From: Andrea Bianco Date: Sat, 16 Jan 2021 07:44:44 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.12 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/www.w3.org/TR/wai-aria-practices?a=commitdiff_plain;h=ee202323a42a93c4d994b433fe61c33043762f4d;p=motion2.git Built motion from commit (unavailable).|2.5.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a085089..337ae79 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-01-15T22:24:01.810Z", + "time": "2021-01-16T07:36:41.608Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 95dfa26..137ac86 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-01-15T22:24:01.810Z", + "time": "2021-01-16T07:36:41.608Z", "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 59650eb..2b22b90 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 _0x645a=['TEXT','sequelize','exports','VIRTUAL','contactManager','integration','motionbar','jscripty','bot','script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x244fda,_0x470d37){var _0xcb6919=function(_0x4ed09d){while(--_0x4ed09d){_0x244fda['push'](_0x244fda['shift']());}};_0xcb6919(++_0x470d37);}(_0x645a,0x15d));var _0xa645=function(_0x465a2f,_0x473c48){_0x465a2f=_0x465a2f-0x0;var _0x329622=_0x645a[_0x465a2f];return _0x329622;};'use strict';var Sequelize=require(_0xa645('0x0'));module[_0xa645('0x1')]={'name':{'type':Sequelize[_0xa645('0x2')],'get':function(_0x5d97e6){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xa645('0x3'),_0xa645('0x4'),_0xa645('0x5'),_0xa645('0x6'),'urlForward','browser',_0xa645('0x7'),_0xa645('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xa645('0x9')](0x1000),'comment':_0xa645('0xa')},'data2':{'type':Sequelize[_0xa645('0x9')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xa645('0x9')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xa645('0x9')](0x1000)},'data5':{'type':Sequelize[_0xa645('0x9')](0x1000)},'data6':{'type':Sequelize[_0xa645('0x9')]},'data7':{'type':Sequelize[_0xa645('0xb')]}}; \ No newline at end of file +var _0xbc4a=['TEXT','exports','getDataValue','STRING','contactManager','motionbar','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]'];(function(_0x332c77,_0x4075e8){var _0x817f56=function(_0x4cb625){while(--_0x4cb625){_0x332c77['push'](_0x332c77['shift']());}};_0x817f56(++_0x4075e8);}(_0xbc4a,0x112));var _0xabc4=function(_0xa25595,_0x4b2503){_0xa25595=_0xa25595-0x0;var _0x4c87c7=_0xbc4a[_0xa25595];return _0x4c87c7;};'use strict';var Sequelize=require('sequelize');module[_0xabc4('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4c5fc8){return this[_0xabc4('0x1')]('action');}},'action':{'type':Sequelize[_0xabc4('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xabc4('0x3'),'integration',_0xabc4('0x4'),_0xabc4('0x5'),_0xabc4('0x6'),_0xabc4('0x7'),_0xabc4('0x8'),'script']],'msg':_0xabc4('0x9')}},'comment':_0xabc4('0x9')},'data1':{'type':Sequelize[_0xabc4('0x2')](0x1000),'comment':_0xabc4('0xa')},'data2':{'type':Sequelize[_0xabc4('0x2')](0x1000),'comment':_0xabc4('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xabc4('0x2')](0x1000)},'data5':{'type':Sequelize[_0xabc4('0x2')](0x1000)},'data6':{'type':Sequelize[_0xabc4('0x2')]},'data7':{'type':Sequelize[_0xabc4('0xc')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 61cb9c4..1b248ec 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 _0x22da=['bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x22da,0x80));var _0xa22d=function(_0x11e51f,_0x5eb8ef){_0x11e51f=_0x11e51f-0x0;var _0x296565=_0x22da[_0x11e51f];return _0x296565;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa22d('0x0'));var zipdir=require(_0xa22d('0x1'));var jsonpatch=require(_0xa22d('0x2'));var rp=require(_0xa22d('0x3'));var moment=require('moment');var BPromise=require(_0xa22d('0x4'));var Mustache=require(_0xa22d('0x5'));var util=require(_0xa22d('0x6'));var path=require(_0xa22d('0x7'));var sox=require('sox');var csv=require(_0xa22d('0x8'));var ejs=require(_0xa22d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa22d('0xa'));var crypto=require(_0xa22d('0xb'));var jsforce=require(_0xa22d('0xc'));var deskjs=require(_0xa22d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa22d('0xe'));var Redis=require(_0xa22d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa22d('0x10'));var as=require(_0xa22d('0x11'));var hardwareService=require(_0xa22d('0x12'));var logger=require(_0xa22d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa22d('0x14'));var licenseUtil=require(_0xa22d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184309,_0x515d6c){_0x515d6c=_0x515d6c||0xcc;return function(_0x983182){if(_0x983182){return _0x184309[_0xa22d('0x16')](_0x515d6c);}return _0x184309[_0xa22d('0x17')](_0x515d6c)['end']();};}function respondWithResult(_0x174a3f,_0x20d7f3){_0x20d7f3=_0x20d7f3||0xc8;return function(_0xc0d11d){if(_0xc0d11d){return _0x174a3f[_0xa22d('0x17')](_0x20d7f3)[_0xa22d('0x18')](_0xc0d11d);}};}function respondWithFilteredResult(_0x4dfa44,_0x132b1d){return function(_0x1b8627){if(_0x1b8627){var _0x2af5c6=_0x1b8627[_0xa22d('0x19')],_0x627117=_0x132b1d[_0xa22d('0x1a')],_0x14a1a7=_0x132b1d[_0xa22d('0x1a')]+_0x132b1d[_0xa22d('0x1b')],_0x2159e1;if(_0x14a1a7>=_0x2af5c6){_0x14a1a7=_0x2af5c6;_0x2159e1=0xc8;}else{_0x2159e1=0xce;}_0x4dfa44[_0xa22d('0x17')](_0x2159e1);return _0x4dfa44[_0xa22d('0x1c')](_0xa22d('0x1d'),_0x627117+'-'+_0x14a1a7+'/'+_0x2af5c6)[_0xa22d('0x18')](_0x1b8627);}return null;};}function patchUpdates(_0x27933b){return function(_0x184604){try{jsonpatch['apply'](_0x184604,_0x27933b,!![]);}catch(_0x177a0f){return BPromise[_0xa22d('0x1e')](_0x177a0f);}return _0x184604[_0xa22d('0x1f')]();};}function saveUpdates(_0x4ed606,_0x4c0aed){return function(_0x5b20f5){if(_0x5b20f5){return _0x5b20f5[_0xa22d('0x20')](_0x4ed606)[_0xa22d('0x21')](function(_0x15f875){return _0x15f875;});}return null;};}function removeEntity(_0x5071e1,_0x389675){return function(_0x45f528){if(_0x45f528){return _0x45f528[_0xa22d('0x22')]()['then'](function(){_0x5071e1[_0xa22d('0x17')](0xcc)[_0xa22d('0x23')]();});}};}function handleEntityNotFound(_0x502219,_0x24701d){return function(_0x18a585){if(!_0x18a585){_0x502219[_0xa22d('0x16')](0x194);}return _0x18a585;};}function handleError(_0x2de6fe,_0x3e1895){_0x3e1895=_0x3e1895||0x1f4;return function(_0x1c83e8){logger[_0xa22d('0x24')](_0x1c83e8['stack']);if(_0x1c83e8['name']){delete _0x1c83e8[_0xa22d('0x25')];}_0x2de6fe[_0xa22d('0x17')](_0x3e1895)[_0xa22d('0x26')](_0x1c83e8);};}exports[_0xa22d('0x20')]=function(_0x33b1c9,_0x291763){if(_0x33b1c9[_0xa22d('0x27')]['id']){delete _0x33b1c9[_0xa22d('0x27')]['id'];}return db[_0xa22d('0x28')][_0xa22d('0x29')]({'where':{'id':_0x33b1c9[_0xa22d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x291763,null))[_0xa22d('0x21')](saveUpdates(_0x33b1c9['body'],null))['then'](respondWithResult(_0x291763,null))[_0xa22d('0x2b')](handleError(_0x291763,null));};exports[_0xa22d('0x22')]=function(_0x2cf10a,_0x12a0f6){return db[_0xa22d('0x28')][_0xa22d('0x29')]({'where':{'id':_0x2cf10a[_0xa22d('0x2a')]['id']}})[_0xa22d('0x21')](handleEntityNotFound(_0x12a0f6,null))['then'](removeEntity(_0x12a0f6,null))[_0xa22d('0x2b')](handleError(_0x12a0f6,null));}; \ No newline at end of file +var _0x6c7b=['bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','destroy','stack','name','send','update','body','Action','find','params','catch','html-pdf','fast-json-patch','moment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2a8167,_0x2ce9d0){_0x2a8167=_0x2a8167-0x0;var _0x483e55=_0x6c7b[_0x2a8167];return _0x483e55;};'use strict';var pdf=require(_0xb6c7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6c7('0x1'));var rp=require('request-promise');var moment=require(_0xb6c7('0x2'));var BPromise=require(_0xb6c7('0x3'));var Mustache=require(_0xb6c7('0x4'));var util=require('util');var path=require(_0xb6c7('0x5'));var sox=require(_0xb6c7('0x6'));var csv=require(_0xb6c7('0x7'));var ejs=require(_0xb6c7('0x8'));var fs=require('fs');var _=require(_0xb6c7('0x9'));var squel=require('squel');var crypto=require(_0xb6c7('0xa'));var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x7'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6c7('0x11'));var logger=require(_0xb6c7('0x12'))(_0xb6c7('0x13'));var utils=require(_0xb6c7('0x14'));var config=require(_0xb6c7('0x15'));var licenseUtil=require(_0xb6c7('0x16'));var db=require(_0xb6c7('0x17'))['db'];function respondWithStatusCode(_0x50c2de,_0x9b32b7){_0x9b32b7=_0x9b32b7||0xcc;return function(_0xa858c5){if(_0xa858c5){return _0x50c2de[_0xb6c7('0x18')](_0x9b32b7);}return _0x50c2de[_0xb6c7('0x19')](_0x9b32b7)[_0xb6c7('0x1a')]();};}function respondWithResult(_0x383ac5,_0x147e4a){_0x147e4a=_0x147e4a||0xc8;return function(_0x561eb4){if(_0x561eb4){return _0x383ac5[_0xb6c7('0x19')](_0x147e4a)['json'](_0x561eb4);}};}function respondWithFilteredResult(_0x480d9a,_0x5d5428){return function(_0x19c145){if(_0x19c145){var _0x48b7ec=_0x19c145[_0xb6c7('0x1b')],_0x45f1a3=_0x5d5428[_0xb6c7('0x1c')],_0x1a2bc9=_0x5d5428[_0xb6c7('0x1c')]+_0x5d5428[_0xb6c7('0x1d')],_0x23971b;if(_0x1a2bc9>=_0x48b7ec){_0x1a2bc9=_0x48b7ec;_0x23971b=0xc8;}else{_0x23971b=0xce;}_0x480d9a[_0xb6c7('0x19')](_0x23971b);return _0x480d9a[_0xb6c7('0x1e')](_0xb6c7('0x1f'),_0x45f1a3+'-'+_0x1a2bc9+'/'+_0x48b7ec)[_0xb6c7('0x20')](_0x19c145);}return null;};}function patchUpdates(_0x3f133f){return function(_0x3beafa){try{jsonpatch['apply'](_0x3beafa,_0x3f133f,!![]);}catch(_0x274f76){return BPromise[_0xb6c7('0x21')](_0x274f76);}return _0x3beafa['save']();};}function saveUpdates(_0x25ca5d,_0x5a1c0a){return function(_0x37f7cb){if(_0x37f7cb){return _0x37f7cb['update'](_0x25ca5d)[_0xb6c7('0x22')](function(_0x4f2960){return _0x4f2960;});}return null;};}function removeEntity(_0x24c0b3,_0x146dd4){return function(_0x4a4788){if(_0x4a4788){return _0x4a4788[_0xb6c7('0x23')]()[_0xb6c7('0x22')](function(){_0x24c0b3[_0xb6c7('0x19')](0xcc)[_0xb6c7('0x1a')]();});}};}function handleEntityNotFound(_0xd33675,_0x1ee45d){return function(_0x54a2ff){if(!_0x54a2ff){_0xd33675[_0xb6c7('0x18')](0x194);}return _0x54a2ff;};}function handleError(_0x1f4e06,_0x209a21){_0x209a21=_0x209a21||0x1f4;return function(_0x418920){logger['error'](_0x418920[_0xb6c7('0x24')]);if(_0x418920[_0xb6c7('0x25')]){delete _0x418920['name'];}_0x1f4e06[_0xb6c7('0x19')](_0x209a21)[_0xb6c7('0x26')](_0x418920);};}exports[_0xb6c7('0x27')]=function(_0x32cd6b,_0x4fb79f){if(_0x32cd6b[_0xb6c7('0x28')]['id']){delete _0x32cd6b['body']['id'];}return db[_0xb6c7('0x29')][_0xb6c7('0x2a')]({'where':{'id':_0x32cd6b[_0xb6c7('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4fb79f,null))['then'](saveUpdates(_0x32cd6b['body'],null))[_0xb6c7('0x22')](respondWithResult(_0x4fb79f,null))[_0xb6c7('0x2c')](handleError(_0x4fb79f,null));};exports[_0xb6c7('0x23')]=function(_0x457df0,_0x41e46c){return db[_0xb6c7('0x29')][_0xb6c7('0x2a')]({'where':{'id':_0x457df0[_0xb6c7('0x2b')]['id']}})[_0xb6c7('0x22')](handleEntityNotFound(_0x41e46c,null))[_0xb6c7('0x22')](removeEntity(_0x41e46c,null))['catch'](handleError(_0x41e46c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8190d9d..b2a88e2 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 _0x9303=['rimraf','../../config/environment','./action.attributes','exports','define','Action','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9303,0xde));var _0x3930=function(_0x26742c,_0xe241ee){_0x26742c=_0x26742c-0x0;var _0x4d9df4=_0x9303[_0x26742c];return _0x4d9df4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3930('0x0'))(_0x3930('0x1'));var moment=require(_0x3930('0x2'));var BPromise=require(_0x3930('0x3'));var rp=require(_0x3930('0x4'));var fs=require('fs');var path=require(_0x3930('0x5'));var rimraf=require(_0x3930('0x6'));var config=require(_0x3930('0x7'));var attributes=require(_0x3930('0x8'));module[_0x3930('0x9')]=function(_0x1a5ee,_0x14085f){return _0x1a5ee[_0x3930('0xa')](_0x3930('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b3=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','util','moment'];(function(_0x10f858,_0x3af3e1){var _0x4bacb8=function(_0xc97570){while(--_0xc97570){_0x10f858['push'](_0x10f858['shift']());}};_0x4bacb8(++_0x3af3e1);}(_0xd9b3,0xce));var _0x3d9b=function(_0x1e3b8f,_0x184b0f){_0x1e3b8f=_0x1e3b8f-0x0;var _0x176773=_0xd9b3[_0x1e3b8f];return _0x176773;};'use strict';var _=require(_0x3d9b('0x0'));var util=require(_0x3d9b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d9b('0x2'));var BPromise=require(_0x3d9b('0x3'));var rp=require(_0x3d9b('0x4'));var fs=require('fs');var path=require(_0x3d9b('0x5'));var rimraf=require(_0x3d9b('0x6'));var config=require(_0x3d9b('0x7'));var attributes=require(_0x3d9b('0x8'));module['exports']=function(_0x682585,_0x5b1e65){return _0x682585[_0x3d9b('0x9')]('Action',attributes,{'tableName':_0x3d9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 0210192..e537f0d 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x315265,_0x28eca2){var _0x6f7c98=function(_0x58d293){while(--_0x58d293){_0x315265['push'](_0x315265['shift']());}};_0x6f7c98(++_0x28eca2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x408c0d,_0x284134){var _0x226808=function(_0x358cf3){while(--_0x358cf3){_0x408c0d['push'](_0x408c0d['shift']());}};_0x226808(++_0x284134);}(_0xe706,0xa3));var _0x6e70=function(_0x2edbea,_0xed922c){_0x2edbea=_0x2edbea-0x0;var _0x40a98b=_0xe706[_0x2edbea];return _0x40a98b;};'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']('Action,\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']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f9d0d6f..993dc1d 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 _0xcee2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x58d84b,_0x3c942e){var _0x1ccde6=function(_0x401939){while(--_0x401939){_0x58d84b['push'](_0x58d84b['shift']());}};_0x1ccde6(++_0x3c942e);}(_0xcee2,0x126));var _0x2cee=function(_0x50fdd6,_0x31485f){_0x50fdd6=_0x50fdd6-0x0;var _0x4380e7=_0xcee2[_0x50fdd6];return _0x4380e7;};'use strict';var multer=require(_0x2cee('0x0'));var util=require(_0x2cee('0x1'));var path=require(_0x2cee('0x2'));var timeout=require(_0x2cee('0x3'));var express=require(_0x2cee('0x4'));var router=express[_0x2cee('0x5')]();var auth=require(_0x2cee('0x6'));var interaction=require(_0x2cee('0x7'));var config=require(_0x2cee('0x8'));var controller=require(_0x2cee('0x9'));router[_0x2cee('0xa')](_0x2cee('0xb'),auth[_0x2cee('0xc')](),controller['update']);router['delete'](_0x2cee('0xb'),auth['isAuthenticated'](),controller[_0x2cee('0xd')]);module[_0x2cee('0xe')]=router; \ No newline at end of file +var _0xcab4=['express','Router','./action.controller','put','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xcab4,0xf0));var _0x4cab=function(_0x3da3c0,_0x1a4514){_0x3da3c0=_0x3da3c0-0x0;var _0x4fc427=_0xcab4[_0x3da3c0];return _0x4fc427;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4cab('0x0'));var timeout=require(_0x4cab('0x1'));var express=require(_0x4cab('0x2'));var router=express[_0x4cab('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4cab('0x4'));router[_0x4cab('0x5')](_0x4cab('0x6'),auth['isAuthenticated'](),controller[_0x4cab('0x7')]);router[_0x4cab('0x8')](_0x4cab('0x6'),auth['isAuthenticated'](),controller[_0x4cab('0x9')]);module[_0x4cab('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index dee00e5..6f4c34b 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 _0xec78=['STRING','TEXT','sequelize','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xec78,0x112));var _0x8ec7=function(_0x5e944a,_0x2847b4){_0x5e944a=_0x5e944a-0x0;var _0x38f07b=_0xec78[_0x5e944a];return _0x38f07b;};'use strict';var Sequelize=require(_0x8ec7('0x0'));module[_0x8ec7('0x1')]={'name':{'type':Sequelize[_0x8ec7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ec7('0x2')]},'parent':{'type':Sequelize[_0x8ec7('0x2')]},'table':{'type':Sequelize[_0x8ec7('0x2')]},'conditions':{'type':Sequelize[_0x8ec7('0x3')]},'joins':{'type':Sequelize[_0x8ec7('0x3')]}}; \ No newline at end of file +var _0x1afe=['exports','STRING','TEXT','sequelize'];(function(_0x13bc84,_0x32a0ee){var _0x45992a=function(_0xe7fb26){while(--_0xe7fb26){_0x13bc84['push'](_0x13bc84['shift']());}};_0x45992a(++_0x32a0ee);}(_0x1afe,0x167));var _0xe1af=function(_0xb3c798,_0x1582e8){_0xb3c798=_0xb3c798-0x0;var _0x4b6ea0=_0x1afe[_0xb3c798];return _0x4b6ea0;};'use strict';var Sequelize=require(_0xe1af('0x0'));module[_0xe1af('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe1af('0x2')]},'parent':{'type':Sequelize[_0xe1af('0x2')]},'table':{'type':Sequelize[_0xe1af('0x2')]},'conditions':{'type':Sequelize[_0xe1af('0x3')]},'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 3b8eed6..1f97190 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 _0x44bd=['end','count','offset','status','set','Content-Range','json','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','left_join','COUNT(DISTINCT\x20%s)','value','metric','groupBy','%s.%s\x20=\x20%s.%s','Limited\x20Query:','SELECT','output','web','fullPath','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','select','countTable','COUNT(*)','run','runReport','IS\x20EMPTY','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus'];(function(_0x481274,_0x1878aa){var _0x34b202=function(_0x12a7f5){while(--_0x12a7f5){_0x481274['push'](_0x481274['shift']());}};_0x34b202(++_0x1878aa);}(_0x44bd,0x1e0));var _0xd44b=function(_0x564078,_0xa93fe6){_0x564078=_0x564078-0x0;var _0x3071c8=_0x44bd[_0x564078];return _0x3071c8;};'use strict';var pdf=require(_0xd44b('0x0'));var emlformat=require(_0xd44b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd44b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd44b('0x3'));var moment=require('moment');var BPromise=require(_0xd44b('0x4'));var Mustache=require(_0xd44b('0x5'));var util=require(_0xd44b('0x6'));var path=require(_0xd44b('0x7'));var sox=require(_0xd44b('0x8'));var csv=require(_0xd44b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd44b('0xa'));var crypto=require(_0xd44b('0xb'));var jsforce=require(_0xd44b('0xc'));var deskjs=require(_0xd44b('0xd'));var toCsv=require(_0xd44b('0x9'));var querystring=require(_0xd44b('0xe'));var Papa=require(_0xd44b('0xf'));var Redis=require(_0xd44b('0x10'));var authService=require(_0xd44b('0x11'));var qs=require(_0xd44b('0x12'));var as=require(_0xd44b('0x13'));var hardwareService=require(_0xd44b('0x14'));var logger=require(_0xd44b('0x15'))(_0xd44b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd44b('0x17'));var db=require(_0xd44b('0x18'))['db'];var dbH=require(_0xd44b('0x18'))[_0xd44b('0x19')];function respondWithStatusCode(_0x24bede,_0x247ea9){_0x247ea9=_0x247ea9||0xcc;return function(_0x230903){if(_0x230903){return _0x24bede[_0xd44b('0x1a')](_0x247ea9);}return _0x24bede['status'](_0x247ea9)[_0xd44b('0x1b')]();};}function respondWithResult(_0x7eca38,_0xa9dab8){_0xa9dab8=_0xa9dab8||0xc8;return function(_0x2458ed){if(_0x2458ed){return _0x7eca38['status'](_0xa9dab8)['json'](_0x2458ed);}};}function respondWithFilteredResult(_0x1836f8,_0x449722){return function(_0x9a9e8){if(_0x9a9e8){var _0x3edd76=_0x9a9e8[_0xd44b('0x1c')],_0x14d9a5=_0x449722['offset'],_0x31c80e=_0x449722[_0xd44b('0x1d')]+_0x449722['limit'],_0x343d53;if(_0x31c80e>=_0x3edd76){_0x31c80e=_0x3edd76;_0x343d53=0xc8;}else{_0x343d53=0xce;}_0x1836f8[_0xd44b('0x1e')](_0x343d53);return _0x1836f8[_0xd44b('0x1f')](_0xd44b('0x20'),_0x14d9a5+'-'+_0x31c80e+'/'+_0x3edd76)[_0xd44b('0x21')](_0x9a9e8);}return null;};}function patchUpdates(_0x149df9){return function(_0x223a7b){try{jsonpatch[_0xd44b('0x22')](_0x223a7b,_0x149df9,!![]);}catch(_0x38ffa5){return BPromise[_0xd44b('0x23')](_0x38ffa5);}return _0x223a7b[_0xd44b('0x24')]();};}function saveUpdates(_0x425dd8,_0x57df9b){return function(_0x1c1ca0){if(_0x1c1ca0){return _0x1c1ca0['update'](_0x425dd8)['then'](function(_0x5716ff){return _0x5716ff;});}return null;};}function removeEntity(_0x3bc552,_0x506a38){return function(_0x13fec3){if(_0x13fec3){return _0x13fec3[_0xd44b('0x25')]()[_0xd44b('0x26')](function(){var _0x325433=_0x13fec3[_0xd44b('0x27')]({'plain':!![]});var _0x54dc48=_0xd44b('0x28');return db[_0xd44b('0x29')][_0xd44b('0x25')]({'where':{'type':_0x54dc48,'resourceId':_0x325433['id']}})[_0xd44b('0x26')](function(){return _0x13fec3;});})[_0xd44b('0x26')](function(){_0x3bc552[_0xd44b('0x1e')](0xcc)[_0xd44b('0x1b')]();});}};}function handleEntityNotFound(_0x2fde47,_0x56f695){return function(_0x30440b){if(!_0x30440b){_0x2fde47[_0xd44b('0x1a')](0x194);}return _0x30440b;};}function handleError(_0x249cd5,_0x11d5f2){_0x11d5f2=_0x11d5f2||0x1f4;return function(_0x48ff84){logger[_0xd44b('0x2a')](_0x48ff84[_0xd44b('0x2b')]);if(_0x48ff84[_0xd44b('0x2c')]){delete _0x48ff84[_0xd44b('0x2c')];}_0x249cd5[_0xd44b('0x1e')](_0x11d5f2)[_0xd44b('0x2d')](_0x48ff84);};}exports[_0xd44b('0x2e')]=function(_0xa49d61,_0x3cd63c){var _0x1c8d6c={},_0xb73cbf={},_0x2765be={'count':0x0,'rows':[]};var _0x236909=_['map'](db[_0xd44b('0x2f')][_0xd44b('0x30')],function(_0x214775){return{'name':_0x214775[_0xd44b('0x31')],'type':_0x214775[_0xd44b('0x32')][_0xd44b('0x33')]};});_0xb73cbf[_0xd44b('0x34')]=_[_0xd44b('0x35')](_0x236909,_0xd44b('0x2c'));_0xb73cbf[_0xd44b('0x36')]=_[_0xd44b('0x37')](_0xa49d61[_0xd44b('0x36')]);_0xb73cbf[_0xd44b('0x38')]=_['intersection'](_0xb73cbf['model'],_0xb73cbf[_0xd44b('0x36')]);_0x1c8d6c['attributes']=_[_0xd44b('0x39')](_0xb73cbf[_0xd44b('0x34')],qs[_0xd44b('0x3a')](_0xa49d61[_0xd44b('0x36')][_0xd44b('0x3a')]));_0x1c8d6c['attributes']=_0x1c8d6c[_0xd44b('0x3b')][_0xd44b('0x3c')]?_0x1c8d6c[_0xd44b('0x3b')]:_0xb73cbf[_0xd44b('0x34')];if(!_0xa49d61[_0xd44b('0x36')][_0xd44b('0x3d')](_0xd44b('0x3e'))){_0x1c8d6c[_0xd44b('0x3f')]=qs[_0xd44b('0x3f')](_0xa49d61[_0xd44b('0x36')]['limit']);_0x1c8d6c[_0xd44b('0x1d')]=qs[_0xd44b('0x1d')](_0xa49d61[_0xd44b('0x36')][_0xd44b('0x1d')]);}_0x1c8d6c[_0xd44b('0x40')]=qs[_0xd44b('0x41')](_0xa49d61[_0xd44b('0x36')][_0xd44b('0x41')]);_0x1c8d6c['where']=qs[_0xd44b('0x38')](_[_0xd44b('0x42')](_0xa49d61[_0xd44b('0x36')],_0xb73cbf[_0xd44b('0x38')]),_0x236909);if(_0xa49d61[_0xd44b('0x36')][_0xd44b('0x43')]){_0x1c8d6c[_0xd44b('0x44')]=_[_0xd44b('0x45')](_0x1c8d6c[_0xd44b('0x44')],{'$or':_[_0xd44b('0x35')](_0x236909,function(_0x1c8690){if(_0x1c8690['type']!==_0xd44b('0x46')){var _0x1a0ef3={};_0x1a0ef3[_0x1c8690[_0xd44b('0x2c')]]={'$like':'%'+_0xa49d61[_0xd44b('0x36')]['filter']+'%'};return _0x1a0ef3;}})});}_0x1c8d6c=_[_0xd44b('0x45')]({},_0x1c8d6c,_0xa49d61[_0xd44b('0x47')]);var _0x168964={'where':_0x1c8d6c[_0xd44b('0x44')]};return db[_0xd44b('0x2f')][_0xd44b('0x1c')](_0x168964)[_0xd44b('0x26')](function(_0x4c99c2){_0x2765be[_0xd44b('0x1c')]=_0x4c99c2;if(_0xa49d61[_0xd44b('0x36')][_0xd44b('0x48')]){_0x1c8d6c['include']=[{'all':!![]}];}return db[_0xd44b('0x2f')][_0xd44b('0x49')](_0x1c8d6c);})[_0xd44b('0x26')](function(_0x374245){_0x2765be[_0xd44b('0x4a')]=_0x374245;return _0x2765be;})[_0xd44b('0x26')](respondWithFilteredResult(_0x3cd63c,_0x1c8d6c))[_0xd44b('0x4b')](handleError(_0x3cd63c,null));};exports[_0xd44b('0x4c')]=function(_0x2c565c,_0x1d1ae7){var _0x56e8d5={'raw':![],'where':{'id':_0x2c565c[_0xd44b('0x4d')]['id']}},_0x2ac203={};_0x2ac203[_0xd44b('0x34')]=_[_0xd44b('0x37')](db[_0xd44b('0x2f')][_0xd44b('0x30')]);_0x2ac203[_0xd44b('0x36')]=_[_0xd44b('0x37')](_0x2c565c['query']);_0x2ac203[_0xd44b('0x38')]=_[_0xd44b('0x39')](_0x2ac203['model'],_0x2ac203[_0xd44b('0x36')]);_0x56e8d5['attributes']=_[_0xd44b('0x39')](_0x2ac203[_0xd44b('0x34')],qs[_0xd44b('0x3a')](_0x2c565c[_0xd44b('0x36')]['fields']));_0x56e8d5[_0xd44b('0x3b')]=_0x56e8d5['attributes'][_0xd44b('0x3c')]?_0x56e8d5[_0xd44b('0x3b')]:_0x2ac203[_0xd44b('0x34')];if(_0x2c565c['query'][_0xd44b('0x48')]){_0x56e8d5[_0xd44b('0x4e')]=[{'all':!![]}];}_0x56e8d5=_['merge']({},_0x56e8d5,_0x2c565c['options']);return db[_0xd44b('0x2f')][_0xd44b('0x4f')](_0x56e8d5)[_0xd44b('0x26')](handleEntityNotFound(_0x1d1ae7,null))[_0xd44b('0x26')](respondWithResult(_0x1d1ae7,null))['catch'](handleError(_0x1d1ae7,null));};exports[_0xd44b('0x50')]=function(_0x3e9f67,_0x460bdd){return db['AnalyticCustomReport']['create'](_0x3e9f67[_0xd44b('0x51')],{})[_0xd44b('0x26')](function(_0x3723c9){var _0x1d8faa=_0x3e9f67['user'][_0xd44b('0x27')]({'plain':!![]});if(!_0x1d8faa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d8faa[_0xd44b('0x52')]==='user'){var _0x5eddea=_0x3723c9[_0xd44b('0x27')]({'plain':!![]});var _0x519714=_0xd44b('0x53');return db['UserProfileSection'][_0xd44b('0x4f')]({'where':{'name':_0x519714,'userProfileId':_0x1d8faa[_0xd44b('0x54')]},'raw':!![]})[_0xd44b('0x26')](function(_0x3f4185){if(_0x3f4185&&_0x3f4185[_0xd44b('0x55')]===0x0){return db[_0xd44b('0x29')][_0xd44b('0x50')]({'name':_0x5eddea[_0xd44b('0x2c')],'resourceId':_0x5eddea['id'],'type':_0xd44b('0x28'),'sectionId':_0x3f4185['id']},{})[_0xd44b('0x26')](function(){return _0x3723c9;});}else{return _0x3723c9;}})[_0xd44b('0x4b')](function(_0x1da76e){logger[_0xd44b('0x2a')](_0xd44b('0x56'),_0x1da76e);throw _0x1da76e;});}return _0x3723c9;})[_0xd44b('0x26')](respondWithResult(_0x460bdd,0xc9))['catch'](handleError(_0x460bdd,null));};exports['update']=function(_0x37594e,_0xb3aa69){if(_0x37594e[_0xd44b('0x51')]['id']){delete _0x37594e[_0xd44b('0x51')]['id'];}return db[_0xd44b('0x2f')]['find']({'where':{'id':_0x37594e[_0xd44b('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb3aa69,null))['then'](saveUpdates(_0x37594e[_0xd44b('0x51')],null))[_0xd44b('0x26')](respondWithResult(_0xb3aa69,null))['catch'](handleError(_0xb3aa69,null));};exports[_0xd44b('0x25')]=function(_0x4b3cfe,_0x182b60){return db[_0xd44b('0x2f')]['find']({'where':{'id':_0x4b3cfe[_0xd44b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x182b60,null))[_0xd44b('0x26')](removeEntity(_0x182b60,null))[_0xd44b('0x4b')](handleError(_0x182b60,null));};exports[_0xd44b('0x57')]=function(_0x20faa0,_0x3b92da){var _0x3f0160=0xa;var _0x4c97e6=[_0xd44b('0x58'),'left_join',_0xd44b('0x59'),_0xd44b('0x5a')];var _0x1c80ee={'SUM':_0xd44b('0x5b'),'COUNT':_0xd44b('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd44b('0x5d'),'MIN':_0xd44b('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd44b('0x5f'),'GROUP_CONCAT ASC':_0xd44b('0x60'),'GROUP_CONCAT DESC':_0xd44b('0x61')};var _0x203aaf={'SEC_TO_TIME':_0xd44b('0x62'),'DATE':_0xd44b('0x63'),'HOUR':_0xd44b('0x64'),'ROUND':_0xd44b('0x65'),'UNIX_TIMESTAMP':_0xd44b('0x66')};var _0xfd0744=function(_0x25e46e){return!_[_0xd44b('0x67')]([_0xd44b('0x68'),_0xd44b('0x69'),'IS\x20EMPTY',_0xd44b('0x6a')],_0x25e46e);};var _0x33d771=function(_0x4467ed){if(!_0x4467ed||!_0x4467ed[_0xd44b('0x6b')][_0xd44b('0x3c')]){return'';}for(var _0x106a8e='(',_0x5a02eb=0x0;_0x5a02eb<_0x4467ed[_0xd44b('0x6b')][_0xd44b('0x3c')];_0x5a02eb+=0x1){_0x5a02eb>0x0&&(_0x106a8e+='\x20'+_0x4467ed[_0xd44b('0x6c')]+'\x20');_0x106a8e+=_0x4467ed[_0xd44b('0x6b')][_0x5a02eb][_0xd44b('0x6d')]?_0x33d771(_0x4467ed[_0xd44b('0x6b')][_0x5a02eb][_0xd44b('0x6d')]):_0x4467ed['rules'][_0x5a02eb][_0xd44b('0x6e')]+'\x20'+_0x4467ed['rules'][_0x5a02eb][_0xd44b('0x6f')]+(_0xfd0744(_0x4467ed[_0xd44b('0x6b')][_0x5a02eb][_0xd44b('0x6f')])?'\x20'+_0x4467ed[_0xd44b('0x6b')][_0x5a02eb]['value']:'');}return _0x106a8e+')';};var _0x44c274={'where':{'id':_0x20faa0['params']['id']}},_0x385a97,_0x25e22c,_0x24ee76,_0x2dfc00,_0x444bb;_0x44c274=_[_0xd44b('0x45')]({},_0x44c274,_0x20faa0[_0xd44b('0x47')]);return db['AnalyticCustomReport'][_0xd44b('0x4f')](_0x44c274)[_0xd44b('0x26')](function(_0x38871d){if(_0x38871d){_0x385a97=_0x38871d;return _0x38871d[_0xd44b('0x70')]();}return null;})[_0xd44b('0x26')](function(_0x5546e4){if(_0x5546e4){if(!_0x5546e4[_0xd44b('0x3c')]){throw new db[(_0xd44b('0x71'))][(_0xd44b('0x72'))](_0xd44b('0x73'),0x193);}_0x25e22c=_0x5546e4;return db[_0xd44b('0x74')][_0xd44b('0x49')]({'raw':!![]});}return null;})[_0xd44b('0x26')](function(_0x11c09d){if(_0x11c09d){_0x24ee76=_[_0xd44b('0x75')](_0x11c09d,'id');var _0x51d852;var _0x52363a=squel['select']();_0x52363a[_0xd44b('0x76')](_0x385a97[_0xd44b('0x77')]);for(var _0x5f2178=0x0;_0x5f2178<_0x25e22c[_0xd44b('0x3c')];_0x5f2178+=0x1){_0x51d852=_0x25e22c[_0x5f2178][_0xd44b('0x78')]?_0x24ee76[_0x25e22c[_0x5f2178][_0xd44b('0x78')]]['metric']:_0x25e22c[_0x5f2178]['field'];_0x51d852=_0x25e22c[_0x5f2178]['function']?_[_0xd44b('0x79')](_0x1c80ee[_0x25e22c[_0x5f2178][_0xd44b('0x7a')]],'%s',_0x51d852):_0x51d852;_0x51d852=_0x25e22c[_0x5f2178][_0xd44b('0x7b')]?_[_0xd44b('0x79')](_0x203aaf[_0x25e22c[_0x5f2178][_0xd44b('0x7b')]],'%s',_0x51d852):_0x51d852;if(_0x25e22c[_0x5f2178]['groupBy']){_0x52363a[_0xd44b('0x6d')](_0x51d852);}_0x25e22c[_0x5f2178][_0xd44b('0x7c')]&&_0x52363a['order'](_0x51d852,_0x25e22c[_0x5f2178]['orderBy']===_0xd44b('0x7d')?![]:!![]);_0x52363a[_0xd44b('0x6e')](_0x51d852,_0x25e22c[_0x5f2178][_0xd44b('0x7e')]||_0x51d852);}if(_0x385a97[_0xd44b('0x7f')]){_0x385a97['joins']=JSON[_0xd44b('0x80')](_0x385a97[_0xd44b('0x7f')]);for(var _0x20e214=0x0;_0x20e214<_0x385a97[_0xd44b('0x7f')]['length'];_0x20e214+=0x1){if(_0x385a97[_0xd44b('0x7f')][_0x20e214][_0xd44b('0x32')]&&_['includes'](_0x4c97e6,_0x385a97[_0xd44b('0x7f')][_0x20e214][_0xd44b('0x32')])&&_0x385a97[_0xd44b('0x7f')][_0x20e214][_0xd44b('0x81')]&&_0x385a97[_0xd44b('0x7f')][_0x20e214][_0xd44b('0x82')]&&_0x385a97[_0xd44b('0x7f')][_0x20e214]['foreignKey']){_0x52363a[_0x385a97[_0xd44b('0x7f')][_0x20e214][_0xd44b('0x32')]](_0x385a97[_0xd44b('0x7f')][_0x20e214][_0xd44b('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x385a97[_0xd44b('0x77')],_0x385a97[_0xd44b('0x7f')][_0x20e214]['parentKey'],_0x385a97[_0xd44b('0x7f')][_0x20e214]['foreignTable'],_0x385a97['joins'][_0x20e214][_0xd44b('0x83')]));}}}if(_0x385a97[_0xd44b('0x84')]){_0x385a97[_0xd44b('0x84')]=JSON['parse'](_0x385a97[_0xd44b('0x84')]);_0x52363a[_0xd44b('0x44')](_0x33d771(_0x385a97[_0xd44b('0x84')][_0xd44b('0x6d')]));}_0x444bb=_0x52363a[_0xd44b('0x85')]();_0x52363a[_0xd44b('0x3f')](_0x3f0160);_0x52363a[_0xd44b('0x1d')](0x0);logger[_0xd44b('0x86')]('Limited\x20Query:',_0x52363a[_0xd44b('0x87')]());return db[_0xd44b('0x88')][_0xd44b('0x36')](_0x52363a[_0xd44b('0x87')](),{'type':db[_0xd44b('0x88')][_0xd44b('0x89')]['SELECT']});}})[_0xd44b('0x26')](respondWithResult(_0x3b92da,null))['catch'](handleError(_0x3b92da,null));};function runReport(_0x4193ee,_0x346a88,_0x21255d){var _0x13176e=_0x346a88[_0xd44b('0x2c')];var _0x3aec97=0xa;var _0x2656a8=[_0xd44b('0x58'),_0xd44b('0x8a'),_0xd44b('0x59'),_0xd44b('0x5a')];var _0x170094={'SUM':'SUM(%s)','COUNT':_0xd44b('0x5c'),'COUNT DISTINCT':_0xd44b('0x8b'),'MAX':_0xd44b('0x5d'),'MIN':_0xd44b('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd44b('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x421a1a={'SEC_TO_TIME':_0xd44b('0x62'),'DATE':'DATE(%s)','HOUR':_0xd44b('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd44b('0x66')};var _0x6a4d13=function(_0x1eb948){return!_[_0xd44b('0x67')](['IS\x20NULL',_0xd44b('0x69'),'IS\x20EMPTY',_0xd44b('0x6a')],_0x1eb948);};var _0x4237a5=function(_0x34e4ba){if(!_0x34e4ba||!_0x34e4ba['rules'][_0xd44b('0x3c')]){return'';}for(var _0x1114c2='(',_0x167398=0x0;_0x167398<_0x34e4ba[_0xd44b('0x6b')][_0xd44b('0x3c')];_0x167398+=0x1){_0x167398>0x0&&(_0x1114c2+='\x20'+_0x34e4ba['operator']+'\x20');_0x1114c2+=_0x34e4ba['rules'][_0x167398][_0xd44b('0x6d')]?_0x4237a5(_0x34e4ba[_0xd44b('0x6b')][_0x167398][_0xd44b('0x6d')]):_0x34e4ba[_0xd44b('0x6b')][_0x167398][_0xd44b('0x6e')]+'\x20'+_0x34e4ba[_0xd44b('0x6b')][_0x167398][_0xd44b('0x6f')]+(_0x6a4d13(_0x34e4ba['rules'][_0x167398][_0xd44b('0x6f')])?'\x20'+_0x34e4ba['rules'][_0x167398][_0xd44b('0x8c')]:'');}return _0x1114c2+')';};var _0x178006={'where':{'id':_0x4193ee['id']}},_0xabddc6,_0x299c35,_0x4dfc11,_0x23293b,_0x1fc2f2;_0x178006=_[_0xd44b('0x45')]({},_0x178006,_0x21255d);return db[_0xd44b('0x2f')][_0xd44b('0x4f')](_0x178006)[_0xd44b('0x26')](function(_0x532282){if(_0x532282){_0xabddc6=_0x532282;return _0x532282[_0xd44b('0x70')]();}return null;})['then'](function(_0x139a0a){if(_0x139a0a){if(!_0x139a0a[_0xd44b('0x3c')]){throw new db['Sequelize'][(_0xd44b('0x72'))](_0xd44b('0x73'),0x193);}_0x299c35=_0x139a0a;return db[_0xd44b('0x74')][_0xd44b('0x49')]({'raw':!![]});}return null;})[_0xd44b('0x26')](function(_0x422e59){if(_0x422e59){_0x4dfc11=_[_0xd44b('0x75')](_0x422e59,'id');var _0x121734;var _0x599142=squel['select']();_0x599142[_0xd44b('0x76')](_0xabddc6[_0xd44b('0x77')]);for(var _0x2062cd=0x0;_0x2062cd<_0x299c35['length'];_0x2062cd+=0x1){_0x121734=_0x299c35[_0x2062cd][_0xd44b('0x78')]?_0x4dfc11[_0x299c35[_0x2062cd][_0xd44b('0x78')]][_0xd44b('0x8d')]:_0x299c35[_0x2062cd][_0xd44b('0x6e')];_0x121734=_0x299c35[_0x2062cd][_0xd44b('0x7a')]?_['replace'](_0x170094[_0x299c35[_0x2062cd]['function']],'%s',_0x121734):_0x121734;_0x121734=_0x299c35[_0x2062cd][_0xd44b('0x7b')]?_['replace'](_0x421a1a[_0x299c35[_0x2062cd][_0xd44b('0x7b')]],'%s',_0x121734):_0x121734;if(_0x299c35[_0x2062cd][_0xd44b('0x8e')]){_0x599142[_0xd44b('0x6d')](_0x121734);}_0x299c35[_0x2062cd]['orderBy']&&_0x599142[_0xd44b('0x40')](_0x121734,_0x299c35[_0x2062cd]['orderBy']===_0xd44b('0x7d')?![]:!![]);_0x599142[_0xd44b('0x6e')](_0x121734,_0x299c35[_0x2062cd]['alias']||_0x121734);}if(_0xabddc6[_0xd44b('0x7f')]){_0xabddc6[_0xd44b('0x7f')]=JSON[_0xd44b('0x80')](_0xabddc6[_0xd44b('0x7f')]);for(var _0x2d4065=0x0;_0x2d4065<_0xabddc6['joins'][_0xd44b('0x3c')];_0x2d4065+=0x1){if(_0xabddc6[_0xd44b('0x7f')][_0x2d4065]['type']&&_[_0xd44b('0x67')](_0x2656a8,_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x32')])&&_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x81')]&&_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x82')]&&_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x83')]){_0x599142[_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x32')]](_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x82')],null,util[_0xd44b('0x7b')](_0xd44b('0x8f'),_0xabddc6[_0xd44b('0x77')],_0xabddc6[_0xd44b('0x7f')][_0x2d4065][_0xd44b('0x81')],_0xabddc6['joins'][_0x2d4065]['foreignTable'],_0xabddc6['joins'][_0x2d4065][_0xd44b('0x83')]));}}}if(_0xabddc6[_0xd44b('0x84')]){_0xabddc6[_0xd44b('0x84')]=JSON[_0xd44b('0x80')](_0xabddc6['conditions']);_0x599142[_0xd44b('0x44')](_0x4237a5(_0xabddc6[_0xd44b('0x84')]['group']));}_0x1fc2f2=_0x599142[_0xd44b('0x85')]();_0x599142[_0xd44b('0x3f')](_0x3aec97);_0x599142[_0xd44b('0x1d')](0x0);logger[_0xd44b('0x86')](_0xd44b('0x90'),_0x599142[_0xd44b('0x87')]());return db['sequelize']['query'](_0x599142[_0xd44b('0x87')](),{'type':db[_0xd44b('0x88')][_0xd44b('0x89')][_0xd44b('0x91')]});}})[_0xd44b('0x26')](function(_0x23c5d9){if(!_0x23c5d9[_0xd44b('0x3c')]){throw new db['Sequelize'][(_0xd44b('0x72'))]('No\x20available\x20data',0xcc);}if(_0x346a88[_0xd44b('0x92')]===_0xd44b('0x93')){return null;}var _0x560183=_['merge'](_0x346a88,{'name':_0x346a88[_0xd44b('0x94')]||_0x346a88[_0xd44b('0x2c')]||_0xabddc6['name'],'basename':_0x13176e,'savename':util[_0xd44b('0x7b')]('%s-%s.%s',_0x346a88[_0xd44b('0x2c')]||_0xabddc6[_0xd44b('0x2c')],require('randomstring')[_0xd44b('0x95')](0x4),_0x346a88[_0xd44b('0x92')]||_0xd44b('0x96')),'reportId':_0xabddc6['id'],'reportType':_0xd44b('0x97')});return db[_0xd44b('0x98')]['create'](_0x560183,{'raw':!![]});})['then'](function(_0x4bef87){if(_0xabddc6['table']===_0xd44b('0x99')){_0x1fc2f2[_0xd44b('0x44')](_0xabddc6['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x346a88[_0xd44b('0x9a')],_0x346a88[_0xd44b('0x9b')]);}else{_0x1fc2f2['where'](_0xabddc6[_0xd44b('0x77')]+_0xd44b('0x9c'),_0x346a88[_0xd44b('0x9a')],_0x346a88[_0xd44b('0x9b')]);}if(_0x4bef87){logger[_0xd44b('0x9d')](_0xd44b('0x9e'),_0x1fc2f2['toString']());require(_0xd44b('0x9f'))[_0xd44b('0xa0')](path[_0xd44b('0x58')](__dirname,_0xd44b('0xa1'),_0x4bef87['output']),[_0x4bef87['id'],_0x1fc2f2[_0xd44b('0x87')](),path[_0xd44b('0x58')](__dirname,_0xd44b('0xa2'),_0x4bef87['savename']),_0x13176e]);return _0x4bef87;}else{var _0x1d6f4f=squel[_0xd44b('0xa3')]();_0x1d6f4f[_0xd44b('0x76')]('('+_0x1fc2f2['toString']()+')',_0xd44b('0xa4'));_0x1d6f4f[_0xd44b('0x6e')](_0xd44b('0xa5'),_0xd44b('0x1c'));_0x1fc2f2[_0xd44b('0x3f')](_0x346a88[_0xd44b('0x3f')]||_0x3aec97);_0x1fc2f2[_0xd44b('0x1d')](_0x346a88['offset']||0x0);return dbH[_0xd44b('0x88')][_0xd44b('0x36')](_0x1d6f4f[_0xd44b('0x87')](),{'type':dbH[_0xd44b('0x88')][_0xd44b('0x89')][_0xd44b('0x91')]})[_0xd44b('0x26')](function(_0x196ff9){if(!_0x196ff9[_0xd44b('0x3c')]){_0x23293b=0x0;}else{_0x23293b=_0x196ff9[0x0][_0xd44b('0x1c')]||0x0;}return dbH[_0xd44b('0x88')][_0xd44b('0x36')](_0x1fc2f2[_0xd44b('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0xd44b('0x91')]});})[_0xd44b('0x26')](function(_0x48b210){return{'rows':_0x48b210||[],'count':_0x23293b};});}});}exports[_0xd44b('0xa6')]=function(_0x53ad58,_0x33fdb4){return runReport(_0x53ad58[_0xd44b('0x4d')],_0x53ad58[_0xd44b('0x36')],_0x53ad58[_0xd44b('0x47')])[_0xd44b('0x26')](respondWithResult(_0x33fdb4,null))[_0xd44b('0x4b')](handleError(_0x33fdb4,null));};exports[_0xd44b('0xa7')]=runReport;exports[_0xd44b('0x36')]=function(_0x3e7de8,_0x3e366c){var _0x3778b2=0xa;var _0x4b2ac8=[_0xd44b('0x58'),_0xd44b('0x8a'),_0xd44b('0x59'),_0xd44b('0x5a')];var _0x2a0194={'SUM':_0xd44b('0x5b'),'COUNT':_0xd44b('0x5c'),'COUNT DISTINCT':_0xd44b('0x8b'),'MAX':_0xd44b('0x5d'),'MIN':_0xd44b('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd44b('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2cac06={'SEC_TO_TIME':_0xd44b('0x62'),'DATE':_0xd44b('0x63'),'HOUR':_0xd44b('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd44b('0x66')};var _0x1a6362=function(_0x3d3f48){return!_[_0xd44b('0x67')]([_0xd44b('0x68'),'IS\x20NOT\x20NULL',_0xd44b('0xa8'),'IS\x20NOT\x20EMPTY'],_0x3d3f48);};var _0x44ddf9=function(_0x4763e4){if(!_0x4763e4||!_0x4763e4[_0xd44b('0x6b')]['length']){return'';}for(var _0x328fed='(',_0x286e1f=0x0;_0x286e1f<_0x4763e4['rules'][_0xd44b('0x3c')];_0x286e1f+=0x1){_0x286e1f>0x0&&(_0x328fed+='\x20'+_0x4763e4[_0xd44b('0x6c')]+'\x20');_0x328fed+=_0x4763e4[_0xd44b('0x6b')][_0x286e1f][_0xd44b('0x6d')]?_0x44ddf9(_0x4763e4[_0xd44b('0x6b')][_0x286e1f][_0xd44b('0x6d')]):_0x4763e4[_0xd44b('0x6b')][_0x286e1f][_0xd44b('0x6e')]+'\x20'+_0x4763e4[_0xd44b('0x6b')][_0x286e1f][_0xd44b('0x6f')]+(_0x1a6362(_0x4763e4[_0xd44b('0x6b')][_0x286e1f][_0xd44b('0x6f')])?'\x20'+_0x4763e4[_0xd44b('0x6b')][_0x286e1f]['value']:'');}return _0x328fed+')';};var _0x1bb273={'where':{'id':_0x3e7de8[_0xd44b('0x4d')]['id']}},_0x142a3d,_0x5ca6ce,_0x581817,_0x436161,_0x29c5f7;_0x1bb273=_['merge']({},_0x1bb273,_0x3e7de8[_0xd44b('0x47')]);return db[_0xd44b('0x2f')][_0xd44b('0x4f')](_0x1bb273)[_0xd44b('0x26')](function(_0x856c0a){if(_0x856c0a){_0x142a3d=_0x856c0a;return _0x856c0a[_0xd44b('0x70')]();}return null;})[_0xd44b('0x26')](function(_0x459e9b){if(_0x459e9b){if(!_0x459e9b[_0xd44b('0x3c')]){throw new db['Sequelize'][(_0xd44b('0x72'))](_0xd44b('0x73'),0x193);}_0x5ca6ce=_0x459e9b;return db[_0xd44b('0x74')]['findAll']({'raw':!![]});}return null;})[_0xd44b('0x26')](function(_0x2bf29e){if(_0x2bf29e){_0x581817=_[_0xd44b('0x75')](_0x2bf29e,'id');var _0x2e4341;var _0x2372a5=squel[_0xd44b('0xa3')]();_0x2372a5[_0xd44b('0x76')](_0x142a3d['table']);for(var _0x36003d=0x0;_0x36003d<_0x5ca6ce[_0xd44b('0x3c')];_0x36003d+=0x1){_0x2e4341=_0x5ca6ce[_0x36003d][_0xd44b('0x78')]?_0x581817[_0x5ca6ce[_0x36003d][_0xd44b('0x78')]][_0xd44b('0x8d')]:_0x5ca6ce[_0x36003d][_0xd44b('0x6e')];_0x2e4341=_0x5ca6ce[_0x36003d][_0xd44b('0x7a')]?_[_0xd44b('0x79')](_0x2a0194[_0x5ca6ce[_0x36003d][_0xd44b('0x7a')]],'%s',_0x2e4341):_0x2e4341;_0x2e4341=_0x5ca6ce[_0x36003d][_0xd44b('0x7b')]?_['replace'](_0x2cac06[_0x5ca6ce[_0x36003d]['format']],'%s',_0x2e4341):_0x2e4341;if(_0x5ca6ce[_0x36003d][_0xd44b('0x8e')]){_0x2372a5[_0xd44b('0x6d')](_0x2e4341);}_0x5ca6ce[_0x36003d]['orderBy']&&_0x2372a5[_0xd44b('0x40')](_0x2e4341,_0x5ca6ce[_0x36003d][_0xd44b('0x7c')]===_0xd44b('0x7d')?![]:!![]);_0x2372a5[_0xd44b('0x6e')](_0x2e4341,_0x5ca6ce[_0x36003d]['alias']||_0x2e4341);}if(_0x142a3d[_0xd44b('0x7f')]){_0x142a3d['joins']=JSON['parse'](_0x142a3d['joins']);for(var _0x25113b=0x0;_0x25113b<_0x142a3d[_0xd44b('0x7f')]['length'];_0x25113b+=0x1){if(_0x142a3d[_0xd44b('0x7f')][_0x25113b]['type']&&_[_0xd44b('0x67')](_0x4b2ac8,_0x142a3d['joins'][_0x25113b]['type'])&&_0x142a3d[_0xd44b('0x7f')][_0x25113b]['parentKey']&&_0x142a3d[_0xd44b('0x7f')][_0x25113b][_0xd44b('0x82')]&&_0x142a3d[_0xd44b('0x7f')][_0x25113b][_0xd44b('0x83')]){_0x2372a5[_0x142a3d[_0xd44b('0x7f')][_0x25113b][_0xd44b('0x32')]](_0x142a3d[_0xd44b('0x7f')][_0x25113b][_0xd44b('0x82')],null,util[_0xd44b('0x7b')](_0xd44b('0x8f'),_0x142a3d[_0xd44b('0x77')],_0x142a3d['joins'][_0x25113b][_0xd44b('0x81')],_0x142a3d[_0xd44b('0x7f')][_0x25113b][_0xd44b('0x82')],_0x142a3d[_0xd44b('0x7f')][_0x25113b][_0xd44b('0x83')]));}}}if(_0x142a3d[_0xd44b('0x84')]){_0x142a3d[_0xd44b('0x84')]=JSON['parse'](_0x142a3d['conditions']);_0x2372a5['where'](_0x44ddf9(_0x142a3d['conditions'][_0xd44b('0x6d')]));}_0x29c5f7=_0x2372a5[_0xd44b('0x85')]();_0x2372a5[_0xd44b('0x3f')](_0x3778b2);_0x2372a5['offset'](0x0);logger[_0xd44b('0x86')]('Limited\x20Query:',_0x2372a5[_0xd44b('0x87')]());return db[_0xd44b('0x88')][_0xd44b('0x36')](_0x2372a5[_0xd44b('0x87')](),{'type':db[_0xd44b('0x88')][_0xd44b('0x89')][_0xd44b('0x91')]});}})['then'](function(){return{'sql':_0x29c5f7[_0xd44b('0x87')]()};})[_0xd44b('0x26')](respondWithResult(_0x3e366c,null))[_0xd44b('0x4b')](handleError(_0x3e366c,null));}; \ No newline at end of file +var _0x0dff=['randomstring','generate','csv','custom','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','html-pdf','rimraf','zip-dir','fast-json-patch','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','../../config/license/util','../../mysqldb','dbH','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomReports','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','filters','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','SELECT','UNIX_TIMESTAMP(%s)','IS\x20NULL','operator','getFields','Sequelize','groupBy','alias','clone','Limited\x20Query:','No\x20available\x20data','output','fullPath','%s-%s.%s'];(function(_0x4f6afc,_0x4dfa88){var _0x256eeb=function(_0x216559){while(--_0x216559){_0x4f6afc['push'](_0x4f6afc['shift']());}};_0x256eeb(++_0x4dfa88);}(_0x0dff,0xbb));var _0xf0df=function(_0x439151,_0x2039d6){_0x439151=_0x439151-0x0;var _0x541956=_0x0dff[_0x439151];return _0x541956;};'use strict';var pdf=require(_0xf0df('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0df('0x1'));var zipdir=require(_0xf0df('0x2'));var jsonpatch=require(_0xf0df('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0df('0x4'));var Mustache=require(_0xf0df('0x5'));var util=require(_0xf0df('0x6'));var path=require(_0xf0df('0x7'));var sox=require(_0xf0df('0x8'));var csv=require(_0xf0df('0x9'));var ejs=require(_0xf0df('0xa'));var fs=require('fs');var _=require(_0xf0df('0xb'));var squel=require(_0xf0df('0xc'));var crypto=require('crypto');var jsforce=require(_0xf0df('0xd'));var deskjs=require(_0xf0df('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf0df('0xf'));var Papa=require(_0xf0df('0x10'));var Redis=require(_0xf0df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf0df('0x12'));var as=require(_0xf0df('0x13'));var hardwareService=require(_0xf0df('0x14'));var logger=require(_0xf0df('0x15'))(_0xf0df('0x16'));var utils=require(_0xf0df('0x17'));var config=require(_0xf0df('0x18'));var licenseUtil=require(_0xf0df('0x19'));var db=require(_0xf0df('0x1a'))['db'];var dbH=require(_0xf0df('0x1a'))[_0xf0df('0x1b')];function respondWithStatusCode(_0x4de092,_0x3d4334){_0x3d4334=_0x3d4334||0xcc;return function(_0x2b9596){if(_0x2b9596){return _0x4de092[_0xf0df('0x1c')](_0x3d4334);}return _0x4de092[_0xf0df('0x1d')](_0x3d4334)['end']();};}function respondWithResult(_0x4b0828,_0x4d66a2){_0x4d66a2=_0x4d66a2||0xc8;return function(_0x35f365){if(_0x35f365){return _0x4b0828[_0xf0df('0x1d')](_0x4d66a2)['json'](_0x35f365);}};}function respondWithFilteredResult(_0x350d4a,_0x14c871){return function(_0x365cdc){if(_0x365cdc){var _0x234023=_0x365cdc[_0xf0df('0x1e')],_0x19da7a=_0x14c871[_0xf0df('0x1f')],_0x2e0165=_0x14c871['offset']+_0x14c871[_0xf0df('0x20')],_0x4310af;if(_0x2e0165>=_0x234023){_0x2e0165=_0x234023;_0x4310af=0xc8;}else{_0x4310af=0xce;}_0x350d4a[_0xf0df('0x1d')](_0x4310af);return _0x350d4a[_0xf0df('0x21')](_0xf0df('0x22'),_0x19da7a+'-'+_0x2e0165+'/'+_0x234023)[_0xf0df('0x23')](_0x365cdc);}return null;};}function patchUpdates(_0x4daa45){return function(_0x474a12){try{jsonpatch[_0xf0df('0x24')](_0x474a12,_0x4daa45,!![]);}catch(_0x5b0d93){return BPromise[_0xf0df('0x25')](_0x5b0d93);}return _0x474a12[_0xf0df('0x26')]();};}function saveUpdates(_0x20b3e7,_0x2ff213){return function(_0x2a29db){if(_0x2a29db){return _0x2a29db[_0xf0df('0x27')](_0x20b3e7)[_0xf0df('0x28')](function(_0x3ad41b){return _0x3ad41b;});}return null;};}function removeEntity(_0x295a3a,_0x931495){return function(_0x4740e4){if(_0x4740e4){return _0x4740e4[_0xf0df('0x29')]()['then'](function(){var _0x3afc73=_0x4740e4[_0xf0df('0x2a')]({'plain':!![]});var _0x1e575d=_0xf0df('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e575d,'resourceId':_0x3afc73['id']}})[_0xf0df('0x28')](function(){return _0x4740e4;});})[_0xf0df('0x28')](function(){_0x295a3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176534,_0xf9fabb){return function(_0x25e33b){if(!_0x25e33b){_0x176534['sendStatus'](0x194);}return _0x25e33b;};}function handleError(_0x40cc3a,_0x5447e4){_0x5447e4=_0x5447e4||0x1f4;return function(_0x237896){logger['error'](_0x237896[_0xf0df('0x2c')]);if(_0x237896[_0xf0df('0x2d')]){delete _0x237896[_0xf0df('0x2d')];}_0x40cc3a[_0xf0df('0x1d')](_0x5447e4)[_0xf0df('0x2e')](_0x237896);};}exports[_0xf0df('0x2f')]=function(_0xd421a2,_0x2aefd1){var _0xb3a6a5={},_0x3436cb={},_0x31947b={'count':0x0,'rows':[]};var _0x24786f=_[_0xf0df('0x30')](db['AnalyticCustomReport'][_0xf0df('0x31')],function(_0x5014b9){return{'name':_0x5014b9[_0xf0df('0x32')],'type':_0x5014b9[_0xf0df('0x33')][_0xf0df('0x34')]};});_0x3436cb[_0xf0df('0x35')]=_[_0xf0df('0x30')](_0x24786f,'name');_0x3436cb[_0xf0df('0x36')]=_['keys'](_0xd421a2[_0xf0df('0x36')]);_0x3436cb['filters']=_[_0xf0df('0x37')](_0x3436cb[_0xf0df('0x35')],_0x3436cb['query']);_0xb3a6a5[_0xf0df('0x38')]=_[_0xf0df('0x37')](_0x3436cb[_0xf0df('0x35')],qs[_0xf0df('0x39')](_0xd421a2[_0xf0df('0x36')][_0xf0df('0x39')]));_0xb3a6a5['attributes']=_0xb3a6a5[_0xf0df('0x38')][_0xf0df('0x3a')]?_0xb3a6a5[_0xf0df('0x38')]:_0x3436cb[_0xf0df('0x35')];if(!_0xd421a2[_0xf0df('0x36')][_0xf0df('0x3b')](_0xf0df('0x3c'))){_0xb3a6a5['limit']=qs[_0xf0df('0x20')](_0xd421a2[_0xf0df('0x36')][_0xf0df('0x20')]);_0xb3a6a5['offset']=qs[_0xf0df('0x1f')](_0xd421a2[_0xf0df('0x36')]['offset']);}_0xb3a6a5[_0xf0df('0x3d')]=qs[_0xf0df('0x3e')](_0xd421a2[_0xf0df('0x36')]['sort']);_0xb3a6a5[_0xf0df('0x3f')]=qs['filters'](_['pick'](_0xd421a2['query'],_0x3436cb['filters']),_0x24786f);if(_0xd421a2[_0xf0df('0x36')]['filter']){_0xb3a6a5[_0xf0df('0x3f')]=_[_0xf0df('0x40')](_0xb3a6a5['where'],{'$or':_['map'](_0x24786f,function(_0x4bc76e){if(_0x4bc76e[_0xf0df('0x33')]!==_0xf0df('0x41')){var _0x4eb08e={};_0x4eb08e[_0x4bc76e[_0xf0df('0x2d')]]={'$like':'%'+_0xd421a2[_0xf0df('0x36')][_0xf0df('0x42')]+'%'};return _0x4eb08e;}})});}_0xb3a6a5=_[_0xf0df('0x40')]({},_0xb3a6a5,_0xd421a2['options']);var _0xde97ff={'where':_0xb3a6a5[_0xf0df('0x3f')]};return db[_0xf0df('0x43')][_0xf0df('0x1e')](_0xde97ff)['then'](function(_0xc1ea85){_0x31947b['count']=_0xc1ea85;if(_0xd421a2['query'][_0xf0df('0x44')]){_0xb3a6a5[_0xf0df('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf0df('0x46')](_0xb3a6a5);})['then'](function(_0x507005){_0x31947b[_0xf0df('0x47')]=_0x507005;return _0x31947b;})[_0xf0df('0x28')](respondWithFilteredResult(_0x2aefd1,_0xb3a6a5))[_0xf0df('0x48')](handleError(_0x2aefd1,null));};exports[_0xf0df('0x49')]=function(_0x432c31,_0x5bd6a2){var _0xc39a88={'raw':![],'where':{'id':_0x432c31[_0xf0df('0x4a')]['id']}},_0x34e86f={};_0x34e86f[_0xf0df('0x35')]=_[_0xf0df('0x4b')](db[_0xf0df('0x43')][_0xf0df('0x31')]);_0x34e86f['query']=_[_0xf0df('0x4b')](_0x432c31[_0xf0df('0x36')]);_0x34e86f[_0xf0df('0x4c')]=_[_0xf0df('0x37')](_0x34e86f[_0xf0df('0x35')],_0x34e86f[_0xf0df('0x36')]);_0xc39a88[_0xf0df('0x38')]=_[_0xf0df('0x37')](_0x34e86f[_0xf0df('0x35')],qs[_0xf0df('0x39')](_0x432c31[_0xf0df('0x36')][_0xf0df('0x39')]));_0xc39a88[_0xf0df('0x38')]=_0xc39a88[_0xf0df('0x38')][_0xf0df('0x3a')]?_0xc39a88[_0xf0df('0x38')]:_0x34e86f['model'];if(_0x432c31[_0xf0df('0x36')][_0xf0df('0x44')]){_0xc39a88['include']=[{'all':!![]}];}_0xc39a88=_['merge']({},_0xc39a88,_0x432c31[_0xf0df('0x4d')]);return db[_0xf0df('0x43')]['find'](_0xc39a88)[_0xf0df('0x28')](handleEntityNotFound(_0x5bd6a2,null))[_0xf0df('0x28')](respondWithResult(_0x5bd6a2,null))[_0xf0df('0x48')](handleError(_0x5bd6a2,null));};exports[_0xf0df('0x4e')]=function(_0x3ada42,_0x17e424){return db[_0xf0df('0x43')][_0xf0df('0x4e')](_0x3ada42[_0xf0df('0x4f')],{})['then'](function(_0x180cb2){var _0x5aa709=_0x3ada42['user'][_0xf0df('0x2a')]({'plain':!![]});if(!_0x5aa709)throw new Error(_0xf0df('0x50'));if(_0x5aa709['role']==='user'){var _0xc31f06=_0x180cb2[_0xf0df('0x2a')]({'plain':!![]});var _0x29bf42=_0xf0df('0x51');return db[_0xf0df('0x52')][_0xf0df('0x53')]({'where':{'name':_0x29bf42,'userProfileId':_0x5aa709[_0xf0df('0x54')]},'raw':!![]})['then'](function(_0x1b0baa){if(_0x1b0baa&&_0x1b0baa[_0xf0df('0x55')]===0x0){return db[_0xf0df('0x56')][_0xf0df('0x4e')]({'name':_0xc31f06['name'],'resourceId':_0xc31f06['id'],'type':'CustomReports','sectionId':_0x1b0baa['id']},{})[_0xf0df('0x28')](function(){return _0x180cb2;});}else{return _0x180cb2;}})[_0xf0df('0x48')](function(_0x4c2d13){logger[_0xf0df('0x57')](_0xf0df('0x58'),_0x4c2d13);throw _0x4c2d13;});}return _0x180cb2;})[_0xf0df('0x28')](respondWithResult(_0x17e424,0xc9))[_0xf0df('0x48')](handleError(_0x17e424,null));};exports[_0xf0df('0x27')]=function(_0x5b938c,_0x38dc00){if(_0x5b938c[_0xf0df('0x4f')]['id']){delete _0x5b938c[_0xf0df('0x4f')]['id'];}return db[_0xf0df('0x43')]['find']({'where':{'id':_0x5b938c[_0xf0df('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38dc00,null))[_0xf0df('0x28')](saveUpdates(_0x5b938c['body'],null))['then'](respondWithResult(_0x38dc00,null))['catch'](handleError(_0x38dc00,null));};exports[_0xf0df('0x29')]=function(_0x28e019,_0x470bf3){return db['AnalyticCustomReport'][_0xf0df('0x53')]({'where':{'id':_0x28e019[_0xf0df('0x4a')]['id']}})[_0xf0df('0x28')](handleEntityNotFound(_0x470bf3,null))['then'](removeEntity(_0x470bf3,null))[_0xf0df('0x48')](handleError(_0x470bf3,null));};exports['preview']=function(_0x27c0fd,_0x4b2992){var _0x57c50=0xa;var _0x298cf3=[_0xf0df('0x59'),_0xf0df('0x5a'),_0xf0df('0x5b'),_0xf0df('0x5c')];var _0x2e969b={'SUM':_0xf0df('0x5d'),'COUNT':_0xf0df('0x5e'),'COUNT DISTINCT':_0xf0df('0x5f'),'MAX':_0xf0df('0x60'),'MIN':_0xf0df('0x61'),'AVG':_0xf0df('0x62'),'GROUP_CONCAT':_0xf0df('0x63'),'GROUP_CONCAT ASC':_0xf0df('0x64'),'GROUP_CONCAT DESC':_0xf0df('0x65')};var _0x37bf87={'SEC_TO_TIME':_0xf0df('0x66'),'DATE':_0xf0df('0x67'),'HOUR':_0xf0df('0x68'),'ROUND':_0xf0df('0x69'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x395015=function(_0xe6652f){return!_[_0xf0df('0x6a')](['IS\x20NULL',_0xf0df('0x6b'),_0xf0df('0x6c'),'IS\x20NOT\x20EMPTY'],_0xe6652f);};var _0x2cc010=function(_0x14923e){if(!_0x14923e||!_0x14923e[_0xf0df('0x6d')][_0xf0df('0x3a')]){return'';}for(var _0x52cada='(',_0x3950b7=0x0;_0x3950b7<_0x14923e[_0xf0df('0x6d')][_0xf0df('0x3a')];_0x3950b7+=0x1){_0x3950b7>0x0&&(_0x52cada+='\x20'+_0x14923e['operator']+'\x20');_0x52cada+=_0x14923e['rules'][_0x3950b7][_0xf0df('0x6e')]?_0x2cc010(_0x14923e[_0xf0df('0x6d')][_0x3950b7][_0xf0df('0x6e')]):_0x14923e['rules'][_0x3950b7][_0xf0df('0x6f')]+'\x20'+_0x14923e[_0xf0df('0x6d')][_0x3950b7][_0xf0df('0x70')]+(_0x395015(_0x14923e[_0xf0df('0x6d')][_0x3950b7][_0xf0df('0x70')])?'\x20'+_0x14923e['rules'][_0x3950b7][_0xf0df('0x71')]:'');}return _0x52cada+')';};var _0x49f96b={'where':{'id':_0x27c0fd[_0xf0df('0x4a')]['id']}},_0x35b925,_0x1601e4,_0x495a2e,_0x6a4a37,_0xe314e4;_0x49f96b=_[_0xf0df('0x40')]({},_0x49f96b,_0x27c0fd['options']);return db[_0xf0df('0x43')][_0xf0df('0x53')](_0x49f96b)[_0xf0df('0x28')](function(_0x2e172b){if(_0x2e172b){_0x35b925=_0x2e172b;return _0x2e172b['getFields']();}return null;})[_0xf0df('0x28')](function(_0x300cf6){if(_0x300cf6){if(!_0x300cf6[_0xf0df('0x3a')]){throw new db['Sequelize'][(_0xf0df('0x72'))](_0xf0df('0x73'),0x193);}_0x1601e4=_0x300cf6;return db[_0xf0df('0x74')][_0xf0df('0x46')]({'raw':!![]});}return null;})[_0xf0df('0x28')](function(_0x3ccdf9){if(_0x3ccdf9){_0x495a2e=_[_0xf0df('0x75')](_0x3ccdf9,'id');var _0x491ebb;var _0x3ff2c6=squel[_0xf0df('0x76')]();_0x3ff2c6[_0xf0df('0x77')](_0x35b925[_0xf0df('0x78')]);for(var _0x888c2d=0x0;_0x888c2d<_0x1601e4['length'];_0x888c2d+=0x1){_0x491ebb=_0x1601e4[_0x888c2d][_0xf0df('0x79')]?_0x495a2e[_0x1601e4[_0x888c2d][_0xf0df('0x79')]][_0xf0df('0x7a')]:_0x1601e4[_0x888c2d]['field'];_0x491ebb=_0x1601e4[_0x888c2d][_0xf0df('0x7b')]?_['replace'](_0x2e969b[_0x1601e4[_0x888c2d][_0xf0df('0x7b')]],'%s',_0x491ebb):_0x491ebb;_0x491ebb=_0x1601e4[_0x888c2d][_0xf0df('0x7c')]?_[_0xf0df('0x7d')](_0x37bf87[_0x1601e4[_0x888c2d][_0xf0df('0x7c')]],'%s',_0x491ebb):_0x491ebb;if(_0x1601e4[_0x888c2d]['groupBy']){_0x3ff2c6[_0xf0df('0x6e')](_0x491ebb);}_0x1601e4[_0x888c2d]['orderBy']&&_0x3ff2c6[_0xf0df('0x3d')](_0x491ebb,_0x1601e4[_0x888c2d][_0xf0df('0x7e')]===_0xf0df('0x7f')?![]:!![]);_0x3ff2c6[_0xf0df('0x6f')](_0x491ebb,_0x1601e4[_0x888c2d]['alias']||_0x491ebb);}if(_0x35b925[_0xf0df('0x80')]){_0x35b925[_0xf0df('0x80')]=JSON[_0xf0df('0x81')](_0x35b925[_0xf0df('0x80')]);for(var _0x35a363=0x0;_0x35a363<_0x35b925['joins']['length'];_0x35a363+=0x1){if(_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x33')]&&_[_0xf0df('0x6a')](_0x298cf3,_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x33')])&&_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x82')]&&_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x83')]&&_0x35b925['joins'][_0x35a363][_0xf0df('0x84')]){_0x3ff2c6[_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x33')]](_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x83')],null,util[_0xf0df('0x7c')](_0xf0df('0x85'),_0x35b925['table'],_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x82')],_0x35b925['joins'][_0x35a363][_0xf0df('0x83')],_0x35b925[_0xf0df('0x80')][_0x35a363][_0xf0df('0x84')]));}}}if(_0x35b925[_0xf0df('0x86')]){_0x35b925['conditions']=JSON[_0xf0df('0x81')](_0x35b925['conditions']);_0x3ff2c6[_0xf0df('0x3f')](_0x2cc010(_0x35b925['conditions'][_0xf0df('0x6e')]));}_0xe314e4=_0x3ff2c6['clone']();_0x3ff2c6['limit'](_0x57c50);_0x3ff2c6['offset'](0x0);logger[_0xf0df('0x87')]('Limited\x20Query:',_0x3ff2c6[_0xf0df('0x88')]());return db[_0xf0df('0x89')]['query'](_0x3ff2c6[_0xf0df('0x88')](),{'type':db['sequelize'][_0xf0df('0x8a')][_0xf0df('0x8b')]});}})[_0xf0df('0x28')](respondWithResult(_0x4b2992,null))[_0xf0df('0x48')](handleError(_0x4b2992,null));};function runReport(_0x3f004c,_0x553bf3,_0x36b6f7){var _0x59d551=_0x553bf3['name'];var _0x1c4f03=0xa;var _0xf09f43=[_0xf0df('0x59'),_0xf0df('0x5a'),'right_join',_0xf0df('0x5c')];var _0x3a8c1a={'SUM':_0xf0df('0x5d'),'COUNT':_0xf0df('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf0df('0x60'),'MIN':_0xf0df('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf0df('0x63'),'GROUP_CONCAT ASC':_0xf0df('0x64'),'GROUP_CONCAT DESC':_0xf0df('0x65')};var _0x4c66e7={'SEC_TO_TIME':_0xf0df('0x66'),'DATE':_0xf0df('0x67'),'HOUR':'HOUR(%s)','ROUND':_0xf0df('0x69'),'UNIX_TIMESTAMP':_0xf0df('0x8c')};var _0x2baeb8=function(_0x2067e8){return!_[_0xf0df('0x6a')]([_0xf0df('0x8d'),'IS\x20NOT\x20NULL',_0xf0df('0x6c'),'IS\x20NOT\x20EMPTY'],_0x2067e8);};var _0x77e934=function(_0x53a7a7){if(!_0x53a7a7||!_0x53a7a7[_0xf0df('0x6d')][_0xf0df('0x3a')]){return'';}for(var _0x59a350='(',_0x40498e=0x0;_0x40498e<_0x53a7a7['rules'][_0xf0df('0x3a')];_0x40498e+=0x1){_0x40498e>0x0&&(_0x59a350+='\x20'+_0x53a7a7[_0xf0df('0x8e')]+'\x20');_0x59a350+=_0x53a7a7[_0xf0df('0x6d')][_0x40498e][_0xf0df('0x6e')]?_0x77e934(_0x53a7a7[_0xf0df('0x6d')][_0x40498e][_0xf0df('0x6e')]):_0x53a7a7['rules'][_0x40498e][_0xf0df('0x6f')]+'\x20'+_0x53a7a7[_0xf0df('0x6d')][_0x40498e][_0xf0df('0x70')]+(_0x2baeb8(_0x53a7a7['rules'][_0x40498e][_0xf0df('0x70')])?'\x20'+_0x53a7a7[_0xf0df('0x6d')][_0x40498e][_0xf0df('0x71')]:'');}return _0x59a350+')';};var _0x2c01e5={'where':{'id':_0x3f004c['id']}},_0x537572,_0x54459d,_0x10188e,_0x253636,_0x4b4196;_0x2c01e5=_[_0xf0df('0x40')]({},_0x2c01e5,_0x36b6f7);return db[_0xf0df('0x43')][_0xf0df('0x53')](_0x2c01e5)[_0xf0df('0x28')](function(_0x483a6e){if(_0x483a6e){_0x537572=_0x483a6e;return _0x483a6e[_0xf0df('0x8f')]();}return null;})[_0xf0df('0x28')](function(_0x55bc51){if(_0x55bc51){if(!_0x55bc51[_0xf0df('0x3a')]){throw new db[(_0xf0df('0x90'))]['ValidationErrorItem'](_0xf0df('0x73'),0x193);}_0x54459d=_0x55bc51;return db[_0xf0df('0x74')][_0xf0df('0x46')]({'raw':!![]});}return null;})[_0xf0df('0x28')](function(_0x36c309){if(_0x36c309){_0x10188e=_[_0xf0df('0x75')](_0x36c309,'id');var _0x22d290;var _0x4444e8=squel['select']();_0x4444e8[_0xf0df('0x77')](_0x537572['table']);for(var _0x5c3c60=0x0;_0x5c3c60<_0x54459d['length'];_0x5c3c60+=0x1){_0x22d290=_0x54459d[_0x5c3c60]['MetricId']?_0x10188e[_0x54459d[_0x5c3c60][_0xf0df('0x79')]]['metric']:_0x54459d[_0x5c3c60][_0xf0df('0x6f')];_0x22d290=_0x54459d[_0x5c3c60][_0xf0df('0x7b')]?_[_0xf0df('0x7d')](_0x3a8c1a[_0x54459d[_0x5c3c60]['function']],'%s',_0x22d290):_0x22d290;_0x22d290=_0x54459d[_0x5c3c60][_0xf0df('0x7c')]?_[_0xf0df('0x7d')](_0x4c66e7[_0x54459d[_0x5c3c60][_0xf0df('0x7c')]],'%s',_0x22d290):_0x22d290;if(_0x54459d[_0x5c3c60][_0xf0df('0x91')]){_0x4444e8['group'](_0x22d290);}_0x54459d[_0x5c3c60][_0xf0df('0x7e')]&&_0x4444e8['order'](_0x22d290,_0x54459d[_0x5c3c60][_0xf0df('0x7e')]===_0xf0df('0x7f')?![]:!![]);_0x4444e8[_0xf0df('0x6f')](_0x22d290,_0x54459d[_0x5c3c60][_0xf0df('0x92')]||_0x22d290);}if(_0x537572[_0xf0df('0x80')]){_0x537572[_0xf0df('0x80')]=JSON[_0xf0df('0x81')](_0x537572[_0xf0df('0x80')]);for(var _0x164d11=0x0;_0x164d11<_0x537572['joins']['length'];_0x164d11+=0x1){if(_0x537572[_0xf0df('0x80')][_0x164d11][_0xf0df('0x33')]&&_[_0xf0df('0x6a')](_0xf09f43,_0x537572[_0xf0df('0x80')][_0x164d11][_0xf0df('0x33')])&&_0x537572['joins'][_0x164d11][_0xf0df('0x82')]&&_0x537572['joins'][_0x164d11]['foreignTable']&&_0x537572['joins'][_0x164d11][_0xf0df('0x84')]){_0x4444e8[_0x537572[_0xf0df('0x80')][_0x164d11][_0xf0df('0x33')]](_0x537572['joins'][_0x164d11][_0xf0df('0x83')],null,util[_0xf0df('0x7c')](_0xf0df('0x85'),_0x537572[_0xf0df('0x78')],_0x537572[_0xf0df('0x80')][_0x164d11]['parentKey'],_0x537572[_0xf0df('0x80')][_0x164d11][_0xf0df('0x83')],_0x537572['joins'][_0x164d11][_0xf0df('0x84')]));}}}if(_0x537572[_0xf0df('0x86')]){_0x537572['conditions']=JSON[_0xf0df('0x81')](_0x537572[_0xf0df('0x86')]);_0x4444e8['where'](_0x77e934(_0x537572[_0xf0df('0x86')][_0xf0df('0x6e')]));}_0x4b4196=_0x4444e8[_0xf0df('0x93')]();_0x4444e8[_0xf0df('0x20')](_0x1c4f03);_0x4444e8[_0xf0df('0x1f')](0x0);logger['debug'](_0xf0df('0x94'),_0x4444e8[_0xf0df('0x88')]());return db[_0xf0df('0x89')][_0xf0df('0x36')](_0x4444e8[_0xf0df('0x88')](),{'type':db[_0xf0df('0x89')][_0xf0df('0x8a')][_0xf0df('0x8b')]});}})[_0xf0df('0x28')](function(_0x31c8d7){if(!_0x31c8d7['length']){throw new db[(_0xf0df('0x90'))]['ValidationErrorItem'](_0xf0df('0x95'),0xcc);}if(_0x553bf3[_0xf0df('0x96')]==='web'){return null;}var _0x4c0113=_[_0xf0df('0x40')](_0x553bf3,{'name':_0x553bf3[_0xf0df('0x97')]||_0x553bf3[_0xf0df('0x2d')]||_0x537572['name'],'basename':_0x59d551,'savename':util[_0xf0df('0x7c')](_0xf0df('0x98'),_0x553bf3['name']||_0x537572['name'],require(_0xf0df('0x99'))[_0xf0df('0x9a')](0x4),_0x553bf3[_0xf0df('0x96')]||_0xf0df('0x9b')),'reportId':_0x537572['id'],'reportType':_0xf0df('0x9c')});return db['AnalyticExtractedReport'][_0xf0df('0x4e')](_0x4c0113,{'raw':!![]});})['then'](function(_0x889f87){if(_0x537572[_0xf0df('0x78')]===_0xf0df('0x9d')){_0x4b4196[_0xf0df('0x3f')](_0x537572[_0xf0df('0x78')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x553bf3[_0xf0df('0x9e')],_0x553bf3['endDate']);}else{_0x4b4196[_0xf0df('0x3f')](_0x537572['table']+_0xf0df('0x9f'),_0x553bf3['startDate'],_0x553bf3[_0xf0df('0xa0')]);}if(_0x889f87){logger[_0xf0df('0xa1')]('Run\x20Query:',_0x4b4196[_0xf0df('0x88')]());require(_0xf0df('0xa2'))[_0xf0df('0xa3')](path[_0xf0df('0x59')](__dirname,_0xf0df('0xa4'),_0x889f87[_0xf0df('0x96')]),[_0x889f87['id'],_0x4b4196[_0xf0df('0x88')](),path[_0xf0df('0x59')](__dirname,_0xf0df('0xa5'),_0x889f87[_0xf0df('0xa6')]),_0x59d551]);return _0x889f87;}else{var _0x491979=squel[_0xf0df('0x76')]();_0x491979[_0xf0df('0x77')]('('+_0x4b4196[_0xf0df('0x88')]()+')',_0xf0df('0xa7'));_0x491979[_0xf0df('0x6f')]('COUNT(*)','count');_0x4b4196[_0xf0df('0x20')](_0x553bf3['limit']||_0x1c4f03);_0x4b4196[_0xf0df('0x1f')](_0x553bf3['offset']||0x0);return dbH[_0xf0df('0x89')]['query'](_0x491979[_0xf0df('0x88')](),{'type':dbH[_0xf0df('0x89')][_0xf0df('0x8a')]['SELECT']})['then'](function(_0x1f5f7c){if(!_0x1f5f7c['length']){_0x253636=0x0;}else{_0x253636=_0x1f5f7c[0x0]['count']||0x0;}return dbH[_0xf0df('0x89')][_0xf0df('0x36')](_0x4b4196[_0xf0df('0x88')](),{'type':dbH[_0xf0df('0x89')][_0xf0df('0x8a')]['SELECT']});})['then'](function(_0x110213){return{'rows':_0x110213||[],'count':_0x253636};});}});}exports[_0xf0df('0xa8')]=function(_0xc0c53a,_0x220c2b){return runReport(_0xc0c53a['params'],_0xc0c53a['query'],_0xc0c53a[_0xf0df('0x4d')])[_0xf0df('0x28')](respondWithResult(_0x220c2b,null))[_0xf0df('0x48')](handleError(_0x220c2b,null));};exports[_0xf0df('0xa9')]=runReport;exports[_0xf0df('0x36')]=function(_0xb6b7f,_0xfba133){var _0x2717ba=0xa;var _0x14dc18=[_0xf0df('0x59'),_0xf0df('0x5a'),_0xf0df('0x5b'),_0xf0df('0x5c')];var _0x2b114d={'SUM':_0xf0df('0x5d'),'COUNT':_0xf0df('0x5e'),'COUNT DISTINCT':_0xf0df('0x5f'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xf0df('0x62'),'GROUP_CONCAT':_0xf0df('0x63'),'GROUP_CONCAT ASC':_0xf0df('0x64'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1ce86c={'SEC_TO_TIME':_0xf0df('0x66'),'DATE':'DATE(%s)','HOUR':_0xf0df('0x68'),'ROUND':_0xf0df('0x69'),'UNIX_TIMESTAMP':_0xf0df('0x8c')};var _0x5d3d82=function(_0x1d4dc9){return!_['includes']([_0xf0df('0x8d'),_0xf0df('0x6b'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1d4dc9);};var _0x29bee4=function(_0x492021){if(!_0x492021||!_0x492021[_0xf0df('0x6d')]['length']){return'';}for(var _0xffccdd='(',_0x571101=0x0;_0x571101<_0x492021[_0xf0df('0x6d')][_0xf0df('0x3a')];_0x571101+=0x1){_0x571101>0x0&&(_0xffccdd+='\x20'+_0x492021[_0xf0df('0x8e')]+'\x20');_0xffccdd+=_0x492021[_0xf0df('0x6d')][_0x571101][_0xf0df('0x6e')]?_0x29bee4(_0x492021[_0xf0df('0x6d')][_0x571101]['group']):_0x492021['rules'][_0x571101][_0xf0df('0x6f')]+'\x20'+_0x492021[_0xf0df('0x6d')][_0x571101]['condition']+(_0x5d3d82(_0x492021[_0xf0df('0x6d')][_0x571101]['condition'])?'\x20'+_0x492021['rules'][_0x571101]['value']:'');}return _0xffccdd+')';};var _0x31b72b={'where':{'id':_0xb6b7f['params']['id']}},_0x447999,_0x3f8a25,_0x37afe4,_0x1ff51f,_0x16676f;_0x31b72b=_[_0xf0df('0x40')]({},_0x31b72b,_0xb6b7f[_0xf0df('0x4d')]);return db['AnalyticCustomReport'][_0xf0df('0x53')](_0x31b72b)[_0xf0df('0x28')](function(_0x23003b){if(_0x23003b){_0x447999=_0x23003b;return _0x23003b['getFields']();}return null;})[_0xf0df('0x28')](function(_0x4d6adb){if(_0x4d6adb){if(!_0x4d6adb[_0xf0df('0x3a')]){throw new db[(_0xf0df('0x90'))][(_0xf0df('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3f8a25=_0x4d6adb;return db[_0xf0df('0x74')][_0xf0df('0x46')]({'raw':!![]});}return null;})[_0xf0df('0x28')](function(_0x76512d){if(_0x76512d){_0x37afe4=_[_0xf0df('0x75')](_0x76512d,'id');var _0x3c2fd2;var _0x4bf767=squel[_0xf0df('0x76')]();_0x4bf767['from'](_0x447999[_0xf0df('0x78')]);for(var _0x1096d8=0x0;_0x1096d8<_0x3f8a25['length'];_0x1096d8+=0x1){_0x3c2fd2=_0x3f8a25[_0x1096d8][_0xf0df('0x79')]?_0x37afe4[_0x3f8a25[_0x1096d8]['MetricId']][_0xf0df('0x7a')]:_0x3f8a25[_0x1096d8]['field'];_0x3c2fd2=_0x3f8a25[_0x1096d8][_0xf0df('0x7b')]?_[_0xf0df('0x7d')](_0x2b114d[_0x3f8a25[_0x1096d8]['function']],'%s',_0x3c2fd2):_0x3c2fd2;_0x3c2fd2=_0x3f8a25[_0x1096d8][_0xf0df('0x7c')]?_[_0xf0df('0x7d')](_0x1ce86c[_0x3f8a25[_0x1096d8][_0xf0df('0x7c')]],'%s',_0x3c2fd2):_0x3c2fd2;if(_0x3f8a25[_0x1096d8][_0xf0df('0x91')]){_0x4bf767[_0xf0df('0x6e')](_0x3c2fd2);}_0x3f8a25[_0x1096d8][_0xf0df('0x7e')]&&_0x4bf767[_0xf0df('0x3d')](_0x3c2fd2,_0x3f8a25[_0x1096d8][_0xf0df('0x7e')]==='DESC'?![]:!![]);_0x4bf767[_0xf0df('0x6f')](_0x3c2fd2,_0x3f8a25[_0x1096d8][_0xf0df('0x92')]||_0x3c2fd2);}if(_0x447999[_0xf0df('0x80')]){_0x447999[_0xf0df('0x80')]=JSON[_0xf0df('0x81')](_0x447999[_0xf0df('0x80')]);for(var _0x4638d0=0x0;_0x4638d0<_0x447999['joins'][_0xf0df('0x3a')];_0x4638d0+=0x1){if(_0x447999[_0xf0df('0x80')][_0x4638d0][_0xf0df('0x33')]&&_[_0xf0df('0x6a')](_0x14dc18,_0x447999['joins'][_0x4638d0][_0xf0df('0x33')])&&_0x447999['joins'][_0x4638d0][_0xf0df('0x82')]&&_0x447999[_0xf0df('0x80')][_0x4638d0]['foreignTable']&&_0x447999[_0xf0df('0x80')][_0x4638d0][_0xf0df('0x84')]){_0x4bf767[_0x447999[_0xf0df('0x80')][_0x4638d0]['type']](_0x447999[_0xf0df('0x80')][_0x4638d0]['foreignTable'],null,util[_0xf0df('0x7c')](_0xf0df('0x85'),_0x447999[_0xf0df('0x78')],_0x447999['joins'][_0x4638d0][_0xf0df('0x82')],_0x447999[_0xf0df('0x80')][_0x4638d0][_0xf0df('0x83')],_0x447999[_0xf0df('0x80')][_0x4638d0][_0xf0df('0x84')]));}}}if(_0x447999['conditions']){_0x447999[_0xf0df('0x86')]=JSON[_0xf0df('0x81')](_0x447999[_0xf0df('0x86')]);_0x4bf767[_0xf0df('0x3f')](_0x29bee4(_0x447999[_0xf0df('0x86')]['group']));}_0x16676f=_0x4bf767[_0xf0df('0x93')]();_0x4bf767[_0xf0df('0x20')](_0x2717ba);_0x4bf767[_0xf0df('0x1f')](0x0);logger[_0xf0df('0x87')]('Limited\x20Query:',_0x4bf767['toString']());return db[_0xf0df('0x89')][_0xf0df('0x36')](_0x4bf767[_0xf0df('0x88')](),{'type':db[_0xf0df('0x89')][_0xf0df('0x8a')]['SELECT']});}})[_0xf0df('0x28')](function(){return{'sql':_0x16676f[_0xf0df('0x88')]()};})[_0xf0df('0x28')](respondWithResult(_0xfba133,null))[_0xf0df('0x48')](handleError(_0xfba133,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9b0afba..b4d2465 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 _0x0553=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x292b9d,_0x123322){var _0x33621e=function(_0x49cd9e){while(--_0x49cd9e){_0x292b9d['push'](_0x292b9d['shift']());}};_0x33621e(++_0x123322);}(_0x0553,0x1a9));var _0x3055=function(_0x2199db,_0x64fe69){_0x2199db=_0x2199db-0x0;var _0x1823bc=_0x0553[_0x2199db];return _0x1823bc;};'use strict';var _=require(_0x3055('0x0'));var util=require(_0x3055('0x1'));var logger=require(_0x3055('0x2'))(_0x3055('0x3'));var moment=require(_0x3055('0x4'));var BPromise=require(_0x3055('0x5'));var rp=require(_0x3055('0x6'));var fs=require('fs');var path=require(_0x3055('0x7'));var rimraf=require(_0x3055('0x8'));var config=require(_0x3055('0x9'));var attributes=require(_0x3055('0xa'));module[_0x3055('0xb')]=function(_0x9a8802,_0x5d9f44){return _0x9a8802[_0x3055('0xc')](_0x3055('0xd'),attributes,{'tableName':_0x3055('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e85=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2e85,0x1c2));var _0x52e8=function(_0x8246e3,_0x1726e8){_0x8246e3=_0x8246e3-0x0;var _0x25d317=_0x2e85[_0x8246e3];return _0x25d317;};'use strict';var _=require(_0x52e8('0x0'));var util=require('util');var logger=require(_0x52e8('0x1'))(_0x52e8('0x2'));var moment=require(_0x52e8('0x3'));var BPromise=require(_0x52e8('0x4'));var rp=require(_0x52e8('0x5'));var fs=require('fs');var path=require(_0x52e8('0x6'));var rimraf=require(_0x52e8('0x7'));var config=require(_0x52e8('0x8'));var attributes=require(_0x52e8('0x9'));module['exports']=function(_0x2d2762,_0x448b95){return _0x2d2762[_0x52e8('0xa')](_0x52e8('0xb'),attributes,{'tableName':_0x52e8('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 d914b45..b112efb 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 _0x1899=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xde1b5,_0x291eca){var _0x52cd92=function(_0x4e02f7){while(--_0x4e02f7){_0xde1b5['push'](_0xde1b5['shift']());}};_0x52cd92(++_0x291eca);}(_0x1899,0x7b));var _0x9189=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x1899[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x9189('0x0'));var util=require(_0x9189('0x1'));var moment=require('moment');var BPromise=require(_0x9189('0x2'));var rs=require(_0x9189('0x3'));var fs=require('fs');var Redis=require(_0x9189('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9189('0x5'))(_0x9189('0x6'));var config=require('../../config/environment');var jayson=require(_0x9189('0x7'));var client=jayson['client'][_0x9189('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5757b4,_0x32d6d1,_0x5f04c8){return new BPromise(function(_0x5e1c02,_0x17b3c6){return client[_0x9189('0x9')](_0x5757b4,_0x5f04c8)['then'](function(_0x413333){logger[_0x9189('0xa')](_0x9189('0xb'),_0x32d6d1,_0x9189('0xc'));logger['debug'](_0x9189('0xd'),_0x32d6d1,_0x9189('0xc'),JSON[_0x9189('0xe')](_0x413333));if(_0x413333[_0x9189('0xf')]){if(_0x413333[_0x9189('0xf')][_0x9189('0x10')]===0x1f4){logger[_0x9189('0xf')](_0x9189('0xb'),_0x32d6d1,_0x413333[_0x9189('0xf')][_0x9189('0x11')]);return _0x17b3c6(_0x413333['error']['message']);}logger[_0x9189('0xf')](_0x9189('0xb'),_0x32d6d1,_0x413333['error'][_0x9189('0x11')]);return _0x5e1c02(_0x413333[_0x9189('0xf')][_0x9189('0x11')]);}else{logger[_0x9189('0xa')](_0x9189('0xb'),_0x32d6d1,_0x9189('0xc'));_0x5e1c02(_0x413333[_0x9189('0x12')][_0x9189('0x11')]);}})[_0x9189('0x13')](function(_0x33ea9c){logger['error'](_0x9189('0xb'),_0x32d6d1,_0x33ea9c);_0x17b3c6(_0x33ea9c);});});} \ No newline at end of file +var _0x5dfa=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x5dfa,0xd6));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa5df('0x0'));var moment=require(_0xa5df('0x1'));var BPromise=require(_0xa5df('0x2'));var rs=require(_0xa5df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5df('0x4'))['db'];var utils=require(_0xa5df('0x5'));var logger=require(_0xa5df('0x6'))(_0xa5df('0x7'));var config=require(_0xa5df('0x8'));var jayson=require(_0xa5df('0x9'));var client=jayson['client'][_0xa5df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f81a,_0x3fcaf8,_0x53c69e){return new BPromise(function(_0xc0b0ed,_0x18c3fa){return client['request'](_0x12f81a,_0x53c69e)['then'](function(_0x5d50ff){logger[_0xa5df('0xb')](_0xa5df('0xc'),_0x3fcaf8,_0xa5df('0xd'));logger[_0xa5df('0xe')](_0xa5df('0xf'),_0x3fcaf8,_0xa5df('0xd'),JSON[_0xa5df('0x10')](_0x5d50ff));if(_0x5d50ff[_0xa5df('0x11')]){if(_0x5d50ff[_0xa5df('0x11')][_0xa5df('0x12')]===0x1f4){logger[_0xa5df('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3fcaf8,_0x5d50ff[_0xa5df('0x11')][_0xa5df('0x13')]);return _0x18c3fa(_0x5d50ff[_0xa5df('0x11')][_0xa5df('0x13')]);}logger[_0xa5df('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3fcaf8,_0x5d50ff[_0xa5df('0x11')][_0xa5df('0x13')]);return _0xc0b0ed(_0x5d50ff[_0xa5df('0x11')][_0xa5df('0x13')]);}else{logger[_0xa5df('0xb')](_0xa5df('0xc'),_0x3fcaf8,'request\x20sent');_0xc0b0ed(_0x5d50ff[_0xa5df('0x14')][_0xa5df('0x13')]);}})[_0xa5df('0x15')](function(_0x106c18){logger[_0xa5df('0x11')](_0xa5df('0xc'),_0x3fcaf8,_0x106c18);_0x18c3fa(_0x106c18);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cdba097..40143df 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 _0xe926=['express','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2d6dc7,_0x4b7e8b){var _0x3e71ce=function(_0x2fad35){while(--_0x2fad35){_0x2d6dc7['push'](_0x2d6dc7['shift']());}};_0x3e71ce(++_0x4b7e8b);}(_0xe926,0x132));var _0x6e92=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xe926[_0x1ca9e9];return _0x309f3c;};'use strict';var multer=require('multer');var util=require(_0x6e92('0x0'));var path=require('path');var timeout=require(_0x6e92('0x1'));var express=require(_0x6e92('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6e92('0x3'));var config=require(_0x6e92('0x4'));var controller=require(_0x6e92('0x5'));router[_0x6e92('0x6')]('/',auth['isAuthenticated'](),controller[_0x6e92('0x7')]);router[_0x6e92('0x6')](_0x6e92('0x8'),auth[_0x6e92('0x9')](),controller['show']);router['get'](_0x6e92('0xa'),auth['isAuthenticated'](),controller[_0x6e92('0xb')]);router[_0x6e92('0x6')](_0x6e92('0xc'),auth[_0x6e92('0x9')](),controller[_0x6e92('0xd')]);router[_0x6e92('0x6')](_0x6e92('0xe'),auth[_0x6e92('0x9')](),controller[_0x6e92('0xf')]);router['post']('/',auth[_0x6e92('0x9')](),controller[_0x6e92('0x10')]);router[_0x6e92('0x11')]('/:id',auth[_0x6e92('0x9')](),controller[_0x6e92('0x12')]);router[_0x6e92('0x13')]('/:id',auth[_0x6e92('0x9')](),controller[_0x6e92('0x14')]);module[_0x6e92('0x15')]=router; \ No newline at end of file +var _0x2ae4=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','put','update','delete','destroy','exports','multer'];(function(_0x3646e3,_0x1703c8){var _0x247596=function(_0x58c235){while(--_0x58c235){_0x3646e3['push'](_0x3646e3['shift']());}};_0x247596(++_0x1703c8);}(_0x2ae4,0xbc));var _0x42ae=function(_0x3da956,_0x6d6137){_0x3da956=_0x3da956-0x0;var _0x24dc45=_0x2ae4[_0x3da956];return _0x24dc45;};'use strict';var multer=require(_0x42ae('0x0'));var util=require(_0x42ae('0x1'));var path=require(_0x42ae('0x2'));var timeout=require(_0x42ae('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x42ae('0x4'));var interaction=require(_0x42ae('0x5'));var config=require(_0x42ae('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x42ae('0x7')]('/',auth[_0x42ae('0x8')](),controller[_0x42ae('0x9')]);router['get'](_0x42ae('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x42ae('0x7')](_0x42ae('0xb'),auth[_0x42ae('0x8')](),controller[_0x42ae('0xc')]);router[_0x42ae('0x7')](_0x42ae('0xd'),auth[_0x42ae('0x8')](),controller[_0x42ae('0xe')]);router[_0x42ae('0x7')]('/:id/query',auth[_0x42ae('0x8')](),controller[_0x42ae('0xf')]);router['post']('/',auth[_0x42ae('0x8')](),controller['create']);router[_0x42ae('0x10')]('/:id',auth[_0x42ae('0x8')](),controller[_0x42ae('0x11')]);router[_0x42ae('0x12')](_0x42ae('0xa'),auth['isAuthenticated'](),controller[_0x42ae('0x13')]);module[_0x42ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index d8b86b2..12128bc 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 _0xe031=['sequelize','exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe031,0xe4));var _0x1e03=function(_0x4bf9c8,_0x2ba3e7){_0x4bf9c8=_0x4bf9c8-0x0;var _0x1c3b6b=_0xe031[_0x4bf9c8];return _0x1c3b6b;};'use strict';var Sequelize=require(_0x1e03('0x0'));module[_0x1e03('0x1')]={'name':{'type':Sequelize[_0x1e03('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1e03('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x1e03('0x2')]},'conditions':{'type':Sequelize[_0x1e03('0x3')]},'joins':{'type':Sequelize[_0x1e03('0x3')]}}; \ No newline at end of file +var _0xbdf6=['exports','STRING','TEXT'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xbdf6,0x147));var _0x6bdf=function(_0x44f555,_0x38b2e5){_0x44f555=_0x44f555-0x0;var _0x29bdaf=_0xbdf6[_0x44f555];return _0x29bdaf;};'use strict';var Sequelize=require('sequelize');module[_0x6bdf('0x0')]={'name':{'type':Sequelize[_0x6bdf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6bdf('0x1')]},'parent':{'type':Sequelize[_0x6bdf('0x1')]},'table':{'type':Sequelize[_0x6bdf('0x1')]},'conditions':{'type':Sequelize[_0x6bdf('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 827f9be..b55b5b6 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 _0xdb6f=['options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','right_join','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','getFields','AnalyticMetric','MetricId','%s.%s\x20=\x20%s.%s','No\x20available\x20data','output','fullPath','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../files/reports','savename','countTable','run','IS\x20NOT\x20NULL','DESC','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','name','send','AnalyticDefaultReport','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x19ec18,_0x4f61ca){var _0x216d53=function(_0x5d6f3a){while(--_0x5d6f3a){_0x19ec18['push'](_0x19ec18['shift']());}};_0x216d53(++_0x4f61ca);}(_0xdb6f,0x64));var _0xfdb6=function(_0xaebd08,_0x1bd66b){_0xaebd08=_0xaebd08-0x0;var _0x1642fa=_0xdb6f[_0xaebd08];return _0x1642fa;};'use strict';var pdf=require(_0xfdb6('0x0'));var emlformat=require(_0xfdb6('0x1'));var rimraf=require(_0xfdb6('0x2'));var zipdir=require(_0xfdb6('0x3'));var jsonpatch=require(_0xfdb6('0x4'));var rp=require(_0xfdb6('0x5'));var moment=require(_0xfdb6('0x6'));var BPromise=require(_0xfdb6('0x7'));var Mustache=require(_0xfdb6('0x8'));var util=require('util');var path=require(_0xfdb6('0x9'));var sox=require(_0xfdb6('0xa'));var csv=require(_0xfdb6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfdb6('0xc'));var squel=require(_0xfdb6('0xd'));var crypto=require(_0xfdb6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfdb6('0xf'));var toCsv=require(_0xfdb6('0xb'));var querystring=require(_0xfdb6('0x10'));var Papa=require(_0xfdb6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfdb6('0x12'));var as=require(_0xfdb6('0x13'));var hardwareService=require(_0xfdb6('0x14'));var logger=require(_0xfdb6('0x15'))(_0xfdb6('0x16'));var utils=require(_0xfdb6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfdb6('0x18'));var db=require(_0xfdb6('0x19'))['db'];var dbH=require(_0xfdb6('0x19'))['dbH'];function respondWithStatusCode(_0x24178b,_0x3595ab){_0x3595ab=_0x3595ab||0xcc;return function(_0x4b8b61){if(_0x4b8b61){return _0x24178b[_0xfdb6('0x1a')](_0x3595ab);}return _0x24178b[_0xfdb6('0x1b')](_0x3595ab)[_0xfdb6('0x1c')]();};}function respondWithResult(_0x3dd485,_0x147753){_0x147753=_0x147753||0xc8;return function(_0x3428dd){if(_0x3428dd){return _0x3dd485['status'](_0x147753)[_0xfdb6('0x1d')](_0x3428dd);}};}function respondWithFilteredResult(_0x23e0fb,_0x431609){return function(_0x378f62){if(_0x378f62){var _0xb4fcd8=_0x378f62[_0xfdb6('0x1e')],_0x30dc54=_0x431609[_0xfdb6('0x1f')],_0x3ce457=_0x431609[_0xfdb6('0x1f')]+_0x431609[_0xfdb6('0x20')],_0x52109f;if(_0x3ce457>=_0xb4fcd8){_0x3ce457=_0xb4fcd8;_0x52109f=0xc8;}else{_0x52109f=0xce;}_0x23e0fb[_0xfdb6('0x1b')](_0x52109f);return _0x23e0fb[_0xfdb6('0x21')](_0xfdb6('0x22'),_0x30dc54+'-'+_0x3ce457+'/'+_0xb4fcd8)[_0xfdb6('0x1d')](_0x378f62);}return null;};}function patchUpdates(_0x5046f6){return function(_0x41bd23){try{jsonpatch[_0xfdb6('0x23')](_0x41bd23,_0x5046f6,!![]);}catch(_0x296f77){return BPromise[_0xfdb6('0x24')](_0x296f77);}return _0x41bd23[_0xfdb6('0x25')]();};}function saveUpdates(_0x299be6,_0x31aa76){return function(_0x1c57fb){if(_0x1c57fb){return _0x1c57fb['update'](_0x299be6)[_0xfdb6('0x26')](function(_0x5f5941){return _0x5f5941;});}return null;};}function removeEntity(_0x39a7ac,_0x1c1ccd){return function(_0x194836){if(_0x194836){return _0x194836[_0xfdb6('0x27')]()['then'](function(){var _0x570944=_0x194836[_0xfdb6('0x28')]({'plain':!![]});var _0x1c27ac=_0xfdb6('0x29');return db['UserProfileResource'][_0xfdb6('0x27')]({'where':{'type':_0x1c27ac,'resourceId':_0x570944['id']}})['then'](function(){return _0x194836;});})[_0xfdb6('0x26')](function(){_0x39a7ac[_0xfdb6('0x1b')](0xcc)[_0xfdb6('0x1c')]();});}};}function handleEntityNotFound(_0x58f298,_0x464554){return function(_0x1b7103){if(!_0x1b7103){_0x58f298['sendStatus'](0x194);}return _0x1b7103;};}function handleError(_0x2b0694,_0x31a102){_0x31a102=_0x31a102||0x1f4;return function(_0x36b7a3){logger['error'](_0x36b7a3['stack']);if(_0x36b7a3[_0xfdb6('0x2a')]){delete _0x36b7a3[_0xfdb6('0x2a')];}_0x2b0694[_0xfdb6('0x1b')](_0x31a102)[_0xfdb6('0x2b')](_0x36b7a3);};}exports['index']=function(_0x1991d6,_0x36c10c){var _0x4903fe={},_0x40456d={},_0x566c8e={'count':0x0,'rows':[]};var _0x529e85=_['map'](db[_0xfdb6('0x2c')][_0xfdb6('0x2d')],function(_0x4a7aad){return{'name':_0x4a7aad['fieldName'],'type':_0x4a7aad[_0xfdb6('0x2e')]['key']};});_0x40456d[_0xfdb6('0x2f')]=_[_0xfdb6('0x30')](_0x529e85,_0xfdb6('0x2a'));_0x40456d['query']=_[_0xfdb6('0x31')](_0x1991d6[_0xfdb6('0x32')]);_0x40456d[_0xfdb6('0x33')]=_[_0xfdb6('0x34')](_0x40456d[_0xfdb6('0x2f')],_0x40456d[_0xfdb6('0x32')]);_0x4903fe[_0xfdb6('0x35')]=_[_0xfdb6('0x34')](_0x40456d['model'],qs['fields'](_0x1991d6[_0xfdb6('0x32')][_0xfdb6('0x36')]));_0x4903fe['attributes']=_0x4903fe[_0xfdb6('0x35')][_0xfdb6('0x37')]?_0x4903fe[_0xfdb6('0x35')]:_0x40456d[_0xfdb6('0x2f')];if(!_0x1991d6['query']['hasOwnProperty'](_0xfdb6('0x38'))){_0x4903fe[_0xfdb6('0x20')]=qs[_0xfdb6('0x20')](_0x1991d6[_0xfdb6('0x32')][_0xfdb6('0x20')]);_0x4903fe[_0xfdb6('0x1f')]=qs['offset'](_0x1991d6[_0xfdb6('0x32')][_0xfdb6('0x1f')]);}_0x4903fe[_0xfdb6('0x39')]=qs[_0xfdb6('0x3a')](_0x1991d6[_0xfdb6('0x32')]['sort']);_0x4903fe[_0xfdb6('0x3b')]=qs[_0xfdb6('0x33')](_[_0xfdb6('0x3c')](_0x1991d6['query'],_0x40456d['filters']),_0x529e85);if(_0x1991d6[_0xfdb6('0x32')][_0xfdb6('0x3d')]){_0x4903fe[_0xfdb6('0x3b')]=_[_0xfdb6('0x3e')](_0x4903fe[_0xfdb6('0x3b')],{'$or':_['map'](_0x529e85,function(_0xc146b1){if(_0xc146b1[_0xfdb6('0x2e')]!==_0xfdb6('0x3f')){var _0x380453={};_0x380453[_0xc146b1[_0xfdb6('0x2a')]]={'$like':'%'+_0x1991d6['query'][_0xfdb6('0x3d')]+'%'};return _0x380453;}})});}_0x4903fe=_[_0xfdb6('0x3e')]({},_0x4903fe,_0x1991d6[_0xfdb6('0x40')]);var _0xce3121={'where':_0x4903fe[_0xfdb6('0x3b')]};return db['AnalyticDefaultReport'][_0xfdb6('0x1e')](_0xce3121)[_0xfdb6('0x26')](function(_0x510b55){_0x566c8e[_0xfdb6('0x1e')]=_0x510b55;if(_0x1991d6[_0xfdb6('0x32')][_0xfdb6('0x41')]){_0x4903fe[_0xfdb6('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xfdb6('0x43')](_0x4903fe);})[_0xfdb6('0x26')](function(_0x1a7632){_0x566c8e[_0xfdb6('0x44')]=_0x1a7632;return _0x566c8e;})[_0xfdb6('0x26')](respondWithFilteredResult(_0x36c10c,_0x4903fe))[_0xfdb6('0x45')](handleError(_0x36c10c,null));};exports[_0xfdb6('0x46')]=function(_0x1e9ca0,_0x142d84){var _0x3b66c5={'raw':!![],'where':{'id':_0x1e9ca0[_0xfdb6('0x47')]['id']}},_0xd94d44={};_0xd94d44[_0xfdb6('0x2f')]=_[_0xfdb6('0x31')](db[_0xfdb6('0x2c')][_0xfdb6('0x2d')]);_0xd94d44[_0xfdb6('0x32')]=_[_0xfdb6('0x31')](_0x1e9ca0[_0xfdb6('0x32')]);_0xd94d44[_0xfdb6('0x33')]=_[_0xfdb6('0x34')](_0xd94d44[_0xfdb6('0x2f')],_0xd94d44[_0xfdb6('0x32')]);_0x3b66c5[_0xfdb6('0x35')]=_[_0xfdb6('0x34')](_0xd94d44[_0xfdb6('0x2f')],qs['fields'](_0x1e9ca0[_0xfdb6('0x32')][_0xfdb6('0x36')]));_0x3b66c5[_0xfdb6('0x35')]=_0x3b66c5[_0xfdb6('0x35')][_0xfdb6('0x37')]?_0x3b66c5['attributes']:_0xd94d44['model'];if(_0x1e9ca0['query'][_0xfdb6('0x41')]){_0x3b66c5['include']=[{'all':!![]}];}_0x3b66c5=_['merge']({},_0x3b66c5,_0x1e9ca0['options']);return db[_0xfdb6('0x2c')]['find'](_0x3b66c5)[_0xfdb6('0x26')](handleEntityNotFound(_0x142d84,null))['then'](respondWithResult(_0x142d84,null))['catch'](handleError(_0x142d84,null));};exports['create']=function(_0x43aaac,_0x1fc8cc){return db[_0xfdb6('0x2c')][_0xfdb6('0x48')](_0x43aaac['body'],{})[_0xfdb6('0x26')](function(_0x4ab529){var _0x3d363a=_0x43aaac[_0xfdb6('0x49')][_0xfdb6('0x28')]({'plain':!![]});if(!_0x3d363a)throw new Error(_0xfdb6('0x4a'));if(_0x3d363a['role']===_0xfdb6('0x49')){var _0x1d5501=_0x4ab529[_0xfdb6('0x28')]({'plain':!![]});var _0x4ea56d='Reports';return db[_0xfdb6('0x4b')][_0xfdb6('0x4c')]({'where':{'name':_0x4ea56d,'userProfileId':_0x3d363a[_0xfdb6('0x4d')]},'raw':!![]})[_0xfdb6('0x26')](function(_0x974b23){if(_0x974b23&&_0x974b23[_0xfdb6('0x4e')]===0x0){return db[_0xfdb6('0x4f')][_0xfdb6('0x48')]({'name':_0x1d5501['name'],'resourceId':_0x1d5501['id'],'type':_0xfdb6('0x29'),'sectionId':_0x974b23['id']},{})[_0xfdb6('0x26')](function(){return _0x4ab529;});}else{return _0x4ab529;}})[_0xfdb6('0x45')](function(_0x5daa9e){logger[_0xfdb6('0x50')](_0xfdb6('0x51'),_0x5daa9e);throw _0x5daa9e;});}return _0x4ab529;})['then'](respondWithResult(_0x1fc8cc,0xc9))[_0xfdb6('0x45')](handleError(_0x1fc8cc,null));};exports[_0xfdb6('0x52')]=function(_0x4a5a24,_0x4905c2){if(_0x4a5a24[_0xfdb6('0x53')]['id']){delete _0x4a5a24[_0xfdb6('0x53')]['id'];}return db[_0xfdb6('0x2c')][_0xfdb6('0x4c')]({'where':{'id':_0x4a5a24[_0xfdb6('0x47')]['id']}})[_0xfdb6('0x26')](handleEntityNotFound(_0x4905c2,null))['then'](saveUpdates(_0x4a5a24['body'],null))['then'](respondWithResult(_0x4905c2,null))[_0xfdb6('0x45')](handleError(_0x4905c2,null));};exports['destroy']=function(_0x5008a0,_0x195289){return db[_0xfdb6('0x2c')][_0xfdb6('0x4c')]({'where':{'id':_0x5008a0[_0xfdb6('0x47')]['id']}})['then'](handleEntityNotFound(_0x195289,null))[_0xfdb6('0x26')](removeEntity(_0x195289,null))[_0xfdb6('0x45')](handleError(_0x195289,null));};exports['preview']=function(_0xf5bed5,_0x2af0b9){var _0x55d671=0xa;var _0x1182a8=[_0xfdb6('0x54'),'left_join','right_join',_0xfdb6('0x55')];var _0x341e4c={'SUM':_0xfdb6('0x56'),'COUNT':_0xfdb6('0x57'),'COUNT DISTINCT':_0xfdb6('0x58'),'MAX':_0xfdb6('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xfdb6('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xfbecdb={'SEC_TO_TIME':_0xfdb6('0x5b'),'DATE':'DATE(%s)','HOUR':_0xfdb6('0x5c'),'ROUND':_0xfdb6('0x5d'),'UNIX_TIMESTAMP':_0xfdb6('0x5e')};var _0x56e34a=function(_0x2cc1b8){return!_[_0xfdb6('0x5f')]([_0xfdb6('0x60'),'IS\x20NOT\x20NULL',_0xfdb6('0x61'),_0xfdb6('0x62')],_0x2cc1b8);};var _0x425022=function(_0x1eea1b){if(!_0x1eea1b||!_0x1eea1b[_0xfdb6('0x63')][_0xfdb6('0x37')]){return'';}for(var _0x1f23a2='(',_0x3c3a88=0x0;_0x3c3a88<_0x1eea1b['rules'][_0xfdb6('0x37')];_0x3c3a88+=0x1){_0x3c3a88>0x0&&(_0x1f23a2+='\x20'+_0x1eea1b[_0xfdb6('0x64')]+'\x20');_0x1f23a2+=_0x1eea1b[_0xfdb6('0x63')][_0x3c3a88][_0xfdb6('0x65')]?_0x425022(_0x1eea1b[_0xfdb6('0x63')][_0x3c3a88][_0xfdb6('0x65')]):_0x1eea1b[_0xfdb6('0x63')][_0x3c3a88][_0xfdb6('0x66')]+'\x20'+_0x1eea1b[_0xfdb6('0x63')][_0x3c3a88][_0xfdb6('0x67')]+(_0x56e34a(_0x1eea1b['rules'][_0x3c3a88]['condition'])?'\x20'+_0x1eea1b[_0xfdb6('0x63')][_0x3c3a88][_0xfdb6('0x68')]:'');}return _0x1f23a2+')';};var _0x3c5a4b={'where':{'id':_0xf5bed5['params']['id']}},_0x50fd32,_0x4e68cc,_0x4d5e7f,_0x4be3c9,_0x2a3028;_0x3c5a4b=_[_0xfdb6('0x3e')]({},_0x3c5a4b,_0xf5bed5[_0xfdb6('0x40')]);return db[_0xfdb6('0x2c')][_0xfdb6('0x4c')](_0x3c5a4b)[_0xfdb6('0x26')](function(_0x18c1db){if(_0x18c1db){_0x50fd32=_0x18c1db;return _0x18c1db['getFields']();}return null;})[_0xfdb6('0x26')](function(_0x3eaa98){if(_0x3eaa98){if(!_0x3eaa98[_0xfdb6('0x37')]){throw new db[(_0xfdb6('0x69'))][(_0xfdb6('0x6a'))](_0xfdb6('0x6b'),0x193);}_0x4e68cc=_0x3eaa98;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xfdb6('0x26')](function(_0x5a49e3){if(_0x5a49e3){_0x4d5e7f=_[_0xfdb6('0x6c')](_0x5a49e3,'id');var _0x3bfe4f;var _0x3a7c3f=squel[_0xfdb6('0x6d')]();_0x3a7c3f[_0xfdb6('0x6e')](_0x50fd32[_0xfdb6('0x6f')]);for(var _0xb85559=0x0;_0xb85559<_0x4e68cc[_0xfdb6('0x37')];_0xb85559+=0x1){_0x3bfe4f=_0x4e68cc[_0xb85559]['MetricId']?_0x4d5e7f[_0x4e68cc[_0xb85559]['MetricId']][_0xfdb6('0x70')]:_0x4e68cc[_0xb85559]['field'];_0x3bfe4f=_0x4e68cc[_0xb85559][_0xfdb6('0x71')]?_[_0xfdb6('0x72')](_0x341e4c[_0x4e68cc[_0xb85559][_0xfdb6('0x71')]],'%s',_0x3bfe4f):_0x3bfe4f;_0x3bfe4f=_0x4e68cc[_0xb85559][_0xfdb6('0x73')]?_[_0xfdb6('0x72')](_0xfbecdb[_0x4e68cc[_0xb85559][_0xfdb6('0x73')]],'%s',_0x3bfe4f):_0x3bfe4f;if(_0x4e68cc[_0xb85559][_0xfdb6('0x74')]){_0x3a7c3f[_0xfdb6('0x65')](_0x3bfe4f);}_0x4e68cc[_0xb85559][_0xfdb6('0x75')]&&_0x3a7c3f['order'](_0x3bfe4f,_0x4e68cc[_0xb85559][_0xfdb6('0x75')]==='DESC'?![]:!![]);_0x3a7c3f[_0xfdb6('0x66')](_0x3bfe4f,_0x4e68cc[_0xb85559][_0xfdb6('0x76')]||_0x3bfe4f);}if(_0x50fd32[_0xfdb6('0x77')]){_0x50fd32[_0xfdb6('0x77')]=JSON[_0xfdb6('0x78')](_0x50fd32[_0xfdb6('0x77')]);for(var _0x25200a=0x0;_0x25200a<_0x50fd32[_0xfdb6('0x77')][_0xfdb6('0x37')];_0x25200a+=0x1){if(_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x2e')]&&_[_0xfdb6('0x5f')](_0x1182a8,_0x50fd32[_0xfdb6('0x77')][_0x25200a]['type'])&&_0x50fd32['joins'][_0x25200a]['parentKey']&&_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x79')]&&_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x7a')]){_0x3a7c3f[_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x2e')]](_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x79')],null,util[_0xfdb6('0x73')]('%s.%s\x20=\x20%s.%s',_0x50fd32[_0xfdb6('0x6f')],_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x7b')],_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x79')],_0x50fd32[_0xfdb6('0x77')][_0x25200a][_0xfdb6('0x7a')]));}}}if(_0x50fd32[_0xfdb6('0x7c')]){_0x50fd32[_0xfdb6('0x7c')]=JSON['parse'](_0x50fd32[_0xfdb6('0x7c')]);_0x3a7c3f[_0xfdb6('0x3b')](_0x425022(_0x50fd32[_0xfdb6('0x7c')][_0xfdb6('0x65')]));}_0x2a3028=_0x3a7c3f[_0xfdb6('0x7d')]();_0x3a7c3f[_0xfdb6('0x20')](_0x55d671);_0x3a7c3f['offset'](0x0);logger[_0xfdb6('0x7e')](_0xfdb6('0x7f'),_0x3a7c3f[_0xfdb6('0x80')]());return db[_0xfdb6('0x81')][_0xfdb6('0x32')](_0x3a7c3f[_0xfdb6('0x80')](),{'type':db['sequelize'][_0xfdb6('0x82')][_0xfdb6('0x83')]});}})[_0xfdb6('0x26')](respondWithResult(_0x2af0b9,null))[_0xfdb6('0x45')](handleError(_0x2af0b9,null));};function runReport(_0x5691b4,_0x8c8157,_0x4c3994){var _0x562e07=_0x8c8157[_0xfdb6('0x2a')];var _0x226ca8=0xa;var _0x366e6f=['join',_0xfdb6('0x84'),_0xfdb6('0x85'),'cross_join'];var _0x5b6b0e={'SUM':_0xfdb6('0x56'),'COUNT':_0xfdb6('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfdb6('0x59'),'MIN':_0xfdb6('0x86'),'AVG':_0xfdb6('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfdb6('0x88'),'GROUP_CONCAT DESC':_0xfdb6('0x89')};var _0x42e7c5={'SEC_TO_TIME':_0xfdb6('0x5b'),'DATE':_0xfdb6('0x8a'),'HOUR':_0xfdb6('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x149ea1=function(_0x27b8b5){return!_['includes']([_0xfdb6('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xfdb6('0x62')],_0x27b8b5);};var _0x56bbdc=function(_0xc53acc){if(!_0xc53acc||!_0xc53acc[_0xfdb6('0x63')][_0xfdb6('0x37')]){return'';}for(var _0x4ab641='(',_0x4bc56c=0x0;_0x4bc56c<_0xc53acc['rules'][_0xfdb6('0x37')];_0x4bc56c+=0x1){_0x4bc56c>0x0&&(_0x4ab641+='\x20'+_0xc53acc[_0xfdb6('0x64')]+'\x20');_0x4ab641+=_0xc53acc[_0xfdb6('0x63')][_0x4bc56c][_0xfdb6('0x65')]?_0x56bbdc(_0xc53acc[_0xfdb6('0x63')][_0x4bc56c][_0xfdb6('0x65')]):_0xc53acc[_0xfdb6('0x63')][_0x4bc56c]['field']+'\x20'+_0xc53acc[_0xfdb6('0x63')][_0x4bc56c][_0xfdb6('0x67')]+(_0x149ea1(_0xc53acc['rules'][_0x4bc56c][_0xfdb6('0x67')])?'\x20'+_0xc53acc[_0xfdb6('0x63')][_0x4bc56c][_0xfdb6('0x68')]:'');}return _0x4ab641+')';};var _0x3cb4a5={'where':{'id':_0x5691b4['id']}},_0x1f445b,_0xbd6e11,_0x1bdb8e,_0x581b7f,_0x7018b5;_0x3cb4a5=_[_0xfdb6('0x3e')]({},_0x3cb4a5,_0x4c3994);return db[_0xfdb6('0x2c')][_0xfdb6('0x4c')](_0x3cb4a5)[_0xfdb6('0x26')](function(_0x107eb4){if(_0x107eb4){_0x1f445b=_0x107eb4;return _0x107eb4[_0xfdb6('0x8b')]();}return null;})[_0xfdb6('0x26')](function(_0x444fed){if(_0x444fed){if(!_0x444fed[_0xfdb6('0x37')]){throw new db['Sequelize'][(_0xfdb6('0x6a'))](_0xfdb6('0x6b'),0x193);}_0xbd6e11=_0x444fed;return db[_0xfdb6('0x8c')][_0xfdb6('0x43')]({'raw':!![]});}return null;})[_0xfdb6('0x26')](function(_0x6680ef){if(_0x6680ef){_0x1bdb8e=_[_0xfdb6('0x6c')](_0x6680ef,'id');var _0x1c496e;var _0x3811ba=squel[_0xfdb6('0x6d')]();_0x3811ba['from'](_0x1f445b[_0xfdb6('0x6f')]);for(var _0x498b9e=0x0;_0x498b9e<_0xbd6e11[_0xfdb6('0x37')];_0x498b9e+=0x1){_0x1c496e=_0xbd6e11[_0x498b9e]['MetricId']?_0x1bdb8e[_0xbd6e11[_0x498b9e][_0xfdb6('0x8d')]]['metric']:_0xbd6e11[_0x498b9e]['field'];_0x1c496e=_0xbd6e11[_0x498b9e]['function']?_['replace'](_0x5b6b0e[_0xbd6e11[_0x498b9e][_0xfdb6('0x71')]],'%s',_0x1c496e):_0x1c496e;_0x1c496e=_0xbd6e11[_0x498b9e][_0xfdb6('0x73')]?_[_0xfdb6('0x72')](_0x42e7c5[_0xbd6e11[_0x498b9e][_0xfdb6('0x73')]],'%s',_0x1c496e):_0x1c496e;if(_0xbd6e11[_0x498b9e][_0xfdb6('0x74')]){_0x3811ba[_0xfdb6('0x65')](_0x1c496e);}_0xbd6e11[_0x498b9e][_0xfdb6('0x75')]&&_0x3811ba[_0xfdb6('0x39')](_0x1c496e,_0xbd6e11[_0x498b9e][_0xfdb6('0x75')]==='DESC'?![]:!![]);_0x3811ba[_0xfdb6('0x66')](_0x1c496e,_0xbd6e11[_0x498b9e][_0xfdb6('0x76')]||_0x1c496e);}if(_0x1f445b[_0xfdb6('0x77')]){_0x1f445b[_0xfdb6('0x77')]=JSON['parse'](_0x1f445b['joins']);for(var _0x246c4d=0x0;_0x246c4d<_0x1f445b['joins'][_0xfdb6('0x37')];_0x246c4d+=0x1){if(_0x1f445b[_0xfdb6('0x77')][_0x246c4d][_0xfdb6('0x2e')]&&_[_0xfdb6('0x5f')](_0x366e6f,_0x1f445b['joins'][_0x246c4d]['type'])&&_0x1f445b[_0xfdb6('0x77')][_0x246c4d][_0xfdb6('0x7b')]&&_0x1f445b[_0xfdb6('0x77')][_0x246c4d]['foreignTable']&&_0x1f445b['joins'][_0x246c4d][_0xfdb6('0x7a')]){_0x3811ba[_0x1f445b['joins'][_0x246c4d][_0xfdb6('0x2e')]](_0x1f445b[_0xfdb6('0x77')][_0x246c4d]['foreignTable'],null,util[_0xfdb6('0x73')](_0xfdb6('0x8e'),_0x1f445b[_0xfdb6('0x6f')],_0x1f445b[_0xfdb6('0x77')][_0x246c4d][_0xfdb6('0x7b')],_0x1f445b[_0xfdb6('0x77')][_0x246c4d][_0xfdb6('0x79')],_0x1f445b[_0xfdb6('0x77')][_0x246c4d]['foreignKey']));}}}if(_0x1f445b[_0xfdb6('0x7c')]){_0x1f445b[_0xfdb6('0x7c')]=JSON[_0xfdb6('0x78')](_0x1f445b[_0xfdb6('0x7c')]);_0x3811ba[_0xfdb6('0x3b')](_0x56bbdc(_0x1f445b[_0xfdb6('0x7c')]['group']));}_0x7018b5=_0x3811ba[_0xfdb6('0x7d')]();_0x3811ba[_0xfdb6('0x20')](_0x226ca8);_0x3811ba['offset'](0x0);logger[_0xfdb6('0x7e')](_0xfdb6('0x7f'),_0x3811ba['toString']());return db[_0xfdb6('0x81')]['query'](_0x3811ba[_0xfdb6('0x80')](),{'type':db[_0xfdb6('0x81')]['QueryTypes'][_0xfdb6('0x83')]});}})[_0xfdb6('0x26')](function(_0x4e64aa){if(!_0x4e64aa[_0xfdb6('0x37')]){throw new db['Sequelize'][(_0xfdb6('0x6a'))](_0xfdb6('0x8f'),0xcc);}if(_0x8c8157[_0xfdb6('0x90')]==='web'){return null;}var _0x2384db=_[_0xfdb6('0x3e')](_0x8c8157,{'name':_0x8c8157[_0xfdb6('0x91')]||_0x8c8157['name']||_0x1f445b[_0xfdb6('0x2a')],'basename':_0x562e07,'savename':util[_0xfdb6('0x73')]('%s-%s.%s',_0x8c8157[_0xfdb6('0x2a')]||_0x1f445b['name'],require(_0xfdb6('0x92'))['generate'](0x4),_0x8c8157[_0xfdb6('0x90')]||_0xfdb6('0x93')),'reportId':_0x1f445b['id'],'reportType':_0xfdb6('0x94')});return db[_0xfdb6('0x95')]['create'](_0x2384db,{'raw':!![]});})[_0xfdb6('0x26')](function(_0x905df5){if(_0x1f445b[_0xfdb6('0x6f')]===_0xfdb6('0x96')){_0x7018b5[_0xfdb6('0x3b')](_0x1f445b['table']+_0xfdb6('0x97'),_0x8c8157[_0xfdb6('0x98')],_0x8c8157[_0xfdb6('0x99')]);}else{_0x7018b5[_0xfdb6('0x3b')](_0x1f445b[_0xfdb6('0x6f')]+_0xfdb6('0x9a'),_0x8c8157[_0xfdb6('0x98')],_0x8c8157['endDate']);}if(_0x905df5){logger[_0xfdb6('0x9b')](_0xfdb6('0x9c'),_0x7018b5['toString']());require('child_process')[_0xfdb6('0x9d')](path[_0xfdb6('0x54')](__dirname,'../../components/export/',_0x905df5[_0xfdb6('0x90')]),[_0x905df5['id'],_0x7018b5['toString'](),path[_0xfdb6('0x54')](__dirname,_0xfdb6('0x9e'),_0x905df5[_0xfdb6('0x9f')]),_0x562e07]);return _0x905df5;}else{var _0x71a5c0=squel['select']();_0x71a5c0[_0xfdb6('0x6e')]('('+_0x7018b5[_0xfdb6('0x80')]()+')',_0xfdb6('0xa0'));_0x71a5c0[_0xfdb6('0x66')]('COUNT(*)',_0xfdb6('0x1e'));_0x7018b5[_0xfdb6('0x20')](_0x8c8157[_0xfdb6('0x20')]||_0x226ca8);_0x7018b5[_0xfdb6('0x1f')](_0x8c8157['offset']||0x0);return dbH[_0xfdb6('0x81')][_0xfdb6('0x32')](_0x71a5c0['toString'](),{'type':dbH[_0xfdb6('0x81')][_0xfdb6('0x82')][_0xfdb6('0x83')]})[_0xfdb6('0x26')](function(_0x586844){if(!_0x586844['length']){_0x581b7f=0x0;}else{_0x581b7f=_0x586844[0x0][_0xfdb6('0x1e')]||0x0;}return dbH[_0xfdb6('0x81')][_0xfdb6('0x32')](_0x7018b5['toString'](),{'type':dbH['sequelize'][_0xfdb6('0x82')][_0xfdb6('0x83')]});})['then'](function(_0x46e4e0){return{'rows':_0x46e4e0||[],'count':_0x581b7f};});}});}exports[_0xfdb6('0xa1')]=function(_0x29e328,_0x55732b){return runReport(_0x29e328['params'],_0x29e328[_0xfdb6('0x32')],_0x29e328[_0xfdb6('0x40')])[_0xfdb6('0x26')](respondWithResult(_0x55732b,null))[_0xfdb6('0x45')](handleError(_0x55732b,null));};exports['runReport']=runReport;exports[_0xfdb6('0x32')]=function(_0x3fe88c,_0x46e5ff){var _0x1ea6e6=0xa;var _0x633617=['join',_0xfdb6('0x84'),_0xfdb6('0x85'),_0xfdb6('0x55')];var _0x40e150={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfdb6('0x58'),'MAX':_0xfdb6('0x59'),'MIN':_0xfdb6('0x86'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfdb6('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x35e51a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfdb6('0x8a'),'HOUR':_0xfdb6('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfdb6('0x5e')};var _0x450279=function(_0x1a0809){return!_[_0xfdb6('0x5f')]([_0xfdb6('0x60'),_0xfdb6('0xa2'),'IS\x20EMPTY',_0xfdb6('0x62')],_0x1a0809);};var _0x38c9b7=function(_0x53a49b){if(!_0x53a49b||!_0x53a49b[_0xfdb6('0x63')][_0xfdb6('0x37')]){return'';}for(var _0x42565e='(',_0x5928b1=0x0;_0x5928b1<_0x53a49b[_0xfdb6('0x63')][_0xfdb6('0x37')];_0x5928b1+=0x1){_0x5928b1>0x0&&(_0x42565e+='\x20'+_0x53a49b[_0xfdb6('0x64')]+'\x20');_0x42565e+=_0x53a49b[_0xfdb6('0x63')][_0x5928b1][_0xfdb6('0x65')]?_0x38c9b7(_0x53a49b['rules'][_0x5928b1][_0xfdb6('0x65')]):_0x53a49b[_0xfdb6('0x63')][_0x5928b1][_0xfdb6('0x66')]+'\x20'+_0x53a49b[_0xfdb6('0x63')][_0x5928b1][_0xfdb6('0x67')]+(_0x450279(_0x53a49b[_0xfdb6('0x63')][_0x5928b1]['condition'])?'\x20'+_0x53a49b[_0xfdb6('0x63')][_0x5928b1][_0xfdb6('0x68')]:'');}return _0x42565e+')';};var _0x25e891={'where':{'id':_0x3fe88c[_0xfdb6('0x47')]['id']}},_0x48dc8a,_0x19cd9b,_0xf5fcbc,_0x5c7e0a,_0x3c1d6b;_0x25e891=_['merge']({},_0x25e891,_0x3fe88c[_0xfdb6('0x40')]);return db[_0xfdb6('0x2c')][_0xfdb6('0x4c')](_0x25e891)[_0xfdb6('0x26')](function(_0x3b0593){if(_0x3b0593){_0x48dc8a=_0x3b0593;return _0x3b0593[_0xfdb6('0x8b')]();}return null;})[_0xfdb6('0x26')](function(_0x1a09a4){if(_0x1a09a4){if(!_0x1a09a4[_0xfdb6('0x37')]){throw new db['Sequelize'][(_0xfdb6('0x6a'))](_0xfdb6('0x6b'),0x193);}_0x19cd9b=_0x1a09a4;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xfdb6('0x26')](function(_0xb9dc10){if(_0xb9dc10){_0xf5fcbc=_[_0xfdb6('0x6c')](_0xb9dc10,'id');var _0x167934;var _0x4ded7a=squel['select']();_0x4ded7a[_0xfdb6('0x6e')](_0x48dc8a[_0xfdb6('0x6f')]);for(var _0x204809=0x0;_0x204809<_0x19cd9b[_0xfdb6('0x37')];_0x204809+=0x1){_0x167934=_0x19cd9b[_0x204809][_0xfdb6('0x8d')]?_0xf5fcbc[_0x19cd9b[_0x204809][_0xfdb6('0x8d')]]['metric']:_0x19cd9b[_0x204809][_0xfdb6('0x66')];_0x167934=_0x19cd9b[_0x204809][_0xfdb6('0x71')]?_['replace'](_0x40e150[_0x19cd9b[_0x204809]['function']],'%s',_0x167934):_0x167934;_0x167934=_0x19cd9b[_0x204809][_0xfdb6('0x73')]?_[_0xfdb6('0x72')](_0x35e51a[_0x19cd9b[_0x204809]['format']],'%s',_0x167934):_0x167934;if(_0x19cd9b[_0x204809]['groupBy']){_0x4ded7a[_0xfdb6('0x65')](_0x167934);}_0x19cd9b[_0x204809]['orderBy']&&_0x4ded7a[_0xfdb6('0x39')](_0x167934,_0x19cd9b[_0x204809][_0xfdb6('0x75')]===_0xfdb6('0xa3')?![]:!![]);_0x4ded7a['field'](_0x167934,_0x19cd9b[_0x204809][_0xfdb6('0x76')]||_0x167934);}if(_0x48dc8a['joins']){_0x48dc8a[_0xfdb6('0x77')]=JSON[_0xfdb6('0x78')](_0x48dc8a['joins']);for(var _0x221afa=0x0;_0x221afa<_0x48dc8a[_0xfdb6('0x77')]['length'];_0x221afa+=0x1){if(_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x2e')]&&_[_0xfdb6('0x5f')](_0x633617,_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x2e')])&&_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x7b')]&&_0x48dc8a['joins'][_0x221afa]['foreignTable']&&_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x7a')]){_0x4ded7a[_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x2e')]](_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x79')],null,util['format'](_0xfdb6('0x8e'),_0x48dc8a[_0xfdb6('0x6f')],_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x7b')],_0x48dc8a[_0xfdb6('0x77')][_0x221afa]['foreignTable'],_0x48dc8a[_0xfdb6('0x77')][_0x221afa][_0xfdb6('0x7a')]));}}}if(_0x48dc8a[_0xfdb6('0x7c')]){_0x48dc8a['conditions']=JSON[_0xfdb6('0x78')](_0x48dc8a['conditions']);_0x4ded7a[_0xfdb6('0x3b')](_0x38c9b7(_0x48dc8a[_0xfdb6('0x7c')][_0xfdb6('0x65')]));}_0x3c1d6b=_0x4ded7a[_0xfdb6('0x7d')]();_0x4ded7a['limit'](_0x1ea6e6);_0x4ded7a[_0xfdb6('0x1f')](0x0);logger['debug'](_0xfdb6('0x7f'),_0x4ded7a[_0xfdb6('0x80')]());return db[_0xfdb6('0x81')][_0xfdb6('0x32')](_0x4ded7a['toString'](),{'type':db[_0xfdb6('0x81')][_0xfdb6('0x82')][_0xfdb6('0x83')]});}})[_0xfdb6('0x26')](function(){return{'sql':_0x3c1d6b[_0xfdb6('0x80')]()};})[_0xfdb6('0x26')](respondWithResult(_0x46e5ff,null))[_0xfdb6('0x45')](handleError(_0x46e5ff,null));}; \ No newline at end of file +var _0x50a5=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','get','DefaultReports','sendStatus','error','stack','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','limit','order','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','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','preview','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','MAX(%s)','SEC_TO_TIME(%s)','DATE(%s)','IS\x20NOT\x20NULL','operator','Sequelize','function','%s.%s\x20=\x20%s.%s','debug','Limited\x20Query:','ValidationErrorItem','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','fork','../../components/export/','../../files/reports','countTable','run','clone','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x2ada6a,_0x49cece){var _0x42b8fa=function(_0x503f4f){while(--_0x503f4f){_0x2ada6a['push'](_0x2ada6a['shift']());}};_0x42b8fa(++_0x49cece);}(_0x50a5,0x1e8));var _0x550a=function(_0x49addc,_0x6b5550){_0x49addc=_0x49addc-0x0;var _0x362be4=_0x50a5[_0x49addc];return _0x362be4;};'use strict';var pdf=require(_0x550a('0x0'));var emlformat=require(_0x550a('0x1'));var rimraf=require(_0x550a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x550a('0x3'));var rp=require(_0x550a('0x4'));var moment=require(_0x550a('0x5'));var BPromise=require(_0x550a('0x6'));var Mustache=require(_0x550a('0x7'));var util=require(_0x550a('0x8'));var path=require(_0x550a('0x9'));var sox=require(_0x550a('0xa'));var csv=require(_0x550a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x550a('0xc'));var crypto=require('crypto');var jsforce=require(_0x550a('0xd'));var deskjs=require(_0x550a('0xe'));var toCsv=require(_0x550a('0xb'));var querystring=require(_0x550a('0xf'));var Papa=require(_0x550a('0x10'));var Redis=require(_0x550a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x550a('0x12'));var hardwareService=require(_0x550a('0x13'));var logger=require('../../config/logger')(_0x550a('0x14'));var utils=require(_0x550a('0x15'));var config=require(_0x550a('0x16'));var licenseUtil=require(_0x550a('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x550a('0x18'))[_0x550a('0x19')];function respondWithStatusCode(_0x2af334,_0x3dda40){_0x3dda40=_0x3dda40||0xcc;return function(_0x4c7bc8){if(_0x4c7bc8){return _0x2af334['sendStatus'](_0x3dda40);}return _0x2af334[_0x550a('0x1a')](_0x3dda40)[_0x550a('0x1b')]();};}function respondWithResult(_0x544753,_0x38e508){_0x38e508=_0x38e508||0xc8;return function(_0x405bbd){if(_0x405bbd){return _0x544753['status'](_0x38e508)[_0x550a('0x1c')](_0x405bbd);}};}function respondWithFilteredResult(_0x4a0649,_0x143feb){return function(_0x1b3a78){if(_0x1b3a78){var _0x5760d7=_0x1b3a78[_0x550a('0x1d')],_0xad8156=_0x143feb[_0x550a('0x1e')],_0x20c612=_0x143feb[_0x550a('0x1e')]+_0x143feb['limit'],_0x2e7a76;if(_0x20c612>=_0x5760d7){_0x20c612=_0x5760d7;_0x2e7a76=0xc8;}else{_0x2e7a76=0xce;}_0x4a0649['status'](_0x2e7a76);return _0x4a0649[_0x550a('0x1f')](_0x550a('0x20'),_0xad8156+'-'+_0x20c612+'/'+_0x5760d7)[_0x550a('0x1c')](_0x1b3a78);}return null;};}function patchUpdates(_0x42d01e){return function(_0x974503){try{jsonpatch[_0x550a('0x21')](_0x974503,_0x42d01e,!![]);}catch(_0x48fb92){return BPromise['reject'](_0x48fb92);}return _0x974503[_0x550a('0x22')]();};}function saveUpdates(_0x2ab031,_0x204d2c){return function(_0x5513ce){if(_0x5513ce){return _0x5513ce['update'](_0x2ab031)[_0x550a('0x23')](function(_0x22da0c){return _0x22da0c;});}return null;};}function removeEntity(_0x29a713,_0x203d13){return function(_0x5cbd2a){if(_0x5cbd2a){return _0x5cbd2a[_0x550a('0x24')]()['then'](function(){var _0x33da72=_0x5cbd2a[_0x550a('0x25')]({'plain':!![]});var _0x1a4021=_0x550a('0x26');return db['UserProfileResource'][_0x550a('0x24')]({'where':{'type':_0x1a4021,'resourceId':_0x33da72['id']}})[_0x550a('0x23')](function(){return _0x5cbd2a;});})['then'](function(){_0x29a713[_0x550a('0x1a')](0xcc)[_0x550a('0x1b')]();});}};}function handleEntityNotFound(_0x518151,_0x330506){return function(_0x3ed9cf){if(!_0x3ed9cf){_0x518151[_0x550a('0x27')](0x194);}return _0x3ed9cf;};}function handleError(_0x4c5d58,_0x3ec51a){_0x3ec51a=_0x3ec51a||0x1f4;return function(_0x1a9708){logger[_0x550a('0x28')](_0x1a9708[_0x550a('0x29')]);if(_0x1a9708[_0x550a('0x2a')]){delete _0x1a9708[_0x550a('0x2a')];}_0x4c5d58[_0x550a('0x1a')](_0x3ec51a)['send'](_0x1a9708);};}exports[_0x550a('0x2b')]=function(_0x25b505,_0x11e766){var _0x9d9456={},_0x18b74d={},_0x165cf3={'count':0x0,'rows':[]};var _0x533083=_['map'](db[_0x550a('0x2c')][_0x550a('0x2d')],function(_0x4c1724){return{'name':_0x4c1724[_0x550a('0x2e')],'type':_0x4c1724[_0x550a('0x2f')][_0x550a('0x30')]};});_0x18b74d[_0x550a('0x31')]=_['map'](_0x533083,_0x550a('0x2a'));_0x18b74d[_0x550a('0x32')]=_['keys'](_0x25b505['query']);_0x18b74d[_0x550a('0x33')]=_['intersection'](_0x18b74d['model'],_0x18b74d['query']);_0x9d9456[_0x550a('0x34')]=_[_0x550a('0x35')](_0x18b74d['model'],qs[_0x550a('0x36')](_0x25b505[_0x550a('0x32')][_0x550a('0x36')]));_0x9d9456[_0x550a('0x34')]=_0x9d9456['attributes']['length']?_0x9d9456[_0x550a('0x34')]:_0x18b74d[_0x550a('0x31')];if(!_0x25b505['query'][_0x550a('0x37')]('nolimit')){_0x9d9456[_0x550a('0x38')]=qs[_0x550a('0x38')](_0x25b505['query']['limit']);_0x9d9456[_0x550a('0x1e')]=qs[_0x550a('0x1e')](_0x25b505[_0x550a('0x32')]['offset']);}_0x9d9456[_0x550a('0x39')]=qs['sort'](_0x25b505[_0x550a('0x32')]['sort']);_0x9d9456[_0x550a('0x3a')]=qs[_0x550a('0x33')](_[_0x550a('0x3b')](_0x25b505[_0x550a('0x32')],_0x18b74d['filters']),_0x533083);if(_0x25b505[_0x550a('0x32')][_0x550a('0x3c')]){_0x9d9456['where']=_[_0x550a('0x3d')](_0x9d9456[_0x550a('0x3a')],{'$or':_[_0x550a('0x3e')](_0x533083,function(_0x3f83cc){if(_0x3f83cc[_0x550a('0x2f')]!==_0x550a('0x3f')){var _0x45ed6e={};_0x45ed6e[_0x3f83cc[_0x550a('0x2a')]]={'$like':'%'+_0x25b505[_0x550a('0x32')][_0x550a('0x3c')]+'%'};return _0x45ed6e;}})});}_0x9d9456=_[_0x550a('0x3d')]({},_0x9d9456,_0x25b505[_0x550a('0x40')]);var _0x2818a7={'where':_0x9d9456[_0x550a('0x3a')]};return db[_0x550a('0x2c')][_0x550a('0x1d')](_0x2818a7)[_0x550a('0x23')](function(_0x4de7f0){_0x165cf3[_0x550a('0x1d')]=_0x4de7f0;if(_0x25b505[_0x550a('0x32')][_0x550a('0x41')]){_0x9d9456[_0x550a('0x42')]=[{'all':!![]}];}return db[_0x550a('0x2c')][_0x550a('0x43')](_0x9d9456);})[_0x550a('0x23')](function(_0x51f7dd){_0x165cf3['rows']=_0x51f7dd;return _0x165cf3;})[_0x550a('0x23')](respondWithFilteredResult(_0x11e766,_0x9d9456))[_0x550a('0x44')](handleError(_0x11e766,null));};exports[_0x550a('0x45')]=function(_0xc473e3,_0x430d37){var _0x44ea97={'raw':!![],'where':{'id':_0xc473e3[_0x550a('0x46')]['id']}},_0x31f52f={};_0x31f52f[_0x550a('0x31')]=_[_0x550a('0x47')](db['AnalyticDefaultReport'][_0x550a('0x2d')]);_0x31f52f[_0x550a('0x32')]=_[_0x550a('0x47')](_0xc473e3['query']);_0x31f52f[_0x550a('0x33')]=_['intersection'](_0x31f52f['model'],_0x31f52f[_0x550a('0x32')]);_0x44ea97[_0x550a('0x34')]=_[_0x550a('0x35')](_0x31f52f['model'],qs[_0x550a('0x36')](_0xc473e3[_0x550a('0x32')]['fields']));_0x44ea97[_0x550a('0x34')]=_0x44ea97[_0x550a('0x34')]['length']?_0x44ea97[_0x550a('0x34')]:_0x31f52f[_0x550a('0x31')];if(_0xc473e3[_0x550a('0x32')][_0x550a('0x41')]){_0x44ea97[_0x550a('0x42')]=[{'all':!![]}];}_0x44ea97=_[_0x550a('0x3d')]({},_0x44ea97,_0xc473e3[_0x550a('0x40')]);return db[_0x550a('0x2c')][_0x550a('0x48')](_0x44ea97)['then'](handleEntityNotFound(_0x430d37,null))[_0x550a('0x23')](respondWithResult(_0x430d37,null))['catch'](handleError(_0x430d37,null));};exports[_0x550a('0x49')]=function(_0x29b04b,_0x22e149){return db['AnalyticDefaultReport'][_0x550a('0x49')](_0x29b04b[_0x550a('0x4a')],{})[_0x550a('0x23')](function(_0x164b5c){var _0x2ee703=_0x29b04b['user'][_0x550a('0x25')]({'plain':!![]});if(!_0x2ee703)throw new Error(_0x550a('0x4b'));if(_0x2ee703[_0x550a('0x4c')]===_0x550a('0x4d')){var _0x5e338f=_0x164b5c[_0x550a('0x25')]({'plain':!![]});var _0x196c3a=_0x550a('0x4e');return db[_0x550a('0x4f')][_0x550a('0x48')]({'where':{'name':_0x196c3a,'userProfileId':_0x2ee703['userProfileId']},'raw':!![]})[_0x550a('0x23')](function(_0x49c6a7){if(_0x49c6a7&&_0x49c6a7[_0x550a('0x50')]===0x0){return db[_0x550a('0x51')]['create']({'name':_0x5e338f[_0x550a('0x2a')],'resourceId':_0x5e338f['id'],'type':_0x550a('0x26'),'sectionId':_0x49c6a7['id']},{})[_0x550a('0x23')](function(){return _0x164b5c;});}else{return _0x164b5c;}})['catch'](function(_0x536c31){logger['error'](_0x550a('0x52'),_0x536c31);throw _0x536c31;});}return _0x164b5c;})[_0x550a('0x23')](respondWithResult(_0x22e149,0xc9))[_0x550a('0x44')](handleError(_0x22e149,null));};exports[_0x550a('0x53')]=function(_0x32dc89,_0x53428b){if(_0x32dc89[_0x550a('0x4a')]['id']){delete _0x32dc89[_0x550a('0x4a')]['id'];}return db[_0x550a('0x2c')][_0x550a('0x48')]({'where':{'id':_0x32dc89[_0x550a('0x46')]['id']}})['then'](handleEntityNotFound(_0x53428b,null))[_0x550a('0x23')](saveUpdates(_0x32dc89[_0x550a('0x4a')],null))[_0x550a('0x23')](respondWithResult(_0x53428b,null))['catch'](handleError(_0x53428b,null));};exports[_0x550a('0x24')]=function(_0x1c9d51,_0x52d36a){return db['AnalyticDefaultReport'][_0x550a('0x48')]({'where':{'id':_0x1c9d51[_0x550a('0x46')]['id']}})['then'](handleEntityNotFound(_0x52d36a,null))[_0x550a('0x23')](removeEntity(_0x52d36a,null))[_0x550a('0x44')](handleError(_0x52d36a,null));};exports[_0x550a('0x54')]=function(_0x516f15,_0x15de8f){var _0x16e97d=0xa;var _0x518ef2=['join',_0x550a('0x55'),_0x550a('0x56'),'cross_join'];var _0x207bb5={'SUM':'SUM(%s)','COUNT':_0x550a('0x57'),'COUNT DISTINCT':_0x550a('0x58'),'MAX':'MAX(%s)','MIN':_0x550a('0x59'),'AVG':_0x550a('0x5a'),'GROUP_CONCAT':_0x550a('0x5b'),'GROUP_CONCAT ASC':_0x550a('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x518376={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x550a('0x5d'),'ROUND':_0x550a('0x5e'),'UNIX_TIMESTAMP':_0x550a('0x5f')};var _0x262ce1=function(_0x4af38f){return!_[_0x550a('0x60')]([_0x550a('0x61'),'IS\x20NOT\x20NULL',_0x550a('0x62'),_0x550a('0x63')],_0x4af38f);};var _0x36cbc8=function(_0x573d3e){if(!_0x573d3e||!_0x573d3e[_0x550a('0x64')][_0x550a('0x65')]){return'';}for(var _0x3d467d='(',_0x527963=0x0;_0x527963<_0x573d3e[_0x550a('0x64')][_0x550a('0x65')];_0x527963+=0x1){_0x527963>0x0&&(_0x3d467d+='\x20'+_0x573d3e['operator']+'\x20');_0x3d467d+=_0x573d3e[_0x550a('0x64')][_0x527963][_0x550a('0x66')]?_0x36cbc8(_0x573d3e['rules'][_0x527963][_0x550a('0x66')]):_0x573d3e[_0x550a('0x64')][_0x527963][_0x550a('0x67')]+'\x20'+_0x573d3e[_0x550a('0x64')][_0x527963][_0x550a('0x68')]+(_0x262ce1(_0x573d3e[_0x550a('0x64')][_0x527963][_0x550a('0x68')])?'\x20'+_0x573d3e[_0x550a('0x64')][_0x527963][_0x550a('0x69')]:'');}return _0x3d467d+')';};var _0x32db51={'where':{'id':_0x516f15[_0x550a('0x46')]['id']}},_0x24647e,_0x3848ac,_0x14ff5b,_0x1f7335,_0x2ee2f3;_0x32db51=_['merge']({},_0x32db51,_0x516f15[_0x550a('0x40')]);return db['AnalyticDefaultReport'][_0x550a('0x48')](_0x32db51)[_0x550a('0x23')](function(_0xe9199c){if(_0xe9199c){_0x24647e=_0xe9199c;return _0xe9199c[_0x550a('0x6a')]();}return null;})[_0x550a('0x23')](function(_0x17ae00){if(_0x17ae00){if(!_0x17ae00[_0x550a('0x65')]){throw new db['Sequelize']['ValidationErrorItem'](_0x550a('0x6b'),0x193);}_0x3848ac=_0x17ae00;return db[_0x550a('0x6c')][_0x550a('0x43')]({'raw':!![]});}return null;})[_0x550a('0x23')](function(_0x4fd8f9){if(_0x4fd8f9){_0x14ff5b=_[_0x550a('0x6d')](_0x4fd8f9,'id');var _0x4c66b4;var _0x6923f=squel[_0x550a('0x6e')]();_0x6923f[_0x550a('0x6f')](_0x24647e[_0x550a('0x70')]);for(var _0x1e5d2d=0x0;_0x1e5d2d<_0x3848ac['length'];_0x1e5d2d+=0x1){_0x4c66b4=_0x3848ac[_0x1e5d2d][_0x550a('0x71')]?_0x14ff5b[_0x3848ac[_0x1e5d2d][_0x550a('0x71')]][_0x550a('0x72')]:_0x3848ac[_0x1e5d2d]['field'];_0x4c66b4=_0x3848ac[_0x1e5d2d]['function']?_[_0x550a('0x73')](_0x207bb5[_0x3848ac[_0x1e5d2d]['function']],'%s',_0x4c66b4):_0x4c66b4;_0x4c66b4=_0x3848ac[_0x1e5d2d][_0x550a('0x74')]?_['replace'](_0x518376[_0x3848ac[_0x1e5d2d][_0x550a('0x74')]],'%s',_0x4c66b4):_0x4c66b4;if(_0x3848ac[_0x1e5d2d][_0x550a('0x75')]){_0x6923f[_0x550a('0x66')](_0x4c66b4);}_0x3848ac[_0x1e5d2d][_0x550a('0x76')]&&_0x6923f[_0x550a('0x39')](_0x4c66b4,_0x3848ac[_0x1e5d2d][_0x550a('0x76')]===_0x550a('0x77')?![]:!![]);_0x6923f[_0x550a('0x67')](_0x4c66b4,_0x3848ac[_0x1e5d2d][_0x550a('0x78')]||_0x4c66b4);}if(_0x24647e[_0x550a('0x79')]){_0x24647e[_0x550a('0x79')]=JSON[_0x550a('0x7a')](_0x24647e[_0x550a('0x79')]);for(var _0x19c71b=0x0;_0x19c71b<_0x24647e[_0x550a('0x79')][_0x550a('0x65')];_0x19c71b+=0x1){if(_0x24647e[_0x550a('0x79')][_0x19c71b][_0x550a('0x2f')]&&_['includes'](_0x518ef2,_0x24647e[_0x550a('0x79')][_0x19c71b][_0x550a('0x2f')])&&_0x24647e['joins'][_0x19c71b][_0x550a('0x7b')]&&_0x24647e['joins'][_0x19c71b][_0x550a('0x7c')]&&_0x24647e[_0x550a('0x79')][_0x19c71b][_0x550a('0x7d')]){_0x6923f[_0x24647e[_0x550a('0x79')][_0x19c71b][_0x550a('0x2f')]](_0x24647e[_0x550a('0x79')][_0x19c71b][_0x550a('0x7c')],null,util[_0x550a('0x74')]('%s.%s\x20=\x20%s.%s',_0x24647e['table'],_0x24647e['joins'][_0x19c71b][_0x550a('0x7b')],_0x24647e['joins'][_0x19c71b][_0x550a('0x7c')],_0x24647e['joins'][_0x19c71b][_0x550a('0x7d')]));}}}if(_0x24647e[_0x550a('0x7e')]){_0x24647e[_0x550a('0x7e')]=JSON[_0x550a('0x7a')](_0x24647e[_0x550a('0x7e')]);_0x6923f[_0x550a('0x3a')](_0x36cbc8(_0x24647e['conditions']['group']));}_0x2ee2f3=_0x6923f['clone']();_0x6923f['limit'](_0x16e97d);_0x6923f[_0x550a('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x6923f[_0x550a('0x7f')]());return db[_0x550a('0x80')][_0x550a('0x32')](_0x6923f[_0x550a('0x7f')](),{'type':db[_0x550a('0x80')][_0x550a('0x81')][_0x550a('0x82')]});}})['then'](respondWithResult(_0x15de8f,null))[_0x550a('0x44')](handleError(_0x15de8f,null));};function runReport(_0x4d0984,_0x14a3f9,_0x33df6f){var _0x42be58=_0x14a3f9[_0x550a('0x2a')];var _0x3826b0=0xa;var _0x19a5eb=[_0x550a('0x83'),'left_join',_0x550a('0x56'),'cross_join'];var _0x31e33c={'SUM':_0x550a('0x84'),'COUNT':_0x550a('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x550a('0x85'),'MIN':_0x550a('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x550a('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4a925f={'SEC_TO_TIME':_0x550a('0x86'),'DATE':_0x550a('0x87'),'HOUR':_0x550a('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x550a('0x5f')};var _0x231bab=function(_0x13e384){return!_[_0x550a('0x60')]([_0x550a('0x61'),_0x550a('0x88'),_0x550a('0x62'),_0x550a('0x63')],_0x13e384);};var _0x47cf92=function(_0x31fff7){if(!_0x31fff7||!_0x31fff7[_0x550a('0x64')][_0x550a('0x65')]){return'';}for(var _0x50f264='(',_0xecd87c=0x0;_0xecd87c<_0x31fff7['rules'][_0x550a('0x65')];_0xecd87c+=0x1){_0xecd87c>0x0&&(_0x50f264+='\x20'+_0x31fff7[_0x550a('0x89')]+'\x20');_0x50f264+=_0x31fff7[_0x550a('0x64')][_0xecd87c][_0x550a('0x66')]?_0x47cf92(_0x31fff7[_0x550a('0x64')][_0xecd87c][_0x550a('0x66')]):_0x31fff7[_0x550a('0x64')][_0xecd87c][_0x550a('0x67')]+'\x20'+_0x31fff7[_0x550a('0x64')][_0xecd87c]['condition']+(_0x231bab(_0x31fff7['rules'][_0xecd87c][_0x550a('0x68')])?'\x20'+_0x31fff7[_0x550a('0x64')][_0xecd87c][_0x550a('0x69')]:'');}return _0x50f264+')';};var _0x3bc36f={'where':{'id':_0x4d0984['id']}},_0xcb7021,_0x1b587c,_0x5d465d,_0x2222ad,_0x1b8bea;_0x3bc36f=_['merge']({},_0x3bc36f,_0x33df6f);return db[_0x550a('0x2c')][_0x550a('0x48')](_0x3bc36f)[_0x550a('0x23')](function(_0x1ccd35){if(_0x1ccd35){_0xcb7021=_0x1ccd35;return _0x1ccd35['getFields']();}return null;})[_0x550a('0x23')](function(_0x2b719f){if(_0x2b719f){if(!_0x2b719f[_0x550a('0x65')]){throw new db[(_0x550a('0x8a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1b587c=_0x2b719f;return db[_0x550a('0x6c')][_0x550a('0x43')]({'raw':!![]});}return null;})[_0x550a('0x23')](function(_0x2641a5){if(_0x2641a5){_0x5d465d=_[_0x550a('0x6d')](_0x2641a5,'id');var _0xa70899;var _0x32284a=squel[_0x550a('0x6e')]();_0x32284a[_0x550a('0x6f')](_0xcb7021[_0x550a('0x70')]);for(var _0x48dd43=0x0;_0x48dd43<_0x1b587c[_0x550a('0x65')];_0x48dd43+=0x1){_0xa70899=_0x1b587c[_0x48dd43]['MetricId']?_0x5d465d[_0x1b587c[_0x48dd43][_0x550a('0x71')]][_0x550a('0x72')]:_0x1b587c[_0x48dd43]['field'];_0xa70899=_0x1b587c[_0x48dd43][_0x550a('0x8b')]?_[_0x550a('0x73')](_0x31e33c[_0x1b587c[_0x48dd43][_0x550a('0x8b')]],'%s',_0xa70899):_0xa70899;_0xa70899=_0x1b587c[_0x48dd43][_0x550a('0x74')]?_['replace'](_0x4a925f[_0x1b587c[_0x48dd43][_0x550a('0x74')]],'%s',_0xa70899):_0xa70899;if(_0x1b587c[_0x48dd43][_0x550a('0x75')]){_0x32284a['group'](_0xa70899);}_0x1b587c[_0x48dd43][_0x550a('0x76')]&&_0x32284a[_0x550a('0x39')](_0xa70899,_0x1b587c[_0x48dd43]['orderBy']===_0x550a('0x77')?![]:!![]);_0x32284a[_0x550a('0x67')](_0xa70899,_0x1b587c[_0x48dd43][_0x550a('0x78')]||_0xa70899);}if(_0xcb7021[_0x550a('0x79')]){_0xcb7021[_0x550a('0x79')]=JSON[_0x550a('0x7a')](_0xcb7021[_0x550a('0x79')]);for(var _0x5de621=0x0;_0x5de621<_0xcb7021['joins']['length'];_0x5de621+=0x1){if(_0xcb7021[_0x550a('0x79')][_0x5de621][_0x550a('0x2f')]&&_[_0x550a('0x60')](_0x19a5eb,_0xcb7021[_0x550a('0x79')][_0x5de621][_0x550a('0x2f')])&&_0xcb7021[_0x550a('0x79')][_0x5de621]['parentKey']&&_0xcb7021['joins'][_0x5de621][_0x550a('0x7c')]&&_0xcb7021[_0x550a('0x79')][_0x5de621][_0x550a('0x7d')]){_0x32284a[_0xcb7021['joins'][_0x5de621]['type']](_0xcb7021[_0x550a('0x79')][_0x5de621]['foreignTable'],null,util[_0x550a('0x74')](_0x550a('0x8c'),_0xcb7021[_0x550a('0x70')],_0xcb7021[_0x550a('0x79')][_0x5de621][_0x550a('0x7b')],_0xcb7021['joins'][_0x5de621][_0x550a('0x7c')],_0xcb7021['joins'][_0x5de621]['foreignKey']));}}}if(_0xcb7021['conditions']){_0xcb7021['conditions']=JSON[_0x550a('0x7a')](_0xcb7021[_0x550a('0x7e')]);_0x32284a[_0x550a('0x3a')](_0x47cf92(_0xcb7021[_0x550a('0x7e')][_0x550a('0x66')]));}_0x1b8bea=_0x32284a['clone']();_0x32284a[_0x550a('0x38')](_0x3826b0);_0x32284a[_0x550a('0x1e')](0x0);logger[_0x550a('0x8d')](_0x550a('0x8e'),_0x32284a[_0x550a('0x7f')]());return db[_0x550a('0x80')]['query'](_0x32284a['toString'](),{'type':db[_0x550a('0x80')][_0x550a('0x81')][_0x550a('0x82')]});}})['then'](function(_0x46354){if(!_0x46354[_0x550a('0x65')]){throw new db['Sequelize'][(_0x550a('0x8f'))](_0x550a('0x90'),0xcc);}if(_0x14a3f9[_0x550a('0x91')]===_0x550a('0x92')){return null;}var _0x5c0366=_[_0x550a('0x3d')](_0x14a3f9,{'name':_0x14a3f9[_0x550a('0x93')]||_0x14a3f9['name']||_0xcb7021[_0x550a('0x2a')],'basename':_0x42be58,'savename':util[_0x550a('0x74')](_0x550a('0x94'),_0x14a3f9[_0x550a('0x2a')]||_0xcb7021['name'],require(_0x550a('0x95'))['generate'](0x4),_0x14a3f9[_0x550a('0x91')]||_0x550a('0x96')),'reportId':_0xcb7021['id'],'reportType':'default'});return db[_0x550a('0x97')][_0x550a('0x49')](_0x5c0366,{'raw':!![]});})['then'](function(_0xfcce66){if(_0xcb7021[_0x550a('0x70')]===_0x550a('0x98')){_0x1b8bea[_0x550a('0x3a')](_0xcb7021[_0x550a('0x70')]+_0x550a('0x99'),_0x14a3f9['startDate'],_0x14a3f9[_0x550a('0x9a')]);}else{_0x1b8bea[_0x550a('0x3a')](_0xcb7021['table']+_0x550a('0x9b'),_0x14a3f9[_0x550a('0x9c')],_0x14a3f9[_0x550a('0x9a')]);}if(_0xfcce66){logger['info'](_0x550a('0x9d'),_0x1b8bea[_0x550a('0x7f')]());require('child_process')[_0x550a('0x9e')](path[_0x550a('0x83')](__dirname,_0x550a('0x9f'),_0xfcce66[_0x550a('0x91')]),[_0xfcce66['id'],_0x1b8bea[_0x550a('0x7f')](),path[_0x550a('0x83')](__dirname,_0x550a('0xa0'),_0xfcce66['savename']),_0x42be58]);return _0xfcce66;}else{var _0x1ed6b5=squel[_0x550a('0x6e')]();_0x1ed6b5['from']('('+_0x1b8bea[_0x550a('0x7f')]()+')',_0x550a('0xa1'));_0x1ed6b5['field']('COUNT(*)',_0x550a('0x1d'));_0x1b8bea[_0x550a('0x38')](_0x14a3f9[_0x550a('0x38')]||_0x3826b0);_0x1b8bea[_0x550a('0x1e')](_0x14a3f9['offset']||0x0);return dbH[_0x550a('0x80')]['query'](_0x1ed6b5[_0x550a('0x7f')](),{'type':dbH[_0x550a('0x80')][_0x550a('0x81')][_0x550a('0x82')]})[_0x550a('0x23')](function(_0x443e7c){if(!_0x443e7c[_0x550a('0x65')]){_0x2222ad=0x0;}else{_0x2222ad=_0x443e7c[0x0]['count']||0x0;}return dbH[_0x550a('0x80')][_0x550a('0x32')](_0x1b8bea[_0x550a('0x7f')](),{'type':dbH[_0x550a('0x80')][_0x550a('0x81')][_0x550a('0x82')]});})['then'](function(_0x52ff58){return{'rows':_0x52ff58||[],'count':_0x2222ad};});}});}exports[_0x550a('0xa2')]=function(_0x5497dc,_0x3e6b46){return runReport(_0x5497dc[_0x550a('0x46')],_0x5497dc['query'],_0x5497dc[_0x550a('0x40')])['then'](respondWithResult(_0x3e6b46,null))[_0x550a('0x44')](handleError(_0x3e6b46,null));};exports['runReport']=runReport;exports['query']=function(_0x1b8e0a,_0x1437ed){var _0x468fb2=0xa;var _0x2eff40=[_0x550a('0x83'),_0x550a('0x55'),_0x550a('0x56'),'cross_join'];var _0x107fb1={'SUM':_0x550a('0x84'),'COUNT':_0x550a('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x550a('0x85'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x550a('0x5b'),'GROUP_CONCAT ASC':_0x550a('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10bd1b={'SEC_TO_TIME':_0x550a('0x86'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x550a('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42f9c8=function(_0x36e6e1){return!_[_0x550a('0x60')]([_0x550a('0x61'),_0x550a('0x88'),'IS\x20EMPTY',_0x550a('0x63')],_0x36e6e1);};var _0x3068e1=function(_0x2b2c72){if(!_0x2b2c72||!_0x2b2c72[_0x550a('0x64')]['length']){return'';}for(var _0x48cd8c='(',_0x2e16db=0x0;_0x2e16db<_0x2b2c72['rules']['length'];_0x2e16db+=0x1){_0x2e16db>0x0&&(_0x48cd8c+='\x20'+_0x2b2c72[_0x550a('0x89')]+'\x20');_0x48cd8c+=_0x2b2c72[_0x550a('0x64')][_0x2e16db][_0x550a('0x66')]?_0x3068e1(_0x2b2c72[_0x550a('0x64')][_0x2e16db][_0x550a('0x66')]):_0x2b2c72['rules'][_0x2e16db][_0x550a('0x67')]+'\x20'+_0x2b2c72[_0x550a('0x64')][_0x2e16db][_0x550a('0x68')]+(_0x42f9c8(_0x2b2c72['rules'][_0x2e16db]['condition'])?'\x20'+_0x2b2c72[_0x550a('0x64')][_0x2e16db]['value']:'');}return _0x48cd8c+')';};var _0x1c746a={'where':{'id':_0x1b8e0a[_0x550a('0x46')]['id']}},_0x36e75c,_0x50a85b,_0x8faba0,_0x29987d,_0x500879;_0x1c746a=_[_0x550a('0x3d')]({},_0x1c746a,_0x1b8e0a[_0x550a('0x40')]);return db[_0x550a('0x2c')][_0x550a('0x48')](_0x1c746a)[_0x550a('0x23')](function(_0x764004){if(_0x764004){_0x36e75c=_0x764004;return _0x764004[_0x550a('0x6a')]();}return null;})[_0x550a('0x23')](function(_0x414640){if(_0x414640){if(!_0x414640['length']){throw new db[(_0x550a('0x8a'))][(_0x550a('0x8f'))](_0x550a('0x6b'),0x193);}_0x50a85b=_0x414640;return db[_0x550a('0x6c')][_0x550a('0x43')]({'raw':!![]});}return null;})[_0x550a('0x23')](function(_0x1d21ed){if(_0x1d21ed){_0x8faba0=_[_0x550a('0x6d')](_0x1d21ed,'id');var _0x2413c7;var _0x456987=squel[_0x550a('0x6e')]();_0x456987[_0x550a('0x6f')](_0x36e75c[_0x550a('0x70')]);for(var _0x572886=0x0;_0x572886<_0x50a85b[_0x550a('0x65')];_0x572886+=0x1){_0x2413c7=_0x50a85b[_0x572886][_0x550a('0x71')]?_0x8faba0[_0x50a85b[_0x572886]['MetricId']][_0x550a('0x72')]:_0x50a85b[_0x572886][_0x550a('0x67')];_0x2413c7=_0x50a85b[_0x572886][_0x550a('0x8b')]?_[_0x550a('0x73')](_0x107fb1[_0x50a85b[_0x572886][_0x550a('0x8b')]],'%s',_0x2413c7):_0x2413c7;_0x2413c7=_0x50a85b[_0x572886][_0x550a('0x74')]?_[_0x550a('0x73')](_0x10bd1b[_0x50a85b[_0x572886][_0x550a('0x74')]],'%s',_0x2413c7):_0x2413c7;if(_0x50a85b[_0x572886]['groupBy']){_0x456987[_0x550a('0x66')](_0x2413c7);}_0x50a85b[_0x572886]['orderBy']&&_0x456987['order'](_0x2413c7,_0x50a85b[_0x572886][_0x550a('0x76')]==='DESC'?![]:!![]);_0x456987[_0x550a('0x67')](_0x2413c7,_0x50a85b[_0x572886][_0x550a('0x78')]||_0x2413c7);}if(_0x36e75c['joins']){_0x36e75c[_0x550a('0x79')]=JSON['parse'](_0x36e75c['joins']);for(var _0x378550=0x0;_0x378550<_0x36e75c['joins'][_0x550a('0x65')];_0x378550+=0x1){if(_0x36e75c[_0x550a('0x79')][_0x378550][_0x550a('0x2f')]&&_[_0x550a('0x60')](_0x2eff40,_0x36e75c[_0x550a('0x79')][_0x378550]['type'])&&_0x36e75c[_0x550a('0x79')][_0x378550][_0x550a('0x7b')]&&_0x36e75c['joins'][_0x378550][_0x550a('0x7c')]&&_0x36e75c['joins'][_0x378550][_0x550a('0x7d')]){_0x456987[_0x36e75c[_0x550a('0x79')][_0x378550][_0x550a('0x2f')]](_0x36e75c[_0x550a('0x79')][_0x378550]['foreignTable'],null,util[_0x550a('0x74')](_0x550a('0x8c'),_0x36e75c[_0x550a('0x70')],_0x36e75c[_0x550a('0x79')][_0x378550][_0x550a('0x7b')],_0x36e75c[_0x550a('0x79')][_0x378550][_0x550a('0x7c')],_0x36e75c['joins'][_0x378550][_0x550a('0x7d')]));}}}if(_0x36e75c[_0x550a('0x7e')]){_0x36e75c[_0x550a('0x7e')]=JSON[_0x550a('0x7a')](_0x36e75c[_0x550a('0x7e')]);_0x456987['where'](_0x3068e1(_0x36e75c['conditions'][_0x550a('0x66')]));}_0x500879=_0x456987[_0x550a('0xa3')]();_0x456987[_0x550a('0x38')](_0x468fb2);_0x456987['offset'](0x0);logger[_0x550a('0x8d')](_0x550a('0x8e'),_0x456987['toString']());return db['sequelize'][_0x550a('0x32')](_0x456987['toString'](),{'type':db[_0x550a('0x80')][_0x550a('0x81')][_0x550a('0x82')]});}})[_0x550a('0x23')](function(){return{'sql':_0x500879[_0x550a('0x7f')]()};})[_0x550a('0x23')](respondWithResult(_0x1437ed,null))[_0x550a('0x44')](handleError(_0x1437ed,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8669709..de79960 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 _0x80a7=['../../config/logger','moment','bluebird','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util'];(function(_0x5dd686,_0x234cd9){var _0xcfd0b1=function(_0x4dc3ea){while(--_0x4dc3ea){_0x5dd686['push'](_0x5dd686['shift']());}};_0xcfd0b1(++_0x234cd9);}(_0x80a7,0xae));var _0x780a=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x80a7[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x780a('0x0'));var util=require(_0x780a('0x1'));var logger=require(_0x780a('0x2'))('api');var moment=require(_0x780a('0x3'));var BPromise=require(_0x780a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x780a('0x5'));var rimraf=require('rimraf');var config=require(_0x780a('0x6'));var attributes=require(_0x780a('0x7'));module[_0x780a('0x8')]=function(_0x16c7d9,_0x3ac2a4){return _0x16c7d9[_0x780a('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x780a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6da2=['rimraf','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','api','moment','bluebird','request-promise','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6da2,0xe1));var _0x26da=function(_0x35fcb7,_0x3734c0){_0x35fcb7=_0x35fcb7-0x0;var _0x30f28a=_0x6da2[_0x35fcb7];return _0x30f28a;};'use strict';var _=require(_0x26da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26da('0x1'));var moment=require(_0x26da('0x2'));var BPromise=require(_0x26da('0x3'));var rp=require(_0x26da('0x4'));var fs=require('fs');var path=require(_0x26da('0x5'));var rimraf=require(_0x26da('0x6'));var config=require('../../config/environment');var attributes=require(_0x26da('0x7'));module[_0x26da('0x8')]=function(_0x567514,_0x1ffca4){return _0x567514[_0x26da('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x26da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4f563be..d8bee6e 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 _0x6c9c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x13c0ff,_0x388f71){_0x13c0ff=_0x13c0ff-0x0;var _0x4438d0=_0x6c9c[_0x13c0ff];return _0x4438d0;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var moment=require('moment');var BPromise=require(_0xc6c9('0x2'));var rs=require(_0xc6c9('0x3'));var fs=require('fs');var Redis=require(_0xc6c9('0x4'));var db=require(_0xc6c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6c9('0x6'))(_0xc6c9('0x7'));var config=require(_0xc6c9('0x8'));var jayson=require(_0xc6c9('0x9'));var client=jayson[_0xc6c9('0xa')][_0xc6c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf9e43e,_0xd310e9,_0x30db53){return new BPromise(function(_0x15cf6e,_0xb11c68){return client[_0xc6c9('0xc')](_0xf9e43e,_0x30db53)[_0xc6c9('0xd')](function(_0x46f3c5){logger[_0xc6c9('0xe')](_0xc6c9('0xf'),_0xd310e9,_0xc6c9('0x10'));logger[_0xc6c9('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xd310e9,_0xc6c9('0x10'),JSON['stringify'](_0x46f3c5));if(_0x46f3c5['error']){if(_0x46f3c5['error'][_0xc6c9('0x12')]===0x1f4){logger[_0xc6c9('0x13')](_0xc6c9('0xf'),_0xd310e9,_0x46f3c5[_0xc6c9('0x13')][_0xc6c9('0x14')]);return _0xb11c68(_0x46f3c5[_0xc6c9('0x13')]['message']);}logger['error'](_0xc6c9('0xf'),_0xd310e9,_0x46f3c5[_0xc6c9('0x13')][_0xc6c9('0x14')]);return _0x15cf6e(_0x46f3c5[_0xc6c9('0x13')][_0xc6c9('0x14')]);}else{logger[_0xc6c9('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xd310e9,_0xc6c9('0x10'));_0x15cf6e(_0x46f3c5[_0xc6c9('0x15')][_0xc6c9('0x14')]);}})[_0xc6c9('0x16')](function(_0x1f2ea9){logger[_0xc6c9('0x13')](_0xc6c9('0xf'),_0xd310e9,_0x1f2ea9);_0xb11c68(_0x1f2ea9);});});} \ No newline at end of file +var _0x9c00=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x5f458c,_0x382344){var _0x1f000f=function(_0x1ea272){while(--_0x1ea272){_0x5f458c['push'](_0x5f458c['shift']());}};_0x1f000f(++_0x382344);}(_0x9c00,0x1a0));var _0x09c0=function(_0x45b190,_0x6297da){_0x45b190=_0x45b190-0x0;var _0x46234d=_0x9c00[_0x45b190];return _0x46234d;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a0cec4b..399fe0e 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 _0xe24f=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe24f,0x7b));var _0xfe24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe24f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfe24('0x0'));var util=require(_0xfe24('0x1'));var path=require('path');var timeout=require(_0xfe24('0x2'));var express=require(_0xfe24('0x3'));var router=express['Router']();var auth=require(_0xfe24('0x4'));var interaction=require(_0xfe24('0x5'));var config=require(_0xfe24('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xfe24('0x7')]('/',auth[_0xfe24('0x8')](),controller[_0xfe24('0x9')]);router['get'](_0xfe24('0xa'),auth[_0xfe24('0x8')](),controller[_0xfe24('0xb')]);router[_0xfe24('0x7')](_0xfe24('0xc'),auth['isAuthenticated'](),controller[_0xfe24('0xd')]);router[_0xfe24('0x7')](_0xfe24('0xe'),auth[_0xfe24('0x8')](),controller[_0xfe24('0xf')]);router[_0xfe24('0x7')](_0xfe24('0x10'),auth[_0xfe24('0x8')](),controller[_0xfe24('0x11')]);router[_0xfe24('0x12')]('/',auth[_0xfe24('0x8')](),controller['create']);router[_0xfe24('0x13')]('/:id',auth[_0xfe24('0x8')](),controller[_0xfe24('0x14')]);router[_0xfe24('0x15')](_0xfe24('0xa'),auth[_0xfe24('0x8')](),controller[_0xfe24('0x16')]);module[_0xfe24('0x17')]=router; \ No newline at end of file +var _0x840a=['isAuthenticated','index','/:id/preview','run','/:id/query','query','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x171667,_0x224f47){var _0x5d4e53=function(_0x199d41){while(--_0x199d41){_0x171667['push'](_0x171667['shift']());}};_0x5d4e53(++_0x224f47);}(_0x840a,0x79));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xa840('0x0'));var util=require(_0xa840('0x1'));var path=require(_0xa840('0x2'));var timeout=require(_0xa840('0x3'));var express=require(_0xa840('0x4'));var router=express[_0xa840('0x5')]();var auth=require(_0xa840('0x6'));var interaction=require(_0xa840('0x7'));var config=require(_0xa840('0x8'));var controller=require(_0xa840('0x9'));router[_0xa840('0xa')]('/',auth[_0xa840('0xb')](),controller[_0xa840('0xc')]);router[_0xa840('0xa')]('/:id',auth[_0xa840('0xb')](),controller['show']);router['get'](_0xa840('0xd'),auth[_0xa840('0xb')](),controller['preview']);router[_0xa840('0xa')]('/:id/run',auth[_0xa840('0xb')](),controller[_0xa840('0xe')]);router[_0xa840('0xa')](_0xa840('0xf'),auth[_0xa840('0xb')](),controller[_0xa840('0x10')]);router['post']('/',auth[_0xa840('0xb')](),controller[_0xa840('0x11')]);router[_0xa840('0x12')](_0xa840('0x13'),auth[_0xa840('0xb')](),controller['update']);router[_0xa840('0x14')](_0xa840('0x13'),auth[_0xa840('0xb')](),controller[_0xa840('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 64eae4b..bbbca85 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 _0x4c42=['Loading','manual','scheduled','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE'];(function(_0x4718a2,_0x6b9f1f){var _0x2bc2c3=function(_0x35fefc){while(--_0x35fefc){_0x4718a2['push'](_0x4718a2['shift']());}};_0x2bc2c3(++_0x6b9f1f);}(_0x4c42,0x1a7));var _0x24c4=function(_0x36690c,_0x588e39){_0x36690c=_0x36690c-0x0;var _0x1e5ce7=_0x4c42[_0x36690c];return _0x1e5ce7;};'use strict';var Sequelize=require(_0x24c4('0x0'));var moment=require(_0x24c4('0x1'));module[_0x24c4('0x2')]={'name':{'type':Sequelize[_0x24c4('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x24c4('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x24c4('0x4')]('csv',_0x24c4('0x5'),_0x24c4('0x6')),'allowNull':![],'defaultValue':_0x24c4('0x7')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x24c4('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x24c4('0x9')},'type':{'type':Sequelize[_0x24c4('0x4')](_0x24c4('0xa'),_0x24c4('0xb')),'allowNull':![],'defaultValue':_0x24c4('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x24c4('0x3')]}}; \ No newline at end of file +var _0xebbe=['pdf','DATE','Loading','ENUM','manual','INTEGER','sequelize','moment','exports','STRING','csv'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xebbe,0x13a));var _0xeebb=function(_0x120839,_0xb47fd){_0x120839=_0x120839-0x0;var _0x3c05b5=_0xebbe[_0x120839];return _0x3c05b5;};'use strict';var Sequelize=require(_0xeebb('0x0'));var moment=require(_0xeebb('0x1'));module[_0xeebb('0x2')]={'name':{'type':Sequelize[_0xeebb('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xeebb('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xeebb('0x4'),_0xeebb('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xeebb('0x4')},'savename':{'type':Sequelize[_0xeebb('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xeebb('0x6')]},'endDate':{'type':Sequelize[_0xeebb('0x6')]},'status':{'type':Sequelize[_0xeebb('0x3')],'defaultValue':_0xeebb('0x7')},'type':{'type':Sequelize[_0xeebb('0x8')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xeebb('0x9')},'reportId':{'type':Sequelize[_0xeebb('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xeebb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 62c7cd8..627edf0 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 _0xbc30=['basename','savename','existsSync','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','get','ExtractedReports','UserProfileResource','end','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download'];(function(_0x199e07,_0x481052){var _0xebb5d0=function(_0xba67ac){while(--_0xba67ac){_0x199e07['push'](_0x199e07['shift']());}};_0xebb5d0(++_0x481052);}(_0xbc30,0x186));var _0x0bc3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbc30[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x0bc3('0x0'));var emlformat=require(_0x0bc3('0x1'));var rimraf=require(_0x0bc3('0x2'));var zipdir=require(_0x0bc3('0x3'));var jsonpatch=require(_0x0bc3('0x4'));var rp=require(_0x0bc3('0x5'));var moment=require(_0x0bc3('0x6'));var BPromise=require(_0x0bc3('0x7'));var Mustache=require('mustache');var util=require(_0x0bc3('0x8'));var path=require(_0x0bc3('0x9'));var sox=require(_0x0bc3('0xa'));var csv=require('to-csv');var ejs=require(_0x0bc3('0xb'));var fs=require('fs');var _=require(_0x0bc3('0xc'));var squel=require(_0x0bc3('0xd'));var crypto=require(_0x0bc3('0xe'));var jsforce=require(_0x0bc3('0xf'));var deskjs=require(_0x0bc3('0x10'));var toCsv=require(_0x0bc3('0x11'));var querystring=require(_0x0bc3('0x12'));var Papa=require('papaparse');var Redis=require(_0x0bc3('0x13'));var authService=require(_0x0bc3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0bc3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bc3('0x16'))(_0x0bc3('0x17'));var utils=require(_0x0bc3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0bc3('0x19'));var db=require(_0x0bc3('0x1a'))['db'];function respondWithStatusCode(_0x26def5,_0x4494ab){_0x4494ab=_0x4494ab||0xcc;return function(_0x44a66c){if(_0x44a66c){return _0x26def5[_0x0bc3('0x1b')](_0x4494ab);}return _0x26def5[_0x0bc3('0x1c')](_0x4494ab)['end']();};}function respondWithResult(_0xf68d0e,_0x4bff33){_0x4bff33=_0x4bff33||0xc8;return function(_0x4ba169){if(_0x4ba169){return _0xf68d0e[_0x0bc3('0x1c')](_0x4bff33)[_0x0bc3('0x1d')](_0x4ba169);}};}function respondWithFilteredResult(_0x4bb33a,_0x51d188){return function(_0x35c6f7){if(_0x35c6f7){var _0x3d887a=_0x35c6f7[_0x0bc3('0x1e')],_0x2ebd42=_0x51d188[_0x0bc3('0x1f')],_0x5c43a5=_0x51d188[_0x0bc3('0x1f')]+_0x51d188[_0x0bc3('0x20')],_0xebe32;if(_0x5c43a5>=_0x3d887a){_0x5c43a5=_0x3d887a;_0xebe32=0xc8;}else{_0xebe32=0xce;}_0x4bb33a[_0x0bc3('0x1c')](_0xebe32);return _0x4bb33a[_0x0bc3('0x21')](_0x0bc3('0x22'),_0x2ebd42+'-'+_0x5c43a5+'/'+_0x3d887a)[_0x0bc3('0x1d')](_0x35c6f7);}return null;};}function patchUpdates(_0x3f9e75){return function(_0x127144){try{jsonpatch[_0x0bc3('0x23')](_0x127144,_0x3f9e75,!![]);}catch(_0xbbfd75){return BPromise['reject'](_0xbbfd75);}return _0x127144['save']();};}function saveUpdates(_0x5cc5d7,_0x129452){return function(_0x241bda){if(_0x241bda){return _0x241bda[_0x0bc3('0x24')](_0x5cc5d7)['then'](function(_0x5d1fcf){return _0x5d1fcf;});}return null;};}function removeEntity(_0x3d7194,_0x1798ab){return function(_0x5a1f69){if(_0x5a1f69){return _0x5a1f69[_0x0bc3('0x25')]()[_0x0bc3('0x26')](function(){var _0x2c61fe=_0x5a1f69[_0x0bc3('0x27')]({'plain':!![]});var _0x5727af=_0x0bc3('0x28');return db[_0x0bc3('0x29')][_0x0bc3('0x25')]({'where':{'type':_0x5727af,'resourceId':_0x2c61fe['id']}})[_0x0bc3('0x26')](function(){return _0x5a1f69;});})['then'](function(){_0x3d7194[_0x0bc3('0x1c')](0xcc)[_0x0bc3('0x2a')]();});}};}function handleEntityNotFound(_0x38fdbf,_0x3da287){return function(_0x1ab8e1){if(!_0x1ab8e1){_0x38fdbf['sendStatus'](0x194);}return _0x1ab8e1;};}function handleError(_0x497c4f,_0x3a2578){_0x3a2578=_0x3a2578||0x1f4;return function(_0x33bb07){logger['error'](_0x33bb07[_0x0bc3('0x2b')]);if(_0x33bb07[_0x0bc3('0x2c')]){delete _0x33bb07[_0x0bc3('0x2c')];}_0x497c4f[_0x0bc3('0x1c')](_0x3a2578)[_0x0bc3('0x2d')](_0x33bb07);};}exports[_0x0bc3('0x2e')]=function(_0x4db10f,_0x2e7eaf){var _0x119352={},_0x12a75c={},_0x1ed0fe={'count':0x0,'rows':[]};var _0x47220c=_[_0x0bc3('0x2f')](db[_0x0bc3('0x30')][_0x0bc3('0x31')],function(_0x49b0df){return{'name':_0x49b0df[_0x0bc3('0x32')],'type':_0x49b0df[_0x0bc3('0x33')]['key']};});_0x12a75c[_0x0bc3('0x34')]=_['map'](_0x47220c,_0x0bc3('0x2c'));_0x12a75c[_0x0bc3('0x35')]=_[_0x0bc3('0x36')](_0x4db10f['query']);_0x12a75c[_0x0bc3('0x37')]=_[_0x0bc3('0x38')](_0x12a75c['model'],_0x12a75c[_0x0bc3('0x35')]);_0x119352[_0x0bc3('0x39')]=_[_0x0bc3('0x38')](_0x12a75c['model'],qs['fields'](_0x4db10f[_0x0bc3('0x35')][_0x0bc3('0x3a')]));_0x119352[_0x0bc3('0x39')]=_0x119352[_0x0bc3('0x39')]['length']?_0x119352[_0x0bc3('0x39')]:_0x12a75c[_0x0bc3('0x34')];if(!_0x4db10f[_0x0bc3('0x35')][_0x0bc3('0x3b')](_0x0bc3('0x3c'))){_0x119352[_0x0bc3('0x20')]=qs['limit'](_0x4db10f[_0x0bc3('0x35')][_0x0bc3('0x20')]);_0x119352[_0x0bc3('0x1f')]=qs[_0x0bc3('0x1f')](_0x4db10f[_0x0bc3('0x35')][_0x0bc3('0x1f')]);}_0x119352['order']=qs[_0x0bc3('0x3d')](_0x4db10f[_0x0bc3('0x35')][_0x0bc3('0x3d')]);_0x119352[_0x0bc3('0x3e')]=qs['filters'](_[_0x0bc3('0x3f')](_0x4db10f[_0x0bc3('0x35')],_0x12a75c['filters']),_0x47220c);if(_0x4db10f['query'][_0x0bc3('0x40')]){_0x119352[_0x0bc3('0x3e')]=_[_0x0bc3('0x41')](_0x119352[_0x0bc3('0x3e')],{'$or':_['map'](_0x47220c,function(_0x55e4d8){if(_0x55e4d8[_0x0bc3('0x33')]!==_0x0bc3('0x42')){var _0x1862e8={};_0x1862e8[_0x55e4d8[_0x0bc3('0x2c')]]={'$like':'%'+_0x4db10f[_0x0bc3('0x35')][_0x0bc3('0x40')]+'%'};return _0x1862e8;}})});}_0x119352=_['merge']({},_0x119352,_0x4db10f[_0x0bc3('0x43')]);var _0x87b97b={'where':_0x119352['where']};return db[_0x0bc3('0x30')][_0x0bc3('0x1e')](_0x87b97b)[_0x0bc3('0x26')](function(_0x40a3c1){_0x1ed0fe[_0x0bc3('0x1e')]=_0x40a3c1;if(_0x4db10f['query'][_0x0bc3('0x44')]){_0x119352['include']=[{'all':!![]}];}return db[_0x0bc3('0x30')][_0x0bc3('0x45')](_0x119352);})[_0x0bc3('0x26')](function(_0x1f9622){_0x1ed0fe['rows']=_0x1f9622;return _0x1ed0fe;})[_0x0bc3('0x26')](respondWithFilteredResult(_0x2e7eaf,_0x119352))[_0x0bc3('0x46')](handleError(_0x2e7eaf,null));};exports[_0x0bc3('0x47')]=function(_0x28a8d9,_0x268bcf){var _0x156b7e={'raw':!![],'where':{'id':_0x28a8d9[_0x0bc3('0x48')]['id']}},_0x335451={};_0x335451[_0x0bc3('0x34')]=_[_0x0bc3('0x36')](db[_0x0bc3('0x30')][_0x0bc3('0x31')]);_0x335451['query']=_[_0x0bc3('0x36')](_0x28a8d9[_0x0bc3('0x35')]);_0x335451[_0x0bc3('0x37')]=_['intersection'](_0x335451[_0x0bc3('0x34')],_0x335451[_0x0bc3('0x35')]);_0x156b7e[_0x0bc3('0x39')]=_[_0x0bc3('0x38')](_0x335451[_0x0bc3('0x34')],qs[_0x0bc3('0x3a')](_0x28a8d9[_0x0bc3('0x35')][_0x0bc3('0x3a')]));_0x156b7e[_0x0bc3('0x39')]=_0x156b7e['attributes']['length']?_0x156b7e['attributes']:_0x335451[_0x0bc3('0x34')];if(_0x28a8d9['query'][_0x0bc3('0x44')]){_0x156b7e[_0x0bc3('0x49')]=[{'all':!![]}];}_0x156b7e=_[_0x0bc3('0x41')]({},_0x156b7e,_0x28a8d9[_0x0bc3('0x43')]);return db[_0x0bc3('0x30')]['find'](_0x156b7e)['then'](handleEntityNotFound(_0x268bcf,null))['then'](respondWithResult(_0x268bcf,null))[_0x0bc3('0x46')](handleError(_0x268bcf,null));};exports[_0x0bc3('0x4a')]=function(_0x53fa6e,_0x95f11d){return db[_0x0bc3('0x30')]['create'](_0x53fa6e[_0x0bc3('0x4b')],{})['then'](function(_0x288bdb){var _0x2c845a=_0x53fa6e[_0x0bc3('0x4c')][_0x0bc3('0x27')]({'plain':!![]});if(!_0x2c845a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c845a[_0x0bc3('0x4d')]==='user'){var _0x267bed=_0x288bdb[_0x0bc3('0x27')]({'plain':!![]});var _0x394feb=_0x0bc3('0x28');return db[_0x0bc3('0x4e')][_0x0bc3('0x4f')]({'where':{'name':_0x394feb,'userProfileId':_0x2c845a[_0x0bc3('0x50')]},'raw':!![]})[_0x0bc3('0x26')](function(_0x9aab99){if(_0x9aab99&&_0x9aab99[_0x0bc3('0x51')]===0x0){return db[_0x0bc3('0x29')][_0x0bc3('0x4a')]({'name':_0x267bed[_0x0bc3('0x2c')],'resourceId':_0x267bed['id'],'type':_0x9aab99[_0x0bc3('0x2c')],'sectionId':_0x9aab99['id']},{})['then'](function(){return _0x288bdb;});}else{return _0x288bdb;}})['catch'](function(_0x18e780){logger[_0x0bc3('0x52')](_0x0bc3('0x53'),_0x18e780);throw _0x18e780;});}return _0x288bdb;})['then'](respondWithResult(_0x95f11d,0xc9))[_0x0bc3('0x46')](handleError(_0x95f11d,null));};exports[_0x0bc3('0x24')]=function(_0xe05d37,_0x5375a8){if(_0xe05d37[_0x0bc3('0x4b')]['id']){delete _0xe05d37['body']['id'];}return db[_0x0bc3('0x30')]['find']({'where':{'id':_0xe05d37[_0x0bc3('0x48')]['id']}})[_0x0bc3('0x26')](handleEntityNotFound(_0x5375a8,null))[_0x0bc3('0x26')](saveUpdates(_0xe05d37[_0x0bc3('0x4b')],null))['then'](respondWithResult(_0x5375a8,null))[_0x0bc3('0x46')](handleError(_0x5375a8,null));};exports[_0x0bc3('0x25')]=function(_0x589579,_0x21cd05){return db[_0x0bc3('0x30')][_0x0bc3('0x4f')]({'where':{'id':_0x589579['params']['id']}})['then'](handleEntityNotFound(_0x21cd05,null))[_0x0bc3('0x26')](removeEntity(_0x21cd05,null))[_0x0bc3('0x46')](handleError(_0x21cd05,null));};exports[_0x0bc3('0x54')]=function(_0x20bf66,_0x268646,_0x106cd7){return db['AnalyticExtractedReport'][_0x0bc3('0x4f')]({'where':{'id':_0x20bf66[_0x0bc3('0x48')]['id']},'attributes':[_0x0bc3('0x2c'),_0x0bc3('0x55'),_0x0bc3('0x56'),'output'],'raw':!![]})[_0x0bc3('0x26')](handleEntityNotFound(_0x268646,null))[_0x0bc3('0x26')](function(_0x17b079){if(_0x17b079){if(!fs[_0x0bc3('0x57')](path['join'](config[_0x0bc3('0x58')],_0x0bc3('0x59'),_0x17b079[_0x0bc3('0x56')]))){throw new db[(_0x0bc3('0x5a'))]['ValidationError'](_0x0bc3('0x5b'));}if(_0x20bf66['query'][_0x0bc3('0x5c')]){return _0x268646[_0x0bc3('0x1b')](0xc8);}return _0x268646[_0x0bc3('0x54')](path['join'](config[_0x0bc3('0x58')],'server/files/reports',_0x17b079[_0x0bc3('0x56')]),util['format'](_0x0bc3('0x5d'),_0x17b079[_0x0bc3('0x55')]||_0x17b079['name'],_0x17b079[_0x0bc3('0x5e')]['toLowerCase']()));}})[_0x0bc3('0x46')](handleError(_0x268646,null));}; \ No newline at end of file +var _0x4e1e=['ExtractedReports','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','AnalyticExtractedReport','include','findAll','rows','catch','show','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','output','join','root','server/files/reports','savename','Sequelize','exists','download','format','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4e1e,0x15b));var _0xe4e1=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0x4e1e[_0x4a93bb];return _0x208468;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4e1('0x0'));var rimraf=require(_0xe4e1('0x1'));var zipdir=require(_0xe4e1('0x2'));var jsonpatch=require(_0xe4e1('0x3'));var rp=require('request-promise');var moment=require(_0xe4e1('0x4'));var BPromise=require(_0xe4e1('0x5'));var Mustache=require('mustache');var util=require(_0xe4e1('0x6'));var path=require(_0xe4e1('0x7'));var sox=require(_0xe4e1('0x8'));var csv=require(_0xe4e1('0x9'));var ejs=require(_0xe4e1('0xa'));var fs=require('fs');var _=require(_0xe4e1('0xb'));var squel=require('squel');var crypto=require(_0xe4e1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4e1('0xd'));var toCsv=require(_0xe4e1('0x9'));var querystring=require(_0xe4e1('0xe'));var Papa=require(_0xe4e1('0xf'));var Redis=require(_0xe4e1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe4e1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e1('0x12'));var logger=require(_0xe4e1('0x13'))(_0xe4e1('0x14'));var utils=require(_0xe4e1('0x15'));var config=require(_0xe4e1('0x16'));var licenseUtil=require(_0xe4e1('0x17'));var db=require(_0xe4e1('0x18'))['db'];function respondWithStatusCode(_0x57fd1d,_0x42b08b){_0x42b08b=_0x42b08b||0xcc;return function(_0x26752e){if(_0x26752e){return _0x57fd1d[_0xe4e1('0x19')](_0x42b08b);}return _0x57fd1d[_0xe4e1('0x1a')](_0x42b08b)[_0xe4e1('0x1b')]();};}function respondWithResult(_0x38e336,_0x1792b4){_0x1792b4=_0x1792b4||0xc8;return function(_0x3f317c){if(_0x3f317c){return _0x38e336[_0xe4e1('0x1a')](_0x1792b4)[_0xe4e1('0x1c')](_0x3f317c);}};}function respondWithFilteredResult(_0x2dc993,_0x27bd4e){return function(_0x55b6c5){if(_0x55b6c5){var _0x16e9b6=_0x55b6c5[_0xe4e1('0x1d')],_0x5633be=_0x27bd4e[_0xe4e1('0x1e')],_0x7f01bd=_0x27bd4e['offset']+_0x27bd4e[_0xe4e1('0x1f')],_0x92530e;if(_0x7f01bd>=_0x16e9b6){_0x7f01bd=_0x16e9b6;_0x92530e=0xc8;}else{_0x92530e=0xce;}_0x2dc993['status'](_0x92530e);return _0x2dc993[_0xe4e1('0x20')](_0xe4e1('0x21'),_0x5633be+'-'+_0x7f01bd+'/'+_0x16e9b6)[_0xe4e1('0x1c')](_0x55b6c5);}return null;};}function patchUpdates(_0x5979dc){return function(_0x26fac4){try{jsonpatch[_0xe4e1('0x22')](_0x26fac4,_0x5979dc,!![]);}catch(_0x1dcad3){return BPromise[_0xe4e1('0x23')](_0x1dcad3);}return _0x26fac4[_0xe4e1('0x24')]();};}function saveUpdates(_0x5443ca,_0x2f073d){return function(_0x39d344){if(_0x39d344){return _0x39d344[_0xe4e1('0x25')](_0x5443ca)[_0xe4e1('0x26')](function(_0x2e87eb){return _0x2e87eb;});}return null;};}function removeEntity(_0x3418db,_0x161749){return function(_0x255493){if(_0x255493){return _0x255493[_0xe4e1('0x27')]()[_0xe4e1('0x26')](function(){var _0x28320c=_0x255493[_0xe4e1('0x28')]({'plain':!![]});var _0x17a9cf=_0xe4e1('0x29');return db[_0xe4e1('0x2a')][_0xe4e1('0x27')]({'where':{'type':_0x17a9cf,'resourceId':_0x28320c['id']}})[_0xe4e1('0x26')](function(){return _0x255493;});})[_0xe4e1('0x26')](function(){_0x3418db[_0xe4e1('0x1a')](0xcc)[_0xe4e1('0x1b')]();});}};}function handleEntityNotFound(_0x1b50d1,_0x3b3540){return function(_0x5e61fd){if(!_0x5e61fd){_0x1b50d1['sendStatus'](0x194);}return _0x5e61fd;};}function handleError(_0x5219b3,_0x27b162){_0x27b162=_0x27b162||0x1f4;return function(_0x1b769e){logger[_0xe4e1('0x2b')](_0x1b769e[_0xe4e1('0x2c')]);if(_0x1b769e[_0xe4e1('0x2d')]){delete _0x1b769e[_0xe4e1('0x2d')];}_0x5219b3[_0xe4e1('0x1a')](_0x27b162)['send'](_0x1b769e);};}exports[_0xe4e1('0x2e')]=function(_0x4440ad,_0x526639){var _0x5f862b={},_0x1e35c4={},_0x1c6528={'count':0x0,'rows':[]};var _0x1d5434=_[_0xe4e1('0x2f')](db['AnalyticExtractedReport'][_0xe4e1('0x30')],function(_0x10bbca){return{'name':_0x10bbca[_0xe4e1('0x31')],'type':_0x10bbca['type'][_0xe4e1('0x32')]};});_0x1e35c4[_0xe4e1('0x33')]=_[_0xe4e1('0x2f')](_0x1d5434,_0xe4e1('0x2d'));_0x1e35c4[_0xe4e1('0x34')]=_[_0xe4e1('0x35')](_0x4440ad['query']);_0x1e35c4[_0xe4e1('0x36')]=_[_0xe4e1('0x37')](_0x1e35c4[_0xe4e1('0x33')],_0x1e35c4[_0xe4e1('0x34')]);_0x5f862b['attributes']=_[_0xe4e1('0x37')](_0x1e35c4[_0xe4e1('0x33')],qs[_0xe4e1('0x38')](_0x4440ad['query'][_0xe4e1('0x38')]));_0x5f862b[_0xe4e1('0x39')]=_0x5f862b['attributes']['length']?_0x5f862b['attributes']:_0x1e35c4[_0xe4e1('0x33')];if(!_0x4440ad[_0xe4e1('0x34')][_0xe4e1('0x3a')](_0xe4e1('0x3b'))){_0x5f862b[_0xe4e1('0x1f')]=qs[_0xe4e1('0x1f')](_0x4440ad[_0xe4e1('0x34')][_0xe4e1('0x1f')]);_0x5f862b[_0xe4e1('0x1e')]=qs[_0xe4e1('0x1e')](_0x4440ad[_0xe4e1('0x34')][_0xe4e1('0x1e')]);}_0x5f862b[_0xe4e1('0x3c')]=qs[_0xe4e1('0x3d')](_0x4440ad[_0xe4e1('0x34')][_0xe4e1('0x3d')]);_0x5f862b[_0xe4e1('0x3e')]=qs[_0xe4e1('0x36')](_[_0xe4e1('0x3f')](_0x4440ad['query'],_0x1e35c4[_0xe4e1('0x36')]),_0x1d5434);if(_0x4440ad[_0xe4e1('0x34')]['filter']){_0x5f862b[_0xe4e1('0x3e')]=_[_0xe4e1('0x40')](_0x5f862b[_0xe4e1('0x3e')],{'$or':_[_0xe4e1('0x2f')](_0x1d5434,function(_0x30e030){if(_0x30e030[_0xe4e1('0x41')]!=='VIRTUAL'){var _0x535969={};_0x535969[_0x30e030[_0xe4e1('0x2d')]]={'$like':'%'+_0x4440ad['query'][_0xe4e1('0x42')]+'%'};return _0x535969;}})});}_0x5f862b=_['merge']({},_0x5f862b,_0x4440ad[_0xe4e1('0x43')]);var _0x1eb59c={'where':_0x5f862b[_0xe4e1('0x3e')]};return db[_0xe4e1('0x44')][_0xe4e1('0x1d')](_0x1eb59c)[_0xe4e1('0x26')](function(_0x23a795){_0x1c6528[_0xe4e1('0x1d')]=_0x23a795;if(_0x4440ad['query']['includeAll']){_0x5f862b[_0xe4e1('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xe4e1('0x46')](_0x5f862b);})['then'](function(_0x474064){_0x1c6528[_0xe4e1('0x47')]=_0x474064;return _0x1c6528;})[_0xe4e1('0x26')](respondWithFilteredResult(_0x526639,_0x5f862b))[_0xe4e1('0x48')](handleError(_0x526639,null));};exports[_0xe4e1('0x49')]=function(_0x54f74e,_0x586ba0){var _0xe427e2={'raw':!![],'where':{'id':_0x54f74e['params']['id']}},_0x59b96e={};_0x59b96e['model']=_[_0xe4e1('0x35')](db[_0xe4e1('0x44')][_0xe4e1('0x30')]);_0x59b96e[_0xe4e1('0x34')]=_['keys'](_0x54f74e[_0xe4e1('0x34')]);_0x59b96e[_0xe4e1('0x36')]=_[_0xe4e1('0x37')](_0x59b96e[_0xe4e1('0x33')],_0x59b96e[_0xe4e1('0x34')]);_0xe427e2[_0xe4e1('0x39')]=_[_0xe4e1('0x37')](_0x59b96e[_0xe4e1('0x33')],qs[_0xe4e1('0x38')](_0x54f74e[_0xe4e1('0x34')]['fields']));_0xe427e2['attributes']=_0xe427e2[_0xe4e1('0x39')][_0xe4e1('0x4a')]?_0xe427e2[_0xe4e1('0x39')]:_0x59b96e[_0xe4e1('0x33')];if(_0x54f74e['query'][_0xe4e1('0x4b')]){_0xe427e2[_0xe4e1('0x45')]=[{'all':!![]}];}_0xe427e2=_[_0xe4e1('0x40')]({},_0xe427e2,_0x54f74e[_0xe4e1('0x43')]);return db[_0xe4e1('0x44')]['find'](_0xe427e2)[_0xe4e1('0x26')](handleEntityNotFound(_0x586ba0,null))[_0xe4e1('0x26')](respondWithResult(_0x586ba0,null))[_0xe4e1('0x48')](handleError(_0x586ba0,null));};exports[_0xe4e1('0x4c')]=function(_0x57c567,_0x19d7b4){return db[_0xe4e1('0x44')][_0xe4e1('0x4c')](_0x57c567[_0xe4e1('0x4d')],{})[_0xe4e1('0x26')](function(_0x83b844){var _0x35bda9=_0x57c567[_0xe4e1('0x4e')][_0xe4e1('0x28')]({'plain':!![]});if(!_0x35bda9)throw new Error(_0xe4e1('0x4f'));if(_0x35bda9[_0xe4e1('0x50')]==='user'){var _0x42bad4=_0x83b844['get']({'plain':!![]});var _0x28d91b=_0xe4e1('0x29');return db[_0xe4e1('0x51')][_0xe4e1('0x52')]({'where':{'name':_0x28d91b,'userProfileId':_0x35bda9[_0xe4e1('0x53')]},'raw':!![]})['then'](function(_0x21bb3d){if(_0x21bb3d&&_0x21bb3d[_0xe4e1('0x54')]===0x0){return db[_0xe4e1('0x2a')][_0xe4e1('0x4c')]({'name':_0x42bad4[_0xe4e1('0x2d')],'resourceId':_0x42bad4['id'],'type':_0x21bb3d[_0xe4e1('0x2d')],'sectionId':_0x21bb3d['id']},{})[_0xe4e1('0x26')](function(){return _0x83b844;});}else{return _0x83b844;}})[_0xe4e1('0x48')](function(_0x4f9dc9){logger[_0xe4e1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f9dc9);throw _0x4f9dc9;});}return _0x83b844;})[_0xe4e1('0x26')](respondWithResult(_0x19d7b4,0xc9))[_0xe4e1('0x48')](handleError(_0x19d7b4,null));};exports[_0xe4e1('0x25')]=function(_0x1c83d6,_0x2c4757){if(_0x1c83d6['body']['id']){delete _0x1c83d6[_0xe4e1('0x4d')]['id'];}return db[_0xe4e1('0x44')][_0xe4e1('0x52')]({'where':{'id':_0x1c83d6[_0xe4e1('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c4757,null))[_0xe4e1('0x26')](saveUpdates(_0x1c83d6[_0xe4e1('0x4d')],null))[_0xe4e1('0x26')](respondWithResult(_0x2c4757,null))[_0xe4e1('0x48')](handleError(_0x2c4757,null));};exports[_0xe4e1('0x27')]=function(_0x33e13f,_0x2ea7d0){return db[_0xe4e1('0x44')][_0xe4e1('0x52')]({'where':{'id':_0x33e13f[_0xe4e1('0x55')]['id']}})[_0xe4e1('0x26')](handleEntityNotFound(_0x2ea7d0,null))['then'](removeEntity(_0x2ea7d0,null))[_0xe4e1('0x48')](handleError(_0x2ea7d0,null));};exports['download']=function(_0x17d33a,_0x827cdb,_0x350076){return db['AnalyticExtractedReport'][_0xe4e1('0x52')]({'where':{'id':_0x17d33a[_0xe4e1('0x55')]['id']},'attributes':[_0xe4e1('0x2d'),'basename','savename',_0xe4e1('0x56')],'raw':!![]})[_0xe4e1('0x26')](handleEntityNotFound(_0x827cdb,null))['then'](function(_0x59c2c8){if(_0x59c2c8){if(!fs['existsSync'](path[_0xe4e1('0x57')](config[_0xe4e1('0x58')],_0xe4e1('0x59'),_0x59c2c8[_0xe4e1('0x5a')]))){throw new db[(_0xe4e1('0x5b'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x17d33a[_0xe4e1('0x34')][_0xe4e1('0x5c')]){return _0x827cdb[_0xe4e1('0x19')](0xc8);}return _0x827cdb[_0xe4e1('0x5d')](path[_0xe4e1('0x57')](config[_0xe4e1('0x58')],_0xe4e1('0x59'),_0x59c2c8[_0xe4e1('0x5a')]),util[_0xe4e1('0x5e')](_0xe4e1('0x5f'),_0x59c2c8[_0xe4e1('0x60')]||_0x59c2c8[_0xe4e1('0x2d')],_0x59c2c8['output']['toLowerCase']()));}})[_0xe4e1('0x48')](handleError(_0x827cdb,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3bfaac8..cde45ad 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 _0xa188=['analytics_extracted_reports','lodash','util','../../config/logger','api','request-promise','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x282749,_0x19111d){var _0x4bc466=function(_0x139a93){while(--_0x139a93){_0x282749['push'](_0x282749['shift']());}};_0x4bc466(++_0x19111d);}(_0xa188,0x1cc));var _0x8a18=function(_0x5abda5,_0x974105){_0x5abda5=_0x5abda5-0x0;var _0x976beb=_0xa188[_0x5abda5];return _0x976beb;};'use strict';var _=require(_0x8a18('0x0'));var util=require(_0x8a18('0x1'));var logger=require(_0x8a18('0x2'))(_0x8a18('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a18('0x5'));module['exports']=function(_0x2039d0,_0x5457c4){return _0x2039d0[_0x8a18('0x6')](_0x8a18('0x7'),attributes,{'tableName':_0x8a18('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd075=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1cb574,_0x54ed8a){var _0x1c918e=function(_0x29240b){while(--_0x29240b){_0x1cb574['push'](_0x1cb574['shift']());}};_0x1c918e(++_0x54ed8a);}(_0xd075,0xe8));var _0x5d07=function(_0x5def03,_0x428e8c){_0x5def03=_0x5def03-0x0;var _0x5d5e89=_0xd075[_0x5def03];return _0x5d5e89;};'use strict';var _=require('lodash');var util=require(_0x5d07('0x0'));var logger=require(_0x5d07('0x1'))(_0x5d07('0x2'));var moment=require(_0x5d07('0x3'));var BPromise=require(_0x5d07('0x4'));var rp=require(_0x5d07('0x5'));var fs=require('fs');var path=require(_0x5d07('0x6'));var rimraf=require(_0x5d07('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x5d07('0x8')]=function(_0x59f421,_0x5addd1){return _0x59f421[_0x5d07('0x9')](_0x5d07('0xa'),attributes,{'tableName':_0x5d07('0xb'),'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 6e7f1b6..8180ee1 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 _0xe87b=['../../config/utils','rpc','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4fd00b,_0x2336e9){var _0x449658=function(_0x39c0bf){while(--_0x39c0bf){_0x4fd00b['push'](_0x4fd00b['shift']());}};_0x449658(++_0x2336e9);}(_0xe87b,0x78));var _0xbe87=function(_0x46da58,_0x174d87){_0x46da58=_0x46da58-0x0;var _0x558862=_0xe87b[_0x46da58];return _0x558862;};'use strict';var _=require(_0xbe87('0x0'));var util=require(_0xbe87('0x1'));var moment=require(_0xbe87('0x2'));var BPromise=require(_0xbe87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe87('0x4'));var db=require(_0xbe87('0x5'))['db'];var utils=require(_0xbe87('0x6'));var logger=require('../../config/logger')(_0xbe87('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe87('0x8')][_0xbe87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x106adb,_0x25b9df,_0x3e7d07){return new BPromise(function(_0x14c99a,_0x49f084){return client[_0xbe87('0xa')](_0x106adb,_0x3e7d07)['then'](function(_0x252adf){logger[_0xbe87('0xb')](_0xbe87('0xc'),_0x25b9df,_0xbe87('0xd'));logger[_0xbe87('0xe')](_0xbe87('0xf'),_0x25b9df,_0xbe87('0xd'),JSON['stringify'](_0x252adf));if(_0x252adf['error']){if(_0x252adf[_0xbe87('0x10')][_0xbe87('0x11')]===0x1f4){logger['error'](_0xbe87('0xc'),_0x25b9df,_0x252adf[_0xbe87('0x10')][_0xbe87('0x12')]);return _0x49f084(_0x252adf['error'][_0xbe87('0x12')]);}logger['error'](_0xbe87('0xc'),_0x25b9df,_0x252adf['error'][_0xbe87('0x12')]);return _0x14c99a(_0x252adf[_0xbe87('0x10')][_0xbe87('0x12')]);}else{logger[_0xbe87('0xb')](_0xbe87('0xc'),_0x25b9df,_0xbe87('0xd'));_0x14c99a(_0x252adf[_0xbe87('0x13')][_0xbe87('0x12')]);}})[_0xbe87('0x14')](function(_0xabfbc8){logger[_0xbe87('0x10')](_0xbe87('0xc'),_0x25b9df,_0xabfbc8);_0x49f084(_0xabfbc8);});});} \ No newline at end of file +var _0x3dda=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1a0b53,_0x137fad){var _0x4a8451=function(_0x4375da){while(--_0x4375da){_0x1a0b53['push'](_0x1a0b53['shift']());}};_0x4a8451(++_0x137fad);}(_0x3dda,0x1e6));var _0xa3dd=function(_0x57b2db,_0x413803){_0x57b2db=_0x57b2db-0x0;var _0x288f48=_0x3dda[_0x57b2db];return _0x288f48;};'use strict';var _=require(_0xa3dd('0x0'));var util=require(_0xa3dd('0x1'));var moment=require('moment');var BPromise=require(_0xa3dd('0x2'));var rs=require(_0xa3dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3dd('0x4'))['db'];var utils=require(_0xa3dd('0x5'));var logger=require(_0xa3dd('0x6'))(_0xa3dd('0x7'));var config=require(_0xa3dd('0x8'));var jayson=require(_0xa3dd('0x9'));var client=jayson[_0xa3dd('0xa')][_0xa3dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2672b8,_0xb932d8,_0x518983){return new BPromise(function(_0x41988e,_0x20d4a6){return client[_0xa3dd('0xc')](_0x2672b8,_0x518983)[_0xa3dd('0xd')](function(_0x3c4a72){logger[_0xa3dd('0xe')](_0xa3dd('0xf'),_0xb932d8,'request\x20sent');logger[_0xa3dd('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xb932d8,_0xa3dd('0x11'),JSON[_0xa3dd('0x12')](_0x3c4a72));if(_0x3c4a72[_0xa3dd('0x13')]){if(_0x3c4a72[_0xa3dd('0x13')][_0xa3dd('0x14')]===0x1f4){logger['error'](_0xa3dd('0xf'),_0xb932d8,_0x3c4a72[_0xa3dd('0x13')][_0xa3dd('0x15')]);return _0x20d4a6(_0x3c4a72['error'][_0xa3dd('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xb932d8,_0x3c4a72[_0xa3dd('0x13')][_0xa3dd('0x15')]);return _0x41988e(_0x3c4a72[_0xa3dd('0x13')]['message']);}else{logger['info'](_0xa3dd('0xf'),_0xb932d8,_0xa3dd('0x11'));_0x41988e(_0x3c4a72[_0xa3dd('0x16')]['message']);}})[_0xa3dd('0x17')](function(_0x4a0d48){logger[_0xa3dd('0x13')](_0xa3dd('0xf'),_0xb932d8,_0x4a0d48);_0x20d4a6(_0x4a0d48);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index de769d8..01d6a29 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 _0xea54=['isAuthenticated','index','/:id','show','/:id/download','download','post','update','destroy','exports','path','../../components/interaction/service','./analyticExtractedReport.controller'];(function(_0x461119,_0x28ce98){var _0x4b5ed3=function(_0x4fdafc){while(--_0x4fdafc){_0x461119['push'](_0x461119['shift']());}};_0x4b5ed3(++_0x28ce98);}(_0xea54,0x142));var _0x4ea5=function(_0x3310b5,_0x494594){_0x3310b5=_0x3310b5-0x0;var _0x376a46=_0xea54[_0x3310b5];return _0x376a46;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ea5('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4ea5('0x1'));var config=require('../../config/environment');var controller=require(_0x4ea5('0x2'));router['get']('/',auth[_0x4ea5('0x3')](),controller[_0x4ea5('0x4')]);router['get'](_0x4ea5('0x5'),auth[_0x4ea5('0x3')](),controller[_0x4ea5('0x6')]);router['get'](_0x4ea5('0x7'),auth[_0x4ea5('0x3')](),controller[_0x4ea5('0x8')]);router[_0x4ea5('0x9')]('/',auth[_0x4ea5('0x3')](),controller['create']);router['put']('/:id',auth[_0x4ea5('0x3')](),controller[_0x4ea5('0xa')]);router['delete'](_0x4ea5('0x5'),auth[_0x4ea5('0x3')](),controller[_0x4ea5('0xb')]);module[_0x4ea5('0xc')]=router; \ No newline at end of file +var _0xa5be=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index','get','download','create','put','/:id','update','delete','destroy','exports'];(function(_0x2e6a62,_0x33da4b){var _0x5b14b5=function(_0x34b9f9){while(--_0x34b9f9){_0x2e6a62['push'](_0x2e6a62['shift']());}};_0x5b14b5(++_0x33da4b);}(_0xa5be,0x10e));var _0xea5b=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa5be[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea5b('0x0'));var timeout=require(_0xea5b('0x1'));var express=require(_0xea5b('0x2'));var router=express[_0xea5b('0x3')]();var auth=require(_0xea5b('0x4'));var interaction=require(_0xea5b('0x5'));var config=require('../../config/environment');var controller=require(_0xea5b('0x6'));router['get']('/',auth[_0xea5b('0x7')](),controller[_0xea5b('0x8')]);router[_0xea5b('0x9')]('/:id',auth[_0xea5b('0x7')](),controller['show']);router[_0xea5b('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xea5b('0xa')]);router['post']('/',auth[_0xea5b('0x7')](),controller[_0xea5b('0xb')]);router[_0xea5b('0xc')](_0xea5b('0xd'),auth[_0xea5b('0x7')](),controller[_0xea5b('0xe')]);router[_0xea5b('0xf')](_0xea5b('0xd'),auth[_0xea5b('0x7')](),controller[_0xea5b('0x10')]);module[_0xea5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f2fa5c3..fbbe949 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['sequelize','exports','STRING'];(function(_0x2fb8b6,_0x44c9f6){var _0xebc2ba=function(_0xf091c9){while(--_0xf091c9){_0x2fb8b6['push'](_0x2fb8b6['shift']());}};_0xebc2ba(++_0x44c9f6);}(_0xe14b,0x93));var _0xbe14=function(_0x4bbcc1,_0xcb8c26){_0x4bbcc1=_0x4bbcc1-0x0;var _0x2e414b=_0xe14b[_0x4bbcc1];return _0x2e414b;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x1c9d70,_0x1dd2d4){var _0x3181cb=function(_0x2c792c){while(--_0x2c792c){_0x1c9d70['push'](_0x1c9d70['shift']());}};_0x3181cb(++_0x1dd2d4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 1eadedd..7113072 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 _0x88d6=['moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','destroy','bulkDestroy','AnalyticCustomReport','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5761f1,_0x41bdf2){var _0xe285ef=function(_0x445763){while(--_0x445763){_0x5761f1['push'](_0x5761f1['shift']());}};_0xe285ef(++_0x41bdf2);}(_0x88d6,0x99));var _0x688d=function(_0x4260f7,_0x5e4d85){_0x4260f7=_0x4260f7-0x0;var _0x1fef1e=_0x88d6[_0x4260f7];return _0x1fef1e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x688d('0x0'));var rimraf=require(_0x688d('0x1'));var zipdir=require(_0x688d('0x2'));var jsonpatch=require(_0x688d('0x3'));var rp=require(_0x688d('0x4'));var moment=require(_0x688d('0x5'));var BPromise=require(_0x688d('0x6'));var Mustache=require(_0x688d('0x7'));var util=require('util');var path=require(_0x688d('0x8'));var sox=require(_0x688d('0x9'));var csv=require('to-csv');var ejs=require(_0x688d('0xa'));var fs=require('fs');var _=require(_0x688d('0xb'));var squel=require(_0x688d('0xc'));var crypto=require(_0x688d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x688d('0xe'));var toCsv=require(_0x688d('0xf'));var querystring=require(_0x688d('0x10'));var Papa=require(_0x688d('0x11'));var Redis=require(_0x688d('0x12'));var authService=require(_0x688d('0x13'));var qs=require(_0x688d('0x14'));var as=require(_0x688d('0x15'));var hardwareService=require(_0x688d('0x16'));var logger=require(_0x688d('0x17'))(_0x688d('0x18'));var utils=require(_0x688d('0x19'));var config=require(_0x688d('0x1a'));var licenseUtil=require(_0x688d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x534ec3,_0x7cf37e){_0x7cf37e=_0x7cf37e||0xcc;return function(_0x1fe364){if(_0x1fe364){return _0x534ec3[_0x688d('0x1c')](_0x7cf37e);}return _0x534ec3['status'](_0x7cf37e)['end']();};}function respondWithResult(_0x4fc9f0,_0xfc0baf){_0xfc0baf=_0xfc0baf||0xc8;return function(_0x49e656){if(_0x49e656){return _0x4fc9f0[_0x688d('0x1d')](_0xfc0baf)['json'](_0x49e656);}};}function respondWithFilteredResult(_0x58dbf3,_0x3a0691){return function(_0xf88ecc){if(_0xf88ecc){var _0x1121a6=_0xf88ecc[_0x688d('0x1e')],_0x3eac9c=_0x3a0691[_0x688d('0x1f')],_0x37880b=_0x3a0691[_0x688d('0x1f')]+_0x3a0691[_0x688d('0x20')],_0xb950fe;if(_0x37880b>=_0x1121a6){_0x37880b=_0x1121a6;_0xb950fe=0xc8;}else{_0xb950fe=0xce;}_0x58dbf3['status'](_0xb950fe);return _0x58dbf3[_0x688d('0x21')](_0x688d('0x22'),_0x3eac9c+'-'+_0x37880b+'/'+_0x1121a6)['json'](_0xf88ecc);}return null;};}function patchUpdates(_0x3523fb){return function(_0x6698ce){try{jsonpatch[_0x688d('0x23')](_0x6698ce,_0x3523fb,!![]);}catch(_0x56d617){return BPromise['reject'](_0x56d617);}return _0x6698ce[_0x688d('0x24')]();};}function saveUpdates(_0x102327,_0x2912f7){return function(_0x5114ce){if(_0x5114ce){return _0x5114ce[_0x688d('0x25')](_0x102327)[_0x688d('0x26')](function(_0x441d18){return _0x441d18;});}return null;};}function removeEntity(_0x35a423,_0x1591f6){return function(_0x4339bd){if(_0x4339bd){return _0x4339bd['destroy']()[_0x688d('0x26')](function(){_0x35a423[_0x688d('0x1d')](0xcc)[_0x688d('0x27')]();});}};}function handleEntityNotFound(_0x5b4586,_0x572714){return function(_0x4c7b06){if(!_0x4c7b06){_0x5b4586['sendStatus'](0x194);}return _0x4c7b06;};}function handleError(_0x90bd3c,_0x10c93c){_0x10c93c=_0x10c93c||0x1f4;return function(_0x50d856){logger[_0x688d('0x28')](_0x50d856[_0x688d('0x29')]);if(_0x50d856[_0x688d('0x2a')]){delete _0x50d856['name'];}_0x90bd3c['status'](_0x10c93c)['send'](_0x50d856);};}exports['index']=function(_0x5ac6d1,_0x21347d){var _0x1b38d1={},_0x351495={},_0x109de6={'count':0x0,'rows':[]};var _0x8b7957=_['map'](db[_0x688d('0x2b')][_0x688d('0x2c')],function(_0x32ce7a){return{'name':_0x32ce7a[_0x688d('0x2d')],'type':_0x32ce7a[_0x688d('0x2e')][_0x688d('0x2f')]};});_0x351495[_0x688d('0x30')]=_[_0x688d('0x31')](_0x8b7957,_0x688d('0x2a'));_0x351495[_0x688d('0x32')]=_['keys'](_0x5ac6d1[_0x688d('0x32')]);_0x351495[_0x688d('0x33')]=_[_0x688d('0x34')](_0x351495['model'],_0x351495[_0x688d('0x32')]);_0x1b38d1[_0x688d('0x35')]=_[_0x688d('0x34')](_0x351495[_0x688d('0x30')],qs[_0x688d('0x36')](_0x5ac6d1[_0x688d('0x32')]['fields']));_0x1b38d1['attributes']=_0x1b38d1['attributes'][_0x688d('0x37')]?_0x1b38d1['attributes']:_0x351495[_0x688d('0x30')];if(!_0x5ac6d1[_0x688d('0x32')][_0x688d('0x38')](_0x688d('0x39'))){_0x1b38d1['limit']=qs[_0x688d('0x20')](_0x5ac6d1[_0x688d('0x32')][_0x688d('0x20')]);_0x1b38d1['offset']=qs['offset'](_0x5ac6d1[_0x688d('0x32')][_0x688d('0x1f')]);}_0x1b38d1[_0x688d('0x3a')]=qs['sort'](_0x5ac6d1[_0x688d('0x32')][_0x688d('0x3b')]);_0x1b38d1[_0x688d('0x3c')]=qs[_0x688d('0x33')](_[_0x688d('0x3d')](_0x5ac6d1[_0x688d('0x32')],_0x351495[_0x688d('0x33')]),_0x8b7957);if(_0x5ac6d1[_0x688d('0x32')][_0x688d('0x3e')]){_0x1b38d1[_0x688d('0x3c')]=_[_0x688d('0x3f')](_0x1b38d1[_0x688d('0x3c')],{'$or':_[_0x688d('0x31')](_0x8b7957,function(_0x1de4bb){if(_0x1de4bb[_0x688d('0x2e')]!=='VIRTUAL'){var _0x17426b={};_0x17426b[_0x1de4bb[_0x688d('0x2a')]]={'$like':'%'+_0x5ac6d1[_0x688d('0x32')][_0x688d('0x3e')]+'%'};return _0x17426b;}})});}_0x1b38d1=_[_0x688d('0x3f')]({},_0x1b38d1,_0x5ac6d1[_0x688d('0x40')]);var _0x5450d7={'where':_0x1b38d1[_0x688d('0x3c')]};return db[_0x688d('0x2b')]['count'](_0x5450d7)[_0x688d('0x26')](function(_0x2c7301){_0x109de6['count']=_0x2c7301;if(_0x5ac6d1[_0x688d('0x32')][_0x688d('0x41')]){_0x1b38d1[_0x688d('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x688d('0x43')](_0x1b38d1);})['then'](function(_0x1d4587){_0x109de6[_0x688d('0x44')]=_0x1d4587;return _0x109de6;})[_0x688d('0x26')](respondWithFilteredResult(_0x21347d,_0x1b38d1))[_0x688d('0x45')](handleError(_0x21347d,null));};exports['show']=function(_0x423cc8,_0x5d930f){var _0x397a0d={'raw':![],'where':{'id':_0x423cc8[_0x688d('0x46')]['id']}},_0x4ad117={};_0x4ad117[_0x688d('0x30')]=_['keys'](db['AnalyticFieldReport'][_0x688d('0x2c')]);_0x4ad117[_0x688d('0x32')]=_['keys'](_0x423cc8[_0x688d('0x32')]);_0x4ad117['filters']=_['intersection'](_0x4ad117[_0x688d('0x30')],_0x4ad117['query']);_0x397a0d[_0x688d('0x35')]=_['intersection'](_0x4ad117['model'],qs['fields'](_0x423cc8[_0x688d('0x32')]['fields']));_0x397a0d[_0x688d('0x35')]=_0x397a0d[_0x688d('0x35')][_0x688d('0x37')]?_0x397a0d[_0x688d('0x35')]:_0x4ad117[_0x688d('0x30')];if(_0x423cc8[_0x688d('0x32')]['includeAll']){_0x397a0d[_0x688d('0x42')]=[{'all':!![]}];}_0x397a0d=_['merge']({},_0x397a0d,_0x423cc8[_0x688d('0x40')]);return db[_0x688d('0x2b')][_0x688d('0x47')](_0x397a0d)[_0x688d('0x26')](handleEntityNotFound(_0x5d930f,null))[_0x688d('0x26')](respondWithResult(_0x5d930f,null))[_0x688d('0x45')](handleError(_0x5d930f,null));};exports[_0x688d('0x48')]=function(_0xa5b94,_0x4ea6dd){return db[_0x688d('0x2b')]['create'](_0xa5b94[_0x688d('0x49')],{})[_0x688d('0x26')](respondWithResult(_0x4ea6dd,0xc9))[_0x688d('0x45')](handleError(_0x4ea6dd,null));};exports[_0x688d('0x4a')]=function(_0x45eaec,_0x3c20b4){return db['AnalyticFieldReport'][_0x688d('0x4a')](_0x45eaec['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3c20b4,0xc9))['catch'](handleError(_0x3c20b4,null));};exports['update']=function(_0x32b9cb,_0x5d820e){if(_0x32b9cb[_0x688d('0x49')]['id']){delete _0x32b9cb[_0x688d('0x49')]['id'];}return db[_0x688d('0x2b')][_0x688d('0x47')]({'where':{'id':_0x32b9cb[_0x688d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d820e,null))[_0x688d('0x26')](saveUpdates(_0x32b9cb[_0x688d('0x49')],null))[_0x688d('0x26')](respondWithResult(_0x5d820e,null))[_0x688d('0x45')](handleError(_0x5d820e,null));};exports[_0x688d('0x4b')]=function(_0x51d35a,_0x5e9b75){return db[_0x688d('0x2b')]['find']({'where':{'id':_0x51d35a['params']['id']}})['then'](handleEntityNotFound(_0x5e9b75,null))['then'](removeEntity(_0x5e9b75,null))['catch'](handleError(_0x5e9b75,null));};exports[_0x688d('0x4c')]=function(_0x30db87,_0x354d8d){return db[_0x688d('0x2b')][_0x688d('0x4b')]({'where':{'id':_0x30db87['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x688d('0x26')](respondWithResult(_0x354d8d,0xcc))[_0x688d('0x45')](handleError(_0x354d8d,null));};exports['addFields']=function(_0x4f5dcf,_0x31e9c8,_0x427bb4){return db[_0x688d('0x4d')]['findOne']({'where':{'id':_0x4f5dcf[_0x688d('0x46')]['id']}})[_0x688d('0x26')](handleEntityNotFound(_0x31e9c8,null))[_0x688d('0x26')](function(_0x2b5566){if(_0x2b5566){return db['sequelize']['transaction'](function(_0x535f38){return db[_0x688d('0x2b')]['destroy']({'where':{'CustomReportId':_0x4f5dcf[_0x688d('0x46')]['id']},'transaction':_0x535f38})[_0x688d('0x26')](function(_0x57f097){var _0x3dccad=_['map'](_0x4f5dcf[_0x688d('0x49')],function(_0x3ce315){delete _0x3ce315['id'];_0x3ce315[_0x688d('0x4e')]=_0x4f5dcf[_0x688d('0x46')]['id'];return _0x3ce315;});return db[_0x688d('0x2b')][_0x688d('0x4a')](_0x3dccad,{'transaction':_0x535f38});});})[_0x688d('0x26')](function(){return db[_0x688d('0x2b')][_0x688d('0x43')]({'where':{'CustomReportId':_0x4f5dcf['params']['id']}});});}})['then'](respondWithResult(_0x31e9c8,null))[_0x688d('0x45')](handleError(_0x31e9c8,null));}; \ No newline at end of file +var _0xc190=['find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','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/utils','../../config/license/util','../../mysqldb','end','status','json','count','offset','Content-Range','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','type','map','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','findAll','rows','catch','params','rawAttributes','includeAll','include','merge'];(function(_0x355abd,_0x52bafb){var _0x535b8f=function(_0x1931c7){while(--_0x1931c7){_0x355abd['push'](_0x355abd['shift']());}};_0x535b8f(++_0x52bafb);}(_0xc190,0x19b));var _0x0c19=function(_0x5488e0,_0x4a1463){_0x5488e0=_0x5488e0-0x0;var _0x14f1dd=_0xc190[_0x5488e0];return _0x14f1dd;};'use strict';var pdf=require(_0x0c19('0x0'));var emlformat=require(_0x0c19('0x1'));var rimraf=require(_0x0c19('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c19('0x3'));var rp=require('request-promise');var moment=require(_0x0c19('0x4'));var BPromise=require(_0x0c19('0x5'));var Mustache=require('mustache');var util=require(_0x0c19('0x6'));var path=require(_0x0c19('0x7'));var sox=require(_0x0c19('0x8'));var csv=require(_0x0c19('0x9'));var ejs=require(_0x0c19('0xa'));var fs=require('fs');var _=require(_0x0c19('0xb'));var squel=require(_0x0c19('0xc'));var crypto=require(_0x0c19('0xd'));var jsforce=require(_0x0c19('0xe'));var deskjs=require(_0x0c19('0xf'));var toCsv=require(_0x0c19('0x9'));var querystring=require(_0x0c19('0x10'));var Papa=require(_0x0c19('0x11'));var Redis=require(_0x0c19('0x12'));var authService=require(_0x0c19('0x13'));var qs=require(_0x0c19('0x14'));var as=require(_0x0c19('0x15'));var hardwareService=require(_0x0c19('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0c19('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0c19('0x18'));var db=require(_0x0c19('0x19'))['db'];function respondWithStatusCode(_0x3aa0f1,_0x2afb9f){_0x2afb9f=_0x2afb9f||0xcc;return function(_0x4801e9){if(_0x4801e9){return _0x3aa0f1['sendStatus'](_0x2afb9f);}return _0x3aa0f1['status'](_0x2afb9f)[_0x0c19('0x1a')]();};}function respondWithResult(_0x4ca8b2,_0x1df2a2){_0x1df2a2=_0x1df2a2||0xc8;return function(_0x822f91){if(_0x822f91){return _0x4ca8b2[_0x0c19('0x1b')](_0x1df2a2)[_0x0c19('0x1c')](_0x822f91);}};}function respondWithFilteredResult(_0x161dc1,_0x2f56cc){return function(_0x3a500a){if(_0x3a500a){var _0x10d285=_0x3a500a[_0x0c19('0x1d')],_0x59a9d2=_0x2f56cc[_0x0c19('0x1e')],_0x2f2cf2=_0x2f56cc['offset']+_0x2f56cc['limit'],_0x547eb0;if(_0x2f2cf2>=_0x10d285){_0x2f2cf2=_0x10d285;_0x547eb0=0xc8;}else{_0x547eb0=0xce;}_0x161dc1[_0x0c19('0x1b')](_0x547eb0);return _0x161dc1['set'](_0x0c19('0x1f'),_0x59a9d2+'-'+_0x2f2cf2+'/'+_0x10d285)['json'](_0x3a500a);}return null;};}function patchUpdates(_0x3b584d){return function(_0xb3d85c){try{jsonpatch['apply'](_0xb3d85c,_0x3b584d,!![]);}catch(_0x5e23d6){return BPromise['reject'](_0x5e23d6);}return _0xb3d85c[_0x0c19('0x20')]();};}function saveUpdates(_0x2113b4,_0x5604a6){return function(_0x43480b){if(_0x43480b){return _0x43480b[_0x0c19('0x21')](_0x2113b4)[_0x0c19('0x22')](function(_0x2830fb){return _0x2830fb;});}return null;};}function removeEntity(_0x1fcb34,_0x276b7e){return function(_0x1d04d3){if(_0x1d04d3){return _0x1d04d3[_0x0c19('0x23')]()[_0x0c19('0x22')](function(){_0x1fcb34[_0x0c19('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3a23,_0x587f35){return function(_0x2869bd){if(!_0x2869bd){_0x4b3a23['sendStatus'](0x194);}return _0x2869bd;};}function handleError(_0x1cc64c,_0x42b215){_0x42b215=_0x42b215||0x1f4;return function(_0x29684f){logger[_0x0c19('0x24')](_0x29684f[_0x0c19('0x25')]);if(_0x29684f[_0x0c19('0x26')]){delete _0x29684f[_0x0c19('0x26')];}_0x1cc64c['status'](_0x42b215)[_0x0c19('0x27')](_0x29684f);};}exports[_0x0c19('0x28')]=function(_0x449c77,_0x7a5a27){var _0x1b947e={},_0x27d468={},_0x366769={'count':0x0,'rows':[]};var _0x961bc0=_['map'](db[_0x0c19('0x29')]['rawAttributes'],function(_0x4b07ef){return{'name':_0x4b07ef['fieldName'],'type':_0x4b07ef[_0x0c19('0x2a')]['key']};});_0x27d468['model']=_[_0x0c19('0x2b')](_0x961bc0,_0x0c19('0x26'));_0x27d468['query']=_[_0x0c19('0x2c')](_0x449c77['query']);_0x27d468[_0x0c19('0x2d')]=_[_0x0c19('0x2e')](_0x27d468[_0x0c19('0x2f')],_0x27d468['query']);_0x1b947e[_0x0c19('0x30')]=_['intersection'](_0x27d468[_0x0c19('0x2f')],qs['fields'](_0x449c77['query'][_0x0c19('0x31')]));_0x1b947e[_0x0c19('0x30')]=_0x1b947e[_0x0c19('0x30')][_0x0c19('0x32')]?_0x1b947e['attributes']:_0x27d468[_0x0c19('0x2f')];if(!_0x449c77[_0x0c19('0x33')][_0x0c19('0x34')](_0x0c19('0x35'))){_0x1b947e['limit']=qs['limit'](_0x449c77['query'][_0x0c19('0x36')]);_0x1b947e[_0x0c19('0x1e')]=qs[_0x0c19('0x1e')](_0x449c77['query'][_0x0c19('0x1e')]);}_0x1b947e[_0x0c19('0x37')]=qs[_0x0c19('0x38')](_0x449c77[_0x0c19('0x33')]['sort']);_0x1b947e[_0x0c19('0x39')]=qs[_0x0c19('0x2d')](_[_0x0c19('0x3a')](_0x449c77[_0x0c19('0x33')],_0x27d468['filters']),_0x961bc0);if(_0x449c77['query'][_0x0c19('0x3b')]){_0x1b947e['where']=_['merge'](_0x1b947e[_0x0c19('0x39')],{'$or':_[_0x0c19('0x2b')](_0x961bc0,function(_0x5eb5ad){if(_0x5eb5ad[_0x0c19('0x2a')]!=='VIRTUAL'){var _0x269263={};_0x269263[_0x5eb5ad[_0x0c19('0x26')]]={'$like':'%'+_0x449c77['query']['filter']+'%'};return _0x269263;}})});}_0x1b947e=_['merge']({},_0x1b947e,_0x449c77[_0x0c19('0x3c')]);var _0x17b637={'where':_0x1b947e['where']};return db[_0x0c19('0x29')][_0x0c19('0x1d')](_0x17b637)['then'](function(_0x210423){_0x366769[_0x0c19('0x1d')]=_0x210423;if(_0x449c77['query']['includeAll']){_0x1b947e['include']=[{'all':!![]}];}return db[_0x0c19('0x29')][_0x0c19('0x3d')](_0x1b947e);})[_0x0c19('0x22')](function(_0xc5df5f){_0x366769[_0x0c19('0x3e')]=_0xc5df5f;return _0x366769;})['then'](respondWithFilteredResult(_0x7a5a27,_0x1b947e))[_0x0c19('0x3f')](handleError(_0x7a5a27,null));};exports['show']=function(_0x4ea5dc,_0x34d1da){var _0x564e9d={'raw':![],'where':{'id':_0x4ea5dc[_0x0c19('0x40')]['id']}},_0x10e371={};_0x10e371[_0x0c19('0x2f')]=_[_0x0c19('0x2c')](db[_0x0c19('0x29')][_0x0c19('0x41')]);_0x10e371[_0x0c19('0x33')]=_[_0x0c19('0x2c')](_0x4ea5dc[_0x0c19('0x33')]);_0x10e371[_0x0c19('0x2d')]=_[_0x0c19('0x2e')](_0x10e371[_0x0c19('0x2f')],_0x10e371[_0x0c19('0x33')]);_0x564e9d['attributes']=_[_0x0c19('0x2e')](_0x10e371[_0x0c19('0x2f')],qs[_0x0c19('0x31')](_0x4ea5dc[_0x0c19('0x33')][_0x0c19('0x31')]));_0x564e9d[_0x0c19('0x30')]=_0x564e9d[_0x0c19('0x30')][_0x0c19('0x32')]?_0x564e9d['attributes']:_0x10e371[_0x0c19('0x2f')];if(_0x4ea5dc['query'][_0x0c19('0x42')]){_0x564e9d[_0x0c19('0x43')]=[{'all':!![]}];}_0x564e9d=_[_0x0c19('0x44')]({},_0x564e9d,_0x4ea5dc[_0x0c19('0x3c')]);return db[_0x0c19('0x29')][_0x0c19('0x45')](_0x564e9d)[_0x0c19('0x22')](handleEntityNotFound(_0x34d1da,null))[_0x0c19('0x22')](respondWithResult(_0x34d1da,null))[_0x0c19('0x3f')](handleError(_0x34d1da,null));};exports[_0x0c19('0x46')]=function(_0x4a2179,_0x4742f6){return db['AnalyticFieldReport'][_0x0c19('0x46')](_0x4a2179[_0x0c19('0x47')],{})[_0x0c19('0x22')](respondWithResult(_0x4742f6,0xc9))[_0x0c19('0x3f')](handleError(_0x4742f6,null));};exports[_0x0c19('0x48')]=function(_0x15a4d1,_0x3cb8a9){return db['AnalyticFieldReport']['bulkCreate'](_0x15a4d1[_0x0c19('0x47')],{'raw':![],'individualHooks':!![]})[_0x0c19('0x22')](respondWithResult(_0x3cb8a9,0xc9))['catch'](handleError(_0x3cb8a9,null));};exports['update']=function(_0x278b94,_0x48e57f){if(_0x278b94[_0x0c19('0x47')]['id']){delete _0x278b94[_0x0c19('0x47')]['id'];}return db[_0x0c19('0x29')]['find']({'where':{'id':_0x278b94[_0x0c19('0x40')]['id']}})['then'](handleEntityNotFound(_0x48e57f,null))[_0x0c19('0x22')](saveUpdates(_0x278b94[_0x0c19('0x47')],null))[_0x0c19('0x22')](respondWithResult(_0x48e57f,null))[_0x0c19('0x3f')](handleError(_0x48e57f,null));};exports[_0x0c19('0x23')]=function(_0x1ed7ae,_0x48efdf){return db[_0x0c19('0x29')][_0x0c19('0x45')]({'where':{'id':_0x1ed7ae[_0x0c19('0x40')]['id']}})[_0x0c19('0x22')](handleEntityNotFound(_0x48efdf,null))[_0x0c19('0x22')](removeEntity(_0x48efdf,null))[_0x0c19('0x3f')](handleError(_0x48efdf,null));};exports[_0x0c19('0x49')]=function(_0x1875ee,_0x4df735){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x1875ee[_0x0c19('0x33')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x0c19('0x22')](respondWithResult(_0x4df735,0xcc))['catch'](handleError(_0x4df735,null));};exports[_0x0c19('0x4a')]=function(_0x312cb1,_0x23aa53,_0x5bdfe3){return db[_0x0c19('0x4b')][_0x0c19('0x4c')]({'where':{'id':_0x312cb1[_0x0c19('0x40')]['id']}})[_0x0c19('0x22')](handleEntityNotFound(_0x23aa53,null))['then'](function(_0x2e3eef){if(_0x2e3eef){return db[_0x0c19('0x4d')][_0x0c19('0x4e')](function(_0x3da0a4){return db[_0x0c19('0x29')][_0x0c19('0x23')]({'where':{'CustomReportId':_0x312cb1['params']['id']},'transaction':_0x3da0a4})[_0x0c19('0x22')](function(_0x55fa55){var _0x10df31=_[_0x0c19('0x2b')](_0x312cb1[_0x0c19('0x47')],function(_0x332869){delete _0x332869['id'];_0x332869[_0x0c19('0x4f')]=_0x312cb1['params']['id'];return _0x332869;});return db[_0x0c19('0x29')]['bulkCreate'](_0x10df31,{'transaction':_0x3da0a4});});})['then'](function(){return db[_0x0c19('0x29')][_0x0c19('0x3d')]({'where':{'CustomReportId':_0x312cb1[_0x0c19('0x40')]['id']}});});}})['then'](respondWithResult(_0x23aa53,null))[_0x0c19('0x3f')](handleError(_0x23aa53,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7aaf906..6e7d846 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 _0x00fe=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x00fe,0xd1));var _0xe00f=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x00fe[_0x246148];return _0x453d94;};'use strict';var _=require(_0xe00f('0x0'));var util=require(_0xe00f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe00f('0x2'));var BPromise=require('bluebird');var rp=require(_0xe00f('0x3'));var fs=require('fs');var path=require(_0xe00f('0x4'));var rimraf=require(_0xe00f('0x5'));var config=require(_0xe00f('0x6'));var attributes=require(_0xe00f('0x7'));module[_0xe00f('0x8')]=function(_0x8833f2,_0x5db3c0){return _0x8833f2[_0xe00f('0x9')](_0xe00f('0xa'),attributes,{'tableName':_0xe00f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa909=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash'];(function(_0x262bf7,_0x5b9989){var _0xe2d32b=function(_0x250335){while(--_0x250335){_0x262bf7['push'](_0x262bf7['shift']());}};_0xe2d32b(++_0x5b9989);}(_0xa909,0x1a1));var _0x9a90=function(_0x1e7a7a,_0x394ff7){_0x1e7a7a=_0x1e7a7a-0x0;var _0x1c7971=_0xa909[_0x1e7a7a];return _0x1c7971;};'use strict';var _=require(_0x9a90('0x0'));var util=require('util');var logger=require(_0x9a90('0x1'))(_0x9a90('0x2'));var moment=require(_0x9a90('0x3'));var BPromise=require(_0x9a90('0x4'));var rp=require(_0x9a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a90('0x6'));var config=require('../../config/environment');var attributes=require(_0x9a90('0x7'));module[_0x9a90('0x8')]=function(_0x29702d,_0x4d05d2){return _0x29702d[_0x9a90('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x9a90('0xa'),'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 a52e854..f3f3571 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 _0xe851=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x35b226,_0x4547ed){var _0x16c127=function(_0x58dbde){while(--_0x58dbde){_0x35b226['push'](_0x35b226['shift']());}};_0x16c127(++_0x4547ed);}(_0xe851,0x15a));var _0x1e85=function(_0x138fc7,_0x51e795){_0x138fc7=_0x138fc7-0x0;var _0x14d025=_0xe851[_0x138fc7];return _0x14d025;};'use strict';var _=require(_0x1e85('0x0'));var util=require(_0x1e85('0x1'));var moment=require(_0x1e85('0x2'));var BPromise=require(_0x1e85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e85('0x4'));var db=require(_0x1e85('0x5'))['db'];var utils=require(_0x1e85('0x6'));var logger=require(_0x1e85('0x7'))(_0x1e85('0x8'));var config=require('../../config/environment');var jayson=require(_0x1e85('0x9'));var client=jayson[_0x1e85('0xa')][_0x1e85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38c48c,_0x5c2a40,_0x7e693a){return new BPromise(function(_0x27526c,_0x433bdf){return client[_0x1e85('0xc')](_0x38c48c,_0x7e693a)['then'](function(_0x42d7e0){logger[_0x1e85('0xd')](_0x1e85('0xe'),_0x5c2a40,'request\x20sent');logger[_0x1e85('0xf')](_0x1e85('0x10'),_0x5c2a40,_0x1e85('0x11'),JSON['stringify'](_0x42d7e0));if(_0x42d7e0[_0x1e85('0x12')]){if(_0x42d7e0[_0x1e85('0x12')][_0x1e85('0x13')]===0x1f4){logger[_0x1e85('0x12')](_0x1e85('0xe'),_0x5c2a40,_0x42d7e0['error'][_0x1e85('0x14')]);return _0x433bdf(_0x42d7e0['error']['message']);}logger[_0x1e85('0x12')](_0x1e85('0xe'),_0x5c2a40,_0x42d7e0['error'][_0x1e85('0x14')]);return _0x27526c(_0x42d7e0[_0x1e85('0x12')][_0x1e85('0x14')]);}else{logger[_0x1e85('0xd')](_0x1e85('0xe'),_0x5c2a40,_0x1e85('0x11'));_0x27526c(_0x42d7e0[_0x1e85('0x15')][_0x1e85('0x14')]);}})[_0x1e85('0x16')](function(_0x4bc26c){logger[_0x1e85('0x12')](_0x1e85('0xe'),_0x5c2a40,_0x4bc26c);_0x433bdf(_0x4bc26c);});});} \ No newline at end of file +var _0x3c5b=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c468e,_0x176a7c){var _0x237028=function(_0x1cc8d1){while(--_0x1cc8d1){_0x5c468e['push'](_0x5c468e['shift']());}};_0x237028(++_0x176a7c);}(_0x3c5b,0x85));var _0xb3c5=function(_0x2bc7fa,_0x2be2b6){_0x2bc7fa=_0x2bc7fa-0x0;var _0x3f3e8a=_0x3c5b[_0x2bc7fa];return _0x3f3e8a;};'use strict';var _=require(_0xb3c5('0x0'));var util=require(_0xb3c5('0x1'));var moment=require(_0xb3c5('0x2'));var BPromise=require(_0xb3c5('0x3'));var rs=require(_0xb3c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3c5('0x5'))['db'];var utils=require(_0xb3c5('0x6'));var logger=require('../../config/logger')(_0xb3c5('0x7'));var config=require(_0xb3c5('0x8'));var jayson=require(_0xb3c5('0x9'));var client=jayson[_0xb3c5('0xa')][_0xb3c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55287e,_0x3ca62c,_0x1d70c3){return new BPromise(function(_0x173d4c,_0x2677ec){return client[_0xb3c5('0xc')](_0x55287e,_0x1d70c3)[_0xb3c5('0xd')](function(_0x4b7af3){logger[_0xb3c5('0xe')](_0xb3c5('0xf'),_0x3ca62c,_0xb3c5('0x10'));logger[_0xb3c5('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3ca62c,'request\x20sent',JSON[_0xb3c5('0x12')](_0x4b7af3));if(_0x4b7af3['error']){if(_0x4b7af3[_0xb3c5('0x13')][_0xb3c5('0x14')]===0x1f4){logger[_0xb3c5('0x13')](_0xb3c5('0xf'),_0x3ca62c,_0x4b7af3[_0xb3c5('0x13')]['message']);return _0x2677ec(_0x4b7af3['error'][_0xb3c5('0x15')]);}logger['error'](_0xb3c5('0xf'),_0x3ca62c,_0x4b7af3[_0xb3c5('0x13')][_0xb3c5('0x15')]);return _0x173d4c(_0x4b7af3['error'][_0xb3c5('0x15')]);}else{logger[_0xb3c5('0xe')](_0xb3c5('0xf'),_0x3ca62c,_0xb3c5('0x10'));_0x173d4c(_0x4b7af3[_0xb3c5('0x16')]['message']);}})[_0xb3c5('0x17')](function(_0x38b352){logger[_0xb3c5('0x13')](_0xb3c5('0xf'),_0x3ca62c,_0x38b352);_0x2677ec(_0x38b352);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c5a6675..e0c5c5a 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 _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0x18ebf5,_0x5889ea){_0x18ebf5=_0x18ebf5-0x0;var _0x302a3e=_0x55ca[_0x18ebf5];return _0x302a3e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xf16d7d,_0x490695){var _0x347b0c=function(_0x30cf89){while(--_0x30cf89){_0xf16d7d['push'](_0xf16d7d['shift']());}};_0x347b0c(++_0x490695);}(_0x814b,0x1a2));var _0xb814=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x814b[_0x587dd0];return _0x56f153;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index baf8d2a..c4ffb2a 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 _0x83e1=['TEXT','sequelize','exports','name'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x83e1,0x1ad));var _0x183e=function(_0x4aac14,_0x361b03){_0x4aac14=_0x4aac14-0x0;var _0x2b58dc=_0x83e1[_0x4aac14];return _0x2b58dc;};'use strict';var Sequelize=require(_0x183e('0x0'));module[_0x183e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x183e('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x183e('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0102=['exports','STRING','name'];(function(_0x596639,_0x55eac0){var _0x1351eb=function(_0x2047b7){while(--_0x2047b7){_0x596639['push'](_0x596639['shift']());}};_0x1351eb(++_0x55eac0);}(_0x0102,0x186));var _0x2010=function(_0x1b6b07,_0x49a796){_0x1b6b07=_0x1b6b07-0x0;var _0x569b15=_0x0102[_0x1b6b07];return _0x569b15;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'name':{'type':Sequelize[_0x2010('0x1')],'allowNull':![],'unique':_0x2010('0x2')},'table':{'type':Sequelize[_0x2010('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 82d7318..2306086 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 _0x034d=['rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','error','name','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticMetric','findAll'];(function(_0x57477f,_0x3d60b4){var _0x1853fc=function(_0x37dde6){while(--_0x37dde6){_0x57477f['push'](_0x57477f['shift']());}};_0x1853fc(++_0x3d60b4);}(_0x034d,0x1d1));var _0xd034=function(_0x5b19f5,_0x541ad8){_0x5b19f5=_0x5b19f5-0x0;var _0x5a1885=_0x034d[_0x5b19f5];return _0x5a1885;};'use strict';var pdf=require(_0xd034('0x0'));var emlformat=require(_0xd034('0x1'));var rimraf=require(_0xd034('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd034('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd034('0x4'));var Mustache=require(_0xd034('0x5'));var util=require('util');var path=require(_0xd034('0x6'));var sox=require(_0xd034('0x7'));var csv=require(_0xd034('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd034('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd034('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd034('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd034('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd034('0xd'));var hardwareService=require(_0xd034('0xe'));var logger=require('../../config/logger')(_0xd034('0xf'));var utils=require(_0xd034('0x10'));var config=require(_0xd034('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xd034('0x12'))['db'];function respondWithStatusCode(_0x5cbe19,_0x4c17b0){_0x4c17b0=_0x4c17b0||0xcc;return function(_0x259a50){if(_0x259a50){return _0x5cbe19[_0xd034('0x13')](_0x4c17b0);}return _0x5cbe19['status'](_0x4c17b0)['end']();};}function respondWithResult(_0x28a489,_0x59f2da){_0x59f2da=_0x59f2da||0xc8;return function(_0x4667fb){if(_0x4667fb){return _0x28a489[_0xd034('0x14')](_0x59f2da)['json'](_0x4667fb);}};}function respondWithFilteredResult(_0x367269,_0x707a44){return function(_0x4fdf52){if(_0x4fdf52){var _0x5c2381=_0x4fdf52[_0xd034('0x15')],_0x3a166b=_0x707a44[_0xd034('0x16')],_0x11f9d2=_0x707a44['offset']+_0x707a44[_0xd034('0x17')],_0x8adb7f;if(_0x11f9d2>=_0x5c2381){_0x11f9d2=_0x5c2381;_0x8adb7f=0xc8;}else{_0x8adb7f=0xce;}_0x367269[_0xd034('0x14')](_0x8adb7f);return _0x367269[_0xd034('0x18')](_0xd034('0x19'),_0x3a166b+'-'+_0x11f9d2+'/'+_0x5c2381)['json'](_0x4fdf52);}return null;};}function patchUpdates(_0x3c0fab){return function(_0x28d168){try{jsonpatch[_0xd034('0x1a')](_0x28d168,_0x3c0fab,!![]);}catch(_0x1d64ab){return BPromise[_0xd034('0x1b')](_0x1d64ab);}return _0x28d168[_0xd034('0x1c')]();};}function saveUpdates(_0x29da1b,_0x4eb965){return function(_0x330035){if(_0x330035){return _0x330035[_0xd034('0x1d')](_0x29da1b)['then'](function(_0x2a7578){return _0x2a7578;});}return null;};}function removeEntity(_0x27041e,_0x58a33b){return function(_0x2e88c1){if(_0x2e88c1){return _0x2e88c1['destroy']()[_0xd034('0x1e')](function(){var _0xa3f0bb=_0x2e88c1[_0xd034('0x1f')]({'plain':!![]});var _0x414d8f='Metrics';return db['UserProfileResource'][_0xd034('0x20')]({'where':{'type':_0x414d8f,'resourceId':_0xa3f0bb['id']}})[_0xd034('0x1e')](function(){return _0x2e88c1;});})[_0xd034('0x1e')](function(){_0x27041e[_0xd034('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aec01,_0x1eb31b){return function(_0x585af3){if(!_0x585af3){_0x3aec01[_0xd034('0x13')](0x194);}return _0x585af3;};}function handleError(_0x4614fd,_0x2e8e9a){_0x2e8e9a=_0x2e8e9a||0x1f4;return function(_0x2b8c7){logger[_0xd034('0x21')](_0x2b8c7['stack']);if(_0x2b8c7[_0xd034('0x22')]){delete _0x2b8c7[_0xd034('0x22')];}_0x4614fd[_0xd034('0x14')](_0x2e8e9a)['send'](_0x2b8c7);};}exports[_0xd034('0x23')]=function(_0x246e0a,_0x30a605){var _0x2234e1={},_0x397fee={},_0x5947ef={'count':0x0,'rows':[]};var _0x4366b4=_['map'](db['AnalyticMetric']['rawAttributes'],function(_0x119621){return{'name':_0x119621[_0xd034('0x24')],'type':_0x119621[_0xd034('0x25')]['key']};});_0x397fee[_0xd034('0x26')]=_[_0xd034('0x27')](_0x4366b4,_0xd034('0x22'));_0x397fee[_0xd034('0x28')]=_[_0xd034('0x29')](_0x246e0a[_0xd034('0x28')]);_0x397fee[_0xd034('0x2a')]=_[_0xd034('0x2b')](_0x397fee[_0xd034('0x26')],_0x397fee[_0xd034('0x28')]);_0x2234e1[_0xd034('0x2c')]=_[_0xd034('0x2b')](_0x397fee[_0xd034('0x26')],qs[_0xd034('0x2d')](_0x246e0a[_0xd034('0x28')][_0xd034('0x2d')]));_0x2234e1[_0xd034('0x2c')]=_0x2234e1[_0xd034('0x2c')][_0xd034('0x2e')]?_0x2234e1[_0xd034('0x2c')]:_0x397fee['model'];if(!_0x246e0a[_0xd034('0x28')]['hasOwnProperty'](_0xd034('0x2f'))){_0x2234e1['limit']=qs[_0xd034('0x17')](_0x246e0a[_0xd034('0x28')][_0xd034('0x17')]);_0x2234e1[_0xd034('0x16')]=qs[_0xd034('0x16')](_0x246e0a[_0xd034('0x28')][_0xd034('0x16')]);}_0x2234e1[_0xd034('0x30')]=qs[_0xd034('0x31')](_0x246e0a[_0xd034('0x28')]['sort']);_0x2234e1[_0xd034('0x32')]=qs[_0xd034('0x2a')](_[_0xd034('0x33')](_0x246e0a[_0xd034('0x28')],_0x397fee[_0xd034('0x2a')]),_0x4366b4);if(_0x246e0a[_0xd034('0x28')][_0xd034('0x34')]){_0x2234e1[_0xd034('0x32')]=_[_0xd034('0x35')](_0x2234e1[_0xd034('0x32')],{'$or':_[_0xd034('0x27')](_0x4366b4,function(_0x102408){if(_0x102408[_0xd034('0x25')]!==_0xd034('0x36')){var _0x2b451a={};_0x2b451a[_0x102408[_0xd034('0x22')]]={'$like':'%'+_0x246e0a['query']['filter']+'%'};return _0x2b451a;}})});}_0x2234e1=_[_0xd034('0x35')]({},_0x2234e1,_0x246e0a[_0xd034('0x37')]);var _0x5195c5={'where':_0x2234e1['where']};return db['AnalyticMetric'][_0xd034('0x15')](_0x5195c5)[_0xd034('0x1e')](function(_0x24ab04){_0x5947ef[_0xd034('0x15')]=_0x24ab04;if(_0x246e0a[_0xd034('0x28')][_0xd034('0x38')]){_0x2234e1[_0xd034('0x39')]=[{'all':!![]}];}return db[_0xd034('0x3a')][_0xd034('0x3b')](_0x2234e1);})[_0xd034('0x1e')](function(_0x43727b){_0x5947ef[_0xd034('0x3c')]=_0x43727b;return _0x5947ef;})[_0xd034('0x1e')](respondWithFilteredResult(_0x30a605,_0x2234e1))[_0xd034('0x3d')](handleError(_0x30a605,null));};exports[_0xd034('0x3e')]=function(_0x4e4300,_0x2a16cf){var _0x5661f7={'raw':!![],'where':{'id':_0x4e4300[_0xd034('0x3f')]['id']}},_0x1d1ed7={};_0x1d1ed7['model']=_[_0xd034('0x29')](db[_0xd034('0x3a')][_0xd034('0x40')]);_0x1d1ed7[_0xd034('0x28')]=_[_0xd034('0x29')](_0x4e4300['query']);_0x1d1ed7[_0xd034('0x2a')]=_[_0xd034('0x2b')](_0x1d1ed7[_0xd034('0x26')],_0x1d1ed7['query']);_0x5661f7['attributes']=_[_0xd034('0x2b')](_0x1d1ed7[_0xd034('0x26')],qs[_0xd034('0x2d')](_0x4e4300[_0xd034('0x28')][_0xd034('0x2d')]));_0x5661f7[_0xd034('0x2c')]=_0x5661f7[_0xd034('0x2c')][_0xd034('0x2e')]?_0x5661f7[_0xd034('0x2c')]:_0x1d1ed7['model'];if(_0x4e4300[_0xd034('0x28')][_0xd034('0x38')]){_0x5661f7[_0xd034('0x39')]=[{'all':!![]}];}_0x5661f7=_['merge']({},_0x5661f7,_0x4e4300['options']);return db[_0xd034('0x3a')][_0xd034('0x41')](_0x5661f7)[_0xd034('0x1e')](handleEntityNotFound(_0x2a16cf,null))[_0xd034('0x1e')](respondWithResult(_0x2a16cf,null))[_0xd034('0x3d')](handleError(_0x2a16cf,null));};exports[_0xd034('0x42')]=function(_0x5cadff,_0x59e858){return db[_0xd034('0x3a')][_0xd034('0x42')](_0x5cadff[_0xd034('0x43')],{})['then'](function(_0x48828e){var _0x2d6e23=_0x5cadff[_0xd034('0x44')][_0xd034('0x1f')]({'plain':!![]});if(!_0x2d6e23)throw new Error(_0xd034('0x45'));if(_0x2d6e23[_0xd034('0x46')]==='user'){var _0x1100fc=_0x48828e[_0xd034('0x1f')]({'plain':!![]});var _0x6bbb35=_0xd034('0x47');return db['UserProfileSection'][_0xd034('0x41')]({'where':{'name':_0x6bbb35,'userProfileId':_0x2d6e23['userProfileId']},'raw':!![]})[_0xd034('0x1e')](function(_0x330545){if(_0x330545&&_0x330545[_0xd034('0x48')]===0x0){return db[_0xd034('0x49')][_0xd034('0x42')]({'name':_0x1100fc[_0xd034('0x22')],'resourceId':_0x1100fc['id'],'type':_0x330545[_0xd034('0x22')],'sectionId':_0x330545['id']},{})['then'](function(){return _0x48828e;});}else{return _0x48828e;}})[_0xd034('0x3d')](function(_0x1353df){logger[_0xd034('0x21')](_0xd034('0x4a'),_0x1353df);throw _0x1353df;});}return _0x48828e;})[_0xd034('0x1e')](respondWithResult(_0x59e858,0xc9))[_0xd034('0x3d')](handleError(_0x59e858,null));};exports[_0xd034('0x1d')]=function(_0x56b579,_0x6462e8){if(_0x56b579[_0xd034('0x43')]['id']){delete _0x56b579[_0xd034('0x43')]['id'];}return db['AnalyticMetric'][_0xd034('0x41')]({'where':{'id':_0x56b579[_0xd034('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6462e8,null))['then'](saveUpdates(_0x56b579[_0xd034('0x43')],null))[_0xd034('0x1e')](respondWithResult(_0x6462e8,null))[_0xd034('0x3d')](handleError(_0x6462e8,null));};exports['destroy']=function(_0x5bf3a3,_0x16127f){return db[_0xd034('0x3a')][_0xd034('0x41')]({'where':{'id':_0x5bf3a3['params']['id']}})[_0xd034('0x1e')](handleEntityNotFound(_0x16127f,null))[_0xd034('0x1e')](removeEntity(_0x16127f,null))[_0xd034('0x3d')](handleError(_0x16127f,null));}; \ No newline at end of file +var _0x5495=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5bc9b9,_0x48aaf5){var _0x9a08cf=function(_0x39822a){while(--_0x39822a){_0x5bc9b9['push'](_0x5bc9b9['shift']());}};_0x9a08cf(++_0x48aaf5);}(_0x5495,0x143));var _0x5549=function(_0x1b70a5,_0x3a7b2f){_0x1b70a5=_0x1b70a5-0x0;var _0x547be0=_0x5495[_0x1b70a5];return _0x547be0;};'use strict';var pdf=require(_0x5549('0x0'));var emlformat=require(_0x5549('0x1'));var rimraf=require(_0x5549('0x2'));var zipdir=require(_0x5549('0x3'));var jsonpatch=require(_0x5549('0x4'));var rp=require(_0x5549('0x5'));var moment=require(_0x5549('0x6'));var BPromise=require(_0x5549('0x7'));var Mustache=require(_0x5549('0x8'));var util=require(_0x5549('0x9'));var path=require('path');var sox=require(_0x5549('0xa'));var csv=require('to-csv');var ejs=require(_0x5549('0xb'));var fs=require('fs');var _=require(_0x5549('0xc'));var squel=require(_0x5549('0xd'));var crypto=require(_0x5549('0xe'));var jsforce=require(_0x5549('0xf'));var deskjs=require(_0x5549('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5549('0x11'));var Redis=require(_0x5549('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5549('0x13'));var as=require(_0x5549('0x14'));var hardwareService=require(_0x5549('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5549('0x16'));var config=require(_0x5549('0x17'));var licenseUtil=require(_0x5549('0x18'));var db=require(_0x5549('0x19'))['db'];function respondWithStatusCode(_0x5b37cd,_0x101e0b){_0x101e0b=_0x101e0b||0xcc;return function(_0x1e951d){if(_0x1e951d){return _0x5b37cd[_0x5549('0x1a')](_0x101e0b);}return _0x5b37cd[_0x5549('0x1b')](_0x101e0b)[_0x5549('0x1c')]();};}function respondWithResult(_0x6be1de,_0x4bcac3){_0x4bcac3=_0x4bcac3||0xc8;return function(_0x14a278){if(_0x14a278){return _0x6be1de[_0x5549('0x1b')](_0x4bcac3)['json'](_0x14a278);}};}function respondWithFilteredResult(_0x60377c,_0xde6f3f){return function(_0x40e3fa){if(_0x40e3fa){var _0x5dae65=_0x40e3fa['count'],_0x2f67ae=_0xde6f3f[_0x5549('0x1d')],_0x1b9f3f=_0xde6f3f[_0x5549('0x1d')]+_0xde6f3f[_0x5549('0x1e')],_0x5bb97e;if(_0x1b9f3f>=_0x5dae65){_0x1b9f3f=_0x5dae65;_0x5bb97e=0xc8;}else{_0x5bb97e=0xce;}_0x60377c[_0x5549('0x1b')](_0x5bb97e);return _0x60377c[_0x5549('0x1f')](_0x5549('0x20'),_0x2f67ae+'-'+_0x1b9f3f+'/'+_0x5dae65)['json'](_0x40e3fa);}return null;};}function patchUpdates(_0x3fe955){return function(_0x4e5ffc){try{jsonpatch[_0x5549('0x21')](_0x4e5ffc,_0x3fe955,!![]);}catch(_0x4192c2){return BPromise[_0x5549('0x22')](_0x4192c2);}return _0x4e5ffc[_0x5549('0x23')]();};}function saveUpdates(_0x17732e,_0x558f45){return function(_0x49cc3e){if(_0x49cc3e){return _0x49cc3e[_0x5549('0x24')](_0x17732e)[_0x5549('0x25')](function(_0x15153f){return _0x15153f;});}return null;};}function removeEntity(_0x1d3bc8,_0x2813d8){return function(_0x334a29){if(_0x334a29){return _0x334a29[_0x5549('0x26')]()[_0x5549('0x25')](function(){var _0x12c633=_0x334a29[_0x5549('0x27')]({'plain':!![]});var _0x289a14=_0x5549('0x28');return db[_0x5549('0x29')][_0x5549('0x26')]({'where':{'type':_0x289a14,'resourceId':_0x12c633['id']}})[_0x5549('0x25')](function(){return _0x334a29;});})[_0x5549('0x25')](function(){_0x1d3bc8['status'](0xcc)[_0x5549('0x1c')]();});}};}function handleEntityNotFound(_0x1a780f,_0x2cd2fa){return function(_0xb2650f){if(!_0xb2650f){_0x1a780f[_0x5549('0x1a')](0x194);}return _0xb2650f;};}function handleError(_0x113733,_0x9283c){_0x9283c=_0x9283c||0x1f4;return function(_0x850c47){logger[_0x5549('0x2a')](_0x850c47[_0x5549('0x2b')]);if(_0x850c47['name']){delete _0x850c47[_0x5549('0x2c')];}_0x113733[_0x5549('0x1b')](_0x9283c)[_0x5549('0x2d')](_0x850c47);};}exports[_0x5549('0x2e')]=function(_0x2b5af5,_0x1f1ed3){var _0x3031ef={},_0x1f3035={},_0x589dd8={'count':0x0,'rows':[]};var _0x51dd79=_['map'](db[_0x5549('0x2f')][_0x5549('0x30')],function(_0x5b55e6){return{'name':_0x5b55e6[_0x5549('0x31')],'type':_0x5b55e6[_0x5549('0x32')][_0x5549('0x33')]};});_0x1f3035[_0x5549('0x34')]=_[_0x5549('0x35')](_0x51dd79,_0x5549('0x2c'));_0x1f3035['query']=_[_0x5549('0x36')](_0x2b5af5[_0x5549('0x37')]);_0x1f3035[_0x5549('0x38')]=_[_0x5549('0x39')](_0x1f3035[_0x5549('0x34')],_0x1f3035[_0x5549('0x37')]);_0x3031ef[_0x5549('0x3a')]=_[_0x5549('0x39')](_0x1f3035[_0x5549('0x34')],qs['fields'](_0x2b5af5[_0x5549('0x37')][_0x5549('0x3b')]));_0x3031ef[_0x5549('0x3a')]=_0x3031ef[_0x5549('0x3a')][_0x5549('0x3c')]?_0x3031ef['attributes']:_0x1f3035[_0x5549('0x34')];if(!_0x2b5af5[_0x5549('0x37')][_0x5549('0x3d')](_0x5549('0x3e'))){_0x3031ef[_0x5549('0x1e')]=qs[_0x5549('0x1e')](_0x2b5af5[_0x5549('0x37')][_0x5549('0x1e')]);_0x3031ef[_0x5549('0x1d')]=qs[_0x5549('0x1d')](_0x2b5af5[_0x5549('0x37')][_0x5549('0x1d')]);}_0x3031ef[_0x5549('0x3f')]=qs[_0x5549('0x40')](_0x2b5af5['query'][_0x5549('0x40')]);_0x3031ef[_0x5549('0x41')]=qs['filters'](_[_0x5549('0x42')](_0x2b5af5['query'],_0x1f3035['filters']),_0x51dd79);if(_0x2b5af5[_0x5549('0x37')][_0x5549('0x43')]){_0x3031ef[_0x5549('0x41')]=_[_0x5549('0x44')](_0x3031ef[_0x5549('0x41')],{'$or':_[_0x5549('0x35')](_0x51dd79,function(_0xfaff84){if(_0xfaff84['type']!==_0x5549('0x45')){var _0xcd1492={};_0xcd1492[_0xfaff84[_0x5549('0x2c')]]={'$like':'%'+_0x2b5af5['query'][_0x5549('0x43')]+'%'};return _0xcd1492;}})});}_0x3031ef=_[_0x5549('0x44')]({},_0x3031ef,_0x2b5af5['options']);var _0x3c5b29={'where':_0x3031ef[_0x5549('0x41')]};return db[_0x5549('0x2f')]['count'](_0x3c5b29)[_0x5549('0x25')](function(_0x230de9){_0x589dd8[_0x5549('0x46')]=_0x230de9;if(_0x2b5af5['query']['includeAll']){_0x3031ef[_0x5549('0x47')]=[{'all':!![]}];}return db[_0x5549('0x2f')][_0x5549('0x48')](_0x3031ef);})['then'](function(_0x2a4362){_0x589dd8[_0x5549('0x49')]=_0x2a4362;return _0x589dd8;})[_0x5549('0x25')](respondWithFilteredResult(_0x1f1ed3,_0x3031ef))[_0x5549('0x4a')](handleError(_0x1f1ed3,null));};exports[_0x5549('0x4b')]=function(_0x39a919,_0xa9e431){var _0x2f94ff={'raw':!![],'where':{'id':_0x39a919[_0x5549('0x4c')]['id']}},_0x28c846={};_0x28c846['model']=_[_0x5549('0x36')](db[_0x5549('0x2f')][_0x5549('0x30')]);_0x28c846[_0x5549('0x37')]=_[_0x5549('0x36')](_0x39a919['query']);_0x28c846[_0x5549('0x38')]=_['intersection'](_0x28c846[_0x5549('0x34')],_0x28c846['query']);_0x2f94ff[_0x5549('0x3a')]=_['intersection'](_0x28c846[_0x5549('0x34')],qs[_0x5549('0x3b')](_0x39a919[_0x5549('0x37')][_0x5549('0x3b')]));_0x2f94ff[_0x5549('0x3a')]=_0x2f94ff[_0x5549('0x3a')][_0x5549('0x3c')]?_0x2f94ff[_0x5549('0x3a')]:_0x28c846[_0x5549('0x34')];if(_0x39a919[_0x5549('0x37')][_0x5549('0x4d')]){_0x2f94ff['include']=[{'all':!![]}];}_0x2f94ff=_[_0x5549('0x44')]({},_0x2f94ff,_0x39a919[_0x5549('0x4e')]);return db[_0x5549('0x2f')][_0x5549('0x4f')](_0x2f94ff)['then'](handleEntityNotFound(_0xa9e431,null))[_0x5549('0x25')](respondWithResult(_0xa9e431,null))[_0x5549('0x4a')](handleError(_0xa9e431,null));};exports[_0x5549('0x50')]=function(_0x40fe8b,_0x21ba6b){return db[_0x5549('0x2f')]['create'](_0x40fe8b[_0x5549('0x51')],{})[_0x5549('0x25')](function(_0x3c3b70){var _0x2b2388=_0x40fe8b['user'][_0x5549('0x27')]({'plain':!![]});if(!_0x2b2388)throw new Error(_0x5549('0x52'));if(_0x2b2388[_0x5549('0x53')]===_0x5549('0x54')){var _0x567eb9=_0x3c3b70[_0x5549('0x27')]({'plain':!![]});var _0x438a1a=_0x5549('0x28');return db[_0x5549('0x55')][_0x5549('0x4f')]({'where':{'name':_0x438a1a,'userProfileId':_0x2b2388[_0x5549('0x56')]},'raw':!![]})[_0x5549('0x25')](function(_0x1f8299){if(_0x1f8299&&_0x1f8299[_0x5549('0x57')]===0x0){return db['UserProfileResource'][_0x5549('0x50')]({'name':_0x567eb9[_0x5549('0x2c')],'resourceId':_0x567eb9['id'],'type':_0x1f8299[_0x5549('0x2c')],'sectionId':_0x1f8299['id']},{})['then'](function(){return _0x3c3b70;});}else{return _0x3c3b70;}})[_0x5549('0x4a')](function(_0x53b09b){logger[_0x5549('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b09b);throw _0x53b09b;});}return _0x3c3b70;})[_0x5549('0x25')](respondWithResult(_0x21ba6b,0xc9))['catch'](handleError(_0x21ba6b,null));};exports['update']=function(_0x209c14,_0x5ace54){if(_0x209c14[_0x5549('0x51')]['id']){delete _0x209c14[_0x5549('0x51')]['id'];}return db[_0x5549('0x2f')][_0x5549('0x4f')]({'where':{'id':_0x209c14[_0x5549('0x4c')]['id']}})[_0x5549('0x25')](handleEntityNotFound(_0x5ace54,null))[_0x5549('0x25')](saveUpdates(_0x209c14[_0x5549('0x51')],null))[_0x5549('0x25')](respondWithResult(_0x5ace54,null))[_0x5549('0x4a')](handleError(_0x5ace54,null));};exports[_0x5549('0x26')]=function(_0x3052e3,_0x5686c7){return db[_0x5549('0x2f')][_0x5549('0x4f')]({'where':{'id':_0x3052e3['params']['id']}})[_0x5549('0x25')](handleEntityNotFound(_0x5686c7,null))[_0x5549('0x25')](removeEntity(_0x5686c7,null))[_0x5549('0x4a')](handleError(_0x5686c7,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6a50b8b..b861d44 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 _0x77cc=['exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x77cc,0xc6));var _0xc77c=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x77cc[_0x5d23be];return _0x4d60a9;};'use strict';var _=require(_0xc77c('0x0'));var util=require(_0xc77c('0x1'));var logger=require(_0xc77c('0x2'))(_0xc77c('0x3'));var moment=require(_0xc77c('0x4'));var BPromise=require(_0xc77c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc77c('0x6'));var rimraf=require(_0xc77c('0x7'));var config=require(_0xc77c('0x8'));var attributes=require(_0xc77c('0x9'));module[_0xc77c('0xa')]=function(_0x582671,_0x444281){return _0x582671[_0xc77c('0xb')]('AnalyticMetric',attributes,{'tableName':_0xc77c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe284=['request-promise','path','rimraf','exports','AnalyticMetric','analytics_metrics','util','moment','bluebird'];(function(_0x68ab8c,_0x19deca){var _0x676e3b=function(_0x444b53){while(--_0x444b53){_0x68ab8c['push'](_0x68ab8c['shift']());}};_0x676e3b(++_0x19deca);}(_0xe284,0x9f));var _0x4e28=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xe284[_0x56825b];return _0x69ce77;};'use strict';var _=require('lodash');var util=require(_0x4e28('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4e28('0x1'));var BPromise=require(_0x4e28('0x2'));var rp=require(_0x4e28('0x3'));var fs=require('fs');var path=require(_0x4e28('0x4'));var rimraf=require(_0x4e28('0x5'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x4e28('0x6')]=function(_0x1e1461,_0x1b524c){return _0x1e1461['define'](_0x4e28('0x7'),attributes,{'tableName':_0x4e28('0x8'),'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 c389f54..db9bda9 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 _0x252e=['message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1aee65,_0x56b92a){var _0x46385e=function(_0x152329){while(--_0x152329){_0x1aee65['push'](_0x1aee65['shift']());}};_0x46385e(++_0x56b92a);}(_0x252e,0x147));var _0xe252=function(_0x3f9397,_0x36d780){_0x3f9397=_0x3f9397-0x0;var _0x12fe91=_0x252e[_0x3f9397];return _0x12fe91;};'use strict';var _=require(_0xe252('0x0'));var util=require('util');var moment=require(_0xe252('0x1'));var BPromise=require('bluebird');var rs=require(_0xe252('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe252('0x3'))['db'];var utils=require(_0xe252('0x4'));var logger=require(_0xe252('0x5'))('rpc');var config=require(_0xe252('0x6'));var jayson=require(_0xe252('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aba5d,_0x13c527,_0x854086){return new BPromise(function(_0x58f795,_0x1bbe6f){return client['request'](_0x5aba5d,_0x854086)[_0xe252('0x8')](function(_0xb6389e){logger['info'](_0xe252('0x9'),_0x13c527,_0xe252('0xa'));logger['debug'](_0xe252('0xb'),_0x13c527,_0xe252('0xa'),JSON[_0xe252('0xc')](_0xb6389e));if(_0xb6389e[_0xe252('0xd')]){if(_0xb6389e['error'][_0xe252('0xe')]===0x1f4){logger[_0xe252('0xd')](_0xe252('0x9'),_0x13c527,_0xb6389e['error']['message']);return _0x1bbe6f(_0xb6389e[_0xe252('0xd')][_0xe252('0xf')]);}logger[_0xe252('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x13c527,_0xb6389e[_0xe252('0xd')][_0xe252('0xf')]);return _0x58f795(_0xb6389e['error']['message']);}else{logger[_0xe252('0x10')](_0xe252('0x9'),_0x13c527,_0xe252('0xa'));_0x58f795(_0xb6389e[_0xe252('0x11')][_0xe252('0xf')]);}})[_0xe252('0x12')](function(_0x26f9b9){logger[_0xe252('0xd')](_0xe252('0x9'),_0x13c527,_0x26f9b9);_0x1bbe6f(_0x26f9b9);});});} \ No newline at end of file +var _0x6615=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x224c32,_0x46b638){var _0x1b9df8=function(_0x27bd95){while(--_0x27bd95){_0x224c32['push'](_0x224c32['shift']());}};_0x1b9df8(++_0x46b638);}(_0x6615,0x171));var _0x5661=function(_0x33a21a,_0x22d1a8){_0x33a21a=_0x33a21a-0x0;var _0x4c628e=_0x6615[_0x33a21a];return _0x4c628e;};'use strict';var _=require(_0x5661('0x0'));var util=require(_0x5661('0x1'));var moment=require(_0x5661('0x2'));var BPromise=require(_0x5661('0x3'));var rs=require(_0x5661('0x4'));var fs=require('fs');var Redis=require(_0x5661('0x5'));var db=require(_0x5661('0x6'))['db'];var utils=require(_0x5661('0x7'));var logger=require(_0x5661('0x8'))(_0x5661('0x9'));var config=require(_0x5661('0xa'));var jayson=require(_0x5661('0xb'));var client=jayson['client'][_0x5661('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ec13e,_0x2e1bb9,_0x16bed6){return new BPromise(function(_0x44371b,_0x37162d){return client[_0x5661('0xd')](_0x4ec13e,_0x16bed6)['then'](function(_0xc0c229){logger[_0x5661('0xe')](_0x5661('0xf'),_0x2e1bb9,'request\x20sent');logger[_0x5661('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2e1bb9,_0x5661('0x11'),JSON['stringify'](_0xc0c229));if(_0xc0c229[_0x5661('0x12')]){if(_0xc0c229[_0x5661('0x12')][_0x5661('0x13')]===0x1f4){logger[_0x5661('0x12')](_0x5661('0xf'),_0x2e1bb9,_0xc0c229[_0x5661('0x12')]['message']);return _0x37162d(_0xc0c229['error'][_0x5661('0x14')]);}logger[_0x5661('0x12')](_0x5661('0xf'),_0x2e1bb9,_0xc0c229['error'][_0x5661('0x14')]);return _0x44371b(_0xc0c229[_0x5661('0x12')]['message']);}else{logger[_0x5661('0xe')](_0x5661('0xf'),_0x2e1bb9,_0x5661('0x11'));_0x44371b(_0xc0c229[_0x5661('0x15')]['message']);}})[_0x5661('0x16')](function(_0x2c63aa){logger['error'](_0x5661('0xf'),_0x2e1bb9,_0x2c63aa);_0x37162d(_0x2c63aa);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 39832d1..9033df5 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x292716,_0x96d32){var _0x34cb57=function(_0x1d0cde){while(--_0x1d0cde){_0x292716['push'](_0x292716['shift']());}};_0x34cb57(++_0x96d32);}(_0x2542,0x169));var _0x2254=function(_0x55caca,_0x18bc05){_0x55caca=_0x55caca-0x0;var _0x1b350a=_0x2542[_0x55caca];return _0x1b350a;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file +var _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x384c96,_0x363897){var _0x145217=function(_0xb3b50){while(--_0xb3b50){_0x384c96['push'](_0x384c96['shift']());}};_0x145217(++_0x363897);}(_0x524e,0x15e));var _0xe524=function(_0x29a687,_0x519dfa){_0x29a687=_0x29a687-0x0;var _0x3023f3=_0x524e[_0x29a687];return _0x3023f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 31a4a1c..846a3c0 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b1b=['exports','TEXT','sequelize'];(function(_0x59f202,_0x31579a){var _0x1444e3=function(_0x485e9d){while(--_0x485e9d){_0x59f202['push'](_0x59f202['shift']());}};_0x1444e3(++_0x31579a);}(_0x4b1b,0x140));var _0xb4b1=function(_0x7baa0a,_0x3df7fa){_0x7baa0a=_0x7baa0a-0x0;var _0xadd57=_0x4b1b[_0x7baa0a];return _0xadd57;};'use strict';var Sequelize=require(_0xb4b1('0x0'));module[_0xb4b1('0x1')]={'tree':{'type':Sequelize[_0xb4b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7c15=['TEXT','sequelize','exports'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x7c15,0x73));var _0x57c1=function(_0x307b13,_0x2fb107){_0x307b13=_0x307b13-0x0;var _0x446550=_0x7c15[_0x307b13];return _0x446550;};'use strict';var Sequelize=require(_0x57c1('0x0'));module[_0x57c1('0x1')]={'tree':{'type':Sequelize[_0x57c1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 2503b45..92d6ce0 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 _0x344e=['catch','show','params','intersection','fields','includeAll','include','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','stack','name','index','map','AnalyticTreeReport','rawAttributes','type','model','keys','query','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','rows'];(function(_0x72441c,_0x19349e){var _0x165566=function(_0x43808a){while(--_0x43808a){_0x72441c['push'](_0x72441c['shift']());}};_0x165566(++_0x19349e);}(_0x344e,0xe0));var _0xe344=function(_0x237d2c,_0x36a8fd){_0x237d2c=_0x237d2c-0x0;var _0x1f8236=_0x344e[_0x237d2c];return _0x1f8236;};'use strict';var pdf=require(_0xe344('0x0'));var emlformat=require(_0xe344('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe344('0x2'));var jsonpatch=require(_0xe344('0x3'));var rp=require(_0xe344('0x4'));var moment=require('moment');var BPromise=require(_0xe344('0x5'));var Mustache=require(_0xe344('0x6'));var util=require(_0xe344('0x7'));var path=require(_0xe344('0x8'));var sox=require(_0xe344('0x9'));var csv=require(_0xe344('0xa'));var ejs=require(_0xe344('0xb'));var fs=require('fs');var _=require(_0xe344('0xc'));var squel=require(_0xe344('0xd'));var crypto=require('crypto');var jsforce=require(_0xe344('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe344('0xa'));var querystring=require(_0xe344('0xf'));var Papa=require(_0xe344('0x10'));var Redis=require(_0xe344('0x11'));var authService=require(_0xe344('0x12'));var qs=require(_0xe344('0x13'));var as=require(_0xe344('0x14'));var hardwareService=require(_0xe344('0x15'));var logger=require(_0xe344('0x16'))('api');var utils=require(_0xe344('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe344('0x18'));var db=require(_0xe344('0x19'))['db'];function respondWithStatusCode(_0x2603f4,_0xea1409){_0xea1409=_0xea1409||0xcc;return function(_0x1f47f6){if(_0x1f47f6){return _0x2603f4[_0xe344('0x1a')](_0xea1409);}return _0x2603f4[_0xe344('0x1b')](_0xea1409)[_0xe344('0x1c')]();};}function respondWithResult(_0x2a0a39,_0x235e86){_0x235e86=_0x235e86||0xc8;return function(_0x2de568){if(_0x2de568){return _0x2a0a39['status'](_0x235e86)[_0xe344('0x1d')](_0x2de568);}};}function respondWithFilteredResult(_0x2ca29f,_0x2a0ffe){return function(_0x1f7915){if(_0x1f7915){var _0x54dd2d=_0x1f7915[_0xe344('0x1e')],_0x564a44=_0x2a0ffe[_0xe344('0x1f')],_0x3c2ad6=_0x2a0ffe['offset']+_0x2a0ffe[_0xe344('0x20')],_0x2f4d98;if(_0x3c2ad6>=_0x54dd2d){_0x3c2ad6=_0x54dd2d;_0x2f4d98=0xc8;}else{_0x2f4d98=0xce;}_0x2ca29f['status'](_0x2f4d98);return _0x2ca29f[_0xe344('0x21')]('Content-Range',_0x564a44+'-'+_0x3c2ad6+'/'+_0x54dd2d)[_0xe344('0x1d')](_0x1f7915);}return null;};}function patchUpdates(_0xbc9af4){return function(_0x2a7dd7){try{jsonpatch[_0xe344('0x22')](_0x2a7dd7,_0xbc9af4,!![]);}catch(_0x535d04){return BPromise[_0xe344('0x23')](_0x535d04);}return _0x2a7dd7['save']();};}function saveUpdates(_0x139186,_0x48ce90){return function(_0x2d4688){if(_0x2d4688){return _0x2d4688[_0xe344('0x24')](_0x139186)[_0xe344('0x25')](function(_0x1c870e){return _0x1c870e;});}return null;};}function removeEntity(_0x2c1d5b,_0x2f8a5c){return function(_0x5131fe){if(_0x5131fe){return _0x5131fe[_0xe344('0x26')]()[_0xe344('0x25')](function(){_0x2c1d5b['status'](0xcc)[_0xe344('0x1c')]();});}};}function handleEntityNotFound(_0x33fcb9,_0x3f7305){return function(_0x574537){if(!_0x574537){_0x33fcb9[_0xe344('0x1a')](0x194);}return _0x574537;};}function handleError(_0x1d515e,_0x512863){_0x512863=_0x512863||0x1f4;return function(_0x469134){logger['error'](_0x469134[_0xe344('0x27')]);if(_0x469134['name']){delete _0x469134[_0xe344('0x28')];}_0x1d515e[_0xe344('0x1b')](_0x512863)['send'](_0x469134);};}exports[_0xe344('0x29')]=function(_0x215c64,_0x21030b){var _0x3219ed={},_0x17fd91={},_0x43859f={'count':0x0,'rows':[]};var _0x36b70b=_[_0xe344('0x2a')](db[_0xe344('0x2b')][_0xe344('0x2c')],function(_0x3b81bc){return{'name':_0x3b81bc['fieldName'],'type':_0x3b81bc[_0xe344('0x2d')]['key']};});_0x17fd91[_0xe344('0x2e')]=_[_0xe344('0x2a')](_0x36b70b,_0xe344('0x28'));_0x17fd91['query']=_[_0xe344('0x2f')](_0x215c64[_0xe344('0x30')]);_0x17fd91['filters']=_['intersection'](_0x17fd91[_0xe344('0x2e')],_0x17fd91[_0xe344('0x30')]);_0x3219ed[_0xe344('0x31')]=_['intersection'](_0x17fd91[_0xe344('0x2e')],qs['fields'](_0x215c64['query']['fields']));_0x3219ed[_0xe344('0x31')]=_0x3219ed[_0xe344('0x31')]['length']?_0x3219ed[_0xe344('0x31')]:_0x17fd91[_0xe344('0x2e')];if(!_0x215c64[_0xe344('0x30')][_0xe344('0x32')](_0xe344('0x33'))){_0x3219ed[_0xe344('0x20')]=qs['limit'](_0x215c64[_0xe344('0x30')][_0xe344('0x20')]);_0x3219ed['offset']=qs['offset'](_0x215c64[_0xe344('0x30')][_0xe344('0x1f')]);}_0x3219ed['order']=qs['sort'](_0x215c64[_0xe344('0x30')][_0xe344('0x34')]);_0x3219ed[_0xe344('0x35')]=qs[_0xe344('0x36')](_[_0xe344('0x37')](_0x215c64[_0xe344('0x30')],_0x17fd91[_0xe344('0x36')]),_0x36b70b);if(_0x215c64[_0xe344('0x30')][_0xe344('0x38')]){_0x3219ed[_0xe344('0x35')]=_[_0xe344('0x39')](_0x3219ed[_0xe344('0x35')],{'$or':_[_0xe344('0x2a')](_0x36b70b,function(_0x175aec){if(_0x175aec[_0xe344('0x2d')]!==_0xe344('0x3a')){var _0x283345={};_0x283345[_0x175aec[_0xe344('0x28')]]={'$like':'%'+_0x215c64[_0xe344('0x30')]['filter']+'%'};return _0x283345;}})});}_0x3219ed=_[_0xe344('0x39')]({},_0x3219ed,_0x215c64['options']);var _0x267464={'where':_0x3219ed[_0xe344('0x35')]};return db[_0xe344('0x2b')][_0xe344('0x1e')](_0x267464)[_0xe344('0x25')](function(_0x463a02){_0x43859f['count']=_0x463a02;if(_0x215c64['query']['includeAll']){_0x3219ed['include']=[{'all':!![]}];}return db[_0xe344('0x2b')]['findAll'](_0x3219ed);})[_0xe344('0x25')](function(_0xdf9647){_0x43859f[_0xe344('0x3b')]=_0xdf9647;return _0x43859f;})[_0xe344('0x25')](respondWithFilteredResult(_0x21030b,_0x3219ed))[_0xe344('0x3c')](handleError(_0x21030b,null));};exports[_0xe344('0x3d')]=function(_0x1b5113,_0x175f66){var _0x3aa890={'raw':!![],'where':{'id':_0x1b5113[_0xe344('0x3e')]['id']}},_0x31f943={};_0x31f943[_0xe344('0x2e')]=_[_0xe344('0x2f')](db[_0xe344('0x2b')]['rawAttributes']);_0x31f943[_0xe344('0x30')]=_[_0xe344('0x2f')](_0x1b5113[_0xe344('0x30')]);_0x31f943[_0xe344('0x36')]=_[_0xe344('0x3f')](_0x31f943[_0xe344('0x2e')],_0x31f943['query']);_0x3aa890[_0xe344('0x31')]=_[_0xe344('0x3f')](_0x31f943[_0xe344('0x2e')],qs[_0xe344('0x40')](_0x1b5113[_0xe344('0x30')][_0xe344('0x40')]));_0x3aa890[_0xe344('0x31')]=_0x3aa890[_0xe344('0x31')]['length']?_0x3aa890[_0xe344('0x31')]:_0x31f943['model'];if(_0x1b5113['query'][_0xe344('0x41')]){_0x3aa890[_0xe344('0x42')]=[{'all':!![]}];}_0x3aa890=_[_0xe344('0x39')]({},_0x3aa890,_0x1b5113[_0xe344('0x43')]);return db[_0xe344('0x2b')][_0xe344('0x44')](_0x3aa890)['then'](handleEntityNotFound(_0x175f66,null))[_0xe344('0x25')](respondWithResult(_0x175f66,null))[_0xe344('0x3c')](handleError(_0x175f66,null));};exports[_0xe344('0x45')]=function(_0x42f5dd,_0x27aca8){return db[_0xe344('0x2b')][_0xe344('0x45')](_0x42f5dd['body'],{})[_0xe344('0x25')](respondWithResult(_0x27aca8,0xc9))[_0xe344('0x3c')](handleError(_0x27aca8,null));};exports['update']=function(_0x566381,_0x456bdc){if(_0x566381['body']['id']){delete _0x566381[_0xe344('0x46')]['id'];}return db[_0xe344('0x2b')][_0xe344('0x44')]({'where':{'id':_0x566381[_0xe344('0x3e')]['id']}})[_0xe344('0x25')](handleEntityNotFound(_0x456bdc,null))[_0xe344('0x25')](saveUpdates(_0x566381[_0xe344('0x46')],null))['then'](respondWithResult(_0x456bdc,null))[_0xe344('0x3c')](handleError(_0x456bdc,null));};exports[_0xe344('0x26')]=function(_0x47d085,_0x1ea8af){return db[_0xe344('0x2b')][_0xe344('0x44')]({'where':{'id':_0x47d085[_0xe344('0x3e')]['id']}})[_0xe344('0x25')](handleEntityNotFound(_0x1ea8af,null))[_0xe344('0x25')](removeEntity(_0x1ea8af,null))[_0xe344('0x3c')](handleError(_0x1ea8af,null));}; \ No newline at end of file +var _0x62f9=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','save','update','destroy','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','key','model','map','query','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','attributes','create','body','find','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x34928b,_0x87c885){var _0x6e042c=function(_0x45eab9){while(--_0x45eab9){_0x34928b['push'](_0x34928b['shift']());}};_0x6e042c(++_0x87c885);}(_0x62f9,0x1e0));var _0x962f=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x62f9[_0x4a7843];return _0x2c57fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x962f('0x0'));var rimraf=require(_0x962f('0x1'));var zipdir=require(_0x962f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x962f('0x3'));var util=require(_0x962f('0x4'));var path=require('path');var sox=require(_0x962f('0x5'));var csv=require(_0x962f('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x962f('0x7'));var squel=require(_0x962f('0x8'));var crypto=require(_0x962f('0x9'));var jsforce=require(_0x962f('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x962f('0xb'));var Papa=require(_0x962f('0xc'));var Redis=require(_0x962f('0xd'));var authService=require(_0x962f('0xe'));var qs=require(_0x962f('0xf'));var as=require(_0x962f('0x10'));var hardwareService=require(_0x962f('0x11'));var logger=require(_0x962f('0x12'))(_0x962f('0x13'));var utils=require('../../config/utils');var config=require(_0x962f('0x14'));var licenseUtil=require(_0x962f('0x15'));var db=require(_0x962f('0x16'))['db'];function respondWithStatusCode(_0x2d0dbd,_0x53fb27){_0x53fb27=_0x53fb27||0xcc;return function(_0x308106){if(_0x308106){return _0x2d0dbd[_0x962f('0x17')](_0x53fb27);}return _0x2d0dbd[_0x962f('0x18')](_0x53fb27)[_0x962f('0x19')]();};}function respondWithResult(_0x35a349,_0x11f77a){_0x11f77a=_0x11f77a||0xc8;return function(_0x3ef1fc){if(_0x3ef1fc){return _0x35a349[_0x962f('0x18')](_0x11f77a)[_0x962f('0x1a')](_0x3ef1fc);}};}function respondWithFilteredResult(_0x3db196,_0x611c5){return function(_0x34c31d){if(_0x34c31d){var _0x4d1bcd=_0x34c31d[_0x962f('0x1b')],_0x373df5=_0x611c5[_0x962f('0x1c')],_0x287ccb=_0x611c5[_0x962f('0x1c')]+_0x611c5['limit'],_0x24eca4;if(_0x287ccb>=_0x4d1bcd){_0x287ccb=_0x4d1bcd;_0x24eca4=0xc8;}else{_0x24eca4=0xce;}_0x3db196[_0x962f('0x18')](_0x24eca4);return _0x3db196['set']('Content-Range',_0x373df5+'-'+_0x287ccb+'/'+_0x4d1bcd)[_0x962f('0x1a')](_0x34c31d);}return null;};}function patchUpdates(_0x2017c0){return function(_0x24ae40){try{jsonpatch['apply'](_0x24ae40,_0x2017c0,!![]);}catch(_0x5a3297){return BPromise['reject'](_0x5a3297);}return _0x24ae40[_0x962f('0x1d')]();};}function saveUpdates(_0x496072,_0x232e8a){return function(_0x3e15ff){if(_0x3e15ff){return _0x3e15ff[_0x962f('0x1e')](_0x496072)['then'](function(_0x3ff85a){return _0x3ff85a;});}return null;};}function removeEntity(_0x2b6b38,_0x464038){return function(_0x385577){if(_0x385577){return _0x385577[_0x962f('0x1f')]()[_0x962f('0x20')](function(){_0x2b6b38['status'](0xcc)[_0x962f('0x19')]();});}};}function handleEntityNotFound(_0x19d210,_0x141b12){return function(_0x328e93){if(!_0x328e93){_0x19d210[_0x962f('0x17')](0x194);}return _0x328e93;};}function handleError(_0x2f5f50,_0x1febff){_0x1febff=_0x1febff||0x1f4;return function(_0x94da71){logger[_0x962f('0x21')](_0x94da71[_0x962f('0x22')]);if(_0x94da71[_0x962f('0x23')]){delete _0x94da71['name'];}_0x2f5f50[_0x962f('0x18')](_0x1febff)[_0x962f('0x24')](_0x94da71);};}exports[_0x962f('0x25')]=function(_0x4b53cd,_0x61b2b1){var _0x3d8441={},_0x4958cf={},_0x1ac00a={'count':0x0,'rows':[]};var _0x3674b9=_['map'](db[_0x962f('0x26')][_0x962f('0x27')],function(_0x1c56a7){return{'name':_0x1c56a7['fieldName'],'type':_0x1c56a7['type'][_0x962f('0x28')]};});_0x4958cf[_0x962f('0x29')]=_[_0x962f('0x2a')](_0x3674b9,_0x962f('0x23'));_0x4958cf['query']=_['keys'](_0x4b53cd[_0x962f('0x2b')]);_0x4958cf['filters']=_['intersection'](_0x4958cf[_0x962f('0x29')],_0x4958cf[_0x962f('0x2b')]);_0x3d8441['attributes']=_[_0x962f('0x2c')](_0x4958cf[_0x962f('0x29')],qs[_0x962f('0x2d')](_0x4b53cd['query']['fields']));_0x3d8441['attributes']=_0x3d8441['attributes'][_0x962f('0x2e')]?_0x3d8441['attributes']:_0x4958cf[_0x962f('0x29')];if(!_0x4b53cd[_0x962f('0x2b')][_0x962f('0x2f')](_0x962f('0x30'))){_0x3d8441[_0x962f('0x31')]=qs[_0x962f('0x31')](_0x4b53cd[_0x962f('0x2b')]['limit']);_0x3d8441[_0x962f('0x1c')]=qs['offset'](_0x4b53cd[_0x962f('0x2b')][_0x962f('0x1c')]);}_0x3d8441[_0x962f('0x32')]=qs[_0x962f('0x33')](_0x4b53cd[_0x962f('0x2b')][_0x962f('0x33')]);_0x3d8441[_0x962f('0x34')]=qs[_0x962f('0x35')](_[_0x962f('0x36')](_0x4b53cd['query'],_0x4958cf[_0x962f('0x35')]),_0x3674b9);if(_0x4b53cd[_0x962f('0x2b')][_0x962f('0x37')]){_0x3d8441[_0x962f('0x34')]=_[_0x962f('0x38')](_0x3d8441[_0x962f('0x34')],{'$or':_['map'](_0x3674b9,function(_0x4a3eda){if(_0x4a3eda[_0x962f('0x39')]!==_0x962f('0x3a')){var _0x89f874={};_0x89f874[_0x4a3eda['name']]={'$like':'%'+_0x4b53cd[_0x962f('0x2b')]['filter']+'%'};return _0x89f874;}})});}_0x3d8441=_[_0x962f('0x38')]({},_0x3d8441,_0x4b53cd[_0x962f('0x3b')]);var _0x1784b={'where':_0x3d8441[_0x962f('0x34')]};return db[_0x962f('0x26')][_0x962f('0x1b')](_0x1784b)[_0x962f('0x20')](function(_0x332356){_0x1ac00a[_0x962f('0x1b')]=_0x332356;if(_0x4b53cd[_0x962f('0x2b')][_0x962f('0x3c')]){_0x3d8441[_0x962f('0x3d')]=[{'all':!![]}];}return db[_0x962f('0x26')]['findAll'](_0x3d8441);})['then'](function(_0x6eac7c){_0x1ac00a[_0x962f('0x3e')]=_0x6eac7c;return _0x1ac00a;})[_0x962f('0x20')](respondWithFilteredResult(_0x61b2b1,_0x3d8441))[_0x962f('0x3f')](handleError(_0x61b2b1,null));};exports[_0x962f('0x40')]=function(_0x205948,_0x5b08f1){var _0x54ffc9={'raw':!![],'where':{'id':_0x205948[_0x962f('0x41')]['id']}},_0x28ca8d={};_0x28ca8d[_0x962f('0x29')]=_[_0x962f('0x42')](db['AnalyticTreeReport'][_0x962f('0x27')]);_0x28ca8d[_0x962f('0x2b')]=_['keys'](_0x205948[_0x962f('0x2b')]);_0x28ca8d[_0x962f('0x35')]=_[_0x962f('0x2c')](_0x28ca8d[_0x962f('0x29')],_0x28ca8d[_0x962f('0x2b')]);_0x54ffc9['attributes']=_['intersection'](_0x28ca8d['model'],qs[_0x962f('0x2d')](_0x205948['query']['fields']));_0x54ffc9[_0x962f('0x43')]=_0x54ffc9[_0x962f('0x43')][_0x962f('0x2e')]?_0x54ffc9['attributes']:_0x28ca8d[_0x962f('0x29')];if(_0x205948['query'][_0x962f('0x3c')]){_0x54ffc9[_0x962f('0x3d')]=[{'all':!![]}];}_0x54ffc9=_[_0x962f('0x38')]({},_0x54ffc9,_0x205948[_0x962f('0x3b')]);return db[_0x962f('0x26')]['find'](_0x54ffc9)[_0x962f('0x20')](handleEntityNotFound(_0x5b08f1,null))[_0x962f('0x20')](respondWithResult(_0x5b08f1,null))[_0x962f('0x3f')](handleError(_0x5b08f1,null));};exports[_0x962f('0x44')]=function(_0x919826,_0x5e2eb5){return db[_0x962f('0x26')][_0x962f('0x44')](_0x919826[_0x962f('0x45')],{})[_0x962f('0x20')](respondWithResult(_0x5e2eb5,0xc9))['catch'](handleError(_0x5e2eb5,null));};exports[_0x962f('0x1e')]=function(_0xa6432d,_0x1bd5f9){if(_0xa6432d[_0x962f('0x45')]['id']){delete _0xa6432d[_0x962f('0x45')]['id'];}return db['AnalyticTreeReport'][_0x962f('0x46')]({'where':{'id':_0xa6432d[_0x962f('0x41')]['id']}})['then'](handleEntityNotFound(_0x1bd5f9,null))['then'](saveUpdates(_0xa6432d[_0x962f('0x45')],null))['then'](respondWithResult(_0x1bd5f9,null))['catch'](handleError(_0x1bd5f9,null));};exports[_0x962f('0x1f')]=function(_0x378c82,_0x4209aa){return db['AnalyticTreeReport']['find']({'where':{'id':_0x378c82[_0x962f('0x41')]['id']}})[_0x962f('0x20')](handleEntityNotFound(_0x4209aa,null))[_0x962f('0x20')](removeEntity(_0x4209aa,null))[_0x962f('0x3f')](handleError(_0x4209aa,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 45ab98e..9e158a1 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 _0xe2bc=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x39eaa0,_0x2cea62){var _0x2402c5=function(_0x3c308a){while(--_0x3c308a){_0x39eaa0['push'](_0x39eaa0['shift']());}};_0x2402c5(++_0x2cea62);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xe2bc[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var logger=require(_0xce2b('0x1'))('api');var moment=require(_0xce2b('0x2'));var BPromise=require(_0xce2b('0x3'));var rp=require(_0xce2b('0x4'));var fs=require('fs');var path=require(_0xce2b('0x5'));var rimraf=require(_0xce2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xce2b('0x7'));module[_0xce2b('0x8')]=function(_0x3c15d3,_0x343373){return _0x3c15d3[_0xce2b('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xce2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d4e=['../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5d4e,0x138));var _0xe5d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5d4e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe5d4('0x0'));var logger=require(_0xe5d4('0x1'))(_0xe5d4('0x2'));var moment=require(_0xe5d4('0x3'));var BPromise=require(_0xe5d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5d4('0x5'));var rimraf=require(_0xe5d4('0x6'));var config=require(_0xe5d4('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xe5d4('0x8')]=function(_0x518138,_0x59cfd9){return _0x518138['define'](_0xe5d4('0x9'),attributes,{'tableName':_0xe5d4('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 0ec03ac..af97791 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 _0xbdb5=['http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f865b,_0x5e47ce){var _0x523c0e=function(_0x160617){while(--_0x160617){_0x3f865b['push'](_0x3f865b['shift']());}};_0x523c0e(++_0x5e47ce);}(_0xbdb5,0xb5));var _0x5bdb=function(_0x1f6b82,_0x53ffb6){_0x1f6b82=_0x1f6b82-0x0;var _0x359645=_0xbdb5[_0x1f6b82];return _0x359645;};'use strict';var _=require(_0x5bdb('0x0'));var util=require(_0x5bdb('0x1'));var moment=require(_0x5bdb('0x2'));var BPromise=require(_0x5bdb('0x3'));var rs=require(_0x5bdb('0x4'));var fs=require('fs');var Redis=require(_0x5bdb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bdb('0x6'));var logger=require('../../config/logger')(_0x5bdb('0x7'));var config=require(_0x5bdb('0x8'));var jayson=require(_0x5bdb('0x9'));var client=jayson[_0x5bdb('0xa')][_0x5bdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c60de,_0x56813e,_0x58adfa){return new BPromise(function(_0x400f0e,_0x53aa93){return client[_0x5bdb('0xc')](_0x3c60de,_0x58adfa)[_0x5bdb('0xd')](function(_0x1b23ee){logger['info'](_0x5bdb('0xe'),_0x56813e,_0x5bdb('0xf'));logger['debug'](_0x5bdb('0x10'),_0x56813e,'request\x20sent',JSON[_0x5bdb('0x11')](_0x1b23ee));if(_0x1b23ee[_0x5bdb('0x12')]){if(_0x1b23ee[_0x5bdb('0x12')][_0x5bdb('0x13')]===0x1f4){logger['error'](_0x5bdb('0xe'),_0x56813e,_0x1b23ee[_0x5bdb('0x12')][_0x5bdb('0x14')]);return _0x53aa93(_0x1b23ee[_0x5bdb('0x12')]['message']);}logger['error'](_0x5bdb('0xe'),_0x56813e,_0x1b23ee['error'][_0x5bdb('0x14')]);return _0x400f0e(_0x1b23ee[_0x5bdb('0x12')][_0x5bdb('0x14')]);}else{logger[_0x5bdb('0x15')]('AnalyticTreeReport,\x20%s,\x20%s',_0x56813e,_0x5bdb('0xf'));_0x400f0e(_0x1b23ee[_0x5bdb('0x16')][_0x5bdb('0x14')]);}})[_0x5bdb('0x17')](function(_0x432093){logger[_0x5bdb('0x12')](_0x5bdb('0xe'),_0x56813e,_0x432093);_0x53aa93(_0x432093);});});} \ No newline at end of file +var _0x28cc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1c76cc,_0x52eaff){var _0x24412d=function(_0x29ae8e){while(--_0x29ae8e){_0x1c76cc['push'](_0x1c76cc['shift']());}};_0x24412d(++_0x52eaff);}(_0x28cc,0x1d4));var _0xc28c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x28cc[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc28c('0x0'));var BPromise=require(_0xc28c('0x1'));var rs=require(_0xc28c('0x2'));var fs=require('fs');var Redis=require(_0xc28c('0x3'));var db=require(_0xc28c('0x4'))['db'];var utils=require(_0xc28c('0x5'));var logger=require(_0xc28c('0x6'))(_0xc28c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b345f,_0x1520dd,_0x5c1837){return new BPromise(function(_0x3405d1,_0x29d9ef){return client['request'](_0x5b345f,_0x5c1837)[_0xc28c('0x8')](function(_0x1853d9){logger[_0xc28c('0x9')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1520dd,_0xc28c('0xa'));logger['debug'](_0xc28c('0xb'),_0x1520dd,'request\x20sent',JSON['stringify'](_0x1853d9));if(_0x1853d9[_0xc28c('0xc')]){if(_0x1853d9[_0xc28c('0xc')][_0xc28c('0xd')]===0x1f4){logger[_0xc28c('0xc')](_0xc28c('0xe'),_0x1520dd,_0x1853d9[_0xc28c('0xc')][_0xc28c('0xf')]);return _0x29d9ef(_0x1853d9[_0xc28c('0xc')][_0xc28c('0xf')]);}logger[_0xc28c('0xc')](_0xc28c('0xe'),_0x1520dd,_0x1853d9['error'][_0xc28c('0xf')]);return _0x3405d1(_0x1853d9[_0xc28c('0xc')][_0xc28c('0xf')]);}else{logger['info'](_0xc28c('0xe'),_0x1520dd,_0xc28c('0xa'));_0x3405d1(_0x1853d9[_0xc28c('0x10')]['message']);}})[_0xc28c('0x11')](function(_0x44d371){logger[_0xc28c('0xc')](_0xc28c('0xe'),_0x1520dd,_0x44d371);_0x29d9ef(_0x44d371);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index cfc9d0c..cd8763c 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 _0x88aa=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','update','delete'];(function(_0x44a4ac,_0x1a7050){var _0x5f5350=function(_0x159d9c){while(--_0x159d9c){_0x44a4ac['push'](_0x44a4ac['shift']());}};_0x5f5350(++_0x1a7050);}(_0x88aa,0xb6));var _0xa88a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x88aa[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xa88a('0x0'));var util=require(_0xa88a('0x1'));var path=require(_0xa88a('0x2'));var timeout=require(_0xa88a('0x3'));var express=require(_0xa88a('0x4'));var router=express['Router']();var auth=require(_0xa88a('0x5'));var interaction=require(_0xa88a('0x6'));var config=require(_0xa88a('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xa88a('0x8')]('/',auth[_0xa88a('0x9')](),controller['index']);router['get']('/:id',auth[_0xa88a('0x9')](),controller['show']);router['post']('/',auth[_0xa88a('0x9')](),controller['create']);router[_0xa88a('0xa')]('/:id',auth[_0xa88a('0x9')](),controller[_0xa88a('0xb')]);router[_0xa88a('0xc')]('/:id',auth[_0xa88a('0x9')](),controller[_0xa88a('0xd')]);module[_0xa88a('0xe')]=router; \ No newline at end of file +var _0x9057=['create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x9057,0x137));var _0x7905=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9057[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x7905('0x0'));var path=require(_0x7905('0x1'));var timeout=require(_0x7905('0x2'));var express=require(_0x7905('0x3'));var router=express[_0x7905('0x4')]();var auth=require(_0x7905('0x5'));var interaction=require(_0x7905('0x6'));var config=require(_0x7905('0x7'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x7905('0x8')](),controller['index']);router[_0x7905('0x9')](_0x7905('0xa'),auth[_0x7905('0x8')](),controller[_0x7905('0xb')]);router['post']('/',auth[_0x7905('0x8')](),controller[_0x7905('0xc')]);router[_0x7905('0xd')]('/:id',auth[_0x7905('0x8')](),controller[_0x7905('0xe')]);router[_0x7905('0xf')](_0x7905('0xa'),auth['isAuthenticated'](),controller[_0x7905('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 285e25b..43691f3 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 _0x80f7=['exports','STRING','sequelize'];(function(_0x1a2ac5,_0x431ac7){var _0x2cedd0=function(_0x169aac){while(--_0x169aac){_0x1a2ac5['push'](_0x1a2ac5['shift']());}};_0x2cedd0(++_0x431ac7);}(_0x80f7,0x167));var _0x780f=function(_0x33c98e,_0x4eb3d0){_0x33c98e=_0x33c98e-0x0;var _0x39a756=_0x80f7[_0x33c98e];return _0x39a756;};'use strict';var Sequelize=require(_0x780f('0x0'));module[_0x780f('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x780f('0x2')]},'type':{'type':Sequelize[_0x780f('0x2')]}}; \ No newline at end of file +var _0x12f0=['STRING','sequelize','exports'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x12f0,0x1c0));var _0x012f=function(_0x52a8b3,_0x1cf84c){_0x52a8b3=_0x52a8b3-0x0;var _0x473f6a=_0x12f0[_0x52a8b3];return _0x473f6a;};'use strict';var Sequelize=require(_0x012f('0x0'));module[_0x012f('0x1')]={'name':{'type':Sequelize[_0x012f('0x2')]},'basename':{'type':Sequelize[_0x012f('0x2')]},'type':{'type':Sequelize[_0x012f('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index cd85fe0..8846210 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 _0x1859=['fieldName','type','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','length','include','clone','find','get','omit','createdAt','updatedAt','body','create','update','file','originalname','basename','download','findOne','join','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','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','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','Attachment'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0x1859,0x83));var _0x9185=function(_0x4464df,_0x540fdb){_0x4464df=_0x4464df-0x0;var _0x4426e3=_0x1859[_0x4464df];return _0x4426e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9185('0x0'));var rimraf=require(_0x9185('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9185('0x2'));var rp=require(_0x9185('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9185('0x4'));var util=require(_0x9185('0x5'));var path=require(_0x9185('0x6'));var sox=require('sox');var csv=require(_0x9185('0x7'));var ejs=require(_0x9185('0x8'));var fs=require('fs');var _=require(_0x9185('0x9'));var squel=require(_0x9185('0xa'));var crypto=require(_0x9185('0xb'));var jsforce=require(_0x9185('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9185('0xd'));var Papa=require(_0x9185('0xe'));var Redis=require(_0x9185('0xf'));var authService=require(_0x9185('0x10'));var qs=require(_0x9185('0x11'));var as=require(_0x9185('0x12'));var hardwareService=require(_0x9185('0x13'));var logger=require(_0x9185('0x14'))(_0x9185('0x15'));var utils=require(_0x9185('0x16'));var config=require(_0x9185('0x17'));var licenseUtil=require(_0x9185('0x18'));var db=require(_0x9185('0x19'))['db'];function respondWithStatusCode(_0x18781b,_0x3b6601){_0x3b6601=_0x3b6601||0xcc;return function(_0x6b8179){if(_0x6b8179){return _0x18781b[_0x9185('0x1a')](_0x3b6601);}return _0x18781b[_0x9185('0x1b')](_0x3b6601)[_0x9185('0x1c')]();};}function respondWithResult(_0x10dd04,_0x264f40){_0x264f40=_0x264f40||0xc8;return function(_0x1f5f76){if(_0x1f5f76){return _0x10dd04[_0x9185('0x1b')](_0x264f40)[_0x9185('0x1d')](_0x1f5f76);}};}function respondWithFilteredResult(_0x21b28a,_0x384761){return function(_0x4fe132){if(_0x4fe132){var _0x142845=_0x4fe132[_0x9185('0x1e')],_0x54a0ec=_0x384761[_0x9185('0x1f')],_0xd0f2b5=_0x384761[_0x9185('0x1f')]+_0x384761[_0x9185('0x20')],_0x62e294;if(_0xd0f2b5>=_0x142845){_0xd0f2b5=_0x142845;_0x62e294=0xc8;}else{_0x62e294=0xce;}_0x21b28a['status'](_0x62e294);return _0x21b28a['set'](_0x9185('0x21'),_0x54a0ec+'-'+_0xd0f2b5+'/'+_0x142845)[_0x9185('0x1d')](_0x4fe132);}return null;};}function patchUpdates(_0x4563e7){return function(_0x398f43){try{jsonpatch[_0x9185('0x22')](_0x398f43,_0x4563e7,!![]);}catch(_0x170310){return BPromise[_0x9185('0x23')](_0x170310);}return _0x398f43[_0x9185('0x24')]();};}function saveUpdates(_0x453353,_0xb35b27){return function(_0x8b6610){if(_0x8b6610){return _0x8b6610['update'](_0x453353)['then'](function(_0x32b1c4){return _0x32b1c4;});}return null;};}function removeEntity(_0x21d175,_0x264402){return function(_0x3b0a59){if(_0x3b0a59){return _0x3b0a59[_0x9185('0x25')]()[_0x9185('0x26')](function(){_0x21d175[_0x9185('0x1b')](0xcc)[_0x9185('0x1c')]();});}};}function handleEntityNotFound(_0xd9517a,_0x4b1b1e){return function(_0x2b0915){if(!_0x2b0915){_0xd9517a[_0x9185('0x1a')](0x194);}return _0x2b0915;};}function handleError(_0x587c33,_0x89b665){_0x89b665=_0x89b665||0x1f4;return function(_0x8aaa08){logger['error'](_0x8aaa08[_0x9185('0x27')]);if(_0x8aaa08[_0x9185('0x28')]){delete _0x8aaa08['name'];}_0x587c33[_0x9185('0x1b')](_0x89b665)[_0x9185('0x29')](_0x8aaa08);};}exports[_0x9185('0x2a')]=function(_0x537817,_0x24ee02){var _0x4b8396={},_0x5b9d6e={},_0x530f71={'count':0x0,'rows':[]};var _0x542a34=_[_0x9185('0x2b')](db[_0x9185('0x2c')]['rawAttributes'],function(_0x23fc32){return{'name':_0x23fc32[_0x9185('0x2d')],'type':_0x23fc32[_0x9185('0x2e')]['key']};});_0x5b9d6e[_0x9185('0x2f')]=_[_0x9185('0x2b')](_0x542a34,_0x9185('0x28'));_0x5b9d6e['query']=_[_0x9185('0x30')](_0x537817['query']);_0x5b9d6e['filters']=_[_0x9185('0x31')](_0x5b9d6e[_0x9185('0x2f')],_0x5b9d6e[_0x9185('0x32')]);_0x4b8396[_0x9185('0x33')]=_[_0x9185('0x31')](_0x5b9d6e[_0x9185('0x2f')],qs[_0x9185('0x34')](_0x537817['query']['fields']));_0x4b8396[_0x9185('0x33')]=_0x4b8396[_0x9185('0x33')]['length']?_0x4b8396[_0x9185('0x33')]:_0x5b9d6e['model'];if(!_0x537817[_0x9185('0x32')][_0x9185('0x35')](_0x9185('0x36'))){_0x4b8396[_0x9185('0x20')]=qs[_0x9185('0x20')](_0x537817['query'][_0x9185('0x20')]);_0x4b8396[_0x9185('0x1f')]=qs[_0x9185('0x1f')](_0x537817[_0x9185('0x32')][_0x9185('0x1f')]);}_0x4b8396[_0x9185('0x37')]=qs[_0x9185('0x38')](_0x537817['query'][_0x9185('0x38')]);_0x4b8396['where']=qs[_0x9185('0x39')](_[_0x9185('0x3a')](_0x537817[_0x9185('0x32')],_0x5b9d6e['filters']),_0x542a34);if(_0x537817['query'][_0x9185('0x3b')]){_0x4b8396[_0x9185('0x3c')]=_[_0x9185('0x3d')](_0x4b8396[_0x9185('0x3c')],{'$or':_[_0x9185('0x2b')](_0x542a34,function(_0x8e6514){if(_0x8e6514[_0x9185('0x2e')]!==_0x9185('0x3e')){var _0x52a73a={};_0x52a73a[_0x8e6514[_0x9185('0x28')]]={'$like':'%'+_0x537817['query'][_0x9185('0x3b')]+'%'};return _0x52a73a;}})});}_0x4b8396=_[_0x9185('0x3d')]({},_0x4b8396,_0x537817[_0x9185('0x3f')]);var _0x5f4c0f={'where':_0x4b8396[_0x9185('0x3c')]};return db[_0x9185('0x2c')][_0x9185('0x1e')](_0x5f4c0f)[_0x9185('0x26')](function(_0x4724bb){_0x530f71[_0x9185('0x1e')]=_0x4724bb;if(_0x537817[_0x9185('0x32')][_0x9185('0x40')]){_0x4b8396['include']=[{'all':!![]}];}return db['Attachment'][_0x9185('0x41')](_0x4b8396);})[_0x9185('0x26')](function(_0x3f565e){_0x530f71[_0x9185('0x42')]=_0x3f565e;return _0x530f71;})[_0x9185('0x26')](respondWithFilteredResult(_0x24ee02,_0x4b8396))[_0x9185('0x43')](handleError(_0x24ee02,null));};exports['show']=function(_0x1d04eb,_0x4b8487){var _0x132c9e={'raw':!![],'where':{'id':_0x1d04eb[_0x9185('0x44')]['id']}},_0x1c5138={};_0x1c5138[_0x9185('0x2f')]=_[_0x9185('0x30')](db['Attachment'][_0x9185('0x45')]);_0x1c5138[_0x9185('0x32')]=_[_0x9185('0x30')](_0x1d04eb[_0x9185('0x32')]);_0x1c5138[_0x9185('0x39')]=_[_0x9185('0x31')](_0x1c5138['model'],_0x1c5138['query']);_0x132c9e['attributes']=_[_0x9185('0x31')](_0x1c5138[_0x9185('0x2f')],qs['fields'](_0x1d04eb[_0x9185('0x32')]['fields']));_0x132c9e[_0x9185('0x33')]=_0x132c9e['attributes'][_0x9185('0x46')]?_0x132c9e[_0x9185('0x33')]:_0x1c5138[_0x9185('0x2f')];if(_0x1d04eb['query'][_0x9185('0x40')]){_0x132c9e[_0x9185('0x47')]=[{'all':!![]}];}_0x132c9e=_[_0x9185('0x3d')]({},_0x132c9e,_0x1d04eb['options']);return db[_0x9185('0x2c')]['find'](_0x132c9e)[_0x9185('0x26')](handleEntityNotFound(_0x4b8487,null))[_0x9185('0x26')](respondWithResult(_0x4b8487,null))['catch'](handleError(_0x4b8487,null));};exports[_0x9185('0x48')]=function(_0x2495da,_0x4df251){var _0x3a0ef2={'where':{'id':_0x2495da[_0x9185('0x44')]['id']}},_0x294c96={};_0x294c96[_0x9185('0x2f')]=_[_0x9185('0x30')](db['Attachment']['rawAttributes']);_0x3a0ef2[_0x9185('0x33')]=_[_0x9185('0x31')](_0x294c96[_0x9185('0x2f')],qs[_0x9185('0x34')](_0x2495da[_0x9185('0x32')]['fields']));_0x3a0ef2[_0x9185('0x33')]=_0x3a0ef2[_0x9185('0x33')]['length']?_0x3a0ef2[_0x9185('0x33')]:_0x294c96[_0x9185('0x2f')];if(_0x2495da[_0x9185('0x32')][_0x9185('0x40')]){_0x3a0ef2[_0x9185('0x47')]=[{'all':!![]}];}_0x3a0ef2=_[_0x9185('0x3d')]({},_0x3a0ef2,_0x2495da[_0x9185('0x3f')]);return db['Attachment'][_0x9185('0x49')](_0x3a0ef2)['then'](handleEntityNotFound(_0x4df251,null))[_0x9185('0x26')](function(_0x82a85b){if(_0x82a85b){var _0x35c352=_0x82a85b[_0x9185('0x4a')]({'plain':!![]});_0x35c352=qs[_0x9185('0x4b')](_0x35c352,['id',_0x9185('0x4c'),_0x9185('0x4d')]);_0x2495da[_0x9185('0x4e')]=_[_0x9185('0x4b')](_0x2495da[_0x9185('0x4e')],['id',_0x9185('0x4c'),_0x9185('0x4d')]);return db[_0x9185('0x2c')][_0x9185('0x4f')](_[_0x9185('0x3d')](_0x35c352,_0x2495da['body']),{'include':_0x2495da['query'][_0x9185('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4df251,0xc9))[_0x9185('0x43')](handleError(_0x4df251,null));};exports[_0x9185('0x50')]=function(_0x107e15,_0x1880f8){if(_0x107e15[_0x9185('0x4e')]['id']){delete _0x107e15[_0x9185('0x4e')]['id'];}return db[_0x9185('0x2c')][_0x9185('0x49')]({'where':{'id':_0x107e15[_0x9185('0x44')]['id']}})[_0x9185('0x26')](handleEntityNotFound(_0x1880f8,null))[_0x9185('0x26')](saveUpdates(_0x107e15['body'],null))[_0x9185('0x26')](respondWithResult(_0x1880f8,null))[_0x9185('0x43')](handleError(_0x1880f8,null));};exports['destroy']=function(_0x3ff572,_0x51bf35){return db[_0x9185('0x2c')][_0x9185('0x49')]({'where':{'id':_0x3ff572[_0x9185('0x44')]['id']}})[_0x9185('0x26')](handleEntityNotFound(_0x51bf35,null))[_0x9185('0x26')](removeEntity(_0x51bf35,null))[_0x9185('0x43')](handleError(_0x51bf35,null));};exports['create']=function(_0x28a46e,_0x3f6fef,_0x4d6323){_0x28a46e[_0x9185('0x4e')][_0x9185('0x28')]=_0x28a46e[_0x9185('0x51')][_0x9185('0x52')];_0x28a46e[_0x9185('0x4e')][_0x9185('0x53')]=_0x28a46e[_0x9185('0x51')]['filename'];_0x28a46e['body'][_0x9185('0x2e')]=_0x28a46e['file']['mimetype'];return db[_0x9185('0x2c')][_0x9185('0x4f')](_0x28a46e[_0x9185('0x4e')])[_0x9185('0x26')](respondWithResult(_0x3f6fef,0xc9))[_0x9185('0x43')](handleError(_0x3f6fef,null));};exports[_0x9185('0x54')]=function(_0x54b874,_0x370bcb,_0x584215){return db['Attachment'][_0x9185('0x55')]({'where':{'id':_0x54b874[_0x9185('0x44')]['id']},'raw':!![]})[_0x9185('0x26')](handleEntityNotFound(_0x370bcb,null))[_0x9185('0x26')](function(_0x1ac2b5){if(_0x1ac2b5){return _0x370bcb[_0x9185('0x54')](path[_0x9185('0x56')](config['root'],_0x9185('0x57'),_0x1ac2b5['basename']));}})['catch'](handleError(_0x370bcb,null));}; \ No newline at end of file +var _0x372f=['filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','get','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','mimetype','findOne','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x372f,0x6d));var _0xf372=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x372f[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf372('0x0'));var rimraf=require(_0xf372('0x1'));var zipdir=require(_0xf372('0x2'));var jsonpatch=require(_0xf372('0x3'));var rp=require(_0xf372('0x4'));var moment=require(_0xf372('0x5'));var BPromise=require(_0xf372('0x6'));var Mustache=require(_0xf372('0x7'));var util=require(_0xf372('0x8'));var path=require(_0xf372('0x9'));var sox=require(_0xf372('0xa'));var csv=require('to-csv');var ejs=require(_0xf372('0xb'));var fs=require('fs');var _=require(_0xf372('0xc'));var squel=require(_0xf372('0xd'));var crypto=require(_0xf372('0xe'));var jsforce=require(_0xf372('0xf'));var deskjs=require(_0xf372('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf372('0x11'));var qs=require(_0xf372('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf372('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf372('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf372('0x15'))['db'];function respondWithStatusCode(_0x2dcca3,_0x2f4d83){_0x2f4d83=_0x2f4d83||0xcc;return function(_0x1b68fc){if(_0x1b68fc){return _0x2dcca3[_0xf372('0x16')](_0x2f4d83);}return _0x2dcca3['status'](_0x2f4d83)[_0xf372('0x17')]();};}function respondWithResult(_0x4bd52e,_0x4479bd){_0x4479bd=_0x4479bd||0xc8;return function(_0x221d95){if(_0x221d95){return _0x4bd52e[_0xf372('0x18')](_0x4479bd)['json'](_0x221d95);}};}function respondWithFilteredResult(_0x5c2ea2,_0x440748){return function(_0x521695){if(_0x521695){var _0x2eb4a4=_0x521695[_0xf372('0x19')],_0x52ed3a=_0x440748[_0xf372('0x1a')],_0x48c659=_0x440748[_0xf372('0x1a')]+_0x440748['limit'],_0x2ccd07;if(_0x48c659>=_0x2eb4a4){_0x48c659=_0x2eb4a4;_0x2ccd07=0xc8;}else{_0x2ccd07=0xce;}_0x5c2ea2[_0xf372('0x18')](_0x2ccd07);return _0x5c2ea2[_0xf372('0x1b')](_0xf372('0x1c'),_0x52ed3a+'-'+_0x48c659+'/'+_0x2eb4a4)[_0xf372('0x1d')](_0x521695);}return null;};}function patchUpdates(_0x464cf7){return function(_0x426b6a){try{jsonpatch[_0xf372('0x1e')](_0x426b6a,_0x464cf7,!![]);}catch(_0x5937d2){return BPromise[_0xf372('0x1f')](_0x5937d2);}return _0x426b6a[_0xf372('0x20')]();};}function saveUpdates(_0x59d2e8,_0x58ab02){return function(_0x20083d){if(_0x20083d){return _0x20083d['update'](_0x59d2e8)[_0xf372('0x21')](function(_0x2b63e7){return _0x2b63e7;});}return null;};}function removeEntity(_0x19d276,_0x464846){return function(_0x5a6534){if(_0x5a6534){return _0x5a6534[_0xf372('0x22')]()[_0xf372('0x21')](function(){_0x19d276[_0xf372('0x18')](0xcc)[_0xf372('0x17')]();});}};}function handleEntityNotFound(_0x56e5d5,_0x4b8230){return function(_0x3bef4c){if(!_0x3bef4c){_0x56e5d5[_0xf372('0x16')](0x194);}return _0x3bef4c;};}function handleError(_0x4742e3,_0x1d1849){_0x1d1849=_0x1d1849||0x1f4;return function(_0x39ce70){logger[_0xf372('0x23')](_0x39ce70[_0xf372('0x24')]);if(_0x39ce70[_0xf372('0x25')]){delete _0x39ce70[_0xf372('0x25')];}_0x4742e3[_0xf372('0x18')](_0x1d1849)[_0xf372('0x26')](_0x39ce70);};}exports[_0xf372('0x27')]=function(_0x31a705,_0x48f9f1){var _0x203653={},_0x524ecb={},_0x479220={'count':0x0,'rows':[]};var _0x35c03e=_[_0xf372('0x28')](db[_0xf372('0x29')][_0xf372('0x2a')],function(_0x1d1515){return{'name':_0x1d1515[_0xf372('0x2b')],'type':_0x1d1515[_0xf372('0x2c')][_0xf372('0x2d')]};});_0x524ecb[_0xf372('0x2e')]=_['map'](_0x35c03e,_0xf372('0x25'));_0x524ecb['query']=_[_0xf372('0x2f')](_0x31a705[_0xf372('0x30')]);_0x524ecb[_0xf372('0x31')]=_['intersection'](_0x524ecb[_0xf372('0x2e')],_0x524ecb[_0xf372('0x30')]);_0x203653[_0xf372('0x32')]=_['intersection'](_0x524ecb['model'],qs['fields'](_0x31a705['query'][_0xf372('0x33')]));_0x203653[_0xf372('0x32')]=_0x203653['attributes'][_0xf372('0x34')]?_0x203653[_0xf372('0x32')]:_0x524ecb[_0xf372('0x2e')];if(!_0x31a705['query'][_0xf372('0x35')](_0xf372('0x36'))){_0x203653['limit']=qs[_0xf372('0x37')](_0x31a705[_0xf372('0x30')][_0xf372('0x37')]);_0x203653[_0xf372('0x1a')]=qs['offset'](_0x31a705['query']['offset']);}_0x203653[_0xf372('0x38')]=qs[_0xf372('0x39')](_0x31a705[_0xf372('0x30')][_0xf372('0x39')]);_0x203653[_0xf372('0x3a')]=qs[_0xf372('0x31')](_['pick'](_0x31a705[_0xf372('0x30')],_0x524ecb['filters']),_0x35c03e);if(_0x31a705['query'][_0xf372('0x3b')]){_0x203653[_0xf372('0x3a')]=_['merge'](_0x203653[_0xf372('0x3a')],{'$or':_[_0xf372('0x28')](_0x35c03e,function(_0x2d05f9){if(_0x2d05f9[_0xf372('0x2c')]!==_0xf372('0x3c')){var _0x38fca1={};_0x38fca1[_0x2d05f9[_0xf372('0x25')]]={'$like':'%'+_0x31a705[_0xf372('0x30')][_0xf372('0x3b')]+'%'};return _0x38fca1;}})});}_0x203653=_['merge']({},_0x203653,_0x31a705[_0xf372('0x3d')]);var _0x5cbc39={'where':_0x203653[_0xf372('0x3a')]};return db[_0xf372('0x29')]['count'](_0x5cbc39)['then'](function(_0x2cfc3b){_0x479220[_0xf372('0x19')]=_0x2cfc3b;if(_0x31a705[_0xf372('0x30')][_0xf372('0x3e')]){_0x203653[_0xf372('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0xf372('0x40')](_0x203653);})[_0xf372('0x21')](function(_0xb60f88){_0x479220[_0xf372('0x41')]=_0xb60f88;return _0x479220;})[_0xf372('0x21')](respondWithFilteredResult(_0x48f9f1,_0x203653))[_0xf372('0x42')](handleError(_0x48f9f1,null));};exports['show']=function(_0x47e80d,_0x1774e9){var _0x463c69={'raw':!![],'where':{'id':_0x47e80d[_0xf372('0x43')]['id']}},_0x4a6ace={};_0x4a6ace[_0xf372('0x2e')]=_[_0xf372('0x2f')](db['Attachment'][_0xf372('0x2a')]);_0x4a6ace['query']=_[_0xf372('0x2f')](_0x47e80d[_0xf372('0x30')]);_0x4a6ace['filters']=_['intersection'](_0x4a6ace[_0xf372('0x2e')],_0x4a6ace[_0xf372('0x30')]);_0x463c69[_0xf372('0x32')]=_[_0xf372('0x44')](_0x4a6ace[_0xf372('0x2e')],qs[_0xf372('0x33')](_0x47e80d[_0xf372('0x30')][_0xf372('0x33')]));_0x463c69[_0xf372('0x32')]=_0x463c69[_0xf372('0x32')]['length']?_0x463c69[_0xf372('0x32')]:_0x4a6ace[_0xf372('0x2e')];if(_0x47e80d[_0xf372('0x30')][_0xf372('0x3e')]){_0x463c69[_0xf372('0x3f')]=[{'all':!![]}];}_0x463c69=_['merge']({},_0x463c69,_0x47e80d[_0xf372('0x3d')]);return db[_0xf372('0x29')][_0xf372('0x45')](_0x463c69)[_0xf372('0x21')](handleEntityNotFound(_0x1774e9,null))[_0xf372('0x21')](respondWithResult(_0x1774e9,null))[_0xf372('0x42')](handleError(_0x1774e9,null));};exports['clone']=function(_0x27ef84,_0x401ebe){var _0x581942={'where':{'id':_0x27ef84[_0xf372('0x43')]['id']}},_0x2ad2ae={};_0x2ad2ae[_0xf372('0x2e')]=_[_0xf372('0x2f')](db[_0xf372('0x29')]['rawAttributes']);_0x581942[_0xf372('0x32')]=_[_0xf372('0x44')](_0x2ad2ae[_0xf372('0x2e')],qs[_0xf372('0x33')](_0x27ef84[_0xf372('0x30')][_0xf372('0x33')]));_0x581942['attributes']=_0x581942[_0xf372('0x32')][_0xf372('0x34')]?_0x581942[_0xf372('0x32')]:_0x2ad2ae['model'];if(_0x27ef84[_0xf372('0x30')][_0xf372('0x3e')]){_0x581942[_0xf372('0x3f')]=[{'all':!![]}];}_0x581942=_['merge']({},_0x581942,_0x27ef84[_0xf372('0x3d')]);return db[_0xf372('0x29')][_0xf372('0x45')](_0x581942)['then'](handleEntityNotFound(_0x401ebe,null))[_0xf372('0x21')](function(_0x504065){if(_0x504065){var _0x116913=_0x504065[_0xf372('0x46')]({'plain':!![]});_0x116913=qs[_0xf372('0x47')](_0x116913,['id',_0xf372('0x48'),_0xf372('0x49')]);_0x27ef84[_0xf372('0x4a')]=_[_0xf372('0x47')](_0x27ef84[_0xf372('0x4a')],['id',_0xf372('0x48'),'updatedAt']);return db['Attachment']['create'](_['merge'](_0x116913,_0x27ef84['body']),{'include':_0x27ef84[_0xf372('0x30')][_0xf372('0x3e')]?[{'all':!![]}]:undefined});}})[_0xf372('0x21')](respondWithResult(_0x401ebe,0xc9))[_0xf372('0x42')](handleError(_0x401ebe,null));};exports[_0xf372('0x4b')]=function(_0x5e7c58,_0x1bfece){if(_0x5e7c58['body']['id']){delete _0x5e7c58['body']['id'];}return db[_0xf372('0x29')]['find']({'where':{'id':_0x5e7c58[_0xf372('0x43')]['id']}})['then'](handleEntityNotFound(_0x1bfece,null))[_0xf372('0x21')](saveUpdates(_0x5e7c58[_0xf372('0x4a')],null))[_0xf372('0x21')](respondWithResult(_0x1bfece,null))['catch'](handleError(_0x1bfece,null));};exports[_0xf372('0x22')]=function(_0x1e04bc,_0x36e27c){return db['Attachment']['find']({'where':{'id':_0x1e04bc[_0xf372('0x43')]['id']}})[_0xf372('0x21')](handleEntityNotFound(_0x36e27c,null))[_0xf372('0x21')](removeEntity(_0x36e27c,null))['catch'](handleError(_0x36e27c,null));};exports[_0xf372('0x4c')]=function(_0x4a658e,_0x559560,_0x39901a){_0x4a658e[_0xf372('0x4a')][_0xf372('0x25')]=_0x4a658e[_0xf372('0x4d')][_0xf372('0x4e')];_0x4a658e['body'][_0xf372('0x4f')]=_0x4a658e['file']['filename'];_0x4a658e[_0xf372('0x4a')][_0xf372('0x2c')]=_0x4a658e[_0xf372('0x4d')][_0xf372('0x50')];return db[_0xf372('0x29')][_0xf372('0x4c')](_0x4a658e[_0xf372('0x4a')])[_0xf372('0x21')](respondWithResult(_0x559560,0xc9))['catch'](handleError(_0x559560,null));};exports['download']=function(_0x221d76,_0x5b23a9,_0x5fdcd4){return db[_0xf372('0x29')][_0xf372('0x51')]({'where':{'id':_0x221d76[_0xf372('0x43')]['id']},'raw':!![]})[_0xf372('0x21')](handleEntityNotFound(_0x5b23a9,null))[_0xf372('0x21')](function(_0x382acd){if(_0x382acd){return _0x5b23a9['download'](path['join'](config[_0xf372('0x52')],_0xf372('0x53'),_0x382acd[_0xf372('0x4f')]));}})[_0xf372('0x42')](handleError(_0x5b23a9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 9c97620..60bc3c4 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 _0x2b4f=['exports','define','attachments','util','api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2b4f,0x142));var _0xf2b4=function(_0x1500de,_0x16c29e){_0x1500de=_0x1500de-0x0;var _0x3d81ac=_0x2b4f[_0x1500de];return _0x3d81ac;};'use strict';var _=require('lodash');var util=require(_0xf2b4('0x0'));var logger=require('../../config/logger')(_0xf2b4('0x1'));var moment=require(_0xf2b4('0x2'));var BPromise=require(_0xf2b4('0x3'));var rp=require(_0xf2b4('0x4'));var fs=require('fs');var path=require(_0xf2b4('0x5'));var rimraf=require('rimraf');var config=require(_0xf2b4('0x6'));var attributes=require(_0xf2b4('0x7'));module[_0xf2b4('0x8')]=function(_0x35a765,_0x55733c){return _0x35a765[_0xf2b4('0x9')]('Attachment',attributes,{'tableName':_0xf2b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5523=['./attachment.attributes','exports','attachments','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5523,0x137));var _0x3552=function(_0x32cf49,_0x4273c8){_0x32cf49=_0x32cf49-0x0;var _0x1f87fb=_0x5523[_0x32cf49];return _0x1f87fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('Attachment',attributes,{'tableName':_0x3552('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 ef95f4e..4c80c8b 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 _0x7152=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','catch','Attachment','create','body','options','CreateAttachment','lodash','util','moment','bluebird'];(function(_0x158545,_0x4e98a8){var _0x1e2c07=function(_0x22ea2b){while(--_0x22ea2b){_0x158545['push'](_0x158545['shift']());}};_0x1e2c07(++_0x4e98a8);}(_0x7152,0x17c));var _0x2715=function(_0x4f6f04,_0x59c6ba){_0x4f6f04=_0x4f6f04-0x0;var _0x606b2c=_0x7152[_0x4f6f04];return _0x606b2c;};'use strict';var _=require(_0x2715('0x0'));var util=require(_0x2715('0x1'));var moment=require(_0x2715('0x2'));var BPromise=require(_0x2715('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2715('0x4'));var db=require(_0x2715('0x5'))['db'];var utils=require(_0x2715('0x6'));var logger=require(_0x2715('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2715('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x503c8a,_0x1fe37c,_0x5e22cf){return new BPromise(function(_0x20b512,_0x2027c3){return client['request'](_0x503c8a,_0x5e22cf)[_0x2715('0x9')](function(_0x6edfe3){logger['info']('Attachment,\x20%s,\x20%s',_0x1fe37c,_0x2715('0xa'));logger[_0x2715('0xb')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1fe37c,'request\x20sent',JSON[_0x2715('0xc')](_0x6edfe3));if(_0x6edfe3[_0x2715('0xd')]){if(_0x6edfe3['error'][_0x2715('0xe')]===0x1f4){logger[_0x2715('0xd')](_0x2715('0xf'),_0x1fe37c,_0x6edfe3[_0x2715('0xd')][_0x2715('0x10')]);return _0x2027c3(_0x6edfe3[_0x2715('0xd')][_0x2715('0x10')]);}logger[_0x2715('0xd')](_0x2715('0xf'),_0x1fe37c,_0x6edfe3[_0x2715('0xd')][_0x2715('0x10')]);return _0x20b512(_0x6edfe3['error'][_0x2715('0x10')]);}else{logger[_0x2715('0x11')](_0x2715('0xf'),_0x1fe37c,_0x2715('0xa'));_0x20b512(_0x6edfe3['result']['message']);}})[_0x2715('0x12')](function(_0x4d88){logger[_0x2715('0xd')]('Attachment,\x20%s,\x20%s',_0x1fe37c,_0x4d88);_0x2027c3(_0x4d88);});});}exports['CreateAttachment']=function(_0x11c45a){var _0x15cd81=this;return new Promise(function(_0x3f1403,_0x4b2918){return db[_0x2715('0x13')][_0x2715('0x14')](_0x11c45a[_0x2715('0x15')],{'raw':_0x11c45a[_0x2715('0x16')]?_0x11c45a[_0x2715('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x2715('0x9')](function(_0x1f6942){logger['info'](_0x2715('0x17'),_0x11c45a);logger['debug']('CreateAttachment',_0x11c45a,JSON[_0x2715('0xc')](_0x1f6942));_0x3f1403(_0x1f6942);})['catch'](function(_0x248a8c){logger['error']('CreateAttachment',_0x248a8c['message'],_0x11c45a);_0x4b2918(_0x15cd81[_0x2715('0xd')](0x1f4,_0x248a8c[_0x2715('0x10')]));});});}; \ No newline at end of file +var _0x9e91=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','body','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x28dd95,_0x35223a){var _0x149c2e=function(_0x1ab011){while(--_0x1ab011){_0x28dd95['push'](_0x28dd95['shift']());}};_0x149c2e(++_0x35223a);}(_0x9e91,0xd8));var _0x19e9=function(_0x2ec9bf,_0x31c280){_0x2ec9bf=_0x2ec9bf-0x0;var _0x3f944c=_0x9e91[_0x2ec9bf];return _0x3f944c;};'use strict';var _=require(_0x19e9('0x0'));var util=require(_0x19e9('0x1'));var moment=require(_0x19e9('0x2'));var BPromise=require(_0x19e9('0x3'));var rs=require(_0x19e9('0x4'));var fs=require('fs');var Redis=require(_0x19e9('0x5'));var db=require(_0x19e9('0x6'))['db'];var utils=require(_0x19e9('0x7'));var logger=require(_0x19e9('0x8'))('rpc');var config=require(_0x19e9('0x9'));var jayson=require(_0x19e9('0xa'));var client=jayson[_0x19e9('0xb')][_0x19e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24e611,_0x4edcfb,_0x565aad){return new BPromise(function(_0x231cea,_0x1926cd){return client[_0x19e9('0xd')](_0x24e611,_0x565aad)[_0x19e9('0xe')](function(_0x1ccf4c){logger[_0x19e9('0xf')]('Attachment,\x20%s,\x20%s',_0x4edcfb,_0x19e9('0x10'));logger[_0x19e9('0x11')](_0x19e9('0x12'),_0x4edcfb,_0x19e9('0x10'),JSON['stringify'](_0x1ccf4c));if(_0x1ccf4c[_0x19e9('0x13')]){if(_0x1ccf4c[_0x19e9('0x13')]['code']===0x1f4){logger[_0x19e9('0x13')](_0x19e9('0x14'),_0x4edcfb,_0x1ccf4c[_0x19e9('0x13')][_0x19e9('0x15')]);return _0x1926cd(_0x1ccf4c[_0x19e9('0x13')][_0x19e9('0x15')]);}logger[_0x19e9('0x13')](_0x19e9('0x14'),_0x4edcfb,_0x1ccf4c[_0x19e9('0x13')][_0x19e9('0x15')]);return _0x231cea(_0x1ccf4c[_0x19e9('0x13')]['message']);}else{logger[_0x19e9('0xf')]('Attachment,\x20%s,\x20%s',_0x4edcfb,_0x19e9('0x10'));_0x231cea(_0x1ccf4c['result'][_0x19e9('0x15')]);}})[_0x19e9('0x16')](function(_0x3f3dab){logger[_0x19e9('0x13')](_0x19e9('0x14'),_0x4edcfb,_0x3f3dab);_0x1926cd(_0x3f3dab);});});}exports[_0x19e9('0x17')]=function(_0x3c9182){var _0x4ea349=this;return new Promise(function(_0x1e4dd8,_0x137592){return db[_0x19e9('0x18')][_0x19e9('0x19')](_0x3c9182[_0x19e9('0x1a')],{'raw':_0x3c9182['options']?_0x3c9182['options'][_0x19e9('0x1b')]===undefined?!![]:![]:!![]})[_0x19e9('0xe')](function(_0x3646d0){logger[_0x19e9('0xf')](_0x19e9('0x17'),_0x3c9182);logger[_0x19e9('0x11')](_0x19e9('0x17'),_0x3c9182,JSON[_0x19e9('0x1c')](_0x3646d0));_0x1e4dd8(_0x3646d0);})[_0x19e9('0x16')](function(_0x1513b7){logger[_0x19e9('0x13')](_0x19e9('0x17'),_0x1513b7[_0x19e9('0x15')],_0x3c9182);_0x137592(_0x4ea349[_0x19e9('0x13')](0x1f4,_0x1513b7[_0x19e9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 87692bc..b31293a 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 _0x2015=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','single','put','destroy','multer','util','path'];(function(_0x366559,_0x54b129){var _0x2e7048=function(_0x300e3f){while(--_0x300e3f){_0x366559['push'](_0x366559['shift']());}};_0x2e7048(++_0x54b129);}(_0x2015,0x193));var _0x5201=function(_0x455e9d,_0x23c85c){_0x455e9d=_0x455e9d-0x0;var _0x191a8a=_0x2015[_0x455e9d];return _0x191a8a;};'use strict';var multer=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var path=require(_0x5201('0x2'));var timeout=require(_0x5201('0x3'));var express=require(_0x5201('0x4'));var router=express[_0x5201('0x5')]();var auth=require(_0x5201('0x6'));var interaction=require(_0x5201('0x7'));var config=require('../../config/environment');var controller=require(_0x5201('0x8'));router[_0x5201('0x9')]('/',auth[_0x5201('0xa')](),controller[_0x5201('0xb')]);router[_0x5201('0x9')](_0x5201('0xc'),auth[_0x5201('0xa')](),controller[_0x5201('0xd')]);router[_0x5201('0x9')](_0x5201('0xe'),auth['isAuthenticated'](),controller[_0x5201('0xf')]);router[_0x5201('0x10')]('/:id/clone',auth[_0x5201('0xa')](),controller[_0x5201('0x11')]);var upload=multer({'storage':multer[_0x5201('0x12')]({'destination':function(_0x47aa66,_0x129e16,_0x29c68f){_0x29c68f(null,path[_0x5201('0x13')](config[_0x5201('0x14')],_0x5201('0x15')));},'filename':function(_0x26677a,_0x2038a9,_0x677cd5){_0x677cd5(null,util[_0x5201('0x16')](_0x5201('0x17'),Date[_0x5201('0x18')](),_0x2038a9[_0x5201('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5201('0x10')]('/',upload[_0x5201('0x1a')]('file'),controller['create']);router[_0x5201('0x1b')](_0x5201('0xc'),auth[_0x5201('0xa')](),controller['update']);router['delete'](_0x5201('0xc'),auth['isAuthenticated'](),controller[_0x5201('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x082a=['put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','/:id/clone','clone','server/files/attachments/','%s-%s','now','originalname','replace','single','create'];(function(_0x5755d6,_0x2b93af){var _0x40399d=function(_0x1a57a3){while(--_0x1a57a3){_0x5755d6['push'](_0x5755d6['shift']());}};_0x40399d(++_0x2b93af);}(_0x082a,0x154));var _0xa082=function(_0x99cece,_0x1fd74c){_0x99cece=_0x99cece-0x0;var _0x3696ca=_0x082a[_0x99cece];return _0x3696ca;};'use strict';var multer=require('multer');var util=require(_0xa082('0x0'));var path=require(_0xa082('0x1'));var timeout=require(_0xa082('0x2'));var express=require('express');var router=express[_0xa082('0x3')]();var auth=require(_0xa082('0x4'));var interaction=require(_0xa082('0x5'));var config=require(_0xa082('0x6'));var controller=require(_0xa082('0x7'));router['get']('/',auth[_0xa082('0x8')](),controller['index']);router[_0xa082('0x9')](_0xa082('0xa'),auth['isAuthenticated'](),controller[_0xa082('0xb')]);router[_0xa082('0x9')](_0xa082('0xc'),auth['isAuthenticated'](),controller[_0xa082('0xd')]);router[_0xa082('0xe')](_0xa082('0xf'),auth[_0xa082('0x8')](),controller[_0xa082('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1fcf69,_0x3fbade,_0x368a65){_0x368a65(null,path['join'](config['root'],_0xa082('0x11')));},'filename':function(_0x18d742,_0x473b1d,_0x2f6591){_0x2f6591(null,util['format'](_0xa082('0x12'),Date[_0xa082('0x13')](),_0x473b1d[_0xa082('0x14')][_0xa082('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa082('0xe')]('/',upload[_0xa082('0x16')]('file'),controller[_0xa082('0x17')]);router[_0xa082('0x18')]('/:id',auth[_0xa082('0x8')](),controller[_0xa082('0x19')]);router[_0xa082('0x1a')](_0xa082('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa082('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c90657b..fd194ee 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 _0x0279=['lodash','passport-google-oauth20','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','authenticate','google','/login','profile','email','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map','emails','value','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','add','minutes','clearBlockUser','getLicense'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0279,0xaf));var _0x9027=function(_0xe429f8,_0xb5ddb4){_0xe429f8=_0xe429f8-0x0;var _0x439723=_0x0279[_0xe429f8];return _0x439723;};'use strict';var _=require(_0x9027('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x9027('0x1'))['Strategy'];var moment=require(_0x9027('0x2'));var db=require(_0x9027('0x3'))['db'];var config=require(_0x9027('0x4'));var signToken=require('../../components/auth/service')[_0x9027('0x5')];var utils=require(_0x9027('0x6'));exports['login']=passport[_0x9027('0x7')](_0x9027('0x8'),{'failureRedirect':_0x9027('0x9'),'scope':[_0x9027('0xa'),_0x9027('0xb')],'session':![]});exports['callback']=passport[_0x9027('0x7')](_0x9027('0x8'),{'failureRedirect':_0x9027('0x9'),'session':![]});passport[_0x9027('0xc')](new GoogleStrategy({'clientID':config[_0x9027('0x8')]?config[_0x9027('0x8')][_0x9027('0xd')]:'id','clientSecret':config[_0x9027('0x8')]?config[_0x9027('0x8')][_0x9027('0xe')]:_0x9027('0xf'),'callbackURL':config[_0x9027('0x8')]?config['google'][_0x9027('0x10')]:''},function(_0x5b2ae6,_0x3fad30,_0x4a9678,_0x1cf897){var _0x3a28fc,_0x3efd00;return db[_0x9027('0x11')][_0x9027('0x12')]({'where':{'id':0x1},'attributes':[_0x9027('0x13'),'blockDuration'],'raw':!![]})[_0x9027('0x14')](function(_0x3045ed){_0x3a28fc=_0x3045ed;return db[_0x9027('0x15')][_0x9027('0x16')]({'where':{'email':_[_0x9027('0x17')](_0x4a9678[_0x9027('0x18')],_0x9027('0x19')),'role':{'$or':[_0x9027('0x1a'),'user',_0x9027('0x1b')]}}});})[_0x9027('0x14')](function(_0x49ad45){_0x3efd00=_0x49ad45;if(_0x3efd00){if(_0x3efd00['disabled']){return _0x1cf897(_0x9027('0x1c'));}else if(_0x3a28fc[_0x9027('0x1d')]>0x0){if(_0x3efd00[_0x9027('0x1e')]){if(moment(_0x3efd00['blockedAt'])[_0x9027('0x1f')](_0x3a28fc[_0x9027('0x1d')],_0x9027('0x20'))>moment()){return _0x1cf897(_0x9027('0x1c'));}else{return utils[_0x9027('0x21')](_0x3efd00,0x0,![],null)[_0x9027('0x14')](function(){return utils['getLicense'](_0x3efd00);})[_0x9027('0x14')](function(){return _0x1cf897(null,_0x3efd00);});}}else{return utils[_0x9027('0x22')](_0x3efd00)[_0x9027('0x14')](function(){return _0x1cf897(null,_0x3efd00);});}}else{return utils[_0x9027('0x22')](_0x3efd00)['then'](function(){return _0x1cf897(null,_0x3efd00);});}}return _0x1cf897(_0x9027('0x1c'));})['catch'](function(_0x2c7eab){_0x1cf897(_0x2c7eab);});})); \ No newline at end of file +var _0xe304=['signToken','login','/login','profile','email','callback','authenticate','use','google','secret','callbackURL','Setting','findOne','then','User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','add','minutes','clearBlockUser','getLicense','catch','passport-google-oauth20','Strategy','moment','../../config/environment','../../components/auth/service'];(function(_0x3fa631,_0x24392c){var _0x5c9dec=function(_0x36d01a){while(--_0x36d01a){_0x3fa631['push'](_0x3fa631['shift']());}};_0x5c9dec(++_0x24392c);}(_0xe304,0x159));var _0x4e30=function(_0x2d2f7d,_0x4551a7){_0x2d2f7d=_0x2d2f7d-0x0;var _0x2fc251=_0xe304[_0x2d2f7d];return _0x2fc251;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x4e30('0x0'))[_0x4e30('0x1')];var moment=require(_0x4e30('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x4e30('0x3'));var signToken=require(_0x4e30('0x4'))[_0x4e30('0x5')];var utils=require('../../config/utils');exports[_0x4e30('0x6')]=passport['authenticate']('google',{'failureRedirect':_0x4e30('0x7'),'scope':[_0x4e30('0x8'),_0x4e30('0x9')],'session':![]});exports[_0x4e30('0xa')]=passport[_0x4e30('0xb')]('google',{'failureRedirect':'/login','session':![]});passport[_0x4e30('0xc')](new GoogleStrategy({'clientID':config[_0x4e30('0xd')]?config[_0x4e30('0xd')]['clientID']:'id','clientSecret':config[_0x4e30('0xd')]?config[_0x4e30('0xd')]['clientSecret']:_0x4e30('0xe'),'callbackURL':config[_0x4e30('0xd')]?config[_0x4e30('0xd')][_0x4e30('0xf')]:''},function(_0x2b0835,_0x35c00a,_0x33f3fd,_0x5deb1c){var _0x4da627,_0x27cc5d;return db[_0x4e30('0x10')][_0x4e30('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x4e30('0x12')](function(_0x575b44){_0x4da627=_0x575b44;return db[_0x4e30('0x13')][_0x4e30('0x14')]({'where':{'email':_[_0x4e30('0x15')](_0x33f3fd[_0x4e30('0x16')],'value'),'role':{'$or':[_0x4e30('0x17'),_0x4e30('0x18'),_0x4e30('0x19')]}}});})[_0x4e30('0x12')](function(_0x5f3493){_0x27cc5d=_0x5f3493;if(_0x27cc5d){if(_0x27cc5d[_0x4e30('0x1a')]){return _0x5deb1c(_0x4e30('0x1b'));}else if(_0x4da627[_0x4e30('0x1c')]>0x0){if(_0x27cc5d[_0x4e30('0x1d')]){if(moment(_0x27cc5d['blockedAt'])[_0x4e30('0x1e')](_0x4da627['blockDuration'],_0x4e30('0x1f'))>moment()){return _0x5deb1c(_0x4e30('0x1b'));}else{return utils[_0x4e30('0x20')](_0x27cc5d,0x0,![],null)['then'](function(){return utils[_0x4e30('0x21')](_0x27cc5d);})[_0x4e30('0x12')](function(){return _0x5deb1c(null,_0x27cc5d);});}}else{return utils[_0x4e30('0x21')](_0x27cc5d)['then'](function(){return _0x5deb1c(null,_0x27cc5d);});}}else{return utils['getLicense'](_0x27cc5d)[_0x4e30('0x12')](function(){return _0x5deb1c(null,_0x27cc5d);});}}return _0x5deb1c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x4e30('0x22')](function(_0x1f30ed){_0x5deb1c(_0x1f30ed);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 87b2c2b..80431fc 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 _0x37a4=['isMiddleware','login','exports','express','Router','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x37a4,0xcb));var _0x437a=function(_0x3d55c3,_0x572eff){_0x3d55c3=_0x3d55c3-0x0;var _0x2d2539=_0x37a4[_0x3d55c3];return _0x2d2539;};'use strict';var express=require(_0x437a('0x0'));var passport=require('passport');var router=express[_0x437a('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x437a('0x2'));var authService=require(_0x437a('0x3'));router[_0x437a('0x4')]('/',controller['login']);router['get'](_0x437a('0x5'),controller[_0x437a('0x6')],authService[_0x437a('0x7')],userController[_0x437a('0x8')],authService['setTokenCookie']);module[_0x437a('0x9')]=router; \ No newline at end of file +var _0x8bdf=['/callback','callback','isMiddleware','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x23fbad,_0x32c9b3){var _0x5ecff6=function(_0x38e5c0){while(--_0x38e5c0){_0x23fbad['push'](_0x23fbad['shift']());}};_0x5ecff6(++_0x32c9b3);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8bdf[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0xf8bd('0x0'));var passport=require(_0xf8bd('0x1'));var router=express[_0xf8bd('0x2')]();var controller=require(_0xf8bd('0x3'));var userController=require(_0xf8bd('0x4'));var authService=require('../../components/auth/service');router[_0xf8bd('0x5')]('/',controller[_0xf8bd('0x6')]);router[_0xf8bd('0x5')](_0xf8bd('0x7'),controller[_0xf8bd('0x8')],authService[_0xf8bd('0x9')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a4de4e4..5da509c 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 _0x8ca9=['salt','role','disabled','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','status','send','message','local','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','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','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0x8ca9,0x9c));var _0x98ca=function(_0x3ef5e2,_0x4ee542){_0x3ef5e2=_0x3ef5e2-0x0;var _0xb7c97a=_0x8ca9[_0x3ef5e2];return _0xb7c97a;};'use strict';var util=require(_0x98ca('0x0'));var passport=require(_0x98ca('0x1'));var LocalStrategy=require(_0x98ca('0x2'))[_0x98ca('0x3')];var jayson=require(_0x98ca('0x4'));var _=require(_0x98ca('0x5'));var rs=require(_0x98ca('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x98ca('0x7'));var utils=require('../../config/utils');var client=jayson[_0x98ca('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x219619,_0xca4097,_0x18c349,_0x2852a0){var _0x323c95,_0x28a37a;return db[_0x98ca('0x9')][_0x98ca('0xa')]({'where':{'id':0x1},'attributes':[_0x98ca('0xb'),_0x98ca('0xc')],'raw':!![]})[_0x98ca('0xd')](function(_0x2074fb){_0x323c95=_0x2074fb;return _0x219619[_0x98ca('0xa')]({'attributes':['id',_0x98ca('0xe'),_0x98ca('0xf'),_0x98ca('0x10'),_0x98ca('0x11'),_0x98ca('0x12'),'blocked',_0x98ca('0x13'),_0x98ca('0x14')],'where':{'name':_0xca4097,'role':{'$or':[_0x98ca('0x15'),_0x98ca('0x16'),'agent']}}});})[_0x98ca('0xd')](function(_0x6345be){if(!_0x6345be||_0x6345be&&_0x6345be[_0x98ca('0xe')]!==_0xca4097){throw new Error(_0x98ca('0x17'));}else{_0x28a37a=_0x6345be;return _0x28a37a;}})[_0x98ca('0xd')](function(){_0x28a37a[_0x98ca('0x18')](_0x18c349,function(_0x58d07a,_0x4940ca){var _0x330713=_0x28a37a[_0x98ca('0x14')]+0x1;if(_0x58d07a){return _0x2852a0(_0x58d07a);}else if(!_0x4940ca){if(_0x28a37a[_0x98ca('0x12')]){return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}else if(_0x323c95['allowedLoginAttempts']>0x0){if(_0x28a37a[_0x98ca('0x19')]){if(_0x323c95[_0x98ca('0xc')]>0x0){if(moment(_0x28a37a[_0x98ca('0x13')])[_0x98ca('0x1a')](_0x323c95[_0x98ca('0xc')],_0x98ca('0x1b'))>moment()){return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}else{return utils[_0x98ca('0x1c')](_0x28a37a,_0x330713,![],null)[_0x98ca('0xd')](function(){return _0x2852a0(null,![],{'message':_0x98ca('0x17')});});}}else{return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}}else{if(_0x330713>=_0x323c95['allowedLoginAttempts']){return utils[_0x98ca('0x1c')](_0x28a37a,0x0,!![],moment())['then'](function(){return _0x2852a0(null,![],{'message':_0x98ca('0x17')});});}else{return utils[_0x98ca('0x1c')](_0x28a37a,_0x330713,![],null)['then'](function(){return _0x2852a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}}else{if(_0x28a37a[_0x98ca('0x12')]){return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}else if(_0x323c95['allowedLoginAttempts']>0x0){if(_0x28a37a[_0x98ca('0x19')]){if(_0x323c95[_0x98ca('0xc')]>0x0){if(moment(_0x28a37a['blockedAt'])[_0x98ca('0x1a')](_0x323c95['blockDuration'],_0x98ca('0x1b'))>moment()){return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}else{return utils[_0x98ca('0x1c')](_0x28a37a,0x0,![],null)[_0x98ca('0xd')](function(){return utils[_0x98ca('0x1d')](_0x28a37a);})[_0x98ca('0xd')](function(){return _0x2852a0(null,_0x28a37a);});}}else{return _0x2852a0(null,![],{'message':_0x98ca('0x17')});}}else{return utils['clearBlockUser'](_0x28a37a,0x0,![],null)[_0x98ca('0xd')](function(){return utils['getLicense'](_0x28a37a);})[_0x98ca('0xd')](function(){return _0x2852a0(null,_0x28a37a);})[_0x98ca('0x1e')](function(_0x5eb829){return _0x2852a0(null,![],_0x5eb829);});}}else{if(_0x28a37a[_0x98ca('0x19')]){return _0x2852a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x98ca('0x1d')](_0x28a37a)['then'](function(){return _0x2852a0(null,_0x28a37a);});}}}});})['catch'](function(_0x14bfb4){return _0x2852a0(null,![],_0x14bfb4);});}function sendServiceMail(_0x540f45){return db[_0x98ca('0x1f')][_0x98ca('0x20')]({'where':{'service':!![]},'attributes':['id',_0x98ca('0xe'),_0x98ca('0x21')],'include':[{'model':db[_0x98ca('0x22')],'as':_0x98ca('0x23')}]})[_0x98ca('0xd')](function(_0x1bf154){if(!_0x1bf154){throw new Error(_0x98ca('0x24'));}var _0x4f2406={'tls':{'rejectUnauthorized':![]}};if(_0x1bf154[_0x98ca('0x23')]['service']){_0x4f2406[_0x98ca('0x25')]=_0x1bf154[_0x98ca('0x23')]['service'];}else{_0x4f2406['host']=_0x1bf154[_0x98ca('0x23')]['host'];_0x4f2406[_0x98ca('0x26')]=_0x1bf154['Smtp'][_0x98ca('0x26')];_0x4f2406['secure']=_0x1bf154[_0x98ca('0x23')][_0x98ca('0x27')];}if(_0x1bf154['Smtp'][_0x98ca('0x28')]){_0x4f2406[_0x98ca('0x29')]={'user':_0x1bf154['Smtp'][_0x98ca('0x16')],'pass':_0x1bf154[_0x98ca('0x23')]['pass']};}var _0x1c9c5b={'account':_0x4f2406,'message':_[_0x98ca('0x2a')]({'from':util[_0x98ca('0x2b')](_0x98ca('0x2c'),_0x1bf154[_0x98ca('0xe')],_0x1bf154['email']||_0x1bf154[_0x98ca('0x23')][_0x98ca('0x16')])},_0x540f45)};return client['request'](_0x98ca('0x2d'),_0x1c9c5b);})[_0x98ca('0xd')](function(_0x2d5012){if(_0x2d5012['error']){throw new Error(util[_0x98ca('0x2b')](_0x98ca('0x2e'),_0x2d5012[_0x98ca('0x2f')]['message']||JSON[_0x98ca('0x30')](_0x2d5012[_0x98ca('0x2f')])));}return!![];});}function handleError(_0x10cbe0,_0x48be6c,_0x4d7329){return _0x10cbe0[_0x98ca('0x31')](_0x48be6c||0x1f4)[_0x98ca('0x32')]({'message':_0x4d7329?_0x4d7329[_0x98ca('0x33')]||_0x4d7329:''});}exports['login']=function(_0x16f7b1,_0x364e37,_0xb48b4e){passport['authenticate'](_0x98ca('0x34'),function(_0xa5d25,_0x1059df,_0x450745){var _0x1b41c5=_0xa5d25||_0x450745;if(_0x1b41c5){return handleError(_0x364e37,0x191,_0x1b41c5);}if(!_0x1059df){return handleError(_0x364e37,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x578b2f={'payload':{'id':_0x1059df['id'],'role':_0x1059df['role']},'options':{'expiresIn':0x15180}};return authService[_0x98ca('0x35')](_0x578b2f)[_0x98ca('0xd')](function(_0x397de0){_0x364e37[_0x98ca('0x36')]({'id':_0x1059df['id'],'token':_0x397de0,'statusCall':'','isAlreadyLogged':_0x1059df[_0x98ca('0x37')]});});}})(_0x16f7b1,_0x364e37,_0xb48b4e);};exports[_0x98ca('0x38')]=function(_0x29801f,_0x570afe,_0x4900ed){if(!_0x29801f[_0x98ca('0x39')][_0x98ca('0x21')]){return handleError(_0x570afe,0x1f4,{'message':_0x98ca('0x3a')});}var _0x382989=rs[_0x98ca('0x3b')]();_0x29801f['body']['email']=_0x29801f['body'][_0x98ca('0x21')][_0x98ca('0x3c')]()[_0x98ca('0x3d')]();var _0x3f260b;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x98ca('0xb'),_0x98ca('0xc')],'raw':!![]})[_0x98ca('0xd')](function(_0x237cd2){_0x3f260b=_0x237cd2;return db[_0x98ca('0x3e')][_0x98ca('0x20')]({'where':{'email':_0x29801f[_0x98ca('0x39')][_0x98ca('0x21')]}});})[_0x98ca('0xd')](function(_0x38b56a){if(!_0x38b56a){throw new Error(_0x98ca('0x3f'));}if(_0x38b56a['disabled']){throw new Error(_0x98ca('0x40'));}if(_0x38b56a[_0x98ca('0x19')]){if(moment(_0x38b56a[_0x98ca('0x13')])[_0x98ca('0x1a')](_0x3f260b[_0x98ca('0xc')],_0x98ca('0x1b'))>moment()){throw new Error(_0x98ca('0x41'));}else{_0x38b56a[_0x98ca('0x19')]=![];_0x38b56a[_0x98ca('0x13')]=null;}}_0x38b56a['resetPasswordToken']=_0x382989;_0x38b56a[_0x98ca('0x42')]=Date[_0x98ca('0x43')]()+0x36ee80;return _0x38b56a['save']();})[_0x98ca('0xd')](function(){return sendServiceMail({'to':_0x29801f['body'][_0x98ca('0x21')],'subject':_0x98ca('0x44'),'text':_0x98ca('0x45')+_0x98ca('0x46')+_0x98ca('0x47')+_0x29801f[_0x98ca('0x48')][_0x98ca('0x49')]+_0x98ca('0x4a')+_0x382989+'\x0a\x0a'+_0x98ca('0x4b')});})[_0x98ca('0xd')](function(){_0x570afe[_0x98ca('0x31')](0xc8)[_0x98ca('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0x98ca('0x1e')](function(_0x1fa4f8){return handleError(_0x570afe,0x1f4,_0x1fa4f8);});};exports[_0x98ca('0x4c')]=function(_0x19dc39,_0x4d5bf0,_0xec9f92){return db[_0x98ca('0x3e')][_0x98ca('0x20')]({'where':{'resetPasswordToken':_0x19dc39[_0x98ca('0x4d')][_0x98ca('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x98ca('0x43')]()}}})[_0x98ca('0xd')](function(_0x490b04){if(!_0x490b04){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x98ca('0xa')]({'attributes':['id',_0x98ca('0x4f'),_0x98ca('0x50'),_0x98ca('0x51')]})['then'](function(_0x5859d9){if(_0x5859d9[_0x98ca('0x4f')])authService[_0x98ca('0x52')](_0x19dc39[_0x98ca('0x39')][_0x98ca('0xf')]);if(!_0x5859d9[_0x98ca('0x50')]||!_0x490b04[_0x98ca('0x53')])return _0x490b04;authService[_0x98ca('0x54')](_0x19dc39[_0x98ca('0x39')][_0x98ca('0xf')],_0x490b04[_0x98ca('0x53')],_0x5859d9[_0x98ca('0x51')]);return _0x490b04;})[_0x98ca('0xd')](function(){_0x490b04[_0x98ca('0xf')]=_0x19dc39['body'][_0x98ca('0xf')];_0x490b04['resetPasswordToken']=null;_0x490b04[_0x98ca('0x42')]=null;return _0x490b04[_0x98ca('0x55')]();});})[_0x98ca('0xd')](function(){_0x4d5bf0[_0x98ca('0x31')](0xc8)[_0x98ca('0x32')]({'message':'Password\x20reset!'});})[_0x98ca('0x1e')](function(_0x2916a8){return handleError(_0x4d5bf0,0x1f4,_0x2916a8);});};passport['use'](new LocalStrategy({'usernameField':_0x98ca('0xe'),'passwordField':_0x98ca('0xf')},function(_0x3b0fa1,_0x5ddaae,_0x9525bb){return localAuthenticate(db[_0x98ca('0x3e')],_0x3b0fa1,_0x5ddaae,_0x9525bb);})); \ No newline at end of file +var _0x187d=['blockedAt','loginAttempts','admin','agent','authenticate','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','blocked','getLicense','catch','MailAccount','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','Smtp','port','secure','authentication','auth','user','pass','merge','email','request','SendMail','error','format','stringify','status','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','resetPasswordToken','resetPasswordExpires','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x187d,0x93));var _0xd187=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x187d[_0x5ddb1c];return _0x354adc;};'use strict';var util=require(_0xd187('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd187('0x1'))[_0xd187('0x2')];var jayson=require(_0xd187('0x3'));var _=require(_0xd187('0x4'));var rs=require(_0xd187('0x5'));var moment=require(_0xd187('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xd187('0x7'));var utils=require(_0xd187('0x8'));var client=jayson['client'][_0xd187('0x9')]({'port':0x232b});function localAuthenticate(_0x58ee7,_0x444a60,_0x1d3fe4,_0x28ce2f){var _0x2d6992,_0x358c45;return db[_0xd187('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd187('0xb'),_0xd187('0xc')],'raw':!![]})[_0xd187('0xd')](function(_0x473866){_0x2d6992=_0x473866;return _0x58ee7[_0xd187('0xe')]({'attributes':['id',_0xd187('0xf'),'password',_0xd187('0x10'),_0xd187('0x11'),_0xd187('0x12'),'blocked',_0xd187('0x13'),_0xd187('0x14')],'where':{'name':_0x444a60,'role':{'$or':[_0xd187('0x15'),'user',_0xd187('0x16')]}}});})[_0xd187('0xd')](function(_0x37870e){if(!_0x37870e||_0x37870e&&_0x37870e[_0xd187('0xf')]!==_0x444a60){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x358c45=_0x37870e;return _0x358c45;}})[_0xd187('0xd')](function(){_0x358c45[_0xd187('0x17')](_0x1d3fe4,function(_0x45ab10,_0x188cfe){var _0x4c8f68=_0x358c45[_0xd187('0x14')]+0x1;if(_0x45ab10){return _0x28ce2f(_0x45ab10);}else if(!_0x188cfe){if(_0x358c45['disabled']){return _0x28ce2f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2d6992[_0xd187('0xb')]>0x0){if(_0x358c45['blocked']){if(_0x2d6992['blockDuration']>0x0){if(moment(_0x358c45[_0xd187('0x13')])[_0xd187('0x18')](_0x2d6992[_0xd187('0xc')],_0xd187('0x19'))>moment()){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}else{return utils[_0xd187('0x1b')](_0x358c45,_0x4c8f68,![],null)[_0xd187('0xd')](function(){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});});}}else{return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}}else{if(_0x4c8f68>=_0x2d6992[_0xd187('0xb')]){return utils[_0xd187('0x1b')](_0x358c45,0x0,!![],moment())[_0xd187('0xd')](function(){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});});}else{return utils['clearBlockUser'](_0x358c45,_0x4c8f68,![],null)[_0xd187('0xd')](function(){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});});}}}else{return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}}else{if(_0x358c45['disabled']){return _0x28ce2f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2d6992['allowedLoginAttempts']>0x0){if(_0x358c45[_0xd187('0x1c')]){if(_0x2d6992[_0xd187('0xc')]>0x0){if(moment(_0x358c45[_0xd187('0x13')])['add'](_0x2d6992[_0xd187('0xc')],'minutes')>moment()){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}else{return utils['clearBlockUser'](_0x358c45,0x0,![],null)[_0xd187('0xd')](function(){return utils['getLicense'](_0x358c45);})['then'](function(){return _0x28ce2f(null,_0x358c45);});}}else{return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}}else{return utils['clearBlockUser'](_0x358c45,0x0,![],null)[_0xd187('0xd')](function(){return utils[_0xd187('0x1d')](_0x358c45);})['then'](function(){return _0x28ce2f(null,_0x358c45);})['catch'](function(_0x848ddd){return _0x28ce2f(null,![],_0x848ddd);});}}else{if(_0x358c45[_0xd187('0x1c')]){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}else{return utils[_0xd187('0x1d')](_0x358c45)['then'](function(){return _0x28ce2f(null,_0x358c45);});}}}});})[_0xd187('0x1e')](function(_0x2875c8){return _0x28ce2f(null,![],_0x2875c8);});}function sendServiceMail(_0x5c8e52){return db[_0xd187('0x1f')][_0xd187('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd187('0xf'),'email'],'include':[{'model':db[_0xd187('0x21')],'as':'Smtp'}]})[_0xd187('0xd')](function(_0x19e75f){if(!_0x19e75f){throw new Error(_0xd187('0x22'));}var _0x352b66={'tls':{'rejectUnauthorized':![]}};if(_0x19e75f['Smtp'][_0xd187('0x23')]){_0x352b66[_0xd187('0x23')]=_0x19e75f['Smtp']['service'];}else{_0x352b66[_0xd187('0x24')]=_0x19e75f[_0xd187('0x25')][_0xd187('0x24')];_0x352b66[_0xd187('0x26')]=_0x19e75f[_0xd187('0x25')][_0xd187('0x26')];_0x352b66[_0xd187('0x27')]=_0x19e75f[_0xd187('0x25')]['secure'];}if(_0x19e75f[_0xd187('0x25')][_0xd187('0x28')]){_0x352b66[_0xd187('0x29')]={'user':_0x19e75f['Smtp'][_0xd187('0x2a')],'pass':_0x19e75f['Smtp'][_0xd187('0x2b')]};}var _0x43dc68={'account':_0x352b66,'message':_[_0xd187('0x2c')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x19e75f[_0xd187('0xf')],_0x19e75f[_0xd187('0x2d')]||_0x19e75f['Smtp'][_0xd187('0x2a')])},_0x5c8e52)};return client[_0xd187('0x2e')](_0xd187('0x2f'),_0x43dc68);})['then'](function(_0x527c6f){if(_0x527c6f[_0xd187('0x30')]){throw new Error(util[_0xd187('0x31')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x527c6f['error']['message']||JSON[_0xd187('0x32')](_0x527c6f['error'])));}return!![];});}function handleError(_0x28c252,_0x35c381,_0x5728be){return _0x28c252[_0xd187('0x33')](_0x35c381||0x1f4)['send']({'message':_0x5728be?_0x5728be[_0xd187('0x34')]||_0x5728be:''});}exports[_0xd187('0x35')]=function(_0x4af59f,_0x1a6256,_0x1d6d97){passport['authenticate'](_0xd187('0x36'),function(_0x5ec6cd,_0x5f01b7,_0x26b06d){var _0x388569=_0x5ec6cd||_0x26b06d;if(_0x388569){return handleError(_0x1a6256,0x191,_0x388569);}if(!_0x5f01b7){return handleError(_0x1a6256,0x194,{'message':_0xd187('0x37')});}else{var _0x1a8f54={'payload':{'id':_0x5f01b7['id'],'role':_0x5f01b7[_0xd187('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1a8f54)[_0xd187('0xd')](function(_0xe090ad){_0x1a6256[_0xd187('0x38')]({'id':_0x5f01b7['id'],'token':_0xe090ad,'statusCall':'','isAlreadyLogged':_0x5f01b7['online']});});}})(_0x4af59f,_0x1a6256,_0x1d6d97);};exports['forgot']=function(_0x538c05,_0x595195,_0x21bb3c){if(!_0x538c05[_0xd187('0x39')][_0xd187('0x2d')]){return handleError(_0x595195,0x1f4,{'message':_0xd187('0x3a')});}var _0x13436d=rs[_0xd187('0x3b')]();_0x538c05[_0xd187('0x39')][_0xd187('0x2d')]=_0x538c05['body'][_0xd187('0x2d')][_0xd187('0x3c')]()[_0xd187('0x3d')]();var _0x51c7fc;return db[_0xd187('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd187('0xb'),_0xd187('0xc')],'raw':!![]})[_0xd187('0xd')](function(_0xb5322c){_0x51c7fc=_0xb5322c;return db[_0xd187('0x3e')]['find']({'where':{'email':_0x538c05[_0xd187('0x39')][_0xd187('0x2d')]}});})[_0xd187('0xd')](function(_0x3fa19c){if(!_0x3fa19c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3fa19c[_0xd187('0x12')]){throw new Error(_0xd187('0x3f'));}if(_0x3fa19c['blocked']){if(moment(_0x3fa19c[_0xd187('0x13')])[_0xd187('0x18')](_0x51c7fc['blockDuration'],'minutes')>moment()){throw new Error(_0xd187('0x40'));}else{_0x3fa19c[_0xd187('0x1c')]=![];_0x3fa19c['blockedAt']=null;}}_0x3fa19c['resetPasswordToken']=_0x13436d;_0x3fa19c['resetPasswordExpires']=Date[_0xd187('0x41')]()+0x36ee80;return _0x3fa19c[_0xd187('0x42')]();})[_0xd187('0xd')](function(){return sendServiceMail({'to':_0x538c05[_0xd187('0x39')][_0xd187('0x2d')],'subject':_0xd187('0x43'),'text':_0xd187('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xd187('0x45')+_0x538c05[_0xd187('0x46')][_0xd187('0x24')]+_0xd187('0x47')+_0x13436d+'\x0a\x0a'+_0xd187('0x48')});})[_0xd187('0xd')](function(){_0x595195[_0xd187('0x33')](0xc8)[_0xd187('0x49')]({'message':'Reset\x20Email\x20sent!'});})[_0xd187('0x1e')](function(_0x2657be){return handleError(_0x595195,0x1f4,_0x2657be);});};exports[_0xd187('0x4a')]=function(_0x1449d7,_0x36b99d,_0x5ad646){return db[_0xd187('0x3e')][_0xd187('0x20')]({'where':{'resetPasswordToken':_0x1449d7['params'][_0xd187('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xd187('0x41')]()}}})['then'](function(_0x59bf03){if(!_0x59bf03){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xd187('0xe')]({'attributes':['id',_0xd187('0x4c'),_0xd187('0x4d'),_0xd187('0x4e')]})[_0xd187('0xd')](function(_0xafc31){if(_0xafc31[_0xd187('0x4c')])authService['validatePasswordPattern'](_0x1449d7[_0xd187('0x39')][_0xd187('0x4f')]);if(!_0xafc31[_0xd187('0x4d')]||!_0x59bf03[_0xd187('0x50')])return _0x59bf03;authService['validatePasswordHistory'](_0x1449d7[_0xd187('0x39')]['password'],_0x59bf03['previousPasswords'],_0xafc31[_0xd187('0x4e')]);return _0x59bf03;})['then'](function(){_0x59bf03[_0xd187('0x4f')]=_0x1449d7[_0xd187('0x39')][_0xd187('0x4f')];_0x59bf03[_0xd187('0x51')]=null;_0x59bf03[_0xd187('0x52')]=null;return _0x59bf03[_0xd187('0x42')]();});})[_0xd187('0xd')](function(){_0x36b99d[_0xd187('0x33')](0xc8)[_0xd187('0x49')]({'message':'Password\x20reset!'});})[_0xd187('0x1e')](function(_0x298a34){return handleError(_0x36b99d,0x1f4,_0x298a34);});};passport['use'](new LocalStrategy({'usernameField':_0xd187('0xf'),'passwordField':_0xd187('0x4f')},function(_0x2de8ee,_0x57eaf5,_0x2b87fe){return localAuthenticate(db[_0xd187('0x3e')],_0x2de8ee,_0x57eaf5,_0x2b87fe);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a468e0e..84b25ff 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 _0x0d19=['reset','exports','./authLocal.controller','login','forgot','/reset/:token'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x0d19,0x188));var _0x90d1=function(_0x1c4b31,_0x33f926){_0x1c4b31=_0x1c4b31-0x0;var _0x429be1=_0x0d19[_0x1c4b31];return _0x429be1;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x90d1('0x0'));router['post']('/',controller[_0x90d1('0x1')]);router['post']('/forgot',controller[_0x90d1('0x2')]);router['post'](_0x90d1('0x3'),controller[_0x90d1('0x4')]);module[_0x90d1('0x5')]=router; \ No newline at end of file +var _0x5f7d=['post','/forgot','forgot','/reset/:token','express','Router','./authLocal.controller'];(function(_0xd5fe2d,_0x5248ca){var _0x1e11b4=function(_0xe4db33){while(--_0xe4db33){_0xd5fe2d['push'](_0xd5fe2d['shift']());}};_0x1e11b4(++_0x5248ca);}(_0x5f7d,0x6d));var _0xd5f7=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0x5f7d[_0x29e3b6];return _0x55d4b0;};'use strict';var express=require(_0xd5f7('0x0'));var router=express[_0xd5f7('0x1')]();var controller=require(_0xd5f7('0x2'));router[_0xd5f7('0x3')]('/',controller['login']);router[_0xd5f7('0x3')](_0xd5f7('0x4'),controller[_0xd5f7('0x5')]);router[_0xd5f7('0x3')](_0xd5f7('0x6'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5adb9f1..f28cda5 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 _0xd5e8=['BOOLEAN','INTEGER','STRING'];(function(_0x5c762d,_0x5a3553){var _0x6895d1=function(_0x3a792d){while(--_0x3a792d){_0x5c762d['push'](_0x5c762d['shift']());}};_0x6895d1(++_0x5a3553);}(_0xd5e8,0xb0));var _0x8d5e=function(_0x34e6ee,_0x26298e){_0x34e6ee=_0x34e6ee-0x0;var _0x1d925a=_0xd5e8[_0x34e6ee];return _0x1d925a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8d5e('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x8d5e('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8d5e('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0818=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x4c51f9,_0x3d56ed){var _0x441821=function(_0xe9582e){while(--_0xe9582e){_0x4c51f9['push'](_0x4c51f9['shift']());}};_0x441821(++_0x3d56ed);}(_0x0818,0x1e5));var _0x8081=function(_0x17d0ea,_0x4d9dcc){_0x17d0ea=_0x17d0ea-0x0;var _0x30cb3e=_0x0818[_0x17d0ea];return _0x30cb3e;};'use strict';var Sequelize=require(_0x8081('0x0'));module[_0x8081('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x8081('0x2')]},'description':{'type':Sequelize[_0x8081('0x2')]},'status':{'type':Sequelize[_0x8081('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8081('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 7cfa49f..07b6dd9 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(_0x480c44,_0x2af747){var _0x1bd9ad=function(_0x1bb13f){while(--_0x1bb13f){_0x480c44['push'](_0x480c44['shift']());}};_0x1bd9ad(++_0x2af747);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x1c61c0,_0x925552){var _0x161f1a=function(_0x4085fb){while(--_0x4085fb){_0x1c61c0['push'](_0x1c61c0['shift']());}};_0x161f1a(++_0x925552);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 ea19593..6210dd7 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 _0xd4c9=['rimraf','exports','define','Automation','tools_automations','lodash','util','moment','bluebird','path'];(function(_0x4876ab,_0x1e2131){var _0x203856=function(_0x1f5cae){while(--_0x1f5cae){_0x4876ab['push'](_0x4876ab['shift']());}};_0x203856(++_0x1e2131);}(_0xd4c9,0x1bd));var _0x9d4c=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xd4c9[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x9d4c('0x0'));var util=require(_0x9d4c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d4c('0x2'));var BPromise=require(_0x9d4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d4c('0x4'));var rimraf=require(_0x9d4c('0x5'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x9d4c('0x6')]=function(_0x11af20,_0x4ab37a){return _0x11af20[_0x9d4c('0x7')](_0x9d4c('0x8'),attributes,{'tableName':_0x9d4c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9deb=['request-promise','path','rimraf','./automation.attributes','exports','define','tools_automations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x939c4d,_0x370f46){var _0x1f3d78=function(_0x26d06b){while(--_0x26d06b){_0x939c4d['push'](_0x939c4d['shift']());}};_0x1f3d78(++_0x370f46);}(_0x9deb,0xdf));var _0xb9de=function(_0x224738,_0x44f8d0){_0x224738=_0x224738-0x0;var _0x469fb2=_0x9deb[_0x224738];return _0x469fb2;};'use strict';var _=require(_0xb9de('0x0'));var util=require(_0xb9de('0x1'));var logger=require(_0xb9de('0x2'))('api');var moment=require(_0xb9de('0x3'));var BPromise=require(_0xb9de('0x4'));var rp=require(_0xb9de('0x5'));var fs=require('fs');var path=require(_0xb9de('0x6'));var rimraf=require(_0xb9de('0x7'));var config=require('../../config/environment');var attributes=require(_0xb9de('0x8'));module[_0xb9de('0x9')]=function(_0x4b0637,_0x2706a0){return _0x4b0637[_0xb9de('0xa')]('Automation',attributes,{'tableName':_0xb9de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 305395e..84b3b9a 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 _0x250e=['request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http'];(function(_0x4b1583,_0x38ecf3){var _0x942f20=function(_0x1e7679){while(--_0x1e7679){_0x4b1583['push'](_0x4b1583['shift']());}};_0x942f20(++_0x38ecf3);}(_0x250e,0x15f));var _0xe250=function(_0x519c1e,_0x569372){_0x519c1e=_0x519c1e-0x0;var _0x3b6b94=_0x250e[_0x519c1e];return _0x3b6b94;};'use strict';var _=require(_0xe250('0x0'));var util=require('util');var moment=require(_0xe250('0x1'));var BPromise=require(_0xe250('0x2'));var rs=require(_0xe250('0x3'));var fs=require('fs');var Redis=require(_0xe250('0x4'));var db=require(_0xe250('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe250('0x6'));var client=jayson[_0xe250('0x7')][_0xe250('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c32a6,_0x12cc50,_0x25bdbb){return new BPromise(function(_0x48fc65,_0x17ca3a){return client[_0xe250('0x9')](_0x2c32a6,_0x25bdbb)[_0xe250('0xa')](function(_0x1c410a){logger['info'](_0xe250('0xb'),_0x12cc50,_0xe250('0xc'));logger[_0xe250('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x12cc50,_0xe250('0xc'),JSON['stringify'](_0x1c410a));if(_0x1c410a[_0xe250('0xe')]){if(_0x1c410a[_0xe250('0xe')][_0xe250('0xf')]===0x1f4){logger['error'](_0xe250('0xb'),_0x12cc50,_0x1c410a[_0xe250('0xe')][_0xe250('0x10')]);return _0x17ca3a(_0x1c410a[_0xe250('0xe')][_0xe250('0x10')]);}logger['error'](_0xe250('0xb'),_0x12cc50,_0x1c410a['error'][_0xe250('0x10')]);return _0x48fc65(_0x1c410a[_0xe250('0xe')][_0xe250('0x10')]);}else{logger[_0xe250('0x11')]('Automation,\x20%s,\x20%s',_0x12cc50,_0xe250('0xc'));_0x48fc65(_0x1c410a[_0xe250('0x12')][_0xe250('0x10')]);}})[_0xe250('0x13')](function(_0x3e78b7){logger[_0xe250('0xe')](_0xe250('0xb'),_0x12cc50,_0x3e78b7);_0x17ca3a(_0x3e78b7);});});} \ No newline at end of file +var _0xded2=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Automation,\x20%s,\x20%s'];(function(_0x43a877,_0xb1fea0){var _0x1da1e0=function(_0x23c78c){while(--_0x23c78c){_0x43a877['push'](_0x43a877['shift']());}};_0x1da1e0(++_0xb1fea0);}(_0xded2,0x1a0));var _0x2ded=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xded2[_0x233cb1];return _0x29ee7e;};'use strict';var _=require(_0x2ded('0x0'));var util=require(_0x2ded('0x1'));var moment=require(_0x2ded('0x2'));var BPromise=require(_0x2ded('0x3'));var rs=require(_0x2ded('0x4'));var fs=require('fs');var Redis=require(_0x2ded('0x5'));var db=require(_0x2ded('0x6'))['db'];var utils=require(_0x2ded('0x7'));var logger=require(_0x2ded('0x8'))(_0x2ded('0x9'));var config=require(_0x2ded('0xa'));var jayson=require(_0x2ded('0xb'));var client=jayson['client'][_0x2ded('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7cbc57,_0x5b200b,_0x2aa740){return new BPromise(function(_0x44a3fc,_0x11457a){return client[_0x2ded('0xd')](_0x7cbc57,_0x2aa740)['then'](function(_0x59c532){logger[_0x2ded('0xe')](_0x2ded('0xf'),_0x5b200b,_0x2ded('0x10'));logger[_0x2ded('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x5b200b,_0x2ded('0x10'),JSON[_0x2ded('0x12')](_0x59c532));if(_0x59c532[_0x2ded('0x13')]){if(_0x59c532[_0x2ded('0x13')][_0x2ded('0x14')]===0x1f4){logger[_0x2ded('0x13')]('Automation,\x20%s,\x20%s',_0x5b200b,_0x59c532['error'][_0x2ded('0x15')]);return _0x11457a(_0x59c532[_0x2ded('0x13')][_0x2ded('0x15')]);}logger[_0x2ded('0x13')]('Automation,\x20%s,\x20%s',_0x5b200b,_0x59c532['error'][_0x2ded('0x15')]);return _0x44a3fc(_0x59c532[_0x2ded('0x13')][_0x2ded('0x15')]);}else{logger[_0x2ded('0xe')](_0x2ded('0xf'),_0x5b200b,_0x2ded('0x10'));_0x44a3fc(_0x59c532[_0x2ded('0x16')][_0x2ded('0x15')]);}})[_0x2ded('0x17')](function(_0xea52df){logger[_0x2ded('0x13')](_0x2ded('0xf'),_0x5b200b,_0xea52df);_0x11457a(_0xea52df);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 455e453..1f06073 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 _0x3da7=['../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','show','getConditions','getActions','post','addConditions','/:id/actions','put','/:id','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x5e3fc7,_0x341090){var _0x23e6d6=function(_0x45d41b){while(--_0x45d41b){_0x5e3fc7['push'](_0x5e3fc7['shift']());}};_0x23e6d6(++_0x341090);}(_0x3da7,0xe2));var _0x73da=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x3da7[_0x2cc711];return _0x31a52e;};'use strict';var multer=require(_0x73da('0x0'));var util=require('util');var path=require(_0x73da('0x1'));var timeout=require(_0x73da('0x2'));var express=require(_0x73da('0x3'));var router=express[_0x73da('0x4')]();var auth=require(_0x73da('0x5'));var interaction=require(_0x73da('0x6'));var config=require('../../config/environment');var controller=require(_0x73da('0x7'));router[_0x73da('0x8')]('/',auth[_0x73da('0x9')](),controller[_0x73da('0xa')]);router[_0x73da('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x73da('0xb')]);router[_0x73da('0x8')]('/:id/conditions',auth[_0x73da('0x9')](),controller[_0x73da('0xc')]);router[_0x73da('0x8')]('/:id/actions',auth[_0x73da('0x9')](),controller[_0x73da('0xd')]);router[_0x73da('0xe')]('/',auth[_0x73da('0x9')](),controller['create']);router['post']('/:id/conditions',auth[_0x73da('0x9')](),controller[_0x73da('0xf')]);router[_0x73da('0xe')](_0x73da('0x10'),auth[_0x73da('0x9')](),controller['addActions']);router[_0x73da('0x11')](_0x73da('0x12'),auth[_0x73da('0x9')](),controller[_0x73da('0x13')]);router['delete']('/:id',auth[_0x73da('0x9')](),controller['destroy']);module[_0x73da('0x14')]=router; \ No newline at end of file +var _0x25e4=['index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x25e4,0xe8));var _0x425e=function(_0x3cdbad,_0x18d76a){_0x3cdbad=_0x3cdbad-0x0;var _0x1680e7=_0x25e4[_0x3cdbad];return _0x1680e7;};'use strict';var multer=require(_0x425e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x425e('0x1'));var express=require(_0x425e('0x2'));var router=express[_0x425e('0x3')]();var auth=require(_0x425e('0x4'));var interaction=require(_0x425e('0x5'));var config=require(_0x425e('0x6'));var controller=require(_0x425e('0x7'));router[_0x425e('0x8')]('/',auth[_0x425e('0x9')](),controller[_0x425e('0xa')]);router[_0x425e('0x8')](_0x425e('0xb'),auth[_0x425e('0x9')](),controller['show']);router[_0x425e('0x8')](_0x425e('0xc'),auth[_0x425e('0x9')](),controller[_0x425e('0xd')]);router[_0x425e('0x8')](_0x425e('0xe'),auth[_0x425e('0x9')](),controller[_0x425e('0xf')]);router[_0x425e('0x10')]('/',auth[_0x425e('0x9')](),controller['create']);router[_0x425e('0x10')](_0x425e('0xc'),auth[_0x425e('0x9')](),controller[_0x425e('0x11')]);router[_0x425e('0x10')](_0x425e('0xe'),auth[_0x425e('0x9')](),controller[_0x425e('0x12')]);router['put'](_0x425e('0xb'),auth['isAuthenticated'](),controller[_0x425e('0x13')]);router['delete']('/:id',auth[_0x425e('0x9')](),controller[_0x425e('0x14')]);module[_0x425e('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e2dd94f..ce7c16a 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 _0xd93b=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xd93b,0x1b2));var _0xbd93=function(_0x1ce201,_0x54b923){_0x1ce201=_0x1ce201-0x0;var _0x215c7f=_0xd93b[_0x1ce201];return _0x215c7f;};'use strict';var Sequelize=require(_0xbd93('0x0'));module[_0xbd93('0x1')]={'name':{'type':Sequelize[_0xbd93('0x2')],'unique':_0xbd93('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xbd93('0x4')](_0xbd93('0x5')),'allowNull':![],'defaultValue':_0xbd93('0x5')},'description':{'type':Sequelize[_0xbd93('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbd93('0x6')},'limitCalls':{'type':Sequelize[_0xbd93('0x7')](0x4)[_0xbd93('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xbd93('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbd93('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbd93('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd93('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd93('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd93('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd93('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd93('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbd93('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd93('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbd93('0x11')},'dialTimezone':{'type':Sequelize[_0xbd93('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbd93('0x2')],'defaultValue':_0xbd93('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xbd93('0x13'),_0xbd93('0x14')),'defaultValue':_0xbd93('0x15')},'dialAMDActive':{'type':Sequelize[_0xbd93('0x16')],'defaultValue':0x0,'comment':_0xbd93('0x17')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbd93('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xbd93('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbd93('0x7')](0x9)[_0xbd93('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbd93('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbd93('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xbd93('0x7')](0x9)[_0xbd93('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbd93('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbd93('0x7')](0x9)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbd93('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbd93('0x7')](0x5)[_0xbd93('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbd93('0x7')](0x9)[_0xbd93('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbd93('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbd93('0x4')](_0xbd93('0x1c'),_0xbd93('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xbd93('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd93('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd93('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xbd93('0x7')](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbd93('0x7')](0x3)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd93('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd93('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd93('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbd93('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd93('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd93('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd93('0x24')}}; \ No newline at end of file +var _0xbe09=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#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)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Greeting'];(function(_0x236176,_0x481dd3){var _0x2e8de7=function(_0x3612ab){while(--_0x3612ab){_0x236176['push'](_0x236176['shift']());}};_0x2e8de7(++_0x481dd3);}(_0xbe09,0x1a2));var _0x9be0=function(_0x2ed20e,_0x4d01c5){_0x2ed20e=_0x2ed20e-0x0;var _0x354003=_0xbe09[_0x2ed20e];return _0x354003;};'use strict';var Sequelize=require(_0x9be0('0x0'));module[_0x9be0('0x1')]={'name':{'type':Sequelize[_0x9be0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9be0('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9be0('0x2')]},'active':{'type':Sequelize[_0x9be0('0x4')],'defaultValue':0x0,'comment':_0x9be0('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x9be0('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9be0('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9be0('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9be0('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9be0('0x8')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9be0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9be0('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9be0('0x7')](0x3)[_0x9be0('0x6')],'defaultValue':0x3,'comment':_0x9be0('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9be0('0xb')},'dialTimezone':{'type':Sequelize[_0x9be0('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x9be0('0x3')](_0x9be0('0xc'),_0x9be0('0xd'),_0x9be0('0xe')),'defaultValue':_0x9be0('0xc')},'dialAMDActive':{'type':Sequelize[_0x9be0('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9be0('0x7')](0x9)[_0x9be0('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9be0('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9be0('0xf')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9be0('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9be0('0x10')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9be0('0x7')](0x9)[_0x9be0('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9be0('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9be0('0x11')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9be0('0x7')](0x9)[_0x9be0('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9be0('0x7')](0x9)[_0x9be0('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9be0('0x12')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9be0('0x7')](0x5)[_0x9be0('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9be0('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9be0('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9be0('0x14')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9be0('0x15'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x9be0('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9be0('0x7')](0x3)[_0x9be0('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9be0('0x16')},'dialCutDigit':{'type':Sequelize[_0x9be0('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9be0('0x17')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9be0('0x7')](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9be0('0x18')},'dialDropMaxRetry':{'type':Sequelize[_0x9be0('0x7')](0x3)[_0x9be0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9be0('0x19')},'dialDropRetryFrequency':{'type':Sequelize[_0x9be0('0x7')](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9be0('0x7')](0x3)[_0x9be0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9be0('0x1a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9be0('0x7')](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9be0('0x1b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9be0('0x1c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9be0('0x7')](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9be0('0x1d')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9be0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9be0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9be0('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3c1df1d..5de78d4 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 _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x35a6ac,_0x17b74c){var _0x454d9d=function(_0x1d45d1){while(--_0x1d45d1){_0x35a6ac['push'](_0x35a6ac['shift']());}};_0x454d9d(++_0x17b74c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x127f9e,_0x9660e2){var _0xcad26=function(_0x46a557){while(--_0x46a557){_0x127f9e['push'](_0x127f9e['shift']());}};_0xcad26(++_0x9660e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 8d06db4..b97a414 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 _0x8dc1=['lodash','util','moment','bluebird','request-promise','path','./campaign.attributes','Campaign','campaigns'];(function(_0x9dbcbb,_0x1c31e6){var _0x3dbbdb=function(_0x1d3356){while(--_0x1d3356){_0x9dbcbb['push'](_0x9dbcbb['shift']());}};_0x3dbbdb(++_0x1c31e6);}(_0x8dc1,0x90));var _0x18dc=function(_0xa60b4f,_0x5613a0){_0xa60b4f=_0xa60b4f-0x0;var _0x4f4e83=_0x8dc1[_0xa60b4f];return _0x4f4e83;};'use strict';var _=require(_0x18dc('0x0'));var util=require(_0x18dc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x18dc('0x2'));var BPromise=require(_0x18dc('0x3'));var rp=require(_0x18dc('0x4'));var fs=require('fs');var path=require(_0x18dc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x18dc('0x6'));module['exports']=function(_0x4a2174,_0xf52b64){return _0x4a2174['define'](_0x18dc('0x7'),attributes,{'tableName':_0x18dc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d8=['define','Campaign','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0xd6d8,0x1c4));var _0x8d6d=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xd6d8[_0x737a1f];return _0x16eba1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d6d('0x0'))(_0x8d6d('0x1'));var moment=require(_0x8d6d('0x2'));var BPromise=require(_0x8d6d('0x3'));var rp=require(_0x8d6d('0x4'));var fs=require('fs');var path=require(_0x8d6d('0x5'));var rimraf=require(_0x8d6d('0x6'));var config=require('../../config/environment');var attributes=require(_0x8d6d('0x7'));module['exports']=function(_0x2ab570,_0x128109){return _0x2ab570[_0x8d6d('0x8')](_0x8d6d('0x9'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 6a0dc8b..adcd1a9 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x524bf9,_0x47462b){var _0x550148=function(_0x1589b1){while(--_0x1589b1){_0x524bf9['push'](_0x524bf9['shift']());}};_0x550148(++_0x47462b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x2218c3,_0x156afe){var _0x1ab530=function(_0x4bab66){while(--_0x4bab66){_0x2218c3['push'](_0x2218c3['shift']());}};_0x1ab530(++_0x156afe);}(_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);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 36e1e2e..06a0e25 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 _0xa2cb=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','put','update','delete','removeLists','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks'];(function(_0x4109e7,_0x2c8158){var _0x28d807=function(_0x386518){while(--_0x386518){_0x4109e7['push'](_0x4109e7['shift']());}};_0x28d807(++_0x2c8158);}(_0xa2cb,0x1cd));var _0xba2c=function(_0x3cc91b,_0x250f20){_0x3cc91b=_0x3cc91b-0x0;var _0x1dafcc=_0xa2cb[_0x3cc91b];return _0x1dafcc;};'use strict';var multer=require('multer');var util=require(_0xba2c('0x0'));var path=require(_0xba2c('0x1'));var timeout=require(_0xba2c('0x2'));var express=require('express');var router=express[_0xba2c('0x3')]();var auth=require(_0xba2c('0x4'));var interaction=require(_0xba2c('0x5'));var config=require(_0xba2c('0x6'));var controller=require(_0xba2c('0x7'));router[_0xba2c('0x8')]('/',auth[_0xba2c('0x9')](),controller[_0xba2c('0xa')]);router[_0xba2c('0x8')](_0xba2c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xba2c('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xba2c('0xc')]);router[_0xba2c('0x8')](_0xba2c('0xd'),auth[_0xba2c('0x9')](),controller[_0xba2c('0xe')]);router[_0xba2c('0x8')](_0xba2c('0xf'),auth['isAuthenticated'](),controller[_0xba2c('0x10')]);router[_0xba2c('0x8')](_0xba2c('0x11'),auth[_0xba2c('0x9')](),controller[_0xba2c('0x12')]);router[_0xba2c('0x8')](_0xba2c('0x13'),auth['isAuthenticated'](),controller[_0xba2c('0x14')]);router['get'](_0xba2c('0x15'),auth['isAuthenticated'](),controller[_0xba2c('0x16')]);router[_0xba2c('0x17')]('/',auth[_0xba2c('0x9')](),controller[_0xba2c('0x18')]);router[_0xba2c('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0xba2c('0x19')]);router[_0xba2c('0x17')](_0xba2c('0x13'),auth['isAuthenticated'](),controller[_0xba2c('0x1a')]);router['post'](_0xba2c('0x15'),auth[_0xba2c('0x9')](),controller['addBlackLists']);router[_0xba2c('0x1b')](_0xba2c('0xb'),auth[_0xba2c('0x9')](),controller[_0xba2c('0x1c')]);router['delete'](_0xba2c('0xb'),auth[_0xba2c('0x9')](),controller['destroy']);router[_0xba2c('0x1d')](_0xba2c('0x13'),auth[_0xba2c('0x9')](),controller[_0xba2c('0x1e')]);router[_0xba2c('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xba2c('0x1f')]=router; \ No newline at end of file +var _0x38cd=['delete','/:id/lists','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','update','destroy'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x38cd,0x64));var _0xd38c=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x38cd[_0x3e3bee];return _0x3ae14c;};'use strict';var multer=require(_0xd38c('0x0'));var util=require(_0xd38c('0x1'));var path=require(_0xd38c('0x2'));var timeout=require(_0xd38c('0x3'));var express=require(_0xd38c('0x4'));var router=express[_0xd38c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd38c('0x6'));var config=require(_0xd38c('0x7'));var controller=require(_0xd38c('0x8'));router[_0xd38c('0x9')]('/',auth[_0xd38c('0xa')](),controller[_0xd38c('0xb')]);router[_0xd38c('0x9')](_0xd38c('0xc'),auth[_0xd38c('0xa')](),controller[_0xd38c('0xd')]);router[_0xd38c('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xd38c('0xe')]);router[_0xd38c('0x9')](_0xd38c('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xd38c('0x9')](_0xd38c('0x10'),auth[_0xd38c('0xa')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xd38c('0xa')](),controller[_0xd38c('0x11')]);router[_0xd38c('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0xd38c('0x12')]);router[_0xd38c('0x9')](_0xd38c('0x13'),auth[_0xd38c('0xa')](),controller[_0xd38c('0x14')]);router[_0xd38c('0x15')]('/',auth[_0xd38c('0xa')](),controller['create']);router[_0xd38c('0x15')](_0xd38c('0x16'),auth[_0xd38c('0xa')](),controller[_0xd38c('0x17')]);router[_0xd38c('0x15')]('/:id/lists',auth[_0xd38c('0xa')](),controller[_0xd38c('0x18')]);router[_0xd38c('0x15')]('/:id/blacklists',auth[_0xd38c('0xa')](),controller['addBlackLists']);router[_0xd38c('0x19')]('/:id',auth[_0xd38c('0xa')](),controller[_0xd38c('0x1a')]);router['delete'](_0xd38c('0xc'),auth[_0xd38c('0xa')](),controller[_0xd38c('0x1b')]);router[_0xd38c('0x1c')](_0xd38c('0x1d'),auth[_0xd38c('0xa')](),controller[_0xd38c('0x1e')]);router[_0xd38c('0x1c')]('/:id/blacklists',auth[_0xd38c('0xa')](),controller[_0xd38c('0x1f')]);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 ac61b3c..c88ef12 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 _0x8989=['exports','STRING','getDataValue','key'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8989,0x1ac));var _0x9898=function(_0x2fef13,_0x25b524){_0x2fef13=_0x2fef13-0x0;var _0x234164=_0x8989[_0x2fef13];return _0x234164;};'use strict';var Sequelize=require('sequelize');module[_0x9898('0x0')]={'key':{'type':Sequelize[_0x9898('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x9898('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9898('0x2')](_0x9898('0x3'));}}}; \ No newline at end of file +var _0x7ccc=['TEXT','getDataValue','key','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7ccc,0x9e));var _0xc7cc=function(_0x5769f2,_0x3f6c65){_0x5769f2=_0x5769f2-0x0;var _0xa1d08b=_0x7ccc[_0x5769f2];return _0xa1d08b;};'use strict';var Sequelize=require('sequelize');module[_0xc7cc('0x0')]={'key':{'type':Sequelize[_0xc7cc('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xc7cc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc7cc('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc7cc('0x3')](_0xc7cc('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7e5f0d6..18031d3 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2e09c9,_0x3c7baf){var _0x1c3e76=function(_0x31c6d0){while(--_0x31c6d0){_0x2e09c9['push'](_0x2e09c9['shift']());}};_0x1c3e76(++_0x3c7baf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ba2f86a..8ea8c94 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 _0x37b4=['moment','request-promise','path','rimraf','../../config/environment','define','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x111f4c,_0x56118c){var _0x5d3596=function(_0x5cccb3){while(--_0x5cccb3){_0x111f4c['push'](_0x111f4c['shift']());}};_0x5d3596(++_0x56118c);}(_0x37b4,0xef));var _0x437b=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x37b4[_0x1b8e60];return _0x363363;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var logger=require(_0x437b('0x1'))(_0x437b('0x2'));var moment=require(_0x437b('0x3'));var BPromise=require('bluebird');var rp=require(_0x437b('0x4'));var fs=require('fs');var path=require(_0x437b('0x5'));var rimraf=require(_0x437b('0x6'));var config=require(_0x437b('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x1bab79,_0x560099){return _0x1bab79[_0x437b('0x8')]('CannedAnswer',attributes,{'tableName':_0x437b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x437b('0xa')});}; \ No newline at end of file +var _0x3b43=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x3d7218,_0x5b64c0){var _0x151fe3=function(_0x5723bb){while(--_0x5723bb){_0x3d7218['push'](_0x3d7218['shift']());}};_0x151fe3(++_0x5b64c0);}(_0x3b43,0x71));var _0x33b4=function(_0x366ba8,_0x1189ad){_0x366ba8=_0x366ba8-0x0;var _0x1ac426=_0x3b43[_0x366ba8];return _0x1ac426;};'use strict';var _=require(_0x33b4('0x0'));var util=require(_0x33b4('0x1'));var logger=require(_0x33b4('0x2'))(_0x33b4('0x3'));var moment=require(_0x33b4('0x4'));var BPromise=require(_0x33b4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33b4('0x6'));var rimraf=require(_0x33b4('0x7'));var config=require('../../config/environment');var attributes=require(_0x33b4('0x8'));module['exports']=function(_0x28f32a,_0x53bb1c){return _0x28f32a[_0x33b4('0x9')](_0x33b4('0xa'),attributes,{'tableName':_0x33b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x33b4('0xc'),'collate':_0x33b4('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 754281f..9a561ad 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 _0x251d=['client','request','then','debug','request\x20sent','error','code','message','CannedAnswer,\x20%s,\x20%s','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x251d,0x1e7));var _0xd251=function(_0xa88305,_0x222df7){_0xa88305=_0xa88305-0x0;var _0x2a64d2=_0x251d[_0xa88305];return _0x2a64d2;};'use strict';var _=require('lodash');var util=require(_0xd251('0x0'));var moment=require(_0xd251('0x1'));var BPromise=require('bluebird');var rs=require(_0xd251('0x2'));var fs=require('fs');var Redis=require(_0xd251('0x3'));var db=require(_0xd251('0x4'))['db'];var utils=require(_0xd251('0x5'));var logger=require('../../config/logger')(_0xd251('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd251('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39f527,_0x501e75,_0x4dcd0b){return new BPromise(function(_0xefea41,_0x39194f){return client[_0xd251('0x8')](_0x39f527,_0x4dcd0b)[_0xd251('0x9')](function(_0x535f25){logger['info']('CannedAnswer,\x20%s,\x20%s',_0x501e75,'request\x20sent');logger[_0xd251('0xa')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x501e75,_0xd251('0xb'),JSON['stringify'](_0x535f25));if(_0x535f25[_0xd251('0xc')]){if(_0x535f25['error'][_0xd251('0xd')]===0x1f4){logger[_0xd251('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x501e75,_0x535f25[_0xd251('0xc')]['message']);return _0x39194f(_0x535f25['error'][_0xd251('0xe')]);}logger[_0xd251('0xc')](_0xd251('0xf'),_0x501e75,_0x535f25[_0xd251('0xc')]['message']);return _0xefea41(_0x535f25[_0xd251('0xc')][_0xd251('0xe')]);}else{logger[_0xd251('0x10')](_0xd251('0xf'),_0x501e75,_0xd251('0xb'));_0xefea41(_0x535f25[_0xd251('0x11')][_0xd251('0xe')]);}})[_0xd251('0x12')](function(_0x47d5cd){logger[_0xd251('0xc')](_0xd251('0xf'),_0x501e75,_0x47d5cd);_0x39194f(_0x47d5cd);});});} \ No newline at end of file +var _0x5ed9=['info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x37b519,_0x24b2ca){var _0x412276=function(_0xbe9cbb){while(--_0xbe9cbb){_0x37b519['push'](_0x37b519['shift']());}};_0x412276(++_0x24b2ca);}(_0x5ed9,0x1e6));var _0x95ed=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5ed9[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require(_0x95ed('0x2'));var BPromise=require(_0x95ed('0x3'));var rs=require(_0x95ed('0x4'));var fs=require('fs');var Redis=require(_0x95ed('0x5'));var db=require(_0x95ed('0x6'))['db'];var utils=require(_0x95ed('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ed('0x8'));var jayson=require(_0x95ed('0x9'));var client=jayson[_0x95ed('0xa')][_0x95ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3be6cf,_0x621449,_0x3af82c){return new BPromise(function(_0x16a0c2,_0x2e80f0){return client[_0x95ed('0xc')](_0x3be6cf,_0x3af82c)[_0x95ed('0xd')](function(_0x4b9366){logger[_0x95ed('0xe')](_0x95ed('0xf'),_0x621449,_0x95ed('0x10'));logger[_0x95ed('0x11')](_0x95ed('0x12'),_0x621449,_0x95ed('0x10'),JSON[_0x95ed('0x13')](_0x4b9366));if(_0x4b9366[_0x95ed('0x14')]){if(_0x4b9366[_0x95ed('0x14')][_0x95ed('0x15')]===0x1f4){logger[_0x95ed('0x14')]('CannedAnswer,\x20%s,\x20%s',_0x621449,_0x4b9366['error'][_0x95ed('0x16')]);return _0x2e80f0(_0x4b9366[_0x95ed('0x14')][_0x95ed('0x16')]);}logger[_0x95ed('0x14')](_0x95ed('0xf'),_0x621449,_0x4b9366[_0x95ed('0x14')][_0x95ed('0x16')]);return _0x16a0c2(_0x4b9366[_0x95ed('0x14')]['message']);}else{logger['info'](_0x95ed('0xf'),_0x621449,'request\x20sent');_0x16a0c2(_0x4b9366[_0x95ed('0x17')]['message']);}})[_0x95ed('0x18')](function(_0x4188f5){logger[_0x95ed('0x14')](_0x95ed('0xf'),_0x621449,_0x4188f5);_0x2e80f0(_0x4188f5);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index f97e550..a3f46c9 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 _0x3594=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3594,0x1f2));var _0x4359=function(_0x2b8bb1,_0xaa9fe4){_0x2b8bb1=_0x2b8bb1-0x0;var _0x13adcc=_0x3594[_0x2b8bb1];return _0x13adcc;};'use strict';var multer=require('multer');var util=require(_0x4359('0x0'));var path=require(_0x4359('0x1'));var timeout=require(_0x4359('0x2'));var express=require(_0x4359('0x3'));var router=express[_0x4359('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4359('0x5'));var config=require(_0x4359('0x6'));var controller=require(_0x4359('0x7'));router[_0x4359('0x8')]('/',auth[_0x4359('0x9')](),controller[_0x4359('0xa')]);router[_0x4359('0x8')](_0x4359('0xb'),auth['isAuthenticated'](),controller[_0x4359('0xc')]);router[_0x4359('0xd')]('/',auth[_0x4359('0x9')](),controller[_0x4359('0xe')]);router['put'](_0x4359('0xb'),auth[_0x4359('0x9')](),controller[_0x4359('0xf')]);router[_0x4359('0x10')](_0x4359('0xb'),auth[_0x4359('0x9')](),controller[_0x4359('0x11')]);module[_0x4359('0x12')]=router; \ No newline at end of file +var _0x1989=['express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer'];(function(_0x41c987,_0x50f6c6){var _0x580d56=function(_0x478092){while(--_0x478092){_0x41c987['push'](_0x41c987['shift']());}};_0x580d56(++_0x50f6c6);}(_0x1989,0x10f));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9198('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9198('0x1'));var router=express[_0x9198('0x2')]();var auth=require(_0x9198('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9198('0x4'));var controller=require(_0x9198('0x5'));router[_0x9198('0x6')]('/',auth[_0x9198('0x7')](),controller[_0x9198('0x8')]);router[_0x9198('0x6')](_0x9198('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9198('0xa')]('/',auth[_0x9198('0x7')](),controller[_0x9198('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9198('0xc')]);router[_0x9198('0xd')](_0x9198('0x9'),auth['isAuthenticated'](),controller[_0x9198('0xe')]);module[_0x9198('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ddaed7c..8e3fb97 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 _0x4b6f=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b6f,0x1f4));var _0xf4b6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4b6f[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xf4b6('0x0')]={'calldate':{'type':Sequelize[_0xf4b6('0x1')],'allowNull':![],'defaultValue':_0xf4b6('0x2')},'clid':{'type':Sequelize[_0xf4b6('0x3')]},'src':{'type':Sequelize[_0xf4b6('0x3')]},'dst':{'type':Sequelize[_0xf4b6('0x3')]},'dcontext':{'type':Sequelize[_0xf4b6('0x3')]},'channel':{'type':Sequelize[_0xf4b6('0x3')]},'dstchannel':{'type':Sequelize[_0xf4b6('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf4b6('0x3')]},'duration':{'type':Sequelize[_0xf4b6('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf4b6('0x3')]},'amaflags':{'type':Sequelize[_0xf4b6('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf4b6('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf4b6('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xf4b6('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf4b6('0x3')]}}; \ No newline at end of file +var _0x266a=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3eecee,_0x4f2db6){var _0x33b135=function(_0x4c2a2e){while(--_0x4c2a2e){_0x3eecee['push'](_0x3eecee['shift']());}};_0x33b135(++_0x4f2db6);}(_0x266a,0x124));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa266('0x0')]={'calldate':{'type':Sequelize[_0xa266('0x1')],'allowNull':![],'defaultValue':_0xa266('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xa266('0x3')]},'dst':{'type':Sequelize[_0xa266('0x3')]},'dcontext':{'type':Sequelize[_0xa266('0x3')]},'channel':{'type':Sequelize[_0xa266('0x3')]},'dstchannel':{'type':Sequelize[_0xa266('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xa266('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa266('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa266('0x3')]},'amaflags':{'type':Sequelize[_0xa266('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa266('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xa266('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 535535a..49cff4a 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 _0x78ed=['filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','include','rows','show','params','length','includeAll','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','error','stack','name','index','rawAttributes','fieldName','map','keys','query'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0x78ed,0x138));var _0xd78e=function(_0x1f2fa0,_0x32ccce){_0x1f2fa0=_0x1f2fa0-0x0;var _0x19da50=_0x78ed[_0x1f2fa0];return _0x19da50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd78e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd78e('0x1'));var jsonpatch=require(_0xd78e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd78e('0x3'));var Mustache=require(_0xd78e('0x4'));var util=require(_0xd78e('0x5'));var path=require(_0xd78e('0x6'));var sox=require(_0xd78e('0x7'));var csv=require(_0xd78e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd78e('0x9'));var squel=require(_0xd78e('0xa'));var crypto=require('crypto');var jsforce=require(_0xd78e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd78e('0x8'));var querystring=require(_0xd78e('0xc'));var Papa=require('papaparse');var Redis=require(_0xd78e('0xd'));var authService=require(_0xd78e('0xe'));var qs=require(_0xd78e('0xf'));var as=require(_0xd78e('0x10'));var hardwareService=require(_0xd78e('0x11'));var logger=require(_0xd78e('0x12'))(_0xd78e('0x13'));var utils=require(_0xd78e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd78e('0x15'));var db=require(_0xd78e('0x16'))['db'];function respondWithStatusCode(_0x4f9c62,_0x140995){_0x140995=_0x140995||0xcc;return function(_0x45685a){if(_0x45685a){return _0x4f9c62[_0xd78e('0x17')](_0x140995);}return _0x4f9c62[_0xd78e('0x18')](_0x140995)[_0xd78e('0x19')]();};}function respondWithResult(_0x10d4c3,_0x5bb66f){_0x5bb66f=_0x5bb66f||0xc8;return function(_0x1fb56f){if(_0x1fb56f){return _0x10d4c3[_0xd78e('0x18')](_0x5bb66f)[_0xd78e('0x1a')](_0x1fb56f);}};}function respondWithFilteredResult(_0x1522af,_0x495942){return function(_0x5a2ae4){if(_0x5a2ae4){var _0x171ec1=_0x5a2ae4[_0xd78e('0x1b')],_0x3f1d37=_0x495942[_0xd78e('0x1c')],_0x5e8b2b=_0x495942['offset']+_0x495942[_0xd78e('0x1d')],_0x4d643c;if(_0x5e8b2b>=_0x171ec1){_0x5e8b2b=_0x171ec1;_0x4d643c=0xc8;}else{_0x4d643c=0xce;}_0x1522af[_0xd78e('0x18')](_0x4d643c);return _0x1522af[_0xd78e('0x1e')]('Content-Range',_0x3f1d37+'-'+_0x5e8b2b+'/'+_0x171ec1)[_0xd78e('0x1a')](_0x5a2ae4);}return null;};}function patchUpdates(_0x495812){return function(_0x5861dd){try{jsonpatch['apply'](_0x5861dd,_0x495812,!![]);}catch(_0x473fa7){return BPromise[_0xd78e('0x1f')](_0x473fa7);}return _0x5861dd['save']();};}function saveUpdates(_0x442035,_0x318a2b){return function(_0x4b6dbd){if(_0x4b6dbd){return _0x4b6dbd['update'](_0x442035)[_0xd78e('0x20')](function(_0x40487b){return _0x40487b;});}return null;};}function removeEntity(_0x441044,_0x5a3fc3){return function(_0x30c1f3){if(_0x30c1f3){return _0x30c1f3[_0xd78e('0x21')]()[_0xd78e('0x20')](function(){_0x441044[_0xd78e('0x18')](0xcc)[_0xd78e('0x19')]();});}};}function handleEntityNotFound(_0x310231,_0xfce661){return function(_0x4cbb48){if(!_0x4cbb48){_0x310231[_0xd78e('0x17')](0x194);}return _0x4cbb48;};}function handleError(_0x44f4b7,_0x44405e){_0x44405e=_0x44405e||0x1f4;return function(_0x18dca2){logger[_0xd78e('0x22')](_0x18dca2[_0xd78e('0x23')]);if(_0x18dca2[_0xd78e('0x24')]){delete _0x18dca2[_0xd78e('0x24')];}_0x44f4b7['status'](_0x44405e)['send'](_0x18dca2);};}exports[_0xd78e('0x25')]=function(_0x421000,_0x1018b6){var _0x4651cc={},_0x43fb60={},_0x4a0e6e={'count':0x0,'rows':[]};var _0x211fc5=_['map'](db['Cdr'][_0xd78e('0x26')],function(_0x3feb3c){return{'name':_0x3feb3c[_0xd78e('0x27')],'type':_0x3feb3c['type']['key']};});_0x43fb60['model']=_[_0xd78e('0x28')](_0x211fc5,_0xd78e('0x24'));_0x43fb60['query']=_[_0xd78e('0x29')](_0x421000[_0xd78e('0x2a')]);_0x43fb60[_0xd78e('0x2b')]=_['intersection'](_0x43fb60[_0xd78e('0x2c')],_0x43fb60[_0xd78e('0x2a')]);_0x4651cc['attributes']=_[_0xd78e('0x2d')](_0x43fb60[_0xd78e('0x2c')],qs[_0xd78e('0x2e')](_0x421000[_0xd78e('0x2a')][_0xd78e('0x2e')]));_0x4651cc[_0xd78e('0x2f')]=_0x4651cc[_0xd78e('0x2f')]['length']?_0x4651cc[_0xd78e('0x2f')]:_0x43fb60[_0xd78e('0x2c')];if(!_0x421000[_0xd78e('0x2a')][_0xd78e('0x30')](_0xd78e('0x31'))){_0x4651cc[_0xd78e('0x1d')]=qs[_0xd78e('0x1d')](_0x421000[_0xd78e('0x2a')][_0xd78e('0x1d')]);_0x4651cc[_0xd78e('0x1c')]=qs['offset'](_0x421000[_0xd78e('0x2a')]['offset']);}_0x4651cc[_0xd78e('0x32')]=qs[_0xd78e('0x33')](_0x421000['query'][_0xd78e('0x33')]);_0x4651cc[_0xd78e('0x34')]=qs[_0xd78e('0x2b')](_[_0xd78e('0x35')](_0x421000[_0xd78e('0x2a')],_0x43fb60['filters']),_0x211fc5);if(_0x421000[_0xd78e('0x2a')]['filter']){_0x4651cc[_0xd78e('0x34')]=_[_0xd78e('0x36')](_0x4651cc['where'],{'$or':_[_0xd78e('0x28')](_0x211fc5,function(_0x38b8bb){if(_0x38b8bb['type']!==_0xd78e('0x37')){var _0x2e7c80={};_0x2e7c80[_0x38b8bb['name']]={'$like':'%'+_0x421000[_0xd78e('0x2a')][_0xd78e('0x38')]+'%'};return _0x2e7c80;}})});}_0x4651cc=_[_0xd78e('0x36')]({},_0x4651cc,_0x421000[_0xd78e('0x39')]);var _0x458214={'where':_0x4651cc[_0xd78e('0x34')]};return db[_0xd78e('0x3a')]['count'](_0x458214)[_0xd78e('0x20')](function(_0x4123de){_0x4a0e6e['count']=_0x4123de;if(_0x421000[_0xd78e('0x2a')]['includeAll']){_0x4651cc[_0xd78e('0x3b')]=[{'all':!![]}];}return db[_0xd78e('0x3a')]['findAll'](_0x4651cc);})['then'](function(_0x1c09a5){_0x4a0e6e[_0xd78e('0x3c')]=_0x1c09a5;return _0x4a0e6e;})[_0xd78e('0x20')](respondWithFilteredResult(_0x1018b6,_0x4651cc))['catch'](handleError(_0x1018b6,null));};exports[_0xd78e('0x3d')]=function(_0x145626,_0x12c614){var _0x525605={'raw':!![],'where':{'id':_0x145626[_0xd78e('0x3e')]['id']}},_0x1474d1={};_0x1474d1['model']=_['keys'](db[_0xd78e('0x3a')][_0xd78e('0x26')]);_0x1474d1[_0xd78e('0x2a')]=_[_0xd78e('0x29')](_0x145626[_0xd78e('0x2a')]);_0x1474d1[_0xd78e('0x2b')]=_[_0xd78e('0x2d')](_0x1474d1[_0xd78e('0x2c')],_0x1474d1[_0xd78e('0x2a')]);_0x525605[_0xd78e('0x2f')]=_['intersection'](_0x1474d1['model'],qs[_0xd78e('0x2e')](_0x145626[_0xd78e('0x2a')][_0xd78e('0x2e')]));_0x525605[_0xd78e('0x2f')]=_0x525605[_0xd78e('0x2f')][_0xd78e('0x3f')]?_0x525605[_0xd78e('0x2f')]:_0x1474d1['model'];if(_0x145626[_0xd78e('0x2a')][_0xd78e('0x40')]){_0x525605[_0xd78e('0x3b')]=[{'all':!![]}];}_0x525605=_[_0xd78e('0x36')]({},_0x525605,_0x145626[_0xd78e('0x39')]);return db['Cdr'][_0xd78e('0x41')](_0x525605)[_0xd78e('0x20')](handleEntityNotFound(_0x12c614,null))[_0xd78e('0x20')](respondWithResult(_0x12c614,null))[_0xd78e('0x42')](handleError(_0x12c614,null));};exports[_0xd78e('0x43')]=function(_0x1a0fd9,_0x4781c9){return db[_0xd78e('0x3a')][_0xd78e('0x43')](_0x1a0fd9[_0xd78e('0x44')],{})['then'](respondWithResult(_0x4781c9,0xc9))[_0xd78e('0x42')](handleError(_0x4781c9,null));};exports[_0xd78e('0x45')]=function(_0x5f342d,_0x27fe0d){if(_0x5f342d[_0xd78e('0x44')]['id']){delete _0x5f342d[_0xd78e('0x44')]['id'];}return db[_0xd78e('0x3a')][_0xd78e('0x41')]({'where':{'id':_0x5f342d[_0xd78e('0x3e')]['id']}})[_0xd78e('0x20')](handleEntityNotFound(_0x27fe0d,null))['then'](saveUpdates(_0x5f342d[_0xd78e('0x44')],null))['then'](respondWithResult(_0x27fe0d,null))[_0xd78e('0x42')](handleError(_0x27fe0d,null));};exports[_0xd78e('0x21')]=function(_0x2b4e35,_0x3a197a){return db['Cdr'][_0xd78e('0x41')]({'where':{'id':_0x2b4e35[_0xd78e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3a197a,null))[_0xd78e('0x20')](removeEntity(_0x3a197a,null))['catch'](handleError(_0x3a197a,null));};exports[_0xd78e('0x46')]=function(_0x47952b,_0x13e9c2){return db[_0xd78e('0x3a')][_0xd78e('0x46')]()[_0xd78e('0x20')](respondWithResult(_0x13e9c2,null))['catch'](handleError(_0x13e9c2,null));}; \ No newline at end of file +var _0x1777=['save','update','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','count','rows','catch','show','params','include','create','body','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject'];(function(_0x555aa5,_0x27ca0d){var _0xa50f7c=function(_0x381128){while(--_0x381128){_0x555aa5['push'](_0x555aa5['shift']());}};_0xa50f7c(++_0x27ca0d);}(_0x1777,0x19b));var _0x7177=function(_0xb42c59,_0x40bd73){_0xb42c59=_0xb42c59-0x0;var _0x580cff=_0x1777[_0xb42c59];return _0x580cff;};'use strict';var pdf=require(_0x7177('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7177('0x1'));var jsonpatch=require(_0x7177('0x2'));var rp=require(_0x7177('0x3'));var moment=require(_0x7177('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7177('0x5'));var util=require('util');var path=require(_0x7177('0x6'));var sox=require(_0x7177('0x7'));var csv=require(_0x7177('0x8'));var ejs=require(_0x7177('0x9'));var fs=require('fs');var _=require(_0x7177('0xa'));var squel=require(_0x7177('0xb'));var crypto=require(_0x7177('0xc'));var jsforce=require(_0x7177('0xd'));var deskjs=require(_0x7177('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7177('0xf'));var Redis=require(_0x7177('0x10'));var authService=require(_0x7177('0x11'));var qs=require(_0x7177('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7177('0x13'));var logger=require(_0x7177('0x14'))(_0x7177('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7177('0x16'));var db=require(_0x7177('0x17'))['db'];function respondWithStatusCode(_0x1fce95,_0x2ff49a){_0x2ff49a=_0x2ff49a||0xcc;return function(_0x3b39f8){if(_0x3b39f8){return _0x1fce95[_0x7177('0x18')](_0x2ff49a);}return _0x1fce95['status'](_0x2ff49a)[_0x7177('0x19')]();};}function respondWithResult(_0x3688eb,_0x1a4231){_0x1a4231=_0x1a4231||0xc8;return function(_0xe938c7){if(_0xe938c7){return _0x3688eb[_0x7177('0x1a')](_0x1a4231)[_0x7177('0x1b')](_0xe938c7);}};}function respondWithFilteredResult(_0x16df6f,_0x3972e3){return function(_0x5e8a3d){if(_0x5e8a3d){var _0xc4e2e3=_0x5e8a3d['count'],_0x9f3390=_0x3972e3['offset'],_0x1bbc43=_0x3972e3[_0x7177('0x1c')]+_0x3972e3[_0x7177('0x1d')],_0x5184af;if(_0x1bbc43>=_0xc4e2e3){_0x1bbc43=_0xc4e2e3;_0x5184af=0xc8;}else{_0x5184af=0xce;}_0x16df6f[_0x7177('0x1a')](_0x5184af);return _0x16df6f['set'](_0x7177('0x1e'),_0x9f3390+'-'+_0x1bbc43+'/'+_0xc4e2e3)[_0x7177('0x1b')](_0x5e8a3d);}return null;};}function patchUpdates(_0x20f0fd){return function(_0x34d794){try{jsonpatch[_0x7177('0x1f')](_0x34d794,_0x20f0fd,!![]);}catch(_0x4f70f9){return BPromise[_0x7177('0x20')](_0x4f70f9);}return _0x34d794[_0x7177('0x21')]();};}function saveUpdates(_0xd68586,_0x3ace90){return function(_0xd0d4f0){if(_0xd0d4f0){return _0xd0d4f0[_0x7177('0x22')](_0xd68586)[_0x7177('0x23')](function(_0x46734a){return _0x46734a;});}return null;};}function removeEntity(_0x4b8b03,_0x41cdbd){return function(_0x1797ca){if(_0x1797ca){return _0x1797ca[_0x7177('0x24')]()[_0x7177('0x23')](function(){_0x4b8b03[_0x7177('0x1a')](0xcc)[_0x7177('0x19')]();});}};}function handleEntityNotFound(_0x3b9935,_0x5e4d08){return function(_0x1686ca){if(!_0x1686ca){_0x3b9935[_0x7177('0x18')](0x194);}return _0x1686ca;};}function handleError(_0x21b4fc,_0x2cc036){_0x2cc036=_0x2cc036||0x1f4;return function(_0x21a8ae){logger[_0x7177('0x25')](_0x21a8ae[_0x7177('0x26')]);if(_0x21a8ae[_0x7177('0x27')]){delete _0x21a8ae[_0x7177('0x27')];}_0x21b4fc[_0x7177('0x1a')](_0x2cc036)[_0x7177('0x28')](_0x21a8ae);};}exports[_0x7177('0x29')]=function(_0x1d6640,_0x2a1c8b){var _0x31e464={},_0x5d607b={},_0x1c5f05={'count':0x0,'rows':[]};var _0x2acd3d=_['map'](db[_0x7177('0x2a')][_0x7177('0x2b')],function(_0x928a64){return{'name':_0x928a64[_0x7177('0x2c')],'type':_0x928a64['type'][_0x7177('0x2d')]};});_0x5d607b['model']=_[_0x7177('0x2e')](_0x2acd3d,'name');_0x5d607b[_0x7177('0x2f')]=_[_0x7177('0x30')](_0x1d6640[_0x7177('0x2f')]);_0x5d607b[_0x7177('0x31')]=_[_0x7177('0x32')](_0x5d607b[_0x7177('0x33')],_0x5d607b[_0x7177('0x2f')]);_0x31e464[_0x7177('0x34')]=_[_0x7177('0x32')](_0x5d607b[_0x7177('0x33')],qs[_0x7177('0x35')](_0x1d6640['query'][_0x7177('0x35')]));_0x31e464[_0x7177('0x34')]=_0x31e464['attributes'][_0x7177('0x36')]?_0x31e464[_0x7177('0x34')]:_0x5d607b[_0x7177('0x33')];if(!_0x1d6640[_0x7177('0x2f')][_0x7177('0x37')]('nolimit')){_0x31e464[_0x7177('0x1d')]=qs[_0x7177('0x1d')](_0x1d6640['query']['limit']);_0x31e464['offset']=qs[_0x7177('0x1c')](_0x1d6640['query'][_0x7177('0x1c')]);}_0x31e464[_0x7177('0x38')]=qs[_0x7177('0x39')](_0x1d6640['query'][_0x7177('0x39')]);_0x31e464['where']=qs['filters'](_['pick'](_0x1d6640[_0x7177('0x2f')],_0x5d607b['filters']),_0x2acd3d);if(_0x1d6640[_0x7177('0x2f')]['filter']){_0x31e464[_0x7177('0x3a')]=_[_0x7177('0x3b')](_0x31e464[_0x7177('0x3a')],{'$or':_['map'](_0x2acd3d,function(_0x1e4076){if(_0x1e4076[_0x7177('0x3c')]!==_0x7177('0x3d')){var _0x1d5113={};_0x1d5113[_0x1e4076['name']]={'$like':'%'+_0x1d6640[_0x7177('0x2f')][_0x7177('0x3e')]+'%'};return _0x1d5113;}})});}_0x31e464=_[_0x7177('0x3b')]({},_0x31e464,_0x1d6640[_0x7177('0x3f')]);var _0x56bc82={'where':_0x31e464[_0x7177('0x3a')]};return db[_0x7177('0x2a')][_0x7177('0x40')](_0x56bc82)[_0x7177('0x23')](function(_0x1b9777){_0x1c5f05[_0x7177('0x40')]=_0x1b9777;if(_0x1d6640['query']['includeAll']){_0x31e464['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x31e464);})['then'](function(_0x3e8aa3){_0x1c5f05[_0x7177('0x41')]=_0x3e8aa3;return _0x1c5f05;})[_0x7177('0x23')](respondWithFilteredResult(_0x2a1c8b,_0x31e464))[_0x7177('0x42')](handleError(_0x2a1c8b,null));};exports[_0x7177('0x43')]=function(_0x577d15,_0x4354bd){var _0x3a5c80={'raw':!![],'where':{'id':_0x577d15[_0x7177('0x44')]['id']}},_0x311a3f={};_0x311a3f['model']=_['keys'](db[_0x7177('0x2a')]['rawAttributes']);_0x311a3f[_0x7177('0x2f')]=_['keys'](_0x577d15[_0x7177('0x2f')]);_0x311a3f[_0x7177('0x31')]=_[_0x7177('0x32')](_0x311a3f['model'],_0x311a3f['query']);_0x3a5c80[_0x7177('0x34')]=_[_0x7177('0x32')](_0x311a3f[_0x7177('0x33')],qs[_0x7177('0x35')](_0x577d15[_0x7177('0x2f')][_0x7177('0x35')]));_0x3a5c80['attributes']=_0x3a5c80[_0x7177('0x34')]['length']?_0x3a5c80[_0x7177('0x34')]:_0x311a3f[_0x7177('0x33')];if(_0x577d15[_0x7177('0x2f')]['includeAll']){_0x3a5c80[_0x7177('0x45')]=[{'all':!![]}];}_0x3a5c80=_[_0x7177('0x3b')]({},_0x3a5c80,_0x577d15[_0x7177('0x3f')]);return db[_0x7177('0x2a')]['find'](_0x3a5c80)[_0x7177('0x23')](handleEntityNotFound(_0x4354bd,null))[_0x7177('0x23')](respondWithResult(_0x4354bd,null))['catch'](handleError(_0x4354bd,null));};exports['create']=function(_0x75df5a,_0x49e74f){return db['Cdr'][_0x7177('0x46')](_0x75df5a[_0x7177('0x47')],{})[_0x7177('0x23')](respondWithResult(_0x49e74f,0xc9))[_0x7177('0x42')](handleError(_0x49e74f,null));};exports['update']=function(_0x4ee871,_0x7a69a3){if(_0x4ee871['body']['id']){delete _0x4ee871[_0x7177('0x47')]['id'];}return db['Cdr']['find']({'where':{'id':_0x4ee871['params']['id']}})[_0x7177('0x23')](handleEntityNotFound(_0x7a69a3,null))['then'](saveUpdates(_0x4ee871['body'],null))[_0x7177('0x23')](respondWithResult(_0x7a69a3,null))[_0x7177('0x42')](handleError(_0x7a69a3,null));};exports[_0x7177('0x24')]=function(_0x1d7e34,_0x499e2a){return db[_0x7177('0x2a')][_0x7177('0x48')]({'where':{'id':_0x1d7e34[_0x7177('0x44')]['id']}})['then'](handleEntityNotFound(_0x499e2a,null))[_0x7177('0x23')](removeEntity(_0x499e2a,null))[_0x7177('0x42')](handleError(_0x499e2a,null));};exports[_0x7177('0x49')]=function(_0x3bdc01,_0x5c7e14){return db['Cdr'][_0x7177('0x49')]()['then'](respondWithResult(_0x5c7e14,null))['catch'](handleError(_0x5c7e14,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 456dadf..131854f 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 _0xdb28=['../../config/environment','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdb28,0x106));var _0x8db2=function(_0x210374,_0x2ee51e){_0x210374=_0x210374-0x0;var _0x4b2818=_0xdb28[_0x210374];return _0x4b2818;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./cdr.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'name':_0x8db2('0xc'),'fields':[_0x8db2('0xc')]},{'name':_0x8db2('0xd'),'fields':[_0x8db2('0xd')]},{'name':_0x8db2('0xe'),'fields':['disposition']},{'name':_0x8db2('0xf'),'fields':[_0x8db2('0xf')]},{'name':_0x8db2('0x10'),'fields':['src']},{'name':_0x8db2('0x11'),'fields':[_0x8db2('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash'];(function(_0x3818cd,_0x33cef5){var _0x4fc8f3=function(_0x2864a4){while(--_0x2864a4){_0x3818cd['push'](_0x3818cd['shift']());}};_0x4fc8f3(++_0x33cef5);}(_0x5496,0x175));var _0x6549=function(_0x354f04,_0x56cfed){_0x354f04=_0x354f04-0x0;var _0x253065=_0x5496[_0x354f04];return _0x253065;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('Cdr',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'calldate','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]},{'name':_0x6549('0xe'),'fields':[_0x6549('0xe')]},{'name':_0x6549('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x6549('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 5c5eb00..51de338 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 _0x969f=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0x969f,0x1e8));var _0xf969=function(_0x4d3681,_0x136f19){_0x4d3681=_0x4d3681-0x0;var _0x22c7ac=_0x969f[_0x4d3681];return _0x22c7ac;};'use strict';var _=require(_0xf969('0x0'));var util=require(_0xf969('0x1'));var moment=require(_0xf969('0x2'));var BPromise=require(_0xf969('0x3'));var rs=require(_0xf969('0x4'));var fs=require('fs');var Redis=require(_0xf969('0x5'));var db=require(_0xf969('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf969('0x7'));var config=require(_0xf969('0x8'));var jayson=require(_0xf969('0x9'));var client=jayson['client'][_0xf969('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c7e2c,_0x30c6f4,_0x712370){return new BPromise(function(_0x2556fb,_0x53534b){return client['request'](_0x2c7e2c,_0x712370)[_0xf969('0xb')](function(_0x12b178){logger[_0xf969('0xc')](_0xf969('0xd'),_0x30c6f4,'request\x20sent');logger['debug'](_0xf969('0xe'),_0x30c6f4,_0xf969('0xf'),JSON[_0xf969('0x10')](_0x12b178));if(_0x12b178[_0xf969('0x11')]){if(_0x12b178[_0xf969('0x11')][_0xf969('0x12')]===0x1f4){logger[_0xf969('0x11')](_0xf969('0xd'),_0x30c6f4,_0x12b178[_0xf969('0x11')][_0xf969('0x13')]);return _0x53534b(_0x12b178[_0xf969('0x11')][_0xf969('0x13')]);}logger[_0xf969('0x11')]('Cdr,\x20%s,\x20%s',_0x30c6f4,_0x12b178[_0xf969('0x11')][_0xf969('0x13')]);return _0x2556fb(_0x12b178[_0xf969('0x11')][_0xf969('0x13')]);}else{logger[_0xf969('0xc')](_0xf969('0xd'),_0x30c6f4,_0xf969('0xf'));_0x2556fb(_0x12b178['result'][_0xf969('0x13')]);}})[_0xf969('0x14')](function(_0x43b9fe){logger[_0xf969('0x11')]('Cdr,\x20%s,\x20%s',_0x30c6f4,_0x43b9fe);_0x53534b(_0x43b9fe);});});} \ No newline at end of file +var _0x41b6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2e22b4,_0x18a987){var _0x45f55a=function(_0x124c31){while(--_0x124c31){_0x2e22b4['push'](_0x2e22b4['shift']());}};_0x45f55a(++_0x18a987);}(_0x41b6,0xf1));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x641b('0x0'));var util=require(_0x641b('0x1'));var moment=require(_0x641b('0x2'));var BPromise=require(_0x641b('0x3'));var rs=require(_0x641b('0x4'));var fs=require('fs');var Redis=require(_0x641b('0x5'));var db=require(_0x641b('0x6'))['db'];var utils=require(_0x641b('0x7'));var logger=require('../../config/logger')(_0x641b('0x8'));var config=require(_0x641b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x641b('0xa')][_0x641b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ed404,_0x27ea69,_0x4413fe){return new BPromise(function(_0x2e94f7,_0xdd5003){return client[_0x641b('0xc')](_0x4ed404,_0x4413fe)[_0x641b('0xd')](function(_0x3eaffd){logger['info'](_0x641b('0xe'),_0x27ea69,_0x641b('0xf'));logger[_0x641b('0x10')](_0x641b('0x11'),_0x27ea69,_0x641b('0xf'),JSON[_0x641b('0x12')](_0x3eaffd));if(_0x3eaffd[_0x641b('0x13')]){if(_0x3eaffd['error'][_0x641b('0x14')]===0x1f4){logger[_0x641b('0x13')](_0x641b('0xe'),_0x27ea69,_0x3eaffd[_0x641b('0x13')][_0x641b('0x15')]);return _0xdd5003(_0x3eaffd[_0x641b('0x13')][_0x641b('0x15')]);}logger[_0x641b('0x13')](_0x641b('0xe'),_0x27ea69,_0x3eaffd[_0x641b('0x13')][_0x641b('0x15')]);return _0x2e94f7(_0x3eaffd[_0x641b('0x13')][_0x641b('0x15')]);}else{logger[_0x641b('0x16')](_0x641b('0xe'),_0x27ea69,_0x641b('0xf'));_0x2e94f7(_0x3eaffd['result'][_0x641b('0x15')]);}})[_0x641b('0x17')](function(_0x38ad31){logger[_0x641b('0x13')](_0x641b('0xe'),_0x27ea69,_0x38ad31);_0xdd5003(_0x38ad31);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3c42d32..0ff6a11 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 _0xb5d4=['isAuthenticated','index','describe','show','post','create','/:id','update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xb5d4,0xd0));var _0x4b5d=function(_0x24e05a,_0x36cf4f){_0x24e05a=_0x24e05a-0x0;var _0x21c536=_0xb5d4[_0x24e05a];return _0x21c536;};'use strict';var multer=require(_0x4b5d('0x0'));var util=require('util');var path=require(_0x4b5d('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b5d('0x2'));var router=express['Router']();var auth=require(_0x4b5d('0x3'));var interaction=require(_0x4b5d('0x4'));var config=require(_0x4b5d('0x5'));var controller=require(_0x4b5d('0x6'));router[_0x4b5d('0x7')]('/',auth[_0x4b5d('0x8')](),controller[_0x4b5d('0x9')]);router[_0x4b5d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4b5d('0xa')]);router[_0x4b5d('0x7')]('/:id',auth[_0x4b5d('0x8')](),controller[_0x4b5d('0xb')]);router[_0x4b5d('0xc')]('/',auth[_0x4b5d('0x8')](),controller[_0x4b5d('0xd')]);router['put'](_0x4b5d('0xe'),auth['isAuthenticated'](),controller[_0x4b5d('0xf')]);router[_0x4b5d('0x10')](_0x4b5d('0xe'),auth['isAuthenticated'](),controller[_0x4b5d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3514=['get','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./cdr.controller','isAuthenticated','index'];(function(_0x10aa42,_0x230a38){var _0x24090c=function(_0xc884bb){while(--_0xc884bb){_0x10aa42['push'](_0x10aa42['shift']());}};_0x24090c(++_0x230a38);}(_0x3514,0xdb));var _0x4351=function(_0x553fcd,_0x321293){_0x553fcd=_0x553fcd-0x0;var _0x52af1a=_0x3514[_0x553fcd];return _0x52af1a;};'use strict';var multer=require(_0x4351('0x0'));var util=require(_0x4351('0x1'));var path=require(_0x4351('0x2'));var timeout=require(_0x4351('0x3'));var express=require(_0x4351('0x4'));var router=express[_0x4351('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4351('0x6'));router['get']('/',auth[_0x4351('0x7')](),controller[_0x4351('0x8')]);router[_0x4351('0x9')](_0x4351('0xa'),auth[_0x4351('0x7')](),controller[_0x4351('0xb')]);router['get'](_0x4351('0xc'),auth[_0x4351('0x7')](),controller[_0x4351('0xd')]);router[_0x4351('0xe')]('/',auth[_0x4351('0x7')](),controller['create']);router[_0x4351('0xf')](_0x4351('0xc'),auth[_0x4351('0x7')](),controller['update']);router[_0x4351('0x10')](_0x4351('0xc'),auth['isAuthenticated'](),controller[_0x4351('0x11')]);module[_0x4351('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 3202559..4d0749a 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 _0xa268=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2351c7,_0x3c3505){var _0x24ce8c=function(_0x68aec5){while(--_0x68aec5){_0x2351c7['push'](_0x2351c7['shift']());}};_0x24ce8c(++_0x3c3505);}(_0xa268,0xd2));var _0x8a26=function(_0x19d0c0,_0x24bf75){_0x19d0c0=_0x19d0c0-0x0;var _0x5e9077=_0xa268[_0x19d0c0];return _0x5e9077;};'use strict';var Sequelize=require(_0x8a26('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8a26('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8a26('0x2')],'allowNull':![],'defaultValue':_0x8a26('0x3')},'appdata':{'type':Sequelize[_0x8a26('0x4')]()},'description':{'type':Sequelize[_0x8a26('0x2')]},'interval':{'type':Sequelize[_0x8a26('0x2')],'defaultValue':_0x8a26('0x5')}}; \ No newline at end of file +var _0x0a14=['STRING','noop','sequelize'];(function(_0x4cc280,_0x3b77f3){var _0x16ed24=function(_0x473e10){while(--_0x473e10){_0x4cc280['push'](_0x4cc280['shift']());}};_0x16ed24(++_0x3b77f3);}(_0x0a14,0x1b8));var _0x40a1=function(_0x2bdc10,_0x99bced){_0x2bdc10=_0x2bdc10-0x0;var _0x2e1d1e=_0x0a14[_0x2bdc10];return _0x2e1d1e;};'use strict';var Sequelize=require(_0x40a1('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x40a1('0x1')],'allowNull':![],'defaultValue':_0x40a1('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x40a1('0x1')]},'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 931ccd6..7c9999e 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 _0x90ec=['show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x3e1645,_0x2214ae){var _0x423faf=function(_0x57417d){while(--_0x57417d){_0x3e1645['push'](_0x3e1645['shift']());}};_0x423faf(++_0x2214ae);}(_0x90ec,0x1d9));var _0xc90e=function(_0x12ccc1,_0x1f0f84){_0x12ccc1=_0x12ccc1-0x0;var _0x58ca0c=_0x90ec[_0x12ccc1];return _0x58ca0c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc90e('0x0'));var rimraf=require(_0xc90e('0x1'));var zipdir=require(_0xc90e('0x2'));var jsonpatch=require(_0xc90e('0x3'));var rp=require(_0xc90e('0x4'));var moment=require(_0xc90e('0x5'));var BPromise=require(_0xc90e('0x6'));var Mustache=require(_0xc90e('0x7'));var util=require(_0xc90e('0x8'));var path=require(_0xc90e('0x9'));var sox=require(_0xc90e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc90e('0xb'));var squel=require(_0xc90e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc90e('0xd'));var deskjs=require(_0xc90e('0xe'));var toCsv=require(_0xc90e('0xf'));var querystring=require(_0xc90e('0x10'));var Papa=require('papaparse');var Redis=require(_0xc90e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc90e('0x12'));var as=require(_0xc90e('0x13'));var hardwareService=require(_0xc90e('0x14'));var logger=require(_0xc90e('0x15'))(_0xc90e('0x16'));var utils=require('../../config/utils');var config=require(_0xc90e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc90e('0x18'))['db'];function respondWithStatusCode(_0x5dcd1f,_0x464632){_0x464632=_0x464632||0xcc;return function(_0x55e29c){if(_0x55e29c){return _0x5dcd1f[_0xc90e('0x19')](_0x464632);}return _0x5dcd1f[_0xc90e('0x1a')](_0x464632)['end']();};}function respondWithResult(_0x17814d,_0x4cc5d1){_0x4cc5d1=_0x4cc5d1||0xc8;return function(_0x1d69bb){if(_0x1d69bb){return _0x17814d[_0xc90e('0x1a')](_0x4cc5d1)[_0xc90e('0x1b')](_0x1d69bb);}};}function respondWithFilteredResult(_0x802bce,_0x29be54){return function(_0x2bc121){if(_0x2bc121){var _0x1ea2f8=_0x2bc121['count'],_0x954817=_0x29be54[_0xc90e('0x1c')],_0x4a7750=_0x29be54[_0xc90e('0x1c')]+_0x29be54['limit'],_0x1cea63;if(_0x4a7750>=_0x1ea2f8){_0x4a7750=_0x1ea2f8;_0x1cea63=0xc8;}else{_0x1cea63=0xce;}_0x802bce[_0xc90e('0x1a')](_0x1cea63);return _0x802bce[_0xc90e('0x1d')](_0xc90e('0x1e'),_0x954817+'-'+_0x4a7750+'/'+_0x1ea2f8)['json'](_0x2bc121);}return null;};}function patchUpdates(_0x49274d){return function(_0x329c31){try{jsonpatch[_0xc90e('0x1f')](_0x329c31,_0x49274d,!![]);}catch(_0x5bd1de){return BPromise[_0xc90e('0x20')](_0x5bd1de);}return _0x329c31[_0xc90e('0x21')]();};}function saveUpdates(_0x3698d9,_0x3d7658){return function(_0x35ca0c){if(_0x35ca0c){return _0x35ca0c[_0xc90e('0x22')](_0x3698d9)[_0xc90e('0x23')](function(_0x298f20){return _0x298f20;});}return null;};}function removeEntity(_0x414381,_0x1a37db){return function(_0x3965fd){if(_0x3965fd){return _0x3965fd[_0xc90e('0x24')]()['then'](function(){_0x414381[_0xc90e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x891385,_0x2e98ac){return function(_0x34e0ec){if(!_0x34e0ec){_0x891385['sendStatus'](0x194);}return _0x34e0ec;};}function handleError(_0x2de970,_0x286967){_0x286967=_0x286967||0x1f4;return function(_0x4a56e0){logger[_0xc90e('0x25')](_0x4a56e0[_0xc90e('0x26')]);if(_0x4a56e0['name']){delete _0x4a56e0[_0xc90e('0x27')];}_0x2de970[_0xc90e('0x1a')](_0x286967)['send'](_0x4a56e0);};}exports[_0xc90e('0x28')]=function(_0x56138a,_0x8500ce){var _0x532ad5={'raw':!![],'where':{'id':_0x56138a[_0xc90e('0x29')]['id']}},_0x366b0c={};_0x366b0c[_0xc90e('0x2a')]=_[_0xc90e('0x2b')](db[_0xc90e('0x2c')][_0xc90e('0x2d')]);_0x366b0c['query']=_['keys'](_0x56138a[_0xc90e('0x2e')]);_0x366b0c['filters']=_[_0xc90e('0x2f')](_0x366b0c[_0xc90e('0x2a')],_0x366b0c[_0xc90e('0x2e')]);_0x532ad5[_0xc90e('0x30')]=_[_0xc90e('0x2f')](_0x366b0c[_0xc90e('0x2a')],qs[_0xc90e('0x31')](_0x56138a[_0xc90e('0x2e')][_0xc90e('0x31')]));_0x532ad5['attributes']=_0x532ad5[_0xc90e('0x30')][_0xc90e('0x32')]?_0x532ad5[_0xc90e('0x30')]:_0x366b0c[_0xc90e('0x2a')];if(_0x56138a['query']['includeAll']){_0x532ad5[_0xc90e('0x33')]=[{'all':!![]}];}_0x532ad5=_[_0xc90e('0x34')]({},_0x532ad5,_0x56138a[_0xc90e('0x35')]);return db[_0xc90e('0x2c')][_0xc90e('0x36')](_0x532ad5)[_0xc90e('0x23')](handleEntityNotFound(_0x8500ce,null))[_0xc90e('0x23')](respondWithResult(_0x8500ce,null))['catch'](handleError(_0x8500ce,null));};exports['update']=function(_0x591cd1,_0x49933e){if(_0x591cd1['body']['id']){delete _0x591cd1[_0xc90e('0x37')]['id'];}return db[_0xc90e('0x2c')][_0xc90e('0x36')]({'where':{'id':_0x591cd1[_0xc90e('0x29')]['id']}})['then'](handleEntityNotFound(_0x49933e,null))[_0xc90e('0x23')](saveUpdates(_0x591cd1[_0xc90e('0x37')],null))['then'](respondWithResult(_0x49933e,null))[_0xc90e('0x38')](handleError(_0x49933e,null));};exports[_0xc90e('0x24')]=function(_0x5f3758,_0x104709){return db[_0xc90e('0x2c')][_0xc90e('0x36')]({'where':{'id':_0x5f3758[_0xc90e('0x29')]['id']}})[_0xc90e('0x23')](handleEntityNotFound(_0x104709,null))[_0xc90e('0x23')](removeEntity(_0x104709,null))[_0xc90e('0x38')](handleError(_0x104709,null));}; \ No newline at end of file +var _0xe380=['name','send','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','options','ChatApplication','catch','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x23b3e0,_0x802d57){var _0x122558=function(_0x30e430){while(--_0x30e430){_0x23b3e0['push'](_0x23b3e0['shift']());}};_0x122558(++_0x802d57);}(_0xe380,0x7d));var _0x0e38=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe380[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x0e38('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e38('0x1'));var zipdir=require(_0x0e38('0x2'));var jsonpatch=require(_0x0e38('0x3'));var rp=require(_0x0e38('0x4'));var moment=require(_0x0e38('0x5'));var BPromise=require(_0x0e38('0x6'));var Mustache=require(_0x0e38('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0e38('0x8'));var csv=require('to-csv');var ejs=require(_0x0e38('0x9'));var fs=require('fs');var _=require(_0x0e38('0xa'));var squel=require(_0x0e38('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e38('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0e38('0xd'));var querystring=require(_0x0e38('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e38('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e38('0x10'));var as=require(_0x0e38('0x11'));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(_0x0e38('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb62c34,_0x2aac16){_0x2aac16=_0x2aac16||0xcc;return function(_0x3afefe){if(_0x3afefe){return _0xb62c34['sendStatus'](_0x2aac16);}return _0xb62c34[_0x0e38('0x13')](_0x2aac16)[_0x0e38('0x14')]();};}function respondWithResult(_0x2188c9,_0x2c0b23){_0x2c0b23=_0x2c0b23||0xc8;return function(_0x5c781c){if(_0x5c781c){return _0x2188c9[_0x0e38('0x13')](_0x2c0b23)[_0x0e38('0x15')](_0x5c781c);}};}function respondWithFilteredResult(_0x28fd53,_0x46c4e2){return function(_0xc4ada7){if(_0xc4ada7){var _0xdb375e=_0xc4ada7['count'],_0x3a1da6=_0x46c4e2['offset'],_0x237409=_0x46c4e2[_0x0e38('0x16')]+_0x46c4e2[_0x0e38('0x17')],_0x1da310;if(_0x237409>=_0xdb375e){_0x237409=_0xdb375e;_0x1da310=0xc8;}else{_0x1da310=0xce;}_0x28fd53[_0x0e38('0x13')](_0x1da310);return _0x28fd53[_0x0e38('0x18')](_0x0e38('0x19'),_0x3a1da6+'-'+_0x237409+'/'+_0xdb375e)[_0x0e38('0x15')](_0xc4ada7);}return null;};}function patchUpdates(_0x3b094a){return function(_0x52be70){try{jsonpatch[_0x0e38('0x1a')](_0x52be70,_0x3b094a,!![]);}catch(_0x4826ff){return BPromise[_0x0e38('0x1b')](_0x4826ff);}return _0x52be70[_0x0e38('0x1c')]();};}function saveUpdates(_0x577d8f,_0x1b9189){return function(_0x5f04cf){if(_0x5f04cf){return _0x5f04cf[_0x0e38('0x1d')](_0x577d8f)[_0x0e38('0x1e')](function(_0x23af7a){return _0x23af7a;});}return null;};}function removeEntity(_0xda9c24,_0x453165){return function(_0x1c4ff4){if(_0x1c4ff4){return _0x1c4ff4[_0x0e38('0x1f')]()['then'](function(){_0xda9c24['status'](0xcc)[_0x0e38('0x14')]();});}};}function handleEntityNotFound(_0x1bd09a,_0xee88da){return function(_0xafd20b){if(!_0xafd20b){_0x1bd09a['sendStatus'](0x194);}return _0xafd20b;};}function handleError(_0x47c36b,_0x677b9b){_0x677b9b=_0x677b9b||0x1f4;return function(_0x12044f){logger[_0x0e38('0x20')](_0x12044f[_0x0e38('0x21')]);if(_0x12044f[_0x0e38('0x22')]){delete _0x12044f[_0x0e38('0x22')];}_0x47c36b['status'](_0x677b9b)[_0x0e38('0x23')](_0x12044f);};}exports['show']=function(_0x393bf1,_0x28f688){var _0x36ff56={'raw':!![],'where':{'id':_0x393bf1[_0x0e38('0x24')]['id']}},_0x10fc15={};_0x10fc15[_0x0e38('0x25')]=_[_0x0e38('0x26')](db['ChatApplication'][_0x0e38('0x27')]);_0x10fc15[_0x0e38('0x28')]=_[_0x0e38('0x26')](_0x393bf1['query']);_0x10fc15[_0x0e38('0x29')]=_['intersection'](_0x10fc15[_0x0e38('0x25')],_0x10fc15['query']);_0x36ff56[_0x0e38('0x2a')]=_['intersection'](_0x10fc15['model'],qs[_0x0e38('0x2b')](_0x393bf1['query']['fields']));_0x36ff56['attributes']=_0x36ff56[_0x0e38('0x2a')][_0x0e38('0x2c')]?_0x36ff56['attributes']:_0x10fc15['model'];if(_0x393bf1[_0x0e38('0x28')][_0x0e38('0x2d')]){_0x36ff56[_0x0e38('0x2e')]=[{'all':!![]}];}_0x36ff56=_[_0x0e38('0x2f')]({},_0x36ff56,_0x393bf1[_0x0e38('0x30')]);return db[_0x0e38('0x31')]['find'](_0x36ff56)[_0x0e38('0x1e')](handleEntityNotFound(_0x28f688,null))['then'](respondWithResult(_0x28f688,null))[_0x0e38('0x32')](handleError(_0x28f688,null));};exports[_0x0e38('0x1d')]=function(_0x2600d2,_0x8f96b6){if(_0x2600d2[_0x0e38('0x33')]['id']){delete _0x2600d2['body']['id'];}return db[_0x0e38('0x31')][_0x0e38('0x34')]({'where':{'id':_0x2600d2[_0x0e38('0x24')]['id']}})[_0x0e38('0x1e')](handleEntityNotFound(_0x8f96b6,null))[_0x0e38('0x1e')](saveUpdates(_0x2600d2[_0x0e38('0x33')],null))[_0x0e38('0x1e')](respondWithResult(_0x8f96b6,null))['catch'](handleError(_0x8f96b6,null));};exports[_0x0e38('0x1f')]=function(_0x36d831,_0x51443b){return db[_0x0e38('0x31')][_0x0e38('0x34')]({'where':{'id':_0x36d831[_0x0e38('0x24')]['id']}})[_0x0e38('0x1e')](handleEntityNotFound(_0x51443b,null))[_0x0e38('0x1e')](removeEntity(_0x51443b,null))[_0x0e38('0x32')](handleError(_0x51443b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7defb20..f45bc4b 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 390a8bb..ddf3157 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 _0x7aca=['message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7aca,0x67));var _0xa7ac=function(_0x2cf3e4,_0x50ff08){_0x2cf3e4=_0x2cf3e4-0x0;var _0x377352=_0x7aca[_0x2cf3e4];return _0x377352;};'use strict';var _=require(_0xa7ac('0x0'));var util=require(_0xa7ac('0x1'));var moment=require('moment');var BPromise=require(_0xa7ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7ac('0x3'));var db=require(_0xa7ac('0x4'))['db'];var utils=require(_0xa7ac('0x5'));var logger=require('../../config/logger')(_0xa7ac('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7ac('0x7'));var client=jayson['client'][_0xa7ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ad2a2,_0x34a266,_0xa3e230){return new BPromise(function(_0x2dea8f,_0x3d0fe2){return client[_0xa7ac('0x9')](_0x4ad2a2,_0xa3e230)['then'](function(_0x582795){logger[_0xa7ac('0xa')](_0xa7ac('0xb'),_0x34a266,'request\x20sent');logger['debug'](_0xa7ac('0xc'),_0x34a266,_0xa7ac('0xd'),JSON['stringify'](_0x582795));if(_0x582795[_0xa7ac('0xe')]){if(_0x582795[_0xa7ac('0xe')][_0xa7ac('0xf')]===0x1f4){logger[_0xa7ac('0xe')](_0xa7ac('0xb'),_0x34a266,_0x582795[_0xa7ac('0xe')][_0xa7ac('0x10')]);return _0x3d0fe2(_0x582795[_0xa7ac('0xe')]['message']);}logger[_0xa7ac('0xe')]('ChatApplication,\x20%s,\x20%s',_0x34a266,_0x582795[_0xa7ac('0xe')][_0xa7ac('0x10')]);return _0x2dea8f(_0x582795[_0xa7ac('0xe')][_0xa7ac('0x10')]);}else{logger[_0xa7ac('0xa')]('ChatApplication,\x20%s,\x20%s',_0x34a266,_0xa7ac('0xd'));_0x2dea8f(_0x582795['result']['message']);}})['catch'](function(_0x180376){logger[_0xa7ac('0xe')](_0xa7ac('0xb'),_0x34a266,_0x180376);_0x3d0fe2(_0x180376);});});} \ No newline at end of file +var _0x8bd1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x3cbbec,_0x5562cf){var _0x44adbf=function(_0x270bdd){while(--_0x270bdd){_0x3cbbec['push'](_0x3cbbec['shift']());}};_0x44adbf(++_0x5562cf);}(_0x8bd1,0x156));var _0x18bd=function(_0x2b4505,_0x472369){_0x2b4505=_0x2b4505-0x0;var _0x4f9b8e=_0x8bd1[_0x2b4505];return _0x4f9b8e;};'use strict';var _=require(_0x18bd('0x0'));var util=require(_0x18bd('0x1'));var moment=require(_0x18bd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18bd('0x3'));var db=require(_0x18bd('0x4'))['db'];var utils=require(_0x18bd('0x5'));var logger=require(_0x18bd('0x6'))(_0x18bd('0x7'));var config=require(_0x18bd('0x8'));var jayson=require(_0x18bd('0x9'));var client=jayson[_0x18bd('0xa')][_0x18bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106746,_0x12db9d,_0x307ae0){return new BPromise(function(_0x4ac7fc,_0x1e67d9){return client[_0x18bd('0xc')](_0x106746,_0x307ae0)[_0x18bd('0xd')](function(_0x41d259){logger[_0x18bd('0xe')](_0x18bd('0xf'),_0x12db9d,_0x18bd('0x10'));logger['debug'](_0x18bd('0x11'),_0x12db9d,_0x18bd('0x10'),JSON[_0x18bd('0x12')](_0x41d259));if(_0x41d259[_0x18bd('0x13')]){if(_0x41d259['error'][_0x18bd('0x14')]===0x1f4){logger[_0x18bd('0x13')]('ChatApplication,\x20%s,\x20%s',_0x12db9d,_0x41d259[_0x18bd('0x13')]['message']);return _0x1e67d9(_0x41d259[_0x18bd('0x13')][_0x18bd('0x15')]);}logger[_0x18bd('0x13')](_0x18bd('0xf'),_0x12db9d,_0x41d259[_0x18bd('0x13')][_0x18bd('0x15')]);return _0x4ac7fc(_0x41d259[_0x18bd('0x13')][_0x18bd('0x15')]);}else{logger[_0x18bd('0xe')](_0x18bd('0xf'),_0x12db9d,'request\x20sent');_0x4ac7fc(_0x41d259[_0x18bd('0x16')][_0x18bd('0x15')]);}})['catch'](function(_0x34417e){logger[_0x18bd('0x13')](_0x18bd('0xf'),_0x12db9d,_0x34417e);_0x1e67d9(_0x34417e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e7ca23b..b6a4f26 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 _0xa178=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa178,0xf0));var _0x8a17=function(_0x4e9c99,_0x1a5068){_0x4e9c99=_0x4e9c99-0x0;var _0x416d82=_0xa178[_0x4e9c99];return _0x416d82;};'use strict';var multer=require(_0x8a17('0x0'));var util=require('util');var path=require(_0x8a17('0x1'));var timeout=require(_0x8a17('0x2'));var express=require(_0x8a17('0x3'));var router=express[_0x8a17('0x4')]();var auth=require(_0x8a17('0x5'));var interaction=require(_0x8a17('0x6'));var config=require(_0x8a17('0x7'));var controller=require('./chatApplication.controller');router[_0x8a17('0x8')](_0x8a17('0x9'),auth[_0x8a17('0xa')](),controller[_0x8a17('0xb')]);router[_0x8a17('0xc')](_0x8a17('0x9'),auth[_0x8a17('0xa')](),controller[_0x8a17('0xd')]);router[_0x8a17('0xe')](_0x8a17('0x9'),auth[_0x8a17('0xa')](),controller[_0x8a17('0xf')]);module[_0x8a17('0x10')]=router; \ No newline at end of file +var _0xe804=['destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','update'];(function(_0x3b9ee4,_0x49de9b){var _0x2a2001=function(_0x55748e){while(--_0x55748e){_0x3b9ee4['push'](_0x3b9ee4['shift']());}};_0x2a2001(++_0x49de9b);}(_0xe804,0x147));var _0x4e80=function(_0x3567de,_0x4e008c){_0x3567de=_0x3567de-0x0;var _0x47296a=_0xe804[_0x3567de];return _0x47296a;};'use strict';var multer=require('multer');var util=require(_0x4e80('0x0'));var path=require('path');var timeout=require(_0x4e80('0x1'));var express=require('express');var router=express[_0x4e80('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4e80('0x3'));var config=require(_0x4e80('0x4'));var controller=require(_0x4e80('0x5'));router[_0x4e80('0x6')](_0x4e80('0x7'),auth[_0x4e80('0x8')](),controller['show']);router[_0x4e80('0x9')](_0x4e80('0x7'),auth[_0x4e80('0x8')](),controller[_0x4e80('0xa')]);router['delete']('/:id',auth[_0x4e80('0x8')](),controller[_0x4e80('0xb')]);module[_0x4e80('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a4423b5..f11e009 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 _0x6744=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0x6744,0x1e8));var _0x4674=function(_0x3eeb2f,_0x5ed43c){_0x3eeb2f=_0x3eeb2f-0x0;var _0xb4aeeb=_0x6744[_0x3eeb2f];return _0xb4aeeb;};'use strict';var Sequelize=require(_0x4674('0x0'));module[_0x4674('0x1')]={'name':{'type':Sequelize[_0x4674('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4674('0x2')]},'write':{'type':Sequelize[_0x4674('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x80cc=['STRING','sequelize','exports'];(function(_0x52f6f0,_0x2609f4){var _0x5a5f7=function(_0x749edf){while(--_0x749edf){_0x52f6f0['push'](_0x52f6f0['shift']());}};_0x5a5f7(++_0x2609f4);}(_0x80cc,0x181));var _0xc80c=function(_0x11f083,_0x342d37){_0x11f083=_0x11f083-0x0;var _0x176940=_0x80cc[_0x11f083];return _0x176940;};'use strict';var Sequelize=require(_0xc80c('0x0'));module[_0xc80c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc80c('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b455ec3..b70994d 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 _0x79bf=['json','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','ChatGroup','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','rows','params','includeAll','find','create','body','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','removeMembers','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status'];(function(_0x19a723,_0x1a82b7){var _0x55c6b2=function(_0x32ec67){while(--_0x32ec67){_0x19a723['push'](_0x19a723['shift']());}};_0x55c6b2(++_0x1a82b7);}(_0x79bf,0x1df));var _0xf79b=function(_0x491d35,_0x43f6e5){_0x491d35=_0x491d35-0x0;var _0x5a2de7=_0x79bf[_0x491d35];return _0x5a2de7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf79b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf79b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf79b('0x2'));var moment=require(_0xf79b('0x3'));var BPromise=require(_0xf79b('0x4'));var Mustache=require(_0xf79b('0x5'));var util=require(_0xf79b('0x6'));var path=require(_0xf79b('0x7'));var sox=require(_0xf79b('0x8'));var csv=require('to-csv');var ejs=require(_0xf79b('0x9'));var fs=require('fs');var _=require(_0xf79b('0xa'));var squel=require(_0xf79b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf79b('0xc'));var deskjs=require(_0xf79b('0xd'));var toCsv=require(_0xf79b('0xe'));var querystring=require(_0xf79b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf79b('0x10'));var qs=require(_0xf79b('0x11'));var as=require(_0xf79b('0x12'));var hardwareService=require(_0xf79b('0x13'));var logger=require(_0xf79b('0x14'))(_0xf79b('0x15'));var utils=require(_0xf79b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf79b('0x17'));var db=require(_0xf79b('0x18'))['db'];config[_0xf79b('0x19')]=_[_0xf79b('0x1a')](config[_0xf79b('0x19')],{'host':_0xf79b('0x1b'),'port':0x18eb});var socket=require(_0xf79b('0x1c'))(new Redis(config[_0xf79b('0x19')]));require(_0xf79b('0x1d'))[_0xf79b('0x1e')](socket);var jayson=require(_0xf79b('0x1f'));var client=jayson[_0xf79b('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x487967,_0x1647c5,_0x595790,_0x3caf78){return new BPromise(function(_0x4ed585,_0x39536e){var _0x597338=_0x3caf78||client;return _0x597338['request'](_0x487967,_0x595790)[_0xf79b('0x21')](function(_0x56a70e){logger[_0xf79b('0x22')](_0xf79b('0x23'),_0x1647c5,_0xf79b('0x24'));logger['debug'](_0xf79b('0x25'),_0x1647c5,'request\x20sent',JSON[_0xf79b('0x26')](_0x56a70e));if(_0x56a70e[_0xf79b('0x27')]){if(_0x56a70e[_0xf79b('0x27')][_0xf79b('0x28')]===0x1f4){logger[_0xf79b('0x27')]('ChatGroup,\x20%s,\x20%s',_0x1647c5,_0x56a70e[_0xf79b('0x27')]['message']);return _0x39536e(_0x56a70e['error'][_0xf79b('0x29')]);}logger[_0xf79b('0x27')](_0xf79b('0x23'),_0x1647c5,_0x56a70e[_0xf79b('0x27')][_0xf79b('0x29')]);return _0x4ed585(_0x56a70e[_0xf79b('0x27')]['message']);}else{logger[_0xf79b('0x22')](_0xf79b('0x23'),_0x1647c5,_0xf79b('0x24'));_0x4ed585(_0x56a70e[_0xf79b('0x2a')][_0xf79b('0x29')]);}})[_0xf79b('0x2b')](function(_0x33b454){logger[_0xf79b('0x27')](_0xf79b('0x23'),_0x1647c5,_0x33b454);_0x39536e(_0x33b454);});});}function respondWithStatusCode(_0x31bd2a,_0x5c9dfb){_0x5c9dfb=_0x5c9dfb||0xcc;return function(_0x2dfa65){if(_0x2dfa65){return _0x31bd2a['sendStatus'](_0x5c9dfb);}return _0x31bd2a['status'](_0x5c9dfb)[_0xf79b('0x2c')]();};}function respondWithResult(_0x4cb150,_0xb4e37){_0xb4e37=_0xb4e37||0xc8;return function(_0x112019){if(_0x112019){return _0x4cb150[_0xf79b('0x2d')](_0xb4e37)[_0xf79b('0x2e')](_0x112019);}};}function respondWithFilteredResult(_0x5c3cbc,_0x4e9e45){return function(_0x3e6171){if(_0x3e6171){var _0x479b41=_0x3e6171['count'],_0x1bd31c=_0x4e9e45[_0xf79b('0x2f')],_0x470f5b=_0x4e9e45[_0xf79b('0x2f')]+_0x4e9e45['limit'],_0x1a4a13;if(_0x470f5b>=_0x479b41){_0x470f5b=_0x479b41;_0x1a4a13=0xc8;}else{_0x1a4a13=0xce;}_0x5c3cbc[_0xf79b('0x2d')](_0x1a4a13);return _0x5c3cbc['set'](_0xf79b('0x30'),_0x1bd31c+'-'+_0x470f5b+'/'+_0x479b41)[_0xf79b('0x2e')](_0x3e6171);}return null;};}function patchUpdates(_0x1cb0c3){return function(_0x3e4627){try{jsonpatch[_0xf79b('0x31')](_0x3e4627,_0x1cb0c3,!![]);}catch(_0x22cbd9){return BPromise[_0xf79b('0x32')](_0x22cbd9);}return _0x3e4627[_0xf79b('0x33')]();};}function saveUpdates(_0x4a4d75,_0x38901f){return function(_0x1e0702){if(_0x1e0702){return _0x1e0702[_0xf79b('0x34')](_0x4a4d75)[_0xf79b('0x21')](function(_0x24e603){return _0x24e603;});}return null;};}function removeEntity(_0x55c5a3,_0x4c14f0){return function(_0x3e6829){if(_0x3e6829){return _0x3e6829[_0xf79b('0x35')]()[_0xf79b('0x21')](function(){_0x55c5a3[_0xf79b('0x2d')](0xcc)[_0xf79b('0x2c')]();});}};}function handleEntityNotFound(_0x4bb695,_0x5701d7){return function(_0x3c8fb5){if(!_0x3c8fb5){_0x4bb695[_0xf79b('0x36')](0x194);}return _0x3c8fb5;};}function handleError(_0x1b0cd7,_0x39ae31){_0x39ae31=_0x39ae31||0x1f4;return function(_0x417036){logger[_0xf79b('0x27')](_0x417036['stack']);if(_0x417036[_0xf79b('0x37')]){delete _0x417036[_0xf79b('0x37')];}_0x1b0cd7[_0xf79b('0x2d')](_0x39ae31)[_0xf79b('0x38')](_0x417036);};}exports[_0xf79b('0x39')]=function(_0x47aca6,_0x3baed9){var _0x4831d3={},_0x119e4a={},_0x57a32e={'count':0x0,'rows':[]};var _0x1ec574=_[_0xf79b('0x3a')](db[_0xf79b('0x3b')][_0xf79b('0x3c')],function(_0x5071e5){return{'name':_0x5071e5['fieldName'],'type':_0x5071e5['type'][_0xf79b('0x3d')]};});_0x119e4a[_0xf79b('0x3e')]=_['map'](_0x1ec574,_0xf79b('0x37'));_0x119e4a['query']=_[_0xf79b('0x3f')](_0x47aca6[_0xf79b('0x40')]);_0x119e4a[_0xf79b('0x41')]=_['intersection'](_0x119e4a[_0xf79b('0x3e')],_0x119e4a[_0xf79b('0x40')]);_0x4831d3['attributes']=_[_0xf79b('0x42')](_0x119e4a['model'],qs[_0xf79b('0x43')](_0x47aca6[_0xf79b('0x40')][_0xf79b('0x43')]));_0x4831d3[_0xf79b('0x44')]=_0x4831d3[_0xf79b('0x44')][_0xf79b('0x45')]?_0x4831d3[_0xf79b('0x44')]:_0x119e4a[_0xf79b('0x3e')];if(!_0x47aca6[_0xf79b('0x40')][_0xf79b('0x46')](_0xf79b('0x47'))){_0x4831d3[_0xf79b('0x48')]=qs['limit'](_0x47aca6[_0xf79b('0x40')][_0xf79b('0x48')]);_0x4831d3['offset']=qs['offset'](_0x47aca6[_0xf79b('0x40')][_0xf79b('0x2f')]);}_0x4831d3[_0xf79b('0x49')]=qs[_0xf79b('0x4a')](_0x47aca6[_0xf79b('0x40')]['sort']);_0x4831d3[_0xf79b('0x4b')]=qs[_0xf79b('0x41')](_[_0xf79b('0x4c')](_0x47aca6[_0xf79b('0x40')],_0x119e4a[_0xf79b('0x41')]),_0x1ec574);if(_0x47aca6[_0xf79b('0x40')][_0xf79b('0x4d')]){_0x4831d3[_0xf79b('0x4b')]=_[_0xf79b('0x4e')](_0x4831d3[_0xf79b('0x4b')],{'$or':_[_0xf79b('0x3a')](_0x1ec574,function(_0x8e9ab4){if(_0x8e9ab4[_0xf79b('0x4f')]!==_0xf79b('0x50')){var _0x30724b={};_0x30724b[_0x8e9ab4[_0xf79b('0x37')]]={'$like':'%'+_0x47aca6['query'][_0xf79b('0x4d')]+'%'};return _0x30724b;}})});}_0x4831d3=_['merge']({},_0x4831d3,_0x47aca6[_0xf79b('0x51')]);var _0x1f1cc3={'where':_0x4831d3[_0xf79b('0x4b')]};return db[_0xf79b('0x3b')][_0xf79b('0x52')](_0x1f1cc3)[_0xf79b('0x21')](function(_0xfda08e){_0x57a32e[_0xf79b('0x52')]=_0xfda08e;if(_0x47aca6[_0xf79b('0x40')]['includeAll']){_0x4831d3['include']=[{'all':!![]}];}return db[_0xf79b('0x3b')]['findAll'](_0x4831d3);})['then'](function(_0x5b107d){_0x57a32e[_0xf79b('0x53')]=_0x5b107d;return _0x57a32e;})[_0xf79b('0x21')](respondWithFilteredResult(_0x3baed9,_0x4831d3))[_0xf79b('0x2b')](handleError(_0x3baed9,null));};exports['show']=function(_0xe5b3e6,_0xc61317){var _0x5b50ae={'raw':!![],'where':{'id':_0xe5b3e6[_0xf79b('0x54')]['id']}},_0xcf04fe={};_0xcf04fe['model']=_[_0xf79b('0x3f')](db[_0xf79b('0x3b')][_0xf79b('0x3c')]);_0xcf04fe[_0xf79b('0x40')]=_[_0xf79b('0x3f')](_0xe5b3e6[_0xf79b('0x40')]);_0xcf04fe[_0xf79b('0x41')]=_[_0xf79b('0x42')](_0xcf04fe['model'],_0xcf04fe[_0xf79b('0x40')]);_0x5b50ae[_0xf79b('0x44')]=_[_0xf79b('0x42')](_0xcf04fe[_0xf79b('0x3e')],qs[_0xf79b('0x43')](_0xe5b3e6[_0xf79b('0x40')]['fields']));_0x5b50ae[_0xf79b('0x44')]=_0x5b50ae['attributes'][_0xf79b('0x45')]?_0x5b50ae[_0xf79b('0x44')]:_0xcf04fe[_0xf79b('0x3e')];if(_0xe5b3e6['query'][_0xf79b('0x55')]){_0x5b50ae['include']=[{'all':!![]}];}_0x5b50ae=_[_0xf79b('0x4e')]({},_0x5b50ae,_0xe5b3e6[_0xf79b('0x51')]);return db['ChatGroup'][_0xf79b('0x56')](_0x5b50ae)['then'](handleEntityNotFound(_0xc61317,null))[_0xf79b('0x21')](respondWithResult(_0xc61317,null))['catch'](handleError(_0xc61317,null));};exports['create']=function(_0x2950d3,_0x280774){return db[_0xf79b('0x3b')][_0xf79b('0x57')](_0x2950d3[_0xf79b('0x58')],{})['then'](respondWithResult(_0x280774,0xc9))[_0xf79b('0x2b')](handleError(_0x280774,null));};exports[_0xf79b('0x34')]=function(_0x47b017,_0x4a158){if(_0x47b017['body']['id']){delete _0x47b017[_0xf79b('0x58')]['id'];}return db[_0xf79b('0x3b')][_0xf79b('0x56')]({'where':{'id':_0x47b017['params']['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x4a158,null))[_0xf79b('0x21')](saveUpdates(_0x47b017['body'],null))[_0xf79b('0x21')](respondWithResult(_0x4a158,null))[_0xf79b('0x2b')](handleError(_0x4a158,null));};exports[_0xf79b('0x35')]=function(_0x5f137f,_0xbdfc92){return db[_0xf79b('0x3b')]['find']({'where':{'id':_0x5f137f['params']['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0xbdfc92,null))['then'](removeEntity(_0xbdfc92,null))['catch'](handleError(_0xbdfc92,null));};exports['describe']=function(_0x4c4fdb,_0xe5fa0e){return db[_0xf79b('0x3b')]['describe']()[_0xf79b('0x21')](respondWithResult(_0xe5fa0e,null))['catch'](handleError(_0xe5fa0e,null));};exports[_0xf79b('0x59')]=function(_0x6ee717,_0x180ff1,_0x780b8c){return db[_0xf79b('0x5a')][_0xf79b('0x52')]({'where':{'ChatGroupId':_0x6ee717['params']['id'],'ToId':_0x6ee717[_0xf79b('0x5b')]['id'],'read':![]}})[_0xf79b('0x21')](function(_0x383b82){return{'id':_['toInteger'](_0x6ee717[_0xf79b('0x54')]['id']),'count':_0x383b82};})['then'](respondWithResult(_0x180ff1,null))['catch'](handleError(_0x180ff1,null));};exports[_0xf79b('0x5c')]=function(_0x20a030,_0x1c4b94,_0xa0366d){return db['ChatGroup']['find']({'where':{'id':_0x20a030[_0xf79b('0x54')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x1c4b94,null))['then'](function(_0x3ab27a){if(_0x3ab27a){return _0x3ab27a[_0xf79b('0x5c')](_0x20a030[_0xf79b('0x58')][_0xf79b('0x5d')],_[_0xf79b('0x5e')](_0x20a030[_0xf79b('0x58')],['ids','id'])||{});}})[_0xf79b('0x21')](respondWithResult(_0x1c4b94,null))[_0xf79b('0x2b')](handleError(_0x1c4b94,null));};exports[_0xf79b('0x5f')]=function(_0x48973d,_0x397eb9,_0x33d934){var _0x38f78f={};var _0x715059={};var _0x67a1b4;var _0x222299;return db['ChatGroup']['findOne']({'where':{'id':_0x48973d[_0xf79b('0x54')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x397eb9,null))[_0xf79b('0x21')](function(_0x3884d1){if(_0x3884d1){_0x67a1b4=_0x3884d1;_0x715059['model']=_[_0xf79b('0x3f')](db[_0xf79b('0x60')][_0xf79b('0x3c')]);_0x715059[_0xf79b('0x40')]=_[_0xf79b('0x3f')](_0x48973d[_0xf79b('0x40')]);_0x715059[_0xf79b('0x41')]=_['intersection'](_0x715059[_0xf79b('0x3e')],_0x715059[_0xf79b('0x40')]);_0x38f78f[_0xf79b('0x44')]=_[_0xf79b('0x42')](_0x715059[_0xf79b('0x3e')],qs[_0xf79b('0x43')](_0x48973d['query'][_0xf79b('0x43')]));_0x38f78f[_0xf79b('0x44')]=_0x38f78f[_0xf79b('0x44')][_0xf79b('0x45')]?_0x38f78f[_0xf79b('0x44')]:_0x715059[_0xf79b('0x3e')];_0x38f78f[_0xf79b('0x49')]=qs['sort'](_0x48973d[_0xf79b('0x40')]['sort']);_0x38f78f[_0xf79b('0x4b')]=qs[_0xf79b('0x41')](_[_0xf79b('0x4c')](_0x48973d[_0xf79b('0x40')],_0x715059['filters']));if(_0x48973d[_0xf79b('0x40')][_0xf79b('0x4d')]){_0x38f78f[_0xf79b('0x4b')]=_[_0xf79b('0x4e')](_0x38f78f[_0xf79b('0x4b')],{'$or':_[_0xf79b('0x3a')](_0x38f78f[_0xf79b('0x44')],function(_0xb6be93){var _0x1420c0={};_0x1420c0[_0xb6be93]={'$like':'%'+_0x48973d['query'][_0xf79b('0x4d')]+'%'};return _0x1420c0;})});}_0x38f78f=_[_0xf79b('0x4e')]({},_0x38f78f,_0x48973d[_0xf79b('0x51')]);return _0x67a1b4[_0xf79b('0x5f')](_0x38f78f);}})['then'](function(_0x5f1b6f){if(_0x5f1b6f){_0x222299=_0x5f1b6f[_0xf79b('0x45')];if(!_0x48973d[_0xf79b('0x40')][_0xf79b('0x46')](_0xf79b('0x47'))){_0x38f78f[_0xf79b('0x48')]=qs[_0xf79b('0x48')](_0x48973d[_0xf79b('0x40')][_0xf79b('0x48')]);_0x38f78f[_0xf79b('0x2f')]=qs[_0xf79b('0x2f')](_0x48973d['query']['offset']);}return _0x67a1b4[_0xf79b('0x5f')](_0x38f78f);}})[_0xf79b('0x21')](function(_0x224e21){if(_0x224e21){return _0x224e21?{'count':_0x222299,'rows':_0x224e21}:null;}})['then'](respondWithResult(_0x397eb9,null))[_0xf79b('0x2b')](handleError(_0x397eb9,null));};exports[_0xf79b('0x61')]=function(_0x6b99a,_0x445dfc,_0x136b6b){return db[_0xf79b('0x3b')][_0xf79b('0x56')]({'where':{'id':_0x6b99a[_0xf79b('0x54')]['id']}})['then'](handleEntityNotFound(_0x445dfc,null))[_0xf79b('0x21')](function(_0x19de24){if(_0x19de24){return _0x19de24['removeMembers'](_0x6b99a[_0xf79b('0x40')]['ids']);}})[_0xf79b('0x21')](respondWithStatusCode(_0x445dfc,null))['catch'](handleError(_0x445dfc,null));};exports['addMessage']=function(_0x1c67f7,_0x2a21b4,_0x428c5d){if(_0x1c67f7[_0xf79b('0x58')]['id']){delete _0x1c67f7[_0xf79b('0x58')]['id'];}return db[_0xf79b('0x3b')]['find']({'where':{'id':_0x1c67f7['params']['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x2a21b4,null))['then'](function(_0x295ba2){if(_0x295ba2){_0x1c67f7[_0xf79b('0x58')][_0xf79b('0x62')]=_0x295ba2['id'];return db[_0xf79b('0x5a')][_0xf79b('0x57')](_0x1c67f7[_0xf79b('0x58')]);}})['then'](respondWithResult(_0x2a21b4,null))[_0xf79b('0x2b')](handleError(_0x2a21b4,null));};exports[_0xf79b('0x63')]=function(_0xde10c0,_0x14500e,_0x1f5511){var _0x21cf10={};var _0x3f5eb2={};var _0x4ef901;var _0x1293fb;return db[_0xf79b('0x3b')][_0xf79b('0x64')]({'where':{'id':_0xde10c0['params']['id']}})['then'](handleEntityNotFound(_0x14500e,null))['then'](function(_0x489782){if(_0x489782){_0x4ef901=_0x489782;_0x3f5eb2['model']=_[_0xf79b('0x3f')](db['ChatInternalMessage'][_0xf79b('0x3c')]);_0x3f5eb2['query']=_[_0xf79b('0x3f')](_0xde10c0[_0xf79b('0x40')]);_0x3f5eb2['filters']=_[_0xf79b('0x42')](_0x3f5eb2['model'],_0x3f5eb2[_0xf79b('0x40')]);_0x21cf10[_0xf79b('0x44')]=_['intersection'](_0x3f5eb2['model'],qs[_0xf79b('0x43')](_0xde10c0[_0xf79b('0x40')][_0xf79b('0x43')]));_0x21cf10[_0xf79b('0x44')]=_0x21cf10[_0xf79b('0x44')][_0xf79b('0x45')]?_0x21cf10[_0xf79b('0x44')]:_0x3f5eb2[_0xf79b('0x3e')];_0x21cf10['order']=qs['sort'](_0xde10c0[_0xf79b('0x40')][_0xf79b('0x4a')]);_0x21cf10[_0xf79b('0x4b')]=qs['filters'](_[_0xf79b('0x4c')](_0xde10c0[_0xf79b('0x40')],_0x3f5eb2[_0xf79b('0x41')]));if(_0xde10c0[_0xf79b('0x40')][_0xf79b('0x4d')]){_0x21cf10[_0xf79b('0x4b')]=_[_0xf79b('0x4e')](_0x21cf10[_0xf79b('0x4b')],{'$or':_[_0xf79b('0x3a')](_0x21cf10[_0xf79b('0x44')],function(_0x2f9599){var _0x205368={};_0x205368[_0x2f9599]={'$like':'%'+_0xde10c0[_0xf79b('0x40')]['filter']+'%'};return _0x205368;})});}if(_0xde10c0['query'][_0xf79b('0x65')]){var _0x212021=_0xde10c0[_0xf79b('0x40')][_0xf79b('0x65')][_0xf79b('0x66')](',');var _0x2ddeb6={};_0x2ddeb6[_0x212021[0x0]]={'$gte':moment(_0x212021[0x1])[_0xf79b('0x67')](_0xf79b('0x68'))};_0x21cf10['where']=_[_0xf79b('0x4e')](_0x21cf10[_0xf79b('0x4b')],_0x2ddeb6);}_0x21cf10=_['merge']({},_0x21cf10,_0xde10c0[_0xf79b('0x51')]);return _0x4ef901[_0xf79b('0x63')](_0x21cf10);}})[_0xf79b('0x21')](function(_0x87379e){if(_0x87379e){_0x1293fb=_0x87379e[_0xf79b('0x45')];if(!_0xde10c0[_0xf79b('0x40')][_0xf79b('0x46')](_0xf79b('0x47'))){_0x21cf10['limit']=qs[_0xf79b('0x48')](_0xde10c0[_0xf79b('0x40')][_0xf79b('0x48')]);_0x21cf10[_0xf79b('0x2f')]=qs['offset'](_0xde10c0['query'][_0xf79b('0x2f')]);}return _0x4ef901['getMessages'](_0x21cf10);}})[_0xf79b('0x21')](function(_0x48d801){if(_0x48d801){return _0x48d801?{'count':_0x1293fb,'rows':_0x48d801}:null;}})[_0xf79b('0x21')](respondWithResult(_0x14500e,null))[_0xf79b('0x2b')](handleError(_0x14500e,null));}; \ No newline at end of file +var _0x8325=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','count','offset','apply','reject','update','end','stack','name','index','map','type','key','model','query','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','ChatGroup','includeAll','findAll','rows','params','keys','rawAttributes','intersection','include','find','create','body','destroy','describe','ChatInternalMessage','user','toInteger','ids','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x12c71c,_0x1ebec8){var _0x2991a0=function(_0x52121b){while(--_0x52121b){_0x12c71c['push'](_0x12c71c['shift']());}};_0x2991a0(++_0x1ebec8);}(_0x8325,0x1f1));var _0x5832=function(_0x43e6ef,_0xea657){_0x43e6ef=_0x43e6ef-0x0;var _0x59b87d=_0x8325[_0x43e6ef];return _0x59b87d;};'use strict';var pdf=require(_0x5832('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5832('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5832('0x2'));var rp=require('request-promise');var moment=require(_0x5832('0x3'));var BPromise=require(_0x5832('0x4'));var Mustache=require(_0x5832('0x5'));var util=require(_0x5832('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5832('0x7'));var ejs=require(_0x5832('0x8'));var fs=require('fs');var _=require(_0x5832('0x9'));var squel=require(_0x5832('0xa'));var crypto=require(_0x5832('0xb'));var jsforce=require(_0x5832('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5832('0x7'));var querystring=require(_0x5832('0xd'));var Papa=require(_0x5832('0xe'));var Redis=require(_0x5832('0xf'));var authService=require(_0x5832('0x10'));var qs=require(_0x5832('0x11'));var as=require(_0x5832('0x12'));var hardwareService=require(_0x5832('0x13'));var logger=require(_0x5832('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5832('0x15'));var licenseUtil=require(_0x5832('0x16'));var db=require(_0x5832('0x17'))['db'];config[_0x5832('0x18')]=_['defaults'](config['redis'],{'host':_0x5832('0x19'),'port':0x18eb});var socket=require(_0x5832('0x1a'))(new Redis(config[_0x5832('0x18')]));require(_0x5832('0x1b'))['register'](socket);var jayson=require(_0x5832('0x1c'));var client=jayson[_0x5832('0x1d')][_0x5832('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x15ef7f,_0x59c5c8,_0x13e900,_0x2a39ae){return new BPromise(function(_0x34cb4e,_0x4a8462){var _0x32d360=_0x2a39ae||client;return _0x32d360[_0x5832('0x1f')](_0x15ef7f,_0x13e900)[_0x5832('0x20')](function(_0xd9e622){logger[_0x5832('0x21')](_0x5832('0x22'),_0x59c5c8,_0x5832('0x23'));logger[_0x5832('0x24')](_0x5832('0x25'),_0x59c5c8,_0x5832('0x23'),JSON['stringify'](_0xd9e622));if(_0xd9e622[_0x5832('0x26')]){if(_0xd9e622['error']['code']===0x1f4){logger['error'](_0x5832('0x22'),_0x59c5c8,_0xd9e622['error']['message']);return _0x4a8462(_0xd9e622['error']['message']);}logger[_0x5832('0x26')]('ChatGroup,\x20%s,\x20%s',_0x59c5c8,_0xd9e622['error'][_0x5832('0x27')]);return _0x34cb4e(_0xd9e622['error'][_0x5832('0x27')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x59c5c8,'request\x20sent');_0x34cb4e(_0xd9e622[_0x5832('0x28')][_0x5832('0x27')]);}})[_0x5832('0x29')](function(_0x345b9c){logger['error']('ChatGroup,\x20%s,\x20%s',_0x59c5c8,_0x345b9c);_0x4a8462(_0x345b9c);});});}function respondWithStatusCode(_0xa5f2b7,_0x313064){_0x313064=_0x313064||0xcc;return function(_0x5648b2){if(_0x5648b2){return _0xa5f2b7[_0x5832('0x2a')](_0x313064);}return _0xa5f2b7[_0x5832('0x2b')](_0x313064)['end']();};}function respondWithResult(_0x349a1e,_0x159eef){_0x159eef=_0x159eef||0xc8;return function(_0x466dbd){if(_0x466dbd){return _0x349a1e[_0x5832('0x2b')](_0x159eef)[_0x5832('0x2c')](_0x466dbd);}};}function respondWithFilteredResult(_0x1693e4,_0x301444){return function(_0x422ba2){if(_0x422ba2){var _0x282455=_0x422ba2[_0x5832('0x2d')],_0x3b1122=_0x301444[_0x5832('0x2e')],_0xdb70aa=_0x301444[_0x5832('0x2e')]+_0x301444['limit'],_0x57b1b9;if(_0xdb70aa>=_0x282455){_0xdb70aa=_0x282455;_0x57b1b9=0xc8;}else{_0x57b1b9=0xce;}_0x1693e4[_0x5832('0x2b')](_0x57b1b9);return _0x1693e4['set']('Content-Range',_0x3b1122+'-'+_0xdb70aa+'/'+_0x282455)[_0x5832('0x2c')](_0x422ba2);}return null;};}function patchUpdates(_0x4603d5){return function(_0x315348){try{jsonpatch[_0x5832('0x2f')](_0x315348,_0x4603d5,!![]);}catch(_0x549bd7){return BPromise[_0x5832('0x30')](_0x549bd7);}return _0x315348['save']();};}function saveUpdates(_0x69f14d,_0x12c4e1){return function(_0x238bb7){if(_0x238bb7){return _0x238bb7[_0x5832('0x31')](_0x69f14d)[_0x5832('0x20')](function(_0x46d20d){return _0x46d20d;});}return null;};}function removeEntity(_0x550ba5,_0x2a4a58){return function(_0x5d0cb0){if(_0x5d0cb0){return _0x5d0cb0['destroy']()[_0x5832('0x20')](function(){_0x550ba5[_0x5832('0x2b')](0xcc)[_0x5832('0x32')]();});}};}function handleEntityNotFound(_0x861e85,_0x188dda){return function(_0x2cb021){if(!_0x2cb021){_0x861e85[_0x5832('0x2a')](0x194);}return _0x2cb021;};}function handleError(_0x2f3875,_0x5434bb){_0x5434bb=_0x5434bb||0x1f4;return function(_0x12bffd){logger['error'](_0x12bffd[_0x5832('0x33')]);if(_0x12bffd[_0x5832('0x34')]){delete _0x12bffd[_0x5832('0x34')];}_0x2f3875[_0x5832('0x2b')](_0x5434bb)['send'](_0x12bffd);};}exports[_0x5832('0x35')]=function(_0xf988ff,_0x38d21b){var _0x2391f8={},_0x3d4718={},_0x4197c0={'count':0x0,'rows':[]};var _0x6261e8=_[_0x5832('0x36')](db['ChatGroup']['rawAttributes'],function(_0x113fac){return{'name':_0x113fac['fieldName'],'type':_0x113fac[_0x5832('0x37')][_0x5832('0x38')]};});_0x3d4718[_0x5832('0x39')]=_[_0x5832('0x36')](_0x6261e8,_0x5832('0x34'));_0x3d4718[_0x5832('0x3a')]=_['keys'](_0xf988ff[_0x5832('0x3a')]);_0x3d4718['filters']=_['intersection'](_0x3d4718['model'],_0x3d4718[_0x5832('0x3a')]);_0x2391f8[_0x5832('0x3b')]=_['intersection'](_0x3d4718[_0x5832('0x39')],qs[_0x5832('0x3c')](_0xf988ff[_0x5832('0x3a')]['fields']));_0x2391f8[_0x5832('0x3b')]=_0x2391f8['attributes'][_0x5832('0x3d')]?_0x2391f8[_0x5832('0x3b')]:_0x3d4718[_0x5832('0x39')];if(!_0xf988ff[_0x5832('0x3a')]['hasOwnProperty'](_0x5832('0x3e'))){_0x2391f8['limit']=qs[_0x5832('0x3f')](_0xf988ff[_0x5832('0x3a')]['limit']);_0x2391f8[_0x5832('0x2e')]=qs['offset'](_0xf988ff[_0x5832('0x3a')]['offset']);}_0x2391f8[_0x5832('0x40')]=qs[_0x5832('0x41')](_0xf988ff[_0x5832('0x3a')]['sort']);_0x2391f8[_0x5832('0x42')]=qs[_0x5832('0x43')](_[_0x5832('0x44')](_0xf988ff[_0x5832('0x3a')],_0x3d4718[_0x5832('0x43')]),_0x6261e8);if(_0xf988ff['query'][_0x5832('0x45')]){_0x2391f8[_0x5832('0x42')]=_[_0x5832('0x46')](_0x2391f8['where'],{'$or':_[_0x5832('0x36')](_0x6261e8,function(_0x1819f0){if(_0x1819f0[_0x5832('0x37')]!=='VIRTUAL'){var _0x4e32ab={};_0x4e32ab[_0x1819f0[_0x5832('0x34')]]={'$like':'%'+_0xf988ff[_0x5832('0x3a')][_0x5832('0x45')]+'%'};return _0x4e32ab;}})});}_0x2391f8=_[_0x5832('0x46')]({},_0x2391f8,_0xf988ff[_0x5832('0x47')]);var _0x52b17c={'where':_0x2391f8['where']};return db[_0x5832('0x48')]['count'](_0x52b17c)['then'](function(_0x27562a){_0x4197c0['count']=_0x27562a;if(_0xf988ff['query'][_0x5832('0x49')]){_0x2391f8['include']=[{'all':!![]}];}return db[_0x5832('0x48')][_0x5832('0x4a')](_0x2391f8);})[_0x5832('0x20')](function(_0x15bf04){_0x4197c0[_0x5832('0x4b')]=_0x15bf04;return _0x4197c0;})['then'](respondWithFilteredResult(_0x38d21b,_0x2391f8))[_0x5832('0x29')](handleError(_0x38d21b,null));};exports['show']=function(_0x40a314,_0x14ce0d){var _0x4d3e1f={'raw':!![],'where':{'id':_0x40a314[_0x5832('0x4c')]['id']}},_0x28b461={};_0x28b461[_0x5832('0x39')]=_[_0x5832('0x4d')](db[_0x5832('0x48')][_0x5832('0x4e')]);_0x28b461['query']=_['keys'](_0x40a314[_0x5832('0x3a')]);_0x28b461[_0x5832('0x43')]=_[_0x5832('0x4f')](_0x28b461[_0x5832('0x39')],_0x28b461[_0x5832('0x3a')]);_0x4d3e1f[_0x5832('0x3b')]=_['intersection'](_0x28b461['model'],qs['fields'](_0x40a314['query'][_0x5832('0x3c')]));_0x4d3e1f[_0x5832('0x3b')]=_0x4d3e1f[_0x5832('0x3b')][_0x5832('0x3d')]?_0x4d3e1f[_0x5832('0x3b')]:_0x28b461['model'];if(_0x40a314['query'][_0x5832('0x49')]){_0x4d3e1f[_0x5832('0x50')]=[{'all':!![]}];}_0x4d3e1f=_['merge']({},_0x4d3e1f,_0x40a314[_0x5832('0x47')]);return db[_0x5832('0x48')][_0x5832('0x51')](_0x4d3e1f)[_0x5832('0x20')](handleEntityNotFound(_0x14ce0d,null))[_0x5832('0x20')](respondWithResult(_0x14ce0d,null))[_0x5832('0x29')](handleError(_0x14ce0d,null));};exports[_0x5832('0x52')]=function(_0x4569ce,_0x157fee){return db[_0x5832('0x48')][_0x5832('0x52')](_0x4569ce[_0x5832('0x53')],{})['then'](respondWithResult(_0x157fee,0xc9))['catch'](handleError(_0x157fee,null));};exports[_0x5832('0x31')]=function(_0x263f36,_0x3ecba4){if(_0x263f36[_0x5832('0x53')]['id']){delete _0x263f36['body']['id'];}return db[_0x5832('0x48')][_0x5832('0x51')]({'where':{'id':_0x263f36[_0x5832('0x4c')]['id']}})[_0x5832('0x20')](handleEntityNotFound(_0x3ecba4,null))[_0x5832('0x20')](saveUpdates(_0x263f36[_0x5832('0x53')],null))['then'](respondWithResult(_0x3ecba4,null))[_0x5832('0x29')](handleError(_0x3ecba4,null));};exports[_0x5832('0x54')]=function(_0x4facc6,_0x2e561e){return db[_0x5832('0x48')]['find']({'where':{'id':_0x4facc6[_0x5832('0x4c')]['id']}})[_0x5832('0x20')](handleEntityNotFound(_0x2e561e,null))[_0x5832('0x20')](removeEntity(_0x2e561e,null))[_0x5832('0x29')](handleError(_0x2e561e,null));};exports[_0x5832('0x55')]=function(_0x2dd18e,_0x3a85e7){return db[_0x5832('0x48')][_0x5832('0x55')]()[_0x5832('0x20')](respondWithResult(_0x3a85e7,null))[_0x5832('0x29')](handleError(_0x3a85e7,null));};exports['getUnread']=function(_0x353c07,_0x346316,_0xc6a286){return db[_0x5832('0x56')][_0x5832('0x2d')]({'where':{'ChatGroupId':_0x353c07[_0x5832('0x4c')]['id'],'ToId':_0x353c07[_0x5832('0x57')]['id'],'read':![]}})[_0x5832('0x20')](function(_0x487bf2){return{'id':_[_0x5832('0x58')](_0x353c07['params']['id']),'count':_0x487bf2};})[_0x5832('0x20')](respondWithResult(_0x346316,null))['catch'](handleError(_0x346316,null));};exports['addMembers']=function(_0x543e6d,_0x8b2c6c,_0xb71bf5){return db[_0x5832('0x48')][_0x5832('0x51')]({'where':{'id':_0x543e6d[_0x5832('0x4c')]['id']}})['then'](handleEntityNotFound(_0x8b2c6c,null))[_0x5832('0x20')](function(_0x4de8c0){if(_0x4de8c0){return _0x4de8c0['addMembers'](_0x543e6d['body'][_0x5832('0x59')],_[_0x5832('0x5a')](_0x543e6d[_0x5832('0x53')],[_0x5832('0x59'),'id'])||{});}})[_0x5832('0x20')](respondWithResult(_0x8b2c6c,null))[_0x5832('0x29')](handleError(_0x8b2c6c,null));};exports[_0x5832('0x5b')]=function(_0x4d90ae,_0x3441dd,_0x239d1e){var _0x41a4df={};var _0x3c070c={};var _0x4dff6b;var _0x900f9c;return db[_0x5832('0x48')][_0x5832('0x5c')]({'where':{'id':_0x4d90ae[_0x5832('0x4c')]['id']}})[_0x5832('0x20')](handleEntityNotFound(_0x3441dd,null))[_0x5832('0x20')](function(_0x1ca183){if(_0x1ca183){_0x4dff6b=_0x1ca183;_0x3c070c[_0x5832('0x39')]=_[_0x5832('0x4d')](db[_0x5832('0x5d')]['rawAttributes']);_0x3c070c[_0x5832('0x3a')]=_[_0x5832('0x4d')](_0x4d90ae['query']);_0x3c070c[_0x5832('0x43')]=_[_0x5832('0x4f')](_0x3c070c['model'],_0x3c070c[_0x5832('0x3a')]);_0x41a4df[_0x5832('0x3b')]=_[_0x5832('0x4f')](_0x3c070c[_0x5832('0x39')],qs[_0x5832('0x3c')](_0x4d90ae['query']['fields']));_0x41a4df[_0x5832('0x3b')]=_0x41a4df['attributes']['length']?_0x41a4df[_0x5832('0x3b')]:_0x3c070c[_0x5832('0x39')];_0x41a4df[_0x5832('0x40')]=qs[_0x5832('0x41')](_0x4d90ae['query'][_0x5832('0x41')]);_0x41a4df['where']=qs[_0x5832('0x43')](_[_0x5832('0x44')](_0x4d90ae['query'],_0x3c070c[_0x5832('0x43')]));if(_0x4d90ae[_0x5832('0x3a')][_0x5832('0x45')]){_0x41a4df['where']=_[_0x5832('0x46')](_0x41a4df[_0x5832('0x42')],{'$or':_[_0x5832('0x36')](_0x41a4df['attributes'],function(_0x7204da){var _0x38b3c9={};_0x38b3c9[_0x7204da]={'$like':'%'+_0x4d90ae[_0x5832('0x3a')][_0x5832('0x45')]+'%'};return _0x38b3c9;})});}_0x41a4df=_[_0x5832('0x46')]({},_0x41a4df,_0x4d90ae[_0x5832('0x47')]);return _0x4dff6b[_0x5832('0x5b')](_0x41a4df);}})[_0x5832('0x20')](function(_0x5bf104){if(_0x5bf104){_0x900f9c=_0x5bf104['length'];if(!_0x4d90ae[_0x5832('0x3a')][_0x5832('0x5e')](_0x5832('0x3e'))){_0x41a4df['limit']=qs[_0x5832('0x3f')](_0x4d90ae[_0x5832('0x3a')][_0x5832('0x3f')]);_0x41a4df[_0x5832('0x2e')]=qs['offset'](_0x4d90ae[_0x5832('0x3a')]['offset']);}return _0x4dff6b[_0x5832('0x5b')](_0x41a4df);}})[_0x5832('0x20')](function(_0x5993be){if(_0x5993be){return _0x5993be?{'count':_0x900f9c,'rows':_0x5993be}:null;}})[_0x5832('0x20')](respondWithResult(_0x3441dd,null))[_0x5832('0x29')](handleError(_0x3441dd,null));};exports['removeMembers']=function(_0x269ace,_0x1b5028,_0x3f5743){return db['ChatGroup'][_0x5832('0x51')]({'where':{'id':_0x269ace[_0x5832('0x4c')]['id']}})[_0x5832('0x20')](handleEntityNotFound(_0x1b5028,null))[_0x5832('0x20')](function(_0x40207b){if(_0x40207b){return _0x40207b[_0x5832('0x5f')](_0x269ace[_0x5832('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x1b5028,null))[_0x5832('0x29')](handleError(_0x1b5028,null));};exports[_0x5832('0x60')]=function(_0x5e842e,_0x4f7b10,_0x54cd8e){if(_0x5e842e[_0x5832('0x53')]['id']){delete _0x5e842e[_0x5832('0x53')]['id'];}return db[_0x5832('0x48')][_0x5832('0x51')]({'where':{'id':_0x5e842e['params']['id']}})[_0x5832('0x20')](handleEntityNotFound(_0x4f7b10,null))['then'](function(_0x58076e){if(_0x58076e){_0x5e842e[_0x5832('0x53')][_0x5832('0x61')]=_0x58076e['id'];return db[_0x5832('0x56')][_0x5832('0x52')](_0x5e842e[_0x5832('0x53')]);}})['then'](respondWithResult(_0x4f7b10,null))[_0x5832('0x29')](handleError(_0x4f7b10,null));};exports['getMessages']=function(_0xc5c8f0,_0x3b2cb6,_0xe1d378){var _0x42992c={};var _0x421f4f={};var _0x496077;var _0x11a091;return db[_0x5832('0x48')][_0x5832('0x5c')]({'where':{'id':_0xc5c8f0[_0x5832('0x4c')]['id']}})[_0x5832('0x20')](handleEntityNotFound(_0x3b2cb6,null))['then'](function(_0x221f5c){if(_0x221f5c){_0x496077=_0x221f5c;_0x421f4f[_0x5832('0x39')]=_[_0x5832('0x4d')](db[_0x5832('0x56')]['rawAttributes']);_0x421f4f[_0x5832('0x3a')]=_['keys'](_0xc5c8f0[_0x5832('0x3a')]);_0x421f4f[_0x5832('0x43')]=_[_0x5832('0x4f')](_0x421f4f[_0x5832('0x39')],_0x421f4f[_0x5832('0x3a')]);_0x42992c['attributes']=_[_0x5832('0x4f')](_0x421f4f['model'],qs[_0x5832('0x3c')](_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x3c')]));_0x42992c[_0x5832('0x3b')]=_0x42992c[_0x5832('0x3b')][_0x5832('0x3d')]?_0x42992c[_0x5832('0x3b')]:_0x421f4f[_0x5832('0x39')];_0x42992c[_0x5832('0x40')]=qs[_0x5832('0x41')](_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x41')]);_0x42992c[_0x5832('0x42')]=qs[_0x5832('0x43')](_[_0x5832('0x44')](_0xc5c8f0[_0x5832('0x3a')],_0x421f4f[_0x5832('0x43')]));if(_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x45')]){_0x42992c[_0x5832('0x42')]=_[_0x5832('0x46')](_0x42992c[_0x5832('0x42')],{'$or':_['map'](_0x42992c['attributes'],function(_0x54b5b4){var _0x168d91={};_0x168d91[_0x54b5b4]={'$like':'%'+_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x45')]+'%'};return _0x168d91;})});}if(_0xc5c8f0['query'][_0x5832('0x62')]){var _0x173452=_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x62')]['split'](',');var _0x4dcde4={};_0x4dcde4[_0x173452[0x0]]={'$gte':moment(_0x173452[0x1])[_0x5832('0x63')](_0x5832('0x64'))};_0x42992c['where']=_['merge'](_0x42992c[_0x5832('0x42')],_0x4dcde4);}_0x42992c=_[_0x5832('0x46')]({},_0x42992c,_0xc5c8f0[_0x5832('0x47')]);return _0x496077[_0x5832('0x65')](_0x42992c);}})[_0x5832('0x20')](function(_0x1d524c){if(_0x1d524c){_0x11a091=_0x1d524c[_0x5832('0x3d')];if(!_0xc5c8f0[_0x5832('0x3a')]['hasOwnProperty'](_0x5832('0x3e'))){_0x42992c[_0x5832('0x3f')]=qs[_0x5832('0x3f')](_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x3f')]);_0x42992c[_0x5832('0x2e')]=qs[_0x5832('0x2e')](_0xc5c8f0[_0x5832('0x3a')][_0x5832('0x2e')]);}return _0x496077[_0x5832('0x65')](_0x42992c);}})[_0x5832('0x20')](function(_0x35ffbb){if(_0x35ffbb){return _0x35ffbb?{'count':_0x11a091,'rows':_0x35ffbb}:null;}})[_0x5832('0x20')](respondWithResult(_0x3b2cb6,null))[_0x5832('0x29')](handleError(_0x3b2cb6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 75c9100..4530c01 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(_0x5a461e,_0xe83e49){var _0x1fac23=function(_0x32517a){while(--_0x32517a){_0x5a461e['push'](_0x5a461e['shift']());}};_0x1fac23(++_0xe83e49);}(_0x2ef3,0xba));var _0x32ef=function(_0xd31c0d,_0x4000b5){_0xd31c0d=_0xd31c0d-0x0;var _0x2726c3=_0x2ef3[_0xd31c0d];return _0x2726c3;};'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(_0x3292ad,_0x193d81){var _0x28baa4=function(_0x2dd974){while(--_0x2dd974){_0x3292ad['push'](_0x3292ad['shift']());}};_0x28baa4(++_0x193d81);}(_0x0b0e,0x187));var _0xe0b0=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x0b0e[_0x500c0];return _0xdd146f;};'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 6de6fcd..a8a165e 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 _0xdb4b=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','util','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x38e730,_0x2e63b6){_0x38e730=_0x38e730-0x0;var _0x29b82e=_0xdb4b[_0x38e730];return _0x29b82e;};'use strict';var _=require('lodash');var util=require(_0xbdb4('0x0'));var logger=require('../../config/logger')(_0xbdb4('0x1'));var moment=require(_0xbdb4('0x2'));var BPromise=require(_0xbdb4('0x3'));var rp=require(_0xbdb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var attributes=require(_0xbdb4('0x7'));module[_0xbdb4('0x8')]=function(_0x1c69ed,_0x3c8252){return _0x1c69ed[_0xbdb4('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb4b=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','util','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0xdb4b[_0x563129];return _0x28d1a3;};'use strict';var _=require('lodash');var util=require(_0xbdb4('0x0'));var logger=require('../../config/logger')(_0xbdb4('0x1'));var moment=require(_0xbdb4('0x2'));var BPromise=require(_0xbdb4('0x3'));var rp=require(_0xbdb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var attributes=require(_0xbdb4('0x7'));module[_0xbdb4('0x8')]=function(_0x1c69ed,_0x3c8252){return _0x1c69ed[_0xbdb4('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b82be80..01d60a1 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 _0xdb92=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xdb92,0xe4));var _0x2db9=function(_0x2ff560,_0x20d5f2){_0x2ff560=_0x2ff560-0x0;var _0x40df3a=_0xdb92[_0x2ff560];return _0x40df3a;};'use strict';var _=require(_0x2db9('0x0'));var util=require(_0x2db9('0x1'));var moment=require(_0x2db9('0x2'));var BPromise=require(_0x2db9('0x3'));var rs=require(_0x2db9('0x4'));var fs=require('fs');var Redis=require(_0x2db9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2db9('0x6'));var logger=require(_0x2db9('0x7'))(_0x2db9('0x8'));var config=require(_0x2db9('0x9'));var jayson=require(_0x2db9('0xa'));var client=jayson[_0x2db9('0xb')][_0x2db9('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2db9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2db9('0xe'))(new Redis(config[_0x2db9('0xd')]));require(_0x2db9('0xf'))[_0x2db9('0x10')](socket);function respondWithRpcPromise(_0x48fef3,_0x2ac355,_0x372a55){return new BPromise(function(_0x1a3c94,_0x2808c5){return client[_0x2db9('0x11')](_0x48fef3,_0x372a55)['then'](function(_0x565e24){logger[_0x2db9('0x12')](_0x2db9('0x13'),_0x2ac355,'request\x20sent');logger['debug'](_0x2db9('0x14'),_0x2ac355,_0x2db9('0x15'),JSON[_0x2db9('0x16')](_0x565e24));if(_0x565e24[_0x2db9('0x17')]){if(_0x565e24[_0x2db9('0x17')][_0x2db9('0x18')]===0x1f4){logger['error'](_0x2db9('0x13'),_0x2ac355,_0x565e24[_0x2db9('0x17')][_0x2db9('0x19')]);return _0x2808c5(_0x565e24[_0x2db9('0x17')][_0x2db9('0x19')]);}logger[_0x2db9('0x17')](_0x2db9('0x13'),_0x2ac355,_0x565e24[_0x2db9('0x17')]['message']);return _0x1a3c94(_0x565e24['error']['message']);}else{logger[_0x2db9('0x12')](_0x2db9('0x13'),_0x2ac355,'request\x20sent');_0x1a3c94(_0x565e24[_0x2db9('0x1a')][_0x2db9('0x19')]);}})[_0x2db9('0x1b')](function(_0x545ad0){logger[_0x2db9('0x17')]('ChatGroup,\x20%s,\x20%s',_0x2ac355,_0x545ad0);_0x2808c5(_0x545ad0);});});} \ No newline at end of file +var _0x06af=['./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x1a5633,_0x38de2d){var _0x1c8d3b=function(_0x361885){while(--_0x361885){_0x1a5633['push'](_0x1a5633['shift']());}};_0x1c8d3b(++_0x38de2d);}(_0x06af,0x8e));var _0xf06a=function(_0x1444d9,_0x7c489a){_0x1444d9=_0x1444d9-0x0;var _0x5ee256=_0x06af[_0x1444d9];return _0x5ee256;};'use strict';var _=require(_0xf06a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf06a('0x1'));var rs=require(_0xf06a('0x2'));var fs=require('fs');var Redis=require(_0xf06a('0x3'));var db=require(_0xf06a('0x4'))['db'];var utils=require(_0xf06a('0x5'));var logger=require(_0xf06a('0x6'))(_0xf06a('0x7'));var config=require(_0xf06a('0x8'));var jayson=require(_0xf06a('0x9'));var client=jayson[_0xf06a('0xa')][_0xf06a('0xb')]({'port':0x232a});config[_0xf06a('0xc')]=_[_0xf06a('0xd')](config[_0xf06a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf06a('0xc')]));require(_0xf06a('0xe'))[_0xf06a('0xf')](socket);function respondWithRpcPromise(_0x42857c,_0x2367f2,_0x52c871){return new BPromise(function(_0x1f937b,_0x49e87f){return client['request'](_0x42857c,_0x52c871)[_0xf06a('0x10')](function(_0x3ee9d4){logger[_0xf06a('0x11')](_0xf06a('0x12'),_0x2367f2,'request\x20sent');logger[_0xf06a('0x13')](_0xf06a('0x14'),_0x2367f2,_0xf06a('0x15'),JSON['stringify'](_0x3ee9d4));if(_0x3ee9d4[_0xf06a('0x16')]){if(_0x3ee9d4['error'][_0xf06a('0x17')]===0x1f4){logger['error'](_0xf06a('0x12'),_0x2367f2,_0x3ee9d4['error'][_0xf06a('0x18')]);return _0x49e87f(_0x3ee9d4['error'][_0xf06a('0x18')]);}logger['error'](_0xf06a('0x12'),_0x2367f2,_0x3ee9d4[_0xf06a('0x16')]['message']);return _0x1f937b(_0x3ee9d4[_0xf06a('0x16')][_0xf06a('0x18')]);}else{logger[_0xf06a('0x11')]('ChatGroup,\x20%s,\x20%s',_0x2367f2,_0xf06a('0x15'));_0x1f937b(_0x3ee9d4[_0xf06a('0x19')][_0xf06a('0x18')]);}})['catch'](function(_0x5bddea){logger[_0xf06a('0x16')](_0xf06a('0x12'),_0x2367f2,_0x5bddea);_0x49e87f(_0x5bddea);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index af8c542..1d302cc 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 _0xd3c3=['emit','register','chatGroup:','./chatGroup.events','remove'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xd3c3,0xb7));var _0x3d3c=function(_0x2ece04,_0xfaae4e){_0x2ece04=_0x2ece04-0x0;var _0x545f5d=_0xd3c3[_0x2ece04];return _0x545f5d;};'use strict';var ChatGroupEvents=require(_0x3d3c('0x0'));var events=['save',_0x3d3c('0x1'),'update'];function createListener(_0x28094f,_0x3a916f){return function(_0x3a0246){_0x3a916f[_0x3d3c('0x2')](_0x28094f,_0x3a0246);};}function removeListener(_0x38e42f,_0x7c91a0){return function(){ChatGroupEvents['removeListener'](_0x38e42f,_0x7c91a0);};}exports[_0x3d3c('0x3')]=function(_0x3d081a){for(var _0x473afe=0x0,_0x32d063=events['length'];_0x473afe<_0x32d063;_0x473afe++){var _0x4bef31=events[_0x473afe];var _0x5f3a68=createListener(_0x3d3c('0x4')+_0x4bef31,_0x3d081a);ChatGroupEvents['on'](_0x4bef31,_0x5f3a68);}}; \ No newline at end of file +var _0xbf9b=['register','./chatGroup.events','update','removeListener'];(function(_0x1123b8,_0xc624e2){var _0x2c7dfd=function(_0x1cfcbf){while(--_0x1cfcbf){_0x1123b8['push'](_0x1123b8['shift']());}};_0x2c7dfd(++_0xc624e2);}(_0xbf9b,0x65));var _0xbbf9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbf9b[_0x565c49];return _0x20ca34;};'use strict';var ChatGroupEvents=require(_0xbbf9('0x0'));var events=['save','remove',_0xbbf9('0x1')];function createListener(_0x256e9c,_0x323975){return function(_0x3b0781){_0x323975['emit'](_0x256e9c,_0x3b0781);};}function removeListener(_0x2bf221,_0x4c3a26){return function(){ChatGroupEvents[_0xbbf9('0x2')](_0x2bf221,_0x4c3a26);};}exports[_0xbbf9('0x3')]=function(_0x9357fb){for(var _0x2f3fd4=0x0,_0x3fb3bd=events['length'];_0x2f3fd4<_0x3fb3bd;_0x2f3fd4++){var _0x50293e=events[_0x2f3fd4];var _0x3aabf2=createListener('chatGroup:'+_0x50293e,_0x9357fb);ChatGroupEvents['on'](_0x50293e,_0x3aabf2);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 01f9c6c..07c8698 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 _0x0284=['Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMessage','put','delete','removeMembers','exports','express'];(function(_0x397fc8,_0x3afb2f){var _0x8ad2f3=function(_0x29db39){while(--_0x29db39){_0x397fc8['push'](_0x397fc8['shift']());}};_0x8ad2f3(++_0x3afb2f);}(_0x0284,0x137));var _0x4028=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x0284[_0x510b98];return _0x45e775;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4028('0x0'));var router=express[_0x4028('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x4028('0x2'));var config=require(_0x4028('0x3'));var controller=require(_0x4028('0x4'));router[_0x4028('0x5')]('/',auth[_0x4028('0x6')](),controller[_0x4028('0x7')]);router[_0x4028('0x5')](_0x4028('0x8'),auth[_0x4028('0x6')](),controller[_0x4028('0x9')]);router[_0x4028('0x5')](_0x4028('0xa'),auth[_0x4028('0x6')](),controller[_0x4028('0xb')]);router['get'](_0x4028('0xc'),auth['isAuthenticated'](),controller[_0x4028('0xd')]);router['get'](_0x4028('0xe'),auth[_0x4028('0x6')](),controller['getMembers']);router['get'](_0x4028('0xf'),auth[_0x4028('0x6')](),controller[_0x4028('0x10')]);router[_0x4028('0x11')]('/',auth[_0x4028('0x6')](),controller[_0x4028('0x12')]);router[_0x4028('0x11')](_0x4028('0xe'),auth[_0x4028('0x6')](),controller['addMembers']);router['post'](_0x4028('0xf'),auth[_0x4028('0x6')](),controller[_0x4028('0x13')]);router[_0x4028('0x14')](_0x4028('0xa'),auth[_0x4028('0x6')](),controller['update']);router[_0x4028('0x15')](_0x4028('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0x4028('0x15')](_0x4028('0xe'),auth[_0x4028('0x6')](),controller[_0x4028('0x16')]);module[_0x4028('0x17')]=router; \ No newline at end of file +var _0x985f=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x260024,_0x53d2bb){var _0x31216c=function(_0x1a781b){while(--_0x1a781b){_0x260024['push'](_0x260024['shift']());}};_0x31216c(++_0x53d2bb);}(_0x985f,0xeb));var _0xf985=function(_0x313014,_0x375ea6){_0x313014=_0x313014-0x0;var _0x39e670=_0x985f[_0x313014];return _0x39e670;};'use strict';var multer=require(_0xf985('0x0'));var util=require('util');var path=require(_0xf985('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf985('0x2')]();var auth=require(_0xf985('0x3'));var interaction=require(_0xf985('0x4'));var config=require(_0xf985('0x5'));var controller=require(_0xf985('0x6'));router[_0xf985('0x7')]('/',auth[_0xf985('0x8')](),controller[_0xf985('0x9')]);router['get'](_0xf985('0xa'),auth[_0xf985('0x8')](),controller[_0xf985('0xb')]);router[_0xf985('0x7')](_0xf985('0xc'),auth['isAuthenticated'](),controller[_0xf985('0xd')]);router[_0xf985('0x7')](_0xf985('0xe'),auth[_0xf985('0x8')](),controller[_0xf985('0xf')]);router[_0xf985('0x7')](_0xf985('0x10'),auth['isAuthenticated'](),controller[_0xf985('0x11')]);router[_0xf985('0x7')](_0xf985('0x12'),auth[_0xf985('0x8')](),controller[_0xf985('0x13')]);router['post']('/',auth[_0xf985('0x8')](),controller[_0xf985('0x14')]);router[_0xf985('0x15')]('/:id/members',auth[_0xf985('0x8')](),controller[_0xf985('0x16')]);router[_0xf985('0x15')](_0xf985('0x12'),auth[_0xf985('0x8')](),controller[_0xf985('0x17')]);router[_0xf985('0x18')](_0xf985('0xc'),auth['isAuthenticated'](),controller[_0xf985('0x19')]);router[_0xf985('0x1a')](_0xf985('0xc'),auth['isAuthenticated'](),controller[_0xf985('0x1b')]);router[_0xf985('0x1a')](_0xf985('0x10'),auth['isAuthenticated'](),controller[_0xf985('0x1c')]);module[_0xf985('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b57390b..82196d1 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 _0xe19e=['TEXT','STRING','DATE','long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x120ab8,_0x577eb9){var _0x597e51=function(_0x165bf4){while(--_0x165bf4){_0x120ab8['push'](_0x120ab8['shift']());}};_0x597e51(++_0x577eb9);}(_0xe19e,0x93));var _0xee19=function(_0x3d2673,_0x780770){_0x3d2673=_0x3d2673-0x0;var _0x2a17b9=_0xe19e[_0x3d2673];return _0x2a17b9;};'use strict';var Sequelize=require(_0xee19('0x0'));module[_0xee19('0x1')]={'closed':{'type':Sequelize[_0xee19('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xee19('0x3')]},'ratingType':{'type':Sequelize[_0xee19('0x4')](_0xee19('0x5'),_0xee19('0x6')),'defaultValue':_0xee19('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xee19('0x7')]},'mailTranscript':{'type':Sequelize[_0xee19('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xee19('0x9')]},'disposition':{'type':Sequelize[_0xee19('0x8')]},'secondDisposition':{'type':Sequelize[_0xee19('0x8')]},'thirdDisposition':{'type':Sequelize[_0xee19('0x8')]},'note':{'type':Sequelize[_0xee19('0x8')]},'browserName':{'type':Sequelize[_0xee19('0x8')]},'browserVersion':{'type':Sequelize[_0xee19('0x8')]},'osName':{'type':Sequelize[_0xee19('0x8')]},'osVersion':{'type':Sequelize[_0xee19('0x8')]},'deviceModel':{'type':Sequelize[_0xee19('0x8')]},'deviceVendor':{'type':Sequelize[_0xee19('0x8')]},'deviceType':{'type':Sequelize[_0xee19('0x8')]},'referer':{'type':Sequelize[_0xee19('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xee19('0x7')](_0xee19('0xa'))},'read1stAt':{'type':Sequelize[_0xee19('0x9')]},'lastMsgAt':{'type':Sequelize[_0xee19('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xee19('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xee19('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xee19('0x7')]}}; \ No newline at end of file +var _0x4775=['DATE','STRING','long','out','exports','BOOLEAN','INTEGER','star','TEXT'];(function(_0x339b5d,_0x133e69){var _0x5a65c0=function(_0x46ba9d){while(--_0x46ba9d){_0x339b5d['push'](_0x339b5d['shift']());}};_0x5a65c0(++_0x133e69);}(_0x4775,0x82));var _0x5477=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0x4775[_0x5e1e25];return _0x548e5f;};'use strict';var Sequelize=require('sequelize');module[_0x5477('0x0')]={'closed':{'type':Sequelize[_0x5477('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5477('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x5477('0x3'),'thumb'),'defaultValue':_0x5477('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x5477('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5477('0x5')]},'disposition':{'type':Sequelize[_0x5477('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5477('0x6')]},'note':{'type':Sequelize[_0x5477('0x6')]},'browserName':{'type':Sequelize[_0x5477('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x5477('0x6')]},'osVersion':{'type':Sequelize[_0x5477('0x6')]},'deviceModel':{'type':Sequelize[_0x5477('0x6')]},'deviceVendor':{'type':Sequelize[_0x5477('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x5477('0x4')]},'customerIp':{'type':Sequelize[_0x5477('0x6')]},'formData':{'type':Sequelize[_0x5477('0x4')](_0x5477('0x7'))},'read1stAt':{'type':Sequelize[_0x5477('0x5')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5477('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5477('0x6')]},'customerPort':{'type':Sequelize[_0x5477('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x5477('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2e6820a..dcd33a3 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 _0x1177=['Chat','YYYY-MM-DD','Owner','N.A.','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','Users','fullname','TagIds','Tags','split','forEach','push','index','map','ChatInteraction','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','find','unreadMessages','value','`\x20=\x200','having','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','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','body','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','order','DESC','t.id\x20IN\x20?','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','params','includeAll','include','options','describe','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','create','updateAttributes','Interaction\x20already\x20assigned','closed','disposition','abandon','attachmentUpload','originalname','basename','file','filename','Attachment','attachmentDownload','Unauthorized','download','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','SendMail','sendMail','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','hasOwnProperty','includeAgent','alias','addTags','setTags','spread','Tag','emit','server','tmp','files','transcript-%d-%s.zip','Contact','firstName','lastName','attachments','Account','get','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','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'];(function(_0x1ced3a,_0x145290){var _0x2e08c0=function(_0x4a4768){while(--_0x4a4768){_0x1ced3a['push'](_0x1ced3a['shift']());}};_0x2e08c0(++_0x145290);}(_0x1177,0x143));var _0x7117=function(_0x34a27a,_0x553294){_0x34a27a=_0x34a27a-0x0;var _0x571547=_0x1177[_0x34a27a];return _0x571547;};'use strict';var pdf=require(_0x7117('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7117('0x1'));var zipdir=require(_0x7117('0x2'));var jsonpatch=require(_0x7117('0x3'));var rp=require('request-promise');var moment=require(_0x7117('0x4'));var BPromise=require(_0x7117('0x5'));var Mustache=require(_0x7117('0x6'));var util=require(_0x7117('0x7'));var path=require(_0x7117('0x8'));var sox=require(_0x7117('0x9'));var csv=require(_0x7117('0xa'));var ejs=require(_0x7117('0xb'));var fs=require('fs');var _=require(_0x7117('0xc'));var squel=require('squel');var crypto=require(_0x7117('0xd'));var jsforce=require(_0x7117('0xe'));var deskjs=require(_0x7117('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7117('0x10'));var Papa=require(_0x7117('0x11'));var Redis=require(_0x7117('0x12'));var authService=require(_0x7117('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7117('0x14'));var hardwareService=require(_0x7117('0x15'));var logger=require('../../config/logger')(_0x7117('0x16'));var utils=require(_0x7117('0x17'));var config=require(_0x7117('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7117('0x19')]=_[_0x7117('0x1a')](config['redis'],{'host':_0x7117('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0x7117('0x1c')](socket);var jayson=require(_0x7117('0x1d'));var client=jayson[_0x7117('0x1e')][_0x7117('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0x7117('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5f1be9,_0xe683af,_0x3c3a27,_0xab07a0){return new BPromise(function(_0xe83a89,_0x543ec6){var _0x227066=_0xab07a0||client;return _0x227066[_0x7117('0x20')](_0x5f1be9,_0x3c3a27)['then'](function(_0x5b8bbd){logger[_0x7117('0x21')](_0x7117('0x22'),_0xe683af,'request\x20sent');logger[_0x7117('0x23')](_0x7117('0x24'),_0xe683af,_0x7117('0x25'),JSON[_0x7117('0x26')](_0x5b8bbd));if(_0x5b8bbd[_0x7117('0x27')]){if(_0x5b8bbd[_0x7117('0x27')]['code']===0x1f4){logger[_0x7117('0x27')]('ChatInteraction,\x20%s,\x20%s',_0xe683af,_0x5b8bbd[_0x7117('0x27')][_0x7117('0x28')]);return _0x543ec6(_0x5b8bbd[_0x7117('0x27')][_0x7117('0x28')]);}logger['error'](_0x7117('0x22'),_0xe683af,_0x5b8bbd[_0x7117('0x27')][_0x7117('0x28')]);return _0xe83a89(_0x5b8bbd[_0x7117('0x27')]['message']);}else{logger[_0x7117('0x21')](_0x7117('0x22'),_0xe683af,_0x7117('0x25'));_0xe83a89(_0x5b8bbd[_0x7117('0x29')]['message']);}})[_0x7117('0x2a')](function(_0x5e4033){logger[_0x7117('0x27')]('ChatInteraction,\x20%s,\x20%s',_0xe683af,_0x5e4033);_0x543ec6(_0x5e4033);});});}function respondWithStatusCode(_0x43aba2,_0x3641e5){_0x3641e5=_0x3641e5||0xcc;return function(_0x407126){if(_0x407126){return _0x43aba2[_0x7117('0x2b')](_0x3641e5);}return _0x43aba2[_0x7117('0x2c')](_0x3641e5)['end']();};}function respondWithResult(_0xb28511,_0xdd1b4f){_0xdd1b4f=_0xdd1b4f||0xc8;return function(_0x190001){if(_0x190001){return _0xb28511[_0x7117('0x2c')](_0xdd1b4f)[_0x7117('0x2d')](_0x190001);}};}function respondWithFilteredResult(_0x1eb600,_0x18315e){return function(_0x140eff){if(_0x140eff){var _0x204389=_0x140eff[_0x7117('0x2e')],_0x581be0=_0x18315e[_0x7117('0x2f')],_0x50f967=_0x18315e[_0x7117('0x2f')]+_0x18315e[_0x7117('0x30')],_0xc0b12c;if(_0x50f967>=_0x204389){_0x50f967=_0x204389;_0xc0b12c=0xc8;}else{_0xc0b12c=0xce;}_0x1eb600[_0x7117('0x2c')](_0xc0b12c);return _0x1eb600[_0x7117('0x31')](_0x7117('0x32'),_0x581be0+'-'+_0x50f967+'/'+_0x204389)[_0x7117('0x2d')](_0x140eff);}return null;};}function patchUpdates(_0x14fdec){return function(_0x1fd401){try{jsonpatch[_0x7117('0x33')](_0x1fd401,_0x14fdec,!![]);}catch(_0x651b1d){return BPromise[_0x7117('0x34')](_0x651b1d);}return _0x1fd401[_0x7117('0x35')]();};}function saveUpdates(_0x129471,_0x143529){return function(_0x465fa3){if(_0x465fa3){return _0x465fa3[_0x7117('0x36')](_0x129471)['then'](function(_0x48dcb5){return _0x48dcb5;});}return null;};}function removeEntity(_0xdd12a4,_0x1a6f44){return function(_0x423459){if(_0x423459){return _0x423459[_0x7117('0x37')]()[_0x7117('0x38')](function(){_0xdd12a4[_0x7117('0x2c')](0xcc)[_0x7117('0x39')]();});}};}function handleEntityNotFound(_0x5ce8ae,_0x4d4959){return function(_0x8a0ac4){if(!_0x8a0ac4){_0x5ce8ae[_0x7117('0x2b')](0x194);}return _0x8a0ac4;};}function handleError(_0x2aeaae,_0x160d1b){_0x160d1b=_0x160d1b||0x1f4;return function(_0x242c90){logger[_0x7117('0x27')](_0x242c90[_0x7117('0x3a')]);if(_0x242c90['name']){delete _0x242c90[_0x7117('0x3b')];}_0x2aeaae[_0x7117('0x2c')](_0x160d1b)['send'](_0x242c90);};}function getInteractionUsers(_0x82154d,_0x2e88aa){return new BPromise(function(_0x57eb89,_0x1039dd){try{if(_0x2e88aa[_0x82154d['id']]){_0x82154d[_0x7117('0x3c')]=_['map'](_0x2e88aa[_0x82154d['id']],function(_0x387e27){return{'id':_0x387e27['id'],'fullname':_0x387e27[_0x7117('0x3d')]};});}}catch(_0x5139e7){_0x1039dd(_0x5139e7);}_0x57eb89(_0x82154d);});}function getInteractionTags(_0x2842ec,_0x38f480){return new BPromise(function(_0x4fb963,_0x1dd284){try{if(_0x2842ec[_0x7117('0x3e')]){_0x2842ec[_0x7117('0x3f')]=[];_0x2842ec[_0x7117('0x3e')][_0x7117('0x40')](',')[_0x7117('0x41')](function(_0x50fecc){_0x2842ec[_0x7117('0x3f')][_0x7117('0x42')](_0x38f480[_0x50fecc]);});}delete _0x2842ec[_0x7117('0x3e')];}catch(_0x39e60e){_0x1dd284(_0x39e60e);}_0x4fb963(_0x2842ec);});}function updateChatInteraction(_0x56cd80,_0x21742a,_0x7397fe){return new BPromise(function(_0x3aa997,_0x1879ad){return getInteractionUsers(_0x56cd80,_0x7397fe)[_0x7117('0x38')](function(_0x3e9188){return getInteractionTags(_0x3e9188,_0x21742a);})[_0x7117('0x38')](function(_0x8e546b){_0x3aa997(_0x8e546b);})[_0x7117('0x2a')](function(_0x4b80b3){_0x1879ad(_0x4b80b3);});});}exports[_0x7117('0x43')]=function(_0x4bc8a4,_0x476101){var _0xdc4c94={},_0x3fb8ed={},_0x1f6b52={'count':0x0,'rows':[]};var _0x287617=_[_0x7117('0x44')](db[_0x7117('0x45')]['rawAttributes'],function(_0x1899dd){return{'name':_0x1899dd[_0x7117('0x46')],'type':_0x1899dd['type'][_0x7117('0x47')]};});_0x3fb8ed[_0x7117('0x48')]=_['map'](_0x287617,'name');_0x3fb8ed[_0x7117('0x49')]=_[_0x7117('0x4a')](_0x4bc8a4[_0x7117('0x49')]);_0x3fb8ed[_0x7117('0x4b')]=_[_0x7117('0x4c')](_0x3fb8ed[_0x7117('0x48')],_0x3fb8ed['query']);_0xdc4c94[_0x7117('0x4d')]=_[_0x7117('0x4c')](_0x3fb8ed[_0x7117('0x48')],qs['fields'](_0x4bc8a4[_0x7117('0x49')][_0x7117('0x4e')]));_0xdc4c94[_0x7117('0x4d')]=_0xdc4c94['attributes'][_0x7117('0x4f')]?_0xdc4c94[_0x7117('0x4d')]:_0x3fb8ed[_0x7117('0x48')];if(!_0x4bc8a4['query']['hasOwnProperty'](_0x7117('0x50'))){_0xdc4c94[_0x7117('0x30')]=qs[_0x7117('0x30')](_0x4bc8a4[_0x7117('0x49')][_0x7117('0x30')]);_0xdc4c94['offset']=qs['offset'](_0x4bc8a4[_0x7117('0x49')][_0x7117('0x2f')]);}_0xdc4c94['order']=qs[_0x7117('0x51')](_0x4bc8a4['query']['sort']);_0xdc4c94[_0x7117('0x52')]=qs['filters'](_[_0x7117('0x53')](_0x4bc8a4[_0x7117('0x49')],_0x3fb8ed[_0x7117('0x4b')]),_0x287617);var _0x487846=[];var _0x17933b=squel[_0x7117('0x54')]()[_0x7117('0x55')]('id')[_0x7117('0x55')](_0x7117('0x3b'))[_0x7117('0x55')](_0x7117('0x56'))['from'](_0x7117('0x57'));var _0x161b33=squel[_0x7117('0x54')]()[_0x7117('0x55')](_0x7117('0x58'))[_0x7117('0x55')](_0x7117('0x59'))['field'](_0x7117('0x5a'))['from'](_0x7117('0x5b'),'ui')[_0x7117('0x5c')](_0x7117('0x5d'),'u',_0x7117('0x5e'));var _0x32badf=squel['select']()['from']('chat_interactions','i')['left_join'](_0x7117('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x7117('0x60'))['left_join'](_0x7117('0x61'),'a',_0x7117('0x62'))[_0x7117('0x5c')](_0x7117('0x63'),'me',_0x7117('0x64'))[_0x7117('0x5c')](_0x7117('0x65'),'it',_0x7117('0x66'))['left_join'](_0x7117('0x57'),'t','t.id\x20=\x20it.TagId');var _0x5b89e0=squel[_0x7117('0x67')]();var _0x52dd7c=[];var _0x47f74f=squel[_0x7117('0x67')]();var _0x1f32e9;if(_0x4bc8a4[_0x7117('0x49')]['search']){_0x1f32e9=as[_0x7117('0x68')](_0x4bc8a4[_0x7117('0x49')][_0x7117('0x69')]);var _0x53594c=_0x1f32e9['sqlOperator'];for(var _0x46a3a7=0x0;_0x46a3a7<_0x1f32e9[_0x7117('0x6a')][_0x7117('0x4f')];_0x46a3a7++){var _0x1ed9e0=_0x1f32e9['conditions'][_0x46a3a7];var _0x239c65='i';var _0x48d350=_[_0x7117('0x6b')](_0x287617,[_0x7117('0x3b'),_0x1ed9e0[_0x7117('0x55')]]);if(!_0x48d350){switch(_0x1ed9e0[_0x7117('0x55')]){case _0x7117('0x6c'):if(_0x1ed9e0[_0x7117('0x6d')]==0x1){_0x32badf['having']('`'+_0x1ed9e0[_0x7117('0x55')]+_0x7117('0x6e'));}else{_0x32badf[_0x7117('0x6f')]('`'+_0x1ed9e0[_0x7117('0x55')]+'`\x20>\x200');}break;case'Contact':if(_0x1ed9e0[_0x7117('0x70')]===_0x7117('0x71')){if(_0x1ed9e0['value'][_0x7117('0x40')]('\x20')[_0x7117('0x4f')]>0x1){_0x5b89e0[_0x53594c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7117('0x72')](_0x1ed9e0[_0x7117('0x6d')]),null);}else{var _0x68a46b='%'+_0x1ed9e0['value']+'%';_0x5b89e0[_0x53594c](_0x7117('0x73'),_0x68a46b,_0x68a46b,_0x68a46b);}}else{_0x48d350=_[_0x7117('0x6b')](_0x287617,[_0x7117('0x3b'),_0x7117('0x74')]);_0x1ed9e0[_0x7117('0x55')]='ContactId';_0x2d88c8=as[_0x7117('0x75')](_0x239c65,_0x48d350[_0x7117('0x76')],_0x1ed9e0);_0x5b89e0[_0x53594c](_0x2d88c8[_0x7117('0x77')],_0x2d88c8[_0x7117('0x6d')][_0x7117('0x78')],_0x2d88c8[_0x7117('0x6d')][_0x7117('0x39')]);}break;case'Tag':var _0x1c9c04=_0x1ed9e0['value'][_0x7117('0x40')](',')[_0x7117('0x44')](function(_0x2078e9){return Number(_0x2078e9);});_0x1c9c04[_0x7117('0x41')](function(_0x1ec9ba){_0x47f74f['or'](_0x7117('0x79'),'%,'+_0x1ec9ba+',%');});_0x52dd7c=_[_0x7117('0x7a')](_0x52dd7c,_0x1c9c04);break;case _0x7117('0x7b'):if(_0x1ed9e0[_0x7117('0x70')]===_0x7117('0x71')){_0x5b89e0[_0x53594c](_0x7117('0x7c'),'%'+_0x1ed9e0[_0x7117('0x6d')]+'%',null);}else{_0x48d350=_[_0x7117('0x6b')](_0x287617,['name',_0x7117('0x7d')]);_0x1ed9e0[_0x7117('0x55')]='UserId';_0x2d88c8=as['buildExpression'](_0x239c65,_0x48d350['type'],_0x1ed9e0);_0x5b89e0[_0x53594c](_0x2d88c8[_0x7117('0x77')],_0x2d88c8['value'][_0x7117('0x78')],_0x2d88c8[_0x7117('0x6d')]['end']);}break;case _0x7117('0x7e'):_0x2d88c8=as[_0x7117('0x75')]('me',null,_0x1ed9e0);_0x5b89e0[_0x53594c](_0x2d88c8[_0x7117('0x77')],_0x2d88c8[_0x7117('0x6d')][_0x7117('0x78')],_0x2d88c8[_0x7117('0x6d')][_0x7117('0x39')]);break;}}else{var _0x2d88c8=as[_0x7117('0x75')](_0x239c65,_0x48d350[_0x7117('0x76')],_0x1ed9e0);_0x5b89e0[_0x53594c](_0x2d88c8[_0x7117('0x77')],_0x2d88c8[_0x7117('0x6d')]['start'],_0x2d88c8[_0x7117('0x6d')]['end']);}}}else{var _0xf3cecf=_(_0x4bc8a4[_0x7117('0x49')])[_0x7117('0x4a')]()[_0x7117('0x44')](function(_0x30f620){return _[_0x7117('0x7f')](_0x287617,[_0x7117('0x3b'),_0x30f620])?_0x30f620:undefined;})[_0x7117('0x80')]()[_0x7117('0x6d')]();if(!_[_0x7117('0x81')](_0xf3cecf)){_0xf3cecf[_0x7117('0x41')](function(_0x49d1e6){if(_0x49d1e6==='ChatWebsiteId'){_0x32badf['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x7117('0x82')](_0x4bc8a4[_0x7117('0x49')][_0x49d1e6]));}else if(_0x49d1e6===_0x7117('0x83')){var _0x7fd710=JSON[_0x7117('0x84')](_0x4bc8a4[_0x7117('0x49')][_0x49d1e6])[_0x7117('0x85')];var _0x25aaea=JSON[_0x7117('0x84')](_0x4bc8a4[_0x7117('0x49')][_0x49d1e6])[_0x7117('0x86')];_0x32badf[_0x7117('0x52')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7fd710,_0x25aaea);}else{if(_0x4bc8a4[_0x7117('0x49')][_0x49d1e6]===_0x7117('0x87')){_0x32badf['where']('i.'+_0x49d1e6+_0x7117('0x88'));}else{_0x32badf[_0x7117('0x52')]('i.'+_0x49d1e6+'\x20=\x20?',_0x4bc8a4[_0x7117('0x49')][_0x49d1e6]);}}});}if(_0x4bc8a4['query'][_0x7117('0x89')]){if(_0x4bc8a4[_0x7117('0x49')][_0x7117('0x89')]==0x1){_0x32badf[_0x7117('0x6f')](_0x7117('0x8a'));}else{_0x32badf[_0x7117('0x6f')](_0x7117('0x8b'));}}if(_0x4bc8a4[_0x7117('0x49')]['tag']){_0x52dd7c=_[_0x7117('0x8c')](_0x4bc8a4[_0x7117('0x49')][_0x7117('0x8d')])?_0x4bc8a4[_0x7117('0x49')][_0x7117('0x8d')]:new Array(_0x4bc8a4['query'][_0x7117('0x8d')]);_0x52dd7c[_0x7117('0x41')](function(_0x20ba6b){_0x47f74f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20ba6b+',%');});}if(_0x4bc8a4[_0x7117('0x49')]['filter']){var _0x186685=_0x4bc8a4[_0x7117('0x49')][_0x7117('0x8e')][_0x7117('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7117('0x90')](_0x186685)){_0x5b89e0['or'](_0x7117('0x91'),_0x186685+'%');}else{_0x5b89e0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x186685))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x186685+'%');}}}_0x32badf['where'](_0x5b89e0);_0x32badf[_0x7117('0x92')]('i.id');var _0x6f0230={'type':db[_0x7117('0x93')][_0x7117('0x94')][_0x7117('0x95')],'raw':!![]};var _0x5ec748=_0x32badf[_0x7117('0x96')]();_0x5ec748[_0x7117('0x55')](_0x7117('0x97'));_0x5ec748['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7117('0x6c'));if(_0xdc4c94[_0x7117('0x98')]){_0xdc4c94[_0x7117('0x98')][_0x7117('0x41')](function(_0x5be58c){var _0x250b6d=_0x5be58c[0x0]==='contactName'?_0x5be58c[0x0]:'i.'+_0x5be58c[0x0];_0x32badf[_0x7117('0x98')](_0x250b6d,_0x5be58c[0x1]===_0x7117('0x99')?![]:!![]);});}if(!_[_0x7117('0x81')](_0x52dd7c)){_0x32badf[_0x7117('0x6f')](_0x47f74f);_0x5ec748[_0x7117('0x52')](_0x7117('0x9a'),_0x52dd7c);}BPromise['resolve']()[_0x7117('0x38')](function(){if(!_0x1f32e9){if(_0x4bc8a4[_0x7117('0x49')][_0x7117('0x9b')]||_0x4bc8a4[_0x7117('0x49')][_0x7117('0x9c')])return;_0x5ec748[_0x7117('0x52')](_0x7117('0x9d'));_0x32badf['where'](_0x7117('0x9d'));return;}if(_0x4bc8a4[_0x7117('0x9e')]['role']!=='agent')return;return _0x4bc8a4[_0x7117('0x9e')][_0x7117('0x9f')]({'attributes':['id'],'raw':!![]})[_0x7117('0x38')](function(_0x5925c7){if(_[_0x7117('0x81')](_0x5925c7)){_0x5ec748[_0x7117('0x52')](_0x7117('0xa0'));_0x32badf[_0x7117('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5ec748[_0x7117('0x52')](_0x7117('0xa1'),_[_0x7117('0x44')](_0x5925c7,'id'));_0x32badf['where'](_0x7117('0xa1'),_['map'](_0x5925c7,'id'));}});})[_0x7117('0x38')](function(){if(_0x4bc8a4[_0x7117('0x9e')][_0x7117('0xa2')]==='agent'&&!_0x1f32e9&&!_0x4bc8a4['query'][_0x7117('0x9b')])return[];return db[_0x7117('0xa3')][_0x7117('0x49')](_0x5ec748[_0x7117('0xa4')](),_0x6f0230);})[_0x7117('0x38')](function(_0x35fd25){_0x1f6b52[_0x7117('0x2e')]=_0x35fd25['length'];if(_0x1f6b52[_0x7117('0x2e')]===0x0)return[];return db['sequelize'][_0x7117('0x49')](_0x17933b[_0x7117('0xa4')](),_0x6f0230)[_0x7117('0x38')](function(_0x3d29cb){_0x487846=_['keyBy'](_0x3d29cb,'id');_0x6f0230=_[_0x7117('0xa5')](_0x6f0230,{'model':db[_0x7117('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bc8a4[_0x7117('0x49')]['fields']){_0xdc4c94[_0x7117('0x4d')][_0x7117('0x41')](function(_0x3fac73){_0x32badf[_0x7117('0x55')]('i.'+_0x3fac73);});}else{_0x32badf[_0x7117('0x55')](_0x7117('0xa6'),_0x7117('0x6c'));_0x32badf[_0x7117('0x55')]('a.key',_0x7117('0xa7'));_0x32badf[_0x7117('0x55')]('a.mandatoryDisposition',_0x7117('0xa8'));_0x32badf['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',_0x7117('0xa9'));_0x32badf[_0x7117('0x55')](_0x7117('0xaa'));_0x32badf['field'](_0x7117('0xab'),_0x7117('0xac'));_0x32badf[_0x7117('0x55')]('c.lastName',_0x7117('0xad'));_0x32badf[_0x7117('0x55')](_0x7117('0xae'),_0x7117('0xaf'));_0x32badf[_0x7117('0x55')](_0x7117('0xb0'),_0x7117('0xb1'));_0x32badf[_0x7117('0x55')](_0x7117('0xb2'),_0x7117('0xb3'));_0x32badf[_0x7117('0x55')](_0x7117('0xb4'),_0x7117('0xb5'));_0x32badf[_0x7117('0x55')](_0x7117('0xb6'),'Owner.fullname');_0x32badf['field'](_0x7117('0xb7'),_0x7117('0xb8'));_0x32badf['field'](_0x7117('0xb9'),'TagIds');}if(_0xdc4c94[_0x7117('0x30')])_0x32badf[_0x7117('0x30')](_0xdc4c94[_0x7117('0x30')]);if(_0xdc4c94[_0x7117('0x2f')])_0x32badf[_0x7117('0x2f')](_0xdc4c94['offset']);return db[_0x7117('0xa3')][_0x7117('0x49')](_0x32badf['toString'](),_0x6f0230);})[_0x7117('0x38')](function(_0xf63bd4){_0x161b33[_0x7117('0x52')](_0x7117('0xba'),_[_0x7117('0x44')](_0xf63bd4,'id'));return db[_0x7117('0xa3')]['query'](_0x161b33[_0x7117('0xa4')](),_0x6f0230)['then'](function(_0x20eaf1){var _0x19118d=_[_0x7117('0xbb')](_0x20eaf1,_0x7117('0xbc'));var _0x2e4f85=[];_0xf63bd4['forEach'](function(_0x58e2c1){_0x2e4f85[_0x7117('0x42')](updateChatInteraction(_0x58e2c1,_0x487846,_0x19118d));});return BPromise['all'](_0x2e4f85);});});})[_0x7117('0x38')](function(_0x1051f4){_0x1f6b52['rows']=_0x1051f4;return _0x1f6b52;})[_0x7117('0x38')](respondWithFilteredResult(_0x476101,_0xdc4c94))[_0x7117('0x2a')](handleError(_0x476101,null));};exports['show']=function(_0x23470d,_0x473dbb){var _0x273740={'raw':![],'where':{'id':_0x23470d[_0x7117('0xbd')]['id']}},_0x170d1c={};_0x170d1c[_0x7117('0x48')]=_[_0x7117('0x4a')](db[_0x7117('0x45')]['rawAttributes']);_0x170d1c['query']=_[_0x7117('0x4a')](_0x23470d['query']);_0x170d1c[_0x7117('0x4b')]=_[_0x7117('0x4c')](_0x170d1c[_0x7117('0x48')],_0x170d1c[_0x7117('0x49')]);_0x273740['attributes']=_[_0x7117('0x4c')](_0x170d1c[_0x7117('0x48')],qs[_0x7117('0x4e')](_0x23470d[_0x7117('0x49')][_0x7117('0x4e')]));_0x273740[_0x7117('0x4d')]=_0x273740[_0x7117('0x4d')][_0x7117('0x4f')]?_0x273740[_0x7117('0x4d')]:_0x170d1c['model'];if(_0x23470d['query'][_0x7117('0xbe')]){_0x273740[_0x7117('0xbf')]=[{'all':!![]}];}_0x273740=_[_0x7117('0xa5')]({},_0x273740,_0x23470d[_0x7117('0xc0')]);return db['ChatInteraction'][_0x7117('0x6b')](_0x273740)['then'](handleEntityNotFound(_0x473dbb,null))['then'](respondWithResult(_0x473dbb,null))[_0x7117('0x2a')](handleError(_0x473dbb,null));};exports['create']=function(_0x9d5373,_0x1130f0){return db['ChatInteraction']['create'](_0x9d5373[_0x7117('0x7e')],{})[_0x7117('0x38')](respondWithResult(_0x1130f0,0xc9))[_0x7117('0x2a')](handleError(_0x1130f0,null));};exports['update']=function(_0x2250cd,_0x141a6e){if(_0x2250cd[_0x7117('0x7e')]['id']){delete _0x2250cd['body']['id'];}return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x2250cd[_0x7117('0xbd')]['id']}})[_0x7117('0x38')](handleEntityNotFound(_0x141a6e,null))[_0x7117('0x38')](saveUpdates(_0x2250cd[_0x7117('0x7e')],null))[_0x7117('0x38')](respondWithResult(_0x141a6e,null))[_0x7117('0x2a')](handleError(_0x141a6e,null));};exports['destroy']=function(_0x49edce,_0x1d3b4f){return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x49edce['params']['id']}})['then'](handleEntityNotFound(_0x1d3b4f,null))[_0x7117('0x38')](removeEntity(_0x1d3b4f,null))[_0x7117('0x2a')](handleError(_0x1d3b4f,null));};exports[_0x7117('0xc1')]=function(_0x5360f2,_0x10b65a){return db[_0x7117('0x45')][_0x7117('0xc1')]()[_0x7117('0x38')](respondWithResult(_0x10b65a,null))['catch'](handleError(_0x10b65a,null));};exports['createVidaooSession']=function(_0xd7aa8e,_0x1e9653){var _0x64c941=_0xd7aa8e['params']['id'];var _0x136aad;var _0x3b39fb;var _0xc5ca5e;return db['ChatInteraction'][_0x7117('0xc2')]({'where':{'id':_0x64c941}})[_0x7117('0x38')](function(_0x327061){_0x136aad=_0x327061;return db[_0x7117('0xc3')][_0x7117('0xc2')]({'where':{'id':_0x327061['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x7117('0xc4')],'raw':!![]});})['then'](function(_0x35f43b){if(_0x35f43b&&_0x35f43b[_0x7117('0xc5')]&&_0x35f43b['vidaooEscalation']){_0x3b39fb=_0x35f43b;var _0xd0e8da={'rejectUnauthorized':![],'method':_0x7117('0xc6'),'uri':_0x7117('0xc7'),'headers':{'X-APIKEY':_0x35f43b[_0x7117('0xc5')]},'body':{'name':'MotionCWB:'+_0x64c941},'redirect':_0x7117('0xc8'),'json':!![]};return rp(_0xd0e8da);}else{throw new db[(_0x7117('0x93'))][(_0x7117('0xc9'))](_0x7117('0xca'));}})['then'](function(_0x5c5bdd){_0xc5ca5e=_0x5c5bdd;if(_0xc5ca5e['id']){var _0xd1eefa={'body':_0xc5ca5e['join_url'],'ChatWebsiteId':_0x3b39fb['id'],'ChatInteractionId':_0x136aad['id'],'direction':_0x7117('0xcb'),'UserId':_0xd7aa8e[_0x7117('0x9e')]['id']};return db[_0x7117('0xcc')][_0x7117('0xcd')](_0xd1eefa,{});}else{throw new db[(_0x7117('0x93'))][(_0x7117('0xc9'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x136aad[_0x7117('0xce')]({'vidaooSessionId':_0xc5ca5e['id']});})['then'](respondWithResult(_0x1e9653,null))[_0x7117('0x2a')](handleError(_0x1e9653,null));};exports['customUpdate']=function(_0x499c05,_0x530bd9){if(_0x499c05[_0x7117('0x7e')]['id']){delete _0x499c05[_0x7117('0x7e')]['id'];}return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x499c05['params']['id']}})[_0x7117('0x38')](handleEntityNotFound(_0x530bd9,null))[_0x7117('0x38')](saveUpdates(_0x499c05[_0x7117('0x7e')],null))[_0x7117('0x38')](respondWithResult(_0x530bd9,null))[_0x7117('0x2a')](handleError(_0x530bd9,null));};exports['abandon']=function(_0x29c8ea,_0x2e3904,_0x398eb1){if(_0x29c8ea[_0x7117('0x7e')]['id']){delete _0x29c8ea[_0x7117('0x7e')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x29c8ea[_0x7117('0xbd')]['id']}})[_0x7117('0x38')](function(_0x275518){if(!_0x275518){logger[_0x7117('0x27')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x2e3904['sendStatus'](0x194);}else{if(_0x275518[_0x7117('0x7d')]){throw new db[(_0x7117('0x93'))]['ValidationError'](_0x7117('0xcf'));}}return _0x275518;})[_0x7117('0x38')](function(_0x1947ee){if(_0x1947ee){return _0x1947ee[_0x7117('0x36')]({'closed':_0x29c8ea['body'][_0x7117('0xd0')],'disposition':_0x29c8ea[_0x7117('0x7e')][_0x7117('0xd1')]})[_0x7117('0x38')](function(_0x133de3){return _0x133de3;});}})['then'](function(_0x5d119d){return respondWithRpcPromise('AbandonInteraction',_0x7117('0xd2'),_0x29c8ea['body'],client9004);})[_0x7117('0x38')](respondWithResult(_0x2e3904,null))[_0x7117('0x2a')](handleError(_0x2e3904,null));};exports[_0x7117('0xd3')]=function(_0x586abe,_0x5a25b1,_0x47ddf4){_0x586abe[_0x7117('0x7e')][_0x7117('0x3b')]=_0x586abe['file'][_0x7117('0xd4')];_0x586abe[_0x7117('0x7e')][_0x7117('0xd5')]=_0x586abe[_0x7117('0xd6')][_0x7117('0xd7')];_0x586abe['body'][_0x7117('0x76')]=_0x586abe[_0x7117('0xd6')]['mimetype'];return db[_0x7117('0xd8')][_0x7117('0xcd')](_0x586abe['body'])[_0x7117('0x38')](respondWithResult(_0x5a25b1,0xc9))[_0x7117('0x2a')](handleError(_0x5a25b1,null));};exports[_0x7117('0xd9')]=function(_0x1637b5,_0x437abe,_0x2a6ec9){return db[_0x7117('0x45')][_0x7117('0xc2')]({'where':{'id':_0x1637b5[_0x7117('0xbd')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x437abe,null))[_0x7117('0x38')](function(_0x230076){if(_0x230076){if(_0x230076['closed']){return _0x437abe[_0x7117('0x2c')](0x193)[_0x7117('0x2d')]({'status':0x193,'message':_0x7117('0xda')});}return db[_0x7117('0xd8')][_0x7117('0xc2')]({'where':{'id':_0x1637b5[_0x7117('0x49')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x437abe,null));}})['then'](function(_0x386c59){if(_0x386c59){return _0x437abe[_0x7117('0xdb')](path[_0x7117('0xdc')](config[_0x7117('0xdd')],_0x7117('0xde'),_0x386c59['basename']));}})[_0x7117('0x2a')](handleError(_0x437abe,null));};exports['close']=function(_0x552fc5,_0x51c507){var _0x5da534=null;var _0x15c355=null;var _0xc5784a=null;var _0x1ebed5=null;if(_0x552fc5[_0x7117('0x7e')]['id']){delete _0x552fc5['body']['id'];}if(_0x552fc5[_0x7117('0x7e')][_0x7117('0xdf')]){_0x1ebed5=path[_0x7117('0xdc')](config[_0x7117('0xdd')],_0x7117('0xe0'),util[_0x7117('0xe1')](_0x7117('0xe2'),Date[_0x7117('0xe3')]()));_0x552fc5['body']['pathTranscript']=_0x1ebed5;}return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x552fc5[_0x7117('0xbd')]['id']},'include':[{'model':db[_0x7117('0xcc')],'as':_0x7117('0xe4'),'include':[{'model':db['User'],'as':_0x7117('0x7b')}]}]})[_0x7117('0x38')](handleEntityNotFound(_0x51c507,null))[_0x7117('0x38')](saveUpdates(_0x552fc5[_0x7117('0x7e')],null))[_0x7117('0x38')](function(_0x57e084){if(_0x57e084){_0x5da534=_0x57e084;return db[_0x7117('0xc3')][_0x7117('0x6b')]({'where':{'id':_0x5da534[_0x7117('0x9b')]}});}})[_0x7117('0x38')](function(_0xb85900){if(_0xb85900){_0xc5784a=_0xb85900;return db[_0x7117('0xe5')][_0x7117('0x6b')]({'where':{'id':_0x5da534[_0x7117('0x74')]}});}})[_0x7117('0x38')](function(_0x2c5b05){if(_0x2c5b05){_0x15c355=_0x2c5b05;if(_0x1ebed5){var _0x31d2cd=null;for(var _0x524a93=0x1;_0x524a93<_0x5da534['Messages'][_0x7117('0x4f')];++_0x524a93){_0x31d2cd=_0x5da534[_0x7117('0xe4')][_0x524a93];var _0x4dc37d=_0x31d2cd[_0x7117('0x7d')]?util[_0x7117('0xe1')](_0x7117('0xe6'),_0xc5784a[_0x7117('0xe7')],_0x31d2cd[_0x7117('0x7d')]):_0x7117('0xe8');var _0x37cd40=_0x552fc5['body']['customer']||util[_0x7117('0xe1')](_0x7117('0xe6'),_0x7117('0xe9'),_0x31d2cd['ContactId']);switch(_0xc5784a[_0x7117('0xea')]){case _0x7117('0xeb'):_0x4dc37d=_0x31d2cd[_0x7117('0x7d')]?util[_0x7117('0xe1')](_0x7117('0xe6'),_0xc5784a['agentAlias'],_0x31d2cd[_0x7117('0x7d')]):_0x7117('0xe8');break;case _0x7117('0xec'):_0x4dc37d=_0x31d2cd[_0x7117('0x7d')]?_0x31d2cd[_0x7117('0x7b')]['alias']||_0x31d2cd['User'][_0x7117('0x3d')]:'System';break;case _0x7117('0xed'):_0x4dc37d=_0x31d2cd['UserId']?_0x31d2cd['User'][_0x7117('0x3d')]:_0x7117('0xe8');break;default:_0x4dc37d=_0x31d2cd[_0x7117('0x7d')]?util[_0x7117('0xe1')](_0x7117('0xe6'),_0xc5784a['agentAlias'],_0x31d2cd['UserId']):_0x7117('0xe8');}var _0x255d49=util[_0x7117('0xe1')](_0x7117('0xee'),moment(_0x31d2cd[_0x7117('0x83')])['format'](_0x7117('0xef')),_0x31d2cd[_0x7117('0xf0')]==='in'?_0x37cd40:_0x4dc37d,_0x31d2cd['body']);if(!_0x31d2cd[_0x7117('0xf1')]){fs[_0x7117('0xf2')](_0x1ebed5,_0x255d49);}}return db[_0x7117('0xf3')][_0x7117('0xc2')]({'where':{'service':!![]},'include':[{'model':db[_0x7117('0xf4')],'as':_0x7117('0xf5'),'raw':!![]}]});}}})[_0x7117('0x38')](function(_0x35243d){if(_0x35243d&&_0x35243d[_0x7117('0xf5')]&&_0x552fc5[_0x7117('0x7e')]){var _0x3c49d3={'tls':{'rejectUnauthorized':![]}};if(_0x35243d['Smtp'][_0x7117('0xf6')]){_0x3c49d3[_0x7117('0xf6')]=_0x35243d[_0x7117('0xf5')][_0x7117('0xf6')];}else{_0x3c49d3[_0x7117('0xf7')]=_0x35243d[_0x7117('0xf5')][_0x7117('0xf7')];_0x3c49d3[_0x7117('0xf8')]=_0x35243d[_0x7117('0xf5')][_0x7117('0xf8')];_0x3c49d3[_0x7117('0xf9')]=_0x35243d[_0x7117('0xf5')][_0x7117('0xf9')];}if(_0x35243d[_0x7117('0xf5')]['authentication']){_0x3c49d3['auth']={'user':_0x35243d[_0x7117('0xf5')][_0x7117('0x9e')],'pass':_0x35243d['Smtp']['pass']};}return respondWithRpcPromise(_0x7117('0xfa'),_0x7117('0xfb'),{'account':_0x3c49d3,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x35243d[_0x7117('0x3b')],_0x35243d[_0x7117('0xfc')]||_0x35243d[_0x7117('0xf5')]['user']),'to':_0x552fc5[_0x7117('0x7e')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x7117('0xe1')](_0x7117('0xfd'),_0x552fc5[_0x7117('0x7e')][_0x7117('0xdf')]),'attachments':[{'path':_0x1ebed5}]}})[_0x7117('0x38')](function(){return _0x5da534;})[_0x7117('0x2a')](function(_0x566d52){console[_0x7117('0x27')](_0x566d52);});}else{return _0x5da534;}})[_0x7117('0x38')](respondWithStatusCode(_0x51c507,0xc8))[_0x7117('0x2a')](handleError(_0x51c507,null));};exports[_0x7117('0xfe')]=function(_0x324596,_0x37ab97,_0x43cc8d){return db[_0x7117('0xcc')][_0x7117('0x6b')]({'where':{'id':_0x324596['params']['id']}})['then'](handleEntityNotFound(_0x37ab97,null))[_0x7117('0x38')](function(_0x5ce927){if(_0x5ce927){return _0x5ce927['addMessage'](_0x324596[_0x7117('0x7e')][_0x7117('0xff')],_[_0x7117('0x100')](_0x324596[_0x7117('0x7e')],[_0x7117('0xff'),'id'])||{});}})[_0x7117('0x38')](respondWithResult(_0x37ab97,null))['catch'](handleError(_0x37ab97,null));};exports[_0x7117('0x101')]=function(_0x32d7f4,_0xf9dd26,_0x4f3aa5){var _0x24470e={'raw':![],'where':{}};var _0x455689={};var _0xeb7a02={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x32d7f4['params']['id']}})[_0x7117('0x38')](handleEntityNotFound(_0xf9dd26,null))[_0x7117('0x38')](function(_0x3d7677){if(_0x3d7677){_0x455689[_0x7117('0x48')]=_['keys'](db[_0x7117('0xcc')][_0x7117('0x102')]);_0x455689[_0x7117('0x49')]=_[_0x7117('0x4a')](_0x32d7f4[_0x7117('0x49')]);_0x455689[_0x7117('0x4b')]=_['intersection'](_0x455689[_0x7117('0x48')],_0x455689[_0x7117('0x49')]);_0x24470e['attributes']=_['intersection'](_0x455689[_0x7117('0x48')],qs[_0x7117('0x4e')](_0x32d7f4['query']['fields']));_0x24470e[_0x7117('0x4d')]=_0x24470e[_0x7117('0x4d')][_0x7117('0x4f')]?_0x24470e['attributes']:_0x455689[_0x7117('0x48')];if(!_0x32d7f4[_0x7117('0x49')]['hasOwnProperty'](_0x7117('0x50'))){_0x24470e[_0x7117('0x30')]=qs[_0x7117('0x30')](_0x32d7f4[_0x7117('0x49')][_0x7117('0x30')]);_0x24470e[_0x7117('0x2f')]=qs['offset'](_0x32d7f4[_0x7117('0x49')][_0x7117('0x2f')]);}_0x24470e[_0x7117('0x98')]=qs[_0x7117('0x51')](_0x32d7f4[_0x7117('0x49')][_0x7117('0x51')]);_0x24470e[_0x7117('0x52')]=qs[_0x7117('0x4b')](_['pick'](_0x32d7f4[_0x7117('0x49')],_0x455689[_0x7117('0x4b')]));_0x24470e['where'][_0x7117('0xbc')]=_0x3d7677['id'];if(_0x32d7f4[_0x7117('0x49')][_0x7117('0x8e')]){_0x24470e[_0x7117('0x52')]=_[_0x7117('0xa5')](_0x24470e[_0x7117('0x52')],{'$or':_['map'](_0x24470e['attributes'],function(_0x15eb2b){var _0x1048e1={};_0x1048e1[_0x15eb2b]={'$like':'%'+_0x32d7f4[_0x7117('0x49')][_0x7117('0x8e')]+'%'};return _0x1048e1;})});}if(_0x32d7f4['query'][_0x7117('0x85')]){var _0x1c7fb6=_0x32d7f4[_0x7117('0x49')][_0x7117('0x85')][_0x7117('0x40')](',');var _0xb95f8d={};_0xb95f8d[_0x1c7fb6[0x0]]={'$gte':moment(_0x1c7fb6[0x1])[_0x7117('0xe1')](_0x7117('0x103'))};_0x24470e[_0x7117('0x52')]=_[_0x7117('0xa5')](_0x24470e[_0x7117('0x52')],_0xb95f8d);}_0x24470e=_[_0x7117('0xa5')]({},_0x24470e,_0x32d7f4[_0x7117('0xc0')]);return db[_0x7117('0xcc')][_0x7117('0x2e')]({'where':_0x24470e[_0x7117('0x52')]})[_0x7117('0x38')](function(_0x5c306c){_0xeb7a02['count']=_0x5c306c;if(_0x32d7f4[_0x7117('0x49')]['includeAll']){_0x24470e[_0x7117('0xbf')]=[{'all':!![]}];}return db[_0x7117('0xcc')][_0x7117('0x104')](_0x24470e);})[_0x7117('0x38')](function(_0x5aaf7d){_0xeb7a02[_0x7117('0x105')]=_0x5aaf7d;return _0xeb7a02;});}})['then'](respondWithFilteredResult(_0xf9dd26,_0x24470e))[_0x7117('0x2a')](handleError(_0xf9dd26,null));};exports[_0x7117('0x106')]=function(_0x4dd01f,_0x57d7b6,_0x2d5e77){var _0x24eacf={'where':{}},_0x368a77={},_0x1c82c7={'count':0x0,'rows':[]};return db[_0x7117('0x45')]['findOne']({'where':{'id':_0x4dd01f[_0x7117('0xbd')]['id']}})[_0x7117('0x38')](handleEntityNotFound(_0x57d7b6,null))[_0x7117('0x38')](function(_0x40ad5a){if(_0x40ad5a){_0x368a77[_0x7117('0x48')]=_[_0x7117('0x4a')](db['ChatMessage'][_0x7117('0x102')]);_0x368a77[_0x7117('0x49')]=_['keys'](_0x4dd01f['query']);_0x368a77[_0x7117('0x4b')]=_['intersection'](_0x368a77[_0x7117('0x48')],_0x368a77['query']);_0x24eacf[_0x7117('0x4d')]=_['intersection'](_0x368a77[_0x7117('0x48')],qs[_0x7117('0x4e')](_0x4dd01f[_0x7117('0x49')][_0x7117('0x4e')]));_0x24eacf[_0x7117('0x4d')]=_0x24eacf[_0x7117('0x4d')][_0x7117('0x4f')]?_0x24eacf[_0x7117('0x4d')]:_0x368a77['model'];if(!_0x4dd01f['query'][_0x7117('0x107')](_0x7117('0x50'))){_0x24eacf[_0x7117('0x30')]=qs[_0x7117('0x30')](_0x4dd01f[_0x7117('0x49')][_0x7117('0x30')]);_0x24eacf['offset']=qs[_0x7117('0x2f')](_0x4dd01f[_0x7117('0x49')][_0x7117('0x2f')]);}_0x24eacf['order']=qs[_0x7117('0x51')](_0x4dd01f['query'][_0x7117('0x51')]);_0x24eacf[_0x7117('0x52')]=qs[_0x7117('0x4b')](_[_0x7117('0x53')](_0x4dd01f[_0x7117('0x49')],_0x368a77[_0x7117('0x4b')]));_0x24eacf['where'][_0x7117('0xbc')]=_0x40ad5a['id'];if(_0x4dd01f['query']['filter']){_0x24eacf['where']=_['merge'](_0x24eacf[_0x7117('0x52')],{'$or':_[_0x7117('0x44')](_0x24eacf[_0x7117('0x4d')],function(_0x240d7f){var _0x54a799={};_0x54a799[_0x240d7f]={'$like':'%'+_0x4dd01f[_0x7117('0x49')]['filter']+'%'};return _0x54a799;})});}_0x24eacf[_0x7117('0x52')]['secret']=![];if(_0x4dd01f[_0x7117('0x49')]['id']){_0x24eacf[_0x7117('0x52')]['id']={'$gt':_0x4dd01f[_0x7117('0x49')]['id']};}_0x24eacf=_[_0x7117('0xa5')]({},_0x24eacf,_0x4dd01f['options']);return db[_0x7117('0xcc')]['count']({'where':_0x24eacf['where']})['then'](function(_0x1a3418){_0x1c82c7[_0x7117('0x2e')]=_0x1a3418;_0x24eacf[_0x7117('0xbf')]=[];if(_0x4dd01f[_0x7117('0x49')][_0x7117('0x108')]){_0x24eacf[_0x7117('0xbf')]['push']({'model':db[_0x7117('0x7b')],'as':'User','attributes':['id',_0x7117('0x3d'),_0x7117('0x109')]});}if(_0x4dd01f[_0x7117('0x49')][_0x7117('0xbe')]){_0x24eacf[_0x7117('0xbf')]=[{'all':!![]}];}return db[_0x7117('0xcc')]['findAll'](_0x24eacf);})[_0x7117('0x38')](function(_0x47cb8d){_0x1c82c7['rows']=_0x47cb8d;return _0x1c82c7;});}})[_0x7117('0x38')](respondWithFilteredResult(_0x57d7b6,_0x24eacf))['catch'](handleError(_0x57d7b6,null));};exports[_0x7117('0x10a')]=function(_0x179dde,_0x5b57f0,_0x37c0ad){return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x179dde['params']['id']}})['then'](handleEntityNotFound(_0x5b57f0,null))['then'](function(_0x397398){if(_0x397398){return _0x397398[_0x7117('0x10b')](_0x179dde['body'][_0x7117('0xff')],_['omit'](_0x179dde['body'],[_0x7117('0xff'),'id'])||{})[_0x7117('0x10c')](function(){return db[_0x7117('0x10d')][_0x7117('0x104')]({'attributes':['id',_0x7117('0x3b'),_0x7117('0x56')],'where':{'id':_0x179dde[_0x7117('0x7e')][_0x7117('0xff')]}});})['then'](function(_0x5736a0){socket[_0x7117('0x10e')]('chatInteractionTags:save',{'id':Number(_0x179dde[_0x7117('0xbd')]['id']),'tags':_0x5736a0||[]});return{'id':Number(_0x179dde[_0x7117('0xbd')]['id']),'tags':_0x5736a0||[]};});}})[_0x7117('0x38')](respondWithResult(_0x5b57f0,null))['catch'](handleError(_0x5b57f0,null));};exports['removeTags']=function(_0x2b6c90,_0x3bc1d7,_0x5a59f5){return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x2b6c90[_0x7117('0xbd')]['id']}})[_0x7117('0x38')](handleEntityNotFound(_0x3bc1d7,null))[_0x7117('0x38')](function(_0x51a890){if(_0x51a890){return _0x51a890['removeTags'](_0x2b6c90['query'][_0x7117('0xff')]);}})[_0x7117('0x38')](respondWithStatusCode(_0x3bc1d7,null))['catch'](handleError(_0x3bc1d7,null));};exports[_0x7117('0xdb')]=function(_0x4df177,_0x1d6742){var _0x1e34ae=moment()['unix']()[_0x7117('0xa4')]();var _0x4d12ba=path['join'](config[_0x7117('0xdd')],_0x7117('0x10f'),'files',_0x7117('0x110'));var _0x2c92dd=path[_0x7117('0xdc')](config[_0x7117('0xdd')],_0x7117('0x10f'),_0x7117('0x111'),'attachments');var _0x28b6f8=path['join'](_0x4d12ba,_0x1e34ae);var _0x100d77=util[_0x7117('0xe1')](_0x7117('0x112'),_0x4df177[_0x7117('0xbd')]['id'],_0x1e34ae);var _0x4ee0ca=path[_0x7117('0xdc')](_0x4d12ba,_0x100d77);var _0x5b407b=[];_0x5b407b[_0x7117('0x42')]({'model':db[_0x7117('0x7b')],'as':_0x7117('0x7b'),'attributes':['id',_0x7117('0x3d')],'raw':!![]});_0x5b407b['push']({'model':db[_0x7117('0xe5')],'as':_0x7117('0x113'),'attributes':['id',_0x7117('0x114'),_0x7117('0x115')],'raw':!![]});if(_0x4df177[_0x7117('0x49')][_0x7117('0x116')]){_0x5b407b[_0x7117('0x42')]({'model':db[_0x7117('0xd8')],'as':'Attachment','raw':!![]});}var _0x5ab96f=[{'model':db[_0x7117('0xcc')],'as':_0x7117('0xe4'),'attributes':['id',_0x7117('0x7e'),_0x7117('0x83'),'direction',_0x7117('0xf1'),_0x7117('0x89')],'include':_0x5b407b}];_0x5ab96f[_0x7117('0x42')]({'model':db[_0x7117('0xc3')],'as':_0x7117('0x117'),'attributes':['id',_0x7117('0x3b')]});_0x5ab96f[_0x7117('0x42')]({'model':db[_0x7117('0x7b')],'as':'Owner','attributes':['id','fullname']});return db[_0x7117('0x45')][_0x7117('0x6b')]({'where':{'id':_0x4df177[_0x7117('0xbd')]['id']},'include':_0x5ab96f})[_0x7117('0x38')](handleEntityNotFound(_0x1d6742,null))['then'](function(_0x7e8e41){if(_0x7e8e41){var _0x3343e9=_0x7e8e41[_0x7117('0x118')]({'plain':!![]});fs['mkdirSync'](_0x28b6f8);var _0x3c81f6={'format':'A4','border':_0x7117('0x119'),'header':{'height':'40px','contents':{'first':_0x7117('0x11a')}},'footer':{'height':_0x7117('0x11b'),'contents':{'default':util[_0x7117('0xe1')](_0x7117('0x11c'),util[_0x7117('0xe1')]('%s\x20#%d',_0x7117('0x11d'),_0x3343e9['id']),moment()[_0x7117('0xe1')](_0x7117('0x11e'))[_0x7117('0xa4')]())}}};var _0x5bbad3={'channel':_0x7117('0x11d'),'account':_0x3343e9[_0x7117('0x117')][_0x7117('0x3b')],'agent':_0x3343e9[_0x7117('0x11f')]?_0x3343e9[_0x7117('0x11f')]['fullname']:_0x7117('0x120'),'createdAt':moment(_0x3343e9['createdAt'])[_0x7117('0xe1')](_0x7117('0x103'))['toString'](),'closedAt':_0x3343e9[_0x7117('0xd0')]?moment(_0x3343e9['closedAt'])['format'](_0x7117('0x103'))[_0x7117('0xa4')]():'','disposition':_0x3343e9[_0x7117('0xd1')],'chatInfo':{'browser':_0x3343e9[_0x7117('0x121')],'os':_0x3343e9[_0x7117('0x122')],'referer':_0x3343e9['referer'],'customerIp':_0x3343e9[_0x7117('0x123')],'customerPort':_0x3343e9['customerPort']?_0x3343e9[_0x7117('0x124')]:_0x7117('0x120')},'messages':_(_0x3343e9['Messages'])[_0x7117('0x125')]()[_0x7117('0x8e')]({'secret':![]})[_0x7117('0x44')](function(_0x27e7a1){if(_0x27e7a1[_0x7117('0xd8')]){var _0x3aeca7=path[_0x7117('0xdc')](_0x2c92dd,_0x27e7a1[_0x7117('0xd8')][_0x7117('0xd5')]);if(fs['existsSync'](_0x3aeca7)){fs[_0x7117('0x126')](_0x3aeca7)[_0x7117('0x127')](fs[_0x7117('0x128')](path['join'](_0x28b6f8,_0x27e7a1[_0x7117('0xd8')][_0x7117('0xd5')])));}}return{'date':moment(_0x27e7a1[_0x7117('0x83')])[_0x7117('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7117('0xa4')](),'sender':_0x27e7a1[_0x7117('0xf0')]===_0x7117('0xcb')?_0x27e7a1[_0x7117('0x7b')]?_0x27e7a1[_0x7117('0x7b')][_0x7117('0x3d')]:'System':_0x27e7a1[_0x7117('0x113')]['firstName']+(_0x27e7a1['Contact']['lastName']?'\x20'+_0x27e7a1[_0x7117('0x113')][_0x7117('0x115')]:''),'body':_0x27e7a1['Attachment']?_0x27e7a1['Attachment'][_0x7117('0xd5')]:_0x27e7a1[_0x7117('0x7e')],'direction':_0x27e7a1[_0x7117('0xf0')]===_0x7117('0xcb')?'A':'C','secret':_0x27e7a1[_0x7117('0xf1')],'read':_0x27e7a1[_0x7117('0x89')],'attachment':_0x27e7a1[_0x7117('0xd8')]};})[_0x7117('0x6d')]()};return ejs[_0x7117('0x129')](path[_0x7117('0xdc')](config[_0x7117('0xdd')],'server',_0x7117('0x12a'),_0x7117('0x12b')),{'interaction':_0x5bbad3})[_0x7117('0x38')](function(_0x158d2f){return new BPromise(function(_0x3b92e0,_0xf0bb7){pdf[_0x7117('0xcd')](_0x158d2f,_0x3c81f6)[_0x7117('0x12c')](path[_0x7117('0xdc')](_0x28b6f8,_0x7117('0x12d')+_0x3343e9['id']+'-'+_0x1e34ae+_0x7117('0x12e')),function(_0x4f8bc9,_0xe11162){if(_0x4f8bc9)return _0xf0bb7(_0x4f8bc9);_0x3b92e0(_0xe11162);});});})[_0x7117('0x38')](function(){return new BPromise(function(_0x1e8dee,_0x32a82f){zipdir(_0x28b6f8,{'saveTo':_0x4ee0ca},function(_0x2d269f,_0xbfede0){if(_0x2d269f)return _0x32a82f(_0x2d269f);return _0x1e8dee(_0xbfede0);});})[_0x7117('0x38')](function(){return new BPromise(function(_0x45da9a,_0x55fdec){rimraf(_0x28b6f8,function(_0x1b2519){if(_0x1b2519)_0x55fdec(_0x1b2519);return _0x45da9a();});});})[_0x7117('0x38')](function(){return _0x1d6742[_0x7117('0xdb')](_0x4ee0ca,_0x100d77,function(_0x5f912e){if(_0x5f912e){console['log']('err',_0x5f912e);}else{fs[_0x7117('0x12f')](_0x4ee0ca);}});});});}else{return _0x1d6742['sendStatus'](0xc8);}})[_0x7117('0x2a')](handleError(_0x1d6742,null));}; \ No newline at end of file +var _0x707d=['server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','CmContact','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','email','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','ChatInteractionId','merge','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','views','downloadInteraction.html','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','Users','map','TagIds','Tags','push','index','ChatInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','buildExpression','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','order','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','user','sequelize','toString','keyBy','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','rows','show','includeAll','include','options','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','join_url','out','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','Attachment','attachmentDownload','attachId','download','join','root','basename'];(function(_0x2bde76,_0x4b1377){var _0x4808e0=function(_0x4d1c60){while(--_0x4d1c60){_0x2bde76['push'](_0x2bde76['shift']());}};_0x4808e0(++_0x4b1377);}(_0x707d,0x18b));var _0xd707=function(_0x4c77a0,_0x2dcd95){_0x4c77a0=_0x4c77a0-0x0;var _0x26e625=_0x707d[_0x4c77a0];return _0x26e625;};'use strict';var pdf=require(_0xd707('0x0'));var emlformat=require(_0xd707('0x1'));var rimraf=require(_0xd707('0x2'));var zipdir=require(_0xd707('0x3'));var jsonpatch=require(_0xd707('0x4'));var rp=require(_0xd707('0x5'));var moment=require(_0xd707('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd707('0x7'));var util=require(_0xd707('0x8'));var path=require(_0xd707('0x9'));var sox=require(_0xd707('0xa'));var csv=require('to-csv');var ejs=require(_0xd707('0xb'));var fs=require('fs');var _=require(_0xd707('0xc'));var squel=require('squel');var crypto=require(_0xd707('0xd'));var jsforce=require(_0xd707('0xe'));var deskjs=require(_0xd707('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd707('0x10'));var Papa=require(_0xd707('0x11'));var Redis=require('ioredis');var authService=require(_0xd707('0x12'));var qs=require(_0xd707('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd707('0x14'))(_0xd707('0x15'));var utils=require(_0xd707('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd707('0x17'));var db=require(_0xd707('0x18'))['db'];config[_0xd707('0x19')]=_['defaults'](config['redis'],{'host':_0xd707('0x1a'),'port':0x18eb});var socket=require(_0xd707('0x1b'))(new Redis(config['redis']));require(_0xd707('0x1c'))[_0xd707('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd707('0x1e')][_0xd707('0x1f')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x8d4e1c,_0x49ec72,_0x356836,_0x18211b){return new BPromise(function(_0x479aea,_0x443a81){var _0x172e70=_0x18211b||client;return _0x172e70[_0xd707('0x20')](_0x8d4e1c,_0x356836)[_0xd707('0x21')](function(_0x4649cd){logger[_0xd707('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x49ec72,'request\x20sent');logger[_0xd707('0x23')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x49ec72,_0xd707('0x24'),JSON[_0xd707('0x25')](_0x4649cd));if(_0x4649cd[_0xd707('0x26')]){if(_0x4649cd['error']['code']===0x1f4){logger[_0xd707('0x26')](_0xd707('0x27'),_0x49ec72,_0x4649cd[_0xd707('0x26')][_0xd707('0x28')]);return _0x443a81(_0x4649cd[_0xd707('0x26')][_0xd707('0x28')]);}logger[_0xd707('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x49ec72,_0x4649cd[_0xd707('0x26')]['message']);return _0x479aea(_0x4649cd[_0xd707('0x26')]['message']);}else{logger[_0xd707('0x22')](_0xd707('0x27'),_0x49ec72,_0xd707('0x24'));_0x479aea(_0x4649cd['result'][_0xd707('0x28')]);}})[_0xd707('0x29')](function(_0x57be13){logger[_0xd707('0x26')](_0xd707('0x27'),_0x49ec72,_0x57be13);_0x443a81(_0x57be13);});});}function respondWithStatusCode(_0xdf8e03,_0xdc96a5){_0xdc96a5=_0xdc96a5||0xcc;return function(_0x2a41cb){if(_0x2a41cb){return _0xdf8e03[_0xd707('0x2a')](_0xdc96a5);}return _0xdf8e03[_0xd707('0x2b')](_0xdc96a5)[_0xd707('0x2c')]();};}function respondWithResult(_0x3feb7f,_0x1f752e){_0x1f752e=_0x1f752e||0xc8;return function(_0x27d15b){if(_0x27d15b){return _0x3feb7f['status'](_0x1f752e)[_0xd707('0x2d')](_0x27d15b);}};}function respondWithFilteredResult(_0x340b79,_0x17145b){return function(_0x2cf61d){if(_0x2cf61d){var _0x47029e=_0x2cf61d[_0xd707('0x2e')],_0x5c0310=_0x17145b[_0xd707('0x2f')],_0x45f8c8=_0x17145b[_0xd707('0x2f')]+_0x17145b[_0xd707('0x30')],_0x6deda0;if(_0x45f8c8>=_0x47029e){_0x45f8c8=_0x47029e;_0x6deda0=0xc8;}else{_0x6deda0=0xce;}_0x340b79['status'](_0x6deda0);return _0x340b79[_0xd707('0x31')](_0xd707('0x32'),_0x5c0310+'-'+_0x45f8c8+'/'+_0x47029e)[_0xd707('0x2d')](_0x2cf61d);}return null;};}function patchUpdates(_0x4eb43c){return function(_0x56e642){try{jsonpatch[_0xd707('0x33')](_0x56e642,_0x4eb43c,!![]);}catch(_0x1a4d80){return BPromise['reject'](_0x1a4d80);}return _0x56e642[_0xd707('0x34')]();};}function saveUpdates(_0x11b05b,_0x3b05d5){return function(_0x2dde56){if(_0x2dde56){return _0x2dde56['update'](_0x11b05b)['then'](function(_0x17d75e){return _0x17d75e;});}return null;};}function removeEntity(_0x1a6c3c,_0x4903da){return function(_0x385378){if(_0x385378){return _0x385378[_0xd707('0x35')]()['then'](function(){_0x1a6c3c['status'](0xcc)[_0xd707('0x2c')]();});}};}function handleEntityNotFound(_0x4b69d4,_0x6fec54){return function(_0x5bfe4e){if(!_0x5bfe4e){_0x4b69d4[_0xd707('0x2a')](0x194);}return _0x5bfe4e;};}function handleError(_0x244c0e,_0x4ff823){_0x4ff823=_0x4ff823||0x1f4;return function(_0x386b71){logger[_0xd707('0x26')](_0x386b71[_0xd707('0x36')]);if(_0x386b71[_0xd707('0x37')]){delete _0x386b71[_0xd707('0x37')];}_0x244c0e[_0xd707('0x2b')](_0x4ff823)['send'](_0x386b71);};}function getInteractionUsers(_0x1b0ac8,_0x2c0853){return new BPromise(function(_0x187f8f,_0xda9b7b){try{if(_0x2c0853[_0x1b0ac8['id']]){_0x1b0ac8[_0xd707('0x38')]=_[_0xd707('0x39')](_0x2c0853[_0x1b0ac8['id']],function(_0x309dee){return{'id':_0x309dee['id'],'fullname':_0x309dee['fullname']};});}}catch(_0x5beb41){_0xda9b7b(_0x5beb41);}_0x187f8f(_0x1b0ac8);});}function getInteractionTags(_0x5ecc38,_0x495c2a){return new BPromise(function(_0x322971,_0x2db9ae){try{if(_0x5ecc38[_0xd707('0x3a')]){_0x5ecc38[_0xd707('0x3b')]=[];_0x5ecc38[_0xd707('0x3a')]['split'](',')['forEach'](function(_0x998655){_0x5ecc38[_0xd707('0x3b')][_0xd707('0x3c')](_0x495c2a[_0x998655]);});}delete _0x5ecc38[_0xd707('0x3a')];}catch(_0x3b728){_0x2db9ae(_0x3b728);}_0x322971(_0x5ecc38);});}function updateChatInteraction(_0x26ed13,_0x41d53a,_0x4a6a44){return new BPromise(function(_0x23bb78,_0x48c248){return getInteractionUsers(_0x26ed13,_0x4a6a44)[_0xd707('0x21')](function(_0x625d4){return getInteractionTags(_0x625d4,_0x41d53a);})[_0xd707('0x21')](function(_0x3d5971){_0x23bb78(_0x3d5971);})['catch'](function(_0xbfac2){_0x48c248(_0xbfac2);});});}exports[_0xd707('0x3d')]=function(_0x19deb2,_0x65b0f8){var _0xc21fb8={},_0xe47d3c={},_0xec67df={'count':0x0,'rows':[]};var _0x13d2e5=_[_0xd707('0x39')](db[_0xd707('0x3e')][_0xd707('0x3f')],function(_0x536695){return{'name':_0x536695[_0xd707('0x40')],'type':_0x536695['type'][_0xd707('0x41')]};});_0xe47d3c[_0xd707('0x42')]=_['map'](_0x13d2e5,'name');_0xe47d3c['query']=_[_0xd707('0x43')](_0x19deb2[_0xd707('0x44')]);_0xe47d3c[_0xd707('0x45')]=_[_0xd707('0x46')](_0xe47d3c[_0xd707('0x42')],_0xe47d3c['query']);_0xc21fb8['attributes']=_[_0xd707('0x46')](_0xe47d3c[_0xd707('0x42')],qs[_0xd707('0x47')](_0x19deb2[_0xd707('0x44')]['fields']));_0xc21fb8[_0xd707('0x48')]=_0xc21fb8[_0xd707('0x48')][_0xd707('0x49')]?_0xc21fb8[_0xd707('0x48')]:_0xe47d3c[_0xd707('0x42')];if(!_0x19deb2[_0xd707('0x44')][_0xd707('0x4a')](_0xd707('0x4b'))){_0xc21fb8[_0xd707('0x30')]=qs['limit'](_0x19deb2[_0xd707('0x44')][_0xd707('0x30')]);_0xc21fb8[_0xd707('0x2f')]=qs['offset'](_0x19deb2[_0xd707('0x44')]['offset']);}_0xc21fb8['order']=qs[_0xd707('0x4c')](_0x19deb2['query'][_0xd707('0x4c')]);_0xc21fb8[_0xd707('0x4d')]=qs['filters'](_[_0xd707('0x4e')](_0x19deb2[_0xd707('0x44')],_0xe47d3c['filters']),_0x13d2e5);var _0x2f6f8e=[];var _0x3397da=squel[_0xd707('0x4f')]()[_0xd707('0x50')]('id')[_0xd707('0x50')](_0xd707('0x37'))[_0xd707('0x50')]('color')[_0xd707('0x51')](_0xd707('0x52'));var _0x1ecd51=squel[_0xd707('0x4f')]()[_0xd707('0x50')](_0xd707('0x53'))['field'](_0xd707('0x54'))[_0xd707('0x50')](_0xd707('0x55'))['from'](_0xd707('0x56'),'ui')['left_join'](_0xd707('0x57'),'u',_0xd707('0x58'));var _0x5b8c02=squel[_0xd707('0x4f')]()[_0xd707('0x51')]('chat_interactions','i')[_0xd707('0x59')](_0xd707('0x5a'),'c',_0xd707('0x5b'))['left_join'](_0xd707('0x57'),'o',_0xd707('0x5c'))[_0xd707('0x59')](_0xd707('0x5d'),'a',_0xd707('0x5e'))['left_join'](_0xd707('0x5f'),'me',_0xd707('0x60'))[_0xd707('0x59')]('chat_interaction_has_tags','it',_0xd707('0x61'))['left_join'](_0xd707('0x52'),'t',_0xd707('0x62'));var _0x101cf9=squel[_0xd707('0x63')]();var _0x325cef=[];var _0x294b25=squel[_0xd707('0x63')]();var _0x41ab05;if(_0x19deb2[_0xd707('0x44')][_0xd707('0x64')]){_0x41ab05=as[_0xd707('0x65')](_0x19deb2[_0xd707('0x44')]['search']);var _0xd7c202=_0x41ab05[_0xd707('0x66')];for(var _0x51b6f5=0x0;_0x51b6f5<_0x41ab05[_0xd707('0x67')][_0xd707('0x49')];_0x51b6f5++){var _0x409dbf=_0x41ab05['conditions'][_0x51b6f5];var _0x58d1fd='i';var _0x488ad3=_[_0xd707('0x68')](_0x13d2e5,['name',_0x409dbf[_0xd707('0x50')]]);if(!_0x488ad3){switch(_0x409dbf[_0xd707('0x50')]){case _0xd707('0x69'):if(_0x409dbf[_0xd707('0x6a')]==0x1){_0x5b8c02[_0xd707('0x6b')]('`'+_0x409dbf['field']+'`\x20=\x200');}else{_0x5b8c02[_0xd707('0x6b')]('`'+_0x409dbf[_0xd707('0x50')]+'`\x20>\x200');}break;case _0xd707('0x6c'):if(_0x409dbf['operator']===_0xd707('0x6d')){if(_0x409dbf[_0xd707('0x6a')][_0xd707('0x6e')]('\x20')[_0xd707('0x49')]>0x1){_0x101cf9[_0xd7c202]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd707('0x6f')](_0x409dbf[_0xd707('0x6a')]),null);}else{var _0x34c187='%'+_0x409dbf[_0xd707('0x6a')]+'%';_0x101cf9[_0xd7c202](_0xd707('0x70'),_0x34c187,_0x34c187,_0x34c187);}}else{_0x488ad3=_[_0xd707('0x68')](_0x13d2e5,['name',_0xd707('0x71')]);_0x409dbf[_0xd707('0x50')]=_0xd707('0x71');_0x10b62d=as['buildExpression'](_0x58d1fd,_0x488ad3[_0xd707('0x72')],_0x409dbf);_0x101cf9[_0xd7c202](_0x10b62d[_0xd707('0x73')],_0x10b62d['value'][_0xd707('0x74')],_0x10b62d[_0xd707('0x6a')]['end']);}break;case'Tag':var _0xecd0b=_0x409dbf[_0xd707('0x6a')]['split'](',')['map'](function(_0xf0bcee){return Number(_0xf0bcee);});_0xecd0b[_0xd707('0x75')](function(_0x44adb7){_0x294b25['or'](_0xd707('0x76'),'%,'+_0x44adb7+',%');});_0x325cef=_[_0xd707('0x77')](_0x325cef,_0xecd0b);break;case'User':if(_0x409dbf[_0xd707('0x78')]===_0xd707('0x6d')){_0x101cf9[_0xd7c202]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x409dbf[_0xd707('0x6a')]+'%',null);}else{_0x488ad3=_[_0xd707('0x68')](_0x13d2e5,[_0xd707('0x37'),_0xd707('0x79')]);_0x409dbf['field']=_0xd707('0x79');_0x10b62d=as[_0xd707('0x7a')](_0x58d1fd,_0x488ad3[_0xd707('0x72')],_0x409dbf);_0x101cf9[_0xd7c202](_0x10b62d['text'],_0x10b62d[_0xd707('0x6a')]['start'],_0x10b62d['value']['end']);}break;case _0xd707('0x7b'):_0x10b62d=as[_0xd707('0x7a')]('me',null,_0x409dbf);_0x101cf9[_0xd7c202](_0x10b62d[_0xd707('0x73')],_0x10b62d[_0xd707('0x6a')]['start'],_0x10b62d['value'][_0xd707('0x2c')]);break;}}else{var _0x10b62d=as[_0xd707('0x7a')](_0x58d1fd,_0x488ad3[_0xd707('0x72')],_0x409dbf);_0x101cf9[_0xd7c202](_0x10b62d[_0xd707('0x73')],_0x10b62d[_0xd707('0x6a')]['start'],_0x10b62d[_0xd707('0x6a')]['end']);}}}else{var _0x50e104=_(_0x19deb2['query'])[_0xd707('0x43')]()['map'](function(_0xd5c89b){return _[_0xd707('0x7c')](_0x13d2e5,[_0xd707('0x37'),_0xd5c89b])?_0xd5c89b:undefined;})[_0xd707('0x7d')]()[_0xd707('0x6a')]();if(!_[_0xd707('0x7e')](_0x50e104)){_0x50e104[_0xd707('0x75')](function(_0x433045){if(_0x433045===_0xd707('0x7f')){_0x5b8c02[_0xd707('0x4d')](_0xd707('0x80'),[][_0xd707('0x81')](_0x19deb2[_0xd707('0x44')][_0x433045]));}else if(_0x433045==='createdAt'){var _0x81fde7=JSON[_0xd707('0x82')](_0x19deb2['query'][_0x433045])[_0xd707('0x83')];var _0x4147ce=JSON[_0xd707('0x82')](_0x19deb2[_0xd707('0x44')][_0x433045])['$lte'];_0x5b8c02[_0xd707('0x4d')](_0xd707('0x84'),_0x81fde7,_0x4147ce);}else{if(_0x19deb2[_0xd707('0x44')][_0x433045]==='null'){_0x5b8c02['where']('i.'+_0x433045+'\x20IS\x20NULL');}else{_0x5b8c02[_0xd707('0x4d')]('i.'+_0x433045+_0xd707('0x85'),_0x19deb2[_0xd707('0x44')][_0x433045]);}}});}if(_0x19deb2[_0xd707('0x44')][_0xd707('0x86')]){if(_0x19deb2[_0xd707('0x44')][_0xd707('0x86')]==0x1){_0x5b8c02[_0xd707('0x6b')](_0xd707('0x87'));}else{_0x5b8c02[_0xd707('0x6b')](_0xd707('0x88'));}}if(_0x19deb2[_0xd707('0x44')][_0xd707('0x89')]){_0x325cef=_[_0xd707('0x8a')](_0x19deb2[_0xd707('0x44')][_0xd707('0x89')])?_0x19deb2['query'][_0xd707('0x89')]:new Array(_0x19deb2[_0xd707('0x44')][_0xd707('0x89')]);_0x325cef[_0xd707('0x75')](function(_0x42b7bd){_0x294b25['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x42b7bd+',%');});}if(_0x19deb2[_0xd707('0x44')]['filter']){var _0x5483e4=_0x19deb2[_0xd707('0x44')][_0xd707('0x8b')][_0xd707('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5483e4)){_0x101cf9['or']('i.id\x20LIKE\x20?',_0x5483e4+'%');}else{_0x101cf9['or'](_0xd707('0x8d'),qs[_0xd707('0x6f')](_0x5483e4))['or'](_0xd707('0x8e'),_0x5483e4+'%');}}}_0x5b8c02[_0xd707('0x4d')](_0x101cf9);_0x5b8c02[_0xd707('0x8f')](_0xd707('0x90'));var _0x54115d={'type':db['Sequelize'][_0xd707('0x91')]['SELECT'],'raw':!![]};var _0x1c0f99=_0x5b8c02[_0xd707('0x92')]();_0x1c0f99[_0xd707('0x50')]('i.id');_0x1c0f99[_0xd707('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd707('0x69'));if(_0xc21fb8[_0xd707('0x93')]){_0xc21fb8[_0xd707('0x93')][_0xd707('0x75')](function(_0x47d71e){var _0x1f69e4=_0x47d71e[0x0]==='contactName'?_0x47d71e[0x0]:'i.'+_0x47d71e[0x0];_0x5b8c02[_0xd707('0x93')](_0x1f69e4,_0x47d71e[0x1]===_0xd707('0x94')?![]:!![]);});}if(!_[_0xd707('0x7e')](_0x325cef)){_0x5b8c02[_0xd707('0x6b')](_0x294b25);_0x1c0f99[_0xd707('0x4d')](_0xd707('0x95'),_0x325cef);}BPromise['resolve']()[_0xd707('0x21')](function(){if(!_0x41ab05){if(_0x19deb2[_0xd707('0x44')][_0xd707('0x7f')]||_0x19deb2[_0xd707('0x44')]['journey'])return;_0x1c0f99[_0xd707('0x4d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5b8c02['where'](_0xd707('0x96'));return;}if(_0x19deb2['user'][_0xd707('0x97')]!==_0xd707('0x98'))return;return _0x19deb2['user'][_0xd707('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d1367){if(_[_0xd707('0x7e')](_0x2d1367)){_0x1c0f99[_0xd707('0x4d')](_0xd707('0x9a'));_0x5b8c02[_0xd707('0x4d')](_0xd707('0x9a'));}else{_0x1c0f99[_0xd707('0x4d')](_0xd707('0x80'),_['map'](_0x2d1367,'id'));_0x5b8c02[_0xd707('0x4d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd707('0x39')](_0x2d1367,'id'));}});})[_0xd707('0x21')](function(){if(_0x19deb2[_0xd707('0x9b')]['role']===_0xd707('0x98')&&!_0x41ab05&&!_0x19deb2[_0xd707('0x44')][_0xd707('0x7f')])return[];return db[_0xd707('0x9c')][_0xd707('0x44')](_0x1c0f99['toString'](),_0x54115d);})[_0xd707('0x21')](function(_0x38400b){_0xec67df[_0xd707('0x2e')]=_0x38400b[_0xd707('0x49')];if(_0xec67df['count']===0x0)return[];return db[_0xd707('0x9c')][_0xd707('0x44')](_0x3397da[_0xd707('0x9d')](),_0x54115d)[_0xd707('0x21')](function(_0x5c8955){_0x2f6f8e=_[_0xd707('0x9e')](_0x5c8955,'id');_0x54115d=_['merge'](_0x54115d,{'model':db[_0xd707('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19deb2[_0xd707('0x44')]['fields']){_0xc21fb8[_0xd707('0x48')][_0xd707('0x75')](function(_0x1b0232){_0x5b8c02[_0xd707('0x50')]('i.'+_0x1b0232);});}else{_0x5b8c02[_0xd707('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd707('0x69'));_0x5b8c02[_0xd707('0x50')](_0xd707('0x9f'),'Account.key');_0x5b8c02['field'](_0xd707('0xa0'),_0xd707('0xa1'));_0x5b8c02[_0xd707('0x50')](_0xd707('0xa2'),_0xd707('0xa3'));_0x5b8c02['field']('i.*');_0x5b8c02[_0xd707('0x50')](_0xd707('0xa4'),_0xd707('0xa5'));_0x5b8c02[_0xd707('0x50')](_0xd707('0xa6'),_0xd707('0xa7'));_0x5b8c02[_0xd707('0x50')](_0xd707('0xa8'),_0xd707('0xa9'));_0x5b8c02[_0xd707('0x50')](_0xd707('0xaa'),_0xd707('0xab'));_0x5b8c02[_0xd707('0x50')](_0xd707('0xac'),_0xd707('0xad'));_0x5b8c02[_0xd707('0x50')]('c.fax',_0xd707('0xae'));_0x5b8c02['field']('o.fullname','Owner.fullname');_0x5b8c02[_0xd707('0x50')](_0xd707('0xaf'),_0xd707('0xb0'));_0x5b8c02['field'](_0xd707('0xb1'),'TagIds');}if(_0xc21fb8[_0xd707('0x30')])_0x5b8c02['limit'](_0xc21fb8['limit']);if(_0xc21fb8['offset'])_0x5b8c02[_0xd707('0x2f')](_0xc21fb8[_0xd707('0x2f')]);return db[_0xd707('0x9c')]['query'](_0x5b8c02[_0xd707('0x9d')](),_0x54115d);})[_0xd707('0x21')](function(_0x4ada21){_0x1ecd51[_0xd707('0x4d')]('ui.ChatInteractionId\x20IN\x20?',_[_0xd707('0x39')](_0x4ada21,'id'));return db['sequelize']['query'](_0x1ecd51[_0xd707('0x9d')](),_0x54115d)['then'](function(_0x1faa7c){var _0x2efc2a=_['groupBy'](_0x1faa7c,'ChatInteractionId');var _0x3a4e5f=[];_0x4ada21[_0xd707('0x75')](function(_0x5f1c71){_0x3a4e5f[_0xd707('0x3c')](updateChatInteraction(_0x5f1c71,_0x2f6f8e,_0x2efc2a));});return BPromise[_0xd707('0xb2')](_0x3a4e5f);});});})[_0xd707('0x21')](function(_0x9c312a){_0xec67df[_0xd707('0xb3')]=_0x9c312a;return _0xec67df;})[_0xd707('0x21')](respondWithFilteredResult(_0x65b0f8,_0xc21fb8))[_0xd707('0x29')](handleError(_0x65b0f8,null));};exports[_0xd707('0xb4')]=function(_0x5dad8a,_0x31acba){var _0x470e8d={'raw':![],'where':{'id':_0x5dad8a['params']['id']}},_0x4ba5d5={};_0x4ba5d5[_0xd707('0x42')]=_['keys'](db[_0xd707('0x3e')][_0xd707('0x3f')]);_0x4ba5d5['query']=_['keys'](_0x5dad8a[_0xd707('0x44')]);_0x4ba5d5[_0xd707('0x45')]=_[_0xd707('0x46')](_0x4ba5d5['model'],_0x4ba5d5[_0xd707('0x44')]);_0x470e8d['attributes']=_['intersection'](_0x4ba5d5[_0xd707('0x42')],qs[_0xd707('0x47')](_0x5dad8a[_0xd707('0x44')]['fields']));_0x470e8d['attributes']=_0x470e8d['attributes'][_0xd707('0x49')]?_0x470e8d[_0xd707('0x48')]:_0x4ba5d5['model'];if(_0x5dad8a[_0xd707('0x44')][_0xd707('0xb5')]){_0x470e8d[_0xd707('0xb6')]=[{'all':!![]}];}_0x470e8d=_['merge']({},_0x470e8d,_0x5dad8a[_0xd707('0xb7')]);return db[_0xd707('0x3e')][_0xd707('0x68')](_0x470e8d)[_0xd707('0x21')](handleEntityNotFound(_0x31acba,null))[_0xd707('0x21')](respondWithResult(_0x31acba,null))[_0xd707('0x29')](handleError(_0x31acba,null));};exports[_0xd707('0xb8')]=function(_0x4ac802,_0x40ed60){return db[_0xd707('0x3e')][_0xd707('0xb8')](_0x4ac802[_0xd707('0x7b')],{})[_0xd707('0x21')](respondWithResult(_0x40ed60,0xc9))['catch'](handleError(_0x40ed60,null));};exports[_0xd707('0xb9')]=function(_0x46fff7,_0x3c7f86){if(_0x46fff7[_0xd707('0x7b')]['id']){delete _0x46fff7[_0xd707('0x7b')]['id'];}return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x46fff7[_0xd707('0xba')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x3c7f86,null))[_0xd707('0x21')](saveUpdates(_0x46fff7['body'],null))[_0xd707('0x21')](respondWithResult(_0x3c7f86,null))[_0xd707('0x29')](handleError(_0x3c7f86,null));};exports[_0xd707('0x35')]=function(_0x5261bd,_0x1f59b7){return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x5261bd['params']['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1f59b7,null))[_0xd707('0x21')](removeEntity(_0x1f59b7,null))[_0xd707('0x29')](handleError(_0x1f59b7,null));};exports[_0xd707('0xbb')]=function(_0x35725d,_0x293864){return db['ChatInteraction']['describe']()[_0xd707('0x21')](respondWithResult(_0x293864,null))[_0xd707('0x29')](handleError(_0x293864,null));};exports[_0xd707('0xbc')]=function(_0x297efd,_0x2d7566){var _0x3ccd5f=_0x297efd[_0xd707('0xba')]['id'];var _0x1dab92;var _0x35a6f5;var _0x3aaa48;return db[_0xd707('0x3e')][_0xd707('0xbd')]({'where':{'id':_0x3ccd5f}})[_0xd707('0x21')](function(_0x47c556){_0x1dab92=_0x47c556;return db[_0xd707('0xbe')][_0xd707('0xbd')]({'where':{'id':_0x47c556['ChatWebsiteId']},'attributes':['id',_0xd707('0xbf'),_0xd707('0xc0')],'raw':!![]});})[_0xd707('0x21')](function(_0x1fb09d){if(_0x1fb09d&&_0x1fb09d[_0xd707('0xbf')]&&_0x1fb09d[_0xd707('0xc0')]){_0x35a6f5=_0x1fb09d;var _0x103028={'rejectUnauthorized':![],'method':_0xd707('0xc1'),'uri':_0xd707('0xc2'),'headers':{'X-APIKEY':_0x1fb09d[_0xd707('0xbf')]},'body':{'name':_0xd707('0xc3')+_0x3ccd5f},'redirect':_0xd707('0xc4'),'json':!![]};return rp(_0x103028);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd707('0x21')](function(_0x277f2b){_0x3aaa48=_0x277f2b;if(_0x3aaa48['id']){var _0x423749={'body':_0x3aaa48[_0xd707('0xc5')],'ChatWebsiteId':_0x35a6f5['id'],'ChatInteractionId':_0x1dab92['id'],'direction':_0xd707('0xc6'),'UserId':_0x297efd[_0xd707('0x9b')]['id']};return db['ChatMessage'][_0xd707('0xb8')](_0x423749,{});}else{throw new db[(_0xd707('0xc7'))]['ValidationError'](_0xd707('0xc8'));}})[_0xd707('0x21')](function(){return _0x1dab92['updateAttributes']({'vidaooSessionId':_0x3aaa48['id']});})['then'](respondWithResult(_0x2d7566,null))[_0xd707('0x29')](handleError(_0x2d7566,null));};exports['customUpdate']=function(_0x2b8979,_0xeb3a55){if(_0x2b8979[_0xd707('0x7b')]['id']){delete _0x2b8979[_0xd707('0x7b')]['id'];}return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x2b8979[_0xd707('0xba')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0xeb3a55,null))['then'](saveUpdates(_0x2b8979['body'],null))[_0xd707('0x21')](respondWithResult(_0xeb3a55,null))[_0xd707('0x29')](handleError(_0xeb3a55,null));};exports[_0xd707('0xc9')]=function(_0x37baba,_0x4b6d49,_0x5c22f4){if(_0x37baba['body']['id']){delete _0x37baba[_0xd707('0x7b')]['id'];}return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x37baba[_0xd707('0xba')]['id']}})[_0xd707('0x21')](function(_0x6e9a55){if(!_0x6e9a55){logger[_0xd707('0x26')](_0xd707('0xca'),'abandon',0x194,_0xd707('0xcb'));_0x4b6d49[_0xd707('0x2a')](0x194);}else{if(_0x6e9a55[_0xd707('0x79')]){throw new db[(_0xd707('0xc7'))]['ValidationError'](_0xd707('0xcc'));}}return _0x6e9a55;})['then'](function(_0x2133e5){if(_0x2133e5){return _0x2133e5[_0xd707('0xb9')]({'closed':_0x37baba[_0xd707('0x7b')][_0xd707('0xcd')],'disposition':_0x37baba[_0xd707('0x7b')][_0xd707('0xce')]})['then'](function(_0x6cf8e4){return _0x6cf8e4;});}})[_0xd707('0x21')](function(_0x55cc05){return respondWithRpcPromise(_0xd707('0xcf'),_0xd707('0xc9'),_0x37baba[_0xd707('0x7b')],client9004);})[_0xd707('0x21')](respondWithResult(_0x4b6d49,null))[_0xd707('0x29')](handleError(_0x4b6d49,null));};exports[_0xd707('0xd0')]=function(_0x515911,_0x513a7b,_0x4e0ba5){_0x515911[_0xd707('0x7b')][_0xd707('0x37')]=_0x515911[_0xd707('0xd1')][_0xd707('0xd2')];_0x515911[_0xd707('0x7b')]['basename']=_0x515911['file'][_0xd707('0xd3')];_0x515911['body']['type']=_0x515911[_0xd707('0xd1')]['mimetype'];return db[_0xd707('0xd4')][_0xd707('0xb8')](_0x515911[_0xd707('0x7b')])['then'](respondWithResult(_0x513a7b,0xc9))['catch'](handleError(_0x513a7b,null));};exports[_0xd707('0xd5')]=function(_0x5d6a8b,_0x24f266,_0x4215e0){return db[_0xd707('0x3e')][_0xd707('0xbd')]({'where':{'id':_0x5d6a8b['params']['id']},'raw':!![]})[_0xd707('0x21')](handleEntityNotFound(_0x24f266,null))[_0xd707('0x21')](function(_0x1527db){if(_0x1527db){if(_0x1527db[_0xd707('0xcd')]){return _0x24f266['status'](0x193)[_0xd707('0x2d')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd707('0xd4')][_0xd707('0xbd')]({'where':{'id':_0x5d6a8b[_0xd707('0x44')][_0xd707('0xd6')]},'raw':!![]})[_0xd707('0x21')](handleEntityNotFound(_0x24f266,null));}})['then'](function(_0x1de7f7){if(_0x1de7f7){return _0x24f266[_0xd707('0xd7')](path[_0xd707('0xd8')](config[_0xd707('0xd9')],'server/files/attachments/',_0x1de7f7[_0xd707('0xda')]));}})['catch'](handleError(_0x24f266,null));};exports['close']=function(_0x52c24e,_0x2b146b){var _0x57a16c=null;var _0x5e44de=null;var _0x279024=null;var _0x4a2770=null;if(_0x52c24e[_0xd707('0x7b')]['id']){delete _0x52c24e[_0xd707('0x7b')]['id'];}if(_0x52c24e[_0xd707('0x7b')]['mailTranscript']){_0x4a2770=path[_0xd707('0xd8')](config['root'],_0xd707('0xdb'),util[_0xd707('0xdc')](_0xd707('0xdd'),Date[_0xd707('0xde')]()));_0x52c24e['body'][_0xd707('0xdf')]=_0x4a2770;}return db[_0xd707('0x3e')]['find']({'where':{'id':_0x52c24e[_0xd707('0xba')]['id']},'include':[{'model':db[_0xd707('0xe0')],'as':_0xd707('0xe1'),'include':[{'model':db['User'],'as':_0xd707('0xe2')}]}]})[_0xd707('0x21')](handleEntityNotFound(_0x2b146b,null))['then'](saveUpdates(_0x52c24e[_0xd707('0x7b')],null))[_0xd707('0x21')](function(_0x2d390a){if(_0x2d390a){_0x57a16c=_0x2d390a;return db[_0xd707('0xbe')][_0xd707('0x68')]({'where':{'id':_0x57a16c[_0xd707('0x7f')]}});}})[_0xd707('0x21')](function(_0x3e1d6e){if(_0x3e1d6e){_0x279024=_0x3e1d6e;return db[_0xd707('0xe3')]['find']({'where':{'id':_0x57a16c[_0xd707('0x71')]}});}})[_0xd707('0x21')](function(_0x11cd20){if(_0x11cd20){_0x5e44de=_0x11cd20;if(_0x4a2770){var _0x484287=null;for(var _0x6ff6be=0x1;_0x6ff6be<_0x57a16c[_0xd707('0xe1')][_0xd707('0x49')];++_0x6ff6be){_0x484287=_0x57a16c[_0xd707('0xe1')][_0x6ff6be];var _0x13644a=_0x484287[_0xd707('0x79')]?util[_0xd707('0xdc')](_0xd707('0xe4'),_0x279024['agentAlias'],_0x484287[_0xd707('0x79')]):_0xd707('0xe5');var _0x10dcd0=_0x52c24e['body'][_0xd707('0xe6')]||util[_0xd707('0xdc')](_0xd707('0xe4'),_0xd707('0xe7'),_0x484287[_0xd707('0x71')]);switch(_0x279024[_0xd707('0xe8')]){case _0xd707('0xe9'):_0x13644a=_0x484287[_0xd707('0x79')]?util['format']('%s%d',_0x279024[_0xd707('0xea')],_0x484287[_0xd707('0x79')]):_0xd707('0xe5');break;case _0xd707('0xeb'):_0x13644a=_0x484287[_0xd707('0x79')]?_0x484287[_0xd707('0xe2')][_0xd707('0xec')]||_0x484287[_0xd707('0xe2')]['fullname']:_0xd707('0xe5');break;case'agent_fullname':_0x13644a=_0x484287[_0xd707('0x79')]?_0x484287['User'][_0xd707('0xed')]:_0xd707('0xe5');break;default:_0x13644a=_0x484287[_0xd707('0x79')]?util[_0xd707('0xdc')](_0xd707('0xe4'),_0x279024[_0xd707('0xea')],_0x484287[_0xd707('0x79')]):'System';}var _0x4bcc59=util[_0xd707('0xdc')]('[%s]\x20%s:\x20%s\x0a',moment(_0x484287[_0xd707('0xee')])[_0xd707('0xdc')](_0xd707('0xef')),_0x484287[_0xd707('0xf0')]==='in'?_0x10dcd0:_0x13644a,_0x484287['body']);if(!_0x484287[_0xd707('0xf1')]){fs[_0xd707('0xf2')](_0x4a2770,_0x4bcc59);}}return db[_0xd707('0xf3')][_0xd707('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0xd707('0xf4')],'as':_0xd707('0xf5'),'raw':!![]}]});}}})['then'](function(_0x39e709){if(_0x39e709&&_0x39e709[_0xd707('0xf5')]&&_0x52c24e['body']){var _0x1444e0={'tls':{'rejectUnauthorized':![]}};if(_0x39e709[_0xd707('0xf5')]['service']){_0x1444e0[_0xd707('0xf6')]=_0x39e709[_0xd707('0xf5')][_0xd707('0xf6')];}else{_0x1444e0[_0xd707('0xf7')]=_0x39e709[_0xd707('0xf5')]['host'];_0x1444e0[_0xd707('0xf8')]=_0x39e709[_0xd707('0xf5')]['port'];_0x1444e0[_0xd707('0xf9')]=_0x39e709['Smtp'][_0xd707('0xf9')];}if(_0x39e709[_0xd707('0xf5')]['authentication']){_0x1444e0['auth']={'user':_0x39e709[_0xd707('0xf5')][_0xd707('0x9b')],'pass':_0x39e709[_0xd707('0xf5')][_0xd707('0xfa')]};}return respondWithRpcPromise(_0xd707('0xfb'),'sendMail',{'account':_0x1444e0,'message':{'from':util[_0xd707('0xdc')]('\x22%s\x22\x20<%s>',_0x39e709[_0xd707('0x37')],_0x39e709[_0xd707('0xfc')]||_0x39e709['Smtp'][_0xd707('0x9b')]),'to':_0x52c24e[_0xd707('0x7b')][_0xd707('0xfd')],'subject':_0xd707('0xfe'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x52c24e[_0xd707('0x7b')][_0xd707('0xfd')]),'attachments':[{'path':_0x4a2770}]}})[_0xd707('0x21')](function(){return _0x57a16c;})[_0xd707('0x29')](function(_0x1ed021){console[_0xd707('0x26')](_0x1ed021);});}else{return _0x57a16c;}})[_0xd707('0x21')](respondWithStatusCode(_0x2b146b,0xc8))[_0xd707('0x29')](handleError(_0x2b146b,null));};exports[_0xd707('0xff')]=function(_0x3e05e9,_0xd9cabd,_0x2ddb9e){return db[_0xd707('0xe0')][_0xd707('0x68')]({'where':{'id':_0x3e05e9[_0xd707('0xba')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0xd9cabd,null))['then'](function(_0x5971ad){if(_0x5971ad){return _0x5971ad[_0xd707('0xff')](_0x3e05e9[_0xd707('0x7b')][_0xd707('0x100')],_[_0xd707('0x101')](_0x3e05e9[_0xd707('0x7b')],['ids','id'])||{});}})[_0xd707('0x21')](respondWithResult(_0xd9cabd,null))['catch'](handleError(_0xd9cabd,null));};exports['getMessages']=function(_0x581b9f,_0x24ac19,_0x3b9b04){var _0x1acca6={'raw':![],'where':{}};var _0x2440c7={};var _0x55c581={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x581b9f['params']['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x24ac19,null))['then'](function(_0x4585d1){if(_0x4585d1){_0x2440c7[_0xd707('0x42')]=_[_0xd707('0x43')](db[_0xd707('0xe0')]['rawAttributes']);_0x2440c7['query']=_[_0xd707('0x43')](_0x581b9f[_0xd707('0x44')]);_0x2440c7[_0xd707('0x45')]=_[_0xd707('0x46')](_0x2440c7[_0xd707('0x42')],_0x2440c7['query']);_0x1acca6[_0xd707('0x48')]=_['intersection'](_0x2440c7['model'],qs[_0xd707('0x47')](_0x581b9f['query'][_0xd707('0x47')]));_0x1acca6[_0xd707('0x48')]=_0x1acca6[_0xd707('0x48')][_0xd707('0x49')]?_0x1acca6[_0xd707('0x48')]:_0x2440c7[_0xd707('0x42')];if(!_0x581b9f[_0xd707('0x44')][_0xd707('0x4a')](_0xd707('0x4b'))){_0x1acca6[_0xd707('0x30')]=qs[_0xd707('0x30')](_0x581b9f[_0xd707('0x44')][_0xd707('0x30')]);_0x1acca6[_0xd707('0x2f')]=qs[_0xd707('0x2f')](_0x581b9f[_0xd707('0x44')]['offset']);}_0x1acca6[_0xd707('0x93')]=qs[_0xd707('0x4c')](_0x581b9f['query']['sort']);_0x1acca6[_0xd707('0x4d')]=qs[_0xd707('0x45')](_[_0xd707('0x4e')](_0x581b9f[_0xd707('0x44')],_0x2440c7[_0xd707('0x45')]));_0x1acca6[_0xd707('0x4d')][_0xd707('0x102')]=_0x4585d1['id'];if(_0x581b9f[_0xd707('0x44')][_0xd707('0x8b')]){_0x1acca6[_0xd707('0x4d')]=_[_0xd707('0x103')](_0x1acca6[_0xd707('0x4d')],{'$or':_[_0xd707('0x39')](_0x1acca6[_0xd707('0x48')],function(_0x19ba12){var _0x16d697={};_0x16d697[_0x19ba12]={'$like':'%'+_0x581b9f[_0xd707('0x44')]['filter']+'%'};return _0x16d697;})});}if(_0x581b9f[_0xd707('0x44')][_0xd707('0x83')]){var _0x1d3d0f=_0x581b9f[_0xd707('0x44')]['$gte'][_0xd707('0x6e')](',');var _0x39295c={};_0x39295c[_0x1d3d0f[0x0]]={'$gte':moment(_0x1d3d0f[0x1])['format'](_0xd707('0x104'))};_0x1acca6['where']=_[_0xd707('0x103')](_0x1acca6[_0xd707('0x4d')],_0x39295c);}_0x1acca6=_['merge']({},_0x1acca6,_0x581b9f['options']);return db[_0xd707('0xe0')][_0xd707('0x2e')]({'where':_0x1acca6[_0xd707('0x4d')]})[_0xd707('0x21')](function(_0x175083){_0x55c581[_0xd707('0x2e')]=_0x175083;if(_0x581b9f['query'][_0xd707('0xb5')]){_0x1acca6['include']=[{'all':!![]}];}return db['ChatMessage'][_0xd707('0x105')](_0x1acca6);})[_0xd707('0x21')](function(_0x40c94e){_0x55c581['rows']=_0x40c94e;return _0x55c581;});}})['then'](respondWithFilteredResult(_0x24ac19,_0x1acca6))['catch'](handleError(_0x24ac19,null));};exports[_0xd707('0x106')]=function(_0x1a2a78,_0x2e6234,_0x44a7ab){var _0x56b09e={'where':{}},_0x42a156={},_0x408175={'count':0x0,'rows':[]};return db[_0xd707('0x3e')]['findOne']({'where':{'id':_0x1a2a78[_0xd707('0xba')]['id']}})['then'](handleEntityNotFound(_0x2e6234,null))[_0xd707('0x21')](function(_0x36ed92){if(_0x36ed92){_0x42a156['model']=_[_0xd707('0x43')](db[_0xd707('0xe0')]['rawAttributes']);_0x42a156[_0xd707('0x44')]=_[_0xd707('0x43')](_0x1a2a78[_0xd707('0x44')]);_0x42a156[_0xd707('0x45')]=_[_0xd707('0x46')](_0x42a156[_0xd707('0x42')],_0x42a156[_0xd707('0x44')]);_0x56b09e['attributes']=_[_0xd707('0x46')](_0x42a156['model'],qs[_0xd707('0x47')](_0x1a2a78[_0xd707('0x44')][_0xd707('0x47')]));_0x56b09e[_0xd707('0x48')]=_0x56b09e['attributes'][_0xd707('0x49')]?_0x56b09e[_0xd707('0x48')]:_0x42a156[_0xd707('0x42')];if(!_0x1a2a78['query'][_0xd707('0x4a')](_0xd707('0x4b'))){_0x56b09e[_0xd707('0x30')]=qs[_0xd707('0x30')](_0x1a2a78['query'][_0xd707('0x30')]);_0x56b09e[_0xd707('0x2f')]=qs[_0xd707('0x2f')](_0x1a2a78[_0xd707('0x44')][_0xd707('0x2f')]);}_0x56b09e[_0xd707('0x93')]=qs[_0xd707('0x4c')](_0x1a2a78[_0xd707('0x44')][_0xd707('0x4c')]);_0x56b09e[_0xd707('0x4d')]=qs[_0xd707('0x45')](_[_0xd707('0x4e')](_0x1a2a78[_0xd707('0x44')],_0x42a156[_0xd707('0x45')]));_0x56b09e['where']['ChatInteractionId']=_0x36ed92['id'];if(_0x1a2a78['query']['filter']){_0x56b09e[_0xd707('0x4d')]=_['merge'](_0x56b09e[_0xd707('0x4d')],{'$or':_[_0xd707('0x39')](_0x56b09e['attributes'],function(_0x3cf812){var _0x1bcf2c={};_0x1bcf2c[_0x3cf812]={'$like':'%'+_0x1a2a78['query'][_0xd707('0x8b')]+'%'};return _0x1bcf2c;})});}_0x56b09e[_0xd707('0x4d')][_0xd707('0xf1')]=![];if(_0x1a2a78[_0xd707('0x44')]['id']){_0x56b09e[_0xd707('0x4d')]['id']={'$gt':_0x1a2a78[_0xd707('0x44')]['id']};}_0x56b09e=_[_0xd707('0x103')]({},_0x56b09e,_0x1a2a78[_0xd707('0xb7')]);return db[_0xd707('0xe0')]['count']({'where':_0x56b09e[_0xd707('0x4d')]})['then'](function(_0x326d94){_0x408175[_0xd707('0x2e')]=_0x326d94;_0x56b09e[_0xd707('0xb6')]=[];if(_0x1a2a78['query'][_0xd707('0x107')]){_0x56b09e[_0xd707('0xb6')]['push']({'model':db[_0xd707('0xe2')],'as':_0xd707('0xe2'),'attributes':['id',_0xd707('0xed'),_0xd707('0xec')]});}if(_0x1a2a78[_0xd707('0x44')][_0xd707('0xb5')]){_0x56b09e[_0xd707('0xb6')]=[{'all':!![]}];}return db['ChatMessage'][_0xd707('0x105')](_0x56b09e);})[_0xd707('0x21')](function(_0x16d774){_0x408175[_0xd707('0xb3')]=_0x16d774;return _0x408175;});}})['then'](respondWithFilteredResult(_0x2e6234,_0x56b09e))['catch'](handleError(_0x2e6234,null));};exports[_0xd707('0x108')]=function(_0x4dd272,_0x3567a9,_0x598f48){return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x4dd272[_0xd707('0xba')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x3567a9,null))[_0xd707('0x21')](function(_0x367a5f){if(_0x367a5f){return _0x367a5f[_0xd707('0x109')](_0x4dd272[_0xd707('0x7b')]['ids'],_[_0xd707('0x101')](_0x4dd272[_0xd707('0x7b')],[_0xd707('0x100'),'id'])||{})[_0xd707('0x10a')](function(){return db[_0xd707('0x10b')][_0xd707('0x105')]({'attributes':['id','name',_0xd707('0x10c')],'where':{'id':_0x4dd272[_0xd707('0x7b')][_0xd707('0x100')]}});})['then'](function(_0x55801f){socket[_0xd707('0x10d')](_0xd707('0x10e'),{'id':Number(_0x4dd272[_0xd707('0xba')]['id']),'tags':_0x55801f||[]});return{'id':Number(_0x4dd272[_0xd707('0xba')]['id']),'tags':_0x55801f||[]};});}})['then'](respondWithResult(_0x3567a9,null))[_0xd707('0x29')](handleError(_0x3567a9,null));};exports[_0xd707('0x10f')]=function(_0x13ca5b,_0xcafe70,_0x34d660){return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x13ca5b[_0xd707('0xba')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0xcafe70,null))[_0xd707('0x21')](function(_0x4854ac){if(_0x4854ac){return _0x4854ac[_0xd707('0x10f')](_0x13ca5b[_0xd707('0x44')][_0xd707('0x100')]);}})['then'](respondWithStatusCode(_0xcafe70,null))[_0xd707('0x29')](handleError(_0xcafe70,null));};exports[_0xd707('0xd7')]=function(_0x5dddf0,_0x30e88a){var _0x4c6d3c=moment()[_0xd707('0x110')]()[_0xd707('0x9d')]();var _0x543f36=path[_0xd707('0xd8')](config[_0xd707('0xd9')],_0xd707('0x111'),_0xd707('0x112'),'tmp');var _0x55719f=path[_0xd707('0xd8')](config[_0xd707('0xd9')],_0xd707('0x111'),'files',_0xd707('0x113'));var _0x127251=path[_0xd707('0xd8')](_0x543f36,_0x4c6d3c);var _0x2ecda3=util['format'](_0xd707('0x114'),_0x5dddf0[_0xd707('0xba')]['id'],_0x4c6d3c);var _0x42b886=path[_0xd707('0xd8')](_0x543f36,_0x2ecda3);var _0x41f9e1=[];_0x41f9e1[_0xd707('0x3c')]({'model':db[_0xd707('0xe2')],'as':'User','attributes':['id',_0xd707('0xed')],'raw':!![]});_0x41f9e1['push']({'model':db[_0xd707('0xe3')],'as':_0xd707('0x6c'),'attributes':['id',_0xd707('0x115'),_0xd707('0x116')],'raw':!![]});if(_0x5dddf0[_0xd707('0x44')]['attachments']){_0x41f9e1[_0xd707('0x3c')]({'model':db[_0xd707('0xd4')],'as':_0xd707('0xd4'),'raw':!![]});}var _0xa9672d=[{'model':db['ChatMessage'],'as':_0xd707('0xe1'),'attributes':['id','body',_0xd707('0xee'),_0xd707('0xf0'),_0xd707('0xf1'),_0xd707('0x86')],'include':_0x41f9e1}];_0xa9672d[_0xd707('0x3c')]({'model':db[_0xd707('0xbe')],'as':_0xd707('0x117'),'attributes':['id',_0xd707('0x37')]});_0xa9672d[_0xd707('0x3c')]({'model':db[_0xd707('0xe2')],'as':_0xd707('0x118'),'attributes':['id',_0xd707('0xed')]});return db[_0xd707('0x3e')][_0xd707('0x68')]({'where':{'id':_0x5dddf0[_0xd707('0xba')]['id']},'include':_0xa9672d})[_0xd707('0x21')](handleEntityNotFound(_0x30e88a,null))['then'](function(_0x4e6d70){if(_0x4e6d70){var _0x48cb89=_0x4e6d70[_0xd707('0x119')]({'plain':!![]});fs[_0xd707('0x11a')](_0x127251);var _0x35e968={'format':'A4','border':_0xd707('0x11b'),'header':{'height':'40px','contents':{'first':_0xd707('0x11c')}},'footer':{'height':_0xd707('0x11d'),'contents':{'default':util['format'](_0xd707('0x11e'),util['format']('%s\x20#%d',_0xd707('0x11f'),_0x48cb89['id']),moment()[_0xd707('0xdc')](_0xd707('0x120'))['toString']())}}};var _0x4b00c4={'channel':'Chat','account':_0x48cb89[_0xd707('0x117')][_0xd707('0x37')],'agent':_0x48cb89[_0xd707('0x118')]?_0x48cb89[_0xd707('0x118')][_0xd707('0xed')]:_0xd707('0x121'),'createdAt':moment(_0x48cb89[_0xd707('0xee')])[_0xd707('0xdc')](_0xd707('0x104'))[_0xd707('0x9d')](),'closedAt':_0x48cb89[_0xd707('0xcd')]?moment(_0x48cb89[_0xd707('0x122')])['format'](_0xd707('0x104'))[_0xd707('0x9d')]():'','disposition':_0x48cb89[_0xd707('0xce')],'chatInfo':{'browser':_0x48cb89[_0xd707('0x123')],'os':_0x48cb89[_0xd707('0x124')],'referer':_0x48cb89[_0xd707('0x125')],'customerIp':_0x48cb89[_0xd707('0x126')],'customerPort':_0x48cb89[_0xd707('0x127')]?_0x48cb89['customerPort']:_0xd707('0x121')},'messages':_(_0x48cb89[_0xd707('0xe1')])[_0xd707('0x128')]()['filter']({'secret':![]})[_0xd707('0x39')](function(_0x522d0b){if(_0x522d0b[_0xd707('0xd4')]){var _0x375052=path[_0xd707('0xd8')](_0x55719f,_0x522d0b[_0xd707('0xd4')][_0xd707('0xda')]);if(fs[_0xd707('0x129')](_0x375052)){fs[_0xd707('0x12a')](_0x375052)[_0xd707('0x12b')](fs[_0xd707('0x12c')](path[_0xd707('0xd8')](_0x127251,_0x522d0b[_0xd707('0xd4')]['basename'])));}}return{'date':moment(_0x522d0b[_0xd707('0xee')])['format'](_0xd707('0x104'))[_0xd707('0x9d')](),'sender':_0x522d0b[_0xd707('0xf0')]===_0xd707('0xc6')?_0x522d0b[_0xd707('0xe2')]?_0x522d0b[_0xd707('0xe2')]['fullname']:'System':_0x522d0b[_0xd707('0x6c')][_0xd707('0x115')]+(_0x522d0b[_0xd707('0x6c')]['lastName']?'\x20'+_0x522d0b['Contact'][_0xd707('0x116')]:''),'body':_0x522d0b[_0xd707('0xd4')]?_0x522d0b[_0xd707('0xd4')][_0xd707('0xda')]:_0x522d0b[_0xd707('0x7b')],'direction':_0x522d0b[_0xd707('0xf0')]===_0xd707('0xc6')?'A':'C','secret':_0x522d0b[_0xd707('0xf1')],'read':_0x522d0b['read'],'attachment':_0x522d0b['Attachment']};})[_0xd707('0x6a')]()};return ejs['renderFile'](path[_0xd707('0xd8')](config[_0xd707('0xd9')],'server',_0xd707('0x12d'),_0xd707('0x12e')),{'interaction':_0x4b00c4})[_0xd707('0x21')](function(_0x28a3f9){return new BPromise(function(_0x5a5c7a,_0x318a62){pdf[_0xd707('0xb8')](_0x28a3f9,_0x35e968)['toFile'](path[_0xd707('0xd8')](_0x127251,_0xd707('0x12f')+_0x48cb89['id']+'-'+_0x4c6d3c+_0xd707('0x130')),function(_0x45593f,_0x189ad0){if(_0x45593f)return _0x318a62(_0x45593f);_0x5a5c7a(_0x189ad0);});});})[_0xd707('0x21')](function(){return new BPromise(function(_0x5e9613,_0x4b7847){zipdir(_0x127251,{'saveTo':_0x42b886},function(_0xe45ec8,_0x4590bc){if(_0xe45ec8)return _0x4b7847(_0xe45ec8);return _0x5e9613(_0x4590bc);});})[_0xd707('0x21')](function(){return new BPromise(function(_0x2b106d,_0x292ab5){rimraf(_0x127251,function(_0xe3aa1c){if(_0xe3aa1c)_0x292ab5(_0xe3aa1c);return _0x2b106d();});});})['then'](function(){return _0x30e88a[_0xd707('0xd7')](_0x42b886,_0x2ecda3,function(_0x11976a){if(_0x11976a){console['log'](_0xd707('0x131'),_0x11976a);}else{fs[_0xd707('0x132')](_0x42b886);}});});});}else{return _0x30e88a[_0xd707('0x2a')](0xc8);}})[_0xd707('0x29')](handleError(_0x30e88a,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a8718c4..9e8dd93 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 _0x147b=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x147b,0x193));var _0xb147=function(_0x5d1927,_0x123ef9){_0x5d1927=_0x5d1927-0x0;var _0x4c6235=_0x147b[_0x5d1927];return _0x4c6235;};'use strict';var EventEmitter=require(_0xb147('0x0'));var ChatInteraction=require(_0xb147('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xb147('0x1'))['db'][_0xb147('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb147('0x3'),'afterUpdate':_0xb147('0x4'),'afterDestroy':_0xb147('0x5')};function emitEvent(_0x5f457b){return function(_0x10b93f,_0x50abca,_0x2432f1){_0x10b93f[_0xb147('0x6')]({'attributes':['id'],'raw':!![]})[_0xb147('0x7')](function(_0x5e93d8){_0x10b93f['setDataValue'](_0xb147('0x8'),_0x5e93d8[_0xb147('0x9')](function(_0x29af7c){return{'id':_0x29af7c['id']};}));return ChatMessage[_0xb147('0xa')]({'where':{'ChatInteractionId':_0x10b93f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb147('0x7')](function(_0x22d125){_0x10b93f[_0xb147('0xb')](_0xb147('0xc'),_0x22d125['length']);ChatInteractionEvents['emit'](_0x5f457b+':'+_0x10b93f['id'],_0x10b93f);ChatInteractionEvents[_0xb147('0xd')](_0x5f457b,_0x10b93f);_0x2432f1(null);})[_0xb147('0xe')](_0x2432f1(null));};}for(var e in events){if(events[_0xb147('0xf')](e)){var event=events[e];ChatInteraction[_0xb147('0x10')](e,emitEvent(event));}}module[_0xb147('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xfb9f=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','save','update','remove'];(function(_0x42b3aa,_0x223f53){var _0x319157=function(_0x4e5c40){while(--_0x4e5c40){_0x42b3aa['push'](_0x42b3aa['shift']());}};_0x319157(++_0x223f53);}(_0xfb9f,0x187));var _0xffb9=function(_0x3c6cb4,_0x1fce32){_0x3c6cb4=_0x3c6cb4-0x0;var _0x41d108=_0xfb9f[_0x3c6cb4];return _0x41d108;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xffb9('0x0'))['db'][_0xffb9('0x1')];var ChatMessage=require(_0xffb9('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xffb9('0x2'),'afterUpdate':_0xffb9('0x3'),'afterDestroy':_0xffb9('0x4')};function emitEvent(_0x49c16a){return function(_0x44dd0d,_0x413ca4,_0x924b18){_0x44dd0d[_0xffb9('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4f1743){_0x44dd0d[_0xffb9('0x6')](_0xffb9('0x7'),_0x4f1743[_0xffb9('0x8')](function(_0x2d4ecd){return{'id':_0x2d4ecd['id']};}));return ChatMessage[_0xffb9('0x9')]({'where':{'ChatInteractionId':_0x44dd0d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xffb9('0xa')](function(_0x20c491){_0x44dd0d['setDataValue'](_0xffb9('0xb'),_0x20c491[_0xffb9('0xc')]);ChatInteractionEvents[_0xffb9('0xd')](_0x49c16a+':'+_0x44dd0d['id'],_0x44dd0d);ChatInteractionEvents[_0xffb9('0xd')](_0x49c16a,_0x44dd0d);_0x924b18(null);})[_0xffb9('0xe')](_0x924b18(null));};}for(var e in events){if(events[_0xffb9('0xf')](e)){var event=events[e];ChatInteraction[_0xffb9('0x10')](e,emitEvent(event));}}module[_0xffb9('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 61fa79d..ebe3b80 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 _0xea38=['ChatInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','rimraf','./chatInteraction.attributes','define'];(function(_0x16b54c,_0x5d4260){var _0x209579=function(_0x28a9fd){while(--_0x28a9fd){_0x16b54c['push'](_0x16b54c['shift']());}};_0x209579(++_0x5d4260);}(_0xea38,0x1a6));var _0x8ea3=function(_0x33838b,_0x302d87){_0x33838b=_0x33838b-0x0;var _0x1a7541=_0xea38[_0x33838b];return _0x1a7541;};'use strict';var _=require(_0x8ea3('0x0'));var util=require(_0x8ea3('0x1'));var logger=require(_0x8ea3('0x2'))(_0x8ea3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8ea3('0x4'));var config=require('../../config/environment');var attributes=require(_0x8ea3('0x5'));module['exports']=function(_0x5e0e23,_0x553513){return _0x5e0e23[_0x8ea3('0x6')](_0x8ea3('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34f0d3,_0xa8f742,_0x51057b){if(_0x34f0d3['changed'](_0x8ea3('0x8'))){_0x34f0d3[_0x8ea3('0x9')]=moment()['format'](_0x8ea3('0xa'));}_0x51057b(null,_0x34f0d3);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x19b4=['rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xca1f68,_0x112094){var _0x4cec58=function(_0x46b7bd){while(--_0x46b7bd){_0xca1f68['push'](_0xca1f68['shift']());}};_0x4cec58(++_0x112094);}(_0x19b4,0x1da));var _0x419b=function(_0x455dd9,_0x1e4863){_0x455dd9=_0x455dd9-0x0;var _0x1cf7dd=_0x19b4[_0x455dd9];return _0x1cf7dd;};'use strict';var _=require(_0x419b('0x0'));var util=require(_0x419b('0x1'));var logger=require(_0x419b('0x2'))(_0x419b('0x3'));var moment=require('moment');var BPromise=require(_0x419b('0x4'));var rp=require(_0x419b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x419b('0x6'));var config=require(_0x419b('0x7'));var attributes=require(_0x419b('0x8'));module['exports']=function(_0x510489,_0x435cba){return _0x510489['define'](_0x419b('0x9'),attributes,{'tableName':_0x419b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bab8f,_0x535dcb,_0x5f1bf3){if(_0x1bab8f[_0x419b('0xb')]('closed')){_0x1bab8f[_0x419b('0xc')]=moment()['format'](_0x419b('0xd'));}_0x5f1bf3(null,_0x1bab8f);}},'charset':_0x419b('0xe'),'collate':_0x419b('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 512462c..35395c1 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 _0x8e07=['./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','find','then','omit','ids','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x73658f,_0x132dfb){var _0x5b6291=function(_0x24d7d5){while(--_0x24d7d5){_0x73658f['push'](_0x73658f['shift']());}};_0x5b6291(++_0x132dfb);}(_0x8e07,0x13a));var _0x78e0=function(_0x2f8d86,_0x126144){_0x2f8d86=_0x2f8d86-0x0;var _0x394e57=_0x8e07[_0x2f8d86];return _0x394e57;};'use strict';var _=require(_0x78e0('0x0'));var util=require(_0x78e0('0x1'));var moment=require(_0x78e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x78e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e0('0x4'))['db'];var utils=require(_0x78e0('0x5'));var logger=require('../../config/logger')(_0x78e0('0x6'));var config=require(_0x78e0('0x7'));var jayson=require(_0x78e0('0x8'));var client=jayson['client'][_0x78e0('0x9')]({'port':0x232a});config['redis']=_[_0x78e0('0xa')](config[_0x78e0('0xb')],{'host':_0x78e0('0xc'),'port':0x18eb});var socket=require(_0x78e0('0xd'))(new Redis(config[_0x78e0('0xb')]));require(_0x78e0('0xe'))['register'](socket);function respondWithRpcPromise(_0x226a4d,_0x310898,_0x35d1db){return new BPromise(function(_0x2dbf1d,_0xbb6f74){return client[_0x78e0('0xf')](_0x226a4d,_0x35d1db)['then'](function(_0x14e456){logger[_0x78e0('0x10')](_0x78e0('0x11'),_0x310898,_0x78e0('0x12'));logger[_0x78e0('0x13')](_0x78e0('0x14'),_0x310898,_0x78e0('0x12'),JSON['stringify'](_0x14e456));if(_0x14e456[_0x78e0('0x15')]){if(_0x14e456[_0x78e0('0x15')][_0x78e0('0x16')]===0x1f4){logger[_0x78e0('0x15')](_0x78e0('0x11'),_0x310898,_0x14e456[_0x78e0('0x15')][_0x78e0('0x17')]);return _0xbb6f74(_0x14e456[_0x78e0('0x15')][_0x78e0('0x17')]);}logger[_0x78e0('0x15')](_0x78e0('0x11'),_0x310898,_0x14e456[_0x78e0('0x15')][_0x78e0('0x17')]);return _0x2dbf1d(_0x14e456[_0x78e0('0x15')]['message']);}else{logger[_0x78e0('0x10')](_0x78e0('0x11'),_0x310898,'request\x20sent');_0x2dbf1d(_0x14e456[_0x78e0('0x18')][_0x78e0('0x17')]);}})[_0x78e0('0x19')](function(_0x4981af){logger[_0x78e0('0x15')](_0x78e0('0x11'),_0x310898,_0x4981af);_0xbb6f74(_0x4981af);});});}exports['UpdateChatInteraction']=function(_0x2bfe29){var _0x3754a5=this;return new Promise(function(_0x1c17b0,_0x189b67){return db[_0x78e0('0x1a')][_0x78e0('0x1b')](_0x2bfe29[_0x78e0('0x1c')],{'raw':_0x2bfe29[_0x78e0('0x1d')]?_0x2bfe29[_0x78e0('0x1d')][_0x78e0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bfe29[_0x78e0('0x1d')]?_0x2bfe29[_0x78e0('0x1d')][_0x78e0('0x1f')]||null:null,'attributes':_0x2bfe29['options']?_0x2bfe29[_0x78e0('0x1d')][_0x78e0('0x20')]||null:null,'limit':_0x2bfe29[_0x78e0('0x1d')]?_0x2bfe29[_0x78e0('0x1d')][_0x78e0('0x21')]||null:null})['then'](function(_0x352cc9){logger[_0x78e0('0x10')]('UpdateChatInteraction',_0x2bfe29);logger['debug'](_0x78e0('0x22'),_0x2bfe29,JSON[_0x78e0('0x23')](_0x352cc9));_0x1c17b0(_0x352cc9);})['catch'](function(_0x1549bb){logger[_0x78e0('0x15')]('UpdateChatInteraction',_0x1549bb[_0x78e0('0x17')],_0x2bfe29);_0x189b67(_0x3754a5[_0x78e0('0x15')](0x1f4,_0x1549bb[_0x78e0('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x44595f){return new Promise(function(_0x4bdac8,_0x1089f4){return db['ChatInteraction'][_0x78e0('0x24')]({'where':_0x44595f[_0x78e0('0x1d')]?_0x44595f[_0x78e0('0x1d')][_0x78e0('0x1f')]||null:null})[_0x78e0('0x25')](function(_0x47888c){if(_0x47888c){return _0x47888c['addTags'](_0x44595f['body']['ids'],_[_0x78e0('0x26')](_0x44595f['body'],[_0x78e0('0x27'),'id'])||{});}})['spread'](function(_0x4ae152){logger[_0x78e0('0x10')](_0x78e0('0x28'),_0x44595f);logger[_0x78e0('0x13')]('AddTags',_0x44595f,JSON[_0x78e0('0x23')](_0x4ae152));_0x4bdac8(_0x4ae152);})[_0x78e0('0x19')](function(_0x42e37b){logger['error']('AddTags',_0x42e37b[_0x78e0('0x17')],_0x44595f);_0x1089f4(_this[_0x78e0('0x15')](0x1f4,_0x42e37b['message']));});});}; \ No newline at end of file +var _0x1ca1=['request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','ChatInteraction','addTags','omit','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register'];(function(_0x150d83,_0x108190){var _0x197e61=function(_0x55dd55){while(--_0x55dd55){_0x150d83['push'](_0x150d83['shift']());}};_0x197e61(++_0x108190);}(_0x1ca1,0x1ab));var _0x11ca=function(_0x11bcd0,_0xa95de4){_0x11bcd0=_0x11bcd0-0x0;var _0x228763=_0x1ca1[_0x11bcd0];return _0x228763;};'use strict';var _=require(_0x11ca('0x0'));var util=require('util');var moment=require(_0x11ca('0x1'));var BPromise=require('bluebird');var rs=require(_0x11ca('0x2'));var fs=require('fs');var Redis=require(_0x11ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x11ca('0x4'));var logger=require(_0x11ca('0x5'))('rpc');var config=require(_0x11ca('0x6'));var jayson=require(_0x11ca('0x7'));var client=jayson[_0x11ca('0x8')][_0x11ca('0x9')]({'port':0x232a});config[_0x11ca('0xa')]=_[_0x11ca('0xb')](config[_0x11ca('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11ca('0xa')]));require('./chatInteraction.socket')[_0x11ca('0xc')](socket);function respondWithRpcPromise(_0x13e634,_0x56fc62,_0x2e255a){return new BPromise(function(_0x5e2c30,_0x4ac020){return client[_0x11ca('0xd')](_0x13e634,_0x2e255a)[_0x11ca('0xe')](function(_0x2f61a0){logger[_0x11ca('0xf')](_0x11ca('0x10'),_0x56fc62,_0x11ca('0x11'));logger[_0x11ca('0x12')](_0x11ca('0x13'),_0x56fc62,_0x11ca('0x11'),JSON[_0x11ca('0x14')](_0x2f61a0));if(_0x2f61a0[_0x11ca('0x15')]){if(_0x2f61a0[_0x11ca('0x15')]['code']===0x1f4){logger[_0x11ca('0x15')](_0x11ca('0x10'),_0x56fc62,_0x2f61a0[_0x11ca('0x15')]['message']);return _0x4ac020(_0x2f61a0[_0x11ca('0x15')][_0x11ca('0x16')]);}logger[_0x11ca('0x15')](_0x11ca('0x10'),_0x56fc62,_0x2f61a0[_0x11ca('0x15')][_0x11ca('0x16')]);return _0x5e2c30(_0x2f61a0[_0x11ca('0x15')]['message']);}else{logger[_0x11ca('0xf')](_0x11ca('0x10'),_0x56fc62,_0x11ca('0x11'));_0x5e2c30(_0x2f61a0[_0x11ca('0x17')][_0x11ca('0x16')]);}})['catch'](function(_0x36d728){logger[_0x11ca('0x15')](_0x11ca('0x10'),_0x56fc62,_0x36d728);_0x4ac020(_0x36d728);});});}exports[_0x11ca('0x18')]=function(_0x5de5bb){var _0x129653=this;return new Promise(function(_0x4985bb,_0x111966){return db['ChatInteraction'][_0x11ca('0x19')](_0x5de5bb[_0x11ca('0x1a')],{'raw':_0x5de5bb[_0x11ca('0x1b')]?_0x5de5bb[_0x11ca('0x1b')][_0x11ca('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5de5bb[_0x11ca('0x1b')]?_0x5de5bb['options'][_0x11ca('0x1d')]||null:null,'attributes':_0x5de5bb[_0x11ca('0x1b')]?_0x5de5bb[_0x11ca('0x1b')][_0x11ca('0x1e')]||null:null,'limit':_0x5de5bb['options']?_0x5de5bb[_0x11ca('0x1b')][_0x11ca('0x1f')]||null:null})[_0x11ca('0xe')](function(_0x27f073){logger[_0x11ca('0xf')](_0x11ca('0x18'),_0x5de5bb);logger[_0x11ca('0x12')](_0x11ca('0x18'),_0x5de5bb,JSON[_0x11ca('0x14')](_0x27f073));_0x4985bb(_0x27f073);})[_0x11ca('0x20')](function(_0x9f410f){logger[_0x11ca('0x15')](_0x11ca('0x18'),_0x9f410f[_0x11ca('0x16')],_0x5de5bb);_0x111966(_0x129653['error'](0x1f4,_0x9f410f['message']));});});};exports[_0x11ca('0x21')]=function(_0x35c67b){return new Promise(function(_0x21e24f,_0x50c10b){return db[_0x11ca('0x22')]['find']({'where':_0x35c67b['options']?_0x35c67b[_0x11ca('0x1b')][_0x11ca('0x1d')]||null:null})[_0x11ca('0xe')](function(_0x2574dc){if(_0x2574dc){return _0x2574dc[_0x11ca('0x23')](_0x35c67b[_0x11ca('0x1a')]['ids'],_[_0x11ca('0x24')](_0x35c67b[_0x11ca('0x1a')],[_0x11ca('0x25'),'id'])||{});}})[_0x11ca('0x26')](function(_0x4ade68){logger[_0x11ca('0xf')]('AddTags',_0x35c67b);logger[_0x11ca('0x12')](_0x11ca('0x27'),_0x35c67b,JSON[_0x11ca('0x14')](_0x4ade68));_0x21e24f(_0x4ade68);})['catch'](function(_0x452411){logger['error'](_0x11ca('0x27'),_0x452411[_0x11ca('0x16')],_0x35c67b);_0x50c10b(_this[_0x11ca('0x15')](0x1f4,_0x452411['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 183e4ab..6b7bce0 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 _0x4532=['removeListener','register','length','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x17660f,_0x2b02b4){var _0xaaf47a=function(_0xd4cc31){while(--_0xd4cc31){_0x17660f['push'](_0x17660f['shift']());}};_0xaaf47a(++_0x2b02b4);}(_0x4532,0x12c));var _0x2453=function(_0x4a7a1c,_0x5209c0){_0x4a7a1c=_0x4a7a1c-0x0;var _0x5d270f=_0x4532[_0x4a7a1c];return _0x5d270f;};'use strict';var ChatInteractionEvents=require(_0x2453('0x0'));var events=['save',_0x2453('0x1'),_0x2453('0x2')];function createListener(_0x229f6e,_0xc66b78){return function(_0x31f6ee){_0xc66b78[_0x2453('0x3')](_0x229f6e,_0x31f6ee);};}function removeListener(_0x5874ab,_0x3c479b){return function(){ChatInteractionEvents[_0x2453('0x4')](_0x5874ab,_0x3c479b);};}exports[_0x2453('0x5')]=function(_0x48f307){for(var _0x5c3d04=0x0,_0x1b7cb2=events[_0x2453('0x6')];_0x5c3d04<_0x1b7cb2;_0x5c3d04++){var _0x3c50fd=events[_0x5c3d04];var _0x5345e5=createListener(_0x2453('0x7')+_0x3c50fd,_0x48f307);ChatInteractionEvents['on'](_0x3c50fd,_0x5345e5);}}; \ No newline at end of file +var _0xc403=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x2b441f,_0x10a479){var _0x413b15=function(_0x56cc27){while(--_0x56cc27){_0x2b441f['push'](_0x2b441f['shift']());}};_0x413b15(++_0x10a479);}(_0xc403,0x83));var _0x3c40=function(_0x204286,_0x10a03f){_0x204286=_0x204286-0x0;var _0x5626df=_0xc403[_0x204286];return _0x5626df;};'use strict';var ChatInteractionEvents=require(_0x3c40('0x0'));var events=[_0x3c40('0x1'),'remove',_0x3c40('0x2')];function createListener(_0x2932c3,_0x5b5462){return function(_0x37126c){_0x5b5462[_0x3c40('0x3')](_0x2932c3,_0x37126c);};}function removeListener(_0x330ce6,_0x352b35){return function(){ChatInteractionEvents['removeListener'](_0x330ce6,_0x352b35);};}exports[_0x3c40('0x4')]=function(_0x4d1d10){for(var _0x2664cd=0x0,_0x519a81=events[_0x3c40('0x5')];_0x2664cd<_0x519a81;_0x2664cd++){var _0x50ea98=events[_0x2664cd];var _0x1f71a8=createListener(_0x3c40('0x6')+_0x50ea98,_0x4d1d10);ChatInteractionEvents['on'](_0x50ea98,_0x1f71a8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 13f2d7e..df27da3 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 _0x26d9=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router'];(function(_0x245885,_0x15248e){var _0x5911e0=function(_0x4b1465){while(--_0x4b1465){_0x245885['push'](_0x245885['shift']());}};_0x5911e0(++_0x15248e);}(_0x26d9,0x133));var _0x926d=function(_0x38292a,_0x4daafd){_0x38292a=_0x38292a-0x0;var _0x5b0a5c=_0x26d9[_0x38292a];return _0x5b0a5c;};'use strict';var multer=require('multer');var util=require(_0x926d('0x0'));var path=require(_0x926d('0x1'));var timeout=require(_0x926d('0x2'));var express=require(_0x926d('0x3'));var router=express[_0x926d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x926d('0x5'));var config=require(_0x926d('0x6'));var controller=require(_0x926d('0x7'));router['get']('/',auth[_0x926d('0x8')](),controller[_0x926d('0x9')]);router[_0x926d('0xa')](_0x926d('0xb'),auth[_0x926d('0x8')](),controller[_0x926d('0xc')]);router['get'](_0x926d('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x926d('0xe')]);router[_0x926d('0xa')](_0x926d('0xf'),auth[_0x926d('0x10')](),controller[_0x926d('0x11')]);router[_0x926d('0xa')](_0x926d('0x12'),auth[_0x926d('0x8')](),controller[_0x926d('0x13')]);router[_0x926d('0xa')](_0x926d('0x14'),auth[_0x926d('0x10')](),controller[_0x926d('0x15')]);router[_0x926d('0xa')]('/:id/download',auth[_0x926d('0x8')](),controller[_0x926d('0x16')]);router[_0x926d('0x17')]('/',auth[_0x926d('0x8')](),controller['create']);router[_0x926d('0x17')](_0x926d('0x18'),auth[_0x926d('0x8')](),controller[_0x926d('0x19')]);var upload=multer({'storage':multer[_0x926d('0x1a')]({'destination':function(_0x29cd1c,_0x4440d8,_0x5282f3){_0x5282f3(null,path[_0x926d('0x1b')](config[_0x926d('0x1c')],_0x926d('0x1d')));},'filename':function(_0x368ec4,_0x5cf827,_0x5a8bf6){_0x5a8bf6(null,util[_0x926d('0x1e')](_0x926d('0x1f'),Date['now'](),_0x5cf827['originalname'][_0x926d('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x926d('0x17')](_0x926d('0x21'),upload[_0x926d('0x22')]('file'),controller[_0x926d('0x23')]);router[_0x926d('0x17')](_0x926d('0x12'),auth[_0x926d('0x10')](),controller[_0x926d('0x24')]);router[_0x926d('0x17')](_0x926d('0x25'),auth[_0x926d('0x8')](),interaction[_0x926d('0x26')](_0x926d('0x27'),'chatinteraction:addtags'),controller['addTags']);router[_0x926d('0x28')](_0x926d('0xd'),auth[_0x926d('0x8')](),interaction[_0x926d('0x26')](_0x926d('0x27'),_0x926d('0x29')),controller[_0x926d('0x2a')]);router[_0x926d('0x28')](_0x926d('0x2b'),controller[_0x926d('0x2c')]);router[_0x926d('0x28')](_0x926d('0x2d'),auth[_0x926d('0x10')](),controller[_0x926d('0x2e')]);router[_0x926d('0x28')]('/:id/close',controller[_0x926d('0x2f')]);router['delete'](_0x926d('0xd'),auth[_0x926d('0x8')](),interaction[_0x926d('0x26')](_0x926d('0x27'),'chatinteraction:destroy'),controller[_0x926d('0x30')]);router[_0x926d('0x31')]('/:id/tags',auth[_0x926d('0x8')](),controller[_0x926d('0x32')]);module[_0x926d('0x33')]=router; \ No newline at end of file +var _0x13c0=['isAuthenticated','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','single','file','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller'];(function(_0x561162,_0x41fb04){var _0x2b1c7=function(_0xc9e52b){while(--_0xc9e52b){_0x561162['push'](_0x561162['shift']());}};_0x2b1c7(++_0x41fb04);}(_0x13c0,0x8b));var _0x013c=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x13c0[_0x8c1005];return _0x175354;};'use strict';var multer=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var path=require(_0x013c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x013c('0x3')]();var auth=require(_0x013c('0x4'));var interaction=require(_0x013c('0x5'));var config=require(_0x013c('0x6'));var controller=require(_0x013c('0x7'));router['get']('/',auth[_0x013c('0x8')](),controller['index']);router[_0x013c('0x9')](_0x013c('0xa'),auth[_0x013c('0x8')](),controller[_0x013c('0xb')]);router['get'](_0x013c('0xc'),auth[_0x013c('0xd')](),controller[_0x013c('0xe')]);router[_0x013c('0x9')](_0x013c('0xf'),auth[_0x013c('0xd')](),controller[_0x013c('0x10')]);router[_0x013c('0x9')](_0x013c('0x11'),auth['isAuthenticated'](),controller[_0x013c('0x12')]);router[_0x013c('0x9')](_0x013c('0x13'),auth[_0x013c('0xd')](),controller['getMyMessages']);router[_0x013c('0x9')](_0x013c('0x14'),auth[_0x013c('0x8')](),controller[_0x013c('0x15')]);router[_0x013c('0x16')]('/',auth[_0x013c('0x8')](),controller['create']);router[_0x013c('0x16')](_0x013c('0x17'),auth[_0x013c('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x013c('0x18')]({'destination':function(_0x38944c,_0xb33134,_0x489106){_0x489106(null,path['join'](config[_0x013c('0x19')],_0x013c('0x1a')));},'filename':function(_0x57cc4e,_0x22d53d,_0x191be7){_0x191be7(null,util[_0x013c('0x1b')](_0x013c('0x1c'),Date['now'](),_0x22d53d[_0x013c('0x1d')][_0x013c('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x013c('0x16')]('/:id/attachment_upload',upload[_0x013c('0x1f')](_0x013c('0x20')),controller['attachmentUpload']);router[_0x013c('0x16')](_0x013c('0x11'),auth[_0x013c('0xd')](),controller['addMessage']);router['post'](_0x013c('0x21'),auth[_0x013c('0x8')](),interaction[_0x013c('0x22')](_0x013c('0x23'),_0x013c('0x24')),controller[_0x013c('0x25')]);router[_0x013c('0x26')](_0x013c('0xc'),auth[_0x013c('0x8')](),interaction[_0x013c('0x22')](_0x013c('0x23'),_0x013c('0x27')),controller[_0x013c('0x28')]);router[_0x013c('0x26')](_0x013c('0x29'),controller[_0x013c('0x2a')]);router[_0x013c('0x26')](_0x013c('0x2b'),auth[_0x013c('0xd')](),controller['abandon']);router[_0x013c('0x26')](_0x013c('0x2c'),controller[_0x013c('0x2d')]);router[_0x013c('0x2e')]('/:id',auth[_0x013c('0x8')](),interaction['tracked'](_0x013c('0x23'),'chatinteraction:destroy'),controller['destroy']);router[_0x013c('0x2e')](_0x013c('0x21'),auth[_0x013c('0x8')](),controller[_0x013c('0x2f')]);module[_0x013c('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4048370..0662430 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 _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x0b0e[_0x4ce1b9];return _0x2bb15d;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0b0('0x3')]}}; \ No newline at end of file +var _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4975,0x86));var _0x5497=function(_0x429a4a,_0x1655c9){_0x429a4a=_0x429a4a-0x0;var _0x18be8b=_0x4975[_0x429a4a];return _0x18be8b;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ccb10e8..b2794bd 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 _0x86ae=['findAll','rows','catch','show','params','merge','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','messages','FromId','read','-createdAt','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','filters','VIRTUAL','filter','options','includeAll','include'];(function(_0x5ec21d,_0x5d0772){var _0x43bde8=function(_0x1bfc7c){while(--_0x1bfc7c){_0x5ec21d['push'](_0x5ec21d['shift']());}};_0x43bde8(++_0x5d0772);}(_0x86ae,0xfd));var _0xe86a=function(_0x38346f,_0x211b64){_0x38346f=_0x38346f-0x0;var _0x39a394=_0x86ae[_0x38346f];return _0x39a394;};'use strict';var pdf=require(_0xe86a('0x0'));var emlformat=require(_0xe86a('0x1'));var rimraf=require(_0xe86a('0x2'));var zipdir=require(_0xe86a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe86a('0x4'));var moment=require(_0xe86a('0x5'));var BPromise=require(_0xe86a('0x6'));var Mustache=require(_0xe86a('0x7'));var util=require('util');var path=require(_0xe86a('0x8'));var sox=require(_0xe86a('0x9'));var csv=require(_0xe86a('0xa'));var ejs=require(_0xe86a('0xb'));var fs=require('fs');var _=require(_0xe86a('0xc'));var squel=require(_0xe86a('0xd'));var crypto=require(_0xe86a('0xe'));var jsforce=require(_0xe86a('0xf'));var deskjs=require(_0xe86a('0x10'));var toCsv=require(_0xe86a('0xa'));var querystring=require(_0xe86a('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe86a('0x12'));var as=require(_0xe86a('0x13'));var hardwareService=require(_0xe86a('0x14'));var logger=require('../../config/logger')(_0xe86a('0x15'));var utils=require(_0xe86a('0x16'));var config=require(_0xe86a('0x17'));var licenseUtil=require(_0xe86a('0x18'));var db=require(_0xe86a('0x19'))['db'];config[_0xe86a('0x1a')]=_[_0xe86a('0x1b')](config[_0xe86a('0x1a')],{'host':_0xe86a('0x1c'),'port':0x18eb});var socket=require(_0xe86a('0x1d'))(new Redis(config[_0xe86a('0x1a')]));require('./chatInternalMessage.socket')[_0xe86a('0x1e')](socket);function respondWithStatusCode(_0x46ebb4,_0x57e3ac){_0x57e3ac=_0x57e3ac||0xcc;return function(_0x562c9d){if(_0x562c9d){return _0x46ebb4[_0xe86a('0x1f')](_0x57e3ac);}return _0x46ebb4[_0xe86a('0x20')](_0x57e3ac)[_0xe86a('0x21')]();};}function respondWithResult(_0x1cb455,_0x39d074){_0x39d074=_0x39d074||0xc8;return function(_0x4ce621){if(_0x4ce621){return _0x1cb455[_0xe86a('0x20')](_0x39d074)[_0xe86a('0x22')](_0x4ce621);}};}function respondWithFilteredResult(_0x20c17e,_0x4b39a6){return function(_0x1dd5b1){if(_0x1dd5b1){var _0x4a48ea=_0x1dd5b1[_0xe86a('0x23')],_0x732b0=_0x4b39a6[_0xe86a('0x24')],_0x889218=_0x4b39a6['offset']+_0x4b39a6[_0xe86a('0x25')],_0x3632a7;if(_0x889218>=_0x4a48ea){_0x889218=_0x4a48ea;_0x3632a7=0xc8;}else{_0x3632a7=0xce;}_0x20c17e[_0xe86a('0x20')](_0x3632a7);return _0x20c17e[_0xe86a('0x26')](_0xe86a('0x27'),_0x732b0+'-'+_0x889218+'/'+_0x4a48ea)[_0xe86a('0x22')](_0x1dd5b1);}return null;};}function patchUpdates(_0x12664e){return function(_0xca03f0){try{jsonpatch['apply'](_0xca03f0,_0x12664e,!![]);}catch(_0x4378d9){return BPromise[_0xe86a('0x28')](_0x4378d9);}return _0xca03f0[_0xe86a('0x29')]();};}function saveUpdates(_0x4a72c4,_0x24e12d){return function(_0xb3e944){if(_0xb3e944){return _0xb3e944[_0xe86a('0x2a')](_0x4a72c4)[_0xe86a('0x2b')](function(_0x52e702){return _0x52e702;});}return null;};}function removeEntity(_0x53f756,_0x5696e2){return function(_0x191929){if(_0x191929){return _0x191929[_0xe86a('0x2c')]()[_0xe86a('0x2b')](function(){_0x53f756[_0xe86a('0x20')](0xcc)[_0xe86a('0x21')]();});}};}function handleEntityNotFound(_0x4d5db5,_0x4f2cd3){return function(_0x361579){if(!_0x361579){_0x4d5db5[_0xe86a('0x1f')](0x194);}return _0x361579;};}function handleError(_0x56c04d,_0x180cc8){_0x180cc8=_0x180cc8||0x1f4;return function(_0x3c0441){logger['error'](_0x3c0441['stack']);if(_0x3c0441[_0xe86a('0x2d')]){delete _0x3c0441[_0xe86a('0x2d')];}_0x56c04d[_0xe86a('0x20')](_0x180cc8)[_0xe86a('0x2e')](_0x3c0441);};}exports[_0xe86a('0x2f')]=function(_0x9629cf,_0x5f26e1){var _0x3abd20={},_0x2ed9f1={},_0x1eb436={'count':0x0,'rows':[]};var _0x4e1ceb=_[_0xe86a('0x30')](db[_0xe86a('0x31')][_0xe86a('0x32')],function(_0x4643be){return{'name':_0x4643be['fieldName'],'type':_0x4643be[_0xe86a('0x33')][_0xe86a('0x34')]};});_0x2ed9f1[_0xe86a('0x35')]=_[_0xe86a('0x30')](_0x4e1ceb,_0xe86a('0x2d'));_0x2ed9f1['query']=_['keys'](_0x9629cf[_0xe86a('0x36')]);_0x2ed9f1['filters']=_['intersection'](_0x2ed9f1[_0xe86a('0x35')],_0x2ed9f1[_0xe86a('0x36')]);_0x3abd20[_0xe86a('0x37')]=_[_0xe86a('0x38')](_0x2ed9f1[_0xe86a('0x35')],qs['fields'](_0x9629cf['query'][_0xe86a('0x39')]));_0x3abd20[_0xe86a('0x37')]=_0x3abd20[_0xe86a('0x37')][_0xe86a('0x3a')]?_0x3abd20[_0xe86a('0x37')]:_0x2ed9f1[_0xe86a('0x35')];if(!_0x9629cf[_0xe86a('0x36')]['hasOwnProperty'](_0xe86a('0x3b'))){_0x3abd20['limit']=qs['limit'](_0x9629cf[_0xe86a('0x36')][_0xe86a('0x25')]);_0x3abd20['offset']=qs[_0xe86a('0x24')](_0x9629cf[_0xe86a('0x36')][_0xe86a('0x24')]);}_0x3abd20['order']=qs[_0xe86a('0x3c')](_0x9629cf['query']['sort']);_0x3abd20[_0xe86a('0x3d')]=qs[_0xe86a('0x3e')](_['pick'](_0x9629cf[_0xe86a('0x36')],_0x2ed9f1['filters']),_0x4e1ceb);if(_0x9629cf[_0xe86a('0x36')]['filter']){_0x3abd20['where']=_['merge'](_0x3abd20[_0xe86a('0x3d')],{'$or':_[_0xe86a('0x30')](_0x4e1ceb,function(_0x18204b){if(_0x18204b[_0xe86a('0x33')]!==_0xe86a('0x3f')){var _0x4fab28={};_0x4fab28[_0x18204b['name']]={'$like':'%'+_0x9629cf['query'][_0xe86a('0x40')]+'%'};return _0x4fab28;}})});}_0x3abd20=_['merge']({},_0x3abd20,_0x9629cf[_0xe86a('0x41')]);var _0x360f9c={'where':_0x3abd20[_0xe86a('0x3d')]};return db[_0xe86a('0x31')][_0xe86a('0x23')](_0x360f9c)[_0xe86a('0x2b')](function(_0xa453e7){_0x1eb436['count']=_0xa453e7;if(_0x9629cf[_0xe86a('0x36')][_0xe86a('0x42')]){_0x3abd20[_0xe86a('0x43')]=[{'all':!![]}];}return db[_0xe86a('0x31')][_0xe86a('0x44')](_0x3abd20);})[_0xe86a('0x2b')](function(_0x51675a){_0x1eb436[_0xe86a('0x45')]=_0x51675a;return _0x1eb436;})[_0xe86a('0x2b')](respondWithFilteredResult(_0x5f26e1,_0x3abd20))[_0xe86a('0x46')](handleError(_0x5f26e1,null));};exports[_0xe86a('0x47')]=function(_0x4417a1,_0x5bfc7d){var _0x38f6ab={'raw':!![],'where':{'id':_0x4417a1[_0xe86a('0x48')]['id']}},_0x755a60={};_0x755a60['model']=_['keys'](db[_0xe86a('0x31')][_0xe86a('0x32')]);_0x755a60['query']=_['keys'](_0x4417a1[_0xe86a('0x36')]);_0x755a60[_0xe86a('0x3e')]=_[_0xe86a('0x38')](_0x755a60[_0xe86a('0x35')],_0x755a60[_0xe86a('0x36')]);_0x38f6ab[_0xe86a('0x37')]=_[_0xe86a('0x38')](_0x755a60[_0xe86a('0x35')],qs[_0xe86a('0x39')](_0x4417a1[_0xe86a('0x36')][_0xe86a('0x39')]));_0x38f6ab[_0xe86a('0x37')]=_0x38f6ab[_0xe86a('0x37')][_0xe86a('0x3a')]?_0x38f6ab[_0xe86a('0x37')]:_0x755a60[_0xe86a('0x35')];if(_0x4417a1[_0xe86a('0x36')][_0xe86a('0x42')]){_0x38f6ab[_0xe86a('0x43')]=[{'all':!![]}];}_0x38f6ab=_[_0xe86a('0x49')]({},_0x38f6ab,_0x4417a1['options']);return db[_0xe86a('0x31')][_0xe86a('0x4a')](_0x38f6ab)[_0xe86a('0x2b')](handleEntityNotFound(_0x5bfc7d,null))['then'](respondWithResult(_0x5bfc7d,null))[_0xe86a('0x46')](handleError(_0x5bfc7d,null));};exports['create']=function(_0x1e215e,_0x5f4a13){return db['ChatInternalMessage'][_0xe86a('0x4b')](_0x1e215e[_0xe86a('0x4c')],{})['then'](respondWithResult(_0x5f4a13,0xc9))[_0xe86a('0x46')](handleError(_0x5f4a13,null));};exports[_0xe86a('0x2a')]=function(_0x27ff98,_0x4ab0a4){if(_0x27ff98[_0xe86a('0x4c')]['id']){delete _0x27ff98[_0xe86a('0x4c')]['id'];}return db[_0xe86a('0x31')]['find']({'where':{'id':_0x27ff98['params']['id']}})[_0xe86a('0x2b')](handleEntityNotFound(_0x4ab0a4,null))[_0xe86a('0x2b')](saveUpdates(_0x27ff98[_0xe86a('0x4c')],null))[_0xe86a('0x2b')](respondWithResult(_0x4ab0a4,null))[_0xe86a('0x46')](handleError(_0x4ab0a4,null));};exports[_0xe86a('0x2c')]=function(_0x1eeca7,_0xfa516b){return db[_0xe86a('0x31')][_0xe86a('0x4a')]({'where':{'id':_0x1eeca7[_0xe86a('0x48')]['id']}})[_0xe86a('0x2b')](handleEntityNotFound(_0xfa516b,null))['then'](removeEntity(_0xfa516b,null))[_0xe86a('0x46')](handleError(_0xfa516b,null));};exports[_0xe86a('0x4d')]=function(_0x52d5fe,_0xf21881){return db[_0xe86a('0x31')][_0xe86a('0x4d')]()[_0xe86a('0x2b')](respondWithResult(_0xf21881,null))['catch'](handleError(_0xf21881,null));};function wrapUser(_0x52920b){return function(_0x36a4a1){var _0x592efa=_0x52920b[_0xe86a('0x4e')]({'plain':!![]});_0x592efa['messages']=[];if(_0x36a4a1){_0x592efa[_0xe86a('0x4f')]=_0x36a4a1[_0xe86a('0x50')];_0x592efa[_0xe86a('0x51')]=_0x36a4a1;}else{_0x592efa[_0xe86a('0x4f')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x592efa[_0xe86a('0x51')]={};}return _0x592efa;};}exports[_0xe86a('0x52')]=function(_0x5eec6a,_0x527d59,_0x1e5e78){var _0x560a9e=[];return db[_0xe86a('0x53')][_0xe86a('0x44')]({'where':{'role':[_0xe86a('0x54'),_0xe86a('0x55'),'user']},'attributes':['id',_0xe86a('0x56'),'name',_0xe86a('0x57'),_0xe86a('0x58'),_0xe86a('0x59'),_0xe86a('0x5a'),_0xe86a('0x5b'),_0xe86a('0x5c'),_0xe86a('0x5d')],'order':qs[_0xe86a('0x3c')]('-online'),'include':[{'model':db[_0xe86a('0x5e')],'as':_0xe86a('0x5f'),'attributes':['id',_0xe86a('0x2d'),_0xe86a('0x33')],'through':{'attributes':[]}}]})[_0xe86a('0x2b')](function(_0x3b67d0){if(_0x3b67d0){var _0x1400eb=_0x5eec6a['user']['get']({'plain':!![]});if(!_0x1400eb)throw new Error(_0xe86a('0x60'));if(_0x1400eb[_0xe86a('0x57')]===_0xe86a('0x61')){return db[_0xe86a('0x62')][_0xe86a('0x4a')]({'where':{'name':_0xe86a('0x63'),'userProfileId':_0x1400eb['userProfileId']},'raw':!![]})[_0xe86a('0x2b')](function(_0x3fc741){if(_0x3fc741){if(_0x3fc741[_0xe86a('0x64')]===0x0){return db['UserProfileResource'][_0xe86a('0x44')]({'where':{'sectionId':_0x3fc741['id']},'raw':!![]})['then'](function(_0x271fbc){var _0x58449c=[];if(_[_0xe86a('0x65')](_0x271fbc)){_0x58449c=_[_0xe86a('0x40')](_0x3b67d0,function(_0x1769c9){if(_0x1769c9[_0xe86a('0x57')]!==_0xe86a('0x54')){return _0x1769c9;}});return _0x58449c;}else{for(var _0x4287aa=0x0;_0x4287aa<_0x3b67d0[_0xe86a('0x3a')];_0x4287aa++){var _0x3620fb=_0x3b67d0[_0x4287aa];if(_0x3620fb[_0xe86a('0x57')]==='agent'){var _0x8c0ed=_[_0xe86a('0x4a')](_0x271fbc,function(_0x57753d){return _0x57753d[_0xe86a('0x66')]===_0x3620fb['id'];});if(_0x8c0ed)_0x58449c['push'](_0x3620fb);}else{_0x58449c['push'](_0x3620fb);}}return _0x58449c;}});}else{return _0x3b67d0;}}else{var _0x2ea2a2=_[_0xe86a('0x40')](_0x3b67d0,function(_0x457f17){if(_0x457f17['role']!=='agent'){return _0x457f17;}});return _0x2ea2a2;}});}else{return _0x3b67d0;}}})[_0xe86a('0x2b')](function(_0x5e0b31){var _0x3a03=[];if(_0x5e0b31){_0x560a9e=_0x5e0b31;for(var _0x5aa7a0=0x0;_0x5aa7a0<_0x5e0b31[_0xe86a('0x3a')];_0x5aa7a0+=0x1){_0x560a9e[_0x5aa7a0][_0xe86a('0x67')]=[];_0x3a03['push'](db[_0xe86a('0x31')][_0xe86a('0x4a')]({'where':{'FromId':[_0x5eec6a[_0xe86a('0x61')]['id'],_0x5e0b31[_0x5aa7a0]['id']],'ToId':[_0x5eec6a[_0xe86a('0x61')]['id'],_0x5e0b31[_0x5aa7a0]['id']],'ChatGroupId':null},'attributes':['id',_0xe86a('0x50'),_0xe86a('0x68'),'ToId',_0xe86a('0x69'),'body'],'order':qs[_0xe86a('0x3c')](_0xe86a('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe86a('0x2b')](wrapUser(_0x5e0b31[_0x5aa7a0])));}return BPromise['all'](_0x3a03);}return[];})[_0xe86a('0x2b')](function(_0x46940e){return{'rows':_0x46940e,'count':_0x46940e[_0xe86a('0x3a')]};})[_0xe86a('0x2b')](respondWithResult(_0x527d59,null))[_0xe86a('0x46')](handleError(_0x527d59,null));}; \ No newline at end of file +var _0xa60d=['merge','includeAll','include','findAll','catch','keys','options','find','create','body','params','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','userpic','internal','allowmessenger','showWebBar','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','-createdAt','all','html-pdf','eml-format','zip-dir','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','map','type'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa60d,0x1d0));var _0xda60=function(_0x14884f,_0x382384){_0x14884f=_0x14884f-0x0;var _0x36acae=_0xa60d[_0x14884f];return _0x36acae;};'use strict';var pdf=require(_0xda60('0x0'));var emlformat=require(_0xda60('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xda60('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda60('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda60('0x4'));var path=require('path');var sox=require(_0xda60('0x5'));var csv=require(_0xda60('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda60('0x7'));var squel=require(_0xda60('0x8'));var crypto=require(_0xda60('0x9'));var jsforce=require(_0xda60('0xa'));var deskjs=require(_0xda60('0xb'));var toCsv=require(_0xda60('0x6'));var querystring=require(_0xda60('0xc'));var Papa=require(_0xda60('0xd'));var Redis=require(_0xda60('0xe'));var authService=require(_0xda60('0xf'));var qs=require(_0xda60('0x10'));var as=require(_0xda60('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda60('0x12'))(_0xda60('0x13'));var utils=require(_0xda60('0x14'));var config=require(_0xda60('0x15'));var licenseUtil=require(_0xda60('0x16'));var db=require(_0xda60('0x17'))['db'];config[_0xda60('0x18')]=_[_0xda60('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda60('0x18')]));require(_0xda60('0x1a'))[_0xda60('0x1b')](socket);function respondWithStatusCode(_0x10f5f5,_0xb66cfc){_0xb66cfc=_0xb66cfc||0xcc;return function(_0x2754af){if(_0x2754af){return _0x10f5f5[_0xda60('0x1c')](_0xb66cfc);}return _0x10f5f5[_0xda60('0x1d')](_0xb66cfc)[_0xda60('0x1e')]();};}function respondWithResult(_0x52ec30,_0x376954){_0x376954=_0x376954||0xc8;return function(_0x53eccd){if(_0x53eccd){return _0x52ec30[_0xda60('0x1d')](_0x376954)[_0xda60('0x1f')](_0x53eccd);}};}function respondWithFilteredResult(_0x5d7f33,_0x5d0ad4){return function(_0x4b22f1){if(_0x4b22f1){var _0xbed27e=_0x4b22f1[_0xda60('0x20')],_0xd6b670=_0x5d0ad4['offset'],_0x54beb8=_0x5d0ad4[_0xda60('0x21')]+_0x5d0ad4[_0xda60('0x22')],_0x5f497c;if(_0x54beb8>=_0xbed27e){_0x54beb8=_0xbed27e;_0x5f497c=0xc8;}else{_0x5f497c=0xce;}_0x5d7f33['status'](_0x5f497c);return _0x5d7f33[_0xda60('0x23')](_0xda60('0x24'),_0xd6b670+'-'+_0x54beb8+'/'+_0xbed27e)[_0xda60('0x1f')](_0x4b22f1);}return null;};}function patchUpdates(_0x42bb03){return function(_0x629a4f){try{jsonpatch[_0xda60('0x25')](_0x629a4f,_0x42bb03,!![]);}catch(_0x5a31aa){return BPromise[_0xda60('0x26')](_0x5a31aa);}return _0x629a4f[_0xda60('0x27')]();};}function saveUpdates(_0x505176,_0x33fbb2){return function(_0xcf2aea){if(_0xcf2aea){return _0xcf2aea[_0xda60('0x28')](_0x505176)[_0xda60('0x29')](function(_0x34c022){return _0x34c022;});}return null;};}function removeEntity(_0x48ea85,_0x5d0181){return function(_0xac0ab){if(_0xac0ab){return _0xac0ab[_0xda60('0x2a')]()[_0xda60('0x29')](function(){_0x48ea85[_0xda60('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d625,_0xcd81d4){return function(_0x354189){if(!_0x354189){_0x52d625[_0xda60('0x1c')](0x194);}return _0x354189;};}function handleError(_0x3648d4,_0x2773e6){_0x2773e6=_0x2773e6||0x1f4;return function(_0x6b2f14){logger[_0xda60('0x2b')](_0x6b2f14[_0xda60('0x2c')]);if(_0x6b2f14[_0xda60('0x2d')]){delete _0x6b2f14['name'];}_0x3648d4[_0xda60('0x1d')](_0x2773e6)[_0xda60('0x2e')](_0x6b2f14);};}exports[_0xda60('0x2f')]=function(_0x2d4029,_0x1fd40f){var _0x76e58f={},_0x5c3aba={},_0x3c4c07={'count':0x0,'rows':[]};var _0x45f8af=_['map'](db[_0xda60('0x30')][_0xda60('0x31')],function(_0x33cfcf){return{'name':_0x33cfcf['fieldName'],'type':_0x33cfcf['type'][_0xda60('0x32')]};});_0x5c3aba[_0xda60('0x33')]=_['map'](_0x45f8af,_0xda60('0x2d'));_0x5c3aba[_0xda60('0x34')]=_['keys'](_0x2d4029['query']);_0x5c3aba[_0xda60('0x35')]=_['intersection'](_0x5c3aba['model'],_0x5c3aba[_0xda60('0x34')]);_0x76e58f[_0xda60('0x36')]=_[_0xda60('0x37')](_0x5c3aba['model'],qs[_0xda60('0x38')](_0x2d4029[_0xda60('0x34')][_0xda60('0x38')]));_0x76e58f[_0xda60('0x36')]=_0x76e58f[_0xda60('0x36')][_0xda60('0x39')]?_0x76e58f[_0xda60('0x36')]:_0x5c3aba[_0xda60('0x33')];if(!_0x2d4029[_0xda60('0x34')]['hasOwnProperty'](_0xda60('0x3a'))){_0x76e58f[_0xda60('0x22')]=qs[_0xda60('0x22')](_0x2d4029['query'][_0xda60('0x22')]);_0x76e58f[_0xda60('0x21')]=qs[_0xda60('0x21')](_0x2d4029['query'][_0xda60('0x21')]);}_0x76e58f[_0xda60('0x3b')]=qs[_0xda60('0x3c')](_0x2d4029['query']['sort']);_0x76e58f[_0xda60('0x3d')]=qs['filters'](_[_0xda60('0x3e')](_0x2d4029['query'],_0x5c3aba[_0xda60('0x35')]),_0x45f8af);if(_0x2d4029[_0xda60('0x34')][_0xda60('0x3f')]){_0x76e58f['where']=_['merge'](_0x76e58f[_0xda60('0x3d')],{'$or':_[_0xda60('0x40')](_0x45f8af,function(_0x2c95e){if(_0x2c95e[_0xda60('0x41')]!=='VIRTUAL'){var _0x24416a={};_0x24416a[_0x2c95e[_0xda60('0x2d')]]={'$like':'%'+_0x2d4029['query']['filter']+'%'};return _0x24416a;}})});}_0x76e58f=_[_0xda60('0x42')]({},_0x76e58f,_0x2d4029['options']);var _0x1ff32a={'where':_0x76e58f[_0xda60('0x3d')]};return db['ChatInternalMessage'][_0xda60('0x20')](_0x1ff32a)[_0xda60('0x29')](function(_0x1ce673){_0x3c4c07['count']=_0x1ce673;if(_0x2d4029[_0xda60('0x34')][_0xda60('0x43')]){_0x76e58f[_0xda60('0x44')]=[{'all':!![]}];}return db[_0xda60('0x30')][_0xda60('0x45')](_0x76e58f);})[_0xda60('0x29')](function(_0x25ce60){_0x3c4c07['rows']=_0x25ce60;return _0x3c4c07;})[_0xda60('0x29')](respondWithFilteredResult(_0x1fd40f,_0x76e58f))[_0xda60('0x46')](handleError(_0x1fd40f,null));};exports['show']=function(_0x458988,_0x3bf26e){var _0x1f2831={'raw':!![],'where':{'id':_0x458988['params']['id']}},_0x808010={};_0x808010['model']=_[_0xda60('0x47')](db[_0xda60('0x30')][_0xda60('0x31')]);_0x808010[_0xda60('0x34')]=_[_0xda60('0x47')](_0x458988['query']);_0x808010['filters']=_['intersection'](_0x808010['model'],_0x808010['query']);_0x1f2831[_0xda60('0x36')]=_[_0xda60('0x37')](_0x808010[_0xda60('0x33')],qs['fields'](_0x458988[_0xda60('0x34')][_0xda60('0x38')]));_0x1f2831['attributes']=_0x1f2831[_0xda60('0x36')]['length']?_0x1f2831[_0xda60('0x36')]:_0x808010[_0xda60('0x33')];if(_0x458988[_0xda60('0x34')][_0xda60('0x43')]){_0x1f2831[_0xda60('0x44')]=[{'all':!![]}];}_0x1f2831=_[_0xda60('0x42')]({},_0x1f2831,_0x458988[_0xda60('0x48')]);return db[_0xda60('0x30')][_0xda60('0x49')](_0x1f2831)['then'](handleEntityNotFound(_0x3bf26e,null))[_0xda60('0x29')](respondWithResult(_0x3bf26e,null))['catch'](handleError(_0x3bf26e,null));};exports[_0xda60('0x4a')]=function(_0x3ff520,_0x28c94c){return db['ChatInternalMessage'][_0xda60('0x4a')](_0x3ff520['body'],{})['then'](respondWithResult(_0x28c94c,0xc9))[_0xda60('0x46')](handleError(_0x28c94c,null));};exports[_0xda60('0x28')]=function(_0x138b56,_0xd83f76){if(_0x138b56[_0xda60('0x4b')]['id']){delete _0x138b56[_0xda60('0x4b')]['id'];}return db[_0xda60('0x30')][_0xda60('0x49')]({'where':{'id':_0x138b56[_0xda60('0x4c')]['id']}})[_0xda60('0x29')](handleEntityNotFound(_0xd83f76,null))['then'](saveUpdates(_0x138b56['body'],null))[_0xda60('0x29')](respondWithResult(_0xd83f76,null))['catch'](handleError(_0xd83f76,null));};exports['destroy']=function(_0x2b67ba,_0x5532be){return db[_0xda60('0x30')]['find']({'where':{'id':_0x2b67ba[_0xda60('0x4c')]['id']}})[_0xda60('0x29')](handleEntityNotFound(_0x5532be,null))[_0xda60('0x29')](removeEntity(_0x5532be,null))[_0xda60('0x46')](handleError(_0x5532be,null));};exports[_0xda60('0x4d')]=function(_0xcca734,_0xa0f4a6){return db[_0xda60('0x30')]['describe']()[_0xda60('0x29')](respondWithResult(_0xa0f4a6,null))[_0xda60('0x46')](handleError(_0xa0f4a6,null));};function wrapUser(_0x1671f8){return function(_0x23f9dc){var _0x47df0a=_0x1671f8['get']({'plain':!![]});_0x47df0a[_0xda60('0x4e')]=[];if(_0x23f9dc){_0x47df0a['lastMessageAt']=_0x23f9dc[_0xda60('0x4f')];_0x47df0a[_0xda60('0x50')]=_0x23f9dc;}else{_0x47df0a[_0xda60('0x51')]=moment(0x0)['format'](_0xda60('0x52'));_0x47df0a[_0xda60('0x50')]={};}return _0x47df0a;};}exports['getUsers']=function(_0x3eb8b2,_0x4f5234,_0x397ec1){var _0x1a6473=[];return db[_0xda60('0x53')][_0xda60('0x45')]({'where':{'role':[_0xda60('0x54'),_0xda60('0x55'),_0xda60('0x56')]},'attributes':['id',_0xda60('0x57'),_0xda60('0x2d'),'role',_0xda60('0x58'),_0xda60('0x59'),'online','lastLoginAt',_0xda60('0x5a'),_0xda60('0x5b')],'order':qs[_0xda60('0x3c')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xda60('0x5c'),'attributes':['id',_0xda60('0x2d'),_0xda60('0x41')],'through':{'attributes':[]}}]})['then'](function(_0x4bfdea){if(_0x4bfdea){var _0x2aa413=_0x3eb8b2[_0xda60('0x56')][_0xda60('0x5d')]({'plain':!![]});if(!_0x2aa413)throw new Error(_0xda60('0x5e'));if(_0x2aa413[_0xda60('0x5f')]===_0xda60('0x56')){return db[_0xda60('0x60')][_0xda60('0x49')]({'where':{'name':'Agents','userProfileId':_0x2aa413[_0xda60('0x61')]},'raw':!![]})[_0xda60('0x29')](function(_0x50cb13){if(_0x50cb13){if(_0x50cb13[_0xda60('0x62')]===0x0){return db[_0xda60('0x63')]['findAll']({'where':{'sectionId':_0x50cb13['id']},'raw':!![]})[_0xda60('0x29')](function(_0x41a01a){var _0x173dcd=[];if(_[_0xda60('0x64')](_0x41a01a)){_0x173dcd=_['filter'](_0x4bfdea,function(_0x4a850f){if(_0x4a850f['role']!=='agent'){return _0x4a850f;}});return _0x173dcd;}else{for(var _0x2b99fc=0x0;_0x2b99fc<_0x4bfdea[_0xda60('0x39')];_0x2b99fc++){var _0x1e588a=_0x4bfdea[_0x2b99fc];if(_0x1e588a['role']===_0xda60('0x54')){var _0x46e17c=_[_0xda60('0x49')](_0x41a01a,function(_0x45616f){return _0x45616f['resourceId']===_0x1e588a['id'];});if(_0x46e17c)_0x173dcd[_0xda60('0x65')](_0x1e588a);}else{_0x173dcd[_0xda60('0x65')](_0x1e588a);}}return _0x173dcd;}});}else{return _0x4bfdea;}}else{var _0x32659c=_[_0xda60('0x3f')](_0x4bfdea,function(_0x217e68){if(_0x217e68['role']!=='agent'){return _0x217e68;}});return _0x32659c;}});}else{return _0x4bfdea;}}})[_0xda60('0x29')](function(_0x483f8f){var _0x3b8acf=[];if(_0x483f8f){_0x1a6473=_0x483f8f;for(var _0x4cb549=0x0;_0x4cb549<_0x483f8f[_0xda60('0x39')];_0x4cb549+=0x1){_0x1a6473[_0x4cb549]['messages']=[];_0x3b8acf['push'](db[_0xda60('0x30')][_0xda60('0x49')]({'where':{'FromId':[_0x3eb8b2[_0xda60('0x56')]['id'],_0x483f8f[_0x4cb549]['id']],'ToId':[_0x3eb8b2[_0xda60('0x56')]['id'],_0x483f8f[_0x4cb549]['id']],'ChatGroupId':null},'attributes':['id',_0xda60('0x4f'),_0xda60('0x66'),_0xda60('0x67'),'read',_0xda60('0x4b')],'order':qs[_0xda60('0x3c')](_0xda60('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x483f8f[_0x4cb549])));}return BPromise[_0xda60('0x69')](_0x3b8acf);}return[];})[_0xda60('0x29')](function(_0x53829e){return{'rows':_0x53829e,'count':_0x53829e[_0xda60('0x39')]};})[_0xda60('0x29')](respondWithResult(_0x4f5234,null))[_0xda60('0x46')](handleError(_0x4f5234,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1524968..4c36241 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 _0x536e=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0xa2befe,_0x530e7a){var _0x13fe74=function(_0x3bd662){while(--_0x3bd662){_0xa2befe['push'](_0xa2befe['shift']());}};_0x13fe74(++_0x530e7a);}(_0x536e,0x155));var _0xe536=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x536e[_0x5b27da];return _0x3254f4;};'use strict';var EventEmitter=require(_0xe536('0x0'));var ChatInternalMessage=require(_0xe536('0x1'))['db'][_0xe536('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe536('0x3')](0x0);var events={'afterCreate':_0xe536('0x4'),'afterUpdate':_0xe536('0x5'),'afterDestroy':_0xe536('0x6')};function emitEvent(_0x181c14){return function(_0x26d7cb,_0x409e01,_0x18d460){ChatInternalMessageEvents[_0xe536('0x7')](_0x181c14+':'+_0x26d7cb['id'],_0x26d7cb);ChatInternalMessageEvents[_0xe536('0x7')](_0x181c14,_0x26d7cb);_0x18d460(null);};}for(var e in events){if(events[_0xe536('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x66d9=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','emit'];(function(_0x47d522,_0x3452b6){var _0x415dd3=function(_0x360247){while(--_0x360247){_0x47d522['push'](_0x47d522['shift']());}};_0x415dd3(++_0x3452b6);}(_0x66d9,0x1e9));var _0x966d=function(_0x2a00db,_0x1ea3a7){_0x2a00db=_0x2a00db-0x0;var _0x5096d7=_0x66d9[_0x2a00db];return _0x5096d7;};'use strict';var EventEmitter=require(_0x966d('0x0'));var ChatInternalMessage=require(_0x966d('0x1'))['db'][_0x966d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x966d('0x3')](0x0);var events={'afterCreate':_0x966d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc9a88b){return function(_0x34a638,_0x4e120a,_0x581424){ChatInternalMessageEvents['emit'](_0xc9a88b+':'+_0x34a638['id'],_0x34a638);ChatInternalMessageEvents[_0x966d('0x5')](_0xc9a88b,_0x34a638);_0x581424(null);};}for(var e in events){if(events[_0x966d('0x6')](e)){var event=events[e];ChatInternalMessage[_0x966d('0x7')](e,emitEvent(event));}}module[_0x966d('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 922316c..23b34a8 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x4774cb,_0x3a244a){var _0x3e49d2=function(_0x19fc5a){while(--_0x19fc5a){_0x4774cb['push'](_0x4774cb['shift']());}};_0x3e49d2(++_0x3a244a);}(_0xaa88,0x137));var _0x8aa8=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xaa88[_0x212fcc];return _0x4d8190;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ No newline at end of file +var _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5649c2,_0x5c8d04){_0x5649c2=_0x5649c2-0x0;var _0x28b072=_0xbdb7[_0x5649c2];return _0x28b072;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1995e93..e1e0382 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 _0x6d01=['redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29af0e,_0x35f669){var _0x349e39=function(_0x251fba){while(--_0x251fba){_0x29af0e['push'](_0x29af0e['shift']());}};_0x349e39(++_0x35f669);}(_0x6d01,0x91));var _0x16d0=function(_0x164884,_0x4e5251){_0x164884=_0x164884-0x0;var _0x36fa5a=_0x6d01[_0x164884];return _0x36fa5a;};'use strict';var _=require('lodash');var util=require(_0x16d0('0x0'));var moment=require(_0x16d0('0x1'));var BPromise=require(_0x16d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16d0('0x3'));var db=require(_0x16d0('0x4'))['db'];var utils=require(_0x16d0('0x5'));var logger=require('../../config/logger')(_0x16d0('0x6'));var config=require(_0x16d0('0x7'));var jayson=require(_0x16d0('0x8'));var client=jayson[_0x16d0('0x9')][_0x16d0('0xa')]({'port':0x232a});config[_0x16d0('0xb')]=_[_0x16d0('0xc')](config[_0x16d0('0xb')],{'host':_0x16d0('0xd'),'port':0x18eb});var socket=require(_0x16d0('0xe'))(new Redis(config[_0x16d0('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2fa191,_0xc73fa,_0x4443d3){return new BPromise(function(_0xd036e0,_0x195a20){return client[_0x16d0('0xf')](_0x2fa191,_0x4443d3)[_0x16d0('0x10')](function(_0xfde7ee){logger[_0x16d0('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0xc73fa,_0x16d0('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xc73fa,'request\x20sent',JSON[_0x16d0('0x13')](_0xfde7ee));if(_0xfde7ee['error']){if(_0xfde7ee[_0x16d0('0x14')][_0x16d0('0x15')]===0x1f4){logger['error'](_0x16d0('0x16'),_0xc73fa,_0xfde7ee['error'][_0x16d0('0x17')]);return _0x195a20(_0xfde7ee[_0x16d0('0x14')][_0x16d0('0x17')]);}logger['error'](_0x16d0('0x16'),_0xc73fa,_0xfde7ee[_0x16d0('0x14')][_0x16d0('0x17')]);return _0xd036e0(_0xfde7ee[_0x16d0('0x14')]['message']);}else{logger[_0x16d0('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0xc73fa,'request\x20sent');_0xd036e0(_0xfde7ee[_0x16d0('0x18')][_0x16d0('0x17')]);}})[_0x16d0('0x19')](function(_0x4c2152){logger[_0x16d0('0x14')](_0x16d0('0x16'),_0xc73fa,_0x4c2152);_0x195a20(_0x4c2152);});});} \ No newline at end of file +var _0x6ff2=['rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6ff2,0xf3));var _0x26ff=function(_0x202b6f,_0x375d3b){_0x202b6f=_0x202b6f-0x0;var _0x29989c=_0x6ff2[_0x202b6f];return _0x29989c;};'use strict';var _=require(_0x26ff('0x0'));var util=require(_0x26ff('0x1'));var moment=require(_0x26ff('0x2'));var BPromise=require('bluebird');var rs=require(_0x26ff('0x3'));var fs=require('fs');var Redis=require(_0x26ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26ff('0x5'));var logger=require(_0x26ff('0x6'))(_0x26ff('0x7'));var config=require(_0x26ff('0x8'));var jayson=require(_0x26ff('0x9'));var client=jayson[_0x26ff('0xa')][_0x26ff('0xb')]({'port':0x232a});config[_0x26ff('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x26ff('0xd'))(new Redis(config['redis']));require(_0x26ff('0xe'))[_0x26ff('0xf')](socket);function respondWithRpcPromise(_0x328cc3,_0x31154e,_0x47c2c3){return new BPromise(function(_0x471cec,_0x2d6cfb){return client['request'](_0x328cc3,_0x47c2c3)[_0x26ff('0x10')](function(_0x4f6e5a){logger['info'](_0x26ff('0x11'),_0x31154e,_0x26ff('0x12'));logger[_0x26ff('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x31154e,_0x26ff('0x12'),JSON['stringify'](_0x4f6e5a));if(_0x4f6e5a[_0x26ff('0x14')]){if(_0x4f6e5a[_0x26ff('0x14')]['code']===0x1f4){logger[_0x26ff('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x31154e,_0x4f6e5a[_0x26ff('0x14')][_0x26ff('0x15')]);return _0x2d6cfb(_0x4f6e5a['error'][_0x26ff('0x15')]);}logger['error'](_0x26ff('0x11'),_0x31154e,_0x4f6e5a['error'][_0x26ff('0x15')]);return _0x471cec(_0x4f6e5a[_0x26ff('0x14')][_0x26ff('0x15')]);}else{logger[_0x26ff('0x16')](_0x26ff('0x11'),_0x31154e,'request\x20sent');_0x471cec(_0x4f6e5a[_0x26ff('0x17')][_0x26ff('0x15')]);}})[_0x26ff('0x18')](function(_0x209d19){logger[_0x26ff('0x14')](_0x26ff('0x11'),_0x31154e,_0x209d19);_0x2d6cfb(_0x209d19);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 3a37fee..729b272 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 _0x222f=['./chatInternalMessage.events','save','remove','update','emit','register'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x222f,0x1a4));var _0xf222=function(_0x21dd50,_0x921f70){_0x21dd50=_0x21dd50-0x0;var _0x1b7d5e=_0x222f[_0x21dd50];return _0x1b7d5e;};'use strict';var ChatInternalMessageEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatInternalMessageEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatInternalMessage:'+_0xf5a105,_0x54a758);ChatInternalMessageEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file +var _0x72b1=['register','length','./chatInternalMessage.events','remove','update','emit','removeListener'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x72b1,0x16e));var _0x172b=function(_0x3719da,_0x40994b){_0x3719da=_0x3719da-0x0;var _0x359f25=_0x72b1[_0x3719da];return _0x359f25;};'use strict';var ChatInternalMessageEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatInternalMessageEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatInternalMessage:'+_0x517363,_0x475fd6);ChatInternalMessageEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 9d10e33..a32d6e3 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(_0xe4fdc,_0x4cc611){var _0x2fb19e=function(_0x247151){while(--_0x247151){_0xe4fdc['push'](_0xe4fdc['shift']());}};_0x2fb19e(++_0x4cc611);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb7e7[_0x13b8f3];return _0x1a6d06;};'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 _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5bc336,_0x5532cf){var _0x5ba0b5=function(_0x30dc84){while(--_0x30dc84){_0x5bc336['push'](_0x5bc336['shift']());}};_0x5ba0b5(++_0x5532cf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0xcb91[_0x2998db];return _0x115fea;};'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('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f8f10a7..9410928 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 _0x048e=['STRING','sequelize','exports','medium','BOOLEAN','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x048e,0xf1));var _0xe048=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0x048e[_0x27af8e];return _0x3d00f8;};'use strict';var Sequelize=require(_0xe048('0x0'));module[_0xe048('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe048('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe048('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe048('0x4')),'defaultValue':_0xe048('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xe048('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2b00=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x2e12cc,_0x1b7eb7){var _0x431d88=function(_0x53b4d7){while(--_0x53b4d7){_0x2e12cc['push'](_0x2e12cc['shift']());}};_0x431d88(++_0x1b7eb7);}(_0x2b00,0x15a));var _0x02b0=function(_0x21a3f4,_0x42396e){_0x21a3f4=_0x21a3f4-0x0;var _0x3d7312=_0x2b00[_0x21a3f4];return _0x3d7312;};'use strict';var Sequelize=require(_0x02b0('0x0'));module[_0x02b0('0x1')]={'body':{'type':Sequelize[_0x02b0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x02b0('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x02b0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x02b0('0x4')),'defaultValue':_0x02b0('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x02b0('0x5')]},'providerName':{'type':Sequelize[_0x02b0('0x6')]},'providerResponse':{'type':Sequelize[_0x02b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index f8c7112..2b5691d 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 _0x05ef=['count','offset','limit','set','Content-Range','apply','update','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','show','include','create','body','find','params','destroy','describe','chat-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','user','interaction','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','reject','UserId','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectmessage','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json'];(function(_0x3f8140,_0x1a36a2){var _0x3979d7=function(_0x4e1d29){while(--_0x4e1d29){_0x3f8140['push'](_0x3f8140['shift']());}};_0x3979d7(++_0x1a36a2);}(_0x05ef,0x139));var _0xf05e=function(_0x3dc473,_0x4b2a0b){_0x3dc473=_0x3dc473-0x0;var _0x4820a6=_0x05ef[_0x3dc473];return _0x4820a6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf05e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf05e('0x1'));var rp=require('request-promise');var moment=require(_0xf05e('0x2'));var BPromise=require(_0xf05e('0x3'));var Mustache=require(_0xf05e('0x4'));var util=require(_0xf05e('0x5'));var path=require(_0xf05e('0x6'));var sox=require(_0xf05e('0x7'));var csv=require(_0xf05e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf05e('0x9'));var squel=require(_0xf05e('0xa'));var crypto=require(_0xf05e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf05e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf05e('0xd'));var Papa=require(_0xf05e('0xe'));var Redis=require(_0xf05e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf05e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf05e('0x11'));var logger=require(_0xf05e('0x12'))(_0xf05e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf05e('0x14'))['db'];config['redis']=_[_0xf05e('0x15')](config[_0xf05e('0x16')],{'host':_0xf05e('0x17'),'port':0x18eb});var socket=require(_0xf05e('0x18'))(new Redis(config[_0xf05e('0x16')]));require(_0xf05e('0x19'))[_0xf05e('0x1a')](socket);var jayson=require(_0xf05e('0x1b'));var client=jayson[_0xf05e('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf05e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x104865,_0x1b5537,_0x562820,_0x1d07eb){return new BPromise(function(_0x40d69f,_0x5f2e8c){var _0x48c03d=_0x1d07eb||client;return _0x48c03d[_0xf05e('0x1d')](_0x104865,_0x562820)[_0xf05e('0x1e')](function(_0x493fb6){logger[_0xf05e('0x1f')](_0xf05e('0x20'),_0x1b5537,_0xf05e('0x21'));logger[_0xf05e('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1b5537,_0xf05e('0x21'),JSON[_0xf05e('0x23')](_0x493fb6));if(_0x493fb6[_0xf05e('0x24')]){if(_0x493fb6[_0xf05e('0x24')][_0xf05e('0x25')]===0x1f4){logger[_0xf05e('0x24')](_0xf05e('0x20'),_0x1b5537,_0x493fb6[_0xf05e('0x24')][_0xf05e('0x26')]);return _0x5f2e8c(_0x493fb6[_0xf05e('0x24')][_0xf05e('0x26')]);}logger[_0xf05e('0x24')](_0xf05e('0x20'),_0x1b5537,_0x493fb6[_0xf05e('0x24')][_0xf05e('0x26')]);return _0x40d69f(_0x493fb6[_0xf05e('0x24')][_0xf05e('0x26')]);}else{logger[_0xf05e('0x1f')](_0xf05e('0x20'),_0x1b5537,_0xf05e('0x21'));_0x40d69f(_0x493fb6[_0xf05e('0x27')][_0xf05e('0x26')]);}})[_0xf05e('0x28')](function(_0x339c59){logger[_0xf05e('0x24')](_0xf05e('0x20'),_0x1b5537,_0x339c59);_0x5f2e8c(_0x339c59);});});}function respondWithStatusCode(_0x27e9ce,_0x56198b){_0x56198b=_0x56198b||0xcc;return function(_0x4af66b){if(_0x4af66b){return _0x27e9ce[_0xf05e('0x29')](_0x56198b);}return _0x27e9ce[_0xf05e('0x2a')](_0x56198b)['end']();};}function respondWithResult(_0x466d85,_0x16df9b){_0x16df9b=_0x16df9b||0xc8;return function(_0x413146){if(_0x413146){return _0x466d85['status'](_0x16df9b)[_0xf05e('0x2b')](_0x413146);}};}function respondWithFilteredResult(_0x1c9e28,_0x52f76d){return function(_0xd26fd0){if(_0xd26fd0){var _0x32b8c9=_0xd26fd0[_0xf05e('0x2c')],_0x517289=_0x52f76d['offset'],_0x41c400=_0x52f76d[_0xf05e('0x2d')]+_0x52f76d[_0xf05e('0x2e')],_0x5561a6;if(_0x41c400>=_0x32b8c9){_0x41c400=_0x32b8c9;_0x5561a6=0xc8;}else{_0x5561a6=0xce;}_0x1c9e28['status'](_0x5561a6);return _0x1c9e28[_0xf05e('0x2f')](_0xf05e('0x30'),_0x517289+'-'+_0x41c400+'/'+_0x32b8c9)[_0xf05e('0x2b')](_0xd26fd0);}return null;};}function patchUpdates(_0x1e94ef){return function(_0xacb268){try{jsonpatch[_0xf05e('0x31')](_0xacb268,_0x1e94ef,!![]);}catch(_0x258806){return BPromise['reject'](_0x258806);}return _0xacb268['save']();};}function saveUpdates(_0x8bc52a,_0x3e4137){return function(_0x1f6226){if(_0x1f6226){return _0x1f6226[_0xf05e('0x32')](_0x8bc52a)['then'](function(_0x148338){return _0x148338;});}return null;};}function removeEntity(_0x281868,_0x20fa57){return function(_0x34cabb){if(_0x34cabb){return _0x34cabb['destroy']()['then'](function(){_0x281868['status'](0xcc)[_0xf05e('0x33')]();});}};}function handleEntityNotFound(_0x284612,_0x858779){return function(_0x4c1cda){if(!_0x4c1cda){_0x284612[_0xf05e('0x29')](0x194);}return _0x4c1cda;};}function handleError(_0x1e2121,_0x4af46a){_0x4af46a=_0x4af46a||0x1f4;return function(_0x5b04d2){logger[_0xf05e('0x24')](_0x5b04d2[_0xf05e('0x34')]);if(_0x5b04d2['name']){delete _0x5b04d2[_0xf05e('0x35')];}_0x1e2121[_0xf05e('0x2a')](_0x4af46a)[_0xf05e('0x36')](_0x5b04d2);};}exports[_0xf05e('0x37')]=function(_0x110f94,_0x22da49){var _0x55e87c={},_0x114801={},_0x407211={'count':0x0,'rows':[]};var _0x298fb9=_[_0xf05e('0x38')](db[_0xf05e('0x39')][_0xf05e('0x3a')],function(_0x51d42a){return{'name':_0x51d42a[_0xf05e('0x3b')],'type':_0x51d42a[_0xf05e('0x3c')][_0xf05e('0x3d')]};});_0x114801[_0xf05e('0x3e')]=_[_0xf05e('0x38')](_0x298fb9,_0xf05e('0x35'));_0x114801[_0xf05e('0x3f')]=_[_0xf05e('0x40')](_0x110f94['query']);_0x114801[_0xf05e('0x41')]=_[_0xf05e('0x42')](_0x114801[_0xf05e('0x3e')],_0x114801['query']);_0x55e87c['attributes']=_[_0xf05e('0x42')](_0x114801['model'],qs[_0xf05e('0x43')](_0x110f94[_0xf05e('0x3f')][_0xf05e('0x43')]));_0x55e87c[_0xf05e('0x44')]=_0x55e87c[_0xf05e('0x44')][_0xf05e('0x45')]?_0x55e87c[_0xf05e('0x44')]:_0x114801[_0xf05e('0x3e')];if(!_0x110f94[_0xf05e('0x3f')][_0xf05e('0x46')](_0xf05e('0x47'))){_0x55e87c[_0xf05e('0x2e')]=qs[_0xf05e('0x2e')](_0x110f94[_0xf05e('0x3f')][_0xf05e('0x2e')]);_0x55e87c[_0xf05e('0x2d')]=qs[_0xf05e('0x2d')](_0x110f94[_0xf05e('0x3f')]['offset']);}_0x55e87c['order']=qs['sort'](_0x110f94[_0xf05e('0x3f')][_0xf05e('0x48')]);_0x55e87c[_0xf05e('0x49')]=qs[_0xf05e('0x41')](_['pick'](_0x110f94[_0xf05e('0x3f')],_0x114801[_0xf05e('0x41')]),_0x298fb9);if(_0x110f94['query'][_0xf05e('0x4a')]){_0x55e87c[_0xf05e('0x49')]=_[_0xf05e('0x4b')](_0x55e87c[_0xf05e('0x49')],{'$or':_[_0xf05e('0x38')](_0x298fb9,function(_0xf0eab5){if(_0xf0eab5['type']!==_0xf05e('0x4c')){var _0x4ac6bd={};_0x4ac6bd[_0xf0eab5[_0xf05e('0x35')]]={'$like':'%'+_0x110f94['query'][_0xf05e('0x4a')]+'%'};return _0x4ac6bd;}})});}_0x55e87c=_[_0xf05e('0x4b')]({},_0x55e87c,_0x110f94[_0xf05e('0x4d')]);var _0x280c81={'where':_0x55e87c[_0xf05e('0x49')]};return db['ChatMessage']['count'](_0x280c81)['then'](function(_0x526a5f){_0x407211[_0xf05e('0x2c')]=_0x526a5f;if(_0x110f94[_0xf05e('0x3f')][_0xf05e('0x4e')]){_0x55e87c['include']=[{'all':!![]}];}return db[_0xf05e('0x39')]['findAll'](_0x55e87c);})['then'](function(_0x3cd16f){_0x407211['rows']=_0x3cd16f;return _0x407211;})[_0xf05e('0x1e')](respondWithFilteredResult(_0x22da49,_0x55e87c))[_0xf05e('0x28')](handleError(_0x22da49,null));};exports[_0xf05e('0x4f')]=function(_0x4395a4,_0x1ebb69){var _0x443f0a={'raw':!![],'where':{'id':_0x4395a4['params']['id']}},_0xf9af84={};_0xf9af84[_0xf05e('0x3e')]=_[_0xf05e('0x40')](db['ChatMessage'][_0xf05e('0x3a')]);_0xf9af84['query']=_[_0xf05e('0x40')](_0x4395a4['query']);_0xf9af84[_0xf05e('0x41')]=_[_0xf05e('0x42')](_0xf9af84['model'],_0xf9af84[_0xf05e('0x3f')]);_0x443f0a['attributes']=_[_0xf05e('0x42')](_0xf9af84['model'],qs['fields'](_0x4395a4[_0xf05e('0x3f')][_0xf05e('0x43')]));_0x443f0a[_0xf05e('0x44')]=_0x443f0a[_0xf05e('0x44')]['length']?_0x443f0a[_0xf05e('0x44')]:_0xf9af84[_0xf05e('0x3e')];if(_0x4395a4['query'][_0xf05e('0x4e')]){_0x443f0a[_0xf05e('0x50')]=[{'all':!![]}];}_0x443f0a=_[_0xf05e('0x4b')]({},_0x443f0a,_0x4395a4[_0xf05e('0x4d')]);return db[_0xf05e('0x39')]['find'](_0x443f0a)[_0xf05e('0x1e')](handleEntityNotFound(_0x1ebb69,null))[_0xf05e('0x1e')](respondWithResult(_0x1ebb69,null))[_0xf05e('0x28')](handleError(_0x1ebb69,null));};exports[_0xf05e('0x51')]=function(_0x4923b9,_0x4a9d6f){return db[_0xf05e('0x39')][_0xf05e('0x51')](_0x4923b9[_0xf05e('0x52')],{})[_0xf05e('0x1e')](respondWithResult(_0x4a9d6f,0xc9))[_0xf05e('0x28')](handleError(_0x4a9d6f,null));};exports[_0xf05e('0x32')]=function(_0xdb725d,_0x25e790){if(_0xdb725d[_0xf05e('0x52')]['id']){delete _0xdb725d[_0xf05e('0x52')]['id'];}return db[_0xf05e('0x39')][_0xf05e('0x53')]({'where':{'id':_0xdb725d[_0xf05e('0x54')]['id']}})[_0xf05e('0x1e')](handleEntityNotFound(_0x25e790,null))[_0xf05e('0x1e')](saveUpdates(_0xdb725d[_0xf05e('0x52')],null))[_0xf05e('0x1e')](respondWithResult(_0x25e790,null))[_0xf05e('0x28')](handleError(_0x25e790,null));};exports[_0xf05e('0x55')]=function(_0x1769f9,_0x4b7c85){return db[_0xf05e('0x39')]['find']({'where':{'id':_0x1769f9[_0xf05e('0x54')]['id']}})[_0xf05e('0x1e')](handleEntityNotFound(_0x4b7c85,null))[_0xf05e('0x1e')](removeEntity(_0x4b7c85,null))[_0xf05e('0x28')](handleError(_0x4b7c85,null));};exports[_0xf05e('0x56')]=function(_0x47bf92,_0x29d66e){return db['ChatMessage'][_0xf05e('0x56')]()[_0xf05e('0x1e')](respondWithResult(_0x29d66e,null))[_0xf05e('0x28')](handleError(_0x29d66e,null));};var interaction_log=require('../../config/logger')(_0xf05e('0x57'));exports[_0xf05e('0x58')]=function(_0x5b3ce3,_0x1b10b6,_0x101bc1){var _0x3e93c1={'channel':'chat'};if(_0x5b3ce3['body']['id']){delete _0x5b3ce3[_0xf05e('0x52')]['id'];}_0x5b3ce3[_0xf05e('0x52')][_0xf05e('0x59')]=!![];_0x5b3ce3[_0xf05e('0x52')]['readAt']=moment()['format'](_0xf05e('0x5a'));_0x5b3ce3['body']['UserId']=_0x5b3ce3[_0xf05e('0x52')]['UserId']||_0x5b3ce3['user']['id'];return db[_0xf05e('0x39')][_0xf05e('0x53')]({'where':{'id':_0x5b3ce3['params']['id'],'UserId':null},'include':[{'model':db[_0xf05e('0x5b')],'as':_0xf05e('0x5c')}]})[_0xf05e('0x1e')](handleEntityNotFound(_0x1b10b6,null))['then'](saveUpdates(_0x5b3ce3[_0xf05e('0x52')],null))[_0xf05e('0x1e')](function(_0x200d87){if(_0x200d87){_0x3e93c1['message']=_0x200d87[_0xf05e('0x5d')]({'plain':!![]});return db[_0xf05e('0x5e')][_0xf05e('0x53')]({'where':{'id':_0x200d87[_0xf05e('0x5f')]}});}return null;})[_0xf05e('0x1e')](handleEntityNotFound(_0x1b10b6,null))['then'](function(_0x308c91){if(_0x308c91){return _0x308c91[_0xf05e('0x32')]({'UserId':_0x5b3ce3['body']['UserId'],'read1stAt':_[_0xf05e('0x60')](_0x308c91[_0xf05e('0x61')])?moment()[_0xf05e('0x62')](_0xf05e('0x5a')):undefined});}return null;})[_0xf05e('0x1e')](function(_0x511376){if(_0x511376){_0x3e93c1['interaction']=_0x511376[_0xf05e('0x5d')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b3ce3[_0xf05e('0x63')]['id'],_0x5b3ce3[_0xf05e('0x63')][_0xf05e('0x35')],_0x5b3ce3['user']['role'],_0x3e93c1[_0xf05e('0x64')]['id'],_0x5b3ce3[_0xf05e('0x52')]?JSON[_0xf05e('0x23')](_0x5b3ce3[_0xf05e('0x52')]):'null');return respondWithRpcPromise(_0xf05e('0x65'),_0xf05e('0x66'),_0x3e93c1);}return null;})['then'](function(_0xba8b14){if(_0xba8b14){if(_0x5b3ce3[_0xf05e('0x52')]['manual']){_0x3e93c1[_0xf05e('0x26')][_0xf05e('0x67')]=util[_0xf05e('0x62')](_0xf05e('0x68'),_0x5b3ce3[_0xf05e('0x63')][_0xf05e('0x35')]);_0x3e93c1['message'][_0xf05e('0x69')]=_0x3e93c1['channel'];_0x3e93c1[_0xf05e('0x26')][_0xf05e('0x6a')]=_0xf05e('0x58');return respondWithRpcPromise('EventManager',_0xf05e('0x6b'),{'event':_0xf05e('0x6c'),'message':_['merge'](_0x3e93c1[_0xf05e('0x26')],JSON[_0xf05e('0x6d')](_0x3e93c1[_0xf05e('0x64')][_0xf05e('0x6e')]))},client9002)[_0xf05e('0x1e')](function(){return _0x3e93c1;});}return _0x3e93c1;}return null;})[_0xf05e('0x1e')](respondWithResult(_0x1b10b6,null))[_0xf05e('0x28')](handleError(_0x1b10b6,null));};var interaction_log=require(_0xf05e('0x12'))(_0xf05e('0x57'));exports[_0xf05e('0x6f')]=function(_0x1f9ff3,_0x48b60d,_0x4be91d){var _0x13602b={'agent':{},'channel':'chat'};if(_0x1f9ff3[_0xf05e('0x52')]['id']){delete _0x1f9ff3['body']['id'];}_0x1f9ff3[_0xf05e('0x52')][_0xf05e('0x70')]=_0x1f9ff3[_0xf05e('0x52')][_0xf05e('0x70')]||_0x1f9ff3[_0xf05e('0x63')]['id'];_0x13602b[_0xf05e('0x71')]['id']=_0x1f9ff3['body'][_0xf05e('0x70')];return db['ChatMessage'][_0xf05e('0x53')]({'where':{'id':_0x1f9ff3[_0xf05e('0x54')]['id'],'UserId':null}})[_0xf05e('0x1e')](handleEntityNotFound(_0x48b60d,null))[_0xf05e('0x1e')](function(_0x45ca36){if(_0x45ca36){_0x13602b[_0xf05e('0x26')]=_0x45ca36['get']({'plain':!![]});return db[_0xf05e('0x5e')][_0xf05e('0x53')]({'where':{'id':_0x45ca36['ChatInteractionId']}});}return null;})[_0xf05e('0x1e')](handleEntityNotFound(_0x48b60d,null))[_0xf05e('0x1e')](function(_0x462056){if(_0x462056){_0x13602b[_0xf05e('0x64')]=_0x462056[_0xf05e('0x5d')]({'plain':!![]});interaction_log[_0xf05e('0x1f')](_0xf05e('0x72'),_0x1f9ff3['user']['id'],_0x1f9ff3[_0xf05e('0x63')][_0xf05e('0x35')],_0x1f9ff3[_0xf05e('0x63')][_0xf05e('0x73')],_0x13602b['interaction']['id'],_0x1f9ff3['body']?JSON[_0xf05e('0x23')](_0x1f9ff3[_0xf05e('0x52')]):_0xf05e('0x74'));return respondWithRpcPromise(_0xf05e('0x75'),'rejectMessage',_0x13602b);}return null;})[_0xf05e('0x1e')](function(_0x263f54){if(_0x263f54){_0x263f54['message'][_0xf05e('0x67')]=util[_0xf05e('0x62')](_0xf05e('0x68'),_0x1f9ff3[_0xf05e('0x63')][_0xf05e('0x35')]);_0x263f54[_0xf05e('0x26')][_0xf05e('0x69')]=_0x13602b['channel'];_0x263f54['message'][_0xf05e('0x6a')]=_0xf05e('0x6f');respondWithRpcPromise(_0xf05e('0x6b'),_0xf05e('0x6b'),{'event':_0xf05e('0x76'),'message':_0x263f54[_0xf05e('0x26')]},client9002);return _0x13602b;}return null;})[_0xf05e('0x1e')](respondWithResult(_0x48b60d,null))['catch'](handleError(_0x48b60d,null));}; \ No newline at end of file +var _0x6c9a=['util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./chatMessage.socket','register','jayson/promise','client','http','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','ChatMessage','type','model','map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','show','params','rawAttributes','fields','include','find','create','body','describe','chat-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x15e523,_0x350025){var _0x3c86cb=function(_0x166749){while(--_0x166749){_0x15e523['push'](_0x15e523['shift']());}};_0x3c86cb(++_0x350025);}(_0x6c9a,0x169));var _0xa6c9=function(_0x1020fe,_0x534c85){_0x1020fe=_0x1020fe-0x0;var _0x28c316=_0x6c9a[_0x1020fe];return _0x28c316;};'use strict';var pdf=require(_0xa6c9('0x0'));var emlformat=require(_0xa6c9('0x1'));var rimraf=require(_0xa6c9('0x2'));var zipdir=require(_0xa6c9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6c9('0x4'));var moment=require(_0xa6c9('0x5'));var BPromise=require(_0xa6c9('0x6'));var Mustache=require(_0xa6c9('0x7'));var util=require(_0xa6c9('0x8'));var path=require('path');var sox=require(_0xa6c9('0x9'));var csv=require(_0xa6c9('0xa'));var ejs=require(_0xa6c9('0xb'));var fs=require('fs');var _=require(_0xa6c9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6c9('0xd'));var toCsv=require(_0xa6c9('0xa'));var querystring=require(_0xa6c9('0xe'));var Papa=require(_0xa6c9('0xf'));var Redis=require('ioredis');var authService=require(_0xa6c9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa6c9('0x11'));var hardwareService=require(_0xa6c9('0x12'));var logger=require(_0xa6c9('0x13'))(_0xa6c9('0x14'));var utils=require('../../config/utils');var config=require(_0xa6c9('0x15'));var licenseUtil=require(_0xa6c9('0x16'));var db=require(_0xa6c9('0x17'))['db'];config[_0xa6c9('0x18')]=_['defaults'](config[_0xa6c9('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa6c9('0x19'))[_0xa6c9('0x1a')](socket);var jayson=require(_0xa6c9('0x1b'));var client=jayson[_0xa6c9('0x1c')][_0xa6c9('0x1d')]({'port':0x232c});var client9002=jayson[_0xa6c9('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f174c,_0x92163f,_0x5071b1,_0x41a7de){return new BPromise(function(_0x26531f,_0x306d78){var _0x40a1a1=_0x41a7de||client;return _0x40a1a1[_0xa6c9('0x1e')](_0x4f174c,_0x5071b1)['then'](function(_0x6628fc){logger['info']('ChatMessage,\x20%s,\x20%s',_0x92163f,_0xa6c9('0x1f'));logger[_0xa6c9('0x20')](_0xa6c9('0x21'),_0x92163f,'request\x20sent',JSON[_0xa6c9('0x22')](_0x6628fc));if(_0x6628fc[_0xa6c9('0x23')]){if(_0x6628fc[_0xa6c9('0x23')]['code']===0x1f4){logger['error'](_0xa6c9('0x24'),_0x92163f,_0x6628fc[_0xa6c9('0x23')]['message']);return _0x306d78(_0x6628fc['error'][_0xa6c9('0x25')]);}logger[_0xa6c9('0x23')](_0xa6c9('0x24'),_0x92163f,_0x6628fc[_0xa6c9('0x23')][_0xa6c9('0x25')]);return _0x26531f(_0x6628fc['error'][_0xa6c9('0x25')]);}else{logger[_0xa6c9('0x26')]('ChatMessage,\x20%s,\x20%s',_0x92163f,_0xa6c9('0x1f'));_0x26531f(_0x6628fc[_0xa6c9('0x27')][_0xa6c9('0x25')]);}})[_0xa6c9('0x28')](function(_0x1561d9){logger[_0xa6c9('0x23')](_0xa6c9('0x24'),_0x92163f,_0x1561d9);_0x306d78(_0x1561d9);});});}function respondWithStatusCode(_0x132e2f,_0x46e0ce){_0x46e0ce=_0x46e0ce||0xcc;return function(_0x5727f9){if(_0x5727f9){return _0x132e2f[_0xa6c9('0x29')](_0x46e0ce);}return _0x132e2f[_0xa6c9('0x2a')](_0x46e0ce)['end']();};}function respondWithResult(_0x3fe988,_0x14dab){_0x14dab=_0x14dab||0xc8;return function(_0x10a318){if(_0x10a318){return _0x3fe988['status'](_0x14dab)['json'](_0x10a318);}};}function respondWithFilteredResult(_0x4f7cb7,_0x7deae8){return function(_0x43ccaf){if(_0x43ccaf){var _0x853e44=_0x43ccaf['count'],_0x2e1c7a=_0x7deae8['offset'],_0x3be41a=_0x7deae8['offset']+_0x7deae8[_0xa6c9('0x2b')],_0x438355;if(_0x3be41a>=_0x853e44){_0x3be41a=_0x853e44;_0x438355=0xc8;}else{_0x438355=0xce;}_0x4f7cb7['status'](_0x438355);return _0x4f7cb7[_0xa6c9('0x2c')](_0xa6c9('0x2d'),_0x2e1c7a+'-'+_0x3be41a+'/'+_0x853e44)[_0xa6c9('0x2e')](_0x43ccaf);}return null;};}function patchUpdates(_0x38e6b9){return function(_0x2790ac){try{jsonpatch[_0xa6c9('0x2f')](_0x2790ac,_0x38e6b9,!![]);}catch(_0x4ebb9a){return BPromise[_0xa6c9('0x30')](_0x4ebb9a);}return _0x2790ac[_0xa6c9('0x31')]();};}function saveUpdates(_0x47352f,_0x3a2ecc){return function(_0x2b18ff){if(_0x2b18ff){return _0x2b18ff[_0xa6c9('0x32')](_0x47352f)[_0xa6c9('0x33')](function(_0x54ca75){return _0x54ca75;});}return null;};}function removeEntity(_0xa7d8fa,_0x499e9c){return function(_0x2c6a29){if(_0x2c6a29){return _0x2c6a29[_0xa6c9('0x34')]()['then'](function(){_0xa7d8fa[_0xa6c9('0x2a')](0xcc)[_0xa6c9('0x35')]();});}};}function handleEntityNotFound(_0x3a0199,_0x59e18c){return function(_0x323031){if(!_0x323031){_0x3a0199[_0xa6c9('0x29')](0x194);}return _0x323031;};}function handleError(_0x41754b,_0x2d921c){_0x2d921c=_0x2d921c||0x1f4;return function(_0x4d6b9d){logger[_0xa6c9('0x23')](_0x4d6b9d[_0xa6c9('0x36')]);if(_0x4d6b9d['name']){delete _0x4d6b9d[_0xa6c9('0x37')];}_0x41754b[_0xa6c9('0x2a')](_0x2d921c)[_0xa6c9('0x38')](_0x4d6b9d);};}exports['index']=function(_0x1e1e8e,_0x2c43e2){var _0x1e7cf0={},_0xfa5c33={},_0xbc22b4={'count':0x0,'rows':[]};var _0x468873=_['map'](db[_0xa6c9('0x39')]['rawAttributes'],function(_0x243114){return{'name':_0x243114['fieldName'],'type':_0x243114[_0xa6c9('0x3a')]['key']};});_0xfa5c33[_0xa6c9('0x3b')]=_[_0xa6c9('0x3c')](_0x468873,_0xa6c9('0x37'));_0xfa5c33['query']=_[_0xa6c9('0x3d')](_0x1e1e8e['query']);_0xfa5c33[_0xa6c9('0x3e')]=_[_0xa6c9('0x3f')](_0xfa5c33[_0xa6c9('0x3b')],_0xfa5c33[_0xa6c9('0x40')]);_0x1e7cf0['attributes']=_[_0xa6c9('0x3f')](_0xfa5c33[_0xa6c9('0x3b')],qs['fields'](_0x1e1e8e['query']['fields']));_0x1e7cf0[_0xa6c9('0x41')]=_0x1e7cf0[_0xa6c9('0x41')][_0xa6c9('0x42')]?_0x1e7cf0[_0xa6c9('0x41')]:_0xfa5c33[_0xa6c9('0x3b')];if(!_0x1e1e8e['query'][_0xa6c9('0x43')](_0xa6c9('0x44'))){_0x1e7cf0['limit']=qs[_0xa6c9('0x2b')](_0x1e1e8e[_0xa6c9('0x40')][_0xa6c9('0x2b')]);_0x1e7cf0[_0xa6c9('0x45')]=qs[_0xa6c9('0x45')](_0x1e1e8e[_0xa6c9('0x40')][_0xa6c9('0x45')]);}_0x1e7cf0[_0xa6c9('0x46')]=qs[_0xa6c9('0x47')](_0x1e1e8e[_0xa6c9('0x40')][_0xa6c9('0x47')]);_0x1e7cf0['where']=qs['filters'](_[_0xa6c9('0x48')](_0x1e1e8e[_0xa6c9('0x40')],_0xfa5c33[_0xa6c9('0x3e')]),_0x468873);if(_0x1e1e8e[_0xa6c9('0x40')]['filter']){_0x1e7cf0[_0xa6c9('0x49')]=_['merge'](_0x1e7cf0[_0xa6c9('0x49')],{'$or':_[_0xa6c9('0x3c')](_0x468873,function(_0x4c2ce1){if(_0x4c2ce1[_0xa6c9('0x3a')]!==_0xa6c9('0x4a')){var _0x2c5ece={};_0x2c5ece[_0x4c2ce1[_0xa6c9('0x37')]]={'$like':'%'+_0x1e1e8e['query'][_0xa6c9('0x4b')]+'%'};return _0x2c5ece;}})});}_0x1e7cf0=_[_0xa6c9('0x4c')]({},_0x1e7cf0,_0x1e1e8e[_0xa6c9('0x4d')]);var _0x190283={'where':_0x1e7cf0[_0xa6c9('0x49')]};return db['ChatMessage'][_0xa6c9('0x4e')](_0x190283)[_0xa6c9('0x33')](function(_0x3a617d){_0xbc22b4[_0xa6c9('0x4e')]=_0x3a617d;if(_0x1e1e8e[_0xa6c9('0x40')][_0xa6c9('0x4f')]){_0x1e7cf0['include']=[{'all':!![]}];}return db['ChatMessage'][_0xa6c9('0x50')](_0x1e7cf0);})[_0xa6c9('0x33')](function(_0x5cfa70){_0xbc22b4[_0xa6c9('0x51')]=_0x5cfa70;return _0xbc22b4;})[_0xa6c9('0x33')](respondWithFilteredResult(_0x2c43e2,_0x1e7cf0))['catch'](handleError(_0x2c43e2,null));};exports[_0xa6c9('0x52')]=function(_0x5a92e1,_0x425e4d){var _0x58ee7e={'raw':!![],'where':{'id':_0x5a92e1[_0xa6c9('0x53')]['id']}},_0x5a1a09={};_0x5a1a09[_0xa6c9('0x3b')]=_[_0xa6c9('0x3d')](db[_0xa6c9('0x39')][_0xa6c9('0x54')]);_0x5a1a09[_0xa6c9('0x40')]=_[_0xa6c9('0x3d')](_0x5a92e1[_0xa6c9('0x40')]);_0x5a1a09[_0xa6c9('0x3e')]=_[_0xa6c9('0x3f')](_0x5a1a09[_0xa6c9('0x3b')],_0x5a1a09[_0xa6c9('0x40')]);_0x58ee7e['attributes']=_[_0xa6c9('0x3f')](_0x5a1a09[_0xa6c9('0x3b')],qs[_0xa6c9('0x55')](_0x5a92e1['query'][_0xa6c9('0x55')]));_0x58ee7e[_0xa6c9('0x41')]=_0x58ee7e[_0xa6c9('0x41')][_0xa6c9('0x42')]?_0x58ee7e[_0xa6c9('0x41')]:_0x5a1a09[_0xa6c9('0x3b')];if(_0x5a92e1[_0xa6c9('0x40')][_0xa6c9('0x4f')]){_0x58ee7e[_0xa6c9('0x56')]=[{'all':!![]}];}_0x58ee7e=_[_0xa6c9('0x4c')]({},_0x58ee7e,_0x5a92e1['options']);return db[_0xa6c9('0x39')][_0xa6c9('0x57')](_0x58ee7e)[_0xa6c9('0x33')](handleEntityNotFound(_0x425e4d,null))[_0xa6c9('0x33')](respondWithResult(_0x425e4d,null))[_0xa6c9('0x28')](handleError(_0x425e4d,null));};exports[_0xa6c9('0x58')]=function(_0x3ad8ac,_0x3c53ea){return db[_0xa6c9('0x39')][_0xa6c9('0x58')](_0x3ad8ac[_0xa6c9('0x59')],{})[_0xa6c9('0x33')](respondWithResult(_0x3c53ea,0xc9))[_0xa6c9('0x28')](handleError(_0x3c53ea,null));};exports[_0xa6c9('0x32')]=function(_0x3856a4,_0x37ce04){if(_0x3856a4[_0xa6c9('0x59')]['id']){delete _0x3856a4[_0xa6c9('0x59')]['id'];}return db[_0xa6c9('0x39')][_0xa6c9('0x57')]({'where':{'id':_0x3856a4[_0xa6c9('0x53')]['id']}})[_0xa6c9('0x33')](handleEntityNotFound(_0x37ce04,null))[_0xa6c9('0x33')](saveUpdates(_0x3856a4['body'],null))['then'](respondWithResult(_0x37ce04,null))[_0xa6c9('0x28')](handleError(_0x37ce04,null));};exports[_0xa6c9('0x34')]=function(_0x4bd5b0,_0x1a0d34){return db[_0xa6c9('0x39')][_0xa6c9('0x57')]({'where':{'id':_0x4bd5b0[_0xa6c9('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a0d34,null))['then'](removeEntity(_0x1a0d34,null))[_0xa6c9('0x28')](handleError(_0x1a0d34,null));};exports[_0xa6c9('0x5a')]=function(_0xcd0bf1,_0x2a6cfa){return db['ChatMessage'][_0xa6c9('0x5a')]()[_0xa6c9('0x33')](respondWithResult(_0x2a6cfa,null))['catch'](handleError(_0x2a6cfa,null));};var interaction_log=require('../../config/logger')(_0xa6c9('0x5b'));exports[_0xa6c9('0x5c')]=function(_0x56873a,_0x4ccc89,_0x2c9358){var _0x404b8={'channel':'chat'};if(_0x56873a[_0xa6c9('0x59')]['id']){delete _0x56873a[_0xa6c9('0x59')]['id'];}_0x56873a['body'][_0xa6c9('0x5d')]=!![];_0x56873a['body'][_0xa6c9('0x5e')]=moment()['format'](_0xa6c9('0x5f'));_0x56873a[_0xa6c9('0x59')][_0xa6c9('0x60')]=_0x56873a['body'][_0xa6c9('0x60')]||_0x56873a[_0xa6c9('0x61')]['id'];return db['ChatMessage'][_0xa6c9('0x57')]({'where':{'id':_0x56873a[_0xa6c9('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xa6c9('0x62')],'as':'Contact'}]})[_0xa6c9('0x33')](handleEntityNotFound(_0x4ccc89,null))['then'](saveUpdates(_0x56873a['body'],null))['then'](function(_0x169fa0){if(_0x169fa0){_0x404b8['message']=_0x169fa0[_0xa6c9('0x63')]({'plain':!![]});return db[_0xa6c9('0x64')][_0xa6c9('0x57')]({'where':{'id':_0x169fa0[_0xa6c9('0x65')]}});}return null;})[_0xa6c9('0x33')](handleEntityNotFound(_0x4ccc89,null))[_0xa6c9('0x33')](function(_0x52a0d4){if(_0x52a0d4){return _0x52a0d4[_0xa6c9('0x32')]({'UserId':_0x56873a[_0xa6c9('0x59')][_0xa6c9('0x60')],'read1stAt':_[_0xa6c9('0x66')](_0x52a0d4['read1stAt'])?moment()[_0xa6c9('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3002ca){if(_0x3002ca){_0x404b8[_0xa6c9('0x68')]=_0x3002ca['get']({'plain':!![]});interaction_log[_0xa6c9('0x26')](_0xa6c9('0x69'),_0x56873a[_0xa6c9('0x61')]['id'],_0x56873a['user']['name'],_0x56873a[_0xa6c9('0x61')][_0xa6c9('0x6a')],_0x404b8[_0xa6c9('0x68')]['id'],_0x56873a[_0xa6c9('0x59')]?JSON[_0xa6c9('0x22')](_0x56873a[_0xa6c9('0x59')]):_0xa6c9('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x404b8);}return null;})['then'](function(_0x1a7f80){if(_0x1a7f80){if(_0x56873a[_0xa6c9('0x59')][_0xa6c9('0x6c')]){_0x404b8[_0xa6c9('0x25')][_0xa6c9('0x6d')]=util[_0xa6c9('0x67')](_0xa6c9('0x6e'),_0x56873a['user'][_0xa6c9('0x37')]);_0x404b8[_0xa6c9('0x25')][_0xa6c9('0x6f')]=_0x404b8['channel'];_0x404b8['message'][_0xa6c9('0x70')]='accept';return respondWithRpcPromise('EventManager',_0xa6c9('0x71'),{'event':_0xa6c9('0x72'),'message':_[_0xa6c9('0x4c')](_0x404b8[_0xa6c9('0x25')],JSON[_0xa6c9('0x73')](_0x404b8[_0xa6c9('0x68')][_0xa6c9('0x74')]))},client9002)[_0xa6c9('0x33')](function(){return _0x404b8;});}return _0x404b8;}return null;})[_0xa6c9('0x33')](respondWithResult(_0x4ccc89,null))[_0xa6c9('0x28')](handleError(_0x4ccc89,null));};var interaction_log=require('../../config/logger')(_0xa6c9('0x5b'));exports[_0xa6c9('0x30')]=function(_0x498905,_0x352811,_0x59e309){var _0x4d4fae={'agent':{},'channel':_0xa6c9('0x75')};if(_0x498905[_0xa6c9('0x59')]['id']){delete _0x498905[_0xa6c9('0x59')]['id'];}_0x498905[_0xa6c9('0x59')]['UserId']=_0x498905['body']['UserId']||_0x498905[_0xa6c9('0x61')]['id'];_0x4d4fae[_0xa6c9('0x76')]['id']=_0x498905[_0xa6c9('0x59')]['UserId'];return db[_0xa6c9('0x39')][_0xa6c9('0x57')]({'where':{'id':_0x498905[_0xa6c9('0x53')]['id'],'UserId':null}})[_0xa6c9('0x33')](handleEntityNotFound(_0x352811,null))[_0xa6c9('0x33')](function(_0x2fa77f){if(_0x2fa77f){_0x4d4fae[_0xa6c9('0x25')]=_0x2fa77f['get']({'plain':!![]});return db[_0xa6c9('0x64')][_0xa6c9('0x57')]({'where':{'id':_0x2fa77f[_0xa6c9('0x65')]}});}return null;})[_0xa6c9('0x33')](handleEntityNotFound(_0x352811,null))[_0xa6c9('0x33')](function(_0xb44df){if(_0xb44df){_0x4d4fae['interaction']=_0xb44df[_0xa6c9('0x63')]({'plain':!![]});interaction_log[_0xa6c9('0x26')](_0xa6c9('0x77'),_0x498905['user']['id'],_0x498905[_0xa6c9('0x61')][_0xa6c9('0x37')],_0x498905[_0xa6c9('0x61')][_0xa6c9('0x6a')],_0x4d4fae[_0xa6c9('0x68')]['id'],_0x498905['body']?JSON[_0xa6c9('0x22')](_0x498905[_0xa6c9('0x59')]):_0xa6c9('0x6b'));return respondWithRpcPromise(_0xa6c9('0x78'),_0xa6c9('0x79'),_0x4d4fae);}return null;})[_0xa6c9('0x33')](function(_0x47e2a5){if(_0x47e2a5){_0x47e2a5[_0xa6c9('0x25')][_0xa6c9('0x6d')]=util[_0xa6c9('0x67')](_0xa6c9('0x6e'),_0x498905[_0xa6c9('0x61')][_0xa6c9('0x37')]);_0x47e2a5[_0xa6c9('0x25')][_0xa6c9('0x6f')]=_0x4d4fae[_0xa6c9('0x6f')];_0x47e2a5[_0xa6c9('0x25')][_0xa6c9('0x70')]=_0xa6c9('0x30');respondWithRpcPromise(_0xa6c9('0x71'),_0xa6c9('0x71'),{'event':_0xa6c9('0x7a'),'message':_0x47e2a5['message']},client9002);return _0x4d4fae;}return null;})[_0xa6c9('0x33')](respondWithResult(_0x352811,null))[_0xa6c9('0x28')](handleError(_0x352811,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 06ddd67..9f891a5 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 _0xb7bb=['../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x5cdb14,_0x3f3804){var _0x324f09=function(_0x39eaf0){while(--_0x39eaf0){_0x5cdb14['push'](_0x5cdb14['shift']());}};_0x324f09(++_0x3f3804);}(_0xb7bb,0x158));var _0xbb7b=function(_0x1cb3fa,_0x5c254e){_0x1cb3fa=_0x1cb3fa-0x0;var _0x4a76b1=_0xb7bb[_0x1cb3fa];return _0x4a76b1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbb7b('0x0'))['db'][_0xbb7b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbb7b('0x2')](0x0);var events={'afterCreate':_0xbb7b('0x3'),'afterUpdate':_0xbb7b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56e30e){return function(_0x51e199,_0x49a180,_0x31b1c6){ChatMessageEvents['emit'](_0x56e30e+':'+_0x51e199['id'],_0x51e199);ChatMessageEvents[_0xbb7b('0x5')](_0x56e30e,_0x51e199);_0x31b1c6(null);};}for(var e in events){if(events[_0xbb7b('0x6')](e)){var event=events[e];ChatMessage[_0xbb7b('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x5c7b=['events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x5c7b,0x1cb));var _0xb5c7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5c7b[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xb5c7('0x0'));var ChatMessage=require(_0xb5c7('0x1'))['db'][_0xb5c7('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb5c7('0x3')](0x0);var events={'afterCreate':_0xb5c7('0x4'),'afterUpdate':'update','afterDestroy':_0xb5c7('0x5')};function emitEvent(_0x133e17){return function(_0xd9b4dd,_0x244e6c,_0x2ad672){ChatMessageEvents[_0xb5c7('0x6')](_0x133e17+':'+_0xd9b4dd['id'],_0xd9b4dd);ChatMessageEvents[_0xb5c7('0x6')](_0x133e17,_0xd9b4dd);_0x2ad672(null);};}for(var e in events){if(events[_0xb5c7('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb5c7('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 03a3481..69988d8 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 _0xa910=['moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x62396d,_0x1ad1ba){var _0x49db3e=function(_0x4ef041){while(--_0x4ef041){_0x62396d['push'](_0x62396d['shift']());}};_0x49db3e(++_0x1ad1ba);}(_0xa910,0x1cc));var _0x0a91=function(_0x3ac87e,_0x480cd1){_0x3ac87e=_0x3ac87e-0x0;var _0xd47d66=_0xa910[_0x3ac87e];return _0xd47d66;};'use strict';var _=require(_0x0a91('0x0'));var util=require(_0x0a91('0x1'));var logger=require(_0x0a91('0x2'))(_0x0a91('0x3'));var moment=require(_0x0a91('0x4'));var BPromise=require(_0x0a91('0x5'));var rp=require(_0x0a91('0x6'));var fs=require('fs');var path=require(_0x0a91('0x7'));var rimraf=require(_0x0a91('0x8'));var config=require(_0x0a91('0x9'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x171245,_0xaabe27){return _0x171245['define'](_0x0a91('0xa'),attributes,{'tableName':_0x0a91('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x0a91('0xc')],'type':_0x0a91('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x275588,_0x197895,_0x428ff9){var _0x128083=_0x171245[_0x0a91('0xe')];var _0x594fba=_0x275588[_0x0a91('0xf')]({'plain':!![]});if(_0x594fba[_0x0a91('0x10')][_0x0a91('0x11')]()==='in'||_0x594fba[_0x0a91('0x10')][_0x0a91('0x11')]()===_0x0a91('0x12')&&!_0x594fba[_0x0a91('0x13')]&&!_[_0x0a91('0x14')](_0x594fba[_0x0a91('0x15')])){_0x128083['ChatInteraction'][_0x0a91('0x16')]({'where':{'id':_0x594fba[_0x0a91('0x17')]}})[_0x0a91('0x18')](function(_0x4a6508){if(_0x4a6508){_0x4a6508[_0x0a91('0x19')]({'lastMsgAt':_0x594fba[_0x0a91('0x1a')],'lastMsgDirection':_0x594fba['direction']['toLowerCase']()});}})['catch'](function(_0x25c679){console[_0x0a91('0x1b')](_0x25c679);});}_0x428ff9();}},'charset':_0x0a91('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4343=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x351784,_0x3275c3){var _0x47b912=function(_0x10e0e7){while(--_0x10e0e7){_0x351784['push'](_0x351784['shift']());}};_0x47b912(++_0x3275c3);}(_0x4343,0x177));var _0x3434=function(_0x9d480f,_0xe2dc76){_0x9d480f=_0x9d480f-0x0;var _0x1ece95=_0x4343[_0x9d480f];return _0x1ece95;};'use strict';var _=require(_0x3434('0x0'));var util=require(_0x3434('0x1'));var logger=require('../../config/logger')(_0x3434('0x2'));var moment=require(_0x3434('0x3'));var BPromise=require(_0x3434('0x4'));var rp=require(_0x3434('0x5'));var fs=require('fs');var path=require(_0x3434('0x6'));var rimraf=require(_0x3434('0x7'));var config=require(_0x3434('0x8'));var attributes=require(_0x3434('0x9'));module['exports']=function(_0x3ea488,_0x2c9704){return _0x3ea488['define'](_0x3434('0xa'),attributes,{'tableName':_0x3434('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x3434('0xc')],'type':_0x3434('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5546d4,_0x2aac17,_0x5a8b72){var _0x27d11e=_0x3ea488[_0x3434('0xe')];var _0x22f833=_0x5546d4[_0x3434('0xf')]({'plain':!![]});if(_0x22f833[_0x3434('0x10')]['toLowerCase']()==='in'||_0x22f833[_0x3434('0x10')][_0x3434('0x11')]()===_0x3434('0x12')&&!_0x22f833[_0x3434('0x13')]&&!_[_0x3434('0x14')](_0x22f833['UserId'])){_0x27d11e[_0x3434('0x15')][_0x3434('0x16')]({'where':{'id':_0x22f833['ChatInteractionId']}})['then'](function(_0x4568e7){if(_0x4568e7){_0x4568e7['update']({'lastMsgAt':_0x22f833[_0x3434('0x17')],'lastMsgDirection':_0x22f833[_0x3434('0x10')]['toLowerCase']()});}})[_0x3434('0x18')](function(_0x577862){console['error'](_0x577862);});}_0x5a8b72();}},'charset':_0x3434('0x19'),'collate':_0x3434('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 6376f63..007d10c 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 _0x2b74=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./chatMessage.socket','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','create','options','raw','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x382f07,_0x54109e){var _0x511839=function(_0x1b467b){while(--_0x1b467b){_0x382f07['push'](_0x382f07['shift']());}};_0x511839(++_0x54109e);}(_0x2b74,0x1d7));var _0x42b7=function(_0x4e1c7d,_0x1366bc){_0x4e1c7d=_0x4e1c7d-0x0;var _0x191a91=_0x2b74[_0x4e1c7d];return _0x191a91;};'use strict';var _=require(_0x42b7('0x0'));var util=require(_0x42b7('0x1'));var moment=require('moment');var BPromise=require(_0x42b7('0x2'));var rs=require(_0x42b7('0x3'));var fs=require('fs');var Redis=require(_0x42b7('0x4'));var db=require(_0x42b7('0x5'))['db'];var utils=require(_0x42b7('0x6'));var logger=require(_0x42b7('0x7'))('rpc');var config=require(_0x42b7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x42b7('0x9')]({'port':0x232a});config[_0x42b7('0xa')]=_['defaults'](config[_0x42b7('0xa')],{'host':_0x42b7('0xb'),'port':0x18eb});var socket=require(_0x42b7('0xc'))(new Redis(config[_0x42b7('0xa')]));require(_0x42b7('0xd'))['register'](socket);function respondWithRpcPromise(_0x42e6a7,_0x53a035,_0x28696b){return new BPromise(function(_0x12176d,_0x4f1ddc){return client['request'](_0x42e6a7,_0x28696b)[_0x42b7('0xe')](function(_0x12cb39){logger[_0x42b7('0xf')]('ChatMessage,\x20%s,\x20%s',_0x53a035,_0x42b7('0x10'));logger['debug'](_0x42b7('0x11'),_0x53a035,_0x42b7('0x10'),JSON[_0x42b7('0x12')](_0x12cb39));if(_0x12cb39['error']){if(_0x12cb39[_0x42b7('0x13')]['code']===0x1f4){logger['error'](_0x42b7('0x14'),_0x53a035,_0x12cb39['error']['message']);return _0x4f1ddc(_0x12cb39[_0x42b7('0x13')][_0x42b7('0x15')]);}logger['error'](_0x42b7('0x14'),_0x53a035,_0x12cb39['error'][_0x42b7('0x15')]);return _0x12176d(_0x12cb39[_0x42b7('0x13')]['message']);}else{logger[_0x42b7('0xf')](_0x42b7('0x14'),_0x53a035,'request\x20sent');_0x12176d(_0x12cb39['result'][_0x42b7('0x15')]);}})[_0x42b7('0x16')](function(_0x3b7076){logger[_0x42b7('0x13')](_0x42b7('0x14'),_0x53a035,_0x3b7076);_0x4f1ddc(_0x3b7076);});});}exports[_0x42b7('0x17')]=function(_0x539ad9){var _0x51c781=this;return new Promise(function(_0x3e34a5,_0x472cc9){return db['ChatMessage'][_0x42b7('0x18')](_0x539ad9['body'],{'raw':_0x539ad9[_0x42b7('0x19')]?_0x539ad9[_0x42b7('0x19')][_0x42b7('0x1a')]===undefined?!![]:![]:!![]})[_0x42b7('0xe')](function(_0x1cb6c6){logger[_0x42b7('0xf')](_0x42b7('0x17'),_0x539ad9);logger[_0x42b7('0x1b')](_0x42b7('0x17'),_0x539ad9,JSON[_0x42b7('0x12')](_0x1cb6c6));_0x3e34a5(_0x1cb6c6);})['catch'](function(_0x16b546){logger[_0x42b7('0x13')](_0x42b7('0x17'),_0x16b546['message'],_0x539ad9);_0x472cc9(_0x51c781[_0x42b7('0x13')](0x1f4,_0x16b546[_0x42b7('0x15')]));});});}; \ No newline at end of file +var _0xdf73=['stringify','error','code','message','ChatMessage,\x20%s,\x20%s','ChatMessage','create','body','options','raw','then','debug','catch','CreateChatMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','redis','socket.io-emitter','./chatMessage.socket','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0xb5745,_0x15f0c6){var _0x280fdf=function(_0x2e1fbc){while(--_0x2e1fbc){_0xb5745['push'](_0xb5745['shift']());}};_0x280fdf(++_0x15f0c6);}(_0xdf73,0xd2));var _0x3df7=function(_0x6b3753,_0x41edd1){_0x6b3753=_0x6b3753-0x0;var _0x335f2a=_0xdf73[_0x6b3753];return _0x335f2a;};'use strict';var _=require('lodash');var util=require(_0x3df7('0x0'));var moment=require(_0x3df7('0x1'));var BPromise=require(_0x3df7('0x2'));var rs=require(_0x3df7('0x3'));var fs=require('fs');var Redis=require(_0x3df7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3df7('0x5'));var logger=require('../../config/logger')(_0x3df7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3df7('0x7')]['http']({'port':0x232a});config[_0x3df7('0x8')]=_['defaults'](config[_0x3df7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3df7('0x9'))(new Redis(config[_0x3df7('0x8')]));require(_0x3df7('0xa'))['register'](socket);function respondWithRpcPromise(_0x1767c0,_0x3feb31,_0x53f461){return new BPromise(function(_0x49a0cd,_0x55306e){return client['request'](_0x1767c0,_0x53f461)['then'](function(_0x28009f){logger[_0x3df7('0xb')]('ChatMessage,\x20%s,\x20%s',_0x3feb31,_0x3df7('0xc'));logger['debug'](_0x3df7('0xd'),_0x3feb31,_0x3df7('0xc'),JSON[_0x3df7('0xe')](_0x28009f));if(_0x28009f[_0x3df7('0xf')]){if(_0x28009f['error'][_0x3df7('0x10')]===0x1f4){logger[_0x3df7('0xf')]('ChatMessage,\x20%s,\x20%s',_0x3feb31,_0x28009f[_0x3df7('0xf')]['message']);return _0x55306e(_0x28009f[_0x3df7('0xf')][_0x3df7('0x11')]);}logger['error'](_0x3df7('0x12'),_0x3feb31,_0x28009f[_0x3df7('0xf')][_0x3df7('0x11')]);return _0x49a0cd(_0x28009f[_0x3df7('0xf')][_0x3df7('0x11')]);}else{logger[_0x3df7('0xb')](_0x3df7('0x12'),_0x3feb31,_0x3df7('0xc'));_0x49a0cd(_0x28009f['result']['message']);}})['catch'](function(_0x529d57){logger[_0x3df7('0xf')](_0x3df7('0x12'),_0x3feb31,_0x529d57);_0x55306e(_0x529d57);});});}exports['CreateChatMessage']=function(_0x29690c){var _0x3ab8a4=this;return new Promise(function(_0x13f54b,_0x1ab40f){return db[_0x3df7('0x13')][_0x3df7('0x14')](_0x29690c[_0x3df7('0x15')],{'raw':_0x29690c[_0x3df7('0x16')]?_0x29690c[_0x3df7('0x16')][_0x3df7('0x17')]===undefined?!![]:![]:!![]})[_0x3df7('0x18')](function(_0x6e4d29){logger[_0x3df7('0xb')]('CreateChatMessage',_0x29690c);logger[_0x3df7('0x19')]('CreateChatMessage',_0x29690c,JSON['stringify'](_0x6e4d29));_0x13f54b(_0x6e4d29);})[_0x3df7('0x1a')](function(_0xb83885){logger[_0x3df7('0xf')](_0x3df7('0x1b'),_0xb83885[_0x3df7('0x11')],_0x29690c);_0x1ab40f(_0x3ab8a4[_0x3df7('0xf')](0x1f4,_0xb83885[_0x3df7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 578b43c..85c53eb 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 _0x0295=['emit','removeListener','register','chatMessage:','./chatMessage.events','update'];(function(_0x415f46,_0x4edba8){var _0x50b622=function(_0x351ad7){while(--_0x351ad7){_0x415f46['push'](_0x415f46['shift']());}};_0x50b622(++_0x4edba8);}(_0x0295,0x1f0));var _0x5029=function(_0x8e992d,_0x5dd91c){_0x8e992d=_0x8e992d-0x0;var _0x41dd7f=_0x0295[_0x8e992d];return _0x41dd7f;};'use strict';var ChatMessageEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){ChatMessageEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);ChatMessageEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x2542=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2fa2b9,_0x289e22){var _0x4d251a=function(_0x519beb){while(--_0x519beb){_0x2fa2b9['push'](_0x2fa2b9['shift']());}};_0x4d251a(++_0x289e22);}(_0x2542,0x169));var _0x2254=function(_0x4fff4a,_0x5e3c25){_0x4fff4a=_0x4fff4a-0x0;var _0x1e4ea3=_0x2542[_0x4fff4a];return _0x1e4ea3;};'use strict';var ChatMessageEvents=require(_0x2254('0x0'));var events=[_0x2254('0x1'),_0x2254('0x2'),_0x2254('0x3')];function createListener(_0x578407,_0x105910){return function(_0x47b1da){_0x105910[_0x2254('0x4')](_0x578407,_0x47b1da);};}function removeListener(_0x3b3dcb,_0x27f5c9){return function(){ChatMessageEvents[_0x2254('0x5')](_0x3b3dcb,_0x27f5c9);};}exports[_0x2254('0x6')]=function(_0x508183){for(var _0x19ad3c=0x0,_0xe8ca50=events[_0x2254('0x7')];_0x19ad3c<_0xe8ca50;_0x19ad3c++){var _0x3c45ec=events[_0x19ad3c];var _0x1637ad=createListener(_0x2254('0x8')+_0x3c45ec,_0x508183);ChatMessageEvents['on'](_0x3c45ec,_0x1637ad);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0fb3621..b4e0c1e 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 _0xb4d8=['/:id/reject','reject','delete','destroy','multer','path','connect-timeout','Router','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept'];(function(_0xd3c9b5,_0x5cfa3d){var _0x2db40e=function(_0x184b06){while(--_0x184b06){_0xd3c9b5['push'](_0xd3c9b5['shift']());}};_0x2db40e(++_0x5cfa3d);}(_0xb4d8,0x108));var _0x8b4d=function(_0x2e1f11,_0x587eaf){_0x2e1f11=_0x2e1f11-0x0;var _0x1c2e24=_0xb4d8[_0x2e1f11];return _0x1c2e24;};'use strict';var multer=require(_0x8b4d('0x0'));var util=require('util');var path=require(_0x8b4d('0x1'));var timeout=require(_0x8b4d('0x2'));var express=require('express');var router=express[_0x8b4d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b4d('0x4'));var controller=require(_0x8b4d('0x5'));router['get']('/',auth[_0x8b4d('0x6')](),controller[_0x8b4d('0x7')]);router[_0x8b4d('0x8')](_0x8b4d('0x9'),auth[_0x8b4d('0x6')](),controller[_0x8b4d('0xa')]);router[_0x8b4d('0x8')](_0x8b4d('0xb'),auth[_0x8b4d('0x6')](),controller[_0x8b4d('0xc')]);router[_0x8b4d('0xd')]('/',auth[_0x8b4d('0x6')](),interaction[_0x8b4d('0xe')](_0x8b4d('0xf'),_0x8b4d('0x10')),controller[_0x8b4d('0x11')]);router[_0x8b4d('0x12')](_0x8b4d('0xb'),controller[_0x8b4d('0x13')]);router[_0x8b4d('0x12')](_0x8b4d('0x14'),auth[_0x8b4d('0x6')](),controller[_0x8b4d('0x15')]);router['put'](_0x8b4d('0x16'),auth['isAuthenticated'](),controller[_0x8b4d('0x17')]);router[_0x8b4d('0x18')](_0x8b4d('0xb'),auth[_0x8b4d('0x6')](),controller[_0x8b4d('0x19')]);module['exports']=router; \ No newline at end of file +var _0xff97=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','chat','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','path','Router','../../components/interaction/service'];(function(_0x2caca2,_0x3079f7){var _0x349b2e=function(_0xfe1e08){while(--_0xfe1e08){_0x2caca2['push'](_0x2caca2['shift']());}};_0x349b2e(++_0x3079f7);}(_0xff97,0x18d));var _0x7ff9=function(_0x4fb2b9,_0x2e0c43){_0x4fb2b9=_0x4fb2b9-0x0;var _0x4de9a3=_0xff97[_0x4fb2b9];return _0x4de9a3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7ff9('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ff9('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x7ff9('0x2'));var config=require(_0x7ff9('0x3'));var controller=require('./chatMessage.controller');router[_0x7ff9('0x4')]('/',auth[_0x7ff9('0x5')](),controller[_0x7ff9('0x6')]);router[_0x7ff9('0x4')](_0x7ff9('0x7'),auth[_0x7ff9('0x5')](),controller['describe']);router[_0x7ff9('0x4')](_0x7ff9('0x8'),auth[_0x7ff9('0x5')](),controller[_0x7ff9('0x9')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x7ff9('0xa'),_0x7ff9('0xb')),controller[_0x7ff9('0xc')]);router['put']('/:id',controller['update']);router[_0x7ff9('0xd')](_0x7ff9('0xe'),auth[_0x7ff9('0x5')](),controller['accept']);router['put'](_0x7ff9('0xf'),auth[_0x7ff9('0x5')](),controller[_0x7ff9('0x10')]);router[_0x7ff9('0x11')](_0x7ff9('0x8'),auth[_0x7ff9('0x5')](),controller[_0x7ff9('0x12')]);module[_0x7ff9('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 784ec9a..aaafc28 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 _0x1f68=['exports','TEXT','medium','sequelize'];(function(_0x213ede,_0x397b4e){var _0x6bb5c5=function(_0x128665){while(--_0x128665){_0x213ede['push'](_0x213ede['shift']());}};_0x6bb5c5(++_0x397b4e);}(_0x1f68,0x1bb));var _0x81f6=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x1f68[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0x81f6('0x0'));module[_0x81f6('0x1')]={'body':{'type':Sequelize[_0x81f6('0x2')](_0x81f6('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x7a6c=['sequelize','exports','TEXT'];(function(_0xe48b29,_0x462096){var _0x4d997d=function(_0x15630f){while(--_0x15630f){_0xe48b29['push'](_0xe48b29['shift']());}};_0x4d997d(++_0x462096);}(_0x7a6c,0x1d7));var _0xc7a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc7a6('0x0'));module[_0xc7a6('0x1')]={'body':{'type':Sequelize[_0xc7a6('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4b8add4..e7be711 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 _0x30b2=['ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','length','find','catch','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','index','map'];(function(_0x2cea4f,_0x371611){var _0x1de881=function(_0x456942){while(--_0x456942){_0x2cea4f['push'](_0x2cea4f['shift']());}};_0x1de881(++_0x371611);}(_0x30b2,0xbb));var _0x230b=function(_0x131387,_0x27e6e1){_0x131387=_0x131387-0x0;var _0x34bb5b=_0x30b2[_0x131387];return _0x34bb5b;};'use strict';var pdf=require(_0x230b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x230b('0x1'));var zipdir=require(_0x230b('0x2'));var jsonpatch=require(_0x230b('0x3'));var rp=require(_0x230b('0x4'));var moment=require('moment');var BPromise=require(_0x230b('0x5'));var Mustache=require(_0x230b('0x6'));var util=require(_0x230b('0x7'));var path=require(_0x230b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x230b('0x9'));var fs=require('fs');var _=require(_0x230b('0xa'));var squel=require(_0x230b('0xb'));var crypto=require(_0x230b('0xc'));var jsforce=require(_0x230b('0xd'));var deskjs=require(_0x230b('0xe'));var toCsv=require(_0x230b('0xf'));var querystring=require(_0x230b('0x10'));var Papa=require(_0x230b('0x11'));var Redis=require(_0x230b('0x12'));var authService=require(_0x230b('0x13'));var qs=require(_0x230b('0x14'));var as=require(_0x230b('0x15'));var hardwareService=require(_0x230b('0x16'));var logger=require(_0x230b('0x17'))(_0x230b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x230b('0x19'));var db=require(_0x230b('0x1a'))['db'];function respondWithStatusCode(_0x3de5b3,_0x3d2646){_0x3d2646=_0x3d2646||0xcc;return function(_0x4a0a66){if(_0x4a0a66){return _0x3de5b3[_0x230b('0x1b')](_0x3d2646);}return _0x3de5b3[_0x230b('0x1c')](_0x3d2646)[_0x230b('0x1d')]();};}function respondWithResult(_0x1fe66d,_0x2ff3fc){_0x2ff3fc=_0x2ff3fc||0xc8;return function(_0x397b5a){if(_0x397b5a){return _0x1fe66d[_0x230b('0x1c')](_0x2ff3fc)[_0x230b('0x1e')](_0x397b5a);}};}function respondWithFilteredResult(_0x39b90e,_0xe4c608){return function(_0x49fde7){if(_0x49fde7){var _0x189e77=_0x49fde7[_0x230b('0x1f')],_0x46e21c=_0xe4c608[_0x230b('0x20')],_0x379038=_0xe4c608[_0x230b('0x20')]+_0xe4c608[_0x230b('0x21')],_0x44d450;if(_0x379038>=_0x189e77){_0x379038=_0x189e77;_0x44d450=0xc8;}else{_0x44d450=0xce;}_0x39b90e['status'](_0x44d450);return _0x39b90e['set'](_0x230b('0x22'),_0x46e21c+'-'+_0x379038+'/'+_0x189e77)[_0x230b('0x1e')](_0x49fde7);}return null;};}function patchUpdates(_0xb7c35b){return function(_0x2de38e){try{jsonpatch[_0x230b('0x23')](_0x2de38e,_0xb7c35b,!![]);}catch(_0x2650cc){return BPromise[_0x230b('0x24')](_0x2650cc);}return _0x2de38e[_0x230b('0x25')]();};}function saveUpdates(_0x1f3055,_0x2325ed){return function(_0x454052){if(_0x454052){return _0x454052[_0x230b('0x26')](_0x1f3055)[_0x230b('0x27')](function(_0xb20be5){return _0xb20be5;});}return null;};}function removeEntity(_0x4ac1c0,_0x39c89a){return function(_0x27514e){if(_0x27514e){return _0x27514e[_0x230b('0x28')]()[_0x230b('0x27')](function(){_0x4ac1c0[_0x230b('0x1c')](0xcc)[_0x230b('0x1d')]();});}};}function handleEntityNotFound(_0x391ea8,_0x26bd86){return function(_0x5a92ed){if(!_0x5a92ed){_0x391ea8[_0x230b('0x1b')](0x194);}return _0x5a92ed;};}function handleError(_0x483e8a,_0x5f228e){_0x5f228e=_0x5f228e||0x1f4;return function(_0x2063cd){logger['error'](_0x2063cd['stack']);if(_0x2063cd['name']){delete _0x2063cd[_0x230b('0x29')];}_0x483e8a[_0x230b('0x1c')](_0x5f228e)['send'](_0x2063cd);};}exports[_0x230b('0x2a')]=function(_0xc827cd,_0x4f882d){var _0x58b27b={},_0x2877a1={},_0x5e9c68={'count':0x0,'rows':[]};var _0x4c8cf5=_[_0x230b('0x2b')](db[_0x230b('0x2c')][_0x230b('0x2d')],function(_0x3b60d8){return{'name':_0x3b60d8[_0x230b('0x2e')],'type':_0x3b60d8[_0x230b('0x2f')][_0x230b('0x30')]};});_0x2877a1['model']=_[_0x230b('0x2b')](_0x4c8cf5,_0x230b('0x29'));_0x2877a1[_0x230b('0x31')]=_[_0x230b('0x32')](_0xc827cd['query']);_0x2877a1[_0x230b('0x33')]=_['intersection'](_0x2877a1['model'],_0x2877a1[_0x230b('0x31')]);_0x58b27b[_0x230b('0x34')]=_[_0x230b('0x35')](_0x2877a1[_0x230b('0x36')],qs[_0x230b('0x37')](_0xc827cd[_0x230b('0x31')][_0x230b('0x37')]));_0x58b27b[_0x230b('0x34')]=_0x58b27b[_0x230b('0x34')]['length']?_0x58b27b[_0x230b('0x34')]:_0x2877a1['model'];if(!_0xc827cd[_0x230b('0x31')][_0x230b('0x38')](_0x230b('0x39'))){_0x58b27b[_0x230b('0x21')]=qs['limit'](_0xc827cd[_0x230b('0x31')]['limit']);_0x58b27b[_0x230b('0x20')]=qs[_0x230b('0x20')](_0xc827cd['query'][_0x230b('0x20')]);}_0x58b27b[_0x230b('0x3a')]=qs[_0x230b('0x3b')](_0xc827cd[_0x230b('0x31')][_0x230b('0x3b')]);_0x58b27b[_0x230b('0x3c')]=qs[_0x230b('0x33')](_[_0x230b('0x3d')](_0xc827cd[_0x230b('0x31')],_0x2877a1[_0x230b('0x33')]),_0x4c8cf5);if(_0xc827cd[_0x230b('0x31')][_0x230b('0x3e')]){_0x58b27b[_0x230b('0x3c')]=_[_0x230b('0x3f')](_0x58b27b[_0x230b('0x3c')],{'$or':_['map'](_0x4c8cf5,function(_0x3a2e94){if(_0x3a2e94['type']!==_0x230b('0x40')){var _0x890b6c={};_0x890b6c[_0x3a2e94[_0x230b('0x29')]]={'$like':'%'+_0xc827cd[_0x230b('0x31')][_0x230b('0x3e')]+'%'};return _0x890b6c;}})});}_0x58b27b=_[_0x230b('0x3f')]({},_0x58b27b,_0xc827cd[_0x230b('0x41')]);var _0x4eea14={'where':_0x58b27b['where']};return db[_0x230b('0x2c')][_0x230b('0x1f')](_0x4eea14)[_0x230b('0x27')](function(_0x2f5497){_0x5e9c68[_0x230b('0x1f')]=_0x2f5497;if(_0xc827cd[_0x230b('0x31')][_0x230b('0x42')]){_0x58b27b[_0x230b('0x43')]=[{'all':!![]}];}return db[_0x230b('0x2c')]['findAll'](_0x58b27b);})[_0x230b('0x27')](function(_0x4941af){_0x5e9c68[_0x230b('0x44')]=_0x4941af;return _0x5e9c68;})['then'](respondWithFilteredResult(_0x4f882d,_0x58b27b))['catch'](handleError(_0x4f882d,null));};exports[_0x230b('0x45')]=function(_0x3bdd6c,_0x27d5de){var _0x278815={'raw':!![],'where':{'id':_0x3bdd6c['params']['id']}},_0x17361f={};_0x17361f[_0x230b('0x36')]=_[_0x230b('0x32')](db['ChatOfflineMessage']['rawAttributes']);_0x17361f[_0x230b('0x31')]=_[_0x230b('0x32')](_0x3bdd6c[_0x230b('0x31')]);_0x17361f[_0x230b('0x33')]=_[_0x230b('0x35')](_0x17361f['model'],_0x17361f[_0x230b('0x31')]);_0x278815[_0x230b('0x34')]=_[_0x230b('0x35')](_0x17361f[_0x230b('0x36')],qs[_0x230b('0x37')](_0x3bdd6c['query'][_0x230b('0x37')]));_0x278815[_0x230b('0x34')]=_0x278815[_0x230b('0x34')][_0x230b('0x46')]?_0x278815[_0x230b('0x34')]:_0x17361f[_0x230b('0x36')];if(_0x3bdd6c['query']['includeAll']){_0x278815[_0x230b('0x43')]=[{'all':!![]}];}_0x278815=_[_0x230b('0x3f')]({},_0x278815,_0x3bdd6c[_0x230b('0x41')]);return db[_0x230b('0x2c')][_0x230b('0x47')](_0x278815)['then'](handleEntityNotFound(_0x27d5de,null))[_0x230b('0x27')](respondWithResult(_0x27d5de,null))[_0x230b('0x48')](handleError(_0x27d5de,null));};exports[_0x230b('0x49')]=function(_0x406c76,_0x711b67){return db[_0x230b('0x2c')][_0x230b('0x49')](_0x406c76[_0x230b('0x4a')],{})[_0x230b('0x27')](respondWithResult(_0x711b67,0xc9))['catch'](handleError(_0x711b67,null));};exports[_0x230b('0x26')]=function(_0x54d9e2,_0xd31a23){if(_0x54d9e2[_0x230b('0x4a')]['id']){delete _0x54d9e2[_0x230b('0x4a')]['id'];}return db[_0x230b('0x2c')][_0x230b('0x47')]({'where':{'id':_0x54d9e2[_0x230b('0x4b')]['id']}})[_0x230b('0x27')](handleEntityNotFound(_0xd31a23,null))[_0x230b('0x27')](saveUpdates(_0x54d9e2['body'],null))[_0x230b('0x27')](respondWithResult(_0xd31a23,null))[_0x230b('0x48')](handleError(_0xd31a23,null));};exports[_0x230b('0x28')]=function(_0xe65a2f,_0x558716){return db[_0x230b('0x2c')][_0x230b('0x47')]({'where':{'id':_0xe65a2f[_0x230b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x558716,null))[_0x230b('0x27')](removeEntity(_0x558716,null))[_0x230b('0x48')](handleError(_0x558716,null));};exports[_0x230b('0x4c')]=function(_0x2dc9b0,_0x1dbc07){return db[_0x230b('0x2c')][_0x230b('0x4c')]()[_0x230b('0x27')](respondWithResult(_0x1dbc07,null))[_0x230b('0x48')](handleError(_0x1dbc07,null));}; \ No newline at end of file +var _0x99d1=['map','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ChatOfflineMessage','include','findAll','rows','show','keys','rawAttributes','length','includeAll','options','find','catch','body','params','describe','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','then','error','stack','name','send','index'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x99d1,0x104));var _0x199d=function(_0x55b8a4,_0x5f178f){_0x55b8a4=_0x55b8a4-0x0;var _0x1829c8=_0x99d1[_0x55b8a4];return _0x1829c8;};'use strict';var pdf=require(_0x199d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x199d('0x1'));var zipdir=require(_0x199d('0x2'));var jsonpatch=require(_0x199d('0x3'));var rp=require(_0x199d('0x4'));var moment=require(_0x199d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x199d('0x6'));var util=require(_0x199d('0x7'));var path=require(_0x199d('0x8'));var sox=require(_0x199d('0x9'));var csv=require(_0x199d('0xa'));var ejs=require(_0x199d('0xb'));var fs=require('fs');var _=require(_0x199d('0xc'));var squel=require(_0x199d('0xd'));var crypto=require(_0x199d('0xe'));var jsforce=require(_0x199d('0xf'));var deskjs=require(_0x199d('0x10'));var toCsv=require(_0x199d('0xa'));var querystring=require(_0x199d('0x11'));var Papa=require(_0x199d('0x12'));var Redis=require('ioredis');var authService=require(_0x199d('0x13'));var qs=require(_0x199d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x199d('0x15'));var logger=require(_0x199d('0x16'))(_0x199d('0x17'));var utils=require('../../config/utils');var config=require(_0x199d('0x18'));var licenseUtil=require(_0x199d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bc650,_0x2cb356){_0x2cb356=_0x2cb356||0xcc;return function(_0xd12e1f){if(_0xd12e1f){return _0x5bc650[_0x199d('0x1a')](_0x2cb356);}return _0x5bc650[_0x199d('0x1b')](_0x2cb356)[_0x199d('0x1c')]();};}function respondWithResult(_0x393a90,_0x580f3e){_0x580f3e=_0x580f3e||0xc8;return function(_0x38fe82){if(_0x38fe82){return _0x393a90[_0x199d('0x1b')](_0x580f3e)['json'](_0x38fe82);}};}function respondWithFilteredResult(_0x21ee01,_0x38211e){return function(_0x1e22a9){if(_0x1e22a9){var _0x133368=_0x1e22a9[_0x199d('0x1d')],_0x46a10f=_0x38211e[_0x199d('0x1e')],_0x3da481=_0x38211e[_0x199d('0x1e')]+_0x38211e[_0x199d('0x1f')],_0x1fa235;if(_0x3da481>=_0x133368){_0x3da481=_0x133368;_0x1fa235=0xc8;}else{_0x1fa235=0xce;}_0x21ee01[_0x199d('0x1b')](_0x1fa235);return _0x21ee01[_0x199d('0x20')](_0x199d('0x21'),_0x46a10f+'-'+_0x3da481+'/'+_0x133368)[_0x199d('0x22')](_0x1e22a9);}return null;};}function patchUpdates(_0x1c849a){return function(_0x37158d){try{jsonpatch[_0x199d('0x23')](_0x37158d,_0x1c849a,!![]);}catch(_0x13f3d7){return BPromise['reject'](_0x13f3d7);}return _0x37158d['save']();};}function saveUpdates(_0x5e0746,_0x49886c){return function(_0x46023a){if(_0x46023a){return _0x46023a[_0x199d('0x24')](_0x5e0746)['then'](function(_0x32cdae){return _0x32cdae;});}return null;};}function removeEntity(_0x30e2b9,_0x15a849){return function(_0x532c3c){if(_0x532c3c){return _0x532c3c[_0x199d('0x25')]()[_0x199d('0x26')](function(){_0x30e2b9[_0x199d('0x1b')](0xcc)[_0x199d('0x1c')]();});}};}function handleEntityNotFound(_0x5341c0,_0x14fa60){return function(_0xac74fe){if(!_0xac74fe){_0x5341c0[_0x199d('0x1a')](0x194);}return _0xac74fe;};}function handleError(_0x582a1f,_0x6fb2bf){_0x6fb2bf=_0x6fb2bf||0x1f4;return function(_0x3c898b){logger[_0x199d('0x27')](_0x3c898b[_0x199d('0x28')]);if(_0x3c898b[_0x199d('0x29')]){delete _0x3c898b[_0x199d('0x29')];}_0x582a1f[_0x199d('0x1b')](_0x6fb2bf)[_0x199d('0x2a')](_0x3c898b);};}exports[_0x199d('0x2b')]=function(_0x2384ca,_0x2e35dc){var _0x241ce0={},_0x4e8a18={},_0x5afff6={'count':0x0,'rows':[]};var _0x2e91fa=_[_0x199d('0x2c')](db['ChatOfflineMessage']['rawAttributes'],function(_0x24110c){return{'name':_0x24110c[_0x199d('0x2d')],'type':_0x24110c[_0x199d('0x2e')]['key']};});_0x4e8a18[_0x199d('0x2f')]=_[_0x199d('0x2c')](_0x2e91fa,_0x199d('0x29'));_0x4e8a18[_0x199d('0x30')]=_['keys'](_0x2384ca[_0x199d('0x30')]);_0x4e8a18[_0x199d('0x31')]=_[_0x199d('0x32')](_0x4e8a18[_0x199d('0x2f')],_0x4e8a18[_0x199d('0x30')]);_0x241ce0[_0x199d('0x33')]=_[_0x199d('0x32')](_0x4e8a18[_0x199d('0x2f')],qs[_0x199d('0x34')](_0x2384ca[_0x199d('0x30')]['fields']));_0x241ce0[_0x199d('0x33')]=_0x241ce0[_0x199d('0x33')]['length']?_0x241ce0['attributes']:_0x4e8a18[_0x199d('0x2f')];if(!_0x2384ca['query'][_0x199d('0x35')]('nolimit')){_0x241ce0[_0x199d('0x1f')]=qs['limit'](_0x2384ca['query'][_0x199d('0x1f')]);_0x241ce0['offset']=qs['offset'](_0x2384ca['query'][_0x199d('0x1e')]);}_0x241ce0[_0x199d('0x36')]=qs[_0x199d('0x37')](_0x2384ca[_0x199d('0x30')]['sort']);_0x241ce0[_0x199d('0x38')]=qs[_0x199d('0x31')](_[_0x199d('0x39')](_0x2384ca[_0x199d('0x30')],_0x4e8a18[_0x199d('0x31')]),_0x2e91fa);if(_0x2384ca[_0x199d('0x30')][_0x199d('0x3a')]){_0x241ce0[_0x199d('0x38')]=_[_0x199d('0x3b')](_0x241ce0[_0x199d('0x38')],{'$or':_[_0x199d('0x2c')](_0x2e91fa,function(_0x159e56){if(_0x159e56[_0x199d('0x2e')]!==_0x199d('0x3c')){var _0x42f685={};_0x42f685[_0x159e56[_0x199d('0x29')]]={'$like':'%'+_0x2384ca[_0x199d('0x30')][_0x199d('0x3a')]+'%'};return _0x42f685;}})});}_0x241ce0=_[_0x199d('0x3b')]({},_0x241ce0,_0x2384ca['options']);var _0x239bd8={'where':_0x241ce0['where']};return db[_0x199d('0x3d')][_0x199d('0x1d')](_0x239bd8)[_0x199d('0x26')](function(_0x56cc27){_0x5afff6['count']=_0x56cc27;if(_0x2384ca['query']['includeAll']){_0x241ce0[_0x199d('0x3e')]=[{'all':!![]}];}return db[_0x199d('0x3d')][_0x199d('0x3f')](_0x241ce0);})[_0x199d('0x26')](function(_0x35acfd){_0x5afff6[_0x199d('0x40')]=_0x35acfd;return _0x5afff6;})['then'](respondWithFilteredResult(_0x2e35dc,_0x241ce0))['catch'](handleError(_0x2e35dc,null));};exports[_0x199d('0x41')]=function(_0xea922f,_0xadf670){var _0x8b76c7={'raw':!![],'where':{'id':_0xea922f['params']['id']}},_0x16d83c={};_0x16d83c['model']=_[_0x199d('0x42')](db['ChatOfflineMessage'][_0x199d('0x43')]);_0x16d83c['query']=_['keys'](_0xea922f[_0x199d('0x30')]);_0x16d83c[_0x199d('0x31')]=_['intersection'](_0x16d83c[_0x199d('0x2f')],_0x16d83c['query']);_0x8b76c7[_0x199d('0x33')]=_[_0x199d('0x32')](_0x16d83c[_0x199d('0x2f')],qs[_0x199d('0x34')](_0xea922f['query']['fields']));_0x8b76c7[_0x199d('0x33')]=_0x8b76c7['attributes'][_0x199d('0x44')]?_0x8b76c7[_0x199d('0x33')]:_0x16d83c[_0x199d('0x2f')];if(_0xea922f['query'][_0x199d('0x45')]){_0x8b76c7[_0x199d('0x3e')]=[{'all':!![]}];}_0x8b76c7=_[_0x199d('0x3b')]({},_0x8b76c7,_0xea922f[_0x199d('0x46')]);return db[_0x199d('0x3d')][_0x199d('0x47')](_0x8b76c7)[_0x199d('0x26')](handleEntityNotFound(_0xadf670,null))['then'](respondWithResult(_0xadf670,null))[_0x199d('0x48')](handleError(_0xadf670,null));};exports['create']=function(_0x57b034,_0x1b6d3a){return db[_0x199d('0x3d')]['create'](_0x57b034['body'],{})[_0x199d('0x26')](respondWithResult(_0x1b6d3a,0xc9))['catch'](handleError(_0x1b6d3a,null));};exports['update']=function(_0x3680ad,_0x349426){if(_0x3680ad[_0x199d('0x49')]['id']){delete _0x3680ad['body']['id'];}return db[_0x199d('0x3d')][_0x199d('0x47')]({'where':{'id':_0x3680ad[_0x199d('0x4a')]['id']}})[_0x199d('0x26')](handleEntityNotFound(_0x349426,null))[_0x199d('0x26')](saveUpdates(_0x3680ad[_0x199d('0x49')],null))[_0x199d('0x26')](respondWithResult(_0x349426,null))[_0x199d('0x48')](handleError(_0x349426,null));};exports[_0x199d('0x25')]=function(_0x862f63,_0xb108e5){return db[_0x199d('0x3d')][_0x199d('0x47')]({'where':{'id':_0x862f63[_0x199d('0x4a')]['id']}})[_0x199d('0x26')](handleEntityNotFound(_0xb108e5,null))['then'](removeEntity(_0xb108e5,null))[_0x199d('0x48')](handleError(_0xb108e5,null));};exports[_0x199d('0x4b')]=function(_0x8da854,_0x121d3c){return db['ChatOfflineMessage'][_0x199d('0x4b')]()[_0x199d('0x26')](respondWithResult(_0x121d3c,null))[_0x199d('0x48')](handleError(_0x121d3c,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 70283bf..1986734 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 _0x8ce3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x28d448,_0x77da84){var _0x14421d=function(_0x3609d3){while(--_0x3609d3){_0x28d448['push'](_0x28d448['shift']());}};_0x14421d(++_0x77da84);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3fa631,_0x24392c){_0x3fa631=_0x3fa631-0x0;var _0x5c9dec=_0x8ce3[_0x3fa631];return _0x5c9dec;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38ce('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa37e=['bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x43ef05,_0x52c7ab){var _0x39363f=function(_0x4ad3e0){while(--_0x4ad3e0){_0x43ef05['push'](_0x43ef05['shift']());}};_0x39363f(++_0x52c7ab);}(_0xa37e,0x97));var _0xea37=function(_0x4b891d,_0x28063a){_0x4b891d=_0x4b891d-0x0;var _0x1f1462=_0xa37e[_0x4b891d];return _0x1f1462;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea37('0x9'),'collate':_0xea37('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 34f8954..07c0776 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 _0xe2b8=['moment','../../mysqldb','rpc','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x140ba4,_0x33f703){var _0xa56163=function(_0x32da91){while(--_0x32da91){_0x140ba4['push'](_0x140ba4['shift']());}};_0xa56163(++_0x33f703);}(_0xe2b8,0xa9));var _0x8e2b=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xe2b8[_0x59bcb1];return _0x4a737f;};'use strict';var _=require(_0x8e2b('0x0'));var util=require('util');var moment=require(_0x8e2b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e2b('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e2b('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e2b('0x4')][_0x8e2b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x36812d,_0x192068,_0x17085b){return new BPromise(function(_0x1de5bd,_0x5f0ae0){return client['request'](_0x36812d,_0x17085b)[_0x8e2b('0x6')](function(_0x14c66b){logger[_0x8e2b('0x7')](_0x8e2b('0x8'),_0x192068,_0x8e2b('0x9'));logger[_0x8e2b('0xa')](_0x8e2b('0xb'),_0x192068,_0x8e2b('0x9'),JSON[_0x8e2b('0xc')](_0x14c66b));if(_0x14c66b['error']){if(_0x14c66b[_0x8e2b('0xd')][_0x8e2b('0xe')]===0x1f4){logger[_0x8e2b('0xd')](_0x8e2b('0x8'),_0x192068,_0x14c66b[_0x8e2b('0xd')][_0x8e2b('0xf')]);return _0x5f0ae0(_0x14c66b[_0x8e2b('0xd')][_0x8e2b('0xf')]);}logger[_0x8e2b('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x192068,_0x14c66b[_0x8e2b('0xd')]['message']);return _0x1de5bd(_0x14c66b[_0x8e2b('0xd')][_0x8e2b('0xf')]);}else{logger[_0x8e2b('0x7')](_0x8e2b('0x8'),_0x192068,'request\x20sent');_0x1de5bd(_0x14c66b['result'][_0x8e2b('0xf')]);}})[_0x8e2b('0x10')](function(_0x4c98bf){logger['error'](_0x8e2b('0x8'),_0x192068,_0x4c98bf);_0x5f0ae0(_0x4c98bf);});});} \ No newline at end of file +var _0xa784=['rpc','../../config/environment','request','then','info','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa784,0x1e8));var _0x4a78=function(_0x133107,_0x539af1){_0x133107=_0x133107-0x0;var _0x1b7621=_0xa784[_0x133107];return _0x1b7621;};'use strict';var _=require(_0x4a78('0x0'));var util=require(_0x4a78('0x1'));var moment=require('moment');var BPromise=require(_0x4a78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a78('0x3'));var db=require(_0x4a78('0x4'))['db'];var utils=require(_0x4a78('0x5'));var logger=require('../../config/logger')(_0x4a78('0x6'));var config=require(_0x4a78('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1429cc,_0x444397,_0x4fa8ee){return new BPromise(function(_0x41a088,_0x6e99ae){return client[_0x4a78('0x8')](_0x1429cc,_0x4fa8ee)[_0x4a78('0x9')](function(_0x2c6c1d){logger[_0x4a78('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x444397,'request\x20sent');logger['debug'](_0x4a78('0xb'),_0x444397,_0x4a78('0xc'),JSON[_0x4a78('0xd')](_0x2c6c1d));if(_0x2c6c1d[_0x4a78('0xe')]){if(_0x2c6c1d[_0x4a78('0xe')]['code']===0x1f4){logger[_0x4a78('0xe')](_0x4a78('0xf'),_0x444397,_0x2c6c1d[_0x4a78('0xe')][_0x4a78('0x10')]);return _0x6e99ae(_0x2c6c1d[_0x4a78('0xe')][_0x4a78('0x10')]);}logger[_0x4a78('0xe')](_0x4a78('0xf'),_0x444397,_0x2c6c1d['error'][_0x4a78('0x10')]);return _0x41a088(_0x2c6c1d['error'][_0x4a78('0x10')]);}else{logger[_0x4a78('0xa')](_0x4a78('0xf'),_0x444397,'request\x20sent');_0x41a088(_0x2c6c1d[_0x4a78('0x11')][_0x4a78('0x10')]);}})[_0x4a78('0x12')](function(_0x27b54d){logger[_0x4a78('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x444397,_0x27b54d);_0x6e99ae(_0x27b54d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a5b9533..ab02621 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 _0x0e9d=['/:id','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x4a689a,_0x2a9cff){var _0x1840d7=function(_0x2b539c){while(--_0x2b539c){_0x4a689a['push'](_0x4a689a['shift']());}};_0x1840d7(++_0x2a9cff);}(_0x0e9d,0x115));var _0xd0e9=function(_0x5f2e17,_0x2de9f2){_0x5f2e17=_0x5f2e17-0x0;var _0x388526=_0x0e9d[_0x5f2e17];return _0x388526;};'use strict';var multer=require(_0xd0e9('0x0'));var util=require(_0xd0e9('0x1'));var path=require('path');var timeout=require(_0xd0e9('0x2'));var express=require(_0xd0e9('0x3'));var router=express[_0xd0e9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd0e9('0x5'));var config=require(_0xd0e9('0x6'));var controller=require(_0xd0e9('0x7'));router[_0xd0e9('0x8')]('/',auth[_0xd0e9('0x9')](),controller['index']);router[_0xd0e9('0x8')](_0xd0e9('0xa'),auth[_0xd0e9('0x9')](),controller[_0xd0e9('0xb')]);router[_0xd0e9('0x8')](_0xd0e9('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd0e9('0xd')]);router['put']('/:id',auth[_0xd0e9('0x9')](),controller[_0xd0e9('0xe')]);router[_0xd0e9('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd0e9('0x10')]=router; \ No newline at end of file +var _0x3b47=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x514038,_0x450ef3){var _0x589720=function(_0x1a356f){while(--_0x1a356f){_0x514038['push'](_0x514038['shift']());}};_0x589720(++_0x450ef3);}(_0x3b47,0x1be));var _0x73b4=function(_0x1ec6ea,_0x265db4){_0x1ec6ea=_0x1ec6ea-0x0;var _0x3bbcc8=_0x3b47[_0x1ec6ea];return _0x3bbcc8;};'use strict';var multer=require(_0x73b4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73b4('0x1'));var router=express[_0x73b4('0x2')]();var auth=require(_0x73b4('0x3'));var interaction=require(_0x73b4('0x4'));var config=require(_0x73b4('0x5'));var controller=require(_0x73b4('0x6'));router[_0x73b4('0x7')]('/',auth[_0x73b4('0x8')](),controller[_0x73b4('0x9')]);router[_0x73b4('0x7')]('/describe',auth[_0x73b4('0x8')](),controller[_0x73b4('0xa')]);router['get'](_0x73b4('0xb'),auth[_0x73b4('0x8')](),controller[_0x73b4('0xc')]);router[_0x73b4('0xd')]('/',auth[_0x73b4('0x8')](),controller[_0x73b4('0xe')]);router[_0x73b4('0xf')]('/:id',auth[_0x73b4('0x8')](),controller['update']);router[_0x73b4('0x10')]('/:id',auth[_0x73b4('0x8')](),controller[_0x73b4('0x11')]);module[_0x73b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index e4c9b33..68bc825 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 _0x97c5=['mouseOver','INTEGER','sequelize','STRING'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x97c5,0x7e));var _0x597c=function(_0x1a6e67,_0x135295){_0x1a6e67=_0x1a6e67-0x0;var _0x106995=_0x97c5[_0x1a6e67];return _0x106995;};'use strict';var Sequelize=require(_0x597c('0x0'));module['exports']={'name':{'type':Sequelize[_0x597c('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x597c('0x2'),'timeout'),'defaultValue':_0x597c('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x597c('0x3')]}}; \ No newline at end of file +var _0xeb89=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x5bf508,_0x3a7c36){var _0xcda9d2=function(_0x4e8851){while(--_0x4e8851){_0x5bf508['push'](_0x5bf508['shift']());}};_0xcda9d2(++_0x3a7c36);}(_0xeb89,0x1ac));var _0x9eb8=function(_0x1fc8b2,_0x467dc6){_0x1fc8b2=_0x1fc8b2-0x0;var _0xd8dc81=_0xeb89[_0x1fc8b2];return _0xd8dc81;};'use strict';var Sequelize=require(_0x9eb8('0x0'));module[_0x9eb8('0x1')]={'name':{'type':Sequelize[_0x9eb8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9eb8('0x3')](_0x9eb8('0x4'),_0x9eb8('0x5')),'defaultValue':_0x9eb8('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9eb8('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f580f32..5b6ee0e 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 _0x5e2b=['ChatProactiveAction','rawAttributes','filters','intersection','query','attributes','fields','includeAll','merge','options','find','create','body','catch','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','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','end','error','stack','name','send','show','params','model','keys'];(function(_0x38a384,_0x4eaa43){var _0x41c1e1=function(_0x40675f){while(--_0x40675f){_0x38a384['push'](_0x38a384['shift']());}};_0x41c1e1(++_0x4eaa43);}(_0x5e2b,0xc9));var _0xb5e2=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x5e2b[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0xb5e2('0x0'));var emlformat=require(_0xb5e2('0x1'));var rimraf=require(_0xb5e2('0x2'));var zipdir=require(_0xb5e2('0x3'));var jsonpatch=require(_0xb5e2('0x4'));var rp=require(_0xb5e2('0x5'));var moment=require(_0xb5e2('0x6'));var BPromise=require(_0xb5e2('0x7'));var Mustache=require(_0xb5e2('0x8'));var util=require(_0xb5e2('0x9'));var path=require(_0xb5e2('0xa'));var sox=require(_0xb5e2('0xb'));var csv=require(_0xb5e2('0xc'));var ejs=require(_0xb5e2('0xd'));var fs=require('fs');var _=require(_0xb5e2('0xe'));var squel=require(_0xb5e2('0xf'));var crypto=require(_0xb5e2('0x10'));var jsforce=require(_0xb5e2('0x11'));var deskjs=require(_0xb5e2('0x12'));var toCsv=require(_0xb5e2('0xc'));var querystring=require(_0xb5e2('0x13'));var Papa=require('papaparse');var Redis=require(_0xb5e2('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb5e2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5e2('0x16'));var logger=require(_0xb5e2('0x17'))(_0xb5e2('0x18'));var utils=require(_0xb5e2('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb5e2('0x1a'));var db=require(_0xb5e2('0x1b'))['db'];function respondWithStatusCode(_0x1cbfcf,_0x310aa0){_0x310aa0=_0x310aa0||0xcc;return function(_0x13e684){if(_0x13e684){return _0x1cbfcf[_0xb5e2('0x1c')](_0x310aa0);}return _0x1cbfcf[_0xb5e2('0x1d')](_0x310aa0)['end']();};}function respondWithResult(_0x3cb634,_0x530de4){_0x530de4=_0x530de4||0xc8;return function(_0xb0bff6){if(_0xb0bff6){return _0x3cb634[_0xb5e2('0x1d')](_0x530de4)[_0xb5e2('0x1e')](_0xb0bff6);}};}function respondWithFilteredResult(_0x3806a9,_0x4fd511){return function(_0x86d08d){if(_0x86d08d){var _0x103aaf=_0x86d08d[_0xb5e2('0x1f')],_0x4209f6=_0x4fd511[_0xb5e2('0x20')],_0x95c213=_0x4fd511[_0xb5e2('0x20')]+_0x4fd511['limit'],_0x703bab;if(_0x95c213>=_0x103aaf){_0x95c213=_0x103aaf;_0x703bab=0xc8;}else{_0x703bab=0xce;}_0x3806a9[_0xb5e2('0x1d')](_0x703bab);return _0x3806a9['set'](_0xb5e2('0x21'),_0x4209f6+'-'+_0x95c213+'/'+_0x103aaf)['json'](_0x86d08d);}return null;};}function patchUpdates(_0x9ef5d2){return function(_0x517726){try{jsonpatch[_0xb5e2('0x22')](_0x517726,_0x9ef5d2,!![]);}catch(_0x8a988a){return BPromise['reject'](_0x8a988a);}return _0x517726[_0xb5e2('0x23')]();};}function saveUpdates(_0x5f2063,_0xf6a4e5){return function(_0x59a308){if(_0x59a308){return _0x59a308[_0xb5e2('0x24')](_0x5f2063)[_0xb5e2('0x25')](function(_0x2e3f99){return _0x2e3f99;});}return null;};}function removeEntity(_0x56b0fb,_0x22305b){return function(_0xc1854d){if(_0xc1854d){return _0xc1854d['destroy']()['then'](function(){_0x56b0fb[_0xb5e2('0x1d')](0xcc)[_0xb5e2('0x26')]();});}};}function handleEntityNotFound(_0x46ea31,_0x49f059){return function(_0x295e39){if(!_0x295e39){_0x46ea31[_0xb5e2('0x1c')](0x194);}return _0x295e39;};}function handleError(_0x2d8518,_0x584a32){_0x584a32=_0x584a32||0x1f4;return function(_0x2c1eda){logger[_0xb5e2('0x27')](_0x2c1eda[_0xb5e2('0x28')]);if(_0x2c1eda[_0xb5e2('0x29')]){delete _0x2c1eda[_0xb5e2('0x29')];}_0x2d8518[_0xb5e2('0x1d')](_0x584a32)[_0xb5e2('0x2a')](_0x2c1eda);};}exports[_0xb5e2('0x2b')]=function(_0xa7991c,_0x113556){var _0x4388b1={'raw':!![],'where':{'id':_0xa7991c[_0xb5e2('0x2c')]['id']}},_0x38fa13={};_0x38fa13[_0xb5e2('0x2d')]=_[_0xb5e2('0x2e')](db[_0xb5e2('0x2f')][_0xb5e2('0x30')]);_0x38fa13['query']=_[_0xb5e2('0x2e')](_0xa7991c['query']);_0x38fa13[_0xb5e2('0x31')]=_[_0xb5e2('0x32')](_0x38fa13[_0xb5e2('0x2d')],_0x38fa13[_0xb5e2('0x33')]);_0x4388b1[_0xb5e2('0x34')]=_[_0xb5e2('0x32')](_0x38fa13['model'],qs[_0xb5e2('0x35')](_0xa7991c[_0xb5e2('0x33')][_0xb5e2('0x35')]));_0x4388b1[_0xb5e2('0x34')]=_0x4388b1[_0xb5e2('0x34')]['length']?_0x4388b1[_0xb5e2('0x34')]:_0x38fa13[_0xb5e2('0x2d')];if(_0xa7991c[_0xb5e2('0x33')][_0xb5e2('0x36')]){_0x4388b1['include']=[{'all':!![]}];}_0x4388b1=_[_0xb5e2('0x37')]({},_0x4388b1,_0xa7991c[_0xb5e2('0x38')]);return db[_0xb5e2('0x2f')][_0xb5e2('0x39')](_0x4388b1)[_0xb5e2('0x25')](handleEntityNotFound(_0x113556,null))[_0xb5e2('0x25')](respondWithResult(_0x113556,null))['catch'](handleError(_0x113556,null));};exports['create']=function(_0x5bad23,_0x1da09c){return db[_0xb5e2('0x2f')][_0xb5e2('0x3a')](_0x5bad23[_0xb5e2('0x3b')],{})[_0xb5e2('0x25')](respondWithResult(_0x1da09c,0xc9))['catch'](handleError(_0x1da09c,null));};exports[_0xb5e2('0x24')]=function(_0x1782b2,_0x12d1dc){if(_0x1782b2[_0xb5e2('0x3b')]['id']){delete _0x1782b2['body']['id'];}return db[_0xb5e2('0x2f')][_0xb5e2('0x39')]({'where':{'id':_0x1782b2[_0xb5e2('0x2c')]['id']}})['then'](handleEntityNotFound(_0x12d1dc,null))['then'](saveUpdates(_0x1782b2[_0xb5e2('0x3b')],null))[_0xb5e2('0x25')](respondWithResult(_0x12d1dc,null))[_0xb5e2('0x3c')](handleError(_0x12d1dc,null));};exports[_0xb5e2('0x3d')]=function(_0x1c2c3c,_0x1fffe2){return db['ChatProactiveAction'][_0xb5e2('0x39')]({'where':{'id':_0x1c2c3c['params']['id']}})[_0xb5e2('0x25')](handleEntityNotFound(_0x1fffe2,null))[_0xb5e2('0x25')](removeEntity(_0x1fffe2,null))[_0xb5e2('0x3c')](handleError(_0x1fffe2,null));}; \ No newline at end of file +var _0x3ec7=['../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','show','params','keys','ChatProactiveAction','query','filters','intersection','model','attributes','length','includeAll','include','merge','find','catch','create','body','html-pdf','eml-format','rimraf','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2f9ac8,_0x27ed35){var _0x4b66bb=function(_0x5f21de){while(--_0x5f21de){_0x2f9ac8['push'](_0x2f9ac8['shift']());}};_0x4b66bb(++_0x27ed35);}(_0x3ec7,0x8d));var _0x73ec=function(_0x5d744e,_0x293853){_0x5d744e=_0x5d744e-0x0;var _0x4326d2=_0x3ec7[_0x5d744e];return _0x4326d2;};'use strict';var pdf=require(_0x73ec('0x0'));var emlformat=require(_0x73ec('0x1'));var rimraf=require(_0x73ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x73ec('0x3'));var util=require(_0x73ec('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x73ec('0x5'));var ejs=require(_0x73ec('0x6'));var fs=require('fs');var _=require(_0x73ec('0x7'));var squel=require(_0x73ec('0x8'));var crypto=require('crypto');var jsforce=require(_0x73ec('0x9'));var deskjs=require(_0x73ec('0xa'));var toCsv=require(_0x73ec('0x5'));var querystring=require(_0x73ec('0xb'));var Papa=require(_0x73ec('0xc'));var Redis=require(_0x73ec('0xd'));var authService=require(_0x73ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x73ec('0xf'));var hardwareService=require(_0x73ec('0x10'));var logger=require('../../config/logger')(_0x73ec('0x11'));var utils=require(_0x73ec('0x12'));var config=require(_0x73ec('0x13'));var licenseUtil=require(_0x73ec('0x14'));var db=require(_0x73ec('0x15'))['db'];function respondWithStatusCode(_0x25b5cf,_0xad12b2){_0xad12b2=_0xad12b2||0xcc;return function(_0x4b768a){if(_0x4b768a){return _0x25b5cf[_0x73ec('0x16')](_0xad12b2);}return _0x25b5cf[_0x73ec('0x17')](_0xad12b2)[_0x73ec('0x18')]();};}function respondWithResult(_0x2ea2c5,_0x486104){_0x486104=_0x486104||0xc8;return function(_0x367ce8){if(_0x367ce8){return _0x2ea2c5[_0x73ec('0x17')](_0x486104)[_0x73ec('0x19')](_0x367ce8);}};}function respondWithFilteredResult(_0x2b5c88,_0x3cef39){return function(_0x5284cf){if(_0x5284cf){var _0x35c4a0=_0x5284cf[_0x73ec('0x1a')],_0x5606d5=_0x3cef39[_0x73ec('0x1b')],_0x5a27ad=_0x3cef39[_0x73ec('0x1b')]+_0x3cef39['limit'],_0x19f738;if(_0x5a27ad>=_0x35c4a0){_0x5a27ad=_0x35c4a0;_0x19f738=0xc8;}else{_0x19f738=0xce;}_0x2b5c88['status'](_0x19f738);return _0x2b5c88[_0x73ec('0x1c')](_0x73ec('0x1d'),_0x5606d5+'-'+_0x5a27ad+'/'+_0x35c4a0)[_0x73ec('0x19')](_0x5284cf);}return null;};}function patchUpdates(_0x49e63a){return function(_0x89100b){try{jsonpatch[_0x73ec('0x1e')](_0x89100b,_0x49e63a,!![]);}catch(_0x354232){return BPromise['reject'](_0x354232);}return _0x89100b[_0x73ec('0x1f')]();};}function saveUpdates(_0x515ac3,_0x4ec943){return function(_0xf0ea3e){if(_0xf0ea3e){return _0xf0ea3e[_0x73ec('0x20')](_0x515ac3)[_0x73ec('0x21')](function(_0x57dbf9){return _0x57dbf9;});}return null;};}function removeEntity(_0x336110,_0x306084){return function(_0xd9bb9d){if(_0xd9bb9d){return _0xd9bb9d[_0x73ec('0x22')]()[_0x73ec('0x21')](function(){_0x336110['status'](0xcc)[_0x73ec('0x18')]();});}};}function handleEntityNotFound(_0x4a709b,_0xe1457a){return function(_0x453ad4){if(!_0x453ad4){_0x4a709b['sendStatus'](0x194);}return _0x453ad4;};}function handleError(_0x48b261,_0x41f7d3){_0x41f7d3=_0x41f7d3||0x1f4;return function(_0x5dc495){logger[_0x73ec('0x23')](_0x5dc495['stack']);if(_0x5dc495[_0x73ec('0x24')]){delete _0x5dc495['name'];}_0x48b261[_0x73ec('0x17')](_0x41f7d3)['send'](_0x5dc495);};}exports[_0x73ec('0x25')]=function(_0x5898a6,_0x198026){var _0x5bed3f={'raw':!![],'where':{'id':_0x5898a6[_0x73ec('0x26')]['id']}},_0x343fe0={};_0x343fe0['model']=_[_0x73ec('0x27')](db[_0x73ec('0x28')]['rawAttributes']);_0x343fe0[_0x73ec('0x29')]=_[_0x73ec('0x27')](_0x5898a6['query']);_0x343fe0[_0x73ec('0x2a')]=_[_0x73ec('0x2b')](_0x343fe0[_0x73ec('0x2c')],_0x343fe0['query']);_0x5bed3f[_0x73ec('0x2d')]=_[_0x73ec('0x2b')](_0x343fe0[_0x73ec('0x2c')],qs['fields'](_0x5898a6[_0x73ec('0x29')]['fields']));_0x5bed3f[_0x73ec('0x2d')]=_0x5bed3f[_0x73ec('0x2d')][_0x73ec('0x2e')]?_0x5bed3f[_0x73ec('0x2d')]:_0x343fe0[_0x73ec('0x2c')];if(_0x5898a6[_0x73ec('0x29')][_0x73ec('0x2f')]){_0x5bed3f[_0x73ec('0x30')]=[{'all':!![]}];}_0x5bed3f=_[_0x73ec('0x31')]({},_0x5bed3f,_0x5898a6['options']);return db[_0x73ec('0x28')][_0x73ec('0x32')](_0x5bed3f)[_0x73ec('0x21')](handleEntityNotFound(_0x198026,null))[_0x73ec('0x21')](respondWithResult(_0x198026,null))[_0x73ec('0x33')](handleError(_0x198026,null));};exports[_0x73ec('0x34')]=function(_0x3583ad,_0x196123){return db[_0x73ec('0x28')][_0x73ec('0x34')](_0x3583ad[_0x73ec('0x35')],{})[_0x73ec('0x21')](respondWithResult(_0x196123,0xc9))[_0x73ec('0x33')](handleError(_0x196123,null));};exports[_0x73ec('0x20')]=function(_0x3ca458,_0x41c5e9){if(_0x3ca458[_0x73ec('0x35')]['id']){delete _0x3ca458[_0x73ec('0x35')]['id'];}return db[_0x73ec('0x28')][_0x73ec('0x32')]({'where':{'id':_0x3ca458[_0x73ec('0x26')]['id']}})['then'](handleEntityNotFound(_0x41c5e9,null))[_0x73ec('0x21')](saveUpdates(_0x3ca458['body'],null))[_0x73ec('0x21')](respondWithResult(_0x41c5e9,null))['catch'](handleError(_0x41c5e9,null));};exports[_0x73ec('0x22')]=function(_0x3b589c,_0xeb531e){return db[_0x73ec('0x28')][_0x73ec('0x32')]({'where':{'id':_0x3b589c[_0x73ec('0x26')]['id']}})[_0x73ec('0x21')](handleEntityNotFound(_0xeb531e,null))[_0x73ec('0x21')](removeEntity(_0xeb531e,null))[_0x73ec('0x33')](handleError(_0xeb531e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 783e2c0..182b68c 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 _0xb90e=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x2652ac,_0x43e7c6){var _0x47998c=function(_0x20d03d){while(--_0x20d03d){_0x2652ac['push'](_0x2652ac['shift']());}};_0x47998c(++_0x43e7c6);}(_0xb90e,0x1d3));var _0xeb90=function(_0x59531d,_0x1a72de){_0x59531d=_0x59531d-0x0;var _0xa66105=_0xb90e[_0x59531d];return _0xa66105;};'use strict';var _=require(_0xeb90('0x0'));var util=require(_0xeb90('0x1'));var logger=require('../../config/logger')(_0xeb90('0x2'));var moment=require(_0xeb90('0x3'));var BPromise=require(_0xeb90('0x4'));var rp=require(_0xeb90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb90('0x6'));var config=require(_0xeb90('0x7'));var attributes=require(_0xeb90('0x8'));module[_0xeb90('0x9')]=function(_0x50788d,_0x3c4d4c){return _0x50788d[_0xeb90('0xa')](_0xeb90('0xb'),attributes,{'tableName':_0xeb90('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ae9=['bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x228cdf,_0x219390){var _0x5251ac=function(_0x1a7c32){while(--_0x1a7c32){_0x228cdf['push'](_0x228cdf['shift']());}};_0x5251ac(++_0x219390);}(_0x9ae9,0xd1));var _0x99ae=function(_0x251bdf,_0x5187d4){_0x251bdf=_0x251bdf-0x0;var _0x5b5d7f=_0x9ae9[_0x251bdf];return _0x5b5d7f;};'use strict';var _=require(_0x99ae('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x99ae('0x1'));var rp=require(_0x99ae('0x2'));var fs=require('fs');var path=require(_0x99ae('0x3'));var rimraf=require(_0x99ae('0x4'));var config=require('../../config/environment');var attributes=require(_0x99ae('0x5'));module[_0x99ae('0x6')]=function(_0x75a771,_0x40dddc){return _0x75a771[_0x99ae('0x7')](_0x99ae('0x8'),attributes,{'tableName':_0x99ae('0x9'),'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 490ca57..8f9c83e 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 _0xedd8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3b0b07,_0xc927c6){var _0x198e38=function(_0x19377d){while(--_0x19377d){_0x3b0b07['push'](_0x3b0b07['shift']());}};_0x198e38(++_0xc927c6);}(_0xedd8,0x10c));var _0x8edd=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xedd8[_0x4715d2];return _0x141811;};'use strict';var _=require(_0x8edd('0x0'));var util=require(_0x8edd('0x1'));var moment=require(_0x8edd('0x2'));var BPromise=require(_0x8edd('0x3'));var rs=require(_0x8edd('0x4'));var fs=require('fs');var Redis=require(_0x8edd('0x5'));var db=require(_0x8edd('0x6'))['db'];var utils=require(_0x8edd('0x7'));var logger=require(_0x8edd('0x8'))(_0x8edd('0x9'));var config=require(_0x8edd('0xa'));var jayson=require(_0x8edd('0xb'));var client=jayson[_0x8edd('0xc')][_0x8edd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42bc6b,_0xfb7477,_0x29d7d3){return new BPromise(function(_0x5b6e01,_0x5ef40b){return client[_0x8edd('0xe')](_0x42bc6b,_0x29d7d3)['then'](function(_0x3bf679){logger[_0x8edd('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0xfb7477,_0x8edd('0x10'));logger['debug'](_0x8edd('0x11'),_0xfb7477,'request\x20sent',JSON['stringify'](_0x3bf679));if(_0x3bf679[_0x8edd('0x12')]){if(_0x3bf679[_0x8edd('0x12')][_0x8edd('0x13')]===0x1f4){logger[_0x8edd('0x12')](_0x8edd('0x14'),_0xfb7477,_0x3bf679[_0x8edd('0x12')][_0x8edd('0x15')]);return _0x5ef40b(_0x3bf679[_0x8edd('0x12')]['message']);}logger[_0x8edd('0x12')](_0x8edd('0x14'),_0xfb7477,_0x3bf679['error'][_0x8edd('0x15')]);return _0x5b6e01(_0x3bf679['error'][_0x8edd('0x15')]);}else{logger[_0x8edd('0xf')](_0x8edd('0x14'),_0xfb7477,_0x8edd('0x10'));_0x5b6e01(_0x3bf679['result'][_0x8edd('0x15')]);}})[_0x8edd('0x16')](function(_0x34ca06){logger[_0x8edd('0x12')](_0x8edd('0x14'),_0xfb7477,_0x34ca06);_0x5ef40b(_0x34ca06);});});} \ No newline at end of file +var _0x1af1=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','moment'];(function(_0x1ea230,_0x4258d6){var _0xdd7f44=function(_0x4fca65){while(--_0x4fca65){_0x1ea230['push'](_0x1ea230['shift']());}};_0xdd7f44(++_0x4258d6);}(_0x1af1,0x18f));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11af('0x0'));var BPromise=require(_0x11af('0x1'));var rs=require(_0x11af('0x2'));var fs=require('fs');var Redis=require(_0x11af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x11af('0x4'));var logger=require('../../config/logger')(_0x11af('0x5'));var config=require(_0x11af('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x11af('0x7')][_0x11af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23c8be,_0x5ec933,_0x3bf0d0){return new BPromise(function(_0x29882e,_0x2a110c){return client[_0x11af('0x9')](_0x23c8be,_0x3bf0d0)[_0x11af('0xa')](function(_0x4bed9c){logger[_0x11af('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ec933,_0x11af('0xc'));logger[_0x11af('0xd')](_0x11af('0xe'),_0x5ec933,_0x11af('0xc'),JSON[_0x11af('0xf')](_0x4bed9c));if(_0x4bed9c[_0x11af('0x10')]){if(_0x4bed9c[_0x11af('0x10')][_0x11af('0x11')]===0x1f4){logger[_0x11af('0x10')](_0x11af('0x12'),_0x5ec933,_0x4bed9c[_0x11af('0x10')][_0x11af('0x13')]);return _0x2a110c(_0x4bed9c[_0x11af('0x10')][_0x11af('0x13')]);}logger['error'](_0x11af('0x12'),_0x5ec933,_0x4bed9c[_0x11af('0x10')][_0x11af('0x13')]);return _0x29882e(_0x4bed9c[_0x11af('0x10')][_0x11af('0x13')]);}else{logger[_0x11af('0xb')](_0x11af('0x12'),_0x5ec933,_0x11af('0xc'));_0x29882e(_0x4bed9c['result'][_0x11af('0x13')]);}})['catch'](function(_0x116d8c){logger[_0x11af('0x10')](_0x11af('0x12'),_0x5ec933,_0x116d8c);_0x2a110c(_0x116d8c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index bcad6f9..098529f 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 _0x2c59=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','connect-timeout','Router'];(function(_0x40b457,_0x3e178f){var _0x199b0d=function(_0x143cf5){while(--_0x143cf5){_0x40b457['push'](_0x40b457['shift']());}};_0x199b0d(++_0x3e178f);}(_0x2c59,0x1e9));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x92c5('0x0'));var util=require(_0x92c5('0x1'));var path=require('path');var timeout=require(_0x92c5('0x2'));var express=require('express');var router=express[_0x92c5('0x3')]();var auth=require(_0x92c5('0x4'));var interaction=require(_0x92c5('0x5'));var config=require(_0x92c5('0x6'));var controller=require(_0x92c5('0x7'));router[_0x92c5('0x8')](_0x92c5('0x9'),auth[_0x92c5('0xa')](),controller[_0x92c5('0xb')]);router[_0x92c5('0xc')]('/',auth[_0x92c5('0xa')](),controller[_0x92c5('0xd')]);router['put'](_0x92c5('0x9'),auth[_0x92c5('0xa')](),controller[_0x92c5('0xe')]);router[_0x92c5('0xf')](_0x92c5('0x9'),auth['isAuthenticated'](),controller[_0x92c5('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2e65=['isAuthenticated','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x2e65,0x193));var _0x52e6=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x2e65[_0x1bc013];return _0x55df36;};'use strict';var multer=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var path=require(_0x52e6('0x2'));var timeout=require(_0x52e6('0x3'));var express=require(_0x52e6('0x4'));var router=express[_0x52e6('0x5')]();var auth=require(_0x52e6('0x6'));var interaction=require(_0x52e6('0x7'));var config=require('../../config/environment');var controller=require(_0x52e6('0x8'));router[_0x52e6('0x9')](_0x52e6('0xa'),auth[_0x52e6('0xb')](),controller[_0x52e6('0xc')]);router[_0x52e6('0xd')]('/',auth[_0x52e6('0xb')](),controller[_0x52e6('0xe')]);router[_0x52e6('0xf')](_0x52e6('0xa'),auth['isAuthenticated'](),controller[_0x52e6('0x10')]);router[_0x52e6('0x11')]('/:id',auth[_0x52e6('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 04e562b..361165a 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 _0xc2fa=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0xa7fb1f,_0x1c49bc){var _0x32e057=function(_0x311d89){while(--_0x311d89){_0xa7fb1f['push'](_0xa7fb1f['shift']());}};_0x32e057(++_0x1c49bc);}(_0xc2fa,0x83));var _0xac2f=function(_0x3551b5,_0xeaaa70){_0x3551b5=_0x3551b5-0x0;var _0x38346a=_0xc2fa[_0x3551b5];return _0x38346a;};'use strict';var Sequelize=require(_0xac2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xac2f('0x1')],'unique':_0xac2f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xac2f('0x1')]},'timeout':{'type':Sequelize[_0xac2f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xac2f('0x4')](_0xac2f('0x5'),_0xac2f('0x6'),_0xac2f('0x7'))}}; \ No newline at end of file +var _0xc257=['beepall','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x4d2ec1,_0x470a0a){var _0x17ad5f=function(_0x1ea488){while(--_0x1ea488){_0x4d2ec1['push'](_0x4d2ec1['shift']());}};_0x17ad5f(++_0x470a0a);}(_0xc257,0x197));var _0x7c25=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc257[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x7c25('0x0'));module[_0x7c25('0x1')]={'name':{'type':Sequelize[_0x7c25('0x2')],'unique':_0x7c25('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7c25('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c25('0x4')](_0x7c25('0x5'),_0x7c25('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 42f573d..8794673 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 _0x1ba0=['toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','ChatQueue','findAll','rows','show','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','pick','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x591272,_0x226635){var _0x468d1c=function(_0x6e63a1){while(--_0x6e63a1){_0x591272['push'](_0x591272['shift']());}};_0x468d1c(++_0x226635);}(_0x1ba0,0x1f4));var _0x01ba=function(_0x452abc,_0x36b295){_0x452abc=_0x452abc-0x0;var _0x4b6bb5=_0x1ba0[_0x452abc];return _0x4b6bb5;};'use strict';var pdf=require(_0x01ba('0x0'));var emlformat=require(_0x01ba('0x1'));var rimraf=require(_0x01ba('0x2'));var zipdir=require(_0x01ba('0x3'));var jsonpatch=require(_0x01ba('0x4'));var rp=require(_0x01ba('0x5'));var moment=require(_0x01ba('0x6'));var BPromise=require(_0x01ba('0x7'));var Mustache=require(_0x01ba('0x8'));var util=require(_0x01ba('0x9'));var path=require(_0x01ba('0xa'));var sox=require(_0x01ba('0xb'));var csv=require(_0x01ba('0xc'));var ejs=require(_0x01ba('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01ba('0xe'));var crypto=require(_0x01ba('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x01ba('0x10'));var toCsv=require(_0x01ba('0xc'));var querystring=require(_0x01ba('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x01ba('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x01ba('0x13'));var hardwareService=require(_0x01ba('0x14'));var logger=require(_0x01ba('0x15'))(_0x01ba('0x16'));var utils=require(_0x01ba('0x17'));var config=require(_0x01ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x01ba('0x19'))['db'];config[_0x01ba('0x1a')]=_[_0x01ba('0x1b')](config['redis'],{'host':_0x01ba('0x1c'),'port':0x18eb});var socket=require(_0x01ba('0x1d'))(new Redis(config[_0x01ba('0x1a')]));require(_0x01ba('0x1e'))[_0x01ba('0x1f')](socket);var jayson=require(_0x01ba('0x20'));var client=jayson['client'][_0x01ba('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5a6631,_0x23684b,_0xd470b3,_0x579582){return new BPromise(function(_0x2e71db,_0x1e004c){var _0x468ccc=_0x579582||client;return _0x468ccc[_0x01ba('0x22')](_0x5a6631,_0xd470b3)[_0x01ba('0x23')](function(_0x15defe){logger[_0x01ba('0x24')](_0x01ba('0x25'),_0x23684b,_0x01ba('0x26'));logger[_0x01ba('0x27')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x23684b,_0x01ba('0x26'),JSON[_0x01ba('0x28')](_0x15defe));if(_0x15defe[_0x01ba('0x29')]){if(_0x15defe[_0x01ba('0x29')][_0x01ba('0x2a')]===0x1f4){logger[_0x01ba('0x29')](_0x01ba('0x25'),_0x23684b,_0x15defe[_0x01ba('0x29')][_0x01ba('0x2b')]);return _0x1e004c(_0x15defe[_0x01ba('0x29')]['message']);}logger[_0x01ba('0x29')]('ChatQueue,\x20%s,\x20%s',_0x23684b,_0x15defe[_0x01ba('0x29')][_0x01ba('0x2b')]);return _0x2e71db(_0x15defe[_0x01ba('0x29')][_0x01ba('0x2b')]);}else{logger['info'](_0x01ba('0x25'),_0x23684b,_0x01ba('0x26'));_0x2e71db(_0x15defe[_0x01ba('0x2c')][_0x01ba('0x2b')]);}})[_0x01ba('0x2d')](function(_0x35a3f0){logger[_0x01ba('0x29')](_0x01ba('0x25'),_0x23684b,_0x35a3f0);_0x1e004c(_0x35a3f0);});});}function respondWithStatusCode(_0x3f5dbc,_0x567190){_0x567190=_0x567190||0xcc;return function(_0x2370e1){if(_0x2370e1){return _0x3f5dbc[_0x01ba('0x2e')](_0x567190);}return _0x3f5dbc['status'](_0x567190)[_0x01ba('0x2f')]();};}function respondWithResult(_0x319d6a,_0x5762f0){_0x5762f0=_0x5762f0||0xc8;return function(_0x4c6b1d){if(_0x4c6b1d){return _0x319d6a[_0x01ba('0x30')](_0x5762f0)[_0x01ba('0x31')](_0x4c6b1d);}};}function respondWithFilteredResult(_0x7758e,_0x15849e){return function(_0x132755){if(_0x132755){var _0x4676f2=_0x132755[_0x01ba('0x32')],_0x95780f=_0x15849e[_0x01ba('0x33')],_0x31c615=_0x15849e[_0x01ba('0x33')]+_0x15849e[_0x01ba('0x34')],_0x13b22e;if(_0x31c615>=_0x4676f2){_0x31c615=_0x4676f2;_0x13b22e=0xc8;}else{_0x13b22e=0xce;}_0x7758e[_0x01ba('0x30')](_0x13b22e);return _0x7758e[_0x01ba('0x35')]('Content-Range',_0x95780f+'-'+_0x31c615+'/'+_0x4676f2)[_0x01ba('0x31')](_0x132755);}return null;};}function patchUpdates(_0x52e357){return function(_0x582502){try{jsonpatch[_0x01ba('0x36')](_0x582502,_0x52e357,!![]);}catch(_0x27b023){return BPromise[_0x01ba('0x37')](_0x27b023);}return _0x582502[_0x01ba('0x38')]();};}function saveUpdates(_0x9cc714,_0xe9a512){return function(_0x1c27ff){if(_0x1c27ff){return _0x1c27ff[_0x01ba('0x39')](_0x9cc714)[_0x01ba('0x23')](function(_0x28639e){return _0x28639e;});}return null;};}function removeEntity(_0xd1ea8d,_0x4ddaf7){return function(_0x161f44){if(_0x161f44){return _0x161f44[_0x01ba('0x3a')]()[_0x01ba('0x23')](function(){var _0x112ce5=_0x161f44[_0x01ba('0x3b')]({'plain':!![]});var _0x2e18b5=_0x01ba('0x3c');return db[_0x01ba('0x3d')][_0x01ba('0x3a')]({'where':{'type':_0x2e18b5,'resourceId':_0x112ce5['id']}})['then'](function(){return _0x161f44;});})[_0x01ba('0x23')](function(){_0xd1ea8d[_0x01ba('0x30')](0xcc)[_0x01ba('0x2f')]();});}};}function handleEntityNotFound(_0x1196e5,_0x1b8ef4){return function(_0x1b0d84){if(!_0x1b0d84){_0x1196e5['sendStatus'](0x194);}return _0x1b0d84;};}function handleError(_0x465cfd,_0x44713d){_0x44713d=_0x44713d||0x1f4;return function(_0x1e5ed2){logger[_0x01ba('0x29')](_0x1e5ed2[_0x01ba('0x3e')]);if(_0x1e5ed2[_0x01ba('0x3f')]){delete _0x1e5ed2[_0x01ba('0x3f')];}_0x465cfd['status'](_0x44713d)[_0x01ba('0x40')](_0x1e5ed2);};}exports[_0x01ba('0x41')]=function(_0x36b19f,_0x1907dd){var _0xf4e31d={},_0x3b0bcf={},_0x2ebd16={'count':0x0,'rows':[]};var _0x201662=_[_0x01ba('0x42')](db['ChatQueue'][_0x01ba('0x43')],function(_0x57243c){return{'name':_0x57243c['fieldName'],'type':_0x57243c[_0x01ba('0x44')][_0x01ba('0x45')]};});_0x3b0bcf[_0x01ba('0x46')]=_['map'](_0x201662,'name');_0x3b0bcf[_0x01ba('0x47')]=_[_0x01ba('0x48')](_0x36b19f[_0x01ba('0x47')]);_0x3b0bcf[_0x01ba('0x49')]=_[_0x01ba('0x4a')](_0x3b0bcf['model'],_0x3b0bcf[_0x01ba('0x47')]);_0xf4e31d[_0x01ba('0x4b')]=_['intersection'](_0x3b0bcf[_0x01ba('0x46')],qs[_0x01ba('0x4c')](_0x36b19f[_0x01ba('0x47')]['fields']));_0xf4e31d['attributes']=_0xf4e31d[_0x01ba('0x4b')][_0x01ba('0x4d')]?_0xf4e31d[_0x01ba('0x4b')]:_0x3b0bcf[_0x01ba('0x46')];if(!_0x36b19f[_0x01ba('0x47')][_0x01ba('0x4e')](_0x01ba('0x4f'))){_0xf4e31d[_0x01ba('0x34')]=qs[_0x01ba('0x34')](_0x36b19f['query'][_0x01ba('0x34')]);_0xf4e31d[_0x01ba('0x33')]=qs[_0x01ba('0x33')](_0x36b19f[_0x01ba('0x47')]['offset']);}_0xf4e31d[_0x01ba('0x50')]=qs[_0x01ba('0x51')](_0x36b19f[_0x01ba('0x47')]['sort']);_0xf4e31d['where']=qs[_0x01ba('0x49')](_['pick'](_0x36b19f[_0x01ba('0x47')],_0x3b0bcf[_0x01ba('0x49')]),_0x201662);if(_0x36b19f[_0x01ba('0x47')][_0x01ba('0x52')]){_0xf4e31d[_0x01ba('0x53')]=_[_0x01ba('0x54')](_0xf4e31d[_0x01ba('0x53')],{'$or':_['map'](_0x201662,function(_0xb0ec81){if(_0xb0ec81['type']!==_0x01ba('0x55')){var _0x46c8f1={};_0x46c8f1[_0xb0ec81['name']]={'$like':'%'+_0x36b19f[_0x01ba('0x47')][_0x01ba('0x52')]+'%'};return _0x46c8f1;}})});}_0xf4e31d=_[_0x01ba('0x54')]({},_0xf4e31d,_0x36b19f[_0x01ba('0x56')]);var _0x53b631={'where':_0xf4e31d[_0x01ba('0x53')]};return db['ChatQueue']['count'](_0x53b631)[_0x01ba('0x23')](function(_0x51a006){_0x2ebd16['count']=_0x51a006;if(_0x36b19f['query']['includeAll']){_0xf4e31d[_0x01ba('0x57')]=[{'all':!![]}];}return db[_0x01ba('0x58')][_0x01ba('0x59')](_0xf4e31d);})[_0x01ba('0x23')](function(_0x367c21){_0x2ebd16[_0x01ba('0x5a')]=_0x367c21;return _0x2ebd16;})[_0x01ba('0x23')](respondWithFilteredResult(_0x1907dd,_0xf4e31d))[_0x01ba('0x2d')](handleError(_0x1907dd,null));};exports[_0x01ba('0x5b')]=function(_0x553239,_0x238a22){var _0x5d9488={'raw':!![],'where':{'id':_0x553239[_0x01ba('0x5c')]['id']}},_0x1e2bb9={};_0x1e2bb9[_0x01ba('0x46')]=_[_0x01ba('0x48')](db[_0x01ba('0x58')][_0x01ba('0x43')]);_0x1e2bb9[_0x01ba('0x47')]=_[_0x01ba('0x48')](_0x553239['query']);_0x1e2bb9['filters']=_[_0x01ba('0x4a')](_0x1e2bb9['model'],_0x1e2bb9[_0x01ba('0x47')]);_0x5d9488[_0x01ba('0x4b')]=_[_0x01ba('0x4a')](_0x1e2bb9[_0x01ba('0x46')],qs['fields'](_0x553239[_0x01ba('0x47')]['fields']));_0x5d9488[_0x01ba('0x4b')]=_0x5d9488[_0x01ba('0x4b')][_0x01ba('0x4d')]?_0x5d9488[_0x01ba('0x4b')]:_0x1e2bb9[_0x01ba('0x46')];if(_0x553239[_0x01ba('0x47')][_0x01ba('0x5d')]){_0x5d9488[_0x01ba('0x57')]=[{'all':!![]}];}_0x5d9488=_['merge']({},_0x5d9488,_0x553239[_0x01ba('0x56')]);return db['ChatQueue']['find'](_0x5d9488)['then'](handleEntityNotFound(_0x238a22,null))[_0x01ba('0x23')](respondWithResult(_0x238a22,null))['catch'](handleError(_0x238a22,null));};exports[_0x01ba('0x5e')]=function(_0x1704fb,_0x57fdf0){return db['ChatQueue'][_0x01ba('0x5e')](_0x1704fb['body'],{})['then'](function(_0x342aa0){var _0x4efa68=_0x1704fb[_0x01ba('0x5f')][_0x01ba('0x3b')]({'plain':!![]});if(!_0x4efa68)throw new Error(_0x01ba('0x60'));if(_0x4efa68[_0x01ba('0x61')]===_0x01ba('0x5f')){var _0x323536=_0x342aa0[_0x01ba('0x3b')]({'plain':!![]});var _0x44541d='ChatQueues';return db[_0x01ba('0x62')][_0x01ba('0x63')]({'where':{'name':_0x44541d,'userProfileId':_0x4efa68[_0x01ba('0x64')]},'raw':!![]})['then'](function(_0x30485b){if(_0x30485b&&_0x30485b[_0x01ba('0x65')]===0x0){return db['UserProfileResource'][_0x01ba('0x5e')]({'name':_0x323536['name'],'resourceId':_0x323536['id'],'type':_0x30485b['name'],'sectionId':_0x30485b['id']},{})[_0x01ba('0x23')](function(){return _0x342aa0;});}else{return _0x342aa0;}})[_0x01ba('0x2d')](function(_0x791a00){logger['error'](_0x01ba('0x66'),_0x791a00);throw _0x791a00;});}return _0x342aa0;})['then'](respondWithResult(_0x57fdf0,0xc9))[_0x01ba('0x2d')](handleError(_0x57fdf0,null));};exports['update']=function(_0x2e3c1c,_0x466e22){if(_0x2e3c1c[_0x01ba('0x67')]['id']){delete _0x2e3c1c[_0x01ba('0x67')]['id'];}return db[_0x01ba('0x58')][_0x01ba('0x63')]({'where':{'id':_0x2e3c1c[_0x01ba('0x5c')]['id']}})[_0x01ba('0x23')](handleEntityNotFound(_0x466e22,null))[_0x01ba('0x23')](saveUpdates(_0x2e3c1c['body'],null))[_0x01ba('0x23')](respondWithResult(_0x466e22,null))['catch'](handleError(_0x466e22,null));};exports[_0x01ba('0x3a')]=function(_0x2821d5,_0x2a5343){return db[_0x01ba('0x58')][_0x01ba('0x63')]({'where':{'id':_0x2821d5[_0x01ba('0x5c')]['id']}})[_0x01ba('0x23')](handleEntityNotFound(_0x2a5343,null))[_0x01ba('0x23')](removeEntity(_0x2a5343,null))['catch'](handleError(_0x2a5343,null));};exports[_0x01ba('0x68')]=function(_0xe522d9,_0x1c55b8){return db[_0x01ba('0x58')][_0x01ba('0x68')]()[_0x01ba('0x23')](respondWithResult(_0x1c55b8,null))[_0x01ba('0x2d')](handleError(_0x1c55b8,null));};exports[_0x01ba('0x69')]=function(_0x3bea82,_0x4c205c,_0x263d61){var _0x12e549={'raw':!![],'where':{}},_0x207cb2={},_0x4e6c0c;return db['ChatQueue'][_0x01ba('0x6a')]({'where':{'id':_0x3bea82[_0x01ba('0x5c')]['id']}})[_0x01ba('0x23')](handleEntityNotFound(_0x4c205c,null))['then'](function(_0x13fee9){if(_0x13fee9){_0x4e6c0c=_0x13fee9[_0x01ba('0x3b')]({'plain':!![]});_0x207cb2[_0x01ba('0x46')]=_['keys'](db['UserChatQueue'][_0x01ba('0x43')]);_0x207cb2[_0x01ba('0x47')]=_[_0x01ba('0x48')](_0x3bea82[_0x01ba('0x47')]);_0x207cb2[_0x01ba('0x49')]=_[_0x01ba('0x4a')](_0x207cb2[_0x01ba('0x46')],_0x207cb2[_0x01ba('0x47')]);_0x12e549[_0x01ba('0x4b')]=_['intersection'](_0x207cb2[_0x01ba('0x46')],qs[_0x01ba('0x4c')](_0x3bea82['query'][_0x01ba('0x4c')]));_0x12e549['attributes']=_0x12e549['attributes'][_0x01ba('0x4d')]?_0x12e549['attributes']:_0x207cb2[_0x01ba('0x46')];if(!_0x3bea82[_0x01ba('0x47')]['hasOwnProperty'](_0x01ba('0x4f'))){_0x12e549[_0x01ba('0x34')]=qs[_0x01ba('0x34')](_0x3bea82[_0x01ba('0x47')]['limit']);_0x12e549['offset']=qs[_0x01ba('0x33')](_0x3bea82['query'][_0x01ba('0x33')]);}_0x12e549[_0x01ba('0x50')]=qs[_0x01ba('0x51')](_0x3bea82['query']['sort']);_0x12e549[_0x01ba('0x53')]=qs[_0x01ba('0x49')](_[_0x01ba('0x6b')](_0x3bea82[_0x01ba('0x47')],_0x207cb2[_0x01ba('0x49')]));_0x12e549[_0x01ba('0x53')][_0x01ba('0x6c')]=_0x13fee9['id'];if(_0x3bea82[_0x01ba('0x47')][_0x01ba('0x52')]){_0x12e549['where']=_[_0x01ba('0x54')](_0x12e549[_0x01ba('0x53')],{'$or':_['map'](_0x12e549[_0x01ba('0x4b')],function(_0x54608e){var _0x45be92={};_0x45be92[_0x54608e]={'$like':'%'+_0x3bea82[_0x01ba('0x47')][_0x01ba('0x52')]+'%'};return _0x45be92;})});}_0x12e549=_['merge']({},_0x12e549,_0x3bea82[_0x01ba('0x56')]);return db[_0x01ba('0x6d')][_0x01ba('0x59')](_0x12e549);}})[_0x01ba('0x23')](function(_0x31a469){if(_0x31a469){return db[_0x01ba('0x6e')][_0x01ba('0x6f')]({'where':{'id':_[_0x01ba('0x42')](_0x31a469,_0x01ba('0x70')),'role':_0x01ba('0x71')},'attributes':['id',_0x01ba('0x3f'),_0x01ba('0x72'),_0x01ba('0x73'),_0x01ba('0x74')]});}})[_0x01ba('0x23')](function(_0x349f32){if(_0x349f32){return{'count':_0x349f32[_0x01ba('0x32')],'rows':_[_0x01ba('0x42')](_0x349f32[_0x01ba('0x5a')],function(_0x4ab1e4){return{'membername':_0x4ab1e4[_0x01ba('0x3f')],'UserId':_0x4ab1e4['id'],'queue_name':_0x4e6c0c['name'],'ChatQueueId':_0x4e6c0c['id'],'interface':util[_0x01ba('0x75')]('%s/%s',_0x01ba('0x76'),_0x4ab1e4[_0x01ba('0x3f')]),'penalty':0x0,'paused':_0x4ab1e4[_0x01ba('0x72')],'createdAt':_0x4ab1e4[_0x01ba('0x74')],'updatedAt':_0x4ab1e4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x01ba('0x23')](respondWithFilteredResult(_0x4c205c,_0x12e549))[_0x01ba('0x2d')](handleError(_0x4c205c,null));};exports[_0x01ba('0x77')]=function(_0x521da5,_0x1555e6,_0x4eb079){var _0x1fdf1d={};var _0xe343c3={};var _0x12d41a;var _0x31c878;return db[_0x01ba('0x58')][_0x01ba('0x6a')]({'where':{'id':_0x521da5[_0x01ba('0x5c')]['id']}})[_0x01ba('0x23')](handleEntityNotFound(_0x1555e6,null))[_0x01ba('0x23')](function(_0x2b5398){if(_0x2b5398){_0x12d41a=_0x2b5398;_0xe343c3['model']=_['keys'](db['Team'][_0x01ba('0x43')]);_0xe343c3[_0x01ba('0x47')]=_['keys'](_0x521da5[_0x01ba('0x47')]);_0xe343c3[_0x01ba('0x49')]=_['intersection'](_0xe343c3[_0x01ba('0x46')],_0xe343c3[_0x01ba('0x47')]);_0x1fdf1d[_0x01ba('0x4b')]=_['intersection'](_0xe343c3[_0x01ba('0x46')],qs['fields'](_0x521da5[_0x01ba('0x47')][_0x01ba('0x4c')]));_0x1fdf1d['attributes']=_0x1fdf1d['attributes'][_0x01ba('0x4d')]?_0x1fdf1d[_0x01ba('0x4b')]:_0xe343c3[_0x01ba('0x46')];_0x1fdf1d['order']=qs[_0x01ba('0x51')](_0x521da5[_0x01ba('0x47')][_0x01ba('0x51')]);_0x1fdf1d[_0x01ba('0x53')]=qs[_0x01ba('0x49')](_['pick'](_0x521da5['query'],_0xe343c3[_0x01ba('0x49')]));if(_0x521da5[_0x01ba('0x47')][_0x01ba('0x52')]){_0x1fdf1d[_0x01ba('0x53')]=_[_0x01ba('0x54')](_0x1fdf1d['where'],{'$or':_[_0x01ba('0x42')](_0x1fdf1d[_0x01ba('0x4b')],function(_0x231970){var _0x4f86b2={};_0x4f86b2[_0x231970]={'$like':'%'+_0x521da5[_0x01ba('0x47')][_0x01ba('0x52')]+'%'};return _0x4f86b2;})});}_0x1fdf1d=_[_0x01ba('0x54')]({},_0x1fdf1d,_0x521da5[_0x01ba('0x56')]);return _0x12d41a[_0x01ba('0x77')](_0x1fdf1d);}})[_0x01ba('0x23')](function(_0xa41f15){if(_0xa41f15){_0x31c878=_0xa41f15[_0x01ba('0x4d')];if(!_0x521da5[_0x01ba('0x47')]['hasOwnProperty'](_0x01ba('0x4f'))){_0x1fdf1d['limit']=qs[_0x01ba('0x34')](_0x521da5['query'][_0x01ba('0x34')]);_0x1fdf1d[_0x01ba('0x33')]=qs[_0x01ba('0x33')](_0x521da5['query'][_0x01ba('0x33')]);}return _0x12d41a['getTeams'](_0x1fdf1d);}})[_0x01ba('0x23')](function(_0x4a0251){if(_0x4a0251){return _0x4a0251?{'count':_0x31c878,'rows':_0x4a0251}:null;}})[_0x01ba('0x23')](respondWithResult(_0x1555e6,null))[_0x01ba('0x2d')](handleError(_0x1555e6,null));};exports[_0x01ba('0x78')]=function(_0x45d739,_0x5f0d61,_0x2083c9){var _0xeeea59=_0x45d739['body'][_0x01ba('0x79')];return db[_0x01ba('0x7a')][_0x01ba('0x59')]({'where':{'id':_0xeeea59},'attributes':['id'],'include':[{'model':db[_0x01ba('0x6e')],'as':_0x01ba('0x7b'),'attributes':['id',_0x01ba('0x3f'),_0x01ba('0x7c'),_0x01ba('0x7d'),_0x01ba('0x7e')],'raw':!![]}]})[_0x01ba('0x23')](function(_0x521488){if(_0x521488){var _0x435562=_[_0x01ba('0x7f')](_0x521488,function(_0x4bd5ee){var _0x21ea6a=_0x4bd5ee[_0x01ba('0x3b')]({'plain':!![]});return _0x21ea6a['Agents'];});return db[_0x01ba('0x58')][_0x01ba('0x63')]({'where':{'id':_0x45d739[_0x01ba('0x5c')]['id']}})[_0x01ba('0x23')](function(_0x1e4fbe){return db[_0x01ba('0x80')][_0x01ba('0x81')](function(_0x5289fe){return _0x1e4fbe['addTeams'](_0xeeea59,{'transaction':_0x5289fe})[_0x01ba('0x23')](function(){return BPromise[_0x01ba('0x82')](_0x435562,function(_0xb45452){return db[_0x01ba('0x6d')][_0x01ba('0x83')]({'where':{'UserId':_0xb45452['id'],'ChatQueueId':_0x45d739[_0x01ba('0x5c')]['id']},'transaction':_0x5289fe});});})[_0x01ba('0x23')](function(){_0x435562[_0x01ba('0x84')](function(_0x16e958){socket['emit'](_0x01ba('0x85'),{'UserId':_0x16e958['id'],'ChatQueueId':_0x1e4fbe['id']});});});});});}})[_0x01ba('0x23')](respondWithStatusCode(_0x5f0d61,null))[_0x01ba('0x2d')](handleError(_0x5f0d61,null));};exports[_0x01ba('0x86')]=function(_0x41fabb,_0x4168d0,_0x3cab85){return db[_0x01ba('0x7a')]['findAll']({'where':{'id':_0x41fabb[_0x01ba('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0x01ba('0x6e')],'as':_0x01ba('0x7b'),'attributes':['id'],'raw':!![]}]})[_0x01ba('0x23')](handleEntityNotFound(_0x4168d0,null))[_0x01ba('0x23')](function(_0x246d52){var _0x4ea270=_['map'](_0x246d52,'id');var _0x42999b=[];var _0x36ddec=[];var _0x5b8483=squel['select']();_0x5b8483[_0x01ba('0x87')](_0x01ba('0x88'))['from'](_0x01ba('0x89'),'tq')[_0x01ba('0x8a')](_0x01ba('0x8b'),'ut',_0x01ba('0x8c'))[_0x01ba('0x53')](_0x01ba('0x8d'),_0x41fabb['params']['id']);for(var _0x397e27=0x0;_0x397e27<_0x246d52[_0x01ba('0x4d')];_0x397e27+=0x1){let _0x1784da=_0x246d52[_0x397e27];for(var _0x42851c=0x0;_0x42851c<_0x1784da[_0x01ba('0x7b')][_0x01ba('0x4d')];_0x42851c+=0x1){let _0x345291=_0x1784da['Agents'][_0x42851c];var _0x300cd6=_0x5b8483[_0x01ba('0x8e')]();_0x300cd6[_0x01ba('0x53')](_0x01ba('0x8f'),_0x345291['id']);_0x36ddec['push'](db[_0x01ba('0x80')][_0x01ba('0x47')](_0x300cd6[_0x01ba('0x90')](),{'type':db[_0x01ba('0x80')][_0x01ba('0x91')][_0x01ba('0x92')]})['then'](function(_0x393e44){if(_0x393e44['length']===0x1){return _0x345291['id'];}else{var _0x3da4e1=_[_0x01ba('0x93')](_[_0x01ba('0x42')](_0x393e44,'TeamId'),function(_0x243826){return _[_0x01ba('0x94')](_0x4ea270,_0x243826);});if(_0x3da4e1){return _0x345291['id'];}}}));}}return BPromise['all'](_0x36ddec)['then'](function(_0x38dd56){_0x42999b=_(_0x42999b)[_0x01ba('0x95')](_0x38dd56)[_0x01ba('0x96')]()[_0x01ba('0x97')]();return db['ChatQueue']['find']({'where':{'id':_0x41fabb[_0x01ba('0x5c')]['id']}})['then'](function(_0x2ff4b){return db['sequelize'][_0x01ba('0x81')](function(_0x1b2231){return _0x2ff4b[_0x01ba('0x86')](_0x41fabb[_0x01ba('0x47')][_0x01ba('0x79')],{'transaction':_0x1b2231})[_0x01ba('0x23')](function(){if(!_[_0x01ba('0x98')](_0x42999b)){return _0x2ff4b[_0x01ba('0x99')](_0x42999b,{'transaction':_0x1b2231});}})[_0x01ba('0x23')](function(){_0x42999b[_0x01ba('0x84')](function(_0x689c79){socket[_0x01ba('0x9a')](_0x01ba('0x9b'),{'UserId':_0x689c79,'ChatQueueId':_0x2ff4b['id']});});});});});});})[_0x01ba('0x23')](respondWithStatusCode(_0x4168d0,null))[_0x01ba('0x2d')](handleError(_0x4168d0,null));};exports[_0x01ba('0x9c')]=function(_0x413916,_0x30ea7d,_0x3cf528){return db[_0x01ba('0x58')][_0x01ba('0x63')]({'where':{'id':_0x413916[_0x01ba('0x5c')]['id']}})['then'](handleEntityNotFound(_0x30ea7d,null))[_0x01ba('0x23')](function(_0x14eaa1){if(_0x14eaa1){return _0x14eaa1[_0x01ba('0x9c')](_0x413916[_0x01ba('0x67')][_0x01ba('0x79')],_[_0x01ba('0x9d')](_0x413916[_0x01ba('0x67')],['ids','id'])||{})[_0x01ba('0x9e')](function(_0x41fad9){for(var _0x57b07b=0x0;_0x57b07b<_0x413916[_0x01ba('0x67')][_0x01ba('0x79')][_0x01ba('0x4d')];_0x57b07b+=0x1){socket[_0x01ba('0x9a')](_0x01ba('0x85'),{'UserId':_0x413916[_0x01ba('0x67')]['ids'][_0x57b07b],'ChatQueueId':_0x413916[_0x01ba('0x5c')]['id']});}return _0x41fad9;});}})['then'](respondWithResult(_0x30ea7d,null))['catch'](handleError(_0x30ea7d,null));};exports['removeAgents']=function(_0x40eb0f,_0x121f27,_0x2036ee){return db[_0x01ba('0x58')][_0x01ba('0x63')]({'where':{'id':_0x40eb0f[_0x01ba('0x5c')]['id']}})[_0x01ba('0x23')](handleEntityNotFound(_0x121f27,null))[_0x01ba('0x23')](function(_0x438c86){if(_0x438c86){return _0x438c86[_0x01ba('0x99')](_0x40eb0f[_0x01ba('0x47')][_0x01ba('0x79')])[_0x01ba('0x23')](function(){if(_[_0x01ba('0x9f')](_0x40eb0f['query'][_0x01ba('0x79')])){for(var _0x4a6d94=0x0;_0x4a6d94<_0x40eb0f[_0x01ba('0x47')][_0x01ba('0x79')][_0x01ba('0x4d')];_0x4a6d94+=0x1){socket['emit'](_0x01ba('0x9b'),{'UserId':Number(_0x40eb0f['query'][_0x01ba('0x79')][_0x4a6d94]),'ChatQueueId':Number(_0x40eb0f[_0x01ba('0x5c')]['id'])});}}else{socket[_0x01ba('0x9a')](_0x01ba('0x9b'),{'UserId':Number(_0x40eb0f['query'][_0x01ba('0x79')]),'ChatQueueId':Number(_0x40eb0f[_0x01ba('0x5c')]['id'])});}});}})[_0x01ba('0x23')](respondWithStatusCode(_0x121f27,null))['catch'](handleError(_0x121f27,null));};exports['getAgents']=function(_0x21d6af,_0x1ee9cb,_0x4c07a4){var _0x2396fb={};var _0x38ae4f={};var _0x50887c;var _0x4de43e;return db[_0x01ba('0x58')][_0x01ba('0x6a')]({'where':{'id':_0x21d6af[_0x01ba('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1ee9cb,null))['then'](function(_0x3761b0){if(_0x3761b0){_0x50887c=_0x3761b0;_0x38ae4f[_0x01ba('0x46')]=_[_0x01ba('0x48')](db[_0x01ba('0x6e')]['rawAttributes']);_0x38ae4f[_0x01ba('0x47')]=_[_0x01ba('0x48')](_0x21d6af[_0x01ba('0x47')]);_0x38ae4f[_0x01ba('0x49')]=_[_0x01ba('0x4a')](_0x38ae4f['model'],_0x38ae4f[_0x01ba('0x47')]);_0x2396fb['attributes']=_[_0x01ba('0x4a')](_0x38ae4f[_0x01ba('0x46')],qs[_0x01ba('0x4c')](_0x21d6af['query'][_0x01ba('0x4c')]));_0x2396fb[_0x01ba('0x4b')]=_0x2396fb[_0x01ba('0x4b')]['length']?_0x2396fb[_0x01ba('0x4b')]:_0x38ae4f['model'];_0x2396fb[_0x01ba('0x50')]=qs[_0x01ba('0x51')](_0x21d6af[_0x01ba('0x47')]['sort']);_0x2396fb[_0x01ba('0x53')]=qs[_0x01ba('0x49')](_[_0x01ba('0x6b')](_0x21d6af[_0x01ba('0x47')],_0x38ae4f['filters']));if(_0x21d6af[_0x01ba('0x47')]['filter']){_0x2396fb['where']=_[_0x01ba('0x54')](_0x2396fb[_0x01ba('0x53')],{'$or':_[_0x01ba('0x42')](_0x2396fb[_0x01ba('0x4b')],function(_0x3060d3){var _0x5d0708={};_0x5d0708[_0x3060d3]={'$like':'%'+_0x21d6af['query'][_0x01ba('0x52')]+'%'};return _0x5d0708;})});}_0x2396fb=_[_0x01ba('0x54')]({},_0x2396fb,_0x21d6af[_0x01ba('0x56')]);return _0x50887c[_0x01ba('0xa0')](_0x2396fb);}})[_0x01ba('0x23')](function(_0x3bb854){if(_0x3bb854){_0x4de43e=_0x3bb854[_0x01ba('0x4d')];if(!_0x21d6af[_0x01ba('0x47')][_0x01ba('0x4e')](_0x01ba('0x4f'))){_0x2396fb[_0x01ba('0x34')]=qs[_0x01ba('0x34')](_0x21d6af['query'][_0x01ba('0x34')]);_0x2396fb['offset']=qs['offset'](_0x21d6af[_0x01ba('0x47')][_0x01ba('0x33')]);}return _0x50887c[_0x01ba('0xa0')](_0x2396fb);}})[_0x01ba('0x23')](function(_0x3c14a0){if(_0x3c14a0){return _0x3c14a0?{'count':_0x4de43e,'rows':_0x3c14a0}:null;}})['then'](respondWithResult(_0x1ee9cb,null))[_0x01ba('0x2d')](handleError(_0x1ee9cb,null));}; \ No newline at end of file +var _0xe946=['transaction','addTeams','each','forEach','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','emit','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','apply','reject','save','get','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','rows','show','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','SIP','getTeams','ids','Agents','online','voicePause','flatMap'];(function(_0x3da725,_0x7c378d){var _0x41bd11=function(_0x4aa73c){while(--_0x4aa73c){_0x3da725['push'](_0x3da725['shift']());}};_0x41bd11(++_0x7c378d);}(_0xe946,0xbe));var _0x6e94=function(_0x2e90e5,_0x25117c){_0x2e90e5=_0x2e90e5-0x0;var _0x1271b1=_0xe946[_0x2e90e5];return _0x1271b1;};'use strict';var pdf=require(_0x6e94('0x0'));var emlformat=require(_0x6e94('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6e94('0x2'));var jsonpatch=require(_0x6e94('0x3'));var rp=require(_0x6e94('0x4'));var moment=require('moment');var BPromise=require(_0x6e94('0x5'));var Mustache=require(_0x6e94('0x6'));var util=require(_0x6e94('0x7'));var path=require(_0x6e94('0x8'));var sox=require(_0x6e94('0x9'));var csv=require('to-csv');var ejs=require(_0x6e94('0xa'));var fs=require('fs');var _=require(_0x6e94('0xb'));var squel=require(_0x6e94('0xc'));var crypto=require(_0x6e94('0xd'));var jsforce=require(_0x6e94('0xe'));var deskjs=require(_0x6e94('0xf'));var toCsv=require(_0x6e94('0x10'));var querystring=require(_0x6e94('0x11'));var Papa=require(_0x6e94('0x12'));var Redis=require('ioredis');var authService=require(_0x6e94('0x13'));var qs=require(_0x6e94('0x14'));var as=require(_0x6e94('0x15'));var hardwareService=require(_0x6e94('0x16'));var logger=require(_0x6e94('0x17'))(_0x6e94('0x18'));var utils=require('../../config/utils');var config=require(_0x6e94('0x19'));var licenseUtil=require(_0x6e94('0x1a'));var db=require(_0x6e94('0x1b'))['db'];config[_0x6e94('0x1c')]=_[_0x6e94('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6e94('0x1e'))(new Redis(config[_0x6e94('0x1c')]));require(_0x6e94('0x1f'))[_0x6e94('0x20')](socket);var jayson=require(_0x6e94('0x21'));var client=jayson[_0x6e94('0x22')][_0x6e94('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x58f4ca,_0x3b5c24,_0x288494,_0x134fea){return new BPromise(function(_0x3b2834,_0x133b58){var _0x352176=_0x134fea||client;return _0x352176[_0x6e94('0x24')](_0x58f4ca,_0x288494)[_0x6e94('0x25')](function(_0x1d53df){logger[_0x6e94('0x26')](_0x6e94('0x27'),_0x3b5c24,_0x6e94('0x28'));logger['debug'](_0x6e94('0x29'),_0x3b5c24,_0x6e94('0x28'),JSON['stringify'](_0x1d53df));if(_0x1d53df[_0x6e94('0x2a')]){if(_0x1d53df[_0x6e94('0x2a')][_0x6e94('0x2b')]===0x1f4){logger[_0x6e94('0x2a')](_0x6e94('0x27'),_0x3b5c24,_0x1d53df[_0x6e94('0x2a')][_0x6e94('0x2c')]);return _0x133b58(_0x1d53df[_0x6e94('0x2a')][_0x6e94('0x2c')]);}logger[_0x6e94('0x2a')](_0x6e94('0x27'),_0x3b5c24,_0x1d53df['error'][_0x6e94('0x2c')]);return _0x3b2834(_0x1d53df[_0x6e94('0x2a')][_0x6e94('0x2c')]);}else{logger[_0x6e94('0x26')](_0x6e94('0x27'),_0x3b5c24,_0x6e94('0x28'));_0x3b2834(_0x1d53df[_0x6e94('0x2d')][_0x6e94('0x2c')]);}})[_0x6e94('0x2e')](function(_0x413ddd){logger[_0x6e94('0x2a')](_0x6e94('0x27'),_0x3b5c24,_0x413ddd);_0x133b58(_0x413ddd);});});}function respondWithStatusCode(_0xeb327a,_0x59d343){_0x59d343=_0x59d343||0xcc;return function(_0x406f3b){if(_0x406f3b){return _0xeb327a[_0x6e94('0x2f')](_0x59d343);}return _0xeb327a[_0x6e94('0x30')](_0x59d343)[_0x6e94('0x31')]();};}function respondWithResult(_0x1f1c24,_0x320aa0){_0x320aa0=_0x320aa0||0xc8;return function(_0x33f570){if(_0x33f570){return _0x1f1c24[_0x6e94('0x30')](_0x320aa0)[_0x6e94('0x32')](_0x33f570);}};}function respondWithFilteredResult(_0x4d8380,_0x47e29b){return function(_0x413b92){if(_0x413b92){var _0xa4cb89=_0x413b92['count'],_0x17ec44=_0x47e29b[_0x6e94('0x33')],_0x20c660=_0x47e29b[_0x6e94('0x33')]+_0x47e29b['limit'],_0x596231;if(_0x20c660>=_0xa4cb89){_0x20c660=_0xa4cb89;_0x596231=0xc8;}else{_0x596231=0xce;}_0x4d8380[_0x6e94('0x30')](_0x596231);return _0x4d8380['set']('Content-Range',_0x17ec44+'-'+_0x20c660+'/'+_0xa4cb89)['json'](_0x413b92);}return null;};}function patchUpdates(_0x4e07d9){return function(_0x2ffaac){try{jsonpatch[_0x6e94('0x34')](_0x2ffaac,_0x4e07d9,!![]);}catch(_0x3ef220){return BPromise[_0x6e94('0x35')](_0x3ef220);}return _0x2ffaac[_0x6e94('0x36')]();};}function saveUpdates(_0xb4f421,_0x23db6e){return function(_0x24c70f){if(_0x24c70f){return _0x24c70f['update'](_0xb4f421)[_0x6e94('0x25')](function(_0x26c9a3){return _0x26c9a3;});}return null;};}function removeEntity(_0x3df3ef,_0x12356b){return function(_0x2ec3b2){if(_0x2ec3b2){return _0x2ec3b2['destroy']()[_0x6e94('0x25')](function(){var _0x4a4aaa=_0x2ec3b2[_0x6e94('0x37')]({'plain':!![]});var _0x8cc605='ChatQueues';return db['UserProfileResource'][_0x6e94('0x38')]({'where':{'type':_0x8cc605,'resourceId':_0x4a4aaa['id']}})[_0x6e94('0x25')](function(){return _0x2ec3b2;});})[_0x6e94('0x25')](function(){_0x3df3ef[_0x6e94('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1100b8,_0x2bc25d){return function(_0xd2d3c9){if(!_0xd2d3c9){_0x1100b8[_0x6e94('0x2f')](0x194);}return _0xd2d3c9;};}function handleError(_0x10dd96,_0x45b466){_0x45b466=_0x45b466||0x1f4;return function(_0x28fe46){logger[_0x6e94('0x2a')](_0x28fe46[_0x6e94('0x39')]);if(_0x28fe46['name']){delete _0x28fe46[_0x6e94('0x3a')];}_0x10dd96['status'](_0x45b466)[_0x6e94('0x3b')](_0x28fe46);};}exports[_0x6e94('0x3c')]=function(_0x53d342,_0x590c3c){var _0x3f242b={},_0x51d6b8={},_0x30e77c={'count':0x0,'rows':[]};var _0x2aaf12=_[_0x6e94('0x3d')](db[_0x6e94('0x3e')][_0x6e94('0x3f')],function(_0x23b928){return{'name':_0x23b928['fieldName'],'type':_0x23b928[_0x6e94('0x40')][_0x6e94('0x41')]};});_0x51d6b8['model']=_[_0x6e94('0x3d')](_0x2aaf12,_0x6e94('0x3a'));_0x51d6b8['query']=_[_0x6e94('0x42')](_0x53d342['query']);_0x51d6b8[_0x6e94('0x43')]=_[_0x6e94('0x44')](_0x51d6b8[_0x6e94('0x45')],_0x51d6b8[_0x6e94('0x46')]);_0x3f242b[_0x6e94('0x47')]=_['intersection'](_0x51d6b8[_0x6e94('0x45')],qs[_0x6e94('0x48')](_0x53d342[_0x6e94('0x46')]['fields']));_0x3f242b[_0x6e94('0x47')]=_0x3f242b[_0x6e94('0x47')][_0x6e94('0x49')]?_0x3f242b['attributes']:_0x51d6b8[_0x6e94('0x45')];if(!_0x53d342[_0x6e94('0x46')][_0x6e94('0x4a')](_0x6e94('0x4b'))){_0x3f242b[_0x6e94('0x4c')]=qs[_0x6e94('0x4c')](_0x53d342['query'][_0x6e94('0x4c')]);_0x3f242b[_0x6e94('0x33')]=qs['offset'](_0x53d342['query'][_0x6e94('0x33')]);}_0x3f242b[_0x6e94('0x4d')]=qs[_0x6e94('0x4e')](_0x53d342['query']['sort']);_0x3f242b[_0x6e94('0x4f')]=qs['filters'](_[_0x6e94('0x50')](_0x53d342['query'],_0x51d6b8[_0x6e94('0x43')]),_0x2aaf12);if(_0x53d342[_0x6e94('0x46')][_0x6e94('0x51')]){_0x3f242b[_0x6e94('0x4f')]=_[_0x6e94('0x52')](_0x3f242b[_0x6e94('0x4f')],{'$or':_['map'](_0x2aaf12,function(_0xa85446){if(_0xa85446[_0x6e94('0x40')]!==_0x6e94('0x53')){var _0x53e36f={};_0x53e36f[_0xa85446['name']]={'$like':'%'+_0x53d342[_0x6e94('0x46')][_0x6e94('0x51')]+'%'};return _0x53e36f;}})});}_0x3f242b=_[_0x6e94('0x52')]({},_0x3f242b,_0x53d342['options']);var _0x5d02a4={'where':_0x3f242b[_0x6e94('0x4f')]};return db[_0x6e94('0x3e')][_0x6e94('0x54')](_0x5d02a4)['then'](function(_0x176ad0){_0x30e77c['count']=_0x176ad0;if(_0x53d342['query']['includeAll']){_0x3f242b['include']=[{'all':!![]}];}return db[_0x6e94('0x3e')]['findAll'](_0x3f242b);})[_0x6e94('0x25')](function(_0x4f3257){_0x30e77c[_0x6e94('0x55')]=_0x4f3257;return _0x30e77c;})[_0x6e94('0x25')](respondWithFilteredResult(_0x590c3c,_0x3f242b))[_0x6e94('0x2e')](handleError(_0x590c3c,null));};exports[_0x6e94('0x56')]=function(_0x995321,_0x221645){var _0x1aaf73={'raw':!![],'where':{'id':_0x995321['params']['id']}},_0x49a597={};_0x49a597[_0x6e94('0x45')]=_[_0x6e94('0x42')](db[_0x6e94('0x3e')][_0x6e94('0x3f')]);_0x49a597[_0x6e94('0x46')]=_[_0x6e94('0x42')](_0x995321['query']);_0x49a597[_0x6e94('0x43')]=_['intersection'](_0x49a597[_0x6e94('0x45')],_0x49a597[_0x6e94('0x46')]);_0x1aaf73[_0x6e94('0x47')]=_[_0x6e94('0x44')](_0x49a597[_0x6e94('0x45')],qs[_0x6e94('0x48')](_0x995321[_0x6e94('0x46')][_0x6e94('0x48')]));_0x1aaf73[_0x6e94('0x47')]=_0x1aaf73['attributes'][_0x6e94('0x49')]?_0x1aaf73[_0x6e94('0x47')]:_0x49a597[_0x6e94('0x45')];if(_0x995321[_0x6e94('0x46')][_0x6e94('0x57')]){_0x1aaf73[_0x6e94('0x58')]=[{'all':!![]}];}_0x1aaf73=_[_0x6e94('0x52')]({},_0x1aaf73,_0x995321[_0x6e94('0x59')]);return db[_0x6e94('0x3e')][_0x6e94('0x5a')](_0x1aaf73)['then'](handleEntityNotFound(_0x221645,null))[_0x6e94('0x25')](respondWithResult(_0x221645,null))[_0x6e94('0x2e')](handleError(_0x221645,null));};exports['create']=function(_0x43c975,_0x5bda1e){return db[_0x6e94('0x3e')][_0x6e94('0x5b')](_0x43c975[_0x6e94('0x5c')],{})[_0x6e94('0x25')](function(_0x133d1a){var _0x279bf2=_0x43c975[_0x6e94('0x5d')][_0x6e94('0x37')]({'plain':!![]});if(!_0x279bf2)throw new Error(_0x6e94('0x5e'));if(_0x279bf2[_0x6e94('0x5f')]==='user'){var _0x3f4eee=_0x133d1a[_0x6e94('0x37')]({'plain':!![]});var _0x5b2091=_0x6e94('0x60');return db['UserProfileSection'][_0x6e94('0x5a')]({'where':{'name':_0x5b2091,'userProfileId':_0x279bf2[_0x6e94('0x61')]},'raw':!![]})[_0x6e94('0x25')](function(_0x598fe2){if(_0x598fe2&&_0x598fe2[_0x6e94('0x62')]===0x0){return db[_0x6e94('0x63')][_0x6e94('0x5b')]({'name':_0x3f4eee[_0x6e94('0x3a')],'resourceId':_0x3f4eee['id'],'type':_0x598fe2['name'],'sectionId':_0x598fe2['id']},{})[_0x6e94('0x25')](function(){return _0x133d1a;});}else{return _0x133d1a;}})['catch'](function(_0x15c960){logger['error'](_0x6e94('0x64'),_0x15c960);throw _0x15c960;});}return _0x133d1a;})['then'](respondWithResult(_0x5bda1e,0xc9))[_0x6e94('0x2e')](handleError(_0x5bda1e,null));};exports[_0x6e94('0x65')]=function(_0x3fe453,_0x239f3b){if(_0x3fe453[_0x6e94('0x5c')]['id']){delete _0x3fe453[_0x6e94('0x5c')]['id'];}return db[_0x6e94('0x3e')][_0x6e94('0x5a')]({'where':{'id':_0x3fe453[_0x6e94('0x66')]['id']}})[_0x6e94('0x25')](handleEntityNotFound(_0x239f3b,null))[_0x6e94('0x25')](saveUpdates(_0x3fe453['body'],null))[_0x6e94('0x25')](respondWithResult(_0x239f3b,null))[_0x6e94('0x2e')](handleError(_0x239f3b,null));};exports['destroy']=function(_0x255df4,_0x2423fd){return db[_0x6e94('0x3e')]['find']({'where':{'id':_0x255df4[_0x6e94('0x66')]['id']}})[_0x6e94('0x25')](handleEntityNotFound(_0x2423fd,null))[_0x6e94('0x25')](removeEntity(_0x2423fd,null))[_0x6e94('0x2e')](handleError(_0x2423fd,null));};exports['describe']=function(_0x2a42a7,_0x51006b){return db[_0x6e94('0x3e')][_0x6e94('0x67')]()[_0x6e94('0x25')](respondWithResult(_0x51006b,null))['catch'](handleError(_0x51006b,null));};exports[_0x6e94('0x68')]=function(_0x3dd1ae,_0x4ac1b1,_0x1ade96){var _0x9e888b={'raw':!![],'where':{}},_0x5898fe={},_0x1cca6a;return db[_0x6e94('0x3e')][_0x6e94('0x69')]({'where':{'id':_0x3dd1ae[_0x6e94('0x66')]['id']}})['then'](handleEntityNotFound(_0x4ac1b1,null))[_0x6e94('0x25')](function(_0x396238){if(_0x396238){_0x1cca6a=_0x396238[_0x6e94('0x37')]({'plain':!![]});_0x5898fe['model']=_[_0x6e94('0x42')](db[_0x6e94('0x6a')][_0x6e94('0x3f')]);_0x5898fe[_0x6e94('0x46')]=_['keys'](_0x3dd1ae[_0x6e94('0x46')]);_0x5898fe[_0x6e94('0x43')]=_[_0x6e94('0x44')](_0x5898fe[_0x6e94('0x45')],_0x5898fe[_0x6e94('0x46')]);_0x9e888b[_0x6e94('0x47')]=_['intersection'](_0x5898fe['model'],qs[_0x6e94('0x48')](_0x3dd1ae[_0x6e94('0x46')][_0x6e94('0x48')]));_0x9e888b['attributes']=_0x9e888b[_0x6e94('0x47')][_0x6e94('0x49')]?_0x9e888b[_0x6e94('0x47')]:_0x5898fe[_0x6e94('0x45')];if(!_0x3dd1ae['query'][_0x6e94('0x4a')](_0x6e94('0x4b'))){_0x9e888b[_0x6e94('0x4c')]=qs[_0x6e94('0x4c')](_0x3dd1ae[_0x6e94('0x46')][_0x6e94('0x4c')]);_0x9e888b[_0x6e94('0x33')]=qs[_0x6e94('0x33')](_0x3dd1ae['query']['offset']);}_0x9e888b[_0x6e94('0x4d')]=qs[_0x6e94('0x4e')](_0x3dd1ae[_0x6e94('0x46')]['sort']);_0x9e888b['where']=qs[_0x6e94('0x43')](_[_0x6e94('0x50')](_0x3dd1ae[_0x6e94('0x46')],_0x5898fe['filters']));_0x9e888b[_0x6e94('0x4f')][_0x6e94('0x6b')]=_0x396238['id'];if(_0x3dd1ae[_0x6e94('0x46')][_0x6e94('0x51')]){_0x9e888b[_0x6e94('0x4f')]=_[_0x6e94('0x52')](_0x9e888b[_0x6e94('0x4f')],{'$or':_[_0x6e94('0x3d')](_0x9e888b[_0x6e94('0x47')],function(_0x1d20d3){var _0x45716e={};_0x45716e[_0x1d20d3]={'$like':'%'+_0x3dd1ae[_0x6e94('0x46')][_0x6e94('0x51')]+'%'};return _0x45716e;})});}_0x9e888b=_['merge']({},_0x9e888b,_0x3dd1ae['options']);return db[_0x6e94('0x6a')][_0x6e94('0x6c')](_0x9e888b);}})[_0x6e94('0x25')](function(_0x9173cb){if(_0x9173cb){return db[_0x6e94('0x6d')][_0x6e94('0x6e')]({'where':{'id':_[_0x6e94('0x3d')](_0x9173cb,_0x6e94('0x6f')),'role':'agent'},'attributes':['id',_0x6e94('0x3a'),_0x6e94('0x70'),_0x6e94('0x71'),_0x6e94('0x72')]});}})[_0x6e94('0x25')](function(_0x27bdd7){if(_0x27bdd7){return{'count':_0x27bdd7[_0x6e94('0x54')],'rows':_[_0x6e94('0x3d')](_0x27bdd7[_0x6e94('0x55')],function(_0x256cf3){return{'membername':_0x256cf3[_0x6e94('0x3a')],'UserId':_0x256cf3['id'],'queue_name':_0x1cca6a['name'],'ChatQueueId':_0x1cca6a['id'],'interface':util['format']('%s/%s',_0x6e94('0x73'),_0x256cf3[_0x6e94('0x3a')]),'penalty':0x0,'paused':_0x256cf3[_0x6e94('0x70')],'createdAt':_0x256cf3['createdAt'],'updatedAt':_0x256cf3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6e94('0x25')](respondWithFilteredResult(_0x4ac1b1,_0x9e888b))['catch'](handleError(_0x4ac1b1,null));};exports[_0x6e94('0x74')]=function(_0x57414d,_0x115d38,_0x265f91){var _0x752e4c={};var _0x331056={};var _0x4277d6;var _0x22dfb9;return db[_0x6e94('0x3e')][_0x6e94('0x69')]({'where':{'id':_0x57414d[_0x6e94('0x66')]['id']}})[_0x6e94('0x25')](handleEntityNotFound(_0x115d38,null))[_0x6e94('0x25')](function(_0x472cca){if(_0x472cca){_0x4277d6=_0x472cca;_0x331056[_0x6e94('0x45')]=_[_0x6e94('0x42')](db['Team'][_0x6e94('0x3f')]);_0x331056['query']=_[_0x6e94('0x42')](_0x57414d[_0x6e94('0x46')]);_0x331056[_0x6e94('0x43')]=_[_0x6e94('0x44')](_0x331056[_0x6e94('0x45')],_0x331056['query']);_0x752e4c[_0x6e94('0x47')]=_[_0x6e94('0x44')](_0x331056[_0x6e94('0x45')],qs['fields'](_0x57414d[_0x6e94('0x46')][_0x6e94('0x48')]));_0x752e4c[_0x6e94('0x47')]=_0x752e4c[_0x6e94('0x47')][_0x6e94('0x49')]?_0x752e4c[_0x6e94('0x47')]:_0x331056[_0x6e94('0x45')];_0x752e4c['order']=qs[_0x6e94('0x4e')](_0x57414d['query']['sort']);_0x752e4c[_0x6e94('0x4f')]=qs['filters'](_[_0x6e94('0x50')](_0x57414d[_0x6e94('0x46')],_0x331056[_0x6e94('0x43')]));if(_0x57414d[_0x6e94('0x46')][_0x6e94('0x51')]){_0x752e4c[_0x6e94('0x4f')]=_[_0x6e94('0x52')](_0x752e4c[_0x6e94('0x4f')],{'$or':_[_0x6e94('0x3d')](_0x752e4c[_0x6e94('0x47')],function(_0x26b606){var _0x4ee6f1={};_0x4ee6f1[_0x26b606]={'$like':'%'+_0x57414d[_0x6e94('0x46')]['filter']+'%'};return _0x4ee6f1;})});}_0x752e4c=_['merge']({},_0x752e4c,_0x57414d[_0x6e94('0x59')]);return _0x4277d6[_0x6e94('0x74')](_0x752e4c);}})[_0x6e94('0x25')](function(_0x1ca08f){if(_0x1ca08f){_0x22dfb9=_0x1ca08f[_0x6e94('0x49')];if(!_0x57414d[_0x6e94('0x46')][_0x6e94('0x4a')](_0x6e94('0x4b'))){_0x752e4c[_0x6e94('0x4c')]=qs[_0x6e94('0x4c')](_0x57414d[_0x6e94('0x46')][_0x6e94('0x4c')]);_0x752e4c[_0x6e94('0x33')]=qs[_0x6e94('0x33')](_0x57414d['query'][_0x6e94('0x33')]);}return _0x4277d6[_0x6e94('0x74')](_0x752e4c);}})[_0x6e94('0x25')](function(_0x7f43e0){if(_0x7f43e0){return _0x7f43e0?{'count':_0x22dfb9,'rows':_0x7f43e0}:null;}})[_0x6e94('0x25')](respondWithResult(_0x115d38,null))[_0x6e94('0x2e')](handleError(_0x115d38,null));};exports['addTeams']=function(_0x3883c5,_0x2b0f04,_0x47a184){var _0x1e636a=_0x3883c5[_0x6e94('0x5c')][_0x6e94('0x75')];return db['Team']['findAll']({'where':{'id':_0x1e636a},'attributes':['id'],'include':[{'model':db[_0x6e94('0x6d')],'as':_0x6e94('0x76'),'attributes':['id',_0x6e94('0x3a'),_0x6e94('0x77'),_0x6e94('0x78'),'interface'],'raw':!![]}]})[_0x6e94('0x25')](function(_0x2f944e){if(_0x2f944e){var _0x2dc99c=_[_0x6e94('0x79')](_0x2f944e,function(_0x51a13f){var _0x12b589=_0x51a13f['get']({'plain':!![]});return _0x12b589['Agents'];});return db['ChatQueue'][_0x6e94('0x5a')]({'where':{'id':_0x3883c5['params']['id']}})['then'](function(_0x329bcb){return db['sequelize'][_0x6e94('0x7a')](function(_0x3ec5ea){return _0x329bcb[_0x6e94('0x7b')](_0x1e636a,{'transaction':_0x3ec5ea})[_0x6e94('0x25')](function(){return BPromise[_0x6e94('0x7c')](_0x2dc99c,function(_0x388949){return db[_0x6e94('0x6a')]['findOrCreate']({'where':{'UserId':_0x388949['id'],'ChatQueueId':_0x3883c5[_0x6e94('0x66')]['id']},'transaction':_0x3ec5ea});});})[_0x6e94('0x25')](function(){_0x2dc99c[_0x6e94('0x7d')](function(_0x42267f){socket['emit'](_0x6e94('0x7e'),{'UserId':_0x42267f['id'],'ChatQueueId':_0x329bcb['id']});});});});});}})[_0x6e94('0x25')](respondWithStatusCode(_0x2b0f04,null))['catch'](handleError(_0x2b0f04,null));};exports['removeTeams']=function(_0x4db184,_0x334fdf,_0x57afcc){return db['Team'][_0x6e94('0x6c')]({'where':{'id':_0x4db184['query'][_0x6e94('0x75')]},'attributes':['id'],'include':[{'model':db[_0x6e94('0x6d')],'as':_0x6e94('0x76'),'attributes':['id'],'raw':!![]}]})[_0x6e94('0x25')](handleEntityNotFound(_0x334fdf,null))['then'](function(_0x148586){var _0x5af01e=_[_0x6e94('0x3d')](_0x148586,'id');var _0x307cbd=[];var _0x277a5f=[];var _0x3d25e3=squel[_0x6e94('0x7f')]();_0x3d25e3[_0x6e94('0x80')](_0x6e94('0x81'))[_0x6e94('0x82')](_0x6e94('0x83'),'tq')[_0x6e94('0x84')](_0x6e94('0x85'),'ut',_0x6e94('0x86'))[_0x6e94('0x4f')](_0x6e94('0x87'),_0x4db184['params']['id']);for(var _0x3a187f=0x0;_0x3a187f<_0x148586[_0x6e94('0x49')];_0x3a187f+=0x1){let _0x40072e=_0x148586[_0x3a187f];for(var _0xec5f60=0x0;_0xec5f60<_0x40072e[_0x6e94('0x76')]['length'];_0xec5f60+=0x1){let _0x1cabc8=_0x40072e[_0x6e94('0x76')][_0xec5f60];var _0x9e5907=_0x3d25e3['clone']();_0x9e5907['where'](_0x6e94('0x88'),_0x1cabc8['id']);_0x277a5f[_0x6e94('0x89')](db['sequelize'][_0x6e94('0x46')](_0x9e5907[_0x6e94('0x8a')](),{'type':db[_0x6e94('0x8b')][_0x6e94('0x8c')][_0x6e94('0x8d')]})['then'](function(_0x15d151){if(_0x15d151[_0x6e94('0x49')]===0x1){return _0x1cabc8['id'];}else{var _0x4d5eb5=_[_0x6e94('0x8e')](_['map'](_0x15d151,'TeamId'),function(_0x4b887c){return _[_0x6e94('0x8f')](_0x5af01e,_0x4b887c);});if(_0x4d5eb5){return _0x1cabc8['id'];}}}));}}return BPromise[_0x6e94('0x90')](_0x277a5f)[_0x6e94('0x25')](function(_0x2b5fed){_0x307cbd=_(_0x307cbd)[_0x6e94('0x91')](_0x2b5fed)[_0x6e94('0x92')]()[_0x6e94('0x93')]();return db[_0x6e94('0x3e')][_0x6e94('0x5a')]({'where':{'id':_0x4db184['params']['id']}})[_0x6e94('0x25')](function(_0x16cba9){return db['sequelize']['transaction'](function(_0x317d9b){return _0x16cba9[_0x6e94('0x94')](_0x4db184[_0x6e94('0x46')][_0x6e94('0x75')],{'transaction':_0x317d9b})[_0x6e94('0x25')](function(){if(!_['isEmpty'](_0x307cbd)){return _0x16cba9[_0x6e94('0x95')](_0x307cbd,{'transaction':_0x317d9b});}})[_0x6e94('0x25')](function(){_0x307cbd[_0x6e94('0x7d')](function(_0x28349e){socket['emit'](_0x6e94('0x96'),{'UserId':_0x28349e,'ChatQueueId':_0x16cba9['id']});});});});});});})['then'](respondWithStatusCode(_0x334fdf,null))[_0x6e94('0x2e')](handleError(_0x334fdf,null));};exports['addAgents']=function(_0x490ebe,_0x399051,_0x7e2d43){return db[_0x6e94('0x3e')][_0x6e94('0x5a')]({'where':{'id':_0x490ebe[_0x6e94('0x66')]['id']}})[_0x6e94('0x25')](handleEntityNotFound(_0x399051,null))['then'](function(_0x4fbea6){if(_0x4fbea6){return _0x4fbea6[_0x6e94('0x97')](_0x490ebe['body'][_0x6e94('0x75')],_[_0x6e94('0x98')](_0x490ebe[_0x6e94('0x5c')],[_0x6e94('0x75'),'id'])||{})['spread'](function(_0x86d416){for(var _0x59c324=0x0;_0x59c324<_0x490ebe[_0x6e94('0x5c')][_0x6e94('0x75')][_0x6e94('0x49')];_0x59c324+=0x1){socket[_0x6e94('0x99')](_0x6e94('0x7e'),{'UserId':_0x490ebe[_0x6e94('0x5c')][_0x6e94('0x75')][_0x59c324],'ChatQueueId':_0x490ebe[_0x6e94('0x66')]['id']});}return _0x86d416;});}})[_0x6e94('0x25')](respondWithResult(_0x399051,null))[_0x6e94('0x2e')](handleError(_0x399051,null));};exports[_0x6e94('0x95')]=function(_0x3b3131,_0x2a1842,_0x363016){return db[_0x6e94('0x3e')][_0x6e94('0x5a')]({'where':{'id':_0x3b3131[_0x6e94('0x66')]['id']}})['then'](handleEntityNotFound(_0x2a1842,null))['then'](function(_0x77d65f){if(_0x77d65f){return _0x77d65f['removeAgents'](_0x3b3131['query'][_0x6e94('0x75')])[_0x6e94('0x25')](function(){if(_[_0x6e94('0x9a')](_0x3b3131[_0x6e94('0x46')]['ids'])){for(var _0x2f97bb=0x0;_0x2f97bb<_0x3b3131[_0x6e94('0x46')][_0x6e94('0x75')][_0x6e94('0x49')];_0x2f97bb+=0x1){socket[_0x6e94('0x99')](_0x6e94('0x96'),{'UserId':Number(_0x3b3131['query'][_0x6e94('0x75')][_0x2f97bb]),'ChatQueueId':Number(_0x3b3131[_0x6e94('0x66')]['id'])});}}else{socket[_0x6e94('0x99')](_0x6e94('0x96'),{'UserId':Number(_0x3b3131[_0x6e94('0x46')][_0x6e94('0x75')]),'ChatQueueId':Number(_0x3b3131[_0x6e94('0x66')]['id'])});}});}})[_0x6e94('0x25')](respondWithStatusCode(_0x2a1842,null))[_0x6e94('0x2e')](handleError(_0x2a1842,null));};exports[_0x6e94('0x9b')]=function(_0x267c70,_0x46df68,_0x55c21e){var _0x587902={};var _0x485359={};var _0x368fc9;var _0x3917fd;return db['ChatQueue'][_0x6e94('0x69')]({'where':{'id':_0x267c70[_0x6e94('0x66')]['id']}})[_0x6e94('0x25')](handleEntityNotFound(_0x46df68,null))['then'](function(_0x5adc56){if(_0x5adc56){_0x368fc9=_0x5adc56;_0x485359[_0x6e94('0x45')]=_[_0x6e94('0x42')](db[_0x6e94('0x6d')][_0x6e94('0x3f')]);_0x485359['query']=_[_0x6e94('0x42')](_0x267c70['query']);_0x485359[_0x6e94('0x43')]=_[_0x6e94('0x44')](_0x485359[_0x6e94('0x45')],_0x485359[_0x6e94('0x46')]);_0x587902[_0x6e94('0x47')]=_['intersection'](_0x485359[_0x6e94('0x45')],qs[_0x6e94('0x48')](_0x267c70['query'][_0x6e94('0x48')]));_0x587902['attributes']=_0x587902[_0x6e94('0x47')][_0x6e94('0x49')]?_0x587902[_0x6e94('0x47')]:_0x485359[_0x6e94('0x45')];_0x587902[_0x6e94('0x4d')]=qs[_0x6e94('0x4e')](_0x267c70[_0x6e94('0x46')][_0x6e94('0x4e')]);_0x587902['where']=qs[_0x6e94('0x43')](_[_0x6e94('0x50')](_0x267c70['query'],_0x485359[_0x6e94('0x43')]));if(_0x267c70['query']['filter']){_0x587902['where']=_['merge'](_0x587902['where'],{'$or':_[_0x6e94('0x3d')](_0x587902['attributes'],function(_0x2a1a8f){var _0x2ebfae={};_0x2ebfae[_0x2a1a8f]={'$like':'%'+_0x267c70['query'][_0x6e94('0x51')]+'%'};return _0x2ebfae;})});}_0x587902=_[_0x6e94('0x52')]({},_0x587902,_0x267c70['options']);return _0x368fc9[_0x6e94('0x9b')](_0x587902);}})[_0x6e94('0x25')](function(_0x2c400a){if(_0x2c400a){_0x3917fd=_0x2c400a[_0x6e94('0x49')];if(!_0x267c70[_0x6e94('0x46')][_0x6e94('0x4a')](_0x6e94('0x4b'))){_0x587902[_0x6e94('0x4c')]=qs['limit'](_0x267c70[_0x6e94('0x46')][_0x6e94('0x4c')]);_0x587902[_0x6e94('0x33')]=qs[_0x6e94('0x33')](_0x267c70[_0x6e94('0x46')][_0x6e94('0x33')]);}return _0x368fc9['getAgents'](_0x587902);}})[_0x6e94('0x25')](function(_0x378ae1){if(_0x378ae1){return _0x378ae1?{'count':_0x3917fd,'rows':_0x378ae1}:null;}})['then'](respondWithResult(_0x46df68,null))[_0x6e94('0x2e')](handleError(_0x46df68,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a30ec83..a5fe11a 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x5b3fa6,_0x1618da){var _0x4b5acc=function(_0xcd1abb){while(--_0xcd1abb){_0x5b3fa6['push'](_0x5b3fa6['shift']());}};_0x4b5acc(++_0x1618da);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45980d,_0x3fca8c){_0x45980d=_0x45980d-0x0;var _0x3ef1ae=_0x5f2f[_0x45980d];return _0x3ef1ae;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x14eb0e,_0x59569a){var _0x325022=function(_0x5a2064){while(--_0x5a2064){_0x14eb0e['push'](_0x14eb0e['shift']());}};_0x325022(++_0x59569a);}(_0xb10b,0x12a));var _0xbb10=function(_0x593fa0,_0x23b388){_0x593fa0=_0x593fa0-0x0;var _0x452eee=_0xb10b[_0x593fa0];return _0x452eee;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 451af51..36fe6d4 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 _0x83e2=['path','../../config/environment','exports','define','ChatQueue','chat_queues','lodash','util','moment','request-promise'];(function(_0x3b8a8a,_0x577b7f){var _0x344f11=function(_0x3d439b){while(--_0x3d439b){_0x3b8a8a['push'](_0x3b8a8a['shift']());}};_0x344f11(++_0x577b7f);}(_0x83e2,0x74));var _0x283e=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x83e2[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x283e('0x0'));var util=require(_0x283e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x283e('0x2'));var BPromise=require('bluebird');var rp=require(_0x283e('0x3'));var fs=require('fs');var path=require(_0x283e('0x4'));var rimraf=require('rimraf');var config=require(_0x283e('0x5'));var attributes=require('./chatQueue.attributes');module[_0x283e('0x6')]=function(_0x1e6c40,_0x32dfbf){return _0x1e6c40[_0x283e('0x7')](_0x283e('0x8'),attributes,{'tableName':_0x283e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd755=['./chatQueue.attributes','ChatQueue','chat_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x52096f,_0x2def77){var _0x459a37=function(_0x245f80){while(--_0x245f80){_0x52096f['push'](_0x52096f['shift']());}};_0x459a37(++_0x2def77);}(_0xd755,0x137));var _0x5d75=function(_0x437b02,_0x34b630){_0x437b02=_0x437b02-0x0;var _0xf8c681=_0xd755[_0x437b02];return _0xf8c681;};'use strict';var _=require('lodash');var util=require(_0x5d75('0x0'));var logger=require(_0x5d75('0x1'))(_0x5d75('0x2'));var moment=require(_0x5d75('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d75('0x4'));var fs=require('fs');var path=require(_0x5d75('0x5'));var rimraf=require(_0x5d75('0x6'));var config=require(_0x5d75('0x7'));var attributes=require(_0x5d75('0x8'));module['exports']=function(_0x50a058,_0x43928e){return _0x50a058['define'](_0x5d75('0x9'),attributes,{'tableName':_0x5d75('0xa'),'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 596f0d7..930daa9 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 _0x285b=['http','redis','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetChatQueue','ChatQueue','findAll','options','limit','include','map','model','attributes','ShowChatQueue','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xdd91cc,_0x2db600){var _0x34b571=function(_0x309b93){while(--_0x309b93){_0xdd91cc['push'](_0xdd91cc['shift']());}};_0x34b571(++_0x2db600);}(_0x285b,0x171));var _0xb285=function(_0x31512f,_0x38e1f2){_0x31512f=_0x31512f-0x0;var _0x1fee7e=_0x285b[_0x31512f];return _0x1fee7e;};'use strict';var _=require(_0xb285('0x0'));var util=require('util');var moment=require(_0xb285('0x1'));var BPromise=require(_0xb285('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb285('0x3'));var db=require(_0xb285('0x4'))['db'];var utils=require(_0xb285('0x5'));var logger=require(_0xb285('0x6'))(_0xb285('0x7'));var config=require(_0xb285('0x8'));var jayson=require(_0xb285('0x9'));var client=jayson[_0xb285('0xa')][_0xb285('0xb')]({'port':0x232a});config[_0xb285('0xc')]=_['defaults'](config[_0xb285('0xc')],{'host':_0xb285('0xd'),'port':0x18eb});var socket=require(_0xb285('0xe'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xb285('0xf')](socket);function respondWithRpcPromise(_0x2556dc,_0x133cc7,_0xd138d8){return new BPromise(function(_0x4e5976,_0x3d2a2b){return client['request'](_0x2556dc,_0xd138d8)[_0xb285('0x10')](function(_0x46ef65){logger[_0xb285('0x11')](_0xb285('0x12'),_0x133cc7,_0xb285('0x13'));logger[_0xb285('0x14')](_0xb285('0x15'),_0x133cc7,_0xb285('0x13'),JSON[_0xb285('0x16')](_0x46ef65));if(_0x46ef65[_0xb285('0x17')]){if(_0x46ef65['error']['code']===0x1f4){logger[_0xb285('0x17')](_0xb285('0x12'),_0x133cc7,_0x46ef65[_0xb285('0x17')][_0xb285('0x18')]);return _0x3d2a2b(_0x46ef65['error'][_0xb285('0x18')]);}logger[_0xb285('0x17')](_0xb285('0x12'),_0x133cc7,_0x46ef65[_0xb285('0x17')]['message']);return _0x4e5976(_0x46ef65[_0xb285('0x17')]['message']);}else{logger[_0xb285('0x11')](_0xb285('0x12'),_0x133cc7,_0xb285('0x13'));_0x4e5976(_0x46ef65['result'][_0xb285('0x18')]);}})[_0xb285('0x19')](function(_0x99b1e6){logger[_0xb285('0x17')](_0xb285('0x12'),_0x133cc7,_0x99b1e6);_0x3d2a2b(_0x99b1e6);});});}exports[_0xb285('0x1a')]=function(_0x17ad6f){var _0x378069=this;return new Promise(function(_0x402822,_0x5d77cb){return db[_0xb285('0x1b')][_0xb285('0x1c')]({'raw':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')]['where']||null:null,'attributes':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')]['attributes']||null:null,'limit':_0x17ad6f['options']?_0x17ad6f[_0xb285('0x1d')][_0xb285('0x1e')]||null:null,'include':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')][_0xb285('0x1f')]?_[_0xb285('0x20')](_0x17ad6f[_0xb285('0x1d')][_0xb285('0x1f')],function(_0x8d9a16){return{'model':db[_0x8d9a16[_0xb285('0x21')]],'as':_0x8d9a16['as'],'attributes':_0x8d9a16[_0xb285('0x22')],'include':_0x8d9a16['include']?_[_0xb285('0x20')](_0x8d9a16[_0xb285('0x1f')],function(_0x56c81f){return{'model':db[_0x56c81f[_0xb285('0x21')]],'as':_0x56c81f['as'],'attributes':_0x56c81f['attributes'],'include':_0x56c81f[_0xb285('0x1f')]?_[_0xb285('0x20')](_0x56c81f[_0xb285('0x1f')],function(_0x4377aa){return{'model':db[_0x4377aa[_0xb285('0x21')]],'as':_0x4377aa['as'],'attributes':_0x4377aa[_0xb285('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb285('0x10')](function(_0x4a4408){logger[_0xb285('0x11')]('GetChatQueue',_0x17ad6f);logger[_0xb285('0x14')](_0xb285('0x1a'),_0x17ad6f,JSON[_0xb285('0x16')](_0x4a4408));_0x402822(_0x4a4408);})[_0xb285('0x19')](function(_0x3f7139){logger[_0xb285('0x17')](_0xb285('0x1a'),_0x3f7139['message'],_0x17ad6f);_0x5d77cb(_0x378069[_0xb285('0x17')](0x1f4,_0x3f7139[_0xb285('0x18')]));});});};exports[_0xb285('0x23')]=function(_0x2ece08){var _0x152e0d=this;return new Promise(function(_0x521837,_0x4ed2b5){return db[_0xb285('0x1b')][_0xb285('0x24')]({'raw':_0x2ece08[_0xb285('0x1d')]?_0x2ece08[_0xb285('0x1d')][_0xb285('0x25')]===undefined?!![]:![]:!![],'where':_0x2ece08[_0xb285('0x1d')]?_0x2ece08[_0xb285('0x1d')]['where']||null:null,'attributes':_0x2ece08[_0xb285('0x1d')]?_0x2ece08[_0xb285('0x1d')][_0xb285('0x22')]||null:null,'include':_0x2ece08[_0xb285('0x1d')]?_0x2ece08['options'][_0xb285('0x1f')]?_[_0xb285('0x20')](_0x2ece08[_0xb285('0x1d')][_0xb285('0x1f')],function(_0x2efbaf){return{'model':db[_0x2efbaf[_0xb285('0x21')]],'as':_0x2efbaf['as'],'attributes':_0x2efbaf['attributes'],'include':_0x2efbaf[_0xb285('0x1f')]?_[_0xb285('0x20')](_0x2efbaf['include'],function(_0x420fa8){return{'model':db[_0x420fa8[_0xb285('0x21')]],'as':_0x420fa8['as'],'attributes':_0x420fa8['attributes'],'include':_0x420fa8[_0xb285('0x1f')]?_[_0xb285('0x20')](_0x420fa8['include'],function(_0x14ef0d){return{'model':db[_0x14ef0d[_0xb285('0x21')]],'as':_0x14ef0d['as'],'attributes':_0x14ef0d[_0xb285('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb285('0x10')](function(_0x1afa35){logger[_0xb285('0x11')](_0xb285('0x23'),_0x2ece08);logger[_0xb285('0x14')](_0xb285('0x23'),_0x2ece08,JSON['stringify'](_0x1afa35));_0x521837(_0x1afa35);})[_0xb285('0x19')](function(_0x2346f4){logger[_0xb285('0x17')](_0xb285('0x23'),_0x2346f4[_0xb285('0x18')],_0x2ece08);_0x4ed2b5(_0x152e0d[_0xb285('0x17')](0x1f4,_0x2346f4['message']));});});}; \ No newline at end of file +var _0xffdd=['include','model','attributes','map','ShowChatQueue','raw','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetChatQueue','ChatQueue','findAll','options','where'];(function(_0x144f34,_0x106f2f){var _0x4230db=function(_0x2b8f3f){while(--_0x2b8f3f){_0x144f34['push'](_0x144f34['shift']());}};_0x4230db(++_0x106f2f);}(_0xffdd,0x193));var _0xdffd=function(_0x5989bf,_0x5e9acb){_0x5989bf=_0x5989bf-0x0;var _0x2d66b9=_0xffdd[_0x5989bf];return _0x2d66b9;};'use strict';var _=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var moment=require(_0xdffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffd('0x3'));var db=require(_0xdffd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffd('0x5'))(_0xdffd('0x6'));var config=require(_0xdffd('0x7'));var jayson=require(_0xdffd('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xdffd('0x9')](config[_0xdffd('0xa')],{'host':_0xdffd('0xb'),'port':0x18eb});var socket=require(_0xdffd('0xc'))(new Redis(config[_0xdffd('0xa')]));require(_0xdffd('0xd'))[_0xdffd('0xe')](socket);function respondWithRpcPromise(_0x5d466a,_0x5389a0,_0x4f8b59){return new BPromise(function(_0x89f8d3,_0x5f214a){return client['request'](_0x5d466a,_0x4f8b59)[_0xdffd('0xf')](function(_0x28cbf6){logger[_0xdffd('0x10')](_0xdffd('0x11'),_0x5389a0,'request\x20sent');logger['debug'](_0xdffd('0x12'),_0x5389a0,'request\x20sent',JSON[_0xdffd('0x13')](_0x28cbf6));if(_0x28cbf6[_0xdffd('0x14')]){if(_0x28cbf6[_0xdffd('0x14')]['code']===0x1f4){logger[_0xdffd('0x14')](_0xdffd('0x11'),_0x5389a0,_0x28cbf6[_0xdffd('0x14')][_0xdffd('0x15')]);return _0x5f214a(_0x28cbf6[_0xdffd('0x14')][_0xdffd('0x15')]);}logger[_0xdffd('0x14')]('ChatQueue,\x20%s,\x20%s',_0x5389a0,_0x28cbf6[_0xdffd('0x14')]['message']);return _0x89f8d3(_0x28cbf6[_0xdffd('0x14')][_0xdffd('0x15')]);}else{logger[_0xdffd('0x10')]('ChatQueue,\x20%s,\x20%s',_0x5389a0,_0xdffd('0x16'));_0x89f8d3(_0x28cbf6['result'][_0xdffd('0x15')]);}})[_0xdffd('0x17')](function(_0xab9ce2){logger[_0xdffd('0x14')](_0xdffd('0x11'),_0x5389a0,_0xab9ce2);_0x5f214a(_0xab9ce2);});});}exports[_0xdffd('0x18')]=function(_0x229e3c){var _0x52d688=this;return new Promise(function(_0x2f6a83,_0x4f7eef){return db[_0xdffd('0x19')][_0xdffd('0x1a')]({'raw':_0x229e3c['options']?_0x229e3c[_0xdffd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x229e3c[_0xdffd('0x1b')]?_0x229e3c[_0xdffd('0x1b')][_0xdffd('0x1c')]||null:null,'attributes':_0x229e3c[_0xdffd('0x1b')]?_0x229e3c[_0xdffd('0x1b')]['attributes']||null:null,'limit':_0x229e3c[_0xdffd('0x1b')]?_0x229e3c[_0xdffd('0x1b')]['limit']||null:null,'include':_0x229e3c[_0xdffd('0x1b')]?_0x229e3c[_0xdffd('0x1b')][_0xdffd('0x1d')]?_['map'](_0x229e3c[_0xdffd('0x1b')]['include'],function(_0x13273a){return{'model':db[_0x13273a[_0xdffd('0x1e')]],'as':_0x13273a['as'],'attributes':_0x13273a[_0xdffd('0x1f')],'include':_0x13273a[_0xdffd('0x1d')]?_[_0xdffd('0x20')](_0x13273a['include'],function(_0x7b4558){return{'model':db[_0x7b4558[_0xdffd('0x1e')]],'as':_0x7b4558['as'],'attributes':_0x7b4558['attributes'],'include':_0x7b4558[_0xdffd('0x1d')]?_[_0xdffd('0x20')](_0x7b4558[_0xdffd('0x1d')],function(_0x29d3e5){return{'model':db[_0x29d3e5[_0xdffd('0x1e')]],'as':_0x29d3e5['as'],'attributes':_0x29d3e5[_0xdffd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdffd('0xf')](function(_0xd758d5){logger['info']('GetChatQueue',_0x229e3c);logger['debug'](_0xdffd('0x18'),_0x229e3c,JSON['stringify'](_0xd758d5));_0x2f6a83(_0xd758d5);})['catch'](function(_0x45f8e9){logger[_0xdffd('0x14')]('GetChatQueue',_0x45f8e9['message'],_0x229e3c);_0x4f7eef(_0x52d688[_0xdffd('0x14')](0x1f4,_0x45f8e9[_0xdffd('0x15')]));});});};exports[_0xdffd('0x21')]=function(_0x595048){var _0x4b3d8f=this;return new Promise(function(_0x4b8385,_0x3ad61e){return db[_0xdffd('0x19')]['find']({'raw':_0x595048[_0xdffd('0x1b')]?_0x595048['options'][_0xdffd('0x22')]===undefined?!![]:![]:!![],'where':_0x595048[_0xdffd('0x1b')]?_0x595048[_0xdffd('0x1b')][_0xdffd('0x1c')]||null:null,'attributes':_0x595048['options']?_0x595048[_0xdffd('0x1b')]['attributes']||null:null,'include':_0x595048[_0xdffd('0x1b')]?_0x595048['options'][_0xdffd('0x1d')]?_[_0xdffd('0x20')](_0x595048[_0xdffd('0x1b')][_0xdffd('0x1d')],function(_0x236656){return{'model':db[_0x236656[_0xdffd('0x1e')]],'as':_0x236656['as'],'attributes':_0x236656[_0xdffd('0x1f')],'include':_0x236656[_0xdffd('0x1d')]?_['map'](_0x236656['include'],function(_0x55d5ae){return{'model':db[_0x55d5ae[_0xdffd('0x1e')]],'as':_0x55d5ae['as'],'attributes':_0x55d5ae[_0xdffd('0x1f')],'include':_0x55d5ae[_0xdffd('0x1d')]?_[_0xdffd('0x20')](_0x55d5ae['include'],function(_0x22ef02){return{'model':db[_0x22ef02[_0xdffd('0x1e')]],'as':_0x22ef02['as'],'attributes':_0x22ef02[_0xdffd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdffd('0xf')](function(_0x46d307){logger[_0xdffd('0x10')](_0xdffd('0x21'),_0x595048);logger[_0xdffd('0x23')](_0xdffd('0x21'),_0x595048,JSON[_0xdffd('0x13')](_0x46d307));_0x4b8385(_0x46d307);})[_0xdffd('0x17')](function(_0x39b7c5){logger[_0xdffd('0x14')](_0xdffd('0x21'),_0x39b7c5[_0xdffd('0x15')],_0x595048);_0x3ad61e(_0x4b3d8f['error'](0x1f4,_0x39b7c5[_0xdffd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9312b72..127a15e 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x914328,_0x43108b){var _0x45dd05=function(_0x13d0eb){while(--_0x13d0eb){_0x914328['push'](_0x914328['shift']());}};_0x45dd05(++_0x43108b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x0b0e[_0x1f7996];return _0x584609;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2493a8,_0x5a240d){_0x2493a8=_0x2493a8-0x0;var _0x2b06c9=_0xb10b[_0x2493a8];return _0x2b06c9;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7b4d345..d4aef97 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 _0x9f20=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','delete','destroy','removeTeams','exports','multer'];(function(_0x3c44fe,_0x2ccfb5){var _0x25274d=function(_0x7783b0){while(--_0x7783b0){_0x3c44fe['push'](_0x3c44fe['shift']());}};_0x25274d(++_0x2ccfb5);}(_0x9f20,0xf2));var _0x09f2=function(_0x3cbcb2,_0x7c82cf){_0x3cbcb2=_0x3cbcb2-0x0;var _0x3e815e=_0x9f20[_0x3cbcb2];return _0x3e815e;};'use strict';var multer=require(_0x09f2('0x0'));var util=require('util');var path=require(_0x09f2('0x1'));var timeout=require(_0x09f2('0x2'));var express=require(_0x09f2('0x3'));var router=express[_0x09f2('0x4')]();var auth=require(_0x09f2('0x5'));var interaction=require(_0x09f2('0x6'));var config=require(_0x09f2('0x7'));var controller=require('./chatQueue.controller');router[_0x09f2('0x8')]('/',auth[_0x09f2('0x9')](),controller[_0x09f2('0xa')]);router[_0x09f2('0x8')]('/describe',auth[_0x09f2('0x9')](),controller[_0x09f2('0xb')]);router['get']('/:id',auth[_0x09f2('0x9')](),controller[_0x09f2('0xc')]);router[_0x09f2('0x8')](_0x09f2('0xd'),auth[_0x09f2('0x9')](),controller[_0x09f2('0xe')]);router[_0x09f2('0x8')](_0x09f2('0xf'),auth[_0x09f2('0x9')](),controller['getTeams']);router[_0x09f2('0x8')](_0x09f2('0x10'),auth[_0x09f2('0x9')](),controller[_0x09f2('0x11')]);router[_0x09f2('0x12')]('/',auth[_0x09f2('0x9')](),controller[_0x09f2('0x13')]);router[_0x09f2('0x12')](_0x09f2('0xf'),auth[_0x09f2('0x9')](),controller[_0x09f2('0x14')]);router[_0x09f2('0x12')](_0x09f2('0x10'),auth[_0x09f2('0x9')](),controller[_0x09f2('0x15')]);router['put'](_0x09f2('0x16'),auth[_0x09f2('0x9')](),controller['update']);router[_0x09f2('0x17')](_0x09f2('0x16'),auth[_0x09f2('0x9')](),controller[_0x09f2('0x18')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x09f2('0x19')]);router[_0x09f2('0x17')](_0x09f2('0x10'),auth[_0x09f2('0x9')](),controller['removeAgents']);module[_0x09f2('0x1a')]=router; \ No newline at end of file +var _0x6d57=['show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','index','/describe','/:id','isAuthenticated'];(function(_0x1cf1ea,_0x2b5725){var _0x5b87ba=function(_0x6bb430){while(--_0x6bb430){_0x1cf1ea['push'](_0x1cf1ea['shift']());}};_0x5b87ba(++_0x2b5725);}(_0x6d57,0x10c));var _0x76d5=function(_0x56e1b7,_0x376069){_0x56e1b7=_0x56e1b7-0x0;var _0x586721=_0x6d57[_0x56e1b7];return _0x586721;};'use strict';var multer=require(_0x76d5('0x0'));var util=require(_0x76d5('0x1'));var path=require(_0x76d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x76d5('0x3'));var router=express['Router']();var auth=require(_0x76d5('0x4'));var interaction=require(_0x76d5('0x5'));var config=require('../../config/environment');var controller=require(_0x76d5('0x6'));router[_0x76d5('0x7')]('/',auth['isAuthenticated'](),controller[_0x76d5('0x8')]);router[_0x76d5('0x7')](_0x76d5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x76d5('0x7')](_0x76d5('0xa'),auth[_0x76d5('0xb')](),controller[_0x76d5('0xc')]);router[_0x76d5('0x7')](_0x76d5('0xd'),auth['isAuthenticated'](),controller[_0x76d5('0xe')]);router['get']('/:id/teams',auth[_0x76d5('0xb')](),controller[_0x76d5('0xf')]);router['get'](_0x76d5('0x10'),auth['isAuthenticated'](),controller[_0x76d5('0x11')]);router[_0x76d5('0x12')]('/',auth[_0x76d5('0xb')](),controller['create']);router[_0x76d5('0x12')](_0x76d5('0x13'),auth[_0x76d5('0xb')](),controller[_0x76d5('0x14')]);router[_0x76d5('0x12')](_0x76d5('0x10'),auth[_0x76d5('0xb')](),controller['addAgents']);router[_0x76d5('0x15')]('/:id',auth[_0x76d5('0xb')](),controller[_0x76d5('0x16')]);router[_0x76d5('0x17')](_0x76d5('0xa'),auth['isAuthenticated'](),controller[_0x76d5('0x18')]);router[_0x76d5('0x17')](_0x76d5('0x13'),auth['isAuthenticated'](),controller[_0x76d5('0x19')]);router[_0x76d5('0x17')](_0x76d5('0x10'),auth['isAuthenticated'](),controller[_0x76d5('0x1a')]);module[_0x76d5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b7441c6..8d460a8 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 _0xd1c9=['DATE','moment','exports','STRING'];(function(_0x3c2f11,_0x44fc28){var _0x3bfbeb=function(_0x478b4d){while(--_0x478b4d){_0x3c2f11['push'](_0x3c2f11['shift']());}};_0x3bfbeb(++_0x44fc28);}(_0xd1c9,0x7d));var _0x9d1c=function(_0x3d0c0a,_0x569519){_0x3d0c0a=_0x3d0c0a-0x0;var _0x338e0e=_0xd1c9[_0x3d0c0a];return _0x338e0e;};'use strict';var moment=require(_0x9d1c('0x0'));var Sequelize=require('sequelize');module[_0x9d1c('0x1')]={'uniqueid':{'type':Sequelize[_0x9d1c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9d1c('0x2')]},'joinAt':{'type':Sequelize[_0x9d1c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9d1c('0x3')]},'reason':{'type':Sequelize[_0x9d1c('0x2')]}}; \ No newline at end of file +var _0x8a89=['STRING','DATE','moment','sequelize','exports'];(function(_0x933acd,_0x5794fb){var _0x1e1f6b=function(_0x2a07cc){while(--_0x2a07cc){_0x933acd['push'](_0x933acd['shift']());}};_0x1e1f6b(++_0x5794fb);}(_0x8a89,0x16a));var _0x98a8=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x8a89[_0x7148a3];return _0x52f31d;};'use strict';var moment=require(_0x98a8('0x0'));var Sequelize=require(_0x98a8('0x1'));module[_0x98a8('0x2')]={'uniqueid':{'type':Sequelize[_0x98a8('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x98a8('0x4')]},'leaveAt':{'type':Sequelize[_0x98a8('0x4')]},'acceptAt':{'type':Sequelize[_0x98a8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 487d683..25346e4 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 _0x426a=['VIRTUAL','merge','includeAll','rows','catch','show','params','keys','intersection','length','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x59d061,_0x2a4f5f){var _0x3d14c2=function(_0x4e14a9){while(--_0x4e14a9){_0x59d061['push'](_0x59d061['shift']());}};_0x3d14c2(++_0x2a4f5f);}(_0x426a,0x1ad));var _0xa426=function(_0x4a8b20,_0x484fdb){_0x4a8b20=_0x4a8b20-0x0;var _0x4e1289=_0x426a[_0x4a8b20];return _0x4e1289;};'use strict';var pdf=require(_0xa426('0x0'));var emlformat=require(_0xa426('0x1'));var rimraf=require(_0xa426('0x2'));var zipdir=require(_0xa426('0x3'));var jsonpatch=require(_0xa426('0x4'));var rp=require('request-promise');var moment=require(_0xa426('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa426('0x6'));var util=require(_0xa426('0x7'));var path=require(_0xa426('0x8'));var sox=require(_0xa426('0x9'));var csv=require(_0xa426('0xa'));var ejs=require(_0xa426('0xb'));var fs=require('fs');var _=require(_0xa426('0xc'));var squel=require(_0xa426('0xd'));var crypto=require('crypto');var jsforce=require(_0xa426('0xe'));var deskjs=require(_0xa426('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa426('0x10'));var as=require(_0xa426('0x11'));var hardwareService=require(_0xa426('0x12'));var logger=require(_0xa426('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa426('0x14'));var db=require(_0xa426('0x15'))['db'];function respondWithStatusCode(_0x327ac5,_0xaaaf2e){_0xaaaf2e=_0xaaaf2e||0xcc;return function(_0x1595e1){if(_0x1595e1){return _0x327ac5[_0xa426('0x16')](_0xaaaf2e);}return _0x327ac5[_0xa426('0x17')](_0xaaaf2e)[_0xa426('0x18')]();};}function respondWithResult(_0x11afa7,_0x3ff0e4){_0x3ff0e4=_0x3ff0e4||0xc8;return function(_0x5bca16){if(_0x5bca16){return _0x11afa7[_0xa426('0x17')](_0x3ff0e4)[_0xa426('0x19')](_0x5bca16);}};}function respondWithFilteredResult(_0x52ee3e,_0x2ca1e4){return function(_0x4eafda){if(_0x4eafda){var _0x26658f=_0x4eafda[_0xa426('0x1a')],_0x3049d7=_0x2ca1e4['offset'],_0xe30715=_0x2ca1e4[_0xa426('0x1b')]+_0x2ca1e4[_0xa426('0x1c')],_0x36ce5e;if(_0xe30715>=_0x26658f){_0xe30715=_0x26658f;_0x36ce5e=0xc8;}else{_0x36ce5e=0xce;}_0x52ee3e[_0xa426('0x17')](_0x36ce5e);return _0x52ee3e['set'](_0xa426('0x1d'),_0x3049d7+'-'+_0xe30715+'/'+_0x26658f)[_0xa426('0x19')](_0x4eafda);}return null;};}function patchUpdates(_0x4037d1){return function(_0x1b5a6f){try{jsonpatch[_0xa426('0x1e')](_0x1b5a6f,_0x4037d1,!![]);}catch(_0x2f3069){return BPromise['reject'](_0x2f3069);}return _0x1b5a6f[_0xa426('0x1f')]();};}function saveUpdates(_0x406d97,_0x1ac1fb){return function(_0x1ee1bf){if(_0x1ee1bf){return _0x1ee1bf[_0xa426('0x20')](_0x406d97)[_0xa426('0x21')](function(_0x1553fc){return _0x1553fc;});}return null;};}function removeEntity(_0x590379,_0x147027){return function(_0x53179c){if(_0x53179c){return _0x53179c['destroy']()['then'](function(){_0x590379[_0xa426('0x17')](0xcc)[_0xa426('0x18')]();});}};}function handleEntityNotFound(_0x16ff5a,_0x32c7bc){return function(_0x7839f2){if(!_0x7839f2){_0x16ff5a[_0xa426('0x16')](0x194);}return _0x7839f2;};}function handleError(_0xbb42b5,_0x18d7dc){_0x18d7dc=_0x18d7dc||0x1f4;return function(_0x20dd6b){logger['error'](_0x20dd6b['stack']);if(_0x20dd6b['name']){delete _0x20dd6b[_0xa426('0x22')];}_0xbb42b5[_0xa426('0x17')](_0x18d7dc)['send'](_0x20dd6b);};}exports[_0xa426('0x23')]=function(_0x1c4c14,_0x582089){var _0x5248f2={},_0x4368aa={},_0x4ab493={'count':0x0,'rows':[]};var _0x1a6c5d=_[_0xa426('0x24')](db[_0xa426('0x25')][_0xa426('0x26')],function(_0x35828d){return{'name':_0x35828d[_0xa426('0x27')],'type':_0x35828d[_0xa426('0x28')][_0xa426('0x29')]};});_0x4368aa[_0xa426('0x2a')]=_[_0xa426('0x24')](_0x1a6c5d,_0xa426('0x22'));_0x4368aa[_0xa426('0x2b')]=_['keys'](_0x1c4c14[_0xa426('0x2b')]);_0x4368aa['filters']=_['intersection'](_0x4368aa['model'],_0x4368aa['query']);_0x5248f2[_0xa426('0x2c')]=_['intersection'](_0x4368aa['model'],qs[_0xa426('0x2d')](_0x1c4c14[_0xa426('0x2b')][_0xa426('0x2d')]));_0x5248f2[_0xa426('0x2c')]=_0x5248f2[_0xa426('0x2c')]['length']?_0x5248f2[_0xa426('0x2c')]:_0x4368aa[_0xa426('0x2a')];if(!_0x1c4c14[_0xa426('0x2b')][_0xa426('0x2e')](_0xa426('0x2f'))){_0x5248f2[_0xa426('0x1c')]=qs[_0xa426('0x1c')](_0x1c4c14[_0xa426('0x2b')][_0xa426('0x1c')]);_0x5248f2[_0xa426('0x1b')]=qs[_0xa426('0x1b')](_0x1c4c14[_0xa426('0x2b')][_0xa426('0x1b')]);}_0x5248f2[_0xa426('0x30')]=qs[_0xa426('0x31')](_0x1c4c14[_0xa426('0x2b')][_0xa426('0x31')]);_0x5248f2[_0xa426('0x32')]=qs[_0xa426('0x33')](_[_0xa426('0x34')](_0x1c4c14[_0xa426('0x2b')],_0x4368aa[_0xa426('0x33')]),_0x1a6c5d);if(_0x1c4c14[_0xa426('0x2b')][_0xa426('0x35')]){_0x5248f2[_0xa426('0x32')]=_['merge'](_0x5248f2[_0xa426('0x32')],{'$or':_[_0xa426('0x24')](_0x1a6c5d,function(_0x440ad1){if(_0x440ad1[_0xa426('0x28')]!==_0xa426('0x36')){var _0x1e0bf3={};_0x1e0bf3[_0x440ad1[_0xa426('0x22')]]={'$like':'%'+_0x1c4c14[_0xa426('0x2b')]['filter']+'%'};return _0x1e0bf3;}})});}_0x5248f2=_[_0xa426('0x37')]({},_0x5248f2,_0x1c4c14['options']);var _0x37aa13={'where':_0x5248f2[_0xa426('0x32')]};return db[_0xa426('0x25')]['count'](_0x37aa13)[_0xa426('0x21')](function(_0x96db37){_0x4ab493[_0xa426('0x1a')]=_0x96db37;if(_0x1c4c14['query'][_0xa426('0x38')]){_0x5248f2['include']=[{'all':!![]}];}return db[_0xa426('0x25')]['findAll'](_0x5248f2);})[_0xa426('0x21')](function(_0x5c6495){_0x4ab493[_0xa426('0x39')]=_0x5c6495;return _0x4ab493;})[_0xa426('0x21')](respondWithFilteredResult(_0x582089,_0x5248f2))[_0xa426('0x3a')](handleError(_0x582089,null));};exports[_0xa426('0x3b')]=function(_0x28304d,_0x31d87e){var _0x5633f7={'raw':!![],'where':{'id':_0x28304d[_0xa426('0x3c')]['id']}},_0x3fcebf={};_0x3fcebf[_0xa426('0x2a')]=_[_0xa426('0x3d')](db['ChatQueueReport'][_0xa426('0x26')]);_0x3fcebf['query']=_[_0xa426('0x3d')](_0x28304d[_0xa426('0x2b')]);_0x3fcebf[_0xa426('0x33')]=_[_0xa426('0x3e')](_0x3fcebf[_0xa426('0x2a')],_0x3fcebf[_0xa426('0x2b')]);_0x5633f7[_0xa426('0x2c')]=_[_0xa426('0x3e')](_0x3fcebf[_0xa426('0x2a')],qs[_0xa426('0x2d')](_0x28304d[_0xa426('0x2b')][_0xa426('0x2d')]));_0x5633f7[_0xa426('0x2c')]=_0x5633f7[_0xa426('0x2c')][_0xa426('0x3f')]?_0x5633f7[_0xa426('0x2c')]:_0x3fcebf['model'];if(_0x28304d[_0xa426('0x2b')][_0xa426('0x38')]){_0x5633f7[_0xa426('0x40')]=[{'all':!![]}];}_0x5633f7=_[_0xa426('0x37')]({},_0x5633f7,_0x28304d[_0xa426('0x41')]);return db['ChatQueueReport'][_0xa426('0x42')](_0x5633f7)['then'](handleEntityNotFound(_0x31d87e,null))[_0xa426('0x21')](respondWithResult(_0x31d87e,null))[_0xa426('0x3a')](handleError(_0x31d87e,null));};exports[_0xa426('0x43')]=function(_0x2d7801,_0x10d5d4){return db[_0xa426('0x25')][_0xa426('0x43')](_0x2d7801[_0xa426('0x44')],{})['then'](respondWithResult(_0x10d5d4,0xc9))[_0xa426('0x3a')](handleError(_0x10d5d4,null));};exports[_0xa426('0x20')]=function(_0x4d1818,_0x31b30b){if(_0x4d1818[_0xa426('0x44')]['id']){delete _0x4d1818['body']['id'];}return db[_0xa426('0x25')][_0xa426('0x42')]({'where':{'id':_0x4d1818['params']['id']}})[_0xa426('0x21')](handleEntityNotFound(_0x31b30b,null))['then'](saveUpdates(_0x4d1818[_0xa426('0x44')],null))[_0xa426('0x21')](respondWithResult(_0x31b30b,null))[_0xa426('0x3a')](handleError(_0x31b30b,null));};exports['destroy']=function(_0x21c801,_0x15a513){return db[_0xa426('0x25')][_0xa426('0x42')]({'where':{'id':_0x21c801[_0xa426('0x3c')]['id']}})[_0xa426('0x21')](handleEntityNotFound(_0x15a513,null))['then'](removeEntity(_0x15a513,null))[_0xa426('0x3a')](handleError(_0x15a513,null));};exports['describe']=function(_0x5a686a,_0xf18cac){return db[_0xa426('0x25')]['describe']()[_0xa426('0x21')](respondWithResult(_0xf18cac,null))[_0xa426('0x3a')](handleError(_0xf18cac,null));}; \ No newline at end of file +var _0x87f3=['options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x87f3,0xa7));var _0x387f=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x87f3[_0x3c4f1f];return _0x19cb69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x387f('0x0'));var rimraf=require(_0x387f('0x1'));var zipdir=require(_0x387f('0x2'));var jsonpatch=require(_0x387f('0x3'));var rp=require('request-promise');var moment=require(_0x387f('0x4'));var BPromise=require(_0x387f('0x5'));var Mustache=require(_0x387f('0x6'));var util=require('util');var path=require(_0x387f('0x7'));var sox=require(_0x387f('0x8'));var csv=require(_0x387f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x387f('0xa'));var squel=require(_0x387f('0xb'));var crypto=require(_0x387f('0xc'));var jsforce=require(_0x387f('0xd'));var deskjs=require(_0x387f('0xe'));var toCsv=require(_0x387f('0x9'));var querystring=require(_0x387f('0xf'));var Papa=require(_0x387f('0x10'));var Redis=require(_0x387f('0x11'));var authService=require(_0x387f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x387f('0x13'));var hardwareService=require(_0x387f('0x14'));var logger=require(_0x387f('0x15'))(_0x387f('0x16'));var utils=require('../../config/utils');var config=require(_0x387f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x387f('0x18'))['db'];function respondWithStatusCode(_0x13ba99,_0x3c06f2){_0x3c06f2=_0x3c06f2||0xcc;return function(_0x5171e5){if(_0x5171e5){return _0x13ba99[_0x387f('0x19')](_0x3c06f2);}return _0x13ba99[_0x387f('0x1a')](_0x3c06f2)['end']();};}function respondWithResult(_0x44014e,_0x26d589){_0x26d589=_0x26d589||0xc8;return function(_0x18d7ee){if(_0x18d7ee){return _0x44014e['status'](_0x26d589)[_0x387f('0x1b')](_0x18d7ee);}};}function respondWithFilteredResult(_0x20985c,_0x3e826c){return function(_0x293039){if(_0x293039){var _0x54275d=_0x293039[_0x387f('0x1c')],_0x197560=_0x3e826c[_0x387f('0x1d')],_0x153d95=_0x3e826c['offset']+_0x3e826c[_0x387f('0x1e')],_0x44cdc6;if(_0x153d95>=_0x54275d){_0x153d95=_0x54275d;_0x44cdc6=0xc8;}else{_0x44cdc6=0xce;}_0x20985c[_0x387f('0x1a')](_0x44cdc6);return _0x20985c[_0x387f('0x1f')](_0x387f('0x20'),_0x197560+'-'+_0x153d95+'/'+_0x54275d)['json'](_0x293039);}return null;};}function patchUpdates(_0x1d6c7a){return function(_0x15694c){try{jsonpatch[_0x387f('0x21')](_0x15694c,_0x1d6c7a,!![]);}catch(_0x5bf7bd){return BPromise['reject'](_0x5bf7bd);}return _0x15694c[_0x387f('0x22')]();};}function saveUpdates(_0x5974d9,_0x5e1d96){return function(_0x22e155){if(_0x22e155){return _0x22e155[_0x387f('0x23')](_0x5974d9)[_0x387f('0x24')](function(_0x402301){return _0x402301;});}return null;};}function removeEntity(_0x5eca5b,_0x5a8188){return function(_0x3ec2cf){if(_0x3ec2cf){return _0x3ec2cf[_0x387f('0x25')]()[_0x387f('0x24')](function(){_0x5eca5b['status'](0xcc)[_0x387f('0x26')]();});}};}function handleEntityNotFound(_0x2d9e00,_0x1dfc23){return function(_0x574ec9){if(!_0x574ec9){_0x2d9e00[_0x387f('0x19')](0x194);}return _0x574ec9;};}function handleError(_0x1c4b1e,_0x5701e5){_0x5701e5=_0x5701e5||0x1f4;return function(_0x5a2829){logger[_0x387f('0x27')](_0x5a2829[_0x387f('0x28')]);if(_0x5a2829[_0x387f('0x29')]){delete _0x5a2829['name'];}_0x1c4b1e[_0x387f('0x1a')](_0x5701e5)[_0x387f('0x2a')](_0x5a2829);};}exports[_0x387f('0x2b')]=function(_0x550808,_0x3b3fd9){var _0x1dbaeb={},_0x1d6c28={},_0x2af94a={'count':0x0,'rows':[]};var _0x4be908=_[_0x387f('0x2c')](db[_0x387f('0x2d')]['rawAttributes'],function(_0x3c126b){return{'name':_0x3c126b[_0x387f('0x2e')],'type':_0x3c126b[_0x387f('0x2f')][_0x387f('0x30')]};});_0x1d6c28[_0x387f('0x31')]=_[_0x387f('0x2c')](_0x4be908,_0x387f('0x29'));_0x1d6c28[_0x387f('0x32')]=_[_0x387f('0x33')](_0x550808[_0x387f('0x32')]);_0x1d6c28[_0x387f('0x34')]=_['intersection'](_0x1d6c28[_0x387f('0x31')],_0x1d6c28['query']);_0x1dbaeb[_0x387f('0x35')]=_[_0x387f('0x36')](_0x1d6c28['model'],qs['fields'](_0x550808[_0x387f('0x32')][_0x387f('0x37')]));_0x1dbaeb[_0x387f('0x35')]=_0x1dbaeb[_0x387f('0x35')]['length']?_0x1dbaeb['attributes']:_0x1d6c28['model'];if(!_0x550808['query'][_0x387f('0x38')](_0x387f('0x39'))){_0x1dbaeb['limit']=qs[_0x387f('0x1e')](_0x550808[_0x387f('0x32')][_0x387f('0x1e')]);_0x1dbaeb['offset']=qs[_0x387f('0x1d')](_0x550808[_0x387f('0x32')]['offset']);}_0x1dbaeb[_0x387f('0x3a')]=qs[_0x387f('0x3b')](_0x550808[_0x387f('0x32')]['sort']);_0x1dbaeb[_0x387f('0x3c')]=qs[_0x387f('0x34')](_['pick'](_0x550808[_0x387f('0x32')],_0x1d6c28[_0x387f('0x34')]),_0x4be908);if(_0x550808[_0x387f('0x32')][_0x387f('0x3d')]){_0x1dbaeb['where']=_[_0x387f('0x3e')](_0x1dbaeb[_0x387f('0x3c')],{'$or':_[_0x387f('0x2c')](_0x4be908,function(_0x19535b){if(_0x19535b[_0x387f('0x2f')]!==_0x387f('0x3f')){var _0x5cb9c2={};_0x5cb9c2[_0x19535b[_0x387f('0x29')]]={'$like':'%'+_0x550808[_0x387f('0x32')][_0x387f('0x3d')]+'%'};return _0x5cb9c2;}})});}_0x1dbaeb=_[_0x387f('0x3e')]({},_0x1dbaeb,_0x550808[_0x387f('0x40')]);var _0x55e3a0={'where':_0x1dbaeb[_0x387f('0x3c')]};return db['ChatQueueReport'][_0x387f('0x1c')](_0x55e3a0)['then'](function(_0x2c0ed1){_0x2af94a[_0x387f('0x1c')]=_0x2c0ed1;if(_0x550808[_0x387f('0x32')][_0x387f('0x41')]){_0x1dbaeb[_0x387f('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x387f('0x43')](_0x1dbaeb);})['then'](function(_0x308b4d){_0x2af94a[_0x387f('0x44')]=_0x308b4d;return _0x2af94a;})[_0x387f('0x24')](respondWithFilteredResult(_0x3b3fd9,_0x1dbaeb))['catch'](handleError(_0x3b3fd9,null));};exports[_0x387f('0x45')]=function(_0x188d63,_0x16d02a){var _0x3ca5b7={'raw':!![],'where':{'id':_0x188d63[_0x387f('0x46')]['id']}},_0x27b163={};_0x27b163[_0x387f('0x31')]=_[_0x387f('0x33')](db[_0x387f('0x2d')]['rawAttributes']);_0x27b163[_0x387f('0x32')]=_[_0x387f('0x33')](_0x188d63[_0x387f('0x32')]);_0x27b163[_0x387f('0x34')]=_['intersection'](_0x27b163[_0x387f('0x31')],_0x27b163[_0x387f('0x32')]);_0x3ca5b7[_0x387f('0x35')]=_['intersection'](_0x27b163['model'],qs[_0x387f('0x37')](_0x188d63['query']['fields']));_0x3ca5b7[_0x387f('0x35')]=_0x3ca5b7[_0x387f('0x35')][_0x387f('0x47')]?_0x3ca5b7[_0x387f('0x35')]:_0x27b163[_0x387f('0x31')];if(_0x188d63[_0x387f('0x32')]['includeAll']){_0x3ca5b7[_0x387f('0x42')]=[{'all':!![]}];}_0x3ca5b7=_[_0x387f('0x3e')]({},_0x3ca5b7,_0x188d63[_0x387f('0x40')]);return db[_0x387f('0x2d')][_0x387f('0x48')](_0x3ca5b7)[_0x387f('0x24')](handleEntityNotFound(_0x16d02a,null))[_0x387f('0x24')](respondWithResult(_0x16d02a,null))['catch'](handleError(_0x16d02a,null));};exports['create']=function(_0x12e307,_0x58c0a7){return db['ChatQueueReport'][_0x387f('0x49')](_0x12e307[_0x387f('0x4a')],{})[_0x387f('0x24')](respondWithResult(_0x58c0a7,0xc9))[_0x387f('0x4b')](handleError(_0x58c0a7,null));};exports[_0x387f('0x23')]=function(_0x2c9f14,_0x680de0){if(_0x2c9f14[_0x387f('0x4a')]['id']){delete _0x2c9f14[_0x387f('0x4a')]['id'];}return db[_0x387f('0x2d')][_0x387f('0x48')]({'where':{'id':_0x2c9f14['params']['id']}})['then'](handleEntityNotFound(_0x680de0,null))[_0x387f('0x24')](saveUpdates(_0x2c9f14[_0x387f('0x4a')],null))[_0x387f('0x24')](respondWithResult(_0x680de0,null))[_0x387f('0x4b')](handleError(_0x680de0,null));};exports['destroy']=function(_0x36f7b1,_0x151c21){return db[_0x387f('0x2d')][_0x387f('0x48')]({'where':{'id':_0x36f7b1['params']['id']}})[_0x387f('0x24')](handleEntityNotFound(_0x151c21,null))[_0x387f('0x24')](removeEntity(_0x151c21,null))[_0x387f('0x4b')](handleError(_0x151c21,null));};exports[_0x387f('0x4c')]=function(_0x1c0fe3,_0x3b2b49){return db[_0x387f('0x2d')]['describe']()[_0x387f('0x24')](respondWithResult(_0x3b2b49,null))[_0x387f('0x4b')](handleError(_0x3b2b49,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 55bc35f..2d39f55 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 _0x7a63=['exports','ChatQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x270cd2,_0x56fab5){var _0x58d282=function(_0x386797){while(--_0x386797){_0x270cd2['push'](_0x270cd2['shift']());}};_0x58d282(++_0x56fab5);}(_0x7a63,0x1d7));var _0x37a6=function(_0x1378a8,_0x1500d6){_0x1378a8=_0x1378a8-0x0;var _0x3767f2=_0x7a63[_0x1378a8];return _0x3767f2;};'use strict';var _=require(_0x37a6('0x0'));var util=require(_0x37a6('0x1'));var logger=require(_0x37a6('0x2'))(_0x37a6('0x3'));var moment=require(_0x37a6('0x4'));var BPromise=require(_0x37a6('0x5'));var rp=require(_0x37a6('0x6'));var fs=require('fs');var path=require(_0x37a6('0x7'));var rimraf=require(_0x37a6('0x8'));var config=require(_0x37a6('0x9'));var attributes=require('./chatQueueReport.attributes');module[_0x37a6('0xa')]=function(_0x40be93,_0x4a66d6){return _0x40be93['define'](_0x37a6('0xb'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x37a6('0xc'),'fields':[_0x37a6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e74=['exports','define','ChatQueueReport','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x7e74,0x12c));var _0x47e7=function(_0x40ef91,_0x1fe64e){_0x40ef91=_0x40ef91-0x0;var _0x240dd=_0x7e74[_0x40ef91];return _0x240dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x47e7('0x0'))('api');var moment=require(_0x47e7('0x1'));var BPromise=require(_0x47e7('0x2'));var rp=require(_0x47e7('0x3'));var fs=require('fs');var path=require(_0x47e7('0x4'));var rimraf=require(_0x47e7('0x5'));var config=require(_0x47e7('0x6'));var attributes=require(_0x47e7('0x7'));module[_0x47e7('0x8')]=function(_0x3dfc12,_0x10fc80){return _0x3dfc12[_0x47e7('0x9')](_0x47e7('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7e7a1bb..a069baf 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 _0x5f91=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','where','limit','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x4dfd8a,_0x476a02){var _0x5aeac9=function(_0x3aa276){while(--_0x3aa276){_0x4dfd8a['push'](_0x4dfd8a['shift']());}};_0x5aeac9(++_0x476a02);}(_0x5f91,0x8c));var _0x15f9=function(_0x208bf0,_0x24abcc){_0x208bf0=_0x208bf0-0x0;var _0x4e554e=_0x5f91[_0x208bf0];return _0x4e554e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x15f9('0x0'));var BPromise=require(_0x15f9('0x1'));var rs=require(_0x15f9('0x2'));var fs=require('fs');var Redis=require(_0x15f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x15f9('0x4'));var logger=require(_0x15f9('0x5'))(_0x15f9('0x6'));var config=require(_0x15f9('0x7'));var jayson=require(_0x15f9('0x8'));var client=jayson[_0x15f9('0x9')][_0x15f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5751e0,_0x5edd70,_0x4f767b){return new BPromise(function(_0x355e8d,_0x5a88d5){return client[_0x15f9('0xb')](_0x5751e0,_0x4f767b)[_0x15f9('0xc')](function(_0x117a75){logger[_0x15f9('0xd')](_0x15f9('0xe'),_0x5edd70,'request\x20sent');logger[_0x15f9('0xf')](_0x15f9('0x10'),_0x5edd70,_0x15f9('0x11'),JSON[_0x15f9('0x12')](_0x117a75));if(_0x117a75['error']){if(_0x117a75[_0x15f9('0x13')]['code']===0x1f4){logger['error'](_0x15f9('0xe'),_0x5edd70,_0x117a75[_0x15f9('0x13')][_0x15f9('0x14')]);return _0x5a88d5(_0x117a75['error'][_0x15f9('0x14')]);}logger[_0x15f9('0x13')](_0x15f9('0xe'),_0x5edd70,_0x117a75[_0x15f9('0x13')][_0x15f9('0x14')]);return _0x355e8d(_0x117a75[_0x15f9('0x13')][_0x15f9('0x14')]);}else{logger[_0x15f9('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x5edd70,'request\x20sent');_0x355e8d(_0x117a75['result'][_0x15f9('0x14')]);}})[_0x15f9('0x15')](function(_0x432253){logger[_0x15f9('0x13')](_0x15f9('0xe'),_0x5edd70,_0x432253);_0x5a88d5(_0x432253);});});}exports[_0x15f9('0x16')]=function(_0x2ab996){var _0x2fcd65=this;return new Promise(function(_0x13a0cf,_0x2b2970){return db[_0x15f9('0x17')][_0x15f9('0x18')](_0x2ab996[_0x15f9('0x19')],{'raw':_0x2ab996[_0x15f9('0x1a')]?_0x2ab996[_0x15f9('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2511c4){logger[_0x15f9('0xd')](_0x15f9('0x16'),_0x2ab996);logger[_0x15f9('0xf')](_0x15f9('0x16'),_0x2ab996,JSON[_0x15f9('0x12')](_0x2511c4));_0x13a0cf(_0x2511c4);})[_0x15f9('0x15')](function(_0x5eaebb){logger['error']('CreateChatQueueReport',_0x5eaebb[_0x15f9('0x14')],_0x2ab996);_0x2b2970(_0x2fcd65[_0x15f9('0x13')](0x1f4,_0x5eaebb[_0x15f9('0x14')]));});});};exports[_0x15f9('0x1b')]=function(_0x9caf96){var _0x24968d=this;return new Promise(function(_0x8771e7,_0x44b82a){return db['ChatQueueReport'][_0x15f9('0x1c')](_0x9caf96[_0x15f9('0x19')],{'raw':_0x9caf96[_0x15f9('0x1a')]?_0x9caf96[_0x15f9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9caf96[_0x15f9('0x1a')]?_0x9caf96['options'][_0x15f9('0x1d')]||null:null,'attributes':_0x9caf96['options']?_0x9caf96[_0x15f9('0x1a')]['attributes']||null:null,'limit':_0x9caf96['options']?_0x9caf96['options'][_0x15f9('0x1e')]||null:null})[_0x15f9('0xc')](function(_0x4b50d1){logger[_0x15f9('0xd')](_0x15f9('0x1b'),_0x9caf96);logger[_0x15f9('0xf')](_0x15f9('0x1b'),_0x9caf96,JSON[_0x15f9('0x12')](_0x4b50d1));_0x8771e7(_0x4b50d1);})['catch'](function(_0x33c542){logger['error']('UpdateChatQueueReport',_0x33c542[_0x15f9('0x14')],_0x9caf96);_0x44b82a(_0x24968d[_0x15f9('0x13')](0x1f4,_0x33c542[_0x15f9('0x14')]));});});}; \ No newline at end of file +var _0x9501=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','stringify','UpdateChatQueueReport','update','body','where','attributes','lodash','util','moment','bluebird'];(function(_0x227be9,_0x29750e){var _0x2680b3=function(_0x277c42){while(--_0x277c42){_0x227be9['push'](_0x227be9['shift']());}};_0x2680b3(++_0x29750e);}(_0x9501,0xea));var _0x1950=function(_0x21359f,_0x32b494){_0x21359f=_0x21359f-0x0;var _0x52b21e=_0x9501[_0x21359f];return _0x52b21e;};'use strict';var _=require(_0x1950('0x0'));var util=require(_0x1950('0x1'));var moment=require(_0x1950('0x2'));var BPromise=require(_0x1950('0x3'));var rs=require(_0x1950('0x4'));var fs=require('fs');var Redis=require(_0x1950('0x5'));var db=require(_0x1950('0x6'))['db'];var utils=require(_0x1950('0x7'));var logger=require(_0x1950('0x8'))(_0x1950('0x9'));var config=require(_0x1950('0xa'));var jayson=require(_0x1950('0xb'));var client=jayson[_0x1950('0xc')][_0x1950('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x554367,_0x62c291,_0x1ed2aa){return new BPromise(function(_0x20a66b,_0xedb021){return client['request'](_0x554367,_0x1ed2aa)[_0x1950('0xe')](function(_0x29662b){logger['info'](_0x1950('0xf'),_0x62c291,'request\x20sent');logger[_0x1950('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x62c291,_0x1950('0x11'),JSON['stringify'](_0x29662b));if(_0x29662b[_0x1950('0x12')]){if(_0x29662b['error'][_0x1950('0x13')]===0x1f4){logger[_0x1950('0x12')](_0x1950('0xf'),_0x62c291,_0x29662b[_0x1950('0x12')][_0x1950('0x14')]);return _0xedb021(_0x29662b[_0x1950('0x12')]['message']);}logger[_0x1950('0x12')](_0x1950('0xf'),_0x62c291,_0x29662b[_0x1950('0x12')][_0x1950('0x14')]);return _0x20a66b(_0x29662b[_0x1950('0x12')][_0x1950('0x14')]);}else{logger[_0x1950('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x62c291,_0x1950('0x11'));_0x20a66b(_0x29662b[_0x1950('0x16')][_0x1950('0x14')]);}})[_0x1950('0x17')](function(_0x14f4dd){logger[_0x1950('0x12')](_0x1950('0xf'),_0x62c291,_0x14f4dd);_0xedb021(_0x14f4dd);});});}exports[_0x1950('0x18')]=function(_0x5a3688){var _0x29e61b=this;return new Promise(function(_0x5b9893,_0x572ced){return db[_0x1950('0x19')][_0x1950('0x1a')](_0x5a3688['body'],{'raw':_0x5a3688[_0x1950('0x1b')]?_0x5a3688[_0x1950('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x1950('0xe')](function(_0x279cdf){logger[_0x1950('0x15')](_0x1950('0x18'),_0x5a3688);logger[_0x1950('0x10')](_0x1950('0x18'),_0x5a3688,JSON[_0x1950('0x1c')](_0x279cdf));_0x5b9893(_0x279cdf);})[_0x1950('0x17')](function(_0x1c31ab){logger['error'](_0x1950('0x18'),_0x1c31ab[_0x1950('0x14')],_0x5a3688);_0x572ced(_0x29e61b[_0x1950('0x12')](0x1f4,_0x1c31ab['message']));});});};exports[_0x1950('0x1d')]=function(_0x3dee54){var _0x3ded95=this;return new Promise(function(_0x100b2f,_0x5df8c7){return db[_0x1950('0x19')][_0x1950('0x1e')](_0x3dee54[_0x1950('0x1f')],{'raw':_0x3dee54['options']?_0x3dee54[_0x1950('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dee54[_0x1950('0x1b')]?_0x3dee54[_0x1950('0x1b')][_0x1950('0x20')]||null:null,'attributes':_0x3dee54[_0x1950('0x1b')]?_0x3dee54[_0x1950('0x1b')][_0x1950('0x21')]||null:null,'limit':_0x3dee54[_0x1950('0x1b')]?_0x3dee54[_0x1950('0x1b')]['limit']||null:null})['then'](function(_0x2d57f5){logger[_0x1950('0x15')](_0x1950('0x1d'),_0x3dee54);logger[_0x1950('0x10')](_0x1950('0x1d'),_0x3dee54,JSON['stringify'](_0x2d57f5));_0x100b2f(_0x2d57f5);})[_0x1950('0x17')](function(_0x58bad7){logger[_0x1950('0x12')](_0x1950('0x1d'),_0x58bad7[_0x1950('0x14')],_0x3dee54);_0x5df8c7(_0x3ded95[_0x1950('0x12')](0x1f4,_0x58bad7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 58a2613..d665598 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 _0x8a00=['../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x64bdb3,_0x4ad6eb){var _0x35a587=function(_0x3cc2a4){while(--_0x3cc2a4){_0x64bdb3['push'](_0x64bdb3['shift']());}};_0x35a587(++_0x4ad6eb);}(_0x8a00,0x126));var _0x08a0=function(_0x3448f9,_0x11944f){_0x3448f9=_0x3448f9-0x0;var _0x17f750=_0x8a00[_0x3448f9];return _0x17f750;};'use strict';var multer=require('multer');var util=require(_0x08a0('0x0'));var path=require(_0x08a0('0x1'));var timeout=require('connect-timeout');var express=require(_0x08a0('0x2'));var router=express[_0x08a0('0x3')]();var auth=require(_0x08a0('0x4'));var interaction=require(_0x08a0('0x5'));var config=require(_0x08a0('0x6'));var controller=require(_0x08a0('0x7'));router[_0x08a0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x08a0('0x8')](_0x08a0('0x9'),auth[_0x08a0('0xa')](),controller[_0x08a0('0xb')]);router[_0x08a0('0x8')](_0x08a0('0xc'),auth[_0x08a0('0xa')](),controller['show']);router[_0x08a0('0xd')]('/',auth[_0x08a0('0xa')](),controller[_0x08a0('0xe')]);router[_0x08a0('0xf')](_0x08a0('0xc'),auth[_0x08a0('0xa')](),controller[_0x08a0('0x10')]);router[_0x08a0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x08a0('0x12')]);module[_0x08a0('0x13')]=router; \ No newline at end of file +var _0xc9dc=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3fd0e3,_0x48d51a){var _0x25c1cc=function(_0x207948){while(--_0x207948){_0x3fd0e3['push'](_0x3fd0e3['shift']());}};_0x25c1cc(++_0x48d51a);}(_0xc9dc,0xac));var _0xcc9d=function(_0x3fa564,_0x21c25f){_0x3fa564=_0x3fa564-0x0;var _0x4020fe=_0xc9dc[_0x3fa564];return _0x4020fe;};'use strict';var multer=require(_0xcc9d('0x0'));var util=require(_0xcc9d('0x1'));var path=require(_0xcc9d('0x2'));var timeout=require(_0xcc9d('0x3'));var express=require(_0xcc9d('0x4'));var router=express['Router']();var auth=require(_0xcc9d('0x5'));var interaction=require(_0xcc9d('0x6'));var config=require(_0xcc9d('0x7'));var controller=require(_0xcc9d('0x8'));router[_0xcc9d('0x9')]('/',auth[_0xcc9d('0xa')](),controller[_0xcc9d('0xb')]);router[_0xcc9d('0x9')](_0xcc9d('0xc'),auth['isAuthenticated'](),controller[_0xcc9d('0xd')]);router[_0xcc9d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xcc9d('0xe')]);router[_0xcc9d('0xf')]('/',auth['isAuthenticated'](),controller[_0xcc9d('0x10')]);router[_0xcc9d('0x11')]('/:id',auth[_0xcc9d('0xa')](),controller[_0xcc9d('0x12')]);router['delete'](_0xcc9d('0x13'),auth['isAuthenticated'](),controller[_0xcc9d('0x14')]);module[_0xcc9d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f353005..6e0c0a9 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 _0x38d7=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x1ad0d0,_0x3e4614){var _0xa5e9ae=function(_0x4f22dc){while(--_0x4f22dc){_0x1ad0d0['push'](_0x1ad0d0['shift']());}};_0xa5e9ae(++_0x3e4614);}(_0x38d7,0x12c));var _0x738d=function(_0xc441b5,_0xa58567){_0xc441b5=_0xc441b5-0x0;var _0x4f5e7c=_0x38d7[_0xc441b5];return _0x4f5e7c;};'use strict';var moment=require(_0x738d('0x0'));var Sequelize=require(_0x738d('0x1'));module[_0x738d('0x2')]={'uniqueid':{'type':Sequelize[_0x738d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x738d('0x4')](_0x738d('0x5'),_0x738d('0x6'),'queue'),'allowNull':![],'defaultValue':_0x738d('0x7')},'transferredAt':{'type':Sequelize[_0x738d('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x738d('0x9')]}}; \ No newline at end of file +var _0x4134=['STRING','ENUM','account','agent','queue','moment','sequelize','exports'];(function(_0x17db61,_0x364236){var _0x7ac96b=function(_0x329bf4){while(--_0x329bf4){_0x17db61['push'](_0x17db61['shift']());}};_0x7ac96b(++_0x364236);}(_0x4134,0x10d));var _0x4413=function(_0xfc6aac,_0x284add){_0xfc6aac=_0xfc6aac-0x0;var _0x4ff988=_0x4134[_0xfc6aac];return _0x4ff988;};'use strict';var moment=require(_0x4413('0x0'));var Sequelize=require(_0x4413('0x1'));module[_0x4413('0x2')]={'uniqueid':{'type':Sequelize[_0x4413('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4413('0x4')](_0x4413('0x5'),_0x4413('0x6'),'queue'),'allowNull':![],'defaultValue':_0x4413('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 46fa4b4..50bfb62 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 _0x46fd=['rows','catch','options','create','body','find','describe','eml-format','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','ChatTransferReport','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','where','count','includeAll'];(function(_0x415f7e,_0x4630b6){var _0x311ff4=function(_0x19c19d){while(--_0x19c19d){_0x415f7e['push'](_0x415f7e['shift']());}};_0x311ff4(++_0x4630b6);}(_0x46fd,0x1bd));var _0xd46f=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x46fd[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd46f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd46f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd46f('0x2'));var moment=require(_0xd46f('0x3'));var BPromise=require(_0xd46f('0x4'));var Mustache=require(_0xd46f('0x5'));var util=require(_0xd46f('0x6'));var path=require(_0xd46f('0x7'));var sox=require(_0xd46f('0x8'));var csv=require('to-csv');var ejs=require(_0xd46f('0x9'));var fs=require('fs');var _=require(_0xd46f('0xa'));var squel=require(_0xd46f('0xb'));var crypto=require(_0xd46f('0xc'));var jsforce=require(_0xd46f('0xd'));var deskjs=require(_0xd46f('0xe'));var toCsv=require(_0xd46f('0xf'));var querystring=require(_0xd46f('0x10'));var Papa=require(_0xd46f('0x11'));var Redis=require(_0xd46f('0x12'));var authService=require(_0xd46f('0x13'));var qs=require(_0xd46f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd46f('0x15'));var logger=require(_0xd46f('0x16'))(_0xd46f('0x17'));var utils=require(_0xd46f('0x18'));var config=require(_0xd46f('0x19'));var licenseUtil=require(_0xd46f('0x1a'));var db=require(_0xd46f('0x1b'))['db'];function respondWithStatusCode(_0x4bff98,_0x4237ae){_0x4237ae=_0x4237ae||0xcc;return function(_0x242e84){if(_0x242e84){return _0x4bff98[_0xd46f('0x1c')](_0x4237ae);}return _0x4bff98['status'](_0x4237ae)[_0xd46f('0x1d')]();};}function respondWithResult(_0x1f430b,_0x4df90c){_0x4df90c=_0x4df90c||0xc8;return function(_0x243b24){if(_0x243b24){return _0x1f430b[_0xd46f('0x1e')](_0x4df90c)['json'](_0x243b24);}};}function respondWithFilteredResult(_0x3753c2,_0x310974){return function(_0x461109){if(_0x461109){var _0x251b9c=_0x461109['count'],_0x70d858=_0x310974[_0xd46f('0x1f')],_0x47caba=_0x310974[_0xd46f('0x1f')]+_0x310974[_0xd46f('0x20')],_0x4cee84;if(_0x47caba>=_0x251b9c){_0x47caba=_0x251b9c;_0x4cee84=0xc8;}else{_0x4cee84=0xce;}_0x3753c2['status'](_0x4cee84);return _0x3753c2[_0xd46f('0x21')](_0xd46f('0x22'),_0x70d858+'-'+_0x47caba+'/'+_0x251b9c)[_0xd46f('0x23')](_0x461109);}return null;};}function patchUpdates(_0x1292f0){return function(_0x469191){try{jsonpatch['apply'](_0x469191,_0x1292f0,!![]);}catch(_0x36538e){return BPromise[_0xd46f('0x24')](_0x36538e);}return _0x469191[_0xd46f('0x25')]();};}function saveUpdates(_0x20bb20,_0x56454e){return function(_0x3f91a3){if(_0x3f91a3){return _0x3f91a3['update'](_0x20bb20)[_0xd46f('0x26')](function(_0x593adf){return _0x593adf;});}return null;};}function removeEntity(_0xe2ad48,_0x4fce11){return function(_0x42b3c1){if(_0x42b3c1){return _0x42b3c1[_0xd46f('0x27')]()['then'](function(){_0xe2ad48[_0xd46f('0x1e')](0xcc)[_0xd46f('0x1d')]();});}};}function handleEntityNotFound(_0x29a6a8,_0x157a8f){return function(_0x283595){if(!_0x283595){_0x29a6a8[_0xd46f('0x1c')](0x194);}return _0x283595;};}function handleError(_0x35f5d3,_0xb7b5da){_0xb7b5da=_0xb7b5da||0x1f4;return function(_0x174d39){logger[_0xd46f('0x28')](_0x174d39[_0xd46f('0x29')]);if(_0x174d39['name']){delete _0x174d39[_0xd46f('0x2a')];}_0x35f5d3[_0xd46f('0x1e')](_0xb7b5da)['send'](_0x174d39);};}exports[_0xd46f('0x2b')]=function(_0x56f402,_0x44c455){var _0x4a3212={},_0x1b6854={},_0x50d904={'count':0x0,'rows':[]};var _0x4548d0=_[_0xd46f('0x2c')](db[_0xd46f('0x2d')]['rawAttributes'],function(_0x39afcc){return{'name':_0x39afcc[_0xd46f('0x2e')],'type':_0x39afcc[_0xd46f('0x2f')][_0xd46f('0x30')]};});_0x1b6854[_0xd46f('0x31')]=_[_0xd46f('0x2c')](_0x4548d0,_0xd46f('0x2a'));_0x1b6854['query']=_[_0xd46f('0x32')](_0x56f402['query']);_0x1b6854[_0xd46f('0x33')]=_[_0xd46f('0x34')](_0x1b6854['model'],_0x1b6854[_0xd46f('0x35')]);_0x4a3212['attributes']=_[_0xd46f('0x34')](_0x1b6854[_0xd46f('0x31')],qs[_0xd46f('0x36')](_0x56f402[_0xd46f('0x35')]['fields']));_0x4a3212[_0xd46f('0x37')]=_0x4a3212['attributes'][_0xd46f('0x38')]?_0x4a3212[_0xd46f('0x37')]:_0x1b6854[_0xd46f('0x31')];if(!_0x56f402[_0xd46f('0x35')][_0xd46f('0x39')]('nolimit')){_0x4a3212[_0xd46f('0x20')]=qs[_0xd46f('0x20')](_0x56f402['query']['limit']);_0x4a3212[_0xd46f('0x1f')]=qs['offset'](_0x56f402[_0xd46f('0x35')][_0xd46f('0x1f')]);}_0x4a3212['order']=qs['sort'](_0x56f402[_0xd46f('0x35')][_0xd46f('0x3a')]);_0x4a3212['where']=qs[_0xd46f('0x33')](_[_0xd46f('0x3b')](_0x56f402['query'],_0x1b6854[_0xd46f('0x33')]),_0x4548d0);if(_0x56f402[_0xd46f('0x35')][_0xd46f('0x3c')]){_0x4a3212['where']=_[_0xd46f('0x3d')](_0x4a3212['where'],{'$or':_[_0xd46f('0x2c')](_0x4548d0,function(_0x2addec){if(_0x2addec['type']!==_0xd46f('0x3e')){var _0x1826de={};_0x1826de[_0x2addec['name']]={'$like':'%'+_0x56f402[_0xd46f('0x35')]['filter']+'%'};return _0x1826de;}})});}_0x4a3212=_[_0xd46f('0x3d')]({},_0x4a3212,_0x56f402['options']);var _0x41aa6f={'where':_0x4a3212[_0xd46f('0x3f')]};return db[_0xd46f('0x2d')][_0xd46f('0x40')](_0x41aa6f)['then'](function(_0x424301){_0x50d904['count']=_0x424301;if(_0x56f402['query'][_0xd46f('0x41')]){_0x4a3212['include']=[{'all':!![]}];}return db[_0xd46f('0x2d')]['findAll'](_0x4a3212);})[_0xd46f('0x26')](function(_0x4b8400){_0x50d904[_0xd46f('0x42')]=_0x4b8400;return _0x50d904;})['then'](respondWithFilteredResult(_0x44c455,_0x4a3212))[_0xd46f('0x43')](handleError(_0x44c455,null));};exports['show']=function(_0x3a8e77,_0x285383){var _0x398db1={'raw':!![],'where':{'id':_0x3a8e77['params']['id']}},_0x5677bb={};_0x5677bb[_0xd46f('0x31')]=_[_0xd46f('0x32')](db[_0xd46f('0x2d')]['rawAttributes']);_0x5677bb[_0xd46f('0x35')]=_[_0xd46f('0x32')](_0x3a8e77[_0xd46f('0x35')]);_0x5677bb[_0xd46f('0x33')]=_[_0xd46f('0x34')](_0x5677bb[_0xd46f('0x31')],_0x5677bb['query']);_0x398db1[_0xd46f('0x37')]=_[_0xd46f('0x34')](_0x5677bb[_0xd46f('0x31')],qs[_0xd46f('0x36')](_0x3a8e77['query'][_0xd46f('0x36')]));_0x398db1[_0xd46f('0x37')]=_0x398db1[_0xd46f('0x37')]['length']?_0x398db1[_0xd46f('0x37')]:_0x5677bb[_0xd46f('0x31')];if(_0x3a8e77[_0xd46f('0x35')][_0xd46f('0x41')]){_0x398db1['include']=[{'all':!![]}];}_0x398db1=_[_0xd46f('0x3d')]({},_0x398db1,_0x3a8e77[_0xd46f('0x44')]);return db[_0xd46f('0x2d')]['find'](_0x398db1)[_0xd46f('0x26')](handleEntityNotFound(_0x285383,null))[_0xd46f('0x26')](respondWithResult(_0x285383,null))['catch'](handleError(_0x285383,null));};exports[_0xd46f('0x45')]=function(_0x78e807,_0x41e1aa){return db['ChatTransferReport'][_0xd46f('0x45')](_0x78e807[_0xd46f('0x46')],{})[_0xd46f('0x26')](respondWithResult(_0x41e1aa,0xc9))[_0xd46f('0x43')](handleError(_0x41e1aa,null));};exports['update']=function(_0x5b660c,_0x1345ed){if(_0x5b660c[_0xd46f('0x46')]['id']){delete _0x5b660c[_0xd46f('0x46')]['id'];}return db[_0xd46f('0x2d')]['find']({'where':{'id':_0x5b660c['params']['id']}})[_0xd46f('0x26')](handleEntityNotFound(_0x1345ed,null))['then'](saveUpdates(_0x5b660c[_0xd46f('0x46')],null))['then'](respondWithResult(_0x1345ed,null))[_0xd46f('0x43')](handleError(_0x1345ed,null));};exports['destroy']=function(_0x32aa24,_0x55e4c7){return db[_0xd46f('0x2d')][_0xd46f('0x47')]({'where':{'id':_0x32aa24['params']['id']}})[_0xd46f('0x26')](handleEntityNotFound(_0x55e4c7,null))[_0xd46f('0x26')](removeEntity(_0x55e4c7,null))[_0xd46f('0x43')](handleError(_0x55e4c7,null));};exports['describe']=function(_0x760857,_0x30e82d){return db[_0xd46f('0x2d')][_0xd46f('0x48')]()[_0xd46f('0x26')](respondWithResult(_0x30e82d,null))[_0xd46f('0x43')](handleError(_0x30e82d,null));}; \ No newline at end of file +var _0xec91=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','index','ChatTransferReport','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec91,0xc7));var _0x1ec9=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xec91[_0x111e94];return _0x3de107;};'use strict';var pdf=require(_0x1ec9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1ec9('0x1'));var zipdir=require(_0x1ec9('0x2'));var jsonpatch=require(_0x1ec9('0x3'));var rp=require(_0x1ec9('0x4'));var moment=require(_0x1ec9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1ec9('0x6'));var util=require(_0x1ec9('0x7'));var path=require(_0x1ec9('0x8'));var sox=require('sox');var csv=require(_0x1ec9('0x9'));var ejs=require(_0x1ec9('0xa'));var fs=require('fs');var _=require(_0x1ec9('0xb'));var squel=require(_0x1ec9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ec9('0x9'));var querystring=require('querystring');var Papa=require(_0x1ec9('0xd'));var Redis=require(_0x1ec9('0xe'));var authService=require(_0x1ec9('0xf'));var qs=require(_0x1ec9('0x10'));var as=require(_0x1ec9('0x11'));var hardwareService=require(_0x1ec9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1ec9('0x13'));var config=require(_0x1ec9('0x14'));var licenseUtil=require(_0x1ec9('0x15'));var db=require(_0x1ec9('0x16'))['db'];function respondWithStatusCode(_0x3caaf7,_0x597248){_0x597248=_0x597248||0xcc;return function(_0x12cfd2){if(_0x12cfd2){return _0x3caaf7[_0x1ec9('0x17')](_0x597248);}return _0x3caaf7[_0x1ec9('0x18')](_0x597248)['end']();};}function respondWithResult(_0x6254b9,_0x94c5c9){_0x94c5c9=_0x94c5c9||0xc8;return function(_0x1f5536){if(_0x1f5536){return _0x6254b9['status'](_0x94c5c9)['json'](_0x1f5536);}};}function respondWithFilteredResult(_0x4d6f3d,_0x20b406){return function(_0x4857c8){if(_0x4857c8){var _0x541273=_0x4857c8[_0x1ec9('0x19')],_0x2570bd=_0x20b406[_0x1ec9('0x1a')],_0x965f96=_0x20b406[_0x1ec9('0x1a')]+_0x20b406[_0x1ec9('0x1b')],_0x127b1b;if(_0x965f96>=_0x541273){_0x965f96=_0x541273;_0x127b1b=0xc8;}else{_0x127b1b=0xce;}_0x4d6f3d['status'](_0x127b1b);return _0x4d6f3d[_0x1ec9('0x1c')](_0x1ec9('0x1d'),_0x2570bd+'-'+_0x965f96+'/'+_0x541273)[_0x1ec9('0x1e')](_0x4857c8);}return null;};}function patchUpdates(_0x367515){return function(_0x56e049){try{jsonpatch[_0x1ec9('0x1f')](_0x56e049,_0x367515,!![]);}catch(_0x2b62a4){return BPromise[_0x1ec9('0x20')](_0x2b62a4);}return _0x56e049[_0x1ec9('0x21')]();};}function saveUpdates(_0x2938d1,_0x250d03){return function(_0x27b6bb){if(_0x27b6bb){return _0x27b6bb[_0x1ec9('0x22')](_0x2938d1)[_0x1ec9('0x23')](function(_0x4d18b4){return _0x4d18b4;});}return null;};}function removeEntity(_0x27eeb4,_0x1e51a3){return function(_0xd7d2a){if(_0xd7d2a){return _0xd7d2a[_0x1ec9('0x24')]()[_0x1ec9('0x23')](function(){_0x27eeb4[_0x1ec9('0x18')](0xcc)[_0x1ec9('0x25')]();});}};}function handleEntityNotFound(_0x13cce3,_0x543337){return function(_0x5bc5d2){if(!_0x5bc5d2){_0x13cce3[_0x1ec9('0x17')](0x194);}return _0x5bc5d2;};}function handleError(_0x5f1027,_0x5ec10e){_0x5ec10e=_0x5ec10e||0x1f4;return function(_0xfdb251){logger[_0x1ec9('0x26')](_0xfdb251[_0x1ec9('0x27')]);if(_0xfdb251[_0x1ec9('0x28')]){delete _0xfdb251[_0x1ec9('0x28')];}_0x5f1027[_0x1ec9('0x18')](_0x5ec10e)['send'](_0xfdb251);};}exports[_0x1ec9('0x29')]=function(_0x2cf576,_0x1c188d){var _0x5e42d9={},_0x1150fb={},_0x201ddb={'count':0x0,'rows':[]};var _0x12736e=_['map'](db[_0x1ec9('0x2a')][_0x1ec9('0x2b')],function(_0x4077ab){return{'name':_0x4077ab['fieldName'],'type':_0x4077ab[_0x1ec9('0x2c')]['key']};});_0x1150fb[_0x1ec9('0x2d')]=_['map'](_0x12736e,_0x1ec9('0x28'));_0x1150fb['query']=_['keys'](_0x2cf576[_0x1ec9('0x2e')]);_0x1150fb['filters']=_[_0x1ec9('0x2f')](_0x1150fb[_0x1ec9('0x2d')],_0x1150fb[_0x1ec9('0x2e')]);_0x5e42d9[_0x1ec9('0x30')]=_['intersection'](_0x1150fb['model'],qs[_0x1ec9('0x31')](_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x31')]));_0x5e42d9[_0x1ec9('0x30')]=_0x5e42d9['attributes'][_0x1ec9('0x32')]?_0x5e42d9[_0x1ec9('0x30')]:_0x1150fb[_0x1ec9('0x2d')];if(!_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x33')](_0x1ec9('0x34'))){_0x5e42d9[_0x1ec9('0x1b')]=qs[_0x1ec9('0x1b')](_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x1b')]);_0x5e42d9[_0x1ec9('0x1a')]=qs[_0x1ec9('0x1a')](_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x1a')]);}_0x5e42d9[_0x1ec9('0x35')]=qs[_0x1ec9('0x36')](_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x36')]);_0x5e42d9[_0x1ec9('0x37')]=qs[_0x1ec9('0x38')](_[_0x1ec9('0x39')](_0x2cf576['query'],_0x1150fb[_0x1ec9('0x38')]),_0x12736e);if(_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x3a')]){_0x5e42d9[_0x1ec9('0x37')]=_[_0x1ec9('0x3b')](_0x5e42d9[_0x1ec9('0x37')],{'$or':_['map'](_0x12736e,function(_0x3fd4e6){if(_0x3fd4e6[_0x1ec9('0x2c')]!==_0x1ec9('0x3c')){var _0x522ba6={};_0x522ba6[_0x3fd4e6[_0x1ec9('0x28')]]={'$like':'%'+_0x2cf576[_0x1ec9('0x2e')][_0x1ec9('0x3a')]+'%'};return _0x522ba6;}})});}_0x5e42d9=_[_0x1ec9('0x3b')]({},_0x5e42d9,_0x2cf576['options']);var _0x59387c={'where':_0x5e42d9['where']};return db[_0x1ec9('0x2a')][_0x1ec9('0x19')](_0x59387c)[_0x1ec9('0x23')](function(_0x154b6c){_0x201ddb[_0x1ec9('0x19')]=_0x154b6c;if(_0x2cf576['query'][_0x1ec9('0x3d')]){_0x5e42d9[_0x1ec9('0x3e')]=[{'all':!![]}];}return db[_0x1ec9('0x2a')][_0x1ec9('0x3f')](_0x5e42d9);})[_0x1ec9('0x23')](function(_0x191fd9){_0x201ddb[_0x1ec9('0x40')]=_0x191fd9;return _0x201ddb;})['then'](respondWithFilteredResult(_0x1c188d,_0x5e42d9))[_0x1ec9('0x41')](handleError(_0x1c188d,null));};exports[_0x1ec9('0x42')]=function(_0x1c7b23,_0x3bfabd){var _0x1126b1={'raw':!![],'where':{'id':_0x1c7b23['params']['id']}},_0x1917df={};_0x1917df['model']=_['keys'](db[_0x1ec9('0x2a')][_0x1ec9('0x2b')]);_0x1917df[_0x1ec9('0x2e')]=_['keys'](_0x1c7b23[_0x1ec9('0x2e')]);_0x1917df[_0x1ec9('0x38')]=_[_0x1ec9('0x2f')](_0x1917df[_0x1ec9('0x2d')],_0x1917df[_0x1ec9('0x2e')]);_0x1126b1[_0x1ec9('0x30')]=_['intersection'](_0x1917df[_0x1ec9('0x2d')],qs[_0x1ec9('0x31')](_0x1c7b23[_0x1ec9('0x2e')][_0x1ec9('0x31')]));_0x1126b1[_0x1ec9('0x30')]=_0x1126b1[_0x1ec9('0x30')][_0x1ec9('0x32')]?_0x1126b1[_0x1ec9('0x30')]:_0x1917df[_0x1ec9('0x2d')];if(_0x1c7b23[_0x1ec9('0x2e')][_0x1ec9('0x3d')]){_0x1126b1[_0x1ec9('0x3e')]=[{'all':!![]}];}_0x1126b1=_[_0x1ec9('0x3b')]({},_0x1126b1,_0x1c7b23['options']);return db['ChatTransferReport'][_0x1ec9('0x43')](_0x1126b1)[_0x1ec9('0x23')](handleEntityNotFound(_0x3bfabd,null))[_0x1ec9('0x23')](respondWithResult(_0x3bfabd,null))['catch'](handleError(_0x3bfabd,null));};exports[_0x1ec9('0x44')]=function(_0x23e2f9,_0x1be36c){return db[_0x1ec9('0x2a')]['create'](_0x23e2f9[_0x1ec9('0x45')],{})[_0x1ec9('0x23')](respondWithResult(_0x1be36c,0xc9))[_0x1ec9('0x41')](handleError(_0x1be36c,null));};exports[_0x1ec9('0x22')]=function(_0x38372f,_0x2a659b){if(_0x38372f[_0x1ec9('0x45')]['id']){delete _0x38372f[_0x1ec9('0x45')]['id'];}return db[_0x1ec9('0x2a')][_0x1ec9('0x43')]({'where':{'id':_0x38372f['params']['id']}})[_0x1ec9('0x23')](handleEntityNotFound(_0x2a659b,null))[_0x1ec9('0x23')](saveUpdates(_0x38372f[_0x1ec9('0x45')],null))[_0x1ec9('0x23')](respondWithResult(_0x2a659b,null))[_0x1ec9('0x41')](handleError(_0x2a659b,null));};exports['destroy']=function(_0x3b17e5,_0x246b4a){return db['ChatTransferReport'][_0x1ec9('0x43')]({'where':{'id':_0x3b17e5['params']['id']}})[_0x1ec9('0x23')](handleEntityNotFound(_0x246b4a,null))[_0x1ec9('0x23')](removeEntity(_0x246b4a,null))[_0x1ec9('0x41')](handleError(_0x246b4a,null));};exports[_0x1ec9('0x46')]=function(_0x52060e,_0x4cd5c8){return db['ChatTransferReport'][_0x1ec9('0x46')]()['then'](respondWithResult(_0x4cd5c8,null))[_0x1ec9('0x41')](handleError(_0x4cd5c8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 19b4479..173d8a4 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 _0x9fd0=['./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9fd0,0x114));var _0x09fd=function(_0x56241f,_0xc69854){_0x56241f=_0x56241f-0x0;var _0x2f68ef=_0x9fd0[_0x56241f];return _0x2f68ef;};'use strict';var _=require('lodash');var util=require(_0x09fd('0x0'));var logger=require(_0x09fd('0x1'))(_0x09fd('0x2'));var moment=require(_0x09fd('0x3'));var BPromise=require(_0x09fd('0x4'));var rp=require(_0x09fd('0x5'));var fs=require('fs');var path=require(_0x09fd('0x6'));var rimraf=require(_0x09fd('0x7'));var config=require(_0x09fd('0x8'));var attributes=require(_0x09fd('0x9'));module[_0x09fd('0xa')]=function(_0x3b9f02,_0x83e0a8){return _0x3b9f02[_0x09fd('0xb')](_0x09fd('0xc'),attributes,{'tableName':_0x09fd('0xd'),'paranoid':![],'indexes':[{'name':_0x09fd('0xe'),'fields':[_0x09fd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fd7=['../../config/environment','./chatTransferReport.attributes','report_chat_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x33ec12,_0x44b94b){var _0x130158=function(_0x1eee1c){while(--_0x1eee1c){_0x33ec12['push'](_0x33ec12['shift']());}};_0x130158(++_0x44b94b);}(_0x6fd7,0x11c));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76fd('0x0'));var util=require('util');var logger=require(_0x76fd('0x1'))(_0x76fd('0x2'));var moment=require('moment');var BPromise=require(_0x76fd('0x3'));var rp=require(_0x76fd('0x4'));var fs=require('fs');var path=require(_0x76fd('0x5'));var rimraf=require('rimraf');var config=require(_0x76fd('0x6'));var attributes=require(_0x76fd('0x7'));module['exports']=function(_0x23ae7d,_0x19242f){return _0x23ae7d['define']('ChatTransferReport',attributes,{'tableName':_0x76fd('0x8'),'paranoid':![],'indexes':[{'name':_0x76fd('0x9'),'fields':[_0x76fd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index edcc4f8..80c95ad 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 _0xec67=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x45598d,_0x29e40d){var _0x59274e=function(_0x2de38f){while(--_0x2de38f){_0x45598d['push'](_0x45598d['shift']());}};_0x59274e(++_0x29e40d);}(_0xec67,0x186));var _0x7ec6=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xec67[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x7ec6('0x0'));var util=require('util');var moment=require(_0x7ec6('0x1'));var BPromise=require(_0x7ec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ec6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ec6('0x4'));var logger=require('../../config/logger')(_0x7ec6('0x5'));var config=require(_0x7ec6('0x6'));var jayson=require(_0x7ec6('0x7'));var client=jayson[_0x7ec6('0x8')][_0x7ec6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x573d9b,_0x41299c,_0x3993cc){return new BPromise(function(_0x5568bf,_0x4879b3){return client[_0x7ec6('0xa')](_0x573d9b,_0x3993cc)[_0x7ec6('0xb')](function(_0x4597ff){logger[_0x7ec6('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x41299c,_0x7ec6('0xd'));logger['debug'](_0x7ec6('0xe'),_0x41299c,_0x7ec6('0xd'),JSON[_0x7ec6('0xf')](_0x4597ff));if(_0x4597ff[_0x7ec6('0x10')]){if(_0x4597ff[_0x7ec6('0x10')][_0x7ec6('0x11')]===0x1f4){logger[_0x7ec6('0x10')](_0x7ec6('0x12'),_0x41299c,_0x4597ff['error'][_0x7ec6('0x13')]);return _0x4879b3(_0x4597ff['error'][_0x7ec6('0x13')]);}logger[_0x7ec6('0x10')](_0x7ec6('0x12'),_0x41299c,_0x4597ff['error'][_0x7ec6('0x13')]);return _0x5568bf(_0x4597ff[_0x7ec6('0x10')]['message']);}else{logger[_0x7ec6('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x41299c,'request\x20sent');_0x5568bf(_0x4597ff[_0x7ec6('0x14')][_0x7ec6('0x13')]);}})[_0x7ec6('0x15')](function(_0x3d9e64){logger[_0x7ec6('0x10')](_0x7ec6('0x12'),_0x41299c,_0x3d9e64);_0x4879b3(_0x3d9e64);});});} \ No newline at end of file +var _0xa6f3=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x22eaca,_0x1e096d){var _0x363f01=function(_0x31b0c5){while(--_0x31b0c5){_0x22eaca['push'](_0x22eaca['shift']());}};_0x363f01(++_0x1e096d);}(_0xa6f3,0xeb));var _0x3a6f=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xa6f3[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0x3a6f('0x0'));var util=require('util');var moment=require(_0x3a6f('0x1'));var BPromise=require(_0x3a6f('0x2'));var rs=require(_0x3a6f('0x3'));var fs=require('fs');var Redis=require(_0x3a6f('0x4'));var db=require(_0x3a6f('0x5'))['db'];var utils=require(_0x3a6f('0x6'));var logger=require(_0x3a6f('0x7'))(_0x3a6f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a6f('0x9')][_0x3a6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569e30,_0x3097d1,_0x3b7def){return new BPromise(function(_0x5a0900,_0x5c6917){return client[_0x3a6f('0xb')](_0x569e30,_0x3b7def)['then'](function(_0x17223b){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x3097d1,_0x3a6f('0xc'));logger['debug'](_0x3a6f('0xd'),_0x3097d1,_0x3a6f('0xc'),JSON['stringify'](_0x17223b));if(_0x17223b[_0x3a6f('0xe')]){if(_0x17223b[_0x3a6f('0xe')][_0x3a6f('0xf')]===0x1f4){logger[_0x3a6f('0xe')](_0x3a6f('0x10'),_0x3097d1,_0x17223b[_0x3a6f('0xe')]['message']);return _0x5c6917(_0x17223b[_0x3a6f('0xe')][_0x3a6f('0x11')]);}logger['error'](_0x3a6f('0x10'),_0x3097d1,_0x17223b['error']['message']);return _0x5a0900(_0x17223b[_0x3a6f('0xe')][_0x3a6f('0x11')]);}else{logger['info'](_0x3a6f('0x10'),_0x3097d1,_0x3a6f('0xc'));_0x5a0900(_0x17223b['result'][_0x3a6f('0x11')]);}})['catch'](function(_0x4ea2fb){logger[_0x3a6f('0xe')](_0x3a6f('0x10'),_0x3097d1,_0x4ea2fb);_0x5c6917(_0x4ea2fb);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d0ab3be..0a70ba4 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x596a2e,_0x318065){var _0x505835=function(_0x469af2){while(--_0x469af2){_0x596a2e['push'](_0x596a2e['shift']());}};_0x505835(++_0x318065);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0x0b0e[_0x4b980d];return _0x5c7974;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1475a6,_0x56628c){_0x1475a6=_0x1475a6-0x0;var _0x3c0d07=_0xb10b[_0x1475a6];return _0x3c0d07;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5c5542a..66062d9 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 _0xbca0=['We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','TEXT','stringify','name','input','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared'];(function(_0x9a0996,_0x1646c8){var _0x2d16f1=function(_0x5567a8){while(--_0x5567a8){_0x9a0996['push'](_0x9a0996['shift']());}};_0x2d16f1(++_0x1646c8);}(_0xbca0,0x17f));var _0x0bca=function(_0x3aa903,_0x3f4f72){_0x3aa903=_0x3aa903-0x0;var _0x5cae68=_0xbca0[_0x3aa903];return _0x5cae68;};'use strict';var Sequelize=require(_0x0bca('0x0'));var rs=require(_0x0bca('0x1'));module[_0x0bca('0x2')]={'name':{'type':Sequelize[_0x0bca('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x0bca('0x3')]},'mapKey':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x5')},'customerAlias':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0bca('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0bca('0x3')],'allowNull':![],'defaultValue':_0x0bca('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0bca('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0bca('0x3')]},'animation':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0bca('0xa')](_0x0bca('0xb'),_0x0bca('0xc')),'defaultValue':_0x0bca('0xb')},'header_online':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0xd')},'start_chat_button':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x12')},'placeholderMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0xe')},'skipMessageButton':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0x15')},'ratingType':{'type':Sequelize[_0x0bca('0xa')]('star',_0x0bca('0x16')),'defaultValue':_0x0bca('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0bca('0x18')],'defaultValue':function(){return JSON[_0x0bca('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0bca('0x1a'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x0bca('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0bca('0x4'),'type':_0x0bca('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0bca('0x1c')](_0x0bca('0x1d'))?JSON['parse'](this[_0x0bca('0x1c')](_0x0bca('0x1d'))):{};},'set':function(_0x42b203){return this[_0x0bca('0x1e')](_0x0bca('0x1d'),JSON[_0x0bca('0x19')](_0x42b203));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0bca('0x19')]({'items':[{'type':'input','props':{'title':_0x0bca('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0bca('0x4'),'type':'email'},'variable':null},{'type':_0x0bca('0x1f'),'config':{'placeholder':_0x0bca('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0bca('0x1c')](_0x0bca('0x21'))?JSON[_0x0bca('0x22')](this[_0x0bca('0x1c')](_0x0bca('0x21'))):{};},'set':function(_0x24fd0b){return this[_0x0bca('0x1e')](_0x0bca('0x21'),JSON[_0x0bca('0x19')](_0x24fd0b));}},'token':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0bca('0x3')]},'forwardOffline':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x24')},'offlineMessageBody':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x25')},'skipUnmanaged':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0bca('0x18')]},'showAgentAvatar':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0bca('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0bca('0x18')],'defaultValue':function(){return _0x0bca('0x26');}},'notificationSound':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bca('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0bca('0x3')]},'customerAvatar':{'type':Sequelize[_0x0bca('0x18')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0bca('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bca('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bca('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x28')},'systemAvatar':{'type':Sequelize[_0x0bca('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0bca('0x8')],'comment':_0x0bca('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![],'comment':_0x0bca('0x2a'),'set':function(_0x37dcf9){if(!_0x37dcf9)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0bca('0x1e')](_0x0bca('0x2b'),_0x37dcf9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x3fc6=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','TEXT','stringify','input','text','name','onlineForm','parse','getDataValue','setDataValue','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5138c3,_0x4232d9){var _0x11987a=function(_0x2ae129){while(--_0x2ae129){_0x5138c3['push'](_0x5138c3['shift']());}};_0x11987a(++_0x4232d9);}(_0x3fc6,0x159));var _0x63fc=function(_0x527773,_0x5055e6){_0x527773=_0x527773-0x0;var _0x15abad=_0x3fc6[_0x527773];return _0x15abad;};'use strict';var Sequelize=require(_0x63fc('0x0'));var rs=require(_0x63fc('0x1'));module[_0x63fc('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x63fc('0x3')],'allowNull':![],'unique':_0x63fc('0x4')},'description':{'type':Sequelize[_0x63fc('0x3')]},'mapKey':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x5')},'mapKeyOffline':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x6')},'customerAlias':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x63fc('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x63fc('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x63fc('0x3')],'allowNull':![],'defaultValue':_0x63fc('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x63fc('0x3')]},'animation':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x63fc('0xb')](_0x63fc('0xc'),_0x63fc('0xd')),'defaultValue':_0x63fc('0xc')},'header_online':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0xe')},'offline_chat_button':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0xf')},'download_transcript':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x14')},'placeholderMessage':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x15')},'closingMessage':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x17')},'skipMessageButton':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x18')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x19')},'ratingType':{'type':Sequelize['ENUM'](_0x63fc('0x1a'),_0x63fc('0x1b')),'defaultValue':_0x63fc('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x63fc('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x63fc('0x1c')],'defaultValue':function(){return JSON[_0x63fc('0x1d')]({'items':[{'type':_0x63fc('0x1e'),'variable':null,'config':{'placeholder':'name','type':_0x63fc('0x1f'),'required':!![]},'props':{'title':_0x63fc('0x20'),'helpText':''}},{'type':_0x63fc('0x1e'),'props':{'title':_0x63fc('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x63fc('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x63fc('0x21'))?JSON[_0x63fc('0x22')](this[_0x63fc('0x23')](_0x63fc('0x21'))):{};},'set':function(_0x59b130){return this[_0x63fc('0x24')](_0x63fc('0x21'),JSON[_0x63fc('0x1d')](_0x59b130));}},'offlineForm':{'type':Sequelize[_0x63fc('0x1c')],'defaultValue':function(){return JSON[_0x63fc('0x1d')]({'items':[{'type':_0x63fc('0x1e'),'props':{'title':_0x63fc('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x63fc('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x63fc('0x25')},'props':{'title':_0x63fc('0x25'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x63fc('0x22')](this[_0x63fc('0x23')](_0x63fc('0x26'))):{};},'set':function(_0x365653){return this[_0x63fc('0x24')](_0x63fc('0x26'),JSON[_0x63fc('0x1d')](_0x365653));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x63fc('0x27')]();}},'autoclose':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x63fc('0x3')]},'forwardOffline':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x18')},'sendUnmanaged':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x17')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x63fc('0x1c')]},'showAgentAvatar':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x63fc('0x1c')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':_0x63fc('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x63fc('0x3')]},'customerAvatar':{'type':Sequelize[_0x63fc('0x1c')]},'showCustomerAvatar':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x63fc('0x3')],'allowNull':![],'defaultValue':_0x63fc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x63fc('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x63fc('0x2d')},'systemAvatar':{'type':Sequelize[_0x63fc('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![],'comment':_0x63fc('0x2e'),'set':function(_0x3e49ba){if(!_0x3e49ba)this[_0x63fc('0x24')](_0x63fc('0x2f'),null);this[_0x63fc('0x24')](_0x63fc('0x30'),_0x3e49ba);}},'vidaooEscalation':{'type':Sequelize[_0x63fc('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 48f7c1d..aa8ed7a 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 _0xfa5f=['show','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','userProfileId','autoAssociation','create','update','params','describe','addDisposition','findOne','Disposition','order','pick','ChatWebsiteId','removeDispositions','ids','CannedAnswer','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','join','server/files/images/logos/default_logo.svg','getLicense','custom','existsSync','root','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','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','DESC','account','applications','Applications','orderBy','asc','Contacts','contact','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','format','%s\x20%s','unknown','version','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','ChatApplication','bulkCreate','priority','getApplications','addProactiveActions','chatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','omit','emit','userChatWebsite:save','isArray','getAgents','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','save','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','ChatWebsite','findAll','rows'];(function(_0x54c5ac,_0x4cdb23){var _0x32ab16=function(_0x2136f9){while(--_0x2136f9){_0x54c5ac['push'](_0x54c5ac['shift']());}};_0x32ab16(++_0x4cdb23);}(_0xfa5f,0xc9));var _0xffa5=function(_0x22ac0a,_0x40c3ef){_0x22ac0a=_0x22ac0a-0x0;var _0x23bdf5=_0xfa5f[_0x22ac0a];return _0x23bdf5;};'use strict';var pdf=require(_0xffa5('0x0'));var emlformat=require(_0xffa5('0x1'));var rimraf=require(_0xffa5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffa5('0x3'));var rp=require(_0xffa5('0x4'));var moment=require(_0xffa5('0x5'));var BPromise=require(_0xffa5('0x6'));var Mustache=require(_0xffa5('0x7'));var util=require(_0xffa5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xffa5('0x9'));var ejs=require(_0xffa5('0xa'));var fs=require('fs');var _=require(_0xffa5('0xb'));var squel=require(_0xffa5('0xc'));var crypto=require(_0xffa5('0xd'));var jsforce=require(_0xffa5('0xe'));var deskjs=require(_0xffa5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xffa5('0x10'));var Papa=require(_0xffa5('0x11'));var Redis=require('ioredis');var authService=require(_0xffa5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xffa5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffa5('0x14'))(_0xffa5('0x15'));var utils=require(_0xffa5('0x16'));var config=require(_0xffa5('0x17'));var licenseUtil=require(_0xffa5('0x18'));var db=require(_0xffa5('0x19'))['db'];config['redis']=_[_0xffa5('0x1a')](config[_0xffa5('0x1b')],{'host':_0xffa5('0x1c'),'port':0x18eb});var socket=require(_0xffa5('0x1d'))(new Redis(config[_0xffa5('0x1b')]));require(_0xffa5('0x1e'))[_0xffa5('0x1f')](socket);var jayson=require(_0xffa5('0x20'));var client=jayson[_0xffa5('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xffa5('0x21')][_0xffa5('0x22')]({'port':0x232a});var client9003=jayson[_0xffa5('0x21')][_0xffa5('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x5a70cb,_0x448d12,_0x3a4ef6,_0x2b1e00){return new BPromise(function(_0xed81b,_0x5b8da9){var _0x2a4954=_0x2b1e00||client;return _0x2a4954[_0xffa5('0x23')](_0x5a70cb,_0x3a4ef6)[_0xffa5('0x24')](function(_0x341fd2){logger[_0xffa5('0x25')](_0xffa5('0x26'),_0x448d12,_0xffa5('0x27'));logger[_0xffa5('0x28')](_0xffa5('0x29'),_0x448d12,'request\x20sent',JSON[_0xffa5('0x2a')](_0x341fd2));if(_0x341fd2[_0xffa5('0x2b')]){if(_0x341fd2[_0xffa5('0x2b')][_0xffa5('0x2c')]===0x1f4){logger['error'](_0xffa5('0x26'),_0x448d12,_0x341fd2[_0xffa5('0x2b')][_0xffa5('0x2d')]);return _0x5b8da9(_0x341fd2['error'][_0xffa5('0x2d')]);}logger[_0xffa5('0x2b')](_0xffa5('0x26'),_0x448d12,_0x341fd2[_0xffa5('0x2b')][_0xffa5('0x2d')]);return _0xed81b(_0x341fd2['error']['message']);}else{logger[_0xffa5('0x25')](_0xffa5('0x26'),_0x448d12,_0xffa5('0x27'));_0xed81b(_0x341fd2[_0xffa5('0x2e')][_0xffa5('0x2d')]);}})[_0xffa5('0x2f')](function(_0x4e3832){logger[_0xffa5('0x2b')](_0xffa5('0x26'),_0x448d12,_0x4e3832);_0x5b8da9(_0x4e3832);});});}function respondWithStatusCode(_0x51d349,_0x3444df){_0x3444df=_0x3444df||0xcc;return function(_0x259f02){if(_0x259f02){return _0x51d349[_0xffa5('0x30')](_0x3444df);}return _0x51d349[_0xffa5('0x31')](_0x3444df)[_0xffa5('0x32')]();};}function respondWithResult(_0xfb9afe,_0x5b894b){_0x5b894b=_0x5b894b||0xc8;return function(_0xf21f5b){if(_0xf21f5b){return _0xfb9afe[_0xffa5('0x31')](_0x5b894b)[_0xffa5('0x33')](_0xf21f5b);}};}function respondWithFilteredResult(_0x2a4551,_0x5bfda6){return function(_0x5c9af9){if(_0x5c9af9){var _0x482a1b=_0x5c9af9['count'],_0x2b5b07=_0x5bfda6[_0xffa5('0x34')],_0xea401b=_0x5bfda6[_0xffa5('0x34')]+_0x5bfda6[_0xffa5('0x35')],_0x15d635;if(_0xea401b>=_0x482a1b){_0xea401b=_0x482a1b;_0x15d635=0xc8;}else{_0x15d635=0xce;}_0x2a4551['status'](_0x15d635);return _0x2a4551[_0xffa5('0x36')]('Content-Range',_0x2b5b07+'-'+_0xea401b+'/'+_0x482a1b)['json'](_0x5c9af9);}return null;};}function patchUpdates(_0x1d7345){return function(_0x294128){try{jsonpatch[_0xffa5('0x37')](_0x294128,_0x1d7345,!![]);}catch(_0x5457fb){return BPromise['reject'](_0x5457fb);}return _0x294128[_0xffa5('0x38')]();};}function saveUpdates(_0x1e500b,_0x372c83){return function(_0xd7d9f7){if(_0xd7d9f7){return _0xd7d9f7['update'](_0x1e500b)['then'](function(_0x5f38c9){return _0x5f38c9;});}return null;};}function removeEntity(_0x34604f,_0x5566e7){return function(_0x1cba74){if(_0x1cba74){return _0x1cba74[_0xffa5('0x39')]()[_0xffa5('0x24')](function(){var _0x2c6ac1=_0x1cba74[_0xffa5('0x3a')]({'plain':!![]});var _0x5dc910='ChatWebsites';return db[_0xffa5('0x3b')][_0xffa5('0x39')]({'where':{'type':_0x5dc910,'resourceId':_0x2c6ac1['id']}})[_0xffa5('0x24')](function(){return _0x1cba74;});})[_0xffa5('0x24')](function(){_0x34604f[_0xffa5('0x31')](0xcc)[_0xffa5('0x32')]();});}};}function handleEntityNotFound(_0x3d1f6b,_0x5984b5){return function(_0x52516e){if(!_0x52516e){_0x3d1f6b[_0xffa5('0x30')](0x194);}return _0x52516e;};}function handleError(_0x11398c,_0x33aeac){_0x33aeac=_0x33aeac||0x1f4;return function(_0x3c2181){logger['error'](_0x3c2181['stack']);if(_0x3c2181[_0xffa5('0x3c')]){delete _0x3c2181[_0xffa5('0x3c')];}_0x11398c['status'](_0x33aeac)[_0xffa5('0x3d')](_0x3c2181);};}exports[_0xffa5('0x3e')]=function(_0x38e2fd,_0x1906e2){var _0x5250da={'include':[{'model':db[_0xffa5('0x3f')],'as':_0xffa5('0x40')}]},_0x226002={},_0x1ecc4a={'count':0x0,'rows':[]};var _0x134989=_[_0xffa5('0x41')](db['ChatWebsite'][_0xffa5('0x42')],function(_0x4d9b92){return{'name':_0x4d9b92[_0xffa5('0x43')],'type':_0x4d9b92[_0xffa5('0x44')][_0xffa5('0x45')]};});_0x226002[_0xffa5('0x46')]=_[_0xffa5('0x41')](_0x134989,'name');_0x226002['query']=_['keys'](_0x38e2fd[_0xffa5('0x47')]);_0x226002[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x226002['model'],_0x226002[_0xffa5('0x47')]);_0x5250da[_0xffa5('0x4a')]=_['intersection'](_0x226002[_0xffa5('0x46')],qs[_0xffa5('0x4b')](_0x38e2fd[_0xffa5('0x47')]['fields']));_0x5250da[_0xffa5('0x4a')]=_0x5250da[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x5250da['attributes']:_0x226002[_0xffa5('0x46')];if(!_0x38e2fd[_0xffa5('0x47')][_0xffa5('0x4d')](_0xffa5('0x4e'))){_0x5250da[_0xffa5('0x35')]=qs[_0xffa5('0x35')](_0x38e2fd['query'][_0xffa5('0x35')]);_0x5250da['offset']=qs[_0xffa5('0x34')](_0x38e2fd['query']['offset']);}_0x5250da['order']=qs[_0xffa5('0x4f')](_0x38e2fd['query'][_0xffa5('0x4f')]);_0x5250da[_0xffa5('0x50')]=qs[_0xffa5('0x48')](_['pick'](_0x38e2fd[_0xffa5('0x47')],_0x226002[_0xffa5('0x48')]),_0x134989);if(_0x38e2fd[_0xffa5('0x47')][_0xffa5('0x51')]){_0x5250da[_0xffa5('0x50')]=_[_0xffa5('0x52')](_0x5250da[_0xffa5('0x50')],{'$or':_[_0xffa5('0x41')](_0x134989,function(_0x342bb4){if(_0x342bb4['type']!==_0xffa5('0x53')){var _0x300580={};_0x300580[_0x342bb4[_0xffa5('0x3c')]]={'$like':'%'+_0x38e2fd[_0xffa5('0x47')][_0xffa5('0x51')]+'%'};return _0x300580;}})});}_0x5250da=_[_0xffa5('0x52')]({},_0x5250da,_0x38e2fd[_0xffa5('0x54')]);var _0xd4dabf={'where':_0x5250da[_0xffa5('0x50')]};return db['ChatWebsite'][_0xffa5('0x55')](_0xd4dabf)[_0xffa5('0x24')](function(_0x51c4be){_0x1ecc4a[_0xffa5('0x55')]=_0x51c4be;if(_0x38e2fd['query'][_0xffa5('0x56')]){_0x5250da[_0xffa5('0x57')]=[{'all':!![]}];}return db[_0xffa5('0x58')][_0xffa5('0x59')](_0x5250da);})[_0xffa5('0x24')](function(_0x1f3311){_0x1ecc4a[_0xffa5('0x5a')]=_0x1f3311;return _0x1ecc4a;})[_0xffa5('0x24')](respondWithFilteredResult(_0x1906e2,_0x5250da))[_0xffa5('0x2f')](handleError(_0x1906e2,null));};exports[_0xffa5('0x5b')]=function(_0x2d4ad0,_0x137adf){var _0x46a41f={'raw':![],'where':{'id':_0x2d4ad0['params']['id']},'include':[{'model':db[_0xffa5('0x3f')],'as':_0xffa5('0x40')}]},_0x4748a2={};_0x4748a2[_0xffa5('0x46')]=_[_0xffa5('0x5c')](db[_0xffa5('0x58')][_0xffa5('0x42')]);_0x4748a2['query']=_[_0xffa5('0x5c')](_0x2d4ad0[_0xffa5('0x47')]);_0x4748a2[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x4748a2[_0xffa5('0x46')],_0x4748a2[_0xffa5('0x47')]);_0x46a41f[_0xffa5('0x4a')]=_[_0xffa5('0x49')](_0x4748a2[_0xffa5('0x46')],qs[_0xffa5('0x4b')](_0x2d4ad0[_0xffa5('0x47')]['fields']));_0x46a41f[_0xffa5('0x4a')]=_0x46a41f['attributes'][_0xffa5('0x4c')]?_0x46a41f[_0xffa5('0x4a')]:_0x4748a2[_0xffa5('0x46')];if(_0x2d4ad0[_0xffa5('0x47')][_0xffa5('0x56')]){_0x46a41f[_0xffa5('0x57')]=[{'all':!![]}];}_0x46a41f=_[_0xffa5('0x52')]({},_0x46a41f,_0x2d4ad0[_0xffa5('0x54')]);return db[_0xffa5('0x58')][_0xffa5('0x5d')](_0x46a41f)['then'](handleEntityNotFound(_0x137adf,null))[_0xffa5('0x24')](respondWithResult(_0x137adf,null))[_0xffa5('0x2f')](handleError(_0x137adf,null));};exports['create']=function(_0x542bad,_0x193769){return db['ChatWebsite']['create'](_0x542bad[_0xffa5('0x5e')],{})['then'](function(_0x21f535){var _0x560ba7=_0x542bad[_0xffa5('0x5f')][_0xffa5('0x3a')]({'plain':!![]});if(!_0x560ba7)throw new Error(_0xffa5('0x60'));if(_0x560ba7['role']==='user'){var _0x5a6bba=_0x21f535[_0xffa5('0x3a')]({'plain':!![]});var _0x169d61=_0xffa5('0x61');return db['UserProfileSection'][_0xffa5('0x5d')]({'where':{'name':_0x169d61,'userProfileId':_0x560ba7[_0xffa5('0x62')]},'raw':!![]})['then'](function(_0x39d424){if(_0x39d424&&_0x39d424[_0xffa5('0x63')]===0x0){return db[_0xffa5('0x3b')][_0xffa5('0x64')]({'name':_0x5a6bba[_0xffa5('0x3c')],'resourceId':_0x5a6bba['id'],'type':_0x39d424[_0xffa5('0x3c')],'sectionId':_0x39d424['id']},{})[_0xffa5('0x24')](function(){return _0x21f535;});}else{return _0x21f535;}})[_0xffa5('0x2f')](function(_0x53411c){logger[_0xffa5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53411c);throw _0x53411c;});}return _0x21f535;})[_0xffa5('0x24')](respondWithResult(_0x193769,0xc9))[_0xffa5('0x2f')](handleError(_0x193769,null));};exports[_0xffa5('0x65')]=function(_0x18d75a,_0x54da61){if(_0x18d75a['body']['id']){delete _0x18d75a[_0xffa5('0x5e')]['id'];}return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x18d75a[_0xffa5('0x66')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xffa5('0x24')](handleEntityNotFound(_0x54da61,null))[_0xffa5('0x24')](saveUpdates(_0x18d75a[_0xffa5('0x5e')],null))['then'](respondWithResult(_0x54da61,null))[_0xffa5('0x2f')](handleError(_0x54da61,null));};exports[_0xffa5('0x39')]=function(_0x344c8d,_0x1e3b5e){return db['ChatWebsite'][_0xffa5('0x5d')]({'where':{'id':_0x344c8d['params']['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x1e3b5e,null))[_0xffa5('0x24')](removeEntity(_0x1e3b5e,null))[_0xffa5('0x2f')](handleError(_0x1e3b5e,null));};exports[_0xffa5('0x67')]=function(_0x248a7c,_0x14c37e){return db[_0xffa5('0x58')][_0xffa5('0x67')]()[_0xffa5('0x24')](respondWithResult(_0x14c37e,null))[_0xffa5('0x2f')](handleError(_0x14c37e,null));};exports[_0xffa5('0x68')]=function(_0x518e5a,_0x108cd6,_0x1b77f8){if(_0x518e5a[_0xffa5('0x5e')]['id']){delete _0x518e5a['body']['id'];}return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x518e5a[_0xffa5('0x66')]['id']}})['then'](handleEntityNotFound(_0x108cd6,null))[_0xffa5('0x24')](function(_0x57da70){if(_0x57da70){_0x518e5a[_0xffa5('0x5e')]['ChatWebsiteId']=_0x57da70['id'];return db['Disposition']['create'](_0x518e5a[_0xffa5('0x5e')]);}})['then'](respondWithResult(_0x108cd6,null))[_0xffa5('0x2f')](handleError(_0x108cd6,null));};exports['getDispositions']=function(_0x5df5e2,_0x56755e,_0x8fda71){var _0x3e880d={'raw':![],'where':{}};var _0x2dfce6={};var _0xd0dc36={'count':0x0,'rows':[]};return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x5df5e2[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x56755e,null))[_0xffa5('0x24')](function(_0x4372bb){if(_0x4372bb){_0x2dfce6[_0xffa5('0x46')]=_[_0xffa5('0x5c')](db[_0xffa5('0x6a')][_0xffa5('0x42')]);_0x2dfce6[_0xffa5('0x47')]=_[_0xffa5('0x5c')](_0x5df5e2[_0xffa5('0x47')]);_0x2dfce6[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x2dfce6[_0xffa5('0x46')],_0x2dfce6[_0xffa5('0x47')]);_0x3e880d[_0xffa5('0x4a')]=_[_0xffa5('0x49')](_0x2dfce6[_0xffa5('0x46')],qs[_0xffa5('0x4b')](_0x5df5e2[_0xffa5('0x47')][_0xffa5('0x4b')]));_0x3e880d[_0xffa5('0x4a')]=_0x3e880d[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x3e880d[_0xffa5('0x4a')]:_0x2dfce6['model'];if(!_0x5df5e2[_0xffa5('0x47')][_0xffa5('0x4d')]('nolimit')){_0x3e880d[_0xffa5('0x35')]=qs[_0xffa5('0x35')](_0x5df5e2['query'][_0xffa5('0x35')]);_0x3e880d[_0xffa5('0x34')]=qs['offset'](_0x5df5e2[_0xffa5('0x47')][_0xffa5('0x34')]);}_0x3e880d[_0xffa5('0x6b')]=qs['sort'](_0x5df5e2[_0xffa5('0x47')]['sort']);_0x3e880d[_0xffa5('0x50')]=qs[_0xffa5('0x48')](_[_0xffa5('0x6c')](_0x5df5e2[_0xffa5('0x47')],_0x2dfce6['filters']));_0x3e880d[_0xffa5('0x50')][_0xffa5('0x6d')]=_0x4372bb['id'];if(_0x5df5e2['query'][_0xffa5('0x51')]){_0x3e880d[_0xffa5('0x50')]=_['merge'](_0x3e880d['where'],{'$or':_['map'](_0x3e880d[_0xffa5('0x4a')],function(_0xaa697f){var _0x53a46c={};_0x53a46c[_0xaa697f]={'$like':'%'+_0x5df5e2[_0xffa5('0x47')]['filter']+'%'};return _0x53a46c;})});}_0x3e880d=_['merge']({},_0x3e880d,_0x5df5e2[_0xffa5('0x54')]);return db['Disposition'][_0xffa5('0x55')]({'where':_0x3e880d[_0xffa5('0x50')]})[_0xffa5('0x24')](function(_0x1beb7d){_0xd0dc36[_0xffa5('0x55')]=_0x1beb7d;if(_0x5df5e2['query'][_0xffa5('0x56')]){_0x3e880d[_0xffa5('0x57')]=[{'all':!![]}];}return db[_0xffa5('0x6a')][_0xffa5('0x59')](_0x3e880d);})['then'](function(_0x2cf577){_0xd0dc36[_0xffa5('0x5a')]=_0x2cf577;return _0xd0dc36;});}})[_0xffa5('0x24')](respondWithFilteredResult(_0x56755e,_0x3e880d))[_0xffa5('0x2f')](handleError(_0x56755e,null));};exports[_0xffa5('0x6e')]=function(_0x4e8ec1,_0xe4c5d,_0x2e887e){return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x4e8ec1[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0xe4c5d,null))[_0xffa5('0x24')](function(_0xd20c95){if(_0xd20c95){return _0xd20c95['removeDispositions'](_0x4e8ec1[_0xffa5('0x47')][_0xffa5('0x6f')]);}})[_0xffa5('0x24')](respondWithStatusCode(_0xe4c5d,null))['catch'](handleError(_0xe4c5d,null));};exports['addAnswer']=function(_0x4e669f,_0x4699cc,_0x26bd41){if(_0x4e669f[_0xffa5('0x5e')]['id']){delete _0x4e669f[_0xffa5('0x5e')]['id'];}return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x4e669f[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x4699cc,null))[_0xffa5('0x24')](function(_0x15cefa){if(_0x15cefa){_0x4e669f['body'][_0xffa5('0x6d')]=_0x15cefa['id'];return db['CannedAnswer'][_0xffa5('0x64')](_0x4e669f['body']);}})[_0xffa5('0x24')](respondWithResult(_0x4699cc,null))[_0xffa5('0x2f')](handleError(_0x4699cc,null));};exports['getAnswers']=function(_0x487e6d,_0x39e69a,_0x28d057){var _0x483d04={'raw':![],'where':{}};var _0x50245b={};var _0x15790b={'count':0x0,'rows':[]};return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x487e6d['params']['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x39e69a,null))[_0xffa5('0x24')](function(_0x453afd){if(_0x453afd){_0x50245b['model']=_[_0xffa5('0x5c')](db[_0xffa5('0x70')]['rawAttributes']);_0x50245b[_0xffa5('0x47')]=_[_0xffa5('0x5c')](_0x487e6d[_0xffa5('0x47')]);_0x50245b[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x50245b[_0xffa5('0x46')],_0x50245b[_0xffa5('0x47')]);_0x483d04[_0xffa5('0x4a')]=_[_0xffa5('0x49')](_0x50245b[_0xffa5('0x46')],qs['fields'](_0x487e6d['query'][_0xffa5('0x4b')]));_0x483d04[_0xffa5('0x4a')]=_0x483d04[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x483d04[_0xffa5('0x4a')]:_0x50245b['model'];if(!_0x487e6d[_0xffa5('0x47')]['hasOwnProperty'](_0xffa5('0x4e'))){_0x483d04[_0xffa5('0x35')]=qs['limit'](_0x487e6d['query']['limit']);_0x483d04[_0xffa5('0x34')]=qs['offset'](_0x487e6d[_0xffa5('0x47')]['offset']);}_0x483d04[_0xffa5('0x6b')]=qs[_0xffa5('0x4f')](_0x487e6d['query']['sort']);_0x483d04[_0xffa5('0x50')]=qs['filters'](_[_0xffa5('0x6c')](_0x487e6d[_0xffa5('0x47')],_0x50245b[_0xffa5('0x48')]));_0x483d04[_0xffa5('0x50')][_0xffa5('0x6d')]=_0x453afd['id'];if(_0x487e6d['query'][_0xffa5('0x51')]){_0x483d04[_0xffa5('0x50')]=_[_0xffa5('0x52')](_0x483d04['where'],{'$or':_[_0xffa5('0x41')](_0x483d04[_0xffa5('0x4a')],function(_0x49d321){var _0x23859b={};_0x23859b[_0x49d321]={'$like':'%'+_0x487e6d[_0xffa5('0x47')][_0xffa5('0x51')]+'%'};return _0x23859b;})});}_0x483d04=_[_0xffa5('0x52')]({},_0x483d04,_0x487e6d[_0xffa5('0x54')]);return db[_0xffa5('0x70')][_0xffa5('0x55')]({'where':_0x483d04[_0xffa5('0x50')]})[_0xffa5('0x24')](function(_0x15ccc3){_0x15790b[_0xffa5('0x55')]=_0x15ccc3;if(_0x487e6d['query'][_0xffa5('0x56')]){_0x483d04[_0xffa5('0x57')]=[{'all':!![]}];}return db[_0xffa5('0x70')][_0xffa5('0x59')](_0x483d04);})[_0xffa5('0x24')](function(_0x333557){_0x15790b['rows']=_0x333557;return _0x15790b;});}})[_0xffa5('0x24')](respondWithFilteredResult(_0x39e69a,_0x483d04))['catch'](handleError(_0x39e69a,null));};exports['removeAnswers']=function(_0x30f8ff,_0x44c89f,_0x39bfa4){return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x30f8ff['params']['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x44c89f,null))['then'](function(_0x1f3fea){if(_0x1f3fea){return _0x1f3fea['removeAnswers'](_0x30f8ff[_0xffa5('0x47')]['ids']);}})[_0xffa5('0x24')](respondWithStatusCode(_0x44c89f,null))[_0xffa5('0x2f')](handleError(_0x44c89f,null));};exports[_0xffa5('0x71')]=function(_0x49d323,_0x483443,_0x7dbe04){_0x49d323[_0xffa5('0x5e')][_0xffa5('0x72')]=_0x49d323[_0xffa5('0x73')]['filename'];return db['ChatWebsite'][_0xffa5('0x5d')]({'where':{'id':_0x49d323[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x483443,null))[_0xffa5('0x24')](saveUpdates(_0x49d323[_0xffa5('0x5e')],null))[_0xffa5('0x24')](respondWithResult(_0x483443,null))['catch'](handleError(_0x483443,null));};exports[_0xffa5('0x74')]=function(_0xf70119,_0x219108,_0xae5357){_0xf70119['body'][_0xffa5('0x75')]=_0xf70119['file'][_0xffa5('0x76')];return db[_0xffa5('0x58')]['find']({'where':{'id':_0xf70119[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x219108,null))[_0xffa5('0x24')](saveUpdates(_0xf70119[_0xffa5('0x5e')],null))[_0xffa5('0x24')](respondWithResult(_0x219108,null))[_0xffa5('0x2f')](handleError(_0x219108,null));};exports[_0xffa5('0x77')]=function(_0x5d1c5e,_0x36d18f,_0x2b16de){_0x5d1c5e[_0xffa5('0x5e')][_0xffa5('0x78')]=_0x5d1c5e[_0xffa5('0x73')][_0xffa5('0x76')];return db['ChatWebsite']['find']({'where':{'id':_0x5d1c5e[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x36d18f,null))['then'](saveUpdates(_0x5d1c5e[_0xffa5('0x5e')],null))[_0xffa5('0x24')](respondWithResult(_0x36d18f,null))[_0xffa5('0x2f')](handleError(_0x36d18f,null));};exports['addSystemAvatar']=function(_0x1403bc,_0x4beb7f,_0x55767f){_0x1403bc[_0xffa5('0x5e')]['systemAvatar']=_0x1403bc[_0xffa5('0x73')][_0xffa5('0x76')];return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x1403bc[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x4beb7f,null))[_0xffa5('0x24')](saveUpdates(_0x1403bc['body'],null))[_0xffa5('0x24')](respondWithResult(_0x4beb7f,null))[_0xffa5('0x2f')](handleError(_0x4beb7f,null));};exports['getLogo']=function(_0x41d8e4,_0x53c09c,_0x26a54d){var _0x1efb14=path[_0xffa5('0x79')](config['root'],_0xffa5('0x7a'));var _0x58649e={'where':{'id':_0x41d8e4[_0xffa5('0x66')]['id']},'attributes':['id',_0xffa5('0x72')],'raw':!![]};var _0x3cc17a=![];return require('../../config/license/util')[_0xffa5('0x7b')]()[_0xffa5('0x24')](function(_0x34ebe2){if(_0x34ebe2){_0x3cc17a=_0x34ebe2[_0xffa5('0x7c')];}})[_0xffa5('0x24')](function(){return db['ChatWebsite']['find'](_0x58649e);})['then'](handleEntityNotFound(_0x53c09c,null))[_0xffa5('0x24')](function(_0x18b525){if(_0x18b525){if(!_['isNil'](_0x18b525[_0xffa5('0x72')])){if(fs[_0xffa5('0x7d')](path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x7f'),_0x18b525[_0xffa5('0x72')]))&&_0x3cc17a){_0x1efb14=path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x7f'),_0x18b525['sitepic']);}}return _0x53c09c[_0xffa5('0x80')](_0x1efb14);}})[_0xffa5('0x2f')](handleError(_0x53c09c,null));};exports[_0xffa5('0x81')]=function(_0x207d58,_0xb9490e,_0xe726e2){var _0x3126b0=path[_0xffa5('0x79')](config['root'],_0xffa5('0x82'));var _0x21925b={'where':{'id':_0x207d58[_0xffa5('0x66')]['id']},'attributes':['id',_0xffa5('0x75')],'raw':!![]};return db['ChatWebsite'][_0xffa5('0x5d')](_0x21925b)[_0xffa5('0x24')](handleEntityNotFound(_0xb9490e,null))['then'](function(_0x2d9123){if(_0x2d9123){if(!_['isNil'](_0x2d9123[_0xffa5('0x75')])){if(fs[_0xffa5('0x7d')](path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x83'),_0x2d9123[_0xffa5('0x75')]))){_0x3126b0=path['join'](config[_0xffa5('0x7e')],_0xffa5('0x83'),_0x2d9123[_0xffa5('0x75')]);}}return _0xb9490e[_0xffa5('0x80')](_0x3126b0);}})[_0xffa5('0x2f')](handleError(_0xb9490e,null));};exports[_0xffa5('0x84')]=function(_0x5eda63,_0x4df6de,_0x2bfa01){var _0x445be9=path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x85'));var _0x4a0a07={'where':{'id':_0x5eda63['params']['id']},'attributes':['id',_0xffa5('0x78'),'showCustomerAvatar'],'raw':!![]};return db[_0xffa5('0x58')][_0xffa5('0x5d')](_0x4a0a07)[_0xffa5('0x24')](handleEntityNotFound(_0x4df6de,null))[_0xffa5('0x24')](function(_0x515097){if(_0x515097){if(!_[_0xffa5('0x86')](_0x515097[_0xffa5('0x78')])){if(fs[_0xffa5('0x7d')](path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x83'),_0x515097[_0xffa5('0x78')]))&&_0x515097['showCustomerAvatar']){_0x445be9=path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x83'),_0x515097[_0xffa5('0x78')]);}}return _0x4df6de[_0xffa5('0x80')](_0x445be9);}})[_0xffa5('0x2f')](handleError(_0x4df6de,null));};exports['getSystemAvatar']=function(_0x1725a7,_0xf5ff4b,_0xd28065){var _0x595108=path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0x87'));var _0x3b4a92={'where':{'id':_0x1725a7[_0xffa5('0x66')]['id']},'attributes':['id',_0xffa5('0x88')],'raw':!![]};return db[_0xffa5('0x58')][_0xffa5('0x5d')](_0x3b4a92)['then'](handleEntityNotFound(_0xf5ff4b,null))[_0xffa5('0x24')](function(_0x26daf5){if(_0x26daf5){if(!_['isNil'](_0x26daf5[_0xffa5('0x88')])){if(fs[_0xffa5('0x7d')](path[_0xffa5('0x79')](config['root'],_0xffa5('0x83'),_0x26daf5['systemAvatar']))){_0x595108=path[_0xffa5('0x79')](config[_0xffa5('0x7e')],'server/files/images/avatars/',_0x26daf5[_0xffa5('0x88')]);}}return _0xf5ff4b[_0xffa5('0x80')](_0x595108);}})[_0xffa5('0x2f')](handleError(_0xf5ff4b,null));};exports[_0xffa5('0x89')]=function(_0x41f047,_0x4b7d85,_0x84e229){var _0x2226eb=require(_0xffa5('0x8a'));var _0x4089e5=new _0x2226eb();var _0x11f737=_0x4089e5[_0xffa5('0x8b')](_0x41f047[_0xffa5('0x8c')][_0xffa5('0x8d')])[_0xffa5('0x8e')]();var _0x30bdf0={'body':_0x41f047['body'],'channel':_0xffa5('0x8f')};var _0x33209b=[];var _0x1c644e=[];var _0x2e591d={};var _0x128ec7=![];return db['CmContact'][_0xffa5('0x67')]()[_0xffa5('0x24')](function(_0x424e2b){if(!_0x424e2b){throw new db[(_0xffa5('0x90'))][(_0xffa5('0x91'))](_0xffa5('0x92'));}_0x33209b=_[_0xffa5('0x93')](_[_0xffa5('0x5c')](_0x424e2b),[_0xffa5('0x94'),_0xffa5('0x95')]);_0x1c644e=_['difference'](_[_0xffa5('0x5c')](_0x424e2b),[_0xffa5('0x94'),_0xffa5('0x95'),_0xffa5('0x96'),_0xffa5('0x97')]);if(_0x41f047[_0xffa5('0x5e')]['id']){delete _0x41f047['body']['id'];}if(_[_0xffa5('0x86')](_0x41f047[_0xffa5('0x5e')][_0xffa5('0x98')])){throw new db['Sequelize'][(_0xffa5('0x91'))]('from\x20is\x20mandatory');}if(_[_0xffa5('0x86')](_0x41f047[_0xffa5('0x5e')]['body'])||_0x41f047[_0xffa5('0x5e')][_0xffa5('0x5e')]===''){throw new db[(_0xffa5('0x90'))][(_0xffa5('0x91'))](_0xffa5('0x99'));}if(_['isNil'](_0x41f047['body'][_0xffa5('0x9a')])){throw new db[(_0xffa5('0x90'))][(_0xffa5('0x91'))](_0xffa5('0x9b')+_0x1c644e);}if(!_['includes'](_0x1c644e,_0x41f047[_0xffa5('0x5e')][_0xffa5('0x9a')])){throw new db['Sequelize']['ValidationError'](_0xffa5('0x9c')+_0x1c644e);}_0x2e591d[_0x41f047[_0xffa5('0x5e')][_0xffa5('0x9a')]]=_0x41f047[_0xffa5('0x5e')][_0xffa5('0x98')];})[_0xffa5('0x24')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x41f047[_0xffa5('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0xffa5('0x9d'),'include':[{'model':db[_0xffa5('0x9e')],'as':'Contacts','where':_0x2e591d,'limit':0x1,'order':[[_0xffa5('0x95'),_0xffa5('0x9f')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xffa5('0x24')](handleEntityNotFound(_0x4b7d85,null))[_0xffa5('0x24')](function(_0x25cced){if(_0x25cced&&_0x25cced[_0xffa5('0x9d')]){_0x30bdf0[_0xffa5('0xa0')]=_0x25cced;_0x30bdf0[_0xffa5('0xa1')]=_0x25cced[_0xffa5('0xa2')];_0x30bdf0['list']=_0x25cced[_0xffa5('0x9d')];_0x30bdf0[_0xffa5('0xa1')]=_[_0xffa5('0xa3')](_0x30bdf0['applications'],['priority'],[_0xffa5('0xa4')]);if(_0x30bdf0[_0xffa5('0xa0')][_0xffa5('0xa2')]){delete _0x30bdf0[_0xffa5('0xa0')][_0xffa5('0xa2')];}if(_0x30bdf0[_0xffa5('0xa0')][_0xffa5('0x9d')]&&_0x30bdf0[_0xffa5('0xa0')][_0xffa5('0x9d')][_0xffa5('0xa5')][_0xffa5('0x4c')]){return _0x30bdf0[_0xffa5('0xa0')][_0xffa5('0x9d')][_0xffa5('0xa5')][0x0];}var _0xe2119e=_[_0xffa5('0x1a')](_0x41f047[_0xffa5('0x5e')],{'firstName':_0x41f047[_0xffa5('0x5e')][_0xffa5('0x98')],'ListId':_0x25cced[_0xffa5('0x97')]});_0xe2119e[_0x41f047[_0xffa5('0x5e')][_0xffa5('0x9a')]]=_0x41f047['body']['from'];return db['CmContact'][_0xffa5('0x64')](_0xe2119e,{'fields':_0x33209b,'raw':!![]});}})[_0xffa5('0x24')](handleEntityNotFound(_0x4b7d85,null))['then'](function(_0x2bd25d){_0x30bdf0[_0xffa5('0xa6')]=_0x2bd25d;var _0x57be65=_0x41f047[_0xffa5('0x5e')]['customerIp'];if(_0x41f047['headers'][_0xffa5('0xa7')]){_0x57be65=_0x41f047['headers'][_0xffa5('0xa7')];}else if(_0x41f047['headers'][_0xffa5('0xa8')]){_0x57be65=_[_0xffa5('0xa9')](_0x41f047[_0xffa5('0x8c')][_0xffa5('0xa8')][_0xffa5('0xaa')](','));}if(_0x2bd25d){var _0x59dd87={'ContactId':_0x2bd25d['id'],'ChatWebsiteId':_0x41f047[_0xffa5('0x66')]['id'],'from':(_0x2bd25d['firstName']||'')+'\x20'+(_0x2bd25d[_0xffa5('0xab')]||''),'customerIp':_0x57be65,'customerPort':_0x41f047['headers'][_0xffa5('0xac')]?_0x41f047[_0xffa5('0x8c')][_0xffa5('0xac')]:null,'referer':_0x41f047[_0xffa5('0x5e')][_0xffa5('0xad')],'browserName':_0x11f737[_0xffa5('0xae')][_0xffa5('0x3c')]&&_0x11f737[_0xffa5('0xae')]['version']?util[_0xffa5('0xaf')](_0xffa5('0xb0'),_0x11f737[_0xffa5('0xae')][_0xffa5('0x3c')],_0x11f737[_0xffa5('0xae')]['version']):_0xffa5('0xb1'),'browserVersion':_0x11f737[_0xffa5('0xae')][_0xffa5('0xb2')]||_0xffa5('0xb1'),'osName':util[_0xffa5('0xaf')](_0xffa5('0xb0'),_0x11f737['os'][_0xffa5('0x3c')],_0x11f737['os'][_0xffa5('0xb2')]),'osVersion':_0x11f737['os'][_0xffa5('0xb2')],'deviceModel':_0x11f737[_0xffa5('0xb3')][_0xffa5('0x46')]&&_0x11f737[_0xffa5('0xb3')][_0xffa5('0xb4')]?util[_0xffa5('0xaf')](_0xffa5('0xb5'),_0x11f737[_0xffa5('0xb3')]['model'],_0x11f737['device'][_0xffa5('0xb4')],_0x11f737[_0xffa5('0xb3')]['type']):null,'deviceVendor':_0x11f737[_0xffa5('0xb3')][_0xffa5('0xb4')],'deviceType':_0x11f737[_0xffa5('0xb3')]['type'],'formData':JSON['stringify'](_0x41f047['body'])};var _0x449bf4={'ChatWebsiteId':_0x41f047['params']['id'],'closed':![]};if(_0x41f047[_0xffa5('0x5e')][_0xffa5('0xb6')]){_0x449bf4[_0xffa5('0xb6')]=_0x41f047['body'][_0xffa5('0xb6')];return db[_0xffa5('0xb7')][_0xffa5('0x5d')]({'where':_0x449bf4})[_0xffa5('0x24')](function(_0x4133a6){if(_0x4133a6){return[_0x4133a6,![]];}_0x59dd87[_0xffa5('0xb6')]=_0x41f047[_0xffa5('0x5e')][_0xffa5('0xb6')];_0x59dd87['externalUrl']=_0x41f047['body'][_0xffa5('0xb8')];return db[_0xffa5('0xb7')][_0xffa5('0x64')](_0x59dd87)[_0xffa5('0x24')](function(_0x113a8e){return[_0x113a8e,!![]];});});}_0x449bf4[_0xffa5('0xb9')]=_0x2bd25d['id'];if(_0x41f047['body'][_0xffa5('0xba')]&&_0x41f047[_0xffa5('0x5e')][_0xffa5('0xba')]['id']){_0x449bf4['id']=_0x41f047[_0xffa5('0x5e')][_0xffa5('0xba')]['id'];return db['ChatInteraction'][_0xffa5('0x5d')]({'where':_0x449bf4})[_0xffa5('0x24')](function(_0x19de8d){if(_0x19de8d){return[_0x19de8d,![]];}return db[_0xffa5('0xb7')][_0xffa5('0x64')](_0x59dd87)[_0xffa5('0x24')](function(_0x263552){return[_0x263552,!![]];});});}return db[_0xffa5('0xb7')][_0xffa5('0x64')](_0x59dd87)[_0xffa5('0x24')](function(_0x234804){return[_0x234804,!![]];});}})['spread'](function(_0x36e01a,_0x2b2928){if(_0x36e01a){_0x128ec7=_0x2b2928;if(!_0x2b2928){var _0x21d3ad={'from':(_0x30bdf0['contact'][_0xffa5('0xbb')]||'')+'\x20'+(_0x30bdf0['contact'][_0xffa5('0xab')]||'')};if(_0x41f047[_0xffa5('0x5e')]['threadId']&&_0x41f047[_0xffa5('0x5e')]['messageId']&&_0x41f047['body']['threadId']!=_0x41f047[_0xffa5('0x5e')][_0xffa5('0xbc')]){_0x21d3ad[_0xffa5('0xb6')]=_0x41f047[_0xffa5('0x5e')]['messageId'];}return _0x36e01a[_0xffa5('0x65')](_0x21d3ad);}else{return _0x36e01a;}}})['then'](function(_0x35a3bb){_0x30bdf0[_0xffa5('0xba')]=_0x35a3bb[_0xffa5('0x3a')]({'plain':!![]});_0x30bdf0[_0xffa5('0xba')][_0xffa5('0xbd')]=_0x128ec7;if(_0x30bdf0['interaction'][_0xffa5('0xbd')]){if(_0x30bdf0['account'][_0xffa5('0xbe')]){_0x30bdf0[_0xffa5('0xa1')][_0xffa5('0xbf')]({'id':0x0,'priority':_0x30bdf0['applications'][_0xffa5('0x4c')]+0x1,'app':_0xffa5('0xc0'),'appdata':_0xffa5('0xc1'),'interval':'*,*,*,*'});}}return db[_0xffa5('0xc2')][_0xffa5('0x64')]({'body':_0x41f047['body'][_0xffa5('0x5e')],'ChatWebsiteId':_0x41f047[_0xffa5('0x66')]['id'],'ChatInteractionId':_0x35a3bb['id'],'direction':'in','ContactId':_0x30bdf0[_0xffa5('0xa6')]['id'],'AttachmentId':_0x41f047[_0xffa5('0x5e')][_0xffa5('0xc3')]});})[_0xffa5('0x24')](function(_0x198cf3){_0x30bdf0[_0xffa5('0x2d')]=_0x198cf3;if(_0x30bdf0[_0xffa5('0xba')][_0xffa5('0xc4')]){return db[_0xffa5('0xc5')][_0xffa5('0x5d')]({'attributes':['id',_0xffa5('0x3c')],'where':{'id':_0x30bdf0[_0xffa5('0xba')][_0xffa5('0xc4')]}})[_0xffa5('0x24')](function(_0x48601a){if(_0x48601a){_0x30bdf0[_0xffa5('0xa1')]['unshift']({'id':0x0,'priority':0x0,'app':_0xffa5('0xc6'),'appdata':_0x48601a[_0xffa5('0x3c')]+','+(_0x30bdf0[_0xffa5('0xa0')][_0xffa5('0xc7')]||0xa),'interval':_0xffa5('0xc8')});_0x30bdf0[_0xffa5('0xc9')]=!![];}return respondWithRpcPromise(_0xffa5('0xca'),_0xffa5('0xcb'),_0x30bdf0);});}return respondWithRpcPromise(_0xffa5('0xca'),_0xffa5('0xcb'),_0x30bdf0);})['then'](function(_0x42c6d3){respondWithRpcPromise(_0xffa5('0xcc'),_0xffa5('0xcc'),{'event':_0xffa5('0x89'),'message':_0x42c6d3},client9002);return _0x42c6d3;})[_0xffa5('0x24')](respondWithResult(_0x4b7d85,null))[_0xffa5('0x2f')](handleError(_0x4b7d85,null));};exports[_0xffa5('0xcd')]=function(_0x570de2,_0x2b9771,_0x7f4fd9){var _0x4ead9f,_0x25825b,_0xde6886;var _0x273350=[];var _0xd08f24=[];var _0x23f39d={};return db['CmContact'][_0xffa5('0x67')]()[_0xffa5('0x24')](function(_0x3776bf){if(!_0x3776bf){throw new db[(_0xffa5('0x90'))][(_0xffa5('0x91'))](_0xffa5('0x92'));}_0xd08f24=_[_0xffa5('0x93')](_['keys'](_0x3776bf),[_0xffa5('0x94'),'updatedAt']);_0x273350=_[_0xffa5('0x93')](_[_0xffa5('0x5c')](_0x3776bf),[_0xffa5('0x94'),'updatedAt',_0xffa5('0x96'),_0xffa5('0x97')]);if(_0x570de2[_0xffa5('0x5e')]['id']){delete _0x570de2[_0xffa5('0x5e')]['id'];}if(_['isNil'](_0x570de2[_0xffa5('0x5e')][_0xffa5('0x98')])){throw _0x2b9771['status'](0x1f4)[_0xffa5('0x3d')](new db[(_0xffa5('0x90'))][(_0xffa5('0x91'))](_0xffa5('0xce')));}if(_[_0xffa5('0x86')](_0x570de2[_0xffa5('0x5e')]['body'])||_0x570de2['body']['body']===''){throw _0x2b9771[_0xffa5('0x31')](0x1f4)[_0xffa5('0x3d')](new db[(_0xffa5('0x90'))]['ValidationError'](_0xffa5('0x99')));}if(_[_0xffa5('0x86')](_0x570de2[_0xffa5('0x5e')][_0xffa5('0xcf')])){throw _0x2b9771['status'](0x1f4)['send'](new db[(_0xffa5('0x90'))][(_0xffa5('0x91'))](_0xffa5('0xd0')+_0x273350));}if(!_[_0xffa5('0xd1')](_0x273350,_0x570de2[_0xffa5('0x5e')][_0xffa5('0xcf')])){throw _0x2b9771[_0xffa5('0x31')](0x1f4)[_0xffa5('0x3d')](new db['Sequelize'][(_0xffa5('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x273350));}_0x23f39d[_0x570de2[_0xffa5('0x5e')]['mapKeyOffline']]=_0x570de2[_0xffa5('0x5e')][_0xffa5('0x98')];})[_0xffa5('0x24')](function(){return db['ChatWebsite'][_0xffa5('0x5d')]({'where':{'id':_0x570de2['params']['id']},'include':[{'model':db[_0xffa5('0xd2')],'as':_0xffa5('0x9d')}]});})[_0xffa5('0x24')](handleEntityNotFound(_0x2b9771,null))[_0xffa5('0x24')](function(_0x3bd780){if(_0x3bd780&&_0x3bd780[_0xffa5('0x9d')]){_0x25825b=_0x3bd780;var _0x3fc771=_[_0xffa5('0x1a')](_0x570de2[_0xffa5('0x5e')],{'firstName':_0x570de2[_0xffa5('0x5e')][_0xffa5('0x98')],'phone':_0x570de2['body']['from'],'ListId':_0x3bd780['ListId']});_0x3fc771[_0x570de2['body'][_0xffa5('0xcf')]]=_0x570de2[_0xffa5('0x5e')][_0xffa5('0x98')];return db[_0xffa5('0x9e')]['findOrCreate']({'where':_0x23f39d,'defaults':_0x3fc771});}})[_0xffa5('0xd3')](function(_0x205df4){if(_0x205df4){_0xde6886=_0x205df4;var _0x249f17=fs[_0xffa5('0xd4')](path[_0xffa5('0x79')](config[_0xffa5('0x7e')],_0xffa5('0xd5')),_0xffa5('0xd6'));var _0x51e62c=ejs[_0xffa5('0xd7')](_0x249f17,{'body':_[_0xffa5('0xd8')](_0x570de2[_0xffa5('0x5e')][_0xffa5('0x5e')]),'bodyTitle':_0x25825b[_0xffa5('0xd9')]});return db[_0xffa5('0xda')][_0xffa5('0x64')]({'body':_0x51e62c,'ContactId':_0x205df4['id'],'ChatWebsiteId':_0x25825b['id']});}})[_0xffa5('0x24')](function(_0x2f1539){if(_0x2f1539){_0x4ead9f=_0x2f1539;return db[_0xffa5('0xdb')][_0xffa5('0x69')]({'where':{'service':!![]},'include':[{'model':db[_0xffa5('0xdc')],'as':'Smtp','raw':!![]}]});}})[_0xffa5('0x24')](function(_0x2baeb6){if(_0x2baeb6&&_0x2baeb6[_0xffa5('0xdd')]&&_0x25825b['forwardOfflineAddress']){var _0x4e3d99={'tls':{'rejectUnauthorized':![]}};if(_0x2baeb6['Smtp'][_0xffa5('0xde')]){_0x4e3d99[_0xffa5('0xde')]=_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0xde')];}else{_0x4e3d99[_0xffa5('0xdf')]=_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0xdf')];_0x4e3d99[_0xffa5('0xe0')]=_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0xe0')];_0x4e3d99[_0xffa5('0xe1')]=_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0xe1')];}if(_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0xe2')]){_0x4e3d99[_0xffa5('0xe3')]={'user':_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0x5f')],'pass':_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0xe4')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x4e3d99,'message':{'from':util[_0xffa5('0xaf')](_0xffa5('0xe5'),_0x2baeb6[_0xffa5('0x3c')],_0x2baeb6[_0xffa5('0xe6')]||_0x2baeb6[_0xffa5('0xdd')][_0xffa5('0x5f')]),'to':_0x25825b[_0xffa5('0xe7')],'subject':_0x25825b['offlineMessageSubject'],'text':_0x4ead9f[_0xffa5('0x5e')]}},client9003)[_0xffa5('0x24')](function(){return _0x4ead9f;})[_0xffa5('0x2f')](function(_0x3c8cb9){console[_0xffa5('0x2b')](_0x3c8cb9);});}})['then'](function(){if(_0x4ead9f){return _0x4ead9f;}})[_0xffa5('0x24')](respondWithResult(_0x2b9771,null))[_0xffa5('0x2f')](handleError(_0x2b9771,null));};exports['addInteraction']=function(_0x1bf020,_0xf6269d,_0x5c4806){return db['ChatInteraction'][_0xffa5('0x5d')]({'where':{'id':_0x1bf020[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0xf6269d,null))['then'](function(_0x4b6600){if(_0x4b6600){return _0x4b6600['addInteraction'](_0x1bf020[_0xffa5('0x5e')][_0xffa5('0x6f')],_['omit'](_0x1bf020['body'],[_0xffa5('0x6f'),'id'])||{});}})[_0xffa5('0x24')](respondWithResult(_0xf6269d,null))[_0xffa5('0x2f')](handleError(_0xf6269d,null));};exports[_0xffa5('0xe8')]=function(_0x524ec4,_0x1c895f,_0x3fbe06){var _0x24f9b9={'raw':![],'where':{}};var _0x143529={};var _0x245e14={'count':0x0,'rows':[]};return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x524ec4[_0xffa5('0x66')]['id']}})['then'](handleEntityNotFound(_0x1c895f,null))[_0xffa5('0x24')](function(_0x2ac933){if(_0x2ac933){_0x143529[_0xffa5('0x46')]=_[_0xffa5('0x5c')](db[_0xffa5('0xb7')][_0xffa5('0x42')]);_0x143529[_0xffa5('0x47')]=_[_0xffa5('0x5c')](_0x524ec4[_0xffa5('0x47')]);_0x143529[_0xffa5('0x48')]=_['intersection'](_0x143529[_0xffa5('0x46')],_0x143529[_0xffa5('0x47')]);_0x24f9b9[_0xffa5('0x4a')]=_[_0xffa5('0x49')](_0x143529[_0xffa5('0x46')],qs[_0xffa5('0x4b')](_0x524ec4[_0xffa5('0x47')][_0xffa5('0x4b')]));_0x24f9b9[_0xffa5('0x4a')]=_0x24f9b9[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x24f9b9['attributes']:_0x143529[_0xffa5('0x46')];if(!_0x524ec4[_0xffa5('0x47')]['hasOwnProperty']('nolimit')){_0x24f9b9[_0xffa5('0x35')]=qs[_0xffa5('0x35')](_0x524ec4[_0xffa5('0x47')][_0xffa5('0x35')]);_0x24f9b9[_0xffa5('0x34')]=qs[_0xffa5('0x34')](_0x524ec4[_0xffa5('0x47')][_0xffa5('0x34')]);}_0x24f9b9[_0xffa5('0x6b')]=qs[_0xffa5('0x4f')](_0x524ec4[_0xffa5('0x47')][_0xffa5('0x4f')]);_0x24f9b9[_0xffa5('0x50')]=qs[_0xffa5('0x48')](_[_0xffa5('0x6c')](_0x524ec4[_0xffa5('0x47')],_0x143529[_0xffa5('0x48')]));_0x24f9b9[_0xffa5('0x50')][_0xffa5('0x6d')]=_0x2ac933['id'];if(_0x524ec4[_0xffa5('0x47')][_0xffa5('0x51')]){_0x24f9b9[_0xffa5('0x50')]=_['merge'](_0x24f9b9[_0xffa5('0x50')],{'$or':_[_0xffa5('0x41')](_0x24f9b9[_0xffa5('0x4a')],function(_0x56d206){var _0x3c6246={};_0x3c6246[_0x56d206]={'$like':'%'+_0x524ec4[_0xffa5('0x47')][_0xffa5('0x51')]+'%'};return _0x3c6246;})});}_0x24f9b9=_[_0xffa5('0x52')]({},_0x24f9b9,_0x524ec4['options']);return db[_0xffa5('0xb7')][_0xffa5('0x55')]({'where':_0x24f9b9[_0xffa5('0x50')]})[_0xffa5('0x24')](function(_0x67df07){_0x245e14[_0xffa5('0x55')]=_0x67df07;if(_0x524ec4['query'][_0xffa5('0x56')]){_0x24f9b9[_0xffa5('0x57')]=[{'model':db[_0xffa5('0x9e')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xffa5('0xe9'),'attributes':[_0xffa5('0x3c'),_0xffa5('0xea'),_0xffa5('0xeb')],'required':![]},{'model':db[_0xffa5('0xec')],'as':_0xffa5('0xed'),'attributes':['id',_0xffa5('0x3c'),_0xffa5('0xee')],'where':_0x524ec4[_0xffa5('0x47')][_0xffa5('0xef')]?{'id':_0x524ec4[_0xffa5('0x47')]['tag']}:undefined,'required':_0x524ec4[_0xffa5('0x47')]['tag']?!![]:![]}];}return db[_0xffa5('0xb7')]['findAll'](_0x24f9b9);})[_0xffa5('0x24')](function(_0x2a7300){_0x245e14[_0xffa5('0x5a')]=_0x2a7300;return _0x245e14;});}})['then'](respondWithFilteredResult(_0x1c895f,_0x24f9b9))[_0xffa5('0x2f')](handleError(_0x1c895f,null));};function iftimePromise(_0x223877,_0x37e2b5){return respondWithRpcPromise(_0xffa5('0xf0'),_0xffa5('0xf1'),{'command':_0x37e2b5['timezone']?util[_0xffa5('0xaf')](_0xffa5('0xf2'),_0x223877['interval'],_0x37e2b5[_0xffa5('0xf3')]):util[_0xffa5('0xaf')](_0xffa5('0xf4'),_0x223877[_0xffa5('0xf5')])},client9002)['then'](function(_0x3bc4f6){var _0x563741=_0x3bc4f6&&_0x3bc4f6[_0xffa5('0xf6')](_0xffa5('0xf7'))>=0x0?!![]:![];logger['info'](_0xffa5('0xf8'),_0x37e2b5['id'],_0x223877['id'],_0x223877[_0xffa5('0xf5')],_0x563741?_0xffa5('0xf9'):_0xffa5('0xfa'),_0x37e2b5[_0xffa5('0xf3')]?_0x37e2b5[_0xffa5('0xf3')]:_0xffa5('0xfb'));return _0x563741;})['catch'](function(_0x3ec1fb){logger[_0xffa5('0x2b')](_0xffa5('0xf8'),_0x37e2b5['id'],_0x223877['id'],_0x223877[_0xffa5('0xf5')],util[_0xffa5('0xfc')](_0x3ec1fb,{'showHidden':![],'depth':null}),_0x37e2b5[_0xffa5('0xf3')]?_0x37e2b5[_0xffa5('0xf3')]:'No\x20timezone');return![];});}exports[_0xffa5('0xf1')]=function(_0x55da9b,_0x248fd0,_0x3eb2d0){var _0x133fbb=0x0;var _0x20ac2b=0x0;var _0xdd1aa0=![];var _0x57b29f;var _0x2889b6;return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x55da9b[_0xffa5('0x66')]['id']},'include':[{'model':db['Interval'],'as':_0xffa5('0xfd'),'include':[{'model':db[_0xffa5('0xfd')],'as':_0xffa5('0xfe'),'attributes':['id',_0xffa5('0xf5')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x248fd0,null))[_0xffa5('0x24')](function(_0x2f92f){if(_0x2f92f){_0x57b29f=_0x2f92f;return _0x2f92f[_0xffa5('0xff')]({'raw':!![]});}})[_0xffa5('0x24')](function(_0x222f86){if(_0x57b29f){if(_0x222f86){_0x2889b6=_0x222f86;}}return require(_0xffa5('0x18'))[_0xffa5('0x7b')]();})[_0xffa5('0x24')](function(_0x44ae3d){if(_0x44ae3d){_0x20ac2b=_0x44ae3d[_0xffa5('0x100')];_0xdd1aa0=_0x44ae3d['custom'];}})[_0xffa5('0x24')](function(){return db[_0xffa5('0xb7')][_0xffa5('0x55')]({'where':{'closed':![]}});})[_0xffa5('0x24')](function(_0x2ed2bb){_0x133fbb=_0x2ed2bb;if(_0x20ac2b&&_0x2ed2bb>_0x20ac2b){return db[_0xffa5('0x101')][_0xffa5('0x69')]({'where':{'id':0x1}})['then'](function(_0x16e42d){if(_0x16e42d){_0x16e42d[_0xffa5('0x102')]('chatLicenseExceeded');}});}})[_0xffa5('0x24')](function(){if(_0x57b29f[_0xffa5('0xfd')]&&_0x57b29f['Interval'][_0xffa5('0xfe')]){var _0x5c4430=[];for(var _0x417640=0x0;_0x417640<_0x57b29f[_0xffa5('0xfd')]['Intervals'][_0xffa5('0x4c')];_0x417640++){var _0x4ffcd7=_0x57b29f[_0xffa5('0xfd')]['Intervals'][_0x417640][_0xffa5('0x3a')]({'plain':!![]});_0x5c4430['push'](iftimePromise(_0x4ffcd7,_0x57b29f));}return BPromise[_0xffa5('0x103')](_0x5c4430)[_0xffa5('0x24')](function(_0x243289){return _[_0xffa5('0x104')](_0x243289);});}else{return!![];}})['then'](function(_0x29d81b){var _0x5393b7=fs[_0xffa5('0xd4')](path[_0xffa5('0x79')](config['root'],_0xffa5('0x105')),'utf8');var _0x1ec36d={'remote':_0x57b29f[_0xffa5('0x106')],'query':querystring[_0xffa5('0x2a')](_[_0xffa5('0x52')](_0x57b29f[_0xffa5('0x3a')]({'plain':!![]}),{'customerIp':_0x55da9b[_0xffa5('0x8c')][_0xffa5('0xa8')]||_0x55da9b[_0xffa5('0x8c')][_0xffa5('0x107')]||_0x55da9b[_0xffa5('0x108')][_0xffa5('0x109')]||_0x55da9b['ip'],'referer':_0x55da9b['headers'][_0xffa5('0xad')],'openedInteractions':_0x133fbb,'maxInteractions':_0x20ac2b,'virtual':_0xdd1aa0['virtual'],'online':_0x29d81b,'custom':_0xdd1aa0}))[_0xffa5('0x10a')](/'/g,'\x5c\x27')};_0x248fd0[_0xffa5('0x3d')](ejs['render'](Mustache['render'](_0x5393b7,_0x1ec36d),{'proactiveActions':_0x2889b6,'alignment':_0x57b29f[_0xffa5('0x10b')],'verticalAlignment':_0x57b29f[_0xffa5('0x10c')],'div_color':_0x57b29f[_0xffa5('0xee')],'text_color':_0x57b29f[_0xffa5('0x10d')]}));})[_0xffa5('0x2f')](handleError(_0x248fd0,null));};exports[_0xffa5('0x10e')]=function(_0x1585e6,_0x980639,_0x445a77){return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x1585e6[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x980639,null))[_0xffa5('0x24')](function(_0x224c04){if(_0x224c04){return db[_0xffa5('0x10f')][_0xffa5('0x110')](function(_0x5a1f2c){return db[_0xffa5('0x111')][_0xffa5('0x39')]({'where':{'ChatWebsiteId':_0x1585e6[_0xffa5('0x66')]['id']},'transaction':_0x5a1f2c})[_0xffa5('0x24')](function(_0x39cd00){var _0x19a258=_[_0xffa5('0x41')](_0x1585e6[_0xffa5('0x5e')],function(_0x658727){_0x658727['ChatWebsiteId']=_0x1585e6[_0xffa5('0x66')]['id'];return _0x658727;});return db[_0xffa5('0x111')][_0xffa5('0x112')](_0x19a258,{'transaction':_0x5a1f2c});});})[_0xffa5('0x24')](function(){return db[_0xffa5('0x111')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1585e6[_0xffa5('0x66')]['id']},'order':_0xffa5('0x113')});});}})[_0xffa5('0x24')](respondWithResult(_0x980639,null))[_0xffa5('0x2f')](handleError(_0x980639,null));};exports[_0xffa5('0x114')]=function(_0x390fa9,_0x2a71c5,_0x152a13){var _0x4b5be7={};var _0x394097={};var _0x5ed128;var _0x3c45c9;return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x390fa9[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x2a71c5,null))['then'](function(_0x43ac64){if(_0x43ac64){_0x5ed128=_0x43ac64;_0x394097[_0xffa5('0x46')]=_[_0xffa5('0x5c')](db[_0xffa5('0x111')][_0xffa5('0x42')]);_0x394097[_0xffa5('0x47')]=_['keys'](_0x390fa9['query']);_0x394097[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x394097['model'],_0x394097['query']);_0x4b5be7[_0xffa5('0x4a')]=_[_0xffa5('0x49')](_0x394097['model'],qs['fields'](_0x390fa9[_0xffa5('0x47')][_0xffa5('0x4b')]));_0x4b5be7[_0xffa5('0x4a')]=_0x4b5be7[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x4b5be7[_0xffa5('0x4a')]:_0x394097['model'];_0x4b5be7['order']=qs['sort'](_0x390fa9['query'][_0xffa5('0x4f')]);_0x4b5be7['where']=qs[_0xffa5('0x48')](_[_0xffa5('0x6c')](_0x390fa9['query'],_0x394097[_0xffa5('0x48')]));if(_0x390fa9[_0xffa5('0x47')][_0xffa5('0x51')]){_0x4b5be7[_0xffa5('0x50')]=_[_0xffa5('0x52')](_0x4b5be7[_0xffa5('0x50')],{'$or':_[_0xffa5('0x41')](_0x4b5be7['attributes'],function(_0x2a19ee){var _0x1b468f={};_0x1b468f[_0x2a19ee]={'$like':'%'+_0x390fa9[_0xffa5('0x47')][_0xffa5('0x51')]+'%'};return _0x1b468f;})});}_0x4b5be7=_[_0xffa5('0x52')]({},_0x4b5be7,_0x390fa9[_0xffa5('0x54')]);return _0x5ed128[_0xffa5('0x114')](_0x4b5be7);}})['then'](function(_0x116d05){if(_0x116d05){_0x3c45c9=_0x116d05[_0xffa5('0x4c')];if(!_0x390fa9[_0xffa5('0x47')][_0xffa5('0x4d')](_0xffa5('0x4e'))){_0x4b5be7[_0xffa5('0x35')]=qs[_0xffa5('0x35')](_0x390fa9['query'][_0xffa5('0x35')]);_0x4b5be7[_0xffa5('0x34')]=qs[_0xffa5('0x34')](_0x390fa9[_0xffa5('0x47')][_0xffa5('0x34')]);}return _0x5ed128[_0xffa5('0x114')](_0x4b5be7);}})[_0xffa5('0x24')](function(_0x4aec7a){if(_0x4aec7a){return _0x4aec7a?{'count':_0x3c45c9,'rows':_0x4aec7a}:null;}})[_0xffa5('0x24')](respondWithResult(_0x2a71c5,null))[_0xffa5('0x2f')](handleError(_0x2a71c5,null));};exports[_0xffa5('0x115')]=function(_0x50cc8e,_0x2dc017,_0x1e3e29){return db[_0xffa5('0x116')]['find']({'where':{'id':_0x50cc8e[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x2dc017,null))[_0xffa5('0x24')](function(_0x355a1f){if(_0x355a1f){return _0x355a1f[_0xffa5('0x115')](_0x50cc8e[_0xffa5('0x5e')][_0xffa5('0x6f')],_['omit'](_0x50cc8e['body'],[_0xffa5('0x6f'),'id'])||{});}})[_0xffa5('0x24')](respondWithResult(_0x2dc017,null))[_0xffa5('0x2f')](handleError(_0x2dc017,null));};exports[_0xffa5('0xff')]=function(_0x5df60e,_0x7115e8,_0x5d601f){var _0x577b4c={};var _0x121eac={};var _0x4dd917;var _0x47aadd;return db['ChatWebsite'][_0xffa5('0x69')]({'where':{'id':_0x5df60e[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x7115e8,null))[_0xffa5('0x24')](function(_0x4eb35f){if(_0x4eb35f){_0x4dd917=_0x4eb35f;_0x121eac['model']=_[_0xffa5('0x5c')](db['ChatProactiveAction']['rawAttributes']);_0x121eac[_0xffa5('0x47')]=_['keys'](_0x5df60e[_0xffa5('0x47')]);_0x121eac[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x121eac[_0xffa5('0x46')],_0x121eac['query']);_0x577b4c[_0xffa5('0x4a')]=_[_0xffa5('0x49')](_0x121eac[_0xffa5('0x46')],qs[_0xffa5('0x4b')](_0x5df60e[_0xffa5('0x47')]['fields']));_0x577b4c[_0xffa5('0x4a')]=_0x577b4c[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x577b4c[_0xffa5('0x4a')]:_0x121eac[_0xffa5('0x46')];_0x577b4c[_0xffa5('0x6b')]=qs['sort'](_0x5df60e[_0xffa5('0x47')][_0xffa5('0x4f')]);_0x577b4c[_0xffa5('0x50')]=qs[_0xffa5('0x48')](_[_0xffa5('0x6c')](_0x5df60e[_0xffa5('0x47')],_0x121eac[_0xffa5('0x48')]));if(_0x5df60e[_0xffa5('0x47')][_0xffa5('0x51')]){_0x577b4c[_0xffa5('0x50')]=_[_0xffa5('0x52')](_0x577b4c[_0xffa5('0x50')],{'$or':_['map'](_0x577b4c[_0xffa5('0x4a')],function(_0x20dc56){var _0x433b51={};_0x433b51[_0x20dc56]={'$like':'%'+_0x5df60e[_0xffa5('0x47')][_0xffa5('0x51')]+'%'};return _0x433b51;})});}_0x577b4c=_[_0xffa5('0x52')]({},_0x577b4c,_0x5df60e[_0xffa5('0x54')]);return _0x4dd917[_0xffa5('0xff')](_0x577b4c);}})[_0xffa5('0x24')](function(_0xda0f58){if(_0xda0f58){_0x47aadd=_0xda0f58[_0xffa5('0x4c')];if(!_0x5df60e[_0xffa5('0x47')][_0xffa5('0x4d')]('nolimit')){_0x577b4c[_0xffa5('0x35')]=qs[_0xffa5('0x35')](_0x5df60e[_0xffa5('0x47')]['limit']);_0x577b4c['offset']=qs['offset'](_0x5df60e[_0xffa5('0x47')][_0xffa5('0x34')]);}return _0x4dd917[_0xffa5('0xff')](_0x577b4c);}})[_0xffa5('0x24')](function(_0x338178){if(_0x338178){return _0x338178?{'count':_0x47aadd,'rows':_0x338178}:null;}})['then'](respondWithResult(_0x7115e8,null))[_0xffa5('0x2f')](handleError(_0x7115e8,null));};exports['getFields']=function(_0x1f8a2c,_0x281bee,_0x5855f8){var _0x4c3df6=_0x1f8a2c[_0xffa5('0x47')][_0xffa5('0x117')]===_0xffa5('0x118')?'offlineForm':_0xffa5('0x119');return db['ChatWebsite']['find']({'attributes':['id',_0x4c3df6],'where':{'id':_0x1f8a2c[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x281bee,null))[_0xffa5('0x24')](function(_0x83d15a){if(_0x83d15a){var _0x3ff147=_0x83d15a[_0x4c3df6];var _0x271832=_0x3ff147&&_0x3ff147[_0xffa5('0x11a')]?_0x3ff147[_0xffa5('0x11a')]:[];_0x281bee[_0xffa5('0x3d')]({'fromKey':_['isNil'](_0x3ff147[_0xffa5('0x11b')])?undefined:_0x3ff147[_0xffa5('0x11b')],'count':_0x271832[_0xffa5('0x4c')],'rows':_0x271832});}})[_0xffa5('0x2f')](handleError(_0x281bee,null));};exports[_0xffa5('0x11c')]=function(_0x333d5a,_0x140d75,_0x31fe80){var _0x4c87de={'raw':![],'where':{}};var _0x387431={};var _0x265be3={'count':0x0,'rows':[]};return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x333d5a[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x140d75,null))[_0xffa5('0x24')](function(_0x272e7b){if(_0x272e7b){_0x387431[_0xffa5('0x46')]=_[_0xffa5('0x5c')](db[_0xffa5('0xda')][_0xffa5('0x42')]);_0x387431[_0xffa5('0x47')]=_['keys'](_0x333d5a[_0xffa5('0x47')]);_0x387431[_0xffa5('0x48')]=_[_0xffa5('0x49')](_0x387431[_0xffa5('0x46')],_0x387431[_0xffa5('0x47')]);_0x4c87de['attributes']=_[_0xffa5('0x49')](_0x387431[_0xffa5('0x46')],qs['fields'](_0x333d5a['query']['fields']));_0x4c87de[_0xffa5('0x4a')]=_0x4c87de[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x4c87de[_0xffa5('0x4a')]:_0x387431[_0xffa5('0x46')];if(!_0x333d5a[_0xffa5('0x47')][_0xffa5('0x4d')]('nolimit')){_0x4c87de[_0xffa5('0x35')]=qs['limit'](_0x333d5a['query'][_0xffa5('0x35')]);_0x4c87de[_0xffa5('0x34')]=qs[_0xffa5('0x34')](_0x333d5a[_0xffa5('0x47')][_0xffa5('0x34')]);}_0x4c87de['order']=qs['sort'](_0x333d5a[_0xffa5('0x47')][_0xffa5('0x4f')]);_0x4c87de[_0xffa5('0x50')]=qs['filters'](_[_0xffa5('0x6c')](_0x333d5a[_0xffa5('0x47')],_0x387431['filters']));_0x4c87de[_0xffa5('0x50')]['ChatWebsiteId']=_0x272e7b['id'];if(_0x333d5a[_0xffa5('0x47')]['filter']){_0x4c87de['where']=_['merge'](_0x4c87de[_0xffa5('0x50')],{'$or':_[_0xffa5('0x41')](_0x4c87de[_0xffa5('0x4a')],function(_0x2a39e6){var _0x41cc6f={};_0x41cc6f[_0x2a39e6]={'$like':'%'+_0x333d5a[_0xffa5('0x47')]['filter']+'%'};return _0x41cc6f;})});}_0x4c87de=_[_0xffa5('0x52')]({},_0x4c87de,_0x333d5a[_0xffa5('0x54')]);return db[_0xffa5('0xda')][_0xffa5('0x55')]({'where':_0x4c87de[_0xffa5('0x50')]})[_0xffa5('0x24')](function(_0x36e532){_0x265be3[_0xffa5('0x55')]=_0x36e532;if(_0x333d5a[_0xffa5('0x47')][_0xffa5('0x56')]){_0x4c87de[_0xffa5('0x57')]=[{'all':!![]}];}else{_0x4c87de[_0xffa5('0x57')]=[{'model':db[_0xffa5('0x9e')],'as':_0xffa5('0x11d'),'required':![]}];}return db[_0xffa5('0xda')][_0xffa5('0x59')](_0x4c87de);})[_0xffa5('0x24')](function(_0x279406){_0x265be3[_0xffa5('0x5a')]=_0x279406;return _0x265be3;});}})[_0xffa5('0x24')](respondWithFilteredResult(_0x140d75,_0x4c87de))[_0xffa5('0x2f')](handleError(_0x140d75,null));};exports[_0xffa5('0x11e')]=function(_0x377964,_0x17d5b8,_0x511079){return db[_0xffa5('0x58')][_0xffa5('0x5d')]({'where':{'id':_0x377964[_0xffa5('0x66')]['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x17d5b8,null))[_0xffa5('0x24')](function(_0x10c48f){if(_0x10c48f){return _0x10c48f['addAgents'](_0x377964['body'][_0xffa5('0x6f')],_[_0xffa5('0x11f')](_0x377964[_0xffa5('0x5e')],[_0xffa5('0x6f'),'id'])||{})[_0xffa5('0xd3')](function(_0x52d7f5){for(var _0x19b56e=0x0;_0x19b56e<_0x377964['body'][_0xffa5('0x6f')][_0xffa5('0x4c')];_0x19b56e+=0x1){socket[_0xffa5('0x120')](_0xffa5('0x121'),{'UserId':_0x377964[_0xffa5('0x5e')]['ids'][_0x19b56e],'ChatWebsiteId':_0x377964[_0xffa5('0x66')]['id']});}return _0x52d7f5;});}})[_0xffa5('0x24')](respondWithResult(_0x17d5b8,null))[_0xffa5('0x2f')](handleError(_0x17d5b8,null));};exports['removeAgents']=function(_0x5b7bae,_0x3d7f42,_0x1d161e){return db['ChatWebsite']['find']({'where':{'id':_0x5b7bae['params']['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x3d7f42,null))[_0xffa5('0x24')](function(_0x4c617e){if(_0x4c617e){return _0x4c617e['removeAgents'](_0x5b7bae['query']['ids'])[_0xffa5('0x24')](function(){if(_[_0xffa5('0x122')](_0x5b7bae[_0xffa5('0x47')][_0xffa5('0x6f')])){for(var _0x225b35=0x0;_0x225b35<_0x5b7bae[_0xffa5('0x47')][_0xffa5('0x6f')]['length'];_0x225b35+=0x1){socket[_0xffa5('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x5b7bae[_0xffa5('0x47')][_0xffa5('0x6f')][_0x225b35]),'ChatWebsiteId':Number(_0x5b7bae[_0xffa5('0x66')]['id'])});}}else{socket[_0xffa5('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x5b7bae[_0xffa5('0x47')]['ids']),'ChatWebsiteId':Number(_0x5b7bae[_0xffa5('0x66')]['id'])});}});}})[_0xffa5('0x24')](respondWithStatusCode(_0x3d7f42,null))['catch'](handleError(_0x3d7f42,null));};exports[_0xffa5('0x123')]=function(_0x59060d,_0x2cba30,_0x42eeda){var _0x3e1ada={};var _0x839053={};var _0x10a6a4;var _0x6349ed;return db[_0xffa5('0x58')][_0xffa5('0x69')]({'where':{'id':_0x59060d['params']['id']}})[_0xffa5('0x24')](handleEntityNotFound(_0x2cba30,null))[_0xffa5('0x24')](function(_0x3ef7ee){if(_0x3ef7ee){_0x10a6a4=_0x3ef7ee;_0x839053[_0xffa5('0x46')]=_['keys'](db[_0xffa5('0xc5')]['rawAttributes']);_0x839053['query']=_[_0xffa5('0x5c')](_0x59060d[_0xffa5('0x47')]);_0x839053[_0xffa5('0x48')]=_['intersection'](_0x839053[_0xffa5('0x46')],_0x839053[_0xffa5('0x47')]);_0x3e1ada['attributes']=_[_0xffa5('0x49')](_0x839053[_0xffa5('0x46')],qs['fields'](_0x59060d[_0xffa5('0x47')][_0xffa5('0x4b')]));_0x3e1ada['attributes']=_0x3e1ada[_0xffa5('0x4a')][_0xffa5('0x4c')]?_0x3e1ada[_0xffa5('0x4a')]:_0x839053[_0xffa5('0x46')];_0x3e1ada['order']=qs['sort'](_0x59060d[_0xffa5('0x47')][_0xffa5('0x4f')]);_0x3e1ada['where']=qs[_0xffa5('0x48')](_[_0xffa5('0x6c')](_0x59060d[_0xffa5('0x47')],_0x839053[_0xffa5('0x48')]));if(_0x59060d[_0xffa5('0x47')][_0xffa5('0x51')]){_0x3e1ada[_0xffa5('0x50')]=_[_0xffa5('0x52')](_0x3e1ada[_0xffa5('0x50')],{'$or':_['map'](_0x3e1ada[_0xffa5('0x4a')],function(_0x307f43){var _0x2c5e63={};_0x2c5e63[_0x307f43]={'$like':'%'+_0x59060d[_0xffa5('0x47')][_0xffa5('0x51')]+'%'};return _0x2c5e63;})});}_0x3e1ada=_[_0xffa5('0x52')]({},_0x3e1ada,_0x59060d[_0xffa5('0x54')]);return _0x10a6a4[_0xffa5('0x123')](_0x3e1ada);}})['then'](function(_0x449a8a){if(_0x449a8a){_0x6349ed=_0x449a8a['length'];if(!_0x59060d[_0xffa5('0x47')]['hasOwnProperty'](_0xffa5('0x4e'))){_0x3e1ada[_0xffa5('0x35')]=qs[_0xffa5('0x35')](_0x59060d[_0xffa5('0x47')][_0xffa5('0x35')]);_0x3e1ada[_0xffa5('0x34')]=qs[_0xffa5('0x34')](_0x59060d[_0xffa5('0x47')][_0xffa5('0x34')]);}return _0x10a6a4[_0xffa5('0x123')](_0x3e1ada);}})[_0xffa5('0x24')](function(_0x358c69){if(_0x358c69){return _0x358c69?{'count':_0x6349ed,'rows':_0x358c69}:null;}})['then'](respondWithResult(_0x2cba30,null))['catch'](handleError(_0x2cba30,null));}; \ No newline at end of file +var _0xb442=['headers','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','applications','close','unmanaged','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','fullname','Tag','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','connection','remoteAddress','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','findOne','pick','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','showCustomerAvatar','existsSync','getSystemAvatar','notify','user-agent-parser','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','orderBy','priority','asc','ListId','contact'];(function(_0x1a5867,_0x598d01){var _0xd2f5a6=function(_0x3a4343){while(--_0x3a4343){_0x1a5867['push'](_0x1a5867['shift']());}};_0xd2f5a6(++_0x598d01);}(_0xb442,0x191));var _0x2b44=function(_0x4c1176,_0xf999e9){_0x4c1176=_0x4c1176-0x0;var _0x2aca97=_0xb442[_0x4c1176];return _0x2aca97;};'use strict';var pdf=require(_0x2b44('0x0'));var emlformat=require(_0x2b44('0x1'));var rimraf=require(_0x2b44('0x2'));var zipdir=require(_0x2b44('0x3'));var jsonpatch=require(_0x2b44('0x4'));var rp=require('request-promise');var moment=require(_0x2b44('0x5'));var BPromise=require(_0x2b44('0x6'));var Mustache=require(_0x2b44('0x7'));var util=require(_0x2b44('0x8'));var path=require(_0x2b44('0x9'));var sox=require(_0x2b44('0xa'));var csv=require(_0x2b44('0xb'));var ejs=require(_0x2b44('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2b44('0xd'));var crypto=require(_0x2b44('0xe'));var jsforce=require(_0x2b44('0xf'));var deskjs=require(_0x2b44('0x10'));var toCsv=require(_0x2b44('0xb'));var querystring=require(_0x2b44('0x11'));var Papa=require(_0x2b44('0x12'));var Redis=require('ioredis');var authService=require(_0x2b44('0x13'));var qs=require(_0x2b44('0x14'));var as=require(_0x2b44('0x15'));var hardwareService=require(_0x2b44('0x16'));var logger=require('../../config/logger')(_0x2b44('0x17'));var utils=require(_0x2b44('0x18'));var config=require(_0x2b44('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b44('0x1a'))['db'];config['redis']=_[_0x2b44('0x1b')](config['redis'],{'host':_0x2b44('0x1c'),'port':0x18eb});var socket=require(_0x2b44('0x1d'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x2b44('0x1e')](socket);var jayson=require(_0x2b44('0x1f'));var client=jayson[_0x2b44('0x20')][_0x2b44('0x21')]({'port':0x232c});var client9002=jayson[_0x2b44('0x20')]['http']({'port':0x232a});var client9003=jayson[_0x2b44('0x20')][_0x2b44('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x5d9238,_0x2d4e52,_0x2c1b51,_0x2ae928){return new BPromise(function(_0x3fdf27,_0x59fb89){var _0x19300d=_0x2ae928||client;return _0x19300d['request'](_0x5d9238,_0x2c1b51)[_0x2b44('0x22')](function(_0x3780cb){logger[_0x2b44('0x23')](_0x2b44('0x24'),_0x2d4e52,_0x2b44('0x25'));logger[_0x2b44('0x26')](_0x2b44('0x27'),_0x2d4e52,_0x2b44('0x25'),JSON[_0x2b44('0x28')](_0x3780cb));if(_0x3780cb[_0x2b44('0x29')]){if(_0x3780cb[_0x2b44('0x29')]['code']===0x1f4){logger[_0x2b44('0x29')](_0x2b44('0x24'),_0x2d4e52,_0x3780cb[_0x2b44('0x29')][_0x2b44('0x2a')]);return _0x59fb89(_0x3780cb[_0x2b44('0x29')][_0x2b44('0x2a')]);}logger[_0x2b44('0x29')](_0x2b44('0x24'),_0x2d4e52,_0x3780cb[_0x2b44('0x29')][_0x2b44('0x2a')]);return _0x3fdf27(_0x3780cb[_0x2b44('0x29')][_0x2b44('0x2a')]);}else{logger[_0x2b44('0x23')](_0x2b44('0x24'),_0x2d4e52,_0x2b44('0x25'));_0x3fdf27(_0x3780cb[_0x2b44('0x2b')][_0x2b44('0x2a')]);}})[_0x2b44('0x2c')](function(_0x50f7b2){logger[_0x2b44('0x29')](_0x2b44('0x24'),_0x2d4e52,_0x50f7b2);_0x59fb89(_0x50f7b2);});});}function respondWithStatusCode(_0x4611b7,_0x52360e){_0x52360e=_0x52360e||0xcc;return function(_0x12abe9){if(_0x12abe9){return _0x4611b7[_0x2b44('0x2d')](_0x52360e);}return _0x4611b7[_0x2b44('0x2e')](_0x52360e)[_0x2b44('0x2f')]();};}function respondWithResult(_0x546a81,_0x4f66fe){_0x4f66fe=_0x4f66fe||0xc8;return function(_0x193a8a){if(_0x193a8a){return _0x546a81[_0x2b44('0x2e')](_0x4f66fe)[_0x2b44('0x30')](_0x193a8a);}};}function respondWithFilteredResult(_0x5eef40,_0x386814){return function(_0x30b0c9){if(_0x30b0c9){var _0x30a3e2=_0x30b0c9[_0x2b44('0x31')],_0x6ba36b=_0x386814[_0x2b44('0x32')],_0x59af0c=_0x386814[_0x2b44('0x32')]+_0x386814[_0x2b44('0x33')],_0x25eaf1;if(_0x59af0c>=_0x30a3e2){_0x59af0c=_0x30a3e2;_0x25eaf1=0xc8;}else{_0x25eaf1=0xce;}_0x5eef40[_0x2b44('0x2e')](_0x25eaf1);return _0x5eef40[_0x2b44('0x34')](_0x2b44('0x35'),_0x6ba36b+'-'+_0x59af0c+'/'+_0x30a3e2)[_0x2b44('0x30')](_0x30b0c9);}return null;};}function patchUpdates(_0x79e15e){return function(_0x420d51){try{jsonpatch[_0x2b44('0x36')](_0x420d51,_0x79e15e,!![]);}catch(_0x400f19){return BPromise[_0x2b44('0x37')](_0x400f19);}return _0x420d51[_0x2b44('0x38')]();};}function saveUpdates(_0xfb2d8a,_0x4b191f){return function(_0x30ba68){if(_0x30ba68){return _0x30ba68[_0x2b44('0x39')](_0xfb2d8a)[_0x2b44('0x22')](function(_0x1b7089){return _0x1b7089;});}return null;};}function removeEntity(_0x38a830,_0x57ff1b){return function(_0x1647ba){if(_0x1647ba){return _0x1647ba[_0x2b44('0x3a')]()[_0x2b44('0x22')](function(){var _0x479f13=_0x1647ba[_0x2b44('0x3b')]({'plain':!![]});var _0x44693d=_0x2b44('0x3c');return db[_0x2b44('0x3d')]['destroy']({'where':{'type':_0x44693d,'resourceId':_0x479f13['id']}})[_0x2b44('0x22')](function(){return _0x1647ba;});})['then'](function(){_0x38a830[_0x2b44('0x2e')](0xcc)[_0x2b44('0x2f')]();});}};}function handleEntityNotFound(_0x5310fc,_0x418887){return function(_0x4dc9ee){if(!_0x4dc9ee){_0x5310fc['sendStatus'](0x194);}return _0x4dc9ee;};}function handleError(_0x1d381f,_0x301973){_0x301973=_0x301973||0x1f4;return function(_0x481810){logger[_0x2b44('0x29')](_0x481810[_0x2b44('0x3e')]);if(_0x481810[_0x2b44('0x3f')]){delete _0x481810[_0x2b44('0x3f')];}_0x1d381f[_0x2b44('0x2e')](_0x301973)[_0x2b44('0x40')](_0x481810);};}exports['index']=function(_0x58bc05,_0x54e70b){var _0x252bb0={'include':[{'model':db[_0x2b44('0x41')],'as':_0x2b44('0x42')}]},_0x75e9cf={},_0x750b74={'count':0x0,'rows':[]};var _0x5d4f86=_[_0x2b44('0x43')](db[_0x2b44('0x44')][_0x2b44('0x45')],function(_0xc075e6){return{'name':_0xc075e6[_0x2b44('0x46')],'type':_0xc075e6[_0x2b44('0x47')]['key']};});_0x75e9cf[_0x2b44('0x48')]=_[_0x2b44('0x43')](_0x5d4f86,'name');_0x75e9cf[_0x2b44('0x49')]=_['keys'](_0x58bc05[_0x2b44('0x49')]);_0x75e9cf['filters']=_[_0x2b44('0x4a')](_0x75e9cf[_0x2b44('0x48')],_0x75e9cf[_0x2b44('0x49')]);_0x252bb0[_0x2b44('0x4b')]=_[_0x2b44('0x4a')](_0x75e9cf[_0x2b44('0x48')],qs[_0x2b44('0x4c')](_0x58bc05['query'][_0x2b44('0x4c')]));_0x252bb0['attributes']=_0x252bb0[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x252bb0[_0x2b44('0x4b')]:_0x75e9cf[_0x2b44('0x48')];if(!_0x58bc05[_0x2b44('0x49')][_0x2b44('0x4e')](_0x2b44('0x4f'))){_0x252bb0['limit']=qs[_0x2b44('0x33')](_0x58bc05[_0x2b44('0x49')][_0x2b44('0x33')]);_0x252bb0['offset']=qs['offset'](_0x58bc05[_0x2b44('0x49')][_0x2b44('0x32')]);}_0x252bb0[_0x2b44('0x50')]=qs[_0x2b44('0x51')](_0x58bc05[_0x2b44('0x49')][_0x2b44('0x51')]);_0x252bb0[_0x2b44('0x52')]=qs[_0x2b44('0x53')](_['pick'](_0x58bc05[_0x2b44('0x49')],_0x75e9cf['filters']),_0x5d4f86);if(_0x58bc05[_0x2b44('0x49')][_0x2b44('0x54')]){_0x252bb0['where']=_['merge'](_0x252bb0['where'],{'$or':_[_0x2b44('0x43')](_0x5d4f86,function(_0x22ee49){if(_0x22ee49[_0x2b44('0x47')]!==_0x2b44('0x55')){var _0x42860d={};_0x42860d[_0x22ee49[_0x2b44('0x3f')]]={'$like':'%'+_0x58bc05[_0x2b44('0x49')]['filter']+'%'};return _0x42860d;}})});}_0x252bb0=_[_0x2b44('0x56')]({},_0x252bb0,_0x58bc05[_0x2b44('0x57')]);var _0x45d552={'where':_0x252bb0['where']};return db['ChatWebsite'][_0x2b44('0x31')](_0x45d552)[_0x2b44('0x22')](function(_0x230123){_0x750b74[_0x2b44('0x31')]=_0x230123;if(_0x58bc05[_0x2b44('0x49')]['includeAll']){_0x252bb0[_0x2b44('0x58')]=[{'all':!![]}];}return db[_0x2b44('0x44')][_0x2b44('0x59')](_0x252bb0);})[_0x2b44('0x22')](function(_0x3c57d7){_0x750b74[_0x2b44('0x5a')]=_0x3c57d7;return _0x750b74;})['then'](respondWithFilteredResult(_0x54e70b,_0x252bb0))[_0x2b44('0x2c')](handleError(_0x54e70b,null));};exports[_0x2b44('0x5b')]=function(_0x1c705e,_0x5b8569){var _0x1ed7a5={'raw':![],'where':{'id':_0x1c705e[_0x2b44('0x5c')]['id']},'include':[{'model':db[_0x2b44('0x41')],'as':_0x2b44('0x42')}]},_0x40bd5d={};_0x40bd5d[_0x2b44('0x48')]=_['keys'](db[_0x2b44('0x44')]['rawAttributes']);_0x40bd5d[_0x2b44('0x49')]=_[_0x2b44('0x5d')](_0x1c705e[_0x2b44('0x49')]);_0x40bd5d[_0x2b44('0x53')]=_[_0x2b44('0x4a')](_0x40bd5d['model'],_0x40bd5d[_0x2b44('0x49')]);_0x1ed7a5['attributes']=_[_0x2b44('0x4a')](_0x40bd5d[_0x2b44('0x48')],qs[_0x2b44('0x4c')](_0x1c705e[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x1ed7a5[_0x2b44('0x4b')]=_0x1ed7a5[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x1ed7a5[_0x2b44('0x4b')]:_0x40bd5d[_0x2b44('0x48')];if(_0x1c705e['query'][_0x2b44('0x5e')]){_0x1ed7a5[_0x2b44('0x58')]=[{'all':!![]}];}_0x1ed7a5=_['merge']({},_0x1ed7a5,_0x1c705e['options']);return db[_0x2b44('0x44')]['find'](_0x1ed7a5)['then'](handleEntityNotFound(_0x5b8569,null))[_0x2b44('0x22')](respondWithResult(_0x5b8569,null))['catch'](handleError(_0x5b8569,null));};exports[_0x2b44('0x5f')]=function(_0x599208,_0xba48c8){return db['ChatWebsite'][_0x2b44('0x5f')](_0x599208[_0x2b44('0x60')],{})[_0x2b44('0x22')](function(_0x10238a){var _0x4aad1c=_0x599208[_0x2b44('0x61')]['get']({'plain':!![]});if(!_0x4aad1c)throw new Error(_0x2b44('0x62'));if(_0x4aad1c[_0x2b44('0x63')]===_0x2b44('0x61')){var _0x165567=_0x10238a[_0x2b44('0x3b')]({'plain':!![]});var _0x3bc93a=_0x2b44('0x3c');return db[_0x2b44('0x64')][_0x2b44('0x65')]({'where':{'name':_0x3bc93a,'userProfileId':_0x4aad1c[_0x2b44('0x66')]},'raw':!![]})['then'](function(_0x22000d){if(_0x22000d&&_0x22000d[_0x2b44('0x67')]===0x0){return db[_0x2b44('0x3d')][_0x2b44('0x5f')]({'name':_0x165567['name'],'resourceId':_0x165567['id'],'type':_0x22000d[_0x2b44('0x3f')],'sectionId':_0x22000d['id']},{})[_0x2b44('0x22')](function(){return _0x10238a;});}else{return _0x10238a;}})[_0x2b44('0x2c')](function(_0x626f03){logger[_0x2b44('0x29')](_0x2b44('0x68'),_0x626f03);throw _0x626f03;});}return _0x10238a;})[_0x2b44('0x22')](respondWithResult(_0xba48c8,0xc9))['catch'](handleError(_0xba48c8,null));};exports['update']=function(_0x427792,_0x47ddfd){if(_0x427792[_0x2b44('0x60')]['id']){delete _0x427792[_0x2b44('0x60')]['id'];}return db['ChatWebsite'][_0x2b44('0x65')]({'where':{'id':_0x427792[_0x2b44('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x47ddfd,null))[_0x2b44('0x22')](saveUpdates(_0x427792['body'],null))[_0x2b44('0x22')](respondWithResult(_0x47ddfd,null))[_0x2b44('0x2c')](handleError(_0x47ddfd,null));};exports['destroy']=function(_0x23cb2c,_0x2407b5){return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x23cb2c[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x2407b5,null))[_0x2b44('0x22')](removeEntity(_0x2407b5,null))[_0x2b44('0x2c')](handleError(_0x2407b5,null));};exports[_0x2b44('0x69')]=function(_0x276079,_0x157815){return db['ChatWebsite'][_0x2b44('0x69')]()[_0x2b44('0x22')](respondWithResult(_0x157815,null))['catch'](handleError(_0x157815,null));};exports[_0x2b44('0x6a')]=function(_0x465d3e,_0x1e442d,_0xa0d215){if(_0x465d3e[_0x2b44('0x60')]['id']){delete _0x465d3e[_0x2b44('0x60')]['id'];}return db[_0x2b44('0x44')]['find']({'where':{'id':_0x465d3e['params']['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x1e442d,null))['then'](function(_0xa6abee){if(_0xa6abee){_0x465d3e[_0x2b44('0x60')][_0x2b44('0x6b')]=_0xa6abee['id'];return db['Disposition'][_0x2b44('0x5f')](_0x465d3e[_0x2b44('0x60')]);}})[_0x2b44('0x22')](respondWithResult(_0x1e442d,null))[_0x2b44('0x2c')](handleError(_0x1e442d,null));};exports['getDispositions']=function(_0x5ec387,_0x56ea4d,_0x53b049){var _0x144d2c={'raw':![],'where':{}};var _0x30fa5a={};var _0xea468={'count':0x0,'rows':[]};return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0x5ec387[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x56ea4d,null))[_0x2b44('0x22')](function(_0x273b55){if(_0x273b55){_0x30fa5a['model']=_[_0x2b44('0x5d')](db['Disposition'][_0x2b44('0x45')]);_0x30fa5a[_0x2b44('0x49')]=_['keys'](_0x5ec387['query']);_0x30fa5a[_0x2b44('0x53')]=_['intersection'](_0x30fa5a[_0x2b44('0x48')],_0x30fa5a[_0x2b44('0x49')]);_0x144d2c[_0x2b44('0x4b')]=_[_0x2b44('0x4a')](_0x30fa5a[_0x2b44('0x48')],qs['fields'](_0x5ec387[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x144d2c[_0x2b44('0x4b')]=_0x144d2c[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x144d2c[_0x2b44('0x4b')]:_0x30fa5a['model'];if(!_0x5ec387[_0x2b44('0x49')][_0x2b44('0x4e')](_0x2b44('0x4f'))){_0x144d2c[_0x2b44('0x33')]=qs[_0x2b44('0x33')](_0x5ec387['query'][_0x2b44('0x33')]);_0x144d2c[_0x2b44('0x32')]=qs[_0x2b44('0x32')](_0x5ec387[_0x2b44('0x49')][_0x2b44('0x32')]);}_0x144d2c[_0x2b44('0x50')]=qs[_0x2b44('0x51')](_0x5ec387[_0x2b44('0x49')][_0x2b44('0x51')]);_0x144d2c['where']=qs['filters'](_[_0x2b44('0x6d')](_0x5ec387[_0x2b44('0x49')],_0x30fa5a['filters']));_0x144d2c[_0x2b44('0x52')]['ChatWebsiteId']=_0x273b55['id'];if(_0x5ec387[_0x2b44('0x49')][_0x2b44('0x54')]){_0x144d2c[_0x2b44('0x52')]=_[_0x2b44('0x56')](_0x144d2c[_0x2b44('0x52')],{'$or':_[_0x2b44('0x43')](_0x144d2c[_0x2b44('0x4b')],function(_0x2c910c){var _0x52c778={};_0x52c778[_0x2c910c]={'$like':'%'+_0x5ec387['query'][_0x2b44('0x54')]+'%'};return _0x52c778;})});}_0x144d2c=_[_0x2b44('0x56')]({},_0x144d2c,_0x5ec387[_0x2b44('0x57')]);return db[_0x2b44('0x6e')][_0x2b44('0x31')]({'where':_0x144d2c[_0x2b44('0x52')]})['then'](function(_0x191d19){_0xea468['count']=_0x191d19;if(_0x5ec387['query'][_0x2b44('0x5e')]){_0x144d2c[_0x2b44('0x58')]=[{'all':!![]}];}return db[_0x2b44('0x6e')]['findAll'](_0x144d2c);})['then'](function(_0x587a2c){_0xea468['rows']=_0x587a2c;return _0xea468;});}})[_0x2b44('0x22')](respondWithFilteredResult(_0x56ea4d,_0x144d2c))[_0x2b44('0x2c')](handleError(_0x56ea4d,null));};exports[_0x2b44('0x6f')]=function(_0x506abb,_0x37b8bb,_0x105d91){return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x506abb[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x37b8bb,null))['then'](function(_0x2e6146){if(_0x2e6146){return _0x2e6146[_0x2b44('0x6f')](_0x506abb[_0x2b44('0x49')]['ids']);}})[_0x2b44('0x22')](respondWithStatusCode(_0x37b8bb,null))[_0x2b44('0x2c')](handleError(_0x37b8bb,null));};exports[_0x2b44('0x70')]=function(_0x3dff16,_0x2eb03e,_0x2caeb0){if(_0x3dff16[_0x2b44('0x60')]['id']){delete _0x3dff16[_0x2b44('0x60')]['id'];}return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x3dff16[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x2eb03e,null))['then'](function(_0x1dc549){if(_0x1dc549){_0x3dff16[_0x2b44('0x60')][_0x2b44('0x6b')]=_0x1dc549['id'];return db[_0x2b44('0x71')][_0x2b44('0x5f')](_0x3dff16[_0x2b44('0x60')]);}})[_0x2b44('0x22')](respondWithResult(_0x2eb03e,null))['catch'](handleError(_0x2eb03e,null));};exports[_0x2b44('0x72')]=function(_0xc97fc6,_0x4bfc60,_0x4fe24f){var _0x33933d={'raw':![],'where':{}};var _0x4701ac={};var _0x385db2={'count':0x0,'rows':[]};return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0xc97fc6[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4bfc60,null))[_0x2b44('0x22')](function(_0x5e878a){if(_0x5e878a){_0x4701ac['model']=_[_0x2b44('0x5d')](db['CannedAnswer'][_0x2b44('0x45')]);_0x4701ac['query']=_[_0x2b44('0x5d')](_0xc97fc6[_0x2b44('0x49')]);_0x4701ac[_0x2b44('0x53')]=_[_0x2b44('0x4a')](_0x4701ac[_0x2b44('0x48')],_0x4701ac[_0x2b44('0x49')]);_0x33933d[_0x2b44('0x4b')]=_['intersection'](_0x4701ac[_0x2b44('0x48')],qs['fields'](_0xc97fc6[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x33933d[_0x2b44('0x4b')]=_0x33933d[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x33933d['attributes']:_0x4701ac[_0x2b44('0x48')];if(!_0xc97fc6[_0x2b44('0x49')][_0x2b44('0x4e')](_0x2b44('0x4f'))){_0x33933d[_0x2b44('0x33')]=qs[_0x2b44('0x33')](_0xc97fc6[_0x2b44('0x49')][_0x2b44('0x33')]);_0x33933d[_0x2b44('0x32')]=qs[_0x2b44('0x32')](_0xc97fc6[_0x2b44('0x49')][_0x2b44('0x32')]);}_0x33933d[_0x2b44('0x50')]=qs['sort'](_0xc97fc6[_0x2b44('0x49')][_0x2b44('0x51')]);_0x33933d['where']=qs[_0x2b44('0x53')](_[_0x2b44('0x6d')](_0xc97fc6[_0x2b44('0x49')],_0x4701ac['filters']));_0x33933d[_0x2b44('0x52')][_0x2b44('0x6b')]=_0x5e878a['id'];if(_0xc97fc6[_0x2b44('0x49')]['filter']){_0x33933d[_0x2b44('0x52')]=_[_0x2b44('0x56')](_0x33933d[_0x2b44('0x52')],{'$or':_['map'](_0x33933d['attributes'],function(_0x55f8e3){var _0x285bb8={};_0x285bb8[_0x55f8e3]={'$like':'%'+_0xc97fc6[_0x2b44('0x49')][_0x2b44('0x54')]+'%'};return _0x285bb8;})});}_0x33933d=_[_0x2b44('0x56')]({},_0x33933d,_0xc97fc6[_0x2b44('0x57')]);return db[_0x2b44('0x71')]['count']({'where':_0x33933d[_0x2b44('0x52')]})[_0x2b44('0x22')](function(_0x14723f){_0x385db2[_0x2b44('0x31')]=_0x14723f;if(_0xc97fc6[_0x2b44('0x49')]['includeAll']){_0x33933d[_0x2b44('0x58')]=[{'all':!![]}];}return db[_0x2b44('0x71')][_0x2b44('0x59')](_0x33933d);})[_0x2b44('0x22')](function(_0x271ac5){_0x385db2['rows']=_0x271ac5;return _0x385db2;});}})[_0x2b44('0x22')](respondWithFilteredResult(_0x4bfc60,_0x33933d))[_0x2b44('0x2c')](handleError(_0x4bfc60,null));};exports['removeAnswers']=function(_0x563922,_0x350a13,_0x3c12e7){return db['ChatWebsite']['find']({'where':{'id':_0x563922[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0x350a13,null))[_0x2b44('0x22')](function(_0x1bb506){if(_0x1bb506){return _0x1bb506['removeAnswers'](_0x563922['query'][_0x2b44('0x73')]);}})[_0x2b44('0x22')](respondWithStatusCode(_0x350a13,null))[_0x2b44('0x2c')](handleError(_0x350a13,null));};exports['addLogo']=function(_0x39d8d7,_0x2dc291,_0x4230a4){_0x39d8d7['body']['sitepic']=_0x39d8d7[_0x2b44('0x74')][_0x2b44('0x75')];return db['ChatWebsite'][_0x2b44('0x65')]({'where':{'id':_0x39d8d7[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x2dc291,null))['then'](saveUpdates(_0x39d8d7['body'],null))[_0x2b44('0x22')](respondWithResult(_0x2dc291,null))[_0x2b44('0x2c')](handleError(_0x2dc291,null));};exports['addAvatar']=function(_0x52b9c1,_0xb520a9,_0x349256){_0x52b9c1[_0x2b44('0x60')][_0x2b44('0x76')]=_0x52b9c1[_0x2b44('0x74')][_0x2b44('0x75')];return db['ChatWebsite'][_0x2b44('0x65')]({'where':{'id':_0x52b9c1[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb520a9,null))[_0x2b44('0x22')](saveUpdates(_0x52b9c1['body'],null))[_0x2b44('0x22')](respondWithResult(_0xb520a9,null))['catch'](handleError(_0xb520a9,null));};exports['addCustomerAvatar']=function(_0xe84e0c,_0x22d468,_0x271067){_0xe84e0c[_0x2b44('0x60')][_0x2b44('0x77')]=_0xe84e0c[_0x2b44('0x74')][_0x2b44('0x75')];return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0xe84e0c[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x22d468,null))[_0x2b44('0x22')](saveUpdates(_0xe84e0c['body'],null))[_0x2b44('0x22')](respondWithResult(_0x22d468,null))[_0x2b44('0x2c')](handleError(_0x22d468,null));};exports[_0x2b44('0x78')]=function(_0x1a0398,_0x21d431,_0x1f4008){_0x1a0398[_0x2b44('0x60')][_0x2b44('0x79')]=_0x1a0398[_0x2b44('0x74')][_0x2b44('0x75')];return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x1a0398[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x21d431,null))[_0x2b44('0x22')](saveUpdates(_0x1a0398['body'],null))[_0x2b44('0x22')](respondWithResult(_0x21d431,null))[_0x2b44('0x2c')](handleError(_0x21d431,null));};exports[_0x2b44('0x7a')]=function(_0x414f2c,_0xf03a7,_0x47d4dc){var _0x22403b=path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],_0x2b44('0x7d'));var _0x11bef5={'where':{'id':_0x414f2c[_0x2b44('0x5c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x24ba92=![];return require(_0x2b44('0x7e'))[_0x2b44('0x7f')]()['then'](function(_0x28b591){if(_0x28b591){_0x24ba92=_0x28b591[_0x2b44('0x80')];}})[_0x2b44('0x22')](function(){return db[_0x2b44('0x44')][_0x2b44('0x65')](_0x11bef5);})[_0x2b44('0x22')](handleEntityNotFound(_0xf03a7,null))[_0x2b44('0x22')](function(_0x17e38b){if(_0x17e38b){if(!_[_0x2b44('0x81')](_0x17e38b[_0x2b44('0x82')])){if(fs['existsSync'](path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],_0x2b44('0x83'),_0x17e38b[_0x2b44('0x82')]))&&_0x24ba92){_0x22403b=path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],'server/files/images/logos/',_0x17e38b[_0x2b44('0x82')]);}}return _0xf03a7[_0x2b44('0x84')](_0x22403b);}})[_0x2b44('0x2c')](handleError(_0xf03a7,null));};exports[_0x2b44('0x85')]=function(_0x30fc1e,_0xed5757,_0x266072){var _0x1e64de=path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],'server/files/images/avatars/default_avatar.png');var _0x441815={'where':{'id':_0x30fc1e[_0x2b44('0x5c')]['id']},'attributes':['id',_0x2b44('0x76')],'raw':!![]};return db[_0x2b44('0x44')][_0x2b44('0x65')](_0x441815)['then'](handleEntityNotFound(_0xed5757,null))[_0x2b44('0x22')](function(_0x43c48f){if(_0x43c48f){if(!_['isNil'](_0x43c48f[_0x2b44('0x76')])){if(fs['existsSync'](path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],_0x2b44('0x86'),_0x43c48f[_0x2b44('0x76')]))){_0x1e64de=path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],_0x2b44('0x86'),_0x43c48f['agentAvatar']);}}return _0xed5757[_0x2b44('0x84')](_0x1e64de);}})[_0x2b44('0x2c')](handleError(_0xed5757,null));};exports['getCustomerAvatar']=function(_0x28ab55,_0x1c051c,_0x36f638){var _0x181df5=path[_0x2b44('0x7b')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x4955b8={'where':{'id':_0x28ab55[_0x2b44('0x5c')]['id']},'attributes':['id',_0x2b44('0x77'),_0x2b44('0x87')],'raw':!![]};return db[_0x2b44('0x44')][_0x2b44('0x65')](_0x4955b8)[_0x2b44('0x22')](handleEntityNotFound(_0x1c051c,null))[_0x2b44('0x22')](function(_0x3719a4){if(_0x3719a4){if(!_[_0x2b44('0x81')](_0x3719a4[_0x2b44('0x77')])){if(fs[_0x2b44('0x88')](path[_0x2b44('0x7b')](config['root'],_0x2b44('0x86'),_0x3719a4[_0x2b44('0x77')]))&&_0x3719a4[_0x2b44('0x87')]){_0x181df5=path[_0x2b44('0x7b')](config['root'],_0x2b44('0x86'),_0x3719a4['customerAvatar']);}}return _0x1c051c[_0x2b44('0x84')](_0x181df5);}})[_0x2b44('0x2c')](handleError(_0x1c051c,null));};exports[_0x2b44('0x89')]=function(_0x3c3a49,_0x3e729f,_0x5157d4){var _0x5e4299=path[_0x2b44('0x7b')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x46030e={'where':{'id':_0x3c3a49[_0x2b44('0x5c')]['id']},'attributes':['id',_0x2b44('0x79')],'raw':!![]};return db['ChatWebsite'][_0x2b44('0x65')](_0x46030e)[_0x2b44('0x22')](handleEntityNotFound(_0x3e729f,null))['then'](function(_0x123eec){if(_0x123eec){if(!_[_0x2b44('0x81')](_0x123eec[_0x2b44('0x79')])){if(fs[_0x2b44('0x88')](path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],'server/files/images/avatars/',_0x123eec[_0x2b44('0x79')]))){_0x5e4299=path[_0x2b44('0x7b')](config['root'],_0x2b44('0x86'),_0x123eec[_0x2b44('0x79')]);}}return _0x3e729f[_0x2b44('0x84')](_0x5e4299);}})[_0x2b44('0x2c')](handleError(_0x3e729f,null));};exports[_0x2b44('0x8a')]=function(_0x50adb3,_0x10cf90,_0x5bc194){var _0x3aa870=require(_0x2b44('0x8b'));var _0x3f20b1=new _0x3aa870();var _0x56c622=_0x3f20b1['setUA'](_0x50adb3['headers'][_0x2b44('0x8c')])[_0x2b44('0x8d')]();var _0x45e82a={'body':_0x50adb3[_0x2b44('0x60')],'channel':_0x2b44('0x8e')};var _0x2d129e=[];var _0x2a7022=[];var _0x6b828e={};var _0x4d4a08=![];return db[_0x2b44('0x8f')][_0x2b44('0x69')]()['then'](function(_0x19f6cb){if(!_0x19f6cb){throw new db[(_0x2b44('0x90'))][(_0x2b44('0x91'))](_0x2b44('0x92'));}_0x2d129e=_[_0x2b44('0x93')](_['keys'](_0x19f6cb),[_0x2b44('0x94'),_0x2b44('0x95')]);_0x2a7022=_[_0x2b44('0x93')](_[_0x2b44('0x5d')](_0x19f6cb),[_0x2b44('0x94'),_0x2b44('0x95'),_0x2b44('0x96'),'ListId']);if(_0x50adb3[_0x2b44('0x60')]['id']){delete _0x50adb3['body']['id'];}if(_[_0x2b44('0x81')](_0x50adb3['body'][_0x2b44('0x97')])){throw new db[(_0x2b44('0x90'))][(_0x2b44('0x91'))](_0x2b44('0x98'));}if(_['isNil'](_0x50adb3[_0x2b44('0x60')][_0x2b44('0x60')])||_0x50adb3[_0x2b44('0x60')][_0x2b44('0x60')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x50adb3[_0x2b44('0x60')][_0x2b44('0x99')])){throw new db[(_0x2b44('0x90'))][(_0x2b44('0x91'))](_0x2b44('0x9a')+_0x2a7022);}if(!_[_0x2b44('0x9b')](_0x2a7022,_0x50adb3[_0x2b44('0x60')][_0x2b44('0x99')])){throw new db[(_0x2b44('0x90'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a7022);}_0x6b828e[_0x50adb3[_0x2b44('0x60')][_0x2b44('0x99')]]=_0x50adb3[_0x2b44('0x60')][_0x2b44('0x97')];})['then'](function(){return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x50adb3[_0x2b44('0x5c')]['id']},'include':[{'model':db[_0x2b44('0x9c')],'as':_0x2b44('0x9d'),'include':[{'model':db[_0x2b44('0x8f')],'as':_0x2b44('0x9e'),'where':_0x6b828e,'limit':0x1,'order':[['updatedAt',_0x2b44('0x9f')]]}]},{'model':db[_0x2b44('0xa0')],'as':_0x2b44('0xa1')}]});})['then'](handleEntityNotFound(_0x10cf90,null))[_0x2b44('0x22')](function(_0x5ef5c4){if(_0x5ef5c4&&_0x5ef5c4['List']){_0x45e82a[_0x2b44('0xa2')]=_0x5ef5c4;_0x45e82a['applications']=_0x5ef5c4[_0x2b44('0xa1')];_0x45e82a[_0x2b44('0xa3')]=_0x5ef5c4['List'];_0x45e82a['applications']=_[_0x2b44('0xa4')](_0x45e82a['applications'],[_0x2b44('0xa5')],[_0x2b44('0xa6')]);if(_0x45e82a[_0x2b44('0xa2')][_0x2b44('0xa1')]){delete _0x45e82a[_0x2b44('0xa2')][_0x2b44('0xa1')];}if(_0x45e82a[_0x2b44('0xa2')][_0x2b44('0x9d')]&&_0x45e82a['account'][_0x2b44('0x9d')]['Contacts'][_0x2b44('0x4d')]){return _0x45e82a[_0x2b44('0xa2')][_0x2b44('0x9d')][_0x2b44('0x9e')][0x0];}var _0x5cda01=_[_0x2b44('0x1b')](_0x50adb3['body'],{'firstName':_0x50adb3[_0x2b44('0x60')][_0x2b44('0x97')],'ListId':_0x5ef5c4[_0x2b44('0xa7')]});_0x5cda01[_0x50adb3[_0x2b44('0x60')][_0x2b44('0x99')]]=_0x50adb3[_0x2b44('0x60')]['from'];return db[_0x2b44('0x8f')][_0x2b44('0x5f')](_0x5cda01,{'fields':_0x2d129e,'raw':!![]});}})[_0x2b44('0x22')](handleEntityNotFound(_0x10cf90,null))['then'](function(_0x2774da){_0x45e82a[_0x2b44('0xa8')]=_0x2774da;var _0x2d710c=_0x50adb3[_0x2b44('0x60')]['customerIp'];if(_0x50adb3[_0x2b44('0xa9')][_0x2b44('0xaa')]){_0x2d710c=_0x50adb3['headers'][_0x2b44('0xaa')];}else if(_0x50adb3['headers']['x-forwarded-for']){_0x2d710c=_[_0x2b44('0xab')](_0x50adb3['headers'][_0x2b44('0xac')]['split'](','));}if(_0x2774da){var _0x1193a4={'ContactId':_0x2774da['id'],'ChatWebsiteId':_0x50adb3[_0x2b44('0x5c')]['id'],'from':(_0x2774da[_0x2b44('0xad')]||'')+'\x20'+(_0x2774da[_0x2b44('0xae')]||''),'customerIp':_0x2d710c,'customerPort':_0x50adb3[_0x2b44('0xa9')][_0x2b44('0xaf')]?_0x50adb3[_0x2b44('0xa9')][_0x2b44('0xaf')]:null,'referer':_0x50adb3[_0x2b44('0x60')][_0x2b44('0xb0')],'browserName':_0x56c622[_0x2b44('0xb1')]['name']&&_0x56c622[_0x2b44('0xb1')][_0x2b44('0xb2')]?util[_0x2b44('0xb3')]('%s\x20%s',_0x56c622[_0x2b44('0xb1')][_0x2b44('0x3f')],_0x56c622['browser']['version']):_0x2b44('0xb4'),'browserVersion':_0x56c622[_0x2b44('0xb1')][_0x2b44('0xb2')]||'unknown','osName':util[_0x2b44('0xb3')](_0x2b44('0xb5'),_0x56c622['os'][_0x2b44('0x3f')],_0x56c622['os'][_0x2b44('0xb2')]),'osVersion':_0x56c622['os'][_0x2b44('0xb2')],'deviceModel':_0x56c622[_0x2b44('0xb6')][_0x2b44('0x48')]&&_0x56c622[_0x2b44('0xb6')][_0x2b44('0xb7')]?util['format']('%s\x20%s\x20%s',_0x56c622[_0x2b44('0xb6')][_0x2b44('0x48')],_0x56c622['device']['vendor'],_0x56c622[_0x2b44('0xb6')]['type']):null,'deviceVendor':_0x56c622['device']['vendor'],'deviceType':_0x56c622[_0x2b44('0xb6')][_0x2b44('0x47')],'formData':JSON[_0x2b44('0x28')](_0x50adb3[_0x2b44('0x60')])};var _0x2fbed7={'ChatWebsiteId':_0x50adb3[_0x2b44('0x5c')]['id'],'closed':![]};if(_0x50adb3['body']['threadId']){_0x2fbed7[_0x2b44('0xb8')]=_0x50adb3[_0x2b44('0x60')]['threadId'];return db[_0x2b44('0xb9')]['find']({'where':_0x2fbed7})['then'](function(_0x48bfa9){if(_0x48bfa9){return[_0x48bfa9,![]];}_0x1193a4[_0x2b44('0xb8')]=_0x50adb3[_0x2b44('0x60')]['threadId'];_0x1193a4[_0x2b44('0xba')]=_0x50adb3['body'][_0x2b44('0xba')];return db[_0x2b44('0xb9')][_0x2b44('0x5f')](_0x1193a4)[_0x2b44('0x22')](function(_0x19ee82){return[_0x19ee82,!![]];});});}_0x2fbed7['ContactId']=_0x2774da['id'];if(_0x50adb3[_0x2b44('0x60')][_0x2b44('0xbb')]&&_0x50adb3[_0x2b44('0x60')]['interaction']['id']){_0x2fbed7['id']=_0x50adb3[_0x2b44('0x60')]['interaction']['id'];return db['ChatInteraction'][_0x2b44('0x65')]({'where':_0x2fbed7})[_0x2b44('0x22')](function(_0x550d99){if(_0x550d99){return[_0x550d99,![]];}return db[_0x2b44('0xb9')][_0x2b44('0x5f')](_0x1193a4)[_0x2b44('0x22')](function(_0x4a7ce0){return[_0x4a7ce0,!![]];});});}return db[_0x2b44('0xb9')][_0x2b44('0x5f')](_0x1193a4)[_0x2b44('0x22')](function(_0x494ae2){return[_0x494ae2,!![]];});}})[_0x2b44('0xbc')](function(_0x4df3a6,_0x14f3d3){if(_0x4df3a6){_0x4d4a08=_0x14f3d3;if(!_0x14f3d3){var _0x25f6a5={'from':(_0x45e82a[_0x2b44('0xa8')]['firstName']||'')+'\x20'+(_0x45e82a[_0x2b44('0xa8')]['lastName']||'')};if(_0x50adb3[_0x2b44('0x60')][_0x2b44('0xb8')]&&_0x50adb3[_0x2b44('0x60')][_0x2b44('0xbd')]&&_0x50adb3['body'][_0x2b44('0xb8')]!=_0x50adb3[_0x2b44('0x60')][_0x2b44('0xbd')]){_0x25f6a5[_0x2b44('0xb8')]=_0x50adb3['body'][_0x2b44('0xbd')];}return _0x4df3a6['update'](_0x25f6a5);}else{return _0x4df3a6;}}})['then'](function(_0x3f6ece){_0x45e82a[_0x2b44('0xbb')]=_0x3f6ece['get']({'plain':!![]});_0x45e82a[_0x2b44('0xbb')][_0x2b44('0xbe')]=_0x4d4a08;if(_0x45e82a['interaction'][_0x2b44('0xbe')]){if(_0x45e82a['account'][_0x2b44('0xbf')]){_0x45e82a['applications'][_0x2b44('0xc0')]({'id':0x0,'priority':_0x45e82a[_0x2b44('0xc1')][_0x2b44('0x4d')]+0x1,'app':_0x2b44('0xc2'),'appdata':_0x2b44('0xc3'),'interval':_0x2b44('0xc4')});}}return db['ChatMessage']['create']({'body':_0x50adb3[_0x2b44('0x60')][_0x2b44('0x60')],'ChatWebsiteId':_0x50adb3[_0x2b44('0x5c')]['id'],'ChatInteractionId':_0x3f6ece['id'],'direction':'in','ContactId':_0x45e82a[_0x2b44('0xa8')]['id'],'AttachmentId':_0x50adb3['body'][_0x2b44('0xc5')]});})['then'](function(_0x1d277c){_0x45e82a[_0x2b44('0x2a')]=_0x1d277c;if(_0x45e82a[_0x2b44('0xbb')][_0x2b44('0xc6')]){return db['User'][_0x2b44('0x65')]({'attributes':['id',_0x2b44('0x3f')],'where':{'id':_0x45e82a[_0x2b44('0xbb')][_0x2b44('0xc6')]}})[_0x2b44('0x22')](function(_0x10fc28){if(_0x10fc28){_0x45e82a[_0x2b44('0xc1')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2b44('0xc7'),'appdata':_0x10fc28['name']+','+(_0x45e82a[_0x2b44('0xa2')][_0x2b44('0xc8')]||0xa),'interval':_0x2b44('0xc4')});_0x45e82a[_0x2b44('0xc9')]=!![];}return respondWithRpcPromise(_0x2b44('0xca'),_0x2b44('0xcb'),_0x45e82a);});}return respondWithRpcPromise(_0x2b44('0xca'),_0x2b44('0xcb'),_0x45e82a);})[_0x2b44('0x22')](function(_0x41bd4b){respondWithRpcPromise(_0x2b44('0xcc'),_0x2b44('0xcc'),{'event':_0x2b44('0x8a'),'message':_0x41bd4b},client9002);return _0x41bd4b;})[_0x2b44('0x22')](respondWithResult(_0x10cf90,null))[_0x2b44('0x2c')](handleError(_0x10cf90,null));};exports[_0x2b44('0xcd')]=function(_0x37ee84,_0x2a4bab,_0x3881c7){var _0x1fb8a9,_0x4e75a6,_0x35c886;var _0xe6d0db=[];var _0x5a3fc6=[];var _0x50cf1f={};return db['CmContact'][_0x2b44('0x69')]()[_0x2b44('0x22')](function(_0x15aa28){if(!_0x15aa28){throw new db[(_0x2b44('0x90'))]['ValidationError'](_0x2b44('0x92'));}_0x5a3fc6=_[_0x2b44('0x93')](_[_0x2b44('0x5d')](_0x15aa28),[_0x2b44('0x94'),_0x2b44('0x95')]);_0xe6d0db=_[_0x2b44('0x93')](_[_0x2b44('0x5d')](_0x15aa28),[_0x2b44('0x94'),_0x2b44('0x95'),_0x2b44('0x96'),_0x2b44('0xa7')]);if(_0x37ee84[_0x2b44('0x60')]['id']){delete _0x37ee84[_0x2b44('0x60')]['id'];}if(_[_0x2b44('0x81')](_0x37ee84['body'][_0x2b44('0x97')])){throw _0x2a4bab[_0x2b44('0x2e')](0x1f4)[_0x2b44('0x40')](new db['Sequelize'][(_0x2b44('0x91'))](_0x2b44('0x98')));}if(_[_0x2b44('0x81')](_0x37ee84[_0x2b44('0x60')][_0x2b44('0x60')])||_0x37ee84[_0x2b44('0x60')][_0x2b44('0x60')]===''){throw _0x2a4bab[_0x2b44('0x2e')](0x1f4)['send'](new db[(_0x2b44('0x90'))][(_0x2b44('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2b44('0x81')](_0x37ee84[_0x2b44('0x60')]['mapKeyOffline'])){throw _0x2a4bab[_0x2b44('0x2e')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x2b44('0xce')+_0xe6d0db));}if(!_[_0x2b44('0x9b')](_0xe6d0db,_0x37ee84[_0x2b44('0x60')][_0x2b44('0xcf')])){throw _0x2a4bab['status'](0x1f4)[_0x2b44('0x40')](new db[(_0x2b44('0x90'))][(_0x2b44('0x91'))](_0x2b44('0xd0')+_0xe6d0db));}_0x50cf1f[_0x37ee84[_0x2b44('0x60')][_0x2b44('0xcf')]]=_0x37ee84[_0x2b44('0x60')][_0x2b44('0x97')];})[_0x2b44('0x22')](function(){return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x37ee84[_0x2b44('0x5c')]['id']},'include':[{'model':db[_0x2b44('0x9c')],'as':_0x2b44('0x9d')}]});})[_0x2b44('0x22')](handleEntityNotFound(_0x2a4bab,null))[_0x2b44('0x22')](function(_0x423518){if(_0x423518&&_0x423518['List']){_0x4e75a6=_0x423518;var _0x5b3efc=_['defaults'](_0x37ee84['body'],{'firstName':_0x37ee84[_0x2b44('0x60')][_0x2b44('0x97')],'phone':_0x37ee84[_0x2b44('0x60')]['from'],'ListId':_0x423518[_0x2b44('0xa7')]});_0x5b3efc[_0x37ee84[_0x2b44('0x60')][_0x2b44('0xcf')]]=_0x37ee84['body'][_0x2b44('0x97')];return db[_0x2b44('0x8f')][_0x2b44('0xd1')]({'where':_0x50cf1f,'defaults':_0x5b3efc});}})[_0x2b44('0xbc')](function(_0x5d08f4){if(_0x5d08f4){_0x35c886=_0x5d08f4;var _0x502cb4=fs[_0x2b44('0xd2')](path[_0x2b44('0x7b')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x243068=ejs['render'](_0x502cb4,{'body':_['toPairs'](_0x37ee84['body'][_0x2b44('0x60')]),'bodyTitle':_0x4e75a6['offlineMessageBody']});return db[_0x2b44('0xd3')][_0x2b44('0x5f')]({'body':_0x243068,'ContactId':_0x5d08f4['id'],'ChatWebsiteId':_0x4e75a6['id']});}})[_0x2b44('0x22')](function(_0x4f55b9){if(_0x4f55b9){_0x1fb8a9=_0x4f55b9;return db['MailAccount'][_0x2b44('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0x2b44('0xd4')],'as':_0x2b44('0xd5'),'raw':!![]}]});}})[_0x2b44('0x22')](function(_0xb74f00){if(_0xb74f00&&_0xb74f00[_0x2b44('0xd5')]&&_0x4e75a6[_0x2b44('0xd6')]){var _0x1b4de5={'tls':{'rejectUnauthorized':![]}};if(_0xb74f00[_0x2b44('0xd5')]['service']){_0x1b4de5[_0x2b44('0xd7')]=_0xb74f00[_0x2b44('0xd5')][_0x2b44('0xd7')];}else{_0x1b4de5['host']=_0xb74f00['Smtp'][_0x2b44('0xd8')];_0x1b4de5[_0x2b44('0xd9')]=_0xb74f00[_0x2b44('0xd5')][_0x2b44('0xd9')];_0x1b4de5[_0x2b44('0xda')]=_0xb74f00[_0x2b44('0xd5')][_0x2b44('0xda')];}if(_0xb74f00['Smtp']['authentication']){_0x1b4de5[_0x2b44('0xdb')]={'user':_0xb74f00['Smtp'][_0x2b44('0x61')],'pass':_0xb74f00[_0x2b44('0xd5')][_0x2b44('0xdc')]};}return respondWithRpcPromise(_0x2b44('0xdd'),_0x2b44('0xde'),{'account':_0x1b4de5,'message':{'from':util[_0x2b44('0xb3')](_0x2b44('0xdf'),_0xb74f00[_0x2b44('0x3f')],_0xb74f00[_0x2b44('0xe0')]||_0xb74f00['Smtp']['user']),'to':_0x4e75a6[_0x2b44('0xd6')],'subject':_0x4e75a6[_0x2b44('0xe1')],'text':_0x1fb8a9[_0x2b44('0x60')]}},client9003)[_0x2b44('0x22')](function(){return _0x1fb8a9;})[_0x2b44('0x2c')](function(_0x443c6f){console['error'](_0x443c6f);});}})['then'](function(){if(_0x1fb8a9){return _0x1fb8a9;}})[_0x2b44('0x22')](respondWithResult(_0x2a4bab,null))[_0x2b44('0x2c')](handleError(_0x2a4bab,null));};exports[_0x2b44('0xe2')]=function(_0x488084,_0x3e9953,_0x1383c0){return db['ChatInteraction']['find']({'where':{'id':_0x488084[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x3e9953,null))[_0x2b44('0x22')](function(_0x1812d6){if(_0x1812d6){return _0x1812d6[_0x2b44('0xe2')](_0x488084['body'][_0x2b44('0x73')],_[_0x2b44('0xe3')](_0x488084[_0x2b44('0x60')],[_0x2b44('0x73'),'id'])||{});}})[_0x2b44('0x22')](respondWithResult(_0x3e9953,null))[_0x2b44('0x2c')](handleError(_0x3e9953,null));};exports[_0x2b44('0xe4')]=function(_0xe5bba8,_0x466a99,_0x1c74db){var _0x467ebe={'raw':![],'where':{}};var _0x26f33a={};var _0x10ea74={'count':0x0,'rows':[]};return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0xe5bba8[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x466a99,null))[_0x2b44('0x22')](function(_0x54e775){if(_0x54e775){_0x26f33a['model']=_[_0x2b44('0x5d')](db[_0x2b44('0xb9')][_0x2b44('0x45')]);_0x26f33a[_0x2b44('0x49')]=_[_0x2b44('0x5d')](_0xe5bba8[_0x2b44('0x49')]);_0x26f33a['filters']=_[_0x2b44('0x4a')](_0x26f33a[_0x2b44('0x48')],_0x26f33a['query']);_0x467ebe[_0x2b44('0x4b')]=_[_0x2b44('0x4a')](_0x26f33a[_0x2b44('0x48')],qs['fields'](_0xe5bba8[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x467ebe[_0x2b44('0x4b')]=_0x467ebe['attributes'][_0x2b44('0x4d')]?_0x467ebe[_0x2b44('0x4b')]:_0x26f33a[_0x2b44('0x48')];if(!_0xe5bba8['query'][_0x2b44('0x4e')](_0x2b44('0x4f'))){_0x467ebe[_0x2b44('0x33')]=qs[_0x2b44('0x33')](_0xe5bba8['query']['limit']);_0x467ebe[_0x2b44('0x32')]=qs['offset'](_0xe5bba8[_0x2b44('0x49')][_0x2b44('0x32')]);}_0x467ebe[_0x2b44('0x50')]=qs[_0x2b44('0x51')](_0xe5bba8[_0x2b44('0x49')][_0x2b44('0x51')]);_0x467ebe[_0x2b44('0x52')]=qs[_0x2b44('0x53')](_[_0x2b44('0x6d')](_0xe5bba8[_0x2b44('0x49')],_0x26f33a[_0x2b44('0x53')]));_0x467ebe[_0x2b44('0x52')][_0x2b44('0x6b')]=_0x54e775['id'];if(_0xe5bba8[_0x2b44('0x49')]['filter']){_0x467ebe[_0x2b44('0x52')]=_[_0x2b44('0x56')](_0x467ebe['where'],{'$or':_[_0x2b44('0x43')](_0x467ebe[_0x2b44('0x4b')],function(_0x14d1ac){var _0x743b6a={};_0x743b6a[_0x14d1ac]={'$like':'%'+_0xe5bba8[_0x2b44('0x49')][_0x2b44('0x54')]+'%'};return _0x743b6a;})});}_0x467ebe=_[_0x2b44('0x56')]({},_0x467ebe,_0xe5bba8['options']);return db['ChatInteraction'][_0x2b44('0x31')]({'where':_0x467ebe[_0x2b44('0x52')]})[_0x2b44('0x22')](function(_0x46b213){_0x10ea74[_0x2b44('0x31')]=_0x46b213;if(_0xe5bba8[_0x2b44('0x49')][_0x2b44('0x5e')]){_0x467ebe['include']=[{'model':db[_0x2b44('0x8f')],'as':_0x2b44('0xe5'),'required':![]},{'model':db[_0x2b44('0xe6')],'as':'Owner','attributes':[_0x2b44('0x3f'),_0x2b44('0xe7'),'internal'],'required':![]},{'model':db[_0x2b44('0xe8')],'as':_0x2b44('0xe9'),'attributes':['id',_0x2b44('0x3f'),_0x2b44('0xea')],'where':_0xe5bba8[_0x2b44('0x49')][_0x2b44('0xeb')]?{'id':_0xe5bba8['query'][_0x2b44('0xeb')]}:undefined,'required':_0xe5bba8[_0x2b44('0x49')]['tag']?!![]:![]}];}return db[_0x2b44('0xb9')]['findAll'](_0x467ebe);})[_0x2b44('0x22')](function(_0x40c6a9){_0x10ea74[_0x2b44('0x5a')]=_0x40c6a9;return _0x10ea74;});}})[_0x2b44('0x22')](respondWithFilteredResult(_0x466a99,_0x467ebe))['catch'](handleError(_0x466a99,null));};function iftimePromise(_0x25491f,_0x4965c0){return respondWithRpcPromise('Command',_0x2b44('0xec'),{'command':_0x4965c0['timezone']?util[_0x2b44('0xb3')](_0x2b44('0xed'),_0x25491f[_0x2b44('0xee')],_0x4965c0[_0x2b44('0xef')]):util[_0x2b44('0xb3')](_0x2b44('0xf0'),_0x25491f[_0x2b44('0xee')])},client9002)['then'](function(_0x3aa713){var _0x570170=_0x3aa713&&_0x3aa713[_0x2b44('0xf1')](_0x2b44('0xf2'))>=0x0?!![]:![];logger[_0x2b44('0x23')](_0x2b44('0xf3'),_0x4965c0['id'],_0x25491f['id'],_0x25491f[_0x2b44('0xee')],_0x570170?_0x2b44('0xf4'):_0x2b44('0xf5'),_0x4965c0['timezone']?_0x4965c0[_0x2b44('0xef')]:_0x2b44('0xf6'));return _0x570170;})[_0x2b44('0x2c')](function(_0x49f958){logger[_0x2b44('0x29')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4965c0['id'],_0x25491f['id'],_0x25491f[_0x2b44('0xee')],util[_0x2b44('0xf7')](_0x49f958,{'showHidden':![],'depth':null}),_0x4965c0[_0x2b44('0xef')]?_0x4965c0[_0x2b44('0xef')]:_0x2b44('0xf6'));return![];});}exports[_0x2b44('0xec')]=function(_0x12a051,_0x2b82eb,_0x3fea51){var _0x54371f=0x0;var _0x2d3e91=0x0;var _0x53bc0e=![];var _0x1ceb69;var _0x26fca0;return db[_0x2b44('0x44')][_0x2b44('0x65')]({'where':{'id':_0x12a051['params']['id']},'include':[{'model':db[_0x2b44('0xf8')],'as':_0x2b44('0xf8'),'include':[{'model':db[_0x2b44('0xf8')],'as':_0x2b44('0xf9'),'attributes':['id',_0x2b44('0xee')],'raw':!![]}]}]})[_0x2b44('0x22')](handleEntityNotFound(_0x2b82eb,null))[_0x2b44('0x22')](function(_0x14f0f1){if(_0x14f0f1){_0x1ceb69=_0x14f0f1;return _0x14f0f1[_0x2b44('0xfa')]({'raw':!![]});}})[_0x2b44('0x22')](function(_0x3c4023){if(_0x1ceb69){if(_0x3c4023){_0x26fca0=_0x3c4023;}}return require('../../config/license/util')[_0x2b44('0x7f')]();})[_0x2b44('0x22')](function(_0x44e1b1){if(_0x44e1b1){_0x2d3e91=_0x44e1b1[_0x2b44('0xfb')];_0x53bc0e=_0x44e1b1[_0x2b44('0x80')];}})['then'](function(){return db[_0x2b44('0xb9')][_0x2b44('0x31')]({'where':{'closed':![]}});})[_0x2b44('0x22')](function(_0x1ef989){_0x54371f=_0x1ef989;if(_0x2d3e91&&_0x1ef989>_0x2d3e91){return db['License']['findOne']({'where':{'id':0x1}})[_0x2b44('0x22')](function(_0x3bc4c7){if(_0x3bc4c7){_0x3bc4c7[_0x2b44('0xfc')](_0x2b44('0xfd'));}});}})[_0x2b44('0x22')](function(){if(_0x1ceb69[_0x2b44('0xf8')]&&_0x1ceb69['Interval'][_0x2b44('0xf9')]){var _0x4e1af2=[];for(var _0x36a5e4=0x0;_0x36a5e4<_0x1ceb69[_0x2b44('0xf8')]['Intervals'][_0x2b44('0x4d')];_0x36a5e4++){var _0x5961b7=_0x1ceb69[_0x2b44('0xf8')][_0x2b44('0xf9')][_0x36a5e4][_0x2b44('0x3b')]({'plain':!![]});_0x4e1af2['push'](iftimePromise(_0x5961b7,_0x1ceb69));}return BPromise[_0x2b44('0xfe')](_0x4e1af2)[_0x2b44('0x22')](function(_0x3837a0){return _[_0x2b44('0xff')](_0x3837a0);});}else{return!![];}})[_0x2b44('0x22')](function(_0x58011f){var _0x36a2f2=fs['readFileSync'](path[_0x2b44('0x7b')](config[_0x2b44('0x7c')],_0x2b44('0x100')),'utf8');var _0x4728b0={'remote':_0x1ceb69[_0x2b44('0x101')],'query':querystring[_0x2b44('0x28')](_[_0x2b44('0x56')](_0x1ceb69[_0x2b44('0x3b')]({'plain':!![]}),{'customerIp':_0x12a051['headers']['x-forwarded-for']||_0x12a051[_0x2b44('0xa9')]['x-real-ip']||_0x12a051[_0x2b44('0x102')][_0x2b44('0x103')]||_0x12a051['ip'],'referer':_0x12a051[_0x2b44('0xa9')][_0x2b44('0xb0')],'openedInteractions':_0x54371f,'maxInteractions':_0x2d3e91,'virtual':_0x53bc0e[_0x2b44('0xfb')],'online':_0x58011f,'custom':_0x53bc0e}))['replace'](/'/g,'\x5c\x27')};_0x2b82eb[_0x2b44('0x40')](ejs[_0x2b44('0x104')](Mustache[_0x2b44('0x104')](_0x36a2f2,_0x4728b0),{'proactiveActions':_0x26fca0,'alignment':_0x1ceb69[_0x2b44('0x105')],'verticalAlignment':_0x1ceb69[_0x2b44('0x106')],'div_color':_0x1ceb69['color'],'text_color':_0x1ceb69[_0x2b44('0x107')]}));})[_0x2b44('0x2c')](handleError(_0x2b82eb,null));};exports[_0x2b44('0x108')]=function(_0x430038,_0x4fdfdd,_0x8d3530){return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0x430038[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4fdfdd,null))[_0x2b44('0x22')](function(_0x5c5e64){if(_0x5c5e64){return db[_0x2b44('0x109')][_0x2b44('0x10a')](function(_0x4d0102){return db[_0x2b44('0xa0')][_0x2b44('0x3a')]({'where':{'ChatWebsiteId':_0x430038[_0x2b44('0x5c')]['id']},'transaction':_0x4d0102})[_0x2b44('0x22')](function(_0x17960f){var _0x34efdd=_[_0x2b44('0x43')](_0x430038[_0x2b44('0x60')],function(_0x5aea82){_0x5aea82[_0x2b44('0x6b')]=_0x430038['params']['id'];return _0x5aea82;});return db['ChatApplication'][_0x2b44('0x10b')](_0x34efdd,{'transaction':_0x4d0102});});})['then'](function(){return db['ChatApplication'][_0x2b44('0x10c')]({'where':{'ChatWebsiteId':_0x430038['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x4fdfdd,null))['catch'](handleError(_0x4fdfdd,null));};exports[_0x2b44('0x10d')]=function(_0x2581c0,_0x1c65c3,_0x52ee7c){var _0x3ba3c6={};var _0x42de98={};var _0x4e9e98;var _0x100d36;return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0x2581c0['params']['id']}})['then'](handleEntityNotFound(_0x1c65c3,null))[_0x2b44('0x22')](function(_0x3133f1){if(_0x3133f1){_0x4e9e98=_0x3133f1;_0x42de98[_0x2b44('0x48')]=_[_0x2b44('0x5d')](db['ChatApplication']['rawAttributes']);_0x42de98[_0x2b44('0x49')]=_[_0x2b44('0x5d')](_0x2581c0['query']);_0x42de98[_0x2b44('0x53')]=_[_0x2b44('0x4a')](_0x42de98[_0x2b44('0x48')],_0x42de98['query']);_0x3ba3c6[_0x2b44('0x4b')]=_['intersection'](_0x42de98['model'],qs[_0x2b44('0x4c')](_0x2581c0[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x3ba3c6['attributes']=_0x3ba3c6[_0x2b44('0x4b')]['length']?_0x3ba3c6['attributes']:_0x42de98[_0x2b44('0x48')];_0x3ba3c6[_0x2b44('0x50')]=qs[_0x2b44('0x51')](_0x2581c0['query'][_0x2b44('0x51')]);_0x3ba3c6[_0x2b44('0x52')]=qs['filters'](_[_0x2b44('0x6d')](_0x2581c0[_0x2b44('0x49')],_0x42de98[_0x2b44('0x53')]));if(_0x2581c0['query']['filter']){_0x3ba3c6[_0x2b44('0x52')]=_[_0x2b44('0x56')](_0x3ba3c6[_0x2b44('0x52')],{'$or':_['map'](_0x3ba3c6[_0x2b44('0x4b')],function(_0xc575e3){var _0x707af8={};_0x707af8[_0xc575e3]={'$like':'%'+_0x2581c0[_0x2b44('0x49')]['filter']+'%'};return _0x707af8;})});}_0x3ba3c6=_[_0x2b44('0x56')]({},_0x3ba3c6,_0x2581c0['options']);return _0x4e9e98[_0x2b44('0x10d')](_0x3ba3c6);}})[_0x2b44('0x22')](function(_0x463d38){if(_0x463d38){_0x100d36=_0x463d38['length'];if(!_0x2581c0['query'][_0x2b44('0x4e')](_0x2b44('0x4f'))){_0x3ba3c6[_0x2b44('0x33')]=qs['limit'](_0x2581c0[_0x2b44('0x49')][_0x2b44('0x33')]);_0x3ba3c6[_0x2b44('0x32')]=qs['offset'](_0x2581c0[_0x2b44('0x49')][_0x2b44('0x32')]);}return _0x4e9e98['getApplications'](_0x3ba3c6);}})[_0x2b44('0x22')](function(_0x5c91c1){if(_0x5c91c1){return _0x5c91c1?{'count':_0x100d36,'rows':_0x5c91c1}:null;}})[_0x2b44('0x22')](respondWithResult(_0x1c65c3,null))[_0x2b44('0x2c')](handleError(_0x1c65c3,null));};exports[_0x2b44('0x10e')]=function(_0x1b59b4,_0x19b276,_0x356be6){return db[_0x2b44('0x10f')][_0x2b44('0x65')]({'where':{'id':_0x1b59b4[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x19b276,null))[_0x2b44('0x22')](function(_0x48f3b9){if(_0x48f3b9){return _0x48f3b9[_0x2b44('0x10e')](_0x1b59b4[_0x2b44('0x60')][_0x2b44('0x73')],_[_0x2b44('0xe3')](_0x1b59b4[_0x2b44('0x60')],[_0x2b44('0x73'),'id'])||{});}})[_0x2b44('0x22')](respondWithResult(_0x19b276,null))[_0x2b44('0x2c')](handleError(_0x19b276,null));};exports['getProactiveActions']=function(_0x4c70f8,_0x798961,_0x4b5d14){var _0x4c1b18={};var _0x46e806={};var _0x13f690;var _0x4ec14b;return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0x4c70f8[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x798961,null))['then'](function(_0x12bf50){if(_0x12bf50){_0x13f690=_0x12bf50;_0x46e806[_0x2b44('0x48')]=_[_0x2b44('0x5d')](db[_0x2b44('0x110')][_0x2b44('0x45')]);_0x46e806[_0x2b44('0x49')]=_[_0x2b44('0x5d')](_0x4c70f8[_0x2b44('0x49')]);_0x46e806[_0x2b44('0x53')]=_[_0x2b44('0x4a')](_0x46e806[_0x2b44('0x48')],_0x46e806[_0x2b44('0x49')]);_0x4c1b18[_0x2b44('0x4b')]=_[_0x2b44('0x4a')](_0x46e806[_0x2b44('0x48')],qs['fields'](_0x4c70f8[_0x2b44('0x49')]['fields']));_0x4c1b18[_0x2b44('0x4b')]=_0x4c1b18[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x4c1b18[_0x2b44('0x4b')]:_0x46e806[_0x2b44('0x48')];_0x4c1b18[_0x2b44('0x50')]=qs['sort'](_0x4c70f8['query']['sort']);_0x4c1b18['where']=qs[_0x2b44('0x53')](_[_0x2b44('0x6d')](_0x4c70f8['query'],_0x46e806['filters']));if(_0x4c70f8[_0x2b44('0x49')][_0x2b44('0x54')]){_0x4c1b18[_0x2b44('0x52')]=_['merge'](_0x4c1b18['where'],{'$or':_['map'](_0x4c1b18[_0x2b44('0x4b')],function(_0x3e8964){var _0x238be8={};_0x238be8[_0x3e8964]={'$like':'%'+_0x4c70f8[_0x2b44('0x49')][_0x2b44('0x54')]+'%'};return _0x238be8;})});}_0x4c1b18=_[_0x2b44('0x56')]({},_0x4c1b18,_0x4c70f8[_0x2b44('0x57')]);return _0x13f690['getProactiveActions'](_0x4c1b18);}})[_0x2b44('0x22')](function(_0x1124f8){if(_0x1124f8){_0x4ec14b=_0x1124f8['length'];if(!_0x4c70f8[_0x2b44('0x49')]['hasOwnProperty'](_0x2b44('0x4f'))){_0x4c1b18[_0x2b44('0x33')]=qs['limit'](_0x4c70f8[_0x2b44('0x49')][_0x2b44('0x33')]);_0x4c1b18['offset']=qs[_0x2b44('0x32')](_0x4c70f8[_0x2b44('0x49')]['offset']);}return _0x13f690['getProactiveActions'](_0x4c1b18);}})['then'](function(_0x441b10){if(_0x441b10){return _0x441b10?{'count':_0x4ec14b,'rows':_0x441b10}:null;}})['then'](respondWithResult(_0x798961,null))['catch'](handleError(_0x798961,null));};exports[_0x2b44('0x111')]=function(_0x1059d8,_0xaf3600,_0x3fe873){var _0x5868e8=_0x1059d8[_0x2b44('0x49')][_0x2b44('0x112')]==='false'?_0x2b44('0x113'):_0x2b44('0x114');return db[_0x2b44('0x44')]['find']({'attributes':['id',_0x5868e8],'where':{'id':_0x1059d8[_0x2b44('0x5c')]['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0xaf3600,null))[_0x2b44('0x22')](function(_0x5e8a21){if(_0x5e8a21){var _0x50356e=_0x5e8a21[_0x5868e8];var _0x58e04a=_0x50356e&&_0x50356e['items']?_0x50356e['items']:[];_0xaf3600[_0x2b44('0x40')]({'fromKey':_[_0x2b44('0x81')](_0x50356e['fromKey'])?undefined:_0x50356e[_0x2b44('0x115')],'count':_0x58e04a[_0x2b44('0x4d')],'rows':_0x58e04a});}})[_0x2b44('0x2c')](handleError(_0xaf3600,null));};exports[_0x2b44('0x116')]=function(_0x5c24e7,_0x4040d7,_0x2e77d1){var _0x1f49e1={'raw':![],'where':{}};var _0x57fccd={};var _0x29039a={'count':0x0,'rows':[]};return db[_0x2b44('0x44')][_0x2b44('0x6c')]({'where':{'id':_0x5c24e7[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4040d7,null))[_0x2b44('0x22')](function(_0x17c9c4){if(_0x17c9c4){_0x57fccd[_0x2b44('0x48')]=_[_0x2b44('0x5d')](db[_0x2b44('0xd3')]['rawAttributes']);_0x57fccd['query']=_[_0x2b44('0x5d')](_0x5c24e7[_0x2b44('0x49')]);_0x57fccd[_0x2b44('0x53')]=_[_0x2b44('0x4a')](_0x57fccd[_0x2b44('0x48')],_0x57fccd[_0x2b44('0x49')]);_0x1f49e1[_0x2b44('0x4b')]=_['intersection'](_0x57fccd[_0x2b44('0x48')],qs['fields'](_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x1f49e1[_0x2b44('0x4b')]=_0x1f49e1[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x1f49e1[_0x2b44('0x4b')]:_0x57fccd[_0x2b44('0x48')];if(!_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x4e')]('nolimit')){_0x1f49e1[_0x2b44('0x33')]=qs[_0x2b44('0x33')](_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x33')]);_0x1f49e1[_0x2b44('0x32')]=qs[_0x2b44('0x32')](_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x32')]);}_0x1f49e1[_0x2b44('0x50')]=qs['sort'](_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x51')]);_0x1f49e1[_0x2b44('0x52')]=qs['filters'](_[_0x2b44('0x6d')](_0x5c24e7[_0x2b44('0x49')],_0x57fccd[_0x2b44('0x53')]));_0x1f49e1[_0x2b44('0x52')][_0x2b44('0x6b')]=_0x17c9c4['id'];if(_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x54')]){_0x1f49e1['where']=_[_0x2b44('0x56')](_0x1f49e1[_0x2b44('0x52')],{'$or':_[_0x2b44('0x43')](_0x1f49e1[_0x2b44('0x4b')],function(_0x3f16cf){var _0x160cb5={};_0x160cb5[_0x3f16cf]={'$like':'%'+_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x54')]+'%'};return _0x160cb5;})});}_0x1f49e1=_['merge']({},_0x1f49e1,_0x5c24e7[_0x2b44('0x57')]);return db['ChatOfflineMessage'][_0x2b44('0x31')]({'where':_0x1f49e1[_0x2b44('0x52')]})[_0x2b44('0x22')](function(_0x33522d){_0x29039a[_0x2b44('0x31')]=_0x33522d;if(_0x5c24e7[_0x2b44('0x49')][_0x2b44('0x5e')]){_0x1f49e1[_0x2b44('0x58')]=[{'all':!![]}];}else{_0x1f49e1[_0x2b44('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0x2b44('0xd3')][_0x2b44('0x59')](_0x1f49e1);})[_0x2b44('0x22')](function(_0x30b65a){_0x29039a['rows']=_0x30b65a;return _0x29039a;});}})['then'](respondWithFilteredResult(_0x4040d7,_0x1f49e1))['catch'](handleError(_0x4040d7,null));};exports['addAgents']=function(_0x1b0556,_0x40cd61,_0x4081ae){return db['ChatWebsite']['find']({'where':{'id':_0x1b0556[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0x40cd61,null))[_0x2b44('0x22')](function(_0x249824){if(_0x249824){return _0x249824[_0x2b44('0x117')](_0x1b0556[_0x2b44('0x60')]['ids'],_[_0x2b44('0xe3')](_0x1b0556['body'],['ids','id'])||{})[_0x2b44('0xbc')](function(_0x2de38b){for(var _0x5c12e3=0x0;_0x5c12e3<_0x1b0556[_0x2b44('0x60')][_0x2b44('0x73')][_0x2b44('0x4d')];_0x5c12e3+=0x1){socket[_0x2b44('0x118')](_0x2b44('0x119'),{'UserId':_0x1b0556[_0x2b44('0x60')][_0x2b44('0x73')][_0x5c12e3],'ChatWebsiteId':_0x1b0556[_0x2b44('0x5c')]['id']});}return _0x2de38b;});}})[_0x2b44('0x22')](respondWithResult(_0x40cd61,null))[_0x2b44('0x2c')](handleError(_0x40cd61,null));};exports['removeAgents']=function(_0x4dbaa3,_0x5cd1c1,_0x523f46){return db['ChatWebsite'][_0x2b44('0x65')]({'where':{'id':_0x4dbaa3[_0x2b44('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5cd1c1,null))[_0x2b44('0x22')](function(_0x1234cf){if(_0x1234cf){return _0x1234cf[_0x2b44('0x11a')](_0x4dbaa3['query']['ids'])[_0x2b44('0x22')](function(){if(_['isArray'](_0x4dbaa3[_0x2b44('0x49')][_0x2b44('0x73')])){for(var _0x50a0f0=0x0;_0x50a0f0<_0x4dbaa3[_0x2b44('0x49')][_0x2b44('0x73')][_0x2b44('0x4d')];_0x50a0f0+=0x1){socket['emit'](_0x2b44('0x11b'),{'UserId':Number(_0x4dbaa3[_0x2b44('0x49')][_0x2b44('0x73')][_0x50a0f0]),'ChatWebsiteId':Number(_0x4dbaa3['params']['id'])});}}else{socket[_0x2b44('0x118')](_0x2b44('0x11b'),{'UserId':Number(_0x4dbaa3[_0x2b44('0x49')]['ids']),'ChatWebsiteId':Number(_0x4dbaa3[_0x2b44('0x5c')]['id'])});}});}})[_0x2b44('0x22')](respondWithStatusCode(_0x5cd1c1,null))[_0x2b44('0x2c')](handleError(_0x5cd1c1,null));};exports['getAgents']=function(_0x1c8d68,_0x475e98,_0x58aacc){var _0x40e64c={};var _0x26a59a={};var _0x54957f;var _0x395fd3;return db['ChatWebsite'][_0x2b44('0x6c')]({'where':{'id':_0x1c8d68['params']['id']}})[_0x2b44('0x22')](handleEntityNotFound(_0x475e98,null))[_0x2b44('0x22')](function(_0xa28369){if(_0xa28369){_0x54957f=_0xa28369;_0x26a59a[_0x2b44('0x48')]=_[_0x2b44('0x5d')](db[_0x2b44('0xe6')][_0x2b44('0x45')]);_0x26a59a[_0x2b44('0x49')]=_[_0x2b44('0x5d')](_0x1c8d68[_0x2b44('0x49')]);_0x26a59a[_0x2b44('0x53')]=_[_0x2b44('0x4a')](_0x26a59a[_0x2b44('0x48')],_0x26a59a['query']);_0x40e64c['attributes']=_[_0x2b44('0x4a')](_0x26a59a['model'],qs[_0x2b44('0x4c')](_0x1c8d68[_0x2b44('0x49')][_0x2b44('0x4c')]));_0x40e64c[_0x2b44('0x4b')]=_0x40e64c[_0x2b44('0x4b')][_0x2b44('0x4d')]?_0x40e64c[_0x2b44('0x4b')]:_0x26a59a['model'];_0x40e64c[_0x2b44('0x50')]=qs['sort'](_0x1c8d68[_0x2b44('0x49')][_0x2b44('0x51')]);_0x40e64c['where']=qs[_0x2b44('0x53')](_['pick'](_0x1c8d68[_0x2b44('0x49')],_0x26a59a[_0x2b44('0x53')]));if(_0x1c8d68[_0x2b44('0x49')][_0x2b44('0x54')]){_0x40e64c['where']=_['merge'](_0x40e64c[_0x2b44('0x52')],{'$or':_[_0x2b44('0x43')](_0x40e64c[_0x2b44('0x4b')],function(_0xdca49d){var _0x23bcf0={};_0x23bcf0[_0xdca49d]={'$like':'%'+_0x1c8d68['query'][_0x2b44('0x54')]+'%'};return _0x23bcf0;})});}_0x40e64c=_[_0x2b44('0x56')]({},_0x40e64c,_0x1c8d68['options']);return _0x54957f['getAgents'](_0x40e64c);}})[_0x2b44('0x22')](function(_0x414125){if(_0x414125){_0x395fd3=_0x414125['length'];if(!_0x1c8d68[_0x2b44('0x49')][_0x2b44('0x4e')](_0x2b44('0x4f'))){_0x40e64c[_0x2b44('0x33')]=qs['limit'](_0x1c8d68[_0x2b44('0x49')][_0x2b44('0x33')]);_0x40e64c['offset']=qs[_0x2b44('0x32')](_0x1c8d68['query'][_0x2b44('0x32')]);}return _0x54957f[_0x2b44('0x11c')](_0x40e64c);}})[_0x2b44('0x22')](function(_0x560ef3){if(_0x560ef3){return _0x560ef3?{'count':_0x395fd3,'rows':_0x560ef3}:null;}})['then'](respondWithResult(_0x475e98,null))['catch'](handleError(_0x475e98,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a0397b6..76bb358 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 _0x6aa7=['events','ChatWebsite','setMaxListeners','save','update','emit','hook','exports'];(function(_0xf12953,_0x3deeff){var _0x9f3015=function(_0x9b0167){while(--_0x9b0167){_0xf12953['push'](_0xf12953['shift']());}};_0x9f3015(++_0x3deeff);}(_0x6aa7,0x178));var _0x76aa=function(_0x4479b9,_0x375ee5){_0x4479b9=_0x4479b9-0x0;var _0x502237=_0x6aa7[_0x4479b9];return _0x502237;};'use strict';var EventEmitter=require(_0x76aa('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x76aa('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x76aa('0x2')](0x0);var events={'afterCreate':_0x76aa('0x3'),'afterUpdate':_0x76aa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13f62b){return function(_0xef15ef,_0x1d6e04,_0x511588){ChatWebsiteEvents['emit'](_0x13f62b+':'+_0xef15ef['id'],_0xef15ef);ChatWebsiteEvents[_0x76aa('0x5')](_0x13f62b,_0xef15ef);_0x511588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x76aa('0x6')](e,emitEvent(event));}}module[_0x76aa('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xadec=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','exports'];(function(_0x9d7a97,_0x4f5da4){var _0x4b7ffc=function(_0x4237c0){while(--_0x4237c0){_0x9d7a97['push'](_0x9d7a97['shift']());}};_0x4b7ffc(++_0x4f5da4);}(_0xadec,0x156));var _0xcade=function(_0x339f29,_0x1d7848){_0x339f29=_0x339f29-0x0;var _0x553bf9=_0xadec[_0x339f29];return _0x553bf9;};'use strict';var EventEmitter=require(_0xcade('0x0'));var ChatWebsite=require(_0xcade('0x1'))['db'][_0xcade('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcade('0x3')](0x0);var events={'afterCreate':_0xcade('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x570d9c){return function(_0x475533,_0x875b81,_0xc0b40e){ChatWebsiteEvents['emit'](_0x570d9c+':'+_0x475533['id'],_0x475533);ChatWebsiteEvents['emit'](_0x570d9c,_0x475533);_0xc0b40e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xcade('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ea1431f..eac495d 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 _0x9567=['lodash','util','../../config/logger','api','moment','path','rimraf','./chatWebsite.attributes','define','ChatWebsite'];(function(_0x49b233,_0x5e5437){var _0x17fc8d=function(_0x20e2d5){while(--_0x20e2d5){_0x49b233['push'](_0x49b233['shift']());}};_0x17fc8d(++_0x5e5437);}(_0x9567,0xdc));var _0x7956=function(_0x3a2534,_0x303a7c){_0x3a2534=_0x3a2534-0x0;var _0x5e6774=_0x9567[_0x3a2534];return _0x5e6774;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var logger=require(_0x7956('0x2'))(_0x7956('0x3'));var moment=require(_0x7956('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7956('0x5'));var rimraf=require(_0x7956('0x6'));var config=require('../../config/environment');var attributes=require(_0x7956('0x7'));module['exports']=function(_0x12c09e,_0x48c4b6){return _0x12c09e[_0x7956('0x8')](_0x7956('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa571=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x1692fd,_0x2e1c9d){var _0x1fec4b=function(_0x3f2d46){while(--_0x3f2d46){_0x1692fd['push'](_0x1692fd['shift']());}};_0x1fec4b(++_0x2e1c9d);}(_0xa571,0x107));var _0x1a57=function(_0x5d61b0,_0x4bcfd5){_0x5d61b0=_0x5d61b0-0x0;var _0x96e8db=_0xa571[_0x5d61b0];return _0x96e8db;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'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 5cad4a1..0e6d079 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 _0x4137=['redis','defaults','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1926bd,_0x2fda07){var _0x2bd481=function(_0x326007){while(--_0x326007){_0x1926bd['push'](_0x1926bd['shift']());}};_0x2bd481(++_0x2fda07);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});config[_0x7413('0xd')]=_[_0x7413('0xe')](config[_0x7413('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7413('0xf'))(new Redis(config[_0x7413('0xd')]));require('./chatWebsite.socket')[_0x7413('0x10')](socket);function respondWithRpcPromise(_0x2f4b54,_0x50fde0,_0x29f124){return new BPromise(function(_0x427b3b,_0x737ab4){return client[_0x7413('0x11')](_0x2f4b54,_0x29f124)[_0x7413('0x12')](function(_0x5a1e62){logger[_0x7413('0x13')](_0x7413('0x14'),_0x50fde0,'request\x20sent');logger[_0x7413('0x15')](_0x7413('0x16'),_0x50fde0,_0x7413('0x17'),JSON['stringify'](_0x5a1e62));if(_0x5a1e62['error']){if(_0x5a1e62['error'][_0x7413('0x18')]===0x1f4){logger[_0x7413('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x50fde0,_0x5a1e62[_0x7413('0x19')][_0x7413('0x1a')]);return _0x737ab4(_0x5a1e62['error'][_0x7413('0x1a')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x50fde0,_0x5a1e62[_0x7413('0x19')]['message']);return _0x427b3b(_0x5a1e62[_0x7413('0x19')]['message']);}else{logger[_0x7413('0x13')](_0x7413('0x14'),_0x50fde0,_0x7413('0x17'));_0x427b3b(_0x5a1e62[_0x7413('0x1b')][_0x7413('0x1a')]);}})[_0x7413('0x1c')](function(_0x51194e){logger[_0x7413('0x19')](_0x7413('0x14'),_0x50fde0,_0x51194e);_0x737ab4(_0x51194e);});});} \ No newline at end of file +var _0x8e3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x469a7e,_0x230a2c){var _0x5b2033=function(_0x3bd4ab){while(--_0x3bd4ab){_0x469a7e['push'](_0x469a7e['shift']());}};_0x5b2033(++_0x230a2c);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c209dd2..47db39f 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(_0x3be43b,_0x3c10b3){var _0x2dc567=function(_0x2c33e8){while(--_0x2c33e8){_0x3be43b['push'](_0x3be43b['shift']());}};_0x2dc567(++_0x3c10b3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0x5f2f[_0x4eb662];return _0x2d7889;};'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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c2098,_0x1f6ab8){_0x5c2098=_0x5c2098-0x0;var _0x1f515f=_0x5f2f[_0x5c2098];return _0x1f515f;};'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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ebb6bd3..289fe1e 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 _0x5505=['getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','now','originalname','/:id/logo','single','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','addAvatar','format','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','offline','addInteraction','/:id/proactive_actions','addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','Router','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages'];(function(_0x55966b,_0x49eb7f){var _0x14b9d8=function(_0x3ee53c){while(--_0x3ee53c){_0x55966b['push'](_0x55966b['shift']());}};_0x14b9d8(++_0x49eb7f);}(_0x5505,0xdb));var _0x5550=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5505[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x5550('0x0'));var util=require(_0x5550('0x1'));var path=require(_0x5550('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5550('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5550('0x4'));var controller=require('./chatWebsite.controller');router[_0x5550('0x5')]('/',auth['isAuthenticated'](),controller[_0x5550('0x6')]);router[_0x5550('0x5')]('/describe',auth[_0x5550('0x7')](),controller[_0x5550('0x8')]);router[_0x5550('0x5')](_0x5550('0x9'),auth['isAuthenticated'](),controller[_0x5550('0xa')]);router[_0x5550('0x5')](_0x5550('0xb'),auth[_0x5550('0x7')](),controller[_0x5550('0xc')]);router[_0x5550('0x5')](_0x5550('0xd'),auth[_0x5550('0x7')](),controller[_0x5550('0xe')]);router[_0x5550('0x5')]('/:id/logo',controller[_0x5550('0xf')]);router[_0x5550('0x5')]('/:id/avatar',controller[_0x5550('0x10')]);router[_0x5550('0x5')](_0x5550('0x11'),controller[_0x5550('0x12')]);router[_0x5550('0x5')]('/:id/system_avatar',controller[_0x5550('0x13')]);router[_0x5550('0x5')](_0x5550('0x14'),auth[_0x5550('0x7')](),controller[_0x5550('0x15')]);router[_0x5550('0x5')](_0x5550('0x16'),controller[_0x5550('0x17')]);router[_0x5550('0x5')](_0x5550('0x18'),auth[_0x5550('0x7')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth[_0x5550('0x7')](),controller[_0x5550('0x19')]);router[_0x5550('0x5')](_0x5550('0x1a'),controller[_0x5550('0x1b')]);router[_0x5550('0x5')](_0x5550('0x1c'),auth[_0x5550('0x7')](),controller[_0x5550('0x1d')]);router[_0x5550('0x5')](_0x5550('0x1e'),auth['isAuthenticated'](),controller[_0x5550('0x1f')]);router[_0x5550('0x20')]('/',auth[_0x5550('0x7')](),controller[_0x5550('0x21')]);router[_0x5550('0x20')](_0x5550('0xb'),auth[_0x5550('0x7')](),controller[_0x5550('0x22')]);router[_0x5550('0x20')](_0x5550('0xd'),auth[_0x5550('0x7')](),controller[_0x5550('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a4796,_0x33c9f8,_0x40627c){_0x40627c(null,path[_0x5550('0x24')](config[_0x5550('0x25')],'server/files/images/logos/'));},'filename':function(_0x39b6bc,_0x24ca9f,_0x534670){_0x534670(null,util['format']('%s-%s',Date[_0x5550('0x26')](),_0x24ca9f[_0x5550('0x27')]));}})});router['post'](_0x5550('0x28'),upload[_0x5550('0x29')](_0x5550('0x2a')),controller[_0x5550('0x2b')]);var upload=multer({'storage':multer[_0x5550('0x2c')]({'destination':function(_0xd9eded,_0x8967ed,_0x337d2){_0x337d2(null,path[_0x5550('0x24')](config['root'],_0x5550('0x2d')));},'filename':function(_0x755f4c,_0x1c8776,_0x2ca3e4){_0x2ca3e4(null,util['format'](_0x5550('0x2e'),Date[_0x5550('0x26')](),_0x1c8776[_0x5550('0x27')]));}})});router[_0x5550('0x20')]('/:id/avatar',upload['single'](_0x5550('0x2a')),controller[_0x5550('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2bf3f8,_0x16a909,_0xf23580){_0xf23580(null,path[_0x5550('0x24')](config[_0x5550('0x25')],_0x5550('0x2d')));},'filename':function(_0x291082,_0x3723de,_0x2689e6){_0x2689e6(null,util[_0x5550('0x30')](_0x5550('0x2e'),Date['now'](),_0x3723de[_0x5550('0x27')]));}})});router[_0x5550('0x20')](_0x5550('0x11'),upload[_0x5550('0x29')](_0x5550('0x2a')),controller[_0x5550('0x31')]);var upload=multer({'storage':multer[_0x5550('0x2c')]({'destination':function(_0x1b515e,_0x149673,_0x153dc0){_0x153dc0(null,path['join'](config['root'],_0x5550('0x2d')));},'filename':function(_0x393043,_0xdcc58b,_0x1dd23a){_0x1dd23a(null,util[_0x5550('0x30')]('%s-%s',Date['now'](),_0xdcc58b['originalname']));}})});router[_0x5550('0x20')]('/:id/system_avatar',upload[_0x5550('0x29')]('file'),controller[_0x5550('0x32')]);router[_0x5550('0x20')]('/:id/notify',controller[_0x5550('0x33')]);router['post'](_0x5550('0x34'),controller[_0x5550('0x35')]);router[_0x5550('0x20')](_0x5550('0x14'),auth[_0x5550('0x7')](),controller[_0x5550('0x36')]);router[_0x5550('0x20')](_0x5550('0x18'),auth[_0x5550('0x7')](),controller['addApplications']);router[_0x5550('0x20')](_0x5550('0x37'),auth['isAuthenticated'](),controller['addProactiveActions']);router['post'](_0x5550('0x1e'),auth[_0x5550('0x7')](),controller[_0x5550('0x38')]);router['put'](_0x5550('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5550('0x39')](_0x5550('0x9'),auth[_0x5550('0x7')](),controller[_0x5550('0x3a')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5550('0x3b')]);router[_0x5550('0x39')](_0x5550('0xd'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5550('0x39')](_0x5550('0x1e'),auth[_0x5550('0x7')](),controller[_0x5550('0x3c')]);module[_0x5550('0x3d')]=router; \ No newline at end of file +var _0xff46=['addAvatar','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addProactiveActions','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','single','file','addLogo','join','root','server/files/images/avatars/','now'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xff46,0x164));var _0x6ff4=function(_0x152998,_0x673cc5){_0x152998=_0x152998-0x0;var _0x348f90=_0xff46[_0x152998];return _0x348f90;};'use strict';var multer=require('multer');var util=require(_0x6ff4('0x0'));var path=require(_0x6ff4('0x1'));var timeout=require(_0x6ff4('0x2'));var express=require('express');var router=express[_0x6ff4('0x3')]();var auth=require(_0x6ff4('0x4'));var interaction=require(_0x6ff4('0x5'));var config=require('../../config/environment');var controller=require(_0x6ff4('0x6'));router[_0x6ff4('0x7')]('/',auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x9')]);router['get'](_0x6ff4('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6ff4('0xb'),auth['isAuthenticated'](),controller[_0x6ff4('0xc')]);router['get'](_0x6ff4('0xd'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0xe')]);router[_0x6ff4('0x7')](_0x6ff4('0xf'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x10')]);router[_0x6ff4('0x7')](_0x6ff4('0x11'),controller[_0x6ff4('0x12')]);router[_0x6ff4('0x7')](_0x6ff4('0x13'),controller[_0x6ff4('0x14')]);router['get'](_0x6ff4('0x15'),controller[_0x6ff4('0x16')]);router['get'](_0x6ff4('0x17'),controller['getSystemAvatar']);router[_0x6ff4('0x7')](_0x6ff4('0x18'),auth['isAuthenticated'](),controller[_0x6ff4('0x19')]);router[_0x6ff4('0x7')](_0x6ff4('0x1a'),controller[_0x6ff4('0x1b')]);router[_0x6ff4('0x7')](_0x6ff4('0x1c'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x1d')]);router[_0x6ff4('0x7')](_0x6ff4('0x1e'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x1f')]);router[_0x6ff4('0x7')](_0x6ff4('0x20'),controller[_0x6ff4('0x21')]);router['get'](_0x6ff4('0x22'),auth[_0x6ff4('0x8')](),controller['getOfflineMessages']);router['get'](_0x6ff4('0x23'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x24')]);router[_0x6ff4('0x25')]('/',auth['isAuthenticated'](),controller[_0x6ff4('0x26')]);router[_0x6ff4('0x25')](_0x6ff4('0xd'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x27')]);router[_0x6ff4('0x25')](_0x6ff4('0xf'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x28')]);var upload=multer({'storage':multer[_0x6ff4('0x29')]({'destination':function(_0x28e3db,_0x350982,_0x2f98ed){_0x2f98ed(null,path['join'](config['root'],_0x6ff4('0x2a')));},'filename':function(_0x4429fc,_0x178a4a,_0x26a9f4){_0x26a9f4(null,util[_0x6ff4('0x2b')](_0x6ff4('0x2c'),Date['now'](),_0x178a4a['originalname']));}})});router[_0x6ff4('0x25')](_0x6ff4('0x11'),upload[_0x6ff4('0x2d')](_0x6ff4('0x2e')),controller[_0x6ff4('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58df40,_0x4d3722,_0x36eac8){_0x36eac8(null,path[_0x6ff4('0x30')](config[_0x6ff4('0x31')],_0x6ff4('0x32')));},'filename':function(_0x2a74b2,_0x52b615,_0x180822){_0x180822(null,util['format'](_0x6ff4('0x2c'),Date[_0x6ff4('0x33')](),_0x52b615['originalname']));}})});router['post'](_0x6ff4('0x13'),upload[_0x6ff4('0x2d')](_0x6ff4('0x2e')),controller[_0x6ff4('0x34')]);var upload=multer({'storage':multer[_0x6ff4('0x29')]({'destination':function(_0x18cf6f,_0x2d24b3,_0x479efc){_0x479efc(null,path[_0x6ff4('0x30')](config[_0x6ff4('0x31')],'server/files/images/avatars/'));},'filename':function(_0x57ca35,_0x2a6212,_0x57280d){_0x57280d(null,util[_0x6ff4('0x2b')](_0x6ff4('0x2c'),Date[_0x6ff4('0x33')](),_0x2a6212[_0x6ff4('0x35')]));}})});router[_0x6ff4('0x25')]('/:id/customer_avatar',upload[_0x6ff4('0x2d')](_0x6ff4('0x2e')),controller[_0x6ff4('0x36')]);var upload=multer({'storage':multer[_0x6ff4('0x29')]({'destination':function(_0x3ec3c9,_0x463462,_0x280d7e){_0x280d7e(null,path['join'](config[_0x6ff4('0x31')],_0x6ff4('0x32')));},'filename':function(_0x42ef1a,_0x453217,_0x28b9ca){_0x28b9ca(null,util['format'](_0x6ff4('0x2c'),Date[_0x6ff4('0x33')](),_0x453217[_0x6ff4('0x35')]));}})});router['post']('/:id/system_avatar',upload[_0x6ff4('0x2d')](_0x6ff4('0x2e')),controller[_0x6ff4('0x37')]);router[_0x6ff4('0x25')](_0x6ff4('0x38'),controller[_0x6ff4('0x39')]);router[_0x6ff4('0x25')](_0x6ff4('0x3a'),controller['offline']);router[_0x6ff4('0x25')](_0x6ff4('0x18'),auth['isAuthenticated'](),controller[_0x6ff4('0x3b')]);router[_0x6ff4('0x25')](_0x6ff4('0x1c'),auth[_0x6ff4('0x8')](),controller['addApplications']);router[_0x6ff4('0x25')](_0x6ff4('0x1e'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x3c')]);router['post']('/:id/users',auth[_0x6ff4('0x8')](),controller['addAgents']);router[_0x6ff4('0x3d')](_0x6ff4('0xb'),auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x3e')]);router[_0x6ff4('0x3f')]('/:id',auth[_0x6ff4('0x8')](),controller[_0x6ff4('0x40')]);router[_0x6ff4('0x3f')](_0x6ff4('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x6ff4('0x3f')](_0x6ff4('0xf'),auth['isAuthenticated'](),controller[_0x6ff4('0x41')]);router[_0x6ff4('0x3f')](_0x6ff4('0x23'),auth['isAuthenticated'](),controller[_0x6ff4('0x42')]);module[_0x6ff4('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index cf8d6c0..1bed4f2 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 _0xd634=['Google','exports','STRING'];(function(_0x3c6fb1,_0x16c0c5){var _0x41887c=function(_0x2e8bb9){while(--_0x2e8bb9){_0x3c6fb1['push'](_0x3c6fb1['shift']());}};_0x41887c(++_0x16c0c5);}(_0xd634,0xf4));var _0x4d63=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xd634[_0x58a4fe];return _0x697de2;};'use strict';var Sequelize=require('sequelize');module[_0x4d63('0x0')]={'name':{'type':Sequelize[_0x4d63('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x4d63('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x4d63('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xad40=['sequelize','exports','STRING','ENUM','Google'];(function(_0x3c2f48,_0x39cece){var _0x2da856=function(_0x277f75){while(--_0x277f75){_0x3c2f48['push'](_0x3c2f48['shift']());}};_0x2da856(++_0x39cece);}(_0xad40,0xfa));var _0x0ad4=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xad40[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0ad4('0x0'));module[_0x0ad4('0x1')]={'name':{'type':Sequelize[_0x0ad4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0ad4('0x3')]('AmazonAWS',_0x0ad4('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x0ad4('0x2')]},'data2':{'type':Sequelize[_0x0ad4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 74ae411..cadb93e 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 _0x6637=['../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CloudProvider','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x3cbecc,_0x48a82a){var _0x5c47bd=function(_0x2acce2){while(--_0x2acce2){_0x3cbecc['push'](_0x3cbecc['shift']());}};_0x5c47bd(++_0x48a82a);}(_0x6637,0x168));var _0x7663=function(_0x46fcbf,_0x5fea08){_0x46fcbf=_0x46fcbf-0x0;var _0x4e9734=_0x6637[_0x46fcbf];return _0x4e9734;};'use strict';var pdf=require(_0x7663('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7663('0x1'));var jsonpatch=require(_0x7663('0x2'));var rp=require(_0x7663('0x3'));var moment=require(_0x7663('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7663('0x5'));var util=require(_0x7663('0x6'));var path=require(_0x7663('0x7'));var sox=require(_0x7663('0x8'));var csv=require('to-csv');var ejs=require(_0x7663('0x9'));var fs=require('fs');var _=require(_0x7663('0xa'));var squel=require('squel');var crypto=require(_0x7663('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7663('0xc'));var toCsv=require(_0x7663('0xd'));var querystring=require(_0x7663('0xe'));var Papa=require(_0x7663('0xf'));var Redis=require(_0x7663('0x10'));var authService=require(_0x7663('0x11'));var qs=require(_0x7663('0x12'));var as=require(_0x7663('0x13'));var hardwareService=require(_0x7663('0x14'));var logger=require(_0x7663('0x15'))(_0x7663('0x16'));var utils=require('../../config/utils');var config=require(_0x7663('0x17'));var licenseUtil=require(_0x7663('0x18'));var db=require(_0x7663('0x19'))['db'];function respondWithStatusCode(_0x1d624f,_0x570e57){_0x570e57=_0x570e57||0xcc;return function(_0x3d8a67){if(_0x3d8a67){return _0x1d624f['sendStatus'](_0x570e57);}return _0x1d624f['status'](_0x570e57)[_0x7663('0x1a')]();};}function respondWithResult(_0x3a9b10,_0x28c82b){_0x28c82b=_0x28c82b||0xc8;return function(_0x2c6743){if(_0x2c6743){return _0x3a9b10[_0x7663('0x1b')](_0x28c82b)[_0x7663('0x1c')](_0x2c6743);}};}function respondWithFilteredResult(_0x20bfda,_0x47bb95){return function(_0x114bc7){if(_0x114bc7){var _0x415918=_0x114bc7[_0x7663('0x1d')],_0x813f7c=_0x47bb95[_0x7663('0x1e')],_0x465d14=_0x47bb95[_0x7663('0x1e')]+_0x47bb95['limit'],_0x583885;if(_0x465d14>=_0x415918){_0x465d14=_0x415918;_0x583885=0xc8;}else{_0x583885=0xce;}_0x20bfda[_0x7663('0x1b')](_0x583885);return _0x20bfda[_0x7663('0x1f')](_0x7663('0x20'),_0x813f7c+'-'+_0x465d14+'/'+_0x415918)[_0x7663('0x1c')](_0x114bc7);}return null;};}function patchUpdates(_0x2628f9){return function(_0x2c886c){try{jsonpatch[_0x7663('0x21')](_0x2c886c,_0x2628f9,!![]);}catch(_0x5dd775){return BPromise[_0x7663('0x22')](_0x5dd775);}return _0x2c886c[_0x7663('0x23')]();};}function saveUpdates(_0x18cb4f,_0x15f0dc){return function(_0x1769f5){if(_0x1769f5){return _0x1769f5[_0x7663('0x24')](_0x18cb4f)['then'](function(_0x504bfe){return _0x504bfe;});}return null;};}function removeEntity(_0x338773,_0x5b905f){return function(_0x459618){if(_0x459618){return _0x459618[_0x7663('0x25')]()[_0x7663('0x26')](function(){_0x338773[_0x7663('0x1b')](0xcc)[_0x7663('0x1a')]();});}};}function handleEntityNotFound(_0x4a7952,_0x11aee6){return function(_0x5ca316){if(!_0x5ca316){_0x4a7952[_0x7663('0x27')](0x194);}return _0x5ca316;};}function handleError(_0x5eb509,_0x1dd592){_0x1dd592=_0x1dd592||0x1f4;return function(_0x36b2a5){logger[_0x7663('0x28')](_0x36b2a5[_0x7663('0x29')]);if(_0x36b2a5[_0x7663('0x2a')]){delete _0x36b2a5[_0x7663('0x2a')];}_0x5eb509['status'](_0x1dd592)[_0x7663('0x2b')](_0x36b2a5);};}exports[_0x7663('0x2c')]=function(_0x5d7f08,_0x68d695){var _0xe6941e={},_0x1881c9={},_0x373c13={'count':0x0,'rows':[]};var _0x11db19=_[_0x7663('0x2d')](db[_0x7663('0x2e')]['rawAttributes'],function(_0x20af00){return{'name':_0x20af00['fieldName'],'type':_0x20af00[_0x7663('0x2f')][_0x7663('0x30')]};});_0x1881c9[_0x7663('0x31')]=_[_0x7663('0x2d')](_0x11db19,_0x7663('0x2a'));_0x1881c9[_0x7663('0x32')]=_[_0x7663('0x33')](_0x5d7f08[_0x7663('0x32')]);_0x1881c9[_0x7663('0x34')]=_['intersection'](_0x1881c9[_0x7663('0x31')],_0x1881c9[_0x7663('0x32')]);_0xe6941e[_0x7663('0x35')]=_[_0x7663('0x36')](_0x1881c9[_0x7663('0x31')],qs[_0x7663('0x37')](_0x5d7f08[_0x7663('0x32')][_0x7663('0x37')]));_0xe6941e[_0x7663('0x35')]=_0xe6941e[_0x7663('0x35')]['length']?_0xe6941e[_0x7663('0x35')]:_0x1881c9['model'];if(!_0x5d7f08[_0x7663('0x32')][_0x7663('0x38')](_0x7663('0x39'))){_0xe6941e[_0x7663('0x3a')]=qs[_0x7663('0x3a')](_0x5d7f08[_0x7663('0x32')][_0x7663('0x3a')]);_0xe6941e[_0x7663('0x1e')]=qs[_0x7663('0x1e')](_0x5d7f08['query'][_0x7663('0x1e')]);}_0xe6941e[_0x7663('0x3b')]=qs['sort'](_0x5d7f08['query'][_0x7663('0x3c')]);_0xe6941e['where']=qs['filters'](_['pick'](_0x5d7f08[_0x7663('0x32')],_0x1881c9['filters']),_0x11db19);if(_0x5d7f08[_0x7663('0x32')][_0x7663('0x3d')]){_0xe6941e[_0x7663('0x3e')]=_['merge'](_0xe6941e[_0x7663('0x3e')],{'$or':_[_0x7663('0x2d')](_0x11db19,function(_0x4d4777){if(_0x4d4777[_0x7663('0x2f')]!==_0x7663('0x3f')){var _0x337022={};_0x337022[_0x4d4777[_0x7663('0x2a')]]={'$like':'%'+_0x5d7f08[_0x7663('0x32')]['filter']+'%'};return _0x337022;}})});}_0xe6941e=_[_0x7663('0x40')]({},_0xe6941e,_0x5d7f08[_0x7663('0x41')]);var _0x1af974={'where':_0xe6941e[_0x7663('0x3e')]};return db[_0x7663('0x2e')]['count'](_0x1af974)[_0x7663('0x26')](function(_0x2e5d57){_0x373c13['count']=_0x2e5d57;if(_0x5d7f08[_0x7663('0x32')][_0x7663('0x42')]){_0xe6941e[_0x7663('0x43')]=[{'all':!![]}];}return db[_0x7663('0x2e')][_0x7663('0x44')](_0xe6941e);})[_0x7663('0x26')](function(_0x440fc3){_0x373c13['rows']=_0x440fc3;return _0x373c13;})[_0x7663('0x26')](respondWithFilteredResult(_0x68d695,_0xe6941e))[_0x7663('0x45')](handleError(_0x68d695,null));};exports[_0x7663('0x46')]=function(_0xad0dff,_0x29db8c){var _0x1b2264={'raw':!![],'where':{'id':_0xad0dff[_0x7663('0x47')]['id']}},_0x125b97={};_0x125b97['model']=_[_0x7663('0x33')](db[_0x7663('0x2e')][_0x7663('0x48')]);_0x125b97['query']=_[_0x7663('0x33')](_0xad0dff['query']);_0x125b97[_0x7663('0x34')]=_[_0x7663('0x36')](_0x125b97[_0x7663('0x31')],_0x125b97[_0x7663('0x32')]);_0x1b2264['attributes']=_[_0x7663('0x36')](_0x125b97['model'],qs['fields'](_0xad0dff[_0x7663('0x32')][_0x7663('0x37')]));_0x1b2264['attributes']=_0x1b2264[_0x7663('0x35')][_0x7663('0x49')]?_0x1b2264['attributes']:_0x125b97[_0x7663('0x31')];if(_0xad0dff[_0x7663('0x32')][_0x7663('0x42')]){_0x1b2264['include']=[{'all':!![]}];}_0x1b2264=_[_0x7663('0x40')]({},_0x1b2264,_0xad0dff[_0x7663('0x41')]);return db[_0x7663('0x2e')][_0x7663('0x4a')](_0x1b2264)[_0x7663('0x26')](handleEntityNotFound(_0x29db8c,null))[_0x7663('0x26')](respondWithResult(_0x29db8c,null))[_0x7663('0x45')](handleError(_0x29db8c,null));};exports[_0x7663('0x4b')]=function(_0xcc7b6c,_0x10480e){return db[_0x7663('0x2e')][_0x7663('0x4b')](_0xcc7b6c['body'],{})[_0x7663('0x26')](respondWithResult(_0x10480e,0xc9))[_0x7663('0x45')](handleError(_0x10480e,null));};exports[_0x7663('0x24')]=function(_0x513243,_0xc660e5){if(_0x513243[_0x7663('0x4c')]['id']){delete _0x513243[_0x7663('0x4c')]['id'];}return db[_0x7663('0x2e')]['find']({'where':{'id':_0x513243[_0x7663('0x47')]['id']}})['then'](handleEntityNotFound(_0xc660e5,null))[_0x7663('0x26')](saveUpdates(_0x513243['body'],null))[_0x7663('0x26')](respondWithResult(_0xc660e5,null))['catch'](handleError(_0xc660e5,null));};exports[_0x7663('0x25')]=function(_0x539966,_0x1091f6){return db[_0x7663('0x2e')][_0x7663('0x4a')]({'where':{'id':_0x539966['params']['id']}})[_0x7663('0x26')](handleEntityNotFound(_0x1091f6,null))['then'](removeEntity(_0x1091f6,null))['catch'](handleError(_0x1091f6,null));}; \ No newline at end of file +var _0xe7f4=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','CloudProvider','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x3b243c,_0x5c79aa){var _0x29f290=function(_0x1bd45a){while(--_0x1bd45a){_0x3b243c['push'](_0x3b243c['shift']());}};_0x29f290(++_0x5c79aa);}(_0xe7f4,0x8f));var _0x4e7f=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xe7f4[_0x256b72];return _0x2183e3;};'use strict';var pdf=require(_0x4e7f('0x0'));var emlformat=require(_0x4e7f('0x1'));var rimraf=require(_0x4e7f('0x2'));var zipdir=require(_0x4e7f('0x3'));var jsonpatch=require(_0x4e7f('0x4'));var rp=require(_0x4e7f('0x5'));var moment=require(_0x4e7f('0x6'));var BPromise=require(_0x4e7f('0x7'));var Mustache=require(_0x4e7f('0x8'));var util=require(_0x4e7f('0x9'));var path=require(_0x4e7f('0xa'));var sox=require('sox');var csv=require(_0x4e7f('0xb'));var ejs=require(_0x4e7f('0xc'));var fs=require('fs');var _=require(_0x4e7f('0xd'));var squel=require(_0x4e7f('0xe'));var crypto=require(_0x4e7f('0xf'));var jsforce=require(_0x4e7f('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e7f('0x11'));var Papa=require(_0x4e7f('0x12'));var Redis=require(_0x4e7f('0x13'));var authService=require(_0x4e7f('0x14'));var qs=require(_0x4e7f('0x15'));var as=require(_0x4e7f('0x16'));var hardwareService=require(_0x4e7f('0x17'));var logger=require(_0x4e7f('0x18'))(_0x4e7f('0x19'));var utils=require(_0x4e7f('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e7f('0x1b'))['db'];function respondWithStatusCode(_0x11ee0f,_0x578b40){_0x578b40=_0x578b40||0xcc;return function(_0x50ad01){if(_0x50ad01){return _0x11ee0f[_0x4e7f('0x1c')](_0x578b40);}return _0x11ee0f['status'](_0x578b40)[_0x4e7f('0x1d')]();};}function respondWithResult(_0x27508c,_0x222833){_0x222833=_0x222833||0xc8;return function(_0x32a3a1){if(_0x32a3a1){return _0x27508c[_0x4e7f('0x1e')](_0x222833)[_0x4e7f('0x1f')](_0x32a3a1);}};}function respondWithFilteredResult(_0x14e156,_0x5e7113){return function(_0x558cc4){if(_0x558cc4){var _0x2ce4d8=_0x558cc4[_0x4e7f('0x20')],_0x3f9f53=_0x5e7113[_0x4e7f('0x21')],_0x5dc21d=_0x5e7113[_0x4e7f('0x21')]+_0x5e7113[_0x4e7f('0x22')],_0x2a0b8e;if(_0x5dc21d>=_0x2ce4d8){_0x5dc21d=_0x2ce4d8;_0x2a0b8e=0xc8;}else{_0x2a0b8e=0xce;}_0x14e156[_0x4e7f('0x1e')](_0x2a0b8e);return _0x14e156[_0x4e7f('0x23')]('Content-Range',_0x3f9f53+'-'+_0x5dc21d+'/'+_0x2ce4d8)[_0x4e7f('0x1f')](_0x558cc4);}return null;};}function patchUpdates(_0x45d3af){return function(_0x42830f){try{jsonpatch['apply'](_0x42830f,_0x45d3af,!![]);}catch(_0x4914f4){return BPromise[_0x4e7f('0x24')](_0x4914f4);}return _0x42830f[_0x4e7f('0x25')]();};}function saveUpdates(_0x39b6d1,_0x1c303e){return function(_0x3d0309){if(_0x3d0309){return _0x3d0309['update'](_0x39b6d1)[_0x4e7f('0x26')](function(_0x14be5e){return _0x14be5e;});}return null;};}function removeEntity(_0x1b5789,_0x500315){return function(_0x28ff96){if(_0x28ff96){return _0x28ff96[_0x4e7f('0x27')]()['then'](function(){_0x1b5789['status'](0xcc)[_0x4e7f('0x1d')]();});}};}function handleEntityNotFound(_0x440684,_0x40815c){return function(_0x106344){if(!_0x106344){_0x440684[_0x4e7f('0x1c')](0x194);}return _0x106344;};}function handleError(_0x31ad85,_0x545644){_0x545644=_0x545644||0x1f4;return function(_0x141b33){logger[_0x4e7f('0x28')](_0x141b33[_0x4e7f('0x29')]);if(_0x141b33[_0x4e7f('0x2a')]){delete _0x141b33[_0x4e7f('0x2a')];}_0x31ad85[_0x4e7f('0x1e')](_0x545644)[_0x4e7f('0x2b')](_0x141b33);};}exports[_0x4e7f('0x2c')]=function(_0x5d9c89,_0x27404f){var _0x3bc59e={},_0x261e0c={},_0x5ea46b={'count':0x0,'rows':[]};var _0x3fefbb=_[_0x4e7f('0x2d')](db['CloudProvider'][_0x4e7f('0x2e')],function(_0x23957d){return{'name':_0x23957d[_0x4e7f('0x2f')],'type':_0x23957d[_0x4e7f('0x30')][_0x4e7f('0x31')]};});_0x261e0c[_0x4e7f('0x32')]=_[_0x4e7f('0x2d')](_0x3fefbb,_0x4e7f('0x2a'));_0x261e0c['query']=_[_0x4e7f('0x33')](_0x5d9c89[_0x4e7f('0x34')]);_0x261e0c[_0x4e7f('0x35')]=_[_0x4e7f('0x36')](_0x261e0c[_0x4e7f('0x32')],_0x261e0c[_0x4e7f('0x34')]);_0x3bc59e['attributes']=_['intersection'](_0x261e0c[_0x4e7f('0x32')],qs[_0x4e7f('0x37')](_0x5d9c89[_0x4e7f('0x34')][_0x4e7f('0x37')]));_0x3bc59e[_0x4e7f('0x38')]=_0x3bc59e['attributes']['length']?_0x3bc59e['attributes']:_0x261e0c[_0x4e7f('0x32')];if(!_0x5d9c89[_0x4e7f('0x34')][_0x4e7f('0x39')](_0x4e7f('0x3a'))){_0x3bc59e[_0x4e7f('0x22')]=qs[_0x4e7f('0x22')](_0x5d9c89[_0x4e7f('0x34')][_0x4e7f('0x22')]);_0x3bc59e[_0x4e7f('0x21')]=qs['offset'](_0x5d9c89[_0x4e7f('0x34')][_0x4e7f('0x21')]);}_0x3bc59e[_0x4e7f('0x3b')]=qs[_0x4e7f('0x3c')](_0x5d9c89[_0x4e7f('0x34')]['sort']);_0x3bc59e['where']=qs[_0x4e7f('0x35')](_[_0x4e7f('0x3d')](_0x5d9c89['query'],_0x261e0c[_0x4e7f('0x35')]),_0x3fefbb);if(_0x5d9c89[_0x4e7f('0x34')][_0x4e7f('0x3e')]){_0x3bc59e[_0x4e7f('0x3f')]=_['merge'](_0x3bc59e['where'],{'$or':_[_0x4e7f('0x2d')](_0x3fefbb,function(_0x40a942){if(_0x40a942[_0x4e7f('0x30')]!==_0x4e7f('0x40')){var _0x1f1dcf={};_0x1f1dcf[_0x40a942['name']]={'$like':'%'+_0x5d9c89['query'][_0x4e7f('0x3e')]+'%'};return _0x1f1dcf;}})});}_0x3bc59e=_[_0x4e7f('0x41')]({},_0x3bc59e,_0x5d9c89[_0x4e7f('0x42')]);var _0x32e5e3={'where':_0x3bc59e[_0x4e7f('0x3f')]};return db[_0x4e7f('0x43')][_0x4e7f('0x20')](_0x32e5e3)[_0x4e7f('0x26')](function(_0x1df49d){_0x5ea46b['count']=_0x1df49d;if(_0x5d9c89['query'][_0x4e7f('0x44')]){_0x3bc59e[_0x4e7f('0x45')]=[{'all':!![]}];}return db[_0x4e7f('0x43')][_0x4e7f('0x46')](_0x3bc59e);})[_0x4e7f('0x26')](function(_0x10d45b){_0x5ea46b[_0x4e7f('0x47')]=_0x10d45b;return _0x5ea46b;})[_0x4e7f('0x26')](respondWithFilteredResult(_0x27404f,_0x3bc59e))[_0x4e7f('0x48')](handleError(_0x27404f,null));};exports[_0x4e7f('0x49')]=function(_0x3ce72d,_0x57c9cd){var _0xe57d7={'raw':!![],'where':{'id':_0x3ce72d[_0x4e7f('0x4a')]['id']}},_0x34dde1={};_0x34dde1[_0x4e7f('0x32')]=_[_0x4e7f('0x33')](db[_0x4e7f('0x43')][_0x4e7f('0x2e')]);_0x34dde1['query']=_['keys'](_0x3ce72d[_0x4e7f('0x34')]);_0x34dde1[_0x4e7f('0x35')]=_[_0x4e7f('0x36')](_0x34dde1['model'],_0x34dde1[_0x4e7f('0x34')]);_0xe57d7[_0x4e7f('0x38')]=_[_0x4e7f('0x36')](_0x34dde1[_0x4e7f('0x32')],qs[_0x4e7f('0x37')](_0x3ce72d[_0x4e7f('0x34')][_0x4e7f('0x37')]));_0xe57d7[_0x4e7f('0x38')]=_0xe57d7[_0x4e7f('0x38')]['length']?_0xe57d7[_0x4e7f('0x38')]:_0x34dde1[_0x4e7f('0x32')];if(_0x3ce72d[_0x4e7f('0x34')][_0x4e7f('0x44')]){_0xe57d7['include']=[{'all':!![]}];}_0xe57d7=_['merge']({},_0xe57d7,_0x3ce72d['options']);return db[_0x4e7f('0x43')][_0x4e7f('0x4b')](_0xe57d7)['then'](handleEntityNotFound(_0x57c9cd,null))[_0x4e7f('0x26')](respondWithResult(_0x57c9cd,null))['catch'](handleError(_0x57c9cd,null));};exports[_0x4e7f('0x4c')]=function(_0xb2a62c,_0x3883fc){return db[_0x4e7f('0x43')][_0x4e7f('0x4c')](_0xb2a62c[_0x4e7f('0x4d')],{})[_0x4e7f('0x26')](respondWithResult(_0x3883fc,0xc9))[_0x4e7f('0x48')](handleError(_0x3883fc,null));};exports[_0x4e7f('0x4e')]=function(_0x184c48,_0x29e472){if(_0x184c48[_0x4e7f('0x4d')]['id']){delete _0x184c48['body']['id'];}return db[_0x4e7f('0x43')]['find']({'where':{'id':_0x184c48[_0x4e7f('0x4a')]['id']}})[_0x4e7f('0x26')](handleEntityNotFound(_0x29e472,null))[_0x4e7f('0x26')](saveUpdates(_0x184c48[_0x4e7f('0x4d')],null))[_0x4e7f('0x26')](respondWithResult(_0x29e472,null))['catch'](handleError(_0x29e472,null));};exports[_0x4e7f('0x27')]=function(_0x1ef97a,_0x44f1f0){return db['CloudProvider']['find']({'where':{'id':_0x1ef97a[_0x4e7f('0x4a')]['id']}})[_0x4e7f('0x26')](handleEntityNotFound(_0x44f1f0,null))[_0x4e7f('0x26')](removeEntity(_0x44f1f0,null))[_0x4e7f('0x48')](handleError(_0x44f1f0,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b2a5d6a..fb3cc04 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 _0xf462=['exports','define','cloud_providers','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3c53f8,_0x1c5ffa){var _0x2a993e=function(_0x2d031c){while(--_0x2d031c){_0x3c53f8['push'](_0x3c53f8['shift']());}};_0x2a993e(++_0x1c5ffa);}(_0xf462,0x1bb));var _0x2f46=function(_0x4d521e,_0x58ba39){_0x4d521e=_0x4d521e-0x0;var _0x3beb42=_0xf462[_0x4d521e];return _0x3beb42;};'use strict';var _=require('lodash');var util=require(_0x2f46('0x0'));var logger=require(_0x2f46('0x1'))(_0x2f46('0x2'));var moment=require(_0x2f46('0x3'));var BPromise=require(_0x2f46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f46('0x5'));var rimraf=require(_0x2f46('0x6'));var config=require(_0x2f46('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x2f46('0x8')]=function(_0x52ab1e,_0x3322e6){return _0x52ab1e[_0x2f46('0x9')]('CloudProvider',attributes,{'tableName':_0x2f46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc380=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','CloudProvider','cloud_providers'];(function(_0x421de0,_0x2b9f94){var _0x2c31e3=function(_0x3b1b76){while(--_0x3b1b76){_0x421de0['push'](_0x421de0['shift']());}};_0x2c31e3(++_0x2b9f94);}(_0xc380,0x1a4));var _0x0c38=function(_0x512255,_0x480c0c){_0x512255=_0x512255-0x0;var _0x3f4581=_0xc380[_0x512255];return _0x3f4581;};'use strict';var _=require('lodash');var util=require(_0x0c38('0x0'));var logger=require(_0x0c38('0x1'))('api');var moment=require(_0x0c38('0x2'));var BPromise=require(_0x0c38('0x3'));var rp=require(_0x0c38('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c38('0x5'));var config=require(_0x0c38('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x412345,_0x171088){return _0x412345[_0x0c38('0x7')](_0x0c38('0x8'),attributes,{'tableName':_0x0c38('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 9912499..41fbb58 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 _0xb5cf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0xb5cf,0x125));var _0xfb5c=function(_0xab1a11,_0x395256){_0xab1a11=_0xab1a11-0x0;var _0x2a5d76=_0xb5cf[_0xab1a11];return _0x2a5d76;};'use strict';var _=require(_0xfb5c('0x0'));var util=require('util');var moment=require(_0xfb5c('0x1'));var BPromise=require(_0xfb5c('0x2'));var rs=require(_0xfb5c('0x3'));var fs=require('fs');var Redis=require(_0xfb5c('0x4'));var db=require(_0xfb5c('0x5'))['db'];var utils=require(_0xfb5c('0x6'));var logger=require(_0xfb5c('0x7'))(_0xfb5c('0x8'));var config=require(_0xfb5c('0x9'));var jayson=require(_0xfb5c('0xa'));var client=jayson[_0xfb5c('0xb')][_0xfb5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x110c60,_0x10d64d,_0x46738a){return new BPromise(function(_0x516b57,_0x5b02f5){return client[_0xfb5c('0xd')](_0x110c60,_0x46738a)[_0xfb5c('0xe')](function(_0x135f7a){logger['info']('CloudProvider,\x20%s,\x20%s',_0x10d64d,'request\x20sent');logger[_0xfb5c('0xf')](_0xfb5c('0x10'),_0x10d64d,_0xfb5c('0x11'),JSON[_0xfb5c('0x12')](_0x135f7a));if(_0x135f7a[_0xfb5c('0x13')]){if(_0x135f7a[_0xfb5c('0x13')][_0xfb5c('0x14')]===0x1f4){logger[_0xfb5c('0x13')](_0xfb5c('0x15'),_0x10d64d,_0x135f7a[_0xfb5c('0x13')]['message']);return _0x5b02f5(_0x135f7a['error'][_0xfb5c('0x16')]);}logger['error'](_0xfb5c('0x15'),_0x10d64d,_0x135f7a[_0xfb5c('0x13')][_0xfb5c('0x16')]);return _0x516b57(_0x135f7a[_0xfb5c('0x13')]['message']);}else{logger['info'](_0xfb5c('0x15'),_0x10d64d,_0xfb5c('0x11'));_0x516b57(_0x135f7a[_0xfb5c('0x17')][_0xfb5c('0x16')]);}})[_0xfb5c('0x18')](function(_0x4e31e0){logger[_0xfb5c('0x13')]('CloudProvider,\x20%s,\x20%s',_0x10d64d,_0x4e31e0);_0x5b02f5(_0x4e31e0);});});} \ No newline at end of file +var _0x056f=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0xa91599,_0x26db76){var _0x4f8a6d=function(_0x1c9558){while(--_0x1c9558){_0xa91599['push'](_0xa91599['shift']());}};_0x4f8a6d(++_0x26db76);}(_0x056f,0xa7));var _0xf056=function(_0x5d88fe,_0x93fb11){_0x5d88fe=_0x5d88fe-0x0;var _0x2cd486=_0x056f[_0x5d88fe];return _0x2cd486;};'use strict';var _=require(_0xf056('0x0'));var util=require(_0xf056('0x1'));var moment=require(_0xf056('0x2'));var BPromise=require(_0xf056('0x3'));var rs=require(_0xf056('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf056('0x5'))['db'];var utils=require(_0xf056('0x6'));var logger=require(_0xf056('0x7'))(_0xf056('0x8'));var config=require(_0xf056('0x9'));var jayson=require(_0xf056('0xa'));var client=jayson[_0xf056('0xb')][_0xf056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56ec96,_0x334217,_0x4f2a03){return new BPromise(function(_0x1415d4,_0x6c1398){return client['request'](_0x56ec96,_0x4f2a03)[_0xf056('0xd')](function(_0x1b0279){logger[_0xf056('0xe')](_0xf056('0xf'),_0x334217,_0xf056('0x10'));logger[_0xf056('0x11')](_0xf056('0x12'),_0x334217,_0xf056('0x10'),JSON[_0xf056('0x13')](_0x1b0279));if(_0x1b0279['error']){if(_0x1b0279['error']['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x334217,_0x1b0279[_0xf056('0x14')][_0xf056('0x15')]);return _0x6c1398(_0x1b0279[_0xf056('0x14')][_0xf056('0x15')]);}logger[_0xf056('0x14')](_0xf056('0xf'),_0x334217,_0x1b0279['error'][_0xf056('0x15')]);return _0x1415d4(_0x1b0279['error'][_0xf056('0x15')]);}else{logger[_0xf056('0xe')](_0xf056('0xf'),_0x334217,_0xf056('0x10'));_0x1415d4(_0x1b0279['result'][_0xf056('0x15')]);}})[_0xf056('0x16')](function(_0x5ecb1e){logger[_0xf056('0x14')](_0xf056('0xf'),_0x334217,_0x5ecb1e);_0x6c1398(_0x5ecb1e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7447100..c1ad4cb 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 _0x86c7=['express','Router','./cloudProvider.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1a494f,_0x5ef7a8){var _0x136037=function(_0x12d89f){while(--_0x12d89f){_0x1a494f['push'](_0x1a494f['shift']());}};_0x136037(++_0x5ef7a8);}(_0x86c7,0x176));var _0x786c=function(_0x5154bb,_0x496c1a){_0x5154bb=_0x5154bb-0x0;var _0x1562e8=_0x86c7[_0x5154bb];return _0x1562e8;};'use strict';var multer=require(_0x786c('0x0'));var util=require(_0x786c('0x1'));var path=require(_0x786c('0x2'));var timeout=require(_0x786c('0x3'));var express=require(_0x786c('0x4'));var router=express[_0x786c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x786c('0x6'));router[_0x786c('0x7')]('/',auth[_0x786c('0x8')](),controller[_0x786c('0x9')]);router[_0x786c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x786c('0xa')]);router[_0x786c('0xb')]('/',auth[_0x786c('0x8')](),controller['create']);router[_0x786c('0xc')](_0x786c('0xd'),auth[_0x786c('0x8')](),controller[_0x786c('0xe')]);router[_0x786c('0xf')]('/:id',auth[_0x786c('0x8')](),controller[_0x786c('0x10')]);module[_0x786c('0x11')]=router; \ No newline at end of file +var _0x71be=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','show','post','put','/:id','update','delete','multer','util','path'];(function(_0x3c08ea,_0x419b25){var _0x4b6e51=function(_0x4e53b3){while(--_0x4e53b3){_0x3c08ea['push'](_0x3c08ea['shift']());}};_0x4b6e51(++_0x419b25);}(_0x71be,0x18d));var _0xe71b=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x71be[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0xe71b('0x0'));var util=require(_0xe71b('0x1'));var path=require(_0xe71b('0x2'));var timeout=require(_0xe71b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe71b('0x4'));var interaction=require(_0xe71b('0x5'));var config=require(_0xe71b('0x6'));var controller=require(_0xe71b('0x7'));router[_0xe71b('0x8')]('/',auth[_0xe71b('0x9')](),controller['index']);router[_0xe71b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe71b('0xa')]);router[_0xe71b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe71b('0xc')](_0xe71b('0xd'),auth['isAuthenticated'](),controller[_0xe71b('0xe')]);router[_0xe71b('0xf')]('/:id',auth['isAuthenticated'](),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 454e822..a3294d7 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 _0x8628=['name','STRING','sequelize','exports'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x8628,0x1ee));var _0x8862=function(_0x558bab,_0x43a6e4){_0x558bab=_0x558bab-0x0;var _0x67c207=_0x8628[_0x558bab];return _0x67c207;};'use strict';var Sequelize=require(_0x8862('0x0'));module[_0x8862('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8862('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8862('0x3')]},'companyId':{'type':Sequelize[_0x8862('0x3')]},'website':{'type':Sequelize[_0x8862('0x3')]},'phone':{'type':Sequelize[_0x8862('0x3')]},'fax':{'type':Sequelize[_0x8862('0x3')]},'type':{'type':Sequelize[_0x8862('0x3')]},'street':{'type':Sequelize[_0x8862('0x3')]},'postalCode':{'type':Sequelize[_0x8862('0x3')]},'city':{'type':Sequelize[_0x8862('0x3')]},'country':{'type':Sequelize[_0x8862('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8862('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8862('0x3')]},'description':{'type':Sequelize[_0x8862('0x3')]}}; \ No newline at end of file +var _0x9dc7=['sequelize','STRING'];(function(_0x220971,_0x25101c){var _0x16deb7=function(_0x47a77c){while(--_0x47a77c){_0x220971['push'](_0x220971['shift']());}};_0x16deb7(++_0x25101c);}(_0x9dc7,0x16a));var _0x79dc=function(_0x2eca9b,_0x96de91){_0x2eca9b=_0x2eca9b-0x0;var _0x3926d2=_0x9dc7[_0x2eca9b];return _0x3926d2;};'use strict';var Sequelize=require(_0x79dc('0x0'));module['exports']={'name':{'type':Sequelize[_0x79dc('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x79dc('0x1')]},'phone':{'type':Sequelize[_0x79dc('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x79dc('0x1')]},'city':{'type':Sequelize[_0x79dc('0x1')]},'country':{'type':Sequelize[_0x79dc('0x1')]},'email':{'type':Sequelize[_0x79dc('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x79dc('0x1')]},'sStreet':{'type':Sequelize[_0x79dc('0x1')]},'sPostalCode':{'type':Sequelize[_0x79dc('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x79dc('0x1')]},'description':{'type':Sequelize[_0x79dc('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b94c968..3c70d51 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 _0x6858=['fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','describe','addContacts','CmContact','ids','omit','findOne','rawAttributes','pick','map','getContacts','nolimit','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','get','Companies','UserProfileResource','stack','name','send','CmCompany','model','keys','query','intersection'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x6858,0x198));var _0x8685=function(_0x59569f,_0x12976d){_0x59569f=_0x59569f-0x0;var _0x593305=_0x6858[_0x59569f];return _0x593305;};'use strict';var pdf=require(_0x8685('0x0'));var emlformat=require(_0x8685('0x1'));var rimraf=require(_0x8685('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8685('0x3'));var rp=require(_0x8685('0x4'));var moment=require(_0x8685('0x5'));var BPromise=require(_0x8685('0x6'));var Mustache=require(_0x8685('0x7'));var util=require(_0x8685('0x8'));var path=require(_0x8685('0x9'));var sox=require(_0x8685('0xa'));var csv=require(_0x8685('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8685('0xc'));var squel=require(_0x8685('0xd'));var crypto=require(_0x8685('0xe'));var jsforce=require(_0x8685('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8685('0xb'));var querystring=require(_0x8685('0x10'));var Papa=require(_0x8685('0x11'));var Redis=require(_0x8685('0x12'));var authService=require(_0x8685('0x13'));var qs=require(_0x8685('0x14'));var as=require(_0x8685('0x15'));var hardwareService=require(_0x8685('0x16'));var logger=require(_0x8685('0x17'))('api');var utils=require(_0x8685('0x18'));var config=require(_0x8685('0x19'));var licenseUtil=require(_0x8685('0x1a'));var db=require(_0x8685('0x1b'))['db'];function respondWithStatusCode(_0x27bc20,_0x278a5c){_0x278a5c=_0x278a5c||0xcc;return function(_0x2897e1){if(_0x2897e1){return _0x27bc20[_0x8685('0x1c')](_0x278a5c);}return _0x27bc20[_0x8685('0x1d')](_0x278a5c)[_0x8685('0x1e')]();};}function respondWithResult(_0xe35e39,_0x161de5){_0x161de5=_0x161de5||0xc8;return function(_0x37a57d){if(_0x37a57d){return _0xe35e39[_0x8685('0x1d')](_0x161de5)['json'](_0x37a57d);}};}function respondWithFilteredResult(_0x14f912,_0x17610d){return function(_0x1fcac5){if(_0x1fcac5){var _0x7611b8=_0x1fcac5[_0x8685('0x1f')],_0x5184c6=_0x17610d[_0x8685('0x20')],_0x492d0c=_0x17610d[_0x8685('0x20')]+_0x17610d[_0x8685('0x21')],_0x90d648;if(_0x492d0c>=_0x7611b8){_0x492d0c=_0x7611b8;_0x90d648=0xc8;}else{_0x90d648=0xce;}_0x14f912['status'](_0x90d648);return _0x14f912[_0x8685('0x22')](_0x8685('0x23'),_0x5184c6+'-'+_0x492d0c+'/'+_0x7611b8)[_0x8685('0x24')](_0x1fcac5);}return null;};}function patchUpdates(_0x364418){return function(_0x2e527d){try{jsonpatch['apply'](_0x2e527d,_0x364418,!![]);}catch(_0x5f2a0f){return BPromise[_0x8685('0x25')](_0x5f2a0f);}return _0x2e527d[_0x8685('0x26')]();};}function saveUpdates(_0xfac0ef,_0x149739){return function(_0x53ab82){if(_0x53ab82){return _0x53ab82['update'](_0xfac0ef)[_0x8685('0x27')](function(_0x46e571){return _0x46e571;});}return null;};}function removeEntity(_0x19e28f,_0xb68e55){return function(_0xb7f731){if(_0xb7f731){return _0xb7f731[_0x8685('0x28')]()[_0x8685('0x27')](function(){var _0x2e851d=_0xb7f731[_0x8685('0x29')]({'plain':!![]});var _0x54e120=_0x8685('0x2a');return db[_0x8685('0x2b')][_0x8685('0x28')]({'where':{'type':_0x54e120,'resourceId':_0x2e851d['id']}})[_0x8685('0x27')](function(){return _0xb7f731;});})[_0x8685('0x27')](function(){_0x19e28f[_0x8685('0x1d')](0xcc)[_0x8685('0x1e')]();});}};}function handleEntityNotFound(_0x14d595,_0x187d12){return function(_0x513102){if(!_0x513102){_0x14d595[_0x8685('0x1c')](0x194);}return _0x513102;};}function handleError(_0xc0ac26,_0x207966){_0x207966=_0x207966||0x1f4;return function(_0x1932ee){logger['error'](_0x1932ee[_0x8685('0x2c')]);if(_0x1932ee[_0x8685('0x2d')]){delete _0x1932ee[_0x8685('0x2d')];}_0xc0ac26[_0x8685('0x1d')](_0x207966)[_0x8685('0x2e')](_0x1932ee);};}exports['index']=function(_0x3f0425,_0x34c773){var _0x493b7c={},_0x53e5a1={},_0x17dc2d={'count':0x0,'rows':[]};return db[_0x8685('0x2f')]['describe']()[_0x8685('0x27')](function(_0x16803b){_0x53e5a1[_0x8685('0x30')]=_[_0x8685('0x31')](_0x16803b);_0x53e5a1[_0x8685('0x32')]=_[_0x8685('0x31')](_0x3f0425['query']);_0x53e5a1['filters']=_[_0x8685('0x33')](_0x53e5a1['model'],_0x53e5a1[_0x8685('0x32')]);_0x493b7c['attributes']=_[_0x8685('0x33')](_0x53e5a1[_0x8685('0x30')],qs[_0x8685('0x34')](_0x3f0425[_0x8685('0x32')][_0x8685('0x34')]));_0x493b7c[_0x8685('0x35')]=_0x493b7c[_0x8685('0x35')][_0x8685('0x36')]?_0x493b7c[_0x8685('0x35')]:_0x53e5a1[_0x8685('0x30')];if(!_0x3f0425[_0x8685('0x32')][_0x8685('0x37')]('nolimit')){_0x493b7c[_0x8685('0x21')]=qs[_0x8685('0x21')](_0x3f0425[_0x8685('0x32')][_0x8685('0x21')]);_0x493b7c['offset']=qs[_0x8685('0x20')](_0x3f0425[_0x8685('0x32')]['offset']);}_0x493b7c[_0x8685('0x38')]=qs[_0x8685('0x39')](_0x3f0425[_0x8685('0x32')][_0x8685('0x39')]);_0x493b7c[_0x8685('0x3a')]=qs[_0x8685('0x3b')](_['pick'](_0x3f0425[_0x8685('0x32')],_0x53e5a1['filters']),_0x16803b);if(_0x3f0425[_0x8685('0x32')][_0x8685('0x3c')]){_0x493b7c[_0x8685('0x3a')]=_[_0x8685('0x3d')](_0x493b7c[_0x8685('0x3a')],{'$or':_['map'](_0x493b7c[_0x8685('0x35')],function(_0x917ac3){var _0x478db8={};_0x478db8[_0x917ac3]={'$like':'%'+_0x3f0425['query'][_0x8685('0x3c')]+'%'};return _0x478db8;})});}_0x493b7c=_['merge']({},_0x493b7c,_0x3f0425[_0x8685('0x3e')]);var _0x1bedec={'where':_0x493b7c[_0x8685('0x3a')]};return db['CmCompany'][_0x8685('0x1f')](_0x1bedec)[_0x8685('0x27')](function(_0x15aaa8){_0x17dc2d['count']=_0x15aaa8;if(_0x3f0425['query'][_0x8685('0x3f')]){_0x493b7c[_0x8685('0x40')]=[{'all':!![]}];}return db['CmCompany'][_0x8685('0x41')](_0x493b7c);})[_0x8685('0x27')](function(_0x5799fa){_0x17dc2d[_0x8685('0x42')]=_0x5799fa;return _0x17dc2d;})[_0x8685('0x27')](respondWithFilteredResult(_0x34c773,_0x493b7c))[_0x8685('0x43')](handleError(_0x34c773,null));})['catch'](handleError(_0x34c773,null));};exports[_0x8685('0x44')]=function(_0x52b7ae,_0x4ef42d){var _0x4a91ca={'raw':![],'where':{'id':_0x52b7ae[_0x8685('0x45')]['id']}},_0x36b497={};_0x36b497['model']=_['keys'](db[_0x8685('0x2f')]['rawAttributes']);_0x36b497[_0x8685('0x32')]=_[_0x8685('0x31')](_0x52b7ae[_0x8685('0x32')]);_0x36b497['filters']=_[_0x8685('0x33')](_0x36b497['model'],_0x36b497['query']);_0x4a91ca['attributes']=_['intersection'](_0x36b497[_0x8685('0x30')],qs['fields'](_0x52b7ae[_0x8685('0x32')][_0x8685('0x34')]));_0x4a91ca[_0x8685('0x35')]=_0x4a91ca[_0x8685('0x35')][_0x8685('0x36')]?_0x4a91ca['attributes']:_0x36b497['model'];if(_0x52b7ae[_0x8685('0x32')][_0x8685('0x3f')]){_0x4a91ca['include']=[{'all':!![]}];}_0x4a91ca=_[_0x8685('0x3d')]({},_0x4a91ca,_0x52b7ae['options']);return db[_0x8685('0x2f')][_0x8685('0x46')](_0x4a91ca)['then'](handleEntityNotFound(_0x4ef42d,null))[_0x8685('0x27')](respondWithResult(_0x4ef42d,null))[_0x8685('0x43')](handleError(_0x4ef42d,null));};exports[_0x8685('0x47')]=function(_0x561175,_0x2e7b5c){return db[_0x8685('0x2f')]['create'](_0x561175[_0x8685('0x48')],{})[_0x8685('0x27')](function(_0x11e3d0){var _0x55947f=_0x561175[_0x8685('0x49')][_0x8685('0x29')]({'plain':!![]});if(!_0x55947f)throw new Error(_0x8685('0x4a'));if(_0x55947f[_0x8685('0x4b')]===_0x8685('0x49')){var _0x2ea821=_0x11e3d0[_0x8685('0x29')]({'plain':!![]});var _0x19e0bc=_0x8685('0x2a');return db[_0x8685('0x4c')][_0x8685('0x46')]({'where':{'name':_0x19e0bc,'userProfileId':_0x55947f[_0x8685('0x4d')]},'raw':!![]})[_0x8685('0x27')](function(_0x4ff636){if(_0x4ff636&&_0x4ff636[_0x8685('0x4e')]===0x0){return db[_0x8685('0x2b')]['create']({'name':_0x2ea821[_0x8685('0x2d')],'resourceId':_0x2ea821['id'],'type':_0x4ff636[_0x8685('0x2d')],'sectionId':_0x4ff636['id']},{})[_0x8685('0x27')](function(){return _0x11e3d0;});}else{return _0x11e3d0;}})[_0x8685('0x43')](function(_0x2a020b){logger[_0x8685('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a020b);throw _0x2a020b;});}return _0x11e3d0;})[_0x8685('0x27')](respondWithResult(_0x2e7b5c,0xc9))['catch'](handleError(_0x2e7b5c,null));};exports[_0x8685('0x50')]=function(_0x46cb33,_0x5c08c3){if(_0x46cb33[_0x8685('0x48')]['id']){delete _0x46cb33['body']['id'];}return db[_0x8685('0x2f')][_0x8685('0x46')]({'where':{'id':_0x46cb33[_0x8685('0x45')]['id']}})[_0x8685('0x27')](handleEntityNotFound(_0x5c08c3,null))['then'](saveUpdates(_0x46cb33[_0x8685('0x48')],null))[_0x8685('0x27')](respondWithResult(_0x5c08c3,null))[_0x8685('0x43')](handleError(_0x5c08c3,null));};exports[_0x8685('0x28')]=function(_0x582f64,_0xef5d7f){return db['CmCompany'][_0x8685('0x46')]({'where':{'id':_0x582f64[_0x8685('0x45')]['id']}})[_0x8685('0x27')](handleEntityNotFound(_0xef5d7f,null))[_0x8685('0x27')](removeEntity(_0xef5d7f,null))[_0x8685('0x43')](handleError(_0xef5d7f,null));};exports[_0x8685('0x51')]=function(_0x2f5697,_0xa06912){return db[_0x8685('0x2f')]['describe']()[_0x8685('0x27')](respondWithResult(_0xa06912,null))[_0x8685('0x43')](handleError(_0xa06912,null));};exports[_0x8685('0x52')]=function(_0x27f819,_0x4cbe99,_0x320c18){return db[_0x8685('0x53')]['find']({'where':{'id':_0x27f819[_0x8685('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cbe99,null))['then'](function(_0x5e54cd){if(_0x5e54cd){return _0x5e54cd['addContacts'](_0x27f819[_0x8685('0x48')][_0x8685('0x54')],_[_0x8685('0x55')](_0x27f819['body'],[_0x8685('0x54'),'id'])||{});}})[_0x8685('0x27')](respondWithResult(_0x4cbe99,null))['catch'](handleError(_0x4cbe99,null));};exports['getContacts']=function(_0x17304a,_0x22ff26,_0x1c8b42){var _0x5178d0={};var _0x57142d={};var _0x523861;var _0x3e281c;return db[_0x8685('0x2f')][_0x8685('0x56')]({'where':{'id':_0x17304a[_0x8685('0x45')]['id']}})[_0x8685('0x27')](handleEntityNotFound(_0x22ff26,null))[_0x8685('0x27')](function(_0x3834c7){if(_0x3834c7){_0x523861=_0x3834c7;_0x57142d[_0x8685('0x30')]=_['keys'](db['CmContact'][_0x8685('0x57')]);_0x57142d[_0x8685('0x32')]=_[_0x8685('0x31')](_0x17304a[_0x8685('0x32')]);_0x57142d[_0x8685('0x3b')]=_[_0x8685('0x33')](_0x57142d[_0x8685('0x30')],_0x57142d[_0x8685('0x32')]);_0x5178d0[_0x8685('0x35')]=_[_0x8685('0x33')](_0x57142d[_0x8685('0x30')],qs[_0x8685('0x34')](_0x17304a[_0x8685('0x32')][_0x8685('0x34')]));_0x5178d0[_0x8685('0x35')]=_0x5178d0[_0x8685('0x35')][_0x8685('0x36')]?_0x5178d0[_0x8685('0x35')]:_0x57142d[_0x8685('0x30')];_0x5178d0['order']=qs['sort'](_0x17304a[_0x8685('0x32')][_0x8685('0x39')]);_0x5178d0['where']=qs[_0x8685('0x3b')](_[_0x8685('0x58')](_0x17304a[_0x8685('0x32')],_0x57142d[_0x8685('0x3b')]));if(_0x17304a[_0x8685('0x32')][_0x8685('0x3c')]){_0x5178d0[_0x8685('0x3a')]=_[_0x8685('0x3d')](_0x5178d0['where'],{'$or':_[_0x8685('0x59')](_0x5178d0[_0x8685('0x35')],function(_0x178c2a){var _0x34683b={};_0x34683b[_0x178c2a]={'$like':'%'+_0x17304a['query']['filter']+'%'};return _0x34683b;})});}_0x5178d0=_[_0x8685('0x3d')]({},_0x5178d0,_0x17304a[_0x8685('0x3e')]);return _0x523861[_0x8685('0x5a')](_0x5178d0);}})[_0x8685('0x27')](function(_0x523929){if(_0x523929){_0x3e281c=_0x523929['length'];if(!_0x17304a[_0x8685('0x32')]['hasOwnProperty'](_0x8685('0x5b'))){_0x5178d0[_0x8685('0x21')]=qs['limit'](_0x17304a['query']['limit']);_0x5178d0[_0x8685('0x20')]=qs[_0x8685('0x20')](_0x17304a[_0x8685('0x32')][_0x8685('0x20')]);}return _0x523861[_0x8685('0x5a')](_0x5178d0);}})[_0x8685('0x27')](function(_0x329bd5){if(_0x329bd5){return _0x329bd5?{'count':_0x3e281c,'rows':_0x329bd5}:null;}})['then'](respondWithResult(_0x22ff26,null))[_0x8685('0x43')](handleError(_0x22ff26,null));}; \ No newline at end of file +var _0xe136=['end','offset','limit','set','Content-Range','json','apply','save','destroy','then','get','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','body','addContacts','CmContact','omit','ids','getContacts','findOne','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x6c77b1,_0x4399eb){var _0x1cee86=function(_0xf4f50){while(--_0xf4f50){_0x6c77b1['push'](_0x6c77b1['shift']());}};_0x1cee86(++_0x4399eb);}(_0xe136,0xee));var _0x6e13=function(_0xb13f3a,_0x541d21){_0xb13f3a=_0xb13f3a-0x0;var _0x43a918=_0xe136[_0xb13f3a];return _0x43a918;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e13('0x0'));var rimraf=require(_0x6e13('0x1'));var zipdir=require(_0x6e13('0x2'));var jsonpatch=require(_0x6e13('0x3'));var rp=require(_0x6e13('0x4'));var moment=require(_0x6e13('0x5'));var BPromise=require(_0x6e13('0x6'));var Mustache=require(_0x6e13('0x7'));var util=require(_0x6e13('0x8'));var path=require(_0x6e13('0x9'));var sox=require('sox');var csv=require(_0x6e13('0xa'));var ejs=require(_0x6e13('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6e13('0xc'));var crypto=require(_0x6e13('0xd'));var jsforce=require(_0x6e13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6e13('0xa'));var querystring=require(_0x6e13('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e13('0x10'));var authService=require(_0x6e13('0x11'));var qs=require(_0x6e13('0x12'));var as=require(_0x6e13('0x13'));var hardwareService=require(_0x6e13('0x14'));var logger=require(_0x6e13('0x15'))(_0x6e13('0x16'));var utils=require(_0x6e13('0x17'));var config=require(_0x6e13('0x18'));var licenseUtil=require(_0x6e13('0x19'));var db=require(_0x6e13('0x1a'))['db'];function respondWithStatusCode(_0x4985a8,_0x1b1f12){_0x1b1f12=_0x1b1f12||0xcc;return function(_0x37d218){if(_0x37d218){return _0x4985a8[_0x6e13('0x1b')](_0x1b1f12);}return _0x4985a8[_0x6e13('0x1c')](_0x1b1f12)[_0x6e13('0x1d')]();};}function respondWithResult(_0x8563f1,_0x7a3fab){_0x7a3fab=_0x7a3fab||0xc8;return function(_0x293bd8){if(_0x293bd8){return _0x8563f1[_0x6e13('0x1c')](_0x7a3fab)['json'](_0x293bd8);}};}function respondWithFilteredResult(_0x5aa026,_0x499fd7){return function(_0x96e191){if(_0x96e191){var _0x10d2f7=_0x96e191['count'],_0xf339a0=_0x499fd7['offset'],_0x493660=_0x499fd7[_0x6e13('0x1e')]+_0x499fd7[_0x6e13('0x1f')],_0x49546c;if(_0x493660>=_0x10d2f7){_0x493660=_0x10d2f7;_0x49546c=0xc8;}else{_0x49546c=0xce;}_0x5aa026[_0x6e13('0x1c')](_0x49546c);return _0x5aa026[_0x6e13('0x20')](_0x6e13('0x21'),_0xf339a0+'-'+_0x493660+'/'+_0x10d2f7)[_0x6e13('0x22')](_0x96e191);}return null;};}function patchUpdates(_0x5cdb0a){return function(_0x9bdd08){try{jsonpatch[_0x6e13('0x23')](_0x9bdd08,_0x5cdb0a,!![]);}catch(_0x3574b7){return BPromise['reject'](_0x3574b7);}return _0x9bdd08[_0x6e13('0x24')]();};}function saveUpdates(_0x598f96,_0x129486){return function(_0x32118e){if(_0x32118e){return _0x32118e['update'](_0x598f96)['then'](function(_0x44f2bc){return _0x44f2bc;});}return null;};}function removeEntity(_0x5b4893,_0xf94935){return function(_0x2b59e2){if(_0x2b59e2){return _0x2b59e2[_0x6e13('0x25')]()[_0x6e13('0x26')](function(){var _0x363b6a=_0x2b59e2[_0x6e13('0x27')]({'plain':!![]});var _0x4bc8eb='Companies';return db[_0x6e13('0x28')]['destroy']({'where':{'type':_0x4bc8eb,'resourceId':_0x363b6a['id']}})[_0x6e13('0x26')](function(){return _0x2b59e2;});})['then'](function(){_0x5b4893[_0x6e13('0x1c')](0xcc)[_0x6e13('0x1d')]();});}};}function handleEntityNotFound(_0x1e5032,_0x40fcce){return function(_0x42e403){if(!_0x42e403){_0x1e5032[_0x6e13('0x1b')](0x194);}return _0x42e403;};}function handleError(_0xb7192d,_0x1a9214){_0x1a9214=_0x1a9214||0x1f4;return function(_0x585369){logger[_0x6e13('0x29')](_0x585369[_0x6e13('0x2a')]);if(_0x585369[_0x6e13('0x2b')]){delete _0x585369[_0x6e13('0x2b')];}_0xb7192d[_0x6e13('0x1c')](_0x1a9214)[_0x6e13('0x2c')](_0x585369);};}exports[_0x6e13('0x2d')]=function(_0x223940,_0x20a575){var _0x4db232={},_0x4fab29={},_0x3db446={'count':0x0,'rows':[]};return db[_0x6e13('0x2e')][_0x6e13('0x2f')]()[_0x6e13('0x26')](function(_0x4e36dc){_0x4fab29[_0x6e13('0x30')]=_[_0x6e13('0x31')](_0x4e36dc);_0x4fab29[_0x6e13('0x32')]=_[_0x6e13('0x31')](_0x223940[_0x6e13('0x32')]);_0x4fab29[_0x6e13('0x33')]=_[_0x6e13('0x34')](_0x4fab29['model'],_0x4fab29[_0x6e13('0x32')]);_0x4db232[_0x6e13('0x35')]=_[_0x6e13('0x34')](_0x4fab29['model'],qs[_0x6e13('0x36')](_0x223940[_0x6e13('0x32')][_0x6e13('0x36')]));_0x4db232[_0x6e13('0x35')]=_0x4db232[_0x6e13('0x35')][_0x6e13('0x37')]?_0x4db232[_0x6e13('0x35')]:_0x4fab29[_0x6e13('0x30')];if(!_0x223940[_0x6e13('0x32')][_0x6e13('0x38')](_0x6e13('0x39'))){_0x4db232['limit']=qs[_0x6e13('0x1f')](_0x223940['query'][_0x6e13('0x1f')]);_0x4db232[_0x6e13('0x1e')]=qs[_0x6e13('0x1e')](_0x223940['query'][_0x6e13('0x1e')]);}_0x4db232['order']=qs[_0x6e13('0x3a')](_0x223940[_0x6e13('0x32')][_0x6e13('0x3a')]);_0x4db232[_0x6e13('0x3b')]=qs[_0x6e13('0x33')](_[_0x6e13('0x3c')](_0x223940[_0x6e13('0x32')],_0x4fab29[_0x6e13('0x33')]),_0x4e36dc);if(_0x223940[_0x6e13('0x32')][_0x6e13('0x3d')]){_0x4db232[_0x6e13('0x3b')]=_[_0x6e13('0x3e')](_0x4db232['where'],{'$or':_[_0x6e13('0x3f')](_0x4db232[_0x6e13('0x35')],function(_0x18e46a){var _0x3cd67c={};_0x3cd67c[_0x18e46a]={'$like':'%'+_0x223940['query'][_0x6e13('0x3d')]+'%'};return _0x3cd67c;})});}_0x4db232=_[_0x6e13('0x3e')]({},_0x4db232,_0x223940[_0x6e13('0x40')]);var _0x1b625e={'where':_0x4db232['where']};return db['CmCompany'][_0x6e13('0x41')](_0x1b625e)['then'](function(_0x36ce09){_0x3db446[_0x6e13('0x41')]=_0x36ce09;if(_0x223940[_0x6e13('0x32')]['includeAll']){_0x4db232[_0x6e13('0x42')]=[{'all':!![]}];}return db[_0x6e13('0x2e')][_0x6e13('0x43')](_0x4db232);})[_0x6e13('0x26')](function(_0x7fc5b3){_0x3db446[_0x6e13('0x44')]=_0x7fc5b3;return _0x3db446;})[_0x6e13('0x26')](respondWithFilteredResult(_0x20a575,_0x4db232))[_0x6e13('0x45')](handleError(_0x20a575,null));})[_0x6e13('0x45')](handleError(_0x20a575,null));};exports[_0x6e13('0x46')]=function(_0x4b2366,_0x4a020d){var _0x52bb68={'raw':![],'where':{'id':_0x4b2366[_0x6e13('0x47')]['id']}},_0x5b3fc9={};_0x5b3fc9[_0x6e13('0x30')]=_[_0x6e13('0x31')](db[_0x6e13('0x2e')][_0x6e13('0x48')]);_0x5b3fc9['query']=_[_0x6e13('0x31')](_0x4b2366['query']);_0x5b3fc9[_0x6e13('0x33')]=_[_0x6e13('0x34')](_0x5b3fc9[_0x6e13('0x30')],_0x5b3fc9[_0x6e13('0x32')]);_0x52bb68['attributes']=_[_0x6e13('0x34')](_0x5b3fc9[_0x6e13('0x30')],qs[_0x6e13('0x36')](_0x4b2366[_0x6e13('0x32')][_0x6e13('0x36')]));_0x52bb68[_0x6e13('0x35')]=_0x52bb68[_0x6e13('0x35')][_0x6e13('0x37')]?_0x52bb68[_0x6e13('0x35')]:_0x5b3fc9['model'];if(_0x4b2366[_0x6e13('0x32')][_0x6e13('0x49')]){_0x52bb68[_0x6e13('0x42')]=[{'all':!![]}];}_0x52bb68=_[_0x6e13('0x3e')]({},_0x52bb68,_0x4b2366[_0x6e13('0x40')]);return db['CmCompany'][_0x6e13('0x4a')](_0x52bb68)['then'](handleEntityNotFound(_0x4a020d,null))[_0x6e13('0x26')](respondWithResult(_0x4a020d,null))[_0x6e13('0x45')](handleError(_0x4a020d,null));};exports[_0x6e13('0x4b')]=function(_0x211718,_0x4550fe){return db['CmCompany'][_0x6e13('0x4b')](_0x211718['body'],{})['then'](function(_0x4bd70f){var _0xe9bdd9=_0x211718[_0x6e13('0x4c')][_0x6e13('0x27')]({'plain':!![]});if(!_0xe9bdd9)throw new Error(_0x6e13('0x4d'));if(_0xe9bdd9[_0x6e13('0x4e')]===_0x6e13('0x4c')){var _0x1266bc=_0x4bd70f['get']({'plain':!![]});var _0x336613='Companies';return db['UserProfileSection'][_0x6e13('0x4a')]({'where':{'name':_0x336613,'userProfileId':_0xe9bdd9['userProfileId']},'raw':!![]})[_0x6e13('0x26')](function(_0x2addcb){if(_0x2addcb&&_0x2addcb[_0x6e13('0x4f')]===0x0){return db['UserProfileResource'][_0x6e13('0x4b')]({'name':_0x1266bc['name'],'resourceId':_0x1266bc['id'],'type':_0x2addcb[_0x6e13('0x2b')],'sectionId':_0x2addcb['id']},{})[_0x6e13('0x26')](function(){return _0x4bd70f;});}else{return _0x4bd70f;}})[_0x6e13('0x45')](function(_0x5eeecf){logger[_0x6e13('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eeecf);throw _0x5eeecf;});}return _0x4bd70f;})[_0x6e13('0x26')](respondWithResult(_0x4550fe,0xc9))[_0x6e13('0x45')](handleError(_0x4550fe,null));};exports[_0x6e13('0x50')]=function(_0x4b13ad,_0xe9b2a3){if(_0x4b13ad[_0x6e13('0x51')]['id']){delete _0x4b13ad[_0x6e13('0x51')]['id'];}return db[_0x6e13('0x2e')][_0x6e13('0x4a')]({'where':{'id':_0x4b13ad[_0x6e13('0x47')]['id']}})['then'](handleEntityNotFound(_0xe9b2a3,null))[_0x6e13('0x26')](saveUpdates(_0x4b13ad['body'],null))['then'](respondWithResult(_0xe9b2a3,null))['catch'](handleError(_0xe9b2a3,null));};exports[_0x6e13('0x25')]=function(_0x75774c,_0x3db42b){return db['CmCompany'][_0x6e13('0x4a')]({'where':{'id':_0x75774c['params']['id']}})[_0x6e13('0x26')](handleEntityNotFound(_0x3db42b,null))[_0x6e13('0x26')](removeEntity(_0x3db42b,null))['catch'](handleError(_0x3db42b,null));};exports['describe']=function(_0x12f3e5,_0x41437f){return db['CmCompany'][_0x6e13('0x2f')]()[_0x6e13('0x26')](respondWithResult(_0x41437f,null))[_0x6e13('0x45')](handleError(_0x41437f,null));};exports[_0x6e13('0x52')]=function(_0x237d0e,_0x567ee5,_0x248ef4){return db[_0x6e13('0x53')][_0x6e13('0x4a')]({'where':{'id':_0x237d0e[_0x6e13('0x47')]['id']}})['then'](handleEntityNotFound(_0x567ee5,null))[_0x6e13('0x26')](function(_0x2a342b){if(_0x2a342b){return _0x2a342b['addContacts'](_0x237d0e[_0x6e13('0x51')]['ids'],_[_0x6e13('0x54')](_0x237d0e[_0x6e13('0x51')],[_0x6e13('0x55'),'id'])||{});}})[_0x6e13('0x26')](respondWithResult(_0x567ee5,null))['catch'](handleError(_0x567ee5,null));};exports[_0x6e13('0x56')]=function(_0x234694,_0x3304db,_0x3726d2){var _0x148151={};var _0xb530c2={};var _0x58cdb5;var _0x2f7e84;return db[_0x6e13('0x2e')][_0x6e13('0x57')]({'where':{'id':_0x234694[_0x6e13('0x47')]['id']}})['then'](handleEntityNotFound(_0x3304db,null))['then'](function(_0x46b2af){if(_0x46b2af){_0x58cdb5=_0x46b2af;_0xb530c2[_0x6e13('0x30')]=_[_0x6e13('0x31')](db[_0x6e13('0x53')][_0x6e13('0x48')]);_0xb530c2[_0x6e13('0x32')]=_[_0x6e13('0x31')](_0x234694['query']);_0xb530c2[_0x6e13('0x33')]=_[_0x6e13('0x34')](_0xb530c2[_0x6e13('0x30')],_0xb530c2[_0x6e13('0x32')]);_0x148151[_0x6e13('0x35')]=_[_0x6e13('0x34')](_0xb530c2[_0x6e13('0x30')],qs[_0x6e13('0x36')](_0x234694[_0x6e13('0x32')][_0x6e13('0x36')]));_0x148151[_0x6e13('0x35')]=_0x148151[_0x6e13('0x35')][_0x6e13('0x37')]?_0x148151[_0x6e13('0x35')]:_0xb530c2['model'];_0x148151[_0x6e13('0x58')]=qs['sort'](_0x234694[_0x6e13('0x32')][_0x6e13('0x3a')]);_0x148151[_0x6e13('0x3b')]=qs[_0x6e13('0x33')](_[_0x6e13('0x3c')](_0x234694['query'],_0xb530c2[_0x6e13('0x33')]));if(_0x234694[_0x6e13('0x32')]['filter']){_0x148151[_0x6e13('0x3b')]=_[_0x6e13('0x3e')](_0x148151[_0x6e13('0x3b')],{'$or':_[_0x6e13('0x3f')](_0x148151['attributes'],function(_0x4c6ebc){var _0x50a39f={};_0x50a39f[_0x4c6ebc]={'$like':'%'+_0x234694[_0x6e13('0x32')]['filter']+'%'};return _0x50a39f;})});}_0x148151=_[_0x6e13('0x3e')]({},_0x148151,_0x234694['options']);return _0x58cdb5['getContacts'](_0x148151);}})[_0x6e13('0x26')](function(_0x31b12f){if(_0x31b12f){_0x2f7e84=_0x31b12f[_0x6e13('0x37')];if(!_0x234694['query'][_0x6e13('0x38')](_0x6e13('0x39'))){_0x148151['limit']=qs[_0x6e13('0x1f')](_0x234694['query'][_0x6e13('0x1f')]);_0x148151[_0x6e13('0x1e')]=qs[_0x6e13('0x1e')](_0x234694['query'][_0x6e13('0x1e')]);}return _0x58cdb5['getContacts'](_0x148151);}})[_0x6e13('0x26')](function(_0x578396){if(_0x578396){return _0x578396?{'count':_0x2f7e84,'rows':_0x578396}:null;}})[_0x6e13('0x26')](respondWithResult(_0x3304db,null))[_0x6e13('0x45')](handleError(_0x3304db,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index f6a21e1..465005c 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 _0x3148=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x3148,0x1d3));var _0x8314=function(_0x538230,_0x522250){_0x538230=_0x538230-0x0;var _0x30f32b=_0x3148[_0x538230];return _0x30f32b;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var logger=require('../../config/logger')(_0x8314('0x2'));var moment=require(_0x8314('0x3'));var BPromise=require(_0x8314('0x4'));var rp=require(_0x8314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var attributes=require(_0x8314('0x8'));module[_0x8314('0x9')]=function(_0x18a30b,_0x9cb271){return _0x18a30b[_0x8314('0xa')]('CmCompany',attributes,{'tableName':_0x8314('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e8a=['path','define','cm_companies','util','../../config/logger','moment','bluebird'];(function(_0x4bc25b,_0x28ca80){var _0x5289cc=function(_0x2cd985){while(--_0x2cd985){_0x4bc25b['push'](_0x4bc25b['shift']());}};_0x5289cc(++_0x28ca80);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0x2e8a[_0x83c716];return _0xab9893;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('api');var moment=require(_0xa2e8('0x2'));var BPromise=require(_0xa2e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module['exports']=function(_0x4593d2,_0x32fb35){return _0x4593d2[_0xa2e8('0x5')]('CmCompany',attributes,{'tableName':_0xa2e8('0x6'),'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 613992b..81ba40e 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 _0xac1b=['then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4349d2,_0x481bad){var _0x3a9f34=function(_0x246883){while(--_0x246883){_0x4349d2['push'](_0x4349d2['shift']());}};_0x3a9f34(++_0x481bad);}(_0xac1b,0x172));var _0xbac1=function(_0x299136,_0x2a3929){_0x299136=_0x299136-0x0;var _0x18a92d=_0xac1b[_0x299136];return _0x18a92d;};'use strict';var _=require(_0xbac1('0x0'));var util=require(_0xbac1('0x1'));var moment=require(_0xbac1('0x2'));var BPromise=require('bluebird');var rs=require(_0xbac1('0x3'));var fs=require('fs');var Redis=require(_0xbac1('0x4'));var db=require(_0xbac1('0x5'))['db'];var utils=require(_0xbac1('0x6'));var logger=require(_0xbac1('0x7'))(_0xbac1('0x8'));var config=require(_0xbac1('0x9'));var jayson=require(_0xbac1('0xa'));var client=jayson[_0xbac1('0xb')][_0xbac1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b602b,_0x33359a,_0x1ba456){return new BPromise(function(_0x9c0473,_0x48cae6){return client[_0xbac1('0xd')](_0x2b602b,_0x1ba456)[_0xbac1('0xe')](function(_0x35efec){logger[_0xbac1('0xf')](_0xbac1('0x10'),_0x33359a,'request\x20sent');logger[_0xbac1('0x11')](_0xbac1('0x12'),_0x33359a,'request\x20sent',JSON['stringify'](_0x35efec));if(_0x35efec[_0xbac1('0x13')]){if(_0x35efec[_0xbac1('0x13')][_0xbac1('0x14')]===0x1f4){logger[_0xbac1('0x13')](_0xbac1('0x10'),_0x33359a,_0x35efec[_0xbac1('0x13')][_0xbac1('0x15')]);return _0x48cae6(_0x35efec[_0xbac1('0x13')]['message']);}logger[_0xbac1('0x13')](_0xbac1('0x10'),_0x33359a,_0x35efec[_0xbac1('0x13')][_0xbac1('0x15')]);return _0x9c0473(_0x35efec['error'][_0xbac1('0x15')]);}else{logger[_0xbac1('0xf')]('CmCompany,\x20%s,\x20%s',_0x33359a,'request\x20sent');_0x9c0473(_0x35efec[_0xbac1('0x16')]['message']);}})[_0xbac1('0x17')](function(_0x4c3928){logger[_0xbac1('0x13')](_0xbac1('0x10'),_0x33359a,_0x4c3928);_0x48cae6(_0x4c3928);});});} \ No newline at end of file +var _0xb47e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0xb47e,0x1c9));var _0xeb47=function(_0x213d3c,_0x5cea7){_0x213d3c=_0x213d3c-0x0;var _0x3677b9=_0xb47e[_0x213d3c];return _0x3677b9;};'use strict';var _=require(_0xeb47('0x0'));var util=require(_0xeb47('0x1'));var moment=require(_0xeb47('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb47('0x3'))['db'];var utils=require(_0xeb47('0x4'));var logger=require(_0xeb47('0x5'))(_0xeb47('0x6'));var config=require(_0xeb47('0x7'));var jayson=require(_0xeb47('0x8'));var client=jayson[_0xeb47('0x9')][_0xeb47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf78416,_0x32c9ce,_0x505e1b){return new BPromise(function(_0x415b83,_0x4583df){return client[_0xeb47('0xb')](_0xf78416,_0x505e1b)[_0xeb47('0xc')](function(_0x5bfec3){logger['info'](_0xeb47('0xd'),_0x32c9ce,_0xeb47('0xe'));logger[_0xeb47('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x32c9ce,_0xeb47('0xe'),JSON[_0xeb47('0x10')](_0x5bfec3));if(_0x5bfec3[_0xeb47('0x11')]){if(_0x5bfec3[_0xeb47('0x11')][_0xeb47('0x12')]===0x1f4){logger['error'](_0xeb47('0xd'),_0x32c9ce,_0x5bfec3[_0xeb47('0x11')][_0xeb47('0x13')]);return _0x4583df(_0x5bfec3[_0xeb47('0x11')][_0xeb47('0x13')]);}logger[_0xeb47('0x11')]('CmCompany,\x20%s,\x20%s',_0x32c9ce,_0x5bfec3[_0xeb47('0x11')][_0xeb47('0x13')]);return _0x415b83(_0x5bfec3['error'][_0xeb47('0x13')]);}else{logger[_0xeb47('0x14')]('CmCompany,\x20%s,\x20%s',_0x32c9ce,'request\x20sent');_0x415b83(_0x5bfec3[_0xeb47('0x15')][_0xeb47('0x13')]);}})[_0xeb47('0x16')](function(_0x31f0a4){logger[_0xeb47('0x11')](_0xeb47('0xd'),_0x32c9ce,_0x31f0a4);_0x4583df(_0x31f0a4);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 108d276..40d58d0 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 _0x1a85=['../../config/environment','./cmCompany.controller','isAuthenticated','get','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x1a85,0x178));var _0x51a8=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x1a85[_0x274638];return _0x5755df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var controller=require(_0x51a8('0x5'));router['get']('/',auth[_0x51a8('0x6')](),controller['index']);router[_0x51a8('0x7')]('/describe',auth[_0x51a8('0x6')](),controller[_0x51a8('0x8')]);router['get'](_0x51a8('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x51a8('0x7')](_0x51a8('0xa'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xb')]);router[_0x51a8('0xc')]('/',auth[_0x51a8('0x6')](),controller[_0x51a8('0xd')]);router[_0x51a8('0xc')](_0x51a8('0xa'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xe')]);router[_0x51a8('0xf')](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x11')](_0x51a8('0x9'),auth['isAuthenticated'](),controller[_0x51a8('0x12')]);module[_0x51a8('0x13')]=router; \ No newline at end of file +var _0x9582=['/describe','describe','post','create','/:id/contacts','addContacts','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x9582,0x95));var _0x2958=function(_0x5640ca,_0x56afc0){_0x5640ca=_0x5640ca-0x0;var _0xef47a3=_0x9582[_0x5640ca];return _0xef47a3;};'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['get']('/:id',auth[_0x2958('0xa')](),controller['show']);router[_0x2958('0x9')]('/:id/contacts',auth[_0x2958('0xa')](),controller['getContacts']);router[_0x2958('0xe')]('/',auth[_0x2958('0xa')](),controller[_0x2958('0xf')]);router[_0x2958('0xe')](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x11')]);router[_0x2958('0x12')](_0x2958('0x13'),auth[_0x2958('0xa')](),controller[_0x2958('0x14')]);router[_0x2958('0x15')](_0x2958('0x13'),auth[_0x2958('0xa')](),controller['destroy']);module[_0x2958('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 25f2e78..9e753e3 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 _0x30dc=['INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING','TEXT'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x30dc,0x173));var _0xc30d=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0x30dc[_0x1c206c];return _0x188aaa;};'use strict';var _=require(_0xc30d('0x0'));var Sequelize=require(_0xc30d('0x1'));module[_0xc30d('0x2')]={'firstName':{'type':Sequelize[_0xc30d('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc30d('0x3')]},'street':{'type':Sequelize[_0xc30d('0x3')]},'postalCode':{'type':Sequelize[_0xc30d('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc30d('0x3')]},'dateOfBirth':{'type':Sequelize[_0xc30d('0x3')]},'description':{'type':Sequelize[_0xc30d('0x4')]},'phone':{'type':Sequelize[_0xc30d('0x3')]},'mobile':{'type':Sequelize[_0xc30d('0x3')]},'fax':{'type':Sequelize[_0xc30d('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xc30d('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xc30d('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xc30d('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc30d('0x3')]},'telegram':{'type':Sequelize[_0xc30d('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xc30d('0x5')](0x2)[_0xc30d('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc30d('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3145=['INTEGER','DATE','NOW','sequelize','STRING','TEXT'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x3145,0x11d));var _0x5314=function(_0x3e7a20,_0x12c4f1){_0x3e7a20=_0x3e7a20-0x0;var _0x427611=_0x3145[_0x3e7a20];return _0x427611;};'use strict';var _=require('lodash');var Sequelize=require(_0x5314('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x5314('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x5314('0x1')]},'postalCode':{'type':Sequelize[_0x5314('0x1')]},'city':{'type':Sequelize[_0x5314('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x5314('0x1')]},'description':{'type':Sequelize[_0x5314('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5314('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5314('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x5314('0x1')]},'fb_data':{'type':Sequelize[_0x5314('0x1')]},'twitter':{'type':Sequelize[_0x5314('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x5314('0x1')]},'viber':{'type':Sequelize[_0x5314('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x5314('0x1')]},'telegram':{'type':Sequelize[_0x5314('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x5314('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5314('0x4')],'defaultValue':Sequelize[_0x5314('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 90d1ddc..94ce61e 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 _0x6655=['left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','castTo','DATE','buildExpression','text','isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','isArray','tag','forEach','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','DESC','having','resolve','user','role','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','count','keyBy','merge','c.id','c.firstName','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','Tags','rows','catch','find','params','displayName','CmCustomField','findAll','custom','values','body','get','mergeWith','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','create','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','Tag','$and','omit','format','cf_%d','pickBy','table','setFields','toParam','phone','intersection','getTags','nolimit','setTags','getHoppers','rawAttributes','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','pid','send','createReadStream','path','parse','meta','import','agent','No\x20phone\x20column\x20specified','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','html-pdf','request-promise','moment','bluebird','sox','to-csv','lodash','squel','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','defaults','redis','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','Content-Range','apply','reject','then','destroy','error','stack','name','index','CmContact','describe','keys','startsWith','cf_','push','findOne','trimStart','all','length','fieldType','type','model','query','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','select','field','color','tools_tags','from','cm_contacts'];(function(_0x402489,_0x397642){var _0x498ce3=function(_0xdf2347){while(--_0xdf2347){_0x402489['push'](_0x402489['shift']());}};_0x498ce3(++_0x397642);}(_0x6655,0x193));var _0x5665=function(_0x21db57,_0x41fe77){_0x21db57=_0x21db57-0x0;var _0x34a3a5=_0x6655[_0x21db57];return _0x34a3a5;};'use strict';var pdf=require(_0x5665('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5665('0x1'));var moment=require(_0x5665('0x2'));var BPromise=require(_0x5665('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5665('0x4'));var csv=require(_0x5665('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5665('0x6'));var squel=require(_0x5665('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5665('0x8'));var toCsv=require(_0x5665('0x5'));var querystring=require(_0x5665('0x9'));var Papa=require(_0x5665('0xa'));var Redis=require('ioredis');var authService=require(_0x5665('0xb'));var qs=require(_0x5665('0xc'));var as=require(_0x5665('0xd'));var hardwareService=require(_0x5665('0xe'));var logger=require(_0x5665('0xf'))(_0x5665('0x10'));var utils=require(_0x5665('0x11'));var config=require(_0x5665('0x12'));var licenseUtil=require(_0x5665('0x13'));var db=require(_0x5665('0x14'))['db'];config['redis']=_[_0x5665('0x15')](config[_0x5665('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x5665('0x17'))(new Redis(config[_0x5665('0x16')]));require(_0x5665('0x18'))[_0x5665('0x19')](socket);function respondWithStatusCode(_0x2a0766,_0x112b4c){_0x112b4c=_0x112b4c||0xcc;return function(_0x14fc7a){if(_0x14fc7a){return _0x2a0766[_0x5665('0x1a')](_0x112b4c);}return _0x2a0766[_0x5665('0x1b')](_0x112b4c)[_0x5665('0x1c')]();};}function respondWithResult(_0x105dcb,_0x383b1f){_0x383b1f=_0x383b1f||0xc8;return function(_0x3d53d9){if(_0x3d53d9){return _0x105dcb[_0x5665('0x1b')](_0x383b1f)[_0x5665('0x1d')](_0x3d53d9);}};}function respondWithFilteredResult(_0x372216,_0x4d92b4){return function(_0x2e0e08){if(_0x2e0e08){var _0x81ba48=_0x2e0e08['count'],_0xcc4368=_0x4d92b4[_0x5665('0x1e')],_0x3e4f36=_0x4d92b4[_0x5665('0x1e')]+_0x4d92b4['limit'],_0x169d8b;if(_0x3e4f36>=_0x81ba48){_0x3e4f36=_0x81ba48;_0x169d8b=0xc8;}else{_0x169d8b=0xce;}_0x372216[_0x5665('0x1b')](_0x169d8b);return _0x372216['set'](_0x5665('0x1f'),_0xcc4368+'-'+_0x3e4f36+'/'+_0x81ba48)[_0x5665('0x1d')](_0x2e0e08);}return null;};}function patchUpdates(_0x3c25fb){return function(_0x5d1f89){try{jsonpatch[_0x5665('0x20')](_0x5d1f89,_0x3c25fb,!![]);}catch(_0x14629d){return BPromise[_0x5665('0x21')](_0x14629d);}return _0x5d1f89['save']();};}function saveUpdates(_0x21e87d,_0x58c625){return function(_0x2d1d45){if(_0x2d1d45){return _0x2d1d45['update'](_0x21e87d)[_0x5665('0x22')](function(_0x1818db){return _0x1818db;});}return null;};}function removeEntity(_0x3e5729,_0x56318d){return function(_0x2d3de7){if(_0x2d3de7){return _0x2d3de7[_0x5665('0x23')]()[_0x5665('0x22')](function(){_0x3e5729[_0x5665('0x1b')](0xcc)[_0x5665('0x1c')]();});}};}function handleEntityNotFound(_0xc625af,_0x4fa318){return function(_0x367376){if(!_0x367376){_0xc625af['sendStatus'](0x194);}return _0x367376;};}function handleError(_0x21bd4a,_0x4ad57a){_0x4ad57a=_0x4ad57a||0x1f4;return function(_0x45419f){logger[_0x5665('0x24')](_0x45419f[_0x5665('0x25')]);if(_0x45419f[_0x5665('0x26')]){delete _0x45419f[_0x5665('0x26')];}_0x21bd4a[_0x5665('0x1b')](_0x4ad57a)['send'](_0x45419f);};}exports[_0x5665('0x27')]=function(_0x6e0777,_0x380d27){var _0x48bf40={},_0x269b1a={},_0x15cfa4={'count':0x0,'rows':[]};return db[_0x5665('0x28')][_0x5665('0x29')]()['then'](function(_0x1e0e35){var _0x536785=[];for(var _0x3add0a=0x0;_0x3add0a0x1){_0x7939f2['or'](_0x5665('0x66'),qs[_0x5665('0x67')](_0x4570c4),null);}else{if(qs['isNumeric'](_0x4570c4)){_0x7939f2['or']('c.id\x20LIKE\x20?',_0x4570c4+'%');_0x7939f2['or'](_0x5665('0x68'),_0x4570c4+'%');_0x7939f2['or'](_0x5665('0x69'),_0x4570c4+'%');_0x7939f2['or']('c.fax\x20LIKE\x20?',_0x4570c4+'%');}else if(qs['isEmail'](_0x4570c4)){_0x7939f2['or']('c.email\x20LIKE\x20?',_0x4570c4+'%');}else{_0x7939f2['or'](_0x5665('0x6a'),'%'+_0x4570c4+'%');_0x7939f2['or'](_0x5665('0x6b'),'%'+_0x4570c4+'%');_0x7939f2['or'](_0x5665('0x6c'),'%'+_0x4570c4+'%');}}}}_0x2d4fa2['where'](_0x7939f2);_0x2d4fa2['group']('c.id');var _0x5cdf80={'type':db[_0x5665('0x6d')][_0x5665('0x6e')][_0x5665('0x6f')],'raw':!![]};var _0x565245=_0x2d4fa2[_0x5665('0x70')]()[_0x5665('0x40')]('c.id');if(_0x48bf40['order']){_0x48bf40[_0x5665('0x3b')][_0x5665('0x63')](function(_0x52b2e2){_0x2d4fa2[_0x5665('0x3b')]('c.'+_0x52b2e2[0x0],_0x52b2e2[0x1]===_0x5665('0x71')?![]:!![]);});}if(!_[_0x5665('0x5d')](_0x13c7f5)){_0x2d4fa2[_0x5665('0x72')](_0x46145f);_0x565245['where']('t.id\x20IN\x20?',_0x13c7f5);}BPromise[_0x5665('0x73')]()[_0x5665('0x22')](function(){if(!_0x3a6572)return;if(_0x6e0777[_0x5665('0x74')][_0x5665('0x75')]!=='agent')return;if(!_[_0x5665('0x76')](_0x3a6572[_0x5665('0x4d')],[_0x5665('0x40'),_0x5665('0x52')])){return _0x6e0777[_0x5665('0x74')][_0x5665('0x77')]({'attributes':['id'],'raw':!![]})[_0x5665('0x22')](function(_0x14813c){if(_['isEmpty'](_0x14813c)){_0x565245['where'](_0x5665('0x78'));_0x2d4fa2[_0x5665('0x3d')](_0x5665('0x78'));}else{_0x565245[_0x5665('0x3d')](_0x5665('0x79'),_[_0x5665('0x4f')](_0x14813c,'id'));_0x2d4fa2[_0x5665('0x3d')]('c.ListId\x20IN\x20?',_[_0x5665('0x4f')](_0x14813c,'id'));}});}})[_0x5665('0x22')](function(){if(_0x6e0777[_0x5665('0x74')][_0x5665('0x75')]==='agent'&&!_0x3a6572&&!_0x6e0777[_0x5665('0x35')][_0x5665('0x5e')])return[];return db[_0x5665('0x7a')][_0x5665('0x35')](_0x565245[_0x5665('0x7b')](),_0x5cdf80);})['then'](function(_0x104a64){_0x15cfa4[_0x5665('0x7c')]=_0x104a64['length'];if(_0x15cfa4[_0x5665('0x7c')]===0x0)return[];return db[_0x5665('0x7a')]['query'](_0x14ca01[_0x5665('0x7b')](),_0x5cdf80)[_0x5665('0x22')](function(_0x48e8a2){_0x35e6cf=_[_0x5665('0x7d')](_0x48e8a2,'id');_0x5cdf80=_[_0x5665('0x7e')](_0x5cdf80,{'model':db[_0x5665('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6e0777['query'][_0x5665('0x38')]){_0x48bf40[_0x5665('0x37')]['forEach'](function(_0x1428f6){_0x2d4fa2[_0x5665('0x40')]('c.'+_0x1428f6);});}else{_0x2d4fa2[_0x5665('0x40')](_0x5665('0x7f'));_0x2d4fa2['field'](_0x5665('0x80'));_0x2d4fa2[_0x5665('0x40')]('c.lastName');_0x2d4fa2[_0x5665('0x40')]('c.phone');_0x2d4fa2[_0x5665('0x40')](_0x5665('0x81'));_0x2d4fa2['field'](_0x5665('0x82'));_0x2d4fa2[_0x5665('0x40')]('c.email');_0x2d4fa2[_0x5665('0x40')](_0x5665('0x83'));_0x2d4fa2[_0x5665('0x40')](_0x5665('0x84'));_0x2d4fa2[_0x5665('0x40')](_0x5665('0x85'));_0x2d4fa2[_0x5665('0x40')]('c.CompanyId');_0x2d4fa2[_0x5665('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x48bf40[_0x5665('0x3a')])_0x2d4fa2[_0x5665('0x3a')](_0x48bf40[_0x5665('0x3a')]);if(_0x48bf40[_0x5665('0x1e')])_0x2d4fa2['offset'](_0x48bf40[_0x5665('0x1e')]);return db[_0x5665('0x7a')]['query'](_0x2d4fa2['toString'](),_0x5cdf80);});})[_0x5665('0x22')](function(_0x2b7bd2){_0x2b7bd2['forEach'](function(_0x50855b){if(_0x50855b['TagIds']){_0x50855b[_0x5665('0x86')]=[];_0x50855b['TagIds'][_0x5665('0x4e')](',')[_0x5665('0x63')](function(_0x185893){_0x50855b[_0x5665('0x86')]['push'](_0x35e6cf[_0x185893]);});}delete _0x50855b['TagIds'];});_0x15cfa4[_0x5665('0x87')]=_0x2b7bd2;return _0x15cfa4;})['then'](respondWithFilteredResult(_0x380d27,_0x48bf40));})[_0x5665('0x88')](handleError(_0x380d27,null));};exports[_0x5665('0x23')]=function(_0x191596,_0x3ad576){return db['CmContact'][_0x5665('0x89')]({'where':{'id':_0x191596[_0x5665('0x8a')]['id']}})['then'](handleEntityNotFound(_0x3ad576,null))['then'](removeEntity(_0x3ad576,null))['catch'](handleError(_0x3ad576,null));};exports[_0x5665('0x29')]=function(_0x1ac240,_0x1a181f){return db['CmContact'][_0x5665('0x29')]()['then'](function(_0x2ac855){delete _0x2ac855['tags'];for(var _0x2d23ea=0x0;_0x2d23ea=_0x2ed87a){_0x339ce4=_0x2ed87a;_0x2722ff=0xc8;}else{_0x2722ff=0xce;}_0x5da003[_0x7681('0x21')](_0x2722ff);return _0x5da003[_0x7681('0x24')]('Content-Range',_0x4f5e7a+'-'+_0x339ce4+'/'+_0x2ed87a)[_0x7681('0x22')](_0x30a950);}return null;};}function patchUpdates(_0x3cbde8){return function(_0x38d62e){try{jsonpatch[_0x7681('0x25')](_0x38d62e,_0x3cbde8,!![]);}catch(_0x2b20c8){return BPromise['reject'](_0x2b20c8);}return _0x38d62e['save']();};}function saveUpdates(_0xc2b661,_0x267d52){return function(_0x6b838a){if(_0x6b838a){return _0x6b838a[_0x7681('0x26')](_0xc2b661)[_0x7681('0x27')](function(_0x2303d3){return _0x2303d3;});}return null;};}function removeEntity(_0x3b6bea,_0x196a1f){return function(_0x4a3f19){if(_0x4a3f19){return _0x4a3f19[_0x7681('0x28')]()[_0x7681('0x27')](function(){_0x3b6bea[_0x7681('0x21')](0xcc)[_0x7681('0x20')]();});}};}function handleEntityNotFound(_0x1ccaab,_0x41c0e6){return function(_0x2d556e){if(!_0x2d556e){_0x1ccaab['sendStatus'](0x194);}return _0x2d556e;};}function handleError(_0x530338,_0x329bfe){_0x329bfe=_0x329bfe||0x1f4;return function(_0xfb82f0){logger['error'](_0xfb82f0[_0x7681('0x29')]);if(_0xfb82f0['name']){delete _0xfb82f0[_0x7681('0x2a')];}_0x530338[_0x7681('0x21')](_0x329bfe)['send'](_0xfb82f0);};}exports[_0x7681('0x2b')]=function(_0x4e2e8d,_0x5962d5){var _0x16fbc5={},_0x106dcc={},_0x1bedbf={'count':0x0,'rows':[]};return db['CmContact'][_0x7681('0x2c')]()[_0x7681('0x27')](function(_0x508af0){var _0x3d0a02=[];for(var _0x24ecf6=0x0;_0x24ecf60x1){_0x3bbf31['or'](_0x7681('0x68'),qs['getFullTextValue'](_0x4fb1e2),null);}else{if(qs['isNumeric'](_0x4fb1e2)){_0x3bbf31['or'](_0x7681('0x69'),_0x4fb1e2+'%');_0x3bbf31['or'](_0x7681('0x6a'),_0x4fb1e2+'%');_0x3bbf31['or']('c.mobile\x20LIKE\x20?',_0x4fb1e2+'%');_0x3bbf31['or'](_0x7681('0x6b'),_0x4fb1e2+'%');}else if(qs[_0x7681('0x6c')](_0x4fb1e2)){_0x3bbf31['or'](_0x7681('0x6d'),_0x4fb1e2+'%');}else{_0x3bbf31['or'](_0x7681('0x6e'),'%'+_0x4fb1e2+'%');_0x3bbf31['or'](_0x7681('0x6f'),'%'+_0x4fb1e2+'%');_0x3bbf31['or'](_0x7681('0x6d'),'%'+_0x4fb1e2+'%');}}}}_0x4a9c3b[_0x7681('0x3e')](_0x3bbf31);_0x4a9c3b[_0x7681('0x70')]('c.id');var _0x1bc6d4={'type':db['Sequelize'][_0x7681('0x71')][_0x7681('0x72')],'raw':!![]};var _0x3e5a91=_0x4a9c3b[_0x7681('0x73')]()[_0x7681('0x41')](_0x7681('0x74'));if(_0x16fbc5[_0x7681('0x3c')]){_0x16fbc5['order'][_0x7681('0x50')](function(_0x3bcfbf){_0x4a9c3b[_0x7681('0x3c')]('c.'+_0x3bcfbf[0x0],_0x3bcfbf[0x1]===_0x7681('0x75')?![]:!![]);});}if(!_[_0x7681('0x5f')](_0x240fa7)){_0x4a9c3b[_0x7681('0x76')](_0x20b518);_0x3e5a91['where']('t.id\x20IN\x20?',_0x240fa7);}BPromise[_0x7681('0x77')]()[_0x7681('0x27')](function(){if(!_0x3bddb9)return;if(_0x4e2e8d[_0x7681('0x78')]['role']!==_0x7681('0x79'))return;if(!_[_0x7681('0x7a')](_0x3bddb9[_0x7681('0x4c')],[_0x7681('0x41'),_0x7681('0x53')])){return _0x4e2e8d['user'][_0x7681('0x7b')]({'attributes':['id'],'raw':!![]})[_0x7681('0x27')](function(_0x3f850e){if(_['isEmpty'](_0x3f850e)){_0x3e5a91[_0x7681('0x3e')]('c.ListId\x20IS\x20NULL');_0x4a9c3b['where'](_0x7681('0x7c'));}else{_0x3e5a91[_0x7681('0x3e')]('c.ListId\x20IN\x20?',_['map'](_0x3f850e,'id'));_0x4a9c3b[_0x7681('0x3e')](_0x7681('0x61'),_['map'](_0x3f850e,'id'));}});}})[_0x7681('0x27')](function(){if(_0x4e2e8d[_0x7681('0x78')][_0x7681('0x7d')]===_0x7681('0x79')&&!_0x3bddb9&&!_0x4e2e8d[_0x7681('0x36')]['ListId'])return[];return db['sequelize'][_0x7681('0x36')](_0x3e5a91[_0x7681('0x7e')](),_0x1bc6d4);})[_0x7681('0x27')](function(_0x1d6897){_0x1bedbf[_0x7681('0x7f')]=_0x1d6897[_0x7681('0x33')];if(_0x1bedbf['count']===0x0)return[];return db[_0x7681('0x80')][_0x7681('0x36')](_0x1656ff[_0x7681('0x7e')](),_0x1bc6d4)[_0x7681('0x27')](function(_0x59c8ad){_0x2643c8=_[_0x7681('0x81')](_0x59c8ad,'id');_0x1bc6d4=_[_0x7681('0x82')](_0x1bc6d4,{'model':db[_0x7681('0x83')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e2e8d['query'][_0x7681('0x39')]){_0x16fbc5[_0x7681('0x3a')][_0x7681('0x50')](function(_0x2d1f7d){_0x4a9c3b[_0x7681('0x41')]('c.'+_0x2d1f7d);});}else{_0x4a9c3b[_0x7681('0x41')](_0x7681('0x74'));_0x4a9c3b[_0x7681('0x41')](_0x7681('0x84'));_0x4a9c3b['field'](_0x7681('0x85'));_0x4a9c3b[_0x7681('0x41')](_0x7681('0x86'));_0x4a9c3b[_0x7681('0x41')](_0x7681('0x87'));_0x4a9c3b[_0x7681('0x41')](_0x7681('0x88'));_0x4a9c3b['field'](_0x7681('0x89'));_0x4a9c3b['field'](_0x7681('0x8a'));_0x4a9c3b[_0x7681('0x41')](_0x7681('0x8b'));_0x4a9c3b[_0x7681('0x41')]('c.deletedAt');_0x4a9c3b[_0x7681('0x41')]('c.CompanyId');_0x4a9c3b[_0x7681('0x41')](_0x7681('0x8c'),_0x7681('0x8d'));}if(_0x16fbc5[_0x7681('0x3b')])_0x4a9c3b[_0x7681('0x3b')](_0x16fbc5[_0x7681('0x3b')]);if(_0x16fbc5[_0x7681('0x23')])_0x4a9c3b[_0x7681('0x23')](_0x16fbc5['offset']);return db[_0x7681('0x80')]['query'](_0x4a9c3b[_0x7681('0x7e')](),_0x1bc6d4);});})[_0x7681('0x27')](function(_0x101d2b){_0x101d2b[_0x7681('0x50')](function(_0x1c7e1f){if(_0x1c7e1f[_0x7681('0x8d')]){_0x1c7e1f[_0x7681('0x8e')]=[];_0x1c7e1f['TagIds'][_0x7681('0x4e')](',')[_0x7681('0x50')](function(_0x346b4b){_0x1c7e1f[_0x7681('0x8e')][_0x7681('0x2e')](_0x2643c8[_0x346b4b]);});}delete _0x1c7e1f[_0x7681('0x8d')];});_0x1bedbf[_0x7681('0x8f')]=_0x101d2b;return _0x1bedbf;})[_0x7681('0x27')](respondWithFilteredResult(_0x5962d5,_0x16fbc5));})[_0x7681('0x90')](handleError(_0x5962d5,null));};exports[_0x7681('0x28')]=function(_0x207c21,_0x193341){return db['CmContact'][_0x7681('0x91')]({'where':{'id':_0x207c21['params']['id']}})[_0x7681('0x27')](handleEntityNotFound(_0x193341,null))[_0x7681('0x27')](removeEntity(_0x193341,null))[_0x7681('0x90')](handleError(_0x193341,null));};exports[_0x7681('0x2c')]=function(_0x17d00d,_0x4a8acc){return db[_0x7681('0x83')][_0x7681('0x2c')]()[_0x7681('0x27')](function(_0x2aef99){delete _0x2aef99[_0x7681('0x92')];for(var _0x3306b9=0x0;_0x3306b9{}\s\\|]/g,'-');_0x102ef9(null,util[_0x44b8('0x19')](_0x44b8('0x1a'),path[_0x44b8('0x1b')](_0x235bdc[_0x44b8('0x17')],path['extname'](_0x235bdc[_0x44b8('0x17')])),Date[_0x44b8('0x1c')](),path[_0x44b8('0x1d')](_0x235bdc[_0x44b8('0x17')])));}})});router[_0x44b8('0x12')]('/csv',upload[_0x44b8('0x1e')]('file'),controller[_0x44b8('0x1f')]);var upload=multer({'storage':multer[_0x44b8('0x14')]({'destination':function(_0x25a0c1,_0x47689e,_0x230a3d){_0x230a3d(null,path['join'](config[_0x44b8('0x15')],'server/files/tmp'));},'filename':function(_0x41d673,_0x350482,_0x549a26){_0x350482[_0x44b8('0x17')]=_0x350482[_0x44b8('0x17')][_0x44b8('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x549a26(null,util['format'](_0x44b8('0x1a'),path[_0x44b8('0x1b')](_0x350482['originalname'],path[_0x44b8('0x1d')](_0x350482['originalname'])),Date[_0x44b8('0x1c')](),path['extname'](_0x350482['originalname'])));}})});router['post'](_0x44b8('0x20'),upload[_0x44b8('0x1e')](_0x44b8('0x21')),controller[_0x44b8('0x22')]);router[_0x44b8('0x12')](_0x44b8('0x23'),auth[_0x44b8('0x7')](),controller[_0x44b8('0x24')]);router[_0x44b8('0x25')](_0x44b8('0x26'),auth[_0x44b8('0x7')](),controller[_0x44b8('0x27')]);router[_0x44b8('0x28')]('/:id',auth[_0x44b8('0x7')](),controller['destroy']);module[_0x44b8('0x29')]=router; \ No newline at end of file +var _0x5d17=['/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','/merge','merge','create','post','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','format','%s-%s%s','extname','now','/csv','uploadCsv','root','replace','/upload','single','file','upload','/upload/:id','import','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x5d17,0x114));var _0x75d1=function(_0x11e1ab,_0x4bb093){_0x11e1ab=_0x11e1ab-0x0;var _0x530ca0=_0x5d17[_0x11e1ab];return _0x530ca0;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0x7')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['show']);router['get'](_0x75d1('0xc'),auth['isAuthenticated'](),controller['getTags']);router[_0x75d1('0x7')](_0x75d1('0xd'),auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x7')](_0x75d1('0xf'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x10')]);router[_0x75d1('0x7')]('/:id/hopper_finals',auth[_0x75d1('0x8')](),controller[_0x75d1('0x11')]);router[_0x75d1('0x7')](_0x75d1('0x12'),auth['isAuthenticated'](),controller['getJscriptySessions']);router['post'](_0x75d1('0x13'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x14')]);router['post']('/',auth[_0x75d1('0x8')](),controller[_0x75d1('0x15')]);router[_0x75d1('0x16')](_0x75d1('0x17'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x18')]);router[_0x75d1('0x16')](_0x75d1('0xc'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x19')]);var upload=multer({'storage':multer[_0x75d1('0x1a')]({'destination':function(_0x5761db,_0x493fff,_0xc6b282){_0xc6b282(null,path[_0x75d1('0x1b')](config['root'],_0x75d1('0x1c')));},'filename':function(_0x406143,_0x579731,_0xf6cc70){_0x579731[_0x75d1('0x1d')]=_0x579731[_0x75d1('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf6cc70(null,util[_0x75d1('0x1e')](_0x75d1('0x1f'),path['basename'](_0x579731[_0x75d1('0x1d')],path[_0x75d1('0x20')](_0x579731['originalname'])),Date[_0x75d1('0x21')](),path['extname'](_0x579731[_0x75d1('0x1d')])));}})});router[_0x75d1('0x16')](_0x75d1('0x22'),upload['single']('file'),controller[_0x75d1('0x23')]);var upload=multer({'storage':multer[_0x75d1('0x1a')]({'destination':function(_0x315ce5,_0x18184b,_0x51d043){_0x51d043(null,path[_0x75d1('0x1b')](config[_0x75d1('0x24')],_0x75d1('0x1c')));},'filename':function(_0x51138e,_0x54095d,_0x57efd6){_0x54095d[_0x75d1('0x1d')]=_0x54095d[_0x75d1('0x1d')][_0x75d1('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57efd6(null,util[_0x75d1('0x1e')](_0x75d1('0x1f'),path['basename'](_0x54095d['originalname'],path[_0x75d1('0x20')](_0x54095d[_0x75d1('0x1d')])),Date['now'](),path[_0x75d1('0x20')](_0x54095d['originalname'])));}})});router[_0x75d1('0x16')](_0x75d1('0x26'),upload[_0x75d1('0x27')](_0x75d1('0x28')),controller[_0x75d1('0x29')]);router['post'](_0x75d1('0x2a'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x2b')]);router[_0x75d1('0x2c')]('/:id',auth[_0x75d1('0x8')](),controller['update']);router[_0x75d1('0x2d')](_0x75d1('0xb'),auth['isAuthenticated'](),controller[_0x75d1('0x2e')]);module[_0x75d1('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0331bd7..faddd61 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 _0xb2ff=['ENUM','voice','sequelize','lodash','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','long','type','select','parse','values','stringify','BOOLEAN'];(function(_0x4560a1,_0x3eeb66){var _0x230fd5=function(_0x303b87){while(--_0x303b87){_0x4560a1['push'](_0x4560a1['shift']());}};_0x230fd5(++_0x3eeb66);}(_0xb2ff,0x123));var _0xfb2f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2ff[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xfb2f('0x0'));var _=require(_0xfb2f('0x1'));module['exports']={'name':{'type':Sequelize[_0xfb2f('0x2')],'get':function(_0x54e80d){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xfb2f('0x3')],'allowNull':![],'set':function(_0x484368){this[_0xfb2f('0x4')](_0xfb2f('0x5'),_0x484368?_0x484368:this[_0xfb2f('0x6')](_0xfb2f('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xfb2f('0x8')),'get':function(){if(this['getDataValue'](_0xfb2f('0x9'))===_0xfb2f('0xa')){return JSON[_0xfb2f('0xb')](this[_0xfb2f('0x6')]('values'));}else{return this[_0xfb2f('0x6')]('values');}},'set':function(_0x149222){if(Array['isArray'](_0x149222)){this[_0xfb2f('0x4')](_0xfb2f('0xc'),JSON[_0xfb2f('0xd')](_0x149222));}else{this[_0xfb2f('0x4')](_0xfb2f('0xc'),_0x149222);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xfb2f('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfb2f('0xf')](_0xfb2f('0x10'))}}; \ No newline at end of file +var _0xff96=['stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','type','select','parse','values','isArray'];(function(_0x101b9e,_0x3c9844){var _0x525949=function(_0x44e46d){while(--_0x44e46d){_0x101b9e['push'](_0x101b9e['shift']());}};_0x525949(++_0x3c9844);}(_0xff96,0x179));var _0x6ff9=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xff96[_0x8ae98b];return _0xc30bd4;};'use strict';var Sequelize=require(_0x6ff9('0x0'));var _=require(_0x6ff9('0x1'));module[_0x6ff9('0x2')]={'name':{'type':Sequelize[_0x6ff9('0x3')],'get':function(_0xa3cf6b){return this[_0x6ff9('0x4')](_0x6ff9('0x5'));}},'alias':{'type':Sequelize[_0x6ff9('0x6')],'allowNull':![],'set':function(_0x3561d7){this[_0x6ff9('0x7')](_0x6ff9('0x5'),_0x3561d7?_0x3561d7:this[_0x6ff9('0x4')]('name'));}},'type':{'type':Sequelize[_0x6ff9('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0x6ff9('0x8'))===_0x6ff9('0x9')){return JSON[_0x6ff9('0xa')](this[_0x6ff9('0x4')](_0x6ff9('0xb')));}else{return this[_0x6ff9('0x4')]('values');}},'set':function(_0x27aab4){if(Array[_0x6ff9('0xc')](_0x27aab4)){this[_0x6ff9('0x7')](_0x6ff9('0xb'),JSON[_0x6ff9('0xd')](_0x27aab4));}else{this[_0x6ff9('0x7')](_0x6ff9('0xb'),_0x27aab4);}}},'required':{'type':Sequelize[_0x6ff9('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6ff9('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index e59a1c3..188da1f 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 _0xee14=['switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','length','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','text','number'];(function(_0x133eee,_0x148078){var _0x3491d8=function(_0xa699b3){while(--_0xa699b3){_0x133eee['push'](_0x133eee['shift']());}};_0x3491d8(++_0x148078);}(_0xee14,0x166));var _0x4ee1=function(_0x5a3a79,_0x52a114){_0x5a3a79=_0x5a3a79-0x0;var _0x126124=_0xee14[_0x5a3a79];return _0x126124;};'use strict';var pdf=require(_0x4ee1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ee1('0x1'));var zipdir=require(_0x4ee1('0x2'));var jsonpatch=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var moment=require('moment');var BPromise=require(_0x4ee1('0x5'));var Mustache=require(_0x4ee1('0x6'));var util=require(_0x4ee1('0x7'));var path=require(_0x4ee1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require(_0x4ee1('0x10'));var Papa=require(_0x4ee1('0x11'));var Redis=require(_0x4ee1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))(_0x4ee1('0x16'));var utils=require(_0x4ee1('0x17'));var config=require(_0x4ee1('0x18'));var licenseUtil=require(_0x4ee1('0x19'));var db=require(_0x4ee1('0x1a'))['db'];function respondWithStatusCode(_0x5e9120,_0x43e2c3){_0x43e2c3=_0x43e2c3||0xcc;return function(_0x1a21e6){if(_0x1a21e6){return _0x5e9120[_0x4ee1('0x1b')](_0x43e2c3);}return _0x5e9120['status'](_0x43e2c3)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x413418,_0x49741d){_0x49741d=_0x49741d||0xc8;return function(_0x4a5bd1){if(_0x4a5bd1){return _0x413418[_0x4ee1('0x1d')](_0x49741d)[_0x4ee1('0x1e')](_0x4a5bd1);}};}function respondWithFilteredResult(_0xf46c89,_0x227b0b){return function(_0x6ff309){if(_0x6ff309){var _0x428d67=_0x6ff309[_0x4ee1('0x1f')],_0x5253f2=_0x227b0b[_0x4ee1('0x20')],_0x58f8c8=_0x227b0b[_0x4ee1('0x20')]+_0x227b0b[_0x4ee1('0x21')],_0x5e5738;if(_0x58f8c8>=_0x428d67){_0x58f8c8=_0x428d67;_0x5e5738=0xc8;}else{_0x5e5738=0xce;}_0xf46c89[_0x4ee1('0x1d')](_0x5e5738);return _0xf46c89['set'](_0x4ee1('0x22'),_0x5253f2+'-'+_0x58f8c8+'/'+_0x428d67)[_0x4ee1('0x1e')](_0x6ff309);}return null;};}function patchUpdates(_0x343953){return function(_0x583ae5){try{jsonpatch[_0x4ee1('0x23')](_0x583ae5,_0x343953,!![]);}catch(_0x493323){return BPromise['reject'](_0x493323);}return _0x583ae5[_0x4ee1('0x24')]();};}function saveUpdates(_0x3d7e0f,_0x519d5e){return function(_0x400e95){if(_0x400e95){return _0x400e95[_0x4ee1('0x25')](_0x3d7e0f)[_0x4ee1('0x26')](function(_0x4bed28){return _0x4bed28;});}return null;};}function removeEntity(_0x2a0231,_0x24e8e2){return function(_0x5adecd){if(_0x5adecd){return _0x5adecd[_0x4ee1('0x27')]()[_0x4ee1('0x26')](function(){_0x2a0231[_0x4ee1('0x1d')](0xcc)[_0x4ee1('0x1c')]();});}};}function handleEntityNotFound(_0x600fc1,_0x42559a){return function(_0xc5d74e){if(!_0xc5d74e){_0x600fc1[_0x4ee1('0x1b')](0x194);}return _0xc5d74e;};}function handleError(_0x3b11d0,_0x4c9ff1){_0x4c9ff1=_0x4c9ff1||0x1f4;return function(_0x3799ab){logger['error'](_0x3799ab[_0x4ee1('0x28')]);if(_0x3799ab[_0x4ee1('0x29')]){delete _0x3799ab['name'];}_0x3b11d0['status'](_0x4c9ff1)[_0x4ee1('0x2a')](_0x3799ab);};}exports[_0x4ee1('0x2b')]=function(_0x29215a,_0x1bd7fd){var _0x287012={},_0xecba4c={},_0x103579={'count':0x0,'rows':[]};var _0x34db26=_[_0x4ee1('0x2c')](db[_0x4ee1('0x2d')][_0x4ee1('0x2e')],function(_0x2434ac){return{'name':_0x2434ac[_0x4ee1('0x2f')],'type':_0x2434ac[_0x4ee1('0x30')]['key']};});_0xecba4c[_0x4ee1('0x31')]=_[_0x4ee1('0x32')](_[_0x4ee1('0x2c')](_0x34db26,_0x4ee1('0x29')),[_0x4ee1('0x29')]);_0xecba4c[_0x4ee1('0x33')]=_['keys'](_0x29215a['query']);_0xecba4c[_0x4ee1('0x34')]=_[_0x4ee1('0x35')](_0xecba4c[_0x4ee1('0x31')],_0xecba4c[_0x4ee1('0x33')]);_0x287012[_0x4ee1('0x36')]=_[_0x4ee1('0x35')](_0xecba4c['model'],qs['fields'](_0x29215a[_0x4ee1('0x33')][_0x4ee1('0x37')]));_0x287012[_0x4ee1('0x36')]=_0x287012[_0x4ee1('0x36')]['length']?_0x287012[_0x4ee1('0x36')]:_0xecba4c[_0x4ee1('0x31')];if(!_0x29215a[_0x4ee1('0x33')][_0x4ee1('0x38')](_0x4ee1('0x39'))){_0x287012[_0x4ee1('0x21')]=qs[_0x4ee1('0x21')](_0x29215a[_0x4ee1('0x33')]['limit']);_0x287012[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x29215a[_0x4ee1('0x33')]['offset']);}_0x287012[_0x4ee1('0x3a')]=qs[_0x4ee1('0x3b')](_0x29215a[_0x4ee1('0x33')][_0x4ee1('0x3b')]);_0x287012[_0x4ee1('0x3c')]=qs[_0x4ee1('0x34')](_['pick'](_0x29215a['query'],_0xecba4c[_0x4ee1('0x34')]),_0x34db26);if(_0x29215a[_0x4ee1('0x33')][_0x4ee1('0x3d')]){_0x287012[_0x4ee1('0x3c')]=_[_0x4ee1('0x3e')](_0x287012[_0x4ee1('0x3c')],{'$or':_[_0x4ee1('0x2c')](_0x34db26,function(_0x3a3ac3){if(_0x3a3ac3['type']!==_0x4ee1('0x3f')){var _0x2d5609={};_0x2d5609[_0x3a3ac3[_0x4ee1('0x29')]]={'$like':'%'+_0x29215a[_0x4ee1('0x33')][_0x4ee1('0x3d')]+'%'};return _0x2d5609;}})});}_0x287012=_['merge']({},_0x287012,_0x29215a[_0x4ee1('0x40')]);var _0x37f548={'where':_0x287012['where']};return db[_0x4ee1('0x2d')][_0x4ee1('0x1f')](_0x37f548)[_0x4ee1('0x26')](function(_0x691b94){_0x103579['count']=_0x691b94;if(_0x29215a[_0x4ee1('0x33')][_0x4ee1('0x41')]){_0x287012[_0x4ee1('0x42')]=[{'all':!![]}];}return db[_0x4ee1('0x2d')][_0x4ee1('0x43')](_0x287012);})['then'](function(_0x116d42){_0x103579[_0x4ee1('0x44')]=_0x116d42;return _0x103579;})[_0x4ee1('0x26')](respondWithFilteredResult(_0x1bd7fd,_0x287012))['catch'](handleError(_0x1bd7fd,null));};exports['show']=function(_0x507a0f,_0x52c22a){var _0x3579f6={'raw':!![],'where':{'id':_0x507a0f[_0x4ee1('0x45')]['id']}},_0x1edef1={};_0x1edef1[_0x4ee1('0x31')]=_[_0x4ee1('0x46')](db[_0x4ee1('0x2d')][_0x4ee1('0x2e')]);_0x1edef1[_0x4ee1('0x33')]=_['keys'](_0x507a0f[_0x4ee1('0x33')]);_0x1edef1[_0x4ee1('0x34')]=_[_0x4ee1('0x35')](_0x1edef1[_0x4ee1('0x31')],_0x1edef1['query']);_0x3579f6[_0x4ee1('0x36')]=_[_0x4ee1('0x35')](_0x1edef1['model'],qs[_0x4ee1('0x37')](_0x507a0f[_0x4ee1('0x33')][_0x4ee1('0x37')]));_0x3579f6[_0x4ee1('0x36')]=_0x3579f6['attributes'][_0x4ee1('0x47')]?_0x3579f6['attributes']:_0x1edef1[_0x4ee1('0x31')];if(_0x507a0f[_0x4ee1('0x33')][_0x4ee1('0x41')]){_0x3579f6[_0x4ee1('0x42')]=[{'all':!![]}];}_0x3579f6=_[_0x4ee1('0x3e')]({},_0x3579f6,_0x507a0f[_0x4ee1('0x40')]);return db[_0x4ee1('0x2d')][_0x4ee1('0x48')](_0x3579f6)[_0x4ee1('0x26')](handleEntityNotFound(_0x52c22a,null))[_0x4ee1('0x26')](respondWithResult(_0x52c22a,null))[_0x4ee1('0x49')](handleError(_0x52c22a,null));};exports[_0x4ee1('0x25')]=function(_0x396983,_0x27b452){if(_0x396983[_0x4ee1('0x4a')]['id']){delete _0x396983[_0x4ee1('0x4a')]['id'];}return db[_0x4ee1('0x2d')][_0x4ee1('0x48')]({'where':{'id':_0x396983['params']['id']}})[_0x4ee1('0x26')](handleEntityNotFound(_0x27b452,null))[_0x4ee1('0x26')](saveUpdates(_0x396983[_0x4ee1('0x4a')],null))[_0x4ee1('0x26')](respondWithResult(_0x27b452,null))[_0x4ee1('0x49')](handleError(_0x27b452,null));};exports[_0x4ee1('0x27')]=function(_0x29503b,_0x29bb07){return db[_0x4ee1('0x2d')]['find']({'where':{'id':_0x29503b[_0x4ee1('0x45')]['id']}})[_0x4ee1('0x26')](handleEntityNotFound(_0x29bb07,null))['then'](removeEntity(_0x29bb07,null))['catch'](handleError(_0x29bb07,null));};exports[_0x4ee1('0x4b')]=function(_0x399613,_0x7e503d){var _0x1988c1;return db[_0x4ee1('0x4c')][_0x4ee1('0x4d')](function(_0x204497){return db[_0x4ee1('0x2d')]['create'](_0x399613[_0x4ee1('0x4a')],{'transaction':_0x204497})['then'](function(_0x405e2b){_0x1988c1=_0x405e2b;var _0x7988c3={'type':db[_0x4ee1('0x4e')][_0x4ee1('0x4f')],'transaction':_0x204497};switch(_0x399613['body'][_0x4ee1('0x30')]){case _0x4ee1('0x50'):_0x7988c3[_0x4ee1('0x30')]=db[_0x4ee1('0x4e')][_0x4ee1('0x4f')];break;case _0x4ee1('0x51'):_0x7988c3[_0x4ee1('0x30')]=db[_0x4ee1('0x4e')]['INTEGER'];break;case _0x4ee1('0x52'):_0x7988c3[_0x4ee1('0x30')]=db[_0x4ee1('0x4e')]['BOOLEAN'];_0x7988c3[_0x4ee1('0x53')]=![];break;default:}return db[_0x4ee1('0x4c')][_0x4ee1('0x54')][_0x4ee1('0x55')](_0x4ee1('0x56'),util['format'](_0x4ee1('0x57'),_0x1988c1['id']),_0x7988c3);})[_0x4ee1('0x26')](function(){return _0x1988c1;});})[_0x4ee1('0x26')](respondWithResult(_0x7e503d,0xc9))[_0x4ee1('0x49')](handleError(_0x7e503d,null));}; \ No newline at end of file +var _0x55d2=['crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','keys','fields','includeAll','find','update','body','params','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0x55d2,0x9f));var _0x255d=function(_0x586cab,_0x5b0d02){_0x586cab=_0x586cab-0x0;var _0x15a859=_0x55d2[_0x586cab];return _0x15a859;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x255d('0x0'));var zipdir=require(_0x255d('0x1'));var jsonpatch=require(_0x255d('0x2'));var rp=require(_0x255d('0x3'));var moment=require(_0x255d('0x4'));var BPromise=require(_0x255d('0x5'));var Mustache=require('mustache');var util=require(_0x255d('0x6'));var path=require(_0x255d('0x7'));var sox=require(_0x255d('0x8'));var csv=require(_0x255d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x255d('0xa'));var crypto=require(_0x255d('0xb'));var jsforce=require(_0x255d('0xc'));var deskjs=require(_0x255d('0xd'));var toCsv=require(_0x255d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x255d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x255d('0xf'));var logger=require(_0x255d('0x10'))(_0x255d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x255d('0x12'));var db=require(_0x255d('0x13'))['db'];function respondWithStatusCode(_0x8d6d98,_0xcf1cb3){_0xcf1cb3=_0xcf1cb3||0xcc;return function(_0xf8abb3){if(_0xf8abb3){return _0x8d6d98[_0x255d('0x14')](_0xcf1cb3);}return _0x8d6d98[_0x255d('0x15')](_0xcf1cb3)[_0x255d('0x16')]();};}function respondWithResult(_0xce7ab2,_0x2b21fd){_0x2b21fd=_0x2b21fd||0xc8;return function(_0xbb7a35){if(_0xbb7a35){return _0xce7ab2[_0x255d('0x15')](_0x2b21fd)[_0x255d('0x17')](_0xbb7a35);}};}function respondWithFilteredResult(_0x500002,_0x29bf44){return function(_0x1be65e){if(_0x1be65e){var _0x58f0fa=_0x1be65e[_0x255d('0x18')],_0x477c48=_0x29bf44[_0x255d('0x19')],_0x19497c=_0x29bf44[_0x255d('0x19')]+_0x29bf44[_0x255d('0x1a')],_0x37c217;if(_0x19497c>=_0x58f0fa){_0x19497c=_0x58f0fa;_0x37c217=0xc8;}else{_0x37c217=0xce;}_0x500002[_0x255d('0x15')](_0x37c217);return _0x500002[_0x255d('0x1b')](_0x255d('0x1c'),_0x477c48+'-'+_0x19497c+'/'+_0x58f0fa)['json'](_0x1be65e);}return null;};}function patchUpdates(_0x164254){return function(_0x46b939){try{jsonpatch[_0x255d('0x1d')](_0x46b939,_0x164254,!![]);}catch(_0x3b4b3c){return BPromise[_0x255d('0x1e')](_0x3b4b3c);}return _0x46b939[_0x255d('0x1f')]();};}function saveUpdates(_0x417079,_0x24b7b9){return function(_0x2c8839){if(_0x2c8839){return _0x2c8839['update'](_0x417079)[_0x255d('0x20')](function(_0x1b23af){return _0x1b23af;});}return null;};}function removeEntity(_0x3aa6d9,_0x288175){return function(_0xb9d98e){if(_0xb9d98e){return _0xb9d98e[_0x255d('0x21')]()[_0x255d('0x20')](function(){_0x3aa6d9[_0x255d('0x15')](0xcc)[_0x255d('0x16')]();});}};}function handleEntityNotFound(_0x35e396,_0x29291f){return function(_0x37e01e){if(!_0x37e01e){_0x35e396[_0x255d('0x14')](0x194);}return _0x37e01e;};}function handleError(_0x1b9e0a,_0x3d7126){_0x3d7126=_0x3d7126||0x1f4;return function(_0x17f38b){logger[_0x255d('0x22')](_0x17f38b[_0x255d('0x23')]);if(_0x17f38b[_0x255d('0x24')]){delete _0x17f38b['name'];}_0x1b9e0a[_0x255d('0x15')](_0x3d7126)[_0x255d('0x25')](_0x17f38b);};}exports[_0x255d('0x26')]=function(_0x22c91b,_0x38818f){var _0x369d65={},_0x56f124={},_0x7da738={'count':0x0,'rows':[]};var _0x53d0e4=_[_0x255d('0x27')](db[_0x255d('0x28')][_0x255d('0x29')],function(_0x547502){return{'name':_0x547502[_0x255d('0x2a')],'type':_0x547502[_0x255d('0x2b')][_0x255d('0x2c')]};});_0x56f124[_0x255d('0x2d')]=_[_0x255d('0x2e')](_[_0x255d('0x27')](_0x53d0e4,'name'),[_0x255d('0x24')]);_0x56f124['query']=_['keys'](_0x22c91b[_0x255d('0x2f')]);_0x56f124[_0x255d('0x30')]=_[_0x255d('0x31')](_0x56f124[_0x255d('0x2d')],_0x56f124['query']);_0x369d65[_0x255d('0x32')]=_[_0x255d('0x31')](_0x56f124[_0x255d('0x2d')],qs['fields'](_0x22c91b[_0x255d('0x2f')]['fields']));_0x369d65['attributes']=_0x369d65[_0x255d('0x32')][_0x255d('0x33')]?_0x369d65[_0x255d('0x32')]:_0x56f124[_0x255d('0x2d')];if(!_0x22c91b[_0x255d('0x2f')]['hasOwnProperty'](_0x255d('0x34'))){_0x369d65['limit']=qs[_0x255d('0x1a')](_0x22c91b[_0x255d('0x2f')][_0x255d('0x1a')]);_0x369d65[_0x255d('0x19')]=qs['offset'](_0x22c91b['query']['offset']);}_0x369d65['order']=qs[_0x255d('0x35')](_0x22c91b['query'][_0x255d('0x35')]);_0x369d65['where']=qs[_0x255d('0x30')](_[_0x255d('0x36')](_0x22c91b['query'],_0x56f124[_0x255d('0x30')]),_0x53d0e4);if(_0x22c91b[_0x255d('0x2f')][_0x255d('0x37')]){_0x369d65[_0x255d('0x38')]=_[_0x255d('0x39')](_0x369d65[_0x255d('0x38')],{'$or':_[_0x255d('0x27')](_0x53d0e4,function(_0x1af321){if(_0x1af321['type']!==_0x255d('0x3a')){var _0x40b498={};_0x40b498[_0x1af321[_0x255d('0x24')]]={'$like':'%'+_0x22c91b['query'][_0x255d('0x37')]+'%'};return _0x40b498;}})});}_0x369d65=_[_0x255d('0x39')]({},_0x369d65,_0x22c91b[_0x255d('0x3b')]);var _0x33b691={'where':_0x369d65['where']};return db['CmCustomField']['count'](_0x33b691)[_0x255d('0x20')](function(_0x1046f2){_0x7da738['count']=_0x1046f2;if(_0x22c91b[_0x255d('0x2f')]['includeAll']){_0x369d65[_0x255d('0x3c')]=[{'all':!![]}];}return db[_0x255d('0x28')][_0x255d('0x3d')](_0x369d65);})[_0x255d('0x20')](function(_0x583b14){_0x7da738['rows']=_0x583b14;return _0x7da738;})[_0x255d('0x20')](respondWithFilteredResult(_0x38818f,_0x369d65))[_0x255d('0x3e')](handleError(_0x38818f,null));};exports[_0x255d('0x3f')]=function(_0x50f87f,_0x403288){var _0x158ac5={'raw':!![],'where':{'id':_0x50f87f['params']['id']}},_0x4cf66f={};_0x4cf66f['model']=_[_0x255d('0x40')](db[_0x255d('0x28')][_0x255d('0x29')]);_0x4cf66f[_0x255d('0x2f')]=_[_0x255d('0x40')](_0x50f87f[_0x255d('0x2f')]);_0x4cf66f['filters']=_['intersection'](_0x4cf66f[_0x255d('0x2d')],_0x4cf66f[_0x255d('0x2f')]);_0x158ac5[_0x255d('0x32')]=_[_0x255d('0x31')](_0x4cf66f['model'],qs[_0x255d('0x41')](_0x50f87f[_0x255d('0x2f')][_0x255d('0x41')]));_0x158ac5[_0x255d('0x32')]=_0x158ac5['attributes']['length']?_0x158ac5[_0x255d('0x32')]:_0x4cf66f[_0x255d('0x2d')];if(_0x50f87f[_0x255d('0x2f')][_0x255d('0x42')]){_0x158ac5['include']=[{'all':!![]}];}_0x158ac5=_[_0x255d('0x39')]({},_0x158ac5,_0x50f87f[_0x255d('0x3b')]);return db[_0x255d('0x28')][_0x255d('0x43')](_0x158ac5)[_0x255d('0x20')](handleEntityNotFound(_0x403288,null))[_0x255d('0x20')](respondWithResult(_0x403288,null))[_0x255d('0x3e')](handleError(_0x403288,null));};exports[_0x255d('0x44')]=function(_0x3618f7,_0x384241){if(_0x3618f7[_0x255d('0x45')]['id']){delete _0x3618f7[_0x255d('0x45')]['id'];}return db['CmCustomField'][_0x255d('0x43')]({'where':{'id':_0x3618f7[_0x255d('0x46')]['id']}})[_0x255d('0x20')](handleEntityNotFound(_0x384241,null))[_0x255d('0x20')](saveUpdates(_0x3618f7[_0x255d('0x45')],null))[_0x255d('0x20')](respondWithResult(_0x384241,null))['catch'](handleError(_0x384241,null));};exports['destroy']=function(_0x2911d2,_0x154474){return db[_0x255d('0x28')][_0x255d('0x43')]({'where':{'id':_0x2911d2['params']['id']}})['then'](handleEntityNotFound(_0x154474,null))['then'](removeEntity(_0x154474,null))['catch'](handleError(_0x154474,null));};exports['create']=function(_0xfb1b81,_0x389430){var _0x187857;return db['sequelize'][_0x255d('0x47')](function(_0x1f761b){return db['CmCustomField']['create'](_0xfb1b81['body'],{'transaction':_0x1f761b})['then'](function(_0x4da302){_0x187857=_0x4da302;var _0x5a74f4={'type':db[_0x255d('0x48')][_0x255d('0x49')],'transaction':_0x1f761b};switch(_0xfb1b81[_0x255d('0x45')][_0x255d('0x2b')]){case _0x255d('0x4a'):_0x5a74f4['type']=db[_0x255d('0x48')]['TEXT'];break;case _0x255d('0x4b'):_0x5a74f4[_0x255d('0x2b')]=db[_0x255d('0x48')][_0x255d('0x4c')];break;case'switch':_0x5a74f4['type']=db[_0x255d('0x48')][_0x255d('0x4d')];_0x5a74f4[_0x255d('0x4e')]=![];break;default:}return db[_0x255d('0x4f')][_0x255d('0x50')][_0x255d('0x51')](_0x255d('0x52'),util[_0x255d('0x53')](_0x255d('0x54'),_0x187857['id']),_0x5a74f4);})['then'](function(){return _0x187857;});})['then'](respondWithResult(_0x389430,0xc9))[_0x255d('0x3e')](handleError(_0x389430,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e867c94..ec6af48 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 _0xc2e7=['request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','api','moment'];(function(_0x5ecfbe,_0x3a0123){var _0x2b43d8=function(_0x5ce93a){while(--_0x5ce93a){_0x5ecfbe['push'](_0x5ecfbe['shift']());}};_0x2b43d8(++_0x3a0123);}(_0xc2e7,0x193));var _0x7c2e=function(_0x2617d6,_0x71cb97){_0x2617d6=_0x2617d6-0x0;var _0x25b98c=_0xc2e7[_0x2617d6];return _0x25b98c;};'use strict';var _=require(_0x7c2e('0x0'));var util=require(_0x7c2e('0x1'));var logger=require(_0x7c2e('0x2'))(_0x7c2e('0x3'));var moment=require(_0x7c2e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7c2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c2e('0x6'));var config=require(_0x7c2e('0x7'));var attributes=require(_0x7c2e('0x8'));module[_0x7c2e('0x9')]=function(_0x467048,_0x33884e){return _0x467048[_0x7c2e('0xa')]('CmCustomField',attributes,{'tableName':_0x7c2e('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf718=['CmCustomField','cm_custom_fields','lodash','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x11666b,_0x26a7a7){var _0x26cd2e=function(_0x3913af){while(--_0x3913af){_0x11666b['push'](_0x11666b['shift']());}};_0x26cd2e(++_0x26a7a7);}(_0xf718,0xea));var _0x8f71=function(_0x2f81ed,_0x518ceb){_0x2f81ed=_0x2f81ed-0x0;var _0x4774c9=_0xf718[_0x2f81ed];return _0x4774c9;};'use strict';var _=require(_0x8f71('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f71('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f71('0x2'));var config=require(_0x8f71('0x3'));var attributes=require(_0x8f71('0x4'));module[_0x8f71('0x5')]=function(_0x548114,_0x3cc99b){return _0x548114['define'](_0x8f71('0x6'),attributes,{'tableName':_0x8f71('0x7'),'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 83b2310..4ed84a7 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 _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x4d3a16,_0x4e33f7){var _0x435380=function(_0x3e1209){while(--_0x3e1209){_0x4d3a16['push'](_0x4d3a16['shift']());}};_0x435380(++_0x4e33f7);}(_0x702d,0x147));var _0xd702=function(_0x2be126,_0x31973e){_0x2be126=_0x2be126-0x0;var _0x822b7c=_0x702d[_0x2be126];return _0x822b7c;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file +var _0xb458=['CmCustomField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb458,0x103));var _0x8b45=function(_0x305713,_0x1e0011){_0x305713=_0x305713-0x0;var _0x4483bc=_0xb458[_0x305713];return _0x4483bc;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c4a6a71..943ab7d 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 _0x3458=['delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x2c763a,_0x418572){var _0x407288=function(_0x235925){while(--_0x235925){_0x2c763a['push'](_0x2c763a['shift']());}};_0x407288(++_0x418572);}(_0x3458,0x92));var _0x8345=function(_0x2741d1,_0x501426){_0x2741d1=_0x2741d1-0x0;var _0x521e37=_0x3458[_0x2741d1];return _0x521e37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8345('0x0'));var timeout=require(_0x8345('0x1'));var express=require(_0x8345('0x2'));var router=express['Router']();var auth=require(_0x8345('0x3'));var interaction=require(_0x8345('0x4'));var config=require(_0x8345('0x5'));var controller=require('./cmCustomField.controller');router[_0x8345('0x6')]('/',auth[_0x8345('0x7')](),controller['index']);router[_0x8345('0x6')](_0x8345('0x8'),auth['isAuthenticated'](),controller[_0x8345('0x9')]);router[_0x8345('0xa')]('/',auth['isAuthenticated'](),controller[_0x8345('0xb')]);router[_0x8345('0xc')](_0x8345('0x8'),auth[_0x8345('0x7')](),controller[_0x8345('0xd')]);router[_0x8345('0xe')]('/:id',auth[_0x8345('0x7')](),controller['destroy']);module[_0x8345('0xf')]=router; \ No newline at end of file +var _0x822f=['./cmCustomField.controller','get','index','isAuthenticated','show','create','put','/:id','update','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa2c50f,_0x35d474){var _0x1f71ab=function(_0x3bc8c3){while(--_0x3bc8c3){_0xa2c50f['push'](_0xa2c50f['shift']());}};_0x1f71ab(++_0x35d474);}(_0x822f,0x79));var _0xf822=function(_0xc56dc1,_0x14f572){_0xc56dc1=_0xc56dc1-0x0;var _0x1609db=_0x822f[_0xc56dc1];return _0x1609db;};'use strict';var multer=require(_0xf822('0x0'));var util=require('util');var path=require(_0xf822('0x1'));var timeout=require('connect-timeout');var express=require(_0xf822('0x2'));var router=express[_0xf822('0x3')]();var auth=require(_0xf822('0x4'));var interaction=require(_0xf822('0x5'));var config=require(_0xf822('0x6'));var controller=require(_0xf822('0x7'));router[_0xf822('0x8')]('/',auth['isAuthenticated'](),controller[_0xf822('0x9')]);router[_0xf822('0x8')]('/:id',auth[_0xf822('0xa')](),controller[_0xf822('0xb')]);router['post']('/',auth[_0xf822('0xa')](),controller[_0xf822('0xc')]);router[_0xf822('0xd')](_0xf822('0xe'),auth['isAuthenticated'](),controller[_0xf822('0xf')]);router['delete'](_0xf822('0xe'),auth[_0xf822('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 60a7456..5ffb322 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 _0xee14=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0xee14,0x13a));var _0x4ee1=function(_0x44a16f,_0xe998e0){_0x44a16f=_0x44a16f-0x0;var _0x4af859=_0xee14[_0x44a16f];return _0x4af859;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4ee1('0x0')]={'phone':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x4ee1('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':moment()[_0x4ee1('0x4')](_0x4ee1('0x5'))},'countbusyretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x4ee1('0x6')](0x2)[_0x4ee1('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4ee1('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4ee1('0x6')],'unique':_0x4ee1('0x8')},'ListId':{'type':Sequelize[_0x4ee1('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4ee1('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x4ee1('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4ee1('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ee1('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3435=['moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x57ad9e,_0x1c34ed){var _0x50a7f6=function(_0x2d395c){while(--_0x2d395c){_0x57ad9e['push'](_0x57ad9e['shift']());}};_0x50a7f6(++_0x1c34ed);}(_0x3435,0xfa));var _0x5343=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3435[_0x4ff09b];return _0x3f5c2e;};'use strict';var moment=require(_0x5343('0x0'));var Sequelize=require(_0x5343('0x1'));module[_0x5343('0x2')]={'phone':{'type':Sequelize[_0x5343('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x5343('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5343('0x5')],'defaultValue':moment()['format'](_0x5343('0x6'))},'countbusyretry':{'type':Sequelize[_0x5343('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5343('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5343('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x5343('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5343('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5343('0x7')],'unique':_0x5343('0x9')},'ListId':{'type':Sequelize[_0x5343('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x5343('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x5343('0x9')},'CampaignId':{'type':Sequelize[_0x5343('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x5343('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5343('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5343('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5343('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 93a9bc4..af08729 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 _0xbee0=['sequelize','transaction','direction','prev','isEmpty','hopperIds','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','filters','query','concat','$and','$or','$gte','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$contained','$any','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','include','options','find','create','update','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt'];(function(_0x188832,_0x49101d){var _0x2b990f=function(_0x231635){while(--_0x231635){_0x188832['push'](_0x188832['shift']());}};_0x2b990f(++_0x49101d);}(_0xbee0,0x147));var _0x0bee=function(_0x44c7ae,_0x5f2ea1){_0x44c7ae=_0x44c7ae-0x0;var _0x3cbc95=_0xbee0[_0x44c7ae];return _0x3cbc95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0bee('0x0'));var rimraf=require(_0x0bee('0x1'));var zipdir=require(_0x0bee('0x2'));var jsonpatch=require(_0x0bee('0x3'));var rp=require(_0x0bee('0x4'));var moment=require(_0x0bee('0x5'));var BPromise=require(_0x0bee('0x6'));var Mustache=require(_0x0bee('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bee('0x8'));var ejs=require(_0x0bee('0x9'));var fs=require('fs');var _=require(_0x0bee('0xa'));var squel=require(_0x0bee('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bee('0xc'));var deskjs=require(_0x0bee('0xd'));var toCsv=require(_0x0bee('0x8'));var querystring=require(_0x0bee('0xe'));var Papa=require('papaparse');var Redis=require(_0x0bee('0xf'));var authService=require(_0x0bee('0x10'));var qs=require(_0x0bee('0x11'));var as=require(_0x0bee('0x12'));var hardwareService=require(_0x0bee('0x13'));var logger=require(_0x0bee('0x14'))(_0x0bee('0x15'));var utils=require('../../config/utils');var config=require(_0x0bee('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0bee('0x17'))['db'];function respondWithStatusCode(_0x3b99a4,_0x3ab183){_0x3ab183=_0x3ab183||0xcc;return function(_0x1d85c4){if(_0x1d85c4){return _0x3b99a4[_0x0bee('0x18')](_0x3ab183);}return _0x3b99a4[_0x0bee('0x19')](_0x3ab183)['end']();};}function respondWithResult(_0x481e0f,_0x4bc49d){_0x4bc49d=_0x4bc49d||0xc8;return function(_0x1d81ba){if(_0x1d81ba){return _0x481e0f[_0x0bee('0x19')](_0x4bc49d)[_0x0bee('0x1a')](_0x1d81ba);}};}function respondWithFilteredResult(_0x1515d4,_0x548ae9){return function(_0x55c83c){if(_0x55c83c){var _0x54aca4=_0x55c83c[_0x0bee('0x1b')],_0xeda8e=_0x548ae9[_0x0bee('0x1c')],_0x2dde14=_0x548ae9['offset']+_0x548ae9[_0x0bee('0x1d')],_0x50786a;if(_0x2dde14>=_0x54aca4){_0x2dde14=_0x54aca4;_0x50786a=0xc8;}else{_0x50786a=0xce;}_0x1515d4[_0x0bee('0x19')](_0x50786a);return _0x1515d4['set'](_0x0bee('0x1e'),_0xeda8e+'-'+_0x2dde14+'/'+_0x54aca4)['json'](_0x55c83c);}return null;};}function patchUpdates(_0xf705a1){return function(_0x178f93){try{jsonpatch[_0x0bee('0x1f')](_0x178f93,_0xf705a1,!![]);}catch(_0x553994){return BPromise[_0x0bee('0x20')](_0x553994);}return _0x178f93[_0x0bee('0x21')]();};}function saveUpdates(_0x103b42,_0x43aeb0){return function(_0x2d66a8){if(_0x2d66a8){return _0x2d66a8['update'](_0x103b42)[_0x0bee('0x22')](function(_0x5a6f28){return _0x5a6f28;});}return null;};}function removeEntity(_0x1397f0,_0x315d60){return function(_0x1f7667){if(_0x1f7667){return _0x1f7667[_0x0bee('0x23')]()['then'](function(){_0x1397f0[_0x0bee('0x19')](0xcc)[_0x0bee('0x24')]();});}};}function handleEntityNotFound(_0x176447,_0x517779){return function(_0x5ce31b){if(!_0x5ce31b){_0x176447[_0x0bee('0x18')](0x194);}return _0x5ce31b;};}function handleError(_0x252ed0,_0x3e9454){_0x3e9454=_0x3e9454||0x1f4;return function(_0x22cb78){logger[_0x0bee('0x25')](_0x22cb78[_0x0bee('0x26')]);if(_0x22cb78[_0x0bee('0x27')]){delete _0x22cb78[_0x0bee('0x27')];}_0x252ed0[_0x0bee('0x19')](_0x3e9454)[_0x0bee('0x28')](_0x22cb78);};}exports[_0x0bee('0x29')]=function(_0x125306,_0x206759){var _0x15ebc8={},_0x306abf={},_0x135cd2={'count':0x0,'rows':[]};var _0x2eebfa=_[_0x0bee('0x2a')](db['CmHopper']['rawAttributes'],function(_0x392aff){return{'name':_0x392aff[_0x0bee('0x2b')],'type':_0x392aff[_0x0bee('0x2c')][_0x0bee('0x2d')]};});_0x306abf[_0x0bee('0x2e')]=_[_0x0bee('0x2a')](_0x2eebfa,_0x0bee('0x27'));_0x306abf['query']=_['keys'](_0x125306['query']);_0x306abf[_0x0bee('0x2f')]=_['intersection'](_0x306abf[_0x0bee('0x2e')],_0x306abf[_0x0bee('0x30')]);_0x306abf[_0x0bee('0x2f')]=_[_0x0bee('0x31')](_0x306abf['filters'],[_0x0bee('0x32'),_0x0bee('0x33'),'$gt',_0x0bee('0x34'),'$lt',_0x0bee('0x35'),_0x0bee('0x36'),_0x0bee('0x37'),'$not',_0x0bee('0x38'),_0x0bee('0x39'),'$in',_0x0bee('0x3a'),_0x0bee('0x3b'),_0x0bee('0x3c'),'$iLike',_0x0bee('0x3d'),_0x0bee('0x3b'),'$overlap',_0x0bee('0x3e'),_0x0bee('0x3f'),_0x0bee('0x40')]);_0x15ebc8[_0x0bee('0x41')]=_[_0x0bee('0x42')](_0x306abf[_0x0bee('0x2e')],qs['fields'](_0x125306[_0x0bee('0x30')]['fields']));_0x15ebc8[_0x0bee('0x41')]=_0x15ebc8[_0x0bee('0x41')][_0x0bee('0x43')]?_0x15ebc8[_0x0bee('0x41')]:_0x306abf[_0x0bee('0x2e')];if(!_0x125306[_0x0bee('0x30')][_0x0bee('0x44')](_0x0bee('0x45'))){_0x15ebc8['limit']=qs['limit'](_0x125306[_0x0bee('0x30')][_0x0bee('0x1d')]);_0x15ebc8[_0x0bee('0x1c')]=qs[_0x0bee('0x1c')](_0x125306[_0x0bee('0x30')][_0x0bee('0x1c')]);}_0x15ebc8[_0x0bee('0x46')]=qs[_0x0bee('0x47')](_0x125306[_0x0bee('0x30')]['sort']);_0x15ebc8[_0x0bee('0x48')]=qs[_0x0bee('0x2f')](_[_0x0bee('0x49')](_0x125306['query'],_0x306abf[_0x0bee('0x2f')]),_0x2eebfa);if(_0x125306['query'][_0x0bee('0x4a')]){_0x15ebc8[_0x0bee('0x48')]=_['merge'](_0x15ebc8[_0x0bee('0x48')],{'$or':_[_0x0bee('0x2a')](_0x2eebfa,function(_0x3d3e1f){if(_0x3d3e1f[_0x0bee('0x2c')]!==_0x0bee('0x4b')){var _0x985f0d={};_0x985f0d[_0x3d3e1f[_0x0bee('0x27')]]={'$like':'%'+_0x125306[_0x0bee('0x30')][_0x0bee('0x4a')]+'%'};return _0x985f0d;}})});}_0x15ebc8=_[_0x0bee('0x4c')]({},_0x15ebc8,_0x125306['options']);var _0x3202fc={'where':_0x15ebc8[_0x0bee('0x48')]};return db[_0x0bee('0x4d')][_0x0bee('0x1b')](_0x3202fc)[_0x0bee('0x22')](function(_0x43c521){_0x135cd2[_0x0bee('0x1b')]=_0x43c521;if(_0x125306[_0x0bee('0x30')][_0x0bee('0x4e')]){_0x15ebc8['include']=[{'all':!![]}];}return db[_0x0bee('0x4d')][_0x0bee('0x4f')](_0x15ebc8);})['then'](function(_0x3ac184){_0x135cd2[_0x0bee('0x50')]=_0x3ac184;return _0x135cd2;})[_0x0bee('0x22')](respondWithFilteredResult(_0x206759,_0x15ebc8))[_0x0bee('0x51')](handleError(_0x206759,null));};exports[_0x0bee('0x52')]=function(_0x2ed3b7,_0x562122){var _0x4bc0a3={'raw':!![],'where':{'id':_0x2ed3b7[_0x0bee('0x53')]['id']}},_0x3e46b1={};_0x3e46b1[_0x0bee('0x2e')]=_[_0x0bee('0x54')](db[_0x0bee('0x4d')][_0x0bee('0x55')]);_0x3e46b1[_0x0bee('0x30')]=_['keys'](_0x2ed3b7[_0x0bee('0x30')]);_0x3e46b1['filters']=_[_0x0bee('0x42')](_0x3e46b1[_0x0bee('0x2e')],_0x3e46b1['query']);_0x4bc0a3[_0x0bee('0x41')]=_[_0x0bee('0x42')](_0x3e46b1['model'],qs['fields'](_0x2ed3b7[_0x0bee('0x30')][_0x0bee('0x56')]));_0x4bc0a3['attributes']=_0x4bc0a3['attributes'][_0x0bee('0x43')]?_0x4bc0a3[_0x0bee('0x41')]:_0x3e46b1[_0x0bee('0x2e')];if(_0x2ed3b7[_0x0bee('0x30')][_0x0bee('0x4e')]){_0x4bc0a3[_0x0bee('0x57')]=[{'all':!![]}];}_0x4bc0a3=_['merge']({},_0x4bc0a3,_0x2ed3b7[_0x0bee('0x58')]);return db[_0x0bee('0x4d')][_0x0bee('0x59')](_0x4bc0a3)[_0x0bee('0x22')](handleEntityNotFound(_0x562122,null))['then'](respondWithResult(_0x562122,null))[_0x0bee('0x51')](handleError(_0x562122,null));};exports['create']=function(_0xc0a084,_0x244a08){return db[_0x0bee('0x4d')][_0x0bee('0x5a')](_0xc0a084['body'],{})[_0x0bee('0x22')](respondWithResult(_0x244a08,0xc9))['catch'](handleError(_0x244a08,null));};exports[_0x0bee('0x5b')]=function(_0x24ec37,_0x203ad){if(_0x24ec37['body']['id']){delete _0x24ec37[_0x0bee('0x5c')]['id'];}return db[_0x0bee('0x4d')]['find']({'where':{'id':_0x24ec37[_0x0bee('0x53')]['id']}})[_0x0bee('0x22')](handleEntityNotFound(_0x203ad,null))[_0x0bee('0x22')](saveUpdates(_0x24ec37[_0x0bee('0x5c')],null))['then'](respondWithResult(_0x203ad,null))['catch'](handleError(_0x203ad,null));};exports[_0x0bee('0x5d')]=function(_0x2d8a7d,_0x44519d){return db['CmHopper'][_0x0bee('0x5d')]()[_0x0bee('0x22')](respondWithResult(_0x44519d,null))[_0x0bee('0x51')](handleError(_0x44519d,null));};exports['destroy']=function(_0xc04b9d,_0x5b3146){var _0x628e6d;return db[_0x0bee('0x4d')][_0x0bee('0x59')]({'where':{'id':_0xc04b9d['params']['id']}})[_0x0bee('0x22')](handleEntityNotFound(_0x5b3146,null))[_0x0bee('0x22')](function(_0x3bd1d1){if(_0x3bd1d1){return _0x3bd1d1[_0x0bee('0x23')]()[_0x0bee('0x22')](function(_0x238a51){return _0x238a51;});}})[_0x0bee('0x22')](function(_0x211a2e){_0x628e6d=_0x211a2e;if(_0x211a2e){if(_0x211a2e[_0x0bee('0x5e')]||_0x211a2e[_0x0bee('0x5f')]){return db[_0x211a2e[_0x0bee('0x5e')]?_0x0bee('0x60'):_0x0bee('0x61')][_0x0bee('0x59')]({'where':{'id':_0x211a2e[_0x0bee('0x5e')]?_0x211a2e[_0x0bee('0x5e')]:_0x211a2e[_0x0bee('0x5f')]},'attributes':['id',_0x0bee('0x27')],'raw':!![]});}}})[_0x0bee('0x22')](function(_0x285a83){var _0x2fbbc1={};if(_0x285a83){_[_0x0bee('0x4c')](_0x2fbbc1,_[_0x0bee('0x62')](_0x628e6d['dataValues'],[_0x0bee('0x63'),_0x0bee('0x64'),'id']));_0x2fbbc1[_0x0bee('0x65')]=0x15;_0x2fbbc1[_0x0bee('0x66')]=_0x0bee('0x67');_0x2fbbc1[_0x0bee('0x68')]=_0x285a83[_0x0bee('0x27')];_0x2fbbc1[_0x0bee('0x69')]=_0xc04b9d[_0x0bee('0x6a')]['name'];_0x2fbbc1[_0x0bee('0x6b')]=_0xc04b9d[_0x0bee('0x6a')]['id'];_0x2fbbc1['deleted']=!![];_0x2fbbc1[_0x0bee('0x6c')]=moment()[_0x0bee('0x6d')](_0x0bee('0x6e'));_0x2fbbc1[_0x0bee('0x6f')]=_0x628e6d['phone'];_0x2fbbc1[_0x0bee('0x70')]=_0x628e6d[_0x0bee('0x5e')]?_0x0bee('0x71'):_0x0bee('0x72');return db['CmContact']['find']({'where':{'id':_0x2fbbc1[_0x0bee('0x73')]},'attributes':[_0x0bee('0x74'),'lastName']})['then'](function(_0x163985){if(!_[_0x0bee('0x75')](_0x5b3146)&&!_[_0x0bee('0x75')](_0x163985[_0x0bee('0x74')])){_0x2fbbc1[_0x0bee('0x76')]=_0x163985[_0x0bee('0x74')];if(!_[_0x0bee('0x75')](_0x163985[_0x0bee('0x77')])){_0x2fbbc1[_0x0bee('0x76')]+='\x20'+_0x163985[_0x0bee('0x77')];}}})['finally'](function(){return db[_0x0bee('0x78')][_0x0bee('0x5a')](_0x2fbbc1);});}})[_0x0bee('0x22')](function(){return _0x5b3146[_0x0bee('0x19')](0xcc)[_0x0bee('0x24')]();})['catch'](handleError(_0x5b3146,null));};exports[_0x0bee('0x79')]=function(_0x5605a5,_0x3446d4,_0x3a0833){var _0x28d3c5=[];return db[_0x0bee('0x7a')][_0x0bee('0x5d')]()[_0x0bee('0x22')](function(_0x4ecb90){_0x28d3c5=_[_0x0bee('0x54')](_0x4ecb90);return _0x5605a5[_0x0bee('0x6a')][_0x0bee('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x0bee('0x7c')},'attributes':['id',_0x0bee('0x7d')],'raw':!![]});})[_0x0bee('0x22')](function(_0x552fef){if(_0x552fef&&_0x552fef[_0x0bee('0x43')]){return db[_0x0bee('0x7e')][_0x0bee('0x7f')](function(_0x8dab00){var _0x87f8d6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0bee('0x6d')](_0x0bee('0x6e'))},'VoiceQueueId':{'$in':_['map'](_0x552fef,'id')},'$or':[{'UserId':null},{'UserId':_0x5605a5[_0x0bee('0x6a')]['id']}]};var _0x3d3d8b=[];if(_0x5605a5['body'][_0x0bee('0x80')]&&_0x5605a5[_0x0bee('0x5c')]['direction']===_0x0bee('0x81')){if(!_[_0x0bee('0x82')](_0x5605a5[_0x0bee('0x5c')][_0x0bee('0x83')])){_0x87f8d6['id']={'$in':_0x5605a5[_0x0bee('0x5c')]['hopperIds']};}_0x3d3d8b=[['priority',_0x0bee('0x84')],['scheduledAt',_0x552fef[0x0][_0x0bee('0x7d')]===_0x0bee('0x84')?_0x0bee('0x85'):_0x0bee('0x84')],db[_0x0bee('0x7e')][_0x0bee('0x86')](_0x0bee('0x87')),['id',_0x0bee('0x85')]];}else{if(!_[_0x0bee('0x82')](_0x5605a5[_0x0bee('0x5c')]['hopperIds'])){_0x87f8d6['id']={'$notIn':_0x5605a5['body']['hopperIds']};}_0x3d3d8b=[[_0x0bee('0x88'),_0x0bee('0x85')],[_0x0bee('0x89'),_0x552fef[0x0][_0x0bee('0x7d')]],db[_0x0bee('0x7e')][_0x0bee('0x86')](_0x0bee('0x8a')),['id',_0x0bee('0x84')]];}return db[_0x0bee('0x4d')][_0x0bee('0x8b')]({'attributes':['id',_0x0bee('0x8c')],'where':_0x87f8d6,'order':_0x3d3d8b,'transaction':_0x8dab00,'lock':_0x8dab00['LOCK'][_0x0bee('0x8d')],'include':[{'model':db[_0x0bee('0x7a')],'as':_0x0bee('0x8e'),'attributes':_0x28d3c5,'include':[{'model':db[_0x0bee('0x8f')],'as':_0x0bee('0x90'),'attributes':['id',_0x0bee('0x27')]}]},{'model':db[_0x0bee('0x91')],'as':_0x0bee('0x92'),'attributes':['id',_0x0bee('0x27')]},{'model':db[_0x0bee('0x60')],'as':'Queue','attributes':['id',_0x0bee('0x27'),_0x0bee('0x93')]}]})['then'](function(_0x5a8acf){if(_0x5a8acf){return _0x5a8acf[_0x0bee('0x5b')]({'UserId':_0x5605a5[_0x0bee('0x6a')]['id']},{'transaction':_0x8dab00});}});});}})['then'](handleEntityNotFound(_0x3446d4,null))[_0x0bee('0x22')](respondWithResult(_0x3446d4,null))['catch'](handleError(_0x3446d4,null));};exports[_0x0bee('0x94')]=function(_0x97a773,_0x20100a,_0x5e78db){return _0x97a773[_0x0bee('0x6a')][_0x0bee('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x0bee('0x7c')},'attributes':['id'],'raw':!![]})[_0x0bee('0x22')](function(_0xf23bcd){if(_0xf23bcd&&_0xf23bcd[_0x0bee('0x43')]){return db[_0x0bee('0x4d')][_0x0bee('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0bee('0x6d')](_0x0bee('0x6e'))},'VoiceQueueId':{'$in':_[_0x0bee('0x2a')](_0xf23bcd,'id')},'$or':[{'UserId':null},{'UserId':_0x97a773[_0x0bee('0x6a')]['id']}]}});}return 0x0;})[_0x0bee('0x22')](function(_0x4e7a40){if(!_[_0x0bee('0x75')](_0x4e7a40)&&_['isNumber'](_0x4e7a40)){return _0x20100a[_0x0bee('0x19')](0xc8)['json']({'contacts':_0x4e7a40});}else{logger[_0x0bee('0x25')](_0x0bee('0x95'),_0x0bee('0x94'),0x194,_0x0bee('0x96'));_0x20100a[_0x0bee('0x18')](0x194);}})['catch'](handleError(_0x20100a,null));}; \ No newline at end of file +var _0x4213=['Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','CmHopper','fieldName','key','map','keys','query','filters','model','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','create','body','describe','CampaignId','VoiceQueueId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','preview','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','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'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x4213,0x77));var _0x3421=function(_0x2ed7bf,_0x515f4d){_0x2ed7bf=_0x2ed7bf-0x0;var _0x5aee37=_0x4213[_0x2ed7bf];return _0x5aee37;};'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(){_0x256cc5[_0x3421('0x1a')](0xcc)[_0x3421('0x1b')]();});}};}function handleEntityNotFound(_0x48fb3d,_0x57a4af){return function(_0x494423){if(!_0x494423){_0x48fb3d[_0x3421('0x19')](0x194);}return _0x494423;};}function handleError(_0x958899,_0x3d56d9){_0x3d56d9=_0x3d56d9||0x1f4;return function(_0x5bc28a){logger['error'](_0x5bc28a[_0x3421('0x26')]);if(_0x5bc28a['name']){delete _0x5bc28a[_0x3421('0x27')];}_0x958899['status'](_0x3d56d9)[_0x3421('0x28')](_0x5bc28a);};}exports[_0x3421('0x29')]=function(_0x36d75f,_0x2e6a75){var _0x186885={},_0x5df4dc={},_0x332017={'count':0x0,'rows':[]};var _0x52fd41=_['map'](db[_0x3421('0x2a')]['rawAttributes'],function(_0x5074a2){return{'name':_0x5074a2[_0x3421('0x2b')],'type':_0x5074a2['type'][_0x3421('0x2c')]};});_0x5df4dc['model']=_[_0x3421('0x2d')](_0x52fd41,_0x3421('0x27'));_0x5df4dc['query']=_[_0x3421('0x2e')](_0x36d75f[_0x3421('0x2f')]);_0x5df4dc[_0x3421('0x30')]=_['intersection'](_0x5df4dc[_0x3421('0x31')],_0x5df4dc['query']);_0x5df4dc[_0x3421('0x30')]=_[_0x3421('0x32')](_0x5df4dc[_0x3421('0x30')],[_0x3421('0x33'),_0x3421('0x34'),_0x3421('0x35'),_0x3421('0x36'),_0x3421('0x37'),_0x3421('0x38'),_0x3421('0x39'),'$eq','$not',_0x3421('0x3a'),_0x3421('0x3b'),'$in',_0x3421('0x3c'),_0x3421('0x3d'),_0x3421('0x3e'),_0x3421('0x3f'),_0x3421('0x40'),'$like',_0x3421('0x41'),_0x3421('0x42'),_0x3421('0x43'),'$any']);_0x186885[_0x3421('0x44')]=_['intersection'](_0x5df4dc[_0x3421('0x31')],qs[_0x3421('0x45')](_0x36d75f[_0x3421('0x2f')][_0x3421('0x45')]));_0x186885[_0x3421('0x44')]=_0x186885[_0x3421('0x44')][_0x3421('0x46')]?_0x186885['attributes']:_0x5df4dc['model'];if(!_0x36d75f['query'][_0x3421('0x47')]('nolimit')){_0x186885['limit']=qs[_0x3421('0x1d')](_0x36d75f['query'][_0x3421('0x1d')]);_0x186885[_0x3421('0x1c')]=qs['offset'](_0x36d75f[_0x3421('0x2f')][_0x3421('0x1c')]);}_0x186885[_0x3421('0x48')]=qs[_0x3421('0x49')](_0x36d75f['query'][_0x3421('0x49')]);_0x186885[_0x3421('0x4a')]=qs[_0x3421('0x30')](_[_0x3421('0x4b')](_0x36d75f[_0x3421('0x2f')],_0x5df4dc['filters']),_0x52fd41);if(_0x36d75f[_0x3421('0x2f')][_0x3421('0x4c')]){_0x186885['where']=_[_0x3421('0x4d')](_0x186885['where'],{'$or':_['map'](_0x52fd41,function(_0x486ce8){if(_0x486ce8[_0x3421('0x4e')]!==_0x3421('0x4f')){var _0x41bdb7={};_0x41bdb7[_0x486ce8[_0x3421('0x27')]]={'$like':'%'+_0x36d75f[_0x3421('0x2f')][_0x3421('0x4c')]+'%'};return _0x41bdb7;}})});}_0x186885=_[_0x3421('0x4d')]({},_0x186885,_0x36d75f[_0x3421('0x50')]);var _0x33198f={'where':_0x186885[_0x3421('0x4a')]};return db[_0x3421('0x2a')][_0x3421('0x51')](_0x33198f)[_0x3421('0x24')](function(_0x3d016d){_0x332017['count']=_0x3d016d;if(_0x36d75f[_0x3421('0x2f')][_0x3421('0x52')]){_0x186885[_0x3421('0x53')]=[{'all':!![]}];}return db[_0x3421('0x2a')]['findAll'](_0x186885);})[_0x3421('0x24')](function(_0x4da769){_0x332017[_0x3421('0x54')]=_0x4da769;return _0x332017;})[_0x3421('0x24')](respondWithFilteredResult(_0x2e6a75,_0x186885))[_0x3421('0x55')](handleError(_0x2e6a75,null));};exports[_0x3421('0x56')]=function(_0x2f9a84,_0x60fb09){var _0x435ba7={'raw':!![],'where':{'id':_0x2f9a84[_0x3421('0x57')]['id']}},_0x305951={};_0x305951[_0x3421('0x31')]=_[_0x3421('0x2e')](db[_0x3421('0x2a')][_0x3421('0x58')]);_0x305951['query']=_[_0x3421('0x2e')](_0x2f9a84['query']);_0x305951[_0x3421('0x30')]=_[_0x3421('0x59')](_0x305951[_0x3421('0x31')],_0x305951[_0x3421('0x2f')]);_0x435ba7[_0x3421('0x44')]=_[_0x3421('0x59')](_0x305951[_0x3421('0x31')],qs[_0x3421('0x45')](_0x2f9a84[_0x3421('0x2f')][_0x3421('0x45')]));_0x435ba7['attributes']=_0x435ba7[_0x3421('0x44')][_0x3421('0x46')]?_0x435ba7[_0x3421('0x44')]:_0x305951['model'];if(_0x2f9a84['query'][_0x3421('0x52')]){_0x435ba7[_0x3421('0x53')]=[{'all':!![]}];}_0x435ba7=_[_0x3421('0x4d')]({},_0x435ba7,_0x2f9a84['options']);return db[_0x3421('0x2a')][_0x3421('0x5a')](_0x435ba7)[_0x3421('0x24')](handleEntityNotFound(_0x60fb09,null))[_0x3421('0x24')](respondWithResult(_0x60fb09,null))['catch'](handleError(_0x60fb09,null));};exports[_0x3421('0x5b')]=function(_0x1bcf74,_0x3f7ff3){return db['CmHopper']['create'](_0x1bcf74['body'],{})[_0x3421('0x24')](respondWithResult(_0x3f7ff3,0xc9))[_0x3421('0x55')](handleError(_0x3f7ff3,null));};exports['update']=function(_0x4d8fe4,_0x2a3bf5){if(_0x4d8fe4[_0x3421('0x5c')]['id']){delete _0x4d8fe4[_0x3421('0x5c')]['id'];}return db[_0x3421('0x2a')][_0x3421('0x5a')]({'where':{'id':_0x4d8fe4['params']['id']}})[_0x3421('0x24')](handleEntityNotFound(_0x2a3bf5,null))[_0x3421('0x24')](saveUpdates(_0x4d8fe4[_0x3421('0x5c')],null))[_0x3421('0x24')](respondWithResult(_0x2a3bf5,null))['catch'](handleError(_0x2a3bf5,null));};exports[_0x3421('0x5d')]=function(_0x400a2c,_0x219e1d){return db['CmHopper'][_0x3421('0x5d')]()['then'](respondWithResult(_0x219e1d,null))['catch'](handleError(_0x219e1d,null));};exports[_0x3421('0x25')]=function(_0x498be5,_0x4e33a0){var _0x7e0c6c;return db[_0x3421('0x2a')]['find']({'where':{'id':_0x498be5[_0x3421('0x57')]['id']}})[_0x3421('0x24')](handleEntityNotFound(_0x4e33a0,null))[_0x3421('0x24')](function(_0x3a398c){if(_0x3a398c){return _0x3a398c[_0x3421('0x25')]()[_0x3421('0x24')](function(_0x4e1103){return _0x4e1103;});}})[_0x3421('0x24')](function(_0x337c75){_0x7e0c6c=_0x337c75;if(_0x337c75){if(_0x337c75['VoiceQueueId']||_0x337c75[_0x3421('0x5e')]){return db[_0x337c75[_0x3421('0x5f')]?'VoiceQueue':_0x3421('0x60')][_0x3421('0x5a')]({'where':{'id':_0x337c75[_0x3421('0x5f')]?_0x337c75['VoiceQueueId']:_0x337c75[_0x3421('0x5e')]},'attributes':['id',_0x3421('0x27')],'raw':!![]});}}})[_0x3421('0x24')](function(_0xfe91d7){var _0x1bca2c={};if(_0xfe91d7){_[_0x3421('0x4d')](_0x1bca2c,_[_0x3421('0x61')](_0x7e0c6c[_0x3421('0x62')],[_0x3421('0x63'),_0x3421('0x64'),'id']));_0x1bca2c[_0x3421('0x65')]=0x15;_0x1bca2c[_0x3421('0x66')]=_0x3421('0x67');_0x1bca2c[_0x3421('0x68')]=_0xfe91d7[_0x3421('0x27')];_0x1bca2c['membername']=_0x498be5[_0x3421('0x69')][_0x3421('0x27')];_0x1bca2c[_0x3421('0x6a')]=_0x498be5[_0x3421('0x69')]['id'];_0x1bca2c[_0x3421('0x67')]=!![];_0x1bca2c[_0x3421('0x6b')]=moment()[_0x3421('0x6c')](_0x3421('0x6d'));_0x1bca2c['calleridnum']=_0x7e0c6c[_0x3421('0x6e')];_0x1bca2c['campaigntype']=_0x7e0c6c[_0x3421('0x5f')]?_0x3421('0x6f'):_0x3421('0x70');return db[_0x3421('0x71')]['find']({'where':{'id':_0x1bca2c[_0x3421('0x72')]},'attributes':[_0x3421('0x73'),_0x3421('0x74')]})[_0x3421('0x24')](function(_0x9e649){if(!_[_0x3421('0x75')](_0x4e33a0)&&!_['isNil'](_0x9e649[_0x3421('0x73')])){_0x1bca2c[_0x3421('0x76')]=_0x9e649[_0x3421('0x73')];if(!_[_0x3421('0x75')](_0x9e649[_0x3421('0x74')])){_0x1bca2c[_0x3421('0x76')]+='\x20'+_0x9e649[_0x3421('0x74')];}}})[_0x3421('0x77')](function(){return db['CmHopperFinal'][_0x3421('0x5b')](_0x1bca2c);});}})[_0x3421('0x24')](function(){return _0x4e33a0[_0x3421('0x1a')](0xcc)[_0x3421('0x1b')]();})[_0x3421('0x55')](handleError(_0x4e33a0,null));};exports['getPreview']=function(_0x5763c1,_0x44fde6,_0x103d84){var _0x230f65=[];return db['CmContact'][_0x3421('0x5d')]()['then'](function(_0x18260e){_0x230f65=_['keys'](_0x18260e);return _0x5763c1['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x3421('0x78')],'raw':!![]});})[_0x3421('0x24')](function(_0x2f64a4){if(_0x2f64a4&&_0x2f64a4[_0x3421('0x46')]){return db[_0x3421('0x79')][_0x3421('0x7a')](function(_0x231067){var _0x11e770={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3421('0x6c')](_0x3421('0x6d'))},'VoiceQueueId':{'$in':_['map'](_0x2f64a4,'id')},'$or':[{'UserId':null},{'UserId':_0x5763c1[_0x3421('0x69')]['id']}]};var _0x4dce60=[];if(_0x5763c1[_0x3421('0x5c')][_0x3421('0x7b')]&&_0x5763c1[_0x3421('0x5c')][_0x3421('0x7b')]===_0x3421('0x7c')){if(!_[_0x3421('0x7d')](_0x5763c1[_0x3421('0x5c')][_0x3421('0x7e')])){_0x11e770['id']={'$in':_0x5763c1[_0x3421('0x5c')]['hopperIds']};}_0x4dce60=[[_0x3421('0x7f'),_0x3421('0x80')],[_0x3421('0x81'),_0x2f64a4[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':'ASC'],db[_0x3421('0x79')]['literal'](_0x3421('0x82')),['id',_0x3421('0x83')]];}else{if(!_[_0x3421('0x7d')](_0x5763c1[_0x3421('0x5c')]['hopperIds'])){_0x11e770['id']={'$notIn':_0x5763c1[_0x3421('0x5c')][_0x3421('0x7e')]};}_0x4dce60=[[_0x3421('0x7f'),_0x3421('0x83')],[_0x3421('0x81'),_0x2f64a4[0x0][_0x3421('0x78')]],db['sequelize'][_0x3421('0x84')](_0x3421('0x85')),['id',_0x3421('0x80')]];}return db[_0x3421('0x2a')][_0x3421('0x86')]({'attributes':['id',_0x3421('0x87')],'where':_0x11e770,'order':_0x4dce60,'transaction':_0x231067,'lock':_0x231067[_0x3421('0x88')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x3421('0x89'),'attributes':_0x230f65,'include':[{'model':db[_0x3421('0x8a')],'as':_0x3421('0x8b'),'attributes':['id','name']}]},{'model':db[_0x3421('0x8c')],'as':'List','attributes':['id',_0x3421('0x27')]},{'model':db['VoiceQueue'],'as':_0x3421('0x8d'),'attributes':['id',_0x3421('0x27'),_0x3421('0x8e')]}]})[_0x3421('0x24')](function(_0x1d51a6){if(_0x1d51a6){return _0x1d51a6[_0x3421('0x23')]({'UserId':_0x5763c1[_0x3421('0x69')]['id']},{'transaction':_0x231067});}});});}})[_0x3421('0x24')](handleEntityNotFound(_0x44fde6,null))[_0x3421('0x24')](respondWithResult(_0x44fde6,null))[_0x3421('0x55')](handleError(_0x44fde6,null));};exports[_0x3421('0x8f')]=function(_0x257cc7,_0x5e0d0a,_0x321335){return _0x257cc7[_0x3421('0x69')][_0x3421('0x90')]({'where':{'type':_0x3421('0x91'),'dialActive':!![],'dialMethod':_0x3421('0x92')},'attributes':['id'],'raw':!![]})[_0x3421('0x24')](function(_0xb3d761){if(_0xb3d761&&_0xb3d761[_0x3421('0x46')]){return db['CmHopper'][_0x3421('0x51')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0xb3d761,'id')},'$or':[{'UserId':null},{'UserId':_0x257cc7[_0x3421('0x69')]['id']}]}});}return 0x0;})[_0x3421('0x24')](function(_0x3e28eb){if(!_[_0x3421('0x75')](_0x3e28eb)&&_['isNumber'](_0x3e28eb)){return _0x5e0d0a[_0x3421('0x1a')](0xc8)[_0x3421('0x20')]({'contacts':_0x3e28eb});}else{logger[_0x3421('0x93')](_0x3421('0x94'),_0x3421('0x8f'),0x194,_0x3421('0x95'));_0x5e0d0a[_0x3421('0x19')](0x194);}})[_0x3421('0x55')](handleError(_0x5e0d0a,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 59252cb..1ea893f 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 _0xcd43=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xcd43,0xc9));var _0x3cd4=function(_0x56fc44,_0x7be087){_0x56fc44=_0x56fc44-0x0;var _0x5e67f8=_0xcd43[_0x56fc44];return _0x5e67f8;};'use strict';var _=require(_0x3cd4('0x0'));var util=require(_0x3cd4('0x1'));var logger=require(_0x3cd4('0x2'))(_0x3cd4('0x3'));var moment=require(_0x3cd4('0x4'));var BPromise=require(_0x3cd4('0x5'));var rp=require(_0x3cd4('0x6'));var fs=require('fs');var path=require(_0x3cd4('0x7'));var rimraf=require(_0x3cd4('0x8'));var config=require(_0x3cd4('0x9'));var attributes=require(_0x3cd4('0xa'));module[_0x3cd4('0xb')]=function(_0x43122b,_0x3752d2){return _0x43122b[_0x3cd4('0xc')]('CmHopper',attributes,{'tableName':_0x3cd4('0xd'),'paranoid':![],'indexes':[{'name':_0x3cd4('0xe'),'fields':['scheduledat']},{'name':_0x3cd4('0xf'),'fields':['phone']},{'name':_0x3cd4('0x10'),'fields':[_0x3cd4('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55cf=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','lodash','util','../../config/logger','api','moment'];(function(_0x186b32,_0x2967e8){var _0x562821=function(_0xd55163){while(--_0xd55163){_0x186b32['push'](_0x186b32['shift']());}};_0x562821(++_0x2967e8);}(_0x55cf,0x1bd));var _0xf55c=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x55cf[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xf55c('0x0'));var util=require(_0xf55c('0x1'));var logger=require(_0xf55c('0x2'))(_0xf55c('0x3'));var moment=require(_0xf55c('0x4'));var BPromise=require(_0xf55c('0x5'));var rp=require(_0xf55c('0x6'));var fs=require('fs');var path=require(_0xf55c('0x7'));var rimraf=require(_0xf55c('0x8'));var config=require(_0xf55c('0x9'));var attributes=require(_0xf55c('0xa'));module[_0xf55c('0xb')]=function(_0x2e4722,_0xc8af0d){return _0x2e4722[_0xf55c('0xc')](_0xf55c('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xf55c('0xe')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0c807eb..b9ac343 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 _0xcad7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','include','map','model','stringify','find','raw','info','ShowCmHopper','debug','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','sequelize','transaction','limit','order','UPDATE','CmContact','Contact','keys','User','voicePause','length','includes','UserId','push','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','all','GetCmHopperPreview','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcad7,0xd4));var _0x7cad=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0xcad7[_0x49f67f];return _0x4779a1;};'use strict';var _=require('lodash');var util=require(_0x7cad('0x0'));var moment=require(_0x7cad('0x1'));var BPromise=require(_0x7cad('0x2'));var rs=require(_0x7cad('0x3'));var fs=require('fs');var Redis=require(_0x7cad('0x4'));var db=require(_0x7cad('0x5'))['db'];var utils=require(_0x7cad('0x6'));var logger=require(_0x7cad('0x7'))(_0x7cad('0x8'));var config=require(_0x7cad('0x9'));var jayson=require(_0x7cad('0xa'));var client=jayson[_0x7cad('0xb')][_0x7cad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x182978,_0x325bbd,_0x3d662e){return new BPromise(function(_0x59009c,_0x5adf4a){return client['request'](_0x182978,_0x3d662e)[_0x7cad('0xd')](function(_0x437bcf){logger['info']('CmHopper,\x20%s,\x20%s',_0x325bbd,_0x7cad('0xe'));logger['debug'](_0x7cad('0xf'),_0x325bbd,_0x7cad('0xe'),JSON['stringify'](_0x437bcf));if(_0x437bcf[_0x7cad('0x10')]){if(_0x437bcf[_0x7cad('0x10')][_0x7cad('0x11')]===0x1f4){logger[_0x7cad('0x10')](_0x7cad('0x12'),_0x325bbd,_0x437bcf['error'][_0x7cad('0x13')]);return _0x5adf4a(_0x437bcf[_0x7cad('0x10')][_0x7cad('0x13')]);}logger[_0x7cad('0x10')](_0x7cad('0x12'),_0x325bbd,_0x437bcf['error'][_0x7cad('0x13')]);return _0x59009c(_0x437bcf['error']['message']);}else{logger['info'](_0x7cad('0x12'),_0x325bbd,_0x7cad('0xe'));_0x59009c(_0x437bcf[_0x7cad('0x14')][_0x7cad('0x13')]);}})[_0x7cad('0x15')](function(_0x3c57e6){logger[_0x7cad('0x10')](_0x7cad('0x12'),_0x325bbd,_0x3c57e6);_0x5adf4a(_0x3c57e6);});});}exports[_0x7cad('0x16')]=function(_0x48d7b2){var _0x28adc0=this;return new Promise(function(_0x437c74,_0x27ee60){return db[_0x7cad('0x17')][_0x7cad('0x18')]({'raw':_0x48d7b2['options']?_0x48d7b2[_0x7cad('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x48d7b2[_0x7cad('0x19')]?_0x48d7b2[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null,'attributes':_0x48d7b2[_0x7cad('0x19')]?_0x48d7b2[_0x7cad('0x19')][_0x7cad('0x1b')]||null:null,'limit':_0x48d7b2[_0x7cad('0x19')]?_0x48d7b2['options']['limit']||null:null,'include':_0x48d7b2['options']?_0x48d7b2['options'][_0x7cad('0x1c')]?_['map'](_0x48d7b2[_0x7cad('0x19')][_0x7cad('0x1c')],function(_0x1e7095){return{'model':db[_0x1e7095['model']],'as':_0x1e7095['as'],'attributes':_0x1e7095['attributes'],'include':_0x1e7095[_0x7cad('0x1c')]?_[_0x7cad('0x1d')](_0x1e7095['include'],function(_0x44682f){return{'model':db[_0x44682f[_0x7cad('0x1e')]],'as':_0x44682f['as'],'attributes':_0x44682f[_0x7cad('0x1b')],'include':_0x44682f[_0x7cad('0x1c')]?_[_0x7cad('0x1d')](_0x44682f['include'],function(_0x596139){return{'model':db[_0x596139[_0x7cad('0x1e')]],'as':_0x596139['as'],'attributes':_0x596139['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ea7b0){logger['info'](_0x7cad('0x16'),_0x48d7b2);logger['debug'](_0x7cad('0x16'),_0x48d7b2,JSON[_0x7cad('0x1f')](_0x2ea7b0));_0x437c74(_0x2ea7b0);})[_0x7cad('0x15')](function(_0x2da62c){logger[_0x7cad('0x10')](_0x7cad('0x16'),_0x2da62c[_0x7cad('0x13')],_0x48d7b2);_0x27ee60(_0x28adc0[_0x7cad('0x10')](0x1f4,_0x2da62c[_0x7cad('0x13')]));});});};exports['ShowCmHopper']=function(_0x7426d){var _0x5d2989=this;return new Promise(function(_0x231f87,_0x5d78d1){return db['CmHopper'][_0x7cad('0x20')]({'raw':_0x7426d[_0x7cad('0x19')]?_0x7426d[_0x7cad('0x19')][_0x7cad('0x21')]===undefined?!![]:![]:!![],'where':_0x7426d[_0x7cad('0x19')]?_0x7426d[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null,'attributes':_0x7426d[_0x7cad('0x19')]?_0x7426d[_0x7cad('0x19')][_0x7cad('0x1b')]||null:null,'include':_0x7426d['options']?_0x7426d[_0x7cad('0x19')]['include']?_[_0x7cad('0x1d')](_0x7426d[_0x7cad('0x19')][_0x7cad('0x1c')],function(_0x2d86d6){return{'model':db[_0x2d86d6[_0x7cad('0x1e')]],'as':_0x2d86d6['as'],'attributes':_0x2d86d6[_0x7cad('0x1b')],'include':_0x2d86d6['include']?_[_0x7cad('0x1d')](_0x2d86d6['include'],function(_0x2e0802){return{'model':db[_0x2e0802[_0x7cad('0x1e')]],'as':_0x2e0802['as'],'attributes':_0x2e0802[_0x7cad('0x1b')],'include':_0x2e0802[_0x7cad('0x1c')]?_['map'](_0x2e0802[_0x7cad('0x1c')],function(_0x1a84da){return{'model':db[_0x1a84da[_0x7cad('0x1e')]],'as':_0x1a84da['as'],'attributes':_0x1a84da[_0x7cad('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15337a){logger[_0x7cad('0x22')](_0x7cad('0x23'),_0x7426d);logger[_0x7cad('0x24')](_0x7cad('0x23'),_0x7426d,JSON[_0x7cad('0x1f')](_0x15337a));_0x231f87(_0x15337a);})[_0x7cad('0x15')](function(_0x35845e){logger[_0x7cad('0x10')](_0x7cad('0x23'),_0x35845e['message'],_0x7426d);_0x5d78d1(_0x5d2989['error'](0x1f4,_0x35845e['message']));});});};exports[_0x7cad('0x25')]=function(_0x28701a){var _0x21f16c=this;return new Promise(function(_0x46f4c6,_0xcf67a6){return db[_0x7cad('0x17')]['create'](_0x28701a[_0x7cad('0x26')],{'raw':_0x28701a[_0x7cad('0x19')]?_0x28701a[_0x7cad('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7cad('0xd')](function(_0xcd69db){logger[_0x7cad('0x22')](_0x7cad('0x25'),_0x28701a);logger['debug'](_0x7cad('0x25'),_0x28701a,JSON[_0x7cad('0x1f')](_0xcd69db));_0x46f4c6(_0xcd69db);})['catch'](function(_0x257b5a){logger['error']('CreateCmHopper',_0x257b5a[_0x7cad('0x13')],_0x28701a);_0xcf67a6(_0x21f16c[_0x7cad('0x10')](0x1f4,_0x257b5a[_0x7cad('0x13')]));});});};exports[_0x7cad('0x27')]=function(_0x4cad41){var _0x2c68ea=this;return new Promise(function(_0x2148ea,_0x36efb5){return db[_0x7cad('0x17')][_0x7cad('0x28')](_0x4cad41[_0x7cad('0x26')],{'raw':_0x4cad41[_0x7cad('0x19')]?_0x4cad41[_0x7cad('0x19')][_0x7cad('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cad41['options']?_0x4cad41['options'][_0x7cad('0x1a')]||null:null,'attributes':_0x4cad41[_0x7cad('0x19')]?_0x4cad41['options'][_0x7cad('0x1b')]||null:null,'limit':_0x4cad41[_0x7cad('0x19')]?_0x4cad41[_0x7cad('0x19')]['limit']||null:null})[_0x7cad('0xd')](function(_0x31aa39){logger[_0x7cad('0x22')](_0x7cad('0x27'),_0x4cad41);logger['debug'](_0x7cad('0x27'),_0x4cad41,JSON[_0x7cad('0x1f')](_0x31aa39));_0x2148ea(_0x31aa39);})['catch'](function(_0x549b27){logger[_0x7cad('0x10')](_0x7cad('0x27'),_0x549b27[_0x7cad('0x13')],_0x4cad41);_0x36efb5(_0x2c68ea['error'](0x1f4,_0x549b27[_0x7cad('0x13')]));});});};exports[_0x7cad('0x29')]=function(_0x182d59){var _0x402132=this;return new Promise(function(_0x26d892,_0x104f1b){return db[_0x7cad('0x17')][_0x7cad('0x2a')]({'where':_0x182d59[_0x7cad('0x19')]?_0x182d59[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null})['then'](function(_0x45ab48){logger[_0x7cad('0x22')](_0x7cad('0x29'),_0x182d59);logger[_0x7cad('0x24')]('DestroyCmHopper',_0x182d59,JSON['stringify'](_0x45ab48));_0x26d892(_0x45ab48);})['catch'](function(_0x156be6){logger['error']('DestroyCmHopper',_0x156be6[_0x7cad('0x13')],_0x182d59);_0x104f1b(_0x402132[_0x7cad('0x10')](0x1f4,_0x156be6[_0x7cad('0x13')]));});});};exports['GetContactDialer']=function(_0x10422b){var _0x344bf9=this;return new Promise(function(_0x3104fa,_0x327e27){return db['CmContact']['describe']()['then'](function(_0x4357c9){return db[_0x7cad('0x2b')][_0x7cad('0x2c')](function(_0x2f7cdb){return db['CmHopper'][_0x7cad('0x18')]({'where':_0x10422b[_0x7cad('0x19')]?_0x10422b[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null,'attributes':_0x10422b[_0x7cad('0x19')]?_0x10422b[_0x7cad('0x19')][_0x7cad('0x1b')]||null:null,'limit':_0x10422b[_0x7cad('0x19')]?_0x10422b[_0x7cad('0x19')][_0x7cad('0x2d')]||null:null,'order':_0x10422b[_0x7cad('0x19')]?_0x10422b[_0x7cad('0x19')][_0x7cad('0x2e')]||null:null,'transaction':_0x2f7cdb,'lock':_0x2f7cdb['LOCK'][_0x7cad('0x2f')],'include':[{'model':db[_0x7cad('0x30')],'as':_0x7cad('0x31'),'attributes':_[_0x7cad('0x32')](_0x4357c9)},{'model':db[_0x7cad('0x33')],'as':'Agent','attributes':['id','name',_0x7cad('0x34')]}]})[_0x7cad('0xd')](function(_0x2eef30){var _0x2d1d8a=[];var _0x4015d5=[];for(var _0x12da20=0x0;_0x12da20<_0x2eef30[_0x7cad('0x35')];_0x12da20+=0x1){if(!_0x4015d5[_0x7cad('0x36')](_0x2eef30[_0x12da20][_0x7cad('0x37')])){_0x4015d5[_0x7cad('0x38')](_0x2eef30[_0x12da20]['UserId']);_0x2d1d8a[_0x7cad('0x38')](_0x2eef30[_0x12da20][_0x7cad('0x28')](_0x10422b['body'],{'transaction':_0x2f7cdb}));}}return BPromise['all'](_0x2d1d8a);});})['then'](function(_0x554f82){logger[_0x7cad('0x22')](_0x7cad('0x39'),_0x10422b);logger[_0x7cad('0x24')](_0x7cad('0x39'),_0x10422b,JSON['stringify'](_0x554f82));_0x3104fa(_0x554f82);})['catch'](function(_0x765d78){logger[_0x7cad('0x10')](_0x7cad('0x39'),_0x765d78[_0x7cad('0x13')],_0x10422b);_0x327e27(_0x344bf9['error'](0x1f4,_0x765d78['message']));});});});};exports[_0x7cad('0x3a')]=function(_0x39f1fc){var _0x52ec87=this;return new Promise(function(_0xbbe5b8,_0x3d59ec){return db[_0x7cad('0x2b')][_0x7cad('0x2c')](function(_0xe1163c){return db[_0x7cad('0x3b')][_0x7cad('0x3c')](_0x39f1fc['body'],{'raw':_0x39f1fc['options']?_0x39f1fc[_0x7cad('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0xe1163c})[_0x7cad('0xd')](function(){return db['CmHopper'][_0x7cad('0x2a')]({'where':_0x39f1fc['options']?_0x39f1fc[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null,'transaction':_0xe1163c});});})[_0x7cad('0xd')](function(_0x19031b){logger['info'](_0x7cad('0x3a'),_0x39f1fc);logger[_0x7cad('0x24')](_0x7cad('0x3a'),_0x39f1fc,JSON[_0x7cad('0x1f')](_0x19031b));_0xbbe5b8(_0x19031b);})[_0x7cad('0x15')](function(_0x43eb26){logger['error'](_0x7cad('0x3a'),_0x43eb26[_0x7cad('0x13')],_0x39f1fc);_0x3d59ec(_0x52ec87[_0x7cad('0x10')](0x1f4,_0x43eb26[_0x7cad('0x13')]));});});};exports[_0x7cad('0x3d')]=function(_0x206f2f){var _0x4dc8b0=this;return new Promise(function(_0x56c7b0,_0x3c3a22){return db[_0x7cad('0x17')][_0x7cad('0x18')]({'raw':_0x206f2f['options']?_0x206f2f[_0x7cad('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x206f2f[_0x7cad('0x19')]?_0x206f2f[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null,'attributes':[[db[_0x7cad('0x2b')]['fn'](_0x7cad('0x3e'),db[_0x7cad('0x2b')]['fn']('IF',db[_0x7cad('0x2b')][_0x7cad('0x3f')](_0x7cad('0x40')+util[_0x7cad('0x41')](_0x7cad('0x42'),moment()['format'](_0x7cad('0x43')))+_0x7cad('0x44')))),'contactsRescheduled']]})[_0x7cad('0xd')](function(_0x4deb18){logger['info'](_0x7cad('0x3d'),_0x206f2f);logger['debug'](_0x7cad('0x3d'),_0x206f2f,JSON[_0x7cad('0x1f')](_0x4deb18));_0x56c7b0(_0x4deb18);})[_0x7cad('0x15')](function(_0x181c0d){logger[_0x7cad('0x10')]('CountReScheduled',_0x181c0d[_0x7cad('0x13')],_0x206f2f);_0x3c3a22(_0x4dc8b0['error'](0x1f4,_0x181c0d[_0x7cad('0x13')]));});});};exports[_0x7cad('0x45')]=function(_0x56d2f5){var _0x212eec=this;return new Promise(function(_0x5bf988,_0x13bfd6){return db[_0x7cad('0x30')][_0x7cad('0x46')]()[_0x7cad('0xd')](function(_0x3fb9ef){return db[_0x7cad('0x2b')][_0x7cad('0x2c')](function(_0x465650){return db[_0x7cad('0x17')][_0x7cad('0x18')]({'where':_0x56d2f5[_0x7cad('0x19')]?_0x56d2f5[_0x7cad('0x19')]['where']||null:null,'attributes':_0x56d2f5[_0x7cad('0x19')]?_0x56d2f5['options']['attributes']||null:null,'limit':0x1,'order':_0x56d2f5[_0x7cad('0x19')]?_0x56d2f5[_0x7cad('0x19')][_0x7cad('0x2e')]||null:null,'group':db[_0x7cad('0x17')]['UserId'],'transaction':_0x465650,'lock':_0x465650['LOCK'][_0x7cad('0x2f')],'include':_0x56d2f5[_0x7cad('0x19')]?_0x56d2f5[_0x7cad('0x19')][_0x7cad('0x1c')]?_[_0x7cad('0x1d')](_0x56d2f5['options'][_0x7cad('0x1c')],function(_0x3bf764){return{'model':db[_0x3bf764['model']],'as':_0x3bf764['as'],'attributes':_0x3bf764[_0x7cad('0x1b')],'include':_0x3bf764['include']?_[_0x7cad('0x1d')](_0x3bf764[_0x7cad('0x1c')],function(_0x5a5e71){return{'model':db[_0x5a5e71[_0x7cad('0x1e')]],'as':_0x5a5e71['as'],'attributes':_0x5a5e71[_0x7cad('0x1b')],'include':_0x5a5e71[_0x7cad('0x1c')]?_[_0x7cad('0x1d')](_0x5a5e71[_0x7cad('0x1c')],function(_0x530503){return{'model':db[_0x530503[_0x7cad('0x1e')]],'as':_0x530503['as'],'attributes':_0x530503[_0x7cad('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7cad('0xd')](function(_0x3b2db0){var _0xaa802d=[];for(var _0x2fb729=0x0;_0x2fb729<_0x3b2db0[_0x7cad('0x35')];_0x2fb729+=0x1){_0xaa802d['push'](_0x3b2db0[_0x2fb729][_0x7cad('0x28')](_0x56d2f5[_0x7cad('0x26')],{'transaction':_0x465650}));}return BPromise[_0x7cad('0x47')](_0xaa802d);});})[_0x7cad('0xd')](function(_0xd685c6){logger[_0x7cad('0x22')]('GetContactRecallMe',_0x56d2f5);logger[_0x7cad('0x24')](_0x7cad('0x45'),_0x56d2f5,JSON[_0x7cad('0x1f')](_0xd685c6));_0x5bf988(_0xd685c6);})[_0x7cad('0x15')](function(_0x21c4b2){logger[_0x7cad('0x10')]('GetContactRecallMe',_0x21c4b2[_0x7cad('0x13')],_0x56d2f5);_0x13bfd6(_0x212eec['error'](0x1f4,_0x21c4b2['message']));});});});};exports[_0x7cad('0x48')]=function(_0x331314){var _0x272692=this;return new Promise(function(_0x4fbf18,_0x177af1){db[_0x7cad('0x30')]['describe']()['then'](function(_0x2a6e01){return db[_0x7cad('0x17')][_0x7cad('0x18')]({'raw':_0x331314[_0x7cad('0x19')]?_0x331314[_0x7cad('0x19')][_0x7cad('0x21')]===undefined?!![]:![]:!![],'where':_0x331314[_0x7cad('0x19')]?_0x331314[_0x7cad('0x19')][_0x7cad('0x1a')]||null:null,'attributes':_0x331314[_0x7cad('0x19')]?_0x331314[_0x7cad('0x19')][_0x7cad('0x1b')]||null:null,'limit':_0x331314[_0x7cad('0x19')]?_0x331314[_0x7cad('0x19')][_0x7cad('0x2d')]||null:null,'include':_0x331314['options']?_0x331314[_0x7cad('0x19')]['include']?_[_0x7cad('0x1d')](_0x331314[_0x7cad('0x19')][_0x7cad('0x1c')],function(_0x34cf10){return{'model':db[_0x34cf10['model']],'as':_0x34cf10['as'],'attributes':_0x34cf10['as']===_0x7cad('0x31')?_[_0x7cad('0x32')](_0x2a6e01):_0x34cf10[_0x7cad('0x1b')],'include':_0x34cf10[_0x7cad('0x1c')]?_[_0x7cad('0x1d')](_0x34cf10[_0x7cad('0x1c')],function(_0xc6960){return{'model':db[_0xc6960[_0x7cad('0x1e')]],'as':_0xc6960['as'],'attributes':_0xc6960[_0x7cad('0x1b')],'include':_0xc6960[_0x7cad('0x1c')]?_['map'](_0xc6960[_0x7cad('0x1c')],function(_0x153545){return{'model':db[_0x153545['model']],'as':_0x153545['as'],'attributes':_0x153545[_0x7cad('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7cad('0xd')](function(_0x4b801b){logger[_0x7cad('0x22')](_0x7cad('0x16'),_0x331314);logger['debug'](_0x7cad('0x16'),_0x331314,JSON[_0x7cad('0x1f')](_0x4b801b));_0x4fbf18(_0x4b801b);})[_0x7cad('0x15')](function(_0x161937){logger[_0x7cad('0x10')]('GetCmHopper',_0x161937[_0x7cad('0x13')],_0x331314);_0x177af1(_0x272692['error'](0x1f4,_0x161937[_0x7cad('0x13')]));});});});}; \ No newline at end of file +var _0xc1cc=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','describe','sequelize','transaction','LOCK','UPDATE','Contact','Agent','name','voicePause','length','includes','push','UserId','all','GetContactDialer','CmHopperFinal','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','CmContact','keys','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x22f99f,_0xc2311d){var _0x78c84f=function(_0x473e86){while(--_0x473e86){_0x22f99f['push'](_0x22f99f['shift']());}};_0x78c84f(++_0xc2311d);}(_0xc1cc,0xd1));var _0xcc1c=function(_0xa4b78d,_0x369973){_0xa4b78d=_0xa4b78d-0x0;var _0x13cca3=_0xc1cc[_0xa4b78d];return _0x13cca3;};'use strict';var _=require(_0xcc1c('0x0'));var util=require(_0xcc1c('0x1'));var moment=require(_0xcc1c('0x2'));var BPromise=require(_0xcc1c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc1c('0x4'));var db=require(_0xcc1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc1c('0x6'))(_0xcc1c('0x7'));var config=require(_0xcc1c('0x8'));var jayson=require(_0xcc1c('0x9'));var client=jayson[_0xcc1c('0xa')][_0xcc1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22c835,_0xc7491c,_0x1311ac){return new BPromise(function(_0x36ece5,_0x20cf67){return client[_0xcc1c('0xc')](_0x22c835,_0x1311ac)[_0xcc1c('0xd')](function(_0x44d819){logger[_0xcc1c('0xe')]('CmHopper,\x20%s,\x20%s',_0xc7491c,_0xcc1c('0xf'));logger[_0xcc1c('0x10')](_0xcc1c('0x11'),_0xc7491c,_0xcc1c('0xf'),JSON['stringify'](_0x44d819));if(_0x44d819['error']){if(_0x44d819['error']['code']===0x1f4){logger[_0xcc1c('0x12')](_0xcc1c('0x13'),_0xc7491c,_0x44d819['error'][_0xcc1c('0x14')]);return _0x20cf67(_0x44d819[_0xcc1c('0x12')][_0xcc1c('0x14')]);}logger[_0xcc1c('0x12')](_0xcc1c('0x13'),_0xc7491c,_0x44d819['error'][_0xcc1c('0x14')]);return _0x36ece5(_0x44d819['error'][_0xcc1c('0x14')]);}else{logger[_0xcc1c('0xe')]('CmHopper,\x20%s,\x20%s',_0xc7491c,_0xcc1c('0xf'));_0x36ece5(_0x44d819[_0xcc1c('0x15')][_0xcc1c('0x14')]);}})[_0xcc1c('0x16')](function(_0x42c9b7){logger[_0xcc1c('0x12')](_0xcc1c('0x13'),_0xc7491c,_0x42c9b7);_0x20cf67(_0x42c9b7);});});}exports[_0xcc1c('0x17')]=function(_0x322732){var _0x3454a3=this;return new Promise(function(_0x479a65,_0x40bece){return db[_0xcc1c('0x18')][_0xcc1c('0x19')]({'raw':_0x322732[_0xcc1c('0x1a')]?_0x322732['options'][_0xcc1c('0x1b')]===undefined?!![]:![]:!![],'where':_0x322732[_0xcc1c('0x1a')]?_0x322732[_0xcc1c('0x1a')][_0xcc1c('0x1c')]||null:null,'attributes':_0x322732[_0xcc1c('0x1a')]?_0x322732['options'][_0xcc1c('0x1d')]||null:null,'limit':_0x322732[_0xcc1c('0x1a')]?_0x322732['options'][_0xcc1c('0x1e')]||null:null,'include':_0x322732[_0xcc1c('0x1a')]?_0x322732['options'][_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0x322732['options']['include'],function(_0x12f058){return{'model':db[_0x12f058[_0xcc1c('0x21')]],'as':_0x12f058['as'],'attributes':_0x12f058[_0xcc1c('0x1d')],'include':_0x12f058[_0xcc1c('0x1f')]?_['map'](_0x12f058[_0xcc1c('0x1f')],function(_0x51bf6d){return{'model':db[_0x51bf6d[_0xcc1c('0x21')]],'as':_0x51bf6d['as'],'attributes':_0x51bf6d[_0xcc1c('0x1d')],'include':_0x51bf6d[_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0x51bf6d['include'],function(_0x4f5586){return{'model':db[_0x4f5586[_0xcc1c('0x21')]],'as':_0x4f5586['as'],'attributes':_0x4f5586[_0xcc1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc1c('0xd')](function(_0x13b9e2){logger['info'](_0xcc1c('0x17'),_0x322732);logger[_0xcc1c('0x10')](_0xcc1c('0x17'),_0x322732,JSON[_0xcc1c('0x22')](_0x13b9e2));_0x479a65(_0x13b9e2);})['catch'](function(_0x53a49a){logger[_0xcc1c('0x12')](_0xcc1c('0x17'),_0x53a49a[_0xcc1c('0x14')],_0x322732);_0x40bece(_0x3454a3['error'](0x1f4,_0x53a49a[_0xcc1c('0x14')]));});});};exports['ShowCmHopper']=function(_0x5ae595){var _0x179a55=this;return new Promise(function(_0x332c77,_0x35da65){return db[_0xcc1c('0x18')][_0xcc1c('0x23')]({'raw':_0x5ae595['options']?_0x5ae595[_0xcc1c('0x1a')][_0xcc1c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ae595['options']?_0x5ae595['options'][_0xcc1c('0x1c')]||null:null,'attributes':_0x5ae595['options']?_0x5ae595[_0xcc1c('0x1a')][_0xcc1c('0x1d')]||null:null,'include':_0x5ae595[_0xcc1c('0x1a')]?_0x5ae595['options'][_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0x5ae595[_0xcc1c('0x1a')][_0xcc1c('0x1f')],function(_0x15d136){return{'model':db[_0x15d136['model']],'as':_0x15d136['as'],'attributes':_0x15d136[_0xcc1c('0x1d')],'include':_0x15d136['include']?_[_0xcc1c('0x20')](_0x15d136[_0xcc1c('0x1f')],function(_0xf8a7c3){return{'model':db[_0xf8a7c3['model']],'as':_0xf8a7c3['as'],'attributes':_0xf8a7c3[_0xcc1c('0x1d')],'include':_0xf8a7c3[_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0xf8a7c3['include'],function(_0x1daf4d){return{'model':db[_0x1daf4d[_0xcc1c('0x21')]],'as':_0x1daf4d['as'],'attributes':_0x1daf4d[_0xcc1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc1c('0xd')](function(_0x261ff6){logger['info'](_0xcc1c('0x24'),_0x5ae595);logger[_0xcc1c('0x10')](_0xcc1c('0x24'),_0x5ae595,JSON[_0xcc1c('0x22')](_0x261ff6));_0x332c77(_0x261ff6);})['catch'](function(_0x2aa279){logger['error'](_0xcc1c('0x24'),_0x2aa279[_0xcc1c('0x14')],_0x5ae595);_0x35da65(_0x179a55[_0xcc1c('0x12')](0x1f4,_0x2aa279[_0xcc1c('0x14')]));});});};exports[_0xcc1c('0x25')]=function(_0x4914a6){var _0x5c5c77=this;return new Promise(function(_0x496ce5,_0x301f88){return db[_0xcc1c('0x18')][_0xcc1c('0x26')](_0x4914a6[_0xcc1c('0x27')],{'raw':_0x4914a6[_0xcc1c('0x1a')]?_0x4914a6['options'][_0xcc1c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4690c3){logger['info'](_0xcc1c('0x25'),_0x4914a6);logger[_0xcc1c('0x10')](_0xcc1c('0x25'),_0x4914a6,JSON[_0xcc1c('0x22')](_0x4690c3));_0x496ce5(_0x4690c3);})['catch'](function(_0x2c4328){logger[_0xcc1c('0x12')]('CreateCmHopper',_0x2c4328[_0xcc1c('0x14')],_0x4914a6);_0x301f88(_0x5c5c77[_0xcc1c('0x12')](0x1f4,_0x2c4328[_0xcc1c('0x14')]));});});};exports[_0xcc1c('0x28')]=function(_0x1ac87d){var _0x30662a=this;return new Promise(function(_0x4b429d,_0x4d006e){return db[_0xcc1c('0x18')][_0xcc1c('0x29')](_0x1ac87d[_0xcc1c('0x27')],{'raw':_0x1ac87d[_0xcc1c('0x1a')]?_0x1ac87d['options'][_0xcc1c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac87d[_0xcc1c('0x1a')]?_0x1ac87d[_0xcc1c('0x1a')][_0xcc1c('0x1c')]||null:null,'attributes':_0x1ac87d['options']?_0x1ac87d[_0xcc1c('0x1a')]['attributes']||null:null,'limit':_0x1ac87d[_0xcc1c('0x1a')]?_0x1ac87d[_0xcc1c('0x1a')][_0xcc1c('0x1e')]||null:null})['then'](function(_0x33fdc3){logger[_0xcc1c('0xe')](_0xcc1c('0x28'),_0x1ac87d);logger[_0xcc1c('0x10')](_0xcc1c('0x28'),_0x1ac87d,JSON['stringify'](_0x33fdc3));_0x4b429d(_0x33fdc3);})[_0xcc1c('0x16')](function(_0xe9a2c0){logger['error'](_0xcc1c('0x28'),_0xe9a2c0[_0xcc1c('0x14')],_0x1ac87d);_0x4d006e(_0x30662a[_0xcc1c('0x12')](0x1f4,_0xe9a2c0['message']));});});};exports[_0xcc1c('0x2a')]=function(_0x5178ca){var _0x5c30a6=this;return new Promise(function(_0x16d6f1,_0x438947){return db[_0xcc1c('0x18')][_0xcc1c('0x2b')]({'where':_0x5178ca[_0xcc1c('0x1a')]?_0x5178ca[_0xcc1c('0x1a')][_0xcc1c('0x1c')]||null:null})[_0xcc1c('0xd')](function(_0x249b95){logger[_0xcc1c('0xe')](_0xcc1c('0x2a'),_0x5178ca);logger[_0xcc1c('0x10')](_0xcc1c('0x2a'),_0x5178ca,JSON[_0xcc1c('0x22')](_0x249b95));_0x16d6f1(_0x249b95);})[_0xcc1c('0x16')](function(_0x5182fe){logger[_0xcc1c('0x12')](_0xcc1c('0x2a'),_0x5182fe[_0xcc1c('0x14')],_0x5178ca);_0x438947(_0x5c30a6[_0xcc1c('0x12')](0x1f4,_0x5182fe[_0xcc1c('0x14')]));});});};exports['GetContactDialer']=function(_0x49dea1){var _0x1c631f=this;return new Promise(function(_0x2f3969,_0x765de4){return db['CmContact'][_0xcc1c('0x2c')]()['then'](function(_0x2bd053){return db[_0xcc1c('0x2d')][_0xcc1c('0x2e')](function(_0x1eae97){return db['CmHopper'][_0xcc1c('0x19')]({'where':_0x49dea1['options']?_0x49dea1[_0xcc1c('0x1a')]['where']||null:null,'attributes':_0x49dea1['options']?_0x49dea1[_0xcc1c('0x1a')][_0xcc1c('0x1d')]||null:null,'limit':_0x49dea1[_0xcc1c('0x1a')]?_0x49dea1['options'][_0xcc1c('0x1e')]||null:null,'order':_0x49dea1[_0xcc1c('0x1a')]?_0x49dea1[_0xcc1c('0x1a')]['order']||null:null,'transaction':_0x1eae97,'lock':_0x1eae97[_0xcc1c('0x2f')][_0xcc1c('0x30')],'include':[{'model':db['CmContact'],'as':_0xcc1c('0x31'),'attributes':_['keys'](_0x2bd053)},{'model':db['User'],'as':_0xcc1c('0x32'),'attributes':['id',_0xcc1c('0x33'),_0xcc1c('0x34')]}]})[_0xcc1c('0xd')](function(_0x5145b7){var _0x5e4358=[];var _0x4ec617=[];for(var _0xfa409b=0x0;_0xfa409b<_0x5145b7[_0xcc1c('0x35')];_0xfa409b+=0x1){if(!_0x4ec617[_0xcc1c('0x36')](_0x5145b7[_0xfa409b]['UserId'])){_0x4ec617[_0xcc1c('0x37')](_0x5145b7[_0xfa409b][_0xcc1c('0x38')]);_0x5e4358['push'](_0x5145b7[_0xfa409b][_0xcc1c('0x29')](_0x49dea1[_0xcc1c('0x27')],{'transaction':_0x1eae97}));}}return BPromise[_0xcc1c('0x39')](_0x5e4358);});})[_0xcc1c('0xd')](function(_0x12031b){logger[_0xcc1c('0xe')]('GetContactDialer',_0x49dea1);logger[_0xcc1c('0x10')](_0xcc1c('0x3a'),_0x49dea1,JSON[_0xcc1c('0x22')](_0x12031b));_0x2f3969(_0x12031b);})[_0xcc1c('0x16')](function(_0x51c87c){logger[_0xcc1c('0x12')](_0xcc1c('0x3a'),_0x51c87c['message'],_0x49dea1);_0x765de4(_0x1c631f[_0xcc1c('0x12')](0x1f4,_0x51c87c[_0xcc1c('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x1812c2){var _0x62a99b=this;return new Promise(function(_0xcbdcd1,_0x571b4b){return db[_0xcc1c('0x2d')][_0xcc1c('0x2e')](function(_0x17e865){return db[_0xcc1c('0x3b')][_0xcc1c('0x26')](_0x1812c2[_0xcc1c('0x27')],{'raw':_0x1812c2[_0xcc1c('0x1a')]?_0x1812c2['options'][_0xcc1c('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x17e865})[_0xcc1c('0xd')](function(){return db['CmHopper']['destroy']({'where':_0x1812c2['options']?_0x1812c2['options'][_0xcc1c('0x1c')]||null:null,'transaction':_0x17e865});});})[_0xcc1c('0xd')](function(_0x1944c4){logger[_0xcc1c('0xe')]('MoveContactManagedDialer',_0x1812c2);logger[_0xcc1c('0x10')](_0xcc1c('0x3c'),_0x1812c2,JSON[_0xcc1c('0x22')](_0x1944c4));_0xcbdcd1(_0x1944c4);})[_0xcc1c('0x16')](function(_0x10c004){logger[_0xcc1c('0x12')]('MoveContactManagedDialer',_0x10c004['message'],_0x1812c2);_0x571b4b(_0x62a99b[_0xcc1c('0x12')](0x1f4,_0x10c004[_0xcc1c('0x14')]));});});};exports['CountReScheduled']=function(_0x536eb7){var _0x49660c=this;return new Promise(function(_0xd198ad,_0x126621){return db['CmHopper'][_0xcc1c('0x19')]({'raw':_0x536eb7[_0xcc1c('0x1a')]?_0x536eb7[_0xcc1c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x536eb7[_0xcc1c('0x1a')]?_0x536eb7[_0xcc1c('0x1a')][_0xcc1c('0x1c')]||null:null,'attributes':[[db[_0xcc1c('0x2d')]['fn'](_0xcc1c('0x3d'),db[_0xcc1c('0x2d')]['fn']('IF',db['sequelize'][_0xcc1c('0x3e')](_0xcc1c('0x3f')+util[_0xcc1c('0x40')]('\x22%s\x22',moment()[_0xcc1c('0x40')](_0xcc1c('0x41')))+_0xcc1c('0x42')))),'contactsRescheduled']]})[_0xcc1c('0xd')](function(_0x605381){logger[_0xcc1c('0xe')](_0xcc1c('0x43'),_0x536eb7);logger[_0xcc1c('0x10')](_0xcc1c('0x43'),_0x536eb7,JSON[_0xcc1c('0x22')](_0x605381));_0xd198ad(_0x605381);})[_0xcc1c('0x16')](function(_0x3b373a){logger[_0xcc1c('0x12')](_0xcc1c('0x43'),_0x3b373a[_0xcc1c('0x14')],_0x536eb7);_0x126621(_0x49660c['error'](0x1f4,_0x3b373a[_0xcc1c('0x14')]));});});};exports[_0xcc1c('0x44')]=function(_0x47d85a){var _0x3a459f=this;return new Promise(function(_0x501cf9,_0x45c85a){return db['CmContact'][_0xcc1c('0x2c')]()['then'](function(_0x522b2f){return db['sequelize'][_0xcc1c('0x2e')](function(_0x5ccc8c){return db['CmHopper'][_0xcc1c('0x19')]({'where':_0x47d85a[_0xcc1c('0x1a')]?_0x47d85a[_0xcc1c('0x1a')][_0xcc1c('0x1c')]||null:null,'attributes':_0x47d85a[_0xcc1c('0x1a')]?_0x47d85a[_0xcc1c('0x1a')][_0xcc1c('0x1d')]||null:null,'limit':0x1,'order':_0x47d85a[_0xcc1c('0x1a')]?_0x47d85a[_0xcc1c('0x1a')]['order']||null:null,'group':db['CmHopper'][_0xcc1c('0x38')],'transaction':_0x5ccc8c,'lock':_0x5ccc8c[_0xcc1c('0x2f')][_0xcc1c('0x30')],'include':_0x47d85a[_0xcc1c('0x1a')]?_0x47d85a[_0xcc1c('0x1a')][_0xcc1c('0x1f')]?_['map'](_0x47d85a[_0xcc1c('0x1a')][_0xcc1c('0x1f')],function(_0xc4e2e){return{'model':db[_0xc4e2e[_0xcc1c('0x21')]],'as':_0xc4e2e['as'],'attributes':_0xc4e2e['attributes'],'include':_0xc4e2e[_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0xc4e2e['include'],function(_0x86d860){return{'model':db[_0x86d860[_0xcc1c('0x21')]],'as':_0x86d860['as'],'attributes':_0x86d860[_0xcc1c('0x1d')],'include':_0x86d860[_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0x86d860[_0xcc1c('0x1f')],function(_0x468778){return{'model':db[_0x468778[_0xcc1c('0x21')]],'as':_0x468778['as'],'attributes':_0x468778[_0xcc1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc1c('0xd')](function(_0x35d7dd){var _0x5186b6=[];for(var _0xbf40d1=0x0;_0xbf40d1<_0x35d7dd['length'];_0xbf40d1+=0x1){_0x5186b6[_0xcc1c('0x37')](_0x35d7dd[_0xbf40d1][_0xcc1c('0x29')](_0x47d85a[_0xcc1c('0x27')],{'transaction':_0x5ccc8c}));}return BPromise[_0xcc1c('0x39')](_0x5186b6);});})['then'](function(_0x4fcb35){logger[_0xcc1c('0xe')]('GetContactRecallMe',_0x47d85a);logger[_0xcc1c('0x10')](_0xcc1c('0x44'),_0x47d85a,JSON[_0xcc1c('0x22')](_0x4fcb35));_0x501cf9(_0x4fcb35);})[_0xcc1c('0x16')](function(_0x6ab9cb){logger[_0xcc1c('0x12')](_0xcc1c('0x44'),_0x6ab9cb[_0xcc1c('0x14')],_0x47d85a);_0x45c85a(_0x3a459f[_0xcc1c('0x12')](0x1f4,_0x6ab9cb['message']));});});});};exports[_0xcc1c('0x45')]=function(_0x154b93){var _0x283ab6=this;return new Promise(function(_0x5e69f4,_0x51373f){db[_0xcc1c('0x46')][_0xcc1c('0x2c')]()[_0xcc1c('0xd')](function(_0x444e93){return db[_0xcc1c('0x18')][_0xcc1c('0x19')]({'raw':_0x154b93[_0xcc1c('0x1a')]?_0x154b93[_0xcc1c('0x1a')][_0xcc1c('0x1b')]===undefined?!![]:![]:!![],'where':_0x154b93[_0xcc1c('0x1a')]?_0x154b93['options'][_0xcc1c('0x1c')]||null:null,'attributes':_0x154b93[_0xcc1c('0x1a')]?_0x154b93['options'][_0xcc1c('0x1d')]||null:null,'limit':_0x154b93[_0xcc1c('0x1a')]?_0x154b93[_0xcc1c('0x1a')][_0xcc1c('0x1e')]||null:null,'include':_0x154b93[_0xcc1c('0x1a')]?_0x154b93['options'][_0xcc1c('0x1f')]?_['map'](_0x154b93[_0xcc1c('0x1a')][_0xcc1c('0x1f')],function(_0x3415ea){return{'model':db[_0x3415ea['model']],'as':_0x3415ea['as'],'attributes':_0x3415ea['as']==='Contact'?_[_0xcc1c('0x47')](_0x444e93):_0x3415ea[_0xcc1c('0x1d')],'include':_0x3415ea[_0xcc1c('0x1f')]?_[_0xcc1c('0x20')](_0x3415ea[_0xcc1c('0x1f')],function(_0xf3603d){return{'model':db[_0xf3603d[_0xcc1c('0x21')]],'as':_0xf3603d['as'],'attributes':_0xf3603d[_0xcc1c('0x1d')],'include':_0xf3603d['include']?_[_0xcc1c('0x20')](_0xf3603d[_0xcc1c('0x1f')],function(_0x4bd998){return{'model':db[_0x4bd998[_0xcc1c('0x21')]],'as':_0x4bd998['as'],'attributes':_0x4bd998[_0xcc1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc1c('0xd')](function(_0x315f3a){logger[_0xcc1c('0xe')](_0xcc1c('0x17'),_0x154b93);logger[_0xcc1c('0x10')]('GetCmHopper',_0x154b93,JSON[_0xcc1c('0x22')](_0x315f3a));_0x5e69f4(_0x315f3a);})[_0xcc1c('0x16')](function(_0x86539d){logger[_0xcc1c('0x12')](_0xcc1c('0x17'),_0x86539d['message'],_0x154b93);_0x51373f(_0x283ab6[_0xcc1c('0x12')](0x1f4,_0x86539d['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2ead913..b6cb348 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 _0xbbbc=['../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4898ec,_0x5a2551){_0x4898ec=_0x4898ec-0x0;var _0xe0d249=_0xbbbc[_0x4898ec];return _0xe0d249;};'use strict';var multer=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var path=require(_0xcbbb('0x2'));var timeout=require(_0xcbbb('0x3'));var express=require(_0xcbbb('0x4'));var router=express[_0xcbbb('0x5')]();var auth=require(_0xcbbb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcbbb('0x7'));var controller=require(_0xcbbb('0x8'));router[_0xcbbb('0x9')]('/',auth[_0xcbbb('0xa')](),controller[_0xcbbb('0xb')]);router['get'](_0xcbbb('0xc'),auth[_0xcbbb('0xa')](),controller[_0xcbbb('0xd')]);router[_0xcbbb('0x9')](_0xcbbb('0xe'),auth[_0xcbbb('0xa')](),controller[_0xcbbb('0xf')]);router['get'](_0xcbbb('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xcbbb('0x11')]('/',auth['isAuthenticated'](),controller[_0xcbbb('0x12')]);router['post'](_0xcbbb('0x13'),auth[_0xcbbb('0xa')](),controller['getPreview']);router[_0xcbbb('0x14')]('/:id',auth[_0xcbbb('0xa')](),controller['update']);router[_0xcbbb('0x15')](_0xcbbb('0x10'),auth[_0xcbbb('0xa')](),controller['destroy']);module[_0xcbbb('0x16')]=router; \ No newline at end of file +var _0xe511=['/:id','show','post','/preview','getPreview','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','/opencontacts'];(function(_0x4ccb82,_0x56aeeb){var _0x529055=function(_0x28f33a){while(--_0x28f33a){_0x4ccb82['push'](_0x4ccb82['shift']());}};_0x529055(++_0x56aeeb);}(_0xe511,0x16f));var _0x1e51=function(_0x107e87,_0x20293b){_0x107e87=_0x107e87-0x0;var _0x267b1a=_0xe511[_0x107e87];return _0x267b1a;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var auth=require(_0x1e51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e51('0x5'));var controller=require(_0x1e51('0x6'));router[_0x1e51('0x7')]('/',auth[_0x1e51('0x8')](),controller['index']);router[_0x1e51('0x7')](_0x1e51('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x1e51('0x7')](_0x1e51('0xa'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x1e51('0x7')](_0x1e51('0xb'),auth[_0x1e51('0x8')](),controller[_0x1e51('0xc')]);router[_0x1e51('0xd')]('/',auth[_0x1e51('0x8')](),controller['create']);router[_0x1e51('0xd')](_0x1e51('0xe'),auth[_0x1e51('0x8')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')](_0x1e51('0xb'),auth['isAuthenticated'](),controller[_0x1e51('0x11')]);router[_0x1e51('0x12')](_0x1e51('0xb'),auth[_0x1e51('0x8')](),controller[_0x1e51('0x13')]);module[_0x1e51('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2a81152..b08fada 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 _0x7064=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x7064,0xc1));var _0x4706=function(_0xf8c6b2,_0x2d1ac2){_0xf8c6b2=_0xf8c6b2-0x0;var _0x10db2b=_0x7064[_0xf8c6b2];return _0x10db2b;};'use strict';var moment=require(_0x4706('0x0'));var Sequelize=require(_0x4706('0x1'));module[_0x4706('0x2')]={'phone':{'type':Sequelize[_0x4706('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4706('0x4')],'unique':_0x4706('0x5')},'ListId':{'type':Sequelize[_0x4706('0x4')],'unique':_0x4706('0x5')},'VoiceQueueId':{'type':Sequelize[_0x4706('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x8744=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8744,0xf1));var _0x4874=function(_0x5c4ae7,_0x40e353){_0x5c4ae7=_0x5c4ae7-0x0;var _0x3651b7=_0x8744[_0x5c4ae7];return _0x3651b7;};'use strict';var moment=require(_0x4874('0x0'));var Sequelize=require(_0x4874('0x1'));module[_0x4874('0x2')]={'phone':{'type':Sequelize[_0x4874('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4874('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4874('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4874('0x4')],'unique':_0x4874('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9df46f2..c9a9936 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 _0x5a5b=['filters','merge','where','type','VIRTUAL','filter','options','count','includeAll','include','rows','show','rawAttributes','body','find','params','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','offset','limit','Content-Range','json','apply','update','then','destroy','error','name','index','CmHopperBlack','fieldName','key','map','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3cec45,_0x37d817){var _0x51d691=function(_0x2c671f){while(--_0x2c671f){_0x3cec45['push'](_0x3cec45['shift']());}};_0x51d691(++_0x37d817);}(_0x5a5b,0x1c2));var _0xb5a5=function(_0x25049c,_0x37d74c){_0x25049c=_0x25049c-0x0;var _0x1cc6d1=_0x5a5b[_0x25049c];return _0x1cc6d1;};'use strict';var pdf=require(_0xb5a5('0x0'));var emlformat=require(_0xb5a5('0x1'));var rimraf=require(_0xb5a5('0x2'));var zipdir=require(_0xb5a5('0x3'));var jsonpatch=require(_0xb5a5('0x4'));var rp=require(_0xb5a5('0x5'));var moment=require(_0xb5a5('0x6'));var BPromise=require(_0xb5a5('0x7'));var Mustache=require(_0xb5a5('0x8'));var util=require(_0xb5a5('0x9'));var path=require(_0xb5a5('0xa'));var sox=require(_0xb5a5('0xb'));var csv=require('to-csv');var ejs=require(_0xb5a5('0xc'));var fs=require('fs');var _=require(_0xb5a5('0xd'));var squel=require(_0xb5a5('0xe'));var crypto=require('crypto');var jsforce=require(_0xb5a5('0xf'));var deskjs=require(_0xb5a5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb5a5('0x11'));var Papa=require(_0xb5a5('0x12'));var Redis=require(_0xb5a5('0x13'));var authService=require(_0xb5a5('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5a5('0x15'));var logger=require(_0xb5a5('0x16'))(_0xb5a5('0x17'));var utils=require('../../config/utils');var config=require(_0xb5a5('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x417115,_0x5b3c55){_0x5b3c55=_0x5b3c55||0xcc;return function(_0x2fd8d7){if(_0x2fd8d7){return _0x417115[_0xb5a5('0x19')](_0x5b3c55);}return _0x417115['status'](_0x5b3c55)[_0xb5a5('0x1a')]();};}function respondWithResult(_0xbb284b,_0x21b024){_0x21b024=_0x21b024||0xc8;return function(_0x2e3c7e){if(_0x2e3c7e){return _0xbb284b[_0xb5a5('0x1b')](_0x21b024)['json'](_0x2e3c7e);}};}function respondWithFilteredResult(_0x503f9d,_0x48dc05){return function(_0x3ee170){if(_0x3ee170){var _0x591ad7=_0x3ee170['count'],_0x46c68d=_0x48dc05[_0xb5a5('0x1c')],_0x294811=_0x48dc05[_0xb5a5('0x1c')]+_0x48dc05[_0xb5a5('0x1d')],_0x5c7604;if(_0x294811>=_0x591ad7){_0x294811=_0x591ad7;_0x5c7604=0xc8;}else{_0x5c7604=0xce;}_0x503f9d['status'](_0x5c7604);return _0x503f9d['set'](_0xb5a5('0x1e'),_0x46c68d+'-'+_0x294811+'/'+_0x591ad7)[_0xb5a5('0x1f')](_0x3ee170);}return null;};}function patchUpdates(_0x558d0c){return function(_0x3a3947){try{jsonpatch[_0xb5a5('0x20')](_0x3a3947,_0x558d0c,!![]);}catch(_0x55d2ba){return BPromise['reject'](_0x55d2ba);}return _0x3a3947['save']();};}function saveUpdates(_0x429f55,_0x22b31c){return function(_0x2ee20e){if(_0x2ee20e){return _0x2ee20e[_0xb5a5('0x21')](_0x429f55)[_0xb5a5('0x22')](function(_0x4f4c8b){return _0x4f4c8b;});}return null;};}function removeEntity(_0x2226c6,_0xf40fdf){return function(_0x4da875){if(_0x4da875){return _0x4da875[_0xb5a5('0x23')]()[_0xb5a5('0x22')](function(){_0x2226c6[_0xb5a5('0x1b')](0xcc)[_0xb5a5('0x1a')]();});}};}function handleEntityNotFound(_0x3d867a,_0x4acb66){return function(_0xa1e5a3){if(!_0xa1e5a3){_0x3d867a[_0xb5a5('0x19')](0x194);}return _0xa1e5a3;};}function handleError(_0x1167c5,_0x4fdfbe){_0x4fdfbe=_0x4fdfbe||0x1f4;return function(_0x378203){logger[_0xb5a5('0x24')](_0x378203['stack']);if(_0x378203[_0xb5a5('0x25')]){delete _0x378203[_0xb5a5('0x25')];}_0x1167c5['status'](_0x4fdfbe)['send'](_0x378203);};}exports[_0xb5a5('0x26')]=function(_0x9b2b9d,_0x224472){var _0x592129={},_0x1f5759={},_0x1addf9={'count':0x0,'rows':[]};var _0x4532f3=_['map'](db[_0xb5a5('0x27')]['rawAttributes'],function(_0x42a49a){return{'name':_0x42a49a[_0xb5a5('0x28')],'type':_0x42a49a['type'][_0xb5a5('0x29')]};});_0x1f5759['model']=_[_0xb5a5('0x2a')](_0x4532f3,_0xb5a5('0x25'));_0x1f5759[_0xb5a5('0x2b')]=_[_0xb5a5('0x2c')](_0x9b2b9d[_0xb5a5('0x2b')]);_0x1f5759['filters']=_['intersection'](_0x1f5759[_0xb5a5('0x2d')],_0x1f5759['query']);_0x592129['attributes']=_[_0xb5a5('0x2e')](_0x1f5759[_0xb5a5('0x2d')],qs['fields'](_0x9b2b9d[_0xb5a5('0x2b')][_0xb5a5('0x2f')]));_0x592129[_0xb5a5('0x30')]=_0x592129[_0xb5a5('0x30')][_0xb5a5('0x31')]?_0x592129[_0xb5a5('0x30')]:_0x1f5759[_0xb5a5('0x2d')];if(!_0x9b2b9d[_0xb5a5('0x2b')][_0xb5a5('0x32')](_0xb5a5('0x33'))){_0x592129[_0xb5a5('0x1d')]=qs[_0xb5a5('0x1d')](_0x9b2b9d[_0xb5a5('0x2b')][_0xb5a5('0x1d')]);_0x592129['offset']=qs['offset'](_0x9b2b9d['query'][_0xb5a5('0x1c')]);}_0x592129[_0xb5a5('0x34')]=qs[_0xb5a5('0x35')](_0x9b2b9d['query'][_0xb5a5('0x35')]);_0x592129['where']=qs[_0xb5a5('0x36')](_['pick'](_0x9b2b9d[_0xb5a5('0x2b')],_0x1f5759['filters']),_0x4532f3);if(_0x9b2b9d[_0xb5a5('0x2b')]['filter']){_0x592129['where']=_[_0xb5a5('0x37')](_0x592129[_0xb5a5('0x38')],{'$or':_[_0xb5a5('0x2a')](_0x4532f3,function(_0x249f1c){if(_0x249f1c[_0xb5a5('0x39')]!==_0xb5a5('0x3a')){var _0x254504={};_0x254504[_0x249f1c[_0xb5a5('0x25')]]={'$like':'%'+_0x9b2b9d[_0xb5a5('0x2b')][_0xb5a5('0x3b')]+'%'};return _0x254504;}})});}_0x592129=_[_0xb5a5('0x37')]({},_0x592129,_0x9b2b9d[_0xb5a5('0x3c')]);var _0x4bff82={'where':_0x592129[_0xb5a5('0x38')]};return db[_0xb5a5('0x27')][_0xb5a5('0x3d')](_0x4bff82)[_0xb5a5('0x22')](function(_0x400cc9){_0x1addf9['count']=_0x400cc9;if(_0x9b2b9d[_0xb5a5('0x2b')][_0xb5a5('0x3e')]){_0x592129[_0xb5a5('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x592129);})[_0xb5a5('0x22')](function(_0x25914e){_0x1addf9[_0xb5a5('0x40')]=_0x25914e;return _0x1addf9;})[_0xb5a5('0x22')](respondWithFilteredResult(_0x224472,_0x592129))['catch'](handleError(_0x224472,null));};exports[_0xb5a5('0x41')]=function(_0x42bc8f,_0xef057c){var _0x3395b8={'raw':!![],'where':{'id':_0x42bc8f['params']['id']}},_0x5d1e8c={};_0x5d1e8c['model']=_[_0xb5a5('0x2c')](db[_0xb5a5('0x27')][_0xb5a5('0x42')]);_0x5d1e8c[_0xb5a5('0x2b')]=_[_0xb5a5('0x2c')](_0x42bc8f[_0xb5a5('0x2b')]);_0x5d1e8c[_0xb5a5('0x36')]=_['intersection'](_0x5d1e8c['model'],_0x5d1e8c['query']);_0x3395b8[_0xb5a5('0x30')]=_[_0xb5a5('0x2e')](_0x5d1e8c[_0xb5a5('0x2d')],qs[_0xb5a5('0x2f')](_0x42bc8f['query'][_0xb5a5('0x2f')]));_0x3395b8[_0xb5a5('0x30')]=_0x3395b8[_0xb5a5('0x30')][_0xb5a5('0x31')]?_0x3395b8[_0xb5a5('0x30')]:_0x5d1e8c[_0xb5a5('0x2d')];if(_0x42bc8f[_0xb5a5('0x2b')][_0xb5a5('0x3e')]){_0x3395b8['include']=[{'all':!![]}];}_0x3395b8=_['merge']({},_0x3395b8,_0x42bc8f[_0xb5a5('0x3c')]);return db['CmHopperBlack']['find'](_0x3395b8)[_0xb5a5('0x22')](handleEntityNotFound(_0xef057c,null))[_0xb5a5('0x22')](respondWithResult(_0xef057c,null))['catch'](handleError(_0xef057c,null));};exports[_0xb5a5('0x21')]=function(_0x5d636d,_0x411024){if(_0x5d636d[_0xb5a5('0x43')]['id']){delete _0x5d636d['body']['id'];}return db[_0xb5a5('0x27')][_0xb5a5('0x44')]({'where':{'id':_0x5d636d[_0xb5a5('0x45')]['id']}})[_0xb5a5('0x22')](handleEntityNotFound(_0x411024,null))[_0xb5a5('0x22')](saveUpdates(_0x5d636d['body'],null))[_0xb5a5('0x22')](respondWithResult(_0x411024,null))[_0xb5a5('0x46')](handleError(_0x411024,null));};exports[_0xb5a5('0x23')]=function(_0x334c14,_0x45f880){return db[_0xb5a5('0x27')]['find']({'where':{'id':_0x334c14['params']['id']}})['then'](handleEntityNotFound(_0x45f880,null))['then'](removeEntity(_0x45f880,null))['catch'](handleError(_0x45f880,null));};exports[_0xb5a5('0x47')]=function(_0x4a31e1,_0x1b97c8){return db['CmHopperBlack'][_0xb5a5('0x47')]()[_0xb5a5('0x22')](respondWithResult(_0x1b97c8,null))[_0xb5a5('0x46')](handleError(_0x1b97c8,null));}; \ No newline at end of file +var _0xf233=['json','apply','save','then','destroy','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','count','rows','params','length','include','find','update','body','catch','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','offset','limit','status','Content-Range'];(function(_0x490f8c,_0x152d6a){var _0x561878=function(_0x4cb1a3){while(--_0x4cb1a3){_0x490f8c['push'](_0x490f8c['shift']());}};_0x561878(++_0x152d6a);}(_0xf233,0xb5));var _0x3f23=function(_0x4ee571,_0x25b365){_0x4ee571=_0x4ee571-0x0;var _0x5e26d3=_0xf233[_0x4ee571];return _0x5e26d3;};'use strict';var pdf=require(_0x3f23('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f23('0x1'));var zipdir=require(_0x3f23('0x2'));var jsonpatch=require(_0x3f23('0x3'));var rp=require(_0x3f23('0x4'));var moment=require(_0x3f23('0x5'));var BPromise=require(_0x3f23('0x6'));var Mustache=require(_0x3f23('0x7'));var util=require('util');var path=require(_0x3f23('0x8'));var sox=require(_0x3f23('0x9'));var csv=require(_0x3f23('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f23('0xb'));var squel=require(_0x3f23('0xc'));var crypto=require(_0x3f23('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f23('0xe'));var toCsv=require(_0x3f23('0xa'));var querystring=require(_0x3f23('0xf'));var Papa=require(_0x3f23('0x10'));var Redis=require(_0x3f23('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f23('0x12'));var hardwareService=require(_0x3f23('0x13'));var logger=require(_0x3f23('0x14'))(_0x3f23('0x15'));var utils=require('../../config/utils');var config=require(_0x3f23('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498275,_0x3b9a59){_0x3b9a59=_0x3b9a59||0xcc;return function(_0x378b48){if(_0x378b48){return _0x498275[_0x3f23('0x17')](_0x3b9a59);}return _0x498275['status'](_0x3b9a59)[_0x3f23('0x18')]();};}function respondWithResult(_0x30bca1,_0x3f66d6){_0x3f66d6=_0x3f66d6||0xc8;return function(_0x4c722e){if(_0x4c722e){return _0x30bca1['status'](_0x3f66d6)['json'](_0x4c722e);}};}function respondWithFilteredResult(_0xf875c5,_0x302b09){return function(_0x132f6e){if(_0x132f6e){var _0x5c552d=_0x132f6e['count'],_0x27b92e=_0x302b09[_0x3f23('0x19')],_0x1f36a1=_0x302b09[_0x3f23('0x19')]+_0x302b09[_0x3f23('0x1a')],_0x20b14c;if(_0x1f36a1>=_0x5c552d){_0x1f36a1=_0x5c552d;_0x20b14c=0xc8;}else{_0x20b14c=0xce;}_0xf875c5[_0x3f23('0x1b')](_0x20b14c);return _0xf875c5['set'](_0x3f23('0x1c'),_0x27b92e+'-'+_0x1f36a1+'/'+_0x5c552d)[_0x3f23('0x1d')](_0x132f6e);}return null;};}function patchUpdates(_0x529da1){return function(_0xee55f7){try{jsonpatch[_0x3f23('0x1e')](_0xee55f7,_0x529da1,!![]);}catch(_0x3e5af8){return BPromise['reject'](_0x3e5af8);}return _0xee55f7[_0x3f23('0x1f')]();};}function saveUpdates(_0x22745c,_0x4a143a){return function(_0x54d74d){if(_0x54d74d){return _0x54d74d['update'](_0x22745c)[_0x3f23('0x20')](function(_0x88a5b9){return _0x88a5b9;});}return null;};}function removeEntity(_0x2fdd7b,_0x247ee0){return function(_0x280e1e){if(_0x280e1e){return _0x280e1e[_0x3f23('0x21')]()['then'](function(){_0x2fdd7b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xad73d8,_0x50ddb1){return function(_0x5092ca){if(!_0x5092ca){_0xad73d8[_0x3f23('0x17')](0x194);}return _0x5092ca;};}function handleError(_0xc75455,_0x27e28c){_0x27e28c=_0x27e28c||0x1f4;return function(_0x9a2853){logger['error'](_0x9a2853[_0x3f23('0x22')]);if(_0x9a2853[_0x3f23('0x23')]){delete _0x9a2853[_0x3f23('0x23')];}_0xc75455[_0x3f23('0x1b')](_0x27e28c)[_0x3f23('0x24')](_0x9a2853);};}exports[_0x3f23('0x25')]=function(_0x41e917,_0x44bce8){var _0x5297c6={},_0xed687e={},_0x23188b={'count':0x0,'rows':[]};var _0x251743=_['map'](db[_0x3f23('0x26')][_0x3f23('0x27')],function(_0x10ae54){return{'name':_0x10ae54[_0x3f23('0x28')],'type':_0x10ae54[_0x3f23('0x29')][_0x3f23('0x2a')]};});_0xed687e['model']=_['map'](_0x251743,_0x3f23('0x23'));_0xed687e['query']=_[_0x3f23('0x2b')](_0x41e917['query']);_0xed687e['filters']=_[_0x3f23('0x2c')](_0xed687e[_0x3f23('0x2d')],_0xed687e[_0x3f23('0x2e')]);_0x5297c6[_0x3f23('0x2f')]=_[_0x3f23('0x2c')](_0xed687e[_0x3f23('0x2d')],qs[_0x3f23('0x30')](_0x41e917[_0x3f23('0x2e')][_0x3f23('0x30')]));_0x5297c6[_0x3f23('0x2f')]=_0x5297c6[_0x3f23('0x2f')]['length']?_0x5297c6[_0x3f23('0x2f')]:_0xed687e['model'];if(!_0x41e917['query']['hasOwnProperty'](_0x3f23('0x31'))){_0x5297c6[_0x3f23('0x1a')]=qs['limit'](_0x41e917[_0x3f23('0x2e')]['limit']);_0x5297c6['offset']=qs[_0x3f23('0x19')](_0x41e917['query']['offset']);}_0x5297c6[_0x3f23('0x32')]=qs[_0x3f23('0x33')](_0x41e917[_0x3f23('0x2e')][_0x3f23('0x33')]);_0x5297c6['where']=qs[_0x3f23('0x34')](_[_0x3f23('0x35')](_0x41e917['query'],_0xed687e[_0x3f23('0x34')]),_0x251743);if(_0x41e917[_0x3f23('0x2e')][_0x3f23('0x36')]){_0x5297c6[_0x3f23('0x37')]=_[_0x3f23('0x38')](_0x5297c6[_0x3f23('0x37')],{'$or':_[_0x3f23('0x39')](_0x251743,function(_0x34cd1b){if(_0x34cd1b[_0x3f23('0x29')]!==_0x3f23('0x3a')){var _0x1f5c50={};_0x1f5c50[_0x34cd1b[_0x3f23('0x23')]]={'$like':'%'+_0x41e917[_0x3f23('0x2e')][_0x3f23('0x36')]+'%'};return _0x1f5c50;}})});}_0x5297c6=_[_0x3f23('0x38')]({},_0x5297c6,_0x41e917[_0x3f23('0x3b')]);var _0x16692c={'where':_0x5297c6[_0x3f23('0x37')]};return db[_0x3f23('0x26')][_0x3f23('0x3c')](_0x16692c)[_0x3f23('0x20')](function(_0x2a0b4b){_0x23188b[_0x3f23('0x3c')]=_0x2a0b4b;if(_0x41e917['query']['includeAll']){_0x5297c6['include']=[{'all':!![]}];}return db[_0x3f23('0x26')]['findAll'](_0x5297c6);})[_0x3f23('0x20')](function(_0x1fe414){_0x23188b[_0x3f23('0x3d')]=_0x1fe414;return _0x23188b;})['then'](respondWithFilteredResult(_0x44bce8,_0x5297c6))['catch'](handleError(_0x44bce8,null));};exports['show']=function(_0xf4d9a8,_0x17bc06){var _0x87ecc4={'raw':!![],'where':{'id':_0xf4d9a8[_0x3f23('0x3e')]['id']}},_0xf00f6={};_0xf00f6[_0x3f23('0x2d')]=_[_0x3f23('0x2b')](db[_0x3f23('0x26')][_0x3f23('0x27')]);_0xf00f6['query']=_[_0x3f23('0x2b')](_0xf4d9a8[_0x3f23('0x2e')]);_0xf00f6[_0x3f23('0x34')]=_[_0x3f23('0x2c')](_0xf00f6['model'],_0xf00f6['query']);_0x87ecc4['attributes']=_[_0x3f23('0x2c')](_0xf00f6[_0x3f23('0x2d')],qs[_0x3f23('0x30')](_0xf4d9a8[_0x3f23('0x2e')][_0x3f23('0x30')]));_0x87ecc4[_0x3f23('0x2f')]=_0x87ecc4[_0x3f23('0x2f')][_0x3f23('0x3f')]?_0x87ecc4['attributes']:_0xf00f6[_0x3f23('0x2d')];if(_0xf4d9a8[_0x3f23('0x2e')]['includeAll']){_0x87ecc4[_0x3f23('0x40')]=[{'all':!![]}];}_0x87ecc4=_[_0x3f23('0x38')]({},_0x87ecc4,_0xf4d9a8[_0x3f23('0x3b')]);return db['CmHopperBlack'][_0x3f23('0x41')](_0x87ecc4)[_0x3f23('0x20')](handleEntityNotFound(_0x17bc06,null))[_0x3f23('0x20')](respondWithResult(_0x17bc06,null))['catch'](handleError(_0x17bc06,null));};exports[_0x3f23('0x42')]=function(_0x49f6a3,_0x1d90c4){if(_0x49f6a3[_0x3f23('0x43')]['id']){delete _0x49f6a3[_0x3f23('0x43')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x49f6a3[_0x3f23('0x3e')]['id']}})[_0x3f23('0x20')](handleEntityNotFound(_0x1d90c4,null))[_0x3f23('0x20')](saveUpdates(_0x49f6a3[_0x3f23('0x43')],null))[_0x3f23('0x20')](respondWithResult(_0x1d90c4,null))[_0x3f23('0x44')](handleError(_0x1d90c4,null));};exports[_0x3f23('0x21')]=function(_0x2a43a9,_0x119b6c){return db[_0x3f23('0x26')]['find']({'where':{'id':_0x2a43a9[_0x3f23('0x3e')]['id']}})['then'](handleEntityNotFound(_0x119b6c,null))['then'](removeEntity(_0x119b6c,null))[_0x3f23('0x44')](handleError(_0x119b6c,null));};exports[_0x3f23('0x45')]=function(_0x25a7aa,_0x206c87){return db[_0x3f23('0x26')]['describe']()['then'](respondWithResult(_0x206c87,null))['catch'](handleError(_0x206c87,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2f0545c..e3c7421 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 _0xee4b=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','api','moment'];(function(_0x532575,_0x1c3f7e){var _0x52570b=function(_0x27109a){while(--_0x27109a){_0x532575['push'](_0x532575['shift']());}};_0x52570b(++_0x1c3f7e);}(_0xee4b,0x17c));var _0xbee4=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xee4b[_0x81dcac];return _0xc7803b;};'use strict';var _=require(_0xbee4('0x0'));var util=require(_0xbee4('0x1'));var logger=require('../../config/logger')(_0xbee4('0x2'));var moment=require(_0xbee4('0x3'));var BPromise=require(_0xbee4('0x4'));var rp=require(_0xbee4('0x5'));var fs=require('fs');var path=require(_0xbee4('0x6'));var rimraf=require('rimraf');var config=require(_0xbee4('0x7'));var attributes=require(_0xbee4('0x8'));module[_0xbee4('0x9')]=function(_0x1b1403,_0x555ecf){return _0x1b1403[_0xbee4('0xa')](_0xbee4('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc21=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','moment'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xbc21,0x71));var _0x1bc2=function(_0x385ed7,_0x390cd1){_0x385ed7=_0x385ed7-0x0;var _0x34e826=_0xbc21[_0x385ed7];return _0x34e826;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1bc2('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bc2('0x1'));var rimraf=require(_0x1bc2('0x2'));var config=require(_0x1bc2('0x3'));var attributes=require(_0x1bc2('0x4'));module[_0x1bc2('0x5')]=function(_0x1bdb0b,_0x160252){return _0x1bdb0b['define']('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index cf7d871..3533ca9 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 _0x10da=['attributes','limit','map','include','model','then','stringify','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','GetCmHopperBlack','CmHopperBlack','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10da,0x1c5));var _0xa10d=function(_0x26c38c,_0x2909af){_0x26c38c=_0x26c38c-0x0;var _0x3f1d4c=_0x10da[_0x26c38c];return _0x3f1d4c;};'use strict';var _=require(_0xa10d('0x0'));var util=require(_0xa10d('0x1'));var moment=require(_0xa10d('0x2'));var BPromise=require(_0xa10d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa10d('0x4'));var db=require(_0xa10d('0x5'))['db'];var utils=require(_0xa10d('0x6'));var logger=require(_0xa10d('0x7'))(_0xa10d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa10d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x469a01,_0x5b0608,_0x42b1f3){return new BPromise(function(_0x10592c,_0x243981){return client['request'](_0x469a01,_0x42b1f3)['then'](function(_0x17b9de){logger[_0xa10d('0xa')](_0xa10d('0xb'),_0x5b0608,_0xa10d('0xc'));logger[_0xa10d('0xd')](_0xa10d('0xe'),_0x5b0608,_0xa10d('0xc'),JSON['stringify'](_0x17b9de));if(_0x17b9de['error']){if(_0x17b9de[_0xa10d('0xf')][_0xa10d('0x10')]===0x1f4){logger[_0xa10d('0xf')](_0xa10d('0xb'),_0x5b0608,_0x17b9de[_0xa10d('0xf')][_0xa10d('0x11')]);return _0x243981(_0x17b9de[_0xa10d('0xf')][_0xa10d('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5b0608,_0x17b9de[_0xa10d('0xf')][_0xa10d('0x11')]);return _0x10592c(_0x17b9de['error']['message']);}else{logger[_0xa10d('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x5b0608,'request\x20sent');_0x10592c(_0x17b9de['result'][_0xa10d('0x11')]);}})['catch'](function(_0x1ad348){logger['error'](_0xa10d('0xb'),_0x5b0608,_0x1ad348);_0x243981(_0x1ad348);});});}exports[_0xa10d('0x12')]=function(_0x414f8c){var _0x136418=this;return new Promise(function(_0x9d1eaa,_0x1bd677){return db[_0xa10d('0x13')]['findAll']({'raw':_0x414f8c[_0xa10d('0x14')]?_0x414f8c[_0xa10d('0x14')][_0xa10d('0x15')]===undefined?!![]:![]:!![],'where':_0x414f8c['options']?_0x414f8c[_0xa10d('0x14')][_0xa10d('0x16')]||null:null,'attributes':_0x414f8c[_0xa10d('0x14')]?_0x414f8c['options'][_0xa10d('0x17')]||null:null,'limit':_0x414f8c[_0xa10d('0x14')]?_0x414f8c[_0xa10d('0x14')][_0xa10d('0x18')]||null:null,'include':_0x414f8c[_0xa10d('0x14')]?_0x414f8c[_0xa10d('0x14')]['include']?_[_0xa10d('0x19')](_0x414f8c['options'][_0xa10d('0x1a')],function(_0x2f3695){return{'model':db[_0x2f3695[_0xa10d('0x1b')]],'as':_0x2f3695['as'],'attributes':_0x2f3695[_0xa10d('0x17')],'include':_0x2f3695[_0xa10d('0x1a')]?_['map'](_0x2f3695[_0xa10d('0x1a')],function(_0x844e5d){return{'model':db[_0x844e5d[_0xa10d('0x1b')]],'as':_0x844e5d['as'],'attributes':_0x844e5d[_0xa10d('0x17')],'include':_0x844e5d[_0xa10d('0x1a')]?_[_0xa10d('0x19')](_0x844e5d[_0xa10d('0x1a')],function(_0x1fbad1){return{'model':db[_0x1fbad1[_0xa10d('0x1b')]],'as':_0x1fbad1['as'],'attributes':_0x1fbad1[_0xa10d('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa10d('0x1c')](function(_0x2ba258){logger[_0xa10d('0xa')](_0xa10d('0x12'),_0x414f8c);logger[_0xa10d('0xd')](_0xa10d('0x12'),_0x414f8c,JSON[_0xa10d('0x1d')](_0x2ba258));_0x9d1eaa(_0x2ba258);})[_0xa10d('0x1e')](function(_0xbe1ed9){logger[_0xa10d('0xf')]('GetCmHopperBlack',_0xbe1ed9[_0xa10d('0x11')],_0x414f8c);_0x1bd677(_0x136418[_0xa10d('0xf')](0x1f4,_0xbe1ed9[_0xa10d('0x11')]));});});};exports[_0xa10d('0x1f')]=function(_0x4cf0b6){var _0x272f05=this;return new Promise(function(_0x4c8831,_0x195e63){return db[_0xa10d('0x13')]['update'](_0x4cf0b6[_0xa10d('0x20')],{'raw':_0x4cf0b6['options']?_0x4cf0b6[_0xa10d('0x14')][_0xa10d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf0b6[_0xa10d('0x14')]?_0x4cf0b6[_0xa10d('0x14')][_0xa10d('0x16')]||null:null,'attributes':_0x4cf0b6[_0xa10d('0x14')]?_0x4cf0b6[_0xa10d('0x14')]['attributes']||null:null,'limit':_0x4cf0b6[_0xa10d('0x14')]?_0x4cf0b6[_0xa10d('0x14')]['limit']||null:null})[_0xa10d('0x1c')](function(_0xd1a014){logger[_0xa10d('0xa')](_0xa10d('0x1f'),_0x4cf0b6);logger[_0xa10d('0xd')](_0xa10d('0x1f'),_0x4cf0b6,JSON[_0xa10d('0x1d')](_0xd1a014));_0x4c8831(_0xd1a014);})[_0xa10d('0x1e')](function(_0x2862c5){logger[_0xa10d('0xf')]('UpdateCmHopperBlack',_0x2862c5[_0xa10d('0x11')],_0x4cf0b6);_0x195e63(_0x272f05[_0xa10d('0xf')](0x1f4,_0x2862c5[_0xa10d('0x11')]));});});};exports[_0xa10d('0x21')]=function(_0xa343b0){var _0x42533b=this;return new Promise(function(_0x2fc1e9,_0xd98093){return db[_0xa10d('0x13')]['destroy']({'where':_0xa343b0[_0xa10d('0x14')]?_0xa343b0[_0xa10d('0x14')][_0xa10d('0x16')]||null:null})[_0xa10d('0x1c')](function(_0x2d7ef8){logger[_0xa10d('0xa')]('DestroyCmHopperBlack',_0xa343b0);logger['debug'](_0xa10d('0x21'),_0xa343b0,JSON[_0xa10d('0x1d')](_0x2d7ef8));_0x2fc1e9(_0x2d7ef8);})[_0xa10d('0x1e')](function(_0x51f1e0){logger['error'](_0xa10d('0x21'),_0x51f1e0['message'],_0xa343b0);_0xd98093(_0x42533b[_0xa10d('0xf')](0x1f4,_0x51f1e0[_0xa10d('0x11')]));});});}; \ No newline at end of file +var _0x3f01=['code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','update','where','stringify','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x2dcdad,_0x288367){var _0x2d08dc=function(_0x4b8dc0){while(--_0x4b8dc0){_0x2dcdad['push'](_0x2dcdad['shift']());}};_0x2d08dc(++_0x288367);}(_0x3f01,0x1da));var _0x13f0=function(_0x2f7fd3,_0x778774){_0x2f7fd3=_0x2f7fd3-0x0;var _0x5ebe00=_0x3f01[_0x2f7fd3];return _0x5ebe00;};'use strict';var _=require(_0x13f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13f0('0x1'));var rs=require(_0x13f0('0x2'));var fs=require('fs');var Redis=require(_0x13f0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x13f0('0x4'));var logger=require('../../config/logger')(_0x13f0('0x5'));var config=require('../../config/environment');var jayson=require(_0x13f0('0x6'));var client=jayson[_0x13f0('0x7')][_0x13f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16a9d2,_0x4373c4,_0x4436ea){return new BPromise(function(_0x3e493e,_0x5689b3){return client[_0x13f0('0x9')](_0x16a9d2,_0x4436ea)[_0x13f0('0xa')](function(_0x2515e6){logger[_0x13f0('0xb')](_0x13f0('0xc'),_0x4373c4,_0x13f0('0xd'));logger[_0x13f0('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4373c4,_0x13f0('0xd'),JSON['stringify'](_0x2515e6));if(_0x2515e6[_0x13f0('0xf')]){if(_0x2515e6['error'][_0x13f0('0x10')]===0x1f4){logger[_0x13f0('0xf')](_0x13f0('0xc'),_0x4373c4,_0x2515e6[_0x13f0('0xf')]['message']);return _0x5689b3(_0x2515e6[_0x13f0('0xf')]['message']);}logger[_0x13f0('0xf')](_0x13f0('0xc'),_0x4373c4,_0x2515e6[_0x13f0('0xf')][_0x13f0('0x11')]);return _0x3e493e(_0x2515e6[_0x13f0('0xf')][_0x13f0('0x11')]);}else{logger[_0x13f0('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x4373c4,_0x13f0('0xd'));_0x3e493e(_0x2515e6[_0x13f0('0x12')][_0x13f0('0x11')]);}})[_0x13f0('0x13')](function(_0x225c32){logger['error'](_0x13f0('0xc'),_0x4373c4,_0x225c32);_0x5689b3(_0x225c32);});});}exports[_0x13f0('0x14')]=function(_0x399e25){var _0x536839=this;return new Promise(function(_0x16ff8c,_0x1e0915){return db[_0x13f0('0x15')]['findAll']({'raw':_0x399e25['options']?_0x399e25[_0x13f0('0x16')][_0x13f0('0x17')]===undefined?!![]:![]:!![],'where':_0x399e25[_0x13f0('0x16')]?_0x399e25[_0x13f0('0x16')]['where']||null:null,'attributes':_0x399e25[_0x13f0('0x16')]?_0x399e25['options'][_0x13f0('0x18')]||null:null,'limit':_0x399e25['options']?_0x399e25[_0x13f0('0x16')][_0x13f0('0x19')]||null:null,'include':_0x399e25[_0x13f0('0x16')]?_0x399e25[_0x13f0('0x16')][_0x13f0('0x1a')]?_[_0x13f0('0x1b')](_0x399e25[_0x13f0('0x16')][_0x13f0('0x1a')],function(_0xfb589b){return{'model':db[_0xfb589b[_0x13f0('0x1c')]],'as':_0xfb589b['as'],'attributes':_0xfb589b[_0x13f0('0x18')],'include':_0xfb589b[_0x13f0('0x1a')]?_['map'](_0xfb589b['include'],function(_0x44cb4d){return{'model':db[_0x44cb4d['model']],'as':_0x44cb4d['as'],'attributes':_0x44cb4d[_0x13f0('0x18')],'include':_0x44cb4d['include']?_[_0x13f0('0x1b')](_0x44cb4d['include'],function(_0x5d682c){return{'model':db[_0x5d682c[_0x13f0('0x1c')]],'as':_0x5d682c['as'],'attributes':_0x5d682c[_0x13f0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x13f0('0xa')](function(_0x50d0df){logger[_0x13f0('0xb')](_0x13f0('0x14'),_0x399e25);logger[_0x13f0('0xe')]('GetCmHopperBlack',_0x399e25,JSON['stringify'](_0x50d0df));_0x16ff8c(_0x50d0df);})[_0x13f0('0x13')](function(_0x291ba1){logger[_0x13f0('0xf')](_0x13f0('0x14'),_0x291ba1[_0x13f0('0x11')],_0x399e25);_0x1e0915(_0x536839[_0x13f0('0xf')](0x1f4,_0x291ba1[_0x13f0('0x11')]));});});};exports[_0x13f0('0x1d')]=function(_0x12c133){var _0x34069a=this;return new Promise(function(_0x2d617f,_0x587ddb){return db[_0x13f0('0x15')][_0x13f0('0x1e')](_0x12c133['body'],{'raw':_0x12c133[_0x13f0('0x16')]?_0x12c133[_0x13f0('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c133[_0x13f0('0x16')]?_0x12c133[_0x13f0('0x16')][_0x13f0('0x1f')]||null:null,'attributes':_0x12c133['options']?_0x12c133[_0x13f0('0x16')][_0x13f0('0x18')]||null:null,'limit':_0x12c133[_0x13f0('0x16')]?_0x12c133['options'][_0x13f0('0x19')]||null:null})['then'](function(_0x323020){logger[_0x13f0('0xb')](_0x13f0('0x1d'),_0x12c133);logger[_0x13f0('0xe')](_0x13f0('0x1d'),_0x12c133,JSON[_0x13f0('0x20')](_0x323020));_0x2d617f(_0x323020);})['catch'](function(_0x11a623){logger['error'](_0x13f0('0x1d'),_0x11a623[_0x13f0('0x11')],_0x12c133);_0x587ddb(_0x34069a[_0x13f0('0xf')](0x1f4,_0x11a623[_0x13f0('0x11')]));});});};exports[_0x13f0('0x21')]=function(_0x3574b9){var _0x2d8688=this;return new Promise(function(_0x323bcd,_0x1433ff){return db[_0x13f0('0x15')][_0x13f0('0x22')]({'where':_0x3574b9[_0x13f0('0x16')]?_0x3574b9[_0x13f0('0x16')][_0x13f0('0x1f')]||null:null})[_0x13f0('0xa')](function(_0x5a6023){logger['info'](_0x13f0('0x21'),_0x3574b9);logger[_0x13f0('0xe')](_0x13f0('0x21'),_0x3574b9,JSON[_0x13f0('0x20')](_0x5a6023));_0x323bcd(_0x5a6023);})[_0x13f0('0x13')](function(_0x44628b){logger[_0x13f0('0xf')](_0x13f0('0x21'),_0x44628b[_0x13f0('0x11')],_0x3574b9);_0x1433ff(_0x2d8688['error'](0x1f4,_0x44628b[_0x13f0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0f0397b..51629cf 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 _0x5636=['update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x531c9f,_0x2d9eff){var _0x472430=function(_0x3eba2c){while(--_0x3eba2c){_0x531c9f['push'](_0x531c9f['shift']());}};_0x472430(++_0x2d9eff);}(_0x5636,0x102));var _0x6563=function(_0xbb55a6,_0x38391d){_0xbb55a6=_0xbb55a6-0x0;var _0x17bf88=_0x5636[_0xbb55a6];return _0x17bf88;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var auth=require(_0x6563('0x3'));var interaction=require(_0x6563('0x4'));var config=require('../../config/environment');var controller=require(_0x6563('0x5'));router[_0x6563('0x6')]('/',auth[_0x6563('0x7')](),controller[_0x6563('0x8')]);router[_0x6563('0x6')](_0x6563('0x9'),auth[_0x6563('0x7')](),controller[_0x6563('0xa')]);router[_0x6563('0x6')](_0x6563('0xb'),auth[_0x6563('0x7')](),controller[_0x6563('0xc')]);router[_0x6563('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6563('0x10')]=router; \ No newline at end of file +var _0x207c=['./cmHopperBlack.controller','get','/describe','isAuthenticated','/:id','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x207c,0x1e8));var _0xc207=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x207c[_0x2892da];return _0x28cff2;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['describe']);router[_0xc207('0x8')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0xc')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')](_0xc207('0xb'),auth['isAuthenticated'](),controller['destroy']);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 60a7b0b..3b6a758 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 _0x3584=['moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0xf7aa86,_0x171456){var _0x5eb1ed=function(_0x47175f){while(--_0x47175f){_0xf7aa86['push'](_0xf7aa86['shift']());}};_0x5eb1ed(++_0x171456);}(_0x3584,0x8e));var _0x4358=function(_0x35c355,_0x123358){_0x35c355=_0x35c355-0x0;var _0x583534=_0x3584[_0x35c355];return _0x583534;};'use strict';var Sequelize=require(_0x4358('0x0'));var moment=require(_0x4358('0x1'));module[_0x4358('0x2')]={'state':{'type':Sequelize[_0x4358('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x4358('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4358('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4358('0x4')]},'calleridname':{'type':Sequelize[_0x4358('0x4')]},'starttime':{'type':Sequelize[_0x4358('0x5')]},'responsetime':{'type':Sequelize[_0x4358('0x5')]},'answertime':{'type':Sequelize[_0x4358('0x5')]},'droptime':{'type':Sequelize[_0x4358('0x5')]},'endtime':{'type':Sequelize[_0x4358('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4358('0x4')]},'campaign':{'type':Sequelize[_0x4358('0x4')]},'campaigntype':{'type':Sequelize[_0x4358('0x4')]},'membername':{'type':Sequelize[_0x4358('0x4')]},'reason':{'type':Sequelize[_0x4358('0x4')]},'disposition':{'type':Sequelize[_0x4358('0x4')]},'secondDisposition':{'type':Sequelize[_0x4358('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4358('0x4')]},'dispositionat':{'type':Sequelize[_0x4358('0x5')],'set':function(_0x57c37c){var _0x305bf3=this['getDataValue'](_0x4358('0x6'));if(_0x305bf3&&_0x57c37c){this[_0x4358('0x7')]('followuptime',moment(_0x57c37c)['diff'](moment(_0x305bf3),_0x4358('0x8')));}return this[_0x4358('0x7')](_0x4358('0x9'),_0x57c37c);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4358('0x5')]},'callback':{'type':Sequelize[_0x4358('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4358('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4358('0x5')]},'deleted':{'type':Sequelize[_0x4358('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x4358('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x4358('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4358('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8aa2=['moment','exports','INTEGER','STRING','DATE','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x2197bb,_0x2d7033){var _0x255158=function(_0x45dcbb){while(--_0x45dcbb){_0x2197bb['push'](_0x2197bb['shift']());}};_0x255158(++_0x2d7033);}(_0x8aa2,0x8f));var _0x28aa=function(_0x532b24,_0x13752d){_0x532b24=_0x532b24-0x0;var _0x4a57e4=_0x8aa2[_0x532b24];return _0x4a57e4;};'use strict';var Sequelize=require(_0x28aa('0x0'));var moment=require(_0x28aa('0x1'));module[_0x28aa('0x2')]={'state':{'type':Sequelize[_0x28aa('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x28aa('0x4')]},'scheduledat':{'type':Sequelize[_0x28aa('0x5')]},'countbusyretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x28aa('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x28aa('0x4')]},'originatecalleridname':{'type':Sequelize[_0x28aa('0x4')]},'calleridnum':{'type':Sequelize[_0x28aa('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x28aa('0x5')]},'responsetime':{'type':Sequelize[_0x28aa('0x5')]},'answertime':{'type':Sequelize[_0x28aa('0x5')]},'droptime':{'type':Sequelize[_0x28aa('0x5')]},'endtime':{'type':Sequelize[_0x28aa('0x5')]},'ringtime':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x28aa('0x4')]},'campaign':{'type':Sequelize[_0x28aa('0x4')]},'campaigntype':{'type':Sequelize[_0x28aa('0x4')]},'membername':{'type':Sequelize[_0x28aa('0x4')]},'reason':{'type':Sequelize[_0x28aa('0x4')]},'disposition':{'type':Sequelize[_0x28aa('0x4')]},'secondDisposition':{'type':Sequelize[_0x28aa('0x4')]},'thirdDisposition':{'type':Sequelize[_0x28aa('0x4')]},'dispositionat':{'type':Sequelize[_0x28aa('0x5')],'set':function(_0x384c78){var _0x47f8ef=this['getDataValue']('endtime');if(_0x47f8ef&&_0x384c78){this[_0x28aa('0x6')](_0x28aa('0x7'),moment(_0x384c78)[_0x28aa('0x8')](moment(_0x47f8ef),_0x28aa('0x9')));}return this['setDataValue'](_0x28aa('0xa'),_0x384c78);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x28aa('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x28aa('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x28aa('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x28aa('0x5')]},'callback':{'type':Sequelize[_0x28aa('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x28aa('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x28aa('0x5')]},'recallme':{'type':Sequelize[_0x28aa('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x28aa('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x28aa('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index df9c11c..d721289 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 _0xe205=['`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','CampaignId','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','filters','length','find','describe','body','uniqueid','params','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x172b77,_0x2b7bcc){var _0x14a220=function(_0x44d8a8){while(--_0x44d8a8){_0x172b77['push'](_0x172b77['shift']());}};_0x14a220(++_0x2b7bcc);}(_0xe205,0xa7));var _0x5e20=function(_0x2f6695,_0x11b7b8){_0x2f6695=_0x2f6695-0x0;var _0x35e1ee=_0xe205[_0x2f6695];return _0x35e1ee;};'use strict';var pdf=require(_0x5e20('0x0'));var emlformat=require(_0x5e20('0x1'));var rimraf=require(_0x5e20('0x2'));var zipdir=require(_0x5e20('0x3'));var jsonpatch=require(_0x5e20('0x4'));var rp=require(_0x5e20('0x5'));var moment=require(_0x5e20('0x6'));var BPromise=require(_0x5e20('0x7'));var Mustache=require(_0x5e20('0x8'));var util=require('util');var path=require(_0x5e20('0x9'));var sox=require(_0x5e20('0xa'));var csv=require(_0x5e20('0xb'));var ejs=require(_0x5e20('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xb'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var licenseUtil=require(_0x5e20('0x17'));var db=require(_0x5e20('0x18'))['db'];function respondWithStatusCode(_0x54deee,_0x19eacf){_0x19eacf=_0x19eacf||0xcc;return function(_0x29b7a2){if(_0x29b7a2){return _0x54deee[_0x5e20('0x19')](_0x19eacf);}return _0x54deee['status'](_0x19eacf)[_0x5e20('0x1a')]();};}function respondWithResult(_0x5d827e,_0x1f47f3){_0x1f47f3=_0x1f47f3||0xc8;return function(_0x5ba833){if(_0x5ba833){return _0x5d827e[_0x5e20('0x1b')](_0x1f47f3)[_0x5e20('0x1c')](_0x5ba833);}};}function respondWithFilteredResult(_0x275026,_0x148ada){return function(_0x294df8){if(_0x294df8){var _0x542b3c=_0x294df8[_0x5e20('0x1d')],_0xeaeb77=_0x148ada[_0x5e20('0x1e')],_0x9a59ce=_0x148ada[_0x5e20('0x1e')]+_0x148ada[_0x5e20('0x1f')],_0x166ffd;if(_0x9a59ce>=_0x542b3c){_0x9a59ce=_0x542b3c;_0x166ffd=0xc8;}else{_0x166ffd=0xce;}_0x275026[_0x5e20('0x1b')](_0x166ffd);return _0x275026['set'](_0x5e20('0x20'),_0xeaeb77+'-'+_0x9a59ce+'/'+_0x542b3c)[_0x5e20('0x1c')](_0x294df8);}return null;};}function patchUpdates(_0x4f900b){return function(_0x295eb3){try{jsonpatch[_0x5e20('0x21')](_0x295eb3,_0x4f900b,!![]);}catch(_0x1d436d){return BPromise[_0x5e20('0x22')](_0x1d436d);}return _0x295eb3['save']();};}function saveUpdates(_0x2954fc,_0x50f222){return function(_0x4a3587){if(_0x4a3587){return _0x4a3587['update'](_0x2954fc)['then'](function(_0xe562ba){return _0xe562ba;});}return null;};}function removeEntity(_0x5cca90,_0x3d89e4){return function(_0x29b111){if(_0x29b111){return _0x29b111[_0x5e20('0x23')]()[_0x5e20('0x24')](function(){_0x5cca90[_0x5e20('0x1b')](0xcc)[_0x5e20('0x1a')]();});}};}function handleEntityNotFound(_0x4c5732,_0x15705f){return function(_0x5a755f){if(!_0x5a755f){_0x4c5732['sendStatus'](0x194);}return _0x5a755f;};}function handleError(_0x33993a,_0x58d678){_0x58d678=_0x58d678||0x1f4;return function(_0x2bae08){logger[_0x5e20('0x25')](_0x2bae08[_0x5e20('0x26')]);if(_0x2bae08[_0x5e20('0x27')]){delete _0x2bae08[_0x5e20('0x27')];}_0x33993a['status'](_0x58d678)[_0x5e20('0x28')](_0x2bae08);};}exports[_0x5e20('0x29')]=function(_0x238758,_0x3032ef){var _0x4c799d={},_0x3a0f06={},_0x2c5d80={'count':0x0,'rows':[]};var _0x37f09a=_[_0x5e20('0x2a')](db[_0x5e20('0x2b')][_0x5e20('0x2c')],function(_0x5ec45b){return{'name':_0x5ec45b[_0x5e20('0x2d')],'type':_0x5ec45b[_0x5e20('0x2e')]['key']};});_0x3a0f06[_0x5e20('0x2f')]=_[_0x5e20('0x2a')](_0x37f09a,_0x5e20('0x27'));_0x3a0f06[_0x5e20('0x30')]=_[_0x5e20('0x31')](_0x238758[_0x5e20('0x30')]);_0x3a0f06['filters']=_[_0x5e20('0x32')](_0x3a0f06[_0x5e20('0x2f')],_0x3a0f06[_0x5e20('0x30')]);_0x4c799d[_0x5e20('0x33')]=_[_0x5e20('0x32')](_0x3a0f06[_0x5e20('0x2f')],qs[_0x5e20('0x34')](_0x238758[_0x5e20('0x30')][_0x5e20('0x34')]));_0x4c799d[_0x5e20('0x33')]=_0x4c799d[_0x5e20('0x33')]['length']?_0x4c799d[_0x5e20('0x33')]:_0x3a0f06[_0x5e20('0x2f')];if(!_0x238758[_0x5e20('0x30')]['hasOwnProperty'](_0x5e20('0x35'))){_0x4c799d[_0x5e20('0x1f')]=qs[_0x5e20('0x1f')](_0x238758[_0x5e20('0x30')][_0x5e20('0x1f')]);_0x4c799d[_0x5e20('0x1e')]=qs[_0x5e20('0x1e')](_0x238758[_0x5e20('0x30')][_0x5e20('0x1e')]);}_0x4c799d[_0x5e20('0x36')]=qs[_0x5e20('0x37')](_0x238758[_0x5e20('0x30')][_0x5e20('0x37')]);_0x4c799d[_0x5e20('0x38')]=qs['filters'](_[_0x5e20('0x39')](_0x238758['query'],_0x3a0f06['filters']),_0x37f09a);if(_0x238758[_0x5e20('0x30')][_0x5e20('0x3a')]){_0x4c799d['where']=_[_0x5e20('0x3b')](_0x4c799d[_0x5e20('0x38')],{'$or':_['map'](_0x37f09a,function(_0x3f3908){if(_0x3f3908[_0x5e20('0x2e')]!==_0x5e20('0x3c')){var _0x139255={};_0x139255[_0x3f3908[_0x5e20('0x27')]]={'$like':'%'+_0x238758[_0x5e20('0x30')][_0x5e20('0x3a')]+'%'};return _0x139255;}})});}_0x4c799d=_[_0x5e20('0x3b')]({},_0x4c799d,_0x238758[_0x5e20('0x3d')]);var _0x20be56={'where':_0x4c799d[_0x5e20('0x38')]};return db[_0x5e20('0x2b')][_0x5e20('0x1d')](_0x20be56)[_0x5e20('0x24')](function(_0x5ad136){_0x2c5d80[_0x5e20('0x1d')]=_0x5ad136;if(_0x238758[_0x5e20('0x30')][_0x5e20('0x3e')]){_0x4c799d['include']=[{'all':!![]}];}return db[_0x5e20('0x2b')][_0x5e20('0x3f')](_0x4c799d);})[_0x5e20('0x24')](function(_0xb3394d){_0x2c5d80[_0x5e20('0x40')]=_0xb3394d;return _0x2c5d80;})['then'](respondWithFilteredResult(_0x3032ef,_0x4c799d))[_0x5e20('0x41')](handleError(_0x3032ef,null));};exports[_0x5e20('0x42')]=function(_0x12b6ea,_0x24c05f){var _0x4d973a={'raw':!![],'where':{'id':_0x12b6ea['params']['id']}},_0x30d3ef={};_0x30d3ef[_0x5e20('0x2f')]=_[_0x5e20('0x31')](db[_0x5e20('0x2b')]['rawAttributes']);_0x30d3ef[_0x5e20('0x30')]=_[_0x5e20('0x31')](_0x12b6ea[_0x5e20('0x30')]);_0x30d3ef[_0x5e20('0x43')]=_[_0x5e20('0x32')](_0x30d3ef[_0x5e20('0x2f')],_0x30d3ef[_0x5e20('0x30')]);_0x4d973a[_0x5e20('0x33')]=_['intersection'](_0x30d3ef[_0x5e20('0x2f')],qs[_0x5e20('0x34')](_0x12b6ea[_0x5e20('0x30')]['fields']));_0x4d973a[_0x5e20('0x33')]=_0x4d973a['attributes'][_0x5e20('0x44')]?_0x4d973a[_0x5e20('0x33')]:_0x30d3ef[_0x5e20('0x2f')];if(_0x12b6ea[_0x5e20('0x30')][_0x5e20('0x3e')]){_0x4d973a['include']=[{'all':!![]}];}_0x4d973a=_[_0x5e20('0x3b')]({},_0x4d973a,_0x12b6ea['options']);return db['CmHopperFinal'][_0x5e20('0x45')](_0x4d973a)[_0x5e20('0x24')](handleEntityNotFound(_0x24c05f,null))[_0x5e20('0x24')](respondWithResult(_0x24c05f,null))[_0x5e20('0x41')](handleError(_0x24c05f,null));};exports[_0x5e20('0x46')]=function(_0x3836f7,_0x57c794){return db['CmHopperFinal']['describe']()[_0x5e20('0x24')](respondWithResult(_0x57c794,null))[_0x5e20('0x41')](handleError(_0x57c794,null));};exports['update']=function(_0x22b84e,_0x27d41c){if(_0x22b84e[_0x5e20('0x47')][_0x5e20('0x48')]){delete _0x22b84e[_0x5e20('0x47')]['uniqueid'];}return db[_0x5e20('0x2b')][_0x5e20('0x45')]({'where':{'uniqueid':_0x22b84e[_0x5e20('0x49')]['id']}})[_0x5e20('0x24')](handleEntityNotFound(_0x27d41c,null))[_0x5e20('0x24')](saveUpdates(_0x22b84e[_0x5e20('0x47')],null))[_0x5e20('0x24')](respondWithResult(_0x27d41c,null))[_0x5e20('0x41')](handleError(_0x27d41c,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5bbc8e,_0x4ea7d9,_0x9723ed){return db[_0x5e20('0x2b')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5bbc8e[_0x5e20('0x49')]['id']},'attributes':[[db['sequelize']['fn'](_0x5e20('0x4a'),db['sequelize']['fn']('IF',db[_0x5e20('0x4b')]['literal'](_0x5e20('0x4c')))),_0x5e20('0x4d')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db[_0x5e20('0x4b')]['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x4f')))),_0x5e20('0x50')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db[_0x5e20('0x4b')]['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x51')))),_0x5e20('0x52')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e20('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x5e20('0x53')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db['sequelize']['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5e20('0x4b')]['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x55')))),_0x5e20('0x56')],[db[_0x5e20('0x4b')]['fn']('COUNT',db[_0x5e20('0x4b')]['fn']('IF',db['sequelize'][_0x5e20('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x5e20('0x57')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db['sequelize']['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x58')))),_0x5e20('0x59')]]})[_0x5e20('0x24')](handleEntityNotFound(_0x4ea7d9,null))[_0x5e20('0x24')](respondWithResult(_0x4ea7d9,null))[_0x5e20('0x41')](handleError(_0x4ea7d9,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3b059f,_0x3e7239,_0x1a03e4){return db[_0x5e20('0x2b')]['findAll']({'raw':![],'where':{'CampaignId':_0x3b059f[_0x5e20('0x49')]['id']},'attributes':[[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db[_0x5e20('0x4b')]['fn']('IF',db['sequelize'][_0x5e20('0x4e')](_0x5e20('0x4c')))),_0x5e20('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x5e20('0x50')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db['sequelize']['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')]('`state`\x20=\x205,\x201,\x20null'))),_0x5e20('0x52')],[db[_0x5e20('0x4b')]['fn']('COUNT',db[_0x5e20('0x4b')]['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x5a')))),'congestionContacts'],[db[_0x5e20('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')](_0x5e20('0x54')))),_0x5e20('0x5b')],[db[_0x5e20('0x4b')]['fn'](_0x5e20('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e20('0x4e')](_0x5e20('0x55')))),_0x5e20('0x56')],[db['sequelize']['fn'](_0x5e20('0x4a'),db[_0x5e20('0x4b')]['fn']('IF',db['sequelize'][_0x5e20('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x5e20('0x4b')]['fn']('COUNT',db[_0x5e20('0x4b')]['fn']('IF',db[_0x5e20('0x4b')][_0x5e20('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x5e20('0x59')]]})[_0x5e20('0x24')](handleEntityNotFound(_0x3e7239,null))[_0x5e20('0x24')](respondWithResult(_0x3e7239,null))[_0x5e20('0x41')](handleError(_0x3e7239,null));};exports[_0x5e20('0x5c')]=function(_0x4e60f0,_0x9d676,_0x805882){return db['VoiceQueue'][_0x5e20('0x45')]({'where':{'id':_0x4e60f0[_0x5e20('0x49')]['id']}})[_0x5e20('0x24')](handleEntityNotFound(_0x9d676,null))['then'](function(_0x4aa7c4){var _0x2531f8;if(_0x4aa7c4){_0x2531f8=squel[_0x5e20('0x5d')]()[_0x5e20('0x5e')](_0x5e20('0x5f'))['fromQuery']([_0x5e20('0x60'),_0x5e20('0x61'),_0x5e20('0x62'),_0x5e20('0x63'),_0x5e20('0x64'),'createdAt',_0x5e20('0x65')],squel[_0x5e20('0x66')]()[_0x5e20('0x67')](_0x5e20('0x68'),_0x5e20('0x60'))[_0x5e20('0x67')](_0x5e20('0x69'),_0x5e20('0x61'))['field'](_0x5e20('0x6a'),'ContactId')['field'](_0x5e20('0x6b'),_0x5e20('0x63'))['field'](_0x5e20('0x6c'),_0x5e20('0x64'))['field'](_0x5e20('0x69'),'createdAt')[_0x5e20('0x67')]('NOW()',_0x5e20('0x65'))[_0x5e20('0x6d')](_0x5e20('0x6e'))[_0x5e20('0x38')](_0x5e20('0x6f'),_0x4e60f0['params']['id'][_0x5e20('0x70')]())['where'](_0x5e20('0x71'),_0x4e60f0['body'][_0x5e20('0x72')][_0x5e20('0x70')]())[_0x5e20('0x38')](_0x5e20('0x73'))['where'](_0x5e20('0x74'),squel[_0x5e20('0x66')]()['field']('phone')[_0x5e20('0x6d')](_0x5e20('0x5f'))[_0x5e20('0x38')](_0x5e20('0x6f'),_0x4e60f0[_0x5e20('0x49')]['id']['toString']()))[_0x5e20('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5e20('0x67')]('calleridnum')['from'](_0x5e20('0x6e'))[_0x5e20('0x38')]('VoiceQueueId\x20=\x20?',_0x4e60f0[_0x5e20('0x49')]['id'][_0x5e20('0x70')]())[_0x5e20('0x38')](_0x5e20('0x75')))[_0x5e20('0x76')]('ContactId'))[_0x5e20('0x70')]();return db[_0x5e20('0x4b')][_0x5e20('0x30')](_0x2531f8);}return[];})[_0x5e20('0x24')](respondWithResult(_0x9d676,null))['catch'](handleError(_0x9d676,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5a0024,_0x326564,_0x1cbbe0){return db[_0x5e20('0x77')][_0x5e20('0x45')]({'where':{'id':_0x5a0024[_0x5e20('0x49')]['id']}})[_0x5e20('0x24')](handleEntityNotFound(_0x326564,null))[_0x5e20('0x24')](function(_0x44fc38){var _0x193a28;if(_0x44fc38){_0x193a28=squel[_0x5e20('0x5d')]()[_0x5e20('0x5e')](_0x5e20('0x5f'))['fromQuery']([_0x5e20('0x60'),_0x5e20('0x61'),_0x5e20('0x62'),'ListId',_0x5e20('0x78'),'createdAt',_0x5e20('0x65')],squel[_0x5e20('0x66')]()['field'](_0x5e20('0x68'),_0x5e20('0x60'))[_0x5e20('0x67')]('NOW()','scheduledAt')[_0x5e20('0x67')](_0x5e20('0x6a'),_0x5e20('0x62'))['field'](_0x5e20('0x6b'),_0x5e20('0x63'))[_0x5e20('0x67')]('ANY_VALUE(CampaignId)',_0x5e20('0x78'))['field'](_0x5e20('0x69'),'createdAt')[_0x5e20('0x67')](_0x5e20('0x69'),_0x5e20('0x65'))[_0x5e20('0x6d')]('cm_hopper_final')[_0x5e20('0x38')](_0x5e20('0x79'),_0x5a0024[_0x5e20('0x49')]['id']['toString']())[_0x5e20('0x38')](_0x5e20('0x71'),_0x5a0024[_0x5e20('0x47')][_0x5e20('0x72')][_0x5e20('0x70')]())[_0x5e20('0x38')](_0x5e20('0x73'))['where'](_0x5e20('0x74'),squel[_0x5e20('0x66')]()['field'](_0x5e20('0x60'))[_0x5e20('0x6d')](_0x5e20('0x5f'))['where'](_0x5e20('0x79'),_0x5a0024[_0x5e20('0x49')]['id'][_0x5e20('0x70')]()))[_0x5e20('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5e20('0x67')](_0x5e20('0x7a'))['from'](_0x5e20('0x6e'))['where']('CampaignId\x20=\x20?',_0x5a0024['params']['id']['toString']())[_0x5e20('0x38')](_0x5e20('0x75')))[_0x5e20('0x76')](_0x5e20('0x62')))[_0x5e20('0x70')]();return db[_0x5e20('0x4b')][_0x5e20('0x30')](_0x193a28);}return[];})[_0x5e20('0x24')](respondWithResult(_0x326564,null))['catch'](handleError(_0x326564,null));};exports[_0x5e20('0x7b')]=function(_0x14ed24,_0x1166a3,_0x377238){return db[_0x5e20('0x7c')][_0x5e20('0x7d')]({'where':{'VoiceQueueId':_0x14ed24[_0x5e20('0x47')][_0x5e20('0x64')],'CampaignId':_0x14ed24['body']['CampaignId'],'ContactId':_0x14ed24[_0x5e20('0x47')][_0x5e20('0x62')]}})[_0x5e20('0x24')](handleEntityNotFound(_0x1166a3,null))['then'](function(_0x6be364){if(_0x6be364){return _0x6be364;}return null;})[_0x5e20('0x24')](respondWithResult(_0x1166a3,null))['catch'](handleError(_0x1166a3,null));}; \ No newline at end of file +var _0xfe57=['NOW()','scheduledAt','ANY_VALUE(ContactId)','field','updatedAt','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','filter','where','VIRTUAL','merge','options','CmHopperFinal','count','catch','show','keys','includeAll','include','find','describe','body','uniqueid','params','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','phone','ContactId','ListId','VoiceQueueId','createdAt','select','ANY_VALUE(calleridnum)'];(function(_0x21e9bd,_0x132902){var _0x40a8c2=function(_0x531a2f){while(--_0x531a2f){_0x21e9bd['push'](_0x21e9bd['shift']());}};_0x40a8c2(++_0x132902);}(_0xfe57,0x195));var _0x7fe5=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xfe57[_0x142020];return _0x40da8f;};'use strict';var pdf=require(_0x7fe5('0x0'));var emlformat=require(_0x7fe5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe5('0x2'));var rp=require(_0x7fe5('0x3'));var moment=require(_0x7fe5('0x4'));var BPromise=require(_0x7fe5('0x5'));var Mustache=require(_0x7fe5('0x6'));var util=require(_0x7fe5('0x7'));var path=require(_0x7fe5('0x8'));var sox=require(_0x7fe5('0x9'));var csv=require(_0x7fe5('0xa'));var ejs=require(_0x7fe5('0xb'));var fs=require('fs');var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=_0x221ab2['count'],_0x4989a=_0x39f175[_0x7fe5('0x1b')],_0x3f699b=_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1c')],_0x104bc8;if(_0x3f699b>=_0xbdf0a4){_0x3f699b=_0xbdf0a4;_0x104bc8=0xc8;}else{_0x104bc8=0xce;}_0x56e76f[_0x7fe5('0x1d')](_0x104bc8);return _0x56e76f[_0x7fe5('0x1e')](_0x7fe5('0x1f'),_0x4989a+'-'+_0x3f699b+'/'+_0xbdf0a4)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x29b0bd){return function(_0x478523){try{jsonpatch[_0x7fe5('0x20')](_0x478523,_0x29b0bd,!![]);}catch(_0x53e996){return BPromise['reject'](_0x53e996);}return _0x478523[_0x7fe5('0x21')]();};}function saveUpdates(_0x459c2d,_0x2f6592){return function(_0x327301){if(_0x327301){return _0x327301[_0x7fe5('0x22')](_0x459c2d)[_0x7fe5('0x23')](function(_0x24efbb){return _0x24efbb;});}return null;};}function removeEntity(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x24')]()[_0x7fe5('0x23')](function(){_0xdd9df7['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x2f39e0,_0x43e547){return function(_0x508826){if(!_0x508826){_0x2f39e0[_0x7fe5('0x18')](0x194);}return _0x508826;};}function handleError(_0x48ee56,_0xf358ed){_0xf358ed=_0xf358ed||0x1f4;return function(_0x53f522){logger[_0x7fe5('0x25')](_0x53f522[_0x7fe5('0x26')]);if(_0x53f522[_0x7fe5('0x27')]){delete _0x53f522[_0x7fe5('0x27')];}_0x48ee56[_0x7fe5('0x1d')](_0xf358ed)[_0x7fe5('0x28')](_0x53f522);};}exports['index']=function(_0x5f2d25,_0x417a56){var _0x450759={},_0x27b66d={},_0x13c96b={'count':0x0,'rows':[]};var _0x51407b=_[_0x7fe5('0x29')](db['CmHopperFinal'][_0x7fe5('0x2a')],function(_0x1420de){return{'name':_0x1420de[_0x7fe5('0x2b')],'type':_0x1420de[_0x7fe5('0x2c')][_0x7fe5('0x2d')]};});_0x27b66d[_0x7fe5('0x2e')]=_['map'](_0x51407b,_0x7fe5('0x27'));_0x27b66d[_0x7fe5('0x2f')]=_['keys'](_0x5f2d25[_0x7fe5('0x2f')]);_0x27b66d[_0x7fe5('0x30')]=_[_0x7fe5('0x31')](_0x27b66d[_0x7fe5('0x2e')],_0x27b66d[_0x7fe5('0x2f')]);_0x450759['attributes']=_['intersection'](_0x27b66d[_0x7fe5('0x2e')],qs[_0x7fe5('0x32')](_0x5f2d25[_0x7fe5('0x2f')][_0x7fe5('0x32')]));_0x450759['attributes']=_0x450759[_0x7fe5('0x33')][_0x7fe5('0x34')]?_0x450759[_0x7fe5('0x33')]:_0x27b66d[_0x7fe5('0x2e')];if(!_0x5f2d25[_0x7fe5('0x2f')][_0x7fe5('0x35')]('nolimit')){_0x450759[_0x7fe5('0x1c')]=qs[_0x7fe5('0x1c')](_0x5f2d25[_0x7fe5('0x2f')][_0x7fe5('0x1c')]);_0x450759['offset']=qs['offset'](_0x5f2d25[_0x7fe5('0x2f')]['offset']);}_0x450759[_0x7fe5('0x36')]=qs['sort'](_0x5f2d25[_0x7fe5('0x2f')]['sort']);_0x450759['where']=qs['filters'](_['pick'](_0x5f2d25[_0x7fe5('0x2f')],_0x27b66d[_0x7fe5('0x30')]),_0x51407b);if(_0x5f2d25['query'][_0x7fe5('0x37')]){_0x450759[_0x7fe5('0x38')]=_['merge'](_0x450759[_0x7fe5('0x38')],{'$or':_['map'](_0x51407b,function(_0x4aeed2){if(_0x4aeed2[_0x7fe5('0x2c')]!==_0x7fe5('0x39')){var _0x1e27ef={};_0x1e27ef[_0x4aeed2[_0x7fe5('0x27')]]={'$like':'%'+_0x5f2d25[_0x7fe5('0x2f')]['filter']+'%'};return _0x1e27ef;}})});}_0x450759=_[_0x7fe5('0x3a')]({},_0x450759,_0x5f2d25[_0x7fe5('0x3b')]);var _0x5839b2={'where':_0x450759[_0x7fe5('0x38')]};return db[_0x7fe5('0x3c')][_0x7fe5('0x3d')](_0x5839b2)[_0x7fe5('0x23')](function(_0x21c6d0){_0x13c96b[_0x7fe5('0x3d')]=_0x21c6d0;if(_0x5f2d25[_0x7fe5('0x2f')]['includeAll']){_0x450759['include']=[{'all':!![]}];}return db[_0x7fe5('0x3c')]['findAll'](_0x450759);})[_0x7fe5('0x23')](function(_0x26be07){_0x13c96b['rows']=_0x26be07;return _0x13c96b;})[_0x7fe5('0x23')](respondWithFilteredResult(_0x417a56,_0x450759))[_0x7fe5('0x3e')](handleError(_0x417a56,null));};exports[_0x7fe5('0x3f')]=function(_0x1c3e08,_0x2fd004){var _0x2a31c0={'raw':!![],'where':{'id':_0x1c3e08['params']['id']}},_0x1cd6d3={};_0x1cd6d3['model']=_[_0x7fe5('0x40')](db['CmHopperFinal'][_0x7fe5('0x2a')]);_0x1cd6d3[_0x7fe5('0x2f')]=_[_0x7fe5('0x40')](_0x1c3e08[_0x7fe5('0x2f')]);_0x1cd6d3['filters']=_[_0x7fe5('0x31')](_0x1cd6d3['model'],_0x1cd6d3['query']);_0x2a31c0[_0x7fe5('0x33')]=_[_0x7fe5('0x31')](_0x1cd6d3['model'],qs[_0x7fe5('0x32')](_0x1c3e08[_0x7fe5('0x2f')][_0x7fe5('0x32')]));_0x2a31c0[_0x7fe5('0x33')]=_0x2a31c0[_0x7fe5('0x33')]['length']?_0x2a31c0[_0x7fe5('0x33')]:_0x1cd6d3[_0x7fe5('0x2e')];if(_0x1c3e08['query'][_0x7fe5('0x41')]){_0x2a31c0[_0x7fe5('0x42')]=[{'all':!![]}];}_0x2a31c0=_[_0x7fe5('0x3a')]({},_0x2a31c0,_0x1c3e08[_0x7fe5('0x3b')]);return db['CmHopperFinal'][_0x7fe5('0x43')](_0x2a31c0)[_0x7fe5('0x23')](handleEntityNotFound(_0x2fd004,null))[_0x7fe5('0x23')](respondWithResult(_0x2fd004,null))['catch'](handleError(_0x2fd004,null));};exports[_0x7fe5('0x44')]=function(_0x38e470,_0x3efc98){return db['CmHopperFinal'][_0x7fe5('0x44')]()[_0x7fe5('0x23')](respondWithResult(_0x3efc98,null))[_0x7fe5('0x3e')](handleError(_0x3efc98,null));};exports['update']=function(_0x19c4a6,_0x211933){if(_0x19c4a6[_0x7fe5('0x45')][_0x7fe5('0x46')]){delete _0x19c4a6[_0x7fe5('0x45')][_0x7fe5('0x46')];}return db[_0x7fe5('0x3c')][_0x7fe5('0x43')]({'where':{'uniqueid':_0x19c4a6[_0x7fe5('0x47')]['id']}})[_0x7fe5('0x23')](handleEntityNotFound(_0x211933,null))[_0x7fe5('0x23')](saveUpdates(_0x19c4a6['body'],null))['then'](respondWithResult(_0x211933,null))['catch'](handleError(_0x211933,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x402c09,_0x5c4f3e,_0x31a345){return db[_0x7fe5('0x3c')][_0x7fe5('0x48')]({'raw':![],'where':{'VoiceQueueId':_0x402c09[_0x7fe5('0x47')]['id']},'attributes':[[db[_0x7fe5('0x49')]['fn']('COUNT',db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x4b')))),_0x7fe5('0x4c')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x7fe5('0x4e')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0x7fe5('0x4f')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x50')))),'congestionContacts'],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7fe5('0x51')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x52')))),_0x7fe5('0x53')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x54')))),_0x7fe5('0x55')],[db[_0x7fe5('0x49')]['fn']('COUNT',db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7fe5('0x23')](handleEntityNotFound(_0x5c4f3e,null))['then'](respondWithResult(_0x5c4f3e,null))[_0x7fe5('0x3e')](handleError(_0x5c4f3e,null));};exports[_0x7fe5('0x56')]=function(_0x491702,_0x16deb8,_0x47c811){return db[_0x7fe5('0x3c')][_0x7fe5('0x48')]({'raw':![],'where':{'CampaignId':_0x491702[_0x7fe5('0x47')]['id']},'attributes':[[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize']['literal'](_0x7fe5('0x4b')))),_0x7fe5('0x4c')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x57')))),_0x7fe5('0x4e')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db['sequelize']['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x58')))),_0x7fe5('0x4f')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x50')))),_0x7fe5('0x59')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7fe5('0x51')],[db['sequelize']['fn'](_0x7fe5('0x4d'),db['sequelize']['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x52')))),_0x7fe5('0x53')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')]['literal'](_0x7fe5('0x54')))),'reCallContacts'],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x5a')))),_0x7fe5('0x5b')]]})[_0x7fe5('0x23')](handleEntityNotFound(_0x16deb8,null))[_0x7fe5('0x23')](respondWithResult(_0x16deb8,null))[_0x7fe5('0x3e')](handleError(_0x16deb8,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2bf9ed,_0x46d509,_0x4b0d01){return db[_0x7fe5('0x5c')][_0x7fe5('0x43')]({'where':{'id':_0x2bf9ed['params']['id']}})[_0x7fe5('0x23')](handleEntityNotFound(_0x46d509,null))['then'](function(_0x128d4d){var _0x3577be;if(_0x128d4d){_0x3577be=squel[_0x7fe5('0x5d')]()[_0x7fe5('0x5e')](_0x7fe5('0x5f'))['fromQuery']([_0x7fe5('0x60'),'scheduledAt',_0x7fe5('0x61'),_0x7fe5('0x62'),_0x7fe5('0x63'),_0x7fe5('0x64'),'updatedAt'],squel[_0x7fe5('0x65')]()['field'](_0x7fe5('0x66'),_0x7fe5('0x60'))['field'](_0x7fe5('0x67'),_0x7fe5('0x68'))['field'](_0x7fe5('0x69'),_0x7fe5('0x61'))[_0x7fe5('0x6a')]('ANY_VALUE(ListId)',_0x7fe5('0x62'))[_0x7fe5('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x7fe5('0x63'))[_0x7fe5('0x6a')]('NOW()',_0x7fe5('0x64'))['field']('NOW()',_0x7fe5('0x6b'))[_0x7fe5('0x6c')]('cm_hopper_final')['where'](_0x7fe5('0x6d'),_0x2bf9ed['params']['id'][_0x7fe5('0x6e')]())['where'](_0x7fe5('0x6f'),_0x2bf9ed[_0x7fe5('0x45')][_0x7fe5('0x70')][_0x7fe5('0x6e')]())[_0x7fe5('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')](_0x7fe5('0x60'))[_0x7fe5('0x6c')](_0x7fe5('0x5f'))[_0x7fe5('0x38')](_0x7fe5('0x6d'),_0x2bf9ed[_0x7fe5('0x47')]['id']['toString']()))[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')](_0x7fe5('0x72'))['from'](_0x7fe5('0x73'))[_0x7fe5('0x38')](_0x7fe5('0x6d'),_0x2bf9ed[_0x7fe5('0x47')]['id'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')](_0x7fe5('0x74')))[_0x7fe5('0x75')](_0x7fe5('0x61')))[_0x7fe5('0x6e')]();return db[_0x7fe5('0x49')]['query'](_0x3577be);}return[];})[_0x7fe5('0x23')](respondWithResult(_0x46d509,null))[_0x7fe5('0x3e')](handleError(_0x46d509,null));};exports[_0x7fe5('0x76')]=function(_0x2d44c4,_0x22caf8,_0x53ee9f){return db[_0x7fe5('0x77')][_0x7fe5('0x43')]({'where':{'id':_0x2d44c4[_0x7fe5('0x47')]['id']}})['then'](handleEntityNotFound(_0x22caf8,null))['then'](function(_0x4a85c8){var _0x45c599;if(_0x4a85c8){_0x45c599=squel[_0x7fe5('0x5d')]()[_0x7fe5('0x5e')](_0x7fe5('0x5f'))['fromQuery']([_0x7fe5('0x60'),_0x7fe5('0x68'),'ContactId','ListId',_0x7fe5('0x78'),_0x7fe5('0x64'),_0x7fe5('0x6b')],squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')]('ANY_VALUE(calleridnum)',_0x7fe5('0x60'))['field'](_0x7fe5('0x67'),_0x7fe5('0x68'))[_0x7fe5('0x6a')](_0x7fe5('0x69'),_0x7fe5('0x61'))[_0x7fe5('0x6a')](_0x7fe5('0x79'),_0x7fe5('0x62'))[_0x7fe5('0x6a')](_0x7fe5('0x7a'),_0x7fe5('0x78'))['field'](_0x7fe5('0x67'),_0x7fe5('0x64'))[_0x7fe5('0x6a')](_0x7fe5('0x67'),_0x7fe5('0x6b'))[_0x7fe5('0x6c')]('cm_hopper_final')[_0x7fe5('0x38')](_0x7fe5('0x7b'),_0x2d44c4[_0x7fe5('0x47')]['id'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')]('state\x20=\x20?',_0x2d44c4['body']['state'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')](_0x7fe5('0x7c'))[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')](_0x7fe5('0x60'))[_0x7fe5('0x6c')](_0x7fe5('0x5f'))['where'](_0x7fe5('0x7b'),_0x2d44c4['params']['id']['toString']()))[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()['field'](_0x7fe5('0x72'))['from']('cm_hopper_final')[_0x7fe5('0x38')](_0x7fe5('0x7b'),_0x2d44c4[_0x7fe5('0x47')]['id'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')](_0x7fe5('0x74')))[_0x7fe5('0x75')](_0x7fe5('0x61')))[_0x7fe5('0x6e')]();return db[_0x7fe5('0x49')]['query'](_0x45c599);}return[];})[_0x7fe5('0x23')](respondWithResult(_0x22caf8,null))[_0x7fe5('0x3e')](handleError(_0x22caf8,null));};exports[_0x7fe5('0x7d')]=function(_0x448514,_0x4e082b,_0x21a6fb){return db[_0x7fe5('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x448514[_0x7fe5('0x45')][_0x7fe5('0x63')],'CampaignId':_0x448514[_0x7fe5('0x45')][_0x7fe5('0x78')],'ContactId':_0x448514[_0x7fe5('0x45')][_0x7fe5('0x61')]}})[_0x7fe5('0x23')](handleEntityNotFound(_0x4e082b,null))[_0x7fe5('0x23')](function(_0x55f461){if(_0x55f461){return _0x55f461;}return null;})[_0x7fe5('0x23')](respondWithResult(_0x4e082b,null))[_0x7fe5('0x3e')](handleError(_0x4e082b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 58e4126..854a50d 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 _0xa26c=['rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4122c3,_0x517c4d){var _0x1e6873=function(_0x3f051c){while(--_0x3f051c){_0x4122c3['push'](_0x4122c3['shift']());}};_0x1e6873(++_0x517c4d);}(_0xa26c,0x1c9));var _0xca26=function(_0x38673c,_0xd8efb8){_0x38673c=_0x38673c-0x0;var _0x61d54f=_0xa26c[_0x38673c];return _0x61d54f;};'use strict';var _=require(_0xca26('0x0'));var util=require(_0xca26('0x1'));var logger=require(_0xca26('0x2'))(_0xca26('0x3'));var moment=require(_0xca26('0x4'));var BPromise=require(_0xca26('0x5'));var rp=require(_0xca26('0x6'));var fs=require('fs');var path=require(_0xca26('0x7'));var rimraf=require(_0xca26('0x8'));var config=require('../../config/environment');var attributes=require(_0xca26('0x9'));module[_0xca26('0xa')]=function(_0x5034fe,_0x431492){return _0x5034fe[_0xca26('0xb')]('CmHopperFinal',attributes,{'tableName':_0xca26('0xc'),'paranoid':![],'indexes':[{'name':_0xca26('0xd'),'fields':[_0xca26('0xd')]},{'name':_0xca26('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3a3=['cm_hopper_final','calleridnum','uniqueid','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xd3a3,0x1ca));var _0x3d3a=function(_0x47d017,_0x5e5e6e){_0x47d017=_0x47d017-0x0;var _0x43f349=_0xd3a3[_0x47d017];return _0x43f349;};'use strict';var _=require(_0x3d3a('0x0'));var util=require(_0x3d3a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3d3a('0x2'));var rp=require(_0x3d3a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d3a('0x4'));var config=require(_0x3d3a('0x5'));var attributes=require(_0x3d3a('0x6'));module[_0x3d3a('0x7')]=function(_0x460ccb,_0x421f79){return _0x460ccb[_0x3d3a('0x8')](_0x3d3a('0x9'),attributes,{'tableName':_0x3d3a('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x3d3a('0xb')]},{'name':'uniqueid','fields':[_0x3d3a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 10bdd35..e54bf10 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 _0xbbb7=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','CmHopperFinal','body','options','raw','CreateCmHopperFinal'];(function(_0x46ea58,_0xdc612f){var _0x5cac1a=function(_0x1b3bf0){while(--_0x1b3bf0){_0x46ea58['push'](_0x46ea58['shift']());}};_0x5cac1a(++_0xdc612f);}(_0xbbb7,0x123));var _0x7bbb=function(_0x57c871,_0x384d51){_0x57c871=_0x57c871-0x0;var _0x17604f=_0xbbb7[_0x57c871];return _0x17604f;};'use strict';var _=require('lodash');var util=require(_0x7bbb('0x0'));var moment=require(_0x7bbb('0x1'));var BPromise=require(_0x7bbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bbb('0x3'));var db=require(_0x7bbb('0x4'))['db'];var utils=require(_0x7bbb('0x5'));var logger=require(_0x7bbb('0x6'))(_0x7bbb('0x7'));var config=require(_0x7bbb('0x8'));var jayson=require(_0x7bbb('0x9'));var client=jayson[_0x7bbb('0xa')][_0x7bbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29310d,_0xefe4cf,_0x27ed95){return new BPromise(function(_0x28ddb8,_0x72f2ec){return client[_0x7bbb('0xc')](_0x29310d,_0x27ed95)[_0x7bbb('0xd')](function(_0x20e257){logger[_0x7bbb('0xe')](_0x7bbb('0xf'),_0xefe4cf,'request\x20sent');logger[_0x7bbb('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0xefe4cf,_0x7bbb('0x11'),JSON[_0x7bbb('0x12')](_0x20e257));if(_0x20e257['error']){if(_0x20e257['error'][_0x7bbb('0x13')]===0x1f4){logger[_0x7bbb('0x14')](_0x7bbb('0xf'),_0xefe4cf,_0x20e257['error'][_0x7bbb('0x15')]);return _0x72f2ec(_0x20e257[_0x7bbb('0x14')][_0x7bbb('0x15')]);}logger[_0x7bbb('0x14')](_0x7bbb('0xf'),_0xefe4cf,_0x20e257['error'][_0x7bbb('0x15')]);return _0x28ddb8(_0x20e257[_0x7bbb('0x14')][_0x7bbb('0x15')]);}else{logger[_0x7bbb('0xe')](_0x7bbb('0xf'),_0xefe4cf,_0x7bbb('0x11'));_0x28ddb8(_0x20e257[_0x7bbb('0x16')][_0x7bbb('0x15')]);}})['catch'](function(_0x2be336){logger[_0x7bbb('0x14')](_0x7bbb('0xf'),_0xefe4cf,_0x2be336);_0x72f2ec(_0x2be336);});});}exports['CreateCmHopperFinal']=function(_0x5ca035){var _0xf867ee=this;return new Promise(function(_0x1b810c,_0x5ef23a){return db[_0x7bbb('0x17')]['create'](_0x5ca035[_0x7bbb('0x18')],{'raw':_0x5ca035[_0x7bbb('0x19')]?_0x5ca035[_0x7bbb('0x19')][_0x7bbb('0x1a')]===undefined?!![]:![]:!![]})[_0x7bbb('0xd')](function(_0x31732b){logger[_0x7bbb('0xe')](_0x7bbb('0x1b'),_0x5ca035);logger[_0x7bbb('0x10')](_0x7bbb('0x1b'),_0x5ca035,JSON[_0x7bbb('0x12')](_0x31732b));_0x1b810c(_0x31732b);})[_0x7bbb('0x1c')](function(_0x294495){logger[_0x7bbb('0x14')](_0x7bbb('0x1b'),_0x294495['message'],_0x5ca035);_0x5ef23a(_0xf867ee['error'](0x1f4,_0x294495['message']));});});}; \ No newline at end of file +var _0x3d8b=['then','info','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmHopperFinal,\x20%s,\x20%s','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2fd02e,_0x8ebcc5){var _0x4d7f54=function(_0x1437c0){while(--_0x1437c0){_0x2fd02e['push'](_0x2fd02e['shift']());}};_0x4d7f54(++_0x8ebcc5);}(_0x3d8b,0x103));var _0xb3d8=function(_0x275644,_0x52edac){_0x275644=_0x275644-0x0;var _0xaa9d09=_0x3d8b[_0x275644];return _0xaa9d09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb3d8('0x0'));var BPromise=require('bluebird');var rs=require(_0xb3d8('0x1'));var fs=require('fs');var Redis=require(_0xb3d8('0x2'));var db=require(_0xb3d8('0x3'))['db'];var utils=require(_0xb3d8('0x4'));var logger=require(_0xb3d8('0x5'))('rpc');var config=require(_0xb3d8('0x6'));var jayson=require(_0xb3d8('0x7'));var client=jayson[_0xb3d8('0x8')][_0xb3d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eae9b,_0x1afd37,_0x3fc8ef){return new BPromise(function(_0x4988df,_0x13ce4e){return client[_0xb3d8('0xa')](_0x4eae9b,_0x3fc8ef)[_0xb3d8('0xb')](function(_0x477f9b){logger[_0xb3d8('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x1afd37,'request\x20sent');logger[_0xb3d8('0xd')](_0xb3d8('0xe'),_0x1afd37,_0xb3d8('0xf'),JSON[_0xb3d8('0x10')](_0x477f9b));if(_0x477f9b[_0xb3d8('0x11')]){if(_0x477f9b['error'][_0xb3d8('0x12')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x1afd37,_0x477f9b[_0xb3d8('0x11')][_0xb3d8('0x13')]);return _0x13ce4e(_0x477f9b[_0xb3d8('0x11')]['message']);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x1afd37,_0x477f9b[_0xb3d8('0x11')]['message']);return _0x4988df(_0x477f9b['error'][_0xb3d8('0x13')]);}else{logger['info'](_0xb3d8('0x14'),_0x1afd37,_0xb3d8('0xf'));_0x4988df(_0x477f9b['result'][_0xb3d8('0x13')]);}})[_0xb3d8('0x15')](function(_0x26c516){logger[_0xb3d8('0x11')](_0xb3d8('0x14'),_0x1afd37,_0x26c516);_0x13ce4e(_0x26c516);});});}exports[_0xb3d8('0x16')]=function(_0x2a235f){var _0x3b9ef8=this;return new Promise(function(_0x5e9692,_0x22de0c){return db[_0xb3d8('0x17')]['create'](_0x2a235f[_0xb3d8('0x18')],{'raw':_0x2a235f[_0xb3d8('0x19')]?_0x2a235f[_0xb3d8('0x19')][_0xb3d8('0x1a')]===undefined?!![]:![]:!![]})[_0xb3d8('0xb')](function(_0x21de73){logger[_0xb3d8('0xc')](_0xb3d8('0x16'),_0x2a235f);logger['debug'](_0xb3d8('0x16'),_0x2a235f,JSON['stringify'](_0x21de73));_0x5e9692(_0x21de73);})[_0xb3d8('0x15')](function(_0x46661f){logger[_0xb3d8('0x11')](_0xb3d8('0x16'),_0x46661f[_0xb3d8('0x13')],_0x2a235f);_0x22de0c(_0x3b9ef8[_0xb3d8('0x11')](0x1f4,_0x46661f[_0xb3d8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index a111f51..016b9cf 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 _0xb989=['./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb989,0x1d4));var _0x9b98=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xb989[_0x11a55c];return _0x26c390;};'use strict';var multer=require('multer');var util=require(_0x9b98('0x0'));var path=require('path');var timeout=require(_0x9b98('0x1'));var express=require(_0x9b98('0x2'));var router=express[_0x9b98('0x3')]();var auth=require(_0x9b98('0x4'));var interaction=require(_0x9b98('0x5'));var config=require(_0x9b98('0x6'));var controller=require(_0x9b98('0x7'));router[_0x9b98('0x8')]('/',auth[_0x9b98('0x9')](),controller[_0x9b98('0xa')]);router[_0x9b98('0x8')](_0x9b98('0xb'),auth[_0x9b98('0x9')](),controller[_0x9b98('0xc')]);router[_0x9b98('0x8')](_0x9b98('0xd'),auth[_0x9b98('0x9')](),controller['show']);router['get'](_0x9b98('0xe'),auth[_0x9b98('0x9')](),controller[_0x9b98('0xf')]);router[_0x9b98('0x8')](_0x9b98('0x10'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x9b98('0x11')]);router[_0x9b98('0x12')](_0x9b98('0x13'),auth[_0x9b98('0x9')](),controller[_0x9b98('0x14')]);router[_0x9b98('0x12')](_0x9b98('0x15'),auth['isAuthenticated'](),controller[_0x9b98('0x16')]);router['put'](_0x9b98('0xd'),auth['isAuthenticated'](),controller[_0x9b98('0x17')]);module[_0x9b98('0x18')]=router; \ No newline at end of file +var _0xb584=['isAuthenticated','index','/describe','describe','get','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x212252,_0x565fc8){var _0x438284=function(_0x37225a){while(--_0x37225a){_0x212252['push'](_0x212252['shift']());}};_0x438284(++_0x565fc8);}(_0xb584,0xa0));var _0x4b58=function(_0x2581fb,_0xd552af){_0x2581fb=_0x2581fb-0x0;var _0x59e90b=_0xb584[_0x2581fb];return _0x59e90b;};'use strict';var multer=require(_0x4b58('0x0'));var util=require(_0x4b58('0x1'));var path=require('path');var timeout=require(_0x4b58('0x2'));var express=require(_0x4b58('0x3'));var router=express[_0x4b58('0x4')]();var auth=require(_0x4b58('0x5'));var interaction=require(_0x4b58('0x6'));var config=require(_0x4b58('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x4b58('0x8')](),controller[_0x4b58('0x9')]);router['get'](_0x4b58('0xa'),auth[_0x4b58('0x8')](),controller[_0x4b58('0xb')]);router[_0x4b58('0xc')](_0x4b58('0xd'),auth[_0x4b58('0x8')](),controller[_0x4b58('0xe')]);router[_0x4b58('0xc')]('/voice/queue/countAttributes/:id',auth[_0x4b58('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x4b58('0xc')](_0x4b58('0xf'),auth[_0x4b58('0x8')](),controller[_0x4b58('0x10')]);router['post'](_0x4b58('0x11'),auth[_0x4b58('0x8')](),controller[_0x4b58('0x12')]);router[_0x4b58('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x4b58('0x8')](),controller[_0x4b58('0x14')]);router['post'](_0x4b58('0x15'),auth[_0x4b58('0x8')](),controller[_0x4b58('0x16')]);router['put'](_0x4b58('0xd'),auth[_0x4b58('0x8')](),controller[_0x4b58('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9744c89..3327437 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 _0xd8a4=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x4be843,_0x4ec83e){var _0x4a0ab5=function(_0x15fc7){while(--_0x15fc7){_0x4be843['push'](_0x4be843['shift']());}};_0x4a0ab5(++_0x4ec83e);}(_0xd8a4,0xa1));var _0x4d8a=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xd8a4[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x4d8a('0x0'));module['exports']={'state':{'type':Sequelize[_0x4d8a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4d8a('0x2')]},'scheduledat':{'type':Sequelize[_0x4d8a('0x3')]},'countbusyretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4d8a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4d8a('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4d8a('0x2')]},'calleridnum':{'type':Sequelize[_0x4d8a('0x2')]},'calleridname':{'type':Sequelize[_0x4d8a('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4d8a('0x3')]},'answertime':{'type':Sequelize[_0x4d8a('0x3')]},'droptime':{'type':Sequelize[_0x4d8a('0x3')]},'endtime':{'type':Sequelize[_0x4d8a('0x3')]},'ringtime':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4d8a('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4d8a('0x2')]},'reason':{'type':Sequelize[_0x4d8a('0x2')]},'amd':{'type':Sequelize[_0x4d8a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4d8a('0x3')]},'recallme':{'type':Sequelize[_0x4d8a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4d8a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc67f=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0xc67f,0x11b));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc67('0x0'));module['exports']={'state':{'type':Sequelize[_0xfc67('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xfc67('0x2')]},'scheduledat':{'type':Sequelize[_0xfc67('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc67('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc67('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xfc67('0x2')]},'originatecalleridname':{'type':Sequelize[_0xfc67('0x2')]},'calleridnum':{'type':Sequelize[_0xfc67('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfc67('0x3')]},'droptime':{'type':Sequelize[_0xfc67('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc67('0x2')]},'campaign':{'type':Sequelize[_0xfc67('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xfc67('0x2')]},'amd':{'type':Sequelize[_0xfc67('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfc67('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc67('0x3')]},'recallme':{'type':Sequelize[_0xfc67('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfc67('0x3')]},'edited':{'type':Sequelize[_0xfc67('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfc67('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc67('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc67('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 4e8ca84..c93d403 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 _0x68fd=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','keys','create','describe','body','uniqueid','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x159530,_0x1581f5){var _0x34fc81=function(_0x46d3b0){while(--_0x46d3b0){_0x159530['push'](_0x159530['shift']());}};_0x34fc81(++_0x1581f5);}(_0x68fd,0x1e4));var _0xd68f=function(_0x1331fd,_0x4f4598){_0x1331fd=_0x1331fd-0x0;var _0x5720f9=_0x68fd[_0x1331fd];return _0x5720f9;};'use strict';var pdf=require(_0xd68f('0x0'));var emlformat=require(_0xd68f('0x1'));var rimraf=require(_0xd68f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd68f('0x3'));var rp=require(_0xd68f('0x4'));var moment=require(_0xd68f('0x5'));var BPromise=require(_0xd68f('0x6'));var Mustache=require(_0xd68f('0x7'));var util=require(_0xd68f('0x8'));var path=require(_0xd68f('0x9'));var sox=require(_0xd68f('0xa'));var csv=require('to-csv');var ejs=require(_0xd68f('0xb'));var fs=require('fs');var _=require(_0xd68f('0xc'));var squel=require(_0xd68f('0xd'));var crypto=require(_0xd68f('0xe'));var jsforce=require(_0xd68f('0xf'));var deskjs=require(_0xd68f('0x10'));var toCsv=require(_0xd68f('0x11'));var querystring=require(_0xd68f('0x12'));var Papa=require(_0xd68f('0x13'));var Redis=require(_0xd68f('0x14'));var authService=require(_0xd68f('0x15'));var qs=require(_0xd68f('0x16'));var as=require(_0xd68f('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd68f('0x18'));var utils=require(_0xd68f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd68f('0x1a'));var db=require(_0xd68f('0x1b'))['db'];function respondWithStatusCode(_0x2aae9f,_0x2dcadc){_0x2dcadc=_0x2dcadc||0xcc;return function(_0x150d6a){if(_0x150d6a){return _0x2aae9f[_0xd68f('0x1c')](_0x2dcadc);}return _0x2aae9f[_0xd68f('0x1d')](_0x2dcadc)[_0xd68f('0x1e')]();};}function respondWithResult(_0x5197c0,_0xfcc306){_0xfcc306=_0xfcc306||0xc8;return function(_0x1d9dd1){if(_0x1d9dd1){return _0x5197c0[_0xd68f('0x1d')](_0xfcc306)[_0xd68f('0x1f')](_0x1d9dd1);}};}function respondWithFilteredResult(_0x320b33,_0x42f337){return function(_0x5b9b1d){if(_0x5b9b1d){var _0x576ea9=_0x5b9b1d[_0xd68f('0x20')],_0x33ab17=_0x42f337[_0xd68f('0x21')],_0x19eff7=_0x42f337[_0xd68f('0x21')]+_0x42f337['limit'],_0x266772;if(_0x19eff7>=_0x576ea9){_0x19eff7=_0x576ea9;_0x266772=0xc8;}else{_0x266772=0xce;}_0x320b33[_0xd68f('0x1d')](_0x266772);return _0x320b33[_0xd68f('0x22')]('Content-Range',_0x33ab17+'-'+_0x19eff7+'/'+_0x576ea9)['json'](_0x5b9b1d);}return null;};}function patchUpdates(_0x2de5cb){return function(_0x51a285){try{jsonpatch['apply'](_0x51a285,_0x2de5cb,!![]);}catch(_0x2abf47){return BPromise[_0xd68f('0x23')](_0x2abf47);}return _0x51a285[_0xd68f('0x24')]();};}function saveUpdates(_0x5b2554,_0x3c72e9){return function(_0x130719){if(_0x130719){return _0x130719[_0xd68f('0x25')](_0x5b2554)[_0xd68f('0x26')](function(_0x49749b){return _0x49749b;});}return null;};}function removeEntity(_0x395dce,_0xc71509){return function(_0x22da1e){if(_0x22da1e){return _0x22da1e[_0xd68f('0x27')]()['then'](function(){_0x395dce[_0xd68f('0x1d')](0xcc)[_0xd68f('0x1e')]();});}};}function handleEntityNotFound(_0x2e349d,_0x2fbfbb){return function(_0x2d62ed){if(!_0x2d62ed){_0x2e349d[_0xd68f('0x1c')](0x194);}return _0x2d62ed;};}function handleError(_0x32a69e,_0x5e8cb0){_0x5e8cb0=_0x5e8cb0||0x1f4;return function(_0xa502d5){logger[_0xd68f('0x28')](_0xa502d5[_0xd68f('0x29')]);if(_0xa502d5[_0xd68f('0x2a')]){delete _0xa502d5[_0xd68f('0x2a')];}_0x32a69e[_0xd68f('0x1d')](_0x5e8cb0)[_0xd68f('0x2b')](_0xa502d5);};}exports[_0xd68f('0x2c')]=function(_0x1cdd3b,_0xe37ff0){var _0x334feb={},_0x4c0e45={},_0x22cf2f={'count':0x0,'rows':[]};var _0x3c4a04=_[_0xd68f('0x2d')](db['CmHopperHistory'][_0xd68f('0x2e')],function(_0x42597b){return{'name':_0x42597b[_0xd68f('0x2f')],'type':_0x42597b[_0xd68f('0x30')][_0xd68f('0x31')]};});_0x4c0e45[_0xd68f('0x32')]=_[_0xd68f('0x2d')](_0x3c4a04,_0xd68f('0x2a'));_0x4c0e45[_0xd68f('0x33')]=_['keys'](_0x1cdd3b[_0xd68f('0x33')]);_0x4c0e45[_0xd68f('0x34')]=_[_0xd68f('0x35')](_0x4c0e45[_0xd68f('0x32')],_0x4c0e45[_0xd68f('0x33')]);_0x334feb['attributes']=_[_0xd68f('0x35')](_0x4c0e45[_0xd68f('0x32')],qs['fields'](_0x1cdd3b[_0xd68f('0x33')][_0xd68f('0x36')]));_0x334feb['attributes']=_0x334feb[_0xd68f('0x37')][_0xd68f('0x38')]?_0x334feb['attributes']:_0x4c0e45['model'];if(!_0x1cdd3b[_0xd68f('0x33')][_0xd68f('0x39')](_0xd68f('0x3a'))){_0x334feb[_0xd68f('0x3b')]=qs[_0xd68f('0x3b')](_0x1cdd3b['query'][_0xd68f('0x3b')]);_0x334feb['offset']=qs[_0xd68f('0x21')](_0x1cdd3b['query'][_0xd68f('0x21')]);}_0x334feb[_0xd68f('0x3c')]=qs[_0xd68f('0x3d')](_0x1cdd3b[_0xd68f('0x33')]['sort']);_0x334feb['where']=qs[_0xd68f('0x34')](_[_0xd68f('0x3e')](_0x1cdd3b[_0xd68f('0x33')],_0x4c0e45[_0xd68f('0x34')]),_0x3c4a04);if(_0x1cdd3b[_0xd68f('0x33')]['filter']){_0x334feb[_0xd68f('0x3f')]=_[_0xd68f('0x40')](_0x334feb[_0xd68f('0x3f')],{'$or':_[_0xd68f('0x2d')](_0x3c4a04,function(_0x3bb1a6){if(_0x3bb1a6[_0xd68f('0x30')]!==_0xd68f('0x41')){var _0x22fa91={};_0x22fa91[_0x3bb1a6[_0xd68f('0x2a')]]={'$like':'%'+_0x1cdd3b['query'][_0xd68f('0x42')]+'%'};return _0x22fa91;}})});}_0x334feb=_[_0xd68f('0x40')]({},_0x334feb,_0x1cdd3b[_0xd68f('0x43')]);var _0x200998={'where':_0x334feb[_0xd68f('0x3f')]};return db[_0xd68f('0x44')]['count'](_0x200998)['then'](function(_0x4488b4){_0x22cf2f[_0xd68f('0x20')]=_0x4488b4;if(_0x1cdd3b[_0xd68f('0x33')][_0xd68f('0x45')]){_0x334feb[_0xd68f('0x46')]=[{'all':!![]}];}return db[_0xd68f('0x44')][_0xd68f('0x47')](_0x334feb);})['then'](function(_0x2a11eb){_0x22cf2f[_0xd68f('0x48')]=_0x2a11eb;return _0x22cf2f;})['then'](respondWithFilteredResult(_0xe37ff0,_0x334feb))[_0xd68f('0x49')](handleError(_0xe37ff0,null));};exports[_0xd68f('0x4a')]=function(_0x464691,_0x28fa65){var _0x3e2bdd={'raw':!![],'where':{'id':_0x464691[_0xd68f('0x4b')]['id']}},_0x51b983={};_0x51b983[_0xd68f('0x32')]=_[_0xd68f('0x4c')](db['CmHopperHistory']['rawAttributes']);_0x51b983[_0xd68f('0x33')]=_[_0xd68f('0x4c')](_0x464691[_0xd68f('0x33')]);_0x51b983[_0xd68f('0x34')]=_['intersection'](_0x51b983[_0xd68f('0x32')],_0x51b983[_0xd68f('0x33')]);_0x3e2bdd[_0xd68f('0x37')]=_[_0xd68f('0x35')](_0x51b983[_0xd68f('0x32')],qs['fields'](_0x464691[_0xd68f('0x33')]['fields']));_0x3e2bdd['attributes']=_0x3e2bdd[_0xd68f('0x37')][_0xd68f('0x38')]?_0x3e2bdd['attributes']:_0x51b983[_0xd68f('0x32')];if(_0x464691[_0xd68f('0x33')]['includeAll']){_0x3e2bdd[_0xd68f('0x46')]=[{'all':!![]}];}_0x3e2bdd=_['merge']({},_0x3e2bdd,_0x464691['options']);return db[_0xd68f('0x44')]['find'](_0x3e2bdd)['then'](handleEntityNotFound(_0x28fa65,null))[_0xd68f('0x26')](respondWithResult(_0x28fa65,null))[_0xd68f('0x49')](handleError(_0x28fa65,null));};exports['create']=function(_0x17d601,_0x2877c4){return db[_0xd68f('0x44')][_0xd68f('0x4d')](_0x17d601['body'],{})['then'](respondWithResult(_0x2877c4,0xc9))[_0xd68f('0x49')](handleError(_0x2877c4,null));};exports[_0xd68f('0x4e')]=function(_0x4b1878,_0x1813cd){return db['CmHopperHistory'][_0xd68f('0x4e')]()['then'](respondWithResult(_0x1813cd,null))[_0xd68f('0x49')](handleError(_0x1813cd,null));};exports[_0xd68f('0x25')]=function(_0x280a5a,_0x5d3aa2){if(_0x280a5a['body']['uniqueid']){delete _0x280a5a[_0xd68f('0x4f')][_0xd68f('0x50')];}return db[_0xd68f('0x44')][_0xd68f('0x51')]({'where':{'uniqueid':_0x280a5a[_0xd68f('0x4b')]['id']}})[_0xd68f('0x26')](handleEntityNotFound(_0x5d3aa2,null))[_0xd68f('0x26')](saveUpdates(_0x280a5a['body'],null))[_0xd68f('0x26')](respondWithResult(_0x5d3aa2,null))[_0xd68f('0x49')](handleError(_0x5d3aa2,null));}; \ No newline at end of file +var _0xc05b=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x3f5e94,_0x11b3f9){var _0x2d331c=function(_0x2f8d8c){while(--_0x2f8d8c){_0x3f5e94['push'](_0x3f5e94['shift']());}};_0x2d331c(++_0x11b3f9);}(_0xc05b,0x1c0));var _0xbc05=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0xc05b[_0x55d829];return _0x52163b;};'use strict';var pdf=require(_0xbc05('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbc05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc05('0x2'));var rp=require(_0xbc05('0x3'));var moment=require('moment');var BPromise=require(_0xbc05('0x4'));var Mustache=require(_0xbc05('0x5'));var util=require(_0xbc05('0x6'));var path=require(_0xbc05('0x7'));var sox=require(_0xbc05('0x8'));var csv=require(_0xbc05('0x9'));var ejs=require(_0xbc05('0xa'));var fs=require('fs');var _=require(_0xbc05('0xb'));var squel=require(_0xbc05('0xc'));var crypto=require(_0xbc05('0xd'));var jsforce=require(_0xbc05('0xe'));var deskjs=require(_0xbc05('0xf'));var toCsv=require(_0xbc05('0x9'));var querystring=require(_0xbc05('0x10'));var Papa=require(_0xbc05('0x11'));var Redis=require(_0xbc05('0x12'));var authService=require(_0xbc05('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbc05('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbc05('0x15'));var utils=require(_0xbc05('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbc05('0x17'));var db=require(_0xbc05('0x18'))['db'];function respondWithStatusCode(_0x34c278,_0x18e84a){_0x18e84a=_0x18e84a||0xcc;return function(_0x692a07){if(_0x692a07){return _0x34c278[_0xbc05('0x19')](_0x18e84a);}return _0x34c278[_0xbc05('0x1a')](_0x18e84a)[_0xbc05('0x1b')]();};}function respondWithResult(_0x55df8f,_0x3eb420){_0x3eb420=_0x3eb420||0xc8;return function(_0x381833){if(_0x381833){return _0x55df8f[_0xbc05('0x1a')](_0x3eb420)[_0xbc05('0x1c')](_0x381833);}};}function respondWithFilteredResult(_0xaa806d,_0x22170b){return function(_0x283114){if(_0x283114){var _0x1771f9=_0x283114['count'],_0x35d09f=_0x22170b[_0xbc05('0x1d')],_0x167e50=_0x22170b[_0xbc05('0x1d')]+_0x22170b[_0xbc05('0x1e')],_0x592d16;if(_0x167e50>=_0x1771f9){_0x167e50=_0x1771f9;_0x592d16=0xc8;}else{_0x592d16=0xce;}_0xaa806d[_0xbc05('0x1a')](_0x592d16);return _0xaa806d[_0xbc05('0x1f')](_0xbc05('0x20'),_0x35d09f+'-'+_0x167e50+'/'+_0x1771f9)['json'](_0x283114);}return null;};}function patchUpdates(_0xdca9d2){return function(_0x27f225){try{jsonpatch[_0xbc05('0x21')](_0x27f225,_0xdca9d2,!![]);}catch(_0x486f8f){return BPromise[_0xbc05('0x22')](_0x486f8f);}return _0x27f225[_0xbc05('0x23')]();};}function saveUpdates(_0x2ae92b,_0x4df36a){return function(_0x8fdbe1){if(_0x8fdbe1){return _0x8fdbe1[_0xbc05('0x24')](_0x2ae92b)[_0xbc05('0x25')](function(_0x2b6eaf){return _0x2b6eaf;});}return null;};}function removeEntity(_0x575798,_0x8c075c){return function(_0x4e0600){if(_0x4e0600){return _0x4e0600[_0xbc05('0x26')]()[_0xbc05('0x25')](function(){_0x575798[_0xbc05('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56519c,_0xf44fc9){return function(_0x25d292){if(!_0x25d292){_0x56519c[_0xbc05('0x19')](0x194);}return _0x25d292;};}function handleError(_0x5566e7,_0x1856e7){_0x1856e7=_0x1856e7||0x1f4;return function(_0x4a92f8){logger[_0xbc05('0x27')](_0x4a92f8[_0xbc05('0x28')]);if(_0x4a92f8['name']){delete _0x4a92f8[_0xbc05('0x29')];}_0x5566e7['status'](_0x1856e7)[_0xbc05('0x2a')](_0x4a92f8);};}exports[_0xbc05('0x2b')]=function(_0x3ddf4c,_0x58b4d2){var _0x2fe9c4={},_0x1d2be4={},_0x478aa8={'count':0x0,'rows':[]};var _0x5b6071=_[_0xbc05('0x2c')](db[_0xbc05('0x2d')][_0xbc05('0x2e')],function(_0x1252ba){return{'name':_0x1252ba['fieldName'],'type':_0x1252ba[_0xbc05('0x2f')][_0xbc05('0x30')]};});_0x1d2be4['model']=_[_0xbc05('0x2c')](_0x5b6071,'name');_0x1d2be4[_0xbc05('0x31')]=_[_0xbc05('0x32')](_0x3ddf4c[_0xbc05('0x31')]);_0x1d2be4[_0xbc05('0x33')]=_[_0xbc05('0x34')](_0x1d2be4[_0xbc05('0x35')],_0x1d2be4[_0xbc05('0x31')]);_0x2fe9c4[_0xbc05('0x36')]=_[_0xbc05('0x34')](_0x1d2be4[_0xbc05('0x35')],qs[_0xbc05('0x37')](_0x3ddf4c['query']['fields']));_0x2fe9c4[_0xbc05('0x36')]=_0x2fe9c4[_0xbc05('0x36')][_0xbc05('0x38')]?_0x2fe9c4['attributes']:_0x1d2be4[_0xbc05('0x35')];if(!_0x3ddf4c[_0xbc05('0x31')][_0xbc05('0x39')](_0xbc05('0x3a'))){_0x2fe9c4[_0xbc05('0x1e')]=qs[_0xbc05('0x1e')](_0x3ddf4c[_0xbc05('0x31')][_0xbc05('0x1e')]);_0x2fe9c4['offset']=qs[_0xbc05('0x1d')](_0x3ddf4c[_0xbc05('0x31')][_0xbc05('0x1d')]);}_0x2fe9c4[_0xbc05('0x3b')]=qs[_0xbc05('0x3c')](_0x3ddf4c[_0xbc05('0x31')][_0xbc05('0x3c')]);_0x2fe9c4['where']=qs['filters'](_[_0xbc05('0x3d')](_0x3ddf4c[_0xbc05('0x31')],_0x1d2be4[_0xbc05('0x33')]),_0x5b6071);if(_0x3ddf4c[_0xbc05('0x31')]['filter']){_0x2fe9c4[_0xbc05('0x3e')]=_[_0xbc05('0x3f')](_0x2fe9c4['where'],{'$or':_[_0xbc05('0x2c')](_0x5b6071,function(_0x4e2f36){if(_0x4e2f36[_0xbc05('0x2f')]!==_0xbc05('0x40')){var _0x47e47c={};_0x47e47c[_0x4e2f36['name']]={'$like':'%'+_0x3ddf4c[_0xbc05('0x31')][_0xbc05('0x41')]+'%'};return _0x47e47c;}})});}_0x2fe9c4=_[_0xbc05('0x3f')]({},_0x2fe9c4,_0x3ddf4c[_0xbc05('0x42')]);var _0x2effb5={'where':_0x2fe9c4[_0xbc05('0x3e')]};return db['CmHopperHistory'][_0xbc05('0x43')](_0x2effb5)[_0xbc05('0x25')](function(_0x5e747e){_0x478aa8[_0xbc05('0x43')]=_0x5e747e;if(_0x3ddf4c[_0xbc05('0x31')][_0xbc05('0x44')]){_0x2fe9c4[_0xbc05('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xbc05('0x46')](_0x2fe9c4);})['then'](function(_0x2d12c2){_0x478aa8[_0xbc05('0x47')]=_0x2d12c2;return _0x478aa8;})[_0xbc05('0x25')](respondWithFilteredResult(_0x58b4d2,_0x2fe9c4))[_0xbc05('0x48')](handleError(_0x58b4d2,null));};exports[_0xbc05('0x49')]=function(_0x536fb0,_0x549cc8){var _0xaa4fc1={'raw':!![],'where':{'id':_0x536fb0[_0xbc05('0x4a')]['id']}},_0x4ef112={};_0x4ef112[_0xbc05('0x35')]=_[_0xbc05('0x32')](db[_0xbc05('0x2d')][_0xbc05('0x2e')]);_0x4ef112[_0xbc05('0x31')]=_[_0xbc05('0x32')](_0x536fb0[_0xbc05('0x31')]);_0x4ef112[_0xbc05('0x33')]=_[_0xbc05('0x34')](_0x4ef112[_0xbc05('0x35')],_0x4ef112[_0xbc05('0x31')]);_0xaa4fc1['attributes']=_['intersection'](_0x4ef112[_0xbc05('0x35')],qs[_0xbc05('0x37')](_0x536fb0[_0xbc05('0x31')]['fields']));_0xaa4fc1['attributes']=_0xaa4fc1[_0xbc05('0x36')][_0xbc05('0x38')]?_0xaa4fc1[_0xbc05('0x36')]:_0x4ef112[_0xbc05('0x35')];if(_0x536fb0['query'][_0xbc05('0x44')]){_0xaa4fc1[_0xbc05('0x45')]=[{'all':!![]}];}_0xaa4fc1=_[_0xbc05('0x3f')]({},_0xaa4fc1,_0x536fb0['options']);return db[_0xbc05('0x2d')][_0xbc05('0x4b')](_0xaa4fc1)[_0xbc05('0x25')](handleEntityNotFound(_0x549cc8,null))[_0xbc05('0x25')](respondWithResult(_0x549cc8,null))[_0xbc05('0x48')](handleError(_0x549cc8,null));};exports['create']=function(_0x3fd18c,_0x22d671){return db[_0xbc05('0x2d')][_0xbc05('0x4c')](_0x3fd18c[_0xbc05('0x4d')],{})[_0xbc05('0x25')](respondWithResult(_0x22d671,0xc9))['catch'](handleError(_0x22d671,null));};exports['describe']=function(_0x2da595,_0x161aff){return db[_0xbc05('0x2d')][_0xbc05('0x4e')]()[_0xbc05('0x25')](respondWithResult(_0x161aff,null))[_0xbc05('0x48')](handleError(_0x161aff,null));};exports['update']=function(_0x343562,_0x162c37){if(_0x343562[_0xbc05('0x4d')][_0xbc05('0x4f')]){delete _0x343562[_0xbc05('0x4d')][_0xbc05('0x4f')];}return db[_0xbc05('0x2d')][_0xbc05('0x4b')]({'where':{'uniqueid':_0x343562[_0xbc05('0x4a')]['id']}})['then'](handleEntityNotFound(_0x162c37,null))[_0xbc05('0x25')](saveUpdates(_0x343562[_0xbc05('0x4d')],null))[_0xbc05('0x25')](respondWithResult(_0x162c37,null))[_0xbc05('0x48')](handleError(_0x162c37,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1c8e3bc..75fbd16 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 _0xc8f8=['uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc8f8,0xd3));var _0x8c8f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc8f8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8c8f('0x0'));var util=require('util');var logger=require(_0x8c8f('0x1'))(_0x8c8f('0x2'));var moment=require(_0x8c8f('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c8f('0x4'));var fs=require('fs');var path=require(_0x8c8f('0x5'));var rimraf=require(_0x8c8f('0x6'));var config=require(_0x8c8f('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x8c8f('0x8')]=function(_0x30e444,_0x4afbaf){return _0x30e444[_0x8c8f('0x9')](_0x8c8f('0xa'),attributes,{'tableName':_0x8c8f('0xb'),'paranoid':![],'indexes':[{'name':_0x8c8f('0xc'),'fields':['endtime']},{'name':_0x8c8f('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4541=['CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define'];(function(_0x43aa65,_0x539943){var _0x38c076=function(_0x1b93f1){while(--_0x1b93f1){_0x43aa65['push'](_0x43aa65['shift']());}};_0x38c076(++_0x539943);}(_0x4541,0x196));var _0x1454=function(_0x58a28e,_0x5a616d){_0x58a28e=_0x58a28e-0x0;var _0x15966a=_0x4541[_0x58a28e];return _0x15966a;};'use strict';var _=require(_0x1454('0x0'));var util=require(_0x1454('0x1'));var logger=require(_0x1454('0x2'))(_0x1454('0x3'));var moment=require('moment');var BPromise=require(_0x1454('0x4'));var rp=require(_0x1454('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1454('0x6'));var config=require(_0x1454('0x7'));var attributes=require(_0x1454('0x8'));module['exports']=function(_0x42b57e,_0x384164){return _0x42b57e[_0x1454('0x9')](_0x1454('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x1454('0xb'),'fields':[_0x1454('0xb')]},{'name':'uniqueid','fields':[_0x1454('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d4f8d84..da5e8ab 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 _0x5498=['message','result','catch','CreateCmHopperHistory','body','options','AvgHandleTime','CmHopperHistory','findAll','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','raw','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x23a749,_0x2af650){var _0x7896cb=function(_0x5d2e83){while(--_0x5d2e83){_0x23a749['push'](_0x23a749['shift']());}};_0x7896cb(++_0x2af650);}(_0x5498,0x74));var _0x8549=function(_0x528367,_0x592945){_0x528367=_0x528367-0x0;var _0x3c9373=_0x5498[_0x528367];return _0x3c9373;};'use strict';var _=require(_0x8549('0x0'));var util=require(_0x8549('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8549('0x2'));var db=require(_0x8549('0x3'))['db'];var utils=require(_0x8549('0x4'));var logger=require(_0x8549('0x5'))(_0x8549('0x6'));var config=require('../../config/environment');var jayson=require(_0x8549('0x7'));var client=jayson[_0x8549('0x8')][_0x8549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a25c1,_0x2e75ac,_0x2fe37a){return new BPromise(function(_0x27402f,_0x1ca7a6){return client[_0x8549('0xa')](_0x1a25c1,_0x2fe37a)[_0x8549('0xb')](function(_0x826a9b){logger[_0x8549('0xc')](_0x8549('0xd'),_0x2e75ac,_0x8549('0xe'));logger[_0x8549('0xf')](_0x8549('0x10'),_0x2e75ac,_0x8549('0xe'),JSON[_0x8549('0x11')](_0x826a9b));if(_0x826a9b[_0x8549('0x12')]){if(_0x826a9b['error'][_0x8549('0x13')]===0x1f4){logger[_0x8549('0x12')](_0x8549('0xd'),_0x2e75ac,_0x826a9b[_0x8549('0x12')][_0x8549('0x14')]);return _0x1ca7a6(_0x826a9b[_0x8549('0x12')][_0x8549('0x14')]);}logger[_0x8549('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2e75ac,_0x826a9b['error'][_0x8549('0x14')]);return _0x27402f(_0x826a9b[_0x8549('0x12')]['message']);}else{logger[_0x8549('0xc')](_0x8549('0xd'),_0x2e75ac,'request\x20sent');_0x27402f(_0x826a9b[_0x8549('0x15')][_0x8549('0x14')]);}})[_0x8549('0x16')](function(_0x5ae7b1){logger[_0x8549('0x12')](_0x8549('0xd'),_0x2e75ac,_0x5ae7b1);_0x1ca7a6(_0x5ae7b1);});});}exports[_0x8549('0x17')]=function(_0x594b62){var _0x533cf6=this;return new Promise(function(_0x57f7e,_0x29729a){return db['CmHopperHistory']['create'](_0x594b62[_0x8549('0x18')],{'raw':_0x594b62[_0x8549('0x19')]?_0x594b62[_0x8549('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x482492){logger['info'](_0x8549('0x17'),_0x594b62);logger[_0x8549('0xf')](_0x8549('0x17'),_0x594b62,JSON[_0x8549('0x11')](_0x482492));_0x57f7e(_0x482492);})['catch'](function(_0x3a8f7a){logger[_0x8549('0x12')](_0x8549('0x17'),_0x3a8f7a[_0x8549('0x14')],_0x594b62);_0x29729a(_0x533cf6[_0x8549('0x12')](0x1f4,_0x3a8f7a[_0x8549('0x14')]));});});};exports[_0x8549('0x1a')]=function(_0x3d7bf1){var _0x56831f=this;return new Promise(function(_0x4ae3df,_0x151a3f){return db[_0x8549('0x1b')][_0x8549('0x1c')]({'raw':_0x3d7bf1[_0x8549('0x19')]?_0x3d7bf1[_0x8549('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3d7bf1[_0x8549('0x19')]?_0x3d7bf1['options']['where']||null:null,'attributes':[[db[_0x8549('0x1d')]['fn']('COUNT',db[_0x8549('0x1d')][_0x8549('0x1e')]('id')),_0x8549('0x1f')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x8549('0x22')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x8549('0x23')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8549('0x24')))),_0x8549('0x25')],[db[_0x8549('0x1d')]['fn']('AVG',db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')](_0x8549('0x26')))),_0x8549('0x27')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x28'),db['sequelize']['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x8549('0x29')]]})[_0x8549('0xb')](function(_0x1507aa){logger[_0x8549('0xc')](_0x8549('0x1a'),_0x3d7bf1);logger[_0x8549('0xf')]('AvgHandleTime',_0x3d7bf1,JSON['stringify'](_0x1507aa));_0x4ae3df(_0x1507aa);})[_0x8549('0x16')](function(_0x4e069e){logger[_0x8549('0x12')](_0x8549('0x1a'),_0x4e069e[_0x8549('0x14')],_0x3d7bf1);_0x151a3f(_0x56831f[_0x8549('0x12')](0x1f4,_0x4e069e[_0x8549('0x14')]));});});};exports[_0x8549('0x2a')]=function(_0x4c88e7){var _0x2fa576=this;return new Promise(function(_0x361542,_0x12620a){return db[_0x8549('0x1b')][_0x8549('0x1c')]({'raw':_0x4c88e7['options']?_0x4c88e7[_0x8549('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4c88e7['options']?_0x4c88e7[_0x8549('0x19')][_0x8549('0x2b')]||null:null,'attributes':[[_0x8549('0x2c'),_0x8549('0x2d')],[db['sequelize']['fn'](_0x8549('0x20'),db['sequelize']['fn']('IF',db[_0x8549('0x1d')]['literal'](_0x8549('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')](_0x8549('0x2f')))),_0x8549('0x30')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8549('0x21')](_0x8549('0x31')))),'outboundAnswerCallsDay'],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0x8549('0x32')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db['sequelize'][_0x8549('0x21')](_0x8549('0x33')))),_0x8549('0x34')],[db['sequelize']['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')]['literal'](_0x8549('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x8549('0x1d')]['fn']('COUNT',db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')](_0x8549('0x36')))),_0x8549('0x37')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db['sequelize'][_0x8549('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0x8549('0x38')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0x8549('0x39')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8549('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')]['literal'](_0x8549('0x3a')))),_0x8549('0x3b')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8549('0x21')](_0x8549('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8549('0x21')](_0x8549('0x3d')))),_0x8549('0x3b')],[db['sequelize']['fn'](_0x8549('0x20'),db[_0x8549('0x1d')]['fn']('IF',db[_0x8549('0x1d')][_0x8549('0x21')](_0x8549('0x3e')))),_0x8549('0x3f')]],'group':['campaign']})[_0x8549('0xb')](function(_0x3bfffc){logger[_0x8549('0xc')](_0x8549('0x2a'),_0x4c88e7);logger[_0x8549('0xf')](_0x8549('0x2a'),_0x4c88e7,JSON[_0x8549('0x11')](_0x3bfffc));_0x361542(_0x3bfffc);})[_0x8549('0x16')](function(_0x5369ac){logger[_0x8549('0x12')](_0x8549('0x2a'),_0x5369ac[_0x8549('0x14')],_0x4c88e7);_0x12620a(_0x2fa576[_0x8549('0x12')](0x1f4,_0x5369ac['message']));});});};exports[_0x8549('0x40')]=function(_0x2baf5f){var _0x141009=this;return new Promise(function(_0x43c6de,_0x510f2f){return db[_0x8549('0x1b')][_0x8549('0x1c')]({'raw':_0x2baf5f[_0x8549('0x19')]?_0x2baf5f[_0x8549('0x19')][_0x8549('0x41')]===undefined?!![]:![]:!![],'where':_0x2baf5f[_0x8549('0x19')]?_0x2baf5f[_0x8549('0x19')][_0x8549('0x2b')]||null:null,'attributes':[['campaign',_0x8549('0x2d')],[db['sequelize']['fn'](_0x8549('0x20'),db[_0x8549('0x1d')][_0x8549('0x1e')]('id')),_0x8549('0x42')],[db[_0x8549('0x1d')]['fn'](_0x8549('0x20'),db['sequelize']['fn']('IF',db[_0x8549('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x8549('0x43')]],'group':[_0x8549('0x2c')]})[_0x8549('0xb')](function(_0x19e099){logger[_0x8549('0xc')](_0x8549('0x40'),_0x2baf5f);logger[_0x8549('0xf')](_0x8549('0x40'),_0x2baf5f,JSON[_0x8549('0x11')](_0x19e099));_0x43c6de(_0x19e099);})['catch'](function(_0x20630){logger['error'](_0x8549('0x40'),_0x20630[_0x8549('0x14')],_0x2baf5f);_0x510f2f(_0x141009['error'](0x1f4,_0x20630['message']));});});}; \ No newline at end of file +var _0x27f5=['then','CreateCmHopperHistory','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopperHistory','create','options'];(function(_0x146001,_0x5ad5c5){var _0x27d61e=function(_0x3fb042){while(--_0x3fb042){_0x146001['push'](_0x146001['shift']());}};_0x27d61e(++_0x5ad5c5);}(_0x27f5,0x6b));var _0x527f=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x27f5[_0x57408b];return _0x31a897;};'use strict';var _=require(_0x527f('0x0'));var util=require(_0x527f('0x1'));var moment=require(_0x527f('0x2'));var BPromise=require('bluebird');var rs=require(_0x527f('0x3'));var fs=require('fs');var Redis=require(_0x527f('0x4'));var db=require(_0x527f('0x5'))['db'];var utils=require(_0x527f('0x6'));var logger=require(_0x527f('0x7'))(_0x527f('0x8'));var config=require(_0x527f('0x9'));var jayson=require(_0x527f('0xa'));var client=jayson['client'][_0x527f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f8c8d,_0xfed1b0,_0x29b02c){return new BPromise(function(_0x5cabfb,_0x3c3813){return client[_0x527f('0xc')](_0x4f8c8d,_0x29b02c)['then'](function(_0x392514){logger[_0x527f('0xd')](_0x527f('0xe'),_0xfed1b0,_0x527f('0xf'));logger[_0x527f('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xfed1b0,_0x527f('0xf'),JSON[_0x527f('0x11')](_0x392514));if(_0x392514[_0x527f('0x12')]){if(_0x392514[_0x527f('0x12')]['code']===0x1f4){logger[_0x527f('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0xfed1b0,_0x392514[_0x527f('0x12')][_0x527f('0x13')]);return _0x3c3813(_0x392514['error'][_0x527f('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xfed1b0,_0x392514['error'][_0x527f('0x13')]);return _0x5cabfb(_0x392514[_0x527f('0x12')]['message']);}else{logger[_0x527f('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0xfed1b0,_0x527f('0xf'));_0x5cabfb(_0x392514[_0x527f('0x14')][_0x527f('0x13')]);}})[_0x527f('0x15')](function(_0x526dbf){logger['error'](_0x527f('0xe'),_0xfed1b0,_0x526dbf);_0x3c3813(_0x526dbf);});});}exports['CreateCmHopperHistory']=function(_0x2a5676){var _0xf17194=this;return new Promise(function(_0x2a3cc1,_0x36d4a8){return db[_0x527f('0x16')][_0x527f('0x17')](_0x2a5676['body'],{'raw':_0x2a5676[_0x527f('0x18')]?_0x2a5676[_0x527f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x527f('0x19')](function(_0x297d38){logger[_0x527f('0xd')](_0x527f('0x1a'),_0x2a5676);logger[_0x527f('0x10')](_0x527f('0x1a'),_0x2a5676,JSON[_0x527f('0x11')](_0x297d38));_0x2a3cc1(_0x297d38);})[_0x527f('0x15')](function(_0x31f2cb){logger[_0x527f('0x12')](_0x527f('0x1a'),_0x31f2cb[_0x527f('0x13')],_0x2a5676);_0x36d4a8(_0xf17194['error'](0x1f4,_0x31f2cb[_0x527f('0x13')]));});});};exports['AvgHandleTime']=function(_0x3c6dd6){var _0x225218=this;return new Promise(function(_0x530b6a,_0xec45b5){return db[_0x527f('0x16')][_0x527f('0x1b')]({'raw':_0x3c6dd6[_0x527f('0x18')]?_0x3c6dd6[_0x527f('0x18')][_0x527f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c6dd6[_0x527f('0x18')]?_0x3c6dd6[_0x527f('0x18')][_0x527f('0x1d')]||null:null,'attributes':[[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')][_0x527f('0x20')]('id')),_0x527f('0x21')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x23')))),_0x527f('0x24')],[db['sequelize']['fn'](_0x527f('0x1f'),db['sequelize']['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x527f('0x1e')]['fn']('AVG',db[_0x527f('0x1e')]['fn']('IF',db['sequelize'][_0x527f('0x22')](_0x527f('0x26')))),_0x527f('0x27')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x28'),db['sequelize']['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x527f('0x29')]]})['then'](function(_0x5db43d){logger['info']('AvgHandleTime',_0x3c6dd6);logger['debug'](_0x527f('0x2a'),_0x3c6dd6,JSON[_0x527f('0x11')](_0x5db43d));_0x530b6a(_0x5db43d);})[_0x527f('0x15')](function(_0x49f511){logger['error'](_0x527f('0x2a'),_0x49f511[_0x527f('0x13')],_0x3c6dd6);_0xec45b5(_0x225218['error'](0x1f4,_0x49f511[_0x527f('0x13')]));});});};exports[_0x527f('0x2b')]=function(_0x3a5bd2){var _0x2b70d2=this;return new Promise(function(_0x5e2f92,_0x479cb6){return db[_0x527f('0x16')][_0x527f('0x1b')]({'raw':_0x3a5bd2[_0x527f('0x18')]?_0x3a5bd2[_0x527f('0x18')][_0x527f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5bd2[_0x527f('0x18')]?_0x3a5bd2['options']['where']||null:null,'attributes':[[_0x527f('0x2c'),_0x527f('0x2d')],[db[_0x527f('0x1e')]['fn']('COUNT',db[_0x527f('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x527f('0x2e')],[db[_0x527f('0x1e')]['fn']('COUNT',db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x527f('0x22')](_0x527f('0x23')))),_0x527f('0x2f')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x527f('0x22')](_0x527f('0x30')))),_0x527f('0x31')],[db['sequelize']['fn']('COUNT',db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x32')))),_0x527f('0x33')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x34')))),_0x527f('0x35')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')]['literal'](_0x527f('0x36')))),_0x527f('0x37')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x38')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')]['literal'](_0x527f('0x39')))),'outboundBlacklistCallsDay'],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x3a')))),_0x527f('0x3b')],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db['sequelize']['fn']('IF',db[_0x527f('0x1e')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x527f('0x3c')],[db[_0x527f('0x1e')]['fn']('COUNT',db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x3e')))),'outboundRejectCallsDay'],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')][_0x527f('0x22')](_0x527f('0x3f')))),'outboundReCallsDay']],'group':[_0x527f('0x2c')]})[_0x527f('0x19')](function(_0x4fddf9){logger[_0x527f('0xd')]('GetVoiceQueueHopperHistory',_0x3a5bd2);logger[_0x527f('0x10')](_0x527f('0x2b'),_0x3a5bd2,JSON['stringify'](_0x4fddf9));_0x5e2f92(_0x4fddf9);})['catch'](function(_0x3528c3){logger[_0x527f('0x12')](_0x527f('0x2b'),_0x3528c3[_0x527f('0x13')],_0x3a5bd2);_0x479cb6(_0x2b70d2[_0x527f('0x12')](0x1f4,_0x3528c3['message']));});});};exports[_0x527f('0x40')]=function(_0x187831){var _0x23c443=this;return new Promise(function(_0x568032,_0x276b73){return db[_0x527f('0x16')][_0x527f('0x1b')]({'raw':_0x187831[_0x527f('0x18')]?_0x187831['options'][_0x527f('0x1c')]===undefined?!![]:![]:!![],'where':_0x187831[_0x527f('0x18')]?_0x187831[_0x527f('0x18')][_0x527f('0x1d')]||null:null,'attributes':[[_0x527f('0x2c'),_0x527f('0x2d')],[db[_0x527f('0x1e')]['fn']('COUNT',db[_0x527f('0x1e')][_0x527f('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x527f('0x1e')]['fn'](_0x527f('0x1f'),db[_0x527f('0x1e')]['fn']('IF',db[_0x527f('0x1e')]['literal'](_0x527f('0x23')))),_0x527f('0x41')]],'group':[_0x527f('0x2c')]})['then'](function(_0x105d43){logger[_0x527f('0xd')](_0x527f('0x40'),_0x187831);logger['debug'](_0x527f('0x40'),_0x187831,JSON['stringify'](_0x105d43));_0x568032(_0x105d43);})[_0x527f('0x15')](function(_0x142628){logger['error'](_0x527f('0x40'),_0x142628[_0x527f('0x13')],_0x187831);_0x276b73(_0x23c443[_0x527f('0x12')](0x1f4,_0x142628[_0x527f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a3b66c7..5e17d5b 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 _0xb190=['Router','../../components/interaction/service','isAuthenticated','index','get','show','post','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xb190,0xce));var _0x0b19=function(_0x250670,_0x3415af){_0x250670=_0x250670-0x0;var _0x596cb0=_0xb190[_0x250670];return _0x596cb0;};'use strict';var multer=require(_0x0b19('0x0'));var util=require(_0x0b19('0x1'));var path=require(_0x0b19('0x2'));var timeout=require(_0x0b19('0x3'));var express=require('express');var router=express[_0x0b19('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b19('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x0b19('0x6')](),controller[_0x0b19('0x7')]);router[_0x0b19('0x8')]('/describe',auth[_0x0b19('0x6')](),controller['describe']);router['get']('/:id',auth[_0x0b19('0x6')](),controller[_0x0b19('0x9')]);router[_0x0b19('0xa')]('/',auth[_0x0b19('0x6')](),controller[_0x0b19('0xb')]);router[_0x0b19('0xc')]('/:id',auth[_0x0b19('0x6')](),controller[_0x0b19('0xd')]);module[_0x0b19('0xe')]=router; \ No newline at end of file +var _0xe987=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xe987,0x109));var _0x7e98=function(_0x5ebec4,_0x474731){_0x5ebec4=_0x5ebec4-0x0;var _0x3b9d3b=_0xe987[_0x5ebec4];return _0x3b9d3b;};'use strict';var multer=require(_0x7e98('0x0'));var util=require(_0x7e98('0x1'));var path=require('path');var timeout=require(_0x7e98('0x2'));var express=require(_0x7e98('0x3'));var router=express[_0x7e98('0x4')]();var auth=require(_0x7e98('0x5'));var interaction=require(_0x7e98('0x6'));var config=require(_0x7e98('0x7'));var controller=require(_0x7e98('0x8'));router[_0x7e98('0x9')]('/',auth[_0x7e98('0xa')](),controller[_0x7e98('0xb')]);router[_0x7e98('0x9')]('/describe',auth[_0x7e98('0xa')](),controller['describe']);router[_0x7e98('0x9')](_0x7e98('0xc'),auth[_0x7e98('0xa')](),controller[_0x7e98('0xd')]);router[_0x7e98('0xe')]('/',auth[_0x7e98('0xa')](),controller[_0x7e98('0xf')]);router[_0x7e98('0x10')]('/:id',auth[_0x7e98('0xa')](),controller[_0x7e98('0x11')]);module[_0x7e98('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1aa5ee3..f760838 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 _0xfb86=['STRING','sequelize','exports','name'];(function(_0x5c04ba,_0x289e32){var _0x1cf0e7=function(_0x494d00){while(--_0x494d00){_0x5c04ba['push'](_0x5c04ba['shift']());}};_0x1cf0e7(++_0x289e32);}(_0xfb86,0x95));var _0x6fb8=function(_0xe200a7,_0x47fcbd){_0xe200a7=_0xe200a7-0x0;var _0x4cd90f=_0xfb86[_0xe200a7];return _0x4cd90f;};'use strict';var Sequelize=require(_0x6fb8('0x0'));module[_0x6fb8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6fb8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x6fb8('0x3')]}}; \ No newline at end of file +var _0x95b2=['STRING','sequelize','exports'];(function(_0x3d2664,_0x416ff7){var _0x4bdabe=function(_0x1a0b8f){while(--_0x1a0b8f){_0x3d2664['push'](_0x3d2664['shift']());}};_0x4bdabe(++_0x416ff7);}(_0x95b2,0x70));var _0x295b=function(_0x320f06,_0x382987){_0x320f06=_0x320f06-0x0;var _0x282fa8=_0x95b2[_0x320f06];return _0x282fa8;};'use strict';var Sequelize=require(_0x295b('0x0'));module[_0x295b('0x1')]={'name':{'type':Sequelize[_0x295b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x295b('0x2')]},'dialPrefix':{'type':Sequelize[_0x295b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b7c9176..33d4c0f 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 _0x7116=['cf_%d','raw','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','userCmList:save','userCmList:remove','emit','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','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','./cmList.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','update','destroy','get','Lists','UserProfileResource','then','error','stack','name','send','index','map','CmList','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','describe','addDisposition','params','ListId','Disposition','getDispositions','findOne','removeDispositions','CmContact','tags','isArray','push','each','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format'];(function(_0x156e60,_0x18ef4b){var _0xe8a8e3=function(_0x3960ea){while(--_0x3960ea){_0x156e60['push'](_0x156e60['shift']());}};_0xe8a8e3(++_0x18ef4b);}(_0x7116,0xb1));var _0x6711=function(_0x54bcb5,_0x1f7f3a){_0x54bcb5=_0x54bcb5-0x0;var _0x45cc8d=_0x7116[_0x54bcb5];return _0x45cc8d;};'use strict';var pdf=require(_0x6711('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6711('0x1'));var zipdir=require(_0x6711('0x2'));var jsonpatch=require(_0x6711('0x3'));var rp=require(_0x6711('0x4'));var moment=require(_0x6711('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6711('0x6'));var util=require(_0x6711('0x7'));var path=require(_0x6711('0x8'));var sox=require(_0x6711('0x9'));var csv=require(_0x6711('0xa'));var ejs=require(_0x6711('0xb'));var fs=require('fs');var _=require(_0x6711('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6711('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6711('0xe'));var Papa=require('papaparse');var Redis=require(_0x6711('0xf'));var authService=require(_0x6711('0x10'));var qs=require(_0x6711('0x11'));var as=require(_0x6711('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6711('0x13'))(_0x6711('0x14'));var utils=require(_0x6711('0x15'));var config=require(_0x6711('0x16'));var licenseUtil=require(_0x6711('0x17'));var db=require('../../mysqldb')['db'];config[_0x6711('0x18')]=_[_0x6711('0x19')](config[_0x6711('0x18')],{'host':_0x6711('0x1a'),'port':0x18eb});var socket=require(_0x6711('0x1b'))(new Redis(config[_0x6711('0x18')]));require(_0x6711('0x1c'))[_0x6711('0x1d')](socket);function respondWithStatusCode(_0x22c3f9,_0x3ef915){_0x3ef915=_0x3ef915||0xcc;return function(_0x33091d){if(_0x33091d){return _0x22c3f9[_0x6711('0x1e')](_0x3ef915);}return _0x22c3f9['status'](_0x3ef915)[_0x6711('0x1f')]();};}function respondWithResult(_0x46c64d,_0x162f46){_0x162f46=_0x162f46||0xc8;return function(_0x140613){if(_0x140613){return _0x46c64d[_0x6711('0x20')](_0x162f46)[_0x6711('0x21')](_0x140613);}};}function respondWithFilteredResult(_0x9cb722,_0x1a0b85){return function(_0x512ba9){if(_0x512ba9){var _0x276803=_0x512ba9[_0x6711('0x22')],_0x221fa4=_0x1a0b85[_0x6711('0x23')],_0x29f660=_0x1a0b85[_0x6711('0x23')]+_0x1a0b85['limit'],_0x5ded5c;if(_0x29f660>=_0x276803){_0x29f660=_0x276803;_0x5ded5c=0xc8;}else{_0x5ded5c=0xce;}_0x9cb722[_0x6711('0x20')](_0x5ded5c);return _0x9cb722[_0x6711('0x24')](_0x6711('0x25'),_0x221fa4+'-'+_0x29f660+'/'+_0x276803)[_0x6711('0x21')](_0x512ba9);}return null;};}function patchUpdates(_0x42df9c){return function(_0x4f69cc){try{jsonpatch['apply'](_0x4f69cc,_0x42df9c,!![]);}catch(_0x4d2327){return BPromise['reject'](_0x4d2327);}return _0x4f69cc['save']();};}function saveUpdates(_0x39bda4,_0x37aeaf){return function(_0x38d6d){if(_0x38d6d){return _0x38d6d[_0x6711('0x26')](_0x39bda4)['then'](function(_0x38e5c2){return _0x38e5c2;});}return null;};}function removeEntity(_0x5067d6,_0x29f0c0){return function(_0x30d0bb){if(_0x30d0bb){return _0x30d0bb[_0x6711('0x27')]()['then'](function(){var _0x50d64f=_0x30d0bb[_0x6711('0x28')]({'plain':!![]});var _0x502c27=_0x6711('0x29');return db[_0x6711('0x2a')][_0x6711('0x27')]({'where':{'type':_0x502c27,'resourceId':_0x50d64f['id']}})[_0x6711('0x2b')](function(){return _0x30d0bb;});})[_0x6711('0x2b')](function(){_0x5067d6[_0x6711('0x20')](0xcc)[_0x6711('0x1f')]();});}};}function handleEntityNotFound(_0x35dba9,_0x22ea46){return function(_0x324188){if(!_0x324188){_0x35dba9['sendStatus'](0x194);}return _0x324188;};}function handleError(_0xf0d283,_0x11f157){_0x11f157=_0x11f157||0x1f4;return function(_0x168ad9){logger[_0x6711('0x2c')](_0x168ad9[_0x6711('0x2d')]);if(_0x168ad9[_0x6711('0x2e')]){delete _0x168ad9['name'];}_0xf0d283['status'](_0x11f157)[_0x6711('0x2f')](_0x168ad9);};}exports[_0x6711('0x30')]=function(_0xb267c5,_0x3e8222){var _0x3ab11f={},_0x1b1243={},_0x54ea32={'count':0x0,'rows':[]};var _0x5682a9=_[_0x6711('0x31')](db[_0x6711('0x32')]['rawAttributes'],function(_0x439567){return{'name':_0x439567[_0x6711('0x33')],'type':_0x439567[_0x6711('0x34')]['key']};});_0x1b1243[_0x6711('0x35')]=_[_0x6711('0x31')](_0x5682a9,_0x6711('0x2e'));_0x1b1243[_0x6711('0x36')]=_[_0x6711('0x37')](_0xb267c5[_0x6711('0x36')]);_0x1b1243[_0x6711('0x38')]=_[_0x6711('0x39')](_0x1b1243['model'],_0x1b1243[_0x6711('0x36')]);_0x3ab11f[_0x6711('0x3a')]=_[_0x6711('0x39')](_0x1b1243[_0x6711('0x35')],qs[_0x6711('0x3b')](_0xb267c5[_0x6711('0x36')][_0x6711('0x3b')]));_0x3ab11f[_0x6711('0x3a')]=_0x3ab11f[_0x6711('0x3a')][_0x6711('0x3c')]?_0x3ab11f[_0x6711('0x3a')]:_0x1b1243[_0x6711('0x35')];if(!_0xb267c5['query'][_0x6711('0x3d')](_0x6711('0x3e'))){_0x3ab11f[_0x6711('0x3f')]=qs[_0x6711('0x3f')](_0xb267c5[_0x6711('0x36')]['limit']);_0x3ab11f[_0x6711('0x23')]=qs[_0x6711('0x23')](_0xb267c5[_0x6711('0x36')][_0x6711('0x23')]);}_0x3ab11f[_0x6711('0x40')]=qs[_0x6711('0x41')](_0xb267c5['query'][_0x6711('0x41')]);_0x3ab11f[_0x6711('0x42')]=qs[_0x6711('0x38')](_[_0x6711('0x43')](_0xb267c5[_0x6711('0x36')],_0x1b1243[_0x6711('0x38')]),_0x5682a9);if(_0xb267c5[_0x6711('0x36')][_0x6711('0x44')]){_0x3ab11f[_0x6711('0x42')]=_[_0x6711('0x45')](_0x3ab11f[_0x6711('0x42')],{'$or':_['map'](_0x5682a9,function(_0x9b26a8){if(_0x9b26a8[_0x6711('0x34')]!==_0x6711('0x46')){var _0x521bc6={};_0x521bc6[_0x9b26a8['name']]={'$like':'%'+_0xb267c5[_0x6711('0x36')][_0x6711('0x44')]+'%'};return _0x521bc6;}})});}_0x3ab11f=_[_0x6711('0x45')]({},_0x3ab11f,_0xb267c5[_0x6711('0x47')]);var _0x1a5099={'where':_0x3ab11f[_0x6711('0x42')]};return db[_0x6711('0x32')]['count'](_0x1a5099)['then'](function(_0x13497a){_0x54ea32[_0x6711('0x22')]=_0x13497a;if(_0xb267c5[_0x6711('0x36')][_0x6711('0x48')]){_0x3ab11f['include']=[{'all':!![]}];}return db[_0x6711('0x32')][_0x6711('0x49')](_0x3ab11f);})[_0x6711('0x2b')](function(_0x371db5){_0x54ea32[_0x6711('0x4a')]=_0x371db5;return _0x54ea32;})[_0x6711('0x2b')](respondWithFilteredResult(_0x3e8222,_0x3ab11f))['catch'](handleError(_0x3e8222,null));};exports[_0x6711('0x4b')]=function(_0x47f767,_0x3dfa69){var _0x209bbe={'raw':![],'where':{'id':_0x47f767['params']['id']}},_0x3ef31d={};_0x3ef31d['model']=_[_0x6711('0x37')](db[_0x6711('0x32')][_0x6711('0x4c')]);_0x3ef31d[_0x6711('0x36')]=_[_0x6711('0x37')](_0x47f767[_0x6711('0x36')]);_0x3ef31d[_0x6711('0x38')]=_[_0x6711('0x39')](_0x3ef31d[_0x6711('0x35')],_0x3ef31d[_0x6711('0x36')]);_0x209bbe[_0x6711('0x3a')]=_[_0x6711('0x39')](_0x3ef31d[_0x6711('0x35')],qs[_0x6711('0x3b')](_0x47f767['query'][_0x6711('0x3b')]));_0x209bbe[_0x6711('0x3a')]=_0x209bbe[_0x6711('0x3a')]['length']?_0x209bbe['attributes']:_0x3ef31d[_0x6711('0x35')];if(_0x47f767[_0x6711('0x36')][_0x6711('0x48')]){_0x209bbe['include']=[{'all':!![]}];}_0x209bbe=_[_0x6711('0x45')]({},_0x209bbe,_0x47f767[_0x6711('0x47')]);return db['CmList'][_0x6711('0x4d')](_0x209bbe)[_0x6711('0x2b')](handleEntityNotFound(_0x3dfa69,null))[_0x6711('0x2b')](respondWithResult(_0x3dfa69,null))['catch'](handleError(_0x3dfa69,null));};exports[_0x6711('0x4e')]=function(_0x574402,_0x462f85){return db['CmList'][_0x6711('0x4e')](_0x574402[_0x6711('0x4f')],{})['then'](function(_0x33c841){var _0x1b5fdf=_0x574402[_0x6711('0x50')][_0x6711('0x28')]({'plain':!![]});if(!_0x1b5fdf)throw new Error(_0x6711('0x51'));if(_0x1b5fdf[_0x6711('0x52')]===_0x6711('0x50')){var _0xbfd66c=_0x33c841[_0x6711('0x28')]({'plain':!![]});var _0x2c0279=_0x6711('0x29');return db[_0x6711('0x53')]['find']({'where':{'name':_0x2c0279,'userProfileId':_0x1b5fdf[_0x6711('0x54')]},'raw':!![]})[_0x6711('0x2b')](function(_0x46aed7){if(_0x46aed7&&_0x46aed7['autoAssociation']===0x0){return db[_0x6711('0x2a')][_0x6711('0x4e')]({'name':_0xbfd66c[_0x6711('0x2e')],'resourceId':_0xbfd66c['id'],'type':_0x46aed7[_0x6711('0x2e')],'sectionId':_0x46aed7['id']},{})[_0x6711('0x2b')](function(){return _0x33c841;});}else{return _0x33c841;}})[_0x6711('0x55')](function(_0x2fa14b){logger[_0x6711('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fa14b);throw _0x2fa14b;});}return _0x33c841;})[_0x6711('0x2b')](respondWithResult(_0x462f85,0xc9))['catch'](handleError(_0x462f85,null));};exports[_0x6711('0x26')]=function(_0x640b1,_0x4680a7){if(_0x640b1[_0x6711('0x4f')]['id']){delete _0x640b1[_0x6711('0x4f')]['id'];}return db[_0x6711('0x32')][_0x6711('0x4d')]({'where':{'id':_0x640b1['params']['id']}})['then'](handleEntityNotFound(_0x4680a7,null))[_0x6711('0x2b')](saveUpdates(_0x640b1[_0x6711('0x4f')],null))[_0x6711('0x2b')](respondWithResult(_0x4680a7,null))[_0x6711('0x55')](handleError(_0x4680a7,null));};exports[_0x6711('0x27')]=function(_0x59a860,_0x59b4ab){return db[_0x6711('0x32')][_0x6711('0x4d')]({'where':{'id':_0x59a860['params']['id']}})[_0x6711('0x2b')](handleEntityNotFound(_0x59b4ab,null))[_0x6711('0x2b')](removeEntity(_0x59b4ab,null))[_0x6711('0x55')](handleError(_0x59b4ab,null));};exports[_0x6711('0x56')]=function(_0x3eef33,_0x16b3dc){return db[_0x6711('0x32')]['describe']()['then'](respondWithResult(_0x16b3dc,null))['catch'](handleError(_0x16b3dc,null));};exports[_0x6711('0x57')]=function(_0x3df931,_0x5578b1,_0x5d21c4){if(_0x3df931['body']['id']){delete _0x3df931[_0x6711('0x4f')]['id'];}return db['CmList'][_0x6711('0x4d')]({'where':{'id':_0x3df931[_0x6711('0x58')]['id']}})['then'](handleEntityNotFound(_0x5578b1,null))[_0x6711('0x2b')](function(_0x15c9ad){if(_0x15c9ad){_0x3df931['body'][_0x6711('0x59')]=_0x15c9ad['id'];return db[_0x6711('0x5a')]['create'](_0x3df931[_0x6711('0x4f')]);}})[_0x6711('0x2b')](respondWithResult(_0x5578b1,null))[_0x6711('0x55')](handleError(_0x5578b1,null));};exports[_0x6711('0x5b')]=function(_0x1e83ee,_0x13e0ac,_0x26b268){var _0x5b8a6e={'raw':![],'where':{}};var _0x472592={};var _0x1e9757={'count':0x0,'rows':[]};return db[_0x6711('0x32')][_0x6711('0x5c')]({'where':{'id':_0x1e83ee['params']['id']}})[_0x6711('0x2b')](handleEntityNotFound(_0x13e0ac,null))['then'](function(_0x25ad93){if(_0x25ad93){_0x472592['model']=_[_0x6711('0x37')](db[_0x6711('0x5a')][_0x6711('0x4c')]);_0x472592[_0x6711('0x36')]=_[_0x6711('0x37')](_0x1e83ee[_0x6711('0x36')]);_0x472592[_0x6711('0x38')]=_['intersection'](_0x472592[_0x6711('0x35')],_0x472592[_0x6711('0x36')]);_0x5b8a6e[_0x6711('0x3a')]=_[_0x6711('0x39')](_0x472592[_0x6711('0x35')],qs[_0x6711('0x3b')](_0x1e83ee['query'][_0x6711('0x3b')]));_0x5b8a6e['attributes']=_0x5b8a6e[_0x6711('0x3a')][_0x6711('0x3c')]?_0x5b8a6e[_0x6711('0x3a')]:_0x472592[_0x6711('0x35')];if(!_0x1e83ee[_0x6711('0x36')][_0x6711('0x3d')](_0x6711('0x3e'))){_0x5b8a6e[_0x6711('0x3f')]=qs['limit'](_0x1e83ee['query'][_0x6711('0x3f')]);_0x5b8a6e[_0x6711('0x23')]=qs[_0x6711('0x23')](_0x1e83ee[_0x6711('0x36')][_0x6711('0x23')]);}_0x5b8a6e[_0x6711('0x40')]=qs[_0x6711('0x41')](_0x1e83ee['query'][_0x6711('0x41')]);_0x5b8a6e[_0x6711('0x42')]=qs['filters'](_[_0x6711('0x43')](_0x1e83ee['query'],_0x472592[_0x6711('0x38')]));_0x5b8a6e['where'][_0x6711('0x59')]=_0x25ad93['id'];if(_0x1e83ee[_0x6711('0x36')][_0x6711('0x44')]){_0x5b8a6e[_0x6711('0x42')]=_[_0x6711('0x45')](_0x5b8a6e[_0x6711('0x42')],{'$or':_['map'](_0x5b8a6e[_0x6711('0x3a')],function(_0x49083a){var _0x2d6439={};_0x2d6439[_0x49083a]={'$like':'%'+_0x1e83ee['query'][_0x6711('0x44')]+'%'};return _0x2d6439;})});}_0x5b8a6e=_[_0x6711('0x45')]({},_0x5b8a6e,_0x1e83ee[_0x6711('0x47')]);return db[_0x6711('0x5a')][_0x6711('0x22')]({'where':_0x5b8a6e[_0x6711('0x42')]})[_0x6711('0x2b')](function(_0x360964){_0x1e9757['count']=_0x360964;if(_0x1e83ee['query']['includeAll']){_0x5b8a6e['include']=[{'all':!![]}];}return db[_0x6711('0x5a')][_0x6711('0x49')](_0x5b8a6e);})[_0x6711('0x2b')](function(_0x1d4e2b){_0x1e9757[_0x6711('0x4a')]=_0x1d4e2b;return _0x1e9757;});}})[_0x6711('0x2b')](respondWithFilteredResult(_0x13e0ac,_0x5b8a6e))['catch'](handleError(_0x13e0ac,null));};exports[_0x6711('0x5d')]=function(_0x530529,_0xcb4bde,_0x5ade93){return db['CmList'][_0x6711('0x4d')]({'where':{'id':_0x530529[_0x6711('0x58')]['id']}})['then'](handleEntityNotFound(_0xcb4bde,null))[_0x6711('0x2b')](function(_0x115bda){if(_0x115bda){return _0x115bda[_0x6711('0x5d')](_0x530529[_0x6711('0x36')]['ids']);}})[_0x6711('0x2b')](respondWithStatusCode(_0xcb4bde,null))[_0x6711('0x55')](handleError(_0xcb4bde,null));};exports['addContacts']=function(_0x361671,_0x175680,_0x82ed69){return db['CmList'][_0x6711('0x4d')]({'where':{'id':_0x361671['params']['id']}})['then'](handleEntityNotFound(_0x175680,null))[_0x6711('0x2b')](function(_0x18a7ea){if(_0x18a7ea){var _0x5c0574=[];var _0x58c943={'success':[],'errors':[]};return db[_0x6711('0x5e')][_0x6711('0x56')]()[_0x6711('0x2b')](function(_0x2e3394){if(_0x361671[_0x6711('0x4f')][_0x6711('0x5f')]&&_[_0x6711('0x60')](_0x361671[_0x6711('0x4f')][_0x6711('0x5f')])){if(_0x361671['body'][_0x6711('0x5f')]['length']){_0x361671['body']['tags']=_0x361671[_0x6711('0x4f')]['tags']['join'](';')+';';}else{_0x361671['body'][_0x6711('0x5f')]=null;}}else{_0x361671[_0x6711('0x4f')][_0x6711('0x5f')]=null;}if(_0x361671[_0x6711('0x4f')]&&_['isArray'](_0x361671[_0x6711('0x4f')])){for(var _0x3deb7d=0x0;_0x3deb7d<_0x361671[_0x6711('0x4f')][_0x6711('0x3c')];_0x3deb7d+=0x1){_0x361671[_0x6711('0x4f')][_0x3deb7d][_0x6711('0x59')]=_0x361671[_0x6711('0x58')]['id'];_0x5c0574[_0x6711('0x61')](_0x361671['body'][_0x3deb7d]);}return BPromise[_0x6711('0x62')](_0x5c0574,function(_0x319654){return db[_0x6711('0x5e')][_0x6711('0x4e')](_[_0x6711('0x63')](_0x319654,[_0x6711('0x64'),'id'])||{},{'fields':_[_0x6711('0x37')](_0x2e3394),'raw':!![]})['then'](function(_0x59c3c8){_0x58c943[_0x6711('0x65')][_0x6711('0x61')](_0x59c3c8[_0x6711('0x66')]);})['catch'](function(_0xebc46b){_0x58c943['errors'][_0x6711('0x61')]({'data':_0x319654,'error':_0xebc46b[_0x6711('0x67')]});});})['then'](function(_0x5c5852){return _0x58c943;})[_0x6711('0x55')](function(_0x3435fe){return _0x3435fe;});}else{_0x175680[_0x6711('0x20')](0x190)[_0x6711('0x21')]({'message':_0x6711('0x68')});}});}})['then'](respondWithResult(_0x175680,null))[_0x6711('0x55')](handleError(_0x175680,null));};exports['getContacts']=function(_0x549351,_0x597400,_0x4f8dc5){var _0x53526a;return db['CmList'][_0x6711('0x4d')]({'where':{'id':_0x549351[_0x6711('0x58')]['id']},'include':[{'model':db[_0x6711('0x69')],'as':_0x6711('0x6a')}]})[_0x6711('0x2b')](handleEntityNotFound(_0x597400,null))[_0x6711('0x2b')](function(_0x1af385){if(_0x1af385){_0x53526a=_0x1af385;return db['CmContact'][_0x6711('0x4c')];}})['then'](function(_0x2e1952){if(_0x2e1952){var _0x20f8b7={};var _0x22340d={};_0x22340d[_0x6711('0x35')]=_[_0x6711('0x6b')](_[_0x6711('0x37')](_0x2e1952),_['map'](_0x53526a[_0x6711('0x6a')],function(_0x44346c){return util[_0x6711('0x6c')](_0x6711('0x6d'),_0x44346c['id']);}));_0x22340d['query']=_[_0x6711('0x37')](_0x549351['query']);_0x22340d[_0x6711('0x38')]=_['intersection'](_0x22340d[_0x6711('0x35')],_0x22340d['query']);_0x20f8b7[_0x6711('0x3a')]=_[_0x6711('0x39')](_0x22340d[_0x6711('0x35')],qs[_0x6711('0x3b')](_0x549351[_0x6711('0x36')][_0x6711('0x3b')]));_0x20f8b7[_0x6711('0x3a')]=_0x20f8b7[_0x6711('0x3a')]['length']?_0x20f8b7['attributes']:_0x22340d[_0x6711('0x35')];if(!_0x549351[_0x6711('0x36')]['hasOwnProperty'](_0x6711('0x3e'))){_0x20f8b7['limit']=qs[_0x6711('0x3f')](_0x549351[_0x6711('0x36')][_0x6711('0x3f')]);_0x20f8b7[_0x6711('0x23')]=qs['offset'](_0x549351[_0x6711('0x36')][_0x6711('0x23')]);}_0x20f8b7[_0x6711('0x40')]=qs[_0x6711('0x41')](_0x549351[_0x6711('0x36')][_0x6711('0x41')]);_0x20f8b7[_0x6711('0x42')]=qs[_0x6711('0x38')](_[_0x6711('0x43')](_0x549351[_0x6711('0x36')],_0x22340d[_0x6711('0x38')]));_0x20f8b7[_0x6711('0x6e')]=!![];if(_0x549351[_0x6711('0x36')][_0x6711('0x44')]){_0x20f8b7[_0x6711('0x42')]=_[_0x6711('0x45')](_0x20f8b7[_0x6711('0x42')],{'$or':_['map'](_0x20f8b7[_0x6711('0x3a')],function(_0x41e77b){var _0x33ad07={};_0x33ad07[_0x41e77b]={'$like':'%'+_0x549351[_0x6711('0x36')][_0x6711('0x44')]+'%'};return _0x33ad07;})});}_0x20f8b7=_[_0x6711('0x45')]({},_0x20f8b7,_0x549351[_0x6711('0x47')]);return _0x53526a[_0x6711('0x6f')](_0x20f8b7);}})['then'](respondWithResult(_0x597400,null))['catch'](handleError(_0x597400,null));};exports['getContactsCsv']=function(_0x36eb9a,_0x2ad17b,_0x83c1fa){var _0x324379;return db[_0x6711('0x32')][_0x6711('0x4d')]({'where':{'id':_0x36eb9a[_0x6711('0x58')]['id']},'include':[{'model':db[_0x6711('0x69')],'as':_0x6711('0x6a')}]})[_0x6711('0x2b')](handleEntityNotFound(_0x2ad17b,null))[_0x6711('0x2b')](function(_0x33bf1d){if(_0x33bf1d){_0x324379=_0x33bf1d;return db[_0x6711('0x5e')][_0x6711('0x4c')];}})['then'](function(_0x178e9b){if(_0x178e9b){var _0x7eb453={};var _0x51aaca={};_0x51aaca[_0x6711('0x35')]=_[_0x6711('0x6b')](_[_0x6711('0x37')](_0x178e9b),_[_0x6711('0x31')](_0x324379[_0x6711('0x6a')],function(_0x36477a){return util[_0x6711('0x6c')]('cf_%d',_0x36477a['id']);}));_0x51aaca[_0x6711('0x36')]=_[_0x6711('0x37')](_0x36eb9a[_0x6711('0x36')]);_0x51aaca[_0x6711('0x38')]=_[_0x6711('0x39')](_0x51aaca[_0x6711('0x35')],_0x51aaca['query']);_0x7eb453[_0x6711('0x3a')]=_['intersection'](_0x51aaca[_0x6711('0x35')],qs[_0x6711('0x3b')](_0x36eb9a['query'][_0x6711('0x3b')]));_0x7eb453[_0x6711('0x3a')]=_0x7eb453[_0x6711('0x3a')][_0x6711('0x3c')]?_0x7eb453[_0x6711('0x3a')]:_0x51aaca['model'];if(!_0x36eb9a['query']['hasOwnProperty'](_0x6711('0x3e'))){_0x7eb453[_0x6711('0x3f')]=qs[_0x6711('0x3f')](_0x36eb9a[_0x6711('0x36')][_0x6711('0x3f')]);_0x7eb453[_0x6711('0x23')]=qs[_0x6711('0x23')](_0x36eb9a[_0x6711('0x36')][_0x6711('0x23')]);}_0x7eb453[_0x6711('0x40')]=qs[_0x6711('0x41')](_0x36eb9a[_0x6711('0x36')][_0x6711('0x41')]);_0x7eb453[_0x6711('0x42')]=qs[_0x6711('0x38')](_['pick'](_0x36eb9a['query'],_0x51aaca[_0x6711('0x38')]));_0x7eb453[_0x6711('0x6e')]=!![];if(_0x36eb9a[_0x6711('0x36')][_0x6711('0x44')]){_0x7eb453[_0x6711('0x42')]=_['merge'](_0x7eb453[_0x6711('0x42')],{'$or':_[_0x6711('0x31')](_0x7eb453[_0x6711('0x3a')],function(_0x20b3e2){var _0x2c6d92={};_0x2c6d92[_0x20b3e2]={'$like':'%'+_0x36eb9a[_0x6711('0x36')][_0x6711('0x44')]+'%'};return _0x2c6d92;})});}_0x7eb453=_[_0x6711('0x45')]({},_0x7eb453,_0x36eb9a[_0x6711('0x47')]);return _0x324379[_0x6711('0x6f')](_0x7eb453);}})[_0x6711('0x2b')](function(_0x56589b){if(!_[_0x6711('0x70')](_0x56589b)){var _0x544115=toCsv(_0x56589b);var _0x2ece66=Date[_0x6711('0x71')]();fs[_0x6711('0x72')](util[_0x6711('0x6c')](_0x6711('0x73'),_0x324379['id'],_0x2ece66),_0x544115);_0x2ad17b[_0x6711('0x74')](_0x6711('0x75'),_0x6711('0x76')+util['format'](_0x6711('0x77'),_0x324379['id'],_0x2ece66));_0x2ad17b['setHeader'](_0x6711('0x78'),_0x6711('0x79'));return _0x2ad17b['download'](util[_0x6711('0x6c')]('/tmp/list_%d_%s.csv',_0x324379['id'],_0x2ece66));}else{return _0x2ad17b[_0x6711('0x1e')](0xcc);}})['catch'](handleError(_0x2ad17b,null));};exports[_0x6711('0x7a')]=function(_0x1f5c0a,_0x136dd4,_0x1df7f0){var _0x44c0a7;delete _0x1f5c0a[_0x6711('0x4f')]['id'];return db[_0x6711('0x32')]['findOne']({'where':{'id':_0x1f5c0a[_0x6711('0x58')]['id']}})[_0x6711('0x2b')](handleEntityNotFound(_0x136dd4,null))[_0x6711('0x2b')](function(_0x2ad640){if(_0x2ad640){return db[_0x6711('0x7b')][_0x6711('0x7c')](function(_0x844bef){return db[_0x6711('0x69')][_0x6711('0x4e')](_0x1f5c0a['body'],{'transaction':_0x844bef})['then'](function(_0x578796){_0x44c0a7=_0x578796;return _0x2ad640[_0x6711('0x7d')](_0x578796,{'transaction':_0x844bef});})[_0x6711('0x2b')](function(){var _0x82c03e={'type':db['Sequelize'][_0x6711('0x7e')],'transaction':_0x844bef};switch(_0x1f5c0a[_0x6711('0x4f')][_0x6711('0x34')]){case _0x6711('0x7f'):_0x82c03e[_0x6711('0x34')]=db[_0x6711('0x80')]['TEXT'];break;case _0x6711('0x81'):_0x82c03e[_0x6711('0x34')]=db[_0x6711('0x80')][_0x6711('0x82')];break;case _0x6711('0x83'):_0x82c03e[_0x6711('0x34')]=db[_0x6711('0x80')]['BOOLEAN'];_0x82c03e[_0x6711('0x84')]=![];break;default:}return db[_0x6711('0x7b')][_0x6711('0x85')][_0x6711('0x86')](_0x6711('0x87'),util[_0x6711('0x6c')](_0x6711('0x88'),_0x44c0a7['id']),_0x82c03e);})[_0x6711('0x2b')](function(){return _0x44c0a7;});});}})[_0x6711('0x2b')](respondWithResult(_0x136dd4,null))[_0x6711('0x55')](handleError(_0x136dd4,null));};exports[_0x6711('0x89')]=function(_0x241303,_0x351b57,_0x22cbe5){var _0x469954={};var _0x2112e5={};var _0x4b0673;var _0x252d43;return db[_0x6711('0x32')]['findOne']({'where':{'id':_0x241303[_0x6711('0x58')]['id']}})['then'](handleEntityNotFound(_0x351b57,null))[_0x6711('0x2b')](function(_0x3c351a){if(_0x3c351a){_0x4b0673=_0x3c351a;_0x2112e5[_0x6711('0x35')]=_[_0x6711('0x37')](db[_0x6711('0x69')][_0x6711('0x4c')]);_0x2112e5['query']=_[_0x6711('0x37')](_0x241303[_0x6711('0x36')]);_0x2112e5[_0x6711('0x38')]=_[_0x6711('0x39')](_0x2112e5['model'],_0x2112e5['query']);_0x469954[_0x6711('0x3a')]=_[_0x6711('0x39')](_0x2112e5[_0x6711('0x35')],qs['fields'](_0x241303[_0x6711('0x36')]['fields']));_0x469954[_0x6711('0x3a')]=_0x469954['attributes'][_0x6711('0x3c')]?_0x469954[_0x6711('0x3a')]:_0x2112e5[_0x6711('0x35')];_0x469954[_0x6711('0x40')]=qs['sort'](_0x241303[_0x6711('0x36')]['sort']);_0x469954['where']=qs['filters'](_[_0x6711('0x43')](_0x241303[_0x6711('0x36')],_0x2112e5[_0x6711('0x38')]));_0x469954[_0x6711('0x42')]=_[_0x6711('0x45')](_0x469954[_0x6711('0x42')],{'$or':[{'ListId':_0x3c351a['id']},{'ListId':null}]});if(_0x241303[_0x6711('0x36')][_0x6711('0x44')]){_0x469954[_0x6711('0x42')]=_['merge'](_0x469954[_0x6711('0x42')],{'$or':_[_0x6711('0x31')](_0x469954[_0x6711('0x3a')],function(_0x180eeb){var _0x367046={};_0x367046[_0x180eeb]={'$like':'%'+_0x241303[_0x6711('0x36')][_0x6711('0x44')]+'%'};return _0x367046;})});}_0x469954=_['merge']({},_0x469954,_0x241303['options']);return db[_0x6711('0x69')]['findAndCountAll'](_0x469954);}})['then'](respondWithResult(_0x351b57,null))[_0x6711('0x55')](handleError(_0x351b57,null));};exports['addAgents']=function(_0x5c94e5,_0x4aa6a2,_0x27cb71){return db[_0x6711('0x32')]['find']({'where':{'id':_0x5c94e5[_0x6711('0x58')]['id']}})['then'](handleEntityNotFound(_0x4aa6a2,null))[_0x6711('0x2b')](function(_0x955fdb){if(_0x955fdb){return _0x955fdb[_0x6711('0x8a')](_0x5c94e5[_0x6711('0x4f')][_0x6711('0x64')],_[_0x6711('0x63')](_0x5c94e5[_0x6711('0x4f')],[_0x6711('0x64'),'id'])||{})['spread'](function(_0x3561f9){for(var _0x5097b0=0x0;_0x5097b0<_0x5c94e5['body'][_0x6711('0x64')][_0x6711('0x3c')];_0x5097b0+=0x1){socket['emit'](_0x6711('0x8b'),{'UserId':_0x5c94e5[_0x6711('0x4f')][_0x6711('0x64')][_0x5097b0],'CmListId':_0x5c94e5[_0x6711('0x58')]['id']});}return _0x3561f9;});}})[_0x6711('0x2b')](respondWithResult(_0x4aa6a2,null))[_0x6711('0x55')](handleError(_0x4aa6a2,null));};exports['removeAgents']=function(_0x152e71,_0xaafb08,_0x5186eb){return db[_0x6711('0x32')][_0x6711('0x4d')]({'where':{'id':_0x152e71[_0x6711('0x58')]['id']}})[_0x6711('0x2b')](handleEntityNotFound(_0xaafb08,null))['then'](function(_0x1b8fa4){if(_0x1b8fa4){return _0x1b8fa4['removeAgents'](_0x152e71[_0x6711('0x36')]['ids'])[_0x6711('0x2b')](function(){if(_[_0x6711('0x60')](_0x152e71[_0x6711('0x36')][_0x6711('0x64')])){for(var _0x4eff31=0x0;_0x4eff31<_0x152e71['query'][_0x6711('0x64')][_0x6711('0x3c')];_0x4eff31+=0x1){socket['emit'](_0x6711('0x8c'),{'UserId':Number(_0x152e71[_0x6711('0x36')][_0x6711('0x64')][_0x4eff31]),'CmListId':Number(_0x152e71[_0x6711('0x58')]['id'])});}}else{socket[_0x6711('0x8d')](_0x6711('0x8c'),{'UserId':Number(_0x152e71['query'][_0x6711('0x64')]),'CmListId':Number(_0x152e71[_0x6711('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0xaafb08,null))[_0x6711('0x55')](handleError(_0xaafb08,null));};exports[_0x6711('0x8e')]=function(_0x332f38,_0x19e389,_0x24e8da){var _0x907512={};var _0x49df44={};var _0x32933c;var _0x2ff0ac;return db['CmList'][_0x6711('0x5c')]({'where':{'id':_0x332f38[_0x6711('0x58')]['id']}})['then'](handleEntityNotFound(_0x19e389,null))[_0x6711('0x2b')](function(_0x53dbc1){if(_0x53dbc1){_0x32933c=_0x53dbc1;_0x49df44[_0x6711('0x35')]=_[_0x6711('0x37')](db['User'][_0x6711('0x4c')]);_0x49df44[_0x6711('0x36')]=_[_0x6711('0x37')](_0x332f38[_0x6711('0x36')]);_0x49df44[_0x6711('0x38')]=_['intersection'](_0x49df44[_0x6711('0x35')],_0x49df44[_0x6711('0x36')]);_0x907512[_0x6711('0x3a')]=_['intersection'](_0x49df44['model'],qs[_0x6711('0x3b')](_0x332f38['query']['fields']));_0x907512[_0x6711('0x3a')]=_0x907512[_0x6711('0x3a')]['length']?_0x907512['attributes']:_0x49df44[_0x6711('0x35')];_0x907512[_0x6711('0x40')]=qs[_0x6711('0x41')](_0x332f38[_0x6711('0x36')]['sort']);_0x907512[_0x6711('0x42')]=qs[_0x6711('0x38')](_[_0x6711('0x43')](_0x332f38[_0x6711('0x36')],_0x49df44[_0x6711('0x38')]));if(_0x332f38[_0x6711('0x36')]['filter']){_0x907512[_0x6711('0x42')]=_[_0x6711('0x45')](_0x907512['where'],{'$or':_[_0x6711('0x31')](_0x907512[_0x6711('0x3a')],function(_0x2489ae){var _0x5db526={};_0x5db526[_0x2489ae]={'$like':'%'+_0x332f38[_0x6711('0x36')][_0x6711('0x44')]+'%'};return _0x5db526;})});}_0x907512=_[_0x6711('0x45')]({},_0x907512,_0x332f38[_0x6711('0x47')]);return _0x32933c[_0x6711('0x8e')](_0x907512);}})[_0x6711('0x2b')](function(_0x518310){if(_0x518310){_0x2ff0ac=_0x518310[_0x6711('0x3c')];if(!_0x332f38[_0x6711('0x36')][_0x6711('0x3d')]('nolimit')){_0x907512['limit']=qs[_0x6711('0x3f')](_0x332f38['query'][_0x6711('0x3f')]);_0x907512[_0x6711('0x23')]=qs[_0x6711('0x23')](_0x332f38['query'][_0x6711('0x23')]);}return _0x32933c[_0x6711('0x8e')](_0x907512);}})[_0x6711('0x2b')](function(_0x3234c6){if(_0x3234c6){return _0x3234c6?{'count':_0x2ff0ac,'rows':_0x3234c6}:null;}})[_0x6711('0x2b')](respondWithResult(_0x19e389,null))[_0x6711('0x55')](handleError(_0x19e389,null));}; \ No newline at end of file +var _0x6b64=['/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','defaultValue','queryInterface','cf_%s','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','getDispositions','findOne','Disposition','sort','pick','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','CustomFields','concat','cf_%d','raw','getContactsCsv','CmCustomField','format','isEmpty','now','writeFileSync'];(function(_0x5a0cfb,_0x1b881b){var _0x55d5f2=function(_0xbcb914){while(--_0xbcb914){_0x5a0cfb['push'](_0x5a0cfb['shift']());}};_0x55d5f2(++_0x1b881b);}(_0x6b64,0x143));var _0x46b6=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x6b64[_0x379799];return _0x46e431;};'use strict';var pdf=require(_0x46b6('0x0'));var emlformat=require(_0x46b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x46b6('0x2'));var jsonpatch=require(_0x46b6('0x3'));var rp=require('request-promise');var moment=require(_0x46b6('0x4'));var BPromise=require(_0x46b6('0x5'));var Mustache=require(_0x46b6('0x6'));var util=require(_0x46b6('0x7'));var path=require(_0x46b6('0x8'));var sox=require(_0x46b6('0x9'));var csv=require('to-csv');var ejs=require(_0x46b6('0xa'));var fs=require('fs');var _=require(_0x46b6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x46b6('0xc'));var deskjs=require(_0x46b6('0xd'));var toCsv=require(_0x46b6('0xe'));var querystring=require(_0x46b6('0xf'));var Papa=require(_0x46b6('0x10'));var Redis=require(_0x46b6('0x11'));var authService=require(_0x46b6('0x12'));var qs=require(_0x46b6('0x13'));var as=require(_0x46b6('0x14'));var hardwareService=require(_0x46b6('0x15'));var logger=require(_0x46b6('0x16'))(_0x46b6('0x17'));var utils=require(_0x46b6('0x18'));var config=require(_0x46b6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x46b6('0x1a'))['db'];config[_0x46b6('0x1b')]=_[_0x46b6('0x1c')](config[_0x46b6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x46b6('0x1d'))[_0x46b6('0x1e')](socket);function respondWithStatusCode(_0x5178c7,_0x59218f){_0x59218f=_0x59218f||0xcc;return function(_0x2eed87){if(_0x2eed87){return _0x5178c7[_0x46b6('0x1f')](_0x59218f);}return _0x5178c7['status'](_0x59218f)[_0x46b6('0x20')]();};}function respondWithResult(_0x44b310,_0x73d700){_0x73d700=_0x73d700||0xc8;return function(_0x29ab65){if(_0x29ab65){return _0x44b310['status'](_0x73d700)['json'](_0x29ab65);}};}function respondWithFilteredResult(_0x22c9de,_0x59650b){return function(_0x1583d8){if(_0x1583d8){var _0x3ae192=_0x1583d8[_0x46b6('0x21')],_0xd088e5=_0x59650b[_0x46b6('0x22')],_0x3088bb=_0x59650b[_0x46b6('0x22')]+_0x59650b[_0x46b6('0x23')],_0x211928;if(_0x3088bb>=_0x3ae192){_0x3088bb=_0x3ae192;_0x211928=0xc8;}else{_0x211928=0xce;}_0x22c9de[_0x46b6('0x24')](_0x211928);return _0x22c9de[_0x46b6('0x25')](_0x46b6('0x26'),_0xd088e5+'-'+_0x3088bb+'/'+_0x3ae192)[_0x46b6('0x27')](_0x1583d8);}return null;};}function patchUpdates(_0x23503b){return function(_0xd39b54){try{jsonpatch[_0x46b6('0x28')](_0xd39b54,_0x23503b,!![]);}catch(_0x454b2e){return BPromise[_0x46b6('0x29')](_0x454b2e);}return _0xd39b54[_0x46b6('0x2a')]();};}function saveUpdates(_0x5805a9,_0x4578c9){return function(_0x18f022){if(_0x18f022){return _0x18f022[_0x46b6('0x2b')](_0x5805a9)[_0x46b6('0x2c')](function(_0x45c095){return _0x45c095;});}return null;};}function removeEntity(_0xa951dd,_0x225521){return function(_0x4b9b70){if(_0x4b9b70){return _0x4b9b70['destroy']()[_0x46b6('0x2c')](function(){var _0x15364=_0x4b9b70[_0x46b6('0x2d')]({'plain':!![]});var _0x288bdd=_0x46b6('0x2e');return db[_0x46b6('0x2f')][_0x46b6('0x30')]({'where':{'type':_0x288bdd,'resourceId':_0x15364['id']}})['then'](function(){return _0x4b9b70;});})[_0x46b6('0x2c')](function(){_0xa951dd[_0x46b6('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4f8e,_0x3bc3d1){return function(_0x154942){if(!_0x154942){_0x5c4f8e['sendStatus'](0x194);}return _0x154942;};}function handleError(_0x3290c3,_0x448d45){_0x448d45=_0x448d45||0x1f4;return function(_0x25989a){logger[_0x46b6('0x31')](_0x25989a[_0x46b6('0x32')]);if(_0x25989a['name']){delete _0x25989a[_0x46b6('0x33')];}_0x3290c3['status'](_0x448d45)[_0x46b6('0x34')](_0x25989a);};}exports['index']=function(_0x1f87a1,_0x36044b){var _0x448bd5={},_0x51120a={},_0x2ce02a={'count':0x0,'rows':[]};var _0x2e5f58=_[_0x46b6('0x35')](db[_0x46b6('0x36')][_0x46b6('0x37')],function(_0x5e5bdc){return{'name':_0x5e5bdc[_0x46b6('0x38')],'type':_0x5e5bdc[_0x46b6('0x39')][_0x46b6('0x3a')]};});_0x51120a[_0x46b6('0x3b')]=_['map'](_0x2e5f58,_0x46b6('0x33'));_0x51120a[_0x46b6('0x3c')]=_['keys'](_0x1f87a1[_0x46b6('0x3c')]);_0x51120a[_0x46b6('0x3d')]=_[_0x46b6('0x3e')](_0x51120a[_0x46b6('0x3b')],_0x51120a['query']);_0x448bd5['attributes']=_[_0x46b6('0x3e')](_0x51120a['model'],qs[_0x46b6('0x3f')](_0x1f87a1[_0x46b6('0x3c')][_0x46b6('0x3f')]));_0x448bd5['attributes']=_0x448bd5['attributes'][_0x46b6('0x40')]?_0x448bd5[_0x46b6('0x41')]:_0x51120a['model'];if(!_0x1f87a1[_0x46b6('0x3c')][_0x46b6('0x42')](_0x46b6('0x43'))){_0x448bd5[_0x46b6('0x23')]=qs[_0x46b6('0x23')](_0x1f87a1['query'][_0x46b6('0x23')]);_0x448bd5[_0x46b6('0x22')]=qs[_0x46b6('0x22')](_0x1f87a1[_0x46b6('0x3c')][_0x46b6('0x22')]);}_0x448bd5[_0x46b6('0x44')]=qs['sort'](_0x1f87a1[_0x46b6('0x3c')]['sort']);_0x448bd5['where']=qs[_0x46b6('0x3d')](_['pick'](_0x1f87a1['query'],_0x51120a['filters']),_0x2e5f58);if(_0x1f87a1[_0x46b6('0x3c')][_0x46b6('0x45')]){_0x448bd5['where']=_['merge'](_0x448bd5[_0x46b6('0x46')],{'$or':_[_0x46b6('0x35')](_0x2e5f58,function(_0x51d011){if(_0x51d011[_0x46b6('0x39')]!==_0x46b6('0x47')){var _0x19584d={};_0x19584d[_0x51d011['name']]={'$like':'%'+_0x1f87a1[_0x46b6('0x3c')][_0x46b6('0x45')]+'%'};return _0x19584d;}})});}_0x448bd5=_['merge']({},_0x448bd5,_0x1f87a1[_0x46b6('0x48')]);var _0x395571={'where':_0x448bd5[_0x46b6('0x46')]};return db[_0x46b6('0x36')][_0x46b6('0x21')](_0x395571)['then'](function(_0x4e80bd){_0x2ce02a['count']=_0x4e80bd;if(_0x1f87a1[_0x46b6('0x3c')][_0x46b6('0x49')]){_0x448bd5[_0x46b6('0x4a')]=[{'all':!![]}];}return db[_0x46b6('0x36')]['findAll'](_0x448bd5);})[_0x46b6('0x2c')](function(_0x4f66cb){_0x2ce02a[_0x46b6('0x4b')]=_0x4f66cb;return _0x2ce02a;})[_0x46b6('0x2c')](respondWithFilteredResult(_0x36044b,_0x448bd5))[_0x46b6('0x4c')](handleError(_0x36044b,null));};exports[_0x46b6('0x4d')]=function(_0x1c2904,_0xac0ed){var _0x1974ca={'raw':![],'where':{'id':_0x1c2904[_0x46b6('0x4e')]['id']}},_0x657e37={};_0x657e37[_0x46b6('0x3b')]=_[_0x46b6('0x4f')](db[_0x46b6('0x36')]['rawAttributes']);_0x657e37['query']=_[_0x46b6('0x4f')](_0x1c2904['query']);_0x657e37[_0x46b6('0x3d')]=_[_0x46b6('0x3e')](_0x657e37['model'],_0x657e37[_0x46b6('0x3c')]);_0x1974ca[_0x46b6('0x41')]=_[_0x46b6('0x3e')](_0x657e37[_0x46b6('0x3b')],qs[_0x46b6('0x3f')](_0x1c2904[_0x46b6('0x3c')]['fields']));_0x1974ca[_0x46b6('0x41')]=_0x1974ca[_0x46b6('0x41')][_0x46b6('0x40')]?_0x1974ca[_0x46b6('0x41')]:_0x657e37[_0x46b6('0x3b')];if(_0x1c2904[_0x46b6('0x3c')][_0x46b6('0x49')]){_0x1974ca[_0x46b6('0x4a')]=[{'all':!![]}];}_0x1974ca=_[_0x46b6('0x50')]({},_0x1974ca,_0x1c2904['options']);return db[_0x46b6('0x36')][_0x46b6('0x51')](_0x1974ca)['then'](handleEntityNotFound(_0xac0ed,null))['then'](respondWithResult(_0xac0ed,null))[_0x46b6('0x4c')](handleError(_0xac0ed,null));};exports[_0x46b6('0x52')]=function(_0x13c9e7,_0x67487a){return db['CmList']['create'](_0x13c9e7[_0x46b6('0x53')],{})[_0x46b6('0x2c')](function(_0xc10ad7){var _0x371121=_0x13c9e7['user'][_0x46b6('0x2d')]({'plain':!![]});if(!_0x371121)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x371121[_0x46b6('0x54')]===_0x46b6('0x55')){var _0x568ef2=_0xc10ad7[_0x46b6('0x2d')]({'plain':!![]});var _0x2d73b0=_0x46b6('0x2e');return db[_0x46b6('0x56')]['find']({'where':{'name':_0x2d73b0,'userProfileId':_0x371121[_0x46b6('0x57')]},'raw':!![]})[_0x46b6('0x2c')](function(_0x1877ae){if(_0x1877ae&&_0x1877ae[_0x46b6('0x58')]===0x0){return db[_0x46b6('0x2f')][_0x46b6('0x52')]({'name':_0x568ef2[_0x46b6('0x33')],'resourceId':_0x568ef2['id'],'type':_0x1877ae[_0x46b6('0x33')],'sectionId':_0x1877ae['id']},{})[_0x46b6('0x2c')](function(){return _0xc10ad7;});}else{return _0xc10ad7;}})[_0x46b6('0x4c')](function(_0x40644c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40644c);throw _0x40644c;});}return _0xc10ad7;})['then'](respondWithResult(_0x67487a,0xc9))[_0x46b6('0x4c')](handleError(_0x67487a,null));};exports[_0x46b6('0x2b')]=function(_0x2c9791,_0x28b01b){if(_0x2c9791[_0x46b6('0x53')]['id']){delete _0x2c9791['body']['id'];}return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0x2c9791['params']['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x28b01b,null))['then'](saveUpdates(_0x2c9791['body'],null))[_0x46b6('0x2c')](respondWithResult(_0x28b01b,null))[_0x46b6('0x4c')](handleError(_0x28b01b,null));};exports[_0x46b6('0x30')]=function(_0x428273,_0x599784){return db[_0x46b6('0x36')]['find']({'where':{'id':_0x428273[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x599784,null))['then'](removeEntity(_0x599784,null))['catch'](handleError(_0x599784,null));};exports[_0x46b6('0x59')]=function(_0x1bafd9,_0x9b3ca6){return db[_0x46b6('0x36')][_0x46b6('0x59')]()[_0x46b6('0x2c')](respondWithResult(_0x9b3ca6,null))['catch'](handleError(_0x9b3ca6,null));};exports[_0x46b6('0x5a')]=function(_0xc849c,_0xaa79cd,_0x1b0c3e){if(_0xc849c['body']['id']){delete _0xc849c['body']['id'];}return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0xc849c[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0xaa79cd,null))[_0x46b6('0x2c')](function(_0x2c1c41){if(_0x2c1c41){_0xc849c[_0x46b6('0x53')]['ListId']=_0x2c1c41['id'];return db['Disposition']['create'](_0xc849c[_0x46b6('0x53')]);}})[_0x46b6('0x2c')](respondWithResult(_0xaa79cd,null))[_0x46b6('0x4c')](handleError(_0xaa79cd,null));};exports[_0x46b6('0x5b')]=function(_0x2d1358,_0x3f0e68,_0x424aff){var _0x1dc9f6={'raw':![],'where':{}};var _0x407f16={};var _0x59aa01={'count':0x0,'rows':[]};return db[_0x46b6('0x36')][_0x46b6('0x5c')]({'where':{'id':_0x2d1358[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x3f0e68,null))[_0x46b6('0x2c')](function(_0xdcff41){if(_0xdcff41){_0x407f16[_0x46b6('0x3b')]=_[_0x46b6('0x4f')](db[_0x46b6('0x5d')][_0x46b6('0x37')]);_0x407f16[_0x46b6('0x3c')]=_['keys'](_0x2d1358[_0x46b6('0x3c')]);_0x407f16['filters']=_[_0x46b6('0x3e')](_0x407f16[_0x46b6('0x3b')],_0x407f16[_0x46b6('0x3c')]);_0x1dc9f6[_0x46b6('0x41')]=_[_0x46b6('0x3e')](_0x407f16[_0x46b6('0x3b')],qs[_0x46b6('0x3f')](_0x2d1358[_0x46b6('0x3c')][_0x46b6('0x3f')]));_0x1dc9f6[_0x46b6('0x41')]=_0x1dc9f6[_0x46b6('0x41')]['length']?_0x1dc9f6[_0x46b6('0x41')]:_0x407f16[_0x46b6('0x3b')];if(!_0x2d1358[_0x46b6('0x3c')][_0x46b6('0x42')](_0x46b6('0x43'))){_0x1dc9f6[_0x46b6('0x23')]=qs[_0x46b6('0x23')](_0x2d1358['query'][_0x46b6('0x23')]);_0x1dc9f6[_0x46b6('0x22')]=qs['offset'](_0x2d1358[_0x46b6('0x3c')][_0x46b6('0x22')]);}_0x1dc9f6[_0x46b6('0x44')]=qs[_0x46b6('0x5e')](_0x2d1358['query'][_0x46b6('0x5e')]);_0x1dc9f6[_0x46b6('0x46')]=qs[_0x46b6('0x3d')](_[_0x46b6('0x5f')](_0x2d1358['query'],_0x407f16[_0x46b6('0x3d')]));_0x1dc9f6['where'][_0x46b6('0x60')]=_0xdcff41['id'];if(_0x2d1358['query'][_0x46b6('0x45')]){_0x1dc9f6[_0x46b6('0x46')]=_[_0x46b6('0x50')](_0x1dc9f6[_0x46b6('0x46')],{'$or':_[_0x46b6('0x35')](_0x1dc9f6[_0x46b6('0x41')],function(_0x3d2c3d){var _0x34d412={};_0x34d412[_0x3d2c3d]={'$like':'%'+_0x2d1358['query'][_0x46b6('0x45')]+'%'};return _0x34d412;})});}_0x1dc9f6=_[_0x46b6('0x50')]({},_0x1dc9f6,_0x2d1358[_0x46b6('0x48')]);return db['Disposition'][_0x46b6('0x21')]({'where':_0x1dc9f6[_0x46b6('0x46')]})['then'](function(_0x18cf68){_0x59aa01[_0x46b6('0x21')]=_0x18cf68;if(_0x2d1358['query'][_0x46b6('0x49')]){_0x1dc9f6[_0x46b6('0x4a')]=[{'all':!![]}];}return db[_0x46b6('0x5d')]['findAll'](_0x1dc9f6);})[_0x46b6('0x2c')](function(_0x44c7cb){_0x59aa01['rows']=_0x44c7cb;return _0x59aa01;});}})[_0x46b6('0x2c')](respondWithFilteredResult(_0x3f0e68,_0x1dc9f6))[_0x46b6('0x4c')](handleError(_0x3f0e68,null));};exports[_0x46b6('0x61')]=function(_0xf5f1aa,_0x24283b,_0x2fdbfe){return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0xf5f1aa['params']['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x24283b,null))['then'](function(_0x40f4f5){if(_0x40f4f5){return _0x40f4f5[_0x46b6('0x61')](_0xf5f1aa[_0x46b6('0x3c')][_0x46b6('0x62')]);}})[_0x46b6('0x2c')](respondWithStatusCode(_0x24283b,null))['catch'](handleError(_0x24283b,null));};exports[_0x46b6('0x63')]=function(_0x4626b2,_0x39a183,_0x4f561c){return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0x4626b2[_0x46b6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39a183,null))['then'](function(_0x58fdf9){if(_0x58fdf9){var _0x262132=[];var _0x3b75e9={'success':[],'errors':[]};return db[_0x46b6('0x64')][_0x46b6('0x59')]()[_0x46b6('0x2c')](function(_0x42af09){if(_0x4626b2['body'][_0x46b6('0x65')]&&_[_0x46b6('0x66')](_0x4626b2[_0x46b6('0x53')][_0x46b6('0x65')])){if(_0x4626b2[_0x46b6('0x53')][_0x46b6('0x65')]['length']){_0x4626b2[_0x46b6('0x53')][_0x46b6('0x65')]=_0x4626b2[_0x46b6('0x53')][_0x46b6('0x65')][_0x46b6('0x67')](';')+';';}else{_0x4626b2[_0x46b6('0x53')][_0x46b6('0x65')]=null;}}else{_0x4626b2[_0x46b6('0x53')][_0x46b6('0x65')]=null;}if(_0x4626b2[_0x46b6('0x53')]&&_['isArray'](_0x4626b2[_0x46b6('0x53')])){for(var _0x5aeb27=0x0;_0x5aeb27<_0x4626b2['body'][_0x46b6('0x40')];_0x5aeb27+=0x1){_0x4626b2[_0x46b6('0x53')][_0x5aeb27][_0x46b6('0x60')]=_0x4626b2[_0x46b6('0x4e')]['id'];_0x262132[_0x46b6('0x68')](_0x4626b2['body'][_0x5aeb27]);}return BPromise[_0x46b6('0x69')](_0x262132,function(_0x35005d){return db['CmContact'][_0x46b6('0x52')](_[_0x46b6('0x6a')](_0x35005d,[_0x46b6('0x62'),'id'])||{},{'fields':_[_0x46b6('0x4f')](_0x42af09),'raw':!![]})[_0x46b6('0x2c')](function(_0x2e9764){_0x3b75e9[_0x46b6('0x6b')][_0x46b6('0x68')](_0x2e9764[_0x46b6('0x6c')]);})[_0x46b6('0x4c')](function(_0x34272a){_0x3b75e9[_0x46b6('0x6d')]['push']({'data':_0x35005d,'error':_0x34272a['message']});});})[_0x46b6('0x2c')](function(_0x620bac){return _0x3b75e9;})[_0x46b6('0x4c')](function(_0x7c00c7){return _0x7c00c7;});}else{_0x39a183[_0x46b6('0x24')](0x190)[_0x46b6('0x27')]({'message':_0x46b6('0x6e')});}});}})[_0x46b6('0x2c')](respondWithResult(_0x39a183,null))[_0x46b6('0x4c')](handleError(_0x39a183,null));};exports['getContacts']=function(_0x4bbaac,_0x36e698,_0x57875c){var _0x36c451;return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0x4bbaac['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x46b6('0x6f')}]})[_0x46b6('0x2c')](handleEntityNotFound(_0x36e698,null))['then'](function(_0xbb8d18){if(_0xbb8d18){_0x36c451=_0xbb8d18;return db[_0x46b6('0x64')][_0x46b6('0x37')];}})[_0x46b6('0x2c')](function(_0x26bc1a){if(_0x26bc1a){var _0x1f6afe={};var _0x359402={};_0x359402['model']=_[_0x46b6('0x70')](_[_0x46b6('0x4f')](_0x26bc1a),_[_0x46b6('0x35')](_0x36c451['CustomFields'],function(_0x562452){return util['format'](_0x46b6('0x71'),_0x562452['id']);}));_0x359402[_0x46b6('0x3c')]=_[_0x46b6('0x4f')](_0x4bbaac[_0x46b6('0x3c')]);_0x359402[_0x46b6('0x3d')]=_[_0x46b6('0x3e')](_0x359402[_0x46b6('0x3b')],_0x359402[_0x46b6('0x3c')]);_0x1f6afe[_0x46b6('0x41')]=_['intersection'](_0x359402[_0x46b6('0x3b')],qs[_0x46b6('0x3f')](_0x4bbaac[_0x46b6('0x3c')][_0x46b6('0x3f')]));_0x1f6afe[_0x46b6('0x41')]=_0x1f6afe[_0x46b6('0x41')][_0x46b6('0x40')]?_0x1f6afe[_0x46b6('0x41')]:_0x359402[_0x46b6('0x3b')];if(!_0x4bbaac[_0x46b6('0x3c')][_0x46b6('0x42')](_0x46b6('0x43'))){_0x1f6afe[_0x46b6('0x23')]=qs[_0x46b6('0x23')](_0x4bbaac['query'][_0x46b6('0x23')]);_0x1f6afe['offset']=qs['offset'](_0x4bbaac[_0x46b6('0x3c')][_0x46b6('0x22')]);}_0x1f6afe[_0x46b6('0x44')]=qs['sort'](_0x4bbaac[_0x46b6('0x3c')][_0x46b6('0x5e')]);_0x1f6afe[_0x46b6('0x46')]=qs[_0x46b6('0x3d')](_[_0x46b6('0x5f')](_0x4bbaac[_0x46b6('0x3c')],_0x359402[_0x46b6('0x3d')]));_0x1f6afe[_0x46b6('0x72')]=!![];if(_0x4bbaac[_0x46b6('0x3c')]['filter']){_0x1f6afe[_0x46b6('0x46')]=_[_0x46b6('0x50')](_0x1f6afe[_0x46b6('0x46')],{'$or':_[_0x46b6('0x35')](_0x1f6afe[_0x46b6('0x41')],function(_0x54324c){var _0x1a3cc9={};_0x1a3cc9[_0x54324c]={'$like':'%'+_0x4bbaac['query'][_0x46b6('0x45')]+'%'};return _0x1a3cc9;})});}_0x1f6afe=_['merge']({},_0x1f6afe,_0x4bbaac[_0x46b6('0x48')]);return _0x36c451['getContacts'](_0x1f6afe);}})['then'](respondWithResult(_0x36e698,null))[_0x46b6('0x4c')](handleError(_0x36e698,null));};exports[_0x46b6('0x73')]=function(_0x56e728,_0x134c08,_0x3e626d){var _0x275a5f;return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0x56e728[_0x46b6('0x4e')]['id']},'include':[{'model':db[_0x46b6('0x74')],'as':_0x46b6('0x6f')}]})['then'](handleEntityNotFound(_0x134c08,null))[_0x46b6('0x2c')](function(_0x4b0f15){if(_0x4b0f15){_0x275a5f=_0x4b0f15;return db[_0x46b6('0x64')][_0x46b6('0x37')];}})[_0x46b6('0x2c')](function(_0x295166){if(_0x295166){var _0x5c920b={};var _0x58551f={};_0x58551f[_0x46b6('0x3b')]=_['concat'](_[_0x46b6('0x4f')](_0x295166),_[_0x46b6('0x35')](_0x275a5f['CustomFields'],function(_0x441fb1){return util[_0x46b6('0x75')](_0x46b6('0x71'),_0x441fb1['id']);}));_0x58551f['query']=_[_0x46b6('0x4f')](_0x56e728[_0x46b6('0x3c')]);_0x58551f[_0x46b6('0x3d')]=_['intersection'](_0x58551f['model'],_0x58551f[_0x46b6('0x3c')]);_0x5c920b[_0x46b6('0x41')]=_[_0x46b6('0x3e')](_0x58551f[_0x46b6('0x3b')],qs[_0x46b6('0x3f')](_0x56e728[_0x46b6('0x3c')][_0x46b6('0x3f')]));_0x5c920b[_0x46b6('0x41')]=_0x5c920b[_0x46b6('0x41')]['length']?_0x5c920b[_0x46b6('0x41')]:_0x58551f['model'];if(!_0x56e728[_0x46b6('0x3c')][_0x46b6('0x42')](_0x46b6('0x43'))){_0x5c920b[_0x46b6('0x23')]=qs[_0x46b6('0x23')](_0x56e728[_0x46b6('0x3c')]['limit']);_0x5c920b['offset']=qs[_0x46b6('0x22')](_0x56e728['query'][_0x46b6('0x22')]);}_0x5c920b[_0x46b6('0x44')]=qs['sort'](_0x56e728['query'][_0x46b6('0x5e')]);_0x5c920b[_0x46b6('0x46')]=qs[_0x46b6('0x3d')](_[_0x46b6('0x5f')](_0x56e728[_0x46b6('0x3c')],_0x58551f[_0x46b6('0x3d')]));_0x5c920b[_0x46b6('0x72')]=!![];if(_0x56e728[_0x46b6('0x3c')][_0x46b6('0x45')]){_0x5c920b[_0x46b6('0x46')]=_[_0x46b6('0x50')](_0x5c920b[_0x46b6('0x46')],{'$or':_['map'](_0x5c920b['attributes'],function(_0x8833f5){var _0x337ddf={};_0x337ddf[_0x8833f5]={'$like':'%'+_0x56e728[_0x46b6('0x3c')]['filter']+'%'};return _0x337ddf;})});}_0x5c920b=_['merge']({},_0x5c920b,_0x56e728[_0x46b6('0x48')]);return _0x275a5f['getContacts'](_0x5c920b);}})['then'](function(_0x111a6b){if(!_[_0x46b6('0x76')](_0x111a6b)){var _0x2de958=toCsv(_0x111a6b);var _0x7eac0c=Date[_0x46b6('0x77')]();fs[_0x46b6('0x78')](util[_0x46b6('0x75')](_0x46b6('0x79'),_0x275a5f['id'],_0x7eac0c),_0x2de958);_0x134c08[_0x46b6('0x7a')]('Content-disposition',_0x46b6('0x7b')+util['format'](_0x46b6('0x7c'),_0x275a5f['id'],_0x7eac0c));_0x134c08['setHeader'](_0x46b6('0x7d'),_0x46b6('0x7e'));return _0x134c08[_0x46b6('0x7f')](util[_0x46b6('0x75')](_0x46b6('0x79'),_0x275a5f['id'],_0x7eac0c));}else{return _0x134c08['sendStatus'](0xcc);}})[_0x46b6('0x4c')](handleError(_0x134c08,null));};exports[_0x46b6('0x80')]=function(_0x3faa37,_0x4c874d,_0xfb47d8){var _0x25366d;delete _0x3faa37[_0x46b6('0x53')]['id'];return db['CmList'][_0x46b6('0x5c')]({'where':{'id':_0x3faa37[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x4c874d,null))['then'](function(_0x1274b9){if(_0x1274b9){return db[_0x46b6('0x81')][_0x46b6('0x82')](function(_0x239da2){return db[_0x46b6('0x74')][_0x46b6('0x52')](_0x3faa37[_0x46b6('0x53')],{'transaction':_0x239da2})['then'](function(_0x24978a){_0x25366d=_0x24978a;return _0x1274b9[_0x46b6('0x83')](_0x24978a,{'transaction':_0x239da2});})['then'](function(){var _0x4b42e5={'type':db[_0x46b6('0x84')]['TEXT'],'transaction':_0x239da2};switch(_0x3faa37[_0x46b6('0x53')][_0x46b6('0x39')]){case _0x46b6('0x85'):_0x4b42e5[_0x46b6('0x39')]=db[_0x46b6('0x84')][_0x46b6('0x86')];break;case'number':_0x4b42e5['type']=db[_0x46b6('0x84')][_0x46b6('0x87')];break;case _0x46b6('0x88'):_0x4b42e5['type']=db[_0x46b6('0x84')]['BOOLEAN'];_0x4b42e5[_0x46b6('0x89')]=![];break;default:}return db[_0x46b6('0x81')][_0x46b6('0x8a')]['addColumn']('cm_contacts',util[_0x46b6('0x75')](_0x46b6('0x8b'),_0x25366d['id']),_0x4b42e5);})['then'](function(){return _0x25366d;});});}})[_0x46b6('0x2c')](respondWithResult(_0x4c874d,null))[_0x46b6('0x4c')](handleError(_0x4c874d,null));};exports['getCustomFields']=function(_0x2427d3,_0x18177c,_0x5759f1){var _0x28082e={};var _0x24d176={};var _0x3eb3b9;var _0x2678e1;return db[_0x46b6('0x36')][_0x46b6('0x5c')]({'where':{'id':_0x2427d3['params']['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x18177c,null))[_0x46b6('0x2c')](function(_0x306f90){if(_0x306f90){_0x3eb3b9=_0x306f90;_0x24d176[_0x46b6('0x3b')]=_[_0x46b6('0x4f')](db[_0x46b6('0x74')][_0x46b6('0x37')]);_0x24d176[_0x46b6('0x3c')]=_[_0x46b6('0x4f')](_0x2427d3[_0x46b6('0x3c')]);_0x24d176[_0x46b6('0x3d')]=_[_0x46b6('0x3e')](_0x24d176[_0x46b6('0x3b')],_0x24d176[_0x46b6('0x3c')]);_0x28082e[_0x46b6('0x41')]=_[_0x46b6('0x3e')](_0x24d176[_0x46b6('0x3b')],qs[_0x46b6('0x3f')](_0x2427d3[_0x46b6('0x3c')][_0x46b6('0x3f')]));_0x28082e[_0x46b6('0x41')]=_0x28082e[_0x46b6('0x41')]['length']?_0x28082e['attributes']:_0x24d176[_0x46b6('0x3b')];_0x28082e[_0x46b6('0x44')]=qs['sort'](_0x2427d3[_0x46b6('0x3c')][_0x46b6('0x5e')]);_0x28082e[_0x46b6('0x46')]=qs[_0x46b6('0x3d')](_[_0x46b6('0x5f')](_0x2427d3[_0x46b6('0x3c')],_0x24d176[_0x46b6('0x3d')]));_0x28082e['where']=_[_0x46b6('0x50')](_0x28082e[_0x46b6('0x46')],{'$or':[{'ListId':_0x306f90['id']},{'ListId':null}]});if(_0x2427d3[_0x46b6('0x3c')][_0x46b6('0x45')]){_0x28082e[_0x46b6('0x46')]=_[_0x46b6('0x50')](_0x28082e['where'],{'$or':_[_0x46b6('0x35')](_0x28082e[_0x46b6('0x41')],function(_0x41c2d6){var _0x1f44a2={};_0x1f44a2[_0x41c2d6]={'$like':'%'+_0x2427d3[_0x46b6('0x3c')]['filter']+'%'};return _0x1f44a2;})});}_0x28082e=_[_0x46b6('0x50')]({},_0x28082e,_0x2427d3[_0x46b6('0x48')]);return db['CmCustomField'][_0x46b6('0x8c')](_0x28082e);}})[_0x46b6('0x2c')](respondWithResult(_0x18177c,null))['catch'](handleError(_0x18177c,null));};exports['addAgents']=function(_0x36fdd4,_0x378cea,_0x3359e6){return db['CmList'][_0x46b6('0x51')]({'where':{'id':_0x36fdd4[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x378cea,null))[_0x46b6('0x2c')](function(_0x4fa5ac){if(_0x4fa5ac){return _0x4fa5ac[_0x46b6('0x8d')](_0x36fdd4['body']['ids'],_[_0x46b6('0x6a')](_0x36fdd4[_0x46b6('0x53')],['ids','id'])||{})[_0x46b6('0x8e')](function(_0x3d141f){for(var _0x4a0391=0x0;_0x4a0391<_0x36fdd4[_0x46b6('0x53')]['ids'][_0x46b6('0x40')];_0x4a0391+=0x1){socket[_0x46b6('0x8f')]('userCmList:save',{'UserId':_0x36fdd4[_0x46b6('0x53')][_0x46b6('0x62')][_0x4a0391],'CmListId':_0x36fdd4[_0x46b6('0x4e')]['id']});}return _0x3d141f;});}})['then'](respondWithResult(_0x378cea,null))[_0x46b6('0x4c')](handleError(_0x378cea,null));};exports[_0x46b6('0x90')]=function(_0x13a1d0,_0x24f92a,_0x7ac48a){return db[_0x46b6('0x36')][_0x46b6('0x51')]({'where':{'id':_0x13a1d0[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x24f92a,null))[_0x46b6('0x2c')](function(_0x3b3865){if(_0x3b3865){return _0x3b3865['removeAgents'](_0x13a1d0['query']['ids'])['then'](function(){if(_[_0x46b6('0x66')](_0x13a1d0[_0x46b6('0x3c')][_0x46b6('0x62')])){for(var _0x5746c0=0x0;_0x5746c0<_0x13a1d0['query'][_0x46b6('0x62')][_0x46b6('0x40')];_0x5746c0+=0x1){socket['emit'](_0x46b6('0x91'),{'UserId':Number(_0x13a1d0[_0x46b6('0x3c')][_0x46b6('0x62')][_0x5746c0]),'CmListId':Number(_0x13a1d0[_0x46b6('0x4e')]['id'])});}}else{socket['emit'](_0x46b6('0x91'),{'UserId':Number(_0x13a1d0['query'][_0x46b6('0x62')]),'CmListId':Number(_0x13a1d0[_0x46b6('0x4e')]['id'])});}});}})[_0x46b6('0x2c')](respondWithStatusCode(_0x24f92a,null))[_0x46b6('0x4c')](handleError(_0x24f92a,null));};exports[_0x46b6('0x92')]=function(_0x51cedc,_0x39ba58,_0x55123c){var _0x2e42da={};var _0xbd6247={};var _0x4dfdae;var _0x1786d7;return db[_0x46b6('0x36')][_0x46b6('0x5c')]({'where':{'id':_0x51cedc[_0x46b6('0x4e')]['id']}})[_0x46b6('0x2c')](handleEntityNotFound(_0x39ba58,null))[_0x46b6('0x2c')](function(_0x56016f){if(_0x56016f){_0x4dfdae=_0x56016f;_0xbd6247['model']=_[_0x46b6('0x4f')](db[_0x46b6('0x93')][_0x46b6('0x37')]);_0xbd6247[_0x46b6('0x3c')]=_[_0x46b6('0x4f')](_0x51cedc['query']);_0xbd6247[_0x46b6('0x3d')]=_[_0x46b6('0x3e')](_0xbd6247[_0x46b6('0x3b')],_0xbd6247[_0x46b6('0x3c')]);_0x2e42da[_0x46b6('0x41')]=_['intersection'](_0xbd6247[_0x46b6('0x3b')],qs[_0x46b6('0x3f')](_0x51cedc[_0x46b6('0x3c')][_0x46b6('0x3f')]));_0x2e42da[_0x46b6('0x41')]=_0x2e42da['attributes']['length']?_0x2e42da[_0x46b6('0x41')]:_0xbd6247['model'];_0x2e42da[_0x46b6('0x44')]=qs['sort'](_0x51cedc['query'][_0x46b6('0x5e')]);_0x2e42da['where']=qs[_0x46b6('0x3d')](_[_0x46b6('0x5f')](_0x51cedc[_0x46b6('0x3c')],_0xbd6247[_0x46b6('0x3d')]));if(_0x51cedc[_0x46b6('0x3c')][_0x46b6('0x45')]){_0x2e42da[_0x46b6('0x46')]=_[_0x46b6('0x50')](_0x2e42da[_0x46b6('0x46')],{'$or':_[_0x46b6('0x35')](_0x2e42da['attributes'],function(_0x4a6af7){var _0x120317={};_0x120317[_0x4a6af7]={'$like':'%'+_0x51cedc[_0x46b6('0x3c')]['filter']+'%'};return _0x120317;})});}_0x2e42da=_[_0x46b6('0x50')]({},_0x2e42da,_0x51cedc[_0x46b6('0x48')]);return _0x4dfdae['getAgents'](_0x2e42da);}})[_0x46b6('0x2c')](function(_0x623540){if(_0x623540){_0x1786d7=_0x623540[_0x46b6('0x40')];if(!_0x51cedc[_0x46b6('0x3c')][_0x46b6('0x42')](_0x46b6('0x43'))){_0x2e42da[_0x46b6('0x23')]=qs['limit'](_0x51cedc[_0x46b6('0x3c')][_0x46b6('0x23')]);_0x2e42da[_0x46b6('0x22')]=qs[_0x46b6('0x22')](_0x51cedc[_0x46b6('0x3c')][_0x46b6('0x22')]);}return _0x4dfdae[_0x46b6('0x92')](_0x2e42da);}})[_0x46b6('0x2c')](function(_0x2c098c){if(_0x2c098c){return _0x2c098c?{'count':_0x1786d7,'rows':_0x2c098c}:null;}})[_0x46b6('0x2c')](respondWithResult(_0x39ba58,null))[_0x46b6('0x4c')](handleError(_0x39ba58,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 62769ea..752ab73 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 _0x1140=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x1140,0x132));var _0x0114=function(_0xe8ed99,_0x18d918){_0xe8ed99=_0xe8ed99-0x0;var _0x235e3a=_0x1140[_0xe8ed99];return _0x235e3a;};'use strict';var EventEmitter=require('events');var CmList=require(_0x0114('0x0'))['db'][_0x0114('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x0114('0x2')](0x0);var events={'afterCreate':_0x0114('0x3'),'afterUpdate':_0x0114('0x4'),'afterDestroy':_0x0114('0x5')};function emitEvent(_0x8ac837){return function(_0x31a3ed,_0x2e1fde,_0x246b2d){CmListEvents['emit'](_0x8ac837+':'+_0x31a3ed['id'],_0x31a3ed);CmListEvents[_0x0114('0x6')](_0x8ac837,_0x31a3ed);_0x246b2d(null);};}for(var e in events){if(events[_0x0114('0x7')](e)){var event=events[e];CmList[_0x0114('0x8')](e,emitEvent(event));}}module[_0x0114('0x9')]=CmListEvents; \ No newline at end of file +var _0xe91e=['exports','events','CmList','save','remove','emit','hasOwnProperty','hook'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0xe91e,0x191));var _0xee91=function(_0x292b9d,_0x123322){_0x292b9d=_0x292b9d-0x0;var _0x33621e=_0xe91e[_0x292b9d];return _0x33621e;};'use strict';var EventEmitter=require(_0xee91('0x0'));var CmList=require('../../mysqldb')['db'][_0xee91('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee91('0x2'),'afterUpdate':'update','afterDestroy':_0xee91('0x3')};function emitEvent(_0x5c05b3){return function(_0x14c3ca,_0x4a10f6,_0x5603da){CmListEvents['emit'](_0x5c05b3+':'+_0x14c3ca['id'],_0x14c3ca);CmListEvents[_0xee91('0x4')](_0x5c05b3,_0x14c3ca);_0x5603da(null);};}for(var e in events){if(events[_0xee91('0x5')](e)){var event=events[e];CmList[_0xee91('0x6')](e,emitEvent(event));}}module[_0xee91('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 072e9c4..a18dd96 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 _0x2386=['request-promise','path','rimraf','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','bluebird'];(function(_0x5af04c,_0xf3acb1){var _0x3e97a1=function(_0x570351){while(--_0x570351){_0x5af04c['push'](_0x5af04c['shift']());}};_0x3e97a1(++_0xf3acb1);}(_0x2386,0x170));var _0x6238=function(_0x229d39,_0x52ffbd){_0x229d39=_0x229d39-0x0;var _0x282743=_0x2386[_0x229d39];return _0x282743;};'use strict';var _=require(_0x6238('0x0'));var util=require(_0x6238('0x1'));var logger=require('../../config/logger')(_0x6238('0x2'));var moment=require('moment');var BPromise=require(_0x6238('0x3'));var rp=require(_0x6238('0x4'));var fs=require('fs');var path=require(_0x6238('0x5'));var rimraf=require(_0x6238('0x6'));var config=require('../../config/environment');var attributes=require(_0x6238('0x7'));module[_0x6238('0x8')]=function(_0x30f920,_0x30250d){return _0x30f920[_0x6238('0x9')](_0x6238('0xa'),attributes,{'tableName':_0x6238('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec0b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists'];(function(_0x302a49,_0x304c7b){var _0x30f6cf=function(_0x4e0ac8){while(--_0x4e0ac8){_0x302a49['push'](_0x302a49['shift']());}};_0x30f6cf(++_0x304c7b);}(_0xec0b,0x15f));var _0xbec0=function(_0x5dc464,_0x1d9bd7){_0x5dc464=_0x5dc464-0x0;var _0x398339=_0xec0b[_0x5dc464];return _0x398339;};'use strict';var _=require(_0xbec0('0x0'));var util=require(_0xbec0('0x1'));var logger=require(_0xbec0('0x2'))(_0xbec0('0x3'));var moment=require(_0xbec0('0x4'));var BPromise=require(_0xbec0('0x5'));var rp=require(_0xbec0('0x6'));var fs=require('fs');var path=require(_0xbec0('0x7'));var rimraf=require(_0xbec0('0x8'));var config=require(_0xbec0('0x9'));var attributes=require('./cmList.attributes');module[_0xbec0('0xa')]=function(_0x2b52e5,_0x5ad629){return _0x2b52e5['define'](_0xbec0('0xb'),attributes,{'tableName':_0xbec0('0xc'),'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 3f89b14..34a1711 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 _0x3bfc=['CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','request\x20sent','debug'];(function(_0x1270ea,_0x2b4eeb){var _0x330478=function(_0x39ba6c){while(--_0x39ba6c){_0x1270ea['push'](_0x1270ea['shift']());}};_0x330478(++_0x2b4eeb);}(_0x3bfc,0x1b7));var _0xc3bf=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0x3bfc[_0x4ddfe1];return _0x4aaf51;};'use strict';var _=require(_0xc3bf('0x0'));var util=require(_0xc3bf('0x1'));var moment=require(_0xc3bf('0x2'));var BPromise=require(_0xc3bf('0x3'));var rs=require(_0xc3bf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3bf('0x5'))['db'];var utils=require(_0xc3bf('0x6'));var logger=require(_0xc3bf('0x7'))(_0xc3bf('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc3bf('0x9')][_0xc3bf('0xa')]({'port':0x232a});config[_0xc3bf('0xb')]=_[_0xc3bf('0xc')](config[_0xc3bf('0xb')],{'host':_0xc3bf('0xd'),'port':0x18eb});var socket=require(_0xc3bf('0xe'))(new Redis(config[_0xc3bf('0xb')]));require(_0xc3bf('0xf'))[_0xc3bf('0x10')](socket);function respondWithRpcPromise(_0x2274b8,_0x365ba1,_0x1a1883){return new BPromise(function(_0x2d66af,_0xc90e6c){return client[_0xc3bf('0x11')](_0x2274b8,_0x1a1883)['then'](function(_0x5f55b4){logger['info']('CmList,\x20%s,\x20%s',_0x365ba1,_0xc3bf('0x12'));logger[_0xc3bf('0x13')](_0xc3bf('0x14'),_0x365ba1,_0xc3bf('0x12'),JSON['stringify'](_0x5f55b4));if(_0x5f55b4[_0xc3bf('0x15')]){if(_0x5f55b4[_0xc3bf('0x15')][_0xc3bf('0x16')]===0x1f4){logger[_0xc3bf('0x15')](_0xc3bf('0x17'),_0x365ba1,_0x5f55b4[_0xc3bf('0x15')][_0xc3bf('0x18')]);return _0xc90e6c(_0x5f55b4[_0xc3bf('0x15')][_0xc3bf('0x18')]);}logger[_0xc3bf('0x15')](_0xc3bf('0x17'),_0x365ba1,_0x5f55b4[_0xc3bf('0x15')]['message']);return _0x2d66af(_0x5f55b4[_0xc3bf('0x15')][_0xc3bf('0x18')]);}else{logger[_0xc3bf('0x19')]('CmList,\x20%s,\x20%s',_0x365ba1,_0xc3bf('0x12'));_0x2d66af(_0x5f55b4[_0xc3bf('0x1a')]['message']);}})['catch'](function(_0xa49bb8){logger[_0xc3bf('0x15')](_0xc3bf('0x17'),_0x365ba1,_0xa49bb8);_0xc90e6c(_0xa49bb8);});});} \ No newline at end of file +var _0x5129=['info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./cmList.socket','register','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5129,0x11d));var _0x9512=function(_0x272132,_0x3cc026){_0x272132=_0x272132-0x0;var _0x1e407a=_0x5129[_0x272132];return _0x1e407a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9512('0x0'));var BPromise=require(_0x9512('0x1'));var rs=require(_0x9512('0x2'));var fs=require('fs');var Redis=require(_0x9512('0x3'));var db=require(_0x9512('0x4'))['db'];var utils=require(_0x9512('0x5'));var logger=require(_0x9512('0x6'))('rpc');var config=require(_0x9512('0x7'));var jayson=require(_0x9512('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x9512('0x9')]=_[_0x9512('0xa')](config[_0x9512('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9512('0xb'))(new Redis(config['redis']));require(_0x9512('0xc'))[_0x9512('0xd')](socket);function respondWithRpcPromise(_0x188c45,_0x29b268,_0x19a11c){return new BPromise(function(_0x4627dc,_0x3de1cd){return client['request'](_0x188c45,_0x19a11c)[_0x9512('0xe')](function(_0x522c06){logger[_0x9512('0xf')](_0x9512('0x10'),_0x29b268,_0x9512('0x11'));logger[_0x9512('0x12')](_0x9512('0x13'),_0x29b268,_0x9512('0x11'),JSON[_0x9512('0x14')](_0x522c06));if(_0x522c06[_0x9512('0x15')]){if(_0x522c06[_0x9512('0x15')][_0x9512('0x16')]===0x1f4){logger[_0x9512('0x15')](_0x9512('0x10'),_0x29b268,_0x522c06[_0x9512('0x15')][_0x9512('0x17')]);return _0x3de1cd(_0x522c06[_0x9512('0x15')][_0x9512('0x17')]);}logger[_0x9512('0x15')]('CmList,\x20%s,\x20%s',_0x29b268,_0x522c06['error']['message']);return _0x4627dc(_0x522c06[_0x9512('0x15')][_0x9512('0x17')]);}else{logger[_0x9512('0xf')](_0x9512('0x10'),_0x29b268,_0x9512('0x11'));_0x4627dc(_0x522c06[_0x9512('0x18')][_0x9512('0x17')]);}})['catch'](function(_0x1d488a){logger['error'](_0x9512('0x10'),_0x29b268,_0x1d488a);_0x3de1cd(_0x1d488a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 86bdc84..67f7901 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 _0x9009=['removeListener','register','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x2d6d5f,_0x583ccd){var _0x7a96b7=function(_0xe43cbe){while(--_0xe43cbe){_0x2d6d5f['push'](_0x2d6d5f['shift']());}};_0x7a96b7(++_0x583ccd);}(_0x9009,0x1d4));var _0x9900=function(_0x1ffa2c,_0x55b043){_0x1ffa2c=_0x1ffa2c-0x0;var _0x59c0c5=_0x9009[_0x1ffa2c];return _0x59c0c5;};'use strict';var CmListEvents=require(_0x9900('0x0'));var events=['save',_0x9900('0x1'),_0x9900('0x2')];function createListener(_0x5d0a60,_0x12d637){return function(_0x177acf){_0x12d637[_0x9900('0x3')](_0x5d0a60,_0x177acf);};}function removeListener(_0x224abb,_0x5705f1){return function(){CmListEvents[_0x9900('0x4')](_0x224abb,_0x5705f1);};}exports[_0x9900('0x5')]=function(_0x502dac){for(var _0x59dd25=0x0,_0x16de4e=events[_0x9900('0x6')];_0x59dd25<_0x16de4e;_0x59dd25++){var _0x4abe19=events[_0x59dd25];var _0x2f085b=createListener(_0x9900('0x7')+_0x4abe19,_0x502dac);CmListEvents['on'](_0x4abe19,_0x2f085b);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./cmList.events'];(function(_0x4d1819,_0x299931){var _0x370d2c=function(_0x4f2517){while(--_0x4f2517){_0x4d1819['push'](_0x4d1819['shift']());}};_0x370d2c(++_0x299931);}(_0x326f,0xd1));var _0xf326=function(_0x52b1ac,_0x25dace){_0x52b1ac=_0x52b1ac-0x0;var _0x43b649=_0x326f[_0x52b1ac];return _0x43b649;};'use strict';var CmListEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){CmListEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('cmList:'+_0x165f95,_0x3ace29);CmListEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 35aa3fa..0a81e11 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 138a531..dd536ba 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(_0x1d6656,_0x31cc15){var _0x5600fa=function(_0x307ffa){while(--_0x307ffa){_0x1d6656['push'](_0x1d6656['shift']());}};_0x5600fa(++_0x31cc15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x2f2350,_0xf261f9){var _0x58aa50=function(_0x37b468){while(--_0x37b468){_0x2f2350['push'](_0x2f2350['shift']());}};_0x58aa50(++_0xf261f9);}(_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')],'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 b0495c3..a8bfb10 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 _0xa449=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','body','find','params','catch','Condition','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0xa449,0x78));var _0x9a44=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa449[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x9a44('0x0'));var emlformat=require(_0x9a44('0x1'));var rimraf=require(_0x9a44('0x2'));var zipdir=require(_0x9a44('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a44('0x4'));var moment=require(_0x9a44('0x5'));var BPromise=require(_0x9a44('0x6'));var Mustache=require(_0x9a44('0x7'));var util=require(_0x9a44('0x8'));var path=require(_0x9a44('0x9'));var sox=require(_0x9a44('0xa'));var csv=require(_0x9a44('0xb'));var ejs=require(_0x9a44('0xc'));var fs=require('fs');var _=require(_0x9a44('0xd'));var squel=require(_0x9a44('0xe'));var crypto=require(_0x9a44('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9a44('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9a44('0x11'));var Redis=require(_0x9a44('0x12'));var authService=require(_0x9a44('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9a44('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a44('0x15'))(_0x9a44('0x16'));var utils=require(_0x9a44('0x17'));var config=require(_0x9a44('0x18'));var licenseUtil=require(_0x9a44('0x19'));var db=require(_0x9a44('0x1a'))['db'];function respondWithStatusCode(_0x13d6b7,_0x3f2de0){_0x3f2de0=_0x3f2de0||0xcc;return function(_0x31b264){if(_0x31b264){return _0x13d6b7[_0x9a44('0x1b')](_0x3f2de0);}return _0x13d6b7[_0x9a44('0x1c')](_0x3f2de0)[_0x9a44('0x1d')]();};}function respondWithResult(_0x4b53db,_0x302a61){_0x302a61=_0x302a61||0xc8;return function(_0x3d8cb3){if(_0x3d8cb3){return _0x4b53db[_0x9a44('0x1c')](_0x302a61)[_0x9a44('0x1e')](_0x3d8cb3);}};}function respondWithFilteredResult(_0x5d2019,_0x4e6899){return function(_0x4388a5){if(_0x4388a5){var _0x2ebdc8=_0x4388a5[_0x9a44('0x1f')],_0x3e29eb=_0x4e6899[_0x9a44('0x20')],_0x1a6cf0=_0x4e6899[_0x9a44('0x20')]+_0x4e6899[_0x9a44('0x21')],_0x469bc5;if(_0x1a6cf0>=_0x2ebdc8){_0x1a6cf0=_0x2ebdc8;_0x469bc5=0xc8;}else{_0x469bc5=0xce;}_0x5d2019[_0x9a44('0x1c')](_0x469bc5);return _0x5d2019[_0x9a44('0x22')](_0x9a44('0x23'),_0x3e29eb+'-'+_0x1a6cf0+'/'+_0x2ebdc8)[_0x9a44('0x1e')](_0x4388a5);}return null;};}function patchUpdates(_0x521e4e){return function(_0x5a2d86){try{jsonpatch['apply'](_0x5a2d86,_0x521e4e,!![]);}catch(_0x4e66d8){return BPromise[_0x9a44('0x24')](_0x4e66d8);}return _0x5a2d86[_0x9a44('0x25')]();};}function saveUpdates(_0x4d4368,_0x1c8249){return function(_0x4b272d){if(_0x4b272d){return _0x4b272d[_0x9a44('0x26')](_0x4d4368)[_0x9a44('0x27')](function(_0x1ead13){return _0x1ead13;});}return null;};}function removeEntity(_0x231d86,_0x4adf72){return function(_0x2080d9){if(_0x2080d9){return _0x2080d9[_0x9a44('0x28')]()[_0x9a44('0x27')](function(){_0x231d86[_0x9a44('0x1c')](0xcc)[_0x9a44('0x1d')]();});}};}function handleEntityNotFound(_0x40542a,_0x152455){return function(_0x274677){if(!_0x274677){_0x40542a[_0x9a44('0x1b')](0x194);}return _0x274677;};}function handleError(_0x168c9d,_0x243a97){_0x243a97=_0x243a97||0x1f4;return function(_0x3fac03){logger['error'](_0x3fac03[_0x9a44('0x29')]);if(_0x3fac03[_0x9a44('0x2a')]){delete _0x3fac03['name'];}_0x168c9d['status'](_0x243a97)[_0x9a44('0x2b')](_0x3fac03);};}exports[_0x9a44('0x26')]=function(_0x342746,_0x328512){if(_0x342746['body']['id']){delete _0x342746[_0x9a44('0x2c')]['id'];}return db['Condition'][_0x9a44('0x2d')]({'where':{'id':_0x342746[_0x9a44('0x2e')]['id']}})[_0x9a44('0x27')](handleEntityNotFound(_0x328512,null))['then'](saveUpdates(_0x342746[_0x9a44('0x2c')],null))['then'](respondWithResult(_0x328512,null))[_0x9a44('0x2f')](handleError(_0x328512,null));};exports[_0x9a44('0x28')]=function(_0x5a516f,_0x5ddfc9){return db[_0x9a44('0x30')][_0x9a44('0x2d')]({'where':{'id':_0x5a516f[_0x9a44('0x2e')]['id']}})[_0x9a44('0x27')](handleEntityNotFound(_0x5ddfc9,null))[_0x9a44('0x27')](removeEntity(_0x5ddfc9,null))[_0x9a44('0x2f')](handleError(_0x5ddfc9,null));}; \ No newline at end of file +var _0x6b8d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','save','update','destroy','then','error','stack','name','body','Condition','find','params','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','querystring'];(function(_0x21b037,_0x1f310a){var _0x20556c=function(_0x1855a9){while(--_0x1855a9){_0x21b037['push'](_0x21b037['shift']());}};_0x20556c(++_0x1f310a);}(_0x6b8d,0x1cb));var _0xd6b8=function(_0x32e5cb,_0x197d1e){_0x32e5cb=_0x32e5cb-0x0;var _0x4dfba6=_0x6b8d[_0x32e5cb];return _0x4dfba6;};'use strict';var pdf=require(_0xd6b8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd6b8('0x1'));var zipdir=require(_0xd6b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6b8('0x3'));var moment=require(_0xd6b8('0x4'));var BPromise=require(_0xd6b8('0x5'));var Mustache=require(_0xd6b8('0x6'));var util=require(_0xd6b8('0x7'));var path=require(_0xd6b8('0x8'));var sox=require('sox');var csv=require(_0xd6b8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6b8('0xa'));var squel=require(_0xd6b8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd6b8('0xc'));var toCsv=require(_0xd6b8('0x9'));var querystring=require(_0xd6b8('0xd'));var Papa=require(_0xd6b8('0xe'));var Redis=require(_0xd6b8('0xf'));var authService=require(_0xd6b8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd6b8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6b8('0x12'))(_0xd6b8('0x13'));var utils=require(_0xd6b8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd6b8('0x15'));var db=require(_0xd6b8('0x16'))['db'];function respondWithStatusCode(_0x4a0d68,_0x178e8c){_0x178e8c=_0x178e8c||0xcc;return function(_0x32fc6f){if(_0x32fc6f){return _0x4a0d68[_0xd6b8('0x17')](_0x178e8c);}return _0x4a0d68[_0xd6b8('0x18')](_0x178e8c)[_0xd6b8('0x19')]();};}function respondWithResult(_0x21c744,_0x1d2be3){_0x1d2be3=_0x1d2be3||0xc8;return function(_0x44afad){if(_0x44afad){return _0x21c744[_0xd6b8('0x18')](_0x1d2be3)['json'](_0x44afad);}};}function respondWithFilteredResult(_0x9ff2ef,_0x9a43a9){return function(_0x4a637d){if(_0x4a637d){var _0x2b1dc9=_0x4a637d['count'],_0x5c4be2=_0x9a43a9[_0xd6b8('0x1a')],_0x55a271=_0x9a43a9[_0xd6b8('0x1a')]+_0x9a43a9[_0xd6b8('0x1b')],_0x26db7c;if(_0x55a271>=_0x2b1dc9){_0x55a271=_0x2b1dc9;_0x26db7c=0xc8;}else{_0x26db7c=0xce;}_0x9ff2ef['status'](_0x26db7c);return _0x9ff2ef[_0xd6b8('0x1c')]('Content-Range',_0x5c4be2+'-'+_0x55a271+'/'+_0x2b1dc9)[_0xd6b8('0x1d')](_0x4a637d);}return null;};}function patchUpdates(_0x4a8cd0){return function(_0x113139){try{jsonpatch[_0xd6b8('0x1e')](_0x113139,_0x4a8cd0,!![]);}catch(_0x5c2b8a){return BPromise['reject'](_0x5c2b8a);}return _0x113139[_0xd6b8('0x1f')]();};}function saveUpdates(_0x1dfdd1,_0x47977d){return function(_0x44f23c){if(_0x44f23c){return _0x44f23c[_0xd6b8('0x20')](_0x1dfdd1)['then'](function(_0x108806){return _0x108806;});}return null;};}function removeEntity(_0x37bdf6,_0x33a633){return function(_0x5da312){if(_0x5da312){return _0x5da312[_0xd6b8('0x21')]()[_0xd6b8('0x22')](function(){_0x37bdf6[_0xd6b8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155056,_0x22c541){return function(_0x2680cd){if(!_0x2680cd){_0x155056[_0xd6b8('0x17')](0x194);}return _0x2680cd;};}function handleError(_0x1f3c68,_0x16abc5){_0x16abc5=_0x16abc5||0x1f4;return function(_0x322fea){logger[_0xd6b8('0x23')](_0x322fea[_0xd6b8('0x24')]);if(_0x322fea[_0xd6b8('0x25')]){delete _0x322fea[_0xd6b8('0x25')];}_0x1f3c68[_0xd6b8('0x18')](_0x16abc5)['send'](_0x322fea);};}exports[_0xd6b8('0x20')]=function(_0x372950,_0x314447){if(_0x372950['body']['id']){delete _0x372950[_0xd6b8('0x26')]['id'];}return db[_0xd6b8('0x27')][_0xd6b8('0x28')]({'where':{'id':_0x372950[_0xd6b8('0x29')]['id']}})[_0xd6b8('0x22')](handleEntityNotFound(_0x314447,null))[_0xd6b8('0x22')](saveUpdates(_0x372950[_0xd6b8('0x26')],null))['then'](respondWithResult(_0x314447,null))[_0xd6b8('0x2a')](handleError(_0x314447,null));};exports[_0xd6b8('0x21')]=function(_0x470986,_0x40609f){return db[_0xd6b8('0x27')][_0xd6b8('0x28')]({'where':{'id':_0x470986[_0xd6b8('0x29')]['id']}})['then'](handleEntityNotFound(_0x40609f,null))[_0xd6b8('0x22')](removeEntity(_0x40609f,null))['catch'](handleError(_0x40609f,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8f5e674..f8cc6a5 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 _0xf89e=['util','api','bluebird','../../config/environment','./condition.attributes','exports','tools_conditions'];(function(_0x3142b1,_0x3cf732){var _0x35c702=function(_0x2dc01a){while(--_0x2dc01a){_0x3142b1['push'](_0x3142b1['shift']());}};_0x35c702(++_0x3cf732);}(_0xf89e,0xe0));var _0xef89=function(_0x53e46c,_0x367494){_0x53e46c=_0x53e46c-0x0;var _0x4b485a=_0xf89e[_0x53e46c];return _0x4b485a;};'use strict';var _=require('lodash');var util=require(_0xef89('0x0'));var logger=require('../../config/logger')(_0xef89('0x1'));var moment=require('moment');var BPromise=require(_0xef89('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef89('0x3'));var attributes=require(_0xef89('0x4'));module[_0xef89('0x5')]=function(_0xf9ea5f,_0x579339){return _0xf9ea5f['define']('Condition',attributes,{'tableName':_0xef89('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8778=['api','bluebird','path','rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions','lodash','util','../../config/logger'];(function(_0x181d1f,_0x41139d){var _0x25cfdd=function(_0x35d639){while(--_0x35d639){_0x181d1f['push'](_0x181d1f['shift']());}};_0x25cfdd(++_0x41139d);}(_0x8778,0x76));var _0x8877=function(_0x1277b2,_0x358813){_0x1277b2=_0x1277b2-0x0;var _0x564642=_0x8778[_0x1277b2];return _0x564642;};'use strict';var _=require(_0x8877('0x0'));var util=require(_0x8877('0x1'));var logger=require(_0x8877('0x2'))(_0x8877('0x3'));var moment=require('moment');var BPromise=require(_0x8877('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8877('0x5'));var rimraf=require(_0x8877('0x6'));var config=require(_0x8877('0x7'));var attributes=require(_0x8877('0x8'));module['exports']=function(_0x4c2914,_0x17539a){return _0x4c2914['define'](_0x8877('0x9'),attributes,{'tableName':_0x8877('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 9569a19..2a473f3 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 _0x4450=['client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x26af62,_0x3cd9d2){var _0x32a101=function(_0x230cb3){while(--_0x230cb3){_0x26af62['push'](_0x26af62['shift']());}};_0x32a101(++_0x3cd9d2);}(_0x4450,0xe6));var _0x0445=function(_0xec4fb7,_0x5d26ce){_0xec4fb7=_0xec4fb7-0x0;var _0x3e6a97=_0x4450[_0xec4fb7];return _0x3e6a97;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0445('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0445('0x1'));var db=require(_0x0445('0x2'))['db'];var utils=require(_0x0445('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0445('0x4')][_0x0445('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5d9bab,_0x26f56c,_0x435e2d){return new BPromise(function(_0x30cb04,_0x137b73){return client[_0x0445('0x6')](_0x5d9bab,_0x435e2d)[_0x0445('0x7')](function(_0x13ad30){logger['info'](_0x0445('0x8'),_0x26f56c,_0x0445('0x9'));logger[_0x0445('0xa')]('Condition,\x20%s,\x20%s,\x20%s',_0x26f56c,_0x0445('0x9'),JSON[_0x0445('0xb')](_0x13ad30));if(_0x13ad30['error']){if(_0x13ad30[_0x0445('0xc')][_0x0445('0xd')]===0x1f4){logger[_0x0445('0xc')](_0x0445('0x8'),_0x26f56c,_0x13ad30['error'][_0x0445('0xe')]);return _0x137b73(_0x13ad30[_0x0445('0xc')][_0x0445('0xe')]);}logger['error'](_0x0445('0x8'),_0x26f56c,_0x13ad30[_0x0445('0xc')]['message']);return _0x30cb04(_0x13ad30['error'][_0x0445('0xe')]);}else{logger[_0x0445('0xf')]('Condition,\x20%s,\x20%s',_0x26f56c,_0x0445('0x9'));_0x30cb04(_0x13ad30[_0x0445('0x10')][_0x0445('0xe')]);}})[_0x0445('0x11')](function(_0x1a9202){logger[_0x0445('0xc')](_0x0445('0x8'),_0x26f56c,_0x1a9202);_0x137b73(_0x1a9202);});});} \ No newline at end of file +var _0xa62b=['jayson/promise','http','request','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','Condition,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xa62b,0xf0));var _0xba62=function(_0x5966a5,_0x444fd8){_0x5966a5=_0x5966a5-0x0;var _0xa6604e=_0xa62b[_0x5966a5];return _0xa6604e;};'use strict';var _=require('lodash');var util=require(_0xba62('0x0'));var moment=require(_0xba62('0x1'));var BPromise=require(_0xba62('0x2'));var rs=require(_0xba62('0x3'));var fs=require('fs');var Redis=require(_0xba62('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba62('0x5'));var logger=require('../../config/logger')(_0xba62('0x6'));var config=require('../../config/environment');var jayson=require(_0xba62('0x7'));var client=jayson['client'][_0xba62('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xedaa06,_0x820ae,_0x1f7c6b){return new BPromise(function(_0x5d2690,_0x479ae4){return client[_0xba62('0x9')](_0xedaa06,_0x1f7c6b)['then'](function(_0x3aebfb){logger[_0xba62('0xa')]('Condition,\x20%s,\x20%s',_0x820ae,_0xba62('0xb'));logger[_0xba62('0xc')](_0xba62('0xd'),_0x820ae,_0xba62('0xb'),JSON[_0xba62('0xe')](_0x3aebfb));if(_0x3aebfb['error']){if(_0x3aebfb['error']['code']===0x1f4){logger[_0xba62('0xf')](_0xba62('0x10'),_0x820ae,_0x3aebfb[_0xba62('0xf')][_0xba62('0x11')]);return _0x479ae4(_0x3aebfb[_0xba62('0xf')]['message']);}logger[_0xba62('0xf')](_0xba62('0x10'),_0x820ae,_0x3aebfb['error'][_0xba62('0x11')]);return _0x5d2690(_0x3aebfb[_0xba62('0xf')][_0xba62('0x11')]);}else{logger[_0xba62('0xa')](_0xba62('0x10'),_0x820ae,_0xba62('0xb'));_0x5d2690(_0x3aebfb[_0xba62('0x12')][_0xba62('0x11')]);}})['catch'](function(_0x3ccfa5){logger[_0xba62('0xf')](_0xba62('0x10'),_0x820ae,_0x3ccfa5);_0x479ae4(_0x3ccfa5);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 90bf069..c584cd7 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 _0x0042=['/:id','update','delete','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x59b207,_0x1c6fa0){var _0xc7e5e0=function(_0x229840){while(--_0x229840){_0x59b207['push'](_0x59b207['shift']());}};_0xc7e5e0(++_0x1c6fa0);}(_0x0042,0x8d));var _0x2004=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0x0042[_0x3b8f2e];return _0x1433d5;};'use strict';var multer=require('multer');var util=require(_0x2004('0x0'));var path=require(_0x2004('0x1'));var timeout=require(_0x2004('0x2'));var express=require(_0x2004('0x3'));var router=express[_0x2004('0x4')]();var auth=require(_0x2004('0x5'));var interaction=require(_0x2004('0x6'));var config=require(_0x2004('0x7'));var controller=require('./condition.controller');router[_0x2004('0x8')](_0x2004('0x9'),auth['isAuthenticated'](),controller[_0x2004('0xa')]);router[_0x2004('0xb')](_0x2004('0x9'),auth[_0x2004('0xc')](),controller[_0x2004('0xd')]);module[_0x2004('0xe')]=router; \ No newline at end of file +var _0x16ce=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0xc25ffb,_0x22b992){var _0x329370=function(_0x127bc0){while(--_0x127bc0){_0xc25ffb['push'](_0xc25ffb['shift']());}};_0x329370(++_0x22b992);}(_0x16ce,0xf2));var _0xe16c=function(_0x2f2351,_0x1cad2e){_0x2f2351=_0x2f2351-0x0;var _0x5c51c5=_0x16ce[_0x2f2351];return _0x5c51c5;};'use strict';var multer=require(_0xe16c('0x0'));var util=require(_0xe16c('0x1'));var path=require(_0xe16c('0x2'));var timeout=require(_0xe16c('0x3'));var express=require(_0xe16c('0x4'));var router=express[_0xe16c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe16c('0x6'));var config=require(_0xe16c('0x7'));var controller=require(_0xe16c('0x8'));router[_0xe16c('0x9')]('/:id',auth[_0xe16c('0xa')](),controller[_0xe16c('0xb')]);router[_0xe16c('0xc')]('/:id',auth[_0xe16c('0xa')](),controller[_0xe16c('0xd')]);module[_0xe16c('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 0c02d83..ff0853e 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 _0x494e=['sequelize','STRING'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x494e,0xd6));var _0xe494=function(_0x5f0063,_0x21faee){_0x5f0063=_0x5f0063-0x0;var _0x442d8a=_0x494e[_0x5f0063];return _0x442d8a;};'use strict';var Sequelize=require(_0xe494('0x0'));module['exports']={'name':{'type':Sequelize[_0xe494('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x858e=['STRING','sequelize','name'];(function(_0x35ad59,_0x33519a){var _0xd45b8=function(_0x2c2544){while(--_0x2c2544){_0x35ad59['push'](_0x35ad59['shift']());}};_0xd45b8(++_0x33519a);}(_0x858e,0x178));var _0xe858=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0x858e[_0x512550];return _0x19f661;};'use strict';var Sequelize=require(_0xe858('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe858('0x1')},'description':{'type':Sequelize[_0xe858('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d8f40fe..cd7e3a6 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 _0x2028=['apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','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','clone','params','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0x2028,0x1ce));var _0x8202=function(_0x1c96ec,_0x3e55e7){_0x1c96ec=_0x1c96ec-0x0;var _0x53720e=_0x2028[_0x1c96ec];return _0x53720e;};'use strict';var pdf=require(_0x8202('0x0'));var emlformat=require(_0x8202('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8202('0x2'));var jsonpatch=require(_0x8202('0x3'));var rp=require('request-promise');var moment=require(_0x8202('0x4'));var BPromise=require(_0x8202('0x5'));var Mustache=require(_0x8202('0x6'));var util=require(_0x8202('0x7'));var path=require(_0x8202('0x8'));var sox=require('sox');var csv=require(_0x8202('0x9'));var ejs=require(_0x8202('0xa'));var fs=require('fs');var _=require(_0x8202('0xb'));var squel=require(_0x8202('0xc'));var crypto=require('crypto');var jsforce=require(_0x8202('0xd'));var deskjs=require(_0x8202('0xe'));var toCsv=require(_0x8202('0x9'));var querystring=require(_0x8202('0xf'));var Papa=require(_0x8202('0x10'));var Redis=require('ioredis');var authService=require(_0x8202('0x11'));var qs=require(_0x8202('0x12'));var as=require(_0x8202('0x13'));var hardwareService=require(_0x8202('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8202('0x15'));var licenseUtil=require(_0x8202('0x16'));var db=require('../../mysqldb')['db'];config[_0x8202('0x17')]=_[_0x8202('0x18')](config[_0x8202('0x17')],{'host':_0x8202('0x19'),'port':0x18eb});var socket=require(_0x8202('0x1a'))(new Redis(config[_0x8202('0x17')]));require(_0x8202('0x1b'))[_0x8202('0x1c')](socket);function respondWithStatusCode(_0x524d31,_0x5d88f4){_0x5d88f4=_0x5d88f4||0xcc;return function(_0x1f0406){if(_0x1f0406){return _0x524d31[_0x8202('0x1d')](_0x5d88f4);}return _0x524d31['status'](_0x5d88f4)[_0x8202('0x1e')]();};}function respondWithResult(_0x343208,_0x354a19){_0x354a19=_0x354a19||0xc8;return function(_0x57eb18){if(_0x57eb18){return _0x343208[_0x8202('0x1f')](_0x354a19)[_0x8202('0x20')](_0x57eb18);}};}function respondWithFilteredResult(_0x92262,_0x56276d){return function(_0x14a16f){if(_0x14a16f){var _0x4640a9=_0x14a16f[_0x8202('0x21')],_0x2aaaa2=_0x56276d[_0x8202('0x22')],_0x16e58b=_0x56276d[_0x8202('0x22')]+_0x56276d[_0x8202('0x23')],_0x155823;if(_0x16e58b>=_0x4640a9){_0x16e58b=_0x4640a9;_0x155823=0xc8;}else{_0x155823=0xce;}_0x92262[_0x8202('0x1f')](_0x155823);return _0x92262[_0x8202('0x24')](_0x8202('0x25'),_0x2aaaa2+'-'+_0x16e58b+'/'+_0x4640a9)['json'](_0x14a16f);}return null;};}function patchUpdates(_0x5e8a35){return function(_0x271aa4){try{jsonpatch[_0x8202('0x26')](_0x271aa4,_0x5e8a35,!![]);}catch(_0x4220c5){return BPromise[_0x8202('0x27')](_0x4220c5);}return _0x271aa4[_0x8202('0x28')]();};}function saveUpdates(_0x5b5c2d,_0x51cfff){return function(_0x3f4803){if(_0x3f4803){return _0x3f4803[_0x8202('0x29')](_0x5b5c2d)[_0x8202('0x2a')](function(_0x17a186){return _0x17a186;});}return null;};}function removeEntity(_0x3dd428,_0x2c210f){return function(_0x4c8ec8){if(_0x4c8ec8){return _0x4c8ec8[_0x8202('0x2b')]()[_0x8202('0x2a')](function(){var _0xe9c9b6=_0x4c8ec8[_0x8202('0x2c')]({'plain':!![]});var _0x42e526=_0x8202('0x2d');return db[_0x8202('0x2e')][_0x8202('0x2b')]({'where':{'type':_0x42e526,'resourceId':_0xe9c9b6['id']}})[_0x8202('0x2a')](function(){return _0x4c8ec8;});})[_0x8202('0x2a')](function(){_0x3dd428[_0x8202('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4027ac,_0x3891c5){return function(_0x22f355){if(!_0x22f355){_0x4027ac[_0x8202('0x1d')](0x194);}return _0x22f355;};}function handleError(_0x20efb3,_0x2bbe68){_0x2bbe68=_0x2bbe68||0x1f4;return function(_0xdd63c4){logger[_0x8202('0x2f')](_0xdd63c4[_0x8202('0x30')]);if(_0xdd63c4[_0x8202('0x31')]){delete _0xdd63c4['name'];}_0x20efb3[_0x8202('0x1f')](_0x2bbe68)[_0x8202('0x32')](_0xdd63c4);};}exports['index']=function(_0x4aacd0,_0x17984c){var _0x5f3604={},_0x1f71b5={},_0x2e49c2={'count':0x0,'rows':[]};var _0x1c14a8=_[_0x8202('0x33')](db[_0x8202('0x34')][_0x8202('0x35')],function(_0x5a873e){return{'name':_0x5a873e[_0x8202('0x36')],'type':_0x5a873e[_0x8202('0x37')][_0x8202('0x38')]};});_0x1f71b5[_0x8202('0x39')]=_['map'](_0x1c14a8,_0x8202('0x31'));_0x1f71b5['query']=_[_0x8202('0x3a')](_0x4aacd0[_0x8202('0x3b')]);_0x1f71b5[_0x8202('0x3c')]=_[_0x8202('0x3d')](_0x1f71b5['model'],_0x1f71b5[_0x8202('0x3b')]);_0x5f3604[_0x8202('0x3e')]=_[_0x8202('0x3d')](_0x1f71b5[_0x8202('0x39')],qs['fields'](_0x4aacd0[_0x8202('0x3b')][_0x8202('0x3f')]));_0x5f3604['attributes']=_0x5f3604[_0x8202('0x3e')][_0x8202('0x40')]?_0x5f3604[_0x8202('0x3e')]:_0x1f71b5[_0x8202('0x39')];if(!_0x4aacd0['query']['hasOwnProperty']('nolimit')){_0x5f3604[_0x8202('0x23')]=qs[_0x8202('0x23')](_0x4aacd0[_0x8202('0x3b')][_0x8202('0x23')]);_0x5f3604[_0x8202('0x22')]=qs[_0x8202('0x22')](_0x4aacd0[_0x8202('0x3b')][_0x8202('0x22')]);}_0x5f3604[_0x8202('0x41')]=qs[_0x8202('0x42')](_0x4aacd0['query'][_0x8202('0x42')]);_0x5f3604[_0x8202('0x43')]=qs['filters'](_[_0x8202('0x44')](_0x4aacd0[_0x8202('0x3b')],_0x1f71b5[_0x8202('0x3c')]),_0x1c14a8);if(_0x4aacd0[_0x8202('0x3b')][_0x8202('0x45')]){_0x5f3604['where']=_['merge'](_0x5f3604[_0x8202('0x43')],{'$or':_['map'](_0x1c14a8,function(_0x321dbc){if(_0x321dbc['type']!==_0x8202('0x46')){var _0x2bfa87={};_0x2bfa87[_0x321dbc[_0x8202('0x31')]]={'$like':'%'+_0x4aacd0['query'][_0x8202('0x45')]+'%'};return _0x2bfa87;}})});}_0x5f3604=_[_0x8202('0x47')]({},_0x5f3604,_0x4aacd0[_0x8202('0x48')]);var _0x5ee828={'where':_0x5f3604['where']};return db[_0x8202('0x34')]['count'](_0x5ee828)[_0x8202('0x2a')](function(_0x48c45b){_0x2e49c2['count']=_0x48c45b;if(_0x4aacd0[_0x8202('0x3b')][_0x8202('0x49')]){_0x5f3604[_0x8202('0x4a')]=[{'all':!![]}];}return db[_0x8202('0x34')][_0x8202('0x4b')](_0x5f3604);})[_0x8202('0x2a')](function(_0x5e7988){_0x2e49c2[_0x8202('0x4c')]=_0x5e7988;return _0x2e49c2;})[_0x8202('0x2a')](respondWithFilteredResult(_0x17984c,_0x5f3604))[_0x8202('0x4d')](handleError(_0x17984c,null));};exports[_0x8202('0x4e')]=function(_0x1dc618,_0x39273c){var _0x2694d4={'raw':![],'where':{'id':_0x1dc618['params']['id']}},_0x175a82={};_0x175a82['model']=_['keys'](db[_0x8202('0x34')][_0x8202('0x35')]);_0x175a82[_0x8202('0x3b')]=_[_0x8202('0x3a')](_0x1dc618[_0x8202('0x3b')]);_0x175a82['filters']=_['intersection'](_0x175a82[_0x8202('0x39')],_0x175a82[_0x8202('0x3b')]);_0x2694d4[_0x8202('0x3e')]=_['intersection'](_0x175a82[_0x8202('0x39')],qs['fields'](_0x1dc618[_0x8202('0x3b')][_0x8202('0x3f')]));_0x2694d4[_0x8202('0x3e')]=_0x2694d4[_0x8202('0x3e')][_0x8202('0x40')]?_0x2694d4['attributes']:_0x175a82['model'];if(_0x1dc618[_0x8202('0x3b')][_0x8202('0x49')]){_0x2694d4[_0x8202('0x4a')]=[{'all':!![]}];}_0x2694d4=_['merge']({},_0x2694d4,_0x1dc618[_0x8202('0x48')]);return db[_0x8202('0x34')][_0x8202('0x4f')](_0x2694d4)[_0x8202('0x2a')](handleEntityNotFound(_0x39273c,null))[_0x8202('0x2a')](respondWithResult(_0x39273c,null))[_0x8202('0x4d')](handleError(_0x39273c,null));};exports['create']=function(_0x170d7b,_0x31ffaf){return db[_0x8202('0x34')][_0x8202('0x50')](_0x170d7b[_0x8202('0x51')],{})[_0x8202('0x2a')](function(_0xd76336){var _0x1f36e4=_0x170d7b[_0x8202('0x52')]['get']({'plain':!![]});if(!_0x1f36e4)throw new Error(_0x8202('0x53'));if(_0x1f36e4[_0x8202('0x54')]==='user'){var _0xfbca3=_0xd76336[_0x8202('0x2c')]({'plain':!![]});var _0x422930=_0x8202('0x2d');return db[_0x8202('0x55')][_0x8202('0x4f')]({'where':{'name':_0x422930,'userProfileId':_0x1f36e4[_0x8202('0x56')]},'raw':!![]})[_0x8202('0x2a')](function(_0x4ef45c){if(_0x4ef45c&&_0x4ef45c[_0x8202('0x57')]===0x0){return db[_0x8202('0x2e')][_0x8202('0x50')]({'name':_0xfbca3[_0x8202('0x31')],'resourceId':_0xfbca3['id'],'type':_0x4ef45c[_0x8202('0x31')],'sectionId':_0x4ef45c['id']},{})[_0x8202('0x2a')](function(){return _0xd76336;});}else{return _0xd76336;}})['catch'](function(_0x180fde){logger[_0x8202('0x2f')](_0x8202('0x58'),_0x180fde);throw _0x180fde;});}return _0xd76336;})[_0x8202('0x2a')](respondWithResult(_0x31ffaf,0xc9))[_0x8202('0x4d')](handleError(_0x31ffaf,null));};exports[_0x8202('0x59')]=function(_0x29cf17,_0x31d830){var _0x5a9395={'where':{'id':_0x29cf17[_0x8202('0x5a')]['id']}},_0x1131d7={};_0x1131d7['model']=_[_0x8202('0x3a')](db[_0x8202('0x34')][_0x8202('0x35')]);_0x5a9395[_0x8202('0x3e')]=_[_0x8202('0x3d')](_0x1131d7[_0x8202('0x39')],qs['fields'](_0x29cf17[_0x8202('0x3b')]['fields']));_0x5a9395['attributes']=_0x5a9395['attributes']['length']?_0x5a9395[_0x8202('0x3e')]:_0x1131d7['model'];if(_0x29cf17[_0x8202('0x3b')][_0x8202('0x49')]){_0x5a9395[_0x8202('0x4a')]=[{'all':!![]}];}_0x5a9395=_[_0x8202('0x47')]({},_0x5a9395,_0x29cf17['options']);return db['Dashboard'][_0x8202('0x4f')](_0x5a9395)[_0x8202('0x2a')](handleEntityNotFound(_0x31d830,null))[_0x8202('0x2a')](function(_0x2ba053){if(_0x2ba053){var _0x82c138=_0x2ba053[_0x8202('0x2c')]({'plain':!![]});_0x82c138=qs[_0x8202('0x5b')](_0x82c138,['id',_0x8202('0x5c'),_0x8202('0x5d')]);_0x29cf17[_0x8202('0x51')]=_[_0x8202('0x5b')](_0x29cf17[_0x8202('0x51')],['id',_0x8202('0x5c'),'updatedAt']);return db[_0x8202('0x34')][_0x8202('0x50')](_[_0x8202('0x47')](_0x82c138,_0x29cf17[_0x8202('0x51')]),{'include':_0x29cf17[_0x8202('0x3b')][_0x8202('0x49')]?[{'all':!![]}]:undefined})[_0x8202('0x2a')](function(_0x2cabd5){var _0x3e33f3=_0x29cf17[_0x8202('0x52')][_0x8202('0x2c')]({'plain':!![]});if(!_0x3e33f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e33f3[_0x8202('0x54')]==='user'){var _0xe2a6a=_0x2cabd5[_0x8202('0x2c')]({'plain':!![]});var _0x46e5dc=_0x8202('0x2d');return db[_0x8202('0x55')][_0x8202('0x4f')]({'where':{'name':_0x46e5dc,'userProfileId':_0x3e33f3[_0x8202('0x56')]},'raw':!![]})[_0x8202('0x2a')](function(_0x52f891){if(_0x52f891&&_0x52f891[_0x8202('0x57')]===0x0){return db[_0x8202('0x2e')][_0x8202('0x50')]({'name':_0xe2a6a[_0x8202('0x31')],'resourceId':_0xe2a6a['id'],'type':_0x52f891[_0x8202('0x31')],'sectionId':_0x52f891['id']},{})[_0x8202('0x2a')](function(){return _0x2cabd5;});}else{return _0x2cabd5;}})[_0x8202('0x4d')](function(_0x13709f){logger[_0x8202('0x2f')](_0x8202('0x58'),_0x13709f);throw _0x13709f;});}return _0x2cabd5;});}})[_0x8202('0x2a')](respondWithResult(_0x31d830,0xc9))[_0x8202('0x4d')](handleError(_0x31d830,null));};exports[_0x8202('0x29')]=function(_0x312983,_0x2092a2){if(_0x312983[_0x8202('0x51')]['id']){delete _0x312983[_0x8202('0x51')]['id'];}return db[_0x8202('0x34')][_0x8202('0x4f')]({'where':{'id':_0x312983['params']['id']}})[_0x8202('0x2a')](handleEntityNotFound(_0x2092a2,null))[_0x8202('0x2a')](saveUpdates(_0x312983[_0x8202('0x51')],null))[_0x8202('0x2a')](respondWithResult(_0x2092a2,null))['catch'](handleError(_0x2092a2,null));};exports[_0x8202('0x2b')]=function(_0x59874a,_0x1258f9){return db[_0x8202('0x34')]['find']({'where':{'id':_0x59874a['params']['id']}})[_0x8202('0x2a')](handleEntityNotFound(_0x1258f9,null))[_0x8202('0x2a')](removeEntity(_0x1258f9,null))[_0x8202('0x4d')](handleError(_0x1258f9,null));};function widgetAttributes(_0x1f513c){try{switch(_0x1f513c['type']){case _0x8202('0x5e'):return[{'name':'attrUrl','value':_0x1f513c[_0x8202('0x5f')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x0]?_0x1f513c[_0x8202('0x60')][0x0][_0x8202('0x61')]:undefined)||_0x8202('0x62')}];case'custom':return[{'name':'attrPath','value':_0x1f513c[_0x8202('0x63')]||(_0x1f513c['attrs']&&_0x1f513c[_0x8202('0x60')][0x0]?_0x1f513c['attrs'][0x0][_0x8202('0x61')]:undefined)||''}];case _0x8202('0x64'):return[{'name':_0x8202('0x65'),'value':_0x1f513c[_0x8202('0x65')]||(_0x1f513c['attrs']&&_0x1f513c[_0x8202('0x60')][0x0]?_0x1f513c[_0x8202('0x60')][0x0][_0x8202('0x61')]:undefined)||_0x8202('0x66')},{'name':_0x8202('0x67'),'value':_0x1f513c[_0x8202('0x67')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c['attrs'][0x1]?_0x1f513c[_0x8202('0x60')][0x1]['value']:undefined)||_0x8202('0x68')},{'name':_0x8202('0x69'),'value':_0x1f513c[_0x8202('0x69')]||(_0x1f513c['attrs']&&_0x1f513c[_0x8202('0x60')][0x2]?_0x1f513c[_0x8202('0x60')][0x2][_0x8202('0x61')]:undefined)||0xc}];case _0x8202('0x6a'):return[{'name':_0x8202('0x6b'),'value':_0x1f513c[_0x8202('0x6b')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x0]?_0x1f513c[_0x8202('0x60')][0x0]['value']:undefined)||_0x8202('0x6c')},{'name':_0x8202('0x6d'),'value':_0x1f513c['attrVoiceQueues']||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c['attrs'][0x1]?_0x1f513c[_0x8202('0x60')][0x1][_0x8202('0x61')]:undefined)||[]},{'name':_0x8202('0x69'),'value':_0x1f513c[_0x8202('0x69')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x2]?_0x1f513c[_0x8202('0x60')][0x2][_0x8202('0x61')]:undefined)||0x14}];case _0x8202('0x6e'):case'pie-chart':return[{'name':_0x8202('0x6f'),'value':_0x1f513c['attrSerie1']||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x0]?_0x1f513c['attrs'][0x0]['value']:undefined)||_0x8202('0x6c')},{'name':'attrSerie2','value':_0x1f513c[_0x8202('0x70')]||(_0x1f513c['attrs']&&_0x1f513c[_0x8202('0x60')][0x1]?_0x1f513c[_0x8202('0x60')][0x1]['value']:undefined)||null},{'name':_0x8202('0x71'),'value':_0x1f513c[_0x8202('0x71')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x2]?_0x1f513c[_0x8202('0x60')][0x2]['value']:undefined)||null},{'name':_0x8202('0x6d'),'value':_0x1f513c[_0x8202('0x6d')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x3]?_0x1f513c[_0x8202('0x60')][0x3][_0x8202('0x61')]:undefined)||[]}];case _0x8202('0x72'):return[{'name':_0x8202('0x73'),'type':_0x1f513c[_0x8202('0x74')]||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c[_0x8202('0x60')][0x0]?_0x1f513c[_0x8202('0x60')][0x0][_0x8202('0x37')]:undefined)||null,'value':_0x1f513c['attrReport']||(_0x1f513c[_0x8202('0x60')]&&_0x1f513c['attrs'][0x0]?_0x1f513c[_0x8202('0x60')][0x0][_0x8202('0x61')]:undefined)||null},{'name':_0x8202('0x75'),'value':_0x1f513c[_0x8202('0x75')]||(_0x1f513c['attrs']&&_0x1f513c[_0x8202('0x60')][0x1]?_0x1f513c[_0x8202('0x60')][0x1][_0x8202('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x755c8d){logger[_0x8202('0x2f')](_0x8202('0x76'),JSON[_0x8202('0x77')](_0x755c8d));return[];}}exports[_0x8202('0x78')]=function(_0x4dee37,_0x185003,_0x1e0c97){if(_0x4dee37['body']['id']){delete _0x4dee37[_0x8202('0x51')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4dee37[_0x8202('0x5a')]['id']}})['then'](handleEntityNotFound(_0x185003,null))[_0x8202('0x2a')](function(_0x16970e){if(_0x16970e){_0x4dee37['body']['DashboardId']=_0x16970e['id'];_0x4dee37['body'][_0x8202('0x60')]=widgetAttributes(_0x4dee37[_0x8202('0x51')]);return db[_0x8202('0x79')][_0x8202('0x50')](_0x4dee37[_0x8202('0x51')]);}})[_0x8202('0x2a')](respondWithResult(_0x185003,null))['catch'](handleError(_0x185003,null));};exports[_0x8202('0x7a')]=function(_0x142854,_0x1c1027,_0x2f956c){var _0x14a899={};var _0xcf2e5f={};var _0x5ea408;var _0x102348;return db[_0x8202('0x34')][_0x8202('0x7b')]({'where':{'id':_0x142854[_0x8202('0x5a')]['id']}})[_0x8202('0x2a')](handleEntityNotFound(_0x1c1027,null))['then'](function(_0x221378){if(_0x221378){_0x5ea408=_0x221378;_0xcf2e5f['model']=_[_0x8202('0x3a')](db['DashboardItem'][_0x8202('0x35')]);_0xcf2e5f[_0x8202('0x3b')]=_[_0x8202('0x3a')](_0x142854['query']);_0xcf2e5f[_0x8202('0x3c')]=_[_0x8202('0x3d')](_0xcf2e5f[_0x8202('0x39')],_0xcf2e5f[_0x8202('0x3b')]);_0x14a899[_0x8202('0x3e')]=_['intersection'](_0xcf2e5f[_0x8202('0x39')],qs[_0x8202('0x3f')](_0x142854['query'][_0x8202('0x3f')]));_0x14a899[_0x8202('0x3e')]=_0x14a899[_0x8202('0x3e')][_0x8202('0x40')]?_0x14a899[_0x8202('0x3e')]:_0xcf2e5f['model'];_0x14a899[_0x8202('0x41')]=qs[_0x8202('0x42')](_0x142854['query'][_0x8202('0x42')]);_0x14a899[_0x8202('0x43')]=qs[_0x8202('0x3c')](_[_0x8202('0x44')](_0x142854[_0x8202('0x3b')],_0xcf2e5f['filters']));if(_0x142854[_0x8202('0x3b')][_0x8202('0x45')]){_0x14a899[_0x8202('0x43')]=_[_0x8202('0x47')](_0x14a899[_0x8202('0x43')],{'$or':_[_0x8202('0x33')](_0x14a899[_0x8202('0x3e')],function(_0xb42905){var _0x5350de={};_0x5350de[_0xb42905]={'$like':'%'+_0x142854['query'][_0x8202('0x45')]+'%'};return _0x5350de;})});}_0x14a899=_[_0x8202('0x47')]({},_0x14a899,_0x142854[_0x8202('0x48')]);return _0x5ea408[_0x8202('0x7a')](_0x14a899);}})[_0x8202('0x2a')](function(_0x15b21a){if(_0x15b21a){_0x102348=_0x15b21a[_0x8202('0x40')];if(!_0x142854[_0x8202('0x3b')][_0x8202('0x7c')]('nolimit')){_0x14a899['limit']=qs[_0x8202('0x23')](_0x142854[_0x8202('0x3b')][_0x8202('0x23')]);_0x14a899[_0x8202('0x22')]=qs['offset'](_0x142854['query'][_0x8202('0x22')]);}return _0x5ea408[_0x8202('0x7a')](_0x14a899);}})[_0x8202('0x2a')](function(_0x350cc3){if(_0x350cc3){return _0x350cc3?{'count':_0x102348,'rows':_0x350cc3}:null;}})[_0x8202('0x2a')](respondWithResult(_0x1c1027,null))[_0x8202('0x4d')](handleError(_0x1c1027,null));}; \ No newline at end of file +var _0x9cbf=['model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','DashboardItem','order','getItems','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','map','Dashboard','rawAttributes','type','key'];(function(_0x38e5ce,_0x17771d){var _0x4ca74e=function(_0x58066e){while(--_0x58066e){_0x38e5ce['push'](_0x38e5ce['shift']());}};_0x4ca74e(++_0x17771d);}(_0x9cbf,0x1ba));var _0xf9cb=function(_0x194b4f,_0x488aa3){_0x194b4f=_0x194b4f-0x0;var _0x39dfea=_0x9cbf[_0x194b4f];return _0x39dfea;};'use strict';var pdf=require(_0xf9cb('0x0'));var emlformat=require(_0xf9cb('0x1'));var rimraf=require(_0xf9cb('0x2'));var zipdir=require(_0xf9cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9cb('0x4'));var moment=require(_0xf9cb('0x5'));var BPromise=require(_0xf9cb('0x6'));var Mustache=require(_0xf9cb('0x7'));var util=require(_0xf9cb('0x8'));var path=require(_0xf9cb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf9cb('0xa'));var fs=require('fs');var _=require(_0xf9cb('0xb'));var squel=require(_0xf9cb('0xc'));var crypto=require(_0xf9cb('0xd'));var jsforce=require(_0xf9cb('0xe'));var deskjs=require(_0xf9cb('0xf'));var toCsv=require(_0xf9cb('0x10'));var querystring=require('querystring');var Papa=require(_0xf9cb('0x11'));var Redis=require(_0xf9cb('0x12'));var authService=require(_0xf9cb('0x13'));var qs=require(_0xf9cb('0x14'));var as=require(_0xf9cb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9cb('0x16'))(_0xf9cb('0x17'));var utils=require('../../config/utils');var config=require(_0xf9cb('0x18'));var licenseUtil=require(_0xf9cb('0x19'));var db=require(_0xf9cb('0x1a'))['db'];config[_0xf9cb('0x1b')]=_[_0xf9cb('0x1c')](config[_0xf9cb('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9cb('0x1d'))(new Redis(config[_0xf9cb('0x1b')]));require(_0xf9cb('0x1e'))[_0xf9cb('0x1f')](socket);function respondWithStatusCode(_0x42ea0b,_0x5afd82){_0x5afd82=_0x5afd82||0xcc;return function(_0x3fe002){if(_0x3fe002){return _0x42ea0b[_0xf9cb('0x20')](_0x5afd82);}return _0x42ea0b[_0xf9cb('0x21')](_0x5afd82)[_0xf9cb('0x22')]();};}function respondWithResult(_0x5d5a9d,_0x5dbf69){_0x5dbf69=_0x5dbf69||0xc8;return function(_0x5168bc){if(_0x5168bc){return _0x5d5a9d['status'](_0x5dbf69)[_0xf9cb('0x23')](_0x5168bc);}};}function respondWithFilteredResult(_0x35d7ff,_0x3939e5){return function(_0x2550cc){if(_0x2550cc){var _0x35f5fe=_0x2550cc[_0xf9cb('0x24')],_0x2df804=_0x3939e5[_0xf9cb('0x25')],_0x40cb2a=_0x3939e5['offset']+_0x3939e5[_0xf9cb('0x26')],_0x5a0e3a;if(_0x40cb2a>=_0x35f5fe){_0x40cb2a=_0x35f5fe;_0x5a0e3a=0xc8;}else{_0x5a0e3a=0xce;}_0x35d7ff[_0xf9cb('0x21')](_0x5a0e3a);return _0x35d7ff[_0xf9cb('0x27')]('Content-Range',_0x2df804+'-'+_0x40cb2a+'/'+_0x35f5fe)[_0xf9cb('0x23')](_0x2550cc);}return null;};}function patchUpdates(_0x4a96c5){return function(_0x46ae01){try{jsonpatch[_0xf9cb('0x28')](_0x46ae01,_0x4a96c5,!![]);}catch(_0x593084){return BPromise[_0xf9cb('0x29')](_0x593084);}return _0x46ae01[_0xf9cb('0x2a')]();};}function saveUpdates(_0x10f633,_0x120d7c){return function(_0x20ca57){if(_0x20ca57){return _0x20ca57[_0xf9cb('0x2b')](_0x10f633)[_0xf9cb('0x2c')](function(_0x236bd3){return _0x236bd3;});}return null;};}function removeEntity(_0xb06826,_0x3de09d){return function(_0x3c6744){if(_0x3c6744){return _0x3c6744['destroy']()[_0xf9cb('0x2c')](function(){var _0x440bae=_0x3c6744[_0xf9cb('0x2d')]({'plain':!![]});var _0x29750d=_0xf9cb('0x2e');return db[_0xf9cb('0x2f')][_0xf9cb('0x30')]({'where':{'type':_0x29750d,'resourceId':_0x440bae['id']}})[_0xf9cb('0x2c')](function(){return _0x3c6744;});})[_0xf9cb('0x2c')](function(){_0xb06826[_0xf9cb('0x21')](0xcc)[_0xf9cb('0x22')]();});}};}function handleEntityNotFound(_0x1f1240,_0x3cb91d){return function(_0x5cc052){if(!_0x5cc052){_0x1f1240['sendStatus'](0x194);}return _0x5cc052;};}function handleError(_0x12308e,_0x575e06){_0x575e06=_0x575e06||0x1f4;return function(_0x26a378){logger[_0xf9cb('0x31')](_0x26a378[_0xf9cb('0x32')]);if(_0x26a378[_0xf9cb('0x33')]){delete _0x26a378[_0xf9cb('0x33')];}_0x12308e['status'](_0x575e06)[_0xf9cb('0x34')](_0x26a378);};}exports['index']=function(_0x552c16,_0x5acd8e){var _0x4b0bd7={},_0x1b081f={},_0x2b7ed9={'count':0x0,'rows':[]};var _0x287f4c=_[_0xf9cb('0x35')](db[_0xf9cb('0x36')][_0xf9cb('0x37')],function(_0x19d170){return{'name':_0x19d170['fieldName'],'type':_0x19d170[_0xf9cb('0x38')][_0xf9cb('0x39')]};});_0x1b081f[_0xf9cb('0x3a')]=_[_0xf9cb('0x35')](_0x287f4c,_0xf9cb('0x33'));_0x1b081f['query']=_['keys'](_0x552c16['query']);_0x1b081f[_0xf9cb('0x3b')]=_[_0xf9cb('0x3c')](_0x1b081f[_0xf9cb('0x3a')],_0x1b081f['query']);_0x4b0bd7[_0xf9cb('0x3d')]=_[_0xf9cb('0x3c')](_0x1b081f[_0xf9cb('0x3a')],qs['fields'](_0x552c16[_0xf9cb('0x3e')][_0xf9cb('0x3f')]));_0x4b0bd7[_0xf9cb('0x3d')]=_0x4b0bd7[_0xf9cb('0x3d')][_0xf9cb('0x40')]?_0x4b0bd7['attributes']:_0x1b081f[_0xf9cb('0x3a')];if(!_0x552c16['query'][_0xf9cb('0x41')](_0xf9cb('0x42'))){_0x4b0bd7[_0xf9cb('0x26')]=qs['limit'](_0x552c16['query'][_0xf9cb('0x26')]);_0x4b0bd7['offset']=qs[_0xf9cb('0x25')](_0x552c16[_0xf9cb('0x3e')]['offset']);}_0x4b0bd7['order']=qs[_0xf9cb('0x43')](_0x552c16[_0xf9cb('0x3e')][_0xf9cb('0x43')]);_0x4b0bd7[_0xf9cb('0x44')]=qs['filters'](_[_0xf9cb('0x45')](_0x552c16[_0xf9cb('0x3e')],_0x1b081f[_0xf9cb('0x3b')]),_0x287f4c);if(_0x552c16[_0xf9cb('0x3e')]['filter']){_0x4b0bd7['where']=_[_0xf9cb('0x46')](_0x4b0bd7[_0xf9cb('0x44')],{'$or':_['map'](_0x287f4c,function(_0x34f11b){if(_0x34f11b[_0xf9cb('0x38')]!==_0xf9cb('0x47')){var _0x13aee7={};_0x13aee7[_0x34f11b[_0xf9cb('0x33')]]={'$like':'%'+_0x552c16[_0xf9cb('0x3e')][_0xf9cb('0x48')]+'%'};return _0x13aee7;}})});}_0x4b0bd7=_[_0xf9cb('0x46')]({},_0x4b0bd7,_0x552c16[_0xf9cb('0x49')]);var _0x13964b={'where':_0x4b0bd7[_0xf9cb('0x44')]};return db[_0xf9cb('0x36')][_0xf9cb('0x24')](_0x13964b)[_0xf9cb('0x2c')](function(_0xae2747){_0x2b7ed9[_0xf9cb('0x24')]=_0xae2747;if(_0x552c16[_0xf9cb('0x3e')]['includeAll']){_0x4b0bd7[_0xf9cb('0x4a')]=[{'all':!![]}];}return db['Dashboard'][_0xf9cb('0x4b')](_0x4b0bd7);})[_0xf9cb('0x2c')](function(_0x5aefe5){_0x2b7ed9['rows']=_0x5aefe5;return _0x2b7ed9;})[_0xf9cb('0x2c')](respondWithFilteredResult(_0x5acd8e,_0x4b0bd7))[_0xf9cb('0x4c')](handleError(_0x5acd8e,null));};exports['show']=function(_0x8b59d2,_0xb337a4){var _0x4565df={'raw':![],'where':{'id':_0x8b59d2[_0xf9cb('0x4d')]['id']}},_0x4dfaaf={};_0x4dfaaf['model']=_['keys'](db[_0xf9cb('0x36')][_0xf9cb('0x37')]);_0x4dfaaf['query']=_[_0xf9cb('0x4e')](_0x8b59d2[_0xf9cb('0x3e')]);_0x4dfaaf[_0xf9cb('0x3b')]=_[_0xf9cb('0x3c')](_0x4dfaaf[_0xf9cb('0x3a')],_0x4dfaaf[_0xf9cb('0x3e')]);_0x4565df[_0xf9cb('0x3d')]=_[_0xf9cb('0x3c')](_0x4dfaaf[_0xf9cb('0x3a')],qs['fields'](_0x8b59d2[_0xf9cb('0x3e')]['fields']));_0x4565df[_0xf9cb('0x3d')]=_0x4565df[_0xf9cb('0x3d')][_0xf9cb('0x40')]?_0x4565df[_0xf9cb('0x3d')]:_0x4dfaaf[_0xf9cb('0x3a')];if(_0x8b59d2[_0xf9cb('0x3e')][_0xf9cb('0x4f')]){_0x4565df[_0xf9cb('0x4a')]=[{'all':!![]}];}_0x4565df=_['merge']({},_0x4565df,_0x8b59d2['options']);return db[_0xf9cb('0x36')][_0xf9cb('0x50')](_0x4565df)[_0xf9cb('0x2c')](handleEntityNotFound(_0xb337a4,null))[_0xf9cb('0x2c')](respondWithResult(_0xb337a4,null))[_0xf9cb('0x4c')](handleError(_0xb337a4,null));};exports[_0xf9cb('0x51')]=function(_0xa8c6f9,_0x4972e9){return db['Dashboard'][_0xf9cb('0x51')](_0xa8c6f9['body'],{})[_0xf9cb('0x2c')](function(_0xa0bc94){var _0x14e15b=_0xa8c6f9[_0xf9cb('0x52')]['get']({'plain':!![]});if(!_0x14e15b)throw new Error(_0xf9cb('0x53'));if(_0x14e15b[_0xf9cb('0x54')]===_0xf9cb('0x52')){var _0x1949b1=_0xa0bc94[_0xf9cb('0x2d')]({'plain':!![]});var _0x280fc3='CustomDashboards';return db[_0xf9cb('0x55')][_0xf9cb('0x50')]({'where':{'name':_0x280fc3,'userProfileId':_0x14e15b[_0xf9cb('0x56')]},'raw':!![]})[_0xf9cb('0x2c')](function(_0x12319b){if(_0x12319b&&_0x12319b[_0xf9cb('0x57')]===0x0){return db[_0xf9cb('0x2f')]['create']({'name':_0x1949b1[_0xf9cb('0x33')],'resourceId':_0x1949b1['id'],'type':_0x12319b[_0xf9cb('0x33')],'sectionId':_0x12319b['id']},{})[_0xf9cb('0x2c')](function(){return _0xa0bc94;});}else{return _0xa0bc94;}})[_0xf9cb('0x4c')](function(_0x557506){logger[_0xf9cb('0x31')](_0xf9cb('0x58'),_0x557506);throw _0x557506;});}return _0xa0bc94;})[_0xf9cb('0x2c')](respondWithResult(_0x4972e9,0xc9))[_0xf9cb('0x4c')](handleError(_0x4972e9,null));};exports[_0xf9cb('0x59')]=function(_0x12b5b0,_0x50afab){var _0x4eab82={'where':{'id':_0x12b5b0[_0xf9cb('0x4d')]['id']}},_0xa12b63={};_0xa12b63['model']=_[_0xf9cb('0x4e')](db['Dashboard'][_0xf9cb('0x37')]);_0x4eab82['attributes']=_[_0xf9cb('0x3c')](_0xa12b63[_0xf9cb('0x3a')],qs['fields'](_0x12b5b0['query']['fields']));_0x4eab82['attributes']=_0x4eab82['attributes']['length']?_0x4eab82['attributes']:_0xa12b63['model'];if(_0x12b5b0['query'][_0xf9cb('0x4f')]){_0x4eab82[_0xf9cb('0x4a')]=[{'all':!![]}];}_0x4eab82=_['merge']({},_0x4eab82,_0x12b5b0['options']);return db[_0xf9cb('0x36')][_0xf9cb('0x50')](_0x4eab82)[_0xf9cb('0x2c')](handleEntityNotFound(_0x50afab,null))[_0xf9cb('0x2c')](function(_0x5d0a29){if(_0x5d0a29){var _0x27577d=_0x5d0a29[_0xf9cb('0x2d')]({'plain':!![]});_0x27577d=qs[_0xf9cb('0x5a')](_0x27577d,['id','createdAt',_0xf9cb('0x5b')]);_0x12b5b0['body']=_['omit'](_0x12b5b0[_0xf9cb('0x5c')],['id',_0xf9cb('0x5d'),'updatedAt']);return db[_0xf9cb('0x36')]['create'](_[_0xf9cb('0x46')](_0x27577d,_0x12b5b0[_0xf9cb('0x5c')]),{'include':_0x12b5b0[_0xf9cb('0x3e')][_0xf9cb('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x4beb56){var _0x4e9c69=_0x12b5b0[_0xf9cb('0x52')][_0xf9cb('0x2d')]({'plain':!![]});if(!_0x4e9c69)throw new Error(_0xf9cb('0x53'));if(_0x4e9c69[_0xf9cb('0x54')]===_0xf9cb('0x52')){var _0x3269aa=_0x4beb56[_0xf9cb('0x2d')]({'plain':!![]});var _0x523e91='CustomDashboards';return db[_0xf9cb('0x55')][_0xf9cb('0x50')]({'where':{'name':_0x523e91,'userProfileId':_0x4e9c69[_0xf9cb('0x56')]},'raw':!![]})[_0xf9cb('0x2c')](function(_0x272553){if(_0x272553&&_0x272553['autoAssociation']===0x0){return db['UserProfileResource'][_0xf9cb('0x51')]({'name':_0x3269aa[_0xf9cb('0x33')],'resourceId':_0x3269aa['id'],'type':_0x272553['name'],'sectionId':_0x272553['id']},{})[_0xf9cb('0x2c')](function(){return _0x4beb56;});}else{return _0x4beb56;}})['catch'](function(_0x3881a2){logger[_0xf9cb('0x31')](_0xf9cb('0x58'),_0x3881a2);throw _0x3881a2;});}return _0x4beb56;});}})[_0xf9cb('0x2c')](respondWithResult(_0x50afab,0xc9))[_0xf9cb('0x4c')](handleError(_0x50afab,null));};exports[_0xf9cb('0x2b')]=function(_0x53dfc3,_0x3b02a6){if(_0x53dfc3[_0xf9cb('0x5c')]['id']){delete _0x53dfc3[_0xf9cb('0x5c')]['id'];}return db['Dashboard'][_0xf9cb('0x50')]({'where':{'id':_0x53dfc3[_0xf9cb('0x4d')]['id']}})[_0xf9cb('0x2c')](handleEntityNotFound(_0x3b02a6,null))[_0xf9cb('0x2c')](saveUpdates(_0x53dfc3['body'],null))['then'](respondWithResult(_0x3b02a6,null))['catch'](handleError(_0x3b02a6,null));};exports[_0xf9cb('0x30')]=function(_0x3f4620,_0x8509b5){return db[_0xf9cb('0x36')]['find']({'where':{'id':_0x3f4620[_0xf9cb('0x4d')]['id']}})[_0xf9cb('0x2c')](handleEntityNotFound(_0x8509b5,null))['then'](removeEntity(_0x8509b5,null))[_0xf9cb('0x4c')](handleError(_0x8509b5,null));};function widgetAttributes(_0x4650a7){try{switch(_0x4650a7['type']){case _0xf9cb('0x5e'):return[{'name':'attrUrl','value':_0x4650a7[_0xf9cb('0x5f')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x0]?_0x4650a7[_0xf9cb('0x60')][0x0][_0xf9cb('0x61')]:undefined)||_0xf9cb('0x62')}];case _0xf9cb('0x63'):return[{'name':'attrPath','value':_0x4650a7[_0xf9cb('0x64')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7['attrs'][0x0]?_0x4650a7[_0xf9cb('0x60')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xf9cb('0x65'),'value':_0x4650a7[_0xf9cb('0x65')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x0]?_0x4650a7[_0xf9cb('0x60')][0x0][_0xf9cb('0x61')]:undefined)||_0xf9cb('0x66')},{'name':_0xf9cb('0x67'),'value':_0x4650a7[_0xf9cb('0x67')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x1]?_0x4650a7[_0xf9cb('0x60')][0x1][_0xf9cb('0x61')]:undefined)||_0xf9cb('0x68')},{'name':_0xf9cb('0x69'),'value':_0x4650a7[_0xf9cb('0x69')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x2]?_0x4650a7[_0xf9cb('0x60')][0x2][_0xf9cb('0x61')]:undefined)||0xc}];case _0xf9cb('0x6a'):return[{'name':_0xf9cb('0x6b'),'value':_0x4650a7['attrMetric']||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x0]?_0x4650a7[_0xf9cb('0x60')][0x0][_0xf9cb('0x61')]:undefined)||_0xf9cb('0x6c')},{'name':_0xf9cb('0x6d'),'value':_0x4650a7[_0xf9cb('0x6d')]||(_0x4650a7['attrs']&&_0x4650a7[_0xf9cb('0x60')][0x1]?_0x4650a7[_0xf9cb('0x60')][0x1]['value']:undefined)||[]},{'name':_0xf9cb('0x69'),'value':_0x4650a7[_0xf9cb('0x69')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x2]?_0x4650a7['attrs'][0x2][_0xf9cb('0x61')]:undefined)||0x14}];case _0xf9cb('0x6e'):case _0xf9cb('0x6f'):return[{'name':_0xf9cb('0x70'),'value':_0x4650a7[_0xf9cb('0x70')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x0]?_0x4650a7[_0xf9cb('0x60')][0x0][_0xf9cb('0x61')]:undefined)||_0xf9cb('0x6c')},{'name':_0xf9cb('0x71'),'value':_0x4650a7['attrSerie2']||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x1]?_0x4650a7[_0xf9cb('0x60')][0x1][_0xf9cb('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x4650a7[_0xf9cb('0x72')]||(_0x4650a7['attrs']&&_0x4650a7[_0xf9cb('0x60')][0x2]?_0x4650a7[_0xf9cb('0x60')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x4650a7[_0xf9cb('0x6d')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x3]?_0x4650a7[_0xf9cb('0x60')][0x3][_0xf9cb('0x61')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4650a7['reportType']||(_0x4650a7['attrs']&&_0x4650a7[_0xf9cb('0x60')][0x0]?_0x4650a7[_0xf9cb('0x60')][0x0][_0xf9cb('0x38')]:undefined)||null,'value':_0x4650a7[_0xf9cb('0x73')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7['attrs'][0x0]?_0x4650a7['attrs'][0x0]['value']:undefined)||null},{'name':_0xf9cb('0x74'),'value':_0x4650a7[_0xf9cb('0x74')]||(_0x4650a7[_0xf9cb('0x60')]&&_0x4650a7[_0xf9cb('0x60')][0x1]?_0x4650a7[_0xf9cb('0x60')][0x1][_0xf9cb('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x2d9776){logger[_0xf9cb('0x31')](_0xf9cb('0x75'),JSON[_0xf9cb('0x76')](_0x2d9776));return[];}}exports[_0xf9cb('0x77')]=function(_0x50fbcb,_0x56ee13,_0x29ec36){if(_0x50fbcb[_0xf9cb('0x5c')]['id']){delete _0x50fbcb[_0xf9cb('0x5c')]['id'];}return db[_0xf9cb('0x36')][_0xf9cb('0x50')]({'where':{'id':_0x50fbcb[_0xf9cb('0x4d')]['id']}})[_0xf9cb('0x2c')](handleEntityNotFound(_0x56ee13,null))[_0xf9cb('0x2c')](function(_0x4b352b){if(_0x4b352b){_0x50fbcb[_0xf9cb('0x5c')][_0xf9cb('0x78')]=_0x4b352b['id'];_0x50fbcb[_0xf9cb('0x5c')][_0xf9cb('0x60')]=widgetAttributes(_0x50fbcb['body']);return db['DashboardItem'][_0xf9cb('0x51')](_0x50fbcb[_0xf9cb('0x5c')]);}})[_0xf9cb('0x2c')](respondWithResult(_0x56ee13,null))[_0xf9cb('0x4c')](handleError(_0x56ee13,null));};exports['getItems']=function(_0x141ace,_0x20abda,_0x2ff67a){var _0x40efa1={};var _0x251b1a={};var _0x30317e;var _0x47fece;return db[_0xf9cb('0x36')][_0xf9cb('0x79')]({'where':{'id':_0x141ace['params']['id']}})[_0xf9cb('0x2c')](handleEntityNotFound(_0x20abda,null))['then'](function(_0x198d7b){if(_0x198d7b){_0x30317e=_0x198d7b;_0x251b1a[_0xf9cb('0x3a')]=_[_0xf9cb('0x4e')](db[_0xf9cb('0x7a')][_0xf9cb('0x37')]);_0x251b1a[_0xf9cb('0x3e')]=_[_0xf9cb('0x4e')](_0x141ace[_0xf9cb('0x3e')]);_0x251b1a[_0xf9cb('0x3b')]=_[_0xf9cb('0x3c')](_0x251b1a[_0xf9cb('0x3a')],_0x251b1a['query']);_0x40efa1[_0xf9cb('0x3d')]=_[_0xf9cb('0x3c')](_0x251b1a[_0xf9cb('0x3a')],qs[_0xf9cb('0x3f')](_0x141ace[_0xf9cb('0x3e')][_0xf9cb('0x3f')]));_0x40efa1['attributes']=_0x40efa1['attributes'][_0xf9cb('0x40')]?_0x40efa1[_0xf9cb('0x3d')]:_0x251b1a[_0xf9cb('0x3a')];_0x40efa1[_0xf9cb('0x7b')]=qs[_0xf9cb('0x43')](_0x141ace['query'][_0xf9cb('0x43')]);_0x40efa1[_0xf9cb('0x44')]=qs[_0xf9cb('0x3b')](_['pick'](_0x141ace[_0xf9cb('0x3e')],_0x251b1a[_0xf9cb('0x3b')]));if(_0x141ace[_0xf9cb('0x3e')]['filter']){_0x40efa1[_0xf9cb('0x44')]=_['merge'](_0x40efa1[_0xf9cb('0x44')],{'$or':_[_0xf9cb('0x35')](_0x40efa1[_0xf9cb('0x3d')],function(_0x48d193){var _0x3dcb5b={};_0x3dcb5b[_0x48d193]={'$like':'%'+_0x141ace[_0xf9cb('0x3e')]['filter']+'%'};return _0x3dcb5b;})});}_0x40efa1=_['merge']({},_0x40efa1,_0x141ace[_0xf9cb('0x49')]);return _0x30317e[_0xf9cb('0x7c')](_0x40efa1);}})[_0xf9cb('0x2c')](function(_0x5749fa){if(_0x5749fa){_0x47fece=_0x5749fa[_0xf9cb('0x40')];if(!_0x141ace[_0xf9cb('0x3e')][_0xf9cb('0x41')](_0xf9cb('0x42'))){_0x40efa1[_0xf9cb('0x26')]=qs[_0xf9cb('0x26')](_0x141ace[_0xf9cb('0x3e')][_0xf9cb('0x26')]);_0x40efa1[_0xf9cb('0x25')]=qs['offset'](_0x141ace[_0xf9cb('0x3e')]['offset']);}return _0x30317e[_0xf9cb('0x7c')](_0x40efa1);}})['then'](function(_0xb21d0d){if(_0xb21d0d){return _0xb21d0d?{'count':_0x47fece,'rows':_0xb21d0d}:null;}})[_0xf9cb('0x2c')](respondWithResult(_0x20abda,null))[_0xf9cb('0x4c')](handleError(_0x20abda,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ddc3661..37d6409 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 _0x816f=['save','remove','emit','hasOwnProperty','hook','exports','Dashboard'];(function(_0x3edc8b,_0x1996cb){var _0xbf74e5=function(_0x2fcc27){while(--_0x2fcc27){_0x3edc8b['push'](_0x3edc8b['shift']());}};_0xbf74e5(++_0x1996cb);}(_0x816f,0x1cd));var _0xf816=function(_0x475b04,_0x2bcea5){_0x475b04=_0x475b04-0x0;var _0x225a2f=_0x816f[_0x475b04];return _0x225a2f;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0xf816('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf816('0x1'),'afterUpdate':'update','afterDestroy':_0xf816('0x2')};function emitEvent(_0x3b9c41){return function(_0x547925,_0x2c90c5,_0x5cd035){DashboardEvents[_0xf816('0x3')](_0x3b9c41+':'+_0x547925['id'],_0x547925);DashboardEvents['emit'](_0x3b9c41,_0x547925);_0x5cd035(null);};}for(var e in events){if(events[_0xf816('0x4')](e)){var event=events[e];Dashboard[_0xf816('0x5')](e,emitEvent(event));}}module[_0xf816('0x6')]=DashboardEvents; \ No newline at end of file +var _0xbf0b=['exports','events','save','remove','emit','hasOwnProperty'];(function(_0x1d38e0,_0x23dcaf){var _0x26e31b=function(_0x26b77b){while(--_0x26b77b){_0x1d38e0['push'](_0x1d38e0['shift']());}};_0x26e31b(++_0x23dcaf);}(_0xbf0b,0x1c3));var _0xbbf0=function(_0x541a7d,_0xbfbb8d){_0x541a7d=_0x541a7d-0x0;var _0x3c7f70=_0xbf0b[_0x541a7d];return _0x3c7f70;};'use strict';var EventEmitter=require(_0xbbf0('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbbf0('0x1'),'afterUpdate':'update','afterDestroy':_0xbbf0('0x2')};function emitEvent(_0x2c8d14){return function(_0x30b469,_0x4c605b,_0x18cf0b){DashboardEvents[_0xbbf0('0x3')](_0x2c8d14+':'+_0x30b469['id'],_0x30b469);DashboardEvents[_0xbbf0('0x3')](_0x2c8d14,_0x30b469);_0x18cf0b(null);};}for(var e in events){if(events[_0xbbf0('0x4')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xbbf0('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 529d493..ea70ac3 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 _0xf0bb=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','../../config/logger','bluebird','request-promise'];(function(_0x32cb2d,_0x454679){var _0x375d77=function(_0x331f51){while(--_0x331f51){_0x32cb2d['push'](_0x32cb2d['shift']());}};_0x375d77(++_0x454679);}(_0xf0bb,0x1e0));var _0xbf0b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf0bb[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xbf0b('0x0'));var util=require('util');var logger=require(_0xbf0b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbf0b('0x2'));var rp=require(_0xbf0b('0x3'));var fs=require('fs');var path=require(_0xbf0b('0x4'));var rimraf=require(_0xbf0b('0x5'));var config=require(_0xbf0b('0x6'));var attributes=require(_0xbf0b('0x7'));module[_0xbf0b('0x8')]=function(_0x4dc502,_0x1b703b){return _0x4dc502[_0xbf0b('0x9')]('Dashboard',attributes,{'tableName':_0xbf0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x327b=['request-promise','path','rimraf','../../config/environment','lodash','util','api','moment','bluebird'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x327b,0xb8));var _0xb327=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x327b[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xb327('0x0'));var util=require(_0xb327('0x1'));var logger=require('../../config/logger')(_0xb327('0x2'));var moment=require(_0xb327('0x3'));var BPromise=require(_0xb327('0x4'));var rp=require(_0xb327('0x5'));var fs=require('fs');var path=require(_0xb327('0x6'));var rimraf=require(_0xb327('0x7'));var config=require(_0xb327('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x596383,_0x5d1d45){return _0x596383['define']('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 158a764..a152c0e 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 _0x21b4=['debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x1205c8,_0x27a794){var _0x98859=function(_0x1e4fd7){while(--_0x1e4fd7){_0x1205c8['push'](_0x1205c8['shift']());}};_0x98859(++_0x27a794);}(_0x21b4,0x116));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x421b('0x0'));var util=require('util');var moment=require(_0x421b('0x1'));var BPromise=require(_0x421b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x421b('0x3'));var db=require(_0x421b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x421b('0x5'))(_0x421b('0x6'));var config=require(_0x421b('0x7'));var jayson=require(_0x421b('0x8'));var client=jayson[_0x421b('0x9')][_0x421b('0xa')]({'port':0x232a});config[_0x421b('0xb')]=_[_0x421b('0xc')](config[_0x421b('0xb')],{'host':_0x421b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x421b('0xb')]));require(_0x421b('0xe'))[_0x421b('0xf')](socket);function respondWithRpcPromise(_0x596703,_0x2ac5d4,_0x5778eb){return new BPromise(function(_0x48e051,_0x4bd2ba){return client[_0x421b('0x10')](_0x596703,_0x5778eb)['then'](function(_0x1d1f80){logger['info'](_0x421b('0x11'),_0x2ac5d4,_0x421b('0x12'));logger[_0x421b('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2ac5d4,'request\x20sent',JSON[_0x421b('0x14')](_0x1d1f80));if(_0x1d1f80[_0x421b('0x15')]){if(_0x1d1f80['error'][_0x421b('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x2ac5d4,_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);return _0x4bd2ba(_0x1d1f80['error'][_0x421b('0x17')]);}logger[_0x421b('0x15')]('Dashboard,\x20%s,\x20%s',_0x2ac5d4,_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);return _0x48e051(_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);}else{logger[_0x421b('0x18')](_0x421b('0x11'),_0x2ac5d4,_0x421b('0x12'));_0x48e051(_0x1d1f80[_0x421b('0x19')][_0x421b('0x17')]);}})[_0x421b('0x1a')](function(_0x3df829){logger[_0x421b('0x15')](_0x421b('0x11'),_0x2ac5d4,_0x3df829);_0x4bd2ba(_0x3df829);});});} \ No newline at end of file +var _0x2607=['error','code','message','request\x20sent','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x2607,0xa5));var _0x7260=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x2607[_0x1b2255];return _0x33e57d;};'use strict';var _=require('lodash');var util=require(_0x7260('0x0'));var moment=require(_0x7260('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7260('0x2'))['db'];var utils=require(_0x7260('0x3'));var logger=require('../../config/logger')(_0x7260('0x4'));var config=require('../../config/environment');var jayson=require(_0x7260('0x5'));var client=jayson['client'][_0x7260('0x6')]({'port':0x232a});config[_0x7260('0x7')]=_[_0x7260('0x8')](config[_0x7260('0x7')],{'host':_0x7260('0x9'),'port':0x18eb});var socket=require(_0x7260('0xa'))(new Redis(config[_0x7260('0x7')]));require(_0x7260('0xb'))[_0x7260('0xc')](socket);function respondWithRpcPromise(_0x520339,_0x2191d2,_0x4ba293){return new BPromise(function(_0x11703f,_0x263129){return client[_0x7260('0xd')](_0x520339,_0x4ba293)['then'](function(_0x44c1fe){logger[_0x7260('0xe')](_0x7260('0xf'),_0x2191d2,'request\x20sent');logger[_0x7260('0x10')](_0x7260('0x11'),_0x2191d2,'request\x20sent',JSON[_0x7260('0x12')](_0x44c1fe));if(_0x44c1fe[_0x7260('0x13')]){if(_0x44c1fe[_0x7260('0x13')][_0x7260('0x14')]===0x1f4){logger[_0x7260('0x13')](_0x7260('0xf'),_0x2191d2,_0x44c1fe[_0x7260('0x13')][_0x7260('0x15')]);return _0x263129(_0x44c1fe['error']['message']);}logger[_0x7260('0x13')](_0x7260('0xf'),_0x2191d2,_0x44c1fe[_0x7260('0x13')][_0x7260('0x15')]);return _0x11703f(_0x44c1fe[_0x7260('0x13')][_0x7260('0x15')]);}else{logger[_0x7260('0xe')](_0x7260('0xf'),_0x2191d2,_0x7260('0x16'));_0x11703f(_0x44c1fe['result'][_0x7260('0x15')]);}})['catch'](function(_0x5774f2){logger[_0x7260('0x13')](_0x7260('0xf'),_0x2191d2,_0x5774f2);_0x263129(_0x5774f2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4db2c6c..d2706eb 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 _0x2785=['dashboard:','./dashboard.events','remove','emit','removeListener','register'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x2785,0x12d));var _0x5278=function(_0x4789cd,_0x1d18d6){_0x4789cd=_0x4789cd-0x0;var _0x39f810=_0x2785[_0x4789cd];return _0x39f810;};'use strict';var DashboardEvents=require(_0x5278('0x0'));var events=['save',_0x5278('0x1'),'update'];function createListener(_0x52be5c,_0x563fb9){return function(_0x1ca37e){_0x563fb9[_0x5278('0x2')](_0x52be5c,_0x1ca37e);};}function removeListener(_0x3a00e9,_0x534ea8){return function(){DashboardEvents[_0x5278('0x3')](_0x3a00e9,_0x534ea8);};}exports[_0x5278('0x4')]=function(_0x3c1cc0){for(var _0x418016=0x0,_0x4b774b=events['length'];_0x418016<_0x4b774b;_0x418016++){var _0x335cb3=events[_0x418016];var _0x51bf97=createListener(_0x5278('0x5')+_0x335cb3,_0x3c1cc0);DashboardEvents['on'](_0x335cb3,_0x51bf97);}}; \ No newline at end of file +var _0x9f0b=['remove','update','emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x3b2380,_0x40b804){var _0x1d0b1c=function(_0x452e34){while(--_0x452e34){_0x3b2380['push'](_0x3b2380['shift']());}};_0x1d0b1c(++_0x40b804);}(_0x9f0b,0xde));var _0xb9f0=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x9f0b[_0x485f53];return _0x480f1e;};'use strict';var DashboardEvents=require(_0xb9f0('0x0'));var events=[_0xb9f0('0x1'),_0xb9f0('0x2'),_0xb9f0('0x3')];function createListener(_0x1d6190,_0xca5710){return function(_0x241077){_0xca5710[_0xb9f0('0x4')](_0x1d6190,_0x241077);};}function removeListener(_0x2feb76,_0x381c3a){return function(){DashboardEvents[_0xb9f0('0x5')](_0x2feb76,_0x381c3a);};}exports[_0xb9f0('0x6')]=function(_0x1e379a){for(var _0xb874e9=0x0,_0x438327=events['length'];_0xb874e9<_0x438327;_0xb874e9++){var _0x32e705=events[_0xb874e9];var _0x26b3c5=createListener(_0xb9f0('0x7')+_0x32e705,_0x1e379a);DashboardEvents['on'](_0x32e705,_0x26b3c5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7fdeee6..4b8a020 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(_0x4c79aa,_0x456fcd){var _0x28e73a=function(_0x2f9084){while(--_0x2f9084){_0x4c79aa['push'](_0x4c79aa['shift']());}};_0x28e73a(++_0x456fcd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xcb91[_0x18f64a];return _0x44687f;};'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(_0x3f29bc,_0x102fa1){var _0x253de9=function(_0x3ee168){while(--_0x3ee168){_0x3f29bc['push'](_0x3f29bc['shift']());}};_0x253de9(++_0x102fa1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xcb91[_0x5f1391];return _0x50ebe3;};'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 4a606e3..5badcfe 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 _0x6bcc=['squel','lodash','exports','STRING','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize'];(function(_0x2c73fa,_0x41b660){var _0x201374=function(_0xb0a36c){while(--_0xb0a36c){_0x2c73fa['push'](_0x2c73fa['shift']());}};_0x201374(++_0x41b660);}(_0x6bcc,0xfb));var _0xc6bc=function(_0x2e311b,_0x457f3d){_0x2e311b=_0x2e311b-0x0;var _0x5f45b6=_0x6bcc[_0x2e311b];return _0x5f45b6;};'use strict';var Sequelize=require(_0xc6bc('0x0'));var squel=require(_0xc6bc('0x1'));var _=require(_0xc6bc('0x2'));module[_0xc6bc('0x3')]={'title':{'type':Sequelize[_0xc6bc('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xc6bc('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0xc6bc('0x5')](this[_0xc6bc('0x6')](_0xc6bc('0x7')));}catch(_0x5466cd){return[];}},'set':function(_0x2091f7){try{this[_0xc6bc('0x8')]('attrs',JSON[_0xc6bc('0x9')](_0x2091f7));}catch(_0x501bcb){this[_0xc6bc('0x8')](_0xc6bc('0x7'),JSON[_0xc6bc('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xc6bc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc6bc('0xa')]},'col':{'type':Sequelize[_0xc6bc('0xa')]},'background':{'type':Sequelize[_0xc6bc('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xc6bc('0x4')],'allowNull':![],'defaultValue':_0xc6bc('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xc6bc('0x4')]}}; \ No newline at end of file +var _0x0b75=['#ffffff','#2196f3','sequelize','squel','lodash','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','STRING'];(function(_0x57d997,_0x367ce4){var _0x2cb473=function(_0x5ed65f){while(--_0x5ed65f){_0x57d997['push'](_0x57d997['shift']());}};_0x2cb473(++_0x367ce4);}(_0x0b75,0xd2));var _0x50b7=function(_0xbd0186,_0x2fb80a){_0xbd0186=_0xbd0186-0x0;var _0x57157e=_0x0b75[_0xbd0186];return _0x57157e;};'use strict';var Sequelize=require(_0x50b7('0x0'));var squel=require(_0x50b7('0x1'));var _=require(_0x50b7('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x50b7('0x3')),'get':function(){try{return JSON[_0x50b7('0x4')](this[_0x50b7('0x5')]('attrs'));}catch(_0x312c76){return[];}},'set':function(_0xc24294){try{this['setDataValue'](_0x50b7('0x6'),JSON[_0x50b7('0x7')](_0xc24294));}catch(_0x4fc7f8){this[_0x50b7('0x8')]('attrs',JSON[_0x50b7('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x50b7('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x50b7('0x9')]},'col':{'type':Sequelize[_0x50b7('0x9')]},'background':{'type':Sequelize[_0x50b7('0xa')],'allowNull':![],'defaultValue':_0x50b7('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x50b7('0xa')],'allowNull':![],'defaultValue':_0x50b7('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x50b7('0xa')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 34b2ea0..0e661cc 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 _0x14dc=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','show','params','keys','DashboardItem','query','filters','intersection','model','attributes','fields','length','includeAll','include','find','destroy','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','stringify','body','create','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util'];(function(_0x4d4a74,_0x344a11){var _0x5491d8=function(_0x400056){while(--_0x400056){_0x4d4a74['push'](_0x4d4a74['shift']());}};_0x5491d8(++_0x344a11);}(_0x14dc,0x1bc));var _0xc14d=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x14dc[_0x45d55e];return _0x29812a;};'use strict';var pdf=require(_0xc14d('0x0'));var emlformat=require(_0xc14d('0x1'));var rimraf=require(_0xc14d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc14d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc14d('0x4'));var util=require(_0xc14d('0x5'));var path=require(_0xc14d('0x6'));var sox=require(_0xc14d('0x7'));var csv=require(_0xc14d('0x8'));var ejs=require(_0xc14d('0x9'));var fs=require('fs');var _=require(_0xc14d('0xa'));var squel=require(_0xc14d('0xb'));var crypto=require(_0xc14d('0xc'));var jsforce=require(_0xc14d('0xd'));var deskjs=require(_0xc14d('0xe'));var toCsv=require(_0xc14d('0x8'));var querystring=require('querystring');var Papa=require(_0xc14d('0xf'));var Redis=require(_0xc14d('0x10'));var authService=require(_0xc14d('0x11'));var qs=require(_0xc14d('0x12'));var as=require(_0xc14d('0x13'));var hardwareService=require(_0xc14d('0x14'));var logger=require('../../config/logger')(_0xc14d('0x15'));var utils=require(_0xc14d('0x16'));var config=require(_0xc14d('0x17'));var licenseUtil=require(_0xc14d('0x18'));var db=require(_0xc14d('0x19'))['db'];config[_0xc14d('0x1a')]=_[_0xc14d('0x1b')](config['redis'],{'host':_0xc14d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc14d('0x1a')]));require(_0xc14d('0x1d'))['register'](socket);function respondWithStatusCode(_0x3ed8c6,_0x2f2c63){_0x2f2c63=_0x2f2c63||0xcc;return function(_0x5edc91){if(_0x5edc91){return _0x3ed8c6[_0xc14d('0x1e')](_0x2f2c63);}return _0x3ed8c6['status'](_0x2f2c63)[_0xc14d('0x1f')]();};}function respondWithResult(_0x3cbc34,_0x1e1781){_0x1e1781=_0x1e1781||0xc8;return function(_0x121e50){if(_0x121e50){return _0x3cbc34[_0xc14d('0x20')](_0x1e1781)[_0xc14d('0x21')](_0x121e50);}};}function respondWithFilteredResult(_0x258a0a,_0x2bec13){return function(_0x95ea7f){if(_0x95ea7f){var _0x44f5ee=_0x95ea7f[_0xc14d('0x22')],_0x46d207=_0x2bec13['offset'],_0x1e64f7=_0x2bec13[_0xc14d('0x23')]+_0x2bec13[_0xc14d('0x24')],_0x16d54b;if(_0x1e64f7>=_0x44f5ee){_0x1e64f7=_0x44f5ee;_0x16d54b=0xc8;}else{_0x16d54b=0xce;}_0x258a0a[_0xc14d('0x20')](_0x16d54b);return _0x258a0a[_0xc14d('0x25')](_0xc14d('0x26'),_0x46d207+'-'+_0x1e64f7+'/'+_0x44f5ee)[_0xc14d('0x21')](_0x95ea7f);}return null;};}function patchUpdates(_0x43f39c){return function(_0x2fbf4d){try{jsonpatch[_0xc14d('0x27')](_0x2fbf4d,_0x43f39c,!![]);}catch(_0x6fdafe){return BPromise[_0xc14d('0x28')](_0x6fdafe);}return _0x2fbf4d[_0xc14d('0x29')]();};}function saveUpdates(_0x4dbe84,_0x274766){return function(_0x2da729){if(_0x2da729){return _0x2da729[_0xc14d('0x2a')](_0x4dbe84)[_0xc14d('0x2b')](function(_0xaebb90){return _0xaebb90;});}return null;};}function removeEntity(_0xe85272,_0x62e6ac){return function(_0x1da2df){if(_0x1da2df){return _0x1da2df['destroy']()[_0xc14d('0x2b')](function(){_0xe85272[_0xc14d('0x20')](0xcc)[_0xc14d('0x1f')]();});}};}function handleEntityNotFound(_0x870fb2,_0xf7ceb4){return function(_0x3de5a2){if(!_0x3de5a2){_0x870fb2[_0xc14d('0x1e')](0x194);}return _0x3de5a2;};}function handleError(_0xcdf176,_0x542c05){_0x542c05=_0x542c05||0x1f4;return function(_0x5e29e1){logger[_0xc14d('0x2c')](_0x5e29e1[_0xc14d('0x2d')]);if(_0x5e29e1['name']){delete _0x5e29e1['name'];}_0xcdf176['status'](_0x542c05)[_0xc14d('0x2e')](_0x5e29e1);};}exports[_0xc14d('0x2f')]=function(_0x425510,_0x1acee5){var _0x2fea9e={'raw':![],'where':{'id':_0x425510[_0xc14d('0x30')]['id']}},_0x4ee5dc={};_0x4ee5dc['model']=_[_0xc14d('0x31')](db[_0xc14d('0x32')]['rawAttributes']);_0x4ee5dc[_0xc14d('0x33')]=_[_0xc14d('0x31')](_0x425510[_0xc14d('0x33')]);_0x4ee5dc[_0xc14d('0x34')]=_[_0xc14d('0x35')](_0x4ee5dc[_0xc14d('0x36')],_0x4ee5dc[_0xc14d('0x33')]);_0x2fea9e[_0xc14d('0x37')]=_[_0xc14d('0x35')](_0x4ee5dc['model'],qs[_0xc14d('0x38')](_0x425510['query'][_0xc14d('0x38')]));_0x2fea9e['attributes']=_0x2fea9e['attributes'][_0xc14d('0x39')]?_0x2fea9e[_0xc14d('0x37')]:_0x4ee5dc['model'];if(_0x425510[_0xc14d('0x33')][_0xc14d('0x3a')]){_0x2fea9e[_0xc14d('0x3b')]=[{'all':!![]}];}_0x2fea9e=_['merge']({},_0x2fea9e,_0x425510['options']);return db[_0xc14d('0x32')][_0xc14d('0x3c')](_0x2fea9e)[_0xc14d('0x2b')](handleEntityNotFound(_0x1acee5,null))['then'](respondWithResult(_0x1acee5,null))['catch'](handleError(_0x1acee5,null));};exports[_0xc14d('0x3d')]=function(_0x8031a8,_0x16e65c){return db[_0xc14d('0x32')][_0xc14d('0x3c')]({'where':{'id':_0x8031a8[_0xc14d('0x30')]['id']}})[_0xc14d('0x2b')](handleEntityNotFound(_0x16e65c,null))[_0xc14d('0x2b')](removeEntity(_0x16e65c,null))[_0xc14d('0x3e')](handleError(_0x16e65c,null));};function widgetAttributes(_0x1c4c7a){try{switch(_0x1c4c7a[_0xc14d('0x3f')]){case'iframe':return[{'name':_0xc14d('0x40'),'value':_0x1c4c7a['attrUrl']||(_0x1c4c7a['attrs']&&_0x1c4c7a[_0xc14d('0x41')][0x0]?_0x1c4c7a[_0xc14d('0x41')][0x0][_0xc14d('0x42')]:undefined)||_0xc14d('0x43')}];case _0xc14d('0x44'):return[{'name':_0xc14d('0x45'),'value':_0x1c4c7a[_0xc14d('0x45')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x0]?_0x1c4c7a[_0xc14d('0x41')][0x0][_0xc14d('0x42')]:undefined)||''}];case _0xc14d('0x46'):return[{'name':_0xc14d('0x47'),'value':_0x1c4c7a[_0xc14d('0x47')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x0]?_0x1c4c7a['attrs'][0x0][_0xc14d('0x42')]:undefined)||_0xc14d('0x48')},{'name':_0xc14d('0x49'),'value':_0x1c4c7a[_0xc14d('0x49')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a['attrs'][0x1]?_0x1c4c7a[_0xc14d('0x41')][0x1]['value']:undefined)||_0xc14d('0x4a')},{'name':_0xc14d('0x4b'),'value':_0x1c4c7a[_0xc14d('0x4b')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x2]?_0x1c4c7a['attrs'][0x2]['value']:undefined)||0xc}];case _0xc14d('0x4c'):return[{'name':_0xc14d('0x4d'),'value':_0x1c4c7a[_0xc14d('0x4d')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x0]?_0x1c4c7a[_0xc14d('0x41')][0x0][_0xc14d('0x42')]:undefined)||_0xc14d('0x4e')},{'name':_0xc14d('0x4f'),'value':_0x1c4c7a[_0xc14d('0x4f')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x1]?_0x1c4c7a[_0xc14d('0x41')][0x1][_0xc14d('0x42')]:undefined)||[]},{'name':_0xc14d('0x4b'),'value':_0x1c4c7a[_0xc14d('0x4b')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a['attrs'][0x2]?_0x1c4c7a['attrs'][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xc14d('0x50'):return[{'name':_0xc14d('0x51'),'value':_0x1c4c7a['attrSerie1']||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x0]?_0x1c4c7a[_0xc14d('0x41')][0x0][_0xc14d('0x42')]:undefined)||'total'},{'name':_0xc14d('0x52'),'value':_0x1c4c7a['attrSerie2']||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x1]?_0x1c4c7a[_0xc14d('0x41')][0x1]['value']:undefined)||null},{'name':_0xc14d('0x53'),'value':_0x1c4c7a[_0xc14d('0x53')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a['attrs'][0x2]?_0x1c4c7a['attrs'][0x2][_0xc14d('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1c4c7a[_0xc14d('0x4f')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a['attrs'][0x3]?_0x1c4c7a[_0xc14d('0x41')][0x3][_0xc14d('0x42')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x1c4c7a[_0xc14d('0x54')]||(_0x1c4c7a['attrs']&&_0x1c4c7a['attrs'][0x0]?_0x1c4c7a[_0xc14d('0x41')][0x0][_0xc14d('0x3f')]:undefined)||null,'value':_0x1c4c7a[_0xc14d('0x55')]||(_0x1c4c7a['attrs']&&_0x1c4c7a['attrs'][0x0]?_0x1c4c7a[_0xc14d('0x41')][0x0][_0xc14d('0x42')]:undefined)||null},{'name':_0xc14d('0x56'),'value':_0x1c4c7a[_0xc14d('0x56')]||(_0x1c4c7a[_0xc14d('0x41')]&&_0x1c4c7a[_0xc14d('0x41')][0x1]?_0x1c4c7a[_0xc14d('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x597ea2){logger[_0xc14d('0x2c')]('widgetAttributes:\x20%s',JSON[_0xc14d('0x57')](_0x597ea2));return[];}}exports['create']=function(_0x50c099,_0x4284a1){if(_0x50c099[_0xc14d('0x58')]){_0x50c099[_0xc14d('0x58')][_0xc14d('0x41')]=widgetAttributes(_0x50c099[_0xc14d('0x58')]);}return db[_0xc14d('0x32')][_0xc14d('0x59')](_0x50c099[_0xc14d('0x58')],{})[_0xc14d('0x2b')](respondWithResult(_0x4284a1,0xc9))['catch'](handleError(_0x4284a1,null));};exports[_0xc14d('0x2a')]=function(_0x17df96,_0x3066ba){if(_0x17df96[_0xc14d('0x58')]['id']){delete _0x17df96[_0xc14d('0x58')]['id'];}_0x17df96[_0xc14d('0x58')][_0xc14d('0x41')]=widgetAttributes(_0x17df96['body']);return db['DashboardItem'][_0xc14d('0x3c')]({'where':{'id':_0x17df96[_0xc14d('0x30')]['id']}})['then'](handleEntityNotFound(_0x3066ba,null))['then'](saveUpdates(_0x17df96['body'],null))[_0xc14d('0x2b')](respondWithResult(_0x3066ba,null))['catch'](handleError(_0x3066ba,null));}; \ No newline at end of file +var _0xc077=['https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','catch','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','filters','attributes','intersection','fields','query','length','includeAll','merge','options','find','destroy','type','iframe','attrUrl','attrs','value'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xc077,0x17e));var _0x7c07=function(_0x2e1cd7,_0x293ea1){_0x2e1cd7=_0x2e1cd7-0x0;var _0x515226=_0xc077[_0x2e1cd7];return _0x515226;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c07('0x0'));var rimraf=require(_0x7c07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7c07('0x2'));var BPromise=require(_0x7c07('0x3'));var Mustache=require(_0x7c07('0x4'));var util=require(_0x7c07('0x5'));var path=require('path');var sox=require(_0x7c07('0x6'));var csv=require(_0x7c07('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c07('0x8'));var squel=require(_0x7c07('0x9'));var crypto=require(_0x7c07('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7c07('0xb'));var toCsv=require(_0x7c07('0x7'));var querystring=require(_0x7c07('0xc'));var Papa=require(_0x7c07('0xd'));var Redis=require(_0x7c07('0xe'));var authService=require(_0x7c07('0xf'));var qs=require(_0x7c07('0x10'));var as=require(_0x7c07('0x11'));var hardwareService=require(_0x7c07('0x12'));var logger=require('../../config/logger')(_0x7c07('0x13'));var utils=require(_0x7c07('0x14'));var config=require(_0x7c07('0x15'));var licenseUtil=require(_0x7c07('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7c07('0x17')](config[_0x7c07('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c07('0x19'))(new Redis(config[_0x7c07('0x18')]));require(_0x7c07('0x1a'))['register'](socket);function respondWithStatusCode(_0x520bf0,_0x16d809){_0x16d809=_0x16d809||0xcc;return function(_0x277c90){if(_0x277c90){return _0x520bf0[_0x7c07('0x1b')](_0x16d809);}return _0x520bf0[_0x7c07('0x1c')](_0x16d809)[_0x7c07('0x1d')]();};}function respondWithResult(_0x2d4355,_0x25f24a){_0x25f24a=_0x25f24a||0xc8;return function(_0x53ac40){if(_0x53ac40){return _0x2d4355['status'](_0x25f24a)[_0x7c07('0x1e')](_0x53ac40);}};}function respondWithFilteredResult(_0x129265,_0x52fa8d){return function(_0x2d47c6){if(_0x2d47c6){var _0x4094ec=_0x2d47c6[_0x7c07('0x1f')],_0x18a756=_0x52fa8d['offset'],_0x51e340=_0x52fa8d[_0x7c07('0x20')]+_0x52fa8d[_0x7c07('0x21')],_0x404c2c;if(_0x51e340>=_0x4094ec){_0x51e340=_0x4094ec;_0x404c2c=0xc8;}else{_0x404c2c=0xce;}_0x129265['status'](_0x404c2c);return _0x129265[_0x7c07('0x22')](_0x7c07('0x23'),_0x18a756+'-'+_0x51e340+'/'+_0x4094ec)['json'](_0x2d47c6);}return null;};}function patchUpdates(_0x1c82b2){return function(_0x12ec40){try{jsonpatch['apply'](_0x12ec40,_0x1c82b2,!![]);}catch(_0x355b11){return BPromise[_0x7c07('0x24')](_0x355b11);}return _0x12ec40['save']();};}function saveUpdates(_0x4cac00,_0x1ec2f2){return function(_0xfdf727){if(_0xfdf727){return _0xfdf727['update'](_0x4cac00)[_0x7c07('0x25')](function(_0xf0aff){return _0xf0aff;});}return null;};}function removeEntity(_0x2af0b2,_0x66ae92){return function(_0x269be0){if(_0x269be0){return _0x269be0['destroy']()['then'](function(){_0x2af0b2[_0x7c07('0x1c')](0xcc)[_0x7c07('0x1d')]();});}};}function handleEntityNotFound(_0xfb9976,_0x1665ea){return function(_0x597e17){if(!_0x597e17){_0xfb9976[_0x7c07('0x1b')](0x194);}return _0x597e17;};}function handleError(_0x224519,_0x4444a0){_0x4444a0=_0x4444a0||0x1f4;return function(_0x5cd227){logger[_0x7c07('0x26')](_0x5cd227['stack']);if(_0x5cd227[_0x7c07('0x27')]){delete _0x5cd227['name'];}_0x224519[_0x7c07('0x1c')](_0x4444a0)[_0x7c07('0x28')](_0x5cd227);};}exports[_0x7c07('0x29')]=function(_0xece7e6,_0x2b0606){var _0x56bc42={'raw':![],'where':{'id':_0xece7e6[_0x7c07('0x2a')]['id']}},_0x437526={};_0x437526[_0x7c07('0x2b')]=_[_0x7c07('0x2c')](db[_0x7c07('0x2d')][_0x7c07('0x2e')]);_0x437526['query']=_[_0x7c07('0x2c')](_0xece7e6['query']);_0x437526[_0x7c07('0x2f')]=_['intersection'](_0x437526[_0x7c07('0x2b')],_0x437526['query']);_0x56bc42[_0x7c07('0x30')]=_[_0x7c07('0x31')](_0x437526[_0x7c07('0x2b')],qs[_0x7c07('0x32')](_0xece7e6[_0x7c07('0x33')][_0x7c07('0x32')]));_0x56bc42[_0x7c07('0x30')]=_0x56bc42[_0x7c07('0x30')][_0x7c07('0x34')]?_0x56bc42[_0x7c07('0x30')]:_0x437526['model'];if(_0xece7e6[_0x7c07('0x33')][_0x7c07('0x35')]){_0x56bc42['include']=[{'all':!![]}];}_0x56bc42=_[_0x7c07('0x36')]({},_0x56bc42,_0xece7e6[_0x7c07('0x37')]);return db[_0x7c07('0x2d')][_0x7c07('0x38')](_0x56bc42)[_0x7c07('0x25')](handleEntityNotFound(_0x2b0606,null))['then'](respondWithResult(_0x2b0606,null))['catch'](handleError(_0x2b0606,null));};exports[_0x7c07('0x39')]=function(_0x3d6f1e,_0x5b92b2){return db[_0x7c07('0x2d')][_0x7c07('0x38')]({'where':{'id':_0x3d6f1e[_0x7c07('0x2a')]['id']}})[_0x7c07('0x25')](handleEntityNotFound(_0x5b92b2,null))[_0x7c07('0x25')](removeEntity(_0x5b92b2,null))['catch'](handleError(_0x5b92b2,null));};function widgetAttributes(_0x178202){try{switch(_0x178202[_0x7c07('0x3a')]){case _0x7c07('0x3b'):return[{'name':'attrUrl','value':_0x178202[_0x7c07('0x3c')]||(_0x178202['attrs']&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202[_0x7c07('0x3d')][0x0][_0x7c07('0x3e')]:undefined)||_0x7c07('0x3f')}];case _0x7c07('0x40'):return[{'name':_0x7c07('0x41'),'value':_0x178202[_0x7c07('0x41')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202[_0x7c07('0x3d')][0x0][_0x7c07('0x3e')]:undefined)||''}];case _0x7c07('0x42'):return[{'name':_0x7c07('0x43'),'value':_0x178202['attrHourFormat']||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202[_0x7c07('0x3d')][0x0][_0x7c07('0x3e')]:undefined)||_0x7c07('0x44')},{'name':_0x7c07('0x45'),'value':_0x178202[_0x7c07('0x45')]||(_0x178202['attrs']&&_0x178202[_0x7c07('0x3d')][0x1]?_0x178202[_0x7c07('0x3d')][0x1][_0x7c07('0x3e')]:undefined)||_0x7c07('0x46')},{'name':_0x7c07('0x47'),'value':_0x178202[_0x7c07('0x47')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202['attrs'][0x2]?_0x178202[_0x7c07('0x3d')][0x2][_0x7c07('0x3e')]:undefined)||0xc}];case _0x7c07('0x48'):return[{'name':_0x7c07('0x49'),'value':_0x178202[_0x7c07('0x49')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202['attrs'][0x0]['value']:undefined)||_0x7c07('0x4a')},{'name':_0x7c07('0x4b'),'value':_0x178202[_0x7c07('0x4b')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x1]?_0x178202[_0x7c07('0x3d')][0x1][_0x7c07('0x3e')]:undefined)||[]},{'name':_0x7c07('0x47'),'value':_0x178202[_0x7c07('0x47')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x2]?_0x178202[_0x7c07('0x3d')][0x2][_0x7c07('0x3e')]:undefined)||0x14}];case _0x7c07('0x4c'):case _0x7c07('0x4d'):return[{'name':_0x7c07('0x4e'),'value':_0x178202[_0x7c07('0x4e')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202['attrs'][0x0][_0x7c07('0x3e')]:undefined)||_0x7c07('0x4a')},{'name':_0x7c07('0x4f'),'value':_0x178202['attrSerie2']||(_0x178202[_0x7c07('0x3d')]&&_0x178202['attrs'][0x1]?_0x178202[_0x7c07('0x3d')][0x1][_0x7c07('0x3e')]:undefined)||null},{'name':_0x7c07('0x50'),'value':_0x178202['attrSerie3']||(_0x178202[_0x7c07('0x3d')]&&_0x178202['attrs'][0x2]?_0x178202[_0x7c07('0x3d')][0x2][_0x7c07('0x3e')]:undefined)||null},{'name':_0x7c07('0x4b'),'value':_0x178202[_0x7c07('0x4b')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202['attrs'][0x3]?_0x178202[_0x7c07('0x3d')][0x3][_0x7c07('0x3e')]:undefined)||[]}];case _0x7c07('0x51'):return[{'name':_0x7c07('0x52'),'type':_0x178202[_0x7c07('0x53')]||(_0x178202['attrs']&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202[_0x7c07('0x3d')][0x0]['type']:undefined)||null,'value':_0x178202[_0x7c07('0x52')]||(_0x178202[_0x7c07('0x3d')]&&_0x178202[_0x7c07('0x3d')][0x0]?_0x178202['attrs'][0x0][_0x7c07('0x3e')]:undefined)||null},{'name':_0x7c07('0x54'),'value':_0x178202['attrRefresh']||(_0x178202[_0x7c07('0x3d')]&&_0x178202['attrs'][0x1]?_0x178202[_0x7c07('0x3d')][0x1][_0x7c07('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x5bf11f){logger[_0x7c07('0x26')]('widgetAttributes:\x20%s',JSON[_0x7c07('0x55')](_0x5bf11f));return[];}}exports[_0x7c07('0x56')]=function(_0x240f1b,_0x58cbc3){if(_0x240f1b[_0x7c07('0x57')]){_0x240f1b['body'][_0x7c07('0x3d')]=widgetAttributes(_0x240f1b['body']);}return db[_0x7c07('0x2d')][_0x7c07('0x56')](_0x240f1b[_0x7c07('0x57')],{})[_0x7c07('0x25')](respondWithResult(_0x58cbc3,0xc9))[_0x7c07('0x58')](handleError(_0x58cbc3,null));};exports['update']=function(_0x369e52,_0x149675){if(_0x369e52[_0x7c07('0x57')]['id']){delete _0x369e52['body']['id'];}_0x369e52['body'][_0x7c07('0x3d')]=widgetAttributes(_0x369e52[_0x7c07('0x57')]);return db[_0x7c07('0x2d')][_0x7c07('0x38')]({'where':{'id':_0x369e52[_0x7c07('0x2a')]['id']}})[_0x7c07('0x25')](handleEntityNotFound(_0x149675,null))[_0x7c07('0x25')](saveUpdates(_0x369e52[_0x7c07('0x57')],null))[_0x7c07('0x25')](respondWithResult(_0x149675,null))[_0x7c07('0x58')](handleError(_0x149675,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 94676a9..be0888e 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 _0xdd0c=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x2a1ed2,_0x282706){var _0x479ad8=function(_0x54b28d){while(--_0x54b28d){_0x2a1ed2['push'](_0x2a1ed2['shift']());}};_0x479ad8(++_0x282706);}(_0xdd0c,0x165));var _0xcdd0=function(_0x593869,_0x32264b){_0x593869=_0x593869-0x0;var _0x53f544=_0xdd0c[_0x593869];return _0x53f544;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xcdd0('0x0'))['db'][_0xcdd0('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcdd0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdd0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d8684){return function(_0x159e38,_0x432716,_0x354e5f){DashboardItemEvents[_0xcdd0('0x4')](_0x3d8684+':'+_0x159e38['id'],_0x159e38);DashboardItemEvents['emit'](_0x3d8684,_0x159e38);_0x354e5f(null);};}for(var e in events){if(events[_0xcdd0('0x5')](e)){var event=events[e];DashboardItem[_0xcdd0('0x6')](e,emitEvent(event));}}module[_0xcdd0('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xd48b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0xa28d1a,_0x3ccb6a){var _0x37463e=function(_0x2b1ad6){while(--_0x2b1ad6){_0xa28d1a['push'](_0xa28d1a['shift']());}};_0x37463e(++_0x3ccb6a);}(_0xd48b,0x14e));var _0xbd48=function(_0x4d7754,_0x58f1c4){_0x4d7754=_0x4d7754-0x0;var _0x3a00f4=_0xd48b[_0x4d7754];return _0x3a00f4;};'use strict';var EventEmitter=require(_0xbd48('0x0'));var DashboardItem=require(_0xbd48('0x1'))['db'][_0xbd48('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbd48('0x3')](0x0);var events={'afterCreate':_0xbd48('0x4'),'afterUpdate':_0xbd48('0x5'),'afterDestroy':_0xbd48('0x6')};function emitEvent(_0x2fff6f){return function(_0x481089,_0x43c907,_0x348a7f){DashboardItemEvents[_0xbd48('0x7')](_0x2fff6f+':'+_0x481089['id'],_0x481089);DashboardItemEvents[_0xbd48('0x7')](_0x2fff6f,_0x481089);_0x348a7f(null);};}for(var e in events){if(events[_0xbd48('0x8')](e)){var event=events[e];DashboardItem[_0xbd48('0x9')](e,emitEvent(event));}}module[_0xbd48('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1fdb2e4..f6a2038 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 _0x0eda=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./dashboardItem.attributes','exports'];(function(_0x5bdd93,_0x208ccb){var _0x2caf5e=function(_0x3a8a9b){while(--_0x3a8a9b){_0x5bdd93['push'](_0x5bdd93['shift']());}};_0x2caf5e(++_0x208ccb);}(_0x0eda,0x115));var _0xa0ed=function(_0x4d2ea3,_0x344557){_0x4d2ea3=_0x4d2ea3-0x0;var _0x54256f=_0x0eda[_0x4d2ea3];return _0x54256f;};'use strict';var _=require(_0xa0ed('0x0'));var util=require(_0xa0ed('0x1'));var logger=require(_0xa0ed('0x2'))(_0xa0ed('0x3'));var moment=require(_0xa0ed('0x4'));var BPromise=require(_0xa0ed('0x5'));var rp=require(_0xa0ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa0ed('0x7'));module[_0xa0ed('0x8')]=function(_0x3a6e2e,_0x24d1c4){return _0x3a6e2e['define'](_0xa0ed('0x9'),attributes,{'tableName':_0xa0ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x960e=['exports','DashboardItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14360a,_0x28497a){var _0x55e13e=function(_0x5a9e94){while(--_0x5a9e94){_0x14360a['push'](_0x14360a['shift']());}};_0x55e13e(++_0x28497a);}(_0x960e,0x6e));var _0xe960=function(_0x4a19fe,_0x144a9d){_0x4a19fe=_0x4a19fe-0x0;var _0x5ddede=_0x960e[_0x4a19fe];return _0x5ddede;};'use strict';var _=require(_0xe960('0x0'));var util=require(_0xe960('0x1'));var logger=require(_0xe960('0x2'))(_0xe960('0x3'));var moment=require(_0xe960('0x4'));var BPromise=require(_0xe960('0x5'));var rp=require(_0xe960('0x6'));var fs=require('fs');var path=require(_0xe960('0x7'));var rimraf=require(_0xe960('0x8'));var config=require(_0xe960('0x9'));var attributes=require('./dashboardItem.attributes');module[_0xe960('0xa')]=function(_0x4ab61a,_0x47f744){return _0x4ab61a['define'](_0xe960('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index d9cb407..d989d90 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 _0xcd84=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x22b37a,_0x483d7f){var _0x221444=function(_0x326d27){while(--_0x326d27){_0x22b37a['push'](_0x22b37a['shift']());}};_0x221444(++_0x483d7f);}(_0xcd84,0xde));var _0x4cd8=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0xcd84[_0x316904];return _0xfa9a21;};'use strict';var _=require(_0x4cd8('0x0'));var util=require(_0x4cd8('0x1'));var moment=require(_0x4cd8('0x2'));var BPromise=require(_0x4cd8('0x3'));var rs=require(_0x4cd8('0x4'));var fs=require('fs');var Redis=require(_0x4cd8('0x5'));var db=require(_0x4cd8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4cd8('0x7'));var jayson=require(_0x4cd8('0x8'));var client=jayson[_0x4cd8('0x9')]['http']({'port':0x232a});config[_0x4cd8('0xa')]=_[_0x4cd8('0xb')](config['redis'],{'host':_0x4cd8('0xc'),'port':0x18eb});var socket=require(_0x4cd8('0xd'))(new Redis(config[_0x4cd8('0xa')]));require(_0x4cd8('0xe'))[_0x4cd8('0xf')](socket);function respondWithRpcPromise(_0x56b120,_0x3c115a,_0x10ba8e){return new BPromise(function(_0xa9ef16,_0x12cb29){return client[_0x4cd8('0x10')](_0x56b120,_0x10ba8e)[_0x4cd8('0x11')](function(_0x39556a){logger[_0x4cd8('0x12')](_0x4cd8('0x13'),_0x3c115a,_0x4cd8('0x14'));logger['debug'](_0x4cd8('0x15'),_0x3c115a,_0x4cd8('0x14'),JSON[_0x4cd8('0x16')](_0x39556a));if(_0x39556a[_0x4cd8('0x17')]){if(_0x39556a['error'][_0x4cd8('0x18')]===0x1f4){logger['error'](_0x4cd8('0x13'),_0x3c115a,_0x39556a[_0x4cd8('0x17')][_0x4cd8('0x19')]);return _0x12cb29(_0x39556a[_0x4cd8('0x17')]['message']);}logger['error'](_0x4cd8('0x13'),_0x3c115a,_0x39556a['error'][_0x4cd8('0x19')]);return _0xa9ef16(_0x39556a[_0x4cd8('0x17')][_0x4cd8('0x19')]);}else{logger[_0x4cd8('0x12')]('DashboardItem,\x20%s,\x20%s',_0x3c115a,_0x4cd8('0x14'));_0xa9ef16(_0x39556a[_0x4cd8('0x1a')][_0x4cd8('0x19')]);}})[_0x4cd8('0x1b')](function(_0x5b971c){logger['error'](_0x4cd8('0x13'),_0x3c115a,_0x5b971c);_0x12cb29(_0x5b971c);});});} \ No newline at end of file +var _0xde62=['code','DashboardItem,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','error'];(function(_0x18aa72,_0x508c68){var _0x44acda=function(_0x555d8e){while(--_0x555d8e){_0x18aa72['push'](_0x18aa72['shift']());}};_0x44acda(++_0x508c68);}(_0xde62,0x64));var _0x2de6=function(_0x1cce6e,_0x10c89a){_0x1cce6e=_0x1cce6e-0x0;var _0x139279=_0xde62[_0x1cce6e];return _0x139279;};'use strict';var _=require(_0x2de6('0x0'));var util=require(_0x2de6('0x1'));var moment=require(_0x2de6('0x2'));var BPromise=require('bluebird');var rs=require(_0x2de6('0x3'));var fs=require('fs');var Redis=require(_0x2de6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2de6('0x5'));var client=jayson[_0x2de6('0x6')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2de6('0x7')],{'host':_0x2de6('0x8'),'port':0x18eb});var socket=require(_0x2de6('0x9'))(new Redis(config[_0x2de6('0x7')]));require('./dashboardItem.socket')[_0x2de6('0xa')](socket);function respondWithRpcPromise(_0x3866f7,_0x99f090,_0x25c792){return new BPromise(function(_0x11f857,_0x4850b2){return client[_0x2de6('0xb')](_0x3866f7,_0x25c792)['then'](function(_0x23a5e2){logger[_0x2de6('0xc')]('DashboardItem,\x20%s,\x20%s',_0x99f090,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x99f090,'request\x20sent',JSON['stringify'](_0x23a5e2));if(_0x23a5e2[_0x2de6('0xd')]){if(_0x23a5e2[_0x2de6('0xd')][_0x2de6('0xe')]===0x1f4){logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x99f090,_0x23a5e2[_0x2de6('0xd')][_0x2de6('0x10')]);return _0x4850b2(_0x23a5e2[_0x2de6('0xd')][_0x2de6('0x10')]);}logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x99f090,_0x23a5e2[_0x2de6('0xd')]['message']);return _0x11f857(_0x23a5e2[_0x2de6('0xd')]['message']);}else{logger[_0x2de6('0xc')](_0x2de6('0xf'),_0x99f090,_0x2de6('0x11'));_0x11f857(_0x23a5e2['result'][_0x2de6('0x10')]);}})[_0x2de6('0x12')](function(_0x597ade){logger['error'](_0x2de6('0xf'),_0x99f090,_0x597ade);_0x4850b2(_0x597ade);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 235c3c9..ecc5b1c 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 _0xc144=['removeListener','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xc144,0x133));var _0x4c14=function(_0x1e6355,_0x5ed332){_0x1e6355=_0x1e6355-0x0;var _0x184f27=_0xc144[_0x1e6355];return _0x184f27;};'use strict';var DashboardItemEvents=require(_0x4c14('0x0'));var events=[_0x4c14('0x1'),_0x4c14('0x2'),_0x4c14('0x3')];function createListener(_0x11107d,_0x4a5aac){return function(_0x663755){_0x4a5aac[_0x4c14('0x4')](_0x11107d,_0x663755);};}function removeListener(_0x566e28,_0x1bfd6a){return function(){DashboardItemEvents[_0x4c14('0x5')](_0x566e28,_0x1bfd6a);};}exports['register']=function(_0x28a2af){for(var _0x55af13=0x0,_0x54fe86=events[_0x4c14('0x6')];_0x55af13<_0x54fe86;_0x55af13++){var _0x41e260=events[_0x55af13];var _0x3c5193=createListener(_0x4c14('0x7')+_0x41e260,_0x28a2af);DashboardItemEvents['on'](_0x41e260,_0x3c5193);}}; \ No newline at end of file +var _0x73aa=['register','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x51168f,_0x27f5ae){var _0x276ee6=function(_0x3ceb26){while(--_0x3ceb26){_0x51168f['push'](_0x51168f['shift']());}};_0x276ee6(++_0x27f5ae);}(_0x73aa,0x14a));var _0xa73a=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x73aa[_0x3e7e96];return _0x13f6f0;};'use strict';var DashboardItemEvents=require(_0xa73a('0x0'));var events=[_0xa73a('0x1'),_0xa73a('0x2'),_0xa73a('0x3')];function createListener(_0x27be95,_0x44114b){return function(_0x29a628){_0x44114b[_0xa73a('0x4')](_0x27be95,_0x29a628);};}function removeListener(_0x38cf36,_0x5a301d){return function(){DashboardItemEvents[_0xa73a('0x5')](_0x38cf36,_0x5a301d);};}exports[_0xa73a('0x6')]=function(_0x364753){for(var _0x5b310f=0x0,_0x155bb7=events['length'];_0x5b310f<_0x155bb7;_0x5b310f++){var _0x205a10=events[_0x5b310f];var _0x904833=createListener(_0xa73a('0x7')+_0x205a10,_0x364753);DashboardItemEvents['on'](_0x205a10,_0x904833);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c3da9ae..806ab66 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['put','update','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post'];(function(_0xb27591,_0x3235a8){var _0x481a90=function(_0x162b90){while(--_0x162b90){_0xb27591['push'](_0xb27591['shift']());}};_0x481a90(++_0x3235a8);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x9')]('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0xa')]('/:id',auth[_0xee2f('0x8')](),controller[_0xee2f('0xb')]);router['delete'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _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(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x5fc3[_0xf2662b];return _0x257dc7;};'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 0f6bb02..4188b2d 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 _0x6c4c=['third','first','sequelize','STRING','ENUM'];(function(_0x254e65,_0x433dd3){var _0x16100d=function(_0x5b8a55){while(--_0x5b8a55){_0x254e65['push'](_0x254e65['shift']());}};_0x16100d(++_0x433dd3);}(_0x6c4c,0x8e));var _0xc6c4=function(_0x3bbd0e,_0x54966f){_0x3bbd0e=_0x3bbd0e-0x0;var _0x1075e3=_0x6c4c[_0x3bbd0e];return _0x1075e3;};'use strict';var Sequelize=require(_0xc6c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6c4('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xc6c4('0x2')]('first','second',_0xc6c4('0x3')),'allowNull':![],'defaultValue':_0xc6c4('0x4')},'description':{'type':Sequelize[_0xc6c4('0x1')]}}; \ No newline at end of file +var _0x562e=['STRING','ENUM','third','first','sequelize','exports'];(function(_0x5abd3c,_0x2685c){var _0x399f0e=function(_0x1bf899){while(--_0x1bf899){_0x5abd3c['push'](_0x5abd3c['shift']());}};_0x399f0e(++_0x2685c);}(_0x562e,0xd0));var _0xe562=function(_0x7d9c33,_0x508afc){_0x7d9c33=_0x7d9c33-0x0;var _0x351b87=_0x562e[_0x7d9c33];return _0x351b87;};'use strict';var Sequelize=require(_0xe562('0x0'));module[_0xe562('0x1')]={'name':{'type':Sequelize[_0xe562('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe562('0x3')]('first','second',_0xe562('0x4')),'allowNull':![],'defaultValue':_0xe562('0x5')},'description':{'type':Sequelize[_0xe562('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e48789e..8500f07 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 _0x7575=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Dispositions','stack','name','index','Disposition','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','catch','show','params','keys','includeAll','create','body','get'];(function(_0x426d05,_0xec50a4){var _0x3ceec8=function(_0x5237fd){while(--_0x5237fd){_0x426d05['push'](_0x426d05['shift']());}};_0x3ceec8(++_0xec50a4);}(_0x7575,0xb1));var _0x5757=function(_0x15d443,_0x2e7637){_0x15d443=_0x15d443-0x0;var _0x2e6a6d=_0x7575[_0x15d443];return _0x2e6a6d;};'use strict';var pdf=require(_0x5757('0x0'));var emlformat=require(_0x5757('0x1'));var rimraf=require(_0x5757('0x2'));var zipdir=require(_0x5757('0x3'));var jsonpatch=require(_0x5757('0x4'));var rp=require(_0x5757('0x5'));var moment=require(_0x5757('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5757('0x7'));var util=require(_0x5757('0x8'));var path=require(_0x5757('0x9'));var sox=require('sox');var csv=require(_0x5757('0xa'));var ejs=require(_0x5757('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5757('0xc'));var crypto=require('crypto');var jsforce=require(_0x5757('0xd'));var deskjs=require(_0x5757('0xe'));var toCsv=require(_0x5757('0xa'));var querystring=require(_0x5757('0xf'));var Papa=require(_0x5757('0x10'));var Redis=require(_0x5757('0x11'));var authService=require(_0x5757('0x12'));var qs=require(_0x5757('0x13'));var as=require(_0x5757('0x14'));var hardwareService=require(_0x5757('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5757('0x16'));var config=require(_0x5757('0x17'));var licenseUtil=require(_0x5757('0x18'));var db=require(_0x5757('0x19'))['db'];function respondWithStatusCode(_0x3c7e6d,_0x120824){_0x120824=_0x120824||0xcc;return function(_0x208277){if(_0x208277){return _0x3c7e6d[_0x5757('0x1a')](_0x120824);}return _0x3c7e6d[_0x5757('0x1b')](_0x120824)[_0x5757('0x1c')]();};}function respondWithResult(_0x3d8cea,_0x1c746d){_0x1c746d=_0x1c746d||0xc8;return function(_0x18fafb){if(_0x18fafb){return _0x3d8cea[_0x5757('0x1b')](_0x1c746d)['json'](_0x18fafb);}};}function respondWithFilteredResult(_0x8acc0c,_0xcea7bf){return function(_0x5ae42a){if(_0x5ae42a){var _0xf8e615=_0x5ae42a[_0x5757('0x1d')],_0x1423fb=_0xcea7bf[_0x5757('0x1e')],_0x33c07b=_0xcea7bf[_0x5757('0x1e')]+_0xcea7bf[_0x5757('0x1f')],_0x5afada;if(_0x33c07b>=_0xf8e615){_0x33c07b=_0xf8e615;_0x5afada=0xc8;}else{_0x5afada=0xce;}_0x8acc0c[_0x5757('0x1b')](_0x5afada);return _0x8acc0c[_0x5757('0x20')](_0x5757('0x21'),_0x1423fb+'-'+_0x33c07b+'/'+_0xf8e615)[_0x5757('0x22')](_0x5ae42a);}return null;};}function patchUpdates(_0x5f218e){return function(_0x129da8){try{jsonpatch[_0x5757('0x23')](_0x129da8,_0x5f218e,!![]);}catch(_0x1dafd6){return BPromise[_0x5757('0x24')](_0x1dafd6);}return _0x129da8[_0x5757('0x25')]();};}function saveUpdates(_0x8aa975,_0x4a2b81){return function(_0x1906e7){if(_0x1906e7){return _0x1906e7[_0x5757('0x26')](_0x8aa975)[_0x5757('0x27')](function(_0x246af7){return _0x246af7;});}return null;};}function removeEntity(_0x5ba7c4,_0x55d31a){return function(_0x408f4c){if(_0x408f4c){return _0x408f4c[_0x5757('0x28')]()[_0x5757('0x27')](function(){var _0x54076d=_0x408f4c['get']({'plain':!![]});var _0x5ca3f8=_0x5757('0x29');return db['UserProfileResource'][_0x5757('0x28')]({'where':{'type':_0x5ca3f8,'resourceId':_0x54076d['id']}})[_0x5757('0x27')](function(){return _0x408f4c;});})[_0x5757('0x27')](function(){_0x5ba7c4[_0x5757('0x1b')](0xcc)[_0x5757('0x1c')]();});}};}function handleEntityNotFound(_0x449862,_0x18bd0a){return function(_0x2d9763){if(!_0x2d9763){_0x449862[_0x5757('0x1a')](0x194);}return _0x2d9763;};}function handleError(_0x33e093,_0x4a731a){_0x4a731a=_0x4a731a||0x1f4;return function(_0x4970d1){logger['error'](_0x4970d1[_0x5757('0x2a')]);if(_0x4970d1[_0x5757('0x2b')]){delete _0x4970d1['name'];}_0x33e093[_0x5757('0x1b')](_0x4a731a)['send'](_0x4970d1);};}exports[_0x5757('0x2c')]=function(_0x2dd655,_0x2cbc6b){var _0x3af102={},_0x532f7b={},_0x3f2245={'count':0x0,'rows':[]};var _0x43ceb4=_['map'](db[_0x5757('0x2d')][_0x5757('0x2e')],function(_0x1c1ac8){return{'name':_0x1c1ac8[_0x5757('0x2f')],'type':_0x1c1ac8[_0x5757('0x30')]['key']};});_0x532f7b['model']=_[_0x5757('0x31')](_0x43ceb4,_0x5757('0x2b'));_0x532f7b[_0x5757('0x32')]=_['keys'](_0x2dd655[_0x5757('0x32')]);_0x532f7b[_0x5757('0x33')]=_['intersection'](_0x532f7b[_0x5757('0x34')],_0x532f7b[_0x5757('0x32')]);_0x3af102[_0x5757('0x35')]=_[_0x5757('0x36')](_0x532f7b['model'],qs[_0x5757('0x37')](_0x2dd655[_0x5757('0x32')][_0x5757('0x37')]));_0x3af102[_0x5757('0x35')]=_0x3af102[_0x5757('0x35')][_0x5757('0x38')]?_0x3af102['attributes']:_0x532f7b[_0x5757('0x34')];if(!_0x2dd655[_0x5757('0x32')][_0x5757('0x39')](_0x5757('0x3a'))){_0x3af102[_0x5757('0x1f')]=qs[_0x5757('0x1f')](_0x2dd655[_0x5757('0x32')]['limit']);_0x3af102[_0x5757('0x1e')]=qs['offset'](_0x2dd655[_0x5757('0x32')]['offset']);}_0x3af102[_0x5757('0x3b')]=qs['sort'](_0x2dd655[_0x5757('0x32')][_0x5757('0x3c')]);_0x3af102[_0x5757('0x3d')]=qs[_0x5757('0x33')](_['pick'](_0x2dd655[_0x5757('0x32')],_0x532f7b[_0x5757('0x33')]),_0x43ceb4);if(_0x2dd655['query']['filter']){_0x3af102[_0x5757('0x3d')]=_[_0x5757('0x3e')](_0x3af102['where'],{'$or':_[_0x5757('0x31')](_0x43ceb4,function(_0x20a5db){if(_0x20a5db[_0x5757('0x30')]!==_0x5757('0x3f')){var _0x16eed1={};_0x16eed1[_0x20a5db[_0x5757('0x2b')]]={'$like':'%'+_0x2dd655[_0x5757('0x32')][_0x5757('0x40')]+'%'};return _0x16eed1;}})});}_0x3af102=_[_0x5757('0x3e')]({},_0x3af102,_0x2dd655[_0x5757('0x41')]);var _0x112338={'where':_0x3af102['where']};return db[_0x5757('0x2d')]['count'](_0x112338)[_0x5757('0x27')](function(_0x29dad5){_0x3f2245[_0x5757('0x1d')]=_0x29dad5;if(_0x2dd655[_0x5757('0x32')]['includeAll']){_0x3af102[_0x5757('0x42')]=[{'all':!![]}];}return db[_0x5757('0x2d')]['findAll'](_0x3af102);})[_0x5757('0x27')](function(_0x17dec1){_0x3f2245['rows']=_0x17dec1;return _0x3f2245;})[_0x5757('0x27')](respondWithFilteredResult(_0x2cbc6b,_0x3af102))[_0x5757('0x43')](handleError(_0x2cbc6b,null));};exports[_0x5757('0x44')]=function(_0x351d42,_0x39e4f4){var _0x4e067f={'raw':!![],'where':{'id':_0x351d42[_0x5757('0x45')]['id']}},_0xfdae46={};_0xfdae46[_0x5757('0x34')]=_[_0x5757('0x46')](db[_0x5757('0x2d')][_0x5757('0x2e')]);_0xfdae46[_0x5757('0x32')]=_[_0x5757('0x46')](_0x351d42['query']);_0xfdae46['filters']=_[_0x5757('0x36')](_0xfdae46['model'],_0xfdae46[_0x5757('0x32')]);_0x4e067f[_0x5757('0x35')]=_[_0x5757('0x36')](_0xfdae46['model'],qs[_0x5757('0x37')](_0x351d42['query'][_0x5757('0x37')]));_0x4e067f[_0x5757('0x35')]=_0x4e067f[_0x5757('0x35')][_0x5757('0x38')]?_0x4e067f[_0x5757('0x35')]:_0xfdae46[_0x5757('0x34')];if(_0x351d42[_0x5757('0x32')][_0x5757('0x47')]){_0x4e067f[_0x5757('0x42')]=[{'all':!![]}];}_0x4e067f=_[_0x5757('0x3e')]({},_0x4e067f,_0x351d42['options']);return db['Disposition']['find'](_0x4e067f)[_0x5757('0x27')](handleEntityNotFound(_0x39e4f4,null))[_0x5757('0x27')](respondWithResult(_0x39e4f4,null))[_0x5757('0x43')](handleError(_0x39e4f4,null));};exports['create']=function(_0x53f1d2,_0x337dfd){return db[_0x5757('0x2d')][_0x5757('0x48')](_0x53f1d2[_0x5757('0x49')],{})[_0x5757('0x27')](function(_0x34ff9d){var _0x382a2e=_0x53f1d2['user'][_0x5757('0x4a')]({'plain':!![]});if(!_0x382a2e)throw new Error(_0x5757('0x4b'));if(_0x382a2e[_0x5757('0x4c')]===_0x5757('0x4d')){var _0x1f3775=_0x34ff9d[_0x5757('0x4a')]({'plain':!![]});var _0x7782cb=_0x5757('0x29');return db[_0x5757('0x4e')][_0x5757('0x4f')]({'where':{'name':_0x7782cb,'userProfileId':_0x382a2e[_0x5757('0x50')]},'raw':!![]})[_0x5757('0x27')](function(_0x11d0c6){if(_0x11d0c6&&_0x11d0c6['autoAssociation']===0x0){return db[_0x5757('0x51')][_0x5757('0x48')]({'name':_0x1f3775[_0x5757('0x2b')],'resourceId':_0x1f3775['id'],'type':_0x11d0c6[_0x5757('0x2b')],'sectionId':_0x11d0c6['id']},{})['then'](function(){return _0x34ff9d;});}else{return _0x34ff9d;}})[_0x5757('0x43')](function(_0x1a51c9){logger[_0x5757('0x52')](_0x5757('0x53'),_0x1a51c9);throw _0x1a51c9;});}return _0x34ff9d;})[_0x5757('0x27')](respondWithResult(_0x337dfd,0xc9))[_0x5757('0x43')](handleError(_0x337dfd,null));};exports[_0x5757('0x26')]=function(_0x4a757f,_0x1d030e){if(_0x4a757f[_0x5757('0x49')]['id']){delete _0x4a757f[_0x5757('0x49')]['id'];}return db[_0x5757('0x2d')]['find']({'where':{'id':_0x4a757f[_0x5757('0x45')]['id']}})[_0x5757('0x27')](handleEntityNotFound(_0x1d030e,null))['then'](saveUpdates(_0x4a757f[_0x5757('0x49')],null))[_0x5757('0x27')](respondWithResult(_0x1d030e,null))[_0x5757('0x43')](handleError(_0x1d030e,null));};exports[_0x5757('0x28')]=function(_0x10d87f,_0xee1bf3){return db[_0x5757('0x2d')][_0x5757('0x4f')]({'where':{'id':_0x10d87f[_0x5757('0x45')]['id']}})[_0x5757('0x27')](handleEntityNotFound(_0xee1bf3,null))['then'](removeEntity(_0xee1bf3,null))[_0x5757('0x43')](handleError(_0xee1bf3,null));}; \ No newline at end of file +var _0x003e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','params','find','create','body','user','role','Dispositions','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','eml-format'];(function(_0x3abbd1,_0x18875e){var _0x176ed5=function(_0x997ab5){while(--_0x997ab5){_0x3abbd1['push'](_0x3abbd1['shift']());}};_0x176ed5(++_0x18875e);}(_0x003e,0x98));var _0xe003=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x003e[_0x2ae8ce];return _0x4bf686;};'use strict';var pdf=require(_0xe003('0x0'));var emlformat=require(_0xe003('0x1'));var rimraf=require(_0xe003('0x2'));var zipdir=require(_0xe003('0x3'));var jsonpatch=require(_0xe003('0x4'));var rp=require(_0xe003('0x5'));var moment=require(_0xe003('0x6'));var BPromise=require(_0xe003('0x7'));var Mustache=require(_0xe003('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe003('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe003('0xa'));var crypto=require(_0xe003('0xb'));var jsforce=require(_0xe003('0xc'));var deskjs=require(_0xe003('0xd'));var toCsv=require(_0xe003('0x9'));var querystring=require('querystring');var Papa=require(_0xe003('0xe'));var Redis=require('ioredis');var authService=require(_0xe003('0xf'));var qs=require(_0xe003('0x10'));var as=require(_0xe003('0x11'));var hardwareService=require(_0xe003('0x12'));var logger=require('../../config/logger')(_0xe003('0x13'));var utils=require(_0xe003('0x14'));var config=require(_0xe003('0x15'));var licenseUtil=require(_0xe003('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249444,_0x6a5af9){_0x6a5af9=_0x6a5af9||0xcc;return function(_0x4ac7e5){if(_0x4ac7e5){return _0x249444[_0xe003('0x17')](_0x6a5af9);}return _0x249444[_0xe003('0x18')](_0x6a5af9)[_0xe003('0x19')]();};}function respondWithResult(_0x4a89fb,_0x318191){_0x318191=_0x318191||0xc8;return function(_0x3fd573){if(_0x3fd573){return _0x4a89fb[_0xe003('0x18')](_0x318191)[_0xe003('0x1a')](_0x3fd573);}};}function respondWithFilteredResult(_0x268b28,_0x58edc2){return function(_0x28a26b){if(_0x28a26b){var _0x347886=_0x28a26b[_0xe003('0x1b')],_0x5c07ee=_0x58edc2[_0xe003('0x1c')],_0x3df079=_0x58edc2[_0xe003('0x1c')]+_0x58edc2['limit'],_0x48552c;if(_0x3df079>=_0x347886){_0x3df079=_0x347886;_0x48552c=0xc8;}else{_0x48552c=0xce;}_0x268b28['status'](_0x48552c);return _0x268b28['set'](_0xe003('0x1d'),_0x5c07ee+'-'+_0x3df079+'/'+_0x347886)[_0xe003('0x1a')](_0x28a26b);}return null;};}function patchUpdates(_0x5868cd){return function(_0x15e337){try{jsonpatch[_0xe003('0x1e')](_0x15e337,_0x5868cd,!![]);}catch(_0x17c1e8){return BPromise[_0xe003('0x1f')](_0x17c1e8);}return _0x15e337[_0xe003('0x20')]();};}function saveUpdates(_0x56b080,_0x331bfe){return function(_0x58b582){if(_0x58b582){return _0x58b582[_0xe003('0x21')](_0x56b080)[_0xe003('0x22')](function(_0x222a02){return _0x222a02;});}return null;};}function removeEntity(_0x5f2905,_0x507438){return function(_0xfe170d){if(_0xfe170d){return _0xfe170d[_0xe003('0x23')]()[_0xe003('0x22')](function(){var _0x25a968=_0xfe170d[_0xe003('0x24')]({'plain':!![]});var _0x5ab5d4='Dispositions';return db[_0xe003('0x25')][_0xe003('0x23')]({'where':{'type':_0x5ab5d4,'resourceId':_0x25a968['id']}})[_0xe003('0x22')](function(){return _0xfe170d;});})[_0xe003('0x22')](function(){_0x5f2905['status'](0xcc)[_0xe003('0x19')]();});}};}function handleEntityNotFound(_0x4e0ec8,_0x6b7b8){return function(_0x369f37){if(!_0x369f37){_0x4e0ec8['sendStatus'](0x194);}return _0x369f37;};}function handleError(_0x2d5d41,_0xebb0a1){_0xebb0a1=_0xebb0a1||0x1f4;return function(_0x182d5a){logger['error'](_0x182d5a['stack']);if(_0x182d5a[_0xe003('0x26')]){delete _0x182d5a['name'];}_0x2d5d41[_0xe003('0x18')](_0xebb0a1)[_0xe003('0x27')](_0x182d5a);};}exports[_0xe003('0x28')]=function(_0xb38755,_0x1ffe10){var _0x57e3c9={},_0x356616={},_0x46dc4c={'count':0x0,'rows':[]};var _0x3aea33=_[_0xe003('0x29')](db[_0xe003('0x2a')][_0xe003('0x2b')],function(_0x267075){return{'name':_0x267075[_0xe003('0x2c')],'type':_0x267075[_0xe003('0x2d')][_0xe003('0x2e')]};});_0x356616[_0xe003('0x2f')]=_[_0xe003('0x29')](_0x3aea33,_0xe003('0x26'));_0x356616['query']=_[_0xe003('0x30')](_0xb38755[_0xe003('0x31')]);_0x356616[_0xe003('0x32')]=_[_0xe003('0x33')](_0x356616[_0xe003('0x2f')],_0x356616[_0xe003('0x31')]);_0x57e3c9['attributes']=_[_0xe003('0x33')](_0x356616[_0xe003('0x2f')],qs['fields'](_0xb38755[_0xe003('0x31')][_0xe003('0x34')]));_0x57e3c9[_0xe003('0x35')]=_0x57e3c9[_0xe003('0x35')][_0xe003('0x36')]?_0x57e3c9[_0xe003('0x35')]:_0x356616[_0xe003('0x2f')];if(!_0xb38755[_0xe003('0x31')][_0xe003('0x37')](_0xe003('0x38'))){_0x57e3c9[_0xe003('0x39')]=qs[_0xe003('0x39')](_0xb38755[_0xe003('0x31')][_0xe003('0x39')]);_0x57e3c9['offset']=qs['offset'](_0xb38755[_0xe003('0x31')][_0xe003('0x1c')]);}_0x57e3c9['order']=qs['sort'](_0xb38755[_0xe003('0x31')][_0xe003('0x3a')]);_0x57e3c9[_0xe003('0x3b')]=qs[_0xe003('0x32')](_[_0xe003('0x3c')](_0xb38755[_0xe003('0x31')],_0x356616[_0xe003('0x32')]),_0x3aea33);if(_0xb38755[_0xe003('0x31')]['filter']){_0x57e3c9[_0xe003('0x3b')]=_['merge'](_0x57e3c9[_0xe003('0x3b')],{'$or':_['map'](_0x3aea33,function(_0x5ae0c6){if(_0x5ae0c6[_0xe003('0x2d')]!=='VIRTUAL'){var _0x41db01={};_0x41db01[_0x5ae0c6[_0xe003('0x26')]]={'$like':'%'+_0xb38755[_0xe003('0x31')][_0xe003('0x3d')]+'%'};return _0x41db01;}})});}_0x57e3c9=_[_0xe003('0x3e')]({},_0x57e3c9,_0xb38755[_0xe003('0x3f')]);var _0x41d152={'where':_0x57e3c9[_0xe003('0x3b')]};return db[_0xe003('0x2a')][_0xe003('0x1b')](_0x41d152)[_0xe003('0x22')](function(_0x2f2f7d){_0x46dc4c[_0xe003('0x1b')]=_0x2f2f7d;if(_0xb38755[_0xe003('0x31')][_0xe003('0x40')]){_0x57e3c9['include']=[{'all':!![]}];}return db[_0xe003('0x2a')][_0xe003('0x41')](_0x57e3c9);})[_0xe003('0x22')](function(_0x32464f){_0x46dc4c['rows']=_0x32464f;return _0x46dc4c;})['then'](respondWithFilteredResult(_0x1ffe10,_0x57e3c9))['catch'](handleError(_0x1ffe10,null));};exports['show']=function(_0x3e0fb4,_0x404202){var _0x1a0705={'raw':!![],'where':{'id':_0x3e0fb4[_0xe003('0x42')]['id']}},_0x45bdd3={};_0x45bdd3[_0xe003('0x2f')]=_[_0xe003('0x30')](db[_0xe003('0x2a')][_0xe003('0x2b')]);_0x45bdd3[_0xe003('0x31')]=_[_0xe003('0x30')](_0x3e0fb4['query']);_0x45bdd3[_0xe003('0x32')]=_[_0xe003('0x33')](_0x45bdd3[_0xe003('0x2f')],_0x45bdd3[_0xe003('0x31')]);_0x1a0705['attributes']=_[_0xe003('0x33')](_0x45bdd3[_0xe003('0x2f')],qs[_0xe003('0x34')](_0x3e0fb4[_0xe003('0x31')][_0xe003('0x34')]));_0x1a0705[_0xe003('0x35')]=_0x1a0705[_0xe003('0x35')][_0xe003('0x36')]?_0x1a0705[_0xe003('0x35')]:_0x45bdd3[_0xe003('0x2f')];if(_0x3e0fb4[_0xe003('0x31')][_0xe003('0x40')]){_0x1a0705['include']=[{'all':!![]}];}_0x1a0705=_[_0xe003('0x3e')]({},_0x1a0705,_0x3e0fb4[_0xe003('0x3f')]);return db['Disposition'][_0xe003('0x43')](_0x1a0705)[_0xe003('0x22')](handleEntityNotFound(_0x404202,null))[_0xe003('0x22')](respondWithResult(_0x404202,null))['catch'](handleError(_0x404202,null));};exports[_0xe003('0x44')]=function(_0x4e734e,_0x4beb54){return db['Disposition'][_0xe003('0x44')](_0x4e734e[_0xe003('0x45')],{})['then'](function(_0x158383){var _0x15b4c2=_0x4e734e[_0xe003('0x46')]['get']({'plain':!![]});if(!_0x15b4c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b4c2[_0xe003('0x47')]===_0xe003('0x46')){var _0x1806b8=_0x158383[_0xe003('0x24')]({'plain':!![]});var _0x142ba0=_0xe003('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x142ba0,'userProfileId':_0x15b4c2[_0xe003('0x49')]},'raw':!![]})['then'](function(_0x3f487a){if(_0x3f487a&&_0x3f487a['autoAssociation']===0x0){return db[_0xe003('0x25')][_0xe003('0x44')]({'name':_0x1806b8['name'],'resourceId':_0x1806b8['id'],'type':_0x3f487a[_0xe003('0x26')],'sectionId':_0x3f487a['id']},{})[_0xe003('0x22')](function(){return _0x158383;});}else{return _0x158383;}})['catch'](function(_0x48ef8a){logger[_0xe003('0x4a')](_0xe003('0x4b'),_0x48ef8a);throw _0x48ef8a;});}return _0x158383;})[_0xe003('0x22')](respondWithResult(_0x4beb54,0xc9))[_0xe003('0x4c')](handleError(_0x4beb54,null));};exports[_0xe003('0x21')]=function(_0x1bdcc2,_0x23ee43){if(_0x1bdcc2[_0xe003('0x45')]['id']){delete _0x1bdcc2[_0xe003('0x45')]['id'];}return db['Disposition'][_0xe003('0x43')]({'where':{'id':_0x1bdcc2[_0xe003('0x42')]['id']}})['then'](handleEntityNotFound(_0x23ee43,null))['then'](saveUpdates(_0x1bdcc2['body'],null))[_0xe003('0x22')](respondWithResult(_0x23ee43,null))[_0xe003('0x4c')](handleError(_0x23ee43,null));};exports[_0xe003('0x23')]=function(_0x1852cb,_0x94e68f){return db[_0xe003('0x2a')]['find']({'where':{'id':_0x1852cb[_0xe003('0x42')]['id']}})[_0xe003('0x22')](handleEntityNotFound(_0x94e68f,null))['then'](removeEntity(_0x94e68f,null))[_0xe003('0x4c')](handleError(_0x94e68f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 99234bf..147de9c 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 _0x1a28=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0x57c49b,_0x512e22){var _0x24fcb9=function(_0x2bc418){while(--_0x2bc418){_0x57c49b['push'](_0x57c49b['shift']());}};_0x24fcb9(++_0x512e22);}(_0x1a28,0x10e));var _0x81a2=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x1a28[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var logger=require(_0x81a2('0x2'))(_0x81a2('0x3'));var moment=require(_0x81a2('0x4'));var BPromise=require(_0x81a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x81a2('0x6'));var config=require(_0x81a2('0x7'));var attributes=require(_0x81a2('0x8'));module['exports']=function(_0x4188d7,_0x20dcd4){return _0x4188d7['define'](_0x81a2('0x9'),attributes,{'tableName':_0x81a2('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x81a2('0xb'),'fields':[_0x81a2('0xc'),_0x81a2('0xd')]},{'unique':!![],'name':_0x81a2('0xe'),'fields':[_0x81a2('0xc'),_0x81a2('0xf')]},{'unique':!![],'name':_0x81a2('0x10'),'fields':['name',_0x81a2('0x11')]},{'unique':!![],'name':_0x81a2('0x12'),'fields':[_0x81a2('0xc'),_0x81a2('0x13')]},{'unique':!![],'name':_0x81a2('0x14'),'fields':['name',_0x81a2('0x15')]},{'unique':!![],'name':_0x81a2('0x16'),'fields':[_0x81a2('0xc'),_0x81a2('0x17')]},{'unique':!![],'name':_0x81a2('0x18'),'fields':[_0x81a2('0xc'),_0x81a2('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7958=['path','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x255b41,_0x10c62f){var _0x3f3ed5=function(_0x29d689){while(--_0x29d689){_0x255b41['push'](_0x255b41['shift']());}};_0x3f3ed5(++_0x10c62f);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var logger=require('../../config/logger')(_0x8795('0x2'));var moment=require(_0x8795('0x3'));var BPromise=require(_0x8795('0x4'));var rp=require(_0x8795('0x5'));var fs=require('fs');var path=require(_0x8795('0x6'));var rimraf=require(_0x8795('0x7'));var config=require(_0x8795('0x8'));var attributes=require(_0x8795('0x9'));module['exports']=function(_0xed1860,_0x456403){return _0xed1860[_0x8795('0xa')]('Disposition',attributes,{'tableName':_0x8795('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x8795('0xc'),_0x8795('0xd')]},{'unique':!![],'name':_0x8795('0xe'),'fields':[_0x8795('0xc'),_0x8795('0xf')]},{'unique':!![],'name':_0x8795('0x10'),'fields':[_0x8795('0xc'),_0x8795('0x11')]},{'unique':!![],'name':_0x8795('0x12'),'fields':[_0x8795('0xc'),_0x8795('0x13')]},{'unique':!![],'name':_0x8795('0x14'),'fields':[_0x8795('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x8795('0x15'),'fields':[_0x8795('0xc'),_0x8795('0x16')]},{'unique':!![],'name':_0x8795('0x17'),'fields':[_0x8795('0xc'),_0x8795('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8c28903..2c97a2f 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 _0x461a=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment'];(function(_0x5f5497,_0x50803a){var _0x10e943=function(_0x2f5faa){while(--_0x2f5faa){_0x5f5497['push'](_0x5f5497['shift']());}};_0x10e943(++_0x50803a);}(_0x461a,0x10f));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa461('0x0'));var BPromise=require(_0xa461('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa461('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa461('0x3'));var logger=require(_0xa461('0x4'))('rpc');var config=require(_0xa461('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa461('0x6')][_0xa461('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x211401,_0x49f01b,_0x654ef4){return new BPromise(function(_0x127fa8,_0x32fc0a){return client['request'](_0x211401,_0x654ef4)[_0xa461('0x8')](function(_0x4bde38){logger[_0xa461('0x9')](_0xa461('0xa'),_0x49f01b,_0xa461('0xb'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x49f01b,'request\x20sent',JSON[_0xa461('0xc')](_0x4bde38));if(_0x4bde38[_0xa461('0xd')]){if(_0x4bde38[_0xa461('0xd')]['code']===0x1f4){logger['error'](_0xa461('0xa'),_0x49f01b,_0x4bde38[_0xa461('0xd')][_0xa461('0xe')]);return _0x32fc0a(_0x4bde38[_0xa461('0xd')][_0xa461('0xe')]);}logger[_0xa461('0xd')](_0xa461('0xa'),_0x49f01b,_0x4bde38[_0xa461('0xd')]['message']);return _0x127fa8(_0x4bde38[_0xa461('0xd')]['message']);}else{logger[_0xa461('0x9')](_0xa461('0xa'),_0x49f01b,'request\x20sent');_0x127fa8(_0x4bde38[_0xa461('0xf')][_0xa461('0xe')]);}})[_0xa461('0x10')](function(_0x6d9b75){logger[_0xa461('0xd')](_0xa461('0xa'),_0x49f01b,_0x6d9b75);_0x32fc0a(_0x6d9b75);});});} \ No newline at end of file +var _0x27b7=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message'];(function(_0xf5237b,_0x583762){var _0x259dad=function(_0x2e5976){while(--_0x2e5976){_0xf5237b['push'](_0xf5237b['shift']());}};_0x259dad(++_0x583762);}(_0x27b7,0x183));var _0x727b=function(_0x4064b7,_0x55aa34){_0x4064b7=_0x4064b7-0x0;var _0x2b4aae=_0x27b7[_0x4064b7];return _0x2b4aae;};'use strict';var _=require(_0x727b('0x0'));var util=require(_0x727b('0x1'));var moment=require(_0x727b('0x2'));var BPromise=require(_0x727b('0x3'));var rs=require(_0x727b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x727b('0x5'));var logger=require(_0x727b('0x6'))(_0x727b('0x7'));var config=require(_0x727b('0x8'));var jayson=require(_0x727b('0x9'));var client=jayson['client'][_0x727b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25a006,_0x13fb07,_0x1dfa01){return new BPromise(function(_0x5d1e98,_0xf1fc27){return client[_0x727b('0xb')](_0x25a006,_0x1dfa01)[_0x727b('0xc')](function(_0x3a738b){logger['info']('Disposition,\x20%s,\x20%s',_0x13fb07,_0x727b('0xd'));logger[_0x727b('0xe')](_0x727b('0xf'),_0x13fb07,'request\x20sent',JSON[_0x727b('0x10')](_0x3a738b));if(_0x3a738b[_0x727b('0x11')]){if(_0x3a738b[_0x727b('0x11')][_0x727b('0x12')]===0x1f4){logger[_0x727b('0x11')](_0x727b('0x13'),_0x13fb07,_0x3a738b[_0x727b('0x11')]['message']);return _0xf1fc27(_0x3a738b[_0x727b('0x11')]['message']);}logger[_0x727b('0x11')](_0x727b('0x13'),_0x13fb07,_0x3a738b['error']['message']);return _0x5d1e98(_0x3a738b[_0x727b('0x11')][_0x727b('0x14')]);}else{logger[_0x727b('0x15')](_0x727b('0x13'),_0x13fb07,_0x727b('0xd'));_0x5d1e98(_0x3a738b[_0x727b('0x16')]['message']);}})[_0x727b('0x17')](function(_0x287ad0){logger[_0x727b('0x11')](_0x727b('0x13'),_0x13fb07,_0x287ad0);_0xf1fc27(_0x287ad0);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 3b17f78..33fd7b0 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 _0x148b=['show','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x13023a,_0x4ea1fb){var _0x1bfe41=function(_0xee3332){while(--_0xee3332){_0x13023a['push'](_0x13023a['shift']());}};_0x1bfe41(++_0x4ea1fb);}(_0x148b,0xf7));var _0xb148=function(_0x215809,_0x151d51){_0x215809=_0x215809-0x0;var _0x369ff5=_0x148b[_0x215809];return _0x369ff5;};'use strict';var multer=require(_0xb148('0x0'));var util=require(_0xb148('0x1'));var path=require(_0xb148('0x2'));var timeout=require('connect-timeout');var express=require(_0xb148('0x3'));var router=express[_0xb148('0x4')]();var auth=require(_0xb148('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xb148('0x6')]('/',auth[_0xb148('0x7')](),controller[_0xb148('0x8')]);router[_0xb148('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb148('0x9')]);router[_0xb148('0xa')]('/',auth[_0xb148('0x7')](),controller[_0xb148('0xb')]);router['put'](_0xb148('0xc'),auth[_0xb148('0x7')](),controller['update']);router[_0xb148('0xd')](_0xb148('0xc'),auth['isAuthenticated'](),controller[_0xb148('0xe')]);module[_0xb148('0xf')]=router; \ No newline at end of file +var _0xb00c=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy'];(function(_0x1b35b4,_0x5559ff){var _0x18445d=function(_0x22b61f){while(--_0x22b61f){_0x1b35b4['push'](_0x1b35b4['shift']());}};_0x18445d(++_0x5559ff);}(_0xb00c,0x111));var _0xcb00=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0xb00c[_0x2786ea];return _0x5c38e5;};'use strict';var multer=require('multer');var util=require(_0xcb00('0x0'));var path=require(_0xcb00('0x1'));var timeout=require(_0xcb00('0x2'));var express=require('express');var router=express[_0xcb00('0x3')]();var auth=require(_0xcb00('0x4'));var interaction=require(_0xcb00('0x5'));var config=require(_0xcb00('0x6'));var controller=require('./disposition.controller');router[_0xcb00('0x7')]('/',auth[_0xcb00('0x8')](),controller[_0xcb00('0x9')]);router[_0xcb00('0x7')](_0xcb00('0xa'),auth[_0xcb00('0x8')](),controller['show']);router[_0xcb00('0xb')]('/',auth[_0xcb00('0x8')](),controller[_0xcb00('0xc')]);router[_0xcb00('0xd')](_0xcb00('0xa'),auth['isAuthenticated'](),controller[_0xcb00('0xe')]);router['delete'](_0xcb00('0xa'),auth[_0xcb00('0x8')](),controller[_0xcb00('0xf')]);module[_0xcb00('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 577a05b..8439fdf 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 _0xcee2=['14400','v17,v27,v29','INTEGER','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcee2,0x9c));var _0x2cee=function(_0xe79a5a,_0x1d4860){_0xe79a5a=_0xe79a5a-0x0;var _0x512fe2=_0xcee2[_0xe79a5a];return _0x512fe2;};'use strict';var Sequelize=require(_0x2cee('0x0'));module[_0x2cee('0x1')]={'name':{'type':Sequelize[_0x2cee('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2cee('0x2')]},'ecm':{'type':Sequelize[_0x2cee('0x3')](_0x2cee('0x4'),'no'),'defaultValue':_0x2cee('0x4')},'headerinfo':{'type':Sequelize[_0x2cee('0x2')],'defaultValue':_0x2cee('0x5')},'localstationid':{'type':Sequelize[_0x2cee('0x2')],'unique':_0x2cee('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x2cee('0x7'),_0x2cee('0x8'),_0x2cee('0x9'),_0x2cee('0xa'),_0x2cee('0xb'),_0x2cee('0xc')),'defaultValue':_0x2cee('0x8')},'maxrate':{'type':Sequelize[_0x2cee('0x3')](_0x2cee('0x7'),_0x2cee('0x8'),'7200',_0x2cee('0xa'),'12000',_0x2cee('0xc')),'defaultValue':_0x2cee('0xc')},'modem':{'type':Sequelize[_0x2cee('0x2')],'defaultValue':_0x2cee('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2cee('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2cee('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0x2cee('0xf'),'KHOMP'),'defaultValue':_0x2cee('0x10')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2cee('0x11')],'defaultValue':function(){return _0x2cee('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2cee('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2cee('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2cee('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2cee('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2cee('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2cee('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2cee('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2cee('0x13')],'defaultValue':![],'comment':_0x2cee('0x14'),'set':function(_0x31d346){if(!_0x31d346)this[_0x2cee('0x15')](_0x2cee('0x16'),null);this[_0x2cee('0x15')](_0x2cee('0x17'),_0x31d346);}}}; \ No newline at end of file +var _0x8e7d=['4800','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400'];(function(_0x482672,_0x49d13c){var _0x32236b=function(_0xe81f5e){while(--_0xe81f5e){_0x482672['push'](_0x482672['shift']());}};_0x32236b(++_0x49d13c);}(_0x8e7d,0x97));var _0xd8e7=function(_0x584a51,_0x3dcc2a){_0x584a51=_0x584a51-0x0;var _0x25d14d=_0x8e7d[_0x584a51];return _0x25d14d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd8e7('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8e7('0x0')]},'ecm':{'type':Sequelize[_0xd8e7('0x1')](_0xd8e7('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xd8e7('0x3')},'localstationid':{'type':Sequelize[_0xd8e7('0x0')],'unique':_0xd8e7('0x4')},'minrate':{'type':Sequelize[_0xd8e7('0x1')](_0xd8e7('0x5'),'4800',_0xd8e7('0x6'),_0xd8e7('0x7'),_0xd8e7('0x8'),_0xd8e7('0x9')),'defaultValue':_0xd8e7('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0xd8e7('0x5'),'4800',_0xd8e7('0x6'),'9600','12000',_0xd8e7('0x9')),'defaultValue':_0xd8e7('0x9')},'modem':{'type':Sequelize[_0xd8e7('0x0')],'defaultValue':_0xd8e7('0xb')},'gateway':{'type':Sequelize[_0xd8e7('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd8e7('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd8e7('0x1')](_0xd8e7('0xd'),'IAX',_0xd8e7('0xe'),_0xd8e7('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xd8e7('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd8e7('0x10');}},'notificationSound':{'type':Sequelize[_0xd8e7('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd8e7('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd8e7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd8e7('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd8e7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd8e7('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8e7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8e7('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xd8e7('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xd8e7('0x11')],'defaultValue':![],'comment':_0xd8e7('0x13'),'set':function(_0x2c4fe4){if(!_0x2c4fe4)this[_0xd8e7('0x14')](_0xd8e7('0x15'),null);this[_0xd8e7('0x14')](_0xd8e7('0x16'),_0x2c4fe4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index efa0c03..8a37781 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 _0x2dde=['CmList','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','FaxAccount','findAll','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','body','params','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','length','order','FaxAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','bulkCreate','updateAccountApplications','transaction','VoiceExtension','omit','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format'];(function(_0x590336,_0x5a16db){var _0x1ee6df=function(_0x22e045){while(--_0x22e045){_0x590336['push'](_0x590336['shift']());}};_0x1ee6df(++_0x5a16db);}(_0x2dde,0x19a));var _0xe2dd=function(_0x181a4,_0x4141ac){_0x181a4=_0x181a4-0x0;var _0x9aa94f=_0x2dde[_0x181a4];return _0x9aa94f;};'use strict';var pdf=require(_0xe2dd('0x0'));var emlformat=require(_0xe2dd('0x1'));var rimraf=require(_0xe2dd('0x2'));var zipdir=require(_0xe2dd('0x3'));var jsonpatch=require(_0xe2dd('0x4'));var rp=require('request-promise');var moment=require(_0xe2dd('0x5'));var BPromise=require(_0xe2dd('0x6'));var Mustache=require('mustache');var util=require(_0xe2dd('0x7'));var path=require('path');var sox=require(_0xe2dd('0x8'));var csv=require(_0xe2dd('0x9'));var ejs=require(_0xe2dd('0xa'));var fs=require('fs');var _=require(_0xe2dd('0xb'));var squel=require(_0xe2dd('0xc'));var crypto=require(_0xe2dd('0xd'));var jsforce=require(_0xe2dd('0xe'));var deskjs=require(_0xe2dd('0xf'));var toCsv=require(_0xe2dd('0x9'));var querystring=require(_0xe2dd('0x10'));var Papa=require(_0xe2dd('0x11'));var Redis=require('ioredis');var authService=require(_0xe2dd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe2dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2dd('0x14'))('api');var utils=require(_0xe2dd('0x15'));var config=require(_0xe2dd('0x16'));var licenseUtil=require(_0xe2dd('0x17'));var db=require(_0xe2dd('0x18'))['db'];config[_0xe2dd('0x19')]=_[_0xe2dd('0x1a')](config['redis'],{'host':_0xe2dd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2dd('0x19')]));require(_0xe2dd('0x1c'))[_0xe2dd('0x1d')](socket);var jayson=require(_0xe2dd('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe2dd('0x1f')][_0xe2dd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x349d0a,_0x26207f,_0x2b5709,_0x532551){return new BPromise(function(_0x1abf34,_0x340ff2){var _0x301fb1=_0x532551||client;return _0x301fb1[_0xe2dd('0x21')](_0x349d0a,_0x2b5709)[_0xe2dd('0x22')](function(_0x55bfd1){logger[_0xe2dd('0x23')](_0xe2dd('0x24'),_0x26207f,_0xe2dd('0x25'));logger[_0xe2dd('0x26')](_0xe2dd('0x27'),_0x26207f,_0xe2dd('0x25'),JSON[_0xe2dd('0x28')](_0x55bfd1));if(_0x55bfd1['error']){if(_0x55bfd1[_0xe2dd('0x29')][_0xe2dd('0x2a')]===0x1f4){logger[_0xe2dd('0x29')]('FaxAccount,\x20%s,\x20%s',_0x26207f,_0x55bfd1['error']['message']);return _0x340ff2(_0x55bfd1['error'][_0xe2dd('0x2b')]);}logger[_0xe2dd('0x29')](_0xe2dd('0x24'),_0x26207f,_0x55bfd1[_0xe2dd('0x29')][_0xe2dd('0x2b')]);return _0x1abf34(_0x55bfd1['error'][_0xe2dd('0x2b')]);}else{logger[_0xe2dd('0x23')](_0xe2dd('0x24'),_0x26207f,_0xe2dd('0x25'));_0x1abf34(_0x55bfd1[_0xe2dd('0x2c')]['message']);}})['catch'](function(_0x3875ee){logger[_0xe2dd('0x29')]('FaxAccount,\x20%s,\x20%s',_0x26207f,_0x3875ee);_0x340ff2(_0x3875ee);});});}function respondWithStatusCode(_0x15dca7,_0x313cb8){_0x313cb8=_0x313cb8||0xcc;return function(_0x10201f){if(_0x10201f){return _0x15dca7[_0xe2dd('0x2d')](_0x313cb8);}return _0x15dca7['status'](_0x313cb8)[_0xe2dd('0x2e')]();};}function respondWithResult(_0x58971d,_0x42272e){_0x42272e=_0x42272e||0xc8;return function(_0x434935){if(_0x434935){return _0x58971d[_0xe2dd('0x2f')](_0x42272e)[_0xe2dd('0x30')](_0x434935);}};}function respondWithFilteredResult(_0x189406,_0x5803d4){return function(_0x5e47df){if(_0x5e47df){var _0x10902a=_0x5e47df[_0xe2dd('0x31')],_0x570af3=_0x5803d4[_0xe2dd('0x32')],_0x195115=_0x5803d4[_0xe2dd('0x32')]+_0x5803d4[_0xe2dd('0x33')],_0x2188f7;if(_0x195115>=_0x10902a){_0x195115=_0x10902a;_0x2188f7=0xc8;}else{_0x2188f7=0xce;}_0x189406[_0xe2dd('0x2f')](_0x2188f7);return _0x189406[_0xe2dd('0x34')](_0xe2dd('0x35'),_0x570af3+'-'+_0x195115+'/'+_0x10902a)['json'](_0x5e47df);}return null;};}function patchUpdates(_0x21c69d){return function(_0x32ed8e){try{jsonpatch['apply'](_0x32ed8e,_0x21c69d,!![]);}catch(_0x1a8c4b){return BPromise['reject'](_0x1a8c4b);}return _0x32ed8e['save']();};}function saveUpdates(_0x239aa6,_0x2e4453){return function(_0x41729b){if(_0x41729b){return _0x41729b[_0xe2dd('0x36')](_0x239aa6)[_0xe2dd('0x22')](function(_0x24a31d){return _0x24a31d;});}return null;};}function removeEntity(_0x3c26b5,_0x5b6844){return function(_0x4a0a75){if(_0x4a0a75){return _0x4a0a75[_0xe2dd('0x37')]()[_0xe2dd('0x22')](function(){var _0x3d4c8e=_0x4a0a75[_0xe2dd('0x38')]({'plain':!![]});var _0x455e2a='FaxAccounts';return db[_0xe2dd('0x39')][_0xe2dd('0x37')]({'where':{'type':_0x455e2a,'resourceId':_0x3d4c8e['id']}})['then'](function(){return _0x4a0a75;});})[_0xe2dd('0x22')](function(){_0x3c26b5[_0xe2dd('0x2f')](0xcc)[_0xe2dd('0x2e')]();});}};}function handleEntityNotFound(_0x400b71,_0x514607){return function(_0x11ec30){if(!_0x11ec30){_0x400b71[_0xe2dd('0x2d')](0x194);}return _0x11ec30;};}function handleError(_0x42ceb8,_0x2859a2){_0x2859a2=_0x2859a2||0x1f4;return function(_0x5671f7){logger[_0xe2dd('0x29')](_0x5671f7[_0xe2dd('0x3a')]);if(_0x5671f7[_0xe2dd('0x3b')]){delete _0x5671f7[_0xe2dd('0x3b')];}_0x42ceb8['status'](_0x2859a2)[_0xe2dd('0x3c')](_0x5671f7);};}exports['index']=function(_0x82c5d6,_0x9126dd){var _0x3b237d={'include':[{'model':db[_0xe2dd('0x3d')],'as':_0xe2dd('0x3e')}]},_0x6bae75={},_0x114d12={'count':0x0,'rows':[]};var _0x4882cd=_[_0xe2dd('0x3f')](db['FaxAccount']['rawAttributes'],function(_0x213f63){return{'name':_0x213f63[_0xe2dd('0x40')],'type':_0x213f63[_0xe2dd('0x41')][_0xe2dd('0x42')]};});_0x6bae75['model']=_[_0xe2dd('0x3f')](_0x4882cd,'name');_0x6bae75[_0xe2dd('0x43')]=_['keys'](_0x82c5d6[_0xe2dd('0x43')]);_0x6bae75[_0xe2dd('0x44')]=_[_0xe2dd('0x45')](_0x6bae75[_0xe2dd('0x46')],_0x6bae75[_0xe2dd('0x43')]);_0x3b237d[_0xe2dd('0x47')]=_['intersection'](_0x6bae75[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0x82c5d6[_0xe2dd('0x43')][_0xe2dd('0x48')]));_0x3b237d[_0xe2dd('0x47')]=_0x3b237d[_0xe2dd('0x47')]['length']?_0x3b237d[_0xe2dd('0x47')]:_0x6bae75[_0xe2dd('0x46')];if(!_0x82c5d6[_0xe2dd('0x43')][_0xe2dd('0x49')](_0xe2dd('0x4a'))){_0x3b237d[_0xe2dd('0x33')]=qs['limit'](_0x82c5d6[_0xe2dd('0x43')][_0xe2dd('0x33')]);_0x3b237d['offset']=qs['offset'](_0x82c5d6[_0xe2dd('0x43')]['offset']);}_0x3b237d['order']=qs[_0xe2dd('0x4b')](_0x82c5d6[_0xe2dd('0x43')][_0xe2dd('0x4b')]);_0x3b237d[_0xe2dd('0x4c')]=qs[_0xe2dd('0x44')](_[_0xe2dd('0x4d')](_0x82c5d6[_0xe2dd('0x43')],_0x6bae75['filters']),_0x4882cd);if(_0x82c5d6['query'][_0xe2dd('0x4e')]){_0x3b237d[_0xe2dd('0x4c')]=_[_0xe2dd('0x4f')](_0x3b237d['where'],{'$or':_[_0xe2dd('0x3f')](_0x4882cd,function(_0x4ca903){if(_0x4ca903[_0xe2dd('0x41')]!=='VIRTUAL'){var _0x1f7c7b={};_0x1f7c7b[_0x4ca903[_0xe2dd('0x3b')]]={'$like':'%'+_0x82c5d6[_0xe2dd('0x43')][_0xe2dd('0x4e')]+'%'};return _0x1f7c7b;}})});}_0x3b237d=_[_0xe2dd('0x4f')]({},_0x3b237d,_0x82c5d6[_0xe2dd('0x50')]);var _0x514cf1={'where':_0x3b237d[_0xe2dd('0x4c')]};return db['FaxAccount']['count'](_0x514cf1)['then'](function(_0x19a15c){_0x114d12[_0xe2dd('0x31')]=_0x19a15c;if(_0x82c5d6['query'][_0xe2dd('0x51')]){_0x3b237d[_0xe2dd('0x52')]=[{'all':!![]}];}return db[_0xe2dd('0x53')][_0xe2dd('0x54')](_0x3b237d);})[_0xe2dd('0x22')](function(_0x49f8b4){_0x114d12['rows']=_0x49f8b4;return _0x114d12;})[_0xe2dd('0x22')](respondWithFilteredResult(_0x9126dd,_0x3b237d))[_0xe2dd('0x55')](handleError(_0x9126dd,null));};exports[_0xe2dd('0x56')]=function(_0x4210d9,_0x490f28){var _0x312f8d={'raw':![],'where':{'id':_0x4210d9['params']['id']},'include':[{'model':db[_0xe2dd('0x3d')],'as':_0xe2dd('0x3e')}]},_0x15826f={};_0x15826f[_0xe2dd('0x46')]=_[_0xe2dd('0x57')](db[_0xe2dd('0x53')]['rawAttributes']);_0x15826f[_0xe2dd('0x43')]=_[_0xe2dd('0x57')](_0x4210d9[_0xe2dd('0x43')]);_0x15826f[_0xe2dd('0x44')]=_[_0xe2dd('0x45')](_0x15826f[_0xe2dd('0x46')],_0x15826f[_0xe2dd('0x43')]);_0x312f8d[_0xe2dd('0x47')]=_[_0xe2dd('0x45')](_0x15826f[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0x4210d9[_0xe2dd('0x43')]['fields']));_0x312f8d[_0xe2dd('0x47')]=_0x312f8d[_0xe2dd('0x47')]['length']?_0x312f8d[_0xe2dd('0x47')]:_0x15826f[_0xe2dd('0x46')];if(_0x4210d9['query'][_0xe2dd('0x51')]){_0x312f8d[_0xe2dd('0x52')]=[{'all':!![]}];}_0x312f8d=_[_0xe2dd('0x4f')]({},_0x312f8d,_0x4210d9[_0xe2dd('0x50')]);return db['FaxAccount'][_0xe2dd('0x58')](_0x312f8d)[_0xe2dd('0x22')](handleEntityNotFound(_0x490f28,null))[_0xe2dd('0x22')](respondWithResult(_0x490f28,null))['catch'](handleError(_0x490f28,null));};exports[_0xe2dd('0x59')]=function(_0x1a8732,_0x18a3f1){return db['FaxAccount']['create'](_0x1a8732['body'],{})['then'](function(_0xb9b651){var _0x5ae90b=_0x1a8732[_0xe2dd('0x5a')][_0xe2dd('0x38')]({'plain':!![]});if(!_0x5ae90b)throw new Error(_0xe2dd('0x5b'));if(_0x5ae90b[_0xe2dd('0x5c')]===_0xe2dd('0x5a')){var _0x1a235d=_0xb9b651[_0xe2dd('0x38')]({'plain':!![]});var _0x4e1342=_0xe2dd('0x5d');return db['UserProfileSection'][_0xe2dd('0x58')]({'where':{'name':_0x4e1342,'userProfileId':_0x5ae90b[_0xe2dd('0x5e')]},'raw':!![]})[_0xe2dd('0x22')](function(_0x3d019a){if(_0x3d019a&&_0x3d019a[_0xe2dd('0x5f')]===0x0){return db[_0xe2dd('0x39')]['create']({'name':_0x1a235d[_0xe2dd('0x3b')],'resourceId':_0x1a235d['id'],'type':_0x3d019a[_0xe2dd('0x3b')],'sectionId':_0x3d019a['id']},{})['then'](function(){return _0xb9b651;});}else{return _0xb9b651;}})[_0xe2dd('0x55')](function(_0x3f3d5f){logger[_0xe2dd('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f3d5f);throw _0x3f3d5f;});}return _0xb9b651;})['then'](respondWithResult(_0x18a3f1,0xc9))[_0xe2dd('0x55')](handleError(_0x18a3f1,null));};exports[_0xe2dd('0x36')]=function(_0x464e7e,_0x1b5874){if(_0x464e7e['body']['id']){delete _0x464e7e[_0xe2dd('0x60')]['id'];}return db[_0xe2dd('0x53')]['find']({'where':{'id':_0x464e7e[_0xe2dd('0x61')]['id']},'include':[{'model':db[_0xe2dd('0x3d')],'as':_0xe2dd('0x3e')}]})[_0xe2dd('0x22')](handleEntityNotFound(_0x1b5874,null))[_0xe2dd('0x22')](saveUpdates(_0x464e7e['body'],null))[_0xe2dd('0x22')](respondWithResult(_0x1b5874,null))['catch'](handleError(_0x1b5874,null));};exports[_0xe2dd('0x37')]=function(_0x34cd15,_0x4b3cd7){return db[_0xe2dd('0x53')][_0xe2dd('0x58')]({'where':{'id':_0x34cd15[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x4b3cd7,null))['then'](removeEntity(_0x4b3cd7,null))[_0xe2dd('0x55')](handleError(_0x4b3cd7,null));};exports['describe']=function(_0x118352,_0x49044c){return db[_0xe2dd('0x53')][_0xe2dd('0x62')]()['then'](respondWithResult(_0x49044c,null))[_0xe2dd('0x55')](handleError(_0x49044c,null));};exports[_0xe2dd('0x63')]=function(_0xa87953,_0x43f254,_0x5d5658){if(_0xa87953['body']['id']){delete _0xa87953[_0xe2dd('0x60')]['id'];}return db[_0xe2dd('0x53')][_0xe2dd('0x58')]({'where':{'id':_0xa87953[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x43f254,null))[_0xe2dd('0x22')](function(_0x3d3b7){if(_0x3d3b7){_0xa87953['body']['FaxAccountId']=_0x3d3b7['id'];return db['Disposition']['create'](_0xa87953[_0xe2dd('0x60')]);}})[_0xe2dd('0x22')](respondWithResult(_0x43f254,null))['catch'](handleError(_0x43f254,null));};exports[_0xe2dd('0x64')]=function(_0x4526d1,_0x4ea93d,_0x407356){var _0x4ddf56={'raw':![],'where':{}};var _0x65c41c={};var _0x35504a={'count':0x0,'rows':[]};return db[_0xe2dd('0x53')][_0xe2dd('0x65')]({'where':{'id':_0x4526d1[_0xe2dd('0x61')]['id']}})['then'](handleEntityNotFound(_0x4ea93d,null))[_0xe2dd('0x22')](function(_0x92bccc){if(_0x92bccc){_0x65c41c[_0xe2dd('0x46')]=_[_0xe2dd('0x57')](db[_0xe2dd('0x66')][_0xe2dd('0x67')]);_0x65c41c['query']=_[_0xe2dd('0x57')](_0x4526d1[_0xe2dd('0x43')]);_0x65c41c[_0xe2dd('0x44')]=_[_0xe2dd('0x45')](_0x65c41c[_0xe2dd('0x46')],_0x65c41c[_0xe2dd('0x43')]);_0x4ddf56['attributes']=_[_0xe2dd('0x45')](_0x65c41c[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0x4526d1['query']['fields']));_0x4ddf56['attributes']=_0x4ddf56[_0xe2dd('0x47')][_0xe2dd('0x68')]?_0x4ddf56['attributes']:_0x65c41c[_0xe2dd('0x46')];if(!_0x4526d1[_0xe2dd('0x43')][_0xe2dd('0x49')]('nolimit')){_0x4ddf56['limit']=qs[_0xe2dd('0x33')](_0x4526d1['query'][_0xe2dd('0x33')]);_0x4ddf56['offset']=qs[_0xe2dd('0x32')](_0x4526d1['query'][_0xe2dd('0x32')]);}_0x4ddf56[_0xe2dd('0x69')]=qs[_0xe2dd('0x4b')](_0x4526d1[_0xe2dd('0x43')]['sort']);_0x4ddf56[_0xe2dd('0x4c')]=qs[_0xe2dd('0x44')](_['pick'](_0x4526d1['query'],_0x65c41c['filters']));_0x4ddf56[_0xe2dd('0x4c')][_0xe2dd('0x6a')]=_0x92bccc['id'];if(_0x4526d1[_0xe2dd('0x43')][_0xe2dd('0x4e')]){_0x4ddf56[_0xe2dd('0x4c')]=_[_0xe2dd('0x4f')](_0x4ddf56[_0xe2dd('0x4c')],{'$or':_[_0xe2dd('0x3f')](_0x4ddf56[_0xe2dd('0x47')],function(_0x47da14){var _0x5fea65={};_0x5fea65[_0x47da14]={'$like':'%'+_0x4526d1[_0xe2dd('0x43')][_0xe2dd('0x4e')]+'%'};return _0x5fea65;})});}_0x4ddf56=_[_0xe2dd('0x4f')]({},_0x4ddf56,_0x4526d1['options']);return db['Disposition'][_0xe2dd('0x31')]({'where':_0x4ddf56['where']})['then'](function(_0x2d7036){_0x35504a[_0xe2dd('0x31')]=_0x2d7036;if(_0x4526d1['query'][_0xe2dd('0x51')]){_0x4ddf56[_0xe2dd('0x52')]=[{'all':!![]}];}return db[_0xe2dd('0x66')]['findAll'](_0x4ddf56);})[_0xe2dd('0x22')](function(_0xb7eaf1){_0x35504a[_0xe2dd('0x6b')]=_0xb7eaf1;return _0x35504a;});}})[_0xe2dd('0x22')](respondWithFilteredResult(_0x4ea93d,_0x4ddf56))['catch'](handleError(_0x4ea93d,null));};exports['removeDispositions']=function(_0x42e8ed,_0x2ca598,_0x216b70){return db[_0xe2dd('0x53')]['find']({'where':{'id':_0x42e8ed['params']['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x2ca598,null))['then'](function(_0x440277){if(_0x440277){return _0x440277[_0xe2dd('0x6c')](_0x42e8ed[_0xe2dd('0x43')][_0xe2dd('0x6d')]);}})[_0xe2dd('0x22')](respondWithStatusCode(_0x2ca598,null))['catch'](handleError(_0x2ca598,null));};exports[_0xe2dd('0x6e')]=function(_0x3917ce,_0x128107,_0x328540){if(_0x3917ce['body']['id']){delete _0x3917ce[_0xe2dd('0x60')]['id'];}return db[_0xe2dd('0x53')]['find']({'where':{'id':_0x3917ce[_0xe2dd('0x61')]['id']}})['then'](handleEntityNotFound(_0x128107,null))['then'](function(_0x2f80c7){if(_0x2f80c7){_0x3917ce[_0xe2dd('0x60')][_0xe2dd('0x6a')]=_0x2f80c7['id'];return db['CannedAnswer'][_0xe2dd('0x59')](_0x3917ce[_0xe2dd('0x60')]);}})[_0xe2dd('0x22')](respondWithResult(_0x128107,null))['catch'](handleError(_0x128107,null));};exports['getAnswers']=function(_0x52411a,_0x22dfc6,_0x3d202a){var _0x36a53e={'raw':![],'where':{}};var _0x37840a={};var _0x5e1878={'count':0x0,'rows':[]};return db[_0xe2dd('0x53')]['findOne']({'where':{'id':_0x52411a[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x22dfc6,null))[_0xe2dd('0x22')](function(_0x5df76e){if(_0x5df76e){_0x37840a[_0xe2dd('0x46')]=_[_0xe2dd('0x57')](db['CannedAnswer']['rawAttributes']);_0x37840a['query']=_[_0xe2dd('0x57')](_0x52411a[_0xe2dd('0x43')]);_0x37840a['filters']=_[_0xe2dd('0x45')](_0x37840a[_0xe2dd('0x46')],_0x37840a[_0xe2dd('0x43')]);_0x36a53e[_0xe2dd('0x47')]=_[_0xe2dd('0x45')](_0x37840a[_0xe2dd('0x46')],qs['fields'](_0x52411a[_0xe2dd('0x43')][_0xe2dd('0x48')]));_0x36a53e[_0xe2dd('0x47')]=_0x36a53e['attributes'][_0xe2dd('0x68')]?_0x36a53e[_0xe2dd('0x47')]:_0x37840a['model'];if(!_0x52411a[_0xe2dd('0x43')][_0xe2dd('0x49')](_0xe2dd('0x4a'))){_0x36a53e[_0xe2dd('0x33')]=qs[_0xe2dd('0x33')](_0x52411a['query'][_0xe2dd('0x33')]);_0x36a53e[_0xe2dd('0x32')]=qs[_0xe2dd('0x32')](_0x52411a[_0xe2dd('0x43')][_0xe2dd('0x32')]);}_0x36a53e[_0xe2dd('0x69')]=qs['sort'](_0x52411a[_0xe2dd('0x43')][_0xe2dd('0x4b')]);_0x36a53e[_0xe2dd('0x4c')]=qs['filters'](_[_0xe2dd('0x4d')](_0x52411a[_0xe2dd('0x43')],_0x37840a[_0xe2dd('0x44')]));_0x36a53e[_0xe2dd('0x4c')][_0xe2dd('0x6a')]=_0x5df76e['id'];if(_0x52411a['query'][_0xe2dd('0x4e')]){_0x36a53e[_0xe2dd('0x4c')]=_['merge'](_0x36a53e[_0xe2dd('0x4c')],{'$or':_['map'](_0x36a53e[_0xe2dd('0x47')],function(_0x1fc150){var _0x4302b9={};_0x4302b9[_0x1fc150]={'$like':'%'+_0x52411a[_0xe2dd('0x43')]['filter']+'%'};return _0x4302b9;})});}_0x36a53e=_[_0xe2dd('0x4f')]({},_0x36a53e,_0x52411a[_0xe2dd('0x50')]);return db[_0xe2dd('0x6f')][_0xe2dd('0x31')]({'where':_0x36a53e[_0xe2dd('0x4c')]})[_0xe2dd('0x22')](function(_0x1608c7){_0x5e1878[_0xe2dd('0x31')]=_0x1608c7;if(_0x52411a[_0xe2dd('0x43')][_0xe2dd('0x51')]){_0x36a53e[_0xe2dd('0x52')]=[{'all':!![]}];}return db[_0xe2dd('0x6f')][_0xe2dd('0x54')](_0x36a53e);})[_0xe2dd('0x22')](function(_0x5a4e1f){_0x5e1878['rows']=_0x5a4e1f;return _0x5e1878;});}})[_0xe2dd('0x22')](respondWithFilteredResult(_0x22dfc6,_0x36a53e))[_0xe2dd('0x55')](handleError(_0x22dfc6,null));};exports[_0xe2dd('0x70')]=function(_0x303e11,_0x471e98,_0x55aabf){return db[_0xe2dd('0x53')]['find']({'where':{'id':_0x303e11[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x471e98,null))[_0xe2dd('0x22')](function(_0x27f711){if(_0x27f711){return _0x27f711[_0xe2dd('0x70')](_0x303e11[_0xe2dd('0x43')][_0xe2dd('0x6d')]);}})[_0xe2dd('0x22')](respondWithStatusCode(_0x471e98,null))[_0xe2dd('0x55')](handleError(_0x471e98,null));};exports[_0xe2dd('0x71')]=function(_0x2cb4ff,_0x3438d7,_0x58a0a2){return db[_0xe2dd('0x72')][_0xe2dd('0x58')]({'where':{'id':_0x2cb4ff['params']['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x3438d7,null))[_0xe2dd('0x22')](function(_0x416c30){if(_0x416c30){return _0x416c30[_0xe2dd('0x71')](_0x2cb4ff[_0xe2dd('0x60')]['ids'],_['omit'](_0x2cb4ff[_0xe2dd('0x60')],['ids','id'])||{});}})[_0xe2dd('0x22')](respondWithResult(_0x3438d7,null))[_0xe2dd('0x55')](handleError(_0x3438d7,null));};exports[_0xe2dd('0x73')]=function(_0xa7afaf,_0x1ee05,_0x1e6d41){var _0x5b29ca={'raw':![],'where':{}};var _0x254067={};var _0xb78b1b={'count':0x0,'rows':[]};return db[_0xe2dd('0x53')][_0xe2dd('0x65')]({'where':{'id':_0xa7afaf[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x1ee05,null))[_0xe2dd('0x22')](function(_0x5df8f0){if(_0x5df8f0){_0x254067[_0xe2dd('0x46')]=_[_0xe2dd('0x57')](db[_0xe2dd('0x72')][_0xe2dd('0x67')]);_0x254067[_0xe2dd('0x43')]=_[_0xe2dd('0x57')](_0xa7afaf[_0xe2dd('0x43')]);_0x254067[_0xe2dd('0x44')]=_['intersection'](_0x254067[_0xe2dd('0x46')],_0x254067[_0xe2dd('0x43')]);_0x5b29ca['attributes']=_[_0xe2dd('0x45')](_0x254067[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0xa7afaf[_0xe2dd('0x43')]['fields']));_0x5b29ca[_0xe2dd('0x47')]=_0x5b29ca[_0xe2dd('0x47')]['length']?_0x5b29ca[_0xe2dd('0x47')]:_0x254067['model'];if(!_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x49')](_0xe2dd('0x4a'))){_0x5b29ca[_0xe2dd('0x33')]=qs['limit'](_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x33')]);_0x5b29ca[_0xe2dd('0x32')]=qs[_0xe2dd('0x32')](_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x32')]);}_0x5b29ca[_0xe2dd('0x69')]=qs[_0xe2dd('0x4b')](_0xa7afaf['query'][_0xe2dd('0x4b')]);_0x5b29ca[_0xe2dd('0x4c')]=qs['filters'](_[_0xe2dd('0x4d')](_0xa7afaf[_0xe2dd('0x43')],_0x254067[_0xe2dd('0x44')]));_0x5b29ca[_0xe2dd('0x4c')]['FaxAccountId']=_0x5df8f0['id'];if(_0xa7afaf['query']['filter']){_0x5b29ca[_0xe2dd('0x4c')]=_[_0xe2dd('0x4f')](_0x5b29ca[_0xe2dd('0x4c')],{'$or':_[_0xe2dd('0x3f')](_0x5b29ca[_0xe2dd('0x47')],function(_0x242f96){var _0xf79eb7={};_0xf79eb7[_0x242f96]={'$like':'%'+_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x4e')]+'%'};return _0xf79eb7;})});}_0x5b29ca=_[_0xe2dd('0x4f')]({},_0x5b29ca,_0xa7afaf[_0xe2dd('0x50')]);return db[_0xe2dd('0x72')][_0xe2dd('0x31')]({'where':_0x5b29ca['where']})[_0xe2dd('0x22')](function(_0x15a2d2){_0xb78b1b[_0xe2dd('0x31')]=_0x15a2d2;if(_0xa7afaf['query'][_0xe2dd('0x51')]){_0x5b29ca[_0xe2dd('0x52')]=[{'model':db[_0xe2dd('0x74')],'as':'Contact','required':![]},{'model':db[_0xe2dd('0x75')],'as':_0xe2dd('0x76'),'attributes':[_0xe2dd('0x3b'),'fullname',_0xe2dd('0x77')],'required':![]},{'model':db[_0xe2dd('0x78')],'as':_0xe2dd('0x79'),'attributes':['id',_0xe2dd('0x3b'),_0xe2dd('0x7a')],'where':_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x7b')]?{'id':_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x7b')]}:undefined,'required':_0xa7afaf[_0xe2dd('0x43')][_0xe2dd('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0xe2dd('0x54')](_0x5b29ca);})[_0xe2dd('0x22')](function(_0x26b16f){_0xb78b1b[_0xe2dd('0x6b')]=_0x26b16f;return _0xb78b1b;});}})['then'](respondWithFilteredResult(_0x1ee05,_0x5b29ca))[_0xe2dd('0x55')](handleError(_0x1ee05,null));};exports[_0xe2dd('0x7c')]=function(_0x4634c6,_0x3a4a2b,_0xb95da4){return db[_0xe2dd('0x53')]['findOne']({'where':{'id':_0x4634c6[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x3a4a2b,null))[_0xe2dd('0x22')](function(_0x3bb31c){if(_0x3bb31c){return db[_0xe2dd('0x7d')]['transaction'](function(_0x4ed1dc){return db[_0xe2dd('0x7e')][_0xe2dd('0x37')]({'where':{'FaxAccountId':_0x4634c6['params']['id']},'transaction':_0x4ed1dc})[_0xe2dd('0x22')](function(_0x2aeceb){var _0x28272f=_['map'](_0x4634c6[_0xe2dd('0x60')],function(_0x486d27){_0x486d27[_0xe2dd('0x6a')]=_0x4634c6['params']['id'];return _0x486d27;});return db[_0xe2dd('0x7e')]['bulkCreate'](_0x28272f,{'transaction':_0x4ed1dc});});})[_0xe2dd('0x22')](function(){return db[_0xe2dd('0x7e')][_0xe2dd('0x7f')]({'where':{'FaxAccountId':_0x4634c6[_0xe2dd('0x61')]['id']},'order':_0xe2dd('0x80')});});}})[_0xe2dd('0x22')](respondWithResult(_0x3a4a2b,null))[_0xe2dd('0x55')](handleError(_0x3a4a2b,null));};exports[_0xe2dd('0x81')]=function(_0x3c1383,_0x1a6932,_0x171625){var _0x8d519d={};var _0x58f013={};var _0x16e222;var _0x53a5e2;return db[_0xe2dd('0x53')][_0xe2dd('0x65')]({'where':{'id':_0x3c1383[_0xe2dd('0x61')]['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x1a6932,null))['then'](function(_0x38a02a){if(_0x38a02a){_0x16e222=_0x38a02a;_0x58f013['model']=_[_0xe2dd('0x57')](db[_0xe2dd('0x7e')][_0xe2dd('0x67')]);_0x58f013[_0xe2dd('0x43')]=_[_0xe2dd('0x57')](_0x3c1383['query']);_0x58f013[_0xe2dd('0x44')]=_[_0xe2dd('0x45')](_0x58f013[_0xe2dd('0x46')],_0x58f013[_0xe2dd('0x43')]);_0x8d519d[_0xe2dd('0x47')]=_['intersection'](_0x58f013[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0x3c1383[_0xe2dd('0x43')][_0xe2dd('0x48')]));_0x8d519d[_0xe2dd('0x47')]=_0x8d519d[_0xe2dd('0x47')][_0xe2dd('0x68')]?_0x8d519d[_0xe2dd('0x47')]:_0x58f013[_0xe2dd('0x46')];_0x8d519d[_0xe2dd('0x69')]=qs[_0xe2dd('0x4b')](_0x3c1383[_0xe2dd('0x43')][_0xe2dd('0x4b')]);_0x8d519d['where']=qs[_0xe2dd('0x44')](_[_0xe2dd('0x4d')](_0x3c1383[_0xe2dd('0x43')],_0x58f013['filters']));if(_0x3c1383['query'][_0xe2dd('0x4e')]){_0x8d519d[_0xe2dd('0x4c')]=_[_0xe2dd('0x4f')](_0x8d519d[_0xe2dd('0x4c')],{'$or':_['map'](_0x8d519d['attributes'],function(_0x1ebd69){var _0x24e164={};_0x24e164[_0x1ebd69]={'$like':'%'+_0x3c1383[_0xe2dd('0x43')][_0xe2dd('0x4e')]+'%'};return _0x24e164;})});}_0x8d519d=_[_0xe2dd('0x4f')]({},_0x8d519d,_0x3c1383[_0xe2dd('0x50')]);return _0x16e222[_0xe2dd('0x81')](_0x8d519d);}})[_0xe2dd('0x22')](function(_0x2205d7){if(_0x2205d7){_0x53a5e2=_0x2205d7[_0xe2dd('0x68')];if(!_0x3c1383[_0xe2dd('0x43')][_0xe2dd('0x49')](_0xe2dd('0x4a'))){_0x8d519d[_0xe2dd('0x33')]=qs[_0xe2dd('0x33')](_0x3c1383[_0xe2dd('0x43')][_0xe2dd('0x33')]);_0x8d519d[_0xe2dd('0x32')]=qs[_0xe2dd('0x32')](_0x3c1383[_0xe2dd('0x43')][_0xe2dd('0x32')]);}return _0x16e222['getApplications'](_0x8d519d);}})[_0xe2dd('0x22')](function(_0x32e50b){if(_0x32e50b){return _0x32e50b?{'count':_0x53a5e2,'rows':_0x32e50b}:null;}})[_0xe2dd('0x22')](respondWithResult(_0x1a6932,null))[_0xe2dd('0x55')](handleError(_0x1a6932,null));};function Extension(_0x247339,_0x2e99e0,_0xf45f2c,_0x3881ec){this[_0xe2dd('0x82')]=_0xe2dd('0x83');this[_0xe2dd('0x84')]=_0x247339[_0xe2dd('0x85')];this[_0xe2dd('0x86')]=_0x3881ec;this['type']=_0xe2dd('0x87');this['description']='Fax\x20Extension';this[_0xe2dd('0x6a')]=_0x247339['id'];this[_0xe2dd('0x80')]=_0x2e99e0;this[_0xe2dd('0x88')]=_0xf45f2c;}function createExtensionsReciveFax(_0x1fe2a1){var _0x1c2326=0x1;var _0x912ad4=[];_0x912ad4[_0xe2dd('0x89')](new Extension(_0x1fe2a1,_0x1c2326,'',_0xe2dd('0x8a')));_0x1c2326+=0x1;_0x912ad4[_0xe2dd('0x89')](new Extension(_0x1fe2a1,_0x1c2326,'CDR(type)=inbound-fax',_0xe2dd('0x8b')));_0x1c2326+=0x1;for(var _0x30880e in _0x1fe2a1){if(_0x1fe2a1[_0xe2dd('0x49')](_0x30880e)&&(_0x30880e===_0xe2dd('0x8c')||_0x30880e==='localstationid'||_0x30880e===_0xe2dd('0x8d')||_0x30880e===_0xe2dd('0x8e')||_0x30880e===_0xe2dd('0x8f')||_0x30880e===_0xe2dd('0x90')||_0x30880e===_0xe2dd('0x91')||_0x30880e==='modem'||_0x30880e===_0xe2dd('0x92'))){_0x912ad4[_0xe2dd('0x89')](new Extension(_0x1fe2a1,_0x1c2326,_0xe2dd('0x93')+_0x30880e+')='+_0x1fe2a1[_0x30880e],_0xe2dd('0x8b')));_0x1c2326+=0x1;}}_0x912ad4['push'](new Extension(_0x1fe2a1,_0x1c2326,'6','Wait'));_0x1c2326+=0x1;_0x912ad4[_0xe2dd('0x89')](new Extension(_0x1fe2a1,_0x1c2326,_0xe2dd('0x94'),_0xe2dd('0x95')));_0x1c2326=0x0;return _0x912ad4;}exports['addAccountApplications']=function(_0x3e3522,_0x4f3ed0,_0x2c498a){var _0x514870;return db['sequelize']['transaction'](function(_0x142d8f){return db[_0xe2dd('0x53')][_0xe2dd('0x59')](_0x3e3522[_0xe2dd('0x60')],{'transaction':_0x142d8f})[_0xe2dd('0x22')](function(_0x397857){_0x514870=_0x397857[_0xe2dd('0x38')]({'plain':!![]});return db['VoiceExtension'][_0xe2dd('0x96')](createExtensionsReciveFax(_0x514870),{'transaction':_0x142d8f});});})[_0xe2dd('0x22')](function(){return _0x514870;})[_0xe2dd('0x22')](respondWithResult(_0x4f3ed0,null))[_0xe2dd('0x55')](handleError(_0x4f3ed0,null));};exports[_0xe2dd('0x97')]=function(_0x31ce8a,_0x13a4da,_0x19c695){var _0x5e2ebf;return db[_0xe2dd('0x7d')][_0xe2dd('0x98')](function(_0x58ea46){return db[_0xe2dd('0x53')][_0xe2dd('0x36')](_0x31ce8a[_0xe2dd('0x60')],{'where':{'id':_0x31ce8a['body']['id']},'transaction':_0x58ea46})['then'](function(_0x48e970){return db['VoiceExtension'][_0xe2dd('0x37')]({'where':{'FaxAccountId':_0x31ce8a['body']['id']},'transaction':_0x58ea46})[_0xe2dd('0x22')](function(_0x3c6e67){return db[_0xe2dd('0x99')]['bulkCreate'](createExtensionsReciveFax(_[_0xe2dd('0x9a')](_0x31ce8a['body'],[_0xe2dd('0x9b'),_0xe2dd('0x42'),'createdAt',_0xe2dd('0x9c'),_0xe2dd('0x9d'),_0xe2dd('0x9e')])),{'transaction':_0x58ea46});});});})[_0xe2dd('0x22')](function(){return db[_0xe2dd('0x53')][_0xe2dd('0x9f')](_0x31ce8a['body']['id']);})['then'](respondWithResult(_0x13a4da,null))['catch'](handleError(_0x13a4da,null));};exports['getMessages']=function(_0x590bbb,_0x152fc0,_0x3e4272){var _0x226c63={'raw':!![],'where':{}};var _0x376e65={};var _0x231620={'count':0x0,'rows':[]};return db[_0xe2dd('0x53')][_0xe2dd('0x65')]({'where':{'id':_0x590bbb['params']['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x152fc0,null))[_0xe2dd('0x22')](function(_0x14c688){if(_0x14c688){_0x376e65['model']=_[_0xe2dd('0x57')](db[_0xe2dd('0xa0')][_0xe2dd('0x67')]);_0x376e65[_0xe2dd('0x43')]=_[_0xe2dd('0x57')](_0x590bbb[_0xe2dd('0x43')]);_0x376e65[_0xe2dd('0x44')]=_[_0xe2dd('0x45')](_0x376e65[_0xe2dd('0x46')],_0x376e65['query']);_0x226c63[_0xe2dd('0x47')]=_['intersection'](_0x376e65[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0x590bbb[_0xe2dd('0x43')]['fields']));_0x226c63[_0xe2dd('0x47')]=_0x226c63[_0xe2dd('0x47')][_0xe2dd('0x68')]?_0x226c63[_0xe2dd('0x47')]:_0x376e65['model'];if(!_0x590bbb[_0xe2dd('0x43')][_0xe2dd('0x49')](_0xe2dd('0x4a'))){_0x226c63[_0xe2dd('0x33')]=qs[_0xe2dd('0x33')](_0x590bbb[_0xe2dd('0x43')][_0xe2dd('0x33')]);_0x226c63[_0xe2dd('0x32')]=qs[_0xe2dd('0x32')](_0x590bbb[_0xe2dd('0x43')]['offset']);}_0x226c63[_0xe2dd('0x69')]=qs[_0xe2dd('0x4b')](_0x590bbb['query']['sort']);_0x226c63['where']=qs[_0xe2dd('0x44')](_[_0xe2dd('0x4d')](_0x590bbb['query'],_0x376e65['filters']));_0x226c63[_0xe2dd('0x4c')][_0xe2dd('0x6a')]=_0x14c688['id'];if(_0x590bbb[_0xe2dd('0x43')][_0xe2dd('0x4e')]){_0x226c63['where']=_['merge'](_0x226c63[_0xe2dd('0x4c')],{'$or':_[_0xe2dd('0x3f')](_0x226c63['attributes'],function(_0x59e372){var _0xc73463={};_0xc73463[_0x59e372]={'$like':'%'+_0x590bbb['query'][_0xe2dd('0x4e')]+'%'};return _0xc73463;})});}if(_0x590bbb[_0xe2dd('0x43')]['$gte']){var _0x36b939=_0x590bbb[_0xe2dd('0x43')][_0xe2dd('0xa1')]['split'](',');var _0x52485e={};_0x52485e[_0x36b939[0x0]]={'$gte':moment(_0x36b939[0x1])[_0xe2dd('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x226c63['where']=_[_0xe2dd('0x4f')](_0x226c63[_0xe2dd('0x4c')],_0x52485e);}_0x226c63=_['merge']({},_0x226c63,_0x590bbb[_0xe2dd('0x50')]);return db['FaxMessage'][_0xe2dd('0x31')]({'where':_0x226c63[_0xe2dd('0x4c')]})['then'](function(_0xa9bbf){_0x231620[_0xe2dd('0x31')]=_0xa9bbf;if(_0x590bbb[_0xe2dd('0x43')]['includeAll']){_0x226c63[_0xe2dd('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0xe2dd('0x54')](_0x226c63);})['then'](function(_0x5632ab){_0x231620[_0xe2dd('0x6b')]=_0x5632ab;return _0x231620;});}})[_0xe2dd('0x22')](respondWithFilteredResult(_0x152fc0,_0x226c63))['catch'](handleError(_0x152fc0,null));};exports[_0xe2dd('0x3c')]=function(_0x23df7e,_0xc8b665,_0x8c8f52){var _0x216872,_0x59f54b={},_0x1fa796;if(_0x23df7e[_0xe2dd('0x60')]['to']){_0x1fa796=_0x23df7e['body']['to'][0x0];}return db[_0xe2dd('0x53')][_0xe2dd('0x58')]({'where':{'id':_0x23df7e[_0xe2dd('0x61')]['id']},'include':[{'model':db[_0xe2dd('0xa3')],'as':_0xe2dd('0xa4'),'include':[{'model':db['CmContact'],'as':_0xe2dd('0xa5'),'where':{'fax':_0x1fa796},'limit':0x1,'order':[[_0xe2dd('0x9c'),_0xe2dd('0xa6')]]}]}]})[_0xe2dd('0x22')](handleEntityNotFound(_0xc8b665,null))[_0xe2dd('0x22')](function(_0x385267){_0x216872=_0x385267;if(_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')]&&_0x23df7e['body']['attachments']['length']){for(var _0x463fd6=0x0;_0x463fd6<_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')]['length'];_0x463fd6+=0x1){_0x23df7e[_0xe2dd('0x60')]['attachments'][_0x463fd6]={'filename':_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')][_0x463fd6][_0xe2dd('0x3b')],'id':_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')][_0x463fd6]['id'],'path':path['join'](config[_0xe2dd('0xa8')],_0xe2dd('0xa9'),_0x23df7e['body']['attachments'][_0x463fd6]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0xe2dd('0xaa'),{'FaxAccountId':_[_0xe2dd('0xab')](_0x23df7e['params']['id'])?undefined:_0x23df7e['params']['id'],'path':_['isNil'](_0x23df7e['body']['attachments'][0x0][_0xe2dd('0xac')])?undefined:_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')][0x0][_0xe2dd('0xac')],'fax':_['isNil'](_0x23df7e['body']['to'][0x0])?undefined:_0x23df7e[_0xe2dd('0x60')]['to'][0x0]},client9002);})[_0xe2dd('0x22')](function(){if(_0x216872){if(_[_0xe2dd('0xab')](_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xad')])){_0x23df7e['body'][_0xe2dd('0xad')]=util['format'](_0xe2dd('0xae'),_0x216872[_0xe2dd('0x3b')],_0x216872['fax']);}if(_0x216872['List']){if(_0x216872[_0xe2dd('0xa4')][_0xe2dd('0xa5')][_0xe2dd('0x68')]){return _0x216872[_0xe2dd('0xa4')][_0xe2dd('0xa5')][0x0];}else{return db[_0xe2dd('0x74')][_0xe2dd('0x59')](_[_0xe2dd('0x1a')](_0x23df7e[_0xe2dd('0x60')],{'firstName':_0x23df7e[_0xe2dd('0x60')]['to'][0x0],'phone':_0x23df7e[_0xe2dd('0x60')]['to'][0x0],'fax':_0x23df7e[_0xe2dd('0x60')]['to'][0x0],'ListId':_0x216872[_0xe2dd('0x9e')]}));}}else{throw new Error(_0xe2dd('0xaf'));}}else{throw new Error(_0xe2dd('0xb0'));}})[_0xe2dd('0x22')](function(_0x1489dd){if(_0x1489dd){return db['FaxInteraction'][_0xe2dd('0x58')]({'where':{'ContactId':_0x1489dd['id'],'closed':![],'FaxAccountId':_0x216872['id']}})[_0xe2dd('0x22')](function(_0x184dd9){if(_0x184dd9){return[_0x184dd9,![]];}return db[_0xe2dd('0x72')][_0xe2dd('0x59')]({'UserId':_0x23df7e['user']['id'],'ContactId':_0x1489dd['id'],'FaxAccountId':_0x216872['id'],'fax':_0x23df7e[_0xe2dd('0x60')]['to'][0x0],'firstMsgDirection':_0xe2dd('0xb1'),'Messages':[_['merge'](_0x23df7e['body'],{'read':![],'body':_0x23df7e['body'][_0xe2dd('0xa7')][0x0][_0xe2dd('0xb2')],'FaxAccountId':_0x216872['id'],'UserId':_0x23df7e['user']['id'],'ContactId':_0x1489dd['id'],'AttachmentId':_0x23df7e['body'][_0xe2dd('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xe2dd('0xa0')],'as':_0xe2dd('0xb3')}]})[_0xe2dd('0x22')](function(_0x6c4fd1){return[_0x6c4fd1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xe2dd('0xb4')](function(_0x54df97,_0x160d39){if(_0x160d39){return _0x54df97;}return db[_0xe2dd('0xa0')][_0xe2dd('0x59')]({'direction':'out','read':![],'body':_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')][0x0]['filename'],'FaxAccountId':_0x216872['id'],'FaxInteractionId':_0x54df97['id'],'UserId':_0x23df7e[_0xe2dd('0x5a')]['id'],'ContactId':_0x54df97[_0xe2dd('0xb5')],'AttachmentId':_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')][0x0]['id']})[_0xe2dd('0x22')](function(_0x467109){_0x54df97[_0xe2dd('0xb6')]['Messages']=[];_0x54df97[_0xe2dd('0xb6')][_0xe2dd('0xb3')][_0xe2dd('0x89')](_0x467109[_0xe2dd('0xb6')]);return _0x54df97;});})['then'](function(_0x4f6f4c){respondWithRpcPromise(_0xe2dd('0xb7'),'SendFax',{'FaxAccountId':_[_0xe2dd('0xab')](_0x23df7e[_0xe2dd('0x61')]['id'])?undefined:_0x23df7e['params']['id'],'path':_[_0xe2dd('0xab')](_0x23df7e[_0xe2dd('0x60')][_0xe2dd('0xa7')][0x0][_0xe2dd('0xac')])?undefined:_0x23df7e['body'][_0xe2dd('0xa7')][0x0][_0xe2dd('0xac')],'fax':_[_0xe2dd('0xab')](_0x23df7e['body']['to'][0x0])?undefined:_0x23df7e[_0xe2dd('0x60')]['to'][0x0],'AttachmentId':_0x23df7e['body'][_0xe2dd('0xa7')][0x0]['id']},client9002)[_0xe2dd('0x22')](function(_0x6cc1c8){logger['info'](_0xe2dd('0xb8'),_0x6cc1c8);})['catch'](function(_0x25bbd7){logger[_0xe2dd('0x23')]('SendFaxRpc,\x20%s',_0x25bbd7);});return _0x4f6f4c;})[_0xe2dd('0x22')](respondWithResult(_0xc8b665,null))[_0xe2dd('0x55')](handleError(_0xc8b665,null));};exports[_0xe2dd('0xb9')]=function(_0x4e5024,_0xf632ea,_0x11a90a){return db[_0xe2dd('0x53')]['find']({'where':{'id':_0x4e5024[_0xe2dd('0x61')]['id']}})['then'](handleEntityNotFound(_0xf632ea,null))[_0xe2dd('0x22')](function(_0x1f9396){if(_0x1f9396){return _0x1f9396[_0xe2dd('0xb9')](_0x4e5024[_0xe2dd('0x60')]['ids'],_[_0xe2dd('0x9a')](_0x4e5024[_0xe2dd('0x60')],['ids','id'])||{})[_0xe2dd('0xb4')](function(_0x403553){for(var _0x555b28=0x0;_0x555b28<_0x4e5024[_0xe2dd('0x60')]['ids'][_0xe2dd('0x68')];_0x555b28+=0x1){socket[_0xe2dd('0xba')](_0xe2dd('0xbb'),{'UserId':_0x4e5024['body'][_0xe2dd('0x6d')][_0x555b28],'FaxAccountId':_0x4e5024[_0xe2dd('0x61')]['id']});}return _0x403553;});}})[_0xe2dd('0x22')](respondWithResult(_0xf632ea,null))[_0xe2dd('0x55')](handleError(_0xf632ea,null));};exports['removeAgents']=function(_0x57e5c3,_0xe605bb,_0x460005){return db[_0xe2dd('0x53')][_0xe2dd('0x58')]({'where':{'id':_0x57e5c3['params']['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0xe605bb,null))[_0xe2dd('0x22')](function(_0x30527f){if(_0x30527f){return _0x30527f['removeAgents'](_0x57e5c3[_0xe2dd('0x43')][_0xe2dd('0x6d')])[_0xe2dd('0x22')](function(){if(_[_0xe2dd('0xbc')](_0x57e5c3[_0xe2dd('0x43')]['ids'])){for(var _0x5c8ad6=0x0;_0x5c8ad6<_0x57e5c3['query']['ids'][_0xe2dd('0x68')];_0x5c8ad6+=0x1){socket['emit'](_0xe2dd('0xbd'),{'UserId':Number(_0x57e5c3[_0xe2dd('0x43')][_0xe2dd('0x6d')][_0x5c8ad6]),'FaxAccountId':Number(_0x57e5c3['params']['id'])});}}else{socket['emit'](_0xe2dd('0xbd'),{'UserId':Number(_0x57e5c3[_0xe2dd('0x43')]['ids']),'FaxAccountId':Number(_0x57e5c3[_0xe2dd('0x61')]['id'])});}});}})[_0xe2dd('0x22')](respondWithStatusCode(_0xe605bb,null))[_0xe2dd('0x55')](handleError(_0xe605bb,null));};exports[_0xe2dd('0xbe')]=function(_0x4a2fb1,_0x36e566,_0x283b37){var _0x8546e5={};var _0x1f2a3a={};var _0x5dc48c;var _0x40afc4;return db[_0xe2dd('0x53')]['findOne']({'where':{'id':_0x4a2fb1['params']['id']}})[_0xe2dd('0x22')](handleEntityNotFound(_0x36e566,null))[_0xe2dd('0x22')](function(_0x149cb4){if(_0x149cb4){_0x5dc48c=_0x149cb4;_0x1f2a3a[_0xe2dd('0x46')]=_[_0xe2dd('0x57')](db[_0xe2dd('0x75')][_0xe2dd('0x67')]);_0x1f2a3a['query']=_['keys'](_0x4a2fb1[_0xe2dd('0x43')]);_0x1f2a3a['filters']=_['intersection'](_0x1f2a3a['model'],_0x1f2a3a[_0xe2dd('0x43')]);_0x8546e5[_0xe2dd('0x47')]=_[_0xe2dd('0x45')](_0x1f2a3a[_0xe2dd('0x46')],qs[_0xe2dd('0x48')](_0x4a2fb1[_0xe2dd('0x43')]['fields']));_0x8546e5[_0xe2dd('0x47')]=_0x8546e5[_0xe2dd('0x47')][_0xe2dd('0x68')]?_0x8546e5['attributes']:_0x1f2a3a[_0xe2dd('0x46')];_0x8546e5['order']=qs[_0xe2dd('0x4b')](_0x4a2fb1[_0xe2dd('0x43')][_0xe2dd('0x4b')]);_0x8546e5[_0xe2dd('0x4c')]=qs[_0xe2dd('0x44')](_[_0xe2dd('0x4d')](_0x4a2fb1[_0xe2dd('0x43')],_0x1f2a3a[_0xe2dd('0x44')]));if(_0x4a2fb1[_0xe2dd('0x43')][_0xe2dd('0x4e')]){_0x8546e5[_0xe2dd('0x4c')]=_[_0xe2dd('0x4f')](_0x8546e5[_0xe2dd('0x4c')],{'$or':_[_0xe2dd('0x3f')](_0x8546e5[_0xe2dd('0x47')],function(_0x2f84dc){var _0x4622bb={};_0x4622bb[_0x2f84dc]={'$like':'%'+_0x4a2fb1[_0xe2dd('0x43')][_0xe2dd('0x4e')]+'%'};return _0x4622bb;})});}_0x8546e5=_[_0xe2dd('0x4f')]({},_0x8546e5,_0x4a2fb1['options']);return _0x5dc48c[_0xe2dd('0xbe')](_0x8546e5);}})[_0xe2dd('0x22')](function(_0x16d183){if(_0x16d183){_0x40afc4=_0x16d183[_0xe2dd('0x68')];if(!_0x4a2fb1['query'][_0xe2dd('0x49')]('nolimit')){_0x8546e5['limit']=qs['limit'](_0x4a2fb1[_0xe2dd('0x43')]['limit']);_0x8546e5[_0xe2dd('0x32')]=qs[_0xe2dd('0x32')](_0x4a2fb1[_0xe2dd('0x43')][_0xe2dd('0x32')]);}return _0x5dc48c[_0xe2dd('0xbe')](_0x8546e5);}})[_0xe2dd('0x22')](function(_0x4b5ef1){if(_0x4b5ef1){return _0x4b5ef1?{'count':_0x40afc4,'rows':_0x4b5ef1}:null;}})[_0xe2dd('0x22')](respondWithResult(_0x36e566,null))[_0xe2dd('0x55')](handleError(_0x36e566,null));}; \ No newline at end of file +var _0x6e6f=['hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','Pause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','pick','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','getInteractions','FaxInteraction','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','ReceiveFax','transaction','VoiceExtension','bulkCreate','updateAccountApplications','omit','tech','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','CmContact','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','http','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x6c385f,_0x13b36a){var _0x2f503b=function(_0x2b6b0d){while(--_0x2b6b0d){_0x6c385f['push'](_0x6c385f['shift']());}};_0x2f503b(++_0x13b36a);}(_0x6e6f,0x76));var _0xf6e6=function(_0x44c5c1,_0x4d9d55){_0x44c5c1=_0x44c5c1-0x0;var _0x467172=_0x6e6f[_0x44c5c1];return _0x467172;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6e6('0x0'));var rimraf=require(_0xf6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6e6('0x2'));var rp=require(_0xf6e6('0x3'));var moment=require(_0xf6e6('0x4'));var BPromise=require(_0xf6e6('0x5'));var Mustache=require(_0xf6e6('0x6'));var util=require(_0xf6e6('0x7'));var path=require(_0xf6e6('0x8'));var sox=require('sox');var csv=require(_0xf6e6('0x9'));var ejs=require(_0xf6e6('0xa'));var fs=require('fs');var _=require(_0xf6e6('0xb'));var squel=require(_0xf6e6('0xc'));var crypto=require(_0xf6e6('0xd'));var jsforce=require(_0xf6e6('0xe'));var deskjs=require(_0xf6e6('0xf'));var toCsv=require(_0xf6e6('0x9'));var querystring=require('querystring');var Papa=require(_0xf6e6('0x10'));var Redis=require(_0xf6e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf6e6('0x12'));var as=require(_0xf6e6('0x13'));var hardwareService=require(_0xf6e6('0x14'));var logger=require(_0xf6e6('0x15'))(_0xf6e6('0x16'));var utils=require(_0xf6e6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf6e6('0x18'));var db=require('../../mysqldb')['db'];config[_0xf6e6('0x19')]=_['defaults'](config[_0xf6e6('0x19')],{'host':_0xf6e6('0x1a'),'port':0x18eb});var socket=require(_0xf6e6('0x1b'))(new Redis(config[_0xf6e6('0x19')]));require(_0xf6e6('0x1c'))[_0xf6e6('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf6e6('0x1e')]({'port':0x232c});var client9002=jayson[_0xf6e6('0x1f')][_0xf6e6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xffcde6,_0xc0bac6,_0x36e928,_0x14fa63){return new BPromise(function(_0x340993,_0x29a389){var _0x346d03=_0x14fa63||client;return _0x346d03[_0xf6e6('0x20')](_0xffcde6,_0x36e928)[_0xf6e6('0x21')](function(_0x1ddc3c){logger['info'](_0xf6e6('0x22'),_0xc0bac6,_0xf6e6('0x23'));logger[_0xf6e6('0x24')](_0xf6e6('0x25'),_0xc0bac6,_0xf6e6('0x23'),JSON['stringify'](_0x1ddc3c));if(_0x1ddc3c[_0xf6e6('0x26')]){if(_0x1ddc3c[_0xf6e6('0x26')][_0xf6e6('0x27')]===0x1f4){logger[_0xf6e6('0x26')](_0xf6e6('0x22'),_0xc0bac6,_0x1ddc3c[_0xf6e6('0x26')]['message']);return _0x29a389(_0x1ddc3c[_0xf6e6('0x26')]['message']);}logger[_0xf6e6('0x26')](_0xf6e6('0x22'),_0xc0bac6,_0x1ddc3c['error']['message']);return _0x340993(_0x1ddc3c[_0xf6e6('0x26')][_0xf6e6('0x28')]);}else{logger['info'](_0xf6e6('0x22'),_0xc0bac6,_0xf6e6('0x23'));_0x340993(_0x1ddc3c[_0xf6e6('0x29')][_0xf6e6('0x28')]);}})[_0xf6e6('0x2a')](function(_0x4afaa9){logger['error'](_0xf6e6('0x22'),_0xc0bac6,_0x4afaa9);_0x29a389(_0x4afaa9);});});}function respondWithStatusCode(_0x2bf171,_0x4249fd){_0x4249fd=_0x4249fd||0xcc;return function(_0x518a17){if(_0x518a17){return _0x2bf171[_0xf6e6('0x2b')](_0x4249fd);}return _0x2bf171[_0xf6e6('0x2c')](_0x4249fd)[_0xf6e6('0x2d')]();};}function respondWithResult(_0x13d103,_0xe21707){_0xe21707=_0xe21707||0xc8;return function(_0xd4638d){if(_0xd4638d){return _0x13d103['status'](_0xe21707)[_0xf6e6('0x2e')](_0xd4638d);}};}function respondWithFilteredResult(_0xbe793f,_0x3ef2ff){return function(_0x290841){if(_0x290841){var _0x128031=_0x290841[_0xf6e6('0x2f')],_0x4a33aa=_0x3ef2ff[_0xf6e6('0x30')],_0x57e994=_0x3ef2ff['offset']+_0x3ef2ff[_0xf6e6('0x31')],_0x298c22;if(_0x57e994>=_0x128031){_0x57e994=_0x128031;_0x298c22=0xc8;}else{_0x298c22=0xce;}_0xbe793f[_0xf6e6('0x2c')](_0x298c22);return _0xbe793f[_0xf6e6('0x32')]('Content-Range',_0x4a33aa+'-'+_0x57e994+'/'+_0x128031)[_0xf6e6('0x2e')](_0x290841);}return null;};}function patchUpdates(_0x72e968){return function(_0x3eafa1){try{jsonpatch[_0xf6e6('0x33')](_0x3eafa1,_0x72e968,!![]);}catch(_0x1acec2){return BPromise[_0xf6e6('0x34')](_0x1acec2);}return _0x3eafa1[_0xf6e6('0x35')]();};}function saveUpdates(_0x4aba8e,_0x1e73a3){return function(_0x5a2c70){if(_0x5a2c70){return _0x5a2c70[_0xf6e6('0x36')](_0x4aba8e)[_0xf6e6('0x21')](function(_0x20056a){return _0x20056a;});}return null;};}function removeEntity(_0x524f9e,_0x410a76){return function(_0x42a0b4){if(_0x42a0b4){return _0x42a0b4[_0xf6e6('0x37')]()['then'](function(){var _0x538d6d=_0x42a0b4[_0xf6e6('0x38')]({'plain':!![]});var _0x1c8c56=_0xf6e6('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c8c56,'resourceId':_0x538d6d['id']}})[_0xf6e6('0x21')](function(){return _0x42a0b4;});})['then'](function(){_0x524f9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x364443,_0x3753b4){return function(_0x9c5c02){if(!_0x9c5c02){_0x364443['sendStatus'](0x194);}return _0x9c5c02;};}function handleError(_0x1190d9,_0x383d76){_0x383d76=_0x383d76||0x1f4;return function(_0x3c8b0d){logger[_0xf6e6('0x26')](_0x3c8b0d[_0xf6e6('0x3a')]);if(_0x3c8b0d[_0xf6e6('0x3b')]){delete _0x3c8b0d[_0xf6e6('0x3b')];}_0x1190d9['status'](_0x383d76)[_0xf6e6('0x3c')](_0x3c8b0d);};}exports[_0xf6e6('0x3d')]=function(_0x3232f6,_0x5581db){var _0x9653a0={'include':[{'model':db['Pause'],'as':_0xf6e6('0x3e')}]},_0x18934d={},_0x280905={'count':0x0,'rows':[]};var _0x41b0a5=_[_0xf6e6('0x3f')](db[_0xf6e6('0x40')]['rawAttributes'],function(_0x19758d){return{'name':_0x19758d[_0xf6e6('0x41')],'type':_0x19758d[_0xf6e6('0x42')][_0xf6e6('0x43')]};});_0x18934d[_0xf6e6('0x44')]=_[_0xf6e6('0x3f')](_0x41b0a5,_0xf6e6('0x3b'));_0x18934d[_0xf6e6('0x45')]=_[_0xf6e6('0x46')](_0x3232f6[_0xf6e6('0x45')]);_0x18934d['filters']=_[_0xf6e6('0x47')](_0x18934d[_0xf6e6('0x44')],_0x18934d['query']);_0x9653a0['attributes']=_['intersection'](_0x18934d[_0xf6e6('0x44')],qs['fields'](_0x3232f6[_0xf6e6('0x45')][_0xf6e6('0x48')]));_0x9653a0[_0xf6e6('0x49')]=_0x9653a0[_0xf6e6('0x49')][_0xf6e6('0x4a')]?_0x9653a0[_0xf6e6('0x49')]:_0x18934d[_0xf6e6('0x44')];if(!_0x3232f6[_0xf6e6('0x45')][_0xf6e6('0x4b')]('nolimit')){_0x9653a0[_0xf6e6('0x31')]=qs[_0xf6e6('0x31')](_0x3232f6['query'][_0xf6e6('0x31')]);_0x9653a0[_0xf6e6('0x30')]=qs[_0xf6e6('0x30')](_0x3232f6[_0xf6e6('0x45')][_0xf6e6('0x30')]);}_0x9653a0[_0xf6e6('0x4c')]=qs[_0xf6e6('0x4d')](_0x3232f6[_0xf6e6('0x45')][_0xf6e6('0x4d')]);_0x9653a0[_0xf6e6('0x4e')]=qs[_0xf6e6('0x4f')](_['pick'](_0x3232f6[_0xf6e6('0x45')],_0x18934d[_0xf6e6('0x4f')]),_0x41b0a5);if(_0x3232f6[_0xf6e6('0x45')]['filter']){_0x9653a0['where']=_[_0xf6e6('0x50')](_0x9653a0['where'],{'$or':_['map'](_0x41b0a5,function(_0x22ce0d){if(_0x22ce0d[_0xf6e6('0x42')]!==_0xf6e6('0x51')){var _0x42ca4d={};_0x42ca4d[_0x22ce0d[_0xf6e6('0x3b')]]={'$like':'%'+_0x3232f6['query'][_0xf6e6('0x52')]+'%'};return _0x42ca4d;}})});}_0x9653a0=_['merge']({},_0x9653a0,_0x3232f6[_0xf6e6('0x53')]);var _0x2d091e={'where':_0x9653a0[_0xf6e6('0x4e')]};return db[_0xf6e6('0x40')]['count'](_0x2d091e)[_0xf6e6('0x21')](function(_0x44ca02){_0x280905[_0xf6e6('0x2f')]=_0x44ca02;if(_0x3232f6[_0xf6e6('0x45')][_0xf6e6('0x54')]){_0x9653a0[_0xf6e6('0x55')]=[{'all':!![]}];}return db[_0xf6e6('0x40')]['findAll'](_0x9653a0);})[_0xf6e6('0x21')](function(_0x5df7b7){_0x280905[_0xf6e6('0x56')]=_0x5df7b7;return _0x280905;})['then'](respondWithFilteredResult(_0x5581db,_0x9653a0))[_0xf6e6('0x2a')](handleError(_0x5581db,null));};exports[_0xf6e6('0x57')]=function(_0x3370c4,_0x44f3c0){var _0x2d1cfa={'raw':![],'where':{'id':_0x3370c4[_0xf6e6('0x58')]['id']},'include':[{'model':db[_0xf6e6('0x59')],'as':_0xf6e6('0x3e')}]},_0x241d51={};_0x241d51[_0xf6e6('0x44')]=_['keys'](db[_0xf6e6('0x40')][_0xf6e6('0x5a')]);_0x241d51[_0xf6e6('0x45')]=_[_0xf6e6('0x46')](_0x3370c4['query']);_0x241d51[_0xf6e6('0x4f')]=_['intersection'](_0x241d51[_0xf6e6('0x44')],_0x241d51[_0xf6e6('0x45')]);_0x2d1cfa[_0xf6e6('0x49')]=_[_0xf6e6('0x47')](_0x241d51[_0xf6e6('0x44')],qs[_0xf6e6('0x48')](_0x3370c4['query'][_0xf6e6('0x48')]));_0x2d1cfa[_0xf6e6('0x49')]=_0x2d1cfa['attributes'][_0xf6e6('0x4a')]?_0x2d1cfa[_0xf6e6('0x49')]:_0x241d51[_0xf6e6('0x44')];if(_0x3370c4[_0xf6e6('0x45')]['includeAll']){_0x2d1cfa[_0xf6e6('0x55')]=[{'all':!![]}];}_0x2d1cfa=_[_0xf6e6('0x50')]({},_0x2d1cfa,_0x3370c4[_0xf6e6('0x53')]);return db['FaxAccount'][_0xf6e6('0x5b')](_0x2d1cfa)['then'](handleEntityNotFound(_0x44f3c0,null))[_0xf6e6('0x21')](respondWithResult(_0x44f3c0,null))[_0xf6e6('0x2a')](handleError(_0x44f3c0,null));};exports[_0xf6e6('0x5c')]=function(_0x109c35,_0x4c913c){return db[_0xf6e6('0x40')]['create'](_0x109c35[_0xf6e6('0x5d')],{})[_0xf6e6('0x21')](function(_0x460cb8){var _0x325a36=_0x109c35[_0xf6e6('0x5e')][_0xf6e6('0x38')]({'plain':!![]});if(!_0x325a36)throw new Error(_0xf6e6('0x5f'));if(_0x325a36[_0xf6e6('0x60')]===_0xf6e6('0x5e')){var _0x14646d=_0x460cb8[_0xf6e6('0x38')]({'plain':!![]});var _0x59cc16=_0xf6e6('0x39');return db[_0xf6e6('0x61')]['find']({'where':{'name':_0x59cc16,'userProfileId':_0x325a36[_0xf6e6('0x62')]},'raw':!![]})['then'](function(_0x2482be){if(_0x2482be&&_0x2482be[_0xf6e6('0x63')]===0x0){return db['UserProfileResource'][_0xf6e6('0x5c')]({'name':_0x14646d[_0xf6e6('0x3b')],'resourceId':_0x14646d['id'],'type':_0x2482be[_0xf6e6('0x3b')],'sectionId':_0x2482be['id']},{})[_0xf6e6('0x21')](function(){return _0x460cb8;});}else{return _0x460cb8;}})['catch'](function(_0x552e62){logger[_0xf6e6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x552e62);throw _0x552e62;});}return _0x460cb8;})[_0xf6e6('0x21')](respondWithResult(_0x4c913c,0xc9))['catch'](handleError(_0x4c913c,null));};exports[_0xf6e6('0x36')]=function(_0x1d5955,_0x5100de){if(_0x1d5955[_0xf6e6('0x5d')]['id']){delete _0x1d5955[_0xf6e6('0x5d')]['id'];}return db[_0xf6e6('0x40')][_0xf6e6('0x5b')]({'where':{'id':_0x1d5955[_0xf6e6('0x58')]['id']},'include':[{'model':db[_0xf6e6('0x59')],'as':_0xf6e6('0x3e')}]})[_0xf6e6('0x21')](handleEntityNotFound(_0x5100de,null))['then'](saveUpdates(_0x1d5955['body'],null))[_0xf6e6('0x21')](respondWithResult(_0x5100de,null))[_0xf6e6('0x2a')](handleError(_0x5100de,null));};exports[_0xf6e6('0x37')]=function(_0x42b285,_0x4f3fa9){return db[_0xf6e6('0x40')][_0xf6e6('0x5b')]({'where':{'id':_0x42b285[_0xf6e6('0x58')]['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x4f3fa9,null))[_0xf6e6('0x21')](removeEntity(_0x4f3fa9,null))[_0xf6e6('0x2a')](handleError(_0x4f3fa9,null));};exports[_0xf6e6('0x64')]=function(_0x2a4388,_0x199267){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x199267,null))[_0xf6e6('0x2a')](handleError(_0x199267,null));};exports[_0xf6e6('0x65')]=function(_0x3abeaa,_0x4078d3,_0x3ff705){if(_0x3abeaa[_0xf6e6('0x5d')]['id']){delete _0x3abeaa[_0xf6e6('0x5d')]['id'];}return db[_0xf6e6('0x40')]['find']({'where':{'id':_0x3abeaa['params']['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x4078d3,null))['then'](function(_0x471498){if(_0x471498){_0x3abeaa[_0xf6e6('0x5d')][_0xf6e6('0x66')]=_0x471498['id'];return db[_0xf6e6('0x67')][_0xf6e6('0x5c')](_0x3abeaa[_0xf6e6('0x5d')]);}})[_0xf6e6('0x21')](respondWithResult(_0x4078d3,null))['catch'](handleError(_0x4078d3,null));};exports[_0xf6e6('0x68')]=function(_0x469c62,_0x43b953,_0x49cef4){var _0x208f5f={'raw':![],'where':{}};var _0x4872a8={};var _0x3a3970={'count':0x0,'rows':[]};return db[_0xf6e6('0x40')][_0xf6e6('0x69')]({'where':{'id':_0x469c62[_0xf6e6('0x58')]['id']}})['then'](handleEntityNotFound(_0x43b953,null))['then'](function(_0x5c805c){if(_0x5c805c){_0x4872a8[_0xf6e6('0x44')]=_['keys'](db[_0xf6e6('0x67')][_0xf6e6('0x5a')]);_0x4872a8['query']=_[_0xf6e6('0x46')](_0x469c62[_0xf6e6('0x45')]);_0x4872a8[_0xf6e6('0x4f')]=_[_0xf6e6('0x47')](_0x4872a8['model'],_0x4872a8['query']);_0x208f5f[_0xf6e6('0x49')]=_[_0xf6e6('0x47')](_0x4872a8[_0xf6e6('0x44')],qs[_0xf6e6('0x48')](_0x469c62['query'][_0xf6e6('0x48')]));_0x208f5f['attributes']=_0x208f5f[_0xf6e6('0x49')][_0xf6e6('0x4a')]?_0x208f5f[_0xf6e6('0x49')]:_0x4872a8[_0xf6e6('0x44')];if(!_0x469c62[_0xf6e6('0x45')][_0xf6e6('0x4b')](_0xf6e6('0x6a'))){_0x208f5f[_0xf6e6('0x31')]=qs[_0xf6e6('0x31')](_0x469c62[_0xf6e6('0x45')][_0xf6e6('0x31')]);_0x208f5f[_0xf6e6('0x30')]=qs[_0xf6e6('0x30')](_0x469c62[_0xf6e6('0x45')]['offset']);}_0x208f5f['order']=qs[_0xf6e6('0x4d')](_0x469c62['query'][_0xf6e6('0x4d')]);_0x208f5f[_0xf6e6('0x4e')]=qs[_0xf6e6('0x4f')](_[_0xf6e6('0x6b')](_0x469c62[_0xf6e6('0x45')],_0x4872a8[_0xf6e6('0x4f')]));_0x208f5f['where'][_0xf6e6('0x66')]=_0x5c805c['id'];if(_0x469c62['query']['filter']){_0x208f5f[_0xf6e6('0x4e')]=_[_0xf6e6('0x50')](_0x208f5f['where'],{'$or':_[_0xf6e6('0x3f')](_0x208f5f[_0xf6e6('0x49')],function(_0x496e5f){var _0x3f7f9e={};_0x3f7f9e[_0x496e5f]={'$like':'%'+_0x469c62[_0xf6e6('0x45')][_0xf6e6('0x52')]+'%'};return _0x3f7f9e;})});}_0x208f5f=_[_0xf6e6('0x50')]({},_0x208f5f,_0x469c62[_0xf6e6('0x53')]);return db['Disposition'][_0xf6e6('0x2f')]({'where':_0x208f5f[_0xf6e6('0x4e')]})['then'](function(_0x39a8fb){_0x3a3970[_0xf6e6('0x2f')]=_0x39a8fb;if(_0x469c62[_0xf6e6('0x45')]['includeAll']){_0x208f5f[_0xf6e6('0x55')]=[{'all':!![]}];}return db[_0xf6e6('0x67')][_0xf6e6('0x6c')](_0x208f5f);})[_0xf6e6('0x21')](function(_0x5d536c){_0x3a3970[_0xf6e6('0x56')]=_0x5d536c;return _0x3a3970;});}})[_0xf6e6('0x21')](respondWithFilteredResult(_0x43b953,_0x208f5f))[_0xf6e6('0x2a')](handleError(_0x43b953,null));};exports[_0xf6e6('0x6d')]=function(_0x51d076,_0x4f8abf,_0x36b99b){return db[_0xf6e6('0x40')][_0xf6e6('0x5b')]({'where':{'id':_0x51d076[_0xf6e6('0x58')]['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x4f8abf,null))[_0xf6e6('0x21')](function(_0x50ea62){if(_0x50ea62){return _0x50ea62[_0xf6e6('0x6d')](_0x51d076[_0xf6e6('0x45')][_0xf6e6('0x6e')]);}})[_0xf6e6('0x21')](respondWithStatusCode(_0x4f8abf,null))[_0xf6e6('0x2a')](handleError(_0x4f8abf,null));};exports['addAnswer']=function(_0x12d46b,_0x52cec8,_0x49d309){if(_0x12d46b[_0xf6e6('0x5d')]['id']){delete _0x12d46b[_0xf6e6('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x12d46b[_0xf6e6('0x58')]['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x52cec8,null))[_0xf6e6('0x21')](function(_0x5b9bc3){if(_0x5b9bc3){_0x12d46b[_0xf6e6('0x5d')][_0xf6e6('0x66')]=_0x5b9bc3['id'];return db['CannedAnswer'][_0xf6e6('0x5c')](_0x12d46b[_0xf6e6('0x5d')]);}})['then'](respondWithResult(_0x52cec8,null))[_0xf6e6('0x2a')](handleError(_0x52cec8,null));};exports[_0xf6e6('0x6f')]=function(_0xee34b7,_0x3b558c,_0xd682b7){var _0x161f4a={'raw':![],'where':{}};var _0x23509b={};var _0x6aaf6f={'count':0x0,'rows':[]};return db[_0xf6e6('0x40')][_0xf6e6('0x69')]({'where':{'id':_0xee34b7[_0xf6e6('0x58')]['id']}})['then'](handleEntityNotFound(_0x3b558c,null))[_0xf6e6('0x21')](function(_0x315e96){if(_0x315e96){_0x23509b[_0xf6e6('0x44')]=_[_0xf6e6('0x46')](db[_0xf6e6('0x70')][_0xf6e6('0x5a')]);_0x23509b[_0xf6e6('0x45')]=_[_0xf6e6('0x46')](_0xee34b7[_0xf6e6('0x45')]);_0x23509b['filters']=_['intersection'](_0x23509b[_0xf6e6('0x44')],_0x23509b[_0xf6e6('0x45')]);_0x161f4a[_0xf6e6('0x49')]=_[_0xf6e6('0x47')](_0x23509b[_0xf6e6('0x44')],qs[_0xf6e6('0x48')](_0xee34b7['query'][_0xf6e6('0x48')]));_0x161f4a[_0xf6e6('0x49')]=_0x161f4a[_0xf6e6('0x49')][_0xf6e6('0x4a')]?_0x161f4a[_0xf6e6('0x49')]:_0x23509b[_0xf6e6('0x44')];if(!_0xee34b7[_0xf6e6('0x45')]['hasOwnProperty']('nolimit')){_0x161f4a['limit']=qs[_0xf6e6('0x31')](_0xee34b7['query']['limit']);_0x161f4a[_0xf6e6('0x30')]=qs[_0xf6e6('0x30')](_0xee34b7[_0xf6e6('0x45')][_0xf6e6('0x30')]);}_0x161f4a['order']=qs[_0xf6e6('0x4d')](_0xee34b7[_0xf6e6('0x45')][_0xf6e6('0x4d')]);_0x161f4a[_0xf6e6('0x4e')]=qs['filters'](_['pick'](_0xee34b7[_0xf6e6('0x45')],_0x23509b[_0xf6e6('0x4f')]));_0x161f4a['where'][_0xf6e6('0x66')]=_0x315e96['id'];if(_0xee34b7[_0xf6e6('0x45')]['filter']){_0x161f4a[_0xf6e6('0x4e')]=_[_0xf6e6('0x50')](_0x161f4a['where'],{'$or':_[_0xf6e6('0x3f')](_0x161f4a[_0xf6e6('0x49')],function(_0x3db60e){var _0x1dab8d={};_0x1dab8d[_0x3db60e]={'$like':'%'+_0xee34b7[_0xf6e6('0x45')][_0xf6e6('0x52')]+'%'};return _0x1dab8d;})});}_0x161f4a=_[_0xf6e6('0x50')]({},_0x161f4a,_0xee34b7['options']);return db[_0xf6e6('0x70')][_0xf6e6('0x2f')]({'where':_0x161f4a[_0xf6e6('0x4e')]})['then'](function(_0x7b2cdc){_0x6aaf6f[_0xf6e6('0x2f')]=_0x7b2cdc;if(_0xee34b7[_0xf6e6('0x45')]['includeAll']){_0x161f4a[_0xf6e6('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf6e6('0x6c')](_0x161f4a);})[_0xf6e6('0x21')](function(_0x324de4){_0x6aaf6f[_0xf6e6('0x56')]=_0x324de4;return _0x6aaf6f;});}})[_0xf6e6('0x21')](respondWithFilteredResult(_0x3b558c,_0x161f4a))[_0xf6e6('0x2a')](handleError(_0x3b558c,null));};exports[_0xf6e6('0x71')]=function(_0xe80b3f,_0x2d19c5,_0x14747c){return db[_0xf6e6('0x40')][_0xf6e6('0x5b')]({'where':{'id':_0xe80b3f['params']['id']}})['then'](handleEntityNotFound(_0x2d19c5,null))['then'](function(_0x187c41){if(_0x187c41){return _0x187c41[_0xf6e6('0x71')](_0xe80b3f[_0xf6e6('0x45')][_0xf6e6('0x6e')]);}})['then'](respondWithStatusCode(_0x2d19c5,null))[_0xf6e6('0x2a')](handleError(_0x2d19c5,null));};exports[_0xf6e6('0x72')]=function(_0x1f8181,_0x338045,_0x49cead){return db['FaxInteraction'][_0xf6e6('0x5b')]({'where':{'id':_0x1f8181[_0xf6e6('0x58')]['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x338045,null))[_0xf6e6('0x21')](function(_0x19c958){if(_0x19c958){return _0x19c958[_0xf6e6('0x72')](_0x1f8181[_0xf6e6('0x5d')][_0xf6e6('0x6e')],_['omit'](_0x1f8181[_0xf6e6('0x5d')],['ids','id'])||{});}})[_0xf6e6('0x21')](respondWithResult(_0x338045,null))[_0xf6e6('0x2a')](handleError(_0x338045,null));};exports[_0xf6e6('0x73')]=function(_0x6cb04e,_0x569abe,_0x526a90){var _0x2b8d2a={'raw':![],'where':{}};var _0x3cd3d8={};var _0x18b420={'count':0x0,'rows':[]};return db[_0xf6e6('0x40')][_0xf6e6('0x69')]({'where':{'id':_0x6cb04e['params']['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x569abe,null))['then'](function(_0x44ef52){if(_0x44ef52){_0x3cd3d8[_0xf6e6('0x44')]=_['keys'](db['FaxInteraction'][_0xf6e6('0x5a')]);_0x3cd3d8['query']=_['keys'](_0x6cb04e[_0xf6e6('0x45')]);_0x3cd3d8['filters']=_[_0xf6e6('0x47')](_0x3cd3d8[_0xf6e6('0x44')],_0x3cd3d8['query']);_0x2b8d2a[_0xf6e6('0x49')]=_['intersection'](_0x3cd3d8['model'],qs[_0xf6e6('0x48')](_0x6cb04e[_0xf6e6('0x45')]['fields']));_0x2b8d2a['attributes']=_0x2b8d2a['attributes'][_0xf6e6('0x4a')]?_0x2b8d2a[_0xf6e6('0x49')]:_0x3cd3d8[_0xf6e6('0x44')];if(!_0x6cb04e[_0xf6e6('0x45')]['hasOwnProperty']('nolimit')){_0x2b8d2a['limit']=qs[_0xf6e6('0x31')](_0x6cb04e['query']['limit']);_0x2b8d2a[_0xf6e6('0x30')]=qs[_0xf6e6('0x30')](_0x6cb04e[_0xf6e6('0x45')][_0xf6e6('0x30')]);}_0x2b8d2a['order']=qs[_0xf6e6('0x4d')](_0x6cb04e[_0xf6e6('0x45')][_0xf6e6('0x4d')]);_0x2b8d2a[_0xf6e6('0x4e')]=qs[_0xf6e6('0x4f')](_['pick'](_0x6cb04e[_0xf6e6('0x45')],_0x3cd3d8[_0xf6e6('0x4f')]));_0x2b8d2a['where'][_0xf6e6('0x66')]=_0x44ef52['id'];if(_0x6cb04e[_0xf6e6('0x45')]['filter']){_0x2b8d2a[_0xf6e6('0x4e')]=_[_0xf6e6('0x50')](_0x2b8d2a['where'],{'$or':_[_0xf6e6('0x3f')](_0x2b8d2a[_0xf6e6('0x49')],function(_0x1408b3){var _0xf08c6d={};_0xf08c6d[_0x1408b3]={'$like':'%'+_0x6cb04e[_0xf6e6('0x45')][_0xf6e6('0x52')]+'%'};return _0xf08c6d;})});}_0x2b8d2a=_[_0xf6e6('0x50')]({},_0x2b8d2a,_0x6cb04e['options']);return db[_0xf6e6('0x74')]['count']({'where':_0x2b8d2a[_0xf6e6('0x4e')]})[_0xf6e6('0x21')](function(_0x31bc27){_0x18b420['count']=_0x31bc27;if(_0x6cb04e[_0xf6e6('0x45')]['includeAll']){_0x2b8d2a[_0xf6e6('0x55')]=[{'model':db['CmContact'],'as':_0xf6e6('0x75'),'required':![]},{'model':db[_0xf6e6('0x76')],'as':_0xf6e6('0x77'),'attributes':['name','fullname',_0xf6e6('0x78')],'required':![]},{'model':db[_0xf6e6('0x79')],'as':_0xf6e6('0x7a'),'attributes':['id',_0xf6e6('0x3b'),_0xf6e6('0x7b')],'where':_0x6cb04e[_0xf6e6('0x45')][_0xf6e6('0x7c')]?{'id':_0x6cb04e[_0xf6e6('0x45')]['tag']}:undefined,'required':_0x6cb04e['query'][_0xf6e6('0x7c')]?!![]:![]}];}return db[_0xf6e6('0x74')][_0xf6e6('0x6c')](_0x2b8d2a);})[_0xf6e6('0x21')](function(_0x1efdff){_0x18b420[_0xf6e6('0x56')]=_0x1efdff;return _0x18b420;});}})['then'](respondWithFilteredResult(_0x569abe,_0x2b8d2a))[_0xf6e6('0x2a')](handleError(_0x569abe,null));};exports[_0xf6e6('0x7d')]=function(_0x3b5635,_0x46f0a1,_0x736a66){return db[_0xf6e6('0x40')]['findOne']({'where':{'id':_0x3b5635[_0xf6e6('0x58')]['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x46f0a1,null))['then'](function(_0x5067da){if(_0x5067da){return db[_0xf6e6('0x7e')]['transaction'](function(_0x4a1c5b){return db[_0xf6e6('0x7f')]['destroy']({'where':{'FaxAccountId':_0x3b5635[_0xf6e6('0x58')]['id']},'transaction':_0x4a1c5b})[_0xf6e6('0x21')](function(_0x2e8637){var _0x2d9c38=_[_0xf6e6('0x3f')](_0x3b5635[_0xf6e6('0x5d')],function(_0x567c9e){_0x567c9e[_0xf6e6('0x66')]=_0x3b5635[_0xf6e6('0x58')]['id'];return _0x567c9e;});return db['FaxApplication']['bulkCreate'](_0x2d9c38,{'transaction':_0x4a1c5b});});})['then'](function(){return db[_0xf6e6('0x7f')][_0xf6e6('0x80')]({'where':{'FaxAccountId':_0x3b5635[_0xf6e6('0x58')]['id']},'order':_0xf6e6('0x81')});});}})['then'](respondWithResult(_0x46f0a1,null))['catch'](handleError(_0x46f0a1,null));};exports['getApplications']=function(_0x3203a9,_0x592378,_0x5ad86a){var _0x1bb5ff={};var _0x2063d9={};var _0x244c07;var _0x22909c;return db[_0xf6e6('0x40')][_0xf6e6('0x69')]({'where':{'id':_0x3203a9['params']['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x592378,null))[_0xf6e6('0x21')](function(_0x3b4e0d){if(_0x3b4e0d){_0x244c07=_0x3b4e0d;_0x2063d9['model']=_[_0xf6e6('0x46')](db[_0xf6e6('0x7f')][_0xf6e6('0x5a')]);_0x2063d9['query']=_[_0xf6e6('0x46')](_0x3203a9['query']);_0x2063d9[_0xf6e6('0x4f')]=_[_0xf6e6('0x47')](_0x2063d9[_0xf6e6('0x44')],_0x2063d9[_0xf6e6('0x45')]);_0x1bb5ff[_0xf6e6('0x49')]=_['intersection'](_0x2063d9[_0xf6e6('0x44')],qs[_0xf6e6('0x48')](_0x3203a9[_0xf6e6('0x45')]['fields']));_0x1bb5ff[_0xf6e6('0x49')]=_0x1bb5ff[_0xf6e6('0x49')][_0xf6e6('0x4a')]?_0x1bb5ff[_0xf6e6('0x49')]:_0x2063d9[_0xf6e6('0x44')];_0x1bb5ff[_0xf6e6('0x4c')]=qs[_0xf6e6('0x4d')](_0x3203a9[_0xf6e6('0x45')]['sort']);_0x1bb5ff['where']=qs['filters'](_[_0xf6e6('0x6b')](_0x3203a9[_0xf6e6('0x45')],_0x2063d9[_0xf6e6('0x4f')]));if(_0x3203a9['query']['filter']){_0x1bb5ff[_0xf6e6('0x4e')]=_[_0xf6e6('0x50')](_0x1bb5ff['where'],{'$or':_[_0xf6e6('0x3f')](_0x1bb5ff[_0xf6e6('0x49')],function(_0x50c4c7){var _0x421cf4={};_0x421cf4[_0x50c4c7]={'$like':'%'+_0x3203a9[_0xf6e6('0x45')][_0xf6e6('0x52')]+'%'};return _0x421cf4;})});}_0x1bb5ff=_[_0xf6e6('0x50')]({},_0x1bb5ff,_0x3203a9[_0xf6e6('0x53')]);return _0x244c07[_0xf6e6('0x82')](_0x1bb5ff);}})['then'](function(_0x2c7591){if(_0x2c7591){_0x22909c=_0x2c7591[_0xf6e6('0x4a')];if(!_0x3203a9['query'][_0xf6e6('0x4b')]('nolimit')){_0x1bb5ff['limit']=qs[_0xf6e6('0x31')](_0x3203a9[_0xf6e6('0x45')][_0xf6e6('0x31')]);_0x1bb5ff[_0xf6e6('0x30')]=qs['offset'](_0x3203a9[_0xf6e6('0x45')][_0xf6e6('0x30')]);}return _0x244c07[_0xf6e6('0x82')](_0x1bb5ff);}})['then'](function(_0x55732b){if(_0x55732b){return _0x55732b?{'count':_0x22909c,'rows':_0x55732b}:null;}})['then'](respondWithResult(_0x592378,null))['catch'](handleError(_0x592378,null));};function Extension(_0x12c1f5,_0x396590,_0x37348f,_0x1b7b63){this[_0xf6e6('0x83')]=_0xf6e6('0x84');this['exten']=_0x12c1f5[_0xf6e6('0x85')];this[_0xf6e6('0x86')]=_0x1b7b63;this[_0xf6e6('0x42')]='system';this['description']=_0xf6e6('0x87');this[_0xf6e6('0x66')]=_0x12c1f5['id'];this[_0xf6e6('0x81')]=_0x396590;this[_0xf6e6('0x88')]=_0x37348f;}function createExtensionsReciveFax(_0x2f09cf){var _0x3e8a70=0x1;var _0x15838a=[];_0x15838a[_0xf6e6('0x89')](new Extension(_0x2f09cf,_0x3e8a70,'','Answer'));_0x3e8a70+=0x1;_0x15838a['push'](new Extension(_0x2f09cf,_0x3e8a70,_0xf6e6('0x8a'),_0xf6e6('0x8b')));_0x3e8a70+=0x1;for(var _0x3ed2c8 in _0x2f09cf){if(_0x2f09cf[_0xf6e6('0x4b')](_0x3ed2c8)&&(_0x3ed2c8===_0xf6e6('0x8c')||_0x3ed2c8===_0xf6e6('0x85')||_0x3ed2c8==='gateway'||_0x3ed2c8===_0xf6e6('0x8d')||_0x3ed2c8===_0xf6e6('0x8e')||_0x3ed2c8===_0xf6e6('0x8f')||_0x3ed2c8===_0xf6e6('0x90')||_0x3ed2c8===_0xf6e6('0x91')||_0x3ed2c8===_0xf6e6('0x92'))){_0x15838a['push'](new Extension(_0x2f09cf,_0x3e8a70,_0xf6e6('0x93')+_0x3ed2c8+')='+_0x2f09cf[_0x3ed2c8],'Set'));_0x3e8a70+=0x1;}}_0x15838a[_0xf6e6('0x89')](new Extension(_0x2f09cf,_0x3e8a70,'6','Wait'));_0x3e8a70+=0x1;_0x15838a[_0xf6e6('0x89')](new Extension(_0x2f09cf,_0x3e8a70,'/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',_0xf6e6('0x94')));_0x3e8a70=0x0;return _0x15838a;}exports['addAccountApplications']=function(_0x25d080,_0x536a8b,_0x2f6fad){var _0x3f03cb;return db[_0xf6e6('0x7e')][_0xf6e6('0x95')](function(_0x3a5410){return db['FaxAccount'][_0xf6e6('0x5c')](_0x25d080[_0xf6e6('0x5d')],{'transaction':_0x3a5410})[_0xf6e6('0x21')](function(_0x192552){_0x3f03cb=_0x192552[_0xf6e6('0x38')]({'plain':!![]});return db[_0xf6e6('0x96')][_0xf6e6('0x97')](createExtensionsReciveFax(_0x3f03cb),{'transaction':_0x3a5410});});})[_0xf6e6('0x21')](function(){return _0x3f03cb;})[_0xf6e6('0x21')](respondWithResult(_0x536a8b,null))[_0xf6e6('0x2a')](handleError(_0x536a8b,null));};exports[_0xf6e6('0x98')]=function(_0x5bf161,_0x310332,_0x1f892a){var _0x303fc9;return db[_0xf6e6('0x7e')]['transaction'](function(_0x53a62f){return db[_0xf6e6('0x40')][_0xf6e6('0x36')](_0x5bf161[_0xf6e6('0x5d')],{'where':{'id':_0x5bf161[_0xf6e6('0x5d')]['id']},'transaction':_0x53a62f})[_0xf6e6('0x21')](function(_0x5731c6){return db[_0xf6e6('0x96')][_0xf6e6('0x37')]({'where':{'FaxAccountId':_0x5bf161['body']['id']},'transaction':_0x53a62f})[_0xf6e6('0x21')](function(_0x296b5a){return db['VoiceExtension'][_0xf6e6('0x97')](createExtensionsReciveFax(_[_0xf6e6('0x99')](_0x5bf161[_0xf6e6('0x5d')],[_0xf6e6('0x9a'),'key','createdAt','updatedAt','TrunkId','ListId'])),{'transaction':_0x53a62f});});});})[_0xf6e6('0x21')](function(){return db[_0xf6e6('0x40')][_0xf6e6('0x9b')](_0x5bf161[_0xf6e6('0x5d')]['id']);})[_0xf6e6('0x21')](respondWithResult(_0x310332,null))[_0xf6e6('0x2a')](handleError(_0x310332,null));};exports[_0xf6e6('0x9c')]=function(_0x4704f0,_0x518136,_0x3fc345){var _0x50fcd2={'raw':!![],'where':{}};var _0x8b83b7={};var _0x4a9d2e={'count':0x0,'rows':[]};return db[_0xf6e6('0x40')][_0xf6e6('0x69')]({'where':{'id':_0x4704f0['params']['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x518136,null))[_0xf6e6('0x21')](function(_0x1fc0a6){if(_0x1fc0a6){_0x8b83b7[_0xf6e6('0x44')]=_[_0xf6e6('0x46')](db[_0xf6e6('0x9d')]['rawAttributes']);_0x8b83b7[_0xf6e6('0x45')]=_[_0xf6e6('0x46')](_0x4704f0[_0xf6e6('0x45')]);_0x8b83b7['filters']=_['intersection'](_0x8b83b7['model'],_0x8b83b7[_0xf6e6('0x45')]);_0x50fcd2[_0xf6e6('0x49')]=_[_0xf6e6('0x47')](_0x8b83b7[_0xf6e6('0x44')],qs[_0xf6e6('0x48')](_0x4704f0[_0xf6e6('0x45')][_0xf6e6('0x48')]));_0x50fcd2['attributes']=_0x50fcd2['attributes'][_0xf6e6('0x4a')]?_0x50fcd2[_0xf6e6('0x49')]:_0x8b83b7[_0xf6e6('0x44')];if(!_0x4704f0['query'][_0xf6e6('0x4b')](_0xf6e6('0x6a'))){_0x50fcd2[_0xf6e6('0x31')]=qs[_0xf6e6('0x31')](_0x4704f0[_0xf6e6('0x45')][_0xf6e6('0x31')]);_0x50fcd2[_0xf6e6('0x30')]=qs['offset'](_0x4704f0[_0xf6e6('0x45')][_0xf6e6('0x30')]);}_0x50fcd2[_0xf6e6('0x4c')]=qs['sort'](_0x4704f0[_0xf6e6('0x45')]['sort']);_0x50fcd2[_0xf6e6('0x4e')]=qs[_0xf6e6('0x4f')](_['pick'](_0x4704f0['query'],_0x8b83b7[_0xf6e6('0x4f')]));_0x50fcd2[_0xf6e6('0x4e')]['FaxAccountId']=_0x1fc0a6['id'];if(_0x4704f0[_0xf6e6('0x45')]['filter']){_0x50fcd2['where']=_[_0xf6e6('0x50')](_0x50fcd2[_0xf6e6('0x4e')],{'$or':_[_0xf6e6('0x3f')](_0x50fcd2[_0xf6e6('0x49')],function(_0xace3f){var _0x11a617={};_0x11a617[_0xace3f]={'$like':'%'+_0x4704f0[_0xf6e6('0x45')][_0xf6e6('0x52')]+'%'};return _0x11a617;})});}if(_0x4704f0['query']['$gte']){var _0x48111a=_0x4704f0['query']['$gte'][_0xf6e6('0x9e')](',');var _0x178ec4={};_0x178ec4[_0x48111a[0x0]]={'$gte':moment(_0x48111a[0x1])[_0xf6e6('0x9f')](_0xf6e6('0xa0'))};_0x50fcd2[_0xf6e6('0x4e')]=_['merge'](_0x50fcd2[_0xf6e6('0x4e')],_0x178ec4);}_0x50fcd2=_[_0xf6e6('0x50')]({},_0x50fcd2,_0x4704f0[_0xf6e6('0x53')]);return db[_0xf6e6('0x9d')]['count']({'where':_0x50fcd2[_0xf6e6('0x4e')]})[_0xf6e6('0x21')](function(_0x5a6aeb){_0x4a9d2e[_0xf6e6('0x2f')]=_0x5a6aeb;if(_0x4704f0[_0xf6e6('0x45')][_0xf6e6('0x54')]){_0x50fcd2[_0xf6e6('0x55')]=[{'all':!![]}];}return db[_0xf6e6('0x9d')][_0xf6e6('0x6c')](_0x50fcd2);})[_0xf6e6('0x21')](function(_0x236153){_0x4a9d2e['rows']=_0x236153;return _0x4a9d2e;});}})[_0xf6e6('0x21')](respondWithFilteredResult(_0x518136,_0x50fcd2))[_0xf6e6('0x2a')](handleError(_0x518136,null));};exports[_0xf6e6('0x3c')]=function(_0x1275b4,_0x42fd7e,_0x3feb3d){var _0x5e8f1a,_0x324aae={},_0xf65819;if(_0x1275b4[_0xf6e6('0x5d')]['to']){_0xf65819=_0x1275b4[_0xf6e6('0x5d')]['to'][0x0];}return db[_0xf6e6('0x40')]['find']({'where':{'id':_0x1275b4[_0xf6e6('0x58')]['id']},'include':[{'model':db[_0xf6e6('0xa1')],'as':_0xf6e6('0xa2'),'include':[{'model':db['CmContact'],'as':_0xf6e6('0xa3'),'where':{'fax':_0xf65819},'limit':0x1,'order':[[_0xf6e6('0xa4'),_0xf6e6('0xa5')]]}]}]})[_0xf6e6('0x21')](handleEntityNotFound(_0x42fd7e,null))['then'](function(_0xa16bcc){_0x5e8f1a=_0xa16bcc;if(_0x1275b4['body'][_0xf6e6('0xa6')]&&_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')]['length']){for(var _0x3b36b0=0x0;_0x3b36b0<_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')]['length'];_0x3b36b0+=0x1){_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][_0x3b36b0]={'filename':_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][_0x3b36b0]['name'],'id':_0x1275b4['body'][_0xf6e6('0xa6')][_0x3b36b0]['id'],'path':path['join'](config[_0xf6e6('0xa7')],_0xf6e6('0xa8'),_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][_0x3b36b0][_0xf6e6('0xa9')])};}}return respondWithRpcPromise('CheckAfterSend',_0xf6e6('0xaa'),{'FaxAccountId':_[_0xf6e6('0xab')](_0x1275b4[_0xf6e6('0x58')]['id'])?undefined:_0x1275b4[_0xf6e6('0x58')]['id'],'path':_[_0xf6e6('0xab')](_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][0x0][_0xf6e6('0x8')])?undefined:_0x1275b4['body']['attachments'][0x0][_0xf6e6('0x8')],'fax':_[_0xf6e6('0xab')](_0x1275b4['body']['to'][0x0])?undefined:_0x1275b4[_0xf6e6('0x5d')]['to'][0x0]},client9002);})[_0xf6e6('0x21')](function(){if(_0x5e8f1a){if(_[_0xf6e6('0xab')](_0x1275b4[_0xf6e6('0x5d')]['from'])){_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xac')]=util[_0xf6e6('0x9f')]('\x22%s\x22\x20<%s>',_0x5e8f1a[_0xf6e6('0x3b')],_0x5e8f1a['fax']);}if(_0x5e8f1a[_0xf6e6('0xa2')]){if(_0x5e8f1a[_0xf6e6('0xa2')][_0xf6e6('0xa3')][_0xf6e6('0x4a')]){return _0x5e8f1a[_0xf6e6('0xa2')][_0xf6e6('0xa3')][0x0];}else{return db[_0xf6e6('0xad')][_0xf6e6('0x5c')](_[_0xf6e6('0xae')](_0x1275b4[_0xf6e6('0x5d')],{'firstName':_0x1275b4[_0xf6e6('0x5d')]['to'][0x0],'phone':_0x1275b4[_0xf6e6('0x5d')]['to'][0x0],'fax':_0x1275b4[_0xf6e6('0x5d')]['to'][0x0],'ListId':_0x5e8f1a[_0xf6e6('0xaf')]}));}}else{throw new Error(_0xf6e6('0xb0'));}}else{throw new Error(_0xf6e6('0xb1'));}})[_0xf6e6('0x21')](function(_0x130d9a){if(_0x130d9a){return db['FaxInteraction']['find']({'where':{'ContactId':_0x130d9a['id'],'closed':![],'FaxAccountId':_0x5e8f1a['id']}})[_0xf6e6('0x21')](function(_0x448d27){if(_0x448d27){return[_0x448d27,![]];}return db['FaxInteraction'][_0xf6e6('0x5c')]({'UserId':_0x1275b4[_0xf6e6('0x5e')]['id'],'ContactId':_0x130d9a['id'],'FaxAccountId':_0x5e8f1a['id'],'fax':_0x1275b4[_0xf6e6('0x5d')]['to'][0x0],'firstMsgDirection':_0xf6e6('0xb2'),'Messages':[_['merge'](_0x1275b4[_0xf6e6('0x5d')],{'read':![],'body':_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][0x0][_0xf6e6('0xb3')],'FaxAccountId':_0x5e8f1a['id'],'UserId':_0x1275b4[_0xf6e6('0x5e')]['id'],'ContactId':_0x130d9a['id'],'AttachmentId':_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0xf6e6('0x9d')],'as':_0xf6e6('0xb4')}]})[_0xf6e6('0x21')](function(_0xf34719){return[_0xf34719,!![]];});});}else{throw new Error(_0xf6e6('0xb5'));}})[_0xf6e6('0xb6')](function(_0x1fa2b9,_0xe0a01e){if(_0xe0a01e){return _0x1fa2b9;}return db[_0xf6e6('0x9d')][_0xf6e6('0x5c')]({'direction':_0xf6e6('0xb2'),'read':![],'body':_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][0x0][_0xf6e6('0xb3')],'FaxAccountId':_0x5e8f1a['id'],'FaxInteractionId':_0x1fa2b9['id'],'UserId':_0x1275b4['user']['id'],'ContactId':_0x1fa2b9[_0xf6e6('0xb7')],'AttachmentId':_0x1275b4['body'][_0xf6e6('0xa6')][0x0]['id']})[_0xf6e6('0x21')](function(_0xddbc99){_0x1fa2b9[_0xf6e6('0xb8')]['Messages']=[];_0x1fa2b9[_0xf6e6('0xb8')][_0xf6e6('0xb4')][_0xf6e6('0x89')](_0xddbc99['dataValues']);return _0x1fa2b9;});})[_0xf6e6('0x21')](function(_0x5d905b){respondWithRpcPromise(_0xf6e6('0xb9'),_0xf6e6('0xb9'),{'FaxAccountId':_[_0xf6e6('0xab')](_0x1275b4[_0xf6e6('0x58')]['id'])?undefined:_0x1275b4['params']['id'],'path':_[_0xf6e6('0xab')](_0x1275b4[_0xf6e6('0x5d')]['attachments'][0x0][_0xf6e6('0x8')])?undefined:_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][0x0][_0xf6e6('0x8')],'fax':_[_0xf6e6('0xab')](_0x1275b4[_0xf6e6('0x5d')]['to'][0x0])?undefined:_0x1275b4[_0xf6e6('0x5d')]['to'][0x0],'AttachmentId':_0x1275b4[_0xf6e6('0x5d')][_0xf6e6('0xa6')][0x0]['id']},client9002)[_0xf6e6('0x21')](function(_0x30406f){logger[_0xf6e6('0xba')]('SendFaxRpc,\x20%s',_0x30406f);})['catch'](function(_0x15e3ad){logger['info']('SendFaxRpc,\x20%s',_0x15e3ad);});return _0x5d905b;})[_0xf6e6('0x21')](respondWithResult(_0x42fd7e,null))[_0xf6e6('0x2a')](handleError(_0x42fd7e,null));};exports[_0xf6e6('0xbb')]=function(_0x109f47,_0x367644,_0x3fc006){return db[_0xf6e6('0x40')][_0xf6e6('0x5b')]({'where':{'id':_0x109f47['params']['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x367644,null))['then'](function(_0x35dc8d){if(_0x35dc8d){return _0x35dc8d[_0xf6e6('0xbb')](_0x109f47['body'][_0xf6e6('0x6e')],_[_0xf6e6('0x99')](_0x109f47[_0xf6e6('0x5d')],[_0xf6e6('0x6e'),'id'])||{})[_0xf6e6('0xb6')](function(_0x4a2d05){for(var _0x3d3e17=0x0;_0x3d3e17<_0x109f47[_0xf6e6('0x5d')][_0xf6e6('0x6e')][_0xf6e6('0x4a')];_0x3d3e17+=0x1){socket[_0xf6e6('0xbc')]('userFaxAccount:save',{'UserId':_0x109f47[_0xf6e6('0x5d')][_0xf6e6('0x6e')][_0x3d3e17],'FaxAccountId':_0x109f47[_0xf6e6('0x58')]['id']});}return _0x4a2d05;});}})[_0xf6e6('0x21')](respondWithResult(_0x367644,null))[_0xf6e6('0x2a')](handleError(_0x367644,null));};exports[_0xf6e6('0xbd')]=function(_0x7e8e86,_0x36c783,_0x3dfcb1){return db[_0xf6e6('0x40')][_0xf6e6('0x5b')]({'where':{'id':_0x7e8e86['params']['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x36c783,null))[_0xf6e6('0x21')](function(_0x361aed){if(_0x361aed){return _0x361aed[_0xf6e6('0xbd')](_0x7e8e86[_0xf6e6('0x45')][_0xf6e6('0x6e')])['then'](function(){if(_[_0xf6e6('0xbe')](_0x7e8e86['query']['ids'])){for(var _0xb79862=0x0;_0xb79862<_0x7e8e86['query']['ids'][_0xf6e6('0x4a')];_0xb79862+=0x1){socket[_0xf6e6('0xbc')](_0xf6e6('0xbf'),{'UserId':Number(_0x7e8e86['query'][_0xf6e6('0x6e')][_0xb79862]),'FaxAccountId':Number(_0x7e8e86['params']['id'])});}}else{socket[_0xf6e6('0xbc')](_0xf6e6('0xbf'),{'UserId':Number(_0x7e8e86[_0xf6e6('0x45')][_0xf6e6('0x6e')]),'FaxAccountId':Number(_0x7e8e86[_0xf6e6('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x36c783,null))['catch'](handleError(_0x36c783,null));};exports[_0xf6e6('0xc0')]=function(_0x18b790,_0x26b2e4,_0x54e5de){var _0x26797e={};var _0x43a613={};var _0x5bd44b;var _0x514d10;return db[_0xf6e6('0x40')][_0xf6e6('0x69')]({'where':{'id':_0x18b790[_0xf6e6('0x58')]['id']}})[_0xf6e6('0x21')](handleEntityNotFound(_0x26b2e4,null))[_0xf6e6('0x21')](function(_0x471b50){if(_0x471b50){_0x5bd44b=_0x471b50;_0x43a613['model']=_['keys'](db[_0xf6e6('0x76')][_0xf6e6('0x5a')]);_0x43a613[_0xf6e6('0x45')]=_[_0xf6e6('0x46')](_0x18b790[_0xf6e6('0x45')]);_0x43a613[_0xf6e6('0x4f')]=_[_0xf6e6('0x47')](_0x43a613[_0xf6e6('0x44')],_0x43a613[_0xf6e6('0x45')]);_0x26797e['attributes']=_[_0xf6e6('0x47')](_0x43a613[_0xf6e6('0x44')],qs[_0xf6e6('0x48')](_0x18b790[_0xf6e6('0x45')][_0xf6e6('0x48')]));_0x26797e[_0xf6e6('0x49')]=_0x26797e[_0xf6e6('0x49')]['length']?_0x26797e[_0xf6e6('0x49')]:_0x43a613[_0xf6e6('0x44')];_0x26797e[_0xf6e6('0x4c')]=qs['sort'](_0x18b790[_0xf6e6('0x45')][_0xf6e6('0x4d')]);_0x26797e[_0xf6e6('0x4e')]=qs[_0xf6e6('0x4f')](_['pick'](_0x18b790[_0xf6e6('0x45')],_0x43a613[_0xf6e6('0x4f')]));if(_0x18b790[_0xf6e6('0x45')][_0xf6e6('0x52')]){_0x26797e['where']=_[_0xf6e6('0x50')](_0x26797e['where'],{'$or':_['map'](_0x26797e['attributes'],function(_0x42758e){var _0x4659c9={};_0x4659c9[_0x42758e]={'$like':'%'+_0x18b790[_0xf6e6('0x45')][_0xf6e6('0x52')]+'%'};return _0x4659c9;})});}_0x26797e=_[_0xf6e6('0x50')]({},_0x26797e,_0x18b790['options']);return _0x5bd44b['getAgents'](_0x26797e);}})[_0xf6e6('0x21')](function(_0x4a0f22){if(_0x4a0f22){_0x514d10=_0x4a0f22[_0xf6e6('0x4a')];if(!_0x18b790['query'][_0xf6e6('0x4b')](_0xf6e6('0x6a'))){_0x26797e[_0xf6e6('0x31')]=qs[_0xf6e6('0x31')](_0x18b790[_0xf6e6('0x45')]['limit']);_0x26797e['offset']=qs[_0xf6e6('0x30')](_0x18b790[_0xf6e6('0x45')][_0xf6e6('0x30')]);}return _0x5bd44b[_0xf6e6('0xc0')](_0x26797e);}})[_0xf6e6('0x21')](function(_0x254742){if(_0x254742){return _0x254742?{'count':_0x514d10,'rows':_0x254742}:null;}})[_0xf6e6('0x21')](respondWithResult(_0x26b2e4,null))[_0xf6e6('0x2a')](handleError(_0x26b2e4,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4f739a7..e52a922 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 _0xb6f2=['FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5cbb3a,_0x48ad34){var _0x53fa12=function(_0x551817){while(--_0x551817){_0x5cbb3a['push'](_0x5cbb3a['shift']());}};_0x53fa12(++_0x48ad34);}(_0xb6f2,0x1b7));var _0x2b6f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xb6f2[_0x2d2c16];return _0x53f2fb;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x2b6f('0x0'))['db'][_0x2b6f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2b6f('0x2')](0x0);var events={'afterCreate':_0x2b6f('0x3'),'afterUpdate':_0x2b6f('0x4'),'afterDestroy':_0x2b6f('0x5')};function emitEvent(_0x5c2ce0){return function(_0x2b4622,_0x53cc86,_0x20b2ef){FaxAccountEvents[_0x2b6f('0x6')](_0x5c2ce0+':'+_0x2b4622['id'],_0x2b4622);FaxAccountEvents['emit'](_0x5c2ce0,_0x2b4622);_0x20b2ef(null);};}for(var e in events){if(events[_0x2b6f('0x7')](e)){var event=events[e];FaxAccount[_0x2b6f('0x8')](e,emitEvent(event));}}module[_0x2b6f('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xf0e2=['FaxAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d7c55,_0x38bac3){var _0x1b747d=function(_0x33dd41){while(--_0x33dd41){_0x3d7c55['push'](_0x3d7c55['shift']());}};_0x1b747d(++_0x38bac3);}(_0xf0e2,0x170));var _0x2f0e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xf0e2[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0x2f0e('0x0'));var FaxAccount=require(_0x2f0e('0x1'))['db'][_0x2f0e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f0e('0x3'),'afterUpdate':_0x2f0e('0x4'),'afterDestroy':_0x2f0e('0x5')};function emitEvent(_0x4a4a07){return function(_0x16790c,_0x117261,_0x3f2965){FaxAccountEvents[_0x2f0e('0x6')](_0x4a4a07+':'+_0x16790c['id'],_0x16790c);FaxAccountEvents[_0x2f0e('0x6')](_0x4a4a07,_0x16790c);_0x3f2965(null);};}for(var e in events){if(events[_0x2f0e('0x7')](e)){var event=events[e];FaxAccount[_0x2f0e('0x8')](e,emitEvent(event));}}module[_0x2f0e('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f58a3bf..69a54ce 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 _0xeaf3=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','api'];(function(_0x5b1646,_0x258430){var _0x1bef39=function(_0x193916){while(--_0x193916){_0x5b1646['push'](_0x5b1646['shift']());}};_0x1bef39(++_0x258430);}(_0xeaf3,0x1d0));var _0x3eaf=function(_0x141158,_0x25142f){_0x141158=_0x141158-0x0;var _0x43b33e=_0xeaf3[_0x141158];return _0x43b33e;};'use strict';var _=require(_0x3eaf('0x0'));var util=require(_0x3eaf('0x1'));var logger=require(_0x3eaf('0x2'))(_0x3eaf('0x3'));var moment=require('moment');var BPromise=require(_0x3eaf('0x4'));var rp=require(_0x3eaf('0x5'));var fs=require('fs');var path=require(_0x3eaf('0x6'));var rimraf=require(_0x3eaf('0x7'));var config=require('../../config/environment');var attributes=require(_0x3eaf('0x8'));module[_0x3eaf('0x9')]=function(_0x3d28f2,_0x1db2fe){return _0x3d28f2[_0x3eaf('0xa')](_0x3eaf('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce99=['util','../../config/logger','moment','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','lodash'];(function(_0x552284,_0x4ddb09){var _0x4ac092=function(_0x5c2703){while(--_0x5c2703){_0x552284['push'](_0x552284['shift']());}};_0x4ac092(++_0x4ddb09);}(_0xce99,0x1df));var _0x9ce9=function(_0x588050,_0x5d186d){_0x588050=_0x588050-0x0;var _0x413051=_0xce99[_0x588050];return _0x413051;};'use strict';var _=require(_0x9ce9('0x0'));var util=require(_0x9ce9('0x1'));var logger=require(_0x9ce9('0x2'))('api');var moment=require(_0x9ce9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ce9('0x4'));var rimraf=require(_0x9ce9('0x5'));var config=require(_0x9ce9('0x6'));var attributes=require(_0x9ce9('0x7'));module[_0x9ce9('0x8')]=function(_0x1e6c05,_0x5840e6){return _0x1e6c05['define'](_0x9ce9('0x9'),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 85b1e85..bb155c3 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 _0x903d=['Start','startRouting','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','include','model','attributes','map','NotifyFaxAccount','body','fax','describe','difference','keys','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','account','length','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','name','UserId','unshift','agent','waitForTheAssignedAgent'];(function(_0x846d25,_0x136c93){var _0x204394=function(_0x59dc60){while(--_0x59dc60){_0x846d25['push'](_0x846d25['shift']());}};_0x204394(++_0x136c93);}(_0x903d,0x1a6));var _0xd903=function(_0x44129e,_0x3f94a9){_0x44129e=_0x44129e-0x0;var _0x3fc82f=_0x903d[_0x44129e];return _0x3fc82f;};'use strict';var _=require(_0xd903('0x0'));var util=require('util');var moment=require(_0xd903('0x1'));var BPromise=require('bluebird');var rs=require(_0xd903('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd903('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd903('0x4'));var config=require(_0xd903('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd903('0x6')][_0xd903('0x7')]({'port':0x232c});config[_0xd903('0x8')]=_[_0xd903('0x9')](config[_0xd903('0x8')],{'host':_0xd903('0xa'),'port':0x18eb});var socket=require(_0xd903('0xb'))(new Redis(config[_0xd903('0x8')]));require('./faxAccount.socket')[_0xd903('0xc')](socket);function respondWithRpcPromise(_0x5bf0b2,_0x334211,_0x1f2096){return new BPromise(function(_0x19d596,_0x12ad94){return client['request'](_0x5bf0b2,_0x1f2096)[_0xd903('0xd')](function(_0x27cbd5){logger[_0xd903('0xe')](_0xd903('0xf'),_0x334211,_0xd903('0x10'));logger['debug'](_0xd903('0x11'),_0x334211,_0xd903('0x10'),JSON[_0xd903('0x12')](_0x27cbd5));if(_0x27cbd5['error']){if(_0x27cbd5[_0xd903('0x13')][_0xd903('0x14')]===0x1f4){logger[_0xd903('0x13')](_0xd903('0xf'),_0x334211,_0x27cbd5[_0xd903('0x13')][_0xd903('0x15')]);return _0x12ad94(_0x27cbd5[_0xd903('0x13')][_0xd903('0x15')]);}logger[_0xd903('0x13')](_0xd903('0xf'),_0x334211,_0x27cbd5[_0xd903('0x13')][_0xd903('0x15')]);return _0x19d596(_0x27cbd5['error'][_0xd903('0x15')]);}else{logger[_0xd903('0xe')](_0xd903('0xf'),_0x334211,_0xd903('0x10'));_0x19d596(_0x27cbd5[_0xd903('0x16')][_0xd903('0x15')]);}})[_0xd903('0x17')](function(_0x32a805){logger[_0xd903('0x13')](_0xd903('0xf'),_0x334211,_0x32a805);_0x12ad94(_0x32a805);});});}exports[_0xd903('0x18')]=function(_0x5773c5){var _0x122a38=this;return new Promise(function(_0x40d92f,_0x394ada){return db[_0xd903('0x19')][_0xd903('0x1a')]({'raw':_0x5773c5[_0xd903('0x1b')]?_0x5773c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x5773c5[_0xd903('0x1b')]?_0x5773c5['options']['where']||null:null,'attributes':_0x5773c5['options']?_0x5773c5[_0xd903('0x1b')]['attributes']||null:null,'limit':_0x5773c5[_0xd903('0x1b')]?_0x5773c5[_0xd903('0x1b')]['limit']||null:null,'include':_0x5773c5[_0xd903('0x1b')]?_0x5773c5[_0xd903('0x1b')][_0xd903('0x1c')]?_['map'](_0x5773c5[_0xd903('0x1b')]['include'],function(_0x47f729){return{'model':db[_0x47f729[_0xd903('0x1d')]],'as':_0x47f729['as'],'attributes':_0x47f729[_0xd903('0x1e')],'include':_0x47f729[_0xd903('0x1c')]?_['map'](_0x47f729[_0xd903('0x1c')],function(_0x12a781){return{'model':db[_0x12a781[_0xd903('0x1d')]],'as':_0x12a781['as'],'attributes':_0x12a781['attributes'],'include':_0x12a781[_0xd903('0x1c')]?_[_0xd903('0x1f')](_0x12a781[_0xd903('0x1c')],function(_0x2839ac){return{'model':db[_0x2839ac[_0xd903('0x1d')]],'as':_0x2839ac['as'],'attributes':_0x2839ac[_0xd903('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd903('0xd')](function(_0x3bfc27){logger[_0xd903('0xe')](_0xd903('0x18'),_0x5773c5);logger['debug'](_0xd903('0x18'),_0x5773c5,JSON['stringify'](_0x3bfc27));_0x40d92f(_0x3bfc27);})['catch'](function(_0x213416){logger[_0xd903('0x13')](_0xd903('0x18'),_0x213416[_0xd903('0x15')],_0x5773c5);_0x394ada(_0x122a38[_0xd903('0x13')](0x1f4,_0x213416['message']));});});};exports[_0xd903('0x20')]=function(_0x233d92,_0x31432e,_0xb35cbc){var _0x28178a=this;return new Promise(function(_0x48022d,_0x42b476){var _0x4d264b={'body':_0x233d92[_0xd903('0x21')],'channel':_0xd903('0x22')};var _0x2597e6=[];var _0x3d23eb=[];var _0x29b0dc={};return db['CmContact'][_0xd903('0x23')]()[_0xd903('0xd')](function(_0x300e8d){if(!_0x300e8d){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x2597e6=_['difference'](_['keys'](_0x300e8d),['createdAt','updatedAt']);_0x3d23eb=_[_0xd903('0x24')](_[_0xd903('0x25')](_0x300e8d),['createdAt',_0xd903('0x26'),'CompanyId',_0xd903('0x27')]);if(_0x233d92[_0xd903('0x21')]['id']){delete _0x233d92[_0xd903('0x21')]['id'];}if(_[_0xd903('0x28')](_0x233d92['body'][_0xd903('0x29')])){throw new db[(_0xd903('0x2a'))]['ValidationError'](_0xd903('0x2b'));}if(_[_0xd903('0x28')](_0x233d92[_0xd903('0x21')][_0xd903('0x21')])||_0x233d92[_0xd903('0x21')][_0xd903('0x21')]===''){throw new db['Sequelize'][(_0xd903('0x2c'))](_0xd903('0x2d'));}if(_['isNil'](_0x233d92[_0xd903('0x21')][_0xd903('0x2e')])){throw new db[(_0xd903('0x2a'))][(_0xd903('0x2c'))](_0xd903('0x2f')+_0x3d23eb);}if(!_['includes'](_0x3d23eb,_0x233d92[_0xd903('0x21')][_0xd903('0x2e')])){throw new db['Sequelize']['ValidationError'](_0xd903('0x30')+_0x3d23eb);}_0x29b0dc[_0x233d92[_0xd903('0x21')][_0xd903('0x2e')]]=_0x233d92[_0xd903('0x21')][_0xd903('0x29')];})['then'](function(){return db['FaxAccount'][_0xd903('0x31')]({'where':{'id':_0x233d92['account']['id']},'include':[{'model':db[_0xd903('0x32')],'as':_0xd903('0x33'),'include':[{'model':db['CmContact'],'as':_0xd903('0x34'),'where':_0x29b0dc,'limit':0x1,'order':[[_0xd903('0x26'),_0xd903('0x35')]]}]},{'model':db[_0xd903('0x36')],'as':_0xd903('0x37')}]});})[_0xd903('0xd')](function(_0x28a6a8){if(_0x28a6a8&&_0x28a6a8[_0xd903('0x33')]){var _0x387707=_0x28a6a8[_0xd903('0x38')]({'plain':!![]});_0x4d264b['account']=_0x387707;_0x4d264b[_0xd903('0x39')]=_0x387707[_0xd903('0x37')];_0x4d264b[_0xd903('0x3a')]=_0x387707['List'];_0x4d264b[_0xd903('0x39')]=_['orderBy'](_0x4d264b[_0xd903('0x39')],['priority'],['asc']);if(_0x4d264b['account'][_0xd903('0x37')]){delete _0x4d264b[_0xd903('0x3b')][_0xd903('0x37')];}if(_0x4d264b[_0xd903('0x3b')][_0xd903('0x33')]&&_0x4d264b[_0xd903('0x3b')]['List']['Contacts'][_0xd903('0x3c')]){return _0x4d264b[_0xd903('0x3b')][_0xd903('0x33')][_0xd903('0x34')][0x0];}var _0x114964=_[_0xd903('0x9')](_0x233d92[_0xd903('0x21')],{'firstName':_0x233d92[_0xd903('0x21')][_0xd903('0x29')],'ListId':_0x387707[_0xd903('0x27')]});_0x114964[_0x233d92[_0xd903('0x21')][_0xd903('0x2e')]]=_0x233d92[_0xd903('0x21')][_0xd903('0x29')];return db[_0xd903('0x3d')][_0xd903('0x3e')](_0x114964,{'fields':_0x2597e6,'raw':!![]});}})[_0xd903('0xd')](function(_0x3e3a7e){_0x4d264b[_0xd903('0x3f')]=_0x3e3a7e;if(_0x3e3a7e){var _0x2a3b84={'ContactId':_0x3e3a7e['id'],'FaxAccountId':_0x233d92[_0xd903('0x3b')]['id'],'fax':_0x3e3a7e['fax']};return db[_0xd903('0x40')][_0xd903('0x31')]({'where':{'ContactId':_0x3e3a7e['id'],'closed':![],'FaxAccountId':_0x233d92[_0xd903('0x3b')]['id']}})[_0xd903('0xd')](function(_0x5af76b){if(_0x5af76b){return[_0x5af76b,![]];}return db[_0xd903('0x40')]['create'](_0x2a3b84)['then'](function(_0x4c4a2d){return[_0x4c4a2d,!![]];});});}else{throw new Error(_0xd903('0x41'));}})[_0xd903('0x42')](function(_0x5f05c2,_0x581fbc){var _0x403584=_0x5f05c2['get']({'plain':!![]});if(_0x581fbc){if(_0x4d264b[_0xd903('0x3b')][_0xd903('0x43')]){_0x4d264b['applications'][_0xd903('0x44')]({'id':0x0,'priority':_0x4d264b['applications']['length']+0x1,'app':_0xd903('0x45'),'appdata':_0xd903('0x46'),'interval':_0xd903('0x47')});}_0x403584[_0xd903('0x48')]=!![];}else{_0x403584[_0xd903('0x48')]=![];}_0x4d264b[_0xd903('0x49')]=_0x403584;return db[_0xd903('0x4a')][_0xd903('0x3e')]({'body':_0x233d92['body']['body'],'FaxAccountId':_0x233d92[_0xd903('0x3b')]['id'],'FaxInteractionId':_0x5f05c2['id'],'direction':'in','ContactId':_0x5f05c2[_0xd903('0x4b')],'AttachmentId':_0x233d92['body']['AttachmentId']});})[_0xd903('0xd')](function(_0x470ad9){_0x4d264b['message']=_0x470ad9;if(_0x4d264b['interaction']['UserId']){return db[_0xd903('0x4c')]['find']({'attributes':['id',_0xd903('0x4d')],'where':{'id':_0x4d264b[_0xd903('0x49')][_0xd903('0x4e')]}})[_0xd903('0xd')](function(_0x14383d){if(_0x14383d){_0x4d264b[_0xd903('0x39')][_0xd903('0x4f')]({'id':0x0,'priority':0x0,'app':_0xd903('0x50'),'appdata':_0x14383d[_0xd903('0x4d')]+','+(_0x4d264b[_0xd903('0x3b')][_0xd903('0x51')]||0xa),'interval':_0xd903('0x47')});}return respondWithRpcPromise(_0xd903('0x52'),'startRouting',_0x4d264b);});}return respondWithRpcPromise(_0xd903('0x52'),_0xd903('0x53'),_0x4d264b);})[_0xd903('0xd')](function(_0x1bac5a){_0x48022d(_0x1bac5a);})[_0xd903('0x17')](function(_0x40ffb6){_0x42b476(_0x28178a[_0xd903('0x13')](0x1f4,_0x40ffb6[_0xd903('0x15')]));});});}; \ No newline at end of file +var _0x1669=['GetFaxAccount','FaxAccount','findAll','options','where','include','map','model','attributes','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','Applications','get','applications','list','orderBy','length','create','contact','FaxInteraction','autoclose','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x3e5c2b,_0x1bf391){var _0x460f3c=function(_0x344d0a){while(--_0x344d0a){_0x3e5c2b['push'](_0x3e5c2b['shift']());}};_0x460f3c(++_0x1bf391);}(_0x1669,0xdd));var _0x9166=function(_0x209ce3,_0x581380){_0x209ce3=_0x209ce3-0x0;var _0x57d6f8=_0x1669[_0x209ce3];return _0x57d6f8;};'use strict';var _=require(_0x9166('0x0'));var util=require(_0x9166('0x1'));var moment=require(_0x9166('0x2'));var BPromise=require(_0x9166('0x3'));var rs=require(_0x9166('0x4'));var fs=require('fs');var Redis=require(_0x9166('0x5'));var db=require(_0x9166('0x6'))['db'];var utils=require(_0x9166('0x7'));var logger=require(_0x9166('0x8'))(_0x9166('0x9'));var config=require(_0x9166('0xa'));var jayson=require(_0x9166('0xb'));var client=jayson[_0x9166('0xc')]['http']({'port':0x232c});config[_0x9166('0xd')]=_[_0x9166('0xe')](config['redis'],{'host':_0x9166('0xf'),'port':0x18eb});var socket=require(_0x9166('0x10'))(new Redis(config[_0x9166('0xd')]));require('./faxAccount.socket')[_0x9166('0x11')](socket);function respondWithRpcPromise(_0x4149c7,_0x32fcf4,_0x34fdcd){return new BPromise(function(_0x4c6708,_0x30bcde){return client['request'](_0x4149c7,_0x34fdcd)[_0x9166('0x12')](function(_0x4023aa){logger['info'](_0x9166('0x13'),_0x32fcf4,'request\x20sent');logger[_0x9166('0x14')](_0x9166('0x15'),_0x32fcf4,'request\x20sent',JSON[_0x9166('0x16')](_0x4023aa));if(_0x4023aa[_0x9166('0x17')]){if(_0x4023aa[_0x9166('0x17')]['code']===0x1f4){logger[_0x9166('0x17')]('FaxAccount,\x20%s,\x20%s',_0x32fcf4,_0x4023aa[_0x9166('0x17')][_0x9166('0x18')]);return _0x30bcde(_0x4023aa[_0x9166('0x17')]['message']);}logger[_0x9166('0x17')](_0x9166('0x13'),_0x32fcf4,_0x4023aa[_0x9166('0x17')][_0x9166('0x18')]);return _0x4c6708(_0x4023aa['error']['message']);}else{logger[_0x9166('0x19')](_0x9166('0x13'),_0x32fcf4,'request\x20sent');_0x4c6708(_0x4023aa[_0x9166('0x1a')][_0x9166('0x18')]);}})[_0x9166('0x1b')](function(_0x4d8499){logger[_0x9166('0x17')](_0x9166('0x13'),_0x32fcf4,_0x4d8499);_0x30bcde(_0x4d8499);});});}exports[_0x9166('0x1c')]=function(_0x3bdd2c){var _0x5a6aaf=this;return new Promise(function(_0x265d60,_0x578a6a){return db[_0x9166('0x1d')][_0x9166('0x1e')]({'raw':_0x3bdd2c[_0x9166('0x1f')]?_0x3bdd2c[_0x9166('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3bdd2c[_0x9166('0x1f')]?_0x3bdd2c[_0x9166('0x1f')][_0x9166('0x20')]||null:null,'attributes':_0x3bdd2c[_0x9166('0x1f')]?_0x3bdd2c[_0x9166('0x1f')]['attributes']||null:null,'limit':_0x3bdd2c[_0x9166('0x1f')]?_0x3bdd2c[_0x9166('0x1f')]['limit']||null:null,'include':_0x3bdd2c[_0x9166('0x1f')]?_0x3bdd2c[_0x9166('0x1f')][_0x9166('0x21')]?_[_0x9166('0x22')](_0x3bdd2c[_0x9166('0x1f')][_0x9166('0x21')],function(_0x1f7c10){return{'model':db[_0x1f7c10[_0x9166('0x23')]],'as':_0x1f7c10['as'],'attributes':_0x1f7c10[_0x9166('0x24')],'include':_0x1f7c10[_0x9166('0x21')]?_[_0x9166('0x22')](_0x1f7c10[_0x9166('0x21')],function(_0x24ba9f){return{'model':db[_0x24ba9f[_0x9166('0x23')]],'as':_0x24ba9f['as'],'attributes':_0x24ba9f['attributes'],'include':_0x24ba9f['include']?_[_0x9166('0x22')](_0x24ba9f[_0x9166('0x21')],function(_0x5b680e){return{'model':db[_0x5b680e['model']],'as':_0x5b680e['as'],'attributes':_0x5b680e[_0x9166('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9166('0x12')](function(_0x16cc8f){logger['info']('GetFaxAccount',_0x3bdd2c);logger[_0x9166('0x14')](_0x9166('0x1c'),_0x3bdd2c,JSON[_0x9166('0x16')](_0x16cc8f));_0x265d60(_0x16cc8f);})[_0x9166('0x1b')](function(_0x3db9af){logger[_0x9166('0x17')](_0x9166('0x1c'),_0x3db9af['message'],_0x3bdd2c);_0x578a6a(_0x5a6aaf['error'](0x1f4,_0x3db9af[_0x9166('0x18')]));});});};exports[_0x9166('0x25')]=function(_0xb56b29,_0x556f0c,_0x2dbe7c){var _0x31d781=this;return new Promise(function(_0x437bad,_0x1d9b45){var _0x39ec92={'body':_0xb56b29['body'],'channel':_0x9166('0x26')};var _0x4e9683=[];var _0x34ec72=[];var _0x3eef89={};return db[_0x9166('0x27')][_0x9166('0x28')]()['then'](function(_0x58ed16){if(!_0x58ed16){throw new db[(_0x9166('0x29'))][(_0x9166('0x2a'))](_0x9166('0x2b'));}_0x4e9683=_[_0x9166('0x2c')](_['keys'](_0x58ed16),[_0x9166('0x2d'),_0x9166('0x2e')]);_0x34ec72=_[_0x9166('0x2c')](_['keys'](_0x58ed16),[_0x9166('0x2d'),'updatedAt',_0x9166('0x2f'),_0x9166('0x30')]);if(_0xb56b29[_0x9166('0x31')]['id']){delete _0xb56b29[_0x9166('0x31')]['id'];}if(_[_0x9166('0x32')](_0xb56b29[_0x9166('0x31')][_0x9166('0x33')])){throw new db[(_0x9166('0x29'))][(_0x9166('0x2a'))](_0x9166('0x34'));}if(_[_0x9166('0x32')](_0xb56b29[_0x9166('0x31')]['body'])||_0xb56b29[_0x9166('0x31')][_0x9166('0x31')]===''){throw new db[(_0x9166('0x29'))]['ValidationError'](_0x9166('0x35'));}if(_['isNil'](_0xb56b29[_0x9166('0x31')][_0x9166('0x36')])){throw new db['Sequelize'][(_0x9166('0x2a'))](_0x9166('0x37')+_0x34ec72);}if(!_['includes'](_0x34ec72,_0xb56b29[_0x9166('0x31')]['mapKey'])){throw new db[(_0x9166('0x29'))][(_0x9166('0x2a'))](_0x9166('0x38')+_0x34ec72);}_0x3eef89[_0xb56b29[_0x9166('0x31')][_0x9166('0x36')]]=_0xb56b29[_0x9166('0x31')][_0x9166('0x33')];})[_0x9166('0x12')](function(){return db[_0x9166('0x1d')][_0x9166('0x39')]({'where':{'id':_0xb56b29[_0x9166('0x3a')]['id']},'include':[{'model':db[_0x9166('0x3b')],'as':_0x9166('0x3c'),'include':[{'model':db[_0x9166('0x27')],'as':'Contacts','where':_0x3eef89,'limit':0x1,'order':[[_0x9166('0x2e'),_0x9166('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0x9166('0x3e')}]});})[_0x9166('0x12')](function(_0xd4df00){if(_0xd4df00&&_0xd4df00[_0x9166('0x3c')]){var _0x142206=_0xd4df00[_0x9166('0x3f')]({'plain':!![]});_0x39ec92['account']=_0x142206;_0x39ec92[_0x9166('0x40')]=_0x142206[_0x9166('0x3e')];_0x39ec92[_0x9166('0x41')]=_0x142206[_0x9166('0x3c')];_0x39ec92[_0x9166('0x40')]=_[_0x9166('0x42')](_0x39ec92[_0x9166('0x40')],['priority'],['asc']);if(_0x39ec92['account'][_0x9166('0x3e')]){delete _0x39ec92[_0x9166('0x3a')][_0x9166('0x3e')];}if(_0x39ec92[_0x9166('0x3a')][_0x9166('0x3c')]&&_0x39ec92['account'][_0x9166('0x3c')]['Contacts'][_0x9166('0x43')]){return _0x39ec92[_0x9166('0x3a')][_0x9166('0x3c')]['Contacts'][0x0];}var _0x2b1d72=_[_0x9166('0xe')](_0xb56b29[_0x9166('0x31')],{'firstName':_0xb56b29[_0x9166('0x31')][_0x9166('0x33')],'ListId':_0x142206[_0x9166('0x30')]});_0x2b1d72[_0xb56b29['body']['mapKey']]=_0xb56b29[_0x9166('0x31')]['from'];return db['CmContact'][_0x9166('0x44')](_0x2b1d72,{'fields':_0x4e9683,'raw':!![]});}})['then'](function(_0x34b6e3){_0x39ec92[_0x9166('0x45')]=_0x34b6e3;if(_0x34b6e3){var _0x24836b={'ContactId':_0x34b6e3['id'],'FaxAccountId':_0xb56b29[_0x9166('0x3a')]['id'],'fax':_0x34b6e3[_0x9166('0x26')]};return db[_0x9166('0x46')][_0x9166('0x39')]({'where':{'ContactId':_0x34b6e3['id'],'closed':![],'FaxAccountId':_0xb56b29['account']['id']}})[_0x9166('0x12')](function(_0x49bc68){if(_0x49bc68){return[_0x49bc68,![]];}return db[_0x9166('0x46')]['create'](_0x24836b)[_0x9166('0x12')](function(_0x21c968){return[_0x21c968,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x322194,_0x2ae649){var _0x5a459c=_0x322194[_0x9166('0x3f')]({'plain':!![]});if(_0x2ae649){if(_0x39ec92[_0x9166('0x3a')][_0x9166('0x47')]){_0x39ec92[_0x9166('0x40')]['push']({'id':0x0,'priority':_0x39ec92[_0x9166('0x40')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x5a459c[_0x9166('0x48')]=!![];}else{_0x5a459c[_0x9166('0x48')]=![];}_0x39ec92[_0x9166('0x49')]=_0x5a459c;return db[_0x9166('0x4a')][_0x9166('0x44')]({'body':_0xb56b29['body'][_0x9166('0x31')],'FaxAccountId':_0xb56b29[_0x9166('0x3a')]['id'],'FaxInteractionId':_0x322194['id'],'direction':'in','ContactId':_0x322194[_0x9166('0x4b')],'AttachmentId':_0xb56b29[_0x9166('0x31')][_0x9166('0x4c')]});})[_0x9166('0x12')](function(_0x4d3636){_0x39ec92[_0x9166('0x18')]=_0x4d3636;if(_0x39ec92[_0x9166('0x49')][_0x9166('0x4d')]){return db['User'][_0x9166('0x39')]({'attributes':['id',_0x9166('0x4e')],'where':{'id':_0x39ec92[_0x9166('0x49')][_0x9166('0x4d')]}})[_0x9166('0x12')](function(_0x45fb6d){if(_0x45fb6d){_0x39ec92[_0x9166('0x40')][_0x9166('0x4f')]({'id':0x0,'priority':0x0,'app':_0x9166('0x50'),'appdata':_0x45fb6d[_0x9166('0x4e')]+','+(_0x39ec92[_0x9166('0x3a')][_0x9166('0x51')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x9166('0x52'),_0x39ec92);});}return respondWithRpcPromise('Start',_0x9166('0x52'),_0x39ec92);})[_0x9166('0x12')](function(_0x14a2b8){_0x437bad(_0x14a2b8);})[_0x9166('0x1b')](function(_0xebe9db){_0x1d9b45(_0x31d781[_0x9166('0x17')](0x1f4,_0xebe9db['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 16e36ef..9526343 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 _0x4137=['emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x210ca0,_0x1b6d00){var _0x1a3f9b=function(_0x54635e){while(--_0x54635e){_0x210ca0['push'](_0x210ca0['shift']());}};_0x1a3f9b(++_0x1b6d00);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var FaxAccountEvents=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(){FaxAccountEvents[_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);FaxAccountEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0x7b84=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0x7b84,0x17c));var _0x47b8=function(_0x3e8870,_0x5e54a8){_0x3e8870=_0x3e8870-0x0;var _0x17831f=_0x7b84[_0x3e8870];return _0x17831f;};'use strict';var FaxAccountEvents=require(_0x47b8('0x0'));var events=[_0x47b8('0x1'),_0x47b8('0x2'),_0x47b8('0x3')];function createListener(_0x6ead7f,_0x2b2f24){return function(_0x2d3031){_0x2b2f24['emit'](_0x6ead7f,_0x2d3031);};}function removeListener(_0x445a5f,_0x1fa41a){return function(){FaxAccountEvents[_0x47b8('0x4')](_0x445a5f,_0x1fa41a);};}exports[_0x47b8('0x5')]=function(_0x2e6853){for(var _0xafe88a=0x0,_0x53e656=events[_0x47b8('0x6')];_0xafe88a<_0x53e656;_0xafe88a++){var _0x3ce846=events[_0xafe88a];var _0x46245a=createListener(_0x47b8('0x7')+_0x3ce846,_0x2e6853);FaxAccountEvents['on'](_0x3ce846,_0x46245a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e77805b..1b570e7 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 _0xbec8=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','put','update','delete','removeAnswers'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xbec8,0x79));var _0x8bec=function(_0x36211c,_0x178508){_0x36211c=_0x36211c-0x0;var _0xd2487b=_0xbec8[_0x36211c];return _0xd2487b;};'use strict';var multer=require(_0x8bec('0x0'));var util=require(_0x8bec('0x1'));var path=require(_0x8bec('0x2'));var timeout=require(_0x8bec('0x3'));var express=require(_0x8bec('0x4'));var router=express[_0x8bec('0x5')]();var auth=require(_0x8bec('0x6'));var interaction=require(_0x8bec('0x7'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x8bec('0x8')]('/',auth[_0x8bec('0x9')](),controller['index']);router[_0x8bec('0x8')](_0x8bec('0xa'),auth[_0x8bec('0x9')](),controller[_0x8bec('0xb')]);router[_0x8bec('0x8')](_0x8bec('0xc'),auth['isAuthenticated'](),controller[_0x8bec('0xd')]);router['get'](_0x8bec('0xe'),auth[_0x8bec('0x9')](),controller[_0x8bec('0xf')]);router[_0x8bec('0x8')](_0x8bec('0x10'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x11')]);router[_0x8bec('0x8')](_0x8bec('0x12'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x13')]);router['get']('/:id/applications',auth[_0x8bec('0x9')](),controller[_0x8bec('0x14')]);router[_0x8bec('0x8')](_0x8bec('0x15'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x16')]);router[_0x8bec('0x8')](_0x8bec('0x17'),auth['isAuthenticated'](),controller[_0x8bec('0x18')]);router[_0x8bec('0x19')]('/',auth[_0x8bec('0x9')](),controller['create']);router[_0x8bec('0x19')](_0x8bec('0xe'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x1a')]);router[_0x8bec('0x19')](_0x8bec('0x10'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x1b')]);router[_0x8bec('0x19')](_0x8bec('0x12'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x1c')]);router[_0x8bec('0x19')](_0x8bec('0x1d'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x1e')]);router[_0x8bec('0x19')](_0x8bec('0x1f'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x20')]);router[_0x8bec('0x19')](_0x8bec('0x21'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x8bec('0x22')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x8bec('0x23')](_0x8bec('0xc'),auth[_0x8bec('0x9')](),controller[_0x8bec('0x24')]);router['delete'](_0x8bec('0xc'),auth[_0x8bec('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x8bec('0x9')](),controller['removeDispositions']);router[_0x8bec('0x25')]('/:id/canned_answers',auth[_0x8bec('0x9')](),controller[_0x8bec('0x26')]);router[_0x8bec('0x25')](_0x8bec('0x17'),auth[_0x8bec('0x9')](),controller['removeAgents']);module[_0x8bec('0x27')]=router; \ No newline at end of file +var _0x6f9c=['getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeAgents','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6f9c,0x86));var _0xc6f9=function(_0x10beb8,_0x2c56a7){_0x10beb8=_0x10beb8-0x0;var _0x4b40e5=_0x6f9c[_0x10beb8];return _0x4b40e5;};'use strict';var multer=require(_0xc6f9('0x0'));var util=require(_0xc6f9('0x1'));var path=require('path');var timeout=require(_0xc6f9('0x2'));var express=require('express');var router=express[_0xc6f9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6f9('0x4'));var config=require(_0xc6f9('0x5'));var controller=require(_0xc6f9('0x6'));router[_0xc6f9('0x7')]('/',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x9')]);router[_0xc6f9('0x7')]('/describe',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0xa')]);router['get'](_0xc6f9('0xb'),auth['isAuthenticated'](),controller[_0xc6f9('0xc')]);router[_0xc6f9('0x7')](_0xc6f9('0xd'),auth['isAuthenticated'](),controller[_0xc6f9('0xe')]);router['get'](_0xc6f9('0xf'),auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x10')]);router['get'](_0xc6f9('0x11'),auth[_0xc6f9('0x8')](),controller['getInteractions']);router[_0xc6f9('0x7')]('/:id/applications',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x12')]);router['get'](_0xc6f9('0x13'),auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x14')]);router[_0xc6f9('0x7')](_0xc6f9('0x15'),auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x16')]);router[_0xc6f9('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc6f9('0x17')](_0xc6f9('0xd'),auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x18')]);router[_0xc6f9('0x17')](_0xc6f9('0xf'),auth[_0xc6f9('0x8')](),controller['addAnswer']);router[_0xc6f9('0x17')]('/:id/interactions',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x19')]);router['post'](_0xc6f9('0x1a'),auth['isAuthenticated'](),controller[_0xc6f9('0x1b')]);router[_0xc6f9('0x17')](_0xc6f9('0x1c'),auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x1d')]);router['post']('/updateaccountapplications',auth[_0xc6f9('0x8')](),controller['updateAccountApplications']);router[_0xc6f9('0x17')](_0xc6f9('0x1e'),auth['isAuthenticated'](),controller[_0xc6f9('0x1f')]);router[_0xc6f9('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xc6f9('0x20')]);router[_0xc6f9('0x21')]('/:id',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x22')]);router[_0xc6f9('0x23')]('/:id',auth[_0xc6f9('0x8')](),controller['destroy']);router[_0xc6f9('0x23')](_0xc6f9('0xd'),auth[_0xc6f9('0x8')](),controller['removeDispositions']);router[_0xc6f9('0x23')]('/:id/canned_answers',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x24')]);router['delete']('/:id/users',auth[_0xc6f9('0x8')](),controller[_0xc6f9('0x25')]);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 88c7d41..f92aea4 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 _0x15a4=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x27b083,_0x99d631){var _0x44e889=function(_0x41cfb1){while(--_0x41cfb1){_0x27b083['push'](_0x27b083['shift']());}};_0x44e889(++_0x99d631);}(_0x15a4,0x178));var _0x415a=function(_0x2dfaed,_0x39a144){_0x2dfaed=_0x2dfaed-0x0;var _0x3d2a5c=_0x15a4[_0x2dfaed];return _0x3d2a5c;};'use strict';var Sequelize=require(_0x415a('0x0'));module[_0x415a('0x1')]={'priority':{'type':Sequelize[_0x415a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x415a('0x3')],'allowNull':![],'defaultValue':_0x415a('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x415a('0x3')]},'interval':{'type':Sequelize[_0x415a('0x3')],'defaultValue':_0x415a('0x5')}}; \ No newline at end of file +var _0x01d9=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'priority':{'type':Sequelize[_0x901d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x901d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x901d('0x4')]()},'description':{'type':Sequelize[_0x901d('0x3')]},'interval':{'type':Sequelize[_0x901d('0x3')],'defaultValue':_0x901d('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4591753..e0ec72d 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 _0x0bb9=['create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','findAll','rows','catch','show','includeAll','include','find'];(function(_0x27e5b4,_0x931a6d){var _0x44129b=function(_0xcc4c05){while(--_0xcc4c05){_0x27e5b4['push'](_0x27e5b4['shift']());}};_0x44129b(++_0x931a6d);}(_0x0bb9,0xea));var _0x90bb=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0bb9[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0x90bb('0x0'));var emlformat=require(_0x90bb('0x1'));var rimraf=require(_0x90bb('0x2'));var zipdir=require(_0x90bb('0x3'));var jsonpatch=require(_0x90bb('0x4'));var rp=require(_0x90bb('0x5'));var moment=require(_0x90bb('0x6'));var BPromise=require(_0x90bb('0x7'));var Mustache=require(_0x90bb('0x8'));var util=require(_0x90bb('0x9'));var path=require(_0x90bb('0xa'));var sox=require(_0x90bb('0xb'));var csv=require(_0x90bb('0xc'));var ejs=require(_0x90bb('0xd'));var fs=require('fs');var _=require(_0x90bb('0xe'));var squel=require(_0x90bb('0xf'));var crypto=require(_0x90bb('0x10'));var jsforce=require(_0x90bb('0x11'));var deskjs=require(_0x90bb('0x12'));var toCsv=require('to-csv');var querystring=require(_0x90bb('0x13'));var Papa=require('papaparse');var Redis=require(_0x90bb('0x14'));var authService=require(_0x90bb('0x15'));var qs=require(_0x90bb('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90bb('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x90bb('0x18'));var config=require(_0x90bb('0x19'));var licenseUtil=require(_0x90bb('0x1a'));var db=require(_0x90bb('0x1b'))['db'];function respondWithStatusCode(_0x51c7a6,_0x43e5b9){_0x43e5b9=_0x43e5b9||0xcc;return function(_0x291bb9){if(_0x291bb9){return _0x51c7a6[_0x90bb('0x1c')](_0x43e5b9);}return _0x51c7a6['status'](_0x43e5b9)[_0x90bb('0x1d')]();};}function respondWithResult(_0x4aa930,_0x206539){_0x206539=_0x206539||0xc8;return function(_0x245a30){if(_0x245a30){return _0x4aa930['status'](_0x206539)[_0x90bb('0x1e')](_0x245a30);}};}function respondWithFilteredResult(_0x31d4bd,_0xaa22a6){return function(_0x4b98dc){if(_0x4b98dc){var _0x139f70=_0x4b98dc[_0x90bb('0x1f')],_0x478b85=_0xaa22a6[_0x90bb('0x20')],_0x3ff8ec=_0xaa22a6[_0x90bb('0x20')]+_0xaa22a6[_0x90bb('0x21')],_0x387f91;if(_0x3ff8ec>=_0x139f70){_0x3ff8ec=_0x139f70;_0x387f91=0xc8;}else{_0x387f91=0xce;}_0x31d4bd[_0x90bb('0x22')](_0x387f91);return _0x31d4bd['set']('Content-Range',_0x478b85+'-'+_0x3ff8ec+'/'+_0x139f70)[_0x90bb('0x1e')](_0x4b98dc);}return null;};}function patchUpdates(_0x2e8535){return function(_0x1b561a){try{jsonpatch['apply'](_0x1b561a,_0x2e8535,!![]);}catch(_0x5508f2){return BPromise[_0x90bb('0x23')](_0x5508f2);}return _0x1b561a[_0x90bb('0x24')]();};}function saveUpdates(_0xdbbb6a,_0x1a1008){return function(_0xe88200){if(_0xe88200){return _0xe88200[_0x90bb('0x25')](_0xdbbb6a)[_0x90bb('0x26')](function(_0x1286c3){return _0x1286c3;});}return null;};}function removeEntity(_0x21e314,_0xda8603){return function(_0x5862da){if(_0x5862da){return _0x5862da[_0x90bb('0x27')]()[_0x90bb('0x26')](function(){_0x21e314[_0x90bb('0x22')](0xcc)[_0x90bb('0x1d')]();});}};}function handleEntityNotFound(_0x19632e,_0xf95f17){return function(_0x8db666){if(!_0x8db666){_0x19632e[_0x90bb('0x1c')](0x194);}return _0x8db666;};}function handleError(_0x5bfef,_0xd99bec){_0xd99bec=_0xd99bec||0x1f4;return function(_0x3ad914){logger[_0x90bb('0x28')](_0x3ad914[_0x90bb('0x29')]);if(_0x3ad914[_0x90bb('0x2a')]){delete _0x3ad914[_0x90bb('0x2a')];}_0x5bfef[_0x90bb('0x22')](_0xd99bec)[_0x90bb('0x2b')](_0x3ad914);};}exports[_0x90bb('0x2c')]=function(_0x1eb4af,_0x3c5260){var _0x5c9deb={},_0x5c05c8={},_0x2e2a78={'count':0x0,'rows':[]};var _0x2282bd=_[_0x90bb('0x2d')](db[_0x90bb('0x2e')][_0x90bb('0x2f')],function(_0x3418d0){return{'name':_0x3418d0[_0x90bb('0x30')],'type':_0x3418d0['type'][_0x90bb('0x31')]};});_0x5c05c8[_0x90bb('0x32')]=_[_0x90bb('0x2d')](_0x2282bd,_0x90bb('0x2a'));_0x5c05c8[_0x90bb('0x33')]=_[_0x90bb('0x34')](_0x1eb4af[_0x90bb('0x33')]);_0x5c05c8[_0x90bb('0x35')]=_[_0x90bb('0x36')](_0x5c05c8[_0x90bb('0x32')],_0x5c05c8[_0x90bb('0x33')]);_0x5c9deb['attributes']=_[_0x90bb('0x36')](_0x5c05c8[_0x90bb('0x32')],qs['fields'](_0x1eb4af[_0x90bb('0x33')][_0x90bb('0x37')]));_0x5c9deb['attributes']=_0x5c9deb[_0x90bb('0x38')][_0x90bb('0x39')]?_0x5c9deb[_0x90bb('0x38')]:_0x5c05c8[_0x90bb('0x32')];if(!_0x1eb4af[_0x90bb('0x33')][_0x90bb('0x3a')](_0x90bb('0x3b'))){_0x5c9deb[_0x90bb('0x21')]=qs['limit'](_0x1eb4af[_0x90bb('0x33')][_0x90bb('0x21')]);_0x5c9deb[_0x90bb('0x20')]=qs[_0x90bb('0x20')](_0x1eb4af[_0x90bb('0x33')][_0x90bb('0x20')]);}_0x5c9deb[_0x90bb('0x3c')]=qs[_0x90bb('0x3d')](_0x1eb4af['query']['sort']);_0x5c9deb[_0x90bb('0x3e')]=qs[_0x90bb('0x35')](_[_0x90bb('0x3f')](_0x1eb4af[_0x90bb('0x33')],_0x5c05c8[_0x90bb('0x35')]),_0x2282bd);if(_0x1eb4af[_0x90bb('0x33')]['filter']){_0x5c9deb[_0x90bb('0x3e')]=_[_0x90bb('0x40')](_0x5c9deb[_0x90bb('0x3e')],{'$or':_['map'](_0x2282bd,function(_0x1735d8){if(_0x1735d8['type']!=='VIRTUAL'){var _0x194722={};_0x194722[_0x1735d8[_0x90bb('0x2a')]]={'$like':'%'+_0x1eb4af['query'][_0x90bb('0x41')]+'%'};return _0x194722;}})});}_0x5c9deb=_[_0x90bb('0x40')]({},_0x5c9deb,_0x1eb4af[_0x90bb('0x42')]);var _0x4ff7db={'where':_0x5c9deb[_0x90bb('0x3e')]};return db[_0x90bb('0x2e')][_0x90bb('0x1f')](_0x4ff7db)[_0x90bb('0x26')](function(_0x5a11c5){_0x2e2a78[_0x90bb('0x1f')]=_0x5a11c5;if(_0x1eb4af[_0x90bb('0x33')]['includeAll']){_0x5c9deb['include']=[{'all':!![]}];}return db['FaxApplication'][_0x90bb('0x43')](_0x5c9deb);})[_0x90bb('0x26')](function(_0x2f3f6e){_0x2e2a78[_0x90bb('0x44')]=_0x2f3f6e;return _0x2e2a78;})[_0x90bb('0x26')](respondWithFilteredResult(_0x3c5260,_0x5c9deb))[_0x90bb('0x45')](handleError(_0x3c5260,null));};exports[_0x90bb('0x46')]=function(_0x59a9e6,_0x348946){var _0x8eaae6={'raw':!![],'where':{'id':_0x59a9e6['params']['id']}},_0x52a59e={};_0x52a59e[_0x90bb('0x32')]=_['keys'](db['FaxApplication'][_0x90bb('0x2f')]);_0x52a59e[_0x90bb('0x33')]=_[_0x90bb('0x34')](_0x59a9e6[_0x90bb('0x33')]);_0x52a59e[_0x90bb('0x35')]=_[_0x90bb('0x36')](_0x52a59e[_0x90bb('0x32')],_0x52a59e[_0x90bb('0x33')]);_0x8eaae6[_0x90bb('0x38')]=_[_0x90bb('0x36')](_0x52a59e[_0x90bb('0x32')],qs[_0x90bb('0x37')](_0x59a9e6[_0x90bb('0x33')]['fields']));_0x8eaae6[_0x90bb('0x38')]=_0x8eaae6[_0x90bb('0x38')][_0x90bb('0x39')]?_0x8eaae6[_0x90bb('0x38')]:_0x52a59e[_0x90bb('0x32')];if(_0x59a9e6[_0x90bb('0x33')][_0x90bb('0x47')]){_0x8eaae6[_0x90bb('0x48')]=[{'all':!![]}];}_0x8eaae6=_[_0x90bb('0x40')]({},_0x8eaae6,_0x59a9e6['options']);return db[_0x90bb('0x2e')][_0x90bb('0x49')](_0x8eaae6)['then'](handleEntityNotFound(_0x348946,null))[_0x90bb('0x26')](respondWithResult(_0x348946,null))['catch'](handleError(_0x348946,null));};exports[_0x90bb('0x4a')]=function(_0x2e5c37,_0x221e62){return db['FaxApplication'][_0x90bb('0x4a')](_0x2e5c37[_0x90bb('0x4b')],{})[_0x90bb('0x26')](respondWithResult(_0x221e62,0xc9))[_0x90bb('0x45')](handleError(_0x221e62,null));};exports['update']=function(_0xb8b0f0,_0x2c5eb8){if(_0xb8b0f0['body']['id']){delete _0xb8b0f0[_0x90bb('0x4b')]['id'];}return db[_0x90bb('0x2e')][_0x90bb('0x49')]({'where':{'id':_0xb8b0f0['params']['id']}})[_0x90bb('0x26')](handleEntityNotFound(_0x2c5eb8,null))[_0x90bb('0x26')](saveUpdates(_0xb8b0f0[_0x90bb('0x4b')],null))[_0x90bb('0x26')](respondWithResult(_0x2c5eb8,null))['catch'](handleError(_0x2c5eb8,null));};exports[_0x90bb('0x27')]=function(_0x56463b,_0xc462c1){return db[_0x90bb('0x2e')][_0x90bb('0x49')]({'where':{'id':_0x56463b[_0x90bb('0x4c')]['id']}})[_0x90bb('0x26')](handleEntityNotFound(_0xc462c1,null))[_0x90bb('0x26')](removeEntity(_0xc462c1,null))[_0x90bb('0x45')](handleError(_0xc462c1,null));}; \ No newline at end of file +var _0x71e1=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x71e1,0x1b0));var _0x171e=function(_0x3de17f,_0x5e9a64){_0x3de17f=_0x3de17f-0x0;var _0x59aaf9=_0x71e1[_0x3de17f];return _0x59aaf9;};'use strict';var pdf=require(_0x171e('0x0'));var emlformat=require(_0x171e('0x1'));var rimraf=require(_0x171e('0x2'));var zipdir=require(_0x171e('0x3'));var jsonpatch=require(_0x171e('0x4'));var rp=require(_0x171e('0x5'));var moment=require(_0x171e('0x6'));var BPromise=require(_0x171e('0x7'));var Mustache=require(_0x171e('0x8'));var util=require(_0x171e('0x9'));var path=require(_0x171e('0xa'));var sox=require(_0x171e('0xb'));var csv=require(_0x171e('0xc'));var ejs=require(_0x171e('0xd'));var fs=require('fs');var _=require(_0x171e('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x171e('0xf'));var deskjs=require(_0x171e('0x10'));var toCsv=require(_0x171e('0xc'));var querystring=require(_0x171e('0x11'));var Papa=require('papaparse');var Redis=require(_0x171e('0x12'));var authService=require(_0x171e('0x13'));var qs=require(_0x171e('0x14'));var as=require(_0x171e('0x15'));var hardwareService=require(_0x171e('0x16'));var logger=require(_0x171e('0x17'))(_0x171e('0x18'));var utils=require('../../config/utils');var config=require(_0x171e('0x19'));var licenseUtil=require(_0x171e('0x1a'));var db=require(_0x171e('0x1b'))['db'];function respondWithStatusCode(_0x2681d8,_0x563ec6){_0x563ec6=_0x563ec6||0xcc;return function(_0x368823){if(_0x368823){return _0x2681d8[_0x171e('0x1c')](_0x563ec6);}return _0x2681d8[_0x171e('0x1d')](_0x563ec6)[_0x171e('0x1e')]();};}function respondWithResult(_0x67d734,_0x5e5f5e){_0x5e5f5e=_0x5e5f5e||0xc8;return function(_0x46fdff){if(_0x46fdff){return _0x67d734['status'](_0x5e5f5e)[_0x171e('0x1f')](_0x46fdff);}};}function respondWithFilteredResult(_0x5f16c3,_0x309cc7){return function(_0x26f664){if(_0x26f664){var _0x383fed=_0x26f664[_0x171e('0x20')],_0x4f7e45=_0x309cc7[_0x171e('0x21')],_0x500910=_0x309cc7[_0x171e('0x21')]+_0x309cc7['limit'],_0x3f24e5;if(_0x500910>=_0x383fed){_0x500910=_0x383fed;_0x3f24e5=0xc8;}else{_0x3f24e5=0xce;}_0x5f16c3['status'](_0x3f24e5);return _0x5f16c3[_0x171e('0x22')](_0x171e('0x23'),_0x4f7e45+'-'+_0x500910+'/'+_0x383fed)[_0x171e('0x1f')](_0x26f664);}return null;};}function patchUpdates(_0x555497){return function(_0x153e39){try{jsonpatch[_0x171e('0x24')](_0x153e39,_0x555497,!![]);}catch(_0x123761){return BPromise[_0x171e('0x25')](_0x123761);}return _0x153e39[_0x171e('0x26')]();};}function saveUpdates(_0x4fb7da,_0x134b0e){return function(_0x1646c1){if(_0x1646c1){return _0x1646c1[_0x171e('0x27')](_0x4fb7da)[_0x171e('0x28')](function(_0x2f9864){return _0x2f9864;});}return null;};}function removeEntity(_0x5d16c7,_0x43b741){return function(_0x165f1c){if(_0x165f1c){return _0x165f1c['destroy']()[_0x171e('0x28')](function(){_0x5d16c7[_0x171e('0x1d')](0xcc)[_0x171e('0x1e')]();});}};}function handleEntityNotFound(_0x57d766,_0x6d6edd){return function(_0x3ab224){if(!_0x3ab224){_0x57d766[_0x171e('0x1c')](0x194);}return _0x3ab224;};}function handleError(_0x3b8f57,_0x4c93c9){_0x4c93c9=_0x4c93c9||0x1f4;return function(_0x271d99){logger[_0x171e('0x29')](_0x271d99[_0x171e('0x2a')]);if(_0x271d99['name']){delete _0x271d99[_0x171e('0x2b')];}_0x3b8f57[_0x171e('0x1d')](_0x4c93c9)[_0x171e('0x2c')](_0x271d99);};}exports[_0x171e('0x2d')]=function(_0x401043,_0x30745d){var _0x4da0cf={},_0x390254={},_0x22d159={'count':0x0,'rows':[]};var _0x51007c=_[_0x171e('0x2e')](db[_0x171e('0x2f')][_0x171e('0x30')],function(_0x7fd9e1){return{'name':_0x7fd9e1[_0x171e('0x31')],'type':_0x7fd9e1[_0x171e('0x32')]['key']};});_0x390254[_0x171e('0x33')]=_['map'](_0x51007c,'name');_0x390254[_0x171e('0x34')]=_[_0x171e('0x35')](_0x401043[_0x171e('0x34')]);_0x390254[_0x171e('0x36')]=_[_0x171e('0x37')](_0x390254[_0x171e('0x33')],_0x390254[_0x171e('0x34')]);_0x4da0cf[_0x171e('0x38')]=_[_0x171e('0x37')](_0x390254[_0x171e('0x33')],qs[_0x171e('0x39')](_0x401043['query']['fields']));_0x4da0cf[_0x171e('0x38')]=_0x4da0cf['attributes'][_0x171e('0x3a')]?_0x4da0cf['attributes']:_0x390254['model'];if(!_0x401043[_0x171e('0x34')][_0x171e('0x3b')](_0x171e('0x3c'))){_0x4da0cf[_0x171e('0x3d')]=qs['limit'](_0x401043[_0x171e('0x34')][_0x171e('0x3d')]);_0x4da0cf[_0x171e('0x21')]=qs[_0x171e('0x21')](_0x401043[_0x171e('0x34')]['offset']);}_0x4da0cf[_0x171e('0x3e')]=qs['sort'](_0x401043[_0x171e('0x34')][_0x171e('0x3f')]);_0x4da0cf[_0x171e('0x40')]=qs[_0x171e('0x36')](_[_0x171e('0x41')](_0x401043[_0x171e('0x34')],_0x390254[_0x171e('0x36')]),_0x51007c);if(_0x401043[_0x171e('0x34')][_0x171e('0x42')]){_0x4da0cf[_0x171e('0x40')]=_[_0x171e('0x43')](_0x4da0cf[_0x171e('0x40')],{'$or':_['map'](_0x51007c,function(_0x22e5d0){if(_0x22e5d0[_0x171e('0x32')]!=='VIRTUAL'){var _0x5e80db={};_0x5e80db[_0x22e5d0[_0x171e('0x2b')]]={'$like':'%'+_0x401043[_0x171e('0x34')][_0x171e('0x42')]+'%'};return _0x5e80db;}})});}_0x4da0cf=_['merge']({},_0x4da0cf,_0x401043[_0x171e('0x44')]);var _0x5a08a9={'where':_0x4da0cf[_0x171e('0x40')]};return db['FaxApplication'][_0x171e('0x20')](_0x5a08a9)[_0x171e('0x28')](function(_0x440a27){_0x22d159['count']=_0x440a27;if(_0x401043[_0x171e('0x34')]['includeAll']){_0x4da0cf[_0x171e('0x45')]=[{'all':!![]}];}return db[_0x171e('0x2f')][_0x171e('0x46')](_0x4da0cf);})['then'](function(_0x1bb467){_0x22d159[_0x171e('0x47')]=_0x1bb467;return _0x22d159;})['then'](respondWithFilteredResult(_0x30745d,_0x4da0cf))[_0x171e('0x48')](handleError(_0x30745d,null));};exports[_0x171e('0x49')]=function(_0x198393,_0x1f3f9e){var _0x5de701={'raw':!![],'where':{'id':_0x198393[_0x171e('0x4a')]['id']}},_0x566594={};_0x566594[_0x171e('0x33')]=_[_0x171e('0x35')](db[_0x171e('0x2f')][_0x171e('0x30')]);_0x566594[_0x171e('0x34')]=_['keys'](_0x198393['query']);_0x566594[_0x171e('0x36')]=_[_0x171e('0x37')](_0x566594[_0x171e('0x33')],_0x566594[_0x171e('0x34')]);_0x5de701[_0x171e('0x38')]=_[_0x171e('0x37')](_0x566594[_0x171e('0x33')],qs['fields'](_0x198393[_0x171e('0x34')][_0x171e('0x39')]));_0x5de701[_0x171e('0x38')]=_0x5de701[_0x171e('0x38')][_0x171e('0x3a')]?_0x5de701[_0x171e('0x38')]:_0x566594[_0x171e('0x33')];if(_0x198393[_0x171e('0x34')][_0x171e('0x4b')]){_0x5de701['include']=[{'all':!![]}];}_0x5de701=_[_0x171e('0x43')]({},_0x5de701,_0x198393['options']);return db[_0x171e('0x2f')][_0x171e('0x4c')](_0x5de701)['then'](handleEntityNotFound(_0x1f3f9e,null))[_0x171e('0x28')](respondWithResult(_0x1f3f9e,null))['catch'](handleError(_0x1f3f9e,null));};exports[_0x171e('0x4d')]=function(_0x43335a,_0x1b2116){return db['FaxApplication'][_0x171e('0x4d')](_0x43335a['body'],{})[_0x171e('0x28')](respondWithResult(_0x1b2116,0xc9))[_0x171e('0x48')](handleError(_0x1b2116,null));};exports[_0x171e('0x27')]=function(_0x5edd9c,_0x138ba3){if(_0x5edd9c[_0x171e('0x4e')]['id']){delete _0x5edd9c[_0x171e('0x4e')]['id'];}return db[_0x171e('0x2f')][_0x171e('0x4c')]({'where':{'id':_0x5edd9c[_0x171e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x138ba3,null))[_0x171e('0x28')](saveUpdates(_0x5edd9c[_0x171e('0x4e')],null))[_0x171e('0x28')](respondWithResult(_0x138ba3,null))[_0x171e('0x48')](handleError(_0x138ba3,null));};exports[_0x171e('0x4f')]=function(_0x4bb9e2,_0x34e785){return db['FaxApplication'][_0x171e('0x4c')]({'where':{'id':_0x4bb9e2[_0x171e('0x4a')]['id']}})[_0x171e('0x28')](handleEntityNotFound(_0x34e785,null))['then'](removeEntity(_0x34e785,null))['catch'](handleError(_0x34e785,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0c9335b..7c78a3e 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 _0xd9fa=['path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x507b1b,_0x1c7c37){var _0x50ae55=function(_0x56d666){while(--_0x56d666){_0x507b1b['push'](_0x507b1b['shift']());}};_0x50ae55(++_0x1c7c37);}(_0xd9fa,0x1e9));var _0xad9f=function(_0x36c7c5,_0x5a3beb){_0x36c7c5=_0x36c7c5-0x0;var _0x408aa7=_0xd9fa[_0x36c7c5];return _0x408aa7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad9f('0x0'))(_0xad9f('0x1'));var moment=require(_0xad9f('0x2'));var BPromise=require(_0xad9f('0x3'));var rp=require(_0xad9f('0x4'));var fs=require('fs');var path=require(_0xad9f('0x5'));var rimraf=require(_0xad9f('0x6'));var config=require(_0xad9f('0x7'));var attributes=require(_0xad9f('0x8'));module['exports']=function(_0x544e93,_0x353fe9){return _0x544e93[_0xad9f('0x9')](_0xad9f('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad9f('0xb'),'collate':_0xad9f('0xc')});}; \ No newline at end of file +var _0x2d59=['utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4'];(function(_0xf759f8,_0x5876d8){var _0x1c67a6=function(_0x5f29ae){while(--_0x5f29ae){_0xf759f8['push'](_0xf759f8['shift']());}};_0x1c67a6(++_0x5876d8);}(_0x2d59,0x1eb));var _0x92d5=function(_0x539e35,_0x4028a9){_0x539e35=_0x539e35-0x0;var _0x542eab=_0x2d59[_0x539e35];return _0x542eab;};'use strict';var _=require('lodash');var util=require(_0x92d5('0x0'));var logger=require('../../config/logger')(_0x92d5('0x1'));var moment=require(_0x92d5('0x2'));var BPromise=require(_0x92d5('0x3'));var rp=require(_0x92d5('0x4'));var fs=require('fs');var path=require(_0x92d5('0x5'));var rimraf=require(_0x92d5('0x6'));var config=require(_0x92d5('0x7'));var attributes=require(_0x92d5('0x8'));module[_0x92d5('0x9')]=function(_0x78a1ff,_0x9394c8){return _0x78a1ff[_0x92d5('0xa')]('FaxApplication',attributes,{'tableName':_0x92d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x92d5('0xc'),'collate':_0x92d5('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1f1825c..206191b 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 _0x6ec6=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','raw','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x100c1c,_0x3fe733){var _0x5c3d11=function(_0x2e5de7){while(--_0x2e5de7){_0x100c1c['push'](_0x100c1c['shift']());}};_0x5c3d11(++_0x3fe733);}(_0x6ec6,0x11a));var _0x66ec=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x6ec6[_0x10d34b];return _0x92b0bf;};'use strict';var _=require(_0x66ec('0x0'));var util=require(_0x66ec('0x1'));var moment=require(_0x66ec('0x2'));var BPromise=require(_0x66ec('0x3'));var rs=require(_0x66ec('0x4'));var fs=require('fs');var Redis=require(_0x66ec('0x5'));var db=require(_0x66ec('0x6'))['db'];var utils=require(_0x66ec('0x7'));var logger=require(_0x66ec('0x8'))(_0x66ec('0x9'));var config=require('../../config/environment');var jayson=require(_0x66ec('0xa'));var client=jayson[_0x66ec('0xb')][_0x66ec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x239969,_0x33121c,_0x4d3459){return new BPromise(function(_0x33193d,_0x2c47fc){return client[_0x66ec('0xd')](_0x239969,_0x4d3459)[_0x66ec('0xe')](function(_0xbcb8a0){logger[_0x66ec('0xf')](_0x66ec('0x10'),_0x33121c,_0x66ec('0x11'));logger[_0x66ec('0x12')](_0x66ec('0x13'),_0x33121c,'request\x20sent',JSON[_0x66ec('0x14')](_0xbcb8a0));if(_0xbcb8a0[_0x66ec('0x15')]){if(_0xbcb8a0[_0x66ec('0x15')][_0x66ec('0x16')]===0x1f4){logger[_0x66ec('0x15')](_0x66ec('0x10'),_0x33121c,_0xbcb8a0[_0x66ec('0x15')][_0x66ec('0x17')]);return _0x2c47fc(_0xbcb8a0[_0x66ec('0x15')][_0x66ec('0x17')]);}logger[_0x66ec('0x15')](_0x66ec('0x10'),_0x33121c,_0xbcb8a0[_0x66ec('0x15')]['message']);return _0x33193d(_0xbcb8a0[_0x66ec('0x15')][_0x66ec('0x17')]);}else{logger[_0x66ec('0xf')](_0x66ec('0x10'),_0x33121c,_0x66ec('0x11'));_0x33193d(_0xbcb8a0['result'][_0x66ec('0x17')]);}})[_0x66ec('0x18')](function(_0x237c66){logger[_0x66ec('0x15')]('FaxApplication,\x20%s,\x20%s',_0x33121c,_0x237c66);_0x2c47fc(_0x237c66);});});}exports[_0x66ec('0x19')]=function(_0x4d5ab2){var _0xcf1cc2=this;return new Promise(function(_0x20e622,_0x1761b2){return db[_0x66ec('0x1a')][_0x66ec('0x1b')](_0x4d5ab2['body'],{'raw':_0x4d5ab2['options']?_0x4d5ab2['options'][_0x66ec('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d5ab2[_0x66ec('0x1d')]?_0x4d5ab2[_0x66ec('0x1d')][_0x66ec('0x1e')]||null:null,'attributes':_0x4d5ab2['options']?_0x4d5ab2['options'][_0x66ec('0x1f')]||null:null,'limit':_0x4d5ab2[_0x66ec('0x1d')]?_0x4d5ab2['options'][_0x66ec('0x20')]||null:null})[_0x66ec('0xe')](function(_0x51c872){logger['info']('UpdateFaxApplication',_0x4d5ab2);logger[_0x66ec('0x12')]('UpdateFaxApplication',_0x4d5ab2,JSON[_0x66ec('0x14')](_0x51c872));_0x20e622(_0x51c872);})[_0x66ec('0x18')](function(_0x31bfbc){logger[_0x66ec('0x15')](_0x66ec('0x19'),_0x31bfbc[_0x66ec('0x17')],_0x4d5ab2);_0x1761b2(_0xcf1cc2[_0x66ec('0x15')](0x1f4,_0x31bfbc['message']));});});}; \ No newline at end of file +var _0xf528=['update','body','options','where','limit','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0xf373b8,_0x532194){var _0x3251c4=function(_0xc31f22){while(--_0xc31f22){_0xf373b8['push'](_0xf373b8['shift']());}};_0x3251c4(++_0x532194);}(_0xf528,0xc0));var _0x8f52=function(_0x37aae7,_0xb321fe){_0x37aae7=_0x37aae7-0x0;var _0x12464d=_0xf528[_0x37aae7];return _0x12464d;};'use strict';var _=require(_0x8f52('0x0'));var util=require(_0x8f52('0x1'));var moment=require('moment');var BPromise=require(_0x8f52('0x2'));var rs=require(_0x8f52('0x3'));var fs=require('fs');var Redis=require(_0x8f52('0x4'));var db=require(_0x8f52('0x5'))['db'];var utils=require(_0x8f52('0x6'));var logger=require('../../config/logger')(_0x8f52('0x7'));var config=require(_0x8f52('0x8'));var jayson=require(_0x8f52('0x9'));var client=jayson[_0x8f52('0xa')][_0x8f52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de0f4,_0x5e194f,_0x4130ce){return new BPromise(function(_0x2de888,_0x24f753){return client[_0x8f52('0xc')](_0x2de0f4,_0x4130ce)['then'](function(_0x16f030){logger[_0x8f52('0xd')](_0x8f52('0xe'),_0x5e194f,_0x8f52('0xf'));logger[_0x8f52('0x10')](_0x8f52('0x11'),_0x5e194f,'request\x20sent',JSON[_0x8f52('0x12')](_0x16f030));if(_0x16f030[_0x8f52('0x13')]){if(_0x16f030[_0x8f52('0x13')]['code']===0x1f4){logger[_0x8f52('0x13')](_0x8f52('0xe'),_0x5e194f,_0x16f030['error'][_0x8f52('0x14')]);return _0x24f753(_0x16f030['error'][_0x8f52('0x14')]);}logger[_0x8f52('0x13')](_0x8f52('0xe'),_0x5e194f,_0x16f030[_0x8f52('0x13')][_0x8f52('0x14')]);return _0x2de888(_0x16f030['error'][_0x8f52('0x14')]);}else{logger[_0x8f52('0xd')]('FaxApplication,\x20%s,\x20%s',_0x5e194f,'request\x20sent');_0x2de888(_0x16f030[_0x8f52('0x15')]['message']);}})[_0x8f52('0x16')](function(_0x5e3a63){logger['error'](_0x8f52('0xe'),_0x5e194f,_0x5e3a63);_0x24f753(_0x5e3a63);});});}exports[_0x8f52('0x17')]=function(_0x155200){var _0x56c9fd=this;return new Promise(function(_0x299a55,_0x53e404){return db[_0x8f52('0x18')][_0x8f52('0x19')](_0x155200[_0x8f52('0x1a')],{'raw':_0x155200['options']?_0x155200[_0x8f52('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x155200[_0x8f52('0x1b')]?_0x155200[_0x8f52('0x1b')][_0x8f52('0x1c')]||null:null,'attributes':_0x155200['options']?_0x155200[_0x8f52('0x1b')]['attributes']||null:null,'limit':_0x155200[_0x8f52('0x1b')]?_0x155200[_0x8f52('0x1b')][_0x8f52('0x1d')]||null:null})[_0x8f52('0x1e')](function(_0x3b14ec){logger[_0x8f52('0xd')](_0x8f52('0x17'),_0x155200);logger[_0x8f52('0x10')](_0x8f52('0x17'),_0x155200,JSON['stringify'](_0x3b14ec));_0x299a55(_0x3b14ec);})[_0x8f52('0x16')](function(_0x5bc822){logger['error'](_0x8f52('0x17'),_0x5bc822['message'],_0x155200);_0x53e404(_0x56c9fd[_0x8f52('0x13')](0x1f4,_0x5bc822[_0x8f52('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index da28d4f..78396d7 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 _0xafc4=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','update','exports'];(function(_0x421c43,_0x359f3b){var _0x1f2f5c=function(_0x3513e5){while(--_0x3513e5){_0x421c43['push'](_0x421c43['shift']());}};_0x1f2f5c(++_0x359f3b);}(_0xafc4,0x69));var _0x4afc=function(_0x5735dc,_0x388663){_0x5735dc=_0x5735dc-0x0;var _0x580fb0=_0xafc4[_0x5735dc];return _0x580fb0;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['post']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xd')]);router['delete']('/:id',auth[_0x4afc('0x6')](),controller['destroy']);module[_0x4afc('0xe')]=router; \ No newline at end of file +var _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x53ec,0x192));var _0xc53e=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x53ec[_0x2f48cd];return _0x193ae2;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('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 84d815e..355dac3 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 _0x6921=['exports','DATE','STRING','ENUM','out'];(function(_0x366b02,_0x795a5b){var _0x35b02f=function(_0xec5018){while(--_0xec5018){_0x366b02['push'](_0x366b02['shift']());}};_0x35b02f(++_0x795a5b);}(_0x6921,0x1d1));var _0x1692=function(_0x2b749a,_0x211ebf){_0x2b749a=_0x2b749a-0x0;var _0x28b3ce=_0x6921[_0x2b749a];return _0x28b3ce;};'use strict';var Sequelize=require('sequelize');module[_0x1692('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1692('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1692('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1692('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1692('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1692('0x3')]('in',_0x1692('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1692('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x1692('0x3')]('in',_0x1692('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb717=['STRING','DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x513ca3,_0x18629c){var _0x1d9d0b=function(_0x1fda55){while(--_0x1fda55){_0x513ca3['push'](_0x513ca3['shift']());}};_0x1d9d0b(++_0x18629c);}(_0xb717,0x1b4));var _0x7b71=function(_0x4d8217,_0x43f574){_0x4d8217=_0x4d8217-0x0;var _0x129569=_0xb717[_0x4d8217];return _0x129569;};'use strict';var Sequelize=require(_0x7b71('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7b71('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7b71('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b71('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b71('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7b71('0x3')]},'fax':{'type':Sequelize[_0x7b71('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7b71('0x4')]('in',_0x7b71('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7b71('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b71('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index d2a1fab..e0ce65e 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 _0xa75b=['fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','u.id','u.fullname','user_has_fax_interactions','users','select','from','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','body','text','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','includeAll','include','create','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','findAll','color','emit','faxInteractionTags:save','unix','server','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','log','err','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','query','keys','model','attributes','intersection'];(function(_0x142258,_0x144266){var _0x6d4b78=function(_0x2c509a){while(--_0x2c509a){_0x142258['push'](_0x142258['shift']());}};_0x6d4b78(++_0x144266);}(_0xa75b,0x170));var _0xba75=function(_0x154e0d,_0x1ab40c){_0x154e0d=_0x154e0d-0x0;var _0x4b9042=_0xa75b[_0x154e0d];return _0x4b9042;};'use strict';var pdf=require(_0xba75('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba75('0x1'));var jsonpatch=require(_0xba75('0x2'));var rp=require(_0xba75('0x3'));var moment=require(_0xba75('0x4'));var BPromise=require(_0xba75('0x5'));var Mustache=require(_0xba75('0x6'));var util=require(_0xba75('0x7'));var path=require(_0xba75('0x8'));var sox=require(_0xba75('0x9'));var csv=require(_0xba75('0xa'));var ejs=require(_0xba75('0xb'));var fs=require('fs');var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];config[_0xba75('0x1a')]=_[_0xba75('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba75('0x1c'))(new Redis(config['redis']));require(_0xba75('0x1d'))[_0xba75('0x1e')](socket);function respondWithStatusCode(_0xa27f76,_0x383b1e){_0x383b1e=_0x383b1e||0xcc;return function(_0x4c4a0b){if(_0x4c4a0b){return _0xa27f76[_0xba75('0x1f')](_0x383b1e);}return _0xa27f76[_0xba75('0x20')](_0x383b1e)[_0xba75('0x21')]();};}function respondWithResult(_0x4028f9,_0x41c9e5){_0x41c9e5=_0x41c9e5||0xc8;return function(_0x51112b){if(_0x51112b){return _0x4028f9[_0xba75('0x20')](_0x41c9e5)[_0xba75('0x22')](_0x51112b);}};}function respondWithFilteredResult(_0x14bd83,_0x47be93){return function(_0x2822af){if(_0x2822af){var _0xd8850f=_0x2822af[_0xba75('0x23')],_0xc4bf17=_0x47be93['offset'],_0x132750=_0x47be93[_0xba75('0x24')]+_0x47be93[_0xba75('0x25')],_0x30d1ab;if(_0x132750>=_0xd8850f){_0x132750=_0xd8850f;_0x30d1ab=0xc8;}else{_0x30d1ab=0xce;}_0x14bd83['status'](_0x30d1ab);return _0x14bd83['set'](_0xba75('0x26'),_0xc4bf17+'-'+_0x132750+'/'+_0xd8850f)[_0xba75('0x22')](_0x2822af);}return null;};}function patchUpdates(_0x496cfc){return function(_0x48206c){try{jsonpatch[_0xba75('0x27')](_0x48206c,_0x496cfc,!![]);}catch(_0x4e79a9){return BPromise[_0xba75('0x28')](_0x4e79a9);}return _0x48206c[_0xba75('0x29')]();};}function saveUpdates(_0x19b2d7,_0x4efad7){return function(_0x458475){if(_0x458475){return _0x458475[_0xba75('0x2a')](_0x19b2d7)[_0xba75('0x2b')](function(_0x3e9bd9){return _0x3e9bd9;});}return null;};}function removeEntity(_0x14c54b,_0x29b14c){return function(_0x4e5502){if(_0x4e5502){return _0x4e5502[_0xba75('0x2c')]()[_0xba75('0x2b')](function(){_0x14c54b[_0xba75('0x20')](0xcc)[_0xba75('0x21')]();});}};}function handleEntityNotFound(_0x1caa6,_0x44b1d4){return function(_0x26dd53){if(!_0x26dd53){_0x1caa6[_0xba75('0x1f')](0x194);}return _0x26dd53;};}function handleError(_0x35c571,_0x155c74){_0x155c74=_0x155c74||0x1f4;return function(_0x47ddff){logger['error'](_0x47ddff['stack']);if(_0x47ddff[_0xba75('0x2d')]){delete _0x47ddff['name'];}_0x35c571[_0xba75('0x20')](_0x155c74)['send'](_0x47ddff);};}function getInteractionUsers(_0x15b5bc,_0x1afc1f){return new BPromise(function(_0x20ac78,_0x4edc2e){try{if(_0x1afc1f[_0x15b5bc['id']]){_0x15b5bc[_0xba75('0x2e')]=_[_0xba75('0x2f')](_0x1afc1f[_0x15b5bc['id']],function(_0x8a2e4d){return{'id':_0x8a2e4d['id'],'fullname':_0x8a2e4d[_0xba75('0x30')]};});}}catch(_0x5d9f78){_0x4edc2e(_0x5d9f78);}_0x20ac78(_0x15b5bc);});}function getInteractionTags(_0x4791a5,_0x200715){return new BPromise(function(_0x481a04,_0x5a85ee){try{if(_0x4791a5[_0xba75('0x31')]){_0x4791a5[_0xba75('0x32')]=[];_0x4791a5[_0xba75('0x31')]['split'](',')[_0xba75('0x33')](function(_0x222d98){_0x4791a5['Tags'][_0xba75('0x34')](_0x200715[_0x222d98]);});}delete _0x4791a5[_0xba75('0x31')];}catch(_0x3930){_0x5a85ee(_0x3930);}_0x481a04(_0x4791a5);});}function updateFaxInteraction(_0x2e6680,_0x4ee68d,_0x75f87a){return new BPromise(function(_0x3a1610,_0x483db2){return getInteractionUsers(_0x2e6680,_0x75f87a)[_0xba75('0x2b')](function(_0x6ea4fc){return getInteractionTags(_0x6ea4fc,_0x4ee68d);})[_0xba75('0x2b')](function(_0x5a97d7){_0x3a1610(_0x5a97d7);})[_0xba75('0x35')](function(_0x282f98){_0x483db2(_0x282f98);});});}exports[_0xba75('0x36')]=function(_0x381cb,_0x5e3c8c){var _0xe5f817={},_0x3d8453={},_0x4c9fb2={'count':0x0,'rows':[]};var _0x55e9ed=_[_0xba75('0x2f')](db[_0xba75('0x37')][_0xba75('0x38')],function(_0x5c6f1a){return{'name':_0x5c6f1a[_0xba75('0x39')],'type':_0x5c6f1a[_0xba75('0x3a')]['key']};});_0x3d8453['model']=_[_0xba75('0x2f')](_0x55e9ed,_0xba75('0x2d'));_0x3d8453[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x381cb[_0xba75('0x3b')]);_0x3d8453['filters']=_['intersection'](_0x3d8453[_0xba75('0x3d')],_0x3d8453[_0xba75('0x3b')]);_0xe5f817[_0xba75('0x3e')]=_[_0xba75('0x3f')](_0x3d8453[_0xba75('0x3d')],qs[_0xba75('0x40')](_0x381cb[_0xba75('0x3b')]['fields']));_0xe5f817[_0xba75('0x3e')]=_0xe5f817[_0xba75('0x3e')]['length']?_0xe5f817[_0xba75('0x3e')]:_0x3d8453[_0xba75('0x3d')];if(!_0x381cb[_0xba75('0x3b')][_0xba75('0x41')](_0xba75('0x42'))){_0xe5f817[_0xba75('0x25')]=qs[_0xba75('0x25')](_0x381cb['query'][_0xba75('0x25')]);_0xe5f817['offset']=qs[_0xba75('0x24')](_0x381cb['query'][_0xba75('0x24')]);}_0xe5f817[_0xba75('0x43')]=qs[_0xba75('0x44')](_0x381cb[_0xba75('0x3b')][_0xba75('0x44')]);_0xe5f817[_0xba75('0x45')]=qs[_0xba75('0x46')](_[_0xba75('0x47')](_0x381cb[_0xba75('0x3b')],_0x3d8453['filters']),_0x55e9ed);var _0x30b5f0=[];var _0x8d9eae=squel['select']()[_0xba75('0x48')]('id')[_0xba75('0x48')](_0xba75('0x2d'))['field']('color')['from']('tools_tags');var _0x1717fa=squel['select']()[_0xba75('0x48')](_0xba75('0x49'))[_0xba75('0x48')](_0xba75('0x4a'))[_0xba75('0x48')]('ui.FaxInteractionId')['from'](_0xba75('0x4b'),'ui')['left_join'](_0xba75('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x3ac538=squel[_0xba75('0x4d')]()[_0xba75('0x4e')](_0xba75('0x4f'),'i')['left_join'](_0xba75('0x50'),'c',_0xba75('0x51'))[_0xba75('0x52')](_0xba75('0x4c'),'o',_0xba75('0x53'))[_0xba75('0x52')](_0xba75('0x54'),'a',_0xba75('0x55'))['left_join'](_0xba75('0x56'),'me',_0xba75('0x57'))[_0xba75('0x52')](_0xba75('0x58'),'it',_0xba75('0x59'))['left_join'](_0xba75('0x5a'),'t',_0xba75('0x5b'));var _0x1ca578=squel[_0xba75('0x5c')]();var _0x174abe=[];var _0x36ef8f=squel[_0xba75('0x5c')]();var _0x5dc5f8;if(_0x381cb[_0xba75('0x3b')][_0xba75('0x5d')]){_0x5dc5f8=as[_0xba75('0x5e')](_0x381cb['query'][_0xba75('0x5d')]);var _0x29b4fc=_0x5dc5f8['sqlOperator'];for(var _0x4d7e7e=0x0;_0x4d7e7e<_0x5dc5f8[_0xba75('0x5f')]['length'];_0x4d7e7e++){var _0x49a4df=_0x5dc5f8[_0xba75('0x5f')][_0x4d7e7e];var _0x531cd7='i';var _0xbb87b9=_[_0xba75('0x60')](_0x55e9ed,[_0xba75('0x2d'),_0x49a4df[_0xba75('0x48')]]);if(!_0xbb87b9){switch(_0x49a4df[_0xba75('0x48')]){case'unreadMessages':if(_0x49a4df[_0xba75('0x61')]==0x1){_0x3ac538[_0xba75('0x62')]('`'+_0x49a4df['field']+_0xba75('0x63'));}else{_0x3ac538[_0xba75('0x62')]('`'+_0x49a4df[_0xba75('0x48')]+_0xba75('0x64'));}break;case _0xba75('0x65'):if(_0x49a4df['operator']===_0xba75('0x66')){if(_0x49a4df[_0xba75('0x61')]['split']('\x20')[_0xba75('0x67')]>0x1){_0x1ca578[_0x29b4fc](_0xba75('0x68'),qs[_0xba75('0x69')](_0x49a4df[_0xba75('0x61')]),null);}else{var _0x4045a3='%'+_0x49a4df[_0xba75('0x61')]+'%';_0x1ca578[_0x29b4fc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4045a3,_0x4045a3,_0x4045a3);}}else{_0xbb87b9=_[_0xba75('0x60')](_0x55e9ed,[_0xba75('0x2d'),_0xba75('0x6a')]);_0x49a4df[_0xba75('0x48')]=_0xba75('0x6a');_0x32e2ae=as[_0xba75('0x6b')](_0x531cd7,_0xbb87b9['type'],_0x49a4df);_0x1ca578[_0x29b4fc](_0x32e2ae['text'],_0x32e2ae['value']['start'],_0x32e2ae[_0xba75('0x61')][_0xba75('0x21')]);}break;case _0xba75('0x6c'):var _0x11bfcb=_0x49a4df[_0xba75('0x61')][_0xba75('0x6d')](',')[_0xba75('0x2f')](function(_0x5cfedd){return Number(_0x5cfedd);});_0x11bfcb[_0xba75('0x33')](function(_0x1e7500){_0x36ef8f['or'](_0xba75('0x6e'),'%,'+_0x1e7500+',%');});_0x174abe=_[_0xba75('0x6f')](_0x174abe,_0x11bfcb);break;case'User':if(_0x49a4df[_0xba75('0x70')]===_0xba75('0x66')){_0x1ca578[_0x29b4fc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x49a4df[_0xba75('0x61')]+'%',null);}else{_0xbb87b9=_['find'](_0x55e9ed,[_0xba75('0x2d'),_0xba75('0x71')]);_0x49a4df['field']=_0xba75('0x71');_0x32e2ae=as[_0xba75('0x6b')](_0x531cd7,_0xbb87b9['type'],_0x49a4df);_0x1ca578[_0x29b4fc](_0x32e2ae['text'],_0x32e2ae[_0xba75('0x61')]['start'],_0x32e2ae[_0xba75('0x61')]['end']);}break;case _0xba75('0x72'):_0x32e2ae=as[_0xba75('0x6b')]('me',null,_0x49a4df);_0x1ca578[_0x29b4fc](_0x32e2ae[_0xba75('0x73')],_0x32e2ae[_0xba75('0x61')][_0xba75('0x74')],_0x32e2ae['value'][_0xba75('0x21')]);break;}}else{var _0x32e2ae=as['buildExpression'](_0x531cd7,_0xbb87b9[_0xba75('0x3a')],_0x49a4df);_0x1ca578[_0x29b4fc](_0x32e2ae[_0xba75('0x73')],_0x32e2ae[_0xba75('0x61')][_0xba75('0x74')],_0x32e2ae[_0xba75('0x61')][_0xba75('0x21')]);}}}else{var _0x3b2dbb=_(_0x381cb[_0xba75('0x3b')])[_0xba75('0x3c')]()[_0xba75('0x2f')](function(_0xa0a92){return _[_0xba75('0x75')](_0x55e9ed,['name',_0xa0a92])?_0xa0a92:undefined;})['compact']()[_0xba75('0x61')]();if(!_[_0xba75('0x76')](_0x3b2dbb)){_0x3b2dbb[_0xba75('0x33')](function(_0x441462){if(_0x441462===_0xba75('0x77')){_0x3ac538[_0xba75('0x45')](_0xba75('0x78'),[][_0xba75('0x79')](_0x381cb[_0xba75('0x3b')][_0x441462]));}else if(_0x441462===_0xba75('0x7a')){var _0x2b686e=JSON['parse'](_0x381cb[_0xba75('0x3b')][_0x441462])['$gte'];var _0x7a722d=JSON[_0xba75('0x7b')](_0x381cb[_0xba75('0x3b')][_0x441462])[_0xba75('0x7c')];_0x3ac538[_0xba75('0x45')](_0xba75('0x7d'),_0x2b686e,_0x7a722d);}else{if(_0x381cb['query'][_0x441462]===_0xba75('0x7e')){_0x3ac538['where']('i.'+_0x441462+_0xba75('0x7f'));}else{_0x3ac538[_0xba75('0x45')]('i.'+_0x441462+'\x20=\x20?',_0x381cb['query'][_0x441462]);}}});}if(_0x381cb[_0xba75('0x3b')][_0xba75('0x80')]){if(_0x381cb[_0xba75('0x3b')][_0xba75('0x80')]==0x1){_0x3ac538[_0xba75('0x62')](_0xba75('0x81'));}else{_0x3ac538['having'](_0xba75('0x82'));}}if(_0x381cb[_0xba75('0x3b')]['tag']){_0x174abe=_[_0xba75('0x83')](_0x381cb[_0xba75('0x3b')][_0xba75('0x84')])?_0x381cb[_0xba75('0x3b')][_0xba75('0x84')]:new Array(_0x381cb['query'][_0xba75('0x84')]);_0x174abe['forEach'](function(_0xaaeef1){_0x36ef8f['or'](_0xba75('0x6e'),'%,'+_0xaaeef1+',%');});}if(_0x381cb[_0xba75('0x3b')][_0xba75('0x85')]){var _0x67446f=_0x381cb[_0xba75('0x3b')]['filter']['replace']('\x5c','\x5c\x5c')[_0xba75('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x67446f)){_0x1ca578['or'](_0xba75('0x87'),_0x67446f+'%')['or'](_0xba75('0x88'),_0x67446f+'%');}_0x1ca578['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x67446f+'%');}}_0x3ac538[_0xba75('0x45')](_0x1ca578);_0x3ac538[_0xba75('0x89')](_0xba75('0x8a'));var _0x4c6aa8={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x58e3bb=_0x3ac538[_0xba75('0x8b')]();_0x58e3bb['field'](_0xba75('0x8a'));_0x58e3bb[_0xba75('0x48')](_0xba75('0x8c'),_0xba75('0x8d'));if(_0xe5f817[_0xba75('0x43')]){_0xe5f817[_0xba75('0x43')][_0xba75('0x33')](function(_0x482033){var _0x4f7fe5=_0x482033[0x0]===_0xba75('0x8e')?_0x482033[0x0]:'i.'+_0x482033[0x0];_0x3ac538[_0xba75('0x43')](_0x4f7fe5,_0x482033[0x1]==='DESC'?![]:!![]);});}if(!_[_0xba75('0x76')](_0x174abe)){_0x3ac538['having'](_0x36ef8f);_0x58e3bb[_0xba75('0x45')](_0xba75('0x8f'),_0x174abe);}BPromise['resolve']()[_0xba75('0x2b')](function(){if(!_0x5dc5f8){if(_0x381cb['query'][_0xba75('0x77')]||_0x381cb[_0xba75('0x3b')]['journey'])return;_0x58e3bb[_0xba75('0x45')](_0xba75('0x90'));_0x3ac538[_0xba75('0x45')](_0xba75('0x90'));return;}if(_0x381cb[_0xba75('0x91')][_0xba75('0x92')]!==_0xba75('0x93'))return;return _0x381cb[_0xba75('0x91')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xba75('0x2b')](function(_0x23faa7){if(_['isEmpty'](_0x23faa7)){_0x58e3bb['where']('i.FaxAccountId\x20IS\x20NULL');_0x3ac538[_0xba75('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x58e3bb[_0xba75('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0xba75('0x2f')](_0x23faa7,'id'));_0x3ac538['where']('i.FaxAccountId\x20IN\x20?',_[_0xba75('0x2f')](_0x23faa7,'id'));}});})['then'](function(){if(_0x381cb[_0xba75('0x91')]['role']==='agent'&&!_0x5dc5f8&&!_0x381cb[_0xba75('0x3b')]['FaxAccountId'])return[];return db[_0xba75('0x94')]['query'](_0x58e3bb[_0xba75('0x95')](),_0x4c6aa8);})[_0xba75('0x2b')](function(_0x21fa25){_0x4c9fb2['count']=_0x21fa25[_0xba75('0x67')];if(_0x4c9fb2[_0xba75('0x23')]===0x0)return[];return db['sequelize'][_0xba75('0x3b')](_0x8d9eae['toString'](),_0x4c6aa8)['then'](function(_0x3791c4){_0x30b5f0=_['keyBy'](_0x3791c4,'id');_0x4c6aa8=_[_0xba75('0x96')](_0x4c6aa8,{'model':db[_0xba75('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x381cb[_0xba75('0x3b')][_0xba75('0x40')]){_0xe5f817[_0xba75('0x3e')][_0xba75('0x33')](function(_0x468587){_0x3ac538[_0xba75('0x48')]('i.'+_0x468587);});}else{_0x3ac538[_0xba75('0x48')](_0xba75('0x8c'),_0xba75('0x8d'));_0x3ac538['field']('a.key',_0xba75('0x97'));_0x3ac538['field'](_0xba75('0x98'),_0xba75('0x99'));_0x3ac538[_0xba75('0x48')](_0xba75('0x9a'),_0xba75('0x8e'));_0x3ac538[_0xba75('0x48')]('i.*');_0x3ac538['field'](_0xba75('0x9b'),'Contact.firstName');_0x3ac538[_0xba75('0x48')](_0xba75('0x9c'),_0xba75('0x9d'));_0x3ac538[_0xba75('0x48')](_0xba75('0x9e'),'Contact.email');_0x3ac538[_0xba75('0x48')](_0xba75('0x9f'),_0xba75('0xa0'));_0x3ac538[_0xba75('0x48')](_0xba75('0xa1'),_0xba75('0xa2'));_0x3ac538[_0xba75('0x48')](_0xba75('0xa3'),_0xba75('0xa4'));_0x3ac538['field'](_0xba75('0xa5'),_0xba75('0xa6'));_0x3ac538[_0xba75('0x48')](_0xba75('0xa7'),_0xba75('0xa8'));_0x3ac538[_0xba75('0x48')](_0xba75('0xa9'),_0xba75('0x31'));}if(_0xe5f817['limit'])_0x3ac538[_0xba75('0x25')](_0xe5f817[_0xba75('0x25')]);if(_0xe5f817[_0xba75('0x24')])_0x3ac538[_0xba75('0x24')](_0xe5f817[_0xba75('0x24')]);return db[_0xba75('0x94')]['query'](_0x3ac538[_0xba75('0x95')](),_0x4c6aa8);})['then'](function(_0x665f4d){_0x1717fa['where'](_0xba75('0xaa'),_[_0xba75('0x2f')](_0x665f4d,'id'));return db[_0xba75('0x94')]['query'](_0x1717fa['toString'](),_0x4c6aa8)['then'](function(_0x2ae4c7){var _0x4125bc=_[_0xba75('0xab')](_0x2ae4c7,_0xba75('0xac'));var _0x50fd44=[];_0x665f4d[_0xba75('0x33')](function(_0x2c545c){_0x50fd44[_0xba75('0x34')](updateFaxInteraction(_0x2c545c,_0x30b5f0,_0x4125bc));});return BPromise[_0xba75('0xad')](_0x50fd44);});});})[_0xba75('0x2b')](function(_0xe05337){_0x4c9fb2[_0xba75('0xae')]=_0xe05337;return _0x4c9fb2;})[_0xba75('0x2b')](respondWithFilteredResult(_0x5e3c8c,_0xe5f817))[_0xba75('0x35')](handleError(_0x5e3c8c,null));};exports[_0xba75('0xaf')]=function(_0x479646,_0x28dc0b){var _0x8b7019={'raw':![],'where':{'id':_0x479646['params']['id']}},_0x46d207={};_0x46d207[_0xba75('0x3d')]=_[_0xba75('0x3c')](db[_0xba75('0x37')][_0xba75('0x38')]);_0x46d207['query']=_[_0xba75('0x3c')](_0x479646[_0xba75('0x3b')]);_0x46d207['filters']=_[_0xba75('0x3f')](_0x46d207[_0xba75('0x3d')],_0x46d207[_0xba75('0x3b')]);_0x8b7019[_0xba75('0x3e')]=_[_0xba75('0x3f')](_0x46d207['model'],qs['fields'](_0x479646[_0xba75('0x3b')]['fields']));_0x8b7019[_0xba75('0x3e')]=_0x8b7019[_0xba75('0x3e')][_0xba75('0x67')]?_0x8b7019['attributes']:_0x46d207[_0xba75('0x3d')];if(_0x479646[_0xba75('0x3b')][_0xba75('0xb0')]){_0x8b7019[_0xba75('0xb1')]=[{'all':!![]}];}_0x8b7019=_[_0xba75('0x96')]({},_0x8b7019,_0x479646['options']);return db['FaxInteraction']['find'](_0x8b7019)[_0xba75('0x2b')](handleEntityNotFound(_0x28dc0b,null))['then'](respondWithResult(_0x28dc0b,null))[_0xba75('0x35')](handleError(_0x28dc0b,null));};exports['create']=function(_0x111dd7,_0x49ced6){return db[_0xba75('0x37')][_0xba75('0xb2')](_0x111dd7[_0xba75('0x72')],{})[_0xba75('0x2b')](respondWithResult(_0x49ced6,0xc9))[_0xba75('0x35')](handleError(_0x49ced6,null));};exports[_0xba75('0x2a')]=function(_0x181217,_0x19f094){if(_0x181217['body']['id']){delete _0x181217[_0xba75('0x72')]['id'];}return db[_0xba75('0x37')][_0xba75('0x60')]({'where':{'id':_0x181217[_0xba75('0xb3')]['id']}})[_0xba75('0x2b')](handleEntityNotFound(_0x19f094,null))['then'](saveUpdates(_0x181217[_0xba75('0x72')],null))[_0xba75('0x2b')](respondWithResult(_0x19f094,null))[_0xba75('0x35')](handleError(_0x19f094,null));};exports['destroy']=function(_0x2b885c,_0x5ce652){return db['FaxInteraction'][_0xba75('0x60')]({'where':{'id':_0x2b885c[_0xba75('0xb3')]['id']}})[_0xba75('0x2b')](handleEntityNotFound(_0x5ce652,null))[_0xba75('0x2b')](removeEntity(_0x5ce652,null))[_0xba75('0x35')](handleError(_0x5ce652,null));};exports[_0xba75('0xb4')]=function(_0x257804,_0x47e785){return db[_0xba75('0x37')]['describe']()[_0xba75('0x2b')](respondWithResult(_0x47e785,null))[_0xba75('0x35')](handleError(_0x47e785,null));};exports[_0xba75('0xb5')]=function(_0x2dac09,_0x3bcf16,_0xf232ed){return db['FaxMessage'][_0xba75('0x60')]({'where':{'id':_0x2dac09[_0xba75('0xb3')]['id']}})[_0xba75('0x2b')](handleEntityNotFound(_0x3bcf16,null))['then'](function(_0x340bd7){if(_0x340bd7){return _0x340bd7[_0xba75('0xb5')](_0x2dac09[_0xba75('0x72')][_0xba75('0xb6')],_[_0xba75('0xb7')](_0x2dac09[_0xba75('0x72')],[_0xba75('0xb6'),'id'])||{});}})[_0xba75('0x2b')](respondWithResult(_0x3bcf16,null))[_0xba75('0x35')](handleError(_0x3bcf16,null));};exports[_0xba75('0xb8')]=function(_0x33f6b9,_0x33167d,_0x2c2541){var _0x5bfacd={'raw':![],'where':{}};var _0x1532de={};var _0x1690a8={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xba75('0xb9')]({'where':{'id':_0x33f6b9['params']['id']}})[_0xba75('0x2b')](handleEntityNotFound(_0x33167d,null))[_0xba75('0x2b')](function(_0x536df8){if(_0x536df8){_0x1532de[_0xba75('0x3d')]=_[_0xba75('0x3c')](db[_0xba75('0xba')][_0xba75('0x38')]);_0x1532de['query']=_[_0xba75('0x3c')](_0x33f6b9[_0xba75('0x3b')]);_0x1532de['filters']=_['intersection'](_0x1532de['model'],_0x1532de[_0xba75('0x3b')]);_0x5bfacd[_0xba75('0x3e')]=_['intersection'](_0x1532de[_0xba75('0x3d')],qs[_0xba75('0x40')](_0x33f6b9[_0xba75('0x3b')][_0xba75('0x40')]));_0x5bfacd['attributes']=_0x5bfacd['attributes'][_0xba75('0x67')]?_0x5bfacd['attributes']:_0x1532de[_0xba75('0x3d')];if(!_0x33f6b9[_0xba75('0x3b')][_0xba75('0x41')]('nolimit')){_0x5bfacd[_0xba75('0x25')]=qs['limit'](_0x33f6b9[_0xba75('0x3b')][_0xba75('0x25')]);_0x5bfacd[_0xba75('0x24')]=qs[_0xba75('0x24')](_0x33f6b9[_0xba75('0x3b')][_0xba75('0x24')]);}_0x5bfacd[_0xba75('0x43')]=qs[_0xba75('0x44')](_0x33f6b9[_0xba75('0x3b')][_0xba75('0x44')]);_0x5bfacd[_0xba75('0x45')]=qs[_0xba75('0x46')](_[_0xba75('0x47')](_0x33f6b9[_0xba75('0x3b')],_0x1532de[_0xba75('0x46')]));_0x5bfacd[_0xba75('0x45')][_0xba75('0xac')]=_0x536df8['id'];if(_0x33f6b9[_0xba75('0x3b')][_0xba75('0x85')]){_0x5bfacd[_0xba75('0x45')]=_['merge'](_0x5bfacd[_0xba75('0x45')],{'$or':_[_0xba75('0x2f')](_0x5bfacd[_0xba75('0x3e')],function(_0x27568b){var _0x3668ea={};_0x3668ea[_0x27568b]={'$like':'%'+_0x33f6b9[_0xba75('0x3b')]['filter']+'%'};return _0x3668ea;})});}if(_0x33f6b9[_0xba75('0x3b')][_0xba75('0xbb')]){var _0x261425=_0x33f6b9[_0xba75('0x3b')][_0xba75('0xbb')]['split'](',');var _0x590ce4={};_0x590ce4[_0x261425[0x0]]={'$gte':moment(_0x261425[0x1])[_0xba75('0xbc')](_0xba75('0xbd'))};_0x5bfacd[_0xba75('0x45')]=_[_0xba75('0x96')](_0x5bfacd[_0xba75('0x45')],_0x590ce4);}_0x5bfacd=_[_0xba75('0x96')]({},_0x5bfacd,_0x33f6b9[_0xba75('0xbe')]);return db[_0xba75('0xba')][_0xba75('0x23')]({'where':_0x5bfacd[_0xba75('0x45')]})[_0xba75('0x2b')](function(_0x402006){_0x1690a8['count']=_0x402006;if(_0x33f6b9[_0xba75('0x3b')][_0xba75('0xb0')]){_0x5bfacd['include']=[{'all':!![]}];}return db[_0xba75('0xba')]['findAll'](_0x5bfacd);})[_0xba75('0x2b')](function(_0x1db8ef){_0x1690a8[_0xba75('0xae')]=_0x1db8ef;return _0x1690a8;});}})[_0xba75('0x2b')](respondWithFilteredResult(_0x33167d,_0x5bfacd))['catch'](handleError(_0x33167d,null));};exports[_0xba75('0xbf')]=function(_0x511e49,_0x1e5cc1,_0x23146f){return db['FaxInteraction'][_0xba75('0x60')]({'where':{'id':_0x511e49['params']['id']}})[_0xba75('0x2b')](handleEntityNotFound(_0x1e5cc1,null))[_0xba75('0x2b')](function(_0x5e1248){if(_0x5e1248){return _0x5e1248['setTags'](_0x511e49[_0xba75('0x72')][_0xba75('0xb6')],_[_0xba75('0xb7')](_0x511e49[_0xba75('0x72')],[_0xba75('0xb6'),'id'])||{})['spread'](function(){return db[_0xba75('0x6c')][_0xba75('0xc0')]({'attributes':['id',_0xba75('0x2d'),_0xba75('0xc1')],'where':{'id':_0x511e49[_0xba75('0x72')]['ids']}});})[_0xba75('0x2b')](function(_0x4faacf){socket[_0xba75('0xc2')](_0xba75('0xc3'),{'id':Number(_0x511e49[_0xba75('0xb3')]['id']),'tags':_0x4faacf||[]});return{'id':Number(_0x511e49[_0xba75('0xb3')]['id']),'tags':_0x4faacf||[]};});}})['then'](respondWithResult(_0x1e5cc1,null))['catch'](handleError(_0x1e5cc1,null));};exports['removeTags']=function(_0x41d7f0,_0x52e327,_0x211c9d){return db[_0xba75('0x37')][_0xba75('0x60')]({'where':{'id':_0x41d7f0[_0xba75('0xb3')]['id']}})['then'](handleEntityNotFound(_0x52e327,null))[_0xba75('0x2b')](function(_0x723814){if(_0x723814){return _0x723814['removeTags'](_0x41d7f0[_0xba75('0x3b')][_0xba75('0xb6')]);}})[_0xba75('0x2b')](respondWithStatusCode(_0x52e327,null))[_0xba75('0x35')](handleError(_0x52e327,null));};exports['download']=function(_0x24a3ce,_0x504966){var _0x10349b=moment()[_0xba75('0xc4')]()['toString']();var _0x499469=path['join'](config['root'],_0xba75('0xc5'),'files',_0xba75('0xc6'));var _0x2d14a4=path[_0xba75('0xc7')](config[_0xba75('0xc8')],'server','files',_0xba75('0xc9'));var _0x56f335=path[_0xba75('0xc7')](_0x499469,_0x10349b);var _0x4a2fee=util[_0xba75('0xbc')](_0xba75('0xca'),_0x24a3ce[_0xba75('0xb3')]['id'],_0x10349b);var _0x1f4b6b=path[_0xba75('0xc7')](_0x499469,_0x4a2fee);var _0x42d85a=[];_0x42d85a[_0xba75('0x34')]({'model':db[_0xba75('0xcb')],'as':_0xba75('0xcb'),'raw':!![]});var _0x563b00=[{'model':db[_0xba75('0xba')],'as':_0xba75('0xcc'),'attributes':['id',_0xba75('0x72'),_0xba75('0x7a')],'include':_0x42d85a}];return db['FaxInteraction'][_0xba75('0x60')]({'where':{'id':_0x24a3ce[_0xba75('0xb3')]['id']},'include':_0x563b00})[_0xba75('0x2b')](handleEntityNotFound(_0x504966,null))['then'](function(_0x19730a){if(_0x19730a&&_0x19730a[_0xba75('0xcc')]){var _0x54fc7e=_0x19730a[_0xba75('0xcd')]({'plain':!![]});fs[_0xba75('0xce')](_0x56f335);for(var _0x4b339b=0x0;_0x4b339b<_0x54fc7e['Messages'][_0xba75('0x67')];_0x4b339b++){var _0x463137=_0x54fc7e['Messages'][_0x4b339b][_0xba75('0xcb')];if(_0x463137){var _0x3e7297=path['join'](_0x2d14a4,_0x463137[_0xba75('0xcf')]);if(fs[_0xba75('0xd0')](_0x3e7297)){fs[_0xba75('0xd1')](_0x3e7297)[_0xba75('0xd2')](fs[_0xba75('0xd3')](path[_0xba75('0xc7')](_0x56f335,_0x463137[_0xba75('0xcf')])));}}}return BPromise[_0xba75('0xd4')]()['then'](function(){return new BPromise(function(_0x13f87d,_0x200ed8){zipdir(_0x56f335,{'saveTo':_0x1f4b6b},function(_0x54bd68,_0x49aa40){if(_0x54bd68)return _0x200ed8(_0x54bd68);return _0x13f87d(_0x49aa40);});})[_0xba75('0x2b')](function(){return new BPromise(function(_0x5de6d0,_0x438d0d){rimraf(_0x56f335,function(_0x5a6359){if(_0x5a6359)_0x438d0d(_0x5a6359);return _0x5de6d0();});});})[_0xba75('0x2b')](function(){return _0x504966[_0xba75('0xd5')](_0x1f4b6b,_0x4a2fee,function(_0x3bd488){if(_0x3bd488){console[_0xba75('0xd6')](_0xba75('0xd7'),_0x3bd488);}else{fs['unlinkSync'](_0x1f4b6b);}});});});}else{return _0x504966[_0xba75('0x1f')](0xc8);}})[_0xba75('0x35')](handleError(_0x504966,null));}; \ No newline at end of file +var _0x6f0d=['keys','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','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)','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','order','isEmpty','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','catch','intersection','includeAll','include','options','params','describe','FaxMessage','ids','omit','getMessages','$gte','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','FaxInteraction','rawAttributes','fieldName','key','model','query'];(function(_0x15431a,_0x5b655f){var _0x4f1136=function(_0x1670f8){while(--_0x1670f8){_0x15431a['push'](_0x15431a['shift']());}};_0x4f1136(++_0x5b655f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2b971d,_0x12126d){_0x2b971d=_0x2b971d-0x0;var _0x3cf8a1=_0x6f0d[_0x2b971d];return _0x3cf8a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6f0('0x0'));var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require(_0xd6f0('0x3'));var rp=require('request-promise');var moment=require(_0xd6f0('0x4'));var BPromise=require(_0xd6f0('0x5'));var Mustache=require(_0xd6f0('0x6'));var util=require(_0xd6f0('0x7'));var path=require(_0xd6f0('0x8'));var sox=require('sox');var csv=require(_0xd6f0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];config[_0xd6f0('0x19')]=_[_0xd6f0('0x1a')](config[_0xd6f0('0x19')],{'host':_0xd6f0('0x1b'),'port':0x18eb});var socket=require(_0xd6f0('0x1c'))(new Redis(config[_0xd6f0('0x19')]));require(_0xd6f0('0x1d'))['register'](socket);function respondWithStatusCode(_0x2b3f32,_0x354846){_0x354846=_0x354846||0xcc;return function(_0x4c1559){if(_0x4c1559){return _0x2b3f32[_0xd6f0('0x1e')](_0x354846);}return _0x2b3f32['status'](_0x354846)[_0xd6f0('0x1f')]();};}function respondWithResult(_0x154e3e,_0x41bd99){_0x41bd99=_0x41bd99||0xc8;return function(_0x472156){if(_0x472156){return _0x154e3e[_0xd6f0('0x20')](_0x41bd99)[_0xd6f0('0x21')](_0x472156);}};}function respondWithFilteredResult(_0x25da0c,_0x29fbb9){return function(_0x2e71bd){if(_0x2e71bd){var _0x1862a9=_0x2e71bd[_0xd6f0('0x22')],_0x23ab6c=_0x29fbb9[_0xd6f0('0x23')],_0x17e7c6=_0x29fbb9[_0xd6f0('0x23')]+_0x29fbb9['limit'],_0x327231;if(_0x17e7c6>=_0x1862a9){_0x17e7c6=_0x1862a9;_0x327231=0xc8;}else{_0x327231=0xce;}_0x25da0c['status'](_0x327231);return _0x25da0c[_0xd6f0('0x24')](_0xd6f0('0x25'),_0x23ab6c+'-'+_0x17e7c6+'/'+_0x1862a9)[_0xd6f0('0x21')](_0x2e71bd);}return null;};}function patchUpdates(_0x54300d){return function(_0x67afa7){try{jsonpatch[_0xd6f0('0x26')](_0x67afa7,_0x54300d,!![]);}catch(_0x557c9b){return BPromise[_0xd6f0('0x27')](_0x557c9b);}return _0x67afa7['save']();};}function saveUpdates(_0x1ee584,_0x1c9d90){return function(_0x5dbe1c){if(_0x5dbe1c){return _0x5dbe1c[_0xd6f0('0x28')](_0x1ee584)[_0xd6f0('0x29')](function(_0x5ea2dd){return _0x5ea2dd;});}return null;};}function removeEntity(_0x3dbdc3,_0x402070){return function(_0x283a07){if(_0x283a07){return _0x283a07['destroy']()[_0xd6f0('0x29')](function(){_0x3dbdc3[_0xd6f0('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcea0ae,_0x551be8){return function(_0x2042d5){if(!_0x2042d5){_0xcea0ae[_0xd6f0('0x1e')](0x194);}return _0x2042d5;};}function handleError(_0x1630dc,_0x3c1bff){_0x3c1bff=_0x3c1bff||0x1f4;return function(_0x4101bd){logger[_0xd6f0('0x2a')](_0x4101bd[_0xd6f0('0x2b')]);if(_0x4101bd[_0xd6f0('0x2c')]){delete _0x4101bd['name'];}_0x1630dc[_0xd6f0('0x20')](_0x3c1bff)[_0xd6f0('0x2d')](_0x4101bd);};}function getInteractionUsers(_0x55656c,_0x38a3e9){return new BPromise(function(_0x385947,_0x27db5e){try{if(_0x38a3e9[_0x55656c['id']]){_0x55656c[_0xd6f0('0x2e')]=_[_0xd6f0('0x2f')](_0x38a3e9[_0x55656c['id']],function(_0x39e96a){return{'id':_0x39e96a['id'],'fullname':_0x39e96a[_0xd6f0('0x30')]};});}}catch(_0x3151f8){_0x27db5e(_0x3151f8);}_0x385947(_0x55656c);});}function getInteractionTags(_0x465cf9,_0x43f72f){return new BPromise(function(_0x1dff9b,_0x3e913a){try{if(_0x465cf9[_0xd6f0('0x31')]){_0x465cf9[_0xd6f0('0x32')]=[];_0x465cf9[_0xd6f0('0x31')][_0xd6f0('0x33')](',')[_0xd6f0('0x34')](function(_0x376890){_0x465cf9[_0xd6f0('0x32')][_0xd6f0('0x35')](_0x43f72f[_0x376890]);});}delete _0x465cf9[_0xd6f0('0x31')];}catch(_0x26ab29){_0x3e913a(_0x26ab29);}_0x1dff9b(_0x465cf9);});}function updateFaxInteraction(_0x4a8ebe,_0x11124c,_0x4ed523){return new BPromise(function(_0x58d2c5,_0x43d588){return getInteractionUsers(_0x4a8ebe,_0x4ed523)[_0xd6f0('0x29')](function(_0x12a6fa){return getInteractionTags(_0x12a6fa,_0x11124c);})[_0xd6f0('0x29')](function(_0x202838){_0x58d2c5(_0x202838);})['catch'](function(_0x15d856){_0x43d588(_0x15d856);});});}exports['index']=function(_0x27b5b0,_0xbe1408){var _0x42c01a={},_0x1eecf0={},_0x518751={'count':0x0,'rows':[]};var _0x5c3132=_['map'](db[_0xd6f0('0x36')][_0xd6f0('0x37')],function(_0x4a6c65){return{'name':_0x4a6c65[_0xd6f0('0x38')],'type':_0x4a6c65['type'][_0xd6f0('0x39')]};});_0x1eecf0[_0xd6f0('0x3a')]=_[_0xd6f0('0x2f')](_0x5c3132,_0xd6f0('0x2c'));_0x1eecf0[_0xd6f0('0x3b')]=_[_0xd6f0('0x3c')](_0x27b5b0[_0xd6f0('0x3b')]);_0x1eecf0['filters']=_['intersection'](_0x1eecf0[_0xd6f0('0x3a')],_0x1eecf0[_0xd6f0('0x3b')]);_0x42c01a[_0xd6f0('0x3d')]=_['intersection'](_0x1eecf0['model'],qs[_0xd6f0('0x3e')](_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x3e')]));_0x42c01a[_0xd6f0('0x3d')]=_0x42c01a[_0xd6f0('0x3d')][_0xd6f0('0x3f')]?_0x42c01a[_0xd6f0('0x3d')]:_0x1eecf0[_0xd6f0('0x3a')];if(!_0x27b5b0['query'][_0xd6f0('0x40')](_0xd6f0('0x41'))){_0x42c01a[_0xd6f0('0x42')]=qs[_0xd6f0('0x42')](_0x27b5b0['query'][_0xd6f0('0x42')]);_0x42c01a[_0xd6f0('0x23')]=qs[_0xd6f0('0x23')](_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x23')]);}_0x42c01a['order']=qs[_0xd6f0('0x43')](_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x43')]);_0x42c01a['where']=qs[_0xd6f0('0x44')](_[_0xd6f0('0x45')](_0x27b5b0['query'],_0x1eecf0['filters']),_0x5c3132);var _0x9cffd4=[];var _0x46aa7d=squel[_0xd6f0('0x46')]()['field']('id')[_0xd6f0('0x47')](_0xd6f0('0x2c'))['field'](_0xd6f0('0x48'))[_0xd6f0('0x49')](_0xd6f0('0x4a'));var _0x173e5d=squel['select']()[_0xd6f0('0x47')](_0xd6f0('0x4b'))[_0xd6f0('0x47')](_0xd6f0('0x4c'))[_0xd6f0('0x47')](_0xd6f0('0x4d'))[_0xd6f0('0x49')](_0xd6f0('0x4e'),'ui')['left_join'](_0xd6f0('0x4f'),'u',_0xd6f0('0x50'));var _0x55e93b=squel[_0xd6f0('0x46')]()[_0xd6f0('0x49')](_0xd6f0('0x51'),'i')[_0xd6f0('0x52')]('cm_contacts','c',_0xd6f0('0x53'))[_0xd6f0('0x52')]('users','o','o.id\x20=\x20i.UserId')[_0xd6f0('0x52')]('fax_accounts','a',_0xd6f0('0x54'))[_0xd6f0('0x52')](_0xd6f0('0x55'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xd6f0('0x52')](_0xd6f0('0x56'),'it',_0xd6f0('0x57'))[_0xd6f0('0x52')](_0xd6f0('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x17cbb0=squel['expr']();var _0x416a94=[];var _0x212bd0=squel[_0xd6f0('0x58')]();var _0x1dc320;if(_0x27b5b0['query']['search']){_0x1dc320=as[_0xd6f0('0x59')](_0x27b5b0[_0xd6f0('0x3b')]['search']);var _0xa68b18=_0x1dc320['sqlOperator'];for(var _0xb5fc29=0x0;_0xb5fc29<_0x1dc320[_0xd6f0('0x5a')][_0xd6f0('0x3f')];_0xb5fc29++){var _0x41d115=_0x1dc320[_0xd6f0('0x5a')][_0xb5fc29];var _0x4d6bc0='i';var _0x232757=_[_0xd6f0('0x5b')](_0x5c3132,[_0xd6f0('0x2c'),_0x41d115[_0xd6f0('0x47')]]);if(!_0x232757){switch(_0x41d115[_0xd6f0('0x47')]){case _0xd6f0('0x5c'):if(_0x41d115[_0xd6f0('0x5d')]==0x1){_0x55e93b[_0xd6f0('0x5e')]('`'+_0x41d115['field']+_0xd6f0('0x5f'));}else{_0x55e93b[_0xd6f0('0x5e')]('`'+_0x41d115[_0xd6f0('0x47')]+_0xd6f0('0x60'));}break;case _0xd6f0('0x61'):if(_0x41d115[_0xd6f0('0x62')]===_0xd6f0('0x63')){if(_0x41d115[_0xd6f0('0x5d')][_0xd6f0('0x33')]('\x20')['length']>0x1){_0x17cbb0[_0xa68b18](_0xd6f0('0x64'),qs['getFullTextValue'](_0x41d115['value']),null);}else{var _0x25ea7b='%'+_0x41d115['value']+'%';_0x17cbb0[_0xa68b18]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x25ea7b,_0x25ea7b,_0x25ea7b);}}else{_0x232757=_[_0xd6f0('0x5b')](_0x5c3132,[_0xd6f0('0x2c'),_0xd6f0('0x65')]);_0x41d115['field']=_0xd6f0('0x65');_0x705eb=as[_0xd6f0('0x66')](_0x4d6bc0,_0x232757[_0xd6f0('0x67')],_0x41d115);_0x17cbb0[_0xa68b18](_0x705eb['text'],_0x705eb[_0xd6f0('0x5d')][_0xd6f0('0x68')],_0x705eb['value'][_0xd6f0('0x1f')]);}break;case _0xd6f0('0x69'):var _0x5573fc=_0x41d115[_0xd6f0('0x5d')][_0xd6f0('0x33')](',')[_0xd6f0('0x2f')](function(_0x1d9972){return Number(_0x1d9972);});_0x5573fc[_0xd6f0('0x34')](function(_0x48bfb3){_0x212bd0['or'](_0xd6f0('0x6a'),'%,'+_0x48bfb3+',%');});_0x416a94=_[_0xd6f0('0x6b')](_0x416a94,_0x5573fc);break;case'User':if(_0x41d115[_0xd6f0('0x62')]===_0xd6f0('0x63')){_0x17cbb0[_0xa68b18](_0xd6f0('0x6c'),'%'+_0x41d115['value']+'%',null);}else{_0x232757=_[_0xd6f0('0x5b')](_0x5c3132,['name','UserId']);_0x41d115['field']='UserId';_0x705eb=as[_0xd6f0('0x66')](_0x4d6bc0,_0x232757[_0xd6f0('0x67')],_0x41d115);_0x17cbb0[_0xa68b18](_0x705eb[_0xd6f0('0x6d')],_0x705eb[_0xd6f0('0x5d')]['start'],_0x705eb[_0xd6f0('0x5d')]['end']);}break;case _0xd6f0('0x6e'):_0x705eb=as[_0xd6f0('0x66')]('me',null,_0x41d115);_0x17cbb0[_0xa68b18](_0x705eb[_0xd6f0('0x6d')],_0x705eb['value'][_0xd6f0('0x68')],_0x705eb[_0xd6f0('0x5d')][_0xd6f0('0x1f')]);break;}}else{var _0x705eb=as['buildExpression'](_0x4d6bc0,_0x232757[_0xd6f0('0x67')],_0x41d115);_0x17cbb0[_0xa68b18](_0x705eb[_0xd6f0('0x6d')],_0x705eb[_0xd6f0('0x5d')]['start'],_0x705eb[_0xd6f0('0x5d')][_0xd6f0('0x1f')]);}}}else{var _0x1fee47=_(_0x27b5b0[_0xd6f0('0x3b')])['keys']()[_0xd6f0('0x2f')](function(_0x2082b5){return _[_0xd6f0('0x6f')](_0x5c3132,[_0xd6f0('0x2c'),_0x2082b5])?_0x2082b5:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x1fee47)){_0x1fee47['forEach'](function(_0x144a77){if(_0x144a77===_0xd6f0('0x70')){_0x55e93b[_0xd6f0('0x71')](_0xd6f0('0x72'),[][_0xd6f0('0x73')](_0x27b5b0[_0xd6f0('0x3b')][_0x144a77]));}else if(_0x144a77===_0xd6f0('0x74')){var _0x1b298a=JSON[_0xd6f0('0x75')](_0x27b5b0['query'][_0x144a77])['$gte'];var _0x1b9728=JSON['parse'](_0x27b5b0[_0xd6f0('0x3b')][_0x144a77])[_0xd6f0('0x76')];_0x55e93b[_0xd6f0('0x71')](_0xd6f0('0x77'),_0x1b298a,_0x1b9728);}else{if(_0x27b5b0[_0xd6f0('0x3b')][_0x144a77]===_0xd6f0('0x78')){_0x55e93b[_0xd6f0('0x71')]('i.'+_0x144a77+'\x20IS\x20NULL');}else{_0x55e93b[_0xd6f0('0x71')]('i.'+_0x144a77+_0xd6f0('0x79'),_0x27b5b0[_0xd6f0('0x3b')][_0x144a77]);}}});}if(_0x27b5b0['query'][_0xd6f0('0x7a')]){if(_0x27b5b0[_0xd6f0('0x3b')]['read']==0x1){_0x55e93b[_0xd6f0('0x5e')](_0xd6f0('0x7b'));}else{_0x55e93b[_0xd6f0('0x5e')](_0xd6f0('0x7c'));}}if(_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x7d')]){_0x416a94=_[_0xd6f0('0x7e')](_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x7d')])?_0x27b5b0['query'][_0xd6f0('0x7d')]:new Array(_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x7d')]);_0x416a94[_0xd6f0('0x34')](function(_0x5f1321){_0x212bd0['or'](_0xd6f0('0x6a'),'%,'+_0x5f1321+',%');});}if(_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x7f')]){var _0x3e74eb=_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x7f')][_0xd6f0('0x80')]('\x5c','\x5c\x5c')[_0xd6f0('0x80')](/'/g,'\x27\x27');if(qs[_0xd6f0('0x81')](_0x3e74eb)){_0x17cbb0['or'](_0xd6f0('0x82'),_0x3e74eb+'%')['or']('i.fax\x20LIKE\x20?',_0x3e74eb+'%');}_0x17cbb0['or'](_0xd6f0('0x83'),_0x3e74eb+'%');}}_0x55e93b[_0xd6f0('0x71')](_0x17cbb0);_0x55e93b[_0xd6f0('0x84')]('i.id');var _0x12a37c={'type':db[_0xd6f0('0x85')][_0xd6f0('0x86')][_0xd6f0('0x87')],'raw':!![]};var _0x2f6b18=_0x55e93b[_0xd6f0('0x88')]();_0x2f6b18[_0xd6f0('0x47')](_0xd6f0('0x89'));_0x2f6b18[_0xd6f0('0x47')](_0xd6f0('0x8a'),_0xd6f0('0x5c'));if(_0x42c01a['order']){_0x42c01a['order'][_0xd6f0('0x34')](function(_0x3192a5){var _0x27ef27=_0x3192a5[0x0]===_0xd6f0('0x8b')?_0x3192a5[0x0]:'i.'+_0x3192a5[0x0];_0x55e93b[_0xd6f0('0x8c')](_0x27ef27,_0x3192a5[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd6f0('0x8d')](_0x416a94)){_0x55e93b[_0xd6f0('0x5e')](_0x212bd0);_0x2f6b18['where'](_0xd6f0('0x8e'),_0x416a94);}BPromise['resolve']()[_0xd6f0('0x29')](function(){if(!_0x1dc320){if(_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x70')]||_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x8f')])return;_0x2f6b18['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x55e93b[_0xd6f0('0x71')](_0xd6f0('0x90'));return;}if(_0x27b5b0['user'][_0xd6f0('0x91')]!=='agent')return;return _0x27b5b0['user'][_0xd6f0('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5dc1c7){if(_['isEmpty'](_0x5dc1c7)){_0x2f6b18['where'](_0xd6f0('0x93'));_0x55e93b[_0xd6f0('0x71')](_0xd6f0('0x93'));}else{_0x2f6b18[_0xd6f0('0x71')](_0xd6f0('0x72'),_[_0xd6f0('0x2f')](_0x5dc1c7,'id'));_0x55e93b[_0xd6f0('0x71')](_0xd6f0('0x72'),_[_0xd6f0('0x2f')](_0x5dc1c7,'id'));}});})['then'](function(){if(_0x27b5b0[_0xd6f0('0x94')]['role']==='agent'&&!_0x1dc320&&!_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x70')])return[];return db[_0xd6f0('0x95')]['query'](_0x2f6b18[_0xd6f0('0x96')](),_0x12a37c);})[_0xd6f0('0x29')](function(_0xc0585c){_0x518751[_0xd6f0('0x22')]=_0xc0585c[_0xd6f0('0x3f')];if(_0x518751[_0xd6f0('0x22')]===0x0)return[];return db[_0xd6f0('0x95')][_0xd6f0('0x3b')](_0x46aa7d['toString'](),_0x12a37c)[_0xd6f0('0x29')](function(_0x37a29b){_0x9cffd4=_['keyBy'](_0x37a29b,'id');_0x12a37c=_[_0xd6f0('0x97')](_0x12a37c,{'model':db[_0xd6f0('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27b5b0[_0xd6f0('0x3b')][_0xd6f0('0x3e')]){_0x42c01a[_0xd6f0('0x3d')][_0xd6f0('0x34')](function(_0x39cfc4){_0x55e93b['field']('i.'+_0x39cfc4);});}else{_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0x8a'),_0xd6f0('0x5c'));_0x55e93b['field']('a.key','Account.key');_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0x98'),_0xd6f0('0x99'));_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0x9a'),_0xd6f0('0x8b'));_0x55e93b['field'](_0xd6f0('0x9b'));_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0x9c'),_0xd6f0('0x9d'));_0x55e93b['field'](_0xd6f0('0x9e'),'Contact.lastName');_0x55e93b[_0xd6f0('0x47')]('c.email',_0xd6f0('0x9f'));_0x55e93b[_0xd6f0('0x47')]('c.phone',_0xd6f0('0xa0'));_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0xa1'),_0xd6f0('0xa2'));_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0xa3'),_0xd6f0('0xa4'));_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0xa5'),_0xd6f0('0xa6'));_0x55e93b[_0xd6f0('0x47')](_0xd6f0('0xa7'),_0xd6f0('0xa8'));_0x55e93b[_0xd6f0('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd6f0('0x31'));}if(_0x42c01a[_0xd6f0('0x42')])_0x55e93b[_0xd6f0('0x42')](_0x42c01a[_0xd6f0('0x42')]);if(_0x42c01a[_0xd6f0('0x23')])_0x55e93b[_0xd6f0('0x23')](_0x42c01a[_0xd6f0('0x23')]);return db[_0xd6f0('0x95')][_0xd6f0('0x3b')](_0x55e93b[_0xd6f0('0x96')](),_0x12a37c);})[_0xd6f0('0x29')](function(_0x34b6fa){_0x173e5d[_0xd6f0('0x71')](_0xd6f0('0xa9'),_['map'](_0x34b6fa,'id'));return db['sequelize'][_0xd6f0('0x3b')](_0x173e5d[_0xd6f0('0x96')](),_0x12a37c)[_0xd6f0('0x29')](function(_0x29f62f){var _0x27be07=_['groupBy'](_0x29f62f,_0xd6f0('0xaa'));var _0xb5c516=[];_0x34b6fa[_0xd6f0('0x34')](function(_0x425ada){_0xb5c516['push'](updateFaxInteraction(_0x425ada,_0x9cffd4,_0x27be07));});return BPromise[_0xd6f0('0xab')](_0xb5c516);});});})[_0xd6f0('0x29')](function(_0xdf9554){_0x518751[_0xd6f0('0xac')]=_0xdf9554;return _0x518751;})[_0xd6f0('0x29')](respondWithFilteredResult(_0xbe1408,_0x42c01a))[_0xd6f0('0xad')](handleError(_0xbe1408,null));};exports['show']=function(_0x585495,_0x1fcf3e){var _0x5b26ca={'raw':![],'where':{'id':_0x585495['params']['id']}},_0x2d1f66={};_0x2d1f66[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](db['FaxInteraction'][_0xd6f0('0x37')]);_0x2d1f66['query']=_[_0xd6f0('0x3c')](_0x585495[_0xd6f0('0x3b')]);_0x2d1f66[_0xd6f0('0x44')]=_[_0xd6f0('0xae')](_0x2d1f66['model'],_0x2d1f66[_0xd6f0('0x3b')]);_0x5b26ca[_0xd6f0('0x3d')]=_[_0xd6f0('0xae')](_0x2d1f66['model'],qs[_0xd6f0('0x3e')](_0x585495[_0xd6f0('0x3b')][_0xd6f0('0x3e')]));_0x5b26ca['attributes']=_0x5b26ca['attributes'][_0xd6f0('0x3f')]?_0x5b26ca[_0xd6f0('0x3d')]:_0x2d1f66[_0xd6f0('0x3a')];if(_0x585495['query'][_0xd6f0('0xaf')]){_0x5b26ca[_0xd6f0('0xb0')]=[{'all':!![]}];}_0x5b26ca=_[_0xd6f0('0x97')]({},_0x5b26ca,_0x585495[_0xd6f0('0xb1')]);return db[_0xd6f0('0x36')][_0xd6f0('0x5b')](_0x5b26ca)[_0xd6f0('0x29')](handleEntityNotFound(_0x1fcf3e,null))['then'](respondWithResult(_0x1fcf3e,null))[_0xd6f0('0xad')](handleError(_0x1fcf3e,null));};exports['create']=function(_0x415f4d,_0x3ab153){return db[_0xd6f0('0x36')]['create'](_0x415f4d[_0xd6f0('0x6e')],{})['then'](respondWithResult(_0x3ab153,0xc9))['catch'](handleError(_0x3ab153,null));};exports[_0xd6f0('0x28')]=function(_0x3d7f0b,_0xb846dc){if(_0x3d7f0b['body']['id']){delete _0x3d7f0b[_0xd6f0('0x6e')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x3d7f0b[_0xd6f0('0xb2')]['id']}})[_0xd6f0('0x29')](handleEntityNotFound(_0xb846dc,null))[_0xd6f0('0x29')](saveUpdates(_0x3d7f0b[_0xd6f0('0x6e')],null))[_0xd6f0('0x29')](respondWithResult(_0xb846dc,null))[_0xd6f0('0xad')](handleError(_0xb846dc,null));};exports['destroy']=function(_0x125086,_0x5b8770){return db[_0xd6f0('0x36')]['find']({'where':{'id':_0x125086[_0xd6f0('0xb2')]['id']}})[_0xd6f0('0x29')](handleEntityNotFound(_0x5b8770,null))['then'](removeEntity(_0x5b8770,null))[_0xd6f0('0xad')](handleError(_0x5b8770,null));};exports[_0xd6f0('0xb3')]=function(_0x3fc5cd,_0x2325d6){return db[_0xd6f0('0x36')][_0xd6f0('0xb3')]()[_0xd6f0('0x29')](respondWithResult(_0x2325d6,null))[_0xd6f0('0xad')](handleError(_0x2325d6,null));};exports['addMessage']=function(_0x25c9a8,_0x1a2390,_0x529c3d){return db[_0xd6f0('0xb4')]['find']({'where':{'id':_0x25c9a8[_0xd6f0('0xb2')]['id']}})[_0xd6f0('0x29')](handleEntityNotFound(_0x1a2390,null))[_0xd6f0('0x29')](function(_0x89a039){if(_0x89a039){return _0x89a039['addMessage'](_0x25c9a8['body'][_0xd6f0('0xb5')],_[_0xd6f0('0xb6')](_0x25c9a8[_0xd6f0('0x6e')],[_0xd6f0('0xb5'),'id'])||{});}})[_0xd6f0('0x29')](respondWithResult(_0x1a2390,null))[_0xd6f0('0xad')](handleError(_0x1a2390,null));};exports[_0xd6f0('0xb7')]=function(_0x563c11,_0x1533b7,_0xfd3ace){var _0x2c609b={'raw':![],'where':{}};var _0x15610e={};var _0x557a37={'count':0x0,'rows':[]};return db[_0xd6f0('0x36')]['findOne']({'where':{'id':_0x563c11['params']['id']}})[_0xd6f0('0x29')](handleEntityNotFound(_0x1533b7,null))['then'](function(_0x3265c4){if(_0x3265c4){_0x15610e[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](db[_0xd6f0('0xb4')][_0xd6f0('0x37')]);_0x15610e[_0xd6f0('0x3b')]=_[_0xd6f0('0x3c')](_0x563c11['query']);_0x15610e[_0xd6f0('0x44')]=_[_0xd6f0('0xae')](_0x15610e[_0xd6f0('0x3a')],_0x15610e['query']);_0x2c609b[_0xd6f0('0x3d')]=_[_0xd6f0('0xae')](_0x15610e[_0xd6f0('0x3a')],qs[_0xd6f0('0x3e')](_0x563c11['query'][_0xd6f0('0x3e')]));_0x2c609b['attributes']=_0x2c609b[_0xd6f0('0x3d')]['length']?_0x2c609b[_0xd6f0('0x3d')]:_0x15610e[_0xd6f0('0x3a')];if(!_0x563c11[_0xd6f0('0x3b')][_0xd6f0('0x40')](_0xd6f0('0x41'))){_0x2c609b[_0xd6f0('0x42')]=qs[_0xd6f0('0x42')](_0x563c11['query']['limit']);_0x2c609b[_0xd6f0('0x23')]=qs['offset'](_0x563c11[_0xd6f0('0x3b')][_0xd6f0('0x23')]);}_0x2c609b[_0xd6f0('0x8c')]=qs[_0xd6f0('0x43')](_0x563c11[_0xd6f0('0x3b')][_0xd6f0('0x43')]);_0x2c609b[_0xd6f0('0x71')]=qs[_0xd6f0('0x44')](_[_0xd6f0('0x45')](_0x563c11[_0xd6f0('0x3b')],_0x15610e[_0xd6f0('0x44')]));_0x2c609b['where'][_0xd6f0('0xaa')]=_0x3265c4['id'];if(_0x563c11['query'][_0xd6f0('0x7f')]){_0x2c609b[_0xd6f0('0x71')]=_['merge'](_0x2c609b[_0xd6f0('0x71')],{'$or':_[_0xd6f0('0x2f')](_0x2c609b[_0xd6f0('0x3d')],function(_0xcc9d50){var _0x2b403e={};_0x2b403e[_0xcc9d50]={'$like':'%'+_0x563c11[_0xd6f0('0x3b')][_0xd6f0('0x7f')]+'%'};return _0x2b403e;})});}if(_0x563c11[_0xd6f0('0x3b')][_0xd6f0('0xb8')]){var _0x50b745=_0x563c11[_0xd6f0('0x3b')][_0xd6f0('0xb8')]['split'](',');var _0x24a11a={};_0x24a11a[_0x50b745[0x0]]={'$gte':moment(_0x50b745[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2c609b['where']=_[_0xd6f0('0x97')](_0x2c609b[_0xd6f0('0x71')],_0x24a11a);}_0x2c609b=_['merge']({},_0x2c609b,_0x563c11[_0xd6f0('0xb1')]);return db[_0xd6f0('0xb4')][_0xd6f0('0x22')]({'where':_0x2c609b[_0xd6f0('0x71')]})[_0xd6f0('0x29')](function(_0x2d5fe3){_0x557a37[_0xd6f0('0x22')]=_0x2d5fe3;if(_0x563c11[_0xd6f0('0x3b')]['includeAll']){_0x2c609b[_0xd6f0('0xb0')]=[{'all':!![]}];}return db[_0xd6f0('0xb4')]['findAll'](_0x2c609b);})[_0xd6f0('0x29')](function(_0x5dc641){_0x557a37[_0xd6f0('0xac')]=_0x5dc641;return _0x557a37;});}})[_0xd6f0('0x29')](respondWithFilteredResult(_0x1533b7,_0x2c609b))[_0xd6f0('0xad')](handleError(_0x1533b7,null));};exports[_0xd6f0('0xb9')]=function(_0x5a7129,_0x1595c1,_0x5ed00a){return db['FaxInteraction'][_0xd6f0('0x5b')]({'where':{'id':_0x5a7129[_0xd6f0('0xb2')]['id']}})[_0xd6f0('0x29')](handleEntityNotFound(_0x1595c1,null))['then'](function(_0x1d1e4a){if(_0x1d1e4a){return _0x1d1e4a[_0xd6f0('0xba')](_0x5a7129[_0xd6f0('0x6e')][_0xd6f0('0xb5')],_[_0xd6f0('0xb6')](_0x5a7129['body'],[_0xd6f0('0xb5'),'id'])||{})[_0xd6f0('0xbb')](function(){return db['Tag'][_0xd6f0('0xbc')]({'attributes':['id','name',_0xd6f0('0x48')],'where':{'id':_0x5a7129[_0xd6f0('0x6e')][_0xd6f0('0xb5')]}});})[_0xd6f0('0x29')](function(_0x174368){socket[_0xd6f0('0xbd')](_0xd6f0('0xbe'),{'id':Number(_0x5a7129['params']['id']),'tags':_0x174368||[]});return{'id':Number(_0x5a7129['params']['id']),'tags':_0x174368||[]};});}})[_0xd6f0('0x29')](respondWithResult(_0x1595c1,null))['catch'](handleError(_0x1595c1,null));};exports[_0xd6f0('0xbf')]=function(_0x42fccd,_0x30d4db,_0x5be6e9){return db[_0xd6f0('0x36')]['find']({'where':{'id':_0x42fccd[_0xd6f0('0xb2')]['id']}})[_0xd6f0('0x29')](handleEntityNotFound(_0x30d4db,null))['then'](function(_0xc24941){if(_0xc24941){return _0xc24941[_0xd6f0('0xbf')](_0x42fccd['query']['ids']);}})['then'](respondWithStatusCode(_0x30d4db,null))[_0xd6f0('0xad')](handleError(_0x30d4db,null));};exports[_0xd6f0('0xc0')]=function(_0x3c5883,_0x24ebed){var _0x342ba1=moment()['unix']()[_0xd6f0('0x96')]();var _0xf4ecc=path[_0xd6f0('0xc1')](config[_0xd6f0('0xc2')],_0xd6f0('0xc3'),_0xd6f0('0xc4'),_0xd6f0('0xc5'));var _0x3cc863=path[_0xd6f0('0xc1')](config[_0xd6f0('0xc2')],_0xd6f0('0xc3'),_0xd6f0('0xc4'),_0xd6f0('0xc6'));var _0x14cc19=path['join'](_0xf4ecc,_0x342ba1);var _0x514f0c=util[_0xd6f0('0xc7')](_0xd6f0('0xc8'),_0x3c5883['params']['id'],_0x342ba1);var _0x1bd3ef=path[_0xd6f0('0xc1')](_0xf4ecc,_0x514f0c);var _0x382054=[];_0x382054[_0xd6f0('0x35')]({'model':db[_0xd6f0('0xc9')],'as':_0xd6f0('0xc9'),'raw':!![]});var _0x42ffcf=[{'model':db['FaxMessage'],'as':_0xd6f0('0xca'),'attributes':['id',_0xd6f0('0x6e'),_0xd6f0('0x74')],'include':_0x382054}];return db[_0xd6f0('0x36')]['find']({'where':{'id':_0x3c5883[_0xd6f0('0xb2')]['id']},'include':_0x42ffcf})[_0xd6f0('0x29')](handleEntityNotFound(_0x24ebed,null))[_0xd6f0('0x29')](function(_0x516f59){if(_0x516f59&&_0x516f59[_0xd6f0('0xca')]){var _0x563a86=_0x516f59[_0xd6f0('0xcb')]({'plain':!![]});fs[_0xd6f0('0xcc')](_0x14cc19);for(var _0xa3546a=0x0;_0xa3546a<_0x563a86[_0xd6f0('0xca')][_0xd6f0('0x3f')];_0xa3546a++){var _0x3e5880=_0x563a86[_0xd6f0('0xca')][_0xa3546a][_0xd6f0('0xc9')];if(_0x3e5880){var _0x3e6f9e=path[_0xd6f0('0xc1')](_0x3cc863,_0x3e5880[_0xd6f0('0xcd')]);if(fs[_0xd6f0('0xce')](_0x3e6f9e)){fs[_0xd6f0('0xcf')](_0x3e6f9e)[_0xd6f0('0xd0')](fs[_0xd6f0('0xd1')](path[_0xd6f0('0xc1')](_0x14cc19,_0x3e5880['basename'])));}}}return BPromise[_0xd6f0('0xd2')]()[_0xd6f0('0x29')](function(){return new BPromise(function(_0x31d723,_0x1b50a5){zipdir(_0x14cc19,{'saveTo':_0x1bd3ef},function(_0x47c731,_0x304c21){if(_0x47c731)return _0x1b50a5(_0x47c731);return _0x31d723(_0x304c21);});})['then'](function(){return new BPromise(function(_0x5a8d88,_0xfc19ca){rimraf(_0x14cc19,function(_0x5a4a86){if(_0x5a4a86)_0xfc19ca(_0x5a4a86);return _0x5a8d88();});});})[_0xd6f0('0x29')](function(){return _0x24ebed[_0xd6f0('0xc0')](_0x1bd3ef,_0x514f0c,function(_0x279f3b){if(_0x279f3b){console['log'](_0xd6f0('0xd3'),_0x279f3b);}else{fs['unlinkSync'](_0x1bd3ef);}});});});}else{return _0x24ebed[_0xd6f0('0x1e')](0xc8);}})[_0xd6f0('0xad')](handleError(_0x24ebed,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7147ad9..067aadf 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x1333c6,_0x548377){var _0x11543e=function(_0xd0ad5f){while(--_0xd0ad5f){_0x1333c6['push'](_0x1333c6['shift']());}};_0x11543e(++_0x548377);}(_0x326f,0xd1));var _0xf326=function(_0x3fe7bc,_0x2ec086){_0x3fe7bc=_0x3fe7bc-0x0;var _0x30f766=_0x326f[_0x3fe7bc];return _0x30f766;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x432364,_0x270cfa){var _0x3a2d95=function(_0xcb6a68){while(--_0xcb6a68){_0x432364['push'](_0x432364['shift']());}};_0x3a2d95(++_0x270cfa);}(_0x326f,0xd1));var _0xf326=function(_0x51542e,_0x5132d3){_0x51542e=_0x51542e-0x0;var _0x165ba3=_0x326f[_0x51542e];return _0x165ba3;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4a6a2df..73fb81b 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 _0xf5dd=['define','FaxInteraction','fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x40a1de,_0x399e42){var _0x461c68=function(_0x848d97){while(--_0x848d97){_0x40a1de['push'](_0x40a1de['shift']());}};_0x461c68(++_0x399e42);}(_0xf5dd,0x181));var _0xdf5d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf5dd[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xdf5d('0x0'));var util=require(_0xdf5d('0x1'));var logger=require(_0xdf5d('0x2'))(_0xdf5d('0x3'));var moment=require('moment');var BPromise=require(_0xdf5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdf5d('0x5'));var config=require(_0xdf5d('0x6'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x138535,_0x214110){return _0x138535[_0xdf5d('0x7')](_0xdf5d('0x8'),attributes,{'tableName':_0xdf5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2912f6,_0x50311b,_0x5d11c3){if(_0x2912f6['changed'](_0xdf5d('0xa'))){_0x2912f6[_0xdf5d('0xb')]=moment()[_0xdf5d('0xc')](_0xdf5d('0xd'));}_0x5d11c3(null,_0x2912f6);}}});}; \ No newline at end of file +var _0xf8ec=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0xf8ec,0x15a));var _0xcf8e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xf8ec[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xcf8e('0x0'));var util=require(_0xcf8e('0x1'));var logger=require(_0xcf8e('0x2'))(_0xcf8e('0x3'));var moment=require(_0xcf8e('0x4'));var BPromise=require('bluebird');var rp=require(_0xcf8e('0x5'));var fs=require('fs');var path=require(_0xcf8e('0x6'));var rimraf=require(_0xcf8e('0x7'));var config=require(_0xcf8e('0x8'));var attributes=require(_0xcf8e('0x9'));module[_0xcf8e('0xa')]=function(_0x25b9a8,_0x5e4fd2){return _0x25b9a8[_0xcf8e('0xb')](_0xcf8e('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e00d2,_0x4c0352,_0x1d1cf3){if(_0x3e00d2[_0xcf8e('0xd')](_0xcf8e('0xe'))){_0x3e00d2[_0xcf8e('0xf')]=moment()[_0xcf8e('0x10')](_0xcf8e('0x11'));}_0x1d1cf3(null,_0x3e00d2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index ff9efeb..6e3c4b9 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 _0xc86d=['attributes','limit','AddTagsToFaxInteraction','find','addTags','omit','spread','AddTags','stringify','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc86d,0xc7));var _0xdc86=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc86d[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdc86('0x0'));var rs=require(_0xdc86('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc86('0x2'))['db'];var utils=require(_0xdc86('0x3'));var logger=require(_0xdc86('0x4'))('rpc');var config=require(_0xdc86('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdc86('0x6')]['http']({'port':0x232a});config[_0xdc86('0x7')]=_[_0xdc86('0x8')](config[_0xdc86('0x7')],{'host':_0xdc86('0x9'),'port':0x18eb});var socket=require(_0xdc86('0xa'))(new Redis(config[_0xdc86('0x7')]));require('./faxInteraction.socket')[_0xdc86('0xb')](socket);function respondWithRpcPromise(_0x2a5faf,_0x422ef5,_0x4eac1a){return new BPromise(function(_0x6d2c24,_0x506bc2){return client['request'](_0x2a5faf,_0x4eac1a)[_0xdc86('0xc')](function(_0x1b8aaf){logger[_0xdc86('0xd')](_0xdc86('0xe'),_0x422ef5,_0xdc86('0xf'));logger[_0xdc86('0x10')](_0xdc86('0x11'),_0x422ef5,_0xdc86('0xf'),JSON['stringify'](_0x1b8aaf));if(_0x1b8aaf['error']){if(_0x1b8aaf[_0xdc86('0x12')]['code']===0x1f4){logger[_0xdc86('0x12')](_0xdc86('0xe'),_0x422ef5,_0x1b8aaf[_0xdc86('0x12')][_0xdc86('0x13')]);return _0x506bc2(_0x1b8aaf[_0xdc86('0x12')][_0xdc86('0x13')]);}logger[_0xdc86('0x12')](_0xdc86('0xe'),_0x422ef5,_0x1b8aaf['error'][_0xdc86('0x13')]);return _0x6d2c24(_0x1b8aaf[_0xdc86('0x12')][_0xdc86('0x13')]);}else{logger['info'](_0xdc86('0xe'),_0x422ef5,_0xdc86('0xf'));_0x6d2c24(_0x1b8aaf[_0xdc86('0x14')]['message']);}})[_0xdc86('0x15')](function(_0x34dbb5){logger[_0xdc86('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x422ef5,_0x34dbb5);_0x506bc2(_0x34dbb5);});});}exports[_0xdc86('0x16')]=function(_0x11e5f1){var _0x687acb=this;return new Promise(function(_0x40429e,_0x3c8f83){return db[_0xdc86('0x17')][_0xdc86('0x18')](_0x11e5f1[_0xdc86('0x19')],{'raw':_0x11e5f1[_0xdc86('0x1a')]?_0x11e5f1[_0xdc86('0x1a')][_0xdc86('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e5f1[_0xdc86('0x1a')]?_0x11e5f1['options'][_0xdc86('0x1c')]||null:null,'attributes':_0x11e5f1[_0xdc86('0x1a')]?_0x11e5f1[_0xdc86('0x1a')][_0xdc86('0x1d')]||null:null,'limit':_0x11e5f1['options']?_0x11e5f1[_0xdc86('0x1a')][_0xdc86('0x1e')]||null:null})[_0xdc86('0xc')](function(_0x398339){logger[_0xdc86('0xd')]('UpdateFaxInteraction',_0x11e5f1);logger[_0xdc86('0x10')](_0xdc86('0x16'),_0x11e5f1,JSON['stringify'](_0x398339));_0x40429e(_0x398339);})[_0xdc86('0x15')](function(_0x1c0665){logger[_0xdc86('0x12')](_0xdc86('0x16'),_0x1c0665[_0xdc86('0x13')],_0x11e5f1);_0x3c8f83(_0x687acb[_0xdc86('0x12')](0x1f4,_0x1c0665[_0xdc86('0x13')]));});});};exports[_0xdc86('0x1f')]=function(_0x27feb5){return new Promise(function(_0x5622a5,_0x5406e5){return db[_0xdc86('0x17')][_0xdc86('0x20')]({'where':_0x27feb5[_0xdc86('0x1a')]?_0x27feb5[_0xdc86('0x1a')][_0xdc86('0x1c')]||null:null})[_0xdc86('0xc')](function(_0x72d1a7){if(_0x72d1a7){return _0x72d1a7[_0xdc86('0x21')](_0x27feb5['body']['ids'],_[_0xdc86('0x22')](_0x27feb5['body'],['ids','id'])||{});}})[_0xdc86('0x23')](function(_0x42048c){logger[_0xdc86('0xd')](_0xdc86('0x24'),_0x27feb5);logger['debug']('AddTags',_0x27feb5,JSON[_0xdc86('0x25')](_0x42048c));_0x5622a5(_0x42048c);})[_0xdc86('0x15')](function(_0x35a1d9){logger['error'](_0xdc86('0x24'),_0x35a1d9[_0xdc86('0x13')],_0x27feb5);_0x5406e5(_this[_0xdc86('0x12')](0x1f4,_0x35a1d9[_0xdc86('0x13')]));});});}; \ No newline at end of file +var _0xeb63=['request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','body','options','raw','where','limit','debug','AddTagsToFaxInteraction','FaxInteraction','find','then','addTags','ids','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0xeb63,0x95));var _0x3eb6=function(_0x4ae6de,_0x31652f){_0x4ae6de=_0x4ae6de-0x0;var _0x267c26=_0xeb63[_0x4ae6de];return _0x267c26;};'use strict';var _=require('lodash');var util=require(_0x3eb6('0x0'));var moment=require(_0x3eb6('0x1'));var BPromise=require('bluebird');var rs=require(_0x3eb6('0x2'));var fs=require('fs');var Redis=require(_0x3eb6('0x3'));var db=require(_0x3eb6('0x4'))['db'];var utils=require(_0x3eb6('0x5'));var logger=require(_0x3eb6('0x6'))(_0x3eb6('0x7'));var config=require(_0x3eb6('0x8'));var jayson=require(_0x3eb6('0x9'));var client=jayson[_0x3eb6('0xa')][_0x3eb6('0xb')]({'port':0x232a});config[_0x3eb6('0xc')]=_[_0x3eb6('0xd')](config['redis'],{'host':_0x3eb6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3eb6('0xc')]));require(_0x3eb6('0xf'))['register'](socket);function respondWithRpcPromise(_0xb7144,_0x5f09c4,_0x5bfe70){return new BPromise(function(_0x5a083e,_0x57fda4){return client['request'](_0xb7144,_0x5bfe70)['then'](function(_0xe85700){logger[_0x3eb6('0x10')](_0x3eb6('0x11'),_0x5f09c4,'request\x20sent');logger['debug'](_0x3eb6('0x12'),_0x5f09c4,_0x3eb6('0x13'),JSON[_0x3eb6('0x14')](_0xe85700));if(_0xe85700[_0x3eb6('0x15')]){if(_0xe85700[_0x3eb6('0x15')][_0x3eb6('0x16')]===0x1f4){logger[_0x3eb6('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x5f09c4,_0xe85700['error']['message']);return _0x57fda4(_0xe85700[_0x3eb6('0x15')]['message']);}logger[_0x3eb6('0x15')](_0x3eb6('0x11'),_0x5f09c4,_0xe85700[_0x3eb6('0x15')][_0x3eb6('0x17')]);return _0x5a083e(_0xe85700[_0x3eb6('0x15')][_0x3eb6('0x17')]);}else{logger['info'](_0x3eb6('0x11'),_0x5f09c4,_0x3eb6('0x13'));_0x5a083e(_0xe85700[_0x3eb6('0x18')][_0x3eb6('0x17')]);}})[_0x3eb6('0x19')](function(_0x413b44){logger['error'](_0x3eb6('0x11'),_0x5f09c4,_0x413b44);_0x57fda4(_0x413b44);});});}exports[_0x3eb6('0x1a')]=function(_0xf59a4f){var _0x59bcdd=this;return new Promise(function(_0x8831c1,_0x3a98a5){return db['FaxInteraction'][_0x3eb6('0x1b')](_0xf59a4f[_0x3eb6('0x1c')],{'raw':_0xf59a4f[_0x3eb6('0x1d')]?_0xf59a4f[_0x3eb6('0x1d')][_0x3eb6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf59a4f['options']?_0xf59a4f[_0x3eb6('0x1d')][_0x3eb6('0x1f')]||null:null,'attributes':_0xf59a4f[_0x3eb6('0x1d')]?_0xf59a4f[_0x3eb6('0x1d')]['attributes']||null:null,'limit':_0xf59a4f[_0x3eb6('0x1d')]?_0xf59a4f['options'][_0x3eb6('0x20')]||null:null})['then'](function(_0x4d8a3a){logger[_0x3eb6('0x10')](_0x3eb6('0x1a'),_0xf59a4f);logger[_0x3eb6('0x21')](_0x3eb6('0x1a'),_0xf59a4f,JSON['stringify'](_0x4d8a3a));_0x8831c1(_0x4d8a3a);})['catch'](function(_0x1b61ec){logger[_0x3eb6('0x15')]('UpdateFaxInteraction',_0x1b61ec[_0x3eb6('0x17')],_0xf59a4f);_0x3a98a5(_0x59bcdd[_0x3eb6('0x15')](0x1f4,_0x1b61ec[_0x3eb6('0x17')]));});});};exports[_0x3eb6('0x22')]=function(_0x28d8b1){return new Promise(function(_0x451dba,_0x4f97e1){return db[_0x3eb6('0x23')][_0x3eb6('0x24')]({'where':_0x28d8b1['options']?_0x28d8b1['options'][_0x3eb6('0x1f')]||null:null})[_0x3eb6('0x25')](function(_0x34f96e){if(_0x34f96e){return _0x34f96e[_0x3eb6('0x26')](_0x28d8b1[_0x3eb6('0x1c')][_0x3eb6('0x27')],_[_0x3eb6('0x28')](_0x28d8b1[_0x3eb6('0x1c')],[_0x3eb6('0x27'),'id'])||{});}})['spread'](function(_0x3af552){logger[_0x3eb6('0x10')](_0x3eb6('0x29'),_0x28d8b1);logger[_0x3eb6('0x21')]('AddTags',_0x28d8b1,JSON[_0x3eb6('0x14')](_0x3af552));_0x451dba(_0x3af552);})['catch'](function(_0x3bd379){logger['error'](_0x3eb6('0x29'),_0x3bd379[_0x3eb6('0x17')],_0x28d8b1);_0x4f97e1(_this['error'](0x1f4,_0x3bd379[_0x3eb6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 537cbb1..9f97b62 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 _0xd8d4=['register','faxInteraction:','remove','update','removeListener'];(function(_0x3ae4b4,_0x34acad){var _0x41ea0c=function(_0x413b58){while(--_0x413b58){_0x3ae4b4['push'](_0x3ae4b4['shift']());}};_0x41ea0c(++_0x34acad);}(_0xd8d4,0x13d));var _0x4d8d=function(_0x44114c,_0xe049c2){_0x44114c=_0x44114c-0x0;var _0x104255=_0xd8d4[_0x44114c];return _0x104255;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x4d8d('0x0'),_0x4d8d('0x1')];function createListener(_0x176188,_0x31fc52){return function(_0x148071){_0x31fc52['emit'](_0x176188,_0x148071);};}function removeListener(_0x28a0f4,_0x30095b){return function(){FaxInteractionEvents[_0x4d8d('0x2')](_0x28a0f4,_0x30095b);};}exports[_0x4d8d('0x3')]=function(_0x40a16f){for(var _0x3aa3a1=0x0,_0x53fc9d=events['length'];_0x3aa3a1<_0x53fc9d;_0x3aa3a1++){var _0x2d076e=events[_0x3aa3a1];var _0x2ef7b0=createListener(_0x4d8d('0x4')+_0x2d076e,_0x40a16f);FaxInteractionEvents['on'](_0x2d076e,_0x2ef7b0);}}; \ No newline at end of file +var _0xe07e=['register','length','save','update','removeListener'];(function(_0x2b7b04,_0x5491aa){var _0x4b0728=function(_0x4947a3){while(--_0x4947a3){_0x2b7b04['push'](_0x2b7b04['shift']());}};_0x4b0728(++_0x5491aa);}(_0xe07e,0xa2));var _0xee07=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0xe07e[_0x122e9b];return _0x22c247;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xee07('0x0'),'remove',_0xee07('0x1')];function createListener(_0x48a0f9,_0x3e4a3e){return function(_0x92a42b){_0x3e4a3e['emit'](_0x48a0f9,_0x92a42b);};}function removeListener(_0x44a8ed,_0x34d7aa){return function(){FaxInteractionEvents[_0xee07('0x2')](_0x44a8ed,_0x34d7aa);};}exports[_0xee07('0x3')]=function(_0x5d65d4){for(var _0x506640=0x0,_0x2376c7=events[_0xee07('0x4')];_0x506640<_0x2376c7;_0x506640++){var _0x115ee7=events[_0x506640];var _0x456183=createListener('faxInteraction:'+_0x115ee7,_0x5d65d4);FaxInteractionEvents['on'](_0x115ee7,_0x456183);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 451a7d1..3ee6fe7 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 _0xe5b5=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xe5b5[_0x37a79c];return _0x561d89;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var auth=require(_0x5e5b('0x6'));var interaction=require(_0x5e5b('0x7'));var config=require(_0x5e5b('0x8'));var controller=require(_0x5e5b('0x9'));router[_0x5e5b('0xa')]('/',auth[_0x5e5b('0xb')](),controller[_0x5e5b('0xc')]);router[_0x5e5b('0xa')](_0x5e5b('0xd'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0xe')]);router[_0x5e5b('0xa')](_0x5e5b('0xf'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x10')]);router[_0x5e5b('0xa')](_0x5e5b('0x11'),auth['isAuthenticated'](),controller[_0x5e5b('0x12')]);router['get'](_0x5e5b('0x13'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5e5b('0x11'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xb')](),interaction[_0x5e5b('0x18')]('fax',_0x5e5b('0x19')),controller[_0x5e5b('0x1a')]);router['put'](_0x5e5b('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x5e5b('0x1b'),_0x5e5b('0x1c')),controller[_0x5e5b('0x1d')]);router['delete'](_0x5e5b('0xf'),auth['isAuthenticated'](),interaction[_0x5e5b('0x18')](_0x5e5b('0x1b'),'faxinteraction:destroy'),controller[_0x5e5b('0x1e')]);router[_0x5e5b('0x1f')](_0x5e5b('0x17'),auth['isAuthenticated'](),controller[_0x5e5b('0x20')]);module[_0x5e5b('0x21')]=router; \ No newline at end of file +var _0xe5b5=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xa6df52,_0x1b8584){var _0x5edd57=function(_0x543f11){while(--_0x543f11){_0xa6df52['push'](_0xa6df52['shift']());}};_0x5edd57(++_0x1b8584);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xe5b5[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var auth=require(_0x5e5b('0x6'));var interaction=require(_0x5e5b('0x7'));var config=require(_0x5e5b('0x8'));var controller=require(_0x5e5b('0x9'));router[_0x5e5b('0xa')]('/',auth[_0x5e5b('0xb')](),controller[_0x5e5b('0xc')]);router[_0x5e5b('0xa')](_0x5e5b('0xd'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0xe')]);router[_0x5e5b('0xa')](_0x5e5b('0xf'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x10')]);router[_0x5e5b('0xa')](_0x5e5b('0x11'),auth['isAuthenticated'](),controller[_0x5e5b('0x12')]);router['get'](_0x5e5b('0x13'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5e5b('0x11'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xb')](),interaction[_0x5e5b('0x18')]('fax',_0x5e5b('0x19')),controller[_0x5e5b('0x1a')]);router['put'](_0x5e5b('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x5e5b('0x1b'),_0x5e5b('0x1c')),controller[_0x5e5b('0x1d')]);router['delete'](_0x5e5b('0xf'),auth['isAuthenticated'](),interaction[_0x5e5b('0x18')](_0x5e5b('0x1b'),'faxinteraction:destroy'),controller[_0x5e5b('0x1e')]);router[_0x5e5b('0x1f')](_0x5e5b('0x17'),auth['isAuthenticated'](),controller[_0x5e5b('0x20')]);module[_0x5e5b('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 882561b..3d536d4 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 _0x76c7=['BOOLEAN','ENUM','out','DATE','sequelize','exports','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76c7,0x10e));var _0x776c=function(_0x26560f,_0x3fd952){_0x26560f=_0x26560f-0x0;var _0x28ea5a=_0x76c7[_0x26560f];return _0x28ea5a;};'use strict';var Sequelize=require(_0x776c('0x0'));module[_0x776c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x776c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x776c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x776c('0x4')]('in',_0x776c('0x5')),'defaultValue':_0x776c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x776c('0x6')]}}; \ No newline at end of file +var _0x2fee=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x39b7a0,_0xe15b7a){var _0x2dfd81=function(_0x2486c0){while(--_0x2486c0){_0x39b7a0['push'](_0x39b7a0['shift']());}};_0x2dfd81(++_0xe15b7a);}(_0x2fee,0x7c));var _0xe2fe=function(_0x50e7b2,_0x436c0b){_0x50e7b2=_0x50e7b2-0x0;var _0x24a67b=_0x2fee[_0x50e7b2];return _0x24a67b;};'use strict';var Sequelize=require(_0xe2fe('0x0'));module[_0xe2fe('0x1')]={'body':{'type':Sequelize[_0xe2fe('0x2')](_0xe2fe('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe2fe('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe2fe('0x5')]('in',_0xe2fe('0x6')),'defaultValue':_0xe2fe('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe2fe('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe2fe('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 04cf69c..af61780 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 _0x2169=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','update','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','channel','event','acceptmessage','agent','get','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','EventManager','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','end','json','count','offset','limit','Content-Range','reject','then','destroy','stack','name','send','index','map','FaxMessage','fieldName','type','model','keys','query','filters'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x2169,0x14f));var _0x9216=function(_0xaedc8f,_0x2487db){_0xaedc8f=_0xaedc8f-0x0;var _0x2e1d6f=_0x2169[_0xaedc8f];return _0x2e1d6f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9216('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9216('0x1'));var jsonpatch=require(_0x9216('0x2'));var rp=require(_0x9216('0x3'));var moment=require(_0x9216('0x4'));var BPromise=require(_0x9216('0x5'));var Mustache=require(_0x9216('0x6'));var util=require(_0x9216('0x7'));var path=require(_0x9216('0x8'));var sox=require(_0x9216('0x9'));var csv=require(_0x9216('0xa'));var ejs=require(_0x9216('0xb'));var fs=require('fs');var _=require(_0x9216('0xc'));var squel=require(_0x9216('0xd'));var crypto=require(_0x9216('0xe'));var jsforce=require(_0x9216('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9216('0xa'));var querystring=require('querystring');var Papa=require(_0x9216('0x10'));var Redis=require(_0x9216('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9216('0x12'));var as=require(_0x9216('0x13'));var hardwareService=require(_0x9216('0x14'));var logger=require(_0x9216('0x15'))(_0x9216('0x16'));var utils=require(_0x9216('0x17'));var config=require(_0x9216('0x18'));var licenseUtil=require(_0x9216('0x19'));var db=require(_0x9216('0x1a'))['db'];config[_0x9216('0x1b')]=_[_0x9216('0x1c')](config[_0x9216('0x1b')],{'host':_0x9216('0x1d'),'port':0x18eb});var socket=require(_0x9216('0x1e'))(new Redis(config[_0x9216('0x1b')]));require(_0x9216('0x1f'))['register'](socket);var jayson=require(_0x9216('0x20'));var client=jayson[_0x9216('0x21')][_0x9216('0x22')]({'port':0x232c});var client9002=jayson[_0x9216('0x21')][_0x9216('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3f0411,_0xeb24cd,_0x29aef5,_0x481ac4){return new BPromise(function(_0x437b41,_0x17addf){var _0x4835e2=_0x481ac4||client;return _0x4835e2[_0x9216('0x23')](_0x3f0411,_0x29aef5)['then'](function(_0x171cdf){logger['info'](_0x9216('0x24'),_0xeb24cd,_0x9216('0x25'));logger[_0x9216('0x26')](_0x9216('0x27'),_0xeb24cd,'request\x20sent',JSON[_0x9216('0x28')](_0x171cdf));if(_0x171cdf['error']){if(_0x171cdf['error']['code']===0x1f4){logger[_0x9216('0x29')](_0x9216('0x24'),_0xeb24cd,_0x171cdf['error']['message']);return _0x17addf(_0x171cdf[_0x9216('0x29')][_0x9216('0x2a')]);}logger[_0x9216('0x29')]('FaxMessage,\x20%s,\x20%s',_0xeb24cd,_0x171cdf['error'][_0x9216('0x2a')]);return _0x437b41(_0x171cdf['error']['message']);}else{logger[_0x9216('0x2b')](_0x9216('0x24'),_0xeb24cd,'request\x20sent');_0x437b41(_0x171cdf['result'][_0x9216('0x2a')]);}})[_0x9216('0x2c')](function(_0x3c1aa6){logger[_0x9216('0x29')](_0x9216('0x24'),_0xeb24cd,_0x3c1aa6);_0x17addf(_0x3c1aa6);});});}function respondWithStatusCode(_0x5b8944,_0x4f7e91){_0x4f7e91=_0x4f7e91||0xcc;return function(_0x542536){if(_0x542536){return _0x5b8944['sendStatus'](_0x4f7e91);}return _0x5b8944[_0x9216('0x2d')](_0x4f7e91)[_0x9216('0x2e')]();};}function respondWithResult(_0x59667f,_0x2b9d2a){_0x2b9d2a=_0x2b9d2a||0xc8;return function(_0xdd104){if(_0xdd104){return _0x59667f[_0x9216('0x2d')](_0x2b9d2a)[_0x9216('0x2f')](_0xdd104);}};}function respondWithFilteredResult(_0x4dc13d,_0x30cc5f){return function(_0x25f542){if(_0x25f542){var _0x11dbe6=_0x25f542[_0x9216('0x30')],_0x4189e4=_0x30cc5f[_0x9216('0x31')],_0x1cd9fd=_0x30cc5f[_0x9216('0x31')]+_0x30cc5f[_0x9216('0x32')],_0x10e487;if(_0x1cd9fd>=_0x11dbe6){_0x1cd9fd=_0x11dbe6;_0x10e487=0xc8;}else{_0x10e487=0xce;}_0x4dc13d['status'](_0x10e487);return _0x4dc13d['set'](_0x9216('0x33'),_0x4189e4+'-'+_0x1cd9fd+'/'+_0x11dbe6)[_0x9216('0x2f')](_0x25f542);}return null;};}function patchUpdates(_0x52ed0d){return function(_0x2ddc7c){try{jsonpatch['apply'](_0x2ddc7c,_0x52ed0d,!![]);}catch(_0x304d19){return BPromise[_0x9216('0x34')](_0x304d19);}return _0x2ddc7c['save']();};}function saveUpdates(_0x31e961,_0x27550f){return function(_0x2a7369){if(_0x2a7369){return _0x2a7369['update'](_0x31e961)[_0x9216('0x35')](function(_0x4afe16){return _0x4afe16;});}return null;};}function removeEntity(_0x1714d8,_0x42a0cc){return function(_0x463d16){if(_0x463d16){return _0x463d16[_0x9216('0x36')]()['then'](function(){_0x1714d8[_0x9216('0x2d')](0xcc)[_0x9216('0x2e')]();});}};}function handleEntityNotFound(_0x100216,_0x191b82){return function(_0x108eba){if(!_0x108eba){_0x100216['sendStatus'](0x194);}return _0x108eba;};}function handleError(_0x9498d9,_0x1b6646){_0x1b6646=_0x1b6646||0x1f4;return function(_0x3b8f41){logger[_0x9216('0x29')](_0x3b8f41[_0x9216('0x37')]);if(_0x3b8f41[_0x9216('0x38')]){delete _0x3b8f41[_0x9216('0x38')];}_0x9498d9[_0x9216('0x2d')](_0x1b6646)[_0x9216('0x39')](_0x3b8f41);};}exports[_0x9216('0x3a')]=function(_0x5cba7c,_0x68e4a){var _0x4bf031={},_0x22ad95={},_0x402526={'count':0x0,'rows':[]};var _0x5043ac=_[_0x9216('0x3b')](db[_0x9216('0x3c')]['rawAttributes'],function(_0x4b8a7e){return{'name':_0x4b8a7e[_0x9216('0x3d')],'type':_0x4b8a7e[_0x9216('0x3e')]['key']};});_0x22ad95[_0x9216('0x3f')]=_[_0x9216('0x3b')](_0x5043ac,_0x9216('0x38'));_0x22ad95['query']=_[_0x9216('0x40')](_0x5cba7c[_0x9216('0x41')]);_0x22ad95[_0x9216('0x42')]=_[_0x9216('0x43')](_0x22ad95[_0x9216('0x3f')],_0x22ad95[_0x9216('0x41')]);_0x4bf031[_0x9216('0x44')]=_[_0x9216('0x43')](_0x22ad95[_0x9216('0x3f')],qs[_0x9216('0x45')](_0x5cba7c[_0x9216('0x41')][_0x9216('0x45')]));_0x4bf031['attributes']=_0x4bf031[_0x9216('0x44')]['length']?_0x4bf031['attributes']:_0x22ad95[_0x9216('0x3f')];if(!_0x5cba7c[_0x9216('0x41')][_0x9216('0x46')](_0x9216('0x47'))){_0x4bf031[_0x9216('0x32')]=qs[_0x9216('0x32')](_0x5cba7c[_0x9216('0x41')][_0x9216('0x32')]);_0x4bf031[_0x9216('0x31')]=qs[_0x9216('0x31')](_0x5cba7c['query']['offset']);}_0x4bf031[_0x9216('0x48')]=qs[_0x9216('0x49')](_0x5cba7c[_0x9216('0x41')][_0x9216('0x49')]);_0x4bf031[_0x9216('0x4a')]=qs[_0x9216('0x42')](_['pick'](_0x5cba7c[_0x9216('0x41')],_0x22ad95[_0x9216('0x42')]),_0x5043ac);if(_0x5cba7c[_0x9216('0x41')][_0x9216('0x4b')]){_0x4bf031[_0x9216('0x4a')]=_['merge'](_0x4bf031[_0x9216('0x4a')],{'$or':_['map'](_0x5043ac,function(_0x75f76e){if(_0x75f76e['type']!==_0x9216('0x4c')){var _0x1f9677={};_0x1f9677[_0x75f76e['name']]={'$like':'%'+_0x5cba7c[_0x9216('0x41')]['filter']+'%'};return _0x1f9677;}})});}_0x4bf031=_[_0x9216('0x4d')]({},_0x4bf031,_0x5cba7c[_0x9216('0x4e')]);var _0x239ace={'where':_0x4bf031[_0x9216('0x4a')]};return db[_0x9216('0x3c')][_0x9216('0x30')](_0x239ace)[_0x9216('0x35')](function(_0x540ab1){_0x402526['count']=_0x540ab1;if(_0x5cba7c[_0x9216('0x41')]['includeAll']){_0x4bf031[_0x9216('0x4f')]=[{'all':!![]}];}return db[_0x9216('0x3c')][_0x9216('0x50')](_0x4bf031);})[_0x9216('0x35')](function(_0x3bcad3){_0x402526[_0x9216('0x51')]=_0x3bcad3;return _0x402526;})[_0x9216('0x35')](respondWithFilteredResult(_0x68e4a,_0x4bf031))['catch'](handleError(_0x68e4a,null));};exports[_0x9216('0x52')]=function(_0x48076a,_0x3e968f){var _0xa5b09f={'raw':!![],'where':{'id':_0x48076a[_0x9216('0x53')]['id']}},_0x268527={};_0x268527[_0x9216('0x3f')]=_[_0x9216('0x40')](db[_0x9216('0x3c')][_0x9216('0x54')]);_0x268527[_0x9216('0x41')]=_[_0x9216('0x40')](_0x48076a['query']);_0x268527[_0x9216('0x42')]=_[_0x9216('0x43')](_0x268527['model'],_0x268527[_0x9216('0x41')]);_0xa5b09f[_0x9216('0x44')]=_[_0x9216('0x43')](_0x268527['model'],qs[_0x9216('0x45')](_0x48076a['query']['fields']));_0xa5b09f['attributes']=_0xa5b09f['attributes'][_0x9216('0x55')]?_0xa5b09f['attributes']:_0x268527[_0x9216('0x3f')];if(_0x48076a['query'][_0x9216('0x56')]){_0xa5b09f[_0x9216('0x4f')]=[{'all':!![]}];}_0xa5b09f=_[_0x9216('0x4d')]({},_0xa5b09f,_0x48076a[_0x9216('0x4e')]);return db[_0x9216('0x3c')][_0x9216('0x57')](_0xa5b09f)['then'](handleEntityNotFound(_0x3e968f,null))[_0x9216('0x35')](respondWithResult(_0x3e968f,null))[_0x9216('0x2c')](handleError(_0x3e968f,null));};exports[_0x9216('0x58')]=function(_0xd2c1c5,_0x5799e7){if(_0xd2c1c5[_0x9216('0x59')]['id']){delete _0xd2c1c5['body']['id'];}return db[_0x9216('0x3c')]['find']({'where':{'id':_0xd2c1c5[_0x9216('0x53')]['id']}})['then'](handleEntityNotFound(_0x5799e7,null))['then'](saveUpdates(_0xd2c1c5[_0x9216('0x59')],null))['then'](respondWithResult(_0x5799e7,null))[_0x9216('0x2c')](handleError(_0x5799e7,null));};exports[_0x9216('0x36')]=function(_0x34f983,_0x2e61ee){return db[_0x9216('0x3c')][_0x9216('0x57')]({'where':{'id':_0x34f983[_0x9216('0x53')]['id']}})[_0x9216('0x35')](handleEntityNotFound(_0x2e61ee,null))[_0x9216('0x35')](removeEntity(_0x2e61ee,null))[_0x9216('0x2c')](handleError(_0x2e61ee,null));};exports[_0x9216('0x5a')]=function(_0xf64af7,_0x2977f4){return db[_0x9216('0x3c')]['describe']()[_0x9216('0x35')](respondWithResult(_0x2977f4,null))[_0x9216('0x2c')](handleError(_0x2977f4,null));};var interaction_log=require(_0x9216('0x15'))(_0x9216('0x5b'));exports[_0x9216('0x5c')]=function(_0x7fdec1,_0xe43f5c,_0x5a7649){var _0x4af635={'channel':_0x9216('0x5d')};if(_0x7fdec1[_0x9216('0x59')]['id']){delete _0x7fdec1[_0x9216('0x59')]['id'];}_0x7fdec1[_0x9216('0x59')][_0x9216('0x5e')]=!![];_0x7fdec1[_0x9216('0x59')][_0x9216('0x5f')]=moment()[_0x9216('0x60')](_0x9216('0x61'));_0x7fdec1[_0x9216('0x59')]['UserId']=_0x7fdec1[_0x9216('0x59')][_0x9216('0x62')]||_0x7fdec1[_0x9216('0x63')]['id'];return db[_0x9216('0x3c')][_0x9216('0x57')]({'where':{'id':_0x7fdec1[_0x9216('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x9216('0x64')],'as':_0x9216('0x65')}]})[_0x9216('0x35')](handleEntityNotFound(_0xe43f5c,null))[_0x9216('0x35')](saveUpdates(_0x7fdec1[_0x9216('0x59')],null))[_0x9216('0x35')](function(_0x6bafb3){if(_0x6bafb3){_0x4af635['message']=_0x6bafb3['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x6bafb3[_0x9216('0x66')]}});}return null;})['then'](handleEntityNotFound(_0xe43f5c,null))['then'](function(_0x4d073a){if(_0x4d073a){return _0x4d073a[_0x9216('0x58')]({'UserId':_0x7fdec1['body']['UserId'],'read1stAt':_[_0x9216('0x67')](_0x4d073a['read1stAt'])?moment()['format'](_0x9216('0x61')):undefined});}return null;})[_0x9216('0x35')](function(_0x146745){if(_0x146745){_0x4af635[_0x9216('0x68')]=_0x146745['get']({'plain':!![]});interaction_log['info'](_0x9216('0x69'),_0x7fdec1['user']['id'],_0x7fdec1[_0x9216('0x63')]['name'],_0x7fdec1['user'][_0x9216('0x6a')],_0x4af635[_0x9216('0x68')]['id'],_0x7fdec1['body']?JSON[_0x9216('0x28')](_0x7fdec1[_0x9216('0x59')]):_0x9216('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x9216('0x6c'),_0x4af635);}return null;})[_0x9216('0x35')](function(_0x5a21f3){if(_0x5a21f3){if(_0x7fdec1[_0x9216('0x59')]['manual']){_0x4af635[_0x9216('0x2a')][_0x9216('0x6d')]=util[_0x9216('0x60')]('SIP/%s',_0x7fdec1[_0x9216('0x63')]['name']);_0x4af635[_0x9216('0x2a')][_0x9216('0x6e')]=_0x4af635[_0x9216('0x6e')];_0x4af635[_0x9216('0x2a')][_0x9216('0x6f')]=_0x9216('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9216('0x70'),'message':_0x4af635['message']},client9002)[_0x9216('0x35')](function(){return _0x4af635;});}return _0x4af635;}return null;})[_0x9216('0x35')](respondWithResult(_0xe43f5c,null))[_0x9216('0x2c')](handleError(_0xe43f5c,null));};var interaction_log=require(_0x9216('0x15'))('fax-interactions');exports['reject']=function(_0x22a33c,_0x653fe4,_0x4d74f5){var _0x3bf44b={'agent':{},'channel':_0x9216('0x5d')};if(_0x22a33c[_0x9216('0x59')]['id']){delete _0x22a33c['body']['id'];}_0x22a33c[_0x9216('0x59')][_0x9216('0x62')]=_0x22a33c[_0x9216('0x59')][_0x9216('0x62')]||_0x22a33c['user']['id'];_0x3bf44b[_0x9216('0x71')]['id']=_0x22a33c[_0x9216('0x59')][_0x9216('0x62')];return db[_0x9216('0x3c')][_0x9216('0x57')]({'where':{'id':_0x22a33c[_0x9216('0x53')]['id'],'UserId':null}})[_0x9216('0x35')](handleEntityNotFound(_0x653fe4,null))['then'](function(_0x194b50){if(_0x194b50){_0x3bf44b[_0x9216('0x2a')]=_0x194b50[_0x9216('0x72')]({'plain':!![]});return db[_0x9216('0x73')]['find']({'where':{'id':_0x194b50[_0x9216('0x66')]}});}return null;})[_0x9216('0x35')](handleEntityNotFound(_0x653fe4,null))[_0x9216('0x35')](function(_0x1598b2){if(_0x1598b2){_0x3bf44b[_0x9216('0x68')]=_0x1598b2[_0x9216('0x72')]({'plain':!![]});interaction_log[_0x9216('0x2b')](_0x9216('0x74'),_0x22a33c[_0x9216('0x63')]['id'],_0x22a33c['user']['name'],_0x22a33c[_0x9216('0x63')][_0x9216('0x6a')],_0x3bf44b[_0x9216('0x68')]['id'],_0x22a33c[_0x9216('0x59')]?JSON[_0x9216('0x28')](_0x22a33c[_0x9216('0x59')]):_0x9216('0x6b'));return respondWithRpcPromise('RejectMessage',_0x9216('0x75'),_0x3bf44b);}return null;})['then'](function(_0x465e1f){if(_0x465e1f){_0x465e1f['message']['interface']=util[_0x9216('0x60')](_0x9216('0x76'),_0x22a33c[_0x9216('0x63')][_0x9216('0x38')]);_0x465e1f[_0x9216('0x2a')][_0x9216('0x6e')]=_0x3bf44b[_0x9216('0x6e')];_0x465e1f[_0x9216('0x2a')][_0x9216('0x6f')]=_0x9216('0x34');respondWithRpcPromise(_0x9216('0x77'),_0x9216('0x77'),{'event':_0x9216('0x78'),'message':_0x465e1f[_0x9216('0x2a')]},client9002);return _0x3bf44b;}return null;})[_0x9216('0x35')](respondWithResult(_0x653fe4,null))[_0x9216('0x2c')](handleError(_0x653fe4,null));};exports[_0x9216('0x79')]=function(_0x5b5ee6,_0xcae80b){var _0x1643f6;return db[_0x9216('0x3c')][_0x9216('0x79')](_0x5b5ee6['body'],{})[_0x9216('0x35')](function(_0x379b26){_0x1643f6=_0x379b26;return db[_0x9216('0x64')][_0x9216('0x7a')]({'where':{'id':_0x1643f6['ContactId']}});})[_0x9216('0x35')](function(_0x3dad46){if(_[_0x9216('0x67')](_0x3dad46)){return;}else{_0x1643f6[_0x9216('0x5d')]=_0x3dad46[_0x9216('0x5d')];return db[_0x9216('0x7b')][_0x9216('0x7a')]({'where':{'id':_0x1643f6[_0x9216('0x7c')]}});}})[_0x9216('0x35')](function(_0x1a55e1){return respondWithRpcPromise(_0x9216('0x7d'),_0x9216('0x7d'),{'FaxAccountId':_[_0x9216('0x67')](_0x5b5ee6['body'])?undefined:_0x5b5ee6[_0x9216('0x59')]['FaxAccountId'],'path':_[_0x9216('0x67')](_0x1a55e1)?undefined:util[_0x9216('0x60')](_0x9216('0x7e'),_0x1a55e1[_0x9216('0x7f')]),'fax':_[_0x9216('0x67')](_0x1643f6['fax'])?undefined:_0x1643f6['fax'],'AttachmentId':_0x1643f6[_0x9216('0x7c')]},client9002);})[_0x9216('0x35')](respondWithResult(_0xcae80b,0xc9))[_0x9216('0x2c')](handleError(_0xcae80b,null));};exports[_0x9216('0x80')]=function(_0x2c81bf,_0x32f2e8){var _0x1d4180=path[_0x9216('0x81')](config[_0x9216('0x82')],_0x9216('0x83'),_0x9216('0x84'),_0x9216('0x85'));return db['FaxMessage'][_0x9216('0x57')]({'where':{'id':_0x2c81bf[_0x9216('0x53')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x9216('0x35')](handleEntityNotFound(_0x32f2e8,null))[_0x9216('0x35')](function(_0x102665){if(_0x102665){return _0x32f2e8[_0x9216('0x80')](path['join'](_0x1d4180,_0x102665['Attachment'][_0x9216('0x7f')]));}})[_0x9216('0x2c')](handleError(_0x32f2e8,null));}; \ No newline at end of file +var _0xab6a=['jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','destroy','stack','name','index','FaxMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','include','options','find','body','params','describe','fax','format','UserId','Contact','get','FaxInteraction','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','../../config/logger','fax-interactions','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0x46fc18,_0x28aa4a){var _0x4d5b73=function(_0x5b148e){while(--_0x5b148e){_0x46fc18['push'](_0x46fc18['shift']());}};_0x4d5b73(++_0x28aa4a);}(_0xab6a,0x177));var _0xaab6=function(_0x4b1b8a,_0x2a39c3){_0x4b1b8a=_0x4b1b8a-0x0;var _0x265b99=_0xab6a[_0x4b1b8a];return _0x265b99;};'use strict';var pdf=require(_0xaab6('0x0'));var emlformat=require(_0xaab6('0x1'));var rimraf=require(_0xaab6('0x2'));var zipdir=require(_0xaab6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaab6('0x4'));var moment=require('moment');var BPromise=require(_0xaab6('0x5'));var Mustache=require(_0xaab6('0x6'));var util=require(_0xaab6('0x7'));var path=require(_0xaab6('0x8'));var sox=require('sox');var csv=require(_0xaab6('0x9'));var ejs=require(_0xaab6('0xa'));var fs=require('fs');var _=require(_0xaab6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaab6('0xc'));var deskjs=require(_0xaab6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaab6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaab6('0xf'));var as=require(_0xaab6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaab6('0x12'));var db=require(_0xaab6('0x13'))['db'];config['redis']=_[_0xaab6('0x14')](config[_0xaab6('0x15')],{'host':_0xaab6('0x16'),'port':0x18eb});var socket=require(_0xaab6('0x17'))(new Redis(config[_0xaab6('0x15')]));require(_0xaab6('0x18'))[_0xaab6('0x19')](socket);var jayson=require(_0xaab6('0x1a'));var client=jayson[_0xaab6('0x1b')][_0xaab6('0x1c')]({'port':0x232c});var client9002=jayson[_0xaab6('0x1b')][_0xaab6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2dbce2,_0x3d7f5c,_0xac6795,_0x12f019){return new BPromise(function(_0x295131,_0x3292ad){var _0x33477d=_0x12f019||client;return _0x33477d[_0xaab6('0x1d')](_0x2dbce2,_0xac6795)[_0xaab6('0x1e')](function(_0x7a81f4){logger[_0xaab6('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x3d7f5c,_0xaab6('0x20'));logger[_0xaab6('0x21')](_0xaab6('0x22'),_0x3d7f5c,_0xaab6('0x20'),JSON[_0xaab6('0x23')](_0x7a81f4));if(_0x7a81f4[_0xaab6('0x24')]){if(_0x7a81f4[_0xaab6('0x24')]['code']===0x1f4){logger[_0xaab6('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3d7f5c,_0x7a81f4[_0xaab6('0x24')]['message']);return _0x3292ad(_0x7a81f4[_0xaab6('0x24')][_0xaab6('0x25')]);}logger['error'](_0xaab6('0x26'),_0x3d7f5c,_0x7a81f4[_0xaab6('0x24')][_0xaab6('0x25')]);return _0x295131(_0x7a81f4['error'][_0xaab6('0x25')]);}else{logger['info'](_0xaab6('0x26'),_0x3d7f5c,_0xaab6('0x20'));_0x295131(_0x7a81f4[_0xaab6('0x27')]['message']);}})[_0xaab6('0x28')](function(_0x980a41){logger[_0xaab6('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3d7f5c,_0x980a41);_0x3292ad(_0x980a41);});});}function respondWithStatusCode(_0x54de96,_0x4ef520){_0x4ef520=_0x4ef520||0xcc;return function(_0x4f96b4){if(_0x4f96b4){return _0x54de96[_0xaab6('0x29')](_0x4ef520);}return _0x54de96['status'](_0x4ef520)[_0xaab6('0x2a')]();};}function respondWithResult(_0x5f1cc8,_0x366e75){_0x366e75=_0x366e75||0xc8;return function(_0x2e5205){if(_0x2e5205){return _0x5f1cc8[_0xaab6('0x2b')](_0x366e75)[_0xaab6('0x2c')](_0x2e5205);}};}function respondWithFilteredResult(_0x582dd8,_0x119092){return function(_0x446460){if(_0x446460){var _0x4d085b=_0x446460[_0xaab6('0x2d')],_0x168032=_0x119092[_0xaab6('0x2e')],_0x39a8b6=_0x119092[_0xaab6('0x2e')]+_0x119092[_0xaab6('0x2f')],_0x140ae3;if(_0x39a8b6>=_0x4d085b){_0x39a8b6=_0x4d085b;_0x140ae3=0xc8;}else{_0x140ae3=0xce;}_0x582dd8[_0xaab6('0x2b')](_0x140ae3);return _0x582dd8[_0xaab6('0x30')]('Content-Range',_0x168032+'-'+_0x39a8b6+'/'+_0x4d085b)[_0xaab6('0x2c')](_0x446460);}return null;};}function patchUpdates(_0x29db78){return function(_0xf33fde){try{jsonpatch[_0xaab6('0x31')](_0xf33fde,_0x29db78,!![]);}catch(_0xff1540){return BPromise[_0xaab6('0x32')](_0xff1540);}return _0xf33fde[_0xaab6('0x33')]();};}function saveUpdates(_0x2cabe3,_0x2c8ab6){return function(_0x4f0fd7){if(_0x4f0fd7){return _0x4f0fd7['update'](_0x2cabe3)[_0xaab6('0x1e')](function(_0x14bb54){return _0x14bb54;});}return null;};}function removeEntity(_0x1fd87a,_0x127f53){return function(_0x3ca9e3){if(_0x3ca9e3){return _0x3ca9e3[_0xaab6('0x34')]()[_0xaab6('0x1e')](function(){_0x1fd87a[_0xaab6('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304a58,_0x394894){return function(_0x3c4665){if(!_0x3c4665){_0x304a58[_0xaab6('0x29')](0x194);}return _0x3c4665;};}function handleError(_0x342ecf,_0x139f7b){_0x139f7b=_0x139f7b||0x1f4;return function(_0xd44886){logger[_0xaab6('0x24')](_0xd44886[_0xaab6('0x35')]);if(_0xd44886[_0xaab6('0x36')]){delete _0xd44886[_0xaab6('0x36')];}_0x342ecf[_0xaab6('0x2b')](_0x139f7b)['send'](_0xd44886);};}exports[_0xaab6('0x37')]=function(_0x520c3c,_0x1b269a){var _0x529ddb={},_0x8d6826={},_0x1ad9e8={'count':0x0,'rows':[]};var _0x247447=_['map'](db[_0xaab6('0x38')][_0xaab6('0x39')],function(_0x3e9ad5){return{'name':_0x3e9ad5[_0xaab6('0x3a')],'type':_0x3e9ad5[_0xaab6('0x3b')][_0xaab6('0x3c')]};});_0x8d6826['model']=_[_0xaab6('0x3d')](_0x247447,'name');_0x8d6826[_0xaab6('0x3e')]=_[_0xaab6('0x3f')](_0x520c3c['query']);_0x8d6826[_0xaab6('0x40')]=_[_0xaab6('0x41')](_0x8d6826[_0xaab6('0x42')],_0x8d6826['query']);_0x529ddb[_0xaab6('0x43')]=_[_0xaab6('0x41')](_0x8d6826['model'],qs['fields'](_0x520c3c[_0xaab6('0x3e')]['fields']));_0x529ddb[_0xaab6('0x43')]=_0x529ddb[_0xaab6('0x43')][_0xaab6('0x44')]?_0x529ddb[_0xaab6('0x43')]:_0x8d6826['model'];if(!_0x520c3c[_0xaab6('0x3e')]['hasOwnProperty'](_0xaab6('0x45'))){_0x529ddb['limit']=qs[_0xaab6('0x2f')](_0x520c3c[_0xaab6('0x3e')][_0xaab6('0x2f')]);_0x529ddb[_0xaab6('0x2e')]=qs[_0xaab6('0x2e')](_0x520c3c['query']['offset']);}_0x529ddb[_0xaab6('0x46')]=qs[_0xaab6('0x47')](_0x520c3c['query'][_0xaab6('0x47')]);_0x529ddb[_0xaab6('0x48')]=qs[_0xaab6('0x40')](_[_0xaab6('0x49')](_0x520c3c[_0xaab6('0x3e')],_0x8d6826[_0xaab6('0x40')]),_0x247447);if(_0x520c3c[_0xaab6('0x3e')]['filter']){_0x529ddb[_0xaab6('0x48')]=_[_0xaab6('0x4a')](_0x529ddb[_0xaab6('0x48')],{'$or':_['map'](_0x247447,function(_0x47a431){if(_0x47a431[_0xaab6('0x3b')]!==_0xaab6('0x4b')){var _0x688d05={};_0x688d05[_0x47a431[_0xaab6('0x36')]]={'$like':'%'+_0x520c3c[_0xaab6('0x3e')][_0xaab6('0x4c')]+'%'};return _0x688d05;}})});}_0x529ddb=_[_0xaab6('0x4a')]({},_0x529ddb,_0x520c3c['options']);var _0x5f22a0={'where':_0x529ddb['where']};return db['FaxMessage'][_0xaab6('0x2d')](_0x5f22a0)[_0xaab6('0x1e')](function(_0x4e57a3){_0x1ad9e8[_0xaab6('0x2d')]=_0x4e57a3;if(_0x520c3c['query'][_0xaab6('0x4d')]){_0x529ddb['include']=[{'all':!![]}];}return db['FaxMessage'][_0xaab6('0x4e')](_0x529ddb);})[_0xaab6('0x1e')](function(_0x150bf5){_0x1ad9e8[_0xaab6('0x4f')]=_0x150bf5;return _0x1ad9e8;})['then'](respondWithFilteredResult(_0x1b269a,_0x529ddb))['catch'](handleError(_0x1b269a,null));};exports[_0xaab6('0x50')]=function(_0x34eaca,_0x1d0aba){var _0x6bc7f3={'raw':!![],'where':{'id':_0x34eaca['params']['id']}},_0x1f916b={};_0x1f916b[_0xaab6('0x42')]=_[_0xaab6('0x3f')](db[_0xaab6('0x38')]['rawAttributes']);_0x1f916b[_0xaab6('0x3e')]=_['keys'](_0x34eaca[_0xaab6('0x3e')]);_0x1f916b[_0xaab6('0x40')]=_[_0xaab6('0x41')](_0x1f916b[_0xaab6('0x42')],_0x1f916b['query']);_0x6bc7f3[_0xaab6('0x43')]=_[_0xaab6('0x41')](_0x1f916b['model'],qs['fields'](_0x34eaca[_0xaab6('0x3e')]['fields']));_0x6bc7f3[_0xaab6('0x43')]=_0x6bc7f3[_0xaab6('0x43')][_0xaab6('0x44')]?_0x6bc7f3[_0xaab6('0x43')]:_0x1f916b[_0xaab6('0x42')];if(_0x34eaca['query'][_0xaab6('0x4d')]){_0x6bc7f3[_0xaab6('0x51')]=[{'all':!![]}];}_0x6bc7f3=_['merge']({},_0x6bc7f3,_0x34eaca[_0xaab6('0x52')]);return db[_0xaab6('0x38')][_0xaab6('0x53')](_0x6bc7f3)[_0xaab6('0x1e')](handleEntityNotFound(_0x1d0aba,null))[_0xaab6('0x1e')](respondWithResult(_0x1d0aba,null))[_0xaab6('0x28')](handleError(_0x1d0aba,null));};exports['update']=function(_0x777e37,_0x3804b1){if(_0x777e37[_0xaab6('0x54')]['id']){delete _0x777e37[_0xaab6('0x54')]['id'];}return db[_0xaab6('0x38')][_0xaab6('0x53')]({'where':{'id':_0x777e37[_0xaab6('0x55')]['id']}})['then'](handleEntityNotFound(_0x3804b1,null))['then'](saveUpdates(_0x777e37['body'],null))[_0xaab6('0x1e')](respondWithResult(_0x3804b1,null))[_0xaab6('0x28')](handleError(_0x3804b1,null));};exports['destroy']=function(_0x4ebb75,_0x44df77){return db[_0xaab6('0x38')][_0xaab6('0x53')]({'where':{'id':_0x4ebb75['params']['id']}})[_0xaab6('0x1e')](handleEntityNotFound(_0x44df77,null))[_0xaab6('0x1e')](removeEntity(_0x44df77,null))[_0xaab6('0x28')](handleError(_0x44df77,null));};exports[_0xaab6('0x56')]=function(_0x725c00,_0x49ad21){return db[_0xaab6('0x38')][_0xaab6('0x56')]()[_0xaab6('0x1e')](respondWithResult(_0x49ad21,null))[_0xaab6('0x28')](handleError(_0x49ad21,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x2a9faa,_0x1f69fa,_0x2dc7e8){var _0x2d5bb8={'channel':_0xaab6('0x57')};if(_0x2a9faa[_0xaab6('0x54')]['id']){delete _0x2a9faa[_0xaab6('0x54')]['id'];}_0x2a9faa[_0xaab6('0x54')]['read']=!![];_0x2a9faa[_0xaab6('0x54')]['readAt']=moment()[_0xaab6('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a9faa[_0xaab6('0x54')][_0xaab6('0x59')]=_0x2a9faa[_0xaab6('0x54')][_0xaab6('0x59')]||_0x2a9faa['user']['id'];return db[_0xaab6('0x38')][_0xaab6('0x53')]({'where':{'id':_0x2a9faa['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xaab6('0x5a')}]})[_0xaab6('0x1e')](handleEntityNotFound(_0x1f69fa,null))[_0xaab6('0x1e')](saveUpdates(_0x2a9faa[_0xaab6('0x54')],null))[_0xaab6('0x1e')](function(_0x547fbe){if(_0x547fbe){_0x2d5bb8['message']=_0x547fbe[_0xaab6('0x5b')]({'plain':!![]});return db[_0xaab6('0x5c')][_0xaab6('0x53')]({'where':{'id':_0x547fbe[_0xaab6('0x5d')]}});}return null;})[_0xaab6('0x1e')](handleEntityNotFound(_0x1f69fa,null))['then'](function(_0x828e8e){if(_0x828e8e){return _0x828e8e['update']({'UserId':_0x2a9faa['body'][_0xaab6('0x59')],'read1stAt':_[_0xaab6('0x5e')](_0x828e8e['read1stAt'])?moment()[_0xaab6('0x58')](_0xaab6('0x5f')):undefined});}return null;})['then'](function(_0x2d3403){if(_0x2d3403){_0x2d5bb8[_0xaab6('0x60')]=_0x2d3403[_0xaab6('0x5b')]({'plain':!![]});interaction_log[_0xaab6('0x1f')](_0xaab6('0x61'),_0x2a9faa[_0xaab6('0x62')]['id'],_0x2a9faa[_0xaab6('0x62')][_0xaab6('0x36')],_0x2a9faa['user'][_0xaab6('0x63')],_0x2d5bb8[_0xaab6('0x60')]['id'],_0x2a9faa['body']?JSON[_0xaab6('0x23')](_0x2a9faa[_0xaab6('0x54')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2d5bb8);}return null;})[_0xaab6('0x1e')](function(_0x575f34){if(_0x575f34){if(_0x2a9faa['body']['manual']){_0x2d5bb8['message'][_0xaab6('0x64')]=util[_0xaab6('0x58')](_0xaab6('0x65'),_0x2a9faa[_0xaab6('0x62')][_0xaab6('0x36')]);_0x2d5bb8[_0xaab6('0x25')][_0xaab6('0x66')]=_0x2d5bb8['channel'];_0x2d5bb8['message'][_0xaab6('0x67')]=_0xaab6('0x68');return respondWithRpcPromise('EventManager',_0xaab6('0x69'),{'event':_0xaab6('0x6a'),'message':_0x2d5bb8[_0xaab6('0x25')]},client9002)[_0xaab6('0x1e')](function(){return _0x2d5bb8;});}return _0x2d5bb8;}return null;})[_0xaab6('0x1e')](respondWithResult(_0x1f69fa,null))[_0xaab6('0x28')](handleError(_0x1f69fa,null));};var interaction_log=require(_0xaab6('0x6b'))(_0xaab6('0x6c'));exports['reject']=function(_0x5e4d3d,_0x3321b1,_0x531c2a){var _0xc82721={'agent':{},'channel':_0xaab6('0x57')};if(_0x5e4d3d['body']['id']){delete _0x5e4d3d[_0xaab6('0x54')]['id'];}_0x5e4d3d[_0xaab6('0x54')][_0xaab6('0x59')]=_0x5e4d3d[_0xaab6('0x54')][_0xaab6('0x59')]||_0x5e4d3d[_0xaab6('0x62')]['id'];_0xc82721[_0xaab6('0x6d')]['id']=_0x5e4d3d[_0xaab6('0x54')][_0xaab6('0x59')];return db['FaxMessage']['find']({'where':{'id':_0x5e4d3d[_0xaab6('0x55')]['id'],'UserId':null}})[_0xaab6('0x1e')](handleEntityNotFound(_0x3321b1,null))[_0xaab6('0x1e')](function(_0x57c7c2){if(_0x57c7c2){_0xc82721[_0xaab6('0x25')]=_0x57c7c2[_0xaab6('0x5b')]({'plain':!![]});return db[_0xaab6('0x5c')]['find']({'where':{'id':_0x57c7c2['FaxInteractionId']}});}return null;})[_0xaab6('0x1e')](handleEntityNotFound(_0x3321b1,null))['then'](function(_0x2b3984){if(_0x2b3984){_0xc82721[_0xaab6('0x60')]=_0x2b3984[_0xaab6('0x5b')]({'plain':!![]});interaction_log[_0xaab6('0x1f')](_0xaab6('0x6e'),_0x5e4d3d['user']['id'],_0x5e4d3d[_0xaab6('0x62')]['name'],_0x5e4d3d[_0xaab6('0x62')]['role'],_0xc82721[_0xaab6('0x60')]['id'],_0x5e4d3d[_0xaab6('0x54')]?JSON[_0xaab6('0x23')](_0x5e4d3d[_0xaab6('0x54')]):'null');return respondWithRpcPromise(_0xaab6('0x6f'),_0xaab6('0x70'),_0xc82721);}return null;})[_0xaab6('0x1e')](function(_0x440bd6){if(_0x440bd6){_0x440bd6[_0xaab6('0x25')][_0xaab6('0x64')]=util[_0xaab6('0x58')]('SIP/%s',_0x5e4d3d[_0xaab6('0x62')]['name']);_0x440bd6[_0xaab6('0x25')][_0xaab6('0x66')]=_0xc82721[_0xaab6('0x66')];_0x440bd6[_0xaab6('0x25')][_0xaab6('0x67')]=_0xaab6('0x32');respondWithRpcPromise('EventManager',_0xaab6('0x69'),{'event':_0xaab6('0x71'),'message':_0x440bd6[_0xaab6('0x25')]},client9002);return _0xc82721;}return null;})[_0xaab6('0x1e')](respondWithResult(_0x3321b1,null))[_0xaab6('0x28')](handleError(_0x3321b1,null));};exports[_0xaab6('0x72')]=function(_0x3e8525,_0x2d3bb0){var _0x597bdd;return db[_0xaab6('0x38')]['create'](_0x3e8525['body'],{})[_0xaab6('0x1e')](function(_0x4e5d0b){_0x597bdd=_0x4e5d0b;return db[_0xaab6('0x73')][_0xaab6('0x74')]({'where':{'id':_0x597bdd[_0xaab6('0x75')]}});})['then'](function(_0x26a3dc){if(_[_0xaab6('0x5e')](_0x26a3dc)){return;}else{_0x597bdd[_0xaab6('0x57')]=_0x26a3dc[_0xaab6('0x57')];return db[_0xaab6('0x76')]['findOne']({'where':{'id':_0x597bdd[_0xaab6('0x77')]}});}})[_0xaab6('0x1e')](function(_0x3c87f8){return respondWithRpcPromise(_0xaab6('0x78'),_0xaab6('0x78'),{'FaxAccountId':_[_0xaab6('0x5e')](_0x3e8525[_0xaab6('0x54')])?undefined:_0x3e8525[_0xaab6('0x54')]['FaxAccountId'],'path':_[_0xaab6('0x5e')](_0x3c87f8)?undefined:util[_0xaab6('0x58')](_0xaab6('0x79'),_0x3c87f8[_0xaab6('0x7a')]),'fax':_['isNil'](_0x597bdd[_0xaab6('0x57')])?undefined:_0x597bdd[_0xaab6('0x57')],'AttachmentId':_0x597bdd[_0xaab6('0x77')]},client9002);})[_0xaab6('0x1e')](respondWithResult(_0x2d3bb0,0xc9))[_0xaab6('0x28')](handleError(_0x2d3bb0,null));};exports[_0xaab6('0x7b')]=function(_0xc0520d,_0x367881){var _0x1ffc26=path[_0xaab6('0x7c')](config[_0xaab6('0x7d')],_0xaab6('0x7e'),_0xaab6('0x7f'),_0xaab6('0x80'));return db[_0xaab6('0x38')][_0xaab6('0x53')]({'where':{'id':_0xc0520d[_0xaab6('0x55')]['id']},'include':[{'model':db[_0xaab6('0x76')],'as':_0xaab6('0x76')}]})['then'](handleEntityNotFound(_0x367881,null))[_0xaab6('0x1e')](function(_0x59aad8){if(_0x59aad8){return _0x367881[_0xaab6('0x7b')](path['join'](_0x1ffc26,_0x59aad8[_0xaab6('0x76')][_0xaab6('0x7a')]));}})['catch'](handleError(_0x367881,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 7ecbf6d..53825f1 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x55ca,0x126));var _0xa55c=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0x55ca[_0x561049];return _0x52f109;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x287acf,_0x15b6c9){_0x287acf=_0x287acf-0x0;var _0x22a043=_0xe14b[_0x287acf];return _0x22a043;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d51b662..4478290 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 _0x1c47=['FaxMessage','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','define'];(function(_0x2164e8,_0x1bdd23){var _0x39ced7=function(_0x30714e){while(--_0x30714e){_0x2164e8['push'](_0x2164e8['shift']());}};_0x39ced7(++_0x1bdd23);}(_0x1c47,0x116));var _0x71c4=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x1c47[_0x51bda1];return _0x1ce08c;};'use strict';var _=require(_0x71c4('0x0'));var util=require(_0x71c4('0x1'));var logger=require(_0x71c4('0x2'))(_0x71c4('0x3'));var moment=require('moment');var BPromise=require(_0x71c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c4('0x5'));var rimraf=require('rimraf');var config=require(_0x71c4('0x6'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x531fb2,_0x2d2ed6){return _0x531fb2[_0x71c4('0x7')](_0x71c4('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x71c4('0x9')],'type':_0x71c4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b88ab,_0x2413e9,_0x35aab2){var _0x1f38d6=_0x531fb2[_0x71c4('0xb')];var _0x501128=_0x2b88ab[_0x71c4('0xc')]({'plain':!![]});if(_0x501128[_0x71c4('0xd')]['toLowerCase']()==='in'||_0x501128[_0x71c4('0xd')][_0x71c4('0xe')]()==='out'&&!_0x501128[_0x71c4('0xf')]&&!_[_0x71c4('0x10')](_0x501128[_0x71c4('0x11')])){_0x1f38d6['FaxInteraction'][_0x71c4('0x12')]({'where':{'id':_0x501128[_0x71c4('0x13')]}})['then'](function(_0x12d35d){if(_0x12d35d){_0x12d35d[_0x71c4('0x14')]({'lastMsgAt':_0x501128[_0x71c4('0x15')],'lastMsgDirection':_0x501128[_0x71c4('0xd')][_0x71c4('0xe')]()});}})[_0x71c4('0x16')](function(_0x1f30db){console[_0x71c4('0x17')](_0x1f30db);});}_0x35aab2();}},'charset':_0x71c4('0x18'),'collate':_0x71c4('0x19')});}; \ No newline at end of file +var _0x9d01=['body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','FaxInteraction','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages'];(function(_0x153cb0,_0x3fd51d){var _0x23eec9=function(_0x103431){while(--_0x103431){_0x153cb0['push'](_0x153cb0['shift']());}};_0x23eec9(++_0x3fd51d);}(_0x9d01,0x66));var _0x19d0=function(_0x41b0d5,_0x2f7baa){_0x41b0d5=_0x41b0d5-0x0;var _0xb9c58b=_0x9d01[_0x41b0d5];return _0xb9c58b;};'use strict';var _=require(_0x19d0('0x0'));var util=require(_0x19d0('0x1'));var logger=require(_0x19d0('0x2'))(_0x19d0('0x3'));var moment=require(_0x19d0('0x4'));var BPromise=require('bluebird');var rp=require(_0x19d0('0x5'));var fs=require('fs');var path=require(_0x19d0('0x6'));var rimraf=require(_0x19d0('0x7'));var config=require(_0x19d0('0x8'));var attributes=require(_0x19d0('0x9'));module[_0x19d0('0xa')]=function(_0x3369db,_0x589c57){return _0x3369db['define'](_0x19d0('0xb'),attributes,{'tableName':_0x19d0('0xc'),'paranoid':![],'indexes':[{'name':_0x19d0('0xd'),'fields':[_0x19d0('0xe')],'type':_0x19d0('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d01cd,_0x1c2121,_0x607913){var _0xe385f1=_0x3369db[_0x19d0('0x10')];var _0x1850bc=_0x5d01cd[_0x19d0('0x11')]({'plain':!![]});if(_0x1850bc[_0x19d0('0x12')][_0x19d0('0x13')]()==='in'||_0x1850bc[_0x19d0('0x12')][_0x19d0('0x13')]()==='out'&&!_0x1850bc[_0x19d0('0x14')]&&!_[_0x19d0('0x15')](_0x1850bc['UserId'])){_0xe385f1[_0x19d0('0x16')]['findOne']({'where':{'id':_0x1850bc['FaxInteractionId']}})[_0x19d0('0x17')](function(_0x543814){if(_0x543814){_0x543814[_0x19d0('0x18')]({'lastMsgAt':_0x1850bc['createdAt'],'lastMsgDirection':_0x1850bc[_0x19d0('0x12')][_0x19d0('0x13')]()});}})[_0x19d0('0x19')](function(_0x1c8f02){console[_0x19d0('0x1a')](_0x1c8f02);});}_0x607913();}},'charset':_0x19d0('0x1b'),'collate':_0x19d0('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 57e9038..91880c1 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 _0xa710=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','lodash','util'];(function(_0xb8b795,_0x5e6eb3){var _0x52dc5d=function(_0x30ef38){while(--_0x30ef38){_0xb8b795['push'](_0xb8b795['shift']());}};_0x52dc5d(++_0x5e6eb3);}(_0xa710,0x108));var _0x0a71=function(_0x2586df,_0x17558e){_0x2586df=_0x2586df-0x0;var _0x5bc581=_0xa710[_0x2586df];return _0x5bc581;};'use strict';var _=require(_0x0a71('0x0'));var util=require(_0x0a71('0x1'));var moment=require(_0x0a71('0x2'));var BPromise=require(_0x0a71('0x3'));var rs=require(_0x0a71('0x4'));var fs=require('fs');var Redis=require(_0x0a71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a71('0x6'));var logger=require(_0x0a71('0x7'))(_0x0a71('0x8'));var config=require(_0x0a71('0x9'));var jayson=require(_0x0a71('0xa'));var client=jayson[_0x0a71('0xb')]['http']({'port':0x232a});config['redis']=_[_0x0a71('0xc')](config[_0x0a71('0xd')],{'host':_0x0a71('0xe'),'port':0x18eb});var socket=require(_0x0a71('0xf'))(new Redis(config[_0x0a71('0xd')]));require(_0x0a71('0x10'))[_0x0a71('0x11')](socket);function respondWithRpcPromise(_0xd4fb98,_0x387419,_0x1ccddf){return new BPromise(function(_0x12ec15,_0x5c6938){return client['request'](_0xd4fb98,_0x1ccddf)[_0x0a71('0x12')](function(_0x5e7e37){logger[_0x0a71('0x13')](_0x0a71('0x14'),_0x387419,_0x0a71('0x15'));logger[_0x0a71('0x16')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x387419,_0x0a71('0x15'),JSON[_0x0a71('0x17')](_0x5e7e37));if(_0x5e7e37['error']){if(_0x5e7e37['error'][_0x0a71('0x18')]===0x1f4){logger[_0x0a71('0x19')](_0x0a71('0x14'),_0x387419,_0x5e7e37[_0x0a71('0x19')][_0x0a71('0x1a')]);return _0x5c6938(_0x5e7e37['error']['message']);}logger[_0x0a71('0x19')](_0x0a71('0x14'),_0x387419,_0x5e7e37[_0x0a71('0x19')]['message']);return _0x12ec15(_0x5e7e37[_0x0a71('0x19')][_0x0a71('0x1a')]);}else{logger[_0x0a71('0x13')](_0x0a71('0x14'),_0x387419,_0x0a71('0x15'));_0x12ec15(_0x5e7e37[_0x0a71('0x1b')][_0x0a71('0x1a')]);}})[_0x0a71('0x1c')](function(_0x36678c){logger[_0x0a71('0x19')](_0x0a71('0x14'),_0x387419,_0x36678c);_0x5c6938(_0x36678c);});});}exports['CreateFaxMessage']=function(_0x3d839f){var _0x532ebc=this;return new Promise(function(_0x242c88,_0x58c197){return db[_0x0a71('0x1d')]['create'](_0x3d839f[_0x0a71('0x1e')],{'raw':_0x3d839f[_0x0a71('0x1f')]?_0x3d839f[_0x0a71('0x1f')][_0x0a71('0x20')]===undefined?!![]:![]:!![]})[_0x0a71('0x12')](function(_0x254163){logger['info'](_0x0a71('0x21'),_0x3d839f);logger['debug']('CreateFaxMessage',_0x3d839f,JSON[_0x0a71('0x17')](_0x254163));_0x242c88(_0x254163);})[_0x0a71('0x1c')](function(_0x384719){logger[_0x0a71('0x19')](_0x0a71('0x21'),_0x384719[_0x0a71('0x1a')],_0x3d839f);_0x58c197(_0x532ebc[_0x0a71('0x19')](0x1f4,_0x384719[_0x0a71('0x1a')]));});});};exports[_0x0a71('0x22')]=function(_0x29ff66){var _0x2a3b33=this;return new Promise(function(_0x1b893e,_0x2e1ae5){return db[_0x0a71('0x1d')][_0x0a71('0x23')](_0x29ff66['body'],{'raw':_0x29ff66[_0x0a71('0x1f')]?_0x29ff66['options'][_0x0a71('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29ff66[_0x0a71('0x1f')]?_0x29ff66[_0x0a71('0x1f')][_0x0a71('0x24')]||null:null,'attributes':_0x29ff66[_0x0a71('0x1f')]?_0x29ff66[_0x0a71('0x1f')][_0x0a71('0x25')]||null:null,'limit':_0x29ff66[_0x0a71('0x1f')]?_0x29ff66[_0x0a71('0x1f')]['limit']||null:null})[_0x0a71('0x12')](function(_0x8cb911){logger[_0x0a71('0x13')]('UpdateFaxMessage',_0x29ff66);logger[_0x0a71('0x16')]('UpdateFaxMessage',_0x29ff66,JSON[_0x0a71('0x17')](_0x8cb911));_0x1b893e(_0x8cb911);})[_0x0a71('0x1c')](function(_0x5610a){logger[_0x0a71('0x19')](_0x0a71('0x22'),_0x5610a['message'],_0x29ff66);_0x2e1ae5(_0x2a3b33[_0x0a71('0x19')](0x1f4,_0x5610a[_0x0a71('0x1a')]));});});}; \ No newline at end of file +var _0xa0bb=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','raw','then','stringify','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring'];(function(_0x18fb8e,_0x565511){var _0x17ccfc=function(_0x18ce1a){while(--_0x18ce1a){_0x18fb8e['push'](_0x18fb8e['shift']());}};_0x17ccfc(++_0x565511);}(_0xa0bb,0x163));var _0xba0b=function(_0x162b7a,_0x5572f3){_0x162b7a=_0x162b7a-0x0;var _0x5eeae1=_0xa0bb[_0x162b7a];return _0x5eeae1;};'use strict';var _=require(_0xba0b('0x0'));var util=require(_0xba0b('0x1'));var moment=require(_0xba0b('0x2'));var BPromise=require(_0xba0b('0x3'));var rs=require(_0xba0b('0x4'));var fs=require('fs');var Redis=require(_0xba0b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba0b('0x6'));var logger=require('../../config/logger')(_0xba0b('0x7'));var config=require(_0xba0b('0x8'));var jayson=require(_0xba0b('0x9'));var client=jayson[_0xba0b('0xa')][_0xba0b('0xb')]({'port':0x232a});config[_0xba0b('0xc')]=_[_0xba0b('0xd')](config[_0xba0b('0xc')],{'host':_0xba0b('0xe'),'port':0x18eb});var socket=require(_0xba0b('0xf'))(new Redis(config['redis']));require(_0xba0b('0x10'))[_0xba0b('0x11')](socket);function respondWithRpcPromise(_0x1b977b,_0x11cc2c,_0x169578){return new BPromise(function(_0x3215bc,_0x984800){return client[_0xba0b('0x12')](_0x1b977b,_0x169578)['then'](function(_0x44839f){logger['info'](_0xba0b('0x13'),_0x11cc2c,_0xba0b('0x14'));logger[_0xba0b('0x15')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x11cc2c,_0xba0b('0x14'),JSON['stringify'](_0x44839f));if(_0x44839f['error']){if(_0x44839f[_0xba0b('0x16')][_0xba0b('0x17')]===0x1f4){logger[_0xba0b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x11cc2c,_0x44839f[_0xba0b('0x16')][_0xba0b('0x18')]);return _0x984800(_0x44839f[_0xba0b('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x11cc2c,_0x44839f['error'][_0xba0b('0x18')]);return _0x3215bc(_0x44839f[_0xba0b('0x16')][_0xba0b('0x18')]);}else{logger[_0xba0b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x11cc2c,_0xba0b('0x14'));_0x3215bc(_0x44839f[_0xba0b('0x1a')][_0xba0b('0x18')]);}})[_0xba0b('0x1b')](function(_0x2128fc){logger[_0xba0b('0x16')](_0xba0b('0x13'),_0x11cc2c,_0x2128fc);_0x984800(_0x2128fc);});});}exports[_0xba0b('0x1c')]=function(_0x20ef41){var _0x3aa64b=this;return new Promise(function(_0x2d142e,_0x2ecafd){return db[_0xba0b('0x1d')][_0xba0b('0x1e')](_0x20ef41[_0xba0b('0x1f')],{'raw':_0x20ef41['options']?_0x20ef41['options'][_0xba0b('0x20')]===undefined?!![]:![]:!![]})[_0xba0b('0x21')](function(_0x43e909){logger['info'](_0xba0b('0x1c'),_0x20ef41);logger['debug']('CreateFaxMessage',_0x20ef41,JSON[_0xba0b('0x22')](_0x43e909));_0x2d142e(_0x43e909);})[_0xba0b('0x1b')](function(_0x948d28){logger[_0xba0b('0x16')](_0xba0b('0x1c'),_0x948d28[_0xba0b('0x18')],_0x20ef41);_0x2ecafd(_0x3aa64b[_0xba0b('0x16')](0x1f4,_0x948d28[_0xba0b('0x18')]));});});};exports[_0xba0b('0x23')]=function(_0x1dfbc4){var _0x2223a2=this;return new Promise(function(_0x4de107,_0x277c99){return db[_0xba0b('0x1d')][_0xba0b('0x24')](_0x1dfbc4[_0xba0b('0x1f')],{'raw':_0x1dfbc4[_0xba0b('0x25')]?_0x1dfbc4[_0xba0b('0x25')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfbc4[_0xba0b('0x25')]?_0x1dfbc4[_0xba0b('0x25')][_0xba0b('0x26')]||null:null,'attributes':_0x1dfbc4['options']?_0x1dfbc4[_0xba0b('0x25')][_0xba0b('0x27')]||null:null,'limit':_0x1dfbc4[_0xba0b('0x25')]?_0x1dfbc4['options']['limit']||null:null})['then'](function(_0x1281e7){logger[_0xba0b('0x19')](_0xba0b('0x23'),_0x1dfbc4);logger[_0xba0b('0x15')](_0xba0b('0x23'),_0x1dfbc4,JSON[_0xba0b('0x22')](_0x1281e7));_0x4de107(_0x1281e7);})['catch'](function(_0x181819){logger[_0xba0b('0x16')](_0xba0b('0x23'),_0x181819[_0xba0b('0x18')],_0x1dfbc4);_0x277c99(_0x2223a2[_0xba0b('0x16')](0x1f4,_0x181819['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ef0dabd..ffa2c20 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(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4adf2eb..2a6fe85 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 _0xafd0=['/:id/download','download','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xafd0,0xb3));var _0x0afd=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xafd0[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x0afd('0x0'));var util=require(_0x0afd('0x1'));var path=require(_0x0afd('0x2'));var timeout=require(_0x0afd('0x3'));var express=require(_0x0afd('0x4'));var router=express[_0x0afd('0x5')]();var auth=require(_0x0afd('0x6'));var interaction=require(_0x0afd('0x7'));var config=require(_0x0afd('0x8'));var controller=require(_0x0afd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0afd('0xa')]);router[_0x0afd('0xb')](_0x0afd('0xc'),auth[_0x0afd('0xd')](),controller[_0x0afd('0xe')]);router[_0x0afd('0xb')](_0x0afd('0xf'),auth['isAuthenticated'](),controller[_0x0afd('0x10')]);router['get'](_0x0afd('0x11'),auth[_0x0afd('0xd')](),controller[_0x0afd('0x12')]);router[_0x0afd('0x13')]('/',auth[_0x0afd('0xd')](),interaction['tracked'](_0x0afd('0x14'),_0x0afd('0x15')),controller['create']);router[_0x0afd('0x16')](_0x0afd('0xf'),auth[_0x0afd('0xd')](),controller[_0x0afd('0x17')]);router[_0x0afd('0x16')](_0x0afd('0x18'),auth['isAuthenticated'](),controller[_0x0afd('0x19')]);router[_0x0afd('0x16')](_0x0afd('0x1a'),auth[_0x0afd('0xd')](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0afd('0x1b')]=router; \ No newline at end of file +var _0xc7b9=['tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post'];(function(_0x2176d9,_0x33923a){var _0x86c771=function(_0x129684){while(--_0x129684){_0x2176d9['push'](_0x2176d9['shift']());}};_0x86c771(++_0x33923a);}(_0xc7b9,0x1a1));var _0x9c7b=function(_0x9f05bc,_0x2d9fcd){_0x9f05bc=_0x9f05bc-0x0;var _0x5b1b24=_0xc7b9[_0x9f05bc];return _0x5b1b24;};'use strict';var multer=require(_0x9c7b('0x0'));var util=require('util');var path=require(_0x9c7b('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c7b('0x2'));var router=express[_0x9c7b('0x3')]();var auth=require(_0x9c7b('0x4'));var interaction=require(_0x9c7b('0x5'));var config=require(_0x9c7b('0x6'));var controller=require(_0x9c7b('0x7'));router[_0x9c7b('0x8')]('/',auth[_0x9c7b('0x9')](),controller[_0x9c7b('0xa')]);router['get'](_0x9c7b('0xb'),auth[_0x9c7b('0x9')](),controller[_0x9c7b('0xc')]);router[_0x9c7b('0x8')](_0x9c7b('0xd'),auth[_0x9c7b('0x9')](),controller[_0x9c7b('0xe')]);router[_0x9c7b('0x8')](_0x9c7b('0xf'),auth[_0x9c7b('0x9')](),controller[_0x9c7b('0x10')]);router[_0x9c7b('0x11')]('/',auth[_0x9c7b('0x9')](),interaction[_0x9c7b('0x12')](_0x9c7b('0x13'),_0x9c7b('0x14')),controller[_0x9c7b('0x15')]);router[_0x9c7b('0x16')](_0x9c7b('0xd'),auth[_0x9c7b('0x9')](),controller[_0x9c7b('0x17')]);router[_0x9c7b('0x16')](_0x9c7b('0x18'),auth[_0x9c7b('0x9')](),controller['accept']);router[_0x9c7b('0x16')](_0x9c7b('0x19'),auth[_0x9c7b('0x9')](),controller[_0x9c7b('0x1a')]);router[_0x9c7b('0x1b')](_0x9c7b('0xd'),auth[_0x9c7b('0x9')](),controller['destroy']);module[_0x9c7b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e528ebe..1c2c8b6 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 _0x9f80=['INTEGER','sequelize','STRING','ENUM','beepall'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x9f80,0x105));var _0x09f8=function(_0x4c28a2,_0x26d4da){_0x4c28a2=_0x4c28a2-0x0;var _0x4473ca=_0x9f80[_0x4c28a2];return _0x4473ca;};'use strict';var Sequelize=require(_0x09f8('0x0'));module['exports']={'name':{'type':Sequelize[_0x09f8('0x1')],'unique':'name','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[_0x09f8('0x2')]('rrmemory',_0x09f8('0x3'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x09f8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x380a=['exports','STRING','rrmemory','INTEGER','sequelize'];(function(_0x342930,_0x3f5bd9){var _0x48e45f=function(_0x13332b){while(--_0x13332b){_0x342930['push'](_0x342930['shift']());}};_0x48e45f(++_0x3f5bd9);}(_0x380a,0x16c));var _0xa380=function(_0x476137,_0x1ccb32){_0x476137=_0x476137-0x0;var _0x5acaf8=_0x380a[_0x476137];return _0x5acaf8;};'use strict';var Sequelize=require(_0xa380('0x0'));module[_0xa380('0x1')]={'name':{'type':Sequelize[_0xa380('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa380('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa380('0x3'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa380('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8a19e0a..3600cd6 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 _0xb44b=['util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','json','offset','limit','set','Content-Range','apply','save','update','then','get','FaxQueues','destroy','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','FaxQueueId','options','findAll','User','findAndCountAll','agent','faxPause','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x135188,_0x1afd71){var _0x371f9e=function(_0x48a4bf){while(--_0x48a4bf){_0x135188['push'](_0x135188['shift']());}};_0x371f9e(++_0x1afd71);}(_0xb44b,0x118));var _0xbb44=function(_0x167b19,_0x56081a){_0x167b19=_0x167b19-0x0;var _0x1fcca2=_0xb44b[_0x167b19];return _0x1fcca2;};'use strict';var pdf=require(_0xbb44('0x0'));var emlformat=require(_0xbb44('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb44('0x2'));var jsonpatch=require(_0xbb44('0x3'));var rp=require(_0xbb44('0x4'));var moment=require(_0xbb44('0x5'));var BPromise=require(_0xbb44('0x6'));var Mustache=require(_0xbb44('0x7'));var util=require(_0xbb44('0x8'));var path=require(_0xbb44('0x9'));var sox=require(_0xbb44('0xa'));var csv=require('to-csv');var ejs=require(_0xbb44('0xb'));var fs=require('fs');var _=require(_0xbb44('0xc'));var squel=require(_0xbb44('0xd'));var crypto=require('crypto');var jsforce=require(_0xbb44('0xe'));var deskjs=require(_0xbb44('0xf'));var toCsv=require(_0xbb44('0x10'));var querystring=require(_0xbb44('0x11'));var Papa=require(_0xbb44('0x12'));var Redis=require(_0xbb44('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbb44('0x14'));var as=require(_0xbb44('0x15'));var hardwareService=require(_0xbb44('0x16'));var logger=require(_0xbb44('0x17'))('api');var utils=require(_0xbb44('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbb44('0x19'));var db=require(_0xbb44('0x1a'))['db'];config['redis']=_[_0xbb44('0x1b')](config[_0xbb44('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb44('0x1d'))(new Redis(config[_0xbb44('0x1c')]));require('./faxQueue.socket')[_0xbb44('0x1e')](socket);function respondWithStatusCode(_0x3a2985,_0x5c5a00){_0x5c5a00=_0x5c5a00||0xcc;return function(_0x3e605a){if(_0x3e605a){return _0x3a2985['sendStatus'](_0x5c5a00);}return _0x3a2985[_0xbb44('0x1f')](_0x5c5a00)['end']();};}function respondWithResult(_0x5325ee,_0x3c9324){_0x3c9324=_0x3c9324||0xc8;return function(_0x16142c){if(_0x16142c){return _0x5325ee['status'](_0x3c9324)[_0xbb44('0x20')](_0x16142c);}};}function respondWithFilteredResult(_0x494445,_0x43141f){return function(_0x18556d){if(_0x18556d){var _0x654191=_0x18556d['count'],_0x326820=_0x43141f[_0xbb44('0x21')],_0x2abe0b=_0x43141f[_0xbb44('0x21')]+_0x43141f[_0xbb44('0x22')],_0x5bd8ab;if(_0x2abe0b>=_0x654191){_0x2abe0b=_0x654191;_0x5bd8ab=0xc8;}else{_0x5bd8ab=0xce;}_0x494445[_0xbb44('0x1f')](_0x5bd8ab);return _0x494445[_0xbb44('0x23')](_0xbb44('0x24'),_0x326820+'-'+_0x2abe0b+'/'+_0x654191)[_0xbb44('0x20')](_0x18556d);}return null;};}function patchUpdates(_0x46e29e){return function(_0x242467){try{jsonpatch[_0xbb44('0x25')](_0x242467,_0x46e29e,!![]);}catch(_0x39912b){return BPromise['reject'](_0x39912b);}return _0x242467[_0xbb44('0x26')]();};}function saveUpdates(_0x1b9a8,_0x226afd){return function(_0x52f944){if(_0x52f944){return _0x52f944[_0xbb44('0x27')](_0x1b9a8)[_0xbb44('0x28')](function(_0x41f867){return _0x41f867;});}return null;};}function removeEntity(_0x43562c,_0x5796ea){return function(_0x4ef032){if(_0x4ef032){return _0x4ef032['destroy']()['then'](function(){var _0x30020f=_0x4ef032[_0xbb44('0x29')]({'plain':!![]});var _0x32d9a2=_0xbb44('0x2a');return db['UserProfileResource'][_0xbb44('0x2b')]({'where':{'type':_0x32d9a2,'resourceId':_0x30020f['id']}})['then'](function(){return _0x4ef032;});})['then'](function(){_0x43562c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5147a8,_0x37a3e9){return function(_0x198e3a){if(!_0x198e3a){_0x5147a8[_0xbb44('0x2c')](0x194);}return _0x198e3a;};}function handleError(_0xc92ce2,_0x4003c6){_0x4003c6=_0x4003c6||0x1f4;return function(_0x5a63ff){logger[_0xbb44('0x2d')](_0x5a63ff[_0xbb44('0x2e')]);if(_0x5a63ff[_0xbb44('0x2f')]){delete _0x5a63ff[_0xbb44('0x2f')];}_0xc92ce2['status'](_0x4003c6)[_0xbb44('0x30')](_0x5a63ff);};}exports[_0xbb44('0x31')]=function(_0x2f20d0,_0x2b69f3){var _0x4b377d={},_0x5696d4={},_0x4c8491={'count':0x0,'rows':[]};var _0x51c64c=_[_0xbb44('0x32')](db[_0xbb44('0x33')][_0xbb44('0x34')],function(_0x33cfd0){return{'name':_0x33cfd0[_0xbb44('0x35')],'type':_0x33cfd0[_0xbb44('0x36')]['key']};});_0x5696d4[_0xbb44('0x37')]=_[_0xbb44('0x32')](_0x51c64c,'name');_0x5696d4['query']=_[_0xbb44('0x38')](_0x2f20d0[_0xbb44('0x39')]);_0x5696d4[_0xbb44('0x3a')]=_['intersection'](_0x5696d4['model'],_0x5696d4[_0xbb44('0x39')]);_0x4b377d[_0xbb44('0x3b')]=_[_0xbb44('0x3c')](_0x5696d4[_0xbb44('0x37')],qs['fields'](_0x2f20d0[_0xbb44('0x39')][_0xbb44('0x3d')]));_0x4b377d[_0xbb44('0x3b')]=_0x4b377d[_0xbb44('0x3b')][_0xbb44('0x3e')]?_0x4b377d[_0xbb44('0x3b')]:_0x5696d4['model'];if(!_0x2f20d0[_0xbb44('0x39')][_0xbb44('0x3f')](_0xbb44('0x40'))){_0x4b377d[_0xbb44('0x22')]=qs[_0xbb44('0x22')](_0x2f20d0['query'][_0xbb44('0x22')]);_0x4b377d['offset']=qs[_0xbb44('0x21')](_0x2f20d0[_0xbb44('0x39')][_0xbb44('0x21')]);}_0x4b377d[_0xbb44('0x41')]=qs[_0xbb44('0x42')](_0x2f20d0[_0xbb44('0x39')]['sort']);_0x4b377d[_0xbb44('0x43')]=qs[_0xbb44('0x3a')](_[_0xbb44('0x44')](_0x2f20d0['query'],_0x5696d4[_0xbb44('0x3a')]),_0x51c64c);if(_0x2f20d0[_0xbb44('0x39')][_0xbb44('0x45')]){_0x4b377d[_0xbb44('0x43')]=_[_0xbb44('0x46')](_0x4b377d[_0xbb44('0x43')],{'$or':_[_0xbb44('0x32')](_0x51c64c,function(_0x1d59f4){if(_0x1d59f4[_0xbb44('0x36')]!=='VIRTUAL'){var _0x3af30b={};_0x3af30b[_0x1d59f4['name']]={'$like':'%'+_0x2f20d0[_0xbb44('0x39')][_0xbb44('0x45')]+'%'};return _0x3af30b;}})});}_0x4b377d=_[_0xbb44('0x46')]({},_0x4b377d,_0x2f20d0['options']);var _0x63f9db={'where':_0x4b377d[_0xbb44('0x43')]};return db[_0xbb44('0x33')][_0xbb44('0x47')](_0x63f9db)[_0xbb44('0x28')](function(_0x3dbcf9){_0x4c8491[_0xbb44('0x47')]=_0x3dbcf9;if(_0x2f20d0[_0xbb44('0x39')][_0xbb44('0x48')]){_0x4b377d[_0xbb44('0x49')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x4b377d);})[_0xbb44('0x28')](function(_0x20b8dc){_0x4c8491[_0xbb44('0x4a')]=_0x20b8dc;return _0x4c8491;})[_0xbb44('0x28')](respondWithFilteredResult(_0x2b69f3,_0x4b377d))[_0xbb44('0x4b')](handleError(_0x2b69f3,null));};exports[_0xbb44('0x4c')]=function(_0x3481f2,_0x519093){var _0x3b34c2={'raw':!![],'where':{'id':_0x3481f2[_0xbb44('0x4d')]['id']}},_0x484cbc={};_0x484cbc['model']=_[_0xbb44('0x38')](db[_0xbb44('0x33')][_0xbb44('0x34')]);_0x484cbc['query']=_[_0xbb44('0x38')](_0x3481f2[_0xbb44('0x39')]);_0x484cbc[_0xbb44('0x3a')]=_[_0xbb44('0x3c')](_0x484cbc[_0xbb44('0x37')],_0x484cbc['query']);_0x3b34c2[_0xbb44('0x3b')]=_[_0xbb44('0x3c')](_0x484cbc[_0xbb44('0x37')],qs[_0xbb44('0x3d')](_0x3481f2[_0xbb44('0x39')][_0xbb44('0x3d')]));_0x3b34c2[_0xbb44('0x3b')]=_0x3b34c2[_0xbb44('0x3b')][_0xbb44('0x3e')]?_0x3b34c2[_0xbb44('0x3b')]:_0x484cbc[_0xbb44('0x37')];if(_0x3481f2[_0xbb44('0x39')][_0xbb44('0x48')]){_0x3b34c2[_0xbb44('0x49')]=[{'all':!![]}];}_0x3b34c2=_[_0xbb44('0x46')]({},_0x3b34c2,_0x3481f2['options']);return db['FaxQueue']['find'](_0x3b34c2)['then'](handleEntityNotFound(_0x519093,null))[_0xbb44('0x28')](respondWithResult(_0x519093,null))[_0xbb44('0x4b')](handleError(_0x519093,null));};exports[_0xbb44('0x4e')]=function(_0x29fc6c,_0x132dcb){return db[_0xbb44('0x33')]['create'](_0x29fc6c[_0xbb44('0x4f')],{})['then'](function(_0x12787f){var _0x27b40a=_0x29fc6c[_0xbb44('0x50')][_0xbb44('0x29')]({'plain':!![]});if(!_0x27b40a)throw new Error(_0xbb44('0x51'));if(_0x27b40a[_0xbb44('0x52')]===_0xbb44('0x50')){var _0x30f004=_0x12787f[_0xbb44('0x29')]({'plain':!![]});var _0x25afed=_0xbb44('0x2a');return db[_0xbb44('0x53')][_0xbb44('0x54')]({'where':{'name':_0x25afed,'userProfileId':_0x27b40a[_0xbb44('0x55')]},'raw':!![]})[_0xbb44('0x28')](function(_0x32a25e){if(_0x32a25e&&_0x32a25e[_0xbb44('0x56')]===0x0){return db['UserProfileResource'][_0xbb44('0x4e')]({'name':_0x30f004[_0xbb44('0x2f')],'resourceId':_0x30f004['id'],'type':_0x32a25e[_0xbb44('0x2f')],'sectionId':_0x32a25e['id']},{})[_0xbb44('0x28')](function(){return _0x12787f;});}else{return _0x12787f;}})['catch'](function(_0x5a0822){logger[_0xbb44('0x2d')](_0xbb44('0x57'),_0x5a0822);throw _0x5a0822;});}return _0x12787f;})[_0xbb44('0x28')](respondWithResult(_0x132dcb,0xc9))['catch'](handleError(_0x132dcb,null));};exports['update']=function(_0x334b2a,_0x23f868){if(_0x334b2a[_0xbb44('0x4f')]['id']){delete _0x334b2a['body']['id'];}return db[_0xbb44('0x33')][_0xbb44('0x54')]({'where':{'id':_0x334b2a['params']['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x23f868,null))[_0xbb44('0x28')](saveUpdates(_0x334b2a[_0xbb44('0x4f')],null))[_0xbb44('0x28')](respondWithResult(_0x23f868,null))[_0xbb44('0x4b')](handleError(_0x23f868,null));};exports[_0xbb44('0x2b')]=function(_0x2f3d02,_0x56c02a){return db[_0xbb44('0x33')][_0xbb44('0x54')]({'where':{'id':_0x2f3d02[_0xbb44('0x4d')]['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x56c02a,null))['then'](removeEntity(_0x56c02a,null))[_0xbb44('0x4b')](handleError(_0x56c02a,null));};exports[_0xbb44('0x58')]=function(_0x219db7,_0x32f492){return db[_0xbb44('0x33')][_0xbb44('0x58')]()[_0xbb44('0x28')](respondWithResult(_0x32f492,null))[_0xbb44('0x4b')](handleError(_0x32f492,null));};exports[_0xbb44('0x59')]=function(_0xe5e64e,_0x207189,_0x27d20c){var _0x71ee0b={'raw':!![],'where':{}},_0x2449c6={},_0x3ee3b2;return db[_0xbb44('0x33')]['findOne']({'where':{'id':_0xe5e64e['params']['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x207189,null))['then'](function(_0xcae149){if(_0xcae149){_0x3ee3b2=_0xcae149[_0xbb44('0x29')]({'plain':!![]});_0x2449c6[_0xbb44('0x37')]=_[_0xbb44('0x38')](db[_0xbb44('0x5a')][_0xbb44('0x34')]);_0x2449c6['query']=_[_0xbb44('0x38')](_0xe5e64e[_0xbb44('0x39')]);_0x2449c6[_0xbb44('0x3a')]=_[_0xbb44('0x3c')](_0x2449c6['model'],_0x2449c6[_0xbb44('0x39')]);_0x71ee0b[_0xbb44('0x3b')]=_[_0xbb44('0x3c')](_0x2449c6[_0xbb44('0x37')],qs[_0xbb44('0x3d')](_0xe5e64e[_0xbb44('0x39')][_0xbb44('0x3d')]));_0x71ee0b[_0xbb44('0x3b')]=_0x71ee0b['attributes'][_0xbb44('0x3e')]?_0x71ee0b[_0xbb44('0x3b')]:_0x2449c6[_0xbb44('0x37')];if(!_0xe5e64e[_0xbb44('0x39')][_0xbb44('0x3f')]('nolimit')){_0x71ee0b[_0xbb44('0x22')]=qs[_0xbb44('0x22')](_0xe5e64e[_0xbb44('0x39')][_0xbb44('0x22')]);_0x71ee0b[_0xbb44('0x21')]=qs[_0xbb44('0x21')](_0xe5e64e[_0xbb44('0x39')][_0xbb44('0x21')]);}_0x71ee0b['order']=qs[_0xbb44('0x42')](_0xe5e64e[_0xbb44('0x39')][_0xbb44('0x42')]);_0x71ee0b[_0xbb44('0x43')]=qs[_0xbb44('0x3a')](_[_0xbb44('0x44')](_0xe5e64e[_0xbb44('0x39')],_0x2449c6[_0xbb44('0x3a')]));_0x71ee0b['where'][_0xbb44('0x5b')]=_0xcae149['id'];if(_0xe5e64e[_0xbb44('0x39')][_0xbb44('0x45')]){_0x71ee0b['where']=_[_0xbb44('0x46')](_0x71ee0b[_0xbb44('0x43')],{'$or':_['map'](_0x71ee0b[_0xbb44('0x3b')],function(_0x441e60){var _0x446156={};_0x446156[_0x441e60]={'$like':'%'+_0xe5e64e['query'][_0xbb44('0x45')]+'%'};return _0x446156;})});}_0x71ee0b=_[_0xbb44('0x46')]({},_0x71ee0b,_0xe5e64e[_0xbb44('0x5c')]);return db['UserFaxQueue'][_0xbb44('0x5d')](_0x71ee0b);}})['then'](function(_0x4d429f){if(_0x4d429f){return db[_0xbb44('0x5e')][_0xbb44('0x5f')]({'where':{'id':_['map'](_0x4d429f,'UserId'),'role':_0xbb44('0x60')},'attributes':['id',_0xbb44('0x2f'),_0xbb44('0x61'),'updatedAt','createdAt']});}})[_0xbb44('0x28')](function(_0x5b509a){if(_0x5b509a){return{'count':_0x5b509a[_0xbb44('0x47')],'rows':_['map'](_0x5b509a[_0xbb44('0x4a')],function(_0x1280ac){return{'membername':_0x1280ac['name'],'UserId':_0x1280ac['id'],'queue_name':_0x3ee3b2[_0xbb44('0x2f')],'FaxQueueId':_0x3ee3b2['id'],'interface':util[_0xbb44('0x62')](_0xbb44('0x63'),_0xbb44('0x64'),_0x1280ac[_0xbb44('0x2f')]),'penalty':0x0,'paused':_0x1280ac[_0xbb44('0x61')],'createdAt':_0x1280ac['createdAt'],'updatedAt':_0x1280ac[_0xbb44('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbb44('0x28')](respondWithFilteredResult(_0x207189,_0x71ee0b))['catch'](handleError(_0x207189,null));};exports[_0xbb44('0x66')]=function(_0x341e82,_0x3be203,_0x46e1b0){var _0x22b9cc={};var _0x589780={};var _0x38b219;var _0x5aad62;return db[_0xbb44('0x33')][_0xbb44('0x67')]({'where':{'id':_0x341e82[_0xbb44('0x4d')]['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x3be203,null))[_0xbb44('0x28')](function(_0x364ec2){if(_0x364ec2){_0x38b219=_0x364ec2;_0x589780[_0xbb44('0x37')]=_[_0xbb44('0x38')](db[_0xbb44('0x68')][_0xbb44('0x34')]);_0x589780[_0xbb44('0x39')]=_[_0xbb44('0x38')](_0x341e82['query']);_0x589780['filters']=_[_0xbb44('0x3c')](_0x589780['model'],_0x589780[_0xbb44('0x39')]);_0x22b9cc[_0xbb44('0x3b')]=_[_0xbb44('0x3c')](_0x589780['model'],qs[_0xbb44('0x3d')](_0x341e82['query'][_0xbb44('0x3d')]));_0x22b9cc[_0xbb44('0x3b')]=_0x22b9cc[_0xbb44('0x3b')]['length']?_0x22b9cc[_0xbb44('0x3b')]:_0x589780[_0xbb44('0x37')];_0x22b9cc[_0xbb44('0x41')]=qs[_0xbb44('0x42')](_0x341e82[_0xbb44('0x39')]['sort']);_0x22b9cc[_0xbb44('0x43')]=qs[_0xbb44('0x3a')](_[_0xbb44('0x44')](_0x341e82[_0xbb44('0x39')],_0x589780[_0xbb44('0x3a')]));if(_0x341e82[_0xbb44('0x39')][_0xbb44('0x45')]){_0x22b9cc[_0xbb44('0x43')]=_['merge'](_0x22b9cc['where'],{'$or':_['map'](_0x22b9cc[_0xbb44('0x3b')],function(_0x29b5df){var _0x38bc4d={};_0x38bc4d[_0x29b5df]={'$like':'%'+_0x341e82['query'][_0xbb44('0x45')]+'%'};return _0x38bc4d;})});}_0x22b9cc=_[_0xbb44('0x46')]({},_0x22b9cc,_0x341e82[_0xbb44('0x5c')]);return _0x38b219[_0xbb44('0x66')](_0x22b9cc);}})[_0xbb44('0x28')](function(_0x10a71f){if(_0x10a71f){_0x5aad62=_0x10a71f['length'];if(!_0x341e82[_0xbb44('0x39')][_0xbb44('0x3f')](_0xbb44('0x40'))){_0x22b9cc[_0xbb44('0x22')]=qs['limit'](_0x341e82[_0xbb44('0x39')][_0xbb44('0x22')]);_0x22b9cc[_0xbb44('0x21')]=qs[_0xbb44('0x21')](_0x341e82[_0xbb44('0x39')][_0xbb44('0x21')]);}return _0x38b219[_0xbb44('0x66')](_0x22b9cc);}})['then'](function(_0x5d3e75){if(_0x5d3e75){return _0x5d3e75?{'count':_0x5aad62,'rows':_0x5d3e75}:null;}})[_0xbb44('0x28')](respondWithResult(_0x3be203,null))[_0xbb44('0x4b')](handleError(_0x3be203,null));};exports[_0xbb44('0x69')]=function(_0x16c6d7,_0x32ec24,_0x5d0903){var _0x2ecf37=_0x16c6d7[_0xbb44('0x4f')][_0xbb44('0x6a')];return db[_0xbb44('0x68')][_0xbb44('0x5d')]({'where':{'id':_0x2ecf37},'attributes':['id'],'include':[{'model':db[_0xbb44('0x5e')],'as':_0xbb44('0x6b'),'attributes':['id',_0xbb44('0x2f'),_0xbb44('0x6c'),_0xbb44('0x6d'),_0xbb44('0x6e')],'raw':!![]}]})['then'](function(_0x39d8ad){if(_0x39d8ad){var _0x552ad0=_[_0xbb44('0x6f')](_0x39d8ad,function(_0x193ba9){var _0x384fb4=_0x193ba9[_0xbb44('0x29')]({'plain':!![]});return _0x384fb4['Agents'];});return db[_0xbb44('0x33')][_0xbb44('0x54')]({'where':{'id':_0x16c6d7['params']['id']}})[_0xbb44('0x28')](function(_0x521812){return db[_0xbb44('0x70')]['transaction'](function(_0x169133){return _0x521812['addTeams'](_0x2ecf37,{'transaction':_0x169133})[_0xbb44('0x28')](function(){return BPromise[_0xbb44('0x71')](_0x552ad0,function(_0x58c0a0){return db[_0xbb44('0x5a')]['findOrCreate']({'where':{'UserId':_0x58c0a0['id'],'FaxQueueId':_0x16c6d7[_0xbb44('0x4d')]['id']},'transaction':_0x169133});});})[_0xbb44('0x28')](function(){_0x552ad0['forEach'](function(_0x2d520e){socket[_0xbb44('0x72')](_0xbb44('0x73'),{'UserId':_0x2d520e['id'],'FaxQueueId':_0x521812['id']});});});});});}})[_0xbb44('0x28')](respondWithStatusCode(_0x32ec24,null))[_0xbb44('0x4b')](handleError(_0x32ec24,null));};exports[_0xbb44('0x74')]=function(_0x94a152,_0x4f0adc,_0x3e0631){return db[_0xbb44('0x68')][_0xbb44('0x5d')]({'where':{'id':_0x94a152[_0xbb44('0x39')][_0xbb44('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbb44('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f0adc,null))[_0xbb44('0x28')](function(_0x36e032){var _0x296355=_[_0xbb44('0x32')](_0x36e032,'id');var _0x52679d=[];var _0x55c3d6=[];var _0x1dc881=squel['select']();_0x1dc881[_0xbb44('0x75')](_0xbb44('0x76'))['from'](_0xbb44('0x77'),'tq')[_0xbb44('0x78')](_0xbb44('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbb44('0x43')](_0xbb44('0x7a'),_0x94a152['params']['id']);for(var _0x8afb9b=0x0;_0x8afb9b<_0x36e032[_0xbb44('0x3e')];_0x8afb9b+=0x1){let _0x2116f5=_0x36e032[_0x8afb9b];for(var _0x489bda=0x0;_0x489bda<_0x2116f5[_0xbb44('0x6b')][_0xbb44('0x3e')];_0x489bda+=0x1){let _0xd9c903=_0x2116f5[_0xbb44('0x6b')][_0x489bda];var _0x5f6166=_0x1dc881[_0xbb44('0x7b')]();_0x5f6166[_0xbb44('0x43')](_0xbb44('0x7c'),_0xd9c903['id']);_0x55c3d6[_0xbb44('0x7d')](db[_0xbb44('0x70')][_0xbb44('0x39')](_0x5f6166[_0xbb44('0x7e')](),{'type':db[_0xbb44('0x70')][_0xbb44('0x7f')][_0xbb44('0x80')]})[_0xbb44('0x28')](function(_0x439751){if(_0x439751[_0xbb44('0x3e')]===0x1){return _0xd9c903['id'];}else{var _0x772931=_[_0xbb44('0x81')](_[_0xbb44('0x32')](_0x439751,_0xbb44('0x82')),function(_0x150dc9){return _['includes'](_0x296355,_0x150dc9);});if(_0x772931){return _0xd9c903['id'];}}}));}}return BPromise[_0xbb44('0x83')](_0x55c3d6)['then'](function(_0x1bf3a3){_0x52679d=_(_0x52679d)[_0xbb44('0x84')](_0x1bf3a3)[_0xbb44('0x85')]()[_0xbb44('0x86')]();return db[_0xbb44('0x33')][_0xbb44('0x54')]({'where':{'id':_0x94a152[_0xbb44('0x4d')]['id']}})[_0xbb44('0x28')](function(_0x2ddcc6){return db[_0xbb44('0x70')][_0xbb44('0x87')](function(_0x4eabfa){return _0x2ddcc6['removeTeams'](_0x94a152['query'][_0xbb44('0x6a')],{'transaction':_0x4eabfa})['then'](function(){if(!_[_0xbb44('0x88')](_0x52679d)){return _0x2ddcc6[_0xbb44('0x89')](_0x52679d,{'transaction':_0x4eabfa});}})['then'](function(){_0x52679d['forEach'](function(_0x5531bf){socket[_0xbb44('0x72')]('userFaxQueue:remove',{'UserId':_0x5531bf,'FaxQueueId':_0x2ddcc6['id']});});});});});});})[_0xbb44('0x28')](respondWithStatusCode(_0x4f0adc,null))[_0xbb44('0x4b')](handleError(_0x4f0adc,null));};exports[_0xbb44('0x8a')]=function(_0x33954b,_0x35d420,_0x6f4be4){return db['FaxQueue'][_0xbb44('0x54')]({'where':{'id':_0x33954b[_0xbb44('0x4d')]['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x35d420,null))[_0xbb44('0x28')](function(_0x2f5406){if(_0x2f5406){return _0x2f5406['addAgents'](_0x33954b[_0xbb44('0x4f')][_0xbb44('0x6a')],_[_0xbb44('0x8b')](_0x33954b['body'],[_0xbb44('0x6a'),'id'])||{})[_0xbb44('0x8c')](function(_0x28c0e8){for(var _0x237040=0x0;_0x237040<_0x33954b['body']['ids'][_0xbb44('0x3e')];_0x237040+=0x1){socket[_0xbb44('0x72')](_0xbb44('0x73'),{'UserId':_0x33954b[_0xbb44('0x4f')][_0xbb44('0x6a')][_0x237040],'FaxQueueId':_0x33954b[_0xbb44('0x4d')]['id']});}return _0x28c0e8;});}})[_0xbb44('0x28')](respondWithResult(_0x35d420,null))[_0xbb44('0x4b')](handleError(_0x35d420,null));};exports[_0xbb44('0x89')]=function(_0x2e148d,_0x1df73b,_0xa8d1f4){return db[_0xbb44('0x33')][_0xbb44('0x54')]({'where':{'id':_0x2e148d['params']['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x1df73b,null))[_0xbb44('0x28')](function(_0x3b4f15){if(_0x3b4f15){return _0x3b4f15[_0xbb44('0x89')](_0x2e148d[_0xbb44('0x39')][_0xbb44('0x6a')])['then'](function(){if(_[_0xbb44('0x8d')](_0x2e148d[_0xbb44('0x39')][_0xbb44('0x6a')])){for(var _0x5b2b27=0x0;_0x5b2b27<_0x2e148d[_0xbb44('0x39')][_0xbb44('0x6a')][_0xbb44('0x3e')];_0x5b2b27+=0x1){socket[_0xbb44('0x72')](_0xbb44('0x8e'),{'UserId':Number(_0x2e148d[_0xbb44('0x39')][_0xbb44('0x6a')][_0x5b2b27]),'FaxQueueId':Number(_0x2e148d['params']['id'])});}}else{socket['emit'](_0xbb44('0x8e'),{'UserId':Number(_0x2e148d[_0xbb44('0x39')][_0xbb44('0x6a')]),'FaxQueueId':Number(_0x2e148d['params']['id'])});}});}})[_0xbb44('0x28')](respondWithStatusCode(_0x1df73b,null))[_0xbb44('0x4b')](handleError(_0x1df73b,null));};exports[_0xbb44('0x8f')]=function(_0x2b5826,_0x4ac958,_0x50b5bb){var _0x5aa078={};var _0x2cafb8={};var _0x474688;var _0xbe2fef;return db[_0xbb44('0x33')][_0xbb44('0x67')]({'where':{'id':_0x2b5826[_0xbb44('0x4d')]['id']}})[_0xbb44('0x28')](handleEntityNotFound(_0x4ac958,null))['then'](function(_0x225d06){if(_0x225d06){_0x474688=_0x225d06;_0x2cafb8[_0xbb44('0x37')]=_[_0xbb44('0x38')](db['User'][_0xbb44('0x34')]);_0x2cafb8[_0xbb44('0x39')]=_[_0xbb44('0x38')](_0x2b5826['query']);_0x2cafb8[_0xbb44('0x3a')]=_[_0xbb44('0x3c')](_0x2cafb8['model'],_0x2cafb8[_0xbb44('0x39')]);_0x5aa078['attributes']=_['intersection'](_0x2cafb8[_0xbb44('0x37')],qs[_0xbb44('0x3d')](_0x2b5826['query']['fields']));_0x5aa078[_0xbb44('0x3b')]=_0x5aa078['attributes']['length']?_0x5aa078[_0xbb44('0x3b')]:_0x2cafb8[_0xbb44('0x37')];_0x5aa078[_0xbb44('0x41')]=qs[_0xbb44('0x42')](_0x2b5826[_0xbb44('0x39')][_0xbb44('0x42')]);_0x5aa078[_0xbb44('0x43')]=qs[_0xbb44('0x3a')](_[_0xbb44('0x44')](_0x2b5826[_0xbb44('0x39')],_0x2cafb8[_0xbb44('0x3a')]));if(_0x2b5826[_0xbb44('0x39')][_0xbb44('0x45')]){_0x5aa078['where']=_[_0xbb44('0x46')](_0x5aa078[_0xbb44('0x43')],{'$or':_[_0xbb44('0x32')](_0x5aa078[_0xbb44('0x3b')],function(_0x1b3eab){var _0x264900={};_0x264900[_0x1b3eab]={'$like':'%'+_0x2b5826[_0xbb44('0x39')]['filter']+'%'};return _0x264900;})});}_0x5aa078=_[_0xbb44('0x46')]({},_0x5aa078,_0x2b5826[_0xbb44('0x5c')]);return _0x474688[_0xbb44('0x8f')](_0x5aa078);}})[_0xbb44('0x28')](function(_0x4536e1){if(_0x4536e1){_0xbe2fef=_0x4536e1['length'];if(!_0x2b5826[_0xbb44('0x39')][_0xbb44('0x3f')](_0xbb44('0x40'))){_0x5aa078['limit']=qs[_0xbb44('0x22')](_0x2b5826[_0xbb44('0x39')][_0xbb44('0x22')]);_0x5aa078[_0xbb44('0x21')]=qs[_0xbb44('0x21')](_0x2b5826[_0xbb44('0x39')][_0xbb44('0x21')]);}return _0x474688[_0xbb44('0x8f')](_0x5aa078);}})[_0xbb44('0x28')](function(_0x9fca83){if(_0x9fca83){return _0x9fca83?{'count':_0xbe2fef,'rows':_0x9fca83}:null;}})[_0xbb44('0x28')](respondWithResult(_0x4ac958,null))[_0xbb44('0x4b')](handleError(_0x4ac958,null));}; \ No newline at end of file +var _0x0f95=['redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','error','name','send','map','FaxQueue','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','options','count','include','rows','show','keys','includeAll','merge','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAll','User','findAndCountAll','faxPause','createdAt','SIP','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','findOrCreate','forEach','emit','select','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','removeTeams','removeAgents','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb'];(function(_0xc598b1,_0x1db39e){var _0x71f14b=function(_0x37724e){while(--_0x37724e){_0xc598b1['push'](_0xc598b1['shift']());}};_0x71f14b(++_0x1db39e);}(_0x0f95,0xfa));var _0x50f9=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x0f95[_0x3c8e9a];return _0x2d4c57;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x50f9('0x0'));var rimraf=require(_0x50f9('0x1'));var zipdir=require(_0x50f9('0x2'));var jsonpatch=require(_0x50f9('0x3'));var rp=require(_0x50f9('0x4'));var moment=require(_0x50f9('0x5'));var BPromise=require(_0x50f9('0x6'));var Mustache=require(_0x50f9('0x7'));var util=require(_0x50f9('0x8'));var path=require(_0x50f9('0x9'));var sox=require(_0x50f9('0xa'));var csv=require('to-csv');var ejs=require(_0x50f9('0xb'));var fs=require('fs');var _=require(_0x50f9('0xc'));var squel=require(_0x50f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x50f9('0xe'));var deskjs=require(_0x50f9('0xf'));var toCsv=require(_0x50f9('0x10'));var querystring=require(_0x50f9('0x11'));var Papa=require('papaparse');var Redis=require(_0x50f9('0x12'));var authService=require(_0x50f9('0x13'));var qs=require(_0x50f9('0x14'));var as=require(_0x50f9('0x15'));var hardwareService=require(_0x50f9('0x16'));var logger=require('../../config/logger')(_0x50f9('0x17'));var utils=require('../../config/utils');var config=require(_0x50f9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x50f9('0x19'))['db'];config[_0x50f9('0x1a')]=_[_0x50f9('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x50f9('0x1c'))(new Redis(config[_0x50f9('0x1a')]));require(_0x50f9('0x1d'))['register'](socket);function respondWithStatusCode(_0x4b6e9e,_0x403f0a){_0x403f0a=_0x403f0a||0xcc;return function(_0xdfc776){if(_0xdfc776){return _0x4b6e9e[_0x50f9('0x1e')](_0x403f0a);}return _0x4b6e9e[_0x50f9('0x1f')](_0x403f0a)[_0x50f9('0x20')]();};}function respondWithResult(_0x3e42d5,_0x550171){_0x550171=_0x550171||0xc8;return function(_0x4f638d){if(_0x4f638d){return _0x3e42d5[_0x50f9('0x1f')](_0x550171)[_0x50f9('0x21')](_0x4f638d);}};}function respondWithFilteredResult(_0x548b97,_0x413a39){return function(_0x5869b8){if(_0x5869b8){var _0xf4bc67=_0x5869b8['count'],_0x155516=_0x413a39[_0x50f9('0x22')],_0x2c6317=_0x413a39['offset']+_0x413a39['limit'],_0x4c3a00;if(_0x2c6317>=_0xf4bc67){_0x2c6317=_0xf4bc67;_0x4c3a00=0xc8;}else{_0x4c3a00=0xce;}_0x548b97[_0x50f9('0x1f')](_0x4c3a00);return _0x548b97['set'](_0x50f9('0x23'),_0x155516+'-'+_0x2c6317+'/'+_0xf4bc67)[_0x50f9('0x21')](_0x5869b8);}return null;};}function patchUpdates(_0x41ea3a){return function(_0x3a77e4){try{jsonpatch[_0x50f9('0x24')](_0x3a77e4,_0x41ea3a,!![]);}catch(_0x4f680c){return BPromise[_0x50f9('0x25')](_0x4f680c);}return _0x3a77e4[_0x50f9('0x26')]();};}function saveUpdates(_0x3672cb,_0x1140f4){return function(_0x5e607d){if(_0x5e607d){return _0x5e607d[_0x50f9('0x27')](_0x3672cb)[_0x50f9('0x28')](function(_0x3d0720){return _0x3d0720;});}return null;};}function removeEntity(_0x515ced,_0x1ba3c4){return function(_0x2644b4){if(_0x2644b4){return _0x2644b4[_0x50f9('0x29')]()[_0x50f9('0x28')](function(){var _0x2e1e45=_0x2644b4['get']({'plain':!![]});var _0x56101c=_0x50f9('0x2a');return db[_0x50f9('0x2b')][_0x50f9('0x29')]({'where':{'type':_0x56101c,'resourceId':_0x2e1e45['id']}})[_0x50f9('0x28')](function(){return _0x2644b4;});})[_0x50f9('0x28')](function(){_0x515ced[_0x50f9('0x1f')](0xcc)[_0x50f9('0x20')]();});}};}function handleEntityNotFound(_0x5de83c,_0x1d8388){return function(_0x571374){if(!_0x571374){_0x5de83c[_0x50f9('0x1e')](0x194);}return _0x571374;};}function handleError(_0x577bbb,_0x1e8a2e){_0x1e8a2e=_0x1e8a2e||0x1f4;return function(_0x16260e){logger[_0x50f9('0x2c')](_0x16260e['stack']);if(_0x16260e['name']){delete _0x16260e[_0x50f9('0x2d')];}_0x577bbb['status'](_0x1e8a2e)[_0x50f9('0x2e')](_0x16260e);};}exports['index']=function(_0x3580d0,_0x2de372){var _0x549c9a={},_0x4a0a4d={},_0x2ad03a={'count':0x0,'rows':[]};var _0x11014a=_[_0x50f9('0x2f')](db[_0x50f9('0x30')][_0x50f9('0x31')],function(_0x3a6fb9){return{'name':_0x3a6fb9[_0x50f9('0x32')],'type':_0x3a6fb9['type'][_0x50f9('0x33')]};});_0x4a0a4d['model']=_[_0x50f9('0x2f')](_0x11014a,_0x50f9('0x2d'));_0x4a0a4d[_0x50f9('0x34')]=_['keys'](_0x3580d0[_0x50f9('0x34')]);_0x4a0a4d[_0x50f9('0x35')]=_[_0x50f9('0x36')](_0x4a0a4d[_0x50f9('0x37')],_0x4a0a4d[_0x50f9('0x34')]);_0x549c9a[_0x50f9('0x38')]=_[_0x50f9('0x36')](_0x4a0a4d['model'],qs[_0x50f9('0x39')](_0x3580d0[_0x50f9('0x34')][_0x50f9('0x39')]));_0x549c9a[_0x50f9('0x38')]=_0x549c9a[_0x50f9('0x38')][_0x50f9('0x3a')]?_0x549c9a[_0x50f9('0x38')]:_0x4a0a4d[_0x50f9('0x37')];if(!_0x3580d0[_0x50f9('0x34')][_0x50f9('0x3b')](_0x50f9('0x3c'))){_0x549c9a[_0x50f9('0x3d')]=qs[_0x50f9('0x3d')](_0x3580d0['query'][_0x50f9('0x3d')]);_0x549c9a[_0x50f9('0x22')]=qs[_0x50f9('0x22')](_0x3580d0['query'][_0x50f9('0x22')]);}_0x549c9a[_0x50f9('0x3e')]=qs[_0x50f9('0x3f')](_0x3580d0[_0x50f9('0x34')]['sort']);_0x549c9a['where']=qs[_0x50f9('0x35')](_[_0x50f9('0x40')](_0x3580d0[_0x50f9('0x34')],_0x4a0a4d['filters']),_0x11014a);if(_0x3580d0[_0x50f9('0x34')][_0x50f9('0x41')]){_0x549c9a[_0x50f9('0x42')]=_['merge'](_0x549c9a[_0x50f9('0x42')],{'$or':_[_0x50f9('0x2f')](_0x11014a,function(_0x373aac){if(_0x373aac[_0x50f9('0x43')]!==_0x50f9('0x44')){var _0x43f062={};_0x43f062[_0x373aac['name']]={'$like':'%'+_0x3580d0['query']['filter']+'%'};return _0x43f062;}})});}_0x549c9a=_['merge']({},_0x549c9a,_0x3580d0[_0x50f9('0x45')]);var _0x433f58={'where':_0x549c9a[_0x50f9('0x42')]};return db[_0x50f9('0x30')][_0x50f9('0x46')](_0x433f58)['then'](function(_0x5d727c){_0x2ad03a[_0x50f9('0x46')]=_0x5d727c;if(_0x3580d0[_0x50f9('0x34')]['includeAll']){_0x549c9a[_0x50f9('0x47')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x549c9a);})[_0x50f9('0x28')](function(_0x146e86){_0x2ad03a[_0x50f9('0x48')]=_0x146e86;return _0x2ad03a;})[_0x50f9('0x28')](respondWithFilteredResult(_0x2de372,_0x549c9a))['catch'](handleError(_0x2de372,null));};exports[_0x50f9('0x49')]=function(_0x54ec3e,_0x5dd727){var _0x48b96a={'raw':!![],'where':{'id':_0x54ec3e['params']['id']}},_0x2a2ec5={};_0x2a2ec5['model']=_[_0x50f9('0x4a')](db[_0x50f9('0x30')]['rawAttributes']);_0x2a2ec5[_0x50f9('0x34')]=_[_0x50f9('0x4a')](_0x54ec3e[_0x50f9('0x34')]);_0x2a2ec5['filters']=_['intersection'](_0x2a2ec5[_0x50f9('0x37')],_0x2a2ec5[_0x50f9('0x34')]);_0x48b96a[_0x50f9('0x38')]=_[_0x50f9('0x36')](_0x2a2ec5['model'],qs[_0x50f9('0x39')](_0x54ec3e[_0x50f9('0x34')][_0x50f9('0x39')]));_0x48b96a['attributes']=_0x48b96a['attributes'][_0x50f9('0x3a')]?_0x48b96a[_0x50f9('0x38')]:_0x2a2ec5[_0x50f9('0x37')];if(_0x54ec3e['query'][_0x50f9('0x4b')]){_0x48b96a[_0x50f9('0x47')]=[{'all':!![]}];}_0x48b96a=_[_0x50f9('0x4c')]({},_0x48b96a,_0x54ec3e[_0x50f9('0x45')]);return db[_0x50f9('0x30')][_0x50f9('0x4d')](_0x48b96a)[_0x50f9('0x28')](handleEntityNotFound(_0x5dd727,null))[_0x50f9('0x28')](respondWithResult(_0x5dd727,null))[_0x50f9('0x4e')](handleError(_0x5dd727,null));};exports['create']=function(_0x570d2b,_0x9ad3ae){return db[_0x50f9('0x30')]['create'](_0x570d2b['body'],{})['then'](function(_0x49af83){var _0x7df02f=_0x570d2b['user']['get']({'plain':!![]});if(!_0x7df02f)throw new Error(_0x50f9('0x4f'));if(_0x7df02f[_0x50f9('0x50')]===_0x50f9('0x51')){var _0x200f26=_0x49af83[_0x50f9('0x52')]({'plain':!![]});var _0x540e1a=_0x50f9('0x2a');return db[_0x50f9('0x53')][_0x50f9('0x4d')]({'where':{'name':_0x540e1a,'userProfileId':_0x7df02f['userProfileId']},'raw':!![]})['then'](function(_0x135dba){if(_0x135dba&&_0x135dba['autoAssociation']===0x0){return db['UserProfileResource'][_0x50f9('0x54')]({'name':_0x200f26[_0x50f9('0x2d')],'resourceId':_0x200f26['id'],'type':_0x135dba[_0x50f9('0x2d')],'sectionId':_0x135dba['id']},{})[_0x50f9('0x28')](function(){return _0x49af83;});}else{return _0x49af83;}})[_0x50f9('0x4e')](function(_0x42b1d2){logger['error'](_0x50f9('0x55'),_0x42b1d2);throw _0x42b1d2;});}return _0x49af83;})[_0x50f9('0x28')](respondWithResult(_0x9ad3ae,0xc9))['catch'](handleError(_0x9ad3ae,null));};exports[_0x50f9('0x27')]=function(_0x200dd8,_0xff8fe4){if(_0x200dd8[_0x50f9('0x56')]['id']){delete _0x200dd8[_0x50f9('0x56')]['id'];}return db[_0x50f9('0x30')][_0x50f9('0x4d')]({'where':{'id':_0x200dd8[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](handleEntityNotFound(_0xff8fe4,null))[_0x50f9('0x28')](saveUpdates(_0x200dd8[_0x50f9('0x56')],null))[_0x50f9('0x28')](respondWithResult(_0xff8fe4,null))[_0x50f9('0x4e')](handleError(_0xff8fe4,null));};exports[_0x50f9('0x29')]=function(_0x4ae9ef,_0x3f2903){return db[_0x50f9('0x30')][_0x50f9('0x4d')]({'where':{'id':_0x4ae9ef[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](handleEntityNotFound(_0x3f2903,null))['then'](removeEntity(_0x3f2903,null))['catch'](handleError(_0x3f2903,null));};exports[_0x50f9('0x58')]=function(_0x5cf91c,_0x51fd59){return db[_0x50f9('0x30')][_0x50f9('0x58')]()[_0x50f9('0x28')](respondWithResult(_0x51fd59,null))['catch'](handleError(_0x51fd59,null));};exports[_0x50f9('0x59')]=function(_0x22c29d,_0x2eaeaf,_0x366439){var _0x946464={'raw':!![],'where':{}},_0x577a3e={},_0x324ea6;return db[_0x50f9('0x30')][_0x50f9('0x5a')]({'where':{'id':_0x22c29d[_0x50f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x2eaeaf,null))['then'](function(_0x532f8a){if(_0x532f8a){_0x324ea6=_0x532f8a[_0x50f9('0x52')]({'plain':!![]});_0x577a3e[_0x50f9('0x37')]=_[_0x50f9('0x4a')](db[_0x50f9('0x5b')][_0x50f9('0x31')]);_0x577a3e['query']=_[_0x50f9('0x4a')](_0x22c29d[_0x50f9('0x34')]);_0x577a3e['filters']=_[_0x50f9('0x36')](_0x577a3e[_0x50f9('0x37')],_0x577a3e[_0x50f9('0x34')]);_0x946464[_0x50f9('0x38')]=_[_0x50f9('0x36')](_0x577a3e[_0x50f9('0x37')],qs[_0x50f9('0x39')](_0x22c29d['query'][_0x50f9('0x39')]));_0x946464['attributes']=_0x946464[_0x50f9('0x38')][_0x50f9('0x3a')]?_0x946464['attributes']:_0x577a3e[_0x50f9('0x37')];if(!_0x22c29d[_0x50f9('0x34')]['hasOwnProperty']('nolimit')){_0x946464[_0x50f9('0x3d')]=qs[_0x50f9('0x3d')](_0x22c29d[_0x50f9('0x34')][_0x50f9('0x3d')]);_0x946464[_0x50f9('0x22')]=qs[_0x50f9('0x22')](_0x22c29d[_0x50f9('0x34')][_0x50f9('0x22')]);}_0x946464[_0x50f9('0x3e')]=qs[_0x50f9('0x3f')](_0x22c29d[_0x50f9('0x34')][_0x50f9('0x3f')]);_0x946464['where']=qs[_0x50f9('0x35')](_['pick'](_0x22c29d[_0x50f9('0x34')],_0x577a3e[_0x50f9('0x35')]));_0x946464[_0x50f9('0x42')][_0x50f9('0x5c')]=_0x532f8a['id'];if(_0x22c29d[_0x50f9('0x34')][_0x50f9('0x41')]){_0x946464[_0x50f9('0x42')]=_[_0x50f9('0x4c')](_0x946464[_0x50f9('0x42')],{'$or':_[_0x50f9('0x2f')](_0x946464['attributes'],function(_0x3fc4d7){var _0x24b8c8={};_0x24b8c8[_0x3fc4d7]={'$like':'%'+_0x22c29d[_0x50f9('0x34')]['filter']+'%'};return _0x24b8c8;})});}_0x946464=_[_0x50f9('0x4c')]({},_0x946464,_0x22c29d['options']);return db['UserFaxQueue'][_0x50f9('0x5d')](_0x946464);}})[_0x50f9('0x28')](function(_0x2469b8){if(_0x2469b8){return db[_0x50f9('0x5e')][_0x50f9('0x5f')]({'where':{'id':_[_0x50f9('0x2f')](_0x2469b8,'UserId'),'role':'agent'},'attributes':['id','name',_0x50f9('0x60'),'updatedAt',_0x50f9('0x61')]});}})['then'](function(_0xdfc9c1){if(_0xdfc9c1){return{'count':_0xdfc9c1[_0x50f9('0x46')],'rows':_[_0x50f9('0x2f')](_0xdfc9c1[_0x50f9('0x48')],function(_0x1f80fc){return{'membername':_0x1f80fc[_0x50f9('0x2d')],'UserId':_0x1f80fc['id'],'queue_name':_0x324ea6[_0x50f9('0x2d')],'FaxQueueId':_0x324ea6['id'],'interface':util['format']('%s/%s',_0x50f9('0x62'),_0x1f80fc[_0x50f9('0x2d')]),'penalty':0x0,'paused':_0x1f80fc[_0x50f9('0x60')],'createdAt':_0x1f80fc[_0x50f9('0x61')],'updatedAt':_0x1f80fc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x50f9('0x28')](respondWithFilteredResult(_0x2eaeaf,_0x946464))['catch'](handleError(_0x2eaeaf,null));};exports[_0x50f9('0x63')]=function(_0xc32e07,_0x10877e,_0x36f82b){var _0x3ba057={};var _0xe7c9aa={};var _0x3f06ba;var _0x202357;return db[_0x50f9('0x30')][_0x50f9('0x5a')]({'where':{'id':_0xc32e07[_0x50f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x10877e,null))[_0x50f9('0x28')](function(_0x3b2697){if(_0x3b2697){_0x3f06ba=_0x3b2697;_0xe7c9aa['model']=_['keys'](db['Team']['rawAttributes']);_0xe7c9aa[_0x50f9('0x34')]=_[_0x50f9('0x4a')](_0xc32e07[_0x50f9('0x34')]);_0xe7c9aa[_0x50f9('0x35')]=_[_0x50f9('0x36')](_0xe7c9aa['model'],_0xe7c9aa[_0x50f9('0x34')]);_0x3ba057[_0x50f9('0x38')]=_[_0x50f9('0x36')](_0xe7c9aa[_0x50f9('0x37')],qs['fields'](_0xc32e07[_0x50f9('0x34')][_0x50f9('0x39')]));_0x3ba057[_0x50f9('0x38')]=_0x3ba057[_0x50f9('0x38')][_0x50f9('0x3a')]?_0x3ba057['attributes']:_0xe7c9aa[_0x50f9('0x37')];_0x3ba057['order']=qs['sort'](_0xc32e07[_0x50f9('0x34')][_0x50f9('0x3f')]);_0x3ba057[_0x50f9('0x42')]=qs[_0x50f9('0x35')](_[_0x50f9('0x40')](_0xc32e07['query'],_0xe7c9aa[_0x50f9('0x35')]));if(_0xc32e07['query'][_0x50f9('0x41')]){_0x3ba057[_0x50f9('0x42')]=_[_0x50f9('0x4c')](_0x3ba057['where'],{'$or':_['map'](_0x3ba057[_0x50f9('0x38')],function(_0x5c33c6){var _0x4095a0={};_0x4095a0[_0x5c33c6]={'$like':'%'+_0xc32e07[_0x50f9('0x34')][_0x50f9('0x41')]+'%'};return _0x4095a0;})});}_0x3ba057=_[_0x50f9('0x4c')]({},_0x3ba057,_0xc32e07[_0x50f9('0x45')]);return _0x3f06ba[_0x50f9('0x63')](_0x3ba057);}})[_0x50f9('0x28')](function(_0x15f16b){if(_0x15f16b){_0x202357=_0x15f16b[_0x50f9('0x3a')];if(!_0xc32e07['query'][_0x50f9('0x3b')](_0x50f9('0x3c'))){_0x3ba057[_0x50f9('0x3d')]=qs[_0x50f9('0x3d')](_0xc32e07['query'][_0x50f9('0x3d')]);_0x3ba057['offset']=qs[_0x50f9('0x22')](_0xc32e07[_0x50f9('0x34')][_0x50f9('0x22')]);}return _0x3f06ba[_0x50f9('0x63')](_0x3ba057);}})[_0x50f9('0x28')](function(_0x29b28c){if(_0x29b28c){return _0x29b28c?{'count':_0x202357,'rows':_0x29b28c}:null;}})[_0x50f9('0x28')](respondWithResult(_0x10877e,null))[_0x50f9('0x4e')](handleError(_0x10877e,null));};exports[_0x50f9('0x64')]=function(_0x51a8ca,_0x28d3c1,_0x2196f7){var _0x46542e=_0x51a8ca[_0x50f9('0x56')][_0x50f9('0x65')];return db[_0x50f9('0x66')][_0x50f9('0x5d')]({'where':{'id':_0x46542e},'attributes':['id'],'include':[{'model':db[_0x50f9('0x5e')],'as':_0x50f9('0x67'),'attributes':['id',_0x50f9('0x2d'),_0x50f9('0x68'),'voicePause',_0x50f9('0x69')],'raw':!![]}]})[_0x50f9('0x28')](function(_0x182412){if(_0x182412){var _0x1e9ad5=_[_0x50f9('0x6a')](_0x182412,function(_0x299518){var _0x51be6d=_0x299518[_0x50f9('0x52')]({'plain':!![]});return _0x51be6d[_0x50f9('0x67')];});return db[_0x50f9('0x30')][_0x50f9('0x4d')]({'where':{'id':_0x51a8ca[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](function(_0x153f29){return db[_0x50f9('0x6b')]['transaction'](function(_0x382d63){return _0x153f29[_0x50f9('0x64')](_0x46542e,{'transaction':_0x382d63})[_0x50f9('0x28')](function(){return BPromise['each'](_0x1e9ad5,function(_0x5d7d97){return db['UserFaxQueue'][_0x50f9('0x6c')]({'where':{'UserId':_0x5d7d97['id'],'FaxQueueId':_0x51a8ca[_0x50f9('0x57')]['id']},'transaction':_0x382d63});});})[_0x50f9('0x28')](function(){_0x1e9ad5[_0x50f9('0x6d')](function(_0x4207db){socket[_0x50f9('0x6e')]('userFaxQueue:save',{'UserId':_0x4207db['id'],'FaxQueueId':_0x153f29['id']});});});});});}})[_0x50f9('0x28')](respondWithStatusCode(_0x28d3c1,null))[_0x50f9('0x4e')](handleError(_0x28d3c1,null));};exports['removeTeams']=function(_0xfce1a0,_0x34e81d,_0x5a5a03){return db[_0x50f9('0x66')][_0x50f9('0x5d')]({'where':{'id':_0xfce1a0[_0x50f9('0x34')][_0x50f9('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x50f9('0x28')](handleEntityNotFound(_0x34e81d,null))[_0x50f9('0x28')](function(_0x192c3b){var _0x29a8fe=_[_0x50f9('0x2f')](_0x192c3b,'id');var _0x23619a=[];var _0x17c74=[];var _0x43bd74=squel[_0x50f9('0x6f')]();_0x43bd74['field'](_0x50f9('0x70'))['from'](_0x50f9('0x71'),'tq')[_0x50f9('0x72')](_0x50f9('0x73'),'ut',_0x50f9('0x74'))[_0x50f9('0x42')](_0x50f9('0x75'),_0xfce1a0[_0x50f9('0x57')]['id']);for(var _0x49b6e7=0x0;_0x49b6e7<_0x192c3b[_0x50f9('0x3a')];_0x49b6e7+=0x1){let _0x493318=_0x192c3b[_0x49b6e7];for(var _0xbd6fdd=0x0;_0xbd6fdd<_0x493318[_0x50f9('0x67')]['length'];_0xbd6fdd+=0x1){let _0x7424df=_0x493318[_0x50f9('0x67')][_0xbd6fdd];var _0x3edcbc=_0x43bd74['clone']();_0x3edcbc[_0x50f9('0x42')](_0x50f9('0x76'),_0x7424df['id']);_0x17c74[_0x50f9('0x77')](db[_0x50f9('0x6b')][_0x50f9('0x34')](_0x3edcbc[_0x50f9('0x78')](),{'type':db[_0x50f9('0x6b')][_0x50f9('0x79')][_0x50f9('0x7a')]})[_0x50f9('0x28')](function(_0x4e4e63){if(_0x4e4e63[_0x50f9('0x3a')]===0x1){return _0x7424df['id'];}else{var _0x3ed832=_[_0x50f9('0x7b')](_['map'](_0x4e4e63,_0x50f9('0x7c')),function(_0x3c9986){return _[_0x50f9('0x7d')](_0x29a8fe,_0x3c9986);});if(_0x3ed832){return _0x7424df['id'];}}}));}}return BPromise[_0x50f9('0x7e')](_0x17c74)[_0x50f9('0x28')](function(_0x577127){_0x23619a=_(_0x23619a)[_0x50f9('0x7f')](_0x577127)['compact']()[_0x50f9('0x80')]();return db[_0x50f9('0x30')][_0x50f9('0x4d')]({'where':{'id':_0xfce1a0[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](function(_0x4332a4){return db[_0x50f9('0x6b')][_0x50f9('0x81')](function(_0x12b3f1){return _0x4332a4[_0x50f9('0x82')](_0xfce1a0[_0x50f9('0x34')][_0x50f9('0x65')],{'transaction':_0x12b3f1})[_0x50f9('0x28')](function(){if(!_['isEmpty'](_0x23619a)){return _0x4332a4[_0x50f9('0x83')](_0x23619a,{'transaction':_0x12b3f1});}})[_0x50f9('0x28')](function(){_0x23619a[_0x50f9('0x6d')](function(_0x4f04){socket[_0x50f9('0x6e')](_0x50f9('0x84'),{'UserId':_0x4f04,'FaxQueueId':_0x4332a4['id']});});});});});});})[_0x50f9('0x28')](respondWithStatusCode(_0x34e81d,null))[_0x50f9('0x4e')](handleError(_0x34e81d,null));};exports['addAgents']=function(_0x4a2dfc,_0x4f4522,_0x228945){return db[_0x50f9('0x30')]['find']({'where':{'id':_0x4a2dfc[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](handleEntityNotFound(_0x4f4522,null))[_0x50f9('0x28')](function(_0x17adbd){if(_0x17adbd){return _0x17adbd[_0x50f9('0x85')](_0x4a2dfc[_0x50f9('0x56')][_0x50f9('0x65')],_['omit'](_0x4a2dfc[_0x50f9('0x56')],[_0x50f9('0x65'),'id'])||{})[_0x50f9('0x86')](function(_0x9fe0f){for(var _0x12592c=0x0;_0x12592c<_0x4a2dfc['body'][_0x50f9('0x65')]['length'];_0x12592c+=0x1){socket[_0x50f9('0x6e')](_0x50f9('0x87'),{'UserId':_0x4a2dfc[_0x50f9('0x56')][_0x50f9('0x65')][_0x12592c],'FaxQueueId':_0x4a2dfc[_0x50f9('0x57')]['id']});}return _0x9fe0f;});}})[_0x50f9('0x28')](respondWithResult(_0x4f4522,null))['catch'](handleError(_0x4f4522,null));};exports['removeAgents']=function(_0x4ff701,_0x300138,_0x32aad4){return db[_0x50f9('0x30')][_0x50f9('0x4d')]({'where':{'id':_0x4ff701[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](handleEntityNotFound(_0x300138,null))[_0x50f9('0x28')](function(_0x414dcc){if(_0x414dcc){return _0x414dcc[_0x50f9('0x83')](_0x4ff701['query'][_0x50f9('0x65')])[_0x50f9('0x28')](function(){if(_[_0x50f9('0x88')](_0x4ff701['query'][_0x50f9('0x65')])){for(var _0x181297=0x0;_0x181297<_0x4ff701[_0x50f9('0x34')][_0x50f9('0x65')]['length'];_0x181297+=0x1){socket['emit'](_0x50f9('0x84'),{'UserId':Number(_0x4ff701['query'][_0x50f9('0x65')][_0x181297]),'FaxQueueId':Number(_0x4ff701['params']['id'])});}}else{socket[_0x50f9('0x6e')](_0x50f9('0x84'),{'UserId':Number(_0x4ff701[_0x50f9('0x34')]['ids']),'FaxQueueId':Number(_0x4ff701[_0x50f9('0x57')]['id'])});}});}})[_0x50f9('0x28')](respondWithStatusCode(_0x300138,null))[_0x50f9('0x4e')](handleError(_0x300138,null));};exports[_0x50f9('0x89')]=function(_0xf80662,_0x31b7ce,_0x442b8c){var _0x1b5124={};var _0x5670f4={};var _0x82a91b;var _0x4e7ace;return db[_0x50f9('0x30')]['findOne']({'where':{'id':_0xf80662[_0x50f9('0x57')]['id']}})[_0x50f9('0x28')](handleEntityNotFound(_0x31b7ce,null))['then'](function(_0x44571c){if(_0x44571c){_0x82a91b=_0x44571c;_0x5670f4[_0x50f9('0x37')]=_['keys'](db[_0x50f9('0x5e')]['rawAttributes']);_0x5670f4['query']=_[_0x50f9('0x4a')](_0xf80662['query']);_0x5670f4[_0x50f9('0x35')]=_[_0x50f9('0x36')](_0x5670f4[_0x50f9('0x37')],_0x5670f4[_0x50f9('0x34')]);_0x1b5124[_0x50f9('0x38')]=_[_0x50f9('0x36')](_0x5670f4[_0x50f9('0x37')],qs[_0x50f9('0x39')](_0xf80662[_0x50f9('0x34')][_0x50f9('0x39')]));_0x1b5124[_0x50f9('0x38')]=_0x1b5124[_0x50f9('0x38')][_0x50f9('0x3a')]?_0x1b5124[_0x50f9('0x38')]:_0x5670f4['model'];_0x1b5124[_0x50f9('0x3e')]=qs[_0x50f9('0x3f')](_0xf80662[_0x50f9('0x34')][_0x50f9('0x3f')]);_0x1b5124[_0x50f9('0x42')]=qs[_0x50f9('0x35')](_[_0x50f9('0x40')](_0xf80662[_0x50f9('0x34')],_0x5670f4[_0x50f9('0x35')]));if(_0xf80662[_0x50f9('0x34')][_0x50f9('0x41')]){_0x1b5124[_0x50f9('0x42')]=_['merge'](_0x1b5124[_0x50f9('0x42')],{'$or':_[_0x50f9('0x2f')](_0x1b5124[_0x50f9('0x38')],function(_0x13986c){var _0x17bc37={};_0x17bc37[_0x13986c]={'$like':'%'+_0xf80662['query'][_0x50f9('0x41')]+'%'};return _0x17bc37;})});}_0x1b5124=_[_0x50f9('0x4c')]({},_0x1b5124,_0xf80662['options']);return _0x82a91b[_0x50f9('0x89')](_0x1b5124);}})[_0x50f9('0x28')](function(_0x13b990){if(_0x13b990){_0x4e7ace=_0x13b990['length'];if(!_0xf80662[_0x50f9('0x34')][_0x50f9('0x3b')](_0x50f9('0x3c'))){_0x1b5124[_0x50f9('0x3d')]=qs[_0x50f9('0x3d')](_0xf80662[_0x50f9('0x34')][_0x50f9('0x3d')]);_0x1b5124['offset']=qs[_0x50f9('0x22')](_0xf80662[_0x50f9('0x34')][_0x50f9('0x22')]);}return _0x82a91b[_0x50f9('0x89')](_0x1b5124);}})[_0x50f9('0x28')](function(_0x2a1e9f){if(_0x2a1e9f){return _0x2a1e9f?{'count':_0x4e7ace,'rows':_0x2a1e9f}:null;}})[_0x50f9('0x28')](respondWithResult(_0x31b7ce,null))[_0x50f9('0x4e')](handleError(_0x31b7ce,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c265948..2038c18 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 _0x89e8=['save','update','remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0xf25802,_0x4b1892){var _0x482df9=function(_0x5956d1){while(--_0x5956d1){_0xf25802['push'](_0xf25802['shift']());}};_0x482df9(++_0x4b1892);}(_0x89e8,0x12e));var _0x889e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x89e8[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x889e('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x889e('0x1')](0x0);var events={'afterCreate':_0x889e('0x2'),'afterUpdate':_0x889e('0x3'),'afterDestroy':_0x889e('0x4')};function emitEvent(_0x2ecfc1){return function(_0x14c013,_0x353c9c,_0x35b650){FaxQueueEvents[_0x889e('0x5')](_0x2ecfc1+':'+_0x14c013['id'],_0x14c013);FaxQueueEvents[_0x889e('0x5')](_0x2ecfc1,_0x14c013);_0x35b650(null);};}for(var e in events){if(events[_0x889e('0x6')](e)){var event=events[e];FaxQueue[_0x889e('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x80f0=['exports','../../mysqldb','FaxQueue','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x80f0,0x99));var _0x080f=function(_0x493222,_0x323c36){_0x493222=_0x493222-0x0;var _0x87b1f9=_0x80f0[_0x493222];return _0x87b1f9;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x080f('0x0'))['db'][_0x080f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x080f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x080f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x400907){return function(_0x542031,_0x521f37,_0x1f81ea){FaxQueueEvents['emit'](_0x400907+':'+_0x542031['id'],_0x542031);FaxQueueEvents[_0x080f('0x4')](_0x400907,_0x542031);_0x1f81ea(null);};}for(var e in events){if(events[_0x080f('0x5')](e)){var event=events[e];FaxQueue[_0x080f('0x6')](e,emitEvent(event));}}module[_0x080f('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7131a42..04c972d 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 _0xf873=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d68e6,_0x3fbeeb){var _0x40ce80=function(_0x4691e4){while(--_0x4691e4){_0x4d68e6['push'](_0x4d68e6['shift']());}};_0x40ce80(++_0x3fbeeb);}(_0xf873,0xd5));var _0x3f87=function(_0x28b923,_0x1cf967){_0x28b923=_0x28b923-0x0;var _0x4babf9=_0xf873[_0x28b923];return _0x4babf9;};'use strict';var _=require(_0x3f87('0x0'));var util=require(_0x3f87('0x1'));var logger=require(_0x3f87('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3f87('0x3'));var rp=require(_0x3f87('0x4'));var fs=require('fs');var path=require(_0x3f87('0x5'));var rimraf=require(_0x3f87('0x6'));var config=require(_0x3f87('0x7'));var attributes=require(_0x3f87('0x8'));module[_0x3f87('0x9')]=function(_0x262c27,_0x3db201){return _0x262c27[_0x3f87('0xa')](_0x3f87('0xb'),attributes,{'tableName':_0x3f87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdc9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','fax_queues','lodash','util','../../config/logger'];(function(_0x584ae4,_0x4cf00d){var _0x5c6749=function(_0x5476df){while(--_0x5476df){_0x584ae4['push'](_0x584ae4['shift']());}};_0x5c6749(++_0x4cf00d);}(_0xcdc9,0x15d));var _0x9cdc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcdc9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x9cdc('0x0'));var util=require(_0x9cdc('0x1'));var logger=require(_0x9cdc('0x2'))('api');var moment=require(_0x9cdc('0x3'));var BPromise=require(_0x9cdc('0x4'));var rp=require(_0x9cdc('0x5'));var fs=require('fs');var path=require(_0x9cdc('0x6'));var rimraf=require(_0x9cdc('0x7'));var config=require(_0x9cdc('0x8'));var attributes=require('./faxQueue.attributes');module[_0x9cdc('0x9')]=function(_0x3454eb,_0x30eac1){return _0x3454eb['define']('FaxQueue',attributes,{'tableName':_0x9cdc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 69cb8a0..83001ee 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 _0x6a7d=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','options','attributes','map','include','model','find','where','ShowFaxQueue','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xf51456,_0x1bf315){var _0x1de62b=function(_0x289a5b){while(--_0x289a5b){_0xf51456['push'](_0xf51456['shift']());}};_0x1de62b(++_0x1bf315);}(_0x6a7d,0x6d));var _0xd6a7=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x6a7d[_0x5a7618];return _0x12dc65;};'use strict';var _=require('lodash');var util=require(_0xd6a7('0x0'));var moment=require('moment');var BPromise=require(_0xd6a7('0x1'));var rs=require(_0xd6a7('0x2'));var fs=require('fs');var Redis=require(_0xd6a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6a7('0x4'));var logger=require(_0xd6a7('0x5'))('rpc');var config=require(_0xd6a7('0x6'));var jayson=require(_0xd6a7('0x7'));var client=jayson[_0xd6a7('0x8')][_0xd6a7('0x9')]({'port':0x232a});config[_0xd6a7('0xa')]=_[_0xd6a7('0xb')](config[_0xd6a7('0xa')],{'host':_0xd6a7('0xc'),'port':0x18eb});var socket=require(_0xd6a7('0xd'))(new Redis(config[_0xd6a7('0xa')]));require(_0xd6a7('0xe'))[_0xd6a7('0xf')](socket);function respondWithRpcPromise(_0x59231e,_0x4f814a,_0x227710){return new BPromise(function(_0x4ed3bd,_0x25b0c8){return client[_0xd6a7('0x10')](_0x59231e,_0x227710)[_0xd6a7('0x11')](function(_0x2140be){logger[_0xd6a7('0x12')]('FaxQueue,\x20%s,\x20%s',_0x4f814a,_0xd6a7('0x13'));logger[_0xd6a7('0x14')](_0xd6a7('0x15'),_0x4f814a,_0xd6a7('0x13'),JSON[_0xd6a7('0x16')](_0x2140be));if(_0x2140be['error']){if(_0x2140be[_0xd6a7('0x17')][_0xd6a7('0x18')]===0x1f4){logger['error'](_0xd6a7('0x19'),_0x4f814a,_0x2140be[_0xd6a7('0x17')][_0xd6a7('0x1a')]);return _0x25b0c8(_0x2140be[_0xd6a7('0x17')][_0xd6a7('0x1a')]);}logger[_0xd6a7('0x17')](_0xd6a7('0x19'),_0x4f814a,_0x2140be['error'][_0xd6a7('0x1a')]);return _0x4ed3bd(_0x2140be[_0xd6a7('0x17')][_0xd6a7('0x1a')]);}else{logger[_0xd6a7('0x12')]('FaxQueue,\x20%s,\x20%s',_0x4f814a,_0xd6a7('0x13'));_0x4ed3bd(_0x2140be['result'][_0xd6a7('0x1a')]);}})[_0xd6a7('0x1b')](function(_0x2d84b3){logger[_0xd6a7('0x17')](_0xd6a7('0x19'),_0x4f814a,_0x2d84b3);_0x25b0c8(_0x2d84b3);});});}exports[_0xd6a7('0x1c')]=function(_0x5e3cbf){var _0x76dec2=this;return new Promise(function(_0x24f787,_0x499ab5){return db[_0xd6a7('0x1d')]['findAll']({'raw':_0x5e3cbf['options']?_0x5e3cbf['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e3cbf['options']?_0x5e3cbf[_0xd6a7('0x1e')]['where']||null:null,'attributes':_0x5e3cbf[_0xd6a7('0x1e')]?_0x5e3cbf[_0xd6a7('0x1e')][_0xd6a7('0x1f')]||null:null,'limit':_0x5e3cbf['options']?_0x5e3cbf[_0xd6a7('0x1e')]['limit']||null:null,'include':_0x5e3cbf[_0xd6a7('0x1e')]?_0x5e3cbf[_0xd6a7('0x1e')]['include']?_[_0xd6a7('0x20')](_0x5e3cbf[_0xd6a7('0x1e')][_0xd6a7('0x21')],function(_0x4ab577){return{'model':db[_0x4ab577['model']],'as':_0x4ab577['as'],'attributes':_0x4ab577[_0xd6a7('0x1f')],'include':_0x4ab577[_0xd6a7('0x21')]?_['map'](_0x4ab577[_0xd6a7('0x21')],function(_0x3bf73d){return{'model':db[_0x3bf73d['model']],'as':_0x3bf73d['as'],'attributes':_0x3bf73d[_0xd6a7('0x1f')],'include':_0x3bf73d[_0xd6a7('0x21')]?_[_0xd6a7('0x20')](_0x3bf73d['include'],function(_0xd86fbd){return{'model':db[_0xd86fbd[_0xd6a7('0x22')]],'as':_0xd86fbd['as'],'attributes':_0xd86fbd['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6a7('0x11')](function(_0x67ba70){logger['info'](_0xd6a7('0x1c'),_0x5e3cbf);logger[_0xd6a7('0x14')](_0xd6a7('0x1c'),_0x5e3cbf,JSON['stringify'](_0x67ba70));_0x24f787(_0x67ba70);})[_0xd6a7('0x1b')](function(_0x4a59c6){logger[_0xd6a7('0x17')]('GetFaxQueue',_0x4a59c6[_0xd6a7('0x1a')],_0x5e3cbf);_0x499ab5(_0x76dec2[_0xd6a7('0x17')](0x1f4,_0x4a59c6['message']));});});};exports['ShowFaxQueue']=function(_0x378a74){var _0x30f6da=this;return new Promise(function(_0x3b5626,_0x19f19c){return db['FaxQueue'][_0xd6a7('0x23')]({'raw':_0x378a74[_0xd6a7('0x1e')]?_0x378a74[_0xd6a7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x378a74[_0xd6a7('0x1e')]?_0x378a74['options'][_0xd6a7('0x24')]||null:null,'attributes':_0x378a74[_0xd6a7('0x1e')]?_0x378a74[_0xd6a7('0x1e')][_0xd6a7('0x1f')]||null:null,'include':_0x378a74[_0xd6a7('0x1e')]?_0x378a74['options'][_0xd6a7('0x21')]?_[_0xd6a7('0x20')](_0x378a74['options'][_0xd6a7('0x21')],function(_0x5b93e2){return{'model':db[_0x5b93e2['model']],'as':_0x5b93e2['as'],'attributes':_0x5b93e2[_0xd6a7('0x1f')],'include':_0x5b93e2[_0xd6a7('0x21')]?_[_0xd6a7('0x20')](_0x5b93e2[_0xd6a7('0x21')],function(_0x2b28e8){return{'model':db[_0x2b28e8[_0xd6a7('0x22')]],'as':_0x2b28e8['as'],'attributes':_0x2b28e8[_0xd6a7('0x1f')],'include':_0x2b28e8['include']?_[_0xd6a7('0x20')](_0x2b28e8['include'],function(_0x144d69){return{'model':db[_0x144d69['model']],'as':_0x144d69['as'],'attributes':_0x144d69[_0xd6a7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd6a7('0x11')](function(_0x3ea947){logger[_0xd6a7('0x12')](_0xd6a7('0x25'),_0x378a74);logger['debug'](_0xd6a7('0x25'),_0x378a74,JSON[_0xd6a7('0x16')](_0x3ea947));_0x3b5626(_0x3ea947);})['catch'](function(_0x5f0919){logger['error'](_0xd6a7('0x25'),_0x5f0919[_0xd6a7('0x1a')],_0x378a74);_0x19f19c(_0x30f6da[_0xd6a7('0x17')](0x1f4,_0x5f0919[_0xd6a7('0x1a')]));});});}; \ No newline at end of file +var _0x3be3=['http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','then','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31bdff,_0x21a396){var _0x1600bd=function(_0x3184f1){while(--_0x3184f1){_0x31bdff['push'](_0x31bdff['shift']());}};_0x1600bd(++_0x21a396);}(_0x3be3,0x1a5));var _0x33be=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x3be3[_0x264545];return _0x114d10;};'use strict';var _=require(_0x33be('0x0'));var util=require(_0x33be('0x1'));var moment=require('moment');var BPromise=require(_0x33be('0x2'));var rs=require(_0x33be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33be('0x4'))['db'];var utils=require(_0x33be('0x5'));var logger=require(_0x33be('0x6'))(_0x33be('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x33be('0x8')]({'port':0x232a});config[_0x33be('0x9')]=_[_0x33be('0xa')](config['redis'],{'host':_0x33be('0xb'),'port':0x18eb});var socket=require(_0x33be('0xc'))(new Redis(config[_0x33be('0x9')]));require(_0x33be('0xd'))['register'](socket);function respondWithRpcPromise(_0x29ab5e,_0x4b95d4,_0x28707c){return new BPromise(function(_0x5851fd,_0x1ab54c){return client[_0x33be('0xe')](_0x29ab5e,_0x28707c)['then'](function(_0x37dbd0){logger[_0x33be('0xf')]('FaxQueue,\x20%s,\x20%s',_0x4b95d4,_0x33be('0x10'));logger[_0x33be('0x11')](_0x33be('0x12'),_0x4b95d4,'request\x20sent',JSON[_0x33be('0x13')](_0x37dbd0));if(_0x37dbd0[_0x33be('0x14')]){if(_0x37dbd0[_0x33be('0x14')]['code']===0x1f4){logger['error'](_0x33be('0x15'),_0x4b95d4,_0x37dbd0['error'][_0x33be('0x16')]);return _0x1ab54c(_0x37dbd0[_0x33be('0x14')][_0x33be('0x16')]);}logger[_0x33be('0x14')]('FaxQueue,\x20%s,\x20%s',_0x4b95d4,_0x37dbd0[_0x33be('0x14')][_0x33be('0x16')]);return _0x5851fd(_0x37dbd0[_0x33be('0x14')][_0x33be('0x16')]);}else{logger[_0x33be('0xf')](_0x33be('0x15'),_0x4b95d4,'request\x20sent');_0x5851fd(_0x37dbd0[_0x33be('0x17')]['message']);}})['catch'](function(_0x83709d){logger[_0x33be('0x14')](_0x33be('0x15'),_0x4b95d4,_0x83709d);_0x1ab54c(_0x83709d);});});}exports[_0x33be('0x18')]=function(_0x9e5398){var _0x5ea89d=this;return new Promise(function(_0x3e7be4,_0x736bc6){return db[_0x33be('0x19')][_0x33be('0x1a')]({'raw':_0x9e5398[_0x33be('0x1b')]?_0x9e5398[_0x33be('0x1b')][_0x33be('0x1c')]===undefined?!![]:![]:!![],'where':_0x9e5398[_0x33be('0x1b')]?_0x9e5398[_0x33be('0x1b')][_0x33be('0x1d')]||null:null,'attributes':_0x9e5398[_0x33be('0x1b')]?_0x9e5398[_0x33be('0x1b')][_0x33be('0x1e')]||null:null,'limit':_0x9e5398[_0x33be('0x1b')]?_0x9e5398[_0x33be('0x1b')][_0x33be('0x1f')]||null:null,'include':_0x9e5398[_0x33be('0x1b')]?_0x9e5398[_0x33be('0x1b')][_0x33be('0x20')]?_[_0x33be('0x21')](_0x9e5398['options'][_0x33be('0x20')],function(_0x3973e2){return{'model':db[_0x3973e2[_0x33be('0x22')]],'as':_0x3973e2['as'],'attributes':_0x3973e2[_0x33be('0x1e')],'include':_0x3973e2['include']?_['map'](_0x3973e2[_0x33be('0x20')],function(_0x14b86a){return{'model':db[_0x14b86a[_0x33be('0x22')]],'as':_0x14b86a['as'],'attributes':_0x14b86a['attributes'],'include':_0x14b86a['include']?_[_0x33be('0x21')](_0x14b86a[_0x33be('0x20')],function(_0x597368){return{'model':db[_0x597368[_0x33be('0x22')]],'as':_0x597368['as'],'attributes':_0x597368[_0x33be('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x376cf1){logger[_0x33be('0xf')](_0x33be('0x18'),_0x9e5398);logger[_0x33be('0x11')](_0x33be('0x18'),_0x9e5398,JSON[_0x33be('0x13')](_0x376cf1));_0x3e7be4(_0x376cf1);})['catch'](function(_0x242e26){logger['error'](_0x33be('0x18'),_0x242e26[_0x33be('0x16')],_0x9e5398);_0x736bc6(_0x5ea89d[_0x33be('0x14')](0x1f4,_0x242e26[_0x33be('0x16')]));});});};exports[_0x33be('0x23')]=function(_0x2bb162){var _0xae1efa=this;return new Promise(function(_0x538368,_0x18251c){return db[_0x33be('0x19')][_0x33be('0x24')]({'raw':_0x2bb162[_0x33be('0x1b')]?_0x2bb162[_0x33be('0x1b')][_0x33be('0x1c')]===undefined?!![]:![]:!![],'where':_0x2bb162[_0x33be('0x1b')]?_0x2bb162[_0x33be('0x1b')][_0x33be('0x1d')]||null:null,'attributes':_0x2bb162[_0x33be('0x1b')]?_0x2bb162[_0x33be('0x1b')][_0x33be('0x1e')]||null:null,'include':_0x2bb162[_0x33be('0x1b')]?_0x2bb162[_0x33be('0x1b')]['include']?_[_0x33be('0x21')](_0x2bb162['options'][_0x33be('0x20')],function(_0xe680){return{'model':db[_0xe680[_0x33be('0x22')]],'as':_0xe680['as'],'attributes':_0xe680[_0x33be('0x1e')],'include':_0xe680[_0x33be('0x20')]?_['map'](_0xe680[_0x33be('0x20')],function(_0x392fa9){return{'model':db[_0x392fa9[_0x33be('0x22')]],'as':_0x392fa9['as'],'attributes':_0x392fa9[_0x33be('0x1e')],'include':_0x392fa9[_0x33be('0x20')]?_[_0x33be('0x21')](_0x392fa9['include'],function(_0x300440){return{'model':db[_0x300440[_0x33be('0x22')]],'as':_0x300440['as'],'attributes':_0x300440[_0x33be('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33be('0x25')](function(_0x167ceb){logger[_0x33be('0xf')](_0x33be('0x23'),_0x2bb162);logger[_0x33be('0x11')]('ShowFaxQueue',_0x2bb162,JSON['stringify'](_0x167ceb));_0x538368(_0x167ceb);})[_0x33be('0x26')](function(_0xeb7615){logger[_0x33be('0x14')](_0x33be('0x23'),_0xeb7615['message'],_0x2bb162);_0x18251c(_0xae1efa[_0x33be('0x14')](0x1f4,_0xeb7615[_0x33be('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ca728d4..4501faa 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 _0x3597=['update','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x3597,0x1c5));var _0x7359=function(_0x2ac7b5,_0x191fb6){_0x2ac7b5=_0x2ac7b5-0x0;var _0x27b2c0=_0x3597[_0x2ac7b5];return _0x27b2c0;};'use strict';var FaxQueueEvents=require(_0x7359('0x0'));var events=[_0x7359('0x1'),'remove',_0x7359('0x2')];function createListener(_0x5b12b9,_0x49c1fe){return function(_0x35b94b){_0x49c1fe['emit'](_0x5b12b9,_0x35b94b);};}function removeListener(_0x32b862,_0x5dc2f2){return function(){FaxQueueEvents[_0x7359('0x3')](_0x32b862,_0x5dc2f2);};}exports[_0x7359('0x4')]=function(_0x620b89){for(var _0x58dbc9=0x0,_0x492de7=events[_0x7359('0x5')];_0x58dbc9<_0x492de7;_0x58dbc9++){var _0x5047b0=events[_0x58dbc9];var _0x510e04=createListener(_0x7359('0x6')+_0x5047b0,_0x620b89);FaxQueueEvents['on'](_0x5047b0,_0x510e04);}}; \ No newline at end of file +var _0xbd52=['removeListener','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbd52,0x106));var _0x2bd5=function(_0x1f063b,_0x321a3c){_0x1f063b=_0x1f063b-0x0;var _0x4d864b=_0xbd52[_0x1f063b];return _0x4d864b;};'use strict';var FaxQueueEvents=require(_0x2bd5('0x0'));var events=[_0x2bd5('0x1'),_0x2bd5('0x2'),_0x2bd5('0x3')];function createListener(_0x158cbb,_0x325399){return function(_0x58a6a1){_0x325399['emit'](_0x158cbb,_0x58a6a1);};}function removeListener(_0x458d4a,_0x3eb4ef){return function(){FaxQueueEvents[_0x2bd5('0x4')](_0x458d4a,_0x3eb4ef);};}exports['register']=function(_0x32a889){for(var _0x34d2c9=0x0,_0x115f88=events[_0x2bd5('0x5')];_0x34d2c9<_0x115f88;_0x34d2c9++){var _0x295f05=events[_0x34d2c9];var _0x4a3793=createListener(_0x2bd5('0x6')+_0x295f05,_0x32a889);FaxQueueEvents['on'](_0x295f05,_0x4a3793);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 37f7f19..c16b9f4 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x12d75f,_0x3d341b){var _0x150016=function(_0x4f725a){while(--_0x4f725a){_0x12d75f['push'](_0x12d75f['shift']());}};_0x150016(++_0x3d341b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x3958fe,_0x3c6605){var _0x1f27d6=function(_0x2bfb4a){while(--_0x2bfb4a){_0x3958fe['push'](_0x3958fe['shift']());}};_0x1f27d6(++_0x3c6605);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ed9ee7e..8ef264a 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 _0x5851=['DATE','moment','exports','STRING'];(function(_0x4a2e7a,_0x4ab75b){var _0x317e4e=function(_0x5bf314){while(--_0x5bf314){_0x4a2e7a['push'](_0x4a2e7a['shift']());}};_0x317e4e(++_0x4ab75b);}(_0x5851,0x191));var _0x1585=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5851[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x1585('0x0'));var Sequelize=require('sequelize');module[_0x1585('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1585('0x2')]},'joinAt':{'type':Sequelize[_0x1585('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1585('0x3')]},'exitAt':{'type':Sequelize[_0x1585('0x3')]},'reason':{'type':Sequelize[_0x1585('0x2')]}}; \ No newline at end of file +var _0x08b6=['STRING','DATE','moment','sequelize'];(function(_0xc7240f,_0x22a39f){var _0x1191dd=function(_0xa199a5){while(--_0xa199a5){_0xc7240f['push'](_0xc7240f['shift']());}};_0x1191dd(++_0x22a39f);}(_0x08b6,0xfe));var _0x608b=function(_0x4dcfe9,_0x3f4bbc){_0x4dcfe9=_0x4dcfe9-0x0;var _0x5c19b5=_0x08b6[_0x4dcfe9];return _0x5c19b5;};'use strict';var moment=require(_0x608b('0x0'));var Sequelize=require(_0x608b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x608b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x608b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x608b('0x3')]},'acceptAt':{'type':Sequelize[_0x608b('0x3')]},'exitAt':{'type':Sequelize[_0x608b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b9d038d..7cddccf 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 _0x5a09=['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','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','catch','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0x5a09,0x84));var _0x95a0=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x5a09[_0x3c59fc];return _0x2b78d4;};'use strict';var pdf=require(_0x95a0('0x0'));var emlformat=require(_0x95a0('0x1'));var rimraf=require(_0x95a0('0x2'));var zipdir=require(_0x95a0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95a0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95a0('0x5'));var util=require(_0x95a0('0x6'));var path=require(_0x95a0('0x7'));var sox=require('sox');var csv=require(_0x95a0('0x8'));var ejs=require(_0x95a0('0x9'));var fs=require('fs');var _=require(_0x95a0('0xa'));var squel=require(_0x95a0('0xb'));var crypto=require(_0x95a0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x95a0('0xd'));var toCsv=require(_0x95a0('0x8'));var querystring=require(_0x95a0('0xe'));var Papa=require(_0x95a0('0xf'));var Redis=require(_0x95a0('0x10'));var authService=require(_0x95a0('0x11'));var qs=require(_0x95a0('0x12'));var as=require(_0x95a0('0x13'));var hardwareService=require(_0x95a0('0x14'));var logger=require(_0x95a0('0x15'))('api');var utils=require(_0x95a0('0x16'));var config=require(_0x95a0('0x17'));var licenseUtil=require(_0x95a0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2110f0,_0xa87d3){_0xa87d3=_0xa87d3||0xcc;return function(_0x16119f){if(_0x16119f){return _0x2110f0['sendStatus'](_0xa87d3);}return _0x2110f0['status'](_0xa87d3)[_0x95a0('0x19')]();};}function respondWithResult(_0xd26a7b,_0x4bb01a){_0x4bb01a=_0x4bb01a||0xc8;return function(_0xd6a712){if(_0xd6a712){return _0xd26a7b[_0x95a0('0x1a')](_0x4bb01a)[_0x95a0('0x1b')](_0xd6a712);}};}function respondWithFilteredResult(_0x36518f,_0x545563){return function(_0x643a95){if(_0x643a95){var _0x1422bf=_0x643a95[_0x95a0('0x1c')],_0x2e0a8e=_0x545563[_0x95a0('0x1d')],_0x489fb0=_0x545563[_0x95a0('0x1d')]+_0x545563[_0x95a0('0x1e')],_0x26ce20;if(_0x489fb0>=_0x1422bf){_0x489fb0=_0x1422bf;_0x26ce20=0xc8;}else{_0x26ce20=0xce;}_0x36518f[_0x95a0('0x1a')](_0x26ce20);return _0x36518f[_0x95a0('0x1f')]('Content-Range',_0x2e0a8e+'-'+_0x489fb0+'/'+_0x1422bf)[_0x95a0('0x1b')](_0x643a95);}return null;};}function patchUpdates(_0x3558e7){return function(_0x3ccc49){try{jsonpatch[_0x95a0('0x20')](_0x3ccc49,_0x3558e7,!![]);}catch(_0x5f5787){return BPromise[_0x95a0('0x21')](_0x5f5787);}return _0x3ccc49[_0x95a0('0x22')]();};}function saveUpdates(_0x467f9a,_0xa63e3a){return function(_0x6f975c){if(_0x6f975c){return _0x6f975c[_0x95a0('0x23')](_0x467f9a)[_0x95a0('0x24')](function(_0x14af82){return _0x14af82;});}return null;};}function removeEntity(_0x16040f,_0x1d9674){return function(_0xd32361){if(_0xd32361){return _0xd32361[_0x95a0('0x25')]()[_0x95a0('0x24')](function(){_0x16040f['status'](0xcc)[_0x95a0('0x19')]();});}};}function handleEntityNotFound(_0x23a00e,_0x40873d){return function(_0x218f4d){if(!_0x218f4d){_0x23a00e[_0x95a0('0x26')](0x194);}return _0x218f4d;};}function handleError(_0x2688ea,_0x4c886d){_0x4c886d=_0x4c886d||0x1f4;return function(_0x2a15d1){logger[_0x95a0('0x27')](_0x2a15d1['stack']);if(_0x2a15d1[_0x95a0('0x28')]){delete _0x2a15d1[_0x95a0('0x28')];}_0x2688ea[_0x95a0('0x1a')](_0x4c886d)[_0x95a0('0x29')](_0x2a15d1);};}exports[_0x95a0('0x2a')]=function(_0x4697cc,_0x13ec2f){var _0x465653={},_0x2cfb66={},_0x722848={'count':0x0,'rows':[]};var _0x5e8576=_[_0x95a0('0x2b')](db[_0x95a0('0x2c')][_0x95a0('0x2d')],function(_0x51c1c3){return{'name':_0x51c1c3[_0x95a0('0x2e')],'type':_0x51c1c3[_0x95a0('0x2f')][_0x95a0('0x30')]};});_0x2cfb66['model']=_[_0x95a0('0x2b')](_0x5e8576,'name');_0x2cfb66['query']=_[_0x95a0('0x31')](_0x4697cc[_0x95a0('0x32')]);_0x2cfb66[_0x95a0('0x33')]=_['intersection'](_0x2cfb66[_0x95a0('0x34')],_0x2cfb66[_0x95a0('0x32')]);_0x465653[_0x95a0('0x35')]=_[_0x95a0('0x36')](_0x2cfb66['model'],qs[_0x95a0('0x37')](_0x4697cc[_0x95a0('0x32')][_0x95a0('0x37')]));_0x465653[_0x95a0('0x35')]=_0x465653[_0x95a0('0x35')][_0x95a0('0x38')]?_0x465653[_0x95a0('0x35')]:_0x2cfb66['model'];if(!_0x4697cc[_0x95a0('0x32')]['hasOwnProperty'](_0x95a0('0x39'))){_0x465653['limit']=qs[_0x95a0('0x1e')](_0x4697cc[_0x95a0('0x32')][_0x95a0('0x1e')]);_0x465653[_0x95a0('0x1d')]=qs[_0x95a0('0x1d')](_0x4697cc[_0x95a0('0x32')][_0x95a0('0x1d')]);}_0x465653['order']=qs[_0x95a0('0x3a')](_0x4697cc[_0x95a0('0x32')]['sort']);_0x465653['where']=qs[_0x95a0('0x33')](_['pick'](_0x4697cc[_0x95a0('0x32')],_0x2cfb66[_0x95a0('0x33')]),_0x5e8576);if(_0x4697cc['query'][_0x95a0('0x3b')]){_0x465653[_0x95a0('0x3c')]=_[_0x95a0('0x3d')](_0x465653[_0x95a0('0x3c')],{'$or':_[_0x95a0('0x2b')](_0x5e8576,function(_0xf6cc59){if(_0xf6cc59[_0x95a0('0x2f')]!==_0x95a0('0x3e')){var _0x3db0e6={};_0x3db0e6[_0xf6cc59['name']]={'$like':'%'+_0x4697cc[_0x95a0('0x32')]['filter']+'%'};return _0x3db0e6;}})});}_0x465653=_[_0x95a0('0x3d')]({},_0x465653,_0x4697cc['options']);var _0x4ed23f={'where':_0x465653[_0x95a0('0x3c')]};return db['FaxQueueReport'][_0x95a0('0x1c')](_0x4ed23f)[_0x95a0('0x24')](function(_0x3fdfd1){_0x722848['count']=_0x3fdfd1;if(_0x4697cc['query'][_0x95a0('0x3f')]){_0x465653[_0x95a0('0x40')]=[{'all':!![]}];}return db[_0x95a0('0x2c')]['findAll'](_0x465653);})['then'](function(_0x4b7683){_0x722848['rows']=_0x4b7683;return _0x722848;})[_0x95a0('0x24')](respondWithFilteredResult(_0x13ec2f,_0x465653))[_0x95a0('0x41')](handleError(_0x13ec2f,null));};exports['show']=function(_0x3a5478,_0x53162b){var _0x1436df={'raw':!![],'where':{'id':_0x3a5478['params']['id']}},_0x4a4433={};_0x4a4433[_0x95a0('0x34')]=_[_0x95a0('0x31')](db[_0x95a0('0x2c')][_0x95a0('0x2d')]);_0x4a4433[_0x95a0('0x32')]=_['keys'](_0x3a5478['query']);_0x4a4433[_0x95a0('0x33')]=_[_0x95a0('0x36')](_0x4a4433[_0x95a0('0x34')],_0x4a4433['query']);_0x1436df['attributes']=_['intersection'](_0x4a4433['model'],qs[_0x95a0('0x37')](_0x3a5478['query'][_0x95a0('0x37')]));_0x1436df[_0x95a0('0x35')]=_0x1436df[_0x95a0('0x35')]['length']?_0x1436df['attributes']:_0x4a4433['model'];if(_0x3a5478[_0x95a0('0x32')]['includeAll']){_0x1436df[_0x95a0('0x40')]=[{'all':!![]}];}_0x1436df=_[_0x95a0('0x3d')]({},_0x1436df,_0x3a5478[_0x95a0('0x42')]);return db['FaxQueueReport']['find'](_0x1436df)[_0x95a0('0x24')](handleEntityNotFound(_0x53162b,null))[_0x95a0('0x24')](respondWithResult(_0x53162b,null))[_0x95a0('0x41')](handleError(_0x53162b,null));};exports[_0x95a0('0x43')]=function(_0x18a6b0,_0x5f55cd){return db[_0x95a0('0x2c')][_0x95a0('0x43')](_0x18a6b0[_0x95a0('0x44')],{})[_0x95a0('0x24')](respondWithResult(_0x5f55cd,0xc9))[_0x95a0('0x41')](handleError(_0x5f55cd,null));};exports[_0x95a0('0x23')]=function(_0x48032e,_0x5bd825){if(_0x48032e[_0x95a0('0x44')]['id']){delete _0x48032e[_0x95a0('0x44')]['id'];}return db[_0x95a0('0x2c')][_0x95a0('0x45')]({'where':{'id':_0x48032e[_0x95a0('0x46')]['id']}})[_0x95a0('0x24')](handleEntityNotFound(_0x5bd825,null))[_0x95a0('0x24')](saveUpdates(_0x48032e['body'],null))[_0x95a0('0x24')](respondWithResult(_0x5bd825,null))[_0x95a0('0x41')](handleError(_0x5bd825,null));};exports[_0x95a0('0x25')]=function(_0x58ca20,_0x37d9d5){return db[_0x95a0('0x2c')]['find']({'where':{'id':_0x58ca20[_0x95a0('0x46')]['id']}})['then'](handleEntityNotFound(_0x37d9d5,null))[_0x95a0('0x24')](removeEntity(_0x37d9d5,null))[_0x95a0('0x41')](handleError(_0x37d9d5,null));};exports[_0x95a0('0x47')]=function(_0x5cf839,_0x188649){return db[_0x95a0('0x2c')][_0x95a0('0x47')]()[_0x95a0('0x24')](respondWithResult(_0x188649,null))[_0x95a0('0x41')](handleError(_0x188649,null));}; \ No newline at end of file +var _0x2e1c=['hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','FaxQueueReport','then','includeAll','include','catch','params','keys','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','end','error','name','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e1c,0xa2));var _0xc2e1=function(_0x4a4a88,_0x1ebcac){_0x4a4a88=_0x4a4a88-0x0;var _0x1df491=_0x2e1c[_0x4a4a88];return _0x1df491;};'use strict';var pdf=require(_0xc2e1('0x0'));var emlformat=require(_0xc2e1('0x1'));var rimraf=require(_0xc2e1('0x2'));var zipdir=require(_0xc2e1('0x3'));var jsonpatch=require(_0xc2e1('0x4'));var rp=require(_0xc2e1('0x5'));var moment=require('moment');var BPromise=require(_0xc2e1('0x6'));var Mustache=require(_0xc2e1('0x7'));var util=require(_0xc2e1('0x8'));var path=require('path');var sox=require(_0xc2e1('0x9'));var csv=require(_0xc2e1('0xa'));var ejs=require(_0xc2e1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc2e1('0xc'));var crypto=require(_0xc2e1('0xd'));var jsforce=require(_0xc2e1('0xe'));var deskjs=require(_0xc2e1('0xf'));var toCsv=require(_0xc2e1('0xa'));var querystring=require(_0xc2e1('0x10'));var Papa=require(_0xc2e1('0x11'));var Redis=require(_0xc2e1('0x12'));var authService=require(_0xc2e1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2e1('0x14'))('api');var utils=require(_0xc2e1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc2e1('0x16'))['db'];function respondWithStatusCode(_0x3f796a,_0xf39069){_0xf39069=_0xf39069||0xcc;return function(_0x16f598){if(_0x16f598){return _0x3f796a[_0xc2e1('0x17')](_0xf39069);}return _0x3f796a[_0xc2e1('0x18')](_0xf39069)['end']();};}function respondWithResult(_0x37460f,_0x139a94){_0x139a94=_0x139a94||0xc8;return function(_0x1cb074){if(_0x1cb074){return _0x37460f[_0xc2e1('0x18')](_0x139a94)[_0xc2e1('0x19')](_0x1cb074);}};}function respondWithFilteredResult(_0x37f708,_0x235c4c){return function(_0x1f7a2f){if(_0x1f7a2f){var _0x4b9e57=_0x1f7a2f[_0xc2e1('0x1a')],_0x194b57=_0x235c4c[_0xc2e1('0x1b')],_0x3b9cba=_0x235c4c[_0xc2e1('0x1b')]+_0x235c4c[_0xc2e1('0x1c')],_0x128c15;if(_0x3b9cba>=_0x4b9e57){_0x3b9cba=_0x4b9e57;_0x128c15=0xc8;}else{_0x128c15=0xce;}_0x37f708[_0xc2e1('0x18')](_0x128c15);return _0x37f708['set'](_0xc2e1('0x1d'),_0x194b57+'-'+_0x3b9cba+'/'+_0x4b9e57)['json'](_0x1f7a2f);}return null;};}function patchUpdates(_0x50bc0f){return function(_0x125420){try{jsonpatch[_0xc2e1('0x1e')](_0x125420,_0x50bc0f,!![]);}catch(_0x3b97b7){return BPromise['reject'](_0x3b97b7);}return _0x125420[_0xc2e1('0x1f')]();};}function saveUpdates(_0x16fa19,_0x2b01d2){return function(_0x438e88){if(_0x438e88){return _0x438e88[_0xc2e1('0x20')](_0x16fa19)['then'](function(_0x410ff9){return _0x410ff9;});}return null;};}function removeEntity(_0x108163,_0x5d2533){return function(_0x558be8){if(_0x558be8){return _0x558be8['destroy']()['then'](function(){_0x108163['status'](0xcc)[_0xc2e1('0x21')]();});}};}function handleEntityNotFound(_0xcb22ad,_0x514ffe){return function(_0x5254d3){if(!_0x5254d3){_0xcb22ad[_0xc2e1('0x17')](0x194);}return _0x5254d3;};}function handleError(_0x2862ed,_0x7c93c8){_0x7c93c8=_0x7c93c8||0x1f4;return function(_0x5bf464){logger[_0xc2e1('0x22')](_0x5bf464['stack']);if(_0x5bf464[_0xc2e1('0x23')]){delete _0x5bf464['name'];}_0x2862ed[_0xc2e1('0x18')](_0x7c93c8)['send'](_0x5bf464);};}exports[_0xc2e1('0x24')]=function(_0x5c239f,_0x13f01f){var _0x2f6e7d={},_0x25edb3={},_0xe16e91={'count':0x0,'rows':[]};var _0x2efd9d=_[_0xc2e1('0x25')](db['FaxQueueReport'][_0xc2e1('0x26')],function(_0x31ea80){return{'name':_0x31ea80[_0xc2e1('0x27')],'type':_0x31ea80[_0xc2e1('0x28')]['key']};});_0x25edb3[_0xc2e1('0x29')]=_[_0xc2e1('0x25')](_0x2efd9d,_0xc2e1('0x23'));_0x25edb3[_0xc2e1('0x2a')]=_['keys'](_0x5c239f['query']);_0x25edb3[_0xc2e1('0x2b')]=_['intersection'](_0x25edb3[_0xc2e1('0x29')],_0x25edb3['query']);_0x2f6e7d[_0xc2e1('0x2c')]=_[_0xc2e1('0x2d')](_0x25edb3[_0xc2e1('0x29')],qs['fields'](_0x5c239f[_0xc2e1('0x2a')][_0xc2e1('0x2e')]));_0x2f6e7d[_0xc2e1('0x2c')]=_0x2f6e7d[_0xc2e1('0x2c')][_0xc2e1('0x2f')]?_0x2f6e7d[_0xc2e1('0x2c')]:_0x25edb3[_0xc2e1('0x29')];if(!_0x5c239f[_0xc2e1('0x2a')][_0xc2e1('0x30')](_0xc2e1('0x31'))){_0x2f6e7d['limit']=qs[_0xc2e1('0x1c')](_0x5c239f[_0xc2e1('0x2a')]['limit']);_0x2f6e7d[_0xc2e1('0x1b')]=qs[_0xc2e1('0x1b')](_0x5c239f[_0xc2e1('0x2a')][_0xc2e1('0x1b')]);}_0x2f6e7d[_0xc2e1('0x32')]=qs[_0xc2e1('0x33')](_0x5c239f['query'][_0xc2e1('0x33')]);_0x2f6e7d['where']=qs['filters'](_[_0xc2e1('0x34')](_0x5c239f['query'],_0x25edb3['filters']),_0x2efd9d);if(_0x5c239f[_0xc2e1('0x2a')]['filter']){_0x2f6e7d['where']=_[_0xc2e1('0x35')](_0x2f6e7d[_0xc2e1('0x36')],{'$or':_['map'](_0x2efd9d,function(_0x27424d){if(_0x27424d[_0xc2e1('0x28')]!==_0xc2e1('0x37')){var _0x35f16c={};_0x35f16c[_0x27424d[_0xc2e1('0x23')]]={'$like':'%'+_0x5c239f['query'][_0xc2e1('0x38')]+'%'};return _0x35f16c;}})});}_0x2f6e7d=_[_0xc2e1('0x35')]({},_0x2f6e7d,_0x5c239f[_0xc2e1('0x39')]);var _0x4d5df7={'where':_0x2f6e7d[_0xc2e1('0x36')]};return db[_0xc2e1('0x3a')][_0xc2e1('0x1a')](_0x4d5df7)[_0xc2e1('0x3b')](function(_0x4e2821){_0xe16e91[_0xc2e1('0x1a')]=_0x4e2821;if(_0x5c239f[_0xc2e1('0x2a')][_0xc2e1('0x3c')]){_0x2f6e7d[_0xc2e1('0x3d')]=[{'all':!![]}];}return db[_0xc2e1('0x3a')]['findAll'](_0x2f6e7d);})[_0xc2e1('0x3b')](function(_0x3894ff){_0xe16e91['rows']=_0x3894ff;return _0xe16e91;})['then'](respondWithFilteredResult(_0x13f01f,_0x2f6e7d))[_0xc2e1('0x3e')](handleError(_0x13f01f,null));};exports['show']=function(_0x3e8fad,_0x12d333){var _0x4263ef={'raw':!![],'where':{'id':_0x3e8fad[_0xc2e1('0x3f')]['id']}},_0x22e021={};_0x22e021[_0xc2e1('0x29')]=_[_0xc2e1('0x40')](db[_0xc2e1('0x3a')][_0xc2e1('0x26')]);_0x22e021[_0xc2e1('0x2a')]=_[_0xc2e1('0x40')](_0x3e8fad[_0xc2e1('0x2a')]);_0x22e021[_0xc2e1('0x2b')]=_[_0xc2e1('0x2d')](_0x22e021[_0xc2e1('0x29')],_0x22e021[_0xc2e1('0x2a')]);_0x4263ef['attributes']=_[_0xc2e1('0x2d')](_0x22e021['model'],qs[_0xc2e1('0x2e')](_0x3e8fad[_0xc2e1('0x2a')][_0xc2e1('0x2e')]));_0x4263ef[_0xc2e1('0x2c')]=_0x4263ef[_0xc2e1('0x2c')]['length']?_0x4263ef['attributes']:_0x22e021[_0xc2e1('0x29')];if(_0x3e8fad[_0xc2e1('0x2a')][_0xc2e1('0x3c')]){_0x4263ef[_0xc2e1('0x3d')]=[{'all':!![]}];}_0x4263ef=_[_0xc2e1('0x35')]({},_0x4263ef,_0x3e8fad[_0xc2e1('0x39')]);return db['FaxQueueReport'][_0xc2e1('0x41')](_0x4263ef)[_0xc2e1('0x3b')](handleEntityNotFound(_0x12d333,null))['then'](respondWithResult(_0x12d333,null))[_0xc2e1('0x3e')](handleError(_0x12d333,null));};exports[_0xc2e1('0x42')]=function(_0x2ca3d2,_0x14b816){return db[_0xc2e1('0x3a')][_0xc2e1('0x42')](_0x2ca3d2[_0xc2e1('0x43')],{})['then'](respondWithResult(_0x14b816,0xc9))['catch'](handleError(_0x14b816,null));};exports[_0xc2e1('0x20')]=function(_0x42bc26,_0x171a66){if(_0x42bc26['body']['id']){delete _0x42bc26[_0xc2e1('0x43')]['id'];}return db[_0xc2e1('0x3a')][_0xc2e1('0x41')]({'where':{'id':_0x42bc26[_0xc2e1('0x3f')]['id']}})[_0xc2e1('0x3b')](handleEntityNotFound(_0x171a66,null))['then'](saveUpdates(_0x42bc26[_0xc2e1('0x43')],null))[_0xc2e1('0x3b')](respondWithResult(_0x171a66,null))[_0xc2e1('0x3e')](handleError(_0x171a66,null));};exports[_0xc2e1('0x44')]=function(_0x1055ba,_0x5e5804){return db[_0xc2e1('0x3a')]['find']({'where':{'id':_0x1055ba[_0xc2e1('0x3f')]['id']}})[_0xc2e1('0x3b')](handleEntityNotFound(_0x5e5804,null))[_0xc2e1('0x3b')](removeEntity(_0x5e5804,null))[_0xc2e1('0x3e')](handleError(_0x5e5804,null));};exports[_0xc2e1('0x45')]=function(_0x22d434,_0x4602ef){return db[_0xc2e1('0x3a')][_0xc2e1('0x45')]()[_0xc2e1('0x3b')](respondWithResult(_0x4602ef,null))['catch'](handleError(_0x4602ef,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4036a53..d398aba 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 _0x8430=['moment','request-promise','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0xa9a14a,_0x2bb967){var _0x5efa74=function(_0x4bdfbd){while(--_0x4bdfbd){_0xa9a14a['push'](_0xa9a14a['shift']());}};_0x5efa74(++_0x2bb967);}(_0x8430,0xd4));var _0x0843=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x8430[_0x5a7e78];return _0xa8d4a1;};'use strict';var _=require(_0x0843('0x0'));var util=require(_0x0843('0x1'));var logger=require(_0x0843('0x2'))(_0x0843('0x3'));var moment=require(_0x0843('0x4'));var BPromise=require('bluebird');var rp=require(_0x0843('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0843('0x6'));module[_0x0843('0x7')]=function(_0x11c698,_0x3d1edb){return _0x11c698[_0x0843('0x8')](_0x0843('0x9'),attributes,{'tableName':_0x0843('0xa'),'paranoid':![],'indexes':[{'name':_0x0843('0xb'),'fields':[_0x0843('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd87=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x47ade3,_0x41fc16){var _0x3f7b76=function(_0xfd1236){while(--_0xfd1236){_0x47ade3['push'](_0x47ade3['shift']());}};_0x3f7b76(++_0x41fc16);}(_0xcd87,0xca));var _0x7cd8=function(_0x411b42,_0x5b6d51){_0x411b42=_0x411b42-0x0;var _0x22e535=_0xcd87[_0x411b42];return _0x22e535;};'use strict';var _=require(_0x7cd8('0x0'));var util=require('util');var logger=require(_0x7cd8('0x1'))(_0x7cd8('0x2'));var moment=require(_0x7cd8('0x3'));var BPromise=require(_0x7cd8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cd8('0x5'));var rimraf=require(_0x7cd8('0x6'));var config=require(_0x7cd8('0x7'));var attributes=require('./faxQueueReport.attributes');module[_0x7cd8('0x8')]=function(_0x3cf0f7,_0x45235f){return _0x3cf0f7[_0x7cd8('0x9')]('FaxQueueReport',attributes,{'tableName':_0x7cd8('0xa'),'paranoid':![],'indexes':[{'name':_0x7cd8('0xb'),'fields':[_0x7cd8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 5aa40fc..b244ed1 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 _0x5b2b=['code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5b2b,0x153));var _0xb5b2=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0x5b2b[_0x9148ba];return _0x355e3b;};'use strict';var _=require(_0xb5b2('0x0'));var util=require(_0xb5b2('0x1'));var moment=require(_0xb5b2('0x2'));var BPromise=require(_0xb5b2('0x3'));var rs=require(_0xb5b2('0x4'));var fs=require('fs');var Redis=require(_0xb5b2('0x5'));var db=require(_0xb5b2('0x6'))['db'];var utils=require(_0xb5b2('0x7'));var logger=require(_0xb5b2('0x8'))(_0xb5b2('0x9'));var config=require(_0xb5b2('0xa'));var jayson=require(_0xb5b2('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9c38ee,_0x1413b8,_0x458893){return new BPromise(function(_0x13791d,_0x30445e){return client[_0xb5b2('0xc')](_0x9c38ee,_0x458893)[_0xb5b2('0xd')](function(_0x2caa49){logger[_0xb5b2('0xe')](_0xb5b2('0xf'),_0x1413b8,_0xb5b2('0x10'));logger[_0xb5b2('0x11')](_0xb5b2('0x12'),_0x1413b8,'request\x20sent',JSON[_0xb5b2('0x13')](_0x2caa49));if(_0x2caa49[_0xb5b2('0x14')]){if(_0x2caa49[_0xb5b2('0x14')][_0xb5b2('0x15')]===0x1f4){logger[_0xb5b2('0x14')](_0xb5b2('0xf'),_0x1413b8,_0x2caa49[_0xb5b2('0x14')][_0xb5b2('0x16')]);return _0x30445e(_0x2caa49['error'][_0xb5b2('0x16')]);}logger[_0xb5b2('0x14')](_0xb5b2('0xf'),_0x1413b8,_0x2caa49[_0xb5b2('0x14')][_0xb5b2('0x16')]);return _0x13791d(_0x2caa49[_0xb5b2('0x14')]['message']);}else{logger['info'](_0xb5b2('0xf'),_0x1413b8,'request\x20sent');_0x13791d(_0x2caa49[_0xb5b2('0x17')][_0xb5b2('0x16')]);}})[_0xb5b2('0x18')](function(_0x3a7956){logger[_0xb5b2('0x14')](_0xb5b2('0xf'),_0x1413b8,_0x3a7956);_0x30445e(_0x3a7956);});});}exports[_0xb5b2('0x19')]=function(_0x27ff06){var _0x3214b2=this;return new Promise(function(_0x12bf72,_0x27b034){return db[_0xb5b2('0x1a')][_0xb5b2('0x1b')](_0x27ff06[_0xb5b2('0x1c')],{'raw':_0x27ff06[_0xb5b2('0x1d')]?_0x27ff06['options'][_0xb5b2('0x1e')]===undefined?!![]:![]:!![]})[_0xb5b2('0xd')](function(_0xde42ad){logger[_0xb5b2('0xe')]('CreateFaxQueueReport',_0x27ff06);logger['debug'](_0xb5b2('0x19'),_0x27ff06,JSON['stringify'](_0xde42ad));_0x12bf72(_0xde42ad);})[_0xb5b2('0x18')](function(_0x1e7c13){logger['error'](_0xb5b2('0x19'),_0x1e7c13['message'],_0x27ff06);_0x27b034(_0x3214b2[_0xb5b2('0x14')](0x1f4,_0x1e7c13[_0xb5b2('0x16')]));});});};exports[_0xb5b2('0x1f')]=function(_0xc5fcb1){var _0x1cdee3=this;return new Promise(function(_0x5e4c31,_0x547565){return db[_0xb5b2('0x1a')][_0xb5b2('0x20')](_0xc5fcb1[_0xb5b2('0x1c')],{'raw':_0xc5fcb1[_0xb5b2('0x1d')]?_0xc5fcb1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5fcb1[_0xb5b2('0x1d')]?_0xc5fcb1[_0xb5b2('0x1d')][_0xb5b2('0x21')]||null:null,'attributes':_0xc5fcb1[_0xb5b2('0x1d')]?_0xc5fcb1['options'][_0xb5b2('0x22')]||null:null,'limit':_0xc5fcb1[_0xb5b2('0x1d')]?_0xc5fcb1[_0xb5b2('0x1d')][_0xb5b2('0x23')]||null:null})[_0xb5b2('0xd')](function(_0x221039){logger[_0xb5b2('0xe')](_0xb5b2('0x1f'),_0xc5fcb1);logger['debug'](_0xb5b2('0x1f'),_0xc5fcb1,JSON[_0xb5b2('0x13')](_0x221039));_0x5e4c31(_0x221039);})['catch'](function(_0x34bc62){logger[_0xb5b2('0x14')](_0xb5b2('0x1f'),_0x34bc62['message'],_0xc5fcb1);_0x547565(_0x1cdee3[_0xb5b2('0x14')](0x1f4,_0x34bc62[_0xb5b2('0x16')]));});});}; \ No newline at end of file +var _0x54e1=['stringify','UpdateFaxQueueReport','FaxQueueReport','update','raw','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateFaxQueueReport','create','body','options'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x54e1,0x65));var _0x154e=function(_0x41232a,_0x20440d){_0x41232a=_0x41232a-0x0;var _0x1ab731=_0x54e1[_0x41232a];return _0x1ab731;};'use strict';var _=require(_0x154e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x154e('0x1'));var fs=require('fs');var Redis=require(_0x154e('0x2'));var db=require(_0x154e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x154e('0x4'))(_0x154e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x154e('0x6')][_0x154e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42498d,_0x27440e,_0x35d4fd){return new BPromise(function(_0x4d0a43,_0x494aea){return client[_0x154e('0x8')](_0x42498d,_0x35d4fd)[_0x154e('0x9')](function(_0x4e8694){logger[_0x154e('0xa')](_0x154e('0xb'),_0x27440e,_0x154e('0xc'));logger[_0x154e('0xd')](_0x154e('0xe'),_0x27440e,_0x154e('0xc'),JSON['stringify'](_0x4e8694));if(_0x4e8694[_0x154e('0xf')]){if(_0x4e8694['error'][_0x154e('0x10')]===0x1f4){logger[_0x154e('0xf')](_0x154e('0xb'),_0x27440e,_0x4e8694[_0x154e('0xf')][_0x154e('0x11')]);return _0x494aea(_0x4e8694[_0x154e('0xf')][_0x154e('0x11')]);}logger['error'](_0x154e('0xb'),_0x27440e,_0x4e8694[_0x154e('0xf')][_0x154e('0x11')]);return _0x4d0a43(_0x4e8694[_0x154e('0xf')][_0x154e('0x11')]);}else{logger[_0x154e('0xa')](_0x154e('0xb'),_0x27440e,_0x154e('0xc'));_0x4d0a43(_0x4e8694['result'][_0x154e('0x11')]);}})[_0x154e('0x12')](function(_0x5bef03){logger[_0x154e('0xf')](_0x154e('0xb'),_0x27440e,_0x5bef03);_0x494aea(_0x5bef03);});});}exports[_0x154e('0x13')]=function(_0x503137){var _0x55e3cf=this;return new Promise(function(_0x4bba27,_0x26a190){return db['FaxQueueReport'][_0x154e('0x14')](_0x503137[_0x154e('0x15')],{'raw':_0x503137[_0x154e('0x16')]?_0x503137['options']['raw']===undefined?!![]:![]:!![]})[_0x154e('0x9')](function(_0x223b17){logger[_0x154e('0xa')]('CreateFaxQueueReport',_0x503137);logger[_0x154e('0xd')]('CreateFaxQueueReport',_0x503137,JSON[_0x154e('0x17')](_0x223b17));_0x4bba27(_0x223b17);})[_0x154e('0x12')](function(_0x46505f){logger[_0x154e('0xf')](_0x154e('0x13'),_0x46505f[_0x154e('0x11')],_0x503137);_0x26a190(_0x55e3cf['error'](0x1f4,_0x46505f[_0x154e('0x11')]));});});};exports[_0x154e('0x18')]=function(_0x5b95d8){var _0x295de1=this;return new Promise(function(_0x34bf07,_0xb0359e){return db[_0x154e('0x19')][_0x154e('0x1a')](_0x5b95d8[_0x154e('0x15')],{'raw':_0x5b95d8[_0x154e('0x16')]?_0x5b95d8[_0x154e('0x16')][_0x154e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b95d8[_0x154e('0x16')]?_0x5b95d8['options'][_0x154e('0x1c')]||null:null,'attributes':_0x5b95d8[_0x154e('0x16')]?_0x5b95d8[_0x154e('0x16')][_0x154e('0x1d')]||null:null,'limit':_0x5b95d8['options']?_0x5b95d8['options'][_0x154e('0x1e')]||null:null})['then'](function(_0x5e7c02){logger['info'](_0x154e('0x18'),_0x5b95d8);logger[_0x154e('0xd')](_0x154e('0x18'),_0x5b95d8,JSON[_0x154e('0x17')](_0x5e7c02));_0x34bf07(_0x5e7c02);})['catch'](function(_0x43918c){logger[_0x154e('0xf')](_0x154e('0x18'),_0x43918c['message'],_0x5b95d8);_0xb0359e(_0x295de1['error'](0x1f4,_0x43918c[_0x154e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b99366e..e4a4d51 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 _0x69da=['../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2815ae,_0x3acfc1){var _0x502681=function(_0x12f8e0){while(--_0x12f8e0){_0x2815ae['push'](_0x2815ae['shift']());}};_0x502681(++_0x3acfc1);}(_0x69da,0x189));var _0xa69d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x69da[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xa69d('0x0'));var util=require(_0xa69d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa69d('0x2'));var router=express[_0xa69d('0x3')]();var auth=require(_0xa69d('0x4'));var interaction=require(_0xa69d('0x5'));var config=require(_0xa69d('0x6'));var controller=require(_0xa69d('0x7'));router[_0xa69d('0x8')]('/',auth[_0xa69d('0x9')](),controller[_0xa69d('0xa')]);router[_0xa69d('0x8')](_0xa69d('0xb'),auth[_0xa69d('0x9')](),controller['describe']);router['get'](_0xa69d('0xc'),auth['isAuthenticated'](),controller[_0xa69d('0xd')]);router[_0xa69d('0xe')]('/',auth[_0xa69d('0x9')](),controller[_0xa69d('0xf')]);router[_0xa69d('0x10')](_0xa69d('0xc'),auth[_0xa69d('0x9')](),controller[_0xa69d('0x11')]);router['delete'](_0xa69d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa69d('0x12')]=router; \ No newline at end of file +var _0x62aa=['index','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x320296,_0x245139){var _0x31d05a=function(_0xd7f511){while(--_0xd7f511){_0x320296['push'](_0x320296['shift']());}};_0x31d05a(++_0x245139);}(_0x62aa,0x111));var _0xa62a=function(_0x202de7,_0x5acec8){_0x202de7=_0x202de7-0x0;var _0x54ef61=_0x62aa[_0x202de7];return _0x54ef61;};'use strict';var multer=require(_0xa62a('0x0'));var util=require(_0xa62a('0x1'));var path=require(_0xa62a('0x2'));var timeout=require(_0xa62a('0x3'));var express=require(_0xa62a('0x4'));var router=express[_0xa62a('0x5')]();var auth=require(_0xa62a('0x6'));var interaction=require(_0xa62a('0x7'));var config=require(_0xa62a('0x8'));var controller=require(_0xa62a('0x9'));router[_0xa62a('0xa')]('/',auth[_0xa62a('0xb')](),controller[_0xa62a('0xc')]);router[_0xa62a('0xa')]('/describe',auth[_0xa62a('0xb')](),controller['describe']);router[_0xa62a('0xa')](_0xa62a('0xd'),auth[_0xa62a('0xb')](),controller['show']);router[_0xa62a('0xe')]('/',auth['isAuthenticated'](),controller[_0xa62a('0xf')]);router[_0xa62a('0x10')](_0xa62a('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xa62a('0xb')](),controller[_0xa62a('0x11')]);module[_0xa62a('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f896780..8ee475d 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 _0x6efe=['DATE','NOW','moment','sequelize','ENUM','account','queue'];(function(_0x103fdc,_0x128fa3){var _0x35fa79=function(_0x1da118){while(--_0x1da118){_0x103fdc['push'](_0x103fdc['shift']());}};_0x35fa79(++_0x128fa3);}(_0x6efe,0x152));var _0xe6ef=function(_0x3a0bf2,_0xc25ca){_0x3a0bf2=_0x3a0bf2-0x0;var _0x40045c=_0x6efe[_0x3a0bf2];return _0x40045c;};'use strict';var moment=require(_0xe6ef('0x0'));var Sequelize=require(_0xe6ef('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe6ef('0x2')](_0xe6ef('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0xe6ef('0x4')},'transferredAt':{'type':Sequelize[_0xe6ef('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe6ef('0x6')]}}; \ No newline at end of file +var _0x5cfe=['ENUM','account','queue','NOW','moment','sequelize','exports'];(function(_0x15be84,_0x537ea7){var _0x347472=function(_0x1f18c1){while(--_0x1f18c1){_0x15be84['push'](_0x15be84['shift']());}};_0x347472(++_0x537ea7);}(_0x5cfe,0x100));var _0xe5cf=function(_0x8cbce3,_0x73323){_0x8cbce3=_0x8cbce3-0x0;var _0x16722e=_0x5cfe[_0x8cbce3];return _0x16722e;};'use strict';var moment=require(_0xe5cf('0x0'));var Sequelize=require(_0xe5cf('0x1'));module[_0xe5cf('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe5cf('0x3')](_0xe5cf('0x4'),'agent',_0xe5cf('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xe5cf('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 044d3e6..7cc17d5 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 _0x6808=['ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','FaxTransferReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','rawAttributes','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6808,0xd1));var _0x8680=function(_0x1214a1,_0x3daca0){_0x1214a1=_0x1214a1-0x0;var _0x399681=_0x6808[_0x1214a1];return _0x399681;};'use strict';var pdf=require(_0x8680('0x0'));var emlformat=require(_0x8680('0x1'));var rimraf=require(_0x8680('0x2'));var zipdir=require(_0x8680('0x3'));var jsonpatch=require(_0x8680('0x4'));var rp=require(_0x8680('0x5'));var moment=require(_0x8680('0x6'));var BPromise=require(_0x8680('0x7'));var Mustache=require('mustache');var util=require(_0x8680('0x8'));var path=require(_0x8680('0x9'));var sox=require(_0x8680('0xa'));var csv=require(_0x8680('0xb'));var ejs=require(_0x8680('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8680('0xd'));var crypto=require(_0x8680('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8680('0xb'));var querystring=require(_0x8680('0xf'));var Papa=require('papaparse');var Redis=require(_0x8680('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8680('0x11'));var logger=require(_0x8680('0x12'))(_0x8680('0x13'));var utils=require(_0x8680('0x14'));var config=require(_0x8680('0x15'));var licenseUtil=require(_0x8680('0x16'));var db=require(_0x8680('0x17'))['db'];function respondWithStatusCode(_0x56ea1c,_0x4dfe20){_0x4dfe20=_0x4dfe20||0xcc;return function(_0xe511a2){if(_0xe511a2){return _0x56ea1c[_0x8680('0x18')](_0x4dfe20);}return _0x56ea1c[_0x8680('0x19')](_0x4dfe20)['end']();};}function respondWithResult(_0x15dea0,_0x392b6b){_0x392b6b=_0x392b6b||0xc8;return function(_0x3951ee){if(_0x3951ee){return _0x15dea0[_0x8680('0x19')](_0x392b6b)[_0x8680('0x1a')](_0x3951ee);}};}function respondWithFilteredResult(_0x18a41b,_0x314e66){return function(_0x59e9a3){if(_0x59e9a3){var _0x42fb98=_0x59e9a3[_0x8680('0x1b')],_0x5d6737=_0x314e66[_0x8680('0x1c')],_0x2f5bcb=_0x314e66['offset']+_0x314e66[_0x8680('0x1d')],_0x5b9ad3;if(_0x2f5bcb>=_0x42fb98){_0x2f5bcb=_0x42fb98;_0x5b9ad3=0xc8;}else{_0x5b9ad3=0xce;}_0x18a41b[_0x8680('0x19')](_0x5b9ad3);return _0x18a41b[_0x8680('0x1e')]('Content-Range',_0x5d6737+'-'+_0x2f5bcb+'/'+_0x42fb98)['json'](_0x59e9a3);}return null;};}function patchUpdates(_0x2c99cb){return function(_0x25929e){try{jsonpatch[_0x8680('0x1f')](_0x25929e,_0x2c99cb,!![]);}catch(_0x1db50f){return BPromise[_0x8680('0x20')](_0x1db50f);}return _0x25929e[_0x8680('0x21')]();};}function saveUpdates(_0x200681,_0x153015){return function(_0x599f80){if(_0x599f80){return _0x599f80[_0x8680('0x22')](_0x200681)['then'](function(_0x12a312){return _0x12a312;});}return null;};}function removeEntity(_0x3d7521,_0x3bcc02){return function(_0x5b247a){if(_0x5b247a){return _0x5b247a[_0x8680('0x23')]()[_0x8680('0x24')](function(){_0x3d7521[_0x8680('0x19')](0xcc)[_0x8680('0x25')]();});}};}function handleEntityNotFound(_0x235099,_0x692a22){return function(_0x60feaf){if(!_0x60feaf){_0x235099[_0x8680('0x18')](0x194);}return _0x60feaf;};}function handleError(_0x41af9e,_0x16db45){_0x16db45=_0x16db45||0x1f4;return function(_0xd6b559){logger[_0x8680('0x26')](_0xd6b559[_0x8680('0x27')]);if(_0xd6b559[_0x8680('0x28')]){delete _0xd6b559['name'];}_0x41af9e[_0x8680('0x19')](_0x16db45)[_0x8680('0x29')](_0xd6b559);};}exports[_0x8680('0x2a')]=function(_0x2796d3,_0x1c4540){var _0xbc82ac={},_0x454752={},_0x52bedf={'count':0x0,'rows':[]};var _0x388856=_['map'](db[_0x8680('0x2b')]['rawAttributes'],function(_0x295bce){return{'name':_0x295bce[_0x8680('0x2c')],'type':_0x295bce[_0x8680('0x2d')][_0x8680('0x2e')]};});_0x454752[_0x8680('0x2f')]=_[_0x8680('0x30')](_0x388856,_0x8680('0x28'));_0x454752[_0x8680('0x31')]=_[_0x8680('0x32')](_0x2796d3[_0x8680('0x31')]);_0x454752[_0x8680('0x33')]=_['intersection'](_0x454752[_0x8680('0x2f')],_0x454752[_0x8680('0x31')]);_0xbc82ac[_0x8680('0x34')]=_[_0x8680('0x35')](_0x454752[_0x8680('0x2f')],qs[_0x8680('0x36')](_0x2796d3[_0x8680('0x31')]['fields']));_0xbc82ac['attributes']=_0xbc82ac[_0x8680('0x34')][_0x8680('0x37')]?_0xbc82ac[_0x8680('0x34')]:_0x454752[_0x8680('0x2f')];if(!_0x2796d3[_0x8680('0x31')][_0x8680('0x38')](_0x8680('0x39'))){_0xbc82ac[_0x8680('0x1d')]=qs[_0x8680('0x1d')](_0x2796d3[_0x8680('0x31')]['limit']);_0xbc82ac[_0x8680('0x1c')]=qs['offset'](_0x2796d3[_0x8680('0x31')][_0x8680('0x1c')]);}_0xbc82ac[_0x8680('0x3a')]=qs['sort'](_0x2796d3['query'][_0x8680('0x3b')]);_0xbc82ac[_0x8680('0x3c')]=qs[_0x8680('0x33')](_[_0x8680('0x3d')](_0x2796d3[_0x8680('0x31')],_0x454752[_0x8680('0x33')]),_0x388856);if(_0x2796d3[_0x8680('0x31')]['filter']){_0xbc82ac[_0x8680('0x3c')]=_[_0x8680('0x3e')](_0xbc82ac['where'],{'$or':_['map'](_0x388856,function(_0xf6743f){if(_0xf6743f[_0x8680('0x2d')]!==_0x8680('0x3f')){var _0x11e37a={};_0x11e37a[_0xf6743f[_0x8680('0x28')]]={'$like':'%'+_0x2796d3[_0x8680('0x31')][_0x8680('0x40')]+'%'};return _0x11e37a;}})});}_0xbc82ac=_[_0x8680('0x3e')]({},_0xbc82ac,_0x2796d3[_0x8680('0x41')]);var _0x5bb852={'where':_0xbc82ac['where']};return db['FaxTransferReport'][_0x8680('0x1b')](_0x5bb852)['then'](function(_0x41e857){_0x52bedf['count']=_0x41e857;if(_0x2796d3[_0x8680('0x31')]['includeAll']){_0xbc82ac[_0x8680('0x42')]=[{'all':!![]}];}return db[_0x8680('0x2b')]['findAll'](_0xbc82ac);})['then'](function(_0xc96c4e){_0x52bedf['rows']=_0xc96c4e;return _0x52bedf;})[_0x8680('0x24')](respondWithFilteredResult(_0x1c4540,_0xbc82ac))[_0x8680('0x43')](handleError(_0x1c4540,null));};exports[_0x8680('0x44')]=function(_0x3fee60,_0x27371c){var _0x5328a={'raw':!![],'where':{'id':_0x3fee60[_0x8680('0x45')]['id']}},_0x3cc12d={};_0x3cc12d[_0x8680('0x2f')]=_[_0x8680('0x32')](db[_0x8680('0x2b')][_0x8680('0x46')]);_0x3cc12d[_0x8680('0x31')]=_['keys'](_0x3fee60['query']);_0x3cc12d[_0x8680('0x33')]=_[_0x8680('0x35')](_0x3cc12d[_0x8680('0x2f')],_0x3cc12d['query']);_0x5328a[_0x8680('0x34')]=_[_0x8680('0x35')](_0x3cc12d[_0x8680('0x2f')],qs['fields'](_0x3fee60[_0x8680('0x31')][_0x8680('0x36')]));_0x5328a[_0x8680('0x34')]=_0x5328a[_0x8680('0x34')][_0x8680('0x37')]?_0x5328a[_0x8680('0x34')]:_0x3cc12d[_0x8680('0x2f')];if(_0x3fee60[_0x8680('0x31')][_0x8680('0x47')]){_0x5328a[_0x8680('0x42')]=[{'all':!![]}];}_0x5328a=_[_0x8680('0x3e')]({},_0x5328a,_0x3fee60[_0x8680('0x41')]);return db[_0x8680('0x2b')][_0x8680('0x48')](_0x5328a)[_0x8680('0x24')](handleEntityNotFound(_0x27371c,null))[_0x8680('0x24')](respondWithResult(_0x27371c,null))[_0x8680('0x43')](handleError(_0x27371c,null));};exports[_0x8680('0x49')]=function(_0x313485,_0x1eec08){return db[_0x8680('0x2b')][_0x8680('0x49')](_0x313485[_0x8680('0x4a')],{})[_0x8680('0x24')](respondWithResult(_0x1eec08,0xc9))[_0x8680('0x43')](handleError(_0x1eec08,null));};exports['update']=function(_0xce9dbb,_0x3b194b){if(_0xce9dbb[_0x8680('0x4a')]['id']){delete _0xce9dbb[_0x8680('0x4a')]['id'];}return db['FaxTransferReport'][_0x8680('0x48')]({'where':{'id':_0xce9dbb['params']['id']}})[_0x8680('0x24')](handleEntityNotFound(_0x3b194b,null))['then'](saveUpdates(_0xce9dbb[_0x8680('0x4a')],null))['then'](respondWithResult(_0x3b194b,null))[_0x8680('0x43')](handleError(_0x3b194b,null));};exports[_0x8680('0x23')]=function(_0x35768f,_0x25cfbd){return db[_0x8680('0x2b')][_0x8680('0x48')]({'where':{'id':_0x35768f[_0x8680('0x45')]['id']}})[_0x8680('0x24')](handleEntityNotFound(_0x25cfbd,null))['then'](removeEntity(_0x25cfbd,null))[_0x8680('0x43')](handleError(_0x25cfbd,null));};exports['describe']=function(_0x5f31ff,_0x3b4161){return db['FaxTransferReport']['describe']()['then'](respondWithResult(_0x3b4161,null))[_0x8680('0x43')](handleError(_0x3b4161,null));}; \ No newline at end of file +var _0x22da=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x4a0f69,_0x51722a){var _0x51d4a7=function(_0x3ff016){while(--_0x3ff016){_0x4a0f69['push'](_0x4a0f69['shift']());}};_0x51d4a7(++_0x51722a);}(_0x22da,0x80));var _0xa22d=function(_0x2cbc19,_0x370b33){_0x2cbc19=_0x2cbc19-0x0;var _0x3b4e0c=_0x22da[_0x2cbc19];return _0x3b4e0c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa22d('0x0'));var zipdir=require(_0xa22d('0x1'));var jsonpatch=require(_0xa22d('0x2'));var rp=require(_0xa22d('0x3'));var moment=require('moment');var BPromise=require(_0xa22d('0x4'));var Mustache=require(_0xa22d('0x5'));var util=require(_0xa22d('0x6'));var path=require(_0xa22d('0x7'));var sox=require('sox');var csv=require(_0xa22d('0x8'));var ejs=require(_0xa22d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa22d('0xa'));var crypto=require(_0xa22d('0xb'));var jsforce=require(_0xa22d('0xc'));var deskjs=require(_0xa22d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa22d('0xe'));var Redis=require(_0xa22d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa22d('0x10'));var as=require(_0xa22d('0x11'));var hardwareService=require(_0xa22d('0x12'));var logger=require(_0xa22d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa22d('0x14'));var licenseUtil=require(_0xa22d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184309,_0x515d6c){_0x515d6c=_0x515d6c||0xcc;return function(_0x983182){if(_0x983182){return _0x184309[_0xa22d('0x16')](_0x515d6c);}return _0x184309[_0xa22d('0x17')](_0x515d6c)['end']();};}function respondWithResult(_0x174a3f,_0x20d7f3){_0x20d7f3=_0x20d7f3||0xc8;return function(_0xc0d11d){if(_0xc0d11d){return _0x174a3f[_0xa22d('0x17')](_0x20d7f3)[_0xa22d('0x18')](_0xc0d11d);}};}function respondWithFilteredResult(_0x4dfa44,_0x132b1d){return function(_0x1b8627){if(_0x1b8627){var _0x2af5c6=_0x1b8627[_0xa22d('0x19')],_0x627117=_0x132b1d[_0xa22d('0x1a')],_0x14a1a7=_0x132b1d[_0xa22d('0x1a')]+_0x132b1d[_0xa22d('0x1b')],_0x2159e1;if(_0x14a1a7>=_0x2af5c6){_0x14a1a7=_0x2af5c6;_0x2159e1=0xc8;}else{_0x2159e1=0xce;}_0x4dfa44[_0xa22d('0x17')](_0x2159e1);return _0x4dfa44[_0xa22d('0x1c')](_0xa22d('0x1d'),_0x627117+'-'+_0x14a1a7+'/'+_0x2af5c6)[_0xa22d('0x18')](_0x1b8627);}return null;};}function patchUpdates(_0x27933b){return function(_0x184604){try{jsonpatch['apply'](_0x184604,_0x27933b,!![]);}catch(_0x177a0f){return BPromise[_0xa22d('0x1e')](_0x177a0f);}return _0x184604[_0xa22d('0x1f')]();};}function saveUpdates(_0x4ed606,_0x4c0aed){return function(_0x5b20f5){if(_0x5b20f5){return _0x5b20f5[_0xa22d('0x20')](_0x4ed606)[_0xa22d('0x21')](function(_0x15f875){return _0x15f875;});}return null;};}function removeEntity(_0x5071e1,_0x389675){return function(_0x45f528){if(_0x45f528){return _0x45f528[_0xa22d('0x22')]()['then'](function(){_0x5071e1[_0xa22d('0x17')](0xcc)[_0xa22d('0x23')]();});}};}function handleEntityNotFound(_0x502219,_0x24701d){return function(_0x18a585){if(!_0x18a585){_0x502219[_0xa22d('0x16')](0x194);}return _0x18a585;};}function handleError(_0x2de6fe,_0x3e1895){_0x3e1895=_0x3e1895||0x1f4;return function(_0x1c83e8){logger[_0xa22d('0x24')](_0x1c83e8['stack']);if(_0x1c83e8['name']){delete _0x1c83e8[_0xa22d('0x25')];}_0x2de6fe[_0xa22d('0x17')](_0x3e1895)[_0xa22d('0x26')](_0x1c83e8);};}exports[_0xa22d('0x27')]=function(_0x33b1c9,_0x291763){var _0x2ff235={},_0x1934f7={},_0x447a72={'count':0x0,'rows':[]};var _0x31789f=_[_0xa22d('0x28')](db['FaxTransferReport'][_0xa22d('0x29')],function(_0x4d460f){return{'name':_0x4d460f['fieldName'],'type':_0x4d460f[_0xa22d('0x2a')][_0xa22d('0x2b')]};});_0x1934f7[_0xa22d('0x2c')]=_[_0xa22d('0x28')](_0x31789f,_0xa22d('0x25'));_0x1934f7[_0xa22d('0x2d')]=_[_0xa22d('0x2e')](_0x33b1c9[_0xa22d('0x2d')]);_0x1934f7['filters']=_[_0xa22d('0x2f')](_0x1934f7[_0xa22d('0x2c')],_0x1934f7[_0xa22d('0x2d')]);_0x2ff235[_0xa22d('0x30')]=_[_0xa22d('0x2f')](_0x1934f7[_0xa22d('0x2c')],qs[_0xa22d('0x31')](_0x33b1c9[_0xa22d('0x2d')][_0xa22d('0x31')]));_0x2ff235[_0xa22d('0x30')]=_0x2ff235['attributes'][_0xa22d('0x32')]?_0x2ff235[_0xa22d('0x30')]:_0x1934f7[_0xa22d('0x2c')];if(!_0x33b1c9[_0xa22d('0x2d')][_0xa22d('0x33')](_0xa22d('0x34'))){_0x2ff235['limit']=qs[_0xa22d('0x1b')](_0x33b1c9[_0xa22d('0x2d')]['limit']);_0x2ff235[_0xa22d('0x1a')]=qs['offset'](_0x33b1c9[_0xa22d('0x2d')][_0xa22d('0x1a')]);}_0x2ff235['order']=qs[_0xa22d('0x35')](_0x33b1c9['query'][_0xa22d('0x35')]);_0x2ff235[_0xa22d('0x36')]=qs[_0xa22d('0x37')](_[_0xa22d('0x38')](_0x33b1c9[_0xa22d('0x2d')],_0x1934f7[_0xa22d('0x37')]),_0x31789f);if(_0x33b1c9[_0xa22d('0x2d')][_0xa22d('0x39')]){_0x2ff235['where']=_[_0xa22d('0x3a')](_0x2ff235[_0xa22d('0x36')],{'$or':_['map'](_0x31789f,function(_0x263ea2){if(_0x263ea2[_0xa22d('0x2a')]!=='VIRTUAL'){var _0x4b0a7b={};_0x4b0a7b[_0x263ea2[_0xa22d('0x25')]]={'$like':'%'+_0x33b1c9[_0xa22d('0x2d')][_0xa22d('0x39')]+'%'};return _0x4b0a7b;}})});}_0x2ff235=_[_0xa22d('0x3a')]({},_0x2ff235,_0x33b1c9[_0xa22d('0x3b')]);var _0x180c37={'where':_0x2ff235[_0xa22d('0x36')]};return db[_0xa22d('0x3c')][_0xa22d('0x19')](_0x180c37)[_0xa22d('0x21')](function(_0x50fb53){_0x447a72[_0xa22d('0x19')]=_0x50fb53;if(_0x33b1c9[_0xa22d('0x2d')][_0xa22d('0x3d')]){_0x2ff235[_0xa22d('0x3e')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xa22d('0x3f')](_0x2ff235);})['then'](function(_0x1314d3){_0x447a72[_0xa22d('0x40')]=_0x1314d3;return _0x447a72;})[_0xa22d('0x21')](respondWithFilteredResult(_0x291763,_0x2ff235))[_0xa22d('0x41')](handleError(_0x291763,null));};exports[_0xa22d('0x42')]=function(_0xeedf8b,_0x55034d){var _0x13fe9e={'raw':!![],'where':{'id':_0xeedf8b['params']['id']}},_0x11a4f2={};_0x11a4f2[_0xa22d('0x2c')]=_[_0xa22d('0x2e')](db['FaxTransferReport'][_0xa22d('0x29')]);_0x11a4f2['query']=_[_0xa22d('0x2e')](_0xeedf8b[_0xa22d('0x2d')]);_0x11a4f2[_0xa22d('0x37')]=_['intersection'](_0x11a4f2[_0xa22d('0x2c')],_0x11a4f2[_0xa22d('0x2d')]);_0x13fe9e['attributes']=_[_0xa22d('0x2f')](_0x11a4f2[_0xa22d('0x2c')],qs[_0xa22d('0x31')](_0xeedf8b[_0xa22d('0x2d')][_0xa22d('0x31')]));_0x13fe9e[_0xa22d('0x30')]=_0x13fe9e[_0xa22d('0x30')][_0xa22d('0x32')]?_0x13fe9e['attributes']:_0x11a4f2['model'];if(_0xeedf8b[_0xa22d('0x2d')]['includeAll']){_0x13fe9e[_0xa22d('0x3e')]=[{'all':!![]}];}_0x13fe9e=_['merge']({},_0x13fe9e,_0xeedf8b[_0xa22d('0x3b')]);return db['FaxTransferReport'][_0xa22d('0x43')](_0x13fe9e)[_0xa22d('0x21')](handleEntityNotFound(_0x55034d,null))[_0xa22d('0x21')](respondWithResult(_0x55034d,null))[_0xa22d('0x41')](handleError(_0x55034d,null));};exports[_0xa22d('0x44')]=function(_0x33def3,_0x5176d5){return db[_0xa22d('0x3c')][_0xa22d('0x44')](_0x33def3[_0xa22d('0x45')],{})['then'](respondWithResult(_0x5176d5,0xc9))['catch'](handleError(_0x5176d5,null));};exports[_0xa22d('0x20')]=function(_0x4d872f,_0x20bc78){if(_0x4d872f['body']['id']){delete _0x4d872f[_0xa22d('0x45')]['id'];}return db[_0xa22d('0x3c')]['find']({'where':{'id':_0x4d872f['params']['id']}})[_0xa22d('0x21')](handleEntityNotFound(_0x20bc78,null))['then'](saveUpdates(_0x4d872f[_0xa22d('0x45')],null))['then'](respondWithResult(_0x20bc78,null))[_0xa22d('0x41')](handleError(_0x20bc78,null));};exports[_0xa22d('0x22')]=function(_0x42e464,_0x3f3a4d){return db[_0xa22d('0x3c')][_0xa22d('0x43')]({'where':{'id':_0x42e464[_0xa22d('0x46')]['id']}})[_0xa22d('0x21')](handleEntityNotFound(_0x3f3a4d,null))[_0xa22d('0x21')](removeEntity(_0x3f3a4d,null))['catch'](handleError(_0x3f3a4d,null));};exports[_0xa22d('0x47')]=function(_0x3ba50e,_0x30dd0a){return db[_0xa22d('0x3c')][_0xa22d('0x47')]()[_0xa22d('0x21')](respondWithResult(_0x30dd0a,null))[_0xa22d('0x41')](handleError(_0x30dd0a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7ad31e8..ce199c9 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 _0x6f4e=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x6f4e,0x120));var _0xe6f4=function(_0x21a860,_0x152c16){_0x21a860=_0x21a860-0x0;var _0xef4444=_0x6f4e[_0x21a860];return _0xef4444;};'use strict';var _=require(_0xe6f4('0x0'));var util=require(_0xe6f4('0x1'));var logger=require(_0xe6f4('0x2'))(_0xe6f4('0x3'));var moment=require(_0xe6f4('0x4'));var BPromise=require(_0xe6f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6f4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6f4('0x7'));module[_0xe6f4('0x8')]=function(_0x2a8f28,_0x4c0352){return _0x2a8f28[_0xe6f4('0x9')](_0xe6f4('0xa'),attributes,{'tableName':_0xe6f4('0xb'),'paranoid':![],'indexes':[{'name':_0xe6f4('0xc'),'fields':[_0xe6f4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7e8=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x172f70,_0x2cc8ac){var _0x1dec9f=function(_0x525ece){while(--_0x525ece){_0x172f70['push'](_0x172f70['shift']());}};_0x1dec9f(++_0x2cc8ac);}(_0xe7e8,0x9d));var _0x8e7e=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xe7e8[_0x219d87];return _0x22823d;};'use strict';var _=require(_0x8e7e('0x0'));var util=require(_0x8e7e('0x1'));var logger=require(_0x8e7e('0x2'))('api');var moment=require(_0x8e7e('0x3'));var BPromise=require(_0x8e7e('0x4'));var rp=require(_0x8e7e('0x5'));var fs=require('fs');var path=require(_0x8e7e('0x6'));var rimraf=require(_0x8e7e('0x7'));var config=require(_0x8e7e('0x8'));var attributes=require(_0x8e7e('0x9'));module[_0x8e7e('0xa')]=function(_0x2b3857,_0x521fb7){return _0x2b3857[_0x8e7e('0xb')](_0x8e7e('0xc'),attributes,{'tableName':_0x8e7e('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8e7e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 96a7671..a1bfece 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 _0x0759=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8daf31,_0x1f4e65){var _0x81bb8e=function(_0x560076){while(--_0x560076){_0x8daf31['push'](_0x8daf31['shift']());}};_0x81bb8e(++_0x1f4e65);}(_0x0759,0x13b));var _0x9075=function(_0x241685,_0x1ab0ae){_0x241685=_0x241685-0x0;var _0x535d7f=_0x0759[_0x241685];return _0x535d7f;};'use strict';var _=require(_0x9075('0x0'));var util=require(_0x9075('0x1'));var moment=require('moment');var BPromise=require(_0x9075('0x2'));var rs=require(_0x9075('0x3'));var fs=require('fs');var Redis=require(_0x9075('0x4'));var db=require(_0x9075('0x5'))['db'];var utils=require(_0x9075('0x6'));var logger=require(_0x9075('0x7'))(_0x9075('0x8'));var config=require(_0x9075('0x9'));var jayson=require(_0x9075('0xa'));var client=jayson[_0x9075('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x567eef,_0x2943ae,_0x4b580e){return new BPromise(function(_0x248ea4,_0x48a76d){return client[_0x9075('0xc')](_0x567eef,_0x4b580e)['then'](function(_0xfc2df7){logger[_0x9075('0xd')](_0x9075('0xe'),_0x2943ae,_0x9075('0xf'));logger[_0x9075('0x10')](_0x9075('0x11'),_0x2943ae,'request\x20sent',JSON[_0x9075('0x12')](_0xfc2df7));if(_0xfc2df7[_0x9075('0x13')]){if(_0xfc2df7[_0x9075('0x13')][_0x9075('0x14')]===0x1f4){logger[_0x9075('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x2943ae,_0xfc2df7[_0x9075('0x13')]['message']);return _0x48a76d(_0xfc2df7[_0x9075('0x13')][_0x9075('0x15')]);}logger[_0x9075('0x13')](_0x9075('0xe'),_0x2943ae,_0xfc2df7[_0x9075('0x13')][_0x9075('0x15')]);return _0x248ea4(_0xfc2df7[_0x9075('0x13')][_0x9075('0x15')]);}else{logger[_0x9075('0xd')](_0x9075('0xe'),_0x2943ae,'request\x20sent');_0x248ea4(_0xfc2df7[_0x9075('0x16')][_0x9075('0x15')]);}})[_0x9075('0x17')](function(_0x373896){logger[_0x9075('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x2943ae,_0x373896);_0x48a76d(_0x373896);});});} \ No newline at end of file +var _0x61c0=['debug','error','code','message','info','result','catch','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s'];(function(_0x326432,_0x35f878){var _0x4ddfaf=function(_0x2616b8){while(--_0x2616b8){_0x326432['push'](_0x326432['shift']());}};_0x4ddfaf(++_0x35f878);}(_0x61c0,0x183));var _0x061c=function(_0x8f35a6,_0x19c9c4){_0x8f35a6=_0x8f35a6-0x0;var _0x49d26b=_0x61c0[_0x8f35a6];return _0x49d26b;};'use strict';var _=require('lodash');var util=require(_0x061c('0x0'));var moment=require('moment');var BPromise=require(_0x061c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x061c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x061c('0x3'));var logger=require('../../config/logger')(_0x061c('0x4'));var config=require(_0x061c('0x5'));var jayson=require(_0x061c('0x6'));var client=jayson[_0x061c('0x7')][_0x061c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2144c7,_0x5dca63,_0x385058){return new BPromise(function(_0x1eb09b,_0x3be849){return client[_0x061c('0x9')](_0x2144c7,_0x385058)[_0x061c('0xa')](function(_0x1b4a6c){logger['info'](_0x061c('0xb'),_0x5dca63,'request\x20sent');logger[_0x061c('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5dca63,'request\x20sent',JSON['stringify'](_0x1b4a6c));if(_0x1b4a6c[_0x061c('0xd')]){if(_0x1b4a6c['error'][_0x061c('0xe')]===0x1f4){logger[_0x061c('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x5dca63,_0x1b4a6c[_0x061c('0xd')][_0x061c('0xf')]);return _0x3be849(_0x1b4a6c[_0x061c('0xd')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5dca63,_0x1b4a6c['error'][_0x061c('0xf')]);return _0x1eb09b(_0x1b4a6c[_0x061c('0xd')][_0x061c('0xf')]);}else{logger[_0x061c('0x10')](_0x061c('0xb'),_0x5dca63,'request\x20sent');_0x1eb09b(_0x1b4a6c[_0x061c('0x11')][_0x061c('0xf')]);}})[_0x061c('0x12')](function(_0x4f9b21){logger['error'](_0x061c('0xb'),_0x5dca63,_0x4f9b21);_0x3be849(_0x4f9b21);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4a0d270..c04cb02 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 _0x5c8b=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x593cf4,_0x12349b){var _0x20fce0=function(_0x34928b){while(--_0x34928b){_0x593cf4['push'](_0x593cf4['shift']());}};_0x20fce0(++_0x12349b);}(_0x5c8b,0xcb));var _0xb5c8=function(_0x293fed,_0x44c6ed){_0x293fed=_0x293fed-0x0;var _0x148dba=_0x5c8b[_0x293fed];return _0x148dba;};'use strict';var multer=require(_0xb5c8('0x0'));var util=require(_0xb5c8('0x1'));var path=require(_0xb5c8('0x2'));var timeout=require(_0xb5c8('0x3'));var express=require(_0xb5c8('0x4'));var router=express[_0xb5c8('0x5')]();var auth=require(_0xb5c8('0x6'));var interaction=require(_0xb5c8('0x7'));var config=require(_0xb5c8('0x8'));var controller=require(_0xb5c8('0x9'));router['get']('/',auth[_0xb5c8('0xa')](),controller['index']);router[_0xb5c8('0xb')](_0xb5c8('0xc'),auth['isAuthenticated'](),controller[_0xb5c8('0xd')]);router[_0xb5c8('0xb')](_0xb5c8('0xe'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xf')]);router[_0xb5c8('0x10')]('/',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x11')]);router['put'](_0xb5c8('0xe'),auth['isAuthenticated'](),controller[_0xb5c8('0x12')]);router['delete']('/:id',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x13')]);module[_0xb5c8('0x14')]=router; \ No newline at end of file +var _0xdb06=['/describe','describe','/:id','isAuthenticated','create','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index'];(function(_0xc06753,_0x4cbc4b){var _0x57aa95=function(_0x51d031){while(--_0x51d031){_0xc06753['push'](_0xc06753['shift']());}};_0x57aa95(++_0x4cbc4b);}(_0xdb06,0xe1));var _0x6db0=function(_0x5fb389,_0x436aef){_0x5fb389=_0x5fb389-0x0;var _0xeb5cef=_0xdb06[_0x5fb389];return _0xeb5cef;};'use strict';var multer=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6db0('0x2'));var router=express[_0x6db0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6db0('0x4'));var config=require(_0x6db0('0x5'));var controller=require(_0x6db0('0x6'));router[_0x6db0('0x7')]('/',auth['isAuthenticated'](),controller[_0x6db0('0x8')]);router[_0x6db0('0x7')](_0x6db0('0x9'),auth['isAuthenticated'](),controller[_0x6db0('0xa')]);router[_0x6db0('0x7')](_0x6db0('0xb'),auth[_0x6db0('0xc')](),controller['show']);router['post']('/',auth[_0x6db0('0xc')](),controller[_0x6db0('0xd')]);router['put'](_0x6db0('0xb'),auth[_0x6db0('0xc')](),controller[_0x6db0('0xe')]);router[_0x6db0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6db0('0x10')]);module[_0x6db0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2a4d596..54d0989 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 _0xf9c5=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x2cc4ce,_0xb708d1){var _0x7793c5=function(_0x4f43bb){while(--_0x4f43bb){_0x2cc4ce['push'](_0x2cc4ce['shift']());}};_0x7793c5(++_0xb708d1);}(_0xf9c5,0x19b));var _0x5f9c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf9c5[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x5f9c('0x0'));var util=require(_0x5f9c('0x1'));var path=require('path');var timeout=require(_0x5f9c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5f9c('0x3'));var interaction=require(_0x5f9c('0x4'));var config=require(_0x5f9c('0x5'));var controller=require(_0x5f9c('0x6'));router[_0x5f9c('0x7')]('/',auth[_0x5f9c('0x8')](),controller['index']);router[_0x5f9c('0x7')](_0x5f9c('0x9'),auth[_0x5f9c('0x8')](),controller[_0x5f9c('0xa')]);router['get'](_0x5f9c('0xb'),auth[_0x5f9c('0x8')](),controller[_0x5f9c('0xc')]);router[_0x5f9c('0x7')](_0x5f9c('0xd'),auth[_0x5f9c('0x8')](),controller[_0x5f9c('0xe')]);router[_0x5f9c('0xf')]('/',auth[_0x5f9c('0x8')](),controller[_0x5f9c('0x10')]);router[_0x5f9c('0xf')](_0x5f9c('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5f9c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5f9c('0x12')]);router[_0x5f9c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5f9c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb858=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb858,0x1e6));var _0x8b85=function(_0x21ad38,_0x335463){_0x21ad38=_0x21ad38-0x0;var _0x5eccb6=_0xb858[_0x21ad38];return _0x5eccb6;};'use strict';var multer=require(_0x8b85('0x0'));var util=require(_0x8b85('0x1'));var path=require(_0x8b85('0x2'));var timeout=require(_0x8b85('0x3'));var express=require(_0x8b85('0x4'));var router=express[_0x8b85('0x5')]();var auth=require(_0x8b85('0x6'));var interaction=require(_0x8b85('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x8b85('0x8')]('/',auth[_0x8b85('0x9')](),controller['index']);router[_0x8b85('0x8')](_0x8b85('0xa'),auth[_0x8b85('0x9')](),controller[_0x8b85('0xb')]);router[_0x8b85('0x8')](_0x8b85('0xc'),auth[_0x8b85('0x9')](),controller[_0x8b85('0xd')]);router[_0x8b85('0x8')]('/:id/fields',auth[_0x8b85('0x9')](),controller[_0x8b85('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8b85('0xf')](_0x8b85('0xc'),auth[_0x8b85('0x9')](),controller[_0x8b85('0x10')]);router[_0x8b85('0x11')](_0x8b85('0xa'),auth[_0x8b85('0x9')](),controller[_0x8b85('0x12')]);router[_0x8b85('0x13')](_0x8b85('0xa'),auth[_0x8b85('0x9')](),controller[_0x8b85('0x14')]);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 b1f9257..1af0c86 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 _0x79d7=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x2ceec2,_0x284b13){var _0x11d812=function(_0x58f3ec){while(--_0x58f3ec){_0x2ceec2['push'](_0x2ceec2['shift']());}};_0x11d812(++_0x284b13);}(_0x79d7,0x9c));var _0x779d=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x79d7[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'name':{'type':Sequelize[_0x779d('0x1')]},'description':{'type':Sequelize[_0x779d('0x1')]},'username':{'type':Sequelize[_0x779d('0x1')]},'remoteUri':{'type':Sequelize[_0x779d('0x1')]},'authType':{'type':Sequelize[_0x779d('0x2')](_0x779d('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x779d('0x1')]},'consumerKey':{'type':Sequelize[_0x779d('0x1')]},'consumerSecret':{'type':Sequelize[_0x779d('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x779d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x779d('0x4'),_0x779d('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb627=['STRING','ENUM','basic','integrationTab','sequelize'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xb627,0x144));var _0x7b62=function(_0x525abb,_0xfd9526){_0x525abb=_0x525abb-0x0;var _0x9822bb=_0xb627[_0x525abb];return _0x9822bb;};'use strict';var Sequelize=require(_0x7b62('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7b62('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7b62('0x1')]},'authType':{'type':Sequelize[_0x7b62('0x2')](_0x7b62('0x3')),'defaultValue':_0x7b62('0x3')},'password':{'type':Sequelize[_0x7b62('0x1')]},'consumerKey':{'type':Sequelize[_0x7b62('0x1')]},'consumerSecret':{'type':Sequelize[_0x7b62('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7b62('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7b62('0x2')](_0x7b62('0x4'),'newTab'),'defaultValue':_0x7b62('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 3e69459..415701f 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 _0xb5da=['consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','stringify','code','error','message','DeskAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','include','find','create','body','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb5da,0x94));var _0xab5d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb5da[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xab5d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xab5d('0x1'));var zipdir=require(_0xab5d('0x2'));var jsonpatch=require(_0xab5d('0x3'));var rp=require('request-promise');var moment=require(_0xab5d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab5d('0x5'));var path=require(_0xab5d('0x6'));var sox=require(_0xab5d('0x7'));var csv=require('to-csv');var ejs=require(_0xab5d('0x8'));var fs=require('fs');var _=require(_0xab5d('0x9'));var squel=require('squel');var crypto=require(_0xab5d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xab5d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xab5d('0xc'));var Papa=require('papaparse');var Redis=require(_0xab5d('0xd'));var authService=require(_0xab5d('0xe'));var qs=require(_0xab5d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab5d('0x10'));var logger=require(_0xab5d('0x11'))(_0xab5d('0x12'));var utils=require(_0xab5d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xab5d('0x14'));var db=require(_0xab5d('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xab5d('0x16'));var client=jayson[_0xab5d('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21929b,_0x279f3c,_0x506f6d,_0x1a2e8e){return new BPromise(function(_0x38fc24,_0x578e9c){var _0x348a07=_0x1a2e8e||client;return _0x348a07['request'](_0x21929b,_0x506f6d)[_0xab5d('0x18')](function(_0x3f9f3b){logger[_0xab5d('0x19')]('DeskAccount,\x20%s,\x20%s',_0x279f3c,_0xab5d('0x1a'));logger[_0xab5d('0x1b')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x279f3c,'request\x20sent',JSON[_0xab5d('0x1c')](_0x3f9f3b));if(_0x3f9f3b['error']){if(_0x3f9f3b['error'][_0xab5d('0x1d')]===0x1f4){logger[_0xab5d('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x279f3c,_0x3f9f3b[_0xab5d('0x1e')][_0xab5d('0x1f')]);return _0x578e9c(_0x3f9f3b[_0xab5d('0x1e')][_0xab5d('0x1f')]);}logger[_0xab5d('0x1e')](_0xab5d('0x20'),_0x279f3c,_0x3f9f3b[_0xab5d('0x1e')][_0xab5d('0x1f')]);return _0x38fc24(_0x3f9f3b[_0xab5d('0x1e')][_0xab5d('0x1f')]);}else{logger['info'](_0xab5d('0x20'),_0x279f3c,'request\x20sent');_0x38fc24(_0x3f9f3b[_0xab5d('0x21')][_0xab5d('0x1f')]);}})[_0xab5d('0x22')](function(_0x37b319){logger[_0xab5d('0x1e')](_0xab5d('0x20'),_0x279f3c,_0x37b319);_0x578e9c(_0x37b319);});});}function respondWithStatusCode(_0xcb458b,_0x1f031f){_0x1f031f=_0x1f031f||0xcc;return function(_0x2027ff){if(_0x2027ff){return _0xcb458b[_0xab5d('0x23')](_0x1f031f);}return _0xcb458b[_0xab5d('0x24')](_0x1f031f)[_0xab5d('0x25')]();};}function respondWithResult(_0x5936cb,_0x2e0eba){_0x2e0eba=_0x2e0eba||0xc8;return function(_0x427ff0){if(_0x427ff0){return _0x5936cb[_0xab5d('0x24')](_0x2e0eba)[_0xab5d('0x26')](_0x427ff0);}};}function respondWithFilteredResult(_0x319206,_0x222e0f){return function(_0xecc1b5){if(_0xecc1b5){var _0x566fd7=_0xecc1b5['count'],_0x7e7c=_0x222e0f['offset'],_0x18a2c7=_0x222e0f['offset']+_0x222e0f[_0xab5d('0x27')],_0x182839;if(_0x18a2c7>=_0x566fd7){_0x18a2c7=_0x566fd7;_0x182839=0xc8;}else{_0x182839=0xce;}_0x319206['status'](_0x182839);return _0x319206[_0xab5d('0x28')](_0xab5d('0x29'),_0x7e7c+'-'+_0x18a2c7+'/'+_0x566fd7)[_0xab5d('0x26')](_0xecc1b5);}return null;};}function patchUpdates(_0x3ed703){return function(_0x1ea78b){try{jsonpatch[_0xab5d('0x2a')](_0x1ea78b,_0x3ed703,!![]);}catch(_0x30b2aa){return BPromise[_0xab5d('0x2b')](_0x30b2aa);}return _0x1ea78b[_0xab5d('0x2c')]();};}function saveUpdates(_0x216fce,_0x4506e5){return function(_0x578809){if(_0x578809){return _0x578809[_0xab5d('0x2d')](_0x216fce)[_0xab5d('0x18')](function(_0x25269c){return _0x25269c;});}return null;};}function removeEntity(_0x108678,_0x3a4a38){return function(_0x4436de){if(_0x4436de){return _0x4436de[_0xab5d('0x2e')]()[_0xab5d('0x18')](function(){_0x108678[_0xab5d('0x24')](0xcc)[_0xab5d('0x25')]();});}};}function handleEntityNotFound(_0x3d3e05,_0x322337){return function(_0x46fc1f){if(!_0x46fc1f){_0x3d3e05[_0xab5d('0x23')](0x194);}return _0x46fc1f;};}function handleError(_0x5d3517,_0x34bc4d){_0x34bc4d=_0x34bc4d||0x1f4;return function(_0x268126){logger[_0xab5d('0x1e')](_0x268126[_0xab5d('0x2f')]);if(_0x268126['name']){delete _0x268126[_0xab5d('0x30')];}_0x5d3517[_0xab5d('0x24')](_0x34bc4d)[_0xab5d('0x31')](_0x268126);};}exports[_0xab5d('0x32')]=function(_0x577eec,_0x143ee1){var _0x59ea16={},_0x2c930b={},_0x248553={'count':0x0,'rows':[]};var _0x3f7730=_[_0xab5d('0x33')](db[_0xab5d('0x34')][_0xab5d('0x35')],function(_0x3f11a4){return{'name':_0x3f11a4[_0xab5d('0x36')],'type':_0x3f11a4[_0xab5d('0x37')][_0xab5d('0x38')]};});_0x2c930b[_0xab5d('0x39')]=_[_0xab5d('0x33')](_0x3f7730,_0xab5d('0x30'));_0x2c930b[_0xab5d('0x3a')]=_[_0xab5d('0x3b')](_0x577eec[_0xab5d('0x3a')]);_0x2c930b[_0xab5d('0x3c')]=_[_0xab5d('0x3d')](_0x2c930b[_0xab5d('0x39')],_0x2c930b[_0xab5d('0x3a')]);_0x59ea16[_0xab5d('0x3e')]=_['intersection'](_0x2c930b[_0xab5d('0x39')],qs[_0xab5d('0x3f')](_0x577eec[_0xab5d('0x3a')]['fields']));_0x59ea16['attributes']=_0x59ea16['attributes'][_0xab5d('0x40')]?_0x59ea16[_0xab5d('0x3e')]:_0x2c930b['model'];if(!_0x577eec[_0xab5d('0x3a')]['hasOwnProperty'](_0xab5d('0x41'))){_0x59ea16[_0xab5d('0x27')]=qs[_0xab5d('0x27')](_0x577eec[_0xab5d('0x3a')]['limit']);_0x59ea16[_0xab5d('0x42')]=qs[_0xab5d('0x42')](_0x577eec[_0xab5d('0x3a')][_0xab5d('0x42')]);}_0x59ea16[_0xab5d('0x43')]=qs[_0xab5d('0x44')](_0x577eec[_0xab5d('0x3a')]['sort']);_0x59ea16[_0xab5d('0x45')]=qs[_0xab5d('0x3c')](_[_0xab5d('0x46')](_0x577eec[_0xab5d('0x3a')],_0x2c930b[_0xab5d('0x3c')]),_0x3f7730);if(_0x577eec['query'][_0xab5d('0x47')]){_0x59ea16['where']=_[_0xab5d('0x48')](_0x59ea16[_0xab5d('0x45')],{'$or':_[_0xab5d('0x33')](_0x3f7730,function(_0x26513e){if(_0x26513e[_0xab5d('0x37')]!=='VIRTUAL'){var _0x35cce0={};_0x35cce0[_0x26513e['name']]={'$like':'%'+_0x577eec[_0xab5d('0x3a')][_0xab5d('0x47')]+'%'};return _0x35cce0;}})});}_0x59ea16=_[_0xab5d('0x48')]({},_0x59ea16,_0x577eec[_0xab5d('0x49')]);var _0x37989e={'where':_0x59ea16['where']};return db[_0xab5d('0x34')][_0xab5d('0x4a')](_0x37989e)[_0xab5d('0x18')](function(_0x5d8eec){_0x248553['count']=_0x5d8eec;if(_0x577eec[_0xab5d('0x3a')][_0xab5d('0x4b')]){_0x59ea16['include']=[{'all':!![]}];}return db['DeskAccount'][_0xab5d('0x4c')](_0x59ea16);})[_0xab5d('0x18')](function(_0x4e5049){_0x248553[_0xab5d('0x4d')]=_0x4e5049;return _0x248553;})[_0xab5d('0x18')](respondWithFilteredResult(_0x143ee1,_0x59ea16))['catch'](handleError(_0x143ee1,null));};exports[_0xab5d('0x4e')]=function(_0x25819d,_0x587d0f){var _0x3f00a1={'raw':![],'where':{'id':_0x25819d['params']['id']}},_0x2cd795={};_0x2cd795[_0xab5d('0x39')]=_[_0xab5d('0x3b')](db[_0xab5d('0x34')]['rawAttributes']);_0x2cd795['query']=_[_0xab5d('0x3b')](_0x25819d[_0xab5d('0x3a')]);_0x2cd795[_0xab5d('0x3c')]=_[_0xab5d('0x3d')](_0x2cd795[_0xab5d('0x39')],_0x2cd795[_0xab5d('0x3a')]);_0x3f00a1[_0xab5d('0x3e')]=_[_0xab5d('0x3d')](_0x2cd795[_0xab5d('0x39')],qs[_0xab5d('0x3f')](_0x25819d[_0xab5d('0x3a')][_0xab5d('0x3f')]));_0x3f00a1[_0xab5d('0x3e')]=_0x3f00a1[_0xab5d('0x3e')][_0xab5d('0x40')]?_0x3f00a1['attributes']:_0x2cd795[_0xab5d('0x39')];if(_0x25819d[_0xab5d('0x3a')][_0xab5d('0x4b')]){_0x3f00a1[_0xab5d('0x4f')]=[{'all':!![]}];}_0x3f00a1=_[_0xab5d('0x48')]({},_0x3f00a1,_0x25819d[_0xab5d('0x49')]);return db[_0xab5d('0x34')][_0xab5d('0x50')](_0x3f00a1)[_0xab5d('0x18')](handleEntityNotFound(_0x587d0f,null))[_0xab5d('0x18')](respondWithResult(_0x587d0f,null))[_0xab5d('0x22')](handleError(_0x587d0f,null));};exports[_0xab5d('0x51')]=function(_0x1662c0,_0xef9137){return db['DeskAccount']['create'](_0x1662c0[_0xab5d('0x52')],{})[_0xab5d('0x18')](respondWithResult(_0xef9137,0xc9))[_0xab5d('0x22')](handleError(_0xef9137,null));};exports[_0xab5d('0x2d')]=function(_0x24473c,_0x163de8){if(_0x24473c[_0xab5d('0x52')]['id']){delete _0x24473c[_0xab5d('0x52')]['id'];}return db[_0xab5d('0x34')][_0xab5d('0x50')]({'where':{'id':_0x24473c[_0xab5d('0x53')]['id']}})[_0xab5d('0x18')](handleEntityNotFound(_0x163de8,null))[_0xab5d('0x18')](saveUpdates(_0x24473c['body'],null))[_0xab5d('0x18')](respondWithResult(_0x163de8,null))[_0xab5d('0x22')](handleError(_0x163de8,null));};exports[_0xab5d('0x2e')]=function(_0x2188cb,_0x287600){return db[_0xab5d('0x34')][_0xab5d('0x50')]({'where':{'id':_0x2188cb[_0xab5d('0x53')]['id']}})['then'](handleEntityNotFound(_0x287600,null))['then'](removeEntity(_0x287600,null))[_0xab5d('0x22')](handleError(_0x287600,null));};exports[_0xab5d('0x54')]=function(_0x3e8e74,_0x54266e,_0x29cbe7){var _0x15c746={};var _0x69df49={};var _0x38f75c;var _0x264e79;return db['DeskAccount'][_0xab5d('0x55')]({'where':{'id':_0x3e8e74[_0xab5d('0x53')]['id']}})['then'](handleEntityNotFound(_0x54266e,null))[_0xab5d('0x18')](function(_0x161805){if(_0x161805){_0x38f75c=_0x161805;_0x69df49[_0xab5d('0x39')]=_[_0xab5d('0x3b')](db['DeskConfiguration']['rawAttributes']);_0x69df49[_0xab5d('0x3a')]=_['keys'](_0x3e8e74[_0xab5d('0x3a')]);_0x69df49['filters']=_[_0xab5d('0x3d')](_0x69df49[_0xab5d('0x39')],_0x69df49[_0xab5d('0x3a')]);_0x15c746[_0xab5d('0x3e')]=_[_0xab5d('0x3d')](_0x69df49['model'],qs[_0xab5d('0x3f')](_0x3e8e74[_0xab5d('0x3a')][_0xab5d('0x3f')]));_0x15c746[_0xab5d('0x3e')]=_0x15c746['attributes'][_0xab5d('0x40')]?_0x15c746[_0xab5d('0x3e')]:_0x69df49[_0xab5d('0x39')];_0x15c746[_0xab5d('0x43')]=qs[_0xab5d('0x44')](_0x3e8e74[_0xab5d('0x3a')][_0xab5d('0x44')]);_0x15c746[_0xab5d('0x45')]=qs['filters'](_[_0xab5d('0x46')](_0x3e8e74[_0xab5d('0x3a')],_0x69df49['filters']));if(_0x3e8e74[_0xab5d('0x3a')][_0xab5d('0x47')]){_0x15c746['where']=_[_0xab5d('0x48')](_0x15c746['where'],{'$or':_['map'](_0x15c746[_0xab5d('0x3e')],function(_0x4f4b41){var _0x5180c5={};_0x5180c5[_0x4f4b41]={'$like':'%'+_0x3e8e74[_0xab5d('0x3a')]['filter']+'%'};return _0x5180c5;})});}_0x15c746=_[_0xab5d('0x48')]({},_0x15c746,_0x3e8e74['options']);return _0x38f75c['getConfigurations'](_0x15c746);}})[_0xab5d('0x18')](function(_0x527b69){if(_0x527b69){_0x264e79=_0x527b69['length'];if(!_0x3e8e74[_0xab5d('0x3a')][_0xab5d('0x56')](_0xab5d('0x41'))){_0x15c746[_0xab5d('0x27')]=qs[_0xab5d('0x27')](_0x3e8e74[_0xab5d('0x3a')][_0xab5d('0x27')]);_0x15c746['offset']=qs['offset'](_0x3e8e74[_0xab5d('0x3a')][_0xab5d('0x42')]);}return _0x38f75c[_0xab5d('0x54')](_0x15c746);}})['then'](function(_0x4e6bfe){if(_0x4e6bfe){return _0x4e6bfe?{'count':_0x264e79,'rows':_0x4e6bfe}:null;}})['then'](respondWithResult(_0x54266e,null))[_0xab5d('0x22')](handleError(_0x54266e,null));};exports[_0xab5d('0x57')]=function(_0x64d074,_0x7c490e,_0x2b51d3){if(_0x64d074[_0xab5d('0x52')]['id']){delete _0x64d074[_0xab5d('0x52')]['id'];}return db[_0xab5d('0x34')][_0xab5d('0x55')]({'where':{'id':_0x64d074['params']['id']}})[_0xab5d('0x18')](handleEntityNotFound(_0x7c490e,null))[_0xab5d('0x18')](function(_0x593205){if(_0x593205){_0x64d074[_0xab5d('0x52')][_0xab5d('0x58')]=_0x593205['id'];_0x64d074[_0xab5d('0x52')][_0xab5d('0x59')]=integrations[_0xab5d('0x5a')](_0x64d074[_0xab5d('0x52')][_0xab5d('0x5b')],_0x64d074[_0xab5d('0x52')][_0xab5d('0x37')]);_0x64d074[_0xab5d('0x52')][_0xab5d('0x5c')]=integrations[_0xab5d('0x5d')](_0x64d074[_0xab5d('0x52')][_0xab5d('0x5b')],_0x64d074[_0xab5d('0x52')][_0xab5d('0x37')]);return db['DeskConfiguration'][_0xab5d('0x51')](_0x64d074['body'],{'include':[{'model':db[_0xab5d('0x5e')],'as':_0xab5d('0x59')},{'model':db[_0xab5d('0x5e')],'as':_0xab5d('0x5c')}]});}return null;})['then'](respondWithResult(_0x7c490e,null))[_0xab5d('0x22')](handleError(_0x7c490e,null));};exports[_0xab5d('0x5f')]=function(_0x3e5d3f,_0x20fcd9,_0x2cb480){var _0x4d7e41=[{'name':_0xab5d('0x60'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x15f6ec='';return db[_0xab5d('0x34')][_0xab5d('0x55')]({'where':{'id':_0x3e5d3f[_0xab5d('0x53')]['id']},'attributes':['id',_0xab5d('0x61'),_0xab5d('0x62'),_0xab5d('0x63'),_0xab5d('0x64'),_0xab5d('0x65'),_0xab5d('0x66'),_0xab5d('0x67'),_0xab5d('0x68')]})[_0xab5d('0x18')](handleEntityNotFound(_0x20fcd9,null))[_0xab5d('0x18')](function(_0x44108c){if(_0x44108c){_0x15f6ec=_0x44108c[_0xab5d('0x61')];var _0x1f70f6=_0x15f6ec[_0xab5d('0x69')](-0x1);if(_0x1f70f6==='/'){_0x15f6ec=_0x15f6ec[_0xab5d('0x6a')](0x0,_0x15f6ec[_0xab5d('0x6b')](_0x1f70f6));}var _0x2be58b={'method':_0xab5d('0x6c'),'uri':util['format'](_0xab5d('0x6d'),_0x15f6ec),'headers':{'Content-Type':_0xab5d('0x6e'),'Accept':_0xab5d('0x6e')},'json':!![]};if(_0x44108c[_0xab5d('0x62')]===_0xab5d('0x6f')){_0x2be58b[_0xab5d('0x70')][_0xab5d('0x71')]=util[_0xab5d('0x72')](_0xab5d('0x73'),new Buffer(util[_0xab5d('0x72')]('%s:%s',_0x44108c['username'],_0x44108c[_0xab5d('0x64')]))['toString'](_0xab5d('0x74')));}return rp(_0x2be58b)[_0xab5d('0x18')](function(_0x10d6b5){return _0x4d7e41['concat'](_[_0xab5d('0x33')](_0x10d6b5[_0xab5d('0x75')][_0xab5d('0x76')],function(_0x1b47f5){return{'id':_0x1b47f5['name'],'name':_0x1b47f5[_0xab5d('0x30')],'type':_0x1b47f5[_0xab5d('0x37')],'active':_0x1b47f5[_0xab5d('0x77')],'label':_0x1b47f5[_0xab5d('0x78')],'custom':!![]};}));});}})[_0xab5d('0x18')](function(_0x1d742d){return{'count':_0x1d742d[_0xab5d('0x40')],'rows':_0x1d742d};})['then'](respondWithResult(_0x20fcd9,null))[_0xab5d('0x22')](function(_0x16c584){var _0x4bea9b=_0x3e5d3f[_0xab5d('0x3a')][_0xab5d('0x79')]?0x1f4:_0x16c584[_0xab5d('0x7a')]||0x1f4;logger['error'](_0xab5d('0x7b'),_0xab5d('0x5f'),_0x4bea9b,JSON['stringify'](_0x16c584));delete _0x16c584[_0xab5d('0x30')];if(_0x4bea9b===0x191){_0x4bea9b=0x190;}_0x20fcd9[_0xab5d('0x24')](_0x4bea9b)[_0xab5d('0x31')](_0x3e5d3f['query'][_0xab5d('0x79')]?{'message':_0xab5d('0x7c'),'statusCode':_0x16c584[_0xab5d('0x7a')]}:_0x16c584);});}; \ No newline at end of file +var _0xea88=['../../config/utils','../../config/license/util','../../mysqldb','client','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','map','DeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','count','includeAll','include','rows','catch','show','find','create','body','findOne','params','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','lastIndexOf','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','entries','active','label','test','Wrong\x20credentials','statusCode','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api'];(function(_0xda1c50,_0x43923d){var _0x54f5ed=function(_0xfc8938){while(--_0xfc8938){_0xda1c50['push'](_0xda1c50['shift']());}};_0x54f5ed(++_0x43923d);}(_0xea88,0x1c7));var _0x8ea8=function(_0x40bd95,_0x4cbb34){_0x40bd95=_0x40bd95-0x0;var _0x5b040e=_0xea88[_0x40bd95];return _0x5b040e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ea8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea8('0x1'));var moment=require('moment');var BPromise=require(_0x8ea8('0x2'));var Mustache=require(_0x8ea8('0x3'));var util=require(_0x8ea8('0x4'));var path=require(_0x8ea8('0x5'));var sox=require(_0x8ea8('0x6'));var csv=require(_0x8ea8('0x7'));var ejs=require(_0x8ea8('0x8'));var fs=require('fs');var _=require(_0x8ea8('0x9'));var squel=require('squel');var crypto=require(_0x8ea8('0xa'));var jsforce=require(_0x8ea8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ea8('0xc'));var Papa=require(_0x8ea8('0xd'));var Redis=require(_0x8ea8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ea8('0xf'));var logger=require('../../config/logger')(_0x8ea8('0x10'));var utils=require(_0x8ea8('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea8('0x12'));var db=require(_0x8ea8('0x13'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x8ea8('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe5ef79,_0x5303ed,_0x435914,_0x8e14dd){return new BPromise(function(_0x15c0ee,_0x3ba383){var _0x33179d=_0x8e14dd||client;return _0x33179d[_0x8ea8('0x15')](_0xe5ef79,_0x435914)[_0x8ea8('0x16')](function(_0x194a3d){logger['info'](_0x8ea8('0x17'),_0x5303ed,_0x8ea8('0x18'));logger[_0x8ea8('0x19')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5303ed,_0x8ea8('0x18'),JSON[_0x8ea8('0x1a')](_0x194a3d));if(_0x194a3d[_0x8ea8('0x1b')]){if(_0x194a3d['error'][_0x8ea8('0x1c')]===0x1f4){logger[_0x8ea8('0x1b')](_0x8ea8('0x17'),_0x5303ed,_0x194a3d['error'][_0x8ea8('0x1d')]);return _0x3ba383(_0x194a3d[_0x8ea8('0x1b')][_0x8ea8('0x1d')]);}logger[_0x8ea8('0x1b')](_0x8ea8('0x17'),_0x5303ed,_0x194a3d[_0x8ea8('0x1b')][_0x8ea8('0x1d')]);return _0x15c0ee(_0x194a3d[_0x8ea8('0x1b')][_0x8ea8('0x1d')]);}else{logger[_0x8ea8('0x1e')](_0x8ea8('0x17'),_0x5303ed,_0x8ea8('0x18'));_0x15c0ee(_0x194a3d[_0x8ea8('0x1f')][_0x8ea8('0x1d')]);}})['catch'](function(_0x4b2c05){logger[_0x8ea8('0x1b')](_0x8ea8('0x17'),_0x5303ed,_0x4b2c05);_0x3ba383(_0x4b2c05);});});}function respondWithStatusCode(_0x1b3e0f,_0x34b61b){_0x34b61b=_0x34b61b||0xcc;return function(_0x34d728){if(_0x34d728){return _0x1b3e0f[_0x8ea8('0x20')](_0x34b61b);}return _0x1b3e0f[_0x8ea8('0x21')](_0x34b61b)['end']();};}function respondWithResult(_0x1fb99d,_0x3f5a3e){_0x3f5a3e=_0x3f5a3e||0xc8;return function(_0x4dff05){if(_0x4dff05){return _0x1fb99d[_0x8ea8('0x21')](_0x3f5a3e)['json'](_0x4dff05);}};}function respondWithFilteredResult(_0x5eae43,_0x2c0cde){return function(_0x28adc7){if(_0x28adc7){var _0x48d4e7=_0x28adc7['count'],_0x27e6c5=_0x2c0cde[_0x8ea8('0x22')],_0xae873b=_0x2c0cde[_0x8ea8('0x22')]+_0x2c0cde[_0x8ea8('0x23')],_0x33177d;if(_0xae873b>=_0x48d4e7){_0xae873b=_0x48d4e7;_0x33177d=0xc8;}else{_0x33177d=0xce;}_0x5eae43[_0x8ea8('0x21')](_0x33177d);return _0x5eae43[_0x8ea8('0x24')](_0x8ea8('0x25'),_0x27e6c5+'-'+_0xae873b+'/'+_0x48d4e7)[_0x8ea8('0x26')](_0x28adc7);}return null;};}function patchUpdates(_0x69a20){return function(_0x2f77a1){try{jsonpatch[_0x8ea8('0x27')](_0x2f77a1,_0x69a20,!![]);}catch(_0x1ed7e6){return BPromise[_0x8ea8('0x28')](_0x1ed7e6);}return _0x2f77a1[_0x8ea8('0x29')]();};}function saveUpdates(_0x40dc8a,_0x4d7dc6){return function(_0x487956){if(_0x487956){return _0x487956[_0x8ea8('0x2a')](_0x40dc8a)[_0x8ea8('0x16')](function(_0x27449d){return _0x27449d;});}return null;};}function removeEntity(_0x783679,_0x5262f7){return function(_0x282592){if(_0x282592){return _0x282592[_0x8ea8('0x2b')]()['then'](function(){_0x783679[_0x8ea8('0x21')](0xcc)[_0x8ea8('0x2c')]();});}};}function handleEntityNotFound(_0x144224,_0x513c62){return function(_0x36b3ee){if(!_0x36b3ee){_0x144224[_0x8ea8('0x20')](0x194);}return _0x36b3ee;};}function handleError(_0x2b886b,_0x2238df){_0x2238df=_0x2238df||0x1f4;return function(_0x1832ee){logger[_0x8ea8('0x1b')](_0x1832ee[_0x8ea8('0x2d')]);if(_0x1832ee['name']){delete _0x1832ee[_0x8ea8('0x2e')];}_0x2b886b[_0x8ea8('0x21')](_0x2238df)[_0x8ea8('0x2f')](_0x1832ee);};}exports['index']=function(_0x5e920d,_0x4ce5de){var _0x2547f8={},_0x2f3c65={},_0x5472e9={'count':0x0,'rows':[]};var _0x5848b1=_[_0x8ea8('0x30')](db[_0x8ea8('0x31')][_0x8ea8('0x32')],function(_0x2e21e3){return{'name':_0x2e21e3['fieldName'],'type':_0x2e21e3['type'][_0x8ea8('0x33')]};});_0x2f3c65[_0x8ea8('0x34')]=_[_0x8ea8('0x30')](_0x5848b1,_0x8ea8('0x2e'));_0x2f3c65[_0x8ea8('0x35')]=_[_0x8ea8('0x36')](_0x5e920d[_0x8ea8('0x35')]);_0x2f3c65[_0x8ea8('0x37')]=_[_0x8ea8('0x38')](_0x2f3c65[_0x8ea8('0x34')],_0x2f3c65[_0x8ea8('0x35')]);_0x2547f8['attributes']=_[_0x8ea8('0x38')](_0x2f3c65['model'],qs['fields'](_0x5e920d['query'][_0x8ea8('0x39')]));_0x2547f8['attributes']=_0x2547f8[_0x8ea8('0x3a')][_0x8ea8('0x3b')]?_0x2547f8[_0x8ea8('0x3a')]:_0x2f3c65['model'];if(!_0x5e920d[_0x8ea8('0x35')][_0x8ea8('0x3c')](_0x8ea8('0x3d'))){_0x2547f8[_0x8ea8('0x23')]=qs[_0x8ea8('0x23')](_0x5e920d[_0x8ea8('0x35')]['limit']);_0x2547f8[_0x8ea8('0x22')]=qs[_0x8ea8('0x22')](_0x5e920d[_0x8ea8('0x35')][_0x8ea8('0x22')]);}_0x2547f8[_0x8ea8('0x3e')]=qs[_0x8ea8('0x3f')](_0x5e920d[_0x8ea8('0x35')]['sort']);_0x2547f8[_0x8ea8('0x40')]=qs[_0x8ea8('0x37')](_[_0x8ea8('0x41')](_0x5e920d['query'],_0x2f3c65[_0x8ea8('0x37')]),_0x5848b1);if(_0x5e920d['query'][_0x8ea8('0x42')]){_0x2547f8['where']=_['merge'](_0x2547f8[_0x8ea8('0x40')],{'$or':_['map'](_0x5848b1,function(_0x5e5467){if(_0x5e5467[_0x8ea8('0x43')]!=='VIRTUAL'){var _0x36e47e={};_0x36e47e[_0x5e5467[_0x8ea8('0x2e')]]={'$like':'%'+_0x5e920d['query'][_0x8ea8('0x42')]+'%'};return _0x36e47e;}})});}_0x2547f8=_[_0x8ea8('0x44')]({},_0x2547f8,_0x5e920d[_0x8ea8('0x45')]);var _0x740f49={'where':_0x2547f8['where']};return db[_0x8ea8('0x31')][_0x8ea8('0x46')](_0x740f49)[_0x8ea8('0x16')](function(_0x29e260){_0x5472e9[_0x8ea8('0x46')]=_0x29e260;if(_0x5e920d[_0x8ea8('0x35')][_0x8ea8('0x47')]){_0x2547f8[_0x8ea8('0x48')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2547f8);})['then'](function(_0x334f3e){_0x5472e9[_0x8ea8('0x49')]=_0x334f3e;return _0x5472e9;})['then'](respondWithFilteredResult(_0x4ce5de,_0x2547f8))[_0x8ea8('0x4a')](handleError(_0x4ce5de,null));};exports[_0x8ea8('0x4b')]=function(_0x4378db,_0x340367){var _0x1634ee={'raw':![],'where':{'id':_0x4378db['params']['id']}},_0x2db0f4={};_0x2db0f4[_0x8ea8('0x34')]=_[_0x8ea8('0x36')](db[_0x8ea8('0x31')][_0x8ea8('0x32')]);_0x2db0f4[_0x8ea8('0x35')]=_['keys'](_0x4378db[_0x8ea8('0x35')]);_0x2db0f4[_0x8ea8('0x37')]=_[_0x8ea8('0x38')](_0x2db0f4[_0x8ea8('0x34')],_0x2db0f4['query']);_0x1634ee['attributes']=_[_0x8ea8('0x38')](_0x2db0f4[_0x8ea8('0x34')],qs['fields'](_0x4378db[_0x8ea8('0x35')][_0x8ea8('0x39')]));_0x1634ee[_0x8ea8('0x3a')]=_0x1634ee[_0x8ea8('0x3a')]['length']?_0x1634ee['attributes']:_0x2db0f4['model'];if(_0x4378db[_0x8ea8('0x35')]['includeAll']){_0x1634ee['include']=[{'all':!![]}];}_0x1634ee=_[_0x8ea8('0x44')]({},_0x1634ee,_0x4378db[_0x8ea8('0x45')]);return db[_0x8ea8('0x31')][_0x8ea8('0x4c')](_0x1634ee)['then'](handleEntityNotFound(_0x340367,null))[_0x8ea8('0x16')](respondWithResult(_0x340367,null))[_0x8ea8('0x4a')](handleError(_0x340367,null));};exports['create']=function(_0x1b7566,_0xd8ffac){return db[_0x8ea8('0x31')][_0x8ea8('0x4d')](_0x1b7566['body'],{})['then'](respondWithResult(_0xd8ffac,0xc9))['catch'](handleError(_0xd8ffac,null));};exports[_0x8ea8('0x2a')]=function(_0x1b7cd8,_0x55cfe0){if(_0x1b7cd8[_0x8ea8('0x4e')]['id']){delete _0x1b7cd8[_0x8ea8('0x4e')]['id'];}return db[_0x8ea8('0x31')]['find']({'where':{'id':_0x1b7cd8['params']['id']}})[_0x8ea8('0x16')](handleEntityNotFound(_0x55cfe0,null))[_0x8ea8('0x16')](saveUpdates(_0x1b7cd8[_0x8ea8('0x4e')],null))[_0x8ea8('0x16')](respondWithResult(_0x55cfe0,null))[_0x8ea8('0x4a')](handleError(_0x55cfe0,null));};exports[_0x8ea8('0x2b')]=function(_0x39c1b2,_0x3a66e3){return db['DeskAccount']['find']({'where':{'id':_0x39c1b2['params']['id']}})[_0x8ea8('0x16')](handleEntityNotFound(_0x3a66e3,null))[_0x8ea8('0x16')](removeEntity(_0x3a66e3,null))[_0x8ea8('0x4a')](handleError(_0x3a66e3,null));};exports['getConfigurations']=function(_0x403f63,_0x2364a9,_0x46fbe8){var _0x514b22={};var _0x542882={};var _0x4e1362;var _0x5c4e0d;return db[_0x8ea8('0x31')][_0x8ea8('0x4f')]({'where':{'id':_0x403f63[_0x8ea8('0x50')]['id']}})[_0x8ea8('0x16')](handleEntityNotFound(_0x2364a9,null))[_0x8ea8('0x16')](function(_0x14976e){if(_0x14976e){_0x4e1362=_0x14976e;_0x542882[_0x8ea8('0x34')]=_[_0x8ea8('0x36')](db[_0x8ea8('0x51')][_0x8ea8('0x32')]);_0x542882[_0x8ea8('0x35')]=_['keys'](_0x403f63[_0x8ea8('0x35')]);_0x542882[_0x8ea8('0x37')]=_[_0x8ea8('0x38')](_0x542882['model'],_0x542882[_0x8ea8('0x35')]);_0x514b22['attributes']=_[_0x8ea8('0x38')](_0x542882[_0x8ea8('0x34')],qs[_0x8ea8('0x39')](_0x403f63[_0x8ea8('0x35')][_0x8ea8('0x39')]));_0x514b22[_0x8ea8('0x3a')]=_0x514b22[_0x8ea8('0x3a')][_0x8ea8('0x3b')]?_0x514b22['attributes']:_0x542882[_0x8ea8('0x34')];_0x514b22[_0x8ea8('0x3e')]=qs[_0x8ea8('0x3f')](_0x403f63['query'][_0x8ea8('0x3f')]);_0x514b22[_0x8ea8('0x40')]=qs['filters'](_[_0x8ea8('0x41')](_0x403f63[_0x8ea8('0x35')],_0x542882['filters']));if(_0x403f63[_0x8ea8('0x35')][_0x8ea8('0x42')]){_0x514b22[_0x8ea8('0x40')]=_[_0x8ea8('0x44')](_0x514b22[_0x8ea8('0x40')],{'$or':_['map'](_0x514b22[_0x8ea8('0x3a')],function(_0x428c94){var _0x28247f={};_0x28247f[_0x428c94]={'$like':'%'+_0x403f63[_0x8ea8('0x35')][_0x8ea8('0x42')]+'%'};return _0x28247f;})});}_0x514b22=_[_0x8ea8('0x44')]({},_0x514b22,_0x403f63[_0x8ea8('0x45')]);return _0x4e1362[_0x8ea8('0x52')](_0x514b22);}})[_0x8ea8('0x16')](function(_0x290dae){if(_0x290dae){_0x5c4e0d=_0x290dae[_0x8ea8('0x3b')];if(!_0x403f63['query']['hasOwnProperty'](_0x8ea8('0x3d'))){_0x514b22[_0x8ea8('0x23')]=qs[_0x8ea8('0x23')](_0x403f63[_0x8ea8('0x35')][_0x8ea8('0x23')]);_0x514b22[_0x8ea8('0x22')]=qs['offset'](_0x403f63[_0x8ea8('0x35')][_0x8ea8('0x22')]);}return _0x4e1362[_0x8ea8('0x52')](_0x514b22);}})['then'](function(_0x3d12fd){if(_0x3d12fd){return _0x3d12fd?{'count':_0x5c4e0d,'rows':_0x3d12fd}:null;}})[_0x8ea8('0x16')](respondWithResult(_0x2364a9,null))['catch'](handleError(_0x2364a9,null));};exports[_0x8ea8('0x53')]=function(_0x21f97d,_0x212aaf,_0x2b0b91){if(_0x21f97d[_0x8ea8('0x4e')]['id']){delete _0x21f97d[_0x8ea8('0x4e')]['id'];}return db[_0x8ea8('0x31')][_0x8ea8('0x4f')]({'where':{'id':_0x21f97d[_0x8ea8('0x50')]['id']}})['then'](handleEntityNotFound(_0x212aaf,null))['then'](function(_0x197cd0){if(_0x197cd0){_0x21f97d[_0x8ea8('0x4e')][_0x8ea8('0x54')]=_0x197cd0['id'];_0x21f97d[_0x8ea8('0x4e')][_0x8ea8('0x55')]=integrations[_0x8ea8('0x56')](_0x21f97d[_0x8ea8('0x4e')][_0x8ea8('0x57')],_0x21f97d['body'][_0x8ea8('0x43')]);_0x21f97d['body'][_0x8ea8('0x58')]=integrations[_0x8ea8('0x59')](_0x21f97d[_0x8ea8('0x4e')]['channel'],_0x21f97d[_0x8ea8('0x4e')][_0x8ea8('0x43')]);return db[_0x8ea8('0x51')][_0x8ea8('0x4d')](_0x21f97d[_0x8ea8('0x4e')],{'include':[{'model':db[_0x8ea8('0x5a')],'as':_0x8ea8('0x55')},{'model':db[_0x8ea8('0x5a')],'as':_0x8ea8('0x58')}]});}return null;})[_0x8ea8('0x16')](respondWithResult(_0x212aaf,null))['catch'](handleError(_0x212aaf,null));};exports[_0x8ea8('0x5b')]=function(_0x200163,_0x250514,_0x3a83cd){var _0x3e642b=[{'name':'priority','label':_0x8ea8('0x5c'),'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 _0x42147d='';return db[_0x8ea8('0x31')][_0x8ea8('0x4f')]({'where':{'id':_0x200163[_0x8ea8('0x50')]['id']},'attributes':['id','remoteUri','authType',_0x8ea8('0x5d'),_0x8ea8('0x5e'),_0x8ea8('0x5f'),_0x8ea8('0x60'),_0x8ea8('0x61'),_0x8ea8('0x62')]})[_0x8ea8('0x16')](handleEntityNotFound(_0x250514,null))[_0x8ea8('0x16')](function(_0x52f5be){if(_0x52f5be){_0x42147d=_0x52f5be[_0x8ea8('0x63')];var _0xedbd63=_0x42147d['slice'](-0x1);if(_0xedbd63==='/'){_0x42147d=_0x42147d['substring'](0x0,_0x42147d[_0x8ea8('0x64')](_0xedbd63));}var _0x4b4930={'method':'GET','uri':util[_0x8ea8('0x65')](_0x8ea8('0x66'),_0x42147d),'headers':{'Content-Type':_0x8ea8('0x67'),'Accept':_0x8ea8('0x67')},'json':!![]};if(_0x52f5be[_0x8ea8('0x68')]===_0x8ea8('0x69')){_0x4b4930[_0x8ea8('0x6a')][_0x8ea8('0x6b')]=util[_0x8ea8('0x65')](_0x8ea8('0x6c'),new Buffer(util[_0x8ea8('0x65')](_0x8ea8('0x6d'),_0x52f5be['username'],_0x52f5be[_0x8ea8('0x5e')]))['toString'](_0x8ea8('0x6e')));}return rp(_0x4b4930)['then'](function(_0x5699a5){return _0x3e642b[_0x8ea8('0x6f')](_[_0x8ea8('0x30')](_0x5699a5['_embedded'][_0x8ea8('0x70')],function(_0x35dfc0){return{'id':_0x35dfc0['name'],'name':_0x35dfc0[_0x8ea8('0x2e')],'type':_0x35dfc0['type'],'active':_0x35dfc0[_0x8ea8('0x71')],'label':_0x35dfc0[_0x8ea8('0x72')],'custom':!![]};}));});}})[_0x8ea8('0x16')](function(_0x5d27de){return{'count':_0x5d27de[_0x8ea8('0x3b')],'rows':_0x5d27de};})[_0x8ea8('0x16')](respondWithResult(_0x250514,null))['catch'](function(_0x40c07b){var _0x3f01fb=_0x200163[_0x8ea8('0x35')][_0x8ea8('0x73')]?0x1f4:_0x40c07b['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8ea8('0x5b'),_0x3f01fb,JSON[_0x8ea8('0x1a')](_0x40c07b));delete _0x40c07b[_0x8ea8('0x2e')];if(_0x3f01fb===0x191){_0x3f01fb=0x190;}_0x250514[_0x8ea8('0x21')](_0x3f01fb)[_0x8ea8('0x2f')](_0x200163['query']['test']?{'message':_0x8ea8('0x74'),'statusCode':_0x40c07b[_0x8ea8('0x75')]}:_0x40c07b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f72c144..b5e28bb 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 _0xcc21=['bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0x118408,_0x75c3b){var _0x39b65a=function(_0x31876d){while(--_0x31876d){_0x118408['push'](_0x118408['shift']());}};_0x39b65a(++_0x75c3b);}(_0xcc21,0x11e));var _0x1cc2=function(_0x1739ec,_0x297362){_0x1739ec=_0x1739ec-0x0;var _0x5cf0ca=_0xcc21[_0x1739ec];return _0x5cf0ca;};'use strict';var _=require('lodash');var util=require(_0x1cc2('0x0'));var logger=require(_0x1cc2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1cc2('0x2'));var rp=require(_0x1cc2('0x3'));var fs=require('fs');var path=require(_0x1cc2('0x4'));var rimraf=require(_0x1cc2('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cc2('0x6'));var integrations=require(_0x1cc2('0x7'));module[_0x1cc2('0x8')]=function(_0x5ccb1e,_0x2fed45){return _0x5ccb1e[_0x1cc2('0x9')](_0x1cc2('0xa'),attributes,{'tableName':_0x1cc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c59=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','moment','request-promise','path'];(function(_0x20113d,_0x30a29f){var _0x269cb1=function(_0x419c61){while(--_0x419c61){_0x20113d['push'](_0x20113d['shift']());}};_0x269cb1(++_0x30a29f);}(_0x7c59,0x17c));var _0x97c5=function(_0x4a2c97,_0x4edde0){_0x4a2c97=_0x4a2c97-0x0;var _0x559a64=_0x7c59[_0x4a2c97];return _0x559a64;};'use strict';var _=require('lodash');var util=require(_0x97c5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x97c5('0x1'));var BPromise=require('bluebird');var rp=require(_0x97c5('0x2'));var fs=require('fs');var path=require(_0x97c5('0x3'));var rimraf=require(_0x97c5('0x4'));var config=require(_0x97c5('0x5'));var attributes=require(_0x97c5('0x6'));var integrations=require(_0x97c5('0x7'));module[_0x97c5('0x8')]=function(_0x499111,_0x2cc3e8){return _0x499111[_0x97c5('0x9')](_0x97c5('0xa'),attributes,{'tableName':_0x97c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index f028d38..5192159 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 _0xd4ca=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','model','map','stringify','find','ShowDeskAccount'];(function(_0xd7d9e0,_0xcf0865){var _0x3b0c9b=function(_0x2dcd90){while(--_0x2dcd90){_0xd7d9e0['push'](_0xd7d9e0['shift']());}};_0x3b0c9b(++_0xcf0865);}(_0xd4ca,0xb4));var _0xad4c=function(_0x4b88ff,_0x538015){_0x4b88ff=_0x4b88ff-0x0;var _0x55ca72=_0xd4ca[_0x4b88ff];return _0x55ca72;};'use strict';var _=require(_0xad4c('0x0'));var util=require(_0xad4c('0x1'));var moment=require(_0xad4c('0x2'));var BPromise=require(_0xad4c('0x3'));var rs=require(_0xad4c('0x4'));var fs=require('fs');var Redis=require(_0xad4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xad4c('0x6'))(_0xad4c('0x7'));var config=require(_0xad4c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad4c('0x9')][_0xad4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x155be8,_0x130c34,_0x22f5c2){return new BPromise(function(_0x5745f3,_0x2865b9){return client[_0xad4c('0xb')](_0x155be8,_0x22f5c2)[_0xad4c('0xc')](function(_0x5e999f){logger[_0xad4c('0xd')](_0xad4c('0xe'),_0x130c34,_0xad4c('0xf'));logger[_0xad4c('0x10')](_0xad4c('0x11'),_0x130c34,_0xad4c('0xf'),JSON['stringify'](_0x5e999f));if(_0x5e999f[_0xad4c('0x12')]){if(_0x5e999f[_0xad4c('0x12')][_0xad4c('0x13')]===0x1f4){logger['error'](_0xad4c('0xe'),_0x130c34,_0x5e999f['error'][_0xad4c('0x14')]);return _0x2865b9(_0x5e999f[_0xad4c('0x12')][_0xad4c('0x14')]);}logger['error'](_0xad4c('0xe'),_0x130c34,_0x5e999f['error']['message']);return _0x5745f3(_0x5e999f[_0xad4c('0x12')]['message']);}else{logger['info'](_0xad4c('0xe'),_0x130c34,_0xad4c('0xf'));_0x5745f3(_0x5e999f[_0xad4c('0x15')][_0xad4c('0x14')]);}})[_0xad4c('0x16')](function(_0xe2a404){logger[_0xad4c('0x12')](_0xad4c('0xe'),_0x130c34,_0xe2a404);_0x2865b9(_0xe2a404);});});}exports[_0xad4c('0x17')]=function(_0xae06d6){var _0x213f80=this;return new Promise(function(_0x126f65,_0x3f8f6c){return db[_0xad4c('0x18')]['findAll']({'raw':_0xae06d6[_0xad4c('0x19')]?_0xae06d6[_0xad4c('0x19')][_0xad4c('0x1a')]===undefined?!![]:![]:!![],'where':_0xae06d6['options']?_0xae06d6[_0xad4c('0x19')][_0xad4c('0x1b')]||null:null,'attributes':_0xae06d6[_0xad4c('0x19')]?_0xae06d6['options'][_0xad4c('0x1c')]||null:null,'limit':_0xae06d6[_0xad4c('0x19')]?_0xae06d6[_0xad4c('0x19')][_0xad4c('0x1d')]||null:null,'include':_0xae06d6[_0xad4c('0x19')]?_0xae06d6['options'][_0xad4c('0x1e')]?_['map'](_0xae06d6['options'][_0xad4c('0x1e')],function(_0x2c7aaa){return{'model':db[_0x2c7aaa[_0xad4c('0x1f')]],'as':_0x2c7aaa['as'],'attributes':_0x2c7aaa[_0xad4c('0x1c')],'include':_0x2c7aaa['include']?_[_0xad4c('0x20')](_0x2c7aaa[_0xad4c('0x1e')],function(_0x4caf5f){return{'model':db[_0x4caf5f['model']],'as':_0x4caf5f['as'],'attributes':_0x4caf5f[_0xad4c('0x1c')],'include':_0x4caf5f['include']?_[_0xad4c('0x20')](_0x4caf5f[_0xad4c('0x1e')],function(_0x1ef284){return{'model':db[_0x1ef284[_0xad4c('0x1f')]],'as':_0x1ef284['as'],'attributes':_0x1ef284[_0xad4c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad4c('0xc')](function(_0x4bd0ab){logger[_0xad4c('0xd')](_0xad4c('0x17'),_0xae06d6);logger['debug'](_0xad4c('0x17'),_0xae06d6,JSON[_0xad4c('0x21')](_0x4bd0ab));_0x126f65(_0x4bd0ab);})[_0xad4c('0x16')](function(_0x10c15d){logger[_0xad4c('0x12')](_0xad4c('0x17'),_0x10c15d[_0xad4c('0x14')],_0xae06d6);_0x3f8f6c(_0x213f80[_0xad4c('0x12')](0x1f4,_0x10c15d[_0xad4c('0x14')]));});});};exports['ShowDeskAccount']=function(_0x110cd4){var _0x4484f6=this;return new Promise(function(_0x8b87f6,_0x114162){return db['DeskAccount'][_0xad4c('0x22')]({'raw':_0x110cd4['options']?_0x110cd4['options'][_0xad4c('0x1a')]===undefined?!![]:![]:!![],'where':_0x110cd4[_0xad4c('0x19')]?_0x110cd4[_0xad4c('0x19')][_0xad4c('0x1b')]||null:null,'attributes':_0x110cd4[_0xad4c('0x19')]?_0x110cd4[_0xad4c('0x19')][_0xad4c('0x1c')]||null:null,'include':_0x110cd4[_0xad4c('0x19')]?_0x110cd4[_0xad4c('0x19')]['include']?_[_0xad4c('0x20')](_0x110cd4['options'][_0xad4c('0x1e')],function(_0x33657f){return{'model':db[_0x33657f[_0xad4c('0x1f')]],'as':_0x33657f['as'],'attributes':_0x33657f[_0xad4c('0x1c')],'include':_0x33657f['include']?_[_0xad4c('0x20')](_0x33657f[_0xad4c('0x1e')],function(_0x42a2de){return{'model':db[_0x42a2de[_0xad4c('0x1f')]],'as':_0x42a2de['as'],'attributes':_0x42a2de[_0xad4c('0x1c')],'include':_0x42a2de['include']?_[_0xad4c('0x20')](_0x42a2de[_0xad4c('0x1e')],function(_0x291c02){return{'model':db[_0x291c02[_0xad4c('0x1f')]],'as':_0x291c02['as'],'attributes':_0x291c02[_0xad4c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad4c('0xc')](function(_0x2686e1){logger[_0xad4c('0xd')]('ShowDeskAccount',_0x110cd4);logger[_0xad4c('0x10')](_0xad4c('0x23'),_0x110cd4,JSON[_0xad4c('0x21')](_0x2686e1));_0x8b87f6(_0x2686e1);})['catch'](function(_0x45fa77){logger['error'](_0xad4c('0x23'),_0x45fa77['message'],_0x110cd4);_0x114162(_0x4484f6[_0xad4c('0x12')](0x1f4,_0x45fa77['message']));});});}; \ No newline at end of file +var _0xcaa9=['attributes','limit','map','model','include','GetDeskAccount','stringify','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','DeskAccount','findAll','options','raw'];(function(_0x10a77f,_0x8575b0){var _0x40e612=function(_0x169079){while(--_0x169079){_0x10a77f['push'](_0x10a77f['shift']());}};_0x40e612(++_0x8575b0);}(_0xcaa9,0x160));var _0x9caa=function(_0x2d0374,_0x2be79b){_0x2d0374=_0x2d0374-0x0;var _0x2b66a2=_0xcaa9[_0x2d0374];return _0x2b66a2;};'use strict';var _=require(_0x9caa('0x0'));var util=require(_0x9caa('0x1'));var moment=require(_0x9caa('0x2'));var BPromise=require(_0x9caa('0x3'));var rs=require(_0x9caa('0x4'));var fs=require('fs');var Redis=require(_0x9caa('0x5'));var db=require(_0x9caa('0x6'))['db'];var utils=require(_0x9caa('0x7'));var logger=require(_0x9caa('0x8'))(_0x9caa('0x9'));var config=require(_0x9caa('0xa'));var jayson=require(_0x9caa('0xb'));var client=jayson['client'][_0x9caa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x439aa3,_0xf58bc9,_0x55cda9){return new BPromise(function(_0xd61486,_0x246a3a){return client[_0x9caa('0xd')](_0x439aa3,_0x55cda9)[_0x9caa('0xe')](function(_0x2e2e8b){logger['info'](_0x9caa('0xf'),_0xf58bc9,_0x9caa('0x10'));logger[_0x9caa('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0xf58bc9,'request\x20sent',JSON['stringify'](_0x2e2e8b));if(_0x2e2e8b['error']){if(_0x2e2e8b[_0x9caa('0x12')][_0x9caa('0x13')]===0x1f4){logger['error'](_0x9caa('0xf'),_0xf58bc9,_0x2e2e8b[_0x9caa('0x12')][_0x9caa('0x14')]);return _0x246a3a(_0x2e2e8b[_0x9caa('0x12')][_0x9caa('0x14')]);}logger[_0x9caa('0x12')](_0x9caa('0xf'),_0xf58bc9,_0x2e2e8b[_0x9caa('0x12')][_0x9caa('0x14')]);return _0xd61486(_0x2e2e8b['error'][_0x9caa('0x14')]);}else{logger[_0x9caa('0x15')](_0x9caa('0xf'),_0xf58bc9,_0x9caa('0x10'));_0xd61486(_0x2e2e8b[_0x9caa('0x16')][_0x9caa('0x14')]);}})[_0x9caa('0x17')](function(_0x1e383e){logger[_0x9caa('0x12')]('DeskAccount,\x20%s,\x20%s',_0xf58bc9,_0x1e383e);_0x246a3a(_0x1e383e);});});}exports['GetDeskAccount']=function(_0x22a330){var _0x1b83e0=this;return new Promise(function(_0x31ef58,_0x11fc8a){return db[_0x9caa('0x18')][_0x9caa('0x19')]({'raw':_0x22a330[_0x9caa('0x1a')]?_0x22a330[_0x9caa('0x1a')][_0x9caa('0x1b')]===undefined?!![]:![]:!![],'where':_0x22a330['options']?_0x22a330[_0x9caa('0x1a')]['where']||null:null,'attributes':_0x22a330[_0x9caa('0x1a')]?_0x22a330[_0x9caa('0x1a')][_0x9caa('0x1c')]||null:null,'limit':_0x22a330['options']?_0x22a330['options'][_0x9caa('0x1d')]||null:null,'include':_0x22a330[_0x9caa('0x1a')]?_0x22a330['options']['include']?_[_0x9caa('0x1e')](_0x22a330[_0x9caa('0x1a')]['include'],function(_0x5ece2c){return{'model':db[_0x5ece2c[_0x9caa('0x1f')]],'as':_0x5ece2c['as'],'attributes':_0x5ece2c[_0x9caa('0x1c')],'include':_0x5ece2c['include']?_[_0x9caa('0x1e')](_0x5ece2c[_0x9caa('0x20')],function(_0x411fde){return{'model':db[_0x411fde[_0x9caa('0x1f')]],'as':_0x411fde['as'],'attributes':_0x411fde[_0x9caa('0x1c')],'include':_0x411fde[_0x9caa('0x20')]?_[_0x9caa('0x1e')](_0x411fde[_0x9caa('0x20')],function(_0x3e74d4){return{'model':db[_0x3e74d4[_0x9caa('0x1f')]],'as':_0x3e74d4['as'],'attributes':_0x3e74d4[_0x9caa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9caa('0xe')](function(_0x223fa0){logger[_0x9caa('0x15')](_0x9caa('0x21'),_0x22a330);logger[_0x9caa('0x11')](_0x9caa('0x21'),_0x22a330,JSON[_0x9caa('0x22')](_0x223fa0));_0x31ef58(_0x223fa0);})['catch'](function(_0xa47ba3){logger['error'](_0x9caa('0x21'),_0xa47ba3[_0x9caa('0x14')],_0x22a330);_0x11fc8a(_0x1b83e0[_0x9caa('0x12')](0x1f4,_0xa47ba3[_0x9caa('0x14')]));});});};exports[_0x9caa('0x23')]=function(_0x1c4ba4){var _0x549baa=this;return new Promise(function(_0xaf6ac9,_0x17688b){return db[_0x9caa('0x18')][_0x9caa('0x24')]({'raw':_0x1c4ba4['options']?_0x1c4ba4[_0x9caa('0x1a')][_0x9caa('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c4ba4['options']?_0x1c4ba4[_0x9caa('0x1a')][_0x9caa('0x25')]||null:null,'attributes':_0x1c4ba4['options']?_0x1c4ba4[_0x9caa('0x1a')][_0x9caa('0x1c')]||null:null,'include':_0x1c4ba4[_0x9caa('0x1a')]?_0x1c4ba4[_0x9caa('0x1a')]['include']?_[_0x9caa('0x1e')](_0x1c4ba4['options'][_0x9caa('0x20')],function(_0x39dcae){return{'model':db[_0x39dcae[_0x9caa('0x1f')]],'as':_0x39dcae['as'],'attributes':_0x39dcae[_0x9caa('0x1c')],'include':_0x39dcae[_0x9caa('0x20')]?_[_0x9caa('0x1e')](_0x39dcae[_0x9caa('0x20')],function(_0xaaa706){return{'model':db[_0xaaa706['model']],'as':_0xaaa706['as'],'attributes':_0xaaa706[_0x9caa('0x1c')],'include':_0xaaa706[_0x9caa('0x20')]?_[_0x9caa('0x1e')](_0xaaa706[_0x9caa('0x20')],function(_0x3bd6ef){return{'model':db[_0x3bd6ef[_0x9caa('0x1f')]],'as':_0x3bd6ef['as'],'attributes':_0x3bd6ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x9caa('0xe')](function(_0x4e1a90){logger[_0x9caa('0x15')](_0x9caa('0x23'),_0x1c4ba4);logger['debug'](_0x9caa('0x23'),_0x1c4ba4,JSON[_0x9caa('0x22')](_0x4e1a90));_0xaf6ac9(_0x4e1a90);})[_0x9caa('0x17')](function(_0x105c8f){logger[_0x9caa('0x12')]('ShowDeskAccount',_0x105c8f[_0x9caa('0x14')],_0x1c4ba4);_0x17688b(_0x549baa[_0x9caa('0x12')](0x1f4,_0x105c8f[_0x9caa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index cfc0efe..df7954b 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 _0x7ed1=['/:id/subjects','getSubjects','/:id/tags','getTags','post','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x5204e5,_0x4a6082){var _0x5eff2b=function(_0x4dd88f){while(--_0x4dd88f){_0x5204e5['push'](_0x5204e5['shift']());}};_0x5eff2b(++_0x4a6082);}(_0x7ed1,0xca));var _0x17ed=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7ed1[_0xa8883];return _0x479426;};'use strict';var multer=require(_0x17ed('0x0'));var util=require('util');var path=require(_0x17ed('0x1'));var timeout=require(_0x17ed('0x2'));var express=require(_0x17ed('0x3'));var router=express[_0x17ed('0x4')]();var auth=require(_0x17ed('0x5'));var interaction=require(_0x17ed('0x6'));var config=require('../../config/environment');var controller=require(_0x17ed('0x7'));router[_0x17ed('0x8')]('/',auth[_0x17ed('0x9')](),controller[_0x17ed('0xa')]);router['get']('/:id',auth[_0x17ed('0x9')](),controller[_0x17ed('0xb')]);router[_0x17ed('0x8')](_0x17ed('0xc'),auth['isAuthenticated'](),controller[_0x17ed('0xd')]);router[_0x17ed('0x8')](_0x17ed('0xe'),auth[_0x17ed('0x9')](),controller[_0x17ed('0xf')]);router[_0x17ed('0x8')]('/:id/descriptions',auth[_0x17ed('0x9')](),controller['getDescriptions']);router['get'](_0x17ed('0x10'),auth[_0x17ed('0x9')](),controller[_0x17ed('0x11')]);router[_0x17ed('0x12')]('/',auth[_0x17ed('0x9')](),controller['create']);router[_0x17ed('0x12')](_0x17ed('0x10'),auth[_0x17ed('0x9')](),controller['setTags']);router[_0x17ed('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x17ed('0x14')]);router['delete'](_0x17ed('0x15'),auth[_0x17ed('0x9')](),controller[_0x17ed('0x16')]);module[_0x17ed('0x17')]=router; \ No newline at end of file +var _0xcdd2=['setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var path=require(_0x2cdd('0x2'));var timeout=require(_0x2cdd('0x3'));var express=require('express');var router=express[_0x2cdd('0x4')]();var auth=require(_0x2cdd('0x5'));var interaction=require(_0x2cdd('0x6'));var config=require(_0x2cdd('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x2cdd('0x8')]('/',auth[_0x2cdd('0x9')](),controller['index']);router[_0x2cdd('0x8')](_0x2cdd('0xa'),auth[_0x2cdd('0x9')](),controller[_0x2cdd('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x2cdd('0xc')]);router['get'](_0x2cdd('0xd'),auth[_0x2cdd('0x9')](),controller[_0x2cdd('0xe')]);router[_0x2cdd('0x8')](_0x2cdd('0xf'),auth[_0x2cdd('0x9')](),controller[_0x2cdd('0x10')]);router[_0x2cdd('0x8')](_0x2cdd('0x11'),auth[_0x2cdd('0x9')](),controller['getTags']);router['post']('/',auth[_0x2cdd('0x9')](),controller[_0x2cdd('0x12')]);router['post'](_0x2cdd('0x11'),auth[_0x2cdd('0x9')](),controller[_0x2cdd('0x13')]);router[_0x2cdd('0x14')](_0x2cdd('0xa'),auth['isAuthenticated'](),controller[_0x2cdd('0x15')]);router[_0x2cdd('0x16')]('/:id',auth[_0x2cdd('0x9')](),controller[_0x2cdd('0x17')]);module[_0x2cdd('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 c287b5b..1166e13 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 _0xd198=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd198,0x73));var _0x8d19=function(_0x58e29f,_0x475e63){_0x58e29f=_0x58e29f-0x0;var _0x32a7ab=_0xd198[_0x58e29f];return _0x32a7ab;};'use strict';var Sequelize=require(_0x8d19('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d19('0x1')]},'description':{'type':Sequelize[_0x8d19('0x1')]}}; \ No newline at end of file +var _0x55ab=['exports','STRING','sequelize'];(function(_0x2392b0,_0x42157c){var _0x40eb0c=function(_0x215d28){while(--_0x215d28){_0x2392b0['push'](_0x2392b0['shift']());}};_0x40eb0c(++_0x42157c);}(_0x55ab,0x143));var _0xb55a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x55ab[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xb55a('0x0'));module[_0xb55a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb55a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index de53c52..eda4009 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 _0x3c05=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','options','count','rows','params','rawAttributes','include','find','create','body','getFields','findOne','DeskField','length','order','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service'];(function(_0x4b9b55,_0x48b0ee){var _0x1180c5=function(_0x4c585f){while(--_0x4c585f){_0x4b9b55['push'](_0x4b9b55['shift']());}};_0x1180c5(++_0x48b0ee);}(_0x3c05,0xaa));var _0x53c0=function(_0x43f479,_0x3701a1){_0x43f479=_0x43f479-0x0;var _0x4106a6=_0x3c05[_0x43f479];return _0x4106a6;};'use strict';var pdf=require(_0x53c0('0x0'));var emlformat=require(_0x53c0('0x1'));var rimraf=require(_0x53c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53c0('0x3'));var rp=require(_0x53c0('0x4'));var moment=require(_0x53c0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x53c0('0x6'));var path=require(_0x53c0('0x7'));var sox=require(_0x53c0('0x8'));var csv=require(_0x53c0('0x9'));var ejs=require(_0x53c0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x53c0('0xb'));var crypto=require(_0x53c0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x53c0('0xd'));var toCsv=require(_0x53c0('0x9'));var querystring=require(_0x53c0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53c0('0xf'));var qs=require(_0x53c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53c0('0x11'));var utils=require(_0x53c0('0x12'));var config=require(_0x53c0('0x13'));var licenseUtil=require(_0x53c0('0x14'));var db=require(_0x53c0('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x53c0('0x16')][_0x53c0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x449aa9,_0xc68f0a,_0x1819d3,_0x15899a){return new BPromise(function(_0xf08431,_0x5ce0a7){var _0x29cb46=_0x15899a||client;return _0x29cb46[_0x53c0('0x18')](_0x449aa9,_0x1819d3)[_0x53c0('0x19')](function(_0x48fe3b){logger[_0x53c0('0x1a')]('DeskConfiguration,\x20%s,\x20%s',_0xc68f0a,_0x53c0('0x1b'));logger[_0x53c0('0x1c')](_0x53c0('0x1d'),_0xc68f0a,'request\x20sent',JSON[_0x53c0('0x1e')](_0x48fe3b));if(_0x48fe3b[_0x53c0('0x1f')]){if(_0x48fe3b[_0x53c0('0x1f')][_0x53c0('0x20')]===0x1f4){logger[_0x53c0('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0xc68f0a,_0x48fe3b[_0x53c0('0x1f')][_0x53c0('0x21')]);return _0x5ce0a7(_0x48fe3b[_0x53c0('0x1f')]['message']);}logger[_0x53c0('0x1f')](_0x53c0('0x22'),_0xc68f0a,_0x48fe3b[_0x53c0('0x1f')][_0x53c0('0x21')]);return _0xf08431(_0x48fe3b[_0x53c0('0x1f')]['message']);}else{logger[_0x53c0('0x1a')]('DeskConfiguration,\x20%s,\x20%s',_0xc68f0a,_0x53c0('0x1b'));_0xf08431(_0x48fe3b[_0x53c0('0x23')][_0x53c0('0x21')]);}})[_0x53c0('0x24')](function(_0x267a6f){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xc68f0a,_0x267a6f);_0x5ce0a7(_0x267a6f);});});}function respondWithStatusCode(_0x2526c7,_0x1af201){_0x1af201=_0x1af201||0xcc;return function(_0x1164ef){if(_0x1164ef){return _0x2526c7[_0x53c0('0x25')](_0x1af201);}return _0x2526c7[_0x53c0('0x26')](_0x1af201)[_0x53c0('0x27')]();};}function respondWithResult(_0x208b01,_0x4db2ba){_0x4db2ba=_0x4db2ba||0xc8;return function(_0x3c7a39){if(_0x3c7a39){return _0x208b01[_0x53c0('0x26')](_0x4db2ba)[_0x53c0('0x28')](_0x3c7a39);}};}function respondWithFilteredResult(_0xa841ad,_0x59a164){return function(_0x573f9e){if(_0x573f9e){var _0x25b6b9=_0x573f9e['count'],_0x4c41a5=_0x59a164['offset'],_0x13fc53=_0x59a164[_0x53c0('0x29')]+_0x59a164['limit'],_0x39dc4a;if(_0x13fc53>=_0x25b6b9){_0x13fc53=_0x25b6b9;_0x39dc4a=0xc8;}else{_0x39dc4a=0xce;}_0xa841ad['status'](_0x39dc4a);return _0xa841ad[_0x53c0('0x2a')](_0x53c0('0x2b'),_0x4c41a5+'-'+_0x13fc53+'/'+_0x25b6b9)[_0x53c0('0x28')](_0x573f9e);}return null;};}function patchUpdates(_0x790538){return function(_0x2da0dc){try{jsonpatch[_0x53c0('0x2c')](_0x2da0dc,_0x790538,!![]);}catch(_0x2cdbaf){return BPromise[_0x53c0('0x2d')](_0x2cdbaf);}return _0x2da0dc[_0x53c0('0x2e')]();};}function saveUpdates(_0x35049b,_0x2d6694){return function(_0x3f0fa7){if(_0x3f0fa7){return _0x3f0fa7[_0x53c0('0x2f')](_0x35049b)[_0x53c0('0x19')](function(_0x545497){return _0x545497;});}return null;};}function removeEntity(_0x9c4572,_0x2ffeb6){return function(_0x87a397){if(_0x87a397){return _0x87a397[_0x53c0('0x30')]()[_0x53c0('0x19')](function(){_0x9c4572[_0x53c0('0x26')](0xcc)[_0x53c0('0x27')]();});}};}function handleEntityNotFound(_0x511db1,_0x2eb84c){return function(_0x35f98d){if(!_0x35f98d){_0x511db1[_0x53c0('0x25')](0x194);}return _0x35f98d;};}function handleError(_0xe6bc00,_0x13cff2){_0x13cff2=_0x13cff2||0x1f4;return function(_0x4e5423){logger[_0x53c0('0x1f')](_0x4e5423['stack']);if(_0x4e5423[_0x53c0('0x31')]){delete _0x4e5423[_0x53c0('0x31')];}_0xe6bc00[_0x53c0('0x26')](_0x13cff2)[_0x53c0('0x32')](_0x4e5423);};}exports[_0x53c0('0x33')]=function(_0x92fedc,_0xb89da5){var _0xf99eb3={},_0x329d0f={},_0x595fc9={'count':0x0,'rows':[]};var _0xc9d5c3=_[_0x53c0('0x34')](db[_0x53c0('0x35')]['rawAttributes'],function(_0x517c02){return{'name':_0x517c02[_0x53c0('0x36')],'type':_0x517c02[_0x53c0('0x37')][_0x53c0('0x38')]};});_0x329d0f[_0x53c0('0x39')]=_[_0x53c0('0x34')](_0xc9d5c3,'name');_0x329d0f[_0x53c0('0x3a')]=_[_0x53c0('0x3b')](_0x92fedc[_0x53c0('0x3a')]);_0x329d0f[_0x53c0('0x3c')]=_[_0x53c0('0x3d')](_0x329d0f[_0x53c0('0x39')],_0x329d0f['query']);_0xf99eb3[_0x53c0('0x3e')]=_['intersection'](_0x329d0f[_0x53c0('0x39')],qs[_0x53c0('0x3f')](_0x92fedc[_0x53c0('0x3a')][_0x53c0('0x3f')]));_0xf99eb3[_0x53c0('0x3e')]=_0xf99eb3['attributes']['length']?_0xf99eb3[_0x53c0('0x3e')]:_0x329d0f['model'];if(!_0x92fedc[_0x53c0('0x3a')][_0x53c0('0x40')]('nolimit')){_0xf99eb3[_0x53c0('0x41')]=qs[_0x53c0('0x41')](_0x92fedc[_0x53c0('0x3a')][_0x53c0('0x41')]);_0xf99eb3[_0x53c0('0x29')]=qs[_0x53c0('0x29')](_0x92fedc['query'][_0x53c0('0x29')]);}_0xf99eb3['order']=qs[_0x53c0('0x42')](_0x92fedc[_0x53c0('0x3a')]['sort']);_0xf99eb3['where']=qs[_0x53c0('0x3c')](_[_0x53c0('0x43')](_0x92fedc[_0x53c0('0x3a')],_0x329d0f[_0x53c0('0x3c')]),_0xc9d5c3);if(_0x92fedc['query']['filter']){_0xf99eb3[_0x53c0('0x44')]=_[_0x53c0('0x45')](_0xf99eb3['where'],{'$or':_[_0x53c0('0x34')](_0xc9d5c3,function(_0x3acf5a){if(_0x3acf5a[_0x53c0('0x37')]!==_0x53c0('0x46')){var _0x580455={};_0x580455[_0x3acf5a[_0x53c0('0x31')]]={'$like':'%'+_0x92fedc[_0x53c0('0x3a')]['filter']+'%'};return _0x580455;}})});}_0xf99eb3=_[_0x53c0('0x45')]({},_0xf99eb3,_0x92fedc[_0x53c0('0x47')]);var _0x37a352={'where':_0xf99eb3[_0x53c0('0x44')]};return db[_0x53c0('0x35')][_0x53c0('0x48')](_0x37a352)['then'](function(_0x8c4c0f){_0x595fc9[_0x53c0('0x48')]=_0x8c4c0f;if(_0x92fedc[_0x53c0('0x3a')]['includeAll']){_0xf99eb3['include']=[{'all':!![]}];}return db[_0x53c0('0x35')]['findAll'](_0xf99eb3);})[_0x53c0('0x19')](function(_0x262011){_0x595fc9[_0x53c0('0x49')]=_0x262011;return _0x595fc9;})[_0x53c0('0x19')](respondWithFilteredResult(_0xb89da5,_0xf99eb3))[_0x53c0('0x24')](handleError(_0xb89da5,null));};exports['show']=function(_0x5d35de,_0x3a44eb){var _0x6966ad={'raw':![],'where':{'id':_0x5d35de[_0x53c0('0x4a')]['id']}},_0x4639dc={};_0x4639dc[_0x53c0('0x39')]=_['keys'](db[_0x53c0('0x35')][_0x53c0('0x4b')]);_0x4639dc['query']=_[_0x53c0('0x3b')](_0x5d35de[_0x53c0('0x3a')]);_0x4639dc[_0x53c0('0x3c')]=_[_0x53c0('0x3d')](_0x4639dc[_0x53c0('0x39')],_0x4639dc['query']);_0x6966ad[_0x53c0('0x3e')]=_[_0x53c0('0x3d')](_0x4639dc['model'],qs['fields'](_0x5d35de['query'][_0x53c0('0x3f')]));_0x6966ad['attributes']=_0x6966ad[_0x53c0('0x3e')]['length']?_0x6966ad['attributes']:_0x4639dc[_0x53c0('0x39')];if(_0x5d35de[_0x53c0('0x3a')]['includeAll']){_0x6966ad[_0x53c0('0x4c')]=[{'all':!![]}];}_0x6966ad=_['merge']({},_0x6966ad,_0x5d35de[_0x53c0('0x47')]);return db[_0x53c0('0x35')][_0x53c0('0x4d')](_0x6966ad)[_0x53c0('0x19')](handleEntityNotFound(_0x3a44eb,null))[_0x53c0('0x19')](respondWithResult(_0x3a44eb,null))[_0x53c0('0x24')](handleError(_0x3a44eb,null));};exports[_0x53c0('0x4e')]=function(_0x4f7a96,_0x2b81dd){return db[_0x53c0('0x35')][_0x53c0('0x4e')](_0x4f7a96[_0x53c0('0x4f')],{})[_0x53c0('0x19')](respondWithResult(_0x2b81dd,0xc9))[_0x53c0('0x24')](handleError(_0x2b81dd,null));};exports[_0x53c0('0x2f')]=function(_0x367131,_0x569a9b){if(_0x367131[_0x53c0('0x4f')]['id']){delete _0x367131['body']['id'];}return db[_0x53c0('0x35')][_0x53c0('0x4d')]({'where':{'id':_0x367131[_0x53c0('0x4a')]['id']}})[_0x53c0('0x19')](handleEntityNotFound(_0x569a9b,null))[_0x53c0('0x19')](saveUpdates(_0x367131['body'],null))[_0x53c0('0x19')](respondWithResult(_0x569a9b,null))[_0x53c0('0x24')](handleError(_0x569a9b,null));};exports[_0x53c0('0x30')]=function(_0x18461b,_0x53b6bb){return db[_0x53c0('0x35')][_0x53c0('0x4d')]({'where':{'id':_0x18461b[_0x53c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53b6bb,null))[_0x53c0('0x19')](removeEntity(_0x53b6bb,null))[_0x53c0('0x24')](handleError(_0x53b6bb,null));};exports[_0x53c0('0x50')]=function(_0x1e84a3,_0x2665e5,_0x1039cb){var _0x245171={};var _0x47dfc9={};var _0x3cdcb0;var _0x4e6a78;return db['DeskConfiguration'][_0x53c0('0x51')]({'where':{'id':_0x1e84a3['params']['id']}})['then'](handleEntityNotFound(_0x2665e5,null))[_0x53c0('0x19')](function(_0x4b4c3b){if(_0x4b4c3b){_0x3cdcb0=_0x4b4c3b;_0x47dfc9['model']=_[_0x53c0('0x3b')](db[_0x53c0('0x52')][_0x53c0('0x4b')]);_0x47dfc9['query']=_[_0x53c0('0x3b')](_0x1e84a3[_0x53c0('0x3a')]);_0x47dfc9[_0x53c0('0x3c')]=_['intersection'](_0x47dfc9[_0x53c0('0x39')],_0x47dfc9['query']);_0x245171[_0x53c0('0x3e')]=_['intersection'](_0x47dfc9['model'],qs[_0x53c0('0x3f')](_0x1e84a3[_0x53c0('0x3a')][_0x53c0('0x3f')]));_0x245171['attributes']=_0x245171[_0x53c0('0x3e')][_0x53c0('0x53')]?_0x245171['attributes']:_0x47dfc9['model'];_0x245171[_0x53c0('0x54')]=qs[_0x53c0('0x42')](_0x1e84a3[_0x53c0('0x3a')]['sort']);_0x245171[_0x53c0('0x44')]=qs[_0x53c0('0x3c')](_[_0x53c0('0x43')](_0x1e84a3[_0x53c0('0x3a')],_0x47dfc9[_0x53c0('0x3c')]));if(_0x1e84a3['query'][_0x53c0('0x55')]){_0x245171[_0x53c0('0x44')]=_[_0x53c0('0x45')](_0x245171[_0x53c0('0x44')],{'$or':_[_0x53c0('0x34')](_0x245171[_0x53c0('0x3e')],function(_0x29bb18){var _0x64edc9={};_0x64edc9[_0x29bb18]={'$like':'%'+_0x1e84a3['query'][_0x53c0('0x55')]+'%'};return _0x64edc9;})});}_0x245171=_[_0x53c0('0x45')]({},_0x245171,_0x1e84a3[_0x53c0('0x47')]);return _0x3cdcb0[_0x53c0('0x50')](_0x245171);}})[_0x53c0('0x19')](function(_0x460f53){if(_0x460f53){_0x4e6a78=_0x460f53[_0x53c0('0x53')];if(!_0x1e84a3[_0x53c0('0x3a')][_0x53c0('0x40')](_0x53c0('0x56'))){_0x245171[_0x53c0('0x41')]=qs[_0x53c0('0x41')](_0x1e84a3['query'][_0x53c0('0x41')]);_0x245171[_0x53c0('0x29')]=qs[_0x53c0('0x29')](_0x1e84a3[_0x53c0('0x3a')][_0x53c0('0x29')]);}return _0x3cdcb0[_0x53c0('0x50')](_0x245171);}})[_0x53c0('0x19')](function(_0x502f54){if(_0x502f54){return _0x502f54?{'count':_0x4e6a78,'rows':_0x502f54}:null;}})['then'](respondWithResult(_0x2665e5,null))[_0x53c0('0x24')](handleError(_0x2665e5,null));};exports[_0x53c0('0x57')]=function(_0x444009,_0x492efe,_0x173e43){var _0x173d5b={};var _0x9d35d4={};var _0x414122;var _0x125ec6;return db['DeskConfiguration'][_0x53c0('0x51')]({'where':{'id':_0x444009[_0x53c0('0x4a')]['id']}})[_0x53c0('0x19')](handleEntityNotFound(_0x492efe,null))[_0x53c0('0x19')](function(_0x1d39bf){if(_0x1d39bf){_0x414122=_0x1d39bf;_0x9d35d4[_0x53c0('0x39')]=_['keys'](db[_0x53c0('0x52')][_0x53c0('0x4b')]);_0x9d35d4[_0x53c0('0x3a')]=_[_0x53c0('0x3b')](_0x444009[_0x53c0('0x3a')]);_0x9d35d4[_0x53c0('0x3c')]=_[_0x53c0('0x3d')](_0x9d35d4[_0x53c0('0x39')],_0x9d35d4[_0x53c0('0x3a')]);_0x173d5b[_0x53c0('0x3e')]=_[_0x53c0('0x3d')](_0x9d35d4[_0x53c0('0x39')],qs[_0x53c0('0x3f')](_0x444009['query']['fields']));_0x173d5b[_0x53c0('0x3e')]=_0x173d5b[_0x53c0('0x3e')]['length']?_0x173d5b['attributes']:_0x9d35d4['model'];_0x173d5b[_0x53c0('0x54')]=qs['sort'](_0x444009[_0x53c0('0x3a')][_0x53c0('0x42')]);_0x173d5b[_0x53c0('0x44')]=qs[_0x53c0('0x3c')](_[_0x53c0('0x43')](_0x444009['query'],_0x9d35d4[_0x53c0('0x3c')]));if(_0x444009[_0x53c0('0x3a')][_0x53c0('0x55')]){_0x173d5b['where']=_[_0x53c0('0x45')](_0x173d5b[_0x53c0('0x44')],{'$or':_[_0x53c0('0x34')](_0x173d5b[_0x53c0('0x3e')],function(_0x55339a){var _0x313389={};_0x313389[_0x55339a]={'$like':'%'+_0x444009[_0x53c0('0x3a')]['filter']+'%'};return _0x313389;})});}_0x173d5b=_[_0x53c0('0x45')]({},_0x173d5b,_0x444009[_0x53c0('0x47')]);return _0x414122['getSubjects'](_0x173d5b);}})['then'](function(_0x2cc27c){if(_0x2cc27c){_0x125ec6=_0x2cc27c[_0x53c0('0x53')];if(!_0x444009[_0x53c0('0x3a')][_0x53c0('0x40')](_0x53c0('0x56'))){_0x173d5b[_0x53c0('0x41')]=qs['limit'](_0x444009[_0x53c0('0x3a')][_0x53c0('0x41')]);_0x173d5b[_0x53c0('0x29')]=qs[_0x53c0('0x29')](_0x444009[_0x53c0('0x3a')][_0x53c0('0x29')]);}return _0x414122[_0x53c0('0x57')](_0x173d5b);}})['then'](function(_0x23b542){if(_0x23b542){return _0x23b542?{'count':_0x125ec6,'rows':_0x23b542}:null;}})[_0x53c0('0x19')](respondWithResult(_0x492efe,null))[_0x53c0('0x24')](handleError(_0x492efe,null));};exports['getDescriptions']=function(_0x1268c2,_0x974288,_0x25b024){var _0x4d11af={};var _0x1d3ae1={};var _0x24afe8;var _0x38f1b6;return db[_0x53c0('0x35')][_0x53c0('0x51')]({'where':{'id':_0x1268c2[_0x53c0('0x4a')]['id']}})[_0x53c0('0x19')](handleEntityNotFound(_0x974288,null))[_0x53c0('0x19')](function(_0x366f81){if(_0x366f81){_0x24afe8=_0x366f81;_0x1d3ae1[_0x53c0('0x39')]=_[_0x53c0('0x3b')](db['DeskField'][_0x53c0('0x4b')]);_0x1d3ae1[_0x53c0('0x3a')]=_[_0x53c0('0x3b')](_0x1268c2[_0x53c0('0x3a')]);_0x1d3ae1[_0x53c0('0x3c')]=_[_0x53c0('0x3d')](_0x1d3ae1[_0x53c0('0x39')],_0x1d3ae1[_0x53c0('0x3a')]);_0x4d11af['attributes']=_[_0x53c0('0x3d')](_0x1d3ae1[_0x53c0('0x39')],qs[_0x53c0('0x3f')](_0x1268c2[_0x53c0('0x3a')]['fields']));_0x4d11af[_0x53c0('0x3e')]=_0x4d11af[_0x53c0('0x3e')][_0x53c0('0x53')]?_0x4d11af[_0x53c0('0x3e')]:_0x1d3ae1[_0x53c0('0x39')];_0x4d11af['order']=qs[_0x53c0('0x42')](_0x1268c2[_0x53c0('0x3a')][_0x53c0('0x42')]);_0x4d11af[_0x53c0('0x44')]=qs[_0x53c0('0x3c')](_[_0x53c0('0x43')](_0x1268c2[_0x53c0('0x3a')],_0x1d3ae1[_0x53c0('0x3c')]));if(_0x1268c2[_0x53c0('0x3a')]['filter']){_0x4d11af['where']=_[_0x53c0('0x45')](_0x4d11af[_0x53c0('0x44')],{'$or':_[_0x53c0('0x34')](_0x4d11af[_0x53c0('0x3e')],function(_0x234694){var _0x37bd70={};_0x37bd70[_0x234694]={'$like':'%'+_0x1268c2[_0x53c0('0x3a')][_0x53c0('0x55')]+'%'};return _0x37bd70;})});}_0x4d11af=_['merge']({},_0x4d11af,_0x1268c2['options']);return _0x24afe8[_0x53c0('0x58')](_0x4d11af);}})[_0x53c0('0x19')](function(_0x287709){if(_0x287709){_0x38f1b6=_0x287709['length'];if(!_0x1268c2['query']['hasOwnProperty'](_0x53c0('0x56'))){_0x4d11af[_0x53c0('0x41')]=qs[_0x53c0('0x41')](_0x1268c2[_0x53c0('0x3a')][_0x53c0('0x41')]);_0x4d11af['offset']=qs[_0x53c0('0x29')](_0x1268c2[_0x53c0('0x3a')][_0x53c0('0x29')]);}return _0x24afe8[_0x53c0('0x58')](_0x4d11af);}})['then'](function(_0x358c95){if(_0x358c95){return _0x358c95?{'count':_0x38f1b6,'rows':_0x358c95}:null;}})[_0x53c0('0x19')](respondWithResult(_0x974288,null))[_0x53c0('0x24')](handleError(_0x974288,null));};exports[_0x53c0('0x59')]=function(_0x52cdca,_0x51d068,_0x30644f){var _0x202e59={};var _0x1da329={};var _0x31f1bf;var _0x4e7dc2;return db['DeskConfiguration'][_0x53c0('0x51')]({'where':{'id':_0x52cdca[_0x53c0('0x4a')]['id']}})[_0x53c0('0x19')](handleEntityNotFound(_0x51d068,null))[_0x53c0('0x19')](function(_0x35ff10){if(_0x35ff10){_0x31f1bf=_0x35ff10;_0x1da329['model']=_[_0x53c0('0x3b')](db[_0x53c0('0x5a')][_0x53c0('0x4b')]);_0x1da329['query']=_[_0x53c0('0x3b')](_0x52cdca[_0x53c0('0x3a')]);_0x1da329['filters']=_[_0x53c0('0x3d')](_0x1da329[_0x53c0('0x39')],_0x1da329[_0x53c0('0x3a')]);_0x202e59[_0x53c0('0x3e')]=_[_0x53c0('0x3d')](_0x1da329[_0x53c0('0x39')],qs[_0x53c0('0x3f')](_0x52cdca[_0x53c0('0x3a')]['fields']));_0x202e59['attributes']=_0x202e59[_0x53c0('0x3e')][_0x53c0('0x53')]?_0x202e59[_0x53c0('0x3e')]:_0x1da329['model'];_0x202e59['order']=qs['sort'](_0x52cdca['query'][_0x53c0('0x42')]);_0x202e59['where']=qs[_0x53c0('0x3c')](_['pick'](_0x52cdca[_0x53c0('0x3a')],_0x1da329[_0x53c0('0x3c')]));if(_0x52cdca[_0x53c0('0x3a')][_0x53c0('0x55')]){_0x202e59[_0x53c0('0x44')]=_[_0x53c0('0x45')](_0x202e59[_0x53c0('0x44')],{'$or':_['map'](_0x202e59['attributes'],function(_0x43012d){var _0x2117c1={};_0x2117c1[_0x43012d]={'$like':'%'+_0x52cdca['query']['filter']+'%'};return _0x2117c1;})});}_0x202e59=_[_0x53c0('0x45')]({},_0x202e59,_0x52cdca['options']);return _0x31f1bf[_0x53c0('0x59')](_0x202e59);}})[_0x53c0('0x19')](function(_0x233226){if(_0x233226){_0x4e7dc2=_0x233226[_0x53c0('0x53')];if(!_0x52cdca[_0x53c0('0x3a')][_0x53c0('0x40')](_0x53c0('0x56'))){_0x202e59[_0x53c0('0x41')]=qs[_0x53c0('0x41')](_0x52cdca[_0x53c0('0x3a')][_0x53c0('0x41')]);_0x202e59[_0x53c0('0x29')]=qs[_0x53c0('0x29')](_0x52cdca[_0x53c0('0x3a')][_0x53c0('0x29')]);}return _0x31f1bf[_0x53c0('0x59')](_0x202e59);}})[_0x53c0('0x19')](function(_0x4a6df8){if(_0x4a6df8){return _0x4a6df8?{'count':_0x4e7dc2,'rows':_0x4a6df8}:null;}})[_0x53c0('0x19')](respondWithResult(_0x51d068,null))[_0x53c0('0x24')](handleError(_0x51d068,null));};exports[_0x53c0('0x5b')]=function(_0x5399a3,_0xe1da93,_0xb35648){if(_0x5399a3['body']['id']){delete _0x5399a3[_0x53c0('0x4f')]['id'];}return db[_0x53c0('0x35')][_0x53c0('0x51')]({'where':{'id':_0x5399a3[_0x53c0('0x4a')]['id']}})[_0x53c0('0x19')](handleEntityNotFound(_0xe1da93,null))[_0x53c0('0x19')](function(_0x4014ed){if(_0x4014ed){return _0x4014ed[_0x53c0('0x5b')](_0x5399a3[_0x53c0('0x4f')][_0x53c0('0x5c')]||[]);}return null;})['then'](respondWithResult(_0xe1da93,null))['catch'](handleError(_0xe1da93,null));}; \ No newline at end of file +var _0x7623=['index','map','DeskConfiguration','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','params','rawAttributes','includeAll','find','create','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7623,0x13e));var _0x3762=function(_0xba96b0,_0x36e8f8){_0xba96b0=_0xba96b0-0x0;var _0xdad969=_0x7623[_0xba96b0];return _0xdad969;};'use strict';var pdf=require(_0x3762('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3762('0x1'));var zipdir=require(_0x3762('0x2'));var jsonpatch=require(_0x3762('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3762('0x4'));var Mustache=require(_0x3762('0x5'));var util=require(_0x3762('0x6'));var path=require(_0x3762('0x7'));var sox=require(_0x3762('0x8'));var csv=require(_0x3762('0x9'));var ejs=require(_0x3762('0xa'));var fs=require('fs');var _=require(_0x3762('0xb'));var squel=require(_0x3762('0xc'));var crypto=require('crypto');var jsforce=require(_0x3762('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3762('0x9'));var querystring=require(_0x3762('0xe'));var Papa=require(_0x3762('0xf'));var Redis=require(_0x3762('0x10'));var authService=require(_0x3762('0x11'));var qs=require(_0x3762('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3762('0x13'))(_0x3762('0x14'));var utils=require('../../config/utils');var config=require(_0x3762('0x15'));var licenseUtil=require(_0x3762('0x16'));var db=require(_0x3762('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3762('0x18')][_0x3762('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x7949ce,_0x536ed3,_0x25065f,_0x5d7560){return new BPromise(function(_0x3c73f7,_0x4e3017){var _0x207ad0=_0x5d7560||client;return _0x207ad0['request'](_0x7949ce,_0x25065f)[_0x3762('0x1a')](function(_0x195816){logger[_0x3762('0x1b')](_0x3762('0x1c'),_0x536ed3,_0x3762('0x1d'));logger[_0x3762('0x1e')](_0x3762('0x1f'),_0x536ed3,'request\x20sent',JSON[_0x3762('0x20')](_0x195816));if(_0x195816[_0x3762('0x21')]){if(_0x195816[_0x3762('0x21')][_0x3762('0x22')]===0x1f4){logger[_0x3762('0x21')](_0x3762('0x1c'),_0x536ed3,_0x195816[_0x3762('0x21')][_0x3762('0x23')]);return _0x4e3017(_0x195816[_0x3762('0x21')][_0x3762('0x23')]);}logger['error'](_0x3762('0x1c'),_0x536ed3,_0x195816['error'][_0x3762('0x23')]);return _0x3c73f7(_0x195816[_0x3762('0x21')][_0x3762('0x23')]);}else{logger['info'](_0x3762('0x1c'),_0x536ed3,_0x3762('0x1d'));_0x3c73f7(_0x195816[_0x3762('0x24')][_0x3762('0x23')]);}})[_0x3762('0x25')](function(_0x485cdd){logger[_0x3762('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x536ed3,_0x485cdd);_0x4e3017(_0x485cdd);});});}function respondWithStatusCode(_0x49e39c,_0x30c264){_0x30c264=_0x30c264||0xcc;return function(_0x4ea37f){if(_0x4ea37f){return _0x49e39c['sendStatus'](_0x30c264);}return _0x49e39c[_0x3762('0x26')](_0x30c264)[_0x3762('0x27')]();};}function respondWithResult(_0x256b18,_0x12e3d8){_0x12e3d8=_0x12e3d8||0xc8;return function(_0x407c81){if(_0x407c81){return _0x256b18[_0x3762('0x26')](_0x12e3d8)['json'](_0x407c81);}};}function respondWithFilteredResult(_0x1d6ffd,_0x58b8f8){return function(_0x2d5c10){if(_0x2d5c10){var _0x40e0bd=_0x2d5c10[_0x3762('0x28')],_0x5ecdae=_0x58b8f8[_0x3762('0x29')],_0x59b14d=_0x58b8f8[_0x3762('0x29')]+_0x58b8f8['limit'],_0x246331;if(_0x59b14d>=_0x40e0bd){_0x59b14d=_0x40e0bd;_0x246331=0xc8;}else{_0x246331=0xce;}_0x1d6ffd['status'](_0x246331);return _0x1d6ffd[_0x3762('0x2a')](_0x3762('0x2b'),_0x5ecdae+'-'+_0x59b14d+'/'+_0x40e0bd)[_0x3762('0x2c')](_0x2d5c10);}return null;};}function patchUpdates(_0x292643){return function(_0x536daf){try{jsonpatch[_0x3762('0x2d')](_0x536daf,_0x292643,!![]);}catch(_0x416e36){return BPromise[_0x3762('0x2e')](_0x416e36);}return _0x536daf[_0x3762('0x2f')]();};}function saveUpdates(_0x1c2bef,_0x40efa2){return function(_0x58adcd){if(_0x58adcd){return _0x58adcd[_0x3762('0x30')](_0x1c2bef)[_0x3762('0x1a')](function(_0x1603fb){return _0x1603fb;});}return null;};}function removeEntity(_0x11c321,_0x294029){return function(_0x414d05){if(_0x414d05){return _0x414d05[_0x3762('0x31')]()['then'](function(){_0x11c321[_0x3762('0x26')](0xcc)[_0x3762('0x27')]();});}};}function handleEntityNotFound(_0x28f1d7,_0x2153bf){return function(_0x25215f){if(!_0x25215f){_0x28f1d7[_0x3762('0x32')](0x194);}return _0x25215f;};}function handleError(_0x2dfa60,_0x5ef305){_0x5ef305=_0x5ef305||0x1f4;return function(_0x132d55){logger['error'](_0x132d55[_0x3762('0x33')]);if(_0x132d55[_0x3762('0x34')]){delete _0x132d55[_0x3762('0x34')];}_0x2dfa60[_0x3762('0x26')](_0x5ef305)[_0x3762('0x35')](_0x132d55);};}exports[_0x3762('0x36')]=function(_0x53df71,_0x2a5a4a){var _0x28c6c6={},_0x4daf90={},_0x3d5537={'count':0x0,'rows':[]};var _0x1c86ea=_[_0x3762('0x37')](db[_0x3762('0x38')]['rawAttributes'],function(_0x13bea7){return{'name':_0x13bea7['fieldName'],'type':_0x13bea7[_0x3762('0x39')][_0x3762('0x3a')]};});_0x4daf90[_0x3762('0x3b')]=_[_0x3762('0x37')](_0x1c86ea,_0x3762('0x34'));_0x4daf90[_0x3762('0x3c')]=_[_0x3762('0x3d')](_0x53df71[_0x3762('0x3c')]);_0x4daf90['filters']=_[_0x3762('0x3e')](_0x4daf90['model'],_0x4daf90[_0x3762('0x3c')]);_0x28c6c6[_0x3762('0x3f')]=_[_0x3762('0x3e')](_0x4daf90[_0x3762('0x3b')],qs['fields'](_0x53df71['query'][_0x3762('0x40')]));_0x28c6c6[_0x3762('0x3f')]=_0x28c6c6[_0x3762('0x3f')][_0x3762('0x41')]?_0x28c6c6['attributes']:_0x4daf90['model'];if(!_0x53df71[_0x3762('0x3c')][_0x3762('0x42')](_0x3762('0x43'))){_0x28c6c6[_0x3762('0x44')]=qs[_0x3762('0x44')](_0x53df71[_0x3762('0x3c')][_0x3762('0x44')]);_0x28c6c6[_0x3762('0x29')]=qs[_0x3762('0x29')](_0x53df71[_0x3762('0x3c')][_0x3762('0x29')]);}_0x28c6c6[_0x3762('0x45')]=qs[_0x3762('0x46')](_0x53df71[_0x3762('0x3c')][_0x3762('0x46')]);_0x28c6c6['where']=qs[_0x3762('0x47')](_['pick'](_0x53df71['query'],_0x4daf90[_0x3762('0x47')]),_0x1c86ea);if(_0x53df71['query'][_0x3762('0x48')]){_0x28c6c6[_0x3762('0x49')]=_[_0x3762('0x4a')](_0x28c6c6[_0x3762('0x49')],{'$or':_[_0x3762('0x37')](_0x1c86ea,function(_0x2a09a1){if(_0x2a09a1['type']!==_0x3762('0x4b')){var _0x17423e={};_0x17423e[_0x2a09a1[_0x3762('0x34')]]={'$like':'%'+_0x53df71[_0x3762('0x3c')]['filter']+'%'};return _0x17423e;}})});}_0x28c6c6=_[_0x3762('0x4a')]({},_0x28c6c6,_0x53df71[_0x3762('0x4c')]);var _0x342a45={'where':_0x28c6c6[_0x3762('0x49')]};return db[_0x3762('0x38')]['count'](_0x342a45)[_0x3762('0x1a')](function(_0x34c8a3){_0x3d5537[_0x3762('0x28')]=_0x34c8a3;if(_0x53df71[_0x3762('0x3c')]['includeAll']){_0x28c6c6[_0x3762('0x4d')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x28c6c6);})[_0x3762('0x1a')](function(_0x14e77a){_0x3d5537['rows']=_0x14e77a;return _0x3d5537;})[_0x3762('0x1a')](respondWithFilteredResult(_0x2a5a4a,_0x28c6c6))[_0x3762('0x25')](handleError(_0x2a5a4a,null));};exports['show']=function(_0x69b034,_0x48638c){var _0x45c97c={'raw':![],'where':{'id':_0x69b034[_0x3762('0x4e')]['id']}},_0x57ad01={};_0x57ad01[_0x3762('0x3b')]=_[_0x3762('0x3d')](db['DeskConfiguration'][_0x3762('0x4f')]);_0x57ad01['query']=_[_0x3762('0x3d')](_0x69b034[_0x3762('0x3c')]);_0x57ad01['filters']=_[_0x3762('0x3e')](_0x57ad01['model'],_0x57ad01['query']);_0x45c97c[_0x3762('0x3f')]=_['intersection'](_0x57ad01[_0x3762('0x3b')],qs[_0x3762('0x40')](_0x69b034[_0x3762('0x3c')]['fields']));_0x45c97c[_0x3762('0x3f')]=_0x45c97c[_0x3762('0x3f')]['length']?_0x45c97c[_0x3762('0x3f')]:_0x57ad01[_0x3762('0x3b')];if(_0x69b034[_0x3762('0x3c')][_0x3762('0x50')]){_0x45c97c[_0x3762('0x4d')]=[{'all':!![]}];}_0x45c97c=_['merge']({},_0x45c97c,_0x69b034['options']);return db['DeskConfiguration'][_0x3762('0x51')](_0x45c97c)[_0x3762('0x1a')](handleEntityNotFound(_0x48638c,null))['then'](respondWithResult(_0x48638c,null))[_0x3762('0x25')](handleError(_0x48638c,null));};exports['create']=function(_0x1cd942,_0x409e2f){return db['DeskConfiguration'][_0x3762('0x52')](_0x1cd942[_0x3762('0x53')],{})[_0x3762('0x1a')](respondWithResult(_0x409e2f,0xc9))[_0x3762('0x25')](handleError(_0x409e2f,null));};exports[_0x3762('0x30')]=function(_0x292b18,_0x3614d0){if(_0x292b18[_0x3762('0x53')]['id']){delete _0x292b18[_0x3762('0x53')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x292b18[_0x3762('0x4e')]['id']}})[_0x3762('0x1a')](handleEntityNotFound(_0x3614d0,null))['then'](saveUpdates(_0x292b18[_0x3762('0x53')],null))[_0x3762('0x1a')](respondWithResult(_0x3614d0,null))[_0x3762('0x25')](handleError(_0x3614d0,null));};exports[_0x3762('0x31')]=function(_0x38defe,_0x2c9762){return db['DeskConfiguration'][_0x3762('0x51')]({'where':{'id':_0x38defe[_0x3762('0x4e')]['id']}})[_0x3762('0x1a')](handleEntityNotFound(_0x2c9762,null))[_0x3762('0x1a')](removeEntity(_0x2c9762,null))['catch'](handleError(_0x2c9762,null));};exports[_0x3762('0x54')]=function(_0x1f365c,_0x20b2bc,_0x558cb8){var _0x56639d={};var _0x76bc48={};var _0x98df5e;var _0x2788dd;return db[_0x3762('0x38')][_0x3762('0x55')]({'where':{'id':_0x1f365c['params']['id']}})[_0x3762('0x1a')](handleEntityNotFound(_0x20b2bc,null))[_0x3762('0x1a')](function(_0x70824c){if(_0x70824c){_0x98df5e=_0x70824c;_0x76bc48[_0x3762('0x3b')]=_['keys'](db[_0x3762('0x56')]['rawAttributes']);_0x76bc48[_0x3762('0x3c')]=_[_0x3762('0x3d')](_0x1f365c[_0x3762('0x3c')]);_0x76bc48[_0x3762('0x47')]=_['intersection'](_0x76bc48[_0x3762('0x3b')],_0x76bc48['query']);_0x56639d['attributes']=_[_0x3762('0x3e')](_0x76bc48[_0x3762('0x3b')],qs[_0x3762('0x40')](_0x1f365c['query'][_0x3762('0x40')]));_0x56639d['attributes']=_0x56639d[_0x3762('0x3f')][_0x3762('0x41')]?_0x56639d[_0x3762('0x3f')]:_0x76bc48[_0x3762('0x3b')];_0x56639d[_0x3762('0x45')]=qs[_0x3762('0x46')](_0x1f365c[_0x3762('0x3c')]['sort']);_0x56639d[_0x3762('0x49')]=qs[_0x3762('0x47')](_[_0x3762('0x57')](_0x1f365c[_0x3762('0x3c')],_0x76bc48[_0x3762('0x47')]));if(_0x1f365c['query'][_0x3762('0x48')]){_0x56639d['where']=_[_0x3762('0x4a')](_0x56639d[_0x3762('0x49')],{'$or':_[_0x3762('0x37')](_0x56639d[_0x3762('0x3f')],function(_0x81b031){var _0x3be5bf={};_0x3be5bf[_0x81b031]={'$like':'%'+_0x1f365c[_0x3762('0x3c')][_0x3762('0x48')]+'%'};return _0x3be5bf;})});}_0x56639d=_[_0x3762('0x4a')]({},_0x56639d,_0x1f365c[_0x3762('0x4c')]);return _0x98df5e[_0x3762('0x54')](_0x56639d);}})[_0x3762('0x1a')](function(_0xfd44b2){if(_0xfd44b2){_0x2788dd=_0xfd44b2[_0x3762('0x41')];if(!_0x1f365c[_0x3762('0x3c')]['hasOwnProperty'](_0x3762('0x43'))){_0x56639d['limit']=qs[_0x3762('0x44')](_0x1f365c['query'][_0x3762('0x44')]);_0x56639d['offset']=qs[_0x3762('0x29')](_0x1f365c[_0x3762('0x3c')][_0x3762('0x29')]);}return _0x98df5e[_0x3762('0x54')](_0x56639d);}})[_0x3762('0x1a')](function(_0x3fa557){if(_0x3fa557){return _0x3fa557?{'count':_0x2788dd,'rows':_0x3fa557}:null;}})[_0x3762('0x1a')](respondWithResult(_0x20b2bc,null))['catch'](handleError(_0x20b2bc,null));};exports[_0x3762('0x58')]=function(_0x405e1b,_0x1caf8c,_0x2222c5){var _0x8be134={};var _0x4b2071={};var _0x473417;var _0x3c2c6c;return db[_0x3762('0x38')]['findOne']({'where':{'id':_0x405e1b['params']['id']}})[_0x3762('0x1a')](handleEntityNotFound(_0x1caf8c,null))[_0x3762('0x1a')](function(_0xc0f3fd){if(_0xc0f3fd){_0x473417=_0xc0f3fd;_0x4b2071[_0x3762('0x3b')]=_['keys'](db[_0x3762('0x56')][_0x3762('0x4f')]);_0x4b2071[_0x3762('0x3c')]=_[_0x3762('0x3d')](_0x405e1b[_0x3762('0x3c')]);_0x4b2071['filters']=_[_0x3762('0x3e')](_0x4b2071['model'],_0x4b2071[_0x3762('0x3c')]);_0x8be134[_0x3762('0x3f')]=_['intersection'](_0x4b2071[_0x3762('0x3b')],qs[_0x3762('0x40')](_0x405e1b['query'][_0x3762('0x40')]));_0x8be134[_0x3762('0x3f')]=_0x8be134[_0x3762('0x3f')][_0x3762('0x41')]?_0x8be134[_0x3762('0x3f')]:_0x4b2071['model'];_0x8be134[_0x3762('0x45')]=qs[_0x3762('0x46')](_0x405e1b[_0x3762('0x3c')]['sort']);_0x8be134['where']=qs['filters'](_[_0x3762('0x57')](_0x405e1b['query'],_0x4b2071['filters']));if(_0x405e1b[_0x3762('0x3c')][_0x3762('0x48')]){_0x8be134['where']=_[_0x3762('0x4a')](_0x8be134[_0x3762('0x49')],{'$or':_['map'](_0x8be134[_0x3762('0x3f')],function(_0x39038d){var _0x38dd83={};_0x38dd83[_0x39038d]={'$like':'%'+_0x405e1b[_0x3762('0x3c')][_0x3762('0x48')]+'%'};return _0x38dd83;})});}_0x8be134=_['merge']({},_0x8be134,_0x405e1b[_0x3762('0x4c')]);return _0x473417['getSubjects'](_0x8be134);}})[_0x3762('0x1a')](function(_0x58e174){if(_0x58e174){_0x3c2c6c=_0x58e174[_0x3762('0x41')];if(!_0x405e1b[_0x3762('0x3c')][_0x3762('0x42')](_0x3762('0x43'))){_0x8be134[_0x3762('0x44')]=qs[_0x3762('0x44')](_0x405e1b[_0x3762('0x3c')][_0x3762('0x44')]);_0x8be134[_0x3762('0x29')]=qs[_0x3762('0x29')](_0x405e1b[_0x3762('0x3c')]['offset']);}return _0x473417[_0x3762('0x58')](_0x8be134);}})[_0x3762('0x1a')](function(_0x335b6b){if(_0x335b6b){return _0x335b6b?{'count':_0x3c2c6c,'rows':_0x335b6b}:null;}})[_0x3762('0x1a')](respondWithResult(_0x1caf8c,null))[_0x3762('0x25')](handleError(_0x1caf8c,null));};exports[_0x3762('0x59')]=function(_0x48ac8d,_0x112178,_0x128b6e){var _0x9bed22={};var _0x3dcb2a={};var _0x343559;var _0xadd0c9;return db[_0x3762('0x38')][_0x3762('0x55')]({'where':{'id':_0x48ac8d[_0x3762('0x4e')]['id']}})['then'](handleEntityNotFound(_0x112178,null))[_0x3762('0x1a')](function(_0x517b03){if(_0x517b03){_0x343559=_0x517b03;_0x3dcb2a[_0x3762('0x3b')]=_[_0x3762('0x3d')](db[_0x3762('0x56')][_0x3762('0x4f')]);_0x3dcb2a[_0x3762('0x3c')]=_['keys'](_0x48ac8d[_0x3762('0x3c')]);_0x3dcb2a['filters']=_[_0x3762('0x3e')](_0x3dcb2a[_0x3762('0x3b')],_0x3dcb2a[_0x3762('0x3c')]);_0x9bed22['attributes']=_[_0x3762('0x3e')](_0x3dcb2a[_0x3762('0x3b')],qs[_0x3762('0x40')](_0x48ac8d[_0x3762('0x3c')][_0x3762('0x40')]));_0x9bed22[_0x3762('0x3f')]=_0x9bed22[_0x3762('0x3f')][_0x3762('0x41')]?_0x9bed22[_0x3762('0x3f')]:_0x3dcb2a[_0x3762('0x3b')];_0x9bed22[_0x3762('0x45')]=qs[_0x3762('0x46')](_0x48ac8d['query']['sort']);_0x9bed22[_0x3762('0x49')]=qs[_0x3762('0x47')](_[_0x3762('0x57')](_0x48ac8d[_0x3762('0x3c')],_0x3dcb2a['filters']));if(_0x48ac8d[_0x3762('0x3c')][_0x3762('0x48')]){_0x9bed22['where']=_[_0x3762('0x4a')](_0x9bed22['where'],{'$or':_[_0x3762('0x37')](_0x9bed22[_0x3762('0x3f')],function(_0x52be0c){var _0x354559={};_0x354559[_0x52be0c]={'$like':'%'+_0x48ac8d['query'][_0x3762('0x48')]+'%'};return _0x354559;})});}_0x9bed22=_['merge']({},_0x9bed22,_0x48ac8d[_0x3762('0x4c')]);return _0x343559['getDescriptions'](_0x9bed22);}})[_0x3762('0x1a')](function(_0x336276){if(_0x336276){_0xadd0c9=_0x336276['length'];if(!_0x48ac8d['query']['hasOwnProperty'](_0x3762('0x43'))){_0x9bed22[_0x3762('0x44')]=qs[_0x3762('0x44')](_0x48ac8d[_0x3762('0x3c')][_0x3762('0x44')]);_0x9bed22[_0x3762('0x29')]=qs['offset'](_0x48ac8d[_0x3762('0x3c')]['offset']);}return _0x343559[_0x3762('0x59')](_0x9bed22);}})['then'](function(_0x264257){if(_0x264257){return _0x264257?{'count':_0xadd0c9,'rows':_0x264257}:null;}})[_0x3762('0x1a')](respondWithResult(_0x112178,null))[_0x3762('0x25')](handleError(_0x112178,null));};exports[_0x3762('0x5a')]=function(_0x4e38fe,_0x55153f,_0x1f7541){var _0x36ea66={};var _0x1e6b8d={};var _0x75dd67;var _0x36b5c0;return db[_0x3762('0x38')]['findOne']({'where':{'id':_0x4e38fe[_0x3762('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55153f,null))[_0x3762('0x1a')](function(_0x1d68bb){if(_0x1d68bb){_0x75dd67=_0x1d68bb;_0x1e6b8d['model']=_[_0x3762('0x3d')](db['Tag'][_0x3762('0x4f')]);_0x1e6b8d['query']=_[_0x3762('0x3d')](_0x4e38fe[_0x3762('0x3c')]);_0x1e6b8d[_0x3762('0x47')]=_[_0x3762('0x3e')](_0x1e6b8d[_0x3762('0x3b')],_0x1e6b8d[_0x3762('0x3c')]);_0x36ea66[_0x3762('0x3f')]=_[_0x3762('0x3e')](_0x1e6b8d[_0x3762('0x3b')],qs[_0x3762('0x40')](_0x4e38fe[_0x3762('0x3c')][_0x3762('0x40')]));_0x36ea66[_0x3762('0x3f')]=_0x36ea66[_0x3762('0x3f')][_0x3762('0x41')]?_0x36ea66[_0x3762('0x3f')]:_0x1e6b8d['model'];_0x36ea66['order']=qs['sort'](_0x4e38fe[_0x3762('0x3c')][_0x3762('0x46')]);_0x36ea66[_0x3762('0x49')]=qs['filters'](_[_0x3762('0x57')](_0x4e38fe['query'],_0x1e6b8d[_0x3762('0x47')]));if(_0x4e38fe[_0x3762('0x3c')][_0x3762('0x48')]){_0x36ea66['where']=_[_0x3762('0x4a')](_0x36ea66[_0x3762('0x49')],{'$or':_[_0x3762('0x37')](_0x36ea66['attributes'],function(_0x4f4d54){var _0x26dc99={};_0x26dc99[_0x4f4d54]={'$like':'%'+_0x4e38fe[_0x3762('0x3c')][_0x3762('0x48')]+'%'};return _0x26dc99;})});}_0x36ea66=_['merge']({},_0x36ea66,_0x4e38fe[_0x3762('0x4c')]);return _0x75dd67[_0x3762('0x5a')](_0x36ea66);}})[_0x3762('0x1a')](function(_0x1c93f5){if(_0x1c93f5){_0x36b5c0=_0x1c93f5[_0x3762('0x41')];if(!_0x4e38fe[_0x3762('0x3c')][_0x3762('0x42')]('nolimit')){_0x36ea66[_0x3762('0x44')]=qs[_0x3762('0x44')](_0x4e38fe[_0x3762('0x3c')][_0x3762('0x44')]);_0x36ea66[_0x3762('0x29')]=qs['offset'](_0x4e38fe[_0x3762('0x3c')][_0x3762('0x29')]);}return _0x75dd67[_0x3762('0x5a')](_0x36ea66);}})[_0x3762('0x1a')](function(_0x21b931){if(_0x21b931){return _0x21b931?{'count':_0x36b5c0,'rows':_0x21b931}:null;}})['then'](respondWithResult(_0x55153f,null))[_0x3762('0x25')](handleError(_0x55153f,null));};exports['setTags']=function(_0x3d5824,_0x43d9c2,_0x2841f8){if(_0x3d5824['body']['id']){delete _0x3d5824[_0x3762('0x53')]['id'];}return db['DeskConfiguration'][_0x3762('0x55')]({'where':{'id':_0x3d5824[_0x3762('0x4e')]['id']}})[_0x3762('0x1a')](handleEntityNotFound(_0x43d9c2,null))[_0x3762('0x1a')](function(_0x140ca8){if(_0x140ca8){return _0x140ca8[_0x3762('0x5b')](_0x3d5824['body'][_0x3762('0x5c')]||[]);}return null;})[_0x3762('0x1a')](respondWithResult(_0x43d9c2,null))['catch'](handleError(_0x43d9c2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 41dd5b6..6d4c207 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 _0xc863=['lodash','util','api','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x54d581,_0x2b61f3){var _0x344aea=function(_0x2d997c){while(--_0x2d997c){_0x54d581['push'](_0x54d581['shift']());}};_0x344aea(++_0x2b61f3);}(_0xc863,0x134));var _0x3c86=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xc863[_0x3b150c];return _0x5cd414;};'use strict';var _=require(_0x3c86('0x0'));var util=require(_0x3c86('0x1'));var logger=require('../../config/logger')(_0x3c86('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3c86('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c86('0x4'));var config=require(_0x3c86('0x5'));var attributes=require(_0x3c86('0x6'));module[_0x3c86('0x7')]=function(_0x1177a8,_0x1808c5){return _0x1177a8[_0x3c86('0x8')](_0x3c86('0x9'),attributes,{'tableName':_0x3c86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7df=['./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','moment','bluebird','rimraf','../../config/environment'];(function(_0x431f3c,_0xfcc082){var _0x30f66a=function(_0x314069){while(--_0x314069){_0x431f3c['push'](_0x431f3c['shift']());}};_0x30f66a(++_0xfcc082);}(_0xf7df,0x187));var _0xff7d=function(_0x4fde2d,_0x5ea945){_0x4fde2d=_0x4fde2d-0x0;var _0x30b2eb=_0xf7df[_0x4fde2d];return _0x30b2eb;};'use strict';var _=require(_0xff7d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xff7d('0x1'));var BPromise=require(_0xff7d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff7d('0x3'));var config=require(_0xff7d('0x4'));var attributes=require(_0xff7d('0x5'));module['exports']=function(_0x573c6f,_0xa9bc){return _0x573c6f[_0xff7d('0x6')](_0xff7d('0x7'),attributes,{'tableName':_0xff7d('0x8'),'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 77f59ad..f01b188 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 _0x4f88=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x56236d,_0x1ac665){var _0x365fce=function(_0x3e3eec){while(--_0x3e3eec){_0x56236d['push'](_0x56236d['shift']());}};_0x365fce(++_0x1ac665);}(_0x4f88,0xf3));var _0x84f8=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x4f88[_0x26e727];return _0x563800;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var moment=require('moment');var BPromise=require(_0x84f8('0x2'));var rs=require(_0x84f8('0x3'));var fs=require('fs');var Redis=require(_0x84f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x84f8('0x5'))(_0x84f8('0x6'));var config=require(_0x84f8('0x7'));var jayson=require(_0x84f8('0x8'));var client=jayson[_0x84f8('0x9')][_0x84f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa345,_0x11747c,_0x40e5f3){return new BPromise(function(_0x4ae430,_0x4a09d3){return client[_0x84f8('0xb')](_0x5aa345,_0x40e5f3)[_0x84f8('0xc')](function(_0x432edd){logger[_0x84f8('0xd')](_0x84f8('0xe'),_0x11747c,_0x84f8('0xf'));logger[_0x84f8('0x10')](_0x84f8('0x11'),_0x11747c,'request\x20sent',JSON['stringify'](_0x432edd));if(_0x432edd[_0x84f8('0x12')]){if(_0x432edd[_0x84f8('0x12')][_0x84f8('0x13')]===0x1f4){logger[_0x84f8('0x12')](_0x84f8('0xe'),_0x11747c,_0x432edd['error'][_0x84f8('0x14')]);return _0x4a09d3(_0x432edd[_0x84f8('0x12')][_0x84f8('0x14')]);}logger[_0x84f8('0x12')](_0x84f8('0xe'),_0x11747c,_0x432edd['error'][_0x84f8('0x14')]);return _0x4ae430(_0x432edd[_0x84f8('0x12')][_0x84f8('0x14')]);}else{logger[_0x84f8('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x11747c,_0x84f8('0xf'));_0x4ae430(_0x432edd['result'][_0x84f8('0x14')]);}})[_0x84f8('0x15')](function(_0x1eba7e){logger['error'](_0x84f8('0xe'),_0x11747c,_0x1eba7e);_0x4a09d3(_0x1eba7e);});});} \ No newline at end of file +var _0x1948=['client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56eb65,_0x2183e2){var _0x71e63=function(_0x3126d1){while(--_0x3126d1){_0x56eb65['push'](_0x56eb65['shift']());}};_0x71e63(++_0x2183e2);}(_0x1948,0x145));var _0x8194=function(_0x5b5340,_0x3bedab){_0x5b5340=_0x5b5340-0x0;var _0x4039ed=_0x1948[_0x5b5340];return _0x4039ed;};'use strict';var _=require(_0x8194('0x0'));var util=require(_0x8194('0x1'));var moment=require(_0x8194('0x2'));var BPromise=require(_0x8194('0x3'));var rs=require(_0x8194('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8194('0x5'))['db'];var utils=require(_0x8194('0x6'));var logger=require(_0x8194('0x7'))(_0x8194('0x8'));var config=require(_0x8194('0x9'));var jayson=require(_0x8194('0xa'));var client=jayson[_0x8194('0xb')][_0x8194('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x521ed0,_0x1e4b32,_0x104856){return new BPromise(function(_0x4f32ce,_0xeeaa84){return client[_0x8194('0xd')](_0x521ed0,_0x104856)['then'](function(_0x4ffc45){logger[_0x8194('0xe')](_0x8194('0xf'),_0x1e4b32,_0x8194('0x10'));logger[_0x8194('0x11')](_0x8194('0x12'),_0x1e4b32,'request\x20sent',JSON[_0x8194('0x13')](_0x4ffc45));if(_0x4ffc45[_0x8194('0x14')]){if(_0x4ffc45[_0x8194('0x14')]['code']===0x1f4){logger[_0x8194('0x14')](_0x8194('0xf'),_0x1e4b32,_0x4ffc45[_0x8194('0x14')][_0x8194('0x15')]);return _0xeeaa84(_0x4ffc45[_0x8194('0x14')][_0x8194('0x15')]);}logger['error'](_0x8194('0xf'),_0x1e4b32,_0x4ffc45[_0x8194('0x14')][_0x8194('0x15')]);return _0x4f32ce(_0x4ffc45[_0x8194('0x14')][_0x8194('0x15')]);}else{logger[_0x8194('0xe')](_0x8194('0xf'),_0x1e4b32,_0x8194('0x10'));_0x4f32ce(_0x4ffc45[_0x8194('0x16')]['message']);}})[_0x8194('0x17')](function(_0x31adc2){logger['error'](_0x8194('0xf'),_0x1e4b32,_0x31adc2);_0xeeaa84(_0x31adc2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7b79e1d..5efd54d 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 _0x3bcc=['isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x3bcc,0x99));var _0xc3bc=function(_0x156bec,_0x35de59){_0x156bec=_0x156bec-0x0;var _0x1c2934=_0x3bcc[_0x156bec];return _0x1c2934;};'use strict';var multer=require('multer');var util=require(_0xc3bc('0x0'));var path=require(_0xc3bc('0x1'));var timeout=require(_0xc3bc('0x2'));var express=require(_0xc3bc('0x3'));var router=express[_0xc3bc('0x4')]();var auth=require(_0xc3bc('0x5'));var interaction=require(_0xc3bc('0x6'));var config=require(_0xc3bc('0x7'));var controller=require(_0xc3bc('0x8'));router['get']('/',auth[_0xc3bc('0x9')](),controller[_0xc3bc('0xa')]);router['get'](_0xc3bc('0xb'),auth[_0xc3bc('0x9')](),controller[_0xc3bc('0xc')]);router[_0xc3bc('0xd')]('/',auth[_0xc3bc('0x9')](),controller['create']);router[_0xc3bc('0xe')](_0xc3bc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc3bc('0xf')](_0xc3bc('0xb'),auth[_0xc3bc('0x9')](),controller[_0xc3bc('0x10')]);module[_0xc3bc('0x11')]=router; \ No newline at end of file +var _0xdab1=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xdab1,0x1d3));var _0x1dab=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdab1[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x1dab('0x0'));var util=require(_0x1dab('0x1'));var path=require(_0x1dab('0x2'));var timeout=require(_0x1dab('0x3'));var express=require(_0x1dab('0x4'));var router=express[_0x1dab('0x5')]();var auth=require(_0x1dab('0x6'));var interaction=require(_0x1dab('0x7'));var config=require(_0x1dab('0x8'));var controller=require(_0x1dab('0x9'));router[_0x1dab('0xa')]('/',auth[_0x1dab('0xb')](),controller[_0x1dab('0xc')]);router[_0x1dab('0xa')](_0x1dab('0xd'),auth[_0x1dab('0xb')](),controller[_0x1dab('0xe')]);router[_0x1dab('0xf')]('/',auth[_0x1dab('0xb')](),controller[_0x1dab('0x10')]);router[_0x1dab('0x11')](_0x1dab('0xd'),auth[_0x1dab('0xb')](),controller[_0x1dab('0x12')]);router[_0x1dab('0x13')](_0x1dab('0xd'),auth[_0x1dab('0xb')](),controller[_0x1dab('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ee0f535..c59b533 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 _0x7c5e=['string','STRING','ENUM','variable','exports','customVariable','keyValue'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7c5e,0x12a));var _0xe7c5=function(_0x3735c1,_0x4932c0){_0x3735c1=_0x3735c1-0x0;var _0x4ef5fd=_0x7c5e[_0x3735c1];return _0x4ef5fd;};'use strict';var Sequelize=require('sequelize');module[_0xe7c5('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xe7c5('0x1'),_0xe7c5('0x2')),'defaultValue':_0xe7c5('0x3')},'content':{'type':Sequelize[_0xe7c5('0x4')]},'key':{'type':Sequelize[_0xe7c5('0x4')]},'keyType':{'type':Sequelize[_0xe7c5('0x5')](_0xe7c5('0x3'),_0xe7c5('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe7c5('0x4')]},'nameField':{'type':Sequelize[_0xe7c5('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe7c5('0x4')]}}; \ No newline at end of file +var _0xf003=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x158885,_0x1f398f){var _0x319c31=function(_0x4dcd88){while(--_0x4dcd88){_0x158885['push'](_0x158885['shift']());}};_0x319c31(++_0x1f398f);}(_0xf003,0xfb));var _0x3f00=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xf003[_0x32c012];return _0x48562e;};'use strict';var Sequelize=require(_0x3f00('0x0'));module[_0x3f00('0x1')]={'type':{'type':Sequelize[_0x3f00('0x2')](_0x3f00('0x3'),_0x3f00('0x4'),_0x3f00('0x5'),_0x3f00('0x6')),'defaultValue':_0x3f00('0x3')},'content':{'type':Sequelize[_0x3f00('0x7')]},'key':{'type':Sequelize[_0x3f00('0x7')]},'keyType':{'type':Sequelize[_0x3f00('0x2')](_0x3f00('0x3'),'variable',_0x3f00('0x5'))},'keyContent':{'type':Sequelize[_0x3f00('0x7')]},'idField':{'type':Sequelize[_0x3f00('0x7')]},'nameField':{'type':Sequelize[_0x3f00('0x7')]},'customField':{'type':Sequelize[_0x3f00('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f00('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 911abee..e6b67ed 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 _0xb1b1=['end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','length','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x4f43fa,_0x211203){var _0x1c28c3=function(_0x2ef4bb){while(--_0x2ef4bb){_0x4f43fa['push'](_0x4f43fa['shift']());}};_0x1c28c3(++_0x211203);}(_0xb1b1,0x1a1));var _0x1b1b=function(_0xe2fcf0,_0x396954){_0xe2fcf0=_0xe2fcf0-0x0;var _0x2d0e03=_0xb1b1[_0xe2fcf0];return _0x2d0e03;};'use strict';var pdf=require(_0x1b1b('0x0'));var emlformat=require(_0x1b1b('0x1'));var rimraf=require(_0x1b1b('0x2'));var zipdir=require(_0x1b1b('0x3'));var jsonpatch=require(_0x1b1b('0x4'));var rp=require(_0x1b1b('0x5'));var moment=require(_0x1b1b('0x6'));var BPromise=require(_0x1b1b('0x7'));var Mustache=require('mustache');var util=require(_0x1b1b('0x8'));var path=require(_0x1b1b('0x9'));var sox=require(_0x1b1b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1b1b('0xb'));var crypto=require(_0x1b1b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1b1b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1b1b('0xe'));var Papa=require(_0x1b1b('0xf'));var Redis=require(_0x1b1b('0x10'));var authService=require(_0x1b1b('0x11'));var qs=require(_0x1b1b('0x12'));var as=require(_0x1b1b('0x13'));var hardwareService=require(_0x1b1b('0x14'));var logger=require(_0x1b1b('0x15'))(_0x1b1b('0x16'));var utils=require(_0x1b1b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b1b('0x18'))['db'];function respondWithStatusCode(_0x588edd,_0x1c8e38){_0x1c8e38=_0x1c8e38||0xcc;return function(_0x3995e6){if(_0x3995e6){return _0x588edd[_0x1b1b('0x19')](_0x1c8e38);}return _0x588edd[_0x1b1b('0x1a')](_0x1c8e38)[_0x1b1b('0x1b')]();};}function respondWithResult(_0x4fb10c,_0x4ab45d){_0x4ab45d=_0x4ab45d||0xc8;return function(_0x3c1b3a){if(_0x3c1b3a){return _0x4fb10c[_0x1b1b('0x1a')](_0x4ab45d)[_0x1b1b('0x1c')](_0x3c1b3a);}};}function respondWithFilteredResult(_0x11c4b5,_0x44e3dd){return function(_0x4172e3){if(_0x4172e3){var _0x539c2d=_0x4172e3['count'],_0x1ecd04=_0x44e3dd[_0x1b1b('0x1d')],_0x573e13=_0x44e3dd['offset']+_0x44e3dd[_0x1b1b('0x1e')],_0x228c79;if(_0x573e13>=_0x539c2d){_0x573e13=_0x539c2d;_0x228c79=0xc8;}else{_0x228c79=0xce;}_0x11c4b5[_0x1b1b('0x1a')](_0x228c79);return _0x11c4b5[_0x1b1b('0x1f')](_0x1b1b('0x20'),_0x1ecd04+'-'+_0x573e13+'/'+_0x539c2d)[_0x1b1b('0x1c')](_0x4172e3);}return null;};}function patchUpdates(_0x209a3b){return function(_0x370e1d){try{jsonpatch[_0x1b1b('0x21')](_0x370e1d,_0x209a3b,!![]);}catch(_0x50908e){return BPromise[_0x1b1b('0x22')](_0x50908e);}return _0x370e1d['save']();};}function saveUpdates(_0x325b9d,_0x3bd57b){return function(_0x3dccde){if(_0x3dccde){return _0x3dccde['update'](_0x325b9d)[_0x1b1b('0x23')](function(_0x367369){return _0x367369;});}return null;};}function removeEntity(_0x5dbabc,_0x2a2622){return function(_0x16d66e){if(_0x16d66e){return _0x16d66e[_0x1b1b('0x24')]()['then'](function(){_0x5dbabc[_0x1b1b('0x1a')](0xcc)[_0x1b1b('0x1b')]();});}};}function handleEntityNotFound(_0x5127ae,_0x41baab){return function(_0x2558b0){if(!_0x2558b0){_0x5127ae[_0x1b1b('0x19')](0x194);}return _0x2558b0;};}function handleError(_0x4c0c1f,_0x30772b){_0x30772b=_0x30772b||0x1f4;return function(_0x10762a){logger[_0x1b1b('0x25')](_0x10762a[_0x1b1b('0x26')]);if(_0x10762a['name']){delete _0x10762a[_0x1b1b('0x27')];}_0x4c0c1f[_0x1b1b('0x1a')](_0x30772b)['send'](_0x10762a);};}exports[_0x1b1b('0x28')]=function(_0x41a21e,_0x13ab86){var _0x410ea6={},_0x3f034c={},_0x15e65f={'count':0x0,'rows':[]};var _0x22a760=_[_0x1b1b('0x29')](db[_0x1b1b('0x2a')][_0x1b1b('0x2b')],function(_0x128ec3){return{'name':_0x128ec3[_0x1b1b('0x2c')],'type':_0x128ec3[_0x1b1b('0x2d')][_0x1b1b('0x2e')]};});_0x3f034c[_0x1b1b('0x2f')]=_[_0x1b1b('0x29')](_0x22a760,'name');_0x3f034c[_0x1b1b('0x30')]=_[_0x1b1b('0x31')](_0x41a21e[_0x1b1b('0x30')]);_0x3f034c[_0x1b1b('0x32')]=_[_0x1b1b('0x33')](_0x3f034c[_0x1b1b('0x2f')],_0x3f034c[_0x1b1b('0x30')]);_0x410ea6[_0x1b1b('0x34')]=_[_0x1b1b('0x33')](_0x3f034c['model'],qs[_0x1b1b('0x35')](_0x41a21e[_0x1b1b('0x30')]['fields']));_0x410ea6[_0x1b1b('0x34')]=_0x410ea6[_0x1b1b('0x34')]['length']?_0x410ea6[_0x1b1b('0x34')]:_0x3f034c['model'];if(!_0x41a21e[_0x1b1b('0x30')][_0x1b1b('0x36')](_0x1b1b('0x37'))){_0x410ea6[_0x1b1b('0x1e')]=qs[_0x1b1b('0x1e')](_0x41a21e['query']['limit']);_0x410ea6[_0x1b1b('0x1d')]=qs[_0x1b1b('0x1d')](_0x41a21e[_0x1b1b('0x30')][_0x1b1b('0x1d')]);}_0x410ea6['order']=qs[_0x1b1b('0x38')](_0x41a21e['query'][_0x1b1b('0x38')]);_0x410ea6[_0x1b1b('0x39')]=qs[_0x1b1b('0x32')](_['pick'](_0x41a21e[_0x1b1b('0x30')],_0x3f034c[_0x1b1b('0x32')]),_0x22a760);if(_0x41a21e[_0x1b1b('0x30')][_0x1b1b('0x3a')]){_0x410ea6[_0x1b1b('0x39')]=_[_0x1b1b('0x3b')](_0x410ea6[_0x1b1b('0x39')],{'$or':_[_0x1b1b('0x29')](_0x22a760,function(_0x2d84d9){if(_0x2d84d9['type']!==_0x1b1b('0x3c')){var _0x3b2a7b={};_0x3b2a7b[_0x2d84d9['name']]={'$like':'%'+_0x41a21e[_0x1b1b('0x30')]['filter']+'%'};return _0x3b2a7b;}})});}_0x410ea6=_[_0x1b1b('0x3b')]({},_0x410ea6,_0x41a21e[_0x1b1b('0x3d')]);var _0xcd8bef={'where':_0x410ea6[_0x1b1b('0x39')]};return db[_0x1b1b('0x2a')][_0x1b1b('0x3e')](_0xcd8bef)[_0x1b1b('0x23')](function(_0xa93184){_0x15e65f[_0x1b1b('0x3e')]=_0xa93184;if(_0x41a21e[_0x1b1b('0x30')][_0x1b1b('0x3f')]){_0x410ea6[_0x1b1b('0x40')]=[{'all':!![]}];}return db[_0x1b1b('0x2a')][_0x1b1b('0x41')](_0x410ea6);})['then'](function(_0x3dab1f){_0x15e65f['rows']=_0x3dab1f;return _0x15e65f;})[_0x1b1b('0x23')](respondWithFilteredResult(_0x13ab86,_0x410ea6))[_0x1b1b('0x42')](handleError(_0x13ab86,null));};exports[_0x1b1b('0x43')]=function(_0x3e4d6d,_0x1ea994){var _0x5a4fb8={'raw':!![],'where':{'id':_0x3e4d6d[_0x1b1b('0x44')]['id']}},_0x3c9b09={};_0x3c9b09[_0x1b1b('0x2f')]=_['keys'](db[_0x1b1b('0x2a')][_0x1b1b('0x2b')]);_0x3c9b09['query']=_['keys'](_0x3e4d6d[_0x1b1b('0x30')]);_0x3c9b09['filters']=_[_0x1b1b('0x33')](_0x3c9b09[_0x1b1b('0x2f')],_0x3c9b09[_0x1b1b('0x30')]);_0x5a4fb8[_0x1b1b('0x34')]=_[_0x1b1b('0x33')](_0x3c9b09[_0x1b1b('0x2f')],qs[_0x1b1b('0x35')](_0x3e4d6d[_0x1b1b('0x30')][_0x1b1b('0x35')]));_0x5a4fb8[_0x1b1b('0x34')]=_0x5a4fb8['attributes'][_0x1b1b('0x45')]?_0x5a4fb8[_0x1b1b('0x34')]:_0x3c9b09[_0x1b1b('0x2f')];if(_0x3e4d6d[_0x1b1b('0x30')][_0x1b1b('0x3f')]){_0x5a4fb8[_0x1b1b('0x40')]=[{'all':!![]}];}_0x5a4fb8=_[_0x1b1b('0x3b')]({},_0x5a4fb8,_0x3e4d6d['options']);return db[_0x1b1b('0x2a')]['find'](_0x5a4fb8)[_0x1b1b('0x23')](handleEntityNotFound(_0x1ea994,null))[_0x1b1b('0x23')](respondWithResult(_0x1ea994,null))[_0x1b1b('0x42')](handleError(_0x1ea994,null));};exports[_0x1b1b('0x46')]=function(_0x236d93,_0x159020){return db['DeskField'][_0x1b1b('0x46')](_0x236d93[_0x1b1b('0x47')],{})[_0x1b1b('0x23')](respondWithResult(_0x159020,0xc9))['catch'](handleError(_0x159020,null));};exports[_0x1b1b('0x48')]=function(_0x2320f0,_0x558158){if(_0x2320f0['body']['id']){delete _0x2320f0[_0x1b1b('0x47')]['id'];}return db[_0x1b1b('0x2a')][_0x1b1b('0x49')]({'where':{'id':_0x2320f0[_0x1b1b('0x44')]['id']}})[_0x1b1b('0x23')](handleEntityNotFound(_0x558158,null))[_0x1b1b('0x23')](saveUpdates(_0x2320f0[_0x1b1b('0x47')],null))[_0x1b1b('0x23')](respondWithResult(_0x558158,null))[_0x1b1b('0x42')](handleError(_0x558158,null));};exports[_0x1b1b('0x24')]=function(_0x562a3d,_0x4ade80){return db[_0x1b1b('0x2a')][_0x1b1b('0x49')]({'where':{'id':_0x562a3d[_0x1b1b('0x44')]['id']}})[_0x1b1b('0x23')](handleEntityNotFound(_0x4ade80,null))['then'](removeEntity(_0x4ade80,null))[_0x1b1b('0x42')](handleError(_0x4ade80,null));}; \ No newline at end of file +var _0x8caf=['sort','where','filter','merge','VIRTUAL','options','DeskField','rows','catch','show','params','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x47dc4e,_0xf893ad){var _0x15a2e9=function(_0x3cf1ae){while(--_0x3cf1ae){_0x47dc4e['push'](_0x47dc4e['shift']());}};_0x15a2e9(++_0xf893ad);}(_0x8caf,0x1cc));var _0xf8ca=function(_0x5be3cc,_0x3b5c7d){_0x5be3cc=_0x5be3cc-0x0;var _0x1162a2=_0x8caf[_0x5be3cc];return _0x1162a2;};'use strict';var pdf=require(_0xf8ca('0x0'));var emlformat=require(_0xf8ca('0x1'));var rimraf=require(_0xf8ca('0x2'));var zipdir=require(_0xf8ca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8ca('0x4'));var moment=require(_0xf8ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8ca('0x6'));var util=require('util');var path=require(_0xf8ca('0x7'));var sox=require(_0xf8ca('0x8'));var csv=require(_0xf8ca('0x9'));var ejs=require(_0xf8ca('0xa'));var fs=require('fs');var _=require(_0xf8ca('0xb'));var squel=require(_0xf8ca('0xc'));var crypto=require(_0xf8ca('0xd'));var jsforce=require(_0xf8ca('0xe'));var deskjs=require(_0xf8ca('0xf'));var toCsv=require(_0xf8ca('0x9'));var querystring=require(_0xf8ca('0x10'));var Papa=require('papaparse');var Redis=require(_0xf8ca('0x11'));var authService=require(_0xf8ca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf8ca('0x13'));var hardwareService=require(_0xf8ca('0x14'));var logger=require(_0xf8ca('0x15'))(_0xf8ca('0x16'));var utils=require(_0xf8ca('0x17'));var config=require(_0xf8ca('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd00bea,_0x1320aa){_0x1320aa=_0x1320aa||0xcc;return function(_0x150182){if(_0x150182){return _0xd00bea[_0xf8ca('0x19')](_0x1320aa);}return _0xd00bea['status'](_0x1320aa)['end']();};}function respondWithResult(_0x5af17b,_0x3ea794){_0x3ea794=_0x3ea794||0xc8;return function(_0x5eba6f){if(_0x5eba6f){return _0x5af17b[_0xf8ca('0x1a')](_0x3ea794)[_0xf8ca('0x1b')](_0x5eba6f);}};}function respondWithFilteredResult(_0x2ca8aa,_0xbefc26){return function(_0x1216a2){if(_0x1216a2){var _0x707312=_0x1216a2[_0xf8ca('0x1c')],_0x204714=_0xbefc26[_0xf8ca('0x1d')],_0xff9513=_0xbefc26[_0xf8ca('0x1d')]+_0xbefc26[_0xf8ca('0x1e')],_0x5d72c7;if(_0xff9513>=_0x707312){_0xff9513=_0x707312;_0x5d72c7=0xc8;}else{_0x5d72c7=0xce;}_0x2ca8aa[_0xf8ca('0x1a')](_0x5d72c7);return _0x2ca8aa[_0xf8ca('0x1f')](_0xf8ca('0x20'),_0x204714+'-'+_0xff9513+'/'+_0x707312)[_0xf8ca('0x1b')](_0x1216a2);}return null;};}function patchUpdates(_0x34ccb2){return function(_0x35e07b){try{jsonpatch[_0xf8ca('0x21')](_0x35e07b,_0x34ccb2,!![]);}catch(_0x384d8b){return BPromise['reject'](_0x384d8b);}return _0x35e07b[_0xf8ca('0x22')]();};}function saveUpdates(_0xff0031,_0x22d431){return function(_0x590a4c){if(_0x590a4c){return _0x590a4c[_0xf8ca('0x23')](_0xff0031)[_0xf8ca('0x24')](function(_0xd28f0a){return _0xd28f0a;});}return null;};}function removeEntity(_0x18a2a9,_0x5ea626){return function(_0xbd2b3e){if(_0xbd2b3e){return _0xbd2b3e[_0xf8ca('0x25')]()['then'](function(){_0x18a2a9[_0xf8ca('0x1a')](0xcc)[_0xf8ca('0x26')]();});}};}function handleEntityNotFound(_0x141bb1,_0x244eec){return function(_0x3638b9){if(!_0x3638b9){_0x141bb1[_0xf8ca('0x19')](0x194);}return _0x3638b9;};}function handleError(_0x2e841f,_0x49ae9d){_0x49ae9d=_0x49ae9d||0x1f4;return function(_0x23226a){logger[_0xf8ca('0x27')](_0x23226a[_0xf8ca('0x28')]);if(_0x23226a[_0xf8ca('0x29')]){delete _0x23226a[_0xf8ca('0x29')];}_0x2e841f[_0xf8ca('0x1a')](_0x49ae9d)[_0xf8ca('0x2a')](_0x23226a);};}exports[_0xf8ca('0x2b')]=function(_0x4b9460,_0x1c680b){var _0x2a9175={},_0x4f960b={},_0x9e11e1={'count':0x0,'rows':[]};var _0x11a817=_[_0xf8ca('0x2c')](db['DeskField'][_0xf8ca('0x2d')],function(_0x198e17){return{'name':_0x198e17[_0xf8ca('0x2e')],'type':_0x198e17[_0xf8ca('0x2f')][_0xf8ca('0x30')]};});_0x4f960b['model']=_[_0xf8ca('0x2c')](_0x11a817,_0xf8ca('0x29'));_0x4f960b[_0xf8ca('0x31')]=_[_0xf8ca('0x32')](_0x4b9460['query']);_0x4f960b[_0xf8ca('0x33')]=_[_0xf8ca('0x34')](_0x4f960b['model'],_0x4f960b[_0xf8ca('0x31')]);_0x2a9175['attributes']=_[_0xf8ca('0x34')](_0x4f960b[_0xf8ca('0x35')],qs[_0xf8ca('0x36')](_0x4b9460[_0xf8ca('0x31')][_0xf8ca('0x36')]));_0x2a9175[_0xf8ca('0x37')]=_0x2a9175[_0xf8ca('0x37')][_0xf8ca('0x38')]?_0x2a9175[_0xf8ca('0x37')]:_0x4f960b['model'];if(!_0x4b9460['query'][_0xf8ca('0x39')]('nolimit')){_0x2a9175['limit']=qs['limit'](_0x4b9460[_0xf8ca('0x31')]['limit']);_0x2a9175[_0xf8ca('0x1d')]=qs[_0xf8ca('0x1d')](_0x4b9460[_0xf8ca('0x31')][_0xf8ca('0x1d')]);}_0x2a9175['order']=qs[_0xf8ca('0x3a')](_0x4b9460['query'][_0xf8ca('0x3a')]);_0x2a9175[_0xf8ca('0x3b')]=qs[_0xf8ca('0x33')](_['pick'](_0x4b9460[_0xf8ca('0x31')],_0x4f960b[_0xf8ca('0x33')]),_0x11a817);if(_0x4b9460[_0xf8ca('0x31')][_0xf8ca('0x3c')]){_0x2a9175[_0xf8ca('0x3b')]=_[_0xf8ca('0x3d')](_0x2a9175['where'],{'$or':_[_0xf8ca('0x2c')](_0x11a817,function(_0x5b9353){if(_0x5b9353[_0xf8ca('0x2f')]!==_0xf8ca('0x3e')){var _0x29b7b4={};_0x29b7b4[_0x5b9353[_0xf8ca('0x29')]]={'$like':'%'+_0x4b9460[_0xf8ca('0x31')]['filter']+'%'};return _0x29b7b4;}})});}_0x2a9175=_[_0xf8ca('0x3d')]({},_0x2a9175,_0x4b9460[_0xf8ca('0x3f')]);var _0x3e6600={'where':_0x2a9175[_0xf8ca('0x3b')]};return db[_0xf8ca('0x40')][_0xf8ca('0x1c')](_0x3e6600)[_0xf8ca('0x24')](function(_0x489863){_0x9e11e1[_0xf8ca('0x1c')]=_0x489863;if(_0x4b9460['query']['includeAll']){_0x2a9175['include']=[{'all':!![]}];}return db[_0xf8ca('0x40')]['findAll'](_0x2a9175);})['then'](function(_0x44a1f0){_0x9e11e1[_0xf8ca('0x41')]=_0x44a1f0;return _0x9e11e1;})[_0xf8ca('0x24')](respondWithFilteredResult(_0x1c680b,_0x2a9175))[_0xf8ca('0x42')](handleError(_0x1c680b,null));};exports[_0xf8ca('0x43')]=function(_0x70f500,_0x493e06){var _0x2212b0={'raw':!![],'where':{'id':_0x70f500[_0xf8ca('0x44')]['id']}},_0x47dbe3={};_0x47dbe3['model']=_[_0xf8ca('0x32')](db['DeskField'][_0xf8ca('0x2d')]);_0x47dbe3[_0xf8ca('0x31')]=_[_0xf8ca('0x32')](_0x70f500[_0xf8ca('0x31')]);_0x47dbe3[_0xf8ca('0x33')]=_['intersection'](_0x47dbe3[_0xf8ca('0x35')],_0x47dbe3['query']);_0x2212b0['attributes']=_[_0xf8ca('0x34')](_0x47dbe3[_0xf8ca('0x35')],qs['fields'](_0x70f500[_0xf8ca('0x31')]['fields']));_0x2212b0['attributes']=_0x2212b0[_0xf8ca('0x37')][_0xf8ca('0x38')]?_0x2212b0['attributes']:_0x47dbe3[_0xf8ca('0x35')];if(_0x70f500['query'][_0xf8ca('0x45')]){_0x2212b0[_0xf8ca('0x46')]=[{'all':!![]}];}_0x2212b0=_[_0xf8ca('0x3d')]({},_0x2212b0,_0x70f500[_0xf8ca('0x3f')]);return db['DeskField']['find'](_0x2212b0)[_0xf8ca('0x24')](handleEntityNotFound(_0x493e06,null))[_0xf8ca('0x24')](respondWithResult(_0x493e06,null))['catch'](handleError(_0x493e06,null));};exports['create']=function(_0xd3ef2b,_0x3c2ddd){return db[_0xf8ca('0x40')][_0xf8ca('0x47')](_0xd3ef2b[_0xf8ca('0x48')],{})[_0xf8ca('0x24')](respondWithResult(_0x3c2ddd,0xc9))['catch'](handleError(_0x3c2ddd,null));};exports[_0xf8ca('0x23')]=function(_0x3b4d70,_0x2ee712){if(_0x3b4d70[_0xf8ca('0x48')]['id']){delete _0x3b4d70[_0xf8ca('0x48')]['id'];}return db[_0xf8ca('0x40')][_0xf8ca('0x49')]({'where':{'id':_0x3b4d70['params']['id']}})[_0xf8ca('0x24')](handleEntityNotFound(_0x2ee712,null))['then'](saveUpdates(_0x3b4d70[_0xf8ca('0x48')],null))[_0xf8ca('0x24')](respondWithResult(_0x2ee712,null))[_0xf8ca('0x42')](handleError(_0x2ee712,null));};exports[_0xf8ca('0x25')]=function(_0x2156c5,_0x28ed68){return db['DeskField'][_0xf8ca('0x49')]({'where':{'id':_0x2156c5['params']['id']}})[_0xf8ca('0x24')](handleEntityNotFound(_0x28ed68,null))[_0xf8ca('0x24')](removeEntity(_0x28ed68,null))[_0xf8ca('0x42')](handleError(_0x28ed68,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 57077f0..edb78b1 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 _0xd8f1=['request-promise','path','rimraf','../../config/environment','define','int_desk_fields','lodash','util','api','bluebird'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xd8f1,0x164));var _0x1d8f=function(_0x58edb3,_0x491b50){_0x58edb3=_0x58edb3-0x0;var _0x5d34f3=_0xd8f1[_0x58edb3];return _0x5d34f3;};'use strict';var _=require(_0x1d8f('0x0'));var util=require(_0x1d8f('0x1'));var logger=require('../../config/logger')(_0x1d8f('0x2'));var moment=require('moment');var BPromise=require(_0x1d8f('0x3'));var rp=require(_0x1d8f('0x4'));var fs=require('fs');var path=require(_0x1d8f('0x5'));var rimraf=require(_0x1d8f('0x6'));var config=require(_0x1d8f('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x1caa56,_0x22f202){return _0x1caa56[_0x1d8f('0x8')]('DeskField',attributes,{'tableName':_0x1d8f('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d55=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d55,0xd1));var _0x55d5=function(_0x193130,_0x253d87){_0x193130=_0x193130-0x0;var _0x44676b=_0x5d55[_0x193130];return _0x44676b;};'use strict';var _=require(_0x55d5('0x0'));var util=require(_0x55d5('0x1'));var logger=require(_0x55d5('0x2'))(_0x55d5('0x3'));var moment=require(_0x55d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x55d5('0x5'));var fs=require('fs');var path=require(_0x55d5('0x6'));var rimraf=require(_0x55d5('0x7'));var config=require(_0x55d5('0x8'));var attributes=require(_0x55d5('0x9'));module[_0x55d5('0xa')]=function(_0x557c15,_0x4fa074){return _0x557c15['define'](_0x55d5('0xb'),attributes,{'tableName':_0x55d5('0xc'),'paranoid':![],'indexes':[{'name':_0x55d5('0xd'),'fields':['idField',_0x55d5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index f1b154b..66669bb 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 _0x3054=['http','request','then','info','debug','request\x20sent','stringify','error','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3054,0x68));var _0x4305=function(_0x9209b4,_0x477c05){_0x9209b4=_0x9209b4-0x0;var _0x5be52d=_0x3054[_0x9209b4];return _0x5be52d;};'use strict';var _=require(_0x4305('0x0'));var util=require(_0x4305('0x1'));var moment=require(_0x4305('0x2'));var BPromise=require('bluebird');var rs=require(_0x4305('0x3'));var fs=require('fs');var Redis=require(_0x4305('0x4'));var db=require(_0x4305('0x5'))['db'];var utils=require(_0x4305('0x6'));var logger=require(_0x4305('0x7'))(_0x4305('0x8'));var config=require(_0x4305('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4305('0xa')][_0x4305('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26584b,_0xcb9ae6,_0x5373a8){return new BPromise(function(_0x13e562,_0x37c8ad){return client[_0x4305('0xc')](_0x26584b,_0x5373a8)[_0x4305('0xd')](function(_0x131ab8){logger[_0x4305('0xe')]('DeskField,\x20%s,\x20%s',_0xcb9ae6,'request\x20sent');logger[_0x4305('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0xcb9ae6,_0x4305('0x10'),JSON[_0x4305('0x11')](_0x131ab8));if(_0x131ab8['error']){if(_0x131ab8[_0x4305('0x12')]['code']===0x1f4){logger[_0x4305('0x12')](_0x4305('0x13'),_0xcb9ae6,_0x131ab8[_0x4305('0x12')][_0x4305('0x14')]);return _0x37c8ad(_0x131ab8['error']['message']);}logger['error'](_0x4305('0x13'),_0xcb9ae6,_0x131ab8[_0x4305('0x12')][_0x4305('0x14')]);return _0x13e562(_0x131ab8['error'][_0x4305('0x14')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0xcb9ae6,_0x4305('0x10'));_0x13e562(_0x131ab8[_0x4305('0x15')][_0x4305('0x14')]);}})[_0x4305('0x16')](function(_0x576e8d){logger[_0x4305('0x12')]('DeskField,\x20%s,\x20%s',_0xcb9ae6,_0x576e8d);_0x37c8ad(_0x576e8d);});});} \ No newline at end of file +var _0xc510=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','DeskField,\x20%s,\x20%s','request\x20sent','error','message','result','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc510,0x1ee));var _0x0c51=function(_0xa7dd32,_0x35561f){_0xa7dd32=_0xa7dd32-0x0;var _0x20f2f8=_0xc510[_0xa7dd32];return _0x20f2f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c51('0x0'));var BPromise=require('bluebird');var rs=require(_0x0c51('0x1'));var fs=require('fs');var Redis=require(_0x0c51('0x2'));var db=require(_0x0c51('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c51('0x4'))('rpc');var config=require(_0x0c51('0x5'));var jayson=require(_0x0c51('0x6'));var client=jayson[_0x0c51('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c61aa,_0x10ba58,_0x4d59cf){return new BPromise(function(_0x314752,_0x4453fd){return client[_0x0c51('0x8')](_0x4c61aa,_0x4d59cf)[_0x0c51('0x9')](function(_0x4627fd){logger['info'](_0x0c51('0xa'),_0x10ba58,_0x0c51('0xb'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x10ba58,_0x0c51('0xb'),JSON['stringify'](_0x4627fd));if(_0x4627fd[_0x0c51('0xc')]){if(_0x4627fd['error']['code']===0x1f4){logger['error'](_0x0c51('0xa'),_0x10ba58,_0x4627fd[_0x0c51('0xc')][_0x0c51('0xd')]);return _0x4453fd(_0x4627fd[_0x0c51('0xc')]['message']);}logger[_0x0c51('0xc')]('DeskField,\x20%s,\x20%s',_0x10ba58,_0x4627fd[_0x0c51('0xc')][_0x0c51('0xd')]);return _0x314752(_0x4627fd[_0x0c51('0xc')][_0x0c51('0xd')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x10ba58,'request\x20sent');_0x314752(_0x4627fd[_0x0c51('0xe')][_0x0c51('0xd')]);}})['catch'](function(_0x300a42){logger[_0x0c51('0xc')]('DeskField,\x20%s,\x20%s',_0x10ba58,_0x300a42);_0x4453fd(_0x300a42);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9e43c90..6329828 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 _0xbaf0=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x16af15,_0x55bc76){var _0xfeda8a=function(_0x13ad56){while(--_0x13ad56){_0x16af15['push'](_0x16af15['shift']());}};_0xfeda8a(++_0x55bc76);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['addConfiguration']);router['put'](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x13')]);router[_0x0baf('0x14')]('/:id',auth[_0x0baf('0x9')](),controller['destroy']);module[_0x0baf('0x15')]=router; \ No newline at end of file +var _0x5f2f=['/:id','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x280a28,_0x225300){var _0x485c50=function(_0xddce78){while(--_0xddce78){_0x280a28['push'](_0x280a28['shift']());}};_0x485c50(++_0x225300);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b14c1,_0x1e95d1){_0x5b14c1=_0x5b14c1-0x0;var _0x4c07fa=_0x5f2f[_0x5b14c1];return _0x4c07fa;};'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('./intDynamics365Account.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getConfigurations']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5f2('0xe')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x12')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x13')]);module[_0xf5f2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3d93443..faf1d6e 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 _0xa725=['STRING','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa725,0x71));var _0x5a72=function(_0xcee593,_0x9886e7){_0xcee593=_0xcee593-0x0;var _0x4fa243=_0xa725[_0xcee593];return _0x4fa243;};'use strict';var Sequelize=require('sequelize');module[_0x5a72('0x0')]={'name':{'type':Sequelize[_0x5a72('0x1')]},'username':{'type':Sequelize[_0x5a72('0x1')]},'password':{'type':Sequelize[_0x5a72('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x5a72('0x1')]},'clientId':{'type':Sequelize[_0x5a72('0x1')]},'clientSecret':{'type':Sequelize[_0x5a72('0x1')]},'serverUrl':{'type':Sequelize[_0x5a72('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5a72('0x1')]}}; \ No newline at end of file +var _0x0b83=['STRING','sequelize'];(function(_0x3437a2,_0x4aa5ec){var _0x38ec72=function(_0x39009b){while(--_0x39009b){_0x3437a2['push'](_0x3437a2['shift']());}};_0x38ec72(++_0x4aa5ec);}(_0x0b83,0x143));var _0x30b8=function(_0x5b4669,_0x5da7c8){_0x5b4669=_0x5b4669-0x0;var _0xec632=_0x0b83[_0x5b4669];return _0xec632;};'use strict';var Sequelize=require(_0x30b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x30b8('0x1')]},'username':{'type':Sequelize[_0x30b8('0x1')]},'password':{'type':Sequelize[_0x30b8('0x1')]},'remoteUri':{'type':Sequelize[_0x30b8('0x1')]},'tenantId':{'type':Sequelize[_0x30b8('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x30b8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x30b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fe7e609..70ac156 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 _0xeff8=['status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','Dynamics365Account','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','options','includeAll','show','params','keys','rawAttributes','include','merge','create','body','find','findOne','Dynamics365Configuration','filter','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','responseby','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','clientId','slice','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/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','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end'];(function(_0x16f39a,_0x233f55){var _0xd6a5da=function(_0x179a80){while(--_0x179a80){_0x16f39a['push'](_0x16f39a['shift']());}};_0xd6a5da(++_0x233f55);}(_0xeff8,0x186));var _0x8eff=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xeff8[_0x2a56ad];return _0x425175;};'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'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8eff('0x17'));var client=jayson[_0x8eff('0x18')][_0x8eff('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x42fb24,_0x1349cb,_0x56efdf,_0x3e7c01){return new BPromise(function(_0x212a2e,_0x372ee8){var _0x1af3d6=_0x3e7c01||client;return _0x1af3d6[_0x8eff('0x1a')](_0x42fb24,_0x56efdf)[_0x8eff('0x1b')](function(_0x16202e){logger[_0x8eff('0x1c')](_0x8eff('0x1d'),_0x1349cb,_0x8eff('0x1e'));logger[_0x8eff('0x1f')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1349cb,_0x8eff('0x1e'),JSON[_0x8eff('0x20')](_0x16202e));if(_0x16202e[_0x8eff('0x21')]){if(_0x16202e[_0x8eff('0x21')][_0x8eff('0x22')]===0x1f4){logger[_0x8eff('0x21')](_0x8eff('0x1d'),_0x1349cb,_0x16202e[_0x8eff('0x21')][_0x8eff('0x23')]);return _0x372ee8(_0x16202e[_0x8eff('0x21')][_0x8eff('0x23')]);}logger[_0x8eff('0x21')](_0x8eff('0x1d'),_0x1349cb,_0x16202e[_0x8eff('0x21')][_0x8eff('0x23')]);return _0x212a2e(_0x16202e[_0x8eff('0x21')]['message']);}else{logger[_0x8eff('0x1c')](_0x8eff('0x1d'),_0x1349cb,'request\x20sent');_0x212a2e(_0x16202e[_0x8eff('0x24')]['message']);}})[_0x8eff('0x25')](function(_0x23c030){logger[_0x8eff('0x21')](_0x8eff('0x1d'),_0x1349cb,_0x23c030);_0x372ee8(_0x23c030);});});}function respondWithStatusCode(_0x1ee09c,_0x4e891c){_0x4e891c=_0x4e891c||0xcc;return function(_0x179814){if(_0x179814){return _0x1ee09c[_0x8eff('0x26')](_0x4e891c);}return _0x1ee09c['status'](_0x4e891c)[_0x8eff('0x27')]();};}function respondWithResult(_0x5ec3d7,_0x40404b){_0x40404b=_0x40404b||0xc8;return function(_0x3b698b){if(_0x3b698b){return _0x5ec3d7[_0x8eff('0x28')](_0x40404b)[_0x8eff('0x29')](_0x3b698b);}};}function respondWithFilteredResult(_0x6359df,_0x2e8067){return function(_0x516173){if(_0x516173){var _0x3e1607=_0x516173[_0x8eff('0x2a')],_0x323ffa=_0x2e8067[_0x8eff('0x2b')],_0x15083c=_0x2e8067['offset']+_0x2e8067['limit'],_0xb88ce9;if(_0x15083c>=_0x3e1607){_0x15083c=_0x3e1607;_0xb88ce9=0xc8;}else{_0xb88ce9=0xce;}_0x6359df[_0x8eff('0x28')](_0xb88ce9);return _0x6359df[_0x8eff('0x2c')](_0x8eff('0x2d'),_0x323ffa+'-'+_0x15083c+'/'+_0x3e1607)['json'](_0x516173);}return null;};}function patchUpdates(_0x2ebf3a){return function(_0x2f8ad9){try{jsonpatch[_0x8eff('0x2e')](_0x2f8ad9,_0x2ebf3a,!![]);}catch(_0x1da0fa){return BPromise[_0x8eff('0x2f')](_0x1da0fa);}return _0x2f8ad9[_0x8eff('0x30')]();};}function saveUpdates(_0x141bd7,_0x1c6efa){return function(_0x36a613){if(_0x36a613){return _0x36a613[_0x8eff('0x31')](_0x141bd7)[_0x8eff('0x1b')](function(_0x324597){return _0x324597;});}return null;};}function removeEntity(_0x5e0ecb,_0x2ad4b7){return function(_0x165f8e){if(_0x165f8e){return _0x165f8e[_0x8eff('0x32')]()[_0x8eff('0x1b')](function(){_0x5e0ecb['status'](0xcc)[_0x8eff('0x27')]();});}};}function handleEntityNotFound(_0x32fd3c,_0x4c4220){return function(_0x4e1256){if(!_0x4e1256){_0x32fd3c[_0x8eff('0x26')](0x194);}return _0x4e1256;};}function handleError(_0x271d64,_0x565b83){_0x565b83=_0x565b83||0x1f4;return function(_0x50dfc3){logger['error'](_0x50dfc3[_0x8eff('0x33')]);if(_0x50dfc3['name']){delete _0x50dfc3[_0x8eff('0x34')];}_0x271d64['status'](_0x565b83)[_0x8eff('0x35')](_0x50dfc3);};}exports[_0x8eff('0x36')]=function(_0x1a7493,_0x1dcab3){var _0x3e53a2={},_0x37e474={},_0x5ed3f3={'count':0x0,'rows':[]};var _0xd95908=_['map'](db[_0x8eff('0x37')]['rawAttributes'],function(_0x2fe45d){return{'name':_0x2fe45d[_0x8eff('0x38')],'type':_0x2fe45d[_0x8eff('0x39')][_0x8eff('0x3a')]};});_0x37e474['model']=_[_0x8eff('0x3b')](_0xd95908,_0x8eff('0x34'));_0x37e474[_0x8eff('0x3c')]=_['keys'](_0x1a7493[_0x8eff('0x3c')]);_0x37e474[_0x8eff('0x3d')]=_[_0x8eff('0x3e')](_0x37e474[_0x8eff('0x3f')],_0x37e474[_0x8eff('0x3c')]);_0x3e53a2[_0x8eff('0x40')]=_[_0x8eff('0x3e')](_0x37e474[_0x8eff('0x3f')],qs[_0x8eff('0x41')](_0x1a7493['query']['fields']));_0x3e53a2[_0x8eff('0x40')]=_0x3e53a2[_0x8eff('0x40')][_0x8eff('0x42')]?_0x3e53a2[_0x8eff('0x40')]:_0x37e474[_0x8eff('0x3f')];if(!_0x1a7493[_0x8eff('0x3c')][_0x8eff('0x43')]('nolimit')){_0x3e53a2[_0x8eff('0x44')]=qs[_0x8eff('0x44')](_0x1a7493['query'][_0x8eff('0x44')]);_0x3e53a2[_0x8eff('0x2b')]=qs[_0x8eff('0x2b')](_0x1a7493[_0x8eff('0x3c')][_0x8eff('0x2b')]);}_0x3e53a2[_0x8eff('0x45')]=qs[_0x8eff('0x46')](_0x1a7493[_0x8eff('0x3c')][_0x8eff('0x46')]);_0x3e53a2['where']=qs[_0x8eff('0x3d')](_[_0x8eff('0x47')](_0x1a7493[_0x8eff('0x3c')],_0x37e474[_0x8eff('0x3d')]),_0xd95908);if(_0x1a7493[_0x8eff('0x3c')]['filter']){_0x3e53a2[_0x8eff('0x48')]=_['merge'](_0x3e53a2[_0x8eff('0x48')],{'$or':_[_0x8eff('0x3b')](_0xd95908,function(_0x1e9d99){if(_0x1e9d99[_0x8eff('0x39')]!=='VIRTUAL'){var _0xa0eabb={};_0xa0eabb[_0x1e9d99[_0x8eff('0x34')]]={'$like':'%'+_0x1a7493[_0x8eff('0x3c')]['filter']+'%'};return _0xa0eabb;}})});}_0x3e53a2=_['merge']({},_0x3e53a2,_0x1a7493[_0x8eff('0x49')]);var _0x1fc65f={'where':_0x3e53a2[_0x8eff('0x48')]};return db[_0x8eff('0x37')][_0x8eff('0x2a')](_0x1fc65f)['then'](function(_0x28cb8e){_0x5ed3f3['count']=_0x28cb8e;if(_0x1a7493[_0x8eff('0x3c')][_0x8eff('0x4a')]){_0x3e53a2['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3e53a2);})['then'](function(_0x4b0b41){_0x5ed3f3['rows']=_0x4b0b41;return _0x5ed3f3;})[_0x8eff('0x1b')](respondWithFilteredResult(_0x1dcab3,_0x3e53a2))[_0x8eff('0x25')](handleError(_0x1dcab3,null));};exports[_0x8eff('0x4b')]=function(_0x1b5fda,_0x1aa204){var _0x190aec={'raw':![],'where':{'id':_0x1b5fda[_0x8eff('0x4c')]['id']}},_0x27555e={};_0x27555e[_0x8eff('0x3f')]=_[_0x8eff('0x4d')](db['Dynamics365Account'][_0x8eff('0x4e')]);_0x27555e['query']=_[_0x8eff('0x4d')](_0x1b5fda[_0x8eff('0x3c')]);_0x27555e[_0x8eff('0x3d')]=_[_0x8eff('0x3e')](_0x27555e[_0x8eff('0x3f')],_0x27555e[_0x8eff('0x3c')]);_0x190aec[_0x8eff('0x40')]=_[_0x8eff('0x3e')](_0x27555e[_0x8eff('0x3f')],qs[_0x8eff('0x41')](_0x1b5fda[_0x8eff('0x3c')][_0x8eff('0x41')]));_0x190aec['attributes']=_0x190aec[_0x8eff('0x40')][_0x8eff('0x42')]?_0x190aec[_0x8eff('0x40')]:_0x27555e[_0x8eff('0x3f')];if(_0x1b5fda[_0x8eff('0x3c')][_0x8eff('0x4a')]){_0x190aec[_0x8eff('0x4f')]=[{'all':!![]}];}_0x190aec=_[_0x8eff('0x50')]({},_0x190aec,_0x1b5fda[_0x8eff('0x49')]);return db['Dynamics365Account']['find'](_0x190aec)[_0x8eff('0x1b')](handleEntityNotFound(_0x1aa204,null))[_0x8eff('0x1b')](respondWithResult(_0x1aa204,null))[_0x8eff('0x25')](handleError(_0x1aa204,null));};exports[_0x8eff('0x51')]=function(_0xb99749,_0x9a8a92){return db['Dynamics365Account'][_0x8eff('0x51')](_0xb99749[_0x8eff('0x52')],{})[_0x8eff('0x1b')](respondWithResult(_0x9a8a92,0xc9))['catch'](handleError(_0x9a8a92,null));};exports[_0x8eff('0x31')]=function(_0x84bc6,_0x2871cf){if(_0x84bc6[_0x8eff('0x52')]['id']){delete _0x84bc6['body']['id'];}return db[_0x8eff('0x37')][_0x8eff('0x53')]({'where':{'id':_0x84bc6[_0x8eff('0x4c')]['id']}})[_0x8eff('0x1b')](handleEntityNotFound(_0x2871cf,null))[_0x8eff('0x1b')](saveUpdates(_0x84bc6[_0x8eff('0x52')],null))[_0x8eff('0x1b')](respondWithResult(_0x2871cf,null))['catch'](handleError(_0x2871cf,null));};exports[_0x8eff('0x32')]=function(_0x162b74,_0x3a6d5e){return db[_0x8eff('0x37')][_0x8eff('0x53')]({'where':{'id':_0x162b74['params']['id']}})[_0x8eff('0x1b')](handleEntityNotFound(_0x3a6d5e,null))[_0x8eff('0x1b')](removeEntity(_0x3a6d5e,null))[_0x8eff('0x25')](handleError(_0x3a6d5e,null));};exports['getConfigurations']=function(_0x2c4c38,_0x4aca10,_0x3f387a){var _0x172c6c={};var _0x23ed92={};var _0xfecdd8;var _0x3d82b6;return db[_0x8eff('0x37')][_0x8eff('0x54')]({'where':{'id':_0x2c4c38['params']['id']}})['then'](handleEntityNotFound(_0x4aca10,null))[_0x8eff('0x1b')](function(_0x4cf5db){if(_0x4cf5db){_0xfecdd8=_0x4cf5db;_0x23ed92[_0x8eff('0x3f')]=_[_0x8eff('0x4d')](db[_0x8eff('0x55')][_0x8eff('0x4e')]);_0x23ed92[_0x8eff('0x3c')]=_['keys'](_0x2c4c38[_0x8eff('0x3c')]);_0x23ed92[_0x8eff('0x3d')]=_[_0x8eff('0x3e')](_0x23ed92[_0x8eff('0x3f')],_0x23ed92[_0x8eff('0x3c')]);_0x172c6c[_0x8eff('0x40')]=_['intersection'](_0x23ed92[_0x8eff('0x3f')],qs['fields'](_0x2c4c38[_0x8eff('0x3c')][_0x8eff('0x41')]));_0x172c6c['attributes']=_0x172c6c[_0x8eff('0x40')][_0x8eff('0x42')]?_0x172c6c[_0x8eff('0x40')]:_0x23ed92[_0x8eff('0x3f')];_0x172c6c[_0x8eff('0x45')]=qs[_0x8eff('0x46')](_0x2c4c38[_0x8eff('0x3c')][_0x8eff('0x46')]);_0x172c6c['where']=qs[_0x8eff('0x3d')](_['pick'](_0x2c4c38['query'],_0x23ed92[_0x8eff('0x3d')]));if(_0x2c4c38[_0x8eff('0x3c')]['filter']){_0x172c6c[_0x8eff('0x48')]=_[_0x8eff('0x50')](_0x172c6c['where'],{'$or':_[_0x8eff('0x3b')](_0x172c6c[_0x8eff('0x40')],function(_0x56c996){var _0xc70ecc={};_0xc70ecc[_0x56c996]={'$like':'%'+_0x2c4c38[_0x8eff('0x3c')][_0x8eff('0x56')]+'%'};return _0xc70ecc;})});}_0x172c6c=_[_0x8eff('0x50')]({},_0x172c6c,_0x2c4c38[_0x8eff('0x49')]);return _0xfecdd8[_0x8eff('0x57')](_0x172c6c);}})[_0x8eff('0x1b')](function(_0x58c9e6){if(_0x58c9e6){_0x3d82b6=_0x58c9e6['length'];if(!_0x2c4c38[_0x8eff('0x3c')][_0x8eff('0x43')](_0x8eff('0x58'))){_0x172c6c[_0x8eff('0x44')]=qs[_0x8eff('0x44')](_0x2c4c38[_0x8eff('0x3c')][_0x8eff('0x44')]);_0x172c6c['offset']=qs['offset'](_0x2c4c38[_0x8eff('0x3c')]['offset']);}return _0xfecdd8['getConfigurations'](_0x172c6c);}})['then'](function(_0x17f9e1){if(_0x17f9e1){return _0x17f9e1?{'count':_0x3d82b6,'rows':_0x17f9e1}:null;}})[_0x8eff('0x1b')](respondWithResult(_0x4aca10,null))[_0x8eff('0x25')](handleError(_0x4aca10,null));};exports[_0x8eff('0x59')]=function(_0x2e4ed6,_0x436f93,_0x2acfad){if(_0x2e4ed6[_0x8eff('0x52')]['id']){delete _0x2e4ed6['body']['id'];}return db[_0x8eff('0x37')]['findOne']({'where':{'id':_0x2e4ed6[_0x8eff('0x4c')]['id']}})[_0x8eff('0x1b')](handleEntityNotFound(_0x436f93,null))[_0x8eff('0x1b')](function(_0x225703){if(_0x225703){_0x2e4ed6[_0x8eff('0x52')][_0x8eff('0x5a')]=_0x225703['id'];_0x2e4ed6['body'][_0x8eff('0x5b')]=integrations['getSubjects'](_0x2e4ed6[_0x8eff('0x52')][_0x8eff('0x5c')],_0x2e4ed6[_0x8eff('0x52')][_0x8eff('0x39')]);_0x2e4ed6[_0x8eff('0x52')][_0x8eff('0x5d')]=integrations[_0x8eff('0x5e')](_0x2e4ed6[_0x8eff('0x52')][_0x8eff('0x5c')],_0x2e4ed6['body'][_0x8eff('0x39')]);return db[_0x8eff('0x55')][_0x8eff('0x51')](_0x2e4ed6[_0x8eff('0x52')],{'include':[{'model':db[_0x8eff('0x5f')],'as':_0x8eff('0x5b')},{'model':db[_0x8eff('0x5f')],'as':_0x8eff('0x5d')}]});}return null;})[_0x8eff('0x1b')](respondWithResult(_0x436f93,null))[_0x8eff('0x25')](handleError(_0x436f93,null));};exports['getFields']=function(_0x503527,_0x5da127,_0x5f3443){var _0x4642d3=_0x503527[_0x8eff('0x3c')][_0x8eff('0x60')];var _0x47435f=_0x4642d3===_0x8eff('0x61')?_0x8eff('0x62'):_0x8eff('0x63');var _0x4e7cce='';var _0x15473b='';var _0x3e4212='';var _0x41458b='';var _0x36248c='';var _0x5b1f67='';var _0x447698='';var _0x34ca22='';var _0x4f6a75=[_0x8eff('0x64'),_0x8eff('0x65'),_0x8eff('0x66'),'ownerid','caseorigincode','subject',_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x69'),_0x8eff('0x6a')];var _0xaca1b5=[_0x8eff('0x6b'),_0x8eff('0x6c'),_0x8eff('0x6d'),_0x8eff('0x6e'),_0x8eff('0x6f'),_0x8eff('0x70'),'contractdetailidname',_0x8eff('0x71'),'createdbyexternalpartyname',_0x8eff('0x72'),_0x8eff('0x73'),'createdbyyominame',_0x8eff('0x74'),'createdonbehalfbyname',_0x8eff('0x75'),_0x8eff('0x76'),_0x8eff('0x77'),_0x8eff('0x78'),_0x8eff('0x79'),'entitlementidname',_0x8eff('0x7a'),_0x8eff('0x7b'),_0x8eff('0x7c'),_0x8eff('0x7d'),_0x8eff('0x7e'),_0x8eff('0x7f'),_0x8eff('0x80'),_0x8eff('0x81'),_0x8eff('0x82'),_0x8eff('0x83'),_0x8eff('0x84'),'modifiedbyexternalpartyname',_0x8eff('0x85'),_0x8eff('0x86'),_0x8eff('0x87'),_0x8eff('0x88'),_0x8eff('0x89'),'modifiedonbehalfbyyominame',_0x8eff('0x8a'),_0x8eff('0x8b'),'numberofchildincidents','onholdtime',_0x8eff('0x8c'),_0x8eff('0x8d'),_0x8eff('0x8e'),_0x8eff('0x8f'),_0x8eff('0x90'),_0x8eff('0x91'),'primarycontactidyominame',_0x8eff('0x92'),'productidname',_0x8eff('0x93'),_0x8eff('0x94'),'resolvebykpiidname',_0x8eff('0x95'),'responsiblecontactidname','responsiblecontactidyominame',_0x8eff('0x96'),'slainvokedidname',_0x8eff('0x97'),_0x8eff('0x98'),'statecode',_0x8eff('0x99'),_0x8eff('0x9a'),'ticketnumber',_0x8eff('0x9b'),_0x8eff('0x9c'),_0x8eff('0x9d'),_0x8eff('0x9e'),_0x8eff('0x9f')];var _0x284b0c=_0x4f6a75[_0x8eff('0xa0')](_0xaca1b5);return db[_0x8eff('0x37')][_0x8eff('0x54')]({'where':{'id':_0x503527['params']['id']},'attributes':['id','username','password',_0x8eff('0xa1'),_0x8eff('0xa2'),_0x8eff('0xa3'),'clientSecret']})[_0x8eff('0x1b')](handleEntityNotFound(_0x5da127,null))[_0x8eff('0x1b')](function(_0x385589){if(_0x385589){_0x34ca22=_0x385589[_0x8eff('0xa1')];var _0x2c9646=_0x34ca22[_0x8eff('0xa4')](-0x1);if(_0x2c9646==='/'){_0x34ca22=_0x34ca22['substring'](0x0,_0x34ca22[_0x8eff('0xa5')](_0x2c9646));}_0x447698=util['format'](_0x8eff('0xa6'),_0x34ca22);var _0x28f8d2={'method':_0x8eff('0xa7'),'uri':_0x8eff('0xa8')+_0x385589[_0x8eff('0xa2')]+_0x8eff('0xa9'),'form':{'client_id':_0x385589[_0x8eff('0xa3')],'resource':_0x34ca22,'username':_0x385589['username'],'password':_0x385589[_0x8eff('0xaa')],'grant_type':_0x8eff('0xaa'),'client_secret':_0x385589[_0x8eff('0xab')]},'json':!![]};return rp(_0x28f8d2);}})[_0x8eff('0x1b')](function(_0x20db23){_0x5b1f67=_0x20db23['access_token'];var _0x272efe={'method':_0x8eff('0xac'),'uri':encodeURI(_0x447698+_0x8eff('0xad')+_0x47435f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x5b1f67,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x272efe);})[_0x8eff('0x1b')](function(_0x55ac8){var _0xbddba2=_0x55ac8['value'][0x0];var _0x36ae39=_0xbddba2['MetadataId'];var _0x52f6e0={'method':_0x8eff('0xac'),'uri':_0x447698+_0x8eff('0xae')+_0x36ae39+_0x8eff('0xaf'),'headers':{'Authorization':_0x8eff('0xb0')+_0x5b1f67,'If-None-Match':null,'OData-Version':_0x8eff('0xb1')},'json':!![]};return rp(_0x52f6e0);})[_0x8eff('0x1b')](function(_0x354676){_0x4e7cce=_0x354676;_0x15473b=_0x4e7cce[_0x8eff('0xb2')];_0x15473b=_[_0x8eff('0xb3')](_0x15473b,function(_0x2936d8){return!_0x284b0c[_0x8eff('0xb4')](_0x2936d8[_0x8eff('0xb5')]);});var _0x4a7ae5=[];var _0x34a0f7=[];_0x15473b[_0x8eff('0xb6')](function(_0x46e6fe){if(_0x46e6fe[_0x8eff('0xb7')]){var _0x134946=_0x46e6fe['@odata.type'][_0x8eff('0xb8')](_0x46e6fe[_0x8eff('0xb7')][_0x8eff('0xa5')]('.')+0x1);if(_0x134946===_0x8eff('0xb9')){_0x4a7ae5['push'](getSelectList(_0x447698,_0x4642d3,_0x34a0f7,_0x4e7cce['MetadataId'],_0x46e6fe[_0x8eff('0xba')],_0x5b1f67));}}});return Promise[_0x8eff('0xbb')](_0x4a7ae5);})[_0x8eff('0x1b')](function(_0x32d427){_0x3e4212=_0x32d427[0x0];var _0x4944af=[];var _0x43c022=[];_0x15473b[_0x8eff('0xb6')](function(_0x361a71){if(!_[_0x8eff('0xbc')](_0x361a71[_0x8eff('0xb7')])){var _0x44e68a=_0x361a71[_0x8eff('0xb7')][_0x8eff('0xb8')](_0x361a71[_0x8eff('0xb7')]['lastIndexOf']('.')+0x1);if(_0x44e68a===_0x8eff('0xbd')){_0x4944af['push'](getBooleanList(_0x447698,_0x4642d3,_0x43c022,_0x4e7cce[_0x8eff('0xba')],_0x361a71[_0x8eff('0xba')],_0x5b1f67));}}});return Promise[_0x8eff('0xbb')](_0x4944af);})['then'](function(_0x1c11fe){_0x41458b=_0x1c11fe[0x0];var _0x4ff258=[];var _0x1dba3f=[];_0x15473b[_0x8eff('0xb6')](function(_0x5c3222){if(_0x5c3222[_0x8eff('0xb7')]){var _0x159c9f=_0x5c3222[_0x8eff('0xb7')][_0x8eff('0xb8')](_0x5c3222[_0x8eff('0xb7')][_0x8eff('0xa5')]('.')+0x1);if(_0x159c9f==='StringAttributeMetadata'||_0x159c9f===_0x8eff('0xbe')||_0x159c9f===_0x8eff('0xbf')||_0x159c9f===_0x8eff('0xc0')||_0x159c9f==='MemoAttributeMetadata'||_0x159c9f===_0x8eff('0xc1')||_0x159c9f===_0x8eff('0xc2')||_0x159c9f==='EntityNameAttributeMetadata'||_0x159c9f===_0x8eff('0xc3')||_0x159c9f===_0x8eff('0xc4')){_0x4ff258[_0x8eff('0xc5')](getInputList(_0x447698,_0x4642d3,_0x159c9f,_0x1dba3f,_0x4e7cce[_0x8eff('0xba')],_0x5c3222['MetadataId'],_0x5b1f67));}}});return Promise[_0x8eff('0xbb')](_0x4ff258);})['then'](function(_0x359fc6){_0x36248c=_0x359fc6[0x0];var _0x39545d=_0x3e4212[_0x8eff('0xa0')](_0x41458b)[_0x8eff('0xa0')](_0x36248c);var _0x4830a5={'count':_0x39545d[_0x8eff('0x42')],'rows':_0x39545d};return _0x4830a5;})['then'](respondWithResult(_0x5da127,null))[_0x8eff('0x25')](function(_0x430218){var _0x83656f=_0x503527[_0x8eff('0x3c')][_0x8eff('0xc6')]?0x1f4:_0x430218['statusCode']||0x1f4;logger[_0x8eff('0x21')](_0x430218[_0x8eff('0x33')]);delete _0x430218[_0x8eff('0x34')];if(_0x83656f===0x191){_0x83656f=0x190;}_0x5da127[_0x8eff('0x28')](_0x83656f)[_0x8eff('0x35')](_0x503527[_0x8eff('0x3c')][_0x8eff('0xc6')]?{'message':_0x8eff('0xc7'),'statusCode':_0x430218['statusCode']}:_0x430218);});};function getSelectList(_0x1dd4bc,_0x40e299,_0x517b2c,_0x4bf7c1,_0x34f66d,_0x5d9fc3){var _0x534862={'method':_0x8eff('0xac'),'uri':_0x1dd4bc+_0x8eff('0xae')+_0x4bf7c1+')/Attributes('+_0x34f66d+_0x8eff('0xc8')+_0x8eff('0xc9'),'headers':{'Authorization':_0x8eff('0xb0')+_0x5d9fc3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x534862)[_0x8eff('0x1b')](function(_0x35be0a){var _0x5e0cd9=[];var _0x3ea1a2=_0x35be0a[_0x8eff('0xca')][_0x8eff('0xcb')];_0x3ea1a2['forEach'](function(_0x5477c0){_0x5e0cd9['push']({'name':_0x5477c0[_0x8eff('0xcc')][_0x8eff('0xcd')][_0x8eff('0xcc')],'value':String(_0x5477c0[_0x8eff('0xce')])});});var _0x110d8e={'id':_0x40e299+'_'+_0x35be0a[_0x8eff('0xb5')],'name':_0x35be0a[_0x8eff('0xcf')][_0x8eff('0xcd')][_0x8eff('0xcc')],'custom':![],'options':_0x5e0cd9};_0x517b2c[_0x8eff('0xc5')](_0x110d8e);return _0x517b2c;});}function getBooleanList(_0x283756,_0x4d7417,_0x56d0ed,_0x20d135,_0x40c902,_0x1b6e02){var _0x3b4b24={'method':_0x8eff('0xac'),'uri':_0x283756+_0x8eff('0xae')+_0x20d135+_0x8eff('0xd0')+_0x40c902+_0x8eff('0xd1'),'headers':{'Authorization':_0x8eff('0xb0')+_0x1b6e02,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3b4b24)[_0x8eff('0x1b')](function(_0x2fea7d){var _0x57284b=[];_0x57284b[_0x8eff('0xc5')]({'name':_0x2fea7d[_0x8eff('0xca')][_0x8eff('0xd2')]['Label']['UserLocalizedLabel'][_0x8eff('0xcc')],'value':_0x8eff('0xd3')},{'name':_0x2fea7d[_0x8eff('0xca')][_0x8eff('0xd4')][_0x8eff('0xcc')]['UserLocalizedLabel'][_0x8eff('0xcc')],'value':'false'});var _0x50e56b={'id':_0x4d7417+'_'+_0x2fea7d[_0x8eff('0xb5')],'name':_0x2fea7d[_0x8eff('0xcf')][_0x8eff('0xcd')]['Label'],'custom':![],'options':_0x57284b};_0x56d0ed[_0x8eff('0xc5')](_0x50e56b);return _0x56d0ed;});}function getInputList(_0x299f7d,_0xcc942c,_0x41f188,_0x27a3be,_0x2902f0,_0x48e9f3,_0x3eca02){var _0x5c5ea7={'method':_0x8eff('0xac'),'uri':_0x299f7d+_0x8eff('0xae')+_0x2902f0+_0x8eff('0xd0')+_0x48e9f3+_0x8eff('0xd5')+_0x41f188+_0x8eff('0xd6'),'headers':{'Authorization':_0x8eff('0xb0')+_0x3eca02,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c5ea7)['then'](function(_0x2a5adc){var _0xaefae6={'id':_0xcc942c+'_'+_0x2a5adc[_0x8eff('0xb5')],'name':_0x2a5adc[_0x8eff('0xcf')][_0x8eff('0xcd')]?_0x2a5adc['DisplayName'][_0x8eff('0xcd')][_0x8eff('0xcc')]:_0x2a5adc[_0x8eff('0xb5')],'custom':![],'options':[]};_0x27a3be['push'](_0xaefae6);return _0x27a3be;});} \ No newline at end of file +var _0x71ab=['createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','remoteUri','substring','lastIndexOf','%s/api/data/v9.0/','POST','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','index','Dynamics365Account','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','find','create','body','getConfigurations','findOne','nolimit','AccountId','getSubjects','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','Subjects','Descriptions','getFields','Incident','PhoneCall','description','customerid','caseorigincode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb71a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb71a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb71a('0x2'));var moment=require(_0xb71a('0x3'));var BPromise=require(_0xb71a('0x4'));var Mustache=require(_0xb71a('0x5'));var util=require(_0xb71a('0x6'));var path=require(_0xb71a('0x7'));var sox=require(_0xb71a('0x8'));var csv=require(_0xb71a('0x9'));var ejs=require(_0xb71a('0xa'));var fs=require('fs');var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x9'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb71a('0x19')][_0xb71a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x315ca8,_0xd8d3ae,_0x483d77,_0x47ee48){return new BPromise(function(_0x5364e3,_0x12900a){var _0xc189cd=_0x47ee48||client;return _0xc189cd[_0xb71a('0x1b')](_0x315ca8,_0x483d77)[_0xb71a('0x1c')](function(_0x3cd0f0){logger[_0xb71a('0x1d')](_0xb71a('0x1e'),_0xd8d3ae,_0xb71a('0x1f'));logger[_0xb71a('0x20')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xd8d3ae,_0xb71a('0x1f'),JSON[_0xb71a('0x21')](_0x3cd0f0));if(_0x3cd0f0[_0xb71a('0x22')]){if(_0x3cd0f0[_0xb71a('0x22')][_0xb71a('0x23')]===0x1f4){logger[_0xb71a('0x22')](_0xb71a('0x1e'),_0xd8d3ae,_0x3cd0f0[_0xb71a('0x22')][_0xb71a('0x24')]);return _0x12900a(_0x3cd0f0[_0xb71a('0x22')][_0xb71a('0x24')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0xd8d3ae,_0x3cd0f0[_0xb71a('0x22')][_0xb71a('0x24')]);return _0x5364e3(_0x3cd0f0['error']['message']);}else{logger[_0xb71a('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0xd8d3ae,_0xb71a('0x1f'));_0x5364e3(_0x3cd0f0[_0xb71a('0x25')][_0xb71a('0x24')]);}})[_0xb71a('0x26')](function(_0x38a728){logger[_0xb71a('0x22')](_0xb71a('0x1e'),_0xd8d3ae,_0x38a728);_0x12900a(_0x38a728);});});}function respondWithStatusCode(_0x14aac7,_0x5f3f19){_0x5f3f19=_0x5f3f19||0xcc;return function(_0xd40f86){if(_0xd40f86){return _0x14aac7[_0xb71a('0x27')](_0x5f3f19);}return _0x14aac7[_0xb71a('0x28')](_0x5f3f19)[_0xb71a('0x29')]();};}function respondWithResult(_0x3401f7,_0x1a010d){_0x1a010d=_0x1a010d||0xc8;return function(_0x20ed75){if(_0x20ed75){return _0x3401f7[_0xb71a('0x28')](_0x1a010d)[_0xb71a('0x2a')](_0x20ed75);}};}function respondWithFilteredResult(_0x2a847a,_0x45b849){return function(_0x17f8b2){if(_0x17f8b2){var _0x160f0f=_0x17f8b2[_0xb71a('0x2b')],_0x5ae0ed=_0x45b849[_0xb71a('0x2c')],_0x2e8ea6=_0x45b849[_0xb71a('0x2c')]+_0x45b849[_0xb71a('0x2d')],_0x39d874;if(_0x2e8ea6>=_0x160f0f){_0x2e8ea6=_0x160f0f;_0x39d874=0xc8;}else{_0x39d874=0xce;}_0x2a847a[_0xb71a('0x28')](_0x39d874);return _0x2a847a[_0xb71a('0x2e')](_0xb71a('0x2f'),_0x5ae0ed+'-'+_0x2e8ea6+'/'+_0x160f0f)[_0xb71a('0x2a')](_0x17f8b2);}return null;};}function patchUpdates(_0xcb40fc){return function(_0x542ffd){try{jsonpatch['apply'](_0x542ffd,_0xcb40fc,!![]);}catch(_0x3112d3){return BPromise['reject'](_0x3112d3);}return _0x542ffd[_0xb71a('0x30')]();};}function saveUpdates(_0x1b1aa8,_0x4d9e1a){return function(_0x147014){if(_0x147014){return _0x147014[_0xb71a('0x31')](_0x1b1aa8)[_0xb71a('0x1c')](function(_0x251d82){return _0x251d82;});}return null;};}function removeEntity(_0x3d3d81,_0x2364c3){return function(_0x5dd779){if(_0x5dd779){return _0x5dd779[_0xb71a('0x32')]()[_0xb71a('0x1c')](function(){_0x3d3d81[_0xb71a('0x28')](0xcc)[_0xb71a('0x29')]();});}};}function handleEntityNotFound(_0x5a0334,_0x2ea22a){return function(_0x140c25){if(!_0x140c25){_0x5a0334[_0xb71a('0x27')](0x194);}return _0x140c25;};}function handleError(_0x3db4e0,_0x1ec701){_0x1ec701=_0x1ec701||0x1f4;return function(_0x3d93fc){logger[_0xb71a('0x22')](_0x3d93fc[_0xb71a('0x33')]);if(_0x3d93fc[_0xb71a('0x34')]){delete _0x3d93fc[_0xb71a('0x34')];}_0x3db4e0['status'](_0x1ec701)['send'](_0x3d93fc);};}exports[_0xb71a('0x35')]=function(_0x18cc6a,_0x2fd09e){var _0x12b907={},_0xb5d842={},_0x247540={'count':0x0,'rows':[]};var _0x394b4f=_['map'](db[_0xb71a('0x36')]['rawAttributes'],function(_0x3143c9){return{'name':_0x3143c9[_0xb71a('0x37')],'type':_0x3143c9[_0xb71a('0x38')][_0xb71a('0x39')]};});_0xb5d842['model']=_[_0xb71a('0x3a')](_0x394b4f,_0xb71a('0x34'));_0xb5d842[_0xb71a('0x3b')]=_[_0xb71a('0x3c')](_0x18cc6a[_0xb71a('0x3b')]);_0xb5d842[_0xb71a('0x3d')]=_[_0xb71a('0x3e')](_0xb5d842[_0xb71a('0x3f')],_0xb5d842[_0xb71a('0x3b')]);_0x12b907['attributes']=_[_0xb71a('0x3e')](_0xb5d842['model'],qs[_0xb71a('0x40')](_0x18cc6a[_0xb71a('0x3b')][_0xb71a('0x40')]));_0x12b907[_0xb71a('0x41')]=_0x12b907[_0xb71a('0x41')][_0xb71a('0x42')]?_0x12b907['attributes']:_0xb5d842['model'];if(!_0x18cc6a['query'][_0xb71a('0x43')]('nolimit')){_0x12b907[_0xb71a('0x2d')]=qs[_0xb71a('0x2d')](_0x18cc6a[_0xb71a('0x3b')][_0xb71a('0x2d')]);_0x12b907[_0xb71a('0x2c')]=qs[_0xb71a('0x2c')](_0x18cc6a['query'][_0xb71a('0x2c')]);}_0x12b907[_0xb71a('0x44')]=qs[_0xb71a('0x45')](_0x18cc6a[_0xb71a('0x3b')][_0xb71a('0x45')]);_0x12b907[_0xb71a('0x46')]=qs['filters'](_[_0xb71a('0x47')](_0x18cc6a[_0xb71a('0x3b')],_0xb5d842[_0xb71a('0x3d')]),_0x394b4f);if(_0x18cc6a[_0xb71a('0x3b')][_0xb71a('0x48')]){_0x12b907[_0xb71a('0x46')]=_[_0xb71a('0x49')](_0x12b907['where'],{'$or':_['map'](_0x394b4f,function(_0x2442f5){if(_0x2442f5[_0xb71a('0x38')]!==_0xb71a('0x4a')){var _0x273964={};_0x273964[_0x2442f5['name']]={'$like':'%'+_0x18cc6a[_0xb71a('0x3b')]['filter']+'%'};return _0x273964;}})});}_0x12b907=_[_0xb71a('0x49')]({},_0x12b907,_0x18cc6a[_0xb71a('0x4b')]);var _0x58e039={'where':_0x12b907[_0xb71a('0x46')]};return db[_0xb71a('0x36')][_0xb71a('0x2b')](_0x58e039)[_0xb71a('0x1c')](function(_0x4b1556){_0x247540[_0xb71a('0x2b')]=_0x4b1556;if(_0x18cc6a[_0xb71a('0x3b')][_0xb71a('0x4c')]){_0x12b907['include']=[{'all':!![]}];}return db[_0xb71a('0x36')][_0xb71a('0x4d')](_0x12b907);})[_0xb71a('0x1c')](function(_0x5e9eea){_0x247540[_0xb71a('0x4e')]=_0x5e9eea;return _0x247540;})[_0xb71a('0x1c')](respondWithFilteredResult(_0x2fd09e,_0x12b907))[_0xb71a('0x26')](handleError(_0x2fd09e,null));};exports[_0xb71a('0x4f')]=function(_0x365bed,_0x550a67){var _0x1d876a={'raw':![],'where':{'id':_0x365bed[_0xb71a('0x50')]['id']}},_0x44f610={};_0x44f610[_0xb71a('0x3f')]=_['keys'](db['Dynamics365Account'][_0xb71a('0x51')]);_0x44f610[_0xb71a('0x3b')]=_[_0xb71a('0x3c')](_0x365bed[_0xb71a('0x3b')]);_0x44f610[_0xb71a('0x3d')]=_[_0xb71a('0x3e')](_0x44f610[_0xb71a('0x3f')],_0x44f610[_0xb71a('0x3b')]);_0x1d876a[_0xb71a('0x41')]=_[_0xb71a('0x3e')](_0x44f610['model'],qs[_0xb71a('0x40')](_0x365bed[_0xb71a('0x3b')]['fields']));_0x1d876a[_0xb71a('0x41')]=_0x1d876a['attributes'][_0xb71a('0x42')]?_0x1d876a[_0xb71a('0x41')]:_0x44f610[_0xb71a('0x3f')];if(_0x365bed[_0xb71a('0x3b')][_0xb71a('0x4c')]){_0x1d876a['include']=[{'all':!![]}];}_0x1d876a=_[_0xb71a('0x49')]({},_0x1d876a,_0x365bed['options']);return db[_0xb71a('0x36')][_0xb71a('0x52')](_0x1d876a)['then'](handleEntityNotFound(_0x550a67,null))['then'](respondWithResult(_0x550a67,null))[_0xb71a('0x26')](handleError(_0x550a67,null));};exports[_0xb71a('0x53')]=function(_0x4ef963,_0x4bc5f3){return db['Dynamics365Account'][_0xb71a('0x53')](_0x4ef963['body'],{})['then'](respondWithResult(_0x4bc5f3,0xc9))[_0xb71a('0x26')](handleError(_0x4bc5f3,null));};exports[_0xb71a('0x31')]=function(_0xf029f7,_0x2744f9){if(_0xf029f7['body']['id']){delete _0xf029f7[_0xb71a('0x54')]['id'];}return db[_0xb71a('0x36')][_0xb71a('0x52')]({'where':{'id':_0xf029f7['params']['id']}})[_0xb71a('0x1c')](handleEntityNotFound(_0x2744f9,null))[_0xb71a('0x1c')](saveUpdates(_0xf029f7['body'],null))[_0xb71a('0x1c')](respondWithResult(_0x2744f9,null))[_0xb71a('0x26')](handleError(_0x2744f9,null));};exports[_0xb71a('0x32')]=function(_0x531d75,_0x43c310){return db['Dynamics365Account'][_0xb71a('0x52')]({'where':{'id':_0x531d75[_0xb71a('0x50')]['id']}})['then'](handleEntityNotFound(_0x43c310,null))[_0xb71a('0x1c')](removeEntity(_0x43c310,null))[_0xb71a('0x26')](handleError(_0x43c310,null));};exports[_0xb71a('0x55')]=function(_0x1c6312,_0x41a1fc,_0x3b6762){var _0x3dfd97={};var _0x535ab6={};var _0x581b75;var _0x19c72d;return db[_0xb71a('0x36')][_0xb71a('0x56')]({'where':{'id':_0x1c6312[_0xb71a('0x50')]['id']}})[_0xb71a('0x1c')](handleEntityNotFound(_0x41a1fc,null))['then'](function(_0x5a45df){if(_0x5a45df){_0x581b75=_0x5a45df;_0x535ab6[_0xb71a('0x3f')]=_[_0xb71a('0x3c')](db['Dynamics365Configuration'][_0xb71a('0x51')]);_0x535ab6[_0xb71a('0x3b')]=_['keys'](_0x1c6312[_0xb71a('0x3b')]);_0x535ab6[_0xb71a('0x3d')]=_[_0xb71a('0x3e')](_0x535ab6[_0xb71a('0x3f')],_0x535ab6['query']);_0x3dfd97[_0xb71a('0x41')]=_[_0xb71a('0x3e')](_0x535ab6['model'],qs[_0xb71a('0x40')](_0x1c6312[_0xb71a('0x3b')][_0xb71a('0x40')]));_0x3dfd97[_0xb71a('0x41')]=_0x3dfd97[_0xb71a('0x41')][_0xb71a('0x42')]?_0x3dfd97[_0xb71a('0x41')]:_0x535ab6[_0xb71a('0x3f')];_0x3dfd97['order']=qs[_0xb71a('0x45')](_0x1c6312[_0xb71a('0x3b')]['sort']);_0x3dfd97[_0xb71a('0x46')]=qs[_0xb71a('0x3d')](_['pick'](_0x1c6312[_0xb71a('0x3b')],_0x535ab6[_0xb71a('0x3d')]));if(_0x1c6312[_0xb71a('0x3b')][_0xb71a('0x48')]){_0x3dfd97[_0xb71a('0x46')]=_[_0xb71a('0x49')](_0x3dfd97['where'],{'$or':_['map'](_0x3dfd97[_0xb71a('0x41')],function(_0x155925){var _0x6fefb8={};_0x6fefb8[_0x155925]={'$like':'%'+_0x1c6312['query'][_0xb71a('0x48')]+'%'};return _0x6fefb8;})});}_0x3dfd97=_['merge']({},_0x3dfd97,_0x1c6312[_0xb71a('0x4b')]);return _0x581b75['getConfigurations'](_0x3dfd97);}})['then'](function(_0x3b6b5e){if(_0x3b6b5e){_0x19c72d=_0x3b6b5e[_0xb71a('0x42')];if(!_0x1c6312[_0xb71a('0x3b')][_0xb71a('0x43')](_0xb71a('0x57'))){_0x3dfd97['limit']=qs[_0xb71a('0x2d')](_0x1c6312['query'][_0xb71a('0x2d')]);_0x3dfd97[_0xb71a('0x2c')]=qs[_0xb71a('0x2c')](_0x1c6312['query']['offset']);}return _0x581b75[_0xb71a('0x55')](_0x3dfd97);}})[_0xb71a('0x1c')](function(_0x1a96fc){if(_0x1a96fc){return _0x1a96fc?{'count':_0x19c72d,'rows':_0x1a96fc}:null;}})[_0xb71a('0x1c')](respondWithResult(_0x41a1fc,null))[_0xb71a('0x26')](handleError(_0x41a1fc,null));};exports['addConfiguration']=function(_0x210fa0,_0x35d932,_0x1063ab){if(_0x210fa0[_0xb71a('0x54')]['id']){delete _0x210fa0[_0xb71a('0x54')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x210fa0[_0xb71a('0x50')]['id']}})[_0xb71a('0x1c')](handleEntityNotFound(_0x35d932,null))[_0xb71a('0x1c')](function(_0x3a39be){if(_0x3a39be){_0x210fa0[_0xb71a('0x54')][_0xb71a('0x58')]=_0x3a39be['id'];_0x210fa0[_0xb71a('0x54')]['Subjects']=integrations[_0xb71a('0x59')](_0x210fa0[_0xb71a('0x54')]['channel'],_0x210fa0[_0xb71a('0x54')][_0xb71a('0x38')]);_0x210fa0[_0xb71a('0x54')]['Descriptions']=integrations[_0xb71a('0x5a')](_0x210fa0[_0xb71a('0x54')][_0xb71a('0x5b')],_0x210fa0['body'][_0xb71a('0x38')]);return db[_0xb71a('0x5c')][_0xb71a('0x53')](_0x210fa0[_0xb71a('0x54')],{'include':[{'model':db[_0xb71a('0x5d')],'as':_0xb71a('0x5e')},{'model':db[_0xb71a('0x5d')],'as':_0xb71a('0x5f')}]});}return null;})['then'](respondWithResult(_0x35d932,null))[_0xb71a('0x26')](handleError(_0x35d932,null));};exports[_0xb71a('0x60')]=function(_0x57896d,_0x30d36a,_0x43e4b8){var _0x2cf441=_0x57896d[_0xb71a('0x3b')]['ticketType'];var _0x1f1e3c=_0x2cf441==='incident'?_0xb71a('0x61'):_0xb71a('0x62');var _0x5e9964='';var _0x2aaaa1='';var _0x4edc77='';var _0x15995f='';var _0x48ca02='';var _0x597e45='';var _0x1ed79c='';var _0x208585='';var _0x2fd9be=['title',_0xb71a('0x63'),_0xb71a('0x64'),'ownerid',_0xb71a('0x65'),'subject','phonenumber','regardingobjectid','directioncode',_0xb71a('0x66')];var _0x1e27ff=[_0xb71a('0x67'),'accountidyominame',_0xb71a('0x68'),_0xb71a('0x69'),'contactidname',_0xb71a('0x6a'),_0xb71a('0x6b'),_0xb71a('0x6c'),_0xb71a('0x6d'),_0xb71a('0x6e'),_0xb71a('0x6f'),'createdbyyominame',_0xb71a('0x70'),_0xb71a('0x71'),_0xb71a('0x72'),_0xb71a('0x73'),_0xb71a('0x74'),_0xb71a('0x75'),'emailaddress',_0xb71a('0x76'),_0xb71a('0x77'),'entityimage_url',_0xb71a('0x78'),_0xb71a('0x79'),_0xb71a('0x7a'),'followupby',_0xb71a('0x7b'),_0xb71a('0x7c'),_0xb71a('0x7d'),'lastonholdtime',_0xb71a('0x7e'),_0xb71a('0x7f'),'modifiedbyexternalpartyyominame',_0xb71a('0x80'),_0xb71a('0x81'),_0xb71a('0x82'),_0xb71a('0x83'),'modifiedonbehalfbyyominame',_0xb71a('0x84'),_0xb71a('0x85'),_0xb71a('0x86'),_0xb71a('0x87'),'overriddencreatedon',_0xb71a('0x88'),_0xb71a('0x89'),'owneridyominame',_0xb71a('0x8a'),_0xb71a('0x8b'),'primarycontactidyominame',_0xb71a('0x8c'),_0xb71a('0x8d'),_0xb71a('0x8e'),'resolveby',_0xb71a('0x8f'),_0xb71a('0x90'),_0xb71a('0x91'),_0xb71a('0x92'),_0xb71a('0x93'),_0xb71a('0x94'),_0xb71a('0x95'),_0xb71a('0x96'),_0xb71a('0x97'),'statuscode','subjectidname',_0xb71a('0x98'),_0xb71a('0x99'),_0xb71a('0x9a'),_0xb71a('0x9b'),_0xb71a('0x9c'),_0xb71a('0x9d')];var _0x4c8f6a=_0x2fd9be[_0xb71a('0x9e')](_0x1e27ff);return db['Dynamics365Account'][_0xb71a('0x56')]({'where':{'id':_0x57896d['params']['id']},'attributes':['id',_0xb71a('0x9f'),_0xb71a('0xa0'),'remoteUri',_0xb71a('0xa1'),_0xb71a('0xa2'),_0xb71a('0xa3')]})[_0xb71a('0x1c')](handleEntityNotFound(_0x30d36a,null))[_0xb71a('0x1c')](function(_0x49146b){if(_0x49146b){_0x208585=_0x49146b[_0xb71a('0xa4')];var _0x3807e6=_0x208585['slice'](-0x1);if(_0x3807e6==='/'){_0x208585=_0x208585[_0xb71a('0xa5')](0x0,_0x208585[_0xb71a('0xa6')](_0x3807e6));}_0x1ed79c=util['format'](_0xb71a('0xa7'),_0x208585);var _0x2e076f={'method':_0xb71a('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x49146b[_0xb71a('0xa1')]+_0xb71a('0xa9'),'form':{'client_id':_0x49146b[_0xb71a('0xa2')],'resource':_0x208585,'username':_0x49146b['username'],'password':_0x49146b[_0xb71a('0xa0')],'grant_type':_0xb71a('0xa0'),'client_secret':_0x49146b[_0xb71a('0xa3')]},'json':!![]};return rp(_0x2e076f);}})[_0xb71a('0x1c')](function(_0x3d5f08){_0x597e45=_0x3d5f08['access_token'];var _0x776789={'method':'GET','uri':encodeURI(_0x1ed79c+_0xb71a('0xaa')+_0x1f1e3c+'\x27'),'headers':{'Authorization':_0xb71a('0xab')+_0x597e45,'If-None-Match':null,'OData-Version':_0xb71a('0xac')},'json':!![]};return rp(_0x776789);})['then'](function(_0x589618){var _0x77dc7=_0x589618[_0xb71a('0xad')][0x0];var _0x1bd375=_0x77dc7[_0xb71a('0xae')];var _0xae63ed={'method':_0xb71a('0xaf'),'uri':_0x1ed79c+_0xb71a('0xb0')+_0x1bd375+_0xb71a('0xb1'),'headers':{'Authorization':_0xb71a('0xab')+_0x597e45,'If-None-Match':null,'OData-Version':_0xb71a('0xac')},'json':!![]};return rp(_0xae63ed);})[_0xb71a('0x1c')](function(_0x3a656f){_0x5e9964=_0x3a656f;_0x2aaaa1=_0x5e9964[_0xb71a('0xb2')];_0x2aaaa1=_[_0xb71a('0xb3')](_0x2aaaa1,function(_0x464da5){return!_0x4c8f6a['includes'](_0x464da5[_0xb71a('0xb4')]);});var _0x231e05=[];var _0x243c90=[];_0x2aaaa1['forEach'](function(_0x4c1003){if(_0x4c1003['@odata.type']){var _0x14f671=_0x4c1003['@odata.type'][_0xb71a('0xa5')](_0x4c1003[_0xb71a('0xb5')]['lastIndexOf']('.')+0x1);if(_0x14f671==='PicklistAttributeMetadata'){_0x231e05[_0xb71a('0xb6')](getSelectList(_0x1ed79c,_0x2cf441,_0x243c90,_0x5e9964[_0xb71a('0xae')],_0x4c1003[_0xb71a('0xae')],_0x597e45));}}});return Promise[_0xb71a('0xb7')](_0x231e05);})[_0xb71a('0x1c')](function(_0x86854b){_0x4edc77=_0x86854b[0x0];var _0x1afba9=[];var _0x28d4cf=[];_0x2aaaa1[_0xb71a('0xb8')](function(_0x41398e){if(!_[_0xb71a('0xb9')](_0x41398e[_0xb71a('0xb5')])){var _0x257be5=_0x41398e[_0xb71a('0xb5')][_0xb71a('0xa5')](_0x41398e[_0xb71a('0xb5')][_0xb71a('0xa6')]('.')+0x1);if(_0x257be5===_0xb71a('0xba')){_0x1afba9[_0xb71a('0xb6')](getBooleanList(_0x1ed79c,_0x2cf441,_0x28d4cf,_0x5e9964[_0xb71a('0xae')],_0x41398e[_0xb71a('0xae')],_0x597e45));}}});return Promise[_0xb71a('0xb7')](_0x1afba9);})['then'](function(_0x277ea6){_0x15995f=_0x277ea6[0x0];var _0x466ab8=[];var _0x31538a=[];_0x2aaaa1[_0xb71a('0xb8')](function(_0x153b07){if(_0x153b07[_0xb71a('0xb5')]){var _0x180c94=_0x153b07[_0xb71a('0xb5')][_0xb71a('0xa5')](_0x153b07[_0xb71a('0xb5')][_0xb71a('0xa6')]('.')+0x1);if(_0x180c94===_0xb71a('0xbb')||_0x180c94===_0xb71a('0xbc')||_0x180c94===_0xb71a('0xbd')||_0x180c94===_0xb71a('0xbe')||_0x180c94===_0xb71a('0xbf')||_0x180c94===_0xb71a('0xc0')||_0x180c94===_0xb71a('0xc1')||_0x180c94===_0xb71a('0xc2')||_0x180c94===_0xb71a('0xc3')||_0x180c94==='DecimalAttributeMetadata'){_0x466ab8[_0xb71a('0xb6')](getInputList(_0x1ed79c,_0x2cf441,_0x180c94,_0x31538a,_0x5e9964[_0xb71a('0xae')],_0x153b07[_0xb71a('0xae')],_0x597e45));}}});return Promise[_0xb71a('0xb7')](_0x466ab8);})[_0xb71a('0x1c')](function(_0x1f4dd8){_0x48ca02=_0x1f4dd8[0x0];var _0x3f7199=_0x4edc77[_0xb71a('0x9e')](_0x15995f)['concat'](_0x48ca02);var _0x5e899b={'count':_0x3f7199[_0xb71a('0x42')],'rows':_0x3f7199};return _0x5e899b;})[_0xb71a('0x1c')](respondWithResult(_0x30d36a,null))[_0xb71a('0x26')](function(_0x902104){var _0x4fabbc=_0x57896d[_0xb71a('0x3b')][_0xb71a('0xc4')]?0x1f4:_0x902104[_0xb71a('0xc5')]||0x1f4;logger[_0xb71a('0x22')](_0x902104[_0xb71a('0x33')]);delete _0x902104[_0xb71a('0x34')];if(_0x4fabbc===0x191){_0x4fabbc=0x190;}_0x30d36a[_0xb71a('0x28')](_0x4fabbc)['send'](_0x57896d[_0xb71a('0x3b')][_0xb71a('0xc4')]?{'message':_0xb71a('0xc6'),'statusCode':_0x902104['statusCode']}:_0x902104);});};function getSelectList(_0x2eb870,_0xad3731,_0x3007f3,_0x51a202,_0x2b59d3,_0x398cda){var _0x149799={'method':_0xb71a('0xaf'),'uri':_0x2eb870+'EntityDefinitions('+_0x51a202+_0xb71a('0xc7')+_0x2b59d3+_0xb71a('0xc8')+_0xb71a('0xc9'),'headers':{'Authorization':_0xb71a('0xab')+_0x398cda,'If-None-Match':null,'OData-Version':_0xb71a('0xac')},'json':!![]};return rp(_0x149799)['then'](function(_0x18ad17){var _0x125473=[];var _0x1618d4=_0x18ad17[_0xb71a('0xca')][_0xb71a('0xcb')];_0x1618d4[_0xb71a('0xb8')](function(_0x4dc96e){_0x125473[_0xb71a('0xb6')]({'name':_0x4dc96e[_0xb71a('0xcc')]['UserLocalizedLabel'][_0xb71a('0xcc')],'value':String(_0x4dc96e[_0xb71a('0xcd')])});});var _0x229064={'id':_0xad3731+'_'+_0x18ad17[_0xb71a('0xb4')],'name':_0x18ad17[_0xb71a('0xce')][_0xb71a('0xcf')][_0xb71a('0xcc')],'custom':![],'options':_0x125473};_0x3007f3[_0xb71a('0xb6')](_0x229064);return _0x3007f3;});}function getBooleanList(_0x3e0d64,_0x13c582,_0x45405c,_0x14e6aa,_0x37321c,_0x629b99){var _0x110de6={'method':_0xb71a('0xaf'),'uri':_0x3e0d64+_0xb71a('0xb0')+_0x14e6aa+_0xb71a('0xc7')+_0x37321c+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x629b99,'If-None-Match':null,'OData-Version':_0xb71a('0xac')},'json':!![]};return rp(_0x110de6)[_0xb71a('0x1c')](function(_0x4f9e31){var _0x181315=[];_0x181315[_0xb71a('0xb6')]({'name':_0x4f9e31[_0xb71a('0xca')][_0xb71a('0xd0')][_0xb71a('0xcc')][_0xb71a('0xcf')][_0xb71a('0xcc')],'value':_0xb71a('0xd1')},{'name':_0x4f9e31[_0xb71a('0xca')][_0xb71a('0xd2')][_0xb71a('0xcc')][_0xb71a('0xcf')][_0xb71a('0xcc')],'value':'false'});var _0x3a0770={'id':_0x13c582+'_'+_0x4f9e31['LogicalName'],'name':_0x4f9e31[_0xb71a('0xce')][_0xb71a('0xcf')]['Label'],'custom':![],'options':_0x181315};_0x45405c[_0xb71a('0xb6')](_0x3a0770);return _0x45405c;});}function getInputList(_0x3c9695,_0x4efa9b,_0xbfcb01,_0x423dcf,_0x1eb26c,_0x8e19f7,_0x96ac3c){var _0x2dc52d={'method':_0xb71a('0xaf'),'uri':_0x3c9695+_0xb71a('0xb0')+_0x1eb26c+_0xb71a('0xc7')+_0x8e19f7+_0xb71a('0xd3')+_0xbfcb01+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xb71a('0xab')+_0x96ac3c,'If-None-Match':null,'OData-Version':_0xb71a('0xac')},'json':!![]};return rp(_0x2dc52d)['then'](function(_0xd64fa5){var _0xcb3ad7={'id':_0x4efa9b+'_'+_0xd64fa5['LogicalName'],'name':_0xd64fa5[_0xb71a('0xce')]['UserLocalizedLabel']?_0xd64fa5[_0xb71a('0xce')][_0xb71a('0xcf')]['Label']:_0xd64fa5[_0xb71a('0xb4')],'custom':![],'options':[]};_0x423dcf[_0xb71a('0xb6')](_0xcb3ad7);return _0x423dcf;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b06aaf6..10252e8 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 _0x8c63=['./intDynamics365Account.attributes','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1058ef,_0x3b1acc){var _0x4ab44a=function(_0x545889){while(--_0x545889){_0x1058ef['push'](_0x1058ef['shift']());}};_0x4ab44a(++_0x3b1acc);}(_0x8c63,0x163));var _0x38c6=function(_0x5c58c7,_0x35da9b){_0x5c58c7=_0x5c58c7-0x0;var _0x56b137=_0x8c63[_0x5c58c7];return _0x56b137;};'use strict';var _=require(_0x38c6('0x0'));var util=require(_0x38c6('0x1'));var logger=require(_0x38c6('0x2'))(_0x38c6('0x3'));var moment=require(_0x38c6('0x4'));var BPromise=require(_0x38c6('0x5'));var rp=require(_0x38c6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38c6('0x7'));var config=require('../../config/environment');var attributes=require(_0x38c6('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1db96d,_0x485896){return _0x1db96d['define'](_0x38c6('0x9'),attributes,{'tableName':_0x38c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52b6=['Dynamics365Account','int_dynamics365_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','exports','define'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x52b6,0xda));var _0x652b=function(_0x119474,_0x28b89a){_0x119474=_0x119474-0x0;var _0x4970db=_0x52b6[_0x119474];return _0x4970db;};'use strict';var _=require(_0x652b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x652b('0x1'));var moment=require(_0x652b('0x2'));var BPromise=require(_0x652b('0x3'));var rp=require(_0x652b('0x4'));var fs=require('fs');var path=require(_0x652b('0x5'));var rimraf=require(_0x652b('0x6'));var config=require('../../config/environment');var attributes=require(_0x652b('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x652b('0x8')]=function(_0x2f05c3,_0x57371a){return _0x2f05c3[_0x652b('0x9')](_0x652b('0xa'),attributes,{'tableName':_0x652b('0xb'),'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 d2e6bb0..c48fb8a 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 _0x99a0=['code','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','GetDynamics365Account','ShowDynamics365Account','find','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x506062,_0x3a4c6e){var _0x2d9b24=function(_0x3e9c51){while(--_0x3e9c51){_0x506062['push'](_0x506062['shift']());}};_0x2d9b24(++_0x3a4c6e);}(_0x99a0,0x121));var _0x099a=function(_0xbc99f6,_0x2ec952){_0xbc99f6=_0xbc99f6-0x0;var _0x2f6fa3=_0x99a0[_0xbc99f6];return _0x2f6fa3;};'use strict';var _=require(_0x099a('0x0'));var util=require(_0x099a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x099a('0x2'))['db'];var utils=require(_0x099a('0x3'));var logger=require('../../config/logger')(_0x099a('0x4'));var config=require(_0x099a('0x5'));var jayson=require(_0x099a('0x6'));var client=jayson[_0x099a('0x7')][_0x099a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaebf62,_0x5a5de5,_0x18f862){return new BPromise(function(_0x2da8c8,_0x268440){return client['request'](_0xaebf62,_0x18f862)[_0x099a('0x9')](function(_0x29255d){logger[_0x099a('0xa')](_0x099a('0xb'),_0x5a5de5,_0x099a('0xc'));logger[_0x099a('0xd')](_0x099a('0xe'),_0x5a5de5,_0x099a('0xc'),JSON[_0x099a('0xf')](_0x29255d));if(_0x29255d[_0x099a('0x10')]){if(_0x29255d[_0x099a('0x10')][_0x099a('0x11')]===0x1f4){logger[_0x099a('0x10')](_0x099a('0xb'),_0x5a5de5,_0x29255d[_0x099a('0x10')]['message']);return _0x268440(_0x29255d[_0x099a('0x10')]['message']);}logger[_0x099a('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x5a5de5,_0x29255d[_0x099a('0x10')][_0x099a('0x12')]);return _0x2da8c8(_0x29255d[_0x099a('0x10')][_0x099a('0x12')]);}else{logger[_0x099a('0xa')](_0x099a('0xb'),_0x5a5de5,'request\x20sent');_0x2da8c8(_0x29255d[_0x099a('0x13')][_0x099a('0x12')]);}})[_0x099a('0x14')](function(_0x371af7){logger['error'](_0x099a('0xb'),_0x5a5de5,_0x371af7);_0x268440(_0x371af7);});});}exports['GetDynamics365Account']=function(_0x1d3924){var _0x26bf41=this;return new Promise(function(_0x295e92,_0x538588){return db[_0x099a('0x15')][_0x099a('0x16')]({'raw':_0x1d3924[_0x099a('0x17')]?_0x1d3924[_0x099a('0x17')][_0x099a('0x18')]===undefined?!![]:![]:!![],'where':_0x1d3924['options']?_0x1d3924['options'][_0x099a('0x19')]||null:null,'attributes':_0x1d3924[_0x099a('0x17')]?_0x1d3924[_0x099a('0x17')][_0x099a('0x1a')]||null:null,'limit':_0x1d3924[_0x099a('0x17')]?_0x1d3924[_0x099a('0x17')][_0x099a('0x1b')]||null:null,'include':_0x1d3924[_0x099a('0x17')]?_0x1d3924['options']['include']?_[_0x099a('0x1c')](_0x1d3924[_0x099a('0x17')][_0x099a('0x1d')],function(_0x7cd361){return{'model':db[_0x7cd361[_0x099a('0x1e')]],'as':_0x7cd361['as'],'attributes':_0x7cd361[_0x099a('0x1a')],'include':_0x7cd361[_0x099a('0x1d')]?_[_0x099a('0x1c')](_0x7cd361[_0x099a('0x1d')],function(_0x42ee18){return{'model':db[_0x42ee18[_0x099a('0x1e')]],'as':_0x42ee18['as'],'attributes':_0x42ee18['attributes'],'include':_0x42ee18[_0x099a('0x1d')]?_['map'](_0x42ee18[_0x099a('0x1d')],function(_0x39f520){return{'model':db[_0x39f520[_0x099a('0x1e')]],'as':_0x39f520['as'],'attributes':_0x39f520['attributes']};}):[]};}):[]};}):[]:[]})[_0x099a('0x9')](function(_0x1101aa){logger[_0x099a('0xa')]('GetDynamics365Account',_0x1d3924);logger['debug']('GetDynamics365Account',_0x1d3924,JSON[_0x099a('0xf')](_0x1101aa));_0x295e92(_0x1101aa);})[_0x099a('0x14')](function(_0x4a1663){logger[_0x099a('0x10')](_0x099a('0x1f'),_0x4a1663[_0x099a('0x12')],_0x1d3924);_0x538588(_0x26bf41[_0x099a('0x10')](0x1f4,_0x4a1663[_0x099a('0x12')]));});});};exports[_0x099a('0x20')]=function(_0x57d1f3){var _0x49c257=this;return new Promise(function(_0x406232,_0x41b983){return db[_0x099a('0x15')][_0x099a('0x21')]({'raw':_0x57d1f3[_0x099a('0x17')]?_0x57d1f3[_0x099a('0x17')][_0x099a('0x18')]===undefined?!![]:![]:!![],'where':_0x57d1f3['options']?_0x57d1f3[_0x099a('0x17')][_0x099a('0x19')]||null:null,'attributes':_0x57d1f3[_0x099a('0x17')]?_0x57d1f3[_0x099a('0x17')][_0x099a('0x1a')]||null:null,'include':_0x57d1f3[_0x099a('0x17')]?_0x57d1f3['options'][_0x099a('0x1d')]?_['map'](_0x57d1f3[_0x099a('0x17')][_0x099a('0x1d')],function(_0x5e7d3c){return{'model':db[_0x5e7d3c[_0x099a('0x1e')]],'as':_0x5e7d3c['as'],'attributes':_0x5e7d3c[_0x099a('0x1a')],'include':_0x5e7d3c[_0x099a('0x1d')]?_[_0x099a('0x1c')](_0x5e7d3c[_0x099a('0x1d')],function(_0x493175){return{'model':db[_0x493175[_0x099a('0x1e')]],'as':_0x493175['as'],'attributes':_0x493175[_0x099a('0x1a')],'include':_0x493175['include']?_[_0x099a('0x1c')](_0x493175[_0x099a('0x1d')],function(_0xba763c){return{'model':db[_0xba763c['model']],'as':_0xba763c['as'],'attributes':_0xba763c[_0x099a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x099a('0x9')](function(_0x1e8a23){logger[_0x099a('0xa')](_0x099a('0x20'),_0x57d1f3);logger[_0x099a('0xd')]('ShowDynamics365Account',_0x57d1f3,JSON[_0x099a('0xf')](_0x1e8a23));_0x406232(_0x1e8a23);})['catch'](function(_0x2dd733){logger[_0x099a('0x10')]('ShowDynamics365Account',_0x2dd733[_0x099a('0x12')],_0x57d1f3);_0x41b983(_0x49c257[_0x099a('0x10')](0x1f4,_0x2dd733[_0x099a('0x12')]));});});}; \ No newline at end of file +var _0x2aa3=['jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3aba54,_0x2ba5aa){var _0x1c3e1c=function(_0x236b71){while(--_0x236b71){_0x3aba54['push'](_0x3aba54['shift']());}};_0x1c3e1c(++_0x2ba5aa);}(_0x2aa3,0x83));var _0x32aa=function(_0x4c154f,_0x2ae879){_0x4c154f=_0x4c154f-0x0;var _0x4a3857=_0x2aa3[_0x4c154f];return _0x4a3857;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112396,_0x3ee18a,_0x20efbe){return new BPromise(function(_0x18ded0,_0x40c96a){return client[_0x32aa('0xb')](_0x112396,_0x20efbe)[_0x32aa('0xc')](function(_0x5d280e){logger[_0x32aa('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x3ee18a,_0x32aa('0xe'));logger[_0x32aa('0xf')](_0x32aa('0x10'),_0x3ee18a,_0x32aa('0xe'),JSON['stringify'](_0x5d280e));if(_0x5d280e[_0x32aa('0x11')]){if(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x12')]===0x1f4){logger['error'](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);return _0x40c96a(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')]['message']);return _0x18ded0(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}else{logger[_0x32aa('0xd')](_0x32aa('0x13'),_0x3ee18a,_0x32aa('0xe'));_0x18ded0(_0x5d280e['result'][_0x32aa('0x14')]);}})[_0x32aa('0x15')](function(_0x463b91){logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x463b91);_0x40c96a(_0x463b91);});});}exports['GetDynamics365Account']=function(_0x5196c0){var _0x3e0a23=this;return new Promise(function(_0x34dcaf,_0x257be0){return db['Dynamics365Account']['findAll']({'raw':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x17')]===undefined?!![]:![]:!![],'where':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x18')]||null:null,'attributes':_0x5196c0['options']?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x19')]||null:null,'limit':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1a')]||null:null,'include':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x5196c0['options'][_0x32aa('0x1b')],function(_0x5c82d2){return{'model':db[_0x5c82d2[_0x32aa('0x1d')]],'as':_0x5c82d2['as'],'attributes':_0x5c82d2[_0x32aa('0x19')],'include':_0x5c82d2['include']?_['map'](_0x5c82d2[_0x32aa('0x1b')],function(_0x313930){return{'model':db[_0x313930[_0x32aa('0x1d')]],'as':_0x313930['as'],'attributes':_0x313930[_0x32aa('0x19')],'include':_0x313930[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x313930[_0x32aa('0x1b')],function(_0x405b03){return{'model':db[_0x405b03[_0x32aa('0x1d')]],'as':_0x405b03['as'],'attributes':_0x405b03['attributes']};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x2e3a5d){logger['info'](_0x32aa('0x1e'),_0x5196c0);logger['debug']('GetDynamics365Account',_0x5196c0,JSON[_0x32aa('0x1f')](_0x2e3a5d));_0x34dcaf(_0x2e3a5d);})[_0x32aa('0x15')](function(_0x1d1c80){logger[_0x32aa('0x11')]('GetDynamics365Account',_0x1d1c80[_0x32aa('0x14')],_0x5196c0);_0x257be0(_0x3e0a23[_0x32aa('0x11')](0x1f4,_0x1d1c80[_0x32aa('0x14')]));});});};exports[_0x32aa('0x20')]=function(_0x19efc6){var _0x44887c=this;return new Promise(function(_0x4b0d5a,_0x5b410f){return db[_0x32aa('0x21')][_0x32aa('0x22')]({'raw':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19efc6['options']?_0x19efc6[_0x32aa('0x16')]['where']||null:null,'attributes':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['attributes']||null:null,'include':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['include']?_[_0x32aa('0x1c')](_0x19efc6[_0x32aa('0x16')][_0x32aa('0x1b')],function(_0xd23473){return{'model':db[_0xd23473[_0x32aa('0x1d')]],'as':_0xd23473['as'],'attributes':_0xd23473[_0x32aa('0x19')],'include':_0xd23473[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0xd23473[_0x32aa('0x1b')],function(_0x2a2f9d){return{'model':db[_0x2a2f9d[_0x32aa('0x1d')]],'as':_0x2a2f9d['as'],'attributes':_0x2a2f9d[_0x32aa('0x19')],'include':_0x2a2f9d[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x2a2f9d['include'],function(_0x5b0fe2){return{'model':db[_0x5b0fe2[_0x32aa('0x1d')]],'as':_0x5b0fe2['as'],'attributes':_0x5b0fe2[_0x32aa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x193d10){logger['info'](_0x32aa('0x20'),_0x19efc6);logger[_0x32aa('0xf')](_0x32aa('0x20'),_0x19efc6,JSON[_0x32aa('0x1f')](_0x193d10));_0x4b0d5a(_0x193d10);})[_0x32aa('0x15')](function(_0xa48198){logger[_0x32aa('0x11')](_0x32aa('0x20'),_0xa48198[_0x32aa('0x14')],_0x19efc6);_0x5b410f(_0x44887c[_0x32aa('0x11')](0x1f4,_0xa48198[_0x32aa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b3eecfc..74020aa 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 _0x6bd6=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/subjects','getDescriptions','create','put','/:id','update','delete'];(function(_0x872a3c,_0x5a1ce9){var _0x11736b=function(_0x53bd73){while(--_0x53bd73){_0x872a3c['push'](_0x872a3c['shift']());}};_0x11736b(++_0x5a1ce9);}(_0x6bd6,0x17d));var _0x66bd=function(_0x583b14,_0x59fe86){_0x583b14=_0x583b14-0x0;var _0x8214dc=_0x6bd6[_0x583b14];return _0x8214dc;};'use strict';var multer=require(_0x66bd('0x0'));var util=require(_0x66bd('0x1'));var path=require('path');var timeout=require(_0x66bd('0x2'));var express=require(_0x66bd('0x3'));var router=express[_0x66bd('0x4')]();var auth=require(_0x66bd('0x5'));var interaction=require(_0x66bd('0x6'));var config=require(_0x66bd('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x66bd('0x8')]('/',auth[_0x66bd('0x9')](),controller['index']);router[_0x66bd('0x8')]('/:id',auth[_0x66bd('0x9')](),controller[_0x66bd('0xa')]);router[_0x66bd('0x8')](_0x66bd('0xb'),auth[_0x66bd('0x9')](),controller['getFields']);router['get'](_0x66bd('0xc'),auth[_0x66bd('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x66bd('0xd')]);router['post']('/',auth[_0x66bd('0x9')](),controller[_0x66bd('0xe')]);router[_0x66bd('0xf')](_0x66bd('0x10'),auth[_0x66bd('0x9')](),controller[_0x66bd('0x11')]);router[_0x66bd('0x12')]('/:id',auth[_0x66bd('0x9')](),controller[_0x66bd('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3a4d=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','getFields','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports'];(function(_0x514038,_0x450ef3){var _0x589720=function(_0x1a356f){while(--_0x1a356f){_0x514038['push'](_0x514038['shift']());}};_0x589720(++_0x450ef3);}(_0x3a4d,0xe7));var _0xd3a4=function(_0x48b5f9,_0x585cfb){_0x48b5f9=_0x48b5f9-0x0;var _0x55ae7a=_0x3a4d[_0x48b5f9];return _0x55ae7a;};'use strict';var multer=require('multer');var util=require(_0xd3a4('0x0'));var path=require('path');var timeout=require(_0xd3a4('0x1'));var express=require(_0xd3a4('0x2'));var router=express[_0xd3a4('0x3')]();var auth=require(_0xd3a4('0x4'));var interaction=require(_0xd3a4('0x5'));var config=require(_0xd3a4('0x6'));var controller=require(_0xd3a4('0x7'));router[_0xd3a4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd3a4('0x8')](_0xd3a4('0x9'),auth[_0xd3a4('0xa')](),controller[_0xd3a4('0xb')]);router[_0xd3a4('0x8')]('/:id/fields',auth[_0xd3a4('0xa')](),controller[_0xd3a4('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xd3a4('0xd'),auth[_0xd3a4('0xa')](),controller[_0xd3a4('0xe')]);router[_0xd3a4('0xf')]('/',auth[_0xd3a4('0xa')](),controller[_0xd3a4('0x10')]);router[_0xd3a4('0x11')](_0xd3a4('0x9'),auth[_0xd3a4('0xa')](),controller[_0xd3a4('0x12')]);router['delete'](_0xd3a4('0x9'),auth[_0xd3a4('0xa')](),controller[_0xd3a4('0x13')]);module[_0xd3a4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0899f2b..bd6803c 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 _0xf176=['sequelize','exports','STRING','ENUM','incident'];(function(_0x5c994d,_0x2b417e){var _0x989738=function(_0x4d2d69){while(--_0x4d2d69){_0x5c994d['push'](_0x5c994d['shift']());}};_0x989738(++_0x2b417e);}(_0xf176,0x136));var _0x6f17=function(_0xfdfaa2,_0x25ec1a){_0xfdfaa2=_0xfdfaa2-0x0;var _0x396ba1=_0xf176[_0xfdfaa2];return _0x396ba1;};'use strict';var Sequelize=require(_0x6f17('0x0'));module[_0x6f17('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6f17('0x2')]},'ticketType':{'type':Sequelize[_0x6f17('0x3')]('incident','phonecall'),'defaultValue':_0x6f17('0x4')}}; \ No newline at end of file +var _0x69c4=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x22d2ff,_0x56a793){var _0x4a50b6=function(_0x54512c){while(--_0x54512c){_0x22d2ff['push'](_0x22d2ff['shift']());}};_0x4a50b6(++_0x56a793);}(_0x69c4,0x1d0));var _0x469c=function(_0x437886,_0xc8dc78){_0x437886=_0x437886-0x0;var _0xdf16fa=_0x69c4[_0x437886];return _0xdf16fa;};'use strict';var Sequelize=require(_0x469c('0x0'));module[_0x469c('0x1')]={'name':{'type':Sequelize[_0x469c('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x469c('0x3')](_0x469c('0x4'),_0x469c('0x5')),'defaultValue':_0x469c('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e0d38a7..bca18bf 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 _0xf9da=['filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','Dynamics365Configuration','find','create','body','findOne','Dynamics365Field','length','getFields','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','sendStatus','stack','name','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x2498cd,_0x3f4ac6){var _0xddb4ad=function(_0x5e0912){while(--_0x5e0912){_0x2498cd['push'](_0x2498cd['shift']());}};_0xddb4ad(++_0x3f4ac6);}(_0xf9da,0x78));var _0xaf9d=function(_0xa193de,_0x276446){_0xa193de=_0xa193de-0x0;var _0xd9e427=_0xf9da[_0xa193de];return _0xd9e427;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf9d('0x1'));var jsonpatch=require(_0xaf9d('0x2'));var rp=require(_0xaf9d('0x3'));var moment=require('moment');var BPromise=require(_0xaf9d('0x4'));var Mustache=require(_0xaf9d('0x5'));var util=require('util');var path=require(_0xaf9d('0x6'));var sox=require(_0xaf9d('0x7'));var csv=require(_0xaf9d('0x8'));var ejs=require(_0xaf9d('0x9'));var fs=require('fs');var _=require(_0xaf9d('0xa'));var squel=require(_0xaf9d('0xb'));var crypto=require(_0xaf9d('0xc'));var jsforce=require(_0xaf9d('0xd'));var deskjs=require(_0xaf9d('0xe'));var toCsv=require(_0xaf9d('0x8'));var querystring=require(_0xaf9d('0xf'));var Papa=require('papaparse');var Redis=require(_0xaf9d('0x10'));var authService=require(_0xaf9d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf9d('0x12'));var hardwareService=require(_0xaf9d('0x13'));var logger=require(_0xaf9d('0x14'))(_0xaf9d('0x15'));var utils=require(_0xaf9d('0x16'));var config=require(_0xaf9d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf9d('0x18'))['db'];var jayson=require(_0xaf9d('0x19'));var client=jayson[_0xaf9d('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4edd3a,_0x2144f5,_0x8ddba8,_0x1cc8cc){return new BPromise(function(_0x4d9a96,_0x3206f9){var _0x3bed80=_0x1cc8cc||client;return _0x3bed80[_0xaf9d('0x1b')](_0x4edd3a,_0x8ddba8)[_0xaf9d('0x1c')](function(_0x3c550b){logger[_0xaf9d('0x1d')](_0xaf9d('0x1e'),_0x2144f5,_0xaf9d('0x1f'));logger['debug'](_0xaf9d('0x20'),_0x2144f5,'request\x20sent',JSON[_0xaf9d('0x21')](_0x3c550b));if(_0x3c550b[_0xaf9d('0x22')]){if(_0x3c550b[_0xaf9d('0x22')][_0xaf9d('0x23')]===0x1f4){logger[_0xaf9d('0x22')](_0xaf9d('0x1e'),_0x2144f5,_0x3c550b[_0xaf9d('0x22')][_0xaf9d('0x24')]);return _0x3206f9(_0x3c550b[_0xaf9d('0x22')][_0xaf9d('0x24')]);}logger[_0xaf9d('0x22')](_0xaf9d('0x1e'),_0x2144f5,_0x3c550b['error'][_0xaf9d('0x24')]);return _0x4d9a96(_0x3c550b[_0xaf9d('0x22')]['message']);}else{logger[_0xaf9d('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2144f5,_0xaf9d('0x1f'));_0x4d9a96(_0x3c550b[_0xaf9d('0x25')][_0xaf9d('0x24')]);}})[_0xaf9d('0x26')](function(_0x46d0d6){logger[_0xaf9d('0x22')](_0xaf9d('0x1e'),_0x2144f5,_0x46d0d6);_0x3206f9(_0x46d0d6);});});}function respondWithStatusCode(_0x102e06,_0x20c0ca){_0x20c0ca=_0x20c0ca||0xcc;return function(_0x51a239){if(_0x51a239){return _0x102e06['sendStatus'](_0x20c0ca);}return _0x102e06['status'](_0x20c0ca)[_0xaf9d('0x27')]();};}function respondWithResult(_0x1f2171,_0x3cad36){_0x3cad36=_0x3cad36||0xc8;return function(_0x96cd52){if(_0x96cd52){return _0x1f2171[_0xaf9d('0x28')](_0x3cad36)[_0xaf9d('0x29')](_0x96cd52);}};}function respondWithFilteredResult(_0x4be3f1,_0x4d7de0){return function(_0x33b982){if(_0x33b982){var _0xff716f=_0x33b982[_0xaf9d('0x2a')],_0x4066c9=_0x4d7de0[_0xaf9d('0x2b')],_0x4247e3=_0x4d7de0[_0xaf9d('0x2b')]+_0x4d7de0[_0xaf9d('0x2c')],_0x3d3e9d;if(_0x4247e3>=_0xff716f){_0x4247e3=_0xff716f;_0x3d3e9d=0xc8;}else{_0x3d3e9d=0xce;}_0x4be3f1[_0xaf9d('0x28')](_0x3d3e9d);return _0x4be3f1[_0xaf9d('0x2d')](_0xaf9d('0x2e'),_0x4066c9+'-'+_0x4247e3+'/'+_0xff716f)[_0xaf9d('0x29')](_0x33b982);}return null;};}function patchUpdates(_0x136df4){return function(_0x6d88db){try{jsonpatch['apply'](_0x6d88db,_0x136df4,!![]);}catch(_0x5a9866){return BPromise['reject'](_0x5a9866);}return _0x6d88db[_0xaf9d('0x2f')]();};}function saveUpdates(_0x35fb70,_0xba3b9f){return function(_0x45dfc2){if(_0x45dfc2){return _0x45dfc2[_0xaf9d('0x30')](_0x35fb70)['then'](function(_0x3dd42b){return _0x3dd42b;});}return null;};}function removeEntity(_0x1bdffe,_0xbdf764){return function(_0x503a04){if(_0x503a04){return _0x503a04[_0xaf9d('0x31')]()[_0xaf9d('0x1c')](function(){_0x1bdffe['status'](0xcc)[_0xaf9d('0x27')]();});}};}function handleEntityNotFound(_0x5ad67d,_0x1eaaf2){return function(_0x5bda34){if(!_0x5bda34){_0x5ad67d[_0xaf9d('0x32')](0x194);}return _0x5bda34;};}function handleError(_0x2188cd,_0x2988f9){_0x2988f9=_0x2988f9||0x1f4;return function(_0x3a8557){logger['error'](_0x3a8557[_0xaf9d('0x33')]);if(_0x3a8557[_0xaf9d('0x34')]){delete _0x3a8557[_0xaf9d('0x34')];}_0x2188cd[_0xaf9d('0x28')](_0x2988f9)['send'](_0x3a8557);};}exports['index']=function(_0x469cd7,_0x224be3){var _0x49a182={},_0x114407={},_0x317a99={'count':0x0,'rows':[]};var _0x100268=_['map'](db['Dynamics365Configuration'][_0xaf9d('0x35')],function(_0xa3ca16){return{'name':_0xa3ca16[_0xaf9d('0x36')],'type':_0xa3ca16[_0xaf9d('0x37')][_0xaf9d('0x38')]};});_0x114407['model']=_[_0xaf9d('0x39')](_0x100268,_0xaf9d('0x34'));_0x114407[_0xaf9d('0x3a')]=_[_0xaf9d('0x3b')](_0x469cd7['query']);_0x114407[_0xaf9d('0x3c')]=_[_0xaf9d('0x3d')](_0x114407['model'],_0x114407[_0xaf9d('0x3a')]);_0x49a182[_0xaf9d('0x3e')]=_[_0xaf9d('0x3d')](_0x114407[_0xaf9d('0x3f')],qs[_0xaf9d('0x40')](_0x469cd7['query'][_0xaf9d('0x40')]));_0x49a182[_0xaf9d('0x3e')]=_0x49a182[_0xaf9d('0x3e')]['length']?_0x49a182['attributes']:_0x114407[_0xaf9d('0x3f')];if(!_0x469cd7[_0xaf9d('0x3a')]['hasOwnProperty'](_0xaf9d('0x41'))){_0x49a182['limit']=qs['limit'](_0x469cd7[_0xaf9d('0x3a')][_0xaf9d('0x2c')]);_0x49a182[_0xaf9d('0x2b')]=qs['offset'](_0x469cd7[_0xaf9d('0x3a')][_0xaf9d('0x2b')]);}_0x49a182[_0xaf9d('0x42')]=qs[_0xaf9d('0x43')](_0x469cd7[_0xaf9d('0x3a')][_0xaf9d('0x43')]);_0x49a182[_0xaf9d('0x44')]=qs['filters'](_[_0xaf9d('0x45')](_0x469cd7[_0xaf9d('0x3a')],_0x114407[_0xaf9d('0x3c')]),_0x100268);if(_0x469cd7[_0xaf9d('0x3a')][_0xaf9d('0x46')]){_0x49a182['where']=_[_0xaf9d('0x47')](_0x49a182['where'],{'$or':_[_0xaf9d('0x39')](_0x100268,function(_0x5ddc53){if(_0x5ddc53[_0xaf9d('0x37')]!=='VIRTUAL'){var _0x2848e2={};_0x2848e2[_0x5ddc53['name']]={'$like':'%'+_0x469cd7[_0xaf9d('0x3a')][_0xaf9d('0x46')]+'%'};return _0x2848e2;}})});}_0x49a182=_[_0xaf9d('0x47')]({},_0x49a182,_0x469cd7[_0xaf9d('0x48')]);var _0x2b9bf7={'where':_0x49a182[_0xaf9d('0x44')]};return db['Dynamics365Configuration'][_0xaf9d('0x2a')](_0x2b9bf7)[_0xaf9d('0x1c')](function(_0x3756ca){_0x317a99[_0xaf9d('0x2a')]=_0x3756ca;if(_0x469cd7['query']['includeAll']){_0x49a182[_0xaf9d('0x49')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xaf9d('0x4a')](_0x49a182);})[_0xaf9d('0x1c')](function(_0x39f52b){_0x317a99[_0xaf9d('0x4b')]=_0x39f52b;return _0x317a99;})[_0xaf9d('0x1c')](respondWithFilteredResult(_0x224be3,_0x49a182))[_0xaf9d('0x26')](handleError(_0x224be3,null));};exports[_0xaf9d('0x4c')]=function(_0x5dbf83,_0x235f8b){var _0x387803={'raw':![],'where':{'id':_0x5dbf83[_0xaf9d('0x4d')]['id']}},_0x3f051b={};_0x3f051b[_0xaf9d('0x3f')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x3f051b['query']=_[_0xaf9d('0x3b')](_0x5dbf83[_0xaf9d('0x3a')]);_0x3f051b[_0xaf9d('0x3c')]=_['intersection'](_0x3f051b['model'],_0x3f051b[_0xaf9d('0x3a')]);_0x387803[_0xaf9d('0x3e')]=_['intersection'](_0x3f051b[_0xaf9d('0x3f')],qs[_0xaf9d('0x40')](_0x5dbf83[_0xaf9d('0x3a')]['fields']));_0x387803[_0xaf9d('0x3e')]=_0x387803[_0xaf9d('0x3e')]['length']?_0x387803[_0xaf9d('0x3e')]:_0x3f051b[_0xaf9d('0x3f')];if(_0x5dbf83[_0xaf9d('0x3a')][_0xaf9d('0x4e')]){_0x387803[_0xaf9d('0x49')]=[{'all':!![]}];}_0x387803=_[_0xaf9d('0x47')]({},_0x387803,_0x5dbf83[_0xaf9d('0x48')]);return db[_0xaf9d('0x4f')][_0xaf9d('0x50')](_0x387803)[_0xaf9d('0x1c')](handleEntityNotFound(_0x235f8b,null))[_0xaf9d('0x1c')](respondWithResult(_0x235f8b,null))[_0xaf9d('0x26')](handleError(_0x235f8b,null));};exports[_0xaf9d('0x51')]=function(_0x616634,_0x3f0131){return db['Dynamics365Configuration'][_0xaf9d('0x51')](_0x616634[_0xaf9d('0x52')],{})[_0xaf9d('0x1c')](respondWithResult(_0x3f0131,0xc9))[_0xaf9d('0x26')](handleError(_0x3f0131,null));};exports[_0xaf9d('0x30')]=function(_0x4e783c,_0x1313e1){if(_0x4e783c[_0xaf9d('0x52')]['id']){delete _0x4e783c[_0xaf9d('0x52')]['id'];}return db[_0xaf9d('0x4f')][_0xaf9d('0x50')]({'where':{'id':_0x4e783c['params']['id']}})[_0xaf9d('0x1c')](handleEntityNotFound(_0x1313e1,null))[_0xaf9d('0x1c')](saveUpdates(_0x4e783c['body'],null))[_0xaf9d('0x1c')](respondWithResult(_0x1313e1,null))[_0xaf9d('0x26')](handleError(_0x1313e1,null));};exports[_0xaf9d('0x31')]=function(_0x13e45d,_0x366eda){return db[_0xaf9d('0x4f')][_0xaf9d('0x50')]({'where':{'id':_0x13e45d[_0xaf9d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x366eda,null))[_0xaf9d('0x1c')](removeEntity(_0x366eda,null))['catch'](handleError(_0x366eda,null));};exports['getFields']=function(_0x254f94,_0xa1cd3f,_0x43da9a){var _0x4ab1e8={};var _0x5df417={};var _0x5bc7ba;var _0x29ccb0;return db['Dynamics365Configuration'][_0xaf9d('0x53')]({'where':{'id':_0x254f94[_0xaf9d('0x4d')]['id']}})[_0xaf9d('0x1c')](handleEntityNotFound(_0xa1cd3f,null))[_0xaf9d('0x1c')](function(_0x5cb1d1){if(_0x5cb1d1){_0x5bc7ba=_0x5cb1d1;_0x5df417['model']=_[_0xaf9d('0x3b')](db[_0xaf9d('0x54')][_0xaf9d('0x35')]);_0x5df417[_0xaf9d('0x3a')]=_[_0xaf9d('0x3b')](_0x254f94[_0xaf9d('0x3a')]);_0x5df417[_0xaf9d('0x3c')]=_['intersection'](_0x5df417[_0xaf9d('0x3f')],_0x5df417[_0xaf9d('0x3a')]);_0x4ab1e8['attributes']=_[_0xaf9d('0x3d')](_0x5df417[_0xaf9d('0x3f')],qs[_0xaf9d('0x40')](_0x254f94[_0xaf9d('0x3a')][_0xaf9d('0x40')]));_0x4ab1e8[_0xaf9d('0x3e')]=_0x4ab1e8[_0xaf9d('0x3e')][_0xaf9d('0x55')]?_0x4ab1e8[_0xaf9d('0x3e')]:_0x5df417[_0xaf9d('0x3f')];_0x4ab1e8[_0xaf9d('0x42')]=qs[_0xaf9d('0x43')](_0x254f94[_0xaf9d('0x3a')][_0xaf9d('0x43')]);_0x4ab1e8[_0xaf9d('0x44')]=qs[_0xaf9d('0x3c')](_[_0xaf9d('0x45')](_0x254f94[_0xaf9d('0x3a')],_0x5df417['filters']));if(_0x254f94['query'][_0xaf9d('0x46')]){_0x4ab1e8[_0xaf9d('0x44')]=_[_0xaf9d('0x47')](_0x4ab1e8[_0xaf9d('0x44')],{'$or':_['map'](_0x4ab1e8['attributes'],function(_0x549c42){var _0x4bd304={};_0x4bd304[_0x549c42]={'$like':'%'+_0x254f94[_0xaf9d('0x3a')][_0xaf9d('0x46')]+'%'};return _0x4bd304;})});}_0x4ab1e8=_[_0xaf9d('0x47')]({},_0x4ab1e8,_0x254f94[_0xaf9d('0x48')]);return _0x5bc7ba[_0xaf9d('0x56')](_0x4ab1e8);}})[_0xaf9d('0x1c')](function(_0x14c478){if(_0x14c478){_0x29ccb0=_0x14c478[_0xaf9d('0x55')];if(!_0x254f94[_0xaf9d('0x3a')]['hasOwnProperty']('nolimit')){_0x4ab1e8[_0xaf9d('0x2c')]=qs[_0xaf9d('0x2c')](_0x254f94[_0xaf9d('0x3a')][_0xaf9d('0x2c')]);_0x4ab1e8[_0xaf9d('0x2b')]=qs[_0xaf9d('0x2b')](_0x254f94[_0xaf9d('0x3a')][_0xaf9d('0x2b')]);}return _0x5bc7ba[_0xaf9d('0x56')](_0x4ab1e8);}})[_0xaf9d('0x1c')](function(_0x479d84){if(_0x479d84){return _0x479d84?{'count':_0x29ccb0,'rows':_0x479d84}:null;}})[_0xaf9d('0x1c')](respondWithResult(_0xa1cd3f,null))['catch'](handleError(_0xa1cd3f,null));};exports[_0xaf9d('0x57')]=function(_0x2589ea,_0x29197e,_0x303a72){var _0x525166={};var _0x1f2177={};var _0x5d6715;var _0x26f200;return db[_0xaf9d('0x4f')]['findOne']({'where':{'id':_0x2589ea[_0xaf9d('0x4d')]['id']}})[_0xaf9d('0x1c')](handleEntityNotFound(_0x29197e,null))[_0xaf9d('0x1c')](function(_0x8bfe38){if(_0x8bfe38){_0x5d6715=_0x8bfe38;_0x1f2177['model']=_[_0xaf9d('0x3b')](db[_0xaf9d('0x54')][_0xaf9d('0x35')]);_0x1f2177[_0xaf9d('0x3a')]=_[_0xaf9d('0x3b')](_0x2589ea[_0xaf9d('0x3a')]);_0x1f2177['filters']=_['intersection'](_0x1f2177['model'],_0x1f2177[_0xaf9d('0x3a')]);_0x525166[_0xaf9d('0x3e')]=_[_0xaf9d('0x3d')](_0x1f2177[_0xaf9d('0x3f')],qs[_0xaf9d('0x40')](_0x2589ea[_0xaf9d('0x3a')][_0xaf9d('0x40')]));_0x525166[_0xaf9d('0x3e')]=_0x525166[_0xaf9d('0x3e')][_0xaf9d('0x55')]?_0x525166[_0xaf9d('0x3e')]:_0x1f2177['model'];_0x525166['order']=qs[_0xaf9d('0x43')](_0x2589ea[_0xaf9d('0x3a')][_0xaf9d('0x43')]);_0x525166[_0xaf9d('0x44')]=qs['filters'](_[_0xaf9d('0x45')](_0x2589ea[_0xaf9d('0x3a')],_0x1f2177[_0xaf9d('0x3c')]));if(_0x2589ea[_0xaf9d('0x3a')][_0xaf9d('0x46')]){_0x525166['where']=_['merge'](_0x525166['where'],{'$or':_['map'](_0x525166['attributes'],function(_0x154862){var _0x341b59={};_0x341b59[_0x154862]={'$like':'%'+_0x2589ea['query'][_0xaf9d('0x46')]+'%'};return _0x341b59;})});}_0x525166=_['merge']({},_0x525166,_0x2589ea['options']);return _0x5d6715['getSubjects'](_0x525166);}})[_0xaf9d('0x1c')](function(_0x1ef6e9){if(_0x1ef6e9){_0x26f200=_0x1ef6e9[_0xaf9d('0x55')];if(!_0x2589ea[_0xaf9d('0x3a')][_0xaf9d('0x58')](_0xaf9d('0x41'))){_0x525166['limit']=qs[_0xaf9d('0x2c')](_0x2589ea[_0xaf9d('0x3a')]['limit']);_0x525166[_0xaf9d('0x2b')]=qs[_0xaf9d('0x2b')](_0x2589ea[_0xaf9d('0x3a')][_0xaf9d('0x2b')]);}return _0x5d6715[_0xaf9d('0x57')](_0x525166);}})[_0xaf9d('0x1c')](function(_0x4a3101){if(_0x4a3101){return _0x4a3101?{'count':_0x26f200,'rows':_0x4a3101}:null;}})['then'](respondWithResult(_0x29197e,null))[_0xaf9d('0x26')](handleError(_0x29197e,null));};exports[_0xaf9d('0x59')]=function(_0x46dc5f,_0x16965f,_0x2552b1){var _0x175318={};var _0x1a4219={};var _0x3ece2c;var _0x50e2c7;return db['Dynamics365Configuration'][_0xaf9d('0x53')]({'where':{'id':_0x46dc5f[_0xaf9d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16965f,null))[_0xaf9d('0x1c')](function(_0x1e41e8){if(_0x1e41e8){_0x3ece2c=_0x1e41e8;_0x1a4219[_0xaf9d('0x3f')]=_[_0xaf9d('0x3b')](db[_0xaf9d('0x54')][_0xaf9d('0x35')]);_0x1a4219[_0xaf9d('0x3a')]=_['keys'](_0x46dc5f[_0xaf9d('0x3a')]);_0x1a4219['filters']=_[_0xaf9d('0x3d')](_0x1a4219[_0xaf9d('0x3f')],_0x1a4219[_0xaf9d('0x3a')]);_0x175318[_0xaf9d('0x3e')]=_['intersection'](_0x1a4219['model'],qs[_0xaf9d('0x40')](_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x40')]));_0x175318['attributes']=_0x175318[_0xaf9d('0x3e')][_0xaf9d('0x55')]?_0x175318[_0xaf9d('0x3e')]:_0x1a4219[_0xaf9d('0x3f')];_0x175318[_0xaf9d('0x42')]=qs[_0xaf9d('0x43')](_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x43')]);_0x175318[_0xaf9d('0x44')]=qs[_0xaf9d('0x3c')](_['pick'](_0x46dc5f[_0xaf9d('0x3a')],_0x1a4219[_0xaf9d('0x3c')]));if(_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x46')]){_0x175318[_0xaf9d('0x44')]=_[_0xaf9d('0x47')](_0x175318['where'],{'$or':_['map'](_0x175318['attributes'],function(_0x1f7c88){var _0x1aed7a={};_0x1aed7a[_0x1f7c88]={'$like':'%'+_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x46')]+'%'};return _0x1aed7a;})});}_0x175318=_[_0xaf9d('0x47')]({},_0x175318,_0x46dc5f[_0xaf9d('0x48')]);return _0x3ece2c[_0xaf9d('0x59')](_0x175318);}})[_0xaf9d('0x1c')](function(_0x3debd5){if(_0x3debd5){_0x50e2c7=_0x3debd5[_0xaf9d('0x55')];if(!_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x58')](_0xaf9d('0x41'))){_0x175318['limit']=qs[_0xaf9d('0x2c')](_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x2c')]);_0x175318[_0xaf9d('0x2b')]=qs[_0xaf9d('0x2b')](_0x46dc5f[_0xaf9d('0x3a')][_0xaf9d('0x2b')]);}return _0x3ece2c[_0xaf9d('0x59')](_0x175318);}})['then'](function(_0x3cf45b){if(_0x3cf45b){return _0x3cf45b?{'count':_0x50e2c7,'rows':_0x3cf45b}:null;}})[_0xaf9d('0x1c')](respondWithResult(_0x16965f,null))['catch'](handleError(_0x16965f,null));}; \ No newline at end of file +var _0xe7d0=['type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','rawAttributes','create','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','stack','send','map','Dynamics365Configuration','fieldName'];(function(_0x2e4b59,_0x342fc1){var _0x432f7e=function(_0x144876){while(--_0x144876){_0x2e4b59['push'](_0x2e4b59['shift']());}};_0x432f7e(++_0x342fc1);}(_0xe7d0,0x78));var _0x0e7d=function(_0x55b25f,_0xad5c1a){_0x55b25f=_0x55b25f-0x0;var _0xbb8f9d=_0xe7d0[_0x55b25f];return _0xbb8f9d;};'use strict';var pdf=require(_0x0e7d('0x0'));var emlformat=require(_0x0e7d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0e7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e7d('0x3'));var BPromise=require(_0x0e7d('0x4'));var Mustache=require(_0x0e7d('0x5'));var util=require(_0x0e7d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0e7d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e7d('0x8'));var squel=require(_0x0e7d('0x9'));var crypto=require(_0x0e7d('0xa'));var jsforce=require(_0x0e7d('0xb'));var deskjs=require(_0x0e7d('0xc'));var toCsv=require(_0x0e7d('0x7'));var querystring=require(_0x0e7d('0xd'));var Papa=require(_0x0e7d('0xe'));var Redis=require('ioredis');var authService=require(_0x0e7d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0e7d('0x10'));var hardwareService=require(_0x0e7d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0e7d('0x12'));var config=require(_0x0e7d('0x13'));var licenseUtil=require(_0x0e7d('0x14'));var db=require(_0x0e7d('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x0e7d('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4bcffe,_0x2d4cf9,_0x45f759,_0x5bf63a){return new BPromise(function(_0x6e6b2a,_0x4f80f6){var _0x4d6172=_0x5bf63a||client;return _0x4d6172['request'](_0x4bcffe,_0x45f759)[_0x0e7d('0x17')](function(_0x5bc00e){logger[_0x0e7d('0x18')](_0x0e7d('0x19'),_0x2d4cf9,'request\x20sent');logger[_0x0e7d('0x1a')](_0x0e7d('0x1b'),_0x2d4cf9,_0x0e7d('0x1c'),JSON[_0x0e7d('0x1d')](_0x5bc00e));if(_0x5bc00e[_0x0e7d('0x1e')]){if(_0x5bc00e[_0x0e7d('0x1e')]['code']===0x1f4){logger[_0x0e7d('0x1e')](_0x0e7d('0x19'),_0x2d4cf9,_0x5bc00e[_0x0e7d('0x1e')][_0x0e7d('0x1f')]);return _0x4f80f6(_0x5bc00e[_0x0e7d('0x1e')][_0x0e7d('0x1f')]);}logger[_0x0e7d('0x1e')](_0x0e7d('0x19'),_0x2d4cf9,_0x5bc00e[_0x0e7d('0x1e')][_0x0e7d('0x1f')]);return _0x6e6b2a(_0x5bc00e['error']['message']);}else{logger['info'](_0x0e7d('0x19'),_0x2d4cf9,'request\x20sent');_0x6e6b2a(_0x5bc00e[_0x0e7d('0x20')][_0x0e7d('0x1f')]);}})[_0x0e7d('0x21')](function(_0x353422){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2d4cf9,_0x353422);_0x4f80f6(_0x353422);});});}function respondWithStatusCode(_0x20afb7,_0x407e8d){_0x407e8d=_0x407e8d||0xcc;return function(_0x8a4c33){if(_0x8a4c33){return _0x20afb7[_0x0e7d('0x22')](_0x407e8d);}return _0x20afb7[_0x0e7d('0x23')](_0x407e8d)[_0x0e7d('0x24')]();};}function respondWithResult(_0x2ba737,_0x477a37){_0x477a37=_0x477a37||0xc8;return function(_0x7b2114){if(_0x7b2114){return _0x2ba737[_0x0e7d('0x23')](_0x477a37)[_0x0e7d('0x25')](_0x7b2114);}};}function respondWithFilteredResult(_0x177785,_0x4e09f9){return function(_0x2d1f98){if(_0x2d1f98){var _0x22dd78=_0x2d1f98['count'],_0x2215f0=_0x4e09f9['offset'],_0x269636=_0x4e09f9[_0x0e7d('0x26')]+_0x4e09f9[_0x0e7d('0x27')],_0x4506e2;if(_0x269636>=_0x22dd78){_0x269636=_0x22dd78;_0x4506e2=0xc8;}else{_0x4506e2=0xce;}_0x177785[_0x0e7d('0x23')](_0x4506e2);return _0x177785[_0x0e7d('0x28')]('Content-Range',_0x2215f0+'-'+_0x269636+'/'+_0x22dd78)[_0x0e7d('0x25')](_0x2d1f98);}return null;};}function patchUpdates(_0x3f2ac7){return function(_0x26e0df){try{jsonpatch[_0x0e7d('0x29')](_0x26e0df,_0x3f2ac7,!![]);}catch(_0x35cc67){return BPromise[_0x0e7d('0x2a')](_0x35cc67);}return _0x26e0df['save']();};}function saveUpdates(_0x470bca,_0x46221a){return function(_0x138fbd){if(_0x138fbd){return _0x138fbd[_0x0e7d('0x2b')](_0x470bca)[_0x0e7d('0x17')](function(_0x1159c7){return _0x1159c7;});}return null;};}function removeEntity(_0x38605b,_0x171a3d){return function(_0x4e59b4){if(_0x4e59b4){return _0x4e59b4[_0x0e7d('0x2c')]()[_0x0e7d('0x17')](function(){_0x38605b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2c4d,_0x2ed377){return function(_0x5bc50e){if(!_0x5bc50e){_0x4c2c4d[_0x0e7d('0x22')](0x194);}return _0x5bc50e;};}function handleError(_0xbfe359,_0x485a24){_0x485a24=_0x485a24||0x1f4;return function(_0x3c9583){logger[_0x0e7d('0x1e')](_0x3c9583[_0x0e7d('0x2d')]);if(_0x3c9583['name']){delete _0x3c9583['name'];}_0xbfe359[_0x0e7d('0x23')](_0x485a24)[_0x0e7d('0x2e')](_0x3c9583);};}exports['index']=function(_0x537f8e,_0x84b57){var _0x388970={},_0x305ea3={},_0x2003fa={'count':0x0,'rows':[]};var _0xc35a2=_[_0x0e7d('0x2f')](db[_0x0e7d('0x30')]['rawAttributes'],function(_0x11a836){return{'name':_0x11a836[_0x0e7d('0x31')],'type':_0x11a836[_0x0e7d('0x32')]['key']};});_0x305ea3[_0x0e7d('0x33')]=_[_0x0e7d('0x2f')](_0xc35a2,_0x0e7d('0x34'));_0x305ea3[_0x0e7d('0x35')]=_['keys'](_0x537f8e[_0x0e7d('0x35')]);_0x305ea3[_0x0e7d('0x36')]=_[_0x0e7d('0x37')](_0x305ea3[_0x0e7d('0x33')],_0x305ea3[_0x0e7d('0x35')]);_0x388970[_0x0e7d('0x38')]=_[_0x0e7d('0x37')](_0x305ea3[_0x0e7d('0x33')],qs['fields'](_0x537f8e[_0x0e7d('0x35')][_0x0e7d('0x39')]));_0x388970['attributes']=_0x388970[_0x0e7d('0x38')][_0x0e7d('0x3a')]?_0x388970['attributes']:_0x305ea3[_0x0e7d('0x33')];if(!_0x537f8e[_0x0e7d('0x35')][_0x0e7d('0x3b')](_0x0e7d('0x3c'))){_0x388970[_0x0e7d('0x27')]=qs[_0x0e7d('0x27')](_0x537f8e[_0x0e7d('0x35')]['limit']);_0x388970['offset']=qs['offset'](_0x537f8e[_0x0e7d('0x35')][_0x0e7d('0x26')]);}_0x388970[_0x0e7d('0x3d')]=qs[_0x0e7d('0x3e')](_0x537f8e['query'][_0x0e7d('0x3e')]);_0x388970[_0x0e7d('0x3f')]=qs[_0x0e7d('0x36')](_[_0x0e7d('0x40')](_0x537f8e[_0x0e7d('0x35')],_0x305ea3[_0x0e7d('0x36')]),_0xc35a2);if(_0x537f8e['query'][_0x0e7d('0x41')]){_0x388970[_0x0e7d('0x3f')]=_[_0x0e7d('0x42')](_0x388970[_0x0e7d('0x3f')],{'$or':_[_0x0e7d('0x2f')](_0xc35a2,function(_0x2ec438){if(_0x2ec438[_0x0e7d('0x32')]!==_0x0e7d('0x43')){var _0x220a7f={};_0x220a7f[_0x2ec438['name']]={'$like':'%'+_0x537f8e[_0x0e7d('0x35')][_0x0e7d('0x41')]+'%'};return _0x220a7f;}})});}_0x388970=_[_0x0e7d('0x42')]({},_0x388970,_0x537f8e[_0x0e7d('0x44')]);var _0x479aa3={'where':_0x388970[_0x0e7d('0x3f')]};return db[_0x0e7d('0x30')][_0x0e7d('0x45')](_0x479aa3)[_0x0e7d('0x17')](function(_0x20aaed){_0x2003fa['count']=_0x20aaed;if(_0x537f8e[_0x0e7d('0x35')][_0x0e7d('0x46')]){_0x388970[_0x0e7d('0x47')]=[{'all':!![]}];}return db[_0x0e7d('0x30')][_0x0e7d('0x48')](_0x388970);})[_0x0e7d('0x17')](function(_0x38f0f9){_0x2003fa[_0x0e7d('0x49')]=_0x38f0f9;return _0x2003fa;})[_0x0e7d('0x17')](respondWithFilteredResult(_0x84b57,_0x388970))['catch'](handleError(_0x84b57,null));};exports['show']=function(_0x2539fd,_0x2f0cd1){var _0x29b572={'raw':![],'where':{'id':_0x2539fd[_0x0e7d('0x4a')]['id']}},_0x2bfd2e={};_0x2bfd2e[_0x0e7d('0x33')]=_[_0x0e7d('0x4b')](db['Dynamics365Configuration'][_0x0e7d('0x4c')]);_0x2bfd2e[_0x0e7d('0x35')]=_[_0x0e7d('0x4b')](_0x2539fd['query']);_0x2bfd2e[_0x0e7d('0x36')]=_['intersection'](_0x2bfd2e[_0x0e7d('0x33')],_0x2bfd2e[_0x0e7d('0x35')]);_0x29b572[_0x0e7d('0x38')]=_[_0x0e7d('0x37')](_0x2bfd2e[_0x0e7d('0x33')],qs[_0x0e7d('0x39')](_0x2539fd[_0x0e7d('0x35')]['fields']));_0x29b572[_0x0e7d('0x38')]=_0x29b572[_0x0e7d('0x38')][_0x0e7d('0x3a')]?_0x29b572[_0x0e7d('0x38')]:_0x2bfd2e[_0x0e7d('0x33')];if(_0x2539fd[_0x0e7d('0x35')][_0x0e7d('0x46')]){_0x29b572[_0x0e7d('0x47')]=[{'all':!![]}];}_0x29b572=_[_0x0e7d('0x42')]({},_0x29b572,_0x2539fd[_0x0e7d('0x44')]);return db[_0x0e7d('0x30')]['find'](_0x29b572)['then'](handleEntityNotFound(_0x2f0cd1,null))[_0x0e7d('0x17')](respondWithResult(_0x2f0cd1,null))[_0x0e7d('0x21')](handleError(_0x2f0cd1,null));};exports[_0x0e7d('0x4d')]=function(_0x33d068,_0x4d8ed3){return db[_0x0e7d('0x30')]['create'](_0x33d068[_0x0e7d('0x4e')],{})[_0x0e7d('0x17')](respondWithResult(_0x4d8ed3,0xc9))[_0x0e7d('0x21')](handleError(_0x4d8ed3,null));};exports[_0x0e7d('0x2b')]=function(_0x514468,_0x496652){if(_0x514468[_0x0e7d('0x4e')]['id']){delete _0x514468['body']['id'];}return db['Dynamics365Configuration'][_0x0e7d('0x4f')]({'where':{'id':_0x514468[_0x0e7d('0x4a')]['id']}})[_0x0e7d('0x17')](handleEntityNotFound(_0x496652,null))[_0x0e7d('0x17')](saveUpdates(_0x514468['body'],null))[_0x0e7d('0x17')](respondWithResult(_0x496652,null))[_0x0e7d('0x21')](handleError(_0x496652,null));};exports[_0x0e7d('0x2c')]=function(_0x1e35b6,_0xfd923c){return db['Dynamics365Configuration'][_0x0e7d('0x4f')]({'where':{'id':_0x1e35b6[_0x0e7d('0x4a')]['id']}})['then'](handleEntityNotFound(_0xfd923c,null))[_0x0e7d('0x17')](removeEntity(_0xfd923c,null))[_0x0e7d('0x21')](handleError(_0xfd923c,null));};exports[_0x0e7d('0x50')]=function(_0x3ca4dd,_0x295cf8,_0x273042){var _0x41c265={};var _0x53440a={};var _0x3a394a;var _0x2c09de;return db['Dynamics365Configuration'][_0x0e7d('0x51')]({'where':{'id':_0x3ca4dd['params']['id']}})[_0x0e7d('0x17')](handleEntityNotFound(_0x295cf8,null))[_0x0e7d('0x17')](function(_0x114e64){if(_0x114e64){_0x3a394a=_0x114e64;_0x53440a['model']=_['keys'](db[_0x0e7d('0x52')][_0x0e7d('0x4c')]);_0x53440a[_0x0e7d('0x35')]=_['keys'](_0x3ca4dd[_0x0e7d('0x35')]);_0x53440a[_0x0e7d('0x36')]=_[_0x0e7d('0x37')](_0x53440a[_0x0e7d('0x33')],_0x53440a['query']);_0x41c265[_0x0e7d('0x38')]=_['intersection'](_0x53440a[_0x0e7d('0x33')],qs[_0x0e7d('0x39')](_0x3ca4dd[_0x0e7d('0x35')][_0x0e7d('0x39')]));_0x41c265[_0x0e7d('0x38')]=_0x41c265[_0x0e7d('0x38')]['length']?_0x41c265[_0x0e7d('0x38')]:_0x53440a[_0x0e7d('0x33')];_0x41c265['order']=qs[_0x0e7d('0x3e')](_0x3ca4dd['query'][_0x0e7d('0x3e')]);_0x41c265[_0x0e7d('0x3f')]=qs[_0x0e7d('0x36')](_[_0x0e7d('0x40')](_0x3ca4dd[_0x0e7d('0x35')],_0x53440a[_0x0e7d('0x36')]));if(_0x3ca4dd[_0x0e7d('0x35')]['filter']){_0x41c265['where']=_[_0x0e7d('0x42')](_0x41c265[_0x0e7d('0x3f')],{'$or':_['map'](_0x41c265['attributes'],function(_0x3455db){var _0x2353fb={};_0x2353fb[_0x3455db]={'$like':'%'+_0x3ca4dd[_0x0e7d('0x35')][_0x0e7d('0x41')]+'%'};return _0x2353fb;})});}_0x41c265=_[_0x0e7d('0x42')]({},_0x41c265,_0x3ca4dd['options']);return _0x3a394a[_0x0e7d('0x50')](_0x41c265);}})[_0x0e7d('0x17')](function(_0x3b2b0d){if(_0x3b2b0d){_0x2c09de=_0x3b2b0d['length'];if(!_0x3ca4dd[_0x0e7d('0x35')][_0x0e7d('0x3b')]('nolimit')){_0x41c265[_0x0e7d('0x27')]=qs[_0x0e7d('0x27')](_0x3ca4dd[_0x0e7d('0x35')][_0x0e7d('0x27')]);_0x41c265['offset']=qs['offset'](_0x3ca4dd[_0x0e7d('0x35')][_0x0e7d('0x26')]);}return _0x3a394a[_0x0e7d('0x50')](_0x41c265);}})['then'](function(_0x3de3c5){if(_0x3de3c5){return _0x3de3c5?{'count':_0x2c09de,'rows':_0x3de3c5}:null;}})[_0x0e7d('0x17')](respondWithResult(_0x295cf8,null))[_0x0e7d('0x21')](handleError(_0x295cf8,null));};exports[_0x0e7d('0x53')]=function(_0x5ef8ec,_0x275fcd,_0x2a5fc3){var _0x45b45b={};var _0xd4c16b={};var _0x131139;var _0x5649bf;return db[_0x0e7d('0x30')][_0x0e7d('0x51')]({'where':{'id':_0x5ef8ec['params']['id']}})[_0x0e7d('0x17')](handleEntityNotFound(_0x275fcd,null))[_0x0e7d('0x17')](function(_0x49da8f){if(_0x49da8f){_0x131139=_0x49da8f;_0xd4c16b[_0x0e7d('0x33')]=_[_0x0e7d('0x4b')](db[_0x0e7d('0x52')][_0x0e7d('0x4c')]);_0xd4c16b[_0x0e7d('0x35')]=_[_0x0e7d('0x4b')](_0x5ef8ec[_0x0e7d('0x35')]);_0xd4c16b['filters']=_[_0x0e7d('0x37')](_0xd4c16b[_0x0e7d('0x33')],_0xd4c16b[_0x0e7d('0x35')]);_0x45b45b[_0x0e7d('0x38')]=_['intersection'](_0xd4c16b['model'],qs['fields'](_0x5ef8ec[_0x0e7d('0x35')][_0x0e7d('0x39')]));_0x45b45b[_0x0e7d('0x38')]=_0x45b45b[_0x0e7d('0x38')]['length']?_0x45b45b['attributes']:_0xd4c16b[_0x0e7d('0x33')];_0x45b45b[_0x0e7d('0x3d')]=qs[_0x0e7d('0x3e')](_0x5ef8ec[_0x0e7d('0x35')][_0x0e7d('0x3e')]);_0x45b45b[_0x0e7d('0x3f')]=qs[_0x0e7d('0x36')](_['pick'](_0x5ef8ec[_0x0e7d('0x35')],_0xd4c16b['filters']));if(_0x5ef8ec[_0x0e7d('0x35')][_0x0e7d('0x41')]){_0x45b45b['where']=_[_0x0e7d('0x42')](_0x45b45b[_0x0e7d('0x3f')],{'$or':_[_0x0e7d('0x2f')](_0x45b45b['attributes'],function(_0x4d0649){var _0x37eb20={};_0x37eb20[_0x4d0649]={'$like':'%'+_0x5ef8ec[_0x0e7d('0x35')][_0x0e7d('0x41')]+'%'};return _0x37eb20;})});}_0x45b45b=_[_0x0e7d('0x42')]({},_0x45b45b,_0x5ef8ec[_0x0e7d('0x44')]);return _0x131139[_0x0e7d('0x53')](_0x45b45b);}})['then'](function(_0xd8539){if(_0xd8539){_0x5649bf=_0xd8539[_0x0e7d('0x3a')];if(!_0x5ef8ec[_0x0e7d('0x35')]['hasOwnProperty'](_0x0e7d('0x3c'))){_0x45b45b['limit']=qs['limit'](_0x5ef8ec[_0x0e7d('0x35')]['limit']);_0x45b45b['offset']=qs[_0x0e7d('0x26')](_0x5ef8ec[_0x0e7d('0x35')][_0x0e7d('0x26')]);}return _0x131139['getSubjects'](_0x45b45b);}})[_0x0e7d('0x17')](function(_0x302556){if(_0x302556){return _0x302556?{'count':_0x5649bf,'rows':_0x302556}:null;}})[_0x0e7d('0x17')](respondWithResult(_0x275fcd,null))[_0x0e7d('0x21')](handleError(_0x275fcd,null));};exports[_0x0e7d('0x54')]=function(_0x26df9d,_0x2d6679,_0x3f9b85){var _0x25a0fb={};var _0x4c961d={};var _0x5594cd;var _0x5dd531;return db[_0x0e7d('0x30')]['findOne']({'where':{'id':_0x26df9d['params']['id']}})['then'](handleEntityNotFound(_0x2d6679,null))[_0x0e7d('0x17')](function(_0x50a724){if(_0x50a724){_0x5594cd=_0x50a724;_0x4c961d['model']=_[_0x0e7d('0x4b')](db[_0x0e7d('0x52')][_0x0e7d('0x4c')]);_0x4c961d[_0x0e7d('0x35')]=_[_0x0e7d('0x4b')](_0x26df9d[_0x0e7d('0x35')]);_0x4c961d[_0x0e7d('0x36')]=_[_0x0e7d('0x37')](_0x4c961d[_0x0e7d('0x33')],_0x4c961d['query']);_0x25a0fb[_0x0e7d('0x38')]=_[_0x0e7d('0x37')](_0x4c961d[_0x0e7d('0x33')],qs[_0x0e7d('0x39')](_0x26df9d['query'][_0x0e7d('0x39')]));_0x25a0fb[_0x0e7d('0x38')]=_0x25a0fb[_0x0e7d('0x38')][_0x0e7d('0x3a')]?_0x25a0fb[_0x0e7d('0x38')]:_0x4c961d['model'];_0x25a0fb[_0x0e7d('0x3d')]=qs[_0x0e7d('0x3e')](_0x26df9d[_0x0e7d('0x35')]['sort']);_0x25a0fb['where']=qs[_0x0e7d('0x36')](_[_0x0e7d('0x40')](_0x26df9d[_0x0e7d('0x35')],_0x4c961d[_0x0e7d('0x36')]));if(_0x26df9d[_0x0e7d('0x35')][_0x0e7d('0x41')]){_0x25a0fb['where']=_[_0x0e7d('0x42')](_0x25a0fb[_0x0e7d('0x3f')],{'$or':_[_0x0e7d('0x2f')](_0x25a0fb[_0x0e7d('0x38')],function(_0x49cbc8){var _0x45cd59={};_0x45cd59[_0x49cbc8]={'$like':'%'+_0x26df9d['query'][_0x0e7d('0x41')]+'%'};return _0x45cd59;})});}_0x25a0fb=_[_0x0e7d('0x42')]({},_0x25a0fb,_0x26df9d[_0x0e7d('0x44')]);return _0x5594cd[_0x0e7d('0x54')](_0x25a0fb);}})['then'](function(_0x582c2e){if(_0x582c2e){_0x5dd531=_0x582c2e['length'];if(!_0x26df9d[_0x0e7d('0x35')]['hasOwnProperty'](_0x0e7d('0x3c'))){_0x25a0fb[_0x0e7d('0x27')]=qs[_0x0e7d('0x27')](_0x26df9d[_0x0e7d('0x35')]['limit']);_0x25a0fb[_0x0e7d('0x26')]=qs['offset'](_0x26df9d[_0x0e7d('0x35')]['offset']);}return _0x5594cd[_0x0e7d('0x54')](_0x25a0fb);}})['then'](function(_0xa2b04c){if(_0xa2b04c){return _0xa2b04c?{'count':_0x5dd531,'rows':_0xa2b04c}:null;}})[_0x0e7d('0x17')](respondWithResult(_0x2d6679,null))[_0x0e7d('0x21')](handleError(_0x2d6679,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index aa0a708..9805d7f 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 _0x3447=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','moment','bluebird','request-promise'];(function(_0xb6021f,_0x56a74a){var _0x54643b=function(_0x100310){while(--_0x100310){_0xb6021f['push'](_0xb6021f['shift']());}};_0x54643b(++_0x56a74a);}(_0x3447,0x13f));var _0x7344=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x3447[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x7344('0x0'));var util=require(_0x7344('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7344('0x2'));var BPromise=require(_0x7344('0x3'));var rp=require(_0x7344('0x4'));var fs=require('fs');var path=require(_0x7344('0x5'));var rimraf=require(_0x7344('0x6'));var config=require(_0x7344('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x7344('0x8')]=function(_0x56b235,_0x384c8c){return _0x56b235[_0x7344('0x9')](_0x7344('0xa'),attributes,{'tableName':_0x7344('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9269=['request-promise','rimraf','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2a58fd,_0x4d5172){var _0x2c3de4=function(_0x401ebe){while(--_0x401ebe){_0x2a58fd['push'](_0x2a58fd['shift']());}};_0x2c3de4(++_0x4d5172);}(_0x9269,0xc6));var _0x9926=function(_0x509f97,_0x442414){_0x509f97=_0x509f97-0x0;var _0x18bbef=_0x9269[_0x509f97];return _0x18bbef;};'use strict';var _=require(_0x9926('0x0'));var util=require(_0x9926('0x1'));var logger=require(_0x9926('0x2'))(_0x9926('0x3'));var moment=require(_0x9926('0x4'));var BPromise=require(_0x9926('0x5'));var rp=require(_0x9926('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9926('0x7'));var config=require('../../config/environment');var attributes=require(_0x9926('0x8'));module['exports']=function(_0x2bb07b,_0x4b785c){return _0x2bb07b[_0x9926('0x9')](_0x9926('0xa'),attributes,{'tableName':_0x9926('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 faadad1..66c1db9 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 _0x1fef=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1fef,0x186));var _0xf1fe=function(_0x292b3f,_0x50657d){_0x292b3f=_0x292b3f-0x0;var _0x48549f=_0x1fef[_0x292b3f];return _0x48549f;};'use strict';var _=require(_0xf1fe('0x0'));var util=require(_0xf1fe('0x1'));var moment=require(_0xf1fe('0x2'));var BPromise=require(_0xf1fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1fe('0x4'));var db=require(_0xf1fe('0x5'))['db'];var utils=require(_0xf1fe('0x6'));var logger=require(_0xf1fe('0x7'))(_0xf1fe('0x8'));var config=require(_0xf1fe('0x9'));var jayson=require(_0xf1fe('0xa'));var client=jayson[_0xf1fe('0xb')][_0xf1fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26e0b5,_0x23c4fa,_0x1a2ee1){return new BPromise(function(_0x4e725b,_0xe2bab2){return client[_0xf1fe('0xd')](_0x26e0b5,_0x1a2ee1)[_0xf1fe('0xe')](function(_0x2a07a4){logger[_0xf1fe('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x23c4fa,_0xf1fe('0x10'));logger[_0xf1fe('0x11')](_0xf1fe('0x12'),_0x23c4fa,_0xf1fe('0x10'),JSON[_0xf1fe('0x13')](_0x2a07a4));if(_0x2a07a4[_0xf1fe('0x14')]){if(_0x2a07a4['error'][_0xf1fe('0x15')]===0x1f4){logger['error'](_0xf1fe('0x16'),_0x23c4fa,_0x2a07a4[_0xf1fe('0x14')][_0xf1fe('0x17')]);return _0xe2bab2(_0x2a07a4[_0xf1fe('0x14')][_0xf1fe('0x17')]);}logger[_0xf1fe('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x23c4fa,_0x2a07a4[_0xf1fe('0x14')][_0xf1fe('0x17')]);return _0x4e725b(_0x2a07a4[_0xf1fe('0x14')][_0xf1fe('0x17')]);}else{logger['info'](_0xf1fe('0x16'),_0x23c4fa,_0xf1fe('0x10'));_0x4e725b(_0x2a07a4[_0xf1fe('0x18')]['message']);}})[_0xf1fe('0x19')](function(_0x56ec4a){logger[_0xf1fe('0x14')](_0xf1fe('0x16'),_0x23c4fa,_0x56ec4a);_0xe2bab2(_0x56ec4a);});});} \ No newline at end of file +var _0x3225=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x3225,0x17e));var _0x5322=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3225[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5322('0x0'));var util=require(_0x5322('0x1'));var moment=require(_0x5322('0x2'));var BPromise=require(_0x5322('0x3'));var rs=require(_0x5322('0x4'));var fs=require('fs');var Redis=require(_0x5322('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5322('0x6'));var logger=require(_0x5322('0x7'))('rpc');var config=require(_0x5322('0x8'));var jayson=require(_0x5322('0x9'));var client=jayson[_0x5322('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34ee06,_0x38638b,_0x1e715c){return new BPromise(function(_0xc5d034,_0x4b8e7c){return client['request'](_0x34ee06,_0x1e715c)['then'](function(_0x46068a){logger[_0x5322('0xb')](_0x5322('0xc'),_0x38638b,_0x5322('0xd'));logger['debug'](_0x5322('0xe'),_0x38638b,'request\x20sent',JSON[_0x5322('0xf')](_0x46068a));if(_0x46068a[_0x5322('0x10')]){if(_0x46068a[_0x5322('0x10')][_0x5322('0x11')]===0x1f4){logger[_0x5322('0x10')](_0x5322('0xc'),_0x38638b,_0x46068a[_0x5322('0x10')][_0x5322('0x12')]);return _0x4b8e7c(_0x46068a[_0x5322('0x10')][_0x5322('0x12')]);}logger['error'](_0x5322('0xc'),_0x38638b,_0x46068a['error'][_0x5322('0x12')]);return _0xc5d034(_0x46068a[_0x5322('0x10')][_0x5322('0x12')]);}else{logger[_0x5322('0xb')](_0x5322('0xc'),_0x38638b,_0x5322('0xd'));_0xc5d034(_0x46068a['result'][_0x5322('0x12')]);}})[_0x5322('0x13')](function(_0x3df8f7){logger[_0x5322('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38638b,_0x3df8f7);_0x4b8e7c(_0x3df8f7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index fbb7633..37f4df6 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 _0x2356=['../../components/auth/service','./intDynamics365Field.controller','index','get','/:id','isAuthenticated','put','update','destroy','exports','util','path','Router'];(function(_0x53d17e,_0xf979c9){var _0x35b0cc=function(_0x556323){while(--_0x556323){_0x53d17e['push'](_0x53d17e['shift']());}};_0x35b0cc(++_0xf979c9);}(_0x2356,0x14f));var _0x6235=function(_0x10ec09,_0x492ddb){_0x10ec09=_0x10ec09-0x0;var _0x8b5ed4=_0x2356[_0x10ec09];return _0x8b5ed4;};'use strict';var multer=require('multer');var util=require(_0x6235('0x0'));var path=require(_0x6235('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6235('0x2')]();var auth=require(_0x6235('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6235('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x6235('0x5')]);router[_0x6235('0x6')](_0x6235('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6235('0x8')](),controller['create']);router[_0x6235('0x9')](_0x6235('0x7'),auth[_0x6235('0x8')](),controller[_0x6235('0xa')]);router['delete'](_0x6235('0x7'),auth[_0x6235('0x8')](),controller[_0x6235('0xb')]);module[_0x6235('0xc')]=router; \ No newline at end of file +var _0x8ce3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x286e0f,_0xb6a192){var _0x3d9b03=function(_0x5bcb32){while(--_0x5bcb32){_0x286e0f['push'](_0x286e0f['shift']());}};_0x3d9b03(++_0xb6a192);}(_0x8ce3,0xc3));var _0x38ce=function(_0x5e2aaf,_0x5ee3e3){_0x5e2aaf=_0x5e2aaf-0x0;var _0x508383=_0x8ce3[_0x5e2aaf];return _0x508383;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var auth=require(_0x38ce('0x5'));var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router[_0x38ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xa')]);router[_0x38ce('0x9')]('/:id',auth[_0x38ce('0xb')](),controller[_0x38ce('0xc')]);router[_0x38ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xe')]);router['put'](_0x38ce('0xf'),auth['isAuthenticated'](),controller[_0x38ce('0x10')]);router[_0x38ce('0x11')](_0x38ce('0xf'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x12')]);module[_0x38ce('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 629fe43..2598168 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 _0xb3d0=['exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xb3d0,0x182));var _0x0b3d=function(_0x1d3863,_0x1aeb92){_0x1d3863=_0x1d3863-0x0;var _0x1ec6ae=_0xb3d0[_0x1d3863];return _0x1ec6ae;};'use strict';var Sequelize=require(_0x0b3d('0x0'));module[_0x0b3d('0x1')]={'type':{'type':Sequelize[_0x0b3d('0x2')](_0x0b3d('0x3'),'variable',_0x0b3d('0x4'),_0x0b3d('0x5')),'defaultValue':_0x0b3d('0x3')},'content':{'type':Sequelize[_0x0b3d('0x6')]},'key':{'type':Sequelize[_0x0b3d('0x6')]},'keyType':{'type':Sequelize[_0x0b3d('0x2')](_0x0b3d('0x3'),_0x0b3d('0x7'),_0x0b3d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0b3d('0x6')]},'nameField':{'type':Sequelize[_0x0b3d('0x6')]},'customField':{'type':Sequelize[_0x0b3d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b3d('0x6')]}}; \ No newline at end of file +var _0xde17=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4b8ff1,_0x36fc2b){var _0x5004b6=function(_0x459f1e){while(--_0x459f1e){_0x4b8ff1['push'](_0x4b8ff1['shift']());}};_0x5004b6(++_0x36fc2b);}(_0xde17,0x186));var _0x7de1=function(_0x148d9f,_0x5c9252){_0x148d9f=_0x148d9f-0x0;var _0xe43a34=_0xde17[_0x148d9f];return _0xe43a34;};'use strict';var Sequelize=require(_0x7de1('0x0'));module[_0x7de1('0x1')]={'type':{'type':Sequelize[_0x7de1('0x2')](_0x7de1('0x3'),_0x7de1('0x4'),_0x7de1('0x5'),_0x7de1('0x6')),'defaultValue':_0x7de1('0x3')},'content':{'type':Sequelize[_0x7de1('0x7')]},'key':{'type':Sequelize[_0x7de1('0x7')]},'keyType':{'type':Sequelize[_0x7de1('0x2')]('string',_0x7de1('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7de1('0x7')]},'idField':{'type':Sequelize[_0x7de1('0x7')]},'nameField':{'type':Sequelize[_0x7de1('0x7')]},'customField':{'type':Sequelize[_0x7de1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7de1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4e2444f..5dd1516 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 _0x9c50=['rows','catch','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','includeAll','include','findAll'];(function(_0x51d99b,_0x40f96f){var _0x359a78=function(_0x4eba9d){while(--_0x4eba9d){_0x51d99b['push'](_0x51d99b['shift']());}};_0x359a78(++_0x40f96f);}(_0x9c50,0xe7));var _0x09c5=function(_0x1c7de4,_0x4193a4){_0x1c7de4=_0x1c7de4-0x0;var _0x442792=_0x9c50[_0x1c7de4];return _0x442792;};'use strict';var pdf=require(_0x09c5('0x0'));var emlformat=require(_0x09c5('0x1'));var rimraf=require(_0x09c5('0x2'));var zipdir=require(_0x09c5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09c5('0x4'));var moment=require(_0x09c5('0x5'));var BPromise=require(_0x09c5('0x6'));var Mustache=require(_0x09c5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x09c5('0x8'));var csv=require('to-csv');var ejs=require(_0x09c5('0x9'));var fs=require('fs');var _=require(_0x09c5('0xa'));var squel=require('squel');var crypto=require(_0x09c5('0xb'));var jsforce=require(_0x09c5('0xc'));var deskjs=require(_0x09c5('0xd'));var toCsv=require(_0x09c5('0xe'));var querystring=require(_0x09c5('0xf'));var Papa=require(_0x09c5('0x10'));var Redis=require(_0x09c5('0x11'));var authService=require(_0x09c5('0x12'));var qs=require(_0x09c5('0x13'));var as=require(_0x09c5('0x14'));var hardwareService=require(_0x09c5('0x15'));var logger=require('../../config/logger')(_0x09c5('0x16'));var utils=require('../../config/utils');var config=require(_0x09c5('0x17'));var licenseUtil=require(_0x09c5('0x18'));var db=require(_0x09c5('0x19'))['db'];function respondWithStatusCode(_0x537108,_0x572639){_0x572639=_0x572639||0xcc;return function(_0x11b434){if(_0x11b434){return _0x537108[_0x09c5('0x1a')](_0x572639);}return _0x537108[_0x09c5('0x1b')](_0x572639)[_0x09c5('0x1c')]();};}function respondWithResult(_0x5b5f32,_0x50d110){_0x50d110=_0x50d110||0xc8;return function(_0x1655a6){if(_0x1655a6){return _0x5b5f32['status'](_0x50d110)[_0x09c5('0x1d')](_0x1655a6);}};}function respondWithFilteredResult(_0x28298b,_0x34d08a){return function(_0x57dcca){if(_0x57dcca){var _0x2d4154=_0x57dcca[_0x09c5('0x1e')],_0x2d51d4=_0x34d08a[_0x09c5('0x1f')],_0x47d288=_0x34d08a['offset']+_0x34d08a['limit'],_0x4221d0;if(_0x47d288>=_0x2d4154){_0x47d288=_0x2d4154;_0x4221d0=0xc8;}else{_0x4221d0=0xce;}_0x28298b[_0x09c5('0x1b')](_0x4221d0);return _0x28298b[_0x09c5('0x20')](_0x09c5('0x21'),_0x2d51d4+'-'+_0x47d288+'/'+_0x2d4154)['json'](_0x57dcca);}return null;};}function patchUpdates(_0x14a8f0){return function(_0x6eff39){try{jsonpatch[_0x09c5('0x22')](_0x6eff39,_0x14a8f0,!![]);}catch(_0x5d0664){return BPromise[_0x09c5('0x23')](_0x5d0664);}return _0x6eff39[_0x09c5('0x24')]();};}function saveUpdates(_0x22e2d9,_0x31ddb1){return function(_0x55017a){if(_0x55017a){return _0x55017a[_0x09c5('0x25')](_0x22e2d9)[_0x09c5('0x26')](function(_0x371357){return _0x371357;});}return null;};}function removeEntity(_0x432b8e,_0x4b6662){return function(_0x183452){if(_0x183452){return _0x183452[_0x09c5('0x27')]()['then'](function(){_0x432b8e[_0x09c5('0x1b')](0xcc)[_0x09c5('0x1c')]();});}};}function handleEntityNotFound(_0x2128ce,_0x278197){return function(_0x26a456){if(!_0x26a456){_0x2128ce[_0x09c5('0x1a')](0x194);}return _0x26a456;};}function handleError(_0x5bc47d,_0x56419a){_0x56419a=_0x56419a||0x1f4;return function(_0x5c66d8){logger[_0x09c5('0x28')](_0x5c66d8[_0x09c5('0x29')]);if(_0x5c66d8[_0x09c5('0x2a')]){delete _0x5c66d8[_0x09c5('0x2a')];}_0x5bc47d[_0x09c5('0x1b')](_0x56419a)[_0x09c5('0x2b')](_0x5c66d8);};}exports[_0x09c5('0x2c')]=function(_0x55ca97,_0x31d7b1){var _0xd11fee={},_0x215b49={},_0x4fc5f2={'count':0x0,'rows':[]};var _0x500b6f=_[_0x09c5('0x2d')](db[_0x09c5('0x2e')][_0x09c5('0x2f')],function(_0x5ea9ad){return{'name':_0x5ea9ad['fieldName'],'type':_0x5ea9ad[_0x09c5('0x30')][_0x09c5('0x31')]};});_0x215b49[_0x09c5('0x32')]=_[_0x09c5('0x2d')](_0x500b6f,_0x09c5('0x2a'));_0x215b49[_0x09c5('0x33')]=_[_0x09c5('0x34')](_0x55ca97[_0x09c5('0x33')]);_0x215b49[_0x09c5('0x35')]=_[_0x09c5('0x36')](_0x215b49[_0x09c5('0x32')],_0x215b49[_0x09c5('0x33')]);_0xd11fee[_0x09c5('0x37')]=_[_0x09c5('0x36')](_0x215b49[_0x09c5('0x32')],qs[_0x09c5('0x38')](_0x55ca97['query'][_0x09c5('0x38')]));_0xd11fee['attributes']=_0xd11fee[_0x09c5('0x37')][_0x09c5('0x39')]?_0xd11fee[_0x09c5('0x37')]:_0x215b49[_0x09c5('0x32')];if(!_0x55ca97['query'][_0x09c5('0x3a')](_0x09c5('0x3b'))){_0xd11fee['limit']=qs[_0x09c5('0x3c')](_0x55ca97['query']['limit']);_0xd11fee[_0x09c5('0x1f')]=qs[_0x09c5('0x1f')](_0x55ca97[_0x09c5('0x33')][_0x09c5('0x1f')]);}_0xd11fee['order']=qs[_0x09c5('0x3d')](_0x55ca97['query']['sort']);_0xd11fee[_0x09c5('0x3e')]=qs[_0x09c5('0x35')](_['pick'](_0x55ca97[_0x09c5('0x33')],_0x215b49['filters']),_0x500b6f);if(_0x55ca97[_0x09c5('0x33')][_0x09c5('0x3f')]){_0xd11fee['where']=_[_0x09c5('0x40')](_0xd11fee[_0x09c5('0x3e')],{'$or':_[_0x09c5('0x2d')](_0x500b6f,function(_0x4dd345){if(_0x4dd345[_0x09c5('0x30')]!=='VIRTUAL'){var _0x521ccd={};_0x521ccd[_0x4dd345[_0x09c5('0x2a')]]={'$like':'%'+_0x55ca97[_0x09c5('0x33')][_0x09c5('0x3f')]+'%'};return _0x521ccd;}})});}_0xd11fee=_[_0x09c5('0x40')]({},_0xd11fee,_0x55ca97[_0x09c5('0x41')]);var _0x5df9c6={'where':_0xd11fee[_0x09c5('0x3e')]};return db[_0x09c5('0x2e')][_0x09c5('0x1e')](_0x5df9c6)[_0x09c5('0x26')](function(_0x531ebc){_0x4fc5f2[_0x09c5('0x1e')]=_0x531ebc;if(_0x55ca97[_0x09c5('0x33')][_0x09c5('0x42')]){_0xd11fee[_0x09c5('0x43')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x09c5('0x44')](_0xd11fee);})['then'](function(_0x57f3ad){_0x4fc5f2[_0x09c5('0x45')]=_0x57f3ad;return _0x4fc5f2;})[_0x09c5('0x26')](respondWithFilteredResult(_0x31d7b1,_0xd11fee))[_0x09c5('0x46')](handleError(_0x31d7b1,null));};exports['show']=function(_0x39737d,_0x92c751){var _0x107322={'raw':!![],'where':{'id':_0x39737d['params']['id']}},_0x555fd9={};_0x555fd9[_0x09c5('0x32')]=_[_0x09c5('0x34')](db[_0x09c5('0x2e')][_0x09c5('0x2f')]);_0x555fd9[_0x09c5('0x33')]=_['keys'](_0x39737d[_0x09c5('0x33')]);_0x555fd9[_0x09c5('0x35')]=_['intersection'](_0x555fd9[_0x09c5('0x32')],_0x555fd9['query']);_0x107322[_0x09c5('0x37')]=_[_0x09c5('0x36')](_0x555fd9['model'],qs[_0x09c5('0x38')](_0x39737d['query'][_0x09c5('0x38')]));_0x107322['attributes']=_0x107322[_0x09c5('0x37')]['length']?_0x107322[_0x09c5('0x37')]:_0x555fd9['model'];if(_0x39737d[_0x09c5('0x33')][_0x09c5('0x42')]){_0x107322[_0x09c5('0x43')]=[{'all':!![]}];}_0x107322=_['merge']({},_0x107322,_0x39737d['options']);return db[_0x09c5('0x2e')][_0x09c5('0x47')](_0x107322)[_0x09c5('0x26')](handleEntityNotFound(_0x92c751,null))['then'](respondWithResult(_0x92c751,null))[_0x09c5('0x46')](handleError(_0x92c751,null));};exports['create']=function(_0x49e447,_0x4d6620){return db[_0x09c5('0x2e')][_0x09c5('0x48')](_0x49e447[_0x09c5('0x49')],{})[_0x09c5('0x26')](respondWithResult(_0x4d6620,0xc9))['catch'](handleError(_0x4d6620,null));};exports[_0x09c5('0x25')]=function(_0x6324fd,_0x396d5f){if(_0x6324fd[_0x09c5('0x49')]['id']){delete _0x6324fd[_0x09c5('0x49')]['id'];}return db['Dynamics365Field'][_0x09c5('0x47')]({'where':{'id':_0x6324fd[_0x09c5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x396d5f,null))[_0x09c5('0x26')](saveUpdates(_0x6324fd['body'],null))[_0x09c5('0x26')](respondWithResult(_0x396d5f,null))[_0x09c5('0x46')](handleError(_0x396d5f,null));};exports['destroy']=function(_0x3c2f5b,_0x2b9d5b){return db[_0x09c5('0x2e')][_0x09c5('0x47')]({'where':{'id':_0x3c2f5b[_0x09c5('0x4a')]['id']}})[_0x09c5('0x26')](handleEntityNotFound(_0x2b9d5b,null))[_0x09c5('0x26')](removeEntity(_0x2b9d5b,null))[_0x09c5('0x46')](handleError(_0x2b9d5b,null));}; \ No newline at end of file +var _0xd37d=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','options','find','create','body','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields'];(function(_0x1d5aa9,_0x39e291){var _0x60c101=function(_0x21a407){while(--_0x21a407){_0x1d5aa9['push'](_0x1d5aa9['shift']());}};_0x60c101(++_0x39e291);}(_0xd37d,0xe1));var _0xdd37=function(_0x1d37fc,_0x4db492){_0x1d37fc=_0x1d37fc-0x0;var _0x652aa6=_0xd37d[_0x1d37fc];return _0x652aa6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdd37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd37('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd37('0x2'));var Mustache=require(_0xdd37('0x3'));var util=require(_0xdd37('0x4'));var path=require(_0xdd37('0x5'));var sox=require(_0xdd37('0x6'));var csv=require(_0xdd37('0x7'));var ejs=require(_0xdd37('0x8'));var fs=require('fs');var _=require(_0xdd37('0x9'));var squel=require('squel');var crypto=require(_0xdd37('0xa'));var jsforce=require(_0xdd37('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd37('0x7'));var querystring=require(_0xdd37('0xc'));var Papa=require(_0xdd37('0xd'));var Redis=require(_0xdd37('0xe'));var authService=require(_0xdd37('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdd37('0x10'));var hardwareService=require(_0xdd37('0x11'));var logger=require(_0xdd37('0x12'))(_0xdd37('0x13'));var utils=require(_0xdd37('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdd37('0x15'));var db=require(_0xdd37('0x16'))['db'];function respondWithStatusCode(_0x22712a,_0x1b8a85){_0x1b8a85=_0x1b8a85||0xcc;return function(_0x1c65f8){if(_0x1c65f8){return _0x22712a[_0xdd37('0x17')](_0x1b8a85);}return _0x22712a['status'](_0x1b8a85)['end']();};}function respondWithResult(_0x564928,_0x584015){_0x584015=_0x584015||0xc8;return function(_0x4a56ee){if(_0x4a56ee){return _0x564928[_0xdd37('0x18')](_0x584015)['json'](_0x4a56ee);}};}function respondWithFilteredResult(_0x4a1f9b,_0x189e26){return function(_0x2d3020){if(_0x2d3020){var _0x524a37=_0x2d3020[_0xdd37('0x19')],_0xb17d09=_0x189e26[_0xdd37('0x1a')],_0x1032e6=_0x189e26[_0xdd37('0x1a')]+_0x189e26[_0xdd37('0x1b')],_0x39d3fe;if(_0x1032e6>=_0x524a37){_0x1032e6=_0x524a37;_0x39d3fe=0xc8;}else{_0x39d3fe=0xce;}_0x4a1f9b[_0xdd37('0x18')](_0x39d3fe);return _0x4a1f9b[_0xdd37('0x1c')](_0xdd37('0x1d'),_0xb17d09+'-'+_0x1032e6+'/'+_0x524a37)['json'](_0x2d3020);}return null;};}function patchUpdates(_0x2be0ea){return function(_0x58d3d1){try{jsonpatch['apply'](_0x58d3d1,_0x2be0ea,!![]);}catch(_0x491a3c){return BPromise['reject'](_0x491a3c);}return _0x58d3d1['save']();};}function saveUpdates(_0x3d113d,_0x2ac417){return function(_0x19f6f4){if(_0x19f6f4){return _0x19f6f4[_0xdd37('0x1e')](_0x3d113d)[_0xdd37('0x1f')](function(_0x149346){return _0x149346;});}return null;};}function removeEntity(_0xb731e3,_0x3de98e){return function(_0x1414dd){if(_0x1414dd){return _0x1414dd[_0xdd37('0x20')]()['then'](function(){_0xb731e3[_0xdd37('0x18')](0xcc)[_0xdd37('0x21')]();});}};}function handleEntityNotFound(_0x34a4ce,_0x5aa67c){return function(_0x349337){if(!_0x349337){_0x34a4ce['sendStatus'](0x194);}return _0x349337;};}function handleError(_0xcec0c2,_0x3bfad9){_0x3bfad9=_0x3bfad9||0x1f4;return function(_0x35012f){logger[_0xdd37('0x22')](_0x35012f[_0xdd37('0x23')]);if(_0x35012f[_0xdd37('0x24')]){delete _0x35012f[_0xdd37('0x24')];}_0xcec0c2[_0xdd37('0x18')](_0x3bfad9)[_0xdd37('0x25')](_0x35012f);};}exports[_0xdd37('0x26')]=function(_0x1f3135,_0x435bc3){var _0x5c6f00={},_0x3c8b73={},_0x2aaee2={'count':0x0,'rows':[]};var _0x128df5=_[_0xdd37('0x27')](db[_0xdd37('0x28')][_0xdd37('0x29')],function(_0x81999){return{'name':_0x81999[_0xdd37('0x2a')],'type':_0x81999[_0xdd37('0x2b')]['key']};});_0x3c8b73[_0xdd37('0x2c')]=_[_0xdd37('0x27')](_0x128df5,'name');_0x3c8b73[_0xdd37('0x2d')]=_[_0xdd37('0x2e')](_0x1f3135[_0xdd37('0x2d')]);_0x3c8b73[_0xdd37('0x2f')]=_['intersection'](_0x3c8b73[_0xdd37('0x2c')],_0x3c8b73['query']);_0x5c6f00[_0xdd37('0x30')]=_[_0xdd37('0x31')](_0x3c8b73[_0xdd37('0x2c')],qs[_0xdd37('0x32')](_0x1f3135[_0xdd37('0x2d')][_0xdd37('0x32')]));_0x5c6f00[_0xdd37('0x30')]=_0x5c6f00['attributes'][_0xdd37('0x33')]?_0x5c6f00[_0xdd37('0x30')]:_0x3c8b73[_0xdd37('0x2c')];if(!_0x1f3135[_0xdd37('0x2d')][_0xdd37('0x34')]('nolimit')){_0x5c6f00[_0xdd37('0x1b')]=qs['limit'](_0x1f3135['query'][_0xdd37('0x1b')]);_0x5c6f00[_0xdd37('0x1a')]=qs[_0xdd37('0x1a')](_0x1f3135[_0xdd37('0x2d')][_0xdd37('0x1a')]);}_0x5c6f00[_0xdd37('0x35')]=qs[_0xdd37('0x36')](_0x1f3135['query'][_0xdd37('0x36')]);_0x5c6f00[_0xdd37('0x37')]=qs['filters'](_[_0xdd37('0x38')](_0x1f3135[_0xdd37('0x2d')],_0x3c8b73[_0xdd37('0x2f')]),_0x128df5);if(_0x1f3135[_0xdd37('0x2d')][_0xdd37('0x39')]){_0x5c6f00[_0xdd37('0x37')]=_[_0xdd37('0x3a')](_0x5c6f00[_0xdd37('0x37')],{'$or':_[_0xdd37('0x27')](_0x128df5,function(_0x490742){if(_0x490742['type']!==_0xdd37('0x3b')){var _0x3604f2={};_0x3604f2[_0x490742[_0xdd37('0x24')]]={'$like':'%'+_0x1f3135[_0xdd37('0x2d')][_0xdd37('0x39')]+'%'};return _0x3604f2;}})});}_0x5c6f00=_[_0xdd37('0x3a')]({},_0x5c6f00,_0x1f3135['options']);var _0x3bdc20={'where':_0x5c6f00['where']};return db['Dynamics365Field'][_0xdd37('0x19')](_0x3bdc20)[_0xdd37('0x1f')](function(_0x508142){_0x2aaee2[_0xdd37('0x19')]=_0x508142;if(_0x1f3135[_0xdd37('0x2d')][_0xdd37('0x3c')]){_0x5c6f00['include']=[{'all':!![]}];}return db[_0xdd37('0x28')][_0xdd37('0x3d')](_0x5c6f00);})[_0xdd37('0x1f')](function(_0x1ab51c){_0x2aaee2[_0xdd37('0x3e')]=_0x1ab51c;return _0x2aaee2;})[_0xdd37('0x1f')](respondWithFilteredResult(_0x435bc3,_0x5c6f00))[_0xdd37('0x3f')](handleError(_0x435bc3,null));};exports['show']=function(_0xb8efdc,_0x205693){var _0x155ef8={'raw':!![],'where':{'id':_0xb8efdc[_0xdd37('0x40')]['id']}},_0x5e0d2d={};_0x5e0d2d[_0xdd37('0x2c')]=_[_0xdd37('0x2e')](db[_0xdd37('0x28')][_0xdd37('0x29')]);_0x5e0d2d[_0xdd37('0x2d')]=_[_0xdd37('0x2e')](_0xb8efdc[_0xdd37('0x2d')]);_0x5e0d2d[_0xdd37('0x2f')]=_[_0xdd37('0x31')](_0x5e0d2d['model'],_0x5e0d2d[_0xdd37('0x2d')]);_0x155ef8[_0xdd37('0x30')]=_[_0xdd37('0x31')](_0x5e0d2d[_0xdd37('0x2c')],qs[_0xdd37('0x32')](_0xb8efdc[_0xdd37('0x2d')]['fields']));_0x155ef8[_0xdd37('0x30')]=_0x155ef8[_0xdd37('0x30')][_0xdd37('0x33')]?_0x155ef8[_0xdd37('0x30')]:_0x5e0d2d[_0xdd37('0x2c')];if(_0xb8efdc['query'][_0xdd37('0x3c')]){_0x155ef8['include']=[{'all':!![]}];}_0x155ef8=_[_0xdd37('0x3a')]({},_0x155ef8,_0xb8efdc[_0xdd37('0x41')]);return db[_0xdd37('0x28')][_0xdd37('0x42')](_0x155ef8)[_0xdd37('0x1f')](handleEntityNotFound(_0x205693,null))['then'](respondWithResult(_0x205693,null))['catch'](handleError(_0x205693,null));};exports[_0xdd37('0x43')]=function(_0x281cb7,_0x5738fd){return db[_0xdd37('0x28')][_0xdd37('0x43')](_0x281cb7[_0xdd37('0x44')],{})[_0xdd37('0x1f')](respondWithResult(_0x5738fd,0xc9))[_0xdd37('0x3f')](handleError(_0x5738fd,null));};exports[_0xdd37('0x1e')]=function(_0x39043f,_0x45318c){if(_0x39043f[_0xdd37('0x44')]['id']){delete _0x39043f[_0xdd37('0x44')]['id'];}return db[_0xdd37('0x28')][_0xdd37('0x42')]({'where':{'id':_0x39043f[_0xdd37('0x40')]['id']}})[_0xdd37('0x1f')](handleEntityNotFound(_0x45318c,null))['then'](saveUpdates(_0x39043f[_0xdd37('0x44')],null))[_0xdd37('0x1f')](respondWithResult(_0x45318c,null))[_0xdd37('0x3f')](handleError(_0x45318c,null));};exports[_0xdd37('0x20')]=function(_0x2a002d,_0x32fa91){return db[_0xdd37('0x28')][_0xdd37('0x42')]({'where':{'id':_0x2a002d['params']['id']}})['then'](handleEntityNotFound(_0x32fa91,null))[_0xdd37('0x1f')](removeEntity(_0x32fa91,null))['catch'](handleError(_0x32fa91,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5582c9d..c777034 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 _0xd821=['FieldId','api','bluebird','request-promise','path','../../config/environment','exports','Dynamics365Field','dynamics365_unique_index','idField'];(function(_0x3c891e,_0x45789a){var _0x3df618=function(_0x161d6e){while(--_0x161d6e){_0x3c891e['push'](_0x3c891e['shift']());}};_0x3df618(++_0x45789a);}(_0xd821,0x155));var _0x1d82=function(_0x4b2950,_0x279d01){_0x4b2950=_0x4b2950-0x0;var _0x11703b=_0xd821[_0x4b2950];return _0x11703b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1d82('0x0'));var moment=require('moment');var BPromise=require(_0x1d82('0x1'));var rp=require(_0x1d82('0x2'));var fs=require('fs');var path=require(_0x1d82('0x3'));var rimraf=require('rimraf');var config=require(_0x1d82('0x4'));var attributes=require('./intDynamics365Field.attributes');module[_0x1d82('0x5')]=function(_0x28aed5,_0x160bd0){return _0x28aed5['define'](_0x1d82('0x6'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x1d82('0x7'),'fields':[_0x1d82('0x8'),_0x1d82('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x061e=['bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x49dba5,_0x1086fd){var _0x495fc6=function(_0x26b659){while(--_0x26b659){_0x49dba5['push'](_0x49dba5['shift']());}};_0x495fc6(++_0x1086fd);}(_0x061e,0x118));var _0xe061=function(_0xd45c42,_0x20d73b){_0xd45c42=_0xd45c42-0x0;var _0x4eb099=_0x061e[_0xd45c42];return _0x4eb099;};'use strict';var _=require(_0xe061('0x0'));var util=require(_0xe061('0x1'));var logger=require(_0xe061('0x2'))(_0xe061('0x3'));var moment=require(_0xe061('0x4'));var BPromise=require(_0xe061('0x5'));var rp=require(_0xe061('0x6'));var fs=require('fs');var path=require(_0xe061('0x7'));var rimraf=require('rimraf');var config=require(_0xe061('0x8'));var attributes=require(_0xe061('0x9'));module[_0xe061('0xa')]=function(_0xfc3f7b,_0x1f68b3){return _0xfc3f7b[_0xe061('0xb')]('Dynamics365Field',attributes,{'tableName':_0xe061('0xc'),'paranoid':![],'indexes':[{'name':_0xe061('0xd'),'fields':[_0xe061('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 1521702..00d5665 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 _0xb7f0=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x1354c9,_0x475347){_0x1354c9=_0x1354c9-0x0;var _0x116916=_0xb7f0[_0x1354c9];return _0x116916;};'use strict';var _=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var moment=require(_0x0b7f('0x2'));var BPromise=require(_0x0b7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7f('0x4'))['db'];var utils=require(_0x0b7f('0x5'));var logger=require(_0x0b7f('0x6'))(_0x0b7f('0x7'));var config=require(_0x0b7f('0x8'));var jayson=require(_0x0b7f('0x9'));var client=jayson[_0x0b7f('0xa')][_0x0b7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10dc6c,_0x36ff5c,_0x53f9a5){return new BPromise(function(_0x98065a,_0x65287){return client['request'](_0x10dc6c,_0x53f9a5)[_0x0b7f('0xc')](function(_0x3b44bd){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x36ff5c,'request\x20sent');logger[_0x0b7f('0xd')](_0x0b7f('0xe'),_0x36ff5c,_0x0b7f('0xf'),JSON[_0x0b7f('0x10')](_0x3b44bd));if(_0x3b44bd[_0x0b7f('0x11')]){if(_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x12')]===0x1f4){logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);return _0x65287(_0x3b44bd['error'][_0x0b7f('0x14')]);}logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);return _0x98065a(_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);}else{logger[_0x0b7f('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x36ff5c,_0x0b7f('0xf'));_0x98065a(_0x3b44bd[_0x0b7f('0x16')][_0x0b7f('0x14')]);}})[_0x0b7f('0x17')](function(_0x58c901){logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x58c901);_0x65287(_0x58c901);});});} \ No newline at end of file +var _0xb2ac=['debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x2ed2d2,_0x2b3aff){var _0x393e91=function(_0xfa2d8b){while(--_0xfa2d8b){_0x2ed2d2['push'](_0x2ed2d2['shift']());}};_0x393e91(++_0x2b3aff);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x5d0720,_0x7c8f1){_0x5d0720=_0x5d0720-0x0;var _0x3196e4=_0xb2ac[_0x5d0720];return _0x3196e4;};'use strict';var _=require(_0xcb2a('0x0'));var util=require(_0xcb2a('0x1'));var moment=require(_0xcb2a('0x2'));var BPromise=require(_0xcb2a('0x3'));var rs=require(_0xcb2a('0x4'));var fs=require('fs');var Redis=require(_0xcb2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb2a('0x6'));var logger=require(_0xcb2a('0x7'))(_0xcb2a('0x8'));var config=require(_0xcb2a('0x9'));var jayson=require(_0xcb2a('0xa'));var client=jayson[_0xcb2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8de8,_0x3e87c1,_0x55dddc){return new BPromise(function(_0x5201a8,_0x5c1d8e){return client[_0xcb2a('0xc')](_0x2a8de8,_0x55dddc)['then'](function(_0x13b6b5){logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));logger[_0xcb2a('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3e87c1,_0xcb2a('0xf'),JSON[_0xcb2a('0x11')](_0x13b6b5));if(_0x13b6b5['error']){if(_0x13b6b5[_0xcb2a('0x12')]['code']===0x1f4){logger['error'](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);return _0x5c1d8e(_0x13b6b5[_0xcb2a('0x12')]['message']);}logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5['error'][_0xcb2a('0x13')]);return _0x5201a8(_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);}else{logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));_0x5201a8(_0x13b6b5[_0xcb2a('0x14')][_0xcb2a('0x13')]);}})['catch'](function(_0x487eec){logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x487eec);_0x5c1d8e(_0x487eec);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e6a9e73..e969443 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 _0x54f1=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index'];(function(_0x58389d,_0x3137df){var _0x2be20a=function(_0x2b6f46){while(--_0x2b6f46){_0x58389d['push'](_0x58389d['shift']());}};_0x2be20a(++_0x3137df);}(_0x54f1,0x1bf));var _0x154f=function(_0xf07a2b,_0x34505b){_0xf07a2b=_0xf07a2b-0x0;var _0x350517=_0x54f1[_0xf07a2b];return _0x350517;};'use strict';var multer=require(_0x154f('0x0'));var util=require(_0x154f('0x1'));var path=require(_0x154f('0x2'));var timeout=require(_0x154f('0x3'));var express=require(_0x154f('0x4'));var router=express[_0x154f('0x5')]();var auth=require(_0x154f('0x6'));var interaction=require(_0x154f('0x7'));var config=require(_0x154f('0x8'));var controller=require(_0x154f('0x9'));router[_0x154f('0xa')]('/',auth['isAuthenticated'](),controller[_0x154f('0xb')]);router[_0x154f('0xa')](_0x154f('0xc'),auth[_0x154f('0xd')](),controller[_0x154f('0xe')]);router['get'](_0x154f('0xf'),auth[_0x154f('0xd')](),controller[_0x154f('0x10')]);router[_0x154f('0xa')](_0x154f('0x11'),auth['isAuthenticated'](),controller[_0x154f('0x12')]);router[_0x154f('0x13')]('/',auth[_0x154f('0xd')](),controller[_0x154f('0x14')]);router[_0x154f('0x13')]('/:id/configurations',auth[_0x154f('0xd')](),controller[_0x154f('0x15')]);router[_0x154f('0x16')](_0x154f('0xc'),auth['isAuthenticated'](),controller[_0x154f('0x17')]);router[_0x154f('0x18')]('/:id',auth[_0x154f('0xd')](),controller[_0x154f('0x19')]);module[_0x154f('0x1a')]=router; \ No newline at end of file +var _0x3669=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','destroy','exports'];(function(_0x229b33,_0x2cd4a9){var _0x1a78fe=function(_0x293e95){while(--_0x293e95){_0x229b33['push'](_0x229b33['shift']());}};_0x1a78fe(++_0x2cd4a9);}(_0x3669,0x1ee));var _0x9366=function(_0x4c8266,_0x49976c){_0x4c8266=_0x4c8266-0x0;var _0x580298=_0x3669[_0x4c8266];return _0x580298;};'use strict';var multer=require(_0x9366('0x0'));var util=require(_0x9366('0x1'));var path=require('path');var timeout=require(_0x9366('0x2'));var express=require(_0x9366('0x3'));var router=express['Router']();var auth=require(_0x9366('0x4'));var interaction=require(_0x9366('0x5'));var config=require('../../config/environment');var controller=require(_0x9366('0x6'));router[_0x9366('0x7')]('/',auth[_0x9366('0x8')](),controller[_0x9366('0x9')]);router['get'](_0x9366('0xa'),auth[_0x9366('0x8')](),controller['show']);router['get'](_0x9366('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x9366('0x7')](_0x9366('0xc'),auth['isAuthenticated'](),controller[_0x9366('0xd')]);router[_0x9366('0xe')]('/',auth[_0x9366('0x8')](),controller['create']);router[_0x9366('0xe')](_0x9366('0xb'),auth[_0x9366('0x8')](),controller[_0x9366('0xf')]);router[_0x9366('0x10')](_0x9366('0xa'),auth[_0x9366('0x8')](),controller['update']);router['delete'](_0x9366('0xa'),auth['isAuthenticated'](),controller[_0x9366('0x11')]);module[_0x9366('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3341b45..8f08cc8 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 _0xdaf5=['sequelize','STRING','remoteUri'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdaf5,0xc3));var _0x5daf=function(_0x2a5541,_0x1324c3){_0x2a5541=_0x2a5541-0x0;var _0x54fd9e=_0xdaf5[_0x2a5541];return _0x54fd9e;};'use strict';var Sequelize=require(_0x5daf('0x0'));module['exports']={'name':{'type':Sequelize[_0x5daf('0x1')]},'description':{'type':Sequelize[_0x5daf('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x5daf('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5daf('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x70df=['username','remoteUri','sequelize','STRING'];(function(_0x386515,_0x4d0168){var _0x374caf=function(_0x2b1074){while(--_0x2b1074){_0x386515['push'](_0x386515['shift']());}};_0x374caf(++_0x4d0168);}(_0x70df,0x12e));var _0xf70d=function(_0x39b25c,_0xa8d8c3){_0x39b25c=_0x39b25c-0x0;var _0x2d825c=_0x70df[_0x39b25c];return _0x2d825c;};'use strict';var Sequelize=require(_0xf70d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf70d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xf70d('0x2')},'apiKey':{'type':Sequelize[_0xf70d('0x1')]},'remoteUri':{'type':Sequelize[_0xf70d('0x1')],'unique':_0xf70d('0x3')},'serverUrl':{'type':Sequelize[_0xf70d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4128e0b..1d1e077 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 _0xb197=['catch','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x28618e,_0x31d0f4){var _0x4ee129=function(_0x430331){while(--_0x430331){_0x28618e['push'](_0x28618e['shift']());}};_0x4ee129(++_0x31d0f4);}(_0xb197,0xd4));var _0x7b19=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xb197[_0x2a8c21];return _0x5f3061;};'use strict';var pdf=require(_0x7b19('0x0'));var emlformat=require(_0x7b19('0x1'));var rimraf=require(_0x7b19('0x2'));var zipdir=require(_0x7b19('0x3'));var jsonpatch=require(_0x7b19('0x4'));var rp=require('request-promise');var moment=require(_0x7b19('0x5'));var BPromise=require(_0x7b19('0x6'));var Mustache=require(_0x7b19('0x7'));var util=require(_0x7b19('0x8'));var path=require(_0x7b19('0x9'));var sox=require('sox');var csv=require(_0x7b19('0xa'));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('desk.js');var toCsv=require(_0x7b19('0xa'));var querystring=require('querystring');var Papa=require(_0x7b19('0xb'));var Redis=require(_0x7b19('0xc'));var authService=require(_0x7b19('0xd'));var qs=require(_0x7b19('0xe'));var as=require(_0x7b19('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b19('0x10'))(_0x7b19('0x11'));var utils=require('../../config/utils');var config=require(_0x7b19('0x12'));var licenseUtil=require(_0x7b19('0x13'));var db=require(_0x7b19('0x14'))['db'];var integrations=require(_0x7b19('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x7b19('0x16')][_0x7b19('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x569476,_0xc69f26,_0x1cfbee,_0x452f2a){return new BPromise(function(_0xc22aa2,_0x5e78c0){var _0x4de49c=_0x452f2a||client;return _0x4de49c['request'](_0x569476,_0x1cfbee)['then'](function(_0x1d505f){logger[_0x7b19('0x18')](_0x7b19('0x19'),_0xc69f26,_0x7b19('0x1a'));logger[_0x7b19('0x1b')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xc69f26,_0x7b19('0x1a'),JSON['stringify'](_0x1d505f));if(_0x1d505f['error']){if(_0x1d505f[_0x7b19('0x1c')][_0x7b19('0x1d')]===0x1f4){logger[_0x7b19('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0xc69f26,_0x1d505f[_0x7b19('0x1c')][_0x7b19('0x1e')]);return _0x5e78c0(_0x1d505f['error'][_0x7b19('0x1e')]);}logger[_0x7b19('0x1c')](_0x7b19('0x19'),_0xc69f26,_0x1d505f[_0x7b19('0x1c')][_0x7b19('0x1e')]);return _0xc22aa2(_0x1d505f[_0x7b19('0x1c')]['message']);}else{logger[_0x7b19('0x18')](_0x7b19('0x19'),_0xc69f26,'request\x20sent');_0xc22aa2(_0x1d505f[_0x7b19('0x1f')][_0x7b19('0x1e')]);}})[_0x7b19('0x20')](function(_0xf632b5){logger['error'](_0x7b19('0x19'),_0xc69f26,_0xf632b5);_0x5e78c0(_0xf632b5);});});}function respondWithStatusCode(_0x2ecb9c,_0xe7b02f){_0xe7b02f=_0xe7b02f||0xcc;return function(_0x4ea519){if(_0x4ea519){return _0x2ecb9c[_0x7b19('0x21')](_0xe7b02f);}return _0x2ecb9c['status'](_0xe7b02f)[_0x7b19('0x22')]();};}function respondWithResult(_0x80c106,_0x1c3563){_0x1c3563=_0x1c3563||0xc8;return function(_0x5538f8){if(_0x5538f8){return _0x80c106[_0x7b19('0x23')](_0x1c3563)['json'](_0x5538f8);}};}function respondWithFilteredResult(_0x468437,_0x56b1f5){return function(_0x5d7aac){if(_0x5d7aac){var _0x50eb78=_0x5d7aac[_0x7b19('0x24')],_0xc2ab63=_0x56b1f5[_0x7b19('0x25')],_0x370ea7=_0x56b1f5[_0x7b19('0x25')]+_0x56b1f5['limit'],_0xcec88d;if(_0x370ea7>=_0x50eb78){_0x370ea7=_0x50eb78;_0xcec88d=0xc8;}else{_0xcec88d=0xce;}_0x468437[_0x7b19('0x23')](_0xcec88d);return _0x468437[_0x7b19('0x26')](_0x7b19('0x27'),_0xc2ab63+'-'+_0x370ea7+'/'+_0x50eb78)[_0x7b19('0x28')](_0x5d7aac);}return null;};}function patchUpdates(_0x42c1de){return function(_0xbdca94){try{jsonpatch[_0x7b19('0x29')](_0xbdca94,_0x42c1de,!![]);}catch(_0x38c008){return BPromise[_0x7b19('0x2a')](_0x38c008);}return _0xbdca94[_0x7b19('0x2b')]();};}function saveUpdates(_0x57a193,_0x26137c){return function(_0x53d987){if(_0x53d987){return _0x53d987[_0x7b19('0x2c')](_0x57a193)[_0x7b19('0x2d')](function(_0x9aef50){return _0x9aef50;});}return null;};}function removeEntity(_0x268c43,_0x3e5f30){return function(_0x397018){if(_0x397018){return _0x397018[_0x7b19('0x2e')]()[_0x7b19('0x2d')](function(){_0x268c43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4684fb,_0x3461fa){return function(_0xa78ee6){if(!_0xa78ee6){_0x4684fb[_0x7b19('0x21')](0x194);}return _0xa78ee6;};}function handleError(_0x5f5371,_0x10d931){_0x10d931=_0x10d931||0x1f4;return function(_0x7ad164){logger[_0x7b19('0x1c')](_0x7ad164[_0x7b19('0x2f')]);if(_0x7ad164['name']){delete _0x7ad164[_0x7b19('0x30')];}_0x5f5371[_0x7b19('0x23')](_0x10d931)['send'](_0x7ad164);};}exports[_0x7b19('0x31')]=function(_0x31f6f6,_0x5a3830){var _0xaddb3={},_0x343d3a={},_0x3707cd={'count':0x0,'rows':[]};var _0x3a4a61=_[_0x7b19('0x32')](db[_0x7b19('0x33')][_0x7b19('0x34')],function(_0x5ab293){return{'name':_0x5ab293['fieldName'],'type':_0x5ab293[_0x7b19('0x35')][_0x7b19('0x36')]};});_0x343d3a[_0x7b19('0x37')]=_[_0x7b19('0x32')](_0x3a4a61,_0x7b19('0x30'));_0x343d3a[_0x7b19('0x38')]=_['keys'](_0x31f6f6[_0x7b19('0x38')]);_0x343d3a[_0x7b19('0x39')]=_[_0x7b19('0x3a')](_0x343d3a[_0x7b19('0x37')],_0x343d3a[_0x7b19('0x38')]);_0xaddb3[_0x7b19('0x3b')]=_[_0x7b19('0x3a')](_0x343d3a['model'],qs[_0x7b19('0x3c')](_0x31f6f6[_0x7b19('0x38')][_0x7b19('0x3c')]));_0xaddb3[_0x7b19('0x3b')]=_0xaddb3['attributes'][_0x7b19('0x3d')]?_0xaddb3[_0x7b19('0x3b')]:_0x343d3a[_0x7b19('0x37')];if(!_0x31f6f6[_0x7b19('0x38')][_0x7b19('0x3e')](_0x7b19('0x3f'))){_0xaddb3['limit']=qs[_0x7b19('0x40')](_0x31f6f6[_0x7b19('0x38')][_0x7b19('0x40')]);_0xaddb3['offset']=qs['offset'](_0x31f6f6['query'][_0x7b19('0x25')]);}_0xaddb3[_0x7b19('0x41')]=qs[_0x7b19('0x42')](_0x31f6f6[_0x7b19('0x38')][_0x7b19('0x42')]);_0xaddb3[_0x7b19('0x43')]=qs['filters'](_[_0x7b19('0x44')](_0x31f6f6[_0x7b19('0x38')],_0x343d3a[_0x7b19('0x39')]),_0x3a4a61);if(_0x31f6f6[_0x7b19('0x38')][_0x7b19('0x45')]){_0xaddb3[_0x7b19('0x43')]=_[_0x7b19('0x46')](_0xaddb3[_0x7b19('0x43')],{'$or':_[_0x7b19('0x32')](_0x3a4a61,function(_0x24ea3c){if(_0x24ea3c[_0x7b19('0x35')]!==_0x7b19('0x47')){var _0x5c944b={};_0x5c944b[_0x24ea3c['name']]={'$like':'%'+_0x31f6f6[_0x7b19('0x38')]['filter']+'%'};return _0x5c944b;}})});}_0xaddb3=_[_0x7b19('0x46')]({},_0xaddb3,_0x31f6f6[_0x7b19('0x48')]);var _0x154355={'where':_0xaddb3[_0x7b19('0x43')]};return db[_0x7b19('0x33')][_0x7b19('0x24')](_0x154355)[_0x7b19('0x2d')](function(_0x19688e){_0x3707cd[_0x7b19('0x24')]=_0x19688e;if(_0x31f6f6[_0x7b19('0x38')][_0x7b19('0x49')]){_0xaddb3[_0x7b19('0x4a')]=[{'all':!![]}];}return db[_0x7b19('0x33')][_0x7b19('0x4b')](_0xaddb3);})[_0x7b19('0x2d')](function(_0x4e3baf){_0x3707cd[_0x7b19('0x4c')]=_0x4e3baf;return _0x3707cd;})[_0x7b19('0x2d')](respondWithFilteredResult(_0x5a3830,_0xaddb3))[_0x7b19('0x20')](handleError(_0x5a3830,null));};exports[_0x7b19('0x4d')]=function(_0x3312b6,_0x2766e0){var _0x314383={'raw':![],'where':{'id':_0x3312b6[_0x7b19('0x4e')]['id']}},_0x233751={};_0x233751['model']=_[_0x7b19('0x4f')](db[_0x7b19('0x33')][_0x7b19('0x34')]);_0x233751[_0x7b19('0x38')]=_[_0x7b19('0x4f')](_0x3312b6['query']);_0x233751[_0x7b19('0x39')]=_[_0x7b19('0x3a')](_0x233751[_0x7b19('0x37')],_0x233751[_0x7b19('0x38')]);_0x314383[_0x7b19('0x3b')]=_[_0x7b19('0x3a')](_0x233751['model'],qs[_0x7b19('0x3c')](_0x3312b6['query']['fields']));_0x314383[_0x7b19('0x3b')]=_0x314383['attributes']['length']?_0x314383['attributes']:_0x233751[_0x7b19('0x37')];if(_0x3312b6['query'][_0x7b19('0x49')]){_0x314383[_0x7b19('0x4a')]=[{'all':!![]}];}_0x314383=_[_0x7b19('0x46')]({},_0x314383,_0x3312b6['options']);return db[_0x7b19('0x33')]['find'](_0x314383)[_0x7b19('0x2d')](handleEntityNotFound(_0x2766e0,null))['then'](respondWithResult(_0x2766e0,null))['catch'](handleError(_0x2766e0,null));};exports[_0x7b19('0x50')]=function(_0x51ad16,_0x4d308a){return db[_0x7b19('0x33')][_0x7b19('0x50')](_0x51ad16['body'],{})[_0x7b19('0x2d')](respondWithResult(_0x4d308a,0xc9))[_0x7b19('0x20')](handleError(_0x4d308a,null));};exports[_0x7b19('0x2c')]=function(_0x11698b,_0x15f242){if(_0x11698b[_0x7b19('0x51')]['id']){delete _0x11698b[_0x7b19('0x51')]['id'];}return db[_0x7b19('0x33')][_0x7b19('0x52')]({'where':{'id':_0x11698b['params']['id']}})[_0x7b19('0x2d')](handleEntityNotFound(_0x15f242,null))['then'](saveUpdates(_0x11698b[_0x7b19('0x51')],null))[_0x7b19('0x2d')](respondWithResult(_0x15f242,null))[_0x7b19('0x20')](handleError(_0x15f242,null));};exports[_0x7b19('0x2e')]=function(_0x1fe61a,_0x36ba88){return db[_0x7b19('0x33')][_0x7b19('0x52')]({'where':{'id':_0x1fe61a[_0x7b19('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36ba88,null))[_0x7b19('0x2d')](removeEntity(_0x36ba88,null))['catch'](handleError(_0x36ba88,null));};exports[_0x7b19('0x53')]=function(_0xfdf9a9,_0x116880,_0xef57ce){var _0x3c8ad6={};var _0x3fc77b={};var _0x47d6ce;var _0x4ef0c7;return db[_0x7b19('0x33')][_0x7b19('0x54')]({'where':{'id':_0xfdf9a9['params']['id']}})[_0x7b19('0x2d')](handleEntityNotFound(_0x116880,null))['then'](function(_0x7748a1){if(_0x7748a1){_0x47d6ce=_0x7748a1;_0x3fc77b[_0x7b19('0x37')]=_[_0x7b19('0x4f')](db['FreshdeskConfiguration'][_0x7b19('0x34')]);_0x3fc77b[_0x7b19('0x38')]=_[_0x7b19('0x4f')](_0xfdf9a9['query']);_0x3fc77b[_0x7b19('0x39')]=_['intersection'](_0x3fc77b[_0x7b19('0x37')],_0x3fc77b['query']);_0x3c8ad6[_0x7b19('0x3b')]=_[_0x7b19('0x3a')](_0x3fc77b[_0x7b19('0x37')],qs[_0x7b19('0x3c')](_0xfdf9a9['query'][_0x7b19('0x3c')]));_0x3c8ad6[_0x7b19('0x3b')]=_0x3c8ad6[_0x7b19('0x3b')]['length']?_0x3c8ad6[_0x7b19('0x3b')]:_0x3fc77b[_0x7b19('0x37')];_0x3c8ad6[_0x7b19('0x41')]=qs[_0x7b19('0x42')](_0xfdf9a9[_0x7b19('0x38')][_0x7b19('0x42')]);_0x3c8ad6['where']=qs['filters'](_[_0x7b19('0x44')](_0xfdf9a9[_0x7b19('0x38')],_0x3fc77b[_0x7b19('0x39')]));if(_0xfdf9a9['query'][_0x7b19('0x45')]){_0x3c8ad6[_0x7b19('0x43')]=_['merge'](_0x3c8ad6[_0x7b19('0x43')],{'$or':_[_0x7b19('0x32')](_0x3c8ad6['attributes'],function(_0x29c587){var _0x12bcb7={};_0x12bcb7[_0x29c587]={'$like':'%'+_0xfdf9a9[_0x7b19('0x38')][_0x7b19('0x45')]+'%'};return _0x12bcb7;})});}_0x3c8ad6=_[_0x7b19('0x46')]({},_0x3c8ad6,_0xfdf9a9[_0x7b19('0x48')]);return _0x47d6ce['getConfigurations'](_0x3c8ad6);}})[_0x7b19('0x2d')](function(_0x2a1c14){if(_0x2a1c14){_0x4ef0c7=_0x2a1c14[_0x7b19('0x3d')];if(!_0xfdf9a9[_0x7b19('0x38')][_0x7b19('0x3e')]('nolimit')){_0x3c8ad6[_0x7b19('0x40')]=qs[_0x7b19('0x40')](_0xfdf9a9[_0x7b19('0x38')][_0x7b19('0x40')]);_0x3c8ad6[_0x7b19('0x25')]=qs[_0x7b19('0x25')](_0xfdf9a9[_0x7b19('0x38')][_0x7b19('0x25')]);}return _0x47d6ce['getConfigurations'](_0x3c8ad6);}})[_0x7b19('0x2d')](function(_0x4ad520){if(_0x4ad520){return _0x4ad520?{'count':_0x4ef0c7,'rows':_0x4ad520}:null;}})[_0x7b19('0x2d')](respondWithResult(_0x116880,null))[_0x7b19('0x20')](handleError(_0x116880,null));};exports[_0x7b19('0x55')]=function(_0x53466d,_0x26e5d3,_0x525a14){if(_0x53466d['body']['id']){delete _0x53466d['body']['id'];}return db[_0x7b19('0x33')][_0x7b19('0x54')]({'where':{'id':_0x53466d[_0x7b19('0x4e')]['id']}})[_0x7b19('0x2d')](handleEntityNotFound(_0x26e5d3,null))['then'](function(_0x2fa808){if(_0x2fa808){_0x53466d['body'][_0x7b19('0x56')]=_0x2fa808['id'];_0x53466d['body'][_0x7b19('0x57')]=integrations['getSubjects'](_0x53466d['body']['channel'],_0x53466d[_0x7b19('0x51')]['type']);_0x53466d[_0x7b19('0x51')][_0x7b19('0x58')]=integrations['getDescriptions'](_0x53466d[_0x7b19('0x51')][_0x7b19('0x59')],_0x53466d['body'][_0x7b19('0x35')]);return db[_0x7b19('0x5a')][_0x7b19('0x50')](_0x53466d[_0x7b19('0x51')],{'include':[{'model':db[_0x7b19('0x5b')],'as':_0x7b19('0x57')},{'model':db[_0x7b19('0x5b')],'as':_0x7b19('0x58')}]});}return null;})[_0x7b19('0x2d')](respondWithResult(_0x26e5d3,null))['catch'](handleError(_0x26e5d3,null));};exports[_0x7b19('0x5c')]=function(_0x1107e8,_0x5a6619,_0x3d370a){var _0x5daef5='';return db['FreshdeskAccount'][_0x7b19('0x54')]({'where':{'id':_0x1107e8['params']['id']},'attributes':['id',_0x7b19('0x5d'),'apiKey']})[_0x7b19('0x2d')](handleEntityNotFound(_0x5a6619,null))[_0x7b19('0x2d')](function(_0x5e85c8){if(_0x5e85c8){_0x5daef5=_0x5e85c8[_0x7b19('0x5d')];var _0x16a98c=_0x5daef5[_0x7b19('0x5e')](-0x1);if(_0x16a98c==='/'){_0x5daef5=_0x5daef5[_0x7b19('0x5f')](0x0,_0x5daef5['lastIndexOf'](_0x16a98c));}return rp({'method':_0x7b19('0x60'),'uri':util[_0x7b19('0x61')]('%s/%s',_0x5daef5,_0x7b19('0x62')),'headers':{'Authorization':util[_0x7b19('0x61')](_0x7b19('0x63'),new Buffer(util[_0x7b19('0x61')](_0x7b19('0x64'),_0x5e85c8[_0x7b19('0x65')]))[_0x7b19('0x66')](_0x7b19('0x67')))},'json':!![]});}})[_0x7b19('0x2d')](function(_0x5944e3){if(_0x5944e3){var _0x548305=[_0x7b19('0x68'),_0x7b19('0x69'),'agent','description',_0x7b19('0x23'),'priority',_0x7b19('0x6a'),_0x7b19('0x6b'),'ticket_type',_0x7b19('0x6a'),_0x7b19('0x6c')];_[_0x7b19('0x6d')](_0x5944e3,function(_0x4bf7c5){return _0x548305[_0x7b19('0x6e')](_0x4bf7c5['name'])||!_0x4bf7c5[_0x7b19('0x6f')]&&_0x4bf7c5['type']!==_0x7b19('0x70')&&_0x4bf7c5['type']!==_0x7b19('0x71');});return{'count':_0x5944e3[_0x7b19('0x3d')],'rows':_['map'](_0x5944e3,function(_0xd18bfd){return{'id':_0xd18bfd['name'],'name':_0xd18bfd[_0x7b19('0x72')],'custom':!_0xd18bfd['default'],'options':_0xd18bfd[_0x7b19('0x73')]?_[_0x7b19('0x32')](_0xd18bfd['choices'],function(_0x578618){return{'name':_[_0x7b19('0x74')](_0x578618),'value':_0x578618};}):[]};})};}})[_0x7b19('0x2d')](respondWithResult(_0x5a6619,null))[_0x7b19('0x20')](function(_0x4b2878){var _0xddd108=_0x1107e8[_0x7b19('0x38')][_0x7b19('0x75')]?0x1f4:_0x4b2878[_0x7b19('0x76')]||0x1f4;logger[_0x7b19('0x1c')](_0x7b19('0x77'),'getFields',_0xddd108,JSON[_0x7b19('0x78')](_0x4b2878));delete _0x4b2878[_0x7b19('0x30')];if(_0xddd108===0x191){_0xddd108=0x190;}_0x5a6619[_0x7b19('0x23')](_0xddd108)[_0x7b19('0x79')](_0x1107e8[_0x7b19('0x38')][_0x7b19('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x4b2878['statusCode']}:_0x4b2878);});}; \ No newline at end of file +var _0x6843=['default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','mustache','util','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/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','offset','limit','Content-Range','json','apply','reject','update','end','sendStatus','name','send','index','map','FreshdeskAccount','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','length','create','body','find','params','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','base64','agent','description','priority','group','source','ticket_type','company','remove','includes'];(function(_0x5b08a0,_0x10b456){var _0x23b82b=function(_0xbf6c3a){while(--_0xbf6c3a){_0x5b08a0['push'](_0x5b08a0['shift']());}};_0x23b82b(++_0x10b456);}(_0x6843,0x170));var _0x3684=function(_0x4f314e,_0x1363b5){_0x4f314e=_0x4f314e-0x0;var _0x3fa36f=_0x6843[_0x4f314e];return _0x3fa36f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3684('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3684('0x1'));var jsonpatch=require(_0x3684('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3684('0x3'));var util=require(_0x3684('0x4'));var path=require('path');var sox=require(_0x3684('0x5'));var csv=require(_0x3684('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3684('0x7'));var jsforce=require(_0x3684('0x8'));var deskjs=require(_0x3684('0x9'));var toCsv=require(_0x3684('0x6'));var querystring=require(_0x3684('0xa'));var Papa=require(_0x3684('0xb'));var Redis=require(_0x3684('0xc'));var authService=require(_0x3684('0xd'));var qs=require(_0x3684('0xe'));var as=require(_0x3684('0xf'));var hardwareService=require(_0x3684('0x10'));var logger=require(_0x3684('0x11'))(_0x3684('0x12'));var utils=require(_0x3684('0x13'));var config=require(_0x3684('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3684('0x15'));var jayson=require(_0x3684('0x16'));var client=jayson[_0x3684('0x17')][_0x3684('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x437ac9,_0x4ffae6,_0x2958bc,_0x4a1189){return new BPromise(function(_0x9acb98,_0x50c0f1){var _0x1e927c=_0x4a1189||client;return _0x1e927c[_0x3684('0x19')](_0x437ac9,_0x2958bc)[_0x3684('0x1a')](function(_0x42c0a3){logger['info'](_0x3684('0x1b'),_0x4ffae6,_0x3684('0x1c'));logger[_0x3684('0x1d')](_0x3684('0x1e'),_0x4ffae6,'request\x20sent',JSON[_0x3684('0x1f')](_0x42c0a3));if(_0x42c0a3[_0x3684('0x20')]){if(_0x42c0a3[_0x3684('0x20')][_0x3684('0x21')]===0x1f4){logger[_0x3684('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x4ffae6,_0x42c0a3[_0x3684('0x20')]['message']);return _0x50c0f1(_0x42c0a3['error'][_0x3684('0x22')]);}logger[_0x3684('0x20')](_0x3684('0x1b'),_0x4ffae6,_0x42c0a3[_0x3684('0x20')][_0x3684('0x22')]);return _0x9acb98(_0x42c0a3[_0x3684('0x20')][_0x3684('0x22')]);}else{logger[_0x3684('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x4ffae6,'request\x20sent');_0x9acb98(_0x42c0a3[_0x3684('0x24')]['message']);}})[_0x3684('0x25')](function(_0xfe2a74){logger[_0x3684('0x20')](_0x3684('0x1b'),_0x4ffae6,_0xfe2a74);_0x50c0f1(_0xfe2a74);});});}function respondWithStatusCode(_0x587bf7,_0x5ec8c4){_0x5ec8c4=_0x5ec8c4||0xcc;return function(_0x1f830a){if(_0x1f830a){return _0x587bf7['sendStatus'](_0x5ec8c4);}return _0x587bf7[_0x3684('0x26')](_0x5ec8c4)['end']();};}function respondWithResult(_0x2f1a94,_0x33e604){_0x33e604=_0x33e604||0xc8;return function(_0x4dc1f6){if(_0x4dc1f6){return _0x2f1a94[_0x3684('0x26')](_0x33e604)['json'](_0x4dc1f6);}};}function respondWithFilteredResult(_0x19ac78,_0x23cca8){return function(_0x1cdf94){if(_0x1cdf94){var _0x37fb8a=_0x1cdf94['count'],_0x123ef2=_0x23cca8['offset'],_0x439e36=_0x23cca8[_0x3684('0x27')]+_0x23cca8[_0x3684('0x28')],_0x51cc61;if(_0x439e36>=_0x37fb8a){_0x439e36=_0x37fb8a;_0x51cc61=0xc8;}else{_0x51cc61=0xce;}_0x19ac78[_0x3684('0x26')](_0x51cc61);return _0x19ac78['set'](_0x3684('0x29'),_0x123ef2+'-'+_0x439e36+'/'+_0x37fb8a)[_0x3684('0x2a')](_0x1cdf94);}return null;};}function patchUpdates(_0x5bfa2e){return function(_0x30f626){try{jsonpatch[_0x3684('0x2b')](_0x30f626,_0x5bfa2e,!![]);}catch(_0x2893b0){return BPromise[_0x3684('0x2c')](_0x2893b0);}return _0x30f626['save']();};}function saveUpdates(_0x23e4d5,_0x14f987){return function(_0x634293){if(_0x634293){return _0x634293[_0x3684('0x2d')](_0x23e4d5)['then'](function(_0x17cd0b){return _0x17cd0b;});}return null;};}function removeEntity(_0x4ab6fd,_0x3526f1){return function(_0x36ac79){if(_0x36ac79){return _0x36ac79['destroy']()[_0x3684('0x1a')](function(){_0x4ab6fd[_0x3684('0x26')](0xcc)[_0x3684('0x2e')]();});}};}function handleEntityNotFound(_0x216391,_0x5f549b){return function(_0x1c292e){if(!_0x1c292e){_0x216391[_0x3684('0x2f')](0x194);}return _0x1c292e;};}function handleError(_0x54b133,_0x56c028){_0x56c028=_0x56c028||0x1f4;return function(_0x266466){logger['error'](_0x266466['stack']);if(_0x266466[_0x3684('0x30')]){delete _0x266466[_0x3684('0x30')];}_0x54b133['status'](_0x56c028)[_0x3684('0x31')](_0x266466);};}exports[_0x3684('0x32')]=function(_0x42c293,_0x419a07){var _0x547e52={},_0x481a00={},_0x33b957={'count':0x0,'rows':[]};var _0x362ec1=_[_0x3684('0x33')](db[_0x3684('0x34')][_0x3684('0x35')],function(_0x3c6b9c){return{'name':_0x3c6b9c['fieldName'],'type':_0x3c6b9c[_0x3684('0x36')]['key']};});_0x481a00['model']=_[_0x3684('0x33')](_0x362ec1,_0x3684('0x30'));_0x481a00[_0x3684('0x37')]=_[_0x3684('0x38')](_0x42c293[_0x3684('0x37')]);_0x481a00[_0x3684('0x39')]=_[_0x3684('0x3a')](_0x481a00[_0x3684('0x3b')],_0x481a00[_0x3684('0x37')]);_0x547e52[_0x3684('0x3c')]=_[_0x3684('0x3a')](_0x481a00[_0x3684('0x3b')],qs['fields'](_0x42c293['query'][_0x3684('0x3d')]));_0x547e52['attributes']=_0x547e52[_0x3684('0x3c')]['length']?_0x547e52[_0x3684('0x3c')]:_0x481a00[_0x3684('0x3b')];if(!_0x42c293[_0x3684('0x37')][_0x3684('0x3e')](_0x3684('0x3f'))){_0x547e52['limit']=qs['limit'](_0x42c293[_0x3684('0x37')]['limit']);_0x547e52['offset']=qs[_0x3684('0x27')](_0x42c293[_0x3684('0x37')][_0x3684('0x27')]);}_0x547e52[_0x3684('0x40')]=qs[_0x3684('0x41')](_0x42c293[_0x3684('0x37')][_0x3684('0x41')]);_0x547e52[_0x3684('0x42')]=qs['filters'](_[_0x3684('0x43')](_0x42c293['query'],_0x481a00[_0x3684('0x39')]),_0x362ec1);if(_0x42c293['query']['filter']){_0x547e52['where']=_[_0x3684('0x44')](_0x547e52[_0x3684('0x42')],{'$or':_[_0x3684('0x33')](_0x362ec1,function(_0x3e89fd){if(_0x3e89fd['type']!=='VIRTUAL'){var _0x99584d={};_0x99584d[_0x3e89fd['name']]={'$like':'%'+_0x42c293['query'][_0x3684('0x45')]+'%'};return _0x99584d;}})});}_0x547e52=_[_0x3684('0x44')]({},_0x547e52,_0x42c293[_0x3684('0x46')]);var _0x1a9c2f={'where':_0x547e52[_0x3684('0x42')]};return db[_0x3684('0x34')][_0x3684('0x47')](_0x1a9c2f)[_0x3684('0x1a')](function(_0x6f7ee7){_0x33b957[_0x3684('0x47')]=_0x6f7ee7;if(_0x42c293[_0x3684('0x37')][_0x3684('0x48')]){_0x547e52[_0x3684('0x49')]=[{'all':!![]}];}return db[_0x3684('0x34')][_0x3684('0x4a')](_0x547e52);})[_0x3684('0x1a')](function(_0x5d6735){_0x33b957[_0x3684('0x4b')]=_0x5d6735;return _0x33b957;})[_0x3684('0x1a')](respondWithFilteredResult(_0x419a07,_0x547e52))[_0x3684('0x25')](handleError(_0x419a07,null));};exports[_0x3684('0x4c')]=function(_0x311581,_0x4f7375){var _0x82270d={'raw':![],'where':{'id':_0x311581['params']['id']}},_0x615652={};_0x615652[_0x3684('0x3b')]=_[_0x3684('0x38')](db['FreshdeskAccount']['rawAttributes']);_0x615652[_0x3684('0x37')]=_[_0x3684('0x38')](_0x311581['query']);_0x615652[_0x3684('0x39')]=_['intersection'](_0x615652['model'],_0x615652[_0x3684('0x37')]);_0x82270d[_0x3684('0x3c')]=_[_0x3684('0x3a')](_0x615652[_0x3684('0x3b')],qs['fields'](_0x311581[_0x3684('0x37')]['fields']));_0x82270d[_0x3684('0x3c')]=_0x82270d['attributes'][_0x3684('0x4d')]?_0x82270d[_0x3684('0x3c')]:_0x615652[_0x3684('0x3b')];if(_0x311581[_0x3684('0x37')][_0x3684('0x48')]){_0x82270d['include']=[{'all':!![]}];}_0x82270d=_[_0x3684('0x44')]({},_0x82270d,_0x311581[_0x3684('0x46')]);return db[_0x3684('0x34')]['find'](_0x82270d)[_0x3684('0x1a')](handleEntityNotFound(_0x4f7375,null))[_0x3684('0x1a')](respondWithResult(_0x4f7375,null))[_0x3684('0x25')](handleError(_0x4f7375,null));};exports['create']=function(_0x44f4a8,_0x928040){return db[_0x3684('0x34')][_0x3684('0x4e')](_0x44f4a8['body'],{})['then'](respondWithResult(_0x928040,0xc9))[_0x3684('0x25')](handleError(_0x928040,null));};exports['update']=function(_0x45ccaa,_0x1b764f){if(_0x45ccaa['body']['id']){delete _0x45ccaa[_0x3684('0x4f')]['id'];}return db[_0x3684('0x34')][_0x3684('0x50')]({'where':{'id':_0x45ccaa[_0x3684('0x51')]['id']}})[_0x3684('0x1a')](handleEntityNotFound(_0x1b764f,null))[_0x3684('0x1a')](saveUpdates(_0x45ccaa['body'],null))[_0x3684('0x1a')](respondWithResult(_0x1b764f,null))[_0x3684('0x25')](handleError(_0x1b764f,null));};exports[_0x3684('0x52')]=function(_0x4478de,_0x3a0ddd){return db[_0x3684('0x34')][_0x3684('0x50')]({'where':{'id':_0x4478de[_0x3684('0x51')]['id']}})[_0x3684('0x1a')](handleEntityNotFound(_0x3a0ddd,null))['then'](removeEntity(_0x3a0ddd,null))['catch'](handleError(_0x3a0ddd,null));};exports[_0x3684('0x53')]=function(_0x44700d,_0x1e60f1,_0x1a58d8){var _0x55693f={};var _0x42b86e={};var _0x2364d7;var _0x43274c;return db['FreshdeskAccount'][_0x3684('0x54')]({'where':{'id':_0x44700d['params']['id']}})['then'](handleEntityNotFound(_0x1e60f1,null))[_0x3684('0x1a')](function(_0x90f919){if(_0x90f919){_0x2364d7=_0x90f919;_0x42b86e[_0x3684('0x3b')]=_[_0x3684('0x38')](db[_0x3684('0x55')]['rawAttributes']);_0x42b86e[_0x3684('0x37')]=_['keys'](_0x44700d['query']);_0x42b86e[_0x3684('0x39')]=_[_0x3684('0x3a')](_0x42b86e[_0x3684('0x3b')],_0x42b86e[_0x3684('0x37')]);_0x55693f[_0x3684('0x3c')]=_[_0x3684('0x3a')](_0x42b86e['model'],qs['fields'](_0x44700d[_0x3684('0x37')][_0x3684('0x3d')]));_0x55693f[_0x3684('0x3c')]=_0x55693f[_0x3684('0x3c')][_0x3684('0x4d')]?_0x55693f[_0x3684('0x3c')]:_0x42b86e[_0x3684('0x3b')];_0x55693f[_0x3684('0x40')]=qs[_0x3684('0x41')](_0x44700d[_0x3684('0x37')][_0x3684('0x41')]);_0x55693f[_0x3684('0x42')]=qs[_0x3684('0x39')](_[_0x3684('0x43')](_0x44700d[_0x3684('0x37')],_0x42b86e[_0x3684('0x39')]));if(_0x44700d['query']['filter']){_0x55693f['where']=_[_0x3684('0x44')](_0x55693f[_0x3684('0x42')],{'$or':_[_0x3684('0x33')](_0x55693f[_0x3684('0x3c')],function(_0x323281){var _0x558175={};_0x558175[_0x323281]={'$like':'%'+_0x44700d[_0x3684('0x37')][_0x3684('0x45')]+'%'};return _0x558175;})});}_0x55693f=_['merge']({},_0x55693f,_0x44700d['options']);return _0x2364d7[_0x3684('0x53')](_0x55693f);}})[_0x3684('0x1a')](function(_0x237fc0){if(_0x237fc0){_0x43274c=_0x237fc0[_0x3684('0x4d')];if(!_0x44700d[_0x3684('0x37')][_0x3684('0x3e')](_0x3684('0x3f'))){_0x55693f['limit']=qs[_0x3684('0x28')](_0x44700d[_0x3684('0x37')][_0x3684('0x28')]);_0x55693f['offset']=qs[_0x3684('0x27')](_0x44700d[_0x3684('0x37')][_0x3684('0x27')]);}return _0x2364d7['getConfigurations'](_0x55693f);}})[_0x3684('0x1a')](function(_0x36f6c7){if(_0x36f6c7){return _0x36f6c7?{'count':_0x43274c,'rows':_0x36f6c7}:null;}})[_0x3684('0x1a')](respondWithResult(_0x1e60f1,null))[_0x3684('0x25')](handleError(_0x1e60f1,null));};exports[_0x3684('0x56')]=function(_0x404374,_0xd7d37e,_0x454cf9){if(_0x404374[_0x3684('0x4f')]['id']){delete _0x404374[_0x3684('0x4f')]['id'];}return db[_0x3684('0x34')][_0x3684('0x54')]({'where':{'id':_0x404374[_0x3684('0x51')]['id']}})[_0x3684('0x1a')](handleEntityNotFound(_0xd7d37e,null))[_0x3684('0x1a')](function(_0x1f723a){if(_0x1f723a){_0x404374[_0x3684('0x4f')]['AccountId']=_0x1f723a['id'];_0x404374[_0x3684('0x4f')]['Subjects']=integrations[_0x3684('0x57')](_0x404374[_0x3684('0x4f')][_0x3684('0x58')],_0x404374[_0x3684('0x4f')][_0x3684('0x36')]);_0x404374['body'][_0x3684('0x59')]=integrations['getDescriptions'](_0x404374[_0x3684('0x4f')][_0x3684('0x58')],_0x404374['body'][_0x3684('0x36')]);return db[_0x3684('0x55')][_0x3684('0x4e')](_0x404374['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x3684('0x1a')](respondWithResult(_0xd7d37e,null))[_0x3684('0x25')](handleError(_0xd7d37e,null));};exports[_0x3684('0x5a')]=function(_0x232300,_0x55f99d,_0x2521d9){var _0x8ca814='';return db[_0x3684('0x34')][_0x3684('0x54')]({'where':{'id':_0x232300[_0x3684('0x51')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x3684('0x1a')](handleEntityNotFound(_0x55f99d,null))[_0x3684('0x1a')](function(_0x1574f6){if(_0x1574f6){_0x8ca814=_0x1574f6[_0x3684('0x5b')];var _0x148ee2=_0x8ca814[_0x3684('0x5c')](-0x1);if(_0x148ee2==='/'){_0x8ca814=_0x8ca814[_0x3684('0x5d')](0x0,_0x8ca814[_0x3684('0x5e')](_0x148ee2));}return rp({'method':_0x3684('0x5f'),'uri':util[_0x3684('0x60')](_0x3684('0x61'),_0x8ca814,_0x3684('0x62')),'headers':{'Authorization':util[_0x3684('0x60')](_0x3684('0x63'),new Buffer(util['format'](_0x3684('0x64'),_0x1574f6[_0x3684('0x65')]))['toString'](_0x3684('0x66')))},'json':!![]});}})[_0x3684('0x1a')](function(_0x159aab){if(_0x159aab){var _0x386c17=['requester','subject',_0x3684('0x67'),_0x3684('0x68'),_0x3684('0x26'),_0x3684('0x69'),_0x3684('0x6a'),_0x3684('0x6b'),_0x3684('0x6c'),_0x3684('0x6a'),_0x3684('0x6d')];_[_0x3684('0x6e')](_0x159aab,function(_0x3d5032){return _0x386c17[_0x3684('0x6f')](_0x3d5032[_0x3684('0x30')])||!_0x3d5032[_0x3684('0x70')]&&_0x3d5032[_0x3684('0x36')]!==_0x3684('0x71')&&_0x3d5032['type']!=='custom_dropdown';});return{'count':_0x159aab['length'],'rows':_[_0x3684('0x33')](_0x159aab,function(_0x1986d4){return{'id':_0x1986d4['name'],'name':_0x1986d4[_0x3684('0x72')],'custom':!_0x1986d4[_0x3684('0x70')],'options':_0x1986d4[_0x3684('0x73')]?_['map'](_0x1986d4[_0x3684('0x73')],function(_0x5db8a1){return{'name':_[_0x3684('0x74')](_0x5db8a1),'value':_0x5db8a1};}):[]};})};}})['then'](respondWithResult(_0x55f99d,null))[_0x3684('0x25')](function(_0x24239a){var _0x5744a1=_0x232300[_0x3684('0x37')][_0x3684('0x75')]?0x1f4:_0x24239a[_0x3684('0x76')]||0x1f4;logger[_0x3684('0x20')](_0x3684('0x77'),_0x3684('0x5a'),_0x5744a1,JSON[_0x3684('0x1f')](_0x24239a));delete _0x24239a[_0x3684('0x30')];if(_0x5744a1===0x191){_0x5744a1=0x190;}_0x55f99d[_0x3684('0x26')](_0x5744a1)[_0x3684('0x31')](_0x232300[_0x3684('0x37')][_0x3684('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x24239a[_0x3684('0x76')]}:_0x24239a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index caf1123..f9d5b88 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 _0x451e=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x451e,0xf4));var _0xe451=function(_0x3a6c99,_0x41458d){_0x3a6c99=_0x3a6c99-0x0;var _0x5eb82a=_0x451e[_0x3a6c99];return _0x5eb82a;};'use strict';var _=require(_0xe451('0x0'));var util=require(_0xe451('0x1'));var logger=require(_0xe451('0x2'))(_0xe451('0x3'));var moment=require(_0xe451('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe451('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xe451('0x6'));module[_0xe451('0x7')]=function(_0x2a71e2,_0x3b800a){return _0x2a71e2[_0xe451('0x8')](_0xe451('0x9'),attributes,{'tableName':_0xe451('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc46f=['api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define','util'];(function(_0xec2c15,_0x3cde11){var _0x1d102e=function(_0x35444a){while(--_0x35444a){_0xec2c15['push'](_0xec2c15['shift']());}};_0x1d102e(++_0x3cde11);}(_0xc46f,0xd7));var _0xfc46=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc46f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xfc46('0x0'));var logger=require('../../config/logger')(_0xfc46('0x1'));var moment=require(_0xfc46('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc46('0x3'));var rimraf=require(_0xfc46('0x4'));var config=require(_0xfc46('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xfc46('0x6'));module['exports']=function(_0x21a31a,_0x5c9ce1){return _0x21a31a[_0xfc46('0x7')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','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 781fc66..2905e9c 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 _0x2e20=['GetFreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowFreshdeskAccount','FreshdeskAccount','find','raw','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x2d099f,_0x40d72d){var _0x2adc30=function(_0x2a1c12){while(--_0x2a1c12){_0x2d099f['push'](_0x2d099f['shift']());}};_0x2adc30(++_0x40d72d);}(_0x2e20,0x1c0));var _0x02e2=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x2e20[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0x02e2('0x0'));var util=require(_0x02e2('0x1'));var moment=require(_0x02e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x02e2('0x3'));var fs=require('fs');var Redis=require(_0x02e2('0x4'));var db=require(_0x02e2('0x5'))['db'];var utils=require(_0x02e2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x02e2('0x7'));var jayson=require(_0x02e2('0x8'));var client=jayson[_0x02e2('0x9')][_0x02e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdaff,_0x167b90,_0x10cb4b){return new BPromise(function(_0x59e9f7,_0x5b2710){return client[_0x02e2('0xb')](_0x3cdaff,_0x10cb4b)['then'](function(_0x1acc99){logger[_0x02e2('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x167b90,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x167b90,_0x02e2('0xd'),JSON['stringify'](_0x1acc99));if(_0x1acc99[_0x02e2('0xe')]){if(_0x1acc99[_0x02e2('0xe')][_0x02e2('0xf')]===0x1f4){logger[_0x02e2('0xe')](_0x02e2('0x10'),_0x167b90,_0x1acc99['error'][_0x02e2('0x11')]);return _0x5b2710(_0x1acc99['error'][_0x02e2('0x11')]);}logger['error'](_0x02e2('0x10'),_0x167b90,_0x1acc99[_0x02e2('0xe')][_0x02e2('0x11')]);return _0x59e9f7(_0x1acc99[_0x02e2('0xe')][_0x02e2('0x11')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x167b90,_0x02e2('0xd'));_0x59e9f7(_0x1acc99[_0x02e2('0x12')]['message']);}})[_0x02e2('0x13')](function(_0x828d68){logger[_0x02e2('0xe')](_0x02e2('0x10'),_0x167b90,_0x828d68);_0x5b2710(_0x828d68);});});}exports[_0x02e2('0x14')]=function(_0x3086cc){var _0x444475=this;return new Promise(function(_0x2f3708,_0x3659bf){return db['FreshdeskAccount'][_0x02e2('0x15')]({'raw':_0x3086cc[_0x02e2('0x16')]?_0x3086cc[_0x02e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3086cc[_0x02e2('0x16')]?_0x3086cc[_0x02e2('0x16')][_0x02e2('0x17')]||null:null,'attributes':_0x3086cc[_0x02e2('0x16')]?_0x3086cc['options'][_0x02e2('0x18')]||null:null,'limit':_0x3086cc['options']?_0x3086cc[_0x02e2('0x16')][_0x02e2('0x19')]||null:null,'include':_0x3086cc['options']?_0x3086cc[_0x02e2('0x16')][_0x02e2('0x1a')]?_[_0x02e2('0x1b')](_0x3086cc['options'][_0x02e2('0x1a')],function(_0x4a6b8c){return{'model':db[_0x4a6b8c[_0x02e2('0x1c')]],'as':_0x4a6b8c['as'],'attributes':_0x4a6b8c[_0x02e2('0x18')],'include':_0x4a6b8c['include']?_['map'](_0x4a6b8c[_0x02e2('0x1a')],function(_0x2136fe){return{'model':db[_0x2136fe['model']],'as':_0x2136fe['as'],'attributes':_0x2136fe['attributes'],'include':_0x2136fe[_0x02e2('0x1a')]?_[_0x02e2('0x1b')](_0x2136fe[_0x02e2('0x1a')],function(_0x306a6c){return{'model':db[_0x306a6c[_0x02e2('0x1c')]],'as':_0x306a6c['as'],'attributes':_0x306a6c[_0x02e2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x02e2('0x1d')](function(_0x587a84){logger['info'](_0x02e2('0x14'),_0x3086cc);logger['debug'](_0x02e2('0x14'),_0x3086cc,JSON['stringify'](_0x587a84));_0x2f3708(_0x587a84);})[_0x02e2('0x13')](function(_0x109641){logger[_0x02e2('0xe')](_0x02e2('0x14'),_0x109641[_0x02e2('0x11')],_0x3086cc);_0x3659bf(_0x444475['error'](0x1f4,_0x109641[_0x02e2('0x11')]));});});};exports[_0x02e2('0x1e')]=function(_0x583a3b){var _0x21b0f9=this;return new Promise(function(_0xd08fd0,_0x2ed745){return db[_0x02e2('0x1f')][_0x02e2('0x20')]({'raw':_0x583a3b[_0x02e2('0x16')]?_0x583a3b[_0x02e2('0x16')][_0x02e2('0x21')]===undefined?!![]:![]:!![],'where':_0x583a3b[_0x02e2('0x16')]?_0x583a3b[_0x02e2('0x16')][_0x02e2('0x17')]||null:null,'attributes':_0x583a3b[_0x02e2('0x16')]?_0x583a3b[_0x02e2('0x16')]['attributes']||null:null,'include':_0x583a3b[_0x02e2('0x16')]?_0x583a3b[_0x02e2('0x16')][_0x02e2('0x1a')]?_[_0x02e2('0x1b')](_0x583a3b['options'][_0x02e2('0x1a')],function(_0x3c6d0d){return{'model':db[_0x3c6d0d['model']],'as':_0x3c6d0d['as'],'attributes':_0x3c6d0d['attributes'],'include':_0x3c6d0d[_0x02e2('0x1a')]?_[_0x02e2('0x1b')](_0x3c6d0d[_0x02e2('0x1a')],function(_0x63d184){return{'model':db[_0x63d184[_0x02e2('0x1c')]],'as':_0x63d184['as'],'attributes':_0x63d184[_0x02e2('0x18')],'include':_0x63d184[_0x02e2('0x1a')]?_[_0x02e2('0x1b')](_0x63d184[_0x02e2('0x1a')],function(_0x1fa8a0){return{'model':db[_0x1fa8a0[_0x02e2('0x1c')]],'as':_0x1fa8a0['as'],'attributes':_0x1fa8a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x02e2('0x1d')](function(_0x17fb92){logger[_0x02e2('0xc')]('ShowFreshdeskAccount',_0x583a3b);logger[_0x02e2('0x22')]('ShowFreshdeskAccount',_0x583a3b,JSON[_0x02e2('0x23')](_0x17fb92));_0xd08fd0(_0x17fb92);})['catch'](function(_0x1e5989){logger[_0x02e2('0xe')](_0x02e2('0x1e'),_0x1e5989['message'],_0x583a3b);_0x2ed745(_0x21b0f9[_0x02e2('0xe')](0x1f4,_0x1e5989[_0x02e2('0x11')]));});});}; \ No newline at end of file +var _0x480d=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','options','raw','where','limit','include','model','attributes','ShowFreshdeskAccount','FreshdeskAccount','find','map','lodash','util'];(function(_0x51c60a,_0x51e538){var _0x56720d=function(_0xff7c13){while(--_0xff7c13){_0x51c60a['push'](_0x51c60a['shift']());}};_0x56720d(++_0x51e538);}(_0x480d,0x195));var _0xd480=function(_0x50d161,_0x279895){_0x50d161=_0x50d161-0x0;var _0x2d2dc8=_0x480d[_0x50d161];return _0x2d2dc8;};'use strict';var _=require(_0xd480('0x0'));var util=require(_0xd480('0x1'));var moment=require(_0xd480('0x2'));var BPromise=require(_0xd480('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd480('0x4'));var db=require(_0xd480('0x5'))['db'];var utils=require(_0xd480('0x6'));var logger=require(_0xd480('0x7'))(_0xd480('0x8'));var config=require(_0xd480('0x9'));var jayson=require(_0xd480('0xa'));var client=jayson[_0xd480('0xb')][_0xd480('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5906f6,_0x54e0a4,_0x16a07a){return new BPromise(function(_0x3d6bc1,_0x89aafa){return client[_0xd480('0xd')](_0x5906f6,_0x16a07a)[_0xd480('0xe')](function(_0x277b40){logger[_0xd480('0xf')](_0xd480('0x10'),_0x54e0a4,_0xd480('0x11'));logger[_0xd480('0x12')](_0xd480('0x13'),_0x54e0a4,_0xd480('0x11'),JSON[_0xd480('0x14')](_0x277b40));if(_0x277b40['error']){if(_0x277b40[_0xd480('0x15')][_0xd480('0x16')]===0x1f4){logger[_0xd480('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x54e0a4,_0x277b40[_0xd480('0x15')][_0xd480('0x17')]);return _0x89aafa(_0x277b40[_0xd480('0x15')][_0xd480('0x17')]);}logger[_0xd480('0x15')](_0xd480('0x10'),_0x54e0a4,_0x277b40[_0xd480('0x15')]['message']);return _0x3d6bc1(_0x277b40[_0xd480('0x15')][_0xd480('0x17')]);}else{logger[_0xd480('0xf')](_0xd480('0x10'),_0x54e0a4,_0xd480('0x11'));_0x3d6bc1(_0x277b40['result'][_0xd480('0x17')]);}})[_0xd480('0x18')](function(_0x1ecf7d){logger[_0xd480('0x15')](_0xd480('0x10'),_0x54e0a4,_0x1ecf7d);_0x89aafa(_0x1ecf7d);});});}exports[_0xd480('0x19')]=function(_0x11fb20){var _0x5ccf6c=this;return new Promise(function(_0x19ac23,_0x60a113){return db['FreshdeskAccount']['findAll']({'raw':_0x11fb20['options']?_0x11fb20[_0xd480('0x1a')][_0xd480('0x1b')]===undefined?!![]:![]:!![],'where':_0x11fb20[_0xd480('0x1a')]?_0x11fb20['options'][_0xd480('0x1c')]||null:null,'attributes':_0x11fb20[_0xd480('0x1a')]?_0x11fb20[_0xd480('0x1a')]['attributes']||null:null,'limit':_0x11fb20['options']?_0x11fb20[_0xd480('0x1a')][_0xd480('0x1d')]||null:null,'include':_0x11fb20[_0xd480('0x1a')]?_0x11fb20[_0xd480('0x1a')][_0xd480('0x1e')]?_['map'](_0x11fb20['options'][_0xd480('0x1e')],function(_0x4e6aaa){return{'model':db[_0x4e6aaa[_0xd480('0x1f')]],'as':_0x4e6aaa['as'],'attributes':_0x4e6aaa[_0xd480('0x20')],'include':_0x4e6aaa[_0xd480('0x1e')]?_['map'](_0x4e6aaa[_0xd480('0x1e')],function(_0x5e34b4){return{'model':db[_0x5e34b4['model']],'as':_0x5e34b4['as'],'attributes':_0x5e34b4[_0xd480('0x20')],'include':_0x5e34b4[_0xd480('0x1e')]?_['map'](_0x5e34b4[_0xd480('0x1e')],function(_0x243eb3){return{'model':db[_0x243eb3[_0xd480('0x1f')]],'as':_0x243eb3['as'],'attributes':_0x243eb3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd480('0xe')](function(_0x5363dc){logger[_0xd480('0xf')](_0xd480('0x19'),_0x11fb20);logger[_0xd480('0x12')](_0xd480('0x19'),_0x11fb20,JSON[_0xd480('0x14')](_0x5363dc));_0x19ac23(_0x5363dc);})[_0xd480('0x18')](function(_0x2da241){logger[_0xd480('0x15')](_0xd480('0x19'),_0x2da241[_0xd480('0x17')],_0x11fb20);_0x60a113(_0x5ccf6c['error'](0x1f4,_0x2da241['message']));});});};exports[_0xd480('0x21')]=function(_0x678fc9){var _0x44fac0=this;return new Promise(function(_0x23b729,_0x2727d5){return db[_0xd480('0x22')][_0xd480('0x23')]({'raw':_0x678fc9[_0xd480('0x1a')]?_0x678fc9[_0xd480('0x1a')][_0xd480('0x1b')]===undefined?!![]:![]:!![],'where':_0x678fc9[_0xd480('0x1a')]?_0x678fc9[_0xd480('0x1a')][_0xd480('0x1c')]||null:null,'attributes':_0x678fc9['options']?_0x678fc9[_0xd480('0x1a')]['attributes']||null:null,'include':_0x678fc9[_0xd480('0x1a')]?_0x678fc9[_0xd480('0x1a')][_0xd480('0x1e')]?_[_0xd480('0x24')](_0x678fc9[_0xd480('0x1a')][_0xd480('0x1e')],function(_0x5c128e){return{'model':db[_0x5c128e[_0xd480('0x1f')]],'as':_0x5c128e['as'],'attributes':_0x5c128e[_0xd480('0x20')],'include':_0x5c128e['include']?_[_0xd480('0x24')](_0x5c128e[_0xd480('0x1e')],function(_0x4468d5){return{'model':db[_0x4468d5[_0xd480('0x1f')]],'as':_0x4468d5['as'],'attributes':_0x4468d5[_0xd480('0x20')],'include':_0x4468d5[_0xd480('0x1e')]?_[_0xd480('0x24')](_0x4468d5[_0xd480('0x1e')],function(_0x5f3310){return{'model':db[_0x5f3310[_0xd480('0x1f')]],'as':_0x5f3310['as'],'attributes':_0x5f3310[_0xd480('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd480('0xe')](function(_0x531500){logger[_0xd480('0xf')](_0xd480('0x21'),_0x678fc9);logger[_0xd480('0x12')]('ShowFreshdeskAccount',_0x678fc9,JSON[_0xd480('0x14')](_0x531500));_0x23b729(_0x531500);})['catch'](function(_0x176184){logger[_0xd480('0x15')](_0xd480('0x21'),_0x176184[_0xd480('0x17')],_0x678fc9);_0x2727d5(_0x44fac0[_0xd480('0x15')](0x1f4,_0x176184['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 341b3cb..9c0ace2 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 _0xaf22=['isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xaf22,0x1f4));var _0x2af2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xaf22[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x2af2('0x0'));var util=require(_0x2af2('0x1'));var path=require(_0x2af2('0x2'));var timeout=require(_0x2af2('0x3'));var express=require('express');var router=express[_0x2af2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2af2('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x2af2('0x6')](),controller[_0x2af2('0x7')]);router[_0x2af2('0x8')](_0x2af2('0x9'),auth[_0x2af2('0x6')](),controller[_0x2af2('0xa')]);router[_0x2af2('0x8')](_0x2af2('0xb'),auth[_0x2af2('0x6')](),controller[_0x2af2('0xc')]);router['get'](_0x2af2('0xd'),auth[_0x2af2('0x6')](),controller[_0x2af2('0xe')]);router[_0x2af2('0x8')](_0x2af2('0xf'),auth[_0x2af2('0x6')](),controller[_0x2af2('0x10')]);router[_0x2af2('0x8')](_0x2af2('0x11'),auth[_0x2af2('0x6')](),controller['getTags']);router['post']('/',auth[_0x2af2('0x6')](),controller['create']);router['post'](_0x2af2('0x11'),auth[_0x2af2('0x6')](),controller[_0x2af2('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2af2('0x13')]);router[_0x2af2('0x14')](_0x2af2('0x9'),auth[_0x2af2('0x6')](),controller[_0x2af2('0x15')]);module[_0x2af2('0x16')]=router; \ No newline at end of file +var _0x00f0=['/:id/tags','getTags','create','post','setTags','put','update','delete','exports','util','path','connect-timeout','express','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3aafad,_0x54a3f7){var _0x20aeb8=function(_0x29ba72){while(--_0x29ba72){_0x3aafad['push'](_0x3aafad['shift']());}};_0x20aeb8(++_0x54a3f7);}(_0x00f0,0x11d));var _0x000f=function(_0x3b8ab0,_0x2f5c06){_0x3b8ab0=_0x3b8ab0-0x0;var _0x308f56=_0x00f0[_0x3b8ab0];return _0x308f56;};'use strict';var multer=require('multer');var util=require(_0x000f('0x0'));var path=require(_0x000f('0x1'));var timeout=require(_0x000f('0x2'));var express=require(_0x000f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x000f('0x4'));var config=require('../../config/environment');var controller=require(_0x000f('0x5'));router[_0x000f('0x6')]('/',auth[_0x000f('0x7')](),controller[_0x000f('0x8')]);router[_0x000f('0x6')](_0x000f('0x9'),auth[_0x000f('0x7')](),controller[_0x000f('0xa')]);router[_0x000f('0x6')]('/:id/fields',auth[_0x000f('0x7')](),controller['getFields']);router[_0x000f('0x6')](_0x000f('0xb'),auth[_0x000f('0x7')](),controller[_0x000f('0xc')]);router[_0x000f('0x6')](_0x000f('0xd'),auth[_0x000f('0x7')](),controller['getDescriptions']);router[_0x000f('0x6')](_0x000f('0xe'),auth[_0x000f('0x7')](),controller[_0x000f('0xf')]);router['post']('/',auth[_0x000f('0x7')](),controller[_0x000f('0x10')]);router[_0x000f('0x11')](_0x000f('0xe'),auth[_0x000f('0x7')](),controller[_0x000f('0x12')]);router[_0x000f('0x13')](_0x000f('0x9'),auth[_0x000f('0x7')](),controller[_0x000f('0x14')]);router[_0x000f('0x15')](_0x000f('0x9'),auth[_0x000f('0x7')](),controller['destroy']);module[_0x000f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0974a27..7ce2f55 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 _0x9811=['exports','STRING','sequelize'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9811,0x1d6));var _0x1981=function(_0xfbd42a,_0x2de162){_0xfbd42a=_0xfbd42a-0x0;var _0xf6732c=_0x9811[_0xfbd42a];return _0xf6732c;};'use strict';var Sequelize=require(_0x1981('0x0'));module[_0x1981('0x1')]={'name':{'type':Sequelize[_0x1981('0x2')]},'description':{'type':Sequelize[_0x1981('0x2')]}}; \ No newline at end of file +var _0x0f5b=['exports','STRING','sequelize'];(function(_0x440fce,_0x5e3af4){var _0x493bb8=function(_0x18411c){while(--_0x18411c){_0x440fce['push'](_0x440fce['shift']());}};_0x493bb8(++_0x5e3af4);}(_0x0f5b,0xa7));var _0xb0f5=function(_0x38ed1e,_0x17c77a){_0x38ed1e=_0x38ed1e-0x0;var _0x1e660e=_0x0f5b[_0x38ed1e];return _0x1e660e;};'use strict';var Sequelize=require(_0xb0f5('0x0'));module[_0xb0f5('0x1')]={'name':{'type':Sequelize[_0xb0f5('0x2')]},'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 6e1e82c..a2a1fc7 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 _0x52fe=['update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','keys','options','find','create','body','getFields','pick','getSubjects','FreshdeskField','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x2641da,_0xecba69){var _0xf8e5d=function(_0x5210a6){while(--_0x5210a6){_0x2641da['push'](_0x2641da['shift']());}};_0xf8e5d(++_0xecba69);}(_0x52fe,0xf5));var _0xe52f=function(_0x51e117,_0x1c870d){_0x51e117=_0x51e117-0x0;var _0x3b6fa7=_0x52fe[_0x51e117];return _0x3b6fa7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe52f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe52f('0x1'));var rp=require(_0xe52f('0x2'));var moment=require('moment');var BPromise=require(_0xe52f('0x3'));var Mustache=require(_0xe52f('0x4'));var util=require(_0xe52f('0x5'));var path=require(_0xe52f('0x6'));var sox=require(_0xe52f('0x7'));var csv=require(_0xe52f('0x8'));var ejs=require(_0xe52f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe52f('0xa'));var crypto=require(_0xe52f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe52f('0xc'));var toCsv=require(_0xe52f('0x8'));var querystring=require(_0xe52f('0xd'));var Papa=require(_0xe52f('0xe'));var Redis=require(_0xe52f('0xf'));var authService=require(_0xe52f('0x10'));var qs=require(_0xe52f('0x11'));var as=require(_0xe52f('0x12'));var hardwareService=require(_0xe52f('0x13'));var logger=require(_0xe52f('0x14'))(_0xe52f('0x15'));var utils=require(_0xe52f('0x16'));var config=require(_0xe52f('0x17'));var licenseUtil=require(_0xe52f('0x18'));var db=require(_0xe52f('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe52f('0x1a')][_0xe52f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x44a958,_0xb57270,_0x4709e8,_0x342b8c){return new BPromise(function(_0x52eae9,_0xd51bf6){var _0x137de6=_0x342b8c||client;return _0x137de6[_0xe52f('0x1c')](_0x44a958,_0x4709e8)[_0xe52f('0x1d')](function(_0x47a651){logger[_0xe52f('0x1e')](_0xe52f('0x1f'),_0xb57270,_0xe52f('0x20'));logger[_0xe52f('0x21')](_0xe52f('0x22'),_0xb57270,'request\x20sent',JSON[_0xe52f('0x23')](_0x47a651));if(_0x47a651[_0xe52f('0x24')]){if(_0x47a651[_0xe52f('0x24')][_0xe52f('0x25')]===0x1f4){logger['error'](_0xe52f('0x1f'),_0xb57270,_0x47a651[_0xe52f('0x24')]['message']);return _0xd51bf6(_0x47a651[_0xe52f('0x24')][_0xe52f('0x26')]);}logger[_0xe52f('0x24')](_0xe52f('0x1f'),_0xb57270,_0x47a651[_0xe52f('0x24')]['message']);return _0x52eae9(_0x47a651[_0xe52f('0x24')][_0xe52f('0x26')]);}else{logger[_0xe52f('0x1e')](_0xe52f('0x1f'),_0xb57270,_0xe52f('0x20'));_0x52eae9(_0x47a651[_0xe52f('0x27')]['message']);}})[_0xe52f('0x28')](function(_0x30dbee){logger[_0xe52f('0x24')](_0xe52f('0x1f'),_0xb57270,_0x30dbee);_0xd51bf6(_0x30dbee);});});}function respondWithStatusCode(_0x30b51c,_0x3dabf6){_0x3dabf6=_0x3dabf6||0xcc;return function(_0x30c5fe){if(_0x30c5fe){return _0x30b51c['sendStatus'](_0x3dabf6);}return _0x30b51c[_0xe52f('0x29')](_0x3dabf6)[_0xe52f('0x2a')]();};}function respondWithResult(_0x379645,_0x418a14){_0x418a14=_0x418a14||0xc8;return function(_0x180d78){if(_0x180d78){return _0x379645[_0xe52f('0x29')](_0x418a14)[_0xe52f('0x2b')](_0x180d78);}};}function respondWithFilteredResult(_0x4d6d5b,_0x22dc99){return function(_0x2141a8){if(_0x2141a8){var _0x5d7dea=_0x2141a8[_0xe52f('0x2c')],_0x3c2473=_0x22dc99[_0xe52f('0x2d')],_0x40e738=_0x22dc99['offset']+_0x22dc99[_0xe52f('0x2e')],_0x26b9d5;if(_0x40e738>=_0x5d7dea){_0x40e738=_0x5d7dea;_0x26b9d5=0xc8;}else{_0x26b9d5=0xce;}_0x4d6d5b[_0xe52f('0x29')](_0x26b9d5);return _0x4d6d5b[_0xe52f('0x2f')](_0xe52f('0x30'),_0x3c2473+'-'+_0x40e738+'/'+_0x5d7dea)['json'](_0x2141a8);}return null;};}function patchUpdates(_0x58f196){return function(_0x2ad384){try{jsonpatch[_0xe52f('0x31')](_0x2ad384,_0x58f196,!![]);}catch(_0x152910){return BPromise[_0xe52f('0x32')](_0x152910);}return _0x2ad384[_0xe52f('0x33')]();};}function saveUpdates(_0x409f19,_0x51031b){return function(_0x58a14f){if(_0x58a14f){return _0x58a14f[_0xe52f('0x34')](_0x409f19)[_0xe52f('0x1d')](function(_0x4cec19){return _0x4cec19;});}return null;};}function removeEntity(_0x35cf3c,_0x338242){return function(_0x44ca6a){if(_0x44ca6a){return _0x44ca6a[_0xe52f('0x35')]()[_0xe52f('0x1d')](function(){_0x35cf3c[_0xe52f('0x29')](0xcc)[_0xe52f('0x2a')]();});}};}function handleEntityNotFound(_0x52c560,_0xfe5834){return function(_0x2eb888){if(!_0x2eb888){_0x52c560[_0xe52f('0x36')](0x194);}return _0x2eb888;};}function handleError(_0x50976b,_0x1f9299){_0x1f9299=_0x1f9299||0x1f4;return function(_0x5b9070){logger[_0xe52f('0x24')](_0x5b9070[_0xe52f('0x37')]);if(_0x5b9070['name']){delete _0x5b9070[_0xe52f('0x38')];}_0x50976b[_0xe52f('0x29')](_0x1f9299)[_0xe52f('0x39')](_0x5b9070);};}exports[_0xe52f('0x3a')]=function(_0x47f2f2,_0x1e9dc4){var _0x4f45ce={},_0x5cc583={},_0x5dd357={'count':0x0,'rows':[]};var _0x55f7eb=_[_0xe52f('0x3b')](db['FreshdeskConfiguration'][_0xe52f('0x3c')],function(_0x2c20a4){return{'name':_0x2c20a4['fieldName'],'type':_0x2c20a4[_0xe52f('0x3d')][_0xe52f('0x3e')]};});_0x5cc583['model']=_[_0xe52f('0x3b')](_0x55f7eb,_0xe52f('0x38'));_0x5cc583['query']=_['keys'](_0x47f2f2['query']);_0x5cc583[_0xe52f('0x3f')]=_[_0xe52f('0x40')](_0x5cc583['model'],_0x5cc583[_0xe52f('0x41')]);_0x4f45ce[_0xe52f('0x42')]=_['intersection'](_0x5cc583[_0xe52f('0x43')],qs[_0xe52f('0x44')](_0x47f2f2[_0xe52f('0x41')][_0xe52f('0x44')]));_0x4f45ce[_0xe52f('0x42')]=_0x4f45ce[_0xe52f('0x42')][_0xe52f('0x45')]?_0x4f45ce[_0xe52f('0x42')]:_0x5cc583[_0xe52f('0x43')];if(!_0x47f2f2[_0xe52f('0x41')][_0xe52f('0x46')](_0xe52f('0x47'))){_0x4f45ce[_0xe52f('0x2e')]=qs[_0xe52f('0x2e')](_0x47f2f2['query'][_0xe52f('0x2e')]);_0x4f45ce['offset']=qs[_0xe52f('0x2d')](_0x47f2f2[_0xe52f('0x41')][_0xe52f('0x2d')]);}_0x4f45ce[_0xe52f('0x48')]=qs[_0xe52f('0x49')](_0x47f2f2[_0xe52f('0x41')]['sort']);_0x4f45ce['where']=qs[_0xe52f('0x3f')](_['pick'](_0x47f2f2[_0xe52f('0x41')],_0x5cc583['filters']),_0x55f7eb);if(_0x47f2f2[_0xe52f('0x41')][_0xe52f('0x4a')]){_0x4f45ce['where']=_['merge'](_0x4f45ce[_0xe52f('0x4b')],{'$or':_['map'](_0x55f7eb,function(_0xea13e8){if(_0xea13e8[_0xe52f('0x3d')]!=='VIRTUAL'){var _0x2056c3={};_0x2056c3[_0xea13e8['name']]={'$like':'%'+_0x47f2f2['query'][_0xe52f('0x4a')]+'%'};return _0x2056c3;}})});}_0x4f45ce=_[_0xe52f('0x4c')]({},_0x4f45ce,_0x47f2f2['options']);var _0xf95856={'where':_0x4f45ce[_0xe52f('0x4b')]};return db['FreshdeskConfiguration']['count'](_0xf95856)[_0xe52f('0x1d')](function(_0x137a60){_0x5dd357[_0xe52f('0x2c')]=_0x137a60;if(_0x47f2f2['query'][_0xe52f('0x4d')]){_0x4f45ce[_0xe52f('0x4e')]=[{'all':!![]}];}return db[_0xe52f('0x4f')][_0xe52f('0x50')](_0x4f45ce);})[_0xe52f('0x1d')](function(_0x1f8414){_0x5dd357[_0xe52f('0x51')]=_0x1f8414;return _0x5dd357;})[_0xe52f('0x1d')](respondWithFilteredResult(_0x1e9dc4,_0x4f45ce))[_0xe52f('0x28')](handleError(_0x1e9dc4,null));};exports[_0xe52f('0x52')]=function(_0x23edd8,_0x4f3b7b){var _0x26ad89={'raw':![],'where':{'id':_0x23edd8[_0xe52f('0x53')]['id']}},_0x2c3ba2={};_0x2c3ba2['model']=_[_0xe52f('0x54')](db[_0xe52f('0x4f')][_0xe52f('0x3c')]);_0x2c3ba2[_0xe52f('0x41')]=_[_0xe52f('0x54')](_0x23edd8['query']);_0x2c3ba2['filters']=_['intersection'](_0x2c3ba2[_0xe52f('0x43')],_0x2c3ba2[_0xe52f('0x41')]);_0x26ad89['attributes']=_[_0xe52f('0x40')](_0x2c3ba2[_0xe52f('0x43')],qs[_0xe52f('0x44')](_0x23edd8['query'][_0xe52f('0x44')]));_0x26ad89[_0xe52f('0x42')]=_0x26ad89[_0xe52f('0x42')][_0xe52f('0x45')]?_0x26ad89['attributes']:_0x2c3ba2[_0xe52f('0x43')];if(_0x23edd8[_0xe52f('0x41')][_0xe52f('0x4d')]){_0x26ad89[_0xe52f('0x4e')]=[{'all':!![]}];}_0x26ad89=_[_0xe52f('0x4c')]({},_0x26ad89,_0x23edd8[_0xe52f('0x55')]);return db[_0xe52f('0x4f')][_0xe52f('0x56')](_0x26ad89)[_0xe52f('0x1d')](handleEntityNotFound(_0x4f3b7b,null))[_0xe52f('0x1d')](respondWithResult(_0x4f3b7b,null))[_0xe52f('0x28')](handleError(_0x4f3b7b,null));};exports[_0xe52f('0x57')]=function(_0x31c294,_0x1f5269){return db[_0xe52f('0x4f')][_0xe52f('0x57')](_0x31c294[_0xe52f('0x58')],{})[_0xe52f('0x1d')](respondWithResult(_0x1f5269,0xc9))[_0xe52f('0x28')](handleError(_0x1f5269,null));};exports['update']=function(_0x2d8fc3,_0x3e3bd1){if(_0x2d8fc3[_0xe52f('0x58')]['id']){delete _0x2d8fc3[_0xe52f('0x58')]['id'];}return db[_0xe52f('0x4f')][_0xe52f('0x56')]({'where':{'id':_0x2d8fc3[_0xe52f('0x53')]['id']}})[_0xe52f('0x1d')](handleEntityNotFound(_0x3e3bd1,null))['then'](saveUpdates(_0x2d8fc3[_0xe52f('0x58')],null))[_0xe52f('0x1d')](respondWithResult(_0x3e3bd1,null))[_0xe52f('0x28')](handleError(_0x3e3bd1,null));};exports['destroy']=function(_0x3b82b0,_0x22f23a){return db[_0xe52f('0x4f')][_0xe52f('0x56')]({'where':{'id':_0x3b82b0[_0xe52f('0x53')]['id']}})['then'](handleEntityNotFound(_0x22f23a,null))[_0xe52f('0x1d')](removeEntity(_0x22f23a,null))[_0xe52f('0x28')](handleError(_0x22f23a,null));};exports[_0xe52f('0x59')]=function(_0x2380c9,_0x5f3c7d,_0x3c9073){var _0x45409a={};var _0x2ff16c={};var _0x34f402;var _0x492e19;return db[_0xe52f('0x4f')]['findOne']({'where':{'id':_0x2380c9[_0xe52f('0x53')]['id']}})[_0xe52f('0x1d')](handleEntityNotFound(_0x5f3c7d,null))['then'](function(_0x4420ee){if(_0x4420ee){_0x34f402=_0x4420ee;_0x2ff16c[_0xe52f('0x43')]=_[_0xe52f('0x54')](db['FreshdeskField'][_0xe52f('0x3c')]);_0x2ff16c['query']=_[_0xe52f('0x54')](_0x2380c9['query']);_0x2ff16c[_0xe52f('0x3f')]=_[_0xe52f('0x40')](_0x2ff16c['model'],_0x2ff16c[_0xe52f('0x41')]);_0x45409a['attributes']=_['intersection'](_0x2ff16c['model'],qs[_0xe52f('0x44')](_0x2380c9[_0xe52f('0x41')][_0xe52f('0x44')]));_0x45409a[_0xe52f('0x42')]=_0x45409a[_0xe52f('0x42')][_0xe52f('0x45')]?_0x45409a[_0xe52f('0x42')]:_0x2ff16c['model'];_0x45409a[_0xe52f('0x48')]=qs['sort'](_0x2380c9[_0xe52f('0x41')]['sort']);_0x45409a[_0xe52f('0x4b')]=qs[_0xe52f('0x3f')](_[_0xe52f('0x5a')](_0x2380c9[_0xe52f('0x41')],_0x2ff16c[_0xe52f('0x3f')]));if(_0x2380c9['query']['filter']){_0x45409a[_0xe52f('0x4b')]=_[_0xe52f('0x4c')](_0x45409a[_0xe52f('0x4b')],{'$or':_[_0xe52f('0x3b')](_0x45409a[_0xe52f('0x42')],function(_0x24c66f){var _0x4c8768={};_0x4c8768[_0x24c66f]={'$like':'%'+_0x2380c9[_0xe52f('0x41')][_0xe52f('0x4a')]+'%'};return _0x4c8768;})});}_0x45409a=_['merge']({},_0x45409a,_0x2380c9['options']);return _0x34f402[_0xe52f('0x59')](_0x45409a);}})['then'](function(_0x26f332){if(_0x26f332){_0x492e19=_0x26f332['length'];if(!_0x2380c9[_0xe52f('0x41')][_0xe52f('0x46')](_0xe52f('0x47'))){_0x45409a[_0xe52f('0x2e')]=qs[_0xe52f('0x2e')](_0x2380c9[_0xe52f('0x41')]['limit']);_0x45409a['offset']=qs[_0xe52f('0x2d')](_0x2380c9[_0xe52f('0x41')][_0xe52f('0x2d')]);}return _0x34f402[_0xe52f('0x59')](_0x45409a);}})[_0xe52f('0x1d')](function(_0xdf8440){if(_0xdf8440){return _0xdf8440?{'count':_0x492e19,'rows':_0xdf8440}:null;}})[_0xe52f('0x1d')](respondWithResult(_0x5f3c7d,null))[_0xe52f('0x28')](handleError(_0x5f3c7d,null));};exports[_0xe52f('0x5b')]=function(_0x523e67,_0x400cab,_0x255123){var _0x5b596a={};var _0x362369={};var _0x2594cc;var _0x2d52bd;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x523e67[_0xe52f('0x53')]['id']}})[_0xe52f('0x1d')](handleEntityNotFound(_0x400cab,null))['then'](function(_0x2bbf30){if(_0x2bbf30){_0x2594cc=_0x2bbf30;_0x362369[_0xe52f('0x43')]=_[_0xe52f('0x54')](db[_0xe52f('0x5c')][_0xe52f('0x3c')]);_0x362369['query']=_[_0xe52f('0x54')](_0x523e67[_0xe52f('0x41')]);_0x362369[_0xe52f('0x3f')]=_['intersection'](_0x362369[_0xe52f('0x43')],_0x362369[_0xe52f('0x41')]);_0x5b596a[_0xe52f('0x42')]=_[_0xe52f('0x40')](_0x362369[_0xe52f('0x43')],qs['fields'](_0x523e67[_0xe52f('0x41')][_0xe52f('0x44')]));_0x5b596a[_0xe52f('0x42')]=_0x5b596a[_0xe52f('0x42')]['length']?_0x5b596a[_0xe52f('0x42')]:_0x362369['model'];_0x5b596a['order']=qs[_0xe52f('0x49')](_0x523e67[_0xe52f('0x41')][_0xe52f('0x49')]);_0x5b596a['where']=qs['filters'](_[_0xe52f('0x5a')](_0x523e67[_0xe52f('0x41')],_0x362369[_0xe52f('0x3f')]));if(_0x523e67['query']['filter']){_0x5b596a[_0xe52f('0x4b')]=_['merge'](_0x5b596a[_0xe52f('0x4b')],{'$or':_['map'](_0x5b596a['attributes'],function(_0x5d5489){var _0x1047e9={};_0x1047e9[_0x5d5489]={'$like':'%'+_0x523e67[_0xe52f('0x41')][_0xe52f('0x4a')]+'%'};return _0x1047e9;})});}_0x5b596a=_[_0xe52f('0x4c')]({},_0x5b596a,_0x523e67['options']);return _0x2594cc[_0xe52f('0x5b')](_0x5b596a);}})[_0xe52f('0x1d')](function(_0x4c377b){if(_0x4c377b){_0x2d52bd=_0x4c377b['length'];if(!_0x523e67['query'][_0xe52f('0x46')](_0xe52f('0x47'))){_0x5b596a[_0xe52f('0x2e')]=qs[_0xe52f('0x2e')](_0x523e67[_0xe52f('0x41')][_0xe52f('0x2e')]);_0x5b596a['offset']=qs[_0xe52f('0x2d')](_0x523e67[_0xe52f('0x41')][_0xe52f('0x2d')]);}return _0x2594cc[_0xe52f('0x5b')](_0x5b596a);}})[_0xe52f('0x1d')](function(_0x13a650){if(_0x13a650){return _0x13a650?{'count':_0x2d52bd,'rows':_0x13a650}:null;}})[_0xe52f('0x1d')](respondWithResult(_0x400cab,null))[_0xe52f('0x28')](handleError(_0x400cab,null));};exports[_0xe52f('0x5d')]=function(_0x4969e6,_0x15613a,_0x339e1d){var _0x456ecb={};var _0x5bc6a0={};var _0x1a204a;var _0x42be0e;return db[_0xe52f('0x4f')]['findOne']({'where':{'id':_0x4969e6['params']['id']}})['then'](handleEntityNotFound(_0x15613a,null))[_0xe52f('0x1d')](function(_0x44b9ab){if(_0x44b9ab){_0x1a204a=_0x44b9ab;_0x5bc6a0['model']=_[_0xe52f('0x54')](db[_0xe52f('0x5c')][_0xe52f('0x3c')]);_0x5bc6a0[_0xe52f('0x41')]=_[_0xe52f('0x54')](_0x4969e6[_0xe52f('0x41')]);_0x5bc6a0[_0xe52f('0x3f')]=_[_0xe52f('0x40')](_0x5bc6a0[_0xe52f('0x43')],_0x5bc6a0['query']);_0x456ecb[_0xe52f('0x42')]=_[_0xe52f('0x40')](_0x5bc6a0[_0xe52f('0x43')],qs[_0xe52f('0x44')](_0x4969e6[_0xe52f('0x41')][_0xe52f('0x44')]));_0x456ecb[_0xe52f('0x42')]=_0x456ecb['attributes']['length']?_0x456ecb[_0xe52f('0x42')]:_0x5bc6a0[_0xe52f('0x43')];_0x456ecb[_0xe52f('0x48')]=qs['sort'](_0x4969e6[_0xe52f('0x41')]['sort']);_0x456ecb['where']=qs[_0xe52f('0x3f')](_[_0xe52f('0x5a')](_0x4969e6[_0xe52f('0x41')],_0x5bc6a0[_0xe52f('0x3f')]));if(_0x4969e6[_0xe52f('0x41')][_0xe52f('0x4a')]){_0x456ecb[_0xe52f('0x4b')]=_['merge'](_0x456ecb['where'],{'$or':_[_0xe52f('0x3b')](_0x456ecb['attributes'],function(_0xd6390f){var _0x3a7e65={};_0x3a7e65[_0xd6390f]={'$like':'%'+_0x4969e6[_0xe52f('0x41')][_0xe52f('0x4a')]+'%'};return _0x3a7e65;})});}_0x456ecb=_[_0xe52f('0x4c')]({},_0x456ecb,_0x4969e6[_0xe52f('0x55')]);return _0x1a204a[_0xe52f('0x5d')](_0x456ecb);}})[_0xe52f('0x1d')](function(_0x36a661){if(_0x36a661){_0x42be0e=_0x36a661[_0xe52f('0x45')];if(!_0x4969e6[_0xe52f('0x41')][_0xe52f('0x46')]('nolimit')){_0x456ecb[_0xe52f('0x2e')]=qs['limit'](_0x4969e6['query']['limit']);_0x456ecb[_0xe52f('0x2d')]=qs[_0xe52f('0x2d')](_0x4969e6[_0xe52f('0x41')]['offset']);}return _0x1a204a['getDescriptions'](_0x456ecb);}})[_0xe52f('0x1d')](function(_0x3940f7){if(_0x3940f7){return _0x3940f7?{'count':_0x42be0e,'rows':_0x3940f7}:null;}})[_0xe52f('0x1d')](respondWithResult(_0x15613a,null))[_0xe52f('0x28')](handleError(_0x15613a,null));};exports[_0xe52f('0x5e')]=function(_0x32adfc,_0x4811d6,_0x38c197){var _0x31cb11={};var _0x434f8b={};var _0x4c02aa;var _0x4d6cae;return db[_0xe52f('0x4f')][_0xe52f('0x5f')]({'where':{'id':_0x32adfc[_0xe52f('0x53')]['id']}})[_0xe52f('0x1d')](handleEntityNotFound(_0x4811d6,null))['then'](function(_0xb3066c){if(_0xb3066c){_0x4c02aa=_0xb3066c;_0x434f8b[_0xe52f('0x43')]=_[_0xe52f('0x54')](db[_0xe52f('0x60')]['rawAttributes']);_0x434f8b[_0xe52f('0x41')]=_[_0xe52f('0x54')](_0x32adfc[_0xe52f('0x41')]);_0x434f8b[_0xe52f('0x3f')]=_[_0xe52f('0x40')](_0x434f8b['model'],_0x434f8b[_0xe52f('0x41')]);_0x31cb11[_0xe52f('0x42')]=_[_0xe52f('0x40')](_0x434f8b[_0xe52f('0x43')],qs[_0xe52f('0x44')](_0x32adfc[_0xe52f('0x41')][_0xe52f('0x44')]));_0x31cb11[_0xe52f('0x42')]=_0x31cb11[_0xe52f('0x42')][_0xe52f('0x45')]?_0x31cb11[_0xe52f('0x42')]:_0x434f8b[_0xe52f('0x43')];_0x31cb11[_0xe52f('0x48')]=qs['sort'](_0x32adfc['query']['sort']);_0x31cb11['where']=qs['filters'](_[_0xe52f('0x5a')](_0x32adfc['query'],_0x434f8b[_0xe52f('0x3f')]));if(_0x32adfc['query']['filter']){_0x31cb11[_0xe52f('0x4b')]=_[_0xe52f('0x4c')](_0x31cb11[_0xe52f('0x4b')],{'$or':_[_0xe52f('0x3b')](_0x31cb11[_0xe52f('0x42')],function(_0x386829){var _0x2b75c6={};_0x2b75c6[_0x386829]={'$like':'%'+_0x32adfc['query'][_0xe52f('0x4a')]+'%'};return _0x2b75c6;})});}_0x31cb11=_[_0xe52f('0x4c')]({},_0x31cb11,_0x32adfc[_0xe52f('0x55')]);return _0x4c02aa['getTags'](_0x31cb11);}})[_0xe52f('0x1d')](function(_0x38a42b){if(_0x38a42b){_0x4d6cae=_0x38a42b[_0xe52f('0x45')];if(!_0x32adfc[_0xe52f('0x41')][_0xe52f('0x46')](_0xe52f('0x47'))){_0x31cb11['limit']=qs[_0xe52f('0x2e')](_0x32adfc[_0xe52f('0x41')]['limit']);_0x31cb11[_0xe52f('0x2d')]=qs[_0xe52f('0x2d')](_0x32adfc[_0xe52f('0x41')]['offset']);}return _0x4c02aa[_0xe52f('0x5e')](_0x31cb11);}})[_0xe52f('0x1d')](function(_0x44acbe){if(_0x44acbe){return _0x44acbe?{'count':_0x4d6cae,'rows':_0x44acbe}:null;}})['then'](respondWithResult(_0x4811d6,null))['catch'](handleError(_0x4811d6,null));};exports['setTags']=function(_0x5709d8,_0x281b84,_0x195f17){if(_0x5709d8[_0xe52f('0x58')]['id']){delete _0x5709d8[_0xe52f('0x58')]['id'];}return db[_0xe52f('0x4f')][_0xe52f('0x5f')]({'where':{'id':_0x5709d8[_0xe52f('0x53')]['id']}})[_0xe52f('0x1d')](handleEntityNotFound(_0x281b84,null))['then'](function(_0x2a5c78){if(_0x2a5c78){return _0x2a5c78[_0xe52f('0x61')](_0x5709d8[_0xe52f('0x58')][_0xe52f('0x62')]||[]);}return null;})['then'](respondWithResult(_0x281b84,null))[_0xe52f('0x28')](handleError(_0x281b84,null));}; \ No newline at end of file +var _0xe239=['jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','params','rawAttributes','create','body','find','findOne','FreshdeskField','length','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x4403f7,_0x193ff5){var _0x38d58d=function(_0x322f23){while(--_0x322f23){_0x4403f7['push'](_0x4403f7['shift']());}};_0x38d58d(++_0x193ff5);}(_0xe239,0x151));var _0x9e23=function(_0x3c0b95,_0x26105c){_0x3c0b95=_0x3c0b95-0x0;var _0x3759e0=_0xe239[_0x3c0b95];return _0x3759e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9e23('0x0'));var rimraf=require(_0x9e23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e23('0x2'));var rp=require(_0x9e23('0x3'));var moment=require('moment');var BPromise=require(_0x9e23('0x4'));var Mustache=require(_0x9e23('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9e23('0x6'));var ejs=require(_0x9e23('0x7'));var fs=require('fs');var _=require(_0x9e23('0x8'));var squel=require(_0x9e23('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9e23('0x6'));var querystring=require(_0x9e23('0xa'));var Papa=require(_0x9e23('0xb'));var Redis=require(_0x9e23('0xc'));var authService=require(_0x9e23('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e23('0xe'));var logger=require(_0x9e23('0xf'))(_0x9e23('0x10'));var utils=require(_0x9e23('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9e23('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9e23('0x13'));var client=jayson[_0x9e23('0x14')][_0x9e23('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x423560,_0x434734,_0x3c18a9,_0x2cdd6c){return new BPromise(function(_0x4661b8,_0x384dd5){var _0x546006=_0x2cdd6c||client;return _0x546006['request'](_0x423560,_0x3c18a9)['then'](function(_0x5d733b){logger[_0x9e23('0x16')](_0x9e23('0x17'),_0x434734,_0x9e23('0x18'));logger['debug'](_0x9e23('0x19'),_0x434734,'request\x20sent',JSON['stringify'](_0x5d733b));if(_0x5d733b[_0x9e23('0x1a')]){if(_0x5d733b[_0x9e23('0x1a')][_0x9e23('0x1b')]===0x1f4){logger[_0x9e23('0x1a')](_0x9e23('0x17'),_0x434734,_0x5d733b['error'][_0x9e23('0x1c')]);return _0x384dd5(_0x5d733b['error'][_0x9e23('0x1c')]);}logger[_0x9e23('0x1a')](_0x9e23('0x17'),_0x434734,_0x5d733b['error']['message']);return _0x4661b8(_0x5d733b[_0x9e23('0x1a')][_0x9e23('0x1c')]);}else{logger[_0x9e23('0x16')](_0x9e23('0x17'),_0x434734,'request\x20sent');_0x4661b8(_0x5d733b[_0x9e23('0x1d')][_0x9e23('0x1c')]);}})[_0x9e23('0x1e')](function(_0x4fdba9){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x434734,_0x4fdba9);_0x384dd5(_0x4fdba9);});});}function respondWithStatusCode(_0x5b3df6,_0x3c5cfa){_0x3c5cfa=_0x3c5cfa||0xcc;return function(_0x3a253c){if(_0x3a253c){return _0x5b3df6[_0x9e23('0x1f')](_0x3c5cfa);}return _0x5b3df6[_0x9e23('0x20')](_0x3c5cfa)[_0x9e23('0x21')]();};}function respondWithResult(_0xc7fc3c,_0x565594){_0x565594=_0x565594||0xc8;return function(_0x46fa5d){if(_0x46fa5d){return _0xc7fc3c[_0x9e23('0x20')](_0x565594)['json'](_0x46fa5d);}};}function respondWithFilteredResult(_0x177251,_0x1cae6e){return function(_0x509624){if(_0x509624){var _0x1f3343=_0x509624['count'],_0x21d89f=_0x1cae6e[_0x9e23('0x22')],_0x38cf27=_0x1cae6e[_0x9e23('0x22')]+_0x1cae6e[_0x9e23('0x23')],_0x57ab90;if(_0x38cf27>=_0x1f3343){_0x38cf27=_0x1f3343;_0x57ab90=0xc8;}else{_0x57ab90=0xce;}_0x177251[_0x9e23('0x20')](_0x57ab90);return _0x177251[_0x9e23('0x24')](_0x9e23('0x25'),_0x21d89f+'-'+_0x38cf27+'/'+_0x1f3343)[_0x9e23('0x26')](_0x509624);}return null;};}function patchUpdates(_0x4f8bdb){return function(_0x574f85){try{jsonpatch['apply'](_0x574f85,_0x4f8bdb,!![]);}catch(_0x7e6206){return BPromise[_0x9e23('0x27')](_0x7e6206);}return _0x574f85[_0x9e23('0x28')]();};}function saveUpdates(_0x578197,_0x2edb20){return function(_0x469619){if(_0x469619){return _0x469619[_0x9e23('0x29')](_0x578197)[_0x9e23('0x2a')](function(_0x58d871){return _0x58d871;});}return null;};}function removeEntity(_0x39e552,_0x18c78d){return function(_0x1a493c){if(_0x1a493c){return _0x1a493c[_0x9e23('0x2b')]()[_0x9e23('0x2a')](function(){_0x39e552[_0x9e23('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d304,_0x128727){return function(_0x7f26a1){if(!_0x7f26a1){_0x51d304[_0x9e23('0x1f')](0x194);}return _0x7f26a1;};}function handleError(_0x3377ca,_0x5b07fe){_0x5b07fe=_0x5b07fe||0x1f4;return function(_0x1e3ef6){logger[_0x9e23('0x1a')](_0x1e3ef6[_0x9e23('0x2c')]);if(_0x1e3ef6[_0x9e23('0x2d')]){delete _0x1e3ef6[_0x9e23('0x2d')];}_0x3377ca['status'](_0x5b07fe)[_0x9e23('0x2e')](_0x1e3ef6);};}exports[_0x9e23('0x2f')]=function(_0x48af7d,_0x1e63b0){var _0x424c3b={},_0x8187f9={},_0x178ad3={'count':0x0,'rows':[]};var _0x148eba=_[_0x9e23('0x30')](db[_0x9e23('0x31')]['rawAttributes'],function(_0xa62aa2){return{'name':_0xa62aa2[_0x9e23('0x32')],'type':_0xa62aa2[_0x9e23('0x33')][_0x9e23('0x34')]};});_0x8187f9[_0x9e23('0x35')]=_[_0x9e23('0x30')](_0x148eba,_0x9e23('0x2d'));_0x8187f9[_0x9e23('0x36')]=_[_0x9e23('0x37')](_0x48af7d[_0x9e23('0x36')]);_0x8187f9[_0x9e23('0x38')]=_['intersection'](_0x8187f9['model'],_0x8187f9[_0x9e23('0x36')]);_0x424c3b[_0x9e23('0x39')]=_[_0x9e23('0x3a')](_0x8187f9['model'],qs[_0x9e23('0x3b')](_0x48af7d[_0x9e23('0x36')][_0x9e23('0x3b')]));_0x424c3b[_0x9e23('0x39')]=_0x424c3b[_0x9e23('0x39')]['length']?_0x424c3b[_0x9e23('0x39')]:_0x8187f9[_0x9e23('0x35')];if(!_0x48af7d[_0x9e23('0x36')][_0x9e23('0x3c')]('nolimit')){_0x424c3b[_0x9e23('0x23')]=qs[_0x9e23('0x23')](_0x48af7d[_0x9e23('0x36')][_0x9e23('0x23')]);_0x424c3b[_0x9e23('0x22')]=qs[_0x9e23('0x22')](_0x48af7d[_0x9e23('0x36')][_0x9e23('0x22')]);}_0x424c3b[_0x9e23('0x3d')]=qs[_0x9e23('0x3e')](_0x48af7d['query'][_0x9e23('0x3e')]);_0x424c3b[_0x9e23('0x3f')]=qs[_0x9e23('0x38')](_[_0x9e23('0x40')](_0x48af7d['query'],_0x8187f9[_0x9e23('0x38')]),_0x148eba);if(_0x48af7d[_0x9e23('0x36')]['filter']){_0x424c3b[_0x9e23('0x3f')]=_[_0x9e23('0x41')](_0x424c3b['where'],{'$or':_[_0x9e23('0x30')](_0x148eba,function(_0x4e6e2b){if(_0x4e6e2b[_0x9e23('0x33')]!==_0x9e23('0x42')){var _0x178778={};_0x178778[_0x4e6e2b[_0x9e23('0x2d')]]={'$like':'%'+_0x48af7d[_0x9e23('0x36')][_0x9e23('0x43')]+'%'};return _0x178778;}})});}_0x424c3b=_[_0x9e23('0x41')]({},_0x424c3b,_0x48af7d[_0x9e23('0x44')]);var _0x338d12={'where':_0x424c3b[_0x9e23('0x3f')]};return db[_0x9e23('0x31')]['count'](_0x338d12)[_0x9e23('0x2a')](function(_0x1e14b4){_0x178ad3[_0x9e23('0x45')]=_0x1e14b4;if(_0x48af7d['query']['includeAll']){_0x424c3b[_0x9e23('0x46')]=[{'all':!![]}];}return db[_0x9e23('0x31')][_0x9e23('0x47')](_0x424c3b);})[_0x9e23('0x2a')](function(_0x2f5ff1){_0x178ad3[_0x9e23('0x48')]=_0x2f5ff1;return _0x178ad3;})[_0x9e23('0x2a')](respondWithFilteredResult(_0x1e63b0,_0x424c3b))[_0x9e23('0x1e')](handleError(_0x1e63b0,null));};exports['show']=function(_0x477cf5,_0x50c501){var _0x18513e={'raw':![],'where':{'id':_0x477cf5[_0x9e23('0x49')]['id']}},_0x47859a={};_0x47859a[_0x9e23('0x35')]=_[_0x9e23('0x37')](db[_0x9e23('0x31')][_0x9e23('0x4a')]);_0x47859a[_0x9e23('0x36')]=_['keys'](_0x477cf5[_0x9e23('0x36')]);_0x47859a[_0x9e23('0x38')]=_[_0x9e23('0x3a')](_0x47859a[_0x9e23('0x35')],_0x47859a[_0x9e23('0x36')]);_0x18513e[_0x9e23('0x39')]=_[_0x9e23('0x3a')](_0x47859a['model'],qs[_0x9e23('0x3b')](_0x477cf5[_0x9e23('0x36')][_0x9e23('0x3b')]));_0x18513e[_0x9e23('0x39')]=_0x18513e[_0x9e23('0x39')]['length']?_0x18513e[_0x9e23('0x39')]:_0x47859a[_0x9e23('0x35')];if(_0x477cf5[_0x9e23('0x36')]['includeAll']){_0x18513e[_0x9e23('0x46')]=[{'all':!![]}];}_0x18513e=_[_0x9e23('0x41')]({},_0x18513e,_0x477cf5[_0x9e23('0x44')]);return db[_0x9e23('0x31')]['find'](_0x18513e)[_0x9e23('0x2a')](handleEntityNotFound(_0x50c501,null))[_0x9e23('0x2a')](respondWithResult(_0x50c501,null))[_0x9e23('0x1e')](handleError(_0x50c501,null));};exports[_0x9e23('0x4b')]=function(_0xc3a56e,_0x4bd0b8){return db[_0x9e23('0x31')]['create'](_0xc3a56e[_0x9e23('0x4c')],{})[_0x9e23('0x2a')](respondWithResult(_0x4bd0b8,0xc9))['catch'](handleError(_0x4bd0b8,null));};exports['update']=function(_0x589f82,_0x5289ec){if(_0x589f82['body']['id']){delete _0x589f82[_0x9e23('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0x9e23('0x4d')]({'where':{'id':_0x589f82[_0x9e23('0x49')]['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x5289ec,null))[_0x9e23('0x2a')](saveUpdates(_0x589f82[_0x9e23('0x4c')],null))[_0x9e23('0x2a')](respondWithResult(_0x5289ec,null))[_0x9e23('0x1e')](handleError(_0x5289ec,null));};exports[_0x9e23('0x2b')]=function(_0xc2d187,_0x540449){return db[_0x9e23('0x31')][_0x9e23('0x4d')]({'where':{'id':_0xc2d187[_0x9e23('0x49')]['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x540449,null))['then'](removeEntity(_0x540449,null))[_0x9e23('0x1e')](handleError(_0x540449,null));};exports['getFields']=function(_0x559e7c,_0x80ae95,_0x596b9c){var _0x13968e={};var _0x1e3052={};var _0x53e3c1;var _0x3e8c1e;return db[_0x9e23('0x31')][_0x9e23('0x4e')]({'where':{'id':_0x559e7c[_0x9e23('0x49')]['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x80ae95,null))[_0x9e23('0x2a')](function(_0x37458e){if(_0x37458e){_0x53e3c1=_0x37458e;_0x1e3052['model']=_[_0x9e23('0x37')](db[_0x9e23('0x4f')][_0x9e23('0x4a')]);_0x1e3052['query']=_[_0x9e23('0x37')](_0x559e7c[_0x9e23('0x36')]);_0x1e3052[_0x9e23('0x38')]=_['intersection'](_0x1e3052[_0x9e23('0x35')],_0x1e3052['query']);_0x13968e['attributes']=_[_0x9e23('0x3a')](_0x1e3052[_0x9e23('0x35')],qs[_0x9e23('0x3b')](_0x559e7c[_0x9e23('0x36')][_0x9e23('0x3b')]));_0x13968e[_0x9e23('0x39')]=_0x13968e[_0x9e23('0x39')][_0x9e23('0x50')]?_0x13968e[_0x9e23('0x39')]:_0x1e3052[_0x9e23('0x35')];_0x13968e[_0x9e23('0x3d')]=qs[_0x9e23('0x3e')](_0x559e7c['query'][_0x9e23('0x3e')]);_0x13968e[_0x9e23('0x3f')]=qs['filters'](_['pick'](_0x559e7c['query'],_0x1e3052[_0x9e23('0x38')]));if(_0x559e7c[_0x9e23('0x36')]['filter']){_0x13968e[_0x9e23('0x3f')]=_[_0x9e23('0x41')](_0x13968e[_0x9e23('0x3f')],{'$or':_[_0x9e23('0x30')](_0x13968e[_0x9e23('0x39')],function(_0x49b872){var _0x546755={};_0x546755[_0x49b872]={'$like':'%'+_0x559e7c[_0x9e23('0x36')]['filter']+'%'};return _0x546755;})});}_0x13968e=_[_0x9e23('0x41')]({},_0x13968e,_0x559e7c[_0x9e23('0x44')]);return _0x53e3c1[_0x9e23('0x51')](_0x13968e);}})[_0x9e23('0x2a')](function(_0x10aa7a){if(_0x10aa7a){_0x3e8c1e=_0x10aa7a['length'];if(!_0x559e7c[_0x9e23('0x36')][_0x9e23('0x3c')](_0x9e23('0x52'))){_0x13968e[_0x9e23('0x23')]=qs[_0x9e23('0x23')](_0x559e7c[_0x9e23('0x36')]['limit']);_0x13968e['offset']=qs['offset'](_0x559e7c['query']['offset']);}return _0x53e3c1['getFields'](_0x13968e);}})[_0x9e23('0x2a')](function(_0x219942){if(_0x219942){return _0x219942?{'count':_0x3e8c1e,'rows':_0x219942}:null;}})[_0x9e23('0x2a')](respondWithResult(_0x80ae95,null))[_0x9e23('0x1e')](handleError(_0x80ae95,null));};exports[_0x9e23('0x53')]=function(_0x4bcf9b,_0x44f1b7,_0x4018e8){var _0x23b752={};var _0x7d2c81={};var _0x1ffccb;var _0x131f9f;return db[_0x9e23('0x31')][_0x9e23('0x4e')]({'where':{'id':_0x4bcf9b['params']['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x44f1b7,null))['then'](function(_0x2762df){if(_0x2762df){_0x1ffccb=_0x2762df;_0x7d2c81['model']=_[_0x9e23('0x37')](db[_0x9e23('0x4f')][_0x9e23('0x4a')]);_0x7d2c81['query']=_[_0x9e23('0x37')](_0x4bcf9b['query']);_0x7d2c81[_0x9e23('0x38')]=_['intersection'](_0x7d2c81[_0x9e23('0x35')],_0x7d2c81['query']);_0x23b752[_0x9e23('0x39')]=_['intersection'](_0x7d2c81[_0x9e23('0x35')],qs[_0x9e23('0x3b')](_0x4bcf9b['query'][_0x9e23('0x3b')]));_0x23b752[_0x9e23('0x39')]=_0x23b752[_0x9e23('0x39')][_0x9e23('0x50')]?_0x23b752[_0x9e23('0x39')]:_0x7d2c81[_0x9e23('0x35')];_0x23b752[_0x9e23('0x3d')]=qs[_0x9e23('0x3e')](_0x4bcf9b['query'][_0x9e23('0x3e')]);_0x23b752['where']=qs[_0x9e23('0x38')](_[_0x9e23('0x40')](_0x4bcf9b['query'],_0x7d2c81[_0x9e23('0x38')]));if(_0x4bcf9b[_0x9e23('0x36')]['filter']){_0x23b752[_0x9e23('0x3f')]=_[_0x9e23('0x41')](_0x23b752[_0x9e23('0x3f')],{'$or':_['map'](_0x23b752['attributes'],function(_0x9cc683){var _0x39ed4a={};_0x39ed4a[_0x9cc683]={'$like':'%'+_0x4bcf9b[_0x9e23('0x36')][_0x9e23('0x43')]+'%'};return _0x39ed4a;})});}_0x23b752=_[_0x9e23('0x41')]({},_0x23b752,_0x4bcf9b[_0x9e23('0x44')]);return _0x1ffccb[_0x9e23('0x53')](_0x23b752);}})[_0x9e23('0x2a')](function(_0x27eb94){if(_0x27eb94){_0x131f9f=_0x27eb94[_0x9e23('0x50')];if(!_0x4bcf9b[_0x9e23('0x36')]['hasOwnProperty'](_0x9e23('0x52'))){_0x23b752[_0x9e23('0x23')]=qs[_0x9e23('0x23')](_0x4bcf9b[_0x9e23('0x36')][_0x9e23('0x23')]);_0x23b752[_0x9e23('0x22')]=qs[_0x9e23('0x22')](_0x4bcf9b[_0x9e23('0x36')][_0x9e23('0x22')]);}return _0x1ffccb[_0x9e23('0x53')](_0x23b752);}})[_0x9e23('0x2a')](function(_0x3b0620){if(_0x3b0620){return _0x3b0620?{'count':_0x131f9f,'rows':_0x3b0620}:null;}})['then'](respondWithResult(_0x44f1b7,null))[_0x9e23('0x1e')](handleError(_0x44f1b7,null));};exports[_0x9e23('0x54')]=function(_0x112000,_0x5d917b,_0x270c6f){var _0x412e66={};var _0x5110af={};var _0x31368a;var _0x3eeb83;return db[_0x9e23('0x31')][_0x9e23('0x4e')]({'where':{'id':_0x112000[_0x9e23('0x49')]['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x5d917b,null))[_0x9e23('0x2a')](function(_0x2739b1){if(_0x2739b1){_0x31368a=_0x2739b1;_0x5110af[_0x9e23('0x35')]=_['keys'](db[_0x9e23('0x4f')]['rawAttributes']);_0x5110af[_0x9e23('0x36')]=_['keys'](_0x112000[_0x9e23('0x36')]);_0x5110af['filters']=_[_0x9e23('0x3a')](_0x5110af[_0x9e23('0x35')],_0x5110af[_0x9e23('0x36')]);_0x412e66[_0x9e23('0x39')]=_[_0x9e23('0x3a')](_0x5110af['model'],qs['fields'](_0x112000[_0x9e23('0x36')][_0x9e23('0x3b')]));_0x412e66[_0x9e23('0x39')]=_0x412e66['attributes'][_0x9e23('0x50')]?_0x412e66['attributes']:_0x5110af[_0x9e23('0x35')];_0x412e66['order']=qs[_0x9e23('0x3e')](_0x112000[_0x9e23('0x36')]['sort']);_0x412e66[_0x9e23('0x3f')]=qs[_0x9e23('0x38')](_[_0x9e23('0x40')](_0x112000[_0x9e23('0x36')],_0x5110af[_0x9e23('0x38')]));if(_0x112000[_0x9e23('0x36')][_0x9e23('0x43')]){_0x412e66['where']=_['merge'](_0x412e66[_0x9e23('0x3f')],{'$or':_[_0x9e23('0x30')](_0x412e66['attributes'],function(_0x3b5b59){var _0xddaefa={};_0xddaefa[_0x3b5b59]={'$like':'%'+_0x112000[_0x9e23('0x36')][_0x9e23('0x43')]+'%'};return _0xddaefa;})});}_0x412e66=_[_0x9e23('0x41')]({},_0x412e66,_0x112000[_0x9e23('0x44')]);return _0x31368a[_0x9e23('0x54')](_0x412e66);}})['then'](function(_0x18f014){if(_0x18f014){_0x3eeb83=_0x18f014[_0x9e23('0x50')];if(!_0x112000[_0x9e23('0x36')][_0x9e23('0x3c')]('nolimit')){_0x412e66[_0x9e23('0x23')]=qs[_0x9e23('0x23')](_0x112000[_0x9e23('0x36')][_0x9e23('0x23')]);_0x412e66[_0x9e23('0x22')]=qs['offset'](_0x112000[_0x9e23('0x36')][_0x9e23('0x22')]);}return _0x31368a[_0x9e23('0x54')](_0x412e66);}})[_0x9e23('0x2a')](function(_0x3aa1b6){if(_0x3aa1b6){return _0x3aa1b6?{'count':_0x3eeb83,'rows':_0x3aa1b6}:null;}})[_0x9e23('0x2a')](respondWithResult(_0x5d917b,null))[_0x9e23('0x1e')](handleError(_0x5d917b,null));};exports[_0x9e23('0x55')]=function(_0x4bd3a0,_0x51578a,_0x3463a1){var _0x5b7d07={};var _0x196c13={};var _0x36251c;var _0x5edc69;return db[_0x9e23('0x31')][_0x9e23('0x4e')]({'where':{'id':_0x4bd3a0['params']['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x51578a,null))[_0x9e23('0x2a')](function(_0x411605){if(_0x411605){_0x36251c=_0x411605;_0x196c13[_0x9e23('0x35')]=_[_0x9e23('0x37')](db[_0x9e23('0x56')][_0x9e23('0x4a')]);_0x196c13[_0x9e23('0x36')]=_[_0x9e23('0x37')](_0x4bd3a0[_0x9e23('0x36')]);_0x196c13[_0x9e23('0x38')]=_[_0x9e23('0x3a')](_0x196c13[_0x9e23('0x35')],_0x196c13[_0x9e23('0x36')]);_0x5b7d07['attributes']=_[_0x9e23('0x3a')](_0x196c13[_0x9e23('0x35')],qs[_0x9e23('0x3b')](_0x4bd3a0[_0x9e23('0x36')]['fields']));_0x5b7d07[_0x9e23('0x39')]=_0x5b7d07[_0x9e23('0x39')][_0x9e23('0x50')]?_0x5b7d07[_0x9e23('0x39')]:_0x196c13[_0x9e23('0x35')];_0x5b7d07[_0x9e23('0x3d')]=qs[_0x9e23('0x3e')](_0x4bd3a0[_0x9e23('0x36')][_0x9e23('0x3e')]);_0x5b7d07[_0x9e23('0x3f')]=qs[_0x9e23('0x38')](_['pick'](_0x4bd3a0['query'],_0x196c13[_0x9e23('0x38')]));if(_0x4bd3a0[_0x9e23('0x36')][_0x9e23('0x43')]){_0x5b7d07[_0x9e23('0x3f')]=_['merge'](_0x5b7d07[_0x9e23('0x3f')],{'$or':_[_0x9e23('0x30')](_0x5b7d07[_0x9e23('0x39')],function(_0x162fee){var _0x3f5849={};_0x3f5849[_0x162fee]={'$like':'%'+_0x4bd3a0[_0x9e23('0x36')]['filter']+'%'};return _0x3f5849;})});}_0x5b7d07=_[_0x9e23('0x41')]({},_0x5b7d07,_0x4bd3a0[_0x9e23('0x44')]);return _0x36251c[_0x9e23('0x55')](_0x5b7d07);}})[_0x9e23('0x2a')](function(_0xe818b3){if(_0xe818b3){_0x5edc69=_0xe818b3[_0x9e23('0x50')];if(!_0x4bd3a0[_0x9e23('0x36')][_0x9e23('0x3c')](_0x9e23('0x52'))){_0x5b7d07['limit']=qs['limit'](_0x4bd3a0[_0x9e23('0x36')][_0x9e23('0x23')]);_0x5b7d07[_0x9e23('0x22')]=qs[_0x9e23('0x22')](_0x4bd3a0[_0x9e23('0x36')][_0x9e23('0x22')]);}return _0x36251c[_0x9e23('0x55')](_0x5b7d07);}})[_0x9e23('0x2a')](function(_0x3e4bea){if(_0x3e4bea){return _0x3e4bea?{'count':_0x5edc69,'rows':_0x3e4bea}:null;}})[_0x9e23('0x2a')](respondWithResult(_0x51578a,null))['catch'](handleError(_0x51578a,null));};exports[_0x9e23('0x57')]=function(_0x31865a,_0x6de67b,_0x4e6b6a){if(_0x31865a['body']['id']){delete _0x31865a['body']['id'];}return db['FreshdeskConfiguration'][_0x9e23('0x4e')]({'where':{'id':_0x31865a[_0x9e23('0x49')]['id']}})[_0x9e23('0x2a')](handleEntityNotFound(_0x6de67b,null))[_0x9e23('0x2a')](function(_0x31dce6){if(_0x31dce6){return _0x31dce6[_0x9e23('0x57')](_0x31865a[_0x9e23('0x4c')][_0x9e23('0x58')]||[]);}return null;})[_0x9e23('0x2a')](respondWithResult(_0x6de67b,null))[_0x9e23('0x1e')](handleError(_0x6de67b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 64bda06..a3a9bde 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 _0x7f5a=['moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash','util','../../config/logger','api'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0x7f5a,0x172));var _0xa7f5=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x7f5a[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xa7f5('0x0'));var util=require(_0xa7f5('0x1'));var logger=require(_0xa7f5('0x2'))(_0xa7f5('0x3'));var moment=require(_0xa7f5('0x4'));var BPromise=require(_0xa7f5('0x5'));var rp=require(_0xa7f5('0x6'));var fs=require('fs');var path=require(_0xa7f5('0x7'));var rimraf=require('rimraf');var config=require(_0xa7f5('0x8'));var attributes=require(_0xa7f5('0x9'));module['exports']=function(_0x38c5ea,_0x4507b2){return _0x38c5ea['define']('FreshdeskConfiguration',attributes,{'tableName':_0xa7f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeea2=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ee381,_0x59685a){var _0x4a30c4=function(_0xfb84b5){while(--_0xfb84b5){_0x2ee381['push'](_0x2ee381['shift']());}};_0x4a30c4(++_0x59685a);}(_0xeea2,0xd8));var _0x2eea=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xeea2[_0x176329];return _0x31997c;};'use strict';var _=require(_0x2eea('0x0'));var util=require(_0x2eea('0x1'));var logger=require(_0x2eea('0x2'))('api');var moment=require(_0x2eea('0x3'));var BPromise=require(_0x2eea('0x4'));var rp=require(_0x2eea('0x5'));var fs=require('fs');var path=require(_0x2eea('0x6'));var rimraf=require(_0x2eea('0x7'));var config=require(_0x2eea('0x8'));var attributes=require(_0x2eea('0x9'));module[_0x2eea('0xa')]=function(_0x4e0234,_0x8a937a){return _0x4e0234[_0x2eea('0xb')](_0x2eea('0xc'),attributes,{'tableName':_0x2eea('0xd'),'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 65901a7..1891033 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 _0x44e2=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44e2,0x140));var _0x244e=function(_0x4cf53a,_0x1a943f){_0x4cf53a=_0x4cf53a-0x0;var _0x49746f=_0x44e2[_0x4cf53a];return _0x49746f;};'use strict';var _=require(_0x244e('0x0'));var util=require('util');var moment=require(_0x244e('0x1'));var BPromise=require('bluebird');var rs=require(_0x244e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x244e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x244e('0x4'));var config=require(_0x244e('0x5'));var jayson=require(_0x244e('0x6'));var client=jayson[_0x244e('0x7')][_0x244e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cfdec,_0xbd8776,_0x3324c8){return new BPromise(function(_0x5c4d1c,_0x39507e){return client[_0x244e('0x9')](_0x4cfdec,_0x3324c8)['then'](function(_0x3f22a5){logger[_0x244e('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xbd8776,'request\x20sent');logger['debug'](_0x244e('0xb'),_0xbd8776,_0x244e('0xc'),JSON['stringify'](_0x3f22a5));if(_0x3f22a5[_0x244e('0xd')]){if(_0x3f22a5[_0x244e('0xd')][_0x244e('0xe')]===0x1f4){logger[_0x244e('0xd')](_0x244e('0xf'),_0xbd8776,_0x3f22a5[_0x244e('0xd')][_0x244e('0x10')]);return _0x39507e(_0x3f22a5['error'][_0x244e('0x10')]);}logger['error'](_0x244e('0xf'),_0xbd8776,_0x3f22a5[_0x244e('0xd')]['message']);return _0x5c4d1c(_0x3f22a5[_0x244e('0xd')]['message']);}else{logger[_0x244e('0xa')](_0x244e('0xf'),_0xbd8776,_0x244e('0xc'));_0x5c4d1c(_0x3f22a5[_0x244e('0x11')][_0x244e('0x10')]);}})[_0x244e('0x12')](function(_0x3ee7ed){logger[_0x244e('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xbd8776,_0x3ee7ed);_0x39507e(_0x3ee7ed);});});} \ No newline at end of file +var _0x0321=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x29a56c,_0x1b8a1b){var _0xe23934=function(_0x55df1f){while(--_0x55df1f){_0x29a56c['push'](_0x29a56c['shift']());}};_0xe23934(++_0x1b8a1b);}(_0x0321,0xf2));var _0x1032=function(_0x539076,_0x527ecd){_0x539076=_0x539076-0x0;var _0x2750a1=_0x0321[_0x539076];return _0x2750a1;};'use strict';var _=require(_0x1032('0x0'));var util=require(_0x1032('0x1'));var moment=require(_0x1032('0x2'));var BPromise=require(_0x1032('0x3'));var rs=require(_0x1032('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1032('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1032('0x6'))(_0x1032('0x7'));var config=require(_0x1032('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1032('0x9')][_0x1032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x521c8e,_0x4df754,_0x58130d){return new BPromise(function(_0x430b49,_0x1a1b3f){return client['request'](_0x521c8e,_0x58130d)['then'](function(_0x16e897){logger[_0x1032('0xb')](_0x1032('0xc'),_0x4df754,'request\x20sent');logger[_0x1032('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4df754,_0x1032('0xe'),JSON[_0x1032('0xf')](_0x16e897));if(_0x16e897['error']){if(_0x16e897[_0x1032('0x10')]['code']===0x1f4){logger[_0x1032('0x10')](_0x1032('0xc'),_0x4df754,_0x16e897[_0x1032('0x10')][_0x1032('0x11')]);return _0x1a1b3f(_0x16e897['error'][_0x1032('0x11')]);}logger[_0x1032('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4df754,_0x16e897[_0x1032('0x10')]['message']);return _0x430b49(_0x16e897['error'][_0x1032('0x11')]);}else{logger[_0x1032('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4df754,_0x1032('0xe'));_0x430b49(_0x16e897[_0x1032('0x12')][_0x1032('0x11')]);}})[_0x1032('0x13')](function(_0x2b51eb){logger[_0x1032('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4df754,_0x2b51eb);_0x1a1b3f(_0x2b51eb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3c9d153..09159d4 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0xcb91[_0x19e928];return _0x4e941f;};'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('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x4aa49a,_0x827ae9){var _0x1cb115=function(_0x42c8f3){while(--_0x42c8f3){_0x4aa49a['push'](_0x4aa49a['shift']());}};_0x1cb115(++_0x827ae9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 39e0a04..f8dcb19 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 _0x3a32=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3a726e,_0x1e6ff1){var _0x1fa716=function(_0x5db112){while(--_0x5db112){_0x3a726e['push'](_0x3a726e['shift']());}};_0x1fa716(++_0x1e6ff1);}(_0x3a32,0x9b));var _0x23a3=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x3a32[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x23a3('0x0'));module[_0x23a3('0x1')]={'type':{'type':Sequelize[_0x23a3('0x2')](_0x23a3('0x3'),_0x23a3('0x4'),_0x23a3('0x5'),_0x23a3('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x23a3('0x7')]},'keyType':{'type':Sequelize[_0x23a3('0x2')]('string',_0x23a3('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x23a3('0x7')]},'idField':{'type':Sequelize[_0x23a3('0x7')]},'nameField':{'type':Sequelize[_0x23a3('0x7')]},'customField':{'type':Sequelize[_0x23a3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x23a3('0x7')]}}; \ No newline at end of file +var _0x8d37=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8d37,0xbc));var _0x78d3=function(_0x547aaa,_0x1e4ca0){_0x547aaa=_0x547aaa-0x0;var _0x49168e=_0x8d37[_0x547aaa];return _0x49168e;};'use strict';var Sequelize=require(_0x78d3('0x0'));module['exports']={'type':{'type':Sequelize[_0x78d3('0x1')](_0x78d3('0x2'),_0x78d3('0x3'),_0x78d3('0x4'),_0x78d3('0x5')),'defaultValue':_0x78d3('0x2')},'content':{'type':Sequelize[_0x78d3('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x78d3('0x1')](_0x78d3('0x2'),'variable',_0x78d3('0x4'))},'keyContent':{'type':Sequelize[_0x78d3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x78d3('0x6')]},'customField':{'type':Sequelize[_0x78d3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78d3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e24ccdb..00018bc 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 _0x0c3f=['count','offset','reject','update','error','stack','name','index','map','FreshdeskField','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x37de82,_0x4b39cf){var _0xda12d7=function(_0x2ab299){while(--_0x2ab299){_0x37de82['push'](_0x37de82['shift']());}};_0xda12d7(++_0x4b39cf);}(_0x0c3f,0xb3));var _0xf0c3=function(_0x376af6,_0x2d75d2){_0x376af6=_0x376af6-0x0;var _0x34108c=_0x0c3f[_0x376af6];return _0x34108c;};'use strict';var pdf=require(_0xf0c3('0x0'));var emlformat=require(_0xf0c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf0c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0c3('0x3'));var moment=require(_0xf0c3('0x4'));var BPromise=require(_0xf0c3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf0c3('0x6'));var csv=require(_0xf0c3('0x7'));var ejs=require(_0xf0c3('0x8'));var fs=require('fs');var _=require(_0xf0c3('0x9'));var squel=require(_0xf0c3('0xa'));var crypto=require(_0xf0c3('0xb'));var jsforce=require(_0xf0c3('0xc'));var deskjs=require(_0xf0c3('0xd'));var toCsv=require(_0xf0c3('0x7'));var querystring=require('querystring');var Papa=require(_0xf0c3('0xe'));var Redis=require(_0xf0c3('0xf'));var authService=require(_0xf0c3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf0c3('0x11'));var hardwareService=require(_0xf0c3('0x12'));var logger=require(_0xf0c3('0x13'))(_0xf0c3('0x14'));var utils=require(_0xf0c3('0x15'));var config=require(_0xf0c3('0x16'));var licenseUtil=require(_0xf0c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230795,_0x2c3e9d){_0x2c3e9d=_0x2c3e9d||0xcc;return function(_0x4ee3a6){if(_0x4ee3a6){return _0x230795[_0xf0c3('0x18')](_0x2c3e9d);}return _0x230795[_0xf0c3('0x19')](_0x2c3e9d)[_0xf0c3('0x1a')]();};}function respondWithResult(_0x40b27e,_0x2d6f4b){_0x2d6f4b=_0x2d6f4b||0xc8;return function(_0x2fdcab){if(_0x2fdcab){return _0x40b27e[_0xf0c3('0x19')](_0x2d6f4b)[_0xf0c3('0x1b')](_0x2fdcab);}};}function respondWithFilteredResult(_0x543abb,_0x41d3a5){return function(_0xb3781a){if(_0xb3781a){var _0x21538f=_0xb3781a[_0xf0c3('0x1c')],_0x2647e8=_0x41d3a5[_0xf0c3('0x1d')],_0x1a1c18=_0x41d3a5['offset']+_0x41d3a5['limit'],_0x261b0d;if(_0x1a1c18>=_0x21538f){_0x1a1c18=_0x21538f;_0x261b0d=0xc8;}else{_0x261b0d=0xce;}_0x543abb[_0xf0c3('0x19')](_0x261b0d);return _0x543abb['set']('Content-Range',_0x2647e8+'-'+_0x1a1c18+'/'+_0x21538f)[_0xf0c3('0x1b')](_0xb3781a);}return null;};}function patchUpdates(_0x51c66f){return function(_0x11088e){try{jsonpatch['apply'](_0x11088e,_0x51c66f,!![]);}catch(_0x3a0f2c){return BPromise[_0xf0c3('0x1e')](_0x3a0f2c);}return _0x11088e['save']();};}function saveUpdates(_0x4cddd8,_0x541405){return function(_0x15e5b9){if(_0x15e5b9){return _0x15e5b9[_0xf0c3('0x1f')](_0x4cddd8)['then'](function(_0xeb7767){return _0xeb7767;});}return null;};}function removeEntity(_0x12d2e8,_0x28b185){return function(_0x4d6062){if(_0x4d6062){return _0x4d6062['destroy']()['then'](function(){_0x12d2e8[_0xf0c3('0x19')](0xcc)[_0xf0c3('0x1a')]();});}};}function handleEntityNotFound(_0x2af1ff,_0x2ed822){return function(_0xfef90){if(!_0xfef90){_0x2af1ff[_0xf0c3('0x18')](0x194);}return _0xfef90;};}function handleError(_0x532e21,_0x251420){_0x251420=_0x251420||0x1f4;return function(_0x646b){logger[_0xf0c3('0x20')](_0x646b[_0xf0c3('0x21')]);if(_0x646b['name']){delete _0x646b[_0xf0c3('0x22')];}_0x532e21[_0xf0c3('0x19')](_0x251420)['send'](_0x646b);};}exports[_0xf0c3('0x23')]=function(_0x40e04e,_0x554daa){var _0x42ce18={},_0x4a73ab={},_0x5b27a0={'count':0x0,'rows':[]};var _0x307afa=_[_0xf0c3('0x24')](db[_0xf0c3('0x25')][_0xf0c3('0x26')],function(_0x4ac67c){return{'name':_0x4ac67c['fieldName'],'type':_0x4ac67c['type'][_0xf0c3('0x27')]};});_0x4a73ab[_0xf0c3('0x28')]=_[_0xf0c3('0x24')](_0x307afa,'name');_0x4a73ab[_0xf0c3('0x29')]=_['keys'](_0x40e04e[_0xf0c3('0x29')]);_0x4a73ab['filters']=_[_0xf0c3('0x2a')](_0x4a73ab[_0xf0c3('0x28')],_0x4a73ab['query']);_0x42ce18[_0xf0c3('0x2b')]=_[_0xf0c3('0x2a')](_0x4a73ab[_0xf0c3('0x28')],qs['fields'](_0x40e04e[_0xf0c3('0x29')][_0xf0c3('0x2c')]));_0x42ce18['attributes']=_0x42ce18[_0xf0c3('0x2b')][_0xf0c3('0x2d')]?_0x42ce18[_0xf0c3('0x2b')]:_0x4a73ab[_0xf0c3('0x28')];if(!_0x40e04e[_0xf0c3('0x29')][_0xf0c3('0x2e')](_0xf0c3('0x2f'))){_0x42ce18[_0xf0c3('0x30')]=qs['limit'](_0x40e04e[_0xf0c3('0x29')][_0xf0c3('0x30')]);_0x42ce18['offset']=qs[_0xf0c3('0x1d')](_0x40e04e[_0xf0c3('0x29')][_0xf0c3('0x1d')]);}_0x42ce18[_0xf0c3('0x31')]=qs[_0xf0c3('0x32')](_0x40e04e[_0xf0c3('0x29')][_0xf0c3('0x32')]);_0x42ce18[_0xf0c3('0x33')]=qs[_0xf0c3('0x34')](_[_0xf0c3('0x35')](_0x40e04e[_0xf0c3('0x29')],_0x4a73ab[_0xf0c3('0x34')]),_0x307afa);if(_0x40e04e['query'][_0xf0c3('0x36')]){_0x42ce18[_0xf0c3('0x33')]=_['merge'](_0x42ce18[_0xf0c3('0x33')],{'$or':_['map'](_0x307afa,function(_0x18e201){if(_0x18e201['type']!=='VIRTUAL'){var _0x20d0af={};_0x20d0af[_0x18e201[_0xf0c3('0x22')]]={'$like':'%'+_0x40e04e['query']['filter']+'%'};return _0x20d0af;}})});}_0x42ce18=_[_0xf0c3('0x37')]({},_0x42ce18,_0x40e04e[_0xf0c3('0x38')]);var _0x2b0e10={'where':_0x42ce18[_0xf0c3('0x33')]};return db[_0xf0c3('0x25')][_0xf0c3('0x1c')](_0x2b0e10)[_0xf0c3('0x39')](function(_0x1dc7fa){_0x5b27a0[_0xf0c3('0x1c')]=_0x1dc7fa;if(_0x40e04e[_0xf0c3('0x29')][_0xf0c3('0x3a')]){_0x42ce18[_0xf0c3('0x3b')]=[{'all':!![]}];}return db[_0xf0c3('0x25')][_0xf0c3('0x3c')](_0x42ce18);})[_0xf0c3('0x39')](function(_0x5b0779){_0x5b27a0[_0xf0c3('0x3d')]=_0x5b0779;return _0x5b27a0;})[_0xf0c3('0x39')](respondWithFilteredResult(_0x554daa,_0x42ce18))[_0xf0c3('0x3e')](handleError(_0x554daa,null));};exports['show']=function(_0x51ba38,_0xc9bd5a){var _0x4b29d0={'raw':!![],'where':{'id':_0x51ba38[_0xf0c3('0x3f')]['id']}},_0x4d9187={};_0x4d9187[_0xf0c3('0x28')]=_[_0xf0c3('0x40')](db[_0xf0c3('0x25')][_0xf0c3('0x26')]);_0x4d9187[_0xf0c3('0x29')]=_['keys'](_0x51ba38['query']);_0x4d9187[_0xf0c3('0x34')]=_[_0xf0c3('0x2a')](_0x4d9187[_0xf0c3('0x28')],_0x4d9187['query']);_0x4b29d0[_0xf0c3('0x2b')]=_[_0xf0c3('0x2a')](_0x4d9187[_0xf0c3('0x28')],qs[_0xf0c3('0x2c')](_0x51ba38[_0xf0c3('0x29')][_0xf0c3('0x2c')]));_0x4b29d0[_0xf0c3('0x2b')]=_0x4b29d0[_0xf0c3('0x2b')][_0xf0c3('0x2d')]?_0x4b29d0['attributes']:_0x4d9187['model'];if(_0x51ba38['query']['includeAll']){_0x4b29d0[_0xf0c3('0x3b')]=[{'all':!![]}];}_0x4b29d0=_[_0xf0c3('0x37')]({},_0x4b29d0,_0x51ba38[_0xf0c3('0x38')]);return db['FreshdeskField'][_0xf0c3('0x41')](_0x4b29d0)['then'](handleEntityNotFound(_0xc9bd5a,null))[_0xf0c3('0x39')](respondWithResult(_0xc9bd5a,null))[_0xf0c3('0x3e')](handleError(_0xc9bd5a,null));};exports[_0xf0c3('0x42')]=function(_0x528906,_0x47885e){return db[_0xf0c3('0x25')][_0xf0c3('0x42')](_0x528906['body'],{})[_0xf0c3('0x39')](respondWithResult(_0x47885e,0xc9))[_0xf0c3('0x3e')](handleError(_0x47885e,null));};exports[_0xf0c3('0x1f')]=function(_0x595c8c,_0x290e35){if(_0x595c8c[_0xf0c3('0x43')]['id']){delete _0x595c8c[_0xf0c3('0x43')]['id'];}return db[_0xf0c3('0x25')]['find']({'where':{'id':_0x595c8c[_0xf0c3('0x3f')]['id']}})[_0xf0c3('0x39')](handleEntityNotFound(_0x290e35,null))[_0xf0c3('0x39')](saveUpdates(_0x595c8c[_0xf0c3('0x43')],null))['then'](respondWithResult(_0x290e35,null))[_0xf0c3('0x3e')](handleError(_0x290e35,null));};exports[_0xf0c3('0x44')]=function(_0x4a2e0d,_0x36f638){return db[_0xf0c3('0x25')]['find']({'where':{'id':_0x4a2e0d[_0xf0c3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36f638,null))[_0xf0c3('0x39')](removeEntity(_0x36f638,null))[_0xf0c3('0x3e')](handleError(_0x36f638,null));}; \ No newline at end of file +var _0xf6b3=['find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','create','body'];(function(_0x4443a4,_0x893fdb){var _0x53fa35=function(_0x521f6c){while(--_0x521f6c){_0x4443a4['push'](_0x4443a4['shift']());}};_0x53fa35(++_0x893fdb);}(_0xf6b3,0x97));var _0x3f6b=function(_0x520138,_0x28b48e){_0x520138=_0x520138-0x0;var _0x46b0bf=_0xf6b3[_0x520138];return _0x46b0bf;};'use strict';var pdf=require(_0x3f6b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f6b('0x1'));var zipdir=require(_0x3f6b('0x2'));var jsonpatch=require(_0x3f6b('0x3'));var rp=require(_0x3f6b('0x4'));var moment=require(_0x3f6b('0x5'));var BPromise=require(_0x3f6b('0x6'));var Mustache=require('mustache');var util=require(_0x3f6b('0x7'));var path=require(_0x3f6b('0x8'));var sox=require('sox');var csv=require(_0x3f6b('0x9'));var ejs=require(_0x3f6b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f6b('0xb'));var crypto=require(_0x3f6b('0xc'));var jsforce=require(_0x3f6b('0xd'));var deskjs=require(_0x3f6b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3f6b('0xf'));var Papa=require(_0x3f6b('0x10'));var Redis=require(_0x3f6b('0x11'));var authService=require(_0x3f6b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3f6b('0x13'));var hardwareService=require(_0x3f6b('0x14'));var logger=require(_0x3f6b('0x15'))(_0x3f6b('0x16'));var utils=require(_0x3f6b('0x17'));var config=require(_0x3f6b('0x18'));var licenseUtil=require(_0x3f6b('0x19'));var db=require(_0x3f6b('0x1a'))['db'];function respondWithStatusCode(_0xdd7c7,_0x37834c){_0x37834c=_0x37834c||0xcc;return function(_0x19d2c6){if(_0x19d2c6){return _0xdd7c7[_0x3f6b('0x1b')](_0x37834c);}return _0xdd7c7['status'](_0x37834c)['end']();};}function respondWithResult(_0x52405a,_0x202124){_0x202124=_0x202124||0xc8;return function(_0x4d0acd){if(_0x4d0acd){return _0x52405a[_0x3f6b('0x1c')](_0x202124)[_0x3f6b('0x1d')](_0x4d0acd);}};}function respondWithFilteredResult(_0x508b9c,_0x3f2484){return function(_0x202c31){if(_0x202c31){var _0x5ee96b=_0x202c31[_0x3f6b('0x1e')],_0x21821a=_0x3f2484[_0x3f6b('0x1f')],_0x1efcc5=_0x3f2484[_0x3f6b('0x1f')]+_0x3f2484[_0x3f6b('0x20')],_0x1fc318;if(_0x1efcc5>=_0x5ee96b){_0x1efcc5=_0x5ee96b;_0x1fc318=0xc8;}else{_0x1fc318=0xce;}_0x508b9c['status'](_0x1fc318);return _0x508b9c[_0x3f6b('0x21')](_0x3f6b('0x22'),_0x21821a+'-'+_0x1efcc5+'/'+_0x5ee96b)[_0x3f6b('0x1d')](_0x202c31);}return null;};}function patchUpdates(_0x1c33db){return function(_0x4a6521){try{jsonpatch[_0x3f6b('0x23')](_0x4a6521,_0x1c33db,!![]);}catch(_0x2559ee){return BPromise[_0x3f6b('0x24')](_0x2559ee);}return _0x4a6521['save']();};}function saveUpdates(_0xe9cbc9,_0x1bf9c9){return function(_0x2f7055){if(_0x2f7055){return _0x2f7055['update'](_0xe9cbc9)[_0x3f6b('0x25')](function(_0x11e9d7){return _0x11e9d7;});}return null;};}function removeEntity(_0x405f11,_0x4fdebe){return function(_0x2bf7b7){if(_0x2bf7b7){return _0x2bf7b7[_0x3f6b('0x26')]()[_0x3f6b('0x25')](function(){_0x405f11[_0x3f6b('0x1c')](0xcc)[_0x3f6b('0x27')]();});}};}function handleEntityNotFound(_0x1263ee,_0x5d581e){return function(_0x5ed0b5){if(!_0x5ed0b5){_0x1263ee[_0x3f6b('0x1b')](0x194);}return _0x5ed0b5;};}function handleError(_0x29ded4,_0x315152){_0x315152=_0x315152||0x1f4;return function(_0x494a61){logger[_0x3f6b('0x28')](_0x494a61[_0x3f6b('0x29')]);if(_0x494a61[_0x3f6b('0x2a')]){delete _0x494a61[_0x3f6b('0x2a')];}_0x29ded4[_0x3f6b('0x1c')](_0x315152)[_0x3f6b('0x2b')](_0x494a61);};}exports[_0x3f6b('0x2c')]=function(_0x34e007,_0x5a23eb){var _0x21bb26={},_0x1385e6={},_0x32851e={'count':0x0,'rows':[]};var _0x327961=_[_0x3f6b('0x2d')](db[_0x3f6b('0x2e')][_0x3f6b('0x2f')],function(_0x248843){return{'name':_0x248843[_0x3f6b('0x30')],'type':_0x248843[_0x3f6b('0x31')]['key']};});_0x1385e6[_0x3f6b('0x32')]=_[_0x3f6b('0x2d')](_0x327961,_0x3f6b('0x2a'));_0x1385e6[_0x3f6b('0x33')]=_[_0x3f6b('0x34')](_0x34e007['query']);_0x1385e6[_0x3f6b('0x35')]=_[_0x3f6b('0x36')](_0x1385e6['model'],_0x1385e6[_0x3f6b('0x33')]);_0x21bb26['attributes']=_['intersection'](_0x1385e6[_0x3f6b('0x32')],qs[_0x3f6b('0x37')](_0x34e007[_0x3f6b('0x33')][_0x3f6b('0x37')]));_0x21bb26['attributes']=_0x21bb26['attributes'][_0x3f6b('0x38')]?_0x21bb26[_0x3f6b('0x39')]:_0x1385e6[_0x3f6b('0x32')];if(!_0x34e007[_0x3f6b('0x33')]['hasOwnProperty'](_0x3f6b('0x3a'))){_0x21bb26[_0x3f6b('0x20')]=qs[_0x3f6b('0x20')](_0x34e007[_0x3f6b('0x33')][_0x3f6b('0x20')]);_0x21bb26[_0x3f6b('0x1f')]=qs[_0x3f6b('0x1f')](_0x34e007[_0x3f6b('0x33')][_0x3f6b('0x1f')]);}_0x21bb26[_0x3f6b('0x3b')]=qs[_0x3f6b('0x3c')](_0x34e007[_0x3f6b('0x33')][_0x3f6b('0x3c')]);_0x21bb26[_0x3f6b('0x3d')]=qs[_0x3f6b('0x35')](_[_0x3f6b('0x3e')](_0x34e007[_0x3f6b('0x33')],_0x1385e6[_0x3f6b('0x35')]),_0x327961);if(_0x34e007[_0x3f6b('0x33')][_0x3f6b('0x3f')]){_0x21bb26[_0x3f6b('0x3d')]=_[_0x3f6b('0x40')](_0x21bb26[_0x3f6b('0x3d')],{'$or':_[_0x3f6b('0x2d')](_0x327961,function(_0x54f2ca){if(_0x54f2ca['type']!==_0x3f6b('0x41')){var _0x52bb72={};_0x52bb72[_0x54f2ca[_0x3f6b('0x2a')]]={'$like':'%'+_0x34e007[_0x3f6b('0x33')][_0x3f6b('0x3f')]+'%'};return _0x52bb72;}})});}_0x21bb26=_[_0x3f6b('0x40')]({},_0x21bb26,_0x34e007['options']);var _0x471ece={'where':_0x21bb26['where']};return db[_0x3f6b('0x2e')][_0x3f6b('0x1e')](_0x471ece)[_0x3f6b('0x25')](function(_0x479500){_0x32851e[_0x3f6b('0x1e')]=_0x479500;if(_0x34e007['query'][_0x3f6b('0x42')]){_0x21bb26[_0x3f6b('0x43')]=[{'all':!![]}];}return db[_0x3f6b('0x2e')][_0x3f6b('0x44')](_0x21bb26);})['then'](function(_0x235c28){_0x32851e[_0x3f6b('0x45')]=_0x235c28;return _0x32851e;})[_0x3f6b('0x25')](respondWithFilteredResult(_0x5a23eb,_0x21bb26))[_0x3f6b('0x46')](handleError(_0x5a23eb,null));};exports['show']=function(_0x44b1f9,_0x1a4a48){var _0x19a856={'raw':!![],'where':{'id':_0x44b1f9[_0x3f6b('0x47')]['id']}},_0x5bdc0f={};_0x5bdc0f[_0x3f6b('0x32')]=_['keys'](db[_0x3f6b('0x2e')][_0x3f6b('0x2f')]);_0x5bdc0f[_0x3f6b('0x33')]=_['keys'](_0x44b1f9[_0x3f6b('0x33')]);_0x5bdc0f[_0x3f6b('0x35')]=_['intersection'](_0x5bdc0f[_0x3f6b('0x32')],_0x5bdc0f['query']);_0x19a856[_0x3f6b('0x39')]=_[_0x3f6b('0x36')](_0x5bdc0f['model'],qs[_0x3f6b('0x37')](_0x44b1f9[_0x3f6b('0x33')][_0x3f6b('0x37')]));_0x19a856[_0x3f6b('0x39')]=_0x19a856['attributes']['length']?_0x19a856[_0x3f6b('0x39')]:_0x5bdc0f[_0x3f6b('0x32')];if(_0x44b1f9[_0x3f6b('0x33')][_0x3f6b('0x42')]){_0x19a856[_0x3f6b('0x43')]=[{'all':!![]}];}_0x19a856=_['merge']({},_0x19a856,_0x44b1f9['options']);return db['FreshdeskField']['find'](_0x19a856)[_0x3f6b('0x25')](handleEntityNotFound(_0x1a4a48,null))['then'](respondWithResult(_0x1a4a48,null))['catch'](handleError(_0x1a4a48,null));};exports[_0x3f6b('0x48')]=function(_0x8fea5e,_0xec7af4){return db[_0x3f6b('0x2e')][_0x3f6b('0x48')](_0x8fea5e[_0x3f6b('0x49')],{})[_0x3f6b('0x25')](respondWithResult(_0xec7af4,0xc9))['catch'](handleError(_0xec7af4,null));};exports['update']=function(_0x57f010,_0x45678f){if(_0x57f010[_0x3f6b('0x49')]['id']){delete _0x57f010[_0x3f6b('0x49')]['id'];}return db[_0x3f6b('0x2e')]['find']({'where':{'id':_0x57f010[_0x3f6b('0x47')]['id']}})[_0x3f6b('0x25')](handleEntityNotFound(_0x45678f,null))['then'](saveUpdates(_0x57f010[_0x3f6b('0x49')],null))[_0x3f6b('0x25')](respondWithResult(_0x45678f,null))[_0x3f6b('0x46')](handleError(_0x45678f,null));};exports[_0x3f6b('0x26')]=function(_0x13ffed,_0x3bcfc5){return db[_0x3f6b('0x2e')][_0x3f6b('0x4a')]({'where':{'id':_0x13ffed[_0x3f6b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bcfc5,null))['then'](removeEntity(_0x3bcfc5,null))[_0x3f6b('0x46')](handleError(_0x3bcfc5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0f43990..c57b513 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 _0x0255=['exports','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','request-promise','path','../../config/environment','./intFreshdeskField.attributes'];(function(_0xe7b0c,_0xd43b66){var _0x1c56af=function(_0x3d95aa){while(--_0x3d95aa){_0xe7b0c['push'](_0xe7b0c['shift']());}};_0x1c56af(++_0xd43b66);}(_0x0255,0xcb));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5025('0x0'));var util=require('util');var logger=require(_0x5025('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5025('0x2'));var fs=require('fs');var path=require(_0x5025('0x3'));var rimraf=require('rimraf');var config=require(_0x5025('0x4'));var attributes=require(_0x5025('0x5'));module[_0x5025('0x6')]=function(_0x24e187,_0x5d6908){return _0x24e187['define'](_0x5025('0x7'),attributes,{'tableName':_0x5025('0x8'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x5025('0x9'),_0x5025('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8179=['request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','util','api','moment'];(function(_0x35cda5,_0x256903){var _0x52144c=function(_0x2e75df){while(--_0x2e75df){_0x35cda5['push'](_0x35cda5['shift']());}};_0x52144c(++_0x256903);}(_0x8179,0x11d));var _0x9817=function(_0x3c311e,_0x22bba6){_0x3c311e=_0x3c311e-0x0;var _0x337225=_0x8179[_0x3c311e];return _0x337225;};'use strict';var _=require('lodash');var util=require(_0x9817('0x0'));var logger=require('../../config/logger')(_0x9817('0x1'));var moment=require(_0x9817('0x2'));var BPromise=require('bluebird');var rp=require(_0x9817('0x3'));var fs=require('fs');var path=require(_0x9817('0x4'));var rimraf=require(_0x9817('0x5'));var config=require(_0x9817('0x6'));var attributes=require(_0x9817('0x7'));module[_0x9817('0x8')]=function(_0x543543,_0x46558d){return _0x543543[_0x9817('0x9')](_0x9817('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x9817('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index d561cf8..d333b07 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x27b366,_0x140295){_0x27b366=_0x27b366-0x0;var _0x53f17e=_0x7a54[_0x27b366];return _0x53f17e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x45a8c4,_0x4a4edf){var _0x2182d5=function(_0x336dbe){while(--_0x336dbe){_0x45a8c4['push'](_0x45a8c4['shift']());}};_0x2182d5(++_0x4a4edf);}(_0xb10b,0x12a));var _0xbb10=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0xb10b[_0x122d9f];return _0x41a09e;};'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 6b8fb6e..008c2ac 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 _0x6cd8=['post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x6cd8,0xee));var _0x86cd=function(_0x3f6a5a,_0x41108a){_0x3f6a5a=_0x3f6a5a-0x0;var _0x54d9e3=_0x6cd8[_0x3f6a5a];return _0x54d9e3;};'use strict';var multer=require(_0x86cd('0x0'));var util=require(_0x86cd('0x1'));var path=require('path');var timeout=require(_0x86cd('0x2'));var express=require(_0x86cd('0x3'));var router=express[_0x86cd('0x4')]();var auth=require(_0x86cd('0x5'));var interaction=require(_0x86cd('0x6'));var config=require(_0x86cd('0x7'));var controller=require(_0x86cd('0x8'));router[_0x86cd('0x9')]('/',auth['isAuthenticated'](),controller[_0x86cd('0xa')]);router[_0x86cd('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x86cd('0x9')](_0x86cd('0xb'),auth['isAuthenticated'](),controller[_0x86cd('0xc')]);router['get'](_0x86cd('0xd'),auth[_0x86cd('0xe')](),controller['getFields']);router[_0x86cd('0xf')]('/',auth[_0x86cd('0xe')](),controller[_0x86cd('0x10')]);router['post'](_0x86cd('0xb'),auth[_0x86cd('0xe')](),controller[_0x86cd('0x11')]);router['put'](_0x86cd('0x12'),auth[_0x86cd('0xe')](),controller[_0x86cd('0x13')]);router[_0x86cd('0x14')](_0x86cd('0x12'),auth[_0x86cd('0xe')](),controller[_0x86cd('0x15')]);module[_0x86cd('0x16')]=router; \ No newline at end of file +var _0xb2c7=['destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x83875e,_0x405493){var _0x4c550a=function(_0x5377e1){while(--_0x5377e1){_0x83875e['push'](_0x83875e['shift']());}};_0x4c550a(++_0x405493);}(_0xb2c7,0x17e));var _0x7b2c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2c7[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7b2c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b2c('0x1'));var express=require('express');var router=express[_0x7b2c('0x2')]();var auth=require(_0x7b2c('0x3'));var interaction=require(_0x7b2c('0x4'));var config=require(_0x7b2c('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x7b2c('0x6')]('/',auth[_0x7b2c('0x7')](),controller['index']);router[_0x7b2c('0x6')](_0x7b2c('0x8'),auth[_0x7b2c('0x7')](),controller['show']);router[_0x7b2c('0x6')](_0x7b2c('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7b2c('0xa'),auth[_0x7b2c('0x7')](),controller[_0x7b2c('0xb')]);router[_0x7b2c('0xc')]('/',auth[_0x7b2c('0x7')](),controller[_0x7b2c('0xd')]);router[_0x7b2c('0xc')](_0x7b2c('0x9'),auth[_0x7b2c('0x7')](),controller[_0x7b2c('0xe')]);router[_0x7b2c('0xf')](_0x7b2c('0x8'),auth[_0x7b2c('0x7')](),controller[_0x7b2c('0x10')]);router[_0x7b2c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7b2c('0x12')]);module[_0x7b2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bae2e3c..9a8637e 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 _0x9913=['username','STRING'];(function(_0x5e38a4,_0x333514){var _0x401332=function(_0x18cd85){while(--_0x18cd85){_0x5e38a4['push'](_0x5e38a4['shift']());}};_0x401332(++_0x333514);}(_0x9913,0x193));var _0x3991=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x9913[_0x41d432];return _0x1650f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3991('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3991('0x0')],'unique':_0x3991('0x1')},'apiKey':{'type':Sequelize[_0x3991('0x0')]},'remoteUri':{'type':Sequelize[_0x3991('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3991('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x810c=['STRING','remoteUri','sequelize'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x810c,0x1a6));var _0xc810=function(_0x5a4138,_0x23a6f3){_0x5a4138=_0x5a4138-0x0;var _0x56a811=_0x810c[_0x5a4138];return _0x56a811;};'use strict';var Sequelize=require(_0xc810('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc810('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xc810('0x1')]},'remoteUri':{'type':Sequelize[_0xc810('0x1')],'unique':_0xc810('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index fd8b7f7..be7d582 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 _0x593e=['info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','stack','name','index','map','FreshsalesAccount','fieldName','key','keys','query','filters','attributes','model','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','intersection','length','includeAll','find','create','body','findOne','FreshsalesConfiguration','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x593e,0xcb));var _0xe593=function(_0x1245b2,_0x5958c8){_0x1245b2=_0x1245b2-0x0;var _0x1f8373=_0x593e[_0x1245b2];return _0x1f8373;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];var integrations=require(_0xe593('0x1c'));var jayson=require(_0xe593('0x1d'));var client=jayson[_0xe593('0x1e')][_0xe593('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x328a5a,_0x15813c,_0x499819,_0x2907e4){return new BPromise(function(_0x1de391,_0x59f7c4){var _0x38418c=_0x2907e4||client;return _0x38418c[_0xe593('0x20')](_0x328a5a,_0x499819)['then'](function(_0x2ae9b6){logger[_0xe593('0x21')](_0xe593('0x22'),_0x15813c,_0xe593('0x23'));logger[_0xe593('0x24')](_0xe593('0x25'),_0x15813c,'request\x20sent',JSON[_0xe593('0x26')](_0x2ae9b6));if(_0x2ae9b6[_0xe593('0x27')]){if(_0x2ae9b6['error'][_0xe593('0x28')]===0x1f4){logger[_0xe593('0x27')]('FreshsalesAccount,\x20%s,\x20%s',_0x15813c,_0x2ae9b6[_0xe593('0x27')][_0xe593('0x29')]);return _0x59f7c4(_0x2ae9b6[_0xe593('0x27')][_0xe593('0x29')]);}logger[_0xe593('0x27')](_0xe593('0x22'),_0x15813c,_0x2ae9b6[_0xe593('0x27')]['message']);return _0x1de391(_0x2ae9b6['error'][_0xe593('0x29')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x15813c,_0xe593('0x23'));_0x1de391(_0x2ae9b6[_0xe593('0x2a')]['message']);}})[_0xe593('0x2b')](function(_0x563053){logger[_0xe593('0x27')](_0xe593('0x22'),_0x15813c,_0x563053);_0x59f7c4(_0x563053);});});}function respondWithStatusCode(_0x185cea,_0x44d997){_0x44d997=_0x44d997||0xcc;return function(_0x39103d){if(_0x39103d){return _0x185cea[_0xe593('0x2c')](_0x44d997);}return _0x185cea[_0xe593('0x2d')](_0x44d997)[_0xe593('0x2e')]();};}function respondWithResult(_0x4fc483,_0x47aea){_0x47aea=_0x47aea||0xc8;return function(_0x347d7d){if(_0x347d7d){return _0x4fc483['status'](_0x47aea)['json'](_0x347d7d);}};}function respondWithFilteredResult(_0xf8d492,_0x25238f){return function(_0x21eefc){if(_0x21eefc){var _0x43699d=_0x21eefc[_0xe593('0x2f')],_0x3b66bc=_0x25238f['offset'],_0x27a3d2=_0x25238f[_0xe593('0x30')]+_0x25238f[_0xe593('0x31')],_0x5918cd;if(_0x27a3d2>=_0x43699d){_0x27a3d2=_0x43699d;_0x5918cd=0xc8;}else{_0x5918cd=0xce;}_0xf8d492['status'](_0x5918cd);return _0xf8d492[_0xe593('0x32')]('Content-Range',_0x3b66bc+'-'+_0x27a3d2+'/'+_0x43699d)[_0xe593('0x33')](_0x21eefc);}return null;};}function patchUpdates(_0x1c147b){return function(_0x1618af){try{jsonpatch['apply'](_0x1618af,_0x1c147b,!![]);}catch(_0x1ae8d9){return BPromise[_0xe593('0x34')](_0x1ae8d9);}return _0x1618af[_0xe593('0x35')]();};}function saveUpdates(_0x338222,_0x2588be){return function(_0x291df8){if(_0x291df8){return _0x291df8[_0xe593('0x36')](_0x338222)['then'](function(_0x4098a9){return _0x4098a9;});}return null;};}function removeEntity(_0xc23a2f,_0x4e8448){return function(_0xe5e728){if(_0xe5e728){return _0xe5e728['destroy']()[_0xe593('0x37')](function(){_0xc23a2f[_0xe593('0x2d')](0xcc)[_0xe593('0x2e')]();});}};}function handleEntityNotFound(_0x3f64d0,_0x38d9f4){return function(_0x24a560){if(!_0x24a560){_0x3f64d0[_0xe593('0x2c')](0x194);}return _0x24a560;};}function handleError(_0x346640,_0x11f287){_0x11f287=_0x11f287||0x1f4;return function(_0x4305de){logger['error'](_0x4305de[_0xe593('0x38')]);if(_0x4305de[_0xe593('0x39')]){delete _0x4305de[_0xe593('0x39')];}_0x346640['status'](_0x11f287)['send'](_0x4305de);};}exports[_0xe593('0x3a')]=function(_0x5813bf,_0x232bf1){var _0x43f71a={},_0x1c2dad={},_0x30511c={'count':0x0,'rows':[]};var _0x35b4c1=_[_0xe593('0x3b')](db[_0xe593('0x3c')]['rawAttributes'],function(_0x5112c1){return{'name':_0x5112c1[_0xe593('0x3d')],'type':_0x5112c1['type'][_0xe593('0x3e')]};});_0x1c2dad['model']=_[_0xe593('0x3b')](_0x35b4c1,'name');_0x1c2dad['query']=_[_0xe593('0x3f')](_0x5813bf[_0xe593('0x40')]);_0x1c2dad[_0xe593('0x41')]=_['intersection'](_0x1c2dad['model'],_0x1c2dad['query']);_0x43f71a[_0xe593('0x42')]=_['intersection'](_0x1c2dad[_0xe593('0x43')],qs[_0xe593('0x44')](_0x5813bf[_0xe593('0x40')][_0xe593('0x44')]));_0x43f71a['attributes']=_0x43f71a[_0xe593('0x42')]['length']?_0x43f71a[_0xe593('0x42')]:_0x1c2dad['model'];if(!_0x5813bf['query']['hasOwnProperty'](_0xe593('0x45'))){_0x43f71a['limit']=qs[_0xe593('0x31')](_0x5813bf[_0xe593('0x40')][_0xe593('0x31')]);_0x43f71a['offset']=qs[_0xe593('0x30')](_0x5813bf[_0xe593('0x40')][_0xe593('0x30')]);}_0x43f71a[_0xe593('0x46')]=qs[_0xe593('0x47')](_0x5813bf[_0xe593('0x40')][_0xe593('0x47')]);_0x43f71a[_0xe593('0x48')]=qs['filters'](_[_0xe593('0x49')](_0x5813bf[_0xe593('0x40')],_0x1c2dad[_0xe593('0x41')]),_0x35b4c1);if(_0x5813bf[_0xe593('0x40')][_0xe593('0x4a')]){_0x43f71a['where']=_['merge'](_0x43f71a[_0xe593('0x48')],{'$or':_[_0xe593('0x3b')](_0x35b4c1,function(_0x44b835){if(_0x44b835['type']!==_0xe593('0x4b')){var _0x8a4c26={};_0x8a4c26[_0x44b835['name']]={'$like':'%'+_0x5813bf['query'][_0xe593('0x4a')]+'%'};return _0x8a4c26;}})});}_0x43f71a=_[_0xe593('0x4c')]({},_0x43f71a,_0x5813bf[_0xe593('0x4d')]);var _0x4f5ee9={'where':_0x43f71a[_0xe593('0x48')]};return db[_0xe593('0x3c')][_0xe593('0x2f')](_0x4f5ee9)[_0xe593('0x37')](function(_0x592586){_0x30511c['count']=_0x592586;if(_0x5813bf['query']['includeAll']){_0x43f71a[_0xe593('0x4e')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xe593('0x4f')](_0x43f71a);})[_0xe593('0x37')](function(_0x190e90){_0x30511c[_0xe593('0x50')]=_0x190e90;return _0x30511c;})[_0xe593('0x37')](respondWithFilteredResult(_0x232bf1,_0x43f71a))[_0xe593('0x2b')](handleError(_0x232bf1,null));};exports[_0xe593('0x51')]=function(_0x297c3e,_0x4c4f61){var _0x3dbb46={'raw':![],'where':{'id':_0x297c3e[_0xe593('0x52')]['id']}},_0x1a5e0f={};_0x1a5e0f['model']=_[_0xe593('0x3f')](db['FreshsalesAccount'][_0xe593('0x53')]);_0x1a5e0f[_0xe593('0x40')]=_[_0xe593('0x3f')](_0x297c3e['query']);_0x1a5e0f['filters']=_[_0xe593('0x54')](_0x1a5e0f[_0xe593('0x43')],_0x1a5e0f['query']);_0x3dbb46['attributes']=_['intersection'](_0x1a5e0f['model'],qs['fields'](_0x297c3e[_0xe593('0x40')][_0xe593('0x44')]));_0x3dbb46[_0xe593('0x42')]=_0x3dbb46[_0xe593('0x42')][_0xe593('0x55')]?_0x3dbb46[_0xe593('0x42')]:_0x1a5e0f[_0xe593('0x43')];if(_0x297c3e[_0xe593('0x40')][_0xe593('0x56')]){_0x3dbb46[_0xe593('0x4e')]=[{'all':!![]}];}_0x3dbb46=_[_0xe593('0x4c')]({},_0x3dbb46,_0x297c3e[_0xe593('0x4d')]);return db[_0xe593('0x3c')][_0xe593('0x57')](_0x3dbb46)[_0xe593('0x37')](handleEntityNotFound(_0x4c4f61,null))[_0xe593('0x37')](respondWithResult(_0x4c4f61,null))['catch'](handleError(_0x4c4f61,null));};exports[_0xe593('0x58')]=function(_0x12e2ac,_0x4390bd){return db[_0xe593('0x3c')][_0xe593('0x58')](_0x12e2ac[_0xe593('0x59')],{})[_0xe593('0x37')](respondWithResult(_0x4390bd,0xc9))[_0xe593('0x2b')](handleError(_0x4390bd,null));};exports[_0xe593('0x36')]=function(_0x355feb,_0x37373c){if(_0x355feb[_0xe593('0x59')]['id']){delete _0x355feb[_0xe593('0x59')]['id'];}return db[_0xe593('0x3c')][_0xe593('0x57')]({'where':{'id':_0x355feb['params']['id']}})[_0xe593('0x37')](handleEntityNotFound(_0x37373c,null))[_0xe593('0x37')](saveUpdates(_0x355feb[_0xe593('0x59')],null))[_0xe593('0x37')](respondWithResult(_0x37373c,null))[_0xe593('0x2b')](handleError(_0x37373c,null));};exports['destroy']=function(_0x503f60,_0xec8cdd){return db[_0xe593('0x3c')][_0xe593('0x57')]({'where':{'id':_0x503f60[_0xe593('0x52')]['id']}})[_0xe593('0x37')](handleEntityNotFound(_0xec8cdd,null))[_0xe593('0x37')](removeEntity(_0xec8cdd,null))[_0xe593('0x2b')](handleError(_0xec8cdd,null));};exports['getConfigurations']=function(_0x54cc48,_0x546aa7,_0x23ee3b){var _0x4ff51d={};var _0x103403={};var _0xf8ed1d;var _0x2bf207;return db[_0xe593('0x3c')][_0xe593('0x5a')]({'where':{'id':_0x54cc48[_0xe593('0x52')]['id']}})[_0xe593('0x37')](handleEntityNotFound(_0x546aa7,null))[_0xe593('0x37')](function(_0x1dc796){if(_0x1dc796){_0xf8ed1d=_0x1dc796;_0x103403[_0xe593('0x43')]=_['keys'](db[_0xe593('0x5b')][_0xe593('0x53')]);_0x103403[_0xe593('0x40')]=_[_0xe593('0x3f')](_0x54cc48[_0xe593('0x40')]);_0x103403[_0xe593('0x41')]=_[_0xe593('0x54')](_0x103403['model'],_0x103403[_0xe593('0x40')]);_0x4ff51d[_0xe593('0x42')]=_[_0xe593('0x54')](_0x103403[_0xe593('0x43')],qs['fields'](_0x54cc48[_0xe593('0x40')][_0xe593('0x44')]));_0x4ff51d[_0xe593('0x42')]=_0x4ff51d[_0xe593('0x42')][_0xe593('0x55')]?_0x4ff51d['attributes']:_0x103403[_0xe593('0x43')];_0x4ff51d[_0xe593('0x46')]=qs[_0xe593('0x47')](_0x54cc48[_0xe593('0x40')][_0xe593('0x47')]);_0x4ff51d[_0xe593('0x48')]=qs[_0xe593('0x41')](_[_0xe593('0x49')](_0x54cc48['query'],_0x103403[_0xe593('0x41')]));if(_0x54cc48[_0xe593('0x40')][_0xe593('0x4a')]){_0x4ff51d[_0xe593('0x48')]=_[_0xe593('0x4c')](_0x4ff51d[_0xe593('0x48')],{'$or':_[_0xe593('0x3b')](_0x4ff51d[_0xe593('0x42')],function(_0x3ffdc4){var _0x7fc05e={};_0x7fc05e[_0x3ffdc4]={'$like':'%'+_0x54cc48['query'][_0xe593('0x4a')]+'%'};return _0x7fc05e;})});}_0x4ff51d=_[_0xe593('0x4c')]({},_0x4ff51d,_0x54cc48[_0xe593('0x4d')]);return _0xf8ed1d['getConfigurations'](_0x4ff51d);}})[_0xe593('0x37')](function(_0x36e92d){if(_0x36e92d){_0x2bf207=_0x36e92d[_0xe593('0x55')];if(!_0x54cc48[_0xe593('0x40')][_0xe593('0x5c')]('nolimit')){_0x4ff51d[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x54cc48['query'][_0xe593('0x31')]);_0x4ff51d[_0xe593('0x30')]=qs[_0xe593('0x30')](_0x54cc48[_0xe593('0x40')]['offset']);}return _0xf8ed1d[_0xe593('0x5d')](_0x4ff51d);}})[_0xe593('0x37')](function(_0x43f868){if(_0x43f868){return _0x43f868?{'count':_0x2bf207,'rows':_0x43f868}:null;}})['then'](respondWithResult(_0x546aa7,null))[_0xe593('0x2b')](handleError(_0x546aa7,null));};exports[_0xe593('0x5e')]=function(_0x2ec8e7,_0x5bbf3d,_0xb6846a){if(_0x2ec8e7[_0xe593('0x59')]['id']){delete _0x2ec8e7[_0xe593('0x59')]['id'];}return db[_0xe593('0x3c')][_0xe593('0x5a')]({'where':{'id':_0x2ec8e7['params']['id']}})[_0xe593('0x37')](handleEntityNotFound(_0x5bbf3d,null))[_0xe593('0x37')](function(_0x2ceda4){if(_0x2ceda4){_0x2ec8e7[_0xe593('0x59')][_0xe593('0x5f')]=_0x2ceda4['id'];_0x2ec8e7[_0xe593('0x59')][_0xe593('0x60')]=integrations[_0xe593('0x61')](_0x2ec8e7[_0xe593('0x59')][_0xe593('0x62')],_0x2ec8e7[_0xe593('0x59')][_0xe593('0x63')]);_0x2ec8e7[_0xe593('0x59')][_0xe593('0x64')]=integrations['getDescriptions'](_0x2ec8e7[_0xe593('0x59')][_0xe593('0x62')],_0x2ec8e7[_0xe593('0x59')][_0xe593('0x63')]);return db[_0xe593('0x5b')][_0xe593('0x58')](_0x2ec8e7[_0xe593('0x59')],{'include':[{'model':db[_0xe593('0x65')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xe593('0x37')](respondWithResult(_0x5bbf3d,null))[_0xe593('0x2b')](handleError(_0x5bbf3d,null));};exports[_0xe593('0x66')]=function(_0x48edd1,_0x5c3134,_0x45a9f5){var _0x4c7972='';var _0x264b6a='';return db[_0xe593('0x3c')][_0xe593('0x5a')]({'where':{'id':_0x48edd1['params']['id']},'attributes':['id',_0xe593('0x67'),_0xe593('0x68'),_0xe593('0x69')]})[_0xe593('0x37')](handleEntityNotFound(_0x5c3134,null))[_0xe593('0x37')](function(_0x343633){if(_0x343633){_0x264b6a=_0x343633[_0xe593('0x67')];_0x4c7972=_0x343633['remoteUri'];var _0x3007ea=_0x343633[_0xe593('0x68')]['slice'](-0x1);if(_0x3007ea==='/'){_0x4c7972=_0x4c7972[_0xe593('0x6a')](0x0,_0x4c7972[_0xe593('0x6b')](_0x3007ea));}return rp({'method':_0xe593('0x6c'),'uri':util['format'](_0xe593('0x6d'),_0x4c7972,_0xe593('0x6e')),'headers':{'Authorization':_0xe593('0x6f')+_0x343633[_0xe593('0x69')]},'json':!![]});}})[_0xe593('0x37')](function(_0x17ad0b){if(_0x17ad0b){var _0x4c16d0=_0x17ad0b['users'];var _0x44b04c=![];var _0x48b481=null;for(_0x48b481=0x0;_0x48b481<_0x4c16d0['length'];_0x48b481++){if(_0x4c16d0[_0x48b481]['email']===_0x264b6a){_0x44b04c=!![];}}if(_0x44b04c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe593('0x70')});}}})[_0xe593('0x37')](respondWithResult(_0x5c3134,null))[_0xe593('0x2b')](function(_0x67d65b){var _0xa07dbb=_0x48edd1['query']['test']?0x1f4:_0x67d65b[_0xe593('0x71')]||0x1f4;logger[_0xe593('0x27')](_0xe593('0x72'),_0xe593('0x66'),_0xa07dbb,JSON['stringify'](_0x67d65b));delete _0x67d65b[_0xe593('0x39')];if(_0xa07dbb===0x191){_0xa07dbb=0x190;}_0x5c3134[_0xe593('0x2d')](_0xa07dbb)[_0xe593('0x73')](_0x48edd1['query'][_0xe593('0x74')]?{'message':_0xe593('0x75'),'statusCode':_0x67d65b['statusCode']}:_0x67d65b);});}; \ No newline at end of file +var _0xe5b5=['limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','merge','options','findAll','rows','show','include','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','filter','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset'];(function(_0x321728,_0x1fbc48){var _0x211876=function(_0x5bf9fc){while(--_0x5bf9fc){_0x321728['push'](_0x321728['shift']());}};_0x211876(++_0x1fbc48);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe5b5[_0xaa0309];return _0x5de7ce;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e5b('0x1b'));var jayson=require(_0x5e5b('0x1c'));var client=jayson[_0x5e5b('0x1d')][_0x5e5b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x13a01e,_0x1e3483,_0x2e331d,_0x49edd0){return new BPromise(function(_0x2b37fa,_0x2e92c3){var _0x4ff37b=_0x49edd0||client;return _0x4ff37b[_0x5e5b('0x1f')](_0x13a01e,_0x2e331d)['then'](function(_0x4e9509){logger[_0x5e5b('0x20')](_0x5e5b('0x21'),_0x1e3483,_0x5e5b('0x22'));logger['debug'](_0x5e5b('0x23'),_0x1e3483,'request\x20sent',JSON[_0x5e5b('0x24')](_0x4e9509));if(_0x4e9509[_0x5e5b('0x25')]){if(_0x4e9509['error'][_0x5e5b('0x26')]===0x1f4){logger[_0x5e5b('0x25')](_0x5e5b('0x21'),_0x1e3483,_0x4e9509['error'][_0x5e5b('0x27')]);return _0x2e92c3(_0x4e9509[_0x5e5b('0x25')]['message']);}logger[_0x5e5b('0x25')](_0x5e5b('0x21'),_0x1e3483,_0x4e9509[_0x5e5b('0x25')][_0x5e5b('0x27')]);return _0x2b37fa(_0x4e9509[_0x5e5b('0x25')][_0x5e5b('0x27')]);}else{logger[_0x5e5b('0x20')](_0x5e5b('0x21'),_0x1e3483,'request\x20sent');_0x2b37fa(_0x4e9509['result'][_0x5e5b('0x27')]);}})[_0x5e5b('0x28')](function(_0x14bfaf){logger[_0x5e5b('0x25')](_0x5e5b('0x21'),_0x1e3483,_0x14bfaf);_0x2e92c3(_0x14bfaf);});});}function respondWithStatusCode(_0x28cd95,_0x135c6c){_0x135c6c=_0x135c6c||0xcc;return function(_0x18903e){if(_0x18903e){return _0x28cd95[_0x5e5b('0x29')](_0x135c6c);}return _0x28cd95[_0x5e5b('0x2a')](_0x135c6c)[_0x5e5b('0x2b')]();};}function respondWithResult(_0x4da321,_0x1ebb11){_0x1ebb11=_0x1ebb11||0xc8;return function(_0x75800d){if(_0x75800d){return _0x4da321[_0x5e5b('0x2a')](_0x1ebb11)['json'](_0x75800d);}};}function respondWithFilteredResult(_0x988e5d,_0xdb2863){return function(_0x5ee866){if(_0x5ee866){var _0x13ff91=_0x5ee866[_0x5e5b('0x2c')],_0x21c74b=_0xdb2863[_0x5e5b('0x2d')],_0x39ce16=_0xdb2863[_0x5e5b('0x2d')]+_0xdb2863[_0x5e5b('0x2e')],_0x36b595;if(_0x39ce16>=_0x13ff91){_0x39ce16=_0x13ff91;_0x36b595=0xc8;}else{_0x36b595=0xce;}_0x988e5d[_0x5e5b('0x2a')](_0x36b595);return _0x988e5d[_0x5e5b('0x2f')](_0x5e5b('0x30'),_0x21c74b+'-'+_0x39ce16+'/'+_0x13ff91)[_0x5e5b('0x31')](_0x5ee866);}return null;};}function patchUpdates(_0x4ed688){return function(_0x579c39){try{jsonpatch[_0x5e5b('0x32')](_0x579c39,_0x4ed688,!![]);}catch(_0x289f54){return BPromise[_0x5e5b('0x33')](_0x289f54);}return _0x579c39[_0x5e5b('0x34')]();};}function saveUpdates(_0x12f1ee,_0x4b9be8){return function(_0x105b82){if(_0x105b82){return _0x105b82['update'](_0x12f1ee)[_0x5e5b('0x35')](function(_0x384d8f){return _0x384d8f;});}return null;};}function removeEntity(_0x11fa95,_0xc2bc09){return function(_0x4b9801){if(_0x4b9801){return _0x4b9801[_0x5e5b('0x36')]()[_0x5e5b('0x35')](function(){_0x11fa95['status'](0xcc)[_0x5e5b('0x2b')]();});}};}function handleEntityNotFound(_0x3ce0dc,_0x34debb){return function(_0x356db0){if(!_0x356db0){_0x3ce0dc[_0x5e5b('0x29')](0x194);}return _0x356db0;};}function handleError(_0x2296dd,_0x6b7977){_0x6b7977=_0x6b7977||0x1f4;return function(_0x317451){logger['error'](_0x317451[_0x5e5b('0x37')]);if(_0x317451[_0x5e5b('0x38')]){delete _0x317451[_0x5e5b('0x38')];}_0x2296dd[_0x5e5b('0x2a')](_0x6b7977)[_0x5e5b('0x39')](_0x317451);};}exports[_0x5e5b('0x3a')]=function(_0x4fec9e,_0x5b2ba5){var _0x1d6686={},_0x322b41={},_0x8ec651={'count':0x0,'rows':[]};var _0x5b0d32=_[_0x5e5b('0x3b')](db[_0x5e5b('0x3c')][_0x5e5b('0x3d')],function(_0x470b45){return{'name':_0x470b45['fieldName'],'type':_0x470b45[_0x5e5b('0x3e')][_0x5e5b('0x3f')]};});_0x322b41['model']=_['map'](_0x5b0d32,_0x5e5b('0x38'));_0x322b41[_0x5e5b('0x40')]=_[_0x5e5b('0x41')](_0x4fec9e['query']);_0x322b41[_0x5e5b('0x42')]=_['intersection'](_0x322b41['model'],_0x322b41[_0x5e5b('0x40')]);_0x1d6686[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x322b41[_0x5e5b('0x45')],qs[_0x5e5b('0x46')](_0x4fec9e[_0x5e5b('0x40')][_0x5e5b('0x46')]));_0x1d6686[_0x5e5b('0x43')]=_0x1d6686[_0x5e5b('0x43')]['length']?_0x1d6686[_0x5e5b('0x43')]:_0x322b41[_0x5e5b('0x45')];if(!_0x4fec9e['query'][_0x5e5b('0x47')]('nolimit')){_0x1d6686[_0x5e5b('0x2e')]=qs[_0x5e5b('0x2e')](_0x4fec9e[_0x5e5b('0x40')][_0x5e5b('0x2e')]);_0x1d6686[_0x5e5b('0x2d')]=qs[_0x5e5b('0x2d')](_0x4fec9e[_0x5e5b('0x40')][_0x5e5b('0x2d')]);}_0x1d6686[_0x5e5b('0x48')]=qs[_0x5e5b('0x49')](_0x4fec9e[_0x5e5b('0x40')]['sort']);_0x1d6686[_0x5e5b('0x4a')]=qs[_0x5e5b('0x42')](_[_0x5e5b('0x4b')](_0x4fec9e['query'],_0x322b41[_0x5e5b('0x42')]),_0x5b0d32);if(_0x4fec9e[_0x5e5b('0x40')]['filter']){_0x1d6686[_0x5e5b('0x4a')]=_[_0x5e5b('0x4c')](_0x1d6686['where'],{'$or':_[_0x5e5b('0x3b')](_0x5b0d32,function(_0x5e32fd){if(_0x5e32fd['type']!=='VIRTUAL'){var _0x362604={};_0x362604[_0x5e32fd['name']]={'$like':'%'+_0x4fec9e[_0x5e5b('0x40')]['filter']+'%'};return _0x362604;}})});}_0x1d6686=_[_0x5e5b('0x4c')]({},_0x1d6686,_0x4fec9e[_0x5e5b('0x4d')]);var _0x2bc089={'where':_0x1d6686[_0x5e5b('0x4a')]};return db[_0x5e5b('0x3c')][_0x5e5b('0x2c')](_0x2bc089)[_0x5e5b('0x35')](function(_0x4e4d03){_0x8ec651['count']=_0x4e4d03;if(_0x4fec9e[_0x5e5b('0x40')]['includeAll']){_0x1d6686['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5e5b('0x4e')](_0x1d6686);})['then'](function(_0x42f42d){_0x8ec651[_0x5e5b('0x4f')]=_0x42f42d;return _0x8ec651;})[_0x5e5b('0x35')](respondWithFilteredResult(_0x5b2ba5,_0x1d6686))[_0x5e5b('0x28')](handleError(_0x5b2ba5,null));};exports[_0x5e5b('0x50')]=function(_0x192445,_0x4fd265){var _0x26a0ff={'raw':![],'where':{'id':_0x192445['params']['id']}},_0x3ae495={};_0x3ae495[_0x5e5b('0x45')]=_['keys'](db[_0x5e5b('0x3c')][_0x5e5b('0x3d')]);_0x3ae495[_0x5e5b('0x40')]=_[_0x5e5b('0x41')](_0x192445['query']);_0x3ae495[_0x5e5b('0x42')]=_[_0x5e5b('0x44')](_0x3ae495['model'],_0x3ae495[_0x5e5b('0x40')]);_0x26a0ff[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x3ae495[_0x5e5b('0x45')],qs[_0x5e5b('0x46')](_0x192445[_0x5e5b('0x40')]['fields']));_0x26a0ff[_0x5e5b('0x43')]=_0x26a0ff[_0x5e5b('0x43')]['length']?_0x26a0ff[_0x5e5b('0x43')]:_0x3ae495[_0x5e5b('0x45')];if(_0x192445[_0x5e5b('0x40')]['includeAll']){_0x26a0ff[_0x5e5b('0x51')]=[{'all':!![]}];}_0x26a0ff=_[_0x5e5b('0x4c')]({},_0x26a0ff,_0x192445[_0x5e5b('0x4d')]);return db['FreshsalesAccount'][_0x5e5b('0x52')](_0x26a0ff)[_0x5e5b('0x35')](handleEntityNotFound(_0x4fd265,null))[_0x5e5b('0x35')](respondWithResult(_0x4fd265,null))['catch'](handleError(_0x4fd265,null));};exports['create']=function(_0x3da13f,_0x545991){return db['FreshsalesAccount'][_0x5e5b('0x53')](_0x3da13f[_0x5e5b('0x54')],{})[_0x5e5b('0x35')](respondWithResult(_0x545991,0xc9))['catch'](handleError(_0x545991,null));};exports[_0x5e5b('0x55')]=function(_0x28ac8b,_0x148032){if(_0x28ac8b[_0x5e5b('0x54')]['id']){delete _0x28ac8b[_0x5e5b('0x54')]['id'];}return db[_0x5e5b('0x3c')]['find']({'where':{'id':_0x28ac8b['params']['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x148032,null))[_0x5e5b('0x35')](saveUpdates(_0x28ac8b[_0x5e5b('0x54')],null))[_0x5e5b('0x35')](respondWithResult(_0x148032,null))['catch'](handleError(_0x148032,null));};exports[_0x5e5b('0x36')]=function(_0x4a86b7,_0x325f87){return db[_0x5e5b('0x3c')][_0x5e5b('0x52')]({'where':{'id':_0x4a86b7[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x325f87,null))[_0x5e5b('0x35')](removeEntity(_0x325f87,null))[_0x5e5b('0x28')](handleError(_0x325f87,null));};exports[_0x5e5b('0x57')]=function(_0x549489,_0x3963eb,_0x21b1d5){var _0x42f294={};var _0x1aea38={};var _0x129026;var _0x5543eb;return db[_0x5e5b('0x3c')][_0x5e5b('0x58')]({'where':{'id':_0x549489[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x3963eb,null))[_0x5e5b('0x35')](function(_0x5207e0){if(_0x5207e0){_0x129026=_0x5207e0;_0x1aea38[_0x5e5b('0x45')]=_['keys'](db[_0x5e5b('0x59')]['rawAttributes']);_0x1aea38[_0x5e5b('0x40')]=_[_0x5e5b('0x41')](_0x549489[_0x5e5b('0x40')]);_0x1aea38[_0x5e5b('0x42')]=_[_0x5e5b('0x44')](_0x1aea38[_0x5e5b('0x45')],_0x1aea38['query']);_0x42f294[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x1aea38[_0x5e5b('0x45')],qs[_0x5e5b('0x46')](_0x549489['query']['fields']));_0x42f294[_0x5e5b('0x43')]=_0x42f294[_0x5e5b('0x43')]['length']?_0x42f294[_0x5e5b('0x43')]:_0x1aea38[_0x5e5b('0x45')];_0x42f294[_0x5e5b('0x48')]=qs[_0x5e5b('0x49')](_0x549489[_0x5e5b('0x40')]['sort']);_0x42f294[_0x5e5b('0x4a')]=qs[_0x5e5b('0x42')](_['pick'](_0x549489['query'],_0x1aea38['filters']));if(_0x549489[_0x5e5b('0x40')][_0x5e5b('0x5a')]){_0x42f294[_0x5e5b('0x4a')]=_[_0x5e5b('0x4c')](_0x42f294[_0x5e5b('0x4a')],{'$or':_['map'](_0x42f294[_0x5e5b('0x43')],function(_0x454095){var _0x4eedb8={};_0x4eedb8[_0x454095]={'$like':'%'+_0x549489[_0x5e5b('0x40')]['filter']+'%'};return _0x4eedb8;})});}_0x42f294=_['merge']({},_0x42f294,_0x549489[_0x5e5b('0x4d')]);return _0x129026[_0x5e5b('0x57')](_0x42f294);}})[_0x5e5b('0x35')](function(_0x15b801){if(_0x15b801){_0x5543eb=_0x15b801[_0x5e5b('0x5b')];if(!_0x549489[_0x5e5b('0x40')][_0x5e5b('0x47')]('nolimit')){_0x42f294[_0x5e5b('0x2e')]=qs[_0x5e5b('0x2e')](_0x549489[_0x5e5b('0x40')][_0x5e5b('0x2e')]);_0x42f294[_0x5e5b('0x2d')]=qs[_0x5e5b('0x2d')](_0x549489[_0x5e5b('0x40')][_0x5e5b('0x2d')]);}return _0x129026[_0x5e5b('0x57')](_0x42f294);}})[_0x5e5b('0x35')](function(_0x26a17f){if(_0x26a17f){return _0x26a17f?{'count':_0x5543eb,'rows':_0x26a17f}:null;}})['then'](respondWithResult(_0x3963eb,null))[_0x5e5b('0x28')](handleError(_0x3963eb,null));};exports[_0x5e5b('0x5c')]=function(_0x3c57ad,_0x271af6,_0xc7171a){if(_0x3c57ad['body']['id']){delete _0x3c57ad[_0x5e5b('0x54')]['id'];}return db[_0x5e5b('0x3c')][_0x5e5b('0x58')]({'where':{'id':_0x3c57ad[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x271af6,null))[_0x5e5b('0x35')](function(_0x4d2218){if(_0x4d2218){_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x5d')]=_0x4d2218['id'];_0x3c57ad[_0x5e5b('0x54')]['Subjects']=integrations[_0x5e5b('0x5e')](_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x5f')],_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x3e')]);_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x60')]=integrations[_0x5e5b('0x61')](_0x3c57ad[_0x5e5b('0x54')]['channel'],_0x3c57ad[_0x5e5b('0x54')]['type']);return db[_0x5e5b('0x59')][_0x5e5b('0x53')](_0x3c57ad['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x5e5b('0x62')},{'model':db[_0x5e5b('0x63')],'as':'Descriptions'}]});}return null;})[_0x5e5b('0x35')](respondWithResult(_0x271af6,null))['catch'](handleError(_0x271af6,null));};exports['getFields']=function(_0x383de8,_0x5cb712,_0x3e3835){var _0x44eee0='';var _0x10aa6a='';return db['FreshsalesAccount'][_0x5e5b('0x58')]({'where':{'id':_0x383de8[_0x5e5b('0x56')]['id']},'attributes':['id',_0x5e5b('0x64'),'remoteUri',_0x5e5b('0x65')]})[_0x5e5b('0x35')](handleEntityNotFound(_0x5cb712,null))['then'](function(_0x388dbe){if(_0x388dbe){_0x10aa6a=_0x388dbe['username'];_0x44eee0=_0x388dbe['remoteUri'];var _0x1e6f7c=_0x388dbe[_0x5e5b('0x66')][_0x5e5b('0x67')](-0x1);if(_0x1e6f7c==='/'){_0x44eee0=_0x44eee0[_0x5e5b('0x68')](0x0,_0x44eee0[_0x5e5b('0x69')](_0x1e6f7c));}return rp({'method':'GET','uri':util[_0x5e5b('0x6a')](_0x5e5b('0x6b'),_0x44eee0,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x388dbe[_0x5e5b('0x65')]},'json':!![]});}})[_0x5e5b('0x35')](function(_0x313e13){if(_0x313e13){var _0x10fa87=_0x313e13[_0x5e5b('0x6c')];var _0x1ad8a9=![];var _0x55878b=null;for(_0x55878b=0x0;_0x55878b<_0x10fa87[_0x5e5b('0x5b')];_0x55878b++){if(_0x10fa87[_0x55878b][_0x5e5b('0x6d')]===_0x10aa6a){_0x1ad8a9=!![];}}if(_0x1ad8a9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5e5b('0x6e')});}}})['then'](respondWithResult(_0x5cb712,null))['catch'](function(_0x24bcc9){var _0x1eb8cd=_0x383de8[_0x5e5b('0x40')]['test']?0x1f4:_0x24bcc9[_0x5e5b('0x6f')]||0x1f4;logger[_0x5e5b('0x25')](_0x5e5b('0x70'),'getFields',_0x1eb8cd,JSON[_0x5e5b('0x24')](_0x24bcc9));delete _0x24bcc9[_0x5e5b('0x38')];if(_0x1eb8cd===0x191){_0x1eb8cd=0x190;}_0x5cb712[_0x5e5b('0x2a')](_0x1eb8cd)['send'](_0x383de8[_0x5e5b('0x40')][_0x5e5b('0x71')]?{'message':_0x5e5b('0x72'),'statusCode':_0x24bcc9[_0x5e5b('0x6f')]}:_0x24bcc9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index dd91cf6..0162b03 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 _0x8f58=['int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x5c1a4e,_0x3e373a){var _0x9dc46=function(_0x327d2a){while(--_0x327d2a){_0x5c1a4e['push'](_0x5c1a4e['shift']());}};_0x9dc46(++_0x3e373a);}(_0x8f58,0x79));var _0x88f5=function(_0x156957,_0x5ca131){_0x156957=_0x156957-0x0;var _0x4d1cdb=_0x8f58[_0x156957];return _0x4d1cdb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x88f5('0x0'))(_0x88f5('0x1'));var moment=require(_0x88f5('0x2'));var BPromise=require(_0x88f5('0x3'));var rp=require(_0x88f5('0x4'));var fs=require('fs');var path=require(_0x88f5('0x5'));var rimraf=require(_0x88f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x88f5('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x88f5('0x8')]=function(_0x295691,_0x48ee78){return _0x295691['define']('FreshsalesAccount',attributes,{'tableName':_0x88f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf496=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x49ac6a,_0x5acd31){var _0x3bd9bd=function(_0x593299){while(--_0x593299){_0x49ac6a['push'](_0x49ac6a['shift']());}};_0x3bd9bd(++_0x5acd31);}(_0xf496,0x114));var _0x6f49=function(_0x5ad886,_0x271111){_0x5ad886=_0x5ad886-0x0;var _0x672d22=_0xf496[_0x5ad886];return _0x672d22;};'use strict';var _=require(_0x6f49('0x0'));var util=require(_0x6f49('0x1'));var logger=require(_0x6f49('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6f49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f49('0x4'));var rimraf=require(_0x6f49('0x5'));var config=require(_0x6f49('0x6'));var attributes=require(_0x6f49('0x7'));var integrations=require(_0x6f49('0x8'));module[_0x6f49('0x9')]=function(_0xf57f79,_0x5ca046){return _0xf57f79[_0x6f49('0xa')](_0x6f49('0xb'),attributes,{'tableName':_0x6f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index ac06f47..a07c54d 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 _0x49c1=['where','attributes','limit','include','map','model','raw','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49c1,0xef));var _0x149c=function(_0x44f043,_0x2923eb){_0x44f043=_0x44f043-0x0;var _0x3f8478=_0x49c1[_0x44f043];return _0x3f8478;};'use strict';var _=require(_0x149c('0x0'));var util=require('util');var moment=require(_0x149c('0x1'));var BPromise=require(_0x149c('0x2'));var rs=require(_0x149c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x149c('0x4'))['db'];var utils=require(_0x149c('0x5'));var logger=require('../../config/logger')(_0x149c('0x6'));var config=require(_0x149c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x149c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33fa87,_0x2a61c0,_0x51f682){return new BPromise(function(_0x4396bb,_0xfe0da6){return client['request'](_0x33fa87,_0x51f682)[_0x149c('0x9')](function(_0x350050){logger['info'](_0x149c('0xa'),_0x2a61c0,_0x149c('0xb'));logger[_0x149c('0xc')](_0x149c('0xd'),_0x2a61c0,'request\x20sent',JSON[_0x149c('0xe')](_0x350050));if(_0x350050[_0x149c('0xf')]){if(_0x350050[_0x149c('0xf')][_0x149c('0x10')]===0x1f4){logger[_0x149c('0xf')](_0x149c('0xa'),_0x2a61c0,_0x350050[_0x149c('0xf')][_0x149c('0x11')]);return _0xfe0da6(_0x350050['error'][_0x149c('0x11')]);}logger[_0x149c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x2a61c0,_0x350050[_0x149c('0xf')]['message']);return _0x4396bb(_0x350050[_0x149c('0xf')][_0x149c('0x11')]);}else{logger[_0x149c('0x12')](_0x149c('0xa'),_0x2a61c0,_0x149c('0xb'));_0x4396bb(_0x350050[_0x149c('0x13')][_0x149c('0x11')]);}})[_0x149c('0x14')](function(_0x40989d){logger['error'](_0x149c('0xa'),_0x2a61c0,_0x40989d);_0xfe0da6(_0x40989d);});});}exports[_0x149c('0x15')]=function(_0x352f68){var _0x1bcd3d=this;return new Promise(function(_0x35f64f,_0x457a03){return db[_0x149c('0x16')][_0x149c('0x17')]({'raw':_0x352f68['options']?_0x352f68[_0x149c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x352f68['options']?_0x352f68['options'][_0x149c('0x19')]||null:null,'attributes':_0x352f68[_0x149c('0x18')]?_0x352f68[_0x149c('0x18')][_0x149c('0x1a')]||null:null,'limit':_0x352f68[_0x149c('0x18')]?_0x352f68[_0x149c('0x18')][_0x149c('0x1b')]||null:null,'include':_0x352f68['options']?_0x352f68[_0x149c('0x18')][_0x149c('0x1c')]?_[_0x149c('0x1d')](_0x352f68[_0x149c('0x18')][_0x149c('0x1c')],function(_0xb60e06){return{'model':db[_0xb60e06[_0x149c('0x1e')]],'as':_0xb60e06['as'],'attributes':_0xb60e06[_0x149c('0x1a')],'include':_0xb60e06['include']?_[_0x149c('0x1d')](_0xb60e06[_0x149c('0x1c')],function(_0x4bb447){return{'model':db[_0x4bb447[_0x149c('0x1e')]],'as':_0x4bb447['as'],'attributes':_0x4bb447[_0x149c('0x1a')],'include':_0x4bb447[_0x149c('0x1c')]?_[_0x149c('0x1d')](_0x4bb447['include'],function(_0x36e070){return{'model':db[_0x36e070[_0x149c('0x1e')]],'as':_0x36e070['as'],'attributes':_0x36e070[_0x149c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x149c('0x9')](function(_0x149705){logger[_0x149c('0x12')](_0x149c('0x15'),_0x352f68);logger['debug']('GetFreshsalesAccount',_0x352f68,JSON[_0x149c('0xe')](_0x149705));_0x35f64f(_0x149705);})[_0x149c('0x14')](function(_0x2da1de){logger['error'](_0x149c('0x15'),_0x2da1de[_0x149c('0x11')],_0x352f68);_0x457a03(_0x1bcd3d[_0x149c('0xf')](0x1f4,_0x2da1de[_0x149c('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x3951ae){var _0x1344d9=this;return new Promise(function(_0x2440d3,_0x1dda8a){return db[_0x149c('0x16')]['find']({'raw':_0x3951ae[_0x149c('0x18')]?_0x3951ae['options'][_0x149c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3951ae[_0x149c('0x18')]?_0x3951ae[_0x149c('0x18')][_0x149c('0x19')]||null:null,'attributes':_0x3951ae[_0x149c('0x18')]?_0x3951ae[_0x149c('0x18')][_0x149c('0x1a')]||null:null,'include':_0x3951ae['options']?_0x3951ae[_0x149c('0x18')]['include']?_[_0x149c('0x1d')](_0x3951ae['options'][_0x149c('0x1c')],function(_0x48ac8e){return{'model':db[_0x48ac8e[_0x149c('0x1e')]],'as':_0x48ac8e['as'],'attributes':_0x48ac8e[_0x149c('0x1a')],'include':_0x48ac8e['include']?_['map'](_0x48ac8e[_0x149c('0x1c')],function(_0x82f483){return{'model':db[_0x82f483['model']],'as':_0x82f483['as'],'attributes':_0x82f483['attributes'],'include':_0x82f483[_0x149c('0x1c')]?_[_0x149c('0x1d')](_0x82f483[_0x149c('0x1c')],function(_0x3d0df6){return{'model':db[_0x3d0df6[_0x149c('0x1e')]],'as':_0x3d0df6['as'],'attributes':_0x3d0df6[_0x149c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36f9f9){logger[_0x149c('0x12')](_0x149c('0x20'),_0x3951ae);logger[_0x149c('0xc')]('ShowFreshsalesAccount',_0x3951ae,JSON[_0x149c('0xe')](_0x36f9f9));_0x2440d3(_0x36f9f9);})[_0x149c('0x14')](function(_0x45f013){logger[_0x149c('0xf')]('ShowFreshsalesAccount',_0x45f013['message'],_0x3951ae);_0x1dda8a(_0x1344d9[_0x149c('0xf')](0x1f4,_0x45f013[_0x149c('0x11')]));});});}; \ No newline at end of file +var _0x80c4=['message','result','catch','findAll','options','where','include','map','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount','FreshsalesAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5498d2,_0x24b4ba){var _0x308a41=function(_0x36bf69){while(--_0x36bf69){_0x5498d2['push'](_0x5498d2['shift']());}};_0x308a41(++_0x24b4ba);}(_0x80c4,0xa3));var _0x480c=function(_0x3cfd29,_0x599fc6){_0x3cfd29=_0x3cfd29-0x0;var _0x1a551e=_0x80c4[_0x3cfd29];return _0x1a551e;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var moment=require(_0x480c('0x1'));var BPromise=require(_0x480c('0x2'));var rs=require(_0x480c('0x3'));var fs=require('fs');var Redis=require(_0x480c('0x4'));var db=require(_0x480c('0x5'))['db'];var utils=require(_0x480c('0x6'));var logger=require('../../config/logger')(_0x480c('0x7'));var config=require(_0x480c('0x8'));var jayson=require(_0x480c('0x9'));var client=jayson[_0x480c('0xa')][_0x480c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a5a6,_0x3a69ec,_0x277efe){return new BPromise(function(_0x21545d,_0x510038){return client[_0x480c('0xc')](_0x40a5a6,_0x277efe)[_0x480c('0xd')](function(_0x292aca){logger[_0x480c('0xe')](_0x480c('0xf'),_0x3a69ec,_0x480c('0x10'));logger[_0x480c('0x11')](_0x480c('0x12'),_0x3a69ec,_0x480c('0x10'),JSON[_0x480c('0x13')](_0x292aca));if(_0x292aca[_0x480c('0x14')]){if(_0x292aca[_0x480c('0x14')][_0x480c('0x15')]===0x1f4){logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);return _0x510038(_0x292aca[_0x480c('0x14')]['message']);}logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca['error'][_0x480c('0x16')]);return _0x21545d(_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x3a69ec,_0x480c('0x10'));_0x21545d(_0x292aca[_0x480c('0x17')][_0x480c('0x16')]);}})[_0x480c('0x18')](function(_0x93d6c5){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3a69ec,_0x93d6c5);_0x510038(_0x93d6c5);});});}exports['GetFreshsalesAccount']=function(_0xfc8a9f){var _0x4412aa=this;return new Promise(function(_0x54750c,_0x172103){return db['FreshsalesAccount'][_0x480c('0x19')]({'raw':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')][_0x480c('0x1b')]||null:null,'attributes':_0xfc8a9f['options']?_0xfc8a9f[_0x480c('0x1a')]['attributes']||null:null,'limit':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')]['limit']||null:null,'include':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')][_0x480c('0x1c')]?_[_0x480c('0x1d')](_0xfc8a9f['options'][_0x480c('0x1c')],function(_0x241901){return{'model':db[_0x241901[_0x480c('0x1e')]],'as':_0x241901['as'],'attributes':_0x241901[_0x480c('0x1f')],'include':_0x241901[_0x480c('0x1c')]?_[_0x480c('0x1d')](_0x241901[_0x480c('0x1c')],function(_0x12445d){return{'model':db[_0x12445d[_0x480c('0x1e')]],'as':_0x12445d['as'],'attributes':_0x12445d[_0x480c('0x1f')],'include':_0x12445d[_0x480c('0x1c')]?_[_0x480c('0x1d')](_0x12445d[_0x480c('0x1c')],function(_0x1363ef){return{'model':db[_0x1363ef['model']],'as':_0x1363ef['as'],'attributes':_0x1363ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x480c('0xd')](function(_0x4eafc7){logger['info']('GetFreshsalesAccount',_0xfc8a9f);logger['debug'](_0x480c('0x20'),_0xfc8a9f,JSON[_0x480c('0x13')](_0x4eafc7));_0x54750c(_0x4eafc7);})[_0x480c('0x18')](function(_0x377e5c){logger['error']('GetFreshsalesAccount',_0x377e5c['message'],_0xfc8a9f);_0x172103(_0x4412aa[_0x480c('0x14')](0x1f4,_0x377e5c[_0x480c('0x16')]));});});};exports[_0x480c('0x21')]=function(_0xe03103){var _0x48c806=this;return new Promise(function(_0x5acc0d,_0x415f68){return db[_0x480c('0x22')][_0x480c('0x23')]({'raw':_0xe03103[_0x480c('0x1a')]?_0xe03103[_0x480c('0x1a')][_0x480c('0x24')]===undefined?!![]:![]:!![],'where':_0xe03103[_0x480c('0x1a')]?_0xe03103[_0x480c('0x1a')]['where']||null:null,'attributes':_0xe03103['options']?_0xe03103[_0x480c('0x1a')][_0x480c('0x1f')]||null:null,'include':_0xe03103['options']?_0xe03103[_0x480c('0x1a')][_0x480c('0x1c')]?_[_0x480c('0x1d')](_0xe03103[_0x480c('0x1a')][_0x480c('0x1c')],function(_0x391e8d){return{'model':db[_0x391e8d[_0x480c('0x1e')]],'as':_0x391e8d['as'],'attributes':_0x391e8d[_0x480c('0x1f')],'include':_0x391e8d[_0x480c('0x1c')]?_[_0x480c('0x1d')](_0x391e8d[_0x480c('0x1c')],function(_0xafb6fa){return{'model':db[_0xafb6fa[_0x480c('0x1e')]],'as':_0xafb6fa['as'],'attributes':_0xafb6fa[_0x480c('0x1f')],'include':_0xafb6fa[_0x480c('0x1c')]?_['map'](_0xafb6fa[_0x480c('0x1c')],function(_0x15db14){return{'model':db[_0x15db14[_0x480c('0x1e')]],'as':_0x15db14['as'],'attributes':_0x15db14[_0x480c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x424060){logger[_0x480c('0xe')]('ShowFreshsalesAccount',_0xe03103);logger[_0x480c('0x11')]('ShowFreshsalesAccount',_0xe03103,JSON[_0x480c('0x13')](_0x424060));_0x5acc0d(_0x424060);})[_0x480c('0x18')](function(_0x261309){logger['error'](_0x480c('0x21'),_0x261309[_0x480c('0x16')],_0xe03103);_0x415f68(_0x48c806[_0x480c('0x14')](0x1f4,_0x261309[_0x480c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9bba980..cc9539d 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 _0x365e=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','/:id/fields','create','put','update','destroy'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x365e,0x119));var _0xe365=function(_0x85089,_0x544d8e){_0x85089=_0x85089-0x0;var _0x2438aa=_0x365e[_0x85089];return _0x2438aa;};'use strict';var multer=require('multer');var util=require(_0xe365('0x0'));var path=require(_0xe365('0x1'));var timeout=require(_0xe365('0x2'));var express=require(_0xe365('0x3'));var router=express['Router']();var auth=require(_0xe365('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe365('0x5'));var controller=require(_0xe365('0x6'));router[_0xe365('0x7')]('/',auth[_0xe365('0x8')](),controller[_0xe365('0x9')]);router[_0xe365('0x7')](_0xe365('0xa'),auth[_0xe365('0x8')](),controller[_0xe365('0xb')]);router[_0xe365('0x7')]('/:id/subjects',auth[_0xe365('0x8')](),controller[_0xe365('0xc')]);router['get'](_0xe365('0xd'),auth[_0xe365('0x8')](),controller['getDescriptions']);router['get'](_0xe365('0xe'),auth[_0xe365('0x8')](),controller['getFields']);router['post']('/',auth[_0xe365('0x8')](),controller[_0xe365('0xf')]);router[_0xe365('0x10')](_0xe365('0xa'),auth[_0xe365('0x8')](),controller[_0xe365('0x11')]);router['delete'](_0xe365('0xa'),auth['isAuthenticated'](),controller[_0xe365('0x12')]);module[_0xe365('0x13')]=router; \ No newline at end of file +var _0xcf8d=['getFields','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf8d,0xbe));var _0xdcf8=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xcf8d[_0x416cdc];return _0x1931ce;};'use strict';var multer=require(_0xdcf8('0x0'));var util=require(_0xdcf8('0x1'));var path=require('path');var timeout=require(_0xdcf8('0x2'));var express=require(_0xdcf8('0x3'));var router=express[_0xdcf8('0x4')]();var auth=require(_0xdcf8('0x5'));var interaction=require(_0xdcf8('0x6'));var config=require(_0xdcf8('0x7'));var controller=require(_0xdcf8('0x8'));router[_0xdcf8('0x9')]('/',auth[_0xdcf8('0xa')](),controller[_0xdcf8('0xb')]);router[_0xdcf8('0x9')](_0xdcf8('0xc'),auth[_0xdcf8('0xa')](),controller['show']);router[_0xdcf8('0x9')]('/:id/subjects',auth[_0xdcf8('0xa')](),controller[_0xdcf8('0xd')]);router[_0xdcf8('0x9')](_0xdcf8('0xe'),auth['isAuthenticated'](),controller[_0xdcf8('0xf')]);router[_0xdcf8('0x9')](_0xdcf8('0x10'),auth[_0xdcf8('0xa')](),controller[_0xdcf8('0x11')]);router['post']('/',auth[_0xdcf8('0xa')](),controller[_0xdcf8('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdcf8('0x13')]);router[_0xdcf8('0x14')](_0xdcf8('0xc'),auth[_0xdcf8('0xa')](),controller[_0xdcf8('0x15')]);module[_0xdcf8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b763b71..67f0256 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 _0xcff8=['STRING','exports'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0xcff8,0x181));var _0x8cff=function(_0x75a103,_0x406e69){_0x75a103=_0x75a103-0x0;var _0x10ec8a=_0xcff8[_0x75a103];return _0x10ec8a;};'use strict';var Sequelize=require('sequelize');module[_0x8cff('0x0')]={'name':{'type':Sequelize[_0x8cff('0x1')]},'description':{'type':Sequelize[_0x8cff('0x1')]}}; \ No newline at end of file +var _0xee4e=['exports','STRING','sequelize'];(function(_0xd18151,_0x13cacf){var _0x441085=function(_0x425886){while(--_0x425886){_0xd18151['push'](_0xd18151['shift']());}};_0x441085(++_0x13cacf);}(_0xee4e,0xc8));var _0xeee4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xee4e[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xeee4('0x0'));module[_0xeee4('0x1')]={'name':{'type':Sequelize[_0xeee4('0x2')]},'description':{'type':Sequelize[_0xeee4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 34a62a8..9f5866a 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 _0xf494=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','FreshsalesConfiguration,\x20%s,\x20%s','end','status','json','offset','limit','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','FreshsalesConfiguration','count','includeAll','include','show','params','find','create','body','catch','getSubjects','nolimit','getDescriptions','findOne','FreshsalesField','getFields','html-pdf'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xf494,0x1c6));var _0x4f49=function(_0x75b3a7,_0x3d7bc9){_0x75b3a7=_0x75b3a7-0x0;var _0x44b4f3=_0xf494[_0x75b3a7];return _0x44b4f3;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x111a8b,_0x1b9145,_0x2efe49,_0x1a0f1e){return new BPromise(function(_0x2f0131,_0xfdb477){var _0x5c373e=_0x1a0f1e||client;return _0x5c373e[_0x4f49('0x1b')](_0x111a8b,_0x2efe49)[_0x4f49('0x1c')](function(_0x415e83){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x4f49('0x1d'));logger[_0x4f49('0x1e')](_0x4f49('0x1f'),_0x1b9145,'request\x20sent',JSON[_0x4f49('0x20')](_0x415e83));if(_0x415e83[_0x4f49('0x21')]){if(_0x415e83[_0x4f49('0x21')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x415e83['error'][_0x4f49('0x22')]);return _0xfdb477(_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);}logger[_0x4f49('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);return _0x2f0131(_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);}else{logger[_0x4f49('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x4f49('0x1d'));_0x2f0131(_0x415e83[_0x4f49('0x24')][_0x4f49('0x22')]);}})['catch'](function(_0x40755e){logger[_0x4f49('0x21')](_0x4f49('0x25'),_0x1b9145,_0x40755e);_0xfdb477(_0x40755e);});});}function respondWithStatusCode(_0x43c458,_0x9d30aa){_0x9d30aa=_0x9d30aa||0xcc;return function(_0x36187b){if(_0x36187b){return _0x43c458['sendStatus'](_0x9d30aa);}return _0x43c458['status'](_0x9d30aa)[_0x4f49('0x26')]();};}function respondWithResult(_0x429de7,_0x4fedbb){_0x4fedbb=_0x4fedbb||0xc8;return function(_0x408552){if(_0x408552){return _0x429de7[_0x4f49('0x27')](_0x4fedbb)[_0x4f49('0x28')](_0x408552);}};}function respondWithFilteredResult(_0x525950,_0xc54070){return function(_0x2eed1c){if(_0x2eed1c){var _0x298785=_0x2eed1c['count'],_0x148153=_0xc54070['offset'],_0xfefbab=_0xc54070[_0x4f49('0x29')]+_0xc54070[_0x4f49('0x2a')],_0x122404;if(_0xfefbab>=_0x298785){_0xfefbab=_0x298785;_0x122404=0xc8;}else{_0x122404=0xce;}_0x525950[_0x4f49('0x27')](_0x122404);return _0x525950['set'](_0x4f49('0x2b'),_0x148153+'-'+_0xfefbab+'/'+_0x298785)[_0x4f49('0x28')](_0x2eed1c);}return null;};}function patchUpdates(_0x43d8e3){return function(_0x506b20){try{jsonpatch['apply'](_0x506b20,_0x43d8e3,!![]);}catch(_0x3e207f){return BPromise[_0x4f49('0x2c')](_0x3e207f);}return _0x506b20[_0x4f49('0x2d')]();};}function saveUpdates(_0x5e7076,_0x1eaac6){return function(_0x35aa33){if(_0x35aa33){return _0x35aa33[_0x4f49('0x2e')](_0x5e7076)[_0x4f49('0x1c')](function(_0x3e103b){return _0x3e103b;});}return null;};}function removeEntity(_0x37bfee,_0x32c066){return function(_0x45ae19){if(_0x45ae19){return _0x45ae19[_0x4f49('0x2f')]()[_0x4f49('0x1c')](function(){_0x37bfee[_0x4f49('0x27')](0xcc)[_0x4f49('0x26')]();});}};}function handleEntityNotFound(_0x29ff83,_0x6625cd){return function(_0x135d17){if(!_0x135d17){_0x29ff83[_0x4f49('0x30')](0x194);}return _0x135d17;};}function handleError(_0x376a7d,_0x14ca52){_0x14ca52=_0x14ca52||0x1f4;return function(_0x3e7a08){logger['error'](_0x3e7a08[_0x4f49('0x31')]);if(_0x3e7a08[_0x4f49('0x32')]){delete _0x3e7a08[_0x4f49('0x32')];}_0x376a7d[_0x4f49('0x27')](_0x14ca52)[_0x4f49('0x33')](_0x3e7a08);};}exports[_0x4f49('0x34')]=function(_0x2cbe4e,_0x3ad6a7){var _0x43f72f={},_0x338db8={},_0x44e6a0={'count':0x0,'rows':[]};var _0x343365=_[_0x4f49('0x35')](db['FreshsalesConfiguration'][_0x4f49('0x36')],function(_0x27b7a9){return{'name':_0x27b7a9[_0x4f49('0x37')],'type':_0x27b7a9[_0x4f49('0x38')][_0x4f49('0x39')]};});_0x338db8[_0x4f49('0x3a')]=_[_0x4f49('0x35')](_0x343365,_0x4f49('0x32'));_0x338db8[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x2cbe4e[_0x4f49('0x3b')]);_0x338db8[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x338db8[_0x4f49('0x3a')],_0x338db8['query']);_0x43f72f[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x338db8['model'],qs[_0x4f49('0x40')](_0x2cbe4e[_0x4f49('0x3b')]['fields']));_0x43f72f[_0x4f49('0x3f')]=_0x43f72f[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x43f72f[_0x4f49('0x3f')]:_0x338db8[_0x4f49('0x3a')];if(!_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x42')]('nolimit')){_0x43f72f['limit']=qs['limit'](_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x2a')]);_0x43f72f[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x29')]);}_0x43f72f[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x2cbe4e[_0x4f49('0x3b')]['sort']);_0x43f72f['where']=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x2cbe4e[_0x4f49('0x3b')],_0x338db8['filters']),_0x343365);if(_0x2cbe4e[_0x4f49('0x3b')]['filter']){_0x43f72f['where']=_[_0x4f49('0x46')](_0x43f72f[_0x4f49('0x47')],{'$or':_[_0x4f49('0x35')](_0x343365,function(_0x497cb8){if(_0x497cb8[_0x4f49('0x38')]!==_0x4f49('0x48')){var _0x5e9f60={};_0x5e9f60[_0x497cb8[_0x4f49('0x32')]]={'$like':'%'+_0x2cbe4e['query'][_0x4f49('0x49')]+'%'};return _0x5e9f60;}})});}_0x43f72f=_[_0x4f49('0x46')]({},_0x43f72f,_0x2cbe4e[_0x4f49('0x4a')]);var _0x5e6632={'where':_0x43f72f[_0x4f49('0x47')]};return db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x5e6632)[_0x4f49('0x1c')](function(_0x29dfdb){_0x44e6a0[_0x4f49('0x4c')]=_0x29dfdb;if(_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x4d')]){_0x43f72f[_0x4f49('0x4e')]=[{'all':!![]}];}return db[_0x4f49('0x4b')]['findAll'](_0x43f72f);})[_0x4f49('0x1c')](function(_0x44bf1d){_0x44e6a0['rows']=_0x44bf1d;return _0x44e6a0;})[_0x4f49('0x1c')](respondWithFilteredResult(_0x3ad6a7,_0x43f72f))['catch'](handleError(_0x3ad6a7,null));};exports[_0x4f49('0x4f')]=function(_0x41c580,_0x2d3dcd){var _0x300230={'raw':![],'where':{'id':_0x41c580[_0x4f49('0x50')]['id']}},_0x4a91ec={};_0x4a91ec[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db[_0x4f49('0x4b')][_0x4f49('0x36')]);_0x4a91ec[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x41c580[_0x4f49('0x3b')]);_0x4a91ec[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x4a91ec[_0x4f49('0x3a')],_0x4a91ec[_0x4f49('0x3b')]);_0x300230[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x4a91ec[_0x4f49('0x3a')],qs[_0x4f49('0x40')](_0x41c580['query']['fields']));_0x300230[_0x4f49('0x3f')]=_0x300230[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x300230[_0x4f49('0x3f')]:_0x4a91ec[_0x4f49('0x3a')];if(_0x41c580[_0x4f49('0x3b')][_0x4f49('0x4d')]){_0x300230['include']=[{'all':!![]}];}_0x300230=_[_0x4f49('0x46')]({},_0x300230,_0x41c580['options']);return db[_0x4f49('0x4b')][_0x4f49('0x51')](_0x300230)[_0x4f49('0x1c')](handleEntityNotFound(_0x2d3dcd,null))[_0x4f49('0x1c')](respondWithResult(_0x2d3dcd,null))['catch'](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x52')]=function(_0x5e75f5,_0x52d18c){return db[_0x4f49('0x4b')][_0x4f49('0x52')](_0x5e75f5[_0x4f49('0x53')],{})[_0x4f49('0x1c')](respondWithResult(_0x52d18c,0xc9))['catch'](handleError(_0x52d18c,null));};exports['update']=function(_0xd7f47b,_0x291a45){if(_0xd7f47b['body']['id']){delete _0xd7f47b[_0x4f49('0x53')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xd7f47b[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x291a45,null))[_0x4f49('0x1c')](saveUpdates(_0xd7f47b['body'],null))[_0x4f49('0x1c')](respondWithResult(_0x291a45,null))[_0x4f49('0x54')](handleError(_0x291a45,null));};exports[_0x4f49('0x2f')]=function(_0x883408,_0x16a591){return db[_0x4f49('0x4b')][_0x4f49('0x51')]({'where':{'id':_0x883408[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x16a591,null))[_0x4f49('0x1c')](removeEntity(_0x16a591,null))['catch'](handleError(_0x16a591,null));};exports[_0x4f49('0x55')]=function(_0x1f640d,_0xc4fc6b,_0x467f12){var _0x1981e0={};var _0xb7538c={};var _0x553981;var _0x426c50;return db[_0x4f49('0x4b')]['findOne']({'where':{'id':_0x1f640d['params']['id']}})[_0x4f49('0x1c')](handleEntityNotFound(_0xc4fc6b,null))[_0x4f49('0x1c')](function(_0x2e0df5){if(_0x2e0df5){_0x553981=_0x2e0df5;_0xb7538c[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db['FreshsalesField'][_0x4f49('0x36')]);_0xb7538c['query']=_[_0x4f49('0x3c')](_0x1f640d[_0x4f49('0x3b')]);_0xb7538c[_0x4f49('0x3d')]=_['intersection'](_0xb7538c[_0x4f49('0x3a')],_0xb7538c[_0x4f49('0x3b')]);_0x1981e0[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0xb7538c['model'],qs[_0x4f49('0x40')](_0x1f640d[_0x4f49('0x3b')]['fields']));_0x1981e0[_0x4f49('0x3f')]=_0x1981e0[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x1981e0[_0x4f49('0x3f')]:_0xb7538c[_0x4f49('0x3a')];_0x1981e0[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x1f640d[_0x4f49('0x3b')]['sort']);_0x1981e0[_0x4f49('0x47')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x1f640d[_0x4f49('0x3b')],_0xb7538c[_0x4f49('0x3d')]));if(_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x49')]){_0x1981e0['where']=_[_0x4f49('0x46')](_0x1981e0['where'],{'$or':_[_0x4f49('0x35')](_0x1981e0[_0x4f49('0x3f')],function(_0x4714c7){var _0xf29378={};_0xf29378[_0x4714c7]={'$like':'%'+_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0xf29378;})});}_0x1981e0=_[_0x4f49('0x46')]({},_0x1981e0,_0x1f640d[_0x4f49('0x4a')]);return _0x553981[_0x4f49('0x55')](_0x1981e0);}})[_0x4f49('0x1c')](function(_0x545552){if(_0x545552){_0x426c50=_0x545552[_0x4f49('0x41')];if(!_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x42')](_0x4f49('0x56'))){_0x1981e0['limit']=qs['limit'](_0x1f640d[_0x4f49('0x3b')]['limit']);_0x1981e0[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x29')]);}return _0x553981[_0x4f49('0x55')](_0x1981e0);}})[_0x4f49('0x1c')](function(_0x179431){if(_0x179431){return _0x179431?{'count':_0x426c50,'rows':_0x179431}:null;}})[_0x4f49('0x1c')](respondWithResult(_0xc4fc6b,null))[_0x4f49('0x54')](handleError(_0xc4fc6b,null));};exports[_0x4f49('0x57')]=function(_0x71ea58,_0x1ba97e,_0x2b3484){var _0xd53de8={};var _0x234984={};var _0x412d84;var _0x30afed;return db[_0x4f49('0x4b')][_0x4f49('0x58')]({'where':{'id':_0x71ea58[_0x4f49('0x50')]['id']}})[_0x4f49('0x1c')](handleEntityNotFound(_0x1ba97e,null))[_0x4f49('0x1c')](function(_0xf6d04b){if(_0xf6d04b){_0x412d84=_0xf6d04b;_0x234984[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db['FreshsalesField'][_0x4f49('0x36')]);_0x234984['query']=_[_0x4f49('0x3c')](_0x71ea58[_0x4f49('0x3b')]);_0x234984[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x234984[_0x4f49('0x3a')],_0x234984[_0x4f49('0x3b')]);_0xd53de8[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x234984[_0x4f49('0x3a')],qs['fields'](_0x71ea58['query'][_0x4f49('0x40')]));_0xd53de8['attributes']=_0xd53de8[_0x4f49('0x3f')][_0x4f49('0x41')]?_0xd53de8[_0x4f49('0x3f')]:_0x234984[_0x4f49('0x3a')];_0xd53de8[_0x4f49('0x43')]=qs['sort'](_0x71ea58['query'][_0x4f49('0x44')]);_0xd53de8[_0x4f49('0x47')]=qs['filters'](_[_0x4f49('0x45')](_0x71ea58[_0x4f49('0x3b')],_0x234984['filters']));if(_0x71ea58[_0x4f49('0x3b')]['filter']){_0xd53de8[_0x4f49('0x47')]=_[_0x4f49('0x46')](_0xd53de8['where'],{'$or':_[_0x4f49('0x35')](_0xd53de8[_0x4f49('0x3f')],function(_0x944375){var _0x1ae1e3={};_0x1ae1e3[_0x944375]={'$like':'%'+_0x71ea58[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0x1ae1e3;})});}_0xd53de8=_['merge']({},_0xd53de8,_0x71ea58[_0x4f49('0x4a')]);return _0x412d84['getDescriptions'](_0xd53de8);}})[_0x4f49('0x1c')](function(_0x574343){if(_0x574343){_0x30afed=_0x574343[_0x4f49('0x41')];if(!_0x71ea58['query'][_0x4f49('0x42')](_0x4f49('0x56'))){_0xd53de8[_0x4f49('0x2a')]=qs[_0x4f49('0x2a')](_0x71ea58['query'][_0x4f49('0x2a')]);_0xd53de8['offset']=qs[_0x4f49('0x29')](_0x71ea58['query'][_0x4f49('0x29')]);}return _0x412d84['getDescriptions'](_0xd53de8);}})['then'](function(_0x329a49){if(_0x329a49){return _0x329a49?{'count':_0x30afed,'rows':_0x329a49}:null;}})[_0x4f49('0x1c')](respondWithResult(_0x1ba97e,null))[_0x4f49('0x54')](handleError(_0x1ba97e,null));};exports['getFields']=function(_0x289810,_0x431c15,_0x5c33c9){var _0x5d52ae={};var _0x5c2acd={};var _0x3fb913;var _0x18d37f;return db[_0x4f49('0x4b')][_0x4f49('0x58')]({'where':{'id':_0x289810[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x431c15,null))[_0x4f49('0x1c')](function(_0x1b922e){if(_0x1b922e){_0x3fb913=_0x1b922e;_0x5c2acd[_0x4f49('0x3a')]=_['keys'](db[_0x4f49('0x59')][_0x4f49('0x36')]);_0x5c2acd[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x289810['query']);_0x5c2acd[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x5c2acd[_0x4f49('0x3a')],_0x5c2acd[_0x4f49('0x3b')]);_0x5d52ae[_0x4f49('0x3f')]=_['intersection'](_0x5c2acd[_0x4f49('0x3a')],qs[_0x4f49('0x40')](_0x289810['query'][_0x4f49('0x40')]));_0x5d52ae['attributes']=_0x5d52ae[_0x4f49('0x3f')]['length']?_0x5d52ae[_0x4f49('0x3f')]:_0x5c2acd[_0x4f49('0x3a')];_0x5d52ae[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x289810[_0x4f49('0x3b')]['sort']);_0x5d52ae[_0x4f49('0x47')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x289810[_0x4f49('0x3b')],_0x5c2acd['filters']));if(_0x289810[_0x4f49('0x3b')]['filter']){_0x5d52ae[_0x4f49('0x47')]=_['merge'](_0x5d52ae[_0x4f49('0x47')],{'$or':_[_0x4f49('0x35')](_0x5d52ae[_0x4f49('0x3f')],function(_0x34fca3){var _0x111e90={};_0x111e90[_0x34fca3]={'$like':'%'+_0x289810[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0x111e90;})});}_0x5d52ae=_[_0x4f49('0x46')]({},_0x5d52ae,_0x289810[_0x4f49('0x4a')]);return _0x3fb913[_0x4f49('0x5a')](_0x5d52ae);}})['then'](function(_0x33098a){if(_0x33098a){_0x18d37f=_0x33098a[_0x4f49('0x41')];if(!_0x289810[_0x4f49('0x3b')][_0x4f49('0x42')](_0x4f49('0x56'))){_0x5d52ae[_0x4f49('0x2a')]=qs['limit'](_0x289810[_0x4f49('0x3b')][_0x4f49('0x2a')]);_0x5d52ae[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x289810['query'][_0x4f49('0x29')]);}return _0x3fb913['getFields'](_0x5d52ae);}})[_0x4f49('0x1c')](function(_0x2be139){if(_0x2be139){return _0x2be139?{'count':_0x18d37f,'rows':_0x2be139}:null;}})[_0x4f49('0x1c')](respondWithResult(_0x431c15,null))[_0x4f49('0x54')](handleError(_0x431c15,null));}; \ No newline at end of file +var _0x1cb9=['http','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','catch','sendStatus','status','end','offset','limit','set','json','apply','save','update','then','destroy','stack','send','map','FreshsalesConfiguration','fieldName','type','key','name','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','count','include','findAll','rows','keys','rawAttributes','includeAll','merge','find','create','body','params','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x2f5468,_0x26b884){var _0x4f50b7=function(_0x23a993){while(--_0x23a993){_0x2f5468['push'](_0x2f5468['shift']());}};_0x4f50b7(++_0x26b884);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4778c6,_0x405b40){_0x4778c6=_0x4778c6-0x0;var _0x3c7477=_0x1cb9[_0x4778c6];return _0x3c7477;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ea707,_0x44f2e9,_0x2c7d40,_0x4a7d45){return new BPromise(function(_0x4cc6ef,_0x4aae25){var _0x3d22b7=_0x4a7d45||client;return _0x3d22b7['request'](_0x3ea707,_0x2c7d40)['then'](function(_0x576369){logger[_0x91cb('0x1b')](_0x91cb('0x1c'),_0x44f2e9,'request\x20sent');logger[_0x91cb('0x1d')](_0x91cb('0x1e'),_0x44f2e9,'request\x20sent',JSON[_0x91cb('0x1f')](_0x576369));if(_0x576369[_0x91cb('0x20')]){if(_0x576369[_0x91cb('0x20')][_0x91cb('0x21')]===0x1f4){logger['error'](_0x91cb('0x1c'),_0x44f2e9,_0x576369[_0x91cb('0x20')]['message']);return _0x4aae25(_0x576369[_0x91cb('0x20')]['message']);}logger['error'](_0x91cb('0x1c'),_0x44f2e9,_0x576369[_0x91cb('0x20')]['message']);return _0x4cc6ef(_0x576369['error']['message']);}else{logger[_0x91cb('0x1b')](_0x91cb('0x1c'),_0x44f2e9,_0x91cb('0x22'));_0x4cc6ef(_0x576369[_0x91cb('0x23')]['message']);}})[_0x91cb('0x24')](function(_0x43881c){logger[_0x91cb('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x44f2e9,_0x43881c);_0x4aae25(_0x43881c);});});}function respondWithStatusCode(_0x26f18f,_0x1a7a54){_0x1a7a54=_0x1a7a54||0xcc;return function(_0x2447e7){if(_0x2447e7){return _0x26f18f[_0x91cb('0x25')](_0x1a7a54);}return _0x26f18f[_0x91cb('0x26')](_0x1a7a54)[_0x91cb('0x27')]();};}function respondWithResult(_0x414e60,_0x423c4f){_0x423c4f=_0x423c4f||0xc8;return function(_0x264e9b){if(_0x264e9b){return _0x414e60['status'](_0x423c4f)['json'](_0x264e9b);}};}function respondWithFilteredResult(_0x234eb1,_0x554350){return function(_0x1c67d2){if(_0x1c67d2){var _0x34d372=_0x1c67d2['count'],_0x318031=_0x554350[_0x91cb('0x28')],_0x5595c5=_0x554350[_0x91cb('0x28')]+_0x554350[_0x91cb('0x29')],_0x9b26a6;if(_0x5595c5>=_0x34d372){_0x5595c5=_0x34d372;_0x9b26a6=0xc8;}else{_0x9b26a6=0xce;}_0x234eb1[_0x91cb('0x26')](_0x9b26a6);return _0x234eb1[_0x91cb('0x2a')]('Content-Range',_0x318031+'-'+_0x5595c5+'/'+_0x34d372)[_0x91cb('0x2b')](_0x1c67d2);}return null;};}function patchUpdates(_0x52670a){return function(_0x196385){try{jsonpatch[_0x91cb('0x2c')](_0x196385,_0x52670a,!![]);}catch(_0x445fe1){return BPromise['reject'](_0x445fe1);}return _0x196385[_0x91cb('0x2d')]();};}function saveUpdates(_0x146e1f,_0x25bbf9){return function(_0x361e4c){if(_0x361e4c){return _0x361e4c[_0x91cb('0x2e')](_0x146e1f)[_0x91cb('0x2f')](function(_0x1e5bf1){return _0x1e5bf1;});}return null;};}function removeEntity(_0x3bbde3,_0x1a10b1){return function(_0x5e6ed3){if(_0x5e6ed3){return _0x5e6ed3[_0x91cb('0x30')]()[_0x91cb('0x2f')](function(){_0x3bbde3[_0x91cb('0x26')](0xcc)[_0x91cb('0x27')]();});}};}function handleEntityNotFound(_0x440060,_0x4e70cd){return function(_0x2409d3){if(!_0x2409d3){_0x440060[_0x91cb('0x25')](0x194);}return _0x2409d3;};}function handleError(_0x2e317c,_0x46db02){_0x46db02=_0x46db02||0x1f4;return function(_0x39dd11){logger['error'](_0x39dd11[_0x91cb('0x31')]);if(_0x39dd11['name']){delete _0x39dd11['name'];}_0x2e317c['status'](_0x46db02)[_0x91cb('0x32')](_0x39dd11);};}exports['index']=function(_0x341ebe,_0x5604ba){var _0x59faf6={},_0x2ec8e1={},_0x2b15a1={'count':0x0,'rows':[]};var _0x1deabb=_[_0x91cb('0x33')](db[_0x91cb('0x34')]['rawAttributes'],function(_0x8beb3a){return{'name':_0x8beb3a[_0x91cb('0x35')],'type':_0x8beb3a[_0x91cb('0x36')][_0x91cb('0x37')]};});_0x2ec8e1['model']=_['map'](_0x1deabb,_0x91cb('0x38'));_0x2ec8e1[_0x91cb('0x39')]=_['keys'](_0x341ebe[_0x91cb('0x39')]);_0x2ec8e1[_0x91cb('0x3a')]=_['intersection'](_0x2ec8e1[_0x91cb('0x3b')],_0x2ec8e1[_0x91cb('0x39')]);_0x59faf6['attributes']=_[_0x91cb('0x3c')](_0x2ec8e1['model'],qs[_0x91cb('0x3d')](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x3d')]));_0x59faf6[_0x91cb('0x3e')]=_0x59faf6[_0x91cb('0x3e')][_0x91cb('0x3f')]?_0x59faf6['attributes']:_0x2ec8e1[_0x91cb('0x3b')];if(!_0x341ebe[_0x91cb('0x39')]['hasOwnProperty'](_0x91cb('0x40'))){_0x59faf6['limit']=qs[_0x91cb('0x29')](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x29')]);_0x59faf6[_0x91cb('0x28')]=qs['offset'](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x28')]);}_0x59faf6[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x42')]);_0x59faf6[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0x341ebe[_0x91cb('0x39')],_0x2ec8e1['filters']),_0x1deabb);if(_0x341ebe[_0x91cb('0x39')]['filter']){_0x59faf6[_0x91cb('0x43')]=_['merge'](_0x59faf6[_0x91cb('0x43')],{'$or':_['map'](_0x1deabb,function(_0x138f48){if(_0x138f48[_0x91cb('0x36')]!==_0x91cb('0x45')){var _0x31c966={};_0x31c966[_0x138f48['name']]={'$like':'%'+_0x341ebe[_0x91cb('0x39')][_0x91cb('0x46')]+'%'};return _0x31c966;}})});}_0x59faf6=_['merge']({},_0x59faf6,_0x341ebe[_0x91cb('0x47')]);var _0x2f1749={'where':_0x59faf6[_0x91cb('0x43')]};return db[_0x91cb('0x34')][_0x91cb('0x48')](_0x2f1749)[_0x91cb('0x2f')](function(_0x17d319){_0x2b15a1[_0x91cb('0x48')]=_0x17d319;if(_0x341ebe[_0x91cb('0x39')]['includeAll']){_0x59faf6[_0x91cb('0x49')]=[{'all':!![]}];}return db[_0x91cb('0x34')][_0x91cb('0x4a')](_0x59faf6);})[_0x91cb('0x2f')](function(_0x3314cc){_0x2b15a1[_0x91cb('0x4b')]=_0x3314cc;return _0x2b15a1;})[_0x91cb('0x2f')](respondWithFilteredResult(_0x5604ba,_0x59faf6))[_0x91cb('0x24')](handleError(_0x5604ba,null));};exports['show']=function(_0x348d78,_0x46caf1){var _0x2b8b7f={'raw':![],'where':{'id':_0x348d78['params']['id']}},_0x3b8cfd={};_0x3b8cfd[_0x91cb('0x3b')]=_[_0x91cb('0x4c')](db['FreshsalesConfiguration'][_0x91cb('0x4d')]);_0x3b8cfd['query']=_[_0x91cb('0x4c')](_0x348d78['query']);_0x3b8cfd['filters']=_['intersection'](_0x3b8cfd[_0x91cb('0x3b')],_0x3b8cfd[_0x91cb('0x39')]);_0x2b8b7f[_0x91cb('0x3e')]=_[_0x91cb('0x3c')](_0x3b8cfd[_0x91cb('0x3b')],qs['fields'](_0x348d78['query'][_0x91cb('0x3d')]));_0x2b8b7f[_0x91cb('0x3e')]=_0x2b8b7f[_0x91cb('0x3e')][_0x91cb('0x3f')]?_0x2b8b7f['attributes']:_0x3b8cfd['model'];if(_0x348d78['query'][_0x91cb('0x4e')]){_0x2b8b7f['include']=[{'all':!![]}];}_0x2b8b7f=_[_0x91cb('0x4f')]({},_0x2b8b7f,_0x348d78['options']);return db[_0x91cb('0x34')][_0x91cb('0x50')](_0x2b8b7f)[_0x91cb('0x2f')](handleEntityNotFound(_0x46caf1,null))[_0x91cb('0x2f')](respondWithResult(_0x46caf1,null))[_0x91cb('0x24')](handleError(_0x46caf1,null));};exports[_0x91cb('0x51')]=function(_0x3ec250,_0x30fd4e){return db[_0x91cb('0x34')][_0x91cb('0x51')](_0x3ec250[_0x91cb('0x52')],{})['then'](respondWithResult(_0x30fd4e,0xc9))[_0x91cb('0x24')](handleError(_0x30fd4e,null));};exports[_0x91cb('0x2e')]=function(_0x4d7a34,_0x3f719b){if(_0x4d7a34[_0x91cb('0x52')]['id']){delete _0x4d7a34['body']['id'];}return db[_0x91cb('0x34')][_0x91cb('0x50')]({'where':{'id':_0x4d7a34[_0x91cb('0x53')]['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x3f719b,null))[_0x91cb('0x2f')](saveUpdates(_0x4d7a34[_0x91cb('0x52')],null))[_0x91cb('0x2f')](respondWithResult(_0x3f719b,null))[_0x91cb('0x24')](handleError(_0x3f719b,null));};exports[_0x91cb('0x30')]=function(_0x93ef52,_0x847164){return db['FreshsalesConfiguration'][_0x91cb('0x50')]({'where':{'id':_0x93ef52['params']['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x847164,null))['then'](removeEntity(_0x847164,null))[_0x91cb('0x24')](handleError(_0x847164,null));};exports[_0x91cb('0x54')]=function(_0x1986d7,_0x47a6cd,_0xe49d42){var _0x3648c1={};var _0x48dcf7={};var _0xef4754;var _0x102025;return db[_0x91cb('0x34')][_0x91cb('0x55')]({'where':{'id':_0x1986d7['params']['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x47a6cd,null))[_0x91cb('0x2f')](function(_0x4250c2){if(_0x4250c2){_0xef4754=_0x4250c2;_0x48dcf7[_0x91cb('0x3b')]=_['keys'](db[_0x91cb('0x56')][_0x91cb('0x4d')]);_0x48dcf7['query']=_['keys'](_0x1986d7[_0x91cb('0x39')]);_0x48dcf7['filters']=_[_0x91cb('0x3c')](_0x48dcf7[_0x91cb('0x3b')],_0x48dcf7['query']);_0x3648c1['attributes']=_[_0x91cb('0x3c')](_0x48dcf7['model'],qs[_0x91cb('0x3d')](_0x1986d7[_0x91cb('0x39')][_0x91cb('0x3d')]));_0x3648c1['attributes']=_0x3648c1[_0x91cb('0x3e')]['length']?_0x3648c1[_0x91cb('0x3e')]:_0x48dcf7[_0x91cb('0x3b')];_0x3648c1[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0x1986d7['query'][_0x91cb('0x42')]);_0x3648c1[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0x1986d7[_0x91cb('0x39')],_0x48dcf7[_0x91cb('0x3a')]));if(_0x1986d7[_0x91cb('0x39')][_0x91cb('0x46')]){_0x3648c1[_0x91cb('0x43')]=_[_0x91cb('0x4f')](_0x3648c1[_0x91cb('0x43')],{'$or':_[_0x91cb('0x33')](_0x3648c1['attributes'],function(_0x2cf4d0){var _0x2e301a={};_0x2e301a[_0x2cf4d0]={'$like':'%'+_0x1986d7[_0x91cb('0x39')][_0x91cb('0x46')]+'%'};return _0x2e301a;})});}_0x3648c1=_[_0x91cb('0x4f')]({},_0x3648c1,_0x1986d7[_0x91cb('0x47')]);return _0xef4754[_0x91cb('0x54')](_0x3648c1);}})['then'](function(_0x325b2d){if(_0x325b2d){_0x102025=_0x325b2d['length'];if(!_0x1986d7[_0x91cb('0x39')][_0x91cb('0x57')](_0x91cb('0x40'))){_0x3648c1[_0x91cb('0x29')]=qs['limit'](_0x1986d7[_0x91cb('0x39')][_0x91cb('0x29')]);_0x3648c1[_0x91cb('0x28')]=qs[_0x91cb('0x28')](_0x1986d7[_0x91cb('0x39')][_0x91cb('0x28')]);}return _0xef4754['getSubjects'](_0x3648c1);}})[_0x91cb('0x2f')](function(_0x28bfe5){if(_0x28bfe5){return _0x28bfe5?{'count':_0x102025,'rows':_0x28bfe5}:null;}})[_0x91cb('0x2f')](respondWithResult(_0x47a6cd,null))[_0x91cb('0x24')](handleError(_0x47a6cd,null));};exports[_0x91cb('0x58')]=function(_0xc58b4a,_0x18b812,_0x2721cb){var _0x43629b={};var _0x457f81={};var _0x1347df;var _0x1f128b;return db[_0x91cb('0x34')][_0x91cb('0x55')]({'where':{'id':_0xc58b4a[_0x91cb('0x53')]['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x18b812,null))[_0x91cb('0x2f')](function(_0x4866aa){if(_0x4866aa){_0x1347df=_0x4866aa;_0x457f81[_0x91cb('0x3b')]=_[_0x91cb('0x4c')](db['FreshsalesField'][_0x91cb('0x4d')]);_0x457f81[_0x91cb('0x39')]=_[_0x91cb('0x4c')](_0xc58b4a['query']);_0x457f81[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x457f81['model'],_0x457f81['query']);_0x43629b[_0x91cb('0x3e')]=_['intersection'](_0x457f81[_0x91cb('0x3b')],qs[_0x91cb('0x3d')](_0xc58b4a['query'][_0x91cb('0x3d')]));_0x43629b['attributes']=_0x43629b[_0x91cb('0x3e')][_0x91cb('0x3f')]?_0x43629b['attributes']:_0x457f81['model'];_0x43629b[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0xc58b4a[_0x91cb('0x39')]['sort']);_0x43629b[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0xc58b4a[_0x91cb('0x39')],_0x457f81['filters']));if(_0xc58b4a[_0x91cb('0x39')]['filter']){_0x43629b[_0x91cb('0x43')]=_[_0x91cb('0x4f')](_0x43629b[_0x91cb('0x43')],{'$or':_[_0x91cb('0x33')](_0x43629b['attributes'],function(_0x5cd11e){var _0x1c8cf9={};_0x1c8cf9[_0x5cd11e]={'$like':'%'+_0xc58b4a['query'][_0x91cb('0x46')]+'%'};return _0x1c8cf9;})});}_0x43629b=_[_0x91cb('0x4f')]({},_0x43629b,_0xc58b4a[_0x91cb('0x47')]);return _0x1347df[_0x91cb('0x58')](_0x43629b);}})[_0x91cb('0x2f')](function(_0x46874e){if(_0x46874e){_0x1f128b=_0x46874e[_0x91cb('0x3f')];if(!_0xc58b4a['query'][_0x91cb('0x57')](_0x91cb('0x40'))){_0x43629b['limit']=qs[_0x91cb('0x29')](_0xc58b4a['query'][_0x91cb('0x29')]);_0x43629b[_0x91cb('0x28')]=qs[_0x91cb('0x28')](_0xc58b4a[_0x91cb('0x39')][_0x91cb('0x28')]);}return _0x1347df[_0x91cb('0x58')](_0x43629b);}})[_0x91cb('0x2f')](function(_0x30259d){if(_0x30259d){return _0x30259d?{'count':_0x1f128b,'rows':_0x30259d}:null;}})[_0x91cb('0x2f')](respondWithResult(_0x18b812,null))[_0x91cb('0x24')](handleError(_0x18b812,null));};exports[_0x91cb('0x59')]=function(_0x11411d,_0x684202,_0x14882d){var _0x22ba54={};var _0x4142eb={};var _0x4bc040;var _0x372270;return db['FreshsalesConfiguration'][_0x91cb('0x55')]({'where':{'id':_0x11411d[_0x91cb('0x53')]['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x684202,null))[_0x91cb('0x2f')](function(_0x319289){if(_0x319289){_0x4bc040=_0x319289;_0x4142eb[_0x91cb('0x3b')]=_[_0x91cb('0x4c')](db[_0x91cb('0x56')]['rawAttributes']);_0x4142eb[_0x91cb('0x39')]=_[_0x91cb('0x4c')](_0x11411d['query']);_0x4142eb['filters']=_[_0x91cb('0x3c')](_0x4142eb['model'],_0x4142eb['query']);_0x22ba54[_0x91cb('0x3e')]=_['intersection'](_0x4142eb[_0x91cb('0x3b')],qs['fields'](_0x11411d[_0x91cb('0x39')][_0x91cb('0x3d')]));_0x22ba54[_0x91cb('0x3e')]=_0x22ba54[_0x91cb('0x3e')]['length']?_0x22ba54[_0x91cb('0x3e')]:_0x4142eb[_0x91cb('0x3b')];_0x22ba54[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0x11411d[_0x91cb('0x39')][_0x91cb('0x42')]);_0x22ba54[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0x11411d[_0x91cb('0x39')],_0x4142eb[_0x91cb('0x3a')]));if(_0x11411d[_0x91cb('0x39')][_0x91cb('0x46')]){_0x22ba54[_0x91cb('0x43')]=_[_0x91cb('0x4f')](_0x22ba54[_0x91cb('0x43')],{'$or':_[_0x91cb('0x33')](_0x22ba54[_0x91cb('0x3e')],function(_0x30640e){var _0x39b5bd={};_0x39b5bd[_0x30640e]={'$like':'%'+_0x11411d[_0x91cb('0x39')][_0x91cb('0x46')]+'%'};return _0x39b5bd;})});}_0x22ba54=_[_0x91cb('0x4f')]({},_0x22ba54,_0x11411d[_0x91cb('0x47')]);return _0x4bc040[_0x91cb('0x59')](_0x22ba54);}})['then'](function(_0x1c8ca7){if(_0x1c8ca7){_0x372270=_0x1c8ca7[_0x91cb('0x3f')];if(!_0x11411d[_0x91cb('0x39')][_0x91cb('0x57')](_0x91cb('0x40'))){_0x22ba54[_0x91cb('0x29')]=qs[_0x91cb('0x29')](_0x11411d[_0x91cb('0x39')][_0x91cb('0x29')]);_0x22ba54[_0x91cb('0x28')]=qs[_0x91cb('0x28')](_0x11411d['query'][_0x91cb('0x28')]);}return _0x4bc040['getFields'](_0x22ba54);}})['then'](function(_0x4023f5){if(_0x4023f5){return _0x4023f5?{'count':_0x372270,'rows':_0x4023f5}:null;}})[_0x91cb('0x2f')](respondWithResult(_0x684202,null))[_0x91cb('0x24')](handleError(_0x684202,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 12b6c11..3d66434 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 _0x8130=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define'];(function(_0x274f48,_0x3bde53){var _0x2a3a28=function(_0x3fa341){while(--_0x3fa341){_0x274f48['push'](_0x274f48['shift']());}};_0x2a3a28(++_0x3bde53);}(_0x8130,0x146));var _0x0813=function(_0x4cd2f5,_0x463c92){_0x4cd2f5=_0x4cd2f5-0x0;var _0x373df6=_0x8130[_0x4cd2f5];return _0x373df6;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var logger=require('../../config/logger')(_0x0813('0x2'));var moment=require(_0x0813('0x3'));var BPromise=require(_0x0813('0x4'));var rp=require(_0x0813('0x5'));var fs=require('fs');var path=require(_0x0813('0x6'));var rimraf=require(_0x0813('0x7'));var config=require('../../config/environment');var attributes=require(_0x0813('0x8'));module['exports']=function(_0x563ee2,_0x306454){return _0x563ee2[_0x0813('0x9')](_0x0813('0xa'),attributes,{'tableName':_0x0813('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdeb=['api','bluebird','request-promise','path','rimraf','exports','define','util'];(function(_0x4ead36,_0x25809){var _0x442535=function(_0x4011df){while(--_0x4011df){_0x4ead36['push'](_0x4ead36['shift']());}};_0x442535(++_0x25809);}(_0xbdeb,0x6f));var _0xbbde=function(_0x2f8849,_0x541df){_0x2f8849=_0x2f8849-0x0;var _0x48c8ba=_0xbdeb[_0x2f8849];return _0x48c8ba;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var logger=require('../../config/logger')(_0xbbde('0x1'));var moment=require('moment');var BPromise=require(_0xbbde('0x2'));var rp=require(_0xbbde('0x3'));var fs=require('fs');var path=require(_0xbbde('0x4'));var rimraf=require(_0xbbde('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xbbde('0x6')]=function(_0x1d4042,_0x278651){return _0x1d4042[_0xbbde('0x7')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index e32b9ac..33f8508 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 _0xbde2=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xbde2,0x7a));var _0x2bde=function(_0x699abd,_0x244127){_0x699abd=_0x699abd-0x0;var _0x391213=_0xbde2[_0x699abd];return _0x391213;};'use strict';var _=require('lodash');var util=require(_0x2bde('0x0'));var moment=require(_0x2bde('0x1'));var BPromise=require(_0x2bde('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bde('0x3'));var db=require(_0x2bde('0x4'))['db'];var utils=require(_0x2bde('0x5'));var logger=require('../../config/logger')(_0x2bde('0x6'));var config=require(_0x2bde('0x7'));var jayson=require(_0x2bde('0x8'));var client=jayson[_0x2bde('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30d926,_0x7b834d,_0x39522f){return new BPromise(function(_0x3ddbc4,_0x343cba){return client[_0x2bde('0xa')](_0x30d926,_0x39522f)['then'](function(_0x5cc171){logger['info'](_0x2bde('0xb'),_0x7b834d,_0x2bde('0xc'));logger[_0x2bde('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x7b834d,_0x2bde('0xc'),JSON[_0x2bde('0xe')](_0x5cc171));if(_0x5cc171[_0x2bde('0xf')]){if(_0x5cc171[_0x2bde('0xf')][_0x2bde('0x10')]===0x1f4){logger[_0x2bde('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7b834d,_0x5cc171[_0x2bde('0xf')]['message']);return _0x343cba(_0x5cc171[_0x2bde('0xf')][_0x2bde('0x11')]);}logger[_0x2bde('0xf')](_0x2bde('0xb'),_0x7b834d,_0x5cc171[_0x2bde('0xf')][_0x2bde('0x11')]);return _0x3ddbc4(_0x5cc171[_0x2bde('0xf')][_0x2bde('0x11')]);}else{logger[_0x2bde('0x12')](_0x2bde('0xb'),_0x7b834d,_0x2bde('0xc'));_0x3ddbc4(_0x5cc171[_0x2bde('0x13')][_0x2bde('0x11')]);}})[_0x2bde('0x14')](function(_0x4f2f86){logger['error'](_0x2bde('0xb'),_0x7b834d,_0x4f2f86);_0x343cba(_0x4f2f86);});});} \ No newline at end of file +var _0x94df=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x94df,0xa3));var _0xf94d=function(_0x266f09,_0x3e77bf){_0x266f09=_0x266f09-0x0;var _0x4e1a7f=_0x94df[_0x266f09];return _0x4e1a7f;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18a11a,_0x1ebc19,_0xf285b5){return new BPromise(function(_0x1832e9,_0x504670){return client[_0xf94d('0xd')](_0x18a11a,_0xf285b5)[_0xf94d('0xe')](function(_0x145f5b){logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));logger['debug'](_0xf94d('0x12'),_0x1ebc19,_0xf94d('0x11'),JSON[_0xf94d('0x13')](_0x145f5b));if(_0x145f5b[_0xf94d('0x14')]){if(_0x145f5b[_0xf94d('0x14')]['code']===0x1f4){logger['error'](_0xf94d('0x10'),_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x504670(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}logger[_0xf94d('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x1832e9(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}else{logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));_0x1832e9(_0x145f5b[_0xf94d('0x16')]['message']);}})[_0xf94d('0x17')](function(_0x5cd967){logger[_0xf94d('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1ebc19,_0x5cd967);_0x504670(_0x5cd967);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 147cec5..a637a5a 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 _0x0fc8=['create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x0fc8,0xbf));var _0x80fc=function(_0x2a13ef,_0x349c01){_0x2a13ef=_0x2a13ef-0x0;var _0x4a7405=_0x0fc8[_0x2a13ef];return _0x4a7405;};'use strict';var multer=require('multer');var util=require(_0x80fc('0x0'));var path=require(_0x80fc('0x1'));var timeout=require(_0x80fc('0x2'));var express=require(_0x80fc('0x3'));var router=express[_0x80fc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x80fc('0x5'));var config=require(_0x80fc('0x6'));var controller=require(_0x80fc('0x7'));router[_0x80fc('0x8')]('/',auth[_0x80fc('0x9')](),controller[_0x80fc('0xa')]);router['get'](_0x80fc('0xb'),auth[_0x80fc('0x9')](),controller['show']);router[_0x80fc('0xc')]('/',auth[_0x80fc('0x9')](),controller[_0x80fc('0xd')]);router[_0x80fc('0xe')](_0x80fc('0xb'),auth[_0x80fc('0x9')](),controller['update']);router[_0x80fc('0xf')](_0x80fc('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x80fc('0x10')]=router; \ No newline at end of file +var _0x2463=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34114b,_0x32091c){var _0x46850f=function(_0xa0d39b){while(--_0xa0d39b){_0x34114b['push'](_0x34114b['shift']());}};_0x46850f(++_0x32091c);}(_0x2463,0x1c2));var _0x3246=function(_0x1e870d,_0x54ad01){_0x1e870d=_0x1e870d-0x0;var _0x44ad69=_0x2463[_0x1e870d];return _0x44ad69;};'use strict';var multer=require(_0x3246('0x0'));var util=require('util');var path=require(_0x3246('0x1'));var timeout=require(_0x3246('0x2'));var express=require(_0x3246('0x3'));var router=express[_0x3246('0x4')]();var auth=require(_0x3246('0x5'));var interaction=require(_0x3246('0x6'));var config=require(_0x3246('0x7'));var controller=require(_0x3246('0x8'));router[_0x3246('0x9')]('/',auth['isAuthenticated'](),controller[_0x3246('0xa')]);router['get']('/:id',auth[_0x3246('0xb')](),controller[_0x3246('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3246('0xd')]);router[_0x3246('0xe')](_0x3246('0xf'),auth[_0x3246('0xb')](),controller[_0x3246('0x10')]);router['delete'](_0x3246('0xf'),auth[_0x3246('0xb')](),controller[_0x3246('0x11')]);module[_0x3246('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 7145bf6..da3ac15 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 _0x8a56=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1c8ce1,_0x3f0442){var _0x36ce85=function(_0x56dcd4){while(--_0x56dcd4){_0x1c8ce1['push'](_0x1c8ce1['shift']());}};_0x36ce85(++_0x3f0442);}(_0x8a56,0xf0));var _0x68a5=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x8a56[_0x695b76];return _0x1dc21f;};'use strict';var Sequelize=require(_0x68a5('0x0'));module[_0x68a5('0x1')]={'type':{'type':Sequelize[_0x68a5('0x2')](_0x68a5('0x3'),_0x68a5('0x4'),_0x68a5('0x5'),_0x68a5('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x68a5('0x7')]},'key':{'type':Sequelize[_0x68a5('0x7')]},'keyType':{'type':Sequelize[_0x68a5('0x2')](_0x68a5('0x3'),'variable',_0x68a5('0x5'))},'keyContent':{'type':Sequelize[_0x68a5('0x7')]},'idField':{'type':Sequelize[_0x68a5('0x7')]},'nameField':{'type':Sequelize[_0x68a5('0x7')]},'customField':{'type':Sequelize[_0x68a5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68a5('0x7')]}}; \ No newline at end of file +var _0x5265=['ENUM','customVariable','keyValue','STRING','string','variable','BOOLEAN','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5265,0x10c));var _0x5526=function(_0x389e25,_0x16f6b5){_0x389e25=_0x389e25-0x0;var _0x21dfc4=_0x5265[_0x389e25];return _0x21dfc4;};'use strict';var Sequelize=require(_0x5526('0x0'));module[_0x5526('0x1')]={'type':{'type':Sequelize[_0x5526('0x2')]('string','variable',_0x5526('0x3'),_0x5526('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5526('0x5')]},'key':{'type':Sequelize[_0x5526('0x5')]},'keyType':{'type':Sequelize[_0x5526('0x2')](_0x5526('0x6'),_0x5526('0x7'),_0x5526('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5526('0x5')]},'nameField':{'type':Sequelize[_0x5526('0x5')]},'customField':{'type':Sequelize[_0x5526('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5526('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a5ab29b..ffba187 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 _0xc15f=['limit','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count'];(function(_0x168ac5,_0xc4b55c){var _0x5ed18b=function(_0x44db16){while(--_0x44db16){_0x168ac5['push'](_0x168ac5['shift']());}};_0x5ed18b(++_0xc4b55c);}(_0xc15f,0x193));var _0xfc15=function(_0x1b8050,_0x4d12c6){_0x1b8050=_0x1b8050-0x0;var _0x1ec2b1=_0xc15f[_0x1b8050];return _0x1ec2b1;};'use strict';var pdf=require(_0xfc15('0x0'));var emlformat=require(_0xfc15('0x1'));var rimraf=require(_0xfc15('0x2'));var zipdir=require(_0xfc15('0x3'));var jsonpatch=require(_0xfc15('0x4'));var rp=require(_0xfc15('0x5'));var moment=require(_0xfc15('0x6'));var BPromise=require(_0xfc15('0x7'));var Mustache=require(_0xfc15('0x8'));var util=require(_0xfc15('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xfc15('0xa'));var ejs=require(_0xfc15('0xb'));var fs=require('fs');var _=require(_0xfc15('0xc'));var squel=require('squel');var crypto=require(_0xfc15('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc15('0xa'));var querystring=require(_0xfc15('0xe'));var Papa=require(_0xfc15('0xf'));var Redis=require(_0xfc15('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc15('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc15('0x12'));var logger=require(_0xfc15('0x13'))(_0xfc15('0x14'));var utils=require('../../config/utils');var config=require(_0xfc15('0x15'));var licenseUtil=require(_0xfc15('0x16'));var db=require(_0xfc15('0x17'))['db'];function respondWithStatusCode(_0x401dff,_0x104a5d){_0x104a5d=_0x104a5d||0xcc;return function(_0x2674da){if(_0x2674da){return _0x401dff[_0xfc15('0x18')](_0x104a5d);}return _0x401dff['status'](_0x104a5d)[_0xfc15('0x19')]();};}function respondWithResult(_0x3916e4,_0x2cac23){_0x2cac23=_0x2cac23||0xc8;return function(_0x4e5a43){if(_0x4e5a43){return _0x3916e4[_0xfc15('0x1a')](_0x2cac23)[_0xfc15('0x1b')](_0x4e5a43);}};}function respondWithFilteredResult(_0x497af4,_0x2a80c6){return function(_0x317868){if(_0x317868){var _0x53cc70=_0x317868[_0xfc15('0x1c')],_0x4ad51b=_0x2a80c6['offset'],_0x512113=_0x2a80c6['offset']+_0x2a80c6[_0xfc15('0x1d')],_0x30d0ba;if(_0x512113>=_0x53cc70){_0x512113=_0x53cc70;_0x30d0ba=0xc8;}else{_0x30d0ba=0xce;}_0x497af4[_0xfc15('0x1a')](_0x30d0ba);return _0x497af4['set'](_0xfc15('0x1e'),_0x4ad51b+'-'+_0x512113+'/'+_0x53cc70)['json'](_0x317868);}return null;};}function patchUpdates(_0x315fcb){return function(_0x1bbc80){try{jsonpatch['apply'](_0x1bbc80,_0x315fcb,!![]);}catch(_0x4319c3){return BPromise[_0xfc15('0x1f')](_0x4319c3);}return _0x1bbc80['save']();};}function saveUpdates(_0x56a233,_0x4a0645){return function(_0x2944d7){if(_0x2944d7){return _0x2944d7[_0xfc15('0x20')](_0x56a233)['then'](function(_0x36b3d8){return _0x36b3d8;});}return null;};}function removeEntity(_0x410c06,_0x262dac){return function(_0x21f086){if(_0x21f086){return _0x21f086[_0xfc15('0x21')]()[_0xfc15('0x22')](function(){_0x410c06[_0xfc15('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d2ea,_0xaeccd1){return function(_0x55182a){if(!_0x55182a){_0x52d2ea[_0xfc15('0x18')](0x194);}return _0x55182a;};}function handleError(_0x7f5fef,_0x2a1533){_0x2a1533=_0x2a1533||0x1f4;return function(_0x18bc00){logger[_0xfc15('0x23')](_0x18bc00[_0xfc15('0x24')]);if(_0x18bc00[_0xfc15('0x25')]){delete _0x18bc00[_0xfc15('0x25')];}_0x7f5fef[_0xfc15('0x1a')](_0x2a1533)[_0xfc15('0x26')](_0x18bc00);};}exports[_0xfc15('0x27')]=function(_0x4336b6,_0x11710b){var _0x4a54d0={},_0x1414ab={},_0x4416fb={'count':0x0,'rows':[]};var _0x5cf061=_[_0xfc15('0x28')](db[_0xfc15('0x29')][_0xfc15('0x2a')],function(_0x1355f4){return{'name':_0x1355f4['fieldName'],'type':_0x1355f4['type']['key']};});_0x1414ab[_0xfc15('0x2b')]=_[_0xfc15('0x28')](_0x5cf061,_0xfc15('0x25'));_0x1414ab[_0xfc15('0x2c')]=_[_0xfc15('0x2d')](_0x4336b6[_0xfc15('0x2c')]);_0x1414ab[_0xfc15('0x2e')]=_[_0xfc15('0x2f')](_0x1414ab['model'],_0x1414ab[_0xfc15('0x2c')]);_0x4a54d0['attributes']=_[_0xfc15('0x2f')](_0x1414ab[_0xfc15('0x2b')],qs[_0xfc15('0x30')](_0x4336b6[_0xfc15('0x2c')][_0xfc15('0x30')]));_0x4a54d0[_0xfc15('0x31')]=_0x4a54d0[_0xfc15('0x31')]['length']?_0x4a54d0[_0xfc15('0x31')]:_0x1414ab['model'];if(!_0x4336b6['query'][_0xfc15('0x32')](_0xfc15('0x33'))){_0x4a54d0['limit']=qs[_0xfc15('0x1d')](_0x4336b6[_0xfc15('0x2c')]['limit']);_0x4a54d0['offset']=qs['offset'](_0x4336b6[_0xfc15('0x2c')][_0xfc15('0x34')]);}_0x4a54d0[_0xfc15('0x35')]=qs[_0xfc15('0x36')](_0x4336b6[_0xfc15('0x2c')][_0xfc15('0x36')]);_0x4a54d0[_0xfc15('0x37')]=qs['filters'](_[_0xfc15('0x38')](_0x4336b6[_0xfc15('0x2c')],_0x1414ab[_0xfc15('0x2e')]),_0x5cf061);if(_0x4336b6[_0xfc15('0x2c')]['filter']){_0x4a54d0[_0xfc15('0x37')]=_[_0xfc15('0x39')](_0x4a54d0['where'],{'$or':_[_0xfc15('0x28')](_0x5cf061,function(_0x4cb516){if(_0x4cb516[_0xfc15('0x3a')]!=='VIRTUAL'){var _0x4ce8fd={};_0x4ce8fd[_0x4cb516['name']]={'$like':'%'+_0x4336b6[_0xfc15('0x2c')][_0xfc15('0x3b')]+'%'};return _0x4ce8fd;}})});}_0x4a54d0=_[_0xfc15('0x39')]({},_0x4a54d0,_0x4336b6[_0xfc15('0x3c')]);var _0x582b4d={'where':_0x4a54d0['where']};return db[_0xfc15('0x29')]['count'](_0x582b4d)['then'](function(_0x3524aa){_0x4416fb['count']=_0x3524aa;if(_0x4336b6[_0xfc15('0x2c')][_0xfc15('0x3d')]){_0x4a54d0[_0xfc15('0x3e')]=[{'all':!![]}];}return db[_0xfc15('0x29')][_0xfc15('0x3f')](_0x4a54d0);})[_0xfc15('0x22')](function(_0x55edbc){_0x4416fb[_0xfc15('0x40')]=_0x55edbc;return _0x4416fb;})[_0xfc15('0x22')](respondWithFilteredResult(_0x11710b,_0x4a54d0))[_0xfc15('0x41')](handleError(_0x11710b,null));};exports[_0xfc15('0x42')]=function(_0x1b7e41,_0x2595e7){var _0x575aa0={'raw':!![],'where':{'id':_0x1b7e41[_0xfc15('0x43')]['id']}},_0x154fe9={};_0x154fe9[_0xfc15('0x2b')]=_['keys'](db['FreshsalesField'][_0xfc15('0x2a')]);_0x154fe9[_0xfc15('0x2c')]=_['keys'](_0x1b7e41[_0xfc15('0x2c')]);_0x154fe9[_0xfc15('0x2e')]=_[_0xfc15('0x2f')](_0x154fe9[_0xfc15('0x2b')],_0x154fe9[_0xfc15('0x2c')]);_0x575aa0[_0xfc15('0x31')]=_['intersection'](_0x154fe9[_0xfc15('0x2b')],qs[_0xfc15('0x30')](_0x1b7e41[_0xfc15('0x2c')][_0xfc15('0x30')]));_0x575aa0['attributes']=_0x575aa0['attributes'][_0xfc15('0x44')]?_0x575aa0[_0xfc15('0x31')]:_0x154fe9[_0xfc15('0x2b')];if(_0x1b7e41[_0xfc15('0x2c')]['includeAll']){_0x575aa0[_0xfc15('0x3e')]=[{'all':!![]}];}_0x575aa0=_[_0xfc15('0x39')]({},_0x575aa0,_0x1b7e41['options']);return db['FreshsalesField']['find'](_0x575aa0)[_0xfc15('0x22')](handleEntityNotFound(_0x2595e7,null))[_0xfc15('0x22')](respondWithResult(_0x2595e7,null))[_0xfc15('0x41')](handleError(_0x2595e7,null));};exports[_0xfc15('0x45')]=function(_0x249884,_0x531735){return db['FreshsalesField']['create'](_0x249884[_0xfc15('0x46')],{})['then'](respondWithResult(_0x531735,0xc9))[_0xfc15('0x41')](handleError(_0x531735,null));};exports[_0xfc15('0x20')]=function(_0x2309ca,_0x2d2e75){if(_0x2309ca[_0xfc15('0x46')]['id']){delete _0x2309ca[_0xfc15('0x46')]['id'];}return db[_0xfc15('0x29')][_0xfc15('0x47')]({'where':{'id':_0x2309ca[_0xfc15('0x43')]['id']}})[_0xfc15('0x22')](handleEntityNotFound(_0x2d2e75,null))[_0xfc15('0x22')](saveUpdates(_0x2309ca[_0xfc15('0x46')],null))[_0xfc15('0x22')](respondWithResult(_0x2d2e75,null))[_0xfc15('0x41')](handleError(_0x2d2e75,null));};exports['destroy']=function(_0xf93c2b,_0x20a54a){return db['FreshsalesField'][_0xfc15('0x47')]({'where':{'id':_0xf93c2b[_0xfc15('0x43')]['id']}})['then'](handleEntityNotFound(_0x20a54a,null))[_0xfc15('0x22')](removeEntity(_0x20a54a,null))[_0xfc15('0x41')](handleError(_0x20a54a,null));}; \ No newline at end of file +var _0xa03a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','catch','show','params','includeAll','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0xa03a,0xd0));var _0xaa03=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xa03a[_0x3e44fa];return _0x2a0aba;};'use strict';var pdf=require(_0xaa03('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaa03('0x1'));var zipdir=require(_0xaa03('0x2'));var jsonpatch=require(_0xaa03('0x3'));var rp=require(_0xaa03('0x4'));var moment=require(_0xaa03('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaa03('0x6'));var util=require(_0xaa03('0x7'));var path=require(_0xaa03('0x8'));var sox=require(_0xaa03('0x9'));var csv=require('to-csv');var ejs=require(_0xaa03('0xa'));var fs=require('fs');var _=require(_0xaa03('0xb'));var squel=require(_0xaa03('0xc'));var crypto=require(_0xaa03('0xd'));var jsforce=require(_0xaa03('0xe'));var deskjs=require(_0xaa03('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa03('0x10'));var Redis=require(_0xaa03('0x11'));var authService=require(_0xaa03('0x12'));var qs=require(_0xaa03('0x13'));var as=require(_0xaa03('0x14'));var hardwareService=require(_0xaa03('0x15'));var logger=require(_0xaa03('0x16'))(_0xaa03('0x17'));var utils=require(_0xaa03('0x18'));var config=require(_0xaa03('0x19'));var licenseUtil=require(_0xaa03('0x1a'));var db=require(_0xaa03('0x1b'))['db'];function respondWithStatusCode(_0x4098ec,_0x18ae9a){_0x18ae9a=_0x18ae9a||0xcc;return function(_0x1051da){if(_0x1051da){return _0x4098ec['sendStatus'](_0x18ae9a);}return _0x4098ec[_0xaa03('0x1c')](_0x18ae9a)['end']();};}function respondWithResult(_0x5006d9,_0x44d19d){_0x44d19d=_0x44d19d||0xc8;return function(_0x39ffab){if(_0x39ffab){return _0x5006d9[_0xaa03('0x1c')](_0x44d19d)[_0xaa03('0x1d')](_0x39ffab);}};}function respondWithFilteredResult(_0x509334,_0xac6e86){return function(_0x208f10){if(_0x208f10){var _0x242ad4=_0x208f10[_0xaa03('0x1e')],_0x356e42=_0xac6e86[_0xaa03('0x1f')],_0x54cb25=_0xac6e86[_0xaa03('0x1f')]+_0xac6e86[_0xaa03('0x20')],_0x5b87c5;if(_0x54cb25>=_0x242ad4){_0x54cb25=_0x242ad4;_0x5b87c5=0xc8;}else{_0x5b87c5=0xce;}_0x509334[_0xaa03('0x1c')](_0x5b87c5);return _0x509334['set'](_0xaa03('0x21'),_0x356e42+'-'+_0x54cb25+'/'+_0x242ad4)[_0xaa03('0x1d')](_0x208f10);}return null;};}function patchUpdates(_0x429a1e){return function(_0x112f6e){try{jsonpatch[_0xaa03('0x22')](_0x112f6e,_0x429a1e,!![]);}catch(_0x409252){return BPromise['reject'](_0x409252);}return _0x112f6e[_0xaa03('0x23')]();};}function saveUpdates(_0x30c836,_0x180bd5){return function(_0x4432d6){if(_0x4432d6){return _0x4432d6[_0xaa03('0x24')](_0x30c836)[_0xaa03('0x25')](function(_0x2e1d79){return _0x2e1d79;});}return null;};}function removeEntity(_0x3e0a7,_0x2a1d82){return function(_0x1a6337){if(_0x1a6337){return _0x1a6337[_0xaa03('0x26')]()[_0xaa03('0x25')](function(){_0x3e0a7[_0xaa03('0x1c')](0xcc)[_0xaa03('0x27')]();});}};}function handleEntityNotFound(_0x229fc3,_0x112d46){return function(_0x29fc39){if(!_0x29fc39){_0x229fc3['sendStatus'](0x194);}return _0x29fc39;};}function handleError(_0xae2b9c,_0x1dd880){_0x1dd880=_0x1dd880||0x1f4;return function(_0x3ddc7e){logger[_0xaa03('0x28')](_0x3ddc7e[_0xaa03('0x29')]);if(_0x3ddc7e[_0xaa03('0x2a')]){delete _0x3ddc7e['name'];}_0xae2b9c[_0xaa03('0x1c')](_0x1dd880)['send'](_0x3ddc7e);};}exports[_0xaa03('0x2b')]=function(_0x137d91,_0x5414d1){var _0x9534b7={},_0x5d24d7={},_0x1c9ac0={'count':0x0,'rows':[]};var _0x3afb34=_[_0xaa03('0x2c')](db[_0xaa03('0x2d')][_0xaa03('0x2e')],function(_0x3e5561){return{'name':_0x3e5561[_0xaa03('0x2f')],'type':_0x3e5561['type']['key']};});_0x5d24d7['model']=_[_0xaa03('0x2c')](_0x3afb34,_0xaa03('0x2a'));_0x5d24d7[_0xaa03('0x30')]=_[_0xaa03('0x31')](_0x137d91[_0xaa03('0x30')]);_0x5d24d7['filters']=_[_0xaa03('0x32')](_0x5d24d7[_0xaa03('0x33')],_0x5d24d7[_0xaa03('0x30')]);_0x9534b7[_0xaa03('0x34')]=_['intersection'](_0x5d24d7[_0xaa03('0x33')],qs[_0xaa03('0x35')](_0x137d91[_0xaa03('0x30')][_0xaa03('0x35')]));_0x9534b7[_0xaa03('0x34')]=_0x9534b7[_0xaa03('0x34')][_0xaa03('0x36')]?_0x9534b7[_0xaa03('0x34')]:_0x5d24d7[_0xaa03('0x33')];if(!_0x137d91[_0xaa03('0x30')][_0xaa03('0x37')](_0xaa03('0x38'))){_0x9534b7['limit']=qs['limit'](_0x137d91[_0xaa03('0x30')][_0xaa03('0x20')]);_0x9534b7[_0xaa03('0x1f')]=qs['offset'](_0x137d91[_0xaa03('0x30')][_0xaa03('0x1f')]);}_0x9534b7[_0xaa03('0x39')]=qs['sort'](_0x137d91['query'][_0xaa03('0x3a')]);_0x9534b7['where']=qs[_0xaa03('0x3b')](_[_0xaa03('0x3c')](_0x137d91[_0xaa03('0x30')],_0x5d24d7[_0xaa03('0x3b')]),_0x3afb34);if(_0x137d91['query'][_0xaa03('0x3d')]){_0x9534b7[_0xaa03('0x3e')]=_[_0xaa03('0x3f')](_0x9534b7[_0xaa03('0x3e')],{'$or':_[_0xaa03('0x2c')](_0x3afb34,function(_0x36097e){if(_0x36097e[_0xaa03('0x40')]!==_0xaa03('0x41')){var _0x2bb282={};_0x2bb282[_0x36097e[_0xaa03('0x2a')]]={'$like':'%'+_0x137d91[_0xaa03('0x30')][_0xaa03('0x3d')]+'%'};return _0x2bb282;}})});}_0x9534b7=_[_0xaa03('0x3f')]({},_0x9534b7,_0x137d91['options']);var _0x1d1992={'where':_0x9534b7['where']};return db['FreshsalesField']['count'](_0x1d1992)['then'](function(_0x4a245f){_0x1c9ac0[_0xaa03('0x1e')]=_0x4a245f;if(_0x137d91[_0xaa03('0x30')]['includeAll']){_0x9534b7[_0xaa03('0x42')]=[{'all':!![]}];}return db[_0xaa03('0x2d')]['findAll'](_0x9534b7);})[_0xaa03('0x25')](function(_0x180f69){_0x1c9ac0['rows']=_0x180f69;return _0x1c9ac0;})['then'](respondWithFilteredResult(_0x5414d1,_0x9534b7))[_0xaa03('0x43')](handleError(_0x5414d1,null));};exports[_0xaa03('0x44')]=function(_0x4d4c43,_0x528dee){var _0x28c289={'raw':!![],'where':{'id':_0x4d4c43[_0xaa03('0x45')]['id']}},_0x564531={};_0x564531['model']=_['keys'](db[_0xaa03('0x2d')][_0xaa03('0x2e')]);_0x564531[_0xaa03('0x30')]=_[_0xaa03('0x31')](_0x4d4c43['query']);_0x564531[_0xaa03('0x3b')]=_['intersection'](_0x564531[_0xaa03('0x33')],_0x564531[_0xaa03('0x30')]);_0x28c289[_0xaa03('0x34')]=_['intersection'](_0x564531[_0xaa03('0x33')],qs[_0xaa03('0x35')](_0x4d4c43[_0xaa03('0x30')][_0xaa03('0x35')]));_0x28c289[_0xaa03('0x34')]=_0x28c289[_0xaa03('0x34')][_0xaa03('0x36')]?_0x28c289[_0xaa03('0x34')]:_0x564531['model'];if(_0x4d4c43[_0xaa03('0x30')][_0xaa03('0x46')]){_0x28c289[_0xaa03('0x42')]=[{'all':!![]}];}_0x28c289=_[_0xaa03('0x3f')]({},_0x28c289,_0x4d4c43[_0xaa03('0x47')]);return db[_0xaa03('0x2d')][_0xaa03('0x48')](_0x28c289)[_0xaa03('0x25')](handleEntityNotFound(_0x528dee,null))[_0xaa03('0x25')](respondWithResult(_0x528dee,null))[_0xaa03('0x43')](handleError(_0x528dee,null));};exports[_0xaa03('0x49')]=function(_0x2c7bf0,_0x1c7399){return db[_0xaa03('0x2d')]['create'](_0x2c7bf0[_0xaa03('0x4a')],{})[_0xaa03('0x25')](respondWithResult(_0x1c7399,0xc9))[_0xaa03('0x43')](handleError(_0x1c7399,null));};exports['update']=function(_0x204021,_0x6d98df){if(_0x204021['body']['id']){delete _0x204021[_0xaa03('0x4a')]['id'];}return db['FreshsalesField'][_0xaa03('0x48')]({'where':{'id':_0x204021['params']['id']}})[_0xaa03('0x25')](handleEntityNotFound(_0x6d98df,null))[_0xaa03('0x25')](saveUpdates(_0x204021[_0xaa03('0x4a')],null))['then'](respondWithResult(_0x6d98df,null))[_0xaa03('0x43')](handleError(_0x6d98df,null));};exports[_0xaa03('0x26')]=function(_0x4e0417,_0x1c8b39){return db[_0xaa03('0x2d')]['find']({'where':{'id':_0x4e0417[_0xaa03('0x45')]['id']}})[_0xaa03('0x25')](handleEntityNotFound(_0x1c8b39,null))[_0xaa03('0x25')](removeEntity(_0x1c8b39,null))[_0xaa03('0x43')](handleError(_0x1c8b39,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index db2659e..d9b38d0 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 _0x90a2=['../../config/environment','exports','define','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xad61eb,_0x5b8374){var _0xb24f75=function(_0xde3758){while(--_0xde3758){_0xad61eb['push'](_0xad61eb['shift']());}};_0xb24f75(++_0x5b8374);}(_0x90a2,0xe2));var _0x290a=function(_0x2cdf66,_0x530f7f){_0x2cdf66=_0x2cdf66-0x0;var _0x5af684=_0x90a2[_0x2cdf66];return _0x5af684;};'use strict';var _=require(_0x290a('0x0'));var util=require(_0x290a('0x1'));var logger=require(_0x290a('0x2'))(_0x290a('0x3'));var moment=require(_0x290a('0x4'));var BPromise=require('bluebird');var rp=require(_0x290a('0x5'));var fs=require('fs');var path=require(_0x290a('0x6'));var rimraf=require(_0x290a('0x7'));var config=require(_0x290a('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0x290a('0x9')]=function(_0x589ab8,_0x55cd69){return _0x589ab8[_0x290a('0xa')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x290a('0xb'),'fields':['idField',_0x290a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f18=['rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','api','moment','request-promise'];(function(_0x37d05e,_0x4e6854){var _0x1fc309=function(_0x2b5b45){while(--_0x2b5b45){_0x37d05e['push'](_0x37d05e['shift']());}};_0x1fc309(++_0x4e6854);}(_0x6f18,0x174));var _0x86f1=function(_0x3f49f0,_0x38fd8c){_0x3f49f0=_0x3f49f0-0x0;var _0x37586f=_0x6f18[_0x3f49f0];return _0x37586f;};'use strict';var _=require(_0x86f1('0x0'));var util=require(_0x86f1('0x1'));var logger=require('../../config/logger')(_0x86f1('0x2'));var moment=require(_0x86f1('0x3'));var BPromise=require('bluebird');var rp=require(_0x86f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86f1('0x5'));var config=require('../../config/environment');var attributes=require(_0x86f1('0x6'));module[_0x86f1('0x7')]=function(_0x22d57d,_0x2f9472){return _0x22d57d[_0x86f1('0x8')](_0x86f1('0x9'),attributes,{'tableName':_0x86f1('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x86f1('0xb'),_0x86f1('0xc')],'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 fe5061b..e0442a8 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 _0x6320=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0xf63e79,_0x1c086e){var _0x131406=function(_0x6a07c8){while(--_0x6a07c8){_0xf63e79['push'](_0xf63e79['shift']());}};_0x131406(++_0x1c086e);}(_0x6320,0x6a));var _0x0632=function(_0x2c9abd,_0x7b1fc8){_0x2c9abd=_0x2c9abd-0x0;var _0x3a0c17=_0x6320[_0x2c9abd];return _0x3a0c17;};'use strict';var _=require(_0x0632('0x0'));var util=require(_0x0632('0x1'));var moment=require(_0x0632('0x2'));var BPromise=require(_0x0632('0x3'));var rs=require(_0x0632('0x4'));var fs=require('fs');var Redis=require(_0x0632('0x5'));var db=require(_0x0632('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0632('0x7'));var config=require(_0x0632('0x8'));var jayson=require(_0x0632('0x9'));var client=jayson[_0x0632('0xa')][_0x0632('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26fdd9,_0x1397c7,_0x36829e){return new BPromise(function(_0x288532,_0x384bdf){return client[_0x0632('0xc')](_0x26fdd9,_0x36829e)[_0x0632('0xd')](function(_0x4f40b7){logger['info'](_0x0632('0xe'),_0x1397c7,'request\x20sent');logger[_0x0632('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1397c7,_0x0632('0x10'),JSON['stringify'](_0x4f40b7));if(_0x4f40b7[_0x0632('0x11')]){if(_0x4f40b7[_0x0632('0x11')][_0x0632('0x12')]===0x1f4){logger[_0x0632('0x11')](_0x0632('0xe'),_0x1397c7,_0x4f40b7[_0x0632('0x11')][_0x0632('0x13')]);return _0x384bdf(_0x4f40b7[_0x0632('0x11')][_0x0632('0x13')]);}logger[_0x0632('0x11')](_0x0632('0xe'),_0x1397c7,_0x4f40b7[_0x0632('0x11')][_0x0632('0x13')]);return _0x288532(_0x4f40b7[_0x0632('0x11')][_0x0632('0x13')]);}else{logger['info'](_0x0632('0xe'),_0x1397c7,'request\x20sent');_0x288532(_0x4f40b7[_0x0632('0x14')][_0x0632('0x13')]);}})[_0x0632('0x15')](function(_0x2d03dc){logger[_0x0632('0x11')](_0x0632('0xe'),_0x1397c7,_0x2d03dc);_0x384bdf(_0x2d03dc);});});} \ No newline at end of file +var _0x8091=['rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19e16f,_0x4a9324){var _0x242c29=function(_0x3c6694){while(--_0x3c6694){_0x19e16f['push'](_0x19e16f['shift']());}};_0x242c29(++_0x4a9324);}(_0x8091,0x124));var _0x1809=function(_0x438d09,_0x571abf){_0x438d09=_0x438d09-0x0;var _0xdc90ff=_0x8091[_0x438d09];return _0xdc90ff;};'use strict';var _=require(_0x1809('0x0'));var util=require(_0x1809('0x1'));var moment=require(_0x1809('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1809('0x3'));var db=require(_0x1809('0x4'))['db'];var utils=require(_0x1809('0x5'));var logger=require(_0x1809('0x6'))(_0x1809('0x7'));var config=require(_0x1809('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1809('0x9')][_0x1809('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fd039,_0xd90ca4,_0x34b31c){return new BPromise(function(_0x14c71c,_0x1c22d9){return client[_0x1809('0xb')](_0x1fd039,_0x34b31c)['then'](function(_0x1035da){logger[_0x1809('0xc')](_0x1809('0xd'),_0xd90ca4,'request\x20sent');logger[_0x1809('0xe')](_0x1809('0xf'),_0xd90ca4,_0x1809('0x10'),JSON[_0x1809('0x11')](_0x1035da));if(_0x1035da[_0x1809('0x12')]){if(_0x1035da[_0x1809('0x12')][_0x1809('0x13')]===0x1f4){logger[_0x1809('0x12')](_0x1809('0xd'),_0xd90ca4,_0x1035da['error'][_0x1809('0x14')]);return _0x1c22d9(_0x1035da[_0x1809('0x12')][_0x1809('0x14')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0xd90ca4,_0x1035da['error'][_0x1809('0x14')]);return _0x14c71c(_0x1035da['error'][_0x1809('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xd90ca4,_0x1809('0x10'));_0x14c71c(_0x1035da[_0x1809('0x15')][_0x1809('0x14')]);}})[_0x1809('0x16')](function(_0x42f21a){logger[_0x1809('0x12')]('FreshsalesField,\x20%s,\x20%s',_0xd90ca4,_0x42f21a);_0x1c22d9(_0x42f21a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4e1295d..cbd61d2 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 _0x9b16=['/:id/fields','getFields','create','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intSalesforceAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x516a58,_0x55347f){var _0x3527f3=function(_0x2b521b){while(--_0x2b521b){_0x516a58['push'](_0x516a58['shift']());}};_0x3527f3(++_0x55347f);}(_0x9b16,0x198));var _0x69b1=function(_0x4377c8,_0x4bf3ea){_0x4377c8=_0x4377c8-0x0;var _0x2a6b41=_0x9b16[_0x4377c8];return _0x2a6b41;};'use strict';var multer=require('multer');var util=require(_0x69b1('0x0'));var path=require(_0x69b1('0x1'));var timeout=require(_0x69b1('0x2'));var express=require(_0x69b1('0x3'));var router=express[_0x69b1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x69b1('0x5'));var config=require('../../config/environment');var controller=require(_0x69b1('0x6'));router[_0x69b1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x69b1('0x7')](_0x69b1('0x8'),auth[_0x69b1('0x9')](),controller[_0x69b1('0xa')]);router['get'](_0x69b1('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x69b1('0xc'),auth[_0x69b1('0x9')](),controller[_0x69b1('0xd')]);router['post']('/',auth[_0x69b1('0x9')](),controller[_0x69b1('0xe')]);router[_0x69b1('0xf')]('/:id/configurations',auth[_0x69b1('0x9')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x69b1('0x10')]);router[_0x69b1('0x11')](_0x69b1('0x8'),auth[_0x69b1('0x9')](),controller[_0x69b1('0x12')]);module[_0x69b1('0x13')]=router; \ No newline at end of file +var _0x6045=['put','update','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x2850de,_0x1121b8){var _0x487dfd=function(_0x4d8266){while(--_0x4d8266){_0x2850de['push'](_0x2850de['shift']());}};_0x487dfd(++_0x1121b8);}(_0x6045,0x12e));var _0x5604=function(_0x1aef90,_0x16a236){_0x1aef90=_0x1aef90-0x0;var _0x1ceaaa=_0x6045[_0x1aef90];return _0x1ceaaa;};'use strict';var multer=require(_0x5604('0x0'));var util=require(_0x5604('0x1'));var path=require(_0x5604('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5604('0x3')]();var auth=require(_0x5604('0x4'));var interaction=require(_0x5604('0x5'));var config=require(_0x5604('0x6'));var controller=require(_0x5604('0x7'));router['get']('/',auth[_0x5604('0x8')](),controller[_0x5604('0x9')]);router[_0x5604('0xa')](_0x5604('0xb'),auth['isAuthenticated'](),controller[_0x5604('0xc')]);router[_0x5604('0xa')](_0x5604('0xd'),auth[_0x5604('0x8')](),controller[_0x5604('0xe')]);router['get'](_0x5604('0xf'),auth[_0x5604('0x8')](),controller[_0x5604('0x10')]);router[_0x5604('0x11')]('/',auth['isAuthenticated'](),controller[_0x5604('0x12')]);router['post'](_0x5604('0xd'),auth['isAuthenticated'](),controller[_0x5604('0x13')]);router[_0x5604('0x14')](_0x5604('0xb'),auth[_0x5604('0x8')](),controller[_0x5604('0x15')]);router['delete']('/:id',auth[_0x5604('0x8')](),controller['destroy']);module[_0x5604('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ffa819b..557a209 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 _0x9e7c=['STRING','username','ENUM','integrationTab','sequelize','exports'];(function(_0x14f2ce,_0x21ac7b){var _0x69ef33=function(_0x13b591){while(--_0x13b591){_0x14f2ce['push'](_0x14f2ce['shift']());}};_0x69ef33(++_0x21ac7b);}(_0x9e7c,0x112));var _0xc9e7=function(_0x196d1e,_0x538527){_0x196d1e=_0x196d1e-0x0;var _0x4fe722=_0x9e7c[_0x196d1e];return _0x4fe722;};'use strict';var Sequelize=require(_0xc9e7('0x0'));module[_0xc9e7('0x1')]={'name':{'type':Sequelize[_0xc9e7('0x2')]},'description':{'type':Sequelize[_0xc9e7('0x2')]},'username':{'type':Sequelize[_0xc9e7('0x2')],'unique':_0xc9e7('0x3')},'remoteUri':{'type':Sequelize[_0xc9e7('0x2')]},'password':{'type':Sequelize[_0xc9e7('0x2')]},'clientId':{'type':Sequelize[_0xc9e7('0x2')]},'clientSecret':{'type':Sequelize[_0xc9e7('0x2')]},'securityToken':{'type':Sequelize[_0xc9e7('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc9e7('0x4')](_0xc9e7('0x5'),'newTab'),'defaultValue':_0xc9e7('0x5')}}; \ No newline at end of file +var _0xe4d9=['exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0xe4d9,0x1ec));var _0x9e4d=function(_0x2c7438,_0x11e31a){_0x2c7438=_0x2c7438-0x0;var _0x3f36dc=_0xe4d9[_0x2c7438];return _0x3f36dc;};'use strict';var Sequelize=require('sequelize');module[_0x9e4d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9e4d('0x1')]},'username':{'type':Sequelize[_0x9e4d('0x1')],'unique':_0x9e4d('0x2')},'remoteUri':{'type':Sequelize[_0x9e4d('0x1')]},'password':{'type':Sequelize[_0x9e4d('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9e4d('0x1')]},'securityToken':{'type':Sequelize[_0x9e4d('0x1')]},'serverUrl':{'type':Sequelize[_0x9e4d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9e4d('0x3')](_0x9e4d('0x4'),_0x9e4d('0x5')),'defaultValue':_0x9e4d('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2b8bf60..ac933ca 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 _0x1eba=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallType','IsArchived','Status','Type','Case','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x5ecf1a,_0x21a27c){var _0x273412=function(_0x18e91a){while(--_0x18e91a){_0x5ecf1a['push'](_0x5ecf1a['shift']());}};_0x273412(++_0x21a27c);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x1eba[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];var integrations=require(_0xa1eb('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xa1eb('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e65dc,_0x35a353,_0x4c7983,_0x25d058){return new BPromise(function(_0x2178e2,_0x14e048){var _0x2877cb=_0x25d058||client;return _0x2877cb[_0xa1eb('0x1b')](_0x4e65dc,_0x4c7983)[_0xa1eb('0x1c')](function(_0x1c858c){logger[_0xa1eb('0x1d')](_0xa1eb('0x1e'),_0x35a353,'request\x20sent');logger[_0xa1eb('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x35a353,_0xa1eb('0x20'),JSON[_0xa1eb('0x21')](_0x1c858c));if(_0x1c858c[_0xa1eb('0x22')]){if(_0x1c858c[_0xa1eb('0x22')]['code']===0x1f4){logger[_0xa1eb('0x22')](_0xa1eb('0x1e'),_0x35a353,_0x1c858c[_0xa1eb('0x22')][_0xa1eb('0x23')]);return _0x14e048(_0x1c858c[_0xa1eb('0x22')][_0xa1eb('0x23')]);}logger[_0xa1eb('0x22')](_0xa1eb('0x1e'),_0x35a353,_0x1c858c['error'][_0xa1eb('0x23')]);return _0x2178e2(_0x1c858c['error'][_0xa1eb('0x23')]);}else{logger[_0xa1eb('0x1d')](_0xa1eb('0x1e'),_0x35a353,_0xa1eb('0x20'));_0x2178e2(_0x1c858c['result']['message']);}})[_0xa1eb('0x24')](function(_0xc64cb9){logger['error'](_0xa1eb('0x1e'),_0x35a353,_0xc64cb9);_0x14e048(_0xc64cb9);});});}function respondWithStatusCode(_0x250728,_0x258d3a){_0x258d3a=_0x258d3a||0xcc;return function(_0xa6b20c){if(_0xa6b20c){return _0x250728[_0xa1eb('0x25')](_0x258d3a);}return _0x250728[_0xa1eb('0x26')](_0x258d3a)[_0xa1eb('0x27')]();};}function respondWithResult(_0x364b1c,_0xd7bb88){_0xd7bb88=_0xd7bb88||0xc8;return function(_0x352796){if(_0x352796){return _0x364b1c[_0xa1eb('0x26')](_0xd7bb88)[_0xa1eb('0x28')](_0x352796);}};}function respondWithFilteredResult(_0x57d089,_0x7c617e){return function(_0xbd5517){if(_0xbd5517){var _0x491f37=_0xbd5517[_0xa1eb('0x29')],_0x2680c0=_0x7c617e['offset'],_0x4e2aa7=_0x7c617e[_0xa1eb('0x2a')]+_0x7c617e[_0xa1eb('0x2b')],_0x3aae71;if(_0x4e2aa7>=_0x491f37){_0x4e2aa7=_0x491f37;_0x3aae71=0xc8;}else{_0x3aae71=0xce;}_0x57d089[_0xa1eb('0x26')](_0x3aae71);return _0x57d089['set'](_0xa1eb('0x2c'),_0x2680c0+'-'+_0x4e2aa7+'/'+_0x491f37)[_0xa1eb('0x28')](_0xbd5517);}return null;};}function patchUpdates(_0x55f5cc){return function(_0x273a42){try{jsonpatch[_0xa1eb('0x2d')](_0x273a42,_0x55f5cc,!![]);}catch(_0x401510){return BPromise[_0xa1eb('0x2e')](_0x401510);}return _0x273a42[_0xa1eb('0x2f')]();};}function saveUpdates(_0x52f9c7,_0x9d49d8){return function(_0x316b02){if(_0x316b02){return _0x316b02[_0xa1eb('0x30')](_0x52f9c7)[_0xa1eb('0x1c')](function(_0x383e26){return _0x383e26;});}return null;};}function removeEntity(_0xcd9efd,_0x1d5b64){return function(_0xcfda64){if(_0xcfda64){return _0xcfda64[_0xa1eb('0x31')]()[_0xa1eb('0x1c')](function(){_0xcd9efd[_0xa1eb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563b11,_0x126d50){return function(_0xb267e0){if(!_0xb267e0){_0x563b11[_0xa1eb('0x25')](0x194);}return _0xb267e0;};}function handleError(_0x36cc2a,_0x2b345a){_0x2b345a=_0x2b345a||0x1f4;return function(_0x58d336){logger['error'](_0x58d336[_0xa1eb('0x32')]);if(_0x58d336[_0xa1eb('0x33')]){delete _0x58d336['name'];}_0x36cc2a['status'](_0x2b345a)[_0xa1eb('0x34')](_0x58d336);};}exports['index']=function(_0x1f33dc,_0x534fe4){var _0x47737d={},_0x3ad54b={},_0x229931={'count':0x0,'rows':[]};var _0x57355f=_[_0xa1eb('0x35')](db[_0xa1eb('0x36')][_0xa1eb('0x37')],function(_0x481405){return{'name':_0x481405[_0xa1eb('0x38')],'type':_0x481405[_0xa1eb('0x39')][_0xa1eb('0x3a')]};});_0x3ad54b[_0xa1eb('0x3b')]=_[_0xa1eb('0x35')](_0x57355f,'name');_0x3ad54b[_0xa1eb('0x3c')]=_[_0xa1eb('0x3d')](_0x1f33dc[_0xa1eb('0x3c')]);_0x3ad54b[_0xa1eb('0x3e')]=_[_0xa1eb('0x3f')](_0x3ad54b[_0xa1eb('0x3b')],_0x3ad54b[_0xa1eb('0x3c')]);_0x47737d[_0xa1eb('0x40')]=_['intersection'](_0x3ad54b[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x41')]));_0x47737d[_0xa1eb('0x40')]=_0x47737d['attributes'][_0xa1eb('0x42')]?_0x47737d[_0xa1eb('0x40')]:_0x3ad54b[_0xa1eb('0x3b')];if(!_0x1f33dc['query'][_0xa1eb('0x43')](_0xa1eb('0x44'))){_0x47737d[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x2b')]);_0x47737d[_0xa1eb('0x2a')]=qs['offset'](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x2a')]);}_0x47737d['order']=qs[_0xa1eb('0x45')](_0x1f33dc['query'][_0xa1eb('0x45')]);_0x47737d[_0xa1eb('0x46')]=qs[_0xa1eb('0x3e')](_[_0xa1eb('0x47')](_0x1f33dc[_0xa1eb('0x3c')],_0x3ad54b[_0xa1eb('0x3e')]),_0x57355f);if(_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x48')]){_0x47737d[_0xa1eb('0x46')]=_[_0xa1eb('0x49')](_0x47737d[_0xa1eb('0x46')],{'$or':_[_0xa1eb('0x35')](_0x57355f,function(_0x459a02){if(_0x459a02[_0xa1eb('0x39')]!==_0xa1eb('0x4a')){var _0x2ee961={};_0x2ee961[_0x459a02['name']]={'$like':'%'+_0x1f33dc[_0xa1eb('0x3c')]['filter']+'%'};return _0x2ee961;}})});}_0x47737d=_[_0xa1eb('0x49')]({},_0x47737d,_0x1f33dc[_0xa1eb('0x4b')]);var _0x54a29f={'where':_0x47737d['where']};return db[_0xa1eb('0x36')][_0xa1eb('0x29')](_0x54a29f)[_0xa1eb('0x1c')](function(_0x55c770){_0x229931[_0xa1eb('0x29')]=_0x55c770;if(_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x4c')]){_0x47737d[_0xa1eb('0x4d')]=[{'all':!![]}];}return db[_0xa1eb('0x36')][_0xa1eb('0x4e')](_0x47737d);})[_0xa1eb('0x1c')](function(_0x3f66a9){_0x229931[_0xa1eb('0x4f')]=_0x3f66a9;return _0x229931;})[_0xa1eb('0x1c')](respondWithFilteredResult(_0x534fe4,_0x47737d))[_0xa1eb('0x24')](handleError(_0x534fe4,null));};exports[_0xa1eb('0x50')]=function(_0x39d3c6,_0x10e15a){var _0x50df09={'raw':![],'where':{'id':_0x39d3c6[_0xa1eb('0x51')]['id']}},_0x41b65a={};_0x41b65a[_0xa1eb('0x3b')]=_[_0xa1eb('0x3d')](db[_0xa1eb('0x36')][_0xa1eb('0x37')]);_0x41b65a[_0xa1eb('0x3c')]=_['keys'](_0x39d3c6[_0xa1eb('0x3c')]);_0x41b65a[_0xa1eb('0x3e')]=_[_0xa1eb('0x3f')](_0x41b65a[_0xa1eb('0x3b')],_0x41b65a[_0xa1eb('0x3c')]);_0x50df09[_0xa1eb('0x40')]=_[_0xa1eb('0x3f')](_0x41b65a[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x39d3c6['query'][_0xa1eb('0x41')]));_0x50df09['attributes']=_0x50df09[_0xa1eb('0x40')]['length']?_0x50df09[_0xa1eb('0x40')]:_0x41b65a[_0xa1eb('0x3b')];if(_0x39d3c6[_0xa1eb('0x3c')]['includeAll']){_0x50df09[_0xa1eb('0x4d')]=[{'all':!![]}];}_0x50df09=_[_0xa1eb('0x49')]({},_0x50df09,_0x39d3c6['options']);return db[_0xa1eb('0x36')][_0xa1eb('0x52')](_0x50df09)[_0xa1eb('0x1c')](handleEntityNotFound(_0x10e15a,null))[_0xa1eb('0x1c')](respondWithResult(_0x10e15a,null))[_0xa1eb('0x24')](handleError(_0x10e15a,null));};exports[_0xa1eb('0x53')]=function(_0x305202,_0x247b08){return db[_0xa1eb('0x36')][_0xa1eb('0x53')](_0x305202[_0xa1eb('0x54')],{})[_0xa1eb('0x1c')](respondWithResult(_0x247b08,0xc9))[_0xa1eb('0x24')](handleError(_0x247b08,null));};exports[_0xa1eb('0x30')]=function(_0x40f119,_0x2ba6c0){if(_0x40f119[_0xa1eb('0x54')]['id']){delete _0x40f119['body']['id'];}return db[_0xa1eb('0x36')][_0xa1eb('0x52')]({'where':{'id':_0x40f119[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x2ba6c0,null))[_0xa1eb('0x1c')](saveUpdates(_0x40f119[_0xa1eb('0x54')],null))['then'](respondWithResult(_0x2ba6c0,null))[_0xa1eb('0x24')](handleError(_0x2ba6c0,null));};exports[_0xa1eb('0x31')]=function(_0x217ecb,_0xf9d185){return db[_0xa1eb('0x36')][_0xa1eb('0x52')]({'where':{'id':_0x217ecb[_0xa1eb('0x51')]['id']}})['then'](handleEntityNotFound(_0xf9d185,null))[_0xa1eb('0x1c')](removeEntity(_0xf9d185,null))[_0xa1eb('0x24')](handleError(_0xf9d185,null));};exports[_0xa1eb('0x55')]=function(_0x1c8fd0,_0x4c30ad,_0x5af1e6){var _0x58ca4e={};var _0x5673fa={};var _0x1b3c33;var _0x1e1e5d;return db['SalesforceAccount'][_0xa1eb('0x56')]({'where':{'id':_0x1c8fd0[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x4c30ad,null))[_0xa1eb('0x1c')](function(_0x4edf8e){if(_0x4edf8e){_0x1b3c33=_0x4edf8e;_0x5673fa['model']=_[_0xa1eb('0x3d')](db[_0xa1eb('0x57')][_0xa1eb('0x37')]);_0x5673fa[_0xa1eb('0x3c')]=_[_0xa1eb('0x3d')](_0x1c8fd0[_0xa1eb('0x3c')]);_0x5673fa['filters']=_['intersection'](_0x5673fa[_0xa1eb('0x3b')],_0x5673fa['query']);_0x58ca4e[_0xa1eb('0x40')]=_['intersection'](_0x5673fa[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x1c8fd0['query'][_0xa1eb('0x41')]));_0x58ca4e[_0xa1eb('0x40')]=_0x58ca4e['attributes'][_0xa1eb('0x42')]?_0x58ca4e[_0xa1eb('0x40')]:_0x5673fa[_0xa1eb('0x3b')];_0x58ca4e['order']=qs[_0xa1eb('0x45')](_0x1c8fd0[_0xa1eb('0x3c')]['sort']);_0x58ca4e[_0xa1eb('0x46')]=qs[_0xa1eb('0x3e')](_[_0xa1eb('0x47')](_0x1c8fd0['query'],_0x5673fa[_0xa1eb('0x3e')]));if(_0x1c8fd0['query'][_0xa1eb('0x48')]){_0x58ca4e[_0xa1eb('0x46')]=_[_0xa1eb('0x49')](_0x58ca4e[_0xa1eb('0x46')],{'$or':_[_0xa1eb('0x35')](_0x58ca4e['attributes'],function(_0x2aba03){var _0x401800={};_0x401800[_0x2aba03]={'$like':'%'+_0x1c8fd0[_0xa1eb('0x3c')]['filter']+'%'};return _0x401800;})});}_0x58ca4e=_[_0xa1eb('0x49')]({},_0x58ca4e,_0x1c8fd0['options']);return _0x1b3c33['getConfigurations'](_0x58ca4e);}})['then'](function(_0x555ded){if(_0x555ded){_0x1e1e5d=_0x555ded[_0xa1eb('0x42')];if(!_0x1c8fd0[_0xa1eb('0x3c')][_0xa1eb('0x43')](_0xa1eb('0x44'))){_0x58ca4e[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1c8fd0[_0xa1eb('0x3c')][_0xa1eb('0x2b')]);_0x58ca4e[_0xa1eb('0x2a')]=qs[_0xa1eb('0x2a')](_0x1c8fd0['query'][_0xa1eb('0x2a')]);}return _0x1b3c33[_0xa1eb('0x55')](_0x58ca4e);}})[_0xa1eb('0x1c')](function(_0x1f9418){if(_0x1f9418){return _0x1f9418?{'count':_0x1e1e5d,'rows':_0x1f9418}:null;}})[_0xa1eb('0x1c')](respondWithResult(_0x4c30ad,null))[_0xa1eb('0x24')](handleError(_0x4c30ad,null));};exports['addConfiguration']=function(_0x113a3a,_0x2b6996,_0x16c5a3){if(_0x113a3a['body']['id']){delete _0x113a3a[_0xa1eb('0x54')]['id'];}return db[_0xa1eb('0x36')][_0xa1eb('0x56')]({'where':{'id':_0x113a3a[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x2b6996,null))['then'](function(_0x2eca4e){if(_0x2eca4e){_0x113a3a['body'][_0xa1eb('0x58')]=_0x2eca4e['id'];_0x113a3a['body'][_0xa1eb('0x59')]=integrations[_0xa1eb('0x5a')](_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x5b')],_0x113a3a['body'][_0xa1eb('0x39')]);_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x5c')]=integrations[_0xa1eb('0x5d')](_0x113a3a['body'][_0xa1eb('0x5b')],_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x39')]);return db[_0xa1eb('0x57')][_0xa1eb('0x53')](_0x113a3a[_0xa1eb('0x54')],{'include':[{'model':db[_0xa1eb('0x5e')],'as':_0xa1eb('0x59')},{'model':db[_0xa1eb('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2b6996,null))['catch'](handleError(_0x2b6996,null));};exports[_0xa1eb('0x5f')]=function(_0x5b7785,_0xa5810,_0x3ec094){var _0x492325;var _0x52522a='';var _0xdcaac3=_0xa1eb('0x60');return db[_0xa1eb('0x36')][_0xa1eb('0x56')]({'where':{'id':_0x5b7785[_0xa1eb('0x51')]['id']},'attributes':['id','remoteUri','clientId',_0xa1eb('0x61'),_0xa1eb('0x62'),_0xa1eb('0x63'),_0xa1eb('0x64')]})['then'](handleEntityNotFound(_0xa5810,null))[_0xa1eb('0x1c')](function(_0x28b3de){if(_0x28b3de){_0x52522a=_0x28b3de[_0xa1eb('0x65')];var _0x4050d6=_0x52522a[_0xa1eb('0x66')](-0x1);if(_0x4050d6==='/'){_0x52522a=_0x52522a[_0xa1eb('0x67')](0x0,_0x52522a[_0xa1eb('0x68')](_0x4050d6));}_0x492325=new jsforce[(_0xa1eb('0x69'))]({'oauth2':{'loginUrl':_0x52522a,'clientId':_0x28b3de[_0xa1eb('0x6a')],'clientSecret':_0x28b3de[_0xa1eb('0x61')]}});return _0x492325[_0xa1eb('0x6b')](_0x28b3de['username'],_0x28b3de[_0xa1eb('0x63')][_0xa1eb('0x6c')](_0x28b3de[_0xa1eb('0x64')]));}})[_0xa1eb('0x1c')](function(_0x3fe7ef){if(_0x3fe7ef){if(!_[_0xa1eb('0x6d')](_0x5b7785['query'][_0xa1eb('0x6e')])){_0xdcaac3=_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')];}return _0x492325[_0xa1eb('0x6f')](_0xdcaac3)['describe']();}})['then'](function(_0xff1843){var _0x5e0cd5=[_0xa1eb('0x70'),_0xa1eb('0x71'),'CallObject',_0xa1eb('0x72'),_0xa1eb('0x73'),'Priority',_0xa1eb('0x74'),_0xa1eb('0x75')];if(!_[_0xa1eb('0x6d')](_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')])&&_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')]===_0xa1eb('0x76')){_0x5e0cd5=[_0xa1eb('0x75'),_0xa1eb('0x77'),_0xa1eb('0x78'),'Status',_0xa1eb('0x79'),_0xa1eb('0x7a'),_0xa1eb('0x7b'),_0xa1eb('0x7c')];}if(_0xff1843){_['remove'](_0xff1843[_0xa1eb('0x41')],function(_0x2ff08e){return _0x2ff08e[_0xa1eb('0x7d')]===![]&&!_0x5e0cd5['includes'](_0x2ff08e[_0xa1eb('0x33')]);});return{'count':_0xff1843[_0xa1eb('0x41')][_0xa1eb('0x42')],'rows':_['map'](_0xff1843[_0xa1eb('0x41')],function(_0x4fb7a7){return{'id':_0x4fb7a7[_0xa1eb('0x33')],'name':_0x4fb7a7[_0xa1eb('0x7e')],'custom':_0x4fb7a7[_0xa1eb('0x7d')],'options':_0x4fb7a7[_0xa1eb('0x7f')][_0xa1eb('0x42')]>0x0?_[_0xa1eb('0x35')](_0x4fb7a7[_0xa1eb('0x7f')],function(_0xc16d28){return{'name':_0xc16d28['label'],'value':_0xc16d28[_0xa1eb('0x80')]};}):_0x4fb7a7[_0xa1eb('0x39')]==_0xa1eb('0x81')?[{'name':_0xa1eb('0x82'),'value':_0xa1eb('0x83')},{'name':'False','value':_0xa1eb('0x84')}]:[]};})};}})[_0xa1eb('0x1c')](respondWithResult(_0xa5810,null))['catch'](function(_0x1e7ce7){var _0x4be2e5=_0x5b7785['query'][_0xa1eb('0x85')]?0x1f4:_0x1e7ce7[_0xa1eb('0x86')]||0x1f4;logger['error'](_0xa1eb('0x87'),_0xa1eb('0x5f'),_0x4be2e5,JSON['stringify'](_0x1e7ce7));delete _0x1e7ce7[_0xa1eb('0x33')];if(_0x4be2e5===0x191){_0x4be2e5=0x190;}_0xa5810[_0xa1eb('0x26')](_0x4be2e5)['send'](_0x5b7785['query'][_0xa1eb('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x1e7ce7[_0xa1eb('0x86')]}:_0x1e7ce7);});}; \ No newline at end of file +var _0x47c5=['offset','limit','json','apply','reject','save','destroy','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','show','include','find','create','body','update','params','getConfigurations','SalesforceConfiguration','sort','addConfiguration','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','findOne','remoteUri','clientId','clientSecret','username','password','securityToken','Connection','login','concat','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','isNil','Case','Type','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count'];(function(_0x23a6f9,_0x2db5fa){var _0x9c537b=function(_0x4bb3de){while(--_0x4bb3de){_0x23a6f9['push'](_0x23a6f9['shift']());}};_0x9c537b(++_0x2db5fa);}(_0x47c5,0x165));var _0x547c=function(_0x39a968,_0x364d93){_0x39a968=_0x39a968-0x0;var _0x47b0a5=_0x47c5[_0x39a968];return _0x47b0a5;};'use strict';var pdf=require(_0x547c('0x0'));var emlformat=require(_0x547c('0x1'));var rimraf=require(_0x547c('0x2'));var zipdir=require(_0x547c('0x3'));var jsonpatch=require(_0x547c('0x4'));var rp=require(_0x547c('0x5'));var moment=require('moment');var BPromise=require(_0x547c('0x6'));var Mustache=require(_0x547c('0x7'));var util=require('util');var path=require(_0x547c('0x8'));var sox=require(_0x547c('0x9'));var csv=require('to-csv');var ejs=require(_0x547c('0xa'));var fs=require('fs');var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x10'));var querystring=require(_0x547c('0x11'));var Papa=require(_0x547c('0x12'));var Redis=require(_0x547c('0x13'));var authService=require(_0x547c('0x14'));var qs=require(_0x547c('0x15'));var as=require(_0x547c('0x16'));var hardwareService=require(_0x547c('0x17'));var logger=require(_0x547c('0x18'))(_0x547c('0x19'));var utils=require(_0x547c('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1b'));var db=require(_0x547c('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x547c('0x1d'));var client=jayson[_0x547c('0x1e')][_0x547c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5016e9,_0x392a35,_0x150317,_0x2bc289){return new BPromise(function(_0xa3c7b0,_0x255aa6){var _0x161991=_0x2bc289||client;return _0x161991[_0x547c('0x20')](_0x5016e9,_0x150317)[_0x547c('0x21')](function(_0x39f316){logger[_0x547c('0x22')](_0x547c('0x23'),_0x392a35,_0x547c('0x24'));logger[_0x547c('0x25')](_0x547c('0x26'),_0x392a35,'request\x20sent',JSON['stringify'](_0x39f316));if(_0x39f316[_0x547c('0x27')]){if(_0x39f316[_0x547c('0x27')][_0x547c('0x28')]===0x1f4){logger['error'](_0x547c('0x23'),_0x392a35,_0x39f316[_0x547c('0x27')][_0x547c('0x29')]);return _0x255aa6(_0x39f316['error'][_0x547c('0x29')]);}logger[_0x547c('0x27')]('SalesforceAccount,\x20%s,\x20%s',_0x392a35,_0x39f316['error'][_0x547c('0x29')]);return _0xa3c7b0(_0x39f316[_0x547c('0x27')]['message']);}else{logger[_0x547c('0x22')](_0x547c('0x23'),_0x392a35,'request\x20sent');_0xa3c7b0(_0x39f316[_0x547c('0x2a')][_0x547c('0x29')]);}})[_0x547c('0x2b')](function(_0x4c718c){logger[_0x547c('0x27')](_0x547c('0x23'),_0x392a35,_0x4c718c);_0x255aa6(_0x4c718c);});});}function respondWithStatusCode(_0x470694,_0x26823c){_0x26823c=_0x26823c||0xcc;return function(_0x1f3581){if(_0x1f3581){return _0x470694[_0x547c('0x2c')](_0x26823c);}return _0x470694[_0x547c('0x2d')](_0x26823c)[_0x547c('0x2e')]();};}function respondWithResult(_0x507895,_0x39c5f9){_0x39c5f9=_0x39c5f9||0xc8;return function(_0x4c66b9){if(_0x4c66b9){return _0x507895['status'](_0x39c5f9)['json'](_0x4c66b9);}};}function respondWithFilteredResult(_0x478f04,_0x2c725d){return function(_0x4c5256){if(_0x4c5256){var _0x93985c=_0x4c5256[_0x547c('0x2f')],_0x5729b0=_0x2c725d[_0x547c('0x30')],_0x3ea493=_0x2c725d[_0x547c('0x30')]+_0x2c725d[_0x547c('0x31')],_0x486216;if(_0x3ea493>=_0x93985c){_0x3ea493=_0x93985c;_0x486216=0xc8;}else{_0x486216=0xce;}_0x478f04[_0x547c('0x2d')](_0x486216);return _0x478f04['set']('Content-Range',_0x5729b0+'-'+_0x3ea493+'/'+_0x93985c)[_0x547c('0x32')](_0x4c5256);}return null;};}function patchUpdates(_0x54de6f){return function(_0x303b57){try{jsonpatch[_0x547c('0x33')](_0x303b57,_0x54de6f,!![]);}catch(_0x3e7652){return BPromise[_0x547c('0x34')](_0x3e7652);}return _0x303b57[_0x547c('0x35')]();};}function saveUpdates(_0x51e6e7,_0x342c10){return function(_0x4d4dbd){if(_0x4d4dbd){return _0x4d4dbd['update'](_0x51e6e7)[_0x547c('0x21')](function(_0x422609){return _0x422609;});}return null;};}function removeEntity(_0x1e4313,_0x26850a){return function(_0x1b8c17){if(_0x1b8c17){return _0x1b8c17[_0x547c('0x36')]()[_0x547c('0x21')](function(){_0x1e4313[_0x547c('0x2d')](0xcc)[_0x547c('0x2e')]();});}};}function handleEntityNotFound(_0x31026e,_0x21174e){return function(_0xbaf7a7){if(!_0xbaf7a7){_0x31026e[_0x547c('0x2c')](0x194);}return _0xbaf7a7;};}function handleError(_0x385275,_0x5e44ba){_0x5e44ba=_0x5e44ba||0x1f4;return function(_0x3afc28){logger['error'](_0x3afc28['stack']);if(_0x3afc28['name']){delete _0x3afc28[_0x547c('0x37')];}_0x385275[_0x547c('0x2d')](_0x5e44ba)[_0x547c('0x38')](_0x3afc28);};}exports[_0x547c('0x39')]=function(_0x14c50c,_0x45f724){var _0x5c920e={},_0x4c0460={},_0x5ea2c7={'count':0x0,'rows':[]};var _0xb51625=_[_0x547c('0x3a')](db[_0x547c('0x3b')][_0x547c('0x3c')],function(_0xe0352c){return{'name':_0xe0352c[_0x547c('0x3d')],'type':_0xe0352c['type'][_0x547c('0x3e')]};});_0x4c0460['model']=_[_0x547c('0x3a')](_0xb51625,_0x547c('0x37'));_0x4c0460['query']=_[_0x547c('0x3f')](_0x14c50c['query']);_0x4c0460['filters']=_[_0x547c('0x40')](_0x4c0460[_0x547c('0x41')],_0x4c0460[_0x547c('0x42')]);_0x5c920e[_0x547c('0x43')]=_['intersection'](_0x4c0460['model'],qs[_0x547c('0x44')](_0x14c50c[_0x547c('0x42')][_0x547c('0x44')]));_0x5c920e['attributes']=_0x5c920e[_0x547c('0x43')][_0x547c('0x45')]?_0x5c920e[_0x547c('0x43')]:_0x4c0460['model'];if(!_0x14c50c[_0x547c('0x42')][_0x547c('0x46')](_0x547c('0x47'))){_0x5c920e['limit']=qs[_0x547c('0x31')](_0x14c50c[_0x547c('0x42')]['limit']);_0x5c920e[_0x547c('0x30')]=qs[_0x547c('0x30')](_0x14c50c[_0x547c('0x42')]['offset']);}_0x5c920e[_0x547c('0x48')]=qs['sort'](_0x14c50c[_0x547c('0x42')]['sort']);_0x5c920e[_0x547c('0x49')]=qs[_0x547c('0x4a')](_[_0x547c('0x4b')](_0x14c50c[_0x547c('0x42')],_0x4c0460[_0x547c('0x4a')]),_0xb51625);if(_0x14c50c[_0x547c('0x42')]['filter']){_0x5c920e['where']=_[_0x547c('0x4c')](_0x5c920e[_0x547c('0x49')],{'$or':_[_0x547c('0x3a')](_0xb51625,function(_0x52c3f7){if(_0x52c3f7[_0x547c('0x4d')]!==_0x547c('0x4e')){var _0x68b66c={};_0x68b66c[_0x52c3f7[_0x547c('0x37')]]={'$like':'%'+_0x14c50c[_0x547c('0x42')][_0x547c('0x4f')]+'%'};return _0x68b66c;}})});}_0x5c920e=_['merge']({},_0x5c920e,_0x14c50c[_0x547c('0x50')]);var _0x3ae2c2={'where':_0x5c920e[_0x547c('0x49')]};return db['SalesforceAccount'][_0x547c('0x2f')](_0x3ae2c2)[_0x547c('0x21')](function(_0xebf295){_0x5ea2c7[_0x547c('0x2f')]=_0xebf295;if(_0x14c50c['query'][_0x547c('0x51')]){_0x5c920e['include']=[{'all':!![]}];}return db[_0x547c('0x3b')]['findAll'](_0x5c920e);})[_0x547c('0x21')](function(_0x1d77a5){_0x5ea2c7['rows']=_0x1d77a5;return _0x5ea2c7;})[_0x547c('0x21')](respondWithFilteredResult(_0x45f724,_0x5c920e))[_0x547c('0x2b')](handleError(_0x45f724,null));};exports[_0x547c('0x52')]=function(_0x1ddf30,_0x52d419){var _0x2cdd66={'raw':![],'where':{'id':_0x1ddf30['params']['id']}},_0x484ede={};_0x484ede[_0x547c('0x41')]=_[_0x547c('0x3f')](db[_0x547c('0x3b')][_0x547c('0x3c')]);_0x484ede[_0x547c('0x42')]=_[_0x547c('0x3f')](_0x1ddf30[_0x547c('0x42')]);_0x484ede[_0x547c('0x4a')]=_[_0x547c('0x40')](_0x484ede[_0x547c('0x41')],_0x484ede[_0x547c('0x42')]);_0x2cdd66[_0x547c('0x43')]=_['intersection'](_0x484ede['model'],qs[_0x547c('0x44')](_0x1ddf30[_0x547c('0x42')]['fields']));_0x2cdd66[_0x547c('0x43')]=_0x2cdd66[_0x547c('0x43')][_0x547c('0x45')]?_0x2cdd66[_0x547c('0x43')]:_0x484ede[_0x547c('0x41')];if(_0x1ddf30[_0x547c('0x42')]['includeAll']){_0x2cdd66[_0x547c('0x53')]=[{'all':!![]}];}_0x2cdd66=_['merge']({},_0x2cdd66,_0x1ddf30[_0x547c('0x50')]);return db[_0x547c('0x3b')][_0x547c('0x54')](_0x2cdd66)['then'](handleEntityNotFound(_0x52d419,null))[_0x547c('0x21')](respondWithResult(_0x52d419,null))['catch'](handleError(_0x52d419,null));};exports[_0x547c('0x55')]=function(_0x166954,_0x533eb0){return db[_0x547c('0x3b')][_0x547c('0x55')](_0x166954[_0x547c('0x56')],{})[_0x547c('0x21')](respondWithResult(_0x533eb0,0xc9))[_0x547c('0x2b')](handleError(_0x533eb0,null));};exports[_0x547c('0x57')]=function(_0x224040,_0x4a42d1){if(_0x224040[_0x547c('0x56')]['id']){delete _0x224040['body']['id'];}return db[_0x547c('0x3b')][_0x547c('0x54')]({'where':{'id':_0x224040[_0x547c('0x58')]['id']}})[_0x547c('0x21')](handleEntityNotFound(_0x4a42d1,null))[_0x547c('0x21')](saveUpdates(_0x224040['body'],null))[_0x547c('0x21')](respondWithResult(_0x4a42d1,null))['catch'](handleError(_0x4a42d1,null));};exports[_0x547c('0x36')]=function(_0x41e85f,_0x202090){return db[_0x547c('0x3b')][_0x547c('0x54')]({'where':{'id':_0x41e85f['params']['id']}})[_0x547c('0x21')](handleEntityNotFound(_0x202090,null))[_0x547c('0x21')](removeEntity(_0x202090,null))['catch'](handleError(_0x202090,null));};exports[_0x547c('0x59')]=function(_0xc58e79,_0x22e016,_0xa83a7e){var _0x53fed6={};var _0x52d134={};var _0x56125c;var _0x188363;return db[_0x547c('0x3b')]['findOne']({'where':{'id':_0xc58e79[_0x547c('0x58')]['id']}})['then'](handleEntityNotFound(_0x22e016,null))[_0x547c('0x21')](function(_0x27842b){if(_0x27842b){_0x56125c=_0x27842b;_0x52d134[_0x547c('0x41')]=_[_0x547c('0x3f')](db[_0x547c('0x5a')][_0x547c('0x3c')]);_0x52d134[_0x547c('0x42')]=_['keys'](_0xc58e79['query']);_0x52d134[_0x547c('0x4a')]=_[_0x547c('0x40')](_0x52d134[_0x547c('0x41')],_0x52d134[_0x547c('0x42')]);_0x53fed6[_0x547c('0x43')]=_['intersection'](_0x52d134['model'],qs['fields'](_0xc58e79['query']['fields']));_0x53fed6[_0x547c('0x43')]=_0x53fed6[_0x547c('0x43')][_0x547c('0x45')]?_0x53fed6['attributes']:_0x52d134[_0x547c('0x41')];_0x53fed6[_0x547c('0x48')]=qs[_0x547c('0x5b')](_0xc58e79[_0x547c('0x42')]['sort']);_0x53fed6['where']=qs['filters'](_[_0x547c('0x4b')](_0xc58e79[_0x547c('0x42')],_0x52d134[_0x547c('0x4a')]));if(_0xc58e79[_0x547c('0x42')][_0x547c('0x4f')]){_0x53fed6['where']=_['merge'](_0x53fed6[_0x547c('0x49')],{'$or':_[_0x547c('0x3a')](_0x53fed6[_0x547c('0x43')],function(_0x70451){var _0xa0fd35={};_0xa0fd35[_0x70451]={'$like':'%'+_0xc58e79['query']['filter']+'%'};return _0xa0fd35;})});}_0x53fed6=_['merge']({},_0x53fed6,_0xc58e79[_0x547c('0x50')]);return _0x56125c['getConfigurations'](_0x53fed6);}})[_0x547c('0x21')](function(_0x36e282){if(_0x36e282){_0x188363=_0x36e282[_0x547c('0x45')];if(!_0xc58e79['query']['hasOwnProperty'](_0x547c('0x47'))){_0x53fed6[_0x547c('0x31')]=qs[_0x547c('0x31')](_0xc58e79[_0x547c('0x42')][_0x547c('0x31')]);_0x53fed6[_0x547c('0x30')]=qs[_0x547c('0x30')](_0xc58e79['query'][_0x547c('0x30')]);}return _0x56125c[_0x547c('0x59')](_0x53fed6);}})[_0x547c('0x21')](function(_0x6bf96d){if(_0x6bf96d){return _0x6bf96d?{'count':_0x188363,'rows':_0x6bf96d}:null;}})[_0x547c('0x21')](respondWithResult(_0x22e016,null))[_0x547c('0x2b')](handleError(_0x22e016,null));};exports[_0x547c('0x5c')]=function(_0x4066ce,_0x49dc3c,_0x1fa11a){if(_0x4066ce[_0x547c('0x56')]['id']){delete _0x4066ce[_0x547c('0x56')]['id'];}return db[_0x547c('0x3b')]['findOne']({'where':{'id':_0x4066ce[_0x547c('0x58')]['id']}})[_0x547c('0x21')](handleEntityNotFound(_0x49dc3c,null))[_0x547c('0x21')](function(_0x4e2acc){if(_0x4e2acc){_0x4066ce['body']['AccountId']=_0x4e2acc['id'];_0x4066ce[_0x547c('0x56')][_0x547c('0x5d')]=integrations[_0x547c('0x5e')](_0x4066ce['body'][_0x547c('0x5f')],_0x4066ce[_0x547c('0x56')][_0x547c('0x4d')]);_0x4066ce[_0x547c('0x56')]['Descriptions']=integrations['getDescriptions'](_0x4066ce[_0x547c('0x56')]['channel'],_0x4066ce[_0x547c('0x56')][_0x547c('0x4d')]);return db['SalesforceConfiguration'][_0x547c('0x55')](_0x4066ce['body'],{'include':[{'model':db[_0x547c('0x60')],'as':_0x547c('0x5d')},{'model':db['SalesforceField'],'as':_0x547c('0x61')}]});}return null;})[_0x547c('0x21')](respondWithResult(_0x49dc3c,null))[_0x547c('0x2b')](handleError(_0x49dc3c,null));};exports[_0x547c('0x62')]=function(_0x4c7e53,_0x535f32,_0xa222f4){var _0x165bfe;var _0x358aed='';var _0x3378a3='Task';return db['SalesforceAccount'][_0x547c('0x63')]({'where':{'id':_0x4c7e53[_0x547c('0x58')]['id']},'attributes':['id',_0x547c('0x64'),_0x547c('0x65'),_0x547c('0x66'),_0x547c('0x67'),_0x547c('0x68'),_0x547c('0x69')]})[_0x547c('0x21')](handleEntityNotFound(_0x535f32,null))[_0x547c('0x21')](function(_0x33f106){if(_0x33f106){_0x358aed=_0x33f106[_0x547c('0x64')];var _0x3b8f45=_0x358aed['slice'](-0x1);if(_0x3b8f45==='/'){_0x358aed=_0x358aed['substring'](0x0,_0x358aed['lastIndexOf'](_0x3b8f45));}_0x165bfe=new jsforce[(_0x547c('0x6a'))]({'oauth2':{'loginUrl':_0x358aed,'clientId':_0x33f106['clientId'],'clientSecret':_0x33f106['clientSecret']}});return _0x165bfe[_0x547c('0x6b')](_0x33f106['username'],_0x33f106['password'][_0x547c('0x6c')](_0x33f106[_0x547c('0x69')]));}})[_0x547c('0x21')](function(_0x1c8fcd){if(_0x1c8fcd){if(!_['isNil'](_0x4c7e53[_0x547c('0x42')][_0x547c('0x6d')])){_0x3378a3=_0x4c7e53['query']['ticketType'];}return _0x165bfe[_0x547c('0x6e')](_0x3378a3)[_0x547c('0x6f')]();}})[_0x547c('0x21')](function(_0x38a01a){var _0x204aad=[_0x547c('0x70'),_0x547c('0x71'),_0x547c('0x72'),'CallType',_0x547c('0x73'),_0x547c('0x74'),_0x547c('0x75'),'Type'];if(!_[_0x547c('0x76')](_0x4c7e53[_0x547c('0x42')][_0x547c('0x6d')])&&_0x4c7e53[_0x547c('0x42')][_0x547c('0x6d')]===_0x547c('0x77')){_0x204aad=[_0x547c('0x78'),_0x547c('0x79'),_0x547c('0x7a'),_0x547c('0x75'),_0x547c('0x74'),_0x547c('0x7b'),_0x547c('0x7c'),_0x547c('0x7d')];}if(_0x38a01a){_['remove'](_0x38a01a[_0x547c('0x44')],function(_0xb3484b){return _0xb3484b[_0x547c('0x7e')]===![]&&!_0x204aad['includes'](_0xb3484b[_0x547c('0x37')]);});return{'count':_0x38a01a[_0x547c('0x44')][_0x547c('0x45')],'rows':_[_0x547c('0x3a')](_0x38a01a[_0x547c('0x44')],function(_0x10fe7b){return{'id':_0x10fe7b[_0x547c('0x37')],'name':_0x10fe7b[_0x547c('0x7f')],'custom':_0x10fe7b[_0x547c('0x7e')],'options':_0x10fe7b[_0x547c('0x80')][_0x547c('0x45')]>0x0?_[_0x547c('0x3a')](_0x10fe7b[_0x547c('0x80')],function(_0x543378){return{'name':_0x543378['label'],'value':_0x543378['value']};}):_0x10fe7b['type']=='boolean'?[{'name':'True','value':_0x547c('0x81')},{'name':_0x547c('0x82'),'value':_0x547c('0x83')}]:[]};})};}})[_0x547c('0x21')](respondWithResult(_0x535f32,null))['catch'](function(_0x2135c1){var _0x11410a=_0x4c7e53[_0x547c('0x42')]['test']?0x1f4:_0x2135c1[_0x547c('0x84')]||0x1f4;logger[_0x547c('0x27')](_0x547c('0x85'),'getFields',_0x11410a,JSON['stringify'](_0x2135c1));delete _0x2135c1['name'];if(_0x11410a===0x191){_0x11410a=0x190;}_0x535f32[_0x547c('0x2d')](_0x11410a)['send'](_0x4c7e53[_0x547c('0x42')][_0x547c('0x86')]?{'message':'Wrong\x20credentials','statusCode':_0x2135c1[_0x547c('0x84')]}:_0x2135c1);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 028d1de..bdb9610 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 _0x8d15=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x8d15,0x10b));var _0x58d1=function(_0x36da6f,_0x5bddd0){_0x36da6f=_0x36da6f-0x0;var _0x5eb864=_0x8d15[_0x36da6f];return _0x5eb864;};'use strict';var _=require(_0x58d1('0x0'));var util=require(_0x58d1('0x1'));var logger=require(_0x58d1('0x2'))(_0x58d1('0x3'));var moment=require('moment');var BPromise=require(_0x58d1('0x4'));var rp=require(_0x58d1('0x5'));var fs=require('fs');var path=require(_0x58d1('0x6'));var rimraf=require(_0x58d1('0x7'));var config=require(_0x58d1('0x8'));var attributes=require(_0x58d1('0x9'));var integrations=require(_0x58d1('0xa'));module['exports']=function(_0x5525d5,_0x2aa9b4){return _0x5525d5[_0x58d1('0xb')](_0x58d1('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09b7=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x09b7,0x1d8));var _0x709b=function(_0x1b6c0c,_0x51ef20){_0x1b6c0c=_0x1b6c0c-0x0;var _0x178991=_0x09b7[_0x1b6c0c];return _0x178991;};'use strict';var _=require(_0x709b('0x0'));var util=require(_0x709b('0x1'));var logger=require(_0x709b('0x2'))(_0x709b('0x3'));var moment=require('moment');var BPromise=require(_0x709b('0x4'));var rp=require(_0x709b('0x5'));var fs=require('fs');var path=require(_0x709b('0x6'));var rimraf=require(_0x709b('0x7'));var config=require(_0x709b('0x8'));var attributes=require(_0x709b('0x9'));var integrations=require(_0x709b('0xa'));module[_0x709b('0xb')]=function(_0x2c4d03,_0x542b34){return _0x2c4d03[_0x709b('0xc')]('SalesforceAccount',attributes,{'tableName':_0x709b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 075dba2..3f7ce3f 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 _0xd87e=['stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','map','include','model','attributes','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0xbe9fe3,_0x1f6f09){var _0x1a39bf=function(_0x467529){while(--_0x467529){_0xbe9fe3['push'](_0xbe9fe3['shift']());}};_0x1a39bf(++_0x1f6f09);}(_0xd87e,0x1bf));var _0xed87=function(_0x53b16b,_0x2a6550){_0x53b16b=_0x53b16b-0x0;var _0x5d10f3=_0xd87e[_0x53b16b];return _0x5d10f3;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da793,_0xa33c67,_0x42fef6){return new BPromise(function(_0x33e1c1,_0x2f348a){return client['request'](_0x5da793,_0x42fef6)[_0xed87('0x9')](function(_0x3dce4b){logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));logger[_0xed87('0xd')](_0xed87('0xe'),_0xa33c67,'request\x20sent',JSON[_0xed87('0xf')](_0x3dce4b));if(_0x3dce4b[_0xed87('0x10')]){if(_0x3dce4b['error'][_0xed87('0x11')]===0x1f4){logger[_0xed87('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0xa33c67,_0x3dce4b['error'][_0xed87('0x12')]);return _0x2f348a(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}logger[_0xed87('0x10')](_0xed87('0xb'),_0xa33c67,_0x3dce4b[_0xed87('0x10')]['message']);return _0x33e1c1(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}else{logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));_0x33e1c1(_0x3dce4b[_0xed87('0x13')][_0xed87('0x12')]);}})[_0xed87('0x14')](function(_0x385859){logger['error'](_0xed87('0xb'),_0xa33c67,_0x385859);_0x2f348a(_0x385859);});});}exports[_0xed87('0x15')]=function(_0x2c386a){var _0xfb8a44=this;return new Promise(function(_0x5f4076,_0x211085){return db[_0xed87('0x16')][_0xed87('0x17')]({'raw':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')][_0xed87('0x19')]===undefined?!![]:![]:!![],'where':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')][_0xed87('0x1a')]||null:null,'attributes':_0x2c386a['options']?_0x2c386a['options']['attributes']||null:null,'limit':_0x2c386a['options']?_0x2c386a[_0xed87('0x18')]['limit']||null:null,'include':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')]['include']?_[_0xed87('0x1b')](_0x2c386a['options'][_0xed87('0x1c')],function(_0x24962e){return{'model':db[_0x24962e[_0xed87('0x1d')]],'as':_0x24962e['as'],'attributes':_0x24962e[_0xed87('0x1e')],'include':_0x24962e[_0xed87('0x1c')]?_['map'](_0x24962e[_0xed87('0x1c')],function(_0x3c22b7){return{'model':db[_0x3c22b7[_0xed87('0x1d')]],'as':_0x3c22b7['as'],'attributes':_0x3c22b7[_0xed87('0x1e')],'include':_0x3c22b7[_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x3c22b7[_0xed87('0x1c')],function(_0x4735b3){return{'model':db[_0x4735b3[_0xed87('0x1d')]],'as':_0x4735b3['as'],'attributes':_0x4735b3[_0xed87('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xed87('0x9')](function(_0x341a35){logger[_0xed87('0xa')](_0xed87('0x15'),_0x2c386a);logger['debug'](_0xed87('0x15'),_0x2c386a,JSON[_0xed87('0xf')](_0x341a35));_0x5f4076(_0x341a35);})['catch'](function(_0x3dff74){logger[_0xed87('0x10')](_0xed87('0x15'),_0x3dff74['message'],_0x2c386a);_0x211085(_0xfb8a44['error'](0x1f4,_0x3dff74[_0xed87('0x12')]));});});};exports[_0xed87('0x1f')]=function(_0x21ab8a){var _0x549a19=this;return new Promise(function(_0x37d45a,_0x3b87e3){return db[_0xed87('0x16')][_0xed87('0x20')]({'raw':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')][_0xed87('0x19')]===undefined?!![]:![]:!![],'where':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')]['where']||null:null,'attributes':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')]['attributes']||null:null,'include':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a['options'][_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x21ab8a[_0xed87('0x18')][_0xed87('0x1c')],function(_0x103b34){return{'model':db[_0x103b34[_0xed87('0x1d')]],'as':_0x103b34['as'],'attributes':_0x103b34[_0xed87('0x1e')],'include':_0x103b34[_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x103b34[_0xed87('0x1c')],function(_0x35c9aa){return{'model':db[_0x35c9aa['model']],'as':_0x35c9aa['as'],'attributes':_0x35c9aa[_0xed87('0x1e')],'include':_0x35c9aa[_0xed87('0x1c')]?_['map'](_0x35c9aa[_0xed87('0x1c')],function(_0x54f6cb){return{'model':db[_0x54f6cb[_0xed87('0x1d')]],'as':_0x54f6cb['as'],'attributes':_0x54f6cb[_0xed87('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x443090){logger[_0xed87('0xa')](_0xed87('0x1f'),_0x21ab8a);logger[_0xed87('0xd')](_0xed87('0x1f'),_0x21ab8a,JSON['stringify'](_0x443090));_0x37d45a(_0x443090);})[_0xed87('0x14')](function(_0x525a11){logger[_0xed87('0x10')]('ShowSalesforceAccount',_0x525a11[_0xed87('0x12')],_0x21ab8a);_0x3b87e3(_0x549a19[_0xed87('0x10')](0x1f4,_0x525a11[_0xed87('0x12')]));});});}; \ No newline at end of file +var _0x39cb=['request','then','info','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','map','include','model','debug','ShowSalesforceAccount','raw','where','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2947cf,_0x53c209){var _0x829621=function(_0x185fcf){while(--_0x185fcf){_0x2947cf['push'](_0x2947cf['shift']());}};_0x829621(++_0x53c209);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});}exports[_0xb39c('0x16')]=function(_0x4e02cf){var _0x35dade=this;return new Promise(function(_0x2eeae6,_0x559ad6){return db[_0xb39c('0x17')][_0xb39c('0x18')]({'raw':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['where']||null:null,'attributes':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')][_0xb39c('0x1a')]||null:null,'limit':_0x4e02cf['options']?_0x4e02cf['options'][_0xb39c('0x1b')]||null:null,'include':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['include']?_[_0xb39c('0x1c')](_0x4e02cf[_0xb39c('0x19')][_0xb39c('0x1d')],function(_0x16f3b0){return{'model':db[_0x16f3b0[_0xb39c('0x1e')]],'as':_0x16f3b0['as'],'attributes':_0x16f3b0['attributes'],'include':_0x16f3b0[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x16f3b0['include'],function(_0x1fd145){return{'model':db[_0x1fd145[_0xb39c('0x1e')]],'as':_0x1fd145['as'],'attributes':_0x1fd145[_0xb39c('0x1a')],'include':_0x1fd145[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x1fd145['include'],function(_0x23a2f1){return{'model':db[_0x23a2f1[_0xb39c('0x1e')]],'as':_0x23a2f1['as'],'attributes':_0x23a2f1[_0xb39c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41fff2){logger[_0xb39c('0xc')]('GetSalesforceAccount',_0x4e02cf);logger[_0xb39c('0x1f')](_0xb39c('0x16'),_0x4e02cf,JSON[_0xb39c('0xf')](_0x41fff2));_0x2eeae6(_0x41fff2);})['catch'](function(_0x714d20){logger[_0xb39c('0x10')]('GetSalesforceAccount',_0x714d20[_0xb39c('0x13')],_0x4e02cf);_0x559ad6(_0x35dade['error'](0x1f4,_0x714d20[_0xb39c('0x13')]));});});};exports[_0xb39c('0x20')]=function(_0x309697){var _0x7339b4=this;return new Promise(function(_0x17eb7b,_0x52e642){return db[_0xb39c('0x17')]['find']({'raw':_0x309697[_0xb39c('0x19')]?_0x309697['options'][_0xb39c('0x21')]===undefined?!![]:![]:!![],'where':_0x309697[_0xb39c('0x19')]?_0x309697[_0xb39c('0x19')][_0xb39c('0x22')]||null:null,'attributes':_0x309697['options']?_0x309697['options'][_0xb39c('0x1a')]||null:null,'include':_0x309697[_0xb39c('0x19')]?_0x309697['options'][_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x309697[_0xb39c('0x19')][_0xb39c('0x1d')],function(_0x14a92f){return{'model':db[_0x14a92f[_0xb39c('0x1e')]],'as':_0x14a92f['as'],'attributes':_0x14a92f[_0xb39c('0x1a')],'include':_0x14a92f[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x14a92f[_0xb39c('0x1d')],function(_0x15882d){return{'model':db[_0x15882d[_0xb39c('0x1e')]],'as':_0x15882d['as'],'attributes':_0x15882d[_0xb39c('0x1a')],'include':_0x15882d[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x15882d[_0xb39c('0x1d')],function(_0x8e5a74){return{'model':db[_0x8e5a74[_0xb39c('0x1e')]],'as':_0x8e5a74['as'],'attributes':_0x8e5a74[_0xb39c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c2b40){logger[_0xb39c('0xc')]('ShowSalesforceAccount',_0x309697);logger['debug']('ShowSalesforceAccount',_0x309697,JSON[_0xb39c('0xf')](_0x2c2b40));_0x17eb7b(_0x2c2b40);})[_0xb39c('0x15')](function(_0xe6bc2e){logger['error'](_0xb39c('0x20'),_0xe6bc2e[_0xb39c('0x13')],_0x309697);_0x52e642(_0x7339b4[_0xb39c('0x10')](0x1f4,_0xe6bc2e[_0xb39c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 41a80f3..0a87540 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 _0x84f3=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','Router','../../config/environment','get','/:id'];(function(_0x4ac2d4,_0x32cd4e){var _0x28e588=function(_0x116262){while(--_0x116262){_0x4ac2d4['push'](_0x4ac2d4['shift']());}};_0x28e588(++_0x32cd4e);}(_0x84f3,0x85));var _0x384f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x84f3[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x384f('0x0'));var util=require(_0x384f('0x1'));var path=require(_0x384f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x384f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x384f('0x4'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x384f('0x5')](_0x384f('0x6'),auth[_0x384f('0x7')](),controller['show']);router[_0x384f('0x5')](_0x384f('0x8'),auth[_0x384f('0x7')](),controller[_0x384f('0x9')]);router[_0x384f('0x5')](_0x384f('0xa'),auth[_0x384f('0x7')](),controller[_0x384f('0xb')]);router[_0x384f('0x5')](_0x384f('0xc'),auth[_0x384f('0x7')](),controller[_0x384f('0xd')]);router[_0x384f('0xe')]('/',auth[_0x384f('0x7')](),controller[_0x384f('0xf')]);router['put'](_0x384f('0x6'),auth['isAuthenticated'](),controller[_0x384f('0x10')]);router[_0x384f('0x11')]('/:id',auth[_0x384f('0x7')](),controller[_0x384f('0x12')]);module[_0x384f('0x13')]=router; \ No newline at end of file +var _0x6864=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index','get'];(function(_0x2ec4d3,_0x544043){var _0x4caf0b=function(_0x3e2935){while(--_0x3e2935){_0x2ec4d3['push'](_0x2ec4d3['shift']());}};_0x4caf0b(++_0x544043);}(_0x6864,0x76));var _0x4686=function(_0x3c6547,_0x1a8870){_0x3c6547=_0x3c6547-0x0;var _0x4da56d=_0x6864[_0x3c6547];return _0x4da56d;};'use strict';var multer=require(_0x4686('0x0'));var util=require(_0x4686('0x1'));var path=require(_0x4686('0x2'));var timeout=require(_0x4686('0x3'));var express=require('express');var router=express[_0x4686('0x4')]();var auth=require(_0x4686('0x5'));var interaction=require(_0x4686('0x6'));var config=require(_0x4686('0x7'));var controller=require(_0x4686('0x8'));router['get']('/',auth[_0x4686('0x9')](),controller[_0x4686('0xa')]);router[_0x4686('0xb')](_0x4686('0xc'),auth[_0x4686('0x9')](),controller[_0x4686('0xd')]);router['get'](_0x4686('0xe'),auth['isAuthenticated'](),controller[_0x4686('0xf')]);router[_0x4686('0xb')](_0x4686('0x10'),auth[_0x4686('0x9')](),controller[_0x4686('0x11')]);router[_0x4686('0xb')](_0x4686('0x12'),auth[_0x4686('0x9')](),controller[_0x4686('0x13')]);router[_0x4686('0x14')]('/',auth[_0x4686('0x9')](),controller[_0x4686('0x15')]);router['put']('/:id',auth[_0x4686('0x9')](),controller[_0x4686('0x16')]);router[_0x4686('0x17')](_0x4686('0xc'),auth['isAuthenticated'](),controller[_0x4686('0x18')]);module[_0x4686('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 708e2b7..2cfb3bc 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 _0x53ac=['sequelize','STRING','Task','contact_lead','lead','ENUM','nothing','contact'];(function(_0x398f30,_0x578f9b){var _0x2ea780=function(_0x153219){while(--_0x153219){_0x398f30['push'](_0x398f30['shift']());}};_0x2ea780(++_0x578f9b);}(_0x53ac,0x1c0));var _0xc53a=function(_0x1ad975,_0x10b8ac){_0x1ad975=_0x1ad975-0x0;var _0x128d79=_0x53ac[_0x1ad975];return _0x128d79;};'use strict';var Sequelize=require(_0xc53a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc53a('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xc53a('0x2'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xc53a('0x3'),'contact',_0xc53a('0x4')),'defaultValue':_0xc53a('0x3')},'moduleCreate':{'type':Sequelize[_0xc53a('0x5')](_0xc53a('0x6'),_0xc53a('0x7'),_0xc53a('0x4')),'defaultValue':_0xc53a('0x4')}}; \ No newline at end of file +var _0x4d61=['STRING','Case','Task','ENUM','contact','contact_lead','nothing','lead'];(function(_0x1acbbb,_0x515b7e){var _0x4018e9=function(_0x4c49c6){while(--_0x4c49c6){_0x1acbbb['push'](_0x1acbbb['shift']());}};_0x4018e9(++_0x515b7e);}(_0x4d61,0x138));var _0x14d6=function(_0x3585cc,_0x43fc48){_0x3585cc=_0x3585cc-0x0;var _0x19e326=_0x4d61[_0x3585cc];return _0x19e326;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x14d6('0x0')]},'description':{'type':Sequelize[_0x14d6('0x0')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x14d6('0x1')),'defaultValue':_0x14d6('0x2')},'moduleSearch':{'type':Sequelize[_0x14d6('0x3')]('contact_lead',_0x14d6('0x4'),'lead'),'defaultValue':_0x14d6('0x5')},'moduleCreate':{'type':Sequelize[_0x14d6('0x3')](_0x14d6('0x6'),'contact',_0x14d6('0x7')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9e617e9..070e51c 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 _0x7cd3=['name','index','map','SalesforceConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','merge','where','includeAll','include','findAll','rows','show','length','options','find','create','body','params','destroy','getFields','findOne','SalesforceField','filter','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','stack'];(function(_0x4a494b,_0x36ed8e){var _0x2a0b30=function(_0x507620){while(--_0x507620){_0x4a494b['push'](_0x4a494b['shift']());}};_0x2a0b30(++_0x36ed8e);}(_0x7cd3,0x7d));var _0x37cd=function(_0x21e5d0,_0x4d09e9){_0x21e5d0=_0x21e5d0-0x0;var _0x3b387d=_0x7cd3[_0x21e5d0];return _0x3b387d;};'use strict';var pdf=require(_0x37cd('0x0'));var emlformat=require(_0x37cd('0x1'));var rimraf=require(_0x37cd('0x2'));var zipdir=require(_0x37cd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37cd('0x4'));var moment=require('moment');var BPromise=require(_0x37cd('0x5'));var Mustache=require(_0x37cd('0x6'));var util=require(_0x37cd('0x7'));var path=require('path');var sox=require(_0x37cd('0x8'));var csv=require('to-csv');var ejs=require(_0x37cd('0x9'));var fs=require('fs');var _=require(_0x37cd('0xa'));var squel=require(_0x37cd('0xb'));var crypto=require(_0x37cd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x37cd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x37cd('0xe'));var Papa=require(_0x37cd('0xf'));var Redis=require(_0x37cd('0x10'));var authService=require(_0x37cd('0x11'));var qs=require(_0x37cd('0x12'));var as=require(_0x37cd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37cd('0x14'))(_0x37cd('0x15'));var utils=require('../../config/utils');var config=require(_0x37cd('0x16'));var licenseUtil=require(_0x37cd('0x17'));var db=require(_0x37cd('0x18'))['db'];var jayson=require(_0x37cd('0x19'));var client=jayson['client'][_0x37cd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f2503,_0x37e6be,_0x1de72b,_0x126231){return new BPromise(function(_0xb10497,_0x46dd1a){var _0x4f6db1=_0x126231||client;return _0x4f6db1['request'](_0x3f2503,_0x1de72b)[_0x37cd('0x1b')](function(_0x2141a9){logger['info'](_0x37cd('0x1c'),_0x37e6be,_0x37cd('0x1d'));logger[_0x37cd('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x37e6be,_0x37cd('0x1d'),JSON[_0x37cd('0x1f')](_0x2141a9));if(_0x2141a9[_0x37cd('0x20')]){if(_0x2141a9[_0x37cd('0x20')]['code']===0x1f4){logger[_0x37cd('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x37e6be,_0x2141a9['error'][_0x37cd('0x21')]);return _0x46dd1a(_0x2141a9['error'][_0x37cd('0x21')]);}logger[_0x37cd('0x20')](_0x37cd('0x1c'),_0x37e6be,_0x2141a9[_0x37cd('0x20')][_0x37cd('0x21')]);return _0xb10497(_0x2141a9[_0x37cd('0x20')][_0x37cd('0x21')]);}else{logger[_0x37cd('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x37e6be,_0x37cd('0x1d'));_0xb10497(_0x2141a9[_0x37cd('0x23')][_0x37cd('0x21')]);}})[_0x37cd('0x24')](function(_0x3a0348){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x37e6be,_0x3a0348);_0x46dd1a(_0x3a0348);});});}function respondWithStatusCode(_0x5e7e93,_0x56cc40){_0x56cc40=_0x56cc40||0xcc;return function(_0x18c258){if(_0x18c258){return _0x5e7e93[_0x37cd('0x25')](_0x56cc40);}return _0x5e7e93['status'](_0x56cc40)[_0x37cd('0x26')]();};}function respondWithResult(_0x55111e,_0x5294c6){_0x5294c6=_0x5294c6||0xc8;return function(_0x578680){if(_0x578680){return _0x55111e[_0x37cd('0x27')](_0x5294c6)[_0x37cd('0x28')](_0x578680);}};}function respondWithFilteredResult(_0x1cbd4e,_0x2ab341){return function(_0x33f219){if(_0x33f219){var _0x1db3e5=_0x33f219[_0x37cd('0x29')],_0x4933af=_0x2ab341[_0x37cd('0x2a')],_0x264685=_0x2ab341[_0x37cd('0x2a')]+_0x2ab341[_0x37cd('0x2b')],_0x4b4b35;if(_0x264685>=_0x1db3e5){_0x264685=_0x1db3e5;_0x4b4b35=0xc8;}else{_0x4b4b35=0xce;}_0x1cbd4e[_0x37cd('0x27')](_0x4b4b35);return _0x1cbd4e[_0x37cd('0x2c')](_0x37cd('0x2d'),_0x4933af+'-'+_0x264685+'/'+_0x1db3e5)[_0x37cd('0x28')](_0x33f219);}return null;};}function patchUpdates(_0x42a9d0){return function(_0x302a47){try{jsonpatch['apply'](_0x302a47,_0x42a9d0,!![]);}catch(_0x7d0fc1){return BPromise['reject'](_0x7d0fc1);}return _0x302a47[_0x37cd('0x2e')]();};}function saveUpdates(_0x469293,_0x434b6b){return function(_0x14ff6e){if(_0x14ff6e){return _0x14ff6e[_0x37cd('0x2f')](_0x469293)[_0x37cd('0x1b')](function(_0x4d26ba){return _0x4d26ba;});}return null;};}function removeEntity(_0xe2f487,_0xb4fb02){return function(_0xac1d9f){if(_0xac1d9f){return _0xac1d9f['destroy']()[_0x37cd('0x1b')](function(){_0xe2f487[_0x37cd('0x27')](0xcc)[_0x37cd('0x26')]();});}};}function handleEntityNotFound(_0x18deac,_0x30e25d){return function(_0x584fa6){if(!_0x584fa6){_0x18deac[_0x37cd('0x25')](0x194);}return _0x584fa6;};}function handleError(_0x23ed30,_0x159583){_0x159583=_0x159583||0x1f4;return function(_0x35a150){logger[_0x37cd('0x20')](_0x35a150[_0x37cd('0x30')]);if(_0x35a150[_0x37cd('0x31')]){delete _0x35a150[_0x37cd('0x31')];}_0x23ed30['status'](_0x159583)['send'](_0x35a150);};}exports[_0x37cd('0x32')]=function(_0x1d0121,_0x1438c8){var _0x2e315f={},_0x2daeb4={},_0x54414b={'count':0x0,'rows':[]};var _0x374487=_[_0x37cd('0x33')](db[_0x37cd('0x34')][_0x37cd('0x35')],function(_0x3ad620){return{'name':_0x3ad620['fieldName'],'type':_0x3ad620[_0x37cd('0x36')]['key']};});_0x2daeb4[_0x37cd('0x37')]=_[_0x37cd('0x33')](_0x374487,_0x37cd('0x31'));_0x2daeb4[_0x37cd('0x38')]=_[_0x37cd('0x39')](_0x1d0121['query']);_0x2daeb4[_0x37cd('0x3a')]=_[_0x37cd('0x3b')](_0x2daeb4[_0x37cd('0x37')],_0x2daeb4[_0x37cd('0x38')]);_0x2e315f['attributes']=_[_0x37cd('0x3b')](_0x2daeb4[_0x37cd('0x37')],qs[_0x37cd('0x3c')](_0x1d0121[_0x37cd('0x38')][_0x37cd('0x3c')]));_0x2e315f[_0x37cd('0x3d')]=_0x2e315f['attributes']['length']?_0x2e315f[_0x37cd('0x3d')]:_0x2daeb4[_0x37cd('0x37')];if(!_0x1d0121['query'][_0x37cd('0x3e')]('nolimit')){_0x2e315f[_0x37cd('0x2b')]=qs['limit'](_0x1d0121[_0x37cd('0x38')][_0x37cd('0x2b')]);_0x2e315f[_0x37cd('0x2a')]=qs[_0x37cd('0x2a')](_0x1d0121['query'][_0x37cd('0x2a')]);}_0x2e315f[_0x37cd('0x3f')]=qs[_0x37cd('0x40')](_0x1d0121[_0x37cd('0x38')][_0x37cd('0x40')]);_0x2e315f['where']=qs[_0x37cd('0x3a')](_[_0x37cd('0x41')](_0x1d0121['query'],_0x2daeb4[_0x37cd('0x3a')]),_0x374487);if(_0x1d0121['query']['filter']){_0x2e315f['where']=_[_0x37cd('0x42')](_0x2e315f[_0x37cd('0x43')],{'$or':_['map'](_0x374487,function(_0x5229e9){if(_0x5229e9['type']!=='VIRTUAL'){var _0x43751d={};_0x43751d[_0x5229e9[_0x37cd('0x31')]]={'$like':'%'+_0x1d0121[_0x37cd('0x38')]['filter']+'%'};return _0x43751d;}})});}_0x2e315f=_[_0x37cd('0x42')]({},_0x2e315f,_0x1d0121['options']);var _0x34caca={'where':_0x2e315f['where']};return db[_0x37cd('0x34')][_0x37cd('0x29')](_0x34caca)[_0x37cd('0x1b')](function(_0x5a01d6){_0x54414b['count']=_0x5a01d6;if(_0x1d0121['query'][_0x37cd('0x44')]){_0x2e315f[_0x37cd('0x45')]=[{'all':!![]}];}return db[_0x37cd('0x34')][_0x37cd('0x46')](_0x2e315f);})[_0x37cd('0x1b')](function(_0x209328){_0x54414b[_0x37cd('0x47')]=_0x209328;return _0x54414b;})['then'](respondWithFilteredResult(_0x1438c8,_0x2e315f))[_0x37cd('0x24')](handleError(_0x1438c8,null));};exports[_0x37cd('0x48')]=function(_0x1835da,_0x555745){var _0x3a7cb3={'raw':![],'where':{'id':_0x1835da['params']['id']}},_0xd8a72b={};_0xd8a72b[_0x37cd('0x37')]=_[_0x37cd('0x39')](db[_0x37cd('0x34')]['rawAttributes']);_0xd8a72b['query']=_[_0x37cd('0x39')](_0x1835da[_0x37cd('0x38')]);_0xd8a72b[_0x37cd('0x3a')]=_['intersection'](_0xd8a72b['model'],_0xd8a72b[_0x37cd('0x38')]);_0x3a7cb3[_0x37cd('0x3d')]=_['intersection'](_0xd8a72b[_0x37cd('0x37')],qs[_0x37cd('0x3c')](_0x1835da[_0x37cd('0x38')][_0x37cd('0x3c')]));_0x3a7cb3['attributes']=_0x3a7cb3[_0x37cd('0x3d')][_0x37cd('0x49')]?_0x3a7cb3[_0x37cd('0x3d')]:_0xd8a72b[_0x37cd('0x37')];if(_0x1835da[_0x37cd('0x38')]['includeAll']){_0x3a7cb3[_0x37cd('0x45')]=[{'all':!![]}];}_0x3a7cb3=_[_0x37cd('0x42')]({},_0x3a7cb3,_0x1835da[_0x37cd('0x4a')]);return db[_0x37cd('0x34')][_0x37cd('0x4b')](_0x3a7cb3)[_0x37cd('0x1b')](handleEntityNotFound(_0x555745,null))[_0x37cd('0x1b')](respondWithResult(_0x555745,null))[_0x37cd('0x24')](handleError(_0x555745,null));};exports[_0x37cd('0x4c')]=function(_0x31f683,_0x1044e6){return db['SalesforceConfiguration'][_0x37cd('0x4c')](_0x31f683['body'],{})[_0x37cd('0x1b')](respondWithResult(_0x1044e6,0xc9))[_0x37cd('0x24')](handleError(_0x1044e6,null));};exports[_0x37cd('0x2f')]=function(_0x30a7ec,_0x1e426a){if(_0x30a7ec[_0x37cd('0x4d')]['id']){delete _0x30a7ec['body']['id'];}return db[_0x37cd('0x34')]['find']({'where':{'id':_0x30a7ec[_0x37cd('0x4e')]['id']}})[_0x37cd('0x1b')](handleEntityNotFound(_0x1e426a,null))[_0x37cd('0x1b')](saveUpdates(_0x30a7ec[_0x37cd('0x4d')],null))['then'](respondWithResult(_0x1e426a,null))['catch'](handleError(_0x1e426a,null));};exports[_0x37cd('0x4f')]=function(_0x3f2b96,_0x53958e){return db['SalesforceConfiguration']['find']({'where':{'id':_0x3f2b96[_0x37cd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53958e,null))['then'](removeEntity(_0x53958e,null))[_0x37cd('0x24')](handleError(_0x53958e,null));};exports[_0x37cd('0x50')]=function(_0x3cfa4b,_0x41de8e,_0x2a1263){var _0x1602fe={};var _0x47f566={};var _0x289b93;var _0x21e267;return db[_0x37cd('0x34')][_0x37cd('0x51')]({'where':{'id':_0x3cfa4b[_0x37cd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x41de8e,null))[_0x37cd('0x1b')](function(_0x11d2b3){if(_0x11d2b3){_0x289b93=_0x11d2b3;_0x47f566['model']=_[_0x37cd('0x39')](db[_0x37cd('0x52')]['rawAttributes']);_0x47f566[_0x37cd('0x38')]=_[_0x37cd('0x39')](_0x3cfa4b['query']);_0x47f566[_0x37cd('0x3a')]=_[_0x37cd('0x3b')](_0x47f566['model'],_0x47f566[_0x37cd('0x38')]);_0x1602fe[_0x37cd('0x3d')]=_[_0x37cd('0x3b')](_0x47f566[_0x37cd('0x37')],qs[_0x37cd('0x3c')](_0x3cfa4b[_0x37cd('0x38')][_0x37cd('0x3c')]));_0x1602fe[_0x37cd('0x3d')]=_0x1602fe[_0x37cd('0x3d')][_0x37cd('0x49')]?_0x1602fe[_0x37cd('0x3d')]:_0x47f566[_0x37cd('0x37')];_0x1602fe[_0x37cd('0x3f')]=qs[_0x37cd('0x40')](_0x3cfa4b[_0x37cd('0x38')]['sort']);_0x1602fe[_0x37cd('0x43')]=qs['filters'](_[_0x37cd('0x41')](_0x3cfa4b['query'],_0x47f566[_0x37cd('0x3a')]));if(_0x3cfa4b[_0x37cd('0x38')][_0x37cd('0x53')]){_0x1602fe[_0x37cd('0x43')]=_['merge'](_0x1602fe[_0x37cd('0x43')],{'$or':_[_0x37cd('0x33')](_0x1602fe[_0x37cd('0x3d')],function(_0x23629c){var _0x21e946={};_0x21e946[_0x23629c]={'$like':'%'+_0x3cfa4b[_0x37cd('0x38')][_0x37cd('0x53')]+'%'};return _0x21e946;})});}_0x1602fe=_[_0x37cd('0x42')]({},_0x1602fe,_0x3cfa4b[_0x37cd('0x4a')]);return _0x289b93['getFields'](_0x1602fe);}})['then'](function(_0x35ed36){if(_0x35ed36){_0x21e267=_0x35ed36[_0x37cd('0x49')];if(!_0x3cfa4b[_0x37cd('0x38')][_0x37cd('0x3e')](_0x37cd('0x54'))){_0x1602fe['limit']=qs[_0x37cd('0x2b')](_0x3cfa4b[_0x37cd('0x38')][_0x37cd('0x2b')]);_0x1602fe[_0x37cd('0x2a')]=qs[_0x37cd('0x2a')](_0x3cfa4b[_0x37cd('0x38')][_0x37cd('0x2a')]);}return _0x289b93[_0x37cd('0x50')](_0x1602fe);}})[_0x37cd('0x1b')](function(_0x48138f){if(_0x48138f){return _0x48138f?{'count':_0x21e267,'rows':_0x48138f}:null;}})['then'](respondWithResult(_0x41de8e,null))['catch'](handleError(_0x41de8e,null));};exports['getSubjects']=function(_0x1a8e8c,_0x5c5409,_0x3e623f){var _0x270bde={};var _0x6ad4d={};var _0x44dfe7;var _0x56ae66;return db[_0x37cd('0x34')][_0x37cd('0x51')]({'where':{'id':_0x1a8e8c[_0x37cd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5c5409,null))['then'](function(_0x5c46b7){if(_0x5c46b7){_0x44dfe7=_0x5c46b7;_0x6ad4d[_0x37cd('0x37')]=_[_0x37cd('0x39')](db[_0x37cd('0x52')]['rawAttributes']);_0x6ad4d['query']=_['keys'](_0x1a8e8c['query']);_0x6ad4d[_0x37cd('0x3a')]=_[_0x37cd('0x3b')](_0x6ad4d[_0x37cd('0x37')],_0x6ad4d[_0x37cd('0x38')]);_0x270bde[_0x37cd('0x3d')]=_['intersection'](_0x6ad4d[_0x37cd('0x37')],qs[_0x37cd('0x3c')](_0x1a8e8c[_0x37cd('0x38')][_0x37cd('0x3c')]));_0x270bde[_0x37cd('0x3d')]=_0x270bde[_0x37cd('0x3d')][_0x37cd('0x49')]?_0x270bde[_0x37cd('0x3d')]:_0x6ad4d[_0x37cd('0x37')];_0x270bde[_0x37cd('0x3f')]=qs[_0x37cd('0x40')](_0x1a8e8c[_0x37cd('0x38')]['sort']);_0x270bde[_0x37cd('0x43')]=qs[_0x37cd('0x3a')](_[_0x37cd('0x41')](_0x1a8e8c['query'],_0x6ad4d[_0x37cd('0x3a')]));if(_0x1a8e8c[_0x37cd('0x38')][_0x37cd('0x53')]){_0x270bde[_0x37cd('0x43')]=_[_0x37cd('0x42')](_0x270bde[_0x37cd('0x43')],{'$or':_['map'](_0x270bde[_0x37cd('0x3d')],function(_0x6b596){var _0x56e5a7={};_0x56e5a7[_0x6b596]={'$like':'%'+_0x1a8e8c[_0x37cd('0x38')][_0x37cd('0x53')]+'%'};return _0x56e5a7;})});}_0x270bde=_[_0x37cd('0x42')]({},_0x270bde,_0x1a8e8c[_0x37cd('0x4a')]);return _0x44dfe7[_0x37cd('0x55')](_0x270bde);}})[_0x37cd('0x1b')](function(_0x122a94){if(_0x122a94){_0x56ae66=_0x122a94[_0x37cd('0x49')];if(!_0x1a8e8c[_0x37cd('0x38')][_0x37cd('0x3e')]('nolimit')){_0x270bde[_0x37cd('0x2b')]=qs[_0x37cd('0x2b')](_0x1a8e8c[_0x37cd('0x38')][_0x37cd('0x2b')]);_0x270bde[_0x37cd('0x2a')]=qs[_0x37cd('0x2a')](_0x1a8e8c[_0x37cd('0x38')][_0x37cd('0x2a')]);}return _0x44dfe7[_0x37cd('0x55')](_0x270bde);}})[_0x37cd('0x1b')](function(_0x5651e0){if(_0x5651e0){return _0x5651e0?{'count':_0x56ae66,'rows':_0x5651e0}:null;}})[_0x37cd('0x1b')](respondWithResult(_0x5c5409,null))[_0x37cd('0x24')](handleError(_0x5c5409,null));};exports[_0x37cd('0x56')]=function(_0x413c2e,_0x151fb1,_0x388c1c){var _0x137624={};var _0x17aba8={};var _0x4b59bf;var _0x299f07;return db[_0x37cd('0x34')][_0x37cd('0x51')]({'where':{'id':_0x413c2e[_0x37cd('0x4e')]['id']}})[_0x37cd('0x1b')](handleEntityNotFound(_0x151fb1,null))[_0x37cd('0x1b')](function(_0xa9a62c){if(_0xa9a62c){_0x4b59bf=_0xa9a62c;_0x17aba8['model']=_[_0x37cd('0x39')](db['SalesforceField'][_0x37cd('0x35')]);_0x17aba8[_0x37cd('0x38')]=_[_0x37cd('0x39')](_0x413c2e[_0x37cd('0x38')]);_0x17aba8[_0x37cd('0x3a')]=_[_0x37cd('0x3b')](_0x17aba8['model'],_0x17aba8[_0x37cd('0x38')]);_0x137624['attributes']=_[_0x37cd('0x3b')](_0x17aba8[_0x37cd('0x37')],qs[_0x37cd('0x3c')](_0x413c2e['query']['fields']));_0x137624[_0x37cd('0x3d')]=_0x137624[_0x37cd('0x3d')][_0x37cd('0x49')]?_0x137624[_0x37cd('0x3d')]:_0x17aba8[_0x37cd('0x37')];_0x137624[_0x37cd('0x3f')]=qs[_0x37cd('0x40')](_0x413c2e[_0x37cd('0x38')][_0x37cd('0x40')]);_0x137624[_0x37cd('0x43')]=qs[_0x37cd('0x3a')](_['pick'](_0x413c2e[_0x37cd('0x38')],_0x17aba8[_0x37cd('0x3a')]));if(_0x413c2e[_0x37cd('0x38')]['filter']){_0x137624['where']=_[_0x37cd('0x42')](_0x137624[_0x37cd('0x43')],{'$or':_['map'](_0x137624['attributes'],function(_0xc5c15a){var _0x558945={};_0x558945[_0xc5c15a]={'$like':'%'+_0x413c2e[_0x37cd('0x38')][_0x37cd('0x53')]+'%'};return _0x558945;})});}_0x137624=_[_0x37cd('0x42')]({},_0x137624,_0x413c2e[_0x37cd('0x4a')]);return _0x4b59bf[_0x37cd('0x56')](_0x137624);}})[_0x37cd('0x1b')](function(_0x23cbb4){if(_0x23cbb4){_0x299f07=_0x23cbb4[_0x37cd('0x49')];if(!_0x413c2e[_0x37cd('0x38')][_0x37cd('0x3e')]('nolimit')){_0x137624['limit']=qs['limit'](_0x413c2e[_0x37cd('0x38')][_0x37cd('0x2b')]);_0x137624[_0x37cd('0x2a')]=qs[_0x37cd('0x2a')](_0x413c2e[_0x37cd('0x38')][_0x37cd('0x2a')]);}return _0x4b59bf['getDescriptions'](_0x137624);}})['then'](function(_0x266c5b){if(_0x266c5b){return _0x266c5b?{'count':_0x299f07,'rows':_0x266c5b}:null;}})[_0x37cd('0x1b')](respondWithResult(_0x151fb1,null))[_0x37cd('0x24')](handleError(_0x151fb1,null));}; \ No newline at end of file +var _0x3ce7=['filters','pick','filter','where','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','findOne','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','update','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort'];(function(_0x563831,_0x4d848d){var _0x55b88b=function(_0x342dcc){while(--_0x342dcc){_0x563831['push'](_0x563831['shift']());}};_0x55b88b(++_0x4d848d);}(_0x3ce7,0x73));var _0x73ce=function(_0x3e572e,_0x11e2ab){_0x3e572e=_0x3e572e-0x0;var _0x5a36e6=_0x3ce7[_0x3e572e];return _0x5a36e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x73ce('0x0'));var rimraf=require(_0x73ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73ce('0x2'));var rp=require(_0x73ce('0x3'));var moment=require('moment');var BPromise=require(_0x73ce('0x4'));var Mustache=require(_0x73ce('0x5'));var util=require(_0x73ce('0x6'));var path=require(_0x73ce('0x7'));var sox=require('sox');var csv=require(_0x73ce('0x8'));var ejs=require(_0x73ce('0x9'));var fs=require('fs');var _=require(_0x73ce('0xa'));var squel=require(_0x73ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x73ce('0xc'));var deskjs=require(_0x73ce('0xd'));var toCsv=require(_0x73ce('0x8'));var querystring=require('querystring');var Papa=require(_0x73ce('0xe'));var Redis=require(_0x73ce('0xf'));var authService=require(_0x73ce('0x10'));var qs=require(_0x73ce('0x11'));var as=require(_0x73ce('0x12'));var hardwareService=require(_0x73ce('0x13'));var logger=require(_0x73ce('0x14'))(_0x73ce('0x15'));var utils=require(_0x73ce('0x16'));var config=require(_0x73ce('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x73ce('0x18'))['db'];var jayson=require(_0x73ce('0x19'));var client=jayson[_0x73ce('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf88e70,_0x5d6429,_0x4c1608,_0x4da9dd){return new BPromise(function(_0x2956f8,_0x252748){var _0x2f56ff=_0x4da9dd||client;return _0x2f56ff[_0x73ce('0x1b')](_0xf88e70,_0x4c1608)[_0x73ce('0x1c')](function(_0x2afaff){logger[_0x73ce('0x1d')](_0x73ce('0x1e'),_0x5d6429,'request\x20sent');logger['debug'](_0x73ce('0x1f'),_0x5d6429,_0x73ce('0x20'),JSON[_0x73ce('0x21')](_0x2afaff));if(_0x2afaff[_0x73ce('0x22')]){if(_0x2afaff['error'][_0x73ce('0x23')]===0x1f4){logger[_0x73ce('0x22')](_0x73ce('0x1e'),_0x5d6429,_0x2afaff[_0x73ce('0x22')][_0x73ce('0x24')]);return _0x252748(_0x2afaff[_0x73ce('0x22')][_0x73ce('0x24')]);}logger[_0x73ce('0x22')](_0x73ce('0x1e'),_0x5d6429,_0x2afaff[_0x73ce('0x22')][_0x73ce('0x24')]);return _0x2956f8(_0x2afaff[_0x73ce('0x22')][_0x73ce('0x24')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5d6429,_0x73ce('0x20'));_0x2956f8(_0x2afaff[_0x73ce('0x25')]['message']);}})[_0x73ce('0x26')](function(_0x149dd9){logger[_0x73ce('0x22')](_0x73ce('0x1e'),_0x5d6429,_0x149dd9);_0x252748(_0x149dd9);});});}function respondWithStatusCode(_0x1a665a,_0x4c4228){_0x4c4228=_0x4c4228||0xcc;return function(_0x237563){if(_0x237563){return _0x1a665a['sendStatus'](_0x4c4228);}return _0x1a665a['status'](_0x4c4228)[_0x73ce('0x27')]();};}function respondWithResult(_0x448c61,_0x199205){_0x199205=_0x199205||0xc8;return function(_0x13fbcd){if(_0x13fbcd){return _0x448c61[_0x73ce('0x28')](_0x199205)[_0x73ce('0x29')](_0x13fbcd);}};}function respondWithFilteredResult(_0x3de9c6,_0x5d7493){return function(_0x29d2d0){if(_0x29d2d0){var _0x1a5309=_0x29d2d0[_0x73ce('0x2a')],_0x2291be=_0x5d7493['offset'],_0x4176a1=_0x5d7493[_0x73ce('0x2b')]+_0x5d7493[_0x73ce('0x2c')],_0x3c0eae;if(_0x4176a1>=_0x1a5309){_0x4176a1=_0x1a5309;_0x3c0eae=0xc8;}else{_0x3c0eae=0xce;}_0x3de9c6[_0x73ce('0x28')](_0x3c0eae);return _0x3de9c6['set'](_0x73ce('0x2d'),_0x2291be+'-'+_0x4176a1+'/'+_0x1a5309)[_0x73ce('0x29')](_0x29d2d0);}return null;};}function patchUpdates(_0xf9d5d6){return function(_0x325e5c){try{jsonpatch[_0x73ce('0x2e')](_0x325e5c,_0xf9d5d6,!![]);}catch(_0x1e0d16){return BPromise[_0x73ce('0x2f')](_0x1e0d16);}return _0x325e5c['save']();};}function saveUpdates(_0x1eb6d3,_0x1921d7){return function(_0x1e0ba7){if(_0x1e0ba7){return _0x1e0ba7[_0x73ce('0x30')](_0x1eb6d3)[_0x73ce('0x1c')](function(_0x16e8ad){return _0x16e8ad;});}return null;};}function removeEntity(_0x474e83,_0x154ff6){return function(_0x3b5112){if(_0x3b5112){return _0x3b5112['destroy']()[_0x73ce('0x1c')](function(){_0x474e83[_0x73ce('0x28')](0xcc)[_0x73ce('0x27')]();});}};}function handleEntityNotFound(_0x3d907a,_0x52f7cf){return function(_0x29caf1){if(!_0x29caf1){_0x3d907a[_0x73ce('0x31')](0x194);}return _0x29caf1;};}function handleError(_0x293ec9,_0x33dfb1){_0x33dfb1=_0x33dfb1||0x1f4;return function(_0x1b7517){logger['error'](_0x1b7517[_0x73ce('0x32')]);if(_0x1b7517[_0x73ce('0x33')]){delete _0x1b7517[_0x73ce('0x33')];}_0x293ec9[_0x73ce('0x28')](_0x33dfb1)['send'](_0x1b7517);};}exports[_0x73ce('0x34')]=function(_0x30f6a5,_0x24bdad){var _0x5a25a4={},_0x2ba473={},_0x47005e={'count':0x0,'rows':[]};var _0xce6d15=_['map'](db['SalesforceConfiguration'][_0x73ce('0x35')],function(_0x3cea9b){return{'name':_0x3cea9b[_0x73ce('0x36')],'type':_0x3cea9b[_0x73ce('0x37')][_0x73ce('0x38')]};});_0x2ba473[_0x73ce('0x39')]=_[_0x73ce('0x3a')](_0xce6d15,_0x73ce('0x33'));_0x2ba473[_0x73ce('0x3b')]=_[_0x73ce('0x3c')](_0x30f6a5[_0x73ce('0x3b')]);_0x2ba473['filters']=_[_0x73ce('0x3d')](_0x2ba473[_0x73ce('0x39')],_0x2ba473[_0x73ce('0x3b')]);_0x5a25a4[_0x73ce('0x3e')]=_['intersection'](_0x2ba473['model'],qs['fields'](_0x30f6a5[_0x73ce('0x3b')][_0x73ce('0x3f')]));_0x5a25a4['attributes']=_0x5a25a4[_0x73ce('0x3e')][_0x73ce('0x40')]?_0x5a25a4['attributes']:_0x2ba473[_0x73ce('0x39')];if(!_0x30f6a5[_0x73ce('0x3b')]['hasOwnProperty']('nolimit')){_0x5a25a4[_0x73ce('0x2c')]=qs['limit'](_0x30f6a5[_0x73ce('0x3b')][_0x73ce('0x2c')]);_0x5a25a4[_0x73ce('0x2b')]=qs[_0x73ce('0x2b')](_0x30f6a5['query'][_0x73ce('0x2b')]);}_0x5a25a4[_0x73ce('0x41')]=qs[_0x73ce('0x42')](_0x30f6a5[_0x73ce('0x3b')][_0x73ce('0x42')]);_0x5a25a4['where']=qs[_0x73ce('0x43')](_[_0x73ce('0x44')](_0x30f6a5[_0x73ce('0x3b')],_0x2ba473['filters']),_0xce6d15);if(_0x30f6a5['query'][_0x73ce('0x45')]){_0x5a25a4[_0x73ce('0x46')]=_[_0x73ce('0x47')](_0x5a25a4['where'],{'$or':_[_0x73ce('0x3a')](_0xce6d15,function(_0x3cf75b){if(_0x3cf75b[_0x73ce('0x37')]!==_0x73ce('0x48')){var _0x3d2f9e={};_0x3d2f9e[_0x3cf75b['name']]={'$like':'%'+_0x30f6a5[_0x73ce('0x3b')][_0x73ce('0x45')]+'%'};return _0x3d2f9e;}})});}_0x5a25a4=_[_0x73ce('0x47')]({},_0x5a25a4,_0x30f6a5[_0x73ce('0x49')]);var _0x216ab2={'where':_0x5a25a4[_0x73ce('0x46')]};return db[_0x73ce('0x4a')][_0x73ce('0x2a')](_0x216ab2)[_0x73ce('0x1c')](function(_0x53b898){_0x47005e[_0x73ce('0x2a')]=_0x53b898;if(_0x30f6a5[_0x73ce('0x3b')][_0x73ce('0x4b')]){_0x5a25a4[_0x73ce('0x4c')]=[{'all':!![]}];}return db[_0x73ce('0x4a')][_0x73ce('0x4d')](_0x5a25a4);})[_0x73ce('0x1c')](function(_0x393c7f){_0x47005e[_0x73ce('0x4e')]=_0x393c7f;return _0x47005e;})['then'](respondWithFilteredResult(_0x24bdad,_0x5a25a4))['catch'](handleError(_0x24bdad,null));};exports[_0x73ce('0x4f')]=function(_0x228248,_0x5d29f4){var _0x25dd9b={'raw':![],'where':{'id':_0x228248[_0x73ce('0x50')]['id']}},_0x16d0c2={};_0x16d0c2[_0x73ce('0x39')]=_[_0x73ce('0x3c')](db[_0x73ce('0x4a')][_0x73ce('0x35')]);_0x16d0c2['query']=_[_0x73ce('0x3c')](_0x228248[_0x73ce('0x3b')]);_0x16d0c2[_0x73ce('0x43')]=_[_0x73ce('0x3d')](_0x16d0c2[_0x73ce('0x39')],_0x16d0c2['query']);_0x25dd9b[_0x73ce('0x3e')]=_[_0x73ce('0x3d')](_0x16d0c2[_0x73ce('0x39')],qs[_0x73ce('0x3f')](_0x228248[_0x73ce('0x3b')][_0x73ce('0x3f')]));_0x25dd9b[_0x73ce('0x3e')]=_0x25dd9b[_0x73ce('0x3e')]['length']?_0x25dd9b[_0x73ce('0x3e')]:_0x16d0c2[_0x73ce('0x39')];if(_0x228248[_0x73ce('0x3b')]['includeAll']){_0x25dd9b[_0x73ce('0x4c')]=[{'all':!![]}];}_0x25dd9b=_[_0x73ce('0x47')]({},_0x25dd9b,_0x228248['options']);return db[_0x73ce('0x4a')][_0x73ce('0x51')](_0x25dd9b)[_0x73ce('0x1c')](handleEntityNotFound(_0x5d29f4,null))['then'](respondWithResult(_0x5d29f4,null))['catch'](handleError(_0x5d29f4,null));};exports[_0x73ce('0x52')]=function(_0x2794dc,_0x5b07be){return db[_0x73ce('0x4a')]['create'](_0x2794dc[_0x73ce('0x53')],{})[_0x73ce('0x1c')](respondWithResult(_0x5b07be,0xc9))[_0x73ce('0x26')](handleError(_0x5b07be,null));};exports[_0x73ce('0x30')]=function(_0x27b2d1,_0xf749f9){if(_0x27b2d1[_0x73ce('0x53')]['id']){delete _0x27b2d1['body']['id'];}return db[_0x73ce('0x4a')][_0x73ce('0x51')]({'where':{'id':_0x27b2d1['params']['id']}})[_0x73ce('0x1c')](handleEntityNotFound(_0xf749f9,null))[_0x73ce('0x1c')](saveUpdates(_0x27b2d1[_0x73ce('0x53')],null))[_0x73ce('0x1c')](respondWithResult(_0xf749f9,null))[_0x73ce('0x26')](handleError(_0xf749f9,null));};exports[_0x73ce('0x54')]=function(_0x43416f,_0x2cd9d4){return db[_0x73ce('0x4a')][_0x73ce('0x51')]({'where':{'id':_0x43416f[_0x73ce('0x50')]['id']}})[_0x73ce('0x1c')](handleEntityNotFound(_0x2cd9d4,null))[_0x73ce('0x1c')](removeEntity(_0x2cd9d4,null))[_0x73ce('0x26')](handleError(_0x2cd9d4,null));};exports[_0x73ce('0x55')]=function(_0x64f16,_0x385569,_0x5d2b33){var _0x4e72a9={};var _0x5e91da={};var _0x43d55b;var _0x5f02c3;return db[_0x73ce('0x4a')][_0x73ce('0x56')]({'where':{'id':_0x64f16['params']['id']}})['then'](handleEntityNotFound(_0x385569,null))['then'](function(_0x20d97e){if(_0x20d97e){_0x43d55b=_0x20d97e;_0x5e91da['model']=_['keys'](db['SalesforceField'][_0x73ce('0x35')]);_0x5e91da[_0x73ce('0x3b')]=_[_0x73ce('0x3c')](_0x64f16['query']);_0x5e91da[_0x73ce('0x43')]=_['intersection'](_0x5e91da['model'],_0x5e91da[_0x73ce('0x3b')]);_0x4e72a9['attributes']=_[_0x73ce('0x3d')](_0x5e91da[_0x73ce('0x39')],qs[_0x73ce('0x3f')](_0x64f16[_0x73ce('0x3b')][_0x73ce('0x3f')]));_0x4e72a9[_0x73ce('0x3e')]=_0x4e72a9['attributes'][_0x73ce('0x40')]?_0x4e72a9[_0x73ce('0x3e')]:_0x5e91da[_0x73ce('0x39')];_0x4e72a9['order']=qs[_0x73ce('0x42')](_0x64f16[_0x73ce('0x3b')][_0x73ce('0x42')]);_0x4e72a9['where']=qs[_0x73ce('0x43')](_['pick'](_0x64f16[_0x73ce('0x3b')],_0x5e91da[_0x73ce('0x43')]));if(_0x64f16[_0x73ce('0x3b')]['filter']){_0x4e72a9[_0x73ce('0x46')]=_[_0x73ce('0x47')](_0x4e72a9[_0x73ce('0x46')],{'$or':_[_0x73ce('0x3a')](_0x4e72a9['attributes'],function(_0x21f7d4){var _0x346ae5={};_0x346ae5[_0x21f7d4]={'$like':'%'+_0x64f16[_0x73ce('0x3b')][_0x73ce('0x45')]+'%'};return _0x346ae5;})});}_0x4e72a9=_[_0x73ce('0x47')]({},_0x4e72a9,_0x64f16[_0x73ce('0x49')]);return _0x43d55b[_0x73ce('0x55')](_0x4e72a9);}})[_0x73ce('0x1c')](function(_0xb21907){if(_0xb21907){_0x5f02c3=_0xb21907[_0x73ce('0x40')];if(!_0x64f16[_0x73ce('0x3b')]['hasOwnProperty'](_0x73ce('0x57'))){_0x4e72a9[_0x73ce('0x2c')]=qs[_0x73ce('0x2c')](_0x64f16[_0x73ce('0x3b')][_0x73ce('0x2c')]);_0x4e72a9['offset']=qs[_0x73ce('0x2b')](_0x64f16['query'][_0x73ce('0x2b')]);}return _0x43d55b[_0x73ce('0x55')](_0x4e72a9);}})['then'](function(_0x144be9){if(_0x144be9){return _0x144be9?{'count':_0x5f02c3,'rows':_0x144be9}:null;}})['then'](respondWithResult(_0x385569,null))['catch'](handleError(_0x385569,null));};exports[_0x73ce('0x58')]=function(_0x152062,_0x41daae,_0x55e4a0){var _0x2b21b7={};var _0x5d3c5b={};var _0x3ac488;var _0x38cf1b;return db[_0x73ce('0x4a')][_0x73ce('0x56')]({'where':{'id':_0x152062[_0x73ce('0x50')]['id']}})[_0x73ce('0x1c')](handleEntityNotFound(_0x41daae,null))[_0x73ce('0x1c')](function(_0x462e23){if(_0x462e23){_0x3ac488=_0x462e23;_0x5d3c5b[_0x73ce('0x39')]=_[_0x73ce('0x3c')](db['SalesforceField'][_0x73ce('0x35')]);_0x5d3c5b[_0x73ce('0x3b')]=_['keys'](_0x152062[_0x73ce('0x3b')]);_0x5d3c5b[_0x73ce('0x43')]=_[_0x73ce('0x3d')](_0x5d3c5b['model'],_0x5d3c5b[_0x73ce('0x3b')]);_0x2b21b7[_0x73ce('0x3e')]=_[_0x73ce('0x3d')](_0x5d3c5b[_0x73ce('0x39')],qs[_0x73ce('0x3f')](_0x152062[_0x73ce('0x3b')][_0x73ce('0x3f')]));_0x2b21b7[_0x73ce('0x3e')]=_0x2b21b7[_0x73ce('0x3e')]['length']?_0x2b21b7[_0x73ce('0x3e')]:_0x5d3c5b[_0x73ce('0x39')];_0x2b21b7['order']=qs[_0x73ce('0x42')](_0x152062[_0x73ce('0x3b')]['sort']);_0x2b21b7[_0x73ce('0x46')]=qs[_0x73ce('0x43')](_[_0x73ce('0x44')](_0x152062[_0x73ce('0x3b')],_0x5d3c5b[_0x73ce('0x43')]));if(_0x152062[_0x73ce('0x3b')][_0x73ce('0x45')]){_0x2b21b7['where']=_[_0x73ce('0x47')](_0x2b21b7['where'],{'$or':_[_0x73ce('0x3a')](_0x2b21b7['attributes'],function(_0x10587b){var _0x3608ba={};_0x3608ba[_0x10587b]={'$like':'%'+_0x152062[_0x73ce('0x3b')]['filter']+'%'};return _0x3608ba;})});}_0x2b21b7=_[_0x73ce('0x47')]({},_0x2b21b7,_0x152062['options']);return _0x3ac488[_0x73ce('0x58')](_0x2b21b7);}})[_0x73ce('0x1c')](function(_0x17d2b1){if(_0x17d2b1){_0x38cf1b=_0x17d2b1['length'];if(!_0x152062[_0x73ce('0x3b')][_0x73ce('0x59')](_0x73ce('0x57'))){_0x2b21b7[_0x73ce('0x2c')]=qs['limit'](_0x152062['query'][_0x73ce('0x2c')]);_0x2b21b7[_0x73ce('0x2b')]=qs[_0x73ce('0x2b')](_0x152062[_0x73ce('0x3b')][_0x73ce('0x2b')]);}return _0x3ac488[_0x73ce('0x58')](_0x2b21b7);}})['then'](function(_0x8fd70a){if(_0x8fd70a){return _0x8fd70a?{'count':_0x38cf1b,'rows':_0x8fd70a}:null;}})['then'](respondWithResult(_0x41daae,null))[_0x73ce('0x26')](handleError(_0x41daae,null));};exports[_0x73ce('0x5a')]=function(_0x2ecf9a,_0xa9691e,_0x4f1bfd){var _0x381abc={};var _0x46d373={};var _0x44719d;var _0x320c71;return db[_0x73ce('0x4a')]['findOne']({'where':{'id':_0x2ecf9a['params']['id']}})['then'](handleEntityNotFound(_0xa9691e,null))[_0x73ce('0x1c')](function(_0x2fdd64){if(_0x2fdd64){_0x44719d=_0x2fdd64;_0x46d373[_0x73ce('0x39')]=_[_0x73ce('0x3c')](db['SalesforceField'][_0x73ce('0x35')]);_0x46d373[_0x73ce('0x3b')]=_[_0x73ce('0x3c')](_0x2ecf9a[_0x73ce('0x3b')]);_0x46d373['filters']=_[_0x73ce('0x3d')](_0x46d373['model'],_0x46d373[_0x73ce('0x3b')]);_0x381abc['attributes']=_['intersection'](_0x46d373[_0x73ce('0x39')],qs['fields'](_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x3f')]));_0x381abc[_0x73ce('0x3e')]=_0x381abc[_0x73ce('0x3e')][_0x73ce('0x40')]?_0x381abc['attributes']:_0x46d373[_0x73ce('0x39')];_0x381abc[_0x73ce('0x41')]=qs[_0x73ce('0x42')](_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x42')]);_0x381abc['where']=qs[_0x73ce('0x43')](_['pick'](_0x2ecf9a[_0x73ce('0x3b')],_0x46d373[_0x73ce('0x43')]));if(_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x45')]){_0x381abc['where']=_[_0x73ce('0x47')](_0x381abc[_0x73ce('0x46')],{'$or':_[_0x73ce('0x3a')](_0x381abc[_0x73ce('0x3e')],function(_0x379ecc){var _0x411239={};_0x411239[_0x379ecc]={'$like':'%'+_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x45')]+'%'};return _0x411239;})});}_0x381abc=_[_0x73ce('0x47')]({},_0x381abc,_0x2ecf9a[_0x73ce('0x49')]);return _0x44719d['getDescriptions'](_0x381abc);}})['then'](function(_0x196f20){if(_0x196f20){_0x320c71=_0x196f20[_0x73ce('0x40')];if(!_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x59')](_0x73ce('0x57'))){_0x381abc['limit']=qs[_0x73ce('0x2c')](_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x2c')]);_0x381abc[_0x73ce('0x2b')]=qs[_0x73ce('0x2b')](_0x2ecf9a[_0x73ce('0x3b')][_0x73ce('0x2b')]);}return _0x44719d['getDescriptions'](_0x381abc);}})['then'](function(_0x181abd){if(_0x181abd){return _0x181abd?{'count':_0x320c71,'rows':_0x181abd}:null;}})[_0x73ce('0x1c')](respondWithResult(_0xa9691e,null))['catch'](handleError(_0xa9691e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c760749..5923d1c 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 _0x314c=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x23e63b,_0x268210){var _0x2ccef8=function(_0x113f49){while(--_0x113f49){_0x23e63b['push'](_0x23e63b['shift']());}};_0x2ccef8(++_0x268210);}(_0x314c,0x17c));var _0xc314=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x314c[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xc314('0x0'));var util=require('util');var logger=require(_0xc314('0x1'))(_0xc314('0x2'));var moment=require(_0xc314('0x3'));var BPromise=require(_0xc314('0x4'));var rp=require(_0xc314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc314('0x6'));var config=require(_0xc314('0x7'));var attributes=require(_0xc314('0x8'));module[_0xc314('0x9')]=function(_0x27d6f6,_0x51c855){return _0x27d6f6['define'](_0xc314('0xa'),attributes,{'tableName':_0xc314('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa935=['request-promise','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa935,0x17c));var _0x5a93=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xa935[_0x52e68e];return _0x3211a4;};'use strict';var _=require(_0x5a93('0x0'));var util=require('util');var logger=require(_0x5a93('0x1'))(_0x5a93('0x2'));var moment=require(_0x5a93('0x3'));var BPromise=require(_0x5a93('0x4'));var rp=require(_0x5a93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a93('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x5a93('0x7')]=function(_0x159aef,_0x3b536f){return _0x159aef[_0x5a93('0x8')](_0x5a93('0x9'),attributes,{'tableName':_0x5a93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 8f5f429..c968b29 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 _0xa52e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa52e,0x1e1));var _0xea52=function(_0x40ab55,_0x2e56d0){_0x40ab55=_0x40ab55-0x0;var _0x45a3d5=_0xa52e[_0x40ab55];return _0x45a3d5;};'use strict';var _=require(_0xea52('0x0'));var util=require(_0xea52('0x1'));var moment=require(_0xea52('0x2'));var BPromise=require(_0xea52('0x3'));var rs=require(_0xea52('0x4'));var fs=require('fs');var Redis=require(_0xea52('0x5'));var db=require(_0xea52('0x6'))['db'];var utils=require(_0xea52('0x7'));var logger=require(_0xea52('0x8'))('rpc');var config=require(_0xea52('0x9'));var jayson=require(_0xea52('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39f5de,_0x18b255,_0x5bbc28){return new BPromise(function(_0x1ee9b5,_0x2ceffe){return client[_0xea52('0xb')](_0x39f5de,_0x5bbc28)[_0xea52('0xc')](function(_0x75899f){logger['info'](_0xea52('0xd'),_0x18b255,_0xea52('0xe'));logger[_0xea52('0xf')](_0xea52('0x10'),_0x18b255,_0xea52('0xe'),JSON[_0xea52('0x11')](_0x75899f));if(_0x75899f[_0xea52('0x12')]){if(_0x75899f[_0xea52('0x12')]['code']===0x1f4){logger[_0xea52('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18b255,_0x75899f[_0xea52('0x12')][_0xea52('0x13')]);return _0x2ceffe(_0x75899f['error'][_0xea52('0x13')]);}logger[_0xea52('0x12')](_0xea52('0xd'),_0x18b255,_0x75899f[_0xea52('0x12')][_0xea52('0x13')]);return _0x1ee9b5(_0x75899f['error'][_0xea52('0x13')]);}else{logger[_0xea52('0x14')](_0xea52('0xd'),_0x18b255,'request\x20sent');_0x1ee9b5(_0x75899f['result']['message']);}})[_0xea52('0x15')](function(_0x9a770){logger[_0xea52('0x12')](_0xea52('0xd'),_0x18b255,_0x9a770);_0x2ceffe(_0x9a770);});});} \ No newline at end of file +var _0x44fd=['request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http'];(function(_0x2b6e1e,_0x571203){var _0x431e2f=function(_0x19f570){while(--_0x19f570){_0x2b6e1e['push'](_0x2b6e1e['shift']());}};_0x431e2f(++_0x571203);}(_0x44fd,0x1de));var _0xd44f=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x44fd[_0x575b72];return _0x561c57;};'use strict';var _=require(_0xd44f('0x0'));var util=require(_0xd44f('0x1'));var moment=require('moment');var BPromise=require(_0xd44f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd44f('0x3'));var db=require(_0xd44f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd44f('0x5'))('rpc');var config=require(_0xd44f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd44f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x596377,_0x21e5cb,_0x2c0d3b){return new BPromise(function(_0x5e438a,_0x1faed6){return client[_0xd44f('0x8')](_0x596377,_0x2c0d3b)['then'](function(_0x1de931){logger['info'](_0xd44f('0x9'),_0x21e5cb,_0xd44f('0xa'));logger[_0xd44f('0xb')](_0xd44f('0xc'),_0x21e5cb,_0xd44f('0xa'),JSON[_0xd44f('0xd')](_0x1de931));if(_0x1de931[_0xd44f('0xe')]){if(_0x1de931[_0xd44f('0xe')][_0xd44f('0xf')]===0x1f4){logger[_0xd44f('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x21e5cb,_0x1de931[_0xd44f('0xe')]['message']);return _0x1faed6(_0x1de931[_0xd44f('0xe')][_0xd44f('0x10')]);}logger[_0xd44f('0xe')](_0xd44f('0x9'),_0x21e5cb,_0x1de931[_0xd44f('0xe')][_0xd44f('0x10')]);return _0x5e438a(_0x1de931['error']['message']);}else{logger['info'](_0xd44f('0x9'),_0x21e5cb,'request\x20sent');_0x5e438a(_0x1de931['result'][_0xd44f('0x10')]);}})[_0xd44f('0x11')](function(_0x525a49){logger[_0xd44f('0xe')](_0xd44f('0x9'),_0x21e5cb,_0x525a49);_0x1faed6(_0x525a49);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c1aaaa2..455703a 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 _0x27a0=['get','isAuthenticated','index','/:id','post','create','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x1a993f,_0x2ae67d){var _0x2cd7a8=function(_0x522431){while(--_0x522431){_0x1a993f['push'](_0x1a993f['shift']());}};_0x2cd7a8(++_0x2ae67d);}(_0x27a0,0xbf));var _0x027a=function(_0xda592d,_0x51de9c){_0xda592d=_0xda592d-0x0;var _0x5cc28e=_0x27a0[_0xda592d];return _0x5cc28e;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x027a('0x5')]('/',auth[_0x027a('0x6')](),controller[_0x027a('0x7')]);router[_0x027a('0x5')](_0x027a('0x8'),auth[_0x027a('0x6')](),controller['show']);router[_0x027a('0x9')]('/',auth[_0x027a('0x6')](),controller[_0x027a('0xa')]);router['put'](_0x027a('0x8'),auth[_0x027a('0x6')](),controller[_0x027a('0xb')]);router['delete'](_0x027a('0x8'),auth[_0x027a('0x6')](),controller[_0x027a('0xc')]);module[_0x027a('0xd')]=router; \ No newline at end of file +var _0x1b20=['/:id','show','put','update','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x4fe7bb,_0x1bdd1c){var _0x5659cc=function(_0x425c86){while(--_0x425c86){_0x4fe7bb['push'](_0x4fe7bb['shift']());}};_0x5659cc(++_0x1bdd1c);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var auth=require(_0x01b2('0x3'));var interaction=require(_0x01b2('0x4'));var config=require(_0x01b2('0x5'));var controller=require(_0x01b2('0x6'));router[_0x01b2('0x7')]('/',auth[_0x01b2('0x8')](),controller[_0x01b2('0x9')]);router[_0x01b2('0x7')](_0x01b2('0xa'),auth[_0x01b2('0x8')](),controller[_0x01b2('0xb')]);router['post']('/',auth[_0x01b2('0x8')](),controller['create']);router[_0x01b2('0xc')](_0x01b2('0xa'),auth[_0x01b2('0x8')](),controller[_0x01b2('0xd')]);router[_0x01b2('0xe')](_0x01b2('0xa'),auth[_0x01b2('0x8')](),controller[_0x01b2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 16e26f1..37b7490 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 _0x0259=['customVariable','STRING','sequelize','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0259,0x1f4));var _0x9025=function(_0x3dcc70,_0x4ac182){_0x3dcc70=_0x3dcc70-0x0;var _0x17a05b=_0x0259[_0x3dcc70];return _0x17a05b;};'use strict';var Sequelize=require(_0x9025('0x0'));module['exports']={'type':{'type':Sequelize[_0x9025('0x1')](_0x9025('0x2'),_0x9025('0x3'),_0x9025('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9025('0x5')]},'keyType':{'type':Sequelize[_0x9025('0x1')](_0x9025('0x2'),_0x9025('0x3'),_0x9025('0x4'))},'keyContent':{'type':Sequelize[_0x9025('0x5')]},'idField':{'type':Sequelize[_0x9025('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xff3a=['customVariable','STRING','sequelize','exports','string','variable','keyValue'];(function(_0x5df398,_0x3edb38){var _0x16b56d=function(_0x551463){while(--_0x551463){_0x5df398['push'](_0x5df398['shift']());}};_0x16b56d(++_0x3edb38);}(_0xff3a,0x19f));var _0xaff3=function(_0x41b41c,_0x26adbd){_0x41b41c=_0x41b41c-0x0;var _0x4e04e8=_0xff3a[_0x41b41c];return _0x4e04e8;};'use strict';var Sequelize=require(_0xaff3('0x0'));module[_0xaff3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaff3('0x2'),_0xaff3('0x3'),'customVariable',_0xaff3('0x4')),'defaultValue':_0xaff3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xaff3('0x5'))},'keyContent':{'type':Sequelize[_0xaff3('0x6')]},'idField':{'type':Sequelize[_0xaff3('0x6')]},'variableName':{'type':Sequelize[_0xaff3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ab66b12..9267578 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 _0x4893=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x15d178,_0x533561){var _0xc73785=function(_0x30674c){while(--_0x30674c){_0x15d178['push'](_0x15d178['shift']());}};_0xc73785(++_0x533561);}(_0x4893,0x180));var _0x3489=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0x4893[_0x51ec61];return _0x223200;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3489('0x0'));var rimraf=require(_0x3489('0x1'));var zipdir=require(_0x3489('0x2'));var jsonpatch=require(_0x3489('0x3'));var rp=require(_0x3489('0x4'));var moment=require(_0x3489('0x5'));var BPromise=require(_0x3489('0x6'));var Mustache=require(_0x3489('0x7'));var util=require(_0x3489('0x8'));var path=require(_0x3489('0x9'));var sox=require(_0x3489('0xa'));var csv=require(_0x3489('0xb'));var ejs=require(_0x3489('0xc'));var fs=require('fs');var _=require(_0x3489('0xd'));var squel=require(_0x3489('0xe'));var crypto=require(_0x3489('0xf'));var jsforce=require(_0x3489('0x10'));var deskjs=require(_0x3489('0x11'));var toCsv=require(_0x3489('0xb'));var querystring=require(_0x3489('0x12'));var Papa=require('papaparse');var Redis=require(_0x3489('0x13'));var authService=require(_0x3489('0x14'));var qs=require(_0x3489('0x15'));var as=require(_0x3489('0x16'));var hardwareService=require(_0x3489('0x17'));var logger=require(_0x3489('0x18'))(_0x3489('0x19'));var utils=require(_0x3489('0x1a'));var config=require(_0x3489('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fcfc0,_0x4dd083){_0x4dd083=_0x4dd083||0xcc;return function(_0x1638d7){if(_0x1638d7){return _0x4fcfc0['sendStatus'](_0x4dd083);}return _0x4fcfc0[_0x3489('0x1c')](_0x4dd083)[_0x3489('0x1d')]();};}function respondWithResult(_0xf6ffe4,_0x310066){_0x310066=_0x310066||0xc8;return function(_0x2ad128){if(_0x2ad128){return _0xf6ffe4[_0x3489('0x1c')](_0x310066)[_0x3489('0x1e')](_0x2ad128);}};}function respondWithFilteredResult(_0x188039,_0x134da3){return function(_0x54b283){if(_0x54b283){var _0x226dde=_0x54b283[_0x3489('0x1f')],_0x1fb458=_0x134da3[_0x3489('0x20')],_0x748451=_0x134da3[_0x3489('0x20')]+_0x134da3[_0x3489('0x21')],_0xd93f00;if(_0x748451>=_0x226dde){_0x748451=_0x226dde;_0xd93f00=0xc8;}else{_0xd93f00=0xce;}_0x188039[_0x3489('0x1c')](_0xd93f00);return _0x188039[_0x3489('0x22')](_0x3489('0x23'),_0x1fb458+'-'+_0x748451+'/'+_0x226dde)[_0x3489('0x1e')](_0x54b283);}return null;};}function patchUpdates(_0x446ad4){return function(_0x2befe7){try{jsonpatch[_0x3489('0x24')](_0x2befe7,_0x446ad4,!![]);}catch(_0x27793e){return BPromise[_0x3489('0x25')](_0x27793e);}return _0x2befe7[_0x3489('0x26')]();};}function saveUpdates(_0x3fd5fa,_0x1c289c){return function(_0xfce67d){if(_0xfce67d){return _0xfce67d['update'](_0x3fd5fa)[_0x3489('0x27')](function(_0x3a4189){return _0x3a4189;});}return null;};}function removeEntity(_0x283e21,_0x5a9ff0){return function(_0x4ce471){if(_0x4ce471){return _0x4ce471[_0x3489('0x28')]()[_0x3489('0x27')](function(){_0x283e21[_0x3489('0x1c')](0xcc)[_0x3489('0x1d')]();});}};}function handleEntityNotFound(_0x2ab122,_0x33d438){return function(_0x7d301b){if(!_0x7d301b){_0x2ab122[_0x3489('0x29')](0x194);}return _0x7d301b;};}function handleError(_0x459830,_0x46d463){_0x46d463=_0x46d463||0x1f4;return function(_0x4e981d){logger[_0x3489('0x2a')](_0x4e981d[_0x3489('0x2b')]);if(_0x4e981d['name']){delete _0x4e981d[_0x3489('0x2c')];}_0x459830['status'](_0x46d463)[_0x3489('0x2d')](_0x4e981d);};}exports['index']=function(_0x3d1a50,_0x3edeb9){var _0x4909eb={},_0x4857ef={},_0x3b2bc7={'count':0x0,'rows':[]};var _0x4ffb1e=_[_0x3489('0x2e')](db[_0x3489('0x2f')][_0x3489('0x30')],function(_0x470a0f){return{'name':_0x470a0f[_0x3489('0x31')],'type':_0x470a0f['type']['key']};});_0x4857ef[_0x3489('0x32')]=_[_0x3489('0x2e')](_0x4ffb1e,'name');_0x4857ef['query']=_[_0x3489('0x33')](_0x3d1a50['query']);_0x4857ef[_0x3489('0x34')]=_[_0x3489('0x35')](_0x4857ef[_0x3489('0x32')],_0x4857ef['query']);_0x4909eb['attributes']=_[_0x3489('0x35')](_0x4857ef[_0x3489('0x32')],qs[_0x3489('0x36')](_0x3d1a50[_0x3489('0x37')][_0x3489('0x36')]));_0x4909eb[_0x3489('0x38')]=_0x4909eb['attributes'][_0x3489('0x39')]?_0x4909eb[_0x3489('0x38')]:_0x4857ef['model'];if(!_0x3d1a50[_0x3489('0x37')][_0x3489('0x3a')](_0x3489('0x3b'))){_0x4909eb['limit']=qs[_0x3489('0x21')](_0x3d1a50[_0x3489('0x37')]['limit']);_0x4909eb['offset']=qs['offset'](_0x3d1a50[_0x3489('0x37')][_0x3489('0x20')]);}_0x4909eb[_0x3489('0x3c')]=qs['sort'](_0x3d1a50[_0x3489('0x37')]['sort']);_0x4909eb['where']=qs['filters'](_[_0x3489('0x3d')](_0x3d1a50[_0x3489('0x37')],_0x4857ef['filters']),_0x4ffb1e);if(_0x3d1a50[_0x3489('0x37')][_0x3489('0x3e')]){_0x4909eb[_0x3489('0x3f')]=_['merge'](_0x4909eb['where'],{'$or':_[_0x3489('0x2e')](_0x4ffb1e,function(_0x1c89bf){if(_0x1c89bf['type']!==_0x3489('0x40')){var _0x1cc6b9={};_0x1cc6b9[_0x1c89bf['name']]={'$like':'%'+_0x3d1a50[_0x3489('0x37')][_0x3489('0x3e')]+'%'};return _0x1cc6b9;}})});}_0x4909eb=_[_0x3489('0x41')]({},_0x4909eb,_0x3d1a50[_0x3489('0x42')]);var _0x5be778={'where':_0x4909eb[_0x3489('0x3f')]};return db['SalesforceField'][_0x3489('0x1f')](_0x5be778)['then'](function(_0x4c0c24){_0x3b2bc7[_0x3489('0x1f')]=_0x4c0c24;if(_0x3d1a50[_0x3489('0x37')][_0x3489('0x43')]){_0x4909eb[_0x3489('0x44')]=[{'all':!![]}];}return db['SalesforceField'][_0x3489('0x45')](_0x4909eb);})[_0x3489('0x27')](function(_0x4c004e){_0x3b2bc7[_0x3489('0x46')]=_0x4c004e;return _0x3b2bc7;})[_0x3489('0x27')](respondWithFilteredResult(_0x3edeb9,_0x4909eb))[_0x3489('0x47')](handleError(_0x3edeb9,null));};exports[_0x3489('0x48')]=function(_0x13511f,_0x535cd8){var _0x35162a={'raw':!![],'where':{'id':_0x13511f[_0x3489('0x49')]['id']}},_0x5a572a={};_0x5a572a[_0x3489('0x32')]=_[_0x3489('0x33')](db[_0x3489('0x2f')][_0x3489('0x30')]);_0x5a572a[_0x3489('0x37')]=_['keys'](_0x13511f[_0x3489('0x37')]);_0x5a572a['filters']=_['intersection'](_0x5a572a[_0x3489('0x32')],_0x5a572a['query']);_0x35162a[_0x3489('0x38')]=_[_0x3489('0x35')](_0x5a572a['model'],qs['fields'](_0x13511f[_0x3489('0x37')][_0x3489('0x36')]));_0x35162a[_0x3489('0x38')]=_0x35162a[_0x3489('0x38')][_0x3489('0x39')]?_0x35162a[_0x3489('0x38')]:_0x5a572a['model'];if(_0x13511f[_0x3489('0x37')][_0x3489('0x43')]){_0x35162a['include']=[{'all':!![]}];}_0x35162a=_['merge']({},_0x35162a,_0x13511f[_0x3489('0x42')]);return db['SalesforceField'][_0x3489('0x4a')](_0x35162a)[_0x3489('0x27')](handleEntityNotFound(_0x535cd8,null))[_0x3489('0x27')](respondWithResult(_0x535cd8,null))['catch'](handleError(_0x535cd8,null));};exports[_0x3489('0x4b')]=function(_0x8be090,_0x150c28){return db[_0x3489('0x2f')][_0x3489('0x4b')](_0x8be090['body'],{})[_0x3489('0x27')](respondWithResult(_0x150c28,0xc9))[_0x3489('0x47')](handleError(_0x150c28,null));};exports[_0x3489('0x4c')]=function(_0x2ed673,_0xef070d){if(_0x2ed673[_0x3489('0x4d')]['id']){delete _0x2ed673[_0x3489('0x4d')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x2ed673['params']['id']}})[_0x3489('0x27')](handleEntityNotFound(_0xef070d,null))['then'](saveUpdates(_0x2ed673[_0x3489('0x4d')],null))[_0x3489('0x27')](respondWithResult(_0xef070d,null))[_0x3489('0x47')](handleError(_0xef070d,null));};exports['destroy']=function(_0x565d91,_0x2c23a7){return db[_0x3489('0x2f')]['find']({'where':{'id':_0x565d91[_0x3489('0x49')]['id']}})[_0x3489('0x27')](handleEntityNotFound(_0x2c23a7,null))[_0x3489('0x27')](removeEntity(_0x2c23a7,null))[_0x3489('0x47')](handleError(_0x2c23a7,null));}; \ No newline at end of file +var _0x7f34=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','map','SalesforceField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format'];(function(_0x1f78cb,_0x58e9f3){var _0x2cf6b8=function(_0x5c753c){while(--_0x5c753c){_0x1f78cb['push'](_0x1f78cb['shift']());}};_0x2cf6b8(++_0x58e9f3);}(_0x7f34,0x16b));var _0x47f3=function(_0x4344a5,_0x2c6493){_0x4344a5=_0x4344a5-0x0;var _0x2bd2e4=_0x7f34[_0x4344a5];return _0x2bd2e4;};'use strict';var pdf=require(_0x47f3('0x0'));var emlformat=require(_0x47f3('0x1'));var rimraf=require(_0x47f3('0x2'));var zipdir=require(_0x47f3('0x3'));var jsonpatch=require(_0x47f3('0x4'));var rp=require(_0x47f3('0x5'));var moment=require(_0x47f3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x47f3('0x7'));var util=require(_0x47f3('0x8'));var path=require(_0x47f3('0x9'));var sox=require('sox');var csv=require(_0x47f3('0xa'));var ejs=require(_0x47f3('0xb'));var fs=require('fs');var _=require(_0x47f3('0xc'));var squel=require(_0x47f3('0xd'));var crypto=require(_0x47f3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x47f3('0xa'));var querystring=require(_0x47f3('0xf'));var Papa=require('papaparse');var Redis=require(_0x47f3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x47f3('0x11'));var as=require(_0x47f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47f3('0x13'))(_0x47f3('0x14'));var utils=require(_0x47f3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x47f3('0x16'));var db=require(_0x47f3('0x17'))['db'];function respondWithStatusCode(_0x37ef8b,_0x309b4f){_0x309b4f=_0x309b4f||0xcc;return function(_0x42814a){if(_0x42814a){return _0x37ef8b[_0x47f3('0x18')](_0x309b4f);}return _0x37ef8b['status'](_0x309b4f)[_0x47f3('0x19')]();};}function respondWithResult(_0x399291,_0x530c9d){_0x530c9d=_0x530c9d||0xc8;return function(_0x332c4c){if(_0x332c4c){return _0x399291[_0x47f3('0x1a')](_0x530c9d)[_0x47f3('0x1b')](_0x332c4c);}};}function respondWithFilteredResult(_0x528552,_0x537f0c){return function(_0x51d26d){if(_0x51d26d){var _0x14cee4=_0x51d26d[_0x47f3('0x1c')],_0x46cc44=_0x537f0c[_0x47f3('0x1d')],_0x226bb3=_0x537f0c[_0x47f3('0x1d')]+_0x537f0c['limit'],_0x28d916;if(_0x226bb3>=_0x14cee4){_0x226bb3=_0x14cee4;_0x28d916=0xc8;}else{_0x28d916=0xce;}_0x528552[_0x47f3('0x1a')](_0x28d916);return _0x528552['set'](_0x47f3('0x1e'),_0x46cc44+'-'+_0x226bb3+'/'+_0x14cee4)[_0x47f3('0x1b')](_0x51d26d);}return null;};}function patchUpdates(_0x37423c){return function(_0xab8f6e){try{jsonpatch[_0x47f3('0x1f')](_0xab8f6e,_0x37423c,!![]);}catch(_0x558583){return BPromise[_0x47f3('0x20')](_0x558583);}return _0xab8f6e[_0x47f3('0x21')]();};}function saveUpdates(_0x3dc409,_0x50310b){return function(_0x5e558a){if(_0x5e558a){return _0x5e558a[_0x47f3('0x22')](_0x3dc409)[_0x47f3('0x23')](function(_0x3ba91c){return _0x3ba91c;});}return null;};}function removeEntity(_0x162f4f,_0x285f5a){return function(_0x1b67e4){if(_0x1b67e4){return _0x1b67e4['destroy']()[_0x47f3('0x23')](function(){_0x162f4f['status'](0xcc)[_0x47f3('0x19')]();});}};}function handleEntityNotFound(_0x47103a,_0x460c5d){return function(_0x386f2b){if(!_0x386f2b){_0x47103a['sendStatus'](0x194);}return _0x386f2b;};}function handleError(_0x56cd5a,_0x4b100f){_0x4b100f=_0x4b100f||0x1f4;return function(_0x379aeb){logger[_0x47f3('0x24')](_0x379aeb[_0x47f3('0x25')]);if(_0x379aeb[_0x47f3('0x26')]){delete _0x379aeb[_0x47f3('0x26')];}_0x56cd5a[_0x47f3('0x1a')](_0x4b100f)['send'](_0x379aeb);};}exports['index']=function(_0x86b79f,_0x24e92e){var _0x4fc074={},_0x47bafc={},_0x304e50={'count':0x0,'rows':[]};var _0x132b9a=_[_0x47f3('0x27')](db[_0x47f3('0x28')]['rawAttributes'],function(_0x12206d){return{'name':_0x12206d[_0x47f3('0x29')],'type':_0x12206d[_0x47f3('0x2a')][_0x47f3('0x2b')]};});_0x47bafc[_0x47f3('0x2c')]=_[_0x47f3('0x27')](_0x132b9a,_0x47f3('0x26'));_0x47bafc[_0x47f3('0x2d')]=_[_0x47f3('0x2e')](_0x86b79f[_0x47f3('0x2d')]);_0x47bafc[_0x47f3('0x2f')]=_[_0x47f3('0x30')](_0x47bafc[_0x47f3('0x2c')],_0x47bafc[_0x47f3('0x2d')]);_0x4fc074['attributes']=_[_0x47f3('0x30')](_0x47bafc['model'],qs[_0x47f3('0x31')](_0x86b79f[_0x47f3('0x2d')][_0x47f3('0x31')]));_0x4fc074[_0x47f3('0x32')]=_0x4fc074[_0x47f3('0x32')][_0x47f3('0x33')]?_0x4fc074[_0x47f3('0x32')]:_0x47bafc['model'];if(!_0x86b79f[_0x47f3('0x2d')][_0x47f3('0x34')](_0x47f3('0x35'))){_0x4fc074[_0x47f3('0x36')]=qs[_0x47f3('0x36')](_0x86b79f[_0x47f3('0x2d')][_0x47f3('0x36')]);_0x4fc074[_0x47f3('0x1d')]=qs[_0x47f3('0x1d')](_0x86b79f['query']['offset']);}_0x4fc074[_0x47f3('0x37')]=qs['sort'](_0x86b79f['query'][_0x47f3('0x38')]);_0x4fc074[_0x47f3('0x39')]=qs['filters'](_[_0x47f3('0x3a')](_0x86b79f['query'],_0x47bafc[_0x47f3('0x2f')]),_0x132b9a);if(_0x86b79f[_0x47f3('0x2d')][_0x47f3('0x3b')]){_0x4fc074[_0x47f3('0x39')]=_[_0x47f3('0x3c')](_0x4fc074['where'],{'$or':_[_0x47f3('0x27')](_0x132b9a,function(_0x58a170){if(_0x58a170['type']!==_0x47f3('0x3d')){var _0x15c584={};_0x15c584[_0x58a170[_0x47f3('0x26')]]={'$like':'%'+_0x86b79f[_0x47f3('0x2d')][_0x47f3('0x3b')]+'%'};return _0x15c584;}})});}_0x4fc074=_[_0x47f3('0x3c')]({},_0x4fc074,_0x86b79f[_0x47f3('0x3e')]);var _0x1e4335={'where':_0x4fc074[_0x47f3('0x39')]};return db[_0x47f3('0x28')][_0x47f3('0x1c')](_0x1e4335)['then'](function(_0x214610){_0x304e50[_0x47f3('0x1c')]=_0x214610;if(_0x86b79f['query'][_0x47f3('0x3f')]){_0x4fc074[_0x47f3('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x47f3('0x41')](_0x4fc074);})[_0x47f3('0x23')](function(_0x582414){_0x304e50[_0x47f3('0x42')]=_0x582414;return _0x304e50;})[_0x47f3('0x23')](respondWithFilteredResult(_0x24e92e,_0x4fc074))['catch'](handleError(_0x24e92e,null));};exports[_0x47f3('0x43')]=function(_0x1aa8e7,_0x3eeac2){var _0x525fd4={'raw':!![],'where':{'id':_0x1aa8e7[_0x47f3('0x44')]['id']}},_0x459fdf={};_0x459fdf['model']=_[_0x47f3('0x2e')](db[_0x47f3('0x28')]['rawAttributes']);_0x459fdf['query']=_[_0x47f3('0x2e')](_0x1aa8e7[_0x47f3('0x2d')]);_0x459fdf[_0x47f3('0x2f')]=_['intersection'](_0x459fdf[_0x47f3('0x2c')],_0x459fdf[_0x47f3('0x2d')]);_0x525fd4['attributes']=_['intersection'](_0x459fdf[_0x47f3('0x2c')],qs[_0x47f3('0x31')](_0x1aa8e7[_0x47f3('0x2d')]['fields']));_0x525fd4[_0x47f3('0x32')]=_0x525fd4[_0x47f3('0x32')][_0x47f3('0x33')]?_0x525fd4['attributes']:_0x459fdf[_0x47f3('0x2c')];if(_0x1aa8e7[_0x47f3('0x2d')]['includeAll']){_0x525fd4[_0x47f3('0x40')]=[{'all':!![]}];}_0x525fd4=_[_0x47f3('0x3c')]({},_0x525fd4,_0x1aa8e7[_0x47f3('0x3e')]);return db[_0x47f3('0x28')][_0x47f3('0x45')](_0x525fd4)[_0x47f3('0x23')](handleEntityNotFound(_0x3eeac2,null))[_0x47f3('0x23')](respondWithResult(_0x3eeac2,null))[_0x47f3('0x46')](handleError(_0x3eeac2,null));};exports[_0x47f3('0x47')]=function(_0x5d11fa,_0x150e87){return db['SalesforceField'][_0x47f3('0x47')](_0x5d11fa[_0x47f3('0x48')],{})[_0x47f3('0x23')](respondWithResult(_0x150e87,0xc9))[_0x47f3('0x46')](handleError(_0x150e87,null));};exports[_0x47f3('0x22')]=function(_0x57bfc9,_0x91aaae){if(_0x57bfc9['body']['id']){delete _0x57bfc9[_0x47f3('0x48')]['id'];}return db[_0x47f3('0x28')][_0x47f3('0x45')]({'where':{'id':_0x57bfc9[_0x47f3('0x44')]['id']}})['then'](handleEntityNotFound(_0x91aaae,null))[_0x47f3('0x23')](saveUpdates(_0x57bfc9[_0x47f3('0x48')],null))[_0x47f3('0x23')](respondWithResult(_0x91aaae,null))['catch'](handleError(_0x91aaae,null));};exports['destroy']=function(_0x40e437,_0x218f78){return db['SalesforceField'][_0x47f3('0x45')]({'where':{'id':_0x40e437[_0x47f3('0x44')]['id']}})[_0x47f3('0x23')](handleEntityNotFound(_0x218f78,null))[_0x47f3('0x23')](removeEntity(_0x218f78,null))[_0x47f3('0x46')](handleError(_0x218f78,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c7eafd8..39ae703 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 _0x93af=['salesforce_unique_index','FieldId','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x7d2272,_0x41f365){var _0x5bc56e=function(_0x3974af){while(--_0x3974af){_0x7d2272['push'](_0x7d2272['shift']());}};_0x5bc56e(++_0x41f365);}(_0x93af,0x1af));var _0xf93a=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x93af[_0x1e05c1];return _0x15f1ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf93a('0x0'));var moment=require(_0xf93a('0x1'));var BPromise=require(_0xf93a('0x2'));var rp=require(_0xf93a('0x3'));var fs=require('fs');var path=require(_0xf93a('0x4'));var rimraf=require(_0xf93a('0x5'));var config=require('../../config/environment');var attributes=require(_0xf93a('0x6'));module[_0xf93a('0x7')]=function(_0x4dbe60,_0x252457){return _0x4dbe60[_0xf93a('0x8')](_0xf93a('0x9'),attributes,{'tableName':_0xf93a('0xa'),'paranoid':![],'indexes':[{'name':_0xf93a('0xb'),'fields':['idField',_0xf93a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa70f=['api','moment','bluebird','request-promise','path','exports','define','SalesforceField','idField','FieldId'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0xa70f,0xb4));var _0xfa70=function(_0x24e557,_0x8c4285){_0x24e557=_0x24e557-0x0;var _0x3f284f=_0xa70f[_0x24e557];return _0x3f284f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfa70('0x0'));var moment=require(_0xfa70('0x1'));var BPromise=require(_0xfa70('0x2'));var rp=require(_0xfa70('0x3'));var fs=require('fs');var path=require(_0xfa70('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xfa70('0x5')]=function(_0x276de4,_0xb80191){return _0x276de4[_0xfa70('0x6')](_0xfa70('0x7'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xfa70('0x8'),_0xfa70('0x9')],'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 54aa4a4..6b2445a 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xda3f,0xec));var _0xfda3=function(_0x40d436,_0x31f326){_0x40d436=_0x40d436-0x0;var _0x440176=_0xda3f[_0x40d436];return _0x440176;};'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')]('SalesforceField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('SalesforceField,\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 _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(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xa571,0x107));var _0x1a57=function(_0x8ea05,_0x58e065){_0x8ea05=_0x8ea05-0x0;var _0x359673=_0xa571[_0x8ea05];return _0x359673;};'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 diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index d17eda2..12d9d13 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 _0x269e=['isAuthenticated','index','/:id','post','/:id/configurations','addConfiguration','update','destroy','multer','util','connect-timeout','express','Router','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x269e,0xc8));var _0xe269=function(_0x11f2d3,_0x58ea9e){_0x11f2d3=_0x11f2d3-0x0;var _0x25f258=_0x269e[_0x11f2d3];return _0x25f258;};'use strict';var multer=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var path=require('path');var timeout=require(_0xe269('0x2'));var express=require(_0xe269('0x3'));var router=express[_0xe269('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe269('0x5'));var controller=require(_0xe269('0x6'));router[_0xe269('0x7')]('/',auth[_0xe269('0x8')](),controller[_0xe269('0x9')]);router[_0xe269('0x7')](_0xe269('0xa'),auth[_0xe269('0x8')](),controller['show']);router[_0xe269('0x7')]('/:id/configurations',auth[_0xe269('0x8')](),controller['getConfigurations']);router[_0xe269('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xe269('0x8')](),controller['create']);router[_0xe269('0xb')](_0xe269('0xc'),auth[_0xe269('0x8')](),controller[_0xe269('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe269('0xe')]);router['delete'](_0xe269('0xa'),auth[_0xe269('0x8')](),controller[_0xe269('0xf')]);module['exports']=router; \ No newline at end of file +var _0x94cb=['get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','index'];(function(_0x58278a,_0xfaaa0b){var _0x13501f=function(_0x21a63a){while(--_0x21a63a){_0x58278a['push'](_0x58278a['shift']());}};_0x13501f(++_0xfaaa0b);}(_0x94cb,0x1c2));var _0xb94c=function(_0x22003a,_0x45d785){_0x22003a=_0x22003a-0x0;var _0x49395e=_0x94cb[_0x22003a];return _0x49395e;};'use strict';var multer=require(_0xb94c('0x0'));var util=require(_0xb94c('0x1'));var path=require(_0xb94c('0x2'));var timeout=require('connect-timeout');var express=require(_0xb94c('0x3'));var router=express[_0xb94c('0x4')]();var auth=require(_0xb94c('0x5'));var interaction=require(_0xb94c('0x6'));var config=require(_0xb94c('0x7'));var controller=require(_0xb94c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb94c('0x9')]);router[_0xb94c('0xa')](_0xb94c('0xb'),auth[_0xb94c('0xc')](),controller['show']);router[_0xb94c('0xa')](_0xb94c('0xd'),auth[_0xb94c('0xc')](),controller[_0xb94c('0xe')]);router[_0xb94c('0xa')](_0xb94c('0xf'),auth[_0xb94c('0xc')](),controller[_0xb94c('0x10')]);router[_0xb94c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb94c('0x11')]('/:id/configurations',auth[_0xb94c('0xc')](),controller[_0xb94c('0x12')]);router[_0xb94c('0x13')](_0xb94c('0xb'),auth['isAuthenticated'](),controller[_0xb94c('0x14')]);router['delete'](_0xb94c('0xb'),auth[_0xb94c('0xc')](),controller[_0xb94c('0x15')]);module[_0xb94c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b3ac9ae..7ac9f10 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 _0xedfb=['sequelize','STRING','username'];(function(_0x24af79,_0x2403c2){var _0x6cf0a9=function(_0x51628e){while(--_0x51628e){_0x24af79['push'](_0x24af79['shift']());}};_0x6cf0a9(++_0x2403c2);}(_0xedfb,0x165));var _0xbedf=function(_0x5e6116,_0x4bae08){_0x5e6116=_0x5e6116-0x0;var _0x29bf86=_0xedfb[_0x5e6116];return _0x29bf86;};'use strict';var Sequelize=require(_0xbedf('0x0'));module['exports']={'name':{'type':Sequelize[_0xbedf('0x1')]},'description':{'type':Sequelize[_0xbedf('0x1')]},'username':{'type':Sequelize[_0xbedf('0x1')],'unique':_0xbedf('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbedf('0x1')]},'remoteUri':{'type':Sequelize[_0xbedf('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbedf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x634b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x26c294,_0xfd32c6){var _0x2355be=function(_0x6e8940){while(--_0x6e8940){_0x26c294['push'](_0x26c294['shift']());}};_0x2355be(++_0xfd32c6);}(_0x634b,0x10a));var _0xb634=function(_0x70bdbf,_0x1a1549){_0x70bdbf=_0x70bdbf-0x0;var _0x233d3b=_0x634b[_0x70bdbf];return _0x233d3b;};'use strict';var Sequelize=require(_0xb634('0x0'));module[_0xb634('0x1')]={'name':{'type':Sequelize[_0xb634('0x2')]},'description':{'type':Sequelize[_0xb634('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xb634('0x3')},'password':{'type':Sequelize[_0xb634('0x2')]},'email':{'type':Sequelize[_0xb634('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb634('0x4')},'serverUrl':{'type':Sequelize[_0xb634('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 5ebbc3f..172ba5b 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 _0x3c64=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','count','limit','apply','reject','save','update','destroy','send','map','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','find','body','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','getDescriptions','create','ServicenowField','Subjects','Descriptions','getFields','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','stack','boolean','True','true','False','inactive','false','rimraf','zip-dir'];(function(_0x14a606,_0x43b056){var _0x16a858=function(_0x43cd1e){while(--_0x43cd1e){_0x14a606['push'](_0x14a606['shift']());}};_0x16a858(++_0x43b056);}(_0x3c64,0xbe));var _0x43c6=function(_0xb83182,_0x421e15){_0xb83182=_0xb83182-0x0;var _0x4ef445=_0x3c64[_0xb83182];return _0x4ef445;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x43c6('0x0'));var zipdir=require(_0x43c6('0x1'));var jsonpatch=require(_0x43c6('0x2'));var rp=require(_0x43c6('0x3'));var moment=require(_0x43c6('0x4'));var BPromise=require(_0x43c6('0x5'));var Mustache=require(_0x43c6('0x6'));var util=require(_0x43c6('0x7'));var path=require('path');var sox=require(_0x43c6('0x8'));var csv=require(_0x43c6('0x9'));var ejs=require(_0x43c6('0xa'));var fs=require('fs');var _=require(_0x43c6('0xb'));var squel=require(_0x43c6('0xc'));var crypto=require(_0x43c6('0xd'));var jsforce=require(_0x43c6('0xe'));var deskjs=require(_0x43c6('0xf'));var toCsv=require(_0x43c6('0x9'));var querystring=require(_0x43c6('0x10'));var Papa=require(_0x43c6('0x11'));var Redis=require(_0x43c6('0x12'));var authService=require(_0x43c6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43c6('0x14'));var logger=require(_0x43c6('0x15'))(_0x43c6('0x16'));var utils=require('../../config/utils');var config=require(_0x43c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x43c6('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x43c6('0x19'));var client=jayson[_0x43c6('0x1a')][_0x43c6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xc9c785,_0x560af0,_0x30aa38,_0x256850){return new BPromise(function(_0x224626,_0x5aaf79){var _0x355a7f=_0x256850||client;return _0x355a7f[_0x43c6('0x1c')](_0xc9c785,_0x30aa38)[_0x43c6('0x1d')](function(_0x561479){logger[_0x43c6('0x1e')](_0x43c6('0x1f'),_0x560af0,'request\x20sent');logger['debug'](_0x43c6('0x20'),_0x560af0,_0x43c6('0x21'),JSON[_0x43c6('0x22')](_0x561479));if(_0x561479[_0x43c6('0x23')]){if(_0x561479[_0x43c6('0x23')]['code']===0x1f4){logger['error'](_0x43c6('0x1f'),_0x560af0,_0x561479[_0x43c6('0x23')]['message']);return _0x5aaf79(_0x561479['error'][_0x43c6('0x24')]);}logger[_0x43c6('0x23')](_0x43c6('0x1f'),_0x560af0,_0x561479[_0x43c6('0x23')][_0x43c6('0x24')]);return _0x224626(_0x561479['error'][_0x43c6('0x24')]);}else{logger[_0x43c6('0x1e')](_0x43c6('0x1f'),_0x560af0,_0x43c6('0x21'));_0x224626(_0x561479['result'][_0x43c6('0x24')]);}})['catch'](function(_0x32501d){logger['error'](_0x43c6('0x1f'),_0x560af0,_0x32501d);_0x5aaf79(_0x32501d);});});}function respondWithStatusCode(_0x378499,_0x18474f){_0x18474f=_0x18474f||0xcc;return function(_0x1283c9){if(_0x1283c9){return _0x378499[_0x43c6('0x25')](_0x18474f);}return _0x378499[_0x43c6('0x26')](_0x18474f)[_0x43c6('0x27')]();};}function respondWithResult(_0x508727,_0x7c01aa){_0x7c01aa=_0x7c01aa||0xc8;return function(_0x465bac){if(_0x465bac){return _0x508727[_0x43c6('0x26')](_0x7c01aa)[_0x43c6('0x28')](_0x465bac);}};}function respondWithFilteredResult(_0x4484d5,_0x49ab86){return function(_0x1dd777){if(_0x1dd777){var _0x10f360=_0x1dd777[_0x43c6('0x29')],_0x50f35d=_0x49ab86['offset'],_0x3b7ace=_0x49ab86['offset']+_0x49ab86[_0x43c6('0x2a')],_0x54f88a;if(_0x3b7ace>=_0x10f360){_0x3b7ace=_0x10f360;_0x54f88a=0xc8;}else{_0x54f88a=0xce;}_0x4484d5[_0x43c6('0x26')](_0x54f88a);return _0x4484d5['set']('Content-Range',_0x50f35d+'-'+_0x3b7ace+'/'+_0x10f360)[_0x43c6('0x28')](_0x1dd777);}return null;};}function patchUpdates(_0x38dc7f){return function(_0x10c638){try{jsonpatch[_0x43c6('0x2b')](_0x10c638,_0x38dc7f,!![]);}catch(_0x1fd370){return BPromise[_0x43c6('0x2c')](_0x1fd370);}return _0x10c638[_0x43c6('0x2d')]();};}function saveUpdates(_0x31f51a,_0x4c154b){return function(_0x445bdb){if(_0x445bdb){return _0x445bdb[_0x43c6('0x2e')](_0x31f51a)[_0x43c6('0x1d')](function(_0x3459ac){return _0x3459ac;});}return null;};}function removeEntity(_0x4aa11c,_0x556242){return function(_0x3a6c2c){if(_0x3a6c2c){return _0x3a6c2c[_0x43c6('0x2f')]()['then'](function(){_0x4aa11c['status'](0xcc)[_0x43c6('0x27')]();});}};}function handleEntityNotFound(_0x2703fc,_0x2a03af){return function(_0x438c08){if(!_0x438c08){_0x2703fc['sendStatus'](0x194);}return _0x438c08;};}function handleError(_0x1fa6a4,_0x5c2261){_0x5c2261=_0x5c2261||0x1f4;return function(_0x3bdc57){logger[_0x43c6('0x23')](_0x3bdc57['stack']);if(_0x3bdc57['name']){delete _0x3bdc57['name'];}_0x1fa6a4['status'](_0x5c2261)[_0x43c6('0x30')](_0x3bdc57);};}exports['index']=function(_0x362792,_0x4cc103){var _0x20671e={},_0x2d3da6={},_0x42065e={'count':0x0,'rows':[]};var _0x25b82f=_[_0x43c6('0x31')](db['ServicenowAccount'][_0x43c6('0x32')],function(_0x2596f7){return{'name':_0x2596f7[_0x43c6('0x33')],'type':_0x2596f7[_0x43c6('0x34')]['key']};});_0x2d3da6[_0x43c6('0x35')]=_['map'](_0x25b82f,_0x43c6('0x36'));_0x2d3da6['query']=_[_0x43c6('0x37')](_0x362792[_0x43c6('0x38')]);_0x2d3da6[_0x43c6('0x39')]=_[_0x43c6('0x3a')](_0x2d3da6[_0x43c6('0x35')],_0x2d3da6[_0x43c6('0x38')]);_0x20671e['attributes']=_['intersection'](_0x2d3da6[_0x43c6('0x35')],qs['fields'](_0x362792['query'][_0x43c6('0x3b')]));_0x20671e[_0x43c6('0x3c')]=_0x20671e[_0x43c6('0x3c')][_0x43c6('0x3d')]?_0x20671e[_0x43c6('0x3c')]:_0x2d3da6[_0x43c6('0x35')];if(!_0x362792['query'][_0x43c6('0x3e')](_0x43c6('0x3f'))){_0x20671e[_0x43c6('0x2a')]=qs['limit'](_0x362792[_0x43c6('0x38')]['limit']);_0x20671e[_0x43c6('0x40')]=qs[_0x43c6('0x40')](_0x362792[_0x43c6('0x38')][_0x43c6('0x40')]);}_0x20671e[_0x43c6('0x41')]=qs[_0x43c6('0x42')](_0x362792[_0x43c6('0x38')]['sort']);_0x20671e[_0x43c6('0x43')]=qs[_0x43c6('0x39')](_[_0x43c6('0x44')](_0x362792[_0x43c6('0x38')],_0x2d3da6[_0x43c6('0x39')]),_0x25b82f);if(_0x362792['query'][_0x43c6('0x45')]){_0x20671e['where']=_[_0x43c6('0x46')](_0x20671e[_0x43c6('0x43')],{'$or':_[_0x43c6('0x31')](_0x25b82f,function(_0x56fcb6){if(_0x56fcb6[_0x43c6('0x34')]!==_0x43c6('0x47')){var _0x512ff6={};_0x512ff6[_0x56fcb6[_0x43c6('0x36')]]={'$like':'%'+_0x362792['query'][_0x43c6('0x45')]+'%'};return _0x512ff6;}})});}_0x20671e=_[_0x43c6('0x46')]({},_0x20671e,_0x362792[_0x43c6('0x48')]);var _0x373ee5={'where':_0x20671e['where']};return db[_0x43c6('0x49')]['count'](_0x373ee5)[_0x43c6('0x1d')](function(_0x5c1ba8){_0x42065e[_0x43c6('0x29')]=_0x5c1ba8;if(_0x362792[_0x43c6('0x38')][_0x43c6('0x4a')]){_0x20671e[_0x43c6('0x4b')]=[{'all':!![]}];}return db[_0x43c6('0x49')][_0x43c6('0x4c')](_0x20671e);})[_0x43c6('0x1d')](function(_0x3d169f){_0x42065e[_0x43c6('0x4d')]=_0x3d169f;return _0x42065e;})[_0x43c6('0x1d')](respondWithFilteredResult(_0x4cc103,_0x20671e))[_0x43c6('0x4e')](handleError(_0x4cc103,null));};exports[_0x43c6('0x4f')]=function(_0x524b4e,_0xcfc21){var _0x58f3f6={'raw':![],'where':{'id':_0x524b4e['params']['id']}},_0x289841={};_0x289841['model']=_[_0x43c6('0x37')](db[_0x43c6('0x49')][_0x43c6('0x32')]);_0x289841[_0x43c6('0x38')]=_['keys'](_0x524b4e[_0x43c6('0x38')]);_0x289841[_0x43c6('0x39')]=_[_0x43c6('0x3a')](_0x289841[_0x43c6('0x35')],_0x289841['query']);_0x58f3f6['attributes']=_[_0x43c6('0x3a')](_0x289841['model'],qs[_0x43c6('0x3b')](_0x524b4e[_0x43c6('0x38')][_0x43c6('0x3b')]));_0x58f3f6['attributes']=_0x58f3f6['attributes'][_0x43c6('0x3d')]?_0x58f3f6[_0x43c6('0x3c')]:_0x289841[_0x43c6('0x35')];if(_0x524b4e[_0x43c6('0x38')][_0x43c6('0x4a')]){_0x58f3f6[_0x43c6('0x4b')]=[{'all':!![]}];}_0x58f3f6=_[_0x43c6('0x46')]({},_0x58f3f6,_0x524b4e[_0x43c6('0x48')]);return db[_0x43c6('0x49')][_0x43c6('0x50')](_0x58f3f6)[_0x43c6('0x1d')](handleEntityNotFound(_0xcfc21,null))[_0x43c6('0x1d')](respondWithResult(_0xcfc21,null))[_0x43c6('0x4e')](handleError(_0xcfc21,null));};exports['create']=function(_0x456542,_0x296949){return db[_0x43c6('0x49')]['create'](_0x456542[_0x43c6('0x51')],{})[_0x43c6('0x1d')](respondWithResult(_0x296949,0xc9))[_0x43c6('0x4e')](handleError(_0x296949,null));};exports['update']=function(_0x25ad76,_0x2ce3e1){if(_0x25ad76['body']['id']){delete _0x25ad76[_0x43c6('0x51')]['id'];}return db[_0x43c6('0x49')][_0x43c6('0x50')]({'where':{'id':_0x25ad76['params']['id']}})['then'](handleEntityNotFound(_0x2ce3e1,null))['then'](saveUpdates(_0x25ad76[_0x43c6('0x51')],null))[_0x43c6('0x1d')](respondWithResult(_0x2ce3e1,null))[_0x43c6('0x4e')](handleError(_0x2ce3e1,null));};exports['destroy']=function(_0x44b8da,_0x1bd28f){return db[_0x43c6('0x49')][_0x43c6('0x50')]({'where':{'id':_0x44b8da[_0x43c6('0x52')]['id']}})[_0x43c6('0x1d')](handleEntityNotFound(_0x1bd28f,null))[_0x43c6('0x1d')](removeEntity(_0x1bd28f,null))['catch'](handleError(_0x1bd28f,null));};exports[_0x43c6('0x53')]=function(_0x106081,_0x3c9e70,_0x546682){var _0x39f87a={};var _0x2b235f={};var _0x95a08e;var _0x957242;return db[_0x43c6('0x49')][_0x43c6('0x54')]({'where':{'id':_0x106081[_0x43c6('0x52')]['id']}})['then'](handleEntityNotFound(_0x3c9e70,null))[_0x43c6('0x1d')](function(_0x177509){if(_0x177509){_0x95a08e=_0x177509;_0x2b235f['model']=_['keys'](db[_0x43c6('0x55')]['rawAttributes']);_0x2b235f['query']=_[_0x43c6('0x37')](_0x106081[_0x43c6('0x38')]);_0x2b235f[_0x43c6('0x39')]=_[_0x43c6('0x3a')](_0x2b235f[_0x43c6('0x35')],_0x2b235f[_0x43c6('0x38')]);_0x39f87a[_0x43c6('0x3c')]=_[_0x43c6('0x3a')](_0x2b235f['model'],qs['fields'](_0x106081[_0x43c6('0x38')]['fields']));_0x39f87a[_0x43c6('0x3c')]=_0x39f87a[_0x43c6('0x3c')]['length']?_0x39f87a[_0x43c6('0x3c')]:_0x2b235f['model'];_0x39f87a[_0x43c6('0x41')]=qs[_0x43c6('0x42')](_0x106081[_0x43c6('0x38')][_0x43c6('0x42')]);_0x39f87a[_0x43c6('0x43')]=qs[_0x43c6('0x39')](_['pick'](_0x106081[_0x43c6('0x38')],_0x2b235f[_0x43c6('0x39')]));if(_0x106081[_0x43c6('0x38')]['filter']){_0x39f87a[_0x43c6('0x43')]=_[_0x43c6('0x46')](_0x39f87a[_0x43c6('0x43')],{'$or':_['map'](_0x39f87a[_0x43c6('0x3c')],function(_0x3b241f){var _0x1553d7={};_0x1553d7[_0x3b241f]={'$like':'%'+_0x106081[_0x43c6('0x38')][_0x43c6('0x45')]+'%'};return _0x1553d7;})});}_0x39f87a=_[_0x43c6('0x46')]({},_0x39f87a,_0x106081[_0x43c6('0x48')]);return _0x95a08e[_0x43c6('0x53')](_0x39f87a);}})[_0x43c6('0x1d')](function(_0x4308cf){if(_0x4308cf){_0x957242=_0x4308cf[_0x43c6('0x3d')];if(!_0x106081[_0x43c6('0x38')]['hasOwnProperty'](_0x43c6('0x3f'))){_0x39f87a[_0x43c6('0x2a')]=qs[_0x43c6('0x2a')](_0x106081[_0x43c6('0x38')][_0x43c6('0x2a')]);_0x39f87a[_0x43c6('0x40')]=qs[_0x43c6('0x40')](_0x106081['query'][_0x43c6('0x40')]);}return _0x95a08e['getConfigurations'](_0x39f87a);}})[_0x43c6('0x1d')](function(_0x3b273e){if(_0x3b273e){return _0x3b273e?{'count':_0x957242,'rows':_0x3b273e}:null;}})['then'](respondWithResult(_0x3c9e70,null))['catch'](handleError(_0x3c9e70,null));};exports[_0x43c6('0x56')]=function(_0x4baabf,_0x22b330,_0x48679d){if(_0x4baabf[_0x43c6('0x51')]['id']){delete _0x4baabf[_0x43c6('0x51')]['id'];}return db[_0x43c6('0x49')][_0x43c6('0x54')]({'where':{'id':_0x4baabf[_0x43c6('0x52')]['id']}})['then'](handleEntityNotFound(_0x22b330,null))[_0x43c6('0x1d')](function(_0x568e1e){if(_0x568e1e){_0x4baabf[_0x43c6('0x51')][_0x43c6('0x57')]=_0x568e1e['id'];_0x4baabf[_0x43c6('0x51')]['Subjects']=integrations['getSubjects'](_0x4baabf[_0x43c6('0x51')][_0x43c6('0x58')],_0x4baabf['body'][_0x43c6('0x34')]);_0x4baabf[_0x43c6('0x51')]['Descriptions']=integrations[_0x43c6('0x59')](_0x4baabf[_0x43c6('0x51')]['channel'],_0x4baabf[_0x43c6('0x51')][_0x43c6('0x34')]);return db['ServicenowConfiguration'][_0x43c6('0x5a')](_0x4baabf[_0x43c6('0x51')],{'include':[{'model':db[_0x43c6('0x5b')],'as':_0x43c6('0x5c')},{'model':db[_0x43c6('0x5b')],'as':_0x43c6('0x5d')}]});}return null;})['then'](respondWithResult(_0x22b330,null))[_0x43c6('0x4e')](handleError(_0x22b330,null));};exports[_0x43c6('0x5e')]=function(_0xeca50b,_0x5997c8,_0x1ff566){var _0x29c205=['made_sla',_0x43c6('0x5f'),_0x43c6('0x60'),_0x43c6('0x61'),'close_code',_0x43c6('0x62'),_0x43c6('0x63'),_0x43c6('0x64'),_0x43c6('0x65')];var _0x2475ed=[_0x43c6('0x66'),'made_sla','caused_by','watch_list','upon_reject',_0x43c6('0x67'),'child_incidents','hold_reason',_0x43c6('0x68'),_0x43c6('0x69'),_0x43c6('0x6a'),'sys_updated_by',_0x43c6('0x6b'),_0x43c6('0x6c'),_0x43c6('0x6d'),_0x43c6('0x6e'),'state',_0x43c6('0x6f'),_0x43c6('0x60'),_0x43c6('0x41'),_0x43c6('0x70'),_0x43c6('0x71'),_0x43c6('0x72'),_0x43c6('0x73'),_0x43c6('0x74'),_0x43c6('0x75'),_0x43c6('0x76'),_0x43c6('0x77'),_0x43c6('0x78'),_0x43c6('0x79'),'rfc','time_worked',_0x43c6('0x7a'),_0x43c6('0x7b'),_0x43c6('0x7c'),'group_list',_0x43c6('0x7d'),_0x43c6('0x7e'),_0x43c6('0x7f'),_0x43c6('0x80'),_0x43c6('0x81'),_0x43c6('0x61'),_0x43c6('0x82'),'short_description',_0x43c6('0x83'),_0x43c6('0x84'),_0x43c6('0x85'),'work_start',_0x43c6('0x86'),_0x43c6('0x87'),_0x43c6('0x88'),'description',_0x43c6('0x89'),'notify',_0x43c6('0x8a'),_0x43c6('0x8b'),'closed_by','follow_up',_0x43c6('0x8c'),_0x43c6('0x8d'),_0x43c6('0x8e'),_0x43c6('0x8f'),'incident_state',_0x43c6('0x90'),_0x43c6('0x91'),'company',_0x43c6('0x92'),'activity_due',_0x43c6('0x93'),_0x43c6('0x64'),_0x43c6('0x94'),_0x43c6('0x95'),_0x43c6('0x96'),_0x43c6('0x97'),_0x43c6('0x98'),_0x43c6('0x99'),_0x43c6('0x9a'),'sys_tags',_0x43c6('0x9b'),_0x43c6('0x9c'),_0x43c6('0x9d'),'location',_0x43c6('0x65')];var _0x48adf8='';var _0x2e1ad3='';var _0x534920=[];var _0x285ca8='';var _0x2fe3e2='';var _0x4f1373=[];var _0x99366e='';var _0x3ecbf6='';var _0x43cd98={};var _0x5af13e='';return db['ServicenowAccount'][_0x43c6('0x54')]({'where':{'id':_0xeca50b[_0x43c6('0x52')]['id']},'attributes':['id','username','password','email',_0x43c6('0x9e'),_0x43c6('0x9f')]})[_0x43c6('0x1d')](handleEntityNotFound(_0x5997c8,null))['then'](function(_0x39e823){if(_0x39e823){_0x5af13e=_0x39e823[_0x43c6('0x9e')];var _0x15d6f2=_0x5af13e['slice'](-0x1);if(_0x15d6f2==='/'){_0x5af13e=_0x5af13e[_0x43c6('0xa0')](0x0,_0x5af13e[_0x43c6('0xa1')](_0x15d6f2));}_0x3ecbf6=util['format'](_0x43c6('0xa2'),_0x5af13e);_0x99366e=util[_0x43c6('0xa3')](_0x43c6('0xa4'),_0x5af13e);_0x43cd98={'user':_0x39e823[_0x43c6('0xa5')],'pass':_0x39e823[_0x43c6('0xa6')]};var _0x2ea52d={'method':_0x43c6('0xa7'),'uri':_0x3ecbf6+_0x43c6('0xa8'),'auth':_0x43cd98,'json':!![]};return rp(_0x2ea52d);}})[_0x43c6('0x1d')](function(_0x4a38d5){if(_0x4a38d5[_0x43c6('0xa9')][_0x43c6('0x3d')]>0x0){_0x48adf8=_0x4a38d5[_0x43c6('0xa9')];}console['log'](_0x43c6('0xaa'),_0x48adf8);_0x4f1373=[];_0x2e1ad3=Object[_0x43c6('0xab')]([],_0x48adf8);_[_0x43c6('0xac')](_0x2e1ad3,function(_0x59b489){return!_0x29c205[_0x43c6('0xad')](_0x59b489[_0x43c6('0x36')]);});_0x2e1ad3[_0x43c6('0xae')](function(_0x59b026){var _0x10e240=createFieldObject(_0x99366e,_0x43cd98,_0x59b026[_0x43c6('0xaf')],_0x59b026[_0x43c6('0x36')],_0x59b026[_0x43c6('0xb0')],![]);_0x4f1373['push'](_0x10e240);});return Promise[_0x43c6('0xb1')](_0x4f1373);})[_0x43c6('0x1d')](function(_0x4d72e2){_0x534920=_0x4d72e2;_0x285ca8=Object[_0x43c6('0xab')]([],_0x48adf8);console[_0x43c6('0xb2')]('TCL:\x20_object',_0x48adf8);_[_0x43c6('0xac')](_0x285ca8,function(_0x23743a){return _0x2475ed['includes'](_0x23743a[_0x43c6('0x36')]);});console[_0x43c6('0xb2')](_0x43c6('0xb3'),_0x285ca8);_0x4f1373=[];_0x285ca8[_0x43c6('0xae')](function(_0x35f093){var _0x54d0f8=createFieldObject(_0x99366e,_0x43cd98,_0x35f093[_0x43c6('0xaf')],_0x35f093[_0x43c6('0x36')],_0x35f093[_0x43c6('0xb0')],!![]);_0x4f1373[_0x43c6('0xb4')](_0x54d0f8);});return Promise[_0x43c6('0xb1')](_0x4f1373);})[_0x43c6('0x1d')](function(_0xdbb0ea){_0x2fe3e2=_0xdbb0ea;var _0x2efaa9=_0x534920[_0x43c6('0xb5')](_0x2fe3e2);return{'count':_0x2efaa9['length'],'rows':_0x2efaa9};})[_0x43c6('0x1d')](respondWithResult(_0x5997c8,null))[_0x43c6('0x4e')](function(_0x328f4d){console['log'](_0x43c6('0xb6')+_0x328f4d);var _0x1d0eb0=_0xeca50b[_0x43c6('0x38')][_0x43c6('0xb7')]?0x1f4:_0x328f4d[_0x43c6('0xb8')]||0x1f4;logger[_0x43c6('0x23')](_0x328f4d[_0x43c6('0xb9')]);delete _0x328f4d[_0x43c6('0x36')];if(_0x1d0eb0===0x191){_0x1d0eb0=0x190;}_0x5997c8[_0x43c6('0x26')](_0x1d0eb0)[_0x43c6('0x30')](_0xeca50b[_0x43c6('0x38')][_0x43c6('0xb7')]?{'message':'Wrong\x20credentials','statusCode':_0x328f4d['statusCode']}:_0x328f4d);});};function createFieldObject(_0x23b292,_0x10dbfb,_0x426d57,_0x2f9f81,_0x26d205,_0x42f67b){return new Promise(function(_0x25de41,_0x365749){var _0x256d17={'id':_0x2f9f81,'name':_0x26d205,'custom':_0x42f67b};if(_0x426d57===_0x43c6('0xba')){_0x256d17[_0x43c6('0x48')]=[{'name':_0x43c6('0xbb'),'value':_0x43c6('0xbc')},{'name':_0x43c6('0xbd'),'value':'false'}];_0x25de41(_0x256d17);}else{var _0x39d8de={'method':_0x43c6('0xa7'),'uri':_0x23b292+'sys_choice?sysparm_query=name=incident^element='+_0x2f9f81,'auth':_0x10dbfb,'json':!![]};return rp(_0x39d8de)[_0x43c6('0x1d')](function(_0x206f1d){var _0x34e431=[];if(_0x206f1d[_0x43c6('0xa9')][_0x43c6('0x3d')]>0x0){_0x206f1d[_0x43c6('0xa9')]['forEach'](function(_0x31511f){if(_0x31511f[_0x43c6('0xbe')]===_0x43c6('0xbf')){var _0xe0d1={'name':_0x31511f[_0x43c6('0xb0')],'value':_0x31511f['value']};_0x34e431[_0x43c6('0xb4')](_0xe0d1);}});}_0x256d17[_0x43c6('0x48')]=_0x34e431;if(_0x256d17[_0x43c6('0x48')]['length']>0x0){_0x25de41(_0x256d17);}else{if(_0x42f67b==![]){_0x25de41();}else{_0x25de41(_0x256d17);}}});}});} \ No newline at end of file +var _0xad51=['type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','ServicenowField','getFields','made_sla','subcategory','close_code','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','sys_id','contact_type','incident_state','urgency','problem_id','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','reopen_count','escalation','correlation_id','category','username','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','log','assign','remove','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','destroy','sendStatus','stack','name','send','index','map','ServicenowAccount','rawAttributes'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xad51,0x8a));var _0x1ad5=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0xad51[_0x3a7634];return _0x23bbe9;};'use strict';var pdf=require(_0x1ad5('0x0'));var emlformat=require(_0x1ad5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1ad5('0x2'));var moment=require(_0x1ad5('0x3'));var BPromise=require(_0x1ad5('0x4'));var Mustache=require(_0x1ad5('0x5'));var util=require(_0x1ad5('0x6'));var path=require(_0x1ad5('0x7'));var sox=require(_0x1ad5('0x8'));var csv=require(_0x1ad5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ad5('0xa'));var squel=require(_0x1ad5('0xb'));var crypto=require(_0x1ad5('0xc'));var jsforce=require(_0x1ad5('0xd'));var deskjs=require(_0x1ad5('0xe'));var toCsv=require(_0x1ad5('0x9'));var querystring=require('querystring');var Papa=require(_0x1ad5('0xf'));var Redis=require(_0x1ad5('0x10'));var authService=require(_0x1ad5('0x11'));var qs=require(_0x1ad5('0x12'));var as=require(_0x1ad5('0x13'));var hardwareService=require(_0x1ad5('0x14'));var logger=require(_0x1ad5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1ad5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ad5('0x17'))['db'];var integrations=require(_0x1ad5('0x18'));var jayson=require(_0x1ad5('0x19'));var client=jayson[_0x1ad5('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe24198,_0x2f38b1,_0x1ca3f0,_0x5d4f27){return new BPromise(function(_0x9150c9,_0x55b700){var _0x17790e=_0x5d4f27||client;return _0x17790e[_0x1ad5('0x1b')](_0xe24198,_0x1ca3f0)[_0x1ad5('0x1c')](function(_0x20c45c){logger[_0x1ad5('0x1d')](_0x1ad5('0x1e'),_0x2f38b1,_0x1ad5('0x1f'));logger[_0x1ad5('0x20')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2f38b1,_0x1ad5('0x1f'),JSON[_0x1ad5('0x21')](_0x20c45c));if(_0x20c45c[_0x1ad5('0x22')]){if(_0x20c45c[_0x1ad5('0x22')]['code']===0x1f4){logger[_0x1ad5('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x2f38b1,_0x20c45c['error'][_0x1ad5('0x23')]);return _0x55b700(_0x20c45c['error'][_0x1ad5('0x23')]);}logger[_0x1ad5('0x22')](_0x1ad5('0x1e'),_0x2f38b1,_0x20c45c['error'][_0x1ad5('0x23')]);return _0x9150c9(_0x20c45c['error'][_0x1ad5('0x23')]);}else{logger[_0x1ad5('0x1d')](_0x1ad5('0x1e'),_0x2f38b1,_0x1ad5('0x1f'));_0x9150c9(_0x20c45c[_0x1ad5('0x24')][_0x1ad5('0x23')]);}})[_0x1ad5('0x25')](function(_0x3254cf){logger[_0x1ad5('0x22')](_0x1ad5('0x1e'),_0x2f38b1,_0x3254cf);_0x55b700(_0x3254cf);});});}function respondWithStatusCode(_0x548a46,_0x54bc9d){_0x54bc9d=_0x54bc9d||0xcc;return function(_0xc10367){if(_0xc10367){return _0x548a46['sendStatus'](_0x54bc9d);}return _0x548a46[_0x1ad5('0x26')](_0x54bc9d)[_0x1ad5('0x27')]();};}function respondWithResult(_0x4e9ff4,_0x463015){_0x463015=_0x463015||0xc8;return function(_0x50384a){if(_0x50384a){return _0x4e9ff4[_0x1ad5('0x26')](_0x463015)[_0x1ad5('0x28')](_0x50384a);}};}function respondWithFilteredResult(_0x52b876,_0x51ff94){return function(_0x56f0a8){if(_0x56f0a8){var _0x46be08=_0x56f0a8[_0x1ad5('0x29')],_0x3269b5=_0x51ff94[_0x1ad5('0x2a')],_0x2ba1a7=_0x51ff94[_0x1ad5('0x2a')]+_0x51ff94[_0x1ad5('0x2b')],_0x1438e5;if(_0x2ba1a7>=_0x46be08){_0x2ba1a7=_0x46be08;_0x1438e5=0xc8;}else{_0x1438e5=0xce;}_0x52b876[_0x1ad5('0x26')](_0x1438e5);return _0x52b876[_0x1ad5('0x2c')]('Content-Range',_0x3269b5+'-'+_0x2ba1a7+'/'+_0x46be08)[_0x1ad5('0x28')](_0x56f0a8);}return null;};}function patchUpdates(_0x4ba9c1){return function(_0xa2ffbe){try{jsonpatch['apply'](_0xa2ffbe,_0x4ba9c1,!![]);}catch(_0x5dbae2){return BPromise['reject'](_0x5dbae2);}return _0xa2ffbe[_0x1ad5('0x2d')]();};}function saveUpdates(_0x1d3fcc,_0x15661e){return function(_0x372f4d){if(_0x372f4d){return _0x372f4d['update'](_0x1d3fcc)[_0x1ad5('0x1c')](function(_0x4c5ef6){return _0x4c5ef6;});}return null;};}function removeEntity(_0x39c9e8,_0x28ca97){return function(_0xdbc238){if(_0xdbc238){return _0xdbc238[_0x1ad5('0x2e')]()[_0x1ad5('0x1c')](function(){_0x39c9e8[_0x1ad5('0x26')](0xcc)[_0x1ad5('0x27')]();});}};}function handleEntityNotFound(_0x3ff8ad,_0xcb2fda){return function(_0xba8f8f){if(!_0xba8f8f){_0x3ff8ad[_0x1ad5('0x2f')](0x194);}return _0xba8f8f;};}function handleError(_0x307f93,_0x16fc75){_0x16fc75=_0x16fc75||0x1f4;return function(_0x5d660b){logger[_0x1ad5('0x22')](_0x5d660b[_0x1ad5('0x30')]);if(_0x5d660b['name']){delete _0x5d660b[_0x1ad5('0x31')];}_0x307f93['status'](_0x16fc75)[_0x1ad5('0x32')](_0x5d660b);};}exports[_0x1ad5('0x33')]=function(_0x406b45,_0x2a97ef){var _0x390a19={},_0x5de48d={},_0x3b3b92={'count':0x0,'rows':[]};var _0x30ab48=_[_0x1ad5('0x34')](db[_0x1ad5('0x35')][_0x1ad5('0x36')],function(_0xa9df8b){return{'name':_0xa9df8b['fieldName'],'type':_0xa9df8b[_0x1ad5('0x37')][_0x1ad5('0x38')]};});_0x5de48d[_0x1ad5('0x39')]=_[_0x1ad5('0x34')](_0x30ab48,_0x1ad5('0x31'));_0x5de48d['query']=_[_0x1ad5('0x3a')](_0x406b45[_0x1ad5('0x3b')]);_0x5de48d[_0x1ad5('0x3c')]=_[_0x1ad5('0x3d')](_0x5de48d['model'],_0x5de48d['query']);_0x390a19[_0x1ad5('0x3e')]=_['intersection'](_0x5de48d[_0x1ad5('0x39')],qs['fields'](_0x406b45[_0x1ad5('0x3b')]['fields']));_0x390a19[_0x1ad5('0x3e')]=_0x390a19['attributes'][_0x1ad5('0x3f')]?_0x390a19[_0x1ad5('0x3e')]:_0x5de48d['model'];if(!_0x406b45[_0x1ad5('0x3b')][_0x1ad5('0x40')](_0x1ad5('0x41'))){_0x390a19[_0x1ad5('0x2b')]=qs['limit'](_0x406b45['query']['limit']);_0x390a19[_0x1ad5('0x2a')]=qs[_0x1ad5('0x2a')](_0x406b45[_0x1ad5('0x3b')][_0x1ad5('0x2a')]);}_0x390a19[_0x1ad5('0x42')]=qs[_0x1ad5('0x43')](_0x406b45[_0x1ad5('0x3b')][_0x1ad5('0x43')]);_0x390a19[_0x1ad5('0x44')]=qs[_0x1ad5('0x3c')](_['pick'](_0x406b45['query'],_0x5de48d[_0x1ad5('0x3c')]),_0x30ab48);if(_0x406b45[_0x1ad5('0x3b')][_0x1ad5('0x45')]){_0x390a19['where']=_[_0x1ad5('0x46')](_0x390a19[_0x1ad5('0x44')],{'$or':_[_0x1ad5('0x34')](_0x30ab48,function(_0x5cacad){if(_0x5cacad[_0x1ad5('0x37')]!==_0x1ad5('0x47')){var _0x23ee16={};_0x23ee16[_0x5cacad[_0x1ad5('0x31')]]={'$like':'%'+_0x406b45[_0x1ad5('0x3b')][_0x1ad5('0x45')]+'%'};return _0x23ee16;}})});}_0x390a19=_[_0x1ad5('0x46')]({},_0x390a19,_0x406b45[_0x1ad5('0x48')]);var _0x4415cf={'where':_0x390a19[_0x1ad5('0x44')]};return db[_0x1ad5('0x35')][_0x1ad5('0x29')](_0x4415cf)[_0x1ad5('0x1c')](function(_0x50740a){_0x3b3b92['count']=_0x50740a;if(_0x406b45[_0x1ad5('0x3b')][_0x1ad5('0x49')]){_0x390a19['include']=[{'all':!![]}];}return db[_0x1ad5('0x35')][_0x1ad5('0x4a')](_0x390a19);})[_0x1ad5('0x1c')](function(_0x33da99){_0x3b3b92[_0x1ad5('0x4b')]=_0x33da99;return _0x3b3b92;})['then'](respondWithFilteredResult(_0x2a97ef,_0x390a19))[_0x1ad5('0x25')](handleError(_0x2a97ef,null));};exports[_0x1ad5('0x4c')]=function(_0x12a751,_0x471cbe){var _0x43f5e6={'raw':![],'where':{'id':_0x12a751[_0x1ad5('0x4d')]['id']}},_0x9d4cd3={};_0x9d4cd3['model']=_[_0x1ad5('0x3a')](db[_0x1ad5('0x35')][_0x1ad5('0x36')]);_0x9d4cd3[_0x1ad5('0x3b')]=_[_0x1ad5('0x3a')](_0x12a751[_0x1ad5('0x3b')]);_0x9d4cd3[_0x1ad5('0x3c')]=_[_0x1ad5('0x3d')](_0x9d4cd3[_0x1ad5('0x39')],_0x9d4cd3[_0x1ad5('0x3b')]);_0x43f5e6[_0x1ad5('0x3e')]=_['intersection'](_0x9d4cd3[_0x1ad5('0x39')],qs[_0x1ad5('0x4e')](_0x12a751[_0x1ad5('0x3b')][_0x1ad5('0x4e')]));_0x43f5e6[_0x1ad5('0x3e')]=_0x43f5e6[_0x1ad5('0x3e')][_0x1ad5('0x3f')]?_0x43f5e6[_0x1ad5('0x3e')]:_0x9d4cd3['model'];if(_0x12a751[_0x1ad5('0x3b')][_0x1ad5('0x49')]){_0x43f5e6[_0x1ad5('0x4f')]=[{'all':!![]}];}_0x43f5e6=_[_0x1ad5('0x46')]({},_0x43f5e6,_0x12a751[_0x1ad5('0x48')]);return db[_0x1ad5('0x35')][_0x1ad5('0x50')](_0x43f5e6)[_0x1ad5('0x1c')](handleEntityNotFound(_0x471cbe,null))[_0x1ad5('0x1c')](respondWithResult(_0x471cbe,null))[_0x1ad5('0x25')](handleError(_0x471cbe,null));};exports[_0x1ad5('0x51')]=function(_0x554262,_0x4fc465){return db[_0x1ad5('0x35')]['create'](_0x554262[_0x1ad5('0x52')],{})[_0x1ad5('0x1c')](respondWithResult(_0x4fc465,0xc9))[_0x1ad5('0x25')](handleError(_0x4fc465,null));};exports['update']=function(_0x1782da,_0x270006){if(_0x1782da['body']['id']){delete _0x1782da['body']['id'];}return db[_0x1ad5('0x35')][_0x1ad5('0x50')]({'where':{'id':_0x1782da[_0x1ad5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x270006,null))[_0x1ad5('0x1c')](saveUpdates(_0x1782da[_0x1ad5('0x52')],null))[_0x1ad5('0x1c')](respondWithResult(_0x270006,null))['catch'](handleError(_0x270006,null));};exports['destroy']=function(_0x56276c,_0x5307e5){return db['ServicenowAccount'][_0x1ad5('0x50')]({'where':{'id':_0x56276c['params']['id']}})[_0x1ad5('0x1c')](handleEntityNotFound(_0x5307e5,null))[_0x1ad5('0x1c')](removeEntity(_0x5307e5,null))['catch'](handleError(_0x5307e5,null));};exports[_0x1ad5('0x53')]=function(_0x2d83e7,_0x5919cc,_0x145c9a){var _0x58517f={};var _0x563f57={};var _0x4b1574;var _0x5c5e26;return db[_0x1ad5('0x35')][_0x1ad5('0x54')]({'where':{'id':_0x2d83e7[_0x1ad5('0x4d')]['id']}})[_0x1ad5('0x1c')](handleEntityNotFound(_0x5919cc,null))['then'](function(_0x561d57){if(_0x561d57){_0x4b1574=_0x561d57;_0x563f57['model']=_[_0x1ad5('0x3a')](db[_0x1ad5('0x55')][_0x1ad5('0x36')]);_0x563f57[_0x1ad5('0x3b')]=_['keys'](_0x2d83e7['query']);_0x563f57[_0x1ad5('0x3c')]=_[_0x1ad5('0x3d')](_0x563f57[_0x1ad5('0x39')],_0x563f57['query']);_0x58517f[_0x1ad5('0x3e')]=_[_0x1ad5('0x3d')](_0x563f57[_0x1ad5('0x39')],qs['fields'](_0x2d83e7[_0x1ad5('0x3b')]['fields']));_0x58517f['attributes']=_0x58517f[_0x1ad5('0x3e')][_0x1ad5('0x3f')]?_0x58517f[_0x1ad5('0x3e')]:_0x563f57['model'];_0x58517f[_0x1ad5('0x42')]=qs[_0x1ad5('0x43')](_0x2d83e7[_0x1ad5('0x3b')]['sort']);_0x58517f['where']=qs['filters'](_[_0x1ad5('0x56')](_0x2d83e7[_0x1ad5('0x3b')],_0x563f57['filters']));if(_0x2d83e7['query']['filter']){_0x58517f['where']=_[_0x1ad5('0x46')](_0x58517f[_0x1ad5('0x44')],{'$or':_['map'](_0x58517f['attributes'],function(_0x1e0ce7){var _0x2b2f1d={};_0x2b2f1d[_0x1e0ce7]={'$like':'%'+_0x2d83e7[_0x1ad5('0x3b')][_0x1ad5('0x45')]+'%'};return _0x2b2f1d;})});}_0x58517f=_[_0x1ad5('0x46')]({},_0x58517f,_0x2d83e7['options']);return _0x4b1574[_0x1ad5('0x53')](_0x58517f);}})[_0x1ad5('0x1c')](function(_0x73207){if(_0x73207){_0x5c5e26=_0x73207[_0x1ad5('0x3f')];if(!_0x2d83e7[_0x1ad5('0x3b')][_0x1ad5('0x40')](_0x1ad5('0x41'))){_0x58517f[_0x1ad5('0x2b')]=qs['limit'](_0x2d83e7[_0x1ad5('0x3b')]['limit']);_0x58517f[_0x1ad5('0x2a')]=qs[_0x1ad5('0x2a')](_0x2d83e7[_0x1ad5('0x3b')][_0x1ad5('0x2a')]);}return _0x4b1574[_0x1ad5('0x53')](_0x58517f);}})[_0x1ad5('0x1c')](function(_0x3d574b){if(_0x3d574b){return _0x3d574b?{'count':_0x5c5e26,'rows':_0x3d574b}:null;}})[_0x1ad5('0x1c')](respondWithResult(_0x5919cc,null))['catch'](handleError(_0x5919cc,null));};exports[_0x1ad5('0x57')]=function(_0x2cf6ff,_0x528279,_0x576529){if(_0x2cf6ff[_0x1ad5('0x52')]['id']){delete _0x2cf6ff[_0x1ad5('0x52')]['id'];}return db[_0x1ad5('0x35')]['findOne']({'where':{'id':_0x2cf6ff['params']['id']}})[_0x1ad5('0x1c')](handleEntityNotFound(_0x528279,null))[_0x1ad5('0x1c')](function(_0x1ac9e1){if(_0x1ac9e1){_0x2cf6ff[_0x1ad5('0x52')][_0x1ad5('0x58')]=_0x1ac9e1['id'];_0x2cf6ff[_0x1ad5('0x52')]['Subjects']=integrations[_0x1ad5('0x59')](_0x2cf6ff[_0x1ad5('0x52')]['channel'],_0x2cf6ff[_0x1ad5('0x52')][_0x1ad5('0x37')]);_0x2cf6ff[_0x1ad5('0x52')][_0x1ad5('0x5a')]=integrations[_0x1ad5('0x5b')](_0x2cf6ff[_0x1ad5('0x52')][_0x1ad5('0x5c')],_0x2cf6ff[_0x1ad5('0x52')]['type']);return db[_0x1ad5('0x55')]['create'](_0x2cf6ff[_0x1ad5('0x52')],{'include':[{'model':db['ServicenowField'],'as':_0x1ad5('0x5d')},{'model':db[_0x1ad5('0x5e')],'as':_0x1ad5('0x5a')}]});}return null;})[_0x1ad5('0x1c')](respondWithResult(_0x528279,null))[_0x1ad5('0x25')](handleError(_0x528279,null));};exports[_0x1ad5('0x5f')]=function(_0x4b998d,_0x4e822e,_0x450c50){var _0x190f7e=[_0x1ad5('0x60'),'hold_reason','knowledge',_0x1ad5('0x61'),_0x1ad5('0x62'),'notify','incident_state',_0x1ad5('0x63'),'category'];var _0x43c40a=[_0x1ad5('0x64'),_0x1ad5('0x60'),_0x1ad5('0x65'),_0x1ad5('0x66'),_0x1ad5('0x67'),_0x1ad5('0x68'),_0x1ad5('0x69'),_0x1ad5('0x6a'),'approval_history',_0x1ad5('0x6b'),_0x1ad5('0x6c'),_0x1ad5('0x6d'),_0x1ad5('0x6e'),_0x1ad5('0x6f'),_0x1ad5('0x70'),_0x1ad5('0x71'),_0x1ad5('0x72'),_0x1ad5('0x73'),_0x1ad5('0x74'),_0x1ad5('0x42'),_0x1ad5('0x75'),_0x1ad5('0x76'),_0x1ad5('0x77'),_0x1ad5('0x78'),_0x1ad5('0x79'),_0x1ad5('0x7a'),_0x1ad5('0x7b'),'business_service',_0x1ad5('0x7c'),_0x1ad5('0x7d'),_0x1ad5('0x7e'),_0x1ad5('0x7f'),'expected_start',_0x1ad5('0x80'),'business_duration',_0x1ad5('0x81'),_0x1ad5('0x82'),_0x1ad5('0x83'),_0x1ad5('0x84'),_0x1ad5('0x85'),_0x1ad5('0x86'),'subcategory',_0x1ad5('0x87'),_0x1ad5('0x88'),_0x1ad5('0x62'),_0x1ad5('0x89'),_0x1ad5('0x8a'),_0x1ad5('0x8b'),_0x1ad5('0x8c'),_0x1ad5('0x8d'),_0x1ad5('0x8e'),'description',_0x1ad5('0x8f'),'notify',_0x1ad5('0x90'),_0x1ad5('0x91'),_0x1ad5('0x92'),'follow_up','parent_incident',_0x1ad5('0x93'),_0x1ad5('0x94'),'reopened_by',_0x1ad5('0x95'),_0x1ad5('0x96'),_0x1ad5('0x97'),'company',_0x1ad5('0x98'),'activity_due',_0x1ad5('0x99'),_0x1ad5('0x63'),_0x1ad5('0x9a'),'sla_due',_0x1ad5('0x9b'),_0x1ad5('0x9c'),'due_date','sys_mod_count',_0x1ad5('0x9d'),'sys_tags',_0x1ad5('0x9e'),'upon_approval',_0x1ad5('0x9f'),'location',_0x1ad5('0xa0')];var _0x8cc118='';var _0x3989ea='';var _0x1dbfb2=[];var _0x2d16b7='';var _0xf78e09='';var _0xb4e7e7=[];var _0x14484e='';var _0x4f3eb6='';var _0x23f97b={};var _0x427c9f='';return db[_0x1ad5('0x35')][_0x1ad5('0x54')]({'where':{'id':_0x4b998d[_0x1ad5('0x4d')]['id']},'attributes':['id',_0x1ad5('0xa1'),'password','email',_0x1ad5('0xa2'),_0x1ad5('0xa3')]})[_0x1ad5('0x1c')](handleEntityNotFound(_0x4e822e,null))[_0x1ad5('0x1c')](function(_0x1c0c0f){if(_0x1c0c0f){_0x427c9f=_0x1c0c0f[_0x1ad5('0xa2')];var _0x420b43=_0x427c9f[_0x1ad5('0xa4')](-0x1);if(_0x420b43==='/'){_0x427c9f=_0x427c9f[_0x1ad5('0xa5')](0x0,_0x427c9f['lastIndexOf'](_0x420b43));}_0x4f3eb6=util[_0x1ad5('0xa6')](_0x1ad5('0xa7'),_0x427c9f);_0x14484e=util[_0x1ad5('0xa6')](_0x1ad5('0xa8'),_0x427c9f);_0x23f97b={'user':_0x1c0c0f['username'],'pass':_0x1c0c0f[_0x1ad5('0xa9')]};var _0x4ffed8={'method':'GET','uri':_0x4f3eb6+'incident?sysparm_display_value=all','auth':_0x23f97b,'json':!![]};return rp(_0x4ffed8);}})[_0x1ad5('0x1c')](function(_0x3d9438){if(_0x3d9438[_0x1ad5('0x24')][_0x1ad5('0x3f')]>0x0){_0x8cc118=_0x3d9438[_0x1ad5('0x24')];}console[_0x1ad5('0xaa')]('incident\x20table\x20objects',_0x8cc118);_0xb4e7e7=[];_0x3989ea=Object[_0x1ad5('0xab')]([],_0x8cc118);_[_0x1ad5('0xac')](_0x3989ea,function(_0xd6e032){return!_0x190f7e[_0x1ad5('0xad')](_0xd6e032[_0x1ad5('0x31')]);});_0x3989ea['forEach'](function(_0xc3b2a0){var _0x22b3dc=createFieldObject(_0x14484e,_0x23f97b,_0xc3b2a0[_0x1ad5('0xae')],_0xc3b2a0[_0x1ad5('0x31')],_0xc3b2a0['label'],![]);_0xb4e7e7[_0x1ad5('0xaf')](_0x22b3dc);});return Promise[_0x1ad5('0xb0')](_0xb4e7e7);})[_0x1ad5('0x1c')](function(_0x26e435){_0x1dbfb2=_0x26e435;_0x2d16b7=Object['assign']([],_0x8cc118);console['log'](_0x1ad5('0xb1'),_0x8cc118);_['remove'](_0x2d16b7,function(_0x19b8c9){return _0x43c40a[_0x1ad5('0xad')](_0x19b8c9[_0x1ad5('0x31')]);});console[_0x1ad5('0xaa')](_0x1ad5('0xb2'),_0x2d16b7);_0xb4e7e7=[];_0x2d16b7[_0x1ad5('0xb3')](function(_0x163e04){var _0x2c1adf=createFieldObject(_0x14484e,_0x23f97b,_0x163e04[_0x1ad5('0xae')],_0x163e04[_0x1ad5('0x31')],_0x163e04[_0x1ad5('0xb4')],!![]);_0xb4e7e7[_0x1ad5('0xaf')](_0x2c1adf);});return Promise['all'](_0xb4e7e7);})[_0x1ad5('0x1c')](function(_0x68dcf8){_0xf78e09=_0x68dcf8;var _0x40e91a=_0x1dbfb2[_0x1ad5('0xb5')](_0xf78e09);return{'count':_0x40e91a[_0x1ad5('0x3f')],'rows':_0x40e91a};})[_0x1ad5('0x1c')](respondWithResult(_0x4e822e,null))['catch'](function(_0x3c7a97){console[_0x1ad5('0xaa')](_0x1ad5('0xb6')+_0x3c7a97);var _0x469ed2=_0x4b998d[_0x1ad5('0x3b')]['test']?0x1f4:_0x3c7a97[_0x1ad5('0xb7')]||0x1f4;logger['error'](_0x3c7a97[_0x1ad5('0x30')]);delete _0x3c7a97['name'];if(_0x469ed2===0x191){_0x469ed2=0x190;}_0x4e822e[_0x1ad5('0x26')](_0x469ed2)['send'](_0x4b998d[_0x1ad5('0x3b')][_0x1ad5('0xb8')]?{'message':_0x1ad5('0xb9'),'statusCode':_0x3c7a97[_0x1ad5('0xb7')]}:_0x3c7a97);});};function createFieldObject(_0x4d1752,_0x3e7ffe,_0x579fc4,_0x4de038,_0x56081f,_0x1c8a43){return new Promise(function(_0x5898e6,_0x4481c6){var _0x8929ec={'id':_0x4de038,'name':_0x56081f,'custom':_0x1c8a43};if(_0x579fc4===_0x1ad5('0xba')){_0x8929ec[_0x1ad5('0x48')]=[{'name':'True','value':_0x1ad5('0xbb')},{'name':_0x1ad5('0xbc'),'value':'false'}];_0x5898e6(_0x8929ec);}else{var _0x20dcfd={'method':'GET','uri':_0x4d1752+_0x1ad5('0xbd')+_0x4de038,'auth':_0x3e7ffe,'json':!![]};return rp(_0x20dcfd)['then'](function(_0x5c5643){var _0x3ca21b=[];if(_0x5c5643[_0x1ad5('0x24')][_0x1ad5('0x3f')]>0x0){_0x5c5643['result'][_0x1ad5('0xb3')](function(_0x190b4b){if(_0x190b4b[_0x1ad5('0xbe')]===_0x1ad5('0xbf')){var _0x3e7e43={'name':_0x190b4b[_0x1ad5('0xb4')],'value':_0x190b4b[_0x1ad5('0xc0')]};_0x3ca21b[_0x1ad5('0xaf')](_0x3e7e43);}});}_0x8929ec[_0x1ad5('0x48')]=_0x3ca21b;if(_0x8929ec[_0x1ad5('0x48')][_0x1ad5('0x3f')]>0x0){_0x5898e6(_0x8929ec);}else{if(_0x1c8a43==![]){_0x5898e6();}else{_0x5898e6(_0x8929ec);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 99a32a1..1196f10 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 _0xc978=['bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x37d80d,_0x31f368){var _0x3703d6=function(_0x202323){while(--_0x202323){_0x37d80d['push'](_0x37d80d['shift']());}};_0x3703d6(++_0x31f368);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));var integrations=require(_0x8c97('0xa'));module[_0x8c97('0xb')]=function(_0xabd146,_0x524196){return _0xabd146[_0x8c97('0xc')](_0x8c97('0xd'),attributes,{'tableName':_0x8c97('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x1d76dc,_0x9feda9){var _0x34f83f=function(_0x2452f3){while(--_0x2452f3){_0x1d76dc['push'](_0x1d76dc['shift']());}};_0x34f83f(++_0x9feda9);}(_0x8ef6,0xf2));var _0x68ef=function(_0xa85392,_0x1cb4ba){_0xa85392=_0xa85392-0x0;var _0x3e0aad=_0x8ef6[_0xa85392];return _0x3e0aad;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));var integrations=require(_0x68ef('0xa'));module['exports']=function(_0x4f77f3,_0x3c2ff3){return _0x4f77f3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':'int_servicenow_accounts','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 2cd09ed..72cbdbe 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 _0xc090=['then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','map','include','stringify','ShowServicenowAccount','find','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc090,0x1c8));var _0x0c09=function(_0x449819,_0x37c49a){_0x449819=_0x449819-0x0;var _0x188af8=_0xc090[_0x449819];return _0x188af8;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var moment=require(_0x0c09('0x2'));var BPromise=require(_0x0c09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c09('0x4'));var db=require(_0x0c09('0x5'))['db'];var utils=require(_0x0c09('0x6'));var logger=require(_0x0c09('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0c09('0x8'));var client=jayson[_0x0c09('0x9')][_0x0c09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b69b,_0x3e6100,_0x421c8b){return new BPromise(function(_0x58d854,_0x473f91){return client[_0x0c09('0xb')](_0x18b69b,_0x421c8b)[_0x0c09('0xc')](function(_0x40dc05){logger[_0x0c09('0xd')](_0x0c09('0xe'),_0x3e6100,'request\x20sent');logger[_0x0c09('0xf')](_0x0c09('0x10'),_0x3e6100,_0x0c09('0x11'),JSON['stringify'](_0x40dc05));if(_0x40dc05[_0x0c09('0x12')]){if(_0x40dc05['error'][_0x0c09('0x13')]===0x1f4){logger[_0x0c09('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3e6100,_0x40dc05[_0x0c09('0x12')]['message']);return _0x473f91(_0x40dc05['error']['message']);}logger[_0x0c09('0x12')](_0x0c09('0xe'),_0x3e6100,_0x40dc05[_0x0c09('0x12')][_0x0c09('0x14')]);return _0x58d854(_0x40dc05[_0x0c09('0x12')][_0x0c09('0x14')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3e6100,'request\x20sent');_0x58d854(_0x40dc05[_0x0c09('0x15')][_0x0c09('0x14')]);}})[_0x0c09('0x16')](function(_0x57a69f){logger[_0x0c09('0x12')](_0x0c09('0xe'),_0x3e6100,_0x57a69f);_0x473f91(_0x57a69f);});});}exports[_0x0c09('0x17')]=function(_0x50b5bd){var _0x11719c=this;return new Promise(function(_0x98df51,_0x3614d1){return db[_0x0c09('0x18')][_0x0c09('0x19')]({'raw':_0x50b5bd['options']?_0x50b5bd[_0x0c09('0x1a')][_0x0c09('0x1b')]===undefined?!![]:![]:!![],'where':_0x50b5bd[_0x0c09('0x1a')]?_0x50b5bd[_0x0c09('0x1a')][_0x0c09('0x1c')]||null:null,'attributes':_0x50b5bd['options']?_0x50b5bd[_0x0c09('0x1a')][_0x0c09('0x1d')]||null:null,'limit':_0x50b5bd[_0x0c09('0x1a')]?_0x50b5bd[_0x0c09('0x1a')]['limit']||null:null,'include':_0x50b5bd['options']?_0x50b5bd['options']['include']?_[_0x0c09('0x1e')](_0x50b5bd[_0x0c09('0x1a')][_0x0c09('0x1f')],function(_0x31c0d6){return{'model':db[_0x31c0d6['model']],'as':_0x31c0d6['as'],'attributes':_0x31c0d6[_0x0c09('0x1d')],'include':_0x31c0d6['include']?_[_0x0c09('0x1e')](_0x31c0d6[_0x0c09('0x1f')],function(_0x5a8532){return{'model':db[_0x5a8532['model']],'as':_0x5a8532['as'],'attributes':_0x5a8532['attributes'],'include':_0x5a8532[_0x0c09('0x1f')]?_['map'](_0x5a8532[_0x0c09('0x1f')],function(_0x3469c2){return{'model':db[_0x3469c2['model']],'as':_0x3469c2['as'],'attributes':_0x3469c2[_0x0c09('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c09('0xc')](function(_0x17edf0){logger['info'](_0x0c09('0x17'),_0x50b5bd);logger[_0x0c09('0xf')]('GetServicenowAccount',_0x50b5bd,JSON[_0x0c09('0x20')](_0x17edf0));_0x98df51(_0x17edf0);})[_0x0c09('0x16')](function(_0x4a5b86){logger[_0x0c09('0x12')](_0x0c09('0x17'),_0x4a5b86[_0x0c09('0x14')],_0x50b5bd);_0x3614d1(_0x11719c[_0x0c09('0x12')](0x1f4,_0x4a5b86[_0x0c09('0x14')]));});});};exports[_0x0c09('0x21')]=function(_0x545edc){var _0x5ce6ba=this;return new Promise(function(_0x38fce8,_0x24c06b){return db[_0x0c09('0x18')][_0x0c09('0x22')]({'raw':_0x545edc[_0x0c09('0x1a')]?_0x545edc[_0x0c09('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x545edc['options']?_0x545edc['options'][_0x0c09('0x1c')]||null:null,'attributes':_0x545edc[_0x0c09('0x1a')]?_0x545edc['options'][_0x0c09('0x1d')]||null:null,'include':_0x545edc[_0x0c09('0x1a')]?_0x545edc[_0x0c09('0x1a')]['include']?_[_0x0c09('0x1e')](_0x545edc[_0x0c09('0x1a')][_0x0c09('0x1f')],function(_0x29655f){return{'model':db[_0x29655f[_0x0c09('0x23')]],'as':_0x29655f['as'],'attributes':_0x29655f['attributes'],'include':_0x29655f[_0x0c09('0x1f')]?_['map'](_0x29655f[_0x0c09('0x1f')],function(_0x443844){return{'model':db[_0x443844['model']],'as':_0x443844['as'],'attributes':_0x443844[_0x0c09('0x1d')],'include':_0x443844[_0x0c09('0x1f')]?_['map'](_0x443844[_0x0c09('0x1f')],function(_0x5d930b){return{'model':db[_0x5d930b['model']],'as':_0x5d930b['as'],'attributes':_0x5d930b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c09('0xc')](function(_0x3110d2){logger['info'](_0x0c09('0x21'),_0x545edc);logger[_0x0c09('0xf')](_0x0c09('0x21'),_0x545edc,JSON[_0x0c09('0x20')](_0x3110d2));_0x38fce8(_0x3110d2);})['catch'](function(_0x2a01ed){logger[_0x0c09('0x12')](_0x0c09('0x21'),_0x2a01ed[_0x0c09('0x14')],_0x545edc);_0x24c06b(_0x5ce6ba['error'](0x1f4,_0x2a01ed[_0x0c09('0x14')]));});});}; \ No newline at end of file +var _0x65b5=['then','ShowServicenowAccount','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','debug','find','where'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x65b5,0x156));var _0x565b=function(_0x8458cf,_0x303751){_0x8458cf=_0x8458cf-0x0;var _0x2a12af=_0x65b5[_0x8458cf];return _0x2a12af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x565b('0x0'));var BPromise=require(_0x565b('0x1'));var rs=require(_0x565b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x565b('0x3'))['db'];var utils=require(_0x565b('0x4'));var logger=require(_0x565b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x565b('0x6'));var client=jayson[_0x565b('0x7')][_0x565b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4489ef,_0x33db81,_0xe09f5f){return new BPromise(function(_0x7220d6,_0x3acce9){return client[_0x565b('0x9')](_0x4489ef,_0xe09f5f)['then'](function(_0x166e80){logger[_0x565b('0xa')](_0x565b('0xb'),_0x33db81,'request\x20sent');logger['debug'](_0x565b('0xc'),_0x33db81,'request\x20sent',JSON[_0x565b('0xd')](_0x166e80));if(_0x166e80['error']){if(_0x166e80['error'][_0x565b('0xe')]===0x1f4){logger[_0x565b('0xf')](_0x565b('0xb'),_0x33db81,_0x166e80[_0x565b('0xf')]['message']);return _0x3acce9(_0x166e80[_0x565b('0xf')][_0x565b('0x10')]);}logger[_0x565b('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x33db81,_0x166e80[_0x565b('0xf')][_0x565b('0x10')]);return _0x7220d6(_0x166e80['error'][_0x565b('0x10')]);}else{logger[_0x565b('0xa')](_0x565b('0xb'),_0x33db81,_0x565b('0x11'));_0x7220d6(_0x166e80[_0x565b('0x12')][_0x565b('0x10')]);}})['catch'](function(_0x1a08dc){logger[_0x565b('0xf')](_0x565b('0xb'),_0x33db81,_0x1a08dc);_0x3acce9(_0x1a08dc);});});}exports[_0x565b('0x13')]=function(_0x55934f){var _0x4202c7=this;return new Promise(function(_0x26ccc5,_0x1b7858){return db[_0x565b('0x14')][_0x565b('0x15')]({'raw':_0x55934f[_0x565b('0x16')]?_0x55934f['options'][_0x565b('0x17')]===undefined?!![]:![]:!![],'where':_0x55934f[_0x565b('0x16')]?_0x55934f[_0x565b('0x16')]['where']||null:null,'attributes':_0x55934f[_0x565b('0x16')]?_0x55934f[_0x565b('0x16')]['attributes']||null:null,'limit':_0x55934f[_0x565b('0x16')]?_0x55934f[_0x565b('0x16')][_0x565b('0x18')]||null:null,'include':_0x55934f[_0x565b('0x16')]?_0x55934f[_0x565b('0x16')][_0x565b('0x19')]?_[_0x565b('0x1a')](_0x55934f['options'][_0x565b('0x19')],function(_0x1e77dd){return{'model':db[_0x1e77dd[_0x565b('0x1b')]],'as':_0x1e77dd['as'],'attributes':_0x1e77dd['attributes'],'include':_0x1e77dd[_0x565b('0x19')]?_[_0x565b('0x1a')](_0x1e77dd[_0x565b('0x19')],function(_0x2adc83){return{'model':db[_0x2adc83[_0x565b('0x1b')]],'as':_0x2adc83['as'],'attributes':_0x2adc83['attributes'],'include':_0x2adc83['include']?_[_0x565b('0x1a')](_0x2adc83['include'],function(_0x564162){return{'model':db[_0x564162[_0x565b('0x1b')]],'as':_0x564162['as'],'attributes':_0x564162[_0x565b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1beaf9){logger[_0x565b('0xa')](_0x565b('0x13'),_0x55934f);logger[_0x565b('0x1d')]('GetServicenowAccount',_0x55934f,JSON['stringify'](_0x1beaf9));_0x26ccc5(_0x1beaf9);})['catch'](function(_0x50986a){logger[_0x565b('0xf')](_0x565b('0x13'),_0x50986a[_0x565b('0x10')],_0x55934f);_0x1b7858(_0x4202c7['error'](0x1f4,_0x50986a['message']));});});};exports['ShowServicenowAccount']=function(_0xe830a9){var _0x2a10d6=this;return new Promise(function(_0x4a0bb4,_0x3fddec){return db['ServicenowAccount'][_0x565b('0x1e')]({'raw':_0xe830a9[_0x565b('0x16')]?_0xe830a9['options'][_0x565b('0x17')]===undefined?!![]:![]:!![],'where':_0xe830a9[_0x565b('0x16')]?_0xe830a9[_0x565b('0x16')][_0x565b('0x1f')]||null:null,'attributes':_0xe830a9[_0x565b('0x16')]?_0xe830a9[_0x565b('0x16')][_0x565b('0x1c')]||null:null,'include':_0xe830a9['options']?_0xe830a9[_0x565b('0x16')][_0x565b('0x19')]?_['map'](_0xe830a9['options'][_0x565b('0x19')],function(_0xecf82e){return{'model':db[_0xecf82e[_0x565b('0x1b')]],'as':_0xecf82e['as'],'attributes':_0xecf82e[_0x565b('0x1c')],'include':_0xecf82e[_0x565b('0x19')]?_[_0x565b('0x1a')](_0xecf82e['include'],function(_0x4f0bab){return{'model':db[_0x4f0bab[_0x565b('0x1b')]],'as':_0x4f0bab['as'],'attributes':_0x4f0bab[_0x565b('0x1c')],'include':_0x4f0bab[_0x565b('0x19')]?_[_0x565b('0x1a')](_0x4f0bab[_0x565b('0x19')],function(_0x104fce){return{'model':db[_0x104fce[_0x565b('0x1b')]],'as':_0x104fce['as'],'attributes':_0x104fce[_0x565b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x565b('0x20')](function(_0x1266d5){logger[_0x565b('0xa')](_0x565b('0x21'),_0xe830a9);logger['debug'](_0x565b('0x21'),_0xe830a9,JSON[_0x565b('0xd')](_0x1266d5));_0x4a0bb4(_0x1266d5);})['catch'](function(_0x929e3f){logger[_0x565b('0xf')](_0x565b('0x21'),_0x929e3f['message'],_0xe830a9);_0x3fddec(_0x2a10d6[_0x565b('0xf')](0x1f4,_0x929e3f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 074a3e8..bdc1a22 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 _0x8414=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete'];(function(_0x1aabfb,_0x15f552){var _0x279cf6=function(_0x5d3c01){while(--_0x5d3c01){_0x1aabfb['push'](_0x1aabfb['shift']());}};_0x279cf6(++_0x15f552);}(_0x8414,0x192));var _0x4841=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x8414[_0x2a6fd5];return _0x43c6a4;};'use strict';var multer=require(_0x4841('0x0'));var util=require(_0x4841('0x1'));var path=require(_0x4841('0x2'));var timeout=require('connect-timeout');var express=require(_0x4841('0x3'));var router=express['Router']();var auth=require(_0x4841('0x4'));var interaction=require(_0x4841('0x5'));var config=require(_0x4841('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x4841('0x7')](),controller[_0x4841('0x8')]);router[_0x4841('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4841('0xa')]);router[_0x4841('0x9')](_0x4841('0xb'),auth['isAuthenticated'](),controller[_0x4841('0xc')]);router['get'](_0x4841('0xd'),auth[_0x4841('0x7')](),controller[_0x4841('0xe')]);router[_0x4841('0x9')](_0x4841('0xf'),auth[_0x4841('0x7')](),controller[_0x4841('0x10')]);router[_0x4841('0x11')]('/',auth[_0x4841('0x7')](),controller[_0x4841('0x12')]);router[_0x4841('0x13')](_0x4841('0x14'),auth[_0x4841('0x7')](),controller[_0x4841('0x15')]);router[_0x4841('0x16')]('/:id',auth[_0x4841('0x7')](),controller[_0x4841('0x17')]);module[_0x4841('0x18')]=router; \ No newline at end of file +var _0xbc04=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0xe41308,_0x47c625){var _0x14816f=function(_0x4083b7){while(--_0x4083b7){_0xe41308['push'](_0xe41308['shift']());}};_0x14816f(++_0x47c625);}(_0xbc04,0x14d));var _0x4bc0=function(_0x3c65d8,_0x3ba16a){_0x3c65d8=_0x3c65d8-0x0;var _0x34b3fe=_0xbc04[_0x3c65d8];return _0x34b3fe;};'use strict';var multer=require(_0x4bc0('0x0'));var util=require('util');var path=require(_0x4bc0('0x1'));var timeout=require(_0x4bc0('0x2'));var express=require(_0x4bc0('0x3'));var router=express[_0x4bc0('0x4')]();var auth=require(_0x4bc0('0x5'));var interaction=require(_0x4bc0('0x6'));var config=require(_0x4bc0('0x7'));var controller=require(_0x4bc0('0x8'));router[_0x4bc0('0x9')]('/',auth[_0x4bc0('0xa')](),controller[_0x4bc0('0xb')]);router[_0x4bc0('0x9')](_0x4bc0('0xc'),auth[_0x4bc0('0xa')](),controller[_0x4bc0('0xd')]);router[_0x4bc0('0x9')](_0x4bc0('0xe'),auth[_0x4bc0('0xa')](),controller[_0x4bc0('0xf')]);router[_0x4bc0('0x9')](_0x4bc0('0x10'),auth[_0x4bc0('0xa')](),controller[_0x4bc0('0x11')]);router[_0x4bc0('0x9')](_0x4bc0('0x12'),auth[_0x4bc0('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x4bc0('0xa')](),controller[_0x4bc0('0x13')]);router['put'](_0x4bc0('0xc'),auth[_0x4bc0('0xa')](),controller[_0x4bc0('0x14')]);router[_0x4bc0('0x15')](_0x4bc0('0xc'),auth[_0x4bc0('0xa')](),controller[_0x4bc0('0x16')]);module[_0x4bc0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f319ed5..192c141 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 _0x5d30=['exports','STRING'];(function(_0x112488,_0x39a9fd){var _0x29cff2=function(_0xb90ef3){while(--_0xb90ef3){_0x112488['push'](_0x112488['shift']());}};_0x29cff2(++_0x39a9fd);}(_0x5d30,0x1f4));var _0x05d3=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x5d30[_0x8bb4c1];return _0x67a6e1;};'use strict';var Sequelize=require('sequelize');module[_0x05d3('0x0')]={'name':{'type':Sequelize[_0x05d3('0x1')]},'description':{'type':Sequelize[_0x05d3('0x1')]}}; \ No newline at end of file +var _0x51d8=['exports','STRING','sequelize'];(function(_0x13cfbd,_0x49a391){var _0x5c7245=function(_0x138e72){while(--_0x138e72){_0x13cfbd['push'](_0x13cfbd['shift']());}};_0x5c7245(++_0x49a391);}(_0x51d8,0x13a));var _0x851d=function(_0x1b070a,_0x18fee1){_0x1b070a=_0x1b070a-0x0;var _0x73ec5f=_0x51d8[_0x1b070a];return _0x73ec5f;};'use strict';var Sequelize=require(_0x851d('0x0'));module[_0x851d('0x1')]={'name':{'type':Sequelize[_0x851d('0x2')]},'description':{'type':Sequelize[_0x851d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 265f694..eb715c6 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 _0x7d32=['pick','filter','options','findAll','rows','catch','params','includeAll','create','update','body','find','findOne','ServicenowField','order','merge','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x2e0a85,_0x242749){var _0x2c49bb=function(_0x320362){while(--_0x320362){_0x2e0a85['push'](_0x2e0a85['shift']());}};_0x2c49bb(++_0x242749);}(_0x7d32,0xc5));var _0x27d3=function(_0x58d104,_0x388544){_0x58d104=_0x58d104-0x0;var _0x34f3eb=_0x7d32[_0x58d104];return _0x34f3eb;};'use strict';var pdf=require(_0x27d3('0x0'));var emlformat=require(_0x27d3('0x1'));var rimraf=require(_0x27d3('0x2'));var zipdir=require(_0x27d3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27d3('0x4'));var moment=require(_0x27d3('0x5'));var BPromise=require(_0x27d3('0x6'));var Mustache=require('mustache');var util=require(_0x27d3('0x7'));var path=require('path');var sox=require(_0x27d3('0x8'));var csv=require(_0x27d3('0x9'));var ejs=require(_0x27d3('0xa'));var fs=require('fs');var _=require(_0x27d3('0xb'));var squel=require(_0x27d3('0xc'));var crypto=require('crypto');var jsforce=require(_0x27d3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x27d3('0x9'));var querystring=require(_0x27d3('0xe'));var Papa=require(_0x27d3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27d3('0x10'));var as=require(_0x27d3('0x11'));var hardwareService=require(_0x27d3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x27d3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x27d3('0x14'));var db=require(_0x27d3('0x15'))['db'];var jayson=require(_0x27d3('0x16'));var client=jayson[_0x27d3('0x17')][_0x27d3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4bb49f,_0x2a37be,_0x39001f,_0x5f44e7){return new BPromise(function(_0x2d24c4,_0x2811ef){var _0x16376b=_0x5f44e7||client;return _0x16376b['request'](_0x4bb49f,_0x39001f)[_0x27d3('0x19')](function(_0x324c79){logger[_0x27d3('0x1a')](_0x27d3('0x1b'),_0x2a37be,_0x27d3('0x1c'));logger[_0x27d3('0x1d')](_0x27d3('0x1e'),_0x2a37be,_0x27d3('0x1c'),JSON[_0x27d3('0x1f')](_0x324c79));if(_0x324c79[_0x27d3('0x20')]){if(_0x324c79['error'][_0x27d3('0x21')]===0x1f4){logger[_0x27d3('0x20')](_0x27d3('0x1b'),_0x2a37be,_0x324c79[_0x27d3('0x20')][_0x27d3('0x22')]);return _0x2811ef(_0x324c79[_0x27d3('0x20')][_0x27d3('0x22')]);}logger[_0x27d3('0x20')](_0x27d3('0x1b'),_0x2a37be,_0x324c79['error'][_0x27d3('0x22')]);return _0x2d24c4(_0x324c79['error'][_0x27d3('0x22')]);}else{logger[_0x27d3('0x1a')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a37be,_0x27d3('0x1c'));_0x2d24c4(_0x324c79[_0x27d3('0x23')]['message']);}})['catch'](function(_0x154f28){logger[_0x27d3('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a37be,_0x154f28);_0x2811ef(_0x154f28);});});}function respondWithStatusCode(_0x12f342,_0x30f273){_0x30f273=_0x30f273||0xcc;return function(_0x131690){if(_0x131690){return _0x12f342[_0x27d3('0x24')](_0x30f273);}return _0x12f342[_0x27d3('0x25')](_0x30f273)[_0x27d3('0x26')]();};}function respondWithResult(_0x50a720,_0x58c047){_0x58c047=_0x58c047||0xc8;return function(_0xba0cf4){if(_0xba0cf4){return _0x50a720[_0x27d3('0x25')](_0x58c047)[_0x27d3('0x27')](_0xba0cf4);}};}function respondWithFilteredResult(_0x2ef394,_0x415a10){return function(_0x2a46a4){if(_0x2a46a4){var _0x36536c=_0x2a46a4[_0x27d3('0x28')],_0x384742=_0x415a10[_0x27d3('0x29')],_0x14c8b5=_0x415a10[_0x27d3('0x29')]+_0x415a10['limit'],_0x746c00;if(_0x14c8b5>=_0x36536c){_0x14c8b5=_0x36536c;_0x746c00=0xc8;}else{_0x746c00=0xce;}_0x2ef394[_0x27d3('0x25')](_0x746c00);return _0x2ef394[_0x27d3('0x2a')](_0x27d3('0x2b'),_0x384742+'-'+_0x14c8b5+'/'+_0x36536c)[_0x27d3('0x27')](_0x2a46a4);}return null;};}function patchUpdates(_0x2de1ab){return function(_0x2e82b8){try{jsonpatch[_0x27d3('0x2c')](_0x2e82b8,_0x2de1ab,!![]);}catch(_0x45d7ca){return BPromise[_0x27d3('0x2d')](_0x45d7ca);}return _0x2e82b8['save']();};}function saveUpdates(_0x4b9afb,_0x55a7ab){return function(_0x503914){if(_0x503914){return _0x503914['update'](_0x4b9afb)[_0x27d3('0x19')](function(_0x569229){return _0x569229;});}return null;};}function removeEntity(_0x19f8b4,_0x8ee7e8){return function(_0x6ba4de){if(_0x6ba4de){return _0x6ba4de[_0x27d3('0x2e')]()['then'](function(){_0x19f8b4[_0x27d3('0x25')](0xcc)[_0x27d3('0x26')]();});}};}function handleEntityNotFound(_0x1903ba,_0x92c565){return function(_0x39d06e){if(!_0x39d06e){_0x1903ba[_0x27d3('0x24')](0x194);}return _0x39d06e;};}function handleError(_0x5cc02f,_0x3ae3f9){_0x3ae3f9=_0x3ae3f9||0x1f4;return function(_0x2b450b){logger[_0x27d3('0x20')](_0x2b450b[_0x27d3('0x2f')]);if(_0x2b450b[_0x27d3('0x30')]){delete _0x2b450b[_0x27d3('0x30')];}_0x5cc02f[_0x27d3('0x25')](_0x3ae3f9)[_0x27d3('0x31')](_0x2b450b);};}exports[_0x27d3('0x32')]=function(_0xeb92,_0x4eb630){var _0x562e3a={},_0x5aea8a={},_0x43bf2c={'count':0x0,'rows':[]};var _0x6199ab=_[_0x27d3('0x33')](db[_0x27d3('0x34')][_0x27d3('0x35')],function(_0xce42a1){return{'name':_0xce42a1[_0x27d3('0x36')],'type':_0xce42a1[_0x27d3('0x37')][_0x27d3('0x38')]};});_0x5aea8a['model']=_[_0x27d3('0x33')](_0x6199ab,'name');_0x5aea8a[_0x27d3('0x39')]=_[_0x27d3('0x3a')](_0xeb92[_0x27d3('0x39')]);_0x5aea8a[_0x27d3('0x3b')]=_[_0x27d3('0x3c')](_0x5aea8a[_0x27d3('0x3d')],_0x5aea8a[_0x27d3('0x39')]);_0x562e3a[_0x27d3('0x3e')]=_[_0x27d3('0x3c')](_0x5aea8a[_0x27d3('0x3d')],qs['fields'](_0xeb92[_0x27d3('0x39')][_0x27d3('0x3f')]));_0x562e3a[_0x27d3('0x3e')]=_0x562e3a['attributes'][_0x27d3('0x40')]?_0x562e3a[_0x27d3('0x3e')]:_0x5aea8a[_0x27d3('0x3d')];if(!_0xeb92[_0x27d3('0x39')][_0x27d3('0x41')](_0x27d3('0x42'))){_0x562e3a['limit']=qs[_0x27d3('0x43')](_0xeb92[_0x27d3('0x39')]['limit']);_0x562e3a[_0x27d3('0x29')]=qs[_0x27d3('0x29')](_0xeb92[_0x27d3('0x39')]['offset']);}_0x562e3a['order']=qs[_0x27d3('0x44')](_0xeb92[_0x27d3('0x39')]['sort']);_0x562e3a[_0x27d3('0x45')]=qs['filters'](_[_0x27d3('0x46')](_0xeb92[_0x27d3('0x39')],_0x5aea8a['filters']),_0x6199ab);if(_0xeb92['query']['filter']){_0x562e3a['where']=_['merge'](_0x562e3a[_0x27d3('0x45')],{'$or':_[_0x27d3('0x33')](_0x6199ab,function(_0x572d92){if(_0x572d92['type']!=='VIRTUAL'){var _0x20158a={};_0x20158a[_0x572d92[_0x27d3('0x30')]]={'$like':'%'+_0xeb92[_0x27d3('0x39')][_0x27d3('0x47')]+'%'};return _0x20158a;}})});}_0x562e3a=_['merge']({},_0x562e3a,_0xeb92[_0x27d3('0x48')]);var _0x5b2137={'where':_0x562e3a['where']};return db[_0x27d3('0x34')]['count'](_0x5b2137)['then'](function(_0x27dcc6){_0x43bf2c['count']=_0x27dcc6;if(_0xeb92['query']['includeAll']){_0x562e3a['include']=[{'all':!![]}];}return db[_0x27d3('0x34')][_0x27d3('0x49')](_0x562e3a);})[_0x27d3('0x19')](function(_0x42783e){_0x43bf2c[_0x27d3('0x4a')]=_0x42783e;return _0x43bf2c;})[_0x27d3('0x19')](respondWithFilteredResult(_0x4eb630,_0x562e3a))[_0x27d3('0x4b')](handleError(_0x4eb630,null));};exports['show']=function(_0x21f437,_0x1d9449){var _0x5156ba={'raw':![],'where':{'id':_0x21f437[_0x27d3('0x4c')]['id']}},_0xa924de={};_0xa924de['model']=_[_0x27d3('0x3a')](db['ServicenowConfiguration'][_0x27d3('0x35')]);_0xa924de[_0x27d3('0x39')]=_['keys'](_0x21f437['query']);_0xa924de[_0x27d3('0x3b')]=_['intersection'](_0xa924de[_0x27d3('0x3d')],_0xa924de['query']);_0x5156ba[_0x27d3('0x3e')]=_[_0x27d3('0x3c')](_0xa924de[_0x27d3('0x3d')],qs[_0x27d3('0x3f')](_0x21f437[_0x27d3('0x39')][_0x27d3('0x3f')]));_0x5156ba[_0x27d3('0x3e')]=_0x5156ba[_0x27d3('0x3e')][_0x27d3('0x40')]?_0x5156ba['attributes']:_0xa924de[_0x27d3('0x3d')];if(_0x21f437[_0x27d3('0x39')][_0x27d3('0x4d')]){_0x5156ba['include']=[{'all':!![]}];}_0x5156ba=_['merge']({},_0x5156ba,_0x21f437[_0x27d3('0x48')]);return db[_0x27d3('0x34')]['find'](_0x5156ba)[_0x27d3('0x19')](handleEntityNotFound(_0x1d9449,null))[_0x27d3('0x19')](respondWithResult(_0x1d9449,null))[_0x27d3('0x4b')](handleError(_0x1d9449,null));};exports[_0x27d3('0x4e')]=function(_0x1a3157,_0x4a2a39){return db['ServicenowConfiguration'][_0x27d3('0x4e')](_0x1a3157['body'],{})['then'](respondWithResult(_0x4a2a39,0xc9))[_0x27d3('0x4b')](handleError(_0x4a2a39,null));};exports[_0x27d3('0x4f')]=function(_0x5d956d,_0x5eb75d){if(_0x5d956d[_0x27d3('0x50')]['id']){delete _0x5d956d[_0x27d3('0x50')]['id'];}return db[_0x27d3('0x34')][_0x27d3('0x51')]({'where':{'id':_0x5d956d[_0x27d3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5eb75d,null))[_0x27d3('0x19')](saveUpdates(_0x5d956d[_0x27d3('0x50')],null))['then'](respondWithResult(_0x5eb75d,null))[_0x27d3('0x4b')](handleError(_0x5eb75d,null));};exports[_0x27d3('0x2e')]=function(_0x3b2c2c,_0x29d5e9){return db[_0x27d3('0x34')][_0x27d3('0x51')]({'where':{'id':_0x3b2c2c[_0x27d3('0x4c')]['id']}})[_0x27d3('0x19')](handleEntityNotFound(_0x29d5e9,null))[_0x27d3('0x19')](removeEntity(_0x29d5e9,null))[_0x27d3('0x4b')](handleError(_0x29d5e9,null));};exports['getFields']=function(_0x25016f,_0x50f3f,_0x573752){var _0x98e460={};var _0x54ca81={};var _0x27025d;var _0x2baf3c;return db[_0x27d3('0x34')][_0x27d3('0x52')]({'where':{'id':_0x25016f['params']['id']}})['then'](handleEntityNotFound(_0x50f3f,null))[_0x27d3('0x19')](function(_0x4089a9){if(_0x4089a9){_0x27025d=_0x4089a9;_0x54ca81[_0x27d3('0x3d')]=_[_0x27d3('0x3a')](db[_0x27d3('0x53')][_0x27d3('0x35')]);_0x54ca81['query']=_[_0x27d3('0x3a')](_0x25016f[_0x27d3('0x39')]);_0x54ca81['filters']=_[_0x27d3('0x3c')](_0x54ca81[_0x27d3('0x3d')],_0x54ca81[_0x27d3('0x39')]);_0x98e460[_0x27d3('0x3e')]=_[_0x27d3('0x3c')](_0x54ca81[_0x27d3('0x3d')],qs['fields'](_0x25016f['query'][_0x27d3('0x3f')]));_0x98e460[_0x27d3('0x3e')]=_0x98e460[_0x27d3('0x3e')][_0x27d3('0x40')]?_0x98e460['attributes']:_0x54ca81[_0x27d3('0x3d')];_0x98e460[_0x27d3('0x54')]=qs[_0x27d3('0x44')](_0x25016f[_0x27d3('0x39')][_0x27d3('0x44')]);_0x98e460[_0x27d3('0x45')]=qs[_0x27d3('0x3b')](_[_0x27d3('0x46')](_0x25016f[_0x27d3('0x39')],_0x54ca81[_0x27d3('0x3b')]));if(_0x25016f[_0x27d3('0x39')]['filter']){_0x98e460['where']=_[_0x27d3('0x55')](_0x98e460[_0x27d3('0x45')],{'$or':_[_0x27d3('0x33')](_0x98e460[_0x27d3('0x3e')],function(_0x4aec0a){var _0x2c1a0e={};_0x2c1a0e[_0x4aec0a]={'$like':'%'+_0x25016f[_0x27d3('0x39')]['filter']+'%'};return _0x2c1a0e;})});}_0x98e460=_[_0x27d3('0x55')]({},_0x98e460,_0x25016f[_0x27d3('0x48')]);return _0x27025d[_0x27d3('0x56')](_0x98e460);}})['then'](function(_0x2d1bca){if(_0x2d1bca){_0x2baf3c=_0x2d1bca['length'];if(!_0x25016f[_0x27d3('0x39')][_0x27d3('0x41')](_0x27d3('0x42'))){_0x98e460[_0x27d3('0x43')]=qs[_0x27d3('0x43')](_0x25016f[_0x27d3('0x39')][_0x27d3('0x43')]);_0x98e460[_0x27d3('0x29')]=qs[_0x27d3('0x29')](_0x25016f[_0x27d3('0x39')][_0x27d3('0x29')]);}return _0x27025d[_0x27d3('0x56')](_0x98e460);}})[_0x27d3('0x19')](function(_0x1916fc){if(_0x1916fc){return _0x1916fc?{'count':_0x2baf3c,'rows':_0x1916fc}:null;}})['then'](respondWithResult(_0x50f3f,null))[_0x27d3('0x4b')](handleError(_0x50f3f,null));};exports[_0x27d3('0x57')]=function(_0x273a8c,_0x3bae35,_0x2b15d6){var _0x1e9a16={};var _0x3b2950={};var _0x4951eb;var _0x516e2a;return db[_0x27d3('0x34')][_0x27d3('0x52')]({'where':{'id':_0x273a8c[_0x27d3('0x4c')]['id']}})[_0x27d3('0x19')](handleEntityNotFound(_0x3bae35,null))[_0x27d3('0x19')](function(_0x12e19d){if(_0x12e19d){_0x4951eb=_0x12e19d;_0x3b2950[_0x27d3('0x3d')]=_[_0x27d3('0x3a')](db['ServicenowField'][_0x27d3('0x35')]);_0x3b2950[_0x27d3('0x39')]=_['keys'](_0x273a8c[_0x27d3('0x39')]);_0x3b2950[_0x27d3('0x3b')]=_[_0x27d3('0x3c')](_0x3b2950[_0x27d3('0x3d')],_0x3b2950[_0x27d3('0x39')]);_0x1e9a16[_0x27d3('0x3e')]=_['intersection'](_0x3b2950[_0x27d3('0x3d')],qs[_0x27d3('0x3f')](_0x273a8c['query'][_0x27d3('0x3f')]));_0x1e9a16[_0x27d3('0x3e')]=_0x1e9a16['attributes'][_0x27d3('0x40')]?_0x1e9a16['attributes']:_0x3b2950[_0x27d3('0x3d')];_0x1e9a16['order']=qs[_0x27d3('0x44')](_0x273a8c[_0x27d3('0x39')]['sort']);_0x1e9a16[_0x27d3('0x45')]=qs[_0x27d3('0x3b')](_[_0x27d3('0x46')](_0x273a8c[_0x27d3('0x39')],_0x3b2950[_0x27d3('0x3b')]));if(_0x273a8c['query'][_0x27d3('0x47')]){_0x1e9a16[_0x27d3('0x45')]=_[_0x27d3('0x55')](_0x1e9a16['where'],{'$or':_[_0x27d3('0x33')](_0x1e9a16[_0x27d3('0x3e')],function(_0x46c309){var _0x4b4fd4={};_0x4b4fd4[_0x46c309]={'$like':'%'+_0x273a8c[_0x27d3('0x39')]['filter']+'%'};return _0x4b4fd4;})});}_0x1e9a16=_[_0x27d3('0x55')]({},_0x1e9a16,_0x273a8c[_0x27d3('0x48')]);return _0x4951eb[_0x27d3('0x57')](_0x1e9a16);}})[_0x27d3('0x19')](function(_0xaea449){if(_0xaea449){_0x516e2a=_0xaea449[_0x27d3('0x40')];if(!_0x273a8c[_0x27d3('0x39')]['hasOwnProperty'](_0x27d3('0x42'))){_0x1e9a16[_0x27d3('0x43')]=qs[_0x27d3('0x43')](_0x273a8c[_0x27d3('0x39')][_0x27d3('0x43')]);_0x1e9a16[_0x27d3('0x29')]=qs[_0x27d3('0x29')](_0x273a8c[_0x27d3('0x39')][_0x27d3('0x29')]);}return _0x4951eb['getSubjects'](_0x1e9a16);}})[_0x27d3('0x19')](function(_0x115adf){if(_0x115adf){return _0x115adf?{'count':_0x516e2a,'rows':_0x115adf}:null;}})[_0x27d3('0x19')](respondWithResult(_0x3bae35,null))[_0x27d3('0x4b')](handleError(_0x3bae35,null));};exports[_0x27d3('0x58')]=function(_0x544dea,_0x3d0c72,_0x5ac131){var _0x19c7de={};var _0x339d2b={};var _0x137731;var _0x45c3ba;return db[_0x27d3('0x34')][_0x27d3('0x52')]({'where':{'id':_0x544dea['params']['id']}})[_0x27d3('0x19')](handleEntityNotFound(_0x3d0c72,null))[_0x27d3('0x19')](function(_0x27c3d6){if(_0x27c3d6){_0x137731=_0x27c3d6;_0x339d2b['model']=_[_0x27d3('0x3a')](db[_0x27d3('0x53')][_0x27d3('0x35')]);_0x339d2b[_0x27d3('0x39')]=_[_0x27d3('0x3a')](_0x544dea[_0x27d3('0x39')]);_0x339d2b['filters']=_[_0x27d3('0x3c')](_0x339d2b[_0x27d3('0x3d')],_0x339d2b[_0x27d3('0x39')]);_0x19c7de[_0x27d3('0x3e')]=_['intersection'](_0x339d2b['model'],qs[_0x27d3('0x3f')](_0x544dea[_0x27d3('0x39')][_0x27d3('0x3f')]));_0x19c7de[_0x27d3('0x3e')]=_0x19c7de[_0x27d3('0x3e')][_0x27d3('0x40')]?_0x19c7de[_0x27d3('0x3e')]:_0x339d2b['model'];_0x19c7de[_0x27d3('0x54')]=qs['sort'](_0x544dea['query'][_0x27d3('0x44')]);_0x19c7de['where']=qs[_0x27d3('0x3b')](_[_0x27d3('0x46')](_0x544dea[_0x27d3('0x39')],_0x339d2b['filters']));if(_0x544dea[_0x27d3('0x39')]['filter']){_0x19c7de[_0x27d3('0x45')]=_[_0x27d3('0x55')](_0x19c7de[_0x27d3('0x45')],{'$or':_[_0x27d3('0x33')](_0x19c7de['attributes'],function(_0x399c0d){var _0x5077ce={};_0x5077ce[_0x399c0d]={'$like':'%'+_0x544dea['query'][_0x27d3('0x47')]+'%'};return _0x5077ce;})});}_0x19c7de=_[_0x27d3('0x55')]({},_0x19c7de,_0x544dea['options']);return _0x137731[_0x27d3('0x58')](_0x19c7de);}})[_0x27d3('0x19')](function(_0x2ca8c6){if(_0x2ca8c6){_0x45c3ba=_0x2ca8c6[_0x27d3('0x40')];if(!_0x544dea['query'][_0x27d3('0x41')](_0x27d3('0x42'))){_0x19c7de[_0x27d3('0x43')]=qs[_0x27d3('0x43')](_0x544dea['query'][_0x27d3('0x43')]);_0x19c7de[_0x27d3('0x29')]=qs[_0x27d3('0x29')](_0x544dea[_0x27d3('0x39')][_0x27d3('0x29')]);}return _0x137731[_0x27d3('0x58')](_0x19c7de);}})[_0x27d3('0x19')](function(_0x48476e){if(_0x48476e){return _0x48476e?{'count':_0x45c3ba,'rows':_0x48476e}:null;}})[_0x27d3('0x19')](respondWithResult(_0x3d0c72,null))[_0x27d3('0x4b')](handleError(_0x3d0c72,null));}; \ No newline at end of file +var _0x8ab6=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','end','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','order','getFields','nolimit','getSubjects','findOne','ServicenowField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x8ab6,0x10e));var _0x68ab=function(_0x48f85b,_0x57e899){_0x48f85b=_0x48f85b-0x0;var _0x46e5e7=_0x8ab6[_0x48f85b];return _0x46e5e7;};'use strict';var pdf=require(_0x68ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x68ab('0x1'));var zipdir=require(_0x68ab('0x2'));var jsonpatch=require(_0x68ab('0x3'));var rp=require(_0x68ab('0x4'));var moment=require(_0x68ab('0x5'));var BPromise=require(_0x68ab('0x6'));var Mustache=require(_0x68ab('0x7'));var util=require(_0x68ab('0x8'));var path=require(_0x68ab('0x9'));var sox=require(_0x68ab('0xa'));var csv=require(_0x68ab('0xb'));var ejs=require(_0x68ab('0xc'));var fs=require('fs');var _=require(_0x68ab('0xd'));var squel=require(_0x68ab('0xe'));var crypto=require(_0x68ab('0xf'));var jsforce=require(_0x68ab('0x10'));var deskjs=require(_0x68ab('0x11'));var toCsv=require(_0x68ab('0xb'));var querystring=require(_0x68ab('0x12'));var Papa=require(_0x68ab('0x13'));var Redis=require(_0x68ab('0x14'));var authService=require(_0x68ab('0x15'));var qs=require(_0x68ab('0x16'));var as=require(_0x68ab('0x17'));var hardwareService=require(_0x68ab('0x18'));var logger=require(_0x68ab('0x19'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x68ab('0x1a'));var db=require(_0x68ab('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x68ab('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1d4b90,_0x3f119e,_0x5f25d8,_0x1b057c){return new BPromise(function(_0x3f6fda,_0x9be73b){var _0x1ae8d8=_0x1b057c||client;return _0x1ae8d8[_0x68ab('0x1d')](_0x1d4b90,_0x5f25d8)[_0x68ab('0x1e')](function(_0x3d0b02){logger[_0x68ab('0x1f')](_0x68ab('0x20'),_0x3f119e,_0x68ab('0x21'));logger[_0x68ab('0x22')](_0x68ab('0x23'),_0x3f119e,_0x68ab('0x21'),JSON[_0x68ab('0x24')](_0x3d0b02));if(_0x3d0b02[_0x68ab('0x25')]){if(_0x3d0b02['error'][_0x68ab('0x26')]===0x1f4){logger[_0x68ab('0x25')](_0x68ab('0x20'),_0x3f119e,_0x3d0b02[_0x68ab('0x25')]['message']);return _0x9be73b(_0x3d0b02['error'][_0x68ab('0x27')]);}logger['error'](_0x68ab('0x20'),_0x3f119e,_0x3d0b02[_0x68ab('0x25')][_0x68ab('0x27')]);return _0x3f6fda(_0x3d0b02[_0x68ab('0x25')][_0x68ab('0x27')]);}else{logger['info'](_0x68ab('0x20'),_0x3f119e,_0x68ab('0x21'));_0x3f6fda(_0x3d0b02['result'][_0x68ab('0x27')]);}})['catch'](function(_0x2b1cc8){logger[_0x68ab('0x25')](_0x68ab('0x20'),_0x3f119e,_0x2b1cc8);_0x9be73b(_0x2b1cc8);});});}function respondWithStatusCode(_0x44ebf6,_0x376334){_0x376334=_0x376334||0xcc;return function(_0x3698b0){if(_0x3698b0){return _0x44ebf6[_0x68ab('0x28')](_0x376334);}return _0x44ebf6[_0x68ab('0x29')](_0x376334)['end']();};}function respondWithResult(_0x37556c,_0x7b648f){_0x7b648f=_0x7b648f||0xc8;return function(_0x3d3fa3){if(_0x3d3fa3){return _0x37556c[_0x68ab('0x29')](_0x7b648f)[_0x68ab('0x2a')](_0x3d3fa3);}};}function respondWithFilteredResult(_0x2432bc,_0x2634d3){return function(_0x1d47b3){if(_0x1d47b3){var _0x5e320f=_0x1d47b3[_0x68ab('0x2b')],_0x35872f=_0x2634d3['offset'],_0x363f5c=_0x2634d3[_0x68ab('0x2c')]+_0x2634d3[_0x68ab('0x2d')],_0x517538;if(_0x363f5c>=_0x5e320f){_0x363f5c=_0x5e320f;_0x517538=0xc8;}else{_0x517538=0xce;}_0x2432bc[_0x68ab('0x29')](_0x517538);return _0x2432bc['set'](_0x68ab('0x2e'),_0x35872f+'-'+_0x363f5c+'/'+_0x5e320f)['json'](_0x1d47b3);}return null;};}function patchUpdates(_0x205c35){return function(_0xae72ba){try{jsonpatch['apply'](_0xae72ba,_0x205c35,!![]);}catch(_0x3cf40c){return BPromise[_0x68ab('0x2f')](_0x3cf40c);}return _0xae72ba[_0x68ab('0x30')]();};}function saveUpdates(_0x45f8e7,_0x2fc8c1){return function(_0x9f41f){if(_0x9f41f){return _0x9f41f[_0x68ab('0x31')](_0x45f8e7)[_0x68ab('0x1e')](function(_0x2b20be){return _0x2b20be;});}return null;};}function removeEntity(_0x496780,_0x38a750){return function(_0x27483c){if(_0x27483c){return _0x27483c[_0x68ab('0x32')]()[_0x68ab('0x1e')](function(){_0x496780[_0x68ab('0x29')](0xcc)[_0x68ab('0x33')]();});}};}function handleEntityNotFound(_0x3bd322,_0x5e3a94){return function(_0x18a05e){if(!_0x18a05e){_0x3bd322['sendStatus'](0x194);}return _0x18a05e;};}function handleError(_0x566d68,_0x415e39){_0x415e39=_0x415e39||0x1f4;return function(_0x2af7eb){logger[_0x68ab('0x25')](_0x2af7eb[_0x68ab('0x34')]);if(_0x2af7eb[_0x68ab('0x35')]){delete _0x2af7eb[_0x68ab('0x35')];}_0x566d68[_0x68ab('0x29')](_0x415e39)['send'](_0x2af7eb);};}exports[_0x68ab('0x36')]=function(_0x3e48cd,_0x54b684){var _0x3e7809={},_0x4f39c9={},_0x266f12={'count':0x0,'rows':[]};var _0xa277f1=_[_0x68ab('0x37')](db[_0x68ab('0x38')][_0x68ab('0x39')],function(_0x317531){return{'name':_0x317531[_0x68ab('0x3a')],'type':_0x317531[_0x68ab('0x3b')][_0x68ab('0x3c')]};});_0x4f39c9[_0x68ab('0x3d')]=_[_0x68ab('0x37')](_0xa277f1,_0x68ab('0x35'));_0x4f39c9[_0x68ab('0x3e')]=_[_0x68ab('0x3f')](_0x3e48cd['query']);_0x4f39c9['filters']=_[_0x68ab('0x40')](_0x4f39c9[_0x68ab('0x3d')],_0x4f39c9[_0x68ab('0x3e')]);_0x3e7809[_0x68ab('0x41')]=_[_0x68ab('0x40')](_0x4f39c9['model'],qs[_0x68ab('0x42')](_0x3e48cd[_0x68ab('0x3e')][_0x68ab('0x42')]));_0x3e7809[_0x68ab('0x41')]=_0x3e7809[_0x68ab('0x41')]['length']?_0x3e7809[_0x68ab('0x41')]:_0x4f39c9[_0x68ab('0x3d')];if(!_0x3e48cd[_0x68ab('0x3e')][_0x68ab('0x43')]('nolimit')){_0x3e7809[_0x68ab('0x2d')]=qs[_0x68ab('0x2d')](_0x3e48cd[_0x68ab('0x3e')]['limit']);_0x3e7809[_0x68ab('0x2c')]=qs[_0x68ab('0x2c')](_0x3e48cd[_0x68ab('0x3e')][_0x68ab('0x2c')]);}_0x3e7809['order']=qs['sort'](_0x3e48cd['query'][_0x68ab('0x44')]);_0x3e7809[_0x68ab('0x45')]=qs[_0x68ab('0x46')](_[_0x68ab('0x47')](_0x3e48cd[_0x68ab('0x3e')],_0x4f39c9[_0x68ab('0x46')]),_0xa277f1);if(_0x3e48cd[_0x68ab('0x3e')]['filter']){_0x3e7809[_0x68ab('0x45')]=_['merge'](_0x3e7809[_0x68ab('0x45')],{'$or':_[_0x68ab('0x37')](_0xa277f1,function(_0x4b9571){if(_0x4b9571[_0x68ab('0x3b')]!=='VIRTUAL'){var _0x4f5364={};_0x4f5364[_0x4b9571[_0x68ab('0x35')]]={'$like':'%'+_0x3e48cd['query'][_0x68ab('0x48')]+'%'};return _0x4f5364;}})});}_0x3e7809=_[_0x68ab('0x49')]({},_0x3e7809,_0x3e48cd[_0x68ab('0x4a')]);var _0x53b666={'where':_0x3e7809[_0x68ab('0x45')]};return db[_0x68ab('0x38')][_0x68ab('0x2b')](_0x53b666)[_0x68ab('0x1e')](function(_0x4189df){_0x266f12['count']=_0x4189df;if(_0x3e48cd[_0x68ab('0x3e')][_0x68ab('0x4b')]){_0x3e7809[_0x68ab('0x4c')]=[{'all':!![]}];}return db[_0x68ab('0x38')][_0x68ab('0x4d')](_0x3e7809);})['then'](function(_0x4fbd58){_0x266f12[_0x68ab('0x4e')]=_0x4fbd58;return _0x266f12;})[_0x68ab('0x1e')](respondWithFilteredResult(_0x54b684,_0x3e7809))[_0x68ab('0x4f')](handleError(_0x54b684,null));};exports[_0x68ab('0x50')]=function(_0x215ae7,_0xf69185){var _0x2cbd5f={'raw':![],'where':{'id':_0x215ae7[_0x68ab('0x51')]['id']}},_0x1e76fd={};_0x1e76fd[_0x68ab('0x3d')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x1e76fd['query']=_['keys'](_0x215ae7[_0x68ab('0x3e')]);_0x1e76fd[_0x68ab('0x46')]=_[_0x68ab('0x40')](_0x1e76fd[_0x68ab('0x3d')],_0x1e76fd[_0x68ab('0x3e')]);_0x2cbd5f[_0x68ab('0x41')]=_['intersection'](_0x1e76fd['model'],qs[_0x68ab('0x42')](_0x215ae7[_0x68ab('0x3e')][_0x68ab('0x42')]));_0x2cbd5f[_0x68ab('0x41')]=_0x2cbd5f[_0x68ab('0x41')][_0x68ab('0x52')]?_0x2cbd5f['attributes']:_0x1e76fd[_0x68ab('0x3d')];if(_0x215ae7[_0x68ab('0x3e')][_0x68ab('0x4b')]){_0x2cbd5f['include']=[{'all':!![]}];}_0x2cbd5f=_[_0x68ab('0x49')]({},_0x2cbd5f,_0x215ae7['options']);return db[_0x68ab('0x38')]['find'](_0x2cbd5f)[_0x68ab('0x1e')](handleEntityNotFound(_0xf69185,null))[_0x68ab('0x1e')](respondWithResult(_0xf69185,null))[_0x68ab('0x4f')](handleError(_0xf69185,null));};exports[_0x68ab('0x53')]=function(_0x203b81,_0x4bb5c9){return db['ServicenowConfiguration'][_0x68ab('0x53')](_0x203b81[_0x68ab('0x54')],{})['then'](respondWithResult(_0x4bb5c9,0xc9))['catch'](handleError(_0x4bb5c9,null));};exports['update']=function(_0x53af69,_0x453d40){if(_0x53af69[_0x68ab('0x54')]['id']){delete _0x53af69[_0x68ab('0x54')]['id'];}return db[_0x68ab('0x38')]['find']({'where':{'id':_0x53af69[_0x68ab('0x51')]['id']}})[_0x68ab('0x1e')](handleEntityNotFound(_0x453d40,null))[_0x68ab('0x1e')](saveUpdates(_0x53af69[_0x68ab('0x54')],null))[_0x68ab('0x1e')](respondWithResult(_0x453d40,null))['catch'](handleError(_0x453d40,null));};exports[_0x68ab('0x32')]=function(_0x40d6f1,_0x3a7b87){return db[_0x68ab('0x38')][_0x68ab('0x55')]({'where':{'id':_0x40d6f1['params']['id']}})['then'](handleEntityNotFound(_0x3a7b87,null))[_0x68ab('0x1e')](removeEntity(_0x3a7b87,null))['catch'](handleError(_0x3a7b87,null));};exports['getFields']=function(_0x5e0e54,_0x587f3d,_0x160d64){var _0x51ec03={};var _0x3ecbcb={};var _0x3ed2cf;var _0x4acc2d;return db[_0x68ab('0x38')]['findOne']({'where':{'id':_0x5e0e54['params']['id']}})[_0x68ab('0x1e')](handleEntityNotFound(_0x587f3d,null))[_0x68ab('0x1e')](function(_0x375855){if(_0x375855){_0x3ed2cf=_0x375855;_0x3ecbcb[_0x68ab('0x3d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x3ecbcb[_0x68ab('0x3e')]=_[_0x68ab('0x3f')](_0x5e0e54[_0x68ab('0x3e')]);_0x3ecbcb['filters']=_[_0x68ab('0x40')](_0x3ecbcb[_0x68ab('0x3d')],_0x3ecbcb['query']);_0x51ec03[_0x68ab('0x41')]=_['intersection'](_0x3ecbcb['model'],qs[_0x68ab('0x42')](_0x5e0e54['query'][_0x68ab('0x42')]));_0x51ec03[_0x68ab('0x41')]=_0x51ec03['attributes'][_0x68ab('0x52')]?_0x51ec03['attributes']:_0x3ecbcb[_0x68ab('0x3d')];_0x51ec03[_0x68ab('0x56')]=qs[_0x68ab('0x44')](_0x5e0e54[_0x68ab('0x3e')][_0x68ab('0x44')]);_0x51ec03['where']=qs['filters'](_[_0x68ab('0x47')](_0x5e0e54[_0x68ab('0x3e')],_0x3ecbcb[_0x68ab('0x46')]));if(_0x5e0e54[_0x68ab('0x3e')]['filter']){_0x51ec03['where']=_[_0x68ab('0x49')](_0x51ec03[_0x68ab('0x45')],{'$or':_['map'](_0x51ec03[_0x68ab('0x41')],function(_0x2d6997){var _0x3852f4={};_0x3852f4[_0x2d6997]={'$like':'%'+_0x5e0e54[_0x68ab('0x3e')]['filter']+'%'};return _0x3852f4;})});}_0x51ec03=_['merge']({},_0x51ec03,_0x5e0e54[_0x68ab('0x4a')]);return _0x3ed2cf[_0x68ab('0x57')](_0x51ec03);}})[_0x68ab('0x1e')](function(_0x13134d){if(_0x13134d){_0x4acc2d=_0x13134d[_0x68ab('0x52')];if(!_0x5e0e54['query'][_0x68ab('0x43')](_0x68ab('0x58'))){_0x51ec03[_0x68ab('0x2d')]=qs[_0x68ab('0x2d')](_0x5e0e54[_0x68ab('0x3e')][_0x68ab('0x2d')]);_0x51ec03['offset']=qs[_0x68ab('0x2c')](_0x5e0e54['query'][_0x68ab('0x2c')]);}return _0x3ed2cf[_0x68ab('0x57')](_0x51ec03);}})[_0x68ab('0x1e')](function(_0x19fbf4){if(_0x19fbf4){return _0x19fbf4?{'count':_0x4acc2d,'rows':_0x19fbf4}:null;}})[_0x68ab('0x1e')](respondWithResult(_0x587f3d,null))[_0x68ab('0x4f')](handleError(_0x587f3d,null));};exports[_0x68ab('0x59')]=function(_0x55d9e1,_0x3b7dca,_0x49244f){var _0x47be57={};var _0x6d1d30={};var _0x4d781b;var _0x1da35b;return db[_0x68ab('0x38')][_0x68ab('0x5a')]({'where':{'id':_0x55d9e1['params']['id']}})[_0x68ab('0x1e')](handleEntityNotFound(_0x3b7dca,null))[_0x68ab('0x1e')](function(_0x17aeba){if(_0x17aeba){_0x4d781b=_0x17aeba;_0x6d1d30[_0x68ab('0x3d')]=_[_0x68ab('0x3f')](db[_0x68ab('0x5b')][_0x68ab('0x39')]);_0x6d1d30['query']=_[_0x68ab('0x3f')](_0x55d9e1[_0x68ab('0x3e')]);_0x6d1d30[_0x68ab('0x46')]=_[_0x68ab('0x40')](_0x6d1d30[_0x68ab('0x3d')],_0x6d1d30[_0x68ab('0x3e')]);_0x47be57['attributes']=_[_0x68ab('0x40')](_0x6d1d30[_0x68ab('0x3d')],qs['fields'](_0x55d9e1['query'][_0x68ab('0x42')]));_0x47be57[_0x68ab('0x41')]=_0x47be57[_0x68ab('0x41')][_0x68ab('0x52')]?_0x47be57['attributes']:_0x6d1d30[_0x68ab('0x3d')];_0x47be57[_0x68ab('0x56')]=qs[_0x68ab('0x44')](_0x55d9e1[_0x68ab('0x3e')][_0x68ab('0x44')]);_0x47be57[_0x68ab('0x45')]=qs['filters'](_[_0x68ab('0x47')](_0x55d9e1[_0x68ab('0x3e')],_0x6d1d30[_0x68ab('0x46')]));if(_0x55d9e1[_0x68ab('0x3e')][_0x68ab('0x48')]){_0x47be57[_0x68ab('0x45')]=_[_0x68ab('0x49')](_0x47be57['where'],{'$or':_['map'](_0x47be57[_0x68ab('0x41')],function(_0x20e2da){var _0x56c62e={};_0x56c62e[_0x20e2da]={'$like':'%'+_0x55d9e1[_0x68ab('0x3e')][_0x68ab('0x48')]+'%'};return _0x56c62e;})});}_0x47be57=_['merge']({},_0x47be57,_0x55d9e1['options']);return _0x4d781b[_0x68ab('0x59')](_0x47be57);}})['then'](function(_0x15af18){if(_0x15af18){_0x1da35b=_0x15af18[_0x68ab('0x52')];if(!_0x55d9e1[_0x68ab('0x3e')][_0x68ab('0x43')](_0x68ab('0x58'))){_0x47be57[_0x68ab('0x2d')]=qs['limit'](_0x55d9e1[_0x68ab('0x3e')][_0x68ab('0x2d')]);_0x47be57[_0x68ab('0x2c')]=qs['offset'](_0x55d9e1['query']['offset']);}return _0x4d781b[_0x68ab('0x59')](_0x47be57);}})['then'](function(_0x606998){if(_0x606998){return _0x606998?{'count':_0x1da35b,'rows':_0x606998}:null;}})[_0x68ab('0x1e')](respondWithResult(_0x3b7dca,null))[_0x68ab('0x4f')](handleError(_0x3b7dca,null));};exports[_0x68ab('0x5c')]=function(_0x54dbcc,_0x5d9d54,_0x727c61){var _0x4a2da3={};var _0x1ff1d2={};var _0x3ef3a7;var _0x2514c4;return db[_0x68ab('0x38')][_0x68ab('0x5a')]({'where':{'id':_0x54dbcc[_0x68ab('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d9d54,null))['then'](function(_0x58d71f){if(_0x58d71f){_0x3ef3a7=_0x58d71f;_0x1ff1d2['model']=_[_0x68ab('0x3f')](db[_0x68ab('0x5b')][_0x68ab('0x39')]);_0x1ff1d2[_0x68ab('0x3e')]=_[_0x68ab('0x3f')](_0x54dbcc[_0x68ab('0x3e')]);_0x1ff1d2['filters']=_[_0x68ab('0x40')](_0x1ff1d2[_0x68ab('0x3d')],_0x1ff1d2['query']);_0x4a2da3['attributes']=_[_0x68ab('0x40')](_0x1ff1d2[_0x68ab('0x3d')],qs[_0x68ab('0x42')](_0x54dbcc['query'][_0x68ab('0x42')]));_0x4a2da3[_0x68ab('0x41')]=_0x4a2da3[_0x68ab('0x41')][_0x68ab('0x52')]?_0x4a2da3[_0x68ab('0x41')]:_0x1ff1d2[_0x68ab('0x3d')];_0x4a2da3[_0x68ab('0x56')]=qs['sort'](_0x54dbcc[_0x68ab('0x3e')][_0x68ab('0x44')]);_0x4a2da3['where']=qs[_0x68ab('0x46')](_['pick'](_0x54dbcc[_0x68ab('0x3e')],_0x1ff1d2['filters']));if(_0x54dbcc[_0x68ab('0x3e')][_0x68ab('0x48')]){_0x4a2da3[_0x68ab('0x45')]=_['merge'](_0x4a2da3[_0x68ab('0x45')],{'$or':_['map'](_0x4a2da3[_0x68ab('0x41')],function(_0x3a056a){var _0x3784f4={};_0x3784f4[_0x3a056a]={'$like':'%'+_0x54dbcc[_0x68ab('0x3e')][_0x68ab('0x48')]+'%'};return _0x3784f4;})});}_0x4a2da3=_[_0x68ab('0x49')]({},_0x4a2da3,_0x54dbcc[_0x68ab('0x4a')]);return _0x3ef3a7[_0x68ab('0x5c')](_0x4a2da3);}})[_0x68ab('0x1e')](function(_0x4942d1){if(_0x4942d1){_0x2514c4=_0x4942d1[_0x68ab('0x52')];if(!_0x54dbcc[_0x68ab('0x3e')][_0x68ab('0x43')](_0x68ab('0x58'))){_0x4a2da3[_0x68ab('0x2d')]=qs[_0x68ab('0x2d')](_0x54dbcc['query'][_0x68ab('0x2d')]);_0x4a2da3['offset']=qs[_0x68ab('0x2c')](_0x54dbcc[_0x68ab('0x3e')][_0x68ab('0x2c')]);}return _0x3ef3a7[_0x68ab('0x5c')](_0x4a2da3);}})[_0x68ab('0x1e')](function(_0x432a8a){if(_0x432a8a){return _0x432a8a?{'count':_0x2514c4,'rows':_0x432a8a}:null;}})[_0x68ab('0x1e')](respondWithResult(_0x5d9d54,null))[_0x68ab('0x4f')](handleError(_0x5d9d54,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1cbf751..c44116a 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 _0xb2b3=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0xb2b3,0x71));var _0x3b2b=function(_0x154365,_0x181a2a){_0x154365=_0x154365-0x0;var _0x22f139=_0xb2b3[_0x154365];return _0x22f139;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var logger=require(_0x3b2b('0x2'))(_0x3b2b('0x3'));var moment=require(_0x3b2b('0x4'));var BPromise=require(_0x3b2b('0x5'));var rp=require(_0x3b2b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b2b('0x7'));var config=require(_0x3b2b('0x8'));var attributes=require(_0x3b2b('0x9'));module[_0x3b2b('0xa')]=function(_0x2581eb,_0xc53a84){return _0x2581eb[_0x3b2b('0xb')](_0x3b2b('0xc'),attributes,{'tableName':_0x3b2b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc592=['../../config/environment','define','ServicenowConfiguration','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xc592,0x1aa));var _0x2c59=function(_0x3e025f,_0x1493b9){_0x3e025f=_0x3e025f-0x0;var _0x457527=_0xc592[_0x3e025f];return _0x457527;};'use strict';var _=require(_0x2c59('0x0'));var util=require(_0x2c59('0x1'));var logger=require(_0x2c59('0x2'))('api');var moment=require(_0x2c59('0x3'));var BPromise=require(_0x2c59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c59('0x5'));var rimraf=require('rimraf');var config=require(_0x2c59('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x356a0a,_0x540cc8){return _0x356a0a[_0x2c59('0x7')](_0x2c59('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 3ccfaa6..9919179 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 _0xa026=['request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xa026,0xe4));var _0x6a02=function(_0x1476fb,_0x467d01){_0x1476fb=_0x1476fb-0x0;var _0x44f57e=_0xa026[_0x1476fb];return _0x44f57e;};'use strict';var _=require(_0x6a02('0x0'));var util=require(_0x6a02('0x1'));var moment=require(_0x6a02('0x2'));var BPromise=require(_0x6a02('0x3'));var rs=require(_0x6a02('0x4'));var fs=require('fs');var Redis=require(_0x6a02('0x5'));var db=require(_0x6a02('0x6'))['db'];var utils=require(_0x6a02('0x7'));var logger=require(_0x6a02('0x8'))(_0x6a02('0x9'));var config=require(_0x6a02('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6a02('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34dd62,_0x19e730,_0x43a845){return new BPromise(function(_0x33210b,_0x4a172a){return client[_0x6a02('0xc')](_0x34dd62,_0x43a845)['then'](function(_0x55bcfb){logger[_0x6a02('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x19e730,_0x6a02('0xe'));logger[_0x6a02('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x19e730,'request\x20sent',JSON[_0x6a02('0x10')](_0x55bcfb));if(_0x55bcfb[_0x6a02('0x11')]){if(_0x55bcfb['error'][_0x6a02('0x12')]===0x1f4){logger[_0x6a02('0x11')](_0x6a02('0x13'),_0x19e730,_0x55bcfb['error'][_0x6a02('0x14')]);return _0x4a172a(_0x55bcfb['error'][_0x6a02('0x14')]);}logger[_0x6a02('0x11')](_0x6a02('0x13'),_0x19e730,_0x55bcfb[_0x6a02('0x11')][_0x6a02('0x14')]);return _0x33210b(_0x55bcfb[_0x6a02('0x11')][_0x6a02('0x14')]);}else{logger[_0x6a02('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x19e730,'request\x20sent');_0x33210b(_0x55bcfb['result'][_0x6a02('0x14')]);}})[_0x6a02('0x15')](function(_0x452dfe){logger[_0x6a02('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x19e730,_0x452dfe);_0x4a172a(_0x452dfe);});});} \ No newline at end of file +var _0x52de=['code','message','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','stringify','error'];(function(_0x913c5f,_0x1d68db){var _0xe39136=function(_0x3c6c39){while(--_0x3c6c39){_0x913c5f['push'](_0x913c5f['shift']());}};_0xe39136(++_0x1d68db);}(_0x52de,0x1e5));var _0xe52d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52de[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe52d('0x0'));var util=require(_0xe52d('0x1'));var moment=require(_0xe52d('0x2'));var BPromise=require(_0xe52d('0x3'));var rs=require(_0xe52d('0x4'));var fs=require('fs');var Redis=require(_0xe52d('0x5'));var db=require(_0xe52d('0x6'))['db'];var utils=require(_0xe52d('0x7'));var logger=require(_0xe52d('0x8'))(_0xe52d('0x9'));var config=require('../../config/environment');var jayson=require(_0xe52d('0xa'));var client=jayson[_0xe52d('0xb')][_0xe52d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cf4c3,_0x497bb4,_0x49707d){return new BPromise(function(_0x2aaccf,_0x585c10){return client[_0xe52d('0xd')](_0x4cf4c3,_0x49707d)[_0xe52d('0xe')](function(_0x1da6aa){logger[_0xe52d('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497bb4,'request\x20sent');logger[_0xe52d('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x497bb4,'request\x20sent',JSON[_0xe52d('0x11')](_0x1da6aa));if(_0x1da6aa[_0xe52d('0x12')]){if(_0x1da6aa['error'][_0xe52d('0x13')]===0x1f4){logger[_0xe52d('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497bb4,_0x1da6aa['error'][_0xe52d('0x14')]);return _0x585c10(_0x1da6aa[_0xe52d('0x12')][_0xe52d('0x14')]);}logger[_0xe52d('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497bb4,_0x1da6aa[_0xe52d('0x12')][_0xe52d('0x14')]);return _0x2aaccf(_0x1da6aa[_0xe52d('0x12')][_0xe52d('0x14')]);}else{logger[_0xe52d('0xf')](_0xe52d('0x15'),_0x497bb4,_0xe52d('0x16'));_0x2aaccf(_0x1da6aa[_0xe52d('0x17')][_0xe52d('0x14')]);}})['catch'](function(_0x5c3d53){logger['error'](_0xe52d('0x15'),_0x497bb4,_0x5c3d53);_0x585c10(_0x5c3d53);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6a6171e..3fb49bf 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 _0xa543=['show','update','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get'];(function(_0x4c496a,_0x1d5dfc){var _0x85c328=function(_0x6d08fd){while(--_0x6d08fd){_0x4c496a['push'](_0x4c496a['shift']());}};_0x85c328(++_0x1d5dfc);}(_0xa543,0xdb));var _0x3a54=function(_0x41c764,_0x535aea){_0x41c764=_0x41c764-0x0;var _0x27ae8d=_0xa543[_0x41c764];return _0x27ae8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a54('0x0'));var timeout=require(_0x3a54('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x3a54('0x2'));var interaction=require(_0x3a54('0x3'));var config=require(_0x3a54('0x4'));var controller=require(_0x3a54('0x5'));router['get']('/',auth[_0x3a54('0x6')](),controller[_0x3a54('0x7')]);router[_0x3a54('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3a54('0x9')]);router['post']('/',auth[_0x3a54('0x6')](),controller['create']);router['put']('/:id',auth[_0x3a54('0x6')](),controller[_0x3a54('0xa')]);router['delete']('/:id',auth[_0x3a54('0x6')](),controller['destroy']);module[_0x3a54('0xb')]=router; \ No newline at end of file +var _0xdd7c=['destroy','connect-timeout','express','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x57ebed,_0x3f118e){var _0x24175d=function(_0x5eadce){while(--_0x5eadce){_0x57ebed['push'](_0x57ebed['shift']());}};_0x24175d(++_0x3f118e);}(_0xdd7c,0x194));var _0xcdd7=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xdd7c[_0x46361e];return _0x14e302;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcdd7('0x0'));var express=require(_0xcdd7('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcdd7('0x2'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xcdd7('0x3')](),controller[_0xcdd7('0x4')]);router[_0xcdd7('0x5')](_0xcdd7('0x6'),auth[_0xcdd7('0x3')](),controller[_0xcdd7('0x7')]);router[_0xcdd7('0x8')]('/',auth[_0xcdd7('0x3')](),controller[_0xcdd7('0x9')]);router[_0xcdd7('0xa')](_0xcdd7('0x6'),auth[_0xcdd7('0x3')](),controller[_0xcdd7('0xb')]);router['delete'](_0xcdd7('0x6'),auth[_0xcdd7('0x3')](),controller[_0xcdd7('0xc')]);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 058ed4a..79f0266 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 _0x1280=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1b902d,_0x1ee275){var _0x3eb306=function(_0x688d75){while(--_0x688d75){_0x1b902d['push'](_0x1b902d['shift']());}};_0x3eb306(++_0x1ee275);}(_0x1280,0xba));var _0x0128=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0x1280[_0x3b22e9];return _0x230314;};'use strict';var Sequelize=require(_0x0128('0x0'));module[_0x0128('0x1')]={'type':{'type':Sequelize[_0x0128('0x2')](_0x0128('0x3'),_0x0128('0x4'),_0x0128('0x5'),_0x0128('0x6')),'defaultValue':_0x0128('0x3')},'content':{'type':Sequelize[_0x0128('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0128('0x2')](_0x0128('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x0128('0x7')]},'idField':{'type':Sequelize[_0x0128('0x7')]},'nameField':{'type':Sequelize[_0x0128('0x7')]},'customField':{'type':Sequelize[_0x0128('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc69=['string','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0xdc69,0x177));var _0x9dc6=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xdc69[_0x1ff575];return _0x48fc9e;};'use strict';var Sequelize=require(_0x9dc6('0x0'));module[_0x9dc6('0x1')]={'type':{'type':Sequelize[_0x9dc6('0x2')](_0x9dc6('0x3'),'variable',_0x9dc6('0x4'),_0x9dc6('0x5')),'defaultValue':_0x9dc6('0x3')},'content':{'type':Sequelize[_0x9dc6('0x6')]},'key':{'type':Sequelize[_0x9dc6('0x6')]},'keyType':{'type':Sequelize[_0x9dc6('0x2')](_0x9dc6('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9dc6('0x6')]},'idField':{'type':Sequelize[_0x9dc6('0x6')]},'nameField':{'type':Sequelize[_0x9dc6('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b369d61..7014b49 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 _0x9a2d=['find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','ServicenowField','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','options'];(function(_0x49f0e8,_0x56e9f2){var _0x52e431=function(_0x1ab8f3){while(--_0x1ab8f3){_0x49f0e8['push'](_0x49f0e8['shift']());}};_0x52e431(++_0x56e9f2);}(_0x9a2d,0x123));var _0xd9a2=function(_0x3b0fad,_0x1c9351){_0x3b0fad=_0x3b0fad-0x0;var _0x401f72=_0x9a2d[_0x3b0fad];return _0x401f72;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd9a2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9a2('0x1'));var rp=require(_0xd9a2('0x2'));var moment=require(_0xd9a2('0x3'));var BPromise=require(_0xd9a2('0x4'));var Mustache=require(_0xd9a2('0x5'));var util=require(_0xd9a2('0x6'));var path=require(_0xd9a2('0x7'));var sox=require(_0xd9a2('0x8'));var csv=require(_0xd9a2('0x9'));var ejs=require(_0xd9a2('0xa'));var fs=require('fs');var _=require(_0xd9a2('0xb'));var squel=require(_0xd9a2('0xc'));var crypto=require(_0xd9a2('0xd'));var jsforce=require(_0xd9a2('0xe'));var deskjs=require(_0xd9a2('0xf'));var toCsv=require(_0xd9a2('0x9'));var querystring=require(_0xd9a2('0x10'));var Papa=require(_0xd9a2('0x11'));var Redis=require(_0xd9a2('0x12'));var authService=require(_0xd9a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a2('0x14'));var logger=require('../../config/logger')(_0xd9a2('0x15'));var utils=require('../../config/utils');var config=require(_0xd9a2('0x16'));var licenseUtil=require(_0xd9a2('0x17'));var db=require(_0xd9a2('0x18'))['db'];function respondWithStatusCode(_0xc5a12e,_0x58a5f0){_0x58a5f0=_0x58a5f0||0xcc;return function(_0x1ba710){if(_0x1ba710){return _0xc5a12e[_0xd9a2('0x19')](_0x58a5f0);}return _0xc5a12e[_0xd9a2('0x1a')](_0x58a5f0)['end']();};}function respondWithResult(_0x41b098,_0x4f3c91){_0x4f3c91=_0x4f3c91||0xc8;return function(_0xf3b78e){if(_0xf3b78e){return _0x41b098['status'](_0x4f3c91)[_0xd9a2('0x1b')](_0xf3b78e);}};}function respondWithFilteredResult(_0x3a6969,_0x5e3a6e){return function(_0xee6ea8){if(_0xee6ea8){var _0x1447e6=_0xee6ea8[_0xd9a2('0x1c')],_0x4a8d26=_0x5e3a6e['offset'],_0x36764b=_0x5e3a6e[_0xd9a2('0x1d')]+_0x5e3a6e[_0xd9a2('0x1e')],_0x53f6fb;if(_0x36764b>=_0x1447e6){_0x36764b=_0x1447e6;_0x53f6fb=0xc8;}else{_0x53f6fb=0xce;}_0x3a6969[_0xd9a2('0x1a')](_0x53f6fb);return _0x3a6969[_0xd9a2('0x1f')](_0xd9a2('0x20'),_0x4a8d26+'-'+_0x36764b+'/'+_0x1447e6)[_0xd9a2('0x1b')](_0xee6ea8);}return null;};}function patchUpdates(_0x1247a2){return function(_0x319859){try{jsonpatch[_0xd9a2('0x21')](_0x319859,_0x1247a2,!![]);}catch(_0x32cc05){return BPromise['reject'](_0x32cc05);}return _0x319859['save']();};}function saveUpdates(_0xde39f6,_0x468f53){return function(_0x57c9b0){if(_0x57c9b0){return _0x57c9b0[_0xd9a2('0x22')](_0xde39f6)[_0xd9a2('0x23')](function(_0x521fa3){return _0x521fa3;});}return null;};}function removeEntity(_0x1758ec,_0x291a1c){return function(_0x11e928){if(_0x11e928){return _0x11e928[_0xd9a2('0x24')]()[_0xd9a2('0x23')](function(){_0x1758ec[_0xd9a2('0x1a')](0xcc)[_0xd9a2('0x25')]();});}};}function handleEntityNotFound(_0x5a59b9,_0x568b91){return function(_0x394fb4){if(!_0x394fb4){_0x5a59b9[_0xd9a2('0x19')](0x194);}return _0x394fb4;};}function handleError(_0x459379,_0x7cbe2e){_0x7cbe2e=_0x7cbe2e||0x1f4;return function(_0x492320){logger[_0xd9a2('0x26')](_0x492320['stack']);if(_0x492320[_0xd9a2('0x27')]){delete _0x492320[_0xd9a2('0x27')];}_0x459379['status'](_0x7cbe2e)[_0xd9a2('0x28')](_0x492320);};}exports[_0xd9a2('0x29')]=function(_0x42606c,_0x4c89d8){var _0x308dde={},_0x392d24={},_0x3590aa={'count':0x0,'rows':[]};var _0x469e32=_['map'](db[_0xd9a2('0x2a')]['rawAttributes'],function(_0xc422b0){return{'name':_0xc422b0['fieldName'],'type':_0xc422b0[_0xd9a2('0x2b')][_0xd9a2('0x2c')]};});_0x392d24[_0xd9a2('0x2d')]=_[_0xd9a2('0x2e')](_0x469e32,'name');_0x392d24[_0xd9a2('0x2f')]=_[_0xd9a2('0x30')](_0x42606c[_0xd9a2('0x2f')]);_0x392d24['filters']=_[_0xd9a2('0x31')](_0x392d24['model'],_0x392d24[_0xd9a2('0x2f')]);_0x308dde['attributes']=_['intersection'](_0x392d24[_0xd9a2('0x2d')],qs['fields'](_0x42606c['query'][_0xd9a2('0x32')]));_0x308dde[_0xd9a2('0x33')]=_0x308dde[_0xd9a2('0x33')][_0xd9a2('0x34')]?_0x308dde['attributes']:_0x392d24['model'];if(!_0x42606c[_0xd9a2('0x2f')][_0xd9a2('0x35')]('nolimit')){_0x308dde[_0xd9a2('0x1e')]=qs[_0xd9a2('0x1e')](_0x42606c[_0xd9a2('0x2f')][_0xd9a2('0x1e')]);_0x308dde[_0xd9a2('0x1d')]=qs[_0xd9a2('0x1d')](_0x42606c['query'][_0xd9a2('0x1d')]);}_0x308dde['order']=qs[_0xd9a2('0x36')](_0x42606c['query'][_0xd9a2('0x36')]);_0x308dde[_0xd9a2('0x37')]=qs[_0xd9a2('0x38')](_[_0xd9a2('0x39')](_0x42606c['query'],_0x392d24[_0xd9a2('0x38')]),_0x469e32);if(_0x42606c[_0xd9a2('0x2f')][_0xd9a2('0x3a')]){_0x308dde[_0xd9a2('0x37')]=_[_0xd9a2('0x3b')](_0x308dde['where'],{'$or':_['map'](_0x469e32,function(_0xff9e89){if(_0xff9e89[_0xd9a2('0x2b')]!==_0xd9a2('0x3c')){var _0x291766={};_0x291766[_0xff9e89[_0xd9a2('0x27')]]={'$like':'%'+_0x42606c[_0xd9a2('0x2f')]['filter']+'%'};return _0x291766;}})});}_0x308dde=_['merge']({},_0x308dde,_0x42606c['options']);var _0x3dae16={'where':_0x308dde[_0xd9a2('0x37')]};return db['ServicenowField'][_0xd9a2('0x1c')](_0x3dae16)[_0xd9a2('0x23')](function(_0x478443){_0x3590aa['count']=_0x478443;if(_0x42606c[_0xd9a2('0x2f')]['includeAll']){_0x308dde[_0xd9a2('0x3d')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x308dde);})[_0xd9a2('0x23')](function(_0x3d1fc2){_0x3590aa[_0xd9a2('0x3e')]=_0x3d1fc2;return _0x3590aa;})[_0xd9a2('0x23')](respondWithFilteredResult(_0x4c89d8,_0x308dde))[_0xd9a2('0x3f')](handleError(_0x4c89d8,null));};exports[_0xd9a2('0x40')]=function(_0x1b32fa,_0x2f5209){var _0x8f7416={'raw':!![],'where':{'id':_0x1b32fa[_0xd9a2('0x41')]['id']}},_0xa2a57b={};_0xa2a57b['model']=_[_0xd9a2('0x30')](db[_0xd9a2('0x2a')][_0xd9a2('0x42')]);_0xa2a57b[_0xd9a2('0x2f')]=_['keys'](_0x1b32fa[_0xd9a2('0x2f')]);_0xa2a57b[_0xd9a2('0x38')]=_['intersection'](_0xa2a57b['model'],_0xa2a57b[_0xd9a2('0x2f')]);_0x8f7416['attributes']=_['intersection'](_0xa2a57b[_0xd9a2('0x2d')],qs[_0xd9a2('0x32')](_0x1b32fa[_0xd9a2('0x2f')][_0xd9a2('0x32')]));_0x8f7416[_0xd9a2('0x33')]=_0x8f7416['attributes']['length']?_0x8f7416[_0xd9a2('0x33')]:_0xa2a57b['model'];if(_0x1b32fa[_0xd9a2('0x2f')][_0xd9a2('0x43')]){_0x8f7416[_0xd9a2('0x3d')]=[{'all':!![]}];}_0x8f7416=_[_0xd9a2('0x3b')]({},_0x8f7416,_0x1b32fa[_0xd9a2('0x44')]);return db[_0xd9a2('0x2a')][_0xd9a2('0x45')](_0x8f7416)[_0xd9a2('0x23')](handleEntityNotFound(_0x2f5209,null))[_0xd9a2('0x23')](respondWithResult(_0x2f5209,null))[_0xd9a2('0x3f')](handleError(_0x2f5209,null));};exports[_0xd9a2('0x46')]=function(_0x1d787f,_0x19e538){return db[_0xd9a2('0x2a')]['create'](_0x1d787f[_0xd9a2('0x47')],{})[_0xd9a2('0x23')](respondWithResult(_0x19e538,0xc9))[_0xd9a2('0x3f')](handleError(_0x19e538,null));};exports[_0xd9a2('0x22')]=function(_0x352041,_0x4d76fc){if(_0x352041['body']['id']){delete _0x352041[_0xd9a2('0x47')]['id'];}return db[_0xd9a2('0x2a')][_0xd9a2('0x45')]({'where':{'id':_0x352041[_0xd9a2('0x41')]['id']}})[_0xd9a2('0x23')](handleEntityNotFound(_0x4d76fc,null))[_0xd9a2('0x23')](saveUpdates(_0x352041[_0xd9a2('0x47')],null))[_0xd9a2('0x23')](respondWithResult(_0x4d76fc,null))[_0xd9a2('0x3f')](handleError(_0x4d76fc,null));};exports[_0xd9a2('0x24')]=function(_0xcf0bc8,_0x156608){return db[_0xd9a2('0x2a')][_0xd9a2('0x45')]({'where':{'id':_0xcf0bc8[_0xd9a2('0x41')]['id']}})['then'](handleEntityNotFound(_0x156608,null))[_0xd9a2('0x23')](removeEntity(_0x156608,null))['catch'](handleError(_0x156608,null));}; \ No newline at end of file +var _0xb2ca=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xb2ca,0x1a8));var _0xab2c=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb2ca[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0xab2c('0x0'));var emlformat=require(_0xab2c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab2c('0x2'));var jsonpatch=require(_0xab2c('0x3'));var rp=require(_0xab2c('0x4'));var moment=require(_0xab2c('0x5'));var BPromise=require(_0xab2c('0x6'));var Mustache=require(_0xab2c('0x7'));var util=require(_0xab2c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xab2c('0x9'));var ejs=require(_0xab2c('0xa'));var fs=require('fs');var _=require(_0xab2c('0xb'));var squel=require('squel');var crypto=require(_0xab2c('0xc'));var jsforce=require(_0xab2c('0xd'));var deskjs=require(_0xab2c('0xe'));var toCsv=require(_0xab2c('0x9'));var querystring=require(_0xab2c('0xf'));var Papa=require(_0xab2c('0x10'));var Redis=require('ioredis');var authService=require(_0xab2c('0x11'));var qs=require(_0xab2c('0x12'));var as=require(_0xab2c('0x13'));var hardwareService=require(_0xab2c('0x14'));var logger=require(_0xab2c('0x15'))(_0xab2c('0x16'));var utils=require(_0xab2c('0x17'));var config=require(_0xab2c('0x18'));var licenseUtil=require(_0xab2c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49d0df,_0xdde708){_0xdde708=_0xdde708||0xcc;return function(_0x311da1){if(_0x311da1){return _0x49d0df[_0xab2c('0x1a')](_0xdde708);}return _0x49d0df[_0xab2c('0x1b')](_0xdde708)[_0xab2c('0x1c')]();};}function respondWithResult(_0x261889,_0x5a7c70){_0x5a7c70=_0x5a7c70||0xc8;return function(_0xcb6182){if(_0xcb6182){return _0x261889[_0xab2c('0x1b')](_0x5a7c70)[_0xab2c('0x1d')](_0xcb6182);}};}function respondWithFilteredResult(_0x292fe9,_0x53d442){return function(_0x5cc6fb){if(_0x5cc6fb){var _0x5c9131=_0x5cc6fb[_0xab2c('0x1e')],_0x851b58=_0x53d442[_0xab2c('0x1f')],_0x25e037=_0x53d442[_0xab2c('0x1f')]+_0x53d442[_0xab2c('0x20')],_0x2b4703;if(_0x25e037>=_0x5c9131){_0x25e037=_0x5c9131;_0x2b4703=0xc8;}else{_0x2b4703=0xce;}_0x292fe9[_0xab2c('0x1b')](_0x2b4703);return _0x292fe9['set'](_0xab2c('0x21'),_0x851b58+'-'+_0x25e037+'/'+_0x5c9131)[_0xab2c('0x1d')](_0x5cc6fb);}return null;};}function patchUpdates(_0x4f4c7c){return function(_0x99c052){try{jsonpatch[_0xab2c('0x22')](_0x99c052,_0x4f4c7c,!![]);}catch(_0x32f001){return BPromise[_0xab2c('0x23')](_0x32f001);}return _0x99c052['save']();};}function saveUpdates(_0x2b61d4,_0x2f3950){return function(_0x3905b5){if(_0x3905b5){return _0x3905b5[_0xab2c('0x24')](_0x2b61d4)[_0xab2c('0x25')](function(_0x334436){return _0x334436;});}return null;};}function removeEntity(_0x429f6a,_0x31c163){return function(_0x101678){if(_0x101678){return _0x101678[_0xab2c('0x26')]()[_0xab2c('0x25')](function(){_0x429f6a[_0xab2c('0x1b')](0xcc)[_0xab2c('0x1c')]();});}};}function handleEntityNotFound(_0x4d63de,_0x36931f){return function(_0x476918){if(!_0x476918){_0x4d63de[_0xab2c('0x1a')](0x194);}return _0x476918;};}function handleError(_0x5f2066,_0x54daa4){_0x54daa4=_0x54daa4||0x1f4;return function(_0x4db87c){logger[_0xab2c('0x27')](_0x4db87c[_0xab2c('0x28')]);if(_0x4db87c[_0xab2c('0x29')]){delete _0x4db87c[_0xab2c('0x29')];}_0x5f2066[_0xab2c('0x1b')](_0x54daa4)[_0xab2c('0x2a')](_0x4db87c);};}exports[_0xab2c('0x2b')]=function(_0x3ea457,_0x13673a){var _0x58f591={},_0x2fc353={},_0x3ec008={'count':0x0,'rows':[]};var _0x3fd3a1=_[_0xab2c('0x2c')](db[_0xab2c('0x2d')][_0xab2c('0x2e')],function(_0x1f7023){return{'name':_0x1f7023[_0xab2c('0x2f')],'type':_0x1f7023[_0xab2c('0x30')][_0xab2c('0x31')]};});_0x2fc353[_0xab2c('0x32')]=_['map'](_0x3fd3a1,_0xab2c('0x29'));_0x2fc353[_0xab2c('0x33')]=_[_0xab2c('0x34')](_0x3ea457['query']);_0x2fc353[_0xab2c('0x35')]=_['intersection'](_0x2fc353[_0xab2c('0x32')],_0x2fc353['query']);_0x58f591[_0xab2c('0x36')]=_[_0xab2c('0x37')](_0x2fc353[_0xab2c('0x32')],qs['fields'](_0x3ea457[_0xab2c('0x33')][_0xab2c('0x38')]));_0x58f591[_0xab2c('0x36')]=_0x58f591[_0xab2c('0x36')][_0xab2c('0x39')]?_0x58f591[_0xab2c('0x36')]:_0x2fc353[_0xab2c('0x32')];if(!_0x3ea457[_0xab2c('0x33')][_0xab2c('0x3a')]('nolimit')){_0x58f591[_0xab2c('0x20')]=qs[_0xab2c('0x20')](_0x3ea457[_0xab2c('0x33')]['limit']);_0x58f591[_0xab2c('0x1f')]=qs[_0xab2c('0x1f')](_0x3ea457[_0xab2c('0x33')]['offset']);}_0x58f591['order']=qs[_0xab2c('0x3b')](_0x3ea457[_0xab2c('0x33')][_0xab2c('0x3b')]);_0x58f591[_0xab2c('0x3c')]=qs['filters'](_[_0xab2c('0x3d')](_0x3ea457[_0xab2c('0x33')],_0x2fc353[_0xab2c('0x35')]),_0x3fd3a1);if(_0x3ea457[_0xab2c('0x33')][_0xab2c('0x3e')]){_0x58f591[_0xab2c('0x3c')]=_['merge'](_0x58f591[_0xab2c('0x3c')],{'$or':_['map'](_0x3fd3a1,function(_0x31b7ee){if(_0x31b7ee[_0xab2c('0x30')]!==_0xab2c('0x3f')){var _0x10f41d={};_0x10f41d[_0x31b7ee['name']]={'$like':'%'+_0x3ea457[_0xab2c('0x33')][_0xab2c('0x3e')]+'%'};return _0x10f41d;}})});}_0x58f591=_[_0xab2c('0x40')]({},_0x58f591,_0x3ea457[_0xab2c('0x41')]);var _0x1cfe96={'where':_0x58f591[_0xab2c('0x3c')]};return db[_0xab2c('0x2d')][_0xab2c('0x1e')](_0x1cfe96)[_0xab2c('0x25')](function(_0x444be2){_0x3ec008[_0xab2c('0x1e')]=_0x444be2;if(_0x3ea457[_0xab2c('0x33')][_0xab2c('0x42')]){_0x58f591[_0xab2c('0x43')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x58f591);})[_0xab2c('0x25')](function(_0x2f47c2){_0x3ec008[_0xab2c('0x44')]=_0x2f47c2;return _0x3ec008;})['then'](respondWithFilteredResult(_0x13673a,_0x58f591))[_0xab2c('0x45')](handleError(_0x13673a,null));};exports['show']=function(_0x2898a5,_0x40ed32){var _0xd5e282={'raw':!![],'where':{'id':_0x2898a5[_0xab2c('0x46')]['id']}},_0x41d582={};_0x41d582[_0xab2c('0x32')]=_[_0xab2c('0x34')](db[_0xab2c('0x2d')][_0xab2c('0x2e')]);_0x41d582[_0xab2c('0x33')]=_[_0xab2c('0x34')](_0x2898a5[_0xab2c('0x33')]);_0x41d582[_0xab2c('0x35')]=_['intersection'](_0x41d582['model'],_0x41d582[_0xab2c('0x33')]);_0xd5e282['attributes']=_[_0xab2c('0x37')](_0x41d582[_0xab2c('0x32')],qs['fields'](_0x2898a5['query'][_0xab2c('0x38')]));_0xd5e282[_0xab2c('0x36')]=_0xd5e282[_0xab2c('0x36')][_0xab2c('0x39')]?_0xd5e282[_0xab2c('0x36')]:_0x41d582['model'];if(_0x2898a5[_0xab2c('0x33')][_0xab2c('0x42')]){_0xd5e282['include']=[{'all':!![]}];}_0xd5e282=_[_0xab2c('0x40')]({},_0xd5e282,_0x2898a5[_0xab2c('0x41')]);return db['ServicenowField'][_0xab2c('0x47')](_0xd5e282)[_0xab2c('0x25')](handleEntityNotFound(_0x40ed32,null))['then'](respondWithResult(_0x40ed32,null))[_0xab2c('0x45')](handleError(_0x40ed32,null));};exports['create']=function(_0x4553ee,_0x425fdb){return db['ServicenowField'][_0xab2c('0x48')](_0x4553ee[_0xab2c('0x49')],{})[_0xab2c('0x25')](respondWithResult(_0x425fdb,0xc9))['catch'](handleError(_0x425fdb,null));};exports[_0xab2c('0x24')]=function(_0x181565,_0x56d8f0){if(_0x181565[_0xab2c('0x49')]['id']){delete _0x181565[_0xab2c('0x49')]['id'];}return db['ServicenowField'][_0xab2c('0x47')]({'where':{'id':_0x181565[_0xab2c('0x46')]['id']}})[_0xab2c('0x25')](handleEntityNotFound(_0x56d8f0,null))[_0xab2c('0x25')](saveUpdates(_0x181565[_0xab2c('0x49')],null))['then'](respondWithResult(_0x56d8f0,null))[_0xab2c('0x45')](handleError(_0x56d8f0,null));};exports[_0xab2c('0x26')]=function(_0x4a5772,_0xfed1a9){return db['ServicenowField']['find']({'where':{'id':_0x4a5772[_0xab2c('0x46')]['id']}})[_0xab2c('0x25')](handleEntityNotFound(_0xfed1a9,null))[_0xab2c('0x25')](removeEntity(_0xfed1a9,null))[_0xab2c('0x45')](handleError(_0xfed1a9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9c10ef7..f75c269 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 _0xf224=['FieldId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x2a4437,_0x245cb2){var _0x3a5a3a=function(_0x59606e){while(--_0x59606e){_0x2a4437['push'](_0x2a4437['shift']());}};_0x3a5a3a(++_0x245cb2);}(_0xf224,0x189));var _0x4f22=function(_0x149f18,_0xc141cc){_0x149f18=_0x149f18-0x0;var _0x527b26=_0xf224[_0x149f18];return _0x527b26;};'use strict';var _=require(_0x4f22('0x0'));var util=require('util');var logger=require(_0x4f22('0x1'))(_0x4f22('0x2'));var moment=require('moment');var BPromise=require(_0x4f22('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f22('0x4'));var rimraf=require(_0x4f22('0x5'));var config=require(_0x4f22('0x6'));var attributes=require(_0x4f22('0x7'));module[_0x4f22('0x8')]=function(_0x5c946a,_0x4ee109){return _0x5c946a[_0x4f22('0x9')]('ServicenowField',attributes,{'tableName':_0x4f22('0xa'),'paranoid':![],'indexes':[{'name':_0x4f22('0xb'),'fields':[_0x4f22('0xc'),_0x4f22('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6419=['util','moment','bluebird','path','rimraf','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x246659,_0x2d7460){var _0x393649=function(_0x2049ae){while(--_0x2049ae){_0x246659['push'](_0x246659['shift']());}};_0x393649(++_0x2d7460);}(_0x6419,0xc6));var _0x9641=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6419[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9641('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9641('0x1'));var BPromise=require(_0x9641('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9641('0x3'));var rimraf=require(_0x9641('0x4'));var config=require('../../config/environment');var attributes=require(_0x9641('0x5'));module['exports']=function(_0x1d0750,_0x22da7a){return _0x1d0750[_0x9641('0x6')](_0x9641('0x7'),attributes,{'tableName':_0x9641('0x8'),'paranoid':![],'indexes':[{'name':_0x9641('0x9'),'fields':[_0x9641('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ff1bf88..cc0a3b1 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 _0x640b=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','info'];(function(_0x6abc9e,_0x2bd93a){var _0x125c1e=function(_0x4a63e3){while(--_0x4a63e3){_0x6abc9e['push'](_0x6abc9e['shift']());}};_0x125c1e(++_0x2bd93a);}(_0x640b,0x18e));var _0xb640=function(_0x1a8d4a,_0x374281){_0x1a8d4a=_0x1a8d4a-0x0;var _0x5242ff=_0x640b[_0x1a8d4a];return _0x5242ff;};'use strict';var _=require(_0xb640('0x0'));var util=require(_0xb640('0x1'));var moment=require(_0xb640('0x2'));var BPromise=require(_0xb640('0x3'));var rs=require(_0xb640('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb640('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb640('0x6'));var jayson=require(_0xb640('0x7'));var client=jayson[_0xb640('0x8')][_0xb640('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4256a4,_0x3f14e3,_0x4c2ff3){return new BPromise(function(_0x5409cc,_0x9d8da3){return client[_0xb640('0xa')](_0x4256a4,_0x4c2ff3)['then'](function(_0x981944){logger['info']('ServicenowField,\x20%s,\x20%s',_0x3f14e3,'request\x20sent');logger[_0xb640('0xb')](_0xb640('0xc'),_0x3f14e3,_0xb640('0xd'),JSON[_0xb640('0xe')](_0x981944));if(_0x981944[_0xb640('0xf')]){if(_0x981944[_0xb640('0xf')][_0xb640('0x10')]===0x1f4){logger[_0xb640('0xf')](_0xb640('0x11'),_0x3f14e3,_0x981944[_0xb640('0xf')][_0xb640('0x12')]);return _0x9d8da3(_0x981944[_0xb640('0xf')]['message']);}logger[_0xb640('0xf')]('ServicenowField,\x20%s,\x20%s',_0x3f14e3,_0x981944[_0xb640('0xf')][_0xb640('0x12')]);return _0x5409cc(_0x981944[_0xb640('0xf')]['message']);}else{logger[_0xb640('0x13')](_0xb640('0x11'),_0x3f14e3,_0xb640('0xd'));_0x5409cc(_0x981944[_0xb640('0x14')][_0xb640('0x12')]);}})[_0xb640('0x15')](function(_0x1eff37){logger[_0xb640('0xf')]('ServicenowField,\x20%s,\x20%s',_0x3f14e3,_0x1eff37);_0x9d8da3(_0x1eff37);});});} \ No newline at end of file +var _0x861c=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x4ad1c9,_0x2aa51e){var _0x2e710b=function(_0xf3082a){while(--_0xf3082a){_0x4ad1c9['push'](_0x4ad1c9['shift']());}};_0x2e710b(++_0x2aa51e);}(_0x861c,0x131));var _0xc861=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x861c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var moment=require(_0xc861('0x2'));var BPromise=require(_0xc861('0x3'));var rs=require(_0xc861('0x4'));var fs=require('fs');var Redis=require(_0xc861('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc861('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc861('0x7')][_0xc861('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x472243,_0xb14714,_0x562ed0){return new BPromise(function(_0x49f65a,_0x291b1){return client['request'](_0x472243,_0x562ed0)[_0xc861('0x9')](function(_0x3a32dd){logger[_0xc861('0xa')](_0xc861('0xb'),_0xb14714,_0xc861('0xc'));logger[_0xc861('0xd')](_0xc861('0xe'),_0xb14714,'request\x20sent',JSON[_0xc861('0xf')](_0x3a32dd));if(_0x3a32dd[_0xc861('0x10')]){if(_0x3a32dd[_0xc861('0x10')]['code']===0x1f4){logger[_0xc861('0x10')](_0xc861('0xb'),_0xb14714,_0x3a32dd[_0xc861('0x10')][_0xc861('0x11')]);return _0x291b1(_0x3a32dd['error']['message']);}logger[_0xc861('0x10')](_0xc861('0xb'),_0xb14714,_0x3a32dd[_0xc861('0x10')][_0xc861('0x11')]);return _0x49f65a(_0x3a32dd[_0xc861('0x10')][_0xc861('0x11')]);}else{logger['info'](_0xc861('0xb'),_0xb14714,'request\x20sent');_0x49f65a(_0x3a32dd[_0xc861('0x12')][_0xc861('0x11')]);}})[_0xc861('0x13')](function(_0x21a1b5){logger[_0xc861('0x10')](_0xc861('0xb'),_0xb14714,_0x21a1b5);_0x291b1(_0x21a1b5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fba2279..007566c 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 _0x7dc0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','create','post','put','/:id','destroy'];(function(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0x7dc0,0x18f));var _0x07dc=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7dc0[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0x07dc('0x0'));var util=require(_0x07dc('0x1'));var path=require(_0x07dc('0x2'));var timeout=require(_0x07dc('0x3'));var express=require(_0x07dc('0x4'));var router=express[_0x07dc('0x5')]();var auth=require(_0x07dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x07dc('0x7'));var controller=require(_0x07dc('0x8'));router[_0x07dc('0x9')]('/',auth[_0x07dc('0xa')](),controller[_0x07dc('0xb')]);router[_0x07dc('0x9')]('/:id',auth[_0x07dc('0xa')](),controller[_0x07dc('0xc')]);router[_0x07dc('0x9')](_0x07dc('0xd'),auth[_0x07dc('0xa')](),controller['getConfigurations']);router[_0x07dc('0x9')]('/:id/fields',auth[_0x07dc('0xa')](),controller['getFields']);router['post']('/',auth[_0x07dc('0xa')](),controller[_0x07dc('0xe')]);router[_0x07dc('0xf')](_0x07dc('0xd'),auth[_0x07dc('0xa')](),controller['addConfiguration']);router[_0x07dc('0x10')](_0x07dc('0x11'),auth[_0x07dc('0xa')](),controller['update']);router['delete'](_0x07dc('0x11'),auth[_0x07dc('0xa')](),controller[_0x07dc('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5d25=['/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','update','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x8ba936,_0xc6bafd){var _0x35cedb=function(_0x35636b){while(--_0x35636b){_0x8ba936['push'](_0x8ba936['shift']());}};_0x35cedb(++_0xc6bafd);}(_0x5d25,0x8e));var _0x55d2=function(_0x532abd,_0x8dd846){_0x532abd=_0x532abd-0x0;var _0x1d3182=_0x5d25[_0x532abd];return _0x1d3182;};'use strict';var multer=require(_0x55d2('0x0'));var util=require(_0x55d2('0x1'));var path=require(_0x55d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x55d2('0x3'));var router=express[_0x55d2('0x4')]();var auth=require(_0x55d2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55d2('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x55d2('0x7')]('/',auth[_0x55d2('0x8')](),controller[_0x55d2('0x9')]);router['get'](_0x55d2('0xa'),auth[_0x55d2('0x8')](),controller[_0x55d2('0xb')]);router[_0x55d2('0x7')]('/:id/configurations',auth[_0x55d2('0x8')](),controller[_0x55d2('0xc')]);router[_0x55d2('0x7')](_0x55d2('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x55d2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x55d2('0xe')](_0x55d2('0xf'),auth[_0x55d2('0x8')](),controller[_0x55d2('0x10')]);router['put'](_0x55d2('0xa'),auth[_0x55d2('0x8')](),controller[_0x55d2('0x11')]);router['delete'](_0x55d2('0xa'),auth[_0x55d2('0x8')](),controller['destroy']);module[_0x55d2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 513cf2d..6634a1d 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 _0xc01f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x154f6a,_0x4c617b){var _0x833e6e=function(_0x255f83){while(--_0x255f83){_0x154f6a['push'](_0x154f6a['shift']());}};_0x833e6e(++_0x4c617b);}(_0xc01f,0x1bb));var _0xfc01=function(_0x557999,_0x1ff0a0){_0x557999=_0x557999-0x0;var _0x28ee4f=_0xc01f[_0x557999];return _0x28ee4f;};'use strict';var Sequelize=require(_0xfc01('0x0'));module[_0xfc01('0x1')]={'name':{'type':Sequelize[_0xfc01('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xfc01('0x3')},'password':{'type':Sequelize[_0xfc01('0x2')]},'remoteUri':{'type':Sequelize[_0xfc01('0x2')],'unique':_0xfc01('0x4')},'serverUrl':{'type':Sequelize[_0xfc01('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x27a9=['exports','STRING','username','remoteUri'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x27a9,0x118));var _0x927a=function(_0x204be9,_0x525eaf){_0x204be9=_0x204be9-0x0;var _0x54fe9c=_0x27a9[_0x204be9];return _0x54fe9c;};'use strict';var Sequelize=require('sequelize');module[_0x927a('0x0')]={'name':{'type':Sequelize[_0x927a('0x1')]},'description':{'type':Sequelize[_0x927a('0x1')]},'username':{'type':Sequelize[_0x927a('0x1')],'unique':_0x927a('0x2')},'password':{'type':Sequelize[_0x927a('0x1')]},'remoteUri':{'type':Sequelize[_0x927a('0x1')],'unique':_0x927a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 1523c76..6045143 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 _0x1d18=['hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','filters','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','pick','addConfiguration','AccountId','getSubjects','channel','Subjects','SugarcrmField','Descriptions','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','remoteUri','slice','substring','lastIndexOf','%s%s','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../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','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x11c156,_0x30f2b2){var _0xee50fa=function(_0x36e049){while(--_0x36e049){_0x11c156['push'](_0x11c156['shift']());}};_0xee50fa(++_0x30f2b2);}(_0x1d18,0x1cf));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x81d1('0x0'));var zipdir=require(_0x81d1('0x1'));var jsonpatch=require(_0x81d1('0x2'));var rp=require(_0x81d1('0x3'));var moment=require(_0x81d1('0x4'));var BPromise=require(_0x81d1('0x5'));var Mustache=require('mustache');var util=require(_0x81d1('0x6'));var path=require(_0x81d1('0x7'));var sox=require(_0x81d1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x81d1('0x9'));var jsforce=require(_0x81d1('0xa'));var deskjs=require(_0x81d1('0xb'));var toCsv=require(_0x81d1('0xc'));var querystring=require(_0x81d1('0xd'));var Papa=require(_0x81d1('0xe'));var Redis=require('ioredis');var authService=require(_0x81d1('0xf'));var qs=require(_0x81d1('0x10'));var as=require(_0x81d1('0x11'));var hardwareService=require(_0x81d1('0x12'));var logger=require(_0x81d1('0x13'))(_0x81d1('0x14'));var utils=require('../../config/utils');var config=require(_0x81d1('0x15'));var licenseUtil=require(_0x81d1('0x16'));var db=require(_0x81d1('0x17'))['db'];var integrations=require(_0x81d1('0x18'));var jayson=require(_0x81d1('0x19'));var client=jayson[_0x81d1('0x1a')][_0x81d1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x12b832,_0x4b4e87,_0x2b1ce0,_0x396635){return new BPromise(function(_0x5378f7,_0xcca5ae){var _0x5c40d3=_0x396635||client;return _0x5c40d3[_0x81d1('0x1c')](_0x12b832,_0x2b1ce0)['then'](function(_0xa53540){logger[_0x81d1('0x1d')](_0x81d1('0x1e'),_0x4b4e87,_0x81d1('0x1f'));logger[_0x81d1('0x20')](_0x81d1('0x21'),_0x4b4e87,'request\x20sent',JSON[_0x81d1('0x22')](_0xa53540));if(_0xa53540[_0x81d1('0x23')]){if(_0xa53540['error'][_0x81d1('0x24')]===0x1f4){logger[_0x81d1('0x23')](_0x81d1('0x1e'),_0x4b4e87,_0xa53540[_0x81d1('0x23')][_0x81d1('0x25')]);return _0xcca5ae(_0xa53540[_0x81d1('0x23')][_0x81d1('0x25')]);}logger['error'](_0x81d1('0x1e'),_0x4b4e87,_0xa53540[_0x81d1('0x23')][_0x81d1('0x25')]);return _0x5378f7(_0xa53540[_0x81d1('0x23')]['message']);}else{logger[_0x81d1('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x4b4e87,_0x81d1('0x1f'));_0x5378f7(_0xa53540['result'][_0x81d1('0x25')]);}})[_0x81d1('0x26')](function(_0x5b1766){logger['error'](_0x81d1('0x1e'),_0x4b4e87,_0x5b1766);_0xcca5ae(_0x5b1766);});});}function respondWithStatusCode(_0x2925be,_0x3a7034){_0x3a7034=_0x3a7034||0xcc;return function(_0x1e1ac5){if(_0x1e1ac5){return _0x2925be[_0x81d1('0x27')](_0x3a7034);}return _0x2925be[_0x81d1('0x28')](_0x3a7034)[_0x81d1('0x29')]();};}function respondWithResult(_0xfeb746,_0x3f33d7){_0x3f33d7=_0x3f33d7||0xc8;return function(_0x42568a){if(_0x42568a){return _0xfeb746[_0x81d1('0x28')](_0x3f33d7)[_0x81d1('0x2a')](_0x42568a);}};}function respondWithFilteredResult(_0x198f38,_0x56f2b6){return function(_0x110a78){if(_0x110a78){var _0x3724e2=_0x110a78[_0x81d1('0x2b')],_0x4aaf03=_0x56f2b6['offset'],_0x2222b4=_0x56f2b6[_0x81d1('0x2c')]+_0x56f2b6[_0x81d1('0x2d')],_0x369af4;if(_0x2222b4>=_0x3724e2){_0x2222b4=_0x3724e2;_0x369af4=0xc8;}else{_0x369af4=0xce;}_0x198f38['status'](_0x369af4);return _0x198f38['set'](_0x81d1('0x2e'),_0x4aaf03+'-'+_0x2222b4+'/'+_0x3724e2)[_0x81d1('0x2a')](_0x110a78);}return null;};}function patchUpdates(_0x79a758){return function(_0x2c9201){try{jsonpatch[_0x81d1('0x2f')](_0x2c9201,_0x79a758,!![]);}catch(_0x47faca){return BPromise[_0x81d1('0x30')](_0x47faca);}return _0x2c9201[_0x81d1('0x31')]();};}function saveUpdates(_0x10912b,_0x3ce8b2){return function(_0x31e669){if(_0x31e669){return _0x31e669[_0x81d1('0x32')](_0x10912b)['then'](function(_0x5845f7){return _0x5845f7;});}return null;};}function removeEntity(_0x24748c,_0x13a133){return function(_0x39a089){if(_0x39a089){return _0x39a089[_0x81d1('0x33')]()[_0x81d1('0x34')](function(){_0x24748c[_0x81d1('0x28')](0xcc)[_0x81d1('0x29')]();});}};}function handleEntityNotFound(_0x441137,_0x1eb0d0){return function(_0x1ddd51){if(!_0x1ddd51){_0x441137[_0x81d1('0x27')](0x194);}return _0x1ddd51;};}function handleError(_0x599528,_0x1a70f6){_0x1a70f6=_0x1a70f6||0x1f4;return function(_0x32eed2){logger['error'](_0x32eed2[_0x81d1('0x35')]);if(_0x32eed2[_0x81d1('0x36')]){delete _0x32eed2['name'];}_0x599528[_0x81d1('0x28')](_0x1a70f6)[_0x81d1('0x37')](_0x32eed2);};}exports[_0x81d1('0x38')]=function(_0x3e88f2,_0xd3466d){var _0x13467b={},_0x5edc3b={},_0x146159={'count':0x0,'rows':[]};var _0x44c5b5=_[_0x81d1('0x39')](db[_0x81d1('0x3a')][_0x81d1('0x3b')],function(_0x25c94a){return{'name':_0x25c94a[_0x81d1('0x3c')],'type':_0x25c94a[_0x81d1('0x3d')][_0x81d1('0x3e')]};});_0x5edc3b[_0x81d1('0x3f')]=_[_0x81d1('0x39')](_0x44c5b5,'name');_0x5edc3b[_0x81d1('0x40')]=_[_0x81d1('0x41')](_0x3e88f2['query']);_0x5edc3b['filters']=_[_0x81d1('0x42')](_0x5edc3b[_0x81d1('0x3f')],_0x5edc3b[_0x81d1('0x40')]);_0x13467b[_0x81d1('0x43')]=_['intersection'](_0x5edc3b[_0x81d1('0x3f')],qs['fields'](_0x3e88f2[_0x81d1('0x40')][_0x81d1('0x44')]));_0x13467b['attributes']=_0x13467b[_0x81d1('0x43')]['length']?_0x13467b[_0x81d1('0x43')]:_0x5edc3b[_0x81d1('0x3f')];if(!_0x3e88f2[_0x81d1('0x40')][_0x81d1('0x45')](_0x81d1('0x46'))){_0x13467b[_0x81d1('0x2d')]=qs[_0x81d1('0x2d')](_0x3e88f2[_0x81d1('0x40')][_0x81d1('0x2d')]);_0x13467b[_0x81d1('0x2c')]=qs[_0x81d1('0x2c')](_0x3e88f2[_0x81d1('0x40')][_0x81d1('0x2c')]);}_0x13467b[_0x81d1('0x47')]=qs['sort'](_0x3e88f2[_0x81d1('0x40')][_0x81d1('0x48')]);_0x13467b['where']=qs['filters'](_['pick'](_0x3e88f2[_0x81d1('0x40')],_0x5edc3b['filters']),_0x44c5b5);if(_0x3e88f2['query'][_0x81d1('0x49')]){_0x13467b[_0x81d1('0x4a')]=_[_0x81d1('0x4b')](_0x13467b['where'],{'$or':_[_0x81d1('0x39')](_0x44c5b5,function(_0xe0dad9){if(_0xe0dad9['type']!==_0x81d1('0x4c')){var _0x40650c={};_0x40650c[_0xe0dad9[_0x81d1('0x36')]]={'$like':'%'+_0x3e88f2[_0x81d1('0x40')]['filter']+'%'};return _0x40650c;}})});}_0x13467b=_[_0x81d1('0x4b')]({},_0x13467b,_0x3e88f2[_0x81d1('0x4d')]);var _0x1e405d={'where':_0x13467b[_0x81d1('0x4a')]};return db[_0x81d1('0x3a')]['count'](_0x1e405d)[_0x81d1('0x34')](function(_0x420416){_0x146159['count']=_0x420416;if(_0x3e88f2['query'][_0x81d1('0x4e')]){_0x13467b[_0x81d1('0x4f')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x13467b);})[_0x81d1('0x34')](function(_0x5efd73){_0x146159[_0x81d1('0x50')]=_0x5efd73;return _0x146159;})[_0x81d1('0x34')](respondWithFilteredResult(_0xd3466d,_0x13467b))['catch'](handleError(_0xd3466d,null));};exports['show']=function(_0x1bbbc6,_0x538909){var _0x1808a5={'raw':![],'where':{'id':_0x1bbbc6[_0x81d1('0x51')]['id']}},_0x201a1a={};_0x201a1a[_0x81d1('0x3f')]=_['keys'](db['SugarcrmAccount'][_0x81d1('0x3b')]);_0x201a1a[_0x81d1('0x40')]=_[_0x81d1('0x41')](_0x1bbbc6[_0x81d1('0x40')]);_0x201a1a[_0x81d1('0x52')]=_['intersection'](_0x201a1a[_0x81d1('0x3f')],_0x201a1a[_0x81d1('0x40')]);_0x1808a5[_0x81d1('0x43')]=_[_0x81d1('0x42')](_0x201a1a['model'],qs[_0x81d1('0x44')](_0x1bbbc6['query'][_0x81d1('0x44')]));_0x1808a5[_0x81d1('0x43')]=_0x1808a5['attributes']['length']?_0x1808a5[_0x81d1('0x43')]:_0x201a1a['model'];if(_0x1bbbc6[_0x81d1('0x40')][_0x81d1('0x4e')]){_0x1808a5[_0x81d1('0x4f')]=[{'all':!![]}];}_0x1808a5=_['merge']({},_0x1808a5,_0x1bbbc6['options']);return db[_0x81d1('0x3a')][_0x81d1('0x53')](_0x1808a5)[_0x81d1('0x34')](handleEntityNotFound(_0x538909,null))[_0x81d1('0x34')](respondWithResult(_0x538909,null))[_0x81d1('0x26')](handleError(_0x538909,null));};exports[_0x81d1('0x54')]=function(_0x2ae2b1,_0x54cedd){return db[_0x81d1('0x3a')][_0x81d1('0x54')](_0x2ae2b1['body'],{})['then'](respondWithResult(_0x54cedd,0xc9))[_0x81d1('0x26')](handleError(_0x54cedd,null));};exports[_0x81d1('0x32')]=function(_0x37f684,_0x2316f0){if(_0x37f684[_0x81d1('0x55')]['id']){delete _0x37f684['body']['id'];}return db[_0x81d1('0x3a')][_0x81d1('0x53')]({'where':{'id':_0x37f684[_0x81d1('0x51')]['id']}})['then'](handleEntityNotFound(_0x2316f0,null))[_0x81d1('0x34')](saveUpdates(_0x37f684[_0x81d1('0x55')],null))[_0x81d1('0x34')](respondWithResult(_0x2316f0,null))[_0x81d1('0x26')](handleError(_0x2316f0,null));};exports[_0x81d1('0x33')]=function(_0x5edeaf,_0x19da68){return db[_0x81d1('0x3a')][_0x81d1('0x53')]({'where':{'id':_0x5edeaf[_0x81d1('0x51')]['id']}})[_0x81d1('0x34')](handleEntityNotFound(_0x19da68,null))[_0x81d1('0x34')](removeEntity(_0x19da68,null))[_0x81d1('0x26')](handleError(_0x19da68,null));};exports[_0x81d1('0x56')]=function(_0x2b690e,_0x4809d1,_0x4764f8){var _0x1c1aec={};var _0x5d42d2={};var _0x30ff9d;var _0x44c990;return db[_0x81d1('0x3a')][_0x81d1('0x57')]({'where':{'id':_0x2b690e[_0x81d1('0x51')]['id']}})['then'](handleEntityNotFound(_0x4809d1,null))[_0x81d1('0x34')](function(_0x10325f){if(_0x10325f){_0x30ff9d=_0x10325f;_0x5d42d2[_0x81d1('0x3f')]=_[_0x81d1('0x41')](db[_0x81d1('0x58')][_0x81d1('0x3b')]);_0x5d42d2[_0x81d1('0x40')]=_[_0x81d1('0x41')](_0x2b690e[_0x81d1('0x40')]);_0x5d42d2[_0x81d1('0x52')]=_['intersection'](_0x5d42d2[_0x81d1('0x3f')],_0x5d42d2[_0x81d1('0x40')]);_0x1c1aec[_0x81d1('0x43')]=_[_0x81d1('0x42')](_0x5d42d2['model'],qs[_0x81d1('0x44')](_0x2b690e[_0x81d1('0x40')]['fields']));_0x1c1aec[_0x81d1('0x43')]=_0x1c1aec['attributes'][_0x81d1('0x59')]?_0x1c1aec['attributes']:_0x5d42d2[_0x81d1('0x3f')];_0x1c1aec['order']=qs[_0x81d1('0x48')](_0x2b690e['query']['sort']);_0x1c1aec['where']=qs[_0x81d1('0x52')](_[_0x81d1('0x5a')](_0x2b690e[_0x81d1('0x40')],_0x5d42d2[_0x81d1('0x52')]));if(_0x2b690e['query'][_0x81d1('0x49')]){_0x1c1aec['where']=_[_0x81d1('0x4b')](_0x1c1aec[_0x81d1('0x4a')],{'$or':_[_0x81d1('0x39')](_0x1c1aec[_0x81d1('0x43')],function(_0x2b9552){var _0x11ce8d={};_0x11ce8d[_0x2b9552]={'$like':'%'+_0x2b690e[_0x81d1('0x40')][_0x81d1('0x49')]+'%'};return _0x11ce8d;})});}_0x1c1aec=_[_0x81d1('0x4b')]({},_0x1c1aec,_0x2b690e[_0x81d1('0x4d')]);return _0x30ff9d['getConfigurations'](_0x1c1aec);}})[_0x81d1('0x34')](function(_0xdb9005){if(_0xdb9005){_0x44c990=_0xdb9005[_0x81d1('0x59')];if(!_0x2b690e['query'][_0x81d1('0x45')](_0x81d1('0x46'))){_0x1c1aec[_0x81d1('0x2d')]=qs[_0x81d1('0x2d')](_0x2b690e[_0x81d1('0x40')][_0x81d1('0x2d')]);_0x1c1aec[_0x81d1('0x2c')]=qs[_0x81d1('0x2c')](_0x2b690e[_0x81d1('0x40')]['offset']);}return _0x30ff9d[_0x81d1('0x56')](_0x1c1aec);}})[_0x81d1('0x34')](function(_0x177134){if(_0x177134){return _0x177134?{'count':_0x44c990,'rows':_0x177134}:null;}})[_0x81d1('0x34')](respondWithResult(_0x4809d1,null))[_0x81d1('0x26')](handleError(_0x4809d1,null));};exports[_0x81d1('0x5b')]=function(_0x17cf58,_0x5cd32e,_0x5285f5){if(_0x17cf58['body']['id']){delete _0x17cf58[_0x81d1('0x55')]['id'];}return db[_0x81d1('0x3a')][_0x81d1('0x57')]({'where':{'id':_0x17cf58[_0x81d1('0x51')]['id']}})['then'](handleEntityNotFound(_0x5cd32e,null))[_0x81d1('0x34')](function(_0x9905bc){if(_0x9905bc){_0x17cf58[_0x81d1('0x55')][_0x81d1('0x5c')]=_0x9905bc['id'];_0x17cf58['body']['Subjects']=integrations[_0x81d1('0x5d')](_0x17cf58[_0x81d1('0x55')][_0x81d1('0x5e')],_0x17cf58[_0x81d1('0x55')][_0x81d1('0x3d')]);_0x17cf58[_0x81d1('0x55')]['Descriptions']=integrations['getDescriptions'](_0x17cf58['body']['channel'],_0x17cf58[_0x81d1('0x55')]['type']);return db['SugarcrmConfiguration']['create'](_0x17cf58[_0x81d1('0x55')],{'include':[{'model':db['SugarcrmField'],'as':_0x81d1('0x5f')},{'model':db[_0x81d1('0x60')],'as':_0x81d1('0x61')}]});}return null;})['then'](respondWithResult(_0x5cd32e,null))[_0x81d1('0x26')](handleError(_0x5cd32e,null));};exports['getFields']=function(_0x26201c,_0x12054f,_0xd10a50){var _0x1059dc='';var _0x453444=['id',_0x81d1('0x36'),_0x81d1('0x62'),_0x81d1('0x63'),'description',_0x81d1('0x64'),_0x81d1('0x65'),_0x81d1('0x66'),_0x81d1('0x67'),_0x81d1('0x68'),'parent_name',_0x81d1('0x69')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x26201c[_0x81d1('0x51')]['id']},'attributes':['id',_0x81d1('0x6a'),'password',_0x81d1('0x6b')]})[_0x81d1('0x34')](handleEntityNotFound(_0x12054f,null))[_0x81d1('0x34')](function(_0x51842e){if(_0x51842e){_0x1059dc=_0x51842e[_0x81d1('0x6b')];var _0x54f4d4=_0x1059dc[_0x81d1('0x6c')](-0x1);if(_0x54f4d4==='/'){_0x1059dc=_0x1059dc[_0x81d1('0x6d')](0x0,_0x1059dc[_0x81d1('0x6e')](_0x54f4d4));}return rp({'method':'POST','uri':util['format'](_0x81d1('0x6f'),_0x1059dc,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x81d1('0x70'),'input_type':'JSON','response_type':_0x81d1('0x71'),'rest_data':JSON[_0x81d1('0x22')]({'user_auth':{'user_name':_0x51842e['username'],'password':_0x51842e['password'],'encryption':'PLAIN'},'application':_0x81d1('0x72')})}});}})['then'](function(_0xc593b0){if(_0xc593b0&&_0xc593b0[_0x81d1('0x36')]!==_0x81d1('0x73')&&_0xc593b0[_0x81d1('0x36')]!==_0x81d1('0x74')){return rp({'method':_0x81d1('0x75'),'uri':util['format'](_0x81d1('0x6f'),_0x1059dc,_0x81d1('0x76')),'json':!![],'form':{'method':_0x81d1('0x77'),'input_type':_0x81d1('0x71'),'response_type':_0x81d1('0x71'),'rest_data':JSON[_0x81d1('0x22')]({'session':_0xc593b0['id'],'module_name':_0x81d1('0x78')})}})['then'](function(_0x1985aa){if(_0x1985aa){var _0x5140c7=_[_0x81d1('0x79')](_0x1985aa[_0x81d1('0x7a')]);_[_0x81d1('0x7b')](_0x5140c7,function(_0x3fe0b7){return _0x453444[_0x81d1('0x7c')](_0x3fe0b7[_0x81d1('0x36')]);});return{'count':_0x5140c7[_0x81d1('0x59')],'rows':_['map'](_0x5140c7,function(_0x10a109){return{'id':_0x10a109['name'],'name':_0x10a109[_0x81d1('0x7d')],'custom':_[_0x81d1('0x7e')](_0x10a109['name'],'_c')?!![]:![],'options':_0x10a109['options']?_[_0x81d1('0x39')](_[_0x81d1('0x79')](_0x10a109[_0x81d1('0x4d')]),function(_0x50d5e1){return{'name':_0x50d5e1[_0x81d1('0x7f')],'value':_0x50d5e1[_0x81d1('0x36')]};}):[]};})};}})[_0x81d1('0x34')](respondWithResult(_0x12054f,null))[_0x81d1('0x26')](function(_0x5f4c36){var _0x18c228=_0x26201c['query'][_0x81d1('0x80')]?0x1f4:_0x5f4c36[_0x81d1('0x81')]||0x1f4;logger[_0x81d1('0x23')](_0x81d1('0x82'),_0x81d1('0x83'),_0x18c228,JSON[_0x81d1('0x22')](_0x5f4c36));delete _0x5f4c36[_0x81d1('0x36')];if(_0x18c228===0x191){_0x18c228=0x190;}_0x12054f[_0x81d1('0x28')](_0x18c228)[_0x81d1('0x37')](_0x26201c[_0x81d1('0x40')][_0x81d1('0x80')]?{'message':_0x81d1('0x84'),'statusCode':_0x5f4c36[_0x81d1('0x81')]}:_0x5f4c36);});}else{var _0x115a92=0x1f4;_0x12054f['status'](_0x115a92)[_0x81d1('0x37')]({'message':_0x81d1('0x84'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xac7c=['zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','map','VIRTUAL','options','SugarcrmAccount','findAll','show','includeAll','include','create','body','update','destroy','find','params','getConfigurations','findOne','SugarcrmConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','/service/v4_1/rest.php','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','format','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xac7c,0x10c));var _0xcac7=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xac7c[_0x35b18a];return _0x4db1bd;};'use strict';var pdf=require(_0xcac7('0x0'));var emlformat=require(_0xcac7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcac7('0x2'));var jsonpatch=require(_0xcac7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcac7('0x4'));var util=require(_0xcac7('0x5'));var path=require(_0xcac7('0x6'));var sox=require(_0xcac7('0x7'));var csv=require(_0xcac7('0x8'));var ejs=require(_0xcac7('0x9'));var fs=require('fs');var _=require(_0xcac7('0xa'));var squel=require(_0xcac7('0xb'));var crypto=require(_0xcac7('0xc'));var jsforce=require(_0xcac7('0xd'));var deskjs=require(_0xcac7('0xe'));var toCsv=require(_0xcac7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcac7('0xf'));var authService=require(_0xcac7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcac7('0x11'));var logger=require(_0xcac7('0x12'))(_0xcac7('0x13'));var utils=require(_0xcac7('0x14'));var config=require(_0xcac7('0x15'));var licenseUtil=require(_0xcac7('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcac7('0x17'));var jayson=require(_0xcac7('0x18'));var client=jayson[_0xcac7('0x19')][_0xcac7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x7f1c78,_0x7be62e,_0x3cb104,_0x441fcc){return new BPromise(function(_0x5713ac,_0x3ffbb2){var _0x6de746=_0x441fcc||client;return _0x6de746[_0xcac7('0x1b')](_0x7f1c78,_0x3cb104)[_0xcac7('0x1c')](function(_0xe5f309){logger[_0xcac7('0x1d')](_0xcac7('0x1e'),_0x7be62e,_0xcac7('0x1f'));logger[_0xcac7('0x20')](_0xcac7('0x21'),_0x7be62e,'request\x20sent',JSON[_0xcac7('0x22')](_0xe5f309));if(_0xe5f309[_0xcac7('0x23')]){if(_0xe5f309[_0xcac7('0x23')][_0xcac7('0x24')]===0x1f4){logger['error'](_0xcac7('0x1e'),_0x7be62e,_0xe5f309[_0xcac7('0x23')][_0xcac7('0x25')]);return _0x3ffbb2(_0xe5f309[_0xcac7('0x23')][_0xcac7('0x25')]);}logger[_0xcac7('0x23')](_0xcac7('0x1e'),_0x7be62e,_0xe5f309[_0xcac7('0x23')][_0xcac7('0x25')]);return _0x5713ac(_0xe5f309[_0xcac7('0x23')][_0xcac7('0x25')]);}else{logger['info'](_0xcac7('0x1e'),_0x7be62e,_0xcac7('0x1f'));_0x5713ac(_0xe5f309[_0xcac7('0x26')][_0xcac7('0x25')]);}})[_0xcac7('0x27')](function(_0xf4f265){logger[_0xcac7('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x7be62e,_0xf4f265);_0x3ffbb2(_0xf4f265);});});}function respondWithStatusCode(_0x5406cb,_0x1d35ea){_0x1d35ea=_0x1d35ea||0xcc;return function(_0x88b301){if(_0x88b301){return _0x5406cb[_0xcac7('0x28')](_0x1d35ea);}return _0x5406cb[_0xcac7('0x29')](_0x1d35ea)[_0xcac7('0x2a')]();};}function respondWithResult(_0x1f773e,_0x4363c0){_0x4363c0=_0x4363c0||0xc8;return function(_0x28f861){if(_0x28f861){return _0x1f773e[_0xcac7('0x29')](_0x4363c0)[_0xcac7('0x2b')](_0x28f861);}};}function respondWithFilteredResult(_0x40b8ed,_0x26742a){return function(_0x3f92ca){if(_0x3f92ca){var _0x177047=_0x3f92ca[_0xcac7('0x2c')],_0x113d51=_0x26742a[_0xcac7('0x2d')],_0x1cb34a=_0x26742a[_0xcac7('0x2d')]+_0x26742a[_0xcac7('0x2e')],_0x50c73d;if(_0x1cb34a>=_0x177047){_0x1cb34a=_0x177047;_0x50c73d=0xc8;}else{_0x50c73d=0xce;}_0x40b8ed[_0xcac7('0x29')](_0x50c73d);return _0x40b8ed[_0xcac7('0x2f')](_0xcac7('0x30'),_0x113d51+'-'+_0x1cb34a+'/'+_0x177047)['json'](_0x3f92ca);}return null;};}function patchUpdates(_0xa7a4e7){return function(_0x4607a2){try{jsonpatch[_0xcac7('0x31')](_0x4607a2,_0xa7a4e7,!![]);}catch(_0x2c61e8){return BPromise[_0xcac7('0x32')](_0x2c61e8);}return _0x4607a2[_0xcac7('0x33')]();};}function saveUpdates(_0x46035b,_0x21ae71){return function(_0x253aba){if(_0x253aba){return _0x253aba['update'](_0x46035b)['then'](function(_0x526be3){return _0x526be3;});}return null;};}function removeEntity(_0x294baf,_0x5d3d01){return function(_0x1ac8e6){if(_0x1ac8e6){return _0x1ac8e6['destroy']()[_0xcac7('0x1c')](function(){_0x294baf[_0xcac7('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef8ae,_0x318384){return function(_0x47ea38){if(!_0x47ea38){_0x3ef8ae[_0xcac7('0x28')](0x194);}return _0x47ea38;};}function handleError(_0x64d8e3,_0x220f74){_0x220f74=_0x220f74||0x1f4;return function(_0x592575){logger[_0xcac7('0x23')](_0x592575[_0xcac7('0x34')]);if(_0x592575[_0xcac7('0x35')]){delete _0x592575['name'];}_0x64d8e3['status'](_0x220f74)[_0xcac7('0x36')](_0x592575);};}exports['index']=function(_0x3c5a1d,_0x1c4739){var _0x51d649={},_0x5408ec={},_0x136884={'count':0x0,'rows':[]};var _0xa2002e=_['map'](db['SugarcrmAccount'][_0xcac7('0x37')],function(_0xdc33e5){return{'name':_0xdc33e5[_0xcac7('0x38')],'type':_0xdc33e5[_0xcac7('0x39')][_0xcac7('0x3a')]};});_0x5408ec[_0xcac7('0x3b')]=_['map'](_0xa2002e,_0xcac7('0x35'));_0x5408ec[_0xcac7('0x3c')]=_[_0xcac7('0x3d')](_0x3c5a1d[_0xcac7('0x3c')]);_0x5408ec['filters']=_[_0xcac7('0x3e')](_0x5408ec[_0xcac7('0x3b')],_0x5408ec['query']);_0x51d649[_0xcac7('0x3f')]=_[_0xcac7('0x3e')](_0x5408ec[_0xcac7('0x3b')],qs[_0xcac7('0x40')](_0x3c5a1d['query'][_0xcac7('0x40')]));_0x51d649[_0xcac7('0x3f')]=_0x51d649['attributes'][_0xcac7('0x41')]?_0x51d649[_0xcac7('0x3f')]:_0x5408ec[_0xcac7('0x3b')];if(!_0x3c5a1d[_0xcac7('0x3c')][_0xcac7('0x42')]('nolimit')){_0x51d649[_0xcac7('0x2e')]=qs[_0xcac7('0x2e')](_0x3c5a1d['query'][_0xcac7('0x2e')]);_0x51d649['offset']=qs[_0xcac7('0x2d')](_0x3c5a1d[_0xcac7('0x3c')][_0xcac7('0x2d')]);}_0x51d649[_0xcac7('0x43')]=qs['sort'](_0x3c5a1d[_0xcac7('0x3c')]['sort']);_0x51d649[_0xcac7('0x44')]=qs[_0xcac7('0x45')](_[_0xcac7('0x46')](_0x3c5a1d[_0xcac7('0x3c')],_0x5408ec['filters']),_0xa2002e);if(_0x3c5a1d[_0xcac7('0x3c')][_0xcac7('0x47')]){_0x51d649[_0xcac7('0x44')]=_[_0xcac7('0x48')](_0x51d649[_0xcac7('0x44')],{'$or':_[_0xcac7('0x49')](_0xa2002e,function(_0x5928ea){if(_0x5928ea[_0xcac7('0x39')]!==_0xcac7('0x4a')){var _0x6c1ea6={};_0x6c1ea6[_0x5928ea['name']]={'$like':'%'+_0x3c5a1d['query'][_0xcac7('0x47')]+'%'};return _0x6c1ea6;}})});}_0x51d649=_['merge']({},_0x51d649,_0x3c5a1d[_0xcac7('0x4b')]);var _0x35b3f9={'where':_0x51d649[_0xcac7('0x44')]};return db[_0xcac7('0x4c')][_0xcac7('0x2c')](_0x35b3f9)[_0xcac7('0x1c')](function(_0x358109){_0x136884['count']=_0x358109;if(_0x3c5a1d[_0xcac7('0x3c')]['includeAll']){_0x51d649['include']=[{'all':!![]}];}return db[_0xcac7('0x4c')][_0xcac7('0x4d')](_0x51d649);})[_0xcac7('0x1c')](function(_0x131bf5){_0x136884['rows']=_0x131bf5;return _0x136884;})[_0xcac7('0x1c')](respondWithFilteredResult(_0x1c4739,_0x51d649))[_0xcac7('0x27')](handleError(_0x1c4739,null));};exports[_0xcac7('0x4e')]=function(_0x3afb55,_0x376659){var _0x5a84d2={'raw':![],'where':{'id':_0x3afb55['params']['id']}},_0x209cd1={};_0x209cd1[_0xcac7('0x3b')]=_[_0xcac7('0x3d')](db[_0xcac7('0x4c')][_0xcac7('0x37')]);_0x209cd1[_0xcac7('0x3c')]=_[_0xcac7('0x3d')](_0x3afb55['query']);_0x209cd1[_0xcac7('0x45')]=_[_0xcac7('0x3e')](_0x209cd1[_0xcac7('0x3b')],_0x209cd1[_0xcac7('0x3c')]);_0x5a84d2[_0xcac7('0x3f')]=_[_0xcac7('0x3e')](_0x209cd1[_0xcac7('0x3b')],qs[_0xcac7('0x40')](_0x3afb55[_0xcac7('0x3c')][_0xcac7('0x40')]));_0x5a84d2['attributes']=_0x5a84d2[_0xcac7('0x3f')]['length']?_0x5a84d2[_0xcac7('0x3f')]:_0x209cd1[_0xcac7('0x3b')];if(_0x3afb55['query'][_0xcac7('0x4f')]){_0x5a84d2[_0xcac7('0x50')]=[{'all':!![]}];}_0x5a84d2=_[_0xcac7('0x48')]({},_0x5a84d2,_0x3afb55[_0xcac7('0x4b')]);return db[_0xcac7('0x4c')]['find'](_0x5a84d2)[_0xcac7('0x1c')](handleEntityNotFound(_0x376659,null))[_0xcac7('0x1c')](respondWithResult(_0x376659,null))[_0xcac7('0x27')](handleError(_0x376659,null));};exports[_0xcac7('0x51')]=function(_0xe68cf5,_0x359fe0){return db[_0xcac7('0x4c')][_0xcac7('0x51')](_0xe68cf5[_0xcac7('0x52')],{})[_0xcac7('0x1c')](respondWithResult(_0x359fe0,0xc9))['catch'](handleError(_0x359fe0,null));};exports[_0xcac7('0x53')]=function(_0xff3d1a,_0x4ea7a7){if(_0xff3d1a[_0xcac7('0x52')]['id']){delete _0xff3d1a[_0xcac7('0x52')]['id'];}return db[_0xcac7('0x4c')]['find']({'where':{'id':_0xff3d1a['params']['id']}})['then'](handleEntityNotFound(_0x4ea7a7,null))[_0xcac7('0x1c')](saveUpdates(_0xff3d1a[_0xcac7('0x52')],null))[_0xcac7('0x1c')](respondWithResult(_0x4ea7a7,null))[_0xcac7('0x27')](handleError(_0x4ea7a7,null));};exports[_0xcac7('0x54')]=function(_0x538b2b,_0x26b337){return db[_0xcac7('0x4c')][_0xcac7('0x55')]({'where':{'id':_0x538b2b[_0xcac7('0x56')]['id']}})['then'](handleEntityNotFound(_0x26b337,null))['then'](removeEntity(_0x26b337,null))[_0xcac7('0x27')](handleError(_0x26b337,null));};exports[_0xcac7('0x57')]=function(_0x942b8c,_0x171c29,_0x540fb4){var _0x574974={};var _0x5af7bc={};var _0x1b2fb6;var _0x479684;return db[_0xcac7('0x4c')][_0xcac7('0x58')]({'where':{'id':_0x942b8c['params']['id']}})[_0xcac7('0x1c')](handleEntityNotFound(_0x171c29,null))[_0xcac7('0x1c')](function(_0x827270){if(_0x827270){_0x1b2fb6=_0x827270;_0x5af7bc['model']=_[_0xcac7('0x3d')](db[_0xcac7('0x59')][_0xcac7('0x37')]);_0x5af7bc[_0xcac7('0x3c')]=_['keys'](_0x942b8c['query']);_0x5af7bc[_0xcac7('0x45')]=_[_0xcac7('0x3e')](_0x5af7bc[_0xcac7('0x3b')],_0x5af7bc['query']);_0x574974[_0xcac7('0x3f')]=_[_0xcac7('0x3e')](_0x5af7bc[_0xcac7('0x3b')],qs[_0xcac7('0x40')](_0x942b8c['query']['fields']));_0x574974[_0xcac7('0x3f')]=_0x574974[_0xcac7('0x3f')]['length']?_0x574974[_0xcac7('0x3f')]:_0x5af7bc[_0xcac7('0x3b')];_0x574974[_0xcac7('0x43')]=qs[_0xcac7('0x5a')](_0x942b8c['query'][_0xcac7('0x5a')]);_0x574974[_0xcac7('0x44')]=qs[_0xcac7('0x45')](_[_0xcac7('0x46')](_0x942b8c[_0xcac7('0x3c')],_0x5af7bc[_0xcac7('0x45')]));if(_0x942b8c[_0xcac7('0x3c')][_0xcac7('0x47')]){_0x574974[_0xcac7('0x44')]=_[_0xcac7('0x48')](_0x574974[_0xcac7('0x44')],{'$or':_['map'](_0x574974[_0xcac7('0x3f')],function(_0x40aa51){var _0x5a5be4={};_0x5a5be4[_0x40aa51]={'$like':'%'+_0x942b8c[_0xcac7('0x3c')][_0xcac7('0x47')]+'%'};return _0x5a5be4;})});}_0x574974=_[_0xcac7('0x48')]({},_0x574974,_0x942b8c[_0xcac7('0x4b')]);return _0x1b2fb6[_0xcac7('0x57')](_0x574974);}})[_0xcac7('0x1c')](function(_0x5f157b){if(_0x5f157b){_0x479684=_0x5f157b[_0xcac7('0x41')];if(!_0x942b8c[_0xcac7('0x3c')][_0xcac7('0x42')](_0xcac7('0x5b'))){_0x574974[_0xcac7('0x2e')]=qs['limit'](_0x942b8c[_0xcac7('0x3c')][_0xcac7('0x2e')]);_0x574974[_0xcac7('0x2d')]=qs[_0xcac7('0x2d')](_0x942b8c['query'][_0xcac7('0x2d')]);}return _0x1b2fb6[_0xcac7('0x57')](_0x574974);}})[_0xcac7('0x1c')](function(_0x58fdc4){if(_0x58fdc4){return _0x58fdc4?{'count':_0x479684,'rows':_0x58fdc4}:null;}})[_0xcac7('0x1c')](respondWithResult(_0x171c29,null))[_0xcac7('0x27')](handleError(_0x171c29,null));};exports[_0xcac7('0x5c')]=function(_0x25da3d,_0x5af8f3,_0xcb9ec){if(_0x25da3d['body']['id']){delete _0x25da3d[_0xcac7('0x52')]['id'];}return db['SugarcrmAccount'][_0xcac7('0x58')]({'where':{'id':_0x25da3d[_0xcac7('0x56')]['id']}})[_0xcac7('0x1c')](handleEntityNotFound(_0x5af8f3,null))[_0xcac7('0x1c')](function(_0xd180c2){if(_0xd180c2){_0x25da3d[_0xcac7('0x52')][_0xcac7('0x5d')]=_0xd180c2['id'];_0x25da3d[_0xcac7('0x52')][_0xcac7('0x5e')]=integrations[_0xcac7('0x5f')](_0x25da3d[_0xcac7('0x52')][_0xcac7('0x60')],_0x25da3d['body'][_0xcac7('0x39')]);_0x25da3d['body'][_0xcac7('0x61')]=integrations[_0xcac7('0x62')](_0x25da3d[_0xcac7('0x52')][_0xcac7('0x60')],_0x25da3d['body'][_0xcac7('0x39')]);return db[_0xcac7('0x59')][_0xcac7('0x51')](_0x25da3d[_0xcac7('0x52')],{'include':[{'model':db[_0xcac7('0x63')],'as':_0xcac7('0x5e')},{'model':db[_0xcac7('0x63')],'as':_0xcac7('0x61')}]});}return null;})['then'](respondWithResult(_0x5af8f3,null))['catch'](handleError(_0x5af8f3,null));};exports['getFields']=function(_0xb7c5ad,_0x54bb98,_0xb3cd1d){var _0x4c8dca='';var _0x58a698=['id',_0xcac7('0x35'),_0xcac7('0x64'),_0xcac7('0x65'),_0xcac7('0x66'),_0xcac7('0x67'),_0xcac7('0x68'),_0xcac7('0x69'),_0xcac7('0x6a'),_0xcac7('0x6b'),_0xcac7('0x6c'),_0xcac7('0x6d')];return db[_0xcac7('0x4c')][_0xcac7('0x58')]({'where':{'id':_0xb7c5ad['params']['id']},'attributes':['id','username',_0xcac7('0x6e'),_0xcac7('0x6f')]})['then'](handleEntityNotFound(_0x54bb98,null))[_0xcac7('0x1c')](function(_0x37c403){if(_0x37c403){_0x4c8dca=_0x37c403[_0xcac7('0x6f')];var _0x249a87=_0x4c8dca[_0xcac7('0x70')](-0x1);if(_0x249a87==='/'){_0x4c8dca=_0x4c8dca[_0xcac7('0x71')](0x0,_0x4c8dca[_0xcac7('0x72')](_0x249a87));}return rp({'method':'POST','uri':util['format']('%s%s',_0x4c8dca,_0xcac7('0x73')),'json':!![],'form':{'method':'login','input_type':_0xcac7('0x74'),'response_type':_0xcac7('0x74'),'rest_data':JSON[_0xcac7('0x22')]({'user_auth':{'user_name':_0x37c403[_0xcac7('0x75')],'password':_0x37c403[_0xcac7('0x6e')],'encryption':_0xcac7('0x76')},'application':_0xcac7('0x77')})}});}})[_0xcac7('0x1c')](function(_0x669c4){if(_0x669c4&&_0x669c4[_0xcac7('0x35')]!==_0xcac7('0x78')&&_0x669c4[_0xcac7('0x35')]!=='Password\x20Expired'){return rp({'method':_0xcac7('0x79'),'uri':util[_0xcac7('0x7a')](_0xcac7('0x7b'),_0x4c8dca,_0xcac7('0x73')),'json':!![],'form':{'method':_0xcac7('0x7c'),'input_type':_0xcac7('0x74'),'response_type':_0xcac7('0x74'),'rest_data':JSON[_0xcac7('0x22')]({'session':_0x669c4['id'],'module_name':_0xcac7('0x7d')})}})[_0xcac7('0x1c')](function(_0x12504e){if(_0x12504e){var _0x14ca56=_[_0xcac7('0x7e')](_0x12504e[_0xcac7('0x7f')]);_[_0xcac7('0x80')](_0x14ca56,function(_0x14a180){return _0x58a698[_0xcac7('0x81')](_0x14a180[_0xcac7('0x35')]);});return{'count':_0x14ca56[_0xcac7('0x41')],'rows':_[_0xcac7('0x49')](_0x14ca56,function(_0x535434){return{'id':_0x535434['name'],'name':_0x535434['label'],'custom':_[_0xcac7('0x82')](_0x535434[_0xcac7('0x35')],'_c')?!![]:![],'options':_0x535434[_0xcac7('0x4b')]?_[_0xcac7('0x49')](_[_0xcac7('0x7e')](_0x535434[_0xcac7('0x4b')]),function(_0x323158){return{'name':_0x323158['value'],'value':_0x323158[_0xcac7('0x35')]};}):[]};})};}})[_0xcac7('0x1c')](respondWithResult(_0x54bb98,null))[_0xcac7('0x27')](function(_0x58d8c4){var _0xdab44f=_0xb7c5ad[_0xcac7('0x3c')][_0xcac7('0x83')]?0x1f4:_0x58d8c4['statusCode']||0x1f4;logger[_0xcac7('0x23')](_0xcac7('0x84'),_0xcac7('0x85'),_0xdab44f,JSON[_0xcac7('0x22')](_0x58d8c4));delete _0x58d8c4['name'];if(_0xdab44f===0x191){_0xdab44f=0x190;}_0x54bb98['status'](_0xdab44f)['send'](_0xb7c5ad[_0xcac7('0x3c')]['test']?{'message':_0xcac7('0x86'),'statusCode':_0x58d8c4['statusCode']}:_0x58d8c4);});}else{var _0xddb4d0=0x1f4;_0x54bb98[_0xcac7('0x29')](_0xddb4d0)[_0xcac7('0x36')]({'message':_0xcac7('0x86'),'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 95b3ce0..6c74f9e 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 _0x73aa=['request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird'];(function(_0x1b9670,_0x1a173d){var _0x40444a=function(_0x14d617){while(--_0x14d617){_0x1b9670['push'](_0x1b9670['shift']());}};_0x40444a(++_0x1a173d);}(_0x73aa,0x1eb));var _0xa73a=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x73aa[_0x17406e];return _0x2bfc5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa73a('0x0'))(_0xa73a('0x1'));var moment=require(_0xa73a('0x2'));var BPromise=require(_0xa73a('0x3'));var rp=require(_0xa73a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa73a('0x5'));var config=require(_0xa73a('0x6'));var attributes=require(_0xa73a('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2f533a,_0x5428f8){return _0x2f533a[_0xa73a('0x8')](_0xa73a('0x9'),attributes,{'tableName':_0xa73a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81d4=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports'];(function(_0x2d2a75,_0x474fbd){var _0x4c138a=function(_0x2a242f){while(--_0x2a242f){_0x2d2a75['push'](_0x2d2a75['shift']());}};_0x4c138a(++_0x474fbd);}(_0x81d4,0x1ca));var _0x481d=function(_0x4f6def,_0x1e4bb8){_0x4f6def=_0x4f6def-0x0;var _0x343106=_0x81d4[_0x4f6def];return _0x343106;};'use strict';var _=require(_0x481d('0x0'));var util=require('util');var logger=require(_0x481d('0x1'))(_0x481d('0x2'));var moment=require(_0x481d('0x3'));var BPromise=require(_0x481d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x481d('0x5'));var rimraf=require(_0x481d('0x6'));var config=require(_0x481d('0x7'));var attributes=require(_0x481d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x481d('0x9')]=function(_0x3138c3,_0x76839f){return _0x3138c3[_0x481d('0xa')](_0x481d('0xb'),attributes,{'tableName':_0x481d('0xc'),'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 6c51e1f..f0028cc 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 _0xbc1b=['SugarcrmAccount,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','where','attributes','include','model','map','debug','catch','ShowSugarcrmAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x5686e4,_0x4ccb9a){var _0x51e9b4=function(_0x4677b7){while(--_0x4677b7){_0x5686e4['push'](_0x5686e4['shift']());}};_0x51e9b4(++_0x4ccb9a);}(_0xbc1b,0x1a0));var _0xbbc1=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xbc1b[_0x319cb9];return _0x1735fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbc1('0x0'));var BPromise=require(_0xbbc1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbc1('0x2'));var db=require(_0xbbc1('0x3'))['db'];var utils=require(_0xbbc1('0x4'));var logger=require(_0xbbc1('0x5'))(_0xbbc1('0x6'));var config=require(_0xbbc1('0x7'));var jayson=require(_0xbbc1('0x8'));var client=jayson[_0xbbc1('0x9')][_0xbbc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f02ea,_0x2b5383,_0x245954){return new BPromise(function(_0x1fdfc0,_0x30b911){return client['request'](_0x4f02ea,_0x245954)[_0xbbc1('0xb')](function(_0x28dbd7){logger[_0xbbc1('0xc')](_0xbbc1('0xd'),_0x2b5383,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2b5383,'request\x20sent',JSON[_0xbbc1('0xe')](_0x28dbd7));if(_0x28dbd7[_0xbbc1('0xf')]){if(_0x28dbd7['error'][_0xbbc1('0x10')]===0x1f4){logger['error'](_0xbbc1('0xd'),_0x2b5383,_0x28dbd7[_0xbbc1('0xf')]['message']);return _0x30b911(_0x28dbd7[_0xbbc1('0xf')][_0xbbc1('0x11')]);}logger[_0xbbc1('0xf')](_0xbbc1('0xd'),_0x2b5383,_0x28dbd7[_0xbbc1('0xf')][_0xbbc1('0x11')]);return _0x1fdfc0(_0x28dbd7[_0xbbc1('0xf')][_0xbbc1('0x11')]);}else{logger[_0xbbc1('0xc')](_0xbbc1('0xd'),_0x2b5383,'request\x20sent');_0x1fdfc0(_0x28dbd7[_0xbbc1('0x12')][_0xbbc1('0x11')]);}})['catch'](function(_0x1ef962){logger[_0xbbc1('0xf')](_0xbbc1('0xd'),_0x2b5383,_0x1ef962);_0x30b911(_0x1ef962);});});}exports[_0xbbc1('0x13')]=function(_0x3e6358){var _0x1146ff=this;return new Promise(function(_0x1f9c50,_0x1b3459){return db[_0xbbc1('0x14')][_0xbbc1('0x15')]({'raw':_0x3e6358['options']?_0x3e6358['options'][_0xbbc1('0x16')]===undefined?!![]:![]:!![],'where':_0x3e6358['options']?_0x3e6358[_0xbbc1('0x17')][_0xbbc1('0x18')]||null:null,'attributes':_0x3e6358[_0xbbc1('0x17')]?_0x3e6358[_0xbbc1('0x17')][_0xbbc1('0x19')]||null:null,'limit':_0x3e6358['options']?_0x3e6358[_0xbbc1('0x17')]['limit']||null:null,'include':_0x3e6358[_0xbbc1('0x17')]?_0x3e6358[_0xbbc1('0x17')][_0xbbc1('0x1a')]?_['map'](_0x3e6358[_0xbbc1('0x17')]['include'],function(_0x47a554){return{'model':db[_0x47a554[_0xbbc1('0x1b')]],'as':_0x47a554['as'],'attributes':_0x47a554[_0xbbc1('0x19')],'include':_0x47a554[_0xbbc1('0x1a')]?_['map'](_0x47a554[_0xbbc1('0x1a')],function(_0x223684){return{'model':db[_0x223684[_0xbbc1('0x1b')]],'as':_0x223684['as'],'attributes':_0x223684[_0xbbc1('0x19')],'include':_0x223684[_0xbbc1('0x1a')]?_[_0xbbc1('0x1c')](_0x223684[_0xbbc1('0x1a')],function(_0x288011){return{'model':db[_0x288011[_0xbbc1('0x1b')]],'as':_0x288011['as'],'attributes':_0x288011[_0xbbc1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175d66){logger[_0xbbc1('0xc')](_0xbbc1('0x13'),_0x3e6358);logger[_0xbbc1('0x1d')]('GetSugarcrmAccount',_0x3e6358,JSON[_0xbbc1('0xe')](_0x175d66));_0x1f9c50(_0x175d66);})[_0xbbc1('0x1e')](function(_0x565284){logger['error'](_0xbbc1('0x13'),_0x565284['message'],_0x3e6358);_0x1b3459(_0x1146ff[_0xbbc1('0xf')](0x1f4,_0x565284[_0xbbc1('0x11')]));});});};exports[_0xbbc1('0x1f')]=function(_0x4bc976){var _0x568931=this;return new Promise(function(_0x452d8e,_0x2c1f58){return db[_0xbbc1('0x14')][_0xbbc1('0x20')]({'raw':_0x4bc976[_0xbbc1('0x17')]?_0x4bc976[_0xbbc1('0x17')][_0xbbc1('0x16')]===undefined?!![]:![]:!![],'where':_0x4bc976[_0xbbc1('0x17')]?_0x4bc976['options'][_0xbbc1('0x18')]||null:null,'attributes':_0x4bc976[_0xbbc1('0x17')]?_0x4bc976['options'][_0xbbc1('0x19')]||null:null,'include':_0x4bc976['options']?_0x4bc976[_0xbbc1('0x17')]['include']?_[_0xbbc1('0x1c')](_0x4bc976['options'][_0xbbc1('0x1a')],function(_0x5a2e1c){return{'model':db[_0x5a2e1c[_0xbbc1('0x1b')]],'as':_0x5a2e1c['as'],'attributes':_0x5a2e1c['attributes'],'include':_0x5a2e1c[_0xbbc1('0x1a')]?_[_0xbbc1('0x1c')](_0x5a2e1c[_0xbbc1('0x1a')],function(_0x3e05a2){return{'model':db[_0x3e05a2[_0xbbc1('0x1b')]],'as':_0x3e05a2['as'],'attributes':_0x3e05a2[_0xbbc1('0x19')],'include':_0x3e05a2[_0xbbc1('0x1a')]?_[_0xbbc1('0x1c')](_0x3e05a2[_0xbbc1('0x1a')],function(_0xf908ce){return{'model':db[_0xf908ce[_0xbbc1('0x1b')]],'as':_0xf908ce['as'],'attributes':_0xf908ce[_0xbbc1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0xb')](function(_0x3f517d){logger[_0xbbc1('0xc')](_0xbbc1('0x1f'),_0x4bc976);logger[_0xbbc1('0x1d')](_0xbbc1('0x1f'),_0x4bc976,JSON[_0xbbc1('0xe')](_0x3f517d));_0x452d8e(_0x3f517d);})[_0xbbc1('0x1e')](function(_0x424484){logger[_0xbbc1('0xf')](_0xbbc1('0x1f'),_0x424484[_0xbbc1('0x11')],_0x4bc976);_0x2c1f58(_0x568931['error'](0x1f4,_0x424484[_0xbbc1('0x11')]));});});}; \ No newline at end of file +var _0x0dbe=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowSugarcrmAccount','debug','lodash','util','moment','randomstring','ioredis'];(function(_0xfa17e5,_0x3fc7ed){var _0x4c8ffe=function(_0x3b82a0){while(--_0x3b82a0){_0xfa17e5['push'](_0xfa17e5['shift']());}};_0x4c8ffe(++_0x3fc7ed);}(_0x0dbe,0x87));var _0xe0db=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x0dbe[_0x1a595a];return _0x33f008;};'use strict';var _=require(_0xe0db('0x0'));var util=require(_0xe0db('0x1'));var moment=require(_0xe0db('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0db('0x3'));var fs=require('fs');var Redis=require(_0xe0db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe0db('0x5'))(_0xe0db('0x6'));var config=require(_0xe0db('0x7'));var jayson=require(_0xe0db('0x8'));var client=jayson[_0xe0db('0x9')][_0xe0db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476712,_0x42a67a,_0x1b7003){return new BPromise(function(_0x13723f,_0x54e094){return client[_0xe0db('0xb')](_0x476712,_0x1b7003)[_0xe0db('0xc')](function(_0x26208b){logger[_0xe0db('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x42a67a,_0xe0db('0xe'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x42a67a,_0xe0db('0xe'),JSON['stringify'](_0x26208b));if(_0x26208b[_0xe0db('0xf')]){if(_0x26208b[_0xe0db('0xf')]['code']===0x1f4){logger[_0xe0db('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x42a67a,_0x26208b['error'][_0xe0db('0x10')]);return _0x54e094(_0x26208b[_0xe0db('0xf')][_0xe0db('0x10')]);}logger[_0xe0db('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x42a67a,_0x26208b[_0xe0db('0xf')]['message']);return _0x13723f(_0x26208b[_0xe0db('0xf')][_0xe0db('0x10')]);}else{logger[_0xe0db('0xd')](_0xe0db('0x11'),_0x42a67a,_0xe0db('0xe'));_0x13723f(_0x26208b[_0xe0db('0x12')][_0xe0db('0x10')]);}})[_0xe0db('0x13')](function(_0x44574a){logger[_0xe0db('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x42a67a,_0x44574a);_0x54e094(_0x44574a);});});}exports[_0xe0db('0x14')]=function(_0x585054){var _0x4260a6=this;return new Promise(function(_0x3b8229,_0x4c7198){return db[_0xe0db('0x15')][_0xe0db('0x16')]({'raw':_0x585054['options']?_0x585054[_0xe0db('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x585054[_0xe0db('0x17')]?_0x585054[_0xe0db('0x17')][_0xe0db('0x18')]||null:null,'attributes':_0x585054['options']?_0x585054[_0xe0db('0x17')][_0xe0db('0x19')]||null:null,'limit':_0x585054[_0xe0db('0x17')]?_0x585054['options'][_0xe0db('0x1a')]||null:null,'include':_0x585054['options']?_0x585054[_0xe0db('0x17')][_0xe0db('0x1b')]?_[_0xe0db('0x1c')](_0x585054[_0xe0db('0x17')][_0xe0db('0x1b')],function(_0x29e83d){return{'model':db[_0x29e83d[_0xe0db('0x1d')]],'as':_0x29e83d['as'],'attributes':_0x29e83d[_0xe0db('0x19')],'include':_0x29e83d['include']?_[_0xe0db('0x1c')](_0x29e83d['include'],function(_0x517220){return{'model':db[_0x517220[_0xe0db('0x1d')]],'as':_0x517220['as'],'attributes':_0x517220[_0xe0db('0x19')],'include':_0x517220[_0xe0db('0x1b')]?_[_0xe0db('0x1c')](_0x517220[_0xe0db('0x1b')],function(_0x2254a6){return{'model':db[_0x2254a6[_0xe0db('0x1d')]],'as':_0x2254a6['as'],'attributes':_0x2254a6[_0xe0db('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe0db('0xc')](function(_0x42ff75){logger[_0xe0db('0xd')](_0xe0db('0x14'),_0x585054);logger['debug'](_0xe0db('0x14'),_0x585054,JSON[_0xe0db('0x1e')](_0x42ff75));_0x3b8229(_0x42ff75);})[_0xe0db('0x13')](function(_0x566645){logger[_0xe0db('0xf')](_0xe0db('0x14'),_0x566645[_0xe0db('0x10')],_0x585054);_0x4c7198(_0x4260a6[_0xe0db('0xf')](0x1f4,_0x566645[_0xe0db('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x5cde0e){var _0x6aa066=this;return new Promise(function(_0xa5ea44,_0x4dcf17){return db[_0xe0db('0x15')][_0xe0db('0x1f')]({'raw':_0x5cde0e['options']?_0x5cde0e[_0xe0db('0x17')][_0xe0db('0x20')]===undefined?!![]:![]:!![],'where':_0x5cde0e[_0xe0db('0x17')]?_0x5cde0e[_0xe0db('0x17')][_0xe0db('0x18')]||null:null,'attributes':_0x5cde0e[_0xe0db('0x17')]?_0x5cde0e[_0xe0db('0x17')][_0xe0db('0x19')]||null:null,'include':_0x5cde0e[_0xe0db('0x17')]?_0x5cde0e['options'][_0xe0db('0x1b')]?_[_0xe0db('0x1c')](_0x5cde0e[_0xe0db('0x17')][_0xe0db('0x1b')],function(_0x51aaa7){return{'model':db[_0x51aaa7[_0xe0db('0x1d')]],'as':_0x51aaa7['as'],'attributes':_0x51aaa7[_0xe0db('0x19')],'include':_0x51aaa7[_0xe0db('0x1b')]?_[_0xe0db('0x1c')](_0x51aaa7['include'],function(_0x45d5eb){return{'model':db[_0x45d5eb[_0xe0db('0x1d')]],'as':_0x45d5eb['as'],'attributes':_0x45d5eb['attributes'],'include':_0x45d5eb[_0xe0db('0x1b')]?_[_0xe0db('0x1c')](_0x45d5eb[_0xe0db('0x1b')],function(_0x33615c){return{'model':db[_0x33615c['model']],'as':_0x33615c['as'],'attributes':_0x33615c[_0xe0db('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe0db('0xc')](function(_0x265fb){logger[_0xe0db('0xd')](_0xe0db('0x21'),_0x5cde0e);logger[_0xe0db('0x22')](_0xe0db('0x21'),_0x5cde0e,JSON['stringify'](_0x265fb));_0xa5ea44(_0x265fb);})[_0xe0db('0x13')](function(_0x45adca){logger[_0xe0db('0xf')](_0xe0db('0x21'),_0x45adca[_0xe0db('0x10')],_0x5cde0e);_0x4dcf17(_0x6aa066[_0xe0db('0xf')](0x1f4,_0x45adca[_0xe0db('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a616261..2fb80c7 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 _0x2757=['getFields','/:id/subjects','getSubjects','getDescriptions','create','/:id','update','destroy','exports','multer','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/fields'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2757,0x13b));var _0x7275=function(_0x57fc6d,_0xe5b4ae){_0x57fc6d=_0x57fc6d-0x0;var _0x3d6b93=_0x2757[_0x57fc6d];return _0x3d6b93;};'use strict';var multer=require(_0x7275('0x0'));var util=require(_0x7275('0x1'));var path=require(_0x7275('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7275('0x3'));var config=require(_0x7275('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x7275('0x5')]('/',auth[_0x7275('0x6')](),controller['index']);router[_0x7275('0x5')]('/:id',auth[_0x7275('0x6')](),controller['show']);router[_0x7275('0x5')](_0x7275('0x7'),auth[_0x7275('0x6')](),controller[_0x7275('0x8')]);router[_0x7275('0x5')](_0x7275('0x9'),auth[_0x7275('0x6')](),controller[_0x7275('0xa')]);router['get']('/:id/descriptions',auth[_0x7275('0x6')](),controller[_0x7275('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7275('0xc')]);router['put'](_0x7275('0xd'),auth[_0x7275('0x6')](),controller[_0x7275('0xe')]);router['delete'](_0x7275('0xd'),auth[_0x7275('0x6')](),controller[_0x7275('0xf')]);module[_0x7275('0x10')]=router; \ No newline at end of file +var _0x77ea=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','multer','util'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x77ea,0x1e2));var _0xa77e=function(_0x4584d4,_0x4eabd9){_0x4584d4=_0x4584d4-0x0;var _0x4387a1=_0x77ea[_0x4584d4];return _0x4387a1;};'use strict';var multer=require(_0xa77e('0x0'));var util=require(_0xa77e('0x1'));var path=require(_0xa77e('0x2'));var timeout=require(_0xa77e('0x3'));var express=require(_0xa77e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa77e('0x5'));var config=require(_0xa77e('0x6'));var controller=require(_0xa77e('0x7'));router[_0xa77e('0x8')]('/',auth[_0xa77e('0x9')](),controller['index']);router['get'](_0xa77e('0xa'),auth[_0xa77e('0x9')](),controller[_0xa77e('0xb')]);router['get'](_0xa77e('0xc'),auth[_0xa77e('0x9')](),controller[_0xa77e('0xd')]);router['get'](_0xa77e('0xe'),auth[_0xa77e('0x9')](),controller[_0xa77e('0xf')]);router[_0xa77e('0x8')](_0xa77e('0x10'),auth[_0xa77e('0x9')](),controller[_0xa77e('0x11')]);router[_0xa77e('0x12')]('/',auth[_0xa77e('0x9')](),controller[_0xa77e('0x13')]);router['put']('/:id',auth[_0xa77e('0x9')](),controller[_0xa77e('0x14')]);router['delete'](_0xa77e('0xa'),auth[_0xa77e('0x9')](),controller[_0xa77e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bfcf984..38883a8 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 _0x1f47=['STRING','sequelize'];(function(_0x554713,_0x1054e1){var _0xec2475=function(_0x46280e){while(--_0x46280e){_0x554713['push'](_0x554713['shift']());}};_0xec2475(++_0x1054e1);}(_0x1f47,0xcd));var _0x71f4=function(_0x70cea6,_0x12b1df){_0x70cea6=_0x70cea6-0x0;var _0x292567=_0x1f47[_0x70cea6];return _0x292567;};'use strict';var Sequelize=require(_0x71f4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x71f4('0x1')]}}; \ No newline at end of file +var _0x0c07=['STRING','sequelize'];(function(_0x562c3a,_0x45edb1){var _0x5b3e24=function(_0x5d9fc5){while(--_0x5d9fc5){_0x562c3a['push'](_0x562c3a['shift']());}};_0x5b3e24(++_0x45edb1);}(_0x0c07,0xe5));var _0x70c0=function(_0x54080c,_0x2b5537){_0x54080c=_0x54080c-0x0;var _0x37b3a7=_0x0c07[_0x54080c];return _0x37b3a7;};'use strict';var Sequelize=require(_0x70c0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x70c0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4b1b43f..d53c6a6 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 _0xc786=['rows','show','params','options','find','create','body','destroy','findOne','SugarcrmField','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','include','findAll'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc786,0xc2));var _0x6c78=function(_0x2a969e,_0x591d21){_0x2a969e=_0x2a969e-0x0;var _0x2194fd=_0xc786[_0x2a969e];return _0x2194fd;};'use strict';var pdf=require(_0x6c78('0x0'));var emlformat=require(_0x6c78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6c78('0x2'));var jsonpatch=require(_0x6c78('0x3'));var rp=require('request-promise');var moment=require(_0x6c78('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c78('0x5'));var util=require(_0x6c78('0x6'));var path=require(_0x6c78('0x7'));var sox=require(_0x6c78('0x8'));var csv=require('to-csv');var ejs=require(_0x6c78('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c78('0xa'));var jsforce=require(_0x6c78('0xb'));var deskjs=require(_0x6c78('0xc'));var toCsv=require(_0x6c78('0xd'));var querystring=require(_0x6c78('0xe'));var Papa=require(_0x6c78('0xf'));var Redis=require('ioredis');var authService=require(_0x6c78('0x10'));var qs=require(_0x6c78('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c78('0x12'));var logger=require(_0x6c78('0x13'))(_0x6c78('0x14'));var utils=require(_0x6c78('0x15'));var config=require(_0x6c78('0x16'));var licenseUtil=require(_0x6c78('0x17'));var db=require(_0x6c78('0x18'))['db'];var jayson=require(_0x6c78('0x19'));var client=jayson[_0x6c78('0x1a')][_0x6c78('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4489a4,_0x33743d,_0x5e2de4,_0x139f49){return new BPromise(function(_0x32bbe6,_0x2de72e){var _0x36c9c2=_0x139f49||client;return _0x36c9c2[_0x6c78('0x1c')](_0x4489a4,_0x5e2de4)[_0x6c78('0x1d')](function(_0x33bbfe){logger['info'](_0x6c78('0x1e'),_0x33743d,_0x6c78('0x1f'));logger[_0x6c78('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x33743d,_0x6c78('0x1f'),JSON[_0x6c78('0x21')](_0x33bbfe));if(_0x33bbfe[_0x6c78('0x22')]){if(_0x33bbfe['error'][_0x6c78('0x23')]===0x1f4){logger[_0x6c78('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33743d,_0x33bbfe[_0x6c78('0x22')][_0x6c78('0x24')]);return _0x2de72e(_0x33bbfe[_0x6c78('0x22')][_0x6c78('0x24')]);}logger[_0x6c78('0x22')](_0x6c78('0x1e'),_0x33743d,_0x33bbfe[_0x6c78('0x22')][_0x6c78('0x24')]);return _0x32bbe6(_0x33bbfe[_0x6c78('0x22')][_0x6c78('0x24')]);}else{logger[_0x6c78('0x25')](_0x6c78('0x1e'),_0x33743d,'request\x20sent');_0x32bbe6(_0x33bbfe[_0x6c78('0x26')][_0x6c78('0x24')]);}})[_0x6c78('0x27')](function(_0x3b9335){logger[_0x6c78('0x22')](_0x6c78('0x1e'),_0x33743d,_0x3b9335);_0x2de72e(_0x3b9335);});});}function respondWithStatusCode(_0x35761c,_0x28c34d){_0x28c34d=_0x28c34d||0xcc;return function(_0x30f68e){if(_0x30f68e){return _0x35761c['sendStatus'](_0x28c34d);}return _0x35761c[_0x6c78('0x28')](_0x28c34d)[_0x6c78('0x29')]();};}function respondWithResult(_0x1679c7,_0x2a6ca5){_0x2a6ca5=_0x2a6ca5||0xc8;return function(_0x1babb9){if(_0x1babb9){return _0x1679c7[_0x6c78('0x28')](_0x2a6ca5)[_0x6c78('0x2a')](_0x1babb9);}};}function respondWithFilteredResult(_0x4274c4,_0x281795){return function(_0x523164){if(_0x523164){var _0x1f335e=_0x523164[_0x6c78('0x2b')],_0x1fbca0=_0x281795['offset'],_0x2df44f=_0x281795[_0x6c78('0x2c')]+_0x281795[_0x6c78('0x2d')],_0x1ce734;if(_0x2df44f>=_0x1f335e){_0x2df44f=_0x1f335e;_0x1ce734=0xc8;}else{_0x1ce734=0xce;}_0x4274c4[_0x6c78('0x28')](_0x1ce734);return _0x4274c4[_0x6c78('0x2e')](_0x6c78('0x2f'),_0x1fbca0+'-'+_0x2df44f+'/'+_0x1f335e)['json'](_0x523164);}return null;};}function patchUpdates(_0x12cfc8){return function(_0x4b75dc){try{jsonpatch[_0x6c78('0x30')](_0x4b75dc,_0x12cfc8,!![]);}catch(_0x28f6fb){return BPromise[_0x6c78('0x31')](_0x28f6fb);}return _0x4b75dc['save']();};}function saveUpdates(_0x428f47,_0x57643b){return function(_0x404128){if(_0x404128){return _0x404128[_0x6c78('0x32')](_0x428f47)[_0x6c78('0x1d')](function(_0xec09ca){return _0xec09ca;});}return null;};}function removeEntity(_0x30a134,_0x4811c5){return function(_0x4ec2af){if(_0x4ec2af){return _0x4ec2af['destroy']()[_0x6c78('0x1d')](function(){_0x30a134[_0x6c78('0x28')](0xcc)[_0x6c78('0x29')]();});}};}function handleEntityNotFound(_0x102f30,_0x10ffaa){return function(_0x483f1f){if(!_0x483f1f){_0x102f30['sendStatus'](0x194);}return _0x483f1f;};}function handleError(_0x52c82f,_0x15936f){_0x15936f=_0x15936f||0x1f4;return function(_0x2477b3){logger['error'](_0x2477b3[_0x6c78('0x33')]);if(_0x2477b3[_0x6c78('0x34')]){delete _0x2477b3[_0x6c78('0x34')];}_0x52c82f['status'](_0x15936f)[_0x6c78('0x35')](_0x2477b3);};}exports['index']=function(_0x4dbce8,_0x54d955){var _0x26203b={},_0x5e71a5={},_0x152ae5={'count':0x0,'rows':[]};var _0x315410=_[_0x6c78('0x36')](db[_0x6c78('0x37')][_0x6c78('0x38')],function(_0xcdab97){return{'name':_0xcdab97['fieldName'],'type':_0xcdab97[_0x6c78('0x39')][_0x6c78('0x3a')]};});_0x5e71a5[_0x6c78('0x3b')]=_[_0x6c78('0x36')](_0x315410,'name');_0x5e71a5[_0x6c78('0x3c')]=_[_0x6c78('0x3d')](_0x4dbce8['query']);_0x5e71a5[_0x6c78('0x3e')]=_[_0x6c78('0x3f')](_0x5e71a5[_0x6c78('0x3b')],_0x5e71a5[_0x6c78('0x3c')]);_0x26203b[_0x6c78('0x40')]=_[_0x6c78('0x3f')](_0x5e71a5['model'],qs[_0x6c78('0x41')](_0x4dbce8['query']['fields']));_0x26203b['attributes']=_0x26203b[_0x6c78('0x40')][_0x6c78('0x42')]?_0x26203b[_0x6c78('0x40')]:_0x5e71a5[_0x6c78('0x3b')];if(!_0x4dbce8[_0x6c78('0x3c')][_0x6c78('0x43')]('nolimit')){_0x26203b[_0x6c78('0x2d')]=qs[_0x6c78('0x2d')](_0x4dbce8[_0x6c78('0x3c')][_0x6c78('0x2d')]);_0x26203b['offset']=qs[_0x6c78('0x2c')](_0x4dbce8[_0x6c78('0x3c')][_0x6c78('0x2c')]);}_0x26203b[_0x6c78('0x44')]=qs[_0x6c78('0x45')](_0x4dbce8[_0x6c78('0x3c')][_0x6c78('0x45')]);_0x26203b[_0x6c78('0x46')]=qs['filters'](_[_0x6c78('0x47')](_0x4dbce8[_0x6c78('0x3c')],_0x5e71a5[_0x6c78('0x3e')]),_0x315410);if(_0x4dbce8['query']['filter']){_0x26203b[_0x6c78('0x46')]=_[_0x6c78('0x48')](_0x26203b[_0x6c78('0x46')],{'$or':_[_0x6c78('0x36')](_0x315410,function(_0x742400){if(_0x742400[_0x6c78('0x39')]!=='VIRTUAL'){var _0x7fbc67={};_0x7fbc67[_0x742400['name']]={'$like':'%'+_0x4dbce8[_0x6c78('0x3c')][_0x6c78('0x49')]+'%'};return _0x7fbc67;}})});}_0x26203b=_[_0x6c78('0x48')]({},_0x26203b,_0x4dbce8['options']);var _0x373da3={'where':_0x26203b['where']};return db[_0x6c78('0x37')][_0x6c78('0x2b')](_0x373da3)[_0x6c78('0x1d')](function(_0x5b1bd1){_0x152ae5[_0x6c78('0x2b')]=_0x5b1bd1;if(_0x4dbce8[_0x6c78('0x3c')]['includeAll']){_0x26203b[_0x6c78('0x4a')]=[{'all':!![]}];}return db[_0x6c78('0x37')][_0x6c78('0x4b')](_0x26203b);})['then'](function(_0x4220f3){_0x152ae5[_0x6c78('0x4c')]=_0x4220f3;return _0x152ae5;})[_0x6c78('0x1d')](respondWithFilteredResult(_0x54d955,_0x26203b))[_0x6c78('0x27')](handleError(_0x54d955,null));};exports[_0x6c78('0x4d')]=function(_0x136f0d,_0x5e7d87){var _0x5c89b3={'raw':![],'where':{'id':_0x136f0d[_0x6c78('0x4e')]['id']}},_0x150b70={};_0x150b70[_0x6c78('0x3b')]=_[_0x6c78('0x3d')](db[_0x6c78('0x37')]['rawAttributes']);_0x150b70[_0x6c78('0x3c')]=_['keys'](_0x136f0d[_0x6c78('0x3c')]);_0x150b70[_0x6c78('0x3e')]=_[_0x6c78('0x3f')](_0x150b70[_0x6c78('0x3b')],_0x150b70['query']);_0x5c89b3[_0x6c78('0x40')]=_[_0x6c78('0x3f')](_0x150b70[_0x6c78('0x3b')],qs[_0x6c78('0x41')](_0x136f0d[_0x6c78('0x3c')][_0x6c78('0x41')]));_0x5c89b3['attributes']=_0x5c89b3[_0x6c78('0x40')][_0x6c78('0x42')]?_0x5c89b3['attributes']:_0x150b70[_0x6c78('0x3b')];if(_0x136f0d[_0x6c78('0x3c')]['includeAll']){_0x5c89b3['include']=[{'all':!![]}];}_0x5c89b3=_[_0x6c78('0x48')]({},_0x5c89b3,_0x136f0d[_0x6c78('0x4f')]);return db[_0x6c78('0x37')][_0x6c78('0x50')](_0x5c89b3)['then'](handleEntityNotFound(_0x5e7d87,null))[_0x6c78('0x1d')](respondWithResult(_0x5e7d87,null))['catch'](handleError(_0x5e7d87,null));};exports[_0x6c78('0x51')]=function(_0x39efea,_0x301ea2){return db[_0x6c78('0x37')][_0x6c78('0x51')](_0x39efea[_0x6c78('0x52')],{})[_0x6c78('0x1d')](respondWithResult(_0x301ea2,0xc9))['catch'](handleError(_0x301ea2,null));};exports['update']=function(_0x1880d1,_0x43dad8){if(_0x1880d1[_0x6c78('0x52')]['id']){delete _0x1880d1[_0x6c78('0x52')]['id'];}return db[_0x6c78('0x37')][_0x6c78('0x50')]({'where':{'id':_0x1880d1['params']['id']}})[_0x6c78('0x1d')](handleEntityNotFound(_0x43dad8,null))[_0x6c78('0x1d')](saveUpdates(_0x1880d1[_0x6c78('0x52')],null))['then'](respondWithResult(_0x43dad8,null))[_0x6c78('0x27')](handleError(_0x43dad8,null));};exports[_0x6c78('0x53')]=function(_0x2e1717,_0x5660d0){return db[_0x6c78('0x37')][_0x6c78('0x50')]({'where':{'id':_0x2e1717[_0x6c78('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5660d0,null))[_0x6c78('0x1d')](removeEntity(_0x5660d0,null))[_0x6c78('0x27')](handleError(_0x5660d0,null));};exports['getFields']=function(_0x329a58,_0x3b82af,_0x508bf4){var _0x3010d5={};var _0x4a6b87={};var _0x444af5;var _0x2d1fed;return db[_0x6c78('0x37')][_0x6c78('0x54')]({'where':{'id':_0x329a58[_0x6c78('0x4e')]['id']}})[_0x6c78('0x1d')](handleEntityNotFound(_0x3b82af,null))['then'](function(_0x164a85){if(_0x164a85){_0x444af5=_0x164a85;_0x4a6b87['model']=_[_0x6c78('0x3d')](db[_0x6c78('0x55')][_0x6c78('0x38')]);_0x4a6b87[_0x6c78('0x3c')]=_['keys'](_0x329a58[_0x6c78('0x3c')]);_0x4a6b87[_0x6c78('0x3e')]=_[_0x6c78('0x3f')](_0x4a6b87['model'],_0x4a6b87[_0x6c78('0x3c')]);_0x3010d5[_0x6c78('0x40')]=_[_0x6c78('0x3f')](_0x4a6b87[_0x6c78('0x3b')],qs[_0x6c78('0x41')](_0x329a58[_0x6c78('0x3c')][_0x6c78('0x41')]));_0x3010d5[_0x6c78('0x40')]=_0x3010d5[_0x6c78('0x40')][_0x6c78('0x42')]?_0x3010d5[_0x6c78('0x40')]:_0x4a6b87[_0x6c78('0x3b')];_0x3010d5['order']=qs[_0x6c78('0x45')](_0x329a58[_0x6c78('0x3c')]['sort']);_0x3010d5[_0x6c78('0x46')]=qs[_0x6c78('0x3e')](_[_0x6c78('0x47')](_0x329a58[_0x6c78('0x3c')],_0x4a6b87[_0x6c78('0x3e')]));if(_0x329a58[_0x6c78('0x3c')]['filter']){_0x3010d5[_0x6c78('0x46')]=_[_0x6c78('0x48')](_0x3010d5['where'],{'$or':_['map'](_0x3010d5[_0x6c78('0x40')],function(_0x2065cb){var _0x217791={};_0x217791[_0x2065cb]={'$like':'%'+_0x329a58[_0x6c78('0x3c')][_0x6c78('0x49')]+'%'};return _0x217791;})});}_0x3010d5=_[_0x6c78('0x48')]({},_0x3010d5,_0x329a58[_0x6c78('0x4f')]);return _0x444af5[_0x6c78('0x56')](_0x3010d5);}})[_0x6c78('0x1d')](function(_0x2bd9c2){if(_0x2bd9c2){_0x2d1fed=_0x2bd9c2[_0x6c78('0x42')];if(!_0x329a58[_0x6c78('0x3c')][_0x6c78('0x43')](_0x6c78('0x57'))){_0x3010d5[_0x6c78('0x2d')]=qs[_0x6c78('0x2d')](_0x329a58[_0x6c78('0x3c')][_0x6c78('0x2d')]);_0x3010d5['offset']=qs[_0x6c78('0x2c')](_0x329a58[_0x6c78('0x3c')][_0x6c78('0x2c')]);}return _0x444af5[_0x6c78('0x56')](_0x3010d5);}})['then'](function(_0x106f92){if(_0x106f92){return _0x106f92?{'count':_0x2d1fed,'rows':_0x106f92}:null;}})['then'](respondWithResult(_0x3b82af,null))[_0x6c78('0x27')](handleError(_0x3b82af,null));};exports[_0x6c78('0x58')]=function(_0x440211,_0x5b5349,_0x419fb9){var _0x28e362={};var _0x2f0b90={};var _0x45b2c7;var _0x2c1c85;return db[_0x6c78('0x37')][_0x6c78('0x54')]({'where':{'id':_0x440211[_0x6c78('0x4e')]['id']}})[_0x6c78('0x1d')](handleEntityNotFound(_0x5b5349,null))['then'](function(_0x1ca5f0){if(_0x1ca5f0){_0x45b2c7=_0x1ca5f0;_0x2f0b90[_0x6c78('0x3b')]=_['keys'](db[_0x6c78('0x55')][_0x6c78('0x38')]);_0x2f0b90[_0x6c78('0x3c')]=_[_0x6c78('0x3d')](_0x440211[_0x6c78('0x3c')]);_0x2f0b90[_0x6c78('0x3e')]=_[_0x6c78('0x3f')](_0x2f0b90[_0x6c78('0x3b')],_0x2f0b90[_0x6c78('0x3c')]);_0x28e362['attributes']=_[_0x6c78('0x3f')](_0x2f0b90[_0x6c78('0x3b')],qs[_0x6c78('0x41')](_0x440211['query'][_0x6c78('0x41')]));_0x28e362['attributes']=_0x28e362[_0x6c78('0x40')][_0x6c78('0x42')]?_0x28e362[_0x6c78('0x40')]:_0x2f0b90[_0x6c78('0x3b')];_0x28e362[_0x6c78('0x44')]=qs[_0x6c78('0x45')](_0x440211[_0x6c78('0x3c')][_0x6c78('0x45')]);_0x28e362[_0x6c78('0x46')]=qs['filters'](_[_0x6c78('0x47')](_0x440211[_0x6c78('0x3c')],_0x2f0b90[_0x6c78('0x3e')]));if(_0x440211[_0x6c78('0x3c')][_0x6c78('0x49')]){_0x28e362[_0x6c78('0x46')]=_[_0x6c78('0x48')](_0x28e362['where'],{'$or':_[_0x6c78('0x36')](_0x28e362[_0x6c78('0x40')],function(_0x252259){var _0x4980af={};_0x4980af[_0x252259]={'$like':'%'+_0x440211[_0x6c78('0x3c')][_0x6c78('0x49')]+'%'};return _0x4980af;})});}_0x28e362=_['merge']({},_0x28e362,_0x440211['options']);return _0x45b2c7[_0x6c78('0x58')](_0x28e362);}})['then'](function(_0x56c1a0){if(_0x56c1a0){_0x2c1c85=_0x56c1a0[_0x6c78('0x42')];if(!_0x440211[_0x6c78('0x3c')][_0x6c78('0x43')](_0x6c78('0x57'))){_0x28e362[_0x6c78('0x2d')]=qs[_0x6c78('0x2d')](_0x440211['query'][_0x6c78('0x2d')]);_0x28e362[_0x6c78('0x2c')]=qs[_0x6c78('0x2c')](_0x440211[_0x6c78('0x3c')][_0x6c78('0x2c')]);}return _0x45b2c7[_0x6c78('0x58')](_0x28e362);}})[_0x6c78('0x1d')](function(_0x4d0273){if(_0x4d0273){return _0x4d0273?{'count':_0x2c1c85,'rows':_0x4d0273}:null;}})[_0x6c78('0x1d')](respondWithResult(_0x5b5349,null))['catch'](handleError(_0x5b5349,null));};exports[_0x6c78('0x59')]=function(_0x13954c,_0x31aa9f,_0x53a49b){var _0x179514={};var _0x50e5b5={};var _0x16d332;var _0x1481fc;return db[_0x6c78('0x37')][_0x6c78('0x54')]({'where':{'id':_0x13954c['params']['id']}})[_0x6c78('0x1d')](handleEntityNotFound(_0x31aa9f,null))['then'](function(_0x32f21e){if(_0x32f21e){_0x16d332=_0x32f21e;_0x50e5b5['model']=_['keys'](db[_0x6c78('0x55')][_0x6c78('0x38')]);_0x50e5b5[_0x6c78('0x3c')]=_[_0x6c78('0x3d')](_0x13954c[_0x6c78('0x3c')]);_0x50e5b5[_0x6c78('0x3e')]=_[_0x6c78('0x3f')](_0x50e5b5[_0x6c78('0x3b')],_0x50e5b5[_0x6c78('0x3c')]);_0x179514[_0x6c78('0x40')]=_[_0x6c78('0x3f')](_0x50e5b5[_0x6c78('0x3b')],qs['fields'](_0x13954c[_0x6c78('0x3c')]['fields']));_0x179514[_0x6c78('0x40')]=_0x179514['attributes'][_0x6c78('0x42')]?_0x179514[_0x6c78('0x40')]:_0x50e5b5[_0x6c78('0x3b')];_0x179514[_0x6c78('0x44')]=qs['sort'](_0x13954c[_0x6c78('0x3c')][_0x6c78('0x45')]);_0x179514['where']=qs[_0x6c78('0x3e')](_['pick'](_0x13954c[_0x6c78('0x3c')],_0x50e5b5[_0x6c78('0x3e')]));if(_0x13954c['query'][_0x6c78('0x49')]){_0x179514[_0x6c78('0x46')]=_['merge'](_0x179514[_0x6c78('0x46')],{'$or':_[_0x6c78('0x36')](_0x179514[_0x6c78('0x40')],function(_0x553ed3){var _0x529c34={};_0x529c34[_0x553ed3]={'$like':'%'+_0x13954c[_0x6c78('0x3c')][_0x6c78('0x49')]+'%'};return _0x529c34;})});}_0x179514=_[_0x6c78('0x48')]({},_0x179514,_0x13954c[_0x6c78('0x4f')]);return _0x16d332['getDescriptions'](_0x179514);}})['then'](function(_0x381a36){if(_0x381a36){_0x1481fc=_0x381a36[_0x6c78('0x42')];if(!_0x13954c['query'][_0x6c78('0x43')]('nolimit')){_0x179514['limit']=qs[_0x6c78('0x2d')](_0x13954c[_0x6c78('0x3c')][_0x6c78('0x2d')]);_0x179514['offset']=qs[_0x6c78('0x2c')](_0x13954c['query']['offset']);}return _0x16d332[_0x6c78('0x59')](_0x179514);}})[_0x6c78('0x1d')](function(_0x34cf9c){if(_0x34cf9c){return _0x34cf9c?{'count':_0x1481fc,'rows':_0x34cf9c}:null;}})[_0x6c78('0x1d')](respondWithResult(_0x31aa9f,null))['catch'](handleError(_0x31aa9f,null));}; \ No newline at end of file +var _0x4709=['map','SugarcrmConfiguration','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','merge','includeAll','include','rows','show','params','options','find','create','body','findOne','keys','filters','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','bluebird','path','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','count','set','json','apply','save','update','destroy','stack','name','send','index'];(function(_0x50d086,_0x4e96e0){var _0x2e9e27=function(_0x545d54){while(--_0x545d54){_0x50d086['push'](_0x50d086['shift']());}};_0x2e9e27(++_0x4e96e0);}(_0x4709,0x74));var _0x9470=function(_0x56c1b7,_0x2afcc6){_0x56c1b7=_0x56c1b7-0x0;var _0x22564d=_0x4709[_0x56c1b7];return _0x22564d;};'use strict';var pdf=require(_0x9470('0x0'));var emlformat=require(_0x9470('0x1'));var rimraf=require(_0x9470('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9470('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9470('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9470('0x5'));var fs=require('fs');var _=require(_0x9470('0x6'));var squel=require('squel');var crypto=require(_0x9470('0x7'));var jsforce=require(_0x9470('0x8'));var deskjs=require(_0x9470('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9470('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9470('0xb'));var qs=require(_0x9470('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9470('0xd'));var utils=require('../../config/utils');var config=require(_0x9470('0xe'));var licenseUtil=require(_0x9470('0xf'));var db=require(_0x9470('0x10'))['db'];var jayson=require(_0x9470('0x11'));var client=jayson[_0x9470('0x12')][_0x9470('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x11bbe3,_0x5ffc2d,_0x2658b7,_0x3893f3){return new BPromise(function(_0x3203cc,_0x461db1){var _0x10b51e=_0x3893f3||client;return _0x10b51e['request'](_0x11bbe3,_0x2658b7)[_0x9470('0x14')](function(_0x38a937){logger[_0x9470('0x15')](_0x9470('0x16'),_0x5ffc2d,_0x9470('0x17'));logger[_0x9470('0x18')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5ffc2d,_0x9470('0x17'),JSON['stringify'](_0x38a937));if(_0x38a937[_0x9470('0x19')]){if(_0x38a937[_0x9470('0x19')][_0x9470('0x1a')]===0x1f4){logger['error'](_0x9470('0x16'),_0x5ffc2d,_0x38a937[_0x9470('0x19')]['message']);return _0x461db1(_0x38a937[_0x9470('0x19')][_0x9470('0x1b')]);}logger[_0x9470('0x19')](_0x9470('0x16'),_0x5ffc2d,_0x38a937[_0x9470('0x19')][_0x9470('0x1b')]);return _0x3203cc(_0x38a937[_0x9470('0x19')][_0x9470('0x1b')]);}else{logger[_0x9470('0x15')](_0x9470('0x16'),_0x5ffc2d,'request\x20sent');_0x3203cc(_0x38a937[_0x9470('0x1c')][_0x9470('0x1b')]);}})[_0x9470('0x1d')](function(_0x5ca1a3){logger[_0x9470('0x19')](_0x9470('0x16'),_0x5ffc2d,_0x5ca1a3);_0x461db1(_0x5ca1a3);});});}function respondWithStatusCode(_0x76a061,_0x6cc699){_0x6cc699=_0x6cc699||0xcc;return function(_0x2a0ce1){if(_0x2a0ce1){return _0x76a061[_0x9470('0x1e')](_0x6cc699);}return _0x76a061[_0x9470('0x1f')](_0x6cc699)[_0x9470('0x20')]();};}function respondWithResult(_0x2cf57b,_0x1a1b78){_0x1a1b78=_0x1a1b78||0xc8;return function(_0x93cc17){if(_0x93cc17){return _0x2cf57b['status'](_0x1a1b78)['json'](_0x93cc17);}};}function respondWithFilteredResult(_0x317b90,_0x503599){return function(_0x6d0dd8){if(_0x6d0dd8){var _0x5de583=_0x6d0dd8[_0x9470('0x21')],_0x40e80b=_0x503599['offset'],_0x52bb4e=_0x503599['offset']+_0x503599['limit'],_0x2bf0c1;if(_0x52bb4e>=_0x5de583){_0x52bb4e=_0x5de583;_0x2bf0c1=0xc8;}else{_0x2bf0c1=0xce;}_0x317b90[_0x9470('0x1f')](_0x2bf0c1);return _0x317b90[_0x9470('0x22')]('Content-Range',_0x40e80b+'-'+_0x52bb4e+'/'+_0x5de583)[_0x9470('0x23')](_0x6d0dd8);}return null;};}function patchUpdates(_0x2790be){return function(_0x131792){try{jsonpatch[_0x9470('0x24')](_0x131792,_0x2790be,!![]);}catch(_0x125162){return BPromise['reject'](_0x125162);}return _0x131792[_0x9470('0x25')]();};}function saveUpdates(_0x43a427,_0x5c78fc){return function(_0x33aa8e){if(_0x33aa8e){return _0x33aa8e[_0x9470('0x26')](_0x43a427)[_0x9470('0x14')](function(_0x53a6cf){return _0x53a6cf;});}return null;};}function removeEntity(_0x29388e,_0x3cb778){return function(_0x11753f){if(_0x11753f){return _0x11753f[_0x9470('0x27')]()['then'](function(){_0x29388e[_0x9470('0x1f')](0xcc)[_0x9470('0x20')]();});}};}function handleEntityNotFound(_0x2c1553,_0x53dcf0){return function(_0x444dd1){if(!_0x444dd1){_0x2c1553['sendStatus'](0x194);}return _0x444dd1;};}function handleError(_0xe30ffd,_0x3b258e){_0x3b258e=_0x3b258e||0x1f4;return function(_0x2bd965){logger[_0x9470('0x19')](_0x2bd965[_0x9470('0x28')]);if(_0x2bd965['name']){delete _0x2bd965[_0x9470('0x29')];}_0xe30ffd[_0x9470('0x1f')](_0x3b258e)[_0x9470('0x2a')](_0x2bd965);};}exports[_0x9470('0x2b')]=function(_0x4cee22,_0x5a0049){var _0x28db04={},_0x1982bb={},_0x58e6d6={'count':0x0,'rows':[]};var _0x198e5b=_[_0x9470('0x2c')](db[_0x9470('0x2d')][_0x9470('0x2e')],function(_0x5d2b88){return{'name':_0x5d2b88['fieldName'],'type':_0x5d2b88[_0x9470('0x2f')][_0x9470('0x30')]};});_0x1982bb[_0x9470('0x31')]=_[_0x9470('0x2c')](_0x198e5b,'name');_0x1982bb[_0x9470('0x32')]=_['keys'](_0x4cee22[_0x9470('0x32')]);_0x1982bb['filters']=_[_0x9470('0x33')](_0x1982bb[_0x9470('0x31')],_0x1982bb['query']);_0x28db04[_0x9470('0x34')]=_[_0x9470('0x33')](_0x1982bb['model'],qs[_0x9470('0x35')](_0x4cee22[_0x9470('0x32')][_0x9470('0x35')]));_0x28db04[_0x9470('0x34')]=_0x28db04[_0x9470('0x34')][_0x9470('0x36')]?_0x28db04[_0x9470('0x34')]:_0x1982bb[_0x9470('0x31')];if(!_0x4cee22[_0x9470('0x32')][_0x9470('0x37')](_0x9470('0x38'))){_0x28db04[_0x9470('0x39')]=qs[_0x9470('0x39')](_0x4cee22[_0x9470('0x32')][_0x9470('0x39')]);_0x28db04[_0x9470('0x3a')]=qs[_0x9470('0x3a')](_0x4cee22[_0x9470('0x32')][_0x9470('0x3a')]);}_0x28db04[_0x9470('0x3b')]=qs[_0x9470('0x3c')](_0x4cee22['query'][_0x9470('0x3c')]);_0x28db04[_0x9470('0x3d')]=qs['filters'](_['pick'](_0x4cee22[_0x9470('0x32')],_0x1982bb['filters']),_0x198e5b);if(_0x4cee22[_0x9470('0x32')][_0x9470('0x3e')]){_0x28db04[_0x9470('0x3d')]=_[_0x9470('0x3f')](_0x28db04[_0x9470('0x3d')],{'$or':_[_0x9470('0x2c')](_0x198e5b,function(_0x21d386){if(_0x21d386[_0x9470('0x2f')]!=='VIRTUAL'){var _0x4cb9b={};_0x4cb9b[_0x21d386[_0x9470('0x29')]]={'$like':'%'+_0x4cee22[_0x9470('0x32')]['filter']+'%'};return _0x4cb9b;}})});}_0x28db04=_['merge']({},_0x28db04,_0x4cee22['options']);var _0x1ef25e={'where':_0x28db04[_0x9470('0x3d')]};return db[_0x9470('0x2d')][_0x9470('0x21')](_0x1ef25e)[_0x9470('0x14')](function(_0x4fd15a){_0x58e6d6[_0x9470('0x21')]=_0x4fd15a;if(_0x4cee22[_0x9470('0x32')][_0x9470('0x40')]){_0x28db04[_0x9470('0x41')]=[{'all':!![]}];}return db[_0x9470('0x2d')]['findAll'](_0x28db04);})[_0x9470('0x14')](function(_0x3cdeb5){_0x58e6d6[_0x9470('0x42')]=_0x3cdeb5;return _0x58e6d6;})[_0x9470('0x14')](respondWithFilteredResult(_0x5a0049,_0x28db04))['catch'](handleError(_0x5a0049,null));};exports[_0x9470('0x43')]=function(_0x234ab5,_0x1df6a1){var _0x189aca={'raw':![],'where':{'id':_0x234ab5[_0x9470('0x44')]['id']}},_0xd8dd0f={};_0xd8dd0f['model']=_['keys'](db[_0x9470('0x2d')][_0x9470('0x2e')]);_0xd8dd0f['query']=_['keys'](_0x234ab5[_0x9470('0x32')]);_0xd8dd0f['filters']=_[_0x9470('0x33')](_0xd8dd0f[_0x9470('0x31')],_0xd8dd0f[_0x9470('0x32')]);_0x189aca[_0x9470('0x34')]=_[_0x9470('0x33')](_0xd8dd0f[_0x9470('0x31')],qs[_0x9470('0x35')](_0x234ab5[_0x9470('0x32')][_0x9470('0x35')]));_0x189aca[_0x9470('0x34')]=_0x189aca[_0x9470('0x34')][_0x9470('0x36')]?_0x189aca[_0x9470('0x34')]:_0xd8dd0f[_0x9470('0x31')];if(_0x234ab5['query'][_0x9470('0x40')]){_0x189aca['include']=[{'all':!![]}];}_0x189aca=_[_0x9470('0x3f')]({},_0x189aca,_0x234ab5[_0x9470('0x45')]);return db[_0x9470('0x2d')][_0x9470('0x46')](_0x189aca)[_0x9470('0x14')](handleEntityNotFound(_0x1df6a1,null))['then'](respondWithResult(_0x1df6a1,null))['catch'](handleError(_0x1df6a1,null));};exports['create']=function(_0x5b671c,_0x3f8b38){return db['SugarcrmConfiguration'][_0x9470('0x47')](_0x5b671c[_0x9470('0x48')],{})['then'](respondWithResult(_0x3f8b38,0xc9))[_0x9470('0x1d')](handleError(_0x3f8b38,null));};exports['update']=function(_0x462144,_0x158ff1){if(_0x462144[_0x9470('0x48')]['id']){delete _0x462144[_0x9470('0x48')]['id'];}return db['SugarcrmConfiguration'][_0x9470('0x46')]({'where':{'id':_0x462144['params']['id']}})[_0x9470('0x14')](handleEntityNotFound(_0x158ff1,null))[_0x9470('0x14')](saveUpdates(_0x462144[_0x9470('0x48')],null))[_0x9470('0x14')](respondWithResult(_0x158ff1,null))[_0x9470('0x1d')](handleError(_0x158ff1,null));};exports[_0x9470('0x27')]=function(_0x477b52,_0x1e934f){return db[_0x9470('0x2d')]['find']({'where':{'id':_0x477b52[_0x9470('0x44')]['id']}})[_0x9470('0x14')](handleEntityNotFound(_0x1e934f,null))['then'](removeEntity(_0x1e934f,null))[_0x9470('0x1d')](handleError(_0x1e934f,null));};exports['getFields']=function(_0x5ec5d4,_0x373d72,_0x341de1){var _0x569d9f={};var _0x598486={};var _0x464660;var _0x2e672e;return db[_0x9470('0x2d')][_0x9470('0x49')]({'where':{'id':_0x5ec5d4[_0x9470('0x44')]['id']}})[_0x9470('0x14')](handleEntityNotFound(_0x373d72,null))[_0x9470('0x14')](function(_0x5882f9){if(_0x5882f9){_0x464660=_0x5882f9;_0x598486[_0x9470('0x31')]=_[_0x9470('0x4a')](db['SugarcrmField']['rawAttributes']);_0x598486[_0x9470('0x32')]=_[_0x9470('0x4a')](_0x5ec5d4[_0x9470('0x32')]);_0x598486['filters']=_[_0x9470('0x33')](_0x598486[_0x9470('0x31')],_0x598486[_0x9470('0x32')]);_0x569d9f['attributes']=_[_0x9470('0x33')](_0x598486[_0x9470('0x31')],qs[_0x9470('0x35')](_0x5ec5d4[_0x9470('0x32')][_0x9470('0x35')]));_0x569d9f[_0x9470('0x34')]=_0x569d9f[_0x9470('0x34')][_0x9470('0x36')]?_0x569d9f[_0x9470('0x34')]:_0x598486['model'];_0x569d9f[_0x9470('0x3b')]=qs[_0x9470('0x3c')](_0x5ec5d4[_0x9470('0x32')][_0x9470('0x3c')]);_0x569d9f['where']=qs[_0x9470('0x4b')](_[_0x9470('0x4c')](_0x5ec5d4[_0x9470('0x32')],_0x598486[_0x9470('0x4b')]));if(_0x5ec5d4[_0x9470('0x32')][_0x9470('0x3e')]){_0x569d9f[_0x9470('0x3d')]=_['merge'](_0x569d9f[_0x9470('0x3d')],{'$or':_['map'](_0x569d9f[_0x9470('0x34')],function(_0x59da47){var _0x22fef1={};_0x22fef1[_0x59da47]={'$like':'%'+_0x5ec5d4[_0x9470('0x32')][_0x9470('0x3e')]+'%'};return _0x22fef1;})});}_0x569d9f=_['merge']({},_0x569d9f,_0x5ec5d4[_0x9470('0x45')]);return _0x464660[_0x9470('0x4d')](_0x569d9f);}})['then'](function(_0x2f44e6){if(_0x2f44e6){_0x2e672e=_0x2f44e6[_0x9470('0x36')];if(!_0x5ec5d4[_0x9470('0x32')][_0x9470('0x37')]('nolimit')){_0x569d9f['limit']=qs[_0x9470('0x39')](_0x5ec5d4[_0x9470('0x32')][_0x9470('0x39')]);_0x569d9f[_0x9470('0x3a')]=qs[_0x9470('0x3a')](_0x5ec5d4[_0x9470('0x32')][_0x9470('0x3a')]);}return _0x464660['getFields'](_0x569d9f);}})['then'](function(_0x3ad1d2){if(_0x3ad1d2){return _0x3ad1d2?{'count':_0x2e672e,'rows':_0x3ad1d2}:null;}})[_0x9470('0x14')](respondWithResult(_0x373d72,null))[_0x9470('0x1d')](handleError(_0x373d72,null));};exports['getSubjects']=function(_0x2674c7,_0x1f854c,_0x35abec){var _0x3d7950={};var _0x3fc3ee={};var _0x29ec0a;var _0xf1d1b6;return db['SugarcrmConfiguration'][_0x9470('0x49')]({'where':{'id':_0x2674c7[_0x9470('0x44')]['id']}})[_0x9470('0x14')](handleEntityNotFound(_0x1f854c,null))[_0x9470('0x14')](function(_0x250de9){if(_0x250de9){_0x29ec0a=_0x250de9;_0x3fc3ee[_0x9470('0x31')]=_[_0x9470('0x4a')](db['SugarcrmField'][_0x9470('0x2e')]);_0x3fc3ee[_0x9470('0x32')]=_['keys'](_0x2674c7[_0x9470('0x32')]);_0x3fc3ee['filters']=_[_0x9470('0x33')](_0x3fc3ee[_0x9470('0x31')],_0x3fc3ee['query']);_0x3d7950['attributes']=_[_0x9470('0x33')](_0x3fc3ee[_0x9470('0x31')],qs[_0x9470('0x35')](_0x2674c7[_0x9470('0x32')]['fields']));_0x3d7950['attributes']=_0x3d7950[_0x9470('0x34')][_0x9470('0x36')]?_0x3d7950[_0x9470('0x34')]:_0x3fc3ee['model'];_0x3d7950[_0x9470('0x3b')]=qs['sort'](_0x2674c7[_0x9470('0x32')][_0x9470('0x3c')]);_0x3d7950[_0x9470('0x3d')]=qs[_0x9470('0x4b')](_[_0x9470('0x4c')](_0x2674c7['query'],_0x3fc3ee[_0x9470('0x4b')]));if(_0x2674c7[_0x9470('0x32')][_0x9470('0x3e')]){_0x3d7950['where']=_['merge'](_0x3d7950[_0x9470('0x3d')],{'$or':_[_0x9470('0x2c')](_0x3d7950['attributes'],function(_0xa6c301){var _0x422faf={};_0x422faf[_0xa6c301]={'$like':'%'+_0x2674c7[_0x9470('0x32')][_0x9470('0x3e')]+'%'};return _0x422faf;})});}_0x3d7950=_[_0x9470('0x3f')]({},_0x3d7950,_0x2674c7[_0x9470('0x45')]);return _0x29ec0a[_0x9470('0x4e')](_0x3d7950);}})[_0x9470('0x14')](function(_0x14db55){if(_0x14db55){_0xf1d1b6=_0x14db55[_0x9470('0x36')];if(!_0x2674c7[_0x9470('0x32')][_0x9470('0x37')](_0x9470('0x38'))){_0x3d7950[_0x9470('0x39')]=qs[_0x9470('0x39')](_0x2674c7[_0x9470('0x32')]['limit']);_0x3d7950[_0x9470('0x3a')]=qs[_0x9470('0x3a')](_0x2674c7['query'][_0x9470('0x3a')]);}return _0x29ec0a[_0x9470('0x4e')](_0x3d7950);}})[_0x9470('0x14')](function(_0x24ae61){if(_0x24ae61){return _0x24ae61?{'count':_0xf1d1b6,'rows':_0x24ae61}:null;}})['then'](respondWithResult(_0x1f854c,null))['catch'](handleError(_0x1f854c,null));};exports[_0x9470('0x4f')]=function(_0x3a1194,_0x2ea768,_0x156943){var _0x883d26={};var _0x70e79a={};var _0x405cd1;var _0x118e3d;return db[_0x9470('0x2d')][_0x9470('0x49')]({'where':{'id':_0x3a1194[_0x9470('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ea768,null))[_0x9470('0x14')](function(_0x5ef573){if(_0x5ef573){_0x405cd1=_0x5ef573;_0x70e79a[_0x9470('0x31')]=_[_0x9470('0x4a')](db['SugarcrmField'][_0x9470('0x2e')]);_0x70e79a[_0x9470('0x32')]=_[_0x9470('0x4a')](_0x3a1194[_0x9470('0x32')]);_0x70e79a['filters']=_[_0x9470('0x33')](_0x70e79a[_0x9470('0x31')],_0x70e79a[_0x9470('0x32')]);_0x883d26[_0x9470('0x34')]=_[_0x9470('0x33')](_0x70e79a[_0x9470('0x31')],qs[_0x9470('0x35')](_0x3a1194['query'][_0x9470('0x35')]));_0x883d26['attributes']=_0x883d26[_0x9470('0x34')][_0x9470('0x36')]?_0x883d26[_0x9470('0x34')]:_0x70e79a[_0x9470('0x31')];_0x883d26[_0x9470('0x3b')]=qs[_0x9470('0x3c')](_0x3a1194['query'][_0x9470('0x3c')]);_0x883d26[_0x9470('0x3d')]=qs[_0x9470('0x4b')](_['pick'](_0x3a1194['query'],_0x70e79a[_0x9470('0x4b')]));if(_0x3a1194['query'][_0x9470('0x3e')]){_0x883d26[_0x9470('0x3d')]=_[_0x9470('0x3f')](_0x883d26['where'],{'$or':_[_0x9470('0x2c')](_0x883d26[_0x9470('0x34')],function(_0x5caf92){var _0x4aae10={};_0x4aae10[_0x5caf92]={'$like':'%'+_0x3a1194[_0x9470('0x32')][_0x9470('0x3e')]+'%'};return _0x4aae10;})});}_0x883d26=_['merge']({},_0x883d26,_0x3a1194[_0x9470('0x45')]);return _0x405cd1[_0x9470('0x4f')](_0x883d26);}})[_0x9470('0x14')](function(_0x271038){if(_0x271038){_0x118e3d=_0x271038[_0x9470('0x36')];if(!_0x3a1194['query'][_0x9470('0x37')](_0x9470('0x38'))){_0x883d26[_0x9470('0x39')]=qs[_0x9470('0x39')](_0x3a1194[_0x9470('0x32')][_0x9470('0x39')]);_0x883d26['offset']=qs[_0x9470('0x3a')](_0x3a1194[_0x9470('0x32')]['offset']);}return _0x405cd1[_0x9470('0x4f')](_0x883d26);}})[_0x9470('0x14')](function(_0x309408){if(_0x309408){return _0x309408?{'count':_0x118e3d,'rows':_0x309408}:null;}})[_0x9470('0x14')](respondWithResult(_0x2ea768,null))[_0x9470('0x1d')](handleError(_0x2ea768,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 47d5e90..b65d4bc 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 _0xf115=['../../config/logger','api','moment','request-promise','../../config/environment','exports','define','int_sugarcrm_configurations','lodash','util'];(function(_0x6f2818,_0x1242dd){var _0x21601a=function(_0x5e1ecd){while(--_0x5e1ecd){_0x6f2818['push'](_0x6f2818['shift']());}};_0x21601a(++_0x1242dd);}(_0xf115,0x102));var _0x5f11=function(_0x15a031,_0x3b97e6){_0x15a031=_0x15a031-0x0;var _0x13e635=_0xf115[_0x15a031];return _0x13e635;};'use strict';var _=require(_0x5f11('0x0'));var util=require(_0x5f11('0x1'));var logger=require(_0x5f11('0x2'))(_0x5f11('0x3'));var moment=require(_0x5f11('0x4'));var BPromise=require('bluebird');var rp=require(_0x5f11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f11('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x5f11('0x7')]=function(_0x1a72d6,_0x2d1816){return _0x1a72d6[_0x5f11('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0x5f11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04de=['api','bluebird','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x04de,0x1a2));var _0xe04d=function(_0x191f3d,_0x35e38b){_0x191f3d=_0x191f3d-0x0;var _0x27e26b=_0x04de[_0x191f3d];return _0x27e26b;};'use strict';var _=require('lodash');var util=require(_0xe04d('0x0'));var logger=require(_0xe04d('0x1'))(_0xe04d('0x2'));var moment=require('moment');var BPromise=require(_0xe04d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe04d('0x4'));var attributes=require(_0xe04d('0x5'));module[_0xe04d('0x6')]=function(_0x86572b,_0x561815){return _0x86572b[_0xe04d('0x7')](_0xe04d('0x8'),attributes,{'tableName':_0xe04d('0x9'),'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 5bdd132..99af471 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 _0x1738=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0xc87116,_0x46901d){var _0x12328f=function(_0x56f904){while(--_0x56f904){_0xc87116['push'](_0xc87116['shift']());}};_0x12328f(++_0x46901d);}(_0x1738,0x172));var _0x8173=function(_0x1e2493,_0x58d9c4){_0x1e2493=_0x1e2493-0x0;var _0x5911fd=_0x1738[_0x1e2493];return _0x5911fd;};'use strict';var _=require(_0x8173('0x0'));var util=require('util');var moment=require(_0x8173('0x1'));var BPromise=require(_0x8173('0x2'));var rs=require(_0x8173('0x3'));var fs=require('fs');var Redis=require(_0x8173('0x4'));var db=require(_0x8173('0x5'))['db'];var utils=require(_0x8173('0x6'));var logger=require(_0x8173('0x7'))(_0x8173('0x8'));var config=require('../../config/environment');var jayson=require(_0x8173('0x9'));var client=jayson[_0x8173('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea266,_0x56b19d,_0x15725c){return new BPromise(function(_0x468014,_0x43dc76){return client[_0x8173('0xb')](_0x5ea266,_0x15725c)[_0x8173('0xc')](function(_0xe8ebce){logger['info'](_0x8173('0xd'),_0x56b19d,_0x8173('0xe'));logger[_0x8173('0xf')](_0x8173('0x10'),_0x56b19d,_0x8173('0xe'),JSON[_0x8173('0x11')](_0xe8ebce));if(_0xe8ebce[_0x8173('0x12')]){if(_0xe8ebce[_0x8173('0x12')]['code']===0x1f4){logger[_0x8173('0x12')](_0x8173('0xd'),_0x56b19d,_0xe8ebce[_0x8173('0x12')][_0x8173('0x13')]);return _0x43dc76(_0xe8ebce[_0x8173('0x12')][_0x8173('0x13')]);}logger[_0x8173('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x56b19d,_0xe8ebce['error']['message']);return _0x468014(_0xe8ebce['error'][_0x8173('0x13')]);}else{logger[_0x8173('0x14')](_0x8173('0xd'),_0x56b19d,'request\x20sent');_0x468014(_0xe8ebce['result'][_0x8173('0x13')]);}})[_0x8173('0x15')](function(_0x2c60c0){logger[_0x8173('0x12')](_0x8173('0xd'),_0x56b19d,_0x2c60c0);_0x43dc76(_0x2c60c0);});});} \ No newline at end of file +var _0xc9d3=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xc9d3,0xd2));var _0x3c9d=function(_0x59a8e9,_0x4f022c){_0x59a8e9=_0x59a8e9-0x0;var _0x1ecb3f=_0xc9d3[_0x59a8e9];return _0x1ecb3f;};'use strict';var _=require('lodash');var util=require(_0x3c9d('0x0'));var moment=require('moment');var BPromise=require(_0x3c9d('0x1'));var rs=require(_0x3c9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c9d('0x3'))['db'];var utils=require(_0x3c9d('0x4'));var logger=require(_0x3c9d('0x5'))(_0x3c9d('0x6'));var config=require(_0x3c9d('0x7'));var jayson=require(_0x3c9d('0x8'));var client=jayson[_0x3c9d('0x9')][_0x3c9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235674,_0xe8e447,_0x2617a1){return new BPromise(function(_0xd2624a,_0x57391b){return client[_0x3c9d('0xb')](_0x235674,_0x2617a1)[_0x3c9d('0xc')](function(_0x38a383){logger[_0x3c9d('0xd')](_0x3c9d('0xe'),_0xe8e447,_0x3c9d('0xf'));logger[_0x3c9d('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xe8e447,_0x3c9d('0xf'),JSON[_0x3c9d('0x11')](_0x38a383));if(_0x38a383[_0x3c9d('0x12')]){if(_0x38a383[_0x3c9d('0x12')][_0x3c9d('0x13')]===0x1f4){logger[_0x3c9d('0x12')](_0x3c9d('0xe'),_0xe8e447,_0x38a383[_0x3c9d('0x12')][_0x3c9d('0x14')]);return _0x57391b(_0x38a383[_0x3c9d('0x12')][_0x3c9d('0x14')]);}logger['error'](_0x3c9d('0xe'),_0xe8e447,_0x38a383['error'][_0x3c9d('0x14')]);return _0xd2624a(_0x38a383[_0x3c9d('0x12')][_0x3c9d('0x14')]);}else{logger[_0x3c9d('0xd')](_0x3c9d('0xe'),_0xe8e447,_0x3c9d('0xf'));_0xd2624a(_0x38a383[_0x3c9d('0x15')][_0x3c9d('0x14')]);}})[_0x3c9d('0x16')](function(_0x527e29){logger[_0x3c9d('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe8e447,_0x527e29);_0x57391b(_0x527e29);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 0fabbf4..400a4db 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 _0xd57a=['get','isAuthenticated','index','/:id','show','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x3b2dda,_0x549fe4){var _0x68b1c2=function(_0x11f0e9){while(--_0x11f0e9){_0x3b2dda['push'](_0x3b2dda['shift']());}};_0x68b1c2(++_0x549fe4);}(_0xd57a,0xb2));var _0xad57=function(_0x57e1d8,_0x1fe03d){_0x57e1d8=_0x57e1d8-0x0;var _0x3273fd=_0xd57a[_0x57e1d8];return _0x3273fd;};'use strict';var multer=require(_0xad57('0x0'));var util=require(_0xad57('0x1'));var path=require(_0xad57('0x2'));var timeout=require(_0xad57('0x3'));var express=require(_0xad57('0x4'));var router=express[_0xad57('0x5')]();var auth=require(_0xad57('0x6'));var interaction=require(_0xad57('0x7'));var config=require('../../config/environment');var controller=require(_0xad57('0x8'));router[_0xad57('0x9')]('/',auth[_0xad57('0xa')](),controller[_0xad57('0xb')]);router[_0xad57('0x9')](_0xad57('0xc'),auth[_0xad57('0xa')](),controller[_0xad57('0xd')]);router['post']('/',auth[_0xad57('0xa')](),controller[_0xad57('0xe')]);router[_0xad57('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xad57('0x10')]);router['delete'](_0xad57('0xc'),auth[_0xad57('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbd36=['connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2ccc23,_0x293455){var _0x4b9c76=function(_0x59ff31){while(--_0x59ff31){_0x2ccc23['push'](_0x2ccc23['shift']());}};_0x4b9c76(++_0x293455);}(_0xbd36,0x177));var _0x6bd3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xbd36[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var path=require(_0x6bd3('0x2'));var timeout=require(_0x6bd3('0x3'));var express=require(_0x6bd3('0x4'));var router=express[_0x6bd3('0x5')]();var auth=require(_0x6bd3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x6bd3('0x7')]('/',auth[_0x6bd3('0x8')](),controller[_0x6bd3('0x9')]);router['get'](_0x6bd3('0xa'),auth[_0x6bd3('0x8')](),controller[_0x6bd3('0xb')]);router[_0x6bd3('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6bd3('0xd')](_0x6bd3('0xa'),auth['isAuthenticated'](),controller[_0x6bd3('0xe')]);router[_0x6bd3('0xf')](_0x6bd3('0xa'),auth[_0x6bd3('0x8')](),controller[_0x6bd3('0x10')]);module[_0x6bd3('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 f1ee886..755e66a 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 _0xca74=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xca74,0x170));var _0x4ca7=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0xca74[_0x3585fb];return _0x48fb79;};'use strict';var Sequelize=require(_0x4ca7('0x0'));module['exports']={'type':{'type':Sequelize[_0x4ca7('0x1')](_0x4ca7('0x2'),_0x4ca7('0x3'),_0x4ca7('0x4'),_0x4ca7('0x5')),'defaultValue':_0x4ca7('0x2')},'content':{'type':Sequelize[_0x4ca7('0x6')]},'key':{'type':Sequelize[_0x4ca7('0x6')]},'keyType':{'type':Sequelize[_0x4ca7('0x1')](_0x4ca7('0x2'),_0x4ca7('0x3'),_0x4ca7('0x4'))},'keyContent':{'type':Sequelize[_0x4ca7('0x6')]},'idField':{'type':Sequelize[_0x4ca7('0x6')]},'nameField':{'type':Sequelize[_0x4ca7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0683=['BOOLEAN','exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x2be63e,_0x4f5a96){var _0x405910=function(_0x3eb2c5){while(--_0x3eb2c5){_0x2be63e['push'](_0x2be63e['shift']());}};_0x405910(++_0x4f5a96);}(_0x0683,0xe1));var _0x3068=function(_0x1edb33,_0x24efac){_0x1edb33=_0x1edb33-0x0;var _0x680d46=_0x0683[_0x1edb33];return _0x680d46;};'use strict';var Sequelize=require('sequelize');module[_0x3068('0x0')]={'type':{'type':Sequelize['ENUM'](_0x3068('0x1'),_0x3068('0x2'),'customVariable',_0x3068('0x3')),'defaultValue':_0x3068('0x1')},'content':{'type':Sequelize[_0x3068('0x4')]},'key':{'type':Sequelize[_0x3068('0x4')]},'keyType':{'type':Sequelize[_0x3068('0x5')](_0x3068('0x1'),'variable',_0x3068('0x6'))},'keyContent':{'type':Sequelize[_0x3068('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3068('0x4')]},'customField':{'type':Sequelize[_0x3068('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3068('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d1840e3..1327259 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 _0x687b=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','rawAttributes','length','create','body','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','SugarcrmField','type','key'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x687b,0x14a));var _0xb687=function(_0x1b3a9e,_0x3b6e29){_0x1b3a9e=_0x1b3a9e-0x0;var _0x53cdc2=_0x687b[_0x1b3a9e];return _0x53cdc2;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=_0x141375['count'],_0x2c7a18=_0x30622f[_0xb687('0x1f')],_0x25124a=_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x20')],_0x19bb29;if(_0x25124a>=_0x263085){_0x25124a=_0x263085;_0x19bb29=0xc8;}else{_0x19bb29=0xce;}_0x3ab914['status'](_0x19bb29);return _0x3ab914['set'](_0xb687('0x21'),_0x2c7a18+'-'+_0x25124a+'/'+_0x263085)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x19ee14){return function(_0x4b593b){try{jsonpatch[_0xb687('0x22')](_0x4b593b,_0x19ee14,!![]);}catch(_0x481f1d){return BPromise[_0xb687('0x23')](_0x481f1d);}return _0x4b593b[_0xb687('0x24')]();};}function saveUpdates(_0x170dc0,_0x44bd0b){return function(_0x49d5a1){if(_0x49d5a1){return _0x49d5a1[_0xb687('0x25')](_0x170dc0)['then'](function(_0x335541){return _0x335541;});}return null;};}function removeEntity(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x26')]()[_0xb687('0x27')](function(){_0x90e892[_0xb687('0x1d')](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0xbf6c58,_0x38866c){return function(_0xf48ba4){if(!_0xf48ba4){_0xbf6c58[_0xb687('0x1c')](0x194);}return _0xf48ba4;};}function handleError(_0x57cd51,_0xf45db0){_0xf45db0=_0xf45db0||0x1f4;return function(_0x129347){logger[_0xb687('0x29')](_0x129347[_0xb687('0x2a')]);if(_0x129347[_0xb687('0x2b')]){delete _0x129347[_0xb687('0x2b')];}_0x57cd51[_0xb687('0x1d')](_0xf45db0)[_0xb687('0x2c')](_0x129347);};}exports[_0xb687('0x2d')]=function(_0x2e6185,_0x4a61ec){var _0x3712cf={},_0x192966={},_0x392721={'count':0x0,'rows':[]};var _0x265a4b=_[_0xb687('0x2e')](db[_0xb687('0x2f')]['rawAttributes'],function(_0x28b69a){return{'name':_0x28b69a['fieldName'],'type':_0x28b69a[_0xb687('0x30')][_0xb687('0x31')]};});_0x192966[_0xb687('0x32')]=_[_0xb687('0x2e')](_0x265a4b,_0xb687('0x2b'));_0x192966[_0xb687('0x33')]=_[_0xb687('0x34')](_0x2e6185['query']);_0x192966[_0xb687('0x35')]=_[_0xb687('0x36')](_0x192966[_0xb687('0x32')],_0x192966[_0xb687('0x33')]);_0x3712cf[_0xb687('0x37')]=_[_0xb687('0x36')](_0x192966[_0xb687('0x32')],qs[_0xb687('0x38')](_0x2e6185[_0xb687('0x33')][_0xb687('0x38')]));_0x3712cf[_0xb687('0x37')]=_0x3712cf['attributes']['length']?_0x3712cf[_0xb687('0x37')]:_0x192966[_0xb687('0x32')];if(!_0x2e6185[_0xb687('0x33')][_0xb687('0x39')]('nolimit')){_0x3712cf['limit']=qs[_0xb687('0x20')](_0x2e6185[_0xb687('0x33')]['limit']);_0x3712cf[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e6185['query'][_0xb687('0x1f')]);}_0x3712cf['order']=qs[_0xb687('0x3a')](_0x2e6185[_0xb687('0x33')][_0xb687('0x3a')]);_0x3712cf[_0xb687('0x3b')]=qs[_0xb687('0x35')](_[_0xb687('0x3c')](_0x2e6185['query'],_0x192966[_0xb687('0x35')]),_0x265a4b);if(_0x2e6185[_0xb687('0x33')][_0xb687('0x3d')]){_0x3712cf[_0xb687('0x3b')]=_['merge'](_0x3712cf[_0xb687('0x3b')],{'$or':_[_0xb687('0x2e')](_0x265a4b,function(_0x1f1c88){if(_0x1f1c88[_0xb687('0x30')]!==_0xb687('0x3e')){var _0x58c214={};_0x58c214[_0x1f1c88[_0xb687('0x2b')]]={'$like':'%'+_0x2e6185[_0xb687('0x33')][_0xb687('0x3d')]+'%'};return _0x58c214;}})});}_0x3712cf=_[_0xb687('0x3f')]({},_0x3712cf,_0x2e6185[_0xb687('0x40')]);var _0x29cf09={'where':_0x3712cf['where']};return db['SugarcrmField'][_0xb687('0x41')](_0x29cf09)['then'](function(_0x1f919f){_0x392721[_0xb687('0x41')]=_0x1f919f;if(_0x2e6185['query'][_0xb687('0x42')]){_0x3712cf[_0xb687('0x43')]=[{'all':!![]}];}return db['SugarcrmField'][_0xb687('0x44')](_0x3712cf);})[_0xb687('0x27')](function(_0x127b25){_0x392721['rows']=_0x127b25;return _0x392721;})[_0xb687('0x27')](respondWithFilteredResult(_0x4a61ec,_0x3712cf))[_0xb687('0x45')](handleError(_0x4a61ec,null));};exports[_0xb687('0x46')]=function(_0x75102a,_0x140388){var _0x1375f7={'raw':!![],'where':{'id':_0x75102a['params']['id']}},_0x21b9ef={};_0x21b9ef[_0xb687('0x32')]=_['keys'](db['SugarcrmField'][_0xb687('0x47')]);_0x21b9ef[_0xb687('0x33')]=_['keys'](_0x75102a[_0xb687('0x33')]);_0x21b9ef['filters']=_[_0xb687('0x36')](_0x21b9ef[_0xb687('0x32')],_0x21b9ef['query']);_0x1375f7[_0xb687('0x37')]=_[_0xb687('0x36')](_0x21b9ef['model'],qs[_0xb687('0x38')](_0x75102a[_0xb687('0x33')][_0xb687('0x38')]));_0x1375f7[_0xb687('0x37')]=_0x1375f7[_0xb687('0x37')][_0xb687('0x48')]?_0x1375f7[_0xb687('0x37')]:_0x21b9ef[_0xb687('0x32')];if(_0x75102a[_0xb687('0x33')][_0xb687('0x42')]){_0x1375f7[_0xb687('0x43')]=[{'all':!![]}];}_0x1375f7=_[_0xb687('0x3f')]({},_0x1375f7,_0x75102a['options']);return db[_0xb687('0x2f')]['find'](_0x1375f7)[_0xb687('0x27')](handleEntityNotFound(_0x140388,null))[_0xb687('0x27')](respondWithResult(_0x140388,null))[_0xb687('0x45')](handleError(_0x140388,null));};exports[_0xb687('0x49')]=function(_0x113b76,_0x3ff178){return db['SugarcrmField']['create'](_0x113b76[_0xb687('0x4a')],{})[_0xb687('0x27')](respondWithResult(_0x3ff178,0xc9))[_0xb687('0x45')](handleError(_0x3ff178,null));};exports[_0xb687('0x25')]=function(_0x4f5736,_0x3b5f2d){if(_0x4f5736[_0xb687('0x4a')]['id']){delete _0x4f5736[_0xb687('0x4a')]['id'];}return db[_0xb687('0x2f')]['find']({'where':{'id':_0x4f5736[_0xb687('0x4b')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x3b5f2d,null))[_0xb687('0x27')](saveUpdates(_0x4f5736[_0xb687('0x4a')],null))['then'](respondWithResult(_0x3b5f2d,null))['catch'](handleError(_0x3b5f2d,null));};exports[_0xb687('0x26')]=function(_0x170b26,_0x42b61a){return db['SugarcrmField']['find']({'where':{'id':_0x170b26[_0xb687('0x4b')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x42b61a,null))[_0xb687('0x27')](removeEntity(_0x42b61a,null))[_0xb687('0x45')](handleError(_0x42b61a,null));}; \ No newline at end of file +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(_0x4c0c12,_0x3a1a7c){var _0xa008f4=function(_0x40e6f4){while(--_0x40e6f4){_0x4c0c12['push'](_0x4c0c12['shift']());}};_0xa008f4(++_0x3a1a7c);}(_0x31f0,0xb7));var _0x031f=function(_0x5205e1,_0x2e73dc){_0x5205e1=_0x5205e1-0x0;var _0x741b3a=_0x31f0[_0x5205e1];return _0x741b3a;};'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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 27604c2..edc0545 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 _0x8e06=['bluebird','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x458381,_0x3cfb98){var _0x4aaf32=function(_0x414153){while(--_0x414153){_0x458381['push'](_0x458381['shift']());}};_0x4aaf32(++_0x3cfb98);}(_0x8e06,0x1a0));var _0x68e0=function(_0x531489,_0x22e26d){_0x531489=_0x531489-0x0;var _0x577894=_0x8e06[_0x531489];return _0x577894;};'use strict';var _=require(_0x68e0('0x0'));var util=require(_0x68e0('0x1'));var logger=require(_0x68e0('0x2'))(_0x68e0('0x3'));var moment=require('moment');var BPromise=require(_0x68e0('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(_0x68e0('0x5'));module[_0x68e0('0x6')]=function(_0x3e5069,_0x393e14){return _0x3e5069['define'](_0x68e0('0x7'),attributes,{'tableName':_0x68e0('0x8'),'paranoid':![],'indexes':[{'name':_0x68e0('0x9'),'fields':[_0x68e0('0xa'),_0x68e0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x154a=['define','SugarcrmField','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x114984,_0x5c9593){var _0x44822b=function(_0x10af37){while(--_0x10af37){_0x114984['push'](_0x114984['shift']());}};_0x44822b(++_0x5c9593);}(_0x154a,0xe0));var _0xa154=function(_0x41b58b,_0x2e207b){_0x41b58b=_0x41b58b-0x0;var _0x551b4c=_0x154a[_0x41b58b];return _0x551b4c;};'use strict';var _=require(_0xa154('0x0'));var util=require(_0xa154('0x1'));var logger=require(_0xa154('0x2'))(_0xa154('0x3'));var moment=require(_0xa154('0x4'));var BPromise=require(_0xa154('0x5'));var rp=require(_0xa154('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa154('0x7'));var attributes=require(_0xa154('0x8'));module[_0xa154('0x9')]=function(_0x57a1bd,_0x4a066b){return _0x57a1bd[_0xa154('0xa')](_0xa154('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xa154('0xc'),'FieldId'],'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 edabcf9..f6b53de 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash'];(function(_0x4da8e4,_0x6bd1bb){var _0x1b9ff6=function(_0x20b6f1){while(--_0x20b6f1){_0x4da8e4['push'](_0x4da8e4['shift']());}};_0x1b9ff6(++_0x6bd1bb);}(_0x66fa,0x117));var _0xa66f=function(_0x1951ec,_0x1d9d8b){_0x1951ec=_0x1951ec-0x0;var _0x8e487d=_0x66fa[_0x1951ec];return _0x8e487d;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x4f7ca7,_0x5099e7){var _0x55f6b0=function(_0x368838){while(--_0x368838){_0x4f7ca7['push'](_0x4f7ca7['shift']());}};_0x55f6b0(++_0x5099e7);}(_0xda2d,0x102));var _0xdda2=function(_0x46e0f5,_0x2b893c){_0x46e0f5=_0x46e0f5-0x0;var _0x4ddf32=_0xda2d[_0x46e0f5];return _0x4ddf32;};'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']('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ff6bf60..9c4828e 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 _0x36bd=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields'];(function(_0x2802cb,_0xffbd53){var _0x26f518=function(_0x482a51){while(--_0x482a51){_0x2802cb['push'](_0x2802cb['shift']());}};_0x26f518(++_0xffbd53);}(_0x36bd,0x179));var _0xd36b=function(_0x547093,_0x1cc18d){_0x547093=_0x547093-0x0;var _0x3d5d79=_0x36bd[_0x547093];return _0x3d5d79;};'use strict';var multer=require(_0xd36b('0x0'));var util=require(_0xd36b('0x1'));var path=require('path');var timeout=require(_0xd36b('0x2'));var express=require(_0xd36b('0x3'));var router=express[_0xd36b('0x4')]();var auth=require(_0xd36b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd36b('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xd36b('0x7')]('/',auth[_0xd36b('0x8')](),controller[_0xd36b('0x9')]);router[_0xd36b('0x7')](_0xd36b('0xa'),auth[_0xd36b('0x8')](),controller[_0xd36b('0xb')]);router[_0xd36b('0x7')](_0xd36b('0xc'),auth[_0xd36b('0x8')](),controller['getConfigurations']);router['get'](_0xd36b('0xd'),auth[_0xd36b('0x8')](),controller[_0xd36b('0xe')]);router[_0xd36b('0xf')]('/',auth[_0xd36b('0x8')](),controller[_0xd36b('0x10')]);router[_0xd36b('0xf')]('/:id/configurations',auth[_0xd36b('0x8')](),controller[_0xd36b('0x11')]);router[_0xd36b('0x12')](_0xd36b('0xa'),auth['isAuthenticated'](),controller[_0xd36b('0x13')]);router[_0xd36b('0x14')](_0xd36b('0xa'),auth[_0xd36b('0x8')](),controller[_0xd36b('0x15')]);module[_0xd36b('0x16')]=router; \ No newline at end of file +var _0x7d7b=['exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','destroy'];(function(_0x2ab7a1,_0x2b3fae){var _0x623eb7=function(_0x239b0e){while(--_0x239b0e){_0x2ab7a1['push'](_0x2ab7a1['shift']());}};_0x623eb7(++_0x2b3fae);}(_0x7d7b,0xd3));var _0xb7d7=function(_0x470d23,_0x4b6b3b){_0x470d23=_0x470d23-0x0;var _0x71fede=_0x7d7b[_0x470d23];return _0x71fede;};'use strict';var multer=require('multer');var util=require(_0xb7d7('0x0'));var path=require(_0xb7d7('0x1'));var timeout=require(_0xb7d7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb7d7('0x3'));var interaction=require(_0xb7d7('0x4'));var config=require(_0xb7d7('0x5'));var controller=require(_0xb7d7('0x6'));router[_0xb7d7('0x7')]('/',auth[_0xb7d7('0x8')](),controller[_0xb7d7('0x9')]);router[_0xb7d7('0x7')](_0xb7d7('0xa'),auth[_0xb7d7('0x8')](),controller[_0xb7d7('0xb')]);router['get'](_0xb7d7('0xc'),auth['isAuthenticated'](),controller[_0xb7d7('0xd')]);router['get'](_0xb7d7('0xe'),auth['isAuthenticated'](),controller[_0xb7d7('0xf')]);router[_0xb7d7('0x10')]('/',auth[_0xb7d7('0x8')](),controller[_0xb7d7('0x11')]);router[_0xb7d7('0x10')](_0xb7d7('0xc'),auth[_0xb7d7('0x8')](),controller['addConfiguration']);router['put'](_0xb7d7('0xa'),auth[_0xb7d7('0x8')](),controller[_0xb7d7('0x12')]);router['delete'](_0xb7d7('0xa'),auth[_0xb7d7('0x8')](),controller[_0xb7d7('0x13')]);module[_0xb7d7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5eca86e..073e339 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 _0x5ebc=['HelpDesk','exports','STRING'];(function(_0xf15be4,_0x2c2591){var _0x2b6849=function(_0x544282){while(--_0x544282){_0xf15be4['push'](_0xf15be4['shift']());}};_0x2b6849(++_0x2c2591);}(_0x5ebc,0x103));var _0xc5eb=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x5ebc[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require('sequelize');module[_0xc5eb('0x0')]={'name':{'type':Sequelize[_0xc5eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc5eb('0x1')]},'username':{'type':Sequelize[_0xc5eb('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc5eb('0x1')],'allowNull':![],'defaultValue':_0xc5eb('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc5eb('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc5eb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x74b0=['sequelize','STRING','HelpDesk'];(function(_0x44312d,_0x29fde7){var _0x3de785=function(_0xf0964a){while(--_0xf0964a){_0x44312d['push'](_0x44312d['shift']());}};_0x3de785(++_0x29fde7);}(_0x74b0,0x13b));var _0x074b=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0x74b0[_0x4200e3];return _0x26ac37;};'use strict';var Sequelize=require(_0x074b('0x0'));module['exports']={'name':{'type':Sequelize[_0x074b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x074b('0x1')]},'username':{'type':Sequelize[_0x074b('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x074b('0x2')},'remoteUri':{'type':Sequelize[_0x074b('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x074b('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index dcfd226..59d9e6d 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 _0x029b=['request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','destroy','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','VtigerAccount','include','findAll','rows','show','params','length','includeAll','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','description','serverUrl','accessKey','remoteUri','slice','substring','format','GET','getchallenge','username','POST','login','token','success','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http'];(function(_0x456693,_0x5294b4){var _0x2804b7=function(_0x38debd){while(--_0x38debd){_0x456693['push'](_0x456693['shift']());}};_0x2804b7(++_0x5294b4);}(_0x029b,0x66));var _0xb029=function(_0x2cdf2f,_0x207216){_0x2cdf2f=_0x2cdf2f-0x0;var _0x24621d=_0x029b[_0x2cdf2f];return _0x24621d;};'use strict';var pdf=require(_0xb029('0x0'));var emlformat=require(_0xb029('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb029('0x2'));var jsonpatch=require(_0xb029('0x3'));var rp=require('request-promise');var moment=require(_0xb029('0x4'));var BPromise=require(_0xb029('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb029('0x6'));var sox=require(_0xb029('0x7'));var csv=require(_0xb029('0x8'));var ejs=require(_0xb029('0x9'));var fs=require('fs');var _=require(_0xb029('0xa'));var squel=require('squel');var crypto=require(_0xb029('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb029('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb029('0xd'));var Papa=require('papaparse');var Redis=require(_0xb029('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb029('0xf'));var as=require(_0xb029('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb029('0x11'))(_0xb029('0x12'));var utils=require(_0xb029('0x13'));var config=require(_0xb029('0x14'));var licenseUtil=require(_0xb029('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb029('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xb029('0x17')][_0xb029('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x18e228,_0x8dfbf1,_0x5ce391,_0x337ab5){return new BPromise(function(_0x356552,_0xe31318){var _0x5ec510=_0x337ab5||client;return _0x5ec510[_0xb029('0x19')](_0x18e228,_0x5ce391)[_0xb029('0x1a')](function(_0x379fdb){logger[_0xb029('0x1b')](_0xb029('0x1c'),_0x8dfbf1,_0xb029('0x1d'));logger[_0xb029('0x1e')](_0xb029('0x1f'),_0x8dfbf1,_0xb029('0x1d'),JSON['stringify'](_0x379fdb));if(_0x379fdb['error']){if(_0x379fdb[_0xb029('0x20')]['code']===0x1f4){logger[_0xb029('0x20')](_0xb029('0x1c'),_0x8dfbf1,_0x379fdb[_0xb029('0x20')]['message']);return _0xe31318(_0x379fdb['error'][_0xb029('0x21')]);}logger[_0xb029('0x20')](_0xb029('0x1c'),_0x8dfbf1,_0x379fdb[_0xb029('0x20')][_0xb029('0x21')]);return _0x356552(_0x379fdb[_0xb029('0x20')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x8dfbf1,'request\x20sent');_0x356552(_0x379fdb[_0xb029('0x22')][_0xb029('0x21')]);}})[_0xb029('0x23')](function(_0x4201f4){logger['error'](_0xb029('0x1c'),_0x8dfbf1,_0x4201f4);_0xe31318(_0x4201f4);});});}function respondWithStatusCode(_0x379ef3,_0x42b91e){_0x42b91e=_0x42b91e||0xcc;return function(_0x8116f9){if(_0x8116f9){return _0x379ef3[_0xb029('0x24')](_0x42b91e);}return _0x379ef3[_0xb029('0x25')](_0x42b91e)[_0xb029('0x26')]();};}function respondWithResult(_0x3eb5ac,_0x147ad0){_0x147ad0=_0x147ad0||0xc8;return function(_0x3671e6){if(_0x3671e6){return _0x3eb5ac[_0xb029('0x25')](_0x147ad0)[_0xb029('0x27')](_0x3671e6);}};}function respondWithFilteredResult(_0x279e4a,_0x599a14){return function(_0x457a24){if(_0x457a24){var _0x2eb298=_0x457a24[_0xb029('0x28')],_0x47f874=_0x599a14[_0xb029('0x29')],_0x4fd06e=_0x599a14[_0xb029('0x29')]+_0x599a14[_0xb029('0x2a')],_0x112ce9;if(_0x4fd06e>=_0x2eb298){_0x4fd06e=_0x2eb298;_0x112ce9=0xc8;}else{_0x112ce9=0xce;}_0x279e4a['status'](_0x112ce9);return _0x279e4a[_0xb029('0x2b')]('Content-Range',_0x47f874+'-'+_0x4fd06e+'/'+_0x2eb298)[_0xb029('0x27')](_0x457a24);}return null;};}function patchUpdates(_0x6960fb){return function(_0x3381a2){try{jsonpatch['apply'](_0x3381a2,_0x6960fb,!![]);}catch(_0x1aa94b){return BPromise[_0xb029('0x2c')](_0x1aa94b);}return _0x3381a2['save']();};}function saveUpdates(_0x236217,_0x4d9e7e){return function(_0x1ee866){if(_0x1ee866){return _0x1ee866['update'](_0x236217)[_0xb029('0x1a')](function(_0x3b0bfe){return _0x3b0bfe;});}return null;};}function removeEntity(_0x392d0f,_0x2324f3){return function(_0x2812b7){if(_0x2812b7){return _0x2812b7[_0xb029('0x2d')]()[_0xb029('0x1a')](function(){_0x392d0f[_0xb029('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d87c1,_0x2bb739){return function(_0x130663){if(!_0x130663){_0x2d87c1['sendStatus'](0x194);}return _0x130663;};}function handleError(_0x4390e4,_0x2b0f6b){_0x2b0f6b=_0x2b0f6b||0x1f4;return function(_0x5f4688){logger[_0xb029('0x20')](_0x5f4688['stack']);if(_0x5f4688[_0xb029('0x2e')]){delete _0x5f4688['name'];}_0x4390e4[_0xb029('0x25')](_0x2b0f6b)[_0xb029('0x2f')](_0x5f4688);};}exports[_0xb029('0x30')]=function(_0xae3440,_0x142eb5){var _0x12f8bf={},_0x2c589e={},_0x5a1d11={'count':0x0,'rows':[]};var _0x11663c=_[_0xb029('0x31')](db['VtigerAccount'][_0xb029('0x32')],function(_0x3d773b){return{'name':_0x3d773b[_0xb029('0x33')],'type':_0x3d773b[_0xb029('0x34')]['key']};});_0x2c589e[_0xb029('0x35')]=_[_0xb029('0x31')](_0x11663c,_0xb029('0x2e'));_0x2c589e['query']=_[_0xb029('0x36')](_0xae3440[_0xb029('0x37')]);_0x2c589e[_0xb029('0x38')]=_[_0xb029('0x39')](_0x2c589e[_0xb029('0x35')],_0x2c589e[_0xb029('0x37')]);_0x12f8bf[_0xb029('0x3a')]=_[_0xb029('0x39')](_0x2c589e[_0xb029('0x35')],qs[_0xb029('0x3b')](_0xae3440['query'][_0xb029('0x3b')]));_0x12f8bf[_0xb029('0x3a')]=_0x12f8bf[_0xb029('0x3a')]['length']?_0x12f8bf['attributes']:_0x2c589e['model'];if(!_0xae3440[_0xb029('0x37')][_0xb029('0x3c')]('nolimit')){_0x12f8bf[_0xb029('0x2a')]=qs[_0xb029('0x2a')](_0xae3440[_0xb029('0x37')][_0xb029('0x2a')]);_0x12f8bf[_0xb029('0x29')]=qs['offset'](_0xae3440[_0xb029('0x37')][_0xb029('0x29')]);}_0x12f8bf['order']=qs[_0xb029('0x3d')](_0xae3440[_0xb029('0x37')][_0xb029('0x3d')]);_0x12f8bf['where']=qs[_0xb029('0x38')](_[_0xb029('0x3e')](_0xae3440['query'],_0x2c589e['filters']),_0x11663c);if(_0xae3440[_0xb029('0x37')][_0xb029('0x3f')]){_0x12f8bf[_0xb029('0x40')]=_[_0xb029('0x41')](_0x12f8bf['where'],{'$or':_['map'](_0x11663c,function(_0xa83aa5){if(_0xa83aa5['type']!==_0xb029('0x42')){var _0x4c732e={};_0x4c732e[_0xa83aa5[_0xb029('0x2e')]]={'$like':'%'+_0xae3440[_0xb029('0x37')][_0xb029('0x3f')]+'%'};return _0x4c732e;}})});}_0x12f8bf=_[_0xb029('0x41')]({},_0x12f8bf,_0xae3440[_0xb029('0x43')]);var _0xd1a5e9={'where':_0x12f8bf['where']};return db[_0xb029('0x44')]['count'](_0xd1a5e9)['then'](function(_0x2dde2e){_0x5a1d11['count']=_0x2dde2e;if(_0xae3440[_0xb029('0x37')]['includeAll']){_0x12f8bf[_0xb029('0x45')]=[{'all':!![]}];}return db[_0xb029('0x44')][_0xb029('0x46')](_0x12f8bf);})[_0xb029('0x1a')](function(_0x4bab51){_0x5a1d11[_0xb029('0x47')]=_0x4bab51;return _0x5a1d11;})[_0xb029('0x1a')](respondWithFilteredResult(_0x142eb5,_0x12f8bf))[_0xb029('0x23')](handleError(_0x142eb5,null));};exports[_0xb029('0x48')]=function(_0x370b39,_0x45c164){var _0x1a01cf={'raw':![],'where':{'id':_0x370b39[_0xb029('0x49')]['id']}},_0x331275={};_0x331275[_0xb029('0x35')]=_['keys'](db[_0xb029('0x44')][_0xb029('0x32')]);_0x331275[_0xb029('0x37')]=_[_0xb029('0x36')](_0x370b39['query']);_0x331275[_0xb029('0x38')]=_['intersection'](_0x331275[_0xb029('0x35')],_0x331275[_0xb029('0x37')]);_0x1a01cf[_0xb029('0x3a')]=_[_0xb029('0x39')](_0x331275[_0xb029('0x35')],qs['fields'](_0x370b39['query'][_0xb029('0x3b')]));_0x1a01cf[_0xb029('0x3a')]=_0x1a01cf[_0xb029('0x3a')][_0xb029('0x4a')]?_0x1a01cf[_0xb029('0x3a')]:_0x331275[_0xb029('0x35')];if(_0x370b39['query'][_0xb029('0x4b')]){_0x1a01cf[_0xb029('0x45')]=[{'all':!![]}];}_0x1a01cf=_[_0xb029('0x41')]({},_0x1a01cf,_0x370b39['options']);return db['VtigerAccount'][_0xb029('0x4c')](_0x1a01cf)['then'](handleEntityNotFound(_0x45c164,null))[_0xb029('0x1a')](respondWithResult(_0x45c164,null))[_0xb029('0x23')](handleError(_0x45c164,null));};exports[_0xb029('0x4d')]=function(_0x4a3326,_0x4489e0){return db[_0xb029('0x44')]['create'](_0x4a3326[_0xb029('0x4e')],{})[_0xb029('0x1a')](respondWithResult(_0x4489e0,0xc9))[_0xb029('0x23')](handleError(_0x4489e0,null));};exports['update']=function(_0xd39d35,_0x43dcc9){if(_0xd39d35[_0xb029('0x4e')]['id']){delete _0xd39d35[_0xb029('0x4e')]['id'];}return db['VtigerAccount'][_0xb029('0x4c')]({'where':{'id':_0xd39d35[_0xb029('0x49')]['id']}})[_0xb029('0x1a')](handleEntityNotFound(_0x43dcc9,null))['then'](saveUpdates(_0xd39d35[_0xb029('0x4e')],null))['then'](respondWithResult(_0x43dcc9,null))[_0xb029('0x23')](handleError(_0x43dcc9,null));};exports[_0xb029('0x2d')]=function(_0x397871,_0x464dfc){return db[_0xb029('0x44')][_0xb029('0x4c')]({'where':{'id':_0x397871[_0xb029('0x49')]['id']}})['then'](handleEntityNotFound(_0x464dfc,null))['then'](removeEntity(_0x464dfc,null))['catch'](handleError(_0x464dfc,null));};exports[_0xb029('0x4f')]=function(_0x5034f2,_0x4140fd,_0x9184ed){var _0x307c5d={};var _0x48e07b={};var _0x208878;var _0x894515;return db[_0xb029('0x44')][_0xb029('0x50')]({'where':{'id':_0x5034f2['params']['id']}})[_0xb029('0x1a')](handleEntityNotFound(_0x4140fd,null))[_0xb029('0x1a')](function(_0x33dbfc){if(_0x33dbfc){_0x208878=_0x33dbfc;_0x48e07b[_0xb029('0x35')]=_[_0xb029('0x36')](db[_0xb029('0x51')][_0xb029('0x32')]);_0x48e07b[_0xb029('0x37')]=_['keys'](_0x5034f2[_0xb029('0x37')]);_0x48e07b[_0xb029('0x38')]=_['intersection'](_0x48e07b[_0xb029('0x35')],_0x48e07b[_0xb029('0x37')]);_0x307c5d[_0xb029('0x3a')]=_[_0xb029('0x39')](_0x48e07b[_0xb029('0x35')],qs[_0xb029('0x3b')](_0x5034f2[_0xb029('0x37')][_0xb029('0x3b')]));_0x307c5d['attributes']=_0x307c5d[_0xb029('0x3a')]['length']?_0x307c5d[_0xb029('0x3a')]:_0x48e07b[_0xb029('0x35')];_0x307c5d[_0xb029('0x52')]=qs['sort'](_0x5034f2[_0xb029('0x37')][_0xb029('0x3d')]);_0x307c5d['where']=qs['filters'](_[_0xb029('0x3e')](_0x5034f2[_0xb029('0x37')],_0x48e07b['filters']));if(_0x5034f2[_0xb029('0x37')]['filter']){_0x307c5d['where']=_[_0xb029('0x41')](_0x307c5d[_0xb029('0x40')],{'$or':_[_0xb029('0x31')](_0x307c5d[_0xb029('0x3a')],function(_0x8b3c36){var _0x3b8bcb={};_0x3b8bcb[_0x8b3c36]={'$like':'%'+_0x5034f2[_0xb029('0x37')]['filter']+'%'};return _0x3b8bcb;})});}_0x307c5d=_[_0xb029('0x41')]({},_0x307c5d,_0x5034f2[_0xb029('0x43')]);return _0x208878['getConfigurations'](_0x307c5d);}})[_0xb029('0x1a')](function(_0x46dfda){if(_0x46dfda){_0x894515=_0x46dfda[_0xb029('0x4a')];if(!_0x5034f2['query'][_0xb029('0x3c')](_0xb029('0x53'))){_0x307c5d['limit']=qs[_0xb029('0x2a')](_0x5034f2[_0xb029('0x37')]['limit']);_0x307c5d[_0xb029('0x29')]=qs[_0xb029('0x29')](_0x5034f2[_0xb029('0x37')][_0xb029('0x29')]);}return _0x208878[_0xb029('0x4f')](_0x307c5d);}})['then'](function(_0xd191bd){if(_0xd191bd){return _0xd191bd?{'count':_0x894515,'rows':_0xd191bd}:null;}})['then'](respondWithResult(_0x4140fd,null))['catch'](handleError(_0x4140fd,null));};exports[_0xb029('0x54')]=function(_0x24ac4c,_0x1ed270,_0x5bc9cf){if(_0x24ac4c[_0xb029('0x4e')]['id']){delete _0x24ac4c[_0xb029('0x4e')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x24ac4c[_0xb029('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ed270,null))[_0xb029('0x1a')](function(_0x4bf4a4){if(_0x4bf4a4){_0x24ac4c['body'][_0xb029('0x55')]=_0x4bf4a4['id'];_0x24ac4c['body'][_0xb029('0x56')]=integrations[_0xb029('0x57')](_0x24ac4c[_0xb029('0x4e')][_0xb029('0x58')],_0x24ac4c[_0xb029('0x4e')][_0xb029('0x34')]);_0x24ac4c[_0xb029('0x4e')][_0xb029('0x59')]=integrations[_0xb029('0x5a')](_0x24ac4c['body'][_0xb029('0x58')],_0x24ac4c[_0xb029('0x4e')][_0xb029('0x34')]);return db[_0xb029('0x51')][_0xb029('0x4d')](_0x24ac4c[_0xb029('0x4e')],{'include':[{'model':db[_0xb029('0x5b')],'as':_0xb029('0x56')},{'model':db[_0xb029('0x5b')],'as':'Descriptions'}]});}return null;})[_0xb029('0x1a')](respondWithResult(_0x1ed270,null))[_0xb029('0x23')](handleError(_0x1ed270,null));};var md5=require(_0xb029('0x5c'));exports['getFields']=function(_0x1d48d1,_0x32985b,_0x14a0f3){var _0x3bb758=null;var _0x133e8c=null;var _0x136ee3=null;var _0x107c88=null;var _0x55bc28='';return db[_0xb029('0x44')]['findOne']({'where':{'id':_0x1d48d1[_0xb029('0x49')]['id']},'attributes':['id',_0xb029('0x2e'),'username',_0xb029('0x5d'),'moduleName','remoteUri',_0xb029('0x5e'),_0xb029('0x5f')]})[_0xb029('0x1a')](handleEntityNotFound(_0x32985b,null))[_0xb029('0x1a')](function(_0x59ba3f){if(_0x59ba3f){_0x3bb758=_0x59ba3f['username'];_0x133e8c=_0x59ba3f[_0xb029('0x5f')];_0x136ee3=_0x59ba3f['moduleName'];_0x55bc28=_0x59ba3f[_0xb029('0x60')];var _0x299bb6=_0x55bc28[_0xb029('0x61')](-0x1);if(_0x299bb6==='/'){_0x55bc28=_0x55bc28[_0xb029('0x62')](0x0,_0x55bc28['lastIndexOf'](_0x299bb6));}_0x107c88=util[_0xb029('0x63')]('%s/webservice.php',_0x55bc28);var _0x52e9c8={'method':_0xb029('0x64'),'uri':_0x107c88,'qs':{'operation':_0xb029('0x65'),'username':_0x59ba3f[_0xb029('0x66')]},'json':!![]};return rp(_0x52e9c8);}})[_0xb029('0x1a')](function(_0x580bf9){if(_0x580bf9['success']){var _0x41b315={'method':_0xb029('0x67'),'uri':_0x107c88,'form':{'operation':_0xb029('0x68'),'username':_0x3bb758,'accessKey':md5(_0x580bf9[_0xb029('0x22')][_0xb029('0x69')]+_0x133e8c)},'json':!![]};return rp(_0x41b315);}})['then'](function(_0x1b7a95){if(_0x1b7a95[_0xb029('0x6a')]){var _0x4e23d2={'method':_0xb029('0x64'),'uri':_0x107c88,'qs':{'operation':_0xb029('0x6b'),'username':_0x3bb758,'sessionName':_0x1b7a95[_0xb029('0x22')]['sessionName'],'elementType':_0x136ee3},'json':!![]};return rp(_0x4e23d2);}})[_0xb029('0x1a')](function(_0x311409){if(_0x311409['success']){var _0x318c38=[_0xb029('0x6c'),_0xb029('0x6d'),_0xb029('0x6e')];_[_0xb029('0x6f')](_0x311409[_0xb029('0x22')]['fields'],function(_0x595a95){return _0x318c38[_0xb029('0x70')](_0x595a95[_0xb029('0x34')][_0xb029('0x2e')]);});_[_0xb029('0x6f')](_0x311409['result'][_0xb029('0x3b')],function(_0x27b8b5){return _0x27b8b5[_0xb029('0x71')]===_0xb029('0x72');});return{'count':_0x311409['result'][_0xb029('0x3b')][_0xb029('0x4a')],'rows':_[_0xb029('0x31')](_0x311409['result'][_0xb029('0x3b')],function(_0x3d1ea5){return{'id':_0x3d1ea5[_0xb029('0x2e')],'name':_0x3d1ea5[_0xb029('0x73')],'custom':_[_0xb029('0x74')](_0x3d1ea5[_0xb029('0x2e')],'cf_')?!![]:![],'options':_0x3d1ea5['type']['name']===_0xb029('0x75')&&_0x3d1ea5[_0xb029('0x34')][_0xb029('0x76')]['length']>0x0?_[_0xb029('0x31')](_0x3d1ea5[_0xb029('0x34')][_0xb029('0x76')],function(_0x5f1cbc){return{'name':_0x5f1cbc[_0xb029('0x73')],'value':_0x5f1cbc[_0xb029('0x77')]};}):[]};})};}})[_0xb029('0x1a')](respondWithResult(_0x32985b,null))[_0xb029('0x23')](function(_0x5f2d37){console['log'](_0xb029('0x78')+_0x5f2d37);var _0x4950d=_0x1d48d1[_0xb029('0x37')][_0xb029('0x79')]?0x1f4:_0x5f2d37['statusCode']||0x1f4;logger[_0xb029('0x20')](_0xb029('0x7a'),_0xb029('0x7b'),_0x4950d,JSON[_0xb029('0x7c')](_0x5f2d37));delete _0x5f2d37['name'];if(_0x4950d===0x191){_0x4950d=0x190;}_0x32985b['status'](_0x4950d)[_0xb029('0x2f')](_0x1d48d1['query'][_0xb029('0x79')]?{'message':_0xb029('0x7d'),'statusCode':_0x5f2d37[_0xb029('0x7e')]}:_0x5f2d37);});}; \ No newline at end of file +var _0x770d=['remoteUri','serverUrl','username','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','result','success','describe','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','count','limit','Content-Range','destroy','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','where','pick','filters','filter','merge','VIRTUAL','include','findAll','params','includeAll','create','body','update','find','findOne','VtigerConfiguration','length','sort','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','moduleName'];(function(_0x4a1edf,_0x1c80e8){var _0x619c60=function(_0x59a6bd){while(--_0x59a6bd){_0x4a1edf['push'](_0x4a1edf['shift']());}};_0x619c60(++_0x1c80e8);}(_0x770d,0x122));var _0xd770=function(_0x5d1d9f,_0x1ef696){_0x5d1d9f=_0x5d1d9f-0x0;var _0x2faa8e=_0x770d[_0x5d1d9f];return _0x2faa8e;};'use strict';var pdf=require(_0xd770('0x0'));var emlformat=require(_0xd770('0x1'));var rimraf=require(_0xd770('0x2'));var zipdir=require(_0xd770('0x3'));var jsonpatch=require(_0xd770('0x4'));var rp=require(_0xd770('0x5'));var moment=require(_0xd770('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd770('0x7'));var util=require(_0xd770('0x8'));var path=require(_0xd770('0x9'));var sox=require(_0xd770('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd770('0xb'));var squel=require(_0xd770('0xc'));var crypto=require(_0xd770('0xd'));var jsforce=require(_0xd770('0xe'));var deskjs=require(_0xd770('0xf'));var toCsv=require(_0xd770('0x10'));var querystring=require(_0xd770('0x11'));var Papa=require('papaparse');var Redis=require(_0xd770('0x12'));var authService=require(_0xd770('0x13'));var qs=require(_0xd770('0x14'));var as=require(_0xd770('0x15'));var hardwareService=require(_0xd770('0x16'));var logger=require('../../config/logger')(_0xd770('0x17'));var utils=require(_0xd770('0x18'));var config=require(_0xd770('0x19'));var licenseUtil=require(_0xd770('0x1a'));var db=require(_0xd770('0x1b'))['db'];var integrations=require(_0xd770('0x1c'));var jayson=require(_0xd770('0x1d'));var client=jayson[_0xd770('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4875f1,_0x28120b,_0x2b415c,_0x206000){return new BPromise(function(_0x4561bb,_0x51dacf){var _0x2f6832=_0x206000||client;return _0x2f6832[_0xd770('0x1f')](_0x4875f1,_0x2b415c)[_0xd770('0x20')](function(_0x1249f2){logger['info'](_0xd770('0x21'),_0x28120b,'request\x20sent');logger[_0xd770('0x22')](_0xd770('0x23'),_0x28120b,_0xd770('0x24'),JSON[_0xd770('0x25')](_0x1249f2));if(_0x1249f2[_0xd770('0x26')]){if(_0x1249f2[_0xd770('0x26')][_0xd770('0x27')]===0x1f4){logger[_0xd770('0x26')](_0xd770('0x21'),_0x28120b,_0x1249f2['error'][_0xd770('0x28')]);return _0x51dacf(_0x1249f2['error'][_0xd770('0x28')]);}logger['error'](_0xd770('0x21'),_0x28120b,_0x1249f2[_0xd770('0x26')][_0xd770('0x28')]);return _0x4561bb(_0x1249f2[_0xd770('0x26')][_0xd770('0x28')]);}else{logger['info'](_0xd770('0x21'),_0x28120b,_0xd770('0x24'));_0x4561bb(_0x1249f2['result'][_0xd770('0x28')]);}})[_0xd770('0x29')](function(_0x85e70b){logger[_0xd770('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x28120b,_0x85e70b);_0x51dacf(_0x85e70b);});});}function respondWithStatusCode(_0x9f81ea,_0xdfb694){_0xdfb694=_0xdfb694||0xcc;return function(_0x1b404d){if(_0x1b404d){return _0x9f81ea[_0xd770('0x2a')](_0xdfb694);}return _0x9f81ea['status'](_0xdfb694)[_0xd770('0x2b')]();};}function respondWithResult(_0xa58995,_0x4f64df){_0x4f64df=_0x4f64df||0xc8;return function(_0x4cc1e3){if(_0x4cc1e3){return _0xa58995[_0xd770('0x2c')](_0x4f64df)[_0xd770('0x2d')](_0x4cc1e3);}};}function respondWithFilteredResult(_0x19717a,_0x266e80){return function(_0x15d849){if(_0x15d849){var _0x112aaf=_0x15d849[_0xd770('0x2e')],_0x46bf88=_0x266e80['offset'],_0x49ef4d=_0x266e80['offset']+_0x266e80[_0xd770('0x2f')],_0x1094c0;if(_0x49ef4d>=_0x112aaf){_0x49ef4d=_0x112aaf;_0x1094c0=0xc8;}else{_0x1094c0=0xce;}_0x19717a[_0xd770('0x2c')](_0x1094c0);return _0x19717a['set'](_0xd770('0x30'),_0x46bf88+'-'+_0x49ef4d+'/'+_0x112aaf)[_0xd770('0x2d')](_0x15d849);}return null;};}function patchUpdates(_0x46266a){return function(_0x2768c1){try{jsonpatch['apply'](_0x2768c1,_0x46266a,!![]);}catch(_0x33a2b3){return BPromise['reject'](_0x33a2b3);}return _0x2768c1['save']();};}function saveUpdates(_0x1c2c2f,_0x1fdb3f){return function(_0x562463){if(_0x562463){return _0x562463['update'](_0x1c2c2f)[_0xd770('0x20')](function(_0xd0dffd){return _0xd0dffd;});}return null;};}function removeEntity(_0x5c8073,_0x2755c2){return function(_0x187207){if(_0x187207){return _0x187207[_0xd770('0x31')]()[_0xd770('0x20')](function(){_0x5c8073['status'](0xcc)[_0xd770('0x2b')]();});}};}function handleEntityNotFound(_0x55b9d6,_0x1ed58a){return function(_0x3c2728){if(!_0x3c2728){_0x55b9d6[_0xd770('0x2a')](0x194);}return _0x3c2728;};}function handleError(_0x43340b,_0x131bfa){_0x131bfa=_0x131bfa||0x1f4;return function(_0xd5dad8){logger[_0xd770('0x26')](_0xd5dad8[_0xd770('0x32')]);if(_0xd5dad8['name']){delete _0xd5dad8[_0xd770('0x33')];}_0x43340b['status'](_0x131bfa)[_0xd770('0x34')](_0xd5dad8);};}exports['index']=function(_0x23f121,_0x28570c){var _0x1b11f7={},_0x14a48e={},_0x505604={'count':0x0,'rows':[]};var _0x409832=_[_0xd770('0x35')](db[_0xd770('0x36')][_0xd770('0x37')],function(_0x7a1fb){return{'name':_0x7a1fb[_0xd770('0x38')],'type':_0x7a1fb[_0xd770('0x39')]['key']};});_0x14a48e[_0xd770('0x3a')]=_[_0xd770('0x35')](_0x409832,'name');_0x14a48e[_0xd770('0x3b')]=_[_0xd770('0x3c')](_0x23f121['query']);_0x14a48e['filters']=_[_0xd770('0x3d')](_0x14a48e[_0xd770('0x3a')],_0x14a48e['query']);_0x1b11f7[_0xd770('0x3e')]=_[_0xd770('0x3d')](_0x14a48e[_0xd770('0x3a')],qs[_0xd770('0x3f')](_0x23f121[_0xd770('0x3b')][_0xd770('0x3f')]));_0x1b11f7[_0xd770('0x3e')]=_0x1b11f7['attributes']['length']?_0x1b11f7[_0xd770('0x3e')]:_0x14a48e[_0xd770('0x3a')];if(!_0x23f121[_0xd770('0x3b')][_0xd770('0x40')](_0xd770('0x41'))){_0x1b11f7[_0xd770('0x2f')]=qs['limit'](_0x23f121['query'][_0xd770('0x2f')]);_0x1b11f7[_0xd770('0x42')]=qs[_0xd770('0x42')](_0x23f121[_0xd770('0x3b')]['offset']);}_0x1b11f7[_0xd770('0x43')]=qs['sort'](_0x23f121[_0xd770('0x3b')]['sort']);_0x1b11f7[_0xd770('0x44')]=qs['filters'](_[_0xd770('0x45')](_0x23f121[_0xd770('0x3b')],_0x14a48e[_0xd770('0x46')]),_0x409832);if(_0x23f121[_0xd770('0x3b')][_0xd770('0x47')]){_0x1b11f7[_0xd770('0x44')]=_[_0xd770('0x48')](_0x1b11f7[_0xd770('0x44')],{'$or':_[_0xd770('0x35')](_0x409832,function(_0x556d0f){if(_0x556d0f['type']!==_0xd770('0x49')){var _0x4acf6b={};_0x4acf6b[_0x556d0f[_0xd770('0x33')]]={'$like':'%'+_0x23f121[_0xd770('0x3b')][_0xd770('0x47')]+'%'};return _0x4acf6b;}})});}_0x1b11f7=_[_0xd770('0x48')]({},_0x1b11f7,_0x23f121['options']);var _0xa24439={'where':_0x1b11f7[_0xd770('0x44')]};return db[_0xd770('0x36')][_0xd770('0x2e')](_0xa24439)[_0xd770('0x20')](function(_0x3c3e25){_0x505604[_0xd770('0x2e')]=_0x3c3e25;if(_0x23f121[_0xd770('0x3b')]['includeAll']){_0x1b11f7[_0xd770('0x4a')]=[{'all':!![]}];}return db[_0xd770('0x36')][_0xd770('0x4b')](_0x1b11f7);})[_0xd770('0x20')](function(_0x2bce6d){_0x505604['rows']=_0x2bce6d;return _0x505604;})[_0xd770('0x20')](respondWithFilteredResult(_0x28570c,_0x1b11f7))[_0xd770('0x29')](handleError(_0x28570c,null));};exports['show']=function(_0x2663bb,_0x41bc35){var _0x5ce691={'raw':![],'where':{'id':_0x2663bb[_0xd770('0x4c')]['id']}},_0x388fc9={};_0x388fc9[_0xd770('0x3a')]=_[_0xd770('0x3c')](db['VtigerAccount'][_0xd770('0x37')]);_0x388fc9[_0xd770('0x3b')]=_[_0xd770('0x3c')](_0x2663bb[_0xd770('0x3b')]);_0x388fc9[_0xd770('0x46')]=_[_0xd770('0x3d')](_0x388fc9[_0xd770('0x3a')],_0x388fc9['query']);_0x5ce691[_0xd770('0x3e')]=_[_0xd770('0x3d')](_0x388fc9[_0xd770('0x3a')],qs['fields'](_0x2663bb[_0xd770('0x3b')][_0xd770('0x3f')]));_0x5ce691['attributes']=_0x5ce691[_0xd770('0x3e')]['length']?_0x5ce691[_0xd770('0x3e')]:_0x388fc9[_0xd770('0x3a')];if(_0x2663bb[_0xd770('0x3b')][_0xd770('0x4d')]){_0x5ce691[_0xd770('0x4a')]=[{'all':!![]}];}_0x5ce691=_[_0xd770('0x48')]({},_0x5ce691,_0x2663bb['options']);return db['VtigerAccount']['find'](_0x5ce691)[_0xd770('0x20')](handleEntityNotFound(_0x41bc35,null))[_0xd770('0x20')](respondWithResult(_0x41bc35,null))[_0xd770('0x29')](handleError(_0x41bc35,null));};exports[_0xd770('0x4e')]=function(_0x219c12,_0x59f588){return db[_0xd770('0x36')][_0xd770('0x4e')](_0x219c12[_0xd770('0x4f')],{})[_0xd770('0x20')](respondWithResult(_0x59f588,0xc9))[_0xd770('0x29')](handleError(_0x59f588,null));};exports[_0xd770('0x50')]=function(_0x3a2c6f,_0x3c8391){if(_0x3a2c6f['body']['id']){delete _0x3a2c6f['body']['id'];}return db['VtigerAccount'][_0xd770('0x51')]({'where':{'id':_0x3a2c6f[_0xd770('0x4c')]['id']}})[_0xd770('0x20')](handleEntityNotFound(_0x3c8391,null))['then'](saveUpdates(_0x3a2c6f[_0xd770('0x4f')],null))[_0xd770('0x20')](respondWithResult(_0x3c8391,null))[_0xd770('0x29')](handleError(_0x3c8391,null));};exports['destroy']=function(_0x20961c,_0x49630c){return db[_0xd770('0x36')][_0xd770('0x51')]({'where':{'id':_0x20961c[_0xd770('0x4c')]['id']}})[_0xd770('0x20')](handleEntityNotFound(_0x49630c,null))[_0xd770('0x20')](removeEntity(_0x49630c,null))[_0xd770('0x29')](handleError(_0x49630c,null));};exports['getConfigurations']=function(_0x1405ef,_0x60a0e6,_0x2252f2){var _0x1e8f85={};var _0x315574={};var _0x594fa2;var _0x31f1ba;return db[_0xd770('0x36')][_0xd770('0x52')]({'where':{'id':_0x1405ef[_0xd770('0x4c')]['id']}})['then'](handleEntityNotFound(_0x60a0e6,null))[_0xd770('0x20')](function(_0x522f6b){if(_0x522f6b){_0x594fa2=_0x522f6b;_0x315574['model']=_[_0xd770('0x3c')](db[_0xd770('0x53')]['rawAttributes']);_0x315574[_0xd770('0x3b')]=_[_0xd770('0x3c')](_0x1405ef['query']);_0x315574[_0xd770('0x46')]=_[_0xd770('0x3d')](_0x315574[_0xd770('0x3a')],_0x315574['query']);_0x1e8f85[_0xd770('0x3e')]=_['intersection'](_0x315574[_0xd770('0x3a')],qs[_0xd770('0x3f')](_0x1405ef[_0xd770('0x3b')]['fields']));_0x1e8f85[_0xd770('0x3e')]=_0x1e8f85['attributes'][_0xd770('0x54')]?_0x1e8f85[_0xd770('0x3e')]:_0x315574[_0xd770('0x3a')];_0x1e8f85[_0xd770('0x43')]=qs[_0xd770('0x55')](_0x1405ef[_0xd770('0x3b')][_0xd770('0x55')]);_0x1e8f85[_0xd770('0x44')]=qs['filters'](_[_0xd770('0x45')](_0x1405ef[_0xd770('0x3b')],_0x315574['filters']));if(_0x1405ef[_0xd770('0x3b')][_0xd770('0x47')]){_0x1e8f85[_0xd770('0x44')]=_['merge'](_0x1e8f85['where'],{'$or':_[_0xd770('0x35')](_0x1e8f85['attributes'],function(_0x4e5698){var _0x47c086={};_0x47c086[_0x4e5698]={'$like':'%'+_0x1405ef['query'][_0xd770('0x47')]+'%'};return _0x47c086;})});}_0x1e8f85=_['merge']({},_0x1e8f85,_0x1405ef[_0xd770('0x56')]);return _0x594fa2[_0xd770('0x57')](_0x1e8f85);}})['then'](function(_0x2b0808){if(_0x2b0808){_0x31f1ba=_0x2b0808[_0xd770('0x54')];if(!_0x1405ef[_0xd770('0x3b')][_0xd770('0x40')](_0xd770('0x41'))){_0x1e8f85['limit']=qs[_0xd770('0x2f')](_0x1405ef['query'][_0xd770('0x2f')]);_0x1e8f85[_0xd770('0x42')]=qs[_0xd770('0x42')](_0x1405ef[_0xd770('0x3b')][_0xd770('0x42')]);}return _0x594fa2[_0xd770('0x57')](_0x1e8f85);}})[_0xd770('0x20')](function(_0x156db0){if(_0x156db0){return _0x156db0?{'count':_0x31f1ba,'rows':_0x156db0}:null;}})[_0xd770('0x20')](respondWithResult(_0x60a0e6,null))['catch'](handleError(_0x60a0e6,null));};exports[_0xd770('0x58')]=function(_0x2c7a0a,_0x4b8cec,_0x35b5e7){if(_0x2c7a0a[_0xd770('0x4f')]['id']){delete _0x2c7a0a['body']['id'];}return db[_0xd770('0x36')]['findOne']({'where':{'id':_0x2c7a0a[_0xd770('0x4c')]['id']}})[_0xd770('0x20')](handleEntityNotFound(_0x4b8cec,null))[_0xd770('0x20')](function(_0x4c91e9){if(_0x4c91e9){_0x2c7a0a[_0xd770('0x4f')][_0xd770('0x59')]=_0x4c91e9['id'];_0x2c7a0a[_0xd770('0x4f')][_0xd770('0x5a')]=integrations[_0xd770('0x5b')](_0x2c7a0a['body']['channel'],_0x2c7a0a[_0xd770('0x4f')][_0xd770('0x39')]);_0x2c7a0a['body'][_0xd770('0x5c')]=integrations[_0xd770('0x5d')](_0x2c7a0a[_0xd770('0x4f')][_0xd770('0x5e')],_0x2c7a0a['body'][_0xd770('0x39')]);return db[_0xd770('0x53')]['create'](_0x2c7a0a[_0xd770('0x4f')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xd770('0x5f')],'as':_0xd770('0x5c')}]});}return null;})[_0xd770('0x20')](respondWithResult(_0x4b8cec,null))[_0xd770('0x29')](handleError(_0x4b8cec,null));};var md5=require(_0xd770('0x60'));exports[_0xd770('0x61')]=function(_0x139ff9,_0x2403f4,_0x154f87){var _0x250582=null;var _0x1e6897=null;var _0x442c52=null;var _0x3fd274=null;var _0x28921c='';return db[_0xd770('0x36')]['findOne']({'where':{'id':_0x139ff9['params']['id']},'attributes':['id',_0xd770('0x33'),'username',_0xd770('0x62'),_0xd770('0x63'),_0xd770('0x64'),_0xd770('0x65'),'accessKey']})[_0xd770('0x20')](handleEntityNotFound(_0x2403f4,null))['then'](function(_0x498633){if(_0x498633){_0x250582=_0x498633[_0xd770('0x66')];_0x1e6897=_0x498633[_0xd770('0x67')];_0x442c52=_0x498633['moduleName'];_0x28921c=_0x498633['remoteUri'];var _0x3cd71e=_0x28921c['slice'](-0x1);if(_0x3cd71e==='/'){_0x28921c=_0x28921c[_0xd770('0x68')](0x0,_0x28921c[_0xd770('0x69')](_0x3cd71e));}_0x3fd274=util[_0xd770('0x6a')](_0xd770('0x6b'),_0x28921c);var _0x2f4f5e={'method':_0xd770('0x6c'),'uri':_0x3fd274,'qs':{'operation':_0xd770('0x6d'),'username':_0x498633['username']},'json':!![]};return rp(_0x2f4f5e);}})[_0xd770('0x20')](function(_0x354251){if(_0x354251['success']){var _0x484f17={'method':'POST','uri':_0x3fd274,'form':{'operation':_0xd770('0x6e'),'username':_0x250582,'accessKey':md5(_0x354251[_0xd770('0x6f')]['token']+_0x1e6897)},'json':!![]};return rp(_0x484f17);}})['then'](function(_0x1f8737){if(_0x1f8737[_0xd770('0x70')]){var _0x494423={'method':_0xd770('0x6c'),'uri':_0x3fd274,'qs':{'operation':_0xd770('0x71'),'username':_0x250582,'sessionName':_0x1f8737[_0xd770('0x6f')]['sessionName'],'elementType':_0x442c52},'json':!![]};return rp(_0x494423);}})['then'](function(_0x2cbc54){if(_0x2cbc54[_0xd770('0x70')]){var _0x15371f=[_0xd770('0x72'),'reference',_0xd770('0x73')];_[_0xd770('0x74')](_0x2cbc54[_0xd770('0x6f')][_0xd770('0x3f')],function(_0x4a8626){return _0x15371f[_0xd770('0x75')](_0x4a8626[_0xd770('0x39')][_0xd770('0x33')]);});_[_0xd770('0x74')](_0x2cbc54[_0xd770('0x6f')][_0xd770('0x3f')],function(_0x5cfbb0){return _0x5cfbb0[_0xd770('0x76')]===_0xd770('0x77');});return{'count':_0x2cbc54[_0xd770('0x6f')][_0xd770('0x3f')][_0xd770('0x54')],'rows':_[_0xd770('0x35')](_0x2cbc54['result'][_0xd770('0x3f')],function(_0x3204d3){return{'id':_0x3204d3['name'],'name':_0x3204d3[_0xd770('0x78')],'custom':_[_0xd770('0x79')](_0x3204d3[_0xd770('0x33')],_0xd770('0x7a'))?!![]:![],'options':_0x3204d3[_0xd770('0x39')][_0xd770('0x33')]===_0xd770('0x7b')&&_0x3204d3[_0xd770('0x39')]['picklistValues'][_0xd770('0x54')]>0x0?_[_0xd770('0x35')](_0x3204d3['type'][_0xd770('0x7c')],function(_0x201d67){return{'name':_0x201d67['label'],'value':_0x201d67['value']};}):[]};})};}})[_0xd770('0x20')](respondWithResult(_0x2403f4,null))[_0xd770('0x29')](function(_0x3c0edf){console[_0xd770('0x7d')](_0xd770('0x7e')+_0x3c0edf);var _0x4a58be=_0x139ff9[_0xd770('0x3b')]['test']?0x1f4:_0x3c0edf[_0xd770('0x7f')]||0x1f4;logger[_0xd770('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4a58be,JSON[_0xd770('0x25')](_0x3c0edf));delete _0x3c0edf['name'];if(_0x4a58be===0x191){_0x4a58be=0x190;}_0x2403f4[_0xd770('0x2c')](_0x4a58be)[_0xd770('0x34')](_0x139ff9['query'][_0xd770('0x80')]?{'message':_0xd770('0x81'),'statusCode':_0x3c0edf[_0xd770('0x7f')]}:_0x3c0edf);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d39c640..cd33e6f 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 _0x96b5=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x48fcee,_0x431a8b){var _0x28d65a=function(_0x28b4ad){while(--_0x28b4ad){_0x48fcee['push'](_0x48fcee['shift']());}};_0x28d65a(++_0x431a8b);}(_0x96b5,0xff));var _0x596b=function(_0x5b6b9d,_0x10d553){_0x5b6b9d=_0x5b6b9d-0x0;var _0x2f988a=_0x96b5[_0x5b6b9d];return _0x2f988a;};'use strict';var _=require(_0x596b('0x0'));var util=require('util');var logger=require(_0x596b('0x1'))(_0x596b('0x2'));var moment=require(_0x596b('0x3'));var BPromise=require('bluebird');var rp=require(_0x596b('0x4'));var fs=require('fs');var path=require(_0x596b('0x5'));var rimraf=require(_0x596b('0x6'));var config=require(_0x596b('0x7'));var attributes=require(_0x596b('0x8'));var integrations=require(_0x596b('0x9'));module[_0x596b('0xa')]=function(_0x1563af,_0x1f7999){return _0x1563af[_0x596b('0xb')]('VtigerAccount',attributes,{'tableName':_0x596b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59a0=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment'];(function(_0x231562,_0xab9705){var _0x3df715=function(_0x3ee515){while(--_0x3ee515){_0x231562['push'](_0x231562['shift']());}};_0x3df715(++_0xab9705);}(_0x59a0,0x8b));var _0x059a=function(_0x42096f,_0x45ad21){_0x42096f=_0x42096f-0x0;var _0x404a12=_0x59a0[_0x42096f];return _0x404a12;};'use strict';var _=require('lodash');var util=require(_0x059a('0x0'));var logger=require(_0x059a('0x1'))(_0x059a('0x2'));var moment=require(_0x059a('0x3'));var BPromise=require(_0x059a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x059a('0x5'));var rimraf=require(_0x059a('0x6'));var config=require(_0x059a('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x059a('0x8'));module[_0x059a('0x9')]=function(_0x2899a0,_0x46d6f0){return _0x2899a0[_0x059a('0xa')](_0x059a('0xb'),attributes,{'tableName':_0x059a('0xc'),'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 c9d5ec4..d03e1d7 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 _0xc51e=['catch','GetVtigerAccount','VtigerAccount','findAll','options','limit','map','attributes','include','model','find','where','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','then','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc51e,0x193));var _0xec51=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0xc51e[_0xd93b26];return _0x25f668;};'use strict';var _=require(_0xec51('0x0'));var util=require(_0xec51('0x1'));var moment=require(_0xec51('0x2'));var BPromise=require(_0xec51('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec51('0x4'));var db=require(_0xec51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec51('0x6'))('rpc');var config=require(_0xec51('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec51('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfb5638,_0x193c15,_0x3fc02a){return new BPromise(function(_0x4947b1,_0x5f1569){return client['request'](_0xfb5638,_0x3fc02a)[_0xec51('0x9')](function(_0x47cad5){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x193c15,_0xec51('0xa'));logger['debug'](_0xec51('0xb'),_0x193c15,_0xec51('0xa'),JSON[_0xec51('0xc')](_0x47cad5));if(_0x47cad5[_0xec51('0xd')]){if(_0x47cad5[_0xec51('0xd')]['code']===0x1f4){logger[_0xec51('0xd')](_0xec51('0xe'),_0x193c15,_0x47cad5[_0xec51('0xd')]['message']);return _0x5f1569(_0x47cad5[_0xec51('0xd')][_0xec51('0xf')]);}logger[_0xec51('0xd')](_0xec51('0xe'),_0x193c15,_0x47cad5['error'][_0xec51('0xf')]);return _0x4947b1(_0x47cad5[_0xec51('0xd')][_0xec51('0xf')]);}else{logger[_0xec51('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x193c15,_0xec51('0xa'));_0x4947b1(_0x47cad5['result']['message']);}})[_0xec51('0x11')](function(_0x226e5d){logger['error'](_0xec51('0xe'),_0x193c15,_0x226e5d);_0x5f1569(_0x226e5d);});});}exports[_0xec51('0x12')]=function(_0x157bda){var _0xbfca10=this;return new Promise(function(_0x5d73b,_0x5a927e){return db[_0xec51('0x13')][_0xec51('0x14')]({'raw':_0x157bda[_0xec51('0x15')]?_0x157bda[_0xec51('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x157bda[_0xec51('0x15')]?_0x157bda['options']['where']||null:null,'attributes':_0x157bda['options']?_0x157bda[_0xec51('0x15')]['attributes']||null:null,'limit':_0x157bda[_0xec51('0x15')]?_0x157bda[_0xec51('0x15')][_0xec51('0x16')]||null:null,'include':_0x157bda[_0xec51('0x15')]?_0x157bda[_0xec51('0x15')]['include']?_[_0xec51('0x17')](_0x157bda[_0xec51('0x15')]['include'],function(_0x27039d){return{'model':db[_0x27039d['model']],'as':_0x27039d['as'],'attributes':_0x27039d[_0xec51('0x18')],'include':_0x27039d[_0xec51('0x19')]?_[_0xec51('0x17')](_0x27039d[_0xec51('0x19')],function(_0x568345){return{'model':db[_0x568345[_0xec51('0x1a')]],'as':_0x568345['as'],'attributes':_0x568345[_0xec51('0x18')],'include':_0x568345['include']?_[_0xec51('0x17')](_0x568345[_0xec51('0x19')],function(_0x15e560){return{'model':db[_0x15e560['model']],'as':_0x15e560['as'],'attributes':_0x15e560['attributes']};}):[]};}):[]};}):[]:[]})[_0xec51('0x9')](function(_0x5c3f9e){logger[_0xec51('0x10')]('GetVtigerAccount',_0x157bda);logger['debug'](_0xec51('0x12'),_0x157bda,JSON[_0xec51('0xc')](_0x5c3f9e));_0x5d73b(_0x5c3f9e);})[_0xec51('0x11')](function(_0x291ecd){logger[_0xec51('0xd')]('GetVtigerAccount',_0x291ecd[_0xec51('0xf')],_0x157bda);_0x5a927e(_0xbfca10[_0xec51('0xd')](0x1f4,_0x291ecd[_0xec51('0xf')]));});});};exports['ShowVtigerAccount']=function(_0x30f6d8){var _0x542b38=this;return new Promise(function(_0x5b5336,_0x534a22){return db[_0xec51('0x13')][_0xec51('0x1b')]({'raw':_0x30f6d8[_0xec51('0x15')]?_0x30f6d8[_0xec51('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x30f6d8[_0xec51('0x15')]?_0x30f6d8[_0xec51('0x15')][_0xec51('0x1c')]||null:null,'attributes':_0x30f6d8[_0xec51('0x15')]?_0x30f6d8[_0xec51('0x15')]['attributes']||null:null,'include':_0x30f6d8[_0xec51('0x15')]?_0x30f6d8[_0xec51('0x15')]['include']?_['map'](_0x30f6d8['options']['include'],function(_0x2c1e97){return{'model':db[_0x2c1e97[_0xec51('0x1a')]],'as':_0x2c1e97['as'],'attributes':_0x2c1e97[_0xec51('0x18')],'include':_0x2c1e97['include']?_[_0xec51('0x17')](_0x2c1e97[_0xec51('0x19')],function(_0x110fc4){return{'model':db[_0x110fc4[_0xec51('0x1a')]],'as':_0x110fc4['as'],'attributes':_0x110fc4['attributes'],'include':_0x110fc4['include']?_[_0xec51('0x17')](_0x110fc4[_0xec51('0x19')],function(_0x26859e){return{'model':db[_0x26859e['model']],'as':_0x26859e['as'],'attributes':_0x26859e[_0xec51('0x18')]};}):[]};}):[]};}):[]:[]})[_0xec51('0x9')](function(_0x320b72){logger[_0xec51('0x10')](_0xec51('0x1d'),_0x30f6d8);logger['debug'](_0xec51('0x1d'),_0x30f6d8,JSON[_0xec51('0xc')](_0x320b72));_0x5b5336(_0x320b72);})[_0xec51('0x11')](function(_0x3c5e84){logger[_0xec51('0xd')](_0xec51('0x1d'),_0x3c5e84[_0xec51('0xf')],_0x30f6d8);_0x534a22(_0x542b38['error'](0x1f4,_0x3c5e84[_0xec51('0xf')]));});});}; \ No newline at end of file +var _0xa9c7=['result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','model','map','info','ShowVtigerAccount','VtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1679cc,_0x242c53){var _0x4aaec8=function(_0x303c5f){while(--_0x303c5f){_0x1679cc['push'](_0x1679cc['shift']());}};_0x4aaec8(++_0x242c53);}(_0xa9c7,0x158));var _0x7a9c=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0xa9c7[_0x522ae8];return _0x3189b9;};'use strict';var _=require(_0x7a9c('0x0'));var util=require('util');var moment=require(_0x7a9c('0x1'));var BPromise=require(_0x7a9c('0x2'));var rs=require(_0x7a9c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a9c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7a9c('0x5'));var config=require(_0x7a9c('0x6'));var jayson=require(_0x7a9c('0x7'));var client=jayson['client'][_0x7a9c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52b22e,_0x5b806d,_0xa54191){return new BPromise(function(_0x20341f,_0x4d737d){return client[_0x7a9c('0x9')](_0x52b22e,_0xa54191)[_0x7a9c('0xa')](function(_0x57a0c4){logger['info'](_0x7a9c('0xb'),_0x5b806d,_0x7a9c('0xc'));logger[_0x7a9c('0xd')](_0x7a9c('0xe'),_0x5b806d,_0x7a9c('0xc'),JSON[_0x7a9c('0xf')](_0x57a0c4));if(_0x57a0c4[_0x7a9c('0x10')]){if(_0x57a0c4[_0x7a9c('0x10')][_0x7a9c('0x11')]===0x1f4){logger[_0x7a9c('0x10')](_0x7a9c('0xb'),_0x5b806d,_0x57a0c4[_0x7a9c('0x10')][_0x7a9c('0x12')]);return _0x4d737d(_0x57a0c4['error'][_0x7a9c('0x12')]);}logger[_0x7a9c('0x10')](_0x7a9c('0xb'),_0x5b806d,_0x57a0c4[_0x7a9c('0x10')][_0x7a9c('0x12')]);return _0x20341f(_0x57a0c4[_0x7a9c('0x10')][_0x7a9c('0x12')]);}else{logger['info'](_0x7a9c('0xb'),_0x5b806d,_0x7a9c('0xc'));_0x20341f(_0x57a0c4[_0x7a9c('0x13')][_0x7a9c('0x12')]);}})[_0x7a9c('0x14')](function(_0x2e2a5f){logger[_0x7a9c('0x10')](_0x7a9c('0xb'),_0x5b806d,_0x2e2a5f);_0x4d737d(_0x2e2a5f);});});}exports[_0x7a9c('0x15')]=function(_0x57ee37){var _0xf337c1=this;return new Promise(function(_0x16f21b,_0x56948d){return db['VtigerAccount']['findAll']({'raw':_0x57ee37[_0x7a9c('0x16')]?_0x57ee37[_0x7a9c('0x16')][_0x7a9c('0x17')]===undefined?!![]:![]:!![],'where':_0x57ee37[_0x7a9c('0x16')]?_0x57ee37[_0x7a9c('0x16')][_0x7a9c('0x18')]||null:null,'attributes':_0x57ee37[_0x7a9c('0x16')]?_0x57ee37[_0x7a9c('0x16')][_0x7a9c('0x19')]||null:null,'limit':_0x57ee37[_0x7a9c('0x16')]?_0x57ee37[_0x7a9c('0x16')][_0x7a9c('0x1a')]||null:null,'include':_0x57ee37[_0x7a9c('0x16')]?_0x57ee37[_0x7a9c('0x16')][_0x7a9c('0x1b')]?_['map'](_0x57ee37[_0x7a9c('0x16')][_0x7a9c('0x1b')],function(_0x2066a1){return{'model':db[_0x2066a1[_0x7a9c('0x1c')]],'as':_0x2066a1['as'],'attributes':_0x2066a1[_0x7a9c('0x19')],'include':_0x2066a1['include']?_[_0x7a9c('0x1d')](_0x2066a1[_0x7a9c('0x1b')],function(_0x3f9183){return{'model':db[_0x3f9183[_0x7a9c('0x1c')]],'as':_0x3f9183['as'],'attributes':_0x3f9183[_0x7a9c('0x19')],'include':_0x3f9183[_0x7a9c('0x1b')]?_['map'](_0x3f9183[_0x7a9c('0x1b')],function(_0x5e6e69){return{'model':db[_0x5e6e69['model']],'as':_0x5e6e69['as'],'attributes':_0x5e6e69[_0x7a9c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7a9c('0xa')](function(_0x13bb05){logger[_0x7a9c('0x1e')](_0x7a9c('0x15'),_0x57ee37);logger[_0x7a9c('0xd')](_0x7a9c('0x15'),_0x57ee37,JSON[_0x7a9c('0xf')](_0x13bb05));_0x16f21b(_0x13bb05);})[_0x7a9c('0x14')](function(_0x1d36d4){logger['error'](_0x7a9c('0x15'),_0x1d36d4['message'],_0x57ee37);_0x56948d(_0xf337c1[_0x7a9c('0x10')](0x1f4,_0x1d36d4['message']));});});};exports[_0x7a9c('0x1f')]=function(_0x321259){var _0x40eff9=this;return new Promise(function(_0x1f5dec,_0x59d2da){return db[_0x7a9c('0x20')]['find']({'raw':_0x321259[_0x7a9c('0x16')]?_0x321259['options'][_0x7a9c('0x17')]===undefined?!![]:![]:!![],'where':_0x321259['options']?_0x321259['options'][_0x7a9c('0x18')]||null:null,'attributes':_0x321259['options']?_0x321259['options']['attributes']||null:null,'include':_0x321259[_0x7a9c('0x16')]?_0x321259[_0x7a9c('0x16')][_0x7a9c('0x1b')]?_['map'](_0x321259[_0x7a9c('0x16')][_0x7a9c('0x1b')],function(_0x27cf7a){return{'model':db[_0x27cf7a['model']],'as':_0x27cf7a['as'],'attributes':_0x27cf7a[_0x7a9c('0x19')],'include':_0x27cf7a[_0x7a9c('0x1b')]?_[_0x7a9c('0x1d')](_0x27cf7a[_0x7a9c('0x1b')],function(_0x682bed){return{'model':db[_0x682bed['model']],'as':_0x682bed['as'],'attributes':_0x682bed[_0x7a9c('0x19')],'include':_0x682bed['include']?_[_0x7a9c('0x1d')](_0x682bed['include'],function(_0x15205c){return{'model':db[_0x15205c['model']],'as':_0x15205c['as'],'attributes':_0x15205c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28e4df){logger[_0x7a9c('0x1e')]('ShowVtigerAccount',_0x321259);logger[_0x7a9c('0xd')]('ShowVtigerAccount',_0x321259,JSON[_0x7a9c('0xf')](_0x28e4df));_0x1f5dec(_0x28e4df);})[_0x7a9c('0x14')](function(_0x5966e7){logger[_0x7a9c('0x10')]('ShowVtigerAccount',_0x5966e7['message'],_0x321259);_0x59d2da(_0x40eff9['error'](0x1f4,_0x5966e7[_0x7a9c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c52dd28..e3b44ae 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(_0x5da04b,_0x4effa6){var _0x4405f9=function(_0x4baeea){while(--_0x4baeea){_0x5da04b['push'](_0x5da04b['shift']());}};_0x4405f9(++_0x4effa6);}(_0xb10b,0x12a));var _0xbb10=function(_0x561e73,_0x13a224){_0x561e73=_0x561e73-0x0;var _0x2dc60d=_0xb10b[_0x561e73];return _0x2dc60d;};'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(_0x45adf4,_0x17fec0){var _0x472b3d=function(_0x2a6609){while(--_0x2a6609){_0x45adf4['push'](_0x45adf4['shift']());}};_0x472b3d(++_0x17fec0);}(_0xb10b,0x12a));var _0xbb10=function(_0x518cc0,_0x4e38ab){_0x518cc0=_0x518cc0-0x0;var _0x281183=_0xb10b[_0x518cc0];return _0x281183;};'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 4e25012..1badb4b 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 _0x6de6=['STRING','exports'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x6de6,0xb7));var _0x66de=function(_0x56e423,_0x98016e){_0x56e423=_0x56e423-0x0;var _0x331ddb=_0x6de6[_0x56e423];return _0x331ddb;};'use strict';var Sequelize=require('sequelize');module[_0x66de('0x0')]={'name':{'type':Sequelize[_0x66de('0x1')]},'description':{'type':Sequelize[_0x66de('0x1')]}}; \ No newline at end of file +var _0x838b=['STRING','sequelize','exports'];(function(_0x5a8072,_0x3ddd81){var _0x3f8689=function(_0x55bc9a){while(--_0x55bc9a){_0x5a8072['push'](_0x5a8072['shift']());}};_0x3f8689(++_0x3ddd81);}(_0x838b,0x7f));var _0xb838=function(_0x1d8d98,_0x29a5b7){_0x1d8d98=_0x1d8d98-0x0;var _0x286f55=_0x838b[_0x1d8d98];return _0x286f55;};'use strict';var Sequelize=require(_0xb838('0x0'));module[_0xb838('0x1')]={'name':{'type':Sequelize[_0xb838('0x2')]},'description':{'type':Sequelize[_0xb838('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 1a698d3..f277a39 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 _0xf492=['create','body','getFields','params','findOne','VtigerField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','VtigerConfiguration','findAll','rows','show','keys','rawAttributes','includeAll','find'];(function(_0x76a3ae,_0x2e54cb){var _0x6aae2a=function(_0x247e54){while(--_0x247e54){_0x76a3ae['push'](_0x76a3ae['shift']());}};_0x6aae2a(++_0x2e54cb);}(_0xf492,0x67));var _0x2f49=function(_0x1f77ef,_0x248d02){_0x1f77ef=_0x1f77ef-0x0;var _0x2ff490=_0xf492[_0x1f77ef];return _0x2ff490;};'use strict';var pdf=require(_0x2f49('0x0'));var emlformat=require(_0x2f49('0x1'));var rimraf=require(_0x2f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f49('0x3'));var rp=require('request-promise');var moment=require(_0x2f49('0x4'));var BPromise=require(_0x2f49('0x5'));var Mustache=require(_0x2f49('0x6'));var util=require(_0x2f49('0x7'));var path=require('path');var sox=require(_0x2f49('0x8'));var csv=require(_0x2f49('0x9'));var ejs=require(_0x2f49('0xa'));var fs=require('fs');var _=require(_0x2f49('0xb'));var squel=require(_0x2f49('0xc'));var crypto=require(_0x2f49('0xd'));var jsforce=require(_0x2f49('0xe'));var deskjs=require(_0x2f49('0xf'));var toCsv=require(_0x2f49('0x9'));var querystring=require(_0x2f49('0x10'));var Papa=require(_0x2f49('0x11'));var Redis=require('ioredis');var authService=require(_0x2f49('0x12'));var qs=require(_0x2f49('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f49('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2f49('0x15'));var config=require(_0x2f49('0x16'));var licenseUtil=require(_0x2f49('0x17'));var db=require(_0x2f49('0x18'))['db'];var jayson=require(_0x2f49('0x19'));var client=jayson['client'][_0x2f49('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x25ccd7,_0x120ff0,_0x11acf5,_0x18feef){return new BPromise(function(_0x21514c,_0x435cf7){var _0x364918=_0x18feef||client;return _0x364918[_0x2f49('0x1b')](_0x25ccd7,_0x11acf5)[_0x2f49('0x1c')](function(_0x170fc2){logger['info'](_0x2f49('0x1d'),_0x120ff0,_0x2f49('0x1e'));logger[_0x2f49('0x1f')](_0x2f49('0x20'),_0x120ff0,'request\x20sent',JSON[_0x2f49('0x21')](_0x170fc2));if(_0x170fc2[_0x2f49('0x22')]){if(_0x170fc2[_0x2f49('0x22')][_0x2f49('0x23')]===0x1f4){logger[_0x2f49('0x22')](_0x2f49('0x1d'),_0x120ff0,_0x170fc2[_0x2f49('0x22')][_0x2f49('0x24')]);return _0x435cf7(_0x170fc2['error']['message']);}logger[_0x2f49('0x22')](_0x2f49('0x1d'),_0x120ff0,_0x170fc2[_0x2f49('0x22')][_0x2f49('0x24')]);return _0x21514c(_0x170fc2['error'][_0x2f49('0x24')]);}else{logger[_0x2f49('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0x120ff0,_0x2f49('0x1e'));_0x21514c(_0x170fc2[_0x2f49('0x26')]['message']);}})[_0x2f49('0x27')](function(_0x4dd13f){logger[_0x2f49('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x120ff0,_0x4dd13f);_0x435cf7(_0x4dd13f);});});}function respondWithStatusCode(_0x2a2b6b,_0x1c2d0e){_0x1c2d0e=_0x1c2d0e||0xcc;return function(_0x2ffd31){if(_0x2ffd31){return _0x2a2b6b[_0x2f49('0x28')](_0x1c2d0e);}return _0x2a2b6b['status'](_0x1c2d0e)[_0x2f49('0x29')]();};}function respondWithResult(_0x260590,_0x502183){_0x502183=_0x502183||0xc8;return function(_0x4be093){if(_0x4be093){return _0x260590['status'](_0x502183)[_0x2f49('0x2a')](_0x4be093);}};}function respondWithFilteredResult(_0x5b24ea,_0xc2c999){return function(_0x2720dc){if(_0x2720dc){var _0x2ddc51=_0x2720dc[_0x2f49('0x2b')],_0x491b3f=_0xc2c999[_0x2f49('0x2c')],_0x4a9ef4=_0xc2c999[_0x2f49('0x2c')]+_0xc2c999[_0x2f49('0x2d')],_0xec5144;if(_0x4a9ef4>=_0x2ddc51){_0x4a9ef4=_0x2ddc51;_0xec5144=0xc8;}else{_0xec5144=0xce;}_0x5b24ea[_0x2f49('0x2e')](_0xec5144);return _0x5b24ea['set'](_0x2f49('0x2f'),_0x491b3f+'-'+_0x4a9ef4+'/'+_0x2ddc51)[_0x2f49('0x2a')](_0x2720dc);}return null;};}function patchUpdates(_0x421539){return function(_0x4e8a39){try{jsonpatch[_0x2f49('0x30')](_0x4e8a39,_0x421539,!![]);}catch(_0x3da4b){return BPromise[_0x2f49('0x31')](_0x3da4b);}return _0x4e8a39[_0x2f49('0x32')]();};}function saveUpdates(_0x15e006,_0x2533f8){return function(_0x29e5a9){if(_0x29e5a9){return _0x29e5a9[_0x2f49('0x33')](_0x15e006)[_0x2f49('0x1c')](function(_0x25cb6a){return _0x25cb6a;});}return null;};}function removeEntity(_0x346a29,_0x5f5a7b){return function(_0x134983){if(_0x134983){return _0x134983[_0x2f49('0x34')]()[_0x2f49('0x1c')](function(){_0x346a29[_0x2f49('0x2e')](0xcc)[_0x2f49('0x29')]();});}};}function handleEntityNotFound(_0x1528fa,_0x4682dd){return function(_0x2e7e70){if(!_0x2e7e70){_0x1528fa['sendStatus'](0x194);}return _0x2e7e70;};}function handleError(_0x4f6305,_0x458143){_0x458143=_0x458143||0x1f4;return function(_0x3b21a5){logger[_0x2f49('0x22')](_0x3b21a5[_0x2f49('0x35')]);if(_0x3b21a5[_0x2f49('0x36')]){delete _0x3b21a5[_0x2f49('0x36')];}_0x4f6305['status'](_0x458143)[_0x2f49('0x37')](_0x3b21a5);};}exports[_0x2f49('0x38')]=function(_0x545f0f,_0x350c00){var _0x246aef={},_0x2ddfab={},_0x2ec930={'count':0x0,'rows':[]};var _0x4877d6=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0x501c43){return{'name':_0x501c43[_0x2f49('0x39')],'type':_0x501c43[_0x2f49('0x3a')][_0x2f49('0x3b')]};});_0x2ddfab[_0x2f49('0x3c')]=_[_0x2f49('0x3d')](_0x4877d6,_0x2f49('0x36'));_0x2ddfab[_0x2f49('0x3e')]=_['keys'](_0x545f0f['query']);_0x2ddfab[_0x2f49('0x3f')]=_[_0x2f49('0x40')](_0x2ddfab[_0x2f49('0x3c')],_0x2ddfab[_0x2f49('0x3e')]);_0x246aef[_0x2f49('0x41')]=_['intersection'](_0x2ddfab[_0x2f49('0x3c')],qs['fields'](_0x545f0f['query'][_0x2f49('0x42')]));_0x246aef[_0x2f49('0x41')]=_0x246aef[_0x2f49('0x41')][_0x2f49('0x43')]?_0x246aef['attributes']:_0x2ddfab[_0x2f49('0x3c')];if(!_0x545f0f['query'][_0x2f49('0x44')](_0x2f49('0x45'))){_0x246aef[_0x2f49('0x2d')]=qs[_0x2f49('0x2d')](_0x545f0f[_0x2f49('0x3e')][_0x2f49('0x2d')]);_0x246aef[_0x2f49('0x2c')]=qs['offset'](_0x545f0f[_0x2f49('0x3e')]['offset']);}_0x246aef[_0x2f49('0x46')]=qs[_0x2f49('0x47')](_0x545f0f[_0x2f49('0x3e')][_0x2f49('0x47')]);_0x246aef[_0x2f49('0x48')]=qs[_0x2f49('0x3f')](_[_0x2f49('0x49')](_0x545f0f['query'],_0x2ddfab[_0x2f49('0x3f')]),_0x4877d6);if(_0x545f0f[_0x2f49('0x3e')]['filter']){_0x246aef[_0x2f49('0x48')]=_['merge'](_0x246aef[_0x2f49('0x48')],{'$or':_[_0x2f49('0x3d')](_0x4877d6,function(_0x224b5e){if(_0x224b5e[_0x2f49('0x3a')]!==_0x2f49('0x4a')){var _0x183acf={};_0x183acf[_0x224b5e[_0x2f49('0x36')]]={'$like':'%'+_0x545f0f[_0x2f49('0x3e')][_0x2f49('0x4b')]+'%'};return _0x183acf;}})});}_0x246aef=_[_0x2f49('0x4c')]({},_0x246aef,_0x545f0f[_0x2f49('0x4d')]);var _0x2d9cee={'where':_0x246aef[_0x2f49('0x48')]};return db['VtigerConfiguration'][_0x2f49('0x2b')](_0x2d9cee)[_0x2f49('0x1c')](function(_0x277dec){_0x2ec930['count']=_0x277dec;if(_0x545f0f[_0x2f49('0x3e')]['includeAll']){_0x246aef[_0x2f49('0x4e')]=[{'all':!![]}];}return db[_0x2f49('0x4f')][_0x2f49('0x50')](_0x246aef);})[_0x2f49('0x1c')](function(_0x2404f7){_0x2ec930[_0x2f49('0x51')]=_0x2404f7;return _0x2ec930;})[_0x2f49('0x1c')](respondWithFilteredResult(_0x350c00,_0x246aef))[_0x2f49('0x27')](handleError(_0x350c00,null));};exports[_0x2f49('0x52')]=function(_0x14e14c,_0x82e5ed){var _0x5c12f1={'raw':![],'where':{'id':_0x14e14c['params']['id']}},_0x38ac6e={};_0x38ac6e[_0x2f49('0x3c')]=_[_0x2f49('0x53')](db[_0x2f49('0x4f')][_0x2f49('0x54')]);_0x38ac6e[_0x2f49('0x3e')]=_[_0x2f49('0x53')](_0x14e14c['query']);_0x38ac6e[_0x2f49('0x3f')]=_[_0x2f49('0x40')](_0x38ac6e[_0x2f49('0x3c')],_0x38ac6e[_0x2f49('0x3e')]);_0x5c12f1[_0x2f49('0x41')]=_[_0x2f49('0x40')](_0x38ac6e[_0x2f49('0x3c')],qs[_0x2f49('0x42')](_0x14e14c[_0x2f49('0x3e')]['fields']));_0x5c12f1[_0x2f49('0x41')]=_0x5c12f1[_0x2f49('0x41')][_0x2f49('0x43')]?_0x5c12f1[_0x2f49('0x41')]:_0x38ac6e[_0x2f49('0x3c')];if(_0x14e14c[_0x2f49('0x3e')][_0x2f49('0x55')]){_0x5c12f1[_0x2f49('0x4e')]=[{'all':!![]}];}_0x5c12f1=_[_0x2f49('0x4c')]({},_0x5c12f1,_0x14e14c[_0x2f49('0x4d')]);return db[_0x2f49('0x4f')][_0x2f49('0x56')](_0x5c12f1)['then'](handleEntityNotFound(_0x82e5ed,null))[_0x2f49('0x1c')](respondWithResult(_0x82e5ed,null))[_0x2f49('0x27')](handleError(_0x82e5ed,null));};exports[_0x2f49('0x57')]=function(_0x3ea115,_0x31223a){return db[_0x2f49('0x4f')][_0x2f49('0x57')](_0x3ea115['body'],{})['then'](respondWithResult(_0x31223a,0xc9))[_0x2f49('0x27')](handleError(_0x31223a,null));};exports[_0x2f49('0x33')]=function(_0x54ec10,_0x524af6){if(_0x54ec10[_0x2f49('0x58')]['id']){delete _0x54ec10[_0x2f49('0x58')]['id'];}return db[_0x2f49('0x4f')]['find']({'where':{'id':_0x54ec10['params']['id']}})[_0x2f49('0x1c')](handleEntityNotFound(_0x524af6,null))['then'](saveUpdates(_0x54ec10[_0x2f49('0x58')],null))[_0x2f49('0x1c')](respondWithResult(_0x524af6,null))[_0x2f49('0x27')](handleError(_0x524af6,null));};exports[_0x2f49('0x34')]=function(_0x320a96,_0x5ad066){return db[_0x2f49('0x4f')][_0x2f49('0x56')]({'where':{'id':_0x320a96['params']['id']}})[_0x2f49('0x1c')](handleEntityNotFound(_0x5ad066,null))['then'](removeEntity(_0x5ad066,null))[_0x2f49('0x27')](handleError(_0x5ad066,null));};exports[_0x2f49('0x59')]=function(_0x375145,_0x39e0d5,_0x681049){var _0xf2140b={};var _0x559a38={};var _0x421203;var _0x4b89f2;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x375145[_0x2f49('0x5a')]['id']}})['then'](handleEntityNotFound(_0x39e0d5,null))[_0x2f49('0x1c')](function(_0x251081){if(_0x251081){_0x421203=_0x251081;_0x559a38[_0x2f49('0x3c')]=_['keys'](db['VtigerField'][_0x2f49('0x54')]);_0x559a38['query']=_[_0x2f49('0x53')](_0x375145[_0x2f49('0x3e')]);_0x559a38[_0x2f49('0x3f')]=_[_0x2f49('0x40')](_0x559a38[_0x2f49('0x3c')],_0x559a38['query']);_0xf2140b[_0x2f49('0x41')]=_[_0x2f49('0x40')](_0x559a38[_0x2f49('0x3c')],qs[_0x2f49('0x42')](_0x375145[_0x2f49('0x3e')][_0x2f49('0x42')]));_0xf2140b[_0x2f49('0x41')]=_0xf2140b['attributes'][_0x2f49('0x43')]?_0xf2140b[_0x2f49('0x41')]:_0x559a38['model'];_0xf2140b[_0x2f49('0x46')]=qs[_0x2f49('0x47')](_0x375145[_0x2f49('0x3e')][_0x2f49('0x47')]);_0xf2140b[_0x2f49('0x48')]=qs[_0x2f49('0x3f')](_[_0x2f49('0x49')](_0x375145['query'],_0x559a38[_0x2f49('0x3f')]));if(_0x375145[_0x2f49('0x3e')][_0x2f49('0x4b')]){_0xf2140b[_0x2f49('0x48')]=_['merge'](_0xf2140b[_0x2f49('0x48')],{'$or':_['map'](_0xf2140b[_0x2f49('0x41')],function(_0x149bd0){var _0x447aa0={};_0x447aa0[_0x149bd0]={'$like':'%'+_0x375145[_0x2f49('0x3e')]['filter']+'%'};return _0x447aa0;})});}_0xf2140b=_[_0x2f49('0x4c')]({},_0xf2140b,_0x375145[_0x2f49('0x4d')]);return _0x421203[_0x2f49('0x59')](_0xf2140b);}})[_0x2f49('0x1c')](function(_0x3be883){if(_0x3be883){_0x4b89f2=_0x3be883[_0x2f49('0x43')];if(!_0x375145[_0x2f49('0x3e')][_0x2f49('0x44')](_0x2f49('0x45'))){_0xf2140b[_0x2f49('0x2d')]=qs['limit'](_0x375145[_0x2f49('0x3e')][_0x2f49('0x2d')]);_0xf2140b[_0x2f49('0x2c')]=qs['offset'](_0x375145[_0x2f49('0x3e')][_0x2f49('0x2c')]);}return _0x421203['getFields'](_0xf2140b);}})[_0x2f49('0x1c')](function(_0x348577){if(_0x348577){return _0x348577?{'count':_0x4b89f2,'rows':_0x348577}:null;}})['then'](respondWithResult(_0x39e0d5,null))[_0x2f49('0x27')](handleError(_0x39e0d5,null));};exports['getSubjects']=function(_0x5609fd,_0x2968bb,_0x2863d9){var _0x2aed07={};var _0x2997c7={};var _0x321076;var _0x4c5d37;return db['VtigerConfiguration'][_0x2f49('0x5b')]({'where':{'id':_0x5609fd[_0x2f49('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2968bb,null))[_0x2f49('0x1c')](function(_0x490b8a){if(_0x490b8a){_0x321076=_0x490b8a;_0x2997c7[_0x2f49('0x3c')]=_[_0x2f49('0x53')](db[_0x2f49('0x5c')]['rawAttributes']);_0x2997c7['query']=_['keys'](_0x5609fd[_0x2f49('0x3e')]);_0x2997c7[_0x2f49('0x3f')]=_[_0x2f49('0x40')](_0x2997c7[_0x2f49('0x3c')],_0x2997c7[_0x2f49('0x3e')]);_0x2aed07[_0x2f49('0x41')]=_[_0x2f49('0x40')](_0x2997c7['model'],qs['fields'](_0x5609fd[_0x2f49('0x3e')]['fields']));_0x2aed07[_0x2f49('0x41')]=_0x2aed07[_0x2f49('0x41')][_0x2f49('0x43')]?_0x2aed07[_0x2f49('0x41')]:_0x2997c7['model'];_0x2aed07[_0x2f49('0x46')]=qs['sort'](_0x5609fd[_0x2f49('0x3e')][_0x2f49('0x47')]);_0x2aed07[_0x2f49('0x48')]=qs[_0x2f49('0x3f')](_['pick'](_0x5609fd[_0x2f49('0x3e')],_0x2997c7[_0x2f49('0x3f')]));if(_0x5609fd[_0x2f49('0x3e')][_0x2f49('0x4b')]){_0x2aed07['where']=_['merge'](_0x2aed07['where'],{'$or':_['map'](_0x2aed07[_0x2f49('0x41')],function(_0x88f94a){var _0x219fa4={};_0x219fa4[_0x88f94a]={'$like':'%'+_0x5609fd['query'][_0x2f49('0x4b')]+'%'};return _0x219fa4;})});}_0x2aed07=_[_0x2f49('0x4c')]({},_0x2aed07,_0x5609fd[_0x2f49('0x4d')]);return _0x321076[_0x2f49('0x5d')](_0x2aed07);}})[_0x2f49('0x1c')](function(_0x23f46b){if(_0x23f46b){_0x4c5d37=_0x23f46b['length'];if(!_0x5609fd[_0x2f49('0x3e')][_0x2f49('0x44')](_0x2f49('0x45'))){_0x2aed07['limit']=qs[_0x2f49('0x2d')](_0x5609fd[_0x2f49('0x3e')]['limit']);_0x2aed07[_0x2f49('0x2c')]=qs[_0x2f49('0x2c')](_0x5609fd['query'][_0x2f49('0x2c')]);}return _0x321076['getSubjects'](_0x2aed07);}})[_0x2f49('0x1c')](function(_0x3891ea){if(_0x3891ea){return _0x3891ea?{'count':_0x4c5d37,'rows':_0x3891ea}:null;}})[_0x2f49('0x1c')](respondWithResult(_0x2968bb,null))['catch'](handleError(_0x2968bb,null));};exports[_0x2f49('0x5e')]=function(_0x49b3b5,_0x460a96,_0x51ee50){var _0x4497ef={};var _0x517c3e={};var _0x3e3d80;var _0x45624f;return db[_0x2f49('0x4f')]['findOne']({'where':{'id':_0x49b3b5[_0x2f49('0x5a')]['id']}})[_0x2f49('0x1c')](handleEntityNotFound(_0x460a96,null))[_0x2f49('0x1c')](function(_0x5348a9){if(_0x5348a9){_0x3e3d80=_0x5348a9;_0x517c3e['model']=_['keys'](db[_0x2f49('0x5c')][_0x2f49('0x54')]);_0x517c3e['query']=_[_0x2f49('0x53')](_0x49b3b5['query']);_0x517c3e[_0x2f49('0x3f')]=_['intersection'](_0x517c3e[_0x2f49('0x3c')],_0x517c3e[_0x2f49('0x3e')]);_0x4497ef['attributes']=_[_0x2f49('0x40')](_0x517c3e[_0x2f49('0x3c')],qs[_0x2f49('0x42')](_0x49b3b5[_0x2f49('0x3e')]['fields']));_0x4497ef[_0x2f49('0x41')]=_0x4497ef[_0x2f49('0x41')][_0x2f49('0x43')]?_0x4497ef['attributes']:_0x517c3e[_0x2f49('0x3c')];_0x4497ef[_0x2f49('0x46')]=qs[_0x2f49('0x47')](_0x49b3b5[_0x2f49('0x3e')]['sort']);_0x4497ef['where']=qs[_0x2f49('0x3f')](_[_0x2f49('0x49')](_0x49b3b5[_0x2f49('0x3e')],_0x517c3e[_0x2f49('0x3f')]));if(_0x49b3b5['query'][_0x2f49('0x4b')]){_0x4497ef[_0x2f49('0x48')]=_[_0x2f49('0x4c')](_0x4497ef[_0x2f49('0x48')],{'$or':_[_0x2f49('0x3d')](_0x4497ef[_0x2f49('0x41')],function(_0x1c5356){var _0x3700c0={};_0x3700c0[_0x1c5356]={'$like':'%'+_0x49b3b5[_0x2f49('0x3e')][_0x2f49('0x4b')]+'%'};return _0x3700c0;})});}_0x4497ef=_[_0x2f49('0x4c')]({},_0x4497ef,_0x49b3b5[_0x2f49('0x4d')]);return _0x3e3d80[_0x2f49('0x5e')](_0x4497ef);}})['then'](function(_0x5828fc){if(_0x5828fc){_0x45624f=_0x5828fc[_0x2f49('0x43')];if(!_0x49b3b5[_0x2f49('0x3e')][_0x2f49('0x44')](_0x2f49('0x45'))){_0x4497ef[_0x2f49('0x2d')]=qs[_0x2f49('0x2d')](_0x49b3b5['query']['limit']);_0x4497ef['offset']=qs['offset'](_0x49b3b5[_0x2f49('0x3e')][_0x2f49('0x2c')]);}return _0x3e3d80[_0x2f49('0x5e')](_0x4497ef);}})[_0x2f49('0x1c')](function(_0x219ee4){if(_0x219ee4){return _0x219ee4?{'count':_0x45624f,'rows':_0x219ee4}:null;}})[_0x2f49('0x1c')](respondWithResult(_0x460a96,null))[_0x2f49('0x27')](handleError(_0x460a96,null));}; \ No newline at end of file +var _0x95fa=['Content-Range','apply','reject','update','destroy','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','getFields','findOne','VtigerField','pick','hasOwnProperty','getSubjects','rawAttributes','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit'];(function(_0x31e9b8,_0x235dda){var _0xccb497=function(_0x2dd917){while(--_0x2dd917){_0x31e9b8['push'](_0x31e9b8['shift']());}};_0xccb497(++_0x235dda);}(_0x95fa,0x196));var _0xa95f=function(_0x30094b,_0x1f60ac){_0x30094b=_0x30094b-0x0;var _0x227cfd=_0x95fa[_0x30094b];return _0x227cfd;};'use strict';var pdf=require(_0xa95f('0x0'));var emlformat=require(_0xa95f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa95f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa95f('0x3'));var moment=require('moment');var BPromise=require(_0xa95f('0x4'));var Mustache=require(_0xa95f('0x5'));var util=require(_0xa95f('0x6'));var path=require(_0xa95f('0x7'));var sox=require(_0xa95f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa95f('0x9'));var crypto=require('crypto');var jsforce=require(_0xa95f('0xa'));var deskjs=require(_0xa95f('0xb'));var toCsv=require(_0xa95f('0xc'));var querystring=require(_0xa95f('0xd'));var Papa=require(_0xa95f('0xe'));var Redis=require(_0xa95f('0xf'));var authService=require(_0xa95f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa95f('0x11'));var logger=require(_0xa95f('0x12'))('api');var utils=require(_0xa95f('0x13'));var config=require(_0xa95f('0x14'));var licenseUtil=require(_0xa95f('0x15'));var db=require(_0xa95f('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa95f('0x17')][_0xa95f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4dcc7e,_0x5417e8,_0x1285e5,_0xb7edb1){return new BPromise(function(_0x347f39,_0x16e919){var _0x2780ba=_0xb7edb1||client;return _0x2780ba[_0xa95f('0x19')](_0x4dcc7e,_0x1285e5)[_0xa95f('0x1a')](function(_0x5dd1b6){logger[_0xa95f('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x5417e8,_0xa95f('0x1c'));logger[_0xa95f('0x1d')](_0xa95f('0x1e'),_0x5417e8,_0xa95f('0x1c'),JSON[_0xa95f('0x1f')](_0x5dd1b6));if(_0x5dd1b6[_0xa95f('0x20')]){if(_0x5dd1b6[_0xa95f('0x20')][_0xa95f('0x21')]===0x1f4){logger[_0xa95f('0x20')](_0xa95f('0x22'),_0x5417e8,_0x5dd1b6[_0xa95f('0x20')][_0xa95f('0x23')]);return _0x16e919(_0x5dd1b6[_0xa95f('0x20')]['message']);}logger[_0xa95f('0x20')](_0xa95f('0x22'),_0x5417e8,_0x5dd1b6['error'][_0xa95f('0x23')]);return _0x347f39(_0x5dd1b6['error'][_0xa95f('0x23')]);}else{logger[_0xa95f('0x1b')](_0xa95f('0x22'),_0x5417e8,_0xa95f('0x1c'));_0x347f39(_0x5dd1b6['result']['message']);}})[_0xa95f('0x24')](function(_0x1d227b){logger[_0xa95f('0x20')](_0xa95f('0x22'),_0x5417e8,_0x1d227b);_0x16e919(_0x1d227b);});});}function respondWithStatusCode(_0xd77ef2,_0x3716da){_0x3716da=_0x3716da||0xcc;return function(_0x3ed647){if(_0x3ed647){return _0xd77ef2[_0xa95f('0x25')](_0x3716da);}return _0xd77ef2[_0xa95f('0x26')](_0x3716da)[_0xa95f('0x27')]();};}function respondWithResult(_0x37a7ce,_0x2f2201){_0x2f2201=_0x2f2201||0xc8;return function(_0x5149ec){if(_0x5149ec){return _0x37a7ce[_0xa95f('0x26')](_0x2f2201)[_0xa95f('0x28')](_0x5149ec);}};}function respondWithFilteredResult(_0x3ad518,_0x510758){return function(_0x18f2b6){if(_0x18f2b6){var _0x15ef5b=_0x18f2b6[_0xa95f('0x29')],_0x20fe30=_0x510758[_0xa95f('0x2a')],_0x590b79=_0x510758[_0xa95f('0x2a')]+_0x510758[_0xa95f('0x2b')],_0x357b3d;if(_0x590b79>=_0x15ef5b){_0x590b79=_0x15ef5b;_0x357b3d=0xc8;}else{_0x357b3d=0xce;}_0x3ad518[_0xa95f('0x26')](_0x357b3d);return _0x3ad518['set'](_0xa95f('0x2c'),_0x20fe30+'-'+_0x590b79+'/'+_0x15ef5b)['json'](_0x18f2b6);}return null;};}function patchUpdates(_0x9e19e9){return function(_0xaef41e){try{jsonpatch[_0xa95f('0x2d')](_0xaef41e,_0x9e19e9,!![]);}catch(_0xe3cf12){return BPromise[_0xa95f('0x2e')](_0xe3cf12);}return _0xaef41e['save']();};}function saveUpdates(_0x407fc4,_0x39e4a4){return function(_0x16fb3c){if(_0x16fb3c){return _0x16fb3c[_0xa95f('0x2f')](_0x407fc4)['then'](function(_0x36a010){return _0x36a010;});}return null;};}function removeEntity(_0x5dc487,_0x1cd935){return function(_0x55562d){if(_0x55562d){return _0x55562d[_0xa95f('0x30')]()[_0xa95f('0x1a')](function(){_0x5dc487['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f5a7a,_0x1b6a82){return function(_0x51b6d0){if(!_0x51b6d0){_0x4f5a7a['sendStatus'](0x194);}return _0x51b6d0;};}function handleError(_0x16ff08,_0x250cdf){_0x250cdf=_0x250cdf||0x1f4;return function(_0x23c59d){logger[_0xa95f('0x20')](_0x23c59d[_0xa95f('0x31')]);if(_0x23c59d[_0xa95f('0x32')]){delete _0x23c59d[_0xa95f('0x32')];}_0x16ff08[_0xa95f('0x26')](_0x250cdf)[_0xa95f('0x33')](_0x23c59d);};}exports[_0xa95f('0x34')]=function(_0x46268a,_0x35869d){var _0xda8d42={},_0x74aaad={},_0xf7c84c={'count':0x0,'rows':[]};var _0x521f55=_[_0xa95f('0x35')](db[_0xa95f('0x36')]['rawAttributes'],function(_0x46ea0c){return{'name':_0x46ea0c[_0xa95f('0x37')],'type':_0x46ea0c[_0xa95f('0x38')][_0xa95f('0x39')]};});_0x74aaad[_0xa95f('0x3a')]=_['map'](_0x521f55,_0xa95f('0x32'));_0x74aaad[_0xa95f('0x3b')]=_[_0xa95f('0x3c')](_0x46268a[_0xa95f('0x3b')]);_0x74aaad[_0xa95f('0x3d')]=_[_0xa95f('0x3e')](_0x74aaad['model'],_0x74aaad['query']);_0xda8d42[_0xa95f('0x3f')]=_[_0xa95f('0x3e')](_0x74aaad[_0xa95f('0x3a')],qs[_0xa95f('0x40')](_0x46268a[_0xa95f('0x3b')]['fields']));_0xda8d42['attributes']=_0xda8d42[_0xa95f('0x3f')][_0xa95f('0x41')]?_0xda8d42[_0xa95f('0x3f')]:_0x74aaad[_0xa95f('0x3a')];if(!_0x46268a[_0xa95f('0x3b')]['hasOwnProperty'](_0xa95f('0x42'))){_0xda8d42[_0xa95f('0x2b')]=qs[_0xa95f('0x2b')](_0x46268a['query'][_0xa95f('0x2b')]);_0xda8d42['offset']=qs[_0xa95f('0x2a')](_0x46268a['query']['offset']);}_0xda8d42[_0xa95f('0x43')]=qs['sort'](_0x46268a['query'][_0xa95f('0x44')]);_0xda8d42[_0xa95f('0x45')]=qs['filters'](_['pick'](_0x46268a[_0xa95f('0x3b')],_0x74aaad[_0xa95f('0x3d')]),_0x521f55);if(_0x46268a[_0xa95f('0x3b')][_0xa95f('0x46')]){_0xda8d42[_0xa95f('0x45')]=_[_0xa95f('0x47')](_0xda8d42[_0xa95f('0x45')],{'$or':_[_0xa95f('0x35')](_0x521f55,function(_0x41b906){if(_0x41b906[_0xa95f('0x38')]!==_0xa95f('0x48')){var _0x8bdf95={};_0x8bdf95[_0x41b906[_0xa95f('0x32')]]={'$like':'%'+_0x46268a[_0xa95f('0x3b')][_0xa95f('0x46')]+'%'};return _0x8bdf95;}})});}_0xda8d42=_[_0xa95f('0x47')]({},_0xda8d42,_0x46268a[_0xa95f('0x49')]);var _0x451e54={'where':_0xda8d42[_0xa95f('0x45')]};return db[_0xa95f('0x36')][_0xa95f('0x29')](_0x451e54)[_0xa95f('0x1a')](function(_0x3d9b1a){_0xf7c84c['count']=_0x3d9b1a;if(_0x46268a[_0xa95f('0x3b')][_0xa95f('0x4a')]){_0xda8d42[_0xa95f('0x4b')]=[{'all':!![]}];}return db[_0xa95f('0x36')]['findAll'](_0xda8d42);})[_0xa95f('0x1a')](function(_0xfb006b){_0xf7c84c[_0xa95f('0x4c')]=_0xfb006b;return _0xf7c84c;})['then'](respondWithFilteredResult(_0x35869d,_0xda8d42))[_0xa95f('0x24')](handleError(_0x35869d,null));};exports[_0xa95f('0x4d')]=function(_0x1aba48,_0x13cbcd){var _0x2ac177={'raw':![],'where':{'id':_0x1aba48[_0xa95f('0x4e')]['id']}},_0x4b9ea1={};_0x4b9ea1[_0xa95f('0x3a')]=_[_0xa95f('0x3c')](db[_0xa95f('0x36')]['rawAttributes']);_0x4b9ea1['query']=_[_0xa95f('0x3c')](_0x1aba48[_0xa95f('0x3b')]);_0x4b9ea1[_0xa95f('0x3d')]=_['intersection'](_0x4b9ea1[_0xa95f('0x3a')],_0x4b9ea1[_0xa95f('0x3b')]);_0x2ac177[_0xa95f('0x3f')]=_[_0xa95f('0x3e')](_0x4b9ea1[_0xa95f('0x3a')],qs[_0xa95f('0x40')](_0x1aba48['query'][_0xa95f('0x40')]));_0x2ac177[_0xa95f('0x3f')]=_0x2ac177[_0xa95f('0x3f')][_0xa95f('0x41')]?_0x2ac177['attributes']:_0x4b9ea1['model'];if(_0x1aba48[_0xa95f('0x3b')]['includeAll']){_0x2ac177[_0xa95f('0x4b')]=[{'all':!![]}];}_0x2ac177=_[_0xa95f('0x47')]({},_0x2ac177,_0x1aba48[_0xa95f('0x49')]);return db['VtigerConfiguration'][_0xa95f('0x4f')](_0x2ac177)['then'](handleEntityNotFound(_0x13cbcd,null))[_0xa95f('0x1a')](respondWithResult(_0x13cbcd,null))[_0xa95f('0x24')](handleError(_0x13cbcd,null));};exports[_0xa95f('0x50')]=function(_0x41cdff,_0x4772b5){return db[_0xa95f('0x36')][_0xa95f('0x50')](_0x41cdff['body'],{})['then'](respondWithResult(_0x4772b5,0xc9))[_0xa95f('0x24')](handleError(_0x4772b5,null));};exports['update']=function(_0x389ef7,_0x1fdee6){if(_0x389ef7[_0xa95f('0x51')]['id']){delete _0x389ef7[_0xa95f('0x51')]['id'];}return db[_0xa95f('0x36')][_0xa95f('0x4f')]({'where':{'id':_0x389ef7[_0xa95f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fdee6,null))[_0xa95f('0x1a')](saveUpdates(_0x389ef7[_0xa95f('0x51')],null))[_0xa95f('0x1a')](respondWithResult(_0x1fdee6,null))['catch'](handleError(_0x1fdee6,null));};exports[_0xa95f('0x30')]=function(_0x43ddfa,_0x41c2c0){return db[_0xa95f('0x36')]['find']({'where':{'id':_0x43ddfa[_0xa95f('0x4e')]['id']}})[_0xa95f('0x1a')](handleEntityNotFound(_0x41c2c0,null))[_0xa95f('0x1a')](removeEntity(_0x41c2c0,null))['catch'](handleError(_0x41c2c0,null));};exports[_0xa95f('0x52')]=function(_0x57febc,_0x897f83,_0x60fdb1){var _0x16ead8={};var _0x254bcf={};var _0x8a349d;var _0x4c26f5;return db[_0xa95f('0x36')][_0xa95f('0x53')]({'where':{'id':_0x57febc[_0xa95f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x897f83,null))[_0xa95f('0x1a')](function(_0x4acfe1){if(_0x4acfe1){_0x8a349d=_0x4acfe1;_0x254bcf[_0xa95f('0x3a')]=_[_0xa95f('0x3c')](db[_0xa95f('0x54')]['rawAttributes']);_0x254bcf['query']=_[_0xa95f('0x3c')](_0x57febc[_0xa95f('0x3b')]);_0x254bcf['filters']=_[_0xa95f('0x3e')](_0x254bcf[_0xa95f('0x3a')],_0x254bcf['query']);_0x16ead8['attributes']=_['intersection'](_0x254bcf[_0xa95f('0x3a')],qs[_0xa95f('0x40')](_0x57febc[_0xa95f('0x3b')][_0xa95f('0x40')]));_0x16ead8[_0xa95f('0x3f')]=_0x16ead8['attributes'][_0xa95f('0x41')]?_0x16ead8[_0xa95f('0x3f')]:_0x254bcf[_0xa95f('0x3a')];_0x16ead8[_0xa95f('0x43')]=qs['sort'](_0x57febc[_0xa95f('0x3b')][_0xa95f('0x44')]);_0x16ead8[_0xa95f('0x45')]=qs[_0xa95f('0x3d')](_[_0xa95f('0x55')](_0x57febc['query'],_0x254bcf['filters']));if(_0x57febc[_0xa95f('0x3b')]['filter']){_0x16ead8['where']=_[_0xa95f('0x47')](_0x16ead8[_0xa95f('0x45')],{'$or':_[_0xa95f('0x35')](_0x16ead8['attributes'],function(_0x4b64ff){var _0x7497cb={};_0x7497cb[_0x4b64ff]={'$like':'%'+_0x57febc[_0xa95f('0x3b')][_0xa95f('0x46')]+'%'};return _0x7497cb;})});}_0x16ead8=_[_0xa95f('0x47')]({},_0x16ead8,_0x57febc[_0xa95f('0x49')]);return _0x8a349d[_0xa95f('0x52')](_0x16ead8);}})['then'](function(_0x521119){if(_0x521119){_0x4c26f5=_0x521119[_0xa95f('0x41')];if(!_0x57febc[_0xa95f('0x3b')][_0xa95f('0x56')](_0xa95f('0x42'))){_0x16ead8['limit']=qs[_0xa95f('0x2b')](_0x57febc[_0xa95f('0x3b')]['limit']);_0x16ead8['offset']=qs[_0xa95f('0x2a')](_0x57febc[_0xa95f('0x3b')][_0xa95f('0x2a')]);}return _0x8a349d[_0xa95f('0x52')](_0x16ead8);}})['then'](function(_0x202a93){if(_0x202a93){return _0x202a93?{'count':_0x4c26f5,'rows':_0x202a93}:null;}})['then'](respondWithResult(_0x897f83,null))[_0xa95f('0x24')](handleError(_0x897f83,null));};exports[_0xa95f('0x57')]=function(_0x4c7119,_0x4c003c,_0xac09a6){var _0x1110c5={};var _0x2cb47e={};var _0x36fde6;var _0x18c937;return db[_0xa95f('0x36')]['findOne']({'where':{'id':_0x4c7119[_0xa95f('0x4e')]['id']}})[_0xa95f('0x1a')](handleEntityNotFound(_0x4c003c,null))['then'](function(_0x9a56d6){if(_0x9a56d6){_0x36fde6=_0x9a56d6;_0x2cb47e[_0xa95f('0x3a')]=_['keys'](db[_0xa95f('0x54')][_0xa95f('0x58')]);_0x2cb47e['query']=_[_0xa95f('0x3c')](_0x4c7119[_0xa95f('0x3b')]);_0x2cb47e[_0xa95f('0x3d')]=_[_0xa95f('0x3e')](_0x2cb47e[_0xa95f('0x3a')],_0x2cb47e['query']);_0x1110c5[_0xa95f('0x3f')]=_[_0xa95f('0x3e')](_0x2cb47e[_0xa95f('0x3a')],qs[_0xa95f('0x40')](_0x4c7119[_0xa95f('0x3b')][_0xa95f('0x40')]));_0x1110c5['attributes']=_0x1110c5[_0xa95f('0x3f')][_0xa95f('0x41')]?_0x1110c5[_0xa95f('0x3f')]:_0x2cb47e[_0xa95f('0x3a')];_0x1110c5['order']=qs[_0xa95f('0x44')](_0x4c7119[_0xa95f('0x3b')][_0xa95f('0x44')]);_0x1110c5[_0xa95f('0x45')]=qs[_0xa95f('0x3d')](_[_0xa95f('0x55')](_0x4c7119[_0xa95f('0x3b')],_0x2cb47e[_0xa95f('0x3d')]));if(_0x4c7119[_0xa95f('0x3b')][_0xa95f('0x46')]){_0x1110c5[_0xa95f('0x45')]=_[_0xa95f('0x47')](_0x1110c5['where'],{'$or':_[_0xa95f('0x35')](_0x1110c5[_0xa95f('0x3f')],function(_0x435873){var _0x34911c={};_0x34911c[_0x435873]={'$like':'%'+_0x4c7119[_0xa95f('0x3b')][_0xa95f('0x46')]+'%'};return _0x34911c;})});}_0x1110c5=_[_0xa95f('0x47')]({},_0x1110c5,_0x4c7119[_0xa95f('0x49')]);return _0x36fde6[_0xa95f('0x57')](_0x1110c5);}})[_0xa95f('0x1a')](function(_0x45e5ed){if(_0x45e5ed){_0x18c937=_0x45e5ed[_0xa95f('0x41')];if(!_0x4c7119[_0xa95f('0x3b')]['hasOwnProperty'](_0xa95f('0x42'))){_0x1110c5[_0xa95f('0x2b')]=qs[_0xa95f('0x2b')](_0x4c7119[_0xa95f('0x3b')][_0xa95f('0x2b')]);_0x1110c5['offset']=qs[_0xa95f('0x2a')](_0x4c7119[_0xa95f('0x3b')][_0xa95f('0x2a')]);}return _0x36fde6[_0xa95f('0x57')](_0x1110c5);}})[_0xa95f('0x1a')](function(_0x5e84d7){if(_0x5e84d7){return _0x5e84d7?{'count':_0x18c937,'rows':_0x5e84d7}:null;}})[_0xa95f('0x1a')](respondWithResult(_0x4c003c,null))[_0xa95f('0x24')](handleError(_0x4c003c,null));};exports['getDescriptions']=function(_0x3b57be,_0xb63f01,_0x58f227){var _0x16c2b1={};var _0x9fe675={};var _0x54e228;var _0x2ad849;return db[_0xa95f('0x36')]['findOne']({'where':{'id':_0x3b57be[_0xa95f('0x4e')]['id']}})[_0xa95f('0x1a')](handleEntityNotFound(_0xb63f01,null))[_0xa95f('0x1a')](function(_0x2a6000){if(_0x2a6000){_0x54e228=_0x2a6000;_0x9fe675['model']=_['keys'](db[_0xa95f('0x54')][_0xa95f('0x58')]);_0x9fe675[_0xa95f('0x3b')]=_[_0xa95f('0x3c')](_0x3b57be[_0xa95f('0x3b')]);_0x9fe675['filters']=_[_0xa95f('0x3e')](_0x9fe675[_0xa95f('0x3a')],_0x9fe675[_0xa95f('0x3b')]);_0x16c2b1[_0xa95f('0x3f')]=_[_0xa95f('0x3e')](_0x9fe675['model'],qs[_0xa95f('0x40')](_0x3b57be['query'][_0xa95f('0x40')]));_0x16c2b1[_0xa95f('0x3f')]=_0x16c2b1[_0xa95f('0x3f')][_0xa95f('0x41')]?_0x16c2b1[_0xa95f('0x3f')]:_0x9fe675[_0xa95f('0x3a')];_0x16c2b1['order']=qs[_0xa95f('0x44')](_0x3b57be[_0xa95f('0x3b')][_0xa95f('0x44')]);_0x16c2b1[_0xa95f('0x45')]=qs[_0xa95f('0x3d')](_[_0xa95f('0x55')](_0x3b57be[_0xa95f('0x3b')],_0x9fe675[_0xa95f('0x3d')]));if(_0x3b57be['query'][_0xa95f('0x46')]){_0x16c2b1[_0xa95f('0x45')]=_[_0xa95f('0x47')](_0x16c2b1[_0xa95f('0x45')],{'$or':_[_0xa95f('0x35')](_0x16c2b1['attributes'],function(_0x68d0b1){var _0x59eec1={};_0x59eec1[_0x68d0b1]={'$like':'%'+_0x3b57be['query'][_0xa95f('0x46')]+'%'};return _0x59eec1;})});}_0x16c2b1=_[_0xa95f('0x47')]({},_0x16c2b1,_0x3b57be[_0xa95f('0x49')]);return _0x54e228['getDescriptions'](_0x16c2b1);}})['then'](function(_0x22801a){if(_0x22801a){_0x2ad849=_0x22801a[_0xa95f('0x41')];if(!_0x3b57be['query'][_0xa95f('0x56')](_0xa95f('0x42'))){_0x16c2b1[_0xa95f('0x2b')]=qs[_0xa95f('0x2b')](_0x3b57be[_0xa95f('0x3b')][_0xa95f('0x2b')]);_0x16c2b1[_0xa95f('0x2a')]=qs['offset'](_0x3b57be['query']['offset']);}return _0x54e228[_0xa95f('0x59')](_0x16c2b1);}})[_0xa95f('0x1a')](function(_0x34b741){if(_0x34b741){return _0x34b741?{'count':_0x2ad849,'rows':_0x34b741}:null;}})[_0xa95f('0x1a')](respondWithResult(_0xb63f01,null))[_0xa95f('0x24')](handleError(_0xb63f01,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f4e6270..c7842c0 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 _0x6e4e=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','path','./intVtigerConfiguration.attributes','exports','define'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x6e4e,0x1ce));var _0xe6e4=function(_0x31c881,_0x5c03fa){_0x31c881=_0x31c881-0x0;var _0x44d92c=_0x6e4e[_0x31c881];return _0x44d92c;};'use strict';var _=require(_0xe6e4('0x0'));var util=require(_0xe6e4('0x1'));var logger=require(_0xe6e4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe6e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6e4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6e4('0x5'));module[_0xe6e4('0x6')]=function(_0x4729c6,_0x3b549d){return _0x4729c6[_0xe6e4('0x7')](_0xe6e4('0x8'),attributes,{'tableName':_0xe6e4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc401=['int_vtiger_configurations','lodash','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','define'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc401,0x133));var _0x1c40=function(_0x3fe672,_0x27935d){_0x3fe672=_0x3fe672-0x0;var _0x3ed975=_0xc401[_0x3fe672];return _0x3ed975;};'use strict';var _=require(_0x1c40('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1c40('0x1'));var BPromise=require(_0x1c40('0x2'));var rp=require(_0x1c40('0x3'));var fs=require('fs');var path=require(_0x1c40('0x4'));var rimraf=require('rimraf');var config=require(_0x1c40('0x5'));var attributes=require(_0x1c40('0x6'));module['exports']=function(_0x3c4ba1,_0x463244){return _0x3c4ba1[_0x1c40('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x1c40('0x8'),'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 d7ae874..468cc3f 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 _0xa32a=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0xa32a,0x141));var _0xaa32=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0xa32a[_0x119d13];return _0x333c35;};'use strict';var _=require(_0xaa32('0x0'));var util=require(_0xaa32('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa32('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa32('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa32('0x4'));var jayson=require(_0xaa32('0x5'));var client=jayson[_0xaa32('0x6')][_0xaa32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x347e9e,_0x5b8021,_0x529e2a){return new BPromise(function(_0x10aa2e,_0x1afbf5){return client[_0xaa32('0x8')](_0x347e9e,_0x529e2a)[_0xaa32('0x9')](function(_0x34cf6d){logger[_0xaa32('0xa')](_0xaa32('0xb'),_0x5b8021,_0xaa32('0xc'));logger[_0xaa32('0xd')](_0xaa32('0xe'),_0x5b8021,_0xaa32('0xc'),JSON['stringify'](_0x34cf6d));if(_0x34cf6d['error']){if(_0x34cf6d[_0xaa32('0xf')][_0xaa32('0x10')]===0x1f4){logger[_0xaa32('0xf')](_0xaa32('0xb'),_0x5b8021,_0x34cf6d[_0xaa32('0xf')][_0xaa32('0x11')]);return _0x1afbf5(_0x34cf6d['error']['message']);}logger[_0xaa32('0xf')](_0xaa32('0xb'),_0x5b8021,_0x34cf6d[_0xaa32('0xf')][_0xaa32('0x11')]);return _0x10aa2e(_0x34cf6d[_0xaa32('0xf')][_0xaa32('0x11')]);}else{logger[_0xaa32('0xa')](_0xaa32('0xb'),_0x5b8021,'request\x20sent');_0x10aa2e(_0x34cf6d['result'][_0xaa32('0x11')]);}})[_0xaa32('0x12')](function(_0x30abc8){logger[_0xaa32('0xf')](_0xaa32('0xb'),_0x5b8021,_0x30abc8);_0x1afbf5(_0x30abc8);});});} \ No newline at end of file +var _0xbec4=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','VtigerConfiguration,\x20%s,\x20%s','debug'];(function(_0x357707,_0x45e513){var _0x6a3adb=function(_0x14f014){while(--_0x14f014){_0x357707['push'](_0x357707['shift']());}};_0x6a3adb(++_0x45e513);}(_0xbec4,0x65));var _0x4bec=function(_0x2b5367,_0x22ba5f){_0x2b5367=_0x2b5367-0x0;var _0x231fb9=_0xbec4[_0x2b5367];return _0x231fb9;};'use strict';var _=require(_0x4bec('0x0'));var util=require(_0x4bec('0x1'));var moment=require(_0x4bec('0x2'));var BPromise=require(_0x4bec('0x3'));var rs=require(_0x4bec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bec('0x6'))(_0x4bec('0x7'));var config=require(_0x4bec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4bec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b331c,_0x34bb68,_0x4886c0){return new BPromise(function(_0x3b9429,_0x4cac62){return client[_0x4bec('0xa')](_0x2b331c,_0x4886c0)[_0x4bec('0xb')](function(_0x3741d5){logger['info'](_0x4bec('0xc'),_0x34bb68,'request\x20sent');logger[_0x4bec('0xd')](_0x4bec('0xe'),_0x34bb68,'request\x20sent',JSON[_0x4bec('0xf')](_0x3741d5));if(_0x3741d5[_0x4bec('0x10')]){if(_0x3741d5[_0x4bec('0x10')][_0x4bec('0x11')]===0x1f4){logger[_0x4bec('0x10')](_0x4bec('0xc'),_0x34bb68,_0x3741d5[_0x4bec('0x10')]['message']);return _0x4cac62(_0x3741d5[_0x4bec('0x10')]['message']);}logger[_0x4bec('0x10')](_0x4bec('0xc'),_0x34bb68,_0x3741d5[_0x4bec('0x10')][_0x4bec('0x12')]);return _0x3b9429(_0x3741d5[_0x4bec('0x10')]['message']);}else{logger[_0x4bec('0x13')](_0x4bec('0xc'),_0x34bb68,_0x4bec('0x14'));_0x3b9429(_0x3741d5[_0x4bec('0x15')][_0x4bec('0x12')]);}})[_0x4bec('0x16')](function(_0x5034a3){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x34bb68,_0x5034a3);_0x4cac62(_0x5034a3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c100ba3..ead328d 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 _0x8157=['show','post','create','put','delete','/:id','destroy','multer','util','path','express','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index'];(function(_0x34093a,_0x360d91){var _0x32e2d2=function(_0x565e41){while(--_0x565e41){_0x34093a['push'](_0x34093a['shift']());}};_0x32e2d2(++_0x360d91);}(_0x8157,0x8f));var _0x7815=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0x8157[_0x962fc5];return _0x43667c;};'use strict';var multer=require(_0x7815('0x0'));var util=require(_0x7815('0x1'));var path=require(_0x7815('0x2'));var timeout=require('connect-timeout');var express=require(_0x7815('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7815('0x4'));var config=require(_0x7815('0x5'));var controller=require(_0x7815('0x6'));router[_0x7815('0x7')]('/',auth[_0x7815('0x8')](),controller[_0x7815('0x9')]);router[_0x7815('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7815('0xa')]);router[_0x7815('0xb')]('/',auth['isAuthenticated'](),controller[_0x7815('0xc')]);router[_0x7815('0xd')]('/:id',auth[_0x7815('0x8')](),controller['update']);router[_0x7815('0xe')](_0x7815('0xf'),auth[_0x7815('0x8')](),controller[_0x7815('0x10')]);module['exports']=router; \ No newline at end of file +var _0x65c2=['isAuthenticated','index','/:id','show','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x65c2,0x1a0));var _0x265c=function(_0x52d596,_0x4c6131){_0x52d596=_0x52d596-0x0;var _0x39f68b=_0x65c2[_0x52d596];return _0x39f68b;};'use strict';var multer=require(_0x265c('0x0'));var util=require(_0x265c('0x1'));var path=require(_0x265c('0x2'));var timeout=require('connect-timeout');var express=require(_0x265c('0x3'));var router=express[_0x265c('0x4')]();var auth=require(_0x265c('0x5'));var interaction=require(_0x265c('0x6'));var config=require(_0x265c('0x7'));var controller=require('./intVtigerField.controller');router[_0x265c('0x8')]('/',auth[_0x265c('0x9')](),controller[_0x265c('0xa')]);router[_0x265c('0x8')](_0x265c('0xb'),auth[_0x265c('0x9')](),controller[_0x265c('0xc')]);router['post']('/',auth[_0x265c('0x9')](),controller[_0x265c('0xd')]);router[_0x265c('0xe')]('/:id',auth[_0x265c('0x9')](),controller[_0x265c('0xf')]);router['delete'](_0x265c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x265c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 0abf671..552c5a6 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 _0x603f=['keyValue','STRING','customVariable','sequelize','ENUM','string','variable'];(function(_0x5b63f3,_0x56e37d){var _0x102e86=function(_0xd6b33f){while(--_0xd6b33f){_0x5b63f3['push'](_0x5b63f3['shift']());}};_0x102e86(++_0x56e37d);}(_0x603f,0x65));var _0xf603=function(_0x3a4931,_0x1b4341){_0x3a4931=_0x3a4931-0x0;var _0x31873b=_0x603f[_0x3a4931];return _0x31873b;};'use strict';var Sequelize=require(_0xf603('0x0'));module['exports']={'type':{'type':Sequelize[_0xf603('0x1')](_0xf603('0x2'),_0xf603('0x3'),'customVariable',_0xf603('0x4')),'defaultValue':_0xf603('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf603('0x5')]},'keyType':{'type':Sequelize[_0xf603('0x1')]('string','variable',_0xf603('0x6'))},'keyContent':{'type':Sequelize[_0xf603('0x5')]},'idField':{'type':Sequelize[_0xf603('0x5')]},'nameField':{'type':Sequelize[_0xf603('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf603('0x5')]}}; \ No newline at end of file +var _0x0f9a=['variable','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x5a85e4,_0xbe427a){var _0x4c98e5=function(_0x5b20ac){while(--_0x5b20ac){_0x5a85e4['push'](_0x5a85e4['shift']());}};_0x4c98e5(++_0xbe427a);}(_0x0f9a,0x174));var _0xa0f9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x0f9a[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xa0f9('0x0'));module[_0xa0f9('0x1')]={'type':{'type':Sequelize[_0xa0f9('0x2')](_0xa0f9('0x3'),'variable',_0xa0f9('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa0f9('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa0f9('0x2')](_0xa0f9('0x3'),_0xa0f9('0x6'),_0xa0f9('0x4'))},'keyContent':{'type':Sequelize[_0xa0f9('0x5')]},'idField':{'type':Sequelize[_0xa0f9('0x5')]},'nameField':{'type':Sequelize[_0xa0f9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d743330..cde045e 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 _0x8ca9=['body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x3cad98,_0x3a6539){var _0x53f43c=function(_0x44ff9c){while(--_0x44ff9c){_0x3cad98['push'](_0x3cad98['shift']());}};_0x53f43c(++_0x3a6539);}(_0x8ca9,0x9c));var _0x98ca=function(_0x5257c0,_0xc2e255){_0x5257c0=_0x5257c0-0x0;var _0x5677a6=_0x8ca9[_0x5257c0];return _0x5677a6;};'use strict';var pdf=require(_0x98ca('0x0'));var emlformat=require(_0x98ca('0x1'));var rimraf=require(_0x98ca('0x2'));var zipdir=require(_0x98ca('0x3'));var jsonpatch=require(_0x98ca('0x4'));var rp=require(_0x98ca('0x5'));var moment=require(_0x98ca('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98ca('0x7'));var path=require('path');var sox=require(_0x98ca('0x8'));var csv=require('to-csv');var ejs=require(_0x98ca('0x9'));var fs=require('fs');var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0xf'));var querystring=require(_0x98ca('0x10'));var Papa=require(_0x98ca('0x11'));var Redis=require(_0x98ca('0x12'));var authService=require(_0x98ca('0x13'));var qs=require(_0x98ca('0x14'));var as=require(_0x98ca('0x15'));var hardwareService=require(_0x98ca('0x16'));var logger=require(_0x98ca('0x17'))(_0x98ca('0x18'));var utils=require(_0x98ca('0x19'));var config=require(_0x98ca('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1b'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1c')](_0xba3887)[_0x98ca('0x1d')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1c')](_0xa2bab4)[_0x98ca('0x1e')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=_0x29df1b[_0x98ca('0x1f')],_0x398171=_0x330713[_0x98ca('0x20')],_0x52e9c8=_0x330713[_0x98ca('0x20')]+_0x330713[_0x98ca('0x21')],_0x238c1a;if(_0x52e9c8>=_0x29f46b){_0x52e9c8=_0x29f46b;_0x238c1a=0xc8;}else{_0x238c1a=0xce;}_0x4940ca[_0x98ca('0x1c')](_0x238c1a);return _0x4940ca[_0x98ca('0x22')](_0x98ca('0x23'),_0x398171+'-'+_0x52e9c8+'/'+_0x29f46b)[_0x98ca('0x1e')](_0x29df1b);}return null;};}function patchUpdates(_0x110f9f){return function(_0x1b2c69){try{jsonpatch['apply'](_0x1b2c69,_0x110f9f,!![]);}catch(_0x626b37){return BPromise['reject'](_0x626b37);}return _0x1b2c69[_0x98ca('0x24')]();};}function saveUpdates(_0x2fe568,_0x50f8b4){return function(_0x5ca905){if(_0x5ca905){return _0x5ca905[_0x98ca('0x25')](_0x2fe568)[_0x98ca('0x26')](function(_0x130544){return _0x130544;});}return null;};}function removeEntity(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['destroy']()[_0x98ca('0x26')](function(){_0x519927['status'](0xcc)[_0x98ca('0x1d')]();});}};}function handleEntityNotFound(_0x323cdb,_0x430d16){return function(_0x3ec01d){if(!_0x3ec01d){_0x323cdb[_0x98ca('0x27')](0x194);}return _0x3ec01d;};}function handleError(_0xe5091e,_0x2a59e3){_0x2a59e3=_0x2a59e3||0x1f4;return function(_0x50b1a2){logger[_0x98ca('0x28')](_0x50b1a2['stack']);if(_0x50b1a2[_0x98ca('0x29')]){delete _0x50b1a2[_0x98ca('0x29')];}_0xe5091e['status'](_0x2a59e3)[_0x98ca('0x2a')](_0x50b1a2);};}exports['index']=function(_0x214649,_0x4f48db){var _0x5bf77d={},_0x14bfb4={},_0x540f45={'count':0x0,'rows':[]};var _0x342a83=_[_0x98ca('0x2b')](db[_0x98ca('0x2c')][_0x98ca('0x2d')],function(_0x3b3e60){return{'name':_0x3b3e60[_0x98ca('0x2e')],'type':_0x3b3e60[_0x98ca('0x2f')][_0x98ca('0x30')]};});_0x14bfb4[_0x98ca('0x31')]=_['map'](_0x342a83,_0x98ca('0x29'));_0x14bfb4['query']=_[_0x98ca('0x32')](_0x214649[_0x98ca('0x33')]);_0x14bfb4['filters']=_['intersection'](_0x14bfb4[_0x98ca('0x31')],_0x14bfb4['query']);_0x5bf77d[_0x98ca('0x34')]=_['intersection'](_0x14bfb4[_0x98ca('0x31')],qs['fields'](_0x214649[_0x98ca('0x33')][_0x98ca('0x35')]));_0x5bf77d['attributes']=_0x5bf77d[_0x98ca('0x34')][_0x98ca('0x36')]?_0x5bf77d['attributes']:_0x14bfb4[_0x98ca('0x31')];if(!_0x214649[_0x98ca('0x33')]['hasOwnProperty'](_0x98ca('0x37'))){_0x5bf77d[_0x98ca('0x21')]=qs[_0x98ca('0x21')](_0x214649[_0x98ca('0x33')][_0x98ca('0x21')]);_0x5bf77d['offset']=qs[_0x98ca('0x20')](_0x214649[_0x98ca('0x33')]['offset']);}_0x5bf77d[_0x98ca('0x38')]=qs[_0x98ca('0x39')](_0x214649[_0x98ca('0x33')]['sort']);_0x5bf77d[_0x98ca('0x3a')]=qs[_0x98ca('0x3b')](_[_0x98ca('0x3c')](_0x214649['query'],_0x14bfb4[_0x98ca('0x3b')]),_0x342a83);if(_0x214649[_0x98ca('0x33')][_0x98ca('0x3d')]){_0x5bf77d['where']=_['merge'](_0x5bf77d[_0x98ca('0x3a')],{'$or':_[_0x98ca('0x2b')](_0x342a83,function(_0x3b13f9){if(_0x3b13f9['type']!==_0x98ca('0x3e')){var _0x364e37={};_0x364e37[_0x3b13f9[_0x98ca('0x29')]]={'$like':'%'+_0x214649['query'][_0x98ca('0x3d')]+'%'};return _0x364e37;}})});}_0x5bf77d=_[_0x98ca('0x3f')]({},_0x5bf77d,_0x214649[_0x98ca('0x40')]);var _0x450745={'where':_0x5bf77d[_0x98ca('0x3a')]};return db['VtigerField']['count'](_0x450745)['then'](function(_0x405691){_0x540f45[_0x98ca('0x1f')]=_0x405691;if(_0x214649[_0x98ca('0x33')][_0x98ca('0x41')]){_0x5bf77d[_0x98ca('0x42')]=[{'all':!![]}];}return db[_0x98ca('0x2c')][_0x98ca('0x43')](_0x5bf77d);})['then'](function(_0x4900ed){_0x540f45[_0x98ca('0x44')]=_0x4900ed;return _0x540f45;})[_0x98ca('0x26')](respondWithFilteredResult(_0x4f48db,_0x5bf77d))[_0x98ca('0x45')](handleError(_0x4f48db,null));};exports[_0x98ca('0x46')]=function(_0x17fdc7,_0x535fdc){var _0x55161f={'raw':!![],'where':{'id':_0x17fdc7[_0x98ca('0x47')]['id']}},_0x5c0d50={};_0x5c0d50[_0x98ca('0x31')]=_[_0x98ca('0x32')](db[_0x98ca('0x2c')]['rawAttributes']);_0x5c0d50['query']=_[_0x98ca('0x32')](_0x17fdc7[_0x98ca('0x33')]);_0x5c0d50[_0x98ca('0x3b')]=_[_0x98ca('0x48')](_0x5c0d50[_0x98ca('0x31')],_0x5c0d50[_0x98ca('0x33')]);_0x55161f[_0x98ca('0x34')]=_[_0x98ca('0x48')](_0x5c0d50[_0x98ca('0x31')],qs[_0x98ca('0x35')](_0x17fdc7[_0x98ca('0x33')]['fields']));_0x55161f[_0x98ca('0x34')]=_0x55161f[_0x98ca('0x34')][_0x98ca('0x36')]?_0x55161f[_0x98ca('0x34')]:_0x5c0d50[_0x98ca('0x31')];if(_0x17fdc7[_0x98ca('0x33')][_0x98ca('0x41')]){_0x55161f[_0x98ca('0x42')]=[{'all':!![]}];}_0x55161f=_[_0x98ca('0x3f')]({},_0x55161f,_0x17fdc7['options']);return db[_0x98ca('0x2c')][_0x98ca('0x49')](_0x55161f)['then'](handleEntityNotFound(_0x535fdc,null))[_0x98ca('0x26')](respondWithResult(_0x535fdc,null))['catch'](handleError(_0x535fdc,null));};exports[_0x98ca('0x4a')]=function(_0x39f4fd,_0x6a9045){return db[_0x98ca('0x2c')][_0x98ca('0x4a')](_0x39f4fd[_0x98ca('0x4b')],{})[_0x98ca('0x26')](respondWithResult(_0x6a9045,0xc9))[_0x98ca('0x45')](handleError(_0x6a9045,null));};exports[_0x98ca('0x25')]=function(_0x42a53d,_0x15971f){if(_0x42a53d[_0x98ca('0x4b')]['id']){delete _0x42a53d['body']['id'];}return db[_0x98ca('0x2c')][_0x98ca('0x49')]({'where':{'id':_0x42a53d[_0x98ca('0x47')]['id']}})[_0x98ca('0x26')](handleEntityNotFound(_0x15971f,null))['then'](saveUpdates(_0x42a53d[_0x98ca('0x4b')],null))[_0x98ca('0x26')](respondWithResult(_0x15971f,null))[_0x98ca('0x45')](handleError(_0x15971f,null));};exports[_0x98ca('0x4c')]=function(_0x2141ef,_0x254944){return db[_0x98ca('0x2c')]['find']({'where':{'id':_0x2141ef['params']['id']}})['then'](handleEntityNotFound(_0x254944,null))[_0x98ca('0x26')](removeEntity(_0x254944,null))[_0x98ca('0x45')](handleError(_0x254944,null));}; \ No newline at end of file +var _0xc6ac=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','show','create','body','find','catch','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1c3a8f,_0x4e8a24){var _0x473364=function(_0x5a54bc){while(--_0x5a54bc){_0x1c3a8f['push'](_0x1c3a8f['shift']());}};_0x473364(++_0x4e8a24);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5b79f0,_0x1c7577){_0x5b79f0=_0x5b79f0-0x0;var _0x34ec8d=_0xc6ac[_0x5b79f0];return _0x34ec8d;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=_0x403b18[_0xcc6a('0x1e')],_0x4e628f=_0x4133fa[_0xcc6a('0x1f')],_0x4d021a=_0x4133fa[_0xcc6a('0x1f')]+_0x4133fa[_0xcc6a('0x20')],_0x395a55;if(_0x4d021a>=_0x56ffb0){_0x4d021a=_0x56ffb0;_0x395a55=0xc8;}else{_0x395a55=0xce;}_0x337ec5[_0xcc6a('0x1c')](_0x395a55);return _0x337ec5[_0xcc6a('0x21')](_0xcc6a('0x22'),_0x4e628f+'-'+_0x4d021a+'/'+_0x56ffb0)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x2a3994){return function(_0x1d20a3){try{jsonpatch['apply'](_0x1d20a3,_0x2a3994,!![]);}catch(_0xfec60f){return BPromise[_0xcc6a('0x23')](_0xfec60f);}return _0x1d20a3[_0xcc6a('0x24')]();};}function saveUpdates(_0x368a6e,_0x1495d8){return function(_0x30b8ed){if(_0x30b8ed){return _0x30b8ed[_0xcc6a('0x25')](_0x368a6e)[_0xcc6a('0x26')](function(_0x2254a8){return _0x2254a8;});}return null;};}function removeEntity(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['destroy']()[_0xcc6a('0x26')](function(){_0x19d32c[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x27')]();});}};}function handleEntityNotFound(_0x581aae,_0x10016a){return function(_0x294486){if(!_0x294486){_0x581aae[_0xcc6a('0x1b')](0x194);}return _0x294486;};}function handleError(_0x3ed7ce,_0x432c23){_0x432c23=_0x432c23||0x1f4;return function(_0x5fc697){logger['error'](_0x5fc697[_0xcc6a('0x28')]);if(_0x5fc697[_0xcc6a('0x29')]){delete _0x5fc697[_0xcc6a('0x29')];}_0x3ed7ce['status'](_0x432c23)[_0xcc6a('0x2a')](_0x5fc697);};}exports[_0xcc6a('0x2b')]=function(_0x4da301,_0xb377de){var _0x8b1b2b={},_0x3233d1={},_0x473f88={'count':0x0,'rows':[]};var _0x5d7399=_[_0xcc6a('0x2c')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x4f176b){return{'name':_0x4f176b[_0xcc6a('0x2f')],'type':_0x4f176b['type']['key']};});_0x3233d1[_0xcc6a('0x30')]=_[_0xcc6a('0x2c')](_0x5d7399,_0xcc6a('0x29'));_0x3233d1[_0xcc6a('0x31')]=_[_0xcc6a('0x32')](_0x4da301[_0xcc6a('0x31')]);_0x3233d1['filters']=_[_0xcc6a('0x33')](_0x3233d1[_0xcc6a('0x30')],_0x3233d1[_0xcc6a('0x31')]);_0x8b1b2b[_0xcc6a('0x34')]=_[_0xcc6a('0x33')](_0x3233d1[_0xcc6a('0x30')],qs[_0xcc6a('0x35')](_0x4da301[_0xcc6a('0x31')]['fields']));_0x8b1b2b[_0xcc6a('0x34')]=_0x8b1b2b[_0xcc6a('0x34')][_0xcc6a('0x36')]?_0x8b1b2b[_0xcc6a('0x34')]:_0x3233d1[_0xcc6a('0x30')];if(!_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x37')]('nolimit')){_0x8b1b2b[_0xcc6a('0x20')]=qs['limit'](_0x4da301['query']['limit']);_0x8b1b2b[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x1f')]);}_0x8b1b2b[_0xcc6a('0x38')]=qs['sort'](_0x4da301['query'][_0xcc6a('0x39')]);_0x8b1b2b[_0xcc6a('0x3a')]=qs[_0xcc6a('0x3b')](_['pick'](_0x4da301[_0xcc6a('0x31')],_0x3233d1[_0xcc6a('0x3b')]),_0x5d7399);if(_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x3c')]){_0x8b1b2b[_0xcc6a('0x3a')]=_[_0xcc6a('0x3d')](_0x8b1b2b[_0xcc6a('0x3a')],{'$or':_[_0xcc6a('0x2c')](_0x5d7399,function(_0x2a1cd2){if(_0x2a1cd2[_0xcc6a('0x3e')]!==_0xcc6a('0x3f')){var _0x2c14ba={};_0x2c14ba[_0x2a1cd2[_0xcc6a('0x29')]]={'$like':'%'+_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x3c')]+'%'};return _0x2c14ba;}})});}_0x8b1b2b=_[_0xcc6a('0x3d')]({},_0x8b1b2b,_0x4da301[_0xcc6a('0x40')]);var _0x386cbc={'where':_0x8b1b2b['where']};return db['VtigerField'][_0xcc6a('0x1e')](_0x386cbc)[_0xcc6a('0x26')](function(_0x16dde7){_0x473f88[_0xcc6a('0x1e')]=_0x16dde7;if(_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x41')]){_0x8b1b2b[_0xcc6a('0x42')]=[{'all':!![]}];}return db[_0xcc6a('0x2d')]['findAll'](_0x8b1b2b);})['then'](function(_0x470e3b){_0x473f88['rows']=_0x470e3b;return _0x473f88;})['then'](respondWithFilteredResult(_0xb377de,_0x8b1b2b))['catch'](handleError(_0xb377de,null));};exports[_0xcc6a('0x43')]=function(_0x3eebca,_0xb42897){var _0x46e273={'raw':!![],'where':{'id':_0x3eebca['params']['id']}},_0xe8056f={};_0xe8056f[_0xcc6a('0x30')]=_[_0xcc6a('0x32')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0xe8056f[_0xcc6a('0x31')]=_[_0xcc6a('0x32')](_0x3eebca['query']);_0xe8056f[_0xcc6a('0x3b')]=_[_0xcc6a('0x33')](_0xe8056f[_0xcc6a('0x30')],_0xe8056f[_0xcc6a('0x31')]);_0x46e273['attributes']=_[_0xcc6a('0x33')](_0xe8056f['model'],qs[_0xcc6a('0x35')](_0x3eebca[_0xcc6a('0x31')][_0xcc6a('0x35')]));_0x46e273['attributes']=_0x46e273[_0xcc6a('0x34')][_0xcc6a('0x36')]?_0x46e273[_0xcc6a('0x34')]:_0xe8056f['model'];if(_0x3eebca['query'][_0xcc6a('0x41')]){_0x46e273[_0xcc6a('0x42')]=[{'all':!![]}];}_0x46e273=_[_0xcc6a('0x3d')]({},_0x46e273,_0x3eebca[_0xcc6a('0x40')]);return db[_0xcc6a('0x2d')]['find'](_0x46e273)[_0xcc6a('0x26')](handleEntityNotFound(_0xb42897,null))[_0xcc6a('0x26')](respondWithResult(_0xb42897,null))['catch'](handleError(_0xb42897,null));};exports[_0xcc6a('0x44')]=function(_0xa45d06,_0x42ffcc){return db[_0xcc6a('0x2d')][_0xcc6a('0x44')](_0xa45d06[_0xcc6a('0x45')],{})['then'](respondWithResult(_0x42ffcc,0xc9))['catch'](handleError(_0x42ffcc,null));};exports['update']=function(_0x254e83,_0x267e43){if(_0x254e83[_0xcc6a('0x45')]['id']){delete _0x254e83[_0xcc6a('0x45')]['id'];}return db['VtigerField'][_0xcc6a('0x46')]({'where':{'id':_0x254e83['params']['id']}})[_0xcc6a('0x26')](handleEntityNotFound(_0x267e43,null))[_0xcc6a('0x26')](saveUpdates(_0x254e83[_0xcc6a('0x45')],null))[_0xcc6a('0x26')](respondWithResult(_0x267e43,null))[_0xcc6a('0x47')](handleError(_0x267e43,null));};exports[_0xcc6a('0x48')]=function(_0x47b175,_0x1a3b82){return db[_0xcc6a('0x2d')][_0xcc6a('0x46')]({'where':{'id':_0x47b175[_0xcc6a('0x49')]['id']}})[_0xcc6a('0x26')](handleEntityNotFound(_0x1a3b82,null))[_0xcc6a('0x26')](removeEntity(_0x1a3b82,null))[_0xcc6a('0x47')](handleError(_0x1a3b82,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4f1dd7d..a041e21 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x32d236,_0x33a342){var _0x1fa2c3=function(_0x9be744){while(--_0x9be744){_0x32d236['push'](_0x32d236['shift']());}};_0x1fa2c3(++_0x33a342);}(_0x7a54,0x106));var _0x47a5=function(_0x30096c,_0xb95e57){_0x30096c=_0x30096c-0x0;var _0x53271a=_0x7a54[_0x30096c];return _0x53271a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x4c07ab,_0x5561ee){var _0x4b8a42=function(_0x554d2f){while(--_0x554d2f){_0x4c07ab['push'](_0x4c07ab['shift']());}};_0x4b8a42(++_0x5561ee);}(_0x7a54,0x106));var _0x47a5=function(_0x2d1fad,_0x1cc18e){_0x2d1fad=_0x2d1fad-0x0;var _0x585d4c=_0x7a54[_0x2d1fad];return _0x585d4c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index ef632da..1c08574 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 _0x07a2=['error','VtigerField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','stringify'];(function(_0x44eacd,_0x26e949){var _0x1d4d1e=function(_0x17122a){while(--_0x17122a){_0x44eacd['push'](_0x44eacd['shift']());}};_0x1d4d1e(++_0x26e949);}(_0x07a2,0x12c));var _0x207a=function(_0x5d6725,_0x3f6ef9){_0x5d6725=_0x5d6725-0x0;var _0x275399=_0x07a2[_0x5d6725];return _0x275399;};'use strict';var _=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var moment=require('moment');var BPromise=require(_0x207a('0x2'));var rs=require(_0x207a('0x3'));var fs=require('fs');var Redis=require(_0x207a('0x4'));var db=require(_0x207a('0x5'))['db'];var utils=require(_0x207a('0x6'));var logger=require(_0x207a('0x7'))(_0x207a('0x8'));var config=require(_0x207a('0x9'));var jayson=require(_0x207a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18dddc,_0x15d085,_0x7be81c){return new BPromise(function(_0x2a0b70,_0x55412c){return client[_0x207a('0xb')](_0x18dddc,_0x7be81c)['then'](function(_0x5201fe){logger[_0x207a('0xc')]('VtigerField,\x20%s,\x20%s',_0x15d085,'request\x20sent');logger[_0x207a('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x15d085,'request\x20sent',JSON[_0x207a('0xe')](_0x5201fe));if(_0x5201fe[_0x207a('0xf')]){if(_0x5201fe[_0x207a('0xf')]['code']===0x1f4){logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0x5201fe[_0x207a('0xf')]['message']);return _0x55412c(_0x5201fe[_0x207a('0xf')][_0x207a('0x11')]);}logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0x5201fe[_0x207a('0xf')]['message']);return _0x2a0b70(_0x5201fe[_0x207a('0xf')]['message']);}else{logger[_0x207a('0xc')](_0x207a('0x10'),_0x15d085,_0x207a('0x12'));_0x2a0b70(_0x5201fe[_0x207a('0x13')][_0x207a('0x11')]);}})[_0x207a('0x14')](function(_0xd60aa3){logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0xd60aa3);_0x55412c(_0xd60aa3);});});} \ No newline at end of file +var _0xaec5=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5aec('0x0'));var util=require(_0x5aec('0x1'));var moment=require(_0x5aec('0x2'));var BPromise=require(_0x5aec('0x3'));var rs=require(_0x5aec('0x4'));var fs=require('fs');var Redis=require(_0x5aec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aec('0x6'));var logger=require(_0x5aec('0x7'))(_0x5aec('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x476951,_0x3dae8d,_0x215103){return new BPromise(function(_0x28c362,_0x55c01e){return client[_0x5aec('0x9')](_0x476951,_0x215103)[_0x5aec('0xa')](function(_0x5b5bb3){logger[_0x5aec('0xb')](_0x5aec('0xc'),_0x3dae8d,_0x5aec('0xd'));logger[_0x5aec('0xe')](_0x5aec('0xf'),_0x3dae8d,_0x5aec('0xd'),JSON[_0x5aec('0x10')](_0x5b5bb3));if(_0x5b5bb3['error']){if(_0x5b5bb3['error'][_0x5aec('0x11')]===0x1f4){logger[_0x5aec('0x12')](_0x5aec('0xc'),_0x3dae8d,_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);return _0x55c01e(_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);}logger[_0x5aec('0x12')](_0x5aec('0xc'),_0x3dae8d,_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);return _0x28c362(_0x5b5bb3['error'][_0x5aec('0x13')]);}else{logger[_0x5aec('0xb')]('VtigerField,\x20%s,\x20%s',_0x3dae8d,_0x5aec('0xd'));_0x28c362(_0x5b5bb3['result'][_0x5aec('0x13')]);}})[_0x5aec('0x14')](function(_0x28f415){logger[_0x5aec('0x12')]('VtigerField,\x20%s,\x20%s',_0x3dae8d,_0x28f415);_0x55c01e(_0x28f415);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f60e77b..2631071 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 _0x24db=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x4dd354,_0x23084d){var _0x5321a7=function(_0x2bbf02){while(--_0x2bbf02){_0x4dd354['push'](_0x4dd354['shift']());}};_0x5321a7(++_0x23084d);}(_0x24db,0x17d));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb24d('0x0'));var path=require(_0xb24d('0x1'));var timeout=require(_0xb24d('0x2'));var express=require(_0xb24d('0x3'));var router=express[_0xb24d('0x4')]();var auth=require(_0xb24d('0x5'));var interaction=require(_0xb24d('0x6'));var config=require(_0xb24d('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb24d('0x8')]);router[_0xb24d('0x9')](_0xb24d('0xa'),auth[_0xb24d('0xb')](),controller[_0xb24d('0xc')]);router[_0xb24d('0x9')](_0xb24d('0xd'),auth['isAuthenticated'](),controller[_0xb24d('0xe')]);router[_0xb24d('0x9')](_0xb24d('0xf'),auth[_0xb24d('0xb')](),controller[_0xb24d('0x10')]);router[_0xb24d('0x11')]('/',auth[_0xb24d('0xb')](),controller['create']);router['post']('/:id/configurations',auth[_0xb24d('0xb')](),controller['addConfiguration']);router[_0xb24d('0x12')](_0xb24d('0xa'),auth[_0xb24d('0xb')](),controller[_0xb24d('0x13')]);router[_0xb24d('0x14')]('/:id',auth[_0xb24d('0xb')](),controller[_0xb24d('0x15')]);module[_0xb24d('0x16')]=router; \ No newline at end of file +var _0x49c9=['util','connect-timeout','express','Router','../../config/environment','get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x587783,_0x6296e6){var _0x1cca44=function(_0x2c5082){while(--_0x2c5082){_0x587783['push'](_0x587783['shift']());}};_0x1cca44(++_0x6296e6);}(_0x49c9,0x164));var _0x949c=function(_0x290024,_0x24f6ba){_0x290024=_0x290024-0x0;var _0x5628f9=_0x49c9[_0x290024];return _0x5628f9;};'use strict';var multer=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var path=require('path');var timeout=require(_0x949c('0x2'));var express=require(_0x949c('0x3'));var router=express[_0x949c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x949c('0x5'));var controller=require('./intZendeskAccount.controller');router[_0x949c('0x6')]('/',auth['isAuthenticated'](),controller[_0x949c('0x7')]);router['get'](_0x949c('0x8'),auth['isAuthenticated'](),controller[_0x949c('0x9')]);router[_0x949c('0x6')]('/:id/configurations',auth[_0x949c('0xa')](),controller[_0x949c('0xb')]);router[_0x949c('0x6')](_0x949c('0xc'),auth[_0x949c('0xa')](),controller[_0x949c('0xd')]);router[_0x949c('0xe')]('/',auth[_0x949c('0xa')](),controller['create']);router[_0x949c('0xe')](_0x949c('0xf'),auth[_0x949c('0xa')](),controller[_0x949c('0x10')]);router[_0x949c('0x11')](_0x949c('0x8'),auth[_0x949c('0xa')](),controller['update']);router[_0x949c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x949c('0x13')]);module[_0x949c('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 f352134..3d10c84 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 _0x0d31=['password','token','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x25c27a,_0x1f0780){var _0x1bb0d2=function(_0x1feb1b){while(--_0x1feb1b){_0x25c27a['push'](_0x25c27a['shift']());}};_0x1bb0d2(++_0x1f0780);}(_0x0d31,0x1a1));var _0x10d3=function(_0xda582b,_0x27008d){_0xda582b=_0xda582b-0x0;var _0x57abfb=_0x0d31[_0xda582b];return _0x57abfb;};'use strict';var Sequelize=require(_0x10d3('0x0'));module[_0x10d3('0x1')]={'name':{'type':Sequelize[_0x10d3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x10d3('0x2')],'unique':_0x10d3('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x10d3('0x2')]},'remoteUri':{'type':Sequelize[_0x10d3('0x2')],'unique':_0x10d3('0x4')},'authType':{'type':Sequelize[_0x10d3('0x5')](_0x10d3('0x6'),_0x10d3('0x7')),'defaultValue':_0x10d3('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x10d3('0x5')](_0x10d3('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb7c7=['username','remoteUri','password','token','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0xb7c7,0x129));var _0x7b7c=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0xb7c7[_0x1ae491];return _0x4958a5;};'use strict';var Sequelize=require(_0x7b7c('0x0'));module[_0x7b7c('0x1')]={'name':{'type':Sequelize[_0x7b7c('0x2')]},'description':{'type':Sequelize[_0x7b7c('0x2')]},'username':{'type':Sequelize[_0x7b7c('0x2')],'unique':_0x7b7c('0x3')},'password':{'type':Sequelize[_0x7b7c('0x2')]},'token':{'type':Sequelize[_0x7b7c('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7b7c('0x4')},'authType':{'type':Sequelize['ENUM'](_0x7b7c('0x5'),_0x7b7c('0x6')),'defaultValue':_0x7b7c('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7b7c('0x7')](_0x7b7c('0x8'),_0x7b7c('0x9')),'defaultValue':_0x7b7c('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index dfb861e..23c980a 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 _0xeffd=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','fields','length','find','create','body','params','findOne','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','headers','Basic\x20%s','toString','base64','%s/token:%s','token','ValidationError','subject','description','assignee','remove','ticket_fields','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x13cf6c,_0xcd7c1b){var _0x29ff13=function(_0x2da48a){while(--_0x2da48a){_0x13cf6c['push'](_0x13cf6c['shift']());}};_0x29ff13(++_0xcd7c1b);}(_0xeffd,0x6b));var _0xdeff=function(_0x571d45,_0x1af521){_0x571d45=_0x571d45-0x0;var _0x2e9600=_0xeffd[_0x571d45];return _0x2e9600;};'use strict';var pdf=require(_0xdeff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdeff('0x1'));var zipdir=require(_0xdeff('0x2'));var jsonpatch=require(_0xdeff('0x3'));var rp=require(_0xdeff('0x4'));var moment=require(_0xdeff('0x5'));var BPromise=require(_0xdeff('0x6'));var Mustache=require(_0xdeff('0x7'));var util=require(_0xdeff('0x8'));var path=require(_0xdeff('0x9'));var sox=require(_0xdeff('0xa'));var csv=require(_0xdeff('0xb'));var ejs=require(_0xdeff('0xc'));var fs=require('fs');var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdeff('0x1d'));var jayson=require(_0xdeff('0x1e'));var client=jayson['client'][_0xdeff('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4e7526,_0x4d411e,_0x3e56a1,_0x47410f){return new BPromise(function(_0x1585e8,_0xb4bc82){var _0x48f0e8=_0x47410f||client;return _0x48f0e8[_0xdeff('0x20')](_0x4e7526,_0x3e56a1)[_0xdeff('0x21')](function(_0xea6c4){logger[_0xdeff('0x22')](_0xdeff('0x23'),_0x4d411e,_0xdeff('0x24'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4d411e,_0xdeff('0x24'),JSON['stringify'](_0xea6c4));if(_0xea6c4['error']){if(_0xea6c4[_0xdeff('0x25')][_0xdeff('0x26')]===0x1f4){logger['error'](_0xdeff('0x23'),_0x4d411e,_0xea6c4[_0xdeff('0x25')][_0xdeff('0x27')]);return _0xb4bc82(_0xea6c4[_0xdeff('0x25')][_0xdeff('0x27')]);}logger[_0xdeff('0x25')](_0xdeff('0x23'),_0x4d411e,_0xea6c4[_0xdeff('0x25')]['message']);return _0x1585e8(_0xea6c4['error']['message']);}else{logger[_0xdeff('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x4d411e,_0xdeff('0x24'));_0x1585e8(_0xea6c4[_0xdeff('0x28')]['message']);}})[_0xdeff('0x29')](function(_0x21981e){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4d411e,_0x21981e);_0xb4bc82(_0x21981e);});});}function respondWithStatusCode(_0x3b2554,_0x15c425){_0x15c425=_0x15c425||0xcc;return function(_0x253eed){if(_0x253eed){return _0x3b2554[_0xdeff('0x2a')](_0x15c425);}return _0x3b2554[_0xdeff('0x2b')](_0x15c425)['end']();};}function respondWithResult(_0xb08f19,_0x412db3){_0x412db3=_0x412db3||0xc8;return function(_0x3741fb){if(_0x3741fb){return _0xb08f19[_0xdeff('0x2b')](_0x412db3)[_0xdeff('0x2c')](_0x3741fb);}};}function respondWithFilteredResult(_0x35823c,_0x3d0111){return function(_0x52ea5d){if(_0x52ea5d){var _0x31bb72=_0x52ea5d[_0xdeff('0x2d')],_0x1a546c=_0x3d0111[_0xdeff('0x2e')],_0x53b168=_0x3d0111[_0xdeff('0x2e')]+_0x3d0111[_0xdeff('0x2f')],_0x4dd366;if(_0x53b168>=_0x31bb72){_0x53b168=_0x31bb72;_0x4dd366=0xc8;}else{_0x4dd366=0xce;}_0x35823c[_0xdeff('0x2b')](_0x4dd366);return _0x35823c[_0xdeff('0x30')](_0xdeff('0x31'),_0x1a546c+'-'+_0x53b168+'/'+_0x31bb72)['json'](_0x52ea5d);}return null;};}function patchUpdates(_0x331ddc){return function(_0x167e07){try{jsonpatch[_0xdeff('0x32')](_0x167e07,_0x331ddc,!![]);}catch(_0x5045b8){return BPromise['reject'](_0x5045b8);}return _0x167e07[_0xdeff('0x33')]();};}function saveUpdates(_0x505e3f,_0x69842a){return function(_0x145d8b){if(_0x145d8b){return _0x145d8b[_0xdeff('0x34')](_0x505e3f)['then'](function(_0x189a51){return _0x189a51;});}return null;};}function removeEntity(_0x563eba,_0x4ba2b2){return function(_0x45fcde){if(_0x45fcde){return _0x45fcde[_0xdeff('0x35')]()[_0xdeff('0x21')](function(){_0x563eba[_0xdeff('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f91d8,_0x1f5ea9){return function(_0x31f6c7){if(!_0x31f6c7){_0x3f91d8[_0xdeff('0x2a')](0x194);}return _0x31f6c7;};}function handleError(_0x1ae013,_0x78382e){_0x78382e=_0x78382e||0x1f4;return function(_0x321ef0){logger['error'](_0x321ef0[_0xdeff('0x36')]);if(_0x321ef0['name']){delete _0x321ef0[_0xdeff('0x37')];}_0x1ae013[_0xdeff('0x2b')](_0x78382e)[_0xdeff('0x38')](_0x321ef0);};}exports[_0xdeff('0x39')]=function(_0x210dd6,_0x965c5b){var _0x52baf5={},_0x25801b={},_0x3bf462={'count':0x0,'rows':[]};var _0x4e97cf=_[_0xdeff('0x3a')](db[_0xdeff('0x3b')][_0xdeff('0x3c')],function(_0x387c19){return{'name':_0x387c19[_0xdeff('0x3d')],'type':_0x387c19[_0xdeff('0x3e')][_0xdeff('0x3f')]};});_0x25801b[_0xdeff('0x40')]=_['map'](_0x4e97cf,_0xdeff('0x37'));_0x25801b['query']=_[_0xdeff('0x41')](_0x210dd6[_0xdeff('0x42')]);_0x25801b[_0xdeff('0x43')]=_['intersection'](_0x25801b[_0xdeff('0x40')],_0x25801b[_0xdeff('0x42')]);_0x52baf5[_0xdeff('0x44')]=_[_0xdeff('0x45')](_0x25801b[_0xdeff('0x40')],qs['fields'](_0x210dd6[_0xdeff('0x42')]['fields']));_0x52baf5[_0xdeff('0x44')]=_0x52baf5[_0xdeff('0x44')]['length']?_0x52baf5[_0xdeff('0x44')]:_0x25801b[_0xdeff('0x40')];if(!_0x210dd6[_0xdeff('0x42')][_0xdeff('0x46')](_0xdeff('0x47'))){_0x52baf5['limit']=qs[_0xdeff('0x2f')](_0x210dd6[_0xdeff('0x42')][_0xdeff('0x2f')]);_0x52baf5[_0xdeff('0x2e')]=qs[_0xdeff('0x2e')](_0x210dd6['query']['offset']);}_0x52baf5[_0xdeff('0x48')]=qs[_0xdeff('0x49')](_0x210dd6[_0xdeff('0x42')][_0xdeff('0x49')]);_0x52baf5[_0xdeff('0x4a')]=qs[_0xdeff('0x43')](_[_0xdeff('0x4b')](_0x210dd6['query'],_0x25801b[_0xdeff('0x43')]),_0x4e97cf);if(_0x210dd6[_0xdeff('0x42')][_0xdeff('0x4c')]){_0x52baf5['where']=_[_0xdeff('0x4d')](_0x52baf5[_0xdeff('0x4a')],{'$or':_[_0xdeff('0x3a')](_0x4e97cf,function(_0x43f457){if(_0x43f457['type']!==_0xdeff('0x4e')){var _0x362f99={};_0x362f99[_0x43f457[_0xdeff('0x37')]]={'$like':'%'+_0x210dd6[_0xdeff('0x42')][_0xdeff('0x4c')]+'%'};return _0x362f99;}})});}_0x52baf5=_[_0xdeff('0x4d')]({},_0x52baf5,_0x210dd6[_0xdeff('0x4f')]);var _0x460965={'where':_0x52baf5['where']};return db[_0xdeff('0x3b')][_0xdeff('0x2d')](_0x460965)[_0xdeff('0x21')](function(_0x473d32){_0x3bf462[_0xdeff('0x2d')]=_0x473d32;if(_0x210dd6['query'][_0xdeff('0x50')]){_0x52baf5[_0xdeff('0x51')]=[{'all':!![]}];}return db[_0xdeff('0x3b')][_0xdeff('0x52')](_0x52baf5);})[_0xdeff('0x21')](function(_0x5cddcc){_0x3bf462[_0xdeff('0x53')]=_0x5cddcc;return _0x3bf462;})['then'](respondWithFilteredResult(_0x965c5b,_0x52baf5))[_0xdeff('0x29')](handleError(_0x965c5b,null));};exports[_0xdeff('0x54')]=function(_0x1bf17c,_0x46c428){var _0xf58aa6={'raw':![],'where':{'id':_0x1bf17c['params']['id']}},_0x15b02c={};_0x15b02c['model']=_[_0xdeff('0x41')](db[_0xdeff('0x3b')][_0xdeff('0x3c')]);_0x15b02c['query']=_['keys'](_0x1bf17c[_0xdeff('0x42')]);_0x15b02c[_0xdeff('0x43')]=_['intersection'](_0x15b02c[_0xdeff('0x40')],_0x15b02c[_0xdeff('0x42')]);_0xf58aa6[_0xdeff('0x44')]=_['intersection'](_0x15b02c[_0xdeff('0x40')],qs[_0xdeff('0x55')](_0x1bf17c[_0xdeff('0x42')]['fields']));_0xf58aa6[_0xdeff('0x44')]=_0xf58aa6[_0xdeff('0x44')][_0xdeff('0x56')]?_0xf58aa6[_0xdeff('0x44')]:_0x15b02c[_0xdeff('0x40')];if(_0x1bf17c[_0xdeff('0x42')][_0xdeff('0x50')]){_0xf58aa6['include']=[{'all':!![]}];}_0xf58aa6=_[_0xdeff('0x4d')]({},_0xf58aa6,_0x1bf17c[_0xdeff('0x4f')]);return db['ZendeskAccount'][_0xdeff('0x57')](_0xf58aa6)[_0xdeff('0x21')](handleEntityNotFound(_0x46c428,null))[_0xdeff('0x21')](respondWithResult(_0x46c428,null))[_0xdeff('0x29')](handleError(_0x46c428,null));};exports[_0xdeff('0x58')]=function(_0xfb097c,_0x473d9d){return db[_0xdeff('0x3b')]['create'](_0xfb097c[_0xdeff('0x59')],{})[_0xdeff('0x21')](respondWithResult(_0x473d9d,0xc9))[_0xdeff('0x29')](handleError(_0x473d9d,null));};exports['update']=function(_0x4e78db,_0x1e43a6){if(_0x4e78db[_0xdeff('0x59')]['id']){delete _0x4e78db[_0xdeff('0x59')]['id'];}return db[_0xdeff('0x3b')][_0xdeff('0x57')]({'where':{'id':_0x4e78db[_0xdeff('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e43a6,null))['then'](saveUpdates(_0x4e78db[_0xdeff('0x59')],null))[_0xdeff('0x21')](respondWithResult(_0x1e43a6,null))['catch'](handleError(_0x1e43a6,null));};exports['destroy']=function(_0x3b3276,_0x407001){return db['ZendeskAccount'][_0xdeff('0x57')]({'where':{'id':_0x3b3276[_0xdeff('0x5a')]['id']}})['then'](handleEntityNotFound(_0x407001,null))[_0xdeff('0x21')](removeEntity(_0x407001,null))[_0xdeff('0x29')](handleError(_0x407001,null));};exports['getConfigurations']=function(_0x3087ea,_0x339717,_0x5439a4){var _0x388b81={};var _0x152187={};var _0x2a83ac;var _0x592ea6;return db['ZendeskAccount'][_0xdeff('0x5b')]({'where':{'id':_0x3087ea['params']['id']}})[_0xdeff('0x21')](handleEntityNotFound(_0x339717,null))[_0xdeff('0x21')](function(_0x80035d){if(_0x80035d){_0x2a83ac=_0x80035d;_0x152187[_0xdeff('0x40')]=_[_0xdeff('0x41')](db['ZendeskConfiguration']['rawAttributes']);_0x152187[_0xdeff('0x42')]=_[_0xdeff('0x41')](_0x3087ea[_0xdeff('0x42')]);_0x152187[_0xdeff('0x43')]=_[_0xdeff('0x45')](_0x152187[_0xdeff('0x40')],_0x152187['query']);_0x388b81[_0xdeff('0x44')]=_['intersection'](_0x152187[_0xdeff('0x40')],qs[_0xdeff('0x55')](_0x3087ea[_0xdeff('0x42')][_0xdeff('0x55')]));_0x388b81[_0xdeff('0x44')]=_0x388b81[_0xdeff('0x44')][_0xdeff('0x56')]?_0x388b81[_0xdeff('0x44')]:_0x152187[_0xdeff('0x40')];_0x388b81['order']=qs[_0xdeff('0x49')](_0x3087ea['query'][_0xdeff('0x49')]);_0x388b81[_0xdeff('0x4a')]=qs['filters'](_[_0xdeff('0x4b')](_0x3087ea['query'],_0x152187[_0xdeff('0x43')]));if(_0x3087ea['query']['filter']){_0x388b81[_0xdeff('0x4a')]=_[_0xdeff('0x4d')](_0x388b81['where'],{'$or':_[_0xdeff('0x3a')](_0x388b81[_0xdeff('0x44')],function(_0x98552f){var _0x3a04fd={};_0x3a04fd[_0x98552f]={'$like':'%'+_0x3087ea[_0xdeff('0x42')][_0xdeff('0x4c')]+'%'};return _0x3a04fd;})});}_0x388b81=_[_0xdeff('0x4d')]({},_0x388b81,_0x3087ea[_0xdeff('0x4f')]);return _0x2a83ac[_0xdeff('0x5c')](_0x388b81);}})['then'](function(_0x1f71ee){if(_0x1f71ee){_0x592ea6=_0x1f71ee[_0xdeff('0x56')];if(!_0x3087ea['query']['hasOwnProperty'](_0xdeff('0x47'))){_0x388b81[_0xdeff('0x2f')]=qs['limit'](_0x3087ea[_0xdeff('0x42')][_0xdeff('0x2f')]);_0x388b81[_0xdeff('0x2e')]=qs[_0xdeff('0x2e')](_0x3087ea[_0xdeff('0x42')][_0xdeff('0x2e')]);}return _0x2a83ac[_0xdeff('0x5c')](_0x388b81);}})[_0xdeff('0x21')](function(_0x15cfb4){if(_0x15cfb4){return _0x15cfb4?{'count':_0x592ea6,'rows':_0x15cfb4}:null;}})[_0xdeff('0x21')](respondWithResult(_0x339717,null))['catch'](handleError(_0x339717,null));};exports[_0xdeff('0x5d')]=function(_0x169145,_0x190191,_0x44bad3){if(_0x169145[_0xdeff('0x59')]['id']){delete _0x169145['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x169145[_0xdeff('0x5a')]['id']}})[_0xdeff('0x21')](handleEntityNotFound(_0x190191,null))[_0xdeff('0x21')](function(_0x5e85dc){if(_0x5e85dc){_0x169145['body']['AccountId']=_0x5e85dc['id'];_0x169145[_0xdeff('0x59')][_0xdeff('0x5e')]=integrations[_0xdeff('0x5f')](_0x169145[_0xdeff('0x59')][_0xdeff('0x60')],_0x169145[_0xdeff('0x59')][_0xdeff('0x3e')]);_0x169145[_0xdeff('0x59')]['Descriptions']=integrations[_0xdeff('0x61')](_0x169145[_0xdeff('0x59')][_0xdeff('0x60')],_0x169145[_0xdeff('0x59')][_0xdeff('0x3e')]);return db[_0xdeff('0x62')][_0xdeff('0x58')](_0x169145[_0xdeff('0x59')],{'include':[{'model':db[_0xdeff('0x63')],'as':_0xdeff('0x5e')},{'model':db[_0xdeff('0x63')],'as':_0xdeff('0x64')}]});}return null;})['then'](respondWithResult(_0x190191,null))[_0xdeff('0x29')](handleError(_0x190191,null));};exports[_0xdeff('0x65')]=function(_0x1fa20b,_0x54adce,_0x17c78a){var _0x302e78='';return db[_0xdeff('0x3b')][_0xdeff('0x5b')]({'where':{'id':_0x1fa20b['params']['id']},'attributes':['id',_0xdeff('0x66'),_0xdeff('0x67'),'token',_0xdeff('0x68'),_0xdeff('0x69')]})[_0xdeff('0x21')](handleEntityNotFound(_0x54adce,null))[_0xdeff('0x21')](function(_0x2cf348){if(_0x2cf348){_0x302e78=_0x2cf348['remoteUri'];var _0x1ee669=_0x302e78[_0xdeff('0x6a')](-0x1);if(_0x1ee669==='/'){_0x302e78=_0x302e78[_0xdeff('0x6b')](0x0,_0x302e78[_0xdeff('0x6c')](_0x1ee669));}var _0xe85561={'method':'GET','uri':util[_0xdeff('0x6d')](_0xdeff('0x6e'),_0x302e78,'ticket_fields'),'json':!![]};switch(_0x2cf348[_0xdeff('0x68')]){case _0xdeff('0x67'):_0xe85561[_0xdeff('0x6f')]={'Authorization':util['format'](_0xdeff('0x70'),new Buffer(util[_0xdeff('0x6d')]('%s:%s',_0x2cf348[_0xdeff('0x66')],_0x2cf348[_0xdeff('0x67')]))[_0xdeff('0x71')](_0xdeff('0x72')))};break;case'token':_0xe85561[_0xdeff('0x6f')]={'Authorization':util[_0xdeff('0x6d')](_0xdeff('0x70'),new Buffer(util[_0xdeff('0x6d')](_0xdeff('0x73'),_0x2cf348[_0xdeff('0x66')],_0x2cf348[_0xdeff('0x74')]))[_0xdeff('0x71')](_0xdeff('0x72')))};break;default:throw new db['Sequelize'][(_0xdeff('0x75'))]('Unknown\x20authentication\x20type');}return rp(_0xe85561);}})[_0xdeff('0x21')](function(_0x54db11){if(_0x54db11){var _0x5246b3=[_0xdeff('0x76'),_0xdeff('0x77'),'group',_0xdeff('0x78')];_[_0xdeff('0x79')](_0x54db11[_0xdeff('0x7a')],function(_0x3dfd5e){return _0x5246b3['includes'](_0x3dfd5e[_0xdeff('0x3e')]);});return{'count':_0x54db11[_0xdeff('0x7a')]['length'],'rows':_[_0xdeff('0x3a')](_0x54db11[_0xdeff('0x7a')],function(_0x3eeb2d){return{'id':_0x3eeb2d['id'],'name':_0x3eeb2d[_0xdeff('0x7b')]>0x7?_0x3eeb2d[_0xdeff('0x7c')]:_0x3eeb2d[_0xdeff('0x3e')],'custom':_0x3eeb2d[_0xdeff('0x7b')]>0x7?!![]:![],'options':_0x3eeb2d[_0xdeff('0x7d')]?_0x3eeb2d['system_field_options']:_0x3eeb2d['custom_field_options']?_0x3eeb2d[_0xdeff('0x7e')]:[]};})};}})['then'](respondWithResult(_0x54adce,null))[_0xdeff('0x29')](function(_0x299703){var _0x5e9c02=_0x1fa20b[_0xdeff('0x42')][_0xdeff('0x7f')]?0x1f4:_0x299703[_0xdeff('0x80')]||0x1f4;logger['error'](_0xdeff('0x81'),_0xdeff('0x65'),_0x5e9c02,JSON[_0xdeff('0x82')](_0x299703));delete _0x299703[_0xdeff('0x37')];if(_0x5e9c02===0x191){_0x5e9c02=0x190;}_0x54adce['status'](_0x5e9c02)[_0xdeff('0x38')](_0x1fa20b['query'][_0xdeff('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x299703[_0xdeff('0x80')]}:_0x299703);});}; \ No newline at end of file +var _0x5706=['sort','where','filters','pick','merge','VIRTUAL','include','show','includeAll','options','find','create','body','params','findOne','ZendeskConfiguration','filter','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','GET','format','%s/%s','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','ValidationError','subject','description','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','destroy','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order'];(function(_0x59368d,_0x201dc6){var _0x38a12e=function(_0x140c1b){while(--_0x140c1b){_0x59368d['push'](_0x59368d['shift']());}};_0x38a12e(++_0x201dc6);}(_0x5706,0xb0));var _0x6570=function(_0x4fc954,_0x40f058){_0x4fc954=_0x4fc954-0x0;var _0x12c816=_0x5706[_0x4fc954];return _0x12c816;};'use strict';var pdf=require(_0x6570('0x0'));var emlformat=require(_0x6570('0x1'));var rimraf=require(_0x6570('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6570('0x3'));var rp=require('request-promise');var moment=require(_0x6570('0x4'));var BPromise=require(_0x6570('0x5'));var Mustache=require(_0x6570('0x6'));var util=require(_0x6570('0x7'));var path=require(_0x6570('0x8'));var sox=require(_0x6570('0x9'));var csv=require(_0x6570('0xa'));var ejs=require(_0x6570('0xb'));var fs=require('fs');var _=require(_0x6570('0xc'));var squel=require(_0x6570('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6570('0xe'));var toCsv=require(_0x6570('0xa'));var querystring=require(_0x6570('0xf'));var Papa=require(_0x6570('0x10'));var Redis=require(_0x6570('0x11'));var authService=require(_0x6570('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6570('0x13'))(_0x6570('0x14'));var utils=require(_0x6570('0x15'));var config=require(_0x6570('0x16'));var licenseUtil=require(_0x6570('0x17'));var db=require(_0x6570('0x18'))['db'];var integrations=require(_0x6570('0x19'));var jayson=require(_0x6570('0x1a'));var client=jayson[_0x6570('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdc293b,_0x105834,_0x311474,_0x2ee764){return new BPromise(function(_0x27c69b,_0x11b003){var _0x29f176=_0x2ee764||client;return _0x29f176[_0x6570('0x1c')](_0xdc293b,_0x311474)[_0x6570('0x1d')](function(_0x45c48c){logger[_0x6570('0x1e')](_0x6570('0x1f'),_0x105834,'request\x20sent');logger[_0x6570('0x20')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x105834,_0x6570('0x21'),JSON[_0x6570('0x22')](_0x45c48c));if(_0x45c48c[_0x6570('0x23')]){if(_0x45c48c[_0x6570('0x23')][_0x6570('0x24')]===0x1f4){logger[_0x6570('0x23')](_0x6570('0x1f'),_0x105834,_0x45c48c[_0x6570('0x23')][_0x6570('0x25')]);return _0x11b003(_0x45c48c['error'][_0x6570('0x25')]);}logger[_0x6570('0x23')](_0x6570('0x1f'),_0x105834,_0x45c48c[_0x6570('0x23')]['message']);return _0x27c69b(_0x45c48c[_0x6570('0x23')][_0x6570('0x25')]);}else{logger[_0x6570('0x1e')](_0x6570('0x1f'),_0x105834,'request\x20sent');_0x27c69b(_0x45c48c['result']['message']);}})[_0x6570('0x26')](function(_0x5a1e55){logger[_0x6570('0x23')](_0x6570('0x1f'),_0x105834,_0x5a1e55);_0x11b003(_0x5a1e55);});});}function respondWithStatusCode(_0x2d4ba9,_0x5c49df){_0x5c49df=_0x5c49df||0xcc;return function(_0x5b0225){if(_0x5b0225){return _0x2d4ba9[_0x6570('0x27')](_0x5c49df);}return _0x2d4ba9['status'](_0x5c49df)[_0x6570('0x28')]();};}function respondWithResult(_0x5743b6,_0x133c10){_0x133c10=_0x133c10||0xc8;return function(_0x19dff7){if(_0x19dff7){return _0x5743b6['status'](_0x133c10)['json'](_0x19dff7);}};}function respondWithFilteredResult(_0x210724,_0x28fced){return function(_0x49ebef){if(_0x49ebef){var _0x64e440=_0x49ebef[_0x6570('0x29')],_0x425e7c=_0x28fced[_0x6570('0x2a')],_0x429c2c=_0x28fced[_0x6570('0x2a')]+_0x28fced[_0x6570('0x2b')],_0x2d341b;if(_0x429c2c>=_0x64e440){_0x429c2c=_0x64e440;_0x2d341b=0xc8;}else{_0x2d341b=0xce;}_0x210724[_0x6570('0x2c')](_0x2d341b);return _0x210724['set'](_0x6570('0x2d'),_0x425e7c+'-'+_0x429c2c+'/'+_0x64e440)[_0x6570('0x2e')](_0x49ebef);}return null;};}function patchUpdates(_0xcf9c88){return function(_0x127988){try{jsonpatch[_0x6570('0x2f')](_0x127988,_0xcf9c88,!![]);}catch(_0x2df23f){return BPromise[_0x6570('0x30')](_0x2df23f);}return _0x127988['save']();};}function saveUpdates(_0x24bcb8,_0x324b51){return function(_0x3f68fa){if(_0x3f68fa){return _0x3f68fa['update'](_0x24bcb8)['then'](function(_0x48966e){return _0x48966e;});}return null;};}function removeEntity(_0xf3db02,_0x534132){return function(_0x248f04){if(_0x248f04){return _0x248f04[_0x6570('0x31')]()[_0x6570('0x1d')](function(){_0xf3db02[_0x6570('0x2c')](0xcc)[_0x6570('0x28')]();});}};}function handleEntityNotFound(_0x315586,_0x109ec6){return function(_0x1f930a){if(!_0x1f930a){_0x315586[_0x6570('0x27')](0x194);}return _0x1f930a;};}function handleError(_0x3b5405,_0x51c9f3){_0x51c9f3=_0x51c9f3||0x1f4;return function(_0x28551a){logger[_0x6570('0x23')](_0x28551a[_0x6570('0x32')]);if(_0x28551a[_0x6570('0x33')]){delete _0x28551a[_0x6570('0x33')];}_0x3b5405['status'](_0x51c9f3)['send'](_0x28551a);};}exports[_0x6570('0x34')]=function(_0x4b178a,_0x57ee0c){var _0x366d77={},_0x45c163={},_0x2b14cb={'count':0x0,'rows':[]};var _0x63c4ed=_[_0x6570('0x35')](db[_0x6570('0x36')][_0x6570('0x37')],function(_0x3a9e4d){return{'name':_0x3a9e4d[_0x6570('0x38')],'type':_0x3a9e4d[_0x6570('0x39')][_0x6570('0x3a')]};});_0x45c163[_0x6570('0x3b')]=_[_0x6570('0x35')](_0x63c4ed,_0x6570('0x33'));_0x45c163[_0x6570('0x3c')]=_[_0x6570('0x3d')](_0x4b178a[_0x6570('0x3c')]);_0x45c163['filters']=_['intersection'](_0x45c163[_0x6570('0x3b')],_0x45c163['query']);_0x366d77[_0x6570('0x3e')]=_[_0x6570('0x3f')](_0x45c163[_0x6570('0x3b')],qs[_0x6570('0x40')](_0x4b178a[_0x6570('0x3c')][_0x6570('0x40')]));_0x366d77[_0x6570('0x3e')]=_0x366d77['attributes'][_0x6570('0x41')]?_0x366d77[_0x6570('0x3e')]:_0x45c163['model'];if(!_0x4b178a[_0x6570('0x3c')][_0x6570('0x42')]('nolimit')){_0x366d77[_0x6570('0x2b')]=qs[_0x6570('0x2b')](_0x4b178a['query'][_0x6570('0x2b')]);_0x366d77[_0x6570('0x2a')]=qs['offset'](_0x4b178a[_0x6570('0x3c')]['offset']);}_0x366d77[_0x6570('0x43')]=qs[_0x6570('0x44')](_0x4b178a['query']['sort']);_0x366d77[_0x6570('0x45')]=qs[_0x6570('0x46')](_[_0x6570('0x47')](_0x4b178a[_0x6570('0x3c')],_0x45c163[_0x6570('0x46')]),_0x63c4ed);if(_0x4b178a[_0x6570('0x3c')]['filter']){_0x366d77[_0x6570('0x45')]=_[_0x6570('0x48')](_0x366d77[_0x6570('0x45')],{'$or':_[_0x6570('0x35')](_0x63c4ed,function(_0x4b5e70){if(_0x4b5e70[_0x6570('0x39')]!==_0x6570('0x49')){var _0x59dece={};_0x59dece[_0x4b5e70[_0x6570('0x33')]]={'$like':'%'+_0x4b178a[_0x6570('0x3c')]['filter']+'%'};return _0x59dece;}})});}_0x366d77=_[_0x6570('0x48')]({},_0x366d77,_0x4b178a['options']);var _0x3d1f20={'where':_0x366d77[_0x6570('0x45')]};return db[_0x6570('0x36')][_0x6570('0x29')](_0x3d1f20)[_0x6570('0x1d')](function(_0x5298fd){_0x2b14cb['count']=_0x5298fd;if(_0x4b178a[_0x6570('0x3c')]['includeAll']){_0x366d77[_0x6570('0x4a')]=[{'all':!![]}];}return db[_0x6570('0x36')]['findAll'](_0x366d77);})[_0x6570('0x1d')](function(_0x4255cf){_0x2b14cb['rows']=_0x4255cf;return _0x2b14cb;})[_0x6570('0x1d')](respondWithFilteredResult(_0x57ee0c,_0x366d77))[_0x6570('0x26')](handleError(_0x57ee0c,null));};exports[_0x6570('0x4b')]=function(_0xbcb6fc,_0x2b2de6){var _0x8709bd={'raw':![],'where':{'id':_0xbcb6fc['params']['id']}},_0x36031d={};_0x36031d[_0x6570('0x3b')]=_[_0x6570('0x3d')](db['ZendeskAccount']['rawAttributes']);_0x36031d[_0x6570('0x3c')]=_[_0x6570('0x3d')](_0xbcb6fc[_0x6570('0x3c')]);_0x36031d['filters']=_['intersection'](_0x36031d[_0x6570('0x3b')],_0x36031d['query']);_0x8709bd[_0x6570('0x3e')]=_[_0x6570('0x3f')](_0x36031d[_0x6570('0x3b')],qs[_0x6570('0x40')](_0xbcb6fc[_0x6570('0x3c')]['fields']));_0x8709bd[_0x6570('0x3e')]=_0x8709bd['attributes'][_0x6570('0x41')]?_0x8709bd[_0x6570('0x3e')]:_0x36031d[_0x6570('0x3b')];if(_0xbcb6fc['query'][_0x6570('0x4c')]){_0x8709bd['include']=[{'all':!![]}];}_0x8709bd=_[_0x6570('0x48')]({},_0x8709bd,_0xbcb6fc[_0x6570('0x4d')]);return db[_0x6570('0x36')][_0x6570('0x4e')](_0x8709bd)[_0x6570('0x1d')](handleEntityNotFound(_0x2b2de6,null))[_0x6570('0x1d')](respondWithResult(_0x2b2de6,null))[_0x6570('0x26')](handleError(_0x2b2de6,null));};exports['create']=function(_0x3b9738,_0x57986f){return db[_0x6570('0x36')][_0x6570('0x4f')](_0x3b9738[_0x6570('0x50')],{})[_0x6570('0x1d')](respondWithResult(_0x57986f,0xc9))[_0x6570('0x26')](handleError(_0x57986f,null));};exports['update']=function(_0xdef5a4,_0x4c33f0){if(_0xdef5a4[_0x6570('0x50')]['id']){delete _0xdef5a4[_0x6570('0x50')]['id'];}return db[_0x6570('0x36')][_0x6570('0x4e')]({'where':{'id':_0xdef5a4[_0x6570('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c33f0,null))[_0x6570('0x1d')](saveUpdates(_0xdef5a4[_0x6570('0x50')],null))[_0x6570('0x1d')](respondWithResult(_0x4c33f0,null))[_0x6570('0x26')](handleError(_0x4c33f0,null));};exports['destroy']=function(_0x49ffd0,_0x4f80e6){return db[_0x6570('0x36')]['find']({'where':{'id':_0x49ffd0[_0x6570('0x51')]['id']}})[_0x6570('0x1d')](handleEntityNotFound(_0x4f80e6,null))[_0x6570('0x1d')](removeEntity(_0x4f80e6,null))[_0x6570('0x26')](handleError(_0x4f80e6,null));};exports['getConfigurations']=function(_0x3a82c2,_0x45a0b2,_0x196af2){var _0xc86e0b={};var _0xcc16d6={};var _0x82e97d;var _0x4dedb7;return db[_0x6570('0x36')][_0x6570('0x52')]({'where':{'id':_0x3a82c2[_0x6570('0x51')]['id']}})[_0x6570('0x1d')](handleEntityNotFound(_0x45a0b2,null))['then'](function(_0x489b23){if(_0x489b23){_0x82e97d=_0x489b23;_0xcc16d6['model']=_[_0x6570('0x3d')](db[_0x6570('0x53')][_0x6570('0x37')]);_0xcc16d6[_0x6570('0x3c')]=_['keys'](_0x3a82c2[_0x6570('0x3c')]);_0xcc16d6[_0x6570('0x46')]=_[_0x6570('0x3f')](_0xcc16d6[_0x6570('0x3b')],_0xcc16d6['query']);_0xc86e0b[_0x6570('0x3e')]=_[_0x6570('0x3f')](_0xcc16d6[_0x6570('0x3b')],qs['fields'](_0x3a82c2[_0x6570('0x3c')][_0x6570('0x40')]));_0xc86e0b[_0x6570('0x3e')]=_0xc86e0b[_0x6570('0x3e')][_0x6570('0x41')]?_0xc86e0b['attributes']:_0xcc16d6['model'];_0xc86e0b[_0x6570('0x43')]=qs[_0x6570('0x44')](_0x3a82c2[_0x6570('0x3c')]['sort']);_0xc86e0b[_0x6570('0x45')]=qs['filters'](_[_0x6570('0x47')](_0x3a82c2['query'],_0xcc16d6[_0x6570('0x46')]));if(_0x3a82c2[_0x6570('0x3c')][_0x6570('0x54')]){_0xc86e0b[_0x6570('0x45')]=_[_0x6570('0x48')](_0xc86e0b['where'],{'$or':_[_0x6570('0x35')](_0xc86e0b[_0x6570('0x3e')],function(_0x45cc51){var _0xc322ab={};_0xc322ab[_0x45cc51]={'$like':'%'+_0x3a82c2['query'][_0x6570('0x54')]+'%'};return _0xc322ab;})});}_0xc86e0b=_[_0x6570('0x48')]({},_0xc86e0b,_0x3a82c2[_0x6570('0x4d')]);return _0x82e97d[_0x6570('0x55')](_0xc86e0b);}})[_0x6570('0x1d')](function(_0x516174){if(_0x516174){_0x4dedb7=_0x516174['length'];if(!_0x3a82c2[_0x6570('0x3c')][_0x6570('0x42')]('nolimit')){_0xc86e0b[_0x6570('0x2b')]=qs['limit'](_0x3a82c2[_0x6570('0x3c')][_0x6570('0x2b')]);_0xc86e0b['offset']=qs[_0x6570('0x2a')](_0x3a82c2['query'][_0x6570('0x2a')]);}return _0x82e97d['getConfigurations'](_0xc86e0b);}})['then'](function(_0x3d1c36){if(_0x3d1c36){return _0x3d1c36?{'count':_0x4dedb7,'rows':_0x3d1c36}:null;}})[_0x6570('0x1d')](respondWithResult(_0x45a0b2,null))[_0x6570('0x26')](handleError(_0x45a0b2,null));};exports[_0x6570('0x56')]=function(_0x449971,_0x26c212,_0xeba105){if(_0x449971[_0x6570('0x50')]['id']){delete _0x449971[_0x6570('0x50')]['id'];}return db['ZendeskAccount'][_0x6570('0x52')]({'where':{'id':_0x449971[_0x6570('0x51')]['id']}})['then'](handleEntityNotFound(_0x26c212,null))[_0x6570('0x1d')](function(_0x15bae6){if(_0x15bae6){_0x449971[_0x6570('0x50')][_0x6570('0x57')]=_0x15bae6['id'];_0x449971[_0x6570('0x50')]['Subjects']=integrations[_0x6570('0x58')](_0x449971[_0x6570('0x50')][_0x6570('0x59')],_0x449971[_0x6570('0x50')][_0x6570('0x39')]);_0x449971[_0x6570('0x50')][_0x6570('0x5a')]=integrations[_0x6570('0x5b')](_0x449971[_0x6570('0x50')][_0x6570('0x59')],_0x449971[_0x6570('0x50')][_0x6570('0x39')]);return db[_0x6570('0x53')][_0x6570('0x4f')](_0x449971[_0x6570('0x50')],{'include':[{'model':db[_0x6570('0x5c')],'as':_0x6570('0x5d')},{'model':db[_0x6570('0x5c')],'as':'Descriptions'}]});}return null;})[_0x6570('0x1d')](respondWithResult(_0x26c212,null))[_0x6570('0x26')](handleError(_0x26c212,null));};exports[_0x6570('0x5e')]=function(_0x395383,_0x550bd8,_0x59cf88){var _0x4d0a25='';return db[_0x6570('0x36')]['findOne']({'where':{'id':_0x395383[_0x6570('0x51')]['id']},'attributes':['id',_0x6570('0x5f'),_0x6570('0x60'),_0x6570('0x61'),_0x6570('0x62'),_0x6570('0x63')]})[_0x6570('0x1d')](handleEntityNotFound(_0x550bd8,null))['then'](function(_0x376146){if(_0x376146){_0x4d0a25=_0x376146[_0x6570('0x63')];var _0x37878f=_0x4d0a25['slice'](-0x1);if(_0x37878f==='/'){_0x4d0a25=_0x4d0a25['substring'](0x0,_0x4d0a25['lastIndexOf'](_0x37878f));}var _0x4faf9b={'method':_0x6570('0x64'),'uri':util[_0x6570('0x65')](_0x6570('0x66'),_0x4d0a25,'ticket_fields'),'json':!![]};switch(_0x376146[_0x6570('0x62')]){case _0x6570('0x60'):_0x4faf9b[_0x6570('0x67')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x6570('0x68'),_0x376146[_0x6570('0x5f')],_0x376146[_0x6570('0x60')]))[_0x6570('0x69')](_0x6570('0x6a')))};break;case'token':_0x4faf9b[_0x6570('0x67')]={'Authorization':util[_0x6570('0x65')](_0x6570('0x6b'),new Buffer(util[_0x6570('0x65')](_0x6570('0x6c'),_0x376146[_0x6570('0x5f')],_0x376146[_0x6570('0x61')]))[_0x6570('0x69')](_0x6570('0x6a')))};break;default:throw new db[(_0x6570('0x6d'))][(_0x6570('0x6e'))]('Unknown\x20authentication\x20type');}return rp(_0x4faf9b);}})[_0x6570('0x1d')](function(_0x3e3158){if(_0x3e3158){var _0x453c11=[_0x6570('0x6f'),_0x6570('0x70'),'group','assignee'];_['remove'](_0x3e3158[_0x6570('0x71')],function(_0x25364c){return _0x453c11['includes'](_0x25364c[_0x6570('0x39')]);});return{'count':_0x3e3158[_0x6570('0x71')][_0x6570('0x41')],'rows':_['map'](_0x3e3158[_0x6570('0x71')],function(_0x2009a0){return{'id':_0x2009a0['id'],'name':_0x2009a0['position']>0x7?_0x2009a0[_0x6570('0x72')]:_0x2009a0['type'],'custom':_0x2009a0[_0x6570('0x73')]>0x7?!![]:![],'options':_0x2009a0['system_field_options']?_0x2009a0[_0x6570('0x74')]:_0x2009a0[_0x6570('0x75')]?_0x2009a0[_0x6570('0x75')]:[]};})};}})[_0x6570('0x1d')](respondWithResult(_0x550bd8,null))[_0x6570('0x26')](function(_0x3f9cac){var _0x426918=_0x395383[_0x6570('0x3c')][_0x6570('0x76')]?0x1f4:_0x3f9cac[_0x6570('0x77')]||0x1f4;logger[_0x6570('0x23')](_0x6570('0x78'),_0x6570('0x5e'),_0x426918,JSON[_0x6570('0x22')](_0x3f9cac));delete _0x3f9cac['name'];if(_0x426918===0x191){_0x426918=0x190;}_0x550bd8[_0x6570('0x2c')](_0x426918)['send'](_0x395383['query'][_0x6570('0x76')]?{'message':_0x6570('0x79'),'statusCode':_0x3f9cac[_0x6570('0x77')]}:_0x3f9cac);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3dd836b..4264d75 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 _0x14a9=['rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','request-promise'];(function(_0x876650,_0xf83563){var _0x1ff3d4=function(_0x4a9d75){while(--_0x4a9d75){_0x876650['push'](_0x876650['shift']());}};_0x1ff3d4(++_0xf83563);}(_0x14a9,0xeb));var _0x914a=function(_0x4259a3,_0x2f9e82){_0x4259a3=_0x4259a3-0x0;var _0x5dfed4=_0x14a9[_0x4259a3];return _0x5dfed4;};'use strict';var _=require(_0x914a('0x0'));var util=require(_0x914a('0x1'));var logger=require(_0x914a('0x2'))(_0x914a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x914a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x914a('0x5'));var config=require('../../config/environment');var attributes=require(_0x914a('0x6'));var integrations=require(_0x914a('0x7'));module[_0x914a('0x8')]=function(_0x1471ba,_0x48a552){return _0x1471ba[_0x914a('0x9')](_0x914a('0xa'),attributes,{'tableName':_0x914a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7acb=['bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x31d211,_0x309141){var _0x58e0f8=function(_0x164d86){while(--_0x164d86){_0x31d211['push'](_0x31d211['shift']());}};_0x58e0f8(++_0x309141);}(_0x7acb,0x1f3));var _0xb7ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7acb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb7ac('0x0'));var util=require(_0xb7ac('0x1'));var logger=require(_0xb7ac('0x2'))(_0xb7ac('0x3'));var moment=require(_0xb7ac('0x4'));var BPromise=require(_0xb7ac('0x5'));var rp=require(_0xb7ac('0x6'));var fs=require('fs');var path=require(_0xb7ac('0x7'));var rimraf=require(_0xb7ac('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xb7ac('0x9'));module[_0xb7ac('0xa')]=function(_0x28b3c2,_0x20ac09){return _0x28b3c2[_0xb7ac('0xb')](_0xb7ac('0xc'),attributes,{'tableName':_0xb7ac('0xd'),'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 cf6f7b8..e5e80ed 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(_0xd1804f,_0x37e663){var _0x466ab0=function(_0x4cec59){while(--_0x4cec59){_0xd1804f['push'](_0xd1804f['shift']());}};_0x466ab0(++_0x37e663);}(_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 _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b2aa161..0e5584e 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 _0x3b4d=['/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','/:id','isAuthenticated','show'];(function(_0x599d22,_0x35a833){var _0x476730=function(_0x13d069){while(--_0x13d069){_0x599d22['push'](_0x599d22['shift']());}};_0x476730(++_0x35a833);}(_0x3b4d,0x16d));var _0xd3b4=function(_0xc4c142,_0x392430){_0xc4c142=_0xc4c142-0x0;var _0x2c825e=_0x3b4d[_0xc4c142];return _0x2c825e;};'use strict';var multer=require(_0xd3b4('0x0'));var util=require(_0xd3b4('0x1'));var path=require(_0xd3b4('0x2'));var timeout=require(_0xd3b4('0x3'));var express=require('express');var router=express[_0xd3b4('0x4')]();var auth=require(_0xd3b4('0x5'));var interaction=require(_0xd3b4('0x6'));var config=require('../../config/environment');var controller=require(_0xd3b4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd3b4('0x8')]);router[_0xd3b4('0x9')](_0xd3b4('0xa'),auth[_0xd3b4('0xb')](),controller[_0xd3b4('0xc')]);router['get'](_0xd3b4('0xd'),auth[_0xd3b4('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd3b4('0xe')]);router[_0xd3b4('0x9')](_0xd3b4('0xf'),auth['isAuthenticated'](),controller[_0xd3b4('0x10')]);router[_0xd3b4('0x9')](_0xd3b4('0x11'),auth[_0xd3b4('0xb')](),controller[_0xd3b4('0x12')]);router[_0xd3b4('0x13')]('/',auth['isAuthenticated'](),controller[_0xd3b4('0x14')]);router[_0xd3b4('0x13')](_0xd3b4('0x11'),auth[_0xd3b4('0xb')](),controller[_0xd3b4('0x15')]);router[_0xd3b4('0x16')]('/:id',auth[_0xd3b4('0xb')](),controller[_0xd3b4('0x17')]);router[_0xd3b4('0x18')](_0xd3b4('0xa'),auth[_0xd3b4('0xb')](),controller[_0xd3b4('0x19')]);module[_0xd3b4('0x1a')]=router; \ No newline at end of file +var _0x98f5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98f5,0x158));var _0x598f=function(_0x35c86e,_0x395f05){_0x35c86e=_0x35c86e-0x0;var _0xe7cb4d=_0x98f5[_0x35c86e];return _0xe7cb4d;};'use strict';var multer=require(_0x598f('0x0'));var util=require(_0x598f('0x1'));var path=require(_0x598f('0x2'));var timeout=require(_0x598f('0x3'));var express=require(_0x598f('0x4'));var router=express[_0x598f('0x5')]();var auth=require(_0x598f('0x6'));var interaction=require(_0x598f('0x7'));var config=require(_0x598f('0x8'));var controller=require(_0x598f('0x9'));router['get']('/',auth[_0x598f('0xa')](),controller['index']);router[_0x598f('0xb')](_0x598f('0xc'),auth['isAuthenticated'](),controller[_0x598f('0xd')]);router[_0x598f('0xb')](_0x598f('0xe'),auth[_0x598f('0xa')](),controller[_0x598f('0xf')]);router[_0x598f('0xb')]('/:id/subjects',auth[_0x598f('0xa')](),controller[_0x598f('0x10')]);router['get'](_0x598f('0x11'),auth[_0x598f('0xa')](),controller['getDescriptions']);router[_0x598f('0xb')](_0x598f('0x12'),auth[_0x598f('0xa')](),controller[_0x598f('0x13')]);router[_0x598f('0x14')]('/',auth['isAuthenticated'](),controller[_0x598f('0x15')]);router[_0x598f('0x14')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x598f('0x16')](_0x598f('0xc'),auth[_0x598f('0xa')](),controller['update']);router[_0x598f('0x17')](_0x598f('0xc'),auth[_0x598f('0xa')](),controller[_0x598f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8a47199..f11bd10 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 _0x7668=['exports','STRING','sequelize'];(function(_0x4ec00b,_0x5eabf5){var _0x5e0493=function(_0xb9873b){while(--_0xb9873b){_0x4ec00b['push'](_0x4ec00b['shift']());}};_0x5e0493(++_0x5eabf5);}(_0x7668,0x131));var _0x8766=function(_0x59a761,_0x529c8b){_0x59a761=_0x59a761-0x0;var _0x6e0133=_0x7668[_0x59a761];return _0x6e0133;};'use strict';var Sequelize=require(_0x8766('0x0'));module[_0x8766('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8766('0x2')]}}; \ No newline at end of file +var _0x4ced=['exports','STRING'];(function(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0x4ced,0x104));var _0xd4ce=function(_0x9c2ae,_0x1953e0){_0x9c2ae=_0x9c2ae-0x0;var _0xe305fb=_0x4ced[_0x9c2ae];return _0xe305fb;};'use strict';var Sequelize=require('sequelize');module[_0xd4ce('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd4ce('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 88db84a..a7ea212 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 _0x6fae=['where','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','findOne','ZendeskField','sort','pick','getFields','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','save','update','destroy','end','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter'];(function(_0x104e19,_0xe55e70){var _0x55a2a3=function(_0x4cc6dd){while(--_0x4cc6dd){_0x104e19['push'](_0x104e19['shift']());}};_0x55a2a3(++_0xe55e70);}(_0x6fae,0x17d));var _0xe6fa=function(_0x2bd4f0,_0x5e1790){_0x2bd4f0=_0x2bd4f0-0x0;var _0x1dd2a8=_0x6fae[_0x2bd4f0];return _0x1dd2a8;};'use strict';var pdf=require(_0xe6fa('0x0'));var emlformat=require(_0xe6fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe6fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe6fa('0x4'));var util=require(_0xe6fa('0x5'));var path=require('path');var sox=require(_0xe6fa('0x6'));var csv=require(_0xe6fa('0x7'));var ejs=require(_0xe6fa('0x8'));var fs=require('fs');var _=require(_0xe6fa('0x9'));var squel=require('squel');var crypto=require(_0xe6fa('0xa'));var jsforce=require(_0xe6fa('0xb'));var deskjs=require(_0xe6fa('0xc'));var toCsv=require(_0xe6fa('0x7'));var querystring=require(_0xe6fa('0xd'));var Papa=require(_0xe6fa('0xe'));var Redis=require('ioredis');var authService=require(_0xe6fa('0xf'));var qs=require(_0xe6fa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6fa('0x11'));var logger=require('../../config/logger')(_0xe6fa('0x12'));var utils=require('../../config/utils');var config=require(_0xe6fa('0x13'));var licenseUtil=require(_0xe6fa('0x14'));var db=require(_0xe6fa('0x15'))['db'];var jayson=require(_0xe6fa('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d17d8,_0x9c856b,_0x185966,_0x2af415){return new BPromise(function(_0x415633,_0x4eb1aa){var _0x330a31=_0x2af415||client;return _0x330a31['request'](_0x3d17d8,_0x185966)[_0xe6fa('0x17')](function(_0x391d27){logger[_0xe6fa('0x18')](_0xe6fa('0x19'),_0x9c856b,_0xe6fa('0x1a'));logger[_0xe6fa('0x1b')](_0xe6fa('0x1c'),_0x9c856b,_0xe6fa('0x1a'),JSON[_0xe6fa('0x1d')](_0x391d27));if(_0x391d27['error']){if(_0x391d27[_0xe6fa('0x1e')][_0xe6fa('0x1f')]===0x1f4){logger['error'](_0xe6fa('0x19'),_0x9c856b,_0x391d27[_0xe6fa('0x1e')][_0xe6fa('0x20')]);return _0x4eb1aa(_0x391d27[_0xe6fa('0x1e')]['message']);}logger[_0xe6fa('0x1e')](_0xe6fa('0x19'),_0x9c856b,_0x391d27[_0xe6fa('0x1e')][_0xe6fa('0x20')]);return _0x415633(_0x391d27['error'][_0xe6fa('0x20')]);}else{logger['info'](_0xe6fa('0x19'),_0x9c856b,'request\x20sent');_0x415633(_0x391d27[_0xe6fa('0x21')]['message']);}})[_0xe6fa('0x22')](function(_0x3ddde2){logger[_0xe6fa('0x1e')](_0xe6fa('0x19'),_0x9c856b,_0x3ddde2);_0x4eb1aa(_0x3ddde2);});});}function respondWithStatusCode(_0x2372fa,_0x47beca){_0x47beca=_0x47beca||0xcc;return function(_0x559850){if(_0x559850){return _0x2372fa[_0xe6fa('0x23')](_0x47beca);}return _0x2372fa['status'](_0x47beca)['end']();};}function respondWithResult(_0x47855a,_0x1f9a00){_0x1f9a00=_0x1f9a00||0xc8;return function(_0x4edb6c){if(_0x4edb6c){return _0x47855a[_0xe6fa('0x24')](_0x1f9a00)[_0xe6fa('0x25')](_0x4edb6c);}};}function respondWithFilteredResult(_0x16ca07,_0x42759b){return function(_0x1da5f5){if(_0x1da5f5){var _0x1c6944=_0x1da5f5[_0xe6fa('0x26')],_0x12dbef=_0x42759b[_0xe6fa('0x27')],_0x2cac13=_0x42759b[_0xe6fa('0x27')]+_0x42759b[_0xe6fa('0x28')],_0x24f8fd;if(_0x2cac13>=_0x1c6944){_0x2cac13=_0x1c6944;_0x24f8fd=0xc8;}else{_0x24f8fd=0xce;}_0x16ca07['status'](_0x24f8fd);return _0x16ca07[_0xe6fa('0x29')]('Content-Range',_0x12dbef+'-'+_0x2cac13+'/'+_0x1c6944)[_0xe6fa('0x25')](_0x1da5f5);}return null;};}function patchUpdates(_0x3a9260){return function(_0x3b1793){try{jsonpatch['apply'](_0x3b1793,_0x3a9260,!![]);}catch(_0x3d85c4){return BPromise['reject'](_0x3d85c4);}return _0x3b1793[_0xe6fa('0x2a')]();};}function saveUpdates(_0x24c8a6,_0x20fdf3){return function(_0x1cdafa){if(_0x1cdafa){return _0x1cdafa[_0xe6fa('0x2b')](_0x24c8a6)[_0xe6fa('0x17')](function(_0x825bb5){return _0x825bb5;});}return null;};}function removeEntity(_0x4244f8,_0x101f03){return function(_0x324361){if(_0x324361){return _0x324361[_0xe6fa('0x2c')]()[_0xe6fa('0x17')](function(){_0x4244f8[_0xe6fa('0x24')](0xcc)[_0xe6fa('0x2d')]();});}};}function handleEntityNotFound(_0x278cbf,_0x329dd8){return function(_0x30dfcb){if(!_0x30dfcb){_0x278cbf[_0xe6fa('0x23')](0x194);}return _0x30dfcb;};}function handleError(_0x2789ed,_0x5973a4){_0x5973a4=_0x5973a4||0x1f4;return function(_0x1d8059){logger['error'](_0x1d8059[_0xe6fa('0x2e')]);if(_0x1d8059[_0xe6fa('0x2f')]){delete _0x1d8059['name'];}_0x2789ed[_0xe6fa('0x24')](_0x5973a4)['send'](_0x1d8059);};}exports[_0xe6fa('0x30')]=function(_0x2409e1,_0x40467f){var _0x365956={},_0x1e0d5d={},_0x5396e2={'count':0x0,'rows':[]};var _0x4a3613=_[_0xe6fa('0x31')](db['ZendeskConfiguration']['rawAttributes'],function(_0x9b48a0){return{'name':_0x9b48a0[_0xe6fa('0x32')],'type':_0x9b48a0[_0xe6fa('0x33')]['key']};});_0x1e0d5d[_0xe6fa('0x34')]=_[_0xe6fa('0x31')](_0x4a3613,_0xe6fa('0x2f'));_0x1e0d5d[_0xe6fa('0x35')]=_[_0xe6fa('0x36')](_0x2409e1['query']);_0x1e0d5d[_0xe6fa('0x37')]=_[_0xe6fa('0x38')](_0x1e0d5d[_0xe6fa('0x34')],_0x1e0d5d[_0xe6fa('0x35')]);_0x365956[_0xe6fa('0x39')]=_[_0xe6fa('0x38')](_0x1e0d5d[_0xe6fa('0x34')],qs[_0xe6fa('0x3a')](_0x2409e1['query']['fields']));_0x365956[_0xe6fa('0x39')]=_0x365956['attributes'][_0xe6fa('0x3b')]?_0x365956[_0xe6fa('0x39')]:_0x1e0d5d[_0xe6fa('0x34')];if(!_0x2409e1[_0xe6fa('0x35')][_0xe6fa('0x3c')](_0xe6fa('0x3d'))){_0x365956[_0xe6fa('0x28')]=qs[_0xe6fa('0x28')](_0x2409e1['query']['limit']);_0x365956[_0xe6fa('0x27')]=qs[_0xe6fa('0x27')](_0x2409e1[_0xe6fa('0x35')][_0xe6fa('0x27')]);}_0x365956[_0xe6fa('0x3e')]=qs['sort'](_0x2409e1[_0xe6fa('0x35')]['sort']);_0x365956['where']=qs[_0xe6fa('0x37')](_['pick'](_0x2409e1[_0xe6fa('0x35')],_0x1e0d5d[_0xe6fa('0x37')]),_0x4a3613);if(_0x2409e1['query'][_0xe6fa('0x3f')]){_0x365956[_0xe6fa('0x40')]=_[_0xe6fa('0x41')](_0x365956[_0xe6fa('0x40')],{'$or':_[_0xe6fa('0x31')](_0x4a3613,function(_0x3f4b71){if(_0x3f4b71[_0xe6fa('0x33')]!==_0xe6fa('0x42')){var _0x2851ff={};_0x2851ff[_0x3f4b71[_0xe6fa('0x2f')]]={'$like':'%'+_0x2409e1['query'][_0xe6fa('0x3f')]+'%'};return _0x2851ff;}})});}_0x365956=_[_0xe6fa('0x41')]({},_0x365956,_0x2409e1[_0xe6fa('0x43')]);var _0x18df6c={'where':_0x365956[_0xe6fa('0x40')]};return db[_0xe6fa('0x44')]['count'](_0x18df6c)[_0xe6fa('0x17')](function(_0x23b74e){_0x5396e2[_0xe6fa('0x26')]=_0x23b74e;if(_0x2409e1[_0xe6fa('0x35')][_0xe6fa('0x45')]){_0x365956['include']=[{'all':!![]}];}return db[_0xe6fa('0x44')][_0xe6fa('0x46')](_0x365956);})['then'](function(_0x1306ba){_0x5396e2[_0xe6fa('0x47')]=_0x1306ba;return _0x5396e2;})[_0xe6fa('0x17')](respondWithFilteredResult(_0x40467f,_0x365956))[_0xe6fa('0x22')](handleError(_0x40467f,null));};exports[_0xe6fa('0x48')]=function(_0xb79e77,_0x1e6557){var _0x26f533={'raw':![],'where':{'id':_0xb79e77[_0xe6fa('0x49')]['id']}},_0x175394={};_0x175394[_0xe6fa('0x34')]=_[_0xe6fa('0x36')](db['ZendeskConfiguration'][_0xe6fa('0x4a')]);_0x175394[_0xe6fa('0x35')]=_[_0xe6fa('0x36')](_0xb79e77[_0xe6fa('0x35')]);_0x175394[_0xe6fa('0x37')]=_[_0xe6fa('0x38')](_0x175394['model'],_0x175394[_0xe6fa('0x35')]);_0x26f533[_0xe6fa('0x39')]=_[_0xe6fa('0x38')](_0x175394[_0xe6fa('0x34')],qs['fields'](_0xb79e77[_0xe6fa('0x35')][_0xe6fa('0x3a')]));_0x26f533[_0xe6fa('0x39')]=_0x26f533[_0xe6fa('0x39')][_0xe6fa('0x3b')]?_0x26f533[_0xe6fa('0x39')]:_0x175394[_0xe6fa('0x34')];if(_0xb79e77['query'][_0xe6fa('0x45')]){_0x26f533[_0xe6fa('0x4b')]=[{'all':!![]}];}_0x26f533=_[_0xe6fa('0x41')]({},_0x26f533,_0xb79e77[_0xe6fa('0x43')]);return db['ZendeskConfiguration'][_0xe6fa('0x4c')](_0x26f533)[_0xe6fa('0x17')](handleEntityNotFound(_0x1e6557,null))['then'](respondWithResult(_0x1e6557,null))['catch'](handleError(_0x1e6557,null));};exports[_0xe6fa('0x4d')]=function(_0x1447df,_0xad72cc){return db['ZendeskConfiguration'][_0xe6fa('0x4d')](_0x1447df['body'],{})[_0xe6fa('0x17')](respondWithResult(_0xad72cc,0xc9))[_0xe6fa('0x22')](handleError(_0xad72cc,null));};exports[_0xe6fa('0x2b')]=function(_0x2332d3,_0x567b02){if(_0x2332d3[_0xe6fa('0x4e')]['id']){delete _0x2332d3[_0xe6fa('0x4e')]['id'];}return db[_0xe6fa('0x44')][_0xe6fa('0x4c')]({'where':{'id':_0x2332d3[_0xe6fa('0x49')]['id']}})['then'](handleEntityNotFound(_0x567b02,null))[_0xe6fa('0x17')](saveUpdates(_0x2332d3[_0xe6fa('0x4e')],null))['then'](respondWithResult(_0x567b02,null))[_0xe6fa('0x22')](handleError(_0x567b02,null));};exports[_0xe6fa('0x2c')]=function(_0x364f6f,_0x457cdd){return db[_0xe6fa('0x44')]['find']({'where':{'id':_0x364f6f[_0xe6fa('0x49')]['id']}})[_0xe6fa('0x17')](handleEntityNotFound(_0x457cdd,null))[_0xe6fa('0x17')](removeEntity(_0x457cdd,null))[_0xe6fa('0x22')](handleError(_0x457cdd,null));};exports['getFields']=function(_0x4f39f4,_0x459d59,_0x5656dc){var _0x2812c7={};var _0x4af5fb={};var _0x2352c2;var _0x43e5bf;return db[_0xe6fa('0x44')][_0xe6fa('0x4f')]({'where':{'id':_0x4f39f4[_0xe6fa('0x49')]['id']}})[_0xe6fa('0x17')](handleEntityNotFound(_0x459d59,null))[_0xe6fa('0x17')](function(_0x5422f1){if(_0x5422f1){_0x2352c2=_0x5422f1;_0x4af5fb[_0xe6fa('0x34')]=_[_0xe6fa('0x36')](db[_0xe6fa('0x50')]['rawAttributes']);_0x4af5fb['query']=_[_0xe6fa('0x36')](_0x4f39f4[_0xe6fa('0x35')]);_0x4af5fb['filters']=_[_0xe6fa('0x38')](_0x4af5fb['model'],_0x4af5fb[_0xe6fa('0x35')]);_0x2812c7[_0xe6fa('0x39')]=_[_0xe6fa('0x38')](_0x4af5fb[_0xe6fa('0x34')],qs[_0xe6fa('0x3a')](_0x4f39f4[_0xe6fa('0x35')][_0xe6fa('0x3a')]));_0x2812c7[_0xe6fa('0x39')]=_0x2812c7[_0xe6fa('0x39')][_0xe6fa('0x3b')]?_0x2812c7[_0xe6fa('0x39')]:_0x4af5fb[_0xe6fa('0x34')];_0x2812c7[_0xe6fa('0x3e')]=qs[_0xe6fa('0x51')](_0x4f39f4[_0xe6fa('0x35')][_0xe6fa('0x51')]);_0x2812c7[_0xe6fa('0x40')]=qs[_0xe6fa('0x37')](_[_0xe6fa('0x52')](_0x4f39f4['query'],_0x4af5fb['filters']));if(_0x4f39f4['query'][_0xe6fa('0x3f')]){_0x2812c7[_0xe6fa('0x40')]=_[_0xe6fa('0x41')](_0x2812c7[_0xe6fa('0x40')],{'$or':_[_0xe6fa('0x31')](_0x2812c7[_0xe6fa('0x39')],function(_0x2dabe1){var _0x31288e={};_0x31288e[_0x2dabe1]={'$like':'%'+_0x4f39f4[_0xe6fa('0x35')][_0xe6fa('0x3f')]+'%'};return _0x31288e;})});}_0x2812c7=_[_0xe6fa('0x41')]({},_0x2812c7,_0x4f39f4[_0xe6fa('0x43')]);return _0x2352c2[_0xe6fa('0x53')](_0x2812c7);}})[_0xe6fa('0x17')](function(_0x4968b6){if(_0x4968b6){_0x43e5bf=_0x4968b6[_0xe6fa('0x3b')];if(!_0x4f39f4[_0xe6fa('0x35')][_0xe6fa('0x3c')](_0xe6fa('0x3d'))){_0x2812c7[_0xe6fa('0x28')]=qs['limit'](_0x4f39f4[_0xe6fa('0x35')][_0xe6fa('0x28')]);_0x2812c7['offset']=qs['offset'](_0x4f39f4['query'][_0xe6fa('0x27')]);}return _0x2352c2[_0xe6fa('0x53')](_0x2812c7);}})[_0xe6fa('0x17')](function(_0x3a279b){if(_0x3a279b){return _0x3a279b?{'count':_0x43e5bf,'rows':_0x3a279b}:null;}})['then'](respondWithResult(_0x459d59,null))[_0xe6fa('0x22')](handleError(_0x459d59,null));};exports[_0xe6fa('0x54')]=function(_0x44b3eb,_0x259522,_0x560075){var _0x4024fb={};var _0x470529={};var _0x4cbef0;var _0x1b88f9;return db[_0xe6fa('0x44')][_0xe6fa('0x4f')]({'where':{'id':_0x44b3eb['params']['id']}})['then'](handleEntityNotFound(_0x259522,null))[_0xe6fa('0x17')](function(_0x5cf91a){if(_0x5cf91a){_0x4cbef0=_0x5cf91a;_0x470529['model']=_[_0xe6fa('0x36')](db['ZendeskField'][_0xe6fa('0x4a')]);_0x470529['query']=_[_0xe6fa('0x36')](_0x44b3eb[_0xe6fa('0x35')]);_0x470529[_0xe6fa('0x37')]=_[_0xe6fa('0x38')](_0x470529['model'],_0x470529[_0xe6fa('0x35')]);_0x4024fb['attributes']=_['intersection'](_0x470529['model'],qs[_0xe6fa('0x3a')](_0x44b3eb['query']['fields']));_0x4024fb['attributes']=_0x4024fb[_0xe6fa('0x39')][_0xe6fa('0x3b')]?_0x4024fb['attributes']:_0x470529['model'];_0x4024fb[_0xe6fa('0x3e')]=qs[_0xe6fa('0x51')](_0x44b3eb[_0xe6fa('0x35')][_0xe6fa('0x51')]);_0x4024fb[_0xe6fa('0x40')]=qs[_0xe6fa('0x37')](_[_0xe6fa('0x52')](_0x44b3eb[_0xe6fa('0x35')],_0x470529['filters']));if(_0x44b3eb[_0xe6fa('0x35')][_0xe6fa('0x3f')]){_0x4024fb[_0xe6fa('0x40')]=_['merge'](_0x4024fb[_0xe6fa('0x40')],{'$or':_[_0xe6fa('0x31')](_0x4024fb['attributes'],function(_0x1194cb){var _0x47a6cc={};_0x47a6cc[_0x1194cb]={'$like':'%'+_0x44b3eb[_0xe6fa('0x35')]['filter']+'%'};return _0x47a6cc;})});}_0x4024fb=_['merge']({},_0x4024fb,_0x44b3eb['options']);return _0x4cbef0[_0xe6fa('0x54')](_0x4024fb);}})[_0xe6fa('0x17')](function(_0x1792ad){if(_0x1792ad){_0x1b88f9=_0x1792ad[_0xe6fa('0x3b')];if(!_0x44b3eb[_0xe6fa('0x35')][_0xe6fa('0x3c')]('nolimit')){_0x4024fb[_0xe6fa('0x28')]=qs['limit'](_0x44b3eb[_0xe6fa('0x35')][_0xe6fa('0x28')]);_0x4024fb[_0xe6fa('0x27')]=qs[_0xe6fa('0x27')](_0x44b3eb[_0xe6fa('0x35')][_0xe6fa('0x27')]);}return _0x4cbef0[_0xe6fa('0x54')](_0x4024fb);}})['then'](function(_0x594feb){if(_0x594feb){return _0x594feb?{'count':_0x1b88f9,'rows':_0x594feb}:null;}})[_0xe6fa('0x17')](respondWithResult(_0x259522,null))[_0xe6fa('0x22')](handleError(_0x259522,null));};exports[_0xe6fa('0x55')]=function(_0x52215d,_0x1d460c,_0xa332b4){var _0xca9bbf={};var _0x50fcc8={};var _0x3f724;var _0x1b69f8;return db[_0xe6fa('0x44')][_0xe6fa('0x4f')]({'where':{'id':_0x52215d[_0xe6fa('0x49')]['id']}})[_0xe6fa('0x17')](handleEntityNotFound(_0x1d460c,null))[_0xe6fa('0x17')](function(_0x1b2abd){if(_0x1b2abd){_0x3f724=_0x1b2abd;_0x50fcc8[_0xe6fa('0x34')]=_[_0xe6fa('0x36')](db[_0xe6fa('0x50')][_0xe6fa('0x4a')]);_0x50fcc8[_0xe6fa('0x35')]=_[_0xe6fa('0x36')](_0x52215d['query']);_0x50fcc8['filters']=_[_0xe6fa('0x38')](_0x50fcc8[_0xe6fa('0x34')],_0x50fcc8[_0xe6fa('0x35')]);_0xca9bbf[_0xe6fa('0x39')]=_[_0xe6fa('0x38')](_0x50fcc8[_0xe6fa('0x34')],qs['fields'](_0x52215d[_0xe6fa('0x35')]['fields']));_0xca9bbf['attributes']=_0xca9bbf[_0xe6fa('0x39')][_0xe6fa('0x3b')]?_0xca9bbf[_0xe6fa('0x39')]:_0x50fcc8['model'];_0xca9bbf[_0xe6fa('0x3e')]=qs[_0xe6fa('0x51')](_0x52215d[_0xe6fa('0x35')][_0xe6fa('0x51')]);_0xca9bbf[_0xe6fa('0x40')]=qs[_0xe6fa('0x37')](_['pick'](_0x52215d['query'],_0x50fcc8['filters']));if(_0x52215d['query'][_0xe6fa('0x3f')]){_0xca9bbf['where']=_[_0xe6fa('0x41')](_0xca9bbf[_0xe6fa('0x40')],{'$or':_[_0xe6fa('0x31')](_0xca9bbf['attributes'],function(_0x1b4626){var _0x1c6c8e={};_0x1c6c8e[_0x1b4626]={'$like':'%'+_0x52215d[_0xe6fa('0x35')][_0xe6fa('0x3f')]+'%'};return _0x1c6c8e;})});}_0xca9bbf=_[_0xe6fa('0x41')]({},_0xca9bbf,_0x52215d[_0xe6fa('0x43')]);return _0x3f724[_0xe6fa('0x55')](_0xca9bbf);}})[_0xe6fa('0x17')](function(_0x625f1b){if(_0x625f1b){_0x1b69f8=_0x625f1b['length'];if(!_0x52215d['query'][_0xe6fa('0x3c')](_0xe6fa('0x3d'))){_0xca9bbf['limit']=qs[_0xe6fa('0x28')](_0x52215d[_0xe6fa('0x35')][_0xe6fa('0x28')]);_0xca9bbf['offset']=qs[_0xe6fa('0x27')](_0x52215d['query'][_0xe6fa('0x27')]);}return _0x3f724[_0xe6fa('0x55')](_0xca9bbf);}})[_0xe6fa('0x17')](function(_0x50706b){if(_0x50706b){return _0x50706b?{'count':_0x1b69f8,'rows':_0x50706b}:null;}})[_0xe6fa('0x17')](respondWithResult(_0x1d460c,null))[_0xe6fa('0x22')](handleError(_0x1d460c,null));};exports['getTags']=function(_0x3fa801,_0x2834c2,_0x929ab7){var _0x2d3f08={};var _0x131269={};var _0x312999;var _0x4e7d5a;return db[_0xe6fa('0x44')]['findOne']({'where':{'id':_0x3fa801[_0xe6fa('0x49')]['id']}})[_0xe6fa('0x17')](handleEntityNotFound(_0x2834c2,null))[_0xe6fa('0x17')](function(_0x7542b7){if(_0x7542b7){_0x312999=_0x7542b7;_0x131269['model']=_[_0xe6fa('0x36')](db['Tag']['rawAttributes']);_0x131269['query']=_[_0xe6fa('0x36')](_0x3fa801['query']);_0x131269[_0xe6fa('0x37')]=_[_0xe6fa('0x38')](_0x131269[_0xe6fa('0x34')],_0x131269[_0xe6fa('0x35')]);_0x2d3f08[_0xe6fa('0x39')]=_[_0xe6fa('0x38')](_0x131269[_0xe6fa('0x34')],qs[_0xe6fa('0x3a')](_0x3fa801[_0xe6fa('0x35')][_0xe6fa('0x3a')]));_0x2d3f08[_0xe6fa('0x39')]=_0x2d3f08[_0xe6fa('0x39')][_0xe6fa('0x3b')]?_0x2d3f08['attributes']:_0x131269[_0xe6fa('0x34')];_0x2d3f08[_0xe6fa('0x3e')]=qs[_0xe6fa('0x51')](_0x3fa801[_0xe6fa('0x35')][_0xe6fa('0x51')]);_0x2d3f08[_0xe6fa('0x40')]=qs[_0xe6fa('0x37')](_[_0xe6fa('0x52')](_0x3fa801[_0xe6fa('0x35')],_0x131269[_0xe6fa('0x37')]));if(_0x3fa801['query'][_0xe6fa('0x3f')]){_0x2d3f08[_0xe6fa('0x40')]=_['merge'](_0x2d3f08[_0xe6fa('0x40')],{'$or':_[_0xe6fa('0x31')](_0x2d3f08[_0xe6fa('0x39')],function(_0x15823d){var _0x507887={};_0x507887[_0x15823d]={'$like':'%'+_0x3fa801['query'][_0xe6fa('0x3f')]+'%'};return _0x507887;})});}_0x2d3f08=_['merge']({},_0x2d3f08,_0x3fa801[_0xe6fa('0x43')]);return _0x312999[_0xe6fa('0x56')](_0x2d3f08);}})[_0xe6fa('0x17')](function(_0x37070d){if(_0x37070d){_0x4e7d5a=_0x37070d[_0xe6fa('0x3b')];if(!_0x3fa801[_0xe6fa('0x35')]['hasOwnProperty'](_0xe6fa('0x3d'))){_0x2d3f08[_0xe6fa('0x28')]=qs[_0xe6fa('0x28')](_0x3fa801['query'][_0xe6fa('0x28')]);_0x2d3f08[_0xe6fa('0x27')]=qs['offset'](_0x3fa801[_0xe6fa('0x35')][_0xe6fa('0x27')]);}return _0x312999[_0xe6fa('0x56')](_0x2d3f08);}})[_0xe6fa('0x17')](function(_0x3f87e8){if(_0x3f87e8){return _0x3f87e8?{'count':_0x4e7d5a,'rows':_0x3f87e8}:null;}})['then'](respondWithResult(_0x2834c2,null))[_0xe6fa('0x22')](handleError(_0x2834c2,null));};exports[_0xe6fa('0x57')]=function(_0x554231,_0x38911b,_0x8c79d){if(_0x554231['body']['id']){delete _0x554231[_0xe6fa('0x4e')]['id'];}return db[_0xe6fa('0x44')]['findOne']({'where':{'id':_0x554231[_0xe6fa('0x49')]['id']}})[_0xe6fa('0x17')](handleEntityNotFound(_0x38911b,null))[_0xe6fa('0x17')](function(_0x2b7129){if(_0x2b7129){return _0x2b7129[_0xe6fa('0x57')](_0x554231['body'][_0xe6fa('0x58')]||[]);}return null;})[_0xe6fa('0x17')](respondWithResult(_0x38911b,null))[_0xe6fa('0x22')](handleError(_0x38911b,null));}; \ No newline at end of file +var _0x4b79=['request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','nolimit','order','where','pick','filter','merge','options','count','includeAll','include','rows','show','length','find','create','body','params','getFields','findOne','sort','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','html-pdf','rimraf'];(function(_0x1a4709,_0x159d63){var _0x2e9b56=function(_0x4f5290){while(--_0x4f5290){_0x1a4709['push'](_0x1a4709['shift']());}};_0x2e9b56(++_0x159d63);}(_0x4b79,0xb2));var _0x94b7=function(_0x437a74,_0x2fe31e){_0x437a74=_0x437a74-0x0;var _0x59ce7c=_0x4b79[_0x437a74];return _0x59ce7c;};'use strict';var pdf=require(_0x94b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94b7('0x2'));var moment=require('moment');var BPromise=require(_0x94b7('0x3'));var Mustache=require(_0x94b7('0x4'));var util=require('util');var path=require(_0x94b7('0x5'));var sox=require(_0x94b7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x94b7('0x7'));var squel=require(_0x94b7('0x8'));var crypto=require(_0x94b7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x94b7('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b7('0xb'));var qs=require(_0x94b7('0xc'));var as=require(_0x94b7('0xd'));var hardwareService=require(_0x94b7('0xe'));var logger=require(_0x94b7('0xf'))(_0x94b7('0x10'));var utils=require(_0x94b7('0x11'));var config=require(_0x94b7('0x12'));var licenseUtil=require(_0x94b7('0x13'));var db=require(_0x94b7('0x14'))['db'];var jayson=require(_0x94b7('0x15'));var client=jayson[_0x94b7('0x16')][_0x94b7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x36c1ee,_0x5b1d3e,_0x37ef0a,_0x2ead78){return new BPromise(function(_0x2b6abd,_0x23d5de){var _0x10bf84=_0x2ead78||client;return _0x10bf84['request'](_0x36c1ee,_0x37ef0a)[_0x94b7('0x18')](function(_0x1513f1){logger['info'](_0x94b7('0x19'),_0x5b1d3e,'request\x20sent');logger['debug'](_0x94b7('0x1a'),_0x5b1d3e,_0x94b7('0x1b'),JSON[_0x94b7('0x1c')](_0x1513f1));if(_0x1513f1['error']){if(_0x1513f1[_0x94b7('0x1d')][_0x94b7('0x1e')]===0x1f4){logger[_0x94b7('0x1d')](_0x94b7('0x19'),_0x5b1d3e,_0x1513f1[_0x94b7('0x1d')][_0x94b7('0x1f')]);return _0x23d5de(_0x1513f1['error'][_0x94b7('0x1f')]);}logger['error'](_0x94b7('0x19'),_0x5b1d3e,_0x1513f1[_0x94b7('0x1d')][_0x94b7('0x1f')]);return _0x2b6abd(_0x1513f1['error'][_0x94b7('0x1f')]);}else{logger[_0x94b7('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b1d3e,_0x94b7('0x1b'));_0x2b6abd(_0x1513f1[_0x94b7('0x21')][_0x94b7('0x1f')]);}})[_0x94b7('0x22')](function(_0x12cab5){logger[_0x94b7('0x1d')](_0x94b7('0x19'),_0x5b1d3e,_0x12cab5);_0x23d5de(_0x12cab5);});});}function respondWithStatusCode(_0x4c6123,_0x1c6d2e){_0x1c6d2e=_0x1c6d2e||0xcc;return function(_0x3c8876){if(_0x3c8876){return _0x4c6123[_0x94b7('0x23')](_0x1c6d2e);}return _0x4c6123[_0x94b7('0x24')](_0x1c6d2e)[_0x94b7('0x25')]();};}function respondWithResult(_0x12e071,_0x1c2f7d){_0x1c2f7d=_0x1c2f7d||0xc8;return function(_0x17ca90){if(_0x17ca90){return _0x12e071[_0x94b7('0x24')](_0x1c2f7d)[_0x94b7('0x26')](_0x17ca90);}};}function respondWithFilteredResult(_0x5d5284,_0x25c867){return function(_0x5df1b7){if(_0x5df1b7){var _0x54293c=_0x5df1b7['count'],_0x560336=_0x25c867[_0x94b7('0x27')],_0x37513a=_0x25c867[_0x94b7('0x27')]+_0x25c867[_0x94b7('0x28')],_0x4cdc95;if(_0x37513a>=_0x54293c){_0x37513a=_0x54293c;_0x4cdc95=0xc8;}else{_0x4cdc95=0xce;}_0x5d5284[_0x94b7('0x24')](_0x4cdc95);return _0x5d5284[_0x94b7('0x29')](_0x94b7('0x2a'),_0x560336+'-'+_0x37513a+'/'+_0x54293c)[_0x94b7('0x26')](_0x5df1b7);}return null;};}function patchUpdates(_0x48c420){return function(_0x46befa){try{jsonpatch[_0x94b7('0x2b')](_0x46befa,_0x48c420,!![]);}catch(_0x1eaaa8){return BPromise['reject'](_0x1eaaa8);}return _0x46befa[_0x94b7('0x2c')]();};}function saveUpdates(_0x1828b1,_0xd95160){return function(_0x4b2297){if(_0x4b2297){return _0x4b2297[_0x94b7('0x2d')](_0x1828b1)[_0x94b7('0x18')](function(_0x58ad66){return _0x58ad66;});}return null;};}function removeEntity(_0x50da04,_0x2e5ff4){return function(_0x2a65aa){if(_0x2a65aa){return _0x2a65aa[_0x94b7('0x2e')]()['then'](function(){_0x50da04['status'](0xcc)[_0x94b7('0x25')]();});}};}function handleEntityNotFound(_0x3f53a7,_0x19c5e2){return function(_0x48cd99){if(!_0x48cd99){_0x3f53a7[_0x94b7('0x23')](0x194);}return _0x48cd99;};}function handleError(_0x242089,_0x197fa2){_0x197fa2=_0x197fa2||0x1f4;return function(_0x2df829){logger[_0x94b7('0x1d')](_0x2df829[_0x94b7('0x2f')]);if(_0x2df829[_0x94b7('0x30')]){delete _0x2df829[_0x94b7('0x30')];}_0x242089[_0x94b7('0x24')](_0x197fa2)[_0x94b7('0x31')](_0x2df829);};}exports[_0x94b7('0x32')]=function(_0x5f4a50,_0x2c3d79){var _0x1edfa3={},_0x42178f={},_0x5d28c2={'count':0x0,'rows':[]};var _0x4e94e6=_['map'](db[_0x94b7('0x33')][_0x94b7('0x34')],function(_0x76c2d5){return{'name':_0x76c2d5[_0x94b7('0x35')],'type':_0x76c2d5[_0x94b7('0x36')]['key']};});_0x42178f['model']=_[_0x94b7('0x37')](_0x4e94e6,_0x94b7('0x30'));_0x42178f[_0x94b7('0x38')]=_[_0x94b7('0x39')](_0x5f4a50[_0x94b7('0x38')]);_0x42178f[_0x94b7('0x3a')]=_[_0x94b7('0x3b')](_0x42178f['model'],_0x42178f[_0x94b7('0x38')]);_0x1edfa3[_0x94b7('0x3c')]=_[_0x94b7('0x3b')](_0x42178f[_0x94b7('0x3d')],qs[_0x94b7('0x3e')](_0x5f4a50[_0x94b7('0x38')][_0x94b7('0x3e')]));_0x1edfa3['attributes']=_0x1edfa3[_0x94b7('0x3c')]['length']?_0x1edfa3['attributes']:_0x42178f[_0x94b7('0x3d')];if(!_0x5f4a50[_0x94b7('0x38')]['hasOwnProperty'](_0x94b7('0x3f'))){_0x1edfa3[_0x94b7('0x28')]=qs['limit'](_0x5f4a50[_0x94b7('0x38')][_0x94b7('0x28')]);_0x1edfa3[_0x94b7('0x27')]=qs['offset'](_0x5f4a50['query'][_0x94b7('0x27')]);}_0x1edfa3[_0x94b7('0x40')]=qs['sort'](_0x5f4a50[_0x94b7('0x38')]['sort']);_0x1edfa3[_0x94b7('0x41')]=qs['filters'](_[_0x94b7('0x42')](_0x5f4a50['query'],_0x42178f[_0x94b7('0x3a')]),_0x4e94e6);if(_0x5f4a50[_0x94b7('0x38')][_0x94b7('0x43')]){_0x1edfa3[_0x94b7('0x41')]=_[_0x94b7('0x44')](_0x1edfa3[_0x94b7('0x41')],{'$or':_['map'](_0x4e94e6,function(_0x1a9aa6){if(_0x1a9aa6[_0x94b7('0x36')]!=='VIRTUAL'){var _0x415d68={};_0x415d68[_0x1a9aa6[_0x94b7('0x30')]]={'$like':'%'+_0x5f4a50[_0x94b7('0x38')][_0x94b7('0x43')]+'%'};return _0x415d68;}})});}_0x1edfa3=_[_0x94b7('0x44')]({},_0x1edfa3,_0x5f4a50[_0x94b7('0x45')]);var _0x4d2a02={'where':_0x1edfa3[_0x94b7('0x41')]};return db['ZendeskConfiguration'][_0x94b7('0x46')](_0x4d2a02)['then'](function(_0x219924){_0x5d28c2[_0x94b7('0x46')]=_0x219924;if(_0x5f4a50['query'][_0x94b7('0x47')]){_0x1edfa3[_0x94b7('0x48')]=[{'all':!![]}];}return db[_0x94b7('0x33')]['findAll'](_0x1edfa3);})[_0x94b7('0x18')](function(_0x4f7daa){_0x5d28c2[_0x94b7('0x49')]=_0x4f7daa;return _0x5d28c2;})[_0x94b7('0x18')](respondWithFilteredResult(_0x2c3d79,_0x1edfa3))[_0x94b7('0x22')](handleError(_0x2c3d79,null));};exports[_0x94b7('0x4a')]=function(_0x3f9e99,_0x41b0f9){var _0x576dc3={'raw':![],'where':{'id':_0x3f9e99['params']['id']}},_0x5e2762={};_0x5e2762[_0x94b7('0x3d')]=_[_0x94b7('0x39')](db[_0x94b7('0x33')][_0x94b7('0x34')]);_0x5e2762[_0x94b7('0x38')]=_['keys'](_0x3f9e99[_0x94b7('0x38')]);_0x5e2762['filters']=_[_0x94b7('0x3b')](_0x5e2762[_0x94b7('0x3d')],_0x5e2762[_0x94b7('0x38')]);_0x576dc3[_0x94b7('0x3c')]=_[_0x94b7('0x3b')](_0x5e2762[_0x94b7('0x3d')],qs[_0x94b7('0x3e')](_0x3f9e99[_0x94b7('0x38')][_0x94b7('0x3e')]));_0x576dc3[_0x94b7('0x3c')]=_0x576dc3[_0x94b7('0x3c')][_0x94b7('0x4b')]?_0x576dc3[_0x94b7('0x3c')]:_0x5e2762[_0x94b7('0x3d')];if(_0x3f9e99[_0x94b7('0x38')][_0x94b7('0x47')]){_0x576dc3[_0x94b7('0x48')]=[{'all':!![]}];}_0x576dc3=_[_0x94b7('0x44')]({},_0x576dc3,_0x3f9e99[_0x94b7('0x45')]);return db[_0x94b7('0x33')][_0x94b7('0x4c')](_0x576dc3)[_0x94b7('0x18')](handleEntityNotFound(_0x41b0f9,null))[_0x94b7('0x18')](respondWithResult(_0x41b0f9,null))[_0x94b7('0x22')](handleError(_0x41b0f9,null));};exports[_0x94b7('0x4d')]=function(_0x1b141a,_0xb6bc61){return db[_0x94b7('0x33')]['create'](_0x1b141a[_0x94b7('0x4e')],{})[_0x94b7('0x18')](respondWithResult(_0xb6bc61,0xc9))['catch'](handleError(_0xb6bc61,null));};exports[_0x94b7('0x2d')]=function(_0x24fa6a,_0x56648c){if(_0x24fa6a[_0x94b7('0x4e')]['id']){delete _0x24fa6a['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x24fa6a['params']['id']}})[_0x94b7('0x18')](handleEntityNotFound(_0x56648c,null))['then'](saveUpdates(_0x24fa6a[_0x94b7('0x4e')],null))['then'](respondWithResult(_0x56648c,null))[_0x94b7('0x22')](handleError(_0x56648c,null));};exports['destroy']=function(_0x25a6d6,_0x4f2f94){return db[_0x94b7('0x33')][_0x94b7('0x4c')]({'where':{'id':_0x25a6d6[_0x94b7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f2f94,null))[_0x94b7('0x18')](removeEntity(_0x4f2f94,null))[_0x94b7('0x22')](handleError(_0x4f2f94,null));};exports[_0x94b7('0x50')]=function(_0x19b22e,_0x412a1d,_0x2fe114){var _0x344283={};var _0x5d67ba={};var _0x27539b;var _0x2c333f;return db['ZendeskConfiguration'][_0x94b7('0x51')]({'where':{'id':_0x19b22e[_0x94b7('0x4f')]['id']}})[_0x94b7('0x18')](handleEntityNotFound(_0x412a1d,null))[_0x94b7('0x18')](function(_0x1c6bd4){if(_0x1c6bd4){_0x27539b=_0x1c6bd4;_0x5d67ba[_0x94b7('0x3d')]=_[_0x94b7('0x39')](db['ZendeskField'][_0x94b7('0x34')]);_0x5d67ba[_0x94b7('0x38')]=_['keys'](_0x19b22e['query']);_0x5d67ba[_0x94b7('0x3a')]=_[_0x94b7('0x3b')](_0x5d67ba['model'],_0x5d67ba[_0x94b7('0x38')]);_0x344283[_0x94b7('0x3c')]=_[_0x94b7('0x3b')](_0x5d67ba['model'],qs[_0x94b7('0x3e')](_0x19b22e[_0x94b7('0x38')]['fields']));_0x344283[_0x94b7('0x3c')]=_0x344283[_0x94b7('0x3c')][_0x94b7('0x4b')]?_0x344283['attributes']:_0x5d67ba[_0x94b7('0x3d')];_0x344283[_0x94b7('0x40')]=qs[_0x94b7('0x52')](_0x19b22e[_0x94b7('0x38')][_0x94b7('0x52')]);_0x344283[_0x94b7('0x41')]=qs[_0x94b7('0x3a')](_['pick'](_0x19b22e[_0x94b7('0x38')],_0x5d67ba[_0x94b7('0x3a')]));if(_0x19b22e[_0x94b7('0x38')][_0x94b7('0x43')]){_0x344283[_0x94b7('0x41')]=_[_0x94b7('0x44')](_0x344283['where'],{'$or':_[_0x94b7('0x37')](_0x344283[_0x94b7('0x3c')],function(_0x4f090c){var _0x3f5a0e={};_0x3f5a0e[_0x4f090c]={'$like':'%'+_0x19b22e[_0x94b7('0x38')]['filter']+'%'};return _0x3f5a0e;})});}_0x344283=_[_0x94b7('0x44')]({},_0x344283,_0x19b22e[_0x94b7('0x45')]);return _0x27539b['getFields'](_0x344283);}})[_0x94b7('0x18')](function(_0x1c28b6){if(_0x1c28b6){_0x2c333f=_0x1c28b6[_0x94b7('0x4b')];if(!_0x19b22e[_0x94b7('0x38')][_0x94b7('0x53')](_0x94b7('0x3f'))){_0x344283[_0x94b7('0x28')]=qs[_0x94b7('0x28')](_0x19b22e[_0x94b7('0x38')][_0x94b7('0x28')]);_0x344283[_0x94b7('0x27')]=qs[_0x94b7('0x27')](_0x19b22e[_0x94b7('0x38')]['offset']);}return _0x27539b[_0x94b7('0x50')](_0x344283);}})[_0x94b7('0x18')](function(_0x1751de){if(_0x1751de){return _0x1751de?{'count':_0x2c333f,'rows':_0x1751de}:null;}})[_0x94b7('0x18')](respondWithResult(_0x412a1d,null))[_0x94b7('0x22')](handleError(_0x412a1d,null));};exports[_0x94b7('0x54')]=function(_0x125b54,_0x241795,_0x485978){var _0xe8df15={};var _0x50a1b9={};var _0x324135;var _0x3b225a;return db[_0x94b7('0x33')][_0x94b7('0x51')]({'where':{'id':_0x125b54['params']['id']}})[_0x94b7('0x18')](handleEntityNotFound(_0x241795,null))['then'](function(_0x21f145){if(_0x21f145){_0x324135=_0x21f145;_0x50a1b9[_0x94b7('0x3d')]=_[_0x94b7('0x39')](db[_0x94b7('0x55')][_0x94b7('0x34')]);_0x50a1b9[_0x94b7('0x38')]=_[_0x94b7('0x39')](_0x125b54[_0x94b7('0x38')]);_0x50a1b9[_0x94b7('0x3a')]=_['intersection'](_0x50a1b9[_0x94b7('0x3d')],_0x50a1b9[_0x94b7('0x38')]);_0xe8df15[_0x94b7('0x3c')]=_[_0x94b7('0x3b')](_0x50a1b9['model'],qs['fields'](_0x125b54[_0x94b7('0x38')][_0x94b7('0x3e')]));_0xe8df15['attributes']=_0xe8df15[_0x94b7('0x3c')][_0x94b7('0x4b')]?_0xe8df15[_0x94b7('0x3c')]:_0x50a1b9[_0x94b7('0x3d')];_0xe8df15[_0x94b7('0x40')]=qs['sort'](_0x125b54['query'][_0x94b7('0x52')]);_0xe8df15[_0x94b7('0x41')]=qs[_0x94b7('0x3a')](_['pick'](_0x125b54['query'],_0x50a1b9[_0x94b7('0x3a')]));if(_0x125b54[_0x94b7('0x38')]['filter']){_0xe8df15[_0x94b7('0x41')]=_[_0x94b7('0x44')](_0xe8df15['where'],{'$or':_[_0x94b7('0x37')](_0xe8df15[_0x94b7('0x3c')],function(_0x1fcbab){var _0x134945={};_0x134945[_0x1fcbab]={'$like':'%'+_0x125b54[_0x94b7('0x38')][_0x94b7('0x43')]+'%'};return _0x134945;})});}_0xe8df15=_['merge']({},_0xe8df15,_0x125b54[_0x94b7('0x45')]);return _0x324135['getSubjects'](_0xe8df15);}})['then'](function(_0x4363b2){if(_0x4363b2){_0x3b225a=_0x4363b2[_0x94b7('0x4b')];if(!_0x125b54[_0x94b7('0x38')][_0x94b7('0x53')](_0x94b7('0x3f'))){_0xe8df15[_0x94b7('0x28')]=qs[_0x94b7('0x28')](_0x125b54[_0x94b7('0x38')][_0x94b7('0x28')]);_0xe8df15[_0x94b7('0x27')]=qs[_0x94b7('0x27')](_0x125b54['query'][_0x94b7('0x27')]);}return _0x324135[_0x94b7('0x54')](_0xe8df15);}})['then'](function(_0x35dcd4){if(_0x35dcd4){return _0x35dcd4?{'count':_0x3b225a,'rows':_0x35dcd4}:null;}})[_0x94b7('0x18')](respondWithResult(_0x241795,null))[_0x94b7('0x22')](handleError(_0x241795,null));};exports[_0x94b7('0x56')]=function(_0x1ae057,_0x2b9710,_0x412016){var _0x378950={};var _0x172079={};var _0x24b887;var _0x2d3bc1;return db[_0x94b7('0x33')][_0x94b7('0x51')]({'where':{'id':_0x1ae057[_0x94b7('0x4f')]['id']}})[_0x94b7('0x18')](handleEntityNotFound(_0x2b9710,null))[_0x94b7('0x18')](function(_0x3e1766){if(_0x3e1766){_0x24b887=_0x3e1766;_0x172079['model']=_['keys'](db[_0x94b7('0x55')]['rawAttributes']);_0x172079[_0x94b7('0x38')]=_['keys'](_0x1ae057[_0x94b7('0x38')]);_0x172079[_0x94b7('0x3a')]=_[_0x94b7('0x3b')](_0x172079[_0x94b7('0x3d')],_0x172079[_0x94b7('0x38')]);_0x378950['attributes']=_['intersection'](_0x172079[_0x94b7('0x3d')],qs['fields'](_0x1ae057[_0x94b7('0x38')][_0x94b7('0x3e')]));_0x378950[_0x94b7('0x3c')]=_0x378950['attributes'][_0x94b7('0x4b')]?_0x378950[_0x94b7('0x3c')]:_0x172079[_0x94b7('0x3d')];_0x378950[_0x94b7('0x40')]=qs['sort'](_0x1ae057['query'][_0x94b7('0x52')]);_0x378950[_0x94b7('0x41')]=qs[_0x94b7('0x3a')](_['pick'](_0x1ae057[_0x94b7('0x38')],_0x172079[_0x94b7('0x3a')]));if(_0x1ae057['query'][_0x94b7('0x43')]){_0x378950[_0x94b7('0x41')]=_[_0x94b7('0x44')](_0x378950[_0x94b7('0x41')],{'$or':_[_0x94b7('0x37')](_0x378950[_0x94b7('0x3c')],function(_0x50c1cc){var _0x91e4c9={};_0x91e4c9[_0x50c1cc]={'$like':'%'+_0x1ae057['query'][_0x94b7('0x43')]+'%'};return _0x91e4c9;})});}_0x378950=_[_0x94b7('0x44')]({},_0x378950,_0x1ae057[_0x94b7('0x45')]);return _0x24b887[_0x94b7('0x56')](_0x378950);}})[_0x94b7('0x18')](function(_0x1bff54){if(_0x1bff54){_0x2d3bc1=_0x1bff54[_0x94b7('0x4b')];if(!_0x1ae057[_0x94b7('0x38')][_0x94b7('0x53')](_0x94b7('0x3f'))){_0x378950[_0x94b7('0x28')]=qs[_0x94b7('0x28')](_0x1ae057[_0x94b7('0x38')]['limit']);_0x378950[_0x94b7('0x27')]=qs[_0x94b7('0x27')](_0x1ae057[_0x94b7('0x38')][_0x94b7('0x27')]);}return _0x24b887[_0x94b7('0x56')](_0x378950);}})['then'](function(_0x23530b){if(_0x23530b){return _0x23530b?{'count':_0x2d3bc1,'rows':_0x23530b}:null;}})['then'](respondWithResult(_0x2b9710,null))['catch'](handleError(_0x2b9710,null));};exports[_0x94b7('0x57')]=function(_0x4c3600,_0x570fac,_0x2e76ef){var _0x241bf3={};var _0xc6d380={};var _0x594825;var _0x1299ab;return db[_0x94b7('0x33')]['findOne']({'where':{'id':_0x4c3600[_0x94b7('0x4f')]['id']}})[_0x94b7('0x18')](handleEntityNotFound(_0x570fac,null))[_0x94b7('0x18')](function(_0x1f2a6d){if(_0x1f2a6d){_0x594825=_0x1f2a6d;_0xc6d380['model']=_[_0x94b7('0x39')](db['Tag'][_0x94b7('0x34')]);_0xc6d380[_0x94b7('0x38')]=_[_0x94b7('0x39')](_0x4c3600[_0x94b7('0x38')]);_0xc6d380[_0x94b7('0x3a')]=_[_0x94b7('0x3b')](_0xc6d380[_0x94b7('0x3d')],_0xc6d380['query']);_0x241bf3[_0x94b7('0x3c')]=_[_0x94b7('0x3b')](_0xc6d380[_0x94b7('0x3d')],qs[_0x94b7('0x3e')](_0x4c3600[_0x94b7('0x38')][_0x94b7('0x3e')]));_0x241bf3[_0x94b7('0x3c')]=_0x241bf3[_0x94b7('0x3c')]['length']?_0x241bf3[_0x94b7('0x3c')]:_0xc6d380[_0x94b7('0x3d')];_0x241bf3[_0x94b7('0x40')]=qs[_0x94b7('0x52')](_0x4c3600[_0x94b7('0x38')][_0x94b7('0x52')]);_0x241bf3[_0x94b7('0x41')]=qs[_0x94b7('0x3a')](_[_0x94b7('0x42')](_0x4c3600[_0x94b7('0x38')],_0xc6d380[_0x94b7('0x3a')]));if(_0x4c3600[_0x94b7('0x38')]['filter']){_0x241bf3['where']=_['merge'](_0x241bf3[_0x94b7('0x41')],{'$or':_[_0x94b7('0x37')](_0x241bf3[_0x94b7('0x3c')],function(_0x2f8546){var _0x28f4b7={};_0x28f4b7[_0x2f8546]={'$like':'%'+_0x4c3600[_0x94b7('0x38')][_0x94b7('0x43')]+'%'};return _0x28f4b7;})});}_0x241bf3=_[_0x94b7('0x44')]({},_0x241bf3,_0x4c3600['options']);return _0x594825['getTags'](_0x241bf3);}})[_0x94b7('0x18')](function(_0x4e8829){if(_0x4e8829){_0x1299ab=_0x4e8829[_0x94b7('0x4b')];if(!_0x4c3600['query']['hasOwnProperty'](_0x94b7('0x3f'))){_0x241bf3['limit']=qs[_0x94b7('0x28')](_0x4c3600[_0x94b7('0x38')][_0x94b7('0x28')]);_0x241bf3[_0x94b7('0x27')]=qs[_0x94b7('0x27')](_0x4c3600['query'][_0x94b7('0x27')]);}return _0x594825['getTags'](_0x241bf3);}})[_0x94b7('0x18')](function(_0x23a104){if(_0x23a104){return _0x23a104?{'count':_0x1299ab,'rows':_0x23a104}:null;}})[_0x94b7('0x18')](respondWithResult(_0x570fac,null))[_0x94b7('0x22')](handleError(_0x570fac,null));};exports[_0x94b7('0x58')]=function(_0x3ead77,_0x3a97aa,_0x5bd813){if(_0x3ead77['body']['id']){delete _0x3ead77[_0x94b7('0x4e')]['id'];}return db[_0x94b7('0x33')][_0x94b7('0x51')]({'where':{'id':_0x3ead77[_0x94b7('0x4f')]['id']}})[_0x94b7('0x18')](handleEntityNotFound(_0x3a97aa,null))[_0x94b7('0x18')](function(_0x81b29c){if(_0x81b29c){return _0x81b29c[_0x94b7('0x58')](_0x3ead77[_0x94b7('0x4e')][_0x94b7('0x59')]||[]);}return null;})[_0x94b7('0x18')](respondWithResult(_0x3a97aa,null))[_0x94b7('0x22')](handleError(_0x3a97aa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f256938..eb1ccb6 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 _0x35a9=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x35a9,0x124));var _0x935a=function(_0x5cf5dd,_0x2eff32){_0x5cf5dd=_0x5cf5dd-0x0;var _0x2e66f5=_0x35a9[_0x5cf5dd];return _0x2e66f5;};'use strict';var _=require(_0x935a('0x0'));var util=require(_0x935a('0x1'));var logger=require(_0x935a('0x2'))('api');var moment=require(_0x935a('0x3'));var BPromise=require(_0x935a('0x4'));var rp=require(_0x935a('0x5'));var fs=require('fs');var path=require(_0x935a('0x6'));var rimraf=require(_0x935a('0x7'));var config=require(_0x935a('0x8'));var attributes=require(_0x935a('0x9'));module['exports']=function(_0x2e2417,_0x15145d){return _0x2e2417[_0x935a('0xa')](_0x935a('0xb'),attributes,{'tableName':_0x935a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66b9=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x369fb5,_0x177be9){var _0x524685=function(_0xc1e13){while(--_0xc1e13){_0x369fb5['push'](_0x369fb5['shift']());}};_0x524685(++_0x177be9);}(_0x66b9,0x1f3));var _0x966b=function(_0x41c2dd,_0x4f9ce9){_0x41c2dd=_0x41c2dd-0x0;var _0x29913a=_0x66b9[_0x41c2dd];return _0x29913a;};'use strict';var _=require(_0x966b('0x0'));var util=require('util');var logger=require(_0x966b('0x1'))(_0x966b('0x2'));var moment=require(_0x966b('0x3'));var BPromise=require(_0x966b('0x4'));var rp=require(_0x966b('0x5'));var fs=require('fs');var path=require(_0x966b('0x6'));var rimraf=require(_0x966b('0x7'));var config=require('../../config/environment');var attributes=require(_0x966b('0x8'));module['exports']=function(_0x5440ec,_0x2f46d1){return _0x5440ec[_0x966b('0x9')](_0x966b('0xa'),attributes,{'tableName':_0x966b('0xb'),'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 3e87215..c7c2856 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 _0xfd16=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug'];(function(_0x132844,_0x98bc49){var _0x13c26f=function(_0xf5c16f){while(--_0xf5c16f){_0x132844['push'](_0x132844['shift']());}};_0x13c26f(++_0x98bc49);}(_0xfd16,0x169));var _0x6fd1=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xfd16[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require('lodash');var util=require(_0x6fd1('0x0'));var moment=require('moment');var BPromise=require(_0x6fd1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fd1('0x2'))['db'];var utils=require(_0x6fd1('0x3'));var logger=require(_0x6fd1('0x4'))(_0x6fd1('0x5'));var config=require('../../config/environment');var jayson=require(_0x6fd1('0x6'));var client=jayson[_0x6fd1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa17047,_0x3077b1,_0x57d62d){return new BPromise(function(_0x33f89a,_0x2fad7b){return client[_0x6fd1('0x8')](_0xa17047,_0x57d62d)[_0x6fd1('0x9')](function(_0x2a235e){logger[_0x6fd1('0xa')](_0x6fd1('0xb'),_0x3077b1,'request\x20sent');logger[_0x6fd1('0xc')](_0x6fd1('0xd'),_0x3077b1,'request\x20sent',JSON['stringify'](_0x2a235e));if(_0x2a235e['error']){if(_0x2a235e['error']['code']===0x1f4){logger[_0x6fd1('0xe')](_0x6fd1('0xb'),_0x3077b1,_0x2a235e[_0x6fd1('0xe')][_0x6fd1('0xf')]);return _0x2fad7b(_0x2a235e[_0x6fd1('0xe')][_0x6fd1('0xf')]);}logger[_0x6fd1('0xe')](_0x6fd1('0xb'),_0x3077b1,_0x2a235e['error'][_0x6fd1('0xf')]);return _0x33f89a(_0x2a235e['error']['message']);}else{logger[_0x6fd1('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3077b1,'request\x20sent');_0x33f89a(_0x2a235e['result'][_0x6fd1('0xf')]);}})[_0x6fd1('0x10')](function(_0x46eda3){logger[_0x6fd1('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3077b1,_0x46eda3);_0x2fad7b(_0x46eda3);});});} \ No newline at end of file +var _0xbcbc=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x2e797b,_0x876682){var _0x3ccaf1=function(_0xa5afc){while(--_0xa5afc){_0x2e797b['push'](_0x2e797b['shift']());}};_0x3ccaf1(++_0x876682);}(_0xbcbc,0x171));var _0xcbcb=function(_0x5e6dc5,_0x597431){_0x5e6dc5=_0x5e6dc5-0x0;var _0x4f71f4=_0xbcbc[_0x5e6dc5];return _0x4f71f4;};'use strict';var _=require(_0xcbcb('0x0'));var util=require(_0xcbcb('0x1'));var moment=require('moment');var BPromise=require(_0xcbcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbcb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbcb('0x4'));var logger=require('../../config/logger')(_0xcbcb('0x5'));var config=require(_0xcbcb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcbcb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x542b2d,_0x26a55a,_0x50e82d){return new BPromise(function(_0x533215,_0x45b868){return client[_0xcbcb('0x8')](_0x542b2d,_0x50e82d)[_0xcbcb('0x9')](function(_0x307704){logger[_0xcbcb('0xa')](_0xcbcb('0xb'),_0x26a55a,_0xcbcb('0xc'));logger[_0xcbcb('0xd')](_0xcbcb('0xe'),_0x26a55a,'request\x20sent',JSON[_0xcbcb('0xf')](_0x307704));if(_0x307704[_0xcbcb('0x10')]){if(_0x307704['error'][_0xcbcb('0x11')]===0x1f4){logger[_0xcbcb('0x10')](_0xcbcb('0xb'),_0x26a55a,_0x307704[_0xcbcb('0x10')][_0xcbcb('0x12')]);return _0x45b868(_0x307704['error'][_0xcbcb('0x12')]);}logger['error'](_0xcbcb('0xb'),_0x26a55a,_0x307704[_0xcbcb('0x10')]['message']);return _0x533215(_0x307704[_0xcbcb('0x10')]['message']);}else{logger[_0xcbcb('0xa')](_0xcbcb('0xb'),_0x26a55a,_0xcbcb('0xc'));_0x533215(_0x307704[_0xcbcb('0x13')][_0xcbcb('0x12')]);}})[_0xcbcb('0x14')](function(_0x16de12){logger[_0xcbcb('0x10')](_0xcbcb('0xb'),_0x26a55a,_0x16de12);_0x45b868(_0x16de12);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1dabc75..0c58fce 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 _0x54da=['exports','multer','path','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','/:id','isAuthenticated','create','put','update'];(function(_0x2be4a5,_0x615c76){var _0xc56f8=function(_0x5b3ebe){while(--_0x5b3ebe){_0x2be4a5['push'](_0x2be4a5['shift']());}};_0xc56f8(++_0x615c76);}(_0x54da,0x9d));var _0xa54d=function(_0x125243,_0x119e35){_0x125243=_0x125243-0x0;var _0x1e1a69=_0x54da[_0x125243];return _0x1e1a69;};'use strict';var multer=require(_0xa54d('0x0'));var util=require('util');var path=require(_0xa54d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa54d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa54d('0x3'));var config=require(_0xa54d('0x4'));var controller=require(_0xa54d('0x5'));router[_0xa54d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa54d('0x6')](_0xa54d('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa54d('0x8')](),controller[_0xa54d('0x9')]);router[_0xa54d('0xa')]('/:id',auth[_0xa54d('0x8')](),controller[_0xa54d('0xb')]);router['delete']('/:id',auth[_0xa54d('0x8')](),controller['destroy']);module[_0xa54d('0xc')]=router; \ No newline at end of file +var _0xa4a7=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x4b6a25,_0x4a65d7){var _0x152dc9=function(_0x2d9342){while(--_0x2d9342){_0x4b6a25['push'](_0x4b6a25['shift']());}};_0x152dc9(++_0x4a65d7);}(_0xa4a7,0x81));var _0x7a4a=function(_0x2116b2,_0x138cd6){_0x2116b2=_0x2116b2-0x0;var _0x25baed=_0xa4a7[_0x2116b2];return _0x25baed;};'use strict';var multer=require(_0x7a4a('0x0'));var util=require(_0x7a4a('0x1'));var path=require(_0x7a4a('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a4a('0x3'));var router=express[_0x7a4a('0x4')]();var auth=require(_0x7a4a('0x5'));var interaction=require(_0x7a4a('0x6'));var config=require(_0x7a4a('0x7'));var controller=require(_0x7a4a('0x8'));router[_0x7a4a('0x9')]('/',auth[_0x7a4a('0xa')](),controller[_0x7a4a('0xb')]);router[_0x7a4a('0x9')](_0x7a4a('0xc'),auth[_0x7a4a('0xa')](),controller[_0x7a4a('0xd')]);router[_0x7a4a('0xe')]('/',auth[_0x7a4a('0xa')](),controller[_0x7a4a('0xf')]);router[_0x7a4a('0x10')](_0x7a4a('0xc'),auth[_0x7a4a('0xa')](),controller[_0x7a4a('0x11')]);router[_0x7a4a('0x12')](_0x7a4a('0xc'),auth['isAuthenticated'](),controller[_0x7a4a('0x13')]);module[_0x7a4a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1c4ad99..6fd28bf 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 _0x7b47=['exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x7b47,0x118));var _0x77b4=function(_0x2d481c,_0x5e7467){_0x2d481c=_0x2d481c-0x0;var _0x575954=_0x7b47[_0x2d481c];return _0x575954;};'use strict';var Sequelize=require('sequelize');module[_0x77b4('0x0')]={'type':{'type':Sequelize['ENUM'](_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'),_0x77b4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x77b4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x77b4('0x6')](_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'))},'keyContent':{'type':Sequelize[_0x77b4('0x5')]},'idField':{'type':Sequelize[_0x77b4('0x5')]},'nameField':{'type':Sequelize[_0x77b4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77b4('0x5')]}}; \ No newline at end of file +var _0x4a25=['keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x14afeb,_0x1d2903){var _0x7c708a=function(_0x363c25){while(--_0x363c25){_0x14afeb['push'](_0x14afeb['shift']());}};_0x7c708a(++_0x1d2903);}(_0x4a25,0x1d4));var _0x54a2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4a25[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x54a2('0x0'));module['exports']={'type':{'type':Sequelize[_0x54a2('0x1')]('string',_0x54a2('0x2'),_0x54a2('0x3'),_0x54a2('0x4')),'defaultValue':_0x54a2('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x54a2('0x6')]},'keyType':{'type':Sequelize[_0x54a2('0x1')](_0x54a2('0x5'),_0x54a2('0x2'),_0x54a2('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x54a2('0x6')]},'nameField':{'type':Sequelize[_0x54a2('0x6')]},'customField':{'type':Sequelize[_0x54a2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a99f998..80e04fc 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 _0x8f4c=['limit','set','Content-Range','apply','reject','save','update','then','error','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2039ca,_0x228e70){_0x2039ca=_0x2039ca-0x0;var _0x37795e=_0x8f4c[_0x2039ca];return _0x37795e;};'use strict';var pdf=require(_0xc8f4('0x0'));var emlformat=require(_0xc8f4('0x1'));var rimraf=require(_0xc8f4('0x2'));var zipdir=require(_0xc8f4('0x3'));var jsonpatch=require(_0xc8f4('0x4'));var rp=require(_0xc8f4('0x5'));var moment=require('moment');var BPromise=require(_0xc8f4('0x6'));var Mustache=require(_0xc8f4('0x7'));var util=require(_0xc8f4('0x8'));var path=require('path');var sox=require(_0xc8f4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0xd'));var querystring=require(_0xc8f4('0xe'));var Papa=require(_0xc8f4('0xf'));var Redis=require('ioredis');var authService=require(_0xc8f4('0x10'));var qs=require(_0xc8f4('0x11'));var as=require(_0xc8f4('0x12'));var hardwareService=require(_0xc8f4('0x13'));var logger=require('../../config/logger')(_0xc8f4('0x14'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x15'));var licenseUtil=require(_0xc8f4('0x16'));var db=require(_0xc8f4('0x17'))['db'];function respondWithStatusCode(_0x729f8f,_0x39b785){_0x39b785=_0x39b785||0xcc;return function(_0x4e31cf){if(_0x4e31cf){return _0x729f8f[_0xc8f4('0x18')](_0x39b785);}return _0x729f8f[_0xc8f4('0x19')](_0x39b785)[_0xc8f4('0x1a')]();};}function respondWithResult(_0x14bc11,_0x1dcee5){_0x1dcee5=_0x1dcee5||0xc8;return function(_0x411c5c){if(_0x411c5c){return _0x14bc11['status'](_0x1dcee5)[_0xc8f4('0x1b')](_0x411c5c);}};}function respondWithFilteredResult(_0x2c7bc1,_0x1518a6){return function(_0x46ac15){if(_0x46ac15){var _0x22c08a=_0x46ac15['count'],_0x56a25d=_0x1518a6[_0xc8f4('0x1c')],_0xac45d5=_0x1518a6[_0xc8f4('0x1c')]+_0x1518a6[_0xc8f4('0x1d')],_0x4d2b77;if(_0xac45d5>=_0x22c08a){_0xac45d5=_0x22c08a;_0x4d2b77=0xc8;}else{_0x4d2b77=0xce;}_0x2c7bc1[_0xc8f4('0x19')](_0x4d2b77);return _0x2c7bc1[_0xc8f4('0x1e')](_0xc8f4('0x1f'),_0x56a25d+'-'+_0xac45d5+'/'+_0x22c08a)[_0xc8f4('0x1b')](_0x46ac15);}return null;};}function patchUpdates(_0x1074bf){return function(_0x1982bb){try{jsonpatch[_0xc8f4('0x20')](_0x1982bb,_0x1074bf,!![]);}catch(_0x3cd90c){return BPromise[_0xc8f4('0x21')](_0x3cd90c);}return _0x1982bb[_0xc8f4('0x22')]();};}function saveUpdates(_0x5f3264,_0x378f56){return function(_0x5c520){if(_0x5c520){return _0x5c520[_0xc8f4('0x23')](_0x5f3264)[_0xc8f4('0x24')](function(_0xdbc027){return _0xdbc027;});}return null;};}function removeEntity(_0x3b42ee,_0xaeee7d){return function(_0x43eb57){if(_0x43eb57){return _0x43eb57['destroy']()[_0xc8f4('0x24')](function(){_0x3b42ee[_0xc8f4('0x19')](0xcc)[_0xc8f4('0x1a')]();});}};}function handleEntityNotFound(_0x1d159e,_0x5d54a9){return function(_0x39174f){if(!_0x39174f){_0x1d159e['sendStatus'](0x194);}return _0x39174f;};}function handleError(_0x3782fd,_0x540b25){_0x540b25=_0x540b25||0x1f4;return function(_0x177a44){logger[_0xc8f4('0x25')](_0x177a44['stack']);if(_0x177a44[_0xc8f4('0x26')]){delete _0x177a44[_0xc8f4('0x26')];}_0x3782fd[_0xc8f4('0x19')](_0x540b25)[_0xc8f4('0x27')](_0x177a44);};}exports['index']=function(_0x3db490,_0x3484b6){var _0x5db666={},_0x190f61={},_0x37957c={'count':0x0,'rows':[]};var _0x157ad5=_[_0xc8f4('0x28')](db[_0xc8f4('0x29')][_0xc8f4('0x2a')],function(_0x4a25da){return{'name':_0x4a25da[_0xc8f4('0x2b')],'type':_0x4a25da[_0xc8f4('0x2c')][_0xc8f4('0x2d')]};});_0x190f61['model']=_[_0xc8f4('0x28')](_0x157ad5,_0xc8f4('0x26'));_0x190f61['query']=_['keys'](_0x3db490['query']);_0x190f61[_0xc8f4('0x2e')]=_[_0xc8f4('0x2f')](_0x190f61[_0xc8f4('0x30')],_0x190f61[_0xc8f4('0x31')]);_0x5db666[_0xc8f4('0x32')]=_[_0xc8f4('0x2f')](_0x190f61[_0xc8f4('0x30')],qs[_0xc8f4('0x33')](_0x3db490['query'][_0xc8f4('0x33')]));_0x5db666[_0xc8f4('0x32')]=_0x5db666[_0xc8f4('0x32')]['length']?_0x5db666[_0xc8f4('0x32')]:_0x190f61[_0xc8f4('0x30')];if(!_0x3db490['query'][_0xc8f4('0x34')](_0xc8f4('0x35'))){_0x5db666[_0xc8f4('0x1d')]=qs['limit'](_0x3db490[_0xc8f4('0x31')][_0xc8f4('0x1d')]);_0x5db666[_0xc8f4('0x1c')]=qs['offset'](_0x3db490[_0xc8f4('0x31')][_0xc8f4('0x1c')]);}_0x5db666[_0xc8f4('0x36')]=qs[_0xc8f4('0x37')](_0x3db490[_0xc8f4('0x31')][_0xc8f4('0x37')]);_0x5db666[_0xc8f4('0x38')]=qs[_0xc8f4('0x2e')](_[_0xc8f4('0x39')](_0x3db490[_0xc8f4('0x31')],_0x190f61[_0xc8f4('0x2e')]),_0x157ad5);if(_0x3db490[_0xc8f4('0x31')][_0xc8f4('0x3a')]){_0x5db666[_0xc8f4('0x38')]=_[_0xc8f4('0x3b')](_0x5db666[_0xc8f4('0x38')],{'$or':_['map'](_0x157ad5,function(_0x3a8cac){if(_0x3a8cac['type']!==_0xc8f4('0x3c')){var _0x51bfe6={};_0x51bfe6[_0x3a8cac[_0xc8f4('0x26')]]={'$like':'%'+_0x3db490[_0xc8f4('0x31')][_0xc8f4('0x3a')]+'%'};return _0x51bfe6;}})});}_0x5db666=_[_0xc8f4('0x3b')]({},_0x5db666,_0x3db490[_0xc8f4('0x3d')]);var _0x724060={'where':_0x5db666[_0xc8f4('0x38')]};return db['ZendeskField'][_0xc8f4('0x3e')](_0x724060)[_0xc8f4('0x24')](function(_0x3963f4){_0x37957c[_0xc8f4('0x3e')]=_0x3963f4;if(_0x3db490['query'][_0xc8f4('0x3f')]){_0x5db666[_0xc8f4('0x40')]=[{'all':!![]}];}return db[_0xc8f4('0x29')][_0xc8f4('0x41')](_0x5db666);})[_0xc8f4('0x24')](function(_0x1d7831){_0x37957c[_0xc8f4('0x42')]=_0x1d7831;return _0x37957c;})[_0xc8f4('0x24')](respondWithFilteredResult(_0x3484b6,_0x5db666))[_0xc8f4('0x43')](handleError(_0x3484b6,null));};exports[_0xc8f4('0x44')]=function(_0x211aca,_0xd56415){var _0x5257e3={'raw':!![],'where':{'id':_0x211aca[_0xc8f4('0x45')]['id']}},_0x227cdb={};_0x227cdb[_0xc8f4('0x30')]=_[_0xc8f4('0x46')](db['ZendeskField']['rawAttributes']);_0x227cdb[_0xc8f4('0x31')]=_[_0xc8f4('0x46')](_0x211aca['query']);_0x227cdb[_0xc8f4('0x2e')]=_[_0xc8f4('0x2f')](_0x227cdb['model'],_0x227cdb['query']);_0x5257e3[_0xc8f4('0x32')]=_[_0xc8f4('0x2f')](_0x227cdb[_0xc8f4('0x30')],qs[_0xc8f4('0x33')](_0x211aca[_0xc8f4('0x31')][_0xc8f4('0x33')]));_0x5257e3['attributes']=_0x5257e3['attributes'][_0xc8f4('0x47')]?_0x5257e3[_0xc8f4('0x32')]:_0x227cdb[_0xc8f4('0x30')];if(_0x211aca['query']['includeAll']){_0x5257e3['include']=[{'all':!![]}];}_0x5257e3=_['merge']({},_0x5257e3,_0x211aca['options']);return db[_0xc8f4('0x29')][_0xc8f4('0x48')](_0x5257e3)[_0xc8f4('0x24')](handleEntityNotFound(_0xd56415,null))[_0xc8f4('0x24')](respondWithResult(_0xd56415,null))[_0xc8f4('0x43')](handleError(_0xd56415,null));};exports[_0xc8f4('0x49')]=function(_0x511129,_0xdd7c1a){return db[_0xc8f4('0x29')]['create'](_0x511129['body'],{})[_0xc8f4('0x24')](respondWithResult(_0xdd7c1a,0xc9))[_0xc8f4('0x43')](handleError(_0xdd7c1a,null));};exports[_0xc8f4('0x23')]=function(_0xef0521,_0x5ae9dc){if(_0xef0521['body']['id']){delete _0xef0521[_0xc8f4('0x4a')]['id'];}return db[_0xc8f4('0x29')][_0xc8f4('0x48')]({'where':{'id':_0xef0521[_0xc8f4('0x45')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x5ae9dc,null))[_0xc8f4('0x24')](saveUpdates(_0xef0521['body'],null))['then'](respondWithResult(_0x5ae9dc,null))[_0xc8f4('0x43')](handleError(_0x5ae9dc,null));};exports[_0xc8f4('0x4b')]=function(_0x199b7d,_0x1b3744){return db[_0xc8f4('0x29')][_0xc8f4('0x48')]({'where':{'id':_0x199b7d[_0xc8f4('0x45')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x1b3744,null))[_0xc8f4('0x24')](removeEntity(_0x1b3744,null))['catch'](handleError(_0x1b3744,null));}; \ No newline at end of file +var _0x3e24=['bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','keys','length','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e24,0x167));var _0x43e2=function(_0xb4bd53,_0x2a6033){_0xb4bd53=_0xb4bd53-0x0;var _0x3c2969=_0x3e24[_0xb4bd53];return _0x3c2969;};'use strict';var pdf=require(_0x43e2('0x0'));var emlformat=require(_0x43e2('0x1'));var rimraf=require(_0x43e2('0x2'));var zipdir=require(_0x43e2('0x3'));var jsonpatch=require(_0x43e2('0x4'));var rp=require('request-promise');var moment=require(_0x43e2('0x5'));var BPromise=require(_0x43e2('0x6'));var Mustache=require('mustache');var util=require(_0x43e2('0x7'));var path=require(_0x43e2('0x8'));var sox=require(_0x43e2('0x9'));var csv=require(_0x43e2('0xa'));var ejs=require(_0x43e2('0xb'));var fs=require('fs');var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var licenseUtil=require(_0x43e2('0x16'));var db=require(_0x43e2('0x17'))['db'];function respondWithStatusCode(_0x44781a,_0x43ba14){_0x43ba14=_0x43ba14||0xcc;return function(_0x68e82d){if(_0x68e82d){return _0x44781a[_0x43e2('0x18')](_0x43ba14);}return _0x44781a[_0x43e2('0x19')](_0x43ba14)[_0x43e2('0x1a')]();};}function respondWithResult(_0x218ae7,_0x377097){_0x377097=_0x377097||0xc8;return function(_0x3ccccd){if(_0x3ccccd){return _0x218ae7['status'](_0x377097)[_0x43e2('0x1b')](_0x3ccccd);}};}function respondWithFilteredResult(_0x40fb7b,_0xb929b5){return function(_0x2a0fb0){if(_0x2a0fb0){var _0x5cea01=_0x2a0fb0[_0x43e2('0x1c')],_0x4a6443=_0xb929b5[_0x43e2('0x1d')],_0x241da2=_0xb929b5[_0x43e2('0x1d')]+_0xb929b5[_0x43e2('0x1e')],_0x417ce5;if(_0x241da2>=_0x5cea01){_0x241da2=_0x5cea01;_0x417ce5=0xc8;}else{_0x417ce5=0xce;}_0x40fb7b[_0x43e2('0x19')](_0x417ce5);return _0x40fb7b[_0x43e2('0x1f')](_0x43e2('0x20'),_0x4a6443+'-'+_0x241da2+'/'+_0x5cea01)[_0x43e2('0x1b')](_0x2a0fb0);}return null;};}function patchUpdates(_0x4879e9){return function(_0x3ee34c){try{jsonpatch[_0x43e2('0x21')](_0x3ee34c,_0x4879e9,!![]);}catch(_0x4de509){return BPromise[_0x43e2('0x22')](_0x4de509);}return _0x3ee34c['save']();};}function saveUpdates(_0x3bc2ce,_0x13610f){return function(_0x1fac53){if(_0x1fac53){return _0x1fac53[_0x43e2('0x23')](_0x3bc2ce)[_0x43e2('0x24')](function(_0x5ae97b){return _0x5ae97b;});}return null;};}function removeEntity(_0x3b0357,_0x12d842){return function(_0x272934){if(_0x272934){return _0x272934['destroy']()[_0x43e2('0x24')](function(){_0x3b0357[_0x43e2('0x19')](0xcc)[_0x43e2('0x1a')]();});}};}function handleEntityNotFound(_0x11b285,_0x4f20e6){return function(_0x3b5b97){if(!_0x3b5b97){_0x11b285[_0x43e2('0x18')](0x194);}return _0x3b5b97;};}function handleError(_0x215cb7,_0x3b7b22){_0x3b7b22=_0x3b7b22||0x1f4;return function(_0x178223){logger[_0x43e2('0x25')](_0x178223[_0x43e2('0x26')]);if(_0x178223[_0x43e2('0x27')]){delete _0x178223[_0x43e2('0x27')];}_0x215cb7[_0x43e2('0x19')](_0x3b7b22)[_0x43e2('0x28')](_0x178223);};}exports[_0x43e2('0x29')]=function(_0x52ed49,_0x430a0e){var _0x2f2bd8={},_0x545246={},_0x163063={'count':0x0,'rows':[]};var _0x1883c6=_[_0x43e2('0x2a')](db[_0x43e2('0x2b')][_0x43e2('0x2c')],function(_0x5a896b){return{'name':_0x5a896b[_0x43e2('0x2d')],'type':_0x5a896b[_0x43e2('0x2e')][_0x43e2('0x2f')]};});_0x545246[_0x43e2('0x30')]=_[_0x43e2('0x2a')](_0x1883c6,_0x43e2('0x27'));_0x545246['query']=_['keys'](_0x52ed49[_0x43e2('0x31')]);_0x545246[_0x43e2('0x32')]=_[_0x43e2('0x33')](_0x545246[_0x43e2('0x30')],_0x545246[_0x43e2('0x31')]);_0x2f2bd8['attributes']=_[_0x43e2('0x33')](_0x545246[_0x43e2('0x30')],qs[_0x43e2('0x34')](_0x52ed49[_0x43e2('0x31')][_0x43e2('0x34')]));_0x2f2bd8[_0x43e2('0x35')]=_0x2f2bd8[_0x43e2('0x35')]['length']?_0x2f2bd8['attributes']:_0x545246[_0x43e2('0x30')];if(!_0x52ed49[_0x43e2('0x31')]['hasOwnProperty'](_0x43e2('0x36'))){_0x2f2bd8[_0x43e2('0x1e')]=qs['limit'](_0x52ed49[_0x43e2('0x31')]['limit']);_0x2f2bd8['offset']=qs['offset'](_0x52ed49[_0x43e2('0x31')]['offset']);}_0x2f2bd8[_0x43e2('0x37')]=qs[_0x43e2('0x38')](_0x52ed49[_0x43e2('0x31')][_0x43e2('0x38')]);_0x2f2bd8[_0x43e2('0x39')]=qs[_0x43e2('0x32')](_[_0x43e2('0x3a')](_0x52ed49[_0x43e2('0x31')],_0x545246[_0x43e2('0x32')]),_0x1883c6);if(_0x52ed49[_0x43e2('0x31')][_0x43e2('0x3b')]){_0x2f2bd8[_0x43e2('0x39')]=_[_0x43e2('0x3c')](_0x2f2bd8[_0x43e2('0x39')],{'$or':_[_0x43e2('0x2a')](_0x1883c6,function(_0x40b39b){if(_0x40b39b[_0x43e2('0x2e')]!=='VIRTUAL'){var _0x4da45f={};_0x4da45f[_0x40b39b['name']]={'$like':'%'+_0x52ed49[_0x43e2('0x31')][_0x43e2('0x3b')]+'%'};return _0x4da45f;}})});}_0x2f2bd8=_['merge']({},_0x2f2bd8,_0x52ed49['options']);var _0x2b5fce={'where':_0x2f2bd8[_0x43e2('0x39')]};return db[_0x43e2('0x2b')][_0x43e2('0x1c')](_0x2b5fce)[_0x43e2('0x24')](function(_0xd316f9){_0x163063[_0x43e2('0x1c')]=_0xd316f9;if(_0x52ed49[_0x43e2('0x31')][_0x43e2('0x3d')]){_0x2f2bd8[_0x43e2('0x3e')]=[{'all':!![]}];}return db[_0x43e2('0x2b')][_0x43e2('0x3f')](_0x2f2bd8);})[_0x43e2('0x24')](function(_0x280074){_0x163063['rows']=_0x280074;return _0x163063;})[_0x43e2('0x24')](respondWithFilteredResult(_0x430a0e,_0x2f2bd8))['catch'](handleError(_0x430a0e,null));};exports[_0x43e2('0x40')]=function(_0x5e8c0b,_0x19ce1b){var _0x2ce990={'raw':!![],'where':{'id':_0x5e8c0b['params']['id']}},_0x273323={};_0x273323[_0x43e2('0x30')]=_['keys'](db[_0x43e2('0x2b')][_0x43e2('0x2c')]);_0x273323[_0x43e2('0x31')]=_[_0x43e2('0x41')](_0x5e8c0b['query']);_0x273323['filters']=_[_0x43e2('0x33')](_0x273323[_0x43e2('0x30')],_0x273323[_0x43e2('0x31')]);_0x2ce990[_0x43e2('0x35')]=_['intersection'](_0x273323[_0x43e2('0x30')],qs[_0x43e2('0x34')](_0x5e8c0b[_0x43e2('0x31')][_0x43e2('0x34')]));_0x2ce990[_0x43e2('0x35')]=_0x2ce990['attributes'][_0x43e2('0x42')]?_0x2ce990['attributes']:_0x273323[_0x43e2('0x30')];if(_0x5e8c0b[_0x43e2('0x31')]['includeAll']){_0x2ce990[_0x43e2('0x3e')]=[{'all':!![]}];}_0x2ce990=_['merge']({},_0x2ce990,_0x5e8c0b['options']);return db[_0x43e2('0x2b')][_0x43e2('0x43')](_0x2ce990)[_0x43e2('0x24')](handleEntityNotFound(_0x19ce1b,null))[_0x43e2('0x24')](respondWithResult(_0x19ce1b,null))[_0x43e2('0x44')](handleError(_0x19ce1b,null));};exports['create']=function(_0x1b001d,_0x17aaa8){return db[_0x43e2('0x2b')][_0x43e2('0x45')](_0x1b001d[_0x43e2('0x46')],{})[_0x43e2('0x24')](respondWithResult(_0x17aaa8,0xc9))[_0x43e2('0x44')](handleError(_0x17aaa8,null));};exports[_0x43e2('0x23')]=function(_0x5247c4,_0x1c6a0d){if(_0x5247c4[_0x43e2('0x46')]['id']){delete _0x5247c4['body']['id'];}return db[_0x43e2('0x2b')][_0x43e2('0x43')]({'where':{'id':_0x5247c4[_0x43e2('0x47')]['id']}})[_0x43e2('0x24')](handleEntityNotFound(_0x1c6a0d,null))['then'](saveUpdates(_0x5247c4[_0x43e2('0x46')],null))[_0x43e2('0x24')](respondWithResult(_0x1c6a0d,null))[_0x43e2('0x44')](handleError(_0x1c6a0d,null));};exports[_0x43e2('0x48')]=function(_0x42f27d,_0x4bb80f){return db['ZendeskField'][_0x43e2('0x43')]({'where':{'id':_0x42f27d[_0x43e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bb80f,null))[_0x43e2('0x24')](removeEntity(_0x4bb80f,null))[_0x43e2('0x44')](handleError(_0x4bb80f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2c916f6..b7ac10d 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 _0x2b50=['exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x1baf9e,_0x4a2585){var _0xbf5c4f=function(_0x4cbebd){while(--_0x4cbebd){_0x1baf9e['push'](_0x1baf9e['shift']());}};_0xbf5c4f(++_0x4a2585);}(_0x2b50,0x68));var _0x02b5=function(_0x35389f,_0x2c78b9){_0x35389f=_0x35389f-0x0;var _0x52c0cf=_0x2b50[_0x35389f];return _0x52c0cf;};'use strict';var _=require(_0x02b5('0x0'));var util=require('util');var logger=require(_0x02b5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x02b5('0x2'));var fs=require('fs');var path=require(_0x02b5('0x3'));var rimraf=require(_0x02b5('0x4'));var config=require(_0x02b5('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x02b5('0x6')]=function(_0x1670e0,_0x5ac1d1){return _0x1670e0['define']('ZendeskField',attributes,{'tableName':_0x02b5('0x7'),'paranoid':![],'indexes':[{'name':_0x02b5('0x8'),'fields':[_0x02b5('0x9'),_0x02b5('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d31=['FieldId','lodash','util','../../config/logger','moment','bluebird','path','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0xc43477,_0x25e8c5){var _0x4e5723=function(_0x5e1d33){while(--_0x5e1d33){_0xc43477['push'](_0xc43477['shift']());}};_0x4e5723(++_0x25e8c5);}(_0x5d31,0xb7));var _0x15d3=function(_0x14d08c,_0x5b7091){_0x14d08c=_0x14d08c-0x0;var _0x5f5bd9=_0x5d31[_0x14d08c];return _0x5f5bd9;};'use strict';var _=require(_0x15d3('0x0'));var util=require(_0x15d3('0x1'));var logger=require(_0x15d3('0x2'))('api');var moment=require(_0x15d3('0x3'));var BPromise=require(_0x15d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15d3('0x6'));module[_0x15d3('0x7')]=function(_0x4177c1,_0x378cb7){return _0x4177c1[_0x15d3('0x8')](_0x15d3('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x15d3('0xa'),'fields':[_0x15d3('0xb'),_0x15d3('0xc')],'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 a603bc1..5ecba71 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 _0x32a4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment'];(function(_0x468f22,_0xf2d232){var _0x2e4277=function(_0x2d88e2){while(--_0x2d88e2){_0x468f22['push'](_0x468f22['shift']());}};_0x2e4277(++_0xf2d232);}(_0x32a4,0xe4));var _0x432a=function(_0x19996d,_0x28545c){_0x19996d=_0x19996d-0x0;var _0x4c38bc=_0x32a4[_0x19996d];return _0x4c38bc;};'use strict';var _=require(_0x432a('0x0'));var util=require(_0x432a('0x1'));var moment=require(_0x432a('0x2'));var BPromise=require(_0x432a('0x3'));var rs=require(_0x432a('0x4'));var fs=require('fs');var Redis=require(_0x432a('0x5'));var db=require(_0x432a('0x6'))['db'];var utils=require(_0x432a('0x7'));var logger=require(_0x432a('0x8'))(_0x432a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x432a('0xa')][_0x432a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59a904,_0x121f54,_0x396c16){return new BPromise(function(_0x5606b8,_0x3408b5){return client[_0x432a('0xc')](_0x59a904,_0x396c16)['then'](function(_0x2a5727){logger[_0x432a('0xd')](_0x432a('0xe'),_0x121f54,'request\x20sent');logger['debug'](_0x432a('0xf'),_0x121f54,_0x432a('0x10'),JSON['stringify'](_0x2a5727));if(_0x2a5727[_0x432a('0x11')]){if(_0x2a5727['error'][_0x432a('0x12')]===0x1f4){logger[_0x432a('0x11')](_0x432a('0xe'),_0x121f54,_0x2a5727[_0x432a('0x11')][_0x432a('0x13')]);return _0x3408b5(_0x2a5727[_0x432a('0x11')][_0x432a('0x13')]);}logger[_0x432a('0x11')]('ZendeskField,\x20%s,\x20%s',_0x121f54,_0x2a5727[_0x432a('0x11')]['message']);return _0x5606b8(_0x2a5727[_0x432a('0x11')][_0x432a('0x13')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x121f54,_0x432a('0x10'));_0x5606b8(_0x2a5727['result'][_0x432a('0x13')]);}})[_0x432a('0x14')](function(_0x40cb05){logger[_0x432a('0x11')](_0x432a('0xe'),_0x121f54,_0x40cb05);_0x3408b5(_0x40cb05);});});} \ No newline at end of file +var _0x4e38=['error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','then','ZendeskField,\x20%s,\x20%s','debug','stringify'];(function(_0x3a493b,_0x44713b){var _0x3f61ea=function(_0x3715e0){while(--_0x3715e0){_0x3a493b['push'](_0x3a493b['shift']());}};_0x3f61ea(++_0x44713b);}(_0x4e38,0x197));var _0x84e3=function(_0x5a636b,_0x42781a){_0x5a636b=_0x5a636b-0x0;var _0x2e6745=_0x4e38[_0x5a636b];return _0x2e6745;};'use strict';var _=require(_0x84e3('0x0'));var util=require(_0x84e3('0x1'));var moment=require('moment');var BPromise=require(_0x84e3('0x2'));var rs=require(_0x84e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x84e3('0x5'));var config=require('../../config/environment');var jayson=require(_0x84e3('0x6'));var client=jayson[_0x84e3('0x7')][_0x84e3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bbbf8,_0x36c6ba,_0x8c70fb){return new BPromise(function(_0x1dd9d5,_0xe34218){return client['request'](_0x4bbbf8,_0x8c70fb)[_0x84e3('0x9')](function(_0x1e20b7){logger['info'](_0x84e3('0xa'),_0x36c6ba,'request\x20sent');logger[_0x84e3('0xb')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x36c6ba,'request\x20sent',JSON[_0x84e3('0xc')](_0x1e20b7));if(_0x1e20b7[_0x84e3('0xd')]){if(_0x1e20b7['error'][_0x84e3('0xe')]===0x1f4){logger[_0x84e3('0xd')](_0x84e3('0xa'),_0x36c6ba,_0x1e20b7[_0x84e3('0xd')]['message']);return _0xe34218(_0x1e20b7['error']['message']);}logger[_0x84e3('0xd')]('ZendeskField,\x20%s,\x20%s',_0x36c6ba,_0x1e20b7[_0x84e3('0xd')]['message']);return _0x1dd9d5(_0x1e20b7[_0x84e3('0xd')][_0x84e3('0xf')]);}else{logger[_0x84e3('0x10')](_0x84e3('0xa'),_0x36c6ba,_0x84e3('0x11'));_0x1dd9d5(_0x1e20b7[_0x84e3('0x12')]['message']);}})[_0x84e3('0x13')](function(_0x549b82){logger[_0x84e3('0xd')]('ZendeskField,\x20%s,\x20%s',_0x36c6ba,_0x549b82);_0xe34218(_0x549b82);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index dac615b..4f12e8e 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(_0x3edb58,_0x585d0a){var _0x26f385=function(_0x117c2a){while(--_0x117c2a){_0x3edb58['push'](_0x3edb58['shift']());}};_0x26f385(++_0x585d0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x3668b9,_0x5b3578){var _0x24dd13=function(_0x355834){while(--_0x355834){_0x3668b9['push'](_0x3668b9['shift']());}};_0x24dd13(++_0x5b3578);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 13d9f35..c79442c 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 _0x8b33=['exports','STRING'];(function(_0x2c1764,_0x38b4e0){var _0x251e49=function(_0x4c8256){while(--_0x4c8256){_0x2c1764['push'](_0x2c1764['shift']());}};_0x251e49(++_0x38b4e0);}(_0x8b33,0x64));var _0x38b3=function(_0x50283b,_0x55da92){_0x50283b=_0x50283b-0x0;var _0x56d82c=_0x8b33[_0x50283b];return _0x56d82c;};'use strict';var Sequelize=require('sequelize');module[_0x38b3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x38b3('0x1')]},'host':{'type':Sequelize[_0x38b3('0x1')]},'zone':{'type':Sequelize[_0x38b3('0x1')]},'clientId':{'type':Sequelize[_0x38b3('0x1')]},'clientSecret':{'type':Sequelize[_0x38b3('0x1')]},'serverUrl':{'type':Sequelize[_0x38b3('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x38b3('0x1')]},'refreshToken':{'type':Sequelize[_0x38b3('0x1')]}}; \ No newline at end of file +var _0xcee6=['STRING','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcee6,0xd6));var _0x6cee=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xcee6[_0x4bf96c];return _0x281d09;};'use strict';var Sequelize=require(_0x6cee('0x0'));module[_0x6cee('0x1')]={'name':{'type':Sequelize[_0x6cee('0x2')]},'description':{'type':Sequelize[_0x6cee('0x2')]},'host':{'type':Sequelize[_0x6cee('0x2')]},'zone':{'type':Sequelize[_0x6cee('0x2')]},'clientId':{'type':Sequelize[_0x6cee('0x2')]},'clientSecret':{'type':Sequelize[_0x6cee('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6cee('0x2')]},'refreshToken':{'type':Sequelize[_0x6cee('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index aeff7ac..2500ed8 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 _0x1131=['request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','status','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','merge','map','type','VIRTUAL','options','where','count','then','findAll','rows','params','includeAll','include','find','create','body','update','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s'];(function(_0x341eca,_0x37d57f){var _0x42acf8=function(_0x5c78f9){while(--_0x5c78f9){_0x341eca['push'](_0x341eca['shift']());}};_0x42acf8(++_0x37d57f);}(_0x1131,0x71));var _0x1113=function(_0x111154,_0x1e5e37){_0x111154=_0x111154-0x0;var _0xd50a13=_0x1131[_0x111154];return _0xd50a13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1113('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1113('0x1'));var moment=require(_0x1113('0x2'));var BPromise=require(_0x1113('0x3'));var Mustache=require(_0x1113('0x4'));var util=require(_0x1113('0x5'));var path=require(_0x1113('0x6'));var sox=require('sox');var csv=require(_0x1113('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1113('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1113('0x9'));var deskjs=require(_0x1113('0xa'));var toCsv=require(_0x1113('0x7'));var querystring=require(_0x1113('0xb'));var Papa=require(_0x1113('0xc'));var Redis=require(_0x1113('0xd'));var authService=require(_0x1113('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1113('0xf'));var logger=require(_0x1113('0x10'))(_0x1113('0x11'));var utils=require('../../config/utils');var config=require(_0x1113('0x12'));var licenseUtil=require(_0x1113('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1113('0x14'));var jayson=require(_0x1113('0x15'));var client=jayson[_0x1113('0x16')][_0x1113('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x517a7e,_0x5ef93f,_0x512b56,_0x4ca35c){return new BPromise(function(_0x5adf4b,_0x297410){var _0x15d10a=_0x4ca35c||client;return _0x15d10a[_0x1113('0x18')](_0x517a7e,_0x512b56)['then'](function(_0x120e45){logger[_0x1113('0x19')](_0x1113('0x1a'),_0x5ef93f,_0x1113('0x1b'));logger[_0x1113('0x1c')](_0x1113('0x1d'),_0x5ef93f,_0x1113('0x1b'),JSON[_0x1113('0x1e')](_0x120e45));if(_0x120e45[_0x1113('0x1f')]){if(_0x120e45[_0x1113('0x1f')]['code']===0x1f4){logger[_0x1113('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x5ef93f,_0x120e45[_0x1113('0x1f')]['message']);return _0x297410(_0x120e45[_0x1113('0x1f')][_0x1113('0x20')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5ef93f,_0x120e45['error']['message']);return _0x5adf4b(_0x120e45[_0x1113('0x1f')][_0x1113('0x20')]);}else{logger[_0x1113('0x19')](_0x1113('0x1a'),_0x5ef93f,_0x1113('0x1b'));_0x5adf4b(_0x120e45[_0x1113('0x21')][_0x1113('0x20')]);}})[_0x1113('0x22')](function(_0x161630){logger['error'](_0x1113('0x1a'),_0x5ef93f,_0x161630);_0x297410(_0x161630);});});}function respondWithStatusCode(_0x357726,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0xcc;return function(_0x4bae79){if(_0x4bae79){return _0x357726[_0x1113('0x23')](_0x1c9f6b);}return _0x357726['status'](_0x1c9f6b)[_0x1113('0x24')]();};}function respondWithResult(_0x46b4d5,_0x1ebc76){_0x1ebc76=_0x1ebc76||0xc8;return function(_0x35ae31){if(_0x35ae31){return _0x46b4d5['status'](_0x1ebc76)[_0x1113('0x25')](_0x35ae31);}};}function respondWithFilteredResult(_0x270cdc,_0x389410){return function(_0x2ae3d2){if(_0x2ae3d2){var _0x5c0b06=_0x2ae3d2['count'],_0xf75b83=_0x389410[_0x1113('0x26')],_0x3e4b26=_0x389410[_0x1113('0x26')]+_0x389410[_0x1113('0x27')],_0x36929b;if(_0x3e4b26>=_0x5c0b06){_0x3e4b26=_0x5c0b06;_0x36929b=0xc8;}else{_0x36929b=0xce;}_0x270cdc['status'](_0x36929b);return _0x270cdc[_0x1113('0x28')](_0x1113('0x29'),_0xf75b83+'-'+_0x3e4b26+'/'+_0x5c0b06)[_0x1113('0x25')](_0x2ae3d2);}return null;};}function patchUpdates(_0x641777){return function(_0x2a640a){try{jsonpatch[_0x1113('0x2a')](_0x2a640a,_0x641777,!![]);}catch(_0x36edc2){return BPromise[_0x1113('0x2b')](_0x36edc2);}return _0x2a640a[_0x1113('0x2c')]();};}function saveUpdates(_0x14dd61,_0xdab083){return function(_0x2a387f){if(_0x2a387f){return _0x2a387f['update'](_0x14dd61)['then'](function(_0x307f23){return _0x307f23;});}return null;};}function removeEntity(_0x2d5107,_0x503a53){return function(_0x428065){if(_0x428065){return _0x428065[_0x1113('0x2d')]()['then'](function(){_0x2d5107[_0x1113('0x2e')](0xcc)[_0x1113('0x24')]();});}};}function handleEntityNotFound(_0x4c4666,_0x31cc63){return function(_0x1d9235){if(!_0x1d9235){_0x4c4666[_0x1113('0x23')](0x194);}return _0x1d9235;};}function handleError(_0xe032fb,_0x49dc39){_0x49dc39=_0x49dc39||0x1f4;return function(_0x52e0c2){logger[_0x1113('0x1f')](_0x52e0c2[_0x1113('0x2f')]);if(_0x52e0c2['name']){delete _0x52e0c2[_0x1113('0x30')];}_0xe032fb['status'](_0x49dc39)[_0x1113('0x31')](_0x52e0c2);};}exports[_0x1113('0x32')]=function(_0x3e7abf,_0x391547){var _0x309059={},_0x184f67={},_0x5b387b={'count':0x0,'rows':[]};var _0x631426=_['map'](db[_0x1113('0x33')][_0x1113('0x34')],function(_0x4f21ce){return{'name':_0x4f21ce[_0x1113('0x35')],'type':_0x4f21ce['type'][_0x1113('0x36')]};});_0x184f67[_0x1113('0x37')]=_['map'](_0x631426,_0x1113('0x30'));_0x184f67['query']=_[_0x1113('0x38')](_0x3e7abf[_0x1113('0x39')]);_0x184f67[_0x1113('0x3a')]=_['intersection'](_0x184f67['model'],_0x184f67[_0x1113('0x39')]);_0x309059[_0x1113('0x3b')]=_[_0x1113('0x3c')](_0x184f67[_0x1113('0x37')],qs[_0x1113('0x3d')](_0x3e7abf[_0x1113('0x39')][_0x1113('0x3d')]));_0x309059['attributes']=_0x309059[_0x1113('0x3b')][_0x1113('0x3e')]?_0x309059[_0x1113('0x3b')]:_0x184f67[_0x1113('0x37')];if(!_0x3e7abf['query'][_0x1113('0x3f')]('nolimit')){_0x309059[_0x1113('0x27')]=qs[_0x1113('0x27')](_0x3e7abf[_0x1113('0x39')][_0x1113('0x27')]);_0x309059[_0x1113('0x26')]=qs[_0x1113('0x26')](_0x3e7abf[_0x1113('0x39')][_0x1113('0x26')]);}_0x309059[_0x1113('0x40')]=qs[_0x1113('0x41')](_0x3e7abf['query'][_0x1113('0x41')]);_0x309059['where']=qs['filters'](_['pick'](_0x3e7abf[_0x1113('0x39')],_0x184f67[_0x1113('0x3a')]),_0x631426);if(_0x3e7abf[_0x1113('0x39')][_0x1113('0x42')]){_0x309059['where']=_[_0x1113('0x43')](_0x309059['where'],{'$or':_[_0x1113('0x44')](_0x631426,function(_0x439d42){if(_0x439d42[_0x1113('0x45')]!==_0x1113('0x46')){var _0x585d88={};_0x585d88[_0x439d42[_0x1113('0x30')]]={'$like':'%'+_0x3e7abf[_0x1113('0x39')]['filter']+'%'};return _0x585d88;}})});}_0x309059=_[_0x1113('0x43')]({},_0x309059,_0x3e7abf[_0x1113('0x47')]);var _0x5aa335={'where':_0x309059[_0x1113('0x48')]};return db[_0x1113('0x33')][_0x1113('0x49')](_0x5aa335)[_0x1113('0x4a')](function(_0x3b2660){_0x5b387b[_0x1113('0x49')]=_0x3b2660;if(_0x3e7abf[_0x1113('0x39')]['includeAll']){_0x309059['include']=[{'all':!![]}];}return db[_0x1113('0x33')][_0x1113('0x4b')](_0x309059);})[_0x1113('0x4a')](function(_0x434c2c){_0x5b387b[_0x1113('0x4c')]=_0x434c2c;return _0x5b387b;})[_0x1113('0x4a')](respondWithFilteredResult(_0x391547,_0x309059))[_0x1113('0x22')](handleError(_0x391547,null));};exports['show']=function(_0xea171f,_0x19162c){var _0x37aa3b={'raw':![],'where':{'id':_0xea171f[_0x1113('0x4d')]['id']}},_0x1c7d4e={};_0x1c7d4e[_0x1113('0x37')]=_[_0x1113('0x38')](db[_0x1113('0x33')][_0x1113('0x34')]);_0x1c7d4e[_0x1113('0x39')]=_[_0x1113('0x38')](_0xea171f[_0x1113('0x39')]);_0x1c7d4e[_0x1113('0x3a')]=_[_0x1113('0x3c')](_0x1c7d4e[_0x1113('0x37')],_0x1c7d4e[_0x1113('0x39')]);_0x37aa3b[_0x1113('0x3b')]=_[_0x1113('0x3c')](_0x1c7d4e[_0x1113('0x37')],qs[_0x1113('0x3d')](_0xea171f['query'][_0x1113('0x3d')]));_0x37aa3b[_0x1113('0x3b')]=_0x37aa3b[_0x1113('0x3b')][_0x1113('0x3e')]?_0x37aa3b[_0x1113('0x3b')]:_0x1c7d4e[_0x1113('0x37')];if(_0xea171f['query'][_0x1113('0x4e')]){_0x37aa3b[_0x1113('0x4f')]=[{'all':!![]}];}_0x37aa3b=_['merge']({},_0x37aa3b,_0xea171f[_0x1113('0x47')]);return db['ZohoAccount'][_0x1113('0x50')](_0x37aa3b)[_0x1113('0x4a')](handleEntityNotFound(_0x19162c,null))['then'](respondWithResult(_0x19162c,null))['catch'](handleError(_0x19162c,null));};exports[_0x1113('0x51')]=function(_0x2ab7c8,_0x43f2d5){return db[_0x1113('0x33')]['create'](_0x2ab7c8[_0x1113('0x52')],{})[_0x1113('0x4a')](respondWithResult(_0x43f2d5,0xc9))['catch'](handleError(_0x43f2d5,null));};exports[_0x1113('0x53')]=function(_0x2de8c1,_0x33ac27){if(_0x2de8c1[_0x1113('0x52')]['id']){delete _0x2de8c1[_0x1113('0x52')]['id'];}return db[_0x1113('0x33')]['find']({'where':{'id':_0x2de8c1[_0x1113('0x4d')]['id']}})[_0x1113('0x4a')](handleEntityNotFound(_0x33ac27,null))[_0x1113('0x4a')](saveUpdates(_0x2de8c1[_0x1113('0x52')],null))['then'](respondWithResult(_0x33ac27,null))['catch'](handleError(_0x33ac27,null));};exports[_0x1113('0x2d')]=function(_0x2d0a52,_0x26866c){return db[_0x1113('0x33')][_0x1113('0x50')]({'where':{'id':_0x2d0a52[_0x1113('0x4d')]['id']}})[_0x1113('0x4a')](handleEntityNotFound(_0x26866c,null))[_0x1113('0x4a')](removeEntity(_0x26866c,null))[_0x1113('0x22')](handleError(_0x26866c,null));};exports[_0x1113('0x54')]=function(_0x33868d,_0x8b681,_0x25789e){var _0x495054={};var _0x15773d={};var _0x436452;var _0x34d886;return db[_0x1113('0x33')]['findOne']({'where':{'id':_0x33868d[_0x1113('0x4d')]['id']}})[_0x1113('0x4a')](handleEntityNotFound(_0x8b681,null))['then'](function(_0x15dadf){if(_0x15dadf){_0x436452=_0x15dadf;_0x15773d[_0x1113('0x37')]=_[_0x1113('0x38')](db[_0x1113('0x55')][_0x1113('0x34')]);_0x15773d[_0x1113('0x39')]=_['keys'](_0x33868d[_0x1113('0x39')]);_0x15773d[_0x1113('0x3a')]=_[_0x1113('0x3c')](_0x15773d[_0x1113('0x37')],_0x15773d[_0x1113('0x39')]);_0x495054[_0x1113('0x3b')]=_[_0x1113('0x3c')](_0x15773d[_0x1113('0x37')],qs['fields'](_0x33868d[_0x1113('0x39')][_0x1113('0x3d')]));_0x495054[_0x1113('0x3b')]=_0x495054[_0x1113('0x3b')]['length']?_0x495054[_0x1113('0x3b')]:_0x15773d[_0x1113('0x37')];_0x495054[_0x1113('0x40')]=qs[_0x1113('0x41')](_0x33868d[_0x1113('0x39')][_0x1113('0x41')]);_0x495054[_0x1113('0x48')]=qs[_0x1113('0x3a')](_['pick'](_0x33868d[_0x1113('0x39')],_0x15773d[_0x1113('0x3a')]));if(_0x33868d['query'][_0x1113('0x42')]){_0x495054[_0x1113('0x48')]=_[_0x1113('0x43')](_0x495054['where'],{'$or':_['map'](_0x495054[_0x1113('0x3b')],function(_0x49675f){var _0x5e6a25={};_0x5e6a25[_0x49675f]={'$like':'%'+_0x33868d[_0x1113('0x39')][_0x1113('0x42')]+'%'};return _0x5e6a25;})});}_0x495054=_[_0x1113('0x43')]({},_0x495054,_0x33868d[_0x1113('0x47')]);return _0x436452[_0x1113('0x54')](_0x495054);}})['then'](function(_0x5bff2e){if(_0x5bff2e){_0x34d886=_0x5bff2e[_0x1113('0x3e')];if(!_0x33868d[_0x1113('0x39')]['hasOwnProperty'](_0x1113('0x56'))){_0x495054['limit']=qs['limit'](_0x33868d['query'][_0x1113('0x27')]);_0x495054[_0x1113('0x26')]=qs['offset'](_0x33868d[_0x1113('0x39')][_0x1113('0x26')]);}return _0x436452[_0x1113('0x54')](_0x495054);}})[_0x1113('0x4a')](function(_0x14fb9b){if(_0x14fb9b){return _0x14fb9b?{'count':_0x34d886,'rows':_0x14fb9b}:null;}})[_0x1113('0x4a')](respondWithResult(_0x8b681,null))[_0x1113('0x22')](handleError(_0x8b681,null));};exports[_0x1113('0x57')]=function(_0x153d24,_0x237668,_0x45d1df){if(_0x153d24[_0x1113('0x52')]['id']){delete _0x153d24[_0x1113('0x52')]['id'];}return db[_0x1113('0x33')]['findOne']({'where':{'id':_0x153d24['params']['id']}})[_0x1113('0x4a')](handleEntityNotFound(_0x237668,null))[_0x1113('0x4a')](function(_0x2a22ce){if(_0x2a22ce){_0x153d24[_0x1113('0x52')][_0x1113('0x58')]=_0x2a22ce['id'];_0x153d24['body'][_0x1113('0x59')]=integrations[_0x1113('0x5a')](_0x153d24['body'][_0x1113('0x5b')],_0x153d24['body'][_0x1113('0x45')]);_0x153d24[_0x1113('0x52')][_0x1113('0x5c')]=integrations['getDescriptions'](_0x153d24[_0x1113('0x52')][_0x1113('0x5b')],_0x153d24['body']['type']);return db[_0x1113('0x55')][_0x1113('0x51')](_0x153d24['body'],{'include':[{'model':db[_0x1113('0x5d')],'as':_0x1113('0x59')},{'model':db[_0x1113('0x5d')],'as':_0x1113('0x5c')}]});}return null;})[_0x1113('0x4a')](respondWithResult(_0x237668,null))[_0x1113('0x22')](handleError(_0x237668,null));};function getAccessToken(_0x1ff18b){return new Promise(function(_0x240c9e,_0x2f1460){var _0x24f77b;switch(_0x1ff18b[_0x1113('0x5e')]){case'US':_0x24f77b=_0x1113('0x5f');break;case'AU':_0x24f77b=_0x1113('0x60');break;case'EU':_0x24f77b=_0x1113('0x61');break;case'IN':_0x24f77b='https://accounts.zoho.in';break;case'CN':_0x24f77b=_0x1113('0x62');break;default:_0x24f77b=_0x1113('0x61');break;}var _0x590bbe={'method':'POST','uri':_0x24f77b+_0x1113('0x63'),'qs':{'refresh_token':_0x1ff18b[_0x1113('0x64')],'client_id':_0x1ff18b[_0x1113('0x65')],'client_secret':_0x1ff18b[_0x1113('0x66')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x590bbe)['then'](function(_0x4589e5){if(_0x4589e5[_0x1113('0x67')]){_0x240c9e(_0x4589e5[_0x1113('0x67')]);}else{_0x2f1460(_0x1113('0x68'));}})[_0x1113('0x22')](function(_0x2cbb5b){_0x2f1460(_0x2cbb5b);});});}exports[_0x1113('0x69')]=function(_0x1e5c5c,_0x10ac1b,_0x530555){var _0x3d3b0e,_0x30e606,_0x4d4670,_0x9edccb,_0x5c5409;return db[_0x1113('0x33')][_0x1113('0x6a')]({'where':{'id':_0x1e5c5c['params']['id']},'attributes':['id',_0x1113('0x6b'),_0x1113('0x5e'),_0x1113('0x65'),_0x1113('0x66'),_0x1113('0x6c'),_0x1113('0x6d'),'refreshToken']})[_0x1113('0x4a')](handleEntityNotFound(_0x10ac1b,null))[_0x1113('0x4a')](function(_0x47bfdf){_0x5c5409=_0x47bfdf;_0x3d3b0e=_0x5c5409[_0x1113('0x6b')];_0x30e606=_0x3d3b0e===_0x1113('0x6e')?'eu':'com';_0x4d4670=_0x5c5409[_0x1113('0x6c')];var _0x2eb5e1=_0x4d4670[_0x1113('0x6f')](-0x1);if(_0x2eb5e1==='/'||_0x2eb5e1==='\x5c'||_0x2eb5e1===':'){_0x4d4670=_0x4d4670[_0x1113('0x70')](0x0,_0x4d4670[_0x1113('0x71')](_0x2eb5e1));}if(!_0x5c5409[_0x1113('0x64')]){throw new Error(_0x1113('0x72'));}return getAccessToken(_0x5c5409);})[_0x1113('0x4a')](function(_0x25af57){if(_0x25af57){return rp({'method':_0x1113('0x73'),'uri':util[_0x1113('0x74')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x30e606),'qs':{'module':_0x1113('0x75')},'headers':{'Authorization':_0x1113('0x76')+_0x25af57},'json':!![]});}})[_0x1113('0x4a')](function(_0x28f4cf){if(_0x28f4cf){if(_0x28f4cf[_0x1113('0x77')]&&_0x28f4cf[_0x1113('0x77')][_0x1113('0x1f')]){throw new Error(_0x28f4cf['response'][_0x1113('0x1f')]['message']);}var _0x5b6be1=[];var _0x4d0fd3=[];var _0x5e3fc2=[_0x1113('0x78'),_0x1113('0x79'),_0x1113('0x7a'),_0x1113('0x7b'),'Call_Duration',_0x1113('0x7c'),_0x1113('0x7d'),_0x1113('0x7e')];_0x4d0fd3=_[_0x1113('0x7f')](_0x28f4cf[_0x1113('0x3d')],function(_0x39a47c){return _0x5e3fc2['includes'](_0x39a47c[_0x1113('0x80')]);});for(var _0xed6271=0x0;_0xed6271<_0x4d0fd3[_0x1113('0x3e')];_0xed6271++){if(_0x4d0fd3[_0xed6271][_0x1113('0x81')]===![]){_0x5b6be1[_0x1113('0x82')]({'id':_0x4d0fd3[_0xed6271]['id'],'name':_0x4d0fd3[_0xed6271][_0x1113('0x83')],'custom':_0x4d0fd3[_0xed6271][_0x1113('0x84')],'options':_0x4d0fd3[_0xed6271][_0x1113('0x85')]===_0x1113('0x86')&&_0x4d0fd3[_0xed6271][_0x1113('0x87')]['length']>-0x1?_['map'](_0x4d0fd3[_0xed6271]['pick_list_values'],function(_0x16b98f){return{'name':_0x16b98f,'value':_0x16b98f};}):[]});}}return{'count':_0x5b6be1[_0x1113('0x3e')],'rows':_0x5b6be1};}else{return{'count':0x0,'rows':[]};}})[_0x1113('0x4a')](respondWithResult(_0x10ac1b,null))[_0x1113('0x22')](function(_0x213eb8){var _0x307c97=_0x1e5c5c['query'][_0x1113('0x88')]?0x1f4:_0x213eb8[_0x1113('0x89')]||0x1f4;logger[_0x1113('0x1f')](_0x1113('0x8a'),_0x1113('0x69'),_0x307c97,JSON[_0x1113('0x1e')](_0x213eb8));delete _0x213eb8['name'];if(_0x307c97===0x191){_0x307c97=0x190;}_0x10ac1b[_0x1113('0x2e')](_0x307c97)[_0x1113('0x31')](_0x1e5c5c[_0x1113('0x39')][_0x1113('0x88')]?{'message':_0x1113('0x8b'),'statusCode':_0x213eb8[_0x1113('0x89')]}:_0x213eb8);});}; \ No newline at end of file +var _0x6e1c=['clientId','clientSecret','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','params','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','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','refreshToken','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host'];(function(_0x3c03c7,_0x5ded5b){var _0x30752c=function(_0x1b663f){while(--_0x1b663f){_0x3c03c7['push'](_0x3c03c7['shift']());}};_0x30752c(++_0x5ded5b);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xc6e1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc6e1('0x1'));var jsonpatch=require(_0xc6e1('0x2'));var rp=require(_0xc6e1('0x3'));var moment=require(_0xc6e1('0x4'));var BPromise=require(_0xc6e1('0x5'));var Mustache=require(_0xc6e1('0x6'));var util=require(_0xc6e1('0x7'));var path=require(_0xc6e1('0x8'));var sox=require(_0xc6e1('0x9'));var csv=require(_0xc6e1('0xa'));var ejs=require(_0xc6e1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc6e1('0xc'));var crypto=require(_0xc6e1('0xd'));var jsforce=require(_0xc6e1('0xe'));var deskjs=require(_0xc6e1('0xf'));var toCsv=require(_0xc6e1('0xa'));var querystring=require('querystring');var Papa=require(_0xc6e1('0x10'));var Redis=require(_0xc6e1('0x11'));var authService=require(_0xc6e1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6e1('0x13'));var logger=require(_0xc6e1('0x14'))('api');var utils=require(_0xc6e1('0x15'));var config=require(_0xc6e1('0x16'));var licenseUtil=require(_0xc6e1('0x17'));var db=require(_0xc6e1('0x18'))['db'];var integrations=require(_0xc6e1('0x19'));var jayson=require(_0xc6e1('0x1a'));var client=jayson['client'][_0xc6e1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x402b0a,_0x355409,_0x2d554f,_0x3573dd){return new BPromise(function(_0x5a7e25,_0x599f47){var _0x42e7a1=_0x3573dd||client;return _0x42e7a1[_0xc6e1('0x1c')](_0x402b0a,_0x2d554f)['then'](function(_0x6a58af){logger[_0xc6e1('0x1d')](_0xc6e1('0x1e'),_0x355409,'request\x20sent');logger[_0xc6e1('0x1f')](_0xc6e1('0x20'),_0x355409,_0xc6e1('0x21'),JSON[_0xc6e1('0x22')](_0x6a58af));if(_0x6a58af['error']){if(_0x6a58af[_0xc6e1('0x23')][_0xc6e1('0x24')]===0x1f4){logger[_0xc6e1('0x23')](_0xc6e1('0x1e'),_0x355409,_0x6a58af[_0xc6e1('0x23')][_0xc6e1('0x25')]);return _0x599f47(_0x6a58af[_0xc6e1('0x23')][_0xc6e1('0x25')]);}logger[_0xc6e1('0x23')](_0xc6e1('0x1e'),_0x355409,_0x6a58af[_0xc6e1('0x23')][_0xc6e1('0x25')]);return _0x5a7e25(_0x6a58af[_0xc6e1('0x23')][_0xc6e1('0x25')]);}else{logger['info'](_0xc6e1('0x1e'),_0x355409,_0xc6e1('0x21'));_0x5a7e25(_0x6a58af[_0xc6e1('0x26')][_0xc6e1('0x25')]);}})[_0xc6e1('0x27')](function(_0x32e637){logger['error'](_0xc6e1('0x1e'),_0x355409,_0x32e637);_0x599f47(_0x32e637);});});}function respondWithStatusCode(_0x40b059,_0x5597d3){_0x5597d3=_0x5597d3||0xcc;return function(_0x6a44fb){if(_0x6a44fb){return _0x40b059[_0xc6e1('0x28')](_0x5597d3);}return _0x40b059['status'](_0x5597d3)['end']();};}function respondWithResult(_0x2e284e,_0x431cca){_0x431cca=_0x431cca||0xc8;return function(_0x5b0537){if(_0x5b0537){return _0x2e284e[_0xc6e1('0x29')](_0x431cca)[_0xc6e1('0x2a')](_0x5b0537);}};}function respondWithFilteredResult(_0x4de357,_0x400687){return function(_0x3b6f10){if(_0x3b6f10){var _0x240801=_0x3b6f10['count'],_0x26cec4=_0x400687[_0xc6e1('0x2b')],_0x71fa6d=_0x400687[_0xc6e1('0x2b')]+_0x400687[_0xc6e1('0x2c')],_0x191520;if(_0x71fa6d>=_0x240801){_0x71fa6d=_0x240801;_0x191520=0xc8;}else{_0x191520=0xce;}_0x4de357['status'](_0x191520);return _0x4de357[_0xc6e1('0x2d')](_0xc6e1('0x2e'),_0x26cec4+'-'+_0x71fa6d+'/'+_0x240801)[_0xc6e1('0x2a')](_0x3b6f10);}return null;};}function patchUpdates(_0x412f92){return function(_0x4e73b9){try{jsonpatch['apply'](_0x4e73b9,_0x412f92,!![]);}catch(_0x17c8f0){return BPromise[_0xc6e1('0x2f')](_0x17c8f0);}return _0x4e73b9['save']();};}function saveUpdates(_0x2cdb1e,_0x3d6d3d){return function(_0x3211af){if(_0x3211af){return _0x3211af[_0xc6e1('0x30')](_0x2cdb1e)[_0xc6e1('0x31')](function(_0x60446a){return _0x60446a;});}return null;};}function removeEntity(_0x424dda,_0x382235){return function(_0x52181e){if(_0x52181e){return _0x52181e[_0xc6e1('0x32')]()[_0xc6e1('0x31')](function(){_0x424dda[_0xc6e1('0x29')](0xcc)[_0xc6e1('0x33')]();});}};}function handleEntityNotFound(_0x10d890,_0xdfbf4f){return function(_0x5e1d9c){if(!_0x5e1d9c){_0x10d890['sendStatus'](0x194);}return _0x5e1d9c;};}function handleError(_0x2b91d6,_0x3ea695){_0x3ea695=_0x3ea695||0x1f4;return function(_0x1c5db9){logger['error'](_0x1c5db9[_0xc6e1('0x34')]);if(_0x1c5db9[_0xc6e1('0x35')]){delete _0x1c5db9['name'];}_0x2b91d6[_0xc6e1('0x29')](_0x3ea695)[_0xc6e1('0x36')](_0x1c5db9);};}exports[_0xc6e1('0x37')]=function(_0x25205c,_0x5c21ce){var _0xedafbb={},_0x5f32aa={},_0x253543={'count':0x0,'rows':[]};var _0x1c16f5=_[_0xc6e1('0x38')](db[_0xc6e1('0x39')][_0xc6e1('0x3a')],function(_0x595b55){return{'name':_0x595b55['fieldName'],'type':_0x595b55[_0xc6e1('0x3b')][_0xc6e1('0x3c')]};});_0x5f32aa[_0xc6e1('0x3d')]=_['map'](_0x1c16f5,_0xc6e1('0x35'));_0x5f32aa['query']=_[_0xc6e1('0x3e')](_0x25205c[_0xc6e1('0x3f')]);_0x5f32aa[_0xc6e1('0x40')]=_[_0xc6e1('0x41')](_0x5f32aa[_0xc6e1('0x3d')],_0x5f32aa[_0xc6e1('0x3f')]);_0xedafbb[_0xc6e1('0x42')]=_[_0xc6e1('0x41')](_0x5f32aa['model'],qs[_0xc6e1('0x43')](_0x25205c[_0xc6e1('0x3f')][_0xc6e1('0x43')]));_0xedafbb['attributes']=_0xedafbb['attributes'][_0xc6e1('0x44')]?_0xedafbb[_0xc6e1('0x42')]:_0x5f32aa[_0xc6e1('0x3d')];if(!_0x25205c['query'][_0xc6e1('0x45')](_0xc6e1('0x46'))){_0xedafbb[_0xc6e1('0x2c')]=qs['limit'](_0x25205c[_0xc6e1('0x3f')][_0xc6e1('0x2c')]);_0xedafbb[_0xc6e1('0x2b')]=qs[_0xc6e1('0x2b')](_0x25205c[_0xc6e1('0x3f')][_0xc6e1('0x2b')]);}_0xedafbb[_0xc6e1('0x47')]=qs[_0xc6e1('0x48')](_0x25205c[_0xc6e1('0x3f')][_0xc6e1('0x48')]);_0xedafbb[_0xc6e1('0x49')]=qs[_0xc6e1('0x40')](_[_0xc6e1('0x4a')](_0x25205c[_0xc6e1('0x3f')],_0x5f32aa[_0xc6e1('0x40')]),_0x1c16f5);if(_0x25205c['query'][_0xc6e1('0x4b')]){_0xedafbb[_0xc6e1('0x49')]=_['merge'](_0xedafbb[_0xc6e1('0x49')],{'$or':_[_0xc6e1('0x38')](_0x1c16f5,function(_0x84dc2){if(_0x84dc2[_0xc6e1('0x3b')]!==_0xc6e1('0x4c')){var _0x47e4bb={};_0x47e4bb[_0x84dc2[_0xc6e1('0x35')]]={'$like':'%'+_0x25205c[_0xc6e1('0x3f')]['filter']+'%'};return _0x47e4bb;}})});}_0xedafbb=_[_0xc6e1('0x4d')]({},_0xedafbb,_0x25205c[_0xc6e1('0x4e')]);var _0x20bbff={'where':_0xedafbb[_0xc6e1('0x49')]};return db['ZohoAccount'][_0xc6e1('0x4f')](_0x20bbff)[_0xc6e1('0x31')](function(_0x7b7a53){_0x253543[_0xc6e1('0x4f')]=_0x7b7a53;if(_0x25205c[_0xc6e1('0x3f')]['includeAll']){_0xedafbb[_0xc6e1('0x50')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc6e1('0x51')](_0xedafbb);})[_0xc6e1('0x31')](function(_0x44d5ae){_0x253543[_0xc6e1('0x52')]=_0x44d5ae;return _0x253543;})[_0xc6e1('0x31')](respondWithFilteredResult(_0x5c21ce,_0xedafbb))[_0xc6e1('0x27')](handleError(_0x5c21ce,null));};exports['show']=function(_0x2ec072,_0x3d200e){var _0x25787d={'raw':![],'where':{'id':_0x2ec072[_0xc6e1('0x53')]['id']}},_0x14c611={};_0x14c611['model']=_[_0xc6e1('0x3e')](db[_0xc6e1('0x39')]['rawAttributes']);_0x14c611['query']=_[_0xc6e1('0x3e')](_0x2ec072[_0xc6e1('0x3f')]);_0x14c611['filters']=_['intersection'](_0x14c611[_0xc6e1('0x3d')],_0x14c611[_0xc6e1('0x3f')]);_0x25787d[_0xc6e1('0x42')]=_[_0xc6e1('0x41')](_0x14c611[_0xc6e1('0x3d')],qs['fields'](_0x2ec072[_0xc6e1('0x3f')][_0xc6e1('0x43')]));_0x25787d[_0xc6e1('0x42')]=_0x25787d[_0xc6e1('0x42')][_0xc6e1('0x44')]?_0x25787d[_0xc6e1('0x42')]:_0x14c611[_0xc6e1('0x3d')];if(_0x2ec072['query'][_0xc6e1('0x54')]){_0x25787d[_0xc6e1('0x50')]=[{'all':!![]}];}_0x25787d=_['merge']({},_0x25787d,_0x2ec072[_0xc6e1('0x4e')]);return db[_0xc6e1('0x39')][_0xc6e1('0x55')](_0x25787d)[_0xc6e1('0x31')](handleEntityNotFound(_0x3d200e,null))[_0xc6e1('0x31')](respondWithResult(_0x3d200e,null))['catch'](handleError(_0x3d200e,null));};exports['create']=function(_0x4345b6,_0x222883){return db[_0xc6e1('0x39')][_0xc6e1('0x56')](_0x4345b6[_0xc6e1('0x57')],{})[_0xc6e1('0x31')](respondWithResult(_0x222883,0xc9))[_0xc6e1('0x27')](handleError(_0x222883,null));};exports[_0xc6e1('0x30')]=function(_0x13f49c,_0x2e3039){if(_0x13f49c[_0xc6e1('0x57')]['id']){delete _0x13f49c[_0xc6e1('0x57')]['id'];}return db[_0xc6e1('0x39')][_0xc6e1('0x55')]({'where':{'id':_0x13f49c[_0xc6e1('0x53')]['id']}})[_0xc6e1('0x31')](handleEntityNotFound(_0x2e3039,null))[_0xc6e1('0x31')](saveUpdates(_0x13f49c[_0xc6e1('0x57')],null))[_0xc6e1('0x31')](respondWithResult(_0x2e3039,null))[_0xc6e1('0x27')](handleError(_0x2e3039,null));};exports[_0xc6e1('0x32')]=function(_0x166745,_0x23a3e0){return db['ZohoAccount'][_0xc6e1('0x55')]({'where':{'id':_0x166745[_0xc6e1('0x53')]['id']}})[_0xc6e1('0x31')](handleEntityNotFound(_0x23a3e0,null))['then'](removeEntity(_0x23a3e0,null))[_0xc6e1('0x27')](handleError(_0x23a3e0,null));};exports[_0xc6e1('0x58')]=function(_0x2978bd,_0x2b0071,_0x28e4ac){var _0x18da8b={};var _0x3ea8af={};var _0x591c59;var _0xd4ff1a;return db[_0xc6e1('0x39')][_0xc6e1('0x59')]({'where':{'id':_0x2978bd[_0xc6e1('0x53')]['id']}})[_0xc6e1('0x31')](handleEntityNotFound(_0x2b0071,null))[_0xc6e1('0x31')](function(_0x54cfde){if(_0x54cfde){_0x591c59=_0x54cfde;_0x3ea8af[_0xc6e1('0x3d')]=_[_0xc6e1('0x3e')](db['ZohoConfiguration'][_0xc6e1('0x3a')]);_0x3ea8af[_0xc6e1('0x3f')]=_[_0xc6e1('0x3e')](_0x2978bd[_0xc6e1('0x3f')]);_0x3ea8af[_0xc6e1('0x40')]=_[_0xc6e1('0x41')](_0x3ea8af[_0xc6e1('0x3d')],_0x3ea8af[_0xc6e1('0x3f')]);_0x18da8b[_0xc6e1('0x42')]=_[_0xc6e1('0x41')](_0x3ea8af['model'],qs[_0xc6e1('0x43')](_0x2978bd[_0xc6e1('0x3f')][_0xc6e1('0x43')]));_0x18da8b[_0xc6e1('0x42')]=_0x18da8b[_0xc6e1('0x42')]['length']?_0x18da8b[_0xc6e1('0x42')]:_0x3ea8af['model'];_0x18da8b[_0xc6e1('0x47')]=qs[_0xc6e1('0x48')](_0x2978bd[_0xc6e1('0x3f')][_0xc6e1('0x48')]);_0x18da8b[_0xc6e1('0x49')]=qs[_0xc6e1('0x40')](_[_0xc6e1('0x4a')](_0x2978bd[_0xc6e1('0x3f')],_0x3ea8af[_0xc6e1('0x40')]));if(_0x2978bd['query'][_0xc6e1('0x4b')]){_0x18da8b[_0xc6e1('0x49')]=_['merge'](_0x18da8b[_0xc6e1('0x49')],{'$or':_[_0xc6e1('0x38')](_0x18da8b[_0xc6e1('0x42')],function(_0x723331){var _0x1e642a={};_0x1e642a[_0x723331]={'$like':'%'+_0x2978bd[_0xc6e1('0x3f')][_0xc6e1('0x4b')]+'%'};return _0x1e642a;})});}_0x18da8b=_[_0xc6e1('0x4d')]({},_0x18da8b,_0x2978bd[_0xc6e1('0x4e')]);return _0x591c59[_0xc6e1('0x58')](_0x18da8b);}})[_0xc6e1('0x31')](function(_0x5e2840){if(_0x5e2840){_0xd4ff1a=_0x5e2840['length'];if(!_0x2978bd['query']['hasOwnProperty'](_0xc6e1('0x46'))){_0x18da8b['limit']=qs['limit'](_0x2978bd[_0xc6e1('0x3f')][_0xc6e1('0x2c')]);_0x18da8b[_0xc6e1('0x2b')]=qs['offset'](_0x2978bd[_0xc6e1('0x3f')]['offset']);}return _0x591c59[_0xc6e1('0x58')](_0x18da8b);}})[_0xc6e1('0x31')](function(_0x499082){if(_0x499082){return _0x499082?{'count':_0xd4ff1a,'rows':_0x499082}:null;}})['then'](respondWithResult(_0x2b0071,null))[_0xc6e1('0x27')](handleError(_0x2b0071,null));};exports[_0xc6e1('0x5a')]=function(_0x27125d,_0x273c5a,_0x5a3756){if(_0x27125d[_0xc6e1('0x57')]['id']){delete _0x27125d['body']['id'];}return db['ZohoAccount'][_0xc6e1('0x59')]({'where':{'id':_0x27125d['params']['id']}})[_0xc6e1('0x31')](handleEntityNotFound(_0x273c5a,null))[_0xc6e1('0x31')](function(_0x5353ed){if(_0x5353ed){_0x27125d[_0xc6e1('0x57')][_0xc6e1('0x5b')]=_0x5353ed['id'];_0x27125d['body'][_0xc6e1('0x5c')]=integrations[_0xc6e1('0x5d')](_0x27125d['body'][_0xc6e1('0x5e')],_0x27125d[_0xc6e1('0x57')][_0xc6e1('0x3b')]);_0x27125d[_0xc6e1('0x57')][_0xc6e1('0x5f')]=integrations[_0xc6e1('0x60')](_0x27125d[_0xc6e1('0x57')][_0xc6e1('0x5e')],_0x27125d[_0xc6e1('0x57')][_0xc6e1('0x3b')]);return db[_0xc6e1('0x61')][_0xc6e1('0x56')](_0x27125d[_0xc6e1('0x57')],{'include':[{'model':db[_0xc6e1('0x62')],'as':'Subjects'},{'model':db[_0xc6e1('0x62')],'as':_0xc6e1('0x5f')}]});}return null;})[_0xc6e1('0x31')](respondWithResult(_0x273c5a,null))[_0xc6e1('0x27')](handleError(_0x273c5a,null));};function getAccessToken(_0x4161cd){return new Promise(function(_0x29847e,_0x150a98){var _0x382045;switch(_0x4161cd[_0xc6e1('0x63')]){case'US':_0x382045=_0xc6e1('0x64');break;case'AU':_0x382045=_0xc6e1('0x65');break;case'EU':_0x382045='https://accounts.zoho.eu';break;case'IN':_0x382045=_0xc6e1('0x66');break;case'CN':_0x382045=_0xc6e1('0x67');break;default:_0x382045=_0xc6e1('0x68');break;}var _0x1c0c00={'method':_0xc6e1('0x69'),'uri':_0x382045+_0xc6e1('0x6a'),'qs':{'refresh_token':_0x4161cd[_0xc6e1('0x6b')],'client_id':_0x4161cd['clientId'],'client_secret':_0x4161cd['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1c0c00)[_0xc6e1('0x31')](function(_0x570022){if(_0x570022[_0xc6e1('0x6c')]){_0x29847e(_0x570022[_0xc6e1('0x6c')]);}else{_0x150a98(_0xc6e1('0x6d'));}})['catch'](function(_0x54e22a){_0x150a98(_0x54e22a);});});}exports[_0xc6e1('0x6e')]=function(_0x294f4b,_0x338044,_0x111af1){var _0x3c2b08,_0x784a79,_0x367ec0,_0x5914bf,_0x10d74e;return db['ZohoAccount']['findOne']({'where':{'id':_0x294f4b[_0xc6e1('0x53')]['id']},'attributes':['id',_0xc6e1('0x6f'),_0xc6e1('0x63'),_0xc6e1('0x70'),_0xc6e1('0x71'),_0xc6e1('0x72'),_0xc6e1('0x24'),_0xc6e1('0x6b')]})[_0xc6e1('0x31')](handleEntityNotFound(_0x338044,null))[_0xc6e1('0x31')](function(_0x535ff6){_0x10d74e=_0x535ff6;_0x3c2b08=_0x10d74e['host'];_0x784a79=_0x3c2b08===_0xc6e1('0x73')?'eu':_0xc6e1('0x74');_0x367ec0=_0x10d74e[_0xc6e1('0x72')];var _0x30255c=_0x367ec0[_0xc6e1('0x75')](-0x1);if(_0x30255c==='/'||_0x30255c==='\x5c'||_0x30255c===':'){_0x367ec0=_0x367ec0[_0xc6e1('0x76')](0x0,_0x367ec0[_0xc6e1('0x77')](_0x30255c));}if(!_0x10d74e[_0xc6e1('0x6b')]){throw new Error(_0xc6e1('0x78'));}return getAccessToken(_0x10d74e);})[_0xc6e1('0x31')](function(_0x37db90){if(_0x37db90){return rp({'method':_0xc6e1('0x79'),'uri':util[_0xc6e1('0x7a')](_0xc6e1('0x7b'),_0x784a79),'qs':{'module':_0xc6e1('0x7c')},'headers':{'Authorization':_0xc6e1('0x7d')+_0x37db90},'json':!![]});}})[_0xc6e1('0x31')](function(_0x321b9d){if(_0x321b9d){if(_0x321b9d[_0xc6e1('0x7e')]&&_0x321b9d['response'][_0xc6e1('0x23')]){throw new Error(_0x321b9d[_0xc6e1('0x7e')][_0xc6e1('0x23')][_0xc6e1('0x25')]);}var _0x187052=[];var _0x32a143=[];var _0x413df4=[_0xc6e1('0x7f'),_0xc6e1('0x80'),'Description',_0xc6e1('0x81'),_0xc6e1('0x82'),_0xc6e1('0x83'),_0xc6e1('0x84'),_0xc6e1('0x85')];_0x32a143=_[_0xc6e1('0x86')](_0x321b9d[_0xc6e1('0x43')],function(_0x522800){return _0x413df4[_0xc6e1('0x87')](_0x522800[_0xc6e1('0x88')]);});for(var _0x17f0fe=0x0;_0x17f0fe<_0x32a143[_0xc6e1('0x44')];_0x17f0fe++){if(_0x32a143[_0x17f0fe][_0xc6e1('0x89')]===![]){_0x187052[_0xc6e1('0x8a')]({'id':_0x32a143[_0x17f0fe]['id'],'name':_0x32a143[_0x17f0fe][_0xc6e1('0x8b')],'custom':_0x32a143[_0x17f0fe][_0xc6e1('0x8c')],'options':_0x32a143[_0x17f0fe][_0xc6e1('0x8d')]===_0xc6e1('0x8e')&&_0x32a143[_0x17f0fe]['pick_list_values'][_0xc6e1('0x44')]>-0x1?_[_0xc6e1('0x38')](_0x32a143[_0x17f0fe]['pick_list_values'],function(_0x4da11a){return{'name':_0x4da11a,'value':_0x4da11a};}):[]});}}return{'count':_0x187052['length'],'rows':_0x187052};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x338044,null))[_0xc6e1('0x27')](function(_0x3ce9e0){var _0x4c1bac=_0x294f4b['query']['test']?0x1f4:_0x3ce9e0[_0xc6e1('0x8f')]||0x1f4;logger[_0xc6e1('0x23')](_0xc6e1('0x90'),_0xc6e1('0x6e'),_0x4c1bac,JSON[_0xc6e1('0x22')](_0x3ce9e0));delete _0x3ce9e0[_0xc6e1('0x35')];if(_0x4c1bac===0x191){_0x4c1bac=0x190;}_0x338044[_0xc6e1('0x29')](_0x4c1bac)[_0xc6e1('0x36')](_0x294f4b[_0xc6e1('0x3f')][_0xc6e1('0x91')]?{'message':_0xc6e1('0x92'),'statusCode':_0x3ce9e0[_0xc6e1('0x8f')]}:_0x3ce9e0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 41163e1..c9c81b7 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 _0x874f=['parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','/oauth/v2/token','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then'];(function(_0x1d6dc2,_0x24979b){var _0x43862a=function(_0x430e96){while(--_0x430e96){_0x1d6dc2['push'](_0x1d6dc2['shift']());}};_0x43862a(++_0x24979b);}(_0x874f,0x124));var _0xf874=function(_0x40eec9,_0x817a67){_0x40eec9=_0x40eec9-0x0;var _0xfee890=_0x874f[_0x40eec9];return _0xfee890;};'use strict';var _=require(_0xf874('0x0'));var util=require('util');var logger=require(_0xf874('0x1'))(_0xf874('0x2'));var moment=require(_0xf874('0x3'));var BPromise=require('bluebird');var rp=require(_0xf874('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf874('0x5'));var config=require(_0xf874('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xf874('0x7'));module[_0xf874('0x8')]=function(_0x5a34a9,_0x106153){return _0x5a34a9[_0xf874('0x9')](_0xf874('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ff66c,_0x32b6a1,_0x5105d9){if(_0x3ff66c[_0xf874('0xb')]('zone')||_0x3ff66c[_0xf874('0xb')](_0xf874('0xc'))||_0x3ff66c['changed'](_0xf874('0xd'))||_0x3ff66c['changed'](_0xf874('0xe'))||_0x3ff66c[_0xf874('0xb')](_0xf874('0xf'))||_0x3ff66c[_0xf874('0xb')](_0xf874('0x10'))){var _0x3820de,_0x2ab92;_0x3820de=_0x3ff66c[_0xf874('0xc')];var _0x54ebc5=_0x3820de[_0xf874('0x11')](-0x1);if(_0x54ebc5==='/'||_0x54ebc5==='\x5c'||_0x54ebc5===':'){_0x3820de=_0x3820de[_0xf874('0x12')](0x0,_0x3820de[_0xf874('0x13')](_0x54ebc5));}switch(_0x3ff66c['zone']){case'US':_0x2ab92=_0xf874('0x14');break;case'AU':_0x2ab92=_0xf874('0x15');break;case'IN':_0x2ab92='https://accounts.zoho.in';break;case'CN':_0x2ab92=_0xf874('0x16');break;default:_0x2ab92=_0xf874('0x17');break;}var _0x2bba06={'method':_0xf874('0x18'),'uri':_0x2ab92+'/oauth/v2/token','form':{'grant_type':_0xf874('0x19'),'client_id':_0x3ff66c['clientId'],'client_secret':_0x3ff66c['clientSecret'],'redirect_uri':_0x3ff66c[_0xf874('0xc')],'code':_0x3ff66c['code']},'headers':{'Content-Type':_0xf874('0x1a')}};return rp(_0x2bba06)[_0xf874('0x1b')](function(_0x25025b){var _0x80049a=JSON[_0xf874('0x1c')](_0x25025b);if(_0x80049a[_0xf874('0x1d')]){_0x3ff66c[_0xf874('0x1e')]=_0x80049a[_0xf874('0x1d')];logger[_0xf874('0x1f')](util[_0xf874('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3ff66c[_0xf874('0x21')],_0x3ff66c['id']));}else{logger[_0xf874('0x22')](util[_0xf874('0x20')](_0xf874('0x23'),_0x3ff66c[_0xf874('0x21')],_0x3ff66c['id']),util[_0xf874('0x24')](_0x80049a,{'showHidden':![],'depth':null}));}return _0x5105d9(null,_0x32b6a1);})[_0xf874('0x25')](function(_0x3f4aa5){logger[_0xf874('0x22')](util[_0xf874('0x20')](_0xf874('0x23'),_0x3ff66c[_0xf874('0x21')],_0x3ff66c['id']),util[_0xf874('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5105d9(_0x3f4aa5);});}else{return _0x5105d9(null,_0x32b6a1);}},'beforeUpdate':function(_0x2a3082,_0x54ea54,_0x2d79df){if(_0x2a3082[_0xf874('0xb')](_0xf874('0x26'))||_0x2a3082[_0xf874('0xb')](_0xf874('0xc'))||_0x2a3082[_0xf874('0xb')](_0xf874('0xd'))||_0x2a3082[_0xf874('0xb')](_0xf874('0xe'))||_0x2a3082[_0xf874('0xb')](_0xf874('0xf'))||_0x2a3082[_0xf874('0xb')](_0xf874('0x10'))){var _0x5a1e5f,_0x5ca45a;_0x5a1e5f=_0x2a3082[_0xf874('0xc')];var _0x3b48b1=_0x5a1e5f[_0xf874('0x11')](-0x1);if(_0x3b48b1==='/'||_0x3b48b1==='\x5c'||_0x3b48b1===':'){_0x5a1e5f=_0x5a1e5f[_0xf874('0x12')](0x0,_0x5a1e5f['lastIndexOf'](_0x3b48b1));}switch(_0x2a3082['zone']){case'US':_0x5ca45a=_0xf874('0x14');break;case'AU':_0x5ca45a=_0xf874('0x15');break;case'IN':_0x5ca45a='https://accounts.zoho.in';break;case'CN':_0x5ca45a='https://accounts.zoho.com.cn';break;default:_0x5ca45a=_0xf874('0x17');break;}var _0x2295f9={'method':'POST','uri':_0x5ca45a+_0xf874('0x27'),'form':{'grant_type':_0xf874('0x19'),'client_id':_0x2a3082[_0xf874('0xd')],'client_secret':_0x2a3082[_0xf874('0xe')],'redirect_uri':_0x2a3082['serverUrl'],'code':_0x2a3082[_0xf874('0xf')]},'headers':{'Content-Type':_0xf874('0x1a')}};return rp(_0x2295f9)[_0xf874('0x1b')](function(_0x441d5c){var _0x37f474=JSON[_0xf874('0x1c')](_0x441d5c);if(_0x37f474[_0xf874('0x1d')]){_0x2a3082[_0xf874('0x1e')]=_0x37f474[_0xf874('0x1d')];logger['info'](util[_0xf874('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2a3082[_0xf874('0x21')],_0x2a3082['id']));}else{logger[_0xf874('0x22')](util[_0xf874('0x20')](_0xf874('0x23'),_0x2a3082['name'],_0x2a3082['id']),util[_0xf874('0x24')](_0x37f474,{'showHidden':![],'depth':null}));}return _0x2d79df(null,_0x54ea54);})['catch'](function(_0x1be9de){logger[_0xf874('0x22')](util[_0xf874('0x20')](_0xf874('0x23'),_0x2a3082[_0xf874('0x21')],_0x2a3082['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2d79df(_0x1be9de);});}else{return _0x2d79df(null,_0x54ea54);}}}});}; \ No newline at end of file +var _0x69ce=['code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','name','https://accounts.zoho.com.au','https://accounts.zoho.eu','parse','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x69ce,0x1d1));var _0xe69c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x69ce[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xe69c('0x0'));var util=require(_0xe69c('0x1'));var logger=require(_0xe69c('0x2'))(_0xe69c('0x3'));var moment=require(_0xe69c('0x4'));var BPromise=require(_0xe69c('0x5'));var rp=require(_0xe69c('0x6'));var fs=require('fs');var path=require(_0xe69c('0x7'));var rimraf=require('rimraf');var config=require(_0xe69c('0x8'));var attributes=require(_0xe69c('0x9'));var integrations=require(_0xe69c('0xa'));module[_0xe69c('0xb')]=function(_0x39f14c,_0xea090f){return _0x39f14c['define'](_0xe69c('0xc'),attributes,{'tableName':_0xe69c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4399bb,_0x5f4e43,_0x550aca){if(_0x4399bb['changed'](_0xe69c('0xe'))||_0x4399bb[_0xe69c('0xf')](_0xe69c('0x10'))||_0x4399bb[_0xe69c('0xf')](_0xe69c('0x11'))||_0x4399bb[_0xe69c('0xf')](_0xe69c('0x12'))||_0x4399bb[_0xe69c('0xf')](_0xe69c('0x13'))||_0x4399bb[_0xe69c('0xf')](_0xe69c('0x14'))){var _0x231e25,_0x24d543;_0x231e25=_0x4399bb[_0xe69c('0x10')];var _0x2214e1=_0x231e25[_0xe69c('0x15')](-0x1);if(_0x2214e1==='/'||_0x2214e1==='\x5c'||_0x2214e1===':'){_0x231e25=_0x231e25[_0xe69c('0x16')](0x0,_0x231e25[_0xe69c('0x17')](_0x2214e1));}switch(_0x4399bb[_0xe69c('0xe')]){case'US':_0x24d543=_0xe69c('0x18');break;case'AU':_0x24d543='https://accounts.zoho.com.au';break;case'IN':_0x24d543=_0xe69c('0x19');break;case'CN':_0x24d543=_0xe69c('0x1a');break;default:_0x24d543='https://accounts.zoho.eu';break;}var _0x5a856f={'method':_0xe69c('0x1b'),'uri':_0x24d543+_0xe69c('0x1c'),'form':{'grant_type':_0xe69c('0x1d'),'client_id':_0x4399bb['clientId'],'client_secret':_0x4399bb[_0xe69c('0x12')],'redirect_uri':_0x4399bb[_0xe69c('0x10')],'code':_0x4399bb[_0xe69c('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5a856f)[_0xe69c('0x1e')](function(_0x21d914){var _0x1e162d=JSON['parse'](_0x21d914);if(_0x1e162d[_0xe69c('0x1f')]){_0x4399bb[_0xe69c('0x20')]=_0x1e162d[_0xe69c('0x1f')];logger[_0xe69c('0x21')](util[_0xe69c('0x22')](_0xe69c('0x23'),_0x4399bb['name'],_0x4399bb['id']));}else{logger[_0xe69c('0x24')](util['format'](_0xe69c('0x25'),_0x4399bb['name'],_0x4399bb['id']),util[_0xe69c('0x26')](_0x1e162d,{'showHidden':![],'depth':null}));}return _0x550aca(null,_0x5f4e43);})['catch'](function(_0x2747ad){logger[_0xe69c('0x24')](util[_0xe69c('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4399bb[_0xe69c('0x27')],_0x4399bb['id']),util[_0xe69c('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x550aca(_0x2747ad);});}else{return _0x550aca(null,_0x5f4e43);}},'beforeUpdate':function(_0x161c71,_0x5ea815,_0x489167){if(_0x161c71[_0xe69c('0xf')]('zone')||_0x161c71[_0xe69c('0xf')](_0xe69c('0x10'))||_0x161c71['changed'](_0xe69c('0x11'))||_0x161c71[_0xe69c('0xf')](_0xe69c('0x12'))||_0x161c71[_0xe69c('0xf')](_0xe69c('0x13'))||_0x161c71[_0xe69c('0xf')](_0xe69c('0x14'))){var _0x4341fe,_0x5be272;_0x4341fe=_0x161c71[_0xe69c('0x10')];var _0x28b1bf=_0x4341fe[_0xe69c('0x15')](-0x1);if(_0x28b1bf==='/'||_0x28b1bf==='\x5c'||_0x28b1bf===':'){_0x4341fe=_0x4341fe[_0xe69c('0x16')](0x0,_0x4341fe[_0xe69c('0x17')](_0x28b1bf));}switch(_0x161c71['zone']){case'US':_0x5be272=_0xe69c('0x18');break;case'AU':_0x5be272=_0xe69c('0x28');break;case'IN':_0x5be272=_0xe69c('0x19');break;case'CN':_0x5be272='https://accounts.zoho.com.cn';break;default:_0x5be272=_0xe69c('0x29');break;}var _0x1b7d6f={'method':_0xe69c('0x1b'),'uri':_0x5be272+_0xe69c('0x1c'),'form':{'grant_type':_0xe69c('0x1d'),'client_id':_0x161c71[_0xe69c('0x11')],'client_secret':_0x161c71[_0xe69c('0x12')],'redirect_uri':_0x161c71[_0xe69c('0x10')],'code':_0x161c71[_0xe69c('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1b7d6f)[_0xe69c('0x1e')](function(_0x390a8c){var _0x247f0a=JSON[_0xe69c('0x2a')](_0x390a8c);if(_0x247f0a['refresh_token']){_0x161c71[_0xe69c('0x20')]=_0x247f0a[_0xe69c('0x1f')];logger[_0xe69c('0x21')](util['format'](_0xe69c('0x23'),_0x161c71[_0xe69c('0x27')],_0x161c71['id']));}else{logger[_0xe69c('0x24')](util[_0xe69c('0x22')](_0xe69c('0x25'),_0x161c71[_0xe69c('0x27')],_0x161c71['id']),util['inspect'](_0x247f0a,{'showHidden':![],'depth':null}));}return _0x489167(null,_0x5ea815);})[_0xe69c('0x2b')](function(_0x372068){logger[_0xe69c('0x24')](util[_0xe69c('0x22')](_0xe69c('0x25'),_0x161c71[_0xe69c('0x27')],_0x161c71['id']),util[_0xe69c('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x489167(_0x372068);});}else{return _0x489167(null,_0x5ea815);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index df9695f..90e50c7 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 _0x67e8=['error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','attributes','include','map','model','find','raw','where','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e42b9,_0x8465c){var _0x472314=function(_0x59c711){while(--_0x59c711){_0x1e42b9['push'](_0x1e42b9['shift']());}};_0x472314(++_0x8465c);}(_0x67e8,0xcf));var _0x867e=function(_0x455456,_0x9a0fd1){_0x455456=_0x455456-0x0;var _0x1b5835=_0x67e8[_0x455456];return _0x1b5835;};'use strict';var _=require(_0x867e('0x0'));var util=require(_0x867e('0x1'));var moment=require(_0x867e('0x2'));var BPromise=require(_0x867e('0x3'));var rs=require(_0x867e('0x4'));var fs=require('fs');var Redis=require(_0x867e('0x5'));var db=require(_0x867e('0x6'))['db'];var utils=require(_0x867e('0x7'));var logger=require(_0x867e('0x8'))(_0x867e('0x9'));var config=require(_0x867e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x867e('0xb')][_0x867e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40347a,_0x145eb4,_0x1716c3){return new BPromise(function(_0x2856ad,_0x302300){return client[_0x867e('0xd')](_0x40347a,_0x1716c3)[_0x867e('0xe')](function(_0x4715a1){logger[_0x867e('0xf')](_0x867e('0x10'),_0x145eb4,_0x867e('0x11'));logger[_0x867e('0x12')](_0x867e('0x13'),_0x145eb4,'request\x20sent',JSON[_0x867e('0x14')](_0x4715a1));if(_0x4715a1[_0x867e('0x15')]){if(_0x4715a1[_0x867e('0x15')][_0x867e('0x16')]===0x1f4){logger[_0x867e('0x15')](_0x867e('0x10'),_0x145eb4,_0x4715a1['error']['message']);return _0x302300(_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);}logger['error'](_0x867e('0x10'),_0x145eb4,_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);return _0x2856ad(_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);}else{logger[_0x867e('0xf')](_0x867e('0x10'),_0x145eb4,_0x867e('0x11'));_0x2856ad(_0x4715a1[_0x867e('0x18')]['message']);}})[_0x867e('0x19')](function(_0x24d2f9){logger[_0x867e('0x15')](_0x867e('0x10'),_0x145eb4,_0x24d2f9);_0x302300(_0x24d2f9);});});}exports[_0x867e('0x1a')]=function(_0x5c3d1f){var _0x57bfbf=this;return new Promise(function(_0x3c474c,_0xafe377){return db[_0x867e('0x1b')][_0x867e('0x1c')]({'raw':_0x5c3d1f[_0x867e('0x1d')]?_0x5c3d1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c3d1f[_0x867e('0x1d')]?_0x5c3d1f['options']['where']||null:null,'attributes':_0x5c3d1f['options']?_0x5c3d1f[_0x867e('0x1d')][_0x867e('0x1e')]||null:null,'limit':_0x5c3d1f[_0x867e('0x1d')]?_0x5c3d1f[_0x867e('0x1d')]['limit']||null:null,'include':_0x5c3d1f[_0x867e('0x1d')]?_0x5c3d1f[_0x867e('0x1d')][_0x867e('0x1f')]?_[_0x867e('0x20')](_0x5c3d1f['options'][_0x867e('0x1f')],function(_0x1f66fc){return{'model':db[_0x1f66fc[_0x867e('0x21')]],'as':_0x1f66fc['as'],'attributes':_0x1f66fc[_0x867e('0x1e')],'include':_0x1f66fc['include']?_[_0x867e('0x20')](_0x1f66fc[_0x867e('0x1f')],function(_0x300299){return{'model':db[_0x300299[_0x867e('0x21')]],'as':_0x300299['as'],'attributes':_0x300299[_0x867e('0x1e')],'include':_0x300299[_0x867e('0x1f')]?_[_0x867e('0x20')](_0x300299[_0x867e('0x1f')],function(_0x1e17f0){return{'model':db[_0x1e17f0['model']],'as':_0x1e17f0['as'],'attributes':_0x1e17f0[_0x867e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x867e('0xe')](function(_0x277a3d){logger[_0x867e('0xf')](_0x867e('0x1a'),_0x5c3d1f);logger[_0x867e('0x12')](_0x867e('0x1a'),_0x5c3d1f,JSON[_0x867e('0x14')](_0x277a3d));_0x3c474c(_0x277a3d);})[_0x867e('0x19')](function(_0x5f4d30){logger[_0x867e('0x15')]('GetZohoAccount',_0x5f4d30['message'],_0x5c3d1f);_0xafe377(_0x57bfbf['error'](0x1f4,_0x5f4d30[_0x867e('0x17')]));});});};exports['ShowZohoAccount']=function(_0x14102e){var _0x172890=this;return new Promise(function(_0x574a65,_0xb3dee5){return db[_0x867e('0x1b')][_0x867e('0x22')]({'raw':_0x14102e[_0x867e('0x1d')]?_0x14102e['options'][_0x867e('0x23')]===undefined?!![]:![]:!![],'where':_0x14102e[_0x867e('0x1d')]?_0x14102e[_0x867e('0x1d')][_0x867e('0x24')]||null:null,'attributes':_0x14102e[_0x867e('0x1d')]?_0x14102e[_0x867e('0x1d')][_0x867e('0x1e')]||null:null,'include':_0x14102e[_0x867e('0x1d')]?_0x14102e[_0x867e('0x1d')][_0x867e('0x1f')]?_['map'](_0x14102e[_0x867e('0x1d')]['include'],function(_0x50f160){return{'model':db[_0x50f160[_0x867e('0x21')]],'as':_0x50f160['as'],'attributes':_0x50f160[_0x867e('0x1e')],'include':_0x50f160[_0x867e('0x1f')]?_[_0x867e('0x20')](_0x50f160[_0x867e('0x1f')],function(_0x1a91be){return{'model':db[_0x1a91be[_0x867e('0x21')]],'as':_0x1a91be['as'],'attributes':_0x1a91be[_0x867e('0x1e')],'include':_0x1a91be[_0x867e('0x1f')]?_['map'](_0x1a91be[_0x867e('0x1f')],function(_0x15bb5b){return{'model':db[_0x15bb5b[_0x867e('0x21')]],'as':_0x15bb5b['as'],'attributes':_0x15bb5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x867e('0xe')](function(_0x195ea3){logger[_0x867e('0xf')]('ShowZohoAccount',_0x14102e);logger[_0x867e('0x12')]('ShowZohoAccount',_0x14102e,JSON[_0x867e('0x14')](_0x195ea3));_0x574a65(_0x195ea3);})[_0x867e('0x19')](function(_0x1d0798){logger['error'](_0x867e('0x25'),_0x1d0798[_0x867e('0x17')],_0x14102e);_0xb3dee5(_0x172890[_0x867e('0x15')](0x1f4,_0x1d0798[_0x867e('0x17')]));});});}; \ No newline at end of file +var _0xcd4d=['include','map','model','GetZohoAccount','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ZohoAccount','findAll','options','raw','where','attributes','limit'];(function(_0x437a22,_0x38cebe){var _0x5546c4=function(_0x1a8a65){while(--_0x1a8a65){_0x437a22['push'](_0x437a22['shift']());}};_0x5546c4(++_0x38cebe);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x1cfb38,_0x1b1829){_0x1cfb38=_0x1cfb38-0x0;var _0x4d0e93=_0xcd4d[_0x1cfb38];return _0x4d0e93;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require(_0xdcd4('0x6'));var logger=require(_0xdcd4('0x7'))(_0xdcd4('0x8'));var config=require(_0xdcd4('0x9'));var jayson=require(_0xdcd4('0xa'));var client=jayson[_0xdcd4('0xb')][_0xdcd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302b60,_0x5b57f6,_0x17f848){return new BPromise(function(_0x198d6c,_0xc0cf59){return client['request'](_0x302b60,_0x17f848)[_0xdcd4('0xd')](function(_0x3cae6d){logger['info'](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));logger[_0xdcd4('0x10')](_0xdcd4('0x11'),_0x5b57f6,_0xdcd4('0xf'),JSON['stringify'](_0x3cae6d));if(_0x3cae6d[_0xdcd4('0x12')]){if(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x13')]===0x1f4){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error'][_0xdcd4('0x14')]);return _0xc0cf59(_0x3cae6d[_0xdcd4('0x12')]['message']);}logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error']['message']);return _0x198d6c(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x14')]);}else{logger[_0xdcd4('0x15')](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));_0x198d6c(_0x3cae6d[_0xdcd4('0x16')][_0xdcd4('0x14')]);}})[_0xdcd4('0x17')](function(_0xf57175){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0xf57175);_0xc0cf59(_0xf57175);});});}exports['GetZohoAccount']=function(_0x579125){var _0x33608f=this;return new Promise(function(_0x7682f8,_0x13331d){return db[_0xdcd4('0x18')][_0xdcd4('0x19')]({'raw':_0x579125[_0xdcd4('0x1a')]?_0x579125[_0xdcd4('0x1a')][_0xdcd4('0x1b')]===undefined?!![]:![]:!![],'where':_0x579125[_0xdcd4('0x1a')]?_0x579125[_0xdcd4('0x1a')][_0xdcd4('0x1c')]||null:null,'attributes':_0x579125[_0xdcd4('0x1a')]?_0x579125[_0xdcd4('0x1a')][_0xdcd4('0x1d')]||null:null,'limit':_0x579125[_0xdcd4('0x1a')]?_0x579125['options'][_0xdcd4('0x1e')]||null:null,'include':_0x579125[_0xdcd4('0x1a')]?_0x579125['options'][_0xdcd4('0x1f')]?_[_0xdcd4('0x20')](_0x579125[_0xdcd4('0x1a')]['include'],function(_0x46768f){return{'model':db[_0x46768f[_0xdcd4('0x21')]],'as':_0x46768f['as'],'attributes':_0x46768f[_0xdcd4('0x1d')],'include':_0x46768f['include']?_[_0xdcd4('0x20')](_0x46768f[_0xdcd4('0x1f')],function(_0x48b046){return{'model':db[_0x48b046[_0xdcd4('0x21')]],'as':_0x48b046['as'],'attributes':_0x48b046[_0xdcd4('0x1d')],'include':_0x48b046[_0xdcd4('0x1f')]?_[_0xdcd4('0x20')](_0x48b046[_0xdcd4('0x1f')],function(_0x44c843){return{'model':db[_0x44c843[_0xdcd4('0x21')]],'as':_0x44c843['as'],'attributes':_0x44c843[_0xdcd4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x134c00){logger['info'](_0xdcd4('0x22'),_0x579125);logger[_0xdcd4('0x10')]('GetZohoAccount',_0x579125,JSON['stringify'](_0x134c00));_0x7682f8(_0x134c00);})['catch'](function(_0x58cf67){logger[_0xdcd4('0x12')](_0xdcd4('0x22'),_0x58cf67[_0xdcd4('0x14')],_0x579125);_0x13331d(_0x33608f['error'](0x1f4,_0x58cf67[_0xdcd4('0x14')]));});});};exports[_0xdcd4('0x23')]=function(_0x565e9e){var _0x35d1e3=this;return new Promise(function(_0x2e11d6,_0x21aaaf){return db[_0xdcd4('0x18')][_0xdcd4('0x24')]({'raw':_0x565e9e[_0xdcd4('0x1a')]?_0x565e9e['options'][_0xdcd4('0x1b')]===undefined?!![]:![]:!![],'where':_0x565e9e['options']?_0x565e9e[_0xdcd4('0x1a')][_0xdcd4('0x1c')]||null:null,'attributes':_0x565e9e[_0xdcd4('0x1a')]?_0x565e9e[_0xdcd4('0x1a')][_0xdcd4('0x1d')]||null:null,'include':_0x565e9e['options']?_0x565e9e['options'][_0xdcd4('0x1f')]?_[_0xdcd4('0x20')](_0x565e9e[_0xdcd4('0x1a')]['include'],function(_0x3524b8){return{'model':db[_0x3524b8[_0xdcd4('0x21')]],'as':_0x3524b8['as'],'attributes':_0x3524b8['attributes'],'include':_0x3524b8['include']?_[_0xdcd4('0x20')](_0x3524b8[_0xdcd4('0x1f')],function(_0x3b93f6){return{'model':db[_0x3b93f6[_0xdcd4('0x21')]],'as':_0x3b93f6['as'],'attributes':_0x3b93f6[_0xdcd4('0x1d')],'include':_0x3b93f6[_0xdcd4('0x1f')]?_['map'](_0x3b93f6[_0xdcd4('0x1f')],function(_0x49db40){return{'model':db[_0x49db40[_0xdcd4('0x21')]],'as':_0x49db40['as'],'attributes':_0x49db40[_0xdcd4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdcd4('0xd')](function(_0x4ff005){logger[_0xdcd4('0x15')](_0xdcd4('0x23'),_0x565e9e);logger[_0xdcd4('0x10')](_0xdcd4('0x23'),_0x565e9e,JSON['stringify'](_0x4ff005));_0x2e11d6(_0x4ff005);})['catch'](function(_0x5bc94f){logger[_0xdcd4('0x12')]('ShowZohoAccount',_0x5bc94f[_0xdcd4('0x14')],_0x565e9e);_0x21aaaf(_0x35d1e3[_0xdcd4('0x12')](0x1f4,_0x5bc94f[_0xdcd4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a725f28..7ed2792 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 _0x63ad=['path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','post','put','update','delete','exports','util'];(function(_0x16ad9e,_0x2a6ba9){var _0x1f45c0=function(_0x5c8231){while(--_0x5c8231){_0x16ad9e['push'](_0x16ad9e['shift']());}};_0x1f45c0(++_0x2a6ba9);}(_0x63ad,0x7d));var _0xd63a=function(_0x24f4c3,_0x2f2669){_0x24f4c3=_0x24f4c3-0x0;var _0x301489=_0x63ad[_0x24f4c3];return _0x301489;};'use strict';var multer=require('multer');var util=require(_0xd63a('0x0'));var path=require(_0xd63a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd63a('0x2'));var config=require(_0xd63a('0x3'));var controller=require('./intZohoConfiguration.controller');router[_0xd63a('0x4')]('/',auth[_0xd63a('0x5')](),controller[_0xd63a('0x6')]);router[_0xd63a('0x4')](_0xd63a('0x7'),auth[_0xd63a('0x5')](),controller['show']);router[_0xd63a('0x4')]('/:id/fields',auth[_0xd63a('0x5')](),controller['getFields']);router[_0xd63a('0x4')](_0xd63a('0x8'),auth[_0xd63a('0x5')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xd63a('0x5')](),controller['getDescriptions']);router[_0xd63a('0x9')]('/',auth[_0xd63a('0x5')](),controller['create']);router[_0xd63a('0xa')](_0xd63a('0x7'),auth[_0xd63a('0x5')](),controller[_0xd63a('0xb')]);router[_0xd63a('0xc')](_0xd63a('0x7'),auth[_0xd63a('0x5')](),controller['destroy']);module[_0xd63a('0xd')]=router; \ No newline at end of file +var _0x2bb0=['/:id/descriptions','getDescriptions','put','delete','exports','multer','util','path','express','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects'];(function(_0x48b1a5,_0x55bf14){var _0xe8fa92=function(_0x552db8){while(--_0x552db8){_0x48b1a5['push'](_0x48b1a5['shift']());}};_0xe8fa92(++_0x55bf14);}(_0x2bb0,0xf3));var _0x02bb=function(_0x574c60,_0x653c40){_0x574c60=_0x574c60-0x0;var _0x57bb5e=_0x2bb0[_0x574c60];return _0x57bb5e;};'use strict';var multer=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var path=require(_0x02bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x02bb('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x02bb('0x4'));var config=require('../../config/environment');var controller=require(_0x02bb('0x5'));router[_0x02bb('0x6')]('/',auth[_0x02bb('0x7')](),controller[_0x02bb('0x8')]);router[_0x02bb('0x6')](_0x02bb('0x9'),auth[_0x02bb('0x7')](),controller['show']);router[_0x02bb('0x6')](_0x02bb('0xa'),auth[_0x02bb('0x7')](),controller['getFields']);router[_0x02bb('0x6')]('/:id/subjects',auth[_0x02bb('0x7')](),controller[_0x02bb('0xb')]);router['get'](_0x02bb('0xc'),auth[_0x02bb('0x7')](),controller[_0x02bb('0xd')]);router['post']('/',auth[_0x02bb('0x7')](),controller['create']);router[_0x02bb('0xe')](_0x02bb('0x9'),auth[_0x02bb('0x7')](),controller['update']);router[_0x02bb('0xf')](_0x02bb('0x9'),auth[_0x02bb('0x7')](),controller['destroy']);module[_0x02bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9c4fdf9..18e4030 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 _0xcfb7=['ENUM','lead','nothing','contact_lead','contact','sequelize','STRING'];(function(_0x218534,_0x2bd7a5){var _0x159662=function(_0x48bbeb){while(--_0x48bbeb){_0x218534['push'](_0x218534['shift']());}};_0x159662(++_0x2bd7a5);}(_0xcfb7,0xc9));var _0x7cfb=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xcfb7[_0x3a9661];return _0x5bb119;};'use strict';var Sequelize=require(_0x7cfb('0x0'));module['exports']={'name':{'type':Sequelize[_0x7cfb('0x1')]},'moduleCreate':{'type':Sequelize[_0x7cfb('0x2')](_0x7cfb('0x3'),'contact',_0x7cfb('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x7cfb('0x2')](_0x7cfb('0x5'),_0x7cfb('0x6'),_0x7cfb('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0fce=['nothing','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x0fce,0x1bb));var _0xe0fc=function(_0x3d0ad2,_0x3b2a7c){_0x3d0ad2=_0x3d0ad2-0x0;var _0x5460fb=_0x0fce[_0x3d0ad2];return _0x5460fb;};'use strict';var Sequelize=require(_0xe0fc('0x0'));module[_0xe0fc('0x1')]={'name':{'type':Sequelize[_0xe0fc('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xe0fc('0x3'),_0xe0fc('0x4'),_0xe0fc('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xe0fc('0x6'),'contact',_0xe0fc('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe0fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 53a459d..6125b32 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(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var 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(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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 fe8abde..ce96806 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 _0x0b9e=['request-promise','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0b9e,0xed));var _0xe0b9=function(_0x499e1a,_0x28726d){_0x499e1a=_0x499e1a-0x0;var _0x390c21=_0x0b9e[_0x499e1a];return _0x390c21;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe0b9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe0b9('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0b9('0x2'));var config=require('../../config/environment');var attributes=require(_0xe0b9('0x3'));module[_0xe0b9('0x4')]=function(_0x169499,_0x21285b){return _0x169499[_0xe0b9('0x5')](_0xe0b9('0x6'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f25=['exports','define','int_zoho_configurations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39a07f,_0x60bf07){var _0x4fd849=function(_0x30493c){while(--_0x30493c){_0x39a07f['push'](_0x39a07f['shift']());}};_0x4fd849(++_0x60bf07);}(_0x9f25,0xea));var _0x59f2=function(_0xdac383,_0x505d99){_0xdac383=_0xdac383-0x0;var _0x3e783d=_0x9f25[_0xdac383];return _0x3e783d;};'use strict';var _=require('lodash');var util=require(_0x59f2('0x0'));var logger=require(_0x59f2('0x1'))('api');var moment=require(_0x59f2('0x2'));var BPromise=require(_0x59f2('0x3'));var rp=require(_0x59f2('0x4'));var fs=require('fs');var path=require(_0x59f2('0x5'));var rimraf=require(_0x59f2('0x6'));var config=require(_0x59f2('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x59f2('0x8')]=function(_0x2cd0b4,_0x374f08){return _0x2cd0b4[_0x59f2('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x59f2('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 588e763..c4b0920 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 _0x7b43=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x19b120,_0x2027c3){var _0x4db02e=function(_0xcfa55f){while(--_0xcfa55f){_0x19b120['push'](_0x19b120['shift']());}};_0x4db02e(++_0x2027c3);}(_0x7b43,0x152));var _0x37b4=function(_0x18bc26,_0x2800c4){_0x18bc26=_0x18bc26-0x0;var _0x1ddad4=_0x7b43[_0x18bc26];return _0x1ddad4;};'use strict';var _=require(_0x37b4('0x0'));var util=require(_0x37b4('0x1'));var moment=require(_0x37b4('0x2'));var BPromise=require('bluebird');var rs=require(_0x37b4('0x3'));var fs=require('fs');var Redis=require(_0x37b4('0x4'));var db=require(_0x37b4('0x5'))['db'];var utils=require(_0x37b4('0x6'));var logger=require(_0x37b4('0x7'))(_0x37b4('0x8'));var config=require(_0x37b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x37b4('0xa')][_0x37b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bb257,_0x5ec336,_0x25fa6c){return new BPromise(function(_0x118917,_0x2b44d2){return client[_0x37b4('0xc')](_0x5bb257,_0x25fa6c)[_0x37b4('0xd')](function(_0x9d4a73){logger[_0x37b4('0xe')](_0x37b4('0xf'),_0x5ec336,_0x37b4('0x10'));logger['debug'](_0x37b4('0x11'),_0x5ec336,_0x37b4('0x10'),JSON[_0x37b4('0x12')](_0x9d4a73));if(_0x9d4a73[_0x37b4('0x13')]){if(_0x9d4a73[_0x37b4('0x13')][_0x37b4('0x14')]===0x1f4){logger[_0x37b4('0x13')](_0x37b4('0xf'),_0x5ec336,_0x9d4a73[_0x37b4('0x13')]['message']);return _0x2b44d2(_0x9d4a73['error'][_0x37b4('0x15')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5ec336,_0x9d4a73[_0x37b4('0x13')]['message']);return _0x118917(_0x9d4a73[_0x37b4('0x13')]['message']);}else{logger[_0x37b4('0xe')](_0x37b4('0xf'),_0x5ec336,_0x37b4('0x10'));_0x118917(_0x9d4a73['result'][_0x37b4('0x15')]);}})['catch'](function(_0x460d74){logger[_0x37b4('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x5ec336,_0x460d74);_0x2b44d2(_0x460d74);});});} \ No newline at end of file +var _0x59d8=['request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4ee8f2,_0x341ceb){var _0x59d6c8=function(_0x519f9c){while(--_0x519f9c){_0x4ee8f2['push'](_0x4ee8f2['shift']());}};_0x59d6c8(++_0x341ceb);}(_0x59d8,0x147));var _0x859d=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x59d8[_0x687ddc];return _0x441991;};'use strict';var _=require(_0x859d('0x0'));var util=require('util');var moment=require(_0x859d('0x1'));var BPromise=require(_0x859d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x859d('0x3'));var db=require(_0x859d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x859d('0x5'));var config=require(_0x859d('0x6'));var jayson=require(_0x859d('0x7'));var client=jayson[_0x859d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47424b,_0x50eb1b,_0x103d8d){return new BPromise(function(_0x1e1992,_0x6de0e4){return client[_0x859d('0x9')](_0x47424b,_0x103d8d)[_0x859d('0xa')](function(_0x54c1a6){logger['info'](_0x859d('0xb'),_0x50eb1b,'request\x20sent');logger['debug'](_0x859d('0xc'),_0x50eb1b,_0x859d('0xd'),JSON['stringify'](_0x54c1a6));if(_0x54c1a6[_0x859d('0xe')]){if(_0x54c1a6[_0x859d('0xe')][_0x859d('0xf')]===0x1f4){logger[_0x859d('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x50eb1b,_0x54c1a6[_0x859d('0xe')]['message']);return _0x6de0e4(_0x54c1a6['error']['message']);}logger['error'](_0x859d('0xb'),_0x50eb1b,_0x54c1a6['error'][_0x859d('0x10')]);return _0x1e1992(_0x54c1a6[_0x859d('0xe')][_0x859d('0x10')]);}else{logger[_0x859d('0x11')](_0x859d('0xb'),_0x50eb1b,_0x859d('0xd'));_0x1e1992(_0x54c1a6[_0x859d('0x12')]['message']);}})[_0x859d('0x13')](function(_0x56f8a9){logger[_0x859d('0xe')](_0x859d('0xb'),_0x50eb1b,_0x56f8a9);_0x6de0e4(_0x56f8a9);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index cd10089..55c7e6c 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 _0xcaf2=['delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x4008d0,_0x871aea){var _0x4e3eb0=function(_0x947f9a){while(--_0x947f9a){_0x4008d0['push'](_0x4008d0['shift']());}};_0x4e3eb0(++_0x871aea);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0xcaf2[_0x5e9689];return _0x2fac94;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var auth=require(_0x2caf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2caf('0x5'));var controller=require('./intZohoField.controller');router[_0x2caf('0x6')]('/',auth[_0x2caf('0x7')](),controller[_0x2caf('0x8')]);router['get'](_0x2caf('0x9'),auth[_0x2caf('0x7')](),controller[_0x2caf('0xa')]);router[_0x2caf('0xb')]('/',auth['isAuthenticated'](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')](_0x2caf('0x9'),auth[_0x2caf('0x7')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0x9'),auth[_0x2caf('0x7')](),controller[_0x2caf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x31dcd9,_0x545752){var _0xb75e2f=function(_0x2e6da0){while(--_0x2e6da0){_0x31dcd9['push'](_0x31dcd9['shift']());}};_0xb75e2f(++_0x545752);}(_0x1967,0x173));var _0x7196=function(_0x5eb238,_0xfb470a){_0x5eb238=_0x5eb238-0x0;var _0x21ff9f=_0x1967[_0x5eb238];return _0x21ff9f;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c0b4224..ed10958 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 _0x16e4=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x16e4,0x97));var _0x416e=function(_0x355e2b,_0x1e99eb){_0x355e2b=_0x355e2b-0x0;var _0x2b59bb=_0x16e4[_0x355e2b];return _0x2b59bb;};'use strict';var Sequelize=require(_0x416e('0x0'));module[_0x416e('0x1')]={'type':{'type':Sequelize[_0x416e('0x2')](_0x416e('0x3'),_0x416e('0x4'),_0x416e('0x5'),'keyValue'),'defaultValue':_0x416e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x416e('0x6')]},'keyType':{'type':Sequelize[_0x416e('0x2')]('string',_0x416e('0x4'),_0x416e('0x5'))},'keyContent':{'type':Sequelize[_0x416e('0x6')]},'idField':{'type':Sequelize[_0x416e('0x6')]},'nameField':{'type':Sequelize[_0x416e('0x6')]},'customField':{'type':Sequelize[_0x416e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x416e('0x6')]}}; \ No newline at end of file +var _0xba2d=['customVariable','exports','string','STRING','ENUM','variable'];(function(_0x1cd4d5,_0x40bd09){var _0x348028=function(_0x10ffb3){while(--_0x10ffb3){_0x1cd4d5['push'](_0x1cd4d5['shift']());}};_0x348028(++_0x40bd09);}(_0xba2d,0xa3));var _0xdba2=function(_0x2fb380,_0x29c527){_0x2fb380=_0x2fb380-0x0;var _0x2ae75f=_0xba2d[_0x2fb380];return _0x2ae75f;};'use strict';var Sequelize=require('sequelize');module[_0xdba2('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue'),'defaultValue':_0xdba2('0x1')},'content':{'type':Sequelize[_0xdba2('0x2')]},'key':{'type':Sequelize[_0xdba2('0x2')]},'keyType':{'type':Sequelize[_0xdba2('0x3')](_0xdba2('0x1'),_0xdba2('0x4'),_0xdba2('0x5'))},'keyContent':{'type':Sequelize[_0xdba2('0x2')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdba2('0x2')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdba2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index e4669ef..4748cc7 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 _0xce1d=['limit','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','catch','show','params','include','find','create','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','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','../../mysqldb','sendStatus','status','count','offset'];(function(_0x579520,_0x180667){var _0x2d71a4=function(_0x13729f){while(--_0x13729f){_0x579520['push'](_0x579520['shift']());}};_0x2d71a4(++_0x180667);}(_0xce1d,0x1ba));var _0xdce1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce1d[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdce1('0x0'));var rp=require(_0xdce1('0x1'));var moment=require(_0xdce1('0x2'));var BPromise=require(_0xdce1('0x3'));var Mustache=require(_0xdce1('0x4'));var util=require(_0xdce1('0x5'));var path=require(_0xdce1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdce1('0x7'));var fs=require('fs');var _=require(_0xdce1('0x8'));var squel=require('squel');var crypto=require(_0xdce1('0x9'));var jsforce=require(_0xdce1('0xa'));var deskjs=require(_0xdce1('0xb'));var toCsv=require(_0xdce1('0xc'));var querystring=require('querystring');var Papa=require(_0xdce1('0xd'));var Redis=require(_0xdce1('0xe'));var authService=require(_0xdce1('0xf'));var qs=require(_0xdce1('0x10'));var as=require(_0xdce1('0x11'));var hardwareService=require(_0xdce1('0x12'));var logger=require(_0xdce1('0x13'))(_0xdce1('0x14'));var utils=require('../../config/utils');var config=require(_0xdce1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdce1('0x16'))['db'];function respondWithStatusCode(_0x6828ed,_0x287385){_0x287385=_0x287385||0xcc;return function(_0x211146){if(_0x211146){return _0x6828ed[_0xdce1('0x17')](_0x287385);}return _0x6828ed[_0xdce1('0x18')](_0x287385)['end']();};}function respondWithResult(_0x27643a,_0x119d7e){_0x119d7e=_0x119d7e||0xc8;return function(_0x9fff7c){if(_0x9fff7c){return _0x27643a[_0xdce1('0x18')](_0x119d7e)['json'](_0x9fff7c);}};}function respondWithFilteredResult(_0x285223,_0x4705ca){return function(_0xe932c6){if(_0xe932c6){var _0x4a6912=_0xe932c6[_0xdce1('0x19')],_0x4437f7=_0x4705ca[_0xdce1('0x1a')],_0x490930=_0x4705ca[_0xdce1('0x1a')]+_0x4705ca[_0xdce1('0x1b')],_0x628f77;if(_0x490930>=_0x4a6912){_0x490930=_0x4a6912;_0x628f77=0xc8;}else{_0x628f77=0xce;}_0x285223['status'](_0x628f77);return _0x285223['set'](_0xdce1('0x1c'),_0x4437f7+'-'+_0x490930+'/'+_0x4a6912)['json'](_0xe932c6);}return null;};}function patchUpdates(_0x24533d){return function(_0x1797a6){try{jsonpatch['apply'](_0x1797a6,_0x24533d,!![]);}catch(_0x4b290a){return BPromise[_0xdce1('0x1d')](_0x4b290a);}return _0x1797a6[_0xdce1('0x1e')]();};}function saveUpdates(_0x309bf2,_0x4bdaaa){return function(_0x2e917b){if(_0x2e917b){return _0x2e917b[_0xdce1('0x1f')](_0x309bf2)[_0xdce1('0x20')](function(_0xf98736){return _0xf98736;});}return null;};}function removeEntity(_0x26c637,_0x5cd8a1){return function(_0x18a3d7){if(_0x18a3d7){return _0x18a3d7['destroy']()['then'](function(){_0x26c637[_0xdce1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb8afa5,_0xec201e){return function(_0x4169e0){if(!_0x4169e0){_0xb8afa5[_0xdce1('0x17')](0x194);}return _0x4169e0;};}function handleError(_0x5f7470,_0x380aab){_0x380aab=_0x380aab||0x1f4;return function(_0x56bbf5){logger[_0xdce1('0x21')](_0x56bbf5[_0xdce1('0x22')]);if(_0x56bbf5[_0xdce1('0x23')]){delete _0x56bbf5[_0xdce1('0x23')];}_0x5f7470[_0xdce1('0x18')](_0x380aab)[_0xdce1('0x24')](_0x56bbf5);};}exports[_0xdce1('0x25')]=function(_0x104861,_0x14ce9b){var _0x58ad60={},_0x515ce9={},_0x5aba9a={'count':0x0,'rows':[]};var _0x3753f6=_[_0xdce1('0x26')](db[_0xdce1('0x27')][_0xdce1('0x28')],function(_0x9185e5){return{'name':_0x9185e5[_0xdce1('0x29')],'type':_0x9185e5[_0xdce1('0x2a')][_0xdce1('0x2b')]};});_0x515ce9[_0xdce1('0x2c')]=_['map'](_0x3753f6,_0xdce1('0x23'));_0x515ce9['query']=_[_0xdce1('0x2d')](_0x104861[_0xdce1('0x2e')]);_0x515ce9[_0xdce1('0x2f')]=_[_0xdce1('0x30')](_0x515ce9[_0xdce1('0x2c')],_0x515ce9[_0xdce1('0x2e')]);_0x58ad60['attributes']=_[_0xdce1('0x30')](_0x515ce9['model'],qs[_0xdce1('0x31')](_0x104861[_0xdce1('0x2e')][_0xdce1('0x31')]));_0x58ad60[_0xdce1('0x32')]=_0x58ad60['attributes']['length']?_0x58ad60[_0xdce1('0x32')]:_0x515ce9['model'];if(!_0x104861['query'][_0xdce1('0x33')]('nolimit')){_0x58ad60[_0xdce1('0x1b')]=qs[_0xdce1('0x1b')](_0x104861[_0xdce1('0x2e')]['limit']);_0x58ad60[_0xdce1('0x1a')]=qs[_0xdce1('0x1a')](_0x104861['query'][_0xdce1('0x1a')]);}_0x58ad60[_0xdce1('0x34')]=qs['sort'](_0x104861['query']['sort']);_0x58ad60[_0xdce1('0x35')]=qs[_0xdce1('0x2f')](_['pick'](_0x104861['query'],_0x515ce9[_0xdce1('0x2f')]),_0x3753f6);if(_0x104861[_0xdce1('0x2e')][_0xdce1('0x36')]){_0x58ad60[_0xdce1('0x35')]=_['merge'](_0x58ad60[_0xdce1('0x35')],{'$or':_[_0xdce1('0x26')](_0x3753f6,function(_0x2c3903){if(_0x2c3903[_0xdce1('0x2a')]!==_0xdce1('0x37')){var _0x545f4e={};_0x545f4e[_0x2c3903[_0xdce1('0x23')]]={'$like':'%'+_0x104861['query'][_0xdce1('0x36')]+'%'};return _0x545f4e;}})});}_0x58ad60=_[_0xdce1('0x38')]({},_0x58ad60,_0x104861[_0xdce1('0x39')]);var _0x9fcf75={'where':_0x58ad60['where']};return db[_0xdce1('0x27')][_0xdce1('0x19')](_0x9fcf75)[_0xdce1('0x20')](function(_0x1d6079){_0x5aba9a[_0xdce1('0x19')]=_0x1d6079;if(_0x104861[_0xdce1('0x2e')][_0xdce1('0x3a')]){_0x58ad60['include']=[{'all':!![]}];}return db[_0xdce1('0x27')]['findAll'](_0x58ad60);})['then'](function(_0x3d8f85){_0x5aba9a['rows']=_0x3d8f85;return _0x5aba9a;})[_0xdce1('0x20')](respondWithFilteredResult(_0x14ce9b,_0x58ad60))[_0xdce1('0x3b')](handleError(_0x14ce9b,null));};exports[_0xdce1('0x3c')]=function(_0x13ddba,_0x177af6){var _0x560d17={'raw':!![],'where':{'id':_0x13ddba[_0xdce1('0x3d')]['id']}},_0x246916={};_0x246916[_0xdce1('0x2c')]=_['keys'](db[_0xdce1('0x27')]['rawAttributes']);_0x246916[_0xdce1('0x2e')]=_['keys'](_0x13ddba['query']);_0x246916[_0xdce1('0x2f')]=_['intersection'](_0x246916['model'],_0x246916[_0xdce1('0x2e')]);_0x560d17[_0xdce1('0x32')]=_[_0xdce1('0x30')](_0x246916['model'],qs['fields'](_0x13ddba[_0xdce1('0x2e')][_0xdce1('0x31')]));_0x560d17[_0xdce1('0x32')]=_0x560d17['attributes']['length']?_0x560d17[_0xdce1('0x32')]:_0x246916[_0xdce1('0x2c')];if(_0x13ddba[_0xdce1('0x2e')][_0xdce1('0x3a')]){_0x560d17[_0xdce1('0x3e')]=[{'all':!![]}];}_0x560d17=_[_0xdce1('0x38')]({},_0x560d17,_0x13ddba[_0xdce1('0x39')]);return db[_0xdce1('0x27')][_0xdce1('0x3f')](_0x560d17)[_0xdce1('0x20')](handleEntityNotFound(_0x177af6,null))['then'](respondWithResult(_0x177af6,null))['catch'](handleError(_0x177af6,null));};exports[_0xdce1('0x40')]=function(_0x4fa845,_0x1bc942){return db[_0xdce1('0x27')]['create'](_0x4fa845['body'],{})['then'](respondWithResult(_0x1bc942,0xc9))[_0xdce1('0x3b')](handleError(_0x1bc942,null));};exports[_0xdce1('0x1f')]=function(_0x3f5cee,_0x2d8c28){if(_0x3f5cee[_0xdce1('0x41')]['id']){delete _0x3f5cee[_0xdce1('0x41')]['id'];}return db[_0xdce1('0x27')][_0xdce1('0x3f')]({'where':{'id':_0x3f5cee[_0xdce1('0x3d')]['id']}})[_0xdce1('0x20')](handleEntityNotFound(_0x2d8c28,null))['then'](saveUpdates(_0x3f5cee[_0xdce1('0x41')],null))['then'](respondWithResult(_0x2d8c28,null))[_0xdce1('0x3b')](handleError(_0x2d8c28,null));};exports[_0xdce1('0x42')]=function(_0x2a450c,_0x2a4ad0){return db['ZohoField'][_0xdce1('0x3f')]({'where':{'id':_0x2a450c['params']['id']}})[_0xdce1('0x20')](handleEntityNotFound(_0x2a4ad0,null))['then'](removeEntity(_0x2a4ad0,null))[_0xdce1('0x3b')](handleError(_0x2a4ad0,null));}; \ No newline at end of file +var _0x6f0b=['../../mysqldb','end','status','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','ZohoField','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','includeAll','options','find','body','destroy','html-pdf','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5bcccc,_0x4cd420){var _0x3fb541=function(_0x157311){while(--_0x157311){_0x5bcccc['push'](_0x5bcccc['shift']());}};_0x3fb541(++_0x4cd420);}(_0x6f0b,0x158));var _0xb6f0=function(_0x4ed386,_0x5d2e82){_0x4ed386=_0x4ed386-0x0;var _0x39040e=_0x6f0b[_0x4ed386];return _0x39040e;};'use strict';var pdf=require(_0xb6f0('0x0'));var emlformat=require(_0xb6f0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6f0('0x2'));var rp=require(_0xb6f0('0x3'));var moment=require(_0xb6f0('0x4'));var BPromise=require(_0xb6f0('0x5'));var Mustache=require(_0xb6f0('0x6'));var util=require(_0xb6f0('0x7'));var path=require(_0xb6f0('0x8'));var sox=require(_0xb6f0('0x9'));var csv=require(_0xb6f0('0xa'));var ejs=require(_0xb6f0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb6f0('0xc'));var crypto=require(_0xb6f0('0xd'));var jsforce=require(_0xb6f0('0xe'));var deskjs=require(_0xb6f0('0xf'));var toCsv=require(_0xb6f0('0xa'));var querystring=require(_0xb6f0('0x10'));var Papa=require(_0xb6f0('0x11'));var Redis=require(_0xb6f0('0x12'));var authService=require(_0xb6f0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb6f0('0x14'));var hardwareService=require(_0xb6f0('0x15'));var logger=require(_0xb6f0('0x16'))('api');var utils=require(_0xb6f0('0x17'));var config=require(_0xb6f0('0x18'));var licenseUtil=require(_0xb6f0('0x19'));var db=require(_0xb6f0('0x1a'))['db'];function respondWithStatusCode(_0x498be4,_0x190b74){_0x190b74=_0x190b74||0xcc;return function(_0x2e93e9){if(_0x2e93e9){return _0x498be4['sendStatus'](_0x190b74);}return _0x498be4['status'](_0x190b74)[_0xb6f0('0x1b')]();};}function respondWithResult(_0x330f30,_0x2b1583){_0x2b1583=_0x2b1583||0xc8;return function(_0x2294bb){if(_0x2294bb){return _0x330f30[_0xb6f0('0x1c')](_0x2b1583)['json'](_0x2294bb);}};}function respondWithFilteredResult(_0x342d6b,_0x103a5b){return function(_0x2024b8){if(_0x2024b8){var _0x229559=_0x2024b8[_0xb6f0('0x1d')],_0x1fa4cf=_0x103a5b[_0xb6f0('0x1e')],_0xb3b13b=_0x103a5b[_0xb6f0('0x1e')]+_0x103a5b[_0xb6f0('0x1f')],_0x409f47;if(_0xb3b13b>=_0x229559){_0xb3b13b=_0x229559;_0x409f47=0xc8;}else{_0x409f47=0xce;}_0x342d6b[_0xb6f0('0x1c')](_0x409f47);return _0x342d6b['set'](_0xb6f0('0x20'),_0x1fa4cf+'-'+_0xb3b13b+'/'+_0x229559)['json'](_0x2024b8);}return null;};}function patchUpdates(_0x29fd80){return function(_0x206a91){try{jsonpatch[_0xb6f0('0x21')](_0x206a91,_0x29fd80,!![]);}catch(_0x399bb4){return BPromise['reject'](_0x399bb4);}return _0x206a91[_0xb6f0('0x22')]();};}function saveUpdates(_0x45b0e7,_0x132536){return function(_0x522952){if(_0x522952){return _0x522952[_0xb6f0('0x23')](_0x45b0e7)[_0xb6f0('0x24')](function(_0x59f0ad){return _0x59f0ad;});}return null;};}function removeEntity(_0x5d4bad,_0x2d0e56){return function(_0xed0182){if(_0xed0182){return _0xed0182['destroy']()[_0xb6f0('0x24')](function(){_0x5d4bad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50443e,_0x47f232){return function(_0x5cb683){if(!_0x5cb683){_0x50443e['sendStatus'](0x194);}return _0x5cb683;};}function handleError(_0x2b2cd6,_0x3abdc2){_0x3abdc2=_0x3abdc2||0x1f4;return function(_0x14320c){logger[_0xb6f0('0x25')](_0x14320c[_0xb6f0('0x26')]);if(_0x14320c[_0xb6f0('0x27')]){delete _0x14320c['name'];}_0x2b2cd6[_0xb6f0('0x1c')](_0x3abdc2)[_0xb6f0('0x28')](_0x14320c);};}exports['index']=function(_0x1b09fa,_0x5d7b3c){var _0x2bfc7d={},_0x3a7bc9={},_0x5c91a6={'count':0x0,'rows':[]};var _0x4b686b=_['map'](db[_0xb6f0('0x29')][_0xb6f0('0x2a')],function(_0x1d55c7){return{'name':_0x1d55c7[_0xb6f0('0x2b')],'type':_0x1d55c7[_0xb6f0('0x2c')][_0xb6f0('0x2d')]};});_0x3a7bc9['model']=_[_0xb6f0('0x2e')](_0x4b686b,'name');_0x3a7bc9[_0xb6f0('0x2f')]=_['keys'](_0x1b09fa[_0xb6f0('0x2f')]);_0x3a7bc9['filters']=_[_0xb6f0('0x30')](_0x3a7bc9[_0xb6f0('0x31')],_0x3a7bc9[_0xb6f0('0x2f')]);_0x2bfc7d[_0xb6f0('0x32')]=_['intersection'](_0x3a7bc9[_0xb6f0('0x31')],qs['fields'](_0x1b09fa['query'][_0xb6f0('0x33')]));_0x2bfc7d[_0xb6f0('0x32')]=_0x2bfc7d[_0xb6f0('0x32')][_0xb6f0('0x34')]?_0x2bfc7d[_0xb6f0('0x32')]:_0x3a7bc9[_0xb6f0('0x31')];if(!_0x1b09fa[_0xb6f0('0x2f')][_0xb6f0('0x35')](_0xb6f0('0x36'))){_0x2bfc7d[_0xb6f0('0x1f')]=qs[_0xb6f0('0x1f')](_0x1b09fa[_0xb6f0('0x2f')][_0xb6f0('0x1f')]);_0x2bfc7d[_0xb6f0('0x1e')]=qs[_0xb6f0('0x1e')](_0x1b09fa[_0xb6f0('0x2f')]['offset']);}_0x2bfc7d[_0xb6f0('0x37')]=qs[_0xb6f0('0x38')](_0x1b09fa['query'][_0xb6f0('0x38')]);_0x2bfc7d[_0xb6f0('0x39')]=qs[_0xb6f0('0x3a')](_[_0xb6f0('0x3b')](_0x1b09fa[_0xb6f0('0x2f')],_0x3a7bc9['filters']),_0x4b686b);if(_0x1b09fa[_0xb6f0('0x2f')][_0xb6f0('0x3c')]){_0x2bfc7d[_0xb6f0('0x39')]=_[_0xb6f0('0x3d')](_0x2bfc7d[_0xb6f0('0x39')],{'$or':_[_0xb6f0('0x2e')](_0x4b686b,function(_0xbe4700){if(_0xbe4700['type']!==_0xb6f0('0x3e')){var _0x25cfa0={};_0x25cfa0[_0xbe4700[_0xb6f0('0x27')]]={'$like':'%'+_0x1b09fa[_0xb6f0('0x2f')]['filter']+'%'};return _0x25cfa0;}})});}_0x2bfc7d=_['merge']({},_0x2bfc7d,_0x1b09fa['options']);var _0x4e9e29={'where':_0x2bfc7d[_0xb6f0('0x39')]};return db['ZohoField']['count'](_0x4e9e29)[_0xb6f0('0x24')](function(_0x5af997){_0x5c91a6['count']=_0x5af997;if(_0x1b09fa[_0xb6f0('0x2f')]['includeAll']){_0x2bfc7d[_0xb6f0('0x3f')]=[{'all':!![]}];}return db[_0xb6f0('0x29')][_0xb6f0('0x40')](_0x2bfc7d);})['then'](function(_0xe6a919){_0x5c91a6[_0xb6f0('0x41')]=_0xe6a919;return _0x5c91a6;})[_0xb6f0('0x24')](respondWithFilteredResult(_0x5d7b3c,_0x2bfc7d))[_0xb6f0('0x42')](handleError(_0x5d7b3c,null));};exports[_0xb6f0('0x43')]=function(_0x4b2d11,_0x1dbdd4){var _0x55c05a={'raw':!![],'where':{'id':_0x4b2d11['params']['id']}},_0x15daa4={};_0x15daa4[_0xb6f0('0x31')]=_['keys'](db[_0xb6f0('0x29')][_0xb6f0('0x2a')]);_0x15daa4[_0xb6f0('0x2f')]=_[_0xb6f0('0x44')](_0x4b2d11[_0xb6f0('0x2f')]);_0x15daa4['filters']=_[_0xb6f0('0x30')](_0x15daa4[_0xb6f0('0x31')],_0x15daa4[_0xb6f0('0x2f')]);_0x55c05a[_0xb6f0('0x32')]=_[_0xb6f0('0x30')](_0x15daa4[_0xb6f0('0x31')],qs['fields'](_0x4b2d11[_0xb6f0('0x2f')]['fields']));_0x55c05a[_0xb6f0('0x32')]=_0x55c05a['attributes'][_0xb6f0('0x34')]?_0x55c05a['attributes']:_0x15daa4['model'];if(_0x4b2d11[_0xb6f0('0x2f')][_0xb6f0('0x45')]){_0x55c05a[_0xb6f0('0x3f')]=[{'all':!![]}];}_0x55c05a=_[_0xb6f0('0x3d')]({},_0x55c05a,_0x4b2d11[_0xb6f0('0x46')]);return db['ZohoField'][_0xb6f0('0x47')](_0x55c05a)[_0xb6f0('0x24')](handleEntityNotFound(_0x1dbdd4,null))[_0xb6f0('0x24')](respondWithResult(_0x1dbdd4,null))[_0xb6f0('0x42')](handleError(_0x1dbdd4,null));};exports['create']=function(_0x2a4cd4,_0x3da7e3){return db[_0xb6f0('0x29')]['create'](_0x2a4cd4[_0xb6f0('0x48')],{})[_0xb6f0('0x24')](respondWithResult(_0x3da7e3,0xc9))[_0xb6f0('0x42')](handleError(_0x3da7e3,null));};exports[_0xb6f0('0x23')]=function(_0x39ff6f,_0x251c35){if(_0x39ff6f[_0xb6f0('0x48')]['id']){delete _0x39ff6f['body']['id'];}return db[_0xb6f0('0x29')][_0xb6f0('0x47')]({'where':{'id':_0x39ff6f['params']['id']}})['then'](handleEntityNotFound(_0x251c35,null))['then'](saveUpdates(_0x39ff6f[_0xb6f0('0x48')],null))['then'](respondWithResult(_0x251c35,null))[_0xb6f0('0x42')](handleError(_0x251c35,null));};exports[_0xb6f0('0x49')]=function(_0x52a110,_0x32ae91){return db[_0xb6f0('0x29')][_0xb6f0('0x47')]({'where':{'id':_0x52a110['params']['id']}})[_0xb6f0('0x24')](handleEntityNotFound(_0x32ae91,null))[_0xb6f0('0x24')](removeEntity(_0x32ae91,null))[_0xb6f0('0x42')](handleError(_0x32ae91,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 588ca41..3a9d965 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 _0xcf91=['./intZohoField.attributes','zoho_unique_index','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xabde9e,_0x1ada10){var _0x2652f0=function(_0x2a8c00){while(--_0x2a8c00){_0xabde9e['push'](_0xabde9e['shift']());}};_0x2652f0(++_0x1ada10);}(_0xcf91,0x12e));var _0x1cf9=function(_0x1cb9aa,_0x254423){_0x1cb9aa=_0x1cb9aa-0x0;var _0x22f6c8=_0xcf91[_0x1cb9aa];return _0x22f6c8;};'use strict';var _=require(_0x1cf9('0x0'));var util=require('util');var logger=require(_0x1cf9('0x1'))(_0x1cf9('0x2'));var moment=require('moment');var BPromise=require(_0x1cf9('0x3'));var rp=require(_0x1cf9('0x4'));var fs=require('fs');var path=require(_0x1cf9('0x5'));var rimraf=require(_0x1cf9('0x6'));var config=require(_0x1cf9('0x7'));var attributes=require(_0x1cf9('0x8'));module['exports']=function(_0x2b9085,_0x500978){return _0x2b9085['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x1cf9('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bae=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x16a1f8,_0xd57bbd){var _0x207a17=function(_0x1a8ab1){while(--_0x1a8ab1){_0x16a1f8['push'](_0x16a1f8['shift']());}};_0x207a17(++_0xd57bbd);}(_0x3bae,0x1c8));var _0xe3ba=function(_0x16091b,_0x46345f){_0x16091b=_0x16091b-0x0;var _0x5e9f7a=_0x3bae[_0x16091b];return _0x5e9f7a;};'use strict';var _=require(_0xe3ba('0x0'));var util=require(_0xe3ba('0x1'));var logger=require(_0xe3ba('0x2'))(_0xe3ba('0x3'));var moment=require(_0xe3ba('0x4'));var BPromise=require(_0xe3ba('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe3ba('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xe3ba('0x7')]=function(_0x270630,_0x40a101){return _0x270630[_0xe3ba('0x8')](_0xe3ba('0x9'),attributes,{'tableName':_0xe3ba('0xa'),'paranoid':![],'indexes':[{'name':_0xe3ba('0xb'),'fields':['idField',_0xe3ba('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 6357ac6..fa9e8b4 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 _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x440fca,_0x16f4dc){var _0x39f482=function(_0x90a4db){while(--_0x90a4db){_0x440fca['push'](_0x440fca['shift']());}};_0x39f482(++_0x16f4dc);}(_0x4c4e,0x152));var _0xe4c4=function(_0x3aa3ed,_0x3dd4e8){_0x3aa3ed=_0x3aa3ed-0x0;var _0x374474=_0x4c4e[_0x3aa3ed];return _0x374474;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('ZohoField,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('ZohoField,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xb458,0x103));var _0x8b45=function(_0x167bf6,_0x18cd30){_0x167bf6=_0x167bf6-0x0;var _0x369e45=_0xb458[_0x167bf6];return _0x369e45;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6388120..4229aee 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 _0x6780=['../../config/environment','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3a233c,_0xcfdf16){var _0x17df07=function(_0x5d565a){while(--_0x5d565a){_0x3a233c['push'](_0x3a233c['shift']());}};_0x17df07(++_0xcfdf16);}(_0x6780,0x81));var _0x0678=function(_0x4fdb1c,_0x548998){_0x4fdb1c=_0x4fdb1c-0x0;var _0x118416=_0x6780[_0x4fdb1c];return _0x118416;};'use strict';var multer=require(_0x0678('0x0'));var util=require(_0x0678('0x1'));var path=require(_0x0678('0x2'));var timeout=require('connect-timeout');var express=require(_0x0678('0x3'));var router=express[_0x0678('0x4')]();var auth=require(_0x0678('0x5'));var interaction=require(_0x0678('0x6'));var config=require(_0x0678('0x7'));module['exports']=router; \ No newline at end of file +var _0x0dfb=['exports','multer','path','connect-timeout','express','Router'];(function(_0x49aff9,_0x4ef00c){var _0x333fe0=function(_0x4995fd){while(--_0x4995fd){_0x49aff9['push'](_0x49aff9['shift']());}};_0x333fe0(++_0x4ef00c);}(_0x0dfb,0x181));var _0xb0df=function(_0x7b49a2,_0x409313){_0x7b49a2=_0x7b49a2-0x0;var _0x5e0a00=_0x0dfb[_0x7b49a2];return _0x5e0a00;};'use strict';var multer=require(_0xb0df('0x0'));var util=require('util');var path=require(_0xb0df('0x1'));var timeout=require(_0xb0df('0x2'));var express=require(_0xb0df('0x3'));var router=express[_0xb0df('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xb0df('0x5')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5fa8681..55acb9e 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 _0x1368=['STRING','app.js','INTEGER','state','exports','unique_name_and_version'];(function(_0x1f53ca,_0x37aef4){var _0x523fe0=function(_0x15bba8){while(--_0x15bba8){_0x1f53ca['push'](_0x1f53ca['shift']());}};_0x523fe0(++_0x37aef4);}(_0x1368,0xf4));var _0x8136=function(_0x2ccc76,_0x44ccc0){_0x2ccc76=_0x2ccc76-0x0;var _0x45882b=_0x1368[_0x2ccc76];return _0x45882b;};'use strict';var Sequelize=require('sequelize');module[_0x8136('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8136('0x1')},'version':{'type':Sequelize[_0x8136('0x2')],'allowNull':![],'unique':_0x8136('0x1')},'main':{'type':Sequelize[_0x8136('0x2')],'defaultValue':_0x8136('0x3')},'filename':{'type':Sequelize[_0x8136('0x2')]},'path':{'type':Sequelize[_0x8136('0x2')]},'type':{'type':Sequelize[_0x8136('0x2')]},'size':{'type':Sequelize[_0x8136('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x8136('0x2')]},'logo':{'type':Sequelize[_0x8136('0x2')]},'state':{'type':Sequelize[_0x8136('0x2')],'unique':_0x8136('0x5')},'description':{'type':Sequelize[_0x8136('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8136('0x2')]},'link':{'type':Sequelize[_0x8136('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xafb9=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x4a2b03,_0x4a3921){var _0x521a92=function(_0x3b519f){while(--_0x3b519f){_0x4a2b03['push'](_0x4a2b03['shift']());}};_0x521a92(++_0x4a3921);}(_0xafb9,0x1f4));var _0x9afb=function(_0x46f524,_0x1d7044){_0x46f524=_0x46f524-0x0;var _0x2d7539=_0xafb9[_0x46f524];return _0x2d7539;};'use strict';var Sequelize=require(_0x9afb('0x0'));module['exports']={'name':{'type':Sequelize[_0x9afb('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9afb('0x2')},'main':{'type':Sequelize[_0x9afb('0x1')],'defaultValue':_0x9afb('0x3')},'filename':{'type':Sequelize[_0x9afb('0x1')]},'path':{'type':Sequelize[_0x9afb('0x1')]},'type':{'type':Sequelize[_0x9afb('0x1')]},'size':{'type':Sequelize[_0x9afb('0x4')]},'active':{'type':Sequelize[_0x9afb('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9afb('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9afb('0x1')],'unique':_0x9afb('0x6')},'description':{'type':Sequelize[_0x9afb('0x1')]},'title':{'type':Sequelize[_0x9afb('0x1')]},'remoteUri':{'type':Sequelize[_0x9afb('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index dad3951..eb6ba64 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 _0xad59=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','Integration','rawAttributes','fieldName','map','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','include','find','create','body','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto'];(function(_0x1df470,_0x43cff9){var _0x277849=function(_0x164f32){while(--_0x164f32){_0x1df470['push'](_0x1df470['shift']());}};_0x277849(++_0x43cff9);}(_0xad59,0x84));var _0x9ad5=function(_0x18af26,_0x45d001){_0x18af26=_0x18af26-0x0;var _0x23d8ac=_0xad59[_0x18af26];return _0x23d8ac;};'use strict';var pdf=require(_0x9ad5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9ad5('0x1'));var zipdir=require(_0x9ad5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ad5('0x3'));var moment=require(_0x9ad5('0x4'));var BPromise=require(_0x9ad5('0x5'));var Mustache=require('mustache');var util=require(_0x9ad5('0x6'));var path=require(_0x9ad5('0x7'));var sox=require(_0x9ad5('0x8'));var csv=require(_0x9ad5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ad5('0xa'));var squel=require('squel');var crypto=require(_0x9ad5('0xb'));var jsforce=require(_0x9ad5('0xc'));var deskjs=require(_0x9ad5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9ad5('0xe'));var Papa=require(_0x9ad5('0xf'));var Redis=require(_0x9ad5('0x10'));var authService=require(_0x9ad5('0x11'));var qs=require(_0x9ad5('0x12'));var as=require(_0x9ad5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ad5('0x14'))(_0x9ad5('0x15'));var utils=require(_0x9ad5('0x16'));var config=require(_0x9ad5('0x17'));var licenseUtil=require(_0x9ad5('0x18'));var db=require(_0x9ad5('0x19'))['db'];function respondWithStatusCode(_0x5570ee,_0x1ba78a){_0x1ba78a=_0x1ba78a||0xcc;return function(_0x4d48a6){if(_0x4d48a6){return _0x5570ee[_0x9ad5('0x1a')](_0x1ba78a);}return _0x5570ee[_0x9ad5('0x1b')](_0x1ba78a)[_0x9ad5('0x1c')]();};}function respondWithResult(_0x105d19,_0x3bfc39){_0x3bfc39=_0x3bfc39||0xc8;return function(_0x2f7ffa){if(_0x2f7ffa){return _0x105d19[_0x9ad5('0x1b')](_0x3bfc39)[_0x9ad5('0x1d')](_0x2f7ffa);}};}function respondWithFilteredResult(_0x350628,_0x1f501d){return function(_0x5e864f){if(_0x5e864f){var _0x5c7156=_0x5e864f[_0x9ad5('0x1e')],_0x1f106b=_0x1f501d[_0x9ad5('0x1f')],_0x170ee0=_0x1f501d[_0x9ad5('0x1f')]+_0x1f501d[_0x9ad5('0x20')],_0x422f20;if(_0x170ee0>=_0x5c7156){_0x170ee0=_0x5c7156;_0x422f20=0xc8;}else{_0x422f20=0xce;}_0x350628[_0x9ad5('0x1b')](_0x422f20);return _0x350628[_0x9ad5('0x21')](_0x9ad5('0x22'),_0x1f106b+'-'+_0x170ee0+'/'+_0x5c7156)[_0x9ad5('0x1d')](_0x5e864f);}return null;};}function patchUpdates(_0x14d92d){return function(_0x24b5c0){try{jsonpatch[_0x9ad5('0x23')](_0x24b5c0,_0x14d92d,!![]);}catch(_0x33922a){return BPromise['reject'](_0x33922a);}return _0x24b5c0[_0x9ad5('0x24')]();};}function saveUpdates(_0xec8b47,_0x14516c){return function(_0x26c95b){if(_0x26c95b){return _0x26c95b[_0x9ad5('0x25')](_0xec8b47)[_0x9ad5('0x26')](function(_0x46b7ca){return _0x46b7ca;});}return null;};}function removeEntity(_0x558ee0,_0x2c41fd){return function(_0x58262b){if(_0x58262b){return _0x58262b['destroy']()[_0x9ad5('0x26')](function(){_0x558ee0['status'](0xcc)[_0x9ad5('0x1c')]();});}};}function handleEntityNotFound(_0x4048fd,_0x20d31a){return function(_0x38c668){if(!_0x38c668){_0x4048fd[_0x9ad5('0x1a')](0x194);}return _0x38c668;};}function handleError(_0x39c9f4,_0x34811d){_0x34811d=_0x34811d||0x1f4;return function(_0x5c9a5d){logger['error'](_0x5c9a5d[_0x9ad5('0x27')]);if(_0x5c9a5d[_0x9ad5('0x28')]){delete _0x5c9a5d[_0x9ad5('0x28')];}_0x39c9f4[_0x9ad5('0x1b')](_0x34811d)[_0x9ad5('0x29')](_0x5c9a5d);};}exports['index']=function(_0x47b91a,_0x5e96d9){var _0x24efc8={},_0x1e578e={},_0x5a4ec3={'count':0x0,'rows':[]};var _0x51823d=_['map'](db[_0x9ad5('0x2a')][_0x9ad5('0x2b')],function(_0x47ab6c){return{'name':_0x47ab6c[_0x9ad5('0x2c')],'type':_0x47ab6c['type']['key']};});_0x1e578e['model']=_[_0x9ad5('0x2d')](_0x51823d,_0x9ad5('0x28'));_0x1e578e[_0x9ad5('0x2e')]=_['keys'](_0x47b91a[_0x9ad5('0x2e')]);_0x1e578e['filters']=_[_0x9ad5('0x2f')](_0x1e578e['model'],_0x1e578e[_0x9ad5('0x2e')]);_0x24efc8[_0x9ad5('0x30')]=_[_0x9ad5('0x2f')](_0x1e578e[_0x9ad5('0x31')],qs[_0x9ad5('0x32')](_0x47b91a[_0x9ad5('0x2e')]['fields']));_0x24efc8[_0x9ad5('0x30')]=_0x24efc8[_0x9ad5('0x30')][_0x9ad5('0x33')]?_0x24efc8[_0x9ad5('0x30')]:_0x1e578e[_0x9ad5('0x31')];if(!_0x47b91a[_0x9ad5('0x2e')][_0x9ad5('0x34')]('nolimit')){_0x24efc8[_0x9ad5('0x20')]=qs[_0x9ad5('0x20')](_0x47b91a[_0x9ad5('0x2e')][_0x9ad5('0x20')]);_0x24efc8['offset']=qs[_0x9ad5('0x1f')](_0x47b91a[_0x9ad5('0x2e')][_0x9ad5('0x1f')]);}_0x24efc8[_0x9ad5('0x35')]=qs['sort'](_0x47b91a['query'][_0x9ad5('0x36')]);_0x24efc8[_0x9ad5('0x37')]=qs[_0x9ad5('0x38')](_[_0x9ad5('0x39')](_0x47b91a[_0x9ad5('0x2e')],_0x1e578e['filters']),_0x51823d);if(_0x47b91a['query']['filter']){_0x24efc8[_0x9ad5('0x37')]=_[_0x9ad5('0x3a')](_0x24efc8['where'],{'$or':_[_0x9ad5('0x2d')](_0x51823d,function(_0x2e3a0b){if(_0x2e3a0b['type']!==_0x9ad5('0x3b')){var _0x745029={};_0x745029[_0x2e3a0b[_0x9ad5('0x28')]]={'$like':'%'+_0x47b91a[_0x9ad5('0x2e')][_0x9ad5('0x3c')]+'%'};return _0x745029;}})});}_0x24efc8=_['merge']({},_0x24efc8,_0x47b91a[_0x9ad5('0x3d')]);var _0x197bec={'where':_0x24efc8['where']};return db[_0x9ad5('0x2a')][_0x9ad5('0x1e')](_0x197bec)[_0x9ad5('0x26')](function(_0x4a74be){_0x5a4ec3[_0x9ad5('0x1e')]=_0x4a74be;if(_0x47b91a['query']['includeAll']){_0x24efc8['include']=[{'all':!![]}];}return db[_0x9ad5('0x2a')][_0x9ad5('0x3e')](_0x24efc8);})[_0x9ad5('0x26')](function(_0x4a9d09){_0x5a4ec3[_0x9ad5('0x3f')]=_0x4a9d09;return _0x5a4ec3;})['then'](respondWithFilteredResult(_0x5e96d9,_0x24efc8))[_0x9ad5('0x40')](handleError(_0x5e96d9,null));};exports['show']=function(_0x43ffec,_0x3c365f){var _0xbca288={'raw':![],'where':{'id':_0x43ffec[_0x9ad5('0x41')]['id']}},_0xad60b1={};_0xad60b1['model']=_[_0x9ad5('0x42')](db[_0x9ad5('0x2a')]['rawAttributes']);_0xad60b1['query']=_[_0x9ad5('0x42')](_0x43ffec[_0x9ad5('0x2e')]);_0xad60b1[_0x9ad5('0x38')]=_[_0x9ad5('0x2f')](_0xad60b1[_0x9ad5('0x31')],_0xad60b1[_0x9ad5('0x2e')]);_0xbca288[_0x9ad5('0x30')]=_[_0x9ad5('0x2f')](_0xad60b1[_0x9ad5('0x31')],qs[_0x9ad5('0x32')](_0x43ffec[_0x9ad5('0x2e')][_0x9ad5('0x32')]));_0xbca288[_0x9ad5('0x30')]=_0xbca288[_0x9ad5('0x30')][_0x9ad5('0x33')]?_0xbca288['attributes']:_0xad60b1['model'];if(_0x43ffec[_0x9ad5('0x2e')]['includeAll']){_0xbca288[_0x9ad5('0x43')]=[{'all':!![]}];}_0xbca288=_[_0x9ad5('0x3a')]({},_0xbca288,_0x43ffec[_0x9ad5('0x3d')]);return db['Integration'][_0x9ad5('0x44')](_0xbca288)[_0x9ad5('0x26')](handleEntityNotFound(_0x3c365f,null))[_0x9ad5('0x26')](respondWithResult(_0x3c365f,null))['catch'](handleError(_0x3c365f,null));};exports['create']=function(_0x76b884,_0x2ac6ba){return db[_0x9ad5('0x2a')][_0x9ad5('0x45')](_0x76b884[_0x9ad5('0x46')],{})[_0x9ad5('0x26')](respondWithResult(_0x2ac6ba,0xc9))[_0x9ad5('0x40')](handleError(_0x2ac6ba,null));};exports[_0x9ad5('0x25')]=function(_0x351ba7,_0x2256f7){if(_0x351ba7[_0x9ad5('0x46')]['id']){delete _0x351ba7['body']['id'];}return db['Integration'][_0x9ad5('0x44')]({'where':{'id':_0x351ba7[_0x9ad5('0x41')]['id']}})['then'](handleEntityNotFound(_0x2256f7,null))[_0x9ad5('0x26')](saveUpdates(_0x351ba7['body'],null))[_0x9ad5('0x26')](respondWithResult(_0x2256f7,null))[_0x9ad5('0x40')](handleError(_0x2256f7,null));};exports[_0x9ad5('0x47')]=function(_0x253adf,_0x151685){return db[_0x9ad5('0x2a')][_0x9ad5('0x44')]({'where':{'id':_0x253adf[_0x9ad5('0x41')]['id']}})[_0x9ad5('0x26')](handleEntityNotFound(_0x151685,null))[_0x9ad5('0x26')](removeEntity(_0x151685,null))[_0x9ad5('0x40')](handleError(_0x151685,null));}; \ No newline at end of file +var _0x9197=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params'];(function(_0x620ae1,_0x55d56a){var _0x215500=function(_0x357fa6){while(--_0x357fa6){_0x620ae1['push'](_0x620ae1['shift']());}};_0x215500(++_0x55d56a);}(_0x9197,0x97));var _0x7919=function(_0x439853,_0x2a166b){_0x439853=_0x439853-0x0;var _0x13fd07=_0x9197[_0x439853];return _0x13fd07;};'use strict';var pdf=require(_0x7919('0x0'));var emlformat=require(_0x7919('0x1'));var rimraf=require(_0x7919('0x2'));var zipdir=require(_0x7919('0x3'));var jsonpatch=require(_0x7919('0x4'));var rp=require(_0x7919('0x5'));var moment=require(_0x7919('0x6'));var BPromise=require(_0x7919('0x7'));var Mustache=require(_0x7919('0x8'));var util=require(_0x7919('0x9'));var path=require('path');var sox=require(_0x7919('0xa'));var csv=require(_0x7919('0xb'));var ejs=require(_0x7919('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7919('0xd'));var deskjs=require(_0x7919('0xe'));var toCsv=require(_0x7919('0xb'));var querystring=require(_0x7919('0xf'));var Papa=require(_0x7919('0x10'));var Redis=require(_0x7919('0x11'));var authService=require(_0x7919('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7919('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7919('0x14'));var licenseUtil=require(_0x7919('0x15'));var db=require(_0x7919('0x16'))['db'];function respondWithStatusCode(_0xd83c6,_0x2f7687){_0x2f7687=_0x2f7687||0xcc;return function(_0x40860d){if(_0x40860d){return _0xd83c6[_0x7919('0x17')](_0x2f7687);}return _0xd83c6[_0x7919('0x18')](_0x2f7687)[_0x7919('0x19')]();};}function respondWithResult(_0x4aa8cf,_0x17e54a){_0x17e54a=_0x17e54a||0xc8;return function(_0x49fbeb){if(_0x49fbeb){return _0x4aa8cf['status'](_0x17e54a)[_0x7919('0x1a')](_0x49fbeb);}};}function respondWithFilteredResult(_0x2711c8,_0x590f64){return function(_0x47a105){if(_0x47a105){var _0x32d3b4=_0x47a105[_0x7919('0x1b')],_0x1b3f3e=_0x590f64[_0x7919('0x1c')],_0x3d95ec=_0x590f64[_0x7919('0x1c')]+_0x590f64[_0x7919('0x1d')],_0x1c3d6c;if(_0x3d95ec>=_0x32d3b4){_0x3d95ec=_0x32d3b4;_0x1c3d6c=0xc8;}else{_0x1c3d6c=0xce;}_0x2711c8['status'](_0x1c3d6c);return _0x2711c8[_0x7919('0x1e')]('Content-Range',_0x1b3f3e+'-'+_0x3d95ec+'/'+_0x32d3b4)['json'](_0x47a105);}return null;};}function patchUpdates(_0xa7385e){return function(_0x3a2449){try{jsonpatch[_0x7919('0x1f')](_0x3a2449,_0xa7385e,!![]);}catch(_0x192328){return BPromise[_0x7919('0x20')](_0x192328);}return _0x3a2449[_0x7919('0x21')]();};}function saveUpdates(_0x812a56,_0x1ca28a){return function(_0x3fce19){if(_0x3fce19){return _0x3fce19[_0x7919('0x22')](_0x812a56)[_0x7919('0x23')](function(_0xc68fca){return _0xc68fca;});}return null;};}function removeEntity(_0x55d6d3,_0x24fdd7){return function(_0x591c6b){if(_0x591c6b){return _0x591c6b['destroy']()[_0x7919('0x23')](function(){_0x55d6d3[_0x7919('0x18')](0xcc)[_0x7919('0x19')]();});}};}function handleEntityNotFound(_0x51ea6a,_0x419576){return function(_0x178195){if(!_0x178195){_0x51ea6a[_0x7919('0x17')](0x194);}return _0x178195;};}function handleError(_0x3a7201,_0x19ca0f){_0x19ca0f=_0x19ca0f||0x1f4;return function(_0x2ada4d){logger[_0x7919('0x24')](_0x2ada4d[_0x7919('0x25')]);if(_0x2ada4d[_0x7919('0x26')]){delete _0x2ada4d[_0x7919('0x26')];}_0x3a7201[_0x7919('0x18')](_0x19ca0f)['send'](_0x2ada4d);};}exports[_0x7919('0x27')]=function(_0x174f31,_0x413d74){var _0x9940fa={},_0x46e6df={},_0x4bfa44={'count':0x0,'rows':[]};var _0x51bea5=_['map'](db['Integration'][_0x7919('0x28')],function(_0x369782){return{'name':_0x369782[_0x7919('0x29')],'type':_0x369782[_0x7919('0x2a')][_0x7919('0x2b')]};});_0x46e6df[_0x7919('0x2c')]=_[_0x7919('0x2d')](_0x51bea5,'name');_0x46e6df['query']=_['keys'](_0x174f31[_0x7919('0x2e')]);_0x46e6df[_0x7919('0x2f')]=_[_0x7919('0x30')](_0x46e6df[_0x7919('0x2c')],_0x46e6df['query']);_0x9940fa[_0x7919('0x31')]=_['intersection'](_0x46e6df[_0x7919('0x2c')],qs['fields'](_0x174f31[_0x7919('0x2e')][_0x7919('0x32')]));_0x9940fa['attributes']=_0x9940fa[_0x7919('0x31')][_0x7919('0x33')]?_0x9940fa[_0x7919('0x31')]:_0x46e6df[_0x7919('0x2c')];if(!_0x174f31[_0x7919('0x2e')][_0x7919('0x34')](_0x7919('0x35'))){_0x9940fa['limit']=qs[_0x7919('0x1d')](_0x174f31['query']['limit']);_0x9940fa['offset']=qs[_0x7919('0x1c')](_0x174f31['query']['offset']);}_0x9940fa[_0x7919('0x36')]=qs['sort'](_0x174f31[_0x7919('0x2e')][_0x7919('0x37')]);_0x9940fa[_0x7919('0x38')]=qs[_0x7919('0x2f')](_[_0x7919('0x39')](_0x174f31[_0x7919('0x2e')],_0x46e6df[_0x7919('0x2f')]),_0x51bea5);if(_0x174f31['query'][_0x7919('0x3a')]){_0x9940fa[_0x7919('0x38')]=_[_0x7919('0x3b')](_0x9940fa[_0x7919('0x38')],{'$or':_['map'](_0x51bea5,function(_0x2787bf){if(_0x2787bf[_0x7919('0x2a')]!==_0x7919('0x3c')){var _0x3cc419={};_0x3cc419[_0x2787bf['name']]={'$like':'%'+_0x174f31[_0x7919('0x2e')][_0x7919('0x3a')]+'%'};return _0x3cc419;}})});}_0x9940fa=_[_0x7919('0x3b')]({},_0x9940fa,_0x174f31[_0x7919('0x3d')]);var _0xea0eca={'where':_0x9940fa[_0x7919('0x38')]};return db[_0x7919('0x3e')][_0x7919('0x1b')](_0xea0eca)[_0x7919('0x23')](function(_0x45b371){_0x4bfa44[_0x7919('0x1b')]=_0x45b371;if(_0x174f31[_0x7919('0x2e')][_0x7919('0x3f')]){_0x9940fa['include']=[{'all':!![]}];}return db[_0x7919('0x3e')][_0x7919('0x40')](_0x9940fa);})[_0x7919('0x23')](function(_0x1154cb){_0x4bfa44[_0x7919('0x41')]=_0x1154cb;return _0x4bfa44;})['then'](respondWithFilteredResult(_0x413d74,_0x9940fa))[_0x7919('0x42')](handleError(_0x413d74,null));};exports[_0x7919('0x43')]=function(_0x40ae3e,_0x25a58b){var _0x7b2180={'raw':![],'where':{'id':_0x40ae3e['params']['id']}},_0x548a23={};_0x548a23[_0x7919('0x2c')]=_['keys'](db[_0x7919('0x3e')][_0x7919('0x28')]);_0x548a23[_0x7919('0x2e')]=_[_0x7919('0x44')](_0x40ae3e['query']);_0x548a23[_0x7919('0x2f')]=_[_0x7919('0x30')](_0x548a23['model'],_0x548a23[_0x7919('0x2e')]);_0x7b2180['attributes']=_[_0x7919('0x30')](_0x548a23[_0x7919('0x2c')],qs[_0x7919('0x32')](_0x40ae3e[_0x7919('0x2e')][_0x7919('0x32')]));_0x7b2180[_0x7919('0x31')]=_0x7b2180[_0x7919('0x31')][_0x7919('0x33')]?_0x7b2180[_0x7919('0x31')]:_0x548a23['model'];if(_0x40ae3e[_0x7919('0x2e')][_0x7919('0x3f')]){_0x7b2180[_0x7919('0x45')]=[{'all':!![]}];}_0x7b2180=_[_0x7919('0x3b')]({},_0x7b2180,_0x40ae3e['options']);return db[_0x7919('0x3e')][_0x7919('0x46')](_0x7b2180)[_0x7919('0x23')](handleEntityNotFound(_0x25a58b,null))['then'](respondWithResult(_0x25a58b,null))[_0x7919('0x42')](handleError(_0x25a58b,null));};exports['create']=function(_0x46e3dd,_0x412349){return db[_0x7919('0x3e')][_0x7919('0x47')](_0x46e3dd[_0x7919('0x48')],{})[_0x7919('0x23')](respondWithResult(_0x412349,0xc9))[_0x7919('0x42')](handleError(_0x412349,null));};exports['update']=function(_0xf294e5,_0x436533){if(_0xf294e5['body']['id']){delete _0xf294e5[_0x7919('0x48')]['id'];}return db[_0x7919('0x3e')]['find']({'where':{'id':_0xf294e5[_0x7919('0x49')]['id']}})['then'](handleEntityNotFound(_0x436533,null))[_0x7919('0x23')](saveUpdates(_0xf294e5[_0x7919('0x48')],null))[_0x7919('0x23')](respondWithResult(_0x436533,null))[_0x7919('0x42')](handleError(_0x436533,null));};exports[_0x7919('0x4a')]=function(_0x57568a,_0x551a99){return db[_0x7919('0x3e')]['find']({'where':{'id':_0x57568a[_0x7919('0x49')]['id']}})['then'](handleEntityNotFound(_0x551a99,null))[_0x7919('0x23')](removeEntity(_0x551a99,null))['catch'](handleError(_0x551a99,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 58ffa56..d8bedbf 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 _0xbef9=['request-promise','path','../../config/environment','./integration.attributes','define','integrations','util','../../config/logger','api','moment','bluebird'];(function(_0x1795a7,_0x45b30c){var _0x2d7f72=function(_0x33949d){while(--_0x33949d){_0x1795a7['push'](_0x1795a7['shift']());}};_0x2d7f72(++_0x45b30c);}(_0xbef9,0xab));var _0x9bef=function(_0x23c595,_0x418bd1){_0x23c595=_0x23c595-0x0;var _0xafa4ad=_0xbef9[_0x23c595];return _0xafa4ad;};'use strict';var _=require('lodash');var util=require(_0x9bef('0x0'));var logger=require(_0x9bef('0x1'))(_0x9bef('0x2'));var moment=require(_0x9bef('0x3'));var BPromise=require(_0x9bef('0x4'));var rp=require(_0x9bef('0x5'));var fs=require('fs');var path=require(_0x9bef('0x6'));var rimraf=require('rimraf');var config=require(_0x9bef('0x7'));var attributes=require(_0x9bef('0x8'));module['exports']=function(_0x5e0cbd,_0x188842){return _0x5e0cbd[_0x9bef('0x9')]('Integration',attributes,{'tableName':_0x9bef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb7e=['request-promise','exports','define','Integration','integrations','lodash','util','../../config/logger','api'];(function(_0x652923,_0x5f31ce){var _0x95c3eb=function(_0x3eb34b){while(--_0x3eb34b){_0x652923['push'](_0x652923['shift']());}};_0x95c3eb(++_0x5f31ce);}(_0xdb7e,0x191));var _0xedb7=function(_0x4f440a,_0x55c8b3){_0x4f440a=_0x4f440a-0x0;var _0x533c46=_0xdb7e[_0x4f440a];return _0x533c46;};'use strict';var _=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var logger=require(_0xedb7('0x2'))(_0xedb7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedb7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0xedb7('0x5')]=function(_0x4a1f2d,_0x1da907){return _0x4a1f2d[_0xedb7('0x6')](_0xedb7('0x7'),attributes,{'tableName':_0xedb7('0x8'),'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 6f0198b..7369851 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 _0x78b7=['request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x78b7,0x194));var _0x778b=function(_0x21c218,_0xe204e){_0x21c218=_0x21c218-0x0;var _0xebff61=_0x78b7[_0x21c218];return _0xebff61;};'use strict';var _=require(_0x778b('0x0'));var util=require(_0x778b('0x1'));var moment=require('moment');var BPromise=require(_0x778b('0x2'));var rs=require(_0x778b('0x3'));var fs=require('fs');var Redis=require(_0x778b('0x4'));var db=require(_0x778b('0x5'))['db'];var utils=require(_0x778b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x778b('0x7'));var jayson=require(_0x778b('0x8'));var client=jayson[_0x778b('0x9')][_0x778b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41ca62,_0x36d832,_0x49a27a){return new BPromise(function(_0x3fba10,_0x233288){return client[_0x778b('0xb')](_0x41ca62,_0x49a27a)[_0x778b('0xc')](function(_0x1bb497){logger['info'](_0x778b('0xd'),_0x36d832,_0x778b('0xe'));logger['debug'](_0x778b('0xf'),_0x36d832,_0x778b('0xe'),JSON[_0x778b('0x10')](_0x1bb497));if(_0x1bb497[_0x778b('0x11')]){if(_0x1bb497[_0x778b('0x11')]['code']===0x1f4){logger['error'](_0x778b('0xd'),_0x36d832,_0x1bb497[_0x778b('0x11')][_0x778b('0x12')]);return _0x233288(_0x1bb497[_0x778b('0x11')][_0x778b('0x12')]);}logger[_0x778b('0x11')](_0x778b('0xd'),_0x36d832,_0x1bb497['error'][_0x778b('0x12')]);return _0x3fba10(_0x1bb497[_0x778b('0x11')][_0x778b('0x12')]);}else{logger[_0x778b('0x13')](_0x778b('0xd'),_0x36d832,'request\x20sent');_0x3fba10(_0x1bb497[_0x778b('0x14')]['message']);}})[_0x778b('0x15')](function(_0x2525f4){logger['error'](_0x778b('0xd'),_0x36d832,_0x2525f4);_0x233288(_0x2525f4);});});} \ No newline at end of file +var _0x9efe=['code','Integration,\x20%s,\x20%s','message','info','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x9741a3,_0x554445){var _0x134d1e=function(_0xf17d14){while(--_0xf17d14){_0x9741a3['push'](_0x9741a3['shift']());}};_0x134d1e(++_0x554445);}(_0x9efe,0xca));var _0xe9ef=function(_0x6fae04,_0x33078d){_0x6fae04=_0x6fae04-0x0;var _0x546f87=_0x9efe[_0x6fae04];return _0x546f87;};'use strict';var _=require('lodash');var util=require(_0xe9ef('0x0'));var moment=require(_0xe9ef('0x1'));var BPromise=require(_0xe9ef('0x2'));var rs=require(_0xe9ef('0x3'));var fs=require('fs');var Redis=require(_0xe9ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9ef('0x5'));var logger=require(_0xe9ef('0x6'))(_0xe9ef('0x7'));var config=require(_0xe9ef('0x8'));var jayson=require(_0xe9ef('0x9'));var client=jayson[_0xe9ef('0xa')][_0xe9ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58d664,_0x47df46,_0x590cea){return new BPromise(function(_0x40ffdc,_0x2f7280){return client[_0xe9ef('0xc')](_0x58d664,_0x590cea)['then'](function(_0x51b634){logger['info']('Integration,\x20%s,\x20%s',_0x47df46,_0xe9ef('0xd'));logger[_0xe9ef('0xe')](_0xe9ef('0xf'),_0x47df46,'request\x20sent',JSON[_0xe9ef('0x10')](_0x51b634));if(_0x51b634[_0xe9ef('0x11')]){if(_0x51b634[_0xe9ef('0x11')][_0xe9ef('0x12')]===0x1f4){logger[_0xe9ef('0x11')](_0xe9ef('0x13'),_0x47df46,_0x51b634['error'][_0xe9ef('0x14')]);return _0x2f7280(_0x51b634[_0xe9ef('0x11')][_0xe9ef('0x14')]);}logger[_0xe9ef('0x11')](_0xe9ef('0x13'),_0x47df46,_0x51b634['error'][_0xe9ef('0x14')]);return _0x40ffdc(_0x51b634[_0xe9ef('0x11')][_0xe9ef('0x14')]);}else{logger[_0xe9ef('0x15')](_0xe9ef('0x13'),_0x47df46,'request\x20sent');_0x40ffdc(_0x51b634['result'][_0xe9ef('0x14')]);}})['catch'](function(_0x8ed5e3){logger[_0xe9ef('0x11')](_0xe9ef('0x13'),_0x47df46,_0x8ed5e3);_0x2f7280(_0x8ed5e3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a435fae..6efab9b 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 _0xb9b8=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','show','put','/:id','multer'];(function(_0x28f7c4,_0x186530){var _0x31b9b8=function(_0x39075b){while(--_0x39075b){_0x28f7c4['push'](_0x28f7c4['shift']());}};_0x31b9b8(++_0x186530);}(_0xb9b8,0x1d0));var _0x8b9b=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xb9b8[_0x3dc538];return _0x72c2fd;};'use strict';var multer=require(_0x8b9b('0x0'));var util=require(_0x8b9b('0x1'));var path=require(_0x8b9b('0x2'));var timeout=require(_0x8b9b('0x3'));var express=require(_0x8b9b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8b9b('0x5'));var config=require(_0x8b9b('0x6'));var controller=require(_0x8b9b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b9b('0x8')]);router[_0x8b9b('0x9')]('/describe',auth[_0x8b9b('0xa')](),controller[_0x8b9b('0xb')]);router[_0x8b9b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8b9b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8b9b('0xd')]('/:id',auth[_0x8b9b('0xa')](),controller['update']);router['delete'](_0x8b9b('0xe'),auth[_0x8b9b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc171=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','put','update','delete','path','connect-timeout','express','Router'];(function(_0x48ee98,_0x7ea2a6){var _0x2ace70=function(_0x5ae7eb){while(--_0x5ae7eb){_0x48ee98['push'](_0x48ee98['shift']());}};_0x2ace70(++_0x7ea2a6);}(_0xc171,0x6c));var _0x1c17=function(_0x2f7ee1,_0x238541){_0x2f7ee1=_0x2f7ee1-0x0;var _0x298295=_0xc171[_0x2f7ee1];return _0x298295;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c17('0x0'));var timeout=require(_0x1c17('0x1'));var express=require(_0x1c17('0x2'));var router=express[_0x1c17('0x3')]();var auth=require(_0x1c17('0x4'));var interaction=require(_0x1c17('0x5'));var config=require(_0x1c17('0x6'));var controller=require('./integrationReport.controller');router[_0x1c17('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c17('0x7')](_0x1c17('0x8'),auth[_0x1c17('0x9')](),controller[_0x1c17('0xa')]);router[_0x1c17('0x7')](_0x1c17('0xb'),auth[_0x1c17('0x9')](),controller['show']);router[_0x1c17('0xc')]('/',auth[_0x1c17('0x9')](),controller['create']);router[_0x1c17('0xd')](_0x1c17('0xb'),auth[_0x1c17('0x9')](),controller[_0x1c17('0xe')]);router[_0x1c17('0xf')]('/:id',auth[_0x1c17('0x9')](),controller['destroy']);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 fa63011..48ff569 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 _0x4092=['TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x13906f,_0x4cc1a2){var _0x4880ff=function(_0x532cfa){while(--_0x532cfa){_0x13906f['push'](_0x13906f['shift']());}};_0x4880ff(++_0x4cc1a2);}(_0x4092,0x139));var _0x2409=function(_0x5eeb0b,_0x293c14){_0x5eeb0b=_0x5eeb0b-0x0;var _0x270295=_0x4092[_0x5eeb0b];return _0x270295;};'use strict';var Sequelize=require(_0x2409('0x0'));module[_0x2409('0x1')]={'integration':{'type':Sequelize[_0x2409('0x2')]},'eventChannel':{'type':Sequelize[_0x2409('0x2')]},'exitStatus':{'type':Sequelize[_0x2409('0x2')]},'ticketId':{'type':Sequelize[_0x2409('0x2')]},'integrationId':{'type':Sequelize[_0x2409('0x3')]},'contacts':{'type':Sequelize[_0x2409('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2409('0x2')]},'membername':{'type':Sequelize[_0x2409('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2409('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2409('0x3')]},'agentcomplete':{'type':Sequelize[_0x2409('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2409('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2409('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2409('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x2409('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2409('0x4')]},'agentdump':{'type':Sequelize[_0x2409('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2409('0x4')]},'lastevent':{'type':Sequelize[_0x2409('0x2')]},'channel':{'type':Sequelize[_0x2409('0x2')]},'channelstate':{'type':Sequelize[_0x2409('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2409('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2409('0x2')]},'context':{'type':Sequelize[_0x2409('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2409('0x2')]},'destchannel':{'type':Sequelize[_0x2409('0x2')]},'destchannelstate':{'type':Sequelize[_0x2409('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2409('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2409('0x2')]},'destcalleridname':{'type':Sequelize[_0x2409('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2409('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2409('0x2')]},'destlanguage':{'type':Sequelize[_0x2409('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2409('0x2')]},'destexten':{'type':Sequelize[_0x2409('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x2409('0x2')]},'inReplyTo':{'type':Sequelize[_0x2409('0x2')]},'subject':{'type':Sequelize[_0x2409('0x2')]},'from':{'type':Sequelize[_0x2409('0x2')]},'to':{'type':Sequelize[_0x2409('0x2')]},'cc':{'type':Sequelize[_0x2409('0x2')]},'attachment':{'type':Sequelize[_0x2409('0x6')]},'html':{'type':Sequelize[_0x2409('0x6')]},'text':{'type':Sequelize[_0x2409('0x6')]},'status':{'type':Sequelize[_0x2409('0x7')]('SENT',_0x2409('0x8'),_0x2409('0x9'),_0x2409('0xa'))},'url':{'type':Sequelize[_0x2409('0x2')]},'app':{'type':Sequelize[_0x2409('0x2')]},'appdata':{'type':Sequelize[_0x2409('0x2')]},'projectId':{'type':Sequelize[_0x2409('0x3')]}}; \ No newline at end of file +var _0x859e=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x859e,0xde));var _0xe859=function(_0x54e838,_0x352721){_0x54e838=_0x54e838-0x0;var _0xa71aeb=_0x859e[_0x54e838];return _0xa71aeb;};'use strict';var Sequelize=require(_0xe859('0x0'));module[_0xe859('0x1')]={'integration':{'type':Sequelize[_0xe859('0x2')]},'eventChannel':{'type':Sequelize[_0xe859('0x2')]},'exitStatus':{'type':Sequelize[_0xe859('0x2')]},'ticketId':{'type':Sequelize[_0xe859('0x2')]},'integrationId':{'type':Sequelize[_0xe859('0x3')]},'contacts':{'type':Sequelize[_0xe859('0x2')]},'uniqueid':{'type':Sequelize[_0xe859('0x2')]},'calleridnum':{'type':Sequelize[_0xe859('0x2')]},'calleridname':{'type':Sequelize[_0xe859('0x2')]},'queue':{'type':Sequelize[_0xe859('0x2')]},'interface':{'type':Sequelize[_0xe859('0x2')]},'membername':{'type':Sequelize[_0xe859('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe859('0x4')]},'agentconnectAt':{'type':Sequelize[_0xe859('0x4')]},'holdtime':{'type':Sequelize[_0xe859('0x3')]},'agentcomplete':{'type':Sequelize[_0xe859('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xe859('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xe859('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe859('0x4')]},'agentdump':{'type':Sequelize[_0xe859('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe859('0x2')]},'channelstate':{'type':Sequelize[_0xe859('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe859('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe859('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe859('0x2')]},'accountcode':{'type':Sequelize[_0xe859('0x2')]},'context':{'type':Sequelize[_0xe859('0x2')]},'exten':{'type':Sequelize[_0xe859('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xe859('0x2')]},'destchannelstate':{'type':Sequelize[_0xe859('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe859('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe859('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe859('0x2')]},'destlanguage':{'type':Sequelize[_0xe859('0x2')]},'destaccountcode':{'type':Sequelize[_0xe859('0x2')]},'destcontext':{'type':Sequelize[_0xe859('0x2')]},'destexten':{'type':Sequelize[_0xe859('0x2')]},'destpriority':{'type':Sequelize[_0xe859('0x2')]},'destuniqueid':{'type':Sequelize[_0xe859('0x2')]},'messageId':{'type':Sequelize[_0xe859('0x2')]},'inReplyTo':{'type':Sequelize[_0xe859('0x2')]},'subject':{'type':Sequelize[_0xe859('0x2')]},'from':{'type':Sequelize[_0xe859('0x2')]},'to':{'type':Sequelize[_0xe859('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xe859('0x6')]},'html':{'type':Sequelize[_0xe859('0x6')]},'text':{'type':Sequelize[_0xe859('0x6')]},'status':{'type':Sequelize['ENUM'](_0xe859('0x7'),_0xe859('0x8'),_0xe859('0x9'),_0xe859('0xa'))},'url':{'type':Sequelize[_0xe859('0x2')]},'app':{'type':Sequelize[_0xe859('0x2')]},'appdata':{'type':Sequelize[_0xe859('0x2')]},'projectId':{'type':Sequelize[_0xe859('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index be2315d..87d806d 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 _0x2477=['findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','IntegrationReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include'];(function(_0x2a15be,_0x1d0913){var _0x2b5e1d=function(_0x349ffc){while(--_0x349ffc){_0x2a15be['push'](_0x2a15be['shift']());}};_0x2b5e1d(++_0x1d0913);}(_0x2477,0x1ba));var _0x7247=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x2477[_0x173441];return _0x2423a8;};'use strict';var pdf=require(_0x7247('0x0'));var emlformat=require(_0x7247('0x1'));var rimraf=require(_0x7247('0x2'));var zipdir=require(_0x7247('0x3'));var jsonpatch=require(_0x7247('0x4'));var rp=require(_0x7247('0x5'));var moment=require(_0x7247('0x6'));var BPromise=require(_0x7247('0x7'));var Mustache=require(_0x7247('0x8'));var util=require(_0x7247('0x9'));var path=require(_0x7247('0xa'));var sox=require(_0x7247('0xb'));var csv=require(_0x7247('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7247('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7247('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7247('0xc'));var querystring=require('querystring');var Papa=require(_0x7247('0xf'));var Redis=require('ioredis');var authService=require(_0x7247('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7247('0x11'));var logger=require('../../config/logger')(_0x7247('0x12'));var utils=require(_0x7247('0x13'));var config=require(_0x7247('0x14'));var licenseUtil=require(_0x7247('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9340,_0x4b4e0a){_0x4b4e0a=_0x4b4e0a||0xcc;return function(_0x3a2635){if(_0x3a2635){return _0x5e9340['sendStatus'](_0x4b4e0a);}return _0x5e9340['status'](_0x4b4e0a)[_0x7247('0x16')]();};}function respondWithResult(_0x2076f2,_0x411426){_0x411426=_0x411426||0xc8;return function(_0x132686){if(_0x132686){return _0x2076f2[_0x7247('0x17')](_0x411426)[_0x7247('0x18')](_0x132686);}};}function respondWithFilteredResult(_0x3f170d,_0x45fa00){return function(_0x5abc81){if(_0x5abc81){var _0x29e51f=_0x5abc81[_0x7247('0x19')],_0x1ddad2=_0x45fa00['offset'],_0x204412=_0x45fa00[_0x7247('0x1a')]+_0x45fa00[_0x7247('0x1b')],_0x30941a;if(_0x204412>=_0x29e51f){_0x204412=_0x29e51f;_0x30941a=0xc8;}else{_0x30941a=0xce;}_0x3f170d['status'](_0x30941a);return _0x3f170d[_0x7247('0x1c')]('Content-Range',_0x1ddad2+'-'+_0x204412+'/'+_0x29e51f)[_0x7247('0x18')](_0x5abc81);}return null;};}function patchUpdates(_0x451769){return function(_0x4bef62){try{jsonpatch[_0x7247('0x1d')](_0x4bef62,_0x451769,!![]);}catch(_0x4f7b28){return BPromise[_0x7247('0x1e')](_0x4f7b28);}return _0x4bef62[_0x7247('0x1f')]();};}function saveUpdates(_0x5eef7f,_0x3de0b6){return function(_0x3a47ac){if(_0x3a47ac){return _0x3a47ac[_0x7247('0x20')](_0x5eef7f)['then'](function(_0x2393c2){return _0x2393c2;});}return null;};}function removeEntity(_0x52cb15,_0x77fd1f){return function(_0x5eab0b){if(_0x5eab0b){return _0x5eab0b[_0x7247('0x21')]()[_0x7247('0x22')](function(){_0x52cb15[_0x7247('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a49b,_0x16cec5){return function(_0x2c5ad5){if(!_0x2c5ad5){_0x14a49b[_0x7247('0x23')](0x194);}return _0x2c5ad5;};}function handleError(_0x523e75,_0x52d7d0){_0x52d7d0=_0x52d7d0||0x1f4;return function(_0x36faf8){logger[_0x7247('0x24')](_0x36faf8['stack']);if(_0x36faf8[_0x7247('0x25')]){delete _0x36faf8['name'];}_0x523e75[_0x7247('0x17')](_0x52d7d0)[_0x7247('0x26')](_0x36faf8);};}exports[_0x7247('0x27')]=function(_0x4d8e5c,_0x2190a2){var _0x36dc2c={},_0x143401={},_0x59e90d={'count':0x0,'rows':[]};var _0x4b3d1a=_['map'](db[_0x7247('0x28')]['rawAttributes'],function(_0xd67366){return{'name':_0xd67366['fieldName'],'type':_0xd67366[_0x7247('0x29')][_0x7247('0x2a')]};});_0x143401[_0x7247('0x2b')]=_['map'](_0x4b3d1a,'name');_0x143401[_0x7247('0x2c')]=_[_0x7247('0x2d')](_0x4d8e5c[_0x7247('0x2c')]);_0x143401['filters']=_[_0x7247('0x2e')](_0x143401[_0x7247('0x2b')],_0x143401[_0x7247('0x2c')]);_0x36dc2c[_0x7247('0x2f')]=_[_0x7247('0x2e')](_0x143401[_0x7247('0x2b')],qs[_0x7247('0x30')](_0x4d8e5c[_0x7247('0x2c')]['fields']));_0x36dc2c[_0x7247('0x2f')]=_0x36dc2c[_0x7247('0x2f')][_0x7247('0x31')]?_0x36dc2c[_0x7247('0x2f')]:_0x143401[_0x7247('0x2b')];if(!_0x4d8e5c['query'][_0x7247('0x32')](_0x7247('0x33'))){_0x36dc2c[_0x7247('0x1b')]=qs['limit'](_0x4d8e5c['query'][_0x7247('0x1b')]);_0x36dc2c[_0x7247('0x1a')]=qs['offset'](_0x4d8e5c[_0x7247('0x2c')][_0x7247('0x1a')]);}_0x36dc2c[_0x7247('0x34')]=qs[_0x7247('0x35')](_0x4d8e5c['query'][_0x7247('0x35')]);_0x36dc2c['where']=qs[_0x7247('0x36')](_['pick'](_0x4d8e5c[_0x7247('0x2c')],_0x143401[_0x7247('0x36')]),_0x4b3d1a);if(_0x4d8e5c[_0x7247('0x2c')][_0x7247('0x37')]){_0x36dc2c['where']=_[_0x7247('0x38')](_0x36dc2c[_0x7247('0x39')],{'$or':_['map'](_0x4b3d1a,function(_0x452d5a){if(_0x452d5a[_0x7247('0x29')]!==_0x7247('0x3a')){var _0x4cc98c={};_0x4cc98c[_0x452d5a['name']]={'$like':'%'+_0x4d8e5c[_0x7247('0x2c')][_0x7247('0x37')]+'%'};return _0x4cc98c;}})});}_0x36dc2c=_['merge']({},_0x36dc2c,_0x4d8e5c[_0x7247('0x3b')]);var _0x21b95b={'where':_0x36dc2c[_0x7247('0x39')]};return db[_0x7247('0x28')][_0x7247('0x19')](_0x21b95b)[_0x7247('0x22')](function(_0x4560ff){_0x59e90d[_0x7247('0x19')]=_0x4560ff;if(_0x4d8e5c[_0x7247('0x2c')][_0x7247('0x3c')]){_0x36dc2c[_0x7247('0x3d')]=[{'all':!![]}];}return db[_0x7247('0x28')][_0x7247('0x3e')](_0x36dc2c);})[_0x7247('0x22')](function(_0x406ad9){_0x59e90d[_0x7247('0x3f')]=_0x406ad9;return _0x59e90d;})['then'](respondWithFilteredResult(_0x2190a2,_0x36dc2c))[_0x7247('0x40')](handleError(_0x2190a2,null));};exports[_0x7247('0x41')]=function(_0x1f20c1,_0x2466bf){var _0x8c6fa={'raw':![],'where':{'id':_0x1f20c1[_0x7247('0x42')]['id']}},_0x38da54={};_0x38da54[_0x7247('0x2b')]=_[_0x7247('0x2d')](db[_0x7247('0x28')][_0x7247('0x43')]);_0x38da54['query']=_[_0x7247('0x2d')](_0x1f20c1[_0x7247('0x2c')]);_0x38da54['filters']=_[_0x7247('0x2e')](_0x38da54[_0x7247('0x2b')],_0x38da54[_0x7247('0x2c')]);_0x8c6fa['attributes']=_[_0x7247('0x2e')](_0x38da54[_0x7247('0x2b')],qs['fields'](_0x1f20c1[_0x7247('0x2c')][_0x7247('0x30')]));_0x8c6fa[_0x7247('0x2f')]=_0x8c6fa[_0x7247('0x2f')]['length']?_0x8c6fa['attributes']:_0x38da54['model'];if(_0x1f20c1[_0x7247('0x2c')]['includeAll']){_0x8c6fa[_0x7247('0x3d')]=[{'all':!![]}];}_0x8c6fa=_['merge']({},_0x8c6fa,_0x1f20c1[_0x7247('0x3b')]);return db[_0x7247('0x28')]['find'](_0x8c6fa)[_0x7247('0x22')](handleEntityNotFound(_0x2466bf,null))[_0x7247('0x22')](respondWithResult(_0x2466bf,null))[_0x7247('0x40')](handleError(_0x2466bf,null));};exports[_0x7247('0x44')]=function(_0x118736,_0x3a958b){return db[_0x7247('0x28')][_0x7247('0x44')](_0x118736[_0x7247('0x45')],{})['then'](respondWithResult(_0x3a958b,0xc9))[_0x7247('0x40')](handleError(_0x3a958b,null));};exports[_0x7247('0x20')]=function(_0x49283b,_0x1fd20f){if(_0x49283b['body']['id']){delete _0x49283b[_0x7247('0x45')]['id'];}return db[_0x7247('0x28')][_0x7247('0x46')]({'where':{'id':_0x49283b[_0x7247('0x42')]['id']}})[_0x7247('0x22')](handleEntityNotFound(_0x1fd20f,null))[_0x7247('0x22')](saveUpdates(_0x49283b[_0x7247('0x45')],null))['then'](respondWithResult(_0x1fd20f,null))[_0x7247('0x40')](handleError(_0x1fd20f,null));};exports[_0x7247('0x21')]=function(_0x364550,_0x29b0c6){return db[_0x7247('0x28')]['find']({'where':{'id':_0x364550[_0x7247('0x42')]['id']}})[_0x7247('0x22')](handleEntityNotFound(_0x29b0c6,null))['then'](removeEntity(_0x29b0c6,null))[_0x7247('0x40')](handleError(_0x29b0c6,null));};exports[_0x7247('0x47')]=function(_0x280e41,_0x2ee976){return db[_0x7247('0x28')]['describe']()[_0x7247('0x22')](respondWithResult(_0x2ee976,null))['catch'](handleError(_0x2ee976,null));}; \ No newline at end of file +var _0x4032=['find','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','show','params','catch','body'];(function(_0xedb81,_0x787c00){var _0x1a388c=function(_0x194889){while(--_0x194889){_0xedb81['push'](_0xedb81['shift']());}};_0x1a388c(++_0x787c00);}(_0x4032,0x116));var _0x2403=function(_0x428e54,_0xab3044){_0x428e54=_0x428e54-0x0;var _0x1e484b=_0x4032[_0x428e54];return _0x1e484b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2403('0x0'));var rimraf=require(_0x2403('0x1'));var zipdir=require(_0x2403('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2403('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2403('0x4'));var util=require(_0x2403('0x5'));var path=require(_0x2403('0x6'));var sox=require(_0x2403('0x7'));var csv=require(_0x2403('0x8'));var ejs=require(_0x2403('0x9'));var fs=require('fs');var _=require(_0x2403('0xa'));var squel=require(_0x2403('0xb'));var crypto=require('crypto');var jsforce=require(_0x2403('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2403('0x8'));var querystring=require(_0x2403('0xd'));var Papa=require('papaparse');var Redis=require(_0x2403('0xe'));var authService=require(_0x2403('0xf'));var qs=require(_0x2403('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2403('0x11'))(_0x2403('0x12'));var utils=require(_0x2403('0x13'));var config=require(_0x2403('0x14'));var licenseUtil=require(_0x2403('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec708,_0x22e8bb){_0x22e8bb=_0x22e8bb||0xcc;return function(_0xfb570f){if(_0xfb570f){return _0x3ec708[_0x2403('0x16')](_0x22e8bb);}return _0x3ec708[_0x2403('0x17')](_0x22e8bb)[_0x2403('0x18')]();};}function respondWithResult(_0x4234d7,_0x37d747){_0x37d747=_0x37d747||0xc8;return function(_0x444d1c){if(_0x444d1c){return _0x4234d7[_0x2403('0x17')](_0x37d747)['json'](_0x444d1c);}};}function respondWithFilteredResult(_0x44684f,_0x50f79a){return function(_0x4d55e3){if(_0x4d55e3){var _0x3d3338=_0x4d55e3['count'],_0x5d7b1a=_0x50f79a['offset'],_0x54f5ce=_0x50f79a[_0x2403('0x19')]+_0x50f79a[_0x2403('0x1a')],_0x2d4207;if(_0x54f5ce>=_0x3d3338){_0x54f5ce=_0x3d3338;_0x2d4207=0xc8;}else{_0x2d4207=0xce;}_0x44684f[_0x2403('0x17')](_0x2d4207);return _0x44684f['set'](_0x2403('0x1b'),_0x5d7b1a+'-'+_0x54f5ce+'/'+_0x3d3338)[_0x2403('0x1c')](_0x4d55e3);}return null;};}function patchUpdates(_0x4363f6){return function(_0x49641d){try{jsonpatch[_0x2403('0x1d')](_0x49641d,_0x4363f6,!![]);}catch(_0x5cff9d){return BPromise[_0x2403('0x1e')](_0x5cff9d);}return _0x49641d['save']();};}function saveUpdates(_0x86e643,_0x1b4213){return function(_0x2c4c27){if(_0x2c4c27){return _0x2c4c27[_0x2403('0x1f')](_0x86e643)[_0x2403('0x20')](function(_0x5a1d0f){return _0x5a1d0f;});}return null;};}function removeEntity(_0x468094,_0x46dec6){return function(_0x30b87b){if(_0x30b87b){return _0x30b87b['destroy']()['then'](function(){_0x468094[_0x2403('0x17')](0xcc)[_0x2403('0x18')]();});}};}function handleEntityNotFound(_0x27af72,_0x143766){return function(_0x436cd1){if(!_0x436cd1){_0x27af72['sendStatus'](0x194);}return _0x436cd1;};}function handleError(_0x4ca026,_0x23124c){_0x23124c=_0x23124c||0x1f4;return function(_0x4301bb){logger[_0x2403('0x21')](_0x4301bb[_0x2403('0x22')]);if(_0x4301bb[_0x2403('0x23')]){delete _0x4301bb[_0x2403('0x23')];}_0x4ca026[_0x2403('0x17')](_0x23124c)[_0x2403('0x24')](_0x4301bb);};}exports[_0x2403('0x25')]=function(_0x1c27d2,_0x62762f){var _0x5bf9a9={},_0x3adc9a={},_0x2fc97f={'count':0x0,'rows':[]};var _0x4c9e95=_[_0x2403('0x26')](db[_0x2403('0x27')][_0x2403('0x28')],function(_0x141f37){return{'name':_0x141f37['fieldName'],'type':_0x141f37[_0x2403('0x29')]['key']};});_0x3adc9a[_0x2403('0x2a')]=_[_0x2403('0x26')](_0x4c9e95,_0x2403('0x23'));_0x3adc9a[_0x2403('0x2b')]=_[_0x2403('0x2c')](_0x1c27d2[_0x2403('0x2b')]);_0x3adc9a[_0x2403('0x2d')]=_[_0x2403('0x2e')](_0x3adc9a[_0x2403('0x2a')],_0x3adc9a[_0x2403('0x2b')]);_0x5bf9a9[_0x2403('0x2f')]=_[_0x2403('0x2e')](_0x3adc9a[_0x2403('0x2a')],qs[_0x2403('0x30')](_0x1c27d2[_0x2403('0x2b')][_0x2403('0x30')]));_0x5bf9a9[_0x2403('0x2f')]=_0x5bf9a9[_0x2403('0x2f')][_0x2403('0x31')]?_0x5bf9a9[_0x2403('0x2f')]:_0x3adc9a[_0x2403('0x2a')];if(!_0x1c27d2[_0x2403('0x2b')][_0x2403('0x32')](_0x2403('0x33'))){_0x5bf9a9[_0x2403('0x1a')]=qs[_0x2403('0x1a')](_0x1c27d2[_0x2403('0x2b')][_0x2403('0x1a')]);_0x5bf9a9['offset']=qs[_0x2403('0x19')](_0x1c27d2[_0x2403('0x2b')][_0x2403('0x19')]);}_0x5bf9a9['order']=qs[_0x2403('0x34')](_0x1c27d2[_0x2403('0x2b')]['sort']);_0x5bf9a9['where']=qs[_0x2403('0x2d')](_[_0x2403('0x35')](_0x1c27d2['query'],_0x3adc9a[_0x2403('0x2d')]),_0x4c9e95);if(_0x1c27d2[_0x2403('0x2b')][_0x2403('0x36')]){_0x5bf9a9[_0x2403('0x37')]=_[_0x2403('0x38')](_0x5bf9a9['where'],{'$or':_[_0x2403('0x26')](_0x4c9e95,function(_0x4222ec){if(_0x4222ec[_0x2403('0x29')]!=='VIRTUAL'){var _0x3422e0={};_0x3422e0[_0x4222ec[_0x2403('0x23')]]={'$like':'%'+_0x1c27d2[_0x2403('0x2b')][_0x2403('0x36')]+'%'};return _0x3422e0;}})});}_0x5bf9a9=_['merge']({},_0x5bf9a9,_0x1c27d2[_0x2403('0x39')]);var _0x10aaef={'where':_0x5bf9a9['where']};return db['IntegrationReport'][_0x2403('0x3a')](_0x10aaef)['then'](function(_0x381da6){_0x2fc97f['count']=_0x381da6;if(_0x1c27d2['query'][_0x2403('0x3b')]){_0x5bf9a9[_0x2403('0x3c')]=[{'all':!![]}];}return db[_0x2403('0x27')][_0x2403('0x3d')](_0x5bf9a9);})[_0x2403('0x20')](function(_0x2db597){_0x2fc97f[_0x2403('0x3e')]=_0x2db597;return _0x2fc97f;})[_0x2403('0x20')](respondWithFilteredResult(_0x62762f,_0x5bf9a9))['catch'](handleError(_0x62762f,null));};exports[_0x2403('0x3f')]=function(_0x1fd6e2,_0x54a220){var _0x24dad8={'raw':![],'where':{'id':_0x1fd6e2[_0x2403('0x40')]['id']}},_0x45fb2b={};_0x45fb2b[_0x2403('0x2a')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x45fb2b[_0x2403('0x2b')]=_[_0x2403('0x2c')](_0x1fd6e2['query']);_0x45fb2b['filters']=_[_0x2403('0x2e')](_0x45fb2b[_0x2403('0x2a')],_0x45fb2b[_0x2403('0x2b')]);_0x24dad8[_0x2403('0x2f')]=_[_0x2403('0x2e')](_0x45fb2b[_0x2403('0x2a')],qs[_0x2403('0x30')](_0x1fd6e2[_0x2403('0x2b')]['fields']));_0x24dad8[_0x2403('0x2f')]=_0x24dad8[_0x2403('0x2f')][_0x2403('0x31')]?_0x24dad8[_0x2403('0x2f')]:_0x45fb2b['model'];if(_0x1fd6e2[_0x2403('0x2b')][_0x2403('0x3b')]){_0x24dad8['include']=[{'all':!![]}];}_0x24dad8=_[_0x2403('0x38')]({},_0x24dad8,_0x1fd6e2[_0x2403('0x39')]);return db[_0x2403('0x27')]['find'](_0x24dad8)['then'](handleEntityNotFound(_0x54a220,null))['then'](respondWithResult(_0x54a220,null))[_0x2403('0x41')](handleError(_0x54a220,null));};exports['create']=function(_0x21feb8,_0x2e7e6e){return db[_0x2403('0x27')]['create'](_0x21feb8[_0x2403('0x42')],{})[_0x2403('0x20')](respondWithResult(_0x2e7e6e,0xc9))[_0x2403('0x41')](handleError(_0x2e7e6e,null));};exports[_0x2403('0x1f')]=function(_0x378a6b,_0x1d5013){if(_0x378a6b[_0x2403('0x42')]['id']){delete _0x378a6b[_0x2403('0x42')]['id'];}return db[_0x2403('0x27')][_0x2403('0x43')]({'where':{'id':_0x378a6b[_0x2403('0x40')]['id']}})[_0x2403('0x20')](handleEntityNotFound(_0x1d5013,null))['then'](saveUpdates(_0x378a6b[_0x2403('0x42')],null))[_0x2403('0x20')](respondWithResult(_0x1d5013,null))[_0x2403('0x41')](handleError(_0x1d5013,null));};exports['destroy']=function(_0x1f70e2,_0x575da0){return db[_0x2403('0x27')][_0x2403('0x43')]({'where':{'id':_0x1f70e2[_0x2403('0x40')]['id']}})['then'](handleEntityNotFound(_0x575da0,null))[_0x2403('0x20')](removeEntity(_0x575da0,null))[_0x2403('0x41')](handleError(_0x575da0,null));};exports['describe']=function(_0x53e66e,_0x1db7b7){return db['IntegrationReport'][_0x2403('0x44')]()['then'](respondWithResult(_0x1db7b7,null))['catch'](handleError(_0x1db7b7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index db8f9b6..c76604b 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 _0x8a57=['define','IntegrationReport','report_integration','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x8a57,0x183));var _0x78a5=function(_0xbcae42,_0x22bb90){_0xbcae42=_0xbcae42-0x0;var _0x2fba2f=_0x8a57[_0xbcae42];return _0x2fba2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x78a5('0x0'))(_0x78a5('0x1'));var moment=require(_0x78a5('0x2'));var BPromise=require(_0x78a5('0x3'));var rp=require(_0x78a5('0x4'));var fs=require('fs');var path=require(_0x78a5('0x5'));var rimraf=require(_0x78a5('0x6'));var config=require(_0x78a5('0x7'));var attributes=require('./integrationReport.attributes');module[_0x78a5('0x8')]=function(_0x2c9026,_0x226f6a){return _0x2c9026[_0x78a5('0x9')](_0x78a5('0xa'),attributes,{'tableName':_0x78a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x494b=['request-promise','rimraf','../../config/environment','exports','define','report_integration','lodash','util','api','moment','bluebird'];(function(_0x292a97,_0x49fb87){var _0x36aa25=function(_0x3f3f05){while(--_0x3f3f05){_0x292a97['push'](_0x292a97['shift']());}};_0x36aa25(++_0x49fb87);}(_0x494b,0x74));var _0xb494=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x494b[_0x309a5e];return _0x1d21f1;};'use strict';var _=require(_0xb494('0x0'));var util=require(_0xb494('0x1'));var logger=require('../../config/logger')(_0xb494('0x2'));var moment=require(_0xb494('0x3'));var BPromise=require(_0xb494('0x4'));var rp=require(_0xb494('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb494('0x6'));var config=require(_0xb494('0x7'));var attributes=require('./integrationReport.attributes');module[_0xb494('0x8')]=function(_0xa7f7af,_0xd82d74){return _0xa7f7af[_0xb494('0x9')]('IntegrationReport',attributes,{'tableName':_0xb494('0xa'),'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 3bc70dc..22cc950 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x599991,_0x46bc64){var _0x170097=function(_0x42e190){while(--_0x42e190){_0x599991['push'](_0x599991['shift']());}};_0x170097(++_0x46bc64);}(_0x2032,0xd9));var _0x2203=function(_0x148805,_0x801915){_0x148805=_0x148805-0x0;var _0x33c861=_0x2032[_0x148805];return _0x33c861;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x5eb8=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4ee45e,_0x23f3c3){var _0x42267=function(_0x581822){while(--_0x581822){_0x4ee45e['push'](_0x4ee45e['shift']());}};_0x42267(++_0x23f3c3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2b338b,_0x4a06ba){_0x2b338b=_0x2b338b-0x0;var _0x256f66=_0x5eb8[_0x2b338b];return _0x256f66;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4b3f715..967f51d 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(_0xfbeb61,_0x30d181){var _0x37c4fe=function(_0x4a706){while(--_0x4a706){_0xfbeb61['push'](_0xfbeb61['shift']());}};_0x37c4fe(++_0x30d181);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x59d174,_0x76024b){var _0x562b49=function(_0x4b35ac){while(--_0x4b35ac){_0x59d174['push'](_0x59d174['shift']());}};_0x562b49(++_0x76024b);}(_0x008c,0x188));var _0xc008=function(_0x1de3a0,_0x17593c){_0x1de3a0=_0x1de3a0-0x0;var _0x396141=_0x008c[_0x1de3a0];return _0x396141;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b119643..7068280 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 _0xcbde=['exports','STRING'];(function(_0x3b3bef,_0x56685f){var _0x5b9fdb=function(_0x13e867){while(--_0x13e867){_0x3b3bef['push'](_0x3b3bef['shift']());}};_0x5b9fdb(++_0x56685f);}(_0xcbde,0xb0));var _0xecbd=function(_0x443dde,_0x49b2ae){_0x443dde=_0x443dde-0x0;var _0x284883=_0xcbde[_0x443dde];return _0x284883;};'use strict';var Sequelize=require('sequelize');module[_0xecbd('0x0')]={'name':{'type':Sequelize[_0xecbd('0x1')]},'description':{'type':Sequelize[_0xecbd('0x1')]},'interval':{'type':Sequelize[_0xecbd('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x37e9=['sequelize','exports','STRING'];(function(_0x3d20d1,_0x5bdb8a){var _0x4d28a0=function(_0x12a5d0){while(--_0x12a5d0){_0x3d20d1['push'](_0x3d20d1['shift']());}};_0x4d28a0(++_0x5bdb8a);}(_0x37e9,0x14d));var _0x937e=function(_0xa0b649,_0x394b56){_0xa0b649=_0xa0b649-0x0;var _0x589160=_0x37e9[_0xa0b649];return _0x589160;};'use strict';var Sequelize=require(_0x937e('0x0'));module[_0x937e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x937e('0x2')]},'interval':{'type':Sequelize[_0x937e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c4257b5..32e595a 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 _0xac5a=['filter','merge','options','includeAll','include','findAll','rows','catch','show','fields','length','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','hasOwnProperty','nolimit','addIntervals','findOne','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','order','sort','where','filters','pick'];(function(_0x418f42,_0xd0e4da){var _0x30801b=function(_0x4e9583){while(--_0x4e9583){_0x418f42['push'](_0x418f42['shift']());}};_0x30801b(++_0xd0e4da);}(_0xac5a,0x1ef));var _0xaac5=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0xac5a[_0x57a50d];return _0x1b25b3;};'use strict';var pdf=require(_0xaac5('0x0'));var emlformat=require(_0xaac5('0x1'));var rimraf=require(_0xaac5('0x2'));var zipdir=require(_0xaac5('0x3'));var jsonpatch=require(_0xaac5('0x4'));var rp=require(_0xaac5('0x5'));var moment=require(_0xaac5('0x6'));var BPromise=require(_0xaac5('0x7'));var Mustache=require(_0xaac5('0x8'));var util=require(_0xaac5('0x9'));var path=require(_0xaac5('0xa'));var sox=require('sox');var csv=require(_0xaac5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaac5('0xc'));var squel=require(_0xaac5('0xd'));var crypto=require(_0xaac5('0xe'));var jsforce=require(_0xaac5('0xf'));var deskjs=require(_0xaac5('0x10'));var toCsv=require(_0xaac5('0xb'));var querystring=require(_0xaac5('0x11'));var Papa=require(_0xaac5('0x12'));var Redis=require(_0xaac5('0x13'));var authService=require(_0xaac5('0x14'));var qs=require(_0xaac5('0x15'));var as=require(_0xaac5('0x16'));var hardwareService=require(_0xaac5('0x17'));var logger=require('../../config/logger')(_0xaac5('0x18'));var utils=require(_0xaac5('0x19'));var config=require(_0xaac5('0x1a'));var licenseUtil=require(_0xaac5('0x1b'));var db=require(_0xaac5('0x1c'))['db'];var extensions=require(_0xaac5('0x1d'));function respondWithStatusCode(_0x1fb0ad,_0x26cc2c){_0x26cc2c=_0x26cc2c||0xcc;return function(_0x2052db){if(_0x2052db){return _0x1fb0ad[_0xaac5('0x1e')](_0x26cc2c);}return _0x1fb0ad[_0xaac5('0x1f')](_0x26cc2c)[_0xaac5('0x20')]();};}function respondWithResult(_0x341edb,_0x51c89f){_0x51c89f=_0x51c89f||0xc8;return function(_0x264f9a){if(_0x264f9a){return _0x341edb[_0xaac5('0x1f')](_0x51c89f)[_0xaac5('0x21')](_0x264f9a);}};}function respondWithFilteredResult(_0x47a79a,_0x4df829){return function(_0x3a3dc1){if(_0x3a3dc1){var _0x3a5f24=_0x3a3dc1[_0xaac5('0x22')],_0x341f15=_0x4df829['offset'],_0x400f36=_0x4df829[_0xaac5('0x23')]+_0x4df829[_0xaac5('0x24')],_0x444f68;if(_0x400f36>=_0x3a5f24){_0x400f36=_0x3a5f24;_0x444f68=0xc8;}else{_0x444f68=0xce;}_0x47a79a[_0xaac5('0x1f')](_0x444f68);return _0x47a79a['set'](_0xaac5('0x25'),_0x341f15+'-'+_0x400f36+'/'+_0x3a5f24)[_0xaac5('0x21')](_0x3a3dc1);}return null;};}function patchUpdates(_0x15cdd8){return function(_0x3e18f7){try{jsonpatch['apply'](_0x3e18f7,_0x15cdd8,!![]);}catch(_0x2b146e){return BPromise[_0xaac5('0x26')](_0x2b146e);}return _0x3e18f7[_0xaac5('0x27')]();};}function saveUpdates(_0x36a1ca,_0x511dbe){return function(_0x2fad6b){if(_0x2fad6b){return _0x2fad6b[_0xaac5('0x28')](_0x36a1ca)['then'](function(_0x1551e0){return _0x1551e0;});}return null;};}function removeEntity(_0x20900b,_0x5244cf){return function(_0x22451c){if(_0x22451c){return _0x22451c[_0xaac5('0x29')]()[_0xaac5('0x2a')](function(){var _0x1ba02a=_0x22451c['get']({'plain':!![]});var _0x1deb6a=_0xaac5('0x2b');return db[_0xaac5('0x2c')][_0xaac5('0x29')]({'where':{'type':_0x1deb6a,'resourceId':_0x1ba02a['id']}})['then'](function(){return _0x22451c;});})[_0xaac5('0x2a')](function(){_0x20900b[_0xaac5('0x1f')](0xcc)[_0xaac5('0x20')]();});}};}function handleEntityNotFound(_0xda63ad,_0x179912){return function(_0x3fe904){if(!_0x3fe904){_0xda63ad['sendStatus'](0x194);}return _0x3fe904;};}function handleError(_0x4c672f,_0x1148a0){_0x1148a0=_0x1148a0||0x1f4;return function(_0x159f4b){logger['error'](_0x159f4b[_0xaac5('0x2d')]);if(_0x159f4b[_0xaac5('0x2e')]){delete _0x159f4b[_0xaac5('0x2e')];}_0x4c672f[_0xaac5('0x1f')](_0x1148a0)[_0xaac5('0x2f')](_0x159f4b);};}exports['index']=function(_0x30a91c,_0xd94384){var _0x2aade1={},_0x26983e={},_0x8e1526={'count':0x0,'rows':[]};var _0x1a4706=_[_0xaac5('0x30')](db[_0xaac5('0x31')][_0xaac5('0x32')],function(_0x5a70c1){return{'name':_0x5a70c1[_0xaac5('0x33')],'type':_0x5a70c1[_0xaac5('0x34')]['key']};});_0x26983e['model']=_[_0xaac5('0x30')](_0x1a4706,_0xaac5('0x2e'));_0x26983e[_0xaac5('0x35')]=_[_0xaac5('0x36')](_0x30a91c['query']);_0x26983e['filters']=_['intersection'](_0x26983e[_0xaac5('0x37')],_0x26983e[_0xaac5('0x35')]);_0x2aade1[_0xaac5('0x38')]=_[_0xaac5('0x39')](_0x26983e[_0xaac5('0x37')],qs['fields'](_0x30a91c[_0xaac5('0x35')]['fields']));_0x2aade1[_0xaac5('0x38')]=_0x2aade1[_0xaac5('0x38')]['length']?_0x2aade1[_0xaac5('0x38')]:_0x26983e['model'];if(!_0x30a91c['query']['hasOwnProperty']('nolimit')){_0x2aade1['limit']=qs[_0xaac5('0x24')](_0x30a91c[_0xaac5('0x35')][_0xaac5('0x24')]);_0x2aade1[_0xaac5('0x23')]=qs[_0xaac5('0x23')](_0x30a91c[_0xaac5('0x35')]['offset']);}_0x2aade1[_0xaac5('0x3a')]=qs[_0xaac5('0x3b')](_0x30a91c['query'][_0xaac5('0x3b')]);_0x2aade1[_0xaac5('0x3c')]=qs[_0xaac5('0x3d')](_[_0xaac5('0x3e')](_0x30a91c[_0xaac5('0x35')],_0x26983e[_0xaac5('0x3d')]),_0x1a4706);if(_0x30a91c[_0xaac5('0x35')][_0xaac5('0x3f')]){_0x2aade1[_0xaac5('0x3c')]=_['merge'](_0x2aade1[_0xaac5('0x3c')],{'$or':_['map'](_0x1a4706,function(_0x2bfabf){if(_0x2bfabf[_0xaac5('0x34')]!=='VIRTUAL'){var _0x46847b={};_0x46847b[_0x2bfabf[_0xaac5('0x2e')]]={'$like':'%'+_0x30a91c['query'][_0xaac5('0x3f')]+'%'};return _0x46847b;}})});}_0x2aade1=_[_0xaac5('0x40')]({},_0x2aade1,_0x30a91c[_0xaac5('0x41')]);var _0x27bae3={'where':_0x2aade1[_0xaac5('0x3c')]};return db[_0xaac5('0x31')][_0xaac5('0x22')](_0x27bae3)[_0xaac5('0x2a')](function(_0x359c36){_0x8e1526[_0xaac5('0x22')]=_0x359c36;if(_0x30a91c[_0xaac5('0x35')][_0xaac5('0x42')]){_0x2aade1[_0xaac5('0x43')]=[{'all':!![]}];}return db[_0xaac5('0x31')][_0xaac5('0x44')](_0x2aade1);})['then'](function(_0x44fc59){_0x8e1526[_0xaac5('0x45')]=_0x44fc59;return _0x8e1526;})['then'](respondWithFilteredResult(_0xd94384,_0x2aade1))[_0xaac5('0x46')](handleError(_0xd94384,null));};exports[_0xaac5('0x47')]=function(_0x348692,_0x5da10b){var _0x2cac41={'raw':!![],'where':{'id':_0x348692['params']['id']}},_0x4a24e2={};_0x4a24e2['model']=_[_0xaac5('0x36')](db[_0xaac5('0x31')][_0xaac5('0x32')]);_0x4a24e2['query']=_[_0xaac5('0x36')](_0x348692[_0xaac5('0x35')]);_0x4a24e2[_0xaac5('0x3d')]=_[_0xaac5('0x39')](_0x4a24e2[_0xaac5('0x37')],_0x4a24e2[_0xaac5('0x35')]);_0x2cac41[_0xaac5('0x38')]=_[_0xaac5('0x39')](_0x4a24e2[_0xaac5('0x37')],qs[_0xaac5('0x48')](_0x348692[_0xaac5('0x35')][_0xaac5('0x48')]));_0x2cac41[_0xaac5('0x38')]=_0x2cac41[_0xaac5('0x38')][_0xaac5('0x49')]?_0x2cac41[_0xaac5('0x38')]:_0x4a24e2['model'];if(_0x348692[_0xaac5('0x35')]['includeAll']){_0x2cac41[_0xaac5('0x43')]=[{'all':!![]}];}_0x2cac41=_[_0xaac5('0x40')]({},_0x2cac41,_0x348692[_0xaac5('0x41')]);return db[_0xaac5('0x31')][_0xaac5('0x4a')](_0x2cac41)[_0xaac5('0x2a')](handleEntityNotFound(_0x5da10b,null))['then'](respondWithResult(_0x5da10b,null))[_0xaac5('0x46')](handleError(_0x5da10b,null));};exports[_0xaac5('0x4b')]=function(_0xfd96fb,_0x2d1027){return db[_0xaac5('0x31')][_0xaac5('0x4b')](_0xfd96fb[_0xaac5('0x4c')],{})['then'](function(_0x4c6819){var _0x519707=_0xfd96fb[_0xaac5('0x4d')][_0xaac5('0x4e')]({'plain':!![]});if(!_0x519707)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x519707[_0xaac5('0x4f')]===_0xaac5('0x4d')){var _0x1e46f6=_0x4c6819[_0xaac5('0x4e')]({'plain':!![]});var _0x5b13a2='Intervals';return db[_0xaac5('0x50')][_0xaac5('0x4a')]({'where':{'name':_0x5b13a2,'userProfileId':_0x519707[_0xaac5('0x51')]},'raw':!![]})['then'](function(_0xf07373){if(_0xf07373&&_0xf07373['autoAssociation']===0x0){return db[_0xaac5('0x2c')][_0xaac5('0x4b')]({'name':_0x1e46f6['name'],'resourceId':_0x1e46f6['id'],'type':_0xf07373[_0xaac5('0x2e')],'sectionId':_0xf07373['id']},{})['then'](function(){return _0x4c6819;});}else{return _0x4c6819;}})[_0xaac5('0x46')](function(_0x4a0d25){logger['error'](_0xaac5('0x52'),_0x4a0d25);throw _0x4a0d25;});}return _0x4c6819;})[_0xaac5('0x2a')](respondWithResult(_0x2d1027,0xc9))[_0xaac5('0x46')](handleError(_0x2d1027,null));};exports[_0xaac5('0x28')]=function(_0x3e35e0,_0x44027b){if(_0x3e35e0['body']['id']){delete _0x3e35e0[_0xaac5('0x4c')]['id'];}return db['Interval'][_0xaac5('0x4a')]({'where':{'id':_0x3e35e0[_0xaac5('0x53')]['id']}})[_0xaac5('0x2a')](handleEntityNotFound(_0x44027b,null))[_0xaac5('0x2a')](saveUpdates(_0x3e35e0['body'],null))[_0xaac5('0x2a')](respondWithResult(_0x44027b,null))['catch'](handleError(_0x44027b,null));};exports[_0xaac5('0x29')]=function(_0x5049de,_0x477422){return db[_0xaac5('0x31')][_0xaac5('0x4a')]({'where':{'id':_0x5049de['params']['id']}})[_0xaac5('0x2a')](handleEntityNotFound(_0x477422,null))['then'](removeEntity(_0x477422,null))[_0xaac5('0x46')](handleError(_0x477422,null));};exports[_0xaac5('0x54')]=function(_0x2b2af2,_0x241d2e,_0x4ce9f0){if(_0x2b2af2['body']['id']){delete _0x2b2af2['body']['id'];}return db[_0xaac5('0x31')][_0xaac5('0x4a')]({'where':{'id':_0x2b2af2[_0xaac5('0x53')]['id']}})[_0xaac5('0x2a')](handleEntityNotFound(_0x241d2e,null))[_0xaac5('0x2a')](function(_0x5ddb29){if(_0x5ddb29){_0x2b2af2[_0xaac5('0x4c')]['IntervalId']=_0x5ddb29['id'];return db[_0xaac5('0x31')][_0xaac5('0x4b')](_0x2b2af2['body']);}})['then'](respondWithResult(_0x241d2e,null))[_0xaac5('0x46')](handleError(_0x241d2e,null));};exports['getIntervals']=function(_0x12632e,_0x3fa4da,_0x230d44){var _0x113617={};var _0x2f8578={};var _0x2167b5;var _0x56d1a7;return db['Interval']['findOne']({'where':{'id':_0x12632e[_0xaac5('0x53')]['id']}})[_0xaac5('0x2a')](handleEntityNotFound(_0x3fa4da,null))[_0xaac5('0x2a')](function(_0x5a2853){if(_0x5a2853){_0x2167b5=_0x5a2853;_0x2f8578['model']=_[_0xaac5('0x36')](db['Interval'][_0xaac5('0x32')]);_0x2f8578[_0xaac5('0x35')]=_[_0xaac5('0x36')](_0x12632e[_0xaac5('0x35')]);_0x2f8578['filters']=_[_0xaac5('0x39')](_0x2f8578[_0xaac5('0x37')],_0x2f8578[_0xaac5('0x35')]);_0x113617['attributes']=_[_0xaac5('0x39')](_0x2f8578[_0xaac5('0x37')],qs[_0xaac5('0x48')](_0x12632e['query'][_0xaac5('0x48')]));_0x113617[_0xaac5('0x38')]=_0x113617[_0xaac5('0x38')][_0xaac5('0x49')]?_0x113617[_0xaac5('0x38')]:_0x2f8578[_0xaac5('0x37')];_0x113617[_0xaac5('0x3a')]=qs[_0xaac5('0x3b')](_0x12632e['query'][_0xaac5('0x3b')]);_0x113617[_0xaac5('0x3c')]=qs[_0xaac5('0x3d')](_[_0xaac5('0x3e')](_0x12632e[_0xaac5('0x35')],_0x2f8578[_0xaac5('0x3d')]));if(_0x12632e[_0xaac5('0x35')]['filter']){_0x113617['where']=_[_0xaac5('0x40')](_0x113617[_0xaac5('0x3c')],{'$or':_[_0xaac5('0x30')](_0x113617[_0xaac5('0x38')],function(_0x3479c3){var _0x527e8d={};_0x527e8d[_0x3479c3]={'$like':'%'+_0x12632e[_0xaac5('0x35')][_0xaac5('0x3f')]+'%'};return _0x527e8d;})});}_0x113617=_['merge']({},_0x113617,_0x12632e[_0xaac5('0x41')]);return _0x2167b5[_0xaac5('0x55')](_0x113617);}})[_0xaac5('0x2a')](function(_0x2799bb){if(_0x2799bb){_0x56d1a7=_0x2799bb[_0xaac5('0x49')];if(!_0x12632e[_0xaac5('0x35')][_0xaac5('0x56')](_0xaac5('0x57'))){_0x113617[_0xaac5('0x24')]=qs[_0xaac5('0x24')](_0x12632e[_0xaac5('0x35')]['limit']);_0x113617[_0xaac5('0x23')]=qs['offset'](_0x12632e[_0xaac5('0x35')][_0xaac5('0x23')]);}return _0x2167b5[_0xaac5('0x55')](_0x113617);}})[_0xaac5('0x2a')](function(_0x5dfd87){if(_0x5dfd87){return _0x5dfd87?{'count':_0x56d1a7,'rows':_0x5dfd87}:null;}})['then'](respondWithResult(_0x3fa4da,null))[_0xaac5('0x46')](handleError(_0x3fa4da,null));};exports[_0xaac5('0x58')]=function(_0x17b589,_0x411bb6,_0x5f313d){return db[_0xaac5('0x31')][_0xaac5('0x59')]({'where':{'id':_0x17b589['params']['id']}})['then'](handleEntityNotFound(_0x411bb6,null))['then'](function(_0x3b4abb){if(_0x3b4abb){return db[_0xaac5('0x5a')]['transaction'](function(_0x11ef04){return db[_0xaac5('0x31')]['destroy']({'where':{'IntervalId':_0x17b589[_0xaac5('0x53')]['id']},'transaction':_0x11ef04})[_0xaac5('0x2a')](function(_0x24d95e){var _0x20c9df=_[_0xaac5('0x30')](_0x17b589[_0xaac5('0x4c')],function(_0x230443){delete _0x230443['id'];_0x230443[_0xaac5('0x5b')]=_0x17b589[_0xaac5('0x53')]['id'];return _0x230443;});return db['Interval'][_0xaac5('0x5c')](_0x20c9df,{'transaction':_0x11ef04});});})[_0xaac5('0x2a')](function(){return db[_0xaac5('0x31')][_0xaac5('0x44')]({'where':{'IntervalId':_0x17b589[_0xaac5('0x53')]['id']}});});}})[_0xaac5('0x2a')](respondWithResult(_0x411bb6,null))[_0xaac5('0x46')](handleError(_0x411bb6,null));}; \ No newline at end of file +var _0x7b18=['offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','findOne','getIntervals','nolimit','sequelize','transaction','bulkCreate','eml-format','zip-dir','request-promise','mustache','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','limit','status','set','Content-Range','reject','save','then','get','Intervals','destroy','end','error','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x31509a,_0x517b5b){var _0x355a0d=function(_0x529ac3){while(--_0x529ac3){_0x31509a['push'](_0x31509a['shift']());}};_0x355a0d(++_0x517b5b);}(_0x7b18,0x77));var _0x87b1=function(_0xa08fde,_0x2eefc7){_0xa08fde=_0xa08fde-0x0;var _0x41fa82=_0x7b18[_0xa08fde];return _0x41fa82;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x87b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87b1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x87b1('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x87b1('0x4'));var fs=require('fs');var _=require(_0x87b1('0x5'));var squel=require(_0x87b1('0x6'));var crypto=require(_0x87b1('0x7'));var jsforce=require(_0x87b1('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x87b1('0x9'));var querystring=require(_0x87b1('0xa'));var Papa=require(_0x87b1('0xb'));var Redis=require('ioredis');var authService=require(_0x87b1('0xc'));var qs=require(_0x87b1('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87b1('0xe'));var logger=require('../../config/logger')(_0x87b1('0xf'));var utils=require(_0x87b1('0x10'));var config=require(_0x87b1('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x87b1('0x12'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1c18e7,_0x32fdaa){_0x32fdaa=_0x32fdaa||0xcc;return function(_0x40d89b){if(_0x40d89b){return _0x1c18e7[_0x87b1('0x13')](_0x32fdaa);}return _0x1c18e7['status'](_0x32fdaa)['end']();};}function respondWithResult(_0x4de82c,_0xe775e8){_0xe775e8=_0xe775e8||0xc8;return function(_0x1bbc45){if(_0x1bbc45){return _0x4de82c['status'](_0xe775e8)[_0x87b1('0x14')](_0x1bbc45);}};}function respondWithFilteredResult(_0x457780,_0x53270c){return function(_0x1da7e4){if(_0x1da7e4){var _0x4184af=_0x1da7e4['count'],_0x53e556=_0x53270c['offset'],_0x20e655=_0x53270c['offset']+_0x53270c[_0x87b1('0x15')],_0x23fbe8;if(_0x20e655>=_0x4184af){_0x20e655=_0x4184af;_0x23fbe8=0xc8;}else{_0x23fbe8=0xce;}_0x457780[_0x87b1('0x16')](_0x23fbe8);return _0x457780[_0x87b1('0x17')](_0x87b1('0x18'),_0x53e556+'-'+_0x20e655+'/'+_0x4184af)['json'](_0x1da7e4);}return null;};}function patchUpdates(_0x3a0739){return function(_0x419ca3){try{jsonpatch['apply'](_0x419ca3,_0x3a0739,!![]);}catch(_0x44f989){return BPromise[_0x87b1('0x19')](_0x44f989);}return _0x419ca3[_0x87b1('0x1a')]();};}function saveUpdates(_0x1a71eb,_0x57c167){return function(_0x5cad36){if(_0x5cad36){return _0x5cad36['update'](_0x1a71eb)['then'](function(_0x10ccdc){return _0x10ccdc;});}return null;};}function removeEntity(_0xa11ed5,_0xd38703){return function(_0x3d50bf){if(_0x3d50bf){return _0x3d50bf['destroy']()[_0x87b1('0x1b')](function(){var _0x10d477=_0x3d50bf[_0x87b1('0x1c')]({'plain':!![]});var _0x474c53=_0x87b1('0x1d');return db['UserProfileResource'][_0x87b1('0x1e')]({'where':{'type':_0x474c53,'resourceId':_0x10d477['id']}})[_0x87b1('0x1b')](function(){return _0x3d50bf;});})['then'](function(){_0xa11ed5[_0x87b1('0x16')](0xcc)[_0x87b1('0x1f')]();});}};}function handleEntityNotFound(_0x4b0988,_0x271db7){return function(_0x4815a4){if(!_0x4815a4){_0x4b0988[_0x87b1('0x13')](0x194);}return _0x4815a4;};}function handleError(_0x4db2bf,_0x87c6e5){_0x87c6e5=_0x87c6e5||0x1f4;return function(_0x560fc1){logger[_0x87b1('0x20')](_0x560fc1[_0x87b1('0x21')]);if(_0x560fc1[_0x87b1('0x22')]){delete _0x560fc1[_0x87b1('0x22')];}_0x4db2bf[_0x87b1('0x16')](_0x87c6e5)[_0x87b1('0x23')](_0x560fc1);};}exports[_0x87b1('0x24')]=function(_0x5d68b7,_0x151614){var _0x339e8d={},_0x38846a={},_0x40af20={'count':0x0,'rows':[]};var _0x5188c1=_[_0x87b1('0x25')](db[_0x87b1('0x26')]['rawAttributes'],function(_0x225370){return{'name':_0x225370[_0x87b1('0x27')],'type':_0x225370[_0x87b1('0x28')][_0x87b1('0x29')]};});_0x38846a[_0x87b1('0x2a')]=_[_0x87b1('0x25')](_0x5188c1,'name');_0x38846a[_0x87b1('0x2b')]=_[_0x87b1('0x2c')](_0x5d68b7[_0x87b1('0x2b')]);_0x38846a[_0x87b1('0x2d')]=_[_0x87b1('0x2e')](_0x38846a['model'],_0x38846a[_0x87b1('0x2b')]);_0x339e8d[_0x87b1('0x2f')]=_[_0x87b1('0x2e')](_0x38846a['model'],qs[_0x87b1('0x30')](_0x5d68b7['query'][_0x87b1('0x30')]));_0x339e8d[_0x87b1('0x2f')]=_0x339e8d[_0x87b1('0x2f')][_0x87b1('0x31')]?_0x339e8d[_0x87b1('0x2f')]:_0x38846a[_0x87b1('0x2a')];if(!_0x5d68b7['query'][_0x87b1('0x32')]('nolimit')){_0x339e8d[_0x87b1('0x15')]=qs[_0x87b1('0x15')](_0x5d68b7[_0x87b1('0x2b')][_0x87b1('0x15')]);_0x339e8d[_0x87b1('0x33')]=qs[_0x87b1('0x33')](_0x5d68b7['query'][_0x87b1('0x33')]);}_0x339e8d[_0x87b1('0x34')]=qs[_0x87b1('0x35')](_0x5d68b7[_0x87b1('0x2b')][_0x87b1('0x35')]);_0x339e8d[_0x87b1('0x36')]=qs[_0x87b1('0x2d')](_[_0x87b1('0x37')](_0x5d68b7[_0x87b1('0x2b')],_0x38846a[_0x87b1('0x2d')]),_0x5188c1);if(_0x5d68b7['query'][_0x87b1('0x38')]){_0x339e8d[_0x87b1('0x36')]=_[_0x87b1('0x39')](_0x339e8d[_0x87b1('0x36')],{'$or':_[_0x87b1('0x25')](_0x5188c1,function(_0x5c31fb){if(_0x5c31fb[_0x87b1('0x28')]!==_0x87b1('0x3a')){var _0xb6c9e4={};_0xb6c9e4[_0x5c31fb[_0x87b1('0x22')]]={'$like':'%'+_0x5d68b7['query'][_0x87b1('0x38')]+'%'};return _0xb6c9e4;}})});}_0x339e8d=_['merge']({},_0x339e8d,_0x5d68b7[_0x87b1('0x3b')]);var _0x13ca85={'where':_0x339e8d[_0x87b1('0x36')]};return db[_0x87b1('0x26')][_0x87b1('0x3c')](_0x13ca85)[_0x87b1('0x1b')](function(_0x13dc04){_0x40af20[_0x87b1('0x3c')]=_0x13dc04;if(_0x5d68b7[_0x87b1('0x2b')]['includeAll']){_0x339e8d[_0x87b1('0x3d')]=[{'all':!![]}];}return db[_0x87b1('0x26')][_0x87b1('0x3e')](_0x339e8d);})[_0x87b1('0x1b')](function(_0x22113a){_0x40af20[_0x87b1('0x3f')]=_0x22113a;return _0x40af20;})[_0x87b1('0x1b')](respondWithFilteredResult(_0x151614,_0x339e8d))[_0x87b1('0x40')](handleError(_0x151614,null));};exports[_0x87b1('0x41')]=function(_0x2e9ef5,_0x4b9672){var _0x190b7d={'raw':!![],'where':{'id':_0x2e9ef5[_0x87b1('0x42')]['id']}},_0x31d4f4={};_0x31d4f4[_0x87b1('0x2a')]=_[_0x87b1('0x2c')](db['Interval'][_0x87b1('0x43')]);_0x31d4f4[_0x87b1('0x2b')]=_['keys'](_0x2e9ef5[_0x87b1('0x2b')]);_0x31d4f4[_0x87b1('0x2d')]=_[_0x87b1('0x2e')](_0x31d4f4[_0x87b1('0x2a')],_0x31d4f4[_0x87b1('0x2b')]);_0x190b7d[_0x87b1('0x2f')]=_[_0x87b1('0x2e')](_0x31d4f4[_0x87b1('0x2a')],qs[_0x87b1('0x30')](_0x2e9ef5['query']['fields']));_0x190b7d[_0x87b1('0x2f')]=_0x190b7d[_0x87b1('0x2f')][_0x87b1('0x31')]?_0x190b7d[_0x87b1('0x2f')]:_0x31d4f4[_0x87b1('0x2a')];if(_0x2e9ef5['query'][_0x87b1('0x44')]){_0x190b7d[_0x87b1('0x3d')]=[{'all':!![]}];}_0x190b7d=_[_0x87b1('0x39')]({},_0x190b7d,_0x2e9ef5[_0x87b1('0x3b')]);return db[_0x87b1('0x26')][_0x87b1('0x45')](_0x190b7d)['then'](handleEntityNotFound(_0x4b9672,null))['then'](respondWithResult(_0x4b9672,null))[_0x87b1('0x40')](handleError(_0x4b9672,null));};exports[_0x87b1('0x46')]=function(_0x166596,_0x2a5e91){return db['Interval'][_0x87b1('0x46')](_0x166596[_0x87b1('0x47')],{})[_0x87b1('0x1b')](function(_0x29d28e){var _0x1d4ff0=_0x166596['user']['get']({'plain':!![]});if(!_0x1d4ff0)throw new Error(_0x87b1('0x48'));if(_0x1d4ff0[_0x87b1('0x49')]===_0x87b1('0x4a')){var _0x5124f1=_0x29d28e[_0x87b1('0x1c')]({'plain':!![]});var _0x58f704=_0x87b1('0x1d');return db[_0x87b1('0x4b')][_0x87b1('0x45')]({'where':{'name':_0x58f704,'userProfileId':_0x1d4ff0['userProfileId']},'raw':!![]})[_0x87b1('0x1b')](function(_0x4a26bf){if(_0x4a26bf&&_0x4a26bf['autoAssociation']===0x0){return db[_0x87b1('0x4c')][_0x87b1('0x46')]({'name':_0x5124f1['name'],'resourceId':_0x5124f1['id'],'type':_0x4a26bf[_0x87b1('0x22')],'sectionId':_0x4a26bf['id']},{})['then'](function(){return _0x29d28e;});}else{return _0x29d28e;}})['catch'](function(_0x554919){logger[_0x87b1('0x20')](_0x87b1('0x4d'),_0x554919);throw _0x554919;});}return _0x29d28e;})[_0x87b1('0x1b')](respondWithResult(_0x2a5e91,0xc9))[_0x87b1('0x40')](handleError(_0x2a5e91,null));};exports['update']=function(_0x330c42,_0x22e8eb){if(_0x330c42[_0x87b1('0x47')]['id']){delete _0x330c42[_0x87b1('0x47')]['id'];}return db[_0x87b1('0x26')][_0x87b1('0x45')]({'where':{'id':_0x330c42[_0x87b1('0x42')]['id']}})[_0x87b1('0x1b')](handleEntityNotFound(_0x22e8eb,null))[_0x87b1('0x1b')](saveUpdates(_0x330c42[_0x87b1('0x47')],null))['then'](respondWithResult(_0x22e8eb,null))[_0x87b1('0x40')](handleError(_0x22e8eb,null));};exports['destroy']=function(_0x4907ff,_0x5bd158){return db[_0x87b1('0x26')][_0x87b1('0x45')]({'where':{'id':_0x4907ff[_0x87b1('0x42')]['id']}})[_0x87b1('0x1b')](handleEntityNotFound(_0x5bd158,null))[_0x87b1('0x1b')](removeEntity(_0x5bd158,null))['catch'](handleError(_0x5bd158,null));};exports['addInterval']=function(_0x457889,_0xb5fc24,_0x32f9bd){if(_0x457889[_0x87b1('0x47')]['id']){delete _0x457889[_0x87b1('0x47')]['id'];}return db[_0x87b1('0x26')][_0x87b1('0x45')]({'where':{'id':_0x457889[_0x87b1('0x42')]['id']}})[_0x87b1('0x1b')](handleEntityNotFound(_0xb5fc24,null))[_0x87b1('0x1b')](function(_0x445e16){if(_0x445e16){_0x457889[_0x87b1('0x47')][_0x87b1('0x4e')]=_0x445e16['id'];return db[_0x87b1('0x26')][_0x87b1('0x46')](_0x457889[_0x87b1('0x47')]);}})[_0x87b1('0x1b')](respondWithResult(_0xb5fc24,null))['catch'](handleError(_0xb5fc24,null));};exports['getIntervals']=function(_0xaf3e5c,_0x5bb05d,_0x22655e){var _0x508847={};var _0x5e18d5={};var _0x5581b0;var _0x126102;return db[_0x87b1('0x26')][_0x87b1('0x4f')]({'where':{'id':_0xaf3e5c[_0x87b1('0x42')]['id']}})[_0x87b1('0x1b')](handleEntityNotFound(_0x5bb05d,null))[_0x87b1('0x1b')](function(_0xf41caa){if(_0xf41caa){_0x5581b0=_0xf41caa;_0x5e18d5[_0x87b1('0x2a')]=_['keys'](db[_0x87b1('0x26')]['rawAttributes']);_0x5e18d5['query']=_[_0x87b1('0x2c')](_0xaf3e5c['query']);_0x5e18d5['filters']=_['intersection'](_0x5e18d5[_0x87b1('0x2a')],_0x5e18d5[_0x87b1('0x2b')]);_0x508847[_0x87b1('0x2f')]=_[_0x87b1('0x2e')](_0x5e18d5[_0x87b1('0x2a')],qs[_0x87b1('0x30')](_0xaf3e5c[_0x87b1('0x2b')]['fields']));_0x508847['attributes']=_0x508847[_0x87b1('0x2f')][_0x87b1('0x31')]?_0x508847[_0x87b1('0x2f')]:_0x5e18d5[_0x87b1('0x2a')];_0x508847[_0x87b1('0x34')]=qs[_0x87b1('0x35')](_0xaf3e5c[_0x87b1('0x2b')][_0x87b1('0x35')]);_0x508847['where']=qs[_0x87b1('0x2d')](_[_0x87b1('0x37')](_0xaf3e5c[_0x87b1('0x2b')],_0x5e18d5[_0x87b1('0x2d')]));if(_0xaf3e5c[_0x87b1('0x2b')][_0x87b1('0x38')]){_0x508847[_0x87b1('0x36')]=_[_0x87b1('0x39')](_0x508847['where'],{'$or':_[_0x87b1('0x25')](_0x508847['attributes'],function(_0x5cb5eb){var _0x12f97c={};_0x12f97c[_0x5cb5eb]={'$like':'%'+_0xaf3e5c['query']['filter']+'%'};return _0x12f97c;})});}_0x508847=_[_0x87b1('0x39')]({},_0x508847,_0xaf3e5c[_0x87b1('0x3b')]);return _0x5581b0[_0x87b1('0x50')](_0x508847);}})[_0x87b1('0x1b')](function(_0xbe6253){if(_0xbe6253){_0x126102=_0xbe6253[_0x87b1('0x31')];if(!_0xaf3e5c[_0x87b1('0x2b')][_0x87b1('0x32')](_0x87b1('0x51'))){_0x508847['limit']=qs[_0x87b1('0x15')](_0xaf3e5c[_0x87b1('0x2b')][_0x87b1('0x15')]);_0x508847[_0x87b1('0x33')]=qs[_0x87b1('0x33')](_0xaf3e5c[_0x87b1('0x2b')][_0x87b1('0x33')]);}return _0x5581b0['getIntervals'](_0x508847);}})[_0x87b1('0x1b')](function(_0x10a371){if(_0x10a371){return _0x10a371?{'count':_0x126102,'rows':_0x10a371}:null;}})['then'](respondWithResult(_0x5bb05d,null))['catch'](handleError(_0x5bb05d,null));};exports['addIntervals']=function(_0xa9e854,_0x1f3aed,_0x3a63e7){return db[_0x87b1('0x26')]['findOne']({'where':{'id':_0xa9e854['params']['id']}})[_0x87b1('0x1b')](handleEntityNotFound(_0x1f3aed,null))[_0x87b1('0x1b')](function(_0x30c12b){if(_0x30c12b){return db[_0x87b1('0x52')][_0x87b1('0x53')](function(_0x5e993d){return db[_0x87b1('0x26')][_0x87b1('0x1e')]({'where':{'IntervalId':_0xa9e854[_0x87b1('0x42')]['id']},'transaction':_0x5e993d})[_0x87b1('0x1b')](function(_0x138a13){var _0x1f4d35=_[_0x87b1('0x25')](_0xa9e854['body'],function(_0x1ce5ed){delete _0x1ce5ed['id'];_0x1ce5ed[_0x87b1('0x4e')]=_0xa9e854[_0x87b1('0x42')]['id'];return _0x1ce5ed;});return db['Interval'][_0x87b1('0x54')](_0x1f4d35,{'transaction':_0x5e993d});});})['then'](function(){return db[_0x87b1('0x26')][_0x87b1('0x3e')]({'where':{'IntervalId':_0xa9e854[_0x87b1('0x42')]['id']}});});}})[_0x87b1('0x1b')](respondWithResult(_0x1f3aed,null))[_0x87b1('0x40')](handleError(_0x1f3aed,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d89e738..4a02272 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 _0x8aa7=['tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x8aa7,0xb6));var _0x78aa=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x8aa7[_0x28d18d];return _0x470640;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var logger=require(_0x78aa('0x1'))(_0x78aa('0x2'));var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var rp=require(_0x78aa('0x5'));var fs=require('fs');var path=require(_0x78aa('0x6'));var rimraf=require('rimraf');var config=require(_0x78aa('0x7'));var attributes=require(_0x78aa('0x8'));var extensions=require(_0x78aa('0x9'));module[_0x78aa('0xa')]=function(_0x2d17c2,_0x369ee7){return _0x2d17c2[_0x78aa('0xb')](_0x78aa('0xc'),attributes,{'tableName':_0x78aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x460488,_0x1da0ad){extensions[_0x78aa('0xe')](_0x2d17c2,_0x460488);},'afterBulkCreate':function(_0x45d377,_0x41e196,_0x357ab1){_0x357ab1();extensions[_0x78aa('0xe')](_0x2d17c2,_0x45d377[0x0]);},'afterUpdate':function(_0x3df85c,_0x3b7690){extensions[_0x78aa('0xe')](_0x2d17c2,_0x3df85c);},'afterDestroy':function(_0x522c95,_0x57855b){extensions[_0x78aa('0xe')](_0x2d17c2,_0x522c95);}}});}; \ No newline at end of file +var _0xc1fa=['../../config/environment','../../components/extensions/rewrite','Interval','rewrite','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xc1fa,0xe5));var _0xac1f=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xc1fa[_0x100682];return _0xcb6e87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac1f('0x0'))(_0xac1f('0x1'));var moment=require(_0xac1f('0x2'));var BPromise=require('bluebird');var rp=require(_0xac1f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac1f('0x4'));var config=require(_0xac1f('0x5'));var attributes=require('./interval.attributes');var extensions=require(_0xac1f('0x6'));module['exports']=function(_0x16693b,_0x353131){return _0x16693b['define'](_0xac1f('0x7'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xed527c,_0x240fb0){extensions[_0xac1f('0x8')](_0x16693b,_0xed527c);},'afterBulkCreate':function(_0x2eae37,_0x49ebdd,_0x226d82){_0x226d82();extensions[_0xac1f('0x8')](_0x16693b,_0x2eae37[0x0]);},'afterUpdate':function(_0x258eee,_0xa4c8a6){extensions['rewrite'](_0x16693b,_0x258eee);},'afterDestroy':function(_0x2ab1f7,_0x498cd1){extensions[_0xac1f('0x8')](_0x16693b,_0x2ab1f7);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5dd1407..a7a7d6f 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 _0x78ea=['Interval','findAll','options','raw','attributes','limit','include','map','model','ShowInterval','find','where','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','code','Interval,\x20%s,\x20%s','error','message','catch','GetInterval'];(function(_0xb850bd,_0x5e8608){var _0x52d216=function(_0x9a4dc1){while(--_0x9a4dc1){_0xb850bd['push'](_0xb850bd['shift']());}};_0x52d216(++_0x5e8608);}(_0x78ea,0x1d4));var _0xa78e=function(_0x5cd054,_0x2d3b5d){_0x5cd054=_0x5cd054-0x0;var _0x5a9331=_0x78ea[_0x5cd054];return _0x5a9331;};'use strict';var _=require(_0xa78e('0x0'));var util=require('util');var moment=require(_0xa78e('0x1'));var BPromise=require(_0xa78e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa78e('0x3'));var db=require(_0xa78e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa78e('0x5'))(_0xa78e('0x6'));var config=require('../../config/environment');var jayson=require(_0xa78e('0x7'));var client=jayson[_0xa78e('0x8')][_0xa78e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f2208,_0x5c7012,_0x107855){return new BPromise(function(_0x3b8115,_0xe1d766){return client[_0xa78e('0xa')](_0x5f2208,_0x107855)['then'](function(_0x4cda00){logger[_0xa78e('0xb')]('Interval,\x20%s,\x20%s',_0x5c7012,_0xa78e('0xc'));logger[_0xa78e('0xd')](_0xa78e('0xe'),_0x5c7012,_0xa78e('0xc'),JSON[_0xa78e('0xf')](_0x4cda00));if(_0x4cda00['error']){if(_0x4cda00['error'][_0xa78e('0x10')]===0x1f4){logger['error'](_0xa78e('0x11'),_0x5c7012,_0x4cda00[_0xa78e('0x12')]['message']);return _0xe1d766(_0x4cda00[_0xa78e('0x12')]['message']);}logger[_0xa78e('0x12')](_0xa78e('0x11'),_0x5c7012,_0x4cda00[_0xa78e('0x12')][_0xa78e('0x13')]);return _0x3b8115(_0x4cda00[_0xa78e('0x12')][_0xa78e('0x13')]);}else{logger[_0xa78e('0xb')](_0xa78e('0x11'),_0x5c7012,'request\x20sent');_0x3b8115(_0x4cda00['result'][_0xa78e('0x13')]);}})[_0xa78e('0x14')](function(_0x2c1c85){logger['error'](_0xa78e('0x11'),_0x5c7012,_0x2c1c85);_0xe1d766(_0x2c1c85);});});}exports[_0xa78e('0x15')]=function(_0x109ead){var _0x4dddfc=this;return new Promise(function(_0x5bc479,_0x4b0308){return db[_0xa78e('0x16')][_0xa78e('0x17')]({'raw':_0x109ead[_0xa78e('0x18')]?_0x109ead[_0xa78e('0x18')][_0xa78e('0x19')]===undefined?!![]:![]:!![],'where':_0x109ead[_0xa78e('0x18')]?_0x109ead[_0xa78e('0x18')]['where']||null:null,'attributes':_0x109ead[_0xa78e('0x18')]?_0x109ead['options'][_0xa78e('0x1a')]||null:null,'limit':_0x109ead[_0xa78e('0x18')]?_0x109ead[_0xa78e('0x18')][_0xa78e('0x1b')]||null:null,'include':_0x109ead[_0xa78e('0x18')]?_0x109ead[_0xa78e('0x18')][_0xa78e('0x1c')]?_[_0xa78e('0x1d')](_0x109ead[_0xa78e('0x18')]['include'],function(_0x502f65){return{'model':db[_0x502f65[_0xa78e('0x1e')]],'as':_0x502f65['as'],'attributes':_0x502f65[_0xa78e('0x1a')],'include':_0x502f65[_0xa78e('0x1c')]?_[_0xa78e('0x1d')](_0x502f65[_0xa78e('0x1c')],function(_0x28b08f){return{'model':db[_0x28b08f['model']],'as':_0x28b08f['as'],'attributes':_0x28b08f[_0xa78e('0x1a')],'include':_0x28b08f[_0xa78e('0x1c')]?_[_0xa78e('0x1d')](_0x28b08f[_0xa78e('0x1c')],function(_0x414b07){return{'model':db[_0x414b07[_0xa78e('0x1e')]],'as':_0x414b07['as'],'attributes':_0x414b07[_0xa78e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c8b6d){logger[_0xa78e('0xb')](_0xa78e('0x15'),_0x109ead);logger[_0xa78e('0xd')](_0xa78e('0x15'),_0x109ead,JSON[_0xa78e('0xf')](_0x1c8b6d));_0x5bc479(_0x1c8b6d);})[_0xa78e('0x14')](function(_0x9353e0){logger[_0xa78e('0x12')](_0xa78e('0x15'),_0x9353e0[_0xa78e('0x13')],_0x109ead);_0x4b0308(_0x4dddfc[_0xa78e('0x12')](0x1f4,_0x9353e0[_0xa78e('0x13')]));});});};exports[_0xa78e('0x1f')]=function(_0x21d2c6){var _0x4e0baf=this;return new Promise(function(_0x28cf01,_0x555752){return db['Interval'][_0xa78e('0x20')]({'raw':_0x21d2c6[_0xa78e('0x18')]?_0x21d2c6[_0xa78e('0x18')][_0xa78e('0x19')]===undefined?!![]:![]:!![],'where':_0x21d2c6[_0xa78e('0x18')]?_0x21d2c6[_0xa78e('0x18')][_0xa78e('0x21')]||null:null,'attributes':_0x21d2c6['options']?_0x21d2c6[_0xa78e('0x18')][_0xa78e('0x1a')]||null:null,'include':_0x21d2c6[_0xa78e('0x18')]?_0x21d2c6[_0xa78e('0x18')][_0xa78e('0x1c')]?_['map'](_0x21d2c6[_0xa78e('0x18')][_0xa78e('0x1c')],function(_0x4b5124){return{'model':db[_0x4b5124[_0xa78e('0x1e')]],'as':_0x4b5124['as'],'attributes':_0x4b5124['attributes'],'include':_0x4b5124[_0xa78e('0x1c')]?_[_0xa78e('0x1d')](_0x4b5124[_0xa78e('0x1c')],function(_0x370c2e){return{'model':db[_0x370c2e[_0xa78e('0x1e')]],'as':_0x370c2e['as'],'attributes':_0x370c2e['attributes'],'include':_0x370c2e['include']?_[_0xa78e('0x1d')](_0x370c2e[_0xa78e('0x1c')],function(_0x28c6de){return{'model':db[_0x28c6de['model']],'as':_0x28c6de['as'],'attributes':_0x28c6de[_0xa78e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa78e('0x22')](function(_0x102877){logger['info'](_0xa78e('0x1f'),_0x21d2c6);logger['debug'](_0xa78e('0x1f'),_0x21d2c6,JSON[_0xa78e('0xf')](_0x102877));_0x28cf01(_0x102877);})[_0xa78e('0x14')](function(_0x5ba286){logger[_0xa78e('0x12')](_0xa78e('0x1f'),_0x5ba286['message'],_0x21d2c6);_0x555752(_0x4e0baf[_0xa78e('0x12')](0x1f4,_0x5ba286['message']));});});}; \ No newline at end of file +var _0xc1a6=['request\x20sent','result','catch','Interval','options','raw','where','limit','include','map','model','attributes','GetInterval','ShowInterval','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xad3077,_0x848134){var _0x36191a=function(_0x1493d9){while(--_0x1493d9){_0xad3077['push'](_0xad3077['shift']());}};_0x36191a(++_0x848134);}(_0xc1a6,0x104));var _0x6c1a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc1a6[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x6c1a('0x0'));var util=require(_0x6c1a('0x1'));var moment=require('moment');var BPromise=require(_0x6c1a('0x2'));var rs=require(_0x6c1a('0x3'));var fs=require('fs');var Redis=require(_0x6c1a('0x4'));var db=require(_0x6c1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c1a('0x6'))(_0x6c1a('0x7'));var config=require(_0x6c1a('0x8'));var jayson=require(_0x6c1a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4df269,_0x1ea411,_0xdaaee3){return new BPromise(function(_0x34c92e,_0x1bc494){return client[_0x6c1a('0xa')](_0x4df269,_0xdaaee3)[_0x6c1a('0xb')](function(_0x43cd6d){logger[_0x6c1a('0xc')](_0x6c1a('0xd'),_0x1ea411,'request\x20sent');logger[_0x6c1a('0xe')](_0x6c1a('0xf'),_0x1ea411,'request\x20sent',JSON[_0x6c1a('0x10')](_0x43cd6d));if(_0x43cd6d[_0x6c1a('0x11')]){if(_0x43cd6d['error'][_0x6c1a('0x12')]===0x1f4){logger[_0x6c1a('0x11')](_0x6c1a('0xd'),_0x1ea411,_0x43cd6d[_0x6c1a('0x11')][_0x6c1a('0x13')]);return _0x1bc494(_0x43cd6d['error'][_0x6c1a('0x13')]);}logger[_0x6c1a('0x11')](_0x6c1a('0xd'),_0x1ea411,_0x43cd6d[_0x6c1a('0x11')]['message']);return _0x34c92e(_0x43cd6d['error'][_0x6c1a('0x13')]);}else{logger[_0x6c1a('0xc')](_0x6c1a('0xd'),_0x1ea411,_0x6c1a('0x14'));_0x34c92e(_0x43cd6d[_0x6c1a('0x15')][_0x6c1a('0x13')]);}})[_0x6c1a('0x16')](function(_0x56d40f){logger[_0x6c1a('0x11')]('Interval,\x20%s,\x20%s',_0x1ea411,_0x56d40f);_0x1bc494(_0x56d40f);});});}exports['GetInterval']=function(_0x54fb33){var _0x129be1=this;return new Promise(function(_0x38ade9,_0x180cfa){return db[_0x6c1a('0x17')]['findAll']({'raw':_0x54fb33[_0x6c1a('0x18')]?_0x54fb33[_0x6c1a('0x18')][_0x6c1a('0x19')]===undefined?!![]:![]:!![],'where':_0x54fb33[_0x6c1a('0x18')]?_0x54fb33[_0x6c1a('0x18')][_0x6c1a('0x1a')]||null:null,'attributes':_0x54fb33[_0x6c1a('0x18')]?_0x54fb33['options']['attributes']||null:null,'limit':_0x54fb33['options']?_0x54fb33[_0x6c1a('0x18')][_0x6c1a('0x1b')]||null:null,'include':_0x54fb33['options']?_0x54fb33['options'][_0x6c1a('0x1c')]?_[_0x6c1a('0x1d')](_0x54fb33[_0x6c1a('0x18')][_0x6c1a('0x1c')],function(_0x31e394){return{'model':db[_0x31e394[_0x6c1a('0x1e')]],'as':_0x31e394['as'],'attributes':_0x31e394['attributes'],'include':_0x31e394[_0x6c1a('0x1c')]?_[_0x6c1a('0x1d')](_0x31e394[_0x6c1a('0x1c')],function(_0x235752){return{'model':db[_0x235752[_0x6c1a('0x1e')]],'as':_0x235752['as'],'attributes':_0x235752[_0x6c1a('0x1f')],'include':_0x235752[_0x6c1a('0x1c')]?_[_0x6c1a('0x1d')](_0x235752[_0x6c1a('0x1c')],function(_0x36acc6){return{'model':db[_0x36acc6['model']],'as':_0x36acc6['as'],'attributes':_0x36acc6['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c1a('0xb')](function(_0x44265f){logger[_0x6c1a('0xc')](_0x6c1a('0x20'),_0x54fb33);logger[_0x6c1a('0xe')](_0x6c1a('0x20'),_0x54fb33,JSON[_0x6c1a('0x10')](_0x44265f));_0x38ade9(_0x44265f);})[_0x6c1a('0x16')](function(_0x11e8ba){logger[_0x6c1a('0x11')](_0x6c1a('0x20'),_0x11e8ba[_0x6c1a('0x13')],_0x54fb33);_0x180cfa(_0x129be1['error'](0x1f4,_0x11e8ba[_0x6c1a('0x13')]));});});};exports[_0x6c1a('0x21')]=function(_0x493af1){var _0x18bce1=this;return new Promise(function(_0x59b9fb,_0x247a05){return db[_0x6c1a('0x17')][_0x6c1a('0x22')]({'raw':_0x493af1[_0x6c1a('0x18')]?_0x493af1[_0x6c1a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x493af1['options']?_0x493af1[_0x6c1a('0x18')][_0x6c1a('0x1a')]||null:null,'attributes':_0x493af1[_0x6c1a('0x18')]?_0x493af1['options'][_0x6c1a('0x1f')]||null:null,'include':_0x493af1['options']?_0x493af1['options']['include']?_[_0x6c1a('0x1d')](_0x493af1[_0x6c1a('0x18')]['include'],function(_0x592505){return{'model':db[_0x592505[_0x6c1a('0x1e')]],'as':_0x592505['as'],'attributes':_0x592505[_0x6c1a('0x1f')],'include':_0x592505['include']?_[_0x6c1a('0x1d')](_0x592505[_0x6c1a('0x1c')],function(_0x30d908){return{'model':db[_0x30d908['model']],'as':_0x30d908['as'],'attributes':_0x30d908['attributes'],'include':_0x30d908['include']?_[_0x6c1a('0x1d')](_0x30d908[_0x6c1a('0x1c')],function(_0x48e9eb){return{'model':db[_0x48e9eb[_0x6c1a('0x1e')]],'as':_0x48e9eb['as'],'attributes':_0x48e9eb[_0x6c1a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d8aa7){logger['info'](_0x6c1a('0x21'),_0x493af1);logger['debug'](_0x6c1a('0x21'),_0x493af1,JSON['stringify'](_0x4d8aa7));_0x59b9fb(_0x4d8aa7);})['catch'](function(_0x1eacf5){logger[_0x6c1a('0x11')](_0x6c1a('0x21'),_0x1eacf5[_0x6c1a('0x13')],_0x493af1);_0x247a05(_0x18bce1[_0x6c1a('0x11')](0x1f4,_0x1eacf5[_0x6c1a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index c513d41..4e547e8 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 _0x0200=['isAuthenticated','send','exports','express','Router','../../components/auth/service','post'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0200,0x17d));var _0x0020=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x0200[_0x5cc8b9];return _0x58892e;};'use strict';var express=require(_0x0020('0x0'));var router=express[_0x0020('0x1')]();var auth=require(_0x0020('0x2'));var controller=require('./jira.controller');router[_0x0020('0x3')]('/',auth[_0x0020('0x4')](),controller[_0x0020('0x5')]);module[_0x0020('0x6')]=router; \ No newline at end of file +var _0x7f5f=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','express'];(function(_0x443f79,_0x33e446){var _0x3847e4=function(_0x42fa01){while(--_0x42fa01){_0x443f79['push'](_0x443f79['shift']());}};_0x3847e4(++_0x33e446);}(_0x7f5f,0xa0));var _0xf7f5=function(_0x56b1e3,_0x280580){_0x56b1e3=_0x56b1e3-0x0;var _0x28f013=_0x7f5f[_0x56b1e3];return _0x28f013;};'use strict';var express=require(_0xf7f5('0x0'));var router=express[_0xf7f5('0x1')]();var auth=require(_0xf7f5('0x2'));var controller=require(_0xf7f5('0x3'));router[_0xf7f5('0x4')]('/',auth[_0xf7f5('0x5')](),controller[_0xf7f5('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4fcf340..8e48d6a 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 _0x7dad=['customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken'];(function(_0x3b5ce3,_0x465fc4){var _0x3682ea=function(_0x5bebe3){while(--_0x5bebe3){_0x3b5ce3['push'](_0x3b5ce3['shift']());}};_0x3682ea(++_0x465fc4);}(_0x7dad,0x1bb));var _0xd7da=function(_0x2985d6,_0x2533a5){_0x2985d6=_0x2985d6-0x0;var _0x482bf1=_0x7dad[_0x2985d6];return _0x482bf1;};'use strict';var BPromise=require(_0xd7da('0x0'));var https=require('https');var logger=require(_0xd7da('0x1'))(_0xd7da('0x2'));var USERNAME=_0xd7da('0x3');var PASSWORD=_0xd7da('0x4');function openIssue(_0x1e24ee,_0x57e63d){var _0x3a2483={'fields':{'project':{'key':_0x1e24ee[_0xd7da('0x5')]||'MOTGUI'},'summary':(_0x1e24ee[_0xd7da('0x6')]||_0xd7da('0x7'))+_0xd7da('0x8')+_0x1e24ee['ip'],'description':_0x1e24ee[_0xd7da('0x9')]||JSON['stringify'](_0x1e24ee),'issuetype':{'name':_0x1e24ee[_0xd7da('0xa')]||_0xd7da('0xb')}}};_0x3a2483[_0xd7da('0xc')][_0xd7da('0xd')]=_0x1e24ee[_0xd7da('0xe')];_0x3a2483[_0xd7da('0xc')][_0xd7da('0xf')]=_0x1e24ee[_0xd7da('0x10')];_0x3a2483[_0xd7da('0xc')][_0xd7da('0x11')]=_0x1e24ee[_0xd7da('0x12')];_0x3a2483[_0xd7da('0xc')][_0xd7da('0x13')]=_0x1e24ee[_0xd7da('0x14')];_0x3a2483[_0xd7da('0xc')][_0xd7da('0x15')]=_0x1e24ee[_0xd7da('0x16')];_0x3a2483[_0xd7da('0xc')][_0xd7da('0x17')]=_0x1e24ee['ip'];var _0x5d575d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xd7da('0x18'),'method':_0xd7da('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xd7da('0x1a'),'Authorization':_0xd7da('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd7da('0x1c'))}};var _0x331aa4=JSON[_0xd7da('0x1d')](_0x3a2483);var _0x1b6676=https['request'](_0x5d575d,function(_0x326f0b){_0x326f0b[_0xd7da('0x1e')](_0xd7da('0x1f'));var _0x5ebea8='';_0x326f0b['on'](_0xd7da('0x20'),function(_0x3e2293){_0x5ebea8+=_0x3e2293;});_0x326f0b['on'](_0xd7da('0x21'),function(){if(_0x57e63d){return _0x57e63d[_0xd7da('0x22')](_0x326f0b[_0xd7da('0x23')])[_0xd7da('0x24')](JSON[_0xd7da('0x25')](_0x5ebea8));}});});_0x1b6676['on'](_0xd7da('0x26'),function(_0x2cf5fc){if(_0x57e63d){return _0x57e63d[_0xd7da('0x22')](0x1f4)[_0xd7da('0x24')]({'errors':[{'message':_0xd7da('0x27'),'type':_0xd7da('0x28')}]});}});_0x1b6676['write'](_0x331aa4);_0x1b6676['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x5c1ff3,_0x1ab118){_0x5c1ff3[_0xd7da('0x29')]['ip']=_0x5c1ff3['headers'][_0xd7da('0x2a')]||_0x5c1ff3[_0xd7da('0x2b')][_0xd7da('0x2c')]||_0x5c1ff3[_0xd7da('0x2d')][_0xd7da('0x2c')]||_0x5c1ff3[_0xd7da('0x2b')][_0xd7da('0x2d')][_0xd7da('0x2c')];return openIssue(_0x5c1ff3['body'],_0x1ab118);}; \ No newline at end of file +var _0x8dc4=['status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','data','end'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x8dc4,0x1ef));var _0x48dc=function(_0x3add2a,_0x37b717){_0x3add2a=_0x3add2a-0x0;var _0x22e891=_0x8dc4[_0x3add2a];return _0x22e891;};'use strict';var BPromise=require('bluebird');var https=require(_0x48dc('0x0'));var logger=require(_0x48dc('0x1'))(_0x48dc('0x2'));var USERNAME=_0x48dc('0x3');var PASSWORD=_0x48dc('0x4');function openIssue(_0x5ef75b,_0x23e018){var _0x508676={'fields':{'project':{'key':_0x5ef75b[_0x48dc('0x5')]||_0x48dc('0x6')},'summary':(_0x5ef75b[_0x48dc('0x7')]||_0x48dc('0x8'))+_0x48dc('0x9')+_0x5ef75b['ip'],'description':_0x5ef75b[_0x48dc('0xa')]||JSON[_0x48dc('0xb')](_0x5ef75b),'issuetype':{'name':_0x5ef75b[_0x48dc('0xc')]||_0x48dc('0xd')}}};_0x508676[_0x48dc('0xe')][_0x48dc('0xf')]=_0x5ef75b['email'];_0x508676[_0x48dc('0xe')][_0x48dc('0x10')]=_0x5ef75b[_0x48dc('0x11')];_0x508676[_0x48dc('0xe')][_0x48dc('0x12')]=_0x5ef75b[_0x48dc('0x13')];_0x508676[_0x48dc('0xe')][_0x48dc('0x14')]=_0x5ef75b[_0x48dc('0x15')];_0x508676[_0x48dc('0xe')][_0x48dc('0x16')]=_0x5ef75b[_0x48dc('0x17')];_0x508676[_0x48dc('0xe')]['customfield_10102']=_0x5ef75b['ip'];var _0x337268={'host':_0x48dc('0x18'),'port':0x1bb,'path':_0x48dc('0x19'),'method':_0x48dc('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0x48dc('0x1b'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x48dc('0x1c')](_0x48dc('0x1d'))}};var _0x533dc4=JSON[_0x48dc('0xb')](_0x508676);var _0x523468=https['request'](_0x337268,function(_0x4fe0ec){_0x4fe0ec[_0x48dc('0x1e')]('utf8');var _0x5d7930='';_0x4fe0ec['on'](_0x48dc('0x1f'),function(_0x14b734){_0x5d7930+=_0x14b734;});_0x4fe0ec['on'](_0x48dc('0x20'),function(){if(_0x23e018){return _0x23e018[_0x48dc('0x21')](_0x4fe0ec['statusCode'])[_0x48dc('0x22')](JSON[_0x48dc('0x23')](_0x5d7930));}});});_0x523468['on'](_0x48dc('0x24'),function(_0x1b05a7){if(_0x23e018){return _0x23e018[_0x48dc('0x21')](0x1f4)[_0x48dc('0x22')]({'errors':[{'message':_0x48dc('0x25'),'type':_0x48dc('0x26')}]});}});_0x523468[_0x48dc('0x27')](_0x533dc4);_0x523468[_0x48dc('0x20')]();}exports[_0x48dc('0x28')]=openIssue;exports[_0x48dc('0x29')]=function(_0x26e695,_0x483092){_0x26e695['body']['ip']=_0x26e695[_0x48dc('0x2a')][_0x48dc('0x2b')]||_0x26e695[_0x48dc('0x2c')][_0x48dc('0x2d')]||_0x26e695[_0x48dc('0x2e')][_0x48dc('0x2d')]||_0x26e695[_0x48dc('0x2c')][_0x48dc('0x2e')][_0x48dc('0x2d')];return openIssue(_0x26e695[_0x48dc('0x2f')],_0x483092);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5be33ca..c87938a 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 _0x6e04=['get','isAuthenticated','index','/:id','show','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x6e04,0xa2));var _0x46e0=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x6e04[_0x2d982d];return _0x4f36b0;};'use strict';var multer=require('multer');var util=require(_0x46e0('0x0'));var path=require(_0x46e0('0x1'));var timeout=require(_0x46e0('0x2'));var express=require(_0x46e0('0x3'));var router=express[_0x46e0('0x4')]();var auth=require(_0x46e0('0x5'));var interaction=require(_0x46e0('0x6'));var config=require('../../config/environment');var controller=require(_0x46e0('0x7'));router[_0x46e0('0x8')]('/',auth[_0x46e0('0x9')](),controller[_0x46e0('0xa')]);router[_0x46e0('0x8')]('/describe',auth[_0x46e0('0x9')](),controller['describe']);router['get'](_0x46e0('0xb'),auth[_0x46e0('0x9')](),controller[_0x46e0('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x46e0('0xd')]);router[_0x46e0('0xe')]('/:id',auth[_0x46e0('0x9')](),controller[_0x46e0('0xf')]);router['delete'](_0x46e0('0xb'),auth[_0x46e0('0x9')](),controller['destroy']);module[_0x46e0('0x10')]=router; \ No newline at end of file +var _0x9d46=['/:id','show','post','put','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x37ff16,_0x77a530){var _0x20dda1=function(_0x5ae040){while(--_0x5ae040){_0x37ff16['push'](_0x37ff16['shift']());}};_0x20dda1(++_0x77a530);}(_0x9d46,0x8d));var _0x69d4=function(_0x365ecb,_0x2596e7){_0x365ecb=_0x365ecb-0x0;var _0x31f81d=_0x9d46[_0x365ecb];return _0x31f81d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x69d4('0x0'));var express=require(_0x69d4('0x1'));var router=express[_0x69d4('0x2')]();var auth=require(_0x69d4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x69d4('0x4'));var controller=require('./jscriptyAnswerReport.controller');router[_0x69d4('0x5')]('/',auth[_0x69d4('0x6')](),controller['index']);router[_0x69d4('0x5')](_0x69d4('0x7'),auth[_0x69d4('0x6')](),controller[_0x69d4('0x8')]);router['get'](_0x69d4('0x9'),auth[_0x69d4('0x6')](),controller[_0x69d4('0xa')]);router[_0x69d4('0xb')]('/',auth[_0x69d4('0x6')](),controller['create']);router[_0x69d4('0xc')](_0x69d4('0x9'),auth[_0x69d4('0x6')](),controller['update']);router[_0x69d4('0xd')](_0x69d4('0x9'),auth[_0x69d4('0x6')](),controller[_0x69d4('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e576820..4ab7313 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 _0x3c43=['long','STRING','sequelize','exports','TEXT'];(function(_0x1fae3c,_0x41a75c){var _0x384ddf=function(_0x2c98f4){while(--_0x2c98f4){_0x1fae3c['push'](_0x1fae3c['shift']());}};_0x384ddf(++_0x41a75c);}(_0x3c43,0xc5));var _0x33c4=function(_0x543c26,_0x46b529){_0x543c26=_0x543c26-0x0;var _0x4a5722=_0x3c43[_0x543c26];return _0x4a5722;};'use strict';var Sequelize=require(_0x33c4('0x0'));module[_0x33c4('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x33c4('0x2')](_0x33c4('0x3'))},'membername':{'type':Sequelize[_0x33c4('0x4')]},'projectname':{'type':Sequelize[_0x33c4('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x33c4('0x4')]},'calleridname':{'type':Sequelize[_0x33c4('0x4')]},'calleridnum':{'type':Sequelize[_0x33c4('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c1c=['STRING','TEXT','long','sequelize'];(function(_0x4e75af,_0xecc2be){var _0x1954dd=function(_0x12d5b1){while(--_0x12d5b1){_0x4e75af['push'](_0x4e75af['shift']());}};_0x1954dd(++_0xecc2be);}(_0x8c1c,0x7b));var _0xc8c1=function(_0x4c061c,_0x4054f8){_0x4c061c=_0x4c061c-0x0;var _0x3f9a13=_0x8c1c[_0x4c061c];return _0x3f9a13;};'use strict';var Sequelize=require(_0xc8c1('0x0'));module['exports']={'question':{'type':Sequelize[_0xc8c1('0x1')]},'answer':{'type':Sequelize[_0xc8c1('0x2')](_0xc8c1('0x3'))},'membername':{'type':Sequelize[_0xc8c1('0x1')]},'projectname':{'type':Sequelize[_0xc8c1('0x1')]},'queue':{'type':Sequelize[_0xc8c1('0x1')]},'uniqueid':{'type':Sequelize[_0xc8c1('0x1')]},'calleridname':{'type':Sequelize[_0xc8c1('0x1')]},'calleridnum':{'type':Sequelize[_0xc8c1('0x1')]},'questionId':{'type':Sequelize[_0xc8c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 4dbadd0..1c3c811 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 _0xb350=['order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','save','update','then','end','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4bcbba,_0x83270f){var _0x3689ac=function(_0x5db2eb){while(--_0x5db2eb){_0x4bcbba['push'](_0x4bcbba['shift']());}};_0x3689ac(++_0x83270f);}(_0xb350,0xf2));var _0x0b35=function(_0x299392,_0x3eb1f9){_0x299392=_0x299392-0x0;var _0x4a0f4f=_0xb350[_0x299392];return _0x4a0f4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b35('0x0'));var rimraf=require(_0x0b35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b35('0x2'));var rp=require(_0x0b35('0x3'));var moment=require(_0x0b35('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0b35('0x5'));var path=require(_0x0b35('0x6'));var sox=require(_0x0b35('0x7'));var csv=require(_0x0b35('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0b35('0x9'));var crypto=require(_0x0b35('0xa'));var jsforce=require(_0x0b35('0xb'));var deskjs=require(_0x0b35('0xc'));var toCsv=require(_0x0b35('0x8'));var querystring=require(_0x0b35('0xd'));var Papa=require(_0x0b35('0xe'));var Redis=require(_0x0b35('0xf'));var authService=require(_0x0b35('0x10'));var qs=require(_0x0b35('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b35('0x12'));var logger=require('../../config/logger')(_0x0b35('0x13'));var utils=require(_0x0b35('0x14'));var config=require(_0x0b35('0x15'));var licenseUtil=require(_0x0b35('0x16'));var db=require(_0x0b35('0x17'))['db'];function respondWithStatusCode(_0x494710,_0xfcea89){_0xfcea89=_0xfcea89||0xcc;return function(_0x3db09b){if(_0x3db09b){return _0x494710[_0x0b35('0x18')](_0xfcea89);}return _0x494710[_0x0b35('0x19')](_0xfcea89)['end']();};}function respondWithResult(_0x34a19a,_0x1b7332){_0x1b7332=_0x1b7332||0xc8;return function(_0xe62a28){if(_0xe62a28){return _0x34a19a['status'](_0x1b7332)[_0x0b35('0x1a')](_0xe62a28);}};}function respondWithFilteredResult(_0x323cb1,_0x4755ba){return function(_0x17640f){if(_0x17640f){var _0x2b9681=_0x17640f[_0x0b35('0x1b')],_0xc0577f=_0x4755ba[_0x0b35('0x1c')],_0x74c52b=_0x4755ba[_0x0b35('0x1c')]+_0x4755ba[_0x0b35('0x1d')],_0x49c218;if(_0x74c52b>=_0x2b9681){_0x74c52b=_0x2b9681;_0x49c218=0xc8;}else{_0x49c218=0xce;}_0x323cb1['status'](_0x49c218);return _0x323cb1['set']('Content-Range',_0xc0577f+'-'+_0x74c52b+'/'+_0x2b9681)[_0x0b35('0x1a')](_0x17640f);}return null;};}function patchUpdates(_0x4a7d2b){return function(_0x231a23){try{jsonpatch['apply'](_0x231a23,_0x4a7d2b,!![]);}catch(_0x234ed0){return BPromise['reject'](_0x234ed0);}return _0x231a23[_0x0b35('0x1e')]();};}function saveUpdates(_0x1a1288,_0x4b3456){return function(_0x3856b7){if(_0x3856b7){return _0x3856b7[_0x0b35('0x1f')](_0x1a1288)[_0x0b35('0x20')](function(_0x242fd0){return _0x242fd0;});}return null;};}function removeEntity(_0x20cfe0,_0x4fbccb){return function(_0x2c8b60){if(_0x2c8b60){return _0x2c8b60['destroy']()[_0x0b35('0x20')](function(){_0x20cfe0[_0x0b35('0x19')](0xcc)[_0x0b35('0x21')]();});}};}function handleEntityNotFound(_0x8014ae,_0x4a10ca){return function(_0x3140ce){if(!_0x3140ce){_0x8014ae[_0x0b35('0x18')](0x194);}return _0x3140ce;};}function handleError(_0x5ec620,_0x52a47f){_0x52a47f=_0x52a47f||0x1f4;return function(_0x595a9c){logger[_0x0b35('0x22')](_0x595a9c[_0x0b35('0x23')]);if(_0x595a9c[_0x0b35('0x24')]){delete _0x595a9c[_0x0b35('0x24')];}_0x5ec620[_0x0b35('0x19')](_0x52a47f)[_0x0b35('0x25')](_0x595a9c);};}exports[_0x0b35('0x26')]=function(_0x53890f,_0x4d7cf0){var _0x5ae177={},_0x5ebe43={},_0x26e907={'count':0x0,'rows':[]};var _0x29682a=_[_0x0b35('0x27')](db[_0x0b35('0x28')]['rawAttributes'],function(_0x3e0e26){return{'name':_0x3e0e26[_0x0b35('0x29')],'type':_0x3e0e26[_0x0b35('0x2a')][_0x0b35('0x2b')]};});_0x5ebe43['model']=_[_0x0b35('0x27')](_0x29682a,'name');_0x5ebe43[_0x0b35('0x2c')]=_[_0x0b35('0x2d')](_0x53890f['query']);_0x5ebe43[_0x0b35('0x2e')]=_[_0x0b35('0x2f')](_0x5ebe43[_0x0b35('0x30')],_0x5ebe43[_0x0b35('0x2c')]);_0x5ae177[_0x0b35('0x31')]=_[_0x0b35('0x2f')](_0x5ebe43[_0x0b35('0x30')],qs[_0x0b35('0x32')](_0x53890f[_0x0b35('0x2c')][_0x0b35('0x32')]));_0x5ae177[_0x0b35('0x31')]=_0x5ae177[_0x0b35('0x31')][_0x0b35('0x33')]?_0x5ae177[_0x0b35('0x31')]:_0x5ebe43[_0x0b35('0x30')];if(!_0x53890f['query'][_0x0b35('0x34')](_0x0b35('0x35'))){_0x5ae177[_0x0b35('0x1d')]=qs[_0x0b35('0x1d')](_0x53890f[_0x0b35('0x2c')][_0x0b35('0x1d')]);_0x5ae177[_0x0b35('0x1c')]=qs[_0x0b35('0x1c')](_0x53890f['query'][_0x0b35('0x1c')]);}_0x5ae177[_0x0b35('0x36')]=qs[_0x0b35('0x37')](_0x53890f[_0x0b35('0x2c')]['sort']);_0x5ae177[_0x0b35('0x38')]=qs[_0x0b35('0x2e')](_[_0x0b35('0x39')](_0x53890f['query'],_0x5ebe43[_0x0b35('0x2e')]),_0x29682a);if(_0x53890f['query'][_0x0b35('0x3a')]){_0x5ae177[_0x0b35('0x38')]=_[_0x0b35('0x3b')](_0x5ae177['where'],{'$or':_[_0x0b35('0x27')](_0x29682a,function(_0x2d6b78){if(_0x2d6b78[_0x0b35('0x2a')]!==_0x0b35('0x3c')){var _0x2a12e9={};_0x2a12e9[_0x2d6b78[_0x0b35('0x24')]]={'$like':'%'+_0x53890f['query'][_0x0b35('0x3a')]+'%'};return _0x2a12e9;}})});}_0x5ae177=_['merge']({},_0x5ae177,_0x53890f[_0x0b35('0x3d')]);var _0x1f8c08={'where':_0x5ae177[_0x0b35('0x38')]};return db[_0x0b35('0x28')][_0x0b35('0x1b')](_0x1f8c08)[_0x0b35('0x20')](function(_0x4d298e){_0x26e907[_0x0b35('0x1b')]=_0x4d298e;if(_0x53890f[_0x0b35('0x2c')]['includeAll']){_0x5ae177['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x0b35('0x3e')](_0x5ae177);})[_0x0b35('0x20')](function(_0x1e34de){_0x26e907[_0x0b35('0x3f')]=_0x1e34de;return _0x26e907;})[_0x0b35('0x20')](respondWithFilteredResult(_0x4d7cf0,_0x5ae177))[_0x0b35('0x40')](handleError(_0x4d7cf0,null));};exports[_0x0b35('0x41')]=function(_0x38bb87,_0x40eea1){var _0x4e974b={'raw':!![],'where':{'id':_0x38bb87[_0x0b35('0x42')]['id']}},_0x34404a={};_0x34404a['model']=_[_0x0b35('0x2d')](db[_0x0b35('0x28')][_0x0b35('0x43')]);_0x34404a['query']=_['keys'](_0x38bb87[_0x0b35('0x2c')]);_0x34404a['filters']=_[_0x0b35('0x2f')](_0x34404a[_0x0b35('0x30')],_0x34404a[_0x0b35('0x2c')]);_0x4e974b[_0x0b35('0x31')]=_[_0x0b35('0x2f')](_0x34404a[_0x0b35('0x30')],qs[_0x0b35('0x32')](_0x38bb87[_0x0b35('0x2c')][_0x0b35('0x32')]));_0x4e974b[_0x0b35('0x31')]=_0x4e974b[_0x0b35('0x31')]['length']?_0x4e974b['attributes']:_0x34404a[_0x0b35('0x30')];if(_0x38bb87[_0x0b35('0x2c')]['includeAll']){_0x4e974b[_0x0b35('0x44')]=[{'all':!![]}];}_0x4e974b=_[_0x0b35('0x3b')]({},_0x4e974b,_0x38bb87[_0x0b35('0x3d')]);return db[_0x0b35('0x28')][_0x0b35('0x45')](_0x4e974b)[_0x0b35('0x20')](handleEntityNotFound(_0x40eea1,null))[_0x0b35('0x20')](respondWithResult(_0x40eea1,null))[_0x0b35('0x40')](handleError(_0x40eea1,null));};exports[_0x0b35('0x46')]=function(_0x4d6e10,_0xe04499){return db[_0x0b35('0x28')]['create'](_0x4d6e10[_0x0b35('0x47')],{})[_0x0b35('0x20')](respondWithResult(_0xe04499,0xc9))[_0x0b35('0x40')](handleError(_0xe04499,null));};exports[_0x0b35('0x1f')]=function(_0x5011f9,_0x40d106){if(_0x5011f9[_0x0b35('0x47')]['id']){delete _0x5011f9[_0x0b35('0x47')]['id'];}return db['JscriptyAnswerReport'][_0x0b35('0x45')]({'where':{'id':_0x5011f9[_0x0b35('0x42')]['id']}})[_0x0b35('0x20')](handleEntityNotFound(_0x40d106,null))['then'](saveUpdates(_0x5011f9[_0x0b35('0x47')],null))[_0x0b35('0x20')](respondWithResult(_0x40d106,null))[_0x0b35('0x40')](handleError(_0x40d106,null));};exports[_0x0b35('0x48')]=function(_0x40b46d,_0xe9f656){return db[_0x0b35('0x28')][_0x0b35('0x45')]({'where':{'id':_0x40b46d[_0x0b35('0x42')]['id']}})[_0x0b35('0x20')](handleEntityNotFound(_0xe9f656,null))[_0x0b35('0x20')](removeEntity(_0xe9f656,null))['catch'](handleError(_0xe9f656,null));};exports[_0x0b35('0x49')]=function(_0x31b890,_0x520b5a){return db[_0x0b35('0x28')]['describe']()['then'](respondWithResult(_0x520b5a,null))['catch'](handleError(_0x520b5a,null));}; \ No newline at end of file +var _0x8e9e=['reject','update','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','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(_0x52c1b6,_0x5eeb6d){var _0x3a1202=function(_0x100b48){while(--_0x100b48){_0x52c1b6['push'](_0x52c1b6['shift']());}};_0x3a1202(++_0x5eeb6d);}(_0x8e9e,0x199));var _0xe8e9=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x8e9e[_0x4370c7];return _0xce78a9;};'use strict';var pdf=require(_0xe8e9('0x0'));var emlformat=require(_0xe8e9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe8e9('0x2'));var jsonpatch=require(_0xe8e9('0x3'));var rp=require(_0xe8e9('0x4'));var moment=require('moment');var BPromise=require(_0xe8e9('0x5'));var Mustache=require(_0xe8e9('0x6'));var util=require(_0xe8e9('0x7'));var path=require(_0xe8e9('0x8'));var sox=require('sox');var csv=require(_0xe8e9('0x9'));var ejs=require(_0xe8e9('0xa'));var fs=require('fs');var _=require(_0xe8e9('0xb'));var squel=require(_0xe8e9('0xc'));var crypto=require('crypto');var jsforce=require(_0xe8e9('0xd'));var deskjs=require(_0xe8e9('0xe'));var toCsv=require(_0xe8e9('0x9'));var querystring=require(_0xe8e9('0xf'));var Papa=require('papaparse');var Redis=require(_0xe8e9('0x10'));var authService=require(_0xe8e9('0x11'));var qs=require(_0xe8e9('0x12'));var as=require(_0xe8e9('0x13'));var hardwareService=require(_0xe8e9('0x14'));var logger=require(_0xe8e9('0x15'))(_0xe8e9('0x16'));var utils=require(_0xe8e9('0x17'));var config=require(_0xe8e9('0x18'));var licenseUtil=require(_0xe8e9('0x19'));var db=require(_0xe8e9('0x1a'))['db'];function respondWithStatusCode(_0x1cd421,_0x212bd4){_0x212bd4=_0x212bd4||0xcc;return function(_0x3f3bf9){if(_0x3f3bf9){return _0x1cd421[_0xe8e9('0x1b')](_0x212bd4);}return _0x1cd421[_0xe8e9('0x1c')](_0x212bd4)[_0xe8e9('0x1d')]();};}function respondWithResult(_0x2d4587,_0x5beed2){_0x5beed2=_0x5beed2||0xc8;return function(_0x4629d7){if(_0x4629d7){return _0x2d4587[_0xe8e9('0x1c')](_0x5beed2)[_0xe8e9('0x1e')](_0x4629d7);}};}function respondWithFilteredResult(_0x43ea39,_0x14325f){return function(_0xa0d7b2){if(_0xa0d7b2){var _0x5d6bb2=_0xa0d7b2[_0xe8e9('0x1f')],_0x2abef7=_0x14325f[_0xe8e9('0x20')],_0x1e0437=_0x14325f[_0xe8e9('0x20')]+_0x14325f[_0xe8e9('0x21')],_0x51f7a6;if(_0x1e0437>=_0x5d6bb2){_0x1e0437=_0x5d6bb2;_0x51f7a6=0xc8;}else{_0x51f7a6=0xce;}_0x43ea39[_0xe8e9('0x1c')](_0x51f7a6);return _0x43ea39[_0xe8e9('0x22')]('Content-Range',_0x2abef7+'-'+_0x1e0437+'/'+_0x5d6bb2)[_0xe8e9('0x1e')](_0xa0d7b2);}return null;};}function patchUpdates(_0x1b6285){return function(_0x47a8a9){try{jsonpatch['apply'](_0x47a8a9,_0x1b6285,!![]);}catch(_0x36ec49){return BPromise[_0xe8e9('0x23')](_0x36ec49);}return _0x47a8a9['save']();};}function saveUpdates(_0x30f890,_0x49f113){return function(_0x4cbd35){if(_0x4cbd35){return _0x4cbd35[_0xe8e9('0x24')](_0x30f890)[_0xe8e9('0x25')](function(_0x9984ea){return _0x9984ea;});}return null;};}function removeEntity(_0x56deaf,_0x7e1018){return function(_0x8cf789){if(_0x8cf789){return _0x8cf789['destroy']()[_0xe8e9('0x25')](function(){_0x56deaf[_0xe8e9('0x1c')](0xcc)[_0xe8e9('0x1d')]();});}};}function handleEntityNotFound(_0x249442,_0x53347c){return function(_0x20cbdb){if(!_0x20cbdb){_0x249442[_0xe8e9('0x1b')](0x194);}return _0x20cbdb;};}function handleError(_0x5a2eb3,_0x137d27){_0x137d27=_0x137d27||0x1f4;return function(_0x1d84c0){logger[_0xe8e9('0x26')](_0x1d84c0[_0xe8e9('0x27')]);if(_0x1d84c0[_0xe8e9('0x28')]){delete _0x1d84c0['name'];}_0x5a2eb3[_0xe8e9('0x1c')](_0x137d27)[_0xe8e9('0x29')](_0x1d84c0);};}exports['index']=function(_0xd5ef7d,_0x19c991){var _0x4668b1={},_0x46bcdc={},_0x6f4488={'count':0x0,'rows':[]};var _0x21321e=_[_0xe8e9('0x2a')](db[_0xe8e9('0x2b')][_0xe8e9('0x2c')],function(_0x543a5d){return{'name':_0x543a5d[_0xe8e9('0x2d')],'type':_0x543a5d['type']['key']};});_0x46bcdc['model']=_[_0xe8e9('0x2a')](_0x21321e,_0xe8e9('0x28'));_0x46bcdc[_0xe8e9('0x2e')]=_['keys'](_0xd5ef7d[_0xe8e9('0x2e')]);_0x46bcdc[_0xe8e9('0x2f')]=_['intersection'](_0x46bcdc[_0xe8e9('0x30')],_0x46bcdc[_0xe8e9('0x2e')]);_0x4668b1[_0xe8e9('0x31')]=_[_0xe8e9('0x32')](_0x46bcdc[_0xe8e9('0x30')],qs[_0xe8e9('0x33')](_0xd5ef7d[_0xe8e9('0x2e')][_0xe8e9('0x33')]));_0x4668b1[_0xe8e9('0x31')]=_0x4668b1[_0xe8e9('0x31')][_0xe8e9('0x34')]?_0x4668b1['attributes']:_0x46bcdc[_0xe8e9('0x30')];if(!_0xd5ef7d['query'][_0xe8e9('0x35')]('nolimit')){_0x4668b1[_0xe8e9('0x21')]=qs[_0xe8e9('0x21')](_0xd5ef7d['query'][_0xe8e9('0x21')]);_0x4668b1[_0xe8e9('0x20')]=qs[_0xe8e9('0x20')](_0xd5ef7d[_0xe8e9('0x2e')][_0xe8e9('0x20')]);}_0x4668b1[_0xe8e9('0x36')]=qs[_0xe8e9('0x37')](_0xd5ef7d[_0xe8e9('0x2e')]['sort']);_0x4668b1[_0xe8e9('0x38')]=qs[_0xe8e9('0x2f')](_[_0xe8e9('0x39')](_0xd5ef7d[_0xe8e9('0x2e')],_0x46bcdc[_0xe8e9('0x2f')]),_0x21321e);if(_0xd5ef7d[_0xe8e9('0x2e')][_0xe8e9('0x3a')]){_0x4668b1[_0xe8e9('0x38')]=_['merge'](_0x4668b1['where'],{'$or':_[_0xe8e9('0x2a')](_0x21321e,function(_0x55c903){if(_0x55c903[_0xe8e9('0x3b')]!=='VIRTUAL'){var _0x582eae={};_0x582eae[_0x55c903['name']]={'$like':'%'+_0xd5ef7d['query'][_0xe8e9('0x3a')]+'%'};return _0x582eae;}})});}_0x4668b1=_[_0xe8e9('0x3c')]({},_0x4668b1,_0xd5ef7d[_0xe8e9('0x3d')]);var _0x1e9928={'where':_0x4668b1[_0xe8e9('0x38')]};return db['JscriptyAnswerReport']['count'](_0x1e9928)[_0xe8e9('0x25')](function(_0x55348c){_0x6f4488[_0xe8e9('0x1f')]=_0x55348c;if(_0xd5ef7d[_0xe8e9('0x2e')][_0xe8e9('0x3e')]){_0x4668b1[_0xe8e9('0x3f')]=[{'all':!![]}];}return db[_0xe8e9('0x2b')][_0xe8e9('0x40')](_0x4668b1);})['then'](function(_0x5a84be){_0x6f4488['rows']=_0x5a84be;return _0x6f4488;})[_0xe8e9('0x25')](respondWithFilteredResult(_0x19c991,_0x4668b1))[_0xe8e9('0x41')](handleError(_0x19c991,null));};exports[_0xe8e9('0x42')]=function(_0x22c85b,_0x5563a1){var _0x3adb84={'raw':!![],'where':{'id':_0x22c85b[_0xe8e9('0x43')]['id']}},_0x95d5a={};_0x95d5a[_0xe8e9('0x30')]=_[_0xe8e9('0x44')](db[_0xe8e9('0x2b')][_0xe8e9('0x2c')]);_0x95d5a[_0xe8e9('0x2e')]=_['keys'](_0x22c85b[_0xe8e9('0x2e')]);_0x95d5a[_0xe8e9('0x2f')]=_['intersection'](_0x95d5a[_0xe8e9('0x30')],_0x95d5a[_0xe8e9('0x2e')]);_0x3adb84[_0xe8e9('0x31')]=_[_0xe8e9('0x32')](_0x95d5a['model'],qs[_0xe8e9('0x33')](_0x22c85b[_0xe8e9('0x2e')]['fields']));_0x3adb84[_0xe8e9('0x31')]=_0x3adb84[_0xe8e9('0x31')][_0xe8e9('0x34')]?_0x3adb84[_0xe8e9('0x31')]:_0x95d5a[_0xe8e9('0x30')];if(_0x22c85b['query'][_0xe8e9('0x3e')]){_0x3adb84[_0xe8e9('0x3f')]=[{'all':!![]}];}_0x3adb84=_[_0xe8e9('0x3c')]({},_0x3adb84,_0x22c85b['options']);return db[_0xe8e9('0x2b')][_0xe8e9('0x45')](_0x3adb84)[_0xe8e9('0x25')](handleEntityNotFound(_0x5563a1,null))[_0xe8e9('0x25')](respondWithResult(_0x5563a1,null))[_0xe8e9('0x41')](handleError(_0x5563a1,null));};exports['create']=function(_0x5e2bc4,_0x1ef3b2){return db['JscriptyAnswerReport'][_0xe8e9('0x46')](_0x5e2bc4['body'],{})['then'](respondWithResult(_0x1ef3b2,0xc9))['catch'](handleError(_0x1ef3b2,null));};exports[_0xe8e9('0x24')]=function(_0x39928c,_0x58315a){if(_0x39928c[_0xe8e9('0x47')]['id']){delete _0x39928c[_0xe8e9('0x47')]['id'];}return db[_0xe8e9('0x2b')][_0xe8e9('0x45')]({'where':{'id':_0x39928c['params']['id']}})[_0xe8e9('0x25')](handleEntityNotFound(_0x58315a,null))[_0xe8e9('0x25')](saveUpdates(_0x39928c[_0xe8e9('0x47')],null))['then'](respondWithResult(_0x58315a,null))[_0xe8e9('0x41')](handleError(_0x58315a,null));};exports[_0xe8e9('0x48')]=function(_0x56764f,_0x5e9340){return db['JscriptyAnswerReport'][_0xe8e9('0x45')]({'where':{'id':_0x56764f[_0xe8e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e9340,null))[_0xe8e9('0x25')](removeEntity(_0x5e9340,null))[_0xe8e9('0x41')](handleError(_0x5e9340,null));};exports[_0xe8e9('0x49')]=function(_0x56f6ec,_0x59f6a7){return db['JscriptyAnswerReport'][_0xe8e9('0x49')]()[_0xe8e9('0x25')](respondWithResult(_0x59f6a7,null))[_0xe8e9('0x41')](handleError(_0x59f6a7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f9a8f06..1d5deed 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 _0x35cf=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','bluebird'];(function(_0x2582e6,_0x1c15f1){var _0x391e57=function(_0x500b87){while(--_0x500b87){_0x2582e6['push'](_0x2582e6['shift']());}};_0x391e57(++_0x1c15f1);}(_0x35cf,0xbf));var _0xf35c=function(_0x6317d6,_0x424384){_0x6317d6=_0x6317d6-0x0;var _0x5add4d=_0x35cf[_0x6317d6];return _0x5add4d;};'use strict';var _=require(_0xf35c('0x0'));var util=require(_0xf35c('0x1'));var logger=require(_0xf35c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf35c('0x3'));var rp=require(_0xf35c('0x4'));var fs=require('fs');var path=require(_0xf35c('0x5'));var rimraf=require(_0xf35c('0x6'));var config=require(_0xf35c('0x7'));var attributes=require(_0xf35c('0x8'));module[_0xf35c('0x9')]=function(_0x1bd1ad,_0x5795e3){return _0x1bd1ad[_0xf35c('0xa')](_0xf35c('0xb'),attributes,{'tableName':_0xf35c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5094=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x5d61fa,_0x5428fe){var _0x271751=function(_0xa87023){while(--_0xa87023){_0x5d61fa['push'](_0x5d61fa['shift']());}};_0x271751(++_0x5428fe);}(_0x5094,0x6a));var _0x4509=function(_0x26dfc5,_0x138166){_0x26dfc5=_0x26dfc5-0x0;var _0x566350=_0x5094[_0x26dfc5];return _0x566350;};'use strict';var _=require(_0x4509('0x0'));var util=require(_0x4509('0x1'));var logger=require(_0x4509('0x2'))(_0x4509('0x3'));var moment=require(_0x4509('0x4'));var BPromise=require(_0x4509('0x5'));var rp=require(_0x4509('0x6'));var fs=require('fs');var path=require(_0x4509('0x7'));var rimraf=require(_0x4509('0x8'));var config=require('../../config/environment');var attributes=require(_0x4509('0x9'));module['exports']=function(_0x48d28e,_0x144208){return _0x48d28e['define'](_0x4509('0xa'),attributes,{'tableName':_0x4509('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 3824020..d0c33b2 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 _0x52f6=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','bluebird','ioredis'];(function(_0x370911,_0x572aee){var _0x5458fa=function(_0xf22267){while(--_0xf22267){_0x370911['push'](_0x370911['shift']());}};_0x5458fa(++_0x572aee);}(_0x52f6,0x6f));var _0x652f=function(_0x562728,_0xc6a15e){_0x562728=_0x562728-0x0;var _0x1b3a8a=_0x52f6[_0x562728];return _0x1b3a8a;};'use strict';var _=require(_0x652f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x652f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x652f('0x2'));var db=require(_0x652f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x652f('0x4'))(_0x652f('0x5'));var config=require(_0x652f('0x6'));var jayson=require(_0x652f('0x7'));var client=jayson[_0x652f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aca73,_0x562ea6,_0x1f392f){return new BPromise(function(_0xdeb3e1,_0x3b50d4){return client[_0x652f('0x9')](_0x4aca73,_0x1f392f)[_0x652f('0xa')](function(_0x3a741c){logger['info'](_0x652f('0xb'),_0x562ea6,_0x652f('0xc'));logger['debug'](_0x652f('0xd'),_0x562ea6,_0x652f('0xc'),JSON['stringify'](_0x3a741c));if(_0x3a741c['error']){if(_0x3a741c[_0x652f('0xe')]['code']===0x1f4){logger[_0x652f('0xe')](_0x652f('0xb'),_0x562ea6,_0x3a741c['error'][_0x652f('0xf')]);return _0x3b50d4(_0x3a741c[_0x652f('0xe')][_0x652f('0xf')]);}logger[_0x652f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x562ea6,_0x3a741c['error'][_0x652f('0xf')]);return _0xdeb3e1(_0x3a741c['error'][_0x652f('0xf')]);}else{logger[_0x652f('0x10')](_0x652f('0xb'),_0x562ea6,_0x652f('0xc'));_0xdeb3e1(_0x3a741c[_0x652f('0x11')]['message']);}})[_0x652f('0x12')](function(_0xd78089){logger[_0x652f('0xe')](_0x652f('0xb'),_0x562ea6,_0xd78089);_0x3b50d4(_0xd78089);});});} \ No newline at end of file +var _0xec37=['jayson/promise','client','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xec37,0xc1));var _0x7ec3=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xec37[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0x7ec3('0x0'));var util=require('util');var moment=require(_0x7ec3('0x1'));var BPromise=require(_0x7ec3('0x2'));var rs=require(_0x7ec3('0x3'));var fs=require('fs');var Redis=require(_0x7ec3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ec3('0x5'));var logger=require('../../config/logger')(_0x7ec3('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ec3('0x7'));var client=jayson[_0x7ec3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40bfba,_0xeede1a,_0x43c04b){return new BPromise(function(_0x44d4e7,_0xadbccb){return client[_0x7ec3('0x9')](_0x40bfba,_0x43c04b)['then'](function(_0x1393db){logger[_0x7ec3('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xeede1a,_0x7ec3('0xb'));logger[_0x7ec3('0xc')](_0x7ec3('0xd'),_0xeede1a,_0x7ec3('0xb'),JSON[_0x7ec3('0xe')](_0x1393db));if(_0x1393db[_0x7ec3('0xf')]){if(_0x1393db[_0x7ec3('0xf')][_0x7ec3('0x10')]===0x1f4){logger[_0x7ec3('0xf')](_0x7ec3('0x11'),_0xeede1a,_0x1393db[_0x7ec3('0xf')][_0x7ec3('0x12')]);return _0xadbccb(_0x1393db[_0x7ec3('0xf')][_0x7ec3('0x12')]);}logger[_0x7ec3('0xf')](_0x7ec3('0x11'),_0xeede1a,_0x1393db[_0x7ec3('0xf')][_0x7ec3('0x12')]);return _0x44d4e7(_0x1393db[_0x7ec3('0xf')][_0x7ec3('0x12')]);}else{logger['info'](_0x7ec3('0x11'),_0xeede1a,_0x7ec3('0xb'));_0x44d4e7(_0x1393db[_0x7ec3('0x13')]['message']);}})['catch'](function(_0x41967f){logger['error'](_0x7ec3('0x11'),_0xeede1a,_0x41967f);_0xadbccb(_0x41967f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f3a969c..3883dac 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 _0x85ed=['post','create','clone','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getSummary'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0x85ed,0xa9));var _0xd85e=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x85ed[_0x5d7227];return _0x15ac55;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd85e('0x0'));var express=require(_0xd85e('0x1'));var router=express[_0xd85e('0x2')]();var auth=require(_0xd85e('0x3'));var interaction=require(_0xd85e('0x4'));var config=require(_0xd85e('0x5'));var controller=require(_0xd85e('0x6'));router[_0xd85e('0x7')]('/',auth[_0xd85e('0x8')](),controller[_0xd85e('0x9')]);router[_0xd85e('0x7')](_0xd85e('0xa'),auth[_0xd85e('0x8')](),controller[_0xd85e('0xb')]);router[_0xd85e('0x7')]('/:id/sessions',auth[_0xd85e('0x8')](),controller[_0xd85e('0xc')]);router[_0xd85e('0x7')](_0xd85e('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xd85e('0x7')]('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0xd85e('0xe')]);router[_0xd85e('0xf')]('/',auth[_0xd85e('0x8')](),controller[_0xd85e('0x10')]);router[_0xd85e('0xf')]('/:id/clone',auth[_0xd85e('0x8')](),controller[_0xd85e('0x11')]);router[_0xd85e('0x12')](_0xd85e('0xa'),auth['isAuthenticated'](),controller[_0xd85e('0x13')]);router[_0xd85e('0x14')](_0xd85e('0xa'),auth[_0xd85e('0x8')](),controller[_0xd85e('0x15')]);module[_0xd85e('0x16')]=router; \ No newline at end of file +var _0x3c54=['put','delete','destroy','multer','util','express','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone'];(function(_0x3774ed,_0x45d4c6){var _0x448104=function(_0xda2a3){while(--_0xda2a3){_0x3774ed['push'](_0x3774ed['shift']());}};_0x448104(++_0x45d4c6);}(_0x3c54,0x6c));var _0x43c5=function(_0x452feb,_0x415aa4){_0x452feb=_0x452feb-0x0;var _0x48d305=_0x3c54[_0x452feb];return _0x48d305;};'use strict';var multer=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43c5('0x2'));var router=express['Router']();var auth=require(_0x43c5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x43c5('0x4'));var controller=require(_0x43c5('0x5'));router[_0x43c5('0x6')]('/',auth[_0x43c5('0x7')](),controller[_0x43c5('0x8')]);router[_0x43c5('0x6')](_0x43c5('0x9'),auth[_0x43c5('0x7')](),controller['show']);router[_0x43c5('0x6')](_0x43c5('0xa'),auth['isAuthenticated'](),controller['getSessions']);router[_0x43c5('0x6')](_0x43c5('0xb'),auth['isAuthenticated'](),controller[_0x43c5('0xc')]);router[_0x43c5('0x6')](_0x43c5('0xd'),auth[_0x43c5('0x7')](),timeout(_0x43c5('0xe')),controller['getSummary']);router[_0x43c5('0xf')]('/',auth['isAuthenticated'](),controller[_0x43c5('0x10')]);router['post'](_0x43c5('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0x43c5('0x12')]('/:id',auth[_0x43c5('0x7')](),controller['update']);router[_0x43c5('0x13')](_0x43c5('0x9'),auth[_0x43c5('0x7')](),controller[_0x43c5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 84e8d47..d7f5580 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 _0x3a08=['formData','stringify','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','STRING','name','TEXT'];(function(_0x47666d,_0x5e00af){var _0x2f87aa=function(_0x3b1d49){while(--_0x3b1d49){_0x47666d['push'](_0x47666d['shift']());}};_0x2f87aa(++_0x5e00af);}(_0x3a08,0x104));var _0x83a0=function(_0x165c96,_0x5069d0){_0x165c96=_0x165c96-0x0;var _0x588015=_0x3a08[_0x165c96];return _0x588015;};'use strict';var Sequelize=require(_0x83a0('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0x83a0('0x1')],'unique':_0x83a0('0x2')},'description':{'type':Sequelize[_0x83a0('0x1')]},'formData':{'type':Sequelize[_0x83a0('0x3')]('long'),'set':function(_0x7c94e4){if(_['isObjectLike'](_0x7c94e4)){this['setDataValue'](_0x83a0('0x4'),JSON[_0x83a0('0x5')](_0x7c94e4));}else if(_['isString'](_0x7c94e4)){this[_0x83a0('0x6')](_0x83a0('0x4'),_0x7c94e4);}else{this[_0x83a0('0x6')](_0x83a0('0x4'),util['format'](_0x83a0('0x7'),this[_0x83a0('0x8')](_0x83a0('0x2'))||'',this['getDataValue'](_0x83a0('0x9'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x83a0('0xa')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7035=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','name','isObjectLike','formData','stringify','setDataValue'];(function(_0x1fcff3,_0x488e7c){var _0x3ac0dc=function(_0x323c67){while(--_0x323c67){_0x1fcff3['push'](_0x1fcff3['shift']());}};_0x3ac0dc(++_0x488e7c);}(_0x7035,0x108));var _0x5703=function(_0x1a2123,_0x1c7cd7){_0x1a2123=_0x1a2123-0x0;var _0x3ff721=_0x7035[_0x1a2123];return _0x3ff721;};'use strict';var Sequelize=require(_0x5703('0x0'));var _=require(_0x5703('0x1'));var util=require('util');module[_0x5703('0x2')]={'name':{'type':Sequelize[_0x5703('0x3')],'unique':_0x5703('0x4')},'description':{'type':Sequelize[_0x5703('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x1230f2){if(_[_0x5703('0x5')](_0x1230f2)){this['setDataValue'](_0x5703('0x6'),JSON[_0x5703('0x7')](_0x1230f2));}else if(_['isString'](_0x1230f2)){this[_0x5703('0x8')](_0x5703('0x6'),_0x1230f2);}else{this[_0x5703('0x8')](_0x5703('0x6'),util['format'](_0x5703('0x9'),this['getDataValue']('name')||'',this[_0x5703('0xa')](_0x5703('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5703('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5703('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d8021f0..42191fa 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 _0x14c0=['nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','catch','show','params','merge','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','clone','include','omit','createdAt','updatedAt','role','error','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','stack','name','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x2218dc,_0x5f2a60){var _0x21106a=function(_0x58e538){while(--_0x58e538){_0x2218dc['push'](_0x2218dc['shift']());}};_0x21106a(++_0x5f2a60);}(_0x14c0,0x129));var _0x014c=function(_0x54b7fa,_0x3650df){_0x54b7fa=_0x54b7fa-0x0;var _0x58000f=_0x14c0[_0x54b7fa];return _0x58000f;};'use strict';var pdf=require(_0x014c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x014c('0x1'));var jsonpatch=require(_0x014c('0x2'));var rp=require(_0x014c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x014c('0x4'));var util=require(_0x014c('0x5'));var path=require(_0x014c('0x6'));var sox=require(_0x014c('0x7'));var csv=require(_0x014c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x014c('0x9'));var squel=require(_0x014c('0xa'));var crypto=require(_0x014c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x014c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x014c('0xd'));var Papa=require('papaparse');var Redis=require(_0x014c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x014c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x014c('0x10'));var logger=require(_0x014c('0x11'))(_0x014c('0x12'));var utils=require(_0x014c('0x13'));var config=require(_0x014c('0x14'));var licenseUtil=require(_0x014c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3021ee,_0x108483){_0x108483=_0x108483||0xcc;return function(_0x409dc5){if(_0x409dc5){return _0x3021ee[_0x014c('0x16')](_0x108483);}return _0x3021ee['status'](_0x108483)[_0x014c('0x17')]();};}function respondWithResult(_0x15f12b,_0x112a9e){_0x112a9e=_0x112a9e||0xc8;return function(_0x384094){if(_0x384094){return _0x15f12b[_0x014c('0x18')](_0x112a9e)['json'](_0x384094);}};}function respondWithFilteredResult(_0x277e38,_0x4e29b7){return function(_0xe469b){if(_0xe469b){var _0x2e0f16=_0xe469b[_0x014c('0x19')],_0x554a2a=_0x4e29b7[_0x014c('0x1a')],_0x59b9f4=_0x4e29b7[_0x014c('0x1a')]+_0x4e29b7['limit'],_0x17dd99;if(_0x59b9f4>=_0x2e0f16){_0x59b9f4=_0x2e0f16;_0x17dd99=0xc8;}else{_0x17dd99=0xce;}_0x277e38['status'](_0x17dd99);return _0x277e38[_0x014c('0x1b')](_0x014c('0x1c'),_0x554a2a+'-'+_0x59b9f4+'/'+_0x2e0f16)['json'](_0xe469b);}return null;};}function patchUpdates(_0x1cf4a2){return function(_0x44df72){try{jsonpatch[_0x014c('0x1d')](_0x44df72,_0x1cf4a2,!![]);}catch(_0x56960e){return BPromise[_0x014c('0x1e')](_0x56960e);}return _0x44df72[_0x014c('0x1f')]();};}function saveUpdates(_0x5422f7,_0x4be177){return function(_0xa626c7){if(_0xa626c7){return _0xa626c7[_0x014c('0x20')](_0x5422f7)[_0x014c('0x21')](function(_0x39a46d){return _0x39a46d;});}return null;};}function removeEntity(_0x233b5a,_0xd4c699){return function(_0x42ca70){if(_0x42ca70){return _0x42ca70[_0x014c('0x22')]()['then'](function(){var _0x28ef64=_0x42ca70['get']({'plain':!![]});var _0x215a16=_0x014c('0x23');return db[_0x014c('0x24')][_0x014c('0x22')]({'where':{'type':_0x215a16,'resourceId':_0x28ef64['id']}})[_0x014c('0x21')](function(){return _0x42ca70;});})[_0x014c('0x21')](function(){_0x233b5a[_0x014c('0x18')](0xcc)[_0x014c('0x17')]();});}};}function handleEntityNotFound(_0x4b932d,_0x541a81){return function(_0x3c3697){if(!_0x3c3697){_0x4b932d['sendStatus'](0x194);}return _0x3c3697;};}function handleError(_0x5c4725,_0x3af3e8){_0x3af3e8=_0x3af3e8||0x1f4;return function(_0x19f6e3){logger['error'](_0x19f6e3[_0x014c('0x25')]);if(_0x19f6e3['name']){delete _0x19f6e3[_0x014c('0x26')];}_0x5c4725['status'](_0x3af3e8)['send'](_0x19f6e3);};}exports[_0x014c('0x27')]=function(_0x10da0b,_0x3019e6){var _0x1d1d98={},_0x25b3f4={},_0x272005={'count':0x0,'rows':[]};var _0x25162d=_[_0x014c('0x28')](db[_0x014c('0x29')][_0x014c('0x2a')],function(_0x1d3499){return{'name':_0x1d3499['fieldName'],'type':_0x1d3499[_0x014c('0x2b')][_0x014c('0x2c')]};});_0x25b3f4['model']=_[_0x014c('0x28')](_0x25162d,_0x014c('0x26'));_0x25b3f4[_0x014c('0x2d')]=_[_0x014c('0x2e')](_0x10da0b[_0x014c('0x2d')]);_0x25b3f4[_0x014c('0x2f')]=_[_0x014c('0x30')](_0x25b3f4[_0x014c('0x31')],_0x25b3f4['query']);_0x1d1d98['attributes']=_['intersection'](_0x25b3f4[_0x014c('0x31')],qs[_0x014c('0x32')](_0x10da0b[_0x014c('0x2d')][_0x014c('0x32')]));_0x1d1d98[_0x014c('0x33')]=_0x1d1d98[_0x014c('0x33')][_0x014c('0x34')]?_0x1d1d98[_0x014c('0x33')]:_0x25b3f4[_0x014c('0x31')];if(!_0x10da0b['query'][_0x014c('0x35')](_0x014c('0x36'))){_0x1d1d98[_0x014c('0x37')]=qs[_0x014c('0x37')](_0x10da0b[_0x014c('0x2d')][_0x014c('0x37')]);_0x1d1d98[_0x014c('0x1a')]=qs[_0x014c('0x1a')](_0x10da0b['query'][_0x014c('0x1a')]);}_0x1d1d98[_0x014c('0x38')]=qs['sort'](_0x10da0b[_0x014c('0x2d')][_0x014c('0x39')]);_0x1d1d98[_0x014c('0x3a')]=qs['filters'](_[_0x014c('0x3b')](_0x10da0b['query'],_0x25b3f4[_0x014c('0x2f')]),_0x25162d);if(_0x10da0b[_0x014c('0x2d')][_0x014c('0x3c')]){_0x1d1d98[_0x014c('0x3a')]=_['merge'](_0x1d1d98[_0x014c('0x3a')],{'$or':_[_0x014c('0x28')](_0x25162d,function(_0x4a6c67){if(_0x4a6c67[_0x014c('0x2b')]!==_0x014c('0x3d')){var _0x5584c8={};_0x5584c8[_0x4a6c67['name']]={'$like':'%'+_0x10da0b[_0x014c('0x2d')]['filter']+'%'};return _0x5584c8;}})});}_0x1d1d98=_['merge']({},_0x1d1d98,_0x10da0b[_0x014c('0x3e')]);var _0x30b9de={'where':_0x1d1d98['where']};return db[_0x014c('0x29')][_0x014c('0x19')](_0x30b9de)[_0x014c('0x21')](function(_0x3bc162){_0x272005[_0x014c('0x19')]=_0x3bc162;if(_0x10da0b[_0x014c('0x2d')][_0x014c('0x3f')]){_0x1d1d98['include']=[{'all':!![]}];}return db[_0x014c('0x29')]['findAll'](_0x1d1d98);})[_0x014c('0x21')](function(_0x780cc2){_0x272005[_0x014c('0x40')]=_0x780cc2;return _0x272005;})[_0x014c('0x21')](respondWithFilteredResult(_0x3019e6,_0x1d1d98))[_0x014c('0x41')](handleError(_0x3019e6,null));};exports[_0x014c('0x42')]=function(_0x4f44ee,_0x5226a4){var _0xb28666={'raw':![],'where':{'id':_0x4f44ee[_0x014c('0x43')]['id']}},_0x3238f6={};_0x3238f6[_0x014c('0x31')]=_['keys'](db[_0x014c('0x29')]['rawAttributes']);_0x3238f6[_0x014c('0x2d')]=_[_0x014c('0x2e')](_0x4f44ee[_0x014c('0x2d')]);_0x3238f6[_0x014c('0x2f')]=_['intersection'](_0x3238f6[_0x014c('0x31')],_0x3238f6[_0x014c('0x2d')]);_0xb28666['attributes']=_[_0x014c('0x30')](_0x3238f6['model'],qs[_0x014c('0x32')](_0x4f44ee[_0x014c('0x2d')][_0x014c('0x32')]));_0xb28666[_0x014c('0x33')]=_0xb28666[_0x014c('0x33')][_0x014c('0x34')]?_0xb28666[_0x014c('0x33')]:_0x3238f6[_0x014c('0x31')];if(_0x4f44ee[_0x014c('0x2d')][_0x014c('0x3f')]){_0xb28666['include']=[{'all':!![]}];}_0xb28666=_[_0x014c('0x44')]({},_0xb28666,_0x4f44ee[_0x014c('0x3e')]);return db[_0x014c('0x29')][_0x014c('0x45')](_0xb28666)['then'](handleEntityNotFound(_0x5226a4,null))['then'](respondWithResult(_0x5226a4,null))[_0x014c('0x41')](handleError(_0x5226a4,null));};exports[_0x014c('0x46')]=function(_0x247d62,_0xbfdccd){return db[_0x014c('0x29')][_0x014c('0x46')](_0x247d62[_0x014c('0x47')],{})[_0x014c('0x21')](function(_0x154e89){var _0x3a2f79=_0x247d62[_0x014c('0x48')][_0x014c('0x49')]({'plain':!![]});if(!_0x3a2f79)throw new Error(_0x014c('0x4a'));if(_0x3a2f79['role']==='user'){var _0x5e331f=_0x154e89['get']({'plain':!![]});var _0x1151e8='Projects';return db[_0x014c('0x4b')][_0x014c('0x45')]({'where':{'name':_0x1151e8,'userProfileId':_0x3a2f79[_0x014c('0x4c')]},'raw':!![]})['then'](function(_0x14d55f){if(_0x14d55f&&_0x14d55f[_0x014c('0x4d')]===0x0){return db['UserProfileResource'][_0x014c('0x46')]({'name':_0x5e331f['name'],'resourceId':_0x5e331f['id'],'type':_0x14d55f['name'],'sectionId':_0x14d55f['id']},{})[_0x014c('0x21')](function(){return _0x154e89;});}else{return _0x154e89;}})[_0x014c('0x41')](function(_0x42450c){logger['error'](_0x014c('0x4e'),_0x42450c);throw _0x42450c;});}return _0x154e89;})[_0x014c('0x21')](respondWithResult(_0xbfdccd,0xc9))[_0x014c('0x41')](handleError(_0xbfdccd,null));};exports[_0x014c('0x4f')]=function(_0x3dacc5,_0x4ccdac){var _0x2edbcd={'where':{'id':_0x3dacc5[_0x014c('0x43')]['id']}},_0x212135={};_0x212135[_0x014c('0x31')]=_[_0x014c('0x2e')](db['JscriptyProject'][_0x014c('0x2a')]);_0x2edbcd[_0x014c('0x33')]=_[_0x014c('0x30')](_0x212135[_0x014c('0x31')],qs[_0x014c('0x32')](_0x3dacc5['query']['fields']));_0x2edbcd['attributes']=_0x2edbcd[_0x014c('0x33')]['length']?_0x2edbcd['attributes']:_0x212135['model'];if(_0x3dacc5[_0x014c('0x2d')]['includeAll']){_0x2edbcd[_0x014c('0x50')]=[{'all':!![]}];}_0x2edbcd=_[_0x014c('0x44')]({},_0x2edbcd,_0x3dacc5[_0x014c('0x3e')]);return db['JscriptyProject']['find'](_0x2edbcd)[_0x014c('0x21')](handleEntityNotFound(_0x4ccdac,null))[_0x014c('0x21')](function(_0x2357b3){if(_0x2357b3){var _0x3ad48b=_0x2357b3[_0x014c('0x49')]({'plain':!![]});_0x3ad48b=qs[_0x014c('0x51')](_0x3ad48b,['id',_0x014c('0x52'),_0x014c('0x53')]);_0x3dacc5[_0x014c('0x47')]=_[_0x014c('0x51')](_0x3dacc5[_0x014c('0x47')],['id',_0x014c('0x52'),'updatedAt']);return db[_0x014c('0x29')][_0x014c('0x46')](_[_0x014c('0x44')](_0x3ad48b,_0x3dacc5['body']),{'include':_0x3dacc5[_0x014c('0x2d')][_0x014c('0x3f')]?[{'all':!![]}]:undefined})[_0x014c('0x21')](function(_0x343074){var _0x157edd=_0x3dacc5[_0x014c('0x48')][_0x014c('0x49')]({'plain':!![]});if(!_0x157edd)throw new Error(_0x014c('0x4a'));if(_0x157edd[_0x014c('0x54')]===_0x014c('0x48')){var _0x5f20b2=_0x343074['get']({'plain':!![]});var _0x7ccc3b=_0x014c('0x23');return db[_0x014c('0x4b')][_0x014c('0x45')]({'where':{'name':_0x7ccc3b,'userProfileId':_0x157edd[_0x014c('0x4c')]},'raw':!![]})[_0x014c('0x21')](function(_0xfceba7){if(_0xfceba7&&_0xfceba7[_0x014c('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f20b2[_0x014c('0x26')],'resourceId':_0x5f20b2['id'],'type':_0xfceba7['name'],'sectionId':_0xfceba7['id']},{})[_0x014c('0x21')](function(){return _0x343074;});}else{return _0x343074;}})[_0x014c('0x41')](function(_0x56a66f){logger[_0x014c('0x55')](_0x014c('0x4e'),_0x56a66f);throw _0x56a66f;});}return _0x343074;});}})[_0x014c('0x21')](respondWithResult(_0x4ccdac,0xc9))['catch'](handleError(_0x4ccdac,null));};exports[_0x014c('0x20')]=function(_0x1117f7,_0x10b73c){if(_0x1117f7['body']['id']){delete _0x1117f7[_0x014c('0x47')]['id'];}return db[_0x014c('0x29')][_0x014c('0x45')]({'where':{'id':_0x1117f7[_0x014c('0x43')]['id']}})['then'](handleEntityNotFound(_0x10b73c,null))[_0x014c('0x21')](saveUpdates(_0x1117f7['body'],null))[_0x014c('0x21')](respondWithResult(_0x10b73c,null))[_0x014c('0x41')](handleError(_0x10b73c,null));};exports[_0x014c('0x22')]=function(_0x2d2589,_0x164c3e){return db[_0x014c('0x29')]['find']({'where':{'id':_0x2d2589['params']['id']}})[_0x014c('0x21')](handleEntityNotFound(_0x164c3e,null))[_0x014c('0x21')](removeEntity(_0x164c3e,null))[_0x014c('0x41')](handleError(_0x164c3e,null));};exports['getSessions']=function(_0x106646,_0x22c75e,_0x364e87){var _0x2c57dc={'raw':!![],'where':{}};var _0x25d62f={};var _0x3fb6ca={'count':0x0,'rows':[]};return db[_0x014c('0x29')][_0x014c('0x56')]({'where':{'id':_0x106646[_0x014c('0x43')]['id']}})[_0x014c('0x21')](handleEntityNotFound(_0x22c75e,null))[_0x014c('0x21')](function(_0x335028){if(_0x335028){_0x25d62f[_0x014c('0x31')]=_['keys'](db[_0x014c('0x57')][_0x014c('0x2a')]);_0x25d62f[_0x014c('0x2d')]=_[_0x014c('0x2e')](_0x106646['query']);_0x25d62f[_0x014c('0x2f')]=_[_0x014c('0x30')](_0x25d62f[_0x014c('0x31')],_0x25d62f[_0x014c('0x2d')]);_0x2c57dc['attributes']=_[_0x014c('0x30')](_0x25d62f[_0x014c('0x31')],qs['fields'](_0x106646[_0x014c('0x2d')][_0x014c('0x32')]));_0x2c57dc[_0x014c('0x33')]=_0x2c57dc[_0x014c('0x33')]['length']?_0x2c57dc[_0x014c('0x33')]:_0x25d62f[_0x014c('0x31')];if(!_0x106646[_0x014c('0x2d')][_0x014c('0x35')](_0x014c('0x36'))){_0x2c57dc['limit']=qs[_0x014c('0x37')](_0x106646['query'][_0x014c('0x37')]);_0x2c57dc[_0x014c('0x1a')]=qs[_0x014c('0x1a')](_0x106646[_0x014c('0x2d')][_0x014c('0x1a')]);}_0x2c57dc[_0x014c('0x38')]=qs[_0x014c('0x39')](_0x106646[_0x014c('0x2d')][_0x014c('0x39')]);_0x2c57dc[_0x014c('0x3a')]=qs[_0x014c('0x2f')](_[_0x014c('0x3b')](_0x106646[_0x014c('0x2d')],_0x25d62f[_0x014c('0x2f')]));_0x2c57dc[_0x014c('0x3a')][_0x014c('0x58')]=_0x335028['id'];if(_0x106646[_0x014c('0x2d')][_0x014c('0x3c')]){_0x2c57dc[_0x014c('0x3a')]=_['merge'](_0x2c57dc[_0x014c('0x3a')],{'$or':_[_0x014c('0x28')](_0x2c57dc[_0x014c('0x33')],function(_0x52fd28){var _0x3356cd={};_0x3356cd[_0x52fd28]={'$like':'%'+_0x106646[_0x014c('0x2d')][_0x014c('0x3c')]+'%'};return _0x3356cd;})});}_0x2c57dc=_['merge']({},_0x2c57dc,_0x106646['options']);return db['JscriptySessionReport'][_0x014c('0x19')]({'where':_0x2c57dc[_0x014c('0x3a')]})['then'](function(_0x171b13){_0x3fb6ca[_0x014c('0x19')]=_0x171b13;if(_0x106646[_0x014c('0x2d')][_0x014c('0x3f')]){_0x2c57dc[_0x014c('0x50')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x014c('0x59')](_0x2c57dc);})['then'](function(_0x508909){_0x3fb6ca[_0x014c('0x40')]=_0x508909;return _0x3fb6ca;});}})[_0x014c('0x21')](respondWithFilteredResult(_0x22c75e,_0x2c57dc))[_0x014c('0x41')](handleError(_0x22c75e,null));};exports[_0x014c('0x5a')]=function(_0x1c135d,_0x2ea020,_0x498566){var _0x474c4e={'raw':!![],'where':{}};var _0x55fc4d={};var _0x47bc0a={'count':0x0,'rows':[]};return db[_0x014c('0x29')]['findOne']({'where':{'id':_0x1c135d[_0x014c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ea020,null))['then'](function(_0x5018b9){if(_0x5018b9){_0x55fc4d[_0x014c('0x31')]=_[_0x014c('0x2e')](db[_0x014c('0x5b')][_0x014c('0x2a')]);_0x55fc4d['query']=_[_0x014c('0x2e')](_0x1c135d['query']);_0x55fc4d[_0x014c('0x2f')]=_[_0x014c('0x30')](_0x55fc4d['model'],_0x55fc4d[_0x014c('0x2d')]);_0x474c4e['attributes']=_[_0x014c('0x30')](_0x55fc4d[_0x014c('0x31')],qs[_0x014c('0x32')](_0x1c135d[_0x014c('0x2d')][_0x014c('0x32')]));_0x474c4e[_0x014c('0x33')]=_0x474c4e[_0x014c('0x33')][_0x014c('0x34')]?_0x474c4e['attributes']:_0x55fc4d[_0x014c('0x31')];if(!_0x1c135d[_0x014c('0x2d')][_0x014c('0x35')](_0x014c('0x36'))){_0x474c4e[_0x014c('0x37')]=qs[_0x014c('0x37')](_0x1c135d['query'][_0x014c('0x37')]);_0x474c4e['offset']=qs['offset'](_0x1c135d['query'][_0x014c('0x1a')]);}_0x474c4e[_0x014c('0x38')]=qs[_0x014c('0x39')](_0x1c135d[_0x014c('0x2d')][_0x014c('0x39')]);_0x474c4e[_0x014c('0x3a')]=qs[_0x014c('0x2f')](_[_0x014c('0x3b')](_0x1c135d[_0x014c('0x2d')],_0x55fc4d[_0x014c('0x2f')]));_0x474c4e[_0x014c('0x3a')][_0x014c('0x58')]=_0x5018b9['id'];if(_0x1c135d[_0x014c('0x2d')][_0x014c('0x3c')]){_0x474c4e[_0x014c('0x3a')]=_[_0x014c('0x44')](_0x474c4e[_0x014c('0x3a')],{'$or':_['map'](_0x474c4e[_0x014c('0x33')],function(_0xd59a6d){var _0x2e1397={};_0x2e1397[_0xd59a6d]={'$like':'%'+_0x1c135d[_0x014c('0x2d')]['filter']+'%'};return _0x2e1397;})});}_0x474c4e=_[_0x014c('0x44')]({},_0x474c4e,_0x1c135d[_0x014c('0x3e')]);return db[_0x014c('0x5b')][_0x014c('0x19')]({'where':_0x474c4e['where']})[_0x014c('0x21')](function(_0xcd79bd){_0x47bc0a['count']=_0xcd79bd;if(_0x1c135d[_0x014c('0x2d')]['includeAll']){_0x474c4e[_0x014c('0x50')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x014c('0x59')](_0x474c4e);})[_0x014c('0x21')](function(_0x4523ef){_0x47bc0a[_0x014c('0x40')]=_0x4523ef;return _0x47bc0a;});}})[_0x014c('0x21')](respondWithFilteredResult(_0x2ea020,_0x474c4e))[_0x014c('0x41')](handleError(_0x2ea020,null));};function char(_0x50b201){return _0x014c('0x5c')===typeof _0x50b201?String[_0x014c('0x5d')][_0x014c('0x1d')](null,arguments):_0x50b201;}function needsEncapsulation(_0x470b25){return!!_0x470b25&&(_0x470b25[_0x014c('0x5e')]()[_0x014c('0x5f')](char(0xd))>=0x0||_0x470b25[_0x014c('0x5e')]()[_0x014c('0x5f')](char(0xa))>=0x0||_0x470b25[_0x014c('0x5e')]()[_0x014c('0x5f')](char(0x2c))>=0x0||_0x470b25['toString']()[_0x014c('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x1320af){var _0x12817c=char(0x22),_0x30563c='\x5c'+char(0x22),_0x37c445=_0x1320af['toString']()[_0x014c('0x60')](new RegExp(_0x12817c,'g'),_0x30563c);return _0x12817c+_0x37c445+_0x12817c;}exports[_0x014c('0x61')]=function(_0x38a50a,_0x1b1116,_0x197911){var _0x2cdd9b,_0x33dc94;var _0x584683={'where':{'ProjectId':_0x38a50a[_0x014c('0x43')]['id']}};if(_0x38a50a['query'][_0x014c('0x62')]){_0x584683[_0x014c('0x3a')][_0x014c('0x63')]=JSON[_0x014c('0x64')](_0x38a50a[_0x014c('0x2d')][_0x014c('0x62')]);}return db[_0x014c('0x57')][_0x014c('0x59')](_0x584683)[_0x014c('0x21')](handleEntityNotFound(_0x1b1116,null))[_0x014c('0x21')](function(_0x58a841){if(_0x58a841){_0x2cdd9b=_0x58a841;return db[_0x014c('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0x014c('0x28')](_0x2cdd9b,'id')},'ProjectId':_0x38a50a[_0x014c('0x43')]['id']},'order':_0x014c('0x66')});}})['then'](handleEntityNotFound(_0x1b1116,null))['then'](function(_0xb45829){if(_0xb45829){_0x33dc94=_0xb45829;var _0x31d299={};for(var _0x449888=0x0,_0x142875=_0x33dc94['length'];_0x449888<_0x142875;_0x449888++){if(!_0x31d299[_0x014c('0x35')](_0x33dc94[_0x449888]['questionId'])){_0x31d299[_0x33dc94[_0x449888][_0x014c('0x67')]]=needsEncapsulation(_0x33dc94[_0x449888]['question'])?encapsulate(_0x33dc94[_0x449888]['question']):_0x33dc94[_0x449888][_0x014c('0x68')];}}var _0x555384=[],_0x259016={};for(var _0x19b8e4=0x0,_0x213a38=_0x2cdd9b[_0x014c('0x34')];_0x19b8e4<_0x213a38;_0x19b8e4++){_0x259016={'ProjectId':_0x38a50a['params']['id'],'SessionId':_0x2cdd9b[_0x19b8e4]['id'],'StartTime':moment(_0x2cdd9b[_0x19b8e4][_0x014c('0x63')])[_0x014c('0x69')](_0x014c('0x6a'))};for(var _0x56dd6f=0x0,_0x28ebf2=_0x33dc94['length'];_0x56dd6f<_0x28ebf2;_0x56dd6f++){if(_0x33dc94[_0x56dd6f][_0x014c('0x6b')]==_0x2cdd9b[_0x19b8e4]['id']&&_0x31d299[_0x014c('0x35')](_0x33dc94[_0x56dd6f]['questionId'])){_0x259016[_0x31d299[_0x33dc94[_0x56dd6f][_0x014c('0x67')]]]=_0x33dc94[_0x56dd6f][_0x014c('0x6c')];}}for(var _0x436f6c in _0x31d299){if(!_0x259016[_0x014c('0x35')](_0x31d299[_0x436f6c])){_0x259016[_0x31d299[_0x436f6c]]=null;}}_0x555384[_0x014c('0x6d')](_0x259016);}return _0x555384;}})['then'](function(_0xc0386d){if(!_[_0x014c('0x6e')](_0xc0386d)){var _0xd26eb3=toCsv(_0xc0386d);var _0x2d0e8=Date[_0x014c('0x6f')]();fs[_0x014c('0x70')](util[_0x014c('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x38a50a[_0x014c('0x43')]['id'],_0x2d0e8),_0xd26eb3);_0x1b1116[_0x014c('0x71')]('Content-disposition',_0x014c('0x72')+util[_0x014c('0x69')](_0x014c('0x73'),_0x38a50a[_0x014c('0x43')]['id'],_0x2d0e8));_0x1b1116[_0x014c('0x71')]('Content-type','text/csv');return _0x1b1116['download'](util['format'](_0x014c('0x74'),_0x38a50a[_0x014c('0x43')]['id'],_0x2d0e8));}else{return _0x1b1116['sendStatus'](0xcc);}})[_0x014c('0x41')](handleError(_0x1b1116,null));}; \ No newline at end of file +var _0x301c=['../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Projects','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','order','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','update','getSessions','findOne','JscriptySessionReport','nolimit','sort','getAnswers','JscriptyAnswerReport','hasOwnProperty','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','JscriptyQuestionReport','-createdAt','question','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','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3bba8c,_0x1b8a19){var _0x327876=function(_0x509a63){while(--_0x509a63){_0x3bba8c['push'](_0x3bba8c['shift']());}};_0x327876(++_0x1b8a19);}(_0x301c,0x1d2));var _0xc301=function(_0x50d17b,_0x17cc5e){_0x50d17b=_0x50d17b-0x0;var _0x35038b=_0x301c[_0x50d17b];return _0x35038b;};'use strict';var pdf=require(_0xc301('0x0'));var emlformat=require(_0xc301('0x1'));var rimraf=require(_0xc301('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc301('0x3'));var rp=require(_0xc301('0x4'));var moment=require('moment');var BPromise=require(_0xc301('0x5'));var Mustache=require('mustache');var util=require(_0xc301('0x6'));var path=require(_0xc301('0x7'));var sox=require(_0xc301('0x8'));var csv=require(_0xc301('0x9'));var ejs=require(_0xc301('0xa'));var fs=require('fs');var _=require(_0xc301('0xb'));var squel=require(_0xc301('0xc'));var crypto=require('crypto');var jsforce=require(_0xc301('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc301('0x9'));var querystring=require(_0xc301('0xe'));var Papa=require(_0xc301('0xf'));var Redis=require('ioredis');var authService=require(_0xc301('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc301('0x11'));var hardwareService=require(_0xc301('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc301('0x13'));var config=require(_0xc301('0x14'));var licenseUtil=require(_0xc301('0x15'));var db=require(_0xc301('0x16'))['db'];function respondWithStatusCode(_0x2782aa,_0x35d176){_0x35d176=_0x35d176||0xcc;return function(_0xce3e21){if(_0xce3e21){return _0x2782aa[_0xc301('0x17')](_0x35d176);}return _0x2782aa[_0xc301('0x18')](_0x35d176)[_0xc301('0x19')]();};}function respondWithResult(_0x4cd540,_0x104169){_0x104169=_0x104169||0xc8;return function(_0xe8cc6){if(_0xe8cc6){return _0x4cd540['status'](_0x104169)[_0xc301('0x1a')](_0xe8cc6);}};}function respondWithFilteredResult(_0x3d21df,_0x418f95){return function(_0xdad7c8){if(_0xdad7c8){var _0x33607b=_0xdad7c8['count'],_0x114d2f=_0x418f95[_0xc301('0x1b')],_0x55998b=_0x418f95[_0xc301('0x1b')]+_0x418f95[_0xc301('0x1c')],_0x340db7;if(_0x55998b>=_0x33607b){_0x55998b=_0x33607b;_0x340db7=0xc8;}else{_0x340db7=0xce;}_0x3d21df[_0xc301('0x18')](_0x340db7);return _0x3d21df[_0xc301('0x1d')](_0xc301('0x1e'),_0x114d2f+'-'+_0x55998b+'/'+_0x33607b)[_0xc301('0x1a')](_0xdad7c8);}return null;};}function patchUpdates(_0x5cafbf){return function(_0x5d8794){try{jsonpatch[_0xc301('0x1f')](_0x5d8794,_0x5cafbf,!![]);}catch(_0x478716){return BPromise[_0xc301('0x20')](_0x478716);}return _0x5d8794[_0xc301('0x21')]();};}function saveUpdates(_0x561d96,_0x12152e){return function(_0x27eb05){if(_0x27eb05){return _0x27eb05['update'](_0x561d96)[_0xc301('0x22')](function(_0x547e2a){return _0x547e2a;});}return null;};}function removeEntity(_0x280594,_0x3d68ca){return function(_0x41ccf0){if(_0x41ccf0){return _0x41ccf0[_0xc301('0x23')]()['then'](function(){var _0x29b21b=_0x41ccf0[_0xc301('0x24')]({'plain':!![]});var _0x43ecf6=_0xc301('0x25');return db['UserProfileResource'][_0xc301('0x23')]({'where':{'type':_0x43ecf6,'resourceId':_0x29b21b['id']}})[_0xc301('0x22')](function(){return _0x41ccf0;});})[_0xc301('0x22')](function(){_0x280594['status'](0xcc)[_0xc301('0x19')]();});}};}function handleEntityNotFound(_0x143369,_0x17e4ba){return function(_0x35cc18){if(!_0x35cc18){_0x143369[_0xc301('0x17')](0x194);}return _0x35cc18;};}function handleError(_0xc19568,_0x4ef700){_0x4ef700=_0x4ef700||0x1f4;return function(_0x4bec8a){logger[_0xc301('0x26')](_0x4bec8a[_0xc301('0x27')]);if(_0x4bec8a[_0xc301('0x28')]){delete _0x4bec8a[_0xc301('0x28')];}_0xc19568[_0xc301('0x18')](_0x4ef700)['send'](_0x4bec8a);};}exports[_0xc301('0x29')]=function(_0xaf4cb4,_0x32d13d){var _0x2fe3c4={},_0x3dc2fd={},_0x2e1084={'count':0x0,'rows':[]};var _0x3caace=_[_0xc301('0x2a')](db[_0xc301('0x2b')][_0xc301('0x2c')],function(_0xcb9949){return{'name':_0xcb9949[_0xc301('0x2d')],'type':_0xcb9949[_0xc301('0x2e')][_0xc301('0x2f')]};});_0x3dc2fd[_0xc301('0x30')]=_[_0xc301('0x2a')](_0x3caace,_0xc301('0x28'));_0x3dc2fd['query']=_[_0xc301('0x31')](_0xaf4cb4['query']);_0x3dc2fd['filters']=_[_0xc301('0x32')](_0x3dc2fd['model'],_0x3dc2fd[_0xc301('0x33')]);_0x2fe3c4['attributes']=_[_0xc301('0x32')](_0x3dc2fd[_0xc301('0x30')],qs[_0xc301('0x34')](_0xaf4cb4[_0xc301('0x33')][_0xc301('0x34')]));_0x2fe3c4[_0xc301('0x35')]=_0x2fe3c4[_0xc301('0x35')]['length']?_0x2fe3c4[_0xc301('0x35')]:_0x3dc2fd[_0xc301('0x30')];if(!_0xaf4cb4[_0xc301('0x33')]['hasOwnProperty']('nolimit')){_0x2fe3c4[_0xc301('0x1c')]=qs[_0xc301('0x1c')](_0xaf4cb4['query']['limit']);_0x2fe3c4[_0xc301('0x1b')]=qs[_0xc301('0x1b')](_0xaf4cb4['query'][_0xc301('0x1b')]);}_0x2fe3c4[_0xc301('0x36')]=qs['sort'](_0xaf4cb4['query']['sort']);_0x2fe3c4[_0xc301('0x37')]=qs['filters'](_[_0xc301('0x38')](_0xaf4cb4[_0xc301('0x33')],_0x3dc2fd[_0xc301('0x39')]),_0x3caace);if(_0xaf4cb4[_0xc301('0x33')][_0xc301('0x3a')]){_0x2fe3c4[_0xc301('0x37')]=_[_0xc301('0x3b')](_0x2fe3c4[_0xc301('0x37')],{'$or':_[_0xc301('0x2a')](_0x3caace,function(_0x573249){if(_0x573249['type']!==_0xc301('0x3c')){var _0x6926ca={};_0x6926ca[_0x573249[_0xc301('0x28')]]={'$like':'%'+_0xaf4cb4[_0xc301('0x33')][_0xc301('0x3a')]+'%'};return _0x6926ca;}})});}_0x2fe3c4=_[_0xc301('0x3b')]({},_0x2fe3c4,_0xaf4cb4[_0xc301('0x3d')]);var _0x4e4eed={'where':_0x2fe3c4[_0xc301('0x37')]};return db[_0xc301('0x2b')][_0xc301('0x3e')](_0x4e4eed)[_0xc301('0x22')](function(_0x5d11b4){_0x2e1084[_0xc301('0x3e')]=_0x5d11b4;if(_0xaf4cb4[_0xc301('0x33')][_0xc301('0x3f')]){_0x2fe3c4[_0xc301('0x40')]=[{'all':!![]}];}return db[_0xc301('0x2b')][_0xc301('0x41')](_0x2fe3c4);})['then'](function(_0x362271){_0x2e1084[_0xc301('0x42')]=_0x362271;return _0x2e1084;})['then'](respondWithFilteredResult(_0x32d13d,_0x2fe3c4))[_0xc301('0x43')](handleError(_0x32d13d,null));};exports[_0xc301('0x44')]=function(_0x491f73,_0x4a4934){var _0x4cf919={'raw':![],'where':{'id':_0x491f73[_0xc301('0x45')]['id']}},_0x9954a8={};_0x9954a8[_0xc301('0x30')]=_[_0xc301('0x31')](db[_0xc301('0x2b')]['rawAttributes']);_0x9954a8[_0xc301('0x33')]=_['keys'](_0x491f73[_0xc301('0x33')]);_0x9954a8[_0xc301('0x39')]=_['intersection'](_0x9954a8[_0xc301('0x30')],_0x9954a8[_0xc301('0x33')]);_0x4cf919[_0xc301('0x35')]=_['intersection'](_0x9954a8[_0xc301('0x30')],qs[_0xc301('0x34')](_0x491f73[_0xc301('0x33')]['fields']));_0x4cf919[_0xc301('0x35')]=_0x4cf919[_0xc301('0x35')][_0xc301('0x46')]?_0x4cf919[_0xc301('0x35')]:_0x9954a8['model'];if(_0x491f73[_0xc301('0x33')][_0xc301('0x3f')]){_0x4cf919[_0xc301('0x40')]=[{'all':!![]}];}_0x4cf919=_[_0xc301('0x3b')]({},_0x4cf919,_0x491f73['options']);return db['JscriptyProject']['find'](_0x4cf919)['then'](handleEntityNotFound(_0x4a4934,null))[_0xc301('0x22')](respondWithResult(_0x4a4934,null))['catch'](handleError(_0x4a4934,null));};exports[_0xc301('0x47')]=function(_0x4fdf5f,_0x13ae50){return db[_0xc301('0x2b')][_0xc301('0x47')](_0x4fdf5f[_0xc301('0x48')],{})[_0xc301('0x22')](function(_0x5dc118){var _0x4b08bf=_0x4fdf5f[_0xc301('0x49')][_0xc301('0x24')]({'plain':!![]});if(!_0x4b08bf)throw new Error(_0xc301('0x4a'));if(_0x4b08bf[_0xc301('0x4b')]==='user'){var _0x5bc74b=_0x5dc118[_0xc301('0x24')]({'plain':!![]});var _0x309498=_0xc301('0x25');return db[_0xc301('0x4c')][_0xc301('0x4d')]({'where':{'name':_0x309498,'userProfileId':_0x4b08bf['userProfileId']},'raw':!![]})[_0xc301('0x22')](function(_0x10da1a){if(_0x10da1a&&_0x10da1a[_0xc301('0x4e')]===0x0){return db[_0xc301('0x4f')][_0xc301('0x47')]({'name':_0x5bc74b[_0xc301('0x28')],'resourceId':_0x5bc74b['id'],'type':_0x10da1a['name'],'sectionId':_0x10da1a['id']},{})['then'](function(){return _0x5dc118;});}else{return _0x5dc118;}})[_0xc301('0x43')](function(_0x31a07b){logger[_0xc301('0x26')](_0xc301('0x50'),_0x31a07b);throw _0x31a07b;});}return _0x5dc118;})[_0xc301('0x22')](respondWithResult(_0x13ae50,0xc9))['catch'](handleError(_0x13ae50,null));};exports[_0xc301('0x51')]=function(_0x53addc,_0xed1311){var _0x7568dd={'where':{'id':_0x53addc[_0xc301('0x45')]['id']}},_0x291a6={};_0x291a6[_0xc301('0x30')]=_[_0xc301('0x31')](db['JscriptyProject']['rawAttributes']);_0x7568dd[_0xc301('0x35')]=_[_0xc301('0x32')](_0x291a6[_0xc301('0x30')],qs[_0xc301('0x34')](_0x53addc[_0xc301('0x33')][_0xc301('0x34')]));_0x7568dd['attributes']=_0x7568dd[_0xc301('0x35')][_0xc301('0x46')]?_0x7568dd[_0xc301('0x35')]:_0x291a6[_0xc301('0x30')];if(_0x53addc[_0xc301('0x33')]['includeAll']){_0x7568dd['include']=[{'all':!![]}];}_0x7568dd=_['merge']({},_0x7568dd,_0x53addc['options']);return db[_0xc301('0x2b')][_0xc301('0x4d')](_0x7568dd)[_0xc301('0x22')](handleEntityNotFound(_0xed1311,null))[_0xc301('0x22')](function(_0x2de659){if(_0x2de659){var _0x3ef4ac=_0x2de659['get']({'plain':!![]});_0x3ef4ac=qs[_0xc301('0x52')](_0x3ef4ac,['id',_0xc301('0x53'),_0xc301('0x54')]);_0x53addc['body']=_[_0xc301('0x52')](_0x53addc['body'],['id',_0xc301('0x53'),_0xc301('0x54')]);return db[_0xc301('0x2b')][_0xc301('0x47')](_[_0xc301('0x3b')](_0x3ef4ac,_0x53addc[_0xc301('0x48')]),{'include':_0x53addc['query']['includeAll']?[{'all':!![]}]:undefined})[_0xc301('0x22')](function(_0x265198){var _0x2c8e49=_0x53addc['user'][_0xc301('0x24')]({'plain':!![]});if(!_0x2c8e49)throw new Error(_0xc301('0x4a'));if(_0x2c8e49[_0xc301('0x4b')]===_0xc301('0x49')){var _0x17a65a=_0x265198[_0xc301('0x24')]({'plain':!![]});var _0x152e89='Projects';return db[_0xc301('0x4c')][_0xc301('0x4d')]({'where':{'name':_0x152e89,'userProfileId':_0x2c8e49[_0xc301('0x55')]},'raw':!![]})['then'](function(_0x5cffb1){if(_0x5cffb1&&_0x5cffb1[_0xc301('0x4e')]===0x0){return db[_0xc301('0x4f')]['create']({'name':_0x17a65a[_0xc301('0x28')],'resourceId':_0x17a65a['id'],'type':_0x5cffb1['name'],'sectionId':_0x5cffb1['id']},{})[_0xc301('0x22')](function(){return _0x265198;});}else{return _0x265198;}})[_0xc301('0x43')](function(_0x2d1350){logger[_0xc301('0x26')](_0xc301('0x50'),_0x2d1350);throw _0x2d1350;});}return _0x265198;});}})[_0xc301('0x22')](respondWithResult(_0xed1311,0xc9))[_0xc301('0x43')](handleError(_0xed1311,null));};exports[_0xc301('0x56')]=function(_0x1a08fd,_0x4e8894){if(_0x1a08fd[_0xc301('0x48')]['id']){delete _0x1a08fd['body']['id'];}return db[_0xc301('0x2b')][_0xc301('0x4d')]({'where':{'id':_0x1a08fd[_0xc301('0x45')]['id']}})[_0xc301('0x22')](handleEntityNotFound(_0x4e8894,null))[_0xc301('0x22')](saveUpdates(_0x1a08fd[_0xc301('0x48')],null))['then'](respondWithResult(_0x4e8894,null))[_0xc301('0x43')](handleError(_0x4e8894,null));};exports['destroy']=function(_0x4eaf13,_0x29d305){return db[_0xc301('0x2b')][_0xc301('0x4d')]({'where':{'id':_0x4eaf13['params']['id']}})['then'](handleEntityNotFound(_0x29d305,null))[_0xc301('0x22')](removeEntity(_0x29d305,null))['catch'](handleError(_0x29d305,null));};exports[_0xc301('0x57')]=function(_0x218235,_0x453c20,_0x37e688){var _0x4a5438={'raw':!![],'where':{}};var _0x126a94={};var _0x1a9541={'count':0x0,'rows':[]};return db[_0xc301('0x2b')][_0xc301('0x58')]({'where':{'id':_0x218235[_0xc301('0x45')]['id']}})[_0xc301('0x22')](handleEntityNotFound(_0x453c20,null))[_0xc301('0x22')](function(_0x403cf3){if(_0x403cf3){_0x126a94[_0xc301('0x30')]=_['keys'](db[_0xc301('0x59')]['rawAttributes']);_0x126a94['query']=_[_0xc301('0x31')](_0x218235[_0xc301('0x33')]);_0x126a94['filters']=_[_0xc301('0x32')](_0x126a94[_0xc301('0x30')],_0x126a94[_0xc301('0x33')]);_0x4a5438[_0xc301('0x35')]=_[_0xc301('0x32')](_0x126a94[_0xc301('0x30')],qs[_0xc301('0x34')](_0x218235[_0xc301('0x33')][_0xc301('0x34')]));_0x4a5438[_0xc301('0x35')]=_0x4a5438[_0xc301('0x35')][_0xc301('0x46')]?_0x4a5438['attributes']:_0x126a94[_0xc301('0x30')];if(!_0x218235['query']['hasOwnProperty'](_0xc301('0x5a'))){_0x4a5438['limit']=qs['limit'](_0x218235['query'][_0xc301('0x1c')]);_0x4a5438[_0xc301('0x1b')]=qs['offset'](_0x218235[_0xc301('0x33')][_0xc301('0x1b')]);}_0x4a5438[_0xc301('0x36')]=qs[_0xc301('0x5b')](_0x218235['query']['sort']);_0x4a5438[_0xc301('0x37')]=qs[_0xc301('0x39')](_['pick'](_0x218235[_0xc301('0x33')],_0x126a94['filters']));_0x4a5438['where']['ProjectId']=_0x403cf3['id'];if(_0x218235[_0xc301('0x33')][_0xc301('0x3a')]){_0x4a5438[_0xc301('0x37')]=_[_0xc301('0x3b')](_0x4a5438[_0xc301('0x37')],{'$or':_[_0xc301('0x2a')](_0x4a5438[_0xc301('0x35')],function(_0x50f954){var _0x286283={};_0x286283[_0x50f954]={'$like':'%'+_0x218235[_0xc301('0x33')]['filter']+'%'};return _0x286283;})});}_0x4a5438=_['merge']({},_0x4a5438,_0x218235[_0xc301('0x3d')]);return db['JscriptySessionReport']['count']({'where':_0x4a5438[_0xc301('0x37')]})[_0xc301('0x22')](function(_0xfb4c77){_0x1a9541['count']=_0xfb4c77;if(_0x218235[_0xc301('0x33')][_0xc301('0x3f')]){_0x4a5438[_0xc301('0x40')]=[{'all':!![]}];}return db[_0xc301('0x59')][_0xc301('0x41')](_0x4a5438);})[_0xc301('0x22')](function(_0x4db011){_0x1a9541[_0xc301('0x42')]=_0x4db011;return _0x1a9541;});}})[_0xc301('0x22')](respondWithFilteredResult(_0x453c20,_0x4a5438))[_0xc301('0x43')](handleError(_0x453c20,null));};exports[_0xc301('0x5c')]=function(_0x2b10d7,_0x2d181f,_0x5d254e){var _0x2fb7a1={'raw':!![],'where':{}};var _0x30a0ee={};var _0xc4d2ac={'count':0x0,'rows':[]};return db[_0xc301('0x2b')][_0xc301('0x58')]({'where':{'id':_0x2b10d7[_0xc301('0x45')]['id']}})[_0xc301('0x22')](handleEntityNotFound(_0x2d181f,null))[_0xc301('0x22')](function(_0x3869a8){if(_0x3869a8){_0x30a0ee[_0xc301('0x30')]=_[_0xc301('0x31')](db[_0xc301('0x5d')]['rawAttributes']);_0x30a0ee[_0xc301('0x33')]=_[_0xc301('0x31')](_0x2b10d7[_0xc301('0x33')]);_0x30a0ee[_0xc301('0x39')]=_[_0xc301('0x32')](_0x30a0ee[_0xc301('0x30')],_0x30a0ee[_0xc301('0x33')]);_0x2fb7a1[_0xc301('0x35')]=_[_0xc301('0x32')](_0x30a0ee[_0xc301('0x30')],qs[_0xc301('0x34')](_0x2b10d7[_0xc301('0x33')][_0xc301('0x34')]));_0x2fb7a1[_0xc301('0x35')]=_0x2fb7a1[_0xc301('0x35')][_0xc301('0x46')]?_0x2fb7a1[_0xc301('0x35')]:_0x30a0ee[_0xc301('0x30')];if(!_0x2b10d7[_0xc301('0x33')][_0xc301('0x5e')](_0xc301('0x5a'))){_0x2fb7a1[_0xc301('0x1c')]=qs[_0xc301('0x1c')](_0x2b10d7[_0xc301('0x33')][_0xc301('0x1c')]);_0x2fb7a1[_0xc301('0x1b')]=qs[_0xc301('0x1b')](_0x2b10d7[_0xc301('0x33')]['offset']);}_0x2fb7a1['order']=qs['sort'](_0x2b10d7[_0xc301('0x33')]['sort']);_0x2fb7a1[_0xc301('0x37')]=qs[_0xc301('0x39')](_['pick'](_0x2b10d7[_0xc301('0x33')],_0x30a0ee[_0xc301('0x39')]));_0x2fb7a1[_0xc301('0x37')][_0xc301('0x5f')]=_0x3869a8['id'];if(_0x2b10d7[_0xc301('0x33')]['filter']){_0x2fb7a1[_0xc301('0x37')]=_[_0xc301('0x3b')](_0x2fb7a1[_0xc301('0x37')],{'$or':_[_0xc301('0x2a')](_0x2fb7a1[_0xc301('0x35')],function(_0x521b62){var _0x424380={};_0x424380[_0x521b62]={'$like':'%'+_0x2b10d7['query'][_0xc301('0x3a')]+'%'};return _0x424380;})});}_0x2fb7a1=_[_0xc301('0x3b')]({},_0x2fb7a1,_0x2b10d7[_0xc301('0x3d')]);return db['JscriptyAnswerReport'][_0xc301('0x3e')]({'where':_0x2fb7a1[_0xc301('0x37')]})[_0xc301('0x22')](function(_0x5ca037){_0xc4d2ac[_0xc301('0x3e')]=_0x5ca037;if(_0x2b10d7[_0xc301('0x33')][_0xc301('0x3f')]){_0x2fb7a1[_0xc301('0x40')]=[{'all':!![]}];}return db[_0xc301('0x5d')]['findAll'](_0x2fb7a1);})['then'](function(_0x306956){_0xc4d2ac[_0xc301('0x42')]=_0x306956;return _0xc4d2ac;});}})[_0xc301('0x22')](respondWithFilteredResult(_0x2d181f,_0x2fb7a1))[_0xc301('0x43')](handleError(_0x2d181f,null));};function char(_0x4fc0df){return _0xc301('0x60')===typeof _0x4fc0df?String[_0xc301('0x61')][_0xc301('0x1f')](null,arguments):_0x4fc0df;}function needsEncapsulation(_0x273102){return!!_0x273102&&(_0x273102[_0xc301('0x62')]()[_0xc301('0x63')](char(0xd))>=0x0||_0x273102[_0xc301('0x62')]()['indexOf'](char(0xa))>=0x0||_0x273102[_0xc301('0x62')]()[_0xc301('0x63')](char(0x2c))>=0x0||_0x273102['toString']()[_0xc301('0x63')](char(0x22))>=0x0);}function encapsulate(_0x49493d){var _0x1390be=char(0x22),_0x388281='\x5c'+char(0x22),_0x14652a=_0x49493d[_0xc301('0x62')]()[_0xc301('0x64')](new RegExp(_0x1390be,'g'),_0x388281);return _0x1390be+_0x14652a+_0x1390be;}exports[_0xc301('0x65')]=function(_0x43b944,_0x5e5327,_0x459015){var _0x9dd5e2,_0x445cd3;var _0x460462={'where':{'ProjectId':_0x43b944[_0xc301('0x45')]['id']}};if(_0x43b944['query']['startTime']){_0x460462[_0xc301('0x37')][_0xc301('0x66')]=JSON['parse'](_0x43b944['query']['startTime']);}return db[_0xc301('0x59')][_0xc301('0x41')](_0x460462)[_0xc301('0x22')](handleEntityNotFound(_0x5e5327,null))[_0xc301('0x22')](function(_0x1f5927){if(_0x1f5927){_0x9dd5e2=_0x1f5927;return db[_0xc301('0x67')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x9dd5e2,'id')},'ProjectId':_0x43b944[_0xc301('0x45')]['id']},'order':_0xc301('0x68')});}})[_0xc301('0x22')](handleEntityNotFound(_0x5e5327,null))['then'](function(_0x3cb33f){if(_0x3cb33f){_0x445cd3=_0x3cb33f;var _0x5ac5a6={};for(var _0x551e5b=0x0,_0x5d2ba5=_0x445cd3['length'];_0x551e5b<_0x5d2ba5;_0x551e5b++){if(!_0x5ac5a6['hasOwnProperty'](_0x445cd3[_0x551e5b]['questionId'])){_0x5ac5a6[_0x445cd3[_0x551e5b]['questionId']]=needsEncapsulation(_0x445cd3[_0x551e5b][_0xc301('0x69')])?encapsulate(_0x445cd3[_0x551e5b][_0xc301('0x69')]):_0x445cd3[_0x551e5b][_0xc301('0x69')];}}var _0x1bbd01=[],_0x31b903={};for(var _0x5ccd88=0x0,_0x3c4784=_0x9dd5e2['length'];_0x5ccd88<_0x3c4784;_0x5ccd88++){_0x31b903={'ProjectId':_0x43b944[_0xc301('0x45')]['id'],'SessionId':_0x9dd5e2[_0x5ccd88]['id'],'StartTime':moment(_0x9dd5e2[_0x5ccd88][_0xc301('0x66')])[_0xc301('0x6a')](_0xc301('0x6b'))};for(var _0x5d2dd9=0x0,_0x1588c6=_0x445cd3[_0xc301('0x46')];_0x5d2dd9<_0x1588c6;_0x5d2dd9++){if(_0x445cd3[_0x5d2dd9][_0xc301('0x6c')]==_0x9dd5e2[_0x5ccd88]['id']&&_0x5ac5a6[_0xc301('0x5e')](_0x445cd3[_0x5d2dd9]['questionId'])){_0x31b903[_0x5ac5a6[_0x445cd3[_0x5d2dd9]['questionId']]]=_0x445cd3[_0x5d2dd9][_0xc301('0x6d')];}}for(var _0x815ec7 in _0x5ac5a6){if(!_0x31b903['hasOwnProperty'](_0x5ac5a6[_0x815ec7])){_0x31b903[_0x5ac5a6[_0x815ec7]]=null;}}_0x1bbd01[_0xc301('0x6e')](_0x31b903);}return _0x1bbd01;}})['then'](function(_0x5f2bee){if(!_[_0xc301('0x6f')](_0x5f2bee)){var _0x5cfa43=toCsv(_0x5f2bee);var _0x3b9aaa=Date[_0xc301('0x70')]();fs[_0xc301('0x71')](util[_0xc301('0x6a')](_0xc301('0x72'),_0x43b944[_0xc301('0x45')]['id'],_0x3b9aaa),_0x5cfa43);_0x5e5327[_0xc301('0x73')](_0xc301('0x74'),_0xc301('0x75')+util[_0xc301('0x6a')](_0xc301('0x76'),_0x43b944[_0xc301('0x45')]['id'],_0x3b9aaa));_0x5e5327[_0xc301('0x73')](_0xc301('0x77'),_0xc301('0x78'));return _0x5e5327[_0xc301('0x79')](util[_0xc301('0x6a')](_0xc301('0x72'),_0x43b944['params']['id'],_0x3b9aaa));}else{return _0x5e5327['sendStatus'](0xcc);}})['catch'](handleError(_0x5e5327,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index cfe83a8..cdec2f6 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 _0x6fd5=['rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c2fb9,_0x556273){var _0x2b1701=function(_0x3fdbb7){while(--_0x3fdbb7){_0x3c2fb9['push'](_0x3c2fb9['shift']());}};_0x2b1701(++_0x556273);}(_0x6fd5,0xf0));var _0x56fd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6fd5[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x56fd('0x0'));var util=require('util');var logger=require(_0x56fd('0x1'))(_0x56fd('0x2'));var moment=require(_0x56fd('0x3'));var BPromise=require(_0x56fd('0x4'));var rp=require(_0x56fd('0x5'));var fs=require('fs');var path=require(_0x56fd('0x6'));var rimraf=require(_0x56fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x56fd('0x8'));module[_0x56fd('0x9')]=function(_0x1ae776,_0x649fcd){return _0x1ae776[_0x56fd('0xa')](_0x56fd('0xb'),attributes,{'tableName':_0x56fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1690=['path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1690,0x10f));var _0x0169=function(_0x3f617b,_0x270ef2){_0x3f617b=_0x3f617b-0x0;var _0x3faca4=_0x1690[_0x3f617b];return _0x3faca4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0169('0x0'))(_0x0169('0x1'));var moment=require(_0x0169('0x2'));var BPromise=require(_0x0169('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0169('0x4'));var rimraf=require('rimraf');var config=require(_0x0169('0x5'));var attributes=require(_0x0169('0x6'));module[_0x0169('0x7')]=function(_0x64a409,_0x44d3d8){return _0x64a409[_0x0169('0x8')](_0x0169('0x9'),attributes,{'tableName':_0x0169('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 846a396..f56bd78 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 _0xc9d4=['JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x561bd8,_0x2458de){var _0x355db5=function(_0x2d221b){while(--_0x2d221b){_0x561bd8['push'](_0x561bd8['shift']());}};_0x355db5(++_0x2458de);}(_0xc9d4,0xf0));var _0x4c9d=function(_0x59e132,_0x916161){_0x59e132=_0x59e132-0x0;var _0x73fa42=_0xc9d4[_0x59e132];return _0x73fa42;};'use strict';var _=require(_0x4c9d('0x0'));var util=require(_0x4c9d('0x1'));var moment=require(_0x4c9d('0x2'));var BPromise=require(_0x4c9d('0x3'));var rs=require(_0x4c9d('0x4'));var fs=require('fs');var Redis=require(_0x4c9d('0x5'));var db=require(_0x4c9d('0x6'))['db'];var utils=require(_0x4c9d('0x7'));var logger=require(_0x4c9d('0x8'))(_0x4c9d('0x9'));var config=require(_0x4c9d('0xa'));var jayson=require(_0x4c9d('0xb'));var client=jayson[_0x4c9d('0xc')][_0x4c9d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xd7e665,_0xb576c2,_0x53823d){return new BPromise(function(_0x5b5d2b,_0x51c436){return client[_0x4c9d('0xe')](_0xd7e665,_0x53823d)[_0x4c9d('0xf')](function(_0x4581bf){logger[_0x4c9d('0x10')](_0x4c9d('0x11'),_0xb576c2,_0x4c9d('0x12'));logger[_0x4c9d('0x13')](_0x4c9d('0x14'),_0xb576c2,_0x4c9d('0x12'),JSON[_0x4c9d('0x15')](_0x4581bf));if(_0x4581bf['error']){if(_0x4581bf['error'][_0x4c9d('0x16')]===0x1f4){logger[_0x4c9d('0x17')](_0x4c9d('0x11'),_0xb576c2,_0x4581bf[_0x4c9d('0x17')][_0x4c9d('0x18')]);return _0x51c436(_0x4581bf['error'][_0x4c9d('0x18')]);}logger[_0x4c9d('0x17')]('JscriptyProject,\x20%s,\x20%s',_0xb576c2,_0x4581bf['error'][_0x4c9d('0x18')]);return _0x5b5d2b(_0x4581bf[_0x4c9d('0x17')][_0x4c9d('0x18')]);}else{logger[_0x4c9d('0x10')](_0x4c9d('0x11'),_0xb576c2,_0x4c9d('0x12'));_0x5b5d2b(_0x4581bf['result'][_0x4c9d('0x18')]);}})[_0x4c9d('0x19')](function(_0x3db4dd){logger[_0x4c9d('0x17')](_0x4c9d('0x11'),_0xb576c2,_0x3db4dd);_0x51c436(_0x3db4dd);});});} \ No newline at end of file +var _0x825d=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x825d,0xe2));var _0xd825=function(_0x18689c,_0x9bb284){_0x18689c=_0x18689c-0x0;var _0x1f9bf9=_0x825d[_0x18689c];return _0x1f9bf9;};'use strict';var _=require(_0xd825('0x0'));var util=require('util');var moment=require(_0xd825('0x1'));var BPromise=require(_0xd825('0x2'));var rs=require(_0xd825('0x3'));var fs=require('fs');var Redis=require(_0xd825('0x4'));var db=require(_0xd825('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd825('0x6'))(_0xd825('0x7'));var config=require(_0xd825('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd825('0x9')][_0xd825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b72c5,_0x304f94,_0x49278c){return new BPromise(function(_0x2ab414,_0x315347){return client[_0xd825('0xb')](_0x2b72c5,_0x49278c)[_0xd825('0xc')](function(_0x40e578){logger[_0xd825('0xd')](_0xd825('0xe'),_0x304f94,_0xd825('0xf'));logger[_0xd825('0x10')](_0xd825('0x11'),_0x304f94,'request\x20sent',JSON[_0xd825('0x12')](_0x40e578));if(_0x40e578[_0xd825('0x13')]){if(_0x40e578[_0xd825('0x13')][_0xd825('0x14')]===0x1f4){logger[_0xd825('0x13')](_0xd825('0xe'),_0x304f94,_0x40e578[_0xd825('0x13')][_0xd825('0x15')]);return _0x315347(_0x40e578['error']['message']);}logger['error'](_0xd825('0xe'),_0x304f94,_0x40e578[_0xd825('0x13')][_0xd825('0x15')]);return _0x2ab414(_0x40e578['error'][_0xd825('0x15')]);}else{logger[_0xd825('0xd')](_0xd825('0xe'),_0x304f94,_0xd825('0xf'));_0x2ab414(_0x40e578[_0xd825('0x16')]['message']);}})[_0xd825('0x17')](function(_0x4965c0){logger[_0xd825('0x13')](_0xd825('0xe'),_0x304f94,_0x4965c0);_0x315347(_0x4965c0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 15e42fa..e8543f7 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 _0x47ee=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4c0d98,_0x2ad90b){var _0x113b95=function(_0x51741d){while(--_0x51741d){_0x4c0d98['push'](_0x4c0d98['shift']());}};_0x113b95(++_0x2ad90b);}(_0x47ee,0x1d9));var _0xe47e=function(_0x111122,_0xe3505a){_0x111122=_0x111122-0x0;var _0x47873e=_0x47ee[_0x111122];return _0x47873e;};'use strict';var multer=require('multer');var util=require(_0xe47e('0x0'));var path=require('path');var timeout=require(_0xe47e('0x1'));var express=require(_0xe47e('0x2'));var router=express[_0xe47e('0x3')]();var auth=require(_0xe47e('0x4'));var interaction=require(_0xe47e('0x5'));var config=require(_0xe47e('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0xe47e('0x7')]('/',auth[_0xe47e('0x8')](),controller[_0xe47e('0x9')]);router[_0xe47e('0x7')](_0xe47e('0xa'),auth[_0xe47e('0x8')](),controller[_0xe47e('0xb')]);router[_0xe47e('0x7')](_0xe47e('0xc'),auth[_0xe47e('0x8')](),controller[_0xe47e('0xd')]);router[_0xe47e('0xe')]('/',auth[_0xe47e('0x8')](),controller[_0xe47e('0xf')]);router[_0xe47e('0x10')](_0xe47e('0xc'),auth[_0xe47e('0x8')](),controller[_0xe47e('0x11')]);router[_0xe47e('0x12')](_0xe47e('0xc'),auth[_0xe47e('0x8')](),controller[_0xe47e('0x13')]);module[_0xe47e('0x14')]=router; \ No newline at end of file +var _0x73c3=['create','put','delete','multer','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2b0091,_0x21e744){var _0x41dca8=function(_0x2c1f1e){while(--_0x2c1f1e){_0x2b0091['push'](_0x2b0091['shift']());}};_0x41dca8(++_0x21e744);}(_0x73c3,0x73));var _0x373c=function(_0x259190,_0xa7fd7c){_0x259190=_0x259190-0x0;var _0x23d2aa=_0x73c3[_0x259190];return _0x23d2aa;};'use strict';var multer=require(_0x373c('0x0'));var util=require(_0x373c('0x1'));var path=require(_0x373c('0x2'));var timeout=require(_0x373c('0x3'));var express=require(_0x373c('0x4'));var router=express[_0x373c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x373c('0x6'));var controller=require(_0x373c('0x7'));router[_0x373c('0x8')]('/',auth[_0x373c('0x9')](),controller[_0x373c('0xa')]);router[_0x373c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x373c('0xb')]);router['get'](_0x373c('0xc'),auth[_0x373c('0x9')](),controller['show']);router['post']('/',auth[_0x373c('0x9')](),controller[_0x373c('0xd')]);router[_0x373c('0xe')](_0x373c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x373c('0xf')](_0x373c('0xc'),auth['isAuthenticated'](),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 77ba212..2e22b17 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 _0x07ac=['STRING','sequelize','exports'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x07ac,0x70));var _0xc07a=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x07ac[_0x5756f8];return _0x3bb749;};'use strict';var Sequelize=require(_0xc07a('0x0'));module[_0xc07a('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xc07a('0x2')]},'projectname':{'type':Sequelize[_0xc07a('0x2')]},'queue':{'type':Sequelize[_0xc07a('0x2')]},'uniqueid':{'type':Sequelize[_0xc07a('0x2')]},'calleridname':{'type':Sequelize[_0xc07a('0x2')]},'calleridnum':{'type':Sequelize[_0xc07a('0x2')]},'questionId':{'type':Sequelize[_0xc07a('0x2')]}}; \ No newline at end of file +var _0xc9af=['TEXT','long','sequelize','exports','STRING'];(function(_0x65ba05,_0x133b42){var _0x22af98=function(_0x2117bc){while(--_0x2117bc){_0x65ba05['push'](_0x65ba05['shift']());}};_0x22af98(++_0x133b42);}(_0xc9af,0x1dd));var _0xfc9a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc9af[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xfc9a('0x0'));module[_0xfc9a('0x1')]={'question':{'type':Sequelize[_0xfc9a('0x2')]},'answer':{'type':Sequelize[_0xfc9a('0x3')](_0xfc9a('0x4'))},'membername':{'type':Sequelize[_0xfc9a('0x2')]},'projectname':{'type':Sequelize[_0xfc9a('0x2')]},'queue':{'type':Sequelize[_0xfc9a('0x2')]},'uniqueid':{'type':Sequelize[_0xfc9a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfc9a('0x2')]},'questionId':{'type':Sequelize[_0xfc9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index acc03b8..14e2568 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 _0xe4cf=['send','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','merge','VIRTUAL','filter','JscriptyQuestionReport','then','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name'];(function(_0x692a51,_0x34eda4){var _0x19f86c=function(_0x5a1c77){while(--_0x5a1c77){_0x692a51['push'](_0x692a51['shift']());}};_0x19f86c(++_0x34eda4);}(_0xe4cf,0x19d));var _0xfe4c=function(_0x5a7aa3,_0x4451ab){_0x5a7aa3=_0x5a7aa3-0x0;var _0x4ee335=_0xe4cf[_0x5a7aa3];return _0x4ee335;};'use strict';var pdf=require(_0xfe4c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfe4c('0x1'));var jsonpatch=require(_0xfe4c('0x2'));var rp=require(_0xfe4c('0x3'));var moment=require(_0xfe4c('0x4'));var BPromise=require(_0xfe4c('0x5'));var Mustache=require(_0xfe4c('0x6'));var util=require(_0xfe4c('0x7'));var path=require(_0xfe4c('0x8'));var sox=require(_0xfe4c('0x9'));var csv=require(_0xfe4c('0xa'));var ejs=require(_0xfe4c('0xb'));var fs=require('fs');var _=require(_0xfe4c('0xc'));var squel=require(_0xfe4c('0xd'));var crypto=require(_0xfe4c('0xe'));var jsforce=require(_0xfe4c('0xf'));var deskjs=require(_0xfe4c('0x10'));var toCsv=require(_0xfe4c('0xa'));var querystring=require(_0xfe4c('0x11'));var Papa=require(_0xfe4c('0x12'));var Redis=require(_0xfe4c('0x13'));var authService=require(_0xfe4c('0x14'));var qs=require(_0xfe4c('0x15'));var as=require(_0xfe4c('0x16'));var hardwareService=require(_0xfe4c('0x17'));var logger=require(_0xfe4c('0x18'))(_0xfe4c('0x19'));var utils=require('../../config/utils');var config=require(_0xfe4c('0x1a'));var licenseUtil=require(_0xfe4c('0x1b'));var db=require(_0xfe4c('0x1c'))['db'];function respondWithStatusCode(_0x5478ca,_0x2fa023){_0x2fa023=_0x2fa023||0xcc;return function(_0x129049){if(_0x129049){return _0x5478ca['sendStatus'](_0x2fa023);}return _0x5478ca[_0xfe4c('0x1d')](_0x2fa023)[_0xfe4c('0x1e')]();};}function respondWithResult(_0x162dd1,_0x86d15f){_0x86d15f=_0x86d15f||0xc8;return function(_0x3dd6f1){if(_0x3dd6f1){return _0x162dd1[_0xfe4c('0x1d')](_0x86d15f)['json'](_0x3dd6f1);}};}function respondWithFilteredResult(_0x15edcb,_0x3a88bd){return function(_0x1f92d2){if(_0x1f92d2){var _0xc2d451=_0x1f92d2[_0xfe4c('0x1f')],_0x111e5=_0x3a88bd[_0xfe4c('0x20')],_0x50d67a=_0x3a88bd[_0xfe4c('0x20')]+_0x3a88bd['limit'],_0x1d7b79;if(_0x50d67a>=_0xc2d451){_0x50d67a=_0xc2d451;_0x1d7b79=0xc8;}else{_0x1d7b79=0xce;}_0x15edcb[_0xfe4c('0x1d')](_0x1d7b79);return _0x15edcb['set'](_0xfe4c('0x21'),_0x111e5+'-'+_0x50d67a+'/'+_0xc2d451)[_0xfe4c('0x22')](_0x1f92d2);}return null;};}function patchUpdates(_0x32a14c){return function(_0x55b9f7){try{jsonpatch[_0xfe4c('0x23')](_0x55b9f7,_0x32a14c,!![]);}catch(_0x4377e9){return BPromise[_0xfe4c('0x24')](_0x4377e9);}return _0x55b9f7[_0xfe4c('0x25')]();};}function saveUpdates(_0x14f649,_0x1ec47a){return function(_0x36f130){if(_0x36f130){return _0x36f130[_0xfe4c('0x26')](_0x14f649)['then'](function(_0x26416e){return _0x26416e;});}return null;};}function removeEntity(_0xd3db79,_0x791edc){return function(_0x3382fc){if(_0x3382fc){return _0x3382fc[_0xfe4c('0x27')]()['then'](function(){_0xd3db79[_0xfe4c('0x1d')](0xcc)[_0xfe4c('0x1e')]();});}};}function handleEntityNotFound(_0x1e4ebf,_0x3b975d){return function(_0x3f6404){if(!_0x3f6404){_0x1e4ebf[_0xfe4c('0x28')](0x194);}return _0x3f6404;};}function handleError(_0xbcc586,_0x31a03f){_0x31a03f=_0x31a03f||0x1f4;return function(_0x54793c){logger['error'](_0x54793c[_0xfe4c('0x29')]);if(_0x54793c[_0xfe4c('0x2a')]){delete _0x54793c[_0xfe4c('0x2a')];}_0xbcc586['status'](_0x31a03f)[_0xfe4c('0x2b')](_0x54793c);};}exports['index']=function(_0x29877d,_0x5557cb){var _0x3ec6ce={},_0x2f8642={},_0x102463={'count':0x0,'rows':[]};var _0x7fbd3f=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x215dcc){return{'name':_0x215dcc[_0xfe4c('0x2c')],'type':_0x215dcc[_0xfe4c('0x2d')][_0xfe4c('0x2e')]};});_0x2f8642['model']=_[_0xfe4c('0x2f')](_0x7fbd3f,_0xfe4c('0x2a'));_0x2f8642[_0xfe4c('0x30')]=_[_0xfe4c('0x31')](_0x29877d[_0xfe4c('0x30')]);_0x2f8642[_0xfe4c('0x32')]=_[_0xfe4c('0x33')](_0x2f8642[_0xfe4c('0x34')],_0x2f8642[_0xfe4c('0x30')]);_0x3ec6ce[_0xfe4c('0x35')]=_[_0xfe4c('0x33')](_0x2f8642['model'],qs[_0xfe4c('0x36')](_0x29877d[_0xfe4c('0x30')][_0xfe4c('0x36')]));_0x3ec6ce[_0xfe4c('0x35')]=_0x3ec6ce[_0xfe4c('0x35')][_0xfe4c('0x37')]?_0x3ec6ce[_0xfe4c('0x35')]:_0x2f8642[_0xfe4c('0x34')];if(!_0x29877d[_0xfe4c('0x30')][_0xfe4c('0x38')]('nolimit')){_0x3ec6ce[_0xfe4c('0x39')]=qs['limit'](_0x29877d[_0xfe4c('0x30')][_0xfe4c('0x39')]);_0x3ec6ce[_0xfe4c('0x20')]=qs[_0xfe4c('0x20')](_0x29877d[_0xfe4c('0x30')][_0xfe4c('0x20')]);}_0x3ec6ce['order']=qs[_0xfe4c('0x3a')](_0x29877d[_0xfe4c('0x30')]['sort']);_0x3ec6ce[_0xfe4c('0x3b')]=qs[_0xfe4c('0x32')](_['pick'](_0x29877d['query'],_0x2f8642[_0xfe4c('0x32')]),_0x7fbd3f);if(_0x29877d['query']['filter']){_0x3ec6ce[_0xfe4c('0x3b')]=_[_0xfe4c('0x3c')](_0x3ec6ce['where'],{'$or':_[_0xfe4c('0x2f')](_0x7fbd3f,function(_0x518511){if(_0x518511['type']!==_0xfe4c('0x3d')){var _0x45e96d={};_0x45e96d[_0x518511[_0xfe4c('0x2a')]]={'$like':'%'+_0x29877d[_0xfe4c('0x30')][_0xfe4c('0x3e')]+'%'};return _0x45e96d;}})});}_0x3ec6ce=_[_0xfe4c('0x3c')]({},_0x3ec6ce,_0x29877d['options']);var _0x3cebbd={'where':_0x3ec6ce[_0xfe4c('0x3b')]};return db[_0xfe4c('0x3f')][_0xfe4c('0x1f')](_0x3cebbd)[_0xfe4c('0x40')](function(_0x274dd1){_0x102463[_0xfe4c('0x1f')]=_0x274dd1;if(_0x29877d[_0xfe4c('0x30')][_0xfe4c('0x41')]){_0x3ec6ce[_0xfe4c('0x42')]=[{'all':!![]}];}return db[_0xfe4c('0x3f')][_0xfe4c('0x43')](_0x3ec6ce);})[_0xfe4c('0x40')](function(_0x209ef3){_0x102463['rows']=_0x209ef3;return _0x102463;})['then'](respondWithFilteredResult(_0x5557cb,_0x3ec6ce))[_0xfe4c('0x44')](handleError(_0x5557cb,null));};exports[_0xfe4c('0x45')]=function(_0xefba86,_0x494a37){var _0x31fb12={'raw':!![],'where':{'id':_0xefba86[_0xfe4c('0x46')]['id']}},_0x200ff4={};_0x200ff4['model']=_[_0xfe4c('0x31')](db[_0xfe4c('0x3f')]['rawAttributes']);_0x200ff4[_0xfe4c('0x30')]=_[_0xfe4c('0x31')](_0xefba86[_0xfe4c('0x30')]);_0x200ff4[_0xfe4c('0x32')]=_[_0xfe4c('0x33')](_0x200ff4[_0xfe4c('0x34')],_0x200ff4['query']);_0x31fb12[_0xfe4c('0x35')]=_[_0xfe4c('0x33')](_0x200ff4[_0xfe4c('0x34')],qs[_0xfe4c('0x36')](_0xefba86['query']['fields']));_0x31fb12['attributes']=_0x31fb12['attributes'][_0xfe4c('0x37')]?_0x31fb12['attributes']:_0x200ff4[_0xfe4c('0x34')];if(_0xefba86['query']['includeAll']){_0x31fb12[_0xfe4c('0x42')]=[{'all':!![]}];}_0x31fb12=_[_0xfe4c('0x3c')]({},_0x31fb12,_0xefba86[_0xfe4c('0x47')]);return db['JscriptyQuestionReport'][_0xfe4c('0x48')](_0x31fb12)[_0xfe4c('0x40')](handleEntityNotFound(_0x494a37,null))[_0xfe4c('0x40')](respondWithResult(_0x494a37,null))['catch'](handleError(_0x494a37,null));};exports['create']=function(_0xdb544f,_0x3ba1ff){return db[_0xfe4c('0x3f')][_0xfe4c('0x49')](_0xdb544f['body'],{})[_0xfe4c('0x40')](respondWithResult(_0x3ba1ff,0xc9))['catch'](handleError(_0x3ba1ff,null));};exports[_0xfe4c('0x26')]=function(_0x60ec9,_0x1174f4){if(_0x60ec9[_0xfe4c('0x4a')]['id']){delete _0x60ec9[_0xfe4c('0x4a')]['id'];}return db[_0xfe4c('0x3f')][_0xfe4c('0x48')]({'where':{'id':_0x60ec9[_0xfe4c('0x46')]['id']}})[_0xfe4c('0x40')](handleEntityNotFound(_0x1174f4,null))['then'](saveUpdates(_0x60ec9[_0xfe4c('0x4a')],null))[_0xfe4c('0x40')](respondWithResult(_0x1174f4,null))[_0xfe4c('0x44')](handleError(_0x1174f4,null));};exports[_0xfe4c('0x27')]=function(_0x2737b4,_0x30ca37){return db[_0xfe4c('0x3f')][_0xfe4c('0x48')]({'where':{'id':_0x2737b4[_0xfe4c('0x46')]['id']}})[_0xfe4c('0x40')](handleEntityNotFound(_0x30ca37,null))[_0xfe4c('0x40')](removeEntity(_0x30ca37,null))[_0xfe4c('0x44')](handleError(_0x30ca37,null));};exports[_0xfe4c('0x4b')]=function(_0x4d0f57,_0x12b653){return db['JscriptyQuestionReport']['describe']()[_0xfe4c('0x40')](respondWithResult(_0x12b653,null))[_0xfe4c('0x44')](handleError(_0x12b653,null));}; \ No newline at end of file +var _0x8829=['crypto','jsforce','desk.js','to-csv','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','apply','reject','save','update','then','destroy','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','params','keys','create','body','catch','find','describe','html-pdf','eml-format','moment','mustache','util','path','lodash','squel'];(function(_0x141a67,_0x575661){var _0x1936fb=function(_0x5a626d){while(--_0x5a626d){_0x141a67['push'](_0x141a67['shift']());}};_0x1936fb(++_0x575661);}(_0x8829,0x19c));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9882('0x0'));var emlformat=require(_0x9882('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9882('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9882('0x3'));var util=require(_0x9882('0x4'));var path=require(_0x9882('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9882('0x6'));var squel=require(_0x9882('0x7'));var crypto=require(_0x9882('0x8'));var jsforce=require(_0x9882('0x9'));var deskjs=require(_0x9882('0xa'));var toCsv=require(_0x9882('0xb'));var querystring=require('querystring');var Papa=require(_0x9882('0xc'));var Redis=require('ioredis');var authService=require(_0x9882('0xd'));var qs=require(_0x9882('0xe'));var as=require(_0x9882('0xf'));var hardwareService=require(_0x9882('0x10'));var logger=require(_0x9882('0x11'))('api');var utils=require(_0x9882('0x12'));var config=require(_0x9882('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9882('0x14'))['db'];function respondWithStatusCode(_0x377557,_0x4f6c25){_0x4f6c25=_0x4f6c25||0xcc;return function(_0xe5b307){if(_0xe5b307){return _0x377557[_0x9882('0x15')](_0x4f6c25);}return _0x377557[_0x9882('0x16')](_0x4f6c25)[_0x9882('0x17')]();};}function respondWithResult(_0x405455,_0x11853a){_0x11853a=_0x11853a||0xc8;return function(_0xe9935c){if(_0xe9935c){return _0x405455[_0x9882('0x16')](_0x11853a)[_0x9882('0x18')](_0xe9935c);}};}function respondWithFilteredResult(_0x40d741,_0xfe35b){return function(_0x55e055){if(_0x55e055){var _0x5301d0=_0x55e055[_0x9882('0x19')],_0x3caec7=_0xfe35b['offset'],_0x198fe9=_0xfe35b[_0x9882('0x1a')]+_0xfe35b[_0x9882('0x1b')],_0x267550;if(_0x198fe9>=_0x5301d0){_0x198fe9=_0x5301d0;_0x267550=0xc8;}else{_0x267550=0xce;}_0x40d741['status'](_0x267550);return _0x40d741[_0x9882('0x1c')]('Content-Range',_0x3caec7+'-'+_0x198fe9+'/'+_0x5301d0)[_0x9882('0x18')](_0x55e055);}return null;};}function patchUpdates(_0x417430){return function(_0x5ef79d){try{jsonpatch[_0x9882('0x1d')](_0x5ef79d,_0x417430,!![]);}catch(_0x2521f8){return BPromise[_0x9882('0x1e')](_0x2521f8);}return _0x5ef79d[_0x9882('0x1f')]();};}function saveUpdates(_0x200df4,_0xacf092){return function(_0x1abc27){if(_0x1abc27){return _0x1abc27[_0x9882('0x20')](_0x200df4)[_0x9882('0x21')](function(_0x1e0161){return _0x1e0161;});}return null;};}function removeEntity(_0x39cf41,_0x4f7632){return function(_0x8d44ca){if(_0x8d44ca){return _0x8d44ca[_0x9882('0x22')]()['then'](function(){_0x39cf41['status'](0xcc)[_0x9882('0x17')]();});}};}function handleEntityNotFound(_0x2218ad,_0x3a73ec){return function(_0x100166){if(!_0x100166){_0x2218ad[_0x9882('0x15')](0x194);}return _0x100166;};}function handleError(_0x49126b,_0x37c12c){_0x37c12c=_0x37c12c||0x1f4;return function(_0x55cdee){logger['error'](_0x55cdee['stack']);if(_0x55cdee[_0x9882('0x23')]){delete _0x55cdee[_0x9882('0x23')];}_0x49126b[_0x9882('0x16')](_0x37c12c)[_0x9882('0x24')](_0x55cdee);};}exports[_0x9882('0x25')]=function(_0x4cfa37,_0x1172a4){var _0x1e6b02={},_0x38e0be={},_0x463d00={'count':0x0,'rows':[]};var _0x3a00cf=_[_0x9882('0x26')](db[_0x9882('0x27')][_0x9882('0x28')],function(_0x126f05){return{'name':_0x126f05[_0x9882('0x29')],'type':_0x126f05['type'][_0x9882('0x2a')]};});_0x38e0be[_0x9882('0x2b')]=_['map'](_0x3a00cf,_0x9882('0x23'));_0x38e0be[_0x9882('0x2c')]=_['keys'](_0x4cfa37[_0x9882('0x2c')]);_0x38e0be[_0x9882('0x2d')]=_[_0x9882('0x2e')](_0x38e0be[_0x9882('0x2b')],_0x38e0be[_0x9882('0x2c')]);_0x1e6b02['attributes']=_[_0x9882('0x2e')](_0x38e0be[_0x9882('0x2b')],qs[_0x9882('0x2f')](_0x4cfa37[_0x9882('0x2c')][_0x9882('0x2f')]));_0x1e6b02[_0x9882('0x30')]=_0x1e6b02['attributes']['length']?_0x1e6b02[_0x9882('0x30')]:_0x38e0be[_0x9882('0x2b')];if(!_0x4cfa37[_0x9882('0x2c')][_0x9882('0x31')](_0x9882('0x32'))){_0x1e6b02['limit']=qs[_0x9882('0x1b')](_0x4cfa37[_0x9882('0x2c')][_0x9882('0x1b')]);_0x1e6b02[_0x9882('0x1a')]=qs[_0x9882('0x1a')](_0x4cfa37[_0x9882('0x2c')][_0x9882('0x1a')]);}_0x1e6b02[_0x9882('0x33')]=qs[_0x9882('0x34')](_0x4cfa37[_0x9882('0x2c')]['sort']);_0x1e6b02[_0x9882('0x35')]=qs['filters'](_[_0x9882('0x36')](_0x4cfa37['query'],_0x38e0be[_0x9882('0x2d')]),_0x3a00cf);if(_0x4cfa37['query'][_0x9882('0x37')]){_0x1e6b02[_0x9882('0x35')]=_['merge'](_0x1e6b02[_0x9882('0x35')],{'$or':_['map'](_0x3a00cf,function(_0x3dadea){if(_0x3dadea[_0x9882('0x38')]!==_0x9882('0x39')){var _0x33107e={};_0x33107e[_0x3dadea['name']]={'$like':'%'+_0x4cfa37[_0x9882('0x2c')][_0x9882('0x37')]+'%'};return _0x33107e;}})});}_0x1e6b02=_[_0x9882('0x3a')]({},_0x1e6b02,_0x4cfa37[_0x9882('0x3b')]);var _0x10cac2={'where':_0x1e6b02['where']};return db[_0x9882('0x27')][_0x9882('0x19')](_0x10cac2)['then'](function(_0x4e799f){_0x463d00['count']=_0x4e799f;if(_0x4cfa37[_0x9882('0x2c')][_0x9882('0x3c')]){_0x1e6b02[_0x9882('0x3d')]=[{'all':!![]}];}return db[_0x9882('0x27')]['findAll'](_0x1e6b02);})[_0x9882('0x21')](function(_0x2b29ab){_0x463d00[_0x9882('0x3e')]=_0x2b29ab;return _0x463d00;})[_0x9882('0x21')](respondWithFilteredResult(_0x1172a4,_0x1e6b02))['catch'](handleError(_0x1172a4,null));};exports['show']=function(_0x5f1b26,_0x4436af){var _0x469820={'raw':!![],'where':{'id':_0x5f1b26[_0x9882('0x3f')]['id']}},_0x57d064={};_0x57d064[_0x9882('0x2b')]=_[_0x9882('0x40')](db['JscriptyQuestionReport'][_0x9882('0x28')]);_0x57d064[_0x9882('0x2c')]=_[_0x9882('0x40')](_0x5f1b26[_0x9882('0x2c')]);_0x57d064[_0x9882('0x2d')]=_['intersection'](_0x57d064[_0x9882('0x2b')],_0x57d064[_0x9882('0x2c')]);_0x469820[_0x9882('0x30')]=_[_0x9882('0x2e')](_0x57d064[_0x9882('0x2b')],qs[_0x9882('0x2f')](_0x5f1b26[_0x9882('0x2c')]['fields']));_0x469820[_0x9882('0x30')]=_0x469820[_0x9882('0x30')]['length']?_0x469820['attributes']:_0x57d064[_0x9882('0x2b')];if(_0x5f1b26[_0x9882('0x2c')][_0x9882('0x3c')]){_0x469820[_0x9882('0x3d')]=[{'all':!![]}];}_0x469820=_['merge']({},_0x469820,_0x5f1b26[_0x9882('0x3b')]);return db[_0x9882('0x27')]['find'](_0x469820)[_0x9882('0x21')](handleEntityNotFound(_0x4436af,null))[_0x9882('0x21')](respondWithResult(_0x4436af,null))['catch'](handleError(_0x4436af,null));};exports[_0x9882('0x41')]=function(_0x339fdb,_0x352483){return db['JscriptyQuestionReport'][_0x9882('0x41')](_0x339fdb[_0x9882('0x42')],{})[_0x9882('0x21')](respondWithResult(_0x352483,0xc9))[_0x9882('0x43')](handleError(_0x352483,null));};exports[_0x9882('0x20')]=function(_0x5bfc94,_0x4ef07b){if(_0x5bfc94[_0x9882('0x42')]['id']){delete _0x5bfc94[_0x9882('0x42')]['id'];}return db[_0x9882('0x27')][_0x9882('0x44')]({'where':{'id':_0x5bfc94[_0x9882('0x3f')]['id']}})[_0x9882('0x21')](handleEntityNotFound(_0x4ef07b,null))[_0x9882('0x21')](saveUpdates(_0x5bfc94[_0x9882('0x42')],null))[_0x9882('0x21')](respondWithResult(_0x4ef07b,null))[_0x9882('0x43')](handleError(_0x4ef07b,null));};exports[_0x9882('0x22')]=function(_0x32a289,_0x475a35){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x32a289[_0x9882('0x3f')]['id']}})[_0x9882('0x21')](handleEntityNotFound(_0x475a35,null))[_0x9882('0x21')](removeEntity(_0x475a35,null))[_0x9882('0x43')](handleError(_0x475a35,null));};exports[_0x9882('0x45')]=function(_0x2ee731,_0x4c8749){return db[_0x9882('0x27')][_0x9882('0x45')]()['then'](respondWithResult(_0x4c8749,null))[_0x9882('0x43')](handleError(_0x4c8749,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ffe4658..1769626 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 _0x0d44=['request-promise','path','../../config/environment','exports','define','util','../../config/logger'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x0d44,0xa6));var _0x40d4=function(_0x2166c3,_0x90e9af){_0x2166c3=_0x2166c3-0x0;var _0x270f55=_0x0d44[_0x2166c3];return _0x270f55;};'use strict';var _=require('lodash');var util=require(_0x40d4('0x0'));var logger=require(_0x40d4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x40d4('0x2'));var fs=require('fs');var path=require(_0x40d4('0x3'));var rimraf=require('rimraf');var config=require(_0x40d4('0x4'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x40d4('0x5')]=function(_0x555986,_0x1b67d8){return _0x555986[_0x40d4('0x6')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb584=['report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x5a300a,_0x198ebb){var _0xb2260f=function(_0x2ab871){while(--_0x2ab871){_0x5a300a['push'](_0x5a300a['shift']());}};_0xb2260f(++_0x198ebb);}(_0xb584,0x1c1));var _0x4b58=function(_0x498788,_0x823fdd){_0x498788=_0x498788-0x0;var _0xa0e68=_0xb584[_0x498788];return _0xa0e68;};'use strict';var _=require(_0x4b58('0x0'));var util=require('util');var logger=require(_0x4b58('0x1'))(_0x4b58('0x2'));var moment=require(_0x4b58('0x3'));var BPromise=require(_0x4b58('0x4'));var rp=require(_0x4b58('0x5'));var fs=require('fs');var path=require(_0x4b58('0x6'));var rimraf=require(_0x4b58('0x7'));var config=require(_0x4b58('0x8'));var attributes=require(_0x4b58('0x9'));module[_0x4b58('0xa')]=function(_0x223bd3,_0x1e23b6){return _0x223bd3[_0x4b58('0xb')](_0x4b58('0xc'),attributes,{'tableName':_0x4b58('0xd'),'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 3f7b044..147d5bd 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 _0xfd23=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfd23,0xb4));var _0x3fd2=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xfd23[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0x3fd2('0x0'));var util=require('util');var moment=require(_0x3fd2('0x1'));var BPromise=require(_0x3fd2('0x2'));var rs=require(_0x3fd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fd2('0x4'))['db'];var utils=require(_0x3fd2('0x5'));var logger=require(_0x3fd2('0x6'))(_0x3fd2('0x7'));var config=require(_0x3fd2('0x8'));var jayson=require(_0x3fd2('0x9'));var client=jayson['client'][_0x3fd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d1344,_0xb1b569,_0xca087d){return new BPromise(function(_0x63caff,_0x201ded){return client[_0x3fd2('0xb')](_0x5d1344,_0xca087d)[_0x3fd2('0xc')](function(_0x576978){logger[_0x3fd2('0xd')](_0x3fd2('0xe'),_0xb1b569,_0x3fd2('0xf'));logger[_0x3fd2('0x10')](_0x3fd2('0x11'),_0xb1b569,_0x3fd2('0xf'),JSON[_0x3fd2('0x12')](_0x576978));if(_0x576978[_0x3fd2('0x13')]){if(_0x576978[_0x3fd2('0x13')][_0x3fd2('0x14')]===0x1f4){logger[_0x3fd2('0x13')](_0x3fd2('0xe'),_0xb1b569,_0x576978[_0x3fd2('0x13')][_0x3fd2('0x15')]);return _0x201ded(_0x576978[_0x3fd2('0x13')][_0x3fd2('0x15')]);}logger[_0x3fd2('0x13')](_0x3fd2('0xe'),_0xb1b569,_0x576978[_0x3fd2('0x13')]['message']);return _0x63caff(_0x576978[_0x3fd2('0x13')]['message']);}else{logger['info'](_0x3fd2('0xe'),_0xb1b569,_0x3fd2('0xf'));_0x63caff(_0x576978[_0x3fd2('0x16')]['message']);}})['catch'](function(_0x6eb090){logger[_0x3fd2('0x13')](_0x3fd2('0xe'),_0xb1b569,_0x6eb090);_0x201ded(_0x6eb090);});});} \ No newline at end of file +var _0xa5d2=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x1dc916,_0x33ce0c){var _0x46fa0f=function(_0x4e62c9){while(--_0x4e62c9){_0x1dc916['push'](_0x1dc916['shift']());}};_0x46fa0f(++_0x33ce0c);}(_0xa5d2,0xef));var _0x2a5d=function(_0x3c2802,_0x2e63f2){_0x3c2802=_0x3c2802-0x0;var _0x82142c=_0xa5d2[_0x3c2802];return _0x82142c;};'use strict';var _=require(_0x2a5d('0x0'));var util=require(_0x2a5d('0x1'));var moment=require(_0x2a5d('0x2'));var BPromise=require(_0x2a5d('0x3'));var rs=require(_0x2a5d('0x4'));var fs=require('fs');var Redis=require(_0x2a5d('0x5'));var db=require(_0x2a5d('0x6'))['db'];var utils=require(_0x2a5d('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2a5d('0x8'));var client=jayson[_0x2a5d('0x9')][_0x2a5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5de895,_0x5d9cba,_0x41a128){return new BPromise(function(_0x24433a,_0x232e12){return client[_0x2a5d('0xb')](_0x5de895,_0x41a128)[_0x2a5d('0xc')](function(_0x3ef3e0){logger['info'](_0x2a5d('0xd'),_0x5d9cba,_0x2a5d('0xe'));logger[_0x2a5d('0xf')](_0x2a5d('0x10'),_0x5d9cba,'request\x20sent',JSON[_0x2a5d('0x11')](_0x3ef3e0));if(_0x3ef3e0['error']){if(_0x3ef3e0[_0x2a5d('0x12')]['code']===0x1f4){logger[_0x2a5d('0x12')](_0x2a5d('0xd'),_0x5d9cba,_0x3ef3e0['error'][_0x2a5d('0x13')]);return _0x232e12(_0x3ef3e0[_0x2a5d('0x12')][_0x2a5d('0x13')]);}logger[_0x2a5d('0x12')](_0x2a5d('0xd'),_0x5d9cba,_0x3ef3e0['error'][_0x2a5d('0x13')]);return _0x24433a(_0x3ef3e0[_0x2a5d('0x12')][_0x2a5d('0x13')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5d9cba,'request\x20sent');_0x24433a(_0x3ef3e0['result']['message']);}})[_0x2a5d('0x14')](function(_0xa5dc8a){logger[_0x2a5d('0x12')](_0x2a5d('0xd'),_0x5d9cba,_0xa5dc8a);_0x232e12(_0xa5dc8a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4fa8712..4af5323 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 _0xd13e=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create'];(function(_0x484fca,_0x23119a){var _0xdcb8db=function(_0x544111){while(--_0x544111){_0x484fca['push'](_0x484fca['shift']());}};_0xdcb8db(++_0x23119a);}(_0xd13e,0x193));var _0xed13=function(_0x4ef467,_0x14e13){_0x4ef467=_0x4ef467-0x0;var _0x1cefe8=_0xd13e[_0x4ef467];return _0x1cefe8;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xed13('0x5'));var config=require('../../config/environment');var controller=require(_0xed13('0x6'));router[_0xed13('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xed13('0x8'),auth[_0xed13('0x9')](),controller[_0xed13('0xa')]);router[_0xed13('0x7')](_0xed13('0xb'),auth[_0xed13('0x9')](),controller[_0xed13('0xc')]);router[_0xed13('0x7')](_0xed13('0xd'),auth['isAuthenticated'](),controller[_0xed13('0xe')]);router[_0xed13('0xf')]('/',auth[_0xed13('0x9')](),controller[_0xed13('0x10')]);router[_0xed13('0x11')]('/:id',auth[_0xed13('0x9')](),controller[_0xed13('0x12')]);router[_0xed13('0x13')](_0xed13('0xb'),auth[_0xed13('0x9')](),controller[_0xed13('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2fed=['getQuestions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/questions'];(function(_0x2e1271,_0x4bd6cd){var _0x852182=function(_0x1ea09f){while(--_0x1ea09f){_0x2e1271['push'](_0x2e1271['shift']());}};_0x852182(++_0x4bd6cd);}(_0x2fed,0x7c));var _0xd2fe=function(_0x441902,_0xd94685){_0x441902=_0x441902-0x0;var _0x5f1efa=_0x2fed[_0x441902];return _0x5f1efa;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var path=require(_0xd2fe('0x2'));var timeout=require(_0xd2fe('0x3'));var express=require(_0xd2fe('0x4'));var router=express['Router']();var auth=require(_0xd2fe('0x5'));var interaction=require(_0xd2fe('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xd2fe('0x7')]('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x9')]);router['get'](_0xd2fe('0xa'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xb')]);router[_0xd2fe('0x7')]('/:id',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xc')]);router[_0xd2fe('0x7')](_0xd2fe('0xd'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xe')]);router[_0xd2fe('0xf')]('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x10')]);router[_0xd2fe('0x11')](_0xd2fe('0x12'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x13')]);router[_0xd2fe('0x14')](_0xd2fe('0x12'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x15')]);module[_0xd2fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ee4b381..8464d52 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 _0xc754=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0xc754,0x1cb));var _0x4c75=function(_0x4a0e10,_0x4b0112){_0x4a0e10=_0x4a0e10-0x0;var _0x467bb4=_0xc754[_0x4a0e10];return _0x467bb4;};'use strict';var moment=require(_0x4c75('0x0'));var Sequelize=require(_0x4c75('0x1'));module[_0x4c75('0x2')]={'starttime':{'type':Sequelize[_0x4c75('0x3')],'set':function(_0x155607){this[_0x4c75('0x4')](_0x4c75('0x5'),_0x155607);this[_0x4c75('0x4')](_0x4c75('0x6'),moment()[_0x4c75('0x7')](_0x4c75('0x8')));}},'endtime':{'type':Sequelize[_0x4c75('0x3')]},'membername':{'type':Sequelize[_0x4c75('0x9')]},'projectname':{'type':Sequelize[_0x4c75('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4c75('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x4c75('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x62f9=['BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x1d8e5f,_0x274a04){var _0xe62e12=function(_0x5ee006){while(--_0x5ee006){_0x1d8e5f['push'](_0x1d8e5f['shift']());}};_0xe62e12(++_0x274a04);}(_0x62f9,0xe7));var _0x962f=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x62f9[_0x1fc84d];return _0x2658fa;};'use strict';var moment=require(_0x962f('0x0'));var Sequelize=require(_0x962f('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x962f('0x2')],'set':function(_0x517014){this[_0x962f('0x3')](_0x962f('0x4'),_0x517014);this[_0x962f('0x3')](_0x962f('0x5'),moment()[_0x962f('0x6')](_0x962f('0x7')));}},'endtime':{'type':Sequelize[_0x962f('0x2')]},'membername':{'type':Sequelize[_0x962f('0x8')]},'projectname':{'type':Sequelize[_0x962f('0x8')]},'queue':{'type':Sequelize[_0x962f('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x962f('0x8')]},'calleridnum':{'type':Sequelize[_0x962f('0x8')]},'completed':{'type':Sequelize[_0x962f('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index f111d1f..09f62c8 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 _0xd8b0=['options','includeAll','include','rows','catch','show','params','intersection','merge','create','body','update','find','describe','rawAttributes','SessionId','map','JscriptyQuestionReport','findAll','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','JscriptySessionReport','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var licenseUtil=require(_0x0d8b('0x15'));var db=require(_0x0d8b('0x16'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x17')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b)[_0x0d8b('0x19')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x18')](_0x5ad086)[_0x0d8b('0x1a')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=_0xa86349[_0x0d8b('0x1b')],_0xe2e167=_0x23eb7b[_0x0d8b('0x1c')],_0x2cb03c=_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b[_0x0d8b('0x1d')],_0x5cd485;if(_0x2cb03c>=_0x17f7df){_0x2cb03c=_0x17f7df;_0x5cd485=0xc8;}else{_0x5cd485=0xce;}_0x4f6f21[_0x0d8b('0x18')](_0x5cd485);return _0x4f6f21[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0xe2e167+'-'+_0x2cb03c+'/'+_0x17f7df)[_0x0d8b('0x1a')](_0xa86349);}return null;};}function patchUpdates(_0x4a15bf){return function(_0x27512e){try{jsonpatch[_0x0d8b('0x20')](_0x27512e,_0x4a15bf,!![]);}catch(_0x196c0a){return BPromise[_0x0d8b('0x21')](_0x196c0a);}return _0x27512e[_0x0d8b('0x22')]();};}function saveUpdates(_0x5b709c,_0x393beb){return function(_0x352c17){if(_0x352c17){return _0x352c17['update'](_0x5b709c)['then'](function(_0x33fb87){return _0x33fb87;});}return null;};}function removeEntity(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')]()[_0x0d8b('0x24')](function(){_0x54a9a7[_0x0d8b('0x18')](0xcc)[_0x0d8b('0x19')]();});}};}function handleEntityNotFound(_0x221071,_0x2c64e2){return function(_0x30980c){if(!_0x30980c){_0x221071[_0x0d8b('0x17')](0x194);}return _0x30980c;};}function handleError(_0x27b695,_0x5e5bc3){_0x5e5bc3=_0x5e5bc3||0x1f4;return function(_0xe8bbee){logger[_0x0d8b('0x25')](_0xe8bbee['stack']);if(_0xe8bbee[_0x0d8b('0x26')]){delete _0xe8bbee['name'];}_0x27b695[_0x0d8b('0x18')](_0x5e5bc3)[_0x0d8b('0x27')](_0xe8bbee);};}exports[_0x0d8b('0x28')]=function(_0x4fe6f9,_0x59a905){var _0x28f639={},_0x3ef745={},_0x4c05ee={'count':0x0,'rows':[]};var _0xcbc4ac=_['map'](db[_0x0d8b('0x29')]['rawAttributes'],function(_0x97050a){return{'name':_0x97050a['fieldName'],'type':_0x97050a[_0x0d8b('0x2a')]['key']};});_0x3ef745[_0x0d8b('0x2b')]=_['map'](_0xcbc4ac,_0x0d8b('0x26'));_0x3ef745[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0x4fe6f9['query']);_0x3ef745['filters']=_['intersection'](_0x3ef745[_0x0d8b('0x2b')],_0x3ef745['query']);_0x28f639[_0x0d8b('0x2e')]=_['intersection'](_0x3ef745['model'],qs[_0x0d8b('0x2f')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x28f639[_0x0d8b('0x2e')]=_0x28f639[_0x0d8b('0x2e')][_0x0d8b('0x30')]?_0x28f639[_0x0d8b('0x2e')]:_0x3ef745[_0x0d8b('0x2b')];if(!_0x4fe6f9['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x28f639['limit']=qs[_0x0d8b('0x1d')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x28f639['offset']=qs[_0x0d8b('0x1c')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1c')]);}_0x28f639[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x4fe6f9['query'][_0x0d8b('0x34')]);_0x28f639[_0x0d8b('0x35')]=qs['filters'](_[_0x0d8b('0x36')](_0x4fe6f9[_0x0d8b('0x2c')],_0x3ef745[_0x0d8b('0x37')]),_0xcbc4ac);if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x28f639['where']=_['merge'](_0x28f639[_0x0d8b('0x35')],{'$or':_['map'](_0xcbc4ac,function(_0x531c55){if(_0x531c55[_0x0d8b('0x2a')]!==_0x0d8b('0x39')){var _0x15ec8a={};_0x15ec8a[_0x531c55[_0x0d8b('0x26')]]={'$like':'%'+_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x15ec8a;}})});}_0x28f639=_['merge']({},_0x28f639,_0x4fe6f9[_0x0d8b('0x3a')]);var _0x6a02ad={'where':_0x28f639[_0x0d8b('0x35')]};return db[_0x0d8b('0x29')][_0x0d8b('0x1b')](_0x6a02ad)[_0x0d8b('0x24')](function(_0xf1680e){_0x4c05ee['count']=_0xf1680e;if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x3b')]){_0x28f639[_0x0d8b('0x3c')]=[{'all':!![]}];}return db[_0x0d8b('0x29')]['findAll'](_0x28f639);})[_0x0d8b('0x24')](function(_0x4b4bde){_0x4c05ee[_0x0d8b('0x3d')]=_0x4b4bde;return _0x4c05ee;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x59a905,_0x28f639))[_0x0d8b('0x3e')](handleError(_0x59a905,null));};exports[_0x0d8b('0x3f')]=function(_0x35fa7e,_0x3e632e){var _0x1ff17d={'raw':!![],'where':{'id':_0x35fa7e[_0x0d8b('0x40')]['id']}},_0x373f69={};_0x373f69[_0x0d8b('0x2b')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x373f69['query']=_['keys'](_0x35fa7e[_0x0d8b('0x2c')]);_0x373f69[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x373f69['model'],_0x373f69['query']);_0x1ff17d[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x373f69[_0x0d8b('0x2b')],qs['fields'](_0x35fa7e[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x1ff17d['attributes']=_0x1ff17d['attributes'][_0x0d8b('0x30')]?_0x1ff17d['attributes']:_0x373f69[_0x0d8b('0x2b')];if(_0x35fa7e['query']['includeAll']){_0x1ff17d[_0x0d8b('0x3c')]=[{'all':!![]}];}_0x1ff17d=_[_0x0d8b('0x42')]({},_0x1ff17d,_0x35fa7e['options']);return db['JscriptySessionReport']['find'](_0x1ff17d)['then'](handleEntityNotFound(_0x3e632e,null))[_0x0d8b('0x24')](respondWithResult(_0x3e632e,null))[_0x0d8b('0x3e')](handleError(_0x3e632e,null));};exports[_0x0d8b('0x43')]=function(_0x490eda,_0xb0910e){return db[_0x0d8b('0x29')][_0x0d8b('0x43')](_0x490eda[_0x0d8b('0x44')],{})[_0x0d8b('0x24')](respondWithResult(_0xb0910e,0xc9))[_0x0d8b('0x3e')](handleError(_0xb0910e,null));};exports[_0x0d8b('0x45')]=function(_0x1d5067,_0x384a5e){if(_0x1d5067[_0x0d8b('0x44')]['id']){delete _0x1d5067[_0x0d8b('0x44')]['id'];}return db[_0x0d8b('0x29')][_0x0d8b('0x46')]({'where':{'id':_0x1d5067[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x384a5e,null))[_0x0d8b('0x24')](saveUpdates(_0x1d5067[_0x0d8b('0x44')],null))[_0x0d8b('0x24')](respondWithResult(_0x384a5e,null))[_0x0d8b('0x3e')](handleError(_0x384a5e,null));};exports['destroy']=function(_0x371fa0,_0x4d8850){return db['JscriptySessionReport'][_0x0d8b('0x46')]({'where':{'id':_0x371fa0[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x4d8850,null))[_0x0d8b('0x24')](removeEntity(_0x4d8850,null))['catch'](handleError(_0x4d8850,null));};exports[_0x0d8b('0x47')]=function(_0x1106d6,_0x386074){return db[_0x0d8b('0x29')][_0x0d8b('0x47')]()['then'](respondWithResult(_0x386074,null))['catch'](handleError(_0x386074,null));};exports['getQuestions']=function(_0x573f4f,_0x368ede,_0xf22c3c){var _0x5e3bb4={'raw':!![],'where':{}};var _0x4950a8={};var _0x44c5c1={'count':0x0,'rows':[]};return db[_0x0d8b('0x29')]['findOne']({'where':{'id':_0x573f4f['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x24')](function(_0x3cd00a){if(_0x3cd00a){_0x4950a8[_0x0d8b('0x2b')]=_[_0x0d8b('0x2d')](db['JscriptyQuestionReport'][_0x0d8b('0x48')]);_0x4950a8[_0x0d8b('0x2c')]=_['keys'](_0x573f4f['query']);_0x4950a8[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x4950a8['model'],_0x4950a8['query']);_0x5e3bb4[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x4950a8[_0x0d8b('0x2b')],qs[_0x0d8b('0x2f')](_0x573f4f['query'][_0x0d8b('0x2f')]));_0x5e3bb4['attributes']=_0x5e3bb4['attributes'][_0x0d8b('0x30')]?_0x5e3bb4[_0x0d8b('0x2e')]:_0x4950a8['model'];if(!_0x573f4f['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x5e3bb4[_0x0d8b('0x1d')]=qs[_0x0d8b('0x1d')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x5e3bb4[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x573f4f['query'][_0x0d8b('0x1c')]);}_0x5e3bb4[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x34')]);_0x5e3bb4[_0x0d8b('0x35')]=qs[_0x0d8b('0x37')](_[_0x0d8b('0x36')](_0x573f4f[_0x0d8b('0x2c')],_0x4950a8['filters']));_0x5e3bb4[_0x0d8b('0x35')][_0x0d8b('0x49')]=_0x3cd00a['id'];if(_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x5e3bb4[_0x0d8b('0x35')]=_['merge'](_0x5e3bb4[_0x0d8b('0x35')],{'$or':_[_0x0d8b('0x4a')](_0x5e3bb4[_0x0d8b('0x2e')],function(_0x17a87f){var _0x1d6cd4={};_0x1d6cd4[_0x17a87f]={'$like':'%'+_0x573f4f['query']['filter']+'%'};return _0x1d6cd4;})});}_0x5e3bb4=_[_0x0d8b('0x42')]({},_0x5e3bb4,_0x573f4f[_0x0d8b('0x3a')]);return db[_0x0d8b('0x4b')][_0x0d8b('0x1b')]({'where':_0x5e3bb4['where']})[_0x0d8b('0x24')](function(_0x12aef7){_0x44c5c1[_0x0d8b('0x1b')]=_0x12aef7;if(_0x573f4f['query'][_0x0d8b('0x3b')]){_0x5e3bb4['include']=[{'all':!![]}];}return db[_0x0d8b('0x4b')][_0x0d8b('0x4c')](_0x5e3bb4);})[_0x0d8b('0x24')](function(_0x26ccf0){_0x44c5c1[_0x0d8b('0x3d')]=_0x26ccf0;return _0x44c5c1;});}})[_0x0d8b('0x24')](respondWithFilteredResult(_0x368ede,_0x5e3bb4))['catch'](handleError(_0x368ede,null));}; \ No newline at end of file +var _0xd8b0=['options','includeAll','include','rows','catch','show','params','intersection','merge','create','body','update','find','describe','rawAttributes','SessionId','map','JscriptyQuestionReport','findAll','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','JscriptySessionReport','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var licenseUtil=require(_0x0d8b('0x15'));var db=require(_0x0d8b('0x16'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x17')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b)[_0x0d8b('0x19')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x18')](_0x5ad086)[_0x0d8b('0x1a')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=_0xa86349[_0x0d8b('0x1b')],_0xe2e167=_0x23eb7b[_0x0d8b('0x1c')],_0x2cb03c=_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b[_0x0d8b('0x1d')],_0x5cd485;if(_0x2cb03c>=_0x17f7df){_0x2cb03c=_0x17f7df;_0x5cd485=0xc8;}else{_0x5cd485=0xce;}_0x4f6f21[_0x0d8b('0x18')](_0x5cd485);return _0x4f6f21[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0xe2e167+'-'+_0x2cb03c+'/'+_0x17f7df)[_0x0d8b('0x1a')](_0xa86349);}return null;};}function patchUpdates(_0x4a15bf){return function(_0x27512e){try{jsonpatch[_0x0d8b('0x20')](_0x27512e,_0x4a15bf,!![]);}catch(_0x196c0a){return BPromise[_0x0d8b('0x21')](_0x196c0a);}return _0x27512e[_0x0d8b('0x22')]();};}function saveUpdates(_0x5b709c,_0x393beb){return function(_0x352c17){if(_0x352c17){return _0x352c17['update'](_0x5b709c)['then'](function(_0x33fb87){return _0x33fb87;});}return null;};}function removeEntity(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')]()[_0x0d8b('0x24')](function(){_0x54a9a7[_0x0d8b('0x18')](0xcc)[_0x0d8b('0x19')]();});}};}function handleEntityNotFound(_0x221071,_0x2c64e2){return function(_0x30980c){if(!_0x30980c){_0x221071[_0x0d8b('0x17')](0x194);}return _0x30980c;};}function handleError(_0x27b695,_0x5e5bc3){_0x5e5bc3=_0x5e5bc3||0x1f4;return function(_0xe8bbee){logger[_0x0d8b('0x25')](_0xe8bbee['stack']);if(_0xe8bbee[_0x0d8b('0x26')]){delete _0xe8bbee['name'];}_0x27b695[_0x0d8b('0x18')](_0x5e5bc3)[_0x0d8b('0x27')](_0xe8bbee);};}exports[_0x0d8b('0x28')]=function(_0x4fe6f9,_0x59a905){var _0x28f639={},_0x3ef745={},_0x4c05ee={'count':0x0,'rows':[]};var _0xcbc4ac=_['map'](db[_0x0d8b('0x29')]['rawAttributes'],function(_0x97050a){return{'name':_0x97050a['fieldName'],'type':_0x97050a[_0x0d8b('0x2a')]['key']};});_0x3ef745[_0x0d8b('0x2b')]=_['map'](_0xcbc4ac,_0x0d8b('0x26'));_0x3ef745[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0x4fe6f9['query']);_0x3ef745['filters']=_['intersection'](_0x3ef745[_0x0d8b('0x2b')],_0x3ef745['query']);_0x28f639[_0x0d8b('0x2e')]=_['intersection'](_0x3ef745['model'],qs[_0x0d8b('0x2f')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x28f639[_0x0d8b('0x2e')]=_0x28f639[_0x0d8b('0x2e')][_0x0d8b('0x30')]?_0x28f639[_0x0d8b('0x2e')]:_0x3ef745[_0x0d8b('0x2b')];if(!_0x4fe6f9['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x28f639['limit']=qs[_0x0d8b('0x1d')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x28f639['offset']=qs[_0x0d8b('0x1c')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1c')]);}_0x28f639[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x4fe6f9['query'][_0x0d8b('0x34')]);_0x28f639[_0x0d8b('0x35')]=qs['filters'](_[_0x0d8b('0x36')](_0x4fe6f9[_0x0d8b('0x2c')],_0x3ef745[_0x0d8b('0x37')]),_0xcbc4ac);if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x28f639['where']=_['merge'](_0x28f639[_0x0d8b('0x35')],{'$or':_['map'](_0xcbc4ac,function(_0x531c55){if(_0x531c55[_0x0d8b('0x2a')]!==_0x0d8b('0x39')){var _0x15ec8a={};_0x15ec8a[_0x531c55[_0x0d8b('0x26')]]={'$like':'%'+_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x15ec8a;}})});}_0x28f639=_['merge']({},_0x28f639,_0x4fe6f9[_0x0d8b('0x3a')]);var _0x6a02ad={'where':_0x28f639[_0x0d8b('0x35')]};return db[_0x0d8b('0x29')][_0x0d8b('0x1b')](_0x6a02ad)[_0x0d8b('0x24')](function(_0xf1680e){_0x4c05ee['count']=_0xf1680e;if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x3b')]){_0x28f639[_0x0d8b('0x3c')]=[{'all':!![]}];}return db[_0x0d8b('0x29')]['findAll'](_0x28f639);})[_0x0d8b('0x24')](function(_0x4b4bde){_0x4c05ee[_0x0d8b('0x3d')]=_0x4b4bde;return _0x4c05ee;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x59a905,_0x28f639))[_0x0d8b('0x3e')](handleError(_0x59a905,null));};exports[_0x0d8b('0x3f')]=function(_0x35fa7e,_0x3e632e){var _0x1ff17d={'raw':!![],'where':{'id':_0x35fa7e[_0x0d8b('0x40')]['id']}},_0x373f69={};_0x373f69[_0x0d8b('0x2b')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x373f69['query']=_['keys'](_0x35fa7e[_0x0d8b('0x2c')]);_0x373f69[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x373f69['model'],_0x373f69['query']);_0x1ff17d[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x373f69[_0x0d8b('0x2b')],qs['fields'](_0x35fa7e[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x1ff17d['attributes']=_0x1ff17d['attributes'][_0x0d8b('0x30')]?_0x1ff17d['attributes']:_0x373f69[_0x0d8b('0x2b')];if(_0x35fa7e['query']['includeAll']){_0x1ff17d[_0x0d8b('0x3c')]=[{'all':!![]}];}_0x1ff17d=_[_0x0d8b('0x42')]({},_0x1ff17d,_0x35fa7e['options']);return db['JscriptySessionReport']['find'](_0x1ff17d)['then'](handleEntityNotFound(_0x3e632e,null))[_0x0d8b('0x24')](respondWithResult(_0x3e632e,null))[_0x0d8b('0x3e')](handleError(_0x3e632e,null));};exports[_0x0d8b('0x43')]=function(_0x490eda,_0xb0910e){return db[_0x0d8b('0x29')][_0x0d8b('0x43')](_0x490eda[_0x0d8b('0x44')],{})[_0x0d8b('0x24')](respondWithResult(_0xb0910e,0xc9))[_0x0d8b('0x3e')](handleError(_0xb0910e,null));};exports[_0x0d8b('0x45')]=function(_0x1d5067,_0x384a5e){if(_0x1d5067[_0x0d8b('0x44')]['id']){delete _0x1d5067[_0x0d8b('0x44')]['id'];}return db[_0x0d8b('0x29')][_0x0d8b('0x46')]({'where':{'id':_0x1d5067[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x384a5e,null))[_0x0d8b('0x24')](saveUpdates(_0x1d5067[_0x0d8b('0x44')],null))[_0x0d8b('0x24')](respondWithResult(_0x384a5e,null))[_0x0d8b('0x3e')](handleError(_0x384a5e,null));};exports['destroy']=function(_0x371fa0,_0x4d8850){return db['JscriptySessionReport'][_0x0d8b('0x46')]({'where':{'id':_0x371fa0[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x4d8850,null))[_0x0d8b('0x24')](removeEntity(_0x4d8850,null))['catch'](handleError(_0x4d8850,null));};exports[_0x0d8b('0x47')]=function(_0x1106d6,_0x386074){return db[_0x0d8b('0x29')][_0x0d8b('0x47')]()['then'](respondWithResult(_0x386074,null))['catch'](handleError(_0x386074,null));};exports['getQuestions']=function(_0x573f4f,_0x368ede,_0xf22c3c){var _0x5e3bb4={'raw':!![],'where':{}};var _0x4950a8={};var _0x44c5c1={'count':0x0,'rows':[]};return db[_0x0d8b('0x29')]['findOne']({'where':{'id':_0x573f4f['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x24')](function(_0x3cd00a){if(_0x3cd00a){_0x4950a8[_0x0d8b('0x2b')]=_[_0x0d8b('0x2d')](db['JscriptyQuestionReport'][_0x0d8b('0x48')]);_0x4950a8[_0x0d8b('0x2c')]=_['keys'](_0x573f4f['query']);_0x4950a8[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x4950a8['model'],_0x4950a8['query']);_0x5e3bb4[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x4950a8[_0x0d8b('0x2b')],qs[_0x0d8b('0x2f')](_0x573f4f['query'][_0x0d8b('0x2f')]));_0x5e3bb4['attributes']=_0x5e3bb4['attributes'][_0x0d8b('0x30')]?_0x5e3bb4[_0x0d8b('0x2e')]:_0x4950a8['model'];if(!_0x573f4f['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x5e3bb4[_0x0d8b('0x1d')]=qs[_0x0d8b('0x1d')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x5e3bb4[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x573f4f['query'][_0x0d8b('0x1c')]);}_0x5e3bb4[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x34')]);_0x5e3bb4[_0x0d8b('0x35')]=qs[_0x0d8b('0x37')](_[_0x0d8b('0x36')](_0x573f4f[_0x0d8b('0x2c')],_0x4950a8['filters']));_0x5e3bb4[_0x0d8b('0x35')][_0x0d8b('0x49')]=_0x3cd00a['id'];if(_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x5e3bb4[_0x0d8b('0x35')]=_['merge'](_0x5e3bb4[_0x0d8b('0x35')],{'$or':_[_0x0d8b('0x4a')](_0x5e3bb4[_0x0d8b('0x2e')],function(_0x17a87f){var _0x1d6cd4={};_0x1d6cd4[_0x17a87f]={'$like':'%'+_0x573f4f['query']['filter']+'%'};return _0x1d6cd4;})});}_0x5e3bb4=_[_0x0d8b('0x42')]({},_0x5e3bb4,_0x573f4f[_0x0d8b('0x3a')]);return db[_0x0d8b('0x4b')][_0x0d8b('0x1b')]({'where':_0x5e3bb4['where']})[_0x0d8b('0x24')](function(_0x12aef7){_0x44c5c1[_0x0d8b('0x1b')]=_0x12aef7;if(_0x573f4f['query'][_0x0d8b('0x3b')]){_0x5e3bb4['include']=[{'all':!![]}];}return db[_0x0d8b('0x4b')][_0x0d8b('0x4c')](_0x5e3bb4);})[_0x0d8b('0x24')](function(_0x26ccf0){_0x44c5c1[_0x0d8b('0x3d')]=_0x26ccf0;return _0x44c5c1;});}})[_0x0d8b('0x24')](respondWithFilteredResult(_0x368ede,_0x5e3bb4))['catch'](handleError(_0x368ede,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 30aa617..a89e12a 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 _0xc357=['./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d8c69,_0x6ed648){var _0x58d5c0=function(_0x5cfd21){while(--_0x5cfd21){_0x1d8c69['push'](_0x1d8c69['shift']());}};_0x58d5c0(++_0x6ed648);}(_0xc357,0x176));var _0x7c35=function(_0xbd007e,_0x5407c8){_0xbd007e=_0xbd007e-0x0;var _0x591f46=_0xc357[_0xbd007e];return _0x591f46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c35('0x0'))('api');var moment=require('moment');var BPromise=require(_0x7c35('0x1'));var rp=require(_0x7c35('0x2'));var fs=require('fs');var path=require(_0x7c35('0x3'));var rimraf=require(_0x7c35('0x4'));var config=require(_0x7c35('0x5'));var attributes=require(_0x7c35('0x6'));module[_0x7c35('0x7')]=function(_0x5ab28c,_0x288352){return _0x5ab28c[_0x7c35('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x7c35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3db3=['exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x433263,_0x4726db){var _0x13311b=function(_0x26970e){while(--_0x26970e){_0x433263['push'](_0x433263['shift']());}};_0x13311b(++_0x4726db);}(_0x3db3,0x163));var _0x33db=function(_0x18dafb,_0x4209ec){_0x18dafb=_0x18dafb-0x0;var _0x3a9239=_0x3db3[_0x18dafb];return _0x3a9239;};'use strict';var _=require(_0x33db('0x0'));var util=require(_0x33db('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x33db('0x2'));var BPromise=require(_0x33db('0x3'));var rp=require(_0x33db('0x4'));var fs=require('fs');var path=require(_0x33db('0x5'));var rimraf=require('rimraf');var config=require(_0x33db('0x6'));var attributes=require(_0x33db('0x7'));module[_0x33db('0x8')]=function(_0x53c6a1,_0x64dff){return _0x53c6a1['define'](_0x33db('0x9'),attributes,{'tableName':_0x33db('0xa'),'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 ae400f6..f48620a 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 _0x5812=['JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x5812,0x1bd));var _0x2581=function(_0xaaf073,_0x5e13b6){_0xaaf073=_0xaaf073-0x0;var _0x398207=_0x5812[_0xaaf073];return _0x398207;};'use strict';var _=require(_0x2581('0x0'));var util=require(_0x2581('0x1'));var moment=require(_0x2581('0x2'));var BPromise=require(_0x2581('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2581('0x4'));var db=require(_0x2581('0x5'))['db'];var utils=require(_0x2581('0x6'));var logger=require(_0x2581('0x7'))(_0x2581('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2581('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e0e4e,_0x400d93,_0x4ed534){return new BPromise(function(_0x281e65,_0x13de03){return client[_0x2581('0xa')](_0x3e0e4e,_0x4ed534)[_0x2581('0xb')](function(_0x4c4345){logger[_0x2581('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x400d93,_0x2581('0xd'));logger['debug'](_0x2581('0xe'),_0x400d93,_0x2581('0xd'),JSON[_0x2581('0xf')](_0x4c4345));if(_0x4c4345[_0x2581('0x10')]){if(_0x4c4345[_0x2581('0x10')]['code']===0x1f4){logger['error'](_0x2581('0x11'),_0x400d93,_0x4c4345[_0x2581('0x10')][_0x2581('0x12')]);return _0x13de03(_0x4c4345['error'][_0x2581('0x12')]);}logger[_0x2581('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x400d93,_0x4c4345[_0x2581('0x10')][_0x2581('0x12')]);return _0x281e65(_0x4c4345[_0x2581('0x10')][_0x2581('0x12')]);}else{logger['info'](_0x2581('0x11'),_0x400d93,_0x2581('0xd'));_0x281e65(_0x4c4345[_0x2581('0x13')]['message']);}})[_0x2581('0x14')](function(_0x5ec8f9){logger['error'](_0x2581('0x11'),_0x400d93,_0x5ec8f9);_0x13de03(_0x5ec8f9);});});} \ No newline at end of file +var _0xeb28=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x51a1e7,_0x54cc87){var _0x4980d2=function(_0x54d17e){while(--_0x54d17e){_0x51a1e7['push'](_0x51a1e7['shift']());}};_0x4980d2(++_0x54cc87);}(_0xeb28,0x1de));var _0x8eb2=function(_0x57dca9,_0x59a1f7){_0x57dca9=_0x57dca9-0x0;var _0x31314b=_0xeb28[_0x57dca9];return _0x31314b;};'use strict';var _=require(_0x8eb2('0x0'));var util=require(_0x8eb2('0x1'));var moment=require(_0x8eb2('0x2'));var BPromise=require(_0x8eb2('0x3'));var rs=require(_0x8eb2('0x4'));var fs=require('fs');var Redis=require(_0x8eb2('0x5'));var db=require(_0x8eb2('0x6'))['db'];var utils=require(_0x8eb2('0x7'));var logger=require(_0x8eb2('0x8'))(_0x8eb2('0x9'));var config=require(_0x8eb2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8eb2('0xb')][_0x8eb2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41ed18,_0xd87bc8,_0x3cbf79){return new BPromise(function(_0x16dee1,_0x274bb7){return client[_0x8eb2('0xd')](_0x41ed18,_0x3cbf79)['then'](function(_0x782d31){logger[_0x8eb2('0xe')](_0x8eb2('0xf'),_0xd87bc8,_0x8eb2('0x10'));logger[_0x8eb2('0x11')](_0x8eb2('0x12'),_0xd87bc8,_0x8eb2('0x10'),JSON[_0x8eb2('0x13')](_0x782d31));if(_0x782d31[_0x8eb2('0x14')]){if(_0x782d31[_0x8eb2('0x14')][_0x8eb2('0x15')]===0x1f4){logger['error'](_0x8eb2('0xf'),_0xd87bc8,_0x782d31[_0x8eb2('0x14')][_0x8eb2('0x16')]);return _0x274bb7(_0x782d31[_0x8eb2('0x14')][_0x8eb2('0x16')]);}logger[_0x8eb2('0x14')](_0x8eb2('0xf'),_0xd87bc8,_0x782d31[_0x8eb2('0x14')][_0x8eb2('0x16')]);return _0x16dee1(_0x782d31[_0x8eb2('0x14')][_0x8eb2('0x16')]);}else{logger[_0x8eb2('0xe')](_0x8eb2('0xf'),_0xd87bc8,_0x8eb2('0x10'));_0x16dee1(_0x782d31[_0x8eb2('0x17')][_0x8eb2('0x16')]);}})[_0x8eb2('0x18')](function(_0x56d9c4){logger[_0x8eb2('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0xd87bc8,_0x56d9c4);_0x274bb7(_0x56d9c4);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ed63f92..c8eec34 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 _0x2932=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','update','exports','multer','path','connect-timeout'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2932,0xe1));var _0x2293=function(_0x43c3f9,_0x1861cb){_0x43c3f9=_0x43c3f9-0x0;var _0x4f4f54=_0x2932[_0x43c3f9];return _0x4f4f54;};'use strict';var multer=require(_0x2293('0x0'));var util=require('util');var path=require(_0x2293('0x1'));var timeout=require(_0x2293('0x2'));var express=require(_0x2293('0x3'));var router=express[_0x2293('0x4')]();var auth=require(_0x2293('0x5'));var interaction=require(_0x2293('0x6'));var config=require(_0x2293('0x7'));var controller=require('./license.controller');router[_0x2293('0x8')]('/',controller[_0x2293('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2293('0xa')]);module[_0x2293('0xb')]=router; \ No newline at end of file +var _0x99b3=['util','path','express','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','update','exports'];(function(_0x17caed,_0x4a3b3e){var _0xe4acc1=function(_0x5bddde){while(--_0x5bddde){_0x17caed['push'](_0x17caed['shift']());}};_0xe4acc1(++_0x4a3b3e);}(_0x99b3,0x12b));var _0x399b=function(_0x39081f,_0x3d41ce){_0x39081f=_0x39081f-0x0;var _0x2784c9=_0x99b3[_0x39081f];return _0x2784c9;};'use strict';var multer=require('multer');var util=require(_0x399b('0x0'));var path=require(_0x399b('0x1'));var timeout=require('connect-timeout');var express=require(_0x399b('0x2'));var router=express['Router']();var auth=require(_0x399b('0x3'));var interaction=require(_0x399b('0x4'));var config=require('../../config/environment');var controller=require(_0x399b('0x5'));router[_0x399b('0x6')]('/',controller[_0x399b('0x7')]);router[_0x399b('0x8')](_0x399b('0x9'),auth[_0x399b('0xa')](),controller[_0x399b('0xb')]);module[_0x399b('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 2984c5c..3fd96e4 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 _0x326f=['STRING','INTEGER','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x326f,0xd1));var _0xf326=function(_0x2d2f17,_0x3f34db){_0x2d2f17=_0x2d2f17-0x0;var _0x5065d7=_0x326f[_0x2d2f17];return _0x5065d7;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf326('0x1')]},'data2':{'type':Sequelize[_0xf326('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xf326('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','INTEGER'];(function(_0x434903,_0x2bae84){var _0x31021e=function(_0x176a5f){while(--_0x176a5f){_0x434903['push'](_0x434903['shift']());}};_0x31021e(++_0x2bae84);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x493d96,_0x231067){_0x493d96=_0x493d96-0x0;var _0x36db3a=_0xdbf5[_0x493d96];return _0x36db3a;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index bb49f01..6b2be5a 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 _0x919e=['json','count','offset','set','Content-Range','reject','save','update','destroy','then','stack','name','send','../../config/license/util','keys','rawAttributes','query','filters','intersection','model','attributes','fields','merge','options','getLicense','catch','body','License','find','params','get','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe919('0x0'));var emlformat=require(_0xe919('0x1'));var rimraf=require(_0xe919('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe919('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe919('0x4'));var Mustache=require(_0xe919('0x5'));var util=require(_0xe919('0x6'));var path=require(_0xe919('0x7'));var sox=require(_0xe919('0x8'));var csv=require(_0xe919('0x9'));var ejs=require(_0xe919('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe919('0xb'));var crypto=require(_0xe919('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe919('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe919('0xe'));var Papa=require(_0xe919('0xf'));var Redis=require(_0xe919('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe919('0x11'));var as=require(_0xe919('0x12'));var hardwareService=require(_0xe919('0x13'));var logger=require('../../config/logger')(_0xe919('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe919('0x15'))['db'];function respondWithStatusCode(_0xb06def,_0x40d013){_0x40d013=_0x40d013||0xcc;return function(_0x525f3e){if(_0x525f3e){return _0xb06def['sendStatus'](_0x40d013);}return _0xb06def[_0xe919('0x16')](_0x40d013)[_0xe919('0x17')]();};}function respondWithResult(_0x5c44d4,_0x3c09be){_0x3c09be=_0x3c09be||0xc8;return function(_0x1f88a0){if(_0x1f88a0){return _0x5c44d4[_0xe919('0x16')](_0x3c09be)[_0xe919('0x18')](_0x1f88a0);}};}function respondWithFilteredResult(_0x1e2bdd,_0x20d095){return function(_0x33b067){if(_0x33b067){var _0x5768f8=_0x33b067[_0xe919('0x19')],_0x3fadb9=_0x20d095[_0xe919('0x1a')],_0x529a78=_0x20d095['offset']+_0x20d095['limit'],_0x5ba7ad;if(_0x529a78>=_0x5768f8){_0x529a78=_0x5768f8;_0x5ba7ad=0xc8;}else{_0x5ba7ad=0xce;}_0x1e2bdd['status'](_0x5ba7ad);return _0x1e2bdd[_0xe919('0x1b')](_0xe919('0x1c'),_0x3fadb9+'-'+_0x529a78+'/'+_0x5768f8)[_0xe919('0x18')](_0x33b067);}return null;};}function patchUpdates(_0x2d9e62){return function(_0x4a6945){try{jsonpatch['apply'](_0x4a6945,_0x2d9e62,!![]);}catch(_0x165076){return BPromise[_0xe919('0x1d')](_0x165076);}return _0x4a6945[_0xe919('0x1e')]();};}function saveUpdates(_0xd2a816,_0x48d99f){return function(_0x352a43){if(_0x352a43){return _0x352a43[_0xe919('0x1f')](_0xd2a816)['then'](function(_0x5ad456){return _0x5ad456;});}return null;};}function removeEntity(_0x175b39,_0x483515){return function(_0x53e428){if(_0x53e428){return _0x53e428[_0xe919('0x20')]()[_0xe919('0x21')](function(){_0x175b39['status'](0xcc)[_0xe919('0x17')]();});}};}function handleEntityNotFound(_0x5694b0,_0x422934){return function(_0x7c1b72){if(!_0x7c1b72){_0x5694b0['sendStatus'](0x194);}return _0x7c1b72;};}function handleError(_0x4573b1,_0x24e9e8){_0x24e9e8=_0x24e9e8||0x1f4;return function(_0x4607f5){logger['error'](_0x4607f5[_0xe919('0x22')]);if(_0x4607f5[_0xe919('0x23')]){delete _0x4607f5['name'];}_0x4573b1[_0xe919('0x16')](_0x24e9e8)[_0xe919('0x24')](_0x4607f5);};}var utilLicense=require(_0xe919('0x25'));exports['index']=function(_0x3b339f,_0x50502d){var _0x3f2f7f={'raw':!![],'where':{'id':0x1}},_0x84198c={};_0x84198c['model']=_[_0xe919('0x26')](db['License'][_0xe919('0x27')]);_0x84198c[_0xe919('0x28')]=_[_0xe919('0x26')](_0x3b339f['query']);_0x84198c[_0xe919('0x29')]=_[_0xe919('0x2a')](_0x84198c[_0xe919('0x2b')],_0x84198c[_0xe919('0x28')]);_0x3f2f7f[_0xe919('0x2c')]=_[_0xe919('0x2a')](_0x84198c[_0xe919('0x2b')],qs[_0xe919('0x2d')](_0x3b339f['query'][_0xe919('0x2d')]));_0x3f2f7f[_0xe919('0x2c')]=_0x3f2f7f['attributes']['length']?_0x3f2f7f[_0xe919('0x2c')]:_0x84198c[_0xe919('0x2b')];_0x3f2f7f=_[_0xe919('0x2e')]({},_0x3f2f7f,_0x3b339f[_0xe919('0x2f')]);return utilLicense[_0xe919('0x30')](_0x3f2f7f)[_0xe919('0x21')](respondWithResult(_0x50502d,null))[_0xe919('0x31')](handleError(_0x50502d,null));};exports[_0xe919('0x1f')]=function(_0x506f31,_0x69de){if(_0x506f31[_0xe919('0x32')]['id']){delete _0x506f31[_0xe919('0x32')]['id'];}return db[_0xe919('0x33')][_0xe919('0x34')]({'where':{'id':_0x506f31[_0xe919('0x35')]['id']}})[_0xe919('0x21')](handleEntityNotFound(_0x69de,null))[_0xe919('0x21')](function(_0x123986){var _0x59095c=_0x123986[_0xe919('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x59095c,_0x506f31[_0xe919('0x32')]['key']);})['then'](function(_0x28c2ec){if(!_0x28c2ec['demo']){return saveUpdates(_0x506f31[_0xe919('0x32')],null);}return _0x28c2ec;})[_0xe919('0x21')](respondWithResult(_0x69de,null))['catch'](handleError(_0x69de,null));}; \ No newline at end of file +var _0x3379=['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','end','count','offset','status','set','json','apply','save','update','then','sendStatus','name','send','index','model','rawAttributes','query','keys','filters','attributes','fields','length','options','getLicense','catch','body','License','params','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0x3379,0x115));var _0x9337=function(_0x42b56e,_0x12afb7){_0x42b56e=_0x42b56e-0x0;var _0x3a0a0f=_0x3379[_0x42b56e];return _0x3a0a0f;};'use strict';var pdf=require(_0x9337('0x0'));var emlformat=require(_0x9337('0x1'));var rimraf=require(_0x9337('0x2'));var zipdir=require(_0x9337('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9337('0x4'));var moment=require(_0x9337('0x5'));var BPromise=require(_0x9337('0x6'));var Mustache=require(_0x9337('0x7'));var util=require('util');var path=require(_0x9337('0x8'));var sox=require(_0x9337('0x9'));var csv=require(_0x9337('0xa'));var ejs=require(_0x9337('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9337('0xc'));var crypto=require('crypto');var jsforce=require(_0x9337('0xd'));var deskjs=require(_0x9337('0xe'));var toCsv=require(_0x9337('0xa'));var querystring=require(_0x9337('0xf'));var Papa=require(_0x9337('0x10'));var Redis=require('ioredis');var authService=require(_0x9337('0x11'));var qs=require(_0x9337('0x12'));var as=require(_0x9337('0x13'));var hardwareService=require(_0x9337('0x14'));var logger=require(_0x9337('0x15'))('api');var utils=require(_0x9337('0x16'));var config=require(_0x9337('0x17'));var licenseUtil=require(_0x9337('0x18'));var db=require(_0x9337('0x19'))['db'];function respondWithStatusCode(_0x3303f6,_0x32c1f6){_0x32c1f6=_0x32c1f6||0xcc;return function(_0x324e54){if(_0x324e54){return _0x3303f6['sendStatus'](_0x32c1f6);}return _0x3303f6['status'](_0x32c1f6)[_0x9337('0x1a')]();};}function respondWithResult(_0xedb2b6,_0x12f1f1){_0x12f1f1=_0x12f1f1||0xc8;return function(_0x14e7a0){if(_0x14e7a0){return _0xedb2b6['status'](_0x12f1f1)['json'](_0x14e7a0);}};}function respondWithFilteredResult(_0x13515e,_0x594b51){return function(_0x513263){if(_0x513263){var _0x35e805=_0x513263[_0x9337('0x1b')],_0x13a207=_0x594b51[_0x9337('0x1c')],_0x21f587=_0x594b51['offset']+_0x594b51['limit'],_0x48644e;if(_0x21f587>=_0x35e805){_0x21f587=_0x35e805;_0x48644e=0xc8;}else{_0x48644e=0xce;}_0x13515e[_0x9337('0x1d')](_0x48644e);return _0x13515e[_0x9337('0x1e')]('Content-Range',_0x13a207+'-'+_0x21f587+'/'+_0x35e805)[_0x9337('0x1f')](_0x513263);}return null;};}function patchUpdates(_0x2c7bc3){return function(_0x4e9802){try{jsonpatch[_0x9337('0x20')](_0x4e9802,_0x2c7bc3,!![]);}catch(_0x6de2e6){return BPromise['reject'](_0x6de2e6);}return _0x4e9802[_0x9337('0x21')]();};}function saveUpdates(_0x7c334f,_0x55e225){return function(_0x562a36){if(_0x562a36){return _0x562a36[_0x9337('0x22')](_0x7c334f)['then'](function(_0x44eb84){return _0x44eb84;});}return null;};}function removeEntity(_0x55601a,_0x29e989){return function(_0x5768d5){if(_0x5768d5){return _0x5768d5['destroy']()[_0x9337('0x23')](function(){_0x55601a['status'](0xcc)[_0x9337('0x1a')]();});}};}function handleEntityNotFound(_0x543cfc,_0x1e8d80){return function(_0x332238){if(!_0x332238){_0x543cfc[_0x9337('0x24')](0x194);}return _0x332238;};}function handleError(_0x33498a,_0x125af7){_0x125af7=_0x125af7||0x1f4;return function(_0xb49ff1){logger['error'](_0xb49ff1['stack']);if(_0xb49ff1[_0x9337('0x25')]){delete _0xb49ff1[_0x9337('0x25')];}_0x33498a[_0x9337('0x1d')](_0x125af7)[_0x9337('0x26')](_0xb49ff1);};}var utilLicense=require('../../config/license/util');exports[_0x9337('0x27')]=function(_0x48e884,_0x2e2c6e){var _0x3d4b08={'raw':!![],'where':{'id':0x1}},_0x3916c0={};_0x3916c0[_0x9337('0x28')]=_['keys'](db['License'][_0x9337('0x29')]);_0x3916c0[_0x9337('0x2a')]=_[_0x9337('0x2b')](_0x48e884[_0x9337('0x2a')]);_0x3916c0[_0x9337('0x2c')]=_['intersection'](_0x3916c0[_0x9337('0x28')],_0x3916c0['query']);_0x3d4b08[_0x9337('0x2d')]=_['intersection'](_0x3916c0['model'],qs['fields'](_0x48e884['query'][_0x9337('0x2e')]));_0x3d4b08[_0x9337('0x2d')]=_0x3d4b08[_0x9337('0x2d')][_0x9337('0x2f')]?_0x3d4b08[_0x9337('0x2d')]:_0x3916c0['model'];_0x3d4b08=_['merge']({},_0x3d4b08,_0x48e884[_0x9337('0x30')]);return utilLicense[_0x9337('0x31')](_0x3d4b08)[_0x9337('0x23')](respondWithResult(_0x2e2c6e,null))[_0x9337('0x32')](handleError(_0x2e2c6e,null));};exports[_0x9337('0x22')]=function(_0x247929,_0x57df97){if(_0x247929[_0x9337('0x33')]['id']){delete _0x247929[_0x9337('0x33')]['id'];}return db[_0x9337('0x34')]['find']({'where':{'id':_0x247929[_0x9337('0x35')]['id']}})['then'](handleEntityNotFound(_0x57df97,null))[_0x9337('0x23')](function(_0x268ed6){var _0x2b2571=_0x268ed6[_0x9337('0x36')]({'plain':!![]});return utilLicense[_0x9337('0x37')](_0x2b2571,_0x247929[_0x9337('0x33')][_0x9337('0x38')]);})[_0x9337('0x23')](function(_0x3cf561){if(!_0x3cf561[_0x9337('0x39')]){return saveUpdates(_0x247929[_0x9337('0x33')],null);}return _0x3cf561;})[_0x9337('0x23')](respondWithResult(_0x57df97,null))[_0x9337('0x32')](handleError(_0x57df97,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8eaded0..d0a23f4 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 _0xd9d9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','License','license','util'];(function(_0x2b8e97,_0x323e9a){var _0x3cca73=function(_0x47bc7e){while(--_0x47bc7e){_0x2b8e97['push'](_0x2b8e97['shift']());}};_0x3cca73(++_0x323e9a);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x249e6f,_0x2765ea){_0x249e6f=_0x249e6f-0x0;var _0x32001e=_0xd9d9[_0x249e6f];return _0x32001e;};'use strict';var _=require('lodash');var util=require(_0x9d9d('0x0'));var logger=require(_0x9d9d('0x1'))(_0x9d9d('0x2'));var moment=require(_0x9d9d('0x3'));var BPromise=require(_0x9d9d('0x4'));var rp=require(_0x9d9d('0x5'));var fs=require('fs');var path=require(_0x9d9d('0x6'));var rimraf=require(_0x9d9d('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x9d9d('0x8')]=function(_0x508cb4,_0x25f128){return _0x508cb4['define'](_0x9d9d('0x9'),attributes,{'tableName':_0x9d9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f82=['license','lodash','util','api','bluebird','path','../../config/environment','./license.attributes','exports','define','License'];(function(_0x4612df,_0x37a8f7){var _0x2804c6=function(_0x2b1979){while(--_0x2b1979){_0x4612df['push'](_0x4612df['shift']());}};_0x2804c6(++_0x37a8f7);}(_0x4f82,0xbc));var _0x24f8=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x4f82[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0x24f8('0x0'));var util=require(_0x24f8('0x1'));var logger=require('../../config/logger')(_0x24f8('0x2'));var moment=require('moment');var BPromise=require(_0x24f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24f8('0x4'));var rimraf=require('rimraf');var config=require(_0x24f8('0x5'));var attributes=require(_0x24f8('0x6'));module[_0x24f8('0x7')]=function(_0x3fc5d4,_0x53e9fb){return _0x3fc5d4[_0x24f8('0x8')](_0x24f8('0x9'),attributes,{'tableName':_0x24f8('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 27a7dd5..b9c8834 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 _0x63c6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x459ee0,_0x1e950d){var _0x1b87c8=function(_0x377855){while(--_0x377855){_0x459ee0['push'](_0x459ee0['shift']());}};_0x1b87c8(++_0x1e950d);}(_0x63c6,0xbb));var _0x663c=function(_0x18f917,_0x4d3ae5){_0x18f917=_0x18f917-0x0;var _0x4d013d=_0x63c6[_0x18f917];return _0x4d013d;};'use strict';var _=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x663c('0x2'));var fs=require('fs');var Redis=require(_0x663c('0x3'));var db=require(_0x663c('0x4'))['db'];var utils=require(_0x663c('0x5'));var logger=require(_0x663c('0x6'))(_0x663c('0x7'));var config=require(_0x663c('0x8'));var jayson=require(_0x663c('0x9'));var client=jayson[_0x663c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dbe47,_0xe6ac97,_0x3eb551){return new BPromise(function(_0xb32d9e,_0x5b9376){return client[_0x663c('0xb')](_0x1dbe47,_0x3eb551)['then'](function(_0x38dc88){logger['info'](_0x663c('0xc'),_0xe6ac97,_0x663c('0xd'));logger[_0x663c('0xe')](_0x663c('0xf'),_0xe6ac97,_0x663c('0xd'),JSON[_0x663c('0x10')](_0x38dc88));if(_0x38dc88[_0x663c('0x11')]){if(_0x38dc88['error']['code']===0x1f4){logger[_0x663c('0x11')](_0x663c('0xc'),_0xe6ac97,_0x38dc88['error'][_0x663c('0x12')]);return _0x5b9376(_0x38dc88[_0x663c('0x11')][_0x663c('0x12')]);}logger[_0x663c('0x11')]('License,\x20%s,\x20%s',_0xe6ac97,_0x38dc88[_0x663c('0x11')][_0x663c('0x12')]);return _0xb32d9e(_0x38dc88['error'][_0x663c('0x12')]);}else{logger['info'](_0x663c('0xc'),_0xe6ac97,_0x663c('0xd'));_0xb32d9e(_0x38dc88[_0x663c('0x13')][_0x663c('0x12')]);}})[_0x663c('0x14')](function(_0x2d2a8f){logger[_0x663c('0x11')](_0x663c('0xc'),_0xe6ac97,_0x2d2a8f);_0x5b9376(_0x2d2a8f);});});} \ No newline at end of file +var _0x7834=['then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4e77c6,_0x4c359c){var _0x3e326c=function(_0x50e425){while(--_0x50e425){_0x4e77c6['push'](_0x4e77c6['shift']());}};_0x3e326c(++_0x4c359c);}(_0x7834,0x13f));var _0x4783=function(_0x4c587a,_0x3bf54a){_0x4c587a=_0x4c587a-0x0;var _0x3e66fc=_0x7834[_0x4c587a];return _0x3e66fc;};'use strict';var _=require(_0x4783('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4783('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4783('0x2'));var db=require(_0x4783('0x3'))['db'];var utils=require(_0x4783('0x4'));var logger=require(_0x4783('0x5'))(_0x4783('0x6'));var config=require(_0x4783('0x7'));var jayson=require(_0x4783('0x8'));var client=jayson['client'][_0x4783('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf8c030,_0x518da8,_0x2dcf46){return new BPromise(function(_0x16c83e,_0x36c0a7){return client[_0x4783('0xa')](_0xf8c030,_0x2dcf46)[_0x4783('0xb')](function(_0x1f8b29){logger['info'](_0x4783('0xc'),_0x518da8,_0x4783('0xd'));logger[_0x4783('0xe')](_0x4783('0xf'),_0x518da8,_0x4783('0xd'),JSON[_0x4783('0x10')](_0x1f8b29));if(_0x1f8b29[_0x4783('0x11')]){if(_0x1f8b29['error']['code']===0x1f4){logger[_0x4783('0x11')](_0x4783('0xc'),_0x518da8,_0x1f8b29['error'][_0x4783('0x12')]);return _0x36c0a7(_0x1f8b29['error'][_0x4783('0x12')]);}logger[_0x4783('0x11')](_0x4783('0xc'),_0x518da8,_0x1f8b29[_0x4783('0x11')][_0x4783('0x12')]);return _0x16c83e(_0x1f8b29['error'][_0x4783('0x12')]);}else{logger[_0x4783('0x13')](_0x4783('0xc'),_0x518da8,_0x4783('0xd'));_0x16c83e(_0x1f8b29[_0x4783('0x14')][_0x4783('0x12')]);}})[_0x4783('0x15')](function(_0x40dbcf){logger[_0x4783('0x11')](_0x4783('0xc'),_0x518da8,_0x40dbcf);_0x36c0a7(_0x40dbcf);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 08a0aac..bcf71a3 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 _0x1224=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addSmtp','addInteraction','send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe'];(function(_0x431217,_0x42776d){var _0x2e9fee=function(_0x4864bf){while(--_0x4864bf){_0x431217['push'](_0x431217['shift']());}};_0x2e9fee(++_0x42776d);}(_0x1224,0x10d));var _0x4122=function(_0x5db4b0,_0x17dfb5){_0x5db4b0=_0x5db4b0-0x0;var _0x126c9f=_0x1224[_0x5db4b0];return _0x126c9f;};'use strict';var multer=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var path=require(_0x4122('0x2'));var timeout=require(_0x4122('0x3'));var express=require(_0x4122('0x4'));var router=express[_0x4122('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4122('0x6'));var config=require(_0x4122('0x7'));var controller=require(_0x4122('0x8'));router['get']('/',auth[_0x4122('0x9')](),controller[_0x4122('0xa')]);router[_0x4122('0xb')](_0x4122('0xc'),auth[_0x4122('0x9')](),controller[_0x4122('0xd')]);router[_0x4122('0xb')](_0x4122('0xe'),auth[_0x4122('0x9')](),controller[_0x4122('0xf')]);router[_0x4122('0xb')](_0x4122('0x10'),auth[_0x4122('0x9')](),controller[_0x4122('0x11')]);router[_0x4122('0xb')](_0x4122('0x12'),auth[_0x4122('0x9')](),controller[_0x4122('0x13')]);router[_0x4122('0xb')](_0x4122('0x14'),auth[_0x4122('0x9')](),controller[_0x4122('0x15')]);router[_0x4122('0xb')](_0x4122('0x16'),auth[_0x4122('0x9')](),controller[_0x4122('0x17')]);router[_0x4122('0xb')](_0x4122('0x18'),auth[_0x4122('0x9')](),controller[_0x4122('0x19')]);router[_0x4122('0xb')]('/:id/applications',auth[_0x4122('0x9')](),controller[_0x4122('0x1a')]);router[_0x4122('0xb')](_0x4122('0x1b'),auth['isAuthenticated'](),controller[_0x4122('0x1c')]);router[_0x4122('0xb')]('/:id/verify',auth[_0x4122('0x9')](),controller[_0x4122('0x1d')]);router[_0x4122('0xb')](_0x4122('0x1e'),auth[_0x4122('0x9')](),controller[_0x4122('0x1f')]);router[_0x4122('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x4122('0x20')](_0x4122('0x12'),auth[_0x4122('0x9')](),controller[_0x4122('0x21')]);router[_0x4122('0x20')]('/',auth[_0x4122('0x9')](),controller[_0x4122('0x22')]);router[_0x4122('0x20')]('/:id/in_servers',auth[_0x4122('0x9')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0x4122('0x9')](),controller[_0x4122('0x23')]);router[_0x4122('0x20')]('/:id/interactions',auth[_0x4122('0x9')](),controller[_0x4122('0x24')]);router['post']('/:id/applications',auth[_0x4122('0x9')](),controller['addApplications']);router['post']('/:id/send',auth[_0x4122('0x9')](),controller[_0x4122('0x25')]);router[_0x4122('0x20')](_0x4122('0x1e'),auth[_0x4122('0x9')](),controller[_0x4122('0x26')]);router[_0x4122('0x27')](_0x4122('0xe'),auth[_0x4122('0x9')](),controller[_0x4122('0x28')]);router[_0x4122('0x29')](_0x4122('0x10'),auth[_0x4122('0x9')](),controller['removeDispositions']);router[_0x4122('0x29')](_0x4122('0x12'),auth[_0x4122('0x9')](),controller[_0x4122('0x2a')]);router['delete'](_0x4122('0x14'),auth['isAuthenticated'](),controller[_0x4122('0x2b')]);router[_0x4122('0x29')](_0x4122('0x16'),auth[_0x4122('0x9')](),controller[_0x4122('0x2c')]);router[_0x4122('0x29')](_0x4122('0xe'),auth[_0x4122('0x9')](),controller['destroy']);router[_0x4122('0x29')](_0x4122('0x1e'),auth['isAuthenticated'](),controller[_0x4122('0x2d')]);module[_0x4122('0x2e')]=router; \ No newline at end of file +var _0x6a55=['get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','express','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index'];(function(_0x396210,_0x529fe0){var _0x2d2076=function(_0x42c0b4){while(--_0x42c0b4){_0x396210['push'](_0x396210['shift']());}};_0x2d2076(++_0x529fe0);}(_0x6a55,0xdb));var _0x56a5=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0x6a55[_0x4eb6ec];return _0x58881b;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x56a5('0x2'));var config=require('../../config/environment');var controller=require(_0x56a5('0x3'));router['get']('/',auth[_0x56a5('0x4')](),controller[_0x56a5('0x5')]);router[_0x56a5('0x6')](_0x56a5('0x7'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x6')](_0x56a5('0x9'),auth['isAuthenticated'](),controller[_0x56a5('0xa')]);router[_0x56a5('0x6')](_0x56a5('0xb'),auth[_0x56a5('0x4')](),controller[_0x56a5('0xc')]);router[_0x56a5('0x6')](_0x56a5('0xd'),auth[_0x56a5('0x4')](),controller[_0x56a5('0xe')]);router['get']('/:id/in_servers',auth[_0x56a5('0x4')](),controller[_0x56a5('0xf')]);router[_0x56a5('0x6')](_0x56a5('0x10'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x11')]);router['get']('/:id/interactions',auth[_0x56a5('0x4')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x6')](_0x56a5('0x13'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x14')]);router[_0x56a5('0x6')]('/:id/messages',auth[_0x56a5('0x4')](),controller['getMessages']);router[_0x56a5('0x6')]('/:id/verify',auth[_0x56a5('0x4')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x6')](_0x56a5('0x16'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x17')]);router[_0x56a5('0x18')]('/:id/dispositions',auth[_0x56a5('0x4')](),controller[_0x56a5('0x19')]);router[_0x56a5('0x18')](_0x56a5('0xd'),auth['isAuthenticated'](),controller[_0x56a5('0x1a')]);router[_0x56a5('0x18')]('/',auth[_0x56a5('0x4')](),controller[_0x56a5('0x1b')]);router[_0x56a5('0x18')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x56a5('0x1c')]);router[_0x56a5('0x18')]('/:id/out_servers',auth[_0x56a5('0x4')](),controller[_0x56a5('0x1d')]);router[_0x56a5('0x18')](_0x56a5('0x1e'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x1f')]);router[_0x56a5('0x18')](_0x56a5('0x13'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x20')]);router[_0x56a5('0x18')](_0x56a5('0x21'),auth[_0x56a5('0x4')](),controller['send']);router[_0x56a5('0x18')](_0x56a5('0x16'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x22')]);router[_0x56a5('0x23')]('/:id',auth[_0x56a5('0x4')](),controller['update']);router[_0x56a5('0x24')](_0x56a5('0xb'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x25')]);router['delete'](_0x56a5('0xd'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x26')]);router['delete'](_0x56a5('0x27'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x28')]);router[_0x56a5('0x24')](_0x56a5('0x10'),auth['isAuthenticated'](),controller[_0x56a5('0x29')]);router[_0x56a5('0x24')](_0x56a5('0x9'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x2a')]);router['delete']('/:id/users',auth[_0x56a5('0x4')](),controller[_0x56a5('0x2b')]);module[_0x56a5('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 171566c..c08e819 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 _0xfb32=['TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN'];(function(_0x4b1958,_0x18c902){var _0x59fbdd=function(_0x43d610){while(--_0x43d610){_0x4b1958['push'](_0x4b1958['shift']());}};_0x59fbdd(++_0x18c902);}(_0xfb32,0x1d0));var _0x2fb3=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xfb32[_0x19b84f];return _0x18067b;};'use strict';var Sequelize=require(_0x2fb3('0x0'));module[_0x2fb3('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2fb3('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2fb3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2fb3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2fb3('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2fb3('0x4')]},'markAsUnread':{'type':Sequelize[_0x2fb3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2fb3('0x2')],'allowNull':![],'defaultValue':_0x2fb3('0x5')},'fontSize':{'type':Sequelize[_0x2fb3('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2fb3('0x4')],'defaultValue':function(){return _0x2fb3('0x7');}},'notificationSound':{'type':Sequelize[_0x2fb3('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2fb3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2fb3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2fb3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2fb3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2fb3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2fb3('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2fb3('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33f28b){if(!_0x33f28b)this[_0x2fb3('0x9')](_0x2fb3('0xa'),null);this[_0x2fb3('0x9')](_0x2fb3('0xb'),_0x33f28b);}}}; \ No newline at end of file +var _0xd2b7=['STRING','INTEGER','UNSIGNED','TEXT','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','BOOLEAN'];(function(_0x49f9c6,_0x455e11){var _0x2efe0b=function(_0x283aaf){while(--_0x283aaf){_0x49f9c6['push'](_0x49f9c6['shift']());}};_0x2efe0b(++_0x455e11);}(_0xd2b7,0x183));var _0x7d2b=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xd2b7[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require(_0x7d2b('0x0'));module[_0x7d2b('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x7d2b('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7d2b('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7d2b('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7d2b('0x3')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x7d2b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7d2b('0x4')](0x2)[_0x7d2b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7d2b('0x6')],'defaultValue':function(){return _0x7d2b('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7d2b('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7d2b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7d2b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7d2b('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7d2b('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x7d2b('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7d2b('0x9'),'set':function(_0x2d8d90){if(!_0x2d8d90)this['setDataValue'](_0x7d2b('0xa'),null);this[_0x7d2b('0xb')](_0x7d2b('0xc'),_0x2d8d90);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 444918f..bdbe6d5 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 _0x2b02=['ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','update','get','MailAccounts','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','key','model','map','keys','intersection','fields','attributes','length','query','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','Smtp','mandatoryDispositionPause','find','body','params','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','password','authentication','host','port','service','cuser','pass','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b02,0xb9));var _0x22b0=function(_0x1ff527,_0x3ec416){_0x1ff527=_0x1ff527-0x0;var _0x5bf8dc=_0x2b02[_0x1ff527];return _0x5bf8dc;};'use strict';var pdf=require(_0x22b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x22b0('0x1'));var zipdir=require(_0x22b0('0x2'));var jsonpatch=require(_0x22b0('0x3'));var rp=require('request-promise');var moment=require(_0x22b0('0x4'));var BPromise=require(_0x22b0('0x5'));var Mustache=require(_0x22b0('0x6'));var util=require(_0x22b0('0x7'));var path=require('path');var sox=require(_0x22b0('0x8'));var csv=require(_0x22b0('0x9'));var ejs=require(_0x22b0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x22b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x22b0('0xc'));var deskjs=require(_0x22b0('0xd'));var toCsv=require(_0x22b0('0x9'));var querystring=require(_0x22b0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x22b0('0xf'));var qs=require(_0x22b0('0x10'));var as=require(_0x22b0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22b0('0x12'))('api');var utils=require(_0x22b0('0x13'));var config=require(_0x22b0('0x14'));var licenseUtil=require(_0x22b0('0x15'));var db=require('../../mysqldb')['db'];config[_0x22b0('0x16')]=_[_0x22b0('0x17')](config[_0x22b0('0x16')],{'host':_0x22b0('0x18'),'port':0x18eb});var socket=require(_0x22b0('0x19'))(new Redis(config[_0x22b0('0x16')]));require('./mailAccount.socket')[_0x22b0('0x1a')](socket);var jayson=require(_0x22b0('0x1b'));var client=jayson[_0x22b0('0x1c')]['http']({'port':0x232b});function respondWithRpcPromise(_0x162b25,_0x2dc3dc,_0x81c4f2,_0x202c40){return new BPromise(function(_0x54a501,_0x121f13){var _0x4d04c9=_0x202c40||client;return _0x4d04c9[_0x22b0('0x1d')](_0x162b25,_0x81c4f2)[_0x22b0('0x1e')](function(_0x2063c8){logger[_0x22b0('0x1f')](_0x22b0('0x20'),_0x2dc3dc,'request\x20sent');logger['debug'](_0x22b0('0x21'),_0x2dc3dc,_0x22b0('0x22'),JSON[_0x22b0('0x23')](_0x2063c8));if(_0x2063c8['error']){if(_0x2063c8[_0x22b0('0x24')][_0x22b0('0x25')]===0x1f4){logger[_0x22b0('0x24')](_0x22b0('0x20'),_0x2dc3dc,_0x2063c8['error'][_0x22b0('0x26')]);return _0x121f13(_0x2063c8['error']['message']);}logger['error'](_0x22b0('0x20'),_0x2dc3dc,_0x2063c8[_0x22b0('0x24')]['message']);return _0x54a501(_0x2063c8['error'][_0x22b0('0x26')]);}else{logger[_0x22b0('0x1f')](_0x22b0('0x20'),_0x2dc3dc,_0x22b0('0x22'));_0x54a501(_0x2063c8[_0x22b0('0x27')][_0x22b0('0x26')]);}})[_0x22b0('0x28')](function(_0x53cefc){logger[_0x22b0('0x24')](_0x22b0('0x20'),_0x2dc3dc,_0x53cefc);_0x121f13(_0x53cefc);});});}function respondWithStatusCode(_0x520e07,_0x83b680){_0x83b680=_0x83b680||0xcc;return function(_0x578c8b){if(_0x578c8b){return _0x520e07[_0x22b0('0x29')](_0x83b680);}return _0x520e07['status'](_0x83b680)[_0x22b0('0x2a')]();};}function respondWithResult(_0x3e1fe0,_0x1fabef){_0x1fabef=_0x1fabef||0xc8;return function(_0x1b8863){if(_0x1b8863){return _0x3e1fe0[_0x22b0('0x2b')](_0x1fabef)[_0x22b0('0x2c')](_0x1b8863);}};}function respondWithFilteredResult(_0x45a3f1,_0x1a29a5){return function(_0x2eca7c){if(_0x2eca7c){var _0x1de685=_0x2eca7c['count'],_0x76879b=_0x1a29a5[_0x22b0('0x2d')],_0x49b62a=_0x1a29a5[_0x22b0('0x2d')]+_0x1a29a5[_0x22b0('0x2e')],_0x5e2b21;if(_0x49b62a>=_0x1de685){_0x49b62a=_0x1de685;_0x5e2b21=0xc8;}else{_0x5e2b21=0xce;}_0x45a3f1[_0x22b0('0x2b')](_0x5e2b21);return _0x45a3f1[_0x22b0('0x2f')](_0x22b0('0x30'),_0x76879b+'-'+_0x49b62a+'/'+_0x1de685)[_0x22b0('0x2c')](_0x2eca7c);}return null;};}function patchUpdates(_0x262f14){return function(_0x1d3fea){try{jsonpatch[_0x22b0('0x31')](_0x1d3fea,_0x262f14,!![]);}catch(_0x1c9b6b){return BPromise['reject'](_0x1c9b6b);}return _0x1d3fea['save']();};}function saveUpdates(_0x5f2d76,_0x3ec178){return function(_0x447f3){if(_0x447f3){return _0x447f3[_0x22b0('0x32')](_0x5f2d76)['then'](function(_0x3ca461){return _0x3ca461;});}return null;};}function removeEntity(_0x33d0cb,_0x4d257a){return function(_0x4edb3b){if(_0x4edb3b){return _0x4edb3b['destroy']()[_0x22b0('0x1e')](function(){var _0x57b633=_0x4edb3b[_0x22b0('0x33')]({'plain':!![]});var _0x4c0d47=_0x22b0('0x34');return db['UserProfileResource'][_0x22b0('0x35')]({'where':{'type':_0x4c0d47,'resourceId':_0x57b633['id']}})[_0x22b0('0x1e')](function(){return _0x4edb3b;});})[_0x22b0('0x1e')](function(){_0x33d0cb['status'](0xcc)[_0x22b0('0x2a')]();});}};}function handleEntityNotFound(_0x5616e0,_0x341b5f){return function(_0x413454){if(!_0x413454){_0x5616e0[_0x22b0('0x29')](0x194);}return _0x413454;};}function handleError(_0x38604e,_0x2cb59c){_0x2cb59c=_0x2cb59c||0x1f4;return function(_0x4328c1){logger['error'](_0x4328c1[_0x22b0('0x36')]);if(_0x4328c1[_0x22b0('0x37')]){delete _0x4328c1['name'];}_0x38604e[_0x22b0('0x2b')](_0x2cb59c)[_0x22b0('0x38')](_0x4328c1);};}exports[_0x22b0('0x39')]=function(_0x350f10,_0x58b402){var _0x24f06f={'include':[{'model':db[_0x22b0('0x3a')],'as':_0x22b0('0x3b')},{'model':db[_0x22b0('0x3c')],'as':'Smtp'},{'model':db[_0x22b0('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5b9709={},_0x171b6b={'count':0x0,'rows':[]};var _0x2c6220=_['map'](db[_0x22b0('0x3e')][_0x22b0('0x3f')],function(_0x2f33d3){return{'name':_0x2f33d3[_0x22b0('0x40')],'type':_0x2f33d3['type'][_0x22b0('0x41')]};});_0x5b9709[_0x22b0('0x42')]=_[_0x22b0('0x43')](_0x2c6220,_0x22b0('0x37'));_0x5b9709['query']=_[_0x22b0('0x44')](_0x350f10['query']);_0x5b9709['filters']=_[_0x22b0('0x45')](_0x5b9709[_0x22b0('0x42')],_0x5b9709['query']);_0x24f06f['attributes']=_['intersection'](_0x5b9709[_0x22b0('0x42')],qs[_0x22b0('0x46')](_0x350f10['query']['fields']));_0x24f06f['attributes']=_0x24f06f[_0x22b0('0x47')][_0x22b0('0x48')]?_0x24f06f['attributes']:_0x5b9709[_0x22b0('0x42')];if(!_0x350f10[_0x22b0('0x49')][_0x22b0('0x4a')]('nolimit')){_0x24f06f[_0x22b0('0x2e')]=qs[_0x22b0('0x2e')](_0x350f10['query'][_0x22b0('0x2e')]);_0x24f06f[_0x22b0('0x2d')]=qs[_0x22b0('0x2d')](_0x350f10[_0x22b0('0x49')][_0x22b0('0x2d')]);}_0x24f06f[_0x22b0('0x4b')]=qs[_0x22b0('0x4c')](_0x350f10['query'][_0x22b0('0x4c')]);_0x24f06f[_0x22b0('0x4d')]=qs[_0x22b0('0x4e')](_[_0x22b0('0x4f')](_0x350f10[_0x22b0('0x49')],_0x5b9709[_0x22b0('0x4e')]),_0x2c6220);if(_0x350f10['query'][_0x22b0('0x50')]){_0x24f06f[_0x22b0('0x4d')]=_[_0x22b0('0x51')](_0x24f06f[_0x22b0('0x4d')],{'$or':_[_0x22b0('0x43')](_0x2c6220,function(_0x52b656){if(_0x52b656[_0x22b0('0x52')]!==_0x22b0('0x53')){var _0xb5e53a={};_0xb5e53a[_0x52b656['name']]={'$like':'%'+_0x350f10[_0x22b0('0x49')][_0x22b0('0x50')]+'%'};return _0xb5e53a;}})});}_0x24f06f=_[_0x22b0('0x51')]({},_0x24f06f,_0x350f10[_0x22b0('0x54')]);var _0x382914={'where':_0x24f06f[_0x22b0('0x4d')]};return db[_0x22b0('0x3e')][_0x22b0('0x55')](_0x382914)[_0x22b0('0x1e')](function(_0x18a4c9){_0x171b6b['count']=_0x18a4c9;if(_0x350f10[_0x22b0('0x49')][_0x22b0('0x56')]){_0x24f06f[_0x22b0('0x57')]=[{'all':!![]}];}return db[_0x22b0('0x3e')][_0x22b0('0x58')](_0x24f06f);})['then'](function(_0x13c172){_0x171b6b[_0x22b0('0x59')]=_0x13c172;return _0x171b6b;})[_0x22b0('0x1e')](respondWithFilteredResult(_0x58b402,_0x24f06f))[_0x22b0('0x28')](handleError(_0x58b402,null));};exports[_0x22b0('0x5a')]=function(_0x22905f,_0x3102a4){var _0x673477={'raw':![],'where':{'id':_0x22905f['params']['id']},'include':[{'model':db[_0x22b0('0x3a')],'as':_0x22b0('0x3b')},{'model':db[_0x22b0('0x3c')],'as':_0x22b0('0x5b')},{'model':db['Pause'],'as':_0x22b0('0x5c')}]},_0x17cd6e={};_0x17cd6e[_0x22b0('0x42')]=_[_0x22b0('0x44')](db[_0x22b0('0x3e')]['rawAttributes']);_0x17cd6e[_0x22b0('0x49')]=_[_0x22b0('0x44')](_0x22905f[_0x22b0('0x49')]);_0x17cd6e['filters']=_[_0x22b0('0x45')](_0x17cd6e[_0x22b0('0x42')],_0x17cd6e['query']);_0x673477[_0x22b0('0x47')]=_[_0x22b0('0x45')](_0x17cd6e[_0x22b0('0x42')],qs[_0x22b0('0x46')](_0x22905f[_0x22b0('0x49')]['fields']));_0x673477[_0x22b0('0x47')]=_0x673477[_0x22b0('0x47')]['length']?_0x673477[_0x22b0('0x47')]:_0x17cd6e['model'];if(_0x22905f['query'][_0x22b0('0x56')]){_0x673477[_0x22b0('0x57')]=[{'all':!![]}];}_0x673477=_[_0x22b0('0x51')]({},_0x673477,_0x22905f['options']);return db[_0x22b0('0x3e')][_0x22b0('0x5d')](_0x673477)['then'](handleEntityNotFound(_0x3102a4,null))[_0x22b0('0x1e')](respondWithResult(_0x3102a4,null))['catch'](handleError(_0x3102a4,null));};exports['update']=function(_0x2dd66f,_0x11fb1c){if(_0x2dd66f[_0x22b0('0x5e')]['id']){delete _0x2dd66f[_0x22b0('0x5e')]['id'];}return db[_0x22b0('0x3e')][_0x22b0('0x5d')]({'where':{'id':_0x2dd66f[_0x22b0('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x22b0('0x3c')],'as':_0x22b0('0x5b')},{'model':db[_0x22b0('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x22b0('0x1e')](handleEntityNotFound(_0x11fb1c,null))[_0x22b0('0x1e')](saveUpdates(_0x2dd66f['body'],null))[_0x22b0('0x1e')](function(_0x17476f){if(_0x17476f&&_0x2dd66f[_0x22b0('0x5e')][_0x22b0('0x3b')]){return db[_0x22b0('0x3a')][_0x22b0('0x32')](_0x2dd66f[_0x22b0('0x5e')][_0x22b0('0x3b')],{'where':{'MailAccountId':_0x17476f['id']}})['then'](function(){return _0x17476f;});}return _0x17476f;})['then'](function(_0xf525b6){if(_0xf525b6&&_0x2dd66f['body'][_0x22b0('0x5b')]){return db[_0x22b0('0x3c')][_0x22b0('0x32')](_0x2dd66f['body'][_0x22b0('0x5b')],{'where':{'MailAccountId':_0xf525b6['id']}})['then'](function(){return _0xf525b6;});}return _0xf525b6;})[_0x22b0('0x1e')](respondWithResult(_0x11fb1c,null))['catch'](handleError(_0x11fb1c,null));};exports[_0x22b0('0x60')]=function(_0x17ea4e,_0x186b0f){return db[_0x22b0('0x3e')][_0x22b0('0x60')]()[_0x22b0('0x1e')](respondWithResult(_0x186b0f,null))[_0x22b0('0x28')](handleError(_0x186b0f,null));};exports[_0x22b0('0x61')]=function(_0x5571f8,_0x37751d,_0x222d21){if(_0x5571f8['body']['id']){delete _0x5571f8[_0x22b0('0x5e')]['id'];}return db['MailAccount'][_0x22b0('0x5d')]({'where':{'id':_0x5571f8['params']['id']}})['then'](handleEntityNotFound(_0x37751d,null))['then'](function(_0x58e5e6){if(_0x58e5e6){_0x5571f8[_0x22b0('0x5e')][_0x22b0('0x62')]=_0x58e5e6['id'];return db[_0x22b0('0x63')][_0x22b0('0x64')](_0x5571f8[_0x22b0('0x5e')]);}})[_0x22b0('0x1e')](respondWithResult(_0x37751d,null))[_0x22b0('0x28')](handleError(_0x37751d,null));};exports[_0x22b0('0x65')]=function(_0xe4f2b9,_0x577095,_0xcb8de5){var _0x10d33e={'raw':![],'where':{}};var _0x1f6a51={};var _0x3d5651={'count':0x0,'rows':[]};return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0xe4f2b9[_0x22b0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x577095,null))[_0x22b0('0x1e')](function(_0x1d7cab){if(_0x1d7cab){_0x1f6a51[_0x22b0('0x42')]=_[_0x22b0('0x44')](db[_0x22b0('0x63')][_0x22b0('0x3f')]);_0x1f6a51[_0x22b0('0x49')]=_[_0x22b0('0x44')](_0xe4f2b9[_0x22b0('0x49')]);_0x1f6a51[_0x22b0('0x4e')]=_[_0x22b0('0x45')](_0x1f6a51[_0x22b0('0x42')],_0x1f6a51[_0x22b0('0x49')]);_0x10d33e[_0x22b0('0x47')]=_[_0x22b0('0x45')](_0x1f6a51[_0x22b0('0x42')],qs['fields'](_0xe4f2b9[_0x22b0('0x49')]['fields']));_0x10d33e[_0x22b0('0x47')]=_0x10d33e['attributes'][_0x22b0('0x48')]?_0x10d33e[_0x22b0('0x47')]:_0x1f6a51[_0x22b0('0x42')];if(!_0xe4f2b9[_0x22b0('0x49')][_0x22b0('0x4a')](_0x22b0('0x67'))){_0x10d33e['limit']=qs[_0x22b0('0x2e')](_0xe4f2b9['query']['limit']);_0x10d33e[_0x22b0('0x2d')]=qs[_0x22b0('0x2d')](_0xe4f2b9[_0x22b0('0x49')][_0x22b0('0x2d')]);}_0x10d33e[_0x22b0('0x4b')]=qs[_0x22b0('0x4c')](_0xe4f2b9[_0x22b0('0x49')][_0x22b0('0x4c')]);_0x10d33e[_0x22b0('0x4d')]=qs[_0x22b0('0x4e')](_[_0x22b0('0x4f')](_0xe4f2b9[_0x22b0('0x49')],_0x1f6a51['filters']));_0x10d33e[_0x22b0('0x4d')][_0x22b0('0x62')]=_0x1d7cab['id'];if(_0xe4f2b9[_0x22b0('0x49')][_0x22b0('0x50')]){_0x10d33e[_0x22b0('0x4d')]=_[_0x22b0('0x51')](_0x10d33e[_0x22b0('0x4d')],{'$or':_[_0x22b0('0x43')](_0x10d33e[_0x22b0('0x47')],function(_0x47d47c){var _0x400209={};_0x400209[_0x47d47c]={'$like':'%'+_0xe4f2b9['query'][_0x22b0('0x50')]+'%'};return _0x400209;})});}_0x10d33e=_[_0x22b0('0x51')]({},_0x10d33e,_0xe4f2b9[_0x22b0('0x54')]);return db[_0x22b0('0x63')][_0x22b0('0x55')]({'where':_0x10d33e[_0x22b0('0x4d')]})['then'](function(_0x5bf651){_0x3d5651[_0x22b0('0x55')]=_0x5bf651;if(_0xe4f2b9[_0x22b0('0x49')]['includeAll']){_0x10d33e[_0x22b0('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x22b0('0x58')](_0x10d33e);})[_0x22b0('0x1e')](function(_0xbce247){_0x3d5651[_0x22b0('0x59')]=_0xbce247;return _0x3d5651;});}})[_0x22b0('0x1e')](respondWithFilteredResult(_0x577095,_0x10d33e))[_0x22b0('0x28')](handleError(_0x577095,null));};exports[_0x22b0('0x68')]=function(_0xbac935,_0xd509a4,_0x474090){return db[_0x22b0('0x3e')]['find']({'where':{'id':_0xbac935[_0x22b0('0x5f')]['id']}})['then'](handleEntityNotFound(_0xd509a4,null))[_0x22b0('0x1e')](function(_0x3f18d1){if(_0x3f18d1){return _0x3f18d1[_0x22b0('0x68')](_0xbac935['query'][_0x22b0('0x69')]);}})[_0x22b0('0x1e')](respondWithStatusCode(_0xd509a4,null))[_0x22b0('0x28')](handleError(_0xd509a4,null));};exports[_0x22b0('0x6a')]=function(_0x1936fa,_0x496290,_0x5e8312){if(_0x1936fa[_0x22b0('0x5e')]['id']){delete _0x1936fa[_0x22b0('0x5e')]['id'];}return db[_0x22b0('0x3e')][_0x22b0('0x5d')]({'where':{'id':_0x1936fa[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x496290,null))['then'](function(_0x2c9fc1){if(_0x2c9fc1){_0x1936fa[_0x22b0('0x5e')][_0x22b0('0x62')]=_0x2c9fc1['id'];return db['CannedAnswer'][_0x22b0('0x64')](_0x1936fa['body']);}})[_0x22b0('0x1e')](respondWithResult(_0x496290,null))['catch'](handleError(_0x496290,null));};exports[_0x22b0('0x6b')]=function(_0x262493,_0x56db96,_0x479acb){var _0x58e5e5={'raw':![],'where':{}};var _0x1a4f37={};var _0x1aeeaf={'count':0x0,'rows':[]};return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0x262493[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x56db96,null))[_0x22b0('0x1e')](function(_0x52e054){if(_0x52e054){_0x1a4f37[_0x22b0('0x42')]=_['keys'](db[_0x22b0('0x6c')][_0x22b0('0x3f')]);_0x1a4f37[_0x22b0('0x49')]=_['keys'](_0x262493[_0x22b0('0x49')]);_0x1a4f37[_0x22b0('0x4e')]=_[_0x22b0('0x45')](_0x1a4f37[_0x22b0('0x42')],_0x1a4f37['query']);_0x58e5e5[_0x22b0('0x47')]=_[_0x22b0('0x45')](_0x1a4f37[_0x22b0('0x42')],qs[_0x22b0('0x46')](_0x262493[_0x22b0('0x49')][_0x22b0('0x46')]));_0x58e5e5[_0x22b0('0x47')]=_0x58e5e5[_0x22b0('0x47')][_0x22b0('0x48')]?_0x58e5e5['attributes']:_0x1a4f37[_0x22b0('0x42')];if(!_0x262493['query'][_0x22b0('0x4a')](_0x22b0('0x67'))){_0x58e5e5[_0x22b0('0x2e')]=qs[_0x22b0('0x2e')](_0x262493[_0x22b0('0x49')]['limit']);_0x58e5e5[_0x22b0('0x2d')]=qs[_0x22b0('0x2d')](_0x262493[_0x22b0('0x49')]['offset']);}_0x58e5e5[_0x22b0('0x4b')]=qs['sort'](_0x262493[_0x22b0('0x49')][_0x22b0('0x4c')]);_0x58e5e5[_0x22b0('0x4d')]=qs['filters'](_['pick'](_0x262493['query'],_0x1a4f37['filters']));_0x58e5e5[_0x22b0('0x4d')][_0x22b0('0x62')]=_0x52e054['id'];if(_0x262493[_0x22b0('0x49')]['filter']){_0x58e5e5['where']=_[_0x22b0('0x51')](_0x58e5e5[_0x22b0('0x4d')],{'$or':_['map'](_0x58e5e5[_0x22b0('0x47')],function(_0x16ab6c){var _0x281169={};_0x281169[_0x16ab6c]={'$like':'%'+_0x262493['query']['filter']+'%'};return _0x281169;})});}_0x58e5e5=_[_0x22b0('0x51')]({},_0x58e5e5,_0x262493[_0x22b0('0x54')]);return db[_0x22b0('0x6c')]['count']({'where':_0x58e5e5['where']})[_0x22b0('0x1e')](function(_0x432db8){_0x1aeeaf['count']=_0x432db8;if(_0x262493['query']['includeAll']){_0x58e5e5[_0x22b0('0x57')]=[{'all':!![]}];}return db[_0x22b0('0x6c')]['findAll'](_0x58e5e5);})[_0x22b0('0x1e')](function(_0x42278f){_0x1aeeaf['rows']=_0x42278f;return _0x1aeeaf;});}})['then'](respondWithFilteredResult(_0x56db96,_0x58e5e5))['catch'](handleError(_0x56db96,null));};exports[_0x22b0('0x6d')]=function(_0x1df6d4,_0x1df21f,_0x3102c3){return db[_0x22b0('0x3e')][_0x22b0('0x5d')]({'where':{'id':_0x1df6d4[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x1df21f,null))['then'](function(_0x2570ae){if(_0x2570ae){return _0x2570ae['removeAnswers'](_0x1df6d4[_0x22b0('0x49')][_0x22b0('0x69')]);}})[_0x22b0('0x1e')](respondWithStatusCode(_0x1df21f,null))[_0x22b0('0x28')](handleError(_0x1df21f,null));};exports[_0x22b0('0x64')]=function(_0x5baa0c,_0xe68542){var _0x705fe={'name':_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x37')],'key':_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x41')],'email':_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x6e')],'ListId':_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x6f')],'active':!_[_0x22b0('0x70')](_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x71')])?_0x5baa0c['body']['active']:!![],'description':_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x72')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x73')])){if(_0x5baa0c['body'][_0x22b0('0x74')]){_0x705fe[_0x22b0('0x3b')][_0x22b0('0x75')]=_0x705fe['Smtp'][_0x22b0('0x75')]=_0x5baa0c[_0x22b0('0x5e')]['cuser'];_0x705fe['Imap'][_0x22b0('0x76')]=_0x705fe[_0x22b0('0x5b')]['pass']=_0x5baa0c['body']['cpassword'];}else{_0x705fe[_0x22b0('0x3b')]['authentication']=_0x705fe[_0x22b0('0x5b')][_0x22b0('0x77')]=![];}_0x705fe[_0x22b0('0x3b')][_0x22b0('0x78')]=_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x3b')][_0x22b0('0x78')];_0x705fe[_0x22b0('0x3b')]['port']=_0x5baa0c['body'][_0x22b0('0x3b')][_0x22b0('0x79')];_0x705fe[_0x22b0('0x5b')][_0x22b0('0x78')]=_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x5b')][_0x22b0('0x78')];_0x705fe[_0x22b0('0x5b')]['port']=_0x5baa0c[_0x22b0('0x5e')][_0x22b0('0x5b')][_0x22b0('0x79')];}else{_0x705fe[_0x22b0('0x3b')][_0x22b0('0x7a')]=_0x705fe['Smtp'][_0x22b0('0x7a')]=_0x5baa0c['body'][_0x22b0('0x73')];_0x705fe[_0x22b0('0x3b')][_0x22b0('0x75')]=_0x705fe[_0x22b0('0x5b')]['user']=_0x5baa0c['body'][_0x22b0('0x7b')];_0x705fe['Imap'][_0x22b0('0x76')]=_0x705fe[_0x22b0('0x5b')][_0x22b0('0x7c')]=_0x5baa0c['body'][_0x22b0('0x7d')];}return db[_0x22b0('0x3e')]['create'](_0x705fe,{'include':[{'model':db[_0x22b0('0x3c')],'as':_0x22b0('0x5b')},{'model':db[_0x22b0('0x3a')],'as':_0x22b0('0x3b')}]})[_0x22b0('0x1e')](function(_0x136dcb){var _0x163f5d=_0x5baa0c[_0x22b0('0x75')][_0x22b0('0x33')]({'plain':!![]});if(!_0x163f5d)throw new Error(_0x22b0('0x7e'));if(_0x163f5d[_0x22b0('0x7f')]===_0x22b0('0x75')){var _0x51fc6f=_0x136dcb[_0x22b0('0x33')]({'plain':!![]});return db[_0x22b0('0x80')]['find']({'where':{'name':_0x22b0('0x34'),'userProfileId':_0x163f5d[_0x22b0('0x81')]},'raw':!![]})['then'](function(_0xbcb752){if(_0xbcb752&&_0xbcb752[_0x22b0('0x82')]===0x0){return db[_0x22b0('0x83')][_0x22b0('0x64')]({'name':_0x51fc6f[_0x22b0('0x37')],'resourceId':_0x51fc6f['id'],'type':_0xbcb752[_0x22b0('0x37')],'sectionId':_0xbcb752['id']},{})[_0x22b0('0x1e')](function(){return _0x136dcb;});}else{return _0x136dcb;}})[_0x22b0('0x28')](function(_0x34699b){logger[_0x22b0('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34699b);throw _0x34699b;});}return _0x136dcb;})[_0x22b0('0x1e')](respondWithResult(_0xe68542,0xc9))[_0x22b0('0x28')](handleError(_0xe68542,null));};exports[_0x22b0('0x84')]=function(_0x1b5957,_0x4602a3,_0x14be47){return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0x1b5957['params']['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x4602a3,null))['then'](function(_0x542ff4){if(_0x542ff4){return _0x542ff4['getImap']();}return null;})[_0x22b0('0x1e')](respondWithResult(_0x4602a3,null))[_0x22b0('0x28')](handleError(_0x4602a3,null));};exports[_0x22b0('0x85')]=function(_0x1646e1,_0x3ac790,_0x18afc0){if(_0x1646e1[_0x22b0('0x5e')]['id']){delete _0x1646e1['body']['id'];}return db[_0x22b0('0x3e')][_0x22b0('0x5d')]({'where':{'id':_0x1646e1[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x3ac790,null))['then'](function(_0x3cf961){if(_0x3cf961){_0x1646e1[_0x22b0('0x5e')][_0x22b0('0x62')]=_0x3cf961['id'];return db['MailServerIn'][_0x22b0('0x64')](_0x1646e1[_0x22b0('0x5e')]);}})['then'](respondWithResult(_0x3ac790,null))['catch'](handleError(_0x3ac790,null));};exports[_0x22b0('0x86')]=function(_0x551d2b,_0x5de859,_0x466d06){return db[_0x22b0('0x3e')]['findOne']({'where':{'id':_0x551d2b[_0x22b0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5de859,null))[_0x22b0('0x1e')](function(_0x4c5365){if(_0x4c5365){return _0x4c5365[_0x22b0('0x87')](null);}return null;})[_0x22b0('0x1e')](respondWithStatusCode(_0x5de859,null))[_0x22b0('0x28')](handleError(_0x5de859,null));};exports[_0x22b0('0x88')]=function(_0x417b59,_0x5d757a,_0x35f870){return db['MailAccount'][_0x22b0('0x66')]({'where':{'id':_0x417b59[_0x22b0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5d757a,null))[_0x22b0('0x1e')](function(_0x3ff7ea){if(_0x3ff7ea){return _0x3ff7ea[_0x22b0('0x88')]();}return null;})[_0x22b0('0x1e')](respondWithResult(_0x5d757a,null))[_0x22b0('0x28')](handleError(_0x5d757a,null));};exports['addSmtp']=function(_0x5e4a7b,_0x5add28,_0x416671){if(_0x5e4a7b[_0x22b0('0x5e')]['id']){delete _0x5e4a7b[_0x22b0('0x5e')]['id'];}return db['MailAccount'][_0x22b0('0x5d')]({'where':{'id':_0x5e4a7b[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x5add28,null))['then'](function(_0x44ea9b){if(_0x44ea9b){_0x5e4a7b[_0x22b0('0x5e')]['MailAccountId']=_0x44ea9b['id'];return db[_0x22b0('0x3c')][_0x22b0('0x64')](_0x5e4a7b[_0x22b0('0x5e')]);}})[_0x22b0('0x1e')](respondWithResult(_0x5add28,null))['catch'](handleError(_0x5add28,null));};exports['removeSmtp']=function(_0x32517e,_0x14ac44,_0x29c2f9){return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0x32517e[_0x22b0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x14ac44,null))[_0x22b0('0x1e')](function(_0x474d81){if(_0x474d81){return _0x474d81[_0x22b0('0x89')](null);}return null;})[_0x22b0('0x1e')](respondWithStatusCode(_0x14ac44,null))['catch'](handleError(_0x14ac44,null));};exports[_0x22b0('0x8a')]=function(_0x5cf177,_0x364fe1,_0x58cb72){return db[_0x22b0('0x8b')]['find']({'where':{'id':_0x5cf177[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x364fe1,null))[_0x22b0('0x1e')](function(_0x2c0b7b){if(_0x2c0b7b){return _0x2c0b7b[_0x22b0('0x8a')](_0x5cf177[_0x22b0('0x5e')]['ids'],_[_0x22b0('0x8c')](_0x5cf177[_0x22b0('0x5e')],[_0x22b0('0x69'),'id'])||{});}})[_0x22b0('0x1e')](respondWithResult(_0x364fe1,null))[_0x22b0('0x28')](handleError(_0x364fe1,null));};exports['getInteractions']=function(_0x2eaf67,_0x153e86,_0x317bd8){var _0x253bcd={'raw':![],'where':{}};var _0x40f374={};var _0x6e338d={'count':0x0,'rows':[]};return db['MailAccount'][_0x22b0('0x66')]({'where':{'id':_0x2eaf67[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x153e86,null))[_0x22b0('0x1e')](function(_0x49244e){if(_0x49244e){_0x40f374[_0x22b0('0x42')]=_[_0x22b0('0x44')](db['MailInteraction']['rawAttributes']);_0x40f374[_0x22b0('0x49')]=_[_0x22b0('0x44')](_0x2eaf67[_0x22b0('0x49')]);_0x40f374['filters']=_[_0x22b0('0x45')](_0x40f374[_0x22b0('0x42')],_0x40f374[_0x22b0('0x49')]);_0x253bcd[_0x22b0('0x47')]=_['intersection'](_0x40f374[_0x22b0('0x42')],qs['fields'](_0x2eaf67[_0x22b0('0x49')][_0x22b0('0x46')]));_0x253bcd[_0x22b0('0x47')]=_0x253bcd[_0x22b0('0x47')]['length']?_0x253bcd[_0x22b0('0x47')]:_0x40f374[_0x22b0('0x42')];if(!_0x2eaf67['query'][_0x22b0('0x4a')](_0x22b0('0x67'))){_0x253bcd['limit']=qs[_0x22b0('0x2e')](_0x2eaf67['query']['limit']);_0x253bcd[_0x22b0('0x2d')]=qs[_0x22b0('0x2d')](_0x2eaf67[_0x22b0('0x49')][_0x22b0('0x2d')]);}_0x253bcd[_0x22b0('0x4b')]=qs[_0x22b0('0x4c')](_0x2eaf67[_0x22b0('0x49')]['sort']);_0x253bcd[_0x22b0('0x4d')]=qs[_0x22b0('0x4e')](_[_0x22b0('0x4f')](_0x2eaf67[_0x22b0('0x49')],_0x40f374['filters']));_0x253bcd[_0x22b0('0x4d')][_0x22b0('0x62')]=_0x49244e['id'];if(_0x2eaf67[_0x22b0('0x49')][_0x22b0('0x50')]){_0x253bcd['where']=_[_0x22b0('0x51')](_0x253bcd[_0x22b0('0x4d')],{'$or':_[_0x22b0('0x43')](_0x253bcd[_0x22b0('0x47')],function(_0x5c6677){var _0x11710a={};_0x11710a[_0x5c6677]={'$like':'%'+_0x2eaf67[_0x22b0('0x49')][_0x22b0('0x50')]+'%'};return _0x11710a;})});}_0x253bcd=_[_0x22b0('0x51')]({},_0x253bcd,_0x2eaf67[_0x22b0('0x54')]);return db[_0x22b0('0x8b')][_0x22b0('0x55')]({'where':_0x253bcd[_0x22b0('0x4d')]})[_0x22b0('0x1e')](function(_0x305df7){_0x6e338d[_0x22b0('0x55')]=_0x305df7;if(_0x2eaf67['query']['includeAll']){_0x253bcd['include']=[{'model':db[_0x22b0('0x8d')],'as':'Contact','required':![]},{'model':db[_0x22b0('0x8e')],'as':_0x22b0('0x8f'),'attributes':[_0x22b0('0x37'),_0x22b0('0x90'),_0x22b0('0x91')],'required':![]},{'model':db['Tag'],'as':_0x22b0('0x92'),'attributes':['id',_0x22b0('0x37'),_0x22b0('0x93')],'where':_0x2eaf67[_0x22b0('0x49')][_0x22b0('0x94')]?{'id':_0x2eaf67[_0x22b0('0x49')]['tag']}:undefined,'required':_0x2eaf67[_0x22b0('0x49')][_0x22b0('0x94')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x253bcd);})[_0x22b0('0x1e')](function(_0x5da442){_0x6e338d[_0x22b0('0x59')]=_0x5da442;return _0x6e338d;});}})[_0x22b0('0x1e')](respondWithFilteredResult(_0x153e86,_0x253bcd))['catch'](handleError(_0x153e86,null));};exports[_0x22b0('0x95')]=function(_0x335f41,_0x341e16,_0x541c9c){return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0x335f41[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x341e16,null))[_0x22b0('0x1e')](function(_0x15a1c4){if(_0x15a1c4){return db[_0x22b0('0x96')][_0x22b0('0x97')](function(_0x4d7d0d){return db['MailApplication'][_0x22b0('0x35')]({'where':{'MailAccountId':_0x335f41['params']['id']},'transaction':_0x4d7d0d})['then'](function(_0x2e207d){var _0x46619c=_[_0x22b0('0x43')](_0x335f41[_0x22b0('0x5e')],function(_0x4a2eb8){_0x4a2eb8['MailAccountId']=_0x335f41['params']['id'];return _0x4a2eb8;});return db[_0x22b0('0x98')][_0x22b0('0x99')](_0x46619c,{'transaction':_0x4d7d0d});});})[_0x22b0('0x1e')](function(){return db[_0x22b0('0x98')][_0x22b0('0x9a')]({'where':{'MailAccountId':_0x335f41[_0x22b0('0x5f')]['id']},'order':_0x22b0('0x9b')});});}})[_0x22b0('0x1e')](respondWithResult(_0x341e16,null))[_0x22b0('0x28')](handleError(_0x341e16,null));};exports[_0x22b0('0x9c')]=function(_0x47adde,_0x466704,_0xf2f4fa){var _0x39e04d={};var _0x1f5983={};var _0x55ba6d;var _0x4bc25a;return db[_0x22b0('0x3e')]['findOne']({'where':{'id':_0x47adde[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x466704,null))[_0x22b0('0x1e')](function(_0x2c5f15){if(_0x2c5f15){_0x55ba6d=_0x2c5f15;_0x1f5983['model']=_[_0x22b0('0x44')](db[_0x22b0('0x98')][_0x22b0('0x3f')]);_0x1f5983[_0x22b0('0x49')]=_[_0x22b0('0x44')](_0x47adde[_0x22b0('0x49')]);_0x1f5983[_0x22b0('0x4e')]=_[_0x22b0('0x45')](_0x1f5983[_0x22b0('0x42')],_0x1f5983[_0x22b0('0x49')]);_0x39e04d[_0x22b0('0x47')]=_['intersection'](_0x1f5983[_0x22b0('0x42')],qs[_0x22b0('0x46')](_0x47adde[_0x22b0('0x49')][_0x22b0('0x46')]));_0x39e04d[_0x22b0('0x47')]=_0x39e04d[_0x22b0('0x47')][_0x22b0('0x48')]?_0x39e04d[_0x22b0('0x47')]:_0x1f5983['model'];_0x39e04d['order']=qs[_0x22b0('0x4c')](_0x47adde[_0x22b0('0x49')]['sort']);_0x39e04d[_0x22b0('0x4d')]=qs[_0x22b0('0x4e')](_['pick'](_0x47adde[_0x22b0('0x49')],_0x1f5983['filters']));if(_0x47adde[_0x22b0('0x49')]['filter']){_0x39e04d[_0x22b0('0x4d')]=_[_0x22b0('0x51')](_0x39e04d[_0x22b0('0x4d')],{'$or':_[_0x22b0('0x43')](_0x39e04d[_0x22b0('0x47')],function(_0x4eabaa){var _0x1874ba={};_0x1874ba[_0x4eabaa]={'$like':'%'+_0x47adde[_0x22b0('0x49')]['filter']+'%'};return _0x1874ba;})});}_0x39e04d=_[_0x22b0('0x51')]({},_0x39e04d,_0x47adde['options']);return _0x55ba6d[_0x22b0('0x9c')](_0x39e04d);}})[_0x22b0('0x1e')](function(_0x575078){if(_0x575078){_0x4bc25a=_0x575078['length'];if(!_0x47adde[_0x22b0('0x49')]['hasOwnProperty'](_0x22b0('0x67'))){_0x39e04d[_0x22b0('0x2e')]=qs[_0x22b0('0x2e')](_0x47adde[_0x22b0('0x49')]['limit']);_0x39e04d[_0x22b0('0x2d')]=qs[_0x22b0('0x2d')](_0x47adde[_0x22b0('0x49')]['offset']);}return _0x55ba6d['getApplications'](_0x39e04d);}})[_0x22b0('0x1e')](function(_0x289fac){if(_0x289fac){return _0x289fac?{'count':_0x4bc25a,'rows':_0x289fac}:null;}})['then'](respondWithResult(_0x466704,null))[_0x22b0('0x28')](handleError(_0x466704,null));};exports[_0x22b0('0x9d')]=function(_0x387628,_0x5a8af0,_0x181e6a){var _0xc00f8e={'raw':!![],'where':{}};var _0x795eba={};var _0x1881f8={'count':0x0,'rows':[]};return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0x387628[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x5a8af0,null))[_0x22b0('0x1e')](function(_0x1b27d7){if(_0x1b27d7){_0x795eba[_0x22b0('0x42')]=_[_0x22b0('0x44')](db[_0x22b0('0x9e')][_0x22b0('0x3f')]);_0x795eba[_0x22b0('0x49')]=_[_0x22b0('0x44')](_0x387628[_0x22b0('0x49')]);_0x795eba[_0x22b0('0x4e')]=_[_0x22b0('0x45')](_0x795eba[_0x22b0('0x42')],_0x795eba[_0x22b0('0x49')]);_0xc00f8e[_0x22b0('0x47')]=_[_0x22b0('0x45')](_0x795eba[_0x22b0('0x42')],qs[_0x22b0('0x46')](_0x387628['query'][_0x22b0('0x46')]));_0xc00f8e['attributes']=_0xc00f8e['attributes'][_0x22b0('0x48')]?_0xc00f8e[_0x22b0('0x47')]:_0x795eba[_0x22b0('0x42')];if(!_0x387628[_0x22b0('0x49')][_0x22b0('0x4a')](_0x22b0('0x67'))){_0xc00f8e[_0x22b0('0x2e')]=qs['limit'](_0x387628['query'][_0x22b0('0x2e')]);_0xc00f8e[_0x22b0('0x2d')]=qs[_0x22b0('0x2d')](_0x387628['query'][_0x22b0('0x2d')]);}_0xc00f8e[_0x22b0('0x4b')]=qs['sort'](_0x387628[_0x22b0('0x49')][_0x22b0('0x4c')]);_0xc00f8e[_0x22b0('0x4d')]=qs['filters'](_[_0x22b0('0x4f')](_0x387628[_0x22b0('0x49')],_0x795eba[_0x22b0('0x4e')]));_0xc00f8e[_0x22b0('0x4d')][_0x22b0('0x62')]=_0x1b27d7['id'];if(_0x387628[_0x22b0('0x49')][_0x22b0('0x50')]){_0xc00f8e[_0x22b0('0x4d')]=_[_0x22b0('0x51')](_0xc00f8e[_0x22b0('0x4d')],{'$or':_[_0x22b0('0x43')](_0xc00f8e['attributes'],function(_0x1a1805){var _0x2bf0f2={};_0x2bf0f2[_0x1a1805]={'$like':'%'+_0x387628[_0x22b0('0x49')][_0x22b0('0x50')]+'%'};return _0x2bf0f2;})});}if(_0x387628[_0x22b0('0x49')][_0x22b0('0x9f')]){var _0x18d6cf=_0x387628['query'][_0x22b0('0x9f')][_0x22b0('0xa0')](',');var _0x4c9c1c={};_0x4c9c1c[_0x18d6cf[0x0]]={'$gte':moment(_0x18d6cf[0x1])[_0x22b0('0xa1')](_0x22b0('0xa2'))};_0xc00f8e[_0x22b0('0x4d')]=_[_0x22b0('0x51')](_0xc00f8e['where'],_0x4c9c1c);}_0xc00f8e=_[_0x22b0('0x51')]({},_0xc00f8e,_0x387628[_0x22b0('0x54')]);return db[_0x22b0('0x9e')][_0x22b0('0x55')]({'where':_0xc00f8e['where']})[_0x22b0('0x1e')](function(_0x4f989c){_0x1881f8[_0x22b0('0x55')]=_0x4f989c;if(_0x387628[_0x22b0('0x49')][_0x22b0('0x56')]){_0xc00f8e['include']=[{'all':!![]}];}return db[_0x22b0('0x9e')]['findAll'](_0xc00f8e);})[_0x22b0('0x1e')](function(_0xadf071){_0x1881f8[_0x22b0('0x59')]=_0xadf071;return _0x1881f8;});}})[_0x22b0('0x1e')](respondWithFilteredResult(_0x5a8af0,_0xc00f8e))[_0x22b0('0x28')](handleError(_0x5a8af0,null));};exports['send']=function(_0x4ee5ef,_0x285477,_0x3aad43){var _0xfaf998,_0x11ec8a={},_0x31826d;if(_0x4ee5ef['body']['to']){_0x31826d=_0x4ee5ef[_0x22b0('0x5e')]['to'][_0x22b0('0xa0')](',')[0x0];}return db['MailAccount'][_0x22b0('0x5d')]({'where':{'id':_0x4ee5ef[_0x22b0('0x5f')]['id']},'include':[{'model':db[_0x22b0('0xa3')],'as':'List','include':[{'model':db[_0x22b0('0x8d')],'as':'Contacts','where':{'email':_0x31826d},'limit':0x1,'order':[['updatedAt',_0x22b0('0xa4')]]}]},{'model':db[_0x22b0('0x3c')],'as':_0x22b0('0x5b'),'raw':!![]}]})[_0x22b0('0x1e')](handleEntityNotFound(_0x285477,null))['then'](function(_0x100985){if(_0x100985){_0xfaf998=_0x100985;if(_0x100985[_0x22b0('0x5b')]){if(_['isNil'](_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xa5')])){_0x4ee5ef['body']['from']=util[_0x22b0('0xa1')](_0x22b0('0xa6'),_0x100985['name'],_0x100985[_0x22b0('0x6e')]||_0x100985[_0x22b0('0x5b')]['user']);}if(_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xa7')]&&_0x4ee5ef['body']['attachments'][_0x22b0('0x48')]){for(var _0xf83b1c=0x0;_0xf83b1c<_0x4ee5ef['body'][_0x22b0('0xa7')]['length'];_0xf83b1c+=0x1){_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xa7')][_0xf83b1c]={'filename':_0x4ee5ef['body']['attachments'][_0xf83b1c][_0x22b0('0x37')],'path':path[_0x22b0('0xa8')](config[_0x22b0('0xa9')],_0x22b0('0xaa'),_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xa7')][_0xf83b1c][_0x22b0('0xab')])};}}var _0x30d8ab={'tls':{'rejectUnauthorized':![]}};if(_[_0x22b0('0x70')](_0x100985[_0x22b0('0x5b')][_0x22b0('0x7a')])){if(_0x100985[_0x22b0('0x5b')][_0x22b0('0x77')]){_0x30d8ab[_0x22b0('0xac')]={'user':_0x100985[_0x22b0('0x5b')]['user'],'pass':_0x100985[_0x22b0('0x5b')]['pass']};}_0x30d8ab[_0x22b0('0x78')]=_0x100985[_0x22b0('0x5b')][_0x22b0('0x78')];_0x30d8ab[_0x22b0('0x79')]=_0x100985[_0x22b0('0x5b')][_0x22b0('0x79')];_0x30d8ab[_0x22b0('0xad')]=_0x100985['Smtp'][_0x22b0('0xad')];}else{_0x30d8ab[_0x22b0('0x7a')]=_0x100985['Smtp'][_0x22b0('0x7a')];_0x30d8ab[_0x22b0('0xac')]={'user':_0x100985['Smtp'][_0x22b0('0x75')],'pass':_0x100985[_0x22b0('0x5b')][_0x22b0('0x7c')]};}return respondWithRpcPromise(_0x22b0('0xae'),_0x22b0('0xaf'),{'account':_0x30d8ab,'message':_0x4ee5ef[_0x22b0('0x5e')]});}else{throw new Error(_0x22b0('0xb0'));}}})[_0x22b0('0x1e')](function(_0x367484){if(_0x367484){_0x11ec8a=_0x367484;if(_0xfaf998['List']){if(_0xfaf998[_0x22b0('0xb1')][_0x22b0('0xb2')]['length']){return _0xfaf998[_0x22b0('0xb1')]['Contacts'][0x0];}else{return db[_0x22b0('0x8d')]['create'](_[_0x22b0('0x17')](_0x4ee5ef[_0x22b0('0x5e')],{'firstName':_0x4ee5ef[_0x22b0('0x5e')]['to'],'email':_0x4ee5ef[_0x22b0('0x5e')]['to'],'phone':_0x4ee5ef[_0x22b0('0x5e')]['to'],'ListId':_0xfaf998[_0x22b0('0x6f')]}));}}else{throw new Error(_0x22b0('0xb0'));}}})[_0x22b0('0x1e')](function(_0x54c3b6){if(_0x54c3b6){var _0x45089c={'UserId':_0x4ee5ef[_0x22b0('0x75')]['id'],'ContactId':_0x54c3b6['id'],'MailAccountId':_0xfaf998['id'],'inReplyTo':_0x11ec8a[_0x22b0('0xb3')],'to':_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xa5')],'cc':_0x4ee5ef[_0x22b0('0x5e')]['cc'],'subject':_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xb4')],'attach':_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xb5')],'firstMsgDirection':_0x22b0('0xb6'),'lastMsgAt':moment()[_0x22b0('0xa1')](_0x22b0('0xa2')),'lastMsgDirection':'out','lastMsgBody':_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0x5e')],'Messages':[_[_0x22b0('0x51')](_0x4ee5ef[_0x22b0('0x5e')],{'messageId':_0x11ec8a[_0x22b0('0xb3')],'sentAt':moment()['format'](_0x22b0('0xa2')),'read':!![],'MailAccountId':_0xfaf998['id'],'UserId':_0x4ee5ef[_0x22b0('0x75')]['id'],'ContactId':_0x54c3b6['id']})]};if(_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xb7')]){_0x45089c=_[_0x22b0('0x51')](_0x45089c,_0x4ee5ef[_0x22b0('0x5e')][_0x22b0('0xb7')]);}return db[_0x22b0('0x8b')][_0x22b0('0x64')](_0x45089c,{'include':[{'model':db[_0x22b0('0x9e')],'as':_0x22b0('0xb8')}]});}})['then'](respondWithResult(_0x285477,null))['catch'](handleError(_0x285477,null));};exports[_0x22b0('0xb9')]=function(_0x28b18b,_0x2ed8ab,_0x458664){return db[_0x22b0('0x3e')][_0x22b0('0x5d')]({'where':{'id':_0x28b18b[_0x22b0('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x22b0('0x5b'),'raw':!![]}]})[_0x22b0('0x1e')](handleEntityNotFound(_0x2ed8ab,null))[_0x22b0('0x1e')](function(_0x2dbbea){if(_0x2dbbea&&_0x2dbbea['Smtp']){var _0x2886d5={'id':_0x2dbbea['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2dbbea[_0x22b0('0x5b')][_0x22b0('0x7a')]){_0x2886d5['service']=_0x2dbbea['Smtp'][_0x22b0('0x7a')];}else{_0x2886d5[_0x22b0('0x78')]=_0x2dbbea['Smtp'][_0x22b0('0x78')];_0x2886d5['port']=_0x2dbbea[_0x22b0('0x5b')]['port'];_0x2886d5[_0x22b0('0xad')]=_0x2dbbea['Smtp'][_0x22b0('0xad')];}if(_0x2dbbea[_0x22b0('0x5b')][_0x22b0('0x77')]){_0x2886d5[_0x22b0('0xac')]={'user':_0x2dbbea[_0x22b0('0x5b')][_0x22b0('0x75')],'pass':_0x2dbbea[_0x22b0('0x5b')]['pass']};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x2886d5});}})[_0x22b0('0x1e')](respondWithResult(_0x2ed8ab,null))[_0x22b0('0x28')](handleError(_0x2ed8ab,null));};exports[_0x22b0('0x35')]=function(_0x3f0920,_0xf77503){return db[_0x22b0('0x3e')]['find']({'where':{'id':_0x3f0920['params']['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0xf77503,null))[_0x22b0('0x1e')](function(_0x2c58ac){if(_0x2c58ac&&_0x2c58ac[_0x22b0('0x7a')]){throw new db[(_0x22b0('0xba'))]['ValidationError'](_0x22b0('0xbb'));}return _0x2c58ac;})[_0x22b0('0x1e')](removeEntity(_0xf77503,null))[_0x22b0('0x28')](handleError(_0xf77503,null));};exports[_0x22b0('0xbc')]=function(_0x5e42b6,_0x3a1135,_0x1ece6e){return db[_0x22b0('0x3e')][_0x22b0('0x5d')]({'where':{'id':_0x5e42b6[_0x22b0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3a1135,null))[_0x22b0('0x1e')](function(_0xc6fca7){if(_0xc6fca7){return _0xc6fca7[_0x22b0('0xbc')](_0x5e42b6[_0x22b0('0x5e')]['ids'],_['omit'](_0x5e42b6[_0x22b0('0x5e')],[_0x22b0('0x69'),'id'])||{})['spread'](function(_0x50723a){for(var _0x302dbb=0x0;_0x302dbb<_0x5e42b6[_0x22b0('0x5e')]['ids'][_0x22b0('0x48')];_0x302dbb+=0x1){socket[_0x22b0('0xbd')](_0x22b0('0xbe'),{'UserId':_0x5e42b6[_0x22b0('0x5e')][_0x22b0('0x69')][_0x302dbb],'MailAccountId':_0x5e42b6[_0x22b0('0x5f')]['id']});}return _0x50723a;});}})[_0x22b0('0x1e')](respondWithResult(_0x3a1135,null))[_0x22b0('0x28')](handleError(_0x3a1135,null));};exports[_0x22b0('0xbf')]=function(_0x1173fb,_0x3a9766,_0x48710f){return db['MailAccount'][_0x22b0('0x5d')]({'where':{'id':_0x1173fb['params']['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x3a9766,null))[_0x22b0('0x1e')](function(_0x526c04){if(_0x526c04){return _0x526c04['removeAgents'](_0x1173fb[_0x22b0('0x49')][_0x22b0('0x69')])[_0x22b0('0x1e')](function(){if(_[_0x22b0('0xc0')](_0x1173fb[_0x22b0('0x49')][_0x22b0('0x69')])){for(var _0x59aa99=0x0;_0x59aa99<_0x1173fb[_0x22b0('0x49')][_0x22b0('0x69')][_0x22b0('0x48')];_0x59aa99+=0x1){socket[_0x22b0('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x1173fb[_0x22b0('0x49')]['ids'][_0x59aa99]),'MailAccountId':Number(_0x1173fb[_0x22b0('0x5f')]['id'])});}}else{socket[_0x22b0('0xbd')](_0x22b0('0xc1'),{'UserId':Number(_0x1173fb[_0x22b0('0x49')][_0x22b0('0x69')]),'MailAccountId':Number(_0x1173fb[_0x22b0('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a9766,null))[_0x22b0('0x28')](handleError(_0x3a9766,null));};exports[_0x22b0('0xc2')]=function(_0x582058,_0x3abbc7,_0x3379b4){var _0x6b9181={};var _0x3d3d3b={};var _0x3ce6c8;var _0x54a611;return db[_0x22b0('0x3e')][_0x22b0('0x66')]({'where':{'id':_0x582058[_0x22b0('0x5f')]['id']}})[_0x22b0('0x1e')](handleEntityNotFound(_0x3abbc7,null))[_0x22b0('0x1e')](function(_0x47d448){if(_0x47d448){_0x3ce6c8=_0x47d448;_0x3d3d3b['model']=_[_0x22b0('0x44')](db[_0x22b0('0x8e')][_0x22b0('0x3f')]);_0x3d3d3b['query']=_[_0x22b0('0x44')](_0x582058[_0x22b0('0x49')]);_0x3d3d3b['filters']=_[_0x22b0('0x45')](_0x3d3d3b['model'],_0x3d3d3b[_0x22b0('0x49')]);_0x6b9181['attributes']=_[_0x22b0('0x45')](_0x3d3d3b['model'],qs[_0x22b0('0x46')](_0x582058[_0x22b0('0x49')][_0x22b0('0x46')]));_0x6b9181['attributes']=_0x6b9181[_0x22b0('0x47')][_0x22b0('0x48')]?_0x6b9181[_0x22b0('0x47')]:_0x3d3d3b['model'];_0x6b9181[_0x22b0('0x4b')]=qs[_0x22b0('0x4c')](_0x582058[_0x22b0('0x49')][_0x22b0('0x4c')]);_0x6b9181[_0x22b0('0x4d')]=qs[_0x22b0('0x4e')](_[_0x22b0('0x4f')](_0x582058[_0x22b0('0x49')],_0x3d3d3b[_0x22b0('0x4e')]));if(_0x582058['query'][_0x22b0('0x50')]){_0x6b9181['where']=_[_0x22b0('0x51')](_0x6b9181['where'],{'$or':_[_0x22b0('0x43')](_0x6b9181['attributes'],function(_0x2e821b){var _0x1162e1={};_0x1162e1[_0x2e821b]={'$like':'%'+_0x582058[_0x22b0('0x49')][_0x22b0('0x50')]+'%'};return _0x1162e1;})});}_0x6b9181=_[_0x22b0('0x51')]({},_0x6b9181,_0x582058[_0x22b0('0x54')]);return _0x3ce6c8[_0x22b0('0xc2')](_0x6b9181);}})[_0x22b0('0x1e')](function(_0x43bcc0){if(_0x43bcc0){_0x54a611=_0x43bcc0[_0x22b0('0x48')];if(!_0x582058[_0x22b0('0x49')][_0x22b0('0x4a')](_0x22b0('0x67'))){_0x6b9181[_0x22b0('0x2e')]=qs[_0x22b0('0x2e')](_0x582058[_0x22b0('0x49')][_0x22b0('0x2e')]);_0x6b9181['offset']=qs['offset'](_0x582058['query'][_0x22b0('0x2d')]);}return _0x3ce6c8[_0x22b0('0xc2')](_0x6b9181);}})[_0x22b0('0x1e')](function(_0x52924e){if(_0x52924e){return _0x52924e?{'count':_0x54a611,'rows':_0x52924e}:null;}})[_0x22b0('0x1e')](respondWithResult(_0x3abbc7,null))['catch'](handleError(_0x3abbc7,null));}; \ No newline at end of file +var _0x7a07=['findOne','Disposition','MailAccountId','removeDispositions','ids','CannedAnswer','create','pick','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','bulkCreate','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','server/files/attachments','auth','List\x20not\x20found','List','defaults','messageId','subject','out','Interaction','verifySmtp','secure','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','MailAccounts','UserProfileResource','name','send','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','body','Imap','update','describe','addDisposition','params'];(function(_0x27513f,_0xbfde49){var _0x5e5835=function(_0x2bd01f){while(--_0x2bd01f){_0x27513f['push'](_0x27513f['shift']());}};_0x5e5835(++_0xbfde49);}(_0x7a07,0x1df));var _0x77a0=function(_0x4d01e4,_0x3ccc5e){_0x4d01e4=_0x4d01e4-0x0;var _0x3096da=_0x7a07[_0x4d01e4];return _0x3096da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x77a0('0x0'));var zipdir=require(_0x77a0('0x1'));var jsonpatch=require(_0x77a0('0x2'));var rp=require('request-promise');var moment=require(_0x77a0('0x3'));var BPromise=require(_0x77a0('0x4'));var Mustache=require(_0x77a0('0x5'));var util=require(_0x77a0('0x6'));var path=require(_0x77a0('0x7'));var sox=require(_0x77a0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x77a0('0x9'));var squel=require(_0x77a0('0xa'));var crypto=require(_0x77a0('0xb'));var jsforce=require(_0x77a0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x77a0('0xd'));var querystring=require(_0x77a0('0xe'));var Papa=require(_0x77a0('0xf'));var Redis=require(_0x77a0('0x10'));var authService=require(_0x77a0('0x11'));var qs=require(_0x77a0('0x12'));var as=require(_0x77a0('0x13'));var hardwareService=require(_0x77a0('0x14'));var logger=require(_0x77a0('0x15'))(_0x77a0('0x16'));var utils=require(_0x77a0('0x17'));var config=require(_0x77a0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x77a0('0x19'))['db'];config[_0x77a0('0x1a')]=_['defaults'](config['redis'],{'host':_0x77a0('0x1b'),'port':0x18eb});var socket=require(_0x77a0('0x1c'))(new Redis(config[_0x77a0('0x1a')]));require('./mailAccount.socket')[_0x77a0('0x1d')](socket);var jayson=require(_0x77a0('0x1e'));var client=jayson[_0x77a0('0x1f')][_0x77a0('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x21f04b,_0x368b4b,_0x4dc817,_0x21d999){return new BPromise(function(_0x41dd70,_0x5fb070){var _0x415140=_0x21d999||client;return _0x415140[_0x77a0('0x21')](_0x21f04b,_0x4dc817)['then'](function(_0x104738){logger[_0x77a0('0x22')](_0x77a0('0x23'),_0x368b4b,_0x77a0('0x24'));logger[_0x77a0('0x25')](_0x77a0('0x26'),_0x368b4b,'request\x20sent',JSON['stringify'](_0x104738));if(_0x104738['error']){if(_0x104738['error'][_0x77a0('0x27')]===0x1f4){logger[_0x77a0('0x28')](_0x77a0('0x23'),_0x368b4b,_0x104738[_0x77a0('0x28')][_0x77a0('0x29')]);return _0x5fb070(_0x104738[_0x77a0('0x28')][_0x77a0('0x29')]);}logger[_0x77a0('0x28')](_0x77a0('0x23'),_0x368b4b,_0x104738['error'][_0x77a0('0x29')]);return _0x41dd70(_0x104738[_0x77a0('0x28')][_0x77a0('0x29')]);}else{logger[_0x77a0('0x22')](_0x77a0('0x23'),_0x368b4b,_0x77a0('0x24'));_0x41dd70(_0x104738[_0x77a0('0x2a')][_0x77a0('0x29')]);}})[_0x77a0('0x2b')](function(_0x4945fe){logger['error'](_0x77a0('0x23'),_0x368b4b,_0x4945fe);_0x5fb070(_0x4945fe);});});}function respondWithStatusCode(_0x21212f,_0x3e2c37){_0x3e2c37=_0x3e2c37||0xcc;return function(_0x5392e0){if(_0x5392e0){return _0x21212f[_0x77a0('0x2c')](_0x3e2c37);}return _0x21212f[_0x77a0('0x2d')](_0x3e2c37)[_0x77a0('0x2e')]();};}function respondWithResult(_0x548739,_0x117893){_0x117893=_0x117893||0xc8;return function(_0x1e9b26){if(_0x1e9b26){return _0x548739[_0x77a0('0x2d')](_0x117893)['json'](_0x1e9b26);}};}function respondWithFilteredResult(_0x558ba5,_0x4ec56c){return function(_0x1d6381){if(_0x1d6381){var _0x2bd495=_0x1d6381['count'],_0x16fdf1=_0x4ec56c[_0x77a0('0x2f')],_0x351cd6=_0x4ec56c[_0x77a0('0x2f')]+_0x4ec56c[_0x77a0('0x30')],_0x2d28f1;if(_0x351cd6>=_0x2bd495){_0x351cd6=_0x2bd495;_0x2d28f1=0xc8;}else{_0x2d28f1=0xce;}_0x558ba5[_0x77a0('0x2d')](_0x2d28f1);return _0x558ba5[_0x77a0('0x31')](_0x77a0('0x32'),_0x16fdf1+'-'+_0x351cd6+'/'+_0x2bd495)[_0x77a0('0x33')](_0x1d6381);}return null;};}function patchUpdates(_0x4032c6){return function(_0x299655){try{jsonpatch[_0x77a0('0x34')](_0x299655,_0x4032c6,!![]);}catch(_0x1dfceb){return BPromise[_0x77a0('0x35')](_0x1dfceb);}return _0x299655['save']();};}function saveUpdates(_0x4f3dd1,_0x696772){return function(_0x5dd6b5){if(_0x5dd6b5){return _0x5dd6b5['update'](_0x4f3dd1)[_0x77a0('0x36')](function(_0x4a6107){return _0x4a6107;});}return null;};}function removeEntity(_0x39b6d5,_0x5f04a1){return function(_0x156b9a){if(_0x156b9a){return _0x156b9a[_0x77a0('0x37')]()[_0x77a0('0x36')](function(){var _0x522338=_0x156b9a[_0x77a0('0x38')]({'plain':!![]});var _0x46c875=_0x77a0('0x39');return db[_0x77a0('0x3a')][_0x77a0('0x37')]({'where':{'type':_0x46c875,'resourceId':_0x522338['id']}})[_0x77a0('0x36')](function(){return _0x156b9a;});})[_0x77a0('0x36')](function(){_0x39b6d5[_0x77a0('0x2d')](0xcc)[_0x77a0('0x2e')]();});}};}function handleEntityNotFound(_0x55208e,_0x5ecf03){return function(_0x143850){if(!_0x143850){_0x55208e[_0x77a0('0x2c')](0x194);}return _0x143850;};}function handleError(_0x2a1e25,_0x52cd8e){_0x52cd8e=_0x52cd8e||0x1f4;return function(_0x53db02){logger[_0x77a0('0x28')](_0x53db02['stack']);if(_0x53db02[_0x77a0('0x3b')]){delete _0x53db02['name'];}_0x2a1e25[_0x77a0('0x2d')](_0x52cd8e)[_0x77a0('0x3c')](_0x53db02);};}exports[_0x77a0('0x3d')]=function(_0x540a69,_0x1d6ca8){var _0x41328c={'include':[{'model':db[_0x77a0('0x3e')],'as':'Imap'},{'model':db[_0x77a0('0x3f')],'as':_0x77a0('0x40')},{'model':db[_0x77a0('0x41')],'as':_0x77a0('0x42')}]},_0xe3508d={},_0x257752={'count':0x0,'rows':[]};var _0x5471cf=_['map'](db[_0x77a0('0x43')][_0x77a0('0x44')],function(_0xb1ab54){return{'name':_0xb1ab54[_0x77a0('0x45')],'type':_0xb1ab54[_0x77a0('0x46')][_0x77a0('0x47')]};});_0xe3508d[_0x77a0('0x48')]=_[_0x77a0('0x49')](_0x5471cf,_0x77a0('0x3b'));_0xe3508d[_0x77a0('0x4a')]=_[_0x77a0('0x4b')](_0x540a69[_0x77a0('0x4a')]);_0xe3508d[_0x77a0('0x4c')]=_[_0x77a0('0x4d')](_0xe3508d['model'],_0xe3508d[_0x77a0('0x4a')]);_0x41328c[_0x77a0('0x4e')]=_[_0x77a0('0x4d')](_0xe3508d[_0x77a0('0x48')],qs['fields'](_0x540a69[_0x77a0('0x4a')][_0x77a0('0x4f')]));_0x41328c['attributes']=_0x41328c[_0x77a0('0x4e')][_0x77a0('0x50')]?_0x41328c[_0x77a0('0x4e')]:_0xe3508d[_0x77a0('0x48')];if(!_0x540a69['query'][_0x77a0('0x51')](_0x77a0('0x52'))){_0x41328c[_0x77a0('0x30')]=qs[_0x77a0('0x30')](_0x540a69[_0x77a0('0x4a')]['limit']);_0x41328c['offset']=qs[_0x77a0('0x2f')](_0x540a69[_0x77a0('0x4a')]['offset']);}_0x41328c[_0x77a0('0x53')]=qs['sort'](_0x540a69[_0x77a0('0x4a')][_0x77a0('0x54')]);_0x41328c[_0x77a0('0x55')]=qs[_0x77a0('0x4c')](_['pick'](_0x540a69[_0x77a0('0x4a')],_0xe3508d[_0x77a0('0x4c')]),_0x5471cf);if(_0x540a69[_0x77a0('0x4a')][_0x77a0('0x56')]){_0x41328c[_0x77a0('0x55')]=_[_0x77a0('0x57')](_0x41328c[_0x77a0('0x55')],{'$or':_['map'](_0x5471cf,function(_0x10391f){if(_0x10391f[_0x77a0('0x46')]!==_0x77a0('0x58')){var _0x1e52f2={};_0x1e52f2[_0x10391f[_0x77a0('0x3b')]]={'$like':'%'+_0x540a69[_0x77a0('0x4a')][_0x77a0('0x56')]+'%'};return _0x1e52f2;}})});}_0x41328c=_[_0x77a0('0x57')]({},_0x41328c,_0x540a69[_0x77a0('0x59')]);var _0x1856ba={'where':_0x41328c[_0x77a0('0x55')]};return db[_0x77a0('0x43')][_0x77a0('0x5a')](_0x1856ba)[_0x77a0('0x36')](function(_0x4d2e1e){_0x257752[_0x77a0('0x5a')]=_0x4d2e1e;if(_0x540a69[_0x77a0('0x4a')][_0x77a0('0x5b')]){_0x41328c[_0x77a0('0x5c')]=[{'all':!![]}];}return db[_0x77a0('0x43')][_0x77a0('0x5d')](_0x41328c);})[_0x77a0('0x36')](function(_0x52b10e){_0x257752[_0x77a0('0x5e')]=_0x52b10e;return _0x257752;})['then'](respondWithFilteredResult(_0x1d6ca8,_0x41328c))['catch'](handleError(_0x1d6ca8,null));};exports[_0x77a0('0x5f')]=function(_0x659bd2,_0xd0020e){var _0x52cdeb={'raw':![],'where':{'id':_0x659bd2['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x77a0('0x3f')],'as':_0x77a0('0x40')},{'model':db[_0x77a0('0x41')],'as':_0x77a0('0x42')}]},_0x5284={};_0x5284['model']=_[_0x77a0('0x4b')](db[_0x77a0('0x43')]['rawAttributes']);_0x5284[_0x77a0('0x4a')]=_[_0x77a0('0x4b')](_0x659bd2[_0x77a0('0x4a')]);_0x5284[_0x77a0('0x4c')]=_[_0x77a0('0x4d')](_0x5284[_0x77a0('0x48')],_0x5284[_0x77a0('0x4a')]);_0x52cdeb[_0x77a0('0x4e')]=_[_0x77a0('0x4d')](_0x5284[_0x77a0('0x48')],qs[_0x77a0('0x4f')](_0x659bd2[_0x77a0('0x4a')][_0x77a0('0x4f')]));_0x52cdeb['attributes']=_0x52cdeb[_0x77a0('0x4e')][_0x77a0('0x50')]?_0x52cdeb[_0x77a0('0x4e')]:_0x5284[_0x77a0('0x48')];if(_0x659bd2['query']['includeAll']){_0x52cdeb['include']=[{'all':!![]}];}_0x52cdeb=_[_0x77a0('0x57')]({},_0x52cdeb,_0x659bd2[_0x77a0('0x59')]);return db['MailAccount'][_0x77a0('0x60')](_0x52cdeb)[_0x77a0('0x36')](handleEntityNotFound(_0xd0020e,null))[_0x77a0('0x36')](respondWithResult(_0xd0020e,null))['catch'](handleError(_0xd0020e,null));};exports['update']=function(_0x20f30c,_0x6e7c98){if(_0x20f30c[_0x77a0('0x61')]['id']){delete _0x20f30c['body']['id'];}return db['MailAccount'][_0x77a0('0x60')]({'where':{'id':_0x20f30c['params']['id']},'include':[{'model':db[_0x77a0('0x3e')],'as':_0x77a0('0x62')},{'model':db[_0x77a0('0x3f')],'as':_0x77a0('0x40')},{'model':db['Pause'],'as':_0x77a0('0x42')}]})['then'](handleEntityNotFound(_0x6e7c98,null))[_0x77a0('0x36')](saveUpdates(_0x20f30c[_0x77a0('0x61')],null))['then'](function(_0x79e434){if(_0x79e434&&_0x20f30c[_0x77a0('0x61')][_0x77a0('0x62')]){return db[_0x77a0('0x3e')][_0x77a0('0x63')](_0x20f30c['body'][_0x77a0('0x62')],{'where':{'MailAccountId':_0x79e434['id']}})[_0x77a0('0x36')](function(){return _0x79e434;});}return _0x79e434;})[_0x77a0('0x36')](function(_0x3599de){if(_0x3599de&&_0x20f30c[_0x77a0('0x61')][_0x77a0('0x40')]){return db[_0x77a0('0x3f')][_0x77a0('0x63')](_0x20f30c[_0x77a0('0x61')][_0x77a0('0x40')],{'where':{'MailAccountId':_0x3599de['id']}})['then'](function(){return _0x3599de;});}return _0x3599de;})['then'](respondWithResult(_0x6e7c98,null))[_0x77a0('0x2b')](handleError(_0x6e7c98,null));};exports[_0x77a0('0x64')]=function(_0x343806,_0x4b0afd){return db['MailAccount'][_0x77a0('0x64')]()[_0x77a0('0x36')](respondWithResult(_0x4b0afd,null))['catch'](handleError(_0x4b0afd,null));};exports[_0x77a0('0x65')]=function(_0x23f410,_0xb5f138,_0x523b25){if(_0x23f410['body']['id']){delete _0x23f410['body']['id'];}return db[_0x77a0('0x43')][_0x77a0('0x60')]({'where':{'id':_0x23f410[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0xb5f138,null))[_0x77a0('0x36')](function(_0x503af9){if(_0x503af9){_0x23f410[_0x77a0('0x61')]['MailAccountId']=_0x503af9['id'];return db['Disposition']['create'](_0x23f410['body']);}})['then'](respondWithResult(_0xb5f138,null))[_0x77a0('0x2b')](handleError(_0xb5f138,null));};exports['getDispositions']=function(_0xe6affd,_0x5151b0,_0x1d896d){var _0x2fce95={'raw':![],'where':{}};var _0x359730={};var _0x3ae614={'count':0x0,'rows':[]};return db['MailAccount'][_0x77a0('0x67')]({'where':{'id':_0xe6affd[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x5151b0,null))[_0x77a0('0x36')](function(_0x337e30){if(_0x337e30){_0x359730['model']=_['keys'](db[_0x77a0('0x68')][_0x77a0('0x44')]);_0x359730[_0x77a0('0x4a')]=_['keys'](_0xe6affd['query']);_0x359730[_0x77a0('0x4c')]=_['intersection'](_0x359730[_0x77a0('0x48')],_0x359730['query']);_0x2fce95[_0x77a0('0x4e')]=_['intersection'](_0x359730[_0x77a0('0x48')],qs[_0x77a0('0x4f')](_0xe6affd[_0x77a0('0x4a')][_0x77a0('0x4f')]));_0x2fce95[_0x77a0('0x4e')]=_0x2fce95['attributes'][_0x77a0('0x50')]?_0x2fce95[_0x77a0('0x4e')]:_0x359730[_0x77a0('0x48')];if(!_0xe6affd[_0x77a0('0x4a')]['hasOwnProperty'](_0x77a0('0x52'))){_0x2fce95[_0x77a0('0x30')]=qs[_0x77a0('0x30')](_0xe6affd[_0x77a0('0x4a')][_0x77a0('0x30')]);_0x2fce95[_0x77a0('0x2f')]=qs[_0x77a0('0x2f')](_0xe6affd[_0x77a0('0x4a')][_0x77a0('0x2f')]);}_0x2fce95[_0x77a0('0x53')]=qs['sort'](_0xe6affd[_0x77a0('0x4a')][_0x77a0('0x54')]);_0x2fce95[_0x77a0('0x55')]=qs[_0x77a0('0x4c')](_['pick'](_0xe6affd[_0x77a0('0x4a')],_0x359730[_0x77a0('0x4c')]));_0x2fce95[_0x77a0('0x55')][_0x77a0('0x69')]=_0x337e30['id'];if(_0xe6affd[_0x77a0('0x4a')][_0x77a0('0x56')]){_0x2fce95['where']=_['merge'](_0x2fce95[_0x77a0('0x55')],{'$or':_['map'](_0x2fce95[_0x77a0('0x4e')],function(_0x4e85a4){var _0xf9eea1={};_0xf9eea1[_0x4e85a4]={'$like':'%'+_0xe6affd[_0x77a0('0x4a')][_0x77a0('0x56')]+'%'};return _0xf9eea1;})});}_0x2fce95=_[_0x77a0('0x57')]({},_0x2fce95,_0xe6affd['options']);return db[_0x77a0('0x68')][_0x77a0('0x5a')]({'where':_0x2fce95[_0x77a0('0x55')]})['then'](function(_0x1b4d56){_0x3ae614[_0x77a0('0x5a')]=_0x1b4d56;if(_0xe6affd[_0x77a0('0x4a')]['includeAll']){_0x2fce95[_0x77a0('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x77a0('0x5d')](_0x2fce95);})[_0x77a0('0x36')](function(_0x2c6614){_0x3ae614['rows']=_0x2c6614;return _0x3ae614;});}})[_0x77a0('0x36')](respondWithFilteredResult(_0x5151b0,_0x2fce95))[_0x77a0('0x2b')](handleError(_0x5151b0,null));};exports[_0x77a0('0x6a')]=function(_0x1f2b14,_0x4af731,_0x5bc34f){return db[_0x77a0('0x43')][_0x77a0('0x60')]({'where':{'id':_0x1f2b14['params']['id']}})['then'](handleEntityNotFound(_0x4af731,null))[_0x77a0('0x36')](function(_0x5b2660){if(_0x5b2660){return _0x5b2660['removeDispositions'](_0x1f2b14['query'][_0x77a0('0x6b')]);}})[_0x77a0('0x36')](respondWithStatusCode(_0x4af731,null))['catch'](handleError(_0x4af731,null));};exports['addAnswer']=function(_0x21ed12,_0x1b7f31,_0x4c6b3b){if(_0x21ed12['body']['id']){delete _0x21ed12[_0x77a0('0x61')]['id'];}return db['MailAccount'][_0x77a0('0x60')]({'where':{'id':_0x21ed12[_0x77a0('0x66')]['id']}})['then'](handleEntityNotFound(_0x1b7f31,null))[_0x77a0('0x36')](function(_0x39a082){if(_0x39a082){_0x21ed12[_0x77a0('0x61')][_0x77a0('0x69')]=_0x39a082['id'];return db[_0x77a0('0x6c')][_0x77a0('0x6d')](_0x21ed12[_0x77a0('0x61')]);}})[_0x77a0('0x36')](respondWithResult(_0x1b7f31,null))[_0x77a0('0x2b')](handleError(_0x1b7f31,null));};exports['getAnswers']=function(_0x4a72b0,_0x5bc233,_0x54c22a){var _0x22ca7a={'raw':![],'where':{}};var _0x1755ed={};var _0x414df9={'count':0x0,'rows':[]};return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0x4a72b0[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x5bc233,null))[_0x77a0('0x36')](function(_0x29de48){if(_0x29de48){_0x1755ed['model']=_[_0x77a0('0x4b')](db[_0x77a0('0x6c')][_0x77a0('0x44')]);_0x1755ed[_0x77a0('0x4a')]=_[_0x77a0('0x4b')](_0x4a72b0[_0x77a0('0x4a')]);_0x1755ed[_0x77a0('0x4c')]=_[_0x77a0('0x4d')](_0x1755ed[_0x77a0('0x48')],_0x1755ed['query']);_0x22ca7a[_0x77a0('0x4e')]=_[_0x77a0('0x4d')](_0x1755ed[_0x77a0('0x48')],qs[_0x77a0('0x4f')](_0x4a72b0[_0x77a0('0x4a')][_0x77a0('0x4f')]));_0x22ca7a[_0x77a0('0x4e')]=_0x22ca7a[_0x77a0('0x4e')][_0x77a0('0x50')]?_0x22ca7a['attributes']:_0x1755ed['model'];if(!_0x4a72b0[_0x77a0('0x4a')][_0x77a0('0x51')]('nolimit')){_0x22ca7a[_0x77a0('0x30')]=qs[_0x77a0('0x30')](_0x4a72b0[_0x77a0('0x4a')][_0x77a0('0x30')]);_0x22ca7a['offset']=qs['offset'](_0x4a72b0['query'][_0x77a0('0x2f')]);}_0x22ca7a[_0x77a0('0x53')]=qs['sort'](_0x4a72b0[_0x77a0('0x4a')]['sort']);_0x22ca7a[_0x77a0('0x55')]=qs[_0x77a0('0x4c')](_[_0x77a0('0x6e')](_0x4a72b0['query'],_0x1755ed[_0x77a0('0x4c')]));_0x22ca7a[_0x77a0('0x55')][_0x77a0('0x69')]=_0x29de48['id'];if(_0x4a72b0['query']['filter']){_0x22ca7a[_0x77a0('0x55')]=_[_0x77a0('0x57')](_0x22ca7a[_0x77a0('0x55')],{'$or':_[_0x77a0('0x49')](_0x22ca7a[_0x77a0('0x4e')],function(_0x3be076){var _0x5e75c4={};_0x5e75c4[_0x3be076]={'$like':'%'+_0x4a72b0[_0x77a0('0x4a')][_0x77a0('0x56')]+'%'};return _0x5e75c4;})});}_0x22ca7a=_['merge']({},_0x22ca7a,_0x4a72b0['options']);return db[_0x77a0('0x6c')]['count']({'where':_0x22ca7a[_0x77a0('0x55')]})[_0x77a0('0x36')](function(_0x3313cf){_0x414df9['count']=_0x3313cf;if(_0x4a72b0[_0x77a0('0x4a')][_0x77a0('0x5b')]){_0x22ca7a[_0x77a0('0x5c')]=[{'all':!![]}];}return db[_0x77a0('0x6c')][_0x77a0('0x5d')](_0x22ca7a);})[_0x77a0('0x36')](function(_0x4e75f2){_0x414df9[_0x77a0('0x5e')]=_0x4e75f2;return _0x414df9;});}})[_0x77a0('0x36')](respondWithFilteredResult(_0x5bc233,_0x22ca7a))[_0x77a0('0x2b')](handleError(_0x5bc233,null));};exports['removeAnswers']=function(_0x3ce7b0,_0x16e65f,_0x4dc9b9){return db[_0x77a0('0x43')]['find']({'where':{'id':_0x3ce7b0[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x16e65f,null))[_0x77a0('0x36')](function(_0x49da14){if(_0x49da14){return _0x49da14[_0x77a0('0x6f')](_0x3ce7b0[_0x77a0('0x4a')]['ids']);}})[_0x77a0('0x36')](respondWithStatusCode(_0x16e65f,null))['catch'](handleError(_0x16e65f,null));};exports[_0x77a0('0x6d')]=function(_0x13bed0,_0x11a3f5){var _0x1c33b3={'name':_0x13bed0[_0x77a0('0x61')][_0x77a0('0x3b')],'key':_0x13bed0['body']['key'],'email':_0x13bed0[_0x77a0('0x61')][_0x77a0('0x70')],'ListId':_0x13bed0[_0x77a0('0x61')][_0x77a0('0x71')],'active':!_[_0x77a0('0x72')](_0x13bed0[_0x77a0('0x61')][_0x77a0('0x73')])?_0x13bed0[_0x77a0('0x61')][_0x77a0('0x73')]:!![],'description':_0x13bed0[_0x77a0('0x61')][_0x77a0('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x77a0('0x72')](_0x13bed0[_0x77a0('0x61')]['cservice'])){if(_0x13bed0[_0x77a0('0x61')][_0x77a0('0x75')]){_0x1c33b3['Imap'][_0x77a0('0x76')]=_0x1c33b3[_0x77a0('0x40')][_0x77a0('0x76')]=_0x13bed0['body'][_0x77a0('0x77')];_0x1c33b3[_0x77a0('0x62')][_0x77a0('0x78')]=_0x1c33b3['Smtp'][_0x77a0('0x79')]=_0x13bed0['body']['cpassword'];}else{_0x1c33b3[_0x77a0('0x62')][_0x77a0('0x7a')]=_0x1c33b3[_0x77a0('0x40')]['authentication']=![];}_0x1c33b3[_0x77a0('0x62')]['host']=_0x13bed0['body'][_0x77a0('0x62')][_0x77a0('0x7b')];_0x1c33b3[_0x77a0('0x62')][_0x77a0('0x7c')]=_0x13bed0[_0x77a0('0x61')][_0x77a0('0x62')][_0x77a0('0x7c')];_0x1c33b3[_0x77a0('0x40')][_0x77a0('0x7b')]=_0x13bed0[_0x77a0('0x61')][_0x77a0('0x40')][_0x77a0('0x7b')];_0x1c33b3[_0x77a0('0x40')]['port']=_0x13bed0[_0x77a0('0x61')]['Smtp'][_0x77a0('0x7c')];}else{_0x1c33b3[_0x77a0('0x62')]['service']=_0x1c33b3[_0x77a0('0x40')][_0x77a0('0x7d')]=_0x13bed0[_0x77a0('0x61')][_0x77a0('0x7e')];_0x1c33b3[_0x77a0('0x62')]['user']=_0x1c33b3[_0x77a0('0x40')][_0x77a0('0x76')]=_0x13bed0['body']['cuser'];_0x1c33b3[_0x77a0('0x62')][_0x77a0('0x78')]=_0x1c33b3[_0x77a0('0x40')][_0x77a0('0x79')]=_0x13bed0[_0x77a0('0x61')][_0x77a0('0x7f')];}return db[_0x77a0('0x43')][_0x77a0('0x6d')](_0x1c33b3,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x77a0('0x3e')],'as':'Imap'}]})[_0x77a0('0x36')](function(_0x5dd342){var _0x1a445d=_0x13bed0['user']['get']({'plain':!![]});if(!_0x1a445d)throw new Error(_0x77a0('0x80'));if(_0x1a445d[_0x77a0('0x81')]===_0x77a0('0x76')){var _0x10add9=_0x5dd342[_0x77a0('0x38')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MailAccounts','userProfileId':_0x1a445d[_0x77a0('0x82')]},'raw':!![]})[_0x77a0('0x36')](function(_0xa132f9){if(_0xa132f9&&_0xa132f9[_0x77a0('0x83')]===0x0){return db[_0x77a0('0x3a')][_0x77a0('0x6d')]({'name':_0x10add9[_0x77a0('0x3b')],'resourceId':_0x10add9['id'],'type':_0xa132f9['name'],'sectionId':_0xa132f9['id']},{})['then'](function(){return _0x5dd342;});}else{return _0x5dd342;}})['catch'](function(_0x448412){logger[_0x77a0('0x28')](_0x77a0('0x84'),_0x448412);throw _0x448412;});}return _0x5dd342;})[_0x77a0('0x36')](respondWithResult(_0x11a3f5,0xc9))[_0x77a0('0x2b')](handleError(_0x11a3f5,null));};exports[_0x77a0('0x85')]=function(_0x22203e,_0x138b63,_0x1108ee){return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0x22203e[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x138b63,null))['then'](function(_0x531fd5){if(_0x531fd5){return _0x531fd5['getImap']();}return null;})[_0x77a0('0x36')](respondWithResult(_0x138b63,null))[_0x77a0('0x2b')](handleError(_0x138b63,null));};exports['addImap']=function(_0x2ddf18,_0x3799f6,_0x40d682){if(_0x2ddf18['body']['id']){delete _0x2ddf18['body']['id'];}return db[_0x77a0('0x43')][_0x77a0('0x60')]({'where':{'id':_0x2ddf18[_0x77a0('0x66')]['id']}})['then'](handleEntityNotFound(_0x3799f6,null))['then'](function(_0x30485a){if(_0x30485a){_0x2ddf18[_0x77a0('0x61')][_0x77a0('0x69')]=_0x30485a['id'];return db[_0x77a0('0x3e')][_0x77a0('0x6d')](_0x2ddf18[_0x77a0('0x61')]);}})[_0x77a0('0x36')](respondWithResult(_0x3799f6,null))['catch'](handleError(_0x3799f6,null));};exports[_0x77a0('0x86')]=function(_0x1d960d,_0x52327b,_0x24c98c){return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0x1d960d[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x52327b,null))[_0x77a0('0x36')](function(_0x4a2c5c){if(_0x4a2c5c){return _0x4a2c5c['setImap'](null);}return null;})[_0x77a0('0x36')](respondWithStatusCode(_0x52327b,null))[_0x77a0('0x2b')](handleError(_0x52327b,null));};exports[_0x77a0('0x87')]=function(_0x6f7b97,_0xda85ee,_0x2ed27f){return db['MailAccount'][_0x77a0('0x67')]({'where':{'id':_0x6f7b97['params']['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0xda85ee,null))['then'](function(_0x39a444){if(_0x39a444){return _0x39a444[_0x77a0('0x87')]();}return null;})[_0x77a0('0x36')](respondWithResult(_0xda85ee,null))['catch'](handleError(_0xda85ee,null));};exports[_0x77a0('0x88')]=function(_0x462a1a,_0x8ca96,_0x3286ef){if(_0x462a1a[_0x77a0('0x61')]['id']){delete _0x462a1a[_0x77a0('0x61')]['id'];}return db[_0x77a0('0x43')][_0x77a0('0x60')]({'where':{'id':_0x462a1a[_0x77a0('0x66')]['id']}})['then'](handleEntityNotFound(_0x8ca96,null))[_0x77a0('0x36')](function(_0x488a76){if(_0x488a76){_0x462a1a[_0x77a0('0x61')][_0x77a0('0x69')]=_0x488a76['id'];return db[_0x77a0('0x3f')]['create'](_0x462a1a[_0x77a0('0x61')]);}})[_0x77a0('0x36')](respondWithResult(_0x8ca96,null))[_0x77a0('0x2b')](handleError(_0x8ca96,null));};exports['removeSmtp']=function(_0x3eaf31,_0xcd369b,_0x383135){return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0x3eaf31[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0xcd369b,null))[_0x77a0('0x36')](function(_0x4753df){if(_0x4753df){return _0x4753df[_0x77a0('0x89')](null);}return null;})[_0x77a0('0x36')](respondWithStatusCode(_0xcd369b,null))[_0x77a0('0x2b')](handleError(_0xcd369b,null));};exports[_0x77a0('0x8a')]=function(_0x447a64,_0x53d87c,_0x2ab9b5){return db[_0x77a0('0x8b')][_0x77a0('0x60')]({'where':{'id':_0x447a64[_0x77a0('0x66')]['id']}})['then'](handleEntityNotFound(_0x53d87c,null))['then'](function(_0xe26036){if(_0xe26036){return _0xe26036[_0x77a0('0x8a')](_0x447a64['body']['ids'],_[_0x77a0('0x8c')](_0x447a64[_0x77a0('0x61')],[_0x77a0('0x6b'),'id'])||{});}})[_0x77a0('0x36')](respondWithResult(_0x53d87c,null))[_0x77a0('0x2b')](handleError(_0x53d87c,null));};exports[_0x77a0('0x8d')]=function(_0xffa68d,_0x4cecb7,_0x44008e){var _0x5cc04b={'raw':![],'where':{}};var _0x22f926={};var _0x36353b={'count':0x0,'rows':[]};return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0xffa68d[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x4cecb7,null))[_0x77a0('0x36')](function(_0x39de95){if(_0x39de95){_0x22f926[_0x77a0('0x48')]=_[_0x77a0('0x4b')](db[_0x77a0('0x8b')][_0x77a0('0x44')]);_0x22f926[_0x77a0('0x4a')]=_[_0x77a0('0x4b')](_0xffa68d[_0x77a0('0x4a')]);_0x22f926[_0x77a0('0x4c')]=_['intersection'](_0x22f926[_0x77a0('0x48')],_0x22f926[_0x77a0('0x4a')]);_0x5cc04b['attributes']=_['intersection'](_0x22f926[_0x77a0('0x48')],qs[_0x77a0('0x4f')](_0xffa68d['query']['fields']));_0x5cc04b['attributes']=_0x5cc04b[_0x77a0('0x4e')][_0x77a0('0x50')]?_0x5cc04b[_0x77a0('0x4e')]:_0x22f926[_0x77a0('0x48')];if(!_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x51')]('nolimit')){_0x5cc04b[_0x77a0('0x30')]=qs['limit'](_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x30')]);_0x5cc04b['offset']=qs[_0x77a0('0x2f')](_0xffa68d[_0x77a0('0x4a')]['offset']);}_0x5cc04b['order']=qs[_0x77a0('0x54')](_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x54')]);_0x5cc04b[_0x77a0('0x55')]=qs[_0x77a0('0x4c')](_[_0x77a0('0x6e')](_0xffa68d[_0x77a0('0x4a')],_0x22f926[_0x77a0('0x4c')]));_0x5cc04b[_0x77a0('0x55')][_0x77a0('0x69')]=_0x39de95['id'];if(_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x56')]){_0x5cc04b[_0x77a0('0x55')]=_[_0x77a0('0x57')](_0x5cc04b['where'],{'$or':_['map'](_0x5cc04b[_0x77a0('0x4e')],function(_0x3402e5){var _0xb485f7={};_0xb485f7[_0x3402e5]={'$like':'%'+_0xffa68d[_0x77a0('0x4a')]['filter']+'%'};return _0xb485f7;})});}_0x5cc04b=_[_0x77a0('0x57')]({},_0x5cc04b,_0xffa68d['options']);return db[_0x77a0('0x8b')][_0x77a0('0x5a')]({'where':_0x5cc04b['where']})[_0x77a0('0x36')](function(_0x3cce1d){_0x36353b['count']=_0x3cce1d;if(_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x5b')]){_0x5cc04b[_0x77a0('0x5c')]=[{'model':db['CmContact'],'as':_0x77a0('0x8e'),'required':![]},{'model':db['User'],'as':_0x77a0('0x8f'),'attributes':[_0x77a0('0x3b'),_0x77a0('0x90'),_0x77a0('0x91')],'required':![]},{'model':db['Tag'],'as':_0x77a0('0x92'),'attributes':['id',_0x77a0('0x3b'),_0x77a0('0x93')],'where':_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x94')]?{'id':_0xffa68d[_0x77a0('0x4a')][_0x77a0('0x94')]}:undefined,'required':_0xffa68d['query'][_0x77a0('0x94')]?!![]:![]}];}return db[_0x77a0('0x8b')]['findAll'](_0x5cc04b);})[_0x77a0('0x36')](function(_0x149752){_0x36353b[_0x77a0('0x5e')]=_0x149752;return _0x36353b;});}})['then'](respondWithFilteredResult(_0x4cecb7,_0x5cc04b))[_0x77a0('0x2b')](handleError(_0x4cecb7,null));};exports[_0x77a0('0x95')]=function(_0x1ee499,_0x1aa728,_0x45b33f){return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0x1ee499['params']['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x1aa728,null))[_0x77a0('0x36')](function(_0x3154b3){if(_0x3154b3){return db[_0x77a0('0x96')][_0x77a0('0x97')](function(_0x1328e1){return db['MailApplication'][_0x77a0('0x37')]({'where':{'MailAccountId':_0x1ee499['params']['id']},'transaction':_0x1328e1})['then'](function(_0x5a024e){var _0x132d7e=_['map'](_0x1ee499[_0x77a0('0x61')],function(_0x3d57f0){_0x3d57f0[_0x77a0('0x69')]=_0x1ee499[_0x77a0('0x66')]['id'];return _0x3d57f0;});return db['MailApplication'][_0x77a0('0x98')](_0x132d7e,{'transaction':_0x1328e1});});})[_0x77a0('0x36')](function(){return db[_0x77a0('0x99')][_0x77a0('0x9a')]({'where':{'MailAccountId':_0x1ee499[_0x77a0('0x66')]['id']},'order':_0x77a0('0x9b')});});}})[_0x77a0('0x36')](respondWithResult(_0x1aa728,null))[_0x77a0('0x2b')](handleError(_0x1aa728,null));};exports[_0x77a0('0x9c')]=function(_0x2e1e07,_0x56f7f8,_0x645d4e){var _0x345be0={};var _0x19f92c={};var _0x2d2426;var _0x3296e6;return db[_0x77a0('0x43')][_0x77a0('0x67')]({'where':{'id':_0x2e1e07[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x56f7f8,null))[_0x77a0('0x36')](function(_0x1837e7){if(_0x1837e7){_0x2d2426=_0x1837e7;_0x19f92c[_0x77a0('0x48')]=_[_0x77a0('0x4b')](db[_0x77a0('0x99')][_0x77a0('0x44')]);_0x19f92c[_0x77a0('0x4a')]=_['keys'](_0x2e1e07[_0x77a0('0x4a')]);_0x19f92c[_0x77a0('0x4c')]=_[_0x77a0('0x4d')](_0x19f92c[_0x77a0('0x48')],_0x19f92c[_0x77a0('0x4a')]);_0x345be0[_0x77a0('0x4e')]=_[_0x77a0('0x4d')](_0x19f92c['model'],qs['fields'](_0x2e1e07[_0x77a0('0x4a')][_0x77a0('0x4f')]));_0x345be0[_0x77a0('0x4e')]=_0x345be0[_0x77a0('0x4e')][_0x77a0('0x50')]?_0x345be0['attributes']:_0x19f92c[_0x77a0('0x48')];_0x345be0[_0x77a0('0x53')]=qs[_0x77a0('0x54')](_0x2e1e07['query'][_0x77a0('0x54')]);_0x345be0[_0x77a0('0x55')]=qs[_0x77a0('0x4c')](_[_0x77a0('0x6e')](_0x2e1e07['query'],_0x19f92c[_0x77a0('0x4c')]));if(_0x2e1e07[_0x77a0('0x4a')]['filter']){_0x345be0[_0x77a0('0x55')]=_[_0x77a0('0x57')](_0x345be0[_0x77a0('0x55')],{'$or':_[_0x77a0('0x49')](_0x345be0[_0x77a0('0x4e')],function(_0x298471){var _0x94d6ab={};_0x94d6ab[_0x298471]={'$like':'%'+_0x2e1e07[_0x77a0('0x4a')][_0x77a0('0x56')]+'%'};return _0x94d6ab;})});}_0x345be0=_[_0x77a0('0x57')]({},_0x345be0,_0x2e1e07[_0x77a0('0x59')]);return _0x2d2426['getApplications'](_0x345be0);}})['then'](function(_0x2b14e2){if(_0x2b14e2){_0x3296e6=_0x2b14e2['length'];if(!_0x2e1e07[_0x77a0('0x4a')]['hasOwnProperty'](_0x77a0('0x52'))){_0x345be0[_0x77a0('0x30')]=qs[_0x77a0('0x30')](_0x2e1e07[_0x77a0('0x4a')][_0x77a0('0x30')]);_0x345be0[_0x77a0('0x2f')]=qs['offset'](_0x2e1e07[_0x77a0('0x4a')][_0x77a0('0x2f')]);}return _0x2d2426[_0x77a0('0x9c')](_0x345be0);}})[_0x77a0('0x36')](function(_0x41d966){if(_0x41d966){return _0x41d966?{'count':_0x3296e6,'rows':_0x41d966}:null;}})['then'](respondWithResult(_0x56f7f8,null))[_0x77a0('0x2b')](handleError(_0x56f7f8,null));};exports[_0x77a0('0x9d')]=function(_0x34256e,_0x91ccd1,_0x2d5e7d){var _0x5bae0e={'raw':!![],'where':{}};var _0x1516e2={};var _0x4fc166={'count':0x0,'rows':[]};return db['MailAccount'][_0x77a0('0x67')]({'where':{'id':_0x34256e['params']['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x91ccd1,null))[_0x77a0('0x36')](function(_0xf1eb44){if(_0xf1eb44){_0x1516e2[_0x77a0('0x48')]=_[_0x77a0('0x4b')](db[_0x77a0('0x9e')][_0x77a0('0x44')]);_0x1516e2[_0x77a0('0x4a')]=_['keys'](_0x34256e[_0x77a0('0x4a')]);_0x1516e2['filters']=_['intersection'](_0x1516e2[_0x77a0('0x48')],_0x1516e2[_0x77a0('0x4a')]);_0x5bae0e[_0x77a0('0x4e')]=_['intersection'](_0x1516e2[_0x77a0('0x48')],qs[_0x77a0('0x4f')](_0x34256e['query'][_0x77a0('0x4f')]));_0x5bae0e[_0x77a0('0x4e')]=_0x5bae0e[_0x77a0('0x4e')]['length']?_0x5bae0e[_0x77a0('0x4e')]:_0x1516e2['model'];if(!_0x34256e[_0x77a0('0x4a')][_0x77a0('0x51')](_0x77a0('0x52'))){_0x5bae0e[_0x77a0('0x30')]=qs[_0x77a0('0x30')](_0x34256e[_0x77a0('0x4a')][_0x77a0('0x30')]);_0x5bae0e[_0x77a0('0x2f')]=qs[_0x77a0('0x2f')](_0x34256e['query']['offset']);}_0x5bae0e[_0x77a0('0x53')]=qs['sort'](_0x34256e['query']['sort']);_0x5bae0e[_0x77a0('0x55')]=qs['filters'](_[_0x77a0('0x6e')](_0x34256e[_0x77a0('0x4a')],_0x1516e2[_0x77a0('0x4c')]));_0x5bae0e['where'][_0x77a0('0x69')]=_0xf1eb44['id'];if(_0x34256e[_0x77a0('0x4a')]['filter']){_0x5bae0e[_0x77a0('0x55')]=_[_0x77a0('0x57')](_0x5bae0e[_0x77a0('0x55')],{'$or':_[_0x77a0('0x49')](_0x5bae0e[_0x77a0('0x4e')],function(_0x32cd20){var _0x2ec352={};_0x2ec352[_0x32cd20]={'$like':'%'+_0x34256e[_0x77a0('0x4a')][_0x77a0('0x56')]+'%'};return _0x2ec352;})});}if(_0x34256e['query'][_0x77a0('0x9f')]){var _0xcc867f=_0x34256e[_0x77a0('0x4a')]['$gte']['split'](',');var _0xedb497={};_0xedb497[_0xcc867f[0x0]]={'$gte':moment(_0xcc867f[0x1])[_0x77a0('0xa0')](_0x77a0('0xa1'))};_0x5bae0e[_0x77a0('0x55')]=_['merge'](_0x5bae0e[_0x77a0('0x55')],_0xedb497);}_0x5bae0e=_[_0x77a0('0x57')]({},_0x5bae0e,_0x34256e['options']);return db[_0x77a0('0x9e')][_0x77a0('0x5a')]({'where':_0x5bae0e[_0x77a0('0x55')]})[_0x77a0('0x36')](function(_0x4ac4ca){_0x4fc166[_0x77a0('0x5a')]=_0x4ac4ca;if(_0x34256e[_0x77a0('0x4a')]['includeAll']){_0x5bae0e['include']=[{'all':!![]}];}return db['MailMessage'][_0x77a0('0x5d')](_0x5bae0e);})[_0x77a0('0x36')](function(_0x491e5b){_0x4fc166['rows']=_0x491e5b;return _0x4fc166;});}})[_0x77a0('0x36')](respondWithFilteredResult(_0x91ccd1,_0x5bae0e))[_0x77a0('0x2b')](handleError(_0x91ccd1,null));};exports['send']=function(_0xf63051,_0x17b3f0,_0x13cf15){var _0x4999f9,_0x562fb5={},_0x9f2593;if(_0xf63051[_0x77a0('0x61')]['to']){_0x9f2593=_0xf63051[_0x77a0('0x61')]['to']['split'](',')[0x0];}return db[_0x77a0('0x43')]['find']({'where':{'id':_0xf63051[_0x77a0('0x66')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x77a0('0xa2')],'as':_0x77a0('0xa3'),'where':{'email':_0x9f2593},'limit':0x1,'order':[[_0x77a0('0xa4'),_0x77a0('0xa5')]]}]},{'model':db[_0x77a0('0x3f')],'as':_0x77a0('0x40'),'raw':!![]}]})[_0x77a0('0x36')](handleEntityNotFound(_0x17b3f0,null))[_0x77a0('0x36')](function(_0x307e4b){if(_0x307e4b){_0x4999f9=_0x307e4b;if(_0x307e4b[_0x77a0('0x40')]){if(_[_0x77a0('0x72')](_0xf63051[_0x77a0('0x61')][_0x77a0('0xa6')])){_0xf63051['body'][_0x77a0('0xa6')]=util[_0x77a0('0xa0')](_0x77a0('0xa7'),_0x307e4b[_0x77a0('0x3b')],_0x307e4b['email']||_0x307e4b['Smtp'][_0x77a0('0x76')]);}if(_0xf63051[_0x77a0('0x61')][_0x77a0('0xa8')]&&_0xf63051[_0x77a0('0x61')][_0x77a0('0xa8')][_0x77a0('0x50')]){for(var _0x56d002=0x0;_0x56d002<_0xf63051[_0x77a0('0x61')][_0x77a0('0xa8')][_0x77a0('0x50')];_0x56d002+=0x1){_0xf63051[_0x77a0('0x61')][_0x77a0('0xa8')][_0x56d002]={'filename':_0xf63051[_0x77a0('0x61')][_0x77a0('0xa8')][_0x56d002][_0x77a0('0x3b')],'path':path[_0x77a0('0xa9')](config['root'],_0x77a0('0xaa'),_0xf63051[_0x77a0('0x61')]['attachments'][_0x56d002]['basename'])};}}var _0xc2a927={'tls':{'rejectUnauthorized':![]}};if(_[_0x77a0('0x72')](_0x307e4b[_0x77a0('0x40')]['service'])){if(_0x307e4b[_0x77a0('0x40')][_0x77a0('0x7a')]){_0xc2a927[_0x77a0('0xab')]={'user':_0x307e4b[_0x77a0('0x40')]['user'],'pass':_0x307e4b[_0x77a0('0x40')][_0x77a0('0x79')]};}_0xc2a927[_0x77a0('0x7b')]=_0x307e4b[_0x77a0('0x40')][_0x77a0('0x7b')];_0xc2a927[_0x77a0('0x7c')]=_0x307e4b[_0x77a0('0x40')][_0x77a0('0x7c')];_0xc2a927['secure']=_0x307e4b[_0x77a0('0x40')]['secure'];}else{_0xc2a927['service']=_0x307e4b[_0x77a0('0x40')][_0x77a0('0x7d')];_0xc2a927[_0x77a0('0xab')]={'user':_0x307e4b[_0x77a0('0x40')][_0x77a0('0x76')],'pass':_0x307e4b[_0x77a0('0x40')][_0x77a0('0x79')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0xc2a927,'message':_0xf63051[_0x77a0('0x61')]});}else{throw new Error(_0x77a0('0xac'));}}})[_0x77a0('0x36')](function(_0x41ff78){if(_0x41ff78){_0x562fb5=_0x41ff78;if(_0x4999f9[_0x77a0('0xad')]){if(_0x4999f9['List']['Contacts'][_0x77a0('0x50')]){return _0x4999f9[_0x77a0('0xad')][_0x77a0('0xa3')][0x0];}else{return db[_0x77a0('0xa2')][_0x77a0('0x6d')](_[_0x77a0('0xae')](_0xf63051[_0x77a0('0x61')],{'firstName':_0xf63051[_0x77a0('0x61')]['to'],'email':_0xf63051[_0x77a0('0x61')]['to'],'phone':_0xf63051['body']['to'],'ListId':_0x4999f9['ListId']}));}}else{throw new Error(_0x77a0('0xac'));}}})[_0x77a0('0x36')](function(_0x413b61){if(_0x413b61){var _0x5eded3={'UserId':_0xf63051[_0x77a0('0x76')]['id'],'ContactId':_0x413b61['id'],'MailAccountId':_0x4999f9['id'],'inReplyTo':_0x562fb5[_0x77a0('0xaf')],'to':_0xf63051[_0x77a0('0x61')][_0x77a0('0xa6')],'cc':_0xf63051[_0x77a0('0x61')]['cc'],'subject':_0xf63051[_0x77a0('0x61')][_0x77a0('0xb0')],'attach':_0xf63051[_0x77a0('0x61')]['attach'],'firstMsgDirection':_0x77a0('0xb1'),'lastMsgAt':moment()[_0x77a0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0xf63051[_0x77a0('0x61')]['body'],'Messages':[_[_0x77a0('0x57')](_0xf63051['body'],{'messageId':_0x562fb5[_0x77a0('0xaf')],'sentAt':moment()[_0x77a0('0xa0')](_0x77a0('0xa1')),'read':!![],'MailAccountId':_0x4999f9['id'],'UserId':_0xf63051['user']['id'],'ContactId':_0x413b61['id']})]};if(_0xf63051[_0x77a0('0x61')][_0x77a0('0xb2')]){_0x5eded3=_[_0x77a0('0x57')](_0x5eded3,_0xf63051[_0x77a0('0x61')]['Interaction']);}return db[_0x77a0('0x8b')][_0x77a0('0x6d')](_0x5eded3,{'include':[{'model':db[_0x77a0('0x9e')],'as':'Messages'}]});}})[_0x77a0('0x36')](respondWithResult(_0x17b3f0,null))[_0x77a0('0x2b')](handleError(_0x17b3f0,null));};exports[_0x77a0('0xb3')]=function(_0x54e861,_0x98797e,_0x2df6c2){return db[_0x77a0('0x43')][_0x77a0('0x60')]({'where':{'id':_0x54e861[_0x77a0('0x66')]['id']},'include':[{'model':db[_0x77a0('0x3f')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x98797e,null))['then'](function(_0x39136e){if(_0x39136e&&_0x39136e[_0x77a0('0x40')]){var _0x38d8cb={'id':_0x39136e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39136e[_0x77a0('0x40')][_0x77a0('0x7d')]){_0x38d8cb['service']=_0x39136e[_0x77a0('0x40')][_0x77a0('0x7d')];}else{_0x38d8cb[_0x77a0('0x7b')]=_0x39136e['Smtp'][_0x77a0('0x7b')];_0x38d8cb[_0x77a0('0x7c')]=_0x39136e[_0x77a0('0x40')][_0x77a0('0x7c')];_0x38d8cb[_0x77a0('0xb4')]=_0x39136e[_0x77a0('0x40')]['secure'];}if(_0x39136e['Smtp'][_0x77a0('0x7a')]){_0x38d8cb[_0x77a0('0xab')]={'user':_0x39136e[_0x77a0('0x40')][_0x77a0('0x76')],'pass':_0x39136e[_0x77a0('0x40')][_0x77a0('0x79')]};}return respondWithRpcPromise(_0x77a0('0xb5'),_0x77a0('0xb3'),{'account':_0x38d8cb});}})[_0x77a0('0x36')](respondWithResult(_0x98797e,null))[_0x77a0('0x2b')](handleError(_0x98797e,null));};exports[_0x77a0('0x37')]=function(_0x443f91,_0x120d89){return db[_0x77a0('0x43')]['find']({'where':{'id':_0x443f91[_0x77a0('0x66')]['id']}})['then'](handleEntityNotFound(_0x120d89,null))[_0x77a0('0x36')](function(_0x58f30f){if(_0x58f30f&&_0x58f30f[_0x77a0('0x7d')]){throw new db[(_0x77a0('0xb6'))][(_0x77a0('0xb7'))](_0x77a0('0xb8'));}return _0x58f30f;})['then'](removeEntity(_0x120d89,null))[_0x77a0('0x2b')](handleError(_0x120d89,null));};exports[_0x77a0('0xb9')]=function(_0x338734,_0x22afa8,_0x4b58f2){return db['MailAccount']['find']({'where':{'id':_0x338734[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x22afa8,null))[_0x77a0('0x36')](function(_0x5f27b8){if(_0x5f27b8){return _0x5f27b8['addAgents'](_0x338734[_0x77a0('0x61')][_0x77a0('0x6b')],_[_0x77a0('0x8c')](_0x338734[_0x77a0('0x61')],[_0x77a0('0x6b'),'id'])||{})[_0x77a0('0xba')](function(_0x26d6b7){for(var _0x42adfa=0x0;_0x42adfa<_0x338734[_0x77a0('0x61')][_0x77a0('0x6b')][_0x77a0('0x50')];_0x42adfa+=0x1){socket[_0x77a0('0xbb')](_0x77a0('0xbc'),{'UserId':_0x338734['body']['ids'][_0x42adfa],'MailAccountId':_0x338734[_0x77a0('0x66')]['id']});}return _0x26d6b7;});}})[_0x77a0('0x36')](respondWithResult(_0x22afa8,null))[_0x77a0('0x2b')](handleError(_0x22afa8,null));};exports[_0x77a0('0xbd')]=function(_0x56ff27,_0x995b2a,_0xa0f408){return db[_0x77a0('0x43')][_0x77a0('0x60')]({'where':{'id':_0x56ff27[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x995b2a,null))[_0x77a0('0x36')](function(_0x1e4f14){if(_0x1e4f14){return _0x1e4f14[_0x77a0('0xbd')](_0x56ff27[_0x77a0('0x4a')][_0x77a0('0x6b')])[_0x77a0('0x36')](function(){if(_[_0x77a0('0xbe')](_0x56ff27['query'][_0x77a0('0x6b')])){for(var _0x27101d=0x0;_0x27101d<_0x56ff27[_0x77a0('0x4a')][_0x77a0('0x6b')][_0x77a0('0x50')];_0x27101d+=0x1){socket[_0x77a0('0xbb')](_0x77a0('0xbf'),{'UserId':Number(_0x56ff27[_0x77a0('0x4a')][_0x77a0('0x6b')][_0x27101d]),'MailAccountId':Number(_0x56ff27[_0x77a0('0x66')]['id'])});}}else{socket[_0x77a0('0xbb')](_0x77a0('0xbf'),{'UserId':Number(_0x56ff27[_0x77a0('0x4a')][_0x77a0('0x6b')]),'MailAccountId':Number(_0x56ff27[_0x77a0('0x66')]['id'])});}});}})[_0x77a0('0x36')](respondWithStatusCode(_0x995b2a,null))[_0x77a0('0x2b')](handleError(_0x995b2a,null));};exports['getAgents']=function(_0x60631e,_0x248369,_0x2e7689){var _0x2b86ce={};var _0x105599={};var _0x436dcc;var _0x4a3d4b;return db['MailAccount'][_0x77a0('0x67')]({'where':{'id':_0x60631e[_0x77a0('0x66')]['id']}})[_0x77a0('0x36')](handleEntityNotFound(_0x248369,null))[_0x77a0('0x36')](function(_0x407551){if(_0x407551){_0x436dcc=_0x407551;_0x105599[_0x77a0('0x48')]=_[_0x77a0('0x4b')](db[_0x77a0('0xc0')][_0x77a0('0x44')]);_0x105599['query']=_[_0x77a0('0x4b')](_0x60631e[_0x77a0('0x4a')]);_0x105599[_0x77a0('0x4c')]=_[_0x77a0('0x4d')](_0x105599[_0x77a0('0x48')],_0x105599['query']);_0x2b86ce[_0x77a0('0x4e')]=_['intersection'](_0x105599[_0x77a0('0x48')],qs[_0x77a0('0x4f')](_0x60631e[_0x77a0('0x4a')]['fields']));_0x2b86ce[_0x77a0('0x4e')]=_0x2b86ce[_0x77a0('0x4e')]['length']?_0x2b86ce[_0x77a0('0x4e')]:_0x105599['model'];_0x2b86ce[_0x77a0('0x53')]=qs['sort'](_0x60631e['query'][_0x77a0('0x54')]);_0x2b86ce[_0x77a0('0x55')]=qs['filters'](_[_0x77a0('0x6e')](_0x60631e[_0x77a0('0x4a')],_0x105599[_0x77a0('0x4c')]));if(_0x60631e['query'][_0x77a0('0x56')]){_0x2b86ce[_0x77a0('0x55')]=_[_0x77a0('0x57')](_0x2b86ce[_0x77a0('0x55')],{'$or':_[_0x77a0('0x49')](_0x2b86ce[_0x77a0('0x4e')],function(_0x11ea13){var _0x2d9abd={};_0x2d9abd[_0x11ea13]={'$like':'%'+_0x60631e[_0x77a0('0x4a')][_0x77a0('0x56')]+'%'};return _0x2d9abd;})});}_0x2b86ce=_[_0x77a0('0x57')]({},_0x2b86ce,_0x60631e[_0x77a0('0x59')]);return _0x436dcc['getAgents'](_0x2b86ce);}})[_0x77a0('0x36')](function(_0x42768e){if(_0x42768e){_0x4a3d4b=_0x42768e[_0x77a0('0x50')];if(!_0x60631e[_0x77a0('0x4a')][_0x77a0('0x51')]('nolimit')){_0x2b86ce[_0x77a0('0x30')]=qs[_0x77a0('0x30')](_0x60631e[_0x77a0('0x4a')]['limit']);_0x2b86ce['offset']=qs[_0x77a0('0x2f')](_0x60631e[_0x77a0('0x4a')][_0x77a0('0x2f')]);}return _0x436dcc[_0x77a0('0xc1')](_0x2b86ce);}})['then'](function(_0x15634a){if(_0x15634a){return _0x15634a?{'count':_0x4a3d4b,'rows':_0x15634a}:null;}})[_0x77a0('0x36')](respondWithResult(_0x248369,null))[_0x77a0('0x2b')](handleError(_0x248369,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 92c8ca8..fa660f4 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 _0x862b=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','MailAccount'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x862b,0x14a));var _0xb862=function(_0x54c0c2,_0x1df456){_0x54c0c2=_0x54c0c2-0x0;var _0xa21e55=_0x862b[_0x54c0c2];return _0xa21e55;};'use strict';var EventEmitter=require(_0xb862('0x0'));var MailAccount=require(_0xb862('0x1'))['db'][_0xb862('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb862('0x3')](0x0);var events={'afterCreate':_0xb862('0x4'),'afterUpdate':_0xb862('0x5'),'afterDestroy':_0xb862('0x6')};function emitEvent(_0x14d4ed){return function(_0xea753e,_0x5338e0,_0x53b700){MailAccountEvents[_0xb862('0x7')](_0x14d4ed+':'+_0xea753e['id'],_0xea753e);MailAccountEvents[_0xb862('0x7')](_0x14d4ed,_0xea753e);_0x53b700(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb862('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xb4ef=['../../mysqldb','MailAccount','save','remove','emit','hook','exports','events'];(function(_0x526623,_0x5b5bd7){var _0x555f18=function(_0xc98eed){while(--_0xc98eed){_0x526623['push'](_0x526623['shift']());}};_0x555f18(++_0x5b5bd7);}(_0xb4ef,0xbf));var _0xfb4e=function(_0x46f634,_0x3b47e6){_0x46f634=_0x46f634-0x0;var _0x5f2308=_0xb4ef[_0x46f634];return _0x5f2308;};'use strict';var EventEmitter=require(_0xfb4e('0x0'));var MailAccount=require(_0xfb4e('0x1'))['db'][_0xfb4e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb4e('0x3'),'afterUpdate':'update','afterDestroy':_0xfb4e('0x4')};function emitEvent(_0x142366){return function(_0x36cb52,_0x34ba33,_0x903a63){MailAccountEvents['emit'](_0x142366+':'+_0x36cb52['id'],_0x36cb52);MailAccountEvents[_0xfb4e('0x5')](_0x142366,_0x36cb52);_0x903a63(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xfb4e('0x6')](e,emitEvent(event));}}module[_0xfb4e('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e77a299..b624c80 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 _0x3695=['MailAccount','mail_accounts','lodash','../../config/logger','path','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x5d19f6,_0x57051c){var _0x165b11=function(_0x54c351){while(--_0x54c351){_0x5d19f6['push'](_0x5d19f6['shift']());}};_0x165b11(++_0x57051c);}(_0x3695,0x1df));var _0x5369=function(_0x40fa17,_0x20778f){_0x40fa17=_0x40fa17-0x0;var _0x3f63c6=_0x3695[_0x40fa17];return _0x3f63c6;};'use strict';var _=require(_0x5369('0x0'));var util=require('util');var logger=require(_0x5369('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5369('0x2'));var rimraf=require('rimraf');var config=require(_0x5369('0x3'));var attributes=require(_0x5369('0x4'));module[_0x5369('0x5')]=function(_0xa78a07,_0x424455){return _0xa78a07[_0x5369('0x6')](_0x5369('0x7'),attributes,{'tableName':_0x5369('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8868=['./mailAccount.attributes','define','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x8868,0x1ca));var _0x8886=function(_0x457d88,_0x5174b4){_0x457d88=_0x457d88-0x0;var _0x474ff6=_0x8868[_0x457d88];return _0x474ff6;};'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')]('MailAccount',attributes,{'tableName':_0x8886('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 ea7b202..b10ca4e 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 _0xcff8=['omit','applications','Applications','list','priority','autoclose','push','length','close','CmContact','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','interaction','created','attachments','originCc','bcc','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','limit','include','map','attributes','model','ShowMailAccount','where','catch','NotifyMailAccount','body','mail','difference','keys','rawAttributes','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Contacts','updatedAt','MailApplication','MailServerOut','get','account'];(function(_0x39be59,_0x28082d){var _0x241f8e=function(_0x208cf1){while(--_0x208cf1){_0x39be59['push'](_0x39be59['shift']());}};_0x241f8e(++_0x28082d);}(_0xcff8,0x14b));var _0x8cff=function(_0x5dfd85,_0x12a66c){_0x5dfd85=_0x5dfd85-0x0;var _0x13da34=_0xcff8[_0x5dfd85];return _0x13da34;};'use strict';var _=require(_0x8cff('0x0'));var util=require('util');var moment=require(_0x8cff('0x1'));var BPromise=require(_0x8cff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cff('0x3'));var db=require(_0x8cff('0x4'))['db'];var utils=require(_0x8cff('0x5'));var logger=require(_0x8cff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8cff('0x7')]({'port':0x232c});config[_0x8cff('0x8')]=_[_0x8cff('0x9')](config[_0x8cff('0x8')],{'host':_0x8cff('0xa'),'port':0x18eb});var socket=require(_0x8cff('0xb'))(new Redis(config[_0x8cff('0x8')]));require('./mailAccount.socket')[_0x8cff('0xc')](socket);function respondWithRpcPromise(_0x22380d,_0x38ec85,_0x159fc5){return new BPromise(function(_0x506e4a,_0xff9574){return client[_0x8cff('0xd')](_0x22380d,_0x159fc5)[_0x8cff('0xe')](function(_0x1cf90e){logger[_0x8cff('0xf')]('MailAccount,\x20%s,\x20%s',_0x38ec85,_0x8cff('0x10'));logger[_0x8cff('0x11')](_0x8cff('0x12'),_0x38ec85,_0x8cff('0x10'),JSON[_0x8cff('0x13')](_0x1cf90e));if(_0x1cf90e['error']){if(_0x1cf90e[_0x8cff('0x14')]['code']===0x1f4){logger[_0x8cff('0x14')](_0x8cff('0x15'),_0x38ec85,_0x1cf90e[_0x8cff('0x14')][_0x8cff('0x16')]);return _0xff9574(_0x1cf90e[_0x8cff('0x14')][_0x8cff('0x16')]);}logger[_0x8cff('0x14')](_0x8cff('0x15'),_0x38ec85,_0x1cf90e[_0x8cff('0x14')][_0x8cff('0x16')]);return _0x506e4a(_0x1cf90e[_0x8cff('0x14')][_0x8cff('0x16')]);}else{logger[_0x8cff('0xf')](_0x8cff('0x15'),_0x38ec85,'request\x20sent');_0x506e4a(_0x1cf90e[_0x8cff('0x17')]['message']);}})['catch'](function(_0x52ce70){logger[_0x8cff('0x14')]('MailAccount,\x20%s,\x20%s',_0x38ec85,_0x52ce70);_0xff9574(_0x52ce70);});});}exports[_0x8cff('0x18')]=function(_0x3cd89a){var _0x62b489=this;return new Promise(function(_0x1b3b49,_0x594a1d){return db[_0x8cff('0x19')][_0x8cff('0x1a')]({'raw':_0x3cd89a[_0x8cff('0x1b')]?_0x3cd89a[_0x8cff('0x1b')][_0x8cff('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cd89a[_0x8cff('0x1b')]?_0x3cd89a[_0x8cff('0x1b')]['where']||null:null,'attributes':_0x3cd89a[_0x8cff('0x1b')]?_0x3cd89a[_0x8cff('0x1b')]['attributes']||null:null,'limit':_0x3cd89a['options']?_0x3cd89a['options'][_0x8cff('0x1d')]||null:null,'include':_0x3cd89a[_0x8cff('0x1b')]?_0x3cd89a[_0x8cff('0x1b')][_0x8cff('0x1e')]?_[_0x8cff('0x1f')](_0x3cd89a[_0x8cff('0x1b')][_0x8cff('0x1e')],function(_0x149fe5){return{'model':db[_0x149fe5['model']],'as':_0x149fe5['as'],'attributes':_0x149fe5[_0x8cff('0x20')],'include':_0x149fe5['include']?_[_0x8cff('0x1f')](_0x149fe5[_0x8cff('0x1e')],function(_0x30ebab){return{'model':db[_0x30ebab[_0x8cff('0x21')]],'as':_0x30ebab['as'],'attributes':_0x30ebab[_0x8cff('0x20')],'include':_0x30ebab[_0x8cff('0x1e')]?_[_0x8cff('0x1f')](_0x30ebab[_0x8cff('0x1e')],function(_0x2f36c6){return{'model':db[_0x2f36c6[_0x8cff('0x21')]],'as':_0x2f36c6['as'],'attributes':_0x2f36c6[_0x8cff('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8cff('0xe')](function(_0x5248d2){logger['info'](_0x8cff('0x18'),_0x3cd89a);logger[_0x8cff('0x11')](_0x8cff('0x18'),_0x3cd89a,JSON[_0x8cff('0x13')](_0x5248d2));_0x1b3b49(_0x5248d2);})['catch'](function(_0x4d1313){logger['error'](_0x8cff('0x18'),_0x4d1313['message'],_0x3cd89a);_0x594a1d(_0x62b489[_0x8cff('0x14')](0x1f4,_0x4d1313['message']));});});};exports[_0x8cff('0x22')]=function(_0x4da26a){var _0x576718=this;return new Promise(function(_0x22c21d,_0x4f1f44){return db[_0x8cff('0x19')]['find']({'raw':_0x4da26a[_0x8cff('0x1b')]?_0x4da26a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4da26a[_0x8cff('0x1b')]?_0x4da26a[_0x8cff('0x1b')][_0x8cff('0x23')]||null:null,'attributes':_0x4da26a[_0x8cff('0x1b')]?_0x4da26a[_0x8cff('0x1b')][_0x8cff('0x20')]||null:null,'include':_0x4da26a[_0x8cff('0x1b')]?_0x4da26a[_0x8cff('0x1b')][_0x8cff('0x1e')]?_[_0x8cff('0x1f')](_0x4da26a[_0x8cff('0x1b')]['include'],function(_0x37ee0d){return{'model':db[_0x37ee0d[_0x8cff('0x21')]],'as':_0x37ee0d['as'],'attributes':_0x37ee0d['attributes'],'include':_0x37ee0d[_0x8cff('0x1e')]?_[_0x8cff('0x1f')](_0x37ee0d[_0x8cff('0x1e')],function(_0x265f6f){return{'model':db[_0x265f6f[_0x8cff('0x21')]],'as':_0x265f6f['as'],'attributes':_0x265f6f['attributes'],'include':_0x265f6f[_0x8cff('0x1e')]?_['map'](_0x265f6f[_0x8cff('0x1e')],function(_0x2ea65f){return{'model':db[_0x2ea65f[_0x8cff('0x21')]],'as':_0x2ea65f['as'],'attributes':_0x2ea65f[_0x8cff('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x542bdf){logger['info'](_0x8cff('0x22'),_0x4da26a);logger[_0x8cff('0x11')](_0x8cff('0x22'),_0x4da26a,JSON[_0x8cff('0x13')](_0x542bdf));_0x22c21d(_0x542bdf);})[_0x8cff('0x24')](function(_0x420bf1){logger[_0x8cff('0x14')]('ShowMailAccount',_0x420bf1[_0x8cff('0x16')],_0x4da26a);_0x4f1f44(_0x576718['error'](0x1f4,_0x420bf1[_0x8cff('0x16')]));});});};exports[_0x8cff('0x25')]=function(_0x123b9f){var _0x23d55d=this;return new Promise(function(_0x545948,_0x421383){var _0x348dbf={'body':_0x123b9f[_0x8cff('0x26')],'channel':_0x8cff('0x27')};var _0x4d7f23=_[_0x8cff('0x28')](_[_0x8cff('0x29')](db['CmContact'][_0x8cff('0x2a')]),['createdAt','updatedAt',_0x8cff('0x2b'),_0x8cff('0x2c')]);var _0x2fca27=![];if(_0x123b9f[_0x8cff('0x26')]['id']){delete _0x123b9f[_0x8cff('0x26')]['id'];}if(_['isNil'](_0x123b9f[_0x8cff('0x26')][_0x8cff('0x2d')])){return _0x421383(_0x23d55d[_0x8cff('0x14')](0x1f4,_0x8cff('0x2e')));}if(_[_0x8cff('0x2f')](_0x123b9f['body']['body'])||_0x123b9f[_0x8cff('0x26')]['body']===''){return _0x421383(_0x23d55d['error'](0x1f4,_0x8cff('0x30')));}if(_['isNil'](_0x123b9f[_0x8cff('0x26')][_0x8cff('0x31')])){return _0x421383(_0x23d55d[_0x8cff('0x14')](0x1f4,_0x8cff('0x32')+_0x4d7f23));}if(!_[_0x8cff('0x33')](_0x4d7f23,_0x123b9f['body'][_0x8cff('0x31')])){return _0x421383(_0x23d55d['error'](0x1f4,_0x8cff('0x34')+_0x4d7f23));}var _0x13d915={};_0x13d915[_0x123b9f[_0x8cff('0x26')]['mapKey']]=_0x123b9f[_0x8cff('0x26')][_0x8cff('0x2d')];return db['MailAccount'][_0x8cff('0x35')]({'where':{'id':_0x123b9f['account']['id']},'include':[{'model':db['CmList'],'as':_0x8cff('0x36'),'include':[{'model':db['CmContact'],'as':_0x8cff('0x37'),'where':_0x13d915,'limit':0x1,'order':[[_0x8cff('0x38'),'DESC']]}]},{'model':db[_0x8cff('0x39')],'as':'Applications'},{'model':db[_0x8cff('0x3a')],'as':'Smtp'}]})['then'](function(_0x5b9843){if(_0x5b9843&&_0x5b9843[_0x8cff('0x36')]){var _0x2831bb=_0x5b9843[_0x8cff('0x3b')]({'plain':!![]});_0x348dbf[_0x8cff('0x3c')]=_[_0x8cff('0x3d')](_0x2831bb,['Applications',_0x8cff('0x36')]);_0x348dbf[_0x8cff('0x3e')]=_0x2831bb[_0x8cff('0x3f')];_0x348dbf[_0x8cff('0x40')]=_0x2831bb['List'];_0x348dbf[_0x8cff('0x3e')]=_['orderBy'](_0x348dbf[_0x8cff('0x3e')],[_0x8cff('0x41')],['asc']);if(_0x348dbf[_0x8cff('0x3c')]&&_0x348dbf[_0x8cff('0x3c')][_0x8cff('0x42')]){_0x348dbf['applications'][_0x8cff('0x43')]({'id':0x0,'priority':_0x348dbf['applications'][_0x8cff('0x44')]+0x1,'app':_0x8cff('0x45'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x348dbf['account']['Applications']){delete _0x348dbf['account']['Applications'];}if(_0x348dbf[_0x8cff('0x3c')][_0x8cff('0x36')]){delete _0x348dbf['account'][_0x8cff('0x36')];}if(_0x2831bb[_0x8cff('0x36')][_0x8cff('0x37')][_0x8cff('0x44')]){return _0x2831bb[_0x8cff('0x36')][_0x8cff('0x37')][0x0];}var _0x54644d=_['defaults'](_0x123b9f[_0x8cff('0x26')],{'firstName':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x2d')],'ListId':_0x2831bb[_0x8cff('0x2c')]});_0x54644d[_0x123b9f[_0x8cff('0x26')][_0x8cff('0x31')]]=_0x123b9f[_0x8cff('0x26')]['from'];return db[_0x8cff('0x46')][_0x8cff('0x47')](_0x54644d);}else{throw new Error(_0x8cff('0x48'));}})[_0x8cff('0xe')](function(_0x57e63a){_0x348dbf[_0x8cff('0x49')]=_0x57e63a;if(_0x57e63a){if(!_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x4a')]){_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x4a')]=rs['generate']()+'\x20'+_0x123b9f[_0x8cff('0x26')]['message'][_0x8cff('0x2d')];}var _0x5aaa06={'ContactId':_0x57e63a['id'],'MailAccountId':_0x123b9f[_0x8cff('0x3c')]['id'],'inReplyTo':_0x123b9f['body'][_0x8cff('0x16')][_0x8cff('0x4a')],'to':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x2d')],'cc':_0x123b9f['body'][_0x8cff('0x16')]['cc'],'subject':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x4b')],'attach':_0x123b9f['body'][_0x8cff('0x16')][_0x8cff('0x4c')],'lastMsgAt':moment()[_0x8cff('0x4d')](_0x8cff('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x123b9f[_0x8cff('0x26')]['body']};return db['MailInteraction'][_0x8cff('0x35')]({'where':{'closed':![],'MailAccountId':_0x123b9f[_0x8cff('0x3c')]['id']},'include':[{'model':db[_0x8cff('0x4f')],'as':_0x8cff('0x50'),'attributes':[_0x8cff('0x4a')],'where':{'messageId':_0x123b9f[_0x8cff('0x26')]['message'][_0x8cff('0x51')]}}]})[_0x8cff('0xe')](function(_0x5e187b){if(_0x5e187b){return[_0x5e187b,![]];}return db['MailInteraction'][_0x8cff('0x47')](_0x5aaa06)[_0x8cff('0xe')](function(_0x3bc1a8){return[_0x3bc1a8,!![]];});});}else{throw new Error(_0x8cff('0x52'));}})[_0x8cff('0x53')](function(_0x23176d,_0x5988d9){if(_0x23176d){_0x2fca27=_0x5988d9;if(!_0x5988d9){return _0x23176d['update']({'inReplyTo':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x4a')],'to':_0x123b9f['body'][_0x8cff('0x16')][_0x8cff('0x2d')],'cc':_0x123b9f['body']['message']['cc'],'subject':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')]['subject'],'attach':_0x23176d['attach']?_0x23176d[_0x8cff('0x4c')]:_0x123b9f['body'][_0x8cff('0x16')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x8cff('0x4e')),'lastMsgAt':moment()['format'](_0x8cff('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x123b9f[_0x8cff('0x26')]['body']});}else{return _0x23176d;}}})[_0x8cff('0xe')](function(_0x3ab944){_0x348dbf[_0x8cff('0x54')]=_0x3ab944[_0x8cff('0x3b')]({'plain':!![]});_0x348dbf[_0x8cff('0x54')][_0x8cff('0x55')]=_0x2fca27;return db[_0x8cff('0x4f')][_0x8cff('0x47')]({'body':_0x123b9f['body']['body'],'MailAccountId':_0x123b9f[_0x8cff('0x3c')]['id'],'MailInteractionId':_0x3ab944['id'],'direction':'in','ContactId':_0x348dbf['contact']['id'],'messageId':_0x123b9f['body'][_0x8cff('0x16')][_0x8cff('0x4a')],'from':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x2d')],'to':_0x123b9f['body']['message']['to'],'cc':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')]['cc'],'subject':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x4b')],'attach':_0x123b9f[_0x8cff('0x26')]['message'][_0x8cff('0x4c')],'Attachments':_0x123b9f['body'][_0x8cff('0x16')][_0x8cff('0x56')],'originTo':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')]['originTo'],'originCc':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x57')],'bcc':_0x123b9f[_0x8cff('0x26')][_0x8cff('0x16')][_0x8cff('0x58')]},{'include':[{'model':db[_0x8cff('0x59')],'as':_0x8cff('0x5a')}]});})['then'](function(_0x33a62f){_0x348dbf[_0x8cff('0x16')]=_0x33a62f;if(_0x348dbf[_0x8cff('0x54')][_0x8cff('0x5b')]){return db[_0x8cff('0x5c')]['find']({'attributes':['id',_0x8cff('0x5d')],'where':{'id':_0x348dbf[_0x8cff('0x54')]['UserId']}})[_0x8cff('0xe')](function(_0x273ff9){if(_0x273ff9){_0x348dbf[_0x8cff('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8cff('0x5e'),'appdata':_0x273ff9['name']+','+(_0x348dbf[_0x8cff('0x3c')][_0x8cff('0x5f')]||0xa),'interval':_0x8cff('0x60')});}return respondWithRpcPromise('Start',_0x8cff('0x61'),_0x348dbf);});}return respondWithRpcPromise('Start',_0x8cff('0x61'),_0x348dbf);})[_0x8cff('0xe')](function(_0x22e6fe){_0x545948(_0x22e6fe);})[_0x8cff('0x24')](function(_0x52d500){_0x421383(_0x23d55d['error'](0x1f4,_0x52d500['message']));});});}; \ No newline at end of file +var _0xbf1a=['MailServerOut','omit','applications','list','orderBy','account','autoclose','*,*,*,*','create','List\x20not\x20found','messageId','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','attach','format','interaction','attachments','originTo','bcc','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','options','raw','where','attributes','include','map','model','then','ShowMailAccount','MailAccount','find','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','Applications'];(function(_0x18fbcc,_0x1ec91a){var _0x50c414=function(_0x2b44e4){while(--_0x2b44e4){_0x18fbcc['push'](_0x18fbcc['shift']());}};_0x50c414(++_0x1ec91a);}(_0xbf1a,0x7c));var _0xabf1=function(_0x59e8a5,_0x19058f){_0x59e8a5=_0x59e8a5-0x0;var _0x3c0a88=_0xbf1a[_0x59e8a5];return _0x3c0a88;};'use strict';var _=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var moment=require(_0xabf1('0x2'));var BPromise=require(_0xabf1('0x3'));var rs=require(_0xabf1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xabf1('0x6'))(_0xabf1('0x7'));var config=require(_0xabf1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xabf1('0x9')]({'port':0x232c});config['redis']=_[_0xabf1('0xa')](config[_0xabf1('0xb')],{'host':_0xabf1('0xc'),'port':0x18eb});var socket=require(_0xabf1('0xd'))(new Redis(config[_0xabf1('0xb')]));require(_0xabf1('0xe'))['register'](socket);function respondWithRpcPromise(_0x94a69,_0x3362f8,_0xa06c48){return new BPromise(function(_0x3aff77,_0x43c278){return client[_0xabf1('0xf')](_0x94a69,_0xa06c48)['then'](function(_0x3a58a2){logger[_0xabf1('0x10')](_0xabf1('0x11'),_0x3362f8,_0xabf1('0x12'));logger[_0xabf1('0x13')](_0xabf1('0x14'),_0x3362f8,_0xabf1('0x12'),JSON[_0xabf1('0x15')](_0x3a58a2));if(_0x3a58a2[_0xabf1('0x16')]){if(_0x3a58a2[_0xabf1('0x16')]['code']===0x1f4){logger[_0xabf1('0x16')](_0xabf1('0x11'),_0x3362f8,_0x3a58a2[_0xabf1('0x16')]['message']);return _0x43c278(_0x3a58a2[_0xabf1('0x16')][_0xabf1('0x17')]);}logger[_0xabf1('0x16')](_0xabf1('0x11'),_0x3362f8,_0x3a58a2['error'][_0xabf1('0x17')]);return _0x3aff77(_0x3a58a2['error'][_0xabf1('0x17')]);}else{logger[_0xabf1('0x10')](_0xabf1('0x11'),_0x3362f8,_0xabf1('0x12'));_0x3aff77(_0x3a58a2[_0xabf1('0x18')][_0xabf1('0x17')]);}})[_0xabf1('0x19')](function(_0x2d8fac){logger[_0xabf1('0x16')](_0xabf1('0x11'),_0x3362f8,_0x2d8fac);_0x43c278(_0x2d8fac);});});}exports[_0xabf1('0x1a')]=function(_0x3a4265){var _0x1e0d23=this;return new Promise(function(_0xf90090,_0x367d7e){return db['MailAccount']['findAll']({'raw':_0x3a4265[_0xabf1('0x1b')]?_0x3a4265[_0xabf1('0x1b')][_0xabf1('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a4265['options']?_0x3a4265[_0xabf1('0x1b')][_0xabf1('0x1d')]||null:null,'attributes':_0x3a4265[_0xabf1('0x1b')]?_0x3a4265['options'][_0xabf1('0x1e')]||null:null,'limit':_0x3a4265['options']?_0x3a4265[_0xabf1('0x1b')]['limit']||null:null,'include':_0x3a4265['options']?_0x3a4265['options'][_0xabf1('0x1f')]?_[_0xabf1('0x20')](_0x3a4265['options'][_0xabf1('0x1f')],function(_0x69ddb8){return{'model':db[_0x69ddb8['model']],'as':_0x69ddb8['as'],'attributes':_0x69ddb8['attributes'],'include':_0x69ddb8[_0xabf1('0x1f')]?_[_0xabf1('0x20')](_0x69ddb8[_0xabf1('0x1f')],function(_0x420590){return{'model':db[_0x420590[_0xabf1('0x21')]],'as':_0x420590['as'],'attributes':_0x420590['attributes'],'include':_0x420590[_0xabf1('0x1f')]?_['map'](_0x420590[_0xabf1('0x1f')],function(_0x5ddf0d){return{'model':db[_0x5ddf0d[_0xabf1('0x21')]],'as':_0x5ddf0d['as'],'attributes':_0x5ddf0d['attributes']};}):[]};}):[]};}):[]:[]})[_0xabf1('0x22')](function(_0x139540){logger[_0xabf1('0x10')](_0xabf1('0x1a'),_0x3a4265);logger['debug'](_0xabf1('0x1a'),_0x3a4265,JSON[_0xabf1('0x15')](_0x139540));_0xf90090(_0x139540);})['catch'](function(_0xe9a38d){logger['error']('GetMailAccount',_0xe9a38d['message'],_0x3a4265);_0x367d7e(_0x1e0d23[_0xabf1('0x16')](0x1f4,_0xe9a38d[_0xabf1('0x17')]));});});};exports[_0xabf1('0x23')]=function(_0x3887ad){var _0x530da8=this;return new Promise(function(_0x359cf6,_0x3af3d2){return db[_0xabf1('0x24')][_0xabf1('0x25')]({'raw':_0x3887ad['options']?_0x3887ad[_0xabf1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3887ad[_0xabf1('0x1b')]?_0x3887ad['options']['where']||null:null,'attributes':_0x3887ad[_0xabf1('0x1b')]?_0x3887ad[_0xabf1('0x1b')][_0xabf1('0x1e')]||null:null,'include':_0x3887ad[_0xabf1('0x1b')]?_0x3887ad[_0xabf1('0x1b')][_0xabf1('0x1f')]?_[_0xabf1('0x20')](_0x3887ad[_0xabf1('0x1b')]['include'],function(_0x1acc54){return{'model':db[_0x1acc54[_0xabf1('0x21')]],'as':_0x1acc54['as'],'attributes':_0x1acc54['attributes'],'include':_0x1acc54['include']?_['map'](_0x1acc54[_0xabf1('0x1f')],function(_0x4ccb9f){return{'model':db[_0x4ccb9f[_0xabf1('0x21')]],'as':_0x4ccb9f['as'],'attributes':_0x4ccb9f[_0xabf1('0x1e')],'include':_0x4ccb9f[_0xabf1('0x1f')]?_[_0xabf1('0x20')](_0x4ccb9f['include'],function(_0xd23acf){return{'model':db[_0xd23acf['model']],'as':_0xd23acf['as'],'attributes':_0xd23acf[_0xabf1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xabf1('0x22')](function(_0x1dd17d){logger[_0xabf1('0x10')]('ShowMailAccount',_0x3887ad);logger[_0xabf1('0x13')](_0xabf1('0x23'),_0x3887ad,JSON[_0xabf1('0x15')](_0x1dd17d));_0x359cf6(_0x1dd17d);})[_0xabf1('0x19')](function(_0x3cb71d){logger[_0xabf1('0x16')](_0xabf1('0x23'),_0x3cb71d[_0xabf1('0x17')],_0x3887ad);_0x3af3d2(_0x530da8[_0xabf1('0x16')](0x1f4,_0x3cb71d[_0xabf1('0x17')]));});});};exports['NotifyMailAccount']=function(_0x4f5a51){var _0x3d52bc=this;return new Promise(function(_0x7c5288,_0x15ad30){var _0x171b07={'body':_0x4f5a51[_0xabf1('0x26')],'channel':'mail'};var _0xa1bdf7=_['difference'](_[_0xabf1('0x27')](db[_0xabf1('0x28')][_0xabf1('0x29')]),[_0xabf1('0x2a'),_0xabf1('0x2b'),_0xabf1('0x2c'),'ListId']);var _0x50bc4b=![];if(_0x4f5a51[_0xabf1('0x26')]['id']){delete _0x4f5a51['body']['id'];}if(_[_0xabf1('0x2d')](_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x2e')])){return _0x15ad30(_0x3d52bc[_0xabf1('0x16')](0x1f4,_0xabf1('0x2f')));}if(_['isNil'](_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x26')])||_0x4f5a51['body'][_0xabf1('0x26')]===''){return _0x15ad30(_0x3d52bc[_0xabf1('0x16')](0x1f4,_0xabf1('0x30')));}if(_[_0xabf1('0x2d')](_0x4f5a51['body'][_0xabf1('0x31')])){return _0x15ad30(_0x3d52bc['error'](0x1f4,_0xabf1('0x32')+_0xa1bdf7));}if(!_[_0xabf1('0x33')](_0xa1bdf7,_0x4f5a51[_0xabf1('0x26')]['mapKey'])){return _0x15ad30(_0x3d52bc[_0xabf1('0x16')](0x1f4,_0xabf1('0x34')+_0xa1bdf7));}var _0x5b2c56={};_0x5b2c56[_0x4f5a51['body'][_0xabf1('0x31')]]=_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x2e')];return db['MailAccount']['find']({'where':{'id':_0x4f5a51['account']['id']},'include':[{'model':db[_0xabf1('0x35')],'as':_0xabf1('0x36'),'include':[{'model':db[_0xabf1('0x28')],'as':_0xabf1('0x37'),'where':_0x5b2c56,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xabf1('0x38')],'as':_0xabf1('0x39')},{'model':db[_0xabf1('0x3a')],'as':'Smtp'}]})[_0xabf1('0x22')](function(_0x38c955){if(_0x38c955&&_0x38c955['List']){var _0x50ffdf=_0x38c955['get']({'plain':!![]});_0x171b07['account']=_[_0xabf1('0x3b')](_0x50ffdf,[_0xabf1('0x39'),_0xabf1('0x36')]);_0x171b07[_0xabf1('0x3c')]=_0x50ffdf[_0xabf1('0x39')];_0x171b07[_0xabf1('0x3d')]=_0x50ffdf[_0xabf1('0x36')];_0x171b07[_0xabf1('0x3c')]=_[_0xabf1('0x3e')](_0x171b07['applications'],['priority'],['asc']);if(_0x171b07['account']&&_0x171b07[_0xabf1('0x3f')]['autoclose']){_0x171b07[_0xabf1('0x3c')]['push']({'id':0x0,'priority':_0x171b07['applications']['length']+0x1,'app':'close','appdata':_0xabf1('0x40'),'interval':_0xabf1('0x41')});}if(_0x171b07[_0xabf1('0x3f')][_0xabf1('0x39')]){delete _0x171b07['account'][_0xabf1('0x39')];}if(_0x171b07[_0xabf1('0x3f')][_0xabf1('0x36')]){delete _0x171b07[_0xabf1('0x3f')][_0xabf1('0x36')];}if(_0x50ffdf[_0xabf1('0x36')][_0xabf1('0x37')]['length']){return _0x50ffdf[_0xabf1('0x36')][_0xabf1('0x37')][0x0];}var _0x1f1219=_['defaults'](_0x4f5a51['body'],{'firstName':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x2e')],'ListId':_0x50ffdf['ListId']});_0x1f1219[_0x4f5a51['body'][_0xabf1('0x31')]]=_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x2e')];return db[_0xabf1('0x28')][_0xabf1('0x42')](_0x1f1219);}else{throw new Error(_0xabf1('0x43'));}})[_0xabf1('0x22')](function(_0x110853){_0x171b07['contact']=_0x110853;if(_0x110853){if(!_0x4f5a51['body']['message']['messageId']){_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x44')]=rs['generate']()+'\x20'+_0x4f5a51[_0xabf1('0x26')]['message']['from'];}var _0x809009={'ContactId':_0x110853['id'],'MailAccountId':_0x4f5a51['account']['id'],'inReplyTo':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x44')],'to':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x2e')],'cc':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')]['cc'],'subject':_0x4f5a51['body'][_0xabf1('0x17')][_0xabf1('0x45')],'attach':_0x4f5a51['body'][_0xabf1('0x17')]['attach'],'lastMsgAt':moment()['format'](_0xabf1('0x46')),'lastMsgDirection':'in','lastMsgBody':_0x4f5a51['body'][_0xabf1('0x26')]};return db[_0xabf1('0x47')][_0xabf1('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f5a51[_0xabf1('0x3f')]['id']},'include':[{'model':db[_0xabf1('0x48')],'as':_0xabf1('0x49'),'attributes':['messageId'],'where':{'messageId':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x4a')]}}]})['then'](function(_0x3a67fd){if(_0x3a67fd){return[_0x3a67fd,![]];}return db['MailInteraction']['create'](_0x809009)[_0xabf1('0x22')](function(_0x58df83){return[_0x58df83,!![]];});});}else{throw new Error(_0xabf1('0x4b'));}})[_0xabf1('0x4c')](function(_0x17bd11,_0x1d8688){if(_0x17bd11){_0x50bc4b=_0x1d8688;if(!_0x1d8688){return _0x17bd11['update']({'inReplyTo':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')]['messageId'],'to':_0x4f5a51[_0xabf1('0x26')]['message'][_0xabf1('0x2e')],'cc':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')]['cc'],'subject':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x45')],'attach':_0x17bd11[_0xabf1('0x4d')]?_0x17bd11[_0xabf1('0x4d')]:_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x4d')],'substatus':null,'substatusAt':moment()[_0xabf1('0x4e')](_0xabf1('0x46')),'lastMsgAt':moment()['format'](_0xabf1('0x46')),'lastMsgDirection':'in','lastMsgBody':_0x4f5a51['body'][_0xabf1('0x26')]});}else{return _0x17bd11;}}})[_0xabf1('0x22')](function(_0x418a0a){_0x171b07[_0xabf1('0x4f')]=_0x418a0a['get']({'plain':!![]});_0x171b07['interaction']['created']=_0x50bc4b;return db[_0xabf1('0x48')][_0xabf1('0x42')]({'body':_0x4f5a51['body'][_0xabf1('0x26')],'MailAccountId':_0x4f5a51['account']['id'],'MailInteractionId':_0x418a0a['id'],'direction':'in','ContactId':_0x171b07['contact']['id'],'messageId':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x44')],'from':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')]['from'],'to':_0x4f5a51[_0xabf1('0x26')]['message']['to'],'cc':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')]['cc'],'subject':_0x4f5a51['body'][_0xabf1('0x17')][_0xabf1('0x45')],'attach':_0x4f5a51[_0xabf1('0x26')]['message'][_0xabf1('0x4d')],'Attachments':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x50')],'originTo':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x51')],'originCc':_0x4f5a51[_0xabf1('0x26')]['message']['originCc'],'bcc':_0x4f5a51[_0xabf1('0x26')][_0xabf1('0x17')][_0xabf1('0x52')]},{'include':[{'model':db['Attachment'],'as':_0xabf1('0x53')}]});})[_0xabf1('0x22')](function(_0xce15a1){_0x171b07['message']=_0xce15a1;if(_0x171b07['interaction'][_0xabf1('0x54')]){return db[_0xabf1('0x55')][_0xabf1('0x25')]({'attributes':['id',_0xabf1('0x56')],'where':{'id':_0x171b07[_0xabf1('0x4f')][_0xabf1('0x54')]}})['then'](function(_0x65f4bb){if(_0x65f4bb){_0x171b07[_0xabf1('0x3c')][_0xabf1('0x57')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x65f4bb['name']+','+(_0x171b07['account'][_0xabf1('0x58')]||0xa),'interval':_0xabf1('0x41')});}return respondWithRpcPromise(_0xabf1('0x59'),_0xabf1('0x5a'),_0x171b07);});}return respondWithRpcPromise(_0xabf1('0x59'),_0xabf1('0x5a'),_0x171b07);})[_0xabf1('0x22')](function(_0xd8422f){_0x7c5288(_0xd8422f);})['catch'](function(_0x50683a){_0x15ad30(_0x3d52bc[_0xabf1('0x16')](0x1f4,_0x50683a[_0xabf1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 852cecd..39d25e3 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 _0x86b8=['save','remove','emit','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x17e0e6,_0x323f01){var _0x1156e0=function(_0x45964d){while(--_0x45964d){_0x17e0e6['push'](_0x17e0e6['shift']());}};_0x1156e0(++_0x323f01);}(_0x86b8,0x15d));var _0x886b=function(_0x37ecb3,_0x4bd3f5){_0x37ecb3=_0x37ecb3-0x0;var _0x316f4d=_0x86b8[_0x37ecb3];return _0x316f4d;};'use strict';var MailAccountEvents=require(_0x886b('0x0'));var events=[_0x886b('0x1'),_0x886b('0x2'),'update'];function createListener(_0x105f5d,_0x5db7b6){return function(_0x3dcb96){_0x5db7b6[_0x886b('0x3')](_0x105f5d,_0x3dcb96);};}function removeListener(_0x4191fb,_0x4d3769){return function(){MailAccountEvents[_0x886b('0x4')](_0x4191fb,_0x4d3769);};}exports['register']=function(_0x5b5ff5){for(var _0x2c32bc=0x0,_0xd9d9ac=events[_0x886b('0x5')];_0x2c32bc<_0xd9d9ac;_0x2c32bc++){var _0x2f8957=events[_0x2c32bc];var _0xbc2d70=createListener(_0x886b('0x6')+_0x2f8957,_0x5b5ff5);MailAccountEvents['on'](_0x2f8957,_0xbc2d70);}}; \ No newline at end of file +var _0x0738=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x54ea2c,_0x2a4ec8){var _0x38adab=function(_0x5d077d){while(--_0x5d077d){_0x54ea2c['push'](_0x54ea2c['shift']());}};_0x38adab(++_0x2a4ec8);}(_0x0738,0x6e));var _0x8073=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x0738[_0x3f578f];return _0x32c754;};'use strict';var MailAccountEvents=require(_0x8073('0x0'));var events=['save',_0x8073('0x1'),_0x8073('0x2')];function createListener(_0x46b716,_0xf6179e){return function(_0x8e2e35){_0xf6179e[_0x8073('0x3')](_0x46b716,_0x8e2e35);};}function removeListener(_0x176f52,_0x38b47d){return function(){MailAccountEvents[_0x8073('0x4')](_0x176f52,_0x38b47d);};}exports[_0x8073('0x5')]=function(_0x2f90b9){for(var _0x588057=0x0,_0x1aad61=events[_0x8073('0x6')];_0x588057<_0x1aad61;_0x588057++){var _0x2899ce=events[_0x588057];var _0x310f3a=createListener(_0x8073('0x7')+_0x2899ce,_0x2f90b9);MailAccountEvents['on'](_0x2899ce,_0x310f3a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0451b6a..9013e5b 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 _0x3f8c=['/:id','isAuthenticated','show','put','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0x3f8c,0x104));var _0xc3f8=function(_0xef7fbf,_0x39afc9){_0xef7fbf=_0xef7fbf-0x0;var _0x5d9b14=_0x3f8c[_0xef7fbf];return _0x5d9b14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x7')](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0x8')](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);module[_0xc3f8('0xa')]=router; \ No newline at end of file +var _0xe205=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','exports','multer'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xe205,0xa7));var _0x5e20=function(_0xd02b5a,_0x426d4d){_0xd02b5a=_0xd02b5a-0x0;var _0x5ee1a6=_0xe205[_0xd02b5a];return _0x5ee1a6;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var auth=require(_0x5e20('0x6'));var interaction=require(_0x5e20('0x7'));var config=require(_0x5e20('0x8'));var controller=require('./mailApplication.controller');router[_0x5e20('0x9')](_0x5e20('0xa'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['put']('/:id',auth[_0x5e20('0xb')](),controller['update']);router['delete'](_0x5e20('0xa'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 109d9ef..7689ae1 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 _0x96d6=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x2ac14e,_0x2efa95){var _0x167b83=function(_0x6bb834){while(--_0x6bb834){_0x2ac14e['push'](_0x2ac14e['shift']());}};_0x167b83(++_0x2efa95);}(_0x96d6,0x10b));var _0x696d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x96d6[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x696d('0x0'));module[_0x696d('0x1')]={'priority':{'type':Sequelize[_0x696d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x696d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x696d('0x4')]()},'description':{'type':Sequelize[_0x696d('0x3')]},'interval':{'type':Sequelize[_0x696d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3da8=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x882540,_0x1c7037){var _0x1e57f2=function(_0x35aaa6){while(--_0x35aaa6){_0x882540['push'](_0x882540['shift']());}};_0x1e57f2(++_0x1c7037);}(_0x3da8,0x173));var _0x83da=function(_0x9d8b5f,_0x7787a0){_0x9d8b5f=_0x9d8b5f-0x0;var _0x1597e8=_0x3da8[_0x9d8b5f];return _0x1597e8;};'use strict';var Sequelize=require(_0x83da('0x0'));module[_0x83da('0x1')]={'priority':{'type':Sequelize[_0x83da('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x83da('0x3')],'allowNull':![],'defaultValue':_0x83da('0x4')},'appdata':{'type':Sequelize[_0x83da('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x83da('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0d7ae18..d5b4709 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 _0x63e7=['attributes','length','includeAll','include','options','find','catch','body','MailApplication','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','show','params','model','keys','query','intersection'];(function(_0x5cb88e,_0xb13f83){var _0x42db0e=function(_0x3da215){while(--_0x3da215){_0x5cb88e['push'](_0x5cb88e['shift']());}};_0x42db0e(++_0xb13f83);}(_0x63e7,0x126));var _0x763e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x63e7[_0x465028];return _0xb783d4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x763e('0x0'));var zipdir=require(_0x763e('0x1'));var jsonpatch=require(_0x763e('0x2'));var rp=require(_0x763e('0x3'));var moment=require(_0x763e('0x4'));var BPromise=require(_0x763e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x763e('0x6'));var sox=require(_0x763e('0x7'));var csv=require(_0x763e('0x8'));var ejs=require(_0x763e('0x9'));var fs=require('fs');var _=require(_0x763e('0xa'));var squel=require(_0x763e('0xb'));var crypto=require(_0x763e('0xc'));var jsforce=require(_0x763e('0xd'));var deskjs=require(_0x763e('0xe'));var toCsv=require(_0x763e('0x8'));var querystring=require(_0x763e('0xf'));var Papa=require(_0x763e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x763e('0x11'));var as=require(_0x763e('0x12'));var hardwareService=require(_0x763e('0x13'));var logger=require('../../config/logger')(_0x763e('0x14'));var utils=require(_0x763e('0x15'));var config=require(_0x763e('0x16'));var licenseUtil=require(_0x763e('0x17'));var db=require(_0x763e('0x18'))['db'];function respondWithStatusCode(_0x4c6482,_0x5c88a2){_0x5c88a2=_0x5c88a2||0xcc;return function(_0x105813){if(_0x105813){return _0x4c6482[_0x763e('0x19')](_0x5c88a2);}return _0x4c6482[_0x763e('0x1a')](_0x5c88a2)[_0x763e('0x1b')]();};}function respondWithResult(_0x2f6ace,_0x147ea1){_0x147ea1=_0x147ea1||0xc8;return function(_0x1527a9){if(_0x1527a9){return _0x2f6ace['status'](_0x147ea1)[_0x763e('0x1c')](_0x1527a9);}};}function respondWithFilteredResult(_0xaa8a97,_0x52d196){return function(_0x302d65){if(_0x302d65){var _0x5756f5=_0x302d65['count'],_0x306518=_0x52d196[_0x763e('0x1d')],_0x51d2f9=_0x52d196['offset']+_0x52d196[_0x763e('0x1e')],_0x147eb9;if(_0x51d2f9>=_0x5756f5){_0x51d2f9=_0x5756f5;_0x147eb9=0xc8;}else{_0x147eb9=0xce;}_0xaa8a97[_0x763e('0x1a')](_0x147eb9);return _0xaa8a97[_0x763e('0x1f')](_0x763e('0x20'),_0x306518+'-'+_0x51d2f9+'/'+_0x5756f5)[_0x763e('0x1c')](_0x302d65);}return null;};}function patchUpdates(_0x451a5c){return function(_0x418e71){try{jsonpatch[_0x763e('0x21')](_0x418e71,_0x451a5c,!![]);}catch(_0x299d7f){return BPromise[_0x763e('0x22')](_0x299d7f);}return _0x418e71[_0x763e('0x23')]();};}function saveUpdates(_0x4c2a92,_0xeeca0){return function(_0x3eb1d5){if(_0x3eb1d5){return _0x3eb1d5[_0x763e('0x24')](_0x4c2a92)['then'](function(_0x4bfe9a){return _0x4bfe9a;});}return null;};}function removeEntity(_0x522d54,_0x13e411){return function(_0x4f47c3){if(_0x4f47c3){return _0x4f47c3[_0x763e('0x25')]()[_0x763e('0x26')](function(){_0x522d54[_0x763e('0x1a')](0xcc)[_0x763e('0x1b')]();});}};}function handleEntityNotFound(_0x40f952,_0x188446){return function(_0xa00aa6){if(!_0xa00aa6){_0x40f952[_0x763e('0x19')](0x194);}return _0xa00aa6;};}function handleError(_0x17aa46,_0x12c189){_0x12c189=_0x12c189||0x1f4;return function(_0x3a24a6){logger[_0x763e('0x27')](_0x3a24a6[_0x763e('0x28')]);if(_0x3a24a6[_0x763e('0x29')]){delete _0x3a24a6['name'];}_0x17aa46['status'](_0x12c189)['send'](_0x3a24a6);};}exports[_0x763e('0x2a')]=function(_0x618ca2,_0x8efab0){var _0x1d12c6={'raw':!![],'where':{'id':_0x618ca2[_0x763e('0x2b')]['id']}},_0x491a39={};_0x491a39[_0x763e('0x2c')]=_[_0x763e('0x2d')](db['MailApplication']['rawAttributes']);_0x491a39['query']=_[_0x763e('0x2d')](_0x618ca2[_0x763e('0x2e')]);_0x491a39['filters']=_[_0x763e('0x2f')](_0x491a39['model'],_0x491a39[_0x763e('0x2e')]);_0x1d12c6[_0x763e('0x30')]=_[_0x763e('0x2f')](_0x491a39[_0x763e('0x2c')],qs['fields'](_0x618ca2[_0x763e('0x2e')]['fields']));_0x1d12c6[_0x763e('0x30')]=_0x1d12c6[_0x763e('0x30')][_0x763e('0x31')]?_0x1d12c6[_0x763e('0x30')]:_0x491a39[_0x763e('0x2c')];if(_0x618ca2[_0x763e('0x2e')][_0x763e('0x32')]){_0x1d12c6[_0x763e('0x33')]=[{'all':!![]}];}_0x1d12c6=_['merge']({},_0x1d12c6,_0x618ca2[_0x763e('0x34')]);return db['MailApplication'][_0x763e('0x35')](_0x1d12c6)['then'](handleEntityNotFound(_0x8efab0,null))[_0x763e('0x26')](respondWithResult(_0x8efab0,null))[_0x763e('0x36')](handleError(_0x8efab0,null));};exports[_0x763e('0x24')]=function(_0x3f703f,_0x28f3b7){if(_0x3f703f[_0x763e('0x37')]['id']){delete _0x3f703f[_0x763e('0x37')]['id'];}return db[_0x763e('0x38')][_0x763e('0x35')]({'where':{'id':_0x3f703f[_0x763e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x28f3b7,null))['then'](saveUpdates(_0x3f703f[_0x763e('0x37')],null))[_0x763e('0x26')](respondWithResult(_0x28f3b7,null))[_0x763e('0x36')](handleError(_0x28f3b7,null));};exports[_0x763e('0x25')]=function(_0x502047,_0x52ec43){return db[_0x763e('0x38')]['find']({'where':{'id':_0x502047[_0x763e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x52ec43,null))[_0x763e('0x26')](removeEntity(_0x52ec43,null))[_0x763e('0x36')](handleError(_0x52ec43,null));}; \ No newline at end of file +var _0x7d7a=['model','fields','attributes','includeAll','include','merge','options','find','catch','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','error','stack','name','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0x7d7a,0x1eb));var _0xa7d7=function(_0x57df6e,_0x46b2d3){_0x57df6e=_0x57df6e-0x0;var _0x491c8b=_0x7d7a[_0x57df6e];return _0x491c8b;};'use strict';var pdf=require(_0xa7d7('0x0'));var emlformat=require(_0xa7d7('0x1'));var rimraf=require(_0xa7d7('0x2'));var zipdir=require(_0xa7d7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7d7('0x4'));var moment=require(_0xa7d7('0x5'));var BPromise=require(_0xa7d7('0x6'));var Mustache=require('mustache');var util=require(_0xa7d7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa7d7('0x8'));var ejs=require(_0xa7d7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7d7('0xa'));var crypto=require(_0xa7d7('0xb'));var jsforce=require(_0xa7d7('0xc'));var deskjs=require(_0xa7d7('0xd'));var toCsv=require(_0xa7d7('0x8'));var querystring=require(_0xa7d7('0xe'));var Papa=require('papaparse');var Redis=require(_0xa7d7('0xf'));var authService=require(_0xa7d7('0x10'));var qs=require(_0xa7d7('0x11'));var as=require(_0xa7d7('0x12'));var hardwareService=require(_0xa7d7('0x13'));var logger=require(_0xa7d7('0x14'))(_0xa7d7('0x15'));var utils=require(_0xa7d7('0x16'));var config=require(_0xa7d7('0x17'));var licenseUtil=require(_0xa7d7('0x18'));var db=require(_0xa7d7('0x19'))['db'];function respondWithStatusCode(_0x24a85a,_0x40d008){_0x40d008=_0x40d008||0xcc;return function(_0x1e0417){if(_0x1e0417){return _0x24a85a[_0xa7d7('0x1a')](_0x40d008);}return _0x24a85a[_0xa7d7('0x1b')](_0x40d008)[_0xa7d7('0x1c')]();};}function respondWithResult(_0x4e012d,_0x738f8e){_0x738f8e=_0x738f8e||0xc8;return function(_0x4ac8be){if(_0x4ac8be){return _0x4e012d[_0xa7d7('0x1b')](_0x738f8e)[_0xa7d7('0x1d')](_0x4ac8be);}};}function respondWithFilteredResult(_0x2acfd6,_0x32ab0b){return function(_0x3c23e1){if(_0x3c23e1){var _0x2d9490=_0x3c23e1[_0xa7d7('0x1e')],_0xadccfb=_0x32ab0b[_0xa7d7('0x1f')],_0x47127b=_0x32ab0b['offset']+_0x32ab0b['limit'],_0x110d28;if(_0x47127b>=_0x2d9490){_0x47127b=_0x2d9490;_0x110d28=0xc8;}else{_0x110d28=0xce;}_0x2acfd6[_0xa7d7('0x1b')](_0x110d28);return _0x2acfd6[_0xa7d7('0x20')]('Content-Range',_0xadccfb+'-'+_0x47127b+'/'+_0x2d9490)[_0xa7d7('0x1d')](_0x3c23e1);}return null;};}function patchUpdates(_0xc518cc){return function(_0x5e2f2b){try{jsonpatch['apply'](_0x5e2f2b,_0xc518cc,!![]);}catch(_0x3192ef){return BPromise[_0xa7d7('0x21')](_0x3192ef);}return _0x5e2f2b[_0xa7d7('0x22')]();};}function saveUpdates(_0x3dda38,_0x317425){return function(_0x54d897){if(_0x54d897){return _0x54d897[_0xa7d7('0x23')](_0x3dda38)['then'](function(_0x552113){return _0x552113;});}return null;};}function removeEntity(_0x50e62b,_0x5a1cc7){return function(_0x19e3db){if(_0x19e3db){return _0x19e3db['destroy']()[_0xa7d7('0x24')](function(){_0x50e62b[_0xa7d7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174755,_0x52e123){return function(_0x2d6472){if(!_0x2d6472){_0x174755[_0xa7d7('0x1a')](0x194);}return _0x2d6472;};}function handleError(_0x29d2b5,_0x3a227a){_0x3a227a=_0x3a227a||0x1f4;return function(_0x4be655){logger[_0xa7d7('0x25')](_0x4be655[_0xa7d7('0x26')]);if(_0x4be655[_0xa7d7('0x27')]){delete _0x4be655[_0xa7d7('0x27')];}_0x29d2b5[_0xa7d7('0x1b')](_0x3a227a)[_0xa7d7('0x28')](_0x4be655);};}exports[_0xa7d7('0x29')]=function(_0xe9b530,_0x319943){var _0x3be015={'raw':!![],'where':{'id':_0xe9b530[_0xa7d7('0x2a')]['id']}},_0x323d48={};_0x323d48['model']=_[_0xa7d7('0x2b')](db[_0xa7d7('0x2c')][_0xa7d7('0x2d')]);_0x323d48['query']=_[_0xa7d7('0x2b')](_0xe9b530[_0xa7d7('0x2e')]);_0x323d48[_0xa7d7('0x2f')]=_[_0xa7d7('0x30')](_0x323d48[_0xa7d7('0x31')],_0x323d48[_0xa7d7('0x2e')]);_0x3be015['attributes']=_[_0xa7d7('0x30')](_0x323d48[_0xa7d7('0x31')],qs[_0xa7d7('0x32')](_0xe9b530['query']['fields']));_0x3be015[_0xa7d7('0x33')]=_0x3be015[_0xa7d7('0x33')]['length']?_0x3be015[_0xa7d7('0x33')]:_0x323d48['model'];if(_0xe9b530[_0xa7d7('0x2e')][_0xa7d7('0x34')]){_0x3be015[_0xa7d7('0x35')]=[{'all':!![]}];}_0x3be015=_[_0xa7d7('0x36')]({},_0x3be015,_0xe9b530[_0xa7d7('0x37')]);return db['MailApplication'][_0xa7d7('0x38')](_0x3be015)[_0xa7d7('0x24')](handleEntityNotFound(_0x319943,null))[_0xa7d7('0x24')](respondWithResult(_0x319943,null))[_0xa7d7('0x39')](handleError(_0x319943,null));};exports[_0xa7d7('0x23')]=function(_0x373113,_0x571e01){if(_0x373113[_0xa7d7('0x3a')]['id']){delete _0x373113[_0xa7d7('0x3a')]['id'];}return db[_0xa7d7('0x2c')][_0xa7d7('0x38')]({'where':{'id':_0x373113[_0xa7d7('0x2a')]['id']}})['then'](handleEntityNotFound(_0x571e01,null))[_0xa7d7('0x24')](saveUpdates(_0x373113[_0xa7d7('0x3a')],null))[_0xa7d7('0x24')](respondWithResult(_0x571e01,null))[_0xa7d7('0x39')](handleError(_0x571e01,null));};exports[_0xa7d7('0x3b')]=function(_0x9cb80d,_0x41a8b5){return db[_0xa7d7('0x2c')][_0xa7d7('0x38')]({'where':{'id':_0x9cb80d[_0xa7d7('0x2a')]['id']}})[_0xa7d7('0x24')](handleEntityNotFound(_0x41a8b5,null))[_0xa7d7('0x24')](removeEntity(_0x41a8b5,null))[_0xa7d7('0x39')](handleError(_0x41a8b5,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4c3b05d..9155a20 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 _0xd1f1=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','lodash','util','api','moment'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x5eca9f,_0x1d15d3){_0x5eca9f=_0x5eca9f-0x0;var _0x53a05c=_0xd1f1[_0x5eca9f];return _0x53a05c;};'use strict';var _=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var logger=require('../../config/logger')(_0x1d1f('0x2'));var moment=require(_0x1d1f('0x3'));var BPromise=require(_0x1d1f('0x4'));var rp=require(_0x1d1f('0x5'));var fs=require('fs');var path=require(_0x1d1f('0x6'));var rimraf=require(_0x1d1f('0x7'));var config=require(_0x1d1f('0x8'));var attributes=require('./mailApplication.attributes');module[_0x1d1f('0x9')]=function(_0x246882,_0x68d881){return _0x246882[_0x1d1f('0xa')](_0x1d1f('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd05a=['define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x377f55,_0x12926a){var _0x39d1bb=function(_0x3fc1e4){while(--_0x3fc1e4){_0x377f55['push'](_0x377f55['shift']());}};_0x39d1bb(++_0x12926a);}(_0xd05a,0x143));var _0xad05=function(_0x55b01e,_0x460326){_0x55b01e=_0x55b01e-0x0;var _0x4b75e0=_0xd05a[_0x55b01e];return _0x4b75e0;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var logger=require(_0xad05('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xad05('0x2'));var rimraf=require(_0xad05('0x3'));var config=require(_0xad05('0x4'));var attributes=require(_0xad05('0x5'));module[_0xad05('0x6')]=function(_0x520f44,_0x50254e){return _0x520f44[_0xad05('0x7')](_0xad05('0x8'),attributes,{'tableName':_0xad05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xad05('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 00fa3ad..48e6cc5 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 _0xdf38=['update','body','options','where','attributes','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateMailApplication','MailApplication'];(function(_0x2abd09,_0x14e3a9){var _0x4c3fc0=function(_0x589e3d){while(--_0x589e3d){_0x2abd09['push'](_0x2abd09['shift']());}};_0x4c3fc0(++_0x14e3a9);}(_0xdf38,0xc7));var _0x8df3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdf38[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x8df3('0x0'));var util=require(_0x8df3('0x1'));var moment=require(_0x8df3('0x2'));var BPromise=require(_0x8df3('0x3'));var rs=require(_0x8df3('0x4'));var fs=require('fs');var Redis=require(_0x8df3('0x5'));var db=require(_0x8df3('0x6'))['db'];var utils=require(_0x8df3('0x7'));var logger=require(_0x8df3('0x8'))(_0x8df3('0x9'));var config=require(_0x8df3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8df3('0xb')][_0x8df3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38d4b7,_0x8d800c,_0x30d75d){return new BPromise(function(_0x463dec,_0x3b420d){return client[_0x8df3('0xd')](_0x38d4b7,_0x30d75d)['then'](function(_0x40e9b3){logger['info'](_0x8df3('0xe'),_0x8d800c,_0x8df3('0xf'));logger['debug'](_0x8df3('0x10'),_0x8d800c,'request\x20sent',JSON[_0x8df3('0x11')](_0x40e9b3));if(_0x40e9b3[_0x8df3('0x12')]){if(_0x40e9b3[_0x8df3('0x12')][_0x8df3('0x13')]===0x1f4){logger['error'](_0x8df3('0xe'),_0x8d800c,_0x40e9b3[_0x8df3('0x12')][_0x8df3('0x14')]);return _0x3b420d(_0x40e9b3['error'][_0x8df3('0x14')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x8d800c,_0x40e9b3[_0x8df3('0x12')][_0x8df3('0x14')]);return _0x463dec(_0x40e9b3[_0x8df3('0x12')]['message']);}else{logger[_0x8df3('0x15')](_0x8df3('0xe'),_0x8d800c,_0x8df3('0xf'));_0x463dec(_0x40e9b3['result'][_0x8df3('0x14')]);}})[_0x8df3('0x16')](function(_0x1f6d10){logger[_0x8df3('0x12')]('MailApplication,\x20%s,\x20%s',_0x8d800c,_0x1f6d10);_0x3b420d(_0x1f6d10);});});}exports[_0x8df3('0x17')]=function(_0x1a94ab){var _0x104420=this;return new Promise(function(_0x44d426,_0xe65640){return db[_0x8df3('0x18')][_0x8df3('0x19')](_0x1a94ab[_0x8df3('0x1a')],{'raw':_0x1a94ab[_0x8df3('0x1b')]?_0x1a94ab[_0x8df3('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a94ab[_0x8df3('0x1b')]?_0x1a94ab[_0x8df3('0x1b')][_0x8df3('0x1c')]||null:null,'attributes':_0x1a94ab[_0x8df3('0x1b')]?_0x1a94ab[_0x8df3('0x1b')][_0x8df3('0x1d')]||null:null,'limit':_0x1a94ab[_0x8df3('0x1b')]?_0x1a94ab['options']['limit']||null:null})[_0x8df3('0x1e')](function(_0x52d47b){logger[_0x8df3('0x15')](_0x8df3('0x17'),_0x1a94ab);logger[_0x8df3('0x1f')](_0x8df3('0x17'),_0x1a94ab,JSON[_0x8df3('0x11')](_0x52d47b));_0x44d426(_0x52d47b);})[_0x8df3('0x16')](function(_0x5570fd){logger[_0x8df3('0x12')](_0x8df3('0x17'),_0x5570fd[_0x8df3('0x14')],_0x1a94ab);_0xe65640(_0x104420['error'](0x1f4,_0x5570fd[_0x8df3('0x14')]));});});}; \ No newline at end of file +var _0xf28c=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x30861a,_0x337deb){var _0xa37ad6=function(_0x4dad90){while(--_0x4dad90){_0x30861a['push'](_0x30861a['shift']());}};_0xa37ad6(++_0x337deb);}(_0xf28c,0x1be));var _0xcf28=function(_0x57937c,_0x1912ac){_0x57937c=_0x57937c-0x0;var _0x2afa1c=_0xf28c[_0x57937c];return _0x2afa1c;};'use strict';var _=require(_0xcf28('0x0'));var util=require(_0xcf28('0x1'));var moment=require(_0xcf28('0x2'));var BPromise=require(_0xcf28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf28('0x4'));var db=require(_0xcf28('0x5'))['db'];var utils=require(_0xcf28('0x6'));var logger=require(_0xcf28('0x7'))(_0xcf28('0x8'));var config=require(_0xcf28('0x9'));var jayson=require(_0xcf28('0xa'));var client=jayson['client'][_0xcf28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x155d51,_0x3651b5,_0x4ba10b){return new BPromise(function(_0xcd2c0b,_0x408b38){return client[_0xcf28('0xc')](_0x155d51,_0x4ba10b)[_0xcf28('0xd')](function(_0x38d849){logger['info'](_0xcf28('0xe'),_0x3651b5,_0xcf28('0xf'));logger[_0xcf28('0x10')](_0xcf28('0x11'),_0x3651b5,_0xcf28('0xf'),JSON[_0xcf28('0x12')](_0x38d849));if(_0x38d849[_0xcf28('0x13')]){if(_0x38d849[_0xcf28('0x13')][_0xcf28('0x14')]===0x1f4){logger['error'](_0xcf28('0xe'),_0x3651b5,_0x38d849[_0xcf28('0x13')][_0xcf28('0x15')]);return _0x408b38(_0x38d849[_0xcf28('0x13')][_0xcf28('0x15')]);}logger[_0xcf28('0x13')](_0xcf28('0xe'),_0x3651b5,_0x38d849[_0xcf28('0x13')][_0xcf28('0x15')]);return _0xcd2c0b(_0x38d849[_0xcf28('0x13')]['message']);}else{logger[_0xcf28('0x16')](_0xcf28('0xe'),_0x3651b5,_0xcf28('0xf'));_0xcd2c0b(_0x38d849[_0xcf28('0x17')][_0xcf28('0x15')]);}})[_0xcf28('0x18')](function(_0x4b3dd0){logger[_0xcf28('0x13')](_0xcf28('0xe'),_0x3651b5,_0x4b3dd0);_0x408b38(_0x4b3dd0);});});}exports[_0xcf28('0x19')]=function(_0x1f2d27){var _0x1026ec=this;return new Promise(function(_0x3a59,_0x3614b4){return db[_0xcf28('0x1a')][_0xcf28('0x1b')](_0x1f2d27[_0xcf28('0x1c')],{'raw':_0x1f2d27[_0xcf28('0x1d')]?_0x1f2d27['options'][_0xcf28('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2d27['options']?_0x1f2d27[_0xcf28('0x1d')][_0xcf28('0x1f')]||null:null,'attributes':_0x1f2d27['options']?_0x1f2d27[_0xcf28('0x1d')][_0xcf28('0x20')]||null:null,'limit':_0x1f2d27[_0xcf28('0x1d')]?_0x1f2d27[_0xcf28('0x1d')]['limit']||null:null})[_0xcf28('0xd')](function(_0x36d351){logger[_0xcf28('0x16')](_0xcf28('0x19'),_0x1f2d27);logger[_0xcf28('0x10')]('UpdateMailApplication',_0x1f2d27,JSON[_0xcf28('0x12')](_0x36d351));_0x3a59(_0x36d351);})[_0xcf28('0x18')](function(_0x380f5d){logger[_0xcf28('0x13')](_0xcf28('0x19'),_0x380f5d[_0xcf28('0x15')],_0x1f2d27);_0x3614b4(_0x1026ec[_0xcf28('0x13')](0x1f4,_0x380f5d[_0xcf28('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a5067d1..773ab06 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 _0x3c7b=['update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x24e14a,_0x53ed88){_0x24e14a=_0x24e14a-0x0;var _0x1113bc=_0x3c7b[_0x24e14a];return _0x1113bc;};'use strict';var multer=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var path=require(_0xb3c7('0x2'));var timeout=require(_0xb3c7('0x3'));var express=require(_0xb3c7('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3c7('0x5'));router[_0xb3c7('0x6')]('/',auth['isAuthenticated'](),controller[_0xb3c7('0x7')]);router['get'](_0xb3c7('0x8'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0xa')]);router[_0xb3c7('0x6')](_0xb3c7('0xb'),auth['isAuthenticated'](),controller[_0xb3c7('0xc')]);router['get'](_0xb3c7('0xd'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0xe')]);router[_0xb3c7('0x6')]('/:id/download',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0xf')]);router['post']('/',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x10')]);router[_0xb3c7('0x11')](_0xb3c7('0xd'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x12')]);router[_0xb3c7('0x11')]('/:id/tags',auth[_0xb3c7('0x9')](),interaction[_0xb3c7('0x13')]('mail',_0xb3c7('0x14')),controller[_0xb3c7('0x15')]);router[_0xb3c7('0x16')](_0xb3c7('0xb'),auth[_0xb3c7('0x9')](),interaction[_0xb3c7('0x13')](_0xb3c7('0x17'),_0xb3c7('0x18')),controller[_0xb3c7('0x19')]);router[_0xb3c7('0x1a')](_0xb3c7('0xb'),auth[_0xb3c7('0x9')](),interaction['tracked']('mail',_0xb3c7('0x1b')),controller[_0xb3c7('0x1c')]);router[_0xb3c7('0x1a')](_0xb3c7('0x1d'),auth[_0xb3c7('0x9')](),controller['removeTags']);module[_0xb3c7('0x1e')]=router; \ No newline at end of file +var _0x5243=['mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','download','create','post','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked'];(function(_0x392318,_0x1bfaf7){var _0x3f4814=function(_0xca068f){while(--_0xca068f){_0x392318['push'](_0x392318['shift']());}};_0x3f4814(++_0x1bfaf7);}(_0x5243,0x71));var _0x3524=function(_0x12cd74,_0x223909){_0x12cd74=_0x12cd74-0x0;var _0x4eeb48=_0x5243[_0x12cd74];return _0x4eeb48;};'use strict';var multer=require(_0x3524('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3524('0x1'));var express=require(_0x3524('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3524('0x3'));var config=require(_0x3524('0x4'));var controller=require('./mailInteraction.controller');router[_0x3524('0x5')]('/',auth['isAuthenticated'](),controller[_0x3524('0x6')]);router['get'](_0x3524('0x7'),auth[_0x3524('0x8')](),controller[_0x3524('0x9')]);router[_0x3524('0x5')](_0x3524('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3524('0x5')](_0x3524('0xb'),auth[_0x3524('0x8')](),controller[_0x3524('0xc')]);router[_0x3524('0x5')]('/:id/download',auth[_0x3524('0x8')](),controller[_0x3524('0xd')]);router['post']('/',auth[_0x3524('0x8')](),controller[_0x3524('0xe')]);router[_0x3524('0xf')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x3524('0x10'),auth[_0x3524('0x8')](),interaction['tracked'](_0x3524('0x11'),_0x3524('0x12')),controller[_0x3524('0x13')]);router[_0x3524('0x14')](_0x3524('0xa'),auth[_0x3524('0x8')](),interaction[_0x3524('0x15')](_0x3524('0x11'),_0x3524('0x16')),controller['update']);router[_0x3524('0x17')]('/:id',auth[_0x3524('0x8')](),interaction[_0x3524('0x15')](_0x3524('0x11'),_0x3524('0x18')),controller[_0x3524('0x19')]);router[_0x3524('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3524('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ca0e555..f1c0d3d 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 _0xb178=['BOOLEAN','DATE','STRING','long','ENUM','out','TEXT','sequelize','iconv','exports'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xb178,0x93));var _0x8b17=function(_0x3c2863,_0x1b2cee){_0x3c2863=_0x3c2863-0x0;var _0x2c3d27=_0xb178[_0x3c2863];return _0x2c3d27;};'use strict';var Sequelize=require(_0x8b17('0x0'));var iconv=require(_0x8b17('0x1'));module[_0x8b17('0x2')]={'closed':{'type':Sequelize[_0x8b17('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8b17('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8b17('0x5')]},'note':{'type':Sequelize[_0x8b17('0x5')]},'inReplyTo':{'type':Sequelize[_0x8b17('0x5')](0x1fe)},'to':{'type':Sequelize[_0x8b17('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x8b17('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x8b17('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8b17('0x4')]},'substatus':{'type':Sequelize[_0x8b17('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x8b17('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8b17('0x7')]('in',_0x8b17('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8b17('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8b17('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x8b17('0x9')]('long')},'lastMsgText':{'type':Sequelize[_0x8b17('0x9')](_0x8b17('0x6'))}}; \ No newline at end of file +var _0xc50c=['STRING','TEXT','long','BOOLEAN','DATE','ENUM','out','sequelize','iconv','exports'];(function(_0x13bc96,_0x259288){var _0x48b41e=function(_0x3bc7ee){while(--_0x3bc7ee){_0x13bc96['push'](_0x13bc96['shift']());}};_0x48b41e(++_0x259288);}(_0xc50c,0x7f));var _0xcc50=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc50c[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xcc50('0x0'));var iconv=require(_0xcc50('0x1'));module[_0xcc50('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcc50('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcc50('0x3')]},'note':{'type':Sequelize[_0xcc50('0x3')]},'inReplyTo':{'type':Sequelize[_0xcc50('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcc50('0x4')](_0xcc50('0x5'))},'subject':{'type':Sequelize[_0xcc50('0x4')]()},'attach':{'type':Sequelize[_0xcc50('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcc50('0x7')]},'substatus':{'type':Sequelize[_0xcc50('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xcc50('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xcc50('0x8')]('in',_0xcc50('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcc50('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xcc50('0x8')]('in',_0xcc50('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT']('long')},'lastMsgText':{'type':Sequelize[_0xcc50('0x4')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 91559f8..8ac2a33 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 _0x3f5d=['buildExpression','some','compact','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','MailAccountId','sequelize','toString','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.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','rows','show','params','include','options','create','body','destroy','describe','MailMessage','ids','omit','getMessages','hasOwnProperty','format','includeAll','findAll','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','join','root','files','tmp','server','transcript-%d-%s.zip','attachments','Attachment','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','writeFileSync','message%d.eml','download','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','Users','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','select','field','color','from','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','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)','ContactId','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId'];(function(_0x4ddfc9,_0x54aa22){var _0x11b579=function(_0x16a948){while(--_0x16a948){_0x4ddfc9['push'](_0x4ddfc9['shift']());}};_0x11b579(++_0x54aa22);}(_0x3f5d,0x175));var _0xd3f5=function(_0x158897,_0x40b394){_0x158897=_0x158897-0x0;var _0x54b9ab=_0x3f5d[_0x158897];return _0x54b9ab;};'use strict';var pdf=require(_0xd3f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd3f5('0x1'));var zipdir=require(_0xd3f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3f5('0x3'));var moment=require('moment');var BPromise=require(_0xd3f5('0x4'));var Mustache=require(_0xd3f5('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd3f5('0x6'));var csv=require('to-csv');var ejs=require(_0xd3f5('0x7'));var fs=require('fs');var _=require(_0xd3f5('0x8'));var squel=require(_0xd3f5('0x9'));var crypto=require(_0xd3f5('0xa'));var jsforce=require(_0xd3f5('0xb'));var deskjs=require(_0xd3f5('0xc'));var toCsv=require(_0xd3f5('0xd'));var querystring=require(_0xd3f5('0xe'));var Papa=require(_0xd3f5('0xf'));var htmlToText=require(_0xd3f5('0x10'));var Redis=require('ioredis');var authService=require(_0xd3f5('0x11'));var qs=require(_0xd3f5('0x12'));var as=require(_0xd3f5('0x13'));var hardwareService=require(_0xd3f5('0x14'));var logger=require(_0xd3f5('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd3f5('0x16'));var db=require(_0xd3f5('0x17'))['db'];config[_0xd3f5('0x18')]=_[_0xd3f5('0x19')](config[_0xd3f5('0x18')],{'host':_0xd3f5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3f5('0x18')]));require(_0xd3f5('0x1b'))[_0xd3f5('0x1c')](socket);function respondWithStatusCode(_0xc161a2,_0x18bf05){_0x18bf05=_0x18bf05||0xcc;return function(_0x26f642){if(_0x26f642){return _0xc161a2[_0xd3f5('0x1d')](_0x18bf05);}return _0xc161a2[_0xd3f5('0x1e')](_0x18bf05)[_0xd3f5('0x1f')]();};}function respondWithResult(_0x35e13a,_0x1ac96c){_0x1ac96c=_0x1ac96c||0xc8;return function(_0x20eecf){if(_0x20eecf){return _0x35e13a[_0xd3f5('0x1e')](_0x1ac96c)[_0xd3f5('0x20')](_0x20eecf);}};}function respondWithFilteredResult(_0x75982e,_0x2179f9){return function(_0x42b289){if(_0x42b289){var _0x4f705a=_0x42b289[_0xd3f5('0x21')],_0xcf0be2=_0x2179f9['offset'],_0x172f20=_0x2179f9[_0xd3f5('0x22')]+_0x2179f9[_0xd3f5('0x23')],_0x3f2c90;if(_0x172f20>=_0x4f705a){_0x172f20=_0x4f705a;_0x3f2c90=0xc8;}else{_0x3f2c90=0xce;}_0x75982e[_0xd3f5('0x1e')](_0x3f2c90);return _0x75982e[_0xd3f5('0x24')](_0xd3f5('0x25'),_0xcf0be2+'-'+_0x172f20+'/'+_0x4f705a)['json'](_0x42b289);}return null;};}function patchUpdates(_0xec1faa){return function(_0x12e98e){try{jsonpatch[_0xd3f5('0x26')](_0x12e98e,_0xec1faa,!![]);}catch(_0x464d65){return BPromise[_0xd3f5('0x27')](_0x464d65);}return _0x12e98e['save']();};}function saveUpdates(_0xe32c4d,_0x5e76da){return function(_0x23862d){if(_0x23862d){return _0x23862d[_0xd3f5('0x28')](_0xe32c4d)[_0xd3f5('0x29')](function(_0x433b62){return _0x433b62;});}return null;};}function removeEntity(_0x5b1b2c,_0x32f9dc){return function(_0x45d4fd){if(_0x45d4fd){return _0x45d4fd['destroy']()[_0xd3f5('0x29')](function(){_0x5b1b2c[_0xd3f5('0x1e')](0xcc)[_0xd3f5('0x1f')]();});}};}function handleEntityNotFound(_0x27a8f6,_0x2c5247){return function(_0x46f69e){if(!_0x46f69e){_0x27a8f6[_0xd3f5('0x1d')](0x194);}return _0x46f69e;};}function handleError(_0x19e9e2,_0x26ca69){_0x26ca69=_0x26ca69||0x1f4;return function(_0x4dc79a){logger[_0xd3f5('0x2a')](_0x4dc79a[_0xd3f5('0x2b')]);if(_0x4dc79a['name']){delete _0x4dc79a[_0xd3f5('0x2c')];}_0x19e9e2[_0xd3f5('0x1e')](_0x26ca69)[_0xd3f5('0x2d')](_0x4dc79a);};}function getInteractionUsers(_0x11b9bd,_0x247c90){return new BPromise(function(_0x4c8d81,_0x43c0a7){try{if(_0x247c90[_0x11b9bd['id']]){_0x11b9bd[_0xd3f5('0x2e')]=_['map'](_0x247c90[_0x11b9bd['id']],function(_0x47f26c){return{'id':_0x47f26c['id'],'fullname':_0x47f26c['fullname']};});}}catch(_0x427c42){_0x43c0a7(_0x427c42);}_0x4c8d81(_0x11b9bd);});}function getInteractionTags(_0x5e921d,_0x21dc46){return new BPromise(function(_0x45a83a,_0x1b2128){try{if(_0x5e921d[_0xd3f5('0x2f')]){_0x5e921d[_0xd3f5('0x30')]=[];_0x5e921d['TagIds'][_0xd3f5('0x31')](',')[_0xd3f5('0x32')](function(_0x1d2944){_0x5e921d[_0xd3f5('0x30')][_0xd3f5('0x33')](_0x21dc46[_0x1d2944]);});}delete _0x5e921d['TagIds'];}catch(_0xcca40b){_0x1b2128(_0xcca40b);}_0x45a83a(_0x5e921d);});}function getLastMessageText(_0x555460){return new BPromise(function(_0x457010,_0x3a3178){return db[_0xd3f5('0x34')][_0xd3f5('0x35')]({'where':{'id':_0x555460['id']},'attributes':[_0xd3f5('0x36'),_0xd3f5('0x37')],'raw':!![]})[_0xd3f5('0x29')](function(_0x3b33fc){if(!_0x3b33fc['lastMsgText']){_0x555460['lastMsgText']=_[_0xd3f5('0x38')](htmlToText['fromString'](_0x3b33fc[_0xd3f5('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x555460[_0xd3f5('0x37')]=_0x3b33fc[_0xd3f5('0x37')];}_0x457010(_0x555460);})[_0xd3f5('0x39')](function(_0x4906c7){_0x3a3178(_0x4906c7);});});}function updateMailInteraction(_0x1e76c6,_0xb3dc12,_0x14705a,_0x71b773){return new BPromise(function(_0x36095f,_0x49c18e){return getInteractionUsers(_0x1e76c6,_0x14705a)[_0xd3f5('0x29')](function(_0x5f39b4){return getInteractionTags(_0x5f39b4,_0xb3dc12);})[_0xd3f5('0x29')](function(_0x13e53d){if(_0x71b773){_0x36095f(getLastMessageText(_0x13e53d));}else{_0x36095f(_0x13e53d);}})[_0xd3f5('0x39')](function(_0x566e7f){_0x49c18e(_0x566e7f);});});}exports[_0xd3f5('0x3a')]=function(_0x2ee61d,_0x5ea99e){var _0x1fc774={},_0x1876e6={},_0x4b430c={'count':0x0,'rows':[]};var _0x8fcf4=_[_0xd3f5('0x3b')](db[_0xd3f5('0x34')][_0xd3f5('0x3c')],function(_0x283b59){return{'name':_0x283b59[_0xd3f5('0x3d')],'type':_0x283b59['type']['key']};});_0x1876e6[_0xd3f5('0x3e')]=_['map'](_0x8fcf4,_0xd3f5('0x2c'));_0x1876e6[_0xd3f5('0x3f')]=_[_0xd3f5('0x40')](_0x2ee61d[_0xd3f5('0x3f')]);_0x1876e6[_0xd3f5('0x41')]=_[_0xd3f5('0x42')](_0x1876e6['model'],_0x1876e6['query']);_0x1fc774[_0xd3f5('0x43')]=_[_0xd3f5('0x42')](_0x1876e6[_0xd3f5('0x3e')],qs[_0xd3f5('0x44')](_0x2ee61d['query']['fields']));_0x1fc774['attributes']=_0x1fc774[_0xd3f5('0x43')][_0xd3f5('0x45')]?_0x1fc774[_0xd3f5('0x43')]:_0x1876e6[_0xd3f5('0x3e')];if(!_0x2ee61d[_0xd3f5('0x3f')]['hasOwnProperty'](_0xd3f5('0x46'))){_0x1fc774['limit']=qs[_0xd3f5('0x23')](_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x23')]);_0x1fc774[_0xd3f5('0x22')]=qs[_0xd3f5('0x22')](_0x2ee61d['query'][_0xd3f5('0x22')]);}_0x1fc774['order']=qs['sort'](_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x47')]);_0x1fc774[_0xd3f5('0x48')]=qs[_0xd3f5('0x41')](_[_0xd3f5('0x49')](_0x2ee61d[_0xd3f5('0x3f')],_0x1876e6[_0xd3f5('0x41')]),_0x8fcf4);var _0x39053d=[];var _0x1e2b04=squel[_0xd3f5('0x4a')]()['field']('id')[_0xd3f5('0x4b')](_0xd3f5('0x2c'))[_0xd3f5('0x4b')](_0xd3f5('0x4c'))[_0xd3f5('0x4d')]('tools_tags');var _0x48489=squel[_0xd3f5('0x4a')]()[_0xd3f5('0x4b')]('u.id')[_0xd3f5('0x4b')]('u.fullname')[_0xd3f5('0x4b')](_0xd3f5('0x4e'))['from'](_0xd3f5('0x4f'),'ui')[_0xd3f5('0x50')]('users','u',_0xd3f5('0x51'));var _0x2aceaa=squel['select']()[_0xd3f5('0x4d')](_0xd3f5('0x52'),'i')[_0xd3f5('0x50')](_0xd3f5('0x53'),'c',_0xd3f5('0x54'))['left_join'](_0xd3f5('0x55'),'o',_0xd3f5('0x56'))[_0xd3f5('0x50')]('mail_accounts','a',_0xd3f5('0x57'))['left_join'](_0xd3f5('0x58'),'me','me.MailInteractionId\x20=\x20i.id')[_0xd3f5('0x50')](_0xd3f5('0x59'),'it',_0xd3f5('0x5a'))[_0xd3f5('0x50')](_0xd3f5('0x5b'),'t',_0xd3f5('0x5c'));var _0x105c0d=squel['expr']();var _0x532d43=[];var _0x3db486=squel[_0xd3f5('0x5d')]();var _0x3cf2fc;if(_0x2ee61d['query'][_0xd3f5('0x5e')]){_0x3cf2fc=as[_0xd3f5('0x5f')](_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x5e')]);var _0x438007=_0x3cf2fc[_0xd3f5('0x60')];for(var _0x5a752a=0x0;_0x5a752a<_0x3cf2fc['conditions']['length'];_0x5a752a++){var _0x397a94=_0x3cf2fc[_0xd3f5('0x61')][_0x5a752a];var _0xf3a2c6='i';var _0x55c819=_[_0xd3f5('0x62')](_0x8fcf4,['name',_0x397a94[_0xd3f5('0x4b')]]);if(!_0x55c819){switch(_0x397a94[_0xd3f5('0x4b')]){case _0xd3f5('0x63'):if(_0x397a94[_0xd3f5('0x64')]==0x1){_0x2aceaa['having']('`'+_0x397a94[_0xd3f5('0x4b')]+_0xd3f5('0x65'));}else{_0x2aceaa[_0xd3f5('0x66')]('`'+_0x397a94[_0xd3f5('0x4b')]+_0xd3f5('0x67'));}break;case _0xd3f5('0x68'):if(_0x397a94[_0xd3f5('0x69')]===_0xd3f5('0x6a')){if(_0x397a94[_0xd3f5('0x64')][_0xd3f5('0x31')]('\x20')[_0xd3f5('0x45')]>0x1){_0x105c0d[_0x438007](_0xd3f5('0x6b'),qs['getFullTextValue'](_0x397a94['value']),null);}else{var _0x4f6c32='%'+_0x397a94[_0xd3f5('0x64')]+'%';_0x105c0d[_0x438007]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4f6c32,_0x4f6c32,_0x4f6c32);}}else{_0x55c819=_[_0xd3f5('0x62')](_0x8fcf4,[_0xd3f5('0x2c'),'ContactId']);_0x397a94['field']=_0xd3f5('0x6c');_0x37e4e2=as['buildExpression'](_0xf3a2c6,_0x55c819[_0xd3f5('0x6d')],_0x397a94);_0x105c0d[_0x438007](_0x37e4e2[_0xd3f5('0x6e')],_0x37e4e2[_0xd3f5('0x64')][_0xd3f5('0x6f')],_0x37e4e2[_0xd3f5('0x64')][_0xd3f5('0x1f')]);}break;case _0xd3f5('0x70'):var _0x334292=_0x397a94[_0xd3f5('0x64')][_0xd3f5('0x31')](',')[_0xd3f5('0x3b')](function(_0x337ae2){return Number(_0x337ae2);});_0x334292['forEach'](function(_0x4c608c){_0x3db486['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4c608c+',%');});_0x532d43=_[_0xd3f5('0x71')](_0x532d43,_0x334292);break;case _0xd3f5('0x72'):if(_0x397a94[_0xd3f5('0x69')]===_0xd3f5('0x6a')){_0x105c0d[_0x438007](_0xd3f5('0x73'),'%'+_0x397a94[_0xd3f5('0x64')]+'%',null);}else{_0x55c819=_[_0xd3f5('0x62')](_0x8fcf4,[_0xd3f5('0x2c'),_0xd3f5('0x74')]);_0x397a94[_0xd3f5('0x4b')]=_0xd3f5('0x74');_0x37e4e2=as[_0xd3f5('0x75')](_0xf3a2c6,_0x55c819[_0xd3f5('0x6d')],_0x397a94);_0x105c0d[_0x438007](_0x37e4e2['text'],_0x37e4e2[_0xd3f5('0x64')][_0xd3f5('0x6f')],_0x37e4e2[_0xd3f5('0x64')]['end']);}break;case'plainBody':_0x37e4e2=as[_0xd3f5('0x75')]('me',null,_0x397a94);_0x105c0d[_0x438007](_0x37e4e2[_0xd3f5('0x6e')],_0x37e4e2[_0xd3f5('0x64')][_0xd3f5('0x6f')],_0x37e4e2[_0xd3f5('0x64')][_0xd3f5('0x1f')]);break;}}else{var _0x37e4e2=as['buildExpression'](_0xf3a2c6,_0x55c819[_0xd3f5('0x6d')],_0x397a94);_0x105c0d[_0x438007](_0x37e4e2[_0xd3f5('0x6e')],_0x37e4e2['value'][_0xd3f5('0x6f')],_0x37e4e2['value']['end']);}}}else{var _0x359581=_(_0x2ee61d['query'])[_0xd3f5('0x40')]()[_0xd3f5('0x3b')](function(_0x1b2343){return _[_0xd3f5('0x76')](_0x8fcf4,['name',_0x1b2343])?_0x1b2343:undefined;})[_0xd3f5('0x77')]()[_0xd3f5('0x64')]();if(!_[_0xd3f5('0x78')](_0x359581)){_0x359581['forEach'](function(_0x14f2a0){if(_0x14f2a0==='MailAccountId'){_0x2aceaa['where']('i.MailAccountId\x20IN\x20?',[][_0xd3f5('0x79')](_0x2ee61d[_0xd3f5('0x3f')][_0x14f2a0]));}else if(_0x14f2a0===_0xd3f5('0x7a')){var _0x253b11=JSON[_0xd3f5('0x7b')](_0x2ee61d[_0xd3f5('0x3f')][_0x14f2a0])[_0xd3f5('0x7c')];var _0x2a843f=JSON[_0xd3f5('0x7b')](_0x2ee61d[_0xd3f5('0x3f')][_0x14f2a0])['$lte'];_0x2aceaa[_0xd3f5('0x48')](_0xd3f5('0x7d'),_0x253b11,_0x2a843f);}else{if(_0x2ee61d[_0xd3f5('0x3f')][_0x14f2a0]===_0xd3f5('0x7e')){_0x2aceaa[_0xd3f5('0x48')]('i.'+_0x14f2a0+_0xd3f5('0x7f'));}else{_0x2aceaa[_0xd3f5('0x48')]('i.'+_0x14f2a0+'\x20=\x20?',_0x2ee61d[_0xd3f5('0x3f')][_0x14f2a0]);}}});}if(_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x80')]){if(_0x2ee61d[_0xd3f5('0x3f')]['read']==0x1){_0x2aceaa['having'](_0xd3f5('0x81'));}else{_0x2aceaa['having'](_0xd3f5('0x82'));}}if(_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x83')]){_0x532d43=_['isArray'](_0x2ee61d['query'][_0xd3f5('0x83')])?_0x2ee61d[_0xd3f5('0x3f')]['tag']:new Array(_0x2ee61d['query'][_0xd3f5('0x83')]);_0x532d43[_0xd3f5('0x32')](function(_0x52367d){_0x3db486['or'](_0xd3f5('0x84'),'%,'+_0x52367d+',%');});}if(_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x85')]){var _0x1f884b=_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x85')][_0xd3f5('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd3f5('0x87')](_0x1f884b)){_0x105c0d['or'](_0xd3f5('0x88'),_0x1f884b+'%');}else if(qs[_0xd3f5('0x89')](_0x1f884b)){_0x105c0d['or'](_0xd3f5('0x8a'),_0x1f884b+'%');}else{_0x105c0d['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd3f5('0x8b')](_0x1f884b))['or'](_0xd3f5('0x8c'),qs[_0xd3f5('0x8b')](_0x1f884b));}}}_0x2aceaa[_0xd3f5('0x48')](_0x105c0d);_0x2aceaa[_0xd3f5('0x8d')](_0xd3f5('0x8e'));var _0x405a24={'type':db[_0xd3f5('0x8f')]['QueryTypes'][_0xd3f5('0x90')],'raw':!![]};var _0x4b08ca=_0x2aceaa[_0xd3f5('0x91')]();_0x4b08ca['field']('i.id');_0x4b08ca[_0xd3f5('0x4b')](_0xd3f5('0x92'),'unreadMessages');if(_0x1fc774[_0xd3f5('0x93')]){_0x1fc774[_0xd3f5('0x93')]['forEach'](function(_0x8b93b8){var _0x16fe14=_0x8b93b8[0x0]==='contactName'?_0x8b93b8[0x0]:'i.'+_0x8b93b8[0x0];_0x2aceaa[_0xd3f5('0x93')](_0x16fe14,_0x8b93b8[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd3f5('0x78')](_0x532d43)){_0x2aceaa[_0xd3f5('0x66')](_0x3db486);_0x4b08ca['where'](_0xd3f5('0x94'),_0x532d43);}BPromise[_0xd3f5('0x95')]()[_0xd3f5('0x29')](function(){if(!_0x3cf2fc){if(_0x2ee61d['query']['MailAccountId']||_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x96')])return;_0x4b08ca['where'](_0xd3f5('0x97'));_0x2aceaa[_0xd3f5('0x48')](_0xd3f5('0x97'));return;}if(_0x2ee61d[_0xd3f5('0x98')][_0xd3f5('0x99')]!=='agent')return;return _0x2ee61d[_0xd3f5('0x98')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xd3f5('0x29')](function(_0x2dfd3a){if(_[_0xd3f5('0x78')](_0x2dfd3a)){_0x4b08ca['where'](_0xd3f5('0x9a'));_0x2aceaa[_0xd3f5('0x48')](_0xd3f5('0x9a'));}else{_0x4b08ca[_0xd3f5('0x48')](_0xd3f5('0x9b'),_[_0xd3f5('0x3b')](_0x2dfd3a,'id'));_0x2aceaa[_0xd3f5('0x48')](_0xd3f5('0x9b'),_[_0xd3f5('0x3b')](_0x2dfd3a,'id'));}});})[_0xd3f5('0x29')](function(){if(_0x2ee61d[_0xd3f5('0x98')][_0xd3f5('0x99')]==='agent'&&!_0x3cf2fc&&!_0x2ee61d[_0xd3f5('0x3f')][_0xd3f5('0x9c')])return[];return db[_0xd3f5('0x9d')][_0xd3f5('0x3f')](_0x4b08ca[_0xd3f5('0x9e')](),_0x405a24);})[_0xd3f5('0x29')](function(_0x2acdff){_0x4b430c['count']=_0x2acdff[_0xd3f5('0x45')];if(_0x4b430c[_0xd3f5('0x21')]===0x0)return[];return db['sequelize'][_0xd3f5('0x3f')](_0x1e2b04[_0xd3f5('0x9e')](),_0x405a24)[_0xd3f5('0x29')](function(_0xab1850){_0x39053d=_['keyBy'](_0xab1850,'id');_0x405a24=_[_0xd3f5('0x9f')](_0x405a24,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ee61d['query'][_0xd3f5('0x44')]){_0x1fc774[_0xd3f5('0x43')]['forEach'](function(_0x45379b){_0x2aceaa[_0xd3f5('0x4b')]('i.'+_0x45379b);});}else{_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0x92'),_0xd3f5('0x63'));_0x2aceaa['field']('a.key',_0xd3f5('0xa0'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xa1'),_0xd3f5('0xa2'));_0x2aceaa['field'](_0xd3f5('0xa3'),'contactName');_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0x8e'));_0x2aceaa[_0xd3f5('0x4b')]('i.createdAt');_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xa4'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xa5'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xa6'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xa7'));_0x2aceaa['field'](_0xd3f5('0xa8'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xa9'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xaa'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xab'));_0x2aceaa['field'](_0xd3f5('0xac'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xad'));_0x2aceaa['field']('i.substatus');_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xae'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xaf'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xb0'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xb1'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xb2'),_0xd3f5('0xb3'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xb4'),'Contact.lastName');_0x2aceaa['field'](_0xd3f5('0xb5'),_0xd3f5('0xb6'));_0x2aceaa['field'](_0xd3f5('0xb7'),_0xd3f5('0xb8'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xb9'),_0xd3f5('0xba'));_0x2aceaa['field'](_0xd3f5('0xbb'),_0xd3f5('0xbc'));_0x2aceaa[_0xd3f5('0x4b')](_0xd3f5('0xbd'),_0xd3f5('0xbe'));_0x2aceaa[_0xd3f5('0x4b')]('o.internal',_0xd3f5('0xbf'));_0x2aceaa[_0xd3f5('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc774[_0xd3f5('0x23')])_0x2aceaa[_0xd3f5('0x23')](_0x1fc774[_0xd3f5('0x23')]);if(_0x1fc774[_0xd3f5('0x22')])_0x2aceaa[_0xd3f5('0x22')](_0x1fc774['offset']);return db[_0xd3f5('0x9d')][_0xd3f5('0x3f')](_0x2aceaa[_0xd3f5('0x9e')](),_0x405a24);})[_0xd3f5('0x29')](function(_0x11ad46){_0x48489[_0xd3f5('0x48')](_0xd3f5('0xc0'),_[_0xd3f5('0x3b')](_0x11ad46,'id'));return db['sequelize'][_0xd3f5('0x3f')](_0x48489[_0xd3f5('0x9e')](),_0x405a24)['then'](function(_0x3bfff8){var _0x14452a=_['groupBy'](_0x3bfff8,_0xd3f5('0xc1'));var _0x1bc3aa=[];return db[_0xd3f5('0xc2')][_0xd3f5('0x35')]({'attributes':[_0xd3f5('0xc3')],'raw':!![]})[_0xd3f5('0x29')](function(_0x1f2755){var _0x261ecb=_0x1f2755['enableEmailPreview'];_0x11ad46[_0xd3f5('0x32')](function(_0x304fbf){_0x1bc3aa[_0xd3f5('0x33')](updateMailInteraction(_0x304fbf,_0x39053d,_0x14452a,_0x261ecb));});return BPromise['all'](_0x1bc3aa);});});});})['then'](function(_0x355165){_0x4b430c[_0xd3f5('0xc4')]=_0x355165;return _0x4b430c;})[_0xd3f5('0x29')](respondWithFilteredResult(_0x5ea99e,_0x1fc774))[_0xd3f5('0x39')](handleError(_0x5ea99e,null));};exports[_0xd3f5('0xc5')]=function(_0x49da4b,_0x84aca2){var _0x59b0b4={'raw':![],'where':{'id':_0x49da4b[_0xd3f5('0xc6')]['id']}},_0x24cd50={};_0x24cd50[_0xd3f5('0x3e')]=_[_0xd3f5('0x40')](db['MailInteraction'][_0xd3f5('0x3c')]);_0x24cd50['query']=_[_0xd3f5('0x40')](_0x49da4b[_0xd3f5('0x3f')]);_0x24cd50['filters']=_['intersection'](_0x24cd50[_0xd3f5('0x3e')],_0x24cd50['query']);_0x59b0b4['attributes']=_[_0xd3f5('0x42')](_0x24cd50[_0xd3f5('0x3e')],qs[_0xd3f5('0x44')](_0x49da4b['query'][_0xd3f5('0x44')]));_0x59b0b4[_0xd3f5('0x43')]=_0x59b0b4[_0xd3f5('0x43')]['length']?_0x59b0b4[_0xd3f5('0x43')]:_0x24cd50[_0xd3f5('0x3e')];if(_0x49da4b['query']['includeAll']){_0x59b0b4[_0xd3f5('0xc7')]=[{'all':!![]}];}_0x59b0b4=_[_0xd3f5('0x9f')]({},_0x59b0b4,_0x49da4b[_0xd3f5('0xc8')]);return db[_0xd3f5('0x34')][_0xd3f5('0x62')](_0x59b0b4)[_0xd3f5('0x29')](handleEntityNotFound(_0x84aca2,null))[_0xd3f5('0x29')](respondWithResult(_0x84aca2,null))[_0xd3f5('0x39')](handleError(_0x84aca2,null));};exports[_0xd3f5('0xc9')]=function(_0x340eb9,_0x309211){return db[_0xd3f5('0x34')]['create'](_0x340eb9['body'],{})[_0xd3f5('0x29')](respondWithResult(_0x309211,0xc9))[_0xd3f5('0x39')](handleError(_0x309211,null));};exports[_0xd3f5('0x28')]=function(_0x5f3ff0,_0x527fdd){if(_0x5f3ff0[_0xd3f5('0xca')]['id']){delete _0x5f3ff0[_0xd3f5('0xca')]['id'];}return db['MailInteraction'][_0xd3f5('0x62')]({'where':{'id':_0x5f3ff0[_0xd3f5('0xc6')]['id']}})[_0xd3f5('0x29')](handleEntityNotFound(_0x527fdd,null))[_0xd3f5('0x29')](saveUpdates(_0x5f3ff0[_0xd3f5('0xca')],null))['then'](respondWithResult(_0x527fdd,null))['catch'](handleError(_0x527fdd,null));};exports[_0xd3f5('0xcb')]=function(_0xe2f295,_0x3004fb){return db[_0xd3f5('0x34')][_0xd3f5('0x62')]({'where':{'id':_0xe2f295[_0xd3f5('0xc6')]['id']}})[_0xd3f5('0x29')](handleEntityNotFound(_0x3004fb,null))['then'](removeEntity(_0x3004fb,null))[_0xd3f5('0x39')](handleError(_0x3004fb,null));};exports[_0xd3f5('0xcc')]=function(_0x540303,_0x33ae38){return db[_0xd3f5('0x34')][_0xd3f5('0xcc')]()[_0xd3f5('0x29')](respondWithResult(_0x33ae38,null))['catch'](handleError(_0x33ae38,null));};exports['addMessage']=function(_0x67bbd2,_0x48241f,_0x57dd17){return db[_0xd3f5('0xcd')][_0xd3f5('0x62')]({'where':{'id':_0x67bbd2[_0xd3f5('0xc6')]['id']}})['then'](handleEntityNotFound(_0x48241f,null))[_0xd3f5('0x29')](function(_0x1feb05){if(_0x1feb05){return _0x1feb05['addMessage'](_0x67bbd2[_0xd3f5('0xca')][_0xd3f5('0xce')],_[_0xd3f5('0xcf')](_0x67bbd2[_0xd3f5('0xca')],[_0xd3f5('0xce'),'id'])||{});}})[_0xd3f5('0x29')](respondWithResult(_0x48241f,null))[_0xd3f5('0x39')](handleError(_0x48241f,null));};exports[_0xd3f5('0xd0')]=function(_0x5e0f24,_0x35c994,_0x510174){var _0x1be2e9={'raw':![],'where':{}};var _0x1aeb7={};var _0x2bda95={'count':0x0,'rows':[]};return db[_0xd3f5('0x34')][_0xd3f5('0x35')]({'where':{'id':_0x5e0f24['params']['id']}})['then'](handleEntityNotFound(_0x35c994,null))['then'](function(_0x5da31c){if(_0x5da31c){_0x1aeb7[_0xd3f5('0x3e')]=_['keys'](db[_0xd3f5('0xcd')]['rawAttributes']);_0x1aeb7[_0xd3f5('0x3f')]=_[_0xd3f5('0x40')](_0x5e0f24[_0xd3f5('0x3f')]);_0x1aeb7[_0xd3f5('0x41')]=_[_0xd3f5('0x42')](_0x1aeb7[_0xd3f5('0x3e')],_0x1aeb7[_0xd3f5('0x3f')]);_0x1be2e9['attributes']=_[_0xd3f5('0x42')](_0x1aeb7[_0xd3f5('0x3e')],qs['fields'](_0x5e0f24[_0xd3f5('0x3f')]['fields']));_0x1be2e9['attributes']=_0x1be2e9[_0xd3f5('0x43')]['length']?_0x1be2e9['attributes']:_0x1aeb7[_0xd3f5('0x3e')];if(!_0x5e0f24['query'][_0xd3f5('0xd1')](_0xd3f5('0x46'))){_0x1be2e9[_0xd3f5('0x23')]=qs[_0xd3f5('0x23')](_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0x23')]);_0x1be2e9[_0xd3f5('0x22')]=qs['offset'](_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0x22')]);}_0x1be2e9[_0xd3f5('0x93')]=qs[_0xd3f5('0x47')](_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0x47')]);_0x1be2e9['where']=qs[_0xd3f5('0x41')](_['pick'](_0x5e0f24[_0xd3f5('0x3f')],_0x1aeb7[_0xd3f5('0x41')]));_0x1be2e9[_0xd3f5('0x48')][_0xd3f5('0xc1')]=_0x5da31c['id'];if(_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0x85')]){_0x1be2e9[_0xd3f5('0x48')]=_[_0xd3f5('0x9f')](_0x1be2e9['where'],{'$or':_[_0xd3f5('0x3b')](_0x1be2e9[_0xd3f5('0x43')],function(_0x47e4b4){var _0x4bedc7={};_0x4bedc7[_0x47e4b4]={'$like':'%'+_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0x85')]+'%'};return _0x4bedc7;})});}if(_0x5e0f24['query'][_0xd3f5('0x7c')]){var _0x215d38=_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0x7c')][_0xd3f5('0x31')](',');var _0x3beaac={};_0x3beaac[_0x215d38[0x0]]={'$gte':moment(_0x215d38[0x1])[_0xd3f5('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1be2e9[_0xd3f5('0x48')]=_[_0xd3f5('0x9f')](_0x1be2e9[_0xd3f5('0x48')],_0x3beaac);}_0x1be2e9=_['merge']({},_0x1be2e9,_0x5e0f24[_0xd3f5('0xc8')]);return db[_0xd3f5('0xcd')][_0xd3f5('0x21')]({'where':_0x1be2e9[_0xd3f5('0x48')]})[_0xd3f5('0x29')](function(_0x1059fe){_0x2bda95['count']=_0x1059fe;if(_0x5e0f24[_0xd3f5('0x3f')][_0xd3f5('0xd3')]){_0x1be2e9[_0xd3f5('0xc7')]=[{'all':!![]}];}return db['MailMessage'][_0xd3f5('0xd4')](_0x1be2e9);})[_0xd3f5('0x29')](function(_0x56cb1e){_0x2bda95[_0xd3f5('0xc4')]=_0x56cb1e;return _0x2bda95;});}})[_0xd3f5('0x29')](respondWithFilteredResult(_0x35c994,_0x1be2e9))[_0xd3f5('0x39')](handleError(_0x35c994,null));};exports[_0xd3f5('0xd5')]=function(_0x61655c,_0x251f49,_0x28fcf0){return db[_0xd3f5('0x34')][_0xd3f5('0x62')]({'where':{'id':_0x61655c[_0xd3f5('0xc6')]['id']}})[_0xd3f5('0x29')](handleEntityNotFound(_0x251f49,null))['then'](function(_0x546bf4){if(_0x546bf4){return _0x546bf4[_0xd3f5('0xd6')](_0x61655c[_0xd3f5('0xca')]['ids'],_[_0xd3f5('0xcf')](_0x61655c['body'],[_0xd3f5('0xce'),'id'])||{})[_0xd3f5('0xd7')](function(){return db[_0xd3f5('0x70')][_0xd3f5('0xd4')]({'attributes':['id',_0xd3f5('0x2c'),_0xd3f5('0x4c')],'where':{'id':_0x61655c[_0xd3f5('0xca')]['ids']}});})['then'](function(_0x25253e){socket[_0xd3f5('0xd8')](_0xd3f5('0xd9'),{'id':Number(_0x61655c[_0xd3f5('0xc6')]['id']),'tags':_0x25253e||[]});return{'id':Number(_0x61655c[_0xd3f5('0xc6')]['id']),'tags':_0x25253e||[]};});}})[_0xd3f5('0x29')](respondWithResult(_0x251f49,null))[_0xd3f5('0x39')](handleError(_0x251f49,null));};exports['removeTags']=function(_0x4eb9b8,_0x47406c,_0x5ede59){return db['MailInteraction'][_0xd3f5('0x62')]({'where':{'id':_0x4eb9b8['params']['id']}})[_0xd3f5('0x29')](handleEntityNotFound(_0x47406c,null))['then'](function(_0xcb80ba){if(_0xcb80ba){return _0xcb80ba[_0xd3f5('0xda')](_0x4eb9b8['query']['ids']);}})[_0xd3f5('0x29')](respondWithStatusCode(_0x47406c,null))[_0xd3f5('0x39')](handleError(_0x47406c,null));};exports['download']=function(_0x1b13c1,_0x3991d5){var _0xcec5cc=moment()['unix']()[_0xd3f5('0x9e')]();var _0x225052=path[_0xd3f5('0xdb')](config[_0xd3f5('0xdc')],'server',_0xd3f5('0xdd'),_0xd3f5('0xde'));var _0x11d8da=path[_0xd3f5('0xdb')](config[_0xd3f5('0xdc')],_0xd3f5('0xdf'),'files','attachments');var _0x5df1aa=path[_0xd3f5('0xdb')](_0x225052,_0xcec5cc);var _0x28e743=util[_0xd3f5('0xd2')](_0xd3f5('0xe0'),_0x1b13c1[_0xd3f5('0xc6')]['id'],_0xcec5cc);var _0x1dc28d=path[_0xd3f5('0xdb')](_0x225052,_0x28e743);var _0x3b5de1=[];if(_0x1b13c1['query'][_0xd3f5('0xe1')]){_0x3b5de1[_0xd3f5('0x33')]({'model':db[_0xd3f5('0xe2')],'as':'Attachments','raw':!![]});}var _0x3fc1a3=[{'model':db[_0xd3f5('0xcd')],'as':_0xd3f5('0xe3'),'attributes':['id',_0xd3f5('0xca'),_0xd3f5('0x4d'),'to','cc',_0xd3f5('0xe4'),_0xd3f5('0xe5'),'createdAt'],'where':{'secret':![]},'order':qs[_0xd3f5('0x47')]('id'),'include':_0x3b5de1}];return db[_0xd3f5('0x34')][_0xd3f5('0x62')]({'where':{'id':_0x1b13c1[_0xd3f5('0xc6')]['id']},'include':_0x3fc1a3})[_0xd3f5('0x29')](handleEntityNotFound(_0x3991d5,null))[_0xd3f5('0x29')](function(_0x46a741){if(_0x46a741&&_0x46a741['Messages']){var _0x5b17d1=_0x46a741[_0xd3f5('0xe6')]({'plain':!![]});fs[_0xd3f5('0xe7')](_0x5df1aa);return BPromise[_0xd3f5('0xe8')](_0x5b17d1[_0xd3f5('0xe3')],function(_0x4552a3,_0x28f544){var _0x584a6a={'from':_0x4552a3[_0xd3f5('0x4d')],'to':_0x4552a3['to'],'subject':_0x4552a3[_0xd3f5('0xe5')],'html':_0x4552a3['body'],'headers':{'Date':moment(_0x4552a3[_0xd3f5('0x7a')])[_0xd3f5('0xd2')](_0xd3f5('0xe9'))},'attachments':[]};if(_0x4552a3['cc']){_0x584a6a[_0xd3f5('0xea')]['Cc']=_0x4552a3['cc'];}if(_0x4552a3[_0xd3f5('0xe4')]){_0x584a6a[_0xd3f5('0xea')][_0xd3f5('0xeb')]=_0x4552a3[_0xd3f5('0xe4')];}return new BPromise(function(_0x2706dd,_0x53b5a4){if(_0x4552a3[_0xd3f5('0xec')]){for(var _0x56d5c7=0x0;_0x56d5c7<_0x4552a3[_0xd3f5('0xec')][_0xd3f5('0x45')];_0x56d5c7++){var _0x398796=_0x4552a3[_0xd3f5('0xec')][_0x56d5c7];var _0x5620f3=path['join'](_0x11d8da,_0x398796['basename']);if(fs[_0xd3f5('0xed')](_0x5620f3)){_0x584a6a[_0xd3f5('0xe1')][_0xd3f5('0x33')]({'name':_0x398796['name'],'contentType':_0x398796[_0xd3f5('0x6d')],'data':fs[_0xd3f5('0xee')](_0x5620f3)});}}}emlformat['build'](_0x584a6a,function(_0x4993f8,_0x143134){if(_0x4993f8)return _0x53b5a4(_0x4993f8);fs[_0xd3f5('0xef')](path[_0xd3f5('0xdb')](_0x5df1aa,util['format'](_0xd3f5('0xf0'),_0x28f544)),_0x143134);return _0x2706dd(_0x143134);});});})[_0xd3f5('0x29')](function(){return new BPromise(function(_0x2e26ea,_0x4d9572){zipdir(_0x5df1aa,{'saveTo':_0x1dc28d},function(_0xebec74,_0x1b0b97){if(_0xebec74)return _0x4d9572(_0xebec74);return _0x2e26ea(_0x1b0b97);});})[_0xd3f5('0x29')](function(){return new BPromise(function(_0x2596c7,_0x402773){rimraf(_0x5df1aa,function(_0xf9032b){if(_0xf9032b)_0x402773(_0xf9032b);return _0x2596c7();});});})[_0xd3f5('0x29')](function(){return _0x3991d5[_0xd3f5('0xf1')](_0x1dc28d,_0x28e743,function(_0x97795f){if(_0x97795f){console[_0xd3f5('0xf2')](_0xd3f5('0xf3'),_0x97795f);}else{fs[_0xd3f5('0xf4')](_0x1dc28d);}});});});}else{return _0x3991d5[_0xd3f5('0x1d')](0xc8);}})[_0xd3f5('0x39')](handleError(_0x3991d5,null));}; \ No newline at end of file +var _0xff8b=['operator','$substring','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','plainBody','text','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.id\x20LIKE\x20?','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','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','role','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','show','params','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachments','bcc','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','build','writeFileSync','message%d.eml','log','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fullname','Tags','TagIds','forEach','push','MailInteraction','findOne','lastMsgText','trimStart','catch','index','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200'];(function(_0x1b00fc,_0x4590dd){var _0x4d4fa2=function(_0x1ace65){while(--_0x1ace65){_0x1b00fc['push'](_0x1b00fc['shift']());}};_0x4d4fa2(++_0x4590dd);}(_0xff8b,0x8d));var _0xbff8=function(_0x4b17fa,_0x3976e8){_0x4b17fa=_0x4b17fa-0x0;var _0x356b4c=_0xff8b[_0x4b17fa];return _0x356b4c;};'use strict';var pdf=require(_0xbff8('0x0'));var emlformat=require(_0xbff8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbff8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbff8('0x3'));var moment=require(_0xbff8('0x4'));var BPromise=require(_0xbff8('0x5'));var Mustache=require(_0xbff8('0x6'));var util=require(_0xbff8('0x7'));var path=require(_0xbff8('0x8'));var sox=require(_0xbff8('0x9'));var csv=require(_0xbff8('0xa'));var ejs=require(_0xbff8('0xb'));var fs=require('fs');var _=require(_0xbff8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbff8('0xd'));var deskjs=require(_0xbff8('0xe'));var toCsv=require(_0xbff8('0xa'));var querystring=require(_0xbff8('0xf'));var Papa=require(_0xbff8('0x10'));var htmlToText=require(_0xbff8('0x11'));var Redis=require(_0xbff8('0x12'));var authService=require(_0xbff8('0x13'));var qs=require(_0xbff8('0x14'));var as=require(_0xbff8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbff8('0x16'))(_0xbff8('0x17'));var utils=require(_0xbff8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbff8('0x19')](config[_0xbff8('0x1a')],{'host':_0xbff8('0x1b'),'port':0x18eb});var socket=require(_0xbff8('0x1c'))(new Redis(config[_0xbff8('0x1a')]));require(_0xbff8('0x1d'))[_0xbff8('0x1e')](socket);function respondWithStatusCode(_0x465405,_0x407ccf){_0x407ccf=_0x407ccf||0xcc;return function(_0x40dd96){if(_0x40dd96){return _0x465405[_0xbff8('0x1f')](_0x407ccf);}return _0x465405[_0xbff8('0x20')](_0x407ccf)[_0xbff8('0x21')]();};}function respondWithResult(_0x36034f,_0x1149ff){_0x1149ff=_0x1149ff||0xc8;return function(_0x8c2035){if(_0x8c2035){return _0x36034f[_0xbff8('0x20')](_0x1149ff)[_0xbff8('0x22')](_0x8c2035);}};}function respondWithFilteredResult(_0x32421c,_0x2cb387){return function(_0x6310e5){if(_0x6310e5){var _0x358da6=_0x6310e5[_0xbff8('0x23')],_0x2d579d=_0x2cb387[_0xbff8('0x24')],_0x59dfd8=_0x2cb387[_0xbff8('0x24')]+_0x2cb387['limit'],_0x312a22;if(_0x59dfd8>=_0x358da6){_0x59dfd8=_0x358da6;_0x312a22=0xc8;}else{_0x312a22=0xce;}_0x32421c[_0xbff8('0x20')](_0x312a22);return _0x32421c['set'](_0xbff8('0x25'),_0x2d579d+'-'+_0x59dfd8+'/'+_0x358da6)[_0xbff8('0x22')](_0x6310e5);}return null;};}function patchUpdates(_0x44715d){return function(_0x527953){try{jsonpatch[_0xbff8('0x26')](_0x527953,_0x44715d,!![]);}catch(_0x5d5190){return BPromise[_0xbff8('0x27')](_0x5d5190);}return _0x527953[_0xbff8('0x28')]();};}function saveUpdates(_0x40f930,_0x28595e){return function(_0x81a230){if(_0x81a230){return _0x81a230[_0xbff8('0x29')](_0x40f930)[_0xbff8('0x2a')](function(_0x58b4ec){return _0x58b4ec;});}return null;};}function removeEntity(_0x5e3a79,_0x175144){return function(_0x1e4264){if(_0x1e4264){return _0x1e4264[_0xbff8('0x2b')]()[_0xbff8('0x2a')](function(){_0x5e3a79['status'](0xcc)[_0xbff8('0x21')]();});}};}function handleEntityNotFound(_0x5b493d,_0x27411c){return function(_0x3db58c){if(!_0x3db58c){_0x5b493d['sendStatus'](0x194);}return _0x3db58c;};}function handleError(_0x100a37,_0x19db2b){_0x19db2b=_0x19db2b||0x1f4;return function(_0x214a14){logger['error'](_0x214a14[_0xbff8('0x2c')]);if(_0x214a14[_0xbff8('0x2d')]){delete _0x214a14[_0xbff8('0x2d')];}_0x100a37[_0xbff8('0x20')](_0x19db2b)[_0xbff8('0x2e')](_0x214a14);};}function getInteractionUsers(_0x551ebf,_0x2fb6a5){return new BPromise(function(_0x2fb8b5,_0xb9f23d){try{if(_0x2fb6a5[_0x551ebf['id']]){_0x551ebf['Users']=_[_0xbff8('0x2f')](_0x2fb6a5[_0x551ebf['id']],function(_0x5eaeb1){return{'id':_0x5eaeb1['id'],'fullname':_0x5eaeb1[_0xbff8('0x30')]};});}}catch(_0x33d4c2){_0xb9f23d(_0x33d4c2);}_0x2fb8b5(_0x551ebf);});}function getInteractionTags(_0x2e85c0,_0x125c50){return new BPromise(function(_0x1499ac,_0x5675e2){try{if(_0x2e85c0['TagIds']){_0x2e85c0[_0xbff8('0x31')]=[];_0x2e85c0[_0xbff8('0x32')]['split'](',')[_0xbff8('0x33')](function(_0x14feb7){_0x2e85c0[_0xbff8('0x31')][_0xbff8('0x34')](_0x125c50[_0x14feb7]);});}delete _0x2e85c0['TagIds'];}catch(_0x4c758c){_0x5675e2(_0x4c758c);}_0x1499ac(_0x2e85c0);});}function getLastMessageText(_0xf2855a){return new BPromise(function(_0x416726,_0x4c714e){return db[_0xbff8('0x35')][_0xbff8('0x36')]({'where':{'id':_0xf2855a['id']},'attributes':['lastMsgBody','lastMsgText'],'raw':!![]})[_0xbff8('0x2a')](function(_0x137cac){if(!_0x137cac[_0xbff8('0x37')]){_0xf2855a['lastMsgText']=_[_0xbff8('0x38')](htmlToText['fromString'](_0x137cac['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0xf2855a['lastMsgText']=_0x137cac[_0xbff8('0x37')];}_0x416726(_0xf2855a);})['catch'](function(_0x24a917){_0x4c714e(_0x24a917);});});}function updateMailInteraction(_0x4a383a,_0xd18998,_0x11eeb4,_0x2b1eab){return new BPromise(function(_0x125ef3,_0x21d4f5){return getInteractionUsers(_0x4a383a,_0x11eeb4)[_0xbff8('0x2a')](function(_0x2c30c1){return getInteractionTags(_0x2c30c1,_0xd18998);})[_0xbff8('0x2a')](function(_0x553156){if(_0x2b1eab){_0x125ef3(getLastMessageText(_0x553156));}else{_0x125ef3(_0x553156);}})[_0xbff8('0x39')](function(_0x5ad979){_0x21d4f5(_0x5ad979);});});}exports[_0xbff8('0x3a')]=function(_0x23fa71,_0x5664b4){var _0x53cece={},_0x4f2c89={},_0x790788={'count':0x0,'rows':[]};var _0x5d9269=_['map'](db['MailInteraction'][_0xbff8('0x3b')],function(_0x1d34dd){return{'name':_0x1d34dd['fieldName'],'type':_0x1d34dd[_0xbff8('0x3c')]['key']};});_0x4f2c89[_0xbff8('0x3d')]=_[_0xbff8('0x2f')](_0x5d9269,_0xbff8('0x2d'));_0x4f2c89[_0xbff8('0x3e')]=_[_0xbff8('0x3f')](_0x23fa71[_0xbff8('0x3e')]);_0x4f2c89[_0xbff8('0x40')]=_[_0xbff8('0x41')](_0x4f2c89['model'],_0x4f2c89[_0xbff8('0x3e')]);_0x53cece['attributes']=_['intersection'](_0x4f2c89['model'],qs['fields'](_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x42')]));_0x53cece[_0xbff8('0x43')]=_0x53cece[_0xbff8('0x43')][_0xbff8('0x44')]?_0x53cece[_0xbff8('0x43')]:_0x4f2c89['model'];if(!_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x45')](_0xbff8('0x46'))){_0x53cece[_0xbff8('0x47')]=qs[_0xbff8('0x47')](_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x47')]);_0x53cece[_0xbff8('0x24')]=qs[_0xbff8('0x24')](_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x24')]);}_0x53cece['order']=qs[_0xbff8('0x48')](_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x48')]);_0x53cece[_0xbff8('0x49')]=qs[_0xbff8('0x40')](_[_0xbff8('0x4a')](_0x23fa71[_0xbff8('0x3e')],_0x4f2c89[_0xbff8('0x40')]),_0x5d9269);var _0x25dd6e=[];var _0x181175=squel['select']()[_0xbff8('0x4b')]('id')['field'](_0xbff8('0x2d'))[_0xbff8('0x4b')]('color')[_0xbff8('0x4c')](_0xbff8('0x4d'));var _0x45c91e=squel[_0xbff8('0x4e')]()['field'](_0xbff8('0x4f'))[_0xbff8('0x4b')](_0xbff8('0x50'))['field'](_0xbff8('0x51'))[_0xbff8('0x4c')](_0xbff8('0x52'),'ui')[_0xbff8('0x53')](_0xbff8('0x54'),'u',_0xbff8('0x55'));var _0xc2a89e=squel[_0xbff8('0x4e')]()[_0xbff8('0x4c')]('mail_interactions','i')['left_join']('cm_contacts','c',_0xbff8('0x56'))[_0xbff8('0x53')]('users','o',_0xbff8('0x57'))['left_join']('mail_accounts','a',_0xbff8('0x58'))[_0xbff8('0x53')](_0xbff8('0x59'),'me','me.MailInteractionId\x20=\x20i.id')[_0xbff8('0x53')]('mail_interaction_has_tags','it',_0xbff8('0x5a'))[_0xbff8('0x53')](_0xbff8('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x1eb857=squel[_0xbff8('0x5b')]();var _0x357ed2=[];var _0x5845a9=squel[_0xbff8('0x5b')]();var _0x50914e;if(_0x23fa71['query'][_0xbff8('0x5c')]){_0x50914e=as[_0xbff8('0x5d')](_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x5c')]);var _0x533fa4=_0x50914e['sqlOperator'];for(var _0x1445e1=0x0;_0x1445e1<_0x50914e['conditions'][_0xbff8('0x44')];_0x1445e1++){var _0x3ffa1e=_0x50914e[_0xbff8('0x5e')][_0x1445e1];var _0x5f21e7='i';var _0x1928f2=_[_0xbff8('0x5f')](_0x5d9269,[_0xbff8('0x2d'),_0x3ffa1e[_0xbff8('0x4b')]]);if(!_0x1928f2){switch(_0x3ffa1e[_0xbff8('0x4b')]){case _0xbff8('0x60'):if(_0x3ffa1e['value']==0x1){_0xc2a89e[_0xbff8('0x61')]('`'+_0x3ffa1e['field']+_0xbff8('0x62'));}else{_0xc2a89e[_0xbff8('0x61')]('`'+_0x3ffa1e['field']+_0xbff8('0x63'));}break;case'Contact':if(_0x3ffa1e[_0xbff8('0x64')]===_0xbff8('0x65')){if(_0x3ffa1e[_0xbff8('0x66')][_0xbff8('0x67')]('\x20')[_0xbff8('0x44')]>0x1){_0x1eb857[_0x533fa4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbff8('0x68')](_0x3ffa1e['value']),null);}else{var _0x135488='%'+_0x3ffa1e[_0xbff8('0x66')]+'%';_0x1eb857[_0x533fa4](_0xbff8('0x69'),_0x135488,_0x135488,_0x135488);}}else{_0x1928f2=_['find'](_0x5d9269,['name','ContactId']);_0x3ffa1e[_0xbff8('0x4b')]=_0xbff8('0x6a');_0x528ae7=as['buildExpression'](_0x5f21e7,_0x1928f2[_0xbff8('0x3c')],_0x3ffa1e);_0x1eb857[_0x533fa4](_0x528ae7['text'],_0x528ae7['value'][_0xbff8('0x6b')],_0x528ae7[_0xbff8('0x66')][_0xbff8('0x21')]);}break;case _0xbff8('0x6c'):var _0x4136e1=_0x3ffa1e['value'][_0xbff8('0x67')](',')[_0xbff8('0x2f')](function(_0x15f463){return Number(_0x15f463);});_0x4136e1[_0xbff8('0x33')](function(_0x2410d4){_0x5845a9['or'](_0xbff8('0x6d'),'%,'+_0x2410d4+',%');});_0x357ed2=_[_0xbff8('0x6e')](_0x357ed2,_0x4136e1);break;case _0xbff8('0x6f'):if(_0x3ffa1e[_0xbff8('0x64')]===_0xbff8('0x65')){_0x1eb857[_0x533fa4](_0xbff8('0x70'),'%'+_0x3ffa1e[_0xbff8('0x66')]+'%',null);}else{_0x1928f2=_[_0xbff8('0x5f')](_0x5d9269,[_0xbff8('0x2d'),'UserId']);_0x3ffa1e[_0xbff8('0x4b')]='UserId';_0x528ae7=as[_0xbff8('0x71')](_0x5f21e7,_0x1928f2[_0xbff8('0x3c')],_0x3ffa1e);_0x1eb857[_0x533fa4](_0x528ae7['text'],_0x528ae7['value'][_0xbff8('0x6b')],_0x528ae7['value'][_0xbff8('0x21')]);}break;case _0xbff8('0x72'):_0x528ae7=as[_0xbff8('0x71')]('me',null,_0x3ffa1e);_0x1eb857[_0x533fa4](_0x528ae7[_0xbff8('0x73')],_0x528ae7[_0xbff8('0x66')]['start'],_0x528ae7[_0xbff8('0x66')]['end']);break;}}else{var _0x528ae7=as[_0xbff8('0x71')](_0x5f21e7,_0x1928f2['type'],_0x3ffa1e);_0x1eb857[_0x533fa4](_0x528ae7[_0xbff8('0x73')],_0x528ae7[_0xbff8('0x66')][_0xbff8('0x6b')],_0x528ae7['value'][_0xbff8('0x21')]);}}}else{var _0x4b1ce8=_(_0x23fa71['query'])[_0xbff8('0x3f')]()[_0xbff8('0x2f')](function(_0x130453){return _[_0xbff8('0x74')](_0x5d9269,['name',_0x130453])?_0x130453:undefined;})[_0xbff8('0x75')]()['value']();if(!_[_0xbff8('0x76')](_0x4b1ce8)){_0x4b1ce8['forEach'](function(_0x6cd206){if(_0x6cd206==='MailAccountId'){_0xc2a89e[_0xbff8('0x49')]('i.MailAccountId\x20IN\x20?',[][_0xbff8('0x77')](_0x23fa71[_0xbff8('0x3e')][_0x6cd206]));}else if(_0x6cd206===_0xbff8('0x78')){var _0x1e9e78=JSON[_0xbff8('0x79')](_0x23fa71[_0xbff8('0x3e')][_0x6cd206])[_0xbff8('0x7a')];var _0xb8de04=JSON[_0xbff8('0x79')](_0x23fa71[_0xbff8('0x3e')][_0x6cd206])[_0xbff8('0x7b')];_0xc2a89e['where'](_0xbff8('0x7c'),_0x1e9e78,_0xb8de04);}else{if(_0x23fa71[_0xbff8('0x3e')][_0x6cd206]==='null'){_0xc2a89e[_0xbff8('0x49')]('i.'+_0x6cd206+'\x20IS\x20NULL');}else{_0xc2a89e[_0xbff8('0x49')]('i.'+_0x6cd206+_0xbff8('0x7d'),_0x23fa71[_0xbff8('0x3e')][_0x6cd206]);}}});}if(_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x7e')]){if(_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x7e')]==0x1){_0xc2a89e[_0xbff8('0x61')](_0xbff8('0x7f'));}else{_0xc2a89e[_0xbff8('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x23fa71['query'][_0xbff8('0x80')]){_0x357ed2=_['isArray'](_0x23fa71['query']['tag'])?_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x80')]:new Array(_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x80')]);_0x357ed2[_0xbff8('0x33')](function(_0x41ca29){_0x5845a9['or'](_0xbff8('0x6d'),'%,'+_0x41ca29+',%');});}if(_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x81')]){var _0xdcf0fa=_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x81')][_0xbff8('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0xdcf0fa)){_0x1eb857['or'](_0xbff8('0x83'),_0xdcf0fa+'%');}else if(qs['isEmail'](_0xdcf0fa)){_0x1eb857['or'](_0xbff8('0x84'),_0xdcf0fa+'%');}else{_0x1eb857['or'](_0xbff8('0x85'),qs[_0xbff8('0x68')](_0xdcf0fa))['or'](_0xbff8('0x86'),qs['getFullTextValue'](_0xdcf0fa));}}}_0xc2a89e[_0xbff8('0x49')](_0x1eb857);_0xc2a89e[_0xbff8('0x87')](_0xbff8('0x88'));var _0x508017={'type':db[_0xbff8('0x89')][_0xbff8('0x8a')][_0xbff8('0x8b')],'raw':!![]};var _0x11a37f=_0xc2a89e['clone']();_0x11a37f['field'](_0xbff8('0x88'));_0x11a37f[_0xbff8('0x4b')](_0xbff8('0x8c'),_0xbff8('0x60'));if(_0x53cece['order']){_0x53cece[_0xbff8('0x8d')][_0xbff8('0x33')](function(_0x57a2b1){var _0x2da630=_0x57a2b1[0x0]===_0xbff8('0x8e')?_0x57a2b1[0x0]:'i.'+_0x57a2b1[0x0];_0xc2a89e[_0xbff8('0x8d')](_0x2da630,_0x57a2b1[0x1]===_0xbff8('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x357ed2)){_0xc2a89e[_0xbff8('0x61')](_0x5845a9);_0x11a37f[_0xbff8('0x49')](_0xbff8('0x90'),_0x357ed2);}BPromise['resolve']()[_0xbff8('0x2a')](function(){if(!_0x50914e){if(_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x91')]||_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x92')])return;_0x11a37f[_0xbff8('0x49')](_0xbff8('0x93'));_0xc2a89e['where'](_0xbff8('0x93'));return;}if(_0x23fa71[_0xbff8('0x94')]['role']!==_0xbff8('0x95'))return;return _0x23fa71['user'][_0xbff8('0x96')]({'attributes':['id'],'raw':!![]})[_0xbff8('0x2a')](function(_0x4dd7b2){if(_[_0xbff8('0x76')](_0x4dd7b2)){_0x11a37f[_0xbff8('0x49')](_0xbff8('0x97'));_0xc2a89e[_0xbff8('0x49')]('i.MailAccountId\x20IS\x20NULL');}else{_0x11a37f[_0xbff8('0x49')](_0xbff8('0x98'),_[_0xbff8('0x2f')](_0x4dd7b2,'id'));_0xc2a89e[_0xbff8('0x49')](_0xbff8('0x98'),_[_0xbff8('0x2f')](_0x4dd7b2,'id'));}});})[_0xbff8('0x2a')](function(){if(_0x23fa71[_0xbff8('0x94')][_0xbff8('0x99')]===_0xbff8('0x95')&&!_0x50914e&&!_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x91')])return[];return db[_0xbff8('0x9a')][_0xbff8('0x3e')](_0x11a37f['toString'](),_0x508017);})['then'](function(_0x3c18b9){_0x790788[_0xbff8('0x23')]=_0x3c18b9['length'];if(_0x790788['count']===0x0)return[];return db[_0xbff8('0x9a')][_0xbff8('0x3e')](_0x181175['toString'](),_0x508017)['then'](function(_0x2af7e8){_0x25dd6e=_[_0xbff8('0x9b')](_0x2af7e8,'id');_0x508017=_[_0xbff8('0x9c')](_0x508017,{'model':db[_0xbff8('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23fa71[_0xbff8('0x3e')][_0xbff8('0x42')]){_0x53cece[_0xbff8('0x43')][_0xbff8('0x33')](function(_0x30ef34){_0xc2a89e['field']('i.'+_0x30ef34);});}else{_0xc2a89e[_0xbff8('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbff8('0x60'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0x9d'),_0xbff8('0x9e'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0x9f'),'Account.mandatoryDisposition');_0xc2a89e[_0xbff8('0x4b')]('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',_0xbff8('0x8e'));_0xc2a89e[_0xbff8('0x4b')]('i.id');_0xc2a89e['field'](_0xbff8('0xa0'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xa1'));_0xc2a89e['field']('i.closed');_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xa2'));_0xc2a89e['field'](_0xbff8('0xa3'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xa4'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xa5'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xa6'));_0xc2a89e['field'](_0xbff8('0xa7'));_0xc2a89e['field'](_0xbff8('0xa8'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xa9'));_0xc2a89e[_0xbff8('0x4b')]('i.substatus');_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xaa'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xab'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xac'));_0xc2a89e['field'](_0xbff8('0xad'));_0xc2a89e['field']('c.firstName',_0xbff8('0xae'));_0xc2a89e[_0xbff8('0x4b')]('c.lastName',_0xbff8('0xaf'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xb0'),_0xbff8('0xb1'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xb2'),_0xbff8('0xb3'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xb4'),_0xbff8('0xb5'));_0xc2a89e[_0xbff8('0x4b')]('c.fax',_0xbff8('0xb6'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xb7'),_0xbff8('0xb8'));_0xc2a89e[_0xbff8('0x4b')](_0xbff8('0xb9'),_0xbff8('0xba'));_0xc2a89e['field'](_0xbff8('0xbb'),_0xbff8('0x32'));}if(_0x53cece[_0xbff8('0x47')])_0xc2a89e['limit'](_0x53cece[_0xbff8('0x47')]);if(_0x53cece[_0xbff8('0x24')])_0xc2a89e[_0xbff8('0x24')](_0x53cece[_0xbff8('0x24')]);return db[_0xbff8('0x9a')]['query'](_0xc2a89e[_0xbff8('0xbc')](),_0x508017);})['then'](function(_0x2d179d){_0x45c91e[_0xbff8('0x49')](_0xbff8('0xbd'),_[_0xbff8('0x2f')](_0x2d179d,'id'));return db[_0xbff8('0x9a')][_0xbff8('0x3e')](_0x45c91e[_0xbff8('0xbc')](),_0x508017)[_0xbff8('0x2a')](function(_0x24144a){var _0x6b358e=_[_0xbff8('0xbe')](_0x24144a,_0xbff8('0xbf'));var _0x56a24e=[];return db['Setting'][_0xbff8('0x36')]({'attributes':[_0xbff8('0xc0')],'raw':!![]})['then'](function(_0x51df29){var _0x508c6c=_0x51df29[_0xbff8('0xc0')];_0x2d179d[_0xbff8('0x33')](function(_0x5beab1){_0x56a24e[_0xbff8('0x34')](updateMailInteraction(_0x5beab1,_0x25dd6e,_0x6b358e,_0x508c6c));});return BPromise[_0xbff8('0xc1')](_0x56a24e);});});});})[_0xbff8('0x2a')](function(_0x148fb6){_0x790788['rows']=_0x148fb6;return _0x790788;})['then'](respondWithFilteredResult(_0x5664b4,_0x53cece))[_0xbff8('0x39')](handleError(_0x5664b4,null));};exports[_0xbff8('0xc2')]=function(_0x350d11,_0x177835){var _0x2efe28={'raw':![],'where':{'id':_0x350d11[_0xbff8('0xc3')]['id']}},_0x3cc366={};_0x3cc366[_0xbff8('0x3d')]=_[_0xbff8('0x3f')](db[_0xbff8('0x35')][_0xbff8('0x3b')]);_0x3cc366[_0xbff8('0x3e')]=_[_0xbff8('0x3f')](_0x350d11[_0xbff8('0x3e')]);_0x3cc366[_0xbff8('0x40')]=_[_0xbff8('0x41')](_0x3cc366[_0xbff8('0x3d')],_0x3cc366['query']);_0x2efe28[_0xbff8('0x43')]=_[_0xbff8('0x41')](_0x3cc366['model'],qs['fields'](_0x350d11[_0xbff8('0x3e')][_0xbff8('0x42')]));_0x2efe28['attributes']=_0x2efe28['attributes']['length']?_0x2efe28['attributes']:_0x3cc366[_0xbff8('0x3d')];if(_0x350d11[_0xbff8('0x3e')][_0xbff8('0xc4')]){_0x2efe28[_0xbff8('0xc5')]=[{'all':!![]}];}_0x2efe28=_[_0xbff8('0x9c')]({},_0x2efe28,_0x350d11[_0xbff8('0xc6')]);return db[_0xbff8('0x35')][_0xbff8('0x5f')](_0x2efe28)[_0xbff8('0x2a')](handleEntityNotFound(_0x177835,null))['then'](respondWithResult(_0x177835,null))['catch'](handleError(_0x177835,null));};exports[_0xbff8('0xc7')]=function(_0xd36498,_0x3a69c3){return db[_0xbff8('0x35')][_0xbff8('0xc7')](_0xd36498[_0xbff8('0xc8')],{})[_0xbff8('0x2a')](respondWithResult(_0x3a69c3,0xc9))[_0xbff8('0x39')](handleError(_0x3a69c3,null));};exports[_0xbff8('0x29')]=function(_0x512dcc,_0x438cde){if(_0x512dcc[_0xbff8('0xc8')]['id']){delete _0x512dcc[_0xbff8('0xc8')]['id'];}return db['MailInteraction'][_0xbff8('0x5f')]({'where':{'id':_0x512dcc[_0xbff8('0xc3')]['id']}})['then'](handleEntityNotFound(_0x438cde,null))[_0xbff8('0x2a')](saveUpdates(_0x512dcc[_0xbff8('0xc8')],null))[_0xbff8('0x2a')](respondWithResult(_0x438cde,null))['catch'](handleError(_0x438cde,null));};exports[_0xbff8('0x2b')]=function(_0x1ec7d6,_0x52cfe3){return db['MailInteraction'][_0xbff8('0x5f')]({'where':{'id':_0x1ec7d6[_0xbff8('0xc3')]['id']}})[_0xbff8('0x2a')](handleEntityNotFound(_0x52cfe3,null))[_0xbff8('0x2a')](removeEntity(_0x52cfe3,null))[_0xbff8('0x39')](handleError(_0x52cfe3,null));};exports[_0xbff8('0xc9')]=function(_0x1df9cf,_0x3dc8aa){return db[_0xbff8('0x35')]['describe']()[_0xbff8('0x2a')](respondWithResult(_0x3dc8aa,null))[_0xbff8('0x39')](handleError(_0x3dc8aa,null));};exports[_0xbff8('0xca')]=function(_0xa56ec2,_0x213db9,_0x585bef){return db[_0xbff8('0xcb')]['find']({'where':{'id':_0xa56ec2[_0xbff8('0xc3')]['id']}})[_0xbff8('0x2a')](handleEntityNotFound(_0x213db9,null))['then'](function(_0x48b8d9){if(_0x48b8d9){return _0x48b8d9['addMessage'](_0xa56ec2[_0xbff8('0xc8')][_0xbff8('0xcc')],_[_0xbff8('0xcd')](_0xa56ec2[_0xbff8('0xc8')],['ids','id'])||{});}})[_0xbff8('0x2a')](respondWithResult(_0x213db9,null))[_0xbff8('0x39')](handleError(_0x213db9,null));};exports[_0xbff8('0xce')]=function(_0x230692,_0x1c073e,_0x254548){var _0xeb9615={'raw':![],'where':{}};var _0x16ca08={};var _0x3b9665={'count':0x0,'rows':[]};return db['MailInteraction'][_0xbff8('0x36')]({'where':{'id':_0x230692['params']['id']}})[_0xbff8('0x2a')](handleEntityNotFound(_0x1c073e,null))[_0xbff8('0x2a')](function(_0x3bdbee){if(_0x3bdbee){_0x16ca08['model']=_[_0xbff8('0x3f')](db[_0xbff8('0xcb')][_0xbff8('0x3b')]);_0x16ca08[_0xbff8('0x3e')]=_['keys'](_0x230692[_0xbff8('0x3e')]);_0x16ca08[_0xbff8('0x40')]=_[_0xbff8('0x41')](_0x16ca08[_0xbff8('0x3d')],_0x16ca08[_0xbff8('0x3e')]);_0xeb9615[_0xbff8('0x43')]=_[_0xbff8('0x41')](_0x16ca08[_0xbff8('0x3d')],qs[_0xbff8('0x42')](_0x230692[_0xbff8('0x3e')]['fields']));_0xeb9615['attributes']=_0xeb9615[_0xbff8('0x43')]['length']?_0xeb9615[_0xbff8('0x43')]:_0x16ca08[_0xbff8('0x3d')];if(!_0x230692[_0xbff8('0x3e')][_0xbff8('0x45')]('nolimit')){_0xeb9615[_0xbff8('0x47')]=qs['limit'](_0x230692[_0xbff8('0x3e')][_0xbff8('0x47')]);_0xeb9615[_0xbff8('0x24')]=qs[_0xbff8('0x24')](_0x230692[_0xbff8('0x3e')][_0xbff8('0x24')]);}_0xeb9615[_0xbff8('0x8d')]=qs[_0xbff8('0x48')](_0x230692[_0xbff8('0x3e')]['sort']);_0xeb9615[_0xbff8('0x49')]=qs[_0xbff8('0x40')](_[_0xbff8('0x4a')](_0x230692[_0xbff8('0x3e')],_0x16ca08[_0xbff8('0x40')]));_0xeb9615[_0xbff8('0x49')]['MailInteractionId']=_0x3bdbee['id'];if(_0x230692['query'][_0xbff8('0x81')]){_0xeb9615[_0xbff8('0x49')]=_[_0xbff8('0x9c')](_0xeb9615[_0xbff8('0x49')],{'$or':_[_0xbff8('0x2f')](_0xeb9615['attributes'],function(_0x43615d){var _0x541c7b={};_0x541c7b[_0x43615d]={'$like':'%'+_0x230692['query'][_0xbff8('0x81')]+'%'};return _0x541c7b;})});}if(_0x230692['query']['$gte']){var _0x41bc07=_0x230692[_0xbff8('0x3e')]['$gte'][_0xbff8('0x67')](',');var _0x1f39b4={};_0x1f39b4[_0x41bc07[0x0]]={'$gte':moment(_0x41bc07[0x1])[_0xbff8('0xcf')](_0xbff8('0xd0'))};_0xeb9615[_0xbff8('0x49')]=_[_0xbff8('0x9c')](_0xeb9615[_0xbff8('0x49')],_0x1f39b4);}_0xeb9615=_[_0xbff8('0x9c')]({},_0xeb9615,_0x230692[_0xbff8('0xc6')]);return db[_0xbff8('0xcb')][_0xbff8('0x23')]({'where':_0xeb9615[_0xbff8('0x49')]})[_0xbff8('0x2a')](function(_0x487444){_0x3b9665[_0xbff8('0x23')]=_0x487444;if(_0x230692[_0xbff8('0x3e')][_0xbff8('0xc4')]){_0xeb9615[_0xbff8('0xc5')]=[{'all':!![]}];}return db[_0xbff8('0xcb')][_0xbff8('0xd1')](_0xeb9615);})[_0xbff8('0x2a')](function(_0x55dcb1){_0x3b9665['rows']=_0x55dcb1;return _0x3b9665;});}})['then'](respondWithFilteredResult(_0x1c073e,_0xeb9615))[_0xbff8('0x39')](handleError(_0x1c073e,null));};exports[_0xbff8('0xd2')]=function(_0x56cc7f,_0x352221,_0xceb28a){return db['MailInteraction'][_0xbff8('0x5f')]({'where':{'id':_0x56cc7f[_0xbff8('0xc3')]['id']}})[_0xbff8('0x2a')](handleEntityNotFound(_0x352221,null))['then'](function(_0x942ef8){if(_0x942ef8){return _0x942ef8[_0xbff8('0xd3')](_0x56cc7f[_0xbff8('0xc8')][_0xbff8('0xcc')],_[_0xbff8('0xcd')](_0x56cc7f['body'],[_0xbff8('0xcc'),'id'])||{})[_0xbff8('0xd4')](function(){return db[_0xbff8('0x6c')][_0xbff8('0xd1')]({'attributes':['id',_0xbff8('0x2d'),'color'],'where':{'id':_0x56cc7f[_0xbff8('0xc8')]['ids']}});})[_0xbff8('0x2a')](function(_0x3e6e2d){socket[_0xbff8('0xd5')](_0xbff8('0xd6'),{'id':Number(_0x56cc7f[_0xbff8('0xc3')]['id']),'tags':_0x3e6e2d||[]});return{'id':Number(_0x56cc7f['params']['id']),'tags':_0x3e6e2d||[]};});}})[_0xbff8('0x2a')](respondWithResult(_0x352221,null))['catch'](handleError(_0x352221,null));};exports['removeTags']=function(_0x438b4d,_0x5a370a,_0x5b3c3d){return db['MailInteraction'][_0xbff8('0x5f')]({'where':{'id':_0x438b4d[_0xbff8('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5a370a,null))['then'](function(_0x3dd2b9){if(_0x3dd2b9){return _0x3dd2b9[_0xbff8('0xd7')](_0x438b4d['query']['ids']);}})[_0xbff8('0x2a')](respondWithStatusCode(_0x5a370a,null))['catch'](handleError(_0x5a370a,null));};exports[_0xbff8('0xd8')]=function(_0x46271f,_0x3961a0){var _0x2ac8ea=moment()[_0xbff8('0xd9')]()[_0xbff8('0xbc')]();var _0x3f15ac=path[_0xbff8('0xda')](config[_0xbff8('0xdb')],_0xbff8('0xdc'),_0xbff8('0xdd'),_0xbff8('0xde'));var _0x28619c=path[_0xbff8('0xda')](config[_0xbff8('0xdb')],'server',_0xbff8('0xdd'),_0xbff8('0xdf'));var _0x3ae6b4=path[_0xbff8('0xda')](_0x3f15ac,_0x2ac8ea);var _0x478e40=util['format'](_0xbff8('0xe0'),_0x46271f[_0xbff8('0xc3')]['id'],_0x2ac8ea);var _0x2cb8e1=path[_0xbff8('0xda')](_0x3f15ac,_0x478e40);var _0x4737be=[];if(_0x46271f['query'][_0xbff8('0xdf')]){_0x4737be[_0xbff8('0x34')]({'model':db['Attachment'],'as':_0xbff8('0xe1'),'raw':!![]});}var _0x113c68=[{'model':db[_0xbff8('0xcb')],'as':'Messages','attributes':['id','body',_0xbff8('0x4c'),'to','cc',_0xbff8('0xe2'),_0xbff8('0xe3'),_0xbff8('0x78')],'where':{'secret':![]},'order':qs[_0xbff8('0x48')]('id'),'include':_0x4737be}];return db[_0xbff8('0x35')][_0xbff8('0x5f')]({'where':{'id':_0x46271f[_0xbff8('0xc3')]['id']},'include':_0x113c68})[_0xbff8('0x2a')](handleEntityNotFound(_0x3961a0,null))[_0xbff8('0x2a')](function(_0x3a642c){if(_0x3a642c&&_0x3a642c[_0xbff8('0xe4')]){var _0x276a07=_0x3a642c[_0xbff8('0xe5')]({'plain':!![]});fs[_0xbff8('0xe6')](_0x3ae6b4);return BPromise[_0xbff8('0xe7')](_0x276a07[_0xbff8('0xe4')],function(_0x176e34,_0x5a0f24){var _0x67bcb4={'from':_0x176e34[_0xbff8('0x4c')],'to':_0x176e34['to'],'subject':_0x176e34[_0xbff8('0xe3')],'html':_0x176e34[_0xbff8('0xc8')],'headers':{'Date':moment(_0x176e34[_0xbff8('0x78')])[_0xbff8('0xcf')](_0xbff8('0xe8'))},'attachments':[]};if(_0x176e34['cc']){_0x67bcb4[_0xbff8('0xe9')]['Cc']=_0x176e34['cc'];}if(_0x176e34[_0xbff8('0xe2')]){_0x67bcb4[_0xbff8('0xe9')]['Bcc']=_0x176e34['bcc'];}return new BPromise(function(_0x2bd32f,_0x913a0a){if(_0x176e34[_0xbff8('0xe1')]){for(var _0x186cf0=0x0;_0x186cf0<_0x176e34['Attachments'][_0xbff8('0x44')];_0x186cf0++){var _0x2df4d8=_0x176e34[_0xbff8('0xe1')][_0x186cf0];var _0x3d9624=path[_0xbff8('0xda')](_0x28619c,_0x2df4d8[_0xbff8('0xea')]);if(fs[_0xbff8('0xeb')](_0x3d9624)){_0x67bcb4['attachments'][_0xbff8('0x34')]({'name':_0x2df4d8['name'],'contentType':_0x2df4d8[_0xbff8('0x3c')],'data':fs['readFileSync'](_0x3d9624)});}}}emlformat[_0xbff8('0xec')](_0x67bcb4,function(_0x470538,_0x1c9ee5){if(_0x470538)return _0x913a0a(_0x470538);fs[_0xbff8('0xed')](path[_0xbff8('0xda')](_0x3ae6b4,util[_0xbff8('0xcf')](_0xbff8('0xee'),_0x5a0f24)),_0x1c9ee5);return _0x2bd32f(_0x1c9ee5);});});})[_0xbff8('0x2a')](function(){return new BPromise(function(_0x13a110,_0x49d038){zipdir(_0x3ae6b4,{'saveTo':_0x2cb8e1},function(_0x4940ae,_0x10789e){if(_0x4940ae)return _0x49d038(_0x4940ae);return _0x13a110(_0x10789e);});})[_0xbff8('0x2a')](function(){return new BPromise(function(_0x338521,_0x35353d){rimraf(_0x3ae6b4,function(_0x3c4151){if(_0x3c4151)_0x35353d(_0x3c4151);return _0x338521();});});})['then'](function(){return _0x3961a0[_0xbff8('0xd8')](_0x2cb8e1,_0x478e40,function(_0x181a99){if(_0x181a99){console[_0xbff8('0xef')]('err',_0x181a99);}else{fs[_0xbff8('0xf0')](_0x2cb8e1);}});});});}else{return _0x3961a0[_0xbff8('0x1f')](0xc8);}})[_0xbff8('0x39')](handleError(_0x3961a0,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ee8ca72..39358a6 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 _0x8e54=['catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x8e54,0x112));var _0x48e5=function(_0x46cdf8,_0x4a39cf){_0x46cdf8=_0x46cdf8-0x0;var _0x1fb528=_0x8e54[_0x46cdf8];return _0x1fb528;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x48e5('0x0'))['db'][_0x48e5('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x48e5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x48e5('0x3'),'afterDestroy':_0x48e5('0x4')};function emitEvent(_0x461ec4){return function(_0x498832,_0x4bb096,_0x1ca58c){_0x498832[_0x48e5('0x5')]({'attributes':['id'],'raw':!![]})[_0x48e5('0x6')](function(_0x1e56bf){_0x498832[_0x48e5('0x7')](_0x48e5('0x8'),_0x1e56bf[_0x48e5('0x9')](function(_0x2b19c7){return{'id':_0x2b19c7['id']};}));return MailMessage[_0x48e5('0xa')]({'where':{'MailInteractionId':_0x498832['id'],'direction':'in','read':![]},'raw':!![]});})[_0x48e5('0x6')](function(_0x7bb0a5){_0x498832[_0x48e5('0x7')](_0x48e5('0xb'),_0x7bb0a5[_0x48e5('0xc')]);MailInteractionEvents[_0x48e5('0xd')](_0x461ec4+':'+_0x498832['id'],_0x498832);MailInteractionEvents[_0x48e5('0xd')](_0x461ec4,_0x498832);_0x1ca58c(null);})[_0x48e5('0xe')](_0x1ca58c(null));};}for(var e in events){if(events[_0x48e5('0xf')](e)){var event=events[e];MailInteraction[_0x48e5('0x10')](e,emitEvent(event));}}module[_0x48e5('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x9485=['../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','exports','events'];(function(_0x3ae101,_0x1d316f){var _0xcd6111=function(_0x33a1ed){while(--_0x33a1ed){_0x3ae101['push'](_0x3ae101['shift']());}};_0xcd6111(++_0x1d316f);}(_0x9485,0x68));var _0x5948=function(_0x24af71,_0x4b2434){_0x24af71=_0x24af71-0x0;var _0x3b3847=_0x9485[_0x24af71];return _0x3b3847;};'use strict';var EventEmitter=require(_0x5948('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x5948('0x1'))['db'][_0x5948('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5948('0x3')](0x0);var events={'afterCreate':_0x5948('0x4'),'afterUpdate':'update','afterDestroy':_0x5948('0x5')};function emitEvent(_0x44436e){return function(_0x22d28d,_0x9583cb,_0x23cca0){_0x22d28d[_0x5948('0x6')]({'attributes':['id'],'raw':!![]})[_0x5948('0x7')](function(_0xf8f885){_0x22d28d[_0x5948('0x8')](_0x5948('0x9'),_0xf8f885[_0x5948('0xa')](function(_0x186ad6){return{'id':_0x186ad6['id']};}));return MailMessage[_0x5948('0xb')]({'where':{'MailInteractionId':_0x22d28d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x59dca7){_0x22d28d[_0x5948('0x8')]('unreadMessages',_0x59dca7['length']);MailInteractionEvents[_0x5948('0xc')](_0x44436e+':'+_0x22d28d['id'],_0x22d28d);MailInteractionEvents[_0x5948('0xc')](_0x44436e,_0x22d28d);_0x23cca0(null);})[_0x5948('0xd')](_0x23cca0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x5948('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 99c4aa9..124ccd4 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 _0x8bdf=['mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction'];(function(_0x3cfe76,_0x1d9d61){var _0x1f6f12=function(_0x1f2148){while(--_0x1f2148){_0x3cfe76['push'](_0x3cfe76['shift']());}};_0x1f6f12(++_0x1d9d61);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8bdf[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf8bd('0x0'));var util=require(_0xf8bd('0x1'));var logger=require(_0xf8bd('0x2'))(_0xf8bd('0x3'));var moment=require(_0xf8bd('0x4'));var BPromise=require('bluebird');var rp=require(_0xf8bd('0x5'));var fs=require('fs');var path=require(_0xf8bd('0x6'));var rimraf=require(_0xf8bd('0x7'));var config=require(_0xf8bd('0x8'));var attributes=require(_0xf8bd('0x9'));module[_0xf8bd('0xa')]=function(_0x59eff9,_0x4ed701){return _0x59eff9['define'](_0xf8bd('0xb'),attributes,{'tableName':_0xf8bd('0xc'),'paranoid':![],'indexes':[{'name':_0xf8bd('0xd'),'fields':[_0xf8bd('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e94b9,_0x3d10d3,_0x5d59e9){if(_0x1e94b9[_0xf8bd('0xf')]){_0x1e94b9[_0xf8bd('0x10')]=moment()['format'](_0xf8bd('0x11'));}if(_0x1e94b9[_0xf8bd('0x12')]){_0x1e94b9[_0xf8bd('0x13')]=moment()[_0xf8bd('0x14')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5d59e9(null,_0x3d10d3);},'beforeUpdate':function(_0x156e27,_0x136a8b,_0x5ec9ad){if(_0x156e27[_0xf8bd('0x15')]('substatus')){_0x156e27[_0xf8bd('0x10')]=_0x156e27[_0xf8bd('0xf')]?moment()[_0xf8bd('0x14')](_0xf8bd('0x11')):null;}if(_0x156e27[_0xf8bd('0x15')](_0xf8bd('0x12'))){_0x156e27['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x156e27[_0xf8bd('0xf')]=null;_0x156e27[_0xf8bd('0x10')]=null;}_0x5ec9ad(null,_0x156e27);},'afterUpdate':function(_0x54dc30,_0x277123,_0x9d454){var _0x1bd8c6=_0x59eff9[_0xf8bd('0x16')];var _0x54cf43=_0x54dc30[_0xf8bd('0x17')]({'plain':!![]});if(_0x54cf43[_0xf8bd('0x12')]){return _0x1bd8c6['MailMessage'][_0xf8bd('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x54cf43['id']}})[_0xf8bd('0x19')](function(){_0x9d454();})[_0xf8bd('0x1a')](function(_0x207053){_0x9d454(_0x207053);});}else{_0x9d454();}}},'charset':_0xf8bd('0x1b'),'collate':_0xf8bd('0x1c')});}; \ No newline at end of file +var _0xd9dc=['subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models','get','MailMessage','update','then','catch','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x2766b5,_0x4dd625){var _0x4b32d9=function(_0x588d05){while(--_0x588d05){_0x2766b5['push'](_0x2766b5['shift']());}};_0x4b32d9(++_0x4dd625);}(_0xd9dc,0x1be));var _0xcd9d=function(_0xdcfa3,_0x426d85){_0xdcfa3=_0xdcfa3-0x0;var _0x64a7f1=_0xd9dc[_0xdcfa3];return _0x64a7f1;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var logger=require(_0xcd9d('0x1'))('api');var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd9d('0x5'));var config=require(_0xcd9d('0x6'));var attributes=require(_0xcd9d('0x7'));module[_0xcd9d('0x8')]=function(_0x8cc2e4,_0x50f1e2){return _0x8cc2e4[_0xcd9d('0x9')](_0xcd9d('0xa'),attributes,{'tableName':_0xcd9d('0xb'),'paranoid':![],'indexes':[{'name':_0xcd9d('0xc'),'fields':[_0xcd9d('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e6612,_0x114a7c,_0x32dce7){if(_0x1e6612[_0xcd9d('0xe')]){_0x1e6612[_0xcd9d('0xf')]=moment()[_0xcd9d('0x10')](_0xcd9d('0x11'));}if(_0x1e6612[_0xcd9d('0x12')]){_0x1e6612['closedAt']=moment()[_0xcd9d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x32dce7(null,_0x114a7c);},'beforeUpdate':function(_0x2770cf,_0x516686,_0x1ec955){if(_0x2770cf[_0xcd9d('0x13')](_0xcd9d('0xe'))){_0x2770cf['substatusAt']=_0x2770cf[_0xcd9d('0xe')]?moment()['format'](_0xcd9d('0x11')):null;}if(_0x2770cf[_0xcd9d('0x13')](_0xcd9d('0x12'))){_0x2770cf['closedAt']=moment()[_0xcd9d('0x10')](_0xcd9d('0x11'));_0x2770cf['substatus']=null;_0x2770cf[_0xcd9d('0xf')]=null;}_0x1ec955(null,_0x2770cf);},'afterUpdate':function(_0x5a7248,_0x3ea72c,_0x534c8f){var _0x3e5e23=_0x8cc2e4[_0xcd9d('0x14')];var _0x3a66af=_0x5a7248[_0xcd9d('0x15')]({'plain':!![]});if(_0x3a66af[_0xcd9d('0x12')]){return _0x3e5e23[_0xcd9d('0x16')][_0xcd9d('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x3a66af['id']}})[_0xcd9d('0x18')](function(){_0x534c8f();})[_0xcd9d('0x19')](function(_0x55a1a9){_0x534c8f(_0x55a1a9);});}else{_0x534c8f();}}},'charset':_0xcd9d('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 2cdd4f7..03968a2 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 _0x0901=['defaults','redis','socket.io-emitter','./mailInteraction.socket','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x160e99,_0x18c02a){var _0x8193e=function(_0x13af81){while(--_0x13af81){_0x160e99['push'](_0x160e99['shift']());}};_0x8193e(++_0x18c02a);}(_0x0901,0x134));var _0x1090=function(_0x1b4dfb,_0x359b1a){_0x1b4dfb=_0x1b4dfb-0x0;var _0x4e2072=_0x0901[_0x1b4dfb];return _0x4e2072;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var moment=require(_0x1090('0x2'));var BPromise=require(_0x1090('0x3'));var rs=require(_0x1090('0x4'));var fs=require('fs');var Redis=require(_0x1090('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1090('0x6'))(_0x1090('0x7'));var config=require(_0x1090('0x8'));var jayson=require(_0x1090('0x9'));var client=jayson[_0x1090('0xa')][_0x1090('0xb')]({'port':0x232a});config['redis']=_[_0x1090('0xc')](config[_0x1090('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1090('0xe'))(new Redis(config[_0x1090('0xd')]));require(_0x1090('0xf'))['register'](socket);function respondWithRpcPromise(_0x49bba9,_0x48475a,_0x151c1f){return new BPromise(function(_0x6cd20d,_0x3f1d58){return client['request'](_0x49bba9,_0x151c1f)[_0x1090('0x10')](function(_0x5527fd){logger['info'](_0x1090('0x11'),_0x48475a,_0x1090('0x12'));logger[_0x1090('0x13')](_0x1090('0x14'),_0x48475a,_0x1090('0x12'),JSON[_0x1090('0x15')](_0x5527fd));if(_0x5527fd[_0x1090('0x16')]){if(_0x5527fd[_0x1090('0x16')][_0x1090('0x17')]===0x1f4){logger[_0x1090('0x16')](_0x1090('0x11'),_0x48475a,_0x5527fd[_0x1090('0x16')][_0x1090('0x18')]);return _0x3f1d58(_0x5527fd['error'][_0x1090('0x18')]);}logger[_0x1090('0x16')](_0x1090('0x11'),_0x48475a,_0x5527fd['error'][_0x1090('0x18')]);return _0x6cd20d(_0x5527fd[_0x1090('0x16')][_0x1090('0x18')]);}else{logger[_0x1090('0x19')](_0x1090('0x11'),_0x48475a,'request\x20sent');_0x6cd20d(_0x5527fd[_0x1090('0x1a')][_0x1090('0x18')]);}})[_0x1090('0x1b')](function(_0x8c5a68){logger[_0x1090('0x16')](_0x1090('0x11'),_0x48475a,_0x8c5a68);_0x3f1d58(_0x8c5a68);});});}exports[_0x1090('0x1c')]=function(_0x36dd52){var _0x411132=this;return new Promise(function(_0x5ceaa2,_0x57dfc5){return db[_0x1090('0x1d')]['update'](_0x36dd52[_0x1090('0x1e')],{'raw':_0x36dd52[_0x1090('0x1f')]?_0x36dd52[_0x1090('0x1f')][_0x1090('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36dd52[_0x1090('0x1f')]?_0x36dd52[_0x1090('0x1f')][_0x1090('0x21')]||null:null,'attributes':_0x36dd52['options']?_0x36dd52['options'][_0x1090('0x22')]||null:null,'limit':_0x36dd52['options']?_0x36dd52['options']['limit']||null:null})['then'](function(_0x30faba){logger[_0x1090('0x19')]('UpdateMailInteraction',_0x36dd52);logger[_0x1090('0x13')](_0x1090('0x1c'),_0x36dd52,JSON[_0x1090('0x15')](_0x30faba));_0x5ceaa2(_0x30faba);})[_0x1090('0x1b')](function(_0x3a2123){logger['error']('UpdateMailInteraction',_0x3a2123[_0x1090('0x18')],_0x36dd52);_0x57dfc5(_0x411132['error'](0x1f4,_0x3a2123[_0x1090('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x4205a3){return new Promise(function(_0x3a62ce,_0x124ac){return db[_0x1090('0x1d')][_0x1090('0x23')]({'where':_0x4205a3['options']?_0x4205a3[_0x1090('0x1f')][_0x1090('0x21')]||null:null})[_0x1090('0x10')](function(_0x392e61){if(_0x392e61){return _0x392e61[_0x1090('0x24')](_0x4205a3[_0x1090('0x1e')][_0x1090('0x25')],_[_0x1090('0x26')](_0x4205a3[_0x1090('0x1e')],[_0x1090('0x25'),'id'])||{});}})['spread'](function(_0x5d471e){logger[_0x1090('0x19')](_0x1090('0x27'),_0x4205a3);logger[_0x1090('0x13')]('AddTags',_0x4205a3,JSON[_0x1090('0x15')](_0x5d471e));_0x3a62ce(_0x5d471e);})[_0x1090('0x1b')](function(_0x1d3722){logger[_0x1090('0x16')](_0x1090('0x27'),_0x1d3722['message'],_0x4205a3);_0x124ac(_this[_0x1090('0x16')](0x1f4,_0x1d3722[_0x1090('0x18')]));});});}; \ No newline at end of file +var _0x902b=['info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','./mailInteraction.socket','request','then'];(function(_0x56a219,_0x4eacb4){var _0x3c50a0=function(_0x444284){while(--_0x444284){_0x56a219['push'](_0x56a219['shift']());}};_0x3c50a0(++_0x4eacb4);}(_0x902b,0x6a));var _0xb902=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x902b[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var moment=require(_0xb902('0x1'));var BPromise=require(_0xb902('0x2'));var rs=require(_0xb902('0x3'));var fs=require('fs');var Redis=require(_0xb902('0x4'));var db=require(_0xb902('0x5'))['db'];var utils=require(_0xb902('0x6'));var logger=require('../../config/logger')(_0xb902('0x7'));var config=require('../../config/environment');var jayson=require(_0xb902('0x8'));var client=jayson['client'][_0xb902('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb902('0xa')]));require(_0xb902('0xb'))['register'](socket);function respondWithRpcPromise(_0x5a4769,_0xf7d3da,_0x2cfedd){return new BPromise(function(_0x19ea79,_0x1cf8dd){return client[_0xb902('0xc')](_0x5a4769,_0x2cfedd)[_0xb902('0xd')](function(_0x550558){logger[_0xb902('0xe')]('MailInteraction,\x20%s,\x20%s',_0xf7d3da,_0xb902('0xf'));logger[_0xb902('0x10')](_0xb902('0x11'),_0xf7d3da,_0xb902('0xf'),JSON['stringify'](_0x550558));if(_0x550558['error']){if(_0x550558[_0xb902('0x12')][_0xb902('0x13')]===0x1f4){logger['error'](_0xb902('0x14'),_0xf7d3da,_0x550558[_0xb902('0x12')][_0xb902('0x15')]);return _0x1cf8dd(_0x550558[_0xb902('0x12')][_0xb902('0x15')]);}logger[_0xb902('0x12')]('MailInteraction,\x20%s,\x20%s',_0xf7d3da,_0x550558[_0xb902('0x12')][_0xb902('0x15')]);return _0x19ea79(_0x550558[_0xb902('0x12')][_0xb902('0x15')]);}else{logger[_0xb902('0xe')]('MailInteraction,\x20%s,\x20%s',_0xf7d3da,_0xb902('0xf'));_0x19ea79(_0x550558[_0xb902('0x16')][_0xb902('0x15')]);}})[_0xb902('0x17')](function(_0x4a474e){logger[_0xb902('0x12')]('MailInteraction,\x20%s,\x20%s',_0xf7d3da,_0x4a474e);_0x1cf8dd(_0x4a474e);});});}exports[_0xb902('0x18')]=function(_0x11bad2){var _0x13ca9e=this;return new Promise(function(_0x598441,_0x5531fa){return db[_0xb902('0x19')][_0xb902('0x1a')](_0x11bad2[_0xb902('0x1b')],{'raw':_0x11bad2['options']?_0x11bad2[_0xb902('0x1c')][_0xb902('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11bad2[_0xb902('0x1c')]?_0x11bad2[_0xb902('0x1c')][_0xb902('0x1e')]||null:null,'attributes':_0x11bad2[_0xb902('0x1c')]?_0x11bad2[_0xb902('0x1c')][_0xb902('0x1f')]||null:null,'limit':_0x11bad2[_0xb902('0x1c')]?_0x11bad2[_0xb902('0x1c')]['limit']||null:null})[_0xb902('0xd')](function(_0x38b31b){logger[_0xb902('0xe')]('UpdateMailInteraction',_0x11bad2);logger[_0xb902('0x10')]('UpdateMailInteraction',_0x11bad2,JSON[_0xb902('0x20')](_0x38b31b));_0x598441(_0x38b31b);})[_0xb902('0x17')](function(_0x5a7e71){logger[_0xb902('0x12')](_0xb902('0x18'),_0x5a7e71[_0xb902('0x15')],_0x11bad2);_0x5531fa(_0x13ca9e[_0xb902('0x12')](0x1f4,_0x5a7e71['message']));});});};exports[_0xb902('0x21')]=function(_0x115f02){return new Promise(function(_0x731394,_0x54bcbd){return db[_0xb902('0x19')][_0xb902('0x22')]({'where':_0x115f02[_0xb902('0x1c')]?_0x115f02['options']['where']||null:null})[_0xb902('0xd')](function(_0x1ee60d){if(_0x1ee60d){return _0x1ee60d[_0xb902('0x23')](_0x115f02[_0xb902('0x1b')][_0xb902('0x24')],_[_0xb902('0x25')](_0x115f02[_0xb902('0x1b')],['ids','id'])||{});}})[_0xb902('0x26')](function(_0x374667){logger[_0xb902('0xe')]('AddTags',_0x115f02);logger[_0xb902('0x10')](_0xb902('0x27'),_0x115f02,JSON['stringify'](_0x374667));_0x731394(_0x374667);})[_0xb902('0x17')](function(_0x2dcf80){logger[_0xb902('0x12')](_0xb902('0x27'),_0x2dcf80['message'],_0x115f02);_0x54bcbd(_this[_0xb902('0x12')](0x1f4,_0x2dcf80['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 77674fc..34994a1 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 _0x13d5=['update','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x3e3d9c,_0x82c17c){var _0x52f6c1=function(_0x1672a3){while(--_0x1672a3){_0x3e3d9c['push'](_0x3e3d9c['shift']());}};_0x52f6c1(++_0x82c17c);}(_0x13d5,0x17f));var _0x513d=function(_0xbddb64,_0x15e123){_0xbddb64=_0xbddb64-0x0;var _0x3f13df=_0x13d5[_0xbddb64];return _0x3f13df;};'use strict';var MailInteractionEvents=require(_0x513d('0x0'));var events=['save','remove',_0x513d('0x1')];function createListener(_0x4b434b,_0xfe6e2f){return function(_0x4dab0f){_0xfe6e2f['emit'](_0x4b434b,_0x4dab0f);};}function removeListener(_0x11bcea,_0x30b187){return function(){MailInteractionEvents[_0x513d('0x2')](_0x11bcea,_0x30b187);};}exports[_0x513d('0x3')]=function(_0x181b86){for(var _0xf4c5dc=0x0,_0x175152=events[_0x513d('0x4')];_0xf4c5dc<_0x175152;_0xf4c5dc++){var _0x3f8288=events[_0xf4c5dc];var _0x225ff8=createListener(_0x513d('0x5')+_0x3f8288,_0x181b86);MailInteractionEvents['on'](_0x3f8288,_0x225ff8);}}; \ No newline at end of file +var _0x5bba=['save','remove','update','removeListener','register','length','./mailInteraction.events'];(function(_0x42873d,_0x2e5138){var _0x342f75=function(_0x4325b0){while(--_0x4325b0){_0x42873d['push'](_0x42873d['shift']());}};_0x342f75(++_0x2e5138);}(_0x5bba,0xbc));var _0xa5bb=function(_0x3aefae,_0x189cd2){_0x3aefae=_0x3aefae-0x0;var _0x357b84=_0x5bba[_0x3aefae];return _0x357b84;};'use strict';var MailInteractionEvents=require(_0xa5bb('0x0'));var events=[_0xa5bb('0x1'),_0xa5bb('0x2'),_0xa5bb('0x3')];function createListener(_0x35d823,_0x2cd785){return function(_0x2bc37d){_0x2cd785['emit'](_0x35d823,_0x2bc37d);};}function removeListener(_0x3da93f,_0x39b036){return function(){MailInteractionEvents[_0xa5bb('0x4')](_0x3da93f,_0x39b036);};}exports[_0xa5bb('0x5')]=function(_0x4a97d0){for(var _0x471dda=0x0,_0x5a4d43=events[_0xa5bb('0x6')];_0x471dda<_0x5a4d43;_0x471dda++){var _0x21aec0=events[_0x471dda];var _0x161bf5=createListener('mailInteraction:'+_0x21aec0,_0x4a97d0);MailInteractionEvents['on'](_0x21aec0,_0x161bf5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 106cc44..3dc7370 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 _0xf3cd=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0xc072ff,_0x367b9e){var _0x1e2ad2=function(_0x52d1dd){while(--_0x52d1dd){_0xc072ff['push'](_0xc072ff['shift']());}};_0x1e2ad2(++_0x367b9e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0xf3cd[_0x8a30cf];return _0x20f439;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0x11')]('/',auth[_0xdf3c('0x9')](),interaction[_0xdf3c('0x12')](_0xdf3c('0x13'),_0xdf3c('0x14')),controller[_0xdf3c('0x15')]);router[_0xdf3c('0x16')]('/:id',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x17')]);router[_0xdf3c('0x16')](_0xdf3c('0x18'),auth['isAuthenticated'](),controller[_0xdf3c('0x19')]);router[_0xdf3c('0x16')](_0xdf3c('0x1a'),auth['isAuthenticated'](),controller[_0xdf3c('0x1b')]);router[_0xdf3c('0x1c')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1d')]);module[_0xdf3c('0x1e')]=router; \ No newline at end of file +var _0x9c5a=['isAuthenticated','get','/describe','/:id','show','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x5302cf,_0x308b53){var _0x10b32e=function(_0x36a32b){while(--_0x36a32b){_0x5302cf['push'](_0x5302cf['shift']());}};_0x10b32e(++_0x308b53);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x500d24,_0x37047d){_0x500d24=_0x500d24-0x0;var _0x466b03=_0x9c5a[_0x500d24];return _0x466b03;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/download',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa9c5('0xe')](_0xa9c5('0xf'),_0xa9c5('0x10')),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x12')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x12')](_0xa9c5('0x14'),auth['isAuthenticated'](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x12')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x19')]);module[_0xa9c5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8561bfc..bb1d5b1 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 _0x0295=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','long'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0295,0x1f0));var _0x5029=function(_0x105e01,_0x199717){_0x105e01=_0x105e01-0x0;var _0x421f22=_0x0295[_0x105e01];return _0x421f22;};'use strict';var Sequelize=require(_0x5029('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x5029('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x5029('0x2'))},'read':{'type':Sequelize[_0x5029('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5029('0x4')]('in',_0x5029('0x5')),'defaultValue':_0x5029('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5029('0x6')](0x1fe)},'from':{'type':Sequelize[_0x5029('0x6')]},'to':{'type':Sequelize[_0x5029('0x1')](_0x5029('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0x5029('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x5029('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5029('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5029('0x1')](_0x5029('0x7'))},'originCc':{'type':Sequelize[_0x5029('0x1')]('long')}}; \ No newline at end of file +var _0x988c=['sequelize','long','TEXT','medium','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x21a103,_0x2061dd){var _0xbb8463=function(_0x482abd){while(--_0x482abd){_0x21a103['push'](_0x21a103['shift']());}};_0xbb8463(++_0x2061dd);}(_0x988c,0x19e));var _0xc988=function(_0x44ee54,_0x24af37){_0x44ee54=_0x44ee54-0x0;var _0x578d9e=_0x988c[_0x44ee54];return _0x578d9e;};'use strict';var Sequelize=require(_0xc988('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc988('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc988('0x2')](_0xc988('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xc988('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc988('0x5')](0x1fe)},'from':{'type':Sequelize[_0xc988('0x5')]},'to':{'type':Sequelize['TEXT'](_0xc988('0x1'))},'cc':{'type':Sequelize[_0xc988('0x2')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xc988('0x1'))},'subject':{'type':Sequelize[_0xc988('0x2')]},'sentAt':{'type':Sequelize[_0xc988('0x6')]},'attach':{'type':Sequelize[_0xc988('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc988('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xc988('0x2')](_0xc988('0x1'))},'originCc':{'type':Sequelize[_0xc988('0x2')](_0xc988('0x1'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0fd62dc..21bf7dc 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 _0xdb7b=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','http','client','request','then','info','request\x20sent','debug','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','map','MailMessage','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','show','params','keys','find','body','describe','create','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','mail','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','manual','SIP/%s','event','accept','EventManager','UserId','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','channel','rejectmessage','unix','toString','server','files','tmp','subject','createdAt','Attachment','Attachments','from','headers','bcc','Bcc','existsSync','readFileSync','writeFileSync','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto'];(function(_0x31a63a,_0x22513f){var _0x23c8bf=function(_0x13ba52){while(--_0x13ba52){_0x31a63a['push'](_0x31a63a['shift']());}};_0x23c8bf(++_0x22513f);}(_0xdb7b,0x97));var _0xbdb7=function(_0x45b151,_0x80fa33){_0x45b151=_0x45b151-0x0;var _0x27829d=_0xdb7b[_0x45b151];return _0x27829d;};'use strict';var pdf=require(_0xbdb7('0x0'));var emlformat=require(_0xbdb7('0x1'));var rimraf=require(_0xbdb7('0x2'));var zipdir=require(_0xbdb7('0x3'));var jsonpatch=require(_0xbdb7('0x4'));var rp=require('request-promise');var moment=require(_0xbdb7('0x5'));var BPromise=require(_0xbdb7('0x6'));var Mustache=require(_0xbdb7('0x7'));var util=require(_0xbdb7('0x8'));var path=require(_0xbdb7('0x9'));var sox=require('sox');var csv=require(_0xbdb7('0xa'));var ejs=require(_0xbdb7('0xb'));var fs=require('fs');var _=require(_0xbdb7('0xc'));var squel=require('squel');var crypto=require(_0xbdb7('0xd'));var jsforce=require(_0xbdb7('0xe'));var deskjs=require(_0xbdb7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdb7('0x10'));var Papa=require(_0xbdb7('0x11'));var Redis=require('ioredis');var authService=require(_0xbdb7('0x12'));var qs=require(_0xbdb7('0x13'));var as=require(_0xbdb7('0x14'));var hardwareService=require(_0xbdb7('0x15'));var logger=require(_0xbdb7('0x16'))(_0xbdb7('0x17'));var utils=require(_0xbdb7('0x18'));var config=require(_0xbdb7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdb7('0x1a'))['db'];config[_0xbdb7('0x1b')]=_[_0xbdb7('0x1c')](config[_0xbdb7('0x1b')],{'host':_0xbdb7('0x1d'),'port':0x18eb});var socket=require(_0xbdb7('0x1e'))(new Redis(config[_0xbdb7('0x1b')]));require(_0xbdb7('0x1f'))[_0xbdb7('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xbdb7('0x21')]({'port':0x232c});var client9003=jayson[_0xbdb7('0x22')][_0xbdb7('0x21')]({'port':0x232b});var client9002=jayson[_0xbdb7('0x22')][_0xbdb7('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3411b5,_0x4973ec,_0x346ae1,_0x2f3d7d){return new BPromise(function(_0x4106b5,_0x76107){var _0x30d5e4=_0x2f3d7d||client;return _0x30d5e4[_0xbdb7('0x23')](_0x3411b5,_0x346ae1)[_0xbdb7('0x24')](function(_0x598573){logger[_0xbdb7('0x25')]('MailMessage,\x20%s,\x20%s',_0x4973ec,_0xbdb7('0x26'));logger[_0xbdb7('0x27')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4973ec,_0xbdb7('0x26'),JSON['stringify'](_0x598573));if(_0x598573[_0xbdb7('0x28')]){if(_0x598573['error'][_0xbdb7('0x29')]===0x1f4){logger[_0xbdb7('0x28')](_0xbdb7('0x2a'),_0x4973ec,_0x598573['error'][_0xbdb7('0x2b')]);return _0x76107(_0x598573[_0xbdb7('0x28')]['message']);}logger['error'](_0xbdb7('0x2a'),_0x4973ec,_0x598573['error']['message']);return _0x4106b5(_0x598573[_0xbdb7('0x28')][_0xbdb7('0x2b')]);}else{logger[_0xbdb7('0x25')](_0xbdb7('0x2a'),_0x4973ec,_0xbdb7('0x26'));_0x4106b5(_0x598573[_0xbdb7('0x2c')][_0xbdb7('0x2b')]);}})[_0xbdb7('0x2d')](function(_0x2494f2){logger[_0xbdb7('0x28')](_0xbdb7('0x2a'),_0x4973ec,_0x2494f2);_0x76107(_0x2494f2);});});}function respondWithStatusCode(_0x3692c0,_0x4db5d7){_0x4db5d7=_0x4db5d7||0xcc;return function(_0x72d239){if(_0x72d239){return _0x3692c0[_0xbdb7('0x2e')](_0x4db5d7);}return _0x3692c0[_0xbdb7('0x2f')](_0x4db5d7)[_0xbdb7('0x30')]();};}function respondWithResult(_0x292fbd,_0x485101){_0x485101=_0x485101||0xc8;return function(_0x21ab33){if(_0x21ab33){return _0x292fbd[_0xbdb7('0x2f')](_0x485101)[_0xbdb7('0x31')](_0x21ab33);}};}function respondWithFilteredResult(_0x3923fe,_0x345f65){return function(_0x4eb93c){if(_0x4eb93c){var _0x89d0a5=_0x4eb93c[_0xbdb7('0x32')],_0x51c2eb=_0x345f65[_0xbdb7('0x33')],_0x3598b4=_0x345f65['offset']+_0x345f65[_0xbdb7('0x34')],_0x4fcdd0;if(_0x3598b4>=_0x89d0a5){_0x3598b4=_0x89d0a5;_0x4fcdd0=0xc8;}else{_0x4fcdd0=0xce;}_0x3923fe[_0xbdb7('0x2f')](_0x4fcdd0);return _0x3923fe[_0xbdb7('0x35')](_0xbdb7('0x36'),_0x51c2eb+'-'+_0x3598b4+'/'+_0x89d0a5)[_0xbdb7('0x31')](_0x4eb93c);}return null;};}function patchUpdates(_0x2c1b64){return function(_0x56104c){try{jsonpatch[_0xbdb7('0x37')](_0x56104c,_0x2c1b64,!![]);}catch(_0x5859db){return BPromise[_0xbdb7('0x38')](_0x5859db);}return _0x56104c[_0xbdb7('0x39')]();};}function saveUpdates(_0x407831,_0x317d91){return function(_0x4b563b){if(_0x4b563b){return _0x4b563b[_0xbdb7('0x3a')](_0x407831)[_0xbdb7('0x24')](function(_0x3c721d){return _0x3c721d;});}return null;};}function removeEntity(_0x26693c,_0xd2345b){return function(_0x519a44){if(_0x519a44){return _0x519a44[_0xbdb7('0x3b')]()[_0xbdb7('0x24')](function(){_0x26693c[_0xbdb7('0x2f')](0xcc)[_0xbdb7('0x30')]();});}};}function handleEntityNotFound(_0x360f3a,_0x4c99ad){return function(_0x1554eb){if(!_0x1554eb){_0x360f3a[_0xbdb7('0x2e')](0x194);}return _0x1554eb;};}function handleError(_0x45fe2f,_0x1bb252){_0x1bb252=_0x1bb252||0x1f4;return function(_0x5e021d){logger[_0xbdb7('0x28')](_0x5e021d['stack']);if(_0x5e021d[_0xbdb7('0x3c')]){delete _0x5e021d[_0xbdb7('0x3c')];}_0x45fe2f[_0xbdb7('0x2f')](_0x1bb252)['send'](_0x5e021d);};}exports['index']=function(_0x32cba1,_0x2cf7a8){var _0x18d9aa={},_0x1662fb={},_0x5bb532={'count':0x0,'rows':[]};var _0x1cc712=_[_0xbdb7('0x3d')](db[_0xbdb7('0x3e')][_0xbdb7('0x3f')],function(_0x4fa02c){return{'name':_0x4fa02c['fieldName'],'type':_0x4fa02c['type'][_0xbdb7('0x40')]};});_0x1662fb[_0xbdb7('0x41')]=_[_0xbdb7('0x3d')](_0x1cc712,'name');_0x1662fb[_0xbdb7('0x42')]=_['keys'](_0x32cba1[_0xbdb7('0x42')]);_0x1662fb[_0xbdb7('0x43')]=_['intersection'](_0x1662fb[_0xbdb7('0x41')],_0x1662fb['query']);_0x18d9aa[_0xbdb7('0x44')]=_[_0xbdb7('0x45')](_0x1662fb[_0xbdb7('0x41')],qs[_0xbdb7('0x46')](_0x32cba1['query'][_0xbdb7('0x46')]));_0x18d9aa[_0xbdb7('0x44')]=_0x18d9aa[_0xbdb7('0x44')][_0xbdb7('0x47')]?_0x18d9aa[_0xbdb7('0x44')]:_0x1662fb[_0xbdb7('0x41')];if(!_0x32cba1[_0xbdb7('0x42')][_0xbdb7('0x48')](_0xbdb7('0x49'))){_0x18d9aa[_0xbdb7('0x34')]=qs[_0xbdb7('0x34')](_0x32cba1[_0xbdb7('0x42')]['limit']);_0x18d9aa[_0xbdb7('0x33')]=qs[_0xbdb7('0x33')](_0x32cba1[_0xbdb7('0x42')][_0xbdb7('0x33')]);}_0x18d9aa[_0xbdb7('0x4a')]=qs['sort'](_0x32cba1[_0xbdb7('0x42')][_0xbdb7('0x4b')]);_0x18d9aa[_0xbdb7('0x4c')]=qs[_0xbdb7('0x43')](_[_0xbdb7('0x4d')](_0x32cba1[_0xbdb7('0x42')],_0x1662fb[_0xbdb7('0x43')]),_0x1cc712);if(_0x32cba1[_0xbdb7('0x42')][_0xbdb7('0x4e')]){_0x18d9aa[_0xbdb7('0x4c')]=_['merge'](_0x18d9aa[_0xbdb7('0x4c')],{'$or':_[_0xbdb7('0x3d')](_0x1cc712,function(_0x5c1ff5){if(_0x5c1ff5[_0xbdb7('0x4f')]!=='VIRTUAL'){var _0x47d3a1={};_0x47d3a1[_0x5c1ff5[_0xbdb7('0x3c')]]={'$like':'%'+_0x32cba1['query']['filter']+'%'};return _0x47d3a1;}})});}_0x18d9aa=_[_0xbdb7('0x50')]({},_0x18d9aa,_0x32cba1[_0xbdb7('0x51')]);var _0x315f2b={'where':_0x18d9aa[_0xbdb7('0x4c')]};return db[_0xbdb7('0x3e')][_0xbdb7('0x32')](_0x315f2b)[_0xbdb7('0x24')](function(_0x4645ea){_0x5bb532['count']=_0x4645ea;if(_0x32cba1[_0xbdb7('0x42')][_0xbdb7('0x52')]){_0x18d9aa['include']=[{'all':!![]}];}return db['MailMessage'][_0xbdb7('0x53')](_0x18d9aa);})[_0xbdb7('0x24')](function(_0x2293f9){_0x5bb532['rows']=_0x2293f9;return _0x5bb532;})['then'](respondWithFilteredResult(_0x2cf7a8,_0x18d9aa))[_0xbdb7('0x2d')](handleError(_0x2cf7a8,null));};exports[_0xbdb7('0x54')]=function(_0xc3a19e,_0x599c51){var _0x28742b={'raw':!![],'where':{'id':_0xc3a19e[_0xbdb7('0x55')]['id']}},_0x3937c6={};_0x3937c6['model']=_[_0xbdb7('0x56')](db['MailMessage']['rawAttributes']);_0x3937c6[_0xbdb7('0x42')]=_[_0xbdb7('0x56')](_0xc3a19e['query']);_0x3937c6[_0xbdb7('0x43')]=_[_0xbdb7('0x45')](_0x3937c6[_0xbdb7('0x41')],_0x3937c6['query']);_0x28742b['attributes']=_[_0xbdb7('0x45')](_0x3937c6[_0xbdb7('0x41')],qs['fields'](_0xc3a19e[_0xbdb7('0x42')][_0xbdb7('0x46')]));_0x28742b['attributes']=_0x28742b[_0xbdb7('0x44')]['length']?_0x28742b[_0xbdb7('0x44')]:_0x3937c6[_0xbdb7('0x41')];if(_0xc3a19e[_0xbdb7('0x42')]['includeAll']){_0x28742b['include']=[{'all':!![]}];}_0x28742b=_[_0xbdb7('0x50')]({},_0x28742b,_0xc3a19e[_0xbdb7('0x51')]);return db[_0xbdb7('0x3e')][_0xbdb7('0x57')](_0x28742b)['then'](handleEntityNotFound(_0x599c51,null))[_0xbdb7('0x24')](respondWithResult(_0x599c51,null))['catch'](handleError(_0x599c51,null));};exports['update']=function(_0xf6c53,_0x262876){if(_0xf6c53[_0xbdb7('0x58')]['id']){delete _0xf6c53['body']['id'];}return db[_0xbdb7('0x3e')][_0xbdb7('0x57')]({'where':{'id':_0xf6c53[_0xbdb7('0x55')]['id']}})[_0xbdb7('0x24')](handleEntityNotFound(_0x262876,null))[_0xbdb7('0x24')](saveUpdates(_0xf6c53[_0xbdb7('0x58')],null))[_0xbdb7('0x24')](respondWithResult(_0x262876,null))[_0xbdb7('0x2d')](handleError(_0x262876,null));};exports[_0xbdb7('0x3b')]=function(_0x21f763,_0x2ae57d){return db['MailMessage'][_0xbdb7('0x57')]({'where':{'id':_0x21f763['params']['id']}})['then'](handleEntityNotFound(_0x2ae57d,null))[_0xbdb7('0x24')](removeEntity(_0x2ae57d,null))[_0xbdb7('0x2d')](handleError(_0x2ae57d,null));};exports[_0xbdb7('0x59')]=function(_0x493c5a,_0x5f442d){return db['MailMessage']['describe']()[_0xbdb7('0x24')](respondWithResult(_0x5f442d,null))[_0xbdb7('0x2d')](handleError(_0x5f442d,null));};exports['create']=function(_0x3f07b2,_0x4ca3d0){return db[_0xbdb7('0x3e')][_0xbdb7('0x5a')](_0x3f07b2[_0xbdb7('0x58')])[_0xbdb7('0x24')](function(_0x5ddd20){if(_0x5ddd20){if(_0x5ddd20[_0xbdb7('0x5b')]===_0xbdb7('0x5c')&&!_0x5ddd20[_0xbdb7('0x5d')]){var _0x65028c,_0x22b0ab,_0x3c479d;if(_0x3f07b2['body']['to']){_0x22b0ab=_0x3f07b2[_0xbdb7('0x58')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xbdb7('0x5e')]({'where':{'id':_0x5ddd20[_0xbdb7('0x5f')]},'include':[{'model':db[_0xbdb7('0x60')],'as':_0xbdb7('0x61'),'include':[{'model':db[_0xbdb7('0x62')],'as':_0xbdb7('0x63'),'where':{'email':_0x22b0ab},'limit':0x1,'order':[[_0xbdb7('0x64'),_0xbdb7('0x65')]]}]},{'model':db[_0xbdb7('0x66')],'as':_0xbdb7('0x67'),'raw':!![]}]})[_0xbdb7('0x24')](function(_0xc586d2){_0x65028c=_0xc586d2;if(_0x65028c&&_0x65028c['Smtp']){var _0x2ef5be={'tls':{'rejectUnauthorized':![]}};if(_[_0xbdb7('0x68')](_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x69')])){_0x2ef5be['host']=_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x6a')];_0x2ef5be[_0xbdb7('0x6b')]=_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x6b')];_0x2ef5be['secure']=_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x6c')];if(_0x65028c[_0xbdb7('0x67')]['authentication']){_0x2ef5be[_0xbdb7('0x6d')]={'user':_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x6e')],'pass':_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x6f')]};}}else{_0x2ef5be[_0xbdb7('0x69')]=_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x69')];_0x2ef5be[_0xbdb7('0x6d')]={'user':_0x65028c[_0xbdb7('0x67')][_0xbdb7('0x6e')],'pass':_0x65028c[_0xbdb7('0x67')]['pass']};_0x2ef5be[_0xbdb7('0x6c')]=_0x65028c['Smtp'][_0xbdb7('0x6c')];}if(_0x3f07b2[_0xbdb7('0x58')][_0xbdb7('0x70')]&&_0x3f07b2[_0xbdb7('0x58')][_0xbdb7('0x70')][_0xbdb7('0x47')]){for(var _0x113191=0x0;_0x113191<_0x3f07b2[_0xbdb7('0x58')]['attachments'][_0xbdb7('0x47')];_0x113191+=0x1){_0x3f07b2[_0xbdb7('0x58')][_0xbdb7('0x70')][_0x113191]={'filename':_0x3f07b2[_0xbdb7('0x58')][_0xbdb7('0x70')][_0x113191][_0xbdb7('0x3c')],'path':path[_0xbdb7('0x71')](config[_0xbdb7('0x72')],_0xbdb7('0x73'),_0x3f07b2['body'][_0xbdb7('0x70')][_0x113191][_0xbdb7('0x74')])};}}_0x3c479d={'account':_0x2ef5be,'message':_0x3f07b2[_0xbdb7('0x58')]};return;}})[_0xbdb7('0x24')](function(){if(_0x65028c[_0xbdb7('0x61')]){if(_0x65028c[_0xbdb7('0x61')][_0xbdb7('0x63')][_0xbdb7('0x47')]){return _0x65028c[_0xbdb7('0x61')][_0xbdb7('0x63')][0x0];}else{return db[_0xbdb7('0x62')][_0xbdb7('0x5a')](_[_0xbdb7('0x1c')](_0x3f07b2[_0xbdb7('0x58')],{'firstName':_0x3f07b2[_0xbdb7('0x58')]['to'],'email':_0x3f07b2['body']['to'],'phone':_0x3f07b2[_0xbdb7('0x58')]['to'],'ListId':_0x65028c[_0xbdb7('0x75')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xbdb7('0x24')](function(){if(_0x3c479d){return respondWithRpcPromise('SendMail',_0xbdb7('0x76'),_0x3c479d,client9003)[_0xbdb7('0x24')](function(_0x24822c){return _0x5ddd20[_0xbdb7('0x3a')]({'read':!![],'messageId':_0x24822c[_0xbdb7('0x77')],'sentAt':moment()[_0xbdb7('0x78')](_0xbdb7('0x79'))});})[_0xbdb7('0x2d')](function(_0x549393){logger[_0xbdb7('0x28')]('%s',JSON[_0xbdb7('0x7a')](_0x549393));return _0x5ddd20;});}return _0x5ddd20;});}return _0x5ddd20;}})['then'](respondWithResult(_0x4ca3d0,0xc9))[_0xbdb7('0x2d')](handleError(_0x4ca3d0,null));};var interaction_log=require('../../config/logger')(_0xbdb7('0x7b'));exports['accept']=function(_0x44e0ef,_0x4f4892,_0x31d66c){var _0x463682={'channel':_0xbdb7('0x7c')};if(_0x44e0ef[_0xbdb7('0x58')]['id']){delete _0x44e0ef[_0xbdb7('0x58')]['id'];}_0x44e0ef[_0xbdb7('0x58')]['read']=!![];_0x44e0ef['body']['readAt']=moment()['format'](_0xbdb7('0x79'));_0x44e0ef['body']['UserId']=_0x44e0ef[_0xbdb7('0x58')]['UserId']||_0x44e0ef[_0xbdb7('0x6e')]['id'];return db['MailMessage']['find']({'where':{'id':_0x44e0ef[_0xbdb7('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xbdb7('0x62')],'as':_0xbdb7('0x7d')}]})[_0xbdb7('0x24')](handleEntityNotFound(_0x4f4892,null))[_0xbdb7('0x24')](saveUpdates(_0x44e0ef['body'],null))['then'](function(_0x15708f){if(_0x15708f){_0x463682[_0xbdb7('0x2b')]=_0x15708f[_0xbdb7('0x7e')]({'plain':!![]});return db[_0xbdb7('0x7f')][_0xbdb7('0x57')]({'where':{'id':_0x15708f[_0xbdb7('0x80')]}});}return null;})[_0xbdb7('0x24')](handleEntityNotFound(_0x4f4892,null))['then'](function(_0x541cc4){if(_0x541cc4){return _0x541cc4[_0xbdb7('0x3a')]({'UserId':_0x44e0ef['body']['UserId'],'read1stAt':_[_0xbdb7('0x68')](_0x541cc4[_0xbdb7('0x81')])?moment()[_0xbdb7('0x78')](_0xbdb7('0x79')):undefined});}return null;})['then'](function(_0x946e1a){if(_0x946e1a){_0x463682[_0xbdb7('0x82')]=_0x946e1a[_0xbdb7('0x7e')]({'plain':!![]});interaction_log['info'](_0xbdb7('0x83'),_0x44e0ef[_0xbdb7('0x6e')]['id'],_0x44e0ef[_0xbdb7('0x6e')][_0xbdb7('0x3c')],_0x44e0ef[_0xbdb7('0x6e')]['role'],_0x463682[_0xbdb7('0x82')]['id'],_0x44e0ef[_0xbdb7('0x58')]?JSON[_0xbdb7('0x7a')](_0x44e0ef['body']):'null');return respondWithRpcPromise(_0xbdb7('0x84'),_0xbdb7('0x85'),_0x463682);}return null;})[_0xbdb7('0x24')](function(_0x36fdce){if(_0x36fdce){if(_0x44e0ef[_0xbdb7('0x58')][_0xbdb7('0x86')]){_0x463682[_0xbdb7('0x2b')]['interface']=util['format'](_0xbdb7('0x87'),_0x44e0ef[_0xbdb7('0x6e')]['name']);_0x463682[_0xbdb7('0x2b')]['channel']=_0x463682['channel'];_0x463682[_0xbdb7('0x2b')][_0xbdb7('0x88')]=_0xbdb7('0x89');return respondWithRpcPromise(_0xbdb7('0x8a'),_0xbdb7('0x8a'),{'event':'acceptmessage','message':_0x463682[_0xbdb7('0x2b')]},client9002)[_0xbdb7('0x24')](function(){return _0x463682;});}return _0x463682;}return null;})[_0xbdb7('0x24')](respondWithResult(_0x4f4892,null))[_0xbdb7('0x2d')](handleError(_0x4f4892,null));};var interaction_log=require(_0xbdb7('0x16'))(_0xbdb7('0x7b'));exports['reject']=function(_0x111174,_0x628d71,_0x10a9b3){var _0x4cdd05={'agent':{},'channel':'mail'};if(_0x111174['body']['id']){delete _0x111174[_0xbdb7('0x58')]['id'];}_0x111174['body'][_0xbdb7('0x8b')]=_0x111174[_0xbdb7('0x58')][_0xbdb7('0x8b')]||_0x111174[_0xbdb7('0x6e')]['id'];_0x4cdd05[_0xbdb7('0x8c')]['id']=_0x111174[_0xbdb7('0x58')][_0xbdb7('0x8b')];return db[_0xbdb7('0x3e')]['find']({'where':{'id':_0x111174[_0xbdb7('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x628d71,null))['then'](function(_0x2fb090){if(_0x2fb090){_0x4cdd05[_0xbdb7('0x2b')]=_0x2fb090['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x2fb090['MailInteractionId']}});}return null;})[_0xbdb7('0x24')](handleEntityNotFound(_0x628d71,null))[_0xbdb7('0x24')](function(_0xe500c0){if(_0xe500c0){_0x4cdd05[_0xbdb7('0x82')]=_0xe500c0[_0xbdb7('0x7e')]({'plain':!![]});interaction_log[_0xbdb7('0x25')](_0xbdb7('0x8d'),_0x111174[_0xbdb7('0x6e')]['id'],_0x111174['user'][_0xbdb7('0x3c')],_0x111174[_0xbdb7('0x6e')][_0xbdb7('0x8e')],_0x4cdd05['interaction']['id'],_0x111174[_0xbdb7('0x58')]?JSON[_0xbdb7('0x7a')](_0x111174['body']):_0xbdb7('0x8f'));return respondWithRpcPromise(_0xbdb7('0x90'),'rejectMessage',_0x4cdd05);}return null;})[_0xbdb7('0x24')](function(_0x19181d){if(_0x19181d){_0x19181d[_0xbdb7('0x2b')]['interface']=util[_0xbdb7('0x78')](_0xbdb7('0x87'),_0x111174[_0xbdb7('0x6e')]['name']);_0x19181d['message'][_0xbdb7('0x91')]=_0x4cdd05[_0xbdb7('0x91')];_0x19181d[_0xbdb7('0x2b')][_0xbdb7('0x88')]='reject';respondWithRpcPromise(_0xbdb7('0x8a'),_0xbdb7('0x8a'),{'event':_0xbdb7('0x92'),'message':_0x19181d[_0xbdb7('0x2b')]},client9002);return _0x4cdd05;}return null;})[_0xbdb7('0x24')](respondWithResult(_0x628d71,null))[_0xbdb7('0x2d')](handleError(_0x628d71,null));};exports['download']=function(_0x21b3a8,_0x3209d2){var _0x4930df=moment()[_0xbdb7('0x93')]()[_0xbdb7('0x94')]();var _0x58bd03=path['join'](config[_0xbdb7('0x72')],_0xbdb7('0x95'),_0xbdb7('0x96'),_0xbdb7('0x97'));var _0x3d7189=path['join'](config[_0xbdb7('0x72')],_0xbdb7('0x95'),'files','attachments');var _0x6280d7=util[_0xbdb7('0x78')]('message-%s.eml',_0x4930df);return db[_0xbdb7('0x3e')][_0xbdb7('0x57')]({'where':{'id':_0x21b3a8['params']['id']},'attributes':['id',_0xbdb7('0x58'),'from','to','cc','bcc',_0xbdb7('0x98'),_0xbdb7('0x99')],'include':_0x21b3a8[_0xbdb7('0x42')]['attachments']?[{'model':db[_0xbdb7('0x9a')],'as':_0xbdb7('0x9b')}]:undefined})[_0xbdb7('0x24')](handleEntityNotFound(_0x3209d2,null))[_0xbdb7('0x24')](function(_0x46b1d6){if(_0x46b1d6){var _0x5841b8=_0x46b1d6;var _0x5eee48={'from':_0x5841b8[_0xbdb7('0x9c')],'to':_0x5841b8['to'],'subject':_0x5841b8['subject'],'html':_0x5841b8[_0xbdb7('0x58')],'headers':{'Date':moment(_0x5841b8[_0xbdb7('0x99')])[_0xbdb7('0x78')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x46b1d6['cc']){_0x5eee48[_0xbdb7('0x9d')]['Cc']=_0x46b1d6['cc'];}if(_0x46b1d6[_0xbdb7('0x9e')]){_0x5eee48[_0xbdb7('0x9d')][_0xbdb7('0x9f')]=_0x46b1d6[_0xbdb7('0x9e')];}return new BPromise(function(_0xff2713,_0x4d6ba3){if(_0x46b1d6[_0xbdb7('0x9b')]){for(var _0x36c391=0x0;_0x36c391<_0x46b1d6[_0xbdb7('0x9b')]['length'];_0x36c391++){var _0x489eee=_0x46b1d6[_0xbdb7('0x9b')][_0x36c391];var _0x55173e=path['join'](_0x3d7189,_0x489eee['basename']);if(fs[_0xbdb7('0xa0')](_0x55173e)){_0x5eee48[_0xbdb7('0x70')]['push']({'name':_0x489eee[_0xbdb7('0x3c')],'contentType':_0x489eee[_0xbdb7('0x4f')],'data':fs[_0xbdb7('0xa1')](_0x55173e)});}}}emlformat['build'](_0x5eee48,function(_0x4a0124,_0x24ce0f){if(_0x4a0124)return _0x4d6ba3(_0x4a0124);fs[_0xbdb7('0xa2')](path['join'](_0x58bd03,_0x6280d7),_0x24ce0f);return _0xff2713(_0x24ce0f);});});}})[_0xbdb7('0x24')](function(_0x187ff1){if(_0x187ff1){return _0x3209d2['download'](path[_0xbdb7('0x71')](_0x58bd03,_0x6280d7),_0x6280d7,function(_0x457ec7){if(_0x457ec7){console[_0xbdb7('0xa3')](_0xbdb7('0xa4'),_0x457ec7);}else{fs['unlinkSync'](path['join'](_0x58bd03,_0x6280d7));}});}})[_0xbdb7('0x2d')](handleError(_0x3209d2,null));}; \ No newline at end of file +var _0xfde6=['request','then','info','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','body','find','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','service','attachments','join','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','agent','RejectMessage','rejectMessage','interface','rejectmessage','download','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','createdAt','headers','Bcc','basename','existsSync','writeFileSync','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','client','http'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xfde6,0x12a));var _0x6fde=function(_0x4617a4,_0x1f8ebd){_0x4617a4=_0x4617a4-0x0;var _0x5b64a1=_0xfde6[_0x4617a4];return _0x5b64a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6fde('0x0'));var rimraf=require(_0x6fde('0x1'));var zipdir=require(_0x6fde('0x2'));var jsonpatch=require(_0x6fde('0x3'));var rp=require('request-promise');var moment=require(_0x6fde('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6fde('0x5'));var path=require(_0x6fde('0x6'));var sox=require(_0x6fde('0x7'));var csv=require(_0x6fde('0x8'));var ejs=require(_0x6fde('0x9'));var fs=require('fs');var _=require(_0x6fde('0xa'));var squel=require(_0x6fde('0xb'));var crypto=require('crypto');var jsforce=require(_0x6fde('0xc'));var deskjs=require(_0x6fde('0xd'));var toCsv=require(_0x6fde('0x8'));var querystring=require(_0x6fde('0xe'));var Papa=require(_0x6fde('0xf'));var Redis=require(_0x6fde('0x10'));var authService=require(_0x6fde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6fde('0x12'));var hardwareService=require(_0x6fde('0x13'));var logger=require(_0x6fde('0x14'))(_0x6fde('0x15'));var utils=require(_0x6fde('0x16'));var config=require(_0x6fde('0x17'));var licenseUtil=require(_0x6fde('0x18'));var db=require(_0x6fde('0x19'))['db'];config['redis']=_[_0x6fde('0x1a')](config[_0x6fde('0x1b')],{'host':_0x6fde('0x1c'),'port':0x18eb});var socket=require(_0x6fde('0x1d'))(new Redis(config[_0x6fde('0x1b')]));require(_0x6fde('0x1e'))[_0x6fde('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6fde('0x20')][_0x6fde('0x21')]({'port':0x232c});var client9003=jayson[_0x6fde('0x20')][_0x6fde('0x21')]({'port':0x232b});var client9002=jayson['client'][_0x6fde('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5048df,_0x438823,_0x153387,_0x1ca62e){return new BPromise(function(_0x1bfb06,_0x274f62){var _0x13ab3b=_0x1ca62e||client;return _0x13ab3b[_0x6fde('0x22')](_0x5048df,_0x153387)[_0x6fde('0x23')](function(_0x289e96){logger[_0x6fde('0x24')](_0x6fde('0x25'),_0x438823,'request\x20sent');logger[_0x6fde('0x26')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x438823,_0x6fde('0x27'),JSON[_0x6fde('0x28')](_0x289e96));if(_0x289e96['error']){if(_0x289e96[_0x6fde('0x29')]['code']===0x1f4){logger['error'](_0x6fde('0x25'),_0x438823,_0x289e96['error']['message']);return _0x274f62(_0x289e96['error'][_0x6fde('0x2a')]);}logger[_0x6fde('0x29')](_0x6fde('0x25'),_0x438823,_0x289e96[_0x6fde('0x29')][_0x6fde('0x2a')]);return _0x1bfb06(_0x289e96[_0x6fde('0x29')][_0x6fde('0x2a')]);}else{logger[_0x6fde('0x24')]('MailMessage,\x20%s,\x20%s',_0x438823,'request\x20sent');_0x1bfb06(_0x289e96['result'][_0x6fde('0x2a')]);}})['catch'](function(_0x3fc13d){logger['error'](_0x6fde('0x25'),_0x438823,_0x3fc13d);_0x274f62(_0x3fc13d);});});}function respondWithStatusCode(_0x47cdfd,_0x186fda){_0x186fda=_0x186fda||0xcc;return function(_0x288f7b){if(_0x288f7b){return _0x47cdfd[_0x6fde('0x2b')](_0x186fda);}return _0x47cdfd[_0x6fde('0x2c')](_0x186fda)[_0x6fde('0x2d')]();};}function respondWithResult(_0x24dc98,_0x3783f3){_0x3783f3=_0x3783f3||0xc8;return function(_0x3e8580){if(_0x3e8580){return _0x24dc98['status'](_0x3783f3)['json'](_0x3e8580);}};}function respondWithFilteredResult(_0x181345,_0x1f5b6b){return function(_0x3f0765){if(_0x3f0765){var _0x712c00=_0x3f0765[_0x6fde('0x2e')],_0x2b9cb3=_0x1f5b6b[_0x6fde('0x2f')],_0x52e83a=_0x1f5b6b['offset']+_0x1f5b6b[_0x6fde('0x30')],_0xa2d474;if(_0x52e83a>=_0x712c00){_0x52e83a=_0x712c00;_0xa2d474=0xc8;}else{_0xa2d474=0xce;}_0x181345['status'](_0xa2d474);return _0x181345[_0x6fde('0x31')](_0x6fde('0x32'),_0x2b9cb3+'-'+_0x52e83a+'/'+_0x712c00)['json'](_0x3f0765);}return null;};}function patchUpdates(_0x4aa7ed){return function(_0x9d8684){try{jsonpatch[_0x6fde('0x33')](_0x9d8684,_0x4aa7ed,!![]);}catch(_0x546eb7){return BPromise[_0x6fde('0x34')](_0x546eb7);}return _0x9d8684[_0x6fde('0x35')]();};}function saveUpdates(_0x87e4a9,_0x83f87c){return function(_0x8850f3){if(_0x8850f3){return _0x8850f3[_0x6fde('0x36')](_0x87e4a9)[_0x6fde('0x23')](function(_0x507827){return _0x507827;});}return null;};}function removeEntity(_0x35f82d,_0xbf07f7){return function(_0xb1a9d8){if(_0xb1a9d8){return _0xb1a9d8[_0x6fde('0x37')]()['then'](function(){_0x35f82d[_0x6fde('0x2c')](0xcc)[_0x6fde('0x2d')]();});}};}function handleEntityNotFound(_0x5dcfd6,_0x279151){return function(_0x480f87){if(!_0x480f87){_0x5dcfd6['sendStatus'](0x194);}return _0x480f87;};}function handleError(_0x25703b,_0x2b3ff9){_0x2b3ff9=_0x2b3ff9||0x1f4;return function(_0x4a41e8){logger[_0x6fde('0x29')](_0x4a41e8['stack']);if(_0x4a41e8[_0x6fde('0x38')]){delete _0x4a41e8[_0x6fde('0x38')];}_0x25703b[_0x6fde('0x2c')](_0x2b3ff9)[_0x6fde('0x39')](_0x4a41e8);};}exports[_0x6fde('0x3a')]=function(_0x5f095a,_0x1e9b3f){var _0x3db587={},_0x159be4={},_0x11bcec={'count':0x0,'rows':[]};var _0x38cc58=_['map'](db[_0x6fde('0x3b')][_0x6fde('0x3c')],function(_0xc2c320){return{'name':_0xc2c320[_0x6fde('0x3d')],'type':_0xc2c320[_0x6fde('0x3e')][_0x6fde('0x3f')]};});_0x159be4[_0x6fde('0x40')]=_[_0x6fde('0x41')](_0x38cc58,_0x6fde('0x38'));_0x159be4[_0x6fde('0x42')]=_['keys'](_0x5f095a[_0x6fde('0x42')]);_0x159be4[_0x6fde('0x43')]=_[_0x6fde('0x44')](_0x159be4['model'],_0x159be4[_0x6fde('0x42')]);_0x3db587[_0x6fde('0x45')]=_[_0x6fde('0x44')](_0x159be4[_0x6fde('0x40')],qs['fields'](_0x5f095a['query'][_0x6fde('0x46')]));_0x3db587[_0x6fde('0x45')]=_0x3db587[_0x6fde('0x45')][_0x6fde('0x47')]?_0x3db587['attributes']:_0x159be4[_0x6fde('0x40')];if(!_0x5f095a['query']['hasOwnProperty'](_0x6fde('0x48'))){_0x3db587['limit']=qs['limit'](_0x5f095a[_0x6fde('0x42')][_0x6fde('0x30')]);_0x3db587[_0x6fde('0x2f')]=qs[_0x6fde('0x2f')](_0x5f095a[_0x6fde('0x42')][_0x6fde('0x2f')]);}_0x3db587[_0x6fde('0x49')]=qs['sort'](_0x5f095a['query'][_0x6fde('0x4a')]);_0x3db587[_0x6fde('0x4b')]=qs[_0x6fde('0x43')](_['pick'](_0x5f095a['query'],_0x159be4[_0x6fde('0x43')]),_0x38cc58);if(_0x5f095a[_0x6fde('0x42')][_0x6fde('0x4c')]){_0x3db587['where']=_[_0x6fde('0x4d')](_0x3db587[_0x6fde('0x4b')],{'$or':_[_0x6fde('0x41')](_0x38cc58,function(_0x473a0a){if(_0x473a0a[_0x6fde('0x3e')]!==_0x6fde('0x4e')){var _0x2e18bd={};_0x2e18bd[_0x473a0a[_0x6fde('0x38')]]={'$like':'%'+_0x5f095a[_0x6fde('0x42')][_0x6fde('0x4c')]+'%'};return _0x2e18bd;}})});}_0x3db587=_[_0x6fde('0x4d')]({},_0x3db587,_0x5f095a['options']);var _0x3802ef={'where':_0x3db587['where']};return db[_0x6fde('0x3b')]['count'](_0x3802ef)[_0x6fde('0x23')](function(_0x49ef2d){_0x11bcec[_0x6fde('0x2e')]=_0x49ef2d;if(_0x5f095a[_0x6fde('0x42')][_0x6fde('0x4f')]){_0x3db587[_0x6fde('0x50')]=[{'all':!![]}];}return db[_0x6fde('0x3b')][_0x6fde('0x51')](_0x3db587);})[_0x6fde('0x23')](function(_0x57508c){_0x11bcec[_0x6fde('0x52')]=_0x57508c;return _0x11bcec;})['then'](respondWithFilteredResult(_0x1e9b3f,_0x3db587))[_0x6fde('0x53')](handleError(_0x1e9b3f,null));};exports[_0x6fde('0x54')]=function(_0x18767e,_0x322f57){var _0x16539e={'raw':!![],'where':{'id':_0x18767e[_0x6fde('0x55')]['id']}},_0xa51a1f={};_0xa51a1f[_0x6fde('0x40')]=_[_0x6fde('0x56')](db['MailMessage'][_0x6fde('0x3c')]);_0xa51a1f[_0x6fde('0x42')]=_[_0x6fde('0x56')](_0x18767e['query']);_0xa51a1f[_0x6fde('0x43')]=_['intersection'](_0xa51a1f['model'],_0xa51a1f['query']);_0x16539e[_0x6fde('0x45')]=_[_0x6fde('0x44')](_0xa51a1f['model'],qs[_0x6fde('0x46')](_0x18767e['query'][_0x6fde('0x46')]));_0x16539e[_0x6fde('0x45')]=_0x16539e['attributes'][_0x6fde('0x47')]?_0x16539e[_0x6fde('0x45')]:_0xa51a1f[_0x6fde('0x40')];if(_0x18767e[_0x6fde('0x42')][_0x6fde('0x4f')]){_0x16539e[_0x6fde('0x50')]=[{'all':!![]}];}_0x16539e=_[_0x6fde('0x4d')]({},_0x16539e,_0x18767e['options']);return db[_0x6fde('0x3b')]['find'](_0x16539e)['then'](handleEntityNotFound(_0x322f57,null))[_0x6fde('0x23')](respondWithResult(_0x322f57,null))[_0x6fde('0x53')](handleError(_0x322f57,null));};exports[_0x6fde('0x36')]=function(_0x3fecbf,_0x4a46a1){if(_0x3fecbf[_0x6fde('0x57')]['id']){delete _0x3fecbf['body']['id'];}return db[_0x6fde('0x3b')][_0x6fde('0x58')]({'where':{'id':_0x3fecbf[_0x6fde('0x55')]['id']}})[_0x6fde('0x23')](handleEntityNotFound(_0x4a46a1,null))['then'](saveUpdates(_0x3fecbf[_0x6fde('0x57')],null))[_0x6fde('0x23')](respondWithResult(_0x4a46a1,null))[_0x6fde('0x53')](handleError(_0x4a46a1,null));};exports['destroy']=function(_0x8d7581,_0x310b78){return db[_0x6fde('0x3b')][_0x6fde('0x58')]({'where':{'id':_0x8d7581[_0x6fde('0x55')]['id']}})['then'](handleEntityNotFound(_0x310b78,null))['then'](removeEntity(_0x310b78,null))[_0x6fde('0x53')](handleError(_0x310b78,null));};exports[_0x6fde('0x59')]=function(_0x4357b7,_0x18b6cd){return db[_0x6fde('0x3b')][_0x6fde('0x59')]()['then'](respondWithResult(_0x18b6cd,null))['catch'](handleError(_0x18b6cd,null));};exports[_0x6fde('0x5a')]=function(_0x1cd772,_0x30aaad){return db[_0x6fde('0x3b')][_0x6fde('0x5a')](_0x1cd772[_0x6fde('0x57')])[_0x6fde('0x23')](function(_0x3f4b9a){if(_0x3f4b9a){if(_0x3f4b9a[_0x6fde('0x5b')]==='out'&&!_0x3f4b9a[_0x6fde('0x5c')]){var _0x47c3cb,_0x48bdac,_0x5e6bc;if(_0x1cd772[_0x6fde('0x57')]['to']){_0x48bdac=_0x1cd772[_0x6fde('0x57')]['to'][_0x6fde('0x5d')](',')[0x0];}return db[_0x6fde('0x5e')][_0x6fde('0x5f')]({'where':{'id':_0x3f4b9a[_0x6fde('0x60')]},'include':[{'model':db[_0x6fde('0x61')],'as':_0x6fde('0x62'),'include':[{'model':db[_0x6fde('0x63')],'as':_0x6fde('0x64'),'where':{'email':_0x48bdac},'limit':0x1,'order':[[_0x6fde('0x65'),'DESC']]}]},{'model':db[_0x6fde('0x66')],'as':_0x6fde('0x67'),'raw':!![]}]})[_0x6fde('0x23')](function(_0x1882de){_0x47c3cb=_0x1882de;if(_0x47c3cb&&_0x47c3cb[_0x6fde('0x67')]){var _0x57025d={'tls':{'rejectUnauthorized':![]}};if(_[_0x6fde('0x68')](_0x47c3cb['Smtp']['service'])){_0x57025d[_0x6fde('0x69')]=_0x47c3cb['Smtp'][_0x6fde('0x69')];_0x57025d[_0x6fde('0x6a')]=_0x47c3cb[_0x6fde('0x67')][_0x6fde('0x6a')];_0x57025d[_0x6fde('0x6b')]=_0x47c3cb[_0x6fde('0x67')]['secure'];if(_0x47c3cb[_0x6fde('0x67')][_0x6fde('0x6c')]){_0x57025d[_0x6fde('0x6d')]={'user':_0x47c3cb[_0x6fde('0x67')][_0x6fde('0x6e')],'pass':_0x47c3cb[_0x6fde('0x67')]['pass']};}}else{_0x57025d[_0x6fde('0x6f')]=_0x47c3cb['Smtp']['service'];_0x57025d['auth']={'user':_0x47c3cb[_0x6fde('0x67')][_0x6fde('0x6e')],'pass':_0x47c3cb[_0x6fde('0x67')]['pass']};_0x57025d['secure']=_0x47c3cb['Smtp'][_0x6fde('0x6b')];}if(_0x1cd772['body'][_0x6fde('0x70')]&&_0x1cd772[_0x6fde('0x57')][_0x6fde('0x70')][_0x6fde('0x47')]){for(var _0xbebfcd=0x0;_0xbebfcd<_0x1cd772['body'][_0x6fde('0x70')][_0x6fde('0x47')];_0xbebfcd+=0x1){_0x1cd772[_0x6fde('0x57')]['attachments'][_0xbebfcd]={'filename':_0x1cd772['body']['attachments'][_0xbebfcd][_0x6fde('0x38')],'path':path[_0x6fde('0x71')](config[_0x6fde('0x72')],_0x6fde('0x73'),_0x1cd772[_0x6fde('0x57')]['attachments'][_0xbebfcd]['basename'])};}}_0x5e6bc={'account':_0x57025d,'message':_0x1cd772['body']};return;}})[_0x6fde('0x23')](function(){if(_0x47c3cb[_0x6fde('0x62')]){if(_0x47c3cb[_0x6fde('0x62')][_0x6fde('0x64')][_0x6fde('0x47')]){return _0x47c3cb[_0x6fde('0x62')][_0x6fde('0x64')][0x0];}else{return db['CmContact'][_0x6fde('0x5a')](_[_0x6fde('0x1a')](_0x1cd772['body'],{'firstName':_0x1cd772[_0x6fde('0x57')]['to'],'email':_0x1cd772[_0x6fde('0x57')]['to'],'phone':_0x1cd772[_0x6fde('0x57')]['to'],'ListId':_0x47c3cb[_0x6fde('0x74')]}));}}else{throw new Error(_0x6fde('0x75'));}})[_0x6fde('0x23')](function(){if(_0x5e6bc){return respondWithRpcPromise(_0x6fde('0x76'),'sendMail',_0x5e6bc,client9003)[_0x6fde('0x23')](function(_0xa601a0){return _0x3f4b9a['update']({'read':!![],'messageId':_0xa601a0[_0x6fde('0x77')],'sentAt':moment()[_0x6fde('0x78')](_0x6fde('0x79'))});})[_0x6fde('0x53')](function(_0x25a2e5){logger[_0x6fde('0x29')]('%s',JSON['stringify'](_0x25a2e5));return _0x3f4b9a;});}return _0x3f4b9a;});}return _0x3f4b9a;}})[_0x6fde('0x23')](respondWithResult(_0x30aaad,0xc9))[_0x6fde('0x53')](handleError(_0x30aaad,null));};var interaction_log=require('../../config/logger')(_0x6fde('0x7a'));exports[_0x6fde('0x7b')]=function(_0x51a5e7,_0x1ef5fe,_0x2e94a0){var _0x4afd0b={'channel':_0x6fde('0x7c')};if(_0x51a5e7[_0x6fde('0x57')]['id']){delete _0x51a5e7[_0x6fde('0x57')]['id'];}_0x51a5e7['body'][_0x6fde('0x7d')]=!![];_0x51a5e7[_0x6fde('0x57')][_0x6fde('0x7e')]=moment()['format'](_0x6fde('0x79'));_0x51a5e7[_0x6fde('0x57')][_0x6fde('0x7f')]=_0x51a5e7[_0x6fde('0x57')][_0x6fde('0x7f')]||_0x51a5e7['user']['id'];return db[_0x6fde('0x3b')][_0x6fde('0x58')]({'where':{'id':_0x51a5e7[_0x6fde('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6fde('0x80')}]})[_0x6fde('0x23')](handleEntityNotFound(_0x1ef5fe,null))[_0x6fde('0x23')](saveUpdates(_0x51a5e7[_0x6fde('0x57')],null))[_0x6fde('0x23')](function(_0x1864b7){if(_0x1864b7){_0x4afd0b['message']=_0x1864b7[_0x6fde('0x81')]({'plain':!![]});return db[_0x6fde('0x82')][_0x6fde('0x58')]({'where':{'id':_0x1864b7[_0x6fde('0x83')]}});}return null;})[_0x6fde('0x23')](handleEntityNotFound(_0x1ef5fe,null))[_0x6fde('0x23')](function(_0x1613cb){if(_0x1613cb){return _0x1613cb[_0x6fde('0x36')]({'UserId':_0x51a5e7[_0x6fde('0x57')][_0x6fde('0x7f')],'read1stAt':_[_0x6fde('0x68')](_0x1613cb['read1stAt'])?moment()[_0x6fde('0x78')](_0x6fde('0x79')):undefined});}return null;})['then'](function(_0x218bd3){if(_0x218bd3){_0x4afd0b[_0x6fde('0x84')]=_0x218bd3[_0x6fde('0x81')]({'plain':!![]});interaction_log[_0x6fde('0x24')](_0x6fde('0x85'),_0x51a5e7[_0x6fde('0x6e')]['id'],_0x51a5e7[_0x6fde('0x6e')]['name'],_0x51a5e7['user'][_0x6fde('0x86')],_0x4afd0b[_0x6fde('0x84')]['id'],_0x51a5e7['body']?JSON[_0x6fde('0x28')](_0x51a5e7[_0x6fde('0x57')]):_0x6fde('0x87'));return respondWithRpcPromise(_0x6fde('0x88'),'acceptMessage',_0x4afd0b);}return null;})[_0x6fde('0x23')](function(_0x2c091e){if(_0x2c091e){if(_0x51a5e7[_0x6fde('0x57')]['manual']){_0x4afd0b[_0x6fde('0x2a')]['interface']=util[_0x6fde('0x78')](_0x6fde('0x89'),_0x51a5e7[_0x6fde('0x6e')]['name']);_0x4afd0b[_0x6fde('0x2a')]['channel']=_0x4afd0b[_0x6fde('0x8a')];_0x4afd0b['message'][_0x6fde('0x8b')]=_0x6fde('0x7b');return respondWithRpcPromise(_0x6fde('0x8c'),_0x6fde('0x8c'),{'event':_0x6fde('0x8d'),'message':_0x4afd0b['message']},client9002)[_0x6fde('0x23')](function(){return _0x4afd0b;});}return _0x4afd0b;}return null;})[_0x6fde('0x23')](respondWithResult(_0x1ef5fe,null))[_0x6fde('0x53')](handleError(_0x1ef5fe,null));};var interaction_log=require(_0x6fde('0x14'))(_0x6fde('0x7a'));exports['reject']=function(_0xd4c933,_0x2bd49f,_0x20ac2e){var _0x265910={'agent':{},'channel':'mail'};if(_0xd4c933[_0x6fde('0x57')]['id']){delete _0xd4c933['body']['id'];}_0xd4c933[_0x6fde('0x57')][_0x6fde('0x7f')]=_0xd4c933['body'][_0x6fde('0x7f')]||_0xd4c933[_0x6fde('0x6e')]['id'];_0x265910[_0x6fde('0x8e')]['id']=_0xd4c933['body'][_0x6fde('0x7f')];return db[_0x6fde('0x3b')][_0x6fde('0x58')]({'where':{'id':_0xd4c933[_0x6fde('0x55')]['id'],'UserId':null}})[_0x6fde('0x23')](handleEntityNotFound(_0x2bd49f,null))[_0x6fde('0x23')](function(_0x183cda){if(_0x183cda){_0x265910[_0x6fde('0x2a')]=_0x183cda[_0x6fde('0x81')]({'plain':!![]});return db[_0x6fde('0x82')][_0x6fde('0x58')]({'where':{'id':_0x183cda[_0x6fde('0x83')]}});}return null;})[_0x6fde('0x23')](handleEntityNotFound(_0x2bd49f,null))[_0x6fde('0x23')](function(_0x5034b6){if(_0x5034b6){_0x265910['interaction']=_0x5034b6[_0x6fde('0x81')]({'plain':!![]});interaction_log[_0x6fde('0x24')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd4c933[_0x6fde('0x6e')]['id'],_0xd4c933['user'][_0x6fde('0x38')],_0xd4c933[_0x6fde('0x6e')][_0x6fde('0x86')],_0x265910['interaction']['id'],_0xd4c933['body']?JSON[_0x6fde('0x28')](_0xd4c933[_0x6fde('0x57')]):'null');return respondWithRpcPromise(_0x6fde('0x8f'),_0x6fde('0x90'),_0x265910);}return null;})['then'](function(_0x311ecb){if(_0x311ecb){_0x311ecb[_0x6fde('0x2a')][_0x6fde('0x91')]=util[_0x6fde('0x78')](_0x6fde('0x89'),_0xd4c933[_0x6fde('0x6e')]['name']);_0x311ecb[_0x6fde('0x2a')][_0x6fde('0x8a')]=_0x265910['channel'];_0x311ecb[_0x6fde('0x2a')][_0x6fde('0x8b')]=_0x6fde('0x34');respondWithRpcPromise(_0x6fde('0x8c'),_0x6fde('0x8c'),{'event':_0x6fde('0x92'),'message':_0x311ecb[_0x6fde('0x2a')]},client9002);return _0x265910;}return null;})[_0x6fde('0x23')](respondWithResult(_0x2bd49f,null))[_0x6fde('0x53')](handleError(_0x2bd49f,null));};exports[_0x6fde('0x93')]=function(_0x2249a3,_0x3d8df7){var _0x12266b=moment()['unix']()['toString']();var _0x10899a=path[_0x6fde('0x71')](config[_0x6fde('0x72')],_0x6fde('0x94'),_0x6fde('0x95'),_0x6fde('0x96'));var _0x282617=path[_0x6fde('0x71')](config[_0x6fde('0x72')],'server',_0x6fde('0x95'),'attachments');var _0x3ded32=util[_0x6fde('0x78')](_0x6fde('0x97'),_0x12266b);return db[_0x6fde('0x3b')][_0x6fde('0x58')]({'where':{'id':_0x2249a3[_0x6fde('0x55')]['id']},'attributes':['id',_0x6fde('0x57'),_0x6fde('0x98'),'to','cc',_0x6fde('0x99'),_0x6fde('0x9a'),'createdAt'],'include':_0x2249a3[_0x6fde('0x42')]['attachments']?[{'model':db[_0x6fde('0x9b')],'as':_0x6fde('0x9c')}]:undefined})[_0x6fde('0x23')](handleEntityNotFound(_0x3d8df7,null))[_0x6fde('0x23')](function(_0x544693){if(_0x544693){var _0x4c1032=_0x544693;var _0x28cd01={'from':_0x4c1032['from'],'to':_0x4c1032['to'],'subject':_0x4c1032[_0x6fde('0x9a')],'html':_0x4c1032[_0x6fde('0x57')],'headers':{'Date':moment(_0x4c1032[_0x6fde('0x9d')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x544693['cc']){_0x28cd01[_0x6fde('0x9e')]['Cc']=_0x544693['cc'];}if(_0x544693['bcc']){_0x28cd01[_0x6fde('0x9e')][_0x6fde('0x9f')]=_0x544693[_0x6fde('0x99')];}return new BPromise(function(_0x1e1ae4,_0x32879f){if(_0x544693[_0x6fde('0x9c')]){for(var _0x2b49a8=0x0;_0x2b49a8<_0x544693[_0x6fde('0x9c')][_0x6fde('0x47')];_0x2b49a8++){var _0x3b9947=_0x544693[_0x6fde('0x9c')][_0x2b49a8];var _0x14cf99=path[_0x6fde('0x71')](_0x282617,_0x3b9947[_0x6fde('0xa0')]);if(fs[_0x6fde('0xa1')](_0x14cf99)){_0x28cd01['attachments']['push']({'name':_0x3b9947[_0x6fde('0x38')],'contentType':_0x3b9947[_0x6fde('0x3e')],'data':fs['readFileSync'](_0x14cf99)});}}}emlformat['build'](_0x28cd01,function(_0xd73cac,_0x2461ee){if(_0xd73cac)return _0x32879f(_0xd73cac);fs[_0x6fde('0xa2')](path['join'](_0x10899a,_0x3ded32),_0x2461ee);return _0x1e1ae4(_0x2461ee);});});}})['then'](function(_0x582c3b){if(_0x582c3b){return _0x3d8df7[_0x6fde('0x93')](path['join'](_0x10899a,_0x3ded32),_0x3ded32,function(_0x547c0f){if(_0x547c0f){console[_0x6fde('0xa3')](_0x6fde('0xa4'),_0x547c0f);}else{fs[_0x6fde('0xa5')](path[_0x6fde('0x71')](_0x10899a,_0x3ded32));}});}})[_0x6fde('0x53')](handleError(_0x3d8df7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d6ef220..da3f276 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 _0x5982=['events','../../mysqldb','MailMessage','save','update','remove','emit','hook'];(function(_0x1ad260,_0x13e8c7){var _0x16fd6d=function(_0x48a434){while(--_0x48a434){_0x1ad260['push'](_0x1ad260['shift']());}};_0x16fd6d(++_0x13e8c7);}(_0x5982,0xa8));var _0x2598=function(_0x5be050,_0x489a77){_0x5be050=_0x5be050-0x0;var _0x4366fe=_0x5982[_0x5be050];return _0x4366fe;};'use strict';var EventEmitter=require(_0x2598('0x0'));var MailMessage=require(_0x2598('0x1'))['db'][_0x2598('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2598('0x3'),'afterUpdate':_0x2598('0x4'),'afterDestroy':_0x2598('0x5')};function emitEvent(_0x4d8a8f){return function(_0x10b690,_0x5cdaba,_0x449e50){MailMessageEvents[_0x2598('0x6')](_0x4d8a8f+':'+_0x10b690['id'],_0x10b690);MailMessageEvents[_0x2598('0x6')](_0x4d8a8f,_0x10b690);_0x449e50(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x2598('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x64b2=['save','remove','emit','events','MailMessage','setMaxListeners'];(function(_0x198f36,_0x4ccbaa){var _0x4d8fe4=function(_0x557aaa){while(--_0x557aaa){_0x198f36['push'](_0x198f36['shift']());}};_0x4d8fe4(++_0x4ccbaa);}(_0x64b2,0x69));var _0x264b=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x64b2[_0x2f1762];return _0x8ab21;};'use strict';var EventEmitter=require(_0x264b('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x264b('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x264b('0x2')](0x0);var events={'afterCreate':_0x264b('0x3'),'afterUpdate':'update','afterDestroy':_0x264b('0x4')};function emitEvent(_0x19bc57){return function(_0x457c9c,_0x38222a,_0x2187a8){MailMessageEvents[_0x264b('0x5')](_0x19bc57+':'+_0x457c9c['id'],_0x457c9c);MailMessageEvents['emit'](_0x19bc57,_0x457c9c);_0x2187a8(null);};}for(var e in events){if(events['hasOwnProperty'](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 ea5c672..9e7e433 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 _0x8744=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body'];(function(_0x1adb5d,_0x1e36cc){var _0x3acc58=function(_0x30a5ac){while(--_0x30a5ac){_0x1adb5d['push'](_0x1adb5d['shift']());}};_0x3acc58(++_0x1e36cc);}(_0x8744,0x174));var _0x4874=function(_0x1c3efa,_0x2590fe){_0x1c3efa=_0x1c3efa-0x0;var _0xddc345=_0x8744[_0x1c3efa];return _0xddc345;};'use strict';var _=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var logger=require(_0x4874('0x2'))(_0x4874('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4874('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x4874('0x5'));var rimraf=require(_0x4874('0x6'));var config=require('../../config/environment');var attributes=require(_0x4874('0x7'));module[_0x4874('0x8')]=function(_0x546d9a,_0x2e92f9){return _0x546d9a[_0x4874('0x9')](_0x4874('0xa'),attributes,{'tableName':_0x4874('0xb'),'paranoid':![],'indexes':[{'name':_0x4874('0xc'),'fields':['messageId']},{'name':_0x4874('0xd'),'fields':[_0x4874('0xe'),_0x4874('0xf')],'type':_0x4874('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x356c18,_0x23641f,_0x4784bd){if(_0x356c18[_0x4874('0x11')]){_0x356c18[_0x4874('0xe')]=htmlToText['fromString'](_0x356c18[_0x4874('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4784bd(null,_0x23641f);},'afterCreate':function(_0x4c020c,_0x1df272,_0x4471b4){var _0x28d8d0=_0x546d9a['models'];var _0x148622=_0x4c020c[_0x4874('0x12')]({'plain':!![]});if(_0x148622[_0x4874('0x13')][_0x4874('0x14')]()==='in'||_0x148622['direction'][_0x4874('0x14')]()===_0x4874('0x15')&&!_0x148622[_0x4874('0x16')]&&!_[_0x4874('0x17')](_0x148622[_0x4874('0x18')])){_0x28d8d0['MailInteraction'][_0x4874('0x19')]({'where':{'id':_0x148622['MailInteractionId']}})['then'](function(_0x5d15a3){if(_0x5d15a3){_0x5d15a3['update']({'lastMsgAt':_0x148622[_0x4874('0x1a')],'lastMsgDirection':_0x148622['direction'][_0x4874('0x14')](),'lastMsgBody':_0x148622[_0x4874('0x11')]});}})['catch'](function(_0x59aa49){console[_0x4874('0x1b')](_0x59aa49);});}_0x4471b4();}},'charset':_0x4874('0x1c'),'collate':_0x4874('0x1d')});}; \ No newline at end of file +var _0xe8b2=['get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','plainBody','subject','FULLTEXT','body'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0xe8b2,0x6e));var _0x2e8b=function(_0x4ed79e,_0x54b68a){_0x4ed79e=_0x4ed79e-0x0;var _0x1201b6=_0xe8b2[_0x4ed79e];return _0x1201b6;};'use strict';var _=require(_0x2e8b('0x0'));var util=require(_0x2e8b('0x1'));var logger=require(_0x2e8b('0x2'))('api');var moment=require(_0x2e8b('0x3'));var BPromise=require(_0x2e8b('0x4'));var rp=require(_0x2e8b('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x2e8b('0x6'));var rimraf=require(_0x2e8b('0x7'));var config=require(_0x2e8b('0x8'));var attributes=require(_0x2e8b('0x9'));module[_0x2e8b('0xa')]=function(_0x3c0764,_0x42ce0e){return _0x3c0764[_0x2e8b('0xb')](_0x2e8b('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x2e8b('0xd'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x2e8b('0xe'),_0x2e8b('0xf')],'type':_0x2e8b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x141d0f,_0x1e9469,_0x5f1d2c){if(_0x141d0f[_0x2e8b('0x11')]){_0x141d0f['plainBody']=htmlToText['fromString'](_0x141d0f[_0x2e8b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5f1d2c(null,_0x1e9469);},'afterCreate':function(_0x5afe12,_0x3db256,_0xf7dad9){var _0x3d0637=_0x3c0764['models'];var _0x13ede2=_0x5afe12[_0x2e8b('0x12')]({'plain':!![]});if(_0x13ede2[_0x2e8b('0x13')]['toLowerCase']()==='in'||_0x13ede2[_0x2e8b('0x13')][_0x2e8b('0x14')]()===_0x2e8b('0x15')&&!_0x13ede2[_0x2e8b('0x16')]&&!_[_0x2e8b('0x17')](_0x13ede2[_0x2e8b('0x18')])){_0x3d0637['MailInteraction']['findOne']({'where':{'id':_0x13ede2[_0x2e8b('0x19')]}})[_0x2e8b('0x1a')](function(_0x3a2728){if(_0x3a2728){_0x3a2728[_0x2e8b('0x1b')]({'lastMsgAt':_0x13ede2[_0x2e8b('0x1c')],'lastMsgDirection':_0x13ede2[_0x2e8b('0x13')]['toLowerCase'](),'lastMsgBody':_0x13ede2[_0x2e8b('0x11')]});}})[_0x2e8b('0x1d')](function(_0x460797){console[_0x2e8b('0x1e')](_0x460797);});}_0xf7dad9();}},'charset':'utf8mb4','collate':_0x2e8b('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 27d7fab..6e140b0 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 _0x6a46=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','moment'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6a46,0x1cd));var _0x66a4=function(_0x54de23,_0x16695a){_0x54de23=_0x54de23-0x0;var _0x119906=_0x6a46[_0x54de23];return _0x119906;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66a4('0x0'));var BPromise=require(_0x66a4('0x1'));var rs=require(_0x66a4('0x2'));var fs=require('fs');var Redis=require(_0x66a4('0x3'));var db=require(_0x66a4('0x4'))['db'];var utils=require(_0x66a4('0x5'));var logger=require(_0x66a4('0x6'))(_0x66a4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x66a4('0x8')][_0x66a4('0x9')]({'port':0x232a});config[_0x66a4('0xa')]=_[_0x66a4('0xb')](config[_0x66a4('0xa')],{'host':_0x66a4('0xc'),'port':0x18eb});var socket=require(_0x66a4('0xd'))(new Redis(config[_0x66a4('0xa')]));require(_0x66a4('0xe'))[_0x66a4('0xf')](socket);function respondWithRpcPromise(_0x2aee52,_0x1e3c20,_0x38c3be){return new BPromise(function(_0x195b44,_0x43bb23){return client['request'](_0x2aee52,_0x38c3be)['then'](function(_0x55bbcd){logger[_0x66a4('0x10')](_0x66a4('0x11'),_0x1e3c20,_0x66a4('0x12'));logger[_0x66a4('0x13')](_0x66a4('0x14'),_0x1e3c20,_0x66a4('0x12'),JSON[_0x66a4('0x15')](_0x55bbcd));if(_0x55bbcd[_0x66a4('0x16')]){if(_0x55bbcd[_0x66a4('0x16')][_0x66a4('0x17')]===0x1f4){logger[_0x66a4('0x16')](_0x66a4('0x11'),_0x1e3c20,_0x55bbcd[_0x66a4('0x16')][_0x66a4('0x18')]);return _0x43bb23(_0x55bbcd[_0x66a4('0x16')][_0x66a4('0x18')]);}logger[_0x66a4('0x16')](_0x66a4('0x11'),_0x1e3c20,_0x55bbcd[_0x66a4('0x16')]['message']);return _0x195b44(_0x55bbcd[_0x66a4('0x16')][_0x66a4('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x1e3c20,_0x66a4('0x12'));_0x195b44(_0x55bbcd[_0x66a4('0x19')]['message']);}})[_0x66a4('0x1a')](function(_0x51697f){logger[_0x66a4('0x16')](_0x66a4('0x11'),_0x1e3c20,_0x51697f);_0x43bb23(_0x51697f);});});}exports[_0x66a4('0x1b')]=function(_0x224f60){var _0x3b9639=this;return new Promise(function(_0x58c63b,_0x3385e8){return db[_0x66a4('0x1c')][_0x66a4('0x1d')](_0x224f60[_0x66a4('0x1e')],{'raw':_0x224f60[_0x66a4('0x1f')]?_0x224f60['options'][_0x66a4('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2bcbc9){logger[_0x66a4('0x10')]('CreateMailMessage',_0x224f60);logger['debug']('CreateMailMessage',_0x224f60,JSON[_0x66a4('0x15')](_0x2bcbc9));_0x58c63b(_0x2bcbc9);})[_0x66a4('0x1a')](function(_0x790ecf){logger['error'](_0x66a4('0x1b'),_0x790ecf['message'],_0x224f60);_0x3385e8(_0x3b9639[_0x66a4('0x16')](0x1f4,_0x790ecf[_0x66a4('0x18')]));});});}; \ No newline at end of file +var _0x3525=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailMessage.socket','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a4364,_0x145b9f){var _0x4fb6c3=function(_0x209fee){while(--_0x209fee){_0x1a4364['push'](_0x1a4364['shift']());}};_0x4fb6c3(++_0x145b9f);}(_0x3525,0x143));var _0x5352=function(_0x167936,_0x2bfe83){_0x167936=_0x167936-0x0;var _0x570166=_0x3525[_0x167936];return _0x570166;};'use strict';var _=require(_0x5352('0x0'));var util=require(_0x5352('0x1'));var moment=require(_0x5352('0x2'));var BPromise=require(_0x5352('0x3'));var rs=require(_0x5352('0x4'));var fs=require('fs');var Redis=require(_0x5352('0x5'));var db=require(_0x5352('0x6'))['db'];var utils=require(_0x5352('0x7'));var logger=require('../../config/logger')(_0x5352('0x8'));var config=require(_0x5352('0x9'));var jayson=require(_0x5352('0xa'));var client=jayson[_0x5352('0xb')][_0x5352('0xc')]({'port':0x232a});config[_0x5352('0xd')]=_['defaults'](config[_0x5352('0xd')],{'host':_0x5352('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5352('0xd')]));require(_0x5352('0xf'))['register'](socket);function respondWithRpcPromise(_0x5c25d,_0x35229a,_0x26acaa){return new BPromise(function(_0x1abcdf,_0x125f1b){return client[_0x5352('0x10')](_0x5c25d,_0x26acaa)['then'](function(_0x442d27){logger[_0x5352('0x11')](_0x5352('0x12'),_0x35229a,_0x5352('0x13'));logger[_0x5352('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x35229a,'request\x20sent',JSON[_0x5352('0x15')](_0x442d27));if(_0x442d27[_0x5352('0x16')]){if(_0x442d27[_0x5352('0x16')][_0x5352('0x17')]===0x1f4){logger['error'](_0x5352('0x12'),_0x35229a,_0x442d27['error'][_0x5352('0x18')]);return _0x125f1b(_0x442d27[_0x5352('0x16')][_0x5352('0x18')]);}logger[_0x5352('0x16')](_0x5352('0x12'),_0x35229a,_0x442d27[_0x5352('0x16')][_0x5352('0x18')]);return _0x1abcdf(_0x442d27[_0x5352('0x16')][_0x5352('0x18')]);}else{logger['info'](_0x5352('0x12'),_0x35229a,'request\x20sent');_0x1abcdf(_0x442d27[_0x5352('0x19')][_0x5352('0x18')]);}})[_0x5352('0x1a')](function(_0x5a0606){logger[_0x5352('0x16')](_0x5352('0x12'),_0x35229a,_0x5a0606);_0x125f1b(_0x5a0606);});});}exports[_0x5352('0x1b')]=function(_0x5ea030){var _0x460c19=this;return new Promise(function(_0x1a3de1,_0x22bec6){return db[_0x5352('0x1c')]['create'](_0x5ea030[_0x5352('0x1d')],{'raw':_0x5ea030[_0x5352('0x1e')]?_0x5ea030[_0x5352('0x1e')][_0x5352('0x1f')]===undefined?!![]:![]:!![]})[_0x5352('0x20')](function(_0x1308b4){logger['info'](_0x5352('0x1b'),_0x5ea030);logger[_0x5352('0x14')](_0x5352('0x1b'),_0x5ea030,JSON[_0x5352('0x15')](_0x1308b4));_0x1a3de1(_0x1308b4);})[_0x5352('0x1a')](function(_0x1788f0){logger[_0x5352('0x16')]('CreateMailMessage',_0x1788f0[_0x5352('0x18')],_0x5ea030);_0x22bec6(_0x460c19['error'](0x1f4,_0x1788f0[_0x5352('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a761827..b4b77d8 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 _0xaa3f=['save','update','emit','removeListener','length','./mailMessage.events'];(function(_0x233c48,_0xffa705){var _0x432de9=function(_0x14cef2){while(--_0x14cef2){_0x233c48['push'](_0x233c48['shift']());}};_0x432de9(++_0xffa705);}(_0xaa3f,0x95));var _0xfaa3=function(_0xf1bbfa,_0x32943f){_0xf1bbfa=_0xf1bbfa-0x0;var _0x1e7a0d=_0xaa3f[_0xf1bbfa];return _0x1e7a0d;};'use strict';var MailMessageEvents=require(_0xfaa3('0x0'));var events=[_0xfaa3('0x1'),'remove',_0xfaa3('0x2')];function createListener(_0x1092c0,_0x4dae21){return function(_0x53113d){_0x4dae21[_0xfaa3('0x3')](_0x1092c0,_0x53113d);};}function removeListener(_0x227f93,_0x4e127a){return function(){MailMessageEvents[_0xfaa3('0x4')](_0x227f93,_0x4e127a);};}exports['register']=function(_0x3f85e4){for(var _0x5760ee=0x0,_0x2da98f=events[_0xfaa3('0x5')];_0x5760ee<_0x2da98f;_0x5760ee++){var _0x3d4174=events[_0x5760ee];var _0x5dfc13=createListener('mailMessage:'+_0x3d4174,_0x3f85e4);MailMessageEvents['on'](_0x3d4174,_0x5dfc13);}}; \ No newline at end of file +var _0x6737=['mailMessage:','save','remove','emit','removeListener'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6737,0xe2));var _0x7673=function(_0x4a7497,_0x5d8fca){_0x4a7497=_0x4a7497-0x0;var _0x320d67=_0x6737[_0x4a7497];return _0x320d67;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x7673('0x0'),_0x7673('0x1'),'update'];function createListener(_0x2f05d4,_0x2a9cd0){return function(_0x43ee27){_0x2a9cd0[_0x7673('0x2')](_0x2f05d4,_0x43ee27);};}function removeListener(_0x54002e,_0x32e6f2){return function(){MailMessageEvents[_0x7673('0x3')](_0x54002e,_0x32e6f2);};}exports['register']=function(_0x2f5edc){for(var _0x15230f=0x0,_0x5af802=events['length'];_0x15230f<_0x5af802;_0x15230f++){var _0x53d67d=events[_0x15230f];var _0x5292f7=createListener(_0x7673('0x4')+_0x53d67d,_0x2f5edc);MailMessageEvents['on'](_0x53d67d,_0x5292f7);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 83c31c5..b2f27a7 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 _0xe730=['post','addTeams','addAgents','put','update','destroy','delete','/:id/teams','removeTeams','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/users','getAgents'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xe730,0xc9));var _0x0e73=function(_0x2b9794,_0x320dcf){_0x2b9794=_0x2b9794-0x0;var _0x186b0b=_0xe730[_0x2b9794];return _0x186b0b;};'use strict';var multer=require(_0x0e73('0x0'));var util=require(_0x0e73('0x1'));var path=require('path');var timeout=require(_0x0e73('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0e73('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0e73('0x4'));var controller=require(_0x0e73('0x5'));router[_0x0e73('0x6')]('/',auth[_0x0e73('0x7')](),controller[_0x0e73('0x8')]);router[_0x0e73('0x6')]('/describe',auth[_0x0e73('0x7')](),controller['describe']);router['get'](_0x0e73('0x9'),auth[_0x0e73('0x7')](),controller[_0x0e73('0xa')]);router[_0x0e73('0x6')](_0x0e73('0xb'),auth[_0x0e73('0x7')](),controller[_0x0e73('0xc')]);router[_0x0e73('0x6')]('/:id/teams',auth[_0x0e73('0x7')](),controller['getTeams']);router['get'](_0x0e73('0xd'),auth[_0x0e73('0x7')](),controller[_0x0e73('0xe')]);router[_0x0e73('0xf')]('/',auth[_0x0e73('0x7')](),controller['create']);router[_0x0e73('0xf')]('/:id/teams',auth[_0x0e73('0x7')](),controller[_0x0e73('0x10')]);router[_0x0e73('0xf')](_0x0e73('0xd'),auth[_0x0e73('0x7')](),controller[_0x0e73('0x11')]);router[_0x0e73('0x12')](_0x0e73('0x9'),auth['isAuthenticated'](),controller[_0x0e73('0x13')]);router['delete'](_0x0e73('0x9'),auth[_0x0e73('0x7')](),controller[_0x0e73('0x14')]);router[_0x0e73('0x15')](_0x0e73('0x16'),auth[_0x0e73('0x7')](),controller[_0x0e73('0x17')]);router['delete']('/:id/users',auth[_0x0e73('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf908=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf908,0x1b0));var _0x8f90=function(_0x47c6be,_0x3f3001){_0x47c6be=_0x47c6be-0x0;var _0x5b5cee=_0xf908[_0x47c6be];return _0x5b5cee;};'use strict';var multer=require(_0x8f90('0x0'));var util=require(_0x8f90('0x1'));var path=require(_0x8f90('0x2'));var timeout=require(_0x8f90('0x3'));var express=require(_0x8f90('0x4'));var router=express[_0x8f90('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f90('0x6'));var config=require(_0x8f90('0x7'));var controller=require(_0x8f90('0x8'));router[_0x8f90('0x9')]('/',auth[_0x8f90('0xa')](),controller[_0x8f90('0xb')]);router[_0x8f90('0x9')](_0x8f90('0xc'),auth[_0x8f90('0xa')](),controller[_0x8f90('0xd')]);router[_0x8f90('0x9')](_0x8f90('0xe'),auth[_0x8f90('0xa')](),controller[_0x8f90('0xf')]);router[_0x8f90('0x9')]('/:id/members',auth[_0x8f90('0xa')](),controller[_0x8f90('0x10')]);router[_0x8f90('0x9')](_0x8f90('0x11'),auth[_0x8f90('0xa')](),controller['getTeams']);router[_0x8f90('0x9')](_0x8f90('0x12'),auth[_0x8f90('0xa')](),controller['getAgents']);router['post']('/',auth[_0x8f90('0xa')](),controller[_0x8f90('0x13')]);router['post'](_0x8f90('0x11'),auth[_0x8f90('0xa')](),controller[_0x8f90('0x14')]);router['post'](_0x8f90('0x12'),auth[_0x8f90('0xa')](),controller[_0x8f90('0x15')]);router[_0x8f90('0x16')](_0x8f90('0xe'),auth['isAuthenticated'](),controller[_0x8f90('0x17')]);router[_0x8f90('0x18')](_0x8f90('0xe'),auth[_0x8f90('0xa')](),controller[_0x8f90('0x19')]);router['delete'](_0x8f90('0x11'),auth['isAuthenticated'](),controller[_0x8f90('0x1a')]);router[_0x8f90('0x18')]('/:id/users',auth[_0x8f90('0xa')](),controller[_0x8f90('0x1b')]);module[_0x8f90('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e9290dd..f2da940 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 _0x65ac=['exports','STRING','name','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x22eeb5,_0x448ad3){var _0x36b148=function(_0x115ccd){while(--_0x115ccd){_0x22eeb5['push'](_0x22eeb5['shift']());}};_0x36b148(++_0x448ad3);}(_0x65ac,0x1a3));var _0xc65a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x65ac[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xc65a('0x0'));module[_0xc65a('0x1')]={'name':{'type':Sequelize[_0xc65a('0x2')],'unique':_0xc65a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc65a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc65a('0x5')](_0xc65a('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x5ab9=['INTEGER','rrmemory','beepall','exports','name','STRING'];(function(_0x5bd2ea,_0x415e47){var _0x1477c3=function(_0x28760b){while(--_0x28760b){_0x5bd2ea['push'](_0x5bd2ea['shift']());}};_0x1477c3(++_0x415e47);}(_0x5ab9,0x117));var _0x95ab=function(_0x21b293,_0x352a44){_0x21b293=_0x21b293-0x0;var _0xd73e84=_0x5ab9[_0x21b293];return _0xd73e84;};'use strict';var Sequelize=require('sequelize');module[_0x95ab('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x95ab('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x95ab('0x2')]},'timeout':{'type':Sequelize[_0x95ab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x95ab('0x4'),_0x95ab('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 94d8766..0f0fae2 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 _0xc5df=['squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','sendStatus','status','offset','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','map','MailQueue','fieldName','key','query','keys','filters','intersection','model','fields','length','attributes','limit','order','sort','pick','merge','VIRTUAL','filter','options','count','findAll','rows','show','params','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','rawAttributes','hasOwnProperty','where','MailQueueId','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0x42fa28,_0x4df48a){var _0x5a22fb=function(_0x28c336){while(--_0x28c336){_0x42fa28['push'](_0x42fa28['shift']());}};_0x5a22fb(++_0x4df48a);}(_0xc5df,0x80));var _0xfc5d=function(_0x1ef206,_0x13eca1){_0x1ef206=_0x1ef206-0x0;var _0x54004e=_0xc5df[_0x1ef206];return _0x54004e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfc5d('0x0'));var zipdir=require(_0xfc5d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfc5d('0x2'));var BPromise=require(_0xfc5d('0x3'));var Mustache=require(_0xfc5d('0x4'));var util=require(_0xfc5d('0x5'));var path=require(_0xfc5d('0x6'));var sox=require('sox');var csv=require(_0xfc5d('0x7'));var ejs=require(_0xfc5d('0x8'));var fs=require('fs');var _=require(_0xfc5d('0x9'));var squel=require(_0xfc5d('0xa'));var crypto=require(_0xfc5d('0xb'));var jsforce=require(_0xfc5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc5d('0x7'));var querystring=require(_0xfc5d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc5d('0xe'));var authService=require(_0xfc5d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc5d('0x10'));var hardwareService=require(_0xfc5d('0x11'));var logger=require(_0xfc5d('0x12'))(_0xfc5d('0x13'));var utils=require('../../config/utils');var config=require(_0xfc5d('0x14'));var licenseUtil=require(_0xfc5d('0x15'));var db=require(_0xfc5d('0x16'))['db'];config['redis']=_[_0xfc5d('0x17')](config[_0xfc5d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc5d('0x19'))(new Redis(config['redis']));require(_0xfc5d('0x1a'))['register'](socket);function respondWithStatusCode(_0x248498,_0x206207){_0x206207=_0x206207||0xcc;return function(_0x1606ee){if(_0x1606ee){return _0x248498[_0xfc5d('0x1b')](_0x206207);}return _0x248498[_0xfc5d('0x1c')](_0x206207)['end']();};}function respondWithResult(_0x44d245,_0x1d496e){_0x1d496e=_0x1d496e||0xc8;return function(_0x4db0cd){if(_0x4db0cd){return _0x44d245[_0xfc5d('0x1c')](_0x1d496e)['json'](_0x4db0cd);}};}function respondWithFilteredResult(_0x438729,_0x581c1c){return function(_0x4783d5){if(_0x4783d5){var _0x3ae06e=_0x4783d5['count'],_0x1b8c0d=_0x581c1c['offset'],_0x1bcee2=_0x581c1c[_0xfc5d('0x1d')]+_0x581c1c['limit'],_0x396de4;if(_0x1bcee2>=_0x3ae06e){_0x1bcee2=_0x3ae06e;_0x396de4=0xc8;}else{_0x396de4=0xce;}_0x438729['status'](_0x396de4);return _0x438729['set'](_0xfc5d('0x1e'),_0x1b8c0d+'-'+_0x1bcee2+'/'+_0x3ae06e)['json'](_0x4783d5);}return null;};}function patchUpdates(_0x146a2a){return function(_0x4fa971){try{jsonpatch[_0xfc5d('0x1f')](_0x4fa971,_0x146a2a,!![]);}catch(_0x252474){return BPromise[_0xfc5d('0x20')](_0x252474);}return _0x4fa971[_0xfc5d('0x21')]();};}function saveUpdates(_0x47e6c2,_0x4cf28c){return function(_0x5c88fc){if(_0x5c88fc){return _0x5c88fc[_0xfc5d('0x22')](_0x47e6c2)[_0xfc5d('0x23')](function(_0x3c0ec4){return _0x3c0ec4;});}return null;};}function removeEntity(_0x4ce3dd,_0x30b782){return function(_0x22eb5a){if(_0x22eb5a){return _0x22eb5a[_0xfc5d('0x24')]()[_0xfc5d('0x23')](function(){var _0x2036b3=_0x22eb5a[_0xfc5d('0x25')]({'plain':!![]});var _0x64cf33='MailQueues';return db['UserProfileResource'][_0xfc5d('0x24')]({'where':{'type':_0x64cf33,'resourceId':_0x2036b3['id']}})['then'](function(){return _0x22eb5a;});})['then'](function(){_0x4ce3dd[_0xfc5d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9fd7,_0x29d36c){return function(_0x4e5b48){if(!_0x4e5b48){_0x1c9fd7[_0xfc5d('0x1b')](0x194);}return _0x4e5b48;};}function handleError(_0x5bc69c,_0x4d2d3b){_0x4d2d3b=_0x4d2d3b||0x1f4;return function(_0x4714f0){logger[_0xfc5d('0x26')](_0x4714f0[_0xfc5d('0x27')]);if(_0x4714f0[_0xfc5d('0x28')]){delete _0x4714f0[_0xfc5d('0x28')];}_0x5bc69c[_0xfc5d('0x1c')](_0x4d2d3b)[_0xfc5d('0x29')](_0x4714f0);};}exports['index']=function(_0x82f10a,_0x5eb75f){var _0x3eb6e3={},_0xf44fdc={},_0x53c893={'count':0x0,'rows':[]};var _0x446344=_[_0xfc5d('0x2a')](db[_0xfc5d('0x2b')]['rawAttributes'],function(_0x39461c){return{'name':_0x39461c[_0xfc5d('0x2c')],'type':_0x39461c['type'][_0xfc5d('0x2d')]};});_0xf44fdc['model']=_[_0xfc5d('0x2a')](_0x446344,_0xfc5d('0x28'));_0xf44fdc[_0xfc5d('0x2e')]=_[_0xfc5d('0x2f')](_0x82f10a[_0xfc5d('0x2e')]);_0xf44fdc[_0xfc5d('0x30')]=_[_0xfc5d('0x31')](_0xf44fdc['model'],_0xf44fdc['query']);_0x3eb6e3['attributes']=_['intersection'](_0xf44fdc[_0xfc5d('0x32')],qs[_0xfc5d('0x33')](_0x82f10a[_0xfc5d('0x2e')][_0xfc5d('0x33')]));_0x3eb6e3['attributes']=_0x3eb6e3['attributes'][_0xfc5d('0x34')]?_0x3eb6e3[_0xfc5d('0x35')]:_0xf44fdc[_0xfc5d('0x32')];if(!_0x82f10a[_0xfc5d('0x2e')]['hasOwnProperty']('nolimit')){_0x3eb6e3[_0xfc5d('0x36')]=qs[_0xfc5d('0x36')](_0x82f10a[_0xfc5d('0x2e')][_0xfc5d('0x36')]);_0x3eb6e3[_0xfc5d('0x1d')]=qs[_0xfc5d('0x1d')](_0x82f10a[_0xfc5d('0x2e')][_0xfc5d('0x1d')]);}_0x3eb6e3[_0xfc5d('0x37')]=qs['sort'](_0x82f10a[_0xfc5d('0x2e')][_0xfc5d('0x38')]);_0x3eb6e3['where']=qs[_0xfc5d('0x30')](_[_0xfc5d('0x39')](_0x82f10a['query'],_0xf44fdc['filters']),_0x446344);if(_0x82f10a['query']['filter']){_0x3eb6e3['where']=_[_0xfc5d('0x3a')](_0x3eb6e3['where'],{'$or':_[_0xfc5d('0x2a')](_0x446344,function(_0x2f8bee){if(_0x2f8bee['type']!==_0xfc5d('0x3b')){var _0x523813={};_0x523813[_0x2f8bee[_0xfc5d('0x28')]]={'$like':'%'+_0x82f10a['query'][_0xfc5d('0x3c')]+'%'};return _0x523813;}})});}_0x3eb6e3=_[_0xfc5d('0x3a')]({},_0x3eb6e3,_0x82f10a[_0xfc5d('0x3d')]);var _0x20ad76={'where':_0x3eb6e3['where']};return db[_0xfc5d('0x2b')][_0xfc5d('0x3e')](_0x20ad76)[_0xfc5d('0x23')](function(_0x1046d8){_0x53c893[_0xfc5d('0x3e')]=_0x1046d8;if(_0x82f10a[_0xfc5d('0x2e')]['includeAll']){_0x3eb6e3['include']=[{'all':!![]}];}return db[_0xfc5d('0x2b')][_0xfc5d('0x3f')](_0x3eb6e3);})['then'](function(_0x24cf7a){_0x53c893[_0xfc5d('0x40')]=_0x24cf7a;return _0x53c893;})[_0xfc5d('0x23')](respondWithFilteredResult(_0x5eb75f,_0x3eb6e3))['catch'](handleError(_0x5eb75f,null));};exports[_0xfc5d('0x41')]=function(_0x1c1cae,_0xd9d449){var _0x1ae074={'raw':!![],'where':{'id':_0x1c1cae[_0xfc5d('0x42')]['id']}},_0x86b909={};_0x86b909[_0xfc5d('0x32')]=_[_0xfc5d('0x2f')](db[_0xfc5d('0x2b')]['rawAttributes']);_0x86b909[_0xfc5d('0x2e')]=_['keys'](_0x1c1cae['query']);_0x86b909[_0xfc5d('0x30')]=_[_0xfc5d('0x31')](_0x86b909[_0xfc5d('0x32')],_0x86b909[_0xfc5d('0x2e')]);_0x1ae074[_0xfc5d('0x35')]=_[_0xfc5d('0x31')](_0x86b909['model'],qs[_0xfc5d('0x33')](_0x1c1cae[_0xfc5d('0x2e')][_0xfc5d('0x33')]));_0x1ae074['attributes']=_0x1ae074['attributes'][_0xfc5d('0x34')]?_0x1ae074[_0xfc5d('0x35')]:_0x86b909[_0xfc5d('0x32')];if(_0x1c1cae[_0xfc5d('0x2e')][_0xfc5d('0x43')]){_0x1ae074[_0xfc5d('0x44')]=[{'all':!![]}];}_0x1ae074=_['merge']({},_0x1ae074,_0x1c1cae[_0xfc5d('0x3d')]);return db[_0xfc5d('0x2b')][_0xfc5d('0x45')](_0x1ae074)[_0xfc5d('0x23')](handleEntityNotFound(_0xd9d449,null))[_0xfc5d('0x23')](respondWithResult(_0xd9d449,null))['catch'](handleError(_0xd9d449,null));};exports[_0xfc5d('0x46')]=function(_0x1d3ec1,_0x17f852){return db[_0xfc5d('0x2b')]['create'](_0x1d3ec1['body'],{})[_0xfc5d('0x23')](function(_0x2afdfe){var _0x512a30=_0x1d3ec1['user'][_0xfc5d('0x25')]({'plain':!![]});if(!_0x512a30)throw new Error(_0xfc5d('0x47'));if(_0x512a30['role']===_0xfc5d('0x48')){var _0x4a73dd=_0x2afdfe['get']({'plain':!![]});var _0xc77d4e=_0xfc5d('0x49');return db[_0xfc5d('0x4a')]['find']({'where':{'name':_0xc77d4e,'userProfileId':_0x512a30[_0xfc5d('0x4b')]},'raw':!![]})[_0xfc5d('0x23')](function(_0x3ad74c){if(_0x3ad74c&&_0x3ad74c[_0xfc5d('0x4c')]===0x0){return db[_0xfc5d('0x4d')][_0xfc5d('0x46')]({'name':_0x4a73dd[_0xfc5d('0x28')],'resourceId':_0x4a73dd['id'],'type':_0x3ad74c['name'],'sectionId':_0x3ad74c['id']},{})['then'](function(){return _0x2afdfe;});}else{return _0x2afdfe;}})[_0xfc5d('0x4e')](function(_0x69ac7c){logger['error'](_0xfc5d('0x4f'),_0x69ac7c);throw _0x69ac7c;});}return _0x2afdfe;})['then'](respondWithResult(_0x17f852,0xc9))[_0xfc5d('0x4e')](handleError(_0x17f852,null));};exports[_0xfc5d('0x22')]=function(_0x2c7a8f,_0x1d93bd){if(_0x2c7a8f[_0xfc5d('0x50')]['id']){delete _0x2c7a8f[_0xfc5d('0x50')]['id'];}return db[_0xfc5d('0x2b')][_0xfc5d('0x45')]({'where':{'id':_0x2c7a8f[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x23')](handleEntityNotFound(_0x1d93bd,null))[_0xfc5d('0x23')](saveUpdates(_0x2c7a8f[_0xfc5d('0x50')],null))['then'](respondWithResult(_0x1d93bd,null))[_0xfc5d('0x4e')](handleError(_0x1d93bd,null));};exports[_0xfc5d('0x24')]=function(_0x13f6a9,_0x60f319){return db[_0xfc5d('0x2b')]['find']({'where':{'id':_0x13f6a9[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x23')](handleEntityNotFound(_0x60f319,null))[_0xfc5d('0x23')](removeEntity(_0x60f319,null))[_0xfc5d('0x4e')](handleError(_0x60f319,null));};exports[_0xfc5d('0x51')]=function(_0x459800,_0x4f21ef){return db[_0xfc5d('0x2b')][_0xfc5d('0x51')]()[_0xfc5d('0x23')](respondWithResult(_0x4f21ef,null))[_0xfc5d('0x4e')](handleError(_0x4f21ef,null));};exports[_0xfc5d('0x52')]=function(_0x20d9d8,_0x2fdfd8,_0x59586e){var _0x1fa073={'raw':!![],'where':{}},_0x4bd03b={},_0x275ca7;return db[_0xfc5d('0x2b')][_0xfc5d('0x53')]({'where':{'id':_0x20d9d8[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x23')](handleEntityNotFound(_0x2fdfd8,null))[_0xfc5d('0x23')](function(_0x19af34){if(_0x19af34){_0x275ca7=_0x19af34['get']({'plain':!![]});_0x4bd03b[_0xfc5d('0x32')]=_[_0xfc5d('0x2f')](db[_0xfc5d('0x54')][_0xfc5d('0x55')]);_0x4bd03b['query']=_[_0xfc5d('0x2f')](_0x20d9d8[_0xfc5d('0x2e')]);_0x4bd03b[_0xfc5d('0x30')]=_[_0xfc5d('0x31')](_0x4bd03b[_0xfc5d('0x32')],_0x4bd03b[_0xfc5d('0x2e')]);_0x1fa073[_0xfc5d('0x35')]=_[_0xfc5d('0x31')](_0x4bd03b[_0xfc5d('0x32')],qs[_0xfc5d('0x33')](_0x20d9d8[_0xfc5d('0x2e')]['fields']));_0x1fa073['attributes']=_0x1fa073[_0xfc5d('0x35')]['length']?_0x1fa073['attributes']:_0x4bd03b[_0xfc5d('0x32')];if(!_0x20d9d8[_0xfc5d('0x2e')][_0xfc5d('0x56')]('nolimit')){_0x1fa073['limit']=qs[_0xfc5d('0x36')](_0x20d9d8[_0xfc5d('0x2e')][_0xfc5d('0x36')]);_0x1fa073[_0xfc5d('0x1d')]=qs['offset'](_0x20d9d8[_0xfc5d('0x2e')][_0xfc5d('0x1d')]);}_0x1fa073[_0xfc5d('0x37')]=qs['sort'](_0x20d9d8['query'][_0xfc5d('0x38')]);_0x1fa073['where']=qs['filters'](_[_0xfc5d('0x39')](_0x20d9d8[_0xfc5d('0x2e')],_0x4bd03b[_0xfc5d('0x30')]));_0x1fa073[_0xfc5d('0x57')][_0xfc5d('0x58')]=_0x19af34['id'];if(_0x20d9d8[_0xfc5d('0x2e')][_0xfc5d('0x3c')]){_0x1fa073['where']=_['merge'](_0x1fa073['where'],{'$or':_[_0xfc5d('0x2a')](_0x1fa073[_0xfc5d('0x35')],function(_0x5893ae){var _0x3c62b5={};_0x3c62b5[_0x5893ae]={'$like':'%'+_0x20d9d8[_0xfc5d('0x2e')]['filter']+'%'};return _0x3c62b5;})});}_0x1fa073=_['merge']({},_0x1fa073,_0x20d9d8[_0xfc5d('0x3d')]);return db[_0xfc5d('0x54')][_0xfc5d('0x3f')](_0x1fa073);}})[_0xfc5d('0x23')](function(_0x1939b3){if(_0x1939b3){return db['User'][_0xfc5d('0x59')]({'where':{'id':_['map'](_0x1939b3,_0xfc5d('0x5a')),'role':'agent'},'attributes':['id','name',_0xfc5d('0x5b'),_0xfc5d('0x5c'),_0xfc5d('0x5d')]});}})[_0xfc5d('0x23')](function(_0x5736f5){if(_0x5736f5){return{'count':_0x5736f5[_0xfc5d('0x3e')],'rows':_[_0xfc5d('0x2a')](_0x5736f5[_0xfc5d('0x40')],function(_0x1b6d79){return{'membername':_0x1b6d79['name'],'UserId':_0x1b6d79['id'],'queue_name':_0x275ca7[_0xfc5d('0x28')],'MailQueueId':_0x275ca7['id'],'interface':util[_0xfc5d('0x5e')](_0xfc5d('0x5f'),_0xfc5d('0x60'),_0x1b6d79[_0xfc5d('0x28')]),'penalty':0x0,'paused':_0x1b6d79[_0xfc5d('0x5b')],'createdAt':_0x1b6d79['createdAt'],'updatedAt':_0x1b6d79['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfc5d('0x23')](respondWithFilteredResult(_0x2fdfd8,_0x1fa073))['catch'](handleError(_0x2fdfd8,null));};exports[_0xfc5d('0x61')]=function(_0x40d3b1,_0x20f9dd,_0x3e9a8b){var _0xab45ac={};var _0x1b81d5={};var _0x7159be;var _0x51ae58;return db[_0xfc5d('0x2b')][_0xfc5d('0x53')]({'where':{'id':_0x40d3b1[_0xfc5d('0x42')]['id']}})['then'](handleEntityNotFound(_0x20f9dd,null))[_0xfc5d('0x23')](function(_0x476cd7){if(_0x476cd7){_0x7159be=_0x476cd7;_0x1b81d5[_0xfc5d('0x32')]=_['keys'](db[_0xfc5d('0x62')][_0xfc5d('0x55')]);_0x1b81d5[_0xfc5d('0x2e')]=_['keys'](_0x40d3b1[_0xfc5d('0x2e')]);_0x1b81d5[_0xfc5d('0x30')]=_['intersection'](_0x1b81d5[_0xfc5d('0x32')],_0x1b81d5[_0xfc5d('0x2e')]);_0xab45ac[_0xfc5d('0x35')]=_[_0xfc5d('0x31')](_0x1b81d5[_0xfc5d('0x32')],qs[_0xfc5d('0x33')](_0x40d3b1[_0xfc5d('0x2e')][_0xfc5d('0x33')]));_0xab45ac[_0xfc5d('0x35')]=_0xab45ac['attributes'][_0xfc5d('0x34')]?_0xab45ac['attributes']:_0x1b81d5[_0xfc5d('0x32')];_0xab45ac[_0xfc5d('0x37')]=qs[_0xfc5d('0x38')](_0x40d3b1['query']['sort']);_0xab45ac[_0xfc5d('0x57')]=qs[_0xfc5d('0x30')](_[_0xfc5d('0x39')](_0x40d3b1[_0xfc5d('0x2e')],_0x1b81d5[_0xfc5d('0x30')]));if(_0x40d3b1[_0xfc5d('0x2e')][_0xfc5d('0x3c')]){_0xab45ac[_0xfc5d('0x57')]=_['merge'](_0xab45ac[_0xfc5d('0x57')],{'$or':_[_0xfc5d('0x2a')](_0xab45ac[_0xfc5d('0x35')],function(_0x42b4af){var _0x7b31ff={};_0x7b31ff[_0x42b4af]={'$like':'%'+_0x40d3b1[_0xfc5d('0x2e')][_0xfc5d('0x3c')]+'%'};return _0x7b31ff;})});}_0xab45ac=_[_0xfc5d('0x3a')]({},_0xab45ac,_0x40d3b1[_0xfc5d('0x3d')]);return _0x7159be[_0xfc5d('0x61')](_0xab45ac);}})[_0xfc5d('0x23')](function(_0x2c65dc){if(_0x2c65dc){_0x51ae58=_0x2c65dc[_0xfc5d('0x34')];if(!_0x40d3b1[_0xfc5d('0x2e')][_0xfc5d('0x56')](_0xfc5d('0x63'))){_0xab45ac['limit']=qs[_0xfc5d('0x36')](_0x40d3b1['query']['limit']);_0xab45ac[_0xfc5d('0x1d')]=qs[_0xfc5d('0x1d')](_0x40d3b1[_0xfc5d('0x2e')]['offset']);}return _0x7159be['getTeams'](_0xab45ac);}})[_0xfc5d('0x23')](function(_0x20ed62){if(_0x20ed62){return _0x20ed62?{'count':_0x51ae58,'rows':_0x20ed62}:null;}})[_0xfc5d('0x23')](respondWithResult(_0x20f9dd,null))[_0xfc5d('0x4e')](handleError(_0x20f9dd,null));};exports[_0xfc5d('0x64')]=function(_0x4e4e5a,_0x410f06,_0x8439c1){var _0x275370=_0x4e4e5a['body'][_0xfc5d('0x65')];return db[_0xfc5d('0x62')]['findAll']({'where':{'id':_0x275370},'attributes':['id'],'include':[{'model':db[_0xfc5d('0x66')],'as':_0xfc5d('0x67'),'attributes':['id',_0xfc5d('0x28'),_0xfc5d('0x68'),_0xfc5d('0x69'),_0xfc5d('0x6a')],'raw':!![]}]})[_0xfc5d('0x23')](function(_0x6bd2bb){if(_0x6bd2bb){var _0x1ae36c=_[_0xfc5d('0x6b')](_0x6bd2bb,function(_0x5220c3){var _0x2eae6f=_0x5220c3[_0xfc5d('0x25')]({'plain':!![]});return _0x2eae6f[_0xfc5d('0x67')];});return db[_0xfc5d('0x2b')][_0xfc5d('0x45')]({'where':{'id':_0x4e4e5a[_0xfc5d('0x42')]['id']}})['then'](function(_0x4940dc){return db[_0xfc5d('0x6c')][_0xfc5d('0x6d')](function(_0x3c3a1d){return _0x4940dc[_0xfc5d('0x64')](_0x275370,{'transaction':_0x3c3a1d})[_0xfc5d('0x23')](function(){return BPromise[_0xfc5d('0x6e')](_0x1ae36c,function(_0x3b1051){return db[_0xfc5d('0x54')][_0xfc5d('0x6f')]({'where':{'UserId':_0x3b1051['id'],'MailQueueId':_0x4e4e5a['params']['id']},'transaction':_0x3c3a1d});});})[_0xfc5d('0x23')](function(){_0x1ae36c[_0xfc5d('0x70')](function(_0x23c748){socket[_0xfc5d('0x71')]('userMailQueue:save',{'UserId':_0x23c748['id'],'MailQueueId':_0x4940dc['id']});});});});});}})[_0xfc5d('0x23')](respondWithStatusCode(_0x410f06,null))[_0xfc5d('0x4e')](handleError(_0x410f06,null));};exports['removeTeams']=function(_0x12b539,_0x897e16,_0x168fdf){return db['Team'][_0xfc5d('0x3f')]({'where':{'id':_0x12b539['query'][_0xfc5d('0x65')]},'attributes':['id'],'include':[{'model':db[_0xfc5d('0x66')],'as':_0xfc5d('0x67'),'attributes':['id'],'raw':!![]}]})[_0xfc5d('0x23')](handleEntityNotFound(_0x897e16,null))[_0xfc5d('0x23')](function(_0x2ad572){var _0x202ed6=_[_0xfc5d('0x2a')](_0x2ad572,'id');var _0x5ecfd8=[];var _0x1e98fa=[];var _0x207452=squel['select']();_0x207452[_0xfc5d('0x72')](_0xfc5d('0x73'))['from'](_0xfc5d('0x74'),'tq')[_0xfc5d('0x75')](_0xfc5d('0x76'),'ut',_0xfc5d('0x77'))['where'](_0xfc5d('0x78'),_0x12b539[_0xfc5d('0x42')]['id']);for(var _0x24c024=0x0;_0x24c024<_0x2ad572[_0xfc5d('0x34')];_0x24c024+=0x1){let _0x309328=_0x2ad572[_0x24c024];for(var _0x17f723=0x0;_0x17f723<_0x309328[_0xfc5d('0x67')][_0xfc5d('0x34')];_0x17f723+=0x1){let _0xa450d0=_0x309328['Agents'][_0x17f723];var _0x7b09c2=_0x207452[_0xfc5d('0x79')]();_0x7b09c2[_0xfc5d('0x57')]('ut.UserId\x20=\x20?',_0xa450d0['id']);_0x1e98fa[_0xfc5d('0x7a')](db[_0xfc5d('0x6c')][_0xfc5d('0x2e')](_0x7b09c2['toString'](),{'type':db[_0xfc5d('0x6c')]['QueryTypes'][_0xfc5d('0x7b')]})['then'](function(_0x44ad00){if(_0x44ad00[_0xfc5d('0x34')]===0x1){return _0xa450d0['id'];}else{var _0x256440=_[_0xfc5d('0x7c')](_[_0xfc5d('0x2a')](_0x44ad00,_0xfc5d('0x7d')),function(_0x4ebb7b){return _[_0xfc5d('0x7e')](_0x202ed6,_0x4ebb7b);});if(_0x256440){return _0xa450d0['id'];}}}));}}return BPromise['all'](_0x1e98fa)['then'](function(_0x135a8c){_0x5ecfd8=_(_0x5ecfd8)['union'](_0x135a8c)[_0xfc5d('0x7f')]()[_0xfc5d('0x80')]();return db['MailQueue'][_0xfc5d('0x45')]({'where':{'id':_0x12b539[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x23')](function(_0x3a9172){return db[_0xfc5d('0x6c')][_0xfc5d('0x6d')](function(_0x3aa824){return _0x3a9172['removeTeams'](_0x12b539[_0xfc5d('0x2e')]['ids'],{'transaction':_0x3aa824})['then'](function(){if(!_[_0xfc5d('0x81')](_0x5ecfd8)){return _0x3a9172[_0xfc5d('0x82')](_0x5ecfd8,{'transaction':_0x3aa824});}})[_0xfc5d('0x23')](function(){_0x5ecfd8[_0xfc5d('0x70')](function(_0x287163){socket[_0xfc5d('0x71')](_0xfc5d('0x83'),{'UserId':_0x287163,'MailQueueId':_0x3a9172['id']});});});});});});})[_0xfc5d('0x23')](respondWithStatusCode(_0x897e16,null))[_0xfc5d('0x4e')](handleError(_0x897e16,null));};exports[_0xfc5d('0x84')]=function(_0x1f1d38,_0x4a815c,_0xd6c25a){return db[_0xfc5d('0x2b')][_0xfc5d('0x45')]({'where':{'id':_0x1f1d38[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x23')](handleEntityNotFound(_0x4a815c,null))['then'](function(_0x33d5d6){if(_0x33d5d6){return _0x33d5d6['addAgents'](_0x1f1d38[_0xfc5d('0x50')][_0xfc5d('0x65')],_[_0xfc5d('0x85')](_0x1f1d38[_0xfc5d('0x50')],[_0xfc5d('0x65'),'id'])||{})[_0xfc5d('0x86')](function(_0x1d90b7){for(var _0x561e91=0x0;_0x561e91<_0x1f1d38[_0xfc5d('0x50')]['ids'][_0xfc5d('0x34')];_0x561e91+=0x1){socket[_0xfc5d('0x71')](_0xfc5d('0x87'),{'UserId':_0x1f1d38[_0xfc5d('0x50')][_0xfc5d('0x65')][_0x561e91],'MailQueueId':_0x1f1d38[_0xfc5d('0x42')]['id']});}return _0x1d90b7;});}})[_0xfc5d('0x23')](respondWithResult(_0x4a815c,null))[_0xfc5d('0x4e')](handleError(_0x4a815c,null));};exports[_0xfc5d('0x82')]=function(_0x35026b,_0x2d987a,_0x57e66b){return db[_0xfc5d('0x2b')][_0xfc5d('0x45')]({'where':{'id':_0x35026b[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x23')](handleEntityNotFound(_0x2d987a,null))[_0xfc5d('0x23')](function(_0x2fe45c){if(_0x2fe45c){return _0x2fe45c[_0xfc5d('0x82')](_0x35026b['query']['ids'])[_0xfc5d('0x23')](function(){if(_[_0xfc5d('0x88')](_0x35026b[_0xfc5d('0x2e')]['ids'])){for(var _0x4cf87e=0x0;_0x4cf87e<_0x35026b[_0xfc5d('0x2e')][_0xfc5d('0x65')][_0xfc5d('0x34')];_0x4cf87e+=0x1){socket[_0xfc5d('0x71')](_0xfc5d('0x83'),{'UserId':Number(_0x35026b['query']['ids'][_0x4cf87e]),'MailQueueId':Number(_0x35026b[_0xfc5d('0x42')]['id'])});}}else{socket[_0xfc5d('0x71')]('userMailQueue:remove',{'UserId':Number(_0x35026b['query']['ids']),'MailQueueId':Number(_0x35026b[_0xfc5d('0x42')]['id'])});}});}})[_0xfc5d('0x23')](respondWithStatusCode(_0x2d987a,null))[_0xfc5d('0x4e')](handleError(_0x2d987a,null));};exports[_0xfc5d('0x89')]=function(_0xba223b,_0x16ed6f,_0x267594){var _0x3b2941={};var _0x6f3d6a={};var _0xe4e63c;var _0x1af39f;return db[_0xfc5d('0x2b')]['findOne']({'where':{'id':_0xba223b['params']['id']}})[_0xfc5d('0x23')](handleEntityNotFound(_0x16ed6f,null))[_0xfc5d('0x23')](function(_0x23a9f8){if(_0x23a9f8){_0xe4e63c=_0x23a9f8;_0x6f3d6a[_0xfc5d('0x32')]=_[_0xfc5d('0x2f')](db['User'][_0xfc5d('0x55')]);_0x6f3d6a[_0xfc5d('0x2e')]=_[_0xfc5d('0x2f')](_0xba223b['query']);_0x6f3d6a['filters']=_[_0xfc5d('0x31')](_0x6f3d6a['model'],_0x6f3d6a[_0xfc5d('0x2e')]);_0x3b2941[_0xfc5d('0x35')]=_[_0xfc5d('0x31')](_0x6f3d6a[_0xfc5d('0x32')],qs[_0xfc5d('0x33')](_0xba223b[_0xfc5d('0x2e')][_0xfc5d('0x33')]));_0x3b2941[_0xfc5d('0x35')]=_0x3b2941[_0xfc5d('0x35')][_0xfc5d('0x34')]?_0x3b2941[_0xfc5d('0x35')]:_0x6f3d6a[_0xfc5d('0x32')];_0x3b2941['order']=qs[_0xfc5d('0x38')](_0xba223b['query'][_0xfc5d('0x38')]);_0x3b2941[_0xfc5d('0x57')]=qs[_0xfc5d('0x30')](_[_0xfc5d('0x39')](_0xba223b[_0xfc5d('0x2e')],_0x6f3d6a[_0xfc5d('0x30')]));if(_0xba223b['query'][_0xfc5d('0x3c')]){_0x3b2941['where']=_[_0xfc5d('0x3a')](_0x3b2941[_0xfc5d('0x57')],{'$or':_[_0xfc5d('0x2a')](_0x3b2941[_0xfc5d('0x35')],function(_0x43cdfd){var _0x57f9f5={};_0x57f9f5[_0x43cdfd]={'$like':'%'+_0xba223b['query'][_0xfc5d('0x3c')]+'%'};return _0x57f9f5;})});}_0x3b2941=_[_0xfc5d('0x3a')]({},_0x3b2941,_0xba223b['options']);return _0xe4e63c[_0xfc5d('0x89')](_0x3b2941);}})[_0xfc5d('0x23')](function(_0x585773){if(_0x585773){_0x1af39f=_0x585773[_0xfc5d('0x34')];if(!_0xba223b[_0xfc5d('0x2e')]['hasOwnProperty'](_0xfc5d('0x63'))){_0x3b2941[_0xfc5d('0x36')]=qs['limit'](_0xba223b[_0xfc5d('0x2e')][_0xfc5d('0x36')]);_0x3b2941[_0xfc5d('0x1d')]=qs[_0xfc5d('0x1d')](_0xba223b[_0xfc5d('0x2e')][_0xfc5d('0x1d')]);}return _0xe4e63c[_0xfc5d('0x89')](_0x3b2941);}})[_0xfc5d('0x23')](function(_0x27a3b9){if(_0x27a3b9){return _0x27a3b9?{'count':_0x1af39f,'rows':_0x27a3b9}:null;}})[_0xfc5d('0x23')](respondWithResult(_0x16ed6f,null))[_0xfc5d('0x4e')](handleError(_0x16ed6f,null));}; \ No newline at end of file +var _0xb62e=['getMembers','findOne','options','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','emit','userMailQueue:save','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','map','MailQueue','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','get','user','MailQueues','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x55d1e9,_0x2fb907){var _0x2cdf69=function(_0x4a3f91){while(--_0x4a3f91){_0x55d1e9['push'](_0x55d1e9['shift']());}};_0x2cdf69(++_0x2fb907);}(_0xb62e,0x1de));var _0xeb62=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb62e[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var licenseUtil=require(_0xeb62('0x19'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1a')]=_[_0xeb62('0x1b')](config[_0xeb62('0x1a')],{'host':_0xeb62('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1a')]));require(_0xeb62('0x1d'))[_0xeb62('0x1e')](socket);function respondWithStatusCode(_0x4da178,_0x26c3fd){_0x26c3fd=_0x26c3fd||0xcc;return function(_0x195837){if(_0x195837){return _0x4da178[_0xeb62('0x1f')](_0x26c3fd);}return _0x4da178['status'](_0x26c3fd)[_0xeb62('0x20')]();};}function respondWithResult(_0x15b3e8,_0x184106){_0x184106=_0x184106||0xc8;return function(_0x353e2c){if(_0x353e2c){return _0x15b3e8[_0xeb62('0x21')](_0x184106)[_0xeb62('0x22')](_0x353e2c);}};}function respondWithFilteredResult(_0x1fb460,_0x1324d7){return function(_0x39b138){if(_0x39b138){var _0x27fd84=_0x39b138['count'],_0x27efc8=_0x1324d7[_0xeb62('0x23')],_0x11d516=_0x1324d7[_0xeb62('0x23')]+_0x1324d7[_0xeb62('0x24')],_0x3cdf76;if(_0x11d516>=_0x27fd84){_0x11d516=_0x27fd84;_0x3cdf76=0xc8;}else{_0x3cdf76=0xce;}_0x1fb460[_0xeb62('0x21')](_0x3cdf76);return _0x1fb460[_0xeb62('0x25')](_0xeb62('0x26'),_0x27efc8+'-'+_0x11d516+'/'+_0x27fd84)[_0xeb62('0x22')](_0x39b138);}return null;};}function patchUpdates(_0x589bf2){return function(_0x599d0b){try{jsonpatch[_0xeb62('0x27')](_0x599d0b,_0x589bf2,!![]);}catch(_0x154451){return BPromise[_0xeb62('0x28')](_0x154451);}return _0x599d0b[_0xeb62('0x29')]();};}function saveUpdates(_0x122b15,_0x4cafcf){return function(_0x5e7aee){if(_0x5e7aee){return _0x5e7aee[_0xeb62('0x2a')](_0x122b15)[_0xeb62('0x2b')](function(_0x182781){return _0x182781;});}return null;};}function removeEntity(_0x395b70,_0x55a169){return function(_0x4e92f5){if(_0x4e92f5){return _0x4e92f5[_0xeb62('0x2c')]()['then'](function(){var _0x448327=_0x4e92f5['get']({'plain':!![]});var _0xfe3e16='MailQueues';return db[_0xeb62('0x2d')][_0xeb62('0x2c')]({'where':{'type':_0xfe3e16,'resourceId':_0x448327['id']}})[_0xeb62('0x2b')](function(){return _0x4e92f5;});})['then'](function(){_0x395b70[_0xeb62('0x21')](0xcc)[_0xeb62('0x20')]();});}};}function handleEntityNotFound(_0x5222f4,_0xe8872c){return function(_0x42f486){if(!_0x42f486){_0x5222f4[_0xeb62('0x1f')](0x194);}return _0x42f486;};}function handleError(_0x511202,_0x192517){_0x192517=_0x192517||0x1f4;return function(_0x1616ee){logger['error'](_0x1616ee[_0xeb62('0x2e')]);if(_0x1616ee[_0xeb62('0x2f')]){delete _0x1616ee[_0xeb62('0x2f')];}_0x511202[_0xeb62('0x21')](_0x192517)[_0xeb62('0x30')](_0x1616ee);};}exports['index']=function(_0x4b58af,_0x1248bb){var _0x357cf4={},_0x1607ef={},_0x3f89ed={'count':0x0,'rows':[]};var _0x42b197=_[_0xeb62('0x31')](db[_0xeb62('0x32')]['rawAttributes'],function(_0x411062){return{'name':_0x411062['fieldName'],'type':_0x411062['type'][_0xeb62('0x33')]};});_0x1607ef[_0xeb62('0x34')]=_['map'](_0x42b197,_0xeb62('0x2f'));_0x1607ef['query']=_[_0xeb62('0x35')](_0x4b58af[_0xeb62('0x36')]);_0x1607ef['filters']=_[_0xeb62('0x37')](_0x1607ef[_0xeb62('0x34')],_0x1607ef['query']);_0x357cf4[_0xeb62('0x38')]=_[_0xeb62('0x37')](_0x1607ef[_0xeb62('0x34')],qs[_0xeb62('0x39')](_0x4b58af['query'][_0xeb62('0x39')]));_0x357cf4[_0xeb62('0x38')]=_0x357cf4['attributes']['length']?_0x357cf4[_0xeb62('0x38')]:_0x1607ef[_0xeb62('0x34')];if(!_0x4b58af['query'][_0xeb62('0x3a')](_0xeb62('0x3b'))){_0x357cf4[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x4b58af[_0xeb62('0x36')][_0xeb62('0x24')]);_0x357cf4[_0xeb62('0x23')]=qs['offset'](_0x4b58af['query'][_0xeb62('0x23')]);}_0x357cf4[_0xeb62('0x3c')]=qs[_0xeb62('0x3d')](_0x4b58af[_0xeb62('0x36')]['sort']);_0x357cf4[_0xeb62('0x3e')]=qs['filters'](_[_0xeb62('0x3f')](_0x4b58af[_0xeb62('0x36')],_0x1607ef[_0xeb62('0x40')]),_0x42b197);if(_0x4b58af[_0xeb62('0x36')][_0xeb62('0x41')]){_0x357cf4[_0xeb62('0x3e')]=_[_0xeb62('0x42')](_0x357cf4[_0xeb62('0x3e')],{'$or':_['map'](_0x42b197,function(_0x38f91b){if(_0x38f91b[_0xeb62('0x43')]!==_0xeb62('0x44')){var _0x6ffbb={};_0x6ffbb[_0x38f91b['name']]={'$like':'%'+_0x4b58af['query'][_0xeb62('0x41')]+'%'};return _0x6ffbb;}})});}_0x357cf4=_[_0xeb62('0x42')]({},_0x357cf4,_0x4b58af['options']);var _0x1f7036={'where':_0x357cf4[_0xeb62('0x3e')]};return db['MailQueue'][_0xeb62('0x45')](_0x1f7036)['then'](function(_0x37022f){_0x3f89ed['count']=_0x37022f;if(_0x4b58af[_0xeb62('0x36')]['includeAll']){_0x357cf4[_0xeb62('0x46')]=[{'all':!![]}];}return db[_0xeb62('0x32')][_0xeb62('0x47')](_0x357cf4);})['then'](function(_0x5464e6){_0x3f89ed[_0xeb62('0x48')]=_0x5464e6;return _0x3f89ed;})[_0xeb62('0x2b')](respondWithFilteredResult(_0x1248bb,_0x357cf4))[_0xeb62('0x49')](handleError(_0x1248bb,null));};exports[_0xeb62('0x4a')]=function(_0x31d4d6,_0x4afd5e){var _0x29fdb8={'raw':!![],'where':{'id':_0x31d4d6[_0xeb62('0x4b')]['id']}},_0x56efe0={};_0x56efe0['model']=_[_0xeb62('0x35')](db['MailQueue'][_0xeb62('0x4c')]);_0x56efe0['query']=_[_0xeb62('0x35')](_0x31d4d6[_0xeb62('0x36')]);_0x56efe0[_0xeb62('0x40')]=_[_0xeb62('0x37')](_0x56efe0[_0xeb62('0x34')],_0x56efe0[_0xeb62('0x36')]);_0x29fdb8['attributes']=_[_0xeb62('0x37')](_0x56efe0[_0xeb62('0x34')],qs['fields'](_0x31d4d6['query']['fields']));_0x29fdb8['attributes']=_0x29fdb8[_0xeb62('0x38')][_0xeb62('0x4d')]?_0x29fdb8['attributes']:_0x56efe0[_0xeb62('0x34')];if(_0x31d4d6[_0xeb62('0x36')][_0xeb62('0x4e')]){_0x29fdb8[_0xeb62('0x46')]=[{'all':!![]}];}_0x29fdb8=_[_0xeb62('0x42')]({},_0x29fdb8,_0x31d4d6['options']);return db[_0xeb62('0x32')]['find'](_0x29fdb8)[_0xeb62('0x2b')](handleEntityNotFound(_0x4afd5e,null))[_0xeb62('0x2b')](respondWithResult(_0x4afd5e,null))[_0xeb62('0x49')](handleError(_0x4afd5e,null));};exports[_0xeb62('0x4f')]=function(_0x1f2d87,_0x2736d4){return db[_0xeb62('0x32')][_0xeb62('0x4f')](_0x1f2d87[_0xeb62('0x50')],{})[_0xeb62('0x2b')](function(_0xe13846){var _0x13e102=_0x1f2d87['user'][_0xeb62('0x51')]({'plain':!![]});if(!_0x13e102)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13e102['role']===_0xeb62('0x52')){var _0x31fd4a=_0xe13846['get']({'plain':!![]});var _0x373505=_0xeb62('0x53');return db['UserProfileSection'][_0xeb62('0x54')]({'where':{'name':_0x373505,'userProfileId':_0x13e102[_0xeb62('0x55')]},'raw':!![]})[_0xeb62('0x2b')](function(_0x60617){if(_0x60617&&_0x60617[_0xeb62('0x56')]===0x0){return db[_0xeb62('0x2d')][_0xeb62('0x4f')]({'name':_0x31fd4a[_0xeb62('0x2f')],'resourceId':_0x31fd4a['id'],'type':_0x60617['name'],'sectionId':_0x60617['id']},{})[_0xeb62('0x2b')](function(){return _0xe13846;});}else{return _0xe13846;}})['catch'](function(_0x35a2d6){logger[_0xeb62('0x57')](_0xeb62('0x58'),_0x35a2d6);throw _0x35a2d6;});}return _0xe13846;})[_0xeb62('0x2b')](respondWithResult(_0x2736d4,0xc9))[_0xeb62('0x49')](handleError(_0x2736d4,null));};exports[_0xeb62('0x2a')]=function(_0xc3aee0,_0xf12d72){if(_0xc3aee0['body']['id']){delete _0xc3aee0['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0xc3aee0[_0xeb62('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf12d72,null))[_0xeb62('0x2b')](saveUpdates(_0xc3aee0['body'],null))[_0xeb62('0x2b')](respondWithResult(_0xf12d72,null))[_0xeb62('0x49')](handleError(_0xf12d72,null));};exports[_0xeb62('0x2c')]=function(_0x595797,_0x116139){return db[_0xeb62('0x32')]['find']({'where':{'id':_0x595797[_0xeb62('0x4b')]['id']}})[_0xeb62('0x2b')](handleEntityNotFound(_0x116139,null))[_0xeb62('0x2b')](removeEntity(_0x116139,null))[_0xeb62('0x49')](handleError(_0x116139,null));};exports['describe']=function(_0x3be3e1,_0x1b20c4){return db['MailQueue'][_0xeb62('0x59')]()[_0xeb62('0x2b')](respondWithResult(_0x1b20c4,null))[_0xeb62('0x49')](handleError(_0x1b20c4,null));};exports[_0xeb62('0x5a')]=function(_0x3a450b,_0x46da69,_0x3e55bf){var _0x1b354d={'raw':!![],'where':{}},_0x222d0c={},_0x1db841;return db[_0xeb62('0x32')][_0xeb62('0x5b')]({'where':{'id':_0x3a450b[_0xeb62('0x4b')]['id']}})[_0xeb62('0x2b')](handleEntityNotFound(_0x46da69,null))[_0xeb62('0x2b')](function(_0x472610){if(_0x472610){_0x1db841=_0x472610['get']({'plain':!![]});_0x222d0c['model']=_['keys'](db['UserMailQueue'][_0xeb62('0x4c')]);_0x222d0c['query']=_[_0xeb62('0x35')](_0x3a450b[_0xeb62('0x36')]);_0x222d0c[_0xeb62('0x40')]=_[_0xeb62('0x37')](_0x222d0c[_0xeb62('0x34')],_0x222d0c[_0xeb62('0x36')]);_0x1b354d[_0xeb62('0x38')]=_[_0xeb62('0x37')](_0x222d0c[_0xeb62('0x34')],qs[_0xeb62('0x39')](_0x3a450b['query'][_0xeb62('0x39')]));_0x1b354d[_0xeb62('0x38')]=_0x1b354d[_0xeb62('0x38')][_0xeb62('0x4d')]?_0x1b354d['attributes']:_0x222d0c[_0xeb62('0x34')];if(!_0x3a450b[_0xeb62('0x36')][_0xeb62('0x3a')](_0xeb62('0x3b'))){_0x1b354d[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x3a450b[_0xeb62('0x36')][_0xeb62('0x24')]);_0x1b354d[_0xeb62('0x23')]=qs[_0xeb62('0x23')](_0x3a450b[_0xeb62('0x36')]['offset']);}_0x1b354d[_0xeb62('0x3c')]=qs[_0xeb62('0x3d')](_0x3a450b[_0xeb62('0x36')][_0xeb62('0x3d')]);_0x1b354d[_0xeb62('0x3e')]=qs[_0xeb62('0x40')](_[_0xeb62('0x3f')](_0x3a450b[_0xeb62('0x36')],_0x222d0c[_0xeb62('0x40')]));_0x1b354d[_0xeb62('0x3e')]['MailQueueId']=_0x472610['id'];if(_0x3a450b[_0xeb62('0x36')][_0xeb62('0x41')]){_0x1b354d[_0xeb62('0x3e')]=_[_0xeb62('0x42')](_0x1b354d['where'],{'$or':_[_0xeb62('0x31')](_0x1b354d[_0xeb62('0x38')],function(_0x3f7dc8){var _0xdde337={};_0xdde337[_0x3f7dc8]={'$like':'%'+_0x3a450b[_0xeb62('0x36')][_0xeb62('0x41')]+'%'};return _0xdde337;})});}_0x1b354d=_['merge']({},_0x1b354d,_0x3a450b[_0xeb62('0x5c')]);return db[_0xeb62('0x5d')][_0xeb62('0x47')](_0x1b354d);}})[_0xeb62('0x2b')](function(_0x351acf){if(_0x351acf){return db[_0xeb62('0x5e')][_0xeb62('0x5f')]({'where':{'id':_[_0xeb62('0x31')](_0x351acf,_0xeb62('0x60')),'role':_0xeb62('0x61')},'attributes':['id',_0xeb62('0x2f'),_0xeb62('0x62'),_0xeb62('0x63'),_0xeb62('0x64')]});}})[_0xeb62('0x2b')](function(_0x2bbbff){if(_0x2bbbff){return{'count':_0x2bbbff['count'],'rows':_[_0xeb62('0x31')](_0x2bbbff['rows'],function(_0x6ea297){return{'membername':_0x6ea297[_0xeb62('0x2f')],'UserId':_0x6ea297['id'],'queue_name':_0x1db841['name'],'MailQueueId':_0x1db841['id'],'interface':util[_0xeb62('0x65')](_0xeb62('0x66'),_0xeb62('0x67'),_0x6ea297[_0xeb62('0x2f')]),'penalty':0x0,'paused':_0x6ea297[_0xeb62('0x62')],'createdAt':_0x6ea297[_0xeb62('0x64')],'updatedAt':_0x6ea297[_0xeb62('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeb62('0x2b')](respondWithFilteredResult(_0x46da69,_0x1b354d))[_0xeb62('0x49')](handleError(_0x46da69,null));};exports[_0xeb62('0x68')]=function(_0x17d1ff,_0x146174,_0x910940){var _0x4c6b69={};var _0x26091f={};var _0x1d058d;var _0x5868cc;return db[_0xeb62('0x32')]['findOne']({'where':{'id':_0x17d1ff[_0xeb62('0x4b')]['id']}})[_0xeb62('0x2b')](handleEntityNotFound(_0x146174,null))[_0xeb62('0x2b')](function(_0x10dee9){if(_0x10dee9){_0x1d058d=_0x10dee9;_0x26091f[_0xeb62('0x34')]=_[_0xeb62('0x35')](db['Team'][_0xeb62('0x4c')]);_0x26091f['query']=_[_0xeb62('0x35')](_0x17d1ff[_0xeb62('0x36')]);_0x26091f[_0xeb62('0x40')]=_[_0xeb62('0x37')](_0x26091f[_0xeb62('0x34')],_0x26091f['query']);_0x4c6b69[_0xeb62('0x38')]=_[_0xeb62('0x37')](_0x26091f[_0xeb62('0x34')],qs['fields'](_0x17d1ff[_0xeb62('0x36')][_0xeb62('0x39')]));_0x4c6b69[_0xeb62('0x38')]=_0x4c6b69[_0xeb62('0x38')][_0xeb62('0x4d')]?_0x4c6b69[_0xeb62('0x38')]:_0x26091f['model'];_0x4c6b69['order']=qs['sort'](_0x17d1ff['query']['sort']);_0x4c6b69[_0xeb62('0x3e')]=qs[_0xeb62('0x40')](_[_0xeb62('0x3f')](_0x17d1ff[_0xeb62('0x36')],_0x26091f[_0xeb62('0x40')]));if(_0x17d1ff[_0xeb62('0x36')][_0xeb62('0x41')]){_0x4c6b69[_0xeb62('0x3e')]=_[_0xeb62('0x42')](_0x4c6b69[_0xeb62('0x3e')],{'$or':_[_0xeb62('0x31')](_0x4c6b69[_0xeb62('0x38')],function(_0x491d2d){var _0x71c47b={};_0x71c47b[_0x491d2d]={'$like':'%'+_0x17d1ff[_0xeb62('0x36')][_0xeb62('0x41')]+'%'};return _0x71c47b;})});}_0x4c6b69=_[_0xeb62('0x42')]({},_0x4c6b69,_0x17d1ff[_0xeb62('0x5c')]);return _0x1d058d[_0xeb62('0x68')](_0x4c6b69);}})[_0xeb62('0x2b')](function(_0x214fd0){if(_0x214fd0){_0x5868cc=_0x214fd0[_0xeb62('0x4d')];if(!_0x17d1ff[_0xeb62('0x36')][_0xeb62('0x3a')](_0xeb62('0x3b'))){_0x4c6b69[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x17d1ff[_0xeb62('0x36')][_0xeb62('0x24')]);_0x4c6b69[_0xeb62('0x23')]=qs[_0xeb62('0x23')](_0x17d1ff['query'][_0xeb62('0x23')]);}return _0x1d058d['getTeams'](_0x4c6b69);}})[_0xeb62('0x2b')](function(_0x3e9287){if(_0x3e9287){return _0x3e9287?{'count':_0x5868cc,'rows':_0x3e9287}:null;}})['then'](respondWithResult(_0x146174,null))[_0xeb62('0x49')](handleError(_0x146174,null));};exports['addTeams']=function(_0x51e954,_0x15f716,_0x218139){var _0x43727a=_0x51e954[_0xeb62('0x50')]['ids'];return db[_0xeb62('0x69')][_0xeb62('0x47')]({'where':{'id':_0x43727a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb62('0x6a'),'attributes':['id',_0xeb62('0x2f'),_0xeb62('0x6b'),_0xeb62('0x6c'),_0xeb62('0x6d')],'raw':!![]}]})[_0xeb62('0x2b')](function(_0x119f9c){if(_0x119f9c){var _0x3d2fc4=_['flatMap'](_0x119f9c,function(_0x32ae8e){var _0x2e57b2=_0x32ae8e['get']({'plain':!![]});return _0x2e57b2[_0xeb62('0x6a')];});return db['MailQueue']['find']({'where':{'id':_0x51e954[_0xeb62('0x4b')]['id']}})[_0xeb62('0x2b')](function(_0x45a1d2){return db[_0xeb62('0x6e')][_0xeb62('0x6f')](function(_0x5072fd){return _0x45a1d2[_0xeb62('0x70')](_0x43727a,{'transaction':_0x5072fd})[_0xeb62('0x2b')](function(){return BPromise[_0xeb62('0x71')](_0x3d2fc4,function(_0x284cbd){return db[_0xeb62('0x5d')][_0xeb62('0x72')]({'where':{'UserId':_0x284cbd['id'],'MailQueueId':_0x51e954[_0xeb62('0x4b')]['id']},'transaction':_0x5072fd});});})[_0xeb62('0x2b')](function(){_0x3d2fc4['forEach'](function(_0x53d4bb){socket[_0xeb62('0x73')](_0xeb62('0x74'),{'UserId':_0x53d4bb['id'],'MailQueueId':_0x45a1d2['id']});});});});});}})[_0xeb62('0x2b')](respondWithStatusCode(_0x15f716,null))[_0xeb62('0x49')](handleError(_0x15f716,null));};exports['removeTeams']=function(_0x63ce7a,_0x539f30,_0x5acc3a){return db[_0xeb62('0x69')][_0xeb62('0x47')]({'where':{'id':_0x63ce7a['query'][_0xeb62('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb62('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xeb62('0x2b')](handleEntityNotFound(_0x539f30,null))[_0xeb62('0x2b')](function(_0x5bad3f){var _0x58bb25=_[_0xeb62('0x31')](_0x5bad3f,'id');var _0x276e06=[];var _0x310268=[];var _0x4b6e6b=squel[_0xeb62('0x76')]();_0x4b6e6b[_0xeb62('0x77')](_0xeb62('0x78'))[_0xeb62('0x79')](_0xeb62('0x7a'),'tq')[_0xeb62('0x7b')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xeb62('0x7c'),_0x63ce7a['params']['id']);for(var _0x47929d=0x0;_0x47929d<_0x5bad3f[_0xeb62('0x4d')];_0x47929d+=0x1){let _0x49d2c7=_0x5bad3f[_0x47929d];for(var _0x4feb08=0x0;_0x4feb08<_0x49d2c7['Agents'][_0xeb62('0x4d')];_0x4feb08+=0x1){let _0x5c48c8=_0x49d2c7[_0xeb62('0x6a')][_0x4feb08];var _0x169b13=_0x4b6e6b[_0xeb62('0x7d')]();_0x169b13[_0xeb62('0x3e')](_0xeb62('0x7e'),_0x5c48c8['id']);_0x310268[_0xeb62('0x7f')](db[_0xeb62('0x6e')]['query'](_0x169b13['toString'](),{'type':db[_0xeb62('0x6e')][_0xeb62('0x80')][_0xeb62('0x81')]})[_0xeb62('0x2b')](function(_0x32495e){if(_0x32495e['length']===0x1){return _0x5c48c8['id'];}else{var _0x35d920=_[_0xeb62('0x82')](_[_0xeb62('0x31')](_0x32495e,'TeamId'),function(_0x7c03a4){return _['includes'](_0x58bb25,_0x7c03a4);});if(_0x35d920){return _0x5c48c8['id'];}}}));}}return BPromise[_0xeb62('0x83')](_0x310268)[_0xeb62('0x2b')](function(_0x4ff08a){_0x276e06=_(_0x276e06)['union'](_0x4ff08a)[_0xeb62('0x84')]()[_0xeb62('0x85')]();return db[_0xeb62('0x32')][_0xeb62('0x54')]({'where':{'id':_0x63ce7a['params']['id']}})[_0xeb62('0x2b')](function(_0x19e57f){return db['sequelize']['transaction'](function(_0x12adf6){return _0x19e57f[_0xeb62('0x86')](_0x63ce7a[_0xeb62('0x36')][_0xeb62('0x75')],{'transaction':_0x12adf6})[_0xeb62('0x2b')](function(){if(!_[_0xeb62('0x87')](_0x276e06)){return _0x19e57f[_0xeb62('0x88')](_0x276e06,{'transaction':_0x12adf6});}})[_0xeb62('0x2b')](function(){_0x276e06[_0xeb62('0x89')](function(_0x416ec7){socket[_0xeb62('0x73')](_0xeb62('0x8a'),{'UserId':_0x416ec7,'MailQueueId':_0x19e57f['id']});});});});});});})[_0xeb62('0x2b')](respondWithStatusCode(_0x539f30,null))[_0xeb62('0x49')](handleError(_0x539f30,null));};exports[_0xeb62('0x8b')]=function(_0xf2a819,_0x5984d2,_0x1be079){return db[_0xeb62('0x32')][_0xeb62('0x54')]({'where':{'id':_0xf2a819[_0xeb62('0x4b')]['id']}})[_0xeb62('0x2b')](handleEntityNotFound(_0x5984d2,null))['then'](function(_0x54984f){if(_0x54984f){return _0x54984f[_0xeb62('0x8b')](_0xf2a819[_0xeb62('0x50')][_0xeb62('0x75')],_[_0xeb62('0x8c')](_0xf2a819['body'],[_0xeb62('0x75'),'id'])||{})['spread'](function(_0x2e4e2d){for(var _0x129fe6=0x0;_0x129fe6<_0xf2a819[_0xeb62('0x50')][_0xeb62('0x75')][_0xeb62('0x4d')];_0x129fe6+=0x1){socket['emit'](_0xeb62('0x74'),{'UserId':_0xf2a819[_0xeb62('0x50')]['ids'][_0x129fe6],'MailQueueId':_0xf2a819[_0xeb62('0x4b')]['id']});}return _0x2e4e2d;});}})['then'](respondWithResult(_0x5984d2,null))[_0xeb62('0x49')](handleError(_0x5984d2,null));};exports[_0xeb62('0x88')]=function(_0x2e503b,_0x106bfb,_0x45a197){return db[_0xeb62('0x32')]['find']({'where':{'id':_0x2e503b['params']['id']}})[_0xeb62('0x2b')](handleEntityNotFound(_0x106bfb,null))[_0xeb62('0x2b')](function(_0x171262){if(_0x171262){return _0x171262[_0xeb62('0x88')](_0x2e503b['query']['ids'])[_0xeb62('0x2b')](function(){if(_['isArray'](_0x2e503b[_0xeb62('0x36')][_0xeb62('0x75')])){for(var _0x46bdad=0x0;_0x46bdad<_0x2e503b['query'][_0xeb62('0x75')][_0xeb62('0x4d')];_0x46bdad+=0x1){socket[_0xeb62('0x73')](_0xeb62('0x8a'),{'UserId':Number(_0x2e503b[_0xeb62('0x36')][_0xeb62('0x75')][_0x46bdad]),'MailQueueId':Number(_0x2e503b[_0xeb62('0x4b')]['id'])});}}else{socket[_0xeb62('0x73')]('userMailQueue:remove',{'UserId':Number(_0x2e503b[_0xeb62('0x36')][_0xeb62('0x75')]),'MailQueueId':Number(_0x2e503b[_0xeb62('0x4b')]['id'])});}});}})[_0xeb62('0x2b')](respondWithStatusCode(_0x106bfb,null))['catch'](handleError(_0x106bfb,null));};exports[_0xeb62('0x8d')]=function(_0x194138,_0xf3b5ac,_0x146c7e){var _0x24c285={};var _0x59bb00={};var _0x36919c;var _0x2d7b74;return db[_0xeb62('0x32')][_0xeb62('0x5b')]({'where':{'id':_0x194138[_0xeb62('0x4b')]['id']}})[_0xeb62('0x2b')](handleEntityNotFound(_0xf3b5ac,null))[_0xeb62('0x2b')](function(_0x1087f1){if(_0x1087f1){_0x36919c=_0x1087f1;_0x59bb00[_0xeb62('0x34')]=_[_0xeb62('0x35')](db['User'][_0xeb62('0x4c')]);_0x59bb00[_0xeb62('0x36')]=_['keys'](_0x194138['query']);_0x59bb00[_0xeb62('0x40')]=_[_0xeb62('0x37')](_0x59bb00[_0xeb62('0x34')],_0x59bb00[_0xeb62('0x36')]);_0x24c285[_0xeb62('0x38')]=_[_0xeb62('0x37')](_0x59bb00[_0xeb62('0x34')],qs[_0xeb62('0x39')](_0x194138[_0xeb62('0x36')]['fields']));_0x24c285['attributes']=_0x24c285[_0xeb62('0x38')][_0xeb62('0x4d')]?_0x24c285['attributes']:_0x59bb00['model'];_0x24c285[_0xeb62('0x3c')]=qs[_0xeb62('0x3d')](_0x194138[_0xeb62('0x36')]['sort']);_0x24c285['where']=qs[_0xeb62('0x40')](_['pick'](_0x194138[_0xeb62('0x36')],_0x59bb00[_0xeb62('0x40')]));if(_0x194138[_0xeb62('0x36')]['filter']){_0x24c285['where']=_['merge'](_0x24c285[_0xeb62('0x3e')],{'$or':_[_0xeb62('0x31')](_0x24c285[_0xeb62('0x38')],function(_0x1c0a59){var _0x5bd3b6={};_0x5bd3b6[_0x1c0a59]={'$like':'%'+_0x194138[_0xeb62('0x36')][_0xeb62('0x41')]+'%'};return _0x5bd3b6;})});}_0x24c285=_[_0xeb62('0x42')]({},_0x24c285,_0x194138[_0xeb62('0x5c')]);return _0x36919c[_0xeb62('0x8d')](_0x24c285);}})[_0xeb62('0x2b')](function(_0x114ad3){if(_0x114ad3){_0x2d7b74=_0x114ad3[_0xeb62('0x4d')];if(!_0x194138['query'][_0xeb62('0x3a')](_0xeb62('0x3b'))){_0x24c285[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x194138['query'][_0xeb62('0x24')]);_0x24c285[_0xeb62('0x23')]=qs['offset'](_0x194138[_0xeb62('0x36')][_0xeb62('0x23')]);}return _0x36919c[_0xeb62('0x8d')](_0x24c285);}})[_0xeb62('0x2b')](function(_0x1f8a23){if(_0x1f8a23){return _0x1f8a23?{'count':_0x2d7b74,'rows':_0x1f8a23}:null;}})[_0xeb62('0x2b')](respondWithResult(_0xf3b5ac,null))[_0xeb62('0x49')](handleError(_0xf3b5ac,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5090f28..bf45c17 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 _0x2d46=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2d46,0x76));var _0x62d4=function(_0x32385a,_0xfb0159){_0x32385a=_0x32385a-0x0;var _0x5434f3=_0x2d46[_0x32385a];return _0x5434f3;};'use strict';var EventEmitter=require(_0x62d4('0x0'));var MailQueue=require(_0x62d4('0x1'))['db'][_0x62d4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x62d4('0x3')](0x0);var events={'afterCreate':_0x62d4('0x4'),'afterUpdate':_0x62d4('0x5'),'afterDestroy':_0x62d4('0x6')};function emitEvent(_0x4337b5){return function(_0x826704,_0x8a3952,_0x58d684){MailQueueEvents[_0x62d4('0x7')](_0x4337b5+':'+_0x826704['id'],_0x826704);MailQueueEvents[_0x62d4('0x7')](_0x4337b5,_0x826704);_0x58d684(null);};}for(var e in events){if(events[_0x62d4('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x62d4('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xc69e=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4477f3,_0x3a94a9){var _0xcfb81c=function(_0x56740f){while(--_0x56740f){_0x4477f3['push'](_0x4477f3['shift']());}};_0xcfb81c(++_0x3a94a9);}(_0xc69e,0x1c5));var _0xec69=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc69e[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0xec69('0x0'));var MailQueue=require(_0xec69('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec69('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x859e58){return function(_0x37eb44,_0x1de11d,_0x3055c2){MailQueueEvents['emit'](_0x859e58+':'+_0x37eb44['id'],_0x37eb44);MailQueueEvents[_0xec69('0x3')](_0x859e58,_0x37eb44);_0x3055c2(null);};}for(var e in events){if(events[_0xec69('0x4')](e)){var event=events[e];MailQueue[_0xec69('0x5')](e,emitEvent(event));}}module[_0xec69('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 ad0c982..28e1c40 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 _0x6aa0=['exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./mailQueue.attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6aa0,0x9e));var _0x06aa=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x6aa0[_0x119705];return _0x2affc2;};'use strict';var _=require(_0x06aa('0x0'));var util=require('util');var logger=require(_0x06aa('0x1'))(_0x06aa('0x2'));var moment=require('moment');var BPromise=require(_0x06aa('0x3'));var rp=require(_0x06aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06aa('0x5'));var config=require('../../config/environment');var attributes=require(_0x06aa('0x6'));module[_0x06aa('0x7')]=function(_0x2a13c5,_0x4fe161){return _0x2a13c5[_0x06aa('0x8')](_0x06aa('0x9'),attributes,{'tableName':_0x06aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b6=['lodash','util','../../config/logger','moment','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x5be743,_0x409f10){var _0x3303d0=function(_0x31a665){while(--_0x31a665){_0x5be743['push'](_0x5be743['shift']());}};_0x3303d0(++_0x409f10);}(_0x97b6,0x19a));var _0x697b=function(_0xd4f90b,_0x148333){_0xd4f90b=_0xd4f90b-0x0;var _0x451848=_0x97b6[_0xd4f90b];return _0x451848;};'use strict';var _=require(_0x697b('0x0'));var util=require(_0x697b('0x1'));var logger=require(_0x697b('0x2'))('api');var moment=require(_0x697b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x697b('0x4'));var config=require('../../config/environment');var attributes=require(_0x697b('0x5'));module[_0x697b('0x6')]=function(_0x485373,_0x1d473e){return _0x485373[_0x697b('0x7')](_0x697b('0x8'),attributes,{'tableName':_0x697b('0x9'),'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 6cfb9e0..d786793 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 _0x72ba=['GetMailQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowMailQueue','MailQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x44c36f,_0x1f93f6){var _0x1e1c7a=function(_0x267646){while(--_0x267646){_0x44c36f['push'](_0x44c36f['shift']());}};_0x1e1c7a(++_0x1f93f6);}(_0x72ba,0x8a));var _0xa72b=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x72ba[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xa72b('0x0'));var util=require(_0xa72b('0x1'));var moment=require('moment');var BPromise=require(_0xa72b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa72b('0x3'));var db=require(_0xa72b('0x4'))['db'];var utils=require(_0xa72b('0x5'));var logger=require(_0xa72b('0x6'))(_0xa72b('0x7'));var config=require(_0xa72b('0x8'));var jayson=require(_0xa72b('0x9'));var client=jayson[_0xa72b('0xa')][_0xa72b('0xb')]({'port':0x232a});config[_0xa72b('0xc')]=_[_0xa72b('0xd')](config[_0xa72b('0xc')],{'host':_0xa72b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa72b('0xc')]));require(_0xa72b('0xf'))['register'](socket);function respondWithRpcPromise(_0x528774,_0x20d480,_0x204718){return new BPromise(function(_0x1f5e05,_0x110a00){return client['request'](_0x528774,_0x204718)[_0xa72b('0x10')](function(_0x540c87){logger[_0xa72b('0x11')](_0xa72b('0x12'),_0x20d480,'request\x20sent');logger[_0xa72b('0x13')](_0xa72b('0x14'),_0x20d480,'request\x20sent',JSON['stringify'](_0x540c87));if(_0x540c87['error']){if(_0x540c87[_0xa72b('0x15')][_0xa72b('0x16')]===0x1f4){logger['error'](_0xa72b('0x12'),_0x20d480,_0x540c87['error'][_0xa72b('0x17')]);return _0x110a00(_0x540c87[_0xa72b('0x15')][_0xa72b('0x17')]);}logger[_0xa72b('0x15')]('MailQueue,\x20%s,\x20%s',_0x20d480,_0x540c87[_0xa72b('0x15')][_0xa72b('0x17')]);return _0x1f5e05(_0x540c87[_0xa72b('0x15')][_0xa72b('0x17')]);}else{logger[_0xa72b('0x11')](_0xa72b('0x12'),_0x20d480,_0xa72b('0x18'));_0x1f5e05(_0x540c87[_0xa72b('0x19')][_0xa72b('0x17')]);}})['catch'](function(_0x5d1a24){logger[_0xa72b('0x15')](_0xa72b('0x12'),_0x20d480,_0x5d1a24);_0x110a00(_0x5d1a24);});});}exports[_0xa72b('0x1a')]=function(_0x4fed7c){var _0x142e38=this;return new Promise(function(_0x5ae1e0,_0x4eb4f5){return db['MailQueue'][_0xa72b('0x1b')]({'raw':_0x4fed7c[_0xa72b('0x1c')]?_0x4fed7c['options'][_0xa72b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4fed7c[_0xa72b('0x1c')]?_0x4fed7c[_0xa72b('0x1c')][_0xa72b('0x1e')]||null:null,'attributes':_0x4fed7c[_0xa72b('0x1c')]?_0x4fed7c['options']['attributes']||null:null,'limit':_0x4fed7c[_0xa72b('0x1c')]?_0x4fed7c['options'][_0xa72b('0x1f')]||null:null,'include':_0x4fed7c[_0xa72b('0x1c')]?_0x4fed7c[_0xa72b('0x1c')][_0xa72b('0x20')]?_[_0xa72b('0x21')](_0x4fed7c[_0xa72b('0x1c')][_0xa72b('0x20')],function(_0x1d5dae){return{'model':db[_0x1d5dae[_0xa72b('0x22')]],'as':_0x1d5dae['as'],'attributes':_0x1d5dae[_0xa72b('0x23')],'include':_0x1d5dae[_0xa72b('0x20')]?_['map'](_0x1d5dae[_0xa72b('0x20')],function(_0x25f772){return{'model':db[_0x25f772[_0xa72b('0x22')]],'as':_0x25f772['as'],'attributes':_0x25f772[_0xa72b('0x23')],'include':_0x25f772[_0xa72b('0x20')]?_[_0xa72b('0x21')](_0x25f772[_0xa72b('0x20')],function(_0x21a640){return{'model':db[_0x21a640['model']],'as':_0x21a640['as'],'attributes':_0x21a640['attributes']};}):[]};}):[]};}):[]:[]})[_0xa72b('0x10')](function(_0x4d2a1f){logger[_0xa72b('0x11')](_0xa72b('0x1a'),_0x4fed7c);logger[_0xa72b('0x13')]('GetMailQueue',_0x4fed7c,JSON[_0xa72b('0x24')](_0x4d2a1f));_0x5ae1e0(_0x4d2a1f);})[_0xa72b('0x25')](function(_0x59be97){logger[_0xa72b('0x15')]('GetMailQueue',_0x59be97[_0xa72b('0x17')],_0x4fed7c);_0x4eb4f5(_0x142e38[_0xa72b('0x15')](0x1f4,_0x59be97[_0xa72b('0x17')]));});});};exports[_0xa72b('0x26')]=function(_0x5c2f32){var _0x2140d2=this;return new Promise(function(_0x37ebbc,_0x54adb7){return db[_0xa72b('0x27')][_0xa72b('0x28')]({'raw':_0x5c2f32[_0xa72b('0x1c')]?_0x5c2f32[_0xa72b('0x1c')][_0xa72b('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c2f32[_0xa72b('0x1c')]?_0x5c2f32[_0xa72b('0x1c')]['where']||null:null,'attributes':_0x5c2f32[_0xa72b('0x1c')]?_0x5c2f32['options'][_0xa72b('0x23')]||null:null,'include':_0x5c2f32[_0xa72b('0x1c')]?_0x5c2f32[_0xa72b('0x1c')][_0xa72b('0x20')]?_['map'](_0x5c2f32[_0xa72b('0x1c')][_0xa72b('0x20')],function(_0x31b2be){return{'model':db[_0x31b2be[_0xa72b('0x22')]],'as':_0x31b2be['as'],'attributes':_0x31b2be[_0xa72b('0x23')],'include':_0x31b2be['include']?_['map'](_0x31b2be[_0xa72b('0x20')],function(_0x98a619){return{'model':db[_0x98a619['model']],'as':_0x98a619['as'],'attributes':_0x98a619[_0xa72b('0x23')],'include':_0x98a619[_0xa72b('0x20')]?_[_0xa72b('0x21')](_0x98a619[_0xa72b('0x20')],function(_0x245dae){return{'model':db[_0x245dae['model']],'as':_0x245dae['as'],'attributes':_0x245dae['attributes']};}):[]};}):[]};}):[]:[]})[_0xa72b('0x10')](function(_0x2a50f7){logger['info'](_0xa72b('0x26'),_0x5c2f32);logger[_0xa72b('0x13')](_0xa72b('0x26'),_0x5c2f32,JSON[_0xa72b('0x24')](_0x2a50f7));_0x37ebbc(_0x2a50f7);})[_0xa72b('0x25')](function(_0x8ed029){logger[_0xa72b('0x15')]('ShowMailQueue',_0x8ed029[_0xa72b('0x17')],_0x5c2f32);_0x54adb7(_0x2140d2['error'](0x1f4,_0x8ed029[_0xa72b('0x17')]));});});}; \ No newline at end of file +var _0x3cf5=['limit','include','map','model','ShowMailQueue','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes'];(function(_0x1eedfe,_0x4c4642){var _0x1f8a26=function(_0x404252){while(--_0x404252){_0x1eedfe['push'](_0x1eedfe['shift']());}};_0x1f8a26(++_0x4c4642);}(_0x3cf5,0x135));var _0x53cf=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x3cf5[_0x40ebff];return _0x40122a;};'use strict';var _=require(_0x53cf('0x0'));var util=require('util');var moment=require(_0x53cf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53cf('0x2'));var db=require(_0x53cf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x53cf('0x4'))(_0x53cf('0x5'));var config=require(_0x53cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x53cf('0x7')][_0x53cf('0x8')]({'port':0x232a});config[_0x53cf('0x9')]=_[_0x53cf('0xa')](config[_0x53cf('0x9')],{'host':_0x53cf('0xb'),'port':0x18eb});var socket=require(_0x53cf('0xc'))(new Redis(config[_0x53cf('0x9')]));require(_0x53cf('0xd'))['register'](socket);function respondWithRpcPromise(_0x8ac943,_0x85a5e1,_0x4dfae9){return new BPromise(function(_0x463805,_0x2def03){return client[_0x53cf('0xe')](_0x8ac943,_0x4dfae9)[_0x53cf('0xf')](function(_0x40f044){logger['info'](_0x53cf('0x10'),_0x85a5e1,'request\x20sent');logger[_0x53cf('0x11')](_0x53cf('0x12'),_0x85a5e1,_0x53cf('0x13'),JSON[_0x53cf('0x14')](_0x40f044));if(_0x40f044[_0x53cf('0x15')]){if(_0x40f044[_0x53cf('0x15')][_0x53cf('0x16')]===0x1f4){logger[_0x53cf('0x15')](_0x53cf('0x10'),_0x85a5e1,_0x40f044[_0x53cf('0x15')][_0x53cf('0x17')]);return _0x2def03(_0x40f044[_0x53cf('0x15')][_0x53cf('0x17')]);}logger[_0x53cf('0x15')](_0x53cf('0x10'),_0x85a5e1,_0x40f044[_0x53cf('0x15')][_0x53cf('0x17')]);return _0x463805(_0x40f044[_0x53cf('0x15')][_0x53cf('0x17')]);}else{logger[_0x53cf('0x18')](_0x53cf('0x10'),_0x85a5e1,_0x53cf('0x13'));_0x463805(_0x40f044[_0x53cf('0x19')][_0x53cf('0x17')]);}})[_0x53cf('0x1a')](function(_0x3db5b3){logger[_0x53cf('0x15')](_0x53cf('0x10'),_0x85a5e1,_0x3db5b3);_0x2def03(_0x3db5b3);});});}exports[_0x53cf('0x1b')]=function(_0x1db98c){var _0x4a0712=this;return new Promise(function(_0x1d35a7,_0x1f61b3){return db[_0x53cf('0x1c')][_0x53cf('0x1d')]({'raw':_0x1db98c[_0x53cf('0x1e')]?_0x1db98c[_0x53cf('0x1e')][_0x53cf('0x1f')]===undefined?!![]:![]:!![],'where':_0x1db98c[_0x53cf('0x1e')]?_0x1db98c['options']['where']||null:null,'attributes':_0x1db98c[_0x53cf('0x1e')]?_0x1db98c[_0x53cf('0x1e')][_0x53cf('0x20')]||null:null,'limit':_0x1db98c[_0x53cf('0x1e')]?_0x1db98c['options'][_0x53cf('0x21')]||null:null,'include':_0x1db98c[_0x53cf('0x1e')]?_0x1db98c[_0x53cf('0x1e')][_0x53cf('0x22')]?_[_0x53cf('0x23')](_0x1db98c[_0x53cf('0x1e')][_0x53cf('0x22')],function(_0x5a3577){return{'model':db[_0x5a3577[_0x53cf('0x24')]],'as':_0x5a3577['as'],'attributes':_0x5a3577['attributes'],'include':_0x5a3577[_0x53cf('0x22')]?_[_0x53cf('0x23')](_0x5a3577['include'],function(_0x3e3f55){return{'model':db[_0x3e3f55[_0x53cf('0x24')]],'as':_0x3e3f55['as'],'attributes':_0x3e3f55[_0x53cf('0x20')],'include':_0x3e3f55[_0x53cf('0x22')]?_[_0x53cf('0x23')](_0x3e3f55[_0x53cf('0x22')],function(_0x3032e2){return{'model':db[_0x3032e2['model']],'as':_0x3032e2['as'],'attributes':_0x3032e2[_0x53cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x53cf('0xf')](function(_0x2fafcb){logger['info'](_0x53cf('0x1b'),_0x1db98c);logger[_0x53cf('0x11')]('GetMailQueue',_0x1db98c,JSON[_0x53cf('0x14')](_0x2fafcb));_0x1d35a7(_0x2fafcb);})[_0x53cf('0x1a')](function(_0x98f08d){logger[_0x53cf('0x15')](_0x53cf('0x1b'),_0x98f08d['message'],_0x1db98c);_0x1f61b3(_0x4a0712['error'](0x1f4,_0x98f08d[_0x53cf('0x17')]));});});};exports['ShowMailQueue']=function(_0x2e444d){var _0xdecf99=this;return new Promise(function(_0x3c676d,_0x37989e){return db[_0x53cf('0x1c')]['find']({'raw':_0x2e444d[_0x53cf('0x1e')]?_0x2e444d[_0x53cf('0x1e')][_0x53cf('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e444d['options']?_0x2e444d[_0x53cf('0x1e')]['where']||null:null,'attributes':_0x2e444d['options']?_0x2e444d['options'][_0x53cf('0x20')]||null:null,'include':_0x2e444d[_0x53cf('0x1e')]?_0x2e444d[_0x53cf('0x1e')][_0x53cf('0x22')]?_['map'](_0x2e444d[_0x53cf('0x1e')]['include'],function(_0x53a3d6){return{'model':db[_0x53a3d6[_0x53cf('0x24')]],'as':_0x53a3d6['as'],'attributes':_0x53a3d6[_0x53cf('0x20')],'include':_0x53a3d6[_0x53cf('0x22')]?_['map'](_0x53a3d6[_0x53cf('0x22')],function(_0x5c3a47){return{'model':db[_0x5c3a47[_0x53cf('0x24')]],'as':_0x5c3a47['as'],'attributes':_0x5c3a47[_0x53cf('0x20')],'include':_0x5c3a47[_0x53cf('0x22')]?_[_0x53cf('0x23')](_0x5c3a47[_0x53cf('0x22')],function(_0x3475c1){return{'model':db[_0x3475c1[_0x53cf('0x24')]],'as':_0x3475c1['as'],'attributes':_0x3475c1[_0x53cf('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5be2a8){logger['info'](_0x53cf('0x25'),_0x2e444d);logger[_0x53cf('0x11')](_0x53cf('0x25'),_0x2e444d,JSON[_0x53cf('0x14')](_0x5be2a8));_0x3c676d(_0x5be2a8);})['catch'](function(_0x502a5c){logger[_0x53cf('0x15')](_0x53cf('0x25'),_0x502a5c[_0x53cf('0x17')],_0x2e444d);_0x37989e(_0xdecf99[_0x53cf('0x15')](0x1f4,_0x502a5c[_0x53cf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ca2d9da..4817247 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 _0xa9fb=['./mailQueue.events','remove','emit','removeListener','mailQueue:'];(function(_0x15c9d1,_0x6030dc){var _0x538f6c=function(_0x424c56){while(--_0x424c56){_0x15c9d1['push'](_0x15c9d1['shift']());}};_0x538f6c(++_0x6030dc);}(_0xa9fb,0x73));var _0xba9f=function(_0x186e2e,_0x3829c0){_0x186e2e=_0x186e2e-0x0;var _0x206942=_0xa9fb[_0x186e2e];return _0x206942;};'use strict';var MailQueueEvents=require(_0xba9f('0x0'));var events=['save',_0xba9f('0x1'),'update'];function createListener(_0xe1ab24,_0x1f19eb){return function(_0xb5c960){_0x1f19eb[_0xba9f('0x2')](_0xe1ab24,_0xb5c960);};}function removeListener(_0x12e542,_0x41facc){return function(){MailQueueEvents[_0xba9f('0x3')](_0x12e542,_0x41facc);};}exports['register']=function(_0x281582){for(var _0x5771e9=0x0,_0x290049=events['length'];_0x5771e9<_0x290049;_0x5771e9++){var _0x19e8ed=events[_0x5771e9];var _0x461bac=createListener(_0xba9f('0x4')+_0x19e8ed,_0x281582);MailQueueEvents['on'](_0x19e8ed,_0x461bac);}}; \ No newline at end of file +var _0x24fe=['removeListener','mailQueue:','save','update','emit'];(function(_0x11c180,_0x44d275){var _0x49b7c0=function(_0x286389){while(--_0x286389){_0x11c180['push'](_0x11c180['shift']());}};_0x49b7c0(++_0x44d275);}(_0x24fe,0x19c));var _0xe24f=function(_0xde4d6,_0x3f5981){_0xde4d6=_0xde4d6-0x0;var _0xb78618=_0x24fe[_0xde4d6];return _0xb78618;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xe24f('0x0'),'remove',_0xe24f('0x1')];function createListener(_0x21ad5d,_0x39e94c){return function(_0x475d66){_0x39e94c[_0xe24f('0x2')](_0x21ad5d,_0x475d66);};}function removeListener(_0x39b956,_0x360415){return function(){MailQueueEvents[_0xe24f('0x3')](_0x39b956,_0x360415);};}exports['register']=function(_0x486402){for(var _0x42bcfb=0x0,_0x53a9f1=events['length'];_0x42bcfb<_0x53a9f1;_0x42bcfb++){var _0x24d8d5=events[_0x42bcfb];var _0x21c6a8=createListener(_0xe24f('0x4')+_0x24d8d5,_0x486402);MailQueueEvents['on'](_0x24d8d5,_0x21c6a8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 2874388..b4d56f5 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 _0xe149=['index','get','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe149,0x188));var _0x9e14=function(_0x4a013b,_0x2051a2){_0x4a013b=_0x4a013b-0x0;var _0x2b1652=_0xe149[_0x4a013b];return _0x2b1652;};'use strict';var multer=require(_0x9e14('0x0'));var util=require(_0x9e14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9e14('0x2'));var router=express[_0x9e14('0x3')]();var auth=require(_0x9e14('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e14('0x5'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x9e14('0x6')](),controller[_0x9e14('0x7')]);router[_0x9e14('0x8')](_0x9e14('0x9'),auth['isAuthenticated'](),controller[_0x9e14('0xa')]);router[_0x9e14('0x8')]('/:id',auth[_0x9e14('0x6')](),controller[_0x9e14('0xb')]);router[_0x9e14('0xc')]('/',auth[_0x9e14('0x6')](),controller['create']);router[_0x9e14('0xd')](_0x9e14('0xe'),auth['isAuthenticated'](),controller[_0x9e14('0xf')]);router[_0x9e14('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9e14('0x11')]);module[_0x9e14('0x12')]=router; \ No newline at end of file +var _0x7a77=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','delete','destroy'];(function(_0x31038b,_0x3ac1c9){var _0x1c9d3c=function(_0xe00e97){while(--_0xe00e97){_0x31038b['push'](_0x31038b['shift']());}};_0x1c9d3c(++_0x3ac1c9);}(_0x7a77,0x16a));var _0x77a7=function(_0x4ef55b,_0x12fd82){_0x4ef55b=_0x4ef55b-0x0;var _0x9ca06b=_0x7a77[_0x4ef55b];return _0x9ca06b;};'use strict';var multer=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var path=require(_0x77a7('0x2'));var timeout=require(_0x77a7('0x3'));var express=require('express');var router=express[_0x77a7('0x4')]();var auth=require(_0x77a7('0x5'));var interaction=require(_0x77a7('0x6'));var config=require('../../config/environment');var controller=require(_0x77a7('0x7'));router[_0x77a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x77a7('0x9')]);router[_0x77a7('0x8')]('/describe',auth[_0x77a7('0xa')](),controller[_0x77a7('0xb')]);router[_0x77a7('0x8')](_0x77a7('0xc'),auth[_0x77a7('0xa')](),controller[_0x77a7('0xd')]);router[_0x77a7('0xe')]('/',auth[_0x77a7('0xa')](),controller[_0x77a7('0xf')]);router['put'](_0x77a7('0xc'),auth[_0x77a7('0xa')](),controller['update']);router[_0x77a7('0x10')]('/:id',auth[_0x77a7('0xa')](),controller[_0x77a7('0x11')]);module[_0x77a7('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 f21ab5c..bfca4d9 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 _0x755b=['DATE','moment','STRING'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x755b,0xfa));var _0xb755=function(_0x568fc3,_0x56fedc){_0x568fc3=_0x568fc3-0x0;var _0x160dbe=_0x755b[_0x568fc3];return _0x160dbe;};'use strict';var moment=require(_0xb755('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb755('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb755('0x1')]},'joinAt':{'type':Sequelize[_0xb755('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb755('0x2')]},'exitAt':{'type':Sequelize[_0xb755('0x2')]},'reason':{'type':Sequelize[_0xb755('0x1')]}}; \ No newline at end of file +var _0x0ad9=['STRING','DATE','moment','sequelize','exports'];(function(_0x2e9b07,_0x5dce18){var _0x374995=function(_0x344a7f){while(--_0x344a7f){_0x2e9b07['push'](_0x2e9b07['shift']());}};_0x374995(++_0x5dce18);}(_0x0ad9,0x174));var _0x90ad=function(_0x33fc43,_0x4b9e92){_0x33fc43=_0x33fc43-0x0;var _0x5666a9=_0x0ad9[_0x33fc43];return _0x5666a9;};'use strict';var moment=require(_0x90ad('0x0'));var Sequelize=require(_0x90ad('0x1'));module[_0x90ad('0x2')]={'uniqueid':{'type':Sequelize[_0x90ad('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x90ad('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x90ad('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x90ad('0x4')]},'reason':{'type':Sequelize[_0x90ad('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index bdf20d8..8389917 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 _0x3a40=['body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','name','MailQueueReport','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','create'];(function(_0x597eb6,_0x4fbdea){var _0x58c0fb=function(_0x357767){while(--_0x357767){_0x597eb6['push'](_0x597eb6['shift']());}};_0x58c0fb(++_0x4fbdea);}(_0x3a40,0x1f3));var _0x03a4=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x3a40[_0x24f31b];return _0x488401;};'use strict';var pdf=require(_0x03a4('0x0'));var emlformat=require(_0x03a4('0x1'));var rimraf=require(_0x03a4('0x2'));var zipdir=require(_0x03a4('0x3'));var jsonpatch=require(_0x03a4('0x4'));var rp=require(_0x03a4('0x5'));var moment=require(_0x03a4('0x6'));var BPromise=require(_0x03a4('0x7'));var Mustache=require(_0x03a4('0x8'));var util=require('util');var path=require(_0x03a4('0x9'));var sox=require(_0x03a4('0xa'));var csv=require(_0x03a4('0xb'));var ejs=require(_0x03a4('0xc'));var fs=require('fs');var _=require(_0x03a4('0xd'));var squel=require('squel');var crypto=require(_0x03a4('0xe'));var jsforce=require(_0x03a4('0xf'));var deskjs=require(_0x03a4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x03a4('0x11'));var Papa=require(_0x03a4('0x12'));var Redis=require(_0x03a4('0x13'));var authService=require(_0x03a4('0x14'));var qs=require(_0x03a4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a4('0x16'));var logger=require(_0x03a4('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a0ee4,_0x455ca9){_0x455ca9=_0x455ca9||0xcc;return function(_0x4f62f8){if(_0x4f62f8){return _0x4a0ee4[_0x03a4('0x19')](_0x455ca9);}return _0x4a0ee4[_0x03a4('0x1a')](_0x455ca9)[_0x03a4('0x1b')]();};}function respondWithResult(_0x555706,_0xae7de4){_0xae7de4=_0xae7de4||0xc8;return function(_0x35631d){if(_0x35631d){return _0x555706[_0x03a4('0x1a')](_0xae7de4)[_0x03a4('0x1c')](_0x35631d);}};}function respondWithFilteredResult(_0x41c1cb,_0xc9abbd){return function(_0x3e3026){if(_0x3e3026){var _0x4fb9c2=_0x3e3026['count'],_0x28513c=_0xc9abbd[_0x03a4('0x1d')],_0x138d24=_0xc9abbd[_0x03a4('0x1d')]+_0xc9abbd[_0x03a4('0x1e')],_0x22b49a;if(_0x138d24>=_0x4fb9c2){_0x138d24=_0x4fb9c2;_0x22b49a=0xc8;}else{_0x22b49a=0xce;}_0x41c1cb[_0x03a4('0x1a')](_0x22b49a);return _0x41c1cb[_0x03a4('0x1f')](_0x03a4('0x20'),_0x28513c+'-'+_0x138d24+'/'+_0x4fb9c2)[_0x03a4('0x1c')](_0x3e3026);}return null;};}function patchUpdates(_0xcadb75){return function(_0x1666d2){try{jsonpatch['apply'](_0x1666d2,_0xcadb75,!![]);}catch(_0x2d7b60){return BPromise[_0x03a4('0x21')](_0x2d7b60);}return _0x1666d2['save']();};}function saveUpdates(_0x23cd21,_0x100cdf){return function(_0x4cf33e){if(_0x4cf33e){return _0x4cf33e[_0x03a4('0x22')](_0x23cd21)[_0x03a4('0x23')](function(_0x5a2760){return _0x5a2760;});}return null;};}function removeEntity(_0x28316a,_0x478ba4){return function(_0x22f182){if(_0x22f182){return _0x22f182[_0x03a4('0x24')]()[_0x03a4('0x23')](function(){_0x28316a[_0x03a4('0x1a')](0xcc)[_0x03a4('0x1b')]();});}};}function handleEntityNotFound(_0x1e88f0,_0x1e83f9){return function(_0x338232){if(!_0x338232){_0x1e88f0[_0x03a4('0x19')](0x194);}return _0x338232;};}function handleError(_0x15a8de,_0x1d8703){_0x1d8703=_0x1d8703||0x1f4;return function(_0x179594){logger['error'](_0x179594['stack']);if(_0x179594[_0x03a4('0x25')]){delete _0x179594[_0x03a4('0x25')];}_0x15a8de[_0x03a4('0x1a')](_0x1d8703)['send'](_0x179594);};}exports['index']=function(_0x246eb3,_0x1374db){var _0xa387f0={},_0x5b9604={},_0x4f50b2={'count':0x0,'rows':[]};var _0x5e14b6=_['map'](db[_0x03a4('0x26')][_0x03a4('0x27')],function(_0x3167b9){return{'name':_0x3167b9[_0x03a4('0x28')],'type':_0x3167b9[_0x03a4('0x29')]['key']};});_0x5b9604[_0x03a4('0x2a')]=_[_0x03a4('0x2b')](_0x5e14b6,_0x03a4('0x25'));_0x5b9604[_0x03a4('0x2c')]=_['keys'](_0x246eb3[_0x03a4('0x2c')]);_0x5b9604['filters']=_[_0x03a4('0x2d')](_0x5b9604[_0x03a4('0x2a')],_0x5b9604[_0x03a4('0x2c')]);_0xa387f0[_0x03a4('0x2e')]=_[_0x03a4('0x2d')](_0x5b9604[_0x03a4('0x2a')],qs[_0x03a4('0x2f')](_0x246eb3[_0x03a4('0x2c')][_0x03a4('0x2f')]));_0xa387f0[_0x03a4('0x2e')]=_0xa387f0[_0x03a4('0x2e')][_0x03a4('0x30')]?_0xa387f0['attributes']:_0x5b9604['model'];if(!_0x246eb3[_0x03a4('0x2c')][_0x03a4('0x31')](_0x03a4('0x32'))){_0xa387f0[_0x03a4('0x1e')]=qs['limit'](_0x246eb3['query'][_0x03a4('0x1e')]);_0xa387f0[_0x03a4('0x1d')]=qs[_0x03a4('0x1d')](_0x246eb3[_0x03a4('0x2c')]['offset']);}_0xa387f0[_0x03a4('0x33')]=qs['sort'](_0x246eb3['query'][_0x03a4('0x34')]);_0xa387f0[_0x03a4('0x35')]=qs[_0x03a4('0x36')](_[_0x03a4('0x37')](_0x246eb3[_0x03a4('0x2c')],_0x5b9604['filters']),_0x5e14b6);if(_0x246eb3[_0x03a4('0x2c')][_0x03a4('0x38')]){_0xa387f0[_0x03a4('0x35')]=_[_0x03a4('0x39')](_0xa387f0[_0x03a4('0x35')],{'$or':_[_0x03a4('0x2b')](_0x5e14b6,function(_0x257941){if(_0x257941[_0x03a4('0x29')]!=='VIRTUAL'){var _0x2da9bc={};_0x2da9bc[_0x257941['name']]={'$like':'%'+_0x246eb3[_0x03a4('0x2c')][_0x03a4('0x38')]+'%'};return _0x2da9bc;}})});}_0xa387f0=_['merge']({},_0xa387f0,_0x246eb3[_0x03a4('0x3a')]);var _0x205c54={'where':_0xa387f0['where']};return db[_0x03a4('0x26')]['count'](_0x205c54)['then'](function(_0x15f89a){_0x4f50b2[_0x03a4('0x3b')]=_0x15f89a;if(_0x246eb3[_0x03a4('0x2c')][_0x03a4('0x3c')]){_0xa387f0[_0x03a4('0x3d')]=[{'all':!![]}];}return db[_0x03a4('0x26')][_0x03a4('0x3e')](_0xa387f0);})[_0x03a4('0x23')](function(_0x53809a){_0x4f50b2['rows']=_0x53809a;return _0x4f50b2;})['then'](respondWithFilteredResult(_0x1374db,_0xa387f0))[_0x03a4('0x3f')](handleError(_0x1374db,null));};exports[_0x03a4('0x40')]=function(_0x176d2f,_0x4d6473){var _0x5ce024={'raw':!![],'where':{'id':_0x176d2f[_0x03a4('0x41')]['id']}},_0x1d3656={};_0x1d3656[_0x03a4('0x2a')]=_[_0x03a4('0x42')](db[_0x03a4('0x26')][_0x03a4('0x27')]);_0x1d3656[_0x03a4('0x2c')]=_[_0x03a4('0x42')](_0x176d2f[_0x03a4('0x2c')]);_0x1d3656[_0x03a4('0x36')]=_[_0x03a4('0x2d')](_0x1d3656[_0x03a4('0x2a')],_0x1d3656[_0x03a4('0x2c')]);_0x5ce024[_0x03a4('0x2e')]=_[_0x03a4('0x2d')](_0x1d3656['model'],qs['fields'](_0x176d2f[_0x03a4('0x2c')][_0x03a4('0x2f')]));_0x5ce024[_0x03a4('0x2e')]=_0x5ce024[_0x03a4('0x2e')][_0x03a4('0x30')]?_0x5ce024[_0x03a4('0x2e')]:_0x1d3656['model'];if(_0x176d2f[_0x03a4('0x2c')]['includeAll']){_0x5ce024[_0x03a4('0x3d')]=[{'all':!![]}];}_0x5ce024=_[_0x03a4('0x39')]({},_0x5ce024,_0x176d2f[_0x03a4('0x3a')]);return db['MailQueueReport'][_0x03a4('0x43')](_0x5ce024)[_0x03a4('0x23')](handleEntityNotFound(_0x4d6473,null))[_0x03a4('0x23')](respondWithResult(_0x4d6473,null))[_0x03a4('0x3f')](handleError(_0x4d6473,null));};exports['create']=function(_0x41db7e,_0x3a2f06){return db[_0x03a4('0x26')][_0x03a4('0x44')](_0x41db7e[_0x03a4('0x45')],{})['then'](respondWithResult(_0x3a2f06,0xc9))[_0x03a4('0x3f')](handleError(_0x3a2f06,null));};exports[_0x03a4('0x22')]=function(_0x3c8cb0,_0xffd9fa){if(_0x3c8cb0[_0x03a4('0x45')]['id']){delete _0x3c8cb0[_0x03a4('0x45')]['id'];}return db[_0x03a4('0x26')][_0x03a4('0x43')]({'where':{'id':_0x3c8cb0[_0x03a4('0x41')]['id']}})['then'](handleEntityNotFound(_0xffd9fa,null))[_0x03a4('0x23')](saveUpdates(_0x3c8cb0['body'],null))['then'](respondWithResult(_0xffd9fa,null))[_0x03a4('0x3f')](handleError(_0xffd9fa,null));};exports[_0x03a4('0x24')]=function(_0x33e735,_0x1dd937){return db[_0x03a4('0x26')][_0x03a4('0x43')]({'where':{'id':_0x33e735['params']['id']}})[_0x03a4('0x23')](handleEntityNotFound(_0x1dd937,null))[_0x03a4('0x23')](removeEntity(_0x1dd937,null))[_0x03a4('0x3f')](handleError(_0x1dd937,null));};exports[_0x03a4('0x46')]=function(_0x19254c,_0x358178){return db[_0x03a4('0x26')][_0x03a4('0x46')]()[_0x03a4('0x23')](respondWithResult(_0x358178,null))[_0x03a4('0x3f')](handleError(_0x358178,null));}; \ No newline at end of file +var _0x6142=['rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailQueueReport','findAll','then','catch','show','params','includeAll','include','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','count','offset','set','json','apply','save','update','destroy','end','sendStatus','stack','name','index','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6142,0x148));var _0x2614=function(_0x9efb49,_0x1bfb17){_0x9efb49=_0x9efb49-0x0;var _0x445fb8=_0x6142[_0x9efb49];return _0x445fb8;};'use strict';var pdf=require(_0x2614('0x0'));var emlformat=require(_0x2614('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2614('0x2'));var jsonpatch=require(_0x2614('0x3'));var rp=require(_0x2614('0x4'));var moment=require('moment');var BPromise=require(_0x2614('0x5'));var Mustache=require(_0x2614('0x6'));var util=require(_0x2614('0x7'));var path=require(_0x2614('0x8'));var sox=require(_0x2614('0x9'));var csv=require(_0x2614('0xa'));var ejs=require(_0x2614('0xb'));var fs=require('fs');var _=require(_0x2614('0xc'));var squel=require(_0x2614('0xd'));var crypto=require(_0x2614('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2614('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2614('0x10'));var Papa=require(_0x2614('0x11'));var Redis=require('ioredis');var authService=require(_0x2614('0x12'));var qs=require(_0x2614('0x13'));var as=require(_0x2614('0x14'));var hardwareService=require(_0x2614('0x15'));var logger=require(_0x2614('0x16'))(_0x2614('0x17'));var utils=require(_0x2614('0x18'));var config=require(_0x2614('0x19'));var licenseUtil=require(_0x2614('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe9abde,_0x2c4716){_0x2c4716=_0x2c4716||0xcc;return function(_0x37dc4e){if(_0x37dc4e){return _0xe9abde['sendStatus'](_0x2c4716);}return _0xe9abde[_0x2614('0x1b')](_0x2c4716)['end']();};}function respondWithResult(_0x20f11d,_0x468e5c){_0x468e5c=_0x468e5c||0xc8;return function(_0x4ced7f){if(_0x4ced7f){return _0x20f11d['status'](_0x468e5c)['json'](_0x4ced7f);}};}function respondWithFilteredResult(_0x424c24,_0x4babd1){return function(_0x4ebb3e){if(_0x4ebb3e){var _0x1fd801=_0x4ebb3e[_0x2614('0x1c')],_0x275ae8=_0x4babd1[_0x2614('0x1d')],_0x1b7ca2=_0x4babd1[_0x2614('0x1d')]+_0x4babd1['limit'],_0x383f58;if(_0x1b7ca2>=_0x1fd801){_0x1b7ca2=_0x1fd801;_0x383f58=0xc8;}else{_0x383f58=0xce;}_0x424c24['status'](_0x383f58);return _0x424c24[_0x2614('0x1e')]('Content-Range',_0x275ae8+'-'+_0x1b7ca2+'/'+_0x1fd801)[_0x2614('0x1f')](_0x4ebb3e);}return null;};}function patchUpdates(_0x408796){return function(_0x12fc92){try{jsonpatch[_0x2614('0x20')](_0x12fc92,_0x408796,!![]);}catch(_0x22aaa9){return BPromise['reject'](_0x22aaa9);}return _0x12fc92[_0x2614('0x21')]();};}function saveUpdates(_0x4e7e7d,_0x2d2edd){return function(_0x1643f7){if(_0x1643f7){return _0x1643f7[_0x2614('0x22')](_0x4e7e7d)['then'](function(_0x35ec6e){return _0x35ec6e;});}return null;};}function removeEntity(_0x477261,_0x4fc234){return function(_0x4a5860){if(_0x4a5860){return _0x4a5860[_0x2614('0x23')]()['then'](function(){_0x477261[_0x2614('0x1b')](0xcc)[_0x2614('0x24')]();});}};}function handleEntityNotFound(_0x371f42,_0x467776){return function(_0x4a922e){if(!_0x4a922e){_0x371f42[_0x2614('0x25')](0x194);}return _0x4a922e;};}function handleError(_0x3ec1de,_0x57637e){_0x57637e=_0x57637e||0x1f4;return function(_0x54d519){logger['error'](_0x54d519[_0x2614('0x26')]);if(_0x54d519[_0x2614('0x27')]){delete _0x54d519['name'];}_0x3ec1de[_0x2614('0x1b')](_0x57637e)['send'](_0x54d519);};}exports[_0x2614('0x28')]=function(_0x6bc4f2,_0x203698){var _0x314c0a={},_0x51d911={},_0x1bbb45={'count':0x0,'rows':[]};var _0x54b760=_[_0x2614('0x29')](db['MailQueueReport'][_0x2614('0x2a')],function(_0x40824f){return{'name':_0x40824f[_0x2614('0x2b')],'type':_0x40824f['type']['key']};});_0x51d911[_0x2614('0x2c')]=_['map'](_0x54b760,'name');_0x51d911[_0x2614('0x2d')]=_['keys'](_0x6bc4f2[_0x2614('0x2d')]);_0x51d911[_0x2614('0x2e')]=_['intersection'](_0x51d911[_0x2614('0x2c')],_0x51d911['query']);_0x314c0a[_0x2614('0x2f')]=_[_0x2614('0x30')](_0x51d911[_0x2614('0x2c')],qs[_0x2614('0x31')](_0x6bc4f2['query'][_0x2614('0x31')]));_0x314c0a['attributes']=_0x314c0a[_0x2614('0x2f')][_0x2614('0x32')]?_0x314c0a[_0x2614('0x2f')]:_0x51d911[_0x2614('0x2c')];if(!_0x6bc4f2[_0x2614('0x2d')]['hasOwnProperty'](_0x2614('0x33'))){_0x314c0a[_0x2614('0x34')]=qs['limit'](_0x6bc4f2[_0x2614('0x2d')][_0x2614('0x34')]);_0x314c0a[_0x2614('0x1d')]=qs['offset'](_0x6bc4f2[_0x2614('0x2d')][_0x2614('0x1d')]);}_0x314c0a[_0x2614('0x35')]=qs[_0x2614('0x36')](_0x6bc4f2['query'][_0x2614('0x36')]);_0x314c0a[_0x2614('0x37')]=qs[_0x2614('0x2e')](_[_0x2614('0x38')](_0x6bc4f2[_0x2614('0x2d')],_0x51d911[_0x2614('0x2e')]),_0x54b760);if(_0x6bc4f2[_0x2614('0x2d')][_0x2614('0x39')]){_0x314c0a[_0x2614('0x37')]=_[_0x2614('0x3a')](_0x314c0a[_0x2614('0x37')],{'$or':_[_0x2614('0x29')](_0x54b760,function(_0x57eb3d){if(_0x57eb3d[_0x2614('0x3b')]!==_0x2614('0x3c')){var _0x3d0479={};_0x3d0479[_0x57eb3d[_0x2614('0x27')]]={'$like':'%'+_0x6bc4f2[_0x2614('0x2d')][_0x2614('0x39')]+'%'};return _0x3d0479;}})});}_0x314c0a=_[_0x2614('0x3a')]({},_0x314c0a,_0x6bc4f2[_0x2614('0x3d')]);var _0x468f0e={'where':_0x314c0a[_0x2614('0x37')]};return db[_0x2614('0x3e')][_0x2614('0x1c')](_0x468f0e)['then'](function(_0x250d82){_0x1bbb45[_0x2614('0x1c')]=_0x250d82;if(_0x6bc4f2[_0x2614('0x2d')]['includeAll']){_0x314c0a['include']=[{'all':!![]}];}return db[_0x2614('0x3e')][_0x2614('0x3f')](_0x314c0a);})[_0x2614('0x40')](function(_0x190d7f){_0x1bbb45['rows']=_0x190d7f;return _0x1bbb45;})[_0x2614('0x40')](respondWithFilteredResult(_0x203698,_0x314c0a))[_0x2614('0x41')](handleError(_0x203698,null));};exports[_0x2614('0x42')]=function(_0x56306c,_0x5e6bb5){var _0x4c99f3={'raw':!![],'where':{'id':_0x56306c[_0x2614('0x43')]['id']}},_0x1e2208={};_0x1e2208[_0x2614('0x2c')]=_['keys'](db[_0x2614('0x3e')]['rawAttributes']);_0x1e2208[_0x2614('0x2d')]=_['keys'](_0x56306c[_0x2614('0x2d')]);_0x1e2208[_0x2614('0x2e')]=_[_0x2614('0x30')](_0x1e2208[_0x2614('0x2c')],_0x1e2208[_0x2614('0x2d')]);_0x4c99f3[_0x2614('0x2f')]=_[_0x2614('0x30')](_0x1e2208[_0x2614('0x2c')],qs[_0x2614('0x31')](_0x56306c[_0x2614('0x2d')][_0x2614('0x31')]));_0x4c99f3[_0x2614('0x2f')]=_0x4c99f3[_0x2614('0x2f')]['length']?_0x4c99f3[_0x2614('0x2f')]:_0x1e2208['model'];if(_0x56306c[_0x2614('0x2d')][_0x2614('0x44')]){_0x4c99f3[_0x2614('0x45')]=[{'all':!![]}];}_0x4c99f3=_[_0x2614('0x3a')]({},_0x4c99f3,_0x56306c[_0x2614('0x3d')]);return db[_0x2614('0x3e')]['find'](_0x4c99f3)[_0x2614('0x40')](handleEntityNotFound(_0x5e6bb5,null))['then'](respondWithResult(_0x5e6bb5,null))[_0x2614('0x41')](handleError(_0x5e6bb5,null));};exports['create']=function(_0x38c541,_0x41afde){return db[_0x2614('0x3e')][_0x2614('0x46')](_0x38c541[_0x2614('0x47')],{})[_0x2614('0x40')](respondWithResult(_0x41afde,0xc9))[_0x2614('0x41')](handleError(_0x41afde,null));};exports[_0x2614('0x22')]=function(_0x165b4c,_0x97d981){if(_0x165b4c[_0x2614('0x47')]['id']){delete _0x165b4c[_0x2614('0x47')]['id'];}return db['MailQueueReport'][_0x2614('0x48')]({'where':{'id':_0x165b4c[_0x2614('0x43')]['id']}})[_0x2614('0x40')](handleEntityNotFound(_0x97d981,null))['then'](saveUpdates(_0x165b4c[_0x2614('0x47')],null))[_0x2614('0x40')](respondWithResult(_0x97d981,null))[_0x2614('0x41')](handleError(_0x97d981,null));};exports['destroy']=function(_0x396ca5,_0x38b6ae){return db[_0x2614('0x3e')][_0x2614('0x48')]({'where':{'id':_0x396ca5[_0x2614('0x43')]['id']}})[_0x2614('0x40')](handleEntityNotFound(_0x38b6ae,null))[_0x2614('0x40')](removeEntity(_0x38b6ae,null))['catch'](handleError(_0x38b6ae,null));};exports[_0x2614('0x49')]=function(_0x482948,_0x2fa4f7){return db['MailQueueReport'][_0x2614('0x49')]()['then'](respondWithResult(_0x2fa4f7,null))['catch'](handleError(_0x2fa4f7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 403b319..d128aab 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 _0x92bc=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1c2b5d,_0x4b6280){var _0x315fb1=function(_0x11d9a8){while(--_0x11d9a8){_0x1c2b5d['push'](_0x1c2b5d['shift']());}};_0x315fb1(++_0x4b6280);}(_0x92bc,0x128));var _0xc92b=function(_0x21ffa3,_0x4258d2){_0x21ffa3=_0x21ffa3-0x0;var _0x1b5aaf=_0x92bc[_0x21ffa3];return _0x1b5aaf;};'use strict';var _=require(_0xc92b('0x0'));var util=require(_0xc92b('0x1'));var logger=require(_0xc92b('0x2'))(_0xc92b('0x3'));var moment=require(_0xc92b('0x4'));var BPromise=require(_0xc92b('0x5'));var rp=require(_0xc92b('0x6'));var fs=require('fs');var path=require(_0xc92b('0x7'));var rimraf=require(_0xc92b('0x8'));var config=require(_0xc92b('0x9'));var attributes=require(_0xc92b('0xa'));module[_0xc92b('0xb')]=function(_0x1c1f6d,_0x4d6c2b){return _0x1c1f6d[_0xc92b('0xc')](_0xc92b('0xd'),attributes,{'tableName':_0xc92b('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc92b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x032a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue'];(function(_0x27c6ac,_0x4e0f99){var _0x1eaa26=function(_0x42a335){while(--_0x42a335){_0x27c6ac['push'](_0x27c6ac['shift']());}};_0x1eaa26(++_0x4e0f99);}(_0x032a,0xf0));var _0xa032=function(_0x3c424f,_0x1c61c2){_0x3c424f=_0x3c424f-0x0;var _0x3fee82=_0x032a[_0x3c424f];return _0x3fee82;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var logger=require('../../config/logger')(_0xa032('0x1'));var moment=require(_0xa032('0x2'));var BPromise=require(_0xa032('0x3'));var rp=require(_0xa032('0x4'));var fs=require('fs');var path=require(_0xa032('0x5'));var rimraf=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var attributes=require(_0xa032('0x8'));module[_0xa032('0x9')]=function(_0x2b1445,_0x43d0f5){return _0x2b1445[_0xa032('0xa')]('MailQueueReport',attributes,{'tableName':_0xa032('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 2fc704a..7bc9391 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 _0x3ba2=['limit','UpdateMailQueueReport','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','MailQueueReport','create','options','CreateMailQueueReport','update','body','raw','where','attributes'];(function(_0xcaecb8,_0x2f5120){var _0x20f4bf=function(_0x45604b){while(--_0x45604b){_0xcaecb8['push'](_0xcaecb8['shift']());}};_0x20f4bf(++_0x2f5120);}(_0x3ba2,0x18f));var _0x23ba=function(_0xbccf97,_0x4665c9){_0xbccf97=_0xbccf97-0x0;var _0x4d11bd=_0x3ba2[_0xbccf97];return _0x4d11bd;};'use strict';var _=require(_0x23ba('0x0'));var util=require('util');var moment=require(_0x23ba('0x1'));var BPromise=require(_0x23ba('0x2'));var rs=require(_0x23ba('0x3'));var fs=require('fs');var Redis=require(_0x23ba('0x4'));var db=require(_0x23ba('0x5'))['db'];var utils=require(_0x23ba('0x6'));var logger=require('../../config/logger')(_0x23ba('0x7'));var config=require(_0x23ba('0x8'));var jayson=require(_0x23ba('0x9'));var client=jayson[_0x23ba('0xa')][_0x23ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x201902,_0x309b23,_0x1be5ba){return new BPromise(function(_0x25f5f0,_0x4763cc){return client[_0x23ba('0xc')](_0x201902,_0x1be5ba)[_0x23ba('0xd')](function(_0x2f44ea){logger[_0x23ba('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x309b23,_0x23ba('0xf'));logger['debug'](_0x23ba('0x10'),_0x309b23,_0x23ba('0xf'),JSON[_0x23ba('0x11')](_0x2f44ea));if(_0x2f44ea['error']){if(_0x2f44ea['error'][_0x23ba('0x12')]===0x1f4){logger[_0x23ba('0x13')](_0x23ba('0x14'),_0x309b23,_0x2f44ea[_0x23ba('0x13')][_0x23ba('0x15')]);return _0x4763cc(_0x2f44ea['error'][_0x23ba('0x15')]);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x309b23,_0x2f44ea[_0x23ba('0x13')][_0x23ba('0x15')]);return _0x25f5f0(_0x2f44ea[_0x23ba('0x13')][_0x23ba('0x15')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x309b23,_0x23ba('0xf'));_0x25f5f0(_0x2f44ea[_0x23ba('0x16')][_0x23ba('0x15')]);}})[_0x23ba('0x17')](function(_0x24e367){logger[_0x23ba('0x13')](_0x23ba('0x14'),_0x309b23,_0x24e367);_0x4763cc(_0x24e367);});});}exports['CreateMailQueueReport']=function(_0x3899d2){var _0x2a2806=this;return new Promise(function(_0x81db00,_0x18feaf){return db[_0x23ba('0x18')][_0x23ba('0x19')](_0x3899d2['body'],{'raw':_0x3899d2[_0x23ba('0x1a')]?_0x3899d2['options']['raw']===undefined?!![]:![]:!![]})[_0x23ba('0xd')](function(_0x5207e6){logger[_0x23ba('0xe')](_0x23ba('0x1b'),_0x3899d2);logger['debug'](_0x23ba('0x1b'),_0x3899d2,JSON['stringify'](_0x5207e6));_0x81db00(_0x5207e6);})[_0x23ba('0x17')](function(_0x58af3e){logger[_0x23ba('0x13')](_0x23ba('0x1b'),_0x58af3e[_0x23ba('0x15')],_0x3899d2);_0x18feaf(_0x2a2806['error'](0x1f4,_0x58af3e['message']));});});};exports['UpdateMailQueueReport']=function(_0x2fbd16){var _0x2f33ea=this;return new Promise(function(_0x305ac6,_0x62c4b7){return db['MailQueueReport'][_0x23ba('0x1c')](_0x2fbd16[_0x23ba('0x1d')],{'raw':_0x2fbd16['options']?_0x2fbd16[_0x23ba('0x1a')][_0x23ba('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fbd16[_0x23ba('0x1a')]?_0x2fbd16['options'][_0x23ba('0x1f')]||null:null,'attributes':_0x2fbd16[_0x23ba('0x1a')]?_0x2fbd16['options'][_0x23ba('0x20')]||null:null,'limit':_0x2fbd16[_0x23ba('0x1a')]?_0x2fbd16[_0x23ba('0x1a')][_0x23ba('0x21')]||null:null})[_0x23ba('0xd')](function(_0x464eaa){logger['info'](_0x23ba('0x22'),_0x2fbd16);logger[_0x23ba('0x23')]('UpdateMailQueueReport',_0x2fbd16,JSON[_0x23ba('0x11')](_0x464eaa));_0x305ac6(_0x464eaa);})[_0x23ba('0x17')](function(_0x46d85f){logger[_0x23ba('0x13')](_0x23ba('0x22'),_0x46d85f['message'],_0x2fbd16);_0x62c4b7(_0x2f33ea[_0x23ba('0x13')](0x1f4,_0x46d85f['message']));});});}; \ No newline at end of file +var _0x1083=['UpdateMailQueueReport','update','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','then'];(function(_0x42dc3e,_0x117cf1){var _0x17224d=function(_0x19b8f9){while(--_0x19b8f9){_0x42dc3e['push'](_0x42dc3e['shift']());}};_0x17224d(++_0x117cf1);}(_0x1083,0x143));var _0x3108=function(_0x5b529f,_0x1c0c02){_0x5b529f=_0x5b529f-0x0;var _0x549577=_0x1083[_0x5b529f];return _0x549577;};'use strict';var _=require(_0x3108('0x0'));var util=require('util');var moment=require(_0x3108('0x1'));var BPromise=require(_0x3108('0x2'));var rs=require(_0x3108('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3108('0x4'))['db'];var utils=require(_0x3108('0x5'));var logger=require(_0x3108('0x6'))(_0x3108('0x7'));var config=require(_0x3108('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3108('0x9')][_0x3108('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x517c2e,_0x48de52,_0x5af593){return new BPromise(function(_0x4ab14c,_0x236956){return client[_0x3108('0xb')](_0x517c2e,_0x5af593)['then'](function(_0xdb88a7){logger[_0x3108('0xc')](_0x3108('0xd'),_0x48de52,'request\x20sent');logger[_0x3108('0xe')](_0x3108('0xf'),_0x48de52,'request\x20sent',JSON[_0x3108('0x10')](_0xdb88a7));if(_0xdb88a7['error']){if(_0xdb88a7[_0x3108('0x11')]['code']===0x1f4){logger['error'](_0x3108('0xd'),_0x48de52,_0xdb88a7['error']['message']);return _0x236956(_0xdb88a7[_0x3108('0x11')]['message']);}logger['error'](_0x3108('0xd'),_0x48de52,_0xdb88a7['error']['message']);return _0x4ab14c(_0xdb88a7[_0x3108('0x11')][_0x3108('0x12')]);}else{logger[_0x3108('0xc')](_0x3108('0xd'),_0x48de52,_0x3108('0x13'));_0x4ab14c(_0xdb88a7[_0x3108('0x14')][_0x3108('0x12')]);}})[_0x3108('0x15')](function(_0x327897){logger[_0x3108('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x48de52,_0x327897);_0x236956(_0x327897);});});}exports[_0x3108('0x16')]=function(_0x57e640){var _0x34ad40=this;return new Promise(function(_0x30d4e6,_0x15086d){return db[_0x3108('0x17')][_0x3108('0x18')](_0x57e640[_0x3108('0x19')],{'raw':_0x57e640['options']?_0x57e640[_0x3108('0x1a')][_0x3108('0x1b')]===undefined?!![]:![]:!![]})[_0x3108('0x1c')](function(_0x406e03){logger['info'](_0x3108('0x16'),_0x57e640);logger[_0x3108('0xe')](_0x3108('0x16'),_0x57e640,JSON['stringify'](_0x406e03));_0x30d4e6(_0x406e03);})[_0x3108('0x15')](function(_0x3897bc){logger[_0x3108('0x11')]('CreateMailQueueReport',_0x3897bc[_0x3108('0x12')],_0x57e640);_0x15086d(_0x34ad40[_0x3108('0x11')](0x1f4,_0x3897bc[_0x3108('0x12')]));});});};exports[_0x3108('0x1d')]=function(_0x4d4fb8){var _0x382a0b=this;return new Promise(function(_0x20e656,_0x355e63){return db['MailQueueReport'][_0x3108('0x1e')](_0x4d4fb8['body'],{'raw':_0x4d4fb8['options']?_0x4d4fb8[_0x3108('0x1a')][_0x3108('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d4fb8['options']?_0x4d4fb8[_0x3108('0x1a')][_0x3108('0x1f')]||null:null,'attributes':_0x4d4fb8['options']?_0x4d4fb8[_0x3108('0x1a')]['attributes']||null:null,'limit':_0x4d4fb8[_0x3108('0x1a')]?_0x4d4fb8[_0x3108('0x1a')]['limit']||null:null})[_0x3108('0x1c')](function(_0xc7a0e1){logger['info']('UpdateMailQueueReport',_0x4d4fb8);logger[_0x3108('0xe')](_0x3108('0x1d'),_0x4d4fb8,JSON[_0x3108('0x10')](_0xc7a0e1));_0x20e656(_0xc7a0e1);})[_0x3108('0x15')](function(_0x37b14f){logger[_0x3108('0x11')](_0x3108('0x1d'),_0x37b14f[_0x3108('0x12')],_0x4d4fb8);_0x355e63(_0x382a0b[_0x3108('0x11')](0x1f4,_0x37b14f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e0a7fb3..991e7b7 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 _0xa2d9=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x42f7cd,_0x1c47b7){var _0x514f16=function(_0x7426ce){while(--_0x7426ce){_0x42f7cd['push'](_0x42f7cd['shift']());}};_0x514f16(++_0x1c47b7);}(_0xa2d9,0x11a));var _0x9a2d=function(_0x244c17,_0x27c1f6){_0x244c17=_0x244c17-0x0;var _0x362ec4=_0xa2d9[_0x244c17];return _0x362ec4;};'use strict';var multer=require(_0x9a2d('0x0'));var util=require(_0x9a2d('0x1'));var path=require('path');var timeout=require(_0x9a2d('0x2'));var express=require(_0x9a2d('0x3'));var router=express['Router']();var auth=require(_0x9a2d('0x4'));var interaction=require(_0x9a2d('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x12e8=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x1ba4d1,_0x54fd0e){var _0x29a4a5=function(_0x15c9b8){while(--_0x15c9b8){_0x1ba4d1['push'](_0x1ba4d1['shift']());}};_0x29a4a5(++_0x54fd0e);}(_0x12e8,0x195));var _0x812e=function(_0x5eed62,_0x365554){_0x5eed62=_0x5eed62-0x0;var _0x3658e1=_0x12e8[_0x5eed62];return _0x3658e1;};'use strict';var multer=require(_0x812e('0x0'));var util=require(_0x812e('0x1'));var path=require(_0x812e('0x2'));var timeout=require(_0x812e('0x3'));var express=require(_0x812e('0x4'));var router=express['Router']();var auth=require(_0x812e('0x5'));var interaction=require(_0x812e('0x6'));var config=require(_0x812e('0x7'));module[_0x812e('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 1d3c3f0..e21b818 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 _0xcc51=['INTEGER','exports','STRING','BOOLEAN','INBOX'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xcc51,0x10a));var _0x1cc5=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcc51[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x1cc5('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1cc5('0x1')]},'authentication':{'type':Sequelize[_0x1cc5('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x1cc5('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1cc5('0x1')],'defaultValue':_0x1cc5('0x3')},'connTimeout':{'type':Sequelize[_0x1cc5('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x1cc5('0x1')]}}; \ No newline at end of file +var _0xc4b3=['INBOX','sequelize','exports','STRING','BOOLEAN','username','INTEGER'];(function(_0x4bfa93,_0x4bb95d){var _0x1d661f=function(_0x1e6c19){while(--_0x1e6c19){_0x4bfa93['push'](_0x4bfa93['shift']());}};_0x1d661f(++_0x4bb95d);}(_0xc4b3,0x13c));var _0x3c4b=function(_0x110046,_0x45e3cd){_0x110046=_0x110046-0x0;var _0x1de55c=_0xc4b3[_0x110046];return _0x1de55c;};'use strict';var Sequelize=require(_0x3c4b('0x0'));module[_0x3c4b('0x1')]={'description':{'type':Sequelize[_0x3c4b('0x2')]},'host':{'type':Sequelize[_0x3c4b('0x2')]},'authentication':{'type':Sequelize[_0x3c4b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3c4b('0x2')],'unique':_0x3c4b('0x4')},'password':{'type':Sequelize[_0x3c4b('0x2')]},'port':{'type':Sequelize[_0x3c4b('0x5')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3c4b('0x2')],'defaultValue':_0x3c4b('0x6')},'connTimeout':{'type':Sequelize[_0x3c4b('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3c4b('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3c4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6330aaf..a355178 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 _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xc0cbdb,_0x5ddc2b){_0xc0cbdb=_0xc0cbdb-0x0;var _0x2da073=_0xd7d1[_0xc0cbdb];return _0x2da073;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed3c=['util','../../config/logger','api','bluebird','request-promise','path','./mailServerIn.attributes','exports','lodash'];(function(_0x457993,_0x9abda9){var _0x57ed82=function(_0x9cd1d2){while(--_0x9cd1d2){_0x457993['push'](_0x457993['shift']());}};_0x57ed82(++_0x9abda9);}(_0xed3c,0x1a6));var _0xced3=function(_0x227fe7,_0x392329){_0x227fe7=_0x227fe7-0x0;var _0x4b98be=_0xed3c[_0x227fe7];return _0x4b98be;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 208c79f..4be4b74 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 _0x71e8=['attributes','limit','include','map','model','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where'];(function(_0x35830b,_0x35bf23){var _0x44fd8a=function(_0x2cd0c7){while(--_0x2cd0c7){_0x35830b['push'](_0x35830b['shift']());}};_0x44fd8a(++_0x35bf23);}(_0x71e8,0xcb));var _0x871e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71e8[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x871e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x871e('0x1'));var fs=require('fs');var Redis=require(_0x871e('0x2'));var db=require(_0x871e('0x3'))['db'];var utils=require(_0x871e('0x4'));var logger=require(_0x871e('0x5'))(_0x871e('0x6'));var config=require(_0x871e('0x7'));var jayson=require(_0x871e('0x8'));var client=jayson[_0x871e('0x9')][_0x871e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df2fb,_0x375f44,_0x59e32b){return new BPromise(function(_0x372114,_0x23f90e){return client['request'](_0x3df2fb,_0x59e32b)[_0x871e('0xb')](function(_0x214a9a){logger[_0x871e('0xc')](_0x871e('0xd'),_0x375f44,_0x871e('0xe'));logger[_0x871e('0xf')](_0x871e('0x10'),_0x375f44,'request\x20sent',JSON[_0x871e('0x11')](_0x214a9a));if(_0x214a9a['error']){if(_0x214a9a['error'][_0x871e('0x12')]===0x1f4){logger[_0x871e('0x13')](_0x871e('0xd'),_0x375f44,_0x214a9a[_0x871e('0x13')][_0x871e('0x14')]);return _0x23f90e(_0x214a9a[_0x871e('0x13')]['message']);}logger[_0x871e('0x13')]('MailServerIn,\x20%s,\x20%s',_0x375f44,_0x214a9a[_0x871e('0x13')][_0x871e('0x14')]);return _0x372114(_0x214a9a[_0x871e('0x13')][_0x871e('0x14')]);}else{logger[_0x871e('0xc')](_0x871e('0xd'),_0x375f44,_0x871e('0xe'));_0x372114(_0x214a9a[_0x871e('0x15')][_0x871e('0x14')]);}})[_0x871e('0x16')](function(_0x4e1be5){logger[_0x871e('0x13')](_0x871e('0xd'),_0x375f44,_0x4e1be5);_0x23f90e(_0x4e1be5);});});}exports[_0x871e('0x17')]=function(_0x192ed0){var _0x564f1f=this;return new Promise(function(_0x513e68,_0x5ef8d3){return db[_0x871e('0x18')][_0x871e('0x19')]({'raw':_0x192ed0[_0x871e('0x1a')]?_0x192ed0[_0x871e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x192ed0['options']?_0x192ed0['options'][_0x871e('0x1b')]||null:null,'attributes':_0x192ed0[_0x871e('0x1a')]?_0x192ed0[_0x871e('0x1a')][_0x871e('0x1c')]||null:null,'limit':_0x192ed0[_0x871e('0x1a')]?_0x192ed0[_0x871e('0x1a')][_0x871e('0x1d')]||null:null,'include':_0x192ed0[_0x871e('0x1a')]?_0x192ed0[_0x871e('0x1a')][_0x871e('0x1e')]?_[_0x871e('0x1f')](_0x192ed0[_0x871e('0x1a')][_0x871e('0x1e')],function(_0x28f049){return{'model':db[_0x28f049[_0x871e('0x20')]],'as':_0x28f049['as'],'attributes':_0x28f049[_0x871e('0x1c')],'include':_0x28f049[_0x871e('0x1e')]?_[_0x871e('0x1f')](_0x28f049['include'],function(_0x16ef8b){return{'model':db[_0x16ef8b['model']],'as':_0x16ef8b['as'],'attributes':_0x16ef8b[_0x871e('0x1c')],'include':_0x16ef8b['include']?_['map'](_0x16ef8b[_0x871e('0x1e')],function(_0x3ed95a){return{'model':db[_0x3ed95a[_0x871e('0x20')]],'as':_0x3ed95a['as'],'attributes':_0x3ed95a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2720d5){logger[_0x871e('0xc')](_0x871e('0x17'),_0x192ed0);logger[_0x871e('0xf')](_0x871e('0x17'),_0x192ed0,JSON[_0x871e('0x11')](_0x2720d5));_0x513e68(_0x2720d5);})[_0x871e('0x16')](function(_0x2e6284){logger[_0x871e('0x13')](_0x871e('0x17'),_0x2e6284[_0x871e('0x14')],_0x192ed0);_0x5ef8d3(_0x564f1f[_0x871e('0x13')](0x1f4,_0x2e6284[_0x871e('0x14')]));});});}; \ No newline at end of file +var _0xf128=['map','model','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include'];(function(_0x63cb89,_0x3106b9){var _0x26ea80=function(_0xc2b471){while(--_0xc2b471){_0x63cb89['push'](_0x63cb89['shift']());}};_0x26ea80(++_0x3106b9);}(_0xf128,0x7f));var _0x8f12=function(_0x497642,_0x55c481){_0x497642=_0x497642-0x0;var _0x351a14=_0xf128[_0x497642];return _0x351a14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f12('0x0'));var BPromise=require(_0x8f12('0x1'));var rs=require(_0x8f12('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f12('0x3'))['db'];var utils=require(_0x8f12('0x4'));var logger=require(_0x8f12('0x5'))('rpc');var config=require(_0x8f12('0x6'));var jayson=require(_0x8f12('0x7'));var client=jayson[_0x8f12('0x8')][_0x8f12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c2eb3,_0x562101,_0x57f564){return new BPromise(function(_0x1cb028,_0xe5d542){return client['request'](_0x4c2eb3,_0x57f564)['then'](function(_0x120760){logger[_0x8f12('0xa')](_0x8f12('0xb'),_0x562101,'request\x20sent');logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x562101,_0x8f12('0xc'),JSON[_0x8f12('0xd')](_0x120760));if(_0x120760[_0x8f12('0xe')]){if(_0x120760[_0x8f12('0xe')][_0x8f12('0xf')]===0x1f4){logger['error'](_0x8f12('0xb'),_0x562101,_0x120760[_0x8f12('0xe')][_0x8f12('0x10')]);return _0xe5d542(_0x120760['error'][_0x8f12('0x10')]);}logger['error'](_0x8f12('0xb'),_0x562101,_0x120760[_0x8f12('0xe')][_0x8f12('0x10')]);return _0x1cb028(_0x120760['error'][_0x8f12('0x10')]);}else{logger[_0x8f12('0xa')](_0x8f12('0xb'),_0x562101,_0x8f12('0xc'));_0x1cb028(_0x120760[_0x8f12('0x11')][_0x8f12('0x10')]);}})[_0x8f12('0x12')](function(_0x4cc52a){logger[_0x8f12('0xe')]('MailServerIn,\x20%s,\x20%s',_0x562101,_0x4cc52a);_0xe5d542(_0x4cc52a);});});}exports[_0x8f12('0x13')]=function(_0x4003ed){var _0x103ffd=this;return new Promise(function(_0x54f0ab,_0x4a2099){return db[_0x8f12('0x14')][_0x8f12('0x15')]({'raw':_0x4003ed[_0x8f12('0x16')]?_0x4003ed[_0x8f12('0x16')][_0x8f12('0x17')]===undefined?!![]:![]:!![],'where':_0x4003ed[_0x8f12('0x16')]?_0x4003ed[_0x8f12('0x16')][_0x8f12('0x18')]||null:null,'attributes':_0x4003ed[_0x8f12('0x16')]?_0x4003ed['options'][_0x8f12('0x19')]||null:null,'limit':_0x4003ed[_0x8f12('0x16')]?_0x4003ed['options'][_0x8f12('0x1a')]||null:null,'include':_0x4003ed[_0x8f12('0x16')]?_0x4003ed[_0x8f12('0x16')][_0x8f12('0x1b')]?_[_0x8f12('0x1c')](_0x4003ed['options'][_0x8f12('0x1b')],function(_0x230e39){return{'model':db[_0x230e39[_0x8f12('0x1d')]],'as':_0x230e39['as'],'attributes':_0x230e39[_0x8f12('0x19')],'include':_0x230e39[_0x8f12('0x1b')]?_[_0x8f12('0x1c')](_0x230e39['include'],function(_0x569e72){return{'model':db[_0x569e72[_0x8f12('0x1d')]],'as':_0x569e72['as'],'attributes':_0x569e72['attributes'],'include':_0x569e72[_0x8f12('0x1b')]?_[_0x8f12('0x1c')](_0x569e72[_0x8f12('0x1b')],function(_0x130c65){return{'model':db[_0x130c65[_0x8f12('0x1d')]],'as':_0x130c65['as'],'attributes':_0x130c65['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41481b){logger[_0x8f12('0xa')]('GetMailServerIn',_0x4003ed);logger[_0x8f12('0x1e')](_0x8f12('0x13'),_0x4003ed,JSON[_0x8f12('0xd')](_0x41481b));_0x54f0ab(_0x41481b);})['catch'](function(_0x5f58c4){logger[_0x8f12('0xe')]('GetMailServerIn',_0x5f58c4[_0x8f12('0x10')],_0x4003ed);_0x4a2099(_0x103ffd[_0x8f12('0xe')](0x1f4,_0x5f58c4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2aa58ef..7acdabc 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 _0x98ed=['/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated'];(function(_0x491b3b,_0x563f2e){var _0x2eed0d=function(_0x22c96e){while(--_0x22c96e){_0x491b3b['push'](_0x491b3b['shift']());}};_0x2eed0d(++_0x563f2e);}(_0x98ed,0xd4));var _0xd98e=function(_0x457bf8,_0x209a0a){_0x457bf8=_0x457bf8-0x0;var _0x919f94=_0x98ed[_0x457bf8];return _0x919f94;};'use strict';var multer=require(_0xd98e('0x0'));var util=require(_0xd98e('0x1'));var path=require(_0xd98e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd98e('0x3'));var router=express[_0xd98e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd98e('0x5'));var config=require('../../config/environment');var controller=require(_0xd98e('0x6'));router[_0xd98e('0x7')]('/',auth[_0xd98e('0x8')](),controller['index']);router[_0xd98e('0x7')](_0xd98e('0x9'),auth['isAuthenticated'](),controller[_0xd98e('0xa')]);router[_0xd98e('0xb')]('/',auth[_0xd98e('0x8')](),controller[_0xd98e('0xc')]);router[_0xd98e('0xd')]('/:id',auth[_0xd98e('0x8')](),controller[_0xd98e('0xe')]);router[_0xd98e('0xf')](_0xd98e('0x9'),auth[_0xd98e('0x8')](),controller['destroy']);module[_0xd98e('0x10')]=router; \ No newline at end of file +var _0xe408=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe408,0x1df));var _0x8e40=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xe408[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0x8e40('0x0'));var util=require(_0x8e40('0x1'));var path=require(_0x8e40('0x2'));var timeout=require(_0x8e40('0x3'));var express=require(_0x8e40('0x4'));var router=express[_0x8e40('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8e40('0x6'));var config=require(_0x8e40('0x7'));var controller=require(_0x8e40('0x8'));router['get']('/',auth[_0x8e40('0x9')](),controller[_0x8e40('0xa')]);router[_0x8e40('0xb')](_0x8e40('0xc'),auth[_0x8e40('0x9')](),controller[_0x8e40('0xd')]);router[_0x8e40('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8e40('0xf')]('/:id',auth[_0x8e40('0x9')](),controller['update']);router[_0x8e40('0x10')](_0x8e40('0xc'),auth[_0x8e40('0x9')](),controller[_0x8e40('0x11')]);module[_0x8e40('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 2699ffb..71d21d7 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 _0x647c=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x2e5801,_0x104997){var _0x164605=function(_0x218b22){while(--_0x218b22){_0x2e5801['push'](_0x2e5801['shift']());}};_0x164605(++_0x104997);}(_0x647c,0x1d3));var _0xc647=function(_0x1acb96,_0x108216){_0x1acb96=_0x1acb96-0x0;var _0x5da6cf=_0x647c[_0x1acb96];return _0x5da6cf;};'use strict';var Sequelize=require(_0xc647('0x0'));module['exports']={'description':{'type':Sequelize[_0xc647('0x1')]},'host':{'type':Sequelize[_0xc647('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xc647('0x1')]},'port':{'type':Sequelize[_0xc647('0x2')]},'secure':{'type':Sequelize[_0xc647('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc647('0x1')]},'authentication':{'type':Sequelize[_0xc647('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5d59=['exports','STRING','INTEGER'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5d59,0x15f));var _0x95d5=function(_0x554c0e,_0x2396bd){_0x554c0e=_0x554c0e-0x0;var _0x5c2afe=_0x5d59[_0x554c0e];return _0x5c2afe;};'use strict';var Sequelize=require('sequelize');module[_0x95d5('0x0')]={'description':{'type':Sequelize[_0x95d5('0x1')]},'host':{'type':Sequelize[_0x95d5('0x1')]},'user':{'type':Sequelize[_0x95d5('0x1')]},'pass':{'type':Sequelize[_0x95d5('0x1')]},'port':{'type':Sequelize[_0x95d5('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x95d5('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 21870b0..1b77cff 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 _0x3ba6=['destroy','error','name','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','findAll','catch','show','params','length','includeAll','include','find','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then'];(function(_0x55ab87,_0xc826b9){var _0xd805b2=function(_0x19f322){while(--_0x19f322){_0x55ab87['push'](_0x55ab87['shift']());}};_0xd805b2(++_0xc826b9);}(_0x3ba6,0x171));var _0x63ba=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x3ba6[_0x4c1ec2];return _0x3f6f1c;};'use strict';var pdf=require(_0x63ba('0x0'));var emlformat=require(_0x63ba('0x1'));var rimraf=require(_0x63ba('0x2'));var zipdir=require(_0x63ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63ba('0x4'));var moment=require(_0x63ba('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x63ba('0x6'));var sox=require('sox');var csv=require(_0x63ba('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x63ba('0x8'));var squel=require(_0x63ba('0x9'));var crypto=require(_0x63ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x63ba('0x7'));var querystring=require(_0x63ba('0xb'));var Papa=require(_0x63ba('0xc'));var Redis=require('ioredis');var authService=require(_0x63ba('0xd'));var qs=require(_0x63ba('0xe'));var as=require(_0x63ba('0xf'));var hardwareService=require(_0x63ba('0x10'));var logger=require(_0x63ba('0x11'))(_0x63ba('0x12'));var utils=require(_0x63ba('0x13'));var config=require(_0x63ba('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x183e78,_0x397921){_0x397921=_0x397921||0xcc;return function(_0x64feb1){if(_0x64feb1){return _0x183e78[_0x63ba('0x15')](_0x397921);}return _0x183e78[_0x63ba('0x16')](_0x397921)[_0x63ba('0x17')]();};}function respondWithResult(_0x180c3f,_0x374262){_0x374262=_0x374262||0xc8;return function(_0x10878a){if(_0x10878a){return _0x180c3f[_0x63ba('0x16')](_0x374262)[_0x63ba('0x18')](_0x10878a);}};}function respondWithFilteredResult(_0x1573be,_0x3082be){return function(_0x43ef41){if(_0x43ef41){var _0x4ad53c=_0x43ef41[_0x63ba('0x19')],_0x4c203a=_0x3082be[_0x63ba('0x1a')],_0x303d93=_0x3082be[_0x63ba('0x1a')]+_0x3082be['limit'],_0x58d7ea;if(_0x303d93>=_0x4ad53c){_0x303d93=_0x4ad53c;_0x58d7ea=0xc8;}else{_0x58d7ea=0xce;}_0x1573be['status'](_0x58d7ea);return _0x1573be[_0x63ba('0x1b')](_0x63ba('0x1c'),_0x4c203a+'-'+_0x303d93+'/'+_0x4ad53c)[_0x63ba('0x18')](_0x43ef41);}return null;};}function patchUpdates(_0x44d733){return function(_0x66de2c){try{jsonpatch[_0x63ba('0x1d')](_0x66de2c,_0x44d733,!![]);}catch(_0x472c92){return BPromise['reject'](_0x472c92);}return _0x66de2c[_0x63ba('0x1e')]();};}function saveUpdates(_0x5edfa7,_0x4c9f26){return function(_0x153338){if(_0x153338){return _0x153338[_0x63ba('0x1f')](_0x5edfa7)[_0x63ba('0x20')](function(_0x146a17){return _0x146a17;});}return null;};}function removeEntity(_0x5380de,_0x16fa2b){return function(_0x26dcf0){if(_0x26dcf0){return _0x26dcf0[_0x63ba('0x21')]()['then'](function(){_0x5380de[_0x63ba('0x16')](0xcc)[_0x63ba('0x17')]();});}};}function handleEntityNotFound(_0x59446c,_0x2c1b12){return function(_0x1b969c){if(!_0x1b969c){_0x59446c[_0x63ba('0x15')](0x194);}return _0x1b969c;};}function handleError(_0x3b6314,_0x3a7b0d){_0x3a7b0d=_0x3a7b0d||0x1f4;return function(_0x268638){logger[_0x63ba('0x22')](_0x268638['stack']);if(_0x268638[_0x63ba('0x23')]){delete _0x268638[_0x63ba('0x23')];}_0x3b6314[_0x63ba('0x16')](_0x3a7b0d)['send'](_0x268638);};}exports[_0x63ba('0x24')]=function(_0x2619fb,_0xce3a9a){var _0x55fa41={},_0x68376={},_0x7b0992={'count':0x0,'rows':[]};var _0x32af55=_[_0x63ba('0x25')](db[_0x63ba('0x26')][_0x63ba('0x27')],function(_0x1ecce4){return{'name':_0x1ecce4['fieldName'],'type':_0x1ecce4[_0x63ba('0x28')][_0x63ba('0x29')]};});_0x68376[_0x63ba('0x2a')]=_[_0x63ba('0x25')](_0x32af55,_0x63ba('0x23'));_0x68376[_0x63ba('0x2b')]=_[_0x63ba('0x2c')](_0x2619fb[_0x63ba('0x2b')]);_0x68376[_0x63ba('0x2d')]=_[_0x63ba('0x2e')](_0x68376[_0x63ba('0x2a')],_0x68376['query']);_0x55fa41[_0x63ba('0x2f')]=_['intersection'](_0x68376['model'],qs[_0x63ba('0x30')](_0x2619fb[_0x63ba('0x2b')][_0x63ba('0x30')]));_0x55fa41['attributes']=_0x55fa41[_0x63ba('0x2f')]['length']?_0x55fa41['attributes']:_0x68376[_0x63ba('0x2a')];if(!_0x2619fb[_0x63ba('0x2b')][_0x63ba('0x31')]('nolimit')){_0x55fa41['limit']=qs[_0x63ba('0x32')](_0x2619fb[_0x63ba('0x2b')][_0x63ba('0x32')]);_0x55fa41[_0x63ba('0x1a')]=qs[_0x63ba('0x1a')](_0x2619fb[_0x63ba('0x2b')]['offset']);}_0x55fa41[_0x63ba('0x33')]=qs[_0x63ba('0x34')](_0x2619fb['query'][_0x63ba('0x34')]);_0x55fa41[_0x63ba('0x35')]=qs[_0x63ba('0x2d')](_['pick'](_0x2619fb[_0x63ba('0x2b')],_0x68376[_0x63ba('0x2d')]),_0x32af55);if(_0x2619fb[_0x63ba('0x2b')]['filter']){_0x55fa41[_0x63ba('0x35')]=_[_0x63ba('0x36')](_0x55fa41[_0x63ba('0x35')],{'$or':_[_0x63ba('0x25')](_0x32af55,function(_0x11cada){if(_0x11cada['type']!==_0x63ba('0x37')){var _0x3ef0c0={};_0x3ef0c0[_0x11cada[_0x63ba('0x23')]]={'$like':'%'+_0x2619fb[_0x63ba('0x2b')][_0x63ba('0x38')]+'%'};return _0x3ef0c0;}})});}_0x55fa41=_['merge']({},_0x55fa41,_0x2619fb[_0x63ba('0x39')]);var _0x182f48={'where':_0x55fa41[_0x63ba('0x35')]};return db['MailServerOut'][_0x63ba('0x19')](_0x182f48)[_0x63ba('0x20')](function(_0x2155d9){_0x7b0992['count']=_0x2155d9;if(_0x2619fb[_0x63ba('0x2b')]['includeAll']){_0x55fa41['include']=[{'all':!![]}];}return db[_0x63ba('0x26')][_0x63ba('0x3a')](_0x55fa41);})[_0x63ba('0x20')](function(_0x3047ea){_0x7b0992['rows']=_0x3047ea;return _0x7b0992;})[_0x63ba('0x20')](respondWithFilteredResult(_0xce3a9a,_0x55fa41))[_0x63ba('0x3b')](handleError(_0xce3a9a,null));};exports[_0x63ba('0x3c')]=function(_0x32ad90,_0x15d84b){var _0x3892fe={'raw':!![],'where':{'id':_0x32ad90[_0x63ba('0x3d')]['id']}},_0x330a88={};_0x330a88['model']=_[_0x63ba('0x2c')](db['MailServerOut'][_0x63ba('0x27')]);_0x330a88[_0x63ba('0x2b')]=_[_0x63ba('0x2c')](_0x32ad90[_0x63ba('0x2b')]);_0x330a88[_0x63ba('0x2d')]=_[_0x63ba('0x2e')](_0x330a88[_0x63ba('0x2a')],_0x330a88[_0x63ba('0x2b')]);_0x3892fe['attributes']=_['intersection'](_0x330a88[_0x63ba('0x2a')],qs[_0x63ba('0x30')](_0x32ad90[_0x63ba('0x2b')][_0x63ba('0x30')]));_0x3892fe['attributes']=_0x3892fe['attributes'][_0x63ba('0x3e')]?_0x3892fe[_0x63ba('0x2f')]:_0x330a88[_0x63ba('0x2a')];if(_0x32ad90[_0x63ba('0x2b')][_0x63ba('0x3f')]){_0x3892fe[_0x63ba('0x40')]=[{'all':!![]}];}_0x3892fe=_[_0x63ba('0x36')]({},_0x3892fe,_0x32ad90[_0x63ba('0x39')]);return db[_0x63ba('0x26')][_0x63ba('0x41')](_0x3892fe)[_0x63ba('0x20')](handleEntityNotFound(_0x15d84b,null))['then'](respondWithResult(_0x15d84b,null))[_0x63ba('0x3b')](handleError(_0x15d84b,null));};exports['create']=function(_0x1490a5,_0x3529a1){return db[_0x63ba('0x26')]['create'](_0x1490a5[_0x63ba('0x42')],{})[_0x63ba('0x20')](respondWithResult(_0x3529a1,0xc9))[_0x63ba('0x3b')](handleError(_0x3529a1,null));};exports[_0x63ba('0x1f')]=function(_0x54af77,_0x35d50b){if(_0x54af77[_0x63ba('0x42')]['id']){delete _0x54af77[_0x63ba('0x42')]['id'];}return db[_0x63ba('0x26')]['find']({'where':{'id':_0x54af77['params']['id']}})[_0x63ba('0x20')](handleEntityNotFound(_0x35d50b,null))['then'](saveUpdates(_0x54af77[_0x63ba('0x42')],null))[_0x63ba('0x20')](respondWithResult(_0x35d50b,null))[_0x63ba('0x3b')](handleError(_0x35d50b,null));};exports['destroy']=function(_0x43b430,_0x4e6563){return db[_0x63ba('0x26')][_0x63ba('0x41')]({'where':{'id':_0x43b430[_0x63ba('0x3d')]['id']}})[_0x63ba('0x20')](handleEntityNotFound(_0x4e6563,null))[_0x63ba('0x20')](removeEntity(_0x4e6563,null))[_0x63ba('0x3b')](handleError(_0x4e6563,null));}; \ No newline at end of file +var _0x60ae=['stack','name','send','map','MailServerOut','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x60ae,0xf7));var _0xe60a=function(_0x24b33c,_0x33cb97){_0x24b33c=_0x24b33c-0x0;var _0x33becf=_0x60ae[_0x24b33c];return _0x33becf;};'use strict';var pdf=require(_0xe60a('0x0'));var emlformat=require(_0xe60a('0x1'));var rimraf=require(_0xe60a('0x2'));var zipdir=require(_0xe60a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe60a('0x4'));var Mustache=require(_0xe60a('0x5'));var util=require(_0xe60a('0x6'));var path=require(_0xe60a('0x7'));var sox=require(_0xe60a('0x8'));var csv=require(_0xe60a('0x9'));var ejs=require(_0xe60a('0xa'));var fs=require('fs');var _=require(_0xe60a('0xb'));var squel=require(_0xe60a('0xc'));var crypto=require(_0xe60a('0xd'));var jsforce=require(_0xe60a('0xe'));var deskjs=require(_0xe60a('0xf'));var toCsv=require(_0xe60a('0x9'));var querystring=require(_0xe60a('0x10'));var Papa=require(_0xe60a('0x11'));var Redis=require(_0xe60a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe60a('0x13'));var logger=require(_0xe60a('0x14'))('api');var utils=require(_0xe60a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe60a('0x16'))['db'];function respondWithStatusCode(_0x867fc2,_0x281d18){_0x281d18=_0x281d18||0xcc;return function(_0x460782){if(_0x460782){return _0x867fc2[_0xe60a('0x17')](_0x281d18);}return _0x867fc2[_0xe60a('0x18')](_0x281d18)[_0xe60a('0x19')]();};}function respondWithResult(_0x1be455,_0x1b2591){_0x1b2591=_0x1b2591||0xc8;return function(_0x214203){if(_0x214203){return _0x1be455['status'](_0x1b2591)['json'](_0x214203);}};}function respondWithFilteredResult(_0x3b36a8,_0x54ccfa){return function(_0x5e84d0){if(_0x5e84d0){var _0x46b282=_0x5e84d0['count'],_0x12086f=_0x54ccfa[_0xe60a('0x1a')],_0x477b48=_0x54ccfa[_0xe60a('0x1a')]+_0x54ccfa[_0xe60a('0x1b')],_0x5d3d1d;if(_0x477b48>=_0x46b282){_0x477b48=_0x46b282;_0x5d3d1d=0xc8;}else{_0x5d3d1d=0xce;}_0x3b36a8[_0xe60a('0x18')](_0x5d3d1d);return _0x3b36a8['set'](_0xe60a('0x1c'),_0x12086f+'-'+_0x477b48+'/'+_0x46b282)['json'](_0x5e84d0);}return null;};}function patchUpdates(_0x431bb0){return function(_0x5a46eb){try{jsonpatch[_0xe60a('0x1d')](_0x5a46eb,_0x431bb0,!![]);}catch(_0x121916){return BPromise[_0xe60a('0x1e')](_0x121916);}return _0x5a46eb[_0xe60a('0x1f')]();};}function saveUpdates(_0x1c239d,_0x1dd93b){return function(_0x46bccd){if(_0x46bccd){return _0x46bccd[_0xe60a('0x20')](_0x1c239d)['then'](function(_0x4d0d10){return _0x4d0d10;});}return null;};}function removeEntity(_0x364ee4,_0x334b96){return function(_0x13a9b2){if(_0x13a9b2){return _0x13a9b2['destroy']()['then'](function(){_0x364ee4[_0xe60a('0x18')](0xcc)[_0xe60a('0x19')]();});}};}function handleEntityNotFound(_0x4f875e,_0x554480){return function(_0x151894){if(!_0x151894){_0x4f875e['sendStatus'](0x194);}return _0x151894;};}function handleError(_0x86a34a,_0xe8963b){_0xe8963b=_0xe8963b||0x1f4;return function(_0x8b8c0d){logger['error'](_0x8b8c0d[_0xe60a('0x21')]);if(_0x8b8c0d['name']){delete _0x8b8c0d[_0xe60a('0x22')];}_0x86a34a[_0xe60a('0x18')](_0xe8963b)[_0xe60a('0x23')](_0x8b8c0d);};}exports['index']=function(_0x1a2cfd,_0x5bc122){var _0x41be08={},_0x2405ab={},_0x2f1044={'count':0x0,'rows':[]};var _0x2ce246=_[_0xe60a('0x24')](db[_0xe60a('0x25')][_0xe60a('0x26')],function(_0x11ba45){return{'name':_0x11ba45['fieldName'],'type':_0x11ba45[_0xe60a('0x27')][_0xe60a('0x28')]};});_0x2405ab[_0xe60a('0x29')]=_['map'](_0x2ce246,'name');_0x2405ab['query']=_[_0xe60a('0x2a')](_0x1a2cfd['query']);_0x2405ab['filters']=_[_0xe60a('0x2b')](_0x2405ab[_0xe60a('0x29')],_0x2405ab[_0xe60a('0x2c')]);_0x41be08[_0xe60a('0x2d')]=_['intersection'](_0x2405ab[_0xe60a('0x29')],qs[_0xe60a('0x2e')](_0x1a2cfd[_0xe60a('0x2c')][_0xe60a('0x2e')]));_0x41be08[_0xe60a('0x2d')]=_0x41be08[_0xe60a('0x2d')][_0xe60a('0x2f')]?_0x41be08['attributes']:_0x2405ab[_0xe60a('0x29')];if(!_0x1a2cfd[_0xe60a('0x2c')]['hasOwnProperty'](_0xe60a('0x30'))){_0x41be08['limit']=qs[_0xe60a('0x1b')](_0x1a2cfd['query'][_0xe60a('0x1b')]);_0x41be08['offset']=qs[_0xe60a('0x1a')](_0x1a2cfd[_0xe60a('0x2c')]['offset']);}_0x41be08['order']=qs[_0xe60a('0x31')](_0x1a2cfd[_0xe60a('0x2c')]['sort']);_0x41be08[_0xe60a('0x32')]=qs[_0xe60a('0x33')](_[_0xe60a('0x34')](_0x1a2cfd[_0xe60a('0x2c')],_0x2405ab['filters']),_0x2ce246);if(_0x1a2cfd[_0xe60a('0x2c')][_0xe60a('0x35')]){_0x41be08['where']=_[_0xe60a('0x36')](_0x41be08[_0xe60a('0x32')],{'$or':_['map'](_0x2ce246,function(_0xd1e0b4){if(_0xd1e0b4[_0xe60a('0x27')]!==_0xe60a('0x37')){var _0x1e121e={};_0x1e121e[_0xd1e0b4[_0xe60a('0x22')]]={'$like':'%'+_0x1a2cfd['query'][_0xe60a('0x35')]+'%'};return _0x1e121e;}})});}_0x41be08=_[_0xe60a('0x36')]({},_0x41be08,_0x1a2cfd[_0xe60a('0x38')]);var _0x4bd89e={'where':_0x41be08[_0xe60a('0x32')]};return db[_0xe60a('0x25')][_0xe60a('0x39')](_0x4bd89e)[_0xe60a('0x3a')](function(_0x29bf73){_0x2f1044[_0xe60a('0x39')]=_0x29bf73;if(_0x1a2cfd[_0xe60a('0x2c')][_0xe60a('0x3b')]){_0x41be08[_0xe60a('0x3c')]=[{'all':!![]}];}return db[_0xe60a('0x25')][_0xe60a('0x3d')](_0x41be08);})[_0xe60a('0x3a')](function(_0x5a34c5){_0x2f1044[_0xe60a('0x3e')]=_0x5a34c5;return _0x2f1044;})['then'](respondWithFilteredResult(_0x5bc122,_0x41be08))['catch'](handleError(_0x5bc122,null));};exports[_0xe60a('0x3f')]=function(_0x554988,_0x12151c){var _0x38b374={'raw':!![],'where':{'id':_0x554988['params']['id']}},_0x2247b8={};_0x2247b8['model']=_['keys'](db[_0xe60a('0x25')][_0xe60a('0x26')]);_0x2247b8[_0xe60a('0x2c')]=_[_0xe60a('0x2a')](_0x554988[_0xe60a('0x2c')]);_0x2247b8[_0xe60a('0x33')]=_[_0xe60a('0x2b')](_0x2247b8['model'],_0x2247b8['query']);_0x38b374[_0xe60a('0x2d')]=_[_0xe60a('0x2b')](_0x2247b8[_0xe60a('0x29')],qs[_0xe60a('0x2e')](_0x554988[_0xe60a('0x2c')][_0xe60a('0x2e')]));_0x38b374[_0xe60a('0x2d')]=_0x38b374['attributes'][_0xe60a('0x2f')]?_0x38b374[_0xe60a('0x2d')]:_0x2247b8[_0xe60a('0x29')];if(_0x554988[_0xe60a('0x2c')][_0xe60a('0x3b')]){_0x38b374['include']=[{'all':!![]}];}_0x38b374=_[_0xe60a('0x36')]({},_0x38b374,_0x554988[_0xe60a('0x38')]);return db['MailServerOut'][_0xe60a('0x40')](_0x38b374)[_0xe60a('0x3a')](handleEntityNotFound(_0x12151c,null))['then'](respondWithResult(_0x12151c,null))[_0xe60a('0x41')](handleError(_0x12151c,null));};exports[_0xe60a('0x42')]=function(_0xe41cae,_0x282dc2){return db['MailServerOut']['create'](_0xe41cae['body'],{})[_0xe60a('0x3a')](respondWithResult(_0x282dc2,0xc9))[_0xe60a('0x41')](handleError(_0x282dc2,null));};exports[_0xe60a('0x20')]=function(_0x17e8b5,_0x48f18c){if(_0x17e8b5[_0xe60a('0x43')]['id']){delete _0x17e8b5['body']['id'];}return db[_0xe60a('0x25')][_0xe60a('0x40')]({'where':{'id':_0x17e8b5[_0xe60a('0x44')]['id']}})[_0xe60a('0x3a')](handleEntityNotFound(_0x48f18c,null))['then'](saveUpdates(_0x17e8b5[_0xe60a('0x43')],null))['then'](respondWithResult(_0x48f18c,null))[_0xe60a('0x41')](handleError(_0x48f18c,null));};exports[_0xe60a('0x45')]=function(_0x53e4dc,_0x4939c1){return db[_0xe60a('0x25')][_0xe60a('0x40')]({'where':{'id':_0x53e4dc[_0xe60a('0x44')]['id']}})[_0xe60a('0x3a')](handleEntityNotFound(_0x4939c1,null))[_0xe60a('0x3a')](removeEntity(_0x4939c1,null))['catch'](handleError(_0x4939c1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 205f66d..793c108 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 _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0xaddc33,_0x430b6d){var _0x37a048=function(_0x4d433c){while(--_0x4d433c){_0xaddc33['push'](_0xaddc33['shift']());}};_0x37a048(++_0x430b6d);}(_0x4819,0xcd));var _0x9481=function(_0x47410f,_0x53d9b2){_0x47410f=_0x47410f-0x0;var _0x272541=_0x4819[_0x47410f];return _0x272541;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['mail_servers_out','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x15c24e,_0x399653){var _0x1a6655=function(_0xd26d6){while(--_0xd26d6){_0x15c24e['push'](_0x15c24e['shift']());}};_0x1a6655(++_0x399653);}(_0x326f,0xd1));var _0xf326=function(_0x76d598,_0x425881){_0x76d598=_0x76d598-0x0;var _0x1862e4=_0x326f[_0x76d598];return _0x1862e4;};'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':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d1de198..6651407 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 _0xad95=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x6cde6c,_0x4fa34f){var _0x4e5ee1=function(_0x415ffe){while(--_0x415ffe){_0x6cde6c['push'](_0x6cde6c['shift']());}};_0x4e5ee1(++_0x4fa34f);}(_0xad95,0x14a));var _0x5ad9=function(_0x5b09cb,_0x2e7a04){_0x5b09cb=_0x5b09cb-0x0;var _0x56ddc9=_0xad95[_0x5b09cb];return _0x56ddc9;};'use strict';var _=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var moment=require(_0x5ad9('0x2'));var BPromise=require(_0x5ad9('0x3'));var rs=require(_0x5ad9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ad9('0x5'));var logger=require(_0x5ad9('0x6'))('rpc');var config=require(_0x5ad9('0x7'));var jayson=require(_0x5ad9('0x8'));var client=jayson[_0x5ad9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d2b6e,_0xfd6a2a,_0x3d4a49){return new BPromise(function(_0xdebc97,_0x55a48e){return client[_0x5ad9('0xa')](_0x5d2b6e,_0x3d4a49)[_0x5ad9('0xb')](function(_0x5e02e1){logger[_0x5ad9('0xc')](_0x5ad9('0xd'),_0xfd6a2a,_0x5ad9('0xe'));logger[_0x5ad9('0xf')](_0x5ad9('0x10'),_0xfd6a2a,_0x5ad9('0xe'),JSON[_0x5ad9('0x11')](_0x5e02e1));if(_0x5e02e1[_0x5ad9('0x12')]){if(_0x5e02e1[_0x5ad9('0x12')]['code']===0x1f4){logger[_0x5ad9('0x12')](_0x5ad9('0xd'),_0xfd6a2a,_0x5e02e1[_0x5ad9('0x12')][_0x5ad9('0x13')]);return _0x55a48e(_0x5e02e1[_0x5ad9('0x12')][_0x5ad9('0x13')]);}logger[_0x5ad9('0x12')](_0x5ad9('0xd'),_0xfd6a2a,_0x5e02e1[_0x5ad9('0x12')][_0x5ad9('0x13')]);return _0xdebc97(_0x5e02e1[_0x5ad9('0x12')][_0x5ad9('0x13')]);}else{logger[_0x5ad9('0xc')]('MailServerOut,\x20%s,\x20%s',_0xfd6a2a,_0x5ad9('0xe'));_0xdebc97(_0x5e02e1[_0x5ad9('0x14')][_0x5ad9('0x13')]);}})[_0x5ad9('0x15')](function(_0x5c1581){logger['error'](_0x5ad9('0xd'),_0xfd6a2a,_0x5c1581);_0x55a48e(_0x5c1581);});});} \ No newline at end of file +var _0x6da1=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','info','MailServerOut,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x6da1,0x1b1));var _0x16da=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x6da1[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0x16da('0x0'));var util=require(_0x16da('0x1'));var moment=require(_0x16da('0x2'));var BPromise=require(_0x16da('0x3'));var rs=require(_0x16da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16da('0x5'))['db'];var utils=require(_0x16da('0x6'));var logger=require(_0x16da('0x7'))(_0x16da('0x8'));var config=require(_0x16da('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x16da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e574e,_0x6c0c3,_0x441b70){return new BPromise(function(_0x123922,_0x2e9f2f){return client[_0x16da('0xb')](_0x1e574e,_0x441b70)[_0x16da('0xc')](function(_0x8813d2){logger['info']('MailServerOut,\x20%s,\x20%s',_0x6c0c3,_0x16da('0xd'));logger[_0x16da('0xe')](_0x16da('0xf'),_0x6c0c3,'request\x20sent',JSON[_0x16da('0x10')](_0x8813d2));if(_0x8813d2[_0x16da('0x11')]){if(_0x8813d2[_0x16da('0x11')]['code']===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x6c0c3,_0x8813d2[_0x16da('0x11')]['message']);return _0x2e9f2f(_0x8813d2['error'][_0x16da('0x12')]);}logger[_0x16da('0x11')]('MailServerOut,\x20%s,\x20%s',_0x6c0c3,_0x8813d2[_0x16da('0x11')][_0x16da('0x12')]);return _0x123922(_0x8813d2['error'][_0x16da('0x12')]);}else{logger[_0x16da('0x13')](_0x16da('0x14'),_0x6c0c3,_0x16da('0xd'));_0x123922(_0x8813d2[_0x16da('0x15')]['message']);}})[_0x16da('0x16')](function(_0x40f28e){logger[_0x16da('0x11')](_0x16da('0x14'),_0x6c0c3,_0x40f28e);_0x2e9f2f(_0x40f28e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e5e531c..c546c38 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 _0x5f7d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','/describe','describe','/:id','show','isAuthenticated','create','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3f481e,_0xabaa4a){var _0xc2ad1=function(_0x52ebf5){while(--_0x52ebf5){_0x3f481e['push'](_0x3f481e['shift']());}};_0xc2ad1(++_0xabaa4a);}(_0x5f7d,0x6d));var _0xd5f7=function(_0x5712c3,_0x120349){_0x5712c3=_0x5712c3-0x0;var _0x553327=_0x5f7d[_0x5712c3];return _0x553327;};'use strict';var multer=require(_0xd5f7('0x0'));var util=require(_0xd5f7('0x1'));var path=require(_0xd5f7('0x2'));var timeout=require(_0xd5f7('0x3'));var express=require('express');var router=express[_0xd5f7('0x4')]();var auth=require(_0xd5f7('0x5'));var interaction=require(_0xd5f7('0x6'));var config=require(_0xd5f7('0x7'));var controller=require(_0xd5f7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd5f7('0x9')]);router['get'](_0xd5f7('0xa'),auth['isAuthenticated'](),controller[_0xd5f7('0xb')]);router['get'](_0xd5f7('0xc'),auth['isAuthenticated'](),controller[_0xd5f7('0xd')]);router['post']('/',auth[_0xd5f7('0xe')](),controller[_0xd5f7('0xf')]);router['put'](_0xd5f7('0xc'),auth[_0xd5f7('0xe')](),controller['update']);router[_0xd5f7('0x10')](_0xd5f7('0xc'),auth[_0xd5f7('0xe')](),controller[_0xd5f7('0x11')]);module[_0xd5f7('0x12')]=router; \ No newline at end of file +var _0xcb75=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xcb75,0x174));var _0x5cb7=function(_0x31da0d,_0x51aac7){_0x31da0d=_0x31da0d-0x0;var _0x2d89da=_0xcb75[_0x31da0d];return _0x2d89da;};'use strict';var multer=require(_0x5cb7('0x0'));var util=require(_0x5cb7('0x1'));var path=require(_0x5cb7('0x2'));var timeout=require(_0x5cb7('0x3'));var express=require(_0x5cb7('0x4'));var router=express[_0x5cb7('0x5')]();var auth=require(_0x5cb7('0x6'));var interaction=require(_0x5cb7('0x7'));var config=require(_0x5cb7('0x8'));var controller=require(_0x5cb7('0x9'));router[_0x5cb7('0xa')]('/',auth[_0x5cb7('0xb')](),controller[_0x5cb7('0xc')]);router[_0x5cb7('0xa')](_0x5cb7('0xd'),auth[_0x5cb7('0xb')](),controller['describe']);router['get'](_0x5cb7('0xe'),auth[_0x5cb7('0xb')](),controller[_0x5cb7('0xf')]);router[_0x5cb7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5cb7('0xe'),auth['isAuthenticated'](),controller[_0x5cb7('0x11')]);router[_0x5cb7('0x12')]('/:id',auth[_0x5cb7('0xb')](),controller[_0x5cb7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index d441395..226fbc2 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 _0xb0ee=['exports','STRING','name'];(function(_0xb578f1,_0x2fb93c){var _0x114128=function(_0x32bf52){while(--_0x32bf52){_0xb578f1['push'](_0xb578f1['shift']());}};_0x114128(++_0x2fb93c);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xb0ee[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require('sequelize');module[_0xeb0e('0x0')]={'name':{'type':Sequelize[_0xeb0e('0x1')],'unique':_0xeb0e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeb0e('0x1')]}}; \ No newline at end of file +var _0x1a37=['sequelize','exports','STRING','name'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x1a37,0xb4));var _0x71a3=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x1a37[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x71a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index cdcbc92..d352794 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 _0xc795=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5c842f,_0x3bc98f){var _0x4a069d=function(_0xe49ee5){while(--_0xe49ee5){_0x5c842f['push'](_0x5c842f['shift']());}};_0x4a069d(++_0x3bc98f);}(_0xc795,0x111));var _0x5c79=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc795[_0x413feb];return _0x40ee88;};'use strict';var pdf=require(_0x5c79('0x0'));var emlformat=require(_0x5c79('0x1'));var rimraf=require(_0x5c79('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c79('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c79('0x4'));var Mustache=require(_0x5c79('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5c79('0x6'));var ejs=require(_0x5c79('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5c79('0x8'));var crypto=require('crypto');var jsforce=require(_0x5c79('0x9'));var deskjs=require(_0x5c79('0xa'));var toCsv=require(_0x5c79('0x6'));var querystring=require(_0x5c79('0xb'));var Papa=require(_0x5c79('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c79('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c79('0xe'));var logger=require(_0x5c79('0xf'))(_0x5c79('0x10'));var utils=require(_0x5c79('0x11'));var config=require(_0x5c79('0x12'));var licenseUtil=require(_0x5c79('0x13'));var db=require(_0x5c79('0x14'))['db'];function respondWithStatusCode(_0x536eee,_0x500521){_0x500521=_0x500521||0xcc;return function(_0x388349){if(_0x388349){return _0x536eee[_0x5c79('0x15')](_0x500521);}return _0x536eee[_0x5c79('0x16')](_0x500521)[_0x5c79('0x17')]();};}function respondWithResult(_0x5c0e38,_0x262678){_0x262678=_0x262678||0xc8;return function(_0x426d9c){if(_0x426d9c){return _0x5c0e38[_0x5c79('0x16')](_0x262678)[_0x5c79('0x18')](_0x426d9c);}};}function respondWithFilteredResult(_0x4f82af,_0x91d9a7){return function(_0x45b18f){if(_0x45b18f){var _0xa86db1=_0x45b18f[_0x5c79('0x19')],_0x47a6c2=_0x91d9a7[_0x5c79('0x1a')],_0x2232a8=_0x91d9a7['offset']+_0x91d9a7[_0x5c79('0x1b')],_0x47f87e;if(_0x2232a8>=_0xa86db1){_0x2232a8=_0xa86db1;_0x47f87e=0xc8;}else{_0x47f87e=0xce;}_0x4f82af['status'](_0x47f87e);return _0x4f82af[_0x5c79('0x1c')](_0x5c79('0x1d'),_0x47a6c2+'-'+_0x2232a8+'/'+_0xa86db1)[_0x5c79('0x18')](_0x45b18f);}return null;};}function patchUpdates(_0x1ba4da){return function(_0xc0ec9d){try{jsonpatch[_0x5c79('0x1e')](_0xc0ec9d,_0x1ba4da,!![]);}catch(_0x3c155b){return BPromise[_0x5c79('0x1f')](_0x3c155b);}return _0xc0ec9d['save']();};}function saveUpdates(_0x8df31e,_0x18932d){return function(_0x3d25ba){if(_0x3d25ba){return _0x3d25ba[_0x5c79('0x20')](_0x8df31e)['then'](function(_0x367f48){return _0x367f48;});}return null;};}function removeEntity(_0x5dad8a,_0x388954){return function(_0x37b015){if(_0x37b015){return _0x37b015['destroy']()['then'](function(){_0x5dad8a['status'](0xcc)[_0x5c79('0x17')]();});}};}function handleEntityNotFound(_0x289d91,_0x44a4c9){return function(_0x503701){if(!_0x503701){_0x289d91[_0x5c79('0x15')](0x194);}return _0x503701;};}function handleError(_0x3770de,_0x3f8a9c){_0x3f8a9c=_0x3f8a9c||0x1f4;return function(_0x3699f0){logger['error'](_0x3699f0[_0x5c79('0x21')]);if(_0x3699f0[_0x5c79('0x22')]){delete _0x3699f0[_0x5c79('0x22')];}_0x3770de[_0x5c79('0x16')](_0x3f8a9c)[_0x5c79('0x23')](_0x3699f0);};}exports[_0x5c79('0x24')]=function(_0x352a40,_0x23fb18){var _0x8eee2f={},_0x4fd892={},_0x3b70f9={'count':0x0,'rows':[]};var _0x4f9d0b=_[_0x5c79('0x25')](db[_0x5c79('0x26')][_0x5c79('0x27')],function(_0x230390){return{'name':_0x230390[_0x5c79('0x28')],'type':_0x230390['type'][_0x5c79('0x29')]};});_0x4fd892['model']=_[_0x5c79('0x25')](_0x4f9d0b,_0x5c79('0x22'));_0x4fd892[_0x5c79('0x2a')]=_[_0x5c79('0x2b')](_0x352a40[_0x5c79('0x2a')]);_0x4fd892[_0x5c79('0x2c')]=_[_0x5c79('0x2d')](_0x4fd892[_0x5c79('0x2e')],_0x4fd892[_0x5c79('0x2a')]);_0x8eee2f['attributes']=_[_0x5c79('0x2d')](_0x4fd892[_0x5c79('0x2e')],qs[_0x5c79('0x2f')](_0x352a40['query'][_0x5c79('0x2f')]));_0x8eee2f[_0x5c79('0x30')]=_0x8eee2f[_0x5c79('0x30')]['length']?_0x8eee2f[_0x5c79('0x30')]:_0x4fd892[_0x5c79('0x2e')];if(!_0x352a40[_0x5c79('0x2a')][_0x5c79('0x31')](_0x5c79('0x32'))){_0x8eee2f['limit']=qs[_0x5c79('0x1b')](_0x352a40['query'][_0x5c79('0x1b')]);_0x8eee2f[_0x5c79('0x1a')]=qs[_0x5c79('0x1a')](_0x352a40[_0x5c79('0x2a')][_0x5c79('0x1a')]);}_0x8eee2f[_0x5c79('0x33')]=qs[_0x5c79('0x34')](_0x352a40[_0x5c79('0x2a')]['sort']);_0x8eee2f['where']=qs[_0x5c79('0x2c')](_[_0x5c79('0x35')](_0x352a40[_0x5c79('0x2a')],_0x4fd892[_0x5c79('0x2c')]),_0x4f9d0b);if(_0x352a40[_0x5c79('0x2a')][_0x5c79('0x36')]){_0x8eee2f[_0x5c79('0x37')]=_[_0x5c79('0x38')](_0x8eee2f[_0x5c79('0x37')],{'$or':_[_0x5c79('0x25')](_0x4f9d0b,function(_0x57dd5c){if(_0x57dd5c['type']!=='VIRTUAL'){var _0x5ecce1={};_0x5ecce1[_0x57dd5c[_0x5c79('0x22')]]={'$like':'%'+_0x352a40['query'][_0x5c79('0x36')]+'%'};return _0x5ecce1;}})});}_0x8eee2f=_[_0x5c79('0x38')]({},_0x8eee2f,_0x352a40[_0x5c79('0x39')]);var _0x2947a1={'where':_0x8eee2f[_0x5c79('0x37')]};return db[_0x5c79('0x26')]['count'](_0x2947a1)[_0x5c79('0x3a')](function(_0x854d9a){_0x3b70f9['count']=_0x854d9a;if(_0x352a40[_0x5c79('0x2a')][_0x5c79('0x3b')]){_0x8eee2f[_0x5c79('0x3c')]=[{'all':!![]}];}return db[_0x5c79('0x26')][_0x5c79('0x3d')](_0x8eee2f);})[_0x5c79('0x3a')](function(_0x2d9aa8){_0x3b70f9[_0x5c79('0x3e')]=_0x2d9aa8;return _0x3b70f9;})[_0x5c79('0x3a')](respondWithFilteredResult(_0x23fb18,_0x8eee2f))[_0x5c79('0x3f')](handleError(_0x23fb18,null));};exports[_0x5c79('0x40')]=function(_0x30b19b,_0xc7a934){var _0x26be62={'raw':!![],'where':{'id':_0x30b19b['params']['id']}},_0x3a0e78={};_0x3a0e78[_0x5c79('0x2e')]=_[_0x5c79('0x2b')](db[_0x5c79('0x26')][_0x5c79('0x27')]);_0x3a0e78[_0x5c79('0x2a')]=_[_0x5c79('0x2b')](_0x30b19b['query']);_0x3a0e78[_0x5c79('0x2c')]=_['intersection'](_0x3a0e78['model'],_0x3a0e78[_0x5c79('0x2a')]);_0x26be62['attributes']=_[_0x5c79('0x2d')](_0x3a0e78[_0x5c79('0x2e')],qs[_0x5c79('0x2f')](_0x30b19b[_0x5c79('0x2a')][_0x5c79('0x2f')]));_0x26be62[_0x5c79('0x30')]=_0x26be62[_0x5c79('0x30')][_0x5c79('0x41')]?_0x26be62[_0x5c79('0x30')]:_0x3a0e78[_0x5c79('0x2e')];if(_0x30b19b[_0x5c79('0x2a')][_0x5c79('0x3b')]){_0x26be62[_0x5c79('0x3c')]=[{'all':!![]}];}_0x26be62=_[_0x5c79('0x38')]({},_0x26be62,_0x30b19b[_0x5c79('0x39')]);return db[_0x5c79('0x26')]['find'](_0x26be62)[_0x5c79('0x3a')](handleEntityNotFound(_0xc7a934,null))[_0x5c79('0x3a')](respondWithResult(_0xc7a934,null))[_0x5c79('0x3f')](handleError(_0xc7a934,null));};exports[_0x5c79('0x42')]=function(_0x3d6e24,_0xb04a28){return db['MailSubstatus']['create'](_0x3d6e24[_0x5c79('0x43')],{})[_0x5c79('0x3a')](respondWithResult(_0xb04a28,0xc9))[_0x5c79('0x3f')](handleError(_0xb04a28,null));};exports[_0x5c79('0x20')]=function(_0x4b75bc,_0x4d178f){if(_0x4b75bc[_0x5c79('0x43')]['id']){delete _0x4b75bc[_0x5c79('0x43')]['id'];}return db[_0x5c79('0x26')][_0x5c79('0x44')]({'where':{'id':_0x4b75bc[_0x5c79('0x45')]['id']}})[_0x5c79('0x3a')](handleEntityNotFound(_0x4d178f,null))['then'](saveUpdates(_0x4b75bc['body'],null))['then'](respondWithResult(_0x4d178f,null))[_0x5c79('0x3f')](handleError(_0x4d178f,null));};exports[_0x5c79('0x46')]=function(_0x260357,_0x3b125d){return db[_0x5c79('0x26')][_0x5c79('0x44')]({'where':{'id':_0x260357[_0x5c79('0x45')]['id']}})[_0x5c79('0x3a')](handleEntityNotFound(_0x3b125d,null))[_0x5c79('0x3a')](removeEntity(_0x3b125d,null))[_0x5c79('0x3f')](handleError(_0x3b125d,null));};exports[_0x5c79('0x47')]=function(_0x62f0c6,_0x27742f){return db[_0x5c79('0x26')][_0x5c79('0x47')]()[_0x5c79('0x3a')](respondWithResult(_0x27742f,null))['catch'](handleError(_0x27742f,null));}; \ No newline at end of file +var _0x736c=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','json','offset','status','set','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','count','findAll','rows','catch','show','rawAttributes','includeAll','include','options','create','body','find','params','describe','eml-format','rimraf','moment','bluebird','mustache','util'];(function(_0x56165d,_0x3ea8e3){var _0x148eed=function(_0x1572db){while(--_0x1572db){_0x56165d['push'](_0x56165d['shift']());}};_0x148eed(++_0x3ea8e3);}(_0x736c,0x15d));var _0xc736=function(_0x51921f,_0x42bde0){_0x51921f=_0x51921f-0x0;var _0x41743a=_0x736c[_0x51921f];return _0x41743a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc736('0x0'));var rimraf=require(_0xc736('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc736('0x2'));var BPromise=require(_0xc736('0x3'));var Mustache=require(_0xc736('0x4'));var util=require(_0xc736('0x5'));var path=require('path');var sox=require(_0xc736('0x6'));var csv=require(_0xc736('0x7'));var ejs=require(_0xc736('0x8'));var fs=require('fs');var _=require(_0xc736('0x9'));var squel=require(_0xc736('0xa'));var crypto=require(_0xc736('0xb'));var jsforce=require(_0xc736('0xc'));var deskjs=require(_0xc736('0xd'));var toCsv=require(_0xc736('0x7'));var querystring=require('querystring');var Papa=require(_0xc736('0xe'));var Redis=require(_0xc736('0xf'));var authService=require(_0xc736('0x10'));var qs=require(_0xc736('0x11'));var as=require(_0xc736('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc736('0x13'));var utils=require(_0xc736('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc736('0x15'))['db'];function respondWithStatusCode(_0x5c2059,_0x23e9a2){_0x23e9a2=_0x23e9a2||0xcc;return function(_0x34edfc){if(_0x34edfc){return _0x5c2059['sendStatus'](_0x23e9a2);}return _0x5c2059['status'](_0x23e9a2)['end']();};}function respondWithResult(_0x2cc5d8,_0x5b4aa3){_0x5b4aa3=_0x5b4aa3||0xc8;return function(_0x6c7676){if(_0x6c7676){return _0x2cc5d8['status'](_0x5b4aa3)[_0xc736('0x16')](_0x6c7676);}};}function respondWithFilteredResult(_0x4c1d67,_0x1603b7){return function(_0x32426d){if(_0x32426d){var _0xe1f1d5=_0x32426d['count'],_0x196529=_0x1603b7[_0xc736('0x17')],_0x2a32b9=_0x1603b7[_0xc736('0x17')]+_0x1603b7['limit'],_0xc09089;if(_0x2a32b9>=_0xe1f1d5){_0x2a32b9=_0xe1f1d5;_0xc09089=0xc8;}else{_0xc09089=0xce;}_0x4c1d67[_0xc736('0x18')](_0xc09089);return _0x4c1d67[_0xc736('0x19')]('Content-Range',_0x196529+'-'+_0x2a32b9+'/'+_0xe1f1d5)[_0xc736('0x16')](_0x32426d);}return null;};}function patchUpdates(_0x165d7f){return function(_0x170cf4){try{jsonpatch['apply'](_0x170cf4,_0x165d7f,!![]);}catch(_0x4f7a7e){return BPromise['reject'](_0x4f7a7e);}return _0x170cf4[_0xc736('0x1a')]();};}function saveUpdates(_0x3caf1f,_0x2290e4){return function(_0x9b0a0f){if(_0x9b0a0f){return _0x9b0a0f[_0xc736('0x1b')](_0x3caf1f)[_0xc736('0x1c')](function(_0x1b7b2c){return _0x1b7b2c;});}return null;};}function removeEntity(_0x4e00d3,_0x5fe776){return function(_0x429aa4){if(_0x429aa4){return _0x429aa4[_0xc736('0x1d')]()[_0xc736('0x1c')](function(){_0x4e00d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a233f,_0x1bf8bc){return function(_0x268d59){if(!_0x268d59){_0x1a233f[_0xc736('0x1e')](0x194);}return _0x268d59;};}function handleError(_0x188858,_0x6af378){_0x6af378=_0x6af378||0x1f4;return function(_0x17e19d){logger['error'](_0x17e19d[_0xc736('0x1f')]);if(_0x17e19d[_0xc736('0x20')]){delete _0x17e19d['name'];}_0x188858[_0xc736('0x18')](_0x6af378)[_0xc736('0x21')](_0x17e19d);};}exports[_0xc736('0x22')]=function(_0x16f7c1,_0x107d20){var _0x511db7={},_0xa1cd49={},_0x8b5ba9={'count':0x0,'rows':[]};var _0x324310=_[_0xc736('0x23')](db[_0xc736('0x24')]['rawAttributes'],function(_0x322080){return{'name':_0x322080[_0xc736('0x25')],'type':_0x322080[_0xc736('0x26')][_0xc736('0x27')]};});_0xa1cd49[_0xc736('0x28')]=_[_0xc736('0x23')](_0x324310,'name');_0xa1cd49['query']=_[_0xc736('0x29')](_0x16f7c1[_0xc736('0x2a')]);_0xa1cd49[_0xc736('0x2b')]=_[_0xc736('0x2c')](_0xa1cd49[_0xc736('0x28')],_0xa1cd49[_0xc736('0x2a')]);_0x511db7[_0xc736('0x2d')]=_['intersection'](_0xa1cd49[_0xc736('0x28')],qs[_0xc736('0x2e')](_0x16f7c1[_0xc736('0x2a')][_0xc736('0x2e')]));_0x511db7[_0xc736('0x2d')]=_0x511db7[_0xc736('0x2d')][_0xc736('0x2f')]?_0x511db7[_0xc736('0x2d')]:_0xa1cd49['model'];if(!_0x16f7c1['query'][_0xc736('0x30')](_0xc736('0x31'))){_0x511db7[_0xc736('0x32')]=qs[_0xc736('0x32')](_0x16f7c1[_0xc736('0x2a')][_0xc736('0x32')]);_0x511db7[_0xc736('0x17')]=qs[_0xc736('0x17')](_0x16f7c1[_0xc736('0x2a')]['offset']);}_0x511db7[_0xc736('0x33')]=qs['sort'](_0x16f7c1['query'][_0xc736('0x34')]);_0x511db7['where']=qs['filters'](_[_0xc736('0x35')](_0x16f7c1[_0xc736('0x2a')],_0xa1cd49[_0xc736('0x2b')]),_0x324310);if(_0x16f7c1[_0xc736('0x2a')]['filter']){_0x511db7[_0xc736('0x36')]=_[_0xc736('0x37')](_0x511db7['where'],{'$or':_['map'](_0x324310,function(_0x5ef546){if(_0x5ef546[_0xc736('0x26')]!==_0xc736('0x38')){var _0x10f576={};_0x10f576[_0x5ef546[_0xc736('0x20')]]={'$like':'%'+_0x16f7c1[_0xc736('0x2a')]['filter']+'%'};return _0x10f576;}})});}_0x511db7=_[_0xc736('0x37')]({},_0x511db7,_0x16f7c1['options']);var _0x44eeed={'where':_0x511db7['where']};return db[_0xc736('0x24')][_0xc736('0x39')](_0x44eeed)[_0xc736('0x1c')](function(_0x178091){_0x8b5ba9[_0xc736('0x39')]=_0x178091;if(_0x16f7c1['query']['includeAll']){_0x511db7['include']=[{'all':!![]}];}return db[_0xc736('0x24')][_0xc736('0x3a')](_0x511db7);})['then'](function(_0x40ba6d){_0x8b5ba9[_0xc736('0x3b')]=_0x40ba6d;return _0x8b5ba9;})[_0xc736('0x1c')](respondWithFilteredResult(_0x107d20,_0x511db7))[_0xc736('0x3c')](handleError(_0x107d20,null));};exports[_0xc736('0x3d')]=function(_0x1ed4a6,_0x4ceb9c){var _0x352128={'raw':!![],'where':{'id':_0x1ed4a6['params']['id']}},_0x3ddff0={};_0x3ddff0[_0xc736('0x28')]=_[_0xc736('0x29')](db[_0xc736('0x24')][_0xc736('0x3e')]);_0x3ddff0[_0xc736('0x2a')]=_[_0xc736('0x29')](_0x1ed4a6[_0xc736('0x2a')]);_0x3ddff0[_0xc736('0x2b')]=_[_0xc736('0x2c')](_0x3ddff0[_0xc736('0x28')],_0x3ddff0[_0xc736('0x2a')]);_0x352128[_0xc736('0x2d')]=_[_0xc736('0x2c')](_0x3ddff0['model'],qs[_0xc736('0x2e')](_0x1ed4a6['query'][_0xc736('0x2e')]));_0x352128[_0xc736('0x2d')]=_0x352128[_0xc736('0x2d')][_0xc736('0x2f')]?_0x352128[_0xc736('0x2d')]:_0x3ddff0[_0xc736('0x28')];if(_0x1ed4a6[_0xc736('0x2a')][_0xc736('0x3f')]){_0x352128[_0xc736('0x40')]=[{'all':!![]}];}_0x352128=_[_0xc736('0x37')]({},_0x352128,_0x1ed4a6[_0xc736('0x41')]);return db[_0xc736('0x24')]['find'](_0x352128)['then'](handleEntityNotFound(_0x4ceb9c,null))[_0xc736('0x1c')](respondWithResult(_0x4ceb9c,null))[_0xc736('0x3c')](handleError(_0x4ceb9c,null));};exports[_0xc736('0x42')]=function(_0x119656,_0x51b7d7){return db[_0xc736('0x24')][_0xc736('0x42')](_0x119656[_0xc736('0x43')],{})['then'](respondWithResult(_0x51b7d7,0xc9))[_0xc736('0x3c')](handleError(_0x51b7d7,null));};exports[_0xc736('0x1b')]=function(_0x337383,_0x4752c7){if(_0x337383[_0xc736('0x43')]['id']){delete _0x337383[_0xc736('0x43')]['id'];}return db[_0xc736('0x24')][_0xc736('0x44')]({'where':{'id':_0x337383[_0xc736('0x45')]['id']}})[_0xc736('0x1c')](handleEntityNotFound(_0x4752c7,null))[_0xc736('0x1c')](saveUpdates(_0x337383['body'],null))['then'](respondWithResult(_0x4752c7,null))[_0xc736('0x3c')](handleError(_0x4752c7,null));};exports['destroy']=function(_0x3d51ce,_0x5ae877){return db[_0xc736('0x24')][_0xc736('0x44')]({'where':{'id':_0x3d51ce[_0xc736('0x45')]['id']}})[_0xc736('0x1c')](handleEntityNotFound(_0x5ae877,null))[_0xc736('0x1c')](removeEntity(_0x5ae877,null))['catch'](handleError(_0x5ae877,null));};exports[_0xc736('0x46')]=function(_0xe8804d,_0x4305ad){return db['MailSubstatus'][_0xc736('0x46')]()[_0xc736('0x1c')](respondWithResult(_0x4305ad,null))[_0xc736('0x3c')](handleError(_0x4305ad,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c6183bf..5b000b0 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 _0x0447=['moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash','util','../../config/logger','api'];(function(_0x3c607b,_0x369b9b){var _0x325d1c=function(_0x311c2b){while(--_0x311c2b){_0x3c607b['push'](_0x3c607b['shift']());}};_0x325d1c(++_0x369b9b);}(_0x0447,0x8b));var _0x7044=function(_0x335db2,_0x3e70f6){_0x335db2=_0x335db2-0x0;var _0x410499=_0x0447[_0x335db2];return _0x410499;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var logger=require(_0x7044('0x2'))(_0x7044('0x3'));var moment=require(_0x7044('0x4'));var BPromise=require('bluebird');var rp=require(_0x7044('0x5'));var fs=require('fs');var path=require(_0x7044('0x6'));var rimraf=require(_0x7044('0x7'));var config=require(_0x7044('0x8'));var attributes=require(_0x7044('0x9'));module[_0x7044('0xa')]=function(_0x148941,_0x20dfb1){return _0x148941[_0x7044('0xb')]('MailSubstatus',attributes,{'tableName':_0x7044('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a40=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash'];(function(_0x87df7c,_0x5e94e9){var _0x23c96a=function(_0x1d19fa){while(--_0x1d19fa){_0x87df7c['push'](_0x87df7c['shift']());}};_0x23c96a(++_0x5e94e9);}(_0x7a40,0x197));var _0x07a4=function(_0x422277,_0x7ee3e2){_0x422277=_0x422277-0x0;var _0x1298e4=_0x7a40[_0x422277];return _0x1298e4;};'use strict';var _=require(_0x07a4('0x0'));var util=require(_0x07a4('0x1'));var logger=require(_0x07a4('0x2'))('api');var moment=require(_0x07a4('0x3'));var BPromise=require(_0x07a4('0x4'));var rp=require(_0x07a4('0x5'));var fs=require('fs');var path=require(_0x07a4('0x6'));var rimraf=require(_0x07a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x07a4('0x8'));module[_0x07a4('0x9')]=function(_0x3a53fb,_0x399d0f){return _0x3a53fb[_0x07a4('0xa')]('MailSubstatus',attributes,{'tableName':_0x07a4('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 611258f..af355c5 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x55e0,0xdc));var _0x055e=function(_0x148cd4,_0x3bb783){_0x148cd4=_0x148cd4-0x0;var _0x1b8338=_0x55e0[_0x148cd4];return _0x1b8338;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x1982c4,_0x1f46e6){var _0x5dce03=function(_0x421eaf){while(--_0x421eaf){_0x1982c4['push'](_0x1982c4['shift']());}};_0x5dce03(++_0x1f46e6);}(_0x702d,0x147));var _0xd702=function(_0x430403,_0x2481ba){_0x430403=_0x430403-0x0;var _0x31be3b=_0x702d[_0x430403];return _0x31be3b;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6e4ec1c..ba6a0b3 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 _0x9ae7=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4c3ba0,_0xdc0e0f){var _0xe09d6d=function(_0x301d8c){while(--_0x301d8c){_0x4c3ba0['push'](_0x4c3ba0['shift']());}};_0xe09d6d(++_0xdc0e0f);}(_0x9ae7,0x72));var _0x79ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ae7[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x79ae('0x0'));var util=require('util');var path=require(_0x79ae('0x1'));var timeout=require(_0x79ae('0x2'));var express=require('express');var router=express[_0x79ae('0x3')]();var auth=require(_0x79ae('0x4'));var interaction=require(_0x79ae('0x5'));var config=require(_0x79ae('0x6'));var controller=require(_0x79ae('0x7'));router[_0x79ae('0x8')]('/',auth[_0x79ae('0x9')](),controller[_0x79ae('0xa')]);router[_0x79ae('0x8')]('/describe',auth[_0x79ae('0x9')](),controller[_0x79ae('0xb')]);router[_0x79ae('0x8')]('/:id',auth[_0x79ae('0x9')](),controller[_0x79ae('0xc')]);router[_0x79ae('0xd')]('/',auth[_0x79ae('0x9')](),controller[_0x79ae('0xe')]);router[_0x79ae('0xf')](_0x79ae('0x10'),auth['isAuthenticated'](),controller[_0x79ae('0x11')]);router[_0x79ae('0x12')]('/:id',auth[_0x79ae('0x9')](),controller['destroy']);module[_0x79ae('0x13')]=router; \ No newline at end of file +var _0xa994=['create','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x2cb1ef,_0x23fc77){var _0xc5c61e=function(_0x393f96){while(--_0x393f96){_0x2cb1ef['push'](_0x2cb1ef['shift']());}};_0xc5c61e(++_0x23fc77);}(_0xa994,0x180));var _0x4a99=function(_0x3c5f0b,_0x138c4f){_0x3c5f0b=_0x3c5f0b-0x0;var _0x36ebe6=_0xa994[_0x3c5f0b];return _0x36ebe6;};'use strict';var multer=require('multer');var util=require(_0x4a99('0x0'));var path=require(_0x4a99('0x1'));var timeout=require(_0x4a99('0x2'));var express=require('express');var router=express[_0x4a99('0x3')]();var auth=require(_0x4a99('0x4'));var interaction=require(_0x4a99('0x5'));var config=require('../../config/environment');var controller=require(_0x4a99('0x6'));router[_0x4a99('0x7')]('/',auth['isAuthenticated'](),controller[_0x4a99('0x8')]);router[_0x4a99('0x7')](_0x4a99('0x9'),auth[_0x4a99('0xa')](),controller[_0x4a99('0xb')]);router[_0x4a99('0x7')](_0x4a99('0xc'),auth[_0x4a99('0xa')](),controller[_0x4a99('0xd')]);router[_0x4a99('0xe')]('/',auth[_0x4a99('0xa')](),controller[_0x4a99('0xf')]);router[_0x4a99('0x10')](_0x4a99('0xc'),auth[_0x4a99('0xa')](),controller[_0x4a99('0x11')]);router['delete'](_0x4a99('0xc'),auth[_0x4a99('0xa')](),controller['destroy']);module[_0x4a99('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 8320304..2350116 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 _0xa1eb=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x578d76,_0x341da0){var _0x1789de=function(_0x2ea49f){while(--_0x2ea49f){_0x578d76['push'](_0x578d76['shift']());}};_0x1789de(++_0x341da0);}(_0xa1eb,0xa1));var _0xba1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1eb[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xba1e('0x0'));var Sequelize=require(_0xba1e('0x1'));module[_0xba1e('0x2')]={'uniqueid':{'type':Sequelize[_0xba1e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xba1e('0x4')](_0xba1e('0x5'),_0xba1e('0x6'),'queue'),'allowNull':![],'defaultValue':_0xba1e('0x7')},'transferredAt':{'type':Sequelize[_0xba1e('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xba1e('0x9')]}}; \ No newline at end of file +var _0xfb96=['queue','DATE','NOW','moment','sequelize','exports','account'];(function(_0x5e6487,_0x2718b8){var _0x70c092=function(_0x16300f){while(--_0x16300f){_0x5e6487['push'](_0x5e6487['shift']());}};_0x70c092(++_0x2718b8);}(_0xfb96,0x11b));var _0x6fb9=function(_0x617e16,_0x48969e){_0x617e16=_0x617e16-0x0;var _0x360a63=_0xfb96[_0x617e16];return _0x360a63;};'use strict';var moment=require(_0x6fb9('0x0'));var Sequelize=require(_0x6fb9('0x1'));module[_0x6fb9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6fb9('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x6fb9('0x4')},'transferredAt':{'type':Sequelize[_0x6fb9('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x6fb9('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e69e50a..73cc1d1 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 _0xfc9e=['findAll','rows','catch','show','rawAttributes','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','send','index','type','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','filter','MailTransferReport','include'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc9e,0x94));var _0xefc9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xfc9e[_0x35e75a];return _0xb23c7f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xefc9('0x0'));var rimraf=require(_0xefc9('0x1'));var zipdir=require(_0xefc9('0x2'));var jsonpatch=require(_0xefc9('0x3'));var rp=require(_0xefc9('0x4'));var moment=require(_0xefc9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xefc9('0x6'));var sox=require('sox');var csv=require(_0xefc9('0x7'));var ejs=require(_0xefc9('0x8'));var fs=require('fs');var _=require(_0xefc9('0x9'));var squel=require('squel');var crypto=require(_0xefc9('0xa'));var jsforce=require(_0xefc9('0xb'));var deskjs=require(_0xefc9('0xc'));var toCsv=require(_0xefc9('0x7'));var querystring=require(_0xefc9('0xd'));var Papa=require(_0xefc9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xefc9('0xf'));var as=require(_0xefc9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xefc9('0x11'));var licenseUtil=require(_0xefc9('0x12'));var db=require(_0xefc9('0x13'))['db'];function respondWithStatusCode(_0x5d6da2,_0x295e1f){_0x295e1f=_0x295e1f||0xcc;return function(_0x16a830){if(_0x16a830){return _0x5d6da2[_0xefc9('0x14')](_0x295e1f);}return _0x5d6da2['status'](_0x295e1f)[_0xefc9('0x15')]();};}function respondWithResult(_0x40335e,_0x4f971b){_0x4f971b=_0x4f971b||0xc8;return function(_0x1edc6c){if(_0x1edc6c){return _0x40335e[_0xefc9('0x16')](_0x4f971b)[_0xefc9('0x17')](_0x1edc6c);}};}function respondWithFilteredResult(_0x25455d,_0x2f0c8c){return function(_0x2eeccd){if(_0x2eeccd){var _0x2b548f=_0x2eeccd[_0xefc9('0x18')],_0x4699c2=_0x2f0c8c['offset'],_0x20b09c=_0x2f0c8c[_0xefc9('0x19')]+_0x2f0c8c[_0xefc9('0x1a')],_0x1469ca;if(_0x20b09c>=_0x2b548f){_0x20b09c=_0x2b548f;_0x1469ca=0xc8;}else{_0x1469ca=0xce;}_0x25455d['status'](_0x1469ca);return _0x25455d[_0xefc9('0x1b')]('Content-Range',_0x4699c2+'-'+_0x20b09c+'/'+_0x2b548f)['json'](_0x2eeccd);}return null;};}function patchUpdates(_0x2a43cd){return function(_0x47d7d8){try{jsonpatch[_0xefc9('0x1c')](_0x47d7d8,_0x2a43cd,!![]);}catch(_0x53a94c){return BPromise[_0xefc9('0x1d')](_0x53a94c);}return _0x47d7d8[_0xefc9('0x1e')]();};}function saveUpdates(_0x25345b,_0x1c9d61){return function(_0x53364b){if(_0x53364b){return _0x53364b[_0xefc9('0x1f')](_0x25345b)[_0xefc9('0x20')](function(_0xedb308){return _0xedb308;});}return null;};}function removeEntity(_0x158f98,_0x54f118){return function(_0x342d28){if(_0x342d28){return _0x342d28[_0xefc9('0x21')]()['then'](function(){_0x158f98['status'](0xcc)[_0xefc9('0x15')]();});}};}function handleEntityNotFound(_0x4f4065,_0xc2fbf1){return function(_0x463138){if(!_0x463138){_0x4f4065[_0xefc9('0x14')](0x194);}return _0x463138;};}function handleError(_0x17db4f,_0x12d4f7){_0x12d4f7=_0x12d4f7||0x1f4;return function(_0x301a69){logger['error'](_0x301a69[_0xefc9('0x22')]);if(_0x301a69['name']){delete _0x301a69['name'];}_0x17db4f[_0xefc9('0x16')](_0x12d4f7)[_0xefc9('0x23')](_0x301a69);};}exports[_0xefc9('0x24')]=function(_0x14d342,_0x7bc556){var _0x4ae607={},_0x230920={},_0x142d95={'count':0x0,'rows':[]};var _0x3dcc11=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x11799c){return{'name':_0x11799c['fieldName'],'type':_0x11799c[_0xefc9('0x25')]['key']};});_0x230920[_0xefc9('0x26')]=_[_0xefc9('0x27')](_0x3dcc11,_0xefc9('0x28'));_0x230920[_0xefc9('0x29')]=_[_0xefc9('0x2a')](_0x14d342['query']);_0x230920['filters']=_[_0xefc9('0x2b')](_0x230920[_0xefc9('0x26')],_0x230920[_0xefc9('0x29')]);_0x4ae607[_0xefc9('0x2c')]=_[_0xefc9('0x2b')](_0x230920['model'],qs[_0xefc9('0x2d')](_0x14d342[_0xefc9('0x29')]['fields']));_0x4ae607[_0xefc9('0x2c')]=_0x4ae607[_0xefc9('0x2c')]['length']?_0x4ae607[_0xefc9('0x2c')]:_0x230920[_0xefc9('0x26')];if(!_0x14d342[_0xefc9('0x29')][_0xefc9('0x2e')](_0xefc9('0x2f'))){_0x4ae607[_0xefc9('0x1a')]=qs[_0xefc9('0x1a')](_0x14d342[_0xefc9('0x29')][_0xefc9('0x1a')]);_0x4ae607[_0xefc9('0x19')]=qs[_0xefc9('0x19')](_0x14d342['query'][_0xefc9('0x19')]);}_0x4ae607['order']=qs['sort'](_0x14d342[_0xefc9('0x29')][_0xefc9('0x30')]);_0x4ae607['where']=qs['filters'](_['pick'](_0x14d342[_0xefc9('0x29')],_0x230920[_0xefc9('0x31')]),_0x3dcc11);if(_0x14d342[_0xefc9('0x29')]['filter']){_0x4ae607[_0xefc9('0x32')]=_[_0xefc9('0x33')](_0x4ae607[_0xefc9('0x32')],{'$or':_[_0xefc9('0x27')](_0x3dcc11,function(_0x4221dd){if(_0x4221dd[_0xefc9('0x25')]!==_0xefc9('0x34')){var _0x4d5328={};_0x4d5328[_0x4221dd[_0xefc9('0x28')]]={'$like':'%'+_0x14d342[_0xefc9('0x29')][_0xefc9('0x35')]+'%'};return _0x4d5328;}})});}_0x4ae607=_[_0xefc9('0x33')]({},_0x4ae607,_0x14d342['options']);var _0x460231={'where':_0x4ae607[_0xefc9('0x32')]};return db[_0xefc9('0x36')][_0xefc9('0x18')](_0x460231)['then'](function(_0x230b90){_0x142d95['count']=_0x230b90;if(_0x14d342[_0xefc9('0x29')]['includeAll']){_0x4ae607[_0xefc9('0x37')]=[{'all':!![]}];}return db[_0xefc9('0x36')][_0xefc9('0x38')](_0x4ae607);})[_0xefc9('0x20')](function(_0x90537){_0x142d95[_0xefc9('0x39')]=_0x90537;return _0x142d95;})[_0xefc9('0x20')](respondWithFilteredResult(_0x7bc556,_0x4ae607))[_0xefc9('0x3a')](handleError(_0x7bc556,null));};exports[_0xefc9('0x3b')]=function(_0x9f5960,_0x594938){var _0x20f501={'raw':!![],'where':{'id':_0x9f5960['params']['id']}},_0x147057={};_0x147057[_0xefc9('0x26')]=_['keys'](db['MailTransferReport'][_0xefc9('0x3c')]);_0x147057[_0xefc9('0x29')]=_[_0xefc9('0x2a')](_0x9f5960[_0xefc9('0x29')]);_0x147057[_0xefc9('0x31')]=_[_0xefc9('0x2b')](_0x147057[_0xefc9('0x26')],_0x147057[_0xefc9('0x29')]);_0x20f501[_0xefc9('0x2c')]=_['intersection'](_0x147057['model'],qs['fields'](_0x9f5960[_0xefc9('0x29')][_0xefc9('0x2d')]));_0x20f501[_0xefc9('0x2c')]=_0x20f501[_0xefc9('0x2c')][_0xefc9('0x3d')]?_0x20f501[_0xefc9('0x2c')]:_0x147057[_0xefc9('0x26')];if(_0x9f5960[_0xefc9('0x29')]['includeAll']){_0x20f501[_0xefc9('0x37')]=[{'all':!![]}];}_0x20f501=_['merge']({},_0x20f501,_0x9f5960[_0xefc9('0x3e')]);return db[_0xefc9('0x36')][_0xefc9('0x3f')](_0x20f501)[_0xefc9('0x20')](handleEntityNotFound(_0x594938,null))['then'](respondWithResult(_0x594938,null))['catch'](handleError(_0x594938,null));};exports[_0xefc9('0x40')]=function(_0x307477,_0x5bebf7){return db['MailTransferReport'][_0xefc9('0x40')](_0x307477[_0xefc9('0x41')],{})[_0xefc9('0x20')](respondWithResult(_0x5bebf7,0xc9))['catch'](handleError(_0x5bebf7,null));};exports[_0xefc9('0x1f')]=function(_0x25d485,_0x54629b){if(_0x25d485['body']['id']){delete _0x25d485[_0xefc9('0x41')]['id'];}return db['MailTransferReport'][_0xefc9('0x3f')]({'where':{'id':_0x25d485['params']['id']}})['then'](handleEntityNotFound(_0x54629b,null))['then'](saveUpdates(_0x25d485['body'],null))[_0xefc9('0x20')](respondWithResult(_0x54629b,null))['catch'](handleError(_0x54629b,null));};exports['destroy']=function(_0x32dc9b,_0x54d4f0){return db['MailTransferReport'][_0xefc9('0x3f')]({'where':{'id':_0x32dc9b[_0xefc9('0x42')]['id']}})[_0xefc9('0x20')](handleEntityNotFound(_0x54d4f0,null))['then'](removeEntity(_0x54d4f0,null))[_0xefc9('0x3a')](handleError(_0x54d4f0,null));};exports[_0xefc9('0x43')]=function(_0x45e587,_0x17cf30){return db[_0xefc9('0x36')][_0xefc9('0x43')]()['then'](respondWithResult(_0x17cf30,null))[_0xefc9('0x3a')](handleError(_0x17cf30,null));}; \ No newline at end of file +var _0x2fbb=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','MailTransferReport','fieldName','key','map','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','rawAttributes','model','includeAll','find','create','update','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x46dfd3,_0x4e6286){var _0x43200e=function(_0xf70a8c){while(--_0xf70a8c){_0x46dfd3['push'](_0x46dfd3['shift']());}};_0x43200e(++_0x4e6286);}(_0x2fbb,0x19d));var _0xb2fb=function(_0x2516cf,_0x4620e8){_0x2516cf=_0x2516cf-0x0;var _0x472832=_0x2fbb[_0x2516cf];return _0x472832;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb2fb('0x0'));var rp=require(_0xb2fb('0x1'));var moment=require(_0xb2fb('0x2'));var BPromise=require(_0xb2fb('0x3'));var Mustache=require(_0xb2fb('0x4'));var util=require(_0xb2fb('0x5'));var path=require(_0xb2fb('0x6'));var sox=require(_0xb2fb('0x7'));var csv=require(_0xb2fb('0x8'));var ejs=require(_0xb2fb('0x9'));var fs=require('fs');var _=require(_0xb2fb('0xa'));var squel=require(_0xb2fb('0xb'));var crypto=require('crypto');var jsforce=require(_0xb2fb('0xc'));var deskjs=require(_0xb2fb('0xd'));var toCsv=require(_0xb2fb('0x8'));var querystring=require('querystring');var Papa=require(_0xb2fb('0xe'));var Redis=require(_0xb2fb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb2fb('0x10'));var as=require(_0xb2fb('0x11'));var hardwareService=require(_0xb2fb('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb2fb('0x13'))['db'];function respondWithStatusCode(_0x150e92,_0x212bb3){_0x212bb3=_0x212bb3||0xcc;return function(_0x3ceeb8){if(_0x3ceeb8){return _0x150e92[_0xb2fb('0x14')](_0x212bb3);}return _0x150e92[_0xb2fb('0x15')](_0x212bb3)['end']();};}function respondWithResult(_0x49856e,_0x301c8d){_0x301c8d=_0x301c8d||0xc8;return function(_0x3b9251){if(_0x3b9251){return _0x49856e[_0xb2fb('0x15')](_0x301c8d)[_0xb2fb('0x16')](_0x3b9251);}};}function respondWithFilteredResult(_0x33d505,_0x280ea4){return function(_0x593f16){if(_0x593f16){var _0x56377f=_0x593f16[_0xb2fb('0x17')],_0x4705ad=_0x280ea4[_0xb2fb('0x18')],_0x2c1816=_0x280ea4[_0xb2fb('0x18')]+_0x280ea4['limit'],_0x1493f7;if(_0x2c1816>=_0x56377f){_0x2c1816=_0x56377f;_0x1493f7=0xc8;}else{_0x1493f7=0xce;}_0x33d505['status'](_0x1493f7);return _0x33d505[_0xb2fb('0x19')](_0xb2fb('0x1a'),_0x4705ad+'-'+_0x2c1816+'/'+_0x56377f)[_0xb2fb('0x16')](_0x593f16);}return null;};}function patchUpdates(_0x396c30){return function(_0x1c2caf){try{jsonpatch[_0xb2fb('0x1b')](_0x1c2caf,_0x396c30,!![]);}catch(_0x238b11){return BPromise[_0xb2fb('0x1c')](_0x238b11);}return _0x1c2caf[_0xb2fb('0x1d')]();};}function saveUpdates(_0xf65752,_0x32eddd){return function(_0x398c5d){if(_0x398c5d){return _0x398c5d['update'](_0xf65752)[_0xb2fb('0x1e')](function(_0x5967c7){return _0x5967c7;});}return null;};}function removeEntity(_0x2b8724,_0x4c3eb5){return function(_0x5422cb){if(_0x5422cb){return _0x5422cb[_0xb2fb('0x1f')]()['then'](function(){_0x2b8724[_0xb2fb('0x15')](0xcc)[_0xb2fb('0x20')]();});}};}function handleEntityNotFound(_0x3fbadd,_0x33565f){return function(_0x4a872e){if(!_0x4a872e){_0x3fbadd['sendStatus'](0x194);}return _0x4a872e;};}function handleError(_0x76cd61,_0x2e6fdf){_0x2e6fdf=_0x2e6fdf||0x1f4;return function(_0x3917cb){logger[_0xb2fb('0x21')](_0x3917cb[_0xb2fb('0x22')]);if(_0x3917cb[_0xb2fb('0x23')]){delete _0x3917cb[_0xb2fb('0x23')];}_0x76cd61[_0xb2fb('0x15')](_0x2e6fdf)[_0xb2fb('0x24')](_0x3917cb);};}exports['index']=function(_0x56ef7b,_0x167251){var _0x4e061f={},_0x4b31aa={},_0x37d290={'count':0x0,'rows':[]};var _0x502d0c=_['map'](db[_0xb2fb('0x25')]['rawAttributes'],function(_0x516202){return{'name':_0x516202[_0xb2fb('0x26')],'type':_0x516202['type'][_0xb2fb('0x27')]};});_0x4b31aa['model']=_[_0xb2fb('0x28')](_0x502d0c,'name');_0x4b31aa['query']=_[_0xb2fb('0x29')](_0x56ef7b[_0xb2fb('0x2a')]);_0x4b31aa[_0xb2fb('0x2b')]=_[_0xb2fb('0x2c')](_0x4b31aa['model'],_0x4b31aa['query']);_0x4e061f[_0xb2fb('0x2d')]=_[_0xb2fb('0x2c')](_0x4b31aa['model'],qs[_0xb2fb('0x2e')](_0x56ef7b[_0xb2fb('0x2a')][_0xb2fb('0x2e')]));_0x4e061f['attributes']=_0x4e061f['attributes'][_0xb2fb('0x2f')]?_0x4e061f['attributes']:_0x4b31aa['model'];if(!_0x56ef7b[_0xb2fb('0x2a')]['hasOwnProperty'](_0xb2fb('0x30'))){_0x4e061f[_0xb2fb('0x31')]=qs[_0xb2fb('0x31')](_0x56ef7b[_0xb2fb('0x2a')][_0xb2fb('0x31')]);_0x4e061f[_0xb2fb('0x18')]=qs[_0xb2fb('0x18')](_0x56ef7b[_0xb2fb('0x2a')][_0xb2fb('0x18')]);}_0x4e061f[_0xb2fb('0x32')]=qs[_0xb2fb('0x33')](_0x56ef7b[_0xb2fb('0x2a')][_0xb2fb('0x33')]);_0x4e061f[_0xb2fb('0x34')]=qs['filters'](_['pick'](_0x56ef7b[_0xb2fb('0x2a')],_0x4b31aa[_0xb2fb('0x2b')]),_0x502d0c);if(_0x56ef7b[_0xb2fb('0x2a')]['filter']){_0x4e061f[_0xb2fb('0x34')]=_[_0xb2fb('0x35')](_0x4e061f[_0xb2fb('0x34')],{'$or':_[_0xb2fb('0x28')](_0x502d0c,function(_0x502e9e){if(_0x502e9e[_0xb2fb('0x36')]!==_0xb2fb('0x37')){var _0xada4ad={};_0xada4ad[_0x502e9e[_0xb2fb('0x23')]]={'$like':'%'+_0x56ef7b[_0xb2fb('0x2a')][_0xb2fb('0x38')]+'%'};return _0xada4ad;}})});}_0x4e061f=_[_0xb2fb('0x35')]({},_0x4e061f,_0x56ef7b[_0xb2fb('0x39')]);var _0x32c74e={'where':_0x4e061f[_0xb2fb('0x34')]};return db[_0xb2fb('0x25')][_0xb2fb('0x17')](_0x32c74e)[_0xb2fb('0x1e')](function(_0x2bf41d){_0x37d290['count']=_0x2bf41d;if(_0x56ef7b['query']['includeAll']){_0x4e061f[_0xb2fb('0x3a')]=[{'all':!![]}];}return db[_0xb2fb('0x25')][_0xb2fb('0x3b')](_0x4e061f);})['then'](function(_0x3f6170){_0x37d290['rows']=_0x3f6170;return _0x37d290;})['then'](respondWithFilteredResult(_0x167251,_0x4e061f))[_0xb2fb('0x3c')](handleError(_0x167251,null));};exports[_0xb2fb('0x3d')]=function(_0xf6234e,_0x53f98f){var _0x2b961d={'raw':!![],'where':{'id':_0xf6234e[_0xb2fb('0x3e')]['id']}},_0x2958f1={};_0x2958f1['model']=_[_0xb2fb('0x29')](db[_0xb2fb('0x25')][_0xb2fb('0x3f')]);_0x2958f1[_0xb2fb('0x2a')]=_[_0xb2fb('0x29')](_0xf6234e[_0xb2fb('0x2a')]);_0x2958f1[_0xb2fb('0x2b')]=_[_0xb2fb('0x2c')](_0x2958f1[_0xb2fb('0x40')],_0x2958f1['query']);_0x2b961d[_0xb2fb('0x2d')]=_[_0xb2fb('0x2c')](_0x2958f1[_0xb2fb('0x40')],qs[_0xb2fb('0x2e')](_0xf6234e[_0xb2fb('0x2a')][_0xb2fb('0x2e')]));_0x2b961d[_0xb2fb('0x2d')]=_0x2b961d[_0xb2fb('0x2d')][_0xb2fb('0x2f')]?_0x2b961d[_0xb2fb('0x2d')]:_0x2958f1[_0xb2fb('0x40')];if(_0xf6234e['query'][_0xb2fb('0x41')]){_0x2b961d[_0xb2fb('0x3a')]=[{'all':!![]}];}_0x2b961d=_['merge']({},_0x2b961d,_0xf6234e[_0xb2fb('0x39')]);return db[_0xb2fb('0x25')][_0xb2fb('0x42')](_0x2b961d)[_0xb2fb('0x1e')](handleEntityNotFound(_0x53f98f,null))[_0xb2fb('0x1e')](respondWithResult(_0x53f98f,null))['catch'](handleError(_0x53f98f,null));};exports[_0xb2fb('0x43')]=function(_0x24d5c9,_0x358e4f){return db[_0xb2fb('0x25')][_0xb2fb('0x43')](_0x24d5c9['body'],{})[_0xb2fb('0x1e')](respondWithResult(_0x358e4f,0xc9))[_0xb2fb('0x3c')](handleError(_0x358e4f,null));};exports[_0xb2fb('0x44')]=function(_0x2bff91,_0x195bc6){if(_0x2bff91[_0xb2fb('0x45')]['id']){delete _0x2bff91[_0xb2fb('0x45')]['id'];}return db[_0xb2fb('0x25')]['find']({'where':{'id':_0x2bff91['params']['id']}})[_0xb2fb('0x1e')](handleEntityNotFound(_0x195bc6,null))[_0xb2fb('0x1e')](saveUpdates(_0x2bff91[_0xb2fb('0x45')],null))[_0xb2fb('0x1e')](respondWithResult(_0x195bc6,null))[_0xb2fb('0x3c')](handleError(_0x195bc6,null));};exports[_0xb2fb('0x1f')]=function(_0x36a6fc,_0x1fd1c7){return db['MailTransferReport'][_0xb2fb('0x42')]({'where':{'id':_0x36a6fc['params']['id']}})[_0xb2fb('0x1e')](handleEntityNotFound(_0x1fd1c7,null))['then'](removeEntity(_0x1fd1c7,null))[_0xb2fb('0x3c')](handleError(_0x1fd1c7,null));};exports['describe']=function(_0x110b67,_0x1231ca){return db[_0xb2fb('0x25')][_0xb2fb('0x46')]()[_0xb2fb('0x1e')](respondWithResult(_0x1231ca,null))[_0xb2fb('0x3c')](handleError(_0x1231ca,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5ea7703..70d3853 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 _0x94c9=['./mailTransferReport.attributes','exports','define','MailTransferReport','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x57c08b,_0x50e50e){var _0x852c9=function(_0x41b5b5){while(--_0x41b5b5){_0x57c08b['push'](_0x57c08b['shift']());}};_0x852c9(++_0x50e50e);}(_0x94c9,0x13a));var _0x994c=function(_0x3a14ac,_0x55403f){_0x3a14ac=_0x3a14ac-0x0;var _0x5e3bc3=_0x94c9[_0x3a14ac];return _0x5e3bc3;};'use strict';var _=require(_0x994c('0x0'));var util=require(_0x994c('0x1'));var logger=require(_0x994c('0x2'))(_0x994c('0x3'));var moment=require(_0x994c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x994c('0x5'));var config=require('../../config/environment');var attributes=require(_0x994c('0x6'));module[_0x994c('0x7')]=function(_0x5bf970,_0xc73b5f){return _0x5bf970[_0x994c('0x8')](_0x994c('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2467=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x3e082e,_0x5b498b){var _0x2cfbe0=function(_0x4626dd){while(--_0x4626dd){_0x3e082e['push'](_0x3e082e['shift']());}};_0x2cfbe0(++_0x5b498b);}(_0x2467,0x1e4));var _0x7246=function(_0xe3a257,_0x367ad3){_0xe3a257=_0xe3a257-0x0;var _0x5e9852=_0x2467[_0xe3a257];return _0x5e9852;};'use strict';var _=require(_0x7246('0x0'));var util=require(_0x7246('0x1'));var logger=require(_0x7246('0x2'))(_0x7246('0x3'));var moment=require('moment');var BPromise=require(_0x7246('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7246('0x5'));var rimraf=require(_0x7246('0x6'));var config=require(_0x7246('0x7'));var attributes=require(_0x7246('0x8'));module[_0x7246('0x9')]=function(_0x4252b3,_0x14aa90){return _0x4252b3[_0x7246('0xa')](_0x7246('0xb'),attributes,{'tableName':_0x7246('0xc'),'paranoid':![],'indexes':[{'name':_0x7246('0xd'),'fields':[_0x7246('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 2be8714..59ab9de 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 _0x9b7c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring'];(function(_0x59316e,_0x2bca8d){var _0x29028a=function(_0xd886b0){while(--_0xd886b0){_0x59316e['push'](_0x59316e['shift']());}};_0x29028a(++_0x2bca8d);}(_0x9b7c,0x1bf));var _0xc9b7=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x9b7c[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0xc9b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc9b7('0x1'));var rs=require(_0xc9b7('0x2'));var fs=require('fs');var Redis=require(_0xc9b7('0x3'));var db=require(_0xc9b7('0x4'))['db'];var utils=require(_0xc9b7('0x5'));var logger=require(_0xc9b7('0x6'))(_0xc9b7('0x7'));var config=require(_0xc9b7('0x8'));var jayson=require(_0xc9b7('0x9'));var client=jayson[_0xc9b7('0xa')][_0xc9b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51ecb2,_0x209c10,_0x57ae56){return new BPromise(function(_0x225c45,_0x34c1d6){return client[_0xc9b7('0xc')](_0x51ecb2,_0x57ae56)[_0xc9b7('0xd')](function(_0x123d5c){logger[_0xc9b7('0xe')](_0xc9b7('0xf'),_0x209c10,_0xc9b7('0x10'));logger[_0xc9b7('0x11')](_0xc9b7('0x12'),_0x209c10,_0xc9b7('0x10'),JSON[_0xc9b7('0x13')](_0x123d5c));if(_0x123d5c[_0xc9b7('0x14')]){if(_0x123d5c[_0xc9b7('0x14')][_0xc9b7('0x15')]===0x1f4){logger[_0xc9b7('0x14')](_0xc9b7('0xf'),_0x209c10,_0x123d5c[_0xc9b7('0x14')][_0xc9b7('0x16')]);return _0x34c1d6(_0x123d5c[_0xc9b7('0x14')]['message']);}logger[_0xc9b7('0x14')](_0xc9b7('0xf'),_0x209c10,_0x123d5c['error'][_0xc9b7('0x16')]);return _0x225c45(_0x123d5c['error'][_0xc9b7('0x16')]);}else{logger[_0xc9b7('0xe')](_0xc9b7('0xf'),_0x209c10,_0xc9b7('0x10'));_0x225c45(_0x123d5c[_0xc9b7('0x17')][_0xc9b7('0x16')]);}})[_0xc9b7('0x18')](function(_0x332921){logger[_0xc9b7('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x209c10,_0x332921);_0x34c1d6(_0x332921);});});} \ No newline at end of file +var _0x9370=['MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x52a22c,_0x5d209a){var _0x1565de=function(_0x53d114){while(--_0x53d114){_0x52a22c['push'](_0x52a22c['shift']());}};_0x1565de(++_0x5d209a);}(_0x9370,0x126));var _0x0937=function(_0x2439f3,_0x394b45){_0x2439f3=_0x2439f3-0x0;var _0x3948a1=_0x9370[_0x2439f3];return _0x3948a1;};'use strict';var _=require(_0x0937('0x0'));var util=require(_0x0937('0x1'));var moment=require(_0x0937('0x2'));var BPromise=require(_0x0937('0x3'));var rs=require(_0x0937('0x4'));var fs=require('fs');var Redis=require(_0x0937('0x5'));var db=require(_0x0937('0x6'))['db'];var utils=require(_0x0937('0x7'));var logger=require(_0x0937('0x8'))(_0x0937('0x9'));var config=require(_0x0937('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0937('0xb')][_0x0937('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x520160,_0x3e0807,_0x3d52a1){return new BPromise(function(_0x5ce73d,_0x2a04aa){return client[_0x0937('0xd')](_0x520160,_0x3d52a1)[_0x0937('0xe')](function(_0x3f2ff9){logger[_0x0937('0xf')](_0x0937('0x10'),_0x3e0807,_0x0937('0x11'));logger['debug'](_0x0937('0x12'),_0x3e0807,_0x0937('0x11'),JSON['stringify'](_0x3f2ff9));if(_0x3f2ff9[_0x0937('0x13')]){if(_0x3f2ff9[_0x0937('0x13')][_0x0937('0x14')]===0x1f4){logger[_0x0937('0x13')](_0x0937('0x10'),_0x3e0807,_0x3f2ff9[_0x0937('0x13')][_0x0937('0x15')]);return _0x2a04aa(_0x3f2ff9[_0x0937('0x13')][_0x0937('0x15')]);}logger[_0x0937('0x13')](_0x0937('0x10'),_0x3e0807,_0x3f2ff9[_0x0937('0x13')][_0x0937('0x15')]);return _0x5ce73d(_0x3f2ff9['error'][_0x0937('0x15')]);}else{logger[_0x0937('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3e0807,_0x0937('0x11'));_0x5ce73d(_0x3f2ff9[_0x0937('0x16')]['message']);}})[_0x0937('0x17')](function(_0x38a144){logger[_0x0937('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x3e0807,_0x38a144);_0x2a04aa(_0x38a144);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dea593f..e75033c 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 _0x7076=['./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','/:id','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7076,0x93));var _0x6707=function(_0x5db88a,_0x3bf8a0){_0x5db88a=_0x5db88a-0x0;var _0x38e1f8=_0x7076[_0x5db88a];return _0x38e1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6707('0x0'));var timeout=require(_0x6707('0x1'));var express=require('express');var router=express[_0x6707('0x2')]();var auth=require(_0x6707('0x3'));var interaction=require(_0x6707('0x4'));var config=require('../../config/environment');var controller=require(_0x6707('0x5'));router[_0x6707('0x6')]('/',auth[_0x6707('0x7')](),controller[_0x6707('0x8')]);router['get'](_0x6707('0x9'),auth[_0x6707('0x7')](),controller[_0x6707('0xa')]);router[_0x6707('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6707('0xb')]);router[_0x6707('0xc')]('/',auth['isAuthenticated'](),controller[_0x6707('0xd')]);router['put']('/:id',auth[_0x6707('0x7')](),controller[_0x6707('0xe')]);router[_0x6707('0xf')](_0x6707('0x10'),auth[_0x6707('0x7')](),controller[_0x6707('0x11')]);module[_0x6707('0x12')]=router; \ No newline at end of file +var _0x7683=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated'];(function(_0x18e0bf,_0x2b3088){var _0x13c438=function(_0x377a84){while(--_0x377a84){_0x18e0bf['push'](_0x18e0bf['shift']());}};_0x13c438(++_0x2b3088);}(_0x7683,0x1be));var _0x3768=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x7683[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x3768('0x0'));var util=require(_0x3768('0x1'));var path=require(_0x3768('0x2'));var timeout=require(_0x3768('0x3'));var express=require(_0x3768('0x4'));var router=express[_0x3768('0x5')]();var auth=require(_0x3768('0x6'));var interaction=require(_0x3768('0x7'));var config=require(_0x3768('0x8'));var controller=require(_0x3768('0x9'));router[_0x3768('0xa')]('/',auth['isAuthenticated'](),controller[_0x3768('0xb')]);router[_0x3768('0xa')](_0x3768('0xc'),auth[_0x3768('0xd')](),controller[_0x3768('0xe')]);router['get'](_0x3768('0xf'),auth['isAuthenticated'](),controller[_0x3768('0x10')]);router['post']('/',auth[_0x3768('0xd')](),controller[_0x3768('0x11')]);router[_0x3768('0x12')](_0x3768('0xf'),auth[_0x3768('0xd')](),controller[_0x3768('0x13')]);router[_0x3768('0x14')](_0x3768('0xf'),auth[_0x3768('0xd')](),controller[_0x3768('0x15')]);module[_0x3768('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8030703..33d3db5 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 _0x5359=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize','exports'];(function(_0x461c9e,_0x9a67cd){var _0x144e35=function(_0x17d055){while(--_0x17d055){_0x461c9e['push'](_0x461c9e['shift']());}};_0x144e35(++_0x9a67cd);}(_0x5359,0x193));var _0x9535=function(_0x13d549,_0x1d4821){_0x13d549=_0x13d549-0x0;var _0x17e51a=_0x5359[_0x13d549];return _0x17e51a;};'use strict';var Sequelize=require(_0x9535('0x0'));var moment=require('moment');module[_0x9535('0x1')]={'channel':{'type':Sequelize[_0x9535('0x2')]},'membername':{'type':Sequelize[_0x9535('0x2')]},'interface':{'type':Sequelize[_0x9535('0x2')]},'type':{'type':Sequelize[_0x9535('0x2')],'defaultValue':_0x9535('0x3'),'comment':_0x9535('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9535('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x7593b9){var _0xe95d72=moment(_0x7593b9);var _0x5ef06a=moment(this['getDataValue'](_0x9535('0x6')));var _0x396a26=_0xe95d72['diff'](_0x5ef06a,_0x9535('0x7'));this['setDataValue'](_0x9535('0x8'),_0x7593b9);this[_0x9535('0x9')]('duration',_0x396a26||null);}},'data1':{'type':Sequelize[_0x9535('0x2')],'comment':_0x9535('0xa')},'data2':{'type':Sequelize['STRING'],'comment':_0x9535('0xb')},'data3':{'type':Sequelize[_0x9535('0x2')],'comment':_0x9535('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0x9535('0xd')},'data5':{'type':Sequelize[_0x9535('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9535('0x2')]},'internal':{'type':Sequelize[_0x9535('0xe')]},'uniqueid':{'type':Sequelize[_0x9535('0x2')]}}; \ No newline at end of file +var _0x29bf=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','setDataValue'];(function(_0x22544d,_0x308db1){var _0x12355=function(_0x1ecdb6){while(--_0x1ecdb6){_0x22544d['push'](_0x22544d['shift']());}};_0x12355(++_0x308db1);}(_0x29bf,0xb9));var _0xf29b=function(_0x502542,_0x5c5b7a){_0x502542=_0x502542-0x0;var _0x17eab3=_0x29bf[_0x502542];return _0x17eab3;};'use strict';var Sequelize=require(_0xf29b('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xf29b('0x1')]},'membername':{'type':Sequelize[_0xf29b('0x1')]},'interface':{'type':Sequelize[_0xf29b('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xf29b('0x2')},'duration':{'type':Sequelize[_0xf29b('0x3')]},'enterAt':{'type':Sequelize[_0xf29b('0x4')]},'exitAt':{'type':Sequelize[_0xf29b('0x4')],'set':function(_0x2aa921){var _0x52d167=moment(_0x2aa921);var _0x42a47c=moment(this['getDataValue'](_0xf29b('0x5')));var _0x19fc65=_0x52d167['diff'](_0x42a47c,'seconds');this['setDataValue']('exitAt',_0x2aa921);this[_0xf29b('0x6')]('duration',_0x19fc65||null);}},'data1':{'type':Sequelize[_0xf29b('0x1')],'comment':_0xf29b('0x7')},'data2':{'type':Sequelize[_0xf29b('0x1')],'comment':_0xf29b('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xf29b('0x9')},'data4':{'type':Sequelize[_0xf29b('0x1')],'comment':_0xf29b('0xa')},'data5':{'type':Sequelize[_0xf29b('0x1')],'comment':_0xf29b('0xb')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf29b('0x3')]},'uniqueid':{'type':Sequelize[_0xf29b('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 247d053..7bd3da2 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 _0x11f7=['MemberReport','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','index','map'];(function(_0x321575,_0x458292){var _0x147fc3=function(_0x55d3a6){while(--_0x55d3a6){_0x321575['push'](_0x321575['shift']());}};_0x147fc3(++_0x458292);}(_0x11f7,0xf6));var _0x711f=function(_0x45c4c6,_0x1ebacc){_0x45c4c6=_0x45c4c6-0x0;var _0x194ba6=_0x11f7[_0x45c4c6];return _0x194ba6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x711f('0x0'));var rimraf=require(_0x711f('0x1'));var zipdir=require(_0x711f('0x2'));var jsonpatch=require(_0x711f('0x3'));var rp=require(_0x711f('0x4'));var moment=require(_0x711f('0x5'));var BPromise=require(_0x711f('0x6'));var Mustache=require(_0x711f('0x7'));var util=require('util');var path=require(_0x711f('0x8'));var sox=require(_0x711f('0x9'));var csv=require('to-csv');var ejs=require(_0x711f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x711f('0xb'));var crypto=require(_0x711f('0xc'));var jsforce=require(_0x711f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x711f('0xe'));var Papa=require(_0x711f('0xf'));var Redis=require(_0x711f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x711f('0x11'));var hardwareService=require(_0x711f('0x12'));var logger=require(_0x711f('0x13'))(_0x711f('0x14'));var utils=require(_0x711f('0x15'));var config=require(_0x711f('0x16'));var licenseUtil=require(_0x711f('0x17'));var db=require(_0x711f('0x18'))['db'];function respondWithStatusCode(_0x1ff34c,_0x2c5279){_0x2c5279=_0x2c5279||0xcc;return function(_0x761a8b){if(_0x761a8b){return _0x1ff34c['sendStatus'](_0x2c5279);}return _0x1ff34c[_0x711f('0x19')](_0x2c5279)[_0x711f('0x1a')]();};}function respondWithResult(_0x3e0bb1,_0x1775c6){_0x1775c6=_0x1775c6||0xc8;return function(_0x564858){if(_0x564858){return _0x3e0bb1[_0x711f('0x19')](_0x1775c6)[_0x711f('0x1b')](_0x564858);}};}function respondWithFilteredResult(_0x389476,_0x21009d){return function(_0x332057){if(_0x332057){var _0xf3005a=_0x332057[_0x711f('0x1c')],_0x5e7718=_0x21009d[_0x711f('0x1d')],_0x2358d=_0x21009d[_0x711f('0x1d')]+_0x21009d['limit'],_0x909d12;if(_0x2358d>=_0xf3005a){_0x2358d=_0xf3005a;_0x909d12=0xc8;}else{_0x909d12=0xce;}_0x389476['status'](_0x909d12);return _0x389476[_0x711f('0x1e')](_0x711f('0x1f'),_0x5e7718+'-'+_0x2358d+'/'+_0xf3005a)['json'](_0x332057);}return null;};}function patchUpdates(_0x43c23b){return function(_0x507fc9){try{jsonpatch[_0x711f('0x20')](_0x507fc9,_0x43c23b,!![]);}catch(_0x5b9972){return BPromise['reject'](_0x5b9972);}return _0x507fc9['save']();};}function saveUpdates(_0x59e3ca,_0x583954){return function(_0x56d042){if(_0x56d042){return _0x56d042[_0x711f('0x21')](_0x59e3ca)[_0x711f('0x22')](function(_0x3eb504){return _0x3eb504;});}return null;};}function removeEntity(_0x1b257a,_0x46e28e){return function(_0x59e474){if(_0x59e474){return _0x59e474[_0x711f('0x23')]()['then'](function(){_0x1b257a[_0x711f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36eb22,_0x197920){return function(_0x93936b){if(!_0x93936b){_0x36eb22[_0x711f('0x24')](0x194);}return _0x93936b;};}function handleError(_0x33503e,_0x4362a7){_0x4362a7=_0x4362a7||0x1f4;return function(_0x1a52ae){logger[_0x711f('0x25')](_0x1a52ae['stack']);if(_0x1a52ae[_0x711f('0x26')]){delete _0x1a52ae[_0x711f('0x26')];}_0x33503e['status'](_0x4362a7)[_0x711f('0x27')](_0x1a52ae);};}exports[_0x711f('0x28')]=function(_0x2005a2,_0x4caac6){var _0x236165={},_0x50db7a={},_0x3ab2f3={'count':0x0,'rows':[]};var _0x5d3d2b=_[_0x711f('0x29')](db[_0x711f('0x2a')][_0x711f('0x2b')],function(_0x35e187){return{'name':_0x35e187[_0x711f('0x2c')],'type':_0x35e187[_0x711f('0x2d')]['key']};});_0x50db7a[_0x711f('0x2e')]=_[_0x711f('0x29')](_0x5d3d2b,_0x711f('0x26'));_0x50db7a[_0x711f('0x2f')]=_['keys'](_0x2005a2[_0x711f('0x2f')]);_0x50db7a[_0x711f('0x30')]=_['intersection'](_0x50db7a['model'],_0x50db7a[_0x711f('0x2f')]);_0x236165[_0x711f('0x31')]=_['intersection'](_0x50db7a['model'],qs[_0x711f('0x32')](_0x2005a2['query'][_0x711f('0x32')]));_0x236165[_0x711f('0x31')]=_0x236165[_0x711f('0x31')][_0x711f('0x33')]?_0x236165[_0x711f('0x31')]:_0x50db7a[_0x711f('0x2e')];if(!_0x2005a2['query'][_0x711f('0x34')](_0x711f('0x35'))){_0x236165[_0x711f('0x36')]=qs[_0x711f('0x36')](_0x2005a2['query'][_0x711f('0x36')]);_0x236165[_0x711f('0x1d')]=qs['offset'](_0x2005a2['query']['offset']);}_0x236165['order']=qs[_0x711f('0x37')](_0x2005a2[_0x711f('0x2f')]['sort']);_0x236165[_0x711f('0x38')]=qs['filters'](_[_0x711f('0x39')](_0x2005a2[_0x711f('0x2f')],_0x50db7a[_0x711f('0x30')]),_0x5d3d2b);if(_0x2005a2[_0x711f('0x2f')][_0x711f('0x3a')]){_0x236165[_0x711f('0x38')]=_[_0x711f('0x3b')](_0x236165[_0x711f('0x38')],{'$or':_['map'](_0x5d3d2b,function(_0x461e5c){if(_0x461e5c[_0x711f('0x2d')]!=='VIRTUAL'){var _0x28dbc9={};_0x28dbc9[_0x461e5c[_0x711f('0x26')]]={'$like':'%'+_0x2005a2[_0x711f('0x2f')][_0x711f('0x3a')]+'%'};return _0x28dbc9;}})});}_0x236165=_['merge']({},_0x236165,_0x2005a2[_0x711f('0x3c')]);var _0x34fbf9={'where':_0x236165[_0x711f('0x38')]};return db[_0x711f('0x2a')][_0x711f('0x1c')](_0x34fbf9)['then'](function(_0x1925aa){_0x3ab2f3[_0x711f('0x1c')]=_0x1925aa;if(_0x2005a2[_0x711f('0x2f')][_0x711f('0x3d')]){_0x236165[_0x711f('0x3e')]=[{'all':!![]}];}return db[_0x711f('0x2a')][_0x711f('0x3f')](_0x236165);})[_0x711f('0x22')](function(_0x1fd425){_0x3ab2f3[_0x711f('0x40')]=_0x1fd425;return _0x3ab2f3;})[_0x711f('0x22')](respondWithFilteredResult(_0x4caac6,_0x236165))[_0x711f('0x41')](handleError(_0x4caac6,null));};exports['show']=function(_0x481ccc,_0x1acb56){var _0x1ddadc={'raw':!![],'where':{'id':_0x481ccc[_0x711f('0x42')]['id']}},_0x480480={};_0x480480[_0x711f('0x2e')]=_[_0x711f('0x43')](db[_0x711f('0x2a')][_0x711f('0x2b')]);_0x480480['query']=_[_0x711f('0x43')](_0x481ccc[_0x711f('0x2f')]);_0x480480[_0x711f('0x30')]=_[_0x711f('0x44')](_0x480480[_0x711f('0x2e')],_0x480480[_0x711f('0x2f')]);_0x1ddadc[_0x711f('0x31')]=_[_0x711f('0x44')](_0x480480[_0x711f('0x2e')],qs[_0x711f('0x32')](_0x481ccc[_0x711f('0x2f')]['fields']));_0x1ddadc[_0x711f('0x31')]=_0x1ddadc[_0x711f('0x31')][_0x711f('0x33')]?_0x1ddadc[_0x711f('0x31')]:_0x480480[_0x711f('0x2e')];if(_0x481ccc[_0x711f('0x2f')][_0x711f('0x3d')]){_0x1ddadc['include']=[{'all':!![]}];}_0x1ddadc=_[_0x711f('0x3b')]({},_0x1ddadc,_0x481ccc['options']);return db[_0x711f('0x2a')][_0x711f('0x45')](_0x1ddadc)[_0x711f('0x22')](handleEntityNotFound(_0x1acb56,null))['then'](respondWithResult(_0x1acb56,null))[_0x711f('0x41')](handleError(_0x1acb56,null));};exports[_0x711f('0x46')]=function(_0x58f0e2,_0x3083c2){return db[_0x711f('0x2a')][_0x711f('0x46')](_0x58f0e2[_0x711f('0x47')],{})[_0x711f('0x22')](respondWithResult(_0x3083c2,0xc9))['catch'](handleError(_0x3083c2,null));};exports['update']=function(_0x5b9380,_0x1aab14){if(_0x5b9380['body']['id']){delete _0x5b9380[_0x711f('0x47')]['id'];}return db[_0x711f('0x2a')]['find']({'where':{'id':_0x5b9380[_0x711f('0x42')]['id']}})[_0x711f('0x22')](handleEntityNotFound(_0x1aab14,null))[_0x711f('0x22')](saveUpdates(_0x5b9380['body'],null))[_0x711f('0x22')](respondWithResult(_0x1aab14,null))[_0x711f('0x41')](handleError(_0x1aab14,null));};exports['destroy']=function(_0x10c304,_0x2a267c){return db[_0x711f('0x2a')][_0x711f('0x45')]({'where':{'id':_0x10c304['params']['id']}})[_0x711f('0x22')](handleEntityNotFound(_0x2a267c,null))[_0x711f('0x22')](removeEntity(_0x2a267c,null))[_0x711f('0x41')](handleError(_0x2a267c,null));};exports['describe']=function(_0x236962,_0x1581aa){return db['MemberReport']['describe']()[_0x711f('0x22')](respondWithResult(_0x1581aa,null))['catch'](handleError(_0x1581aa,null));}; \ No newline at end of file +var _0x6f7f=['json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','MemberReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','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','status'];(function(_0x4c3767,_0x1d3f07){var _0x1c083f=function(_0x5afbae){while(--_0x5afbae){_0x4c3767['push'](_0x4c3767['shift']());}};_0x1c083f(++_0x1d3f07);}(_0x6f7f,0x11c));var _0xf6f7=function(_0x2b1931,_0x5c6757){_0x2b1931=_0x2b1931-0x0;var _0x583eed=_0x6f7f[_0x2b1931];return _0x583eed;};'use strict';var pdf=require(_0xf6f7('0x0'));var emlformat=require(_0xf6f7('0x1'));var rimraf=require(_0xf6f7('0x2'));var zipdir=require(_0xf6f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6f7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf6f7('0x5'));var util=require(_0xf6f7('0x6'));var path=require(_0xf6f7('0x7'));var sox=require('sox');var csv=require(_0xf6f7('0x8'));var ejs=require(_0xf6f7('0x9'));var fs=require('fs');var _=require(_0xf6f7('0xa'));var squel=require(_0xf6f7('0xb'));var crypto=require(_0xf6f7('0xc'));var jsforce=require(_0xf6f7('0xd'));var deskjs=require(_0xf6f7('0xe'));var toCsv=require(_0xf6f7('0x8'));var querystring=require(_0xf6f7('0xf'));var Papa=require(_0xf6f7('0x10'));var Redis=require(_0xf6f7('0x11'));var authService=require(_0xf6f7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6f7('0x13'));var logger=require(_0xf6f7('0x14'))(_0xf6f7('0x15'));var utils=require(_0xf6f7('0x16'));var config=require(_0xf6f7('0x17'));var licenseUtil=require(_0xf6f7('0x18'));var db=require(_0xf6f7('0x19'))['db'];function respondWithStatusCode(_0x9bb616,_0xf1012b){_0xf1012b=_0xf1012b||0xcc;return function(_0x525963){if(_0x525963){return _0x9bb616[_0xf6f7('0x1a')](_0xf1012b);}return _0x9bb616['status'](_0xf1012b)['end']();};}function respondWithResult(_0x36a008,_0x1dbde8){_0x1dbde8=_0x1dbde8||0xc8;return function(_0x50eaeb){if(_0x50eaeb){return _0x36a008[_0xf6f7('0x1b')](_0x1dbde8)[_0xf6f7('0x1c')](_0x50eaeb);}};}function respondWithFilteredResult(_0x35bbe6,_0x4b3632){return function(_0x3597a0){if(_0x3597a0){var _0x456375=_0x3597a0[_0xf6f7('0x1d')],_0x5b8906=_0x4b3632['offset'],_0x286b74=_0x4b3632[_0xf6f7('0x1e')]+_0x4b3632['limit'],_0x3dd79a;if(_0x286b74>=_0x456375){_0x286b74=_0x456375;_0x3dd79a=0xc8;}else{_0x3dd79a=0xce;}_0x35bbe6[_0xf6f7('0x1b')](_0x3dd79a);return _0x35bbe6[_0xf6f7('0x1f')](_0xf6f7('0x20'),_0x5b8906+'-'+_0x286b74+'/'+_0x456375)[_0xf6f7('0x1c')](_0x3597a0);}return null;};}function patchUpdates(_0x32dacd){return function(_0x5dacdd){try{jsonpatch[_0xf6f7('0x21')](_0x5dacdd,_0x32dacd,!![]);}catch(_0x873adb){return BPromise[_0xf6f7('0x22')](_0x873adb);}return _0x5dacdd['save']();};}function saveUpdates(_0x6255d9,_0x51adb3){return function(_0x44b34c){if(_0x44b34c){return _0x44b34c[_0xf6f7('0x23')](_0x6255d9)[_0xf6f7('0x24')](function(_0x4701d5){return _0x4701d5;});}return null;};}function removeEntity(_0xbf7735,_0x368036){return function(_0x466504){if(_0x466504){return _0x466504[_0xf6f7('0x25')]()['then'](function(){_0xbf7735[_0xf6f7('0x1b')](0xcc)[_0xf6f7('0x26')]();});}};}function handleEntityNotFound(_0x316ef4,_0x47dba7){return function(_0x3ab0e3){if(!_0x3ab0e3){_0x316ef4[_0xf6f7('0x1a')](0x194);}return _0x3ab0e3;};}function handleError(_0x5ab3c9,_0x1b7c4c){_0x1b7c4c=_0x1b7c4c||0x1f4;return function(_0x29157a){logger[_0xf6f7('0x27')](_0x29157a[_0xf6f7('0x28')]);if(_0x29157a[_0xf6f7('0x29')]){delete _0x29157a[_0xf6f7('0x29')];}_0x5ab3c9['status'](_0x1b7c4c)[_0xf6f7('0x2a')](_0x29157a);};}exports[_0xf6f7('0x2b')]=function(_0x35ab02,_0x2b5f27){var _0x22adc2={},_0x1275dc={},_0x3d9dec={'count':0x0,'rows':[]};var _0x210f6d=_['map'](db[_0xf6f7('0x2c')][_0xf6f7('0x2d')],function(_0x4ba369){return{'name':_0x4ba369[_0xf6f7('0x2e')],'type':_0x4ba369[_0xf6f7('0x2f')][_0xf6f7('0x30')]};});_0x1275dc[_0xf6f7('0x31')]=_[_0xf6f7('0x32')](_0x210f6d,_0xf6f7('0x29'));_0x1275dc[_0xf6f7('0x33')]=_['keys'](_0x35ab02[_0xf6f7('0x33')]);_0x1275dc[_0xf6f7('0x34')]=_[_0xf6f7('0x35')](_0x1275dc[_0xf6f7('0x31')],_0x1275dc[_0xf6f7('0x33')]);_0x22adc2[_0xf6f7('0x36')]=_[_0xf6f7('0x35')](_0x1275dc[_0xf6f7('0x31')],qs[_0xf6f7('0x37')](_0x35ab02[_0xf6f7('0x33')][_0xf6f7('0x37')]));_0x22adc2[_0xf6f7('0x36')]=_0x22adc2['attributes']['length']?_0x22adc2['attributes']:_0x1275dc[_0xf6f7('0x31')];if(!_0x35ab02[_0xf6f7('0x33')][_0xf6f7('0x38')](_0xf6f7('0x39'))){_0x22adc2['limit']=qs[_0xf6f7('0x3a')](_0x35ab02[_0xf6f7('0x33')][_0xf6f7('0x3a')]);_0x22adc2[_0xf6f7('0x1e')]=qs[_0xf6f7('0x1e')](_0x35ab02[_0xf6f7('0x33')]['offset']);}_0x22adc2[_0xf6f7('0x3b')]=qs[_0xf6f7('0x3c')](_0x35ab02[_0xf6f7('0x33')][_0xf6f7('0x3c')]);_0x22adc2['where']=qs[_0xf6f7('0x34')](_['pick'](_0x35ab02[_0xf6f7('0x33')],_0x1275dc[_0xf6f7('0x34')]),_0x210f6d);if(_0x35ab02[_0xf6f7('0x33')][_0xf6f7('0x3d')]){_0x22adc2[_0xf6f7('0x3e')]=_[_0xf6f7('0x3f')](_0x22adc2['where'],{'$or':_[_0xf6f7('0x32')](_0x210f6d,function(_0x34c9c0){if(_0x34c9c0['type']!=='VIRTUAL'){var _0x23ccb8={};_0x23ccb8[_0x34c9c0[_0xf6f7('0x29')]]={'$like':'%'+_0x35ab02[_0xf6f7('0x33')]['filter']+'%'};return _0x23ccb8;}})});}_0x22adc2=_[_0xf6f7('0x3f')]({},_0x22adc2,_0x35ab02[_0xf6f7('0x40')]);var _0x397fe0={'where':_0x22adc2[_0xf6f7('0x3e')]};return db[_0xf6f7('0x2c')][_0xf6f7('0x1d')](_0x397fe0)['then'](function(_0x5a5c2d){_0x3d9dec[_0xf6f7('0x1d')]=_0x5a5c2d;if(_0x35ab02[_0xf6f7('0x33')][_0xf6f7('0x41')]){_0x22adc2[_0xf6f7('0x42')]=[{'all':!![]}];}return db[_0xf6f7('0x2c')][_0xf6f7('0x43')](_0x22adc2);})[_0xf6f7('0x24')](function(_0x56bf01){_0x3d9dec[_0xf6f7('0x44')]=_0x56bf01;return _0x3d9dec;})[_0xf6f7('0x24')](respondWithFilteredResult(_0x2b5f27,_0x22adc2))[_0xf6f7('0x45')](handleError(_0x2b5f27,null));};exports[_0xf6f7('0x46')]=function(_0x44503e,_0x1ac063){var _0x285a76={'raw':!![],'where':{'id':_0x44503e[_0xf6f7('0x47')]['id']}},_0x4cb873={};_0x4cb873['model']=_['keys'](db[_0xf6f7('0x2c')][_0xf6f7('0x2d')]);_0x4cb873[_0xf6f7('0x33')]=_[_0xf6f7('0x48')](_0x44503e[_0xf6f7('0x33')]);_0x4cb873['filters']=_['intersection'](_0x4cb873[_0xf6f7('0x31')],_0x4cb873['query']);_0x285a76['attributes']=_[_0xf6f7('0x35')](_0x4cb873[_0xf6f7('0x31')],qs[_0xf6f7('0x37')](_0x44503e[_0xf6f7('0x33')][_0xf6f7('0x37')]));_0x285a76[_0xf6f7('0x36')]=_0x285a76['attributes'][_0xf6f7('0x49')]?_0x285a76[_0xf6f7('0x36')]:_0x4cb873[_0xf6f7('0x31')];if(_0x44503e['query']['includeAll']){_0x285a76[_0xf6f7('0x42')]=[{'all':!![]}];}_0x285a76=_[_0xf6f7('0x3f')]({},_0x285a76,_0x44503e[_0xf6f7('0x40')]);return db[_0xf6f7('0x2c')][_0xf6f7('0x4a')](_0x285a76)[_0xf6f7('0x24')](handleEntityNotFound(_0x1ac063,null))[_0xf6f7('0x24')](respondWithResult(_0x1ac063,null))[_0xf6f7('0x45')](handleError(_0x1ac063,null));};exports[_0xf6f7('0x4b')]=function(_0x595d4f,_0x50f366){return db[_0xf6f7('0x2c')][_0xf6f7('0x4b')](_0x595d4f[_0xf6f7('0x4c')],{})[_0xf6f7('0x24')](respondWithResult(_0x50f366,0xc9))['catch'](handleError(_0x50f366,null));};exports['update']=function(_0x598a78,_0xb81f8c){if(_0x598a78[_0xf6f7('0x4c')]['id']){delete _0x598a78['body']['id'];}return db[_0xf6f7('0x2c')][_0xf6f7('0x4a')]({'where':{'id':_0x598a78[_0xf6f7('0x47')]['id']}})[_0xf6f7('0x24')](handleEntityNotFound(_0xb81f8c,null))[_0xf6f7('0x24')](saveUpdates(_0x598a78[_0xf6f7('0x4c')],null))[_0xf6f7('0x24')](respondWithResult(_0xb81f8c,null))[_0xf6f7('0x45')](handleError(_0xb81f8c,null));};exports['destroy']=function(_0x4cd178,_0xfc0fd3){return db[_0xf6f7('0x2c')][_0xf6f7('0x4a')]({'where':{'id':_0x4cd178['params']['id']}})[_0xf6f7('0x24')](handleEntityNotFound(_0xfc0fd3,null))[_0xf6f7('0x24')](removeEntity(_0xfc0fd3,null))[_0xf6f7('0x45')](handleError(_0xfc0fd3,null));};exports[_0xf6f7('0x4d')]=function(_0x54c7d3,_0x5193c3){return db[_0xf6f7('0x2c')]['describe']()['then'](respondWithResult(_0x5193c3,null))[_0xf6f7('0x45')](handleError(_0x5193c3,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 460e818..648bf8b 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 _0xdbab=['MemberReport','membername_interface','membername','interface','util','moment','request-promise','path','../../config/environment','exports','define'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0xdbab,0x185));var _0xbdba=function(_0x1c115b,_0x59d8a5){_0x1c115b=_0x1c115b-0x0;var _0x234a18=_0xdbab[_0x1c115b];return _0x234a18;};'use strict';var _=require('lodash');var util=require(_0xbdba('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbdba('0x1'));var BPromise=require('bluebird');var rp=require(_0xbdba('0x2'));var fs=require('fs');var path=require(_0xbdba('0x3'));var rimraf=require('rimraf');var config=require(_0xbdba('0x4'));var attributes=require('./memberReport.attributes');module[_0xbdba('0x5')]=function(_0x3370d5,_0x557fe4){return _0x3370d5[_0xbdba('0x6')](_0xbdba('0x7'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xbdba('0x8'),'fields':[_0xbdba('0x9'),_0xbdba('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31ae=['interface','lodash','util','api','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0xe83bce,_0x2a53a6){var _0xe2b3eb=function(_0x166a7d){while(--_0x166a7d){_0xe83bce['push'](_0xe83bce['shift']());}};_0xe2b3eb(++_0x2a53a6);}(_0x31ae,0x17a));var _0xe31a=function(_0x1c4f4a,_0x1b254c){_0x1c4f4a=_0x1c4f4a-0x0;var _0x1e6a1b=_0x31ae[_0x1c4f4a];return _0x1e6a1b;};'use strict';var _=require(_0xe31a('0x0'));var util=require(_0xe31a('0x1'));var logger=require('../../config/logger')(_0xe31a('0x2'));var moment=require('moment');var BPromise=require(_0xe31a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe31a('0x4'));var config=require(_0xe31a('0x5'));var attributes=require(_0xe31a('0x6'));module[_0xe31a('0x7')]=function(_0xb858f1,_0x5a625a){return _0xb858f1[_0xe31a('0x8')](_0xe31a('0x9'),attributes,{'tableName':_0xe31a('0xa'),'paranoid':![],'indexes':[{'name':_0xe31a('0xb'),'fields':['membername',_0xe31a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0cbdd39..ad348f0 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 _0xa69c=['http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MemberReport','findAll','options','raw','attributes','include','model','map','GetMemberReport','CreateMemberReport','create','UpdateMemberReport','update','body','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3380ba,_0x10446f){var _0x565dc2=function(_0x23ac94){while(--_0x23ac94){_0x3380ba['push'](_0x3380ba['shift']());}};_0x565dc2(++_0x10446f);}(_0xa69c,0x18e));var _0xca69=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xa69c[_0x151381];return _0x2afab6;};'use strict';var _=require(_0xca69('0x0'));var util=require(_0xca69('0x1'));var moment=require(_0xca69('0x2'));var BPromise=require('bluebird');var rs=require(_0xca69('0x3'));var fs=require('fs');var Redis=require(_0xca69('0x4'));var db=require(_0xca69('0x5'))['db'];var utils=require(_0xca69('0x6'));var logger=require(_0xca69('0x7'))(_0xca69('0x8'));var config=require(_0xca69('0x9'));var jayson=require(_0xca69('0xa'));var client=jayson[_0xca69('0xb')][_0xca69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47e7fe,_0x595faa,_0x255e46){return new BPromise(function(_0x3a8218,_0x26c915){return client[_0xca69('0xd')](_0x47e7fe,_0x255e46)[_0xca69('0xe')](function(_0x32670d){logger['info'](_0xca69('0xf'),_0x595faa,_0xca69('0x10'));logger[_0xca69('0x11')](_0xca69('0x12'),_0x595faa,_0xca69('0x10'),JSON[_0xca69('0x13')](_0x32670d));if(_0x32670d[_0xca69('0x14')]){if(_0x32670d[_0xca69('0x14')][_0xca69('0x15')]===0x1f4){logger[_0xca69('0x14')](_0xca69('0xf'),_0x595faa,_0x32670d[_0xca69('0x14')]['message']);return _0x26c915(_0x32670d[_0xca69('0x14')][_0xca69('0x16')]);}logger[_0xca69('0x14')]('MemberReport,\x20%s,\x20%s',_0x595faa,_0x32670d['error'][_0xca69('0x16')]);return _0x3a8218(_0x32670d[_0xca69('0x14')]['message']);}else{logger[_0xca69('0x17')](_0xca69('0xf'),_0x595faa,_0xca69('0x10'));_0x3a8218(_0x32670d[_0xca69('0x18')][_0xca69('0x16')]);}})[_0xca69('0x19')](function(_0x29ba6d){logger[_0xca69('0x14')]('MemberReport,\x20%s,\x20%s',_0x595faa,_0x29ba6d);_0x26c915(_0x29ba6d);});});}exports['GetMemberReport']=function(_0x2489d6){var _0x204471=this;return new Promise(function(_0x59ba5a,_0xa4d901){return db[_0xca69('0x1a')][_0xca69('0x1b')]({'raw':_0x2489d6[_0xca69('0x1c')]?_0x2489d6[_0xca69('0x1c')][_0xca69('0x1d')]===undefined?!![]:![]:!![],'where':_0x2489d6[_0xca69('0x1c')]?_0x2489d6[_0xca69('0x1c')]['where']||null:null,'attributes':_0x2489d6['options']?_0x2489d6[_0xca69('0x1c')][_0xca69('0x1e')]||null:null,'limit':_0x2489d6[_0xca69('0x1c')]?_0x2489d6['options']['limit']||null:null,'include':_0x2489d6[_0xca69('0x1c')]?_0x2489d6[_0xca69('0x1c')][_0xca69('0x1f')]?_['map'](_0x2489d6['options'][_0xca69('0x1f')],function(_0x398463){return{'model':db[_0x398463[_0xca69('0x20')]],'as':_0x398463['as'],'attributes':_0x398463['attributes'],'include':_0x398463[_0xca69('0x1f')]?_[_0xca69('0x21')](_0x398463['include'],function(_0x4968b5){return{'model':db[_0x4968b5[_0xca69('0x20')]],'as':_0x4968b5['as'],'attributes':_0x4968b5[_0xca69('0x1e')],'include':_0x4968b5['include']?_[_0xca69('0x21')](_0x4968b5['include'],function(_0x138be0){return{'model':db[_0x138be0['model']],'as':_0x138be0['as'],'attributes':_0x138be0[_0xca69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xca69('0xe')](function(_0x3f6df2){logger[_0xca69('0x17')]('GetMemberReport',_0x2489d6);logger[_0xca69('0x11')](_0xca69('0x22'),_0x2489d6,JSON[_0xca69('0x13')](_0x3f6df2));_0x59ba5a(_0x3f6df2);})[_0xca69('0x19')](function(_0x351916){logger[_0xca69('0x14')]('GetMemberReport',_0x351916['message'],_0x2489d6);_0xa4d901(_0x204471[_0xca69('0x14')](0x1f4,_0x351916[_0xca69('0x16')]));});});};exports[_0xca69('0x23')]=function(_0x51e3ce){var _0x36061f=this;return new Promise(function(_0x50493c,_0x59d7a8){return db[_0xca69('0x1a')][_0xca69('0x24')](_0x51e3ce['body'],{'raw':_0x51e3ce[_0xca69('0x1c')]?_0x51e3ce[_0xca69('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xca69('0xe')](function(_0x521ee8){logger[_0xca69('0x17')](_0xca69('0x23'),_0x51e3ce);logger['debug'](_0xca69('0x23'),_0x51e3ce,JSON[_0xca69('0x13')](_0x521ee8));_0x50493c(_0x521ee8);})[_0xca69('0x19')](function(_0x1aca57){logger[_0xca69('0x14')](_0xca69('0x23'),_0x1aca57[_0xca69('0x16')],_0x51e3ce);_0x59d7a8(_0x36061f[_0xca69('0x14')](0x1f4,_0x1aca57[_0xca69('0x16')]));});});};exports[_0xca69('0x25')]=function(_0x51dedc){var _0x4772a5=this;return new Promise(function(_0x22bb10,_0x1c6a25){return db[_0xca69('0x1a')][_0xca69('0x26')](_0x51dedc[_0xca69('0x27')],{'raw':_0x51dedc[_0xca69('0x1c')]?_0x51dedc[_0xca69('0x1c')][_0xca69('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51dedc['options']?_0x51dedc[_0xca69('0x1c')]['where']||null:null,'attributes':_0x51dedc[_0xca69('0x1c')]?_0x51dedc[_0xca69('0x1c')][_0xca69('0x1e')]||null:null,'limit':_0x51dedc[_0xca69('0x1c')]?_0x51dedc[_0xca69('0x1c')][_0xca69('0x28')]||null:null})[_0xca69('0xe')](function(_0x996f41){logger[_0xca69('0x17')](_0xca69('0x25'),_0x51dedc);logger[_0xca69('0x11')](_0xca69('0x25'),_0x51dedc,JSON[_0xca69('0x13')](_0x996f41));_0x22bb10(_0x996f41);})[_0xca69('0x19')](function(_0x496b64){logger[_0xca69('0x14')](_0xca69('0x25'),_0x496b64['message'],_0x51dedc);_0x1c6a25(_0x4772a5[_0xca69('0x14')](0x1f4,_0x496b64['message']));});});}; \ No newline at end of file +var _0xc683=['options','raw','limit','include','map','model','attributes','GetMemberReport','debug','create','CreateMemberReport','UpdateMemberReport','update','body','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MemberReport','findAll'];(function(_0x59a1e4,_0xdf725f){var _0x497390=function(_0xf54098){while(--_0xf54098){_0x59a1e4['push'](_0x59a1e4['shift']());}};_0x497390(++_0xdf725f);}(_0xc683,0xf3));var _0x3c68=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xc683[_0x557fd2];return _0x1b54a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c68('0x0'));var BPromise=require(_0x3c68('0x1'));var rs=require(_0x3c68('0x2'));var fs=require('fs');var Redis=require(_0x3c68('0x3'));var db=require(_0x3c68('0x4'))['db'];var utils=require(_0x3c68('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3c68('0x6'));var jayson=require(_0x3c68('0x7'));var client=jayson[_0x3c68('0x8')][_0x3c68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x176d6d,_0x4f6e79,_0x4dc25d){return new BPromise(function(_0x108fc3,_0x1dd694){return client[_0x3c68('0xa')](_0x176d6d,_0x4dc25d)[_0x3c68('0xb')](function(_0x542176){logger[_0x3c68('0xc')](_0x3c68('0xd'),_0x4f6e79,_0x3c68('0xe'));logger['debug'](_0x3c68('0xf'),_0x4f6e79,'request\x20sent',JSON[_0x3c68('0x10')](_0x542176));if(_0x542176[_0x3c68('0x11')]){if(_0x542176['error'][_0x3c68('0x12')]===0x1f4){logger['error'](_0x3c68('0xd'),_0x4f6e79,_0x542176[_0x3c68('0x11')][_0x3c68('0x13')]);return _0x1dd694(_0x542176[_0x3c68('0x11')][_0x3c68('0x13')]);}logger[_0x3c68('0x11')](_0x3c68('0xd'),_0x4f6e79,_0x542176[_0x3c68('0x11')][_0x3c68('0x13')]);return _0x108fc3(_0x542176['error'][_0x3c68('0x13')]);}else{logger[_0x3c68('0xc')](_0x3c68('0xd'),_0x4f6e79,_0x3c68('0xe'));_0x108fc3(_0x542176['result'][_0x3c68('0x13')]);}})[_0x3c68('0x14')](function(_0x27d2bd){logger[_0x3c68('0x11')](_0x3c68('0xd'),_0x4f6e79,_0x27d2bd);_0x1dd694(_0x27d2bd);});});}exports['GetMemberReport']=function(_0x2d4af9){var _0x443525=this;return new Promise(function(_0x50956b,_0x27b749){return db[_0x3c68('0x15')][_0x3c68('0x16')]({'raw':_0x2d4af9[_0x3c68('0x17')]?_0x2d4af9[_0x3c68('0x17')][_0x3c68('0x18')]===undefined?!![]:![]:!![],'where':_0x2d4af9[_0x3c68('0x17')]?_0x2d4af9['options']['where']||null:null,'attributes':_0x2d4af9['options']?_0x2d4af9['options']['attributes']||null:null,'limit':_0x2d4af9[_0x3c68('0x17')]?_0x2d4af9[_0x3c68('0x17')][_0x3c68('0x19')]||null:null,'include':_0x2d4af9[_0x3c68('0x17')]?_0x2d4af9[_0x3c68('0x17')][_0x3c68('0x1a')]?_[_0x3c68('0x1b')](_0x2d4af9[_0x3c68('0x17')]['include'],function(_0x2ec6b9){return{'model':db[_0x2ec6b9[_0x3c68('0x1c')]],'as':_0x2ec6b9['as'],'attributes':_0x2ec6b9[_0x3c68('0x1d')],'include':_0x2ec6b9['include']?_['map'](_0x2ec6b9[_0x3c68('0x1a')],function(_0x119e99){return{'model':db[_0x119e99['model']],'as':_0x119e99['as'],'attributes':_0x119e99[_0x3c68('0x1d')],'include':_0x119e99[_0x3c68('0x1a')]?_[_0x3c68('0x1b')](_0x119e99['include'],function(_0x25010c){return{'model':db[_0x25010c[_0x3c68('0x1c')]],'as':_0x25010c['as'],'attributes':_0x25010c[_0x3c68('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3c68('0xb')](function(_0x5948fc){logger[_0x3c68('0xc')](_0x3c68('0x1e'),_0x2d4af9);logger[_0x3c68('0x1f')](_0x3c68('0x1e'),_0x2d4af9,JSON[_0x3c68('0x10')](_0x5948fc));_0x50956b(_0x5948fc);})[_0x3c68('0x14')](function(_0x2eafb9){logger[_0x3c68('0x11')](_0x3c68('0x1e'),_0x2eafb9['message'],_0x2d4af9);_0x27b749(_0x443525[_0x3c68('0x11')](0x1f4,_0x2eafb9[_0x3c68('0x13')]));});});};exports['CreateMemberReport']=function(_0x15a56c){var _0x38bba4=this;return new Promise(function(_0x4f7178,_0xdae1a6){return db[_0x3c68('0x15')][_0x3c68('0x20')](_0x15a56c['body'],{'raw':_0x15a56c[_0x3c68('0x17')]?_0x15a56c['options'][_0x3c68('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x346738){logger[_0x3c68('0xc')](_0x3c68('0x21'),_0x15a56c);logger[_0x3c68('0x1f')](_0x3c68('0x21'),_0x15a56c,JSON[_0x3c68('0x10')](_0x346738));_0x4f7178(_0x346738);})[_0x3c68('0x14')](function(_0x71ea77){logger[_0x3c68('0x11')](_0x3c68('0x21'),_0x71ea77[_0x3c68('0x13')],_0x15a56c);_0xdae1a6(_0x38bba4[_0x3c68('0x11')](0x1f4,_0x71ea77[_0x3c68('0x13')]));});});};exports[_0x3c68('0x22')]=function(_0x321f98){var _0x370368=this;return new Promise(function(_0x17332f,_0x435920){return db[_0x3c68('0x15')][_0x3c68('0x23')](_0x321f98[_0x3c68('0x24')],{'raw':_0x321f98[_0x3c68('0x17')]?_0x321f98[_0x3c68('0x17')][_0x3c68('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321f98['options']?_0x321f98['options'][_0x3c68('0x25')]||null:null,'attributes':_0x321f98[_0x3c68('0x17')]?_0x321f98[_0x3c68('0x17')][_0x3c68('0x1d')]||null:null,'limit':_0x321f98['options']?_0x321f98[_0x3c68('0x17')][_0x3c68('0x19')]||null:null})['then'](function(_0x36cc18){logger[_0x3c68('0xc')]('UpdateMemberReport',_0x321f98);logger[_0x3c68('0x1f')](_0x3c68('0x22'),_0x321f98,JSON[_0x3c68('0x10')](_0x36cc18));_0x17332f(_0x36cc18);})[_0x3c68('0x14')](function(_0x4f8786){logger['error'](_0x3c68('0x22'),_0x4f8786[_0x3c68('0x13')],_0x321f98);_0x435920(_0x370368[_0x3c68('0x11')](0x1f4,_0x4f8786['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 76a532a..c5ebe8e 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 _0x9c00=['get','index','multer','util','express','Router','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x5ebb4d,_0x3180ec){var _0x7e1980=function(_0x1ec1dd){while(--_0x1ec1dd){_0x5ebb4d['push'](_0x5ebb4d['shift']());}};_0x7e1980(++_0x3180ec);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4f7fe0,_0x18201f){_0x4f7fe0=_0x4f7fe0-0x0;var _0x1e2851=_0x9c00[_0x4f7fe0];return _0x1e2851;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c0('0x4'));var config=require(_0x09c0('0x5'));var controller=require(_0x09c0('0x6'));router[_0x09c0('0x7')]('/',controller[_0x09c0('0x8')]);module['exports']=router; \ No newline at end of file +var _0xd914=['../../config/environment','get','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xd914,0x17f));var _0x4d91=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0xd914[_0x8bb4c1];return _0x67a6e1;};'use strict';var multer=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var path=require('path');var timeout=require(_0x4d91('0x2'));var express=require(_0x4d91('0x3'));var router=express[_0x4d91('0x4')]();var auth=require(_0x4d91('0x5'));var interaction=require(_0x4d91('0x6'));var config=require(_0x4d91('0x7'));var controller=require('./migration.controller');router[_0x4d91('0x8')]('/',controller['index']);module[_0x4d91('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 468323c..35f3ece 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 _0x4d77=['version','sequelize','exports'];(function(_0x49776a,_0x20255b){var _0x1ece66=function(_0x2b83e3){while(--_0x2b83e3){_0x49776a['push'](_0x49776a['shift']());}};_0x1ece66(++_0x20255b);}(_0x4d77,0xa0));var _0x74d7=function(_0x317c0d,_0x1f4185){_0x317c0d=_0x317c0d-0x0;var _0x2009a0=_0x4d77[_0x317c0d];return _0x2009a0;};'use strict';var Sequelize=require(_0x74d7('0x0'));module[_0x74d7('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x74d7('0x2')}}; \ No newline at end of file +var _0xf168=['version','sequelize','STRING'];(function(_0x505dcb,_0x3d3646){var _0x3f1944=function(_0x22dfa1){while(--_0x22dfa1){_0x505dcb['push'](_0x505dcb['shift']());}};_0x3f1944(++_0x3d3646);}(_0xf168,0xe2));var _0x8f16=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xf168[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x8f16('0x0'));module['exports']={'version':{'type':Sequelize[_0x8f16('0x1')],'unique':_0x8f16('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ad26d87..8c78fef 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 _0x3f4b=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../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','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x4ac635,_0x59ef69){var _0x379e19=function(_0xedbba5){while(--_0xedbba5){_0x4ac635['push'](_0x4ac635['shift']());}};_0x379e19(++_0x59ef69);}(_0x3f4b,0x118));var _0xb3f4=function(_0x2a335c,_0x355c9a){_0x2a335c=_0x2a335c-0x0;var _0x235410=_0x3f4b[_0x2a335c];return _0x235410;};'use strict';var pdf=require(_0xb3f4('0x0'));var emlformat=require(_0xb3f4('0x1'));var rimraf=require(_0xb3f4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3f4('0x3'));var rp=require(_0xb3f4('0x4'));var moment=require(_0xb3f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb3f4('0x6'));var util=require(_0xb3f4('0x7'));var path=require(_0xb3f4('0x8'));var sox=require(_0xb3f4('0x9'));var csv=require('to-csv');var ejs=require(_0xb3f4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb3f4('0xb'));var crypto=require('crypto');var jsforce=require(_0xb3f4('0xc'));var deskjs=require(_0xb3f4('0xd'));var toCsv=require(_0xb3f4('0xe'));var querystring=require(_0xb3f4('0xf'));var Papa=require('papaparse');var Redis=require(_0xb3f4('0x10'));var authService=require(_0xb3f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb3f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3f4('0x13'))(_0xb3f4('0x14'));var utils=require(_0xb3f4('0x15'));var config=require(_0xb3f4('0x16'));var licenseUtil=require(_0xb3f4('0x17'));var db=require(_0xb3f4('0x18'))['db'];function respondWithStatusCode(_0xdb4f41,_0x1b5d0f){_0x1b5d0f=_0x1b5d0f||0xcc;return function(_0x232eb8){if(_0x232eb8){return _0xdb4f41[_0xb3f4('0x19')](_0x1b5d0f);}return _0xdb4f41[_0xb3f4('0x1a')](_0x1b5d0f)[_0xb3f4('0x1b')]();};}function respondWithResult(_0x43c62c,_0x160896){_0x160896=_0x160896||0xc8;return function(_0x571d5a){if(_0x571d5a){return _0x43c62c[_0xb3f4('0x1a')](_0x160896)[_0xb3f4('0x1c')](_0x571d5a);}};}function respondWithFilteredResult(_0x207970,_0x12db95){return function(_0x10a437){if(_0x10a437){var _0xaa4796=_0x10a437[_0xb3f4('0x1d')],_0x24c721=_0x12db95['offset'],_0x153b49=_0x12db95[_0xb3f4('0x1e')]+_0x12db95['limit'],_0x48a6f9;if(_0x153b49>=_0xaa4796){_0x153b49=_0xaa4796;_0x48a6f9=0xc8;}else{_0x48a6f9=0xce;}_0x207970[_0xb3f4('0x1a')](_0x48a6f9);return _0x207970[_0xb3f4('0x1f')](_0xb3f4('0x20'),_0x24c721+'-'+_0x153b49+'/'+_0xaa4796)['json'](_0x10a437);}return null;};}function patchUpdates(_0x14624c){return function(_0x40a6ba){try{jsonpatch[_0xb3f4('0x21')](_0x40a6ba,_0x14624c,!![]);}catch(_0xa97ff){return BPromise[_0xb3f4('0x22')](_0xa97ff);}return _0x40a6ba[_0xb3f4('0x23')]();};}function saveUpdates(_0x215b97,_0x325ee8){return function(_0x431d12){if(_0x431d12){return _0x431d12[_0xb3f4('0x24')](_0x215b97)[_0xb3f4('0x25')](function(_0x57660e){return _0x57660e;});}return null;};}function removeEntity(_0x25d396,_0x49dc00){return function(_0xa1bea2){if(_0xa1bea2){return _0xa1bea2[_0xb3f4('0x26')]()['then'](function(){_0x25d396['status'](0xcc)[_0xb3f4('0x1b')]();});}};}function handleEntityNotFound(_0x2352e8,_0x2a97fe){return function(_0x4c5e31){if(!_0x4c5e31){_0x2352e8[_0xb3f4('0x19')](0x194);}return _0x4c5e31;};}function handleError(_0x3416ff,_0x3db26b){_0x3db26b=_0x3db26b||0x1f4;return function(_0x198140){logger[_0xb3f4('0x27')](_0x198140[_0xb3f4('0x28')]);if(_0x198140[_0xb3f4('0x29')]){delete _0x198140[_0xb3f4('0x29')];}_0x3416ff[_0xb3f4('0x1a')](_0x3db26b)[_0xb3f4('0x2a')](_0x198140);};}exports[_0xb3f4('0x2b')]=function(_0x167248,_0x55e5ac){var _0x4fb9cb={},_0x5621d5={},_0x28fb5d={'count':0x0,'rows':[]};var _0x1bcc73=_[_0xb3f4('0x2c')](db[_0xb3f4('0x2d')][_0xb3f4('0x2e')],function(_0x305a9a){return{'name':_0x305a9a[_0xb3f4('0x2f')],'type':_0x305a9a[_0xb3f4('0x30')][_0xb3f4('0x31')]};});_0x5621d5['model']=_[_0xb3f4('0x2c')](_0x1bcc73,_0xb3f4('0x29'));_0x5621d5['query']=_['keys'](_0x167248[_0xb3f4('0x32')]);_0x5621d5[_0xb3f4('0x33')]=_[_0xb3f4('0x34')](_0x5621d5[_0xb3f4('0x35')],_0x5621d5[_0xb3f4('0x32')]);_0x4fb9cb[_0xb3f4('0x36')]=_[_0xb3f4('0x34')](_0x5621d5[_0xb3f4('0x35')],qs[_0xb3f4('0x37')](_0x167248[_0xb3f4('0x32')][_0xb3f4('0x37')]));_0x4fb9cb[_0xb3f4('0x36')]=_0x4fb9cb[_0xb3f4('0x36')]['length']?_0x4fb9cb['attributes']:_0x5621d5[_0xb3f4('0x35')];if(!_0x167248['query'][_0xb3f4('0x38')](_0xb3f4('0x39'))){_0x4fb9cb['limit']=qs[_0xb3f4('0x3a')](_0x167248[_0xb3f4('0x32')][_0xb3f4('0x3a')]);_0x4fb9cb['offset']=qs[_0xb3f4('0x1e')](_0x167248['query']['offset']);}_0x4fb9cb[_0xb3f4('0x3b')]=qs[_0xb3f4('0x3c')](_0x167248[_0xb3f4('0x32')][_0xb3f4('0x3c')]);_0x4fb9cb[_0xb3f4('0x3d')]=qs[_0xb3f4('0x33')](_[_0xb3f4('0x3e')](_0x167248[_0xb3f4('0x32')],_0x5621d5[_0xb3f4('0x33')]),_0x1bcc73);if(_0x167248['query'][_0xb3f4('0x3f')]){_0x4fb9cb['where']=_['merge'](_0x4fb9cb[_0xb3f4('0x3d')],{'$or':_[_0xb3f4('0x2c')](_0x1bcc73,function(_0x4772b2){if(_0x4772b2[_0xb3f4('0x30')]!==_0xb3f4('0x40')){var _0x4f74e1={};_0x4f74e1[_0x4772b2[_0xb3f4('0x29')]]={'$like':'%'+_0x167248[_0xb3f4('0x32')]['filter']+'%'};return _0x4f74e1;}})});}_0x4fb9cb=_['merge']({},_0x4fb9cb,_0x167248[_0xb3f4('0x41')]);var _0x13d9c7={'where':_0x4fb9cb[_0xb3f4('0x3d')]};return db[_0xb3f4('0x2d')]['count'](_0x13d9c7)[_0xb3f4('0x25')](function(_0x269263){_0x28fb5d['count']=_0x269263;if(_0x167248[_0xb3f4('0x32')][_0xb3f4('0x42')]){_0x4fb9cb[_0xb3f4('0x43')]=[{'all':!![]}];}return db[_0xb3f4('0x2d')][_0xb3f4('0x44')](_0x4fb9cb);})[_0xb3f4('0x25')](function(_0x3a6b03){_0x28fb5d['rows']=_0x3a6b03;return _0x28fb5d;})[_0xb3f4('0x25')](respondWithFilteredResult(_0x55e5ac,_0x4fb9cb))[_0xb3f4('0x45')](handleError(_0x55e5ac,null));}; \ No newline at end of file +var _0xb6dd=['../../config/utils','sendStatus','end','status','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','Migration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','merge','options','count','includeAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb6dd,0x126));var _0xdb6d=function(_0x2f9728,_0x48cbe1){_0x2f9728=_0x2f9728-0x0;var _0x31d4ed=_0xb6dd[_0x2f9728];return _0x31d4ed;};'use strict';var pdf=require(_0xdb6d('0x0'));var emlformat=require(_0xdb6d('0x1'));var rimraf=require(_0xdb6d('0x2'));var zipdir=require(_0xdb6d('0x3'));var jsonpatch=require(_0xdb6d('0x4'));var rp=require(_0xdb6d('0x5'));var moment=require('moment');var BPromise=require(_0xdb6d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdb6d('0x7'));var ejs=require(_0xdb6d('0x8'));var fs=require('fs');var _=require(_0xdb6d('0x9'));var squel=require(_0xdb6d('0xa'));var crypto=require(_0xdb6d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdb6d('0xc'));var toCsv=require(_0xdb6d('0x7'));var querystring=require(_0xdb6d('0xd'));var Papa=require(_0xdb6d('0xe'));var Redis=require(_0xdb6d('0xf'));var authService=require(_0xdb6d('0x10'));var qs=require(_0xdb6d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb6d('0x12'));var logger=require(_0xdb6d('0x13'))(_0xdb6d('0x14'));var utils=require(_0xdb6d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25b3e5,_0x16acea){_0x16acea=_0x16acea||0xcc;return function(_0x1e97f6){if(_0x1e97f6){return _0x25b3e5[_0xdb6d('0x16')](_0x16acea);}return _0x25b3e5['status'](_0x16acea)[_0xdb6d('0x17')]();};}function respondWithResult(_0x30e1da,_0x2a9b3b){_0x2a9b3b=_0x2a9b3b||0xc8;return function(_0x5062e3){if(_0x5062e3){return _0x30e1da[_0xdb6d('0x18')](_0x2a9b3b)['json'](_0x5062e3);}};}function respondWithFilteredResult(_0x388688,_0x43c8a7){return function(_0x3cad9d){if(_0x3cad9d){var _0x5f23d3=_0x3cad9d['count'],_0x1f6135=_0x43c8a7['offset'],_0x2825da=_0x43c8a7[_0xdb6d('0x19')]+_0x43c8a7[_0xdb6d('0x1a')],_0x4b9ce1;if(_0x2825da>=_0x5f23d3){_0x2825da=_0x5f23d3;_0x4b9ce1=0xc8;}else{_0x4b9ce1=0xce;}_0x388688[_0xdb6d('0x18')](_0x4b9ce1);return _0x388688[_0xdb6d('0x1b')](_0xdb6d('0x1c'),_0x1f6135+'-'+_0x2825da+'/'+_0x5f23d3)[_0xdb6d('0x1d')](_0x3cad9d);}return null;};}function patchUpdates(_0x543441){return function(_0x441025){try{jsonpatch['apply'](_0x441025,_0x543441,!![]);}catch(_0x327c27){return BPromise[_0xdb6d('0x1e')](_0x327c27);}return _0x441025[_0xdb6d('0x1f')]();};}function saveUpdates(_0x2f7c8f,_0xd67722){return function(_0x802cd6){if(_0x802cd6){return _0x802cd6[_0xdb6d('0x20')](_0x2f7c8f)[_0xdb6d('0x21')](function(_0x285b5e){return _0x285b5e;});}return null;};}function removeEntity(_0x4284e0,_0x5eab18){return function(_0x4a3933){if(_0x4a3933){return _0x4a3933[_0xdb6d('0x22')]()['then'](function(){_0x4284e0[_0xdb6d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8cb734,_0x2d3817){return function(_0x2bc7a5){if(!_0x2bc7a5){_0x8cb734[_0xdb6d('0x16')](0x194);}return _0x2bc7a5;};}function handleError(_0xb6a71f,_0xc3354f){_0xc3354f=_0xc3354f||0x1f4;return function(_0x3b5431){logger[_0xdb6d('0x23')](_0x3b5431['stack']);if(_0x3b5431[_0xdb6d('0x24')]){delete _0x3b5431[_0xdb6d('0x24')];}_0xb6a71f[_0xdb6d('0x18')](_0xc3354f)[_0xdb6d('0x25')](_0x3b5431);};}exports[_0xdb6d('0x26')]=function(_0x2f6384,_0x5bf275){var _0x5ce287={},_0x11d45f={},_0x12e17b={'count':0x0,'rows':[]};var _0x47433a=_[_0xdb6d('0x27')](db[_0xdb6d('0x28')]['rawAttributes'],function(_0x5e0bae){return{'name':_0x5e0bae[_0xdb6d('0x29')],'type':_0x5e0bae['type'][_0xdb6d('0x2a')]};});_0x11d45f[_0xdb6d('0x2b')]=_[_0xdb6d('0x27')](_0x47433a,'name');_0x11d45f[_0xdb6d('0x2c')]=_[_0xdb6d('0x2d')](_0x2f6384['query']);_0x11d45f[_0xdb6d('0x2e')]=_[_0xdb6d('0x2f')](_0x11d45f[_0xdb6d('0x2b')],_0x11d45f['query']);_0x5ce287[_0xdb6d('0x30')]=_[_0xdb6d('0x2f')](_0x11d45f[_0xdb6d('0x2b')],qs[_0xdb6d('0x31')](_0x2f6384['query'][_0xdb6d('0x31')]));_0x5ce287[_0xdb6d('0x30')]=_0x5ce287['attributes'][_0xdb6d('0x32')]?_0x5ce287[_0xdb6d('0x30')]:_0x11d45f[_0xdb6d('0x2b')];if(!_0x2f6384[_0xdb6d('0x2c')]['hasOwnProperty'](_0xdb6d('0x33'))){_0x5ce287[_0xdb6d('0x1a')]=qs[_0xdb6d('0x1a')](_0x2f6384[_0xdb6d('0x2c')][_0xdb6d('0x1a')]);_0x5ce287['offset']=qs[_0xdb6d('0x19')](_0x2f6384[_0xdb6d('0x2c')][_0xdb6d('0x19')]);}_0x5ce287[_0xdb6d('0x34')]=qs[_0xdb6d('0x35')](_0x2f6384[_0xdb6d('0x2c')]['sort']);_0x5ce287['where']=qs[_0xdb6d('0x2e')](_['pick'](_0x2f6384[_0xdb6d('0x2c')],_0x11d45f['filters']),_0x47433a);if(_0x2f6384[_0xdb6d('0x2c')][_0xdb6d('0x36')]){_0x5ce287[_0xdb6d('0x37')]=_['merge'](_0x5ce287['where'],{'$or':_[_0xdb6d('0x27')](_0x47433a,function(_0x32c7a9){if(_0x32c7a9[_0xdb6d('0x38')]!=='VIRTUAL'){var _0x1cacc7={};_0x1cacc7[_0x32c7a9[_0xdb6d('0x24')]]={'$like':'%'+_0x2f6384[_0xdb6d('0x2c')]['filter']+'%'};return _0x1cacc7;}})});}_0x5ce287=_[_0xdb6d('0x39')]({},_0x5ce287,_0x2f6384[_0xdb6d('0x3a')]);var _0x1aadcf={'where':_0x5ce287[_0xdb6d('0x37')]};return db[_0xdb6d('0x28')][_0xdb6d('0x3b')](_0x1aadcf)['then'](function(_0x931da){_0x12e17b[_0xdb6d('0x3b')]=_0x931da;if(_0x2f6384['query'][_0xdb6d('0x3c')]){_0x5ce287['include']=[{'all':!![]}];}return db[_0xdb6d('0x28')]['findAll'](_0x5ce287);})[_0xdb6d('0x21')](function(_0x39f452){_0x12e17b[_0xdb6d('0x3d')]=_0x39f452;return _0x12e17b;})[_0xdb6d('0x21')](respondWithFilteredResult(_0x5bf275,_0x5ce287))[_0xdb6d('0x3e')](handleError(_0x5bf275,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1a0ae59..a422b63 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 _0x311a=['api','request-promise','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x311a,0x116));var _0xa311=function(_0x5d26d5,_0x199d2d){_0x5d26d5=_0x5d26d5-0x0;var _0x3a27b5=_0x311a[_0x5d26d5];return _0x3a27b5;};'use strict';var _=require(_0xa311('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa311('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa311('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa311('0x3'));var config=require('../../config/environment');var attributes=require(_0xa311('0x4'));module[_0xa311('0x5')]=function(_0x46fc5e,_0x4ed2e9){return _0x46fc5e[_0xa311('0x6')](_0xa311('0x7'),attributes,{'tableName':_0xa311('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb626=['Migration','migrations','util','../../config/logger','moment','rimraf','./migration.attributes'];(function(_0x49de97,_0x3758d0){var _0x356289=function(_0xf0072d){while(--_0xf0072d){_0x49de97['push'](_0x49de97['shift']());}};_0x356289(++_0x3758d0);}(_0xb626,0xbf));var _0x6b62=function(_0x51843f,_0x16238e){_0x51843f=_0x51843f-0x0;var _0x5b8b77=_0xb626[_0x51843f];return _0x5b8b77;};'use strict';var _=require('lodash');var util=require(_0x6b62('0x0'));var logger=require(_0x6b62('0x1'))('api');var moment=require(_0x6b62('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b62('0x3'));var config=require('../../config/environment');var attributes=require(_0x6b62('0x4'));module['exports']=function(_0x49624a,_0x26f818){return _0x49624a['define'](_0x6b62('0x5'),attributes,{'tableName':_0x6b62('0x6'),'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 610c71c..b9e4f4a 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 _0x5490=['message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error'];(function(_0x17099f,_0x52db2a){var _0x2078fe=function(_0x5779d1){while(--_0x5779d1){_0x17099f['push'](_0x17099f['shift']());}};_0x2078fe(++_0x52db2a);}(_0x5490,0x152));var _0x0549=function(_0x300efc,_0x2902ef){_0x300efc=_0x300efc-0x0;var _0x12c28c=_0x5490[_0x300efc];return _0x12c28c;};'use strict';var _=require('lodash');var util=require(_0x0549('0x0'));var moment=require(_0x0549('0x1'));var BPromise=require(_0x0549('0x2'));var rs=require(_0x0549('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0549('0x4'))['db'];var utils=require(_0x0549('0x5'));var logger=require('../../config/logger')(_0x0549('0x6'));var config=require(_0x0549('0x7'));var jayson=require(_0x0549('0x8'));var client=jayson[_0x0549('0x9')][_0x0549('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4a87,_0x472ba2,_0x281ff1){return new BPromise(function(_0xb9c151,_0x1f6f95){return client[_0x0549('0xb')](_0x4b4a87,_0x281ff1)[_0x0549('0xc')](function(_0x4bca21){logger[_0x0549('0xd')](_0x0549('0xe'),_0x472ba2,_0x0549('0xf'));logger[_0x0549('0x10')](_0x0549('0x11'),_0x472ba2,_0x0549('0xf'),JSON['stringify'](_0x4bca21));if(_0x4bca21[_0x0549('0x12')]){if(_0x4bca21[_0x0549('0x12')]['code']===0x1f4){logger[_0x0549('0x12')](_0x0549('0xe'),_0x472ba2,_0x4bca21[_0x0549('0x12')]['message']);return _0x1f6f95(_0x4bca21[_0x0549('0x12')][_0x0549('0x13')]);}logger['error'](_0x0549('0xe'),_0x472ba2,_0x4bca21[_0x0549('0x12')][_0x0549('0x13')]);return _0xb9c151(_0x4bca21[_0x0549('0x12')][_0x0549('0x13')]);}else{logger[_0x0549('0xd')](_0x0549('0xe'),_0x472ba2,_0x0549('0xf'));_0xb9c151(_0x4bca21[_0x0549('0x14')]['message']);}})['catch'](function(_0x1fa0e3){logger[_0x0549('0x12')](_0x0549('0xe'),_0x472ba2,_0x1fa0e3);_0x1f6f95(_0x1fa0e3);});});} \ No newline at end of file +var _0x024b=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x024b,0xac));var _0xb024=function(_0x229dda,_0x472dec){_0x229dda=_0x229dda-0x0;var _0x23c85b=_0x024b[_0x229dda];return _0x23c85b;};'use strict';var _=require(_0xb024('0x0'));var util=require(_0xb024('0x1'));var moment=require(_0xb024('0x2'));var BPromise=require('bluebird');var rs=require(_0xb024('0x3'));var fs=require('fs');var Redis=require(_0xb024('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb024('0x5'));var logger=require(_0xb024('0x6'))('rpc');var config=require(_0xb024('0x7'));var jayson=require(_0xb024('0x8'));var client=jayson[_0xb024('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48db6d,_0x221470,_0x2084b3){return new BPromise(function(_0xc5262,_0x1e63ed){return client[_0xb024('0xa')](_0x48db6d,_0x2084b3)[_0xb024('0xb')](function(_0x54c8da){logger[_0xb024('0xc')](_0xb024('0xd'),_0x221470,_0xb024('0xe'));logger[_0xb024('0xf')](_0xb024('0x10'),_0x221470,'request\x20sent',JSON[_0xb024('0x11')](_0x54c8da));if(_0x54c8da['error']){if(_0x54c8da['error']['code']===0x1f4){logger[_0xb024('0x12')](_0xb024('0xd'),_0x221470,_0x54c8da[_0xb024('0x12')][_0xb024('0x13')]);return _0x1e63ed(_0x54c8da['error'][_0xb024('0x13')]);}logger[_0xb024('0x12')]('Migration,\x20%s,\x20%s',_0x221470,_0x54c8da[_0xb024('0x12')][_0xb024('0x13')]);return _0xc5262(_0x54c8da[_0xb024('0x12')]['message']);}else{logger[_0xb024('0xc')](_0xb024('0xd'),_0x221470,'request\x20sent');_0xc5262(_0x54c8da[_0xb024('0x14')][_0xb024('0x13')]);}})[_0xb024('0x15')](function(_0x32c4f0){logger['error'](_0xb024('0xd'),_0x221470,_0x32c4f0);_0x1e63ed(_0x32c4f0);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a2bc1db..82253c7 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 _0x81bb=['/:id','update','destroy','exports','multer','path','Router','./network.controller','isAuthenticated','index','get','show','post','put'];(function(_0x308be6,_0x47369b){var _0x569814=function(_0x299209){while(--_0x299209){_0x308be6['push'](_0x308be6['shift']());}};_0x569814(++_0x47369b);}(_0x81bb,0x74));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb81b('0x0'));var util=require('util');var path=require(_0xb81b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb81b('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb81b('0x3'));router['get']('/',auth[_0xb81b('0x4')](),controller[_0xb81b('0x5')]);router[_0xb81b('0x6')]('/:id',auth[_0xb81b('0x4')](),controller[_0xb81b('0x7')]);router[_0xb81b('0x8')]('/',auth[_0xb81b('0x4')](),controller['create']);router[_0xb81b('0x9')](_0xb81b('0xa'),auth[_0xb81b('0x4')](),controller[_0xb81b('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb81b('0xc')]);module[_0xb81b('0xd')]=router; \ No newline at end of file +var _0x6df4=['exports','multer','util','path','express','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','put','update','delete'];(function(_0x2d59a2,_0x128ce1){var _0x431d78=function(_0x162b98){while(--_0x162b98){_0x2d59a2['push'](_0x2d59a2['shift']());}};_0x431d78(++_0x128ce1);}(_0x6df4,0xa6));var _0x46df=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x6df4[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0x46df('0x0'));var util=require(_0x46df('0x1'));var path=require(_0x46df('0x2'));var timeout=require('connect-timeout');var express=require(_0x46df('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x46df('0x4'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x46df('0x5')](),controller[_0x46df('0x6')]);router[_0x46df('0x7')](_0x46df('0x8'),auth[_0x46df('0x5')](),controller[_0x46df('0x9')]);router[_0x46df('0xa')]('/',auth[_0x46df('0x5')](),controller['create']);router[_0x46df('0xb')](_0x46df('0x8'),auth['isAuthenticated'](),controller[_0x46df('0xc')]);router[_0x46df('0xd')](_0x46df('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x46df('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 214c10d..7cc4bb6 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(_0x839f1b,_0x323fdc){var _0x1da957=function(_0x163912){while(--_0x163912){_0x839f1b['push'](_0x839f1b['shift']());}};_0x1da957(++_0x323fdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x200d0d,_0x38c0ef){var _0x8c4d26=function(_0x5eb22f){while(--_0x5eb22f){_0x200d0d['push'](_0x200d0d['shift']());}};_0x8c4d26(++_0x38c0ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 df73ccc..ecdf399 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 _0x6f99=['set','Content-Range','json','apply','reject','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','include','Network','findAll','params','options','find','transaction','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','TURN','join','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','update','server/files/templates/network.ejs','/etc/asterisk/turn_xcally.conf','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','count','offset','limit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6f99,0xa9));var _0x96f9=function(_0x1b5878,_0x445f36){_0x1b5878=_0x1b5878-0x0;var _0x3052c3=_0x6f99[_0x1b5878];return _0x3052c3;};'use strict';var pdf=require(_0x96f9('0x0'));var emlformat=require(_0x96f9('0x1'));var rimraf=require(_0x96f9('0x2'));var zipdir=require(_0x96f9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x96f9('0x4'));var BPromise=require(_0x96f9('0x5'));var Mustache=require(_0x96f9('0x6'));var util=require(_0x96f9('0x7'));var path=require('path');var sox=require(_0x96f9('0x8'));var csv=require(_0x96f9('0x9'));var ejs=require(_0x96f9('0xa'));var fs=require('fs');var _=require(_0x96f9('0xb'));var squel=require(_0x96f9('0xc'));var crypto=require(_0x96f9('0xd'));var jsforce=require(_0x96f9('0xe'));var deskjs=require(_0x96f9('0xf'));var toCsv=require(_0x96f9('0x9'));var querystring=require(_0x96f9('0x10'));var Papa=require(_0x96f9('0x11'));var Redis=require(_0x96f9('0x12'));var authService=require(_0x96f9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96f9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x96f9('0x15'));var config=require(_0x96f9('0x16'));var licenseUtil=require(_0x96f9('0x17'));var db=require(_0x96f9('0x18'))['db'];var jayson=require(_0x96f9('0x19'));var client=jayson[_0x96f9('0x1a')][_0x96f9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x38c4a3,_0x248b41,_0xc97889,_0x3d8925){return new BPromise(function(_0x155215,_0x3dea4e){var _0x1a382b=_0x3d8925||client;return _0x1a382b[_0x96f9('0x1c')](_0x38c4a3,_0xc97889)[_0x96f9('0x1d')](function(_0x366438){logger[_0x96f9('0x1e')](_0x96f9('0x1f'),_0x248b41,_0x96f9('0x20'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x248b41,_0x96f9('0x20'),JSON[_0x96f9('0x21')](_0x366438));if(_0x366438[_0x96f9('0x22')]){if(_0x366438[_0x96f9('0x22')][_0x96f9('0x23')]===0x1f4){logger[_0x96f9('0x22')]('Network,\x20%s,\x20%s',_0x248b41,_0x366438[_0x96f9('0x22')]['message']);return _0x3dea4e(_0x366438[_0x96f9('0x22')][_0x96f9('0x24')]);}logger['error'](_0x96f9('0x1f'),_0x248b41,_0x366438[_0x96f9('0x22')][_0x96f9('0x24')]);return _0x155215(_0x366438['error']['message']);}else{logger[_0x96f9('0x1e')](_0x96f9('0x1f'),_0x248b41,_0x96f9('0x20'));_0x155215(_0x366438['result'][_0x96f9('0x24')]);}})[_0x96f9('0x25')](function(_0x1a0d7b){logger[_0x96f9('0x22')]('Network,\x20%s,\x20%s',_0x248b41,_0x1a0d7b);_0x3dea4e(_0x1a0d7b);});});}function respondWithStatusCode(_0x58313e,_0x42cfe0){_0x42cfe0=_0x42cfe0||0xcc;return function(_0x35d6f2){if(_0x35d6f2){return _0x58313e[_0x96f9('0x26')](_0x42cfe0);}return _0x58313e[_0x96f9('0x27')](_0x42cfe0)['end']();};}function respondWithResult(_0x5ac441,_0x2e77fa){_0x2e77fa=_0x2e77fa||0xc8;return function(_0x3b99f9){if(_0x3b99f9){return _0x5ac441[_0x96f9('0x27')](_0x2e77fa)['json'](_0x3b99f9);}};}function respondWithFilteredResult(_0x32cdc0,_0xcc61cc){return function(_0x56b62c){if(_0x56b62c){var _0x5c60c2=_0x56b62c[_0x96f9('0x28')],_0x3d1a1d=_0xcc61cc[_0x96f9('0x29')],_0x2d5bf2=_0xcc61cc[_0x96f9('0x29')]+_0xcc61cc[_0x96f9('0x2a')],_0x46be63;if(_0x2d5bf2>=_0x5c60c2){_0x2d5bf2=_0x5c60c2;_0x46be63=0xc8;}else{_0x46be63=0xce;}_0x32cdc0[_0x96f9('0x27')](_0x46be63);return _0x32cdc0[_0x96f9('0x2b')](_0x96f9('0x2c'),_0x3d1a1d+'-'+_0x2d5bf2+'/'+_0x5c60c2)[_0x96f9('0x2d')](_0x56b62c);}return null;};}function patchUpdates(_0x1e6461){return function(_0x1b1f5b){try{jsonpatch[_0x96f9('0x2e')](_0x1b1f5b,_0x1e6461,!![]);}catch(_0x3754a5){return BPromise[_0x96f9('0x2f')](_0x3754a5);}return _0x1b1f5b['save']();};}function saveUpdates(_0x166c65,_0x534535){return function(_0x2f4fb2){if(_0x2f4fb2){return _0x2f4fb2['update'](_0x166c65)[_0x96f9('0x1d')](function(_0x27bc10){return _0x27bc10;});}return null;};}function removeEntity(_0x39bb77,_0x1b2b65){return function(_0x5ddbff){if(_0x5ddbff){return _0x5ddbff[_0x96f9('0x30')]()['then'](function(){_0x39bb77[_0x96f9('0x27')](0xcc)[_0x96f9('0x31')]();});}};}function handleEntityNotFound(_0xaa3fbd,_0x4c3ef0){return function(_0x423435){if(!_0x423435){_0xaa3fbd['sendStatus'](0x194);}return _0x423435;};}function handleError(_0x1930aa,_0x35e7c7){_0x35e7c7=_0x35e7c7||0x1f4;return function(_0x20ff33){logger['error'](_0x20ff33[_0x96f9('0x32')]);if(_0x20ff33[_0x96f9('0x33')]){delete _0x20ff33['name'];}_0x1930aa[_0x96f9('0x27')](_0x35e7c7)[_0x96f9('0x34')](_0x20ff33);};}exports['index']=function(_0x5e9219,_0x3439cb){var _0x161ca0={},_0x1f6087={},_0x4b64c5={'count':0x0,'rows':[]};var _0x5bbe21=_[_0x96f9('0x35')](db['Network'][_0x96f9('0x36')],function(_0x11bdc5){return{'name':_0x11bdc5[_0x96f9('0x37')],'type':_0x11bdc5[_0x96f9('0x38')][_0x96f9('0x39')]};});_0x1f6087[_0x96f9('0x3a')]=_['map'](_0x5bbe21,_0x96f9('0x33'));_0x1f6087['query']=_[_0x96f9('0x3b')](_0x5e9219[_0x96f9('0x3c')]);_0x1f6087[_0x96f9('0x3d')]=_[_0x96f9('0x3e')](_0x1f6087[_0x96f9('0x3a')],_0x1f6087[_0x96f9('0x3c')]);_0x161ca0[_0x96f9('0x3f')]=_[_0x96f9('0x3e')](_0x1f6087['model'],qs[_0x96f9('0x40')](_0x5e9219['query']['fields']));_0x161ca0[_0x96f9('0x3f')]=_0x161ca0[_0x96f9('0x3f')][_0x96f9('0x41')]?_0x161ca0['attributes']:_0x1f6087[_0x96f9('0x3a')];if(!_0x5e9219[_0x96f9('0x3c')][_0x96f9('0x42')](_0x96f9('0x43'))){_0x161ca0[_0x96f9('0x2a')]=qs[_0x96f9('0x2a')](_0x5e9219['query'][_0x96f9('0x2a')]);_0x161ca0[_0x96f9('0x29')]=qs['offset'](_0x5e9219[_0x96f9('0x3c')]['offset']);}_0x161ca0[_0x96f9('0x44')]=qs[_0x96f9('0x45')](_0x5e9219[_0x96f9('0x3c')][_0x96f9('0x45')]);_0x161ca0['where']=qs[_0x96f9('0x3d')](_[_0x96f9('0x46')](_0x5e9219[_0x96f9('0x3c')],_0x1f6087['filters']),_0x5bbe21);if(_0x5e9219['query'][_0x96f9('0x47')]){_0x161ca0['where']=_[_0x96f9('0x48')](_0x161ca0['where'],{'$or':_[_0x96f9('0x35')](_0x5bbe21,function(_0x5cfc74){if(_0x5cfc74[_0x96f9('0x38')]!==_0x96f9('0x49')){var _0x297f31={};_0x297f31[_0x5cfc74[_0x96f9('0x33')]]={'$like':'%'+_0x5e9219[_0x96f9('0x3c')]['filter']+'%'};return _0x297f31;}})});}_0x161ca0=_[_0x96f9('0x48')]({},_0x161ca0,_0x5e9219['options']);var _0x271da2={'where':_0x161ca0[_0x96f9('0x4a')]};return db['Network']['count'](_0x271da2)[_0x96f9('0x1d')](function(_0x3dd36d){_0x4b64c5[_0x96f9('0x28')]=_0x3dd36d;if(_0x5e9219[_0x96f9('0x3c')]['includeAll']){_0x161ca0[_0x96f9('0x4b')]=[{'all':!![]}];}return db[_0x96f9('0x4c')][_0x96f9('0x4d')](_0x161ca0);})[_0x96f9('0x1d')](function(_0xf052b){_0x4b64c5['rows']=_0xf052b;return _0x4b64c5;})[_0x96f9('0x1d')](respondWithFilteredResult(_0x3439cb,_0x161ca0))[_0x96f9('0x25')](handleError(_0x3439cb,null));};exports['show']=function(_0x2d3da6,_0x218469){var _0x245539={'raw':!![],'where':{'id':_0x2d3da6[_0x96f9('0x4e')]['id']}},_0x82cd73={};_0x82cd73[_0x96f9('0x3a')]=_['keys'](db[_0x96f9('0x4c')][_0x96f9('0x36')]);_0x82cd73[_0x96f9('0x3c')]=_['keys'](_0x2d3da6['query']);_0x82cd73[_0x96f9('0x3d')]=_[_0x96f9('0x3e')](_0x82cd73['model'],_0x82cd73[_0x96f9('0x3c')]);_0x245539[_0x96f9('0x3f')]=_[_0x96f9('0x3e')](_0x82cd73[_0x96f9('0x3a')],qs[_0x96f9('0x40')](_0x2d3da6[_0x96f9('0x3c')]['fields']));_0x245539[_0x96f9('0x3f')]=_0x245539[_0x96f9('0x3f')][_0x96f9('0x41')]?_0x245539[_0x96f9('0x3f')]:_0x82cd73[_0x96f9('0x3a')];if(_0x2d3da6[_0x96f9('0x3c')]['includeAll']){_0x245539[_0x96f9('0x4b')]=[{'all':!![]}];}_0x245539=_['merge']({},_0x245539,_0x2d3da6[_0x96f9('0x4f')]);return db[_0x96f9('0x4c')][_0x96f9('0x50')](_0x245539)[_0x96f9('0x1d')](handleEntityNotFound(_0x218469,null))['then'](respondWithResult(_0x218469,null))[_0x96f9('0x25')](handleError(_0x218469,null));};exports['create']=function(_0x27017d,_0x221434,_0x14deb6){var _0x49606e;return db['sequelize'][_0x96f9('0x51')](function(_0x5b8c2e){return db[_0x96f9('0x4c')][_0x96f9('0x52')](_0x27017d[_0x96f9('0x53')],{'raw':!![]})[_0x96f9('0x1d')](function(_0x2af591){_0x49606e=_0x2af591;return db['Network'][_0x96f9('0x4d')]({'where':{'type':_0x27017d['body']['type']},'raw':!![]});})[_0x96f9('0x1d')](function(_0x39485d){if(_0x49606e[_0x96f9('0x38')][_0x96f9('0x54')]()==_0x96f9('0x55')){var _0x504dc4=fs[_0x96f9('0x56')](path['join'](config[_0x96f9('0x57')],_0x96f9('0x58')),_0x96f9('0x59'));var _0x22f8fe=ejs[_0x96f9('0x5a')](_0x504dc4,{'networks':_0x39485d||[]});fs[_0x96f9('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x22f8fe);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x49606e[_0x96f9('0x38')][_0x96f9('0x54')]()==_0x96f9('0x5d')){var _0x5efdf9=fs[_0x96f9('0x56')](path[_0x96f9('0x5e')](config[_0x96f9('0x57')],_0x96f9('0x5f')),_0x96f9('0x59'));var _0xd20de7=ejs[_0x96f9('0x5a')](_0x5efdf9,{'networks':_0x39485d||[]});fs[_0x96f9('0x5b')]('/etc/asterisk/turn_xcally.conf',_0xd20de7);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x52'),{'module':'res_stun_monitor.so'});}else{var _0x5dbb0c=fs[_0x96f9('0x56')](path[_0x96f9('0x5e')](config['root'],'server/files/templates/network.ejs'),_0x96f9('0x59'));var _0x425774=ejs[_0x96f9('0x5a')](_0x5dbb0c,{'networks':_0x39485d||[]});fs[_0x96f9('0x5b')](util[_0x96f9('0x60')](_0x96f9('0x61'),_0x27017d[_0x96f9('0x53')][_0x96f9('0x38')][_0x96f9('0x62')]()),_0x425774);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x52'),{'module':_0x96f9('0x63')});}return null;})[_0x96f9('0x1d')](function(){return _0x49606e;});})[_0x96f9('0x1d')](respondWithResult(_0x221434,0xc9))[_0x96f9('0x25')](handleError(_0x221434,null));};exports['update']=function(_0x466adc,_0x31ab80,_0x85fae2){var _0x150f8b;return db[_0x96f9('0x64')][_0x96f9('0x51')](function(_0x593309){return db[_0x96f9('0x4c')][_0x96f9('0x50')]({'where':{'id':_0x466adc[_0x96f9('0x4e')]['id']}})[_0x96f9('0x1d')](handleEntityNotFound(_0x31ab80,null))[_0x96f9('0x1d')](saveUpdates(_0x466adc['body'],null))[_0x96f9('0x1d')](function(_0x308724){if(_0x308724){_0x150f8b=_0x308724;return db['Network'][_0x96f9('0x4d')]({'where':{'type':_0x150f8b['type']},'raw':!![]});}return null;})[_0x96f9('0x1d')](function(_0x54f0b5){if(_0x150f8b[_0x96f9('0x38')][_0x96f9('0x54')]()==_0x96f9('0x55')){var _0x19ab93=fs[_0x96f9('0x56')](path[_0x96f9('0x5e')](config['root'],_0x96f9('0x58')),_0x96f9('0x59'));var _0x421c87=ejs['render'](_0x19ab93,{'networks':_0x54f0b5||[]});fs[_0x96f9('0x5b')](_0x96f9('0x65'),_0x421c87);return respondWithRpcPromise('Reload','update',{'module':_0x96f9('0x66')});}else if(_0x150f8b['type'][_0x96f9('0x54')]()==_0x96f9('0x5d')){var _0x22b16=fs[_0x96f9('0x56')](path['join'](config[_0x96f9('0x57')],_0x96f9('0x5f')),_0x96f9('0x59'));var _0x45f320=ejs['render'](_0x22b16,{'networks':_0x54f0b5||[]});fs[_0x96f9('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x45f320);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x67'),{'module':_0x96f9('0x66')});}else{var _0x244aa6=fs[_0x96f9('0x56')](path[_0x96f9('0x5e')](config[_0x96f9('0x57')],_0x96f9('0x68')),_0x96f9('0x59'));var _0x4c50a5=ejs['render'](_0x244aa6,{'networks':_0x54f0b5||[]});fs['writeFileSync'](util[_0x96f9('0x60')](_0x96f9('0x61'),_0x466adc[_0x96f9('0x53')]['type'][_0x96f9('0x62')]()),_0x4c50a5);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x67'),{'module':'chan_sip.so'});}return null;})[_0x96f9('0x1d')](function(_0x5827ae){if(_0x5827ae){return _0x150f8b;}return null;});})[_0x96f9('0x1d')](respondWithResult(_0x31ab80,null))['catch'](handleError(_0x31ab80,null));};exports['destroy']=function(_0x109331,_0x1b8129,_0x17a97f){var _0x4293f5;return db[_0x96f9('0x4c')][_0x96f9('0x50')]({'where':{'id':_0x109331[_0x96f9('0x4e')]['id']}})[_0x96f9('0x1d')](function(_0x3fc9d8){_0x4293f5=_0x3fc9d8;return _0x3fc9d8;})[_0x96f9('0x1d')](handleEntityNotFound(_0x1b8129,null))['then'](removeEntity(_0x1b8129,null))[_0x96f9('0x1d')](function(){if(_0x4293f5){return db[_0x96f9('0x4c')][_0x96f9('0x4d')]({'where':{'type':_0x4293f5[_0x96f9('0x38')]},'raw':!![]});}})[_0x96f9('0x1d')](function(_0x22965f){if(_0x4293f5[_0x96f9('0x38')][_0x96f9('0x54')]()==_0x96f9('0x55')){var _0x362209=fs[_0x96f9('0x56')](path[_0x96f9('0x5e')](config[_0x96f9('0x57')],'server/files/templates/stun_multiple.ejs'),_0x96f9('0x59'));var _0x2f7764=ejs[_0x96f9('0x5a')](_0x362209,{'networks':_0x22965f||[]});fs[_0x96f9('0x5b')](_0x96f9('0x65'),_0x2f7764);return respondWithRpcPromise('Reload',_0x96f9('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x4293f5[_0x96f9('0x38')]['toUpperCase']()==_0x96f9('0x5d')){var _0x17eba9=fs[_0x96f9('0x56')](path['join'](config[_0x96f9('0x57')],_0x96f9('0x5f')),_0x96f9('0x59'));var _0x4ef102=ejs[_0x96f9('0x5a')](_0x17eba9,{'networks':_0x22965f||[]});fs[_0x96f9('0x5b')](_0x96f9('0x69'),_0x4ef102);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x30'),{'module':_0x96f9('0x66')});}else{var _0x14c905=fs[_0x96f9('0x56')](path[_0x96f9('0x5e')](config[_0x96f9('0x57')],_0x96f9('0x68')),_0x96f9('0x59'));var _0x4231d7=ejs['render'](_0x14c905,{'networks':_0x22965f||[]});fs['writeFileSync'](util[_0x96f9('0x60')](_0x96f9('0x61'),_0x109331[_0x96f9('0x53')][_0x96f9('0x38')][_0x96f9('0x62')]()),_0x4231d7);return respondWithRpcPromise(_0x96f9('0x5c'),_0x96f9('0x30'),{'module':_0x96f9('0x63')});}return null;})[_0x96f9('0x25')](handleError(_0x1b8129,null));}; \ No newline at end of file +var _0xafdf=['Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','include','findAll','rows','show','params','includeAll','find','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','Reload','server/files/templates/network.ejs','format','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name'];(function(_0x246300,_0x4026b3){var _0x3f1472=function(_0x5d68fc){while(--_0x5d68fc){_0x246300['push'](_0x246300['shift']());}};_0x3f1472(++_0x4026b3);}(_0xafdf,0x165));var _0xfafd=function(_0x1fc947,_0x5f0b2c){_0x1fc947=_0x1fc947-0x0;var _0x5cc61a=_0xafdf[_0x1fc947];return _0x5cc61a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfafd('0x0'));var jsonpatch=require(_0xfafd('0x1'));var rp=require(_0xfafd('0x2'));var moment=require(_0xfafd('0x3'));var BPromise=require(_0xfafd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfafd('0x5'));var sox=require(_0xfafd('0x6'));var csv=require(_0xfafd('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfafd('0x8'));var squel=require(_0xfafd('0x9'));var crypto=require(_0xfafd('0xa'));var jsforce=require(_0xfafd('0xb'));var deskjs=require(_0xfafd('0xc'));var toCsv=require(_0xfafd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfafd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfafd('0xe'));var as=require(_0xfafd('0xf'));var hardwareService=require(_0xfafd('0x10'));var logger=require(_0xfafd('0x11'))(_0xfafd('0x12'));var utils=require(_0xfafd('0x13'));var config=require(_0xfafd('0x14'));var licenseUtil=require(_0xfafd('0x15'));var db=require(_0xfafd('0x16'))['db'];var jayson=require(_0xfafd('0x17'));var client=jayson[_0xfafd('0x18')][_0xfafd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x330eb7,_0x1b26da,_0x2c644c,_0x471780){return new BPromise(function(_0x41be0b,_0x570778){var _0xb71fbf=_0x471780||client;return _0xb71fbf[_0xfafd('0x1a')](_0x330eb7,_0x2c644c)[_0xfafd('0x1b')](function(_0x52ace4){logger[_0xfafd('0x1c')](_0xfafd('0x1d'),_0x1b26da,_0xfafd('0x1e'));logger[_0xfafd('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x1b26da,'request\x20sent',JSON[_0xfafd('0x20')](_0x52ace4));if(_0x52ace4[_0xfafd('0x21')]){if(_0x52ace4['error'][_0xfafd('0x22')]===0x1f4){logger[_0xfafd('0x21')](_0xfafd('0x1d'),_0x1b26da,_0x52ace4[_0xfafd('0x21')]['message']);return _0x570778(_0x52ace4[_0xfafd('0x21')][_0xfafd('0x23')]);}logger[_0xfafd('0x21')](_0xfafd('0x1d'),_0x1b26da,_0x52ace4[_0xfafd('0x21')]['message']);return _0x41be0b(_0x52ace4[_0xfafd('0x21')]['message']);}else{logger[_0xfafd('0x1c')](_0xfafd('0x1d'),_0x1b26da,'request\x20sent');_0x41be0b(_0x52ace4['result'][_0xfafd('0x23')]);}})[_0xfafd('0x24')](function(_0xdaf7ec){logger[_0xfafd('0x21')](_0xfafd('0x1d'),_0x1b26da,_0xdaf7ec);_0x570778(_0xdaf7ec);});});}function respondWithStatusCode(_0x396833,_0x49572f){_0x49572f=_0x49572f||0xcc;return function(_0x196916){if(_0x196916){return _0x396833[_0xfafd('0x25')](_0x49572f);}return _0x396833[_0xfafd('0x26')](_0x49572f)[_0xfafd('0x27')]();};}function respondWithResult(_0x122961,_0x3eb273){_0x3eb273=_0x3eb273||0xc8;return function(_0x153906){if(_0x153906){return _0x122961[_0xfafd('0x26')](_0x3eb273)[_0xfafd('0x28')](_0x153906);}};}function respondWithFilteredResult(_0x404331,_0x1f138a){return function(_0x116399){if(_0x116399){var _0x29f73f=_0x116399[_0xfafd('0x29')],_0x2493f5=_0x1f138a[_0xfafd('0x2a')],_0xac6120=_0x1f138a[_0xfafd('0x2a')]+_0x1f138a[_0xfafd('0x2b')],_0x40453d;if(_0xac6120>=_0x29f73f){_0xac6120=_0x29f73f;_0x40453d=0xc8;}else{_0x40453d=0xce;}_0x404331[_0xfafd('0x26')](_0x40453d);return _0x404331[_0xfafd('0x2c')](_0xfafd('0x2d'),_0x2493f5+'-'+_0xac6120+'/'+_0x29f73f)[_0xfafd('0x28')](_0x116399);}return null;};}function patchUpdates(_0x373d8a){return function(_0x3258c1){try{jsonpatch['apply'](_0x3258c1,_0x373d8a,!![]);}catch(_0x51cb9b){return BPromise['reject'](_0x51cb9b);}return _0x3258c1[_0xfafd('0x2e')]();};}function saveUpdates(_0x3bf886,_0x224625){return function(_0x2e9347){if(_0x2e9347){return _0x2e9347[_0xfafd('0x2f')](_0x3bf886)[_0xfafd('0x1b')](function(_0x22dd18){return _0x22dd18;});}return null;};}function removeEntity(_0x413401,_0x40ba4d){return function(_0x2bf090){if(_0x2bf090){return _0x2bf090[_0xfafd('0x30')]()[_0xfafd('0x1b')](function(){_0x413401['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe26f74,_0xae96ec){return function(_0x3b84fa){if(!_0x3b84fa){_0xe26f74['sendStatus'](0x194);}return _0x3b84fa;};}function handleError(_0xbfdd3,_0x5a6b1e){_0x5a6b1e=_0x5a6b1e||0x1f4;return function(_0x18622d){logger['error'](_0x18622d[_0xfafd('0x31')]);if(_0x18622d[_0xfafd('0x32')]){delete _0x18622d[_0xfafd('0x32')];}_0xbfdd3['status'](_0x5a6b1e)['send'](_0x18622d);};}exports['index']=function(_0x98b0dc,_0x356348){var _0x180e5e={},_0x597dd7={},_0x566f89={'count':0x0,'rows':[]};var _0x3da3e8=_['map'](db[_0xfafd('0x33')][_0xfafd('0x34')],function(_0x35113c){return{'name':_0x35113c[_0xfafd('0x35')],'type':_0x35113c[_0xfafd('0x36')][_0xfafd('0x37')]};});_0x597dd7[_0xfafd('0x38')]=_['map'](_0x3da3e8,_0xfafd('0x32'));_0x597dd7['query']=_[_0xfafd('0x39')](_0x98b0dc[_0xfafd('0x3a')]);_0x597dd7[_0xfafd('0x3b')]=_[_0xfafd('0x3c')](_0x597dd7[_0xfafd('0x38')],_0x597dd7[_0xfafd('0x3a')]);_0x180e5e[_0xfafd('0x3d')]=_[_0xfafd('0x3c')](_0x597dd7[_0xfafd('0x38')],qs[_0xfafd('0x3e')](_0x98b0dc[_0xfafd('0x3a')][_0xfafd('0x3e')]));_0x180e5e['attributes']=_0x180e5e['attributes'][_0xfafd('0x3f')]?_0x180e5e[_0xfafd('0x3d')]:_0x597dd7[_0xfafd('0x38')];if(!_0x98b0dc[_0xfafd('0x3a')][_0xfafd('0x40')]('nolimit')){_0x180e5e[_0xfafd('0x2b')]=qs[_0xfafd('0x2b')](_0x98b0dc[_0xfafd('0x3a')]['limit']);_0x180e5e['offset']=qs[_0xfafd('0x2a')](_0x98b0dc[_0xfafd('0x3a')][_0xfafd('0x2a')]);}_0x180e5e[_0xfafd('0x41')]=qs[_0xfafd('0x42')](_0x98b0dc['query'][_0xfafd('0x42')]);_0x180e5e[_0xfafd('0x43')]=qs[_0xfafd('0x3b')](_[_0xfafd('0x44')](_0x98b0dc[_0xfafd('0x3a')],_0x597dd7[_0xfafd('0x3b')]),_0x3da3e8);if(_0x98b0dc[_0xfafd('0x3a')][_0xfafd('0x45')]){_0x180e5e['where']=_[_0xfafd('0x46')](_0x180e5e[_0xfafd('0x43')],{'$or':_[_0xfafd('0x47')](_0x3da3e8,function(_0x4b9f07){if(_0x4b9f07[_0xfafd('0x36')]!=='VIRTUAL'){var _0x31b8c9={};_0x31b8c9[_0x4b9f07[_0xfafd('0x32')]]={'$like':'%'+_0x98b0dc[_0xfafd('0x3a')][_0xfafd('0x45')]+'%'};return _0x31b8c9;}})});}_0x180e5e=_[_0xfafd('0x46')]({},_0x180e5e,_0x98b0dc[_0xfafd('0x48')]);var _0x6db90a={'where':_0x180e5e[_0xfafd('0x43')]};return db['Network'][_0xfafd('0x29')](_0x6db90a)[_0xfafd('0x1b')](function(_0x21d48f){_0x566f89['count']=_0x21d48f;if(_0x98b0dc[_0xfafd('0x3a')]['includeAll']){_0x180e5e[_0xfafd('0x49')]=[{'all':!![]}];}return db[_0xfafd('0x33')][_0xfafd('0x4a')](_0x180e5e);})[_0xfafd('0x1b')](function(_0x3cbdf1){_0x566f89[_0xfafd('0x4b')]=_0x3cbdf1;return _0x566f89;})['then'](respondWithFilteredResult(_0x356348,_0x180e5e))[_0xfafd('0x24')](handleError(_0x356348,null));};exports[_0xfafd('0x4c')]=function(_0x2ccd20,_0x10c31b){var _0x5453f1={'raw':!![],'where':{'id':_0x2ccd20[_0xfafd('0x4d')]['id']}},_0x4f0952={};_0x4f0952['model']=_[_0xfafd('0x39')](db[_0xfafd('0x33')][_0xfafd('0x34')]);_0x4f0952['query']=_[_0xfafd('0x39')](_0x2ccd20[_0xfafd('0x3a')]);_0x4f0952['filters']=_[_0xfafd('0x3c')](_0x4f0952['model'],_0x4f0952[_0xfafd('0x3a')]);_0x5453f1['attributes']=_[_0xfafd('0x3c')](_0x4f0952[_0xfafd('0x38')],qs[_0xfafd('0x3e')](_0x2ccd20[_0xfafd('0x3a')]['fields']));_0x5453f1[_0xfafd('0x3d')]=_0x5453f1[_0xfafd('0x3d')][_0xfafd('0x3f')]?_0x5453f1['attributes']:_0x4f0952['model'];if(_0x2ccd20[_0xfafd('0x3a')][_0xfafd('0x4e')]){_0x5453f1[_0xfafd('0x49')]=[{'all':!![]}];}_0x5453f1=_[_0xfafd('0x46')]({},_0x5453f1,_0x2ccd20[_0xfafd('0x48')]);return db[_0xfafd('0x33')][_0xfafd('0x4f')](_0x5453f1)[_0xfafd('0x1b')](handleEntityNotFound(_0x10c31b,null))['then'](respondWithResult(_0x10c31b,null))[_0xfafd('0x24')](handleError(_0x10c31b,null));};exports[_0xfafd('0x50')]=function(_0x262de5,_0x3f79b0,_0x278ac6){var _0x54bddd;return db[_0xfafd('0x51')]['transaction'](function(_0x18e108){return db[_0xfafd('0x33')]['create'](_0x262de5['body'],{'raw':!![]})[_0xfafd('0x1b')](function(_0x2f27d6){_0x54bddd=_0x2f27d6;return db[_0xfafd('0x33')][_0xfafd('0x4a')]({'where':{'type':_0x262de5[_0xfafd('0x52')][_0xfafd('0x36')]},'raw':!![]});})[_0xfafd('0x1b')](function(_0x1f6e29){if(_0x54bddd[_0xfafd('0x36')][_0xfafd('0x53')]()==_0xfafd('0x54')){var _0x36b746=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],_0xfafd('0x58')),_0xfafd('0x59'));var _0x44a0c8=ejs['render'](_0x36b746,{'networks':_0x1f6e29||[]});fs[_0xfafd('0x5a')](_0xfafd('0x5b'),_0x44a0c8);return respondWithRpcPromise('Reload',_0xfafd('0x50'),{'module':_0xfafd('0x5c')});}else if(_0x54bddd[_0xfafd('0x36')]['toUpperCase']()==_0xfafd('0x5d')){var _0x1056f0=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],_0xfafd('0x5e')),_0xfafd('0x59'));var _0x251051=ejs[_0xfafd('0x5f')](_0x1056f0,{'networks':_0x1f6e29||[]});fs[_0xfafd('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x251051);return respondWithRpcPromise(_0xfafd('0x60'),_0xfafd('0x50'),{'module':_0xfafd('0x5c')});}else{var _0xf7de7d=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],_0xfafd('0x61')),_0xfafd('0x59'));var _0x3a23b1=ejs[_0xfafd('0x5f')](_0xf7de7d,{'networks':_0x1f6e29||[]});fs[_0xfafd('0x5a')](util[_0xfafd('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x262de5['body'][_0xfafd('0x36')]['toLowerCase']()),_0x3a23b1);return respondWithRpcPromise(_0xfafd('0x60'),_0xfafd('0x50'),{'module':_0xfafd('0x63')});}return null;})[_0xfafd('0x1b')](function(){return _0x54bddd;});})['then'](respondWithResult(_0x3f79b0,0xc9))[_0xfafd('0x24')](handleError(_0x3f79b0,null));};exports[_0xfafd('0x2f')]=function(_0x39df3c,_0x3e5244,_0x3cce3c){var _0xee67c7;return db[_0xfafd('0x51')]['transaction'](function(_0x56d994){return db[_0xfafd('0x33')][_0xfafd('0x4f')]({'where':{'id':_0x39df3c[_0xfafd('0x4d')]['id']}})[_0xfafd('0x1b')](handleEntityNotFound(_0x3e5244,null))[_0xfafd('0x1b')](saveUpdates(_0x39df3c['body'],null))[_0xfafd('0x1b')](function(_0x471260){if(_0x471260){_0xee67c7=_0x471260;return db[_0xfafd('0x33')][_0xfafd('0x4a')]({'where':{'type':_0xee67c7['type']},'raw':!![]});}return null;})[_0xfafd('0x1b')](function(_0x698fc9){if(_0xee67c7[_0xfafd('0x36')]['toUpperCase']()==_0xfafd('0x54')){var _0xfaf43=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],_0xfafd('0x58')),_0xfafd('0x59'));var _0x238966=ejs[_0xfafd('0x5f')](_0xfaf43,{'networks':_0x698fc9||[]});fs[_0xfafd('0x5a')](_0xfafd('0x5b'),_0x238966);return respondWithRpcPromise(_0xfafd('0x60'),_0xfafd('0x2f'),{'module':_0xfafd('0x5c')});}else if(_0xee67c7['type'][_0xfafd('0x53')]()==_0xfafd('0x5d')){var _0x30af8e=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],'server/files/templates/turn_multiple.ejs'),_0xfafd('0x59'));var _0x217535=ejs[_0xfafd('0x5f')](_0x30af8e,{'networks':_0x698fc9||[]});fs[_0xfafd('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x217535);return respondWithRpcPromise(_0xfafd('0x60'),_0xfafd('0x2f'),{'module':_0xfafd('0x5c')});}else{var _0x328a66=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],'server/files/templates/network.ejs'),'utf8');var _0x330509=ejs[_0xfafd('0x5f')](_0x328a66,{'networks':_0x698fc9||[]});fs[_0xfafd('0x5a')](util[_0xfafd('0x62')](_0xfafd('0x64'),_0x39df3c['body'][_0xfafd('0x36')][_0xfafd('0x65')]()),_0x330509);return respondWithRpcPromise(_0xfafd('0x60'),_0xfafd('0x2f'),{'module':_0xfafd('0x63')});}return null;})[_0xfafd('0x1b')](function(_0x18cdae){if(_0x18cdae){return _0xee67c7;}return null;});})[_0xfafd('0x1b')](respondWithResult(_0x3e5244,null))[_0xfafd('0x24')](handleError(_0x3e5244,null));};exports['destroy']=function(_0x59302c,_0x45374b,_0x21f36f){var _0x5ed419;return db[_0xfafd('0x33')]['find']({'where':{'id':_0x59302c[_0xfafd('0x4d')]['id']}})['then'](function(_0x1a286d){_0x5ed419=_0x1a286d;return _0x1a286d;})[_0xfafd('0x1b')](handleEntityNotFound(_0x45374b,null))['then'](removeEntity(_0x45374b,null))[_0xfafd('0x1b')](function(){if(_0x5ed419){return db[_0xfafd('0x33')]['findAll']({'where':{'type':_0x5ed419['type']},'raw':!![]});}})['then'](function(_0x10cb44){if(_0x5ed419[_0xfafd('0x36')][_0xfafd('0x53')]()==_0xfafd('0x54')){var _0x1d6172=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],_0xfafd('0x58')),_0xfafd('0x59'));var _0x566f3a=ejs['render'](_0x1d6172,{'networks':_0x10cb44||[]});fs[_0xfafd('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x566f3a);return respondWithRpcPromise('Reload',_0xfafd('0x30'),{'module':_0xfafd('0x5c')});}else if(_0x5ed419[_0xfafd('0x36')][_0xfafd('0x53')]()=='TURN'){var _0x57f5df=fs[_0xfafd('0x55')](path[_0xfafd('0x56')](config[_0xfafd('0x57')],_0xfafd('0x5e')),_0xfafd('0x59'));var _0x3ef3e5=ejs[_0xfafd('0x5f')](_0x57f5df,{'networks':_0x10cb44||[]});fs[_0xfafd('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x3ef3e5);return respondWithRpcPromise(_0xfafd('0x60'),_0xfafd('0x30'),{'module':_0xfafd('0x5c')});}else{var _0x2524b6=fs[_0xfafd('0x55')](path['join'](config[_0xfafd('0x57')],_0xfafd('0x61')),_0xfafd('0x59'));var _0x1ecd48=ejs[_0xfafd('0x5f')](_0x2524b6,{'networks':_0x10cb44||[]});fs[_0xfafd('0x5a')](util[_0xfafd('0x62')](_0xfafd('0x64'),_0x59302c['body'][_0xfafd('0x36')][_0xfafd('0x65')]()),_0x1ecd48);return respondWithRpcPromise(_0xfafd('0x60'),'destroy',{'module':_0xfafd('0x63')});}return null;})['catch'](handleError(_0x45374b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e43d794..0f93619 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 _0x88b9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Network','network','lodash'];(function(_0x57aa7e,_0x18d714){var _0x5ae7dd=function(_0x43a1b9){while(--_0x43a1b9){_0x57aa7e['push'](_0x57aa7e['shift']());}};_0x5ae7dd(++_0x18d714);}(_0x88b9,0x81));var _0x988b=function(_0x398b9a,_0x1d699b){_0x398b9a=_0x398b9a-0x0;var _0x43033b=_0x88b9[_0x398b9a];return _0x43033b;};'use strict';var _=require(_0x988b('0x0'));var util=require(_0x988b('0x1'));var logger=require(_0x988b('0x2'))(_0x988b('0x3'));var moment=require(_0x988b('0x4'));var BPromise=require(_0x988b('0x5'));var rp=require(_0x988b('0x6'));var fs=require('fs');var path=require(_0x988b('0x7'));var rimraf=require(_0x988b('0x8'));var config=require(_0x988b('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0xe38c7d,_0x46adc4){return _0xe38c7d[_0x988b('0xa')](_0x988b('0xb'),attributes,{'tableName':_0x988b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd088=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','define','Network','network'];(function(_0x5d7707,_0x29bb43){var _0x4ad29b=function(_0x26444b){while(--_0x26444b){_0x5d7707['push'](_0x5d7707['shift']());}};_0x4ad29b(++_0x29bb43);}(_0xd088,0x14a));var _0x8d08=function(_0x477adf,_0x3b2272){_0x477adf=_0x477adf-0x0;var _0xa62a36=_0xd088[_0x477adf];return _0xa62a36;};'use strict';var _=require('lodash');var util=require(_0x8d08('0x0'));var logger=require(_0x8d08('0x1'))(_0x8d08('0x2'));var moment=require(_0x8d08('0x3'));var BPromise=require(_0x8d08('0x4'));var rp=require(_0x8d08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d08('0x6'));var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x1b64eb,_0x2015c4){return _0x1b64eb[_0x8d08('0x7')](_0x8d08('0x8'),attributes,{'tableName':_0x8d08('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 b66a83b..1db7a60 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 _0x09f8=['client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x5af9ba,_0x30adfb){var _0x488c7c=function(_0x558245){while(--_0x558245){_0x5af9ba['push'](_0x5af9ba['shift']());}};_0x488c7c(++_0x30adfb);}(_0x09f8,0x117));var _0x809f=function(_0xfcb33d,_0x21748f){_0xfcb33d=_0xfcb33d-0x0;var _0x222854=_0x09f8[_0xfcb33d];return _0x222854;};'use strict';var _=require('lodash');var util=require(_0x809f('0x0'));var moment=require('moment');var BPromise=require(_0x809f('0x1'));var rs=require(_0x809f('0x2'));var fs=require('fs');var Redis=require(_0x809f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x809f('0x4'));var logger=require('../../config/logger')(_0x809f('0x5'));var config=require('../../config/environment');var jayson=require(_0x809f('0x6'));var client=jayson[_0x809f('0x7')][_0x809f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbbcd8e,_0x41119a,_0x1574eb){return new BPromise(function(_0x275347,_0x2c9bcf){return client[_0x809f('0x9')](_0xbbcd8e,_0x1574eb)[_0x809f('0xa')](function(_0x2f8cab){logger['info'](_0x809f('0xb'),_0x41119a,_0x809f('0xc'));logger[_0x809f('0xd')](_0x809f('0xe'),_0x41119a,_0x809f('0xc'),JSON[_0x809f('0xf')](_0x2f8cab));if(_0x2f8cab['error']){if(_0x2f8cab[_0x809f('0x10')][_0x809f('0x11')]===0x1f4){logger[_0x809f('0x10')]('Network,\x20%s,\x20%s',_0x41119a,_0x2f8cab[_0x809f('0x10')][_0x809f('0x12')]);return _0x2c9bcf(_0x2f8cab['error']['message']);}logger[_0x809f('0x10')](_0x809f('0xb'),_0x41119a,_0x2f8cab[_0x809f('0x10')][_0x809f('0x12')]);return _0x275347(_0x2f8cab[_0x809f('0x10')]['message']);}else{logger[_0x809f('0x13')](_0x809f('0xb'),_0x41119a,'request\x20sent');_0x275347(_0x2f8cab[_0x809f('0x14')][_0x809f('0x12')]);}})[_0x809f('0x15')](function(_0x34693c){logger['error']('Network,\x20%s,\x20%s',_0x41119a,_0x34693c);_0x2c9bcf(_0x34693c);});});} \ No newline at end of file +var _0x9edb=['rpc','jayson/promise','client','http','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3554f9,_0x2a5f35){var _0x253d8b=function(_0x291aac){while(--_0x291aac){_0x3554f9['push'](_0x3554f9['shift']());}};_0x253d8b(++_0x2a5f35);}(_0x9edb,0x148));var _0xb9ed=function(_0x1d605e,_0x1423c7){_0x1d605e=_0x1d605e-0x0;var _0x2d8942=_0x9edb[_0x1d605e];return _0x2d8942;};'use strict';var _=require(_0xb9ed('0x0'));var util=require(_0xb9ed('0x1'));var moment=require(_0xb9ed('0x2'));var BPromise=require(_0xb9ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9ed('0x4'));var db=require(_0xb9ed('0x5'))['db'];var utils=require(_0xb9ed('0x6'));var logger=require(_0xb9ed('0x7'))(_0xb9ed('0x8'));var config=require('../../config/environment');var jayson=require(_0xb9ed('0x9'));var client=jayson[_0xb9ed('0xa')][_0xb9ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ba26c,_0x5856d9,_0x2c7465){return new BPromise(function(_0x18e6a8,_0x591156){return client['request'](_0x2ba26c,_0x2c7465)[_0xb9ed('0xc')](function(_0x2dffb0){logger[_0xb9ed('0xd')]('Network,\x20%s,\x20%s',_0x5856d9,'request\x20sent');logger[_0xb9ed('0xe')](_0xb9ed('0xf'),_0x5856d9,_0xb9ed('0x10'),JSON[_0xb9ed('0x11')](_0x2dffb0));if(_0x2dffb0[_0xb9ed('0x12')]){if(_0x2dffb0[_0xb9ed('0x12')][_0xb9ed('0x13')]===0x1f4){logger['error'](_0xb9ed('0x14'),_0x5856d9,_0x2dffb0['error'][_0xb9ed('0x15')]);return _0x591156(_0x2dffb0[_0xb9ed('0x12')][_0xb9ed('0x15')]);}logger[_0xb9ed('0x12')](_0xb9ed('0x14'),_0x5856d9,_0x2dffb0[_0xb9ed('0x12')][_0xb9ed('0x15')]);return _0x18e6a8(_0x2dffb0[_0xb9ed('0x12')][_0xb9ed('0x15')]);}else{logger[_0xb9ed('0xd')]('Network,\x20%s,\x20%s',_0x5856d9,_0xb9ed('0x10'));_0x18e6a8(_0x2dffb0[_0xb9ed('0x16')][_0xb9ed('0x15')]);}})[_0xb9ed('0x17')](function(_0x2b3211){logger[_0xb9ed('0x12')]('Network,\x20%s,\x20%s',_0x5856d9,_0x2b3211);_0x591156(_0x2b3211);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index ede09bb..7c0a4f5 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 _0xf5fb=['../../config/environment','./notification.controller','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x14321f,_0x30cfeb){var _0xf3a60a=function(_0x40442b){while(--_0x40442b){_0x14321f['push'](_0x14321f['shift']());}};_0xf3a60a(++_0x30cfeb);}(_0xf5fb,0x15b));var _0xbf5f=function(_0xf418fc,_0x192745){_0xf418fc=_0xf418fc-0x0;var _0x4ff028=_0xf5fb[_0xf418fc];return _0x4ff028;};'use strict';var multer=require('multer');var util=require(_0xbf5f('0x0'));var path=require(_0xbf5f('0x1'));var timeout=require(_0xbf5f('0x2'));var express=require(_0xbf5f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbf5f('0x4'));var config=require(_0xbf5f('0x5'));var controller=require(_0xbf5f('0x6'));router['post']('/',auth['isAuthenticated'](),controller['sendNotification']);module[_0xbf5f('0x7')]=router; \ No newline at end of file +var _0x80a3=['Router','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','path','connect-timeout','express'];(function(_0x5eeb7d,_0x54a3ae){var _0x34b723=function(_0x4677bd){while(--_0x4677bd){_0x5eeb7d['push'](_0x5eeb7d['shift']());}};_0x34b723(++_0x54a3ae);}(_0x80a3,0x75));var _0x380a=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x80a3[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require(_0x380a('0x0'));var util=require('util');var path=require(_0x380a('0x1'));var timeout=require(_0x380a('0x2'));var express=require(_0x380a('0x3'));var router=express[_0x380a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x380a('0x5'));var config=require(_0x380a('0x6'));var controller=require(_0x380a('0x7'));router[_0x380a('0x8')]('/',auth[_0x380a('0x9')](),controller[_0x380a('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 3e69395..9094ce7 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 _0x457d=['TEXT','BOOLEAN','exports','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x457d,0x16a));var _0xd457=function(_0x5a6d79,_0x4aec84){_0x5a6d79=_0x5a6d79-0x0;var _0x103fc0=_0x457d[_0x5a6d79];return _0x103fc0;};'use strict';var Sequelize=require('sequelize');module[_0xd457('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xd457('0x1')]},'recipientsId':{'type':Sequelize[_0xd457('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd457('0x1')]},'beep':{'type':Sequelize[_0xd457('0x3')]}}; \ No newline at end of file +var _0x6949=['STRING','sequelize','TEXT'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x6949,0xa0));var _0x9694=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x6949[_0x5b740b];return _0x6f8f4e;};'use strict';var Sequelize=require(_0x9694('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x9694('0x1')]},'recipientsDescription':{'type':Sequelize[_0x9694('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index e1243c6..c40c7ea 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 _0xc4d8=['mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','emit','notification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','queue','Queue','ids','push','all','flatten','findOne','getAgents','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue'];(function(_0x791148,_0x56bbe3){var _0x4bd2f2=function(_0x41bf8f){while(--_0x41bf8f){_0x791148['push'](_0x791148['shift']());}};_0x4bd2f2(++_0x56bbe3);}(_0xc4d8,0x86));var _0x8c4d=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xc4d8[_0xc0a3d3];return _0x3386e8;};'use strict';var pdf=require(_0x8c4d('0x0'));var emlformat=require(_0x8c4d('0x1'));var rimraf=require(_0x8c4d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c4d('0x3'));var rp=require(_0x8c4d('0x4'));var moment=require('moment');var BPromise=require(_0x8c4d('0x5'));var Mustache=require(_0x8c4d('0x6'));var util=require(_0x8c4d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8c4d('0x8'));var ejs=require(_0x8c4d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8c4d('0xa'));var crypto=require(_0x8c4d('0xb'));var jsforce=require(_0x8c4d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8c4d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c4d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c4d('0xe'));var hardwareService=require(_0x8c4d('0xf'));var logger=require('../../config/logger')(_0x8c4d('0x10'));var utils=require('../../config/utils');var config=require(_0x8c4d('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8c4d('0x12')]=_[_0x8c4d('0x13')](config[_0x8c4d('0x12')],{'host':_0x8c4d('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8c4d('0x15'))[_0x8c4d('0x16')](socket);function respondWithStatusCode(_0x3c178b,_0x50e201){_0x50e201=_0x50e201||0xcc;return function(_0x250a7f){if(_0x250a7f){return _0x3c178b[_0x8c4d('0x17')](_0x50e201);}return _0x3c178b[_0x8c4d('0x18')](_0x50e201)[_0x8c4d('0x19')]();};}function respondWithResult(_0x2c7d11,_0x387e5b){_0x387e5b=_0x387e5b||0xc8;return function(_0x4d4977){if(_0x4d4977){return _0x2c7d11['status'](_0x387e5b)[_0x8c4d('0x1a')](_0x4d4977);}};}function respondWithFilteredResult(_0x5457fb,_0x2e7116){return function(_0x565430){if(_0x565430){var _0x10b82c=_0x565430[_0x8c4d('0x1b')],_0x2bbae5=_0x2e7116[_0x8c4d('0x1c')],_0x1fd3b0=_0x2e7116[_0x8c4d('0x1c')]+_0x2e7116[_0x8c4d('0x1d')],_0x41cc12;if(_0x1fd3b0>=_0x10b82c){_0x1fd3b0=_0x10b82c;_0x41cc12=0xc8;}else{_0x41cc12=0xce;}_0x5457fb['status'](_0x41cc12);return _0x5457fb[_0x8c4d('0x1e')](_0x8c4d('0x1f'),_0x2bbae5+'-'+_0x1fd3b0+'/'+_0x10b82c)['json'](_0x565430);}return null;};}function patchUpdates(_0x5f0f30){return function(_0x41fbc9){try{jsonpatch['apply'](_0x41fbc9,_0x5f0f30,!![]);}catch(_0x4f1bba){return BPromise[_0x8c4d('0x20')](_0x4f1bba);}return _0x41fbc9[_0x8c4d('0x21')]();};}function saveUpdates(_0x491778,_0x5ac429){return function(_0x7f4a4){if(_0x7f4a4){return _0x7f4a4[_0x8c4d('0x22')](_0x491778)['then'](function(_0x1da9e6){return _0x1da9e6;});}return null;};}function removeEntity(_0x1ac91c,_0x1725a6){return function(_0x58a13d){if(_0x58a13d){return _0x58a13d[_0x8c4d('0x23')]()[_0x8c4d('0x24')](function(){_0x1ac91c['status'](0xcc)[_0x8c4d('0x19')]();});}};}function handleEntityNotFound(_0x183dd5,_0x5752e7){return function(_0x2c6155){if(!_0x2c6155){_0x183dd5[_0x8c4d('0x17')](0x194);}return _0x2c6155;};}function handleError(_0x18b9db,_0x3239d9){_0x3239d9=_0x3239d9||0x1f4;return function(_0x39301a){logger[_0x8c4d('0x25')](_0x39301a[_0x8c4d('0x26')]);if(_0x39301a[_0x8c4d('0x27')]){delete _0x39301a['name'];}_0x18b9db[_0x8c4d('0x18')](_0x3239d9)[_0x8c4d('0x28')](_0x39301a);};}exports[_0x8c4d('0x29')]=function(_0x3c5376,_0x1d8ccf,_0x1d264c){if(!_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x2b')](_0x8c4d('0x2c'))&&!_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x2b')](_0x8c4d('0x2d'))){throw new db[(_0x8c4d('0x2e'))][(_0x8c4d('0x2f'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x2b')](_0x8c4d('0x2d'))&&!_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x2b')]('view')){throw new db[(_0x8c4d('0x2e'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x2b')]('recipients')){throw new db[(_0x8c4d('0x2e'))][(_0x8c4d('0x2f'))](_0x8c4d('0x30'));}else{try{var _0x588eee=JSON['parse'](_0x3c5376[_0x8c4d('0x2a')]['recipients']);}catch(_0x1d997e){logger['error'](_0x1d997e);throw new db['Sequelize']['ValidationError'](_0x8c4d('0x31'));}var _0x32d980=[_0x8c4d('0x32'),_0x8c4d('0x33'),_0x8c4d('0x34'),_0x8c4d('0x35'),_0x8c4d('0x36'),_0x8c4d('0x37'),_0x8c4d('0x38'),'team',_0x8c4d('0x39')];if(_['some'](_0x588eee,function(_0x1d60dd){return!_[_0x8c4d('0x3a')](_0x32d980,_0x1d60dd[_0x8c4d('0x3b')][_0x8c4d('0x3c')]());})){throw new db['Sequelize'][(_0x8c4d('0x2f'))](_0x8c4d('0x3d'));}}}var _0x2e2ad5={};_0x2e2ad5[_0x8c4d('0x3e')]=_0x3c5376[_0x8c4d('0x2a')]['hasOwnProperty']('senderName')?_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x3e')]:_0x3c5376[_0x8c4d('0x39')]['fullname'];_0x2e2ad5[_0x8c4d('0x3f')]=_[_0x8c4d('0x40')](_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x3f')])?null:_0x3c5376[_0x8c4d('0x2a')][_0x8c4d('0x3f')];_0x2e2ad5[_0x8c4d('0x41')]=_0x3c5376[_0x8c4d('0x2a')]['beep']||![];_0x2e2ad5[_0x8c4d('0x42')]=_0x3c5376[_0x8c4d('0x39')]['id'];return getContent(_0x3c5376[_0x8c4d('0x2a')])[_0x8c4d('0x24')](function(_0x78f914){_0x2e2ad5[_0x8c4d('0x2a')]=_0x78f914;return getRecipients(_0x588eee);})[_0x8c4d('0x24')](function(_0x2aaa6d){_0x2e2ad5[_0x8c4d('0x43')]=_[_0x8c4d('0x44')](_0x2aaa6d)[_0x8c4d('0x45')](',');return db[_0x8c4d('0x46')][_0x8c4d('0x47')](function(_0x39af9b){return db['Notification'][_0x8c4d('0x48')](_0x2e2ad5,{'raw':!![],'transaction':_0x39af9b})[_0x8c4d('0x24')](function(_0x281847){var _0x2328e7={'sender':_0x2e2ad5['senderName'],'description':_0x2e2ad5[_0x8c4d('0x3f')],'content':_0x2e2ad5[_0x8c4d('0x2a')],'beep':_0x2e2ad5[_0x8c4d('0x41')]};_0x2aaa6d[_0x8c4d('0x49')](function(_0x470f1d){_0x2328e7['recipient']=_0x470f1d;socket[_0x8c4d('0x4a')](_0x8c4d('0x4b'),_0x2328e7);});return _0x281847;});});})['then'](respondWithResult(_0x1d8ccf,0xc9))[_0x8c4d('0x4c')](handleError(_0x1d8ccf,null));};function getContent(_0x52dc62){return new BPromise(function(_0x1da63e,_0x3b9e09){if(_0x52dc62['text']){_0x1da63e(_0x52dc62['text']);return;}return db['Template']['findOne']({'attributes':[_0x8c4d('0x4d')],'where':{'id':_0x52dc62[_0x8c4d('0x2d')]},'raw':!![]})[_0x8c4d('0x24')](function(_0x3c935d){if(!_0x3c935d)throw new db[(_0x8c4d('0x2e'))][(_0x8c4d('0x2f'))](_0x8c4d('0x4e'));var _0x416adb=Mustache[_0x8c4d('0x4f')](_0x3c935d['html'],_0x52dc62[_0x8c4d('0x50')]);_0x1da63e(_0x416adb);})[_0x8c4d('0x4c')](function(_0x1a4d83){_0x3b9e09(_0x1a4d83);});});}function getRecipients(_0x2e923c){return new BPromise(function(_0x51f35f,_0xedb87d){var _0x5e74c7=[];var _0x300899=[];_0x2e923c[_0x8c4d('0x49')](function(_0x372bfe){var _0x18458c=_[_0x8c4d('0x51')](_0x372bfe[_0x8c4d('0x3b')][_0x8c4d('0x3c')]());if(_0x18458c===_0x8c4d('0x52')){_0x5e74c7=_[_0x8c4d('0x53')](_0x5e74c7,_0x372bfe['ids']);}else{if(_[_0x8c4d('0x3a')](_0x18458c,_0x8c4d('0x54')))_0x18458c=_0x18458c['replace']('queue',_0x8c4d('0x55'));_0x372bfe[_0x8c4d('0x56')][_0x8c4d('0x49')](function(_0x178f25){_0x300899[_0x8c4d('0x57')](getAgents(_0x18458c,_0x178f25));});}});return BPromise[_0x8c4d('0x58')](_0x300899)[_0x8c4d('0x24')](function(_0xcea045){_0x5e74c7=_[_0x8c4d('0x53')](_0x5e74c7,_[_0x8c4d('0x59')](_0xcea045));_0x51f35f(_0x5e74c7);})[_0x8c4d('0x4c')](function(_0x50f2dc){_0xedb87d(_0x50f2dc);});});}function getAgents(_0x2784b1,_0x4dc0b9){return new BPromise(function(_0x207aa4,_0x4f6540){return db[_0x2784b1][_0x8c4d('0x5a')]({'where':{'id':_0x4dc0b9}})[_0x8c4d('0x24')](function(_0x138033){return _0x138033[_0x8c4d('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a15ff){var _0x2b0dd6=_[_0x8c4d('0x5c')](_0x2a15ff,'id');_0x207aa4(_0x2b0dd6);});})[_0x8c4d('0x4c')](function(_0x1cd6c5){_0x4f6540(_0x1cd6c5);});});} \ No newline at end of file +var _0xaa76=['request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','count','offset','limit','set','apply','reject','save','then','error','name','send','hasOwnProperty','TemplateId','ValidationError','body','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','recipient','emit','notification:send','catch','text','html','render','forEach','startCase','User','union','ids','queue','Queue','push','all','flatten','findOne','getAgents','html-pdf','eml-format','rimraf'];(function(_0x8b2dfb,_0x1639d3){var _0x372ceb=function(_0x3fc23c){while(--_0x3fc23c){_0x8b2dfb['push'](_0x8b2dfb['shift']());}};_0x372ceb(++_0x1639d3);}(_0xaa76,0xbb));var _0x6aa7=function(_0x5530f2,_0x354fcb){_0x5530f2=_0x5530f2-0x0;var _0x3a2515=_0xaa76[_0x5530f2];return _0x3a2515;};'use strict';var pdf=require(_0x6aa7('0x0'));var emlformat=require(_0x6aa7('0x1'));var rimraf=require(_0x6aa7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6aa7('0x3'));var moment=require('moment');var BPromise=require(_0x6aa7('0x4'));var Mustache=require(_0x6aa7('0x5'));var util=require('util');var path=require(_0x6aa7('0x6'));var sox=require(_0x6aa7('0x7'));var csv=require(_0x6aa7('0x8'));var ejs=require(_0x6aa7('0x9'));var fs=require('fs');var _=require(_0x6aa7('0xa'));var squel=require(_0x6aa7('0xb'));var crypto=require(_0x6aa7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6aa7('0x8'));var querystring=require('querystring');var Papa=require(_0x6aa7('0xd'));var Redis=require('ioredis');var authService=require(_0x6aa7('0xe'));var qs=require(_0x6aa7('0xf'));var as=require(_0x6aa7('0x10'));var hardwareService=require(_0x6aa7('0x11'));var logger=require(_0x6aa7('0x12'))(_0x6aa7('0x13'));var utils=require(_0x6aa7('0x14'));var config=require(_0x6aa7('0x15'));var licenseUtil=require(_0x6aa7('0x16'));var db=require(_0x6aa7('0x17'))['db'];config['redis']=_['defaults'](config[_0x6aa7('0x18')],{'host':_0x6aa7('0x19'),'port':0x18eb});var socket=require(_0x6aa7('0x1a'))(new Redis(config['redis']));require('./notification.socket')[_0x6aa7('0x1b')](socket);function respondWithStatusCode(_0x50ba79,_0x7cf315){_0x7cf315=_0x7cf315||0xcc;return function(_0x232310){if(_0x232310){return _0x50ba79[_0x6aa7('0x1c')](_0x7cf315);}return _0x50ba79['status'](_0x7cf315)[_0x6aa7('0x1d')]();};}function respondWithResult(_0x1a888c,_0xc9ab50){_0xc9ab50=_0xc9ab50||0xc8;return function(_0x5b41d4){if(_0x5b41d4){return _0x1a888c[_0x6aa7('0x1e')](_0xc9ab50)['json'](_0x5b41d4);}};}function respondWithFilteredResult(_0x207495,_0x171564){return function(_0x5a9d06){if(_0x5a9d06){var _0x48c727=_0x5a9d06[_0x6aa7('0x1f')],_0x2e4c87=_0x171564['offset'],_0x154aca=_0x171564[_0x6aa7('0x20')]+_0x171564[_0x6aa7('0x21')],_0x1e17c0;if(_0x154aca>=_0x48c727){_0x154aca=_0x48c727;_0x1e17c0=0xc8;}else{_0x1e17c0=0xce;}_0x207495[_0x6aa7('0x1e')](_0x1e17c0);return _0x207495[_0x6aa7('0x22')]('Content-Range',_0x2e4c87+'-'+_0x154aca+'/'+_0x48c727)['json'](_0x5a9d06);}return null;};}function patchUpdates(_0x42464a){return function(_0x36dac8){try{jsonpatch[_0x6aa7('0x23')](_0x36dac8,_0x42464a,!![]);}catch(_0x4dcb94){return BPromise[_0x6aa7('0x24')](_0x4dcb94);}return _0x36dac8[_0x6aa7('0x25')]();};}function saveUpdates(_0x4c7bf3,_0x19bccb){return function(_0x1868c2){if(_0x1868c2){return _0x1868c2['update'](_0x4c7bf3)[_0x6aa7('0x26')](function(_0xc27181){return _0xc27181;});}return null;};}function removeEntity(_0x75b5e1,_0x3e775d){return function(_0xef83b1){if(_0xef83b1){return _0xef83b1['destroy']()[_0x6aa7('0x26')](function(){_0x75b5e1[_0x6aa7('0x1e')](0xcc)[_0x6aa7('0x1d')]();});}};}function handleEntityNotFound(_0x530bc8,_0xb63c5b){return function(_0x265609){if(!_0x265609){_0x530bc8[_0x6aa7('0x1c')](0x194);}return _0x265609;};}function handleError(_0x510743,_0x8ad2e2){_0x8ad2e2=_0x8ad2e2||0x1f4;return function(_0x4ca8bc){logger[_0x6aa7('0x27')](_0x4ca8bc['stack']);if(_0x4ca8bc[_0x6aa7('0x28')]){delete _0x4ca8bc[_0x6aa7('0x28')];}_0x510743[_0x6aa7('0x1e')](_0x8ad2e2)[_0x6aa7('0x29')](_0x4ca8bc);};}exports['sendNotification']=function(_0x467c33,_0x1f090b,_0x40390a){if(!_0x467c33['body'][_0x6aa7('0x2a')]('text')&&!_0x467c33['body']['hasOwnProperty'](_0x6aa7('0x2b'))){throw new db['Sequelize'][(_0x6aa7('0x2c'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x2a')](_0x6aa7('0x2b'))&&!_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x2a')](_0x6aa7('0x2e'))){throw new db[(_0x6aa7('0x2f'))][(_0x6aa7('0x2c'))](_0x6aa7('0x30'));}if(!_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x2a')](_0x6aa7('0x31'))){throw new db['Sequelize'][(_0x6aa7('0x2c'))](_0x6aa7('0x32'));}else{try{var _0x1f327f=JSON['parse'](_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x31')]);}catch(_0x561c99){logger[_0x6aa7('0x27')](_0x561c99);throw new db[(_0x6aa7('0x2f'))][(_0x6aa7('0x2c'))](_0x6aa7('0x33'));}var _0x2352a=[_0x6aa7('0x34'),_0x6aa7('0x35'),_0x6aa7('0x36'),_0x6aa7('0x37'),_0x6aa7('0x38'),'voicequeue',_0x6aa7('0x39'),_0x6aa7('0x3a'),_0x6aa7('0x3b')];if(_[_0x6aa7('0x3c')](_0x1f327f,function(_0x4db181){return!_[_0x6aa7('0x3d')](_0x2352a,_0x4db181[_0x6aa7('0x3e')][_0x6aa7('0x3f')]());})){throw new db[(_0x6aa7('0x2f'))][(_0x6aa7('0x2c'))](_0x6aa7('0x40'));}}}var _0x1a9f4a={};_0x1a9f4a[_0x6aa7('0x41')]=_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x2a')](_0x6aa7('0x41'))?_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x41')]:_0x467c33[_0x6aa7('0x3b')][_0x6aa7('0x42')];_0x1a9f4a[_0x6aa7('0x43')]=_[_0x6aa7('0x44')](_0x467c33[_0x6aa7('0x2d')]['recipientsDescription'])?null:_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x43')];_0x1a9f4a[_0x6aa7('0x45')]=_0x467c33[_0x6aa7('0x2d')][_0x6aa7('0x45')]||![];_0x1a9f4a[_0x6aa7('0x46')]=_0x467c33[_0x6aa7('0x3b')]['id'];return getContent(_0x467c33[_0x6aa7('0x2d')])[_0x6aa7('0x26')](function(_0x31f67f){_0x1a9f4a[_0x6aa7('0x2d')]=_0x31f67f;return getRecipients(_0x1f327f);})[_0x6aa7('0x26')](function(_0x259776){_0x1a9f4a[_0x6aa7('0x47')]=_[_0x6aa7('0x48')](_0x259776)['join'](',');return db[_0x6aa7('0x49')][_0x6aa7('0x4a')](function(_0x2ed8b8){return db['Notification'][_0x6aa7('0x4b')](_0x1a9f4a,{'raw':!![],'transaction':_0x2ed8b8})[_0x6aa7('0x26')](function(_0x4aac64){var _0x1ee2bb={'sender':_0x1a9f4a[_0x6aa7('0x41')],'description':_0x1a9f4a[_0x6aa7('0x43')],'content':_0x1a9f4a[_0x6aa7('0x2d')],'beep':_0x1a9f4a[_0x6aa7('0x45')]};_0x259776['forEach'](function(_0x2bf5a4){_0x1ee2bb[_0x6aa7('0x4c')]=_0x2bf5a4;socket[_0x6aa7('0x4d')](_0x6aa7('0x4e'),_0x1ee2bb);});return _0x4aac64;});});})[_0x6aa7('0x26')](respondWithResult(_0x1f090b,0xc9))[_0x6aa7('0x4f')](handleError(_0x1f090b,null));};function getContent(_0x5381f3){return new BPromise(function(_0x48448f,_0x4f6cdb){if(_0x5381f3['text']){_0x48448f(_0x5381f3[_0x6aa7('0x50')]);return;}return db['Template']['findOne']({'attributes':[_0x6aa7('0x51')],'where':{'id':_0x5381f3['TemplateId']},'raw':!![]})[_0x6aa7('0x26')](function(_0x8a71e6){if(!_0x8a71e6)throw new db[(_0x6aa7('0x2f'))][(_0x6aa7('0x2c'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x58c676=Mustache[_0x6aa7('0x52')](_0x8a71e6['html'],_0x5381f3[_0x6aa7('0x2e')]);_0x48448f(_0x58c676);})[_0x6aa7('0x4f')](function(_0x472431){_0x4f6cdb(_0x472431);});});}function getRecipients(_0x2f4c71){return new BPromise(function(_0x257b8f,_0x3d8de6){var _0x1f4937=[];var _0x3157b7=[];_0x2f4c71[_0x6aa7('0x53')](function(_0x56352b){var _0x43c726=_[_0x6aa7('0x54')](_0x56352b['model']['toLowerCase']());if(_0x43c726===_0x6aa7('0x55')){_0x1f4937=_[_0x6aa7('0x56')](_0x1f4937,_0x56352b[_0x6aa7('0x57')]);}else{if(_[_0x6aa7('0x3d')](_0x43c726,_0x6aa7('0x58')))_0x43c726=_0x43c726['replace'](_0x6aa7('0x58'),_0x6aa7('0x59'));_0x56352b['ids'][_0x6aa7('0x53')](function(_0x31600c){_0x3157b7[_0x6aa7('0x5a')](getAgents(_0x43c726,_0x31600c));});}});return BPromise[_0x6aa7('0x5b')](_0x3157b7)['then'](function(_0x33f91e){_0x1f4937=_[_0x6aa7('0x56')](_0x1f4937,_[_0x6aa7('0x5c')](_0x33f91e));_0x257b8f(_0x1f4937);})[_0x6aa7('0x4f')](function(_0x93ea1){_0x3d8de6(_0x93ea1);});});}function getAgents(_0x3e4b82,_0x18e4af){return new BPromise(function(_0x2fc44a,_0x2f3255){return db[_0x3e4b82][_0x6aa7('0x5d')]({'where':{'id':_0x18e4af}})[_0x6aa7('0x26')](function(_0x176f8d){return _0x176f8d[_0x6aa7('0x5e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12d204){var _0x20b608=_['map'](_0x12d204,'id');_0x2fc44a(_0x20b608);});})['catch'](function(_0x17ec10){_0x2f3255(_0x17ec10);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 62a200f..fbbd9f1 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x6b4504,_0x53a1a){var _0x72365a=function(_0xb40368){while(--_0xb40368){_0x6b4504['push'](_0x6b4504['shift']());}};_0x72365a(++_0x53a1a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x276760,_0x4862fa){var _0x561939=function(_0x57adfb){while(--_0x57adfb){_0x276760['push'](_0x276760['shift']());}};_0x561939(++_0x4862fa);}(_0xb10b,0x12a));var _0xbb10=function(_0x40fede,_0x203a11){_0x40fede=_0x40fede-0x0;var _0x482694=_0xb10b[_0x40fede];return _0x482694;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](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 6263804..efb080f 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 _0x6476=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4_unicode_ci','lodash'];(function(_0x53cc86,_0x3215c5){var _0x55a219=function(_0x4717ef){while(--_0x4717ef){_0x53cc86['push'](_0x53cc86['shift']());}};_0x55a219(++_0x3215c5);}(_0x6476,0x12a));var _0x6647=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x6476[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x6647('0x0'));var util=require(_0x6647('0x1'));var logger=require('../../config/logger')(_0x6647('0x2'));var moment=require(_0x6647('0x3'));var BPromise=require(_0x6647('0x4'));var rp=require(_0x6647('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6647('0x6'));var config=require(_0x6647('0x7'));var attributes=require(_0x6647('0x8'));module[_0x6647('0x9')]=function(_0x505359,_0x4b9d0e){return _0x505359['define'](_0x6647('0xa'),attributes,{'tableName':_0x6647('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6647('0xc')});}; \ No newline at end of file +var _0xd7c7=['moment','request-promise','rimraf','../../config/environment','./notification.attributes','define','Notification','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x24e7c5,_0x598635){var _0x1a6d81=function(_0x518673){while(--_0x518673){_0x24e7c5['push'](_0x24e7c5['shift']());}};_0x1a6d81(++_0x598635);}(_0xd7c7,0x195));var _0x7d7c=function(_0x23bb46,_0x55f444){_0x23bb46=_0x23bb46-0x0;var _0x3eb9ff=_0xd7c7[_0x23bb46];return _0x3eb9ff;};'use strict';var _=require(_0x7d7c('0x0'));var util=require(_0x7d7c('0x1'));var logger=require(_0x7d7c('0x2'))('api');var moment=require(_0x7d7c('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d7c('0x5'));var config=require(_0x7d7c('0x6'));var attributes=require(_0x7d7c('0x7'));module['exports']=function(_0x130436,_0x2606e9){return _0x130436[_0x7d7c('0x8')](_0x7d7c('0x9'),attributes,{'tableName':_0x7d7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d7c('0xb')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index dda4779..1e5ddfd 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 _0x5b53=['debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','info','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0x5b53,0x1b0));var _0x35b5=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x5b53[_0x502598];return _0xbdee21;};'use strict';var _=require('lodash');var util=require(_0x35b5('0x0'));var moment=require(_0x35b5('0x1'));var BPromise=require(_0x35b5('0x2'));var rs=require(_0x35b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b5('0x4'))['db'];var utils=require(_0x35b5('0x5'));var logger=require('../../config/logger')(_0x35b5('0x6'));var config=require(_0x35b5('0x7'));var jayson=require(_0x35b5('0x8'));var client=jayson[_0x35b5('0x9')]['http']({'port':0x232a});config[_0x35b5('0xa')]=_[_0x35b5('0xb')](config[_0x35b5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x35b5('0xc'))(new Redis(config[_0x35b5('0xa')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x1c8644,_0x55e167,_0x1947d5){return new BPromise(function(_0x4f8754,_0x5d5eaf){return client[_0x35b5('0xd')](_0x1c8644,_0x1947d5)[_0x35b5('0xe')](function(_0x3224cb){logger[_0x35b5('0xf')](_0x35b5('0x10'),_0x55e167,_0x35b5('0x11'));logger[_0x35b5('0x12')](_0x35b5('0x13'),_0x55e167,'request\x20sent',JSON['stringify'](_0x3224cb));if(_0x3224cb[_0x35b5('0x14')]){if(_0x3224cb['error'][_0x35b5('0x15')]===0x1f4){logger[_0x35b5('0x14')](_0x35b5('0x10'),_0x55e167,_0x3224cb[_0x35b5('0x14')][_0x35b5('0x16')]);return _0x5d5eaf(_0x3224cb[_0x35b5('0x14')][_0x35b5('0x16')]);}logger[_0x35b5('0x14')](_0x35b5('0x10'),_0x55e167,_0x3224cb[_0x35b5('0x14')][_0x35b5('0x16')]);return _0x4f8754(_0x3224cb[_0x35b5('0x14')][_0x35b5('0x16')]);}else{logger[_0x35b5('0xf')](_0x35b5('0x10'),_0x55e167,_0x35b5('0x11'));_0x4f8754(_0x3224cb[_0x35b5('0x17')][_0x35b5('0x16')]);}})[_0x35b5('0x18')](function(_0x28a6fa){logger[_0x35b5('0x14')](_0x35b5('0x10'),_0x55e167,_0x28a6fa);_0x5d5eaf(_0x28a6fa);});});} \ No newline at end of file +var _0xd6b1=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd6b1,0x194));var _0x1d6b=function(_0xe42cb0,_0x318854){_0xe42cb0=_0xe42cb0-0x0;var _0x432cc9=_0xd6b1[_0xe42cb0];return _0x432cc9;};'use strict';var _=require(_0x1d6b('0x0'));var util=require(_0x1d6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d6b('0x2'));var fs=require('fs');var Redis=require(_0x1d6b('0x3'));var db=require(_0x1d6b('0x4'))['db'];var utils=require(_0x1d6b('0x5'));var logger=require(_0x1d6b('0x6'))('rpc');var config=require(_0x1d6b('0x7'));var jayson=require(_0x1d6b('0x8'));var client=jayson[_0x1d6b('0x9')][_0x1d6b('0xa')]({'port':0x232a});config['redis']=_[_0x1d6b('0xb')](config[_0x1d6b('0xc')],{'host':_0x1d6b('0xd'),'port':0x18eb});var socket=require(_0x1d6b('0xe'))(new Redis(config[_0x1d6b('0xc')]));require(_0x1d6b('0xf'))[_0x1d6b('0x10')](socket);function respondWithRpcPromise(_0x1ca843,_0x48fd03,_0x1eab65){return new BPromise(function(_0x442d54,_0x3e9b57){return client['request'](_0x1ca843,_0x1eab65)[_0x1d6b('0x11')](function(_0x109883){logger[_0x1d6b('0x12')](_0x1d6b('0x13'),_0x48fd03,_0x1d6b('0x14'));logger[_0x1d6b('0x15')]('Notification,\x20%s,\x20%s,\x20%s',_0x48fd03,'request\x20sent',JSON[_0x1d6b('0x16')](_0x109883));if(_0x109883[_0x1d6b('0x17')]){if(_0x109883[_0x1d6b('0x17')]['code']===0x1f4){logger[_0x1d6b('0x17')]('Notification,\x20%s,\x20%s',_0x48fd03,_0x109883['error']['message']);return _0x3e9b57(_0x109883[_0x1d6b('0x17')][_0x1d6b('0x18')]);}logger['error'](_0x1d6b('0x13'),_0x48fd03,_0x109883['error']['message']);return _0x442d54(_0x109883['error'][_0x1d6b('0x18')]);}else{logger[_0x1d6b('0x12')](_0x1d6b('0x13'),_0x48fd03,_0x1d6b('0x14'));_0x442d54(_0x109883[_0x1d6b('0x19')]['message']);}})[_0x1d6b('0x1a')](function(_0x2ebeda){logger[_0x1d6b('0x17')](_0x1d6b('0x13'),_0x48fd03,_0x2ebeda);_0x3e9b57(_0x2ebeda);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index ff0fbf0..4411b86 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 _0x2abb=['notification:','./notification.events','save','update','removeListener','register','length'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x2abb,0x189));var _0xb2ab=function(_0x4cd1c8,_0xa37b1){_0x4cd1c8=_0x4cd1c8-0x0;var _0x140d84=_0x2abb[_0x4cd1c8];return _0x140d84;};'use strict';var NotificationEvents=require(_0xb2ab('0x0'));var events=[_0xb2ab('0x1'),'remove',_0xb2ab('0x2')];function createListener(_0x4dd2f2,_0x346fe9){return function(_0x5e9cb6){_0x346fe9['emit'](_0x4dd2f2,_0x5e9cb6);};}function removeListener(_0x445fea,_0x28d2a7){return function(){NotificationEvents[_0xb2ab('0x3')](_0x445fea,_0x28d2a7);};}exports[_0xb2ab('0x4')]=function(_0x36bc23){for(var _0x14663d=0x0,_0x1f6c61=events[_0xb2ab('0x5')];_0x14663d<_0x1f6c61;_0x14663d++){var _0x9600a2=events[_0x14663d];var _0x5ee268=createListener(_0xb2ab('0x6')+_0x9600a2,_0x36bc23);NotificationEvents['on'](_0x9600a2,_0x5ee268);}}; \ No newline at end of file +var _0xd53e=['./notification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4cb92e,_0x3baa14){var _0x5acf49=function(_0x5cef32){while(--_0x5cef32){_0x4cb92e['push'](_0x4cb92e['shift']());}};_0x5acf49(++_0x3baa14);}(_0xd53e,0x130));var _0xed53=function(_0x2594f6,_0x45931d){_0x2594f6=_0x2594f6-0x0;var _0x2d3299=_0xd53e[_0x2594f6];return _0x2d3299;};'use strict';var NotificationEvents=require(_0xed53('0x0'));var events=[_0xed53('0x1'),_0xed53('0x2'),_0xed53('0x3')];function createListener(_0x51389c,_0x422ae1){return function(_0x2dbc72){_0x422ae1[_0xed53('0x4')](_0x51389c,_0x2dbc72);};}function removeListener(_0x2b193b,_0x1ffac1){return function(){NotificationEvents[_0xed53('0x5')](_0x2b193b,_0x1ffac1);};}exports[_0xed53('0x6')]=function(_0x198b54){for(var _0x598dab=0x0,_0x1da0a7=events[_0xed53('0x7')];_0x598dab<_0x1da0a7;_0x598dab++){var _0x2fd437=events[_0x598dab];var _0x4ac9cb=createListener('notification:'+_0x2fd437,_0x198b54);NotificationEvents['on'](_0x2fd437,_0x4ac9cb);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 5abca4d..0a30041 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 _0x8f5d=['connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path'];(function(_0xfa4ea9,_0x1ff442){var _0x4e72be=function(_0x3bd185){while(--_0x3bd185){_0xfa4ea9['push'](_0xfa4ea9['shift']());}};_0x4e72be(++_0x1ff442);}(_0x8f5d,0xd6));var _0xd8f5=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8f5d[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0xd8f5('0x0'));var util=require('util');var path=require(_0xd8f5('0x1'));var timeout=require(_0xd8f5('0x2'));var express=require(_0xd8f5('0x3'));var router=express['Router']();var auth=require(_0xd8f5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xd8f5('0x5')]('/',auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x7')]);router[_0xd8f5('0x5')](_0xd8f5('0x8'),auth[_0xd8f5('0x6')](),controller['describe']);router[_0xd8f5('0x5')](_0xd8f5('0x9'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0xa')]);router[_0xd8f5('0x5')](_0xd8f5('0xb'),auth[_0xd8f5('0x6')](),controller['getDispositions']);router[_0xd8f5('0x5')](_0xd8f5('0xc'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0xd')]);router[_0xd8f5('0x5')](_0xd8f5('0xe'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0xf')]);router[_0xd8f5('0x5')](_0xd8f5('0x10'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x11')]);router[_0xd8f5('0x5')](_0xd8f5('0x12'),auth[_0xd8f5('0x6')](),controller['getAgents']);router[_0xd8f5('0x13')]('/',auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x14')]);router['post'](_0xd8f5('0xb'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x15')]);router[_0xd8f5('0x13')](_0xd8f5('0xc'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x16')]);router[_0xd8f5('0x13')](_0xd8f5('0x17'),controller[_0xd8f5('0x18')]);router[_0xd8f5('0x13')](_0xd8f5('0xe'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x19')]);router[_0xd8f5('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xd8f5('0x1a')]);router['post'](_0xd8f5('0x1b'),auth['isAuthenticated'](),controller[_0xd8f5('0x1c')]);router[_0xd8f5('0x1d')]('/:id',auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x1e')]);router['delete'](_0xd8f5('0x9'),auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x1f')]);router[_0xd8f5('0x20')]('/:id/dispositions',auth[_0xd8f5('0x6')](),controller[_0xd8f5('0x21')]);router[_0xd8f5('0x20')]('/:id/canned_answers',auth[_0xd8f5('0x6')](),controller['removeAnswers']);router['delete'](_0xd8f5('0x12'),auth['isAuthenticated'](),controller[_0xd8f5('0x22')]);module[_0xd8f5('0x23')]=router; \ No newline at end of file +var _0x3883=['../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','notify','addApplications','/:id/send','put','update','delete','destroy','/:id/dispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x60535b,_0xe9972c){var _0x308bbf=function(_0x593daa){while(--_0x593daa){_0x60535b['push'](_0x60535b['shift']());}};_0x308bbf(++_0xe9972c);}(_0x3883,0xfd));var _0x3388=function(_0x51ce59,_0x390a50){_0x51ce59=_0x51ce59-0x0;var _0x10c0b0=_0x3883[_0x51ce59];return _0x10c0b0;};'use strict';var multer=require(_0x3388('0x0'));var util=require(_0x3388('0x1'));var path=require(_0x3388('0x2'));var timeout=require(_0x3388('0x3'));var express=require(_0x3388('0x4'));var router=express[_0x3388('0x5')]();var auth=require(_0x3388('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3388('0x7'));var controller=require(_0x3388('0x8'));router[_0x3388('0x9')]('/',auth[_0x3388('0xa')](),controller[_0x3388('0xb')]);router[_0x3388('0x9')](_0x3388('0xc'),auth[_0x3388('0xa')](),controller[_0x3388('0xd')]);router[_0x3388('0x9')](_0x3388('0xe'),auth[_0x3388('0xa')](),controller[_0x3388('0xf')]);router[_0x3388('0x9')]('/:id/dispositions',auth[_0x3388('0xa')](),controller[_0x3388('0x10')]);router[_0x3388('0x9')](_0x3388('0x11'),auth['isAuthenticated'](),controller[_0x3388('0x12')]);router[_0x3388('0x9')](_0x3388('0x13'),auth[_0x3388('0xa')](),controller[_0x3388('0x14')]);router[_0x3388('0x9')]('/:id/interactions',auth[_0x3388('0xa')](),controller[_0x3388('0x15')]);router[_0x3388('0x9')](_0x3388('0x16'),auth['isAuthenticated'](),controller[_0x3388('0x17')]);router[_0x3388('0x18')]('/',auth['isAuthenticated'](),controller[_0x3388('0x19')]);router[_0x3388('0x18')]('/:id/dispositions',auth[_0x3388('0xa')](),controller[_0x3388('0x1a')]);router['post'](_0x3388('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x3388('0x18')]('/:id/notify',controller[_0x3388('0x1b')]);router[_0x3388('0x18')](_0x3388('0x13'),auth['isAuthenticated'](),controller[_0x3388('0x1c')]);router[_0x3388('0x18')](_0x3388('0x16'),auth[_0x3388('0xa')](),controller['addAgents']);router[_0x3388('0x18')](_0x3388('0x1d'),auth[_0x3388('0xa')](),controller['send']);router[_0x3388('0x1e')](_0x3388('0xe'),auth[_0x3388('0xa')](),controller[_0x3388('0x1f')]);router[_0x3388('0x20')](_0x3388('0xe'),auth[_0x3388('0xa')](),controller[_0x3388('0x21')]);router['delete'](_0x3388('0x22'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x3388('0x20')]('/:id/canned_answers',auth[_0x3388('0xa')](),controller[_0x3388('0x23')]);router[_0x3388('0x20')](_0x3388('0x16'),auth[_0x3388('0xa')](),controller[_0x3388('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c0ff1c4..9c2ba0c 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 _0xca65=['STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x4da13d,_0x4c013a){var _0x392e43=function(_0x3a70a2){while(--_0x3a70a2){_0x4da13d['push'](_0x4da13d['shift']());}};_0x392e43(++_0x4c013a);}(_0xca65,0x1de));var _0x5ca6=function(_0x2e9d05,_0x4ab3eb){_0x2e9d05=_0x2e9d05-0x0;var _0x2771ef=_0xca65[_0x2e9d05];return _0x2771ef;};'use strict';var Sequelize=require(_0x5ca6('0x0'));var rs=require(_0x5ca6('0x1'));module[_0x5ca6('0x2')]={'name':{'type':Sequelize[_0x5ca6('0x3')],'unique':_0x5ca6('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x5ca6('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5ca6('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5ca6('0x5')],'defaultValue':function(){return _0x5ca6('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5ca6('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5ca6('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ca6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ca6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ca6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ca6('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5ca6('0x7')],'defaultValue':![],'comment':_0x5ca6('0x9'),'set':function(_0x5b4945){if(!_0x5b4945)this[_0x5ca6('0xa')](_0x5ca6('0xb'),null);this[_0x5ca6('0xa')](_0x5ca6('0xc'),_0x5b4945);}}}; \ No newline at end of file +var _0xe175=['name','STRING','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x195e53,_0x2be67b){var _0x1f0fce=function(_0x1fa4ac){while(--_0x1fa4ac){_0x195e53['push'](_0x195e53['shift']());}};_0x1f0fce(++_0x2be67b);}(_0xe175,0x1a2));var _0x5e17=function(_0x493709,_0x93ac08){_0x493709=_0x493709-0x0;var _0x4ac8cd=_0xe175[_0x493709];return _0x4ac8cd;};'use strict';var Sequelize=require(_0x5e17('0x0'));var rs=require('randomstring');module[_0x5e17('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5e17('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5e17('0x3')]},'token':{'type':Sequelize[_0x5e17('0x3')],'defaultValue':function(){return rs[_0x5e17('0x4')]();}},'replyUri':{'type':Sequelize[_0x5e17('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5e17('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5e17('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5e17('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5e17('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5e17('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e17('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e17('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e17('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e17('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5e17('0x6')],'defaultValue':![],'comment':_0x5e17('0x8'),'set':function(_0xea41be){if(!_0xea41be)this[_0x5e17('0x9')](_0x5e17('0xa'),null);this[_0x5e17('0x9')](_0x5e17('0xb'),_0xea41be);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a738d13..e01f938 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 _0xfdbd=['autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','update','interaction','created'];(function(_0x2191ce,_0x2c9473){var _0x42fed2=function(_0x2009c8){while(--_0x2009c8){_0x2191ce['push'](_0x2191ce['shift']());}};_0x42fed2(++_0x2c9473);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0xfdbd[_0x15b399];return _0x199f2d;};'use strict';var pdf=require(_0xdfdb('0x0'));var emlformat=require(_0xdfdb('0x1'));var rimraf=require(_0xdfdb('0x2'));var zipdir=require(_0xdfdb('0x3'));var jsonpatch=require(_0xdfdb('0x4'));var rp=require(_0xdfdb('0x5'));var moment=require(_0xdfdb('0x6'));var BPromise=require(_0xdfdb('0x7'));var Mustache=require(_0xdfdb('0x8'));var util=require('util');var path=require(_0xdfdb('0x9'));var sox=require('sox');var csv=require(_0xdfdb('0xa'));var ejs=require(_0xdfdb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];config[_0xdfdb('0x19')]=_[_0xdfdb('0x1a')](config[_0xdfdb('0x19')],{'host':_0xdfdb('0x1b'),'port':0x18eb});var socket=require(_0xdfdb('0x1c'))(new Redis(config[_0xdfdb('0x19')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xdfdb('0x1d'));var client=jayson['client'][_0xdfdb('0x1e')]({'port':0x232c});var client9002=jayson[_0xdfdb('0x1f')][_0xdfdb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x40bc8a,_0x3bfd81,_0x1cdb8b,_0x54ff23){return new BPromise(function(_0x4fd3d5,_0x2a0295){var _0x8b9193=_0x54ff23||client;return _0x8b9193[_0xdfdb('0x20')](_0x40bc8a,_0x1cdb8b)['then'](function(_0x3eb100){logger[_0xdfdb('0x21')](_0xdfdb('0x22'),_0x3bfd81,_0xdfdb('0x23'));logger[_0xdfdb('0x24')](_0xdfdb('0x25'),_0x3bfd81,_0xdfdb('0x23'),JSON[_0xdfdb('0x26')](_0x3eb100));if(_0x3eb100['error']){if(_0x3eb100[_0xdfdb('0x27')][_0xdfdb('0x28')]===0x1f4){logger[_0xdfdb('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x3bfd81,_0x3eb100[_0xdfdb('0x27')][_0xdfdb('0x29')]);return _0x2a0295(_0x3eb100[_0xdfdb('0x27')]['message']);}logger[_0xdfdb('0x27')](_0xdfdb('0x22'),_0x3bfd81,_0x3eb100[_0xdfdb('0x27')]['message']);return _0x4fd3d5(_0x3eb100[_0xdfdb('0x27')]['message']);}else{logger[_0xdfdb('0x21')](_0xdfdb('0x22'),_0x3bfd81,_0xdfdb('0x23'));_0x4fd3d5(_0x3eb100[_0xdfdb('0x2a')]['message']);}})[_0xdfdb('0x2b')](function(_0x4363d8){logger[_0xdfdb('0x27')](_0xdfdb('0x22'),_0x3bfd81,_0x4363d8);_0x2a0295(_0x4363d8);});});}function respondWithStatusCode(_0x27f872,_0x305954){_0x305954=_0x305954||0xcc;return function(_0x57d24f){if(_0x57d24f){return _0x27f872[_0xdfdb('0x2c')](_0x305954);}return _0x27f872[_0xdfdb('0x2d')](_0x305954)[_0xdfdb('0x2e')]();};}function respondWithResult(_0x4f8057,_0x466932){_0x466932=_0x466932||0xc8;return function(_0x5df454){if(_0x5df454){return _0x4f8057[_0xdfdb('0x2d')](_0x466932)[_0xdfdb('0x2f')](_0x5df454);}};}function respondWithFilteredResult(_0x19c36f,_0x513fa0){return function(_0x5bc174){if(_0x5bc174){var _0x1c8ca8=_0x5bc174[_0xdfdb('0x30')],_0xc56435=_0x513fa0[_0xdfdb('0x31')],_0xedbb91=_0x513fa0['offset']+_0x513fa0[_0xdfdb('0x32')],_0x3a2ec3;if(_0xedbb91>=_0x1c8ca8){_0xedbb91=_0x1c8ca8;_0x3a2ec3=0xc8;}else{_0x3a2ec3=0xce;}_0x19c36f[_0xdfdb('0x2d')](_0x3a2ec3);return _0x19c36f[_0xdfdb('0x33')](_0xdfdb('0x34'),_0xc56435+'-'+_0xedbb91+'/'+_0x1c8ca8)[_0xdfdb('0x2f')](_0x5bc174);}return null;};}function patchUpdates(_0x157de8){return function(_0x2dbdf9){try{jsonpatch[_0xdfdb('0x35')](_0x2dbdf9,_0x157de8,!![]);}catch(_0x68398d){return BPromise[_0xdfdb('0x36')](_0x68398d);}return _0x2dbdf9[_0xdfdb('0x37')]();};}function saveUpdates(_0x4aa278,_0x4dadad){return function(_0x3656c3){if(_0x3656c3){return _0x3656c3['update'](_0x4aa278)[_0xdfdb('0x38')](function(_0x14e83e){return _0x14e83e;});}return null;};}function removeEntity(_0x3ba5f5,_0x36d91f){return function(_0x514232){if(_0x514232){return _0x514232[_0xdfdb('0x39')]()['then'](function(){var _0x341f0d=_0x514232[_0xdfdb('0x3a')]({'plain':!![]});var _0x3e2e78=_0xdfdb('0x3b');return db[_0xdfdb('0x3c')][_0xdfdb('0x39')]({'where':{'type':_0x3e2e78,'resourceId':_0x341f0d['id']}})['then'](function(){return _0x514232;});})[_0xdfdb('0x38')](function(){_0x3ba5f5[_0xdfdb('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c1484,_0x4377d6){return function(_0x45b7bb){if(!_0x45b7bb){_0x1c1484[_0xdfdb('0x2c')](0x194);}return _0x45b7bb;};}function handleError(_0x439f32,_0x286fdb){_0x286fdb=_0x286fdb||0x1f4;return function(_0x16d5b8){logger[_0xdfdb('0x27')](_0x16d5b8[_0xdfdb('0x3d')]);if(_0x16d5b8[_0xdfdb('0x3e')]){delete _0x16d5b8[_0xdfdb('0x3e')];}_0x439f32['status'](_0x286fdb)[_0xdfdb('0x3f')](_0x16d5b8);};}exports[_0xdfdb('0x40')]=function(_0x3d3807,_0x158f17){var _0x2ac83d={'include':[{'model':db[_0xdfdb('0x41')],'as':'mandatoryDispositionPause'}]},_0x3e234e={},_0x3ec73a={'count':0x0,'rows':[]};var _0x55d707=_[_0xdfdb('0x42')](db[_0xdfdb('0x43')][_0xdfdb('0x44')],function(_0x1e7688){return{'name':_0x1e7688[_0xdfdb('0x45')],'type':_0x1e7688[_0xdfdb('0x46')][_0xdfdb('0x47')]};});_0x3e234e[_0xdfdb('0x48')]=_[_0xdfdb('0x42')](_0x55d707,'name');_0x3e234e[_0xdfdb('0x49')]=_[_0xdfdb('0x4a')](_0x3d3807[_0xdfdb('0x49')]);_0x3e234e[_0xdfdb('0x4b')]=_[_0xdfdb('0x4c')](_0x3e234e['model'],_0x3e234e[_0xdfdb('0x49')]);_0x2ac83d[_0xdfdb('0x4d')]=_[_0xdfdb('0x4c')](_0x3e234e[_0xdfdb('0x48')],qs[_0xdfdb('0x4e')](_0x3d3807['query'][_0xdfdb('0x4e')]));_0x2ac83d[_0xdfdb('0x4d')]=_0x2ac83d[_0xdfdb('0x4d')]['length']?_0x2ac83d[_0xdfdb('0x4d')]:_0x3e234e['model'];if(!_0x3d3807[_0xdfdb('0x49')]['hasOwnProperty'](_0xdfdb('0x4f'))){_0x2ac83d[_0xdfdb('0x32')]=qs['limit'](_0x3d3807[_0xdfdb('0x49')]['limit']);_0x2ac83d[_0xdfdb('0x31')]=qs[_0xdfdb('0x31')](_0x3d3807[_0xdfdb('0x49')][_0xdfdb('0x31')]);}_0x2ac83d[_0xdfdb('0x50')]=qs['sort'](_0x3d3807['query'][_0xdfdb('0x51')]);_0x2ac83d[_0xdfdb('0x52')]=qs['filters'](_[_0xdfdb('0x53')](_0x3d3807['query'],_0x3e234e[_0xdfdb('0x4b')]),_0x55d707);if(_0x3d3807[_0xdfdb('0x49')][_0xdfdb('0x54')]){_0x2ac83d[_0xdfdb('0x52')]=_[_0xdfdb('0x55')](_0x2ac83d[_0xdfdb('0x52')],{'$or':_[_0xdfdb('0x42')](_0x55d707,function(_0x11ce58){if(_0x11ce58[_0xdfdb('0x46')]!==_0xdfdb('0x56')){var _0x24f88a={};_0x24f88a[_0x11ce58[_0xdfdb('0x3e')]]={'$like':'%'+_0x3d3807[_0xdfdb('0x49')][_0xdfdb('0x54')]+'%'};return _0x24f88a;}})});}_0x2ac83d=_[_0xdfdb('0x55')]({},_0x2ac83d,_0x3d3807[_0xdfdb('0x57')]);var _0x5ae070={'where':_0x2ac83d['where']};return db[_0xdfdb('0x43')][_0xdfdb('0x30')](_0x5ae070)[_0xdfdb('0x38')](function(_0x4bbb88){_0x3ec73a[_0xdfdb('0x30')]=_0x4bbb88;if(_0x3d3807[_0xdfdb('0x49')][_0xdfdb('0x58')]){_0x2ac83d[_0xdfdb('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xdfdb('0x5a')](_0x2ac83d);})[_0xdfdb('0x38')](function(_0x5446f6){_0x3ec73a[_0xdfdb('0x5b')]=_0x5446f6;return _0x3ec73a;})[_0xdfdb('0x38')](respondWithFilteredResult(_0x158f17,_0x2ac83d))[_0xdfdb('0x2b')](handleError(_0x158f17,null));};exports[_0xdfdb('0x5c')]=function(_0x2dd9b6,_0x10b490){var _0x17dfdb={'raw':![],'where':{'id':_0x2dd9b6[_0xdfdb('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xdfdb('0x5e')}]},_0x1f5b88={};_0x1f5b88['model']=_[_0xdfdb('0x4a')](db[_0xdfdb('0x43')][_0xdfdb('0x44')]);_0x1f5b88[_0xdfdb('0x49')]=_[_0xdfdb('0x4a')](_0x2dd9b6[_0xdfdb('0x49')]);_0x1f5b88[_0xdfdb('0x4b')]=_['intersection'](_0x1f5b88[_0xdfdb('0x48')],_0x1f5b88[_0xdfdb('0x49')]);_0x17dfdb[_0xdfdb('0x4d')]=_[_0xdfdb('0x4c')](_0x1f5b88[_0xdfdb('0x48')],qs['fields'](_0x2dd9b6[_0xdfdb('0x49')]['fields']));_0x17dfdb[_0xdfdb('0x4d')]=_0x17dfdb[_0xdfdb('0x4d')][_0xdfdb('0x5f')]?_0x17dfdb[_0xdfdb('0x4d')]:_0x1f5b88[_0xdfdb('0x48')];if(_0x2dd9b6['query'][_0xdfdb('0x58')]){_0x17dfdb[_0xdfdb('0x59')]=[{'all':!![]}];}_0x17dfdb=_['merge']({},_0x17dfdb,_0x2dd9b6[_0xdfdb('0x57')]);return db[_0xdfdb('0x43')][_0xdfdb('0x60')](_0x17dfdb)['then'](handleEntityNotFound(_0x10b490,null))[_0xdfdb('0x38')](respondWithResult(_0x10b490,null))[_0xdfdb('0x2b')](handleError(_0x10b490,null));};exports[_0xdfdb('0x61')]=function(_0x1cce58,_0x421782){return db[_0xdfdb('0x43')]['create'](_0x1cce58['body'],{})[_0xdfdb('0x38')](function(_0x586790){var _0x4d8659=_0x1cce58['user'][_0xdfdb('0x3a')]({'plain':!![]});if(!_0x4d8659)throw new Error(_0xdfdb('0x62'));if(_0x4d8659[_0xdfdb('0x63')]===_0xdfdb('0x64')){var _0x8bd5c0=_0x586790[_0xdfdb('0x3a')]({'plain':!![]});var _0xa1d520=_0xdfdb('0x3b');return db[_0xdfdb('0x65')]['find']({'where':{'name':_0xa1d520,'userProfileId':_0x4d8659['userProfileId']},'raw':!![]})[_0xdfdb('0x38')](function(_0x4a9654){if(_0x4a9654&&_0x4a9654[_0xdfdb('0x66')]===0x0){return db[_0xdfdb('0x3c')][_0xdfdb('0x61')]({'name':_0x8bd5c0['name'],'resourceId':_0x8bd5c0['id'],'type':_0x4a9654[_0xdfdb('0x3e')],'sectionId':_0x4a9654['id']},{})[_0xdfdb('0x38')](function(){return _0x586790;});}else{return _0x586790;}})[_0xdfdb('0x2b')](function(_0x2f69a8){logger[_0xdfdb('0x27')](_0xdfdb('0x67'),_0x2f69a8);throw _0x2f69a8;});}return _0x586790;})[_0xdfdb('0x38')](respondWithResult(_0x421782,0xc9))[_0xdfdb('0x2b')](handleError(_0x421782,null));};exports['update']=function(_0x934be6,_0x22e816){if(_0x934be6['body']['id']){delete _0x934be6[_0xdfdb('0x68')]['id'];}return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x934be6[_0xdfdb('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xdfdb('0x38')](handleEntityNotFound(_0x22e816,null))[_0xdfdb('0x38')](saveUpdates(_0x934be6['body'],null))[_0xdfdb('0x38')](respondWithResult(_0x22e816,null))[_0xdfdb('0x2b')](handleError(_0x22e816,null));};exports[_0xdfdb('0x39')]=function(_0x5ef75a,_0x55b152){return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x5ef75a['params']['id']}})['then'](handleEntityNotFound(_0x55b152,null))[_0xdfdb('0x38')](removeEntity(_0x55b152,null))['catch'](handleError(_0x55b152,null));};exports['describe']=function(_0x90d435,_0x4a3002){return db[_0xdfdb('0x43')][_0xdfdb('0x69')]()['then'](respondWithResult(_0x4a3002,null))['catch'](handleError(_0x4a3002,null));};exports[_0xdfdb('0x6a')]=function(_0x2a218a,_0x58ed98,_0x28fdbf){if(_0x2a218a[_0xdfdb('0x68')]['id']){delete _0x2a218a[_0xdfdb('0x68')]['id'];}return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x2a218a['params']['id']}})['then'](handleEntityNotFound(_0x58ed98,null))[_0xdfdb('0x38')](function(_0x2d6be9){if(_0x2d6be9){_0x2a218a[_0xdfdb('0x68')][_0xdfdb('0x6b')]=_0x2d6be9['id'];return db[_0xdfdb('0x6c')][_0xdfdb('0x61')](_0x2a218a['body']);}})[_0xdfdb('0x38')](respondWithResult(_0x58ed98,null))[_0xdfdb('0x2b')](handleError(_0x58ed98,null));};exports[_0xdfdb('0x6d')]=function(_0x30054b,_0x2e7b9d,_0x1bcfdd){var _0x2037b1={'raw':![],'where':{}};var _0x4cdcdc={};var _0x38fa9c={'count':0x0,'rows':[]};return db[_0xdfdb('0x43')]['findOne']({'where':{'id':_0x30054b[_0xdfdb('0x5d')]['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x2e7b9d,null))[_0xdfdb('0x38')](function(_0x45bfc0){if(_0x45bfc0){_0x4cdcdc[_0xdfdb('0x48')]=_['keys'](db[_0xdfdb('0x6c')][_0xdfdb('0x44')]);_0x4cdcdc[_0xdfdb('0x49')]=_[_0xdfdb('0x4a')](_0x30054b['query']);_0x4cdcdc[_0xdfdb('0x4b')]=_[_0xdfdb('0x4c')](_0x4cdcdc[_0xdfdb('0x48')],_0x4cdcdc[_0xdfdb('0x49')]);_0x2037b1[_0xdfdb('0x4d')]=_[_0xdfdb('0x4c')](_0x4cdcdc[_0xdfdb('0x48')],qs[_0xdfdb('0x4e')](_0x30054b[_0xdfdb('0x49')][_0xdfdb('0x4e')]));_0x2037b1[_0xdfdb('0x4d')]=_0x2037b1['attributes'][_0xdfdb('0x5f')]?_0x2037b1[_0xdfdb('0x4d')]:_0x4cdcdc['model'];if(!_0x30054b[_0xdfdb('0x49')][_0xdfdb('0x6e')](_0xdfdb('0x4f'))){_0x2037b1['limit']=qs['limit'](_0x30054b['query'][_0xdfdb('0x32')]);_0x2037b1[_0xdfdb('0x31')]=qs[_0xdfdb('0x31')](_0x30054b[_0xdfdb('0x49')][_0xdfdb('0x31')]);}_0x2037b1[_0xdfdb('0x50')]=qs[_0xdfdb('0x51')](_0x30054b['query'][_0xdfdb('0x51')]);_0x2037b1[_0xdfdb('0x52')]=qs[_0xdfdb('0x4b')](_[_0xdfdb('0x53')](_0x30054b[_0xdfdb('0x49')],_0x4cdcdc[_0xdfdb('0x4b')]));_0x2037b1[_0xdfdb('0x52')]['OpenchannelAccountId']=_0x45bfc0['id'];if(_0x30054b[_0xdfdb('0x49')][_0xdfdb('0x54')]){_0x2037b1[_0xdfdb('0x52')]=_[_0xdfdb('0x55')](_0x2037b1[_0xdfdb('0x52')],{'$or':_['map'](_0x2037b1[_0xdfdb('0x4d')],function(_0x56a633){var _0xebf001={};_0xebf001[_0x56a633]={'$like':'%'+_0x30054b[_0xdfdb('0x49')][_0xdfdb('0x54')]+'%'};return _0xebf001;})});}_0x2037b1=_[_0xdfdb('0x55')]({},_0x2037b1,_0x30054b[_0xdfdb('0x57')]);return db['Disposition'][_0xdfdb('0x30')]({'where':_0x2037b1[_0xdfdb('0x52')]})['then'](function(_0x5f32f7){_0x38fa9c[_0xdfdb('0x30')]=_0x5f32f7;if(_0x30054b['query']['includeAll']){_0x2037b1[_0xdfdb('0x59')]=[{'all':!![]}];}return db[_0xdfdb('0x6c')][_0xdfdb('0x5a')](_0x2037b1);})[_0xdfdb('0x38')](function(_0x2f03f2){_0x38fa9c[_0xdfdb('0x5b')]=_0x2f03f2;return _0x38fa9c;});}})[_0xdfdb('0x38')](respondWithFilteredResult(_0x2e7b9d,_0x2037b1))[_0xdfdb('0x2b')](handleError(_0x2e7b9d,null));};exports['removeDispositions']=function(_0x1e906f,_0x550977,_0x1660c7){return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x1e906f[_0xdfdb('0x5d')]['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x550977,null))['then'](function(_0x1d410e){if(_0x1d410e){return _0x1d410e[_0xdfdb('0x6f')](_0x1e906f[_0xdfdb('0x49')][_0xdfdb('0x70')]);}})[_0xdfdb('0x38')](respondWithStatusCode(_0x550977,null))['catch'](handleError(_0x550977,null));};exports['addAnswer']=function(_0x231f20,_0x68fad5,_0x5dd0b4){if(_0x231f20[_0xdfdb('0x68')]['id']){delete _0x231f20['body']['id'];}return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x231f20[_0xdfdb('0x5d')]['id']}})['then'](handleEntityNotFound(_0x68fad5,null))[_0xdfdb('0x38')](function(_0x53ca83){if(_0x53ca83){_0x231f20['body'][_0xdfdb('0x6b')]=_0x53ca83['id'];return db['CannedAnswer'][_0xdfdb('0x61')](_0x231f20[_0xdfdb('0x68')]);}})[_0xdfdb('0x38')](respondWithResult(_0x68fad5,null))[_0xdfdb('0x2b')](handleError(_0x68fad5,null));};exports[_0xdfdb('0x71')]=function(_0x78c471,_0x305cf2,_0x32cc17){var _0x1fb331={'raw':![],'where':{}};var _0x40cfba={};var _0x5ed460={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xdfdb('0x72')]({'where':{'id':_0x78c471['params']['id']}})['then'](handleEntityNotFound(_0x305cf2,null))['then'](function(_0x4dcfbd){if(_0x4dcfbd){_0x40cfba[_0xdfdb('0x48')]=_[_0xdfdb('0x4a')](db[_0xdfdb('0x73')][_0xdfdb('0x44')]);_0x40cfba[_0xdfdb('0x49')]=_[_0xdfdb('0x4a')](_0x78c471[_0xdfdb('0x49')]);_0x40cfba[_0xdfdb('0x4b')]=_[_0xdfdb('0x4c')](_0x40cfba[_0xdfdb('0x48')],_0x40cfba[_0xdfdb('0x49')]);_0x1fb331[_0xdfdb('0x4d')]=_[_0xdfdb('0x4c')](_0x40cfba['model'],qs['fields'](_0x78c471[_0xdfdb('0x49')][_0xdfdb('0x4e')]));_0x1fb331[_0xdfdb('0x4d')]=_0x1fb331[_0xdfdb('0x4d')][_0xdfdb('0x5f')]?_0x1fb331[_0xdfdb('0x4d')]:_0x40cfba[_0xdfdb('0x48')];if(!_0x78c471[_0xdfdb('0x49')][_0xdfdb('0x6e')]('nolimit')){_0x1fb331[_0xdfdb('0x32')]=qs[_0xdfdb('0x32')](_0x78c471[_0xdfdb('0x49')][_0xdfdb('0x32')]);_0x1fb331[_0xdfdb('0x31')]=qs[_0xdfdb('0x31')](_0x78c471['query'][_0xdfdb('0x31')]);}_0x1fb331[_0xdfdb('0x50')]=qs[_0xdfdb('0x51')](_0x78c471[_0xdfdb('0x49')][_0xdfdb('0x51')]);_0x1fb331[_0xdfdb('0x52')]=qs['filters'](_[_0xdfdb('0x53')](_0x78c471[_0xdfdb('0x49')],_0x40cfba[_0xdfdb('0x4b')]));_0x1fb331['where']['OpenchannelAccountId']=_0x4dcfbd['id'];if(_0x78c471[_0xdfdb('0x49')]['filter']){_0x1fb331['where']=_[_0xdfdb('0x55')](_0x1fb331[_0xdfdb('0x52')],{'$or':_['map'](_0x1fb331['attributes'],function(_0x37c48f){var _0x2f8d34={};_0x2f8d34[_0x37c48f]={'$like':'%'+_0x78c471[_0xdfdb('0x49')][_0xdfdb('0x54')]+'%'};return _0x2f8d34;})});}_0x1fb331=_[_0xdfdb('0x55')]({},_0x1fb331,_0x78c471['options']);return db['CannedAnswer'][_0xdfdb('0x30')]({'where':_0x1fb331['where']})[_0xdfdb('0x38')](function(_0x2ed23b){_0x5ed460[_0xdfdb('0x30')]=_0x2ed23b;if(_0x78c471['query'][_0xdfdb('0x58')]){_0x1fb331[_0xdfdb('0x59')]=[{'all':!![]}];}return db[_0xdfdb('0x73')][_0xdfdb('0x5a')](_0x1fb331);})['then'](function(_0x41d82c){_0x5ed460[_0xdfdb('0x5b')]=_0x41d82c;return _0x5ed460;});}})[_0xdfdb('0x38')](respondWithFilteredResult(_0x305cf2,_0x1fb331))[_0xdfdb('0x2b')](handleError(_0x305cf2,null));};exports['removeAnswers']=function(_0xa31219,_0x5c1b69,_0x53c6ae){return db['OpenchannelAccount']['find']({'where':{'id':_0xa31219['params']['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x5c1b69,null))[_0xdfdb('0x38')](function(_0x266246){if(_0x266246){return _0x266246[_0xdfdb('0x74')](_0xa31219[_0xdfdb('0x49')][_0xdfdb('0x70')]);}})[_0xdfdb('0x38')](respondWithStatusCode(_0x5c1b69,null))[_0xdfdb('0x2b')](handleError(_0x5c1b69,null));};exports['notify']=function(_0x439fed,_0x502e43,_0x39cd93){var _0x103bb9={'body':_0x439fed['body'],'channel':_0xdfdb('0x75')};var _0x308439=[];var _0x565b38=[];var _0x1772a0={};var _0x38bc69=![];return db[_0xdfdb('0x76')][_0xdfdb('0x69')]()['then'](function(_0x40b080){if(!_0x40b080){throw new db[(_0xdfdb('0x77'))][(_0xdfdb('0x78'))](_0xdfdb('0x79'));}_0x308439=_[_0xdfdb('0x7a')](_['keys'](_0x40b080),['createdAt',_0xdfdb('0x7b')]);_0x565b38=_[_0xdfdb('0x7a')](_['keys'](_0x40b080),[_0xdfdb('0x7c'),'updatedAt',_0xdfdb('0x7d'),_0xdfdb('0x7e')]);if(_0x439fed[_0xdfdb('0x68')]['id']){delete _0x439fed[_0xdfdb('0x68')]['id'];}if(_[_0xdfdb('0x7f')](_0x439fed['body'][_0xdfdb('0x80')])){throw new db[(_0xdfdb('0x77'))][(_0xdfdb('0x78'))](_0xdfdb('0x81'));}if(_[_0xdfdb('0x7f')](_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x68')])||_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x68')]===''){throw new db[(_0xdfdb('0x77'))][(_0xdfdb('0x78'))](_0xdfdb('0x82'));}if(_[_0xdfdb('0x7f')](_0x439fed['body'][_0xdfdb('0x83')])){throw new db[(_0xdfdb('0x77'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x565b38);}if(!_[_0xdfdb('0x84')](_0x565b38,_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x83')])){throw new db['Sequelize'][(_0xdfdb('0x78'))](_0xdfdb('0x85')+_0x565b38);}_0x1772a0[_0x439fed['body'][_0xdfdb('0x83')]]=_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x80')];})['then'](function(){return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x439fed[_0xdfdb('0x5d')]['id']},'include':[{'model':db[_0xdfdb('0x86')],'as':_0xdfdb('0x87'),'include':[{'model':db[_0xdfdb('0x76')],'as':_0xdfdb('0x88'),'where':_0x1772a0,'limit':0x1,'order':[['updatedAt',_0xdfdb('0x89')]]}]},{'model':db[_0xdfdb('0x8a')],'as':_0xdfdb('0x8b')}]});})[_0xdfdb('0x38')](handleEntityNotFound(_0x502e43,null))['then'](function(_0x4e02ec){if(_0x4e02ec&&_0x4e02ec[_0xdfdb('0x87')]){_0x103bb9[_0xdfdb('0x8c')]=_0x4e02ec;_0x103bb9[_0xdfdb('0x8d')]=_0x4e02ec[_0xdfdb('0x8b')];_0x103bb9[_0xdfdb('0x8e')]=_0x4e02ec[_0xdfdb('0x87')];_0x103bb9[_0xdfdb('0x8d')]=_['orderBy'](_0x103bb9[_0xdfdb('0x8d')],[_0xdfdb('0x8f')],[_0xdfdb('0x90')]);if(_0x103bb9['account'][_0xdfdb('0x8b')]){delete _0x103bb9[_0xdfdb('0x8c')][_0xdfdb('0x8b')];}if(_0x103bb9[_0xdfdb('0x8c')][_0xdfdb('0x87')]&&_0x103bb9[_0xdfdb('0x8c')][_0xdfdb('0x87')]['Contacts']['length']){return _0x103bb9[_0xdfdb('0x8c')][_0xdfdb('0x87')]['Contacts'][0x0];}var _0x4b5e2d=_[_0xdfdb('0x1a')](_0x439fed[_0xdfdb('0x68')],{'firstName':_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x80')],'ListId':_0x4e02ec[_0xdfdb('0x7e')]});_0x4b5e2d[_0x439fed['body'][_0xdfdb('0x83')]]=_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x80')];return db['CmContact'][_0xdfdb('0x61')](_0x4b5e2d,{'fields':_0x308439,'raw':!![]});}})[_0xdfdb('0x38')](handleEntityNotFound(_0x502e43,null))[_0xdfdb('0x38')](function(_0x91395a){_0x103bb9['contact']=_0x91395a;if(_0x91395a){var _0x4fbb4a={'ContactId':_0x91395a['id'],'OpenchannelAccountId':_0x439fed['params']['id'],'from':(_0x91395a['firstName']||'')+'\x20'+(_0x91395a[_0xdfdb('0x91')]||'')};var _0xc429f={'OpenchannelAccountId':_0x439fed[_0xdfdb('0x5d')]['id'],'closed':![]};if(_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x92')]){_0xc429f[_0xdfdb('0x92')]=_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x92')];return db['OpenchannelInteraction'][_0xdfdb('0x60')]({'where':_0xc429f})[_0xdfdb('0x38')](function(_0x1825f0){if(_0x1825f0){return[_0x1825f0,![]];}_0x4fbb4a[_0xdfdb('0x92')]=_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x92')];_0x4fbb4a['externalUrl']=_0x439fed['body'][_0xdfdb('0x93')];return db[_0xdfdb('0x94')]['create'](_0x4fbb4a)[_0xdfdb('0x38')](function(_0x50028f){return[_0x50028f,!![]];});});}else{_0xc429f['threadId']=null;}_0xc429f[_0xdfdb('0x95')]=_0x91395a['id'];return db[_0xdfdb('0x94')]['find']({'where':_0xc429f})[_0xdfdb('0x38')](function(_0x581200){if(_0x581200){return[_0x581200,![]];}return db[_0xdfdb('0x94')]['create'](_0x4fbb4a)['then'](function(_0x48aa44){return[_0x48aa44,!![]];});});}})[_0xdfdb('0x96')](function(_0x57cc21,_0x182f12){if(_0x57cc21){_0x38bc69=_0x182f12;if(!_0x182f12){var _0x556232={'from':(_0x103bb9[_0xdfdb('0x97')]['firstName']||'')+'\x20'+(_0x103bb9[_0xdfdb('0x97')]['lastName']||'')};if(_0x439fed[_0xdfdb('0x68')]['threadId']&&_0x439fed[_0xdfdb('0x68')]['messageId']&&_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x92')]!=_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x98')]){_0x556232[_0xdfdb('0x92')]=_0x439fed['body'][_0xdfdb('0x98')];}return _0x57cc21[_0xdfdb('0x99')](_0x556232);}else{return _0x57cc21;}}})[_0xdfdb('0x38')](function(_0x5e830b){_0x103bb9[_0xdfdb('0x9a')]=_0x5e830b[_0xdfdb('0x3a')]({'plain':!![]});_0x103bb9[_0xdfdb('0x9a')][_0xdfdb('0x9b')]=_0x38bc69;if(_0x103bb9[_0xdfdb('0x9a')]['created']){if(_0x103bb9['account'][_0xdfdb('0x9c')]){_0x103bb9['applications'][_0xdfdb('0x9d')]({'id':0x0,'priority':_0x103bb9[_0xdfdb('0x8d')][_0xdfdb('0x5f')]+0x1,'app':_0xdfdb('0x9e'),'appdata':_0xdfdb('0x9f'),'interval':_0xdfdb('0xa0')});}}return db[_0xdfdb('0xa1')][_0xdfdb('0x61')]({'body':_0x439fed[_0xdfdb('0x68')][_0xdfdb('0x68')],'OpenchannelAccountId':_0x439fed[_0xdfdb('0x5d')]['id'],'OpenchannelInteractionId':_0x5e830b['id'],'direction':'in','ContactId':_0x103bb9[_0xdfdb('0x97')]['id'],'AttachmentId':_0x439fed[_0xdfdb('0x68')][_0xdfdb('0xa2')]});})['then'](function(_0x48b84b){_0x103bb9[_0xdfdb('0x29')]=_0x48b84b;if(_0x103bb9[_0xdfdb('0x9a')][_0xdfdb('0xa3')]){return db['User'][_0xdfdb('0x60')]({'attributes':['id',_0xdfdb('0x3e')],'where':{'id':_0x103bb9['interaction'][_0xdfdb('0xa3')]}})[_0xdfdb('0x38')](function(_0x3443ec){if(_0x3443ec){_0x103bb9[_0xdfdb('0x8d')][_0xdfdb('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3443ec[_0xdfdb('0x3e')]+','+(_0x103bb9['account'][_0xdfdb('0xa5')]||0xa),'interval':_0xdfdb('0xa0')});_0x103bb9[_0xdfdb('0xa6')]=![];}return respondWithRpcPromise(_0xdfdb('0xa7'),'startRouting',_0x103bb9);});}return respondWithRpcPromise('Start',_0xdfdb('0xa8'),_0x103bb9);})[_0xdfdb('0x38')](function(_0x452080){respondWithRpcPromise(_0xdfdb('0xa9'),'EventManager',{'event':_0xdfdb('0xaa'),'message':_0x452080},client9002);return _0x452080;})['then'](respondWithResult(_0x502e43,null))[_0xdfdb('0x2b')](handleError(_0x502e43,null));};exports[_0xdfdb('0xab')]=function(_0x219a35,_0x3a3854,_0x2f0ab0){return db[_0xdfdb('0x43')]['findOne']({'where':{'id':_0x219a35['params']['id']}})['then'](handleEntityNotFound(_0x3a3854,null))[_0xdfdb('0x38')](function(_0x2531d4){if(_0x2531d4){return db[_0xdfdb('0xac')][_0xdfdb('0xad')](function(_0x13ab1b){return db[_0xdfdb('0x8a')][_0xdfdb('0x39')]({'where':{'OpenchannelAccountId':_0x219a35['params']['id']},'transaction':_0x13ab1b})[_0xdfdb('0x38')](function(_0x3255b9){var _0x438306=_[_0xdfdb('0x42')](_0x219a35['body'],function(_0xc2f6f2){_0xc2f6f2[_0xdfdb('0x6b')]=_0x219a35[_0xdfdb('0x5d')]['id'];return _0xc2f6f2;});return db[_0xdfdb('0x8a')][_0xdfdb('0xae')](_0x438306,{'transaction':_0x13ab1b});});})[_0xdfdb('0x38')](function(){return db[_0xdfdb('0x8a')][_0xdfdb('0xaf')]({'where':{'OpenchannelAccountId':_0x219a35[_0xdfdb('0x5d')]['id']},'order':_0xdfdb('0x8f')});});}})[_0xdfdb('0x38')](respondWithResult(_0x3a3854,null))[_0xdfdb('0x2b')](handleError(_0x3a3854,null));};exports[_0xdfdb('0xb0')]=function(_0x555279,_0x4ea5ab,_0x323339){var _0x2b2b57={};var _0x1cdf96={};var _0x3c7198;var _0x4b6785;return db[_0xdfdb('0x43')][_0xdfdb('0x72')]({'where':{'id':_0x555279['params']['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x4ea5ab,null))[_0xdfdb('0x38')](function(_0x3de1cc){if(_0x3de1cc){_0x3c7198=_0x3de1cc;_0x1cdf96[_0xdfdb('0x48')]=_['keys'](db[_0xdfdb('0x8a')][_0xdfdb('0x44')]);_0x1cdf96[_0xdfdb('0x49')]=_['keys'](_0x555279[_0xdfdb('0x49')]);_0x1cdf96[_0xdfdb('0x4b')]=_[_0xdfdb('0x4c')](_0x1cdf96[_0xdfdb('0x48')],_0x1cdf96['query']);_0x2b2b57[_0xdfdb('0x4d')]=_[_0xdfdb('0x4c')](_0x1cdf96[_0xdfdb('0x48')],qs[_0xdfdb('0x4e')](_0x555279[_0xdfdb('0x49')][_0xdfdb('0x4e')]));_0x2b2b57[_0xdfdb('0x4d')]=_0x2b2b57[_0xdfdb('0x4d')][_0xdfdb('0x5f')]?_0x2b2b57[_0xdfdb('0x4d')]:_0x1cdf96['model'];_0x2b2b57[_0xdfdb('0x50')]=qs[_0xdfdb('0x51')](_0x555279[_0xdfdb('0x49')][_0xdfdb('0x51')]);_0x2b2b57[_0xdfdb('0x52')]=qs['filters'](_[_0xdfdb('0x53')](_0x555279[_0xdfdb('0x49')],_0x1cdf96[_0xdfdb('0x4b')]));if(_0x555279['query'][_0xdfdb('0x54')]){_0x2b2b57[_0xdfdb('0x52')]=_[_0xdfdb('0x55')](_0x2b2b57[_0xdfdb('0x52')],{'$or':_[_0xdfdb('0x42')](_0x2b2b57[_0xdfdb('0x4d')],function(_0x2fd44d){var _0x53d571={};_0x53d571[_0x2fd44d]={'$like':'%'+_0x555279[_0xdfdb('0x49')][_0xdfdb('0x54')]+'%'};return _0x53d571;})});}_0x2b2b57=_[_0xdfdb('0x55')]({},_0x2b2b57,_0x555279[_0xdfdb('0x57')]);return _0x3c7198[_0xdfdb('0xb0')](_0x2b2b57);}})[_0xdfdb('0x38')](function(_0x4b2192){if(_0x4b2192){_0x4b6785=_0x4b2192['length'];if(!_0x555279['query'][_0xdfdb('0x6e')](_0xdfdb('0x4f'))){_0x2b2b57['limit']=qs['limit'](_0x555279[_0xdfdb('0x49')][_0xdfdb('0x32')]);_0x2b2b57[_0xdfdb('0x31')]=qs['offset'](_0x555279[_0xdfdb('0x49')][_0xdfdb('0x31')]);}return _0x3c7198['getApplications'](_0x2b2b57);}})['then'](function(_0x229ec5){if(_0x229ec5){return _0x229ec5?{'count':_0x4b6785,'rows':_0x229ec5}:null;}})[_0xdfdb('0x38')](respondWithResult(_0x4ea5ab,null))['catch'](handleError(_0x4ea5ab,null));};exports[_0xdfdb('0xb1')]=function(_0xa847ad,_0x21721f,_0x3bc778){var _0x232574={'raw':![],'where':{}};var _0x5a47c6={};var _0x2472c4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xdfdb('0x72')]({'where':{'id':_0xa847ad[_0xdfdb('0x5d')]['id']}})['then'](handleEntityNotFound(_0x21721f,null))[_0xdfdb('0x38')](function(_0x1390ec){if(_0x1390ec){_0x5a47c6[_0xdfdb('0x48')]=_['keys'](db[_0xdfdb('0x94')][_0xdfdb('0x44')]);_0x5a47c6[_0xdfdb('0x49')]=_[_0xdfdb('0x4a')](_0xa847ad[_0xdfdb('0x49')]);_0x5a47c6[_0xdfdb('0x4b')]=_[_0xdfdb('0x4c')](_0x5a47c6['model'],_0x5a47c6['query']);_0x232574[_0xdfdb('0x4d')]=_[_0xdfdb('0x4c')](_0x5a47c6['model'],qs[_0xdfdb('0x4e')](_0xa847ad['query'][_0xdfdb('0x4e')]));_0x232574[_0xdfdb('0x4d')]=_0x232574['attributes'][_0xdfdb('0x5f')]?_0x232574['attributes']:_0x5a47c6[_0xdfdb('0x48')];if(!_0xa847ad[_0xdfdb('0x49')][_0xdfdb('0x6e')](_0xdfdb('0x4f'))){_0x232574['limit']=qs[_0xdfdb('0x32')](_0xa847ad['query']['limit']);_0x232574[_0xdfdb('0x31')]=qs[_0xdfdb('0x31')](_0xa847ad[_0xdfdb('0x49')]['offset']);}_0x232574['order']=qs[_0xdfdb('0x51')](_0xa847ad[_0xdfdb('0x49')]['sort']);_0x232574[_0xdfdb('0x52')]=qs[_0xdfdb('0x4b')](_[_0xdfdb('0x53')](_0xa847ad[_0xdfdb('0x49')],_0x5a47c6['filters']));_0x232574[_0xdfdb('0x52')][_0xdfdb('0x6b')]=_0x1390ec['id'];if(_0xa847ad[_0xdfdb('0x49')][_0xdfdb('0x54')]){_0x232574[_0xdfdb('0x52')]=_[_0xdfdb('0x55')](_0x232574[_0xdfdb('0x52')],{'$or':_[_0xdfdb('0x42')](_0x232574[_0xdfdb('0x4d')],function(_0x24f24e){var _0x367a1a={};_0x367a1a[_0x24f24e]={'$like':'%'+_0xa847ad[_0xdfdb('0x49')][_0xdfdb('0x54')]+'%'};return _0x367a1a;})});}_0x232574=_[_0xdfdb('0x55')]({},_0x232574,_0xa847ad[_0xdfdb('0x57')]);return db[_0xdfdb('0x94')][_0xdfdb('0x30')]({'where':_0x232574[_0xdfdb('0x52')]})['then'](function(_0xc8f463){_0x2472c4['count']=_0xc8f463;if(_0xa847ad[_0xdfdb('0x49')][_0xdfdb('0x58')]){_0x232574[_0xdfdb('0x59')]=[{'model':db[_0xdfdb('0x76')],'as':_0xdfdb('0xb2'),'required':![]},{'model':db[_0xdfdb('0xb3')],'as':_0xdfdb('0xb4'),'attributes':[_0xdfdb('0x3e'),_0xdfdb('0xb5'),_0xdfdb('0xb6')],'required':![]},{'model':db[_0xdfdb('0xb7')],'as':_0xdfdb('0xb8'),'attributes':['id',_0xdfdb('0x3e'),_0xdfdb('0xb9')],'where':_0xa847ad[_0xdfdb('0x49')]['tag']?{'id':_0xa847ad[_0xdfdb('0x49')][_0xdfdb('0xba')]}:undefined,'required':_0xa847ad[_0xdfdb('0x49')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xdfdb('0x5a')](_0x232574);})[_0xdfdb('0x38')](function(_0x558e26){_0x2472c4[_0xdfdb('0x5b')]=_0x558e26;return _0x2472c4;});}})[_0xdfdb('0x38')](respondWithFilteredResult(_0x21721f,_0x232574))['catch'](handleError(_0x21721f,null));};exports[_0xdfdb('0xbb')]=function(_0x240bb4,_0x5458d6,_0x4bb6df){return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x240bb4[_0xdfdb('0x5d')]['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x5458d6,null))[_0xdfdb('0x38')](function(_0x2cc598){if(_0x2cc598){return _0x2cc598[_0xdfdb('0xbb')](_0x240bb4[_0xdfdb('0x68')][_0xdfdb('0x70')],_[_0xdfdb('0xbc')](_0x240bb4[_0xdfdb('0x68')],[_0xdfdb('0x70'),'id'])||{})[_0xdfdb('0x96')](function(_0x225330){for(var _0xfdd466=0x0;_0xfdd466<_0x240bb4[_0xdfdb('0x68')][_0xdfdb('0x70')][_0xdfdb('0x5f')];_0xfdd466+=0x1){socket['emit'](_0xdfdb('0xbd'),{'UserId':_0x240bb4[_0xdfdb('0x68')][_0xdfdb('0x70')][_0xfdd466],'OpenchannelAccountId':_0x240bb4['params']['id']});}return _0x225330;});}})[_0xdfdb('0x38')](respondWithResult(_0x5458d6,null))[_0xdfdb('0x2b')](handleError(_0x5458d6,null));};exports['removeAgents']=function(_0x2efb8f,_0x3146fe,_0x237849){return db[_0xdfdb('0x43')]['find']({'where':{'id':_0x2efb8f[_0xdfdb('0x5d')]['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x3146fe,null))[_0xdfdb('0x38')](function(_0x2fa88d){if(_0x2fa88d){return _0x2fa88d[_0xdfdb('0xbe')](_0x2efb8f[_0xdfdb('0x49')][_0xdfdb('0x70')])[_0xdfdb('0x38')](function(){if(_[_0xdfdb('0xbf')](_0x2efb8f['query'][_0xdfdb('0x70')])){for(var _0x12c97b=0x0;_0x12c97b<_0x2efb8f[_0xdfdb('0x49')][_0xdfdb('0x70')][_0xdfdb('0x5f')];_0x12c97b+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x2efb8f[_0xdfdb('0x49')][_0xdfdb('0x70')][_0x12c97b]),'OpenchannelAccountId':Number(_0x2efb8f[_0xdfdb('0x5d')]['id'])});}}else{socket[_0xdfdb('0xc0')](_0xdfdb('0xc1'),{'UserId':Number(_0x2efb8f[_0xdfdb('0x49')][_0xdfdb('0x70')]),'OpenchannelAccountId':Number(_0x2efb8f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3146fe,null))[_0xdfdb('0x2b')](handleError(_0x3146fe,null));};exports[_0xdfdb('0xc2')]=function(_0x3657aa,_0x199a14,_0x3dab8d){var _0x4812af={};var _0x31e28a={};var _0x24178b;var _0x514e57;return db[_0xdfdb('0x43')][_0xdfdb('0x72')]({'where':{'id':_0x3657aa['params']['id']}})['then'](handleEntityNotFound(_0x199a14,null))['then'](function(_0xd5b25c){if(_0xd5b25c){_0x24178b=_0xd5b25c;_0x31e28a[_0xdfdb('0x48')]=_[_0xdfdb('0x4a')](db[_0xdfdb('0xb3')][_0xdfdb('0x44')]);_0x31e28a[_0xdfdb('0x49')]=_[_0xdfdb('0x4a')](_0x3657aa[_0xdfdb('0x49')]);_0x31e28a[_0xdfdb('0x4b')]=_['intersection'](_0x31e28a[_0xdfdb('0x48')],_0x31e28a[_0xdfdb('0x49')]);_0x4812af['attributes']=_[_0xdfdb('0x4c')](_0x31e28a['model'],qs['fields'](_0x3657aa[_0xdfdb('0x49')][_0xdfdb('0x4e')]));_0x4812af[_0xdfdb('0x4d')]=_0x4812af[_0xdfdb('0x4d')][_0xdfdb('0x5f')]?_0x4812af[_0xdfdb('0x4d')]:_0x31e28a['model'];_0x4812af['order']=qs['sort'](_0x3657aa[_0xdfdb('0x49')][_0xdfdb('0x51')]);_0x4812af[_0xdfdb('0x52')]=qs[_0xdfdb('0x4b')](_[_0xdfdb('0x53')](_0x3657aa[_0xdfdb('0x49')],_0x31e28a['filters']));if(_0x3657aa[_0xdfdb('0x49')]['filter']){_0x4812af[_0xdfdb('0x52')]=_['merge'](_0x4812af[_0xdfdb('0x52')],{'$or':_['map'](_0x4812af[_0xdfdb('0x4d')],function(_0xb37f40){var _0x2f2785={};_0x2f2785[_0xb37f40]={'$like':'%'+_0x3657aa[_0xdfdb('0x49')][_0xdfdb('0x54')]+'%'};return _0x2f2785;})});}_0x4812af=_[_0xdfdb('0x55')]({},_0x4812af,_0x3657aa[_0xdfdb('0x57')]);return _0x24178b[_0xdfdb('0xc2')](_0x4812af);}})['then'](function(_0x5ee7df){if(_0x5ee7df){_0x514e57=_0x5ee7df[_0xdfdb('0x5f')];if(!_0x3657aa['query'][_0xdfdb('0x6e')](_0xdfdb('0x4f'))){_0x4812af[_0xdfdb('0x32')]=qs[_0xdfdb('0x32')](_0x3657aa[_0xdfdb('0x49')][_0xdfdb('0x32')]);_0x4812af[_0xdfdb('0x31')]=qs[_0xdfdb('0x31')](_0x3657aa['query'][_0xdfdb('0x31')]);}return _0x24178b[_0xdfdb('0xc2')](_0x4812af);}})[_0xdfdb('0x38')](function(_0x20f8e6){if(_0x20f8e6){return _0x20f8e6?{'count':_0x514e57,'rows':_0x20f8e6}:null;}})[_0xdfdb('0x38')](respondWithResult(_0x199a14,null))[_0xdfdb('0x2b')](handleError(_0x199a14,null));};exports[_0xdfdb('0x3f')]=function(_0x4faa2b,_0x135758,_0x200441){var _0x167485,_0x562270,_0x8be3d0;if(_[_0xdfdb('0x7f')](_0x4faa2b[_0xdfdb('0x68')][_0xdfdb('0x68')])||_0x4faa2b['body'][_0xdfdb('0x68')]===''){throw new db['Sequelize'][(_0xdfdb('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdfdb('0x7f')](_0x4faa2b[_0xdfdb('0x68')]['to'])){}_0x167485=_0x4faa2b['body']['to'];return db['OpenchannelAccount'][_0xdfdb('0x72')]({'where':{'id':_0x4faa2b[_0xdfdb('0x5d')]['id']}})[_0xdfdb('0x38')](handleEntityNotFound(_0x135758,null))[_0xdfdb('0x38')](function(_0x110f5e){if(_0x110f5e){return db[_0xdfdb('0x43')][_0xdfdb('0x60')]({'where':{'id':_0x110f5e['id']},'include':[{'model':db[_0xdfdb('0x86')],'as':_0xdfdb('0x87'),'include':[{'model':db[_0xdfdb('0x76')],'as':_0xdfdb('0x88'),'where':{[_0x110f5e['mapKey']]:_0x167485},'limit':0x1,'order':[[_0xdfdb('0x7b'),_0xdfdb('0x89')]]}]}]})[_0xdfdb('0x38')](handleEntityNotFound(_0x135758,null))[_0xdfdb('0x38')](function(_0x3d3016){if(_0x3d3016&&_0x3d3016['List']){_0x562270=_0x3d3016['get']({'plain':!![]});if(_0x562270[_0xdfdb('0x87')]&&_0x562270[_0xdfdb('0x87')][_0xdfdb('0x88')][_0xdfdb('0x5f')]){return _0x562270[_0xdfdb('0x87')]['Contacts'][0x0];}return db[_0xdfdb('0x76')]['create'](_[_0xdfdb('0x1a')](_0x4faa2b[_0xdfdb('0x68')],{'firstName':_0x167485,[_0x3d3016[_0xdfdb('0x83')]]:_0x167485,'phone':_0x167485,'ListId':_0x562270[_0xdfdb('0x7e')]}));}})[_0xdfdb('0x38')](handleEntityNotFound(_0x135758,null))[_0xdfdb('0x38')](function(_0x4ddedc){if(_0x4ddedc){_0x8be3d0=_0x4ddedc;return db[_0xdfdb('0x94')][_0xdfdb('0x60')]({'where':{'ContactId':_0x8be3d0['id'],'closed':![],'OpenchannelAccountId':_0x562270['id']}})[_0xdfdb('0x38')](function(_0x287199){if(_0x287199){return[_0x287199,![]];}return db[_0xdfdb('0x94')][_0xdfdb('0x61')]({'UserId':_0x4faa2b[_0xdfdb('0x64')]['id'],'ContactId':_0x8be3d0['id'],'OpenchannelAccountId':_0x562270['id'],'lastMsgDirection':_0xdfdb('0xc3'),'Messages':[_[_0xdfdb('0x55')](_0x4faa2b['body'],{'read':![],'body':_0x4faa2b[_0xdfdb('0x68')]['body'],'OpenchannelAccountId':_0x562270['id'],'UserId':_0x4faa2b[_0xdfdb('0x64')]['id'],'ContactId':_0x8be3d0['id']})]},{'include':[{'model':db[_0xdfdb('0xa1')],'as':_0xdfdb('0xc4')}]})[_0xdfdb('0x38')](function(_0x3b05c3){return[_0x3b05c3,!![]];});});}})['spread'](function(_0x1327ce,_0x51820e){if(_0x51820e){return _0x1327ce;}return db['OpenchannelMessage'][_0xdfdb('0x61')](_[_0xdfdb('0x55')](_0x4faa2b[_0xdfdb('0x68')],{'read':![],'body':_0x4faa2b[_0xdfdb('0x68')][_0xdfdb('0x68')],'OpenchannelAccountId':_0x562270['id'],'OpenchannelInteractionId':_0x1327ce['id'],'UserId':_0x4faa2b[_0xdfdb('0x64')]['id'],'ContactId':_0x8be3d0['id']}))[_0xdfdb('0x38')](function(_0x46de05){_0x1327ce['dataValues'][_0xdfdb('0xc4')]=[];_0x1327ce[_0xdfdb('0xc5')][_0xdfdb('0xc4')][_0xdfdb('0x9d')](_0x46de05[_0xdfdb('0xc5')]);return _0x1327ce;});});}})['then'](respondWithResult(_0x135758,null))['catch'](handleError(_0x135758,null));}; \ No newline at end of file +var _0x187d=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','OpenchannelAccounts','stack','name','send','index','map','OpenchannelAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','Pause','mandatoryDispositionPause','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','Disposition','include','CannedAnswer','getAnswers','removeAnswers','ids','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','OpenchannelApplication','Applications','account','applications','orderBy','priority','Contacts','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','OpenchannelMessage','AttachmentId','message','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','Tags','tag','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','Messages','dataValues','push','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3549a7,_0x59e9b1){var _0x464ffc=function(_0x118a05){while(--_0x118a05){_0x3549a7['push'](_0x3549a7['shift']());}};_0x464ffc(++_0x59e9b1);}(_0x187d,0x93));var _0xd187=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x187d[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0xd187('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd187('0x1'));var zipdir=require(_0xd187('0x2'));var jsonpatch=require(_0xd187('0x3'));var rp=require(_0xd187('0x4'));var moment=require(_0xd187('0x5'));var BPromise=require(_0xd187('0x6'));var Mustache=require('mustache');var util=require(_0xd187('0x7'));var path=require(_0xd187('0x8'));var sox=require('sox');var csv=require(_0xd187('0x9'));var ejs=require(_0xd187('0xa'));var fs=require('fs');var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x9'));var querystring=require('querystring');var Papa=require(_0xd187('0x10'));var Redis=require(_0xd187('0x11'));var authService=require(_0xd187('0x12'));var qs=require(_0xd187('0x13'));var as=require(_0xd187('0x14'));var hardwareService=require(_0xd187('0x15'));var logger=require('../../config/logger')(_0xd187('0x16'));var utils=require(_0xd187('0x17'));var config=require(_0xd187('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x19'))['db'];config[_0xd187('0x1a')]=_[_0xd187('0x1b')](config['redis'],{'host':_0xd187('0x1c'),'port':0x18eb});var socket=require(_0xd187('0x1d'))(new Redis(config[_0xd187('0x1a')]));require(_0xd187('0x1e'))['register'](socket);var jayson=require(_0xd187('0x1f'));var client=jayson[_0xd187('0x20')][_0xd187('0x21')]({'port':0x232c});var client9002=jayson[_0xd187('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x245d3e,_0x52a208,_0x5cf218,_0x40ed84){return new BPromise(function(_0x5a4986,_0x4ec155){var _0x207b36=_0x40ed84||client;return _0x207b36[_0xd187('0x22')](_0x245d3e,_0x5cf218)[_0xd187('0x23')](function(_0x10d9fd){logger[_0xd187('0x24')](_0xd187('0x25'),_0x52a208,_0xd187('0x26'));logger[_0xd187('0x27')](_0xd187('0x28'),_0x52a208,_0xd187('0x26'),JSON[_0xd187('0x29')](_0x10d9fd));if(_0x10d9fd[_0xd187('0x2a')]){if(_0x10d9fd[_0xd187('0x2a')]['code']===0x1f4){logger[_0xd187('0x2a')](_0xd187('0x25'),_0x52a208,_0x10d9fd[_0xd187('0x2a')]['message']);return _0x4ec155(_0x10d9fd['error']['message']);}logger[_0xd187('0x2a')](_0xd187('0x25'),_0x52a208,_0x10d9fd[_0xd187('0x2a')]['message']);return _0x5a4986(_0x10d9fd[_0xd187('0x2a')]['message']);}else{logger[_0xd187('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x52a208,_0xd187('0x26'));_0x5a4986(_0x10d9fd['result']['message']);}})[_0xd187('0x2b')](function(_0x4d992b){logger[_0xd187('0x2a')](_0xd187('0x25'),_0x52a208,_0x4d992b);_0x4ec155(_0x4d992b);});});}function respondWithStatusCode(_0x4ace17,_0x4eac6a){_0x4eac6a=_0x4eac6a||0xcc;return function(_0x848ddd){if(_0x848ddd){return _0x4ace17[_0xd187('0x2c')](_0x4eac6a);}return _0x4ace17[_0xd187('0x2d')](_0x4eac6a)[_0xd187('0x2e')]();};}function respondWithResult(_0x5cf19a,_0x2a20ed){_0x2a20ed=_0x2a20ed||0xc8;return function(_0x2875c8){if(_0x2875c8){return _0x5cf19a['status'](_0x2a20ed)[_0xd187('0x2f')](_0x2875c8);}};}function respondWithFilteredResult(_0x1c87ee,_0x34febe){return function(_0x4c50a5){if(_0x4c50a5){var _0x15e2e8=_0x4c50a5[_0xd187('0x30')],_0x56e292=_0x34febe[_0xd187('0x31')],_0x263e31=_0x34febe['offset']+_0x34febe[_0xd187('0x32')],_0x19e75f;if(_0x263e31>=_0x15e2e8){_0x263e31=_0x15e2e8;_0x19e75f=0xc8;}else{_0x19e75f=0xce;}_0x1c87ee[_0xd187('0x2d')](_0x19e75f);return _0x1c87ee['set']('Content-Range',_0x56e292+'-'+_0x263e31+'/'+_0x15e2e8)[_0xd187('0x2f')](_0x4c50a5);}return null;};}function patchUpdates(_0x1836cf){return function(_0x13f285){try{jsonpatch[_0xd187('0x33')](_0x13f285,_0x1836cf,!![]);}catch(_0x2874b2){return BPromise[_0xd187('0x34')](_0x2874b2);}return _0x13f285[_0xd187('0x35')]();};}function saveUpdates(_0x4713df,_0x5d748f){return function(_0xf03eb5){if(_0xf03eb5){return _0xf03eb5[_0xd187('0x36')](_0x4713df)[_0xd187('0x23')](function(_0x5e2f2e){return _0x5e2f2e;});}return null;};}function removeEntity(_0x22d84b,_0x5393c5){return function(_0xb3efa3){if(_0xb3efa3){return _0xb3efa3[_0xd187('0x37')]()[_0xd187('0x23')](function(){var _0x4d9d97=_0xb3efa3['get']({'plain':!![]});var _0x236ca4=_0xd187('0x38');return db['UserProfileResource'][_0xd187('0x37')]({'where':{'type':_0x236ca4,'resourceId':_0x4d9d97['id']}})[_0xd187('0x23')](function(){return _0xb3efa3;});})[_0xd187('0x23')](function(){_0x22d84b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x236139,_0xf32da2){return function(_0x556146){if(!_0x556146){_0x236139['sendStatus'](0x194);}return _0x556146;};}function handleError(_0x57d10e,_0x31d7f4){_0x31d7f4=_0x31d7f4||0x1f4;return function(_0x578f87){logger[_0xd187('0x2a')](_0x578f87[_0xd187('0x39')]);if(_0x578f87['name']){delete _0x578f87[_0xd187('0x3a')];}_0x57d10e['status'](_0x31d7f4)[_0xd187('0x3b')](_0x578f87);};}exports[_0xd187('0x3c')]=function(_0x4af59f,_0x1a6256){var _0x1d6d97={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x56cbb2={},_0x4399a5={'count':0x0,'rows':[]};var _0x26b06d=_[_0xd187('0x3d')](db[_0xd187('0x3e')][_0xd187('0x3f')],function(_0x6d1c18){return{'name':_0x6d1c18['fieldName'],'type':_0x6d1c18[_0xd187('0x40')][_0xd187('0x41')]};});_0x56cbb2[_0xd187('0x42')]=_['map'](_0x26b06d,'name');_0x56cbb2['query']=_['keys'](_0x4af59f[_0xd187('0x43')]);_0x56cbb2[_0xd187('0x44')]=_[_0xd187('0x45')](_0x56cbb2[_0xd187('0x42')],_0x56cbb2[_0xd187('0x43')]);_0x1d6d97[_0xd187('0x46')]=_[_0xd187('0x45')](_0x56cbb2[_0xd187('0x42')],qs['fields'](_0x4af59f[_0xd187('0x43')][_0xd187('0x47')]));_0x1d6d97[_0xd187('0x46')]=_0x1d6d97['attributes'][_0xd187('0x48')]?_0x1d6d97['attributes']:_0x56cbb2[_0xd187('0x42')];if(!_0x4af59f[_0xd187('0x43')][_0xd187('0x49')](_0xd187('0x4a'))){_0x1d6d97[_0xd187('0x32')]=qs['limit'](_0x4af59f[_0xd187('0x43')][_0xd187('0x32')]);_0x1d6d97[_0xd187('0x31')]=qs[_0xd187('0x31')](_0x4af59f['query'][_0xd187('0x31')]);}_0x1d6d97[_0xd187('0x4b')]=qs['sort'](_0x4af59f[_0xd187('0x43')][_0xd187('0x4c')]);_0x1d6d97['where']=qs['filters'](_[_0xd187('0x4d')](_0x4af59f[_0xd187('0x43')],_0x56cbb2['filters']),_0x26b06d);if(_0x4af59f['query']['filter']){_0x1d6d97[_0xd187('0x4e')]=_[_0xd187('0x4f')](_0x1d6d97[_0xd187('0x4e')],{'$or':_[_0xd187('0x3d')](_0x26b06d,function(_0x321b86){if(_0x321b86[_0xd187('0x40')]!==_0xd187('0x50')){var _0x573155={};_0x573155[_0x321b86[_0xd187('0x3a')]]={'$like':'%'+_0x4af59f[_0xd187('0x43')][_0xd187('0x51')]+'%'};return _0x573155;}})});}_0x1d6d97=_[_0xd187('0x4f')]({},_0x1d6d97,_0x4af59f[_0xd187('0x52')]);var _0x2dc84f={'where':_0x1d6d97[_0xd187('0x4e')]};return db[_0xd187('0x3e')]['count'](_0x2dc84f)[_0xd187('0x23')](function(_0x2657be){_0x4399a5[_0xd187('0x30')]=_0x2657be;if(_0x4af59f[_0xd187('0x43')][_0xd187('0x53')]){_0x1d6d97['include']=[{'all':!![]}];}return db[_0xd187('0x3e')][_0xd187('0x54')](_0x1d6d97);})['then'](function(_0x429c48){_0x4399a5[_0xd187('0x55')]=_0x429c48;return _0x4399a5;})['then'](respondWithFilteredResult(_0x1a6256,_0x1d6d97))['catch'](handleError(_0x1a6256,null));};exports['show']=function(_0x4ce658,_0x473bef){var _0x22f432={'raw':![],'where':{'id':_0x4ce658[_0xd187('0x56')]['id']},'include':[{'model':db[_0xd187('0x57')],'as':_0xd187('0x58')}]},_0x12d448={};_0x12d448[_0xd187('0x42')]=_['keys'](db[_0xd187('0x3e')][_0xd187('0x3f')]);_0x12d448[_0xd187('0x43')]=_[_0xd187('0x59')](_0x4ce658['query']);_0x12d448[_0xd187('0x44')]=_['intersection'](_0x12d448['model'],_0x12d448[_0xd187('0x43')]);_0x22f432['attributes']=_[_0xd187('0x45')](_0x12d448[_0xd187('0x42')],qs[_0xd187('0x47')](_0x4ce658[_0xd187('0x43')][_0xd187('0x47')]));_0x22f432[_0xd187('0x46')]=_0x22f432[_0xd187('0x46')][_0xd187('0x48')]?_0x22f432[_0xd187('0x46')]:_0x12d448['model'];if(_0x4ce658[_0xd187('0x43')][_0xd187('0x53')]){_0x22f432['include']=[{'all':!![]}];}_0x22f432=_[_0xd187('0x4f')]({},_0x22f432,_0x4ce658[_0xd187('0x52')]);return db[_0xd187('0x3e')]['find'](_0x22f432)[_0xd187('0x23')](handleEntityNotFound(_0x473bef,null))[_0xd187('0x23')](respondWithResult(_0x473bef,null))['catch'](handleError(_0x473bef,null));};exports[_0xd187('0x5a')]=function(_0x7173a2,_0x492cea){return db[_0xd187('0x3e')]['create'](_0x7173a2[_0xd187('0x5b')],{})[_0xd187('0x23')](function(_0x3a2a00){var _0x508866=_0x7173a2[_0xd187('0x5c')][_0xd187('0x5d')]({'plain':!![]});if(!_0x508866)throw new Error(_0xd187('0x5e'));if(_0x508866['role']===_0xd187('0x5c')){var _0x298b46=_0x3a2a00[_0xd187('0x5d')]({'plain':!![]});var _0x56b36b=_0xd187('0x38');return db[_0xd187('0x5f')][_0xd187('0x60')]({'where':{'name':_0x56b36b,'userProfileId':_0x508866[_0xd187('0x61')]},'raw':!![]})[_0xd187('0x23')](function(_0x2c4f4d){if(_0x2c4f4d&&_0x2c4f4d[_0xd187('0x62')]===0x0){return db[_0xd187('0x63')][_0xd187('0x5a')]({'name':_0x298b46[_0xd187('0x3a')],'resourceId':_0x298b46['id'],'type':_0x2c4f4d[_0xd187('0x3a')],'sectionId':_0x2c4f4d['id']},{})[_0xd187('0x23')](function(){return _0x3a2a00;});}else{return _0x3a2a00;}})[_0xd187('0x2b')](function(_0x288a04){logger[_0xd187('0x2a')](_0xd187('0x64'),_0x288a04);throw _0x288a04;});}return _0x3a2a00;})[_0xd187('0x23')](respondWithResult(_0x492cea,0xc9))[_0xd187('0x2b')](handleError(_0x492cea,null));};exports[_0xd187('0x36')]=function(_0x36a8cc,_0x5292dd){if(_0x36a8cc[_0xd187('0x5b')]['id']){delete _0x36a8cc['body']['id'];}return db[_0xd187('0x3e')][_0xd187('0x60')]({'where':{'id':_0x36a8cc[_0xd187('0x56')]['id']},'include':[{'model':db[_0xd187('0x57')],'as':'mandatoryDispositionPause'}]})[_0xd187('0x23')](handleEntityNotFound(_0x5292dd,null))[_0xd187('0x23')](saveUpdates(_0x36a8cc['body'],null))['then'](respondWithResult(_0x5292dd,null))[_0xd187('0x2b')](handleError(_0x5292dd,null));};exports[_0xd187('0x37')]=function(_0x2870ad,_0x45e0fe){return db['OpenchannelAccount'][_0xd187('0x60')]({'where':{'id':_0x2870ad['params']['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x45e0fe,null))[_0xd187('0x23')](removeEntity(_0x45e0fe,null))[_0xd187('0x2b')](handleError(_0x45e0fe,null));};exports[_0xd187('0x65')]=function(_0x57cad7,_0x2409a8){return db[_0xd187('0x3e')][_0xd187('0x65')]()[_0xd187('0x23')](respondWithResult(_0x2409a8,null))[_0xd187('0x2b')](handleError(_0x2409a8,null));};exports['addDisposition']=function(_0x5f1031,_0x1b2049,_0x4742f4){if(_0x5f1031[_0xd187('0x5b')]['id']){delete _0x5f1031[_0xd187('0x5b')]['id'];}return db[_0xd187('0x3e')][_0xd187('0x60')]({'where':{'id':_0x5f1031[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x1b2049,null))[_0xd187('0x23')](function(_0x3765b0){if(_0x3765b0){_0x5f1031[_0xd187('0x5b')][_0xd187('0x66')]=_0x3765b0['id'];return db['Disposition'][_0xd187('0x5a')](_0x5f1031[_0xd187('0x5b')]);}})['then'](respondWithResult(_0x1b2049,null))[_0xd187('0x2b')](handleError(_0x1b2049,null));};exports[_0xd187('0x67')]=function(_0x4bec3e,_0x59f46d,_0x32ba2a){var _0x3243a7={'raw':![],'where':{}};var _0x2ac56f={};var _0x2f743b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd187('0x68')]({'where':{'id':_0x4bec3e[_0xd187('0x56')]['id']}})['then'](handleEntityNotFound(_0x59f46d,null))['then'](function(_0x3bca83){if(_0x3bca83){_0x2ac56f['model']=_[_0xd187('0x59')](db[_0xd187('0x69')]['rawAttributes']);_0x2ac56f[_0xd187('0x43')]=_['keys'](_0x4bec3e[_0xd187('0x43')]);_0x2ac56f['filters']=_['intersection'](_0x2ac56f['model'],_0x2ac56f[_0xd187('0x43')]);_0x3243a7[_0xd187('0x46')]=_[_0xd187('0x45')](_0x2ac56f[_0xd187('0x42')],qs[_0xd187('0x47')](_0x4bec3e[_0xd187('0x43')][_0xd187('0x47')]));_0x3243a7[_0xd187('0x46')]=_0x3243a7['attributes'][_0xd187('0x48')]?_0x3243a7[_0xd187('0x46')]:_0x2ac56f[_0xd187('0x42')];if(!_0x4bec3e['query'][_0xd187('0x49')](_0xd187('0x4a'))){_0x3243a7[_0xd187('0x32')]=qs[_0xd187('0x32')](_0x4bec3e['query'][_0xd187('0x32')]);_0x3243a7[_0xd187('0x31')]=qs['offset'](_0x4bec3e[_0xd187('0x43')][_0xd187('0x31')]);}_0x3243a7[_0xd187('0x4b')]=qs[_0xd187('0x4c')](_0x4bec3e['query'][_0xd187('0x4c')]);_0x3243a7[_0xd187('0x4e')]=qs['filters'](_[_0xd187('0x4d')](_0x4bec3e['query'],_0x2ac56f['filters']));_0x3243a7['where'][_0xd187('0x66')]=_0x3bca83['id'];if(_0x4bec3e[_0xd187('0x43')][_0xd187('0x51')]){_0x3243a7[_0xd187('0x4e')]=_[_0xd187('0x4f')](_0x3243a7[_0xd187('0x4e')],{'$or':_['map'](_0x3243a7[_0xd187('0x46')],function(_0x8af7bd){var _0x4d95e4={};_0x4d95e4[_0x8af7bd]={'$like':'%'+_0x4bec3e['query'][_0xd187('0x51')]+'%'};return _0x4d95e4;})});}_0x3243a7=_[_0xd187('0x4f')]({},_0x3243a7,_0x4bec3e[_0xd187('0x52')]);return db[_0xd187('0x69')][_0xd187('0x30')]({'where':_0x3243a7[_0xd187('0x4e')]})['then'](function(_0x206819){_0x2f743b[_0xd187('0x30')]=_0x206819;if(_0x4bec3e[_0xd187('0x43')][_0xd187('0x53')]){_0x3243a7[_0xd187('0x6a')]=[{'all':!![]}];}return db[_0xd187('0x69')][_0xd187('0x54')](_0x3243a7);})[_0xd187('0x23')](function(_0x3d9b2f){_0x2f743b[_0xd187('0x55')]=_0x3d9b2f;return _0x2f743b;});}})[_0xd187('0x23')](respondWithFilteredResult(_0x59f46d,_0x3243a7))[_0xd187('0x2b')](handleError(_0x59f46d,null));};exports['removeDispositions']=function(_0x50a948,_0x3d7e97,_0x2b2c64){return db[_0xd187('0x3e')][_0xd187('0x60')]({'where':{'id':_0x50a948[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x3d7e97,null))['then'](function(_0x3e06b5){if(_0x3e06b5){return _0x3e06b5['removeDispositions'](_0x50a948[_0xd187('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x3d7e97,null))[_0xd187('0x2b')](handleError(_0x3d7e97,null));};exports['addAnswer']=function(_0x2fc480,_0x44ad5c,_0x1ccb17){if(_0x2fc480[_0xd187('0x5b')]['id']){delete _0x2fc480[_0xd187('0x5b')]['id'];}return db[_0xd187('0x3e')][_0xd187('0x60')]({'where':{'id':_0x2fc480[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x44ad5c,null))[_0xd187('0x23')](function(_0x1e8839){if(_0x1e8839){_0x2fc480[_0xd187('0x5b')][_0xd187('0x66')]=_0x1e8839['id'];return db[_0xd187('0x6b')][_0xd187('0x5a')](_0x2fc480['body']);}})[_0xd187('0x23')](respondWithResult(_0x44ad5c,null))[_0xd187('0x2b')](handleError(_0x44ad5c,null));};exports[_0xd187('0x6c')]=function(_0x43563b,_0x59cc5a,_0x2299c0){var _0x1fb212={'raw':![],'where':{}};var _0x503788={};var _0x4c020b={'count':0x0,'rows':[]};return db[_0xd187('0x3e')][_0xd187('0x68')]({'where':{'id':_0x43563b[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x59cc5a,null))[_0xd187('0x23')](function(_0x475ea9){if(_0x475ea9){_0x503788['model']=_[_0xd187('0x59')](db[_0xd187('0x6b')]['rawAttributes']);_0x503788[_0xd187('0x43')]=_[_0xd187('0x59')](_0x43563b[_0xd187('0x43')]);_0x503788[_0xd187('0x44')]=_['intersection'](_0x503788['model'],_0x503788[_0xd187('0x43')]);_0x1fb212[_0xd187('0x46')]=_[_0xd187('0x45')](_0x503788['model'],qs[_0xd187('0x47')](_0x43563b[_0xd187('0x43')][_0xd187('0x47')]));_0x1fb212[_0xd187('0x46')]=_0x1fb212['attributes'][_0xd187('0x48')]?_0x1fb212['attributes']:_0x503788['model'];if(!_0x43563b['query']['hasOwnProperty']('nolimit')){_0x1fb212['limit']=qs['limit'](_0x43563b[_0xd187('0x43')][_0xd187('0x32')]);_0x1fb212['offset']=qs[_0xd187('0x31')](_0x43563b[_0xd187('0x43')][_0xd187('0x31')]);}_0x1fb212[_0xd187('0x4b')]=qs[_0xd187('0x4c')](_0x43563b['query'][_0xd187('0x4c')]);_0x1fb212['where']=qs[_0xd187('0x44')](_[_0xd187('0x4d')](_0x43563b[_0xd187('0x43')],_0x503788[_0xd187('0x44')]));_0x1fb212[_0xd187('0x4e')][_0xd187('0x66')]=_0x475ea9['id'];if(_0x43563b[_0xd187('0x43')]['filter']){_0x1fb212[_0xd187('0x4e')]=_[_0xd187('0x4f')](_0x1fb212['where'],{'$or':_[_0xd187('0x3d')](_0x1fb212[_0xd187('0x46')],function(_0x5df926){var _0x348b73={};_0x348b73[_0x5df926]={'$like':'%'+_0x43563b[_0xd187('0x43')][_0xd187('0x51')]+'%'};return _0x348b73;})});}_0x1fb212=_[_0xd187('0x4f')]({},_0x1fb212,_0x43563b[_0xd187('0x52')]);return db[_0xd187('0x6b')][_0xd187('0x30')]({'where':_0x1fb212[_0xd187('0x4e')]})['then'](function(_0x32b8a8){_0x4c020b[_0xd187('0x30')]=_0x32b8a8;if(_0x43563b[_0xd187('0x43')][_0xd187('0x53')]){_0x1fb212[_0xd187('0x6a')]=[{'all':!![]}];}return db[_0xd187('0x6b')]['findAll'](_0x1fb212);})['then'](function(_0x3ba34f){_0x4c020b[_0xd187('0x55')]=_0x3ba34f;return _0x4c020b;});}})['then'](respondWithFilteredResult(_0x59cc5a,_0x1fb212))[_0xd187('0x2b')](handleError(_0x59cc5a,null));};exports[_0xd187('0x6d')]=function(_0x2c1402,_0x3215a8,_0x46431a){return db[_0xd187('0x3e')]['find']({'where':{'id':_0x2c1402[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x3215a8,null))[_0xd187('0x23')](function(_0x23e30b){if(_0x23e30b){return _0x23e30b[_0xd187('0x6d')](_0x2c1402[_0xd187('0x43')][_0xd187('0x6e')]);}})[_0xd187('0x23')](respondWithStatusCode(_0x3215a8,null))[_0xd187('0x2b')](handleError(_0x3215a8,null));};exports['notify']=function(_0x438807,_0x162df6,_0x25a053){var _0x478f2d={'body':_0x438807[_0xd187('0x5b')],'channel':_0xd187('0x6f')};var _0x378957=[];var _0x3d667f=[];var _0x1e0e80={};var _0xec0779=![];return db['CmContact'][_0xd187('0x65')]()[_0xd187('0x23')](function(_0x1477df){if(!_0x1477df){throw new db['Sequelize'][(_0xd187('0x70'))](_0xd187('0x71'));}_0x378957=_[_0xd187('0x72')](_[_0xd187('0x59')](_0x1477df),[_0xd187('0x73'),_0xd187('0x74')]);_0x3d667f=_['difference'](_[_0xd187('0x59')](_0x1477df),[_0xd187('0x73'),'updatedAt',_0xd187('0x75'),_0xd187('0x76')]);if(_0x438807['body']['id']){delete _0x438807[_0xd187('0x5b')]['id'];}if(_[_0xd187('0x77')](_0x438807['body'][_0xd187('0x78')])){throw new db[(_0xd187('0x79'))]['ValidationError'](_0xd187('0x7a'));}if(_['isNil'](_0x438807[_0xd187('0x5b')][_0xd187('0x5b')])||_0x438807[_0xd187('0x5b')][_0xd187('0x5b')]===''){throw new db[(_0xd187('0x79'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd187('0x77')](_0x438807[_0xd187('0x5b')][_0xd187('0x7b')])){throw new db[(_0xd187('0x79'))][(_0xd187('0x70'))](_0xd187('0x7c')+_0x3d667f);}if(!_[_0xd187('0x7d')](_0x3d667f,_0x438807['body'][_0xd187('0x7b')])){throw new db[(_0xd187('0x79'))][(_0xd187('0x70'))](_0xd187('0x7e')+_0x3d667f);}_0x1e0e80[_0x438807[_0xd187('0x5b')][_0xd187('0x7b')]]=_0x438807['body'][_0xd187('0x78')];})[_0xd187('0x23')](function(){return db[_0xd187('0x3e')][_0xd187('0x60')]({'where':{'id':_0x438807[_0xd187('0x56')]['id']},'include':[{'model':db[_0xd187('0x7f')],'as':_0xd187('0x80'),'include':[{'model':db[_0xd187('0x81')],'as':'Contacts','where':_0x1e0e80,'limit':0x1,'order':[[_0xd187('0x74'),'DESC']]}]},{'model':db[_0xd187('0x82')],'as':_0xd187('0x83')}]});})['then'](handleEntityNotFound(_0x162df6,null))[_0xd187('0x23')](function(_0x254e0a){if(_0x254e0a&&_0x254e0a['List']){_0x478f2d[_0xd187('0x84')]=_0x254e0a;_0x478f2d['applications']=_0x254e0a[_0xd187('0x83')];_0x478f2d['list']=_0x254e0a['List'];_0x478f2d[_0xd187('0x85')]=_[_0xd187('0x86')](_0x478f2d[_0xd187('0x85')],[_0xd187('0x87')],['asc']);if(_0x478f2d[_0xd187('0x84')][_0xd187('0x83')]){delete _0x478f2d[_0xd187('0x84')][_0xd187('0x83')];}if(_0x478f2d[_0xd187('0x84')][_0xd187('0x80')]&&_0x478f2d[_0xd187('0x84')][_0xd187('0x80')][_0xd187('0x88')][_0xd187('0x48')]){return _0x478f2d['account'][_0xd187('0x80')][_0xd187('0x88')][0x0];}var _0x46f495=_['defaults'](_0x438807['body'],{'firstName':_0x438807[_0xd187('0x5b')][_0xd187('0x78')],'ListId':_0x254e0a[_0xd187('0x76')]});_0x46f495[_0x438807['body']['mapKey']]=_0x438807[_0xd187('0x5b')][_0xd187('0x78')];return db['CmContact'][_0xd187('0x5a')](_0x46f495,{'fields':_0x378957,'raw':!![]});}})[_0xd187('0x23')](handleEntityNotFound(_0x162df6,null))[_0xd187('0x23')](function(_0x23233b){_0x478f2d['contact']=_0x23233b;if(_0x23233b){var _0x219ab4={'ContactId':_0x23233b['id'],'OpenchannelAccountId':_0x438807[_0xd187('0x56')]['id'],'from':(_0x23233b[_0xd187('0x89')]||'')+'\x20'+(_0x23233b[_0xd187('0x8a')]||'')};var _0x23b906={'OpenchannelAccountId':_0x438807[_0xd187('0x56')]['id'],'closed':![]};if(_0x438807[_0xd187('0x5b')]['threadId']){_0x23b906[_0xd187('0x8b')]=_0x438807['body'][_0xd187('0x8b')];return db['OpenchannelInteraction'][_0xd187('0x60')]({'where':_0x23b906})['then'](function(_0x2a1288){if(_0x2a1288){return[_0x2a1288,![]];}_0x219ab4[_0xd187('0x8b')]=_0x438807[_0xd187('0x5b')]['threadId'];_0x219ab4[_0xd187('0x8c')]=_0x438807[_0xd187('0x5b')][_0xd187('0x8c')];return db[_0xd187('0x8d')][_0xd187('0x5a')](_0x219ab4)[_0xd187('0x23')](function(_0x12b4a4){return[_0x12b4a4,!![]];});});}else{_0x23b906[_0xd187('0x8b')]=null;}_0x23b906['ContactId']=_0x23233b['id'];return db[_0xd187('0x8d')][_0xd187('0x60')]({'where':_0x23b906})[_0xd187('0x23')](function(_0x588051){if(_0x588051){return[_0x588051,![]];}return db[_0xd187('0x8d')][_0xd187('0x5a')](_0x219ab4)[_0xd187('0x23')](function(_0x110af6){return[_0x110af6,!![]];});});}})[_0xd187('0x8e')](function(_0x28bc14,_0x2e4db4){if(_0x28bc14){_0xec0779=_0x2e4db4;if(!_0x2e4db4){var _0x1101ee={'from':(_0x478f2d[_0xd187('0x8f')][_0xd187('0x89')]||'')+'\x20'+(_0x478f2d[_0xd187('0x8f')]['lastName']||'')};if(_0x438807[_0xd187('0x5b')][_0xd187('0x8b')]&&_0x438807[_0xd187('0x5b')][_0xd187('0x90')]&&_0x438807['body'][_0xd187('0x8b')]!=_0x438807['body'][_0xd187('0x90')]){_0x1101ee[_0xd187('0x8b')]=_0x438807[_0xd187('0x5b')][_0xd187('0x90')];}return _0x28bc14[_0xd187('0x36')](_0x1101ee);}else{return _0x28bc14;}}})['then'](function(_0x28c8f6){_0x478f2d[_0xd187('0x91')]=_0x28c8f6[_0xd187('0x5d')]({'plain':!![]});_0x478f2d[_0xd187('0x91')][_0xd187('0x92')]=_0xec0779;if(_0x478f2d['interaction'][_0xd187('0x92')]){if(_0x478f2d[_0xd187('0x84')][_0xd187('0x93')]){_0x478f2d['applications']['push']({'id':0x0,'priority':_0x478f2d[_0xd187('0x85')][_0xd187('0x48')]+0x1,'app':_0xd187('0x94'),'appdata':_0xd187('0x95'),'interval':'*,*,*,*'});}}return db[_0xd187('0x96')][_0xd187('0x5a')]({'body':_0x438807[_0xd187('0x5b')][_0xd187('0x5b')],'OpenchannelAccountId':_0x438807['params']['id'],'OpenchannelInteractionId':_0x28c8f6['id'],'direction':'in','ContactId':_0x478f2d[_0xd187('0x8f')]['id'],'AttachmentId':_0x438807['body'][_0xd187('0x97')]});})[_0xd187('0x23')](function(_0x19db38){_0x478f2d[_0xd187('0x98')]=_0x19db38;if(_0x478f2d[_0xd187('0x91')]['UserId']){return db[_0xd187('0x99')][_0xd187('0x60')]({'attributes':['id',_0xd187('0x3a')],'where':{'id':_0x478f2d[_0xd187('0x91')]['UserId']}})[_0xd187('0x23')](function(_0x1b7d8b){if(_0x1b7d8b){_0x478f2d[_0xd187('0x85')][_0xd187('0x9a')]({'id':0x0,'priority':0x0,'app':_0xd187('0x9b'),'appdata':_0x1b7d8b[_0xd187('0x3a')]+','+(_0x478f2d[_0xd187('0x84')][_0xd187('0x9c')]||0xa),'interval':_0xd187('0x9d')});_0x478f2d[_0xd187('0x9e')]=![];}return respondWithRpcPromise(_0xd187('0x9f'),_0xd187('0xa0'),_0x478f2d);});}return respondWithRpcPromise(_0xd187('0x9f'),'startRouting',_0x478f2d);})[_0xd187('0x23')](function(_0x51bb4a){respondWithRpcPromise(_0xd187('0xa1'),'EventManager',{'event':_0xd187('0xa2'),'message':_0x51bb4a},client9002);return _0x51bb4a;})[_0xd187('0x23')](respondWithResult(_0x162df6,null))[_0xd187('0x2b')](handleError(_0x162df6,null));};exports[_0xd187('0xa3')]=function(_0x49acad,_0x5ce7ea,_0x29380b){return db[_0xd187('0x3e')][_0xd187('0x68')]({'where':{'id':_0x49acad[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x5ce7ea,null))[_0xd187('0x23')](function(_0x58b3c3){if(_0x58b3c3){return db['sequelize'][_0xd187('0xa4')](function(_0x237855){return db[_0xd187('0x82')]['destroy']({'where':{'OpenchannelAccountId':_0x49acad[_0xd187('0x56')]['id']},'transaction':_0x237855})[_0xd187('0x23')](function(_0x14a63c){var _0x5e4bf4=_[_0xd187('0x3d')](_0x49acad['body'],function(_0x12143f){_0x12143f['OpenchannelAccountId']=_0x49acad['params']['id'];return _0x12143f;});return db['OpenchannelApplication'][_0xd187('0xa5')](_0x5e4bf4,{'transaction':_0x237855});});})[_0xd187('0x23')](function(){return db[_0xd187('0x82')][_0xd187('0xa6')]({'where':{'OpenchannelAccountId':_0x49acad[_0xd187('0x56')]['id']},'order':_0xd187('0x87')});});}})['then'](respondWithResult(_0x5ce7ea,null))[_0xd187('0x2b')](handleError(_0x5ce7ea,null));};exports['getApplications']=function(_0x30c8e0,_0x3ee43e,_0x3c71f3){var _0x96880e={};var _0xc80fe4={};var _0x78ea1a;var _0x516e65;return db[_0xd187('0x3e')][_0xd187('0x68')]({'where':{'id':_0x30c8e0[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x3ee43e,null))['then'](function(_0x27808b){if(_0x27808b){_0x78ea1a=_0x27808b;_0xc80fe4[_0xd187('0x42')]=_['keys'](db[_0xd187('0x82')][_0xd187('0x3f')]);_0xc80fe4[_0xd187('0x43')]=_[_0xd187('0x59')](_0x30c8e0['query']);_0xc80fe4[_0xd187('0x44')]=_['intersection'](_0xc80fe4['model'],_0xc80fe4['query']);_0x96880e[_0xd187('0x46')]=_[_0xd187('0x45')](_0xc80fe4[_0xd187('0x42')],qs[_0xd187('0x47')](_0x30c8e0[_0xd187('0x43')][_0xd187('0x47')]));_0x96880e[_0xd187('0x46')]=_0x96880e[_0xd187('0x46')]['length']?_0x96880e[_0xd187('0x46')]:_0xc80fe4[_0xd187('0x42')];_0x96880e[_0xd187('0x4b')]=qs['sort'](_0x30c8e0[_0xd187('0x43')][_0xd187('0x4c')]);_0x96880e[_0xd187('0x4e')]=qs[_0xd187('0x44')](_[_0xd187('0x4d')](_0x30c8e0['query'],_0xc80fe4[_0xd187('0x44')]));if(_0x30c8e0[_0xd187('0x43')][_0xd187('0x51')]){_0x96880e['where']=_[_0xd187('0x4f')](_0x96880e[_0xd187('0x4e')],{'$or':_[_0xd187('0x3d')](_0x96880e[_0xd187('0x46')],function(_0x5692b6){var _0x476b70={};_0x476b70[_0x5692b6]={'$like':'%'+_0x30c8e0[_0xd187('0x43')][_0xd187('0x51')]+'%'};return _0x476b70;})});}_0x96880e=_[_0xd187('0x4f')]({},_0x96880e,_0x30c8e0['options']);return _0x78ea1a[_0xd187('0xa7')](_0x96880e);}})[_0xd187('0x23')](function(_0x4d1799){if(_0x4d1799){_0x516e65=_0x4d1799[_0xd187('0x48')];if(!_0x30c8e0['query'][_0xd187('0x49')]('nolimit')){_0x96880e['limit']=qs[_0xd187('0x32')](_0x30c8e0['query'][_0xd187('0x32')]);_0x96880e['offset']=qs[_0xd187('0x31')](_0x30c8e0[_0xd187('0x43')]['offset']);}return _0x78ea1a[_0xd187('0xa7')](_0x96880e);}})[_0xd187('0x23')](function(_0x3f7f72){if(_0x3f7f72){return _0x3f7f72?{'count':_0x516e65,'rows':_0x3f7f72}:null;}})[_0xd187('0x23')](respondWithResult(_0x3ee43e,null))[_0xd187('0x2b')](handleError(_0x3ee43e,null));};exports[_0xd187('0xa8')]=function(_0x11993b,_0x310cff,_0x35cb81){var _0x14f68a={'raw':![],'where':{}};var _0x37c239={};var _0x3fd077={'count':0x0,'rows':[]};return db[_0xd187('0x3e')]['findOne']({'where':{'id':_0x11993b[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x310cff,null))[_0xd187('0x23')](function(_0x2dc30a){if(_0x2dc30a){_0x37c239[_0xd187('0x42')]=_[_0xd187('0x59')](db['OpenchannelInteraction'][_0xd187('0x3f')]);_0x37c239['query']=_['keys'](_0x11993b[_0xd187('0x43')]);_0x37c239[_0xd187('0x44')]=_[_0xd187('0x45')](_0x37c239[_0xd187('0x42')],_0x37c239[_0xd187('0x43')]);_0x14f68a[_0xd187('0x46')]=_[_0xd187('0x45')](_0x37c239[_0xd187('0x42')],qs[_0xd187('0x47')](_0x11993b[_0xd187('0x43')]['fields']));_0x14f68a[_0xd187('0x46')]=_0x14f68a[_0xd187('0x46')][_0xd187('0x48')]?_0x14f68a[_0xd187('0x46')]:_0x37c239[_0xd187('0x42')];if(!_0x11993b[_0xd187('0x43')][_0xd187('0x49')](_0xd187('0x4a'))){_0x14f68a[_0xd187('0x32')]=qs[_0xd187('0x32')](_0x11993b[_0xd187('0x43')][_0xd187('0x32')]);_0x14f68a['offset']=qs[_0xd187('0x31')](_0x11993b['query'][_0xd187('0x31')]);}_0x14f68a[_0xd187('0x4b')]=qs['sort'](_0x11993b['query'][_0xd187('0x4c')]);_0x14f68a[_0xd187('0x4e')]=qs[_0xd187('0x44')](_[_0xd187('0x4d')](_0x11993b[_0xd187('0x43')],_0x37c239[_0xd187('0x44')]));_0x14f68a[_0xd187('0x4e')][_0xd187('0x66')]=_0x2dc30a['id'];if(_0x11993b[_0xd187('0x43')][_0xd187('0x51')]){_0x14f68a[_0xd187('0x4e')]=_[_0xd187('0x4f')](_0x14f68a[_0xd187('0x4e')],{'$or':_['map'](_0x14f68a[_0xd187('0x46')],function(_0xbce7d9){var _0x3a7d8={};_0x3a7d8[_0xbce7d9]={'$like':'%'+_0x11993b[_0xd187('0x43')][_0xd187('0x51')]+'%'};return _0x3a7d8;})});}_0x14f68a=_[_0xd187('0x4f')]({},_0x14f68a,_0x11993b['options']);return db[_0xd187('0x8d')][_0xd187('0x30')]({'where':_0x14f68a[_0xd187('0x4e')]})[_0xd187('0x23')](function(_0x458173){_0x3fd077[_0xd187('0x30')]=_0x458173;if(_0x11993b[_0xd187('0x43')]['includeAll']){_0x14f68a[_0xd187('0x6a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd187('0x99')],'as':_0xd187('0xa9'),'attributes':['name',_0xd187('0xaa'),'internal'],'required':![]},{'model':db[_0xd187('0xab')],'as':_0xd187('0xac'),'attributes':['id',_0xd187('0x3a'),'color'],'where':_0x11993b['query'][_0xd187('0xad')]?{'id':_0x11993b[_0xd187('0x43')][_0xd187('0xad')]}:undefined,'required':_0x11993b['query'][_0xd187('0xad')]?!![]:![]}];}return db[_0xd187('0x8d')][_0xd187('0x54')](_0x14f68a);})['then'](function(_0xa3559a){_0x3fd077[_0xd187('0x55')]=_0xa3559a;return _0x3fd077;});}})[_0xd187('0x23')](respondWithFilteredResult(_0x310cff,_0x14f68a))[_0xd187('0x2b')](handleError(_0x310cff,null));};exports['addAgents']=function(_0x13c638,_0x25e1cc,_0xe37b3d){return db['OpenchannelAccount']['find']({'where':{'id':_0x13c638[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x25e1cc,null))[_0xd187('0x23')](function(_0x55a519){if(_0x55a519){return _0x55a519['addAgents'](_0x13c638[_0xd187('0x5b')]['ids'],_[_0xd187('0xae')](_0x13c638[_0xd187('0x5b')],[_0xd187('0x6e'),'id'])||{})[_0xd187('0x8e')](function(_0x56e4a7){for(var _0x29fc97=0x0;_0x29fc97<_0x13c638['body'][_0xd187('0x6e')]['length'];_0x29fc97+=0x1){socket['emit'](_0xd187('0xaf'),{'UserId':_0x13c638[_0xd187('0x5b')][_0xd187('0x6e')][_0x29fc97],'OpenchannelAccountId':_0x13c638[_0xd187('0x56')]['id']});}return _0x56e4a7;});}})[_0xd187('0x23')](respondWithResult(_0x25e1cc,null))[_0xd187('0x2b')](handleError(_0x25e1cc,null));};exports[_0xd187('0xb0')]=function(_0x121a31,_0x4a5940,_0x13b2c4){return db['OpenchannelAccount'][_0xd187('0x60')]({'where':{'id':_0x121a31['params']['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x4a5940,null))['then'](function(_0x1de709){if(_0x1de709){return _0x1de709[_0xd187('0xb0')](_0x121a31[_0xd187('0x43')][_0xd187('0x6e')])[_0xd187('0x23')](function(){if(_[_0xd187('0xb1')](_0x121a31[_0xd187('0x43')][_0xd187('0x6e')])){for(var _0x2d556f=0x0;_0x2d556f<_0x121a31[_0xd187('0x43')][_0xd187('0x6e')]['length'];_0x2d556f+=0x1){socket[_0xd187('0xb2')](_0xd187('0xb3'),{'UserId':Number(_0x121a31[_0xd187('0x43')][_0xd187('0x6e')][_0x2d556f]),'OpenchannelAccountId':Number(_0x121a31[_0xd187('0x56')]['id'])});}}else{socket['emit'](_0xd187('0xb3'),{'UserId':Number(_0x121a31[_0xd187('0x43')][_0xd187('0x6e')]),'OpenchannelAccountId':Number(_0x121a31[_0xd187('0x56')]['id'])});}});}})[_0xd187('0x23')](respondWithStatusCode(_0x4a5940,null))['catch'](handleError(_0x4a5940,null));};exports[_0xd187('0xb4')]=function(_0x50dfcf,_0x2de11d,_0x51278c){var _0xbb3d7a={};var _0x18e002={};var _0x3af751;var _0x27efd3;return db['OpenchannelAccount'][_0xd187('0x68')]({'where':{'id':_0x50dfcf[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x2de11d,null))[_0xd187('0x23')](function(_0x160256){if(_0x160256){_0x3af751=_0x160256;_0x18e002['model']=_[_0xd187('0x59')](db[_0xd187('0x99')][_0xd187('0x3f')]);_0x18e002[_0xd187('0x43')]=_[_0xd187('0x59')](_0x50dfcf[_0xd187('0x43')]);_0x18e002[_0xd187('0x44')]=_[_0xd187('0x45')](_0x18e002[_0xd187('0x42')],_0x18e002[_0xd187('0x43')]);_0xbb3d7a[_0xd187('0x46')]=_[_0xd187('0x45')](_0x18e002[_0xd187('0x42')],qs[_0xd187('0x47')](_0x50dfcf[_0xd187('0x43')][_0xd187('0x47')]));_0xbb3d7a['attributes']=_0xbb3d7a[_0xd187('0x46')][_0xd187('0x48')]?_0xbb3d7a[_0xd187('0x46')]:_0x18e002['model'];_0xbb3d7a[_0xd187('0x4b')]=qs[_0xd187('0x4c')](_0x50dfcf['query'][_0xd187('0x4c')]);_0xbb3d7a[_0xd187('0x4e')]=qs[_0xd187('0x44')](_[_0xd187('0x4d')](_0x50dfcf[_0xd187('0x43')],_0x18e002[_0xd187('0x44')]));if(_0x50dfcf['query'][_0xd187('0x51')]){_0xbb3d7a[_0xd187('0x4e')]=_['merge'](_0xbb3d7a[_0xd187('0x4e')],{'$or':_[_0xd187('0x3d')](_0xbb3d7a[_0xd187('0x46')],function(_0x277c28){var _0x2f99c2={};_0x2f99c2[_0x277c28]={'$like':'%'+_0x50dfcf[_0xd187('0x43')][_0xd187('0x51')]+'%'};return _0x2f99c2;})});}_0xbb3d7a=_['merge']({},_0xbb3d7a,_0x50dfcf['options']);return _0x3af751[_0xd187('0xb4')](_0xbb3d7a);}})['then'](function(_0x4ed13c){if(_0x4ed13c){_0x27efd3=_0x4ed13c['length'];if(!_0x50dfcf[_0xd187('0x43')][_0xd187('0x49')](_0xd187('0x4a'))){_0xbb3d7a[_0xd187('0x32')]=qs[_0xd187('0x32')](_0x50dfcf[_0xd187('0x43')][_0xd187('0x32')]);_0xbb3d7a[_0xd187('0x31')]=qs[_0xd187('0x31')](_0x50dfcf['query'][_0xd187('0x31')]);}return _0x3af751[_0xd187('0xb4')](_0xbb3d7a);}})['then'](function(_0x38287f){if(_0x38287f){return _0x38287f?{'count':_0x27efd3,'rows':_0x38287f}:null;}})[_0xd187('0x23')](respondWithResult(_0x2de11d,null))[_0xd187('0x2b')](handleError(_0x2de11d,null));};exports[_0xd187('0x3b')]=function(_0x32d004,_0x588aa3,_0x56eaca){var _0x3636fe,_0x436695,_0x481cde;if(_[_0xd187('0x77')](_0x32d004[_0xd187('0x5b')]['body'])||_0x32d004[_0xd187('0x5b')][_0xd187('0x5b')]===''){throw new db[(_0xd187('0x79'))][(_0xd187('0x70'))](_0xd187('0xb5'));}if(_['isNil'](_0x32d004[_0xd187('0x5b')]['to'])){}_0x3636fe=_0x32d004[_0xd187('0x5b')]['to'];return db['OpenchannelAccount'][_0xd187('0x68')]({'where':{'id':_0x32d004[_0xd187('0x56')]['id']}})[_0xd187('0x23')](handleEntityNotFound(_0x588aa3,null))[_0xd187('0x23')](function(_0x428276){if(_0x428276){return db[_0xd187('0x3e')][_0xd187('0x60')]({'where':{'id':_0x428276['id']},'include':[{'model':db[_0xd187('0x7f')],'as':_0xd187('0x80'),'include':[{'model':db[_0xd187('0x81')],'as':'Contacts','where':{[_0x428276[_0xd187('0x7b')]]:_0x3636fe},'limit':0x1,'order':[['updatedAt',_0xd187('0xb6')]]}]}]})['then'](handleEntityNotFound(_0x588aa3,null))[_0xd187('0x23')](function(_0x44c1aa){if(_0x44c1aa&&_0x44c1aa[_0xd187('0x80')]){_0x436695=_0x44c1aa[_0xd187('0x5d')]({'plain':!![]});if(_0x436695[_0xd187('0x80')]&&_0x436695['List'][_0xd187('0x88')]['length']){return _0x436695['List'][_0xd187('0x88')][0x0];}return db['CmContact'][_0xd187('0x5a')](_['defaults'](_0x32d004[_0xd187('0x5b')],{'firstName':_0x3636fe,[_0x44c1aa[_0xd187('0x7b')]]:_0x3636fe,'phone':_0x3636fe,'ListId':_0x436695[_0xd187('0x76')]}));}})[_0xd187('0x23')](handleEntityNotFound(_0x588aa3,null))[_0xd187('0x23')](function(_0x3160c3){if(_0x3160c3){_0x481cde=_0x3160c3;return db[_0xd187('0x8d')][_0xd187('0x60')]({'where':{'ContactId':_0x481cde['id'],'closed':![],'OpenchannelAccountId':_0x436695['id']}})['then'](function(_0xca6ce3){if(_0xca6ce3){return[_0xca6ce3,![]];}return db[_0xd187('0x8d')][_0xd187('0x5a')]({'UserId':_0x32d004[_0xd187('0x5c')]['id'],'ContactId':_0x481cde['id'],'OpenchannelAccountId':_0x436695['id'],'lastMsgDirection':'out','Messages':[_[_0xd187('0x4f')](_0x32d004['body'],{'read':![],'body':_0x32d004[_0xd187('0x5b')]['body'],'OpenchannelAccountId':_0x436695['id'],'UserId':_0x32d004['user']['id'],'ContactId':_0x481cde['id']})]},{'include':[{'model':db[_0xd187('0x96')],'as':_0xd187('0xb7')}]})['then'](function(_0x25f76e){return[_0x25f76e,!![]];});});}})[_0xd187('0x8e')](function(_0x1f7167,_0x2b016f){if(_0x2b016f){return _0x1f7167;}return db[_0xd187('0x96')][_0xd187('0x5a')](_[_0xd187('0x4f')](_0x32d004[_0xd187('0x5b')],{'read':![],'body':_0x32d004[_0xd187('0x5b')][_0xd187('0x5b')],'OpenchannelAccountId':_0x436695['id'],'OpenchannelInteractionId':_0x1f7167['id'],'UserId':_0x32d004[_0xd187('0x5c')]['id'],'ContactId':_0x481cde['id']}))['then'](function(_0x31091d){_0x1f7167[_0xd187('0xb8')]['Messages']=[];_0x1f7167[_0xd187('0xb8')][_0xd187('0xb7')][_0xd187('0xb9')](_0x31091d['dataValues']);return _0x1f7167;});});}})[_0xd187('0x23')](respondWithResult(_0x588aa3,null))[_0xd187('0x2b')](handleError(_0x588aa3,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0a4c1bc..1a57f67 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 _0xf783=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4069f1,_0xf07500){var _0x51cabf=function(_0xd091e3){while(--_0xd091e3){_0x4069f1['push'](_0x4069f1['shift']());}};_0x51cabf(++_0xf07500);}(_0xf783,0x142));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x3f78('0x0'))['db'][_0x3f78('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3f78('0x2')](0x0);var events={'afterCreate':_0x3f78('0x3'),'afterUpdate':_0x3f78('0x4'),'afterDestroy':_0x3f78('0x5')};function emitEvent(_0x257153){return function(_0x1ec9ab,_0x303fd6,_0x1bd188){OpenchannelAccountEvents[_0x3f78('0x6')](_0x257153+':'+_0x1ec9ab['id'],_0x1ec9ab);OpenchannelAccountEvents[_0x3f78('0x6')](_0x257153,_0x1ec9ab);_0x1bd188(null);};}for(var e in events){if(events[_0x3f78('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3f78('0x8')](e,emitEvent(event));}}module[_0x3f78('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe7f7=['OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1eb8a8,_0x4d6ec3){var _0x1be04a=function(_0x5bcd80){while(--_0x5bcd80){_0x1eb8a8['push'](_0x1eb8a8['shift']());}};_0x1be04a(++_0x4d6ec3);}(_0xe7f7,0xb3));var _0x7e7f=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0xe7f7[_0x1ee9a1];return _0x21270f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7e7f('0x0'))['db'][_0x7e7f('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7e7f('0x2')](0x0);var events={'afterCreate':_0x7e7f('0x3'),'afterUpdate':_0x7e7f('0x4'),'afterDestroy':_0x7e7f('0x5')};function emitEvent(_0x44c023){return function(_0x5d0fe1,_0x58a07f,_0x2c65f2){OpenchannelAccountEvents[_0x7e7f('0x6')](_0x44c023+':'+_0x5d0fe1['id'],_0x5d0fe1);OpenchannelAccountEvents['emit'](_0x44c023,_0x5d0fe1);_0x2c65f2(null);};}for(var e in events){if(events[_0x7e7f('0x7')](e)){var event=events[e];OpenchannelAccount[_0x7e7f('0x8')](e,emitEvent(event));}}module[_0x7e7f('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 66435d8..23877eb 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 _0x5078=['path','rimraf','./openchannelAccount.attributes','exports','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x31810e,_0x5ab8cc){var _0xf57b86=function(_0x4b46a8){while(--_0x4b46a8){_0x31810e['push'](_0x31810e['shift']());}};_0xf57b86(++_0x5ab8cc);}(_0x5078,0x126));var _0x8507=function(_0x461eff,_0x283cd4){_0x461eff=_0x461eff-0x0;var _0x4fa4e5=_0x5078[_0x461eff];return _0x4fa4e5;};'use strict';var _=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var logger=require(_0x8507('0x2'))('api');var moment=require(_0x8507('0x3'));var BPromise=require(_0x8507('0x4'));var rp=require(_0x8507('0x5'));var fs=require('fs');var path=require(_0x8507('0x6'));var rimraf=require(_0x8507('0x7'));var config=require('../../config/environment');var attributes=require(_0x8507('0x8'));module[_0x8507('0x9')]=function(_0x3b2e94,_0x2ba5c4){return _0x3b2e94['define'](_0x8507('0xa'),attributes,{'tableName':_0x8507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5812=['path','rimraf','../../config/environment','define','OpenchannelAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x5812,0x1bd));var _0x2581=function(_0x4eedde,_0x3f7177){_0x4eedde=_0x4eedde-0x0;var _0x42bdff=_0x5812[_0x4eedde];return _0x42bdff;};'use strict';var _=require(_0x2581('0x0'));var util=require(_0x2581('0x1'));var logger=require(_0x2581('0x2'))(_0x2581('0x3'));var moment=require('moment');var BPromise=require(_0x2581('0x4'));var rp=require(_0x2581('0x5'));var fs=require('fs');var path=require(_0x2581('0x6'));var rimraf=require(_0x2581('0x7'));var config=require(_0x2581('0x8'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x388db1,_0x5576d5){return _0x388db1[_0x2581('0x9')](_0x2581('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index aa1f536..3788960 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 _0x69cd=['register','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3df21d,_0xa44265){var _0x37ab8a=function(_0x156e3d){while(--_0x156e3d){_0x3df21d['push'](_0x3df21d['shift']());}};_0x37ab8a(++_0xa44265);}(_0x69cd,0x129));var _0xd69c=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x69cd[_0x1d8119];return _0x3e30f6;};'use strict';var _=require(_0xd69c('0x0'));var util=require(_0xd69c('0x1'));var moment=require('moment');var BPromise=require(_0xd69c('0x2'));var rs=require(_0xd69c('0x3'));var fs=require('fs');var Redis=require(_0xd69c('0x4'));var db=require(_0xd69c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd69c('0x6'));var config=require(_0xd69c('0x7'));var jayson=require(_0xd69c('0x8'));var client=jayson[_0xd69c('0x9')][_0xd69c('0xa')]({'port':0x232a});config[_0xd69c('0xb')]=_[_0xd69c('0xc')](config[_0xd69c('0xb')],{'host':_0xd69c('0xd'),'port':0x18eb});var socket=require(_0xd69c('0xe'))(new Redis(config[_0xd69c('0xb')]));require('./openchannelAccount.socket')[_0xd69c('0xf')](socket);function respondWithRpcPromise(_0x4f837c,_0x34a2dd,_0x3bf591){return new BPromise(function(_0x12ed2f,_0x57ef49){return client['request'](_0x4f837c,_0x3bf591)['then'](function(_0x174501){logger[_0xd69c('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x34a2dd,_0xd69c('0x11'));logger['debug'](_0xd69c('0x12'),_0x34a2dd,'request\x20sent',JSON[_0xd69c('0x13')](_0x174501));if(_0x174501[_0xd69c('0x14')]){if(_0x174501['error'][_0xd69c('0x15')]===0x1f4){logger[_0xd69c('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x34a2dd,_0x174501[_0xd69c('0x14')][_0xd69c('0x16')]);return _0x57ef49(_0x174501['error'][_0xd69c('0x16')]);}logger[_0xd69c('0x14')](_0xd69c('0x17'),_0x34a2dd,_0x174501[_0xd69c('0x14')]['message']);return _0x12ed2f(_0x174501['error'][_0xd69c('0x16')]);}else{logger[_0xd69c('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x34a2dd,_0xd69c('0x11'));_0x12ed2f(_0x174501[_0xd69c('0x18')][_0xd69c('0x16')]);}})[_0xd69c('0x19')](function(_0x464110){logger[_0xd69c('0x14')](_0xd69c('0x17'),_0x34a2dd,_0x464110);_0x57ef49(_0x464110);});});} \ No newline at end of file +var _0xb2e6=['redis','localhost','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','defaults'];(function(_0x2bd6d9,_0x2071cb){var _0x4b4929=function(_0x41a57b){while(--_0x41a57b){_0x2bd6d9['push'](_0x2bd6d9['shift']());}};_0x4b4929(++_0x2071cb);}(_0xb2e6,0xa0));var _0x6b2e=function(_0x79b0c0,_0x5c00d8){_0x79b0c0=_0x79b0c0-0x0;var _0x55e179=_0xb2e6[_0x79b0c0];return _0x55e179;};'use strict';var _=require(_0x6b2e('0x0'));var util=require('util');var moment=require(_0x6b2e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b2e('0x2'));var db=require(_0x6b2e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b2e('0x4'))(_0x6b2e('0x5'));var config=require('../../config/environment');var jayson=require(_0x6b2e('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6b2e('0x7')](config[_0x6b2e('0x8')],{'host':_0x6b2e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b2e('0xa'))[_0x6b2e('0xb')](socket);function respondWithRpcPromise(_0x54c75c,_0x510633,_0x2a5113){return new BPromise(function(_0x530b91,_0x520f4f){return client[_0x6b2e('0xc')](_0x54c75c,_0x2a5113)[_0x6b2e('0xd')](function(_0x31981e){logger[_0x6b2e('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x510633,_0x6b2e('0xf'));logger['debug'](_0x6b2e('0x10'),_0x510633,_0x6b2e('0xf'),JSON[_0x6b2e('0x11')](_0x31981e));if(_0x31981e[_0x6b2e('0x12')]){if(_0x31981e['error'][_0x6b2e('0x13')]===0x1f4){logger[_0x6b2e('0x12')](_0x6b2e('0x14'),_0x510633,_0x31981e[_0x6b2e('0x12')]['message']);return _0x520f4f(_0x31981e[_0x6b2e('0x12')][_0x6b2e('0x15')]);}logger['error'](_0x6b2e('0x14'),_0x510633,_0x31981e[_0x6b2e('0x12')][_0x6b2e('0x15')]);return _0x530b91(_0x31981e[_0x6b2e('0x12')][_0x6b2e('0x15')]);}else{logger[_0x6b2e('0xe')](_0x6b2e('0x14'),_0x510633,_0x6b2e('0xf'));_0x530b91(_0x31981e[_0x6b2e('0x16')][_0x6b2e('0x15')]);}})[_0x6b2e('0x17')](function(_0x154856){logger[_0x6b2e('0x12')](_0x6b2e('0x14'),_0x510633,_0x154856);_0x520f4f(_0x154856);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 74bc5e1..25322cd 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 _0x20ea=['save','remove','update','emit','removeListener','register','./openchannelAccount.events'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x20ea,0xed));var _0xa20e=function(_0x22b7b9,_0x43a022){_0x22b7b9=_0x22b7b9-0x0;var _0x4f84e7=_0x20ea[_0x22b7b9];return _0x4f84e7;};'use strict';var OpenchannelAccountEvents=require(_0xa20e('0x0'));var events=[_0xa20e('0x1'),_0xa20e('0x2'),_0xa20e('0x3')];function createListener(_0x18b95e,_0x5d478c){return function(_0xbbdc66){_0x5d478c[_0xa20e('0x4')](_0x18b95e,_0xbbdc66);};}function removeListener(_0xfa868,_0x44679a){return function(){OpenchannelAccountEvents[_0xa20e('0x5')](_0xfa868,_0x44679a);};}exports[_0xa20e('0x6')]=function(_0xa10155){for(var _0x33ff06=0x0,_0x59baf3=events['length'];_0x33ff06<_0x59baf3;_0x33ff06++){var _0x22da12=events[_0x33ff06];var _0x4b51a5=createListener('openchannelAccount:'+_0x22da12,_0xa10155);OpenchannelAccountEvents['on'](_0x22da12,_0x4b51a5);}}; \ No newline at end of file +var _0x4f86=['remove','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x150854,_0xbc10d2){var _0x153c55=function(_0x183636){while(--_0x183636){_0x150854['push'](_0x150854['shift']());}};_0x153c55(++_0xbc10d2);}(_0x4f86,0x178));var _0x64f8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4f86[_0x17d9e3];return _0x14192d;};'use strict';var OpenchannelAccountEvents=require(_0x64f8('0x0'));var events=[_0x64f8('0x1'),_0x64f8('0x2'),'update'];function createListener(_0x5144d4,_0x391188){return function(_0x4aa35a){_0x391188['emit'](_0x5144d4,_0x4aa35a);};}function removeListener(_0x2d4010,_0x154c40){return function(){OpenchannelAccountEvents[_0x64f8('0x3')](_0x2d4010,_0x154c40);};}exports[_0x64f8('0x4')]=function(_0x487e7e){for(var _0x3decb4=0x0,_0x46e194=events[_0x64f8('0x5')];_0x3decb4<_0x46e194;_0x3decb4++){var _0x2f21b0=events[_0x3decb4];var _0x414029=createListener(_0x64f8('0x6')+_0x2f21b0,_0x487e7e);OpenchannelAccountEvents['on'](_0x2f21b0,_0x414029);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 48e054e..488a471 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 _0xba61=['index','get','/:id','show','post','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0xba61,0xe9));var _0x1ba6=function(_0x5b4b7e,_0x10b798){_0x5b4b7e=_0x5b4b7e-0x0;var _0x2610c5=_0xba61[_0x5b4b7e];return _0x2610c5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1ba6('0x0'));var express=require(_0x1ba6('0x1'));var router=express[_0x1ba6('0x2')]();var auth=require(_0x1ba6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1ba6('0x4'));var controller=require(_0x1ba6('0x5'));router['get']('/',auth[_0x1ba6('0x6')](),controller[_0x1ba6('0x7')]);router[_0x1ba6('0x8')](_0x1ba6('0x9'),auth['isAuthenticated'](),controller[_0x1ba6('0xa')]);router[_0x1ba6('0xb')]('/',auth[_0x1ba6('0x6')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1ba6('0xc')](_0x1ba6('0x9'),auth[_0x1ba6('0x6')](),controller[_0x1ba6('0xd')]);module[_0x1ba6('0xe')]=router; \ No newline at end of file +var _0xa579=['create','put','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','post'];(function(_0x1bb8d8,_0x35bbfc){var _0x44c4ec=function(_0x11c442){while(--_0x11c442){_0x1bb8d8['push'](_0x1bb8d8['shift']());}};_0x44c4ec(++_0x35bbfc);}(_0xa579,0xd4));var _0x9a57=function(_0x3d273a,_0x3a59bb){_0x3d273a=_0x3d273a-0x0;var _0x2a74c7=_0xa579[_0x3d273a];return _0x2a74c7;};'use strict';var multer=require(_0x9a57('0x0'));var util=require('util');var path=require(_0x9a57('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a57('0x2'));var router=express[_0x9a57('0x3')]();var auth=require(_0x9a57('0x4'));var interaction=require(_0x9a57('0x5'));var config=require(_0x9a57('0x6'));var controller=require(_0x9a57('0x7'));router[_0x9a57('0x8')]('/',auth[_0x9a57('0x9')](),controller['index']);router[_0x9a57('0x8')](_0x9a57('0xa'),auth[_0x9a57('0x9')](),controller['show']);router[_0x9a57('0xb')]('/',auth['isAuthenticated'](),controller[_0x9a57('0xc')]);router[_0x9a57('0xd')](_0x9a57('0xa'),auth[_0x9a57('0x9')](),controller[_0x9a57('0xe')]);router['delete'](_0x9a57('0xa'),auth[_0x9a57('0x9')](),controller['destroy']);module[_0x9a57('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8b8e2e7..2fa1385 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 _0x0dcd=['noop','TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x14fc4c,_0x4451ce){var _0x3803bb=function(_0x10a5e4){while(--_0x10a5e4){_0x14fc4c['push'](_0x14fc4c['shift']());}};_0x3803bb(++_0x4451ce);}(_0x0dcd,0x148));var _0xd0dc=function(_0xd8460e,_0x55e7bc){_0xd8460e=_0xd8460e-0x0;var _0x1a6e20=_0x0dcd[_0xd8460e];return _0x1a6e20;};'use strict';var Sequelize=require(_0xd0dc('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd0dc('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd0dc('0x2')},'appdata':{'type':Sequelize[_0xd0dc('0x3')]()},'description':{'type':Sequelize[_0xd0dc('0x4')]},'interval':{'type':Sequelize[_0xd0dc('0x4')],'defaultValue':_0xd0dc('0x5')}}; \ No newline at end of file +var _0x90d6=['*,*,*,*','sequelize','STRING','TEXT'];(function(_0x4815e2,_0x13692b){var _0x38cfe9=function(_0x219d36){while(--_0x219d36){_0x4815e2['push'](_0x4815e2['shift']());}};_0x38cfe9(++_0x13692b);}(_0x90d6,0x1b5));var _0x690d=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x90d6[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0x690d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x690d('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x690d('0x2')]()},'description':{'type':Sequelize[_0x690d('0x1')]},'interval':{'type':Sequelize[_0x690d('0x1')],'defaultValue':_0x690d('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7de8096..90849b0 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 _0xc7ef=['key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','update','eml-format','zip-dir','moment','util','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','then','end','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xc7ef,0xa1));var _0xfc7e=function(_0x22760c,_0x10a279){_0x22760c=_0x22760c-0x0;var _0x22ff98=_0xc7ef[_0x22760c];return _0x22ff98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfc7e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfc7e('0x3'));var path=require('path');var sox=require(_0xfc7e('0x4'));var csv=require(_0xfc7e('0x5'));var ejs=require(_0xfc7e('0x6'));var fs=require('fs');var _=require(_0xfc7e('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc7e('0x8'));var toCsv=require(_0xfc7e('0x5'));var querystring=require(_0xfc7e('0x9'));var Papa=require('papaparse');var Redis=require(_0xfc7e('0xa'));var authService=require(_0xfc7e('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc7e('0xc'));var config=require(_0xfc7e('0xd'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc7e('0xe'))['db'];function respondWithStatusCode(_0x37d90c,_0x23215c){_0x23215c=_0x23215c||0xcc;return function(_0x59b887){if(_0x59b887){return _0x37d90c[_0xfc7e('0xf')](_0x23215c);}return _0x37d90c[_0xfc7e('0x10')](_0x23215c)['end']();};}function respondWithResult(_0x5cbe49,_0x1016b8){_0x1016b8=_0x1016b8||0xc8;return function(_0xf84180){if(_0xf84180){return _0x5cbe49[_0xfc7e('0x10')](_0x1016b8)[_0xfc7e('0x11')](_0xf84180);}};}function respondWithFilteredResult(_0x237ead,_0x5bb7ac){return function(_0x549b9f){if(_0x549b9f){var _0x1c129b=_0x549b9f['count'],_0x14e51a=_0x5bb7ac['offset'],_0x5b8f00=_0x5bb7ac[_0xfc7e('0x12')]+_0x5bb7ac[_0xfc7e('0x13')],_0xc03651;if(_0x5b8f00>=_0x1c129b){_0x5b8f00=_0x1c129b;_0xc03651=0xc8;}else{_0xc03651=0xce;}_0x237ead['status'](_0xc03651);return _0x237ead[_0xfc7e('0x14')](_0xfc7e('0x15'),_0x14e51a+'-'+_0x5b8f00+'/'+_0x1c129b)[_0xfc7e('0x11')](_0x549b9f);}return null;};}function patchUpdates(_0x1c166e){return function(_0x509cea){try{jsonpatch[_0xfc7e('0x16')](_0x509cea,_0x1c166e,!![]);}catch(_0x3f4753){return BPromise['reject'](_0x3f4753);}return _0x509cea['save']();};}function saveUpdates(_0x5dcfbe,_0x412226){return function(_0x4a7143){if(_0x4a7143){return _0x4a7143['update'](_0x5dcfbe)['then'](function(_0x2a52ac){return _0x2a52ac;});}return null;};}function removeEntity(_0x11e5e2,_0x5adef2){return function(_0x1eaf8c){if(_0x1eaf8c){return _0x1eaf8c['destroy']()[_0xfc7e('0x17')](function(){_0x11e5e2['status'](0xcc)[_0xfc7e('0x18')]();});}};}function handleEntityNotFound(_0x4b00c1,_0x3fe5f3){return function(_0x463d13){if(!_0x463d13){_0x4b00c1['sendStatus'](0x194);}return _0x463d13;};}function handleError(_0x39cd3c,_0x3b8607){_0x3b8607=_0x3b8607||0x1f4;return function(_0x52c941){logger[_0xfc7e('0x19')](_0x52c941['stack']);if(_0x52c941[_0xfc7e('0x1a')]){delete _0x52c941[_0xfc7e('0x1a')];}_0x39cd3c[_0xfc7e('0x10')](_0x3b8607)[_0xfc7e('0x1b')](_0x52c941);};}exports[_0xfc7e('0x1c')]=function(_0x3368f7,_0x2ad975){var _0x5a8d9c={},_0x20e1f6={},_0x7e62b6={'count':0x0,'rows':[]};var _0x1541f4=_[_0xfc7e('0x1d')](db[_0xfc7e('0x1e')][_0xfc7e('0x1f')],function(_0x48d06e){return{'name':_0x48d06e[_0xfc7e('0x20')],'type':_0x48d06e[_0xfc7e('0x21')][_0xfc7e('0x22')]};});_0x20e1f6['model']=_[_0xfc7e('0x1d')](_0x1541f4,_0xfc7e('0x1a'));_0x20e1f6[_0xfc7e('0x23')]=_[_0xfc7e('0x24')](_0x3368f7[_0xfc7e('0x23')]);_0x20e1f6[_0xfc7e('0x25')]=_[_0xfc7e('0x26')](_0x20e1f6['model'],_0x20e1f6[_0xfc7e('0x23')]);_0x5a8d9c[_0xfc7e('0x27')]=_[_0xfc7e('0x26')](_0x20e1f6[_0xfc7e('0x28')],qs[_0xfc7e('0x29')](_0x3368f7['query'][_0xfc7e('0x29')]));_0x5a8d9c[_0xfc7e('0x27')]=_0x5a8d9c['attributes'][_0xfc7e('0x2a')]?_0x5a8d9c[_0xfc7e('0x27')]:_0x20e1f6['model'];if(!_0x3368f7[_0xfc7e('0x23')][_0xfc7e('0x2b')](_0xfc7e('0x2c'))){_0x5a8d9c['limit']=qs[_0xfc7e('0x13')](_0x3368f7[_0xfc7e('0x23')][_0xfc7e('0x13')]);_0x5a8d9c[_0xfc7e('0x12')]=qs[_0xfc7e('0x12')](_0x3368f7['query'][_0xfc7e('0x12')]);}_0x5a8d9c[_0xfc7e('0x2d')]=qs[_0xfc7e('0x2e')](_0x3368f7[_0xfc7e('0x23')][_0xfc7e('0x2e')]);_0x5a8d9c[_0xfc7e('0x2f')]=qs[_0xfc7e('0x25')](_[_0xfc7e('0x30')](_0x3368f7[_0xfc7e('0x23')],_0x20e1f6[_0xfc7e('0x25')]),_0x1541f4);if(_0x3368f7[_0xfc7e('0x23')][_0xfc7e('0x31')]){_0x5a8d9c[_0xfc7e('0x2f')]=_[_0xfc7e('0x32')](_0x5a8d9c['where'],{'$or':_['map'](_0x1541f4,function(_0x34dfef){if(_0x34dfef['type']!==_0xfc7e('0x33')){var _0x494df8={};_0x494df8[_0x34dfef[_0xfc7e('0x1a')]]={'$like':'%'+_0x3368f7[_0xfc7e('0x23')][_0xfc7e('0x31')]+'%'};return _0x494df8;}})});}_0x5a8d9c=_['merge']({},_0x5a8d9c,_0x3368f7['options']);var _0xb0fc7c={'where':_0x5a8d9c[_0xfc7e('0x2f')]};return db['OpenchannelApplication'][_0xfc7e('0x34')](_0xb0fc7c)[_0xfc7e('0x17')](function(_0x3fe064){_0x7e62b6[_0xfc7e('0x34')]=_0x3fe064;if(_0x3368f7['query'][_0xfc7e('0x35')]){_0x5a8d9c['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xfc7e('0x36')](_0x5a8d9c);})[_0xfc7e('0x17')](function(_0x3f5f40){_0x7e62b6[_0xfc7e('0x37')]=_0x3f5f40;return _0x7e62b6;})[_0xfc7e('0x17')](respondWithFilteredResult(_0x2ad975,_0x5a8d9c))['catch'](handleError(_0x2ad975,null));};exports[_0xfc7e('0x38')]=function(_0x456a9d,_0x5d52bf){var _0x4161e5={'raw':!![],'where':{'id':_0x456a9d[_0xfc7e('0x39')]['id']}},_0x3e939d={};_0x3e939d[_0xfc7e('0x28')]=_[_0xfc7e('0x24')](db[_0xfc7e('0x1e')][_0xfc7e('0x1f')]);_0x3e939d['query']=_[_0xfc7e('0x24')](_0x456a9d['query']);_0x3e939d['filters']=_[_0xfc7e('0x26')](_0x3e939d[_0xfc7e('0x28')],_0x3e939d['query']);_0x4161e5[_0xfc7e('0x27')]=_[_0xfc7e('0x26')](_0x3e939d['model'],qs[_0xfc7e('0x29')](_0x456a9d['query'][_0xfc7e('0x29')]));_0x4161e5[_0xfc7e('0x27')]=_0x4161e5[_0xfc7e('0x27')]['length']?_0x4161e5[_0xfc7e('0x27')]:_0x3e939d['model'];if(_0x456a9d['query'][_0xfc7e('0x35')]){_0x4161e5[_0xfc7e('0x3a')]=[{'all':!![]}];}_0x4161e5=_[_0xfc7e('0x32')]({},_0x4161e5,_0x456a9d[_0xfc7e('0x3b')]);return db[_0xfc7e('0x1e')][_0xfc7e('0x3c')](_0x4161e5)[_0xfc7e('0x17')](handleEntityNotFound(_0x5d52bf,null))[_0xfc7e('0x17')](respondWithResult(_0x5d52bf,null))[_0xfc7e('0x3d')](handleError(_0x5d52bf,null));};exports[_0xfc7e('0x3e')]=function(_0x41a01c,_0xeebba6){return db[_0xfc7e('0x1e')][_0xfc7e('0x3e')](_0x41a01c[_0xfc7e('0x3f')],{})[_0xfc7e('0x17')](respondWithResult(_0xeebba6,0xc9))[_0xfc7e('0x3d')](handleError(_0xeebba6,null));};exports[_0xfc7e('0x40')]=function(_0x16b127,_0x1a2c78){if(_0x16b127['body']['id']){delete _0x16b127[_0xfc7e('0x3f')]['id'];}return db[_0xfc7e('0x1e')][_0xfc7e('0x3c')]({'where':{'id':_0x16b127[_0xfc7e('0x39')]['id']}})['then'](handleEntityNotFound(_0x1a2c78,null))[_0xfc7e('0x17')](saveUpdates(_0x16b127[_0xfc7e('0x3f')],null))[_0xfc7e('0x17')](respondWithResult(_0x1a2c78,null))['catch'](handleError(_0x1a2c78,null));};exports['destroy']=function(_0x180283,_0x28d3ef){return db[_0xfc7e('0x1e')]['find']({'where':{'id':_0x180283['params']['id']}})[_0xfc7e('0x17')](handleEntityNotFound(_0x28d3ef,null))[_0xfc7e('0x17')](removeEntity(_0x28d3ef,null))['catch'](handleError(_0x28d3ef,null));}; \ No newline at end of file +var _0x2564=['json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','OpenchannelApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','include','rows','show','params','rawAttributes','includeAll','options','find','create','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x3958e8,_0x42fa99){var _0xb6338f=function(_0x325eec){while(--_0x325eec){_0x3958e8['push'](_0x3958e8['shift']());}};_0xb6338f(++_0x42fa99);}(_0x2564,0x1a3));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x4256('0x0'));var emlformat=require(_0x4256('0x1'));var rimraf=require(_0x4256('0x2'));var zipdir=require(_0x4256('0x3'));var jsonpatch=require(_0x4256('0x4'));var rp=require('request-promise');var moment=require(_0x4256('0x5'));var BPromise=require(_0x4256('0x6'));var Mustache=require(_0x4256('0x7'));var util=require(_0x4256('0x8'));var path=require(_0x4256('0x9'));var sox=require(_0x4256('0xa'));var csv=require(_0x4256('0xb'));var ejs=require(_0x4256('0xc'));var fs=require('fs');var _=require(_0x4256('0xd'));var squel=require(_0x4256('0xe'));var crypto=require(_0x4256('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4256('0x10'));var toCsv=require(_0x4256('0xb'));var querystring=require(_0x4256('0x11'));var Papa=require(_0x4256('0x12'));var Redis=require(_0x4256('0x13'));var authService=require(_0x4256('0x14'));var qs=require(_0x4256('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4256('0x16'));var logger=require(_0x4256('0x17'))(_0x4256('0x18'));var utils=require(_0x4256('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4256('0x1a'));var db=require(_0x4256('0x1b'))['db'];function respondWithStatusCode(_0x5a42be,_0x435010){_0x435010=_0x435010||0xcc;return function(_0x3f6419){if(_0x3f6419){return _0x5a42be[_0x4256('0x1c')](_0x435010);}return _0x5a42be['status'](_0x435010)[_0x4256('0x1d')]();};}function respondWithResult(_0x10ab00,_0x2e35e6){_0x2e35e6=_0x2e35e6||0xc8;return function(_0x27f03b){if(_0x27f03b){return _0x10ab00[_0x4256('0x1e')](_0x2e35e6)[_0x4256('0x1f')](_0x27f03b);}};}function respondWithFilteredResult(_0x2bf563,_0x2e3003){return function(_0x36114f){if(_0x36114f){var _0x449bf0=_0x36114f[_0x4256('0x20')],_0xb393e9=_0x2e3003[_0x4256('0x21')],_0x36b3ba=_0x2e3003[_0x4256('0x21')]+_0x2e3003[_0x4256('0x22')],_0x3c268a;if(_0x36b3ba>=_0x449bf0){_0x36b3ba=_0x449bf0;_0x3c268a=0xc8;}else{_0x3c268a=0xce;}_0x2bf563[_0x4256('0x1e')](_0x3c268a);return _0x2bf563['set'](_0x4256('0x23'),_0xb393e9+'-'+_0x36b3ba+'/'+_0x449bf0)[_0x4256('0x1f')](_0x36114f);}return null;};}function patchUpdates(_0x3ba974){return function(_0xf0fe03){try{jsonpatch[_0x4256('0x24')](_0xf0fe03,_0x3ba974,!![]);}catch(_0x37e7de){return BPromise[_0x4256('0x25')](_0x37e7de);}return _0xf0fe03[_0x4256('0x26')]();};}function saveUpdates(_0x3896b9,_0x3fb764){return function(_0x5ccdfc){if(_0x5ccdfc){return _0x5ccdfc['update'](_0x3896b9)[_0x4256('0x27')](function(_0x466d78){return _0x466d78;});}return null;};}function removeEntity(_0x40dec4,_0x48196d){return function(_0x2a2356){if(_0x2a2356){return _0x2a2356[_0x4256('0x28')]()[_0x4256('0x27')](function(){_0x40dec4[_0x4256('0x1e')](0xcc)[_0x4256('0x1d')]();});}};}function handleEntityNotFound(_0x1585fc,_0x322774){return function(_0x135de2){if(!_0x135de2){_0x1585fc[_0x4256('0x1c')](0x194);}return _0x135de2;};}function handleError(_0x2e9f67,_0x364764){_0x364764=_0x364764||0x1f4;return function(_0x408457){logger['error'](_0x408457[_0x4256('0x29')]);if(_0x408457[_0x4256('0x2a')]){delete _0x408457[_0x4256('0x2a')];}_0x2e9f67['status'](_0x364764)[_0x4256('0x2b')](_0x408457);};}exports[_0x4256('0x2c')]=function(_0x2f9e50,_0x376017){var _0xed0a64={},_0x45a1e9={},_0x2a2511={'count':0x0,'rows':[]};var _0xd170eb=_[_0x4256('0x2d')](db[_0x4256('0x2e')]['rawAttributes'],function(_0x44a3c1){return{'name':_0x44a3c1['fieldName'],'type':_0x44a3c1[_0x4256('0x2f')][_0x4256('0x30')]};});_0x45a1e9[_0x4256('0x31')]=_[_0x4256('0x2d')](_0xd170eb,_0x4256('0x2a'));_0x45a1e9[_0x4256('0x32')]=_[_0x4256('0x33')](_0x2f9e50[_0x4256('0x32')]);_0x45a1e9[_0x4256('0x34')]=_[_0x4256('0x35')](_0x45a1e9[_0x4256('0x31')],_0x45a1e9[_0x4256('0x32')]);_0xed0a64[_0x4256('0x36')]=_['intersection'](_0x45a1e9[_0x4256('0x31')],qs[_0x4256('0x37')](_0x2f9e50['query'][_0x4256('0x37')]));_0xed0a64['attributes']=_0xed0a64[_0x4256('0x36')][_0x4256('0x38')]?_0xed0a64[_0x4256('0x36')]:_0x45a1e9['model'];if(!_0x2f9e50[_0x4256('0x32')]['hasOwnProperty'](_0x4256('0x39'))){_0xed0a64[_0x4256('0x22')]=qs[_0x4256('0x22')](_0x2f9e50[_0x4256('0x32')]['limit']);_0xed0a64[_0x4256('0x21')]=qs[_0x4256('0x21')](_0x2f9e50[_0x4256('0x32')][_0x4256('0x21')]);}_0xed0a64[_0x4256('0x3a')]=qs[_0x4256('0x3b')](_0x2f9e50[_0x4256('0x32')]['sort']);_0xed0a64['where']=qs['filters'](_['pick'](_0x2f9e50[_0x4256('0x32')],_0x45a1e9[_0x4256('0x34')]),_0xd170eb);if(_0x2f9e50[_0x4256('0x32')][_0x4256('0x3c')]){_0xed0a64[_0x4256('0x3d')]=_['merge'](_0xed0a64[_0x4256('0x3d')],{'$or':_['map'](_0xd170eb,function(_0x1516e4){if(_0x1516e4[_0x4256('0x2f')]!==_0x4256('0x3e')){var _0x301fca={};_0x301fca[_0x1516e4[_0x4256('0x2a')]]={'$like':'%'+_0x2f9e50[_0x4256('0x32')][_0x4256('0x3c')]+'%'};return _0x301fca;}})});}_0xed0a64=_[_0x4256('0x3f')]({},_0xed0a64,_0x2f9e50['options']);var _0x4fcd1f={'where':_0xed0a64[_0x4256('0x3d')]};return db[_0x4256('0x2e')][_0x4256('0x20')](_0x4fcd1f)[_0x4256('0x27')](function(_0x291956){_0x2a2511[_0x4256('0x20')]=_0x291956;if(_0x2f9e50[_0x4256('0x32')]['includeAll']){_0xed0a64[_0x4256('0x40')]=[{'all':!![]}];}return db[_0x4256('0x2e')]['findAll'](_0xed0a64);})[_0x4256('0x27')](function(_0x3ec94e){_0x2a2511[_0x4256('0x41')]=_0x3ec94e;return _0x2a2511;})['then'](respondWithFilteredResult(_0x376017,_0xed0a64))['catch'](handleError(_0x376017,null));};exports[_0x4256('0x42')]=function(_0x5d3b32,_0x24f35a){var _0x4a5173={'raw':!![],'where':{'id':_0x5d3b32[_0x4256('0x43')]['id']}},_0x2cd53f={};_0x2cd53f['model']=_[_0x4256('0x33')](db[_0x4256('0x2e')][_0x4256('0x44')]);_0x2cd53f['query']=_[_0x4256('0x33')](_0x5d3b32[_0x4256('0x32')]);_0x2cd53f[_0x4256('0x34')]=_[_0x4256('0x35')](_0x2cd53f[_0x4256('0x31')],_0x2cd53f[_0x4256('0x32')]);_0x4a5173['attributes']=_[_0x4256('0x35')](_0x2cd53f[_0x4256('0x31')],qs[_0x4256('0x37')](_0x5d3b32[_0x4256('0x32')][_0x4256('0x37')]));_0x4a5173[_0x4256('0x36')]=_0x4a5173['attributes']['length']?_0x4a5173['attributes']:_0x2cd53f[_0x4256('0x31')];if(_0x5d3b32[_0x4256('0x32')][_0x4256('0x45')]){_0x4a5173[_0x4256('0x40')]=[{'all':!![]}];}_0x4a5173=_[_0x4256('0x3f')]({},_0x4a5173,_0x5d3b32[_0x4256('0x46')]);return db['OpenchannelApplication'][_0x4256('0x47')](_0x4a5173)[_0x4256('0x27')](handleEntityNotFound(_0x24f35a,null))[_0x4256('0x27')](respondWithResult(_0x24f35a,null))['catch'](handleError(_0x24f35a,null));};exports[_0x4256('0x48')]=function(_0x1dc55d,_0x5f5d49){return db['OpenchannelApplication'][_0x4256('0x48')](_0x1dc55d['body'],{})[_0x4256('0x27')](respondWithResult(_0x5f5d49,0xc9))[_0x4256('0x49')](handleError(_0x5f5d49,null));};exports['update']=function(_0x2a7ba5,_0x2a45f5){if(_0x2a7ba5[_0x4256('0x4a')]['id']){delete _0x2a7ba5['body']['id'];}return db[_0x4256('0x2e')][_0x4256('0x47')]({'where':{'id':_0x2a7ba5['params']['id']}})[_0x4256('0x27')](handleEntityNotFound(_0x2a45f5,null))[_0x4256('0x27')](saveUpdates(_0x2a7ba5[_0x4256('0x4a')],null))[_0x4256('0x27')](respondWithResult(_0x2a45f5,null))['catch'](handleError(_0x2a45f5,null));};exports['destroy']=function(_0x413666,_0x2eb413){return db[_0x4256('0x2e')][_0x4256('0x47')]({'where':{'id':_0x413666[_0x4256('0x43')]['id']}})[_0x4256('0x27')](handleEntityNotFound(_0x2eb413,null))['then'](removeEntity(_0x2eb413,null))[_0x4256('0x49')](handleError(_0x2eb413,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index cbb5578..3a9f6eb 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 _0x6962=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x6962,0x15e));var _0x2696=function(_0x36dc67,_0x7eb346){_0x36dc67=_0x36dc67-0x0;var _0xaaa8dc=_0x6962[_0x36dc67];return _0xaaa8dc;};'use strict';var _=require(_0x2696('0x0'));var util=require(_0x2696('0x1'));var logger=require(_0x2696('0x2'))(_0x2696('0x3'));var moment=require(_0x2696('0x4'));var BPromise=require(_0x2696('0x5'));var rp=require(_0x2696('0x6'));var fs=require('fs');var path=require(_0x2696('0x7'));var rimraf=require('rimraf');var config=require(_0x2696('0x8'));var attributes=require(_0x2696('0x9'));module[_0x2696('0xa')]=function(_0x535367,_0x35d8a7){return _0x535367[_0x2696('0xb')](_0x2696('0xc'),attributes,{'tableName':_0x2696('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2696('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x73f2=['moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x4b4bf4,_0x14f904){var _0x330836=function(_0x59de4a){while(--_0x59de4a){_0x4b4bf4['push'](_0x4b4bf4['shift']());}};_0x330836(++_0x14f904);}(_0x73f2,0xa5));var _0x273f=function(_0x3491e2,_0x5a5faa){_0x3491e2=_0x3491e2-0x0;var _0x4452aa=_0x73f2[_0x3491e2];return _0x4452aa;};'use strict';var _=require(_0x273f('0x0'));var util=require('util');var logger=require(_0x273f('0x1'))(_0x273f('0x2'));var moment=require(_0x273f('0x3'));var BPromise=require('bluebird');var rp=require(_0x273f('0x4'));var fs=require('fs');var path=require(_0x273f('0x5'));var rimraf=require(_0x273f('0x6'));var config=require(_0x273f('0x7'));var attributes=require(_0x273f('0x8'));module[_0x273f('0x9')]=function(_0x5db72b,_0x30b401){return _0x5db72b[_0x273f('0xa')](_0x273f('0xb'),attributes,{'tableName':_0x273f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x273f('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index eba93dc..2137fe7 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _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(_0x2f882a,_0x4ab551){var _0x37073a=function(_0x5b81ef){while(--_0x5b81ef){_0x2f882a['push'](_0x2f882a['shift']());}};_0x37073a(++_0x4ab551);}(_0xb10b,0x12a));var _0xbb10=function(_0x5468bf,_0x48c1ad){_0x5468bf=_0x5468bf-0x0;var _0x3c6c01=_0xb10b[_0x5468bf];return _0x3c6c01;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 37aa604..91c302b 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 _0x6e79=['exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','update','delete','/:id','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x6e79,0x75));var _0x96e7=function(_0x3147ff,_0x230bde){_0x3147ff=_0x3147ff-0x0;var _0x22e581=_0x6e79[_0x3147ff];return _0x22e581;};'use strict';var multer=require(_0x96e7('0x0'));var util=require(_0x96e7('0x1'));var path=require('path');var timeout=require(_0x96e7('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x96e7('0x3'));var config=require(_0x96e7('0x4'));var controller=require(_0x96e7('0x5'));router[_0x96e7('0x6')]('/',auth[_0x96e7('0x7')](),controller[_0x96e7('0x8')]);router[_0x96e7('0x6')](_0x96e7('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x96e7('0x6')]('/:id',auth[_0x96e7('0x7')](),controller[_0x96e7('0xa')]);router[_0x96e7('0x6')](_0x96e7('0xb'),auth[_0x96e7('0x7')](),controller[_0x96e7('0xc')]);router[_0x96e7('0x6')](_0x96e7('0xd'),auth[_0x96e7('0x7')](),controller[_0x96e7('0xe')]);router[_0x96e7('0xf')]('/',auth[_0x96e7('0x7')](),controller[_0x96e7('0x10')]);router[_0x96e7('0xf')](_0x96e7('0xb'),auth['isAuthenticated'](),controller[_0x96e7('0x11')]);router[_0x96e7('0xf')](_0x96e7('0x12'),auth[_0x96e7('0x7')](),interaction[_0x96e7('0x13')](_0x96e7('0x14'),_0x96e7('0x15')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x96e7('0x13')]('openchannel','openchannelinteraction:update'),controller[_0x96e7('0x16')]);router[_0x96e7('0x17')](_0x96e7('0x18'),auth['isAuthenticated'](),interaction[_0x96e7('0x13')]('openchannel',_0x96e7('0x19')),controller[_0x96e7('0x1a')]);router[_0x96e7('0x17')]('/:id/tags',auth[_0x96e7('0x7')](),controller[_0x96e7('0x1b')]);module[_0x96e7('0x1c')]=router; \ No newline at end of file +var _0x78eb=['./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','/:id/tags','removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0x78eb,0x12c));var _0xb78e=function(_0x5ae42b,_0x10dc63){_0x5ae42b=_0x5ae42b-0x0;var _0x373278=_0x78eb[_0x5ae42b];return _0x373278;};'use strict';var multer=require('multer');var util=require(_0xb78e('0x0'));var path=require(_0xb78e('0x1'));var timeout=require(_0xb78e('0x2'));var express=require(_0xb78e('0x3'));var router=express[_0xb78e('0x4')]();var auth=require(_0xb78e('0x5'));var interaction=require(_0xb78e('0x6'));var config=require(_0xb78e('0x7'));var controller=require(_0xb78e('0x8'));router[_0xb78e('0x9')]('/',auth[_0xb78e('0xa')](),controller[_0xb78e('0xb')]);router[_0xb78e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb78e('0xc')]);router[_0xb78e('0x9')](_0xb78e('0xd'),auth[_0xb78e('0xa')](),controller[_0xb78e('0xe')]);router[_0xb78e('0x9')]('/:id/messages',auth[_0xb78e('0xa')](),controller[_0xb78e('0xf')]);router[_0xb78e('0x9')](_0xb78e('0x10'),auth['isAuthenticated'](),controller[_0xb78e('0x11')]);router[_0xb78e('0x12')]('/',auth['isAuthenticated'](),controller[_0xb78e('0x13')]);router['post']('/:id/messages',auth[_0xb78e('0xa')](),controller['addMessage']);router[_0xb78e('0x12')]('/:id/tags',auth[_0xb78e('0xa')](),interaction[_0xb78e('0x14')](_0xb78e('0x15'),'openchannelinteraction:addtags'),controller[_0xb78e('0x16')]);router[_0xb78e('0x17')](_0xb78e('0xd'),auth['isAuthenticated'](),interaction[_0xb78e('0x14')](_0xb78e('0x15'),_0xb78e('0x18')),controller['update']);router[_0xb78e('0x19')]('/:id',auth[_0xb78e('0xa')](),interaction[_0xb78e('0x14')]('openchannel','openchannelinteraction:destroy'),controller['destroy']);router[_0xb78e('0x19')](_0xb78e('0x1a'),auth[_0xb78e('0xa')](),controller[_0xb78e('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index bc877d0..76e8868 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 _0xc1cb=['STRING','out','sequelize','exports','DATE'];(function(_0x523b04,_0x4a1b51){var _0x4fda3b=function(_0x2a5d12){while(--_0x2a5d12){_0x523b04['push'](_0x523b04['shift']());}};_0x4fda3b(++_0x4a1b51);}(_0xc1cb,0xac));var _0xbc1c=function(_0x113df5,_0xdca032){_0x113df5=_0x113df5-0x0;var _0xf3393f=_0xc1cb[_0x113df5];return _0xf3393f;};'use strict';var Sequelize=require(_0xbc1c('0x0'));module[_0xbc1c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbc1c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbc1c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbc1c('0x3')]},'read1stAt':{'type':Sequelize[_0xbc1c('0x2')]},'threadId':{'type':Sequelize[_0xbc1c('0x3')]},'externalUrl':{'type':Sequelize[_0xbc1c('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbc1c('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbc1c('0x3')]}}; \ No newline at end of file +var _0x8262=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x8262,0x9d));var _0x2826=function(_0x4ed0f3,_0x743ec7){_0x4ed0f3=_0x4ed0f3-0x0;var _0x4f3864=_0x8262[_0x4ed0f3];return _0x4f3864;};'use strict';var Sequelize=require(_0x2826('0x0'));module[_0x2826('0x1')]={'closed':{'type':Sequelize[_0x2826('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2826('0x3')]},'disposition':{'type':Sequelize[_0x2826('0x4')]},'secondDisposition':{'type':Sequelize[_0x2826('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2826('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x2826('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2826('0x5')]('in',_0x2826('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2826('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f522f1e..7bd6164 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 _0x24d5=['unreadMessages','having','`\x20=\x200','Contact','value','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?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','merge','options','catch','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','nolimit','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','color','removeTags','download','unix','join','root','server','files','CmContact','lastName','attachments','Attachment','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','format','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','disposition','threadId','Public','Private','Messages','pipe','createWriteStream','basename','direction','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','end','status','json','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','index','OpenchannelInteraction','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','query','order','sort','where','field','from','tools_tags','select','u.id','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find'];(function(_0x5a8e18,_0x597ccd){var _0x1e0b54=function(_0x55bbf7){while(--_0x55bbf7){_0x5a8e18['push'](_0x5a8e18['shift']());}};_0x1e0b54(++_0x597ccd);}(_0x24d5,0x95));var _0x524d=function(_0x5da483,_0x4d94c7){_0x5da483=_0x5da483-0x0;var _0x21f596=_0x24d5[_0x5da483];return _0x21f596;};'use strict';var pdf=require(_0x524d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x524d('0x1'));var jsonpatch=require(_0x524d('0x2'));var rp=require(_0x524d('0x3'));var moment=require('moment');var BPromise=require(_0x524d('0x4'));var Mustache=require(_0x524d('0x5'));var util=require(_0x524d('0x6'));var path=require(_0x524d('0x7'));var sox=require('sox');var csv=require(_0x524d('0x8'));var ejs=require(_0x524d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x524d('0xa'));var crypto=require(_0x524d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x524d('0xc'));var toCsv=require(_0x524d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x524d('0xd'));var authService=require(_0x524d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x524d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x524d('0x10'))('api');var utils=require(_0x524d('0x11'));var config=require(_0x524d('0x12'));var licenseUtil=require(_0x524d('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x524d('0x14')](config['redis'],{'host':_0x524d('0x15'),'port':0x18eb});var socket=require(_0x524d('0x16'))(new Redis(config[_0x524d('0x17')]));require(_0x524d('0x18'))[_0x524d('0x19')](socket);function respondWithStatusCode(_0xbfcd2a,_0x5de0fc){_0x5de0fc=_0x5de0fc||0xcc;return function(_0x575f32){if(_0x575f32){return _0xbfcd2a['sendStatus'](_0x5de0fc);}return _0xbfcd2a['status'](_0x5de0fc)[_0x524d('0x1a')]();};}function respondWithResult(_0x939797,_0x2b6fa2){_0x2b6fa2=_0x2b6fa2||0xc8;return function(_0x1bda0a){if(_0x1bda0a){return _0x939797[_0x524d('0x1b')](_0x2b6fa2)[_0x524d('0x1c')](_0x1bda0a);}};}function respondWithFilteredResult(_0xf0c210,_0x2f06f3){return function(_0x212430){if(_0x212430){var _0x71caa0=_0x212430['count'],_0x50e4b7=_0x2f06f3['offset'],_0x118c26=_0x2f06f3[_0x524d('0x1d')]+_0x2f06f3[_0x524d('0x1e')],_0x113b40;if(_0x118c26>=_0x71caa0){_0x118c26=_0x71caa0;_0x113b40=0xc8;}else{_0x113b40=0xce;}_0xf0c210['status'](_0x113b40);return _0xf0c210[_0x524d('0x1f')](_0x524d('0x20'),_0x50e4b7+'-'+_0x118c26+'/'+_0x71caa0)[_0x524d('0x1c')](_0x212430);}return null;};}function patchUpdates(_0x10a689){return function(_0x2cfc26){try{jsonpatch['apply'](_0x2cfc26,_0x10a689,!![]);}catch(_0x10c5b5){return BPromise['reject'](_0x10c5b5);}return _0x2cfc26[_0x524d('0x21')]();};}function saveUpdates(_0x445647,_0x3d8a2c){return function(_0x3080bb){if(_0x3080bb){return _0x3080bb[_0x524d('0x22')](_0x445647)[_0x524d('0x23')](function(_0x2a71f1){return _0x2a71f1;});}return null;};}function removeEntity(_0x3a86fa,_0x2dde33){return function(_0x16f233){if(_0x16f233){return _0x16f233[_0x524d('0x24')]()[_0x524d('0x23')](function(){_0x3a86fa[_0x524d('0x1b')](0xcc)[_0x524d('0x1a')]();});}};}function handleEntityNotFound(_0x1c533f,_0x3aabc5){return function(_0x3d56a6){if(!_0x3d56a6){_0x1c533f[_0x524d('0x25')](0x194);}return _0x3d56a6;};}function handleError(_0x10da31,_0x4a9428){_0x4a9428=_0x4a9428||0x1f4;return function(_0x1ed37b){logger[_0x524d('0x26')](_0x1ed37b[_0x524d('0x27')]);if(_0x1ed37b[_0x524d('0x28')]){delete _0x1ed37b[_0x524d('0x28')];}_0x10da31[_0x524d('0x1b')](_0x4a9428)[_0x524d('0x29')](_0x1ed37b);};}function getInteractionUsers(_0x72a07b,_0x48f8e4){return new BPromise(function(_0x40e3e3,_0x2ee959){try{if(_0x48f8e4[_0x72a07b['id']]){_0x72a07b[_0x524d('0x2a')]=_[_0x524d('0x2b')](_0x48f8e4[_0x72a07b['id']],function(_0x2b04bc){return{'id':_0x2b04bc['id'],'fullname':_0x2b04bc[_0x524d('0x2c')]};});}}catch(_0x55f2b7){_0x2ee959(_0x55f2b7);}_0x40e3e3(_0x72a07b);});}function getInteractionTags(_0x5a97b0,_0x17d8c8){return new BPromise(function(_0x1d1fbf,_0x26781d){try{if(_0x5a97b0[_0x524d('0x2d')]){_0x5a97b0[_0x524d('0x2e')]=[];_0x5a97b0[_0x524d('0x2d')]['split'](',')[_0x524d('0x2f')](function(_0x2e445a){_0x5a97b0[_0x524d('0x2e')][_0x524d('0x30')](_0x17d8c8[_0x2e445a]);});}delete _0x5a97b0[_0x524d('0x2d')];}catch(_0x477ba0){_0x26781d(_0x477ba0);}_0x1d1fbf(_0x5a97b0);});}function updateOpenchannelInteraction(_0x13c712,_0x1acf61,_0x546748){return new BPromise(function(_0xa64291,_0x4078f0){return getInteractionUsers(_0x13c712,_0x546748)[_0x524d('0x23')](function(_0x35e70f){return getInteractionTags(_0x35e70f,_0x1acf61);})[_0x524d('0x23')](function(_0x134905){_0xa64291(_0x134905);})['catch'](function(_0x51b68d){_0x4078f0(_0x51b68d);});});}exports[_0x524d('0x31')]=function(_0x44ba1d,_0xa78390){var _0x3f7b8c={},_0x3c252f={},_0x130d79={'count':0x0,'rows':[]};var _0x52752c=_[_0x524d('0x2b')](db[_0x524d('0x32')][_0x524d('0x33')],function(_0x30719a){return{'name':_0x30719a['fieldName'],'type':_0x30719a[_0x524d('0x34')][_0x524d('0x35')]};});_0x3c252f[_0x524d('0x36')]=_[_0x524d('0x2b')](_0x52752c,_0x524d('0x28'));_0x3c252f['query']=_[_0x524d('0x37')](_0x44ba1d['query']);_0x3c252f[_0x524d('0x38')]=_[_0x524d('0x39')](_0x3c252f[_0x524d('0x36')],_0x3c252f['query']);_0x3f7b8c[_0x524d('0x3a')]=_[_0x524d('0x39')](_0x3c252f['model'],qs[_0x524d('0x3b')](_0x44ba1d['query'][_0x524d('0x3b')]));_0x3f7b8c['attributes']=_0x3f7b8c[_0x524d('0x3a')][_0x524d('0x3c')]?_0x3f7b8c[_0x524d('0x3a')]:_0x3c252f['model'];if(!_0x44ba1d['query'][_0x524d('0x3d')]('nolimit')){_0x3f7b8c[_0x524d('0x1e')]=qs[_0x524d('0x1e')](_0x44ba1d[_0x524d('0x3e')][_0x524d('0x1e')]);_0x3f7b8c[_0x524d('0x1d')]=qs['offset'](_0x44ba1d[_0x524d('0x3e')][_0x524d('0x1d')]);}_0x3f7b8c[_0x524d('0x3f')]=qs[_0x524d('0x40')](_0x44ba1d['query']['sort']);_0x3f7b8c[_0x524d('0x41')]=qs[_0x524d('0x38')](_['pick'](_0x44ba1d[_0x524d('0x3e')],_0x3c252f['filters']),_0x52752c);var _0x42e3f0=[];var _0x5558c7=squel['select']()[_0x524d('0x42')]('id')[_0x524d('0x42')]('name')[_0x524d('0x42')]('color')[_0x524d('0x43')](_0x524d('0x44'));var _0x1cc1c2=squel[_0x524d('0x45')]()[_0x524d('0x42')](_0x524d('0x46'))[_0x524d('0x42')]('u.fullname')[_0x524d('0x42')](_0x524d('0x47'))['from']('user_has_openchannel_interactions','ui')[_0x524d('0x48')](_0x524d('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x31dd53=squel['select']()[_0x524d('0x43')](_0x524d('0x4a'),'i')['left_join'](_0x524d('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x524d('0x48')](_0x524d('0x49'),'o',_0x524d('0x4c'))[_0x524d('0x48')](_0x524d('0x4d'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x524d('0x48')]('openchannel_messages','me',_0x524d('0x4e'))[_0x524d('0x48')](_0x524d('0x4f'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x524d('0x44'),'t',_0x524d('0x50'));var _0x1bf2e2=squel[_0x524d('0x51')]();var _0x517b36=[];var _0x2b412b=squel[_0x524d('0x51')]();var _0x51809e;if(_0x44ba1d[_0x524d('0x3e')][_0x524d('0x52')]){_0x51809e=as[_0x524d('0x53')](_0x44ba1d[_0x524d('0x3e')][_0x524d('0x52')]);var _0x46a038=_0x51809e[_0x524d('0x54')];for(var _0x1c52ca=0x0;_0x1c52ca<_0x51809e['conditions']['length'];_0x1c52ca++){var _0x41fd1b=_0x51809e[_0x524d('0x55')][_0x1c52ca];var _0x45a08a='i';var _0x54136c=_[_0x524d('0x56')](_0x52752c,[_0x524d('0x28'),_0x41fd1b[_0x524d('0x42')]]);if(!_0x54136c){switch(_0x41fd1b[_0x524d('0x42')]){case _0x524d('0x57'):if(_0x41fd1b['value']==0x1){_0x31dd53[_0x524d('0x58')]('`'+_0x41fd1b[_0x524d('0x42')]+_0x524d('0x59'));}else{_0x31dd53[_0x524d('0x58')]('`'+_0x41fd1b[_0x524d('0x42')]+'`\x20>\x200');}break;case _0x524d('0x5a'):if(_0x41fd1b['operator']==='$substring'){if(_0x41fd1b[_0x524d('0x5b')][_0x524d('0x5c')]('\x20')[_0x524d('0x3c')]>0x1){_0x1bf2e2[_0x46a038](_0x524d('0x5d'),qs['getFullTextValue'](_0x41fd1b[_0x524d('0x5b')]),null);}else{var _0x58c158='%'+_0x41fd1b[_0x524d('0x5b')]+'%';_0x1bf2e2[_0x46a038](_0x524d('0x5e'),_0x58c158,_0x58c158,_0x58c158);}}else{_0x54136c=_[_0x524d('0x56')](_0x52752c,[_0x524d('0x28'),_0x524d('0x5f')]);_0x41fd1b[_0x524d('0x42')]=_0x524d('0x5f');_0x2949f1=as[_0x524d('0x60')](_0x45a08a,_0x54136c[_0x524d('0x34')],_0x41fd1b);_0x1bf2e2[_0x46a038](_0x2949f1[_0x524d('0x61')],_0x2949f1[_0x524d('0x5b')][_0x524d('0x62')],_0x2949f1[_0x524d('0x5b')]['end']);}break;case _0x524d('0x63'):var _0x1bf763=_0x41fd1b['value'][_0x524d('0x5c')](',')[_0x524d('0x2b')](function(_0x4cd027){return Number(_0x4cd027);});_0x1bf763[_0x524d('0x2f')](function(_0xab79c5){_0x2b412b['or'](_0x524d('0x64'),'%,'+_0xab79c5+',%');});_0x517b36=_[_0x524d('0x65')](_0x517b36,_0x1bf763);break;case _0x524d('0x66'):if(_0x41fd1b[_0x524d('0x67')]===_0x524d('0x68')){_0x1bf2e2[_0x46a038](_0x524d('0x69'),'%'+_0x41fd1b[_0x524d('0x5b')]+'%',null);}else{_0x54136c=_[_0x524d('0x56')](_0x52752c,[_0x524d('0x28'),'UserId']);_0x41fd1b['field']='UserId';_0x2949f1=as[_0x524d('0x60')](_0x45a08a,_0x54136c['type'],_0x41fd1b);_0x1bf2e2[_0x46a038](_0x2949f1[_0x524d('0x61')],_0x2949f1[_0x524d('0x5b')][_0x524d('0x62')],_0x2949f1[_0x524d('0x5b')][_0x524d('0x1a')]);}break;case _0x524d('0x6a'):_0x2949f1=as[_0x524d('0x60')]('me',null,_0x41fd1b);_0x1bf2e2[_0x46a038](_0x2949f1[_0x524d('0x61')],_0x2949f1[_0x524d('0x5b')][_0x524d('0x62')],_0x2949f1[_0x524d('0x5b')][_0x524d('0x1a')]);break;}}else{var _0x2949f1=as[_0x524d('0x60')](_0x45a08a,_0x54136c[_0x524d('0x34')],_0x41fd1b);_0x1bf2e2[_0x46a038](_0x2949f1['text'],_0x2949f1[_0x524d('0x5b')][_0x524d('0x62')],_0x2949f1[_0x524d('0x5b')][_0x524d('0x1a')]);}}}else{var _0x536f63=_(_0x44ba1d['query'])[_0x524d('0x37')]()[_0x524d('0x2b')](function(_0x4fe0a5){return _[_0x524d('0x6b')](_0x52752c,[_0x524d('0x28'),_0x4fe0a5])?_0x4fe0a5:undefined;})[_0x524d('0x6c')]()['value']();if(!_[_0x524d('0x6d')](_0x536f63)){_0x536f63[_0x524d('0x2f')](function(_0x2021ab){if(_0x2021ab===_0x524d('0x6e')){_0x31dd53['where'](_0x524d('0x6f'),[][_0x524d('0x70')](_0x44ba1d[_0x524d('0x3e')][_0x2021ab]));}else if(_0x2021ab===_0x524d('0x71')){var _0xcac1bc=JSON[_0x524d('0x72')](_0x44ba1d['query'][_0x2021ab])['$gte'];var _0x237734=JSON[_0x524d('0x72')](_0x44ba1d[_0x524d('0x3e')][_0x2021ab])['$lte'];_0x31dd53['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xcac1bc,_0x237734);}else{if(_0x44ba1d[_0x524d('0x3e')][_0x2021ab]===_0x524d('0x73')){_0x31dd53[_0x524d('0x41')]('i.'+_0x2021ab+_0x524d('0x74'));}else{_0x31dd53[_0x524d('0x41')]('i.'+_0x2021ab+_0x524d('0x75'),_0x44ba1d[_0x524d('0x3e')][_0x2021ab]);}}});}if(_0x44ba1d[_0x524d('0x3e')]['read']){if(_0x44ba1d[_0x524d('0x3e')]['read']==0x1){_0x31dd53[_0x524d('0x58')](_0x524d('0x76'));}else{_0x31dd53[_0x524d('0x58')](_0x524d('0x77'));}}if(_0x44ba1d[_0x524d('0x3e')]['tag']){_0x517b36=_[_0x524d('0x78')](_0x44ba1d[_0x524d('0x3e')][_0x524d('0x79')])?_0x44ba1d[_0x524d('0x3e')][_0x524d('0x79')]:new Array(_0x44ba1d['query'][_0x524d('0x79')]);_0x517b36['forEach'](function(_0x5bef90){_0x2b412b['or'](_0x524d('0x64'),'%,'+_0x5bef90+',%');});}if(_0x44ba1d[_0x524d('0x3e')][_0x524d('0x7a')]){var _0x1a4ad3=_0x44ba1d[_0x524d('0x3e')][_0x524d('0x7a')]['replace']('\x5c','\x5c\x5c')[_0x524d('0x7b')](/'/g,'\x27\x27');if(qs[_0x524d('0x7c')](_0x1a4ad3)){_0x1bf2e2['or'](_0x524d('0x7d'),_0x1a4ad3+'%');}else{_0x1bf2e2['or'](_0x524d('0x7e'),qs[_0x524d('0x7f')](_0x1a4ad3))['or'](_0x524d('0x80'),_0x1a4ad3+'%')['or'](_0x524d('0x81'),_0x1a4ad3+'%');}}}_0x31dd53[_0x524d('0x41')](_0x1bf2e2);_0x31dd53[_0x524d('0x82')](_0x524d('0x83'));var _0x196c3e={'type':db['Sequelize'][_0x524d('0x84')]['SELECT'],'raw':!![]};var _0x4d6c75=_0x31dd53[_0x524d('0x85')]();_0x4d6c75[_0x524d('0x42')]('i.id');_0x4d6c75['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x3f7b8c[_0x524d('0x3f')]){_0x3f7b8c[_0x524d('0x3f')][_0x524d('0x2f')](function(_0x3b536c){var _0x4ef976=_0x3b536c[0x0]===_0x524d('0x86')?_0x3b536c[0x0]:'i.'+_0x3b536c[0x0];_0x31dd53[_0x524d('0x3f')](_0x4ef976,_0x3b536c[0x1]===_0x524d('0x87')?![]:!![]);});}if(!_[_0x524d('0x6d')](_0x517b36)){_0x31dd53[_0x524d('0x58')](_0x2b412b);_0x4d6c75[_0x524d('0x41')](_0x524d('0x88'),_0x517b36);}BPromise[_0x524d('0x89')]()[_0x524d('0x23')](function(){if(!_0x51809e){if(_0x44ba1d[_0x524d('0x3e')]['OpenchannelAccountId']||_0x44ba1d[_0x524d('0x3e')][_0x524d('0x8a')])return;_0x4d6c75['where'](_0x524d('0x8b'));_0x31dd53['where'](_0x524d('0x8b'));return;}if(_0x44ba1d[_0x524d('0x8c')]['role']!==_0x524d('0x8d'))return;return _0x44ba1d[_0x524d('0x8c')][_0x524d('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x20bdac){if(_[_0x524d('0x6d')](_0x20bdac)){_0x4d6c75[_0x524d('0x41')](_0x524d('0x8f'));_0x31dd53[_0x524d('0x41')](_0x524d('0x8f'));}else{_0x4d6c75[_0x524d('0x41')](_0x524d('0x6f'),_[_0x524d('0x2b')](_0x20bdac,'id'));_0x31dd53[_0x524d('0x41')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x20bdac,'id'));}});})[_0x524d('0x23')](function(){if(_0x44ba1d[_0x524d('0x8c')]['role']===_0x524d('0x8d')&&!_0x51809e&&!_0x44ba1d[_0x524d('0x3e')]['OpenchannelAccountId'])return[];return db[_0x524d('0x90')][_0x524d('0x3e')](_0x4d6c75[_0x524d('0x91')](),_0x196c3e);})[_0x524d('0x23')](function(_0x338cd7){_0x130d79[_0x524d('0x92')]=_0x338cd7[_0x524d('0x3c')];if(_0x130d79['count']===0x0)return[];return db[_0x524d('0x90')][_0x524d('0x3e')](_0x5558c7[_0x524d('0x91')](),_0x196c3e)[_0x524d('0x23')](function(_0x548715){_0x42e3f0=_['keyBy'](_0x548715,'id');_0x196c3e=_['merge'](_0x196c3e,{'model':db[_0x524d('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44ba1d[_0x524d('0x3e')]['fields']){_0x3f7b8c[_0x524d('0x3a')][_0x524d('0x2f')](function(_0xedb4eb){_0x31dd53[_0x524d('0x42')]('i.'+_0xedb4eb);});}else{_0x31dd53[_0x524d('0x42')](_0x524d('0x93'),_0x524d('0x57'));_0x31dd53['field'](_0x524d('0x94'),'Account.key');_0x31dd53['field'](_0x524d('0x95'),_0x524d('0x96'));_0x31dd53[_0x524d('0x42')]('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',_0x524d('0x86'));_0x31dd53['field'](_0x524d('0x97'));_0x31dd53[_0x524d('0x42')]('c.firstName',_0x524d('0x98'));_0x31dd53[_0x524d('0x42')]('c.lastName',_0x524d('0x99'));_0x31dd53[_0x524d('0x42')]('c.email',_0x524d('0x9a'));_0x31dd53[_0x524d('0x42')](_0x524d('0x9b'),'Contact.phone');_0x31dd53['field'](_0x524d('0x9c'),_0x524d('0x9d'));_0x31dd53['field'](_0x524d('0x9e'),'Contact.fax');_0x31dd53[_0x524d('0x42')](_0x524d('0x9f'),_0x524d('0xa0'));_0x31dd53['field'](_0x524d('0xa1'),_0x524d('0xa2'));_0x31dd53['field'](_0x524d('0xa3'),'TagIds');}if(_0x3f7b8c['limit'])_0x31dd53[_0x524d('0x1e')](_0x3f7b8c[_0x524d('0x1e')]);if(_0x3f7b8c['offset'])_0x31dd53[_0x524d('0x1d')](_0x3f7b8c[_0x524d('0x1d')]);return db[_0x524d('0x90')][_0x524d('0x3e')](_0x31dd53['toString'](),_0x196c3e);})[_0x524d('0x23')](function(_0x5c3028){_0x1cc1c2[_0x524d('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x524d('0x2b')](_0x5c3028,'id'));return db[_0x524d('0x90')]['query'](_0x1cc1c2[_0x524d('0x91')](),_0x196c3e)['then'](function(_0x1f11d6){var _0xf479d0=_[_0x524d('0xa4')](_0x1f11d6,_0x524d('0xa5'));var _0x5a13c7=[];_0x5c3028[_0x524d('0x2f')](function(_0x46cb4d){_0x5a13c7[_0x524d('0x30')](updateOpenchannelInteraction(_0x46cb4d,_0x42e3f0,_0xf479d0));});return BPromise[_0x524d('0xa6')](_0x5a13c7);});});})[_0x524d('0x23')](function(_0x26340c){_0x130d79[_0x524d('0xa7')]=_0x26340c;return _0x130d79;})[_0x524d('0x23')](respondWithFilteredResult(_0xa78390,_0x3f7b8c))['catch'](handleError(_0xa78390,null));};exports[_0x524d('0xa8')]=function(_0x37cfad,_0x2ffd3a){var _0xd48e7c={};if(_0x37cfad[_0x524d('0x3e')][_0x524d('0x34')]&&_0x37cfad[_0x524d('0x3e')]['type']===_0x524d('0x43')){_0xd48e7c[_0x524d('0x43')]=_0x37cfad[_0x524d('0xa9')]['id'];}else{_0xd48e7c['id']=_0x37cfad['params']['id'];}var _0x458c1a={'raw':![],'where':_0xd48e7c},_0x3b4cfd={};_0x3b4cfd[_0x524d('0x36')]=_[_0x524d('0x37')](db[_0x524d('0x32')][_0x524d('0x33')]);_0x3b4cfd[_0x524d('0x3e')]=_['keys'](_0x37cfad[_0x524d('0x3e')]);_0x3b4cfd[_0x524d('0x38')]=_[_0x524d('0x39')](_0x3b4cfd[_0x524d('0x36')],_0x3b4cfd[_0x524d('0x3e')]);_0x458c1a[_0x524d('0x3a')]=_[_0x524d('0x39')](_0x3b4cfd['model'],qs[_0x524d('0x3b')](_0x37cfad[_0x524d('0x3e')][_0x524d('0x3b')]));_0x458c1a[_0x524d('0x3a')]=_0x458c1a[_0x524d('0x3a')]['length']?_0x458c1a['attributes']:_0x3b4cfd[_0x524d('0x36')];if(_0x37cfad['query'][_0x524d('0xaa')]){_0x458c1a[_0x524d('0xab')]=[{'all':!![]}];}_0x458c1a=_[_0x524d('0xac')]({},_0x458c1a,_0x37cfad[_0x524d('0xad')]);return db['OpenchannelInteraction']['find'](_0x458c1a)[_0x524d('0x23')](handleEntityNotFound(_0x2ffd3a,null))[_0x524d('0x23')](respondWithResult(_0x2ffd3a,null))[_0x524d('0xae')](handleError(_0x2ffd3a,null));};exports[_0x524d('0xaf')]=function(_0x2313be,_0x4cec64){return db[_0x524d('0x32')][_0x524d('0xaf')](_0x2313be[_0x524d('0x6a')],{})[_0x524d('0x23')](respondWithResult(_0x4cec64,0xc9))[_0x524d('0xae')](handleError(_0x4cec64,null));};exports['update']=function(_0x17d8b0,_0x2c586a){if(_0x17d8b0[_0x524d('0x6a')]['id']){delete _0x17d8b0[_0x524d('0x6a')]['id'];}return db['OpenchannelInteraction'][_0x524d('0x56')]({'where':{'id':_0x17d8b0[_0x524d('0xa9')]['id']}})[_0x524d('0x23')](handleEntityNotFound(_0x2c586a,null))[_0x524d('0x23')](saveUpdates(_0x17d8b0[_0x524d('0x6a')],null))['then'](respondWithResult(_0x2c586a,null))[_0x524d('0xae')](handleError(_0x2c586a,null));};exports[_0x524d('0x24')]=function(_0x161da8,_0x1999e0){return db[_0x524d('0x32')][_0x524d('0x56')]({'where':{'id':_0x161da8[_0x524d('0xa9')]['id']}})[_0x524d('0x23')](handleEntityNotFound(_0x1999e0,null))[_0x524d('0x23')](removeEntity(_0x1999e0,null))['catch'](handleError(_0x1999e0,null));};exports[_0x524d('0xb0')]=function(_0x2a804a,_0x3428db){return db['OpenchannelInteraction'][_0x524d('0xb0')]()[_0x524d('0x23')](respondWithResult(_0x3428db,null))[_0x524d('0xae')](handleError(_0x3428db,null));};exports[_0x524d('0xb1')]=function(_0x565b1a,_0x5d5a01,_0x533a70){return db[_0x524d('0xb2')]['find']({'where':{'id':_0x565b1a[_0x524d('0xa9')]['id']}})[_0x524d('0x23')](handleEntityNotFound(_0x5d5a01,null))[_0x524d('0x23')](function(_0xa943f6){if(_0xa943f6){return _0xa943f6[_0x524d('0xb1')](_0x565b1a['body'][_0x524d('0xb3')],_[_0x524d('0xb4')](_0x565b1a['body'],[_0x524d('0xb3'),'id'])||{});}})[_0x524d('0x23')](respondWithResult(_0x5d5a01,null))[_0x524d('0xae')](handleError(_0x5d5a01,null));};exports['getMessages']=function(_0x272d87,_0x3276f3,_0x50fc26){var _0x331b35={'raw':![],'where':{}};var _0x34117={};var _0x381f40={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x524d('0xb5')]({'where':{'id':_0x272d87[_0x524d('0xa9')]['id']}})[_0x524d('0x23')](handleEntityNotFound(_0x3276f3,null))[_0x524d('0x23')](function(_0x579765){if(_0x579765){_0x34117[_0x524d('0x36')]=_[_0x524d('0x37')](db[_0x524d('0xb2')][_0x524d('0x33')]);_0x34117[_0x524d('0x3e')]=_[_0x524d('0x37')](_0x272d87[_0x524d('0x3e')]);_0x34117[_0x524d('0x38')]=_[_0x524d('0x39')](_0x34117[_0x524d('0x36')],_0x34117[_0x524d('0x3e')]);_0x331b35[_0x524d('0x3a')]=_[_0x524d('0x39')](_0x34117[_0x524d('0x36')],qs['fields'](_0x272d87['query'][_0x524d('0x3b')]));_0x331b35[_0x524d('0x3a')]=_0x331b35[_0x524d('0x3a')]['length']?_0x331b35[_0x524d('0x3a')]:_0x34117[_0x524d('0x36')];if(!_0x272d87[_0x524d('0x3e')][_0x524d('0x3d')](_0x524d('0xb6'))){_0x331b35['limit']=qs[_0x524d('0x1e')](_0x272d87[_0x524d('0x3e')][_0x524d('0x1e')]);_0x331b35[_0x524d('0x1d')]=qs['offset'](_0x272d87[_0x524d('0x3e')][_0x524d('0x1d')]);}_0x331b35[_0x524d('0x3f')]=qs[_0x524d('0x40')](_0x272d87[_0x524d('0x3e')]['sort']);_0x331b35[_0x524d('0x41')]=qs[_0x524d('0x38')](_[_0x524d('0xb7')](_0x272d87[_0x524d('0x3e')],_0x34117[_0x524d('0x38')]));_0x331b35[_0x524d('0x41')][_0x524d('0xa5')]=_0x579765['id'];if(_0x272d87['query'][_0x524d('0x7a')]){_0x331b35[_0x524d('0x41')]=_[_0x524d('0xac')](_0x331b35['where'],{'$or':_['map'](_0x331b35[_0x524d('0x3a')],function(_0x41f523){var _0x10ff4b={};_0x10ff4b[_0x41f523]={'$like':'%'+_0x272d87['query']['filter']+'%'};return _0x10ff4b;})});}if(_0x272d87['query'][_0x524d('0xb8')]){var _0x5049f4=_0x272d87[_0x524d('0x3e')][_0x524d('0xb8')]['split'](',');var _0x43f9a2={};_0x43f9a2[_0x5049f4[0x0]]={'$gte':moment(_0x5049f4[0x1])['format'](_0x524d('0xb9'))};_0x331b35[_0x524d('0x41')]=_[_0x524d('0xac')](_0x331b35[_0x524d('0x41')],_0x43f9a2);}_0x331b35=_['merge']({},_0x331b35,_0x272d87[_0x524d('0xad')]);return db['OpenchannelMessage'][_0x524d('0x92')]({'where':_0x331b35[_0x524d('0x41')]})[_0x524d('0x23')](function(_0x4621f6){_0x381f40[_0x524d('0x92')]=_0x4621f6;if(_0x272d87[_0x524d('0x3e')]['includeAll']){_0x331b35[_0x524d('0xab')]=[{'all':!![]}];}return db[_0x524d('0xb2')][_0x524d('0xba')](_0x331b35);})[_0x524d('0x23')](function(_0x43d134){_0x381f40['rows']=_0x43d134;return _0x381f40;});}})[_0x524d('0x23')](respondWithFilteredResult(_0x3276f3,_0x331b35))[_0x524d('0xae')](handleError(_0x3276f3,null));};exports['addTags']=function(_0x39d01c,_0x3d4eb5,_0x51cefe){return db['OpenchannelInteraction'][_0x524d('0x56')]({'where':{'id':_0x39d01c[_0x524d('0xa9')]['id']}})[_0x524d('0x23')](handleEntityNotFound(_0x3d4eb5,null))[_0x524d('0x23')](function(_0x49867f){if(_0x49867f){return _0x49867f['setTags'](_0x39d01c[_0x524d('0x6a')][_0x524d('0xb3')],_[_0x524d('0xb4')](_0x39d01c[_0x524d('0x6a')],[_0x524d('0xb3'),'id'])||{})[_0x524d('0xbb')](function(){return db[_0x524d('0x63')][_0x524d('0xba')]({'attributes':['id',_0x524d('0x28'),_0x524d('0xbc')],'where':{'id':_0x39d01c[_0x524d('0x6a')][_0x524d('0xb3')]}});})[_0x524d('0x23')](function(_0xa6664d){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x39d01c[_0x524d('0xa9')]['id']),'tags':_0xa6664d||[]});return{'id':Number(_0x39d01c[_0x524d('0xa9')]['id']),'tags':_0xa6664d||[]};});}})[_0x524d('0x23')](respondWithResult(_0x3d4eb5,null))[_0x524d('0xae')](handleError(_0x3d4eb5,null));};exports[_0x524d('0xbd')]=function(_0x356ff7,_0x2d3855,_0x5832cc){return db['OpenchannelInteraction'][_0x524d('0x56')]({'where':{'id':_0x356ff7['params']['id']}})['then'](handleEntityNotFound(_0x2d3855,null))[_0x524d('0x23')](function(_0xd09047){if(_0xd09047){return _0xd09047[_0x524d('0xbd')](_0x356ff7[_0x524d('0x3e')][_0x524d('0xb3')]);}})[_0x524d('0x23')](respondWithStatusCode(_0x2d3855,null))[_0x524d('0xae')](handleError(_0x2d3855,null));};exports[_0x524d('0xbe')]=function(_0x490dc2,_0x3221c8){var _0x386330=moment()[_0x524d('0xbf')]()[_0x524d('0x91')]();var _0x1e3455=path[_0x524d('0xc0')](config[_0x524d('0xc1')],_0x524d('0xc2'),_0x524d('0xc3'),'tmp');var _0x2def07=path[_0x524d('0xc0')](config[_0x524d('0xc1')],_0x524d('0xc2'),_0x524d('0xc3'),'attachments');var _0xbcd5a=path[_0x524d('0xc0')](_0x1e3455,_0x386330);var _0x161f47=util['format']('transcript-%d-%s.zip',_0x490dc2['params']['id'],_0x386330);var _0x254798=path[_0x524d('0xc0')](_0x1e3455,_0x161f47);var _0x1d560b=[];_0x1d560b['push']({'model':db[_0x524d('0x66')],'as':_0x524d('0x66'),'attributes':['id',_0x524d('0x2c')],'raw':!![]});_0x1d560b[_0x524d('0x30')]({'model':db[_0x524d('0xc4')],'as':_0x524d('0x5a'),'attributes':['id','firstName',_0x524d('0xc5')],'raw':!![]});if(_0x490dc2[_0x524d('0x3e')][_0x524d('0xc6')]){_0x1d560b['push']({'model':db[_0x524d('0xc7')],'as':_0x524d('0xc7'),'raw':!![]});}var _0x45e055=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x524d('0x6a'),_0x524d('0x71'),'direction',_0x524d('0xc8'),_0x524d('0xc9')],'include':_0x1d560b}];_0x45e055[_0x524d('0x30')]({'model':db[_0x524d('0xca')],'as':_0x524d('0xcb'),'attributes':['id',_0x524d('0x28')]});_0x45e055[_0x524d('0x30')]({'model':db[_0x524d('0x66')],'as':_0x524d('0xcc'),'attributes':['id',_0x524d('0x2c')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x490dc2['params']['id']},'include':_0x45e055})[_0x524d('0x23')](handleEntityNotFound(_0x3221c8,null))['then'](function(_0x53e37b){if(_0x53e37b){var _0x36c72c=_0x53e37b[_0x524d('0xcd')]({'plain':!![]});fs[_0x524d('0xce')](_0xbcd5a);var _0x568ae4={'format':'A4','border':_0x524d('0xcf'),'header':{'height':_0x524d('0xd0'),'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':_0x524d('0xd1'),'contents':{'default':util['format'](_0x524d('0xd2'),util[_0x524d('0xd3')]('%s\x20#%d',_0x524d('0xd4'),_0x36c72c['id']),moment()[_0x524d('0xd3')](_0x524d('0xd5'))['toString']())}}};var _0x31733a={'channel':_0x524d('0xd4'),'account':_0x36c72c[_0x524d('0xcb')][_0x524d('0x28')],'agent':_0x36c72c[_0x524d('0xcc')]?_0x36c72c[_0x524d('0xcc')]['fullname']:_0x524d('0xd6'),'createdAt':moment(_0x36c72c[_0x524d('0x71')])[_0x524d('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x36c72c[_0x524d('0xd7')]?moment(_0x36c72c[_0x524d('0xd8')])[_0x524d('0xd3')](_0x524d('0xb9'))[_0x524d('0x91')]():'','disposition':_0x36c72c[_0x524d('0xd9')],'visibility':_0x36c72c[_0x524d('0xda')]?_0x524d('0xdb'):_0x524d('0xdc'),'messages':_(_0x36c72c[_0x524d('0xdd')])[_0x524d('0x7a')]({'secret':![]})[_0x524d('0x2b')](function(_0x4823e3){if(_0x4823e3[_0x524d('0xc7')]){var _0x58946c=path[_0x524d('0xc0')](_0x2def07,_0x4823e3['Attachment']['basename']);if(fs['existsSync'](_0x58946c)){fs['createReadStream'](_0x58946c)[_0x524d('0xde')](fs[_0x524d('0xdf')](path[_0x524d('0xc0')](_0xbcd5a,_0x4823e3[_0x524d('0xc7')][_0x524d('0xe0')])));}}return{'date':moment(_0x4823e3[_0x524d('0x71')])[_0x524d('0xd3')](_0x524d('0xb9'))[_0x524d('0x91')](),'sender':_0x4823e3[_0x524d('0xe1')]===_0x524d('0xe2')?_0x4823e3['User']?_0x4823e3[_0x524d('0x66')][_0x524d('0x2c')]:_0x524d('0xe3'):_0x4823e3[_0x524d('0x5a')]['firstName']+(_0x4823e3['Contact'][_0x524d('0xc5')]?'\x20'+_0x4823e3['Contact'][_0x524d('0xc5')]:''),'body':_0x4823e3[_0x524d('0xc7')]?_0x4823e3[_0x524d('0xc7')]['basename']:_0x4823e3[_0x524d('0x6a')],'direction':_0x4823e3[_0x524d('0xe1')]===_0x524d('0xe2')?'A':'C','secret':_0x4823e3['secret'],'read':_0x4823e3[_0x524d('0xc9')],'attachment':_0x4823e3[_0x524d('0xc7')]};})[_0x524d('0x5b')]()};return ejs[_0x524d('0xe4')](path[_0x524d('0xc0')](config[_0x524d('0xc1')],_0x524d('0xc2'),'views',_0x524d('0xe5')),{'interaction':_0x31733a})[_0x524d('0x23')](function(_0x17c9b5){return new BPromise(function(_0x2bb4a2,_0x103ac2){pdf[_0x524d('0xaf')](_0x17c9b5,_0x568ae4)[_0x524d('0xe6')](path[_0x524d('0xc0')](_0xbcd5a,_0x524d('0xe7')+_0x36c72c['id']+'-'+_0x386330+_0x524d('0xe8')),function(_0xc6b8a4,_0xd14ec1){if(_0xc6b8a4)return _0x103ac2(_0xc6b8a4);_0x2bb4a2(_0xd14ec1);});});})[_0x524d('0x23')](function(){return new BPromise(function(_0x1a264a,_0x352cfb){zipdir(_0xbcd5a,{'saveTo':_0x254798},function(_0x54e24e,_0x49ded9){if(_0x54e24e)return _0x352cfb(_0x54e24e);return _0x1a264a(_0x49ded9);});})[_0x524d('0x23')](function(){return new BPromise(function(_0x19b73e,_0x2c3044){rimraf(_0xbcd5a,function(_0x5d513c){if(_0x5d513c)_0x2c3044(_0x5d513c);return _0x19b73e();});});})['then'](function(){return _0x3221c8['download'](_0x254798,_0x161f47,function(_0x367252){if(_0x367252){console[_0x524d('0xe9')](_0x524d('0xea'),_0x367252);}else{fs[_0x524d('0xeb')](_0x254798);}});});});}else{return _0x3221c8[_0x524d('0x25')](0xc8);}})[_0x524d('0xae')](handleError(_0x3221c8,null));}; \ No newline at end of file +var _0x2879=['ids','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Messages','basename','createReadStream','createWriteStream','out','System','renderFile','downloadInteraction.html','toFile','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','select','field','color','from','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','UserId','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','merge','unreadMessages','a.key','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','i.*','Contact.firstName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','rows','catch','type','params','include','create','body','describe','addMessage','omit','findOne','OpenchannelMessage','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags'];(function(_0x4377b1,_0x32b738){var _0x312d48=function(_0x4ba683){while(--_0x4ba683){_0x4377b1['push'](_0x4377b1['shift']());}};_0x312d48(++_0x32b738);}(_0x2879,0x11b));var _0x9287=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2879[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9287('0x0'));var emlformat=require(_0x9287('0x1'));var rimraf=require(_0x9287('0x2'));var zipdir=require(_0x9287('0x3'));var jsonpatch=require(_0x9287('0x4'));var rp=require(_0x9287('0x5'));var moment=require(_0x9287('0x6'));var BPromise=require(_0x9287('0x7'));var Mustache=require('mustache');var util=require(_0x9287('0x8'));var path=require(_0x9287('0x9'));var sox=require(_0x9287('0xa'));var csv=require(_0x9287('0xb'));var ejs=require(_0x9287('0xc'));var fs=require('fs');var _=require(_0x9287('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9287('0xe'));var deskjs=require(_0x9287('0xf'));var toCsv=require(_0x9287('0xb'));var querystring=require(_0x9287('0x10'));var Papa=require(_0x9287('0x11'));var Redis=require(_0x9287('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9287('0x13'));var hardwareService=require(_0x9287('0x14'));var logger=require('../../config/logger')(_0x9287('0x15'));var utils=require('../../config/utils');var config=require(_0x9287('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9287('0x17')]=_[_0x9287('0x18')](config['redis'],{'host':_0x9287('0x19'),'port':0x18eb});var socket=require(_0x9287('0x1a'))(new Redis(config[_0x9287('0x17')]));require(_0x9287('0x1b'))[_0x9287('0x1c')](socket);function respondWithStatusCode(_0x4dff18,_0x3bb9b6){_0x3bb9b6=_0x3bb9b6||0xcc;return function(_0x3a57ea){if(_0x3a57ea){return _0x4dff18[_0x9287('0x1d')](_0x3bb9b6);}return _0x4dff18[_0x9287('0x1e')](_0x3bb9b6)[_0x9287('0x1f')]();};}function respondWithResult(_0x34d0bb,_0x48e0cc){_0x48e0cc=_0x48e0cc||0xc8;return function(_0x445811){if(_0x445811){return _0x34d0bb[_0x9287('0x1e')](_0x48e0cc)[_0x9287('0x20')](_0x445811);}};}function respondWithFilteredResult(_0x38220c,_0x472fba){return function(_0x5c939d){if(_0x5c939d){var _0x983a5c=_0x5c939d[_0x9287('0x21')],_0x2890a0=_0x472fba['offset'],_0x4a5754=_0x472fba[_0x9287('0x22')]+_0x472fba['limit'],_0x2678b6;if(_0x4a5754>=_0x983a5c){_0x4a5754=_0x983a5c;_0x2678b6=0xc8;}else{_0x2678b6=0xce;}_0x38220c[_0x9287('0x1e')](_0x2678b6);return _0x38220c[_0x9287('0x23')](_0x9287('0x24'),_0x2890a0+'-'+_0x4a5754+'/'+_0x983a5c)['json'](_0x5c939d);}return null;};}function patchUpdates(_0x528421){return function(_0x53e96f){try{jsonpatch['apply'](_0x53e96f,_0x528421,!![]);}catch(_0x5ddf37){return BPromise[_0x9287('0x25')](_0x5ddf37);}return _0x53e96f[_0x9287('0x26')]();};}function saveUpdates(_0x41a331,_0x48cc9f){return function(_0x269e52){if(_0x269e52){return _0x269e52[_0x9287('0x27')](_0x41a331)[_0x9287('0x28')](function(_0x27cfaf){return _0x27cfaf;});}return null;};}function removeEntity(_0x2f8b11,_0x4e25d8){return function(_0x28303b){if(_0x28303b){return _0x28303b[_0x9287('0x29')]()[_0x9287('0x28')](function(){_0x2f8b11['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44be18,_0x4085bb){return function(_0x56b901){if(!_0x56b901){_0x44be18[_0x9287('0x1d')](0x194);}return _0x56b901;};}function handleError(_0x5263de,_0x1be013){_0x1be013=_0x1be013||0x1f4;return function(_0x5374f6){logger[_0x9287('0x2a')](_0x5374f6[_0x9287('0x2b')]);if(_0x5374f6[_0x9287('0x2c')]){delete _0x5374f6[_0x9287('0x2c')];}_0x5263de['status'](_0x1be013)[_0x9287('0x2d')](_0x5374f6);};}function getInteractionUsers(_0x2beec0,_0x1d6ea5){return new BPromise(function(_0x407595,_0xd5e165){try{if(_0x1d6ea5[_0x2beec0['id']]){_0x2beec0[_0x9287('0x2e')]=_[_0x9287('0x2f')](_0x1d6ea5[_0x2beec0['id']],function(_0x59e866){return{'id':_0x59e866['id'],'fullname':_0x59e866[_0x9287('0x30')]};});}}catch(_0x42fcf3){_0xd5e165(_0x42fcf3);}_0x407595(_0x2beec0);});}function getInteractionTags(_0x5df5e1,_0x3cf493){return new BPromise(function(_0x2dd744,_0x42200e){try{if(_0x5df5e1[_0x9287('0x31')]){_0x5df5e1[_0x9287('0x32')]=[];_0x5df5e1['TagIds']['split'](',')[_0x9287('0x33')](function(_0x3abb64){_0x5df5e1[_0x9287('0x32')][_0x9287('0x34')](_0x3cf493[_0x3abb64]);});}delete _0x5df5e1[_0x9287('0x31')];}catch(_0x1155ac){_0x42200e(_0x1155ac);}_0x2dd744(_0x5df5e1);});}function updateOpenchannelInteraction(_0x43d363,_0x500b85,_0x15c41a){return new BPromise(function(_0x1f6f88,_0x2256a1){return getInteractionUsers(_0x43d363,_0x15c41a)['then'](function(_0x270d4b){return getInteractionTags(_0x270d4b,_0x500b85);})[_0x9287('0x28')](function(_0x2b97d6){_0x1f6f88(_0x2b97d6);})['catch'](function(_0x526bcf){_0x2256a1(_0x526bcf);});});}exports[_0x9287('0x35')]=function(_0x20e58c,_0x405d0b){var _0x837072={},_0x5bc3e0={},_0x66ded={'count':0x0,'rows':[]};var _0x242a10=_[_0x9287('0x2f')](db[_0x9287('0x36')][_0x9287('0x37')],function(_0x2a25ac){return{'name':_0x2a25ac[_0x9287('0x38')],'type':_0x2a25ac['type'][_0x9287('0x39')]};});_0x5bc3e0[_0x9287('0x3a')]=_[_0x9287('0x2f')](_0x242a10,'name');_0x5bc3e0[_0x9287('0x3b')]=_[_0x9287('0x3c')](_0x20e58c[_0x9287('0x3b')]);_0x5bc3e0[_0x9287('0x3d')]=_['intersection'](_0x5bc3e0['model'],_0x5bc3e0[_0x9287('0x3b')]);_0x837072[_0x9287('0x3e')]=_[_0x9287('0x3f')](_0x5bc3e0[_0x9287('0x3a')],qs['fields'](_0x20e58c[_0x9287('0x3b')][_0x9287('0x40')]));_0x837072['attributes']=_0x837072[_0x9287('0x3e')]['length']?_0x837072[_0x9287('0x3e')]:_0x5bc3e0['model'];if(!_0x20e58c['query'][_0x9287('0x41')]('nolimit')){_0x837072[_0x9287('0x42')]=qs['limit'](_0x20e58c['query']['limit']);_0x837072[_0x9287('0x22')]=qs['offset'](_0x20e58c[_0x9287('0x3b')][_0x9287('0x22')]);}_0x837072[_0x9287('0x43')]=qs[_0x9287('0x44')](_0x20e58c['query'][_0x9287('0x44')]);_0x837072[_0x9287('0x45')]=qs[_0x9287('0x3d')](_['pick'](_0x20e58c[_0x9287('0x3b')],_0x5bc3e0[_0x9287('0x3d')]),_0x242a10);var _0x1000e2=[];var _0x501eee=squel[_0x9287('0x46')]()[_0x9287('0x47')]('id')[_0x9287('0x47')](_0x9287('0x2c'))[_0x9287('0x47')](_0x9287('0x48'))[_0x9287('0x49')]('tools_tags');var _0x1bd8f0=squel[_0x9287('0x46')]()['field']('u.id')[_0x9287('0x47')](_0x9287('0x4a'))[_0x9287('0x47')](_0x9287('0x4b'))[_0x9287('0x49')]('user_has_openchannel_interactions','ui')[_0x9287('0x4c')]('users','u',_0x9287('0x4d'));var _0xe1e906=squel[_0x9287('0x46')]()[_0x9287('0x49')](_0x9287('0x4e'),'i')[_0x9287('0x4c')]('cm_contacts','c',_0x9287('0x4f'))[_0x9287('0x4c')](_0x9287('0x50'),'o','o.id\x20=\x20i.UserId')[_0x9287('0x4c')]('openchannel_accounts','a',_0x9287('0x51'))[_0x9287('0x4c')](_0x9287('0x52'),'me',_0x9287('0x53'))[_0x9287('0x4c')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x9287('0x4c')]('tools_tags','t',_0x9287('0x54'));var _0x10c59a=squel[_0x9287('0x55')]();var _0x3d4c78=[];var _0x3dd4c8=squel[_0x9287('0x55')]();var _0x11660f;if(_0x20e58c[_0x9287('0x3b')][_0x9287('0x56')]){_0x11660f=as[_0x9287('0x57')](_0x20e58c[_0x9287('0x3b')]['search']);var _0x36d74e=_0x11660f[_0x9287('0x58')];for(var _0xf6926b=0x0;_0xf6926b<_0x11660f[_0x9287('0x59')][_0x9287('0x5a')];_0xf6926b++){var _0x42730e=_0x11660f['conditions'][_0xf6926b];var _0x3572fa='i';var _0x230b61=_[_0x9287('0x5b')](_0x242a10,[_0x9287('0x2c'),_0x42730e[_0x9287('0x47')]]);if(!_0x230b61){switch(_0x42730e[_0x9287('0x47')]){case'unreadMessages':if(_0x42730e[_0x9287('0x5c')]==0x1){_0xe1e906[_0x9287('0x5d')]('`'+_0x42730e[_0x9287('0x47')]+'`\x20=\x200');}else{_0xe1e906[_0x9287('0x5d')]('`'+_0x42730e[_0x9287('0x47')]+_0x9287('0x5e'));}break;case _0x9287('0x5f'):if(_0x42730e[_0x9287('0x60')]==='$substring'){if(_0x42730e[_0x9287('0x5c')][_0x9287('0x61')]('\x20')[_0x9287('0x5a')]>0x1){_0x10c59a[_0x36d74e](_0x9287('0x62'),qs['getFullTextValue'](_0x42730e['value']),null);}else{var _0x17bd01='%'+_0x42730e[_0x9287('0x5c')]+'%';_0x10c59a[_0x36d74e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x17bd01,_0x17bd01,_0x17bd01);}}else{_0x230b61=_[_0x9287('0x5b')](_0x242a10,[_0x9287('0x2c'),'ContactId']);_0x42730e['field']=_0x9287('0x63');_0x30d4c1=as[_0x9287('0x64')](_0x3572fa,_0x230b61['type'],_0x42730e);_0x10c59a[_0x36d74e](_0x30d4c1[_0x9287('0x65')],_0x30d4c1['value'][_0x9287('0x66')],_0x30d4c1['value'][_0x9287('0x1f')]);}break;case'Tag':var _0x4d2916=_0x42730e[_0x9287('0x5c')][_0x9287('0x61')](',')[_0x9287('0x2f')](function(_0x1e300b){return Number(_0x1e300b);});_0x4d2916[_0x9287('0x33')](function(_0x34446d){_0x3dd4c8['or'](_0x9287('0x67'),'%,'+_0x34446d+',%');});_0x3d4c78=_['union'](_0x3d4c78,_0x4d2916);break;case _0x9287('0x68'):if(_0x42730e['operator']===_0x9287('0x69')){_0x10c59a[_0x36d74e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x42730e[_0x9287('0x5c')]+'%',null);}else{_0x230b61=_[_0x9287('0x5b')](_0x242a10,[_0x9287('0x2c'),_0x9287('0x6a')]);_0x42730e[_0x9287('0x47')]=_0x9287('0x6a');_0x30d4c1=as['buildExpression'](_0x3572fa,_0x230b61['type'],_0x42730e);_0x10c59a[_0x36d74e](_0x30d4c1[_0x9287('0x65')],_0x30d4c1[_0x9287('0x5c')][_0x9287('0x66')],_0x30d4c1[_0x9287('0x5c')][_0x9287('0x1f')]);}break;case'body':_0x30d4c1=as[_0x9287('0x64')]('me',null,_0x42730e);_0x10c59a[_0x36d74e](_0x30d4c1[_0x9287('0x65')],_0x30d4c1['value'][_0x9287('0x66')],_0x30d4c1[_0x9287('0x5c')]['end']);break;}}else{var _0x30d4c1=as['buildExpression'](_0x3572fa,_0x230b61['type'],_0x42730e);_0x10c59a[_0x36d74e](_0x30d4c1[_0x9287('0x65')],_0x30d4c1[_0x9287('0x5c')][_0x9287('0x66')],_0x30d4c1[_0x9287('0x5c')][_0x9287('0x1f')]);}}}else{var _0x69fd57=_(_0x20e58c[_0x9287('0x3b')])['keys']()[_0x9287('0x2f')](function(_0x927a99){return _[_0x9287('0x6b')](_0x242a10,[_0x9287('0x2c'),_0x927a99])?_0x927a99:undefined;})['compact']()[_0x9287('0x5c')]();if(!_[_0x9287('0x6c')](_0x69fd57)){_0x69fd57[_0x9287('0x33')](function(_0x509008){if(_0x509008==='OpenchannelAccountId'){_0xe1e906[_0x9287('0x45')](_0x9287('0x6d'),[]['concat'](_0x20e58c[_0x9287('0x3b')][_0x509008]));}else if(_0x509008===_0x9287('0x6e')){var _0xddab7f=JSON[_0x9287('0x6f')](_0x20e58c[_0x9287('0x3b')][_0x509008])[_0x9287('0x70')];var _0x37f0f8=JSON['parse'](_0x20e58c[_0x9287('0x3b')][_0x509008])[_0x9287('0x71')];_0xe1e906[_0x9287('0x45')](_0x9287('0x72'),_0xddab7f,_0x37f0f8);}else{if(_0x20e58c[_0x9287('0x3b')][_0x509008]===_0x9287('0x73')){_0xe1e906[_0x9287('0x45')]('i.'+_0x509008+'\x20IS\x20NULL');}else{_0xe1e906[_0x9287('0x45')]('i.'+_0x509008+_0x9287('0x74'),_0x20e58c[_0x9287('0x3b')][_0x509008]);}}});}if(_0x20e58c[_0x9287('0x3b')][_0x9287('0x75')]){if(_0x20e58c[_0x9287('0x3b')][_0x9287('0x75')]==0x1){_0xe1e906[_0x9287('0x5d')](_0x9287('0x76'));}else{_0xe1e906[_0x9287('0x5d')](_0x9287('0x77'));}}if(_0x20e58c['query'][_0x9287('0x78')]){_0x3d4c78=_[_0x9287('0x79')](_0x20e58c[_0x9287('0x3b')]['tag'])?_0x20e58c[_0x9287('0x3b')][_0x9287('0x78')]:new Array(_0x20e58c[_0x9287('0x3b')][_0x9287('0x78')]);_0x3d4c78['forEach'](function(_0xd354c2){_0x3dd4c8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd354c2+',%');});}if(_0x20e58c[_0x9287('0x3b')][_0x9287('0x7a')]){var _0x1bab54=_0x20e58c[_0x9287('0x3b')][_0x9287('0x7a')][_0x9287('0x7b')]('\x5c','\x5c\x5c')[_0x9287('0x7b')](/'/g,'\x27\x27');if(qs[_0x9287('0x7c')](_0x1bab54)){_0x10c59a['or']('i.id\x20LIKE\x20?',_0x1bab54+'%');}else{_0x10c59a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9287('0x7d')](_0x1bab54))['or']('i.from\x20LIKE\x20?',_0x1bab54+'%')['or'](_0x9287('0x7e'),_0x1bab54+'%');}}}_0xe1e906[_0x9287('0x45')](_0x10c59a);_0xe1e906[_0x9287('0x7f')](_0x9287('0x80'));var _0xdbff62={'type':db['Sequelize']['QueryTypes'][_0x9287('0x81')],'raw':!![]};var _0x71110f=_0xe1e906[_0x9287('0x82')]();_0x71110f[_0x9287('0x47')]('i.id');_0x71110f[_0x9287('0x47')](_0x9287('0x83'),'unreadMessages');if(_0x837072['order']){_0x837072['order'][_0x9287('0x33')](function(_0x44dec9){var _0x363ab3=_0x44dec9[0x0]===_0x9287('0x84')?_0x44dec9[0x0]:'i.'+_0x44dec9[0x0];_0xe1e906[_0x9287('0x43')](_0x363ab3,_0x44dec9[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9287('0x6c')](_0x3d4c78)){_0xe1e906[_0x9287('0x5d')](_0x3dd4c8);_0x71110f[_0x9287('0x45')](_0x9287('0x85'),_0x3d4c78);}BPromise[_0x9287('0x86')]()[_0x9287('0x28')](function(){if(!_0x11660f){if(_0x20e58c[_0x9287('0x3b')][_0x9287('0x87')]||_0x20e58c[_0x9287('0x3b')][_0x9287('0x88')])return;_0x71110f[_0x9287('0x45')](_0x9287('0x89'));_0xe1e906['where'](_0x9287('0x89'));return;}if(_0x20e58c[_0x9287('0x8a')]['role']!==_0x9287('0x8b'))return;return _0x20e58c[_0x9287('0x8a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4fe025){if(_[_0x9287('0x6c')](_0x4fe025)){_0x71110f[_0x9287('0x45')](_0x9287('0x8c'));_0xe1e906['where'](_0x9287('0x8c'));}else{_0x71110f[_0x9287('0x45')](_0x9287('0x6d'),_['map'](_0x4fe025,'id'));_0xe1e906[_0x9287('0x45')](_0x9287('0x6d'),_[_0x9287('0x2f')](_0x4fe025,'id'));}});})[_0x9287('0x28')](function(){if(_0x20e58c[_0x9287('0x8a')][_0x9287('0x8d')]===_0x9287('0x8b')&&!_0x11660f&&!_0x20e58c['query'][_0x9287('0x87')])return[];return db[_0x9287('0x8e')][_0x9287('0x3b')](_0x71110f[_0x9287('0x8f')](),_0xdbff62);})[_0x9287('0x28')](function(_0xfebf74){_0x66ded['count']=_0xfebf74[_0x9287('0x5a')];if(_0x66ded['count']===0x0)return[];return db[_0x9287('0x8e')][_0x9287('0x3b')](_0x501eee[_0x9287('0x8f')](),_0xdbff62)[_0x9287('0x28')](function(_0x1cfa3b){_0x1000e2=_['keyBy'](_0x1cfa3b,'id');_0xdbff62=_[_0x9287('0x90')](_0xdbff62,{'model':db[_0x9287('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20e58c[_0x9287('0x3b')][_0x9287('0x40')]){_0x837072['attributes'][_0x9287('0x33')](function(_0x27f38b){_0xe1e906[_0x9287('0x47')]('i.'+_0x27f38b);});}else{_0xe1e906['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9287('0x91'));_0xe1e906['field'](_0x9287('0x92'),'Account.key');_0xe1e906[_0x9287('0x47')]('a.mandatoryDisposition',_0x9287('0x93'));_0xe1e906['field'](_0x9287('0x94'),_0x9287('0x84'));_0xe1e906[_0x9287('0x47')](_0x9287('0x95'));_0xe1e906[_0x9287('0x47')]('c.firstName',_0x9287('0x96'));_0xe1e906[_0x9287('0x47')]('c.lastName','Contact.lastName');_0xe1e906[_0x9287('0x47')]('c.email',_0x9287('0x97'));_0xe1e906[_0x9287('0x47')]('c.phone',_0x9287('0x98'));_0xe1e906[_0x9287('0x47')]('c.mobile',_0x9287('0x99'));_0xe1e906[_0x9287('0x47')](_0x9287('0x9a'),_0x9287('0x9b'));_0xe1e906['field'](_0x9287('0x9c'),_0x9287('0x9d'));_0xe1e906['field'](_0x9287('0x9e'),_0x9287('0x9f'));_0xe1e906['field'](_0x9287('0xa0'),_0x9287('0x31'));}if(_0x837072[_0x9287('0x42')])_0xe1e906[_0x9287('0x42')](_0x837072['limit']);if(_0x837072[_0x9287('0x22')])_0xe1e906['offset'](_0x837072[_0x9287('0x22')]);return db[_0x9287('0x8e')]['query'](_0xe1e906[_0x9287('0x8f')](),_0xdbff62);})[_0x9287('0x28')](function(_0xc6b997){_0x1bd8f0[_0x9287('0x45')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x9287('0x2f')](_0xc6b997,'id'));return db[_0x9287('0x8e')]['query'](_0x1bd8f0['toString'](),_0xdbff62)[_0x9287('0x28')](function(_0x9f39cd){var _0x1fb35a=_[_0x9287('0xa1')](_0x9f39cd,_0x9287('0xa2'));var _0x27f128=[];_0xc6b997[_0x9287('0x33')](function(_0x4249ab){_0x27f128[_0x9287('0x34')](updateOpenchannelInteraction(_0x4249ab,_0x1000e2,_0x1fb35a));});return BPromise['all'](_0x27f128);});});})[_0x9287('0x28')](function(_0x4451be){_0x66ded[_0x9287('0xa3')]=_0x4451be;return _0x66ded;})[_0x9287('0x28')](respondWithFilteredResult(_0x405d0b,_0x837072))[_0x9287('0xa4')](handleError(_0x405d0b,null));};exports['show']=function(_0x1ccc49,_0x33627f){var _0x9a07a3={};if(_0x1ccc49[_0x9287('0x3b')][_0x9287('0xa5')]&&_0x1ccc49[_0x9287('0x3b')]['type']==='from'){_0x9a07a3[_0x9287('0x49')]=_0x1ccc49[_0x9287('0xa6')]['id'];}else{_0x9a07a3['id']=_0x1ccc49[_0x9287('0xa6')]['id'];}var _0x5c1f7b={'raw':![],'where':_0x9a07a3},_0x321739={};_0x321739[_0x9287('0x3a')]=_[_0x9287('0x3c')](db[_0x9287('0x36')][_0x9287('0x37')]);_0x321739[_0x9287('0x3b')]=_[_0x9287('0x3c')](_0x1ccc49[_0x9287('0x3b')]);_0x321739[_0x9287('0x3d')]=_[_0x9287('0x3f')](_0x321739['model'],_0x321739[_0x9287('0x3b')]);_0x5c1f7b[_0x9287('0x3e')]=_[_0x9287('0x3f')](_0x321739[_0x9287('0x3a')],qs[_0x9287('0x40')](_0x1ccc49[_0x9287('0x3b')][_0x9287('0x40')]));_0x5c1f7b[_0x9287('0x3e')]=_0x5c1f7b['attributes'][_0x9287('0x5a')]?_0x5c1f7b[_0x9287('0x3e')]:_0x321739[_0x9287('0x3a')];if(_0x1ccc49[_0x9287('0x3b')]['includeAll']){_0x5c1f7b[_0x9287('0xa7')]=[{'all':!![]}];}_0x5c1f7b=_['merge']({},_0x5c1f7b,_0x1ccc49['options']);return db[_0x9287('0x36')][_0x9287('0x5b')](_0x5c1f7b)[_0x9287('0x28')](handleEntityNotFound(_0x33627f,null))[_0x9287('0x28')](respondWithResult(_0x33627f,null))[_0x9287('0xa4')](handleError(_0x33627f,null));};exports[_0x9287('0xa8')]=function(_0x49bb80,_0x5a6b87){return db[_0x9287('0x36')]['create'](_0x49bb80['body'],{})[_0x9287('0x28')](respondWithResult(_0x5a6b87,0xc9))['catch'](handleError(_0x5a6b87,null));};exports[_0x9287('0x27')]=function(_0x2c3a65,_0x2e7010){if(_0x2c3a65[_0x9287('0xa9')]['id']){delete _0x2c3a65[_0x9287('0xa9')]['id'];}return db[_0x9287('0x36')][_0x9287('0x5b')]({'where':{'id':_0x2c3a65['params']['id']}})[_0x9287('0x28')](handleEntityNotFound(_0x2e7010,null))[_0x9287('0x28')](saveUpdates(_0x2c3a65['body'],null))[_0x9287('0x28')](respondWithResult(_0x2e7010,null))[_0x9287('0xa4')](handleError(_0x2e7010,null));};exports[_0x9287('0x29')]=function(_0x6e23b,_0x142567){return db[_0x9287('0x36')][_0x9287('0x5b')]({'where':{'id':_0x6e23b['params']['id']}})[_0x9287('0x28')](handleEntityNotFound(_0x142567,null))[_0x9287('0x28')](removeEntity(_0x142567,null))[_0x9287('0xa4')](handleError(_0x142567,null));};exports[_0x9287('0xaa')]=function(_0x512444,_0x4dc5ec){return db[_0x9287('0x36')][_0x9287('0xaa')]()[_0x9287('0x28')](respondWithResult(_0x4dc5ec,null))[_0x9287('0xa4')](handleError(_0x4dc5ec,null));};exports[_0x9287('0xab')]=function(_0x145f1d,_0x1fb1de,_0x3a6c7b){return db['OpenchannelMessage'][_0x9287('0x5b')]({'where':{'id':_0x145f1d[_0x9287('0xa6')]['id']}})[_0x9287('0x28')](handleEntityNotFound(_0x1fb1de,null))[_0x9287('0x28')](function(_0x3e58ec){if(_0x3e58ec){return _0x3e58ec['addMessage'](_0x145f1d['body']['ids'],_[_0x9287('0xac')](_0x145f1d[_0x9287('0xa9')],['ids','id'])||{});}})[_0x9287('0x28')](respondWithResult(_0x1fb1de,null))[_0x9287('0xa4')](handleError(_0x1fb1de,null));};exports['getMessages']=function(_0x4b321f,_0x5e70ce,_0xc0febc){var _0x520e5a={'raw':![],'where':{}};var _0x17a74b={};var _0x462c2f={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x9287('0xad')]({'where':{'id':_0x4b321f[_0x9287('0xa6')]['id']}})[_0x9287('0x28')](handleEntityNotFound(_0x5e70ce,null))[_0x9287('0x28')](function(_0x189ab8){if(_0x189ab8){_0x17a74b[_0x9287('0x3a')]=_[_0x9287('0x3c')](db[_0x9287('0xae')][_0x9287('0x37')]);_0x17a74b['query']=_[_0x9287('0x3c')](_0x4b321f[_0x9287('0x3b')]);_0x17a74b[_0x9287('0x3d')]=_[_0x9287('0x3f')](_0x17a74b['model'],_0x17a74b[_0x9287('0x3b')]);_0x520e5a[_0x9287('0x3e')]=_[_0x9287('0x3f')](_0x17a74b[_0x9287('0x3a')],qs[_0x9287('0x40')](_0x4b321f[_0x9287('0x3b')][_0x9287('0x40')]));_0x520e5a[_0x9287('0x3e')]=_0x520e5a['attributes']['length']?_0x520e5a[_0x9287('0x3e')]:_0x17a74b[_0x9287('0x3a')];if(!_0x4b321f[_0x9287('0x3b')][_0x9287('0x41')](_0x9287('0xaf'))){_0x520e5a[_0x9287('0x42')]=qs['limit'](_0x4b321f[_0x9287('0x3b')]['limit']);_0x520e5a['offset']=qs[_0x9287('0x22')](_0x4b321f[_0x9287('0x3b')][_0x9287('0x22')]);}_0x520e5a[_0x9287('0x43')]=qs[_0x9287('0x44')](_0x4b321f[_0x9287('0x3b')][_0x9287('0x44')]);_0x520e5a[_0x9287('0x45')]=qs[_0x9287('0x3d')](_[_0x9287('0xb0')](_0x4b321f[_0x9287('0x3b')],_0x17a74b[_0x9287('0x3d')]));_0x520e5a['where'][_0x9287('0xa2')]=_0x189ab8['id'];if(_0x4b321f[_0x9287('0x3b')]['filter']){_0x520e5a[_0x9287('0x45')]=_['merge'](_0x520e5a[_0x9287('0x45')],{'$or':_['map'](_0x520e5a['attributes'],function(_0x5c5db7){var _0x1b7232={};_0x1b7232[_0x5c5db7]={'$like':'%'+_0x4b321f['query'][_0x9287('0x7a')]+'%'};return _0x1b7232;})});}if(_0x4b321f[_0x9287('0x3b')][_0x9287('0x70')]){var _0x3cac4a=_0x4b321f['query'][_0x9287('0x70')]['split'](',');var _0x15e181={};_0x15e181[_0x3cac4a[0x0]]={'$gte':moment(_0x3cac4a[0x1])[_0x9287('0xb1')](_0x9287('0xb2'))};_0x520e5a[_0x9287('0x45')]=_[_0x9287('0x90')](_0x520e5a[_0x9287('0x45')],_0x15e181);}_0x520e5a=_[_0x9287('0x90')]({},_0x520e5a,_0x4b321f['options']);return db[_0x9287('0xae')][_0x9287('0x21')]({'where':_0x520e5a[_0x9287('0x45')]})[_0x9287('0x28')](function(_0x5db623){_0x462c2f['count']=_0x5db623;if(_0x4b321f[_0x9287('0x3b')][_0x9287('0xb3')]){_0x520e5a[_0x9287('0xa7')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x9287('0xb4')](_0x520e5a);})[_0x9287('0x28')](function(_0x4bafb3){_0x462c2f[_0x9287('0xa3')]=_0x4bafb3;return _0x462c2f;});}})[_0x9287('0x28')](respondWithFilteredResult(_0x5e70ce,_0x520e5a))[_0x9287('0xa4')](handleError(_0x5e70ce,null));};exports[_0x9287('0xb5')]=function(_0x1cb2d4,_0x1cdbcb,_0x178d0e){return db[_0x9287('0x36')][_0x9287('0x5b')]({'where':{'id':_0x1cb2d4[_0x9287('0xa6')]['id']}})[_0x9287('0x28')](handleEntityNotFound(_0x1cdbcb,null))['then'](function(_0x18d949){if(_0x18d949){return _0x18d949[_0x9287('0xb6')](_0x1cb2d4['body'][_0x9287('0xb7')],_[_0x9287('0xac')](_0x1cb2d4[_0x9287('0xa9')],[_0x9287('0xb7'),'id'])||{})[_0x9287('0xb8')](function(){return db[_0x9287('0xb9')][_0x9287('0xb4')]({'attributes':['id',_0x9287('0x2c'),_0x9287('0x48')],'where':{'id':_0x1cb2d4[_0x9287('0xa9')][_0x9287('0xb7')]}});})[_0x9287('0x28')](function(_0x28ea64){socket[_0x9287('0xba')](_0x9287('0xbb'),{'id':Number(_0x1cb2d4[_0x9287('0xa6')]['id']),'tags':_0x28ea64||[]});return{'id':Number(_0x1cb2d4[_0x9287('0xa6')]['id']),'tags':_0x28ea64||[]};});}})[_0x9287('0x28')](respondWithResult(_0x1cdbcb,null))[_0x9287('0xa4')](handleError(_0x1cdbcb,null));};exports[_0x9287('0xbc')]=function(_0x1c047d,_0x37713b,_0x1635bf){return db['OpenchannelInteraction'][_0x9287('0x5b')]({'where':{'id':_0x1c047d[_0x9287('0xa6')]['id']}})[_0x9287('0x28')](handleEntityNotFound(_0x37713b,null))['then'](function(_0x15a223){if(_0x15a223){return _0x15a223[_0x9287('0xbc')](_0x1c047d[_0x9287('0x3b')][_0x9287('0xb7')]);}})[_0x9287('0x28')](respondWithStatusCode(_0x37713b,null))[_0x9287('0xa4')](handleError(_0x37713b,null));};exports[_0x9287('0xbd')]=function(_0x5ba03e,_0x148852){var _0x45c661=moment()[_0x9287('0xbe')]()['toString']();var _0x384db5=path[_0x9287('0xbf')](config[_0x9287('0xc0')],_0x9287('0xc1'),_0x9287('0xc2'),_0x9287('0xc3'));var _0x497e72=path['join'](config[_0x9287('0xc0')],_0x9287('0xc1'),_0x9287('0xc2'),_0x9287('0xc4'));var _0x27d2cf=path[_0x9287('0xbf')](_0x384db5,_0x45c661);var _0x353722=util[_0x9287('0xb1')](_0x9287('0xc5'),_0x5ba03e[_0x9287('0xa6')]['id'],_0x45c661);var _0x377dd2=path[_0x9287('0xbf')](_0x384db5,_0x353722);var _0x4bccea=[];_0x4bccea[_0x9287('0x34')]({'model':db[_0x9287('0x68')],'as':_0x9287('0x68'),'attributes':['id',_0x9287('0x30')],'raw':!![]});_0x4bccea[_0x9287('0x34')]({'model':db[_0x9287('0xc6')],'as':'Contact','attributes':['id',_0x9287('0xc7'),_0x9287('0xc8')],'raw':!![]});if(_0x5ba03e[_0x9287('0x3b')]['attachments']){_0x4bccea[_0x9287('0x34')]({'model':db[_0x9287('0xc9')],'as':_0x9287('0xc9'),'raw':!![]});}var _0x2490c8=[{'model':db[_0x9287('0xae')],'as':'Messages','attributes':['id',_0x9287('0xa9'),'createdAt',_0x9287('0xca'),_0x9287('0xcb'),_0x9287('0x75')],'include':_0x4bccea}];_0x2490c8['push']({'model':db[_0x9287('0xcc')],'as':_0x9287('0xcd'),'attributes':['id',_0x9287('0x2c')]});_0x2490c8[_0x9287('0x34')]({'model':db[_0x9287('0x68')],'as':'Owner','attributes':['id',_0x9287('0x30')]});return db[_0x9287('0x36')][_0x9287('0x5b')]({'where':{'id':_0x5ba03e[_0x9287('0xa6')]['id']},'include':_0x2490c8})[_0x9287('0x28')](handleEntityNotFound(_0x148852,null))[_0x9287('0x28')](function(_0x3b690f){if(_0x3b690f){var _0x6a9e5f=_0x3b690f[_0x9287('0xce')]({'plain':!![]});fs[_0x9287('0xcf')](_0x27d2cf);var _0x6abab3={'format':'A4','border':'10px','header':{'height':_0x9287('0xd0'),'contents':{'first':_0x9287('0xd1')}},'footer':{'height':'30px','contents':{'default':util[_0x9287('0xb1')](_0x9287('0xd2'),util[_0x9287('0xb1')](_0x9287('0xd3'),_0x9287('0xd4'),_0x6a9e5f['id']),moment()['format'](_0x9287('0xd5'))[_0x9287('0x8f')]())}}};var _0x3d1620={'channel':_0x9287('0xd4'),'account':_0x6a9e5f[_0x9287('0xcd')][_0x9287('0x2c')],'agent':_0x6a9e5f[_0x9287('0xd6')]?_0x6a9e5f[_0x9287('0xd6')][_0x9287('0x30')]:_0x9287('0xd7'),'createdAt':moment(_0x6a9e5f['createdAt'])[_0x9287('0xb1')](_0x9287('0xb2'))[_0x9287('0x8f')](),'closedAt':_0x6a9e5f[_0x9287('0xd8')]?moment(_0x6a9e5f[_0x9287('0xd9')])[_0x9287('0xb1')](_0x9287('0xb2'))[_0x9287('0x8f')]():'','disposition':_0x6a9e5f[_0x9287('0xda')],'visibility':_0x6a9e5f[_0x9287('0xdb')]?_0x9287('0xdc'):'Private','messages':_(_0x6a9e5f[_0x9287('0xdd')])[_0x9287('0x7a')]({'secret':![]})[_0x9287('0x2f')](function(_0x4c5930){if(_0x4c5930[_0x9287('0xc9')]){var _0x146e7b=path[_0x9287('0xbf')](_0x497e72,_0x4c5930[_0x9287('0xc9')][_0x9287('0xde')]);if(fs['existsSync'](_0x146e7b)){fs[_0x9287('0xdf')](_0x146e7b)['pipe'](fs[_0x9287('0xe0')](path[_0x9287('0xbf')](_0x27d2cf,_0x4c5930[_0x9287('0xc9')][_0x9287('0xde')])));}}return{'date':moment(_0x4c5930['createdAt'])[_0x9287('0xb1')](_0x9287('0xb2'))[_0x9287('0x8f')](),'sender':_0x4c5930[_0x9287('0xca')]===_0x9287('0xe1')?_0x4c5930[_0x9287('0x68')]?_0x4c5930[_0x9287('0x68')][_0x9287('0x30')]:_0x9287('0xe2'):_0x4c5930[_0x9287('0x5f')]['firstName']+(_0x4c5930['Contact']['lastName']?'\x20'+_0x4c5930[_0x9287('0x5f')]['lastName']:''),'body':_0x4c5930[_0x9287('0xc9')]?_0x4c5930[_0x9287('0xc9')][_0x9287('0xde')]:_0x4c5930[_0x9287('0xa9')],'direction':_0x4c5930['direction']===_0x9287('0xe1')?'A':'C','secret':_0x4c5930['secret'],'read':_0x4c5930[_0x9287('0x75')],'attachment':_0x4c5930[_0x9287('0xc9')]};})['value']()};return ejs[_0x9287('0xe3')](path[_0x9287('0xbf')](config[_0x9287('0xc0')],_0x9287('0xc1'),'views',_0x9287('0xe4')),{'interaction':_0x3d1620})[_0x9287('0x28')](function(_0x4e8025){return new BPromise(function(_0x27606d,_0x4a3055){pdf['create'](_0x4e8025,_0x6abab3)[_0x9287('0xe5')](path[_0x9287('0xbf')](_0x27d2cf,'transcript-'+_0x6a9e5f['id']+'-'+_0x45c661+_0x9287('0xe6')),function(_0x4913d8,_0x3e576b){if(_0x4913d8)return _0x4a3055(_0x4913d8);_0x27606d(_0x3e576b);});});})[_0x9287('0x28')](function(){return new BPromise(function(_0x25edf0,_0xc7fda6){zipdir(_0x27d2cf,{'saveTo':_0x377dd2},function(_0x4569f8,_0x443720){if(_0x4569f8)return _0xc7fda6(_0x4569f8);return _0x25edf0(_0x443720);});})['then'](function(){return new BPromise(function(_0x35fba3,_0x42eebc){rimraf(_0x27d2cf,function(_0x256097){if(_0x256097)_0x42eebc(_0x256097);return _0x35fba3();});});})[_0x9287('0x28')](function(){return _0x148852[_0x9287('0xbd')](_0x377dd2,_0x353722,function(_0x2b2dc4){if(_0x2b2dc4){console[_0x9287('0xe7')]('err',_0x2b2dc4);}else{fs[_0x9287('0xe8')](_0x377dd2);}});});});}else{return _0x148852[_0x9287('0x1d')](0xc8);}})[_0x9287('0xa4')](handleError(_0x148852,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c529a3c..ea8cc48 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 _0xb524=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','then','setDataValue','Users','findAll','unreadMessages','emit'];(function(_0x3a908d,_0x6de1b8){var _0x421006=function(_0x5b219f){while(--_0x5b219f){_0x3a908d['push'](_0x3a908d['shift']());}};_0x421006(++_0x6de1b8);}(_0xb524,0x16b));var _0x4b52=function(_0x2f1b66,_0x419fbc){_0x2f1b66=_0x2f1b66-0x0;var _0x1f5d71=_0xb524[_0x2f1b66];return _0x1f5d71;};'use strict';var EventEmitter=require(_0x4b52('0x0'));var OpenchannelInteraction=require(_0x4b52('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x4b52('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4b52('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c1581){return function(_0x41ca8e,_0x43e33f,_0x342d59){_0x41ca8e['getUsers']({'attributes':['id'],'raw':!![]})[_0x4b52('0x3')](function(_0x2396b4){_0x41ca8e[_0x4b52('0x4')](_0x4b52('0x5'),_0x2396b4['map'](function(_0x432737){return{'id':_0x432737['id']};}));return OpenchannelMessage[_0x4b52('0x6')]({'where':{'OpenchannelInteractionId':_0x41ca8e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b52('0x3')](function(_0x155cbd){_0x41ca8e['setDataValue'](_0x4b52('0x7'),_0x155cbd['length']);OpenchannelInteractionEvents[_0x4b52('0x8')](_0x3c1581+':'+_0x41ca8e['id'],_0x41ca8e);OpenchannelInteractionEvents[_0x4b52('0x8')](_0x3c1581,_0x41ca8e);_0x342d59(null);})['catch'](_0x342d59(null));};}for(var e in events){if(events[_0x4b52('0x9')](e)){var event=events[e];OpenchannelInteraction[_0x4b52('0xa')](e,emitEvent(event));}}module[_0x4b52('0xb')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9dfc=['hook','events','../../mysqldb','save','update','remove','then','setDataValue','map','length','emit','hasOwnProperty'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x9dfc,0xc1));var _0xc9df=function(_0x44bcec,_0x16f481){_0x44bcec=_0x44bcec-0x0;var _0x554b47=_0x9dfc[_0x44bcec];return _0x554b47;};'use strict';var EventEmitter=require(_0xc9df('0x0'));var OpenchannelInteraction=require(_0xc9df('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc9df('0x2'),'afterUpdate':_0xc9df('0x3'),'afterDestroy':_0xc9df('0x4')};function emitEvent(_0x35a21a){return function(_0xa65e3b,_0xb047c7,_0x242475){_0xa65e3b['getUsers']({'attributes':['id'],'raw':!![]})[_0xc9df('0x5')](function(_0x317ccc){_0xa65e3b[_0xc9df('0x6')]('Users',_0x317ccc[_0xc9df('0x7')](function(_0x5a669c){return{'id':_0x5a669c['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xa65e3b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc9df('0x5')](function(_0x1a779a){_0xa65e3b[_0xc9df('0x6')]('unreadMessages',_0x1a779a[_0xc9df('0x8')]);OpenchannelInteractionEvents[_0xc9df('0x9')](_0x35a21a+':'+_0xa65e3b['id'],_0xa65e3b);OpenchannelInteractionEvents[_0xc9df('0x9')](_0x35a21a,_0xa65e3b);_0x242475(null);})['catch'](_0x242475(null));};}for(var e in events){if(events[_0xc9df('0xa')](e)){var event=events[e];OpenchannelInteraction[_0xc9df('0xb')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c64261b..65e0aed 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 _0xaba6=['request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x30d552,_0x24e23e){var _0x439b30=function(_0x515c27){while(--_0x515c27){_0x30d552['push'](_0x30d552['shift']());}};_0x439b30(++_0x24e23e);}(_0xaba6,0xe2));var _0x6aba=function(_0x3f7982,_0x24c737){_0x3f7982=_0x3f7982-0x0;var _0x4e6a0d=_0xaba6[_0x3f7982];return _0x4e6a0d;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6aba('0x2'));var fs=require('fs');var path=require(_0x6aba('0x3'));var rimraf=require('rimraf');var config=require(_0x6aba('0x4'));var attributes=require(_0x6aba('0x5'));module['exports']=function(_0x4e929a,_0x5ae14c){return _0x4e929a[_0x6aba('0x6')]('OpenchannelInteraction',attributes,{'tableName':_0x6aba('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a4fbc,_0x508dff,_0x460fe2){if(_0x1a4fbc[_0x6aba('0x8')]('closed')){_0x1a4fbc[_0x6aba('0x9')]=moment()[_0x6aba('0xa')](_0x6aba('0xb'));}_0x460fe2(null,_0x1a4fbc);}}});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xfdbd[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x188508,_0xf72a24,_0x47c629){if(_0x188508[_0xdfdb('0xa')](_0xdfdb('0xb'))){_0x188508[_0xdfdb('0xc')]=moment()[_0xdfdb('0xd')](_0xdfdb('0xe'));}_0x47c629(null,_0x188508);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ae1e0f7..bef9508 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 _0x4825=['redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction','options','raw','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','body','ids','omit','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x5ca719,_0x315439){var _0x13a9b5=function(_0x169f40){while(--_0x169f40){_0x5ca719['push'](_0x5ca719['shift']());}};_0x13a9b5(++_0x315439);}(_0x4825,0x113));var _0x5482=function(_0xbb1c22,_0x394002){_0xbb1c22=_0xbb1c22-0x0;var _0x140343=_0x4825[_0xbb1c22];return _0x140343;};'use strict';var _=require(_0x5482('0x0'));var util=require(_0x5482('0x1'));var moment=require(_0x5482('0x2'));var BPromise=require('bluebird');var rs=require(_0x5482('0x3'));var fs=require('fs');var Redis=require(_0x5482('0x4'));var db=require(_0x5482('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5482('0x6'));var config=require(_0x5482('0x7'));var jayson=require(_0x5482('0x8'));var client=jayson[_0x5482('0x9')][_0x5482('0xa')]({'port':0x232a});config['redis']=_[_0x5482('0xb')](config[_0x5482('0xc')],{'host':_0x5482('0xd'),'port':0x18eb});var socket=require(_0x5482('0xe'))(new Redis(config[_0x5482('0xc')]));require(_0x5482('0xf'))[_0x5482('0x10')](socket);function respondWithRpcPromise(_0x21be3b,_0x22cfed,_0x5ca7e6){return new BPromise(function(_0x5acbbb,_0x50040f){return client[_0x5482('0x11')](_0x21be3b,_0x5ca7e6)[_0x5482('0x12')](function(_0x5168b4){logger[_0x5482('0x13')](_0x5482('0x14'),_0x22cfed,_0x5482('0x15'));logger[_0x5482('0x16')](_0x5482('0x17'),_0x22cfed,_0x5482('0x15'),JSON[_0x5482('0x18')](_0x5168b4));if(_0x5168b4['error']){if(_0x5168b4[_0x5482('0x19')][_0x5482('0x1a')]===0x1f4){logger['error'](_0x5482('0x14'),_0x22cfed,_0x5168b4['error'][_0x5482('0x1b')]);return _0x50040f(_0x5168b4[_0x5482('0x19')][_0x5482('0x1b')]);}logger[_0x5482('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x22cfed,_0x5168b4[_0x5482('0x19')][_0x5482('0x1b')]);return _0x5acbbb(_0x5168b4[_0x5482('0x19')]['message']);}else{logger['info'](_0x5482('0x14'),_0x22cfed,'request\x20sent');_0x5acbbb(_0x5168b4['result'][_0x5482('0x1b')]);}})['catch'](function(_0x28a499){logger[_0x5482('0x19')](_0x5482('0x14'),_0x22cfed,_0x28a499);_0x50040f(_0x28a499);});});}exports['UpdateOpenchannelInteraction']=function(_0x597b49){var _0x25bcc3=this;return new Promise(function(_0x506d98,_0x275ba6){return db[_0x5482('0x1c')]['update'](_0x597b49['body'],{'raw':_0x597b49[_0x5482('0x1d')]?_0x597b49['options'][_0x5482('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597b49['options']?_0x597b49[_0x5482('0x1d')][_0x5482('0x1f')]||null:null,'attributes':_0x597b49['options']?_0x597b49['options']['attributes']||null:null,'limit':_0x597b49['options']?_0x597b49['options'][_0x5482('0x20')]||null:null})[_0x5482('0x12')](function(_0x258abe){logger[_0x5482('0x13')](_0x5482('0x21'),_0x597b49);logger[_0x5482('0x16')](_0x5482('0x21'),_0x597b49,JSON[_0x5482('0x18')](_0x258abe));_0x506d98(_0x258abe);})['catch'](function(_0x35239b){logger['error'](_0x5482('0x21'),_0x35239b[_0x5482('0x1b')],_0x597b49);_0x275ba6(_0x25bcc3[_0x5482('0x19')](0x1f4,_0x35239b['message']));});});};exports[_0x5482('0x22')]=function(_0xb3d836){return new Promise(function(_0x5e7a46,_0x269d1e){return db[_0x5482('0x1c')]['find']({'where':_0xb3d836[_0x5482('0x1d')]?_0xb3d836[_0x5482('0x1d')][_0x5482('0x1f')]||null:null})['then'](function(_0x5325f1){if(_0x5325f1){return _0x5325f1[_0x5482('0x23')](_0xb3d836[_0x5482('0x24')][_0x5482('0x25')],_[_0x5482('0x26')](_0xb3d836['body'],[_0x5482('0x25'),'id'])||{});}})['spread'](function(_0x7c0cf3){logger['info'](_0x5482('0x27'),_0xb3d836);logger['debug'](_0x5482('0x27'),_0xb3d836,JSON['stringify'](_0x7c0cf3));_0x5e7a46(_0x7c0cf3);})[_0x5482('0x28')](function(_0x54f50f){logger['error']('AddTags',_0x54f50f[_0x5482('0x1b')],_0xb3d836);_0x269d1e(_this[_0x5482('0x19')](0x1f4,_0x54f50f[_0x5482('0x1b')]));});});}; \ No newline at end of file +var _0x28a1=['register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28a1,0xeb));var _0x128a=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x28a1[_0x5a5395];return _0x4da43d;};'use strict';var _=require(_0x128a('0x0'));var util=require(_0x128a('0x1'));var moment=require(_0x128a('0x2'));var BPromise=require(_0x128a('0x3'));var rs=require(_0x128a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x128a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x128a('0x6'))(_0x128a('0x7'));var config=require(_0x128a('0x8'));var jayson=require(_0x128a('0x9'));var client=jayson[_0x128a('0xa')][_0x128a('0xb')]({'port':0x232a});config['redis']=_[_0x128a('0xc')](config[_0x128a('0xd')],{'host':_0x128a('0xe'),'port':0x18eb});var socket=require(_0x128a('0xf'))(new Redis(config[_0x128a('0xd')]));require(_0x128a('0x10'))[_0x128a('0x11')](socket);function respondWithRpcPromise(_0x121b70,_0x30e462,_0x23daf2){return new BPromise(function(_0x548bae,_0x239635){return client[_0x128a('0x12')](_0x121b70,_0x23daf2)[_0x128a('0x13')](function(_0x1d5651){logger[_0x128a('0x14')](_0x128a('0x15'),_0x30e462,_0x128a('0x16'));logger['debug'](_0x128a('0x17'),_0x30e462,_0x128a('0x16'),JSON[_0x128a('0x18')](_0x1d5651));if(_0x1d5651[_0x128a('0x19')]){if(_0x1d5651[_0x128a('0x19')]['code']===0x1f4){logger[_0x128a('0x19')](_0x128a('0x15'),_0x30e462,_0x1d5651[_0x128a('0x19')][_0x128a('0x1a')]);return _0x239635(_0x1d5651[_0x128a('0x19')][_0x128a('0x1a')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x30e462,_0x1d5651[_0x128a('0x19')][_0x128a('0x1a')]);return _0x548bae(_0x1d5651['error'][_0x128a('0x1a')]);}else{logger[_0x128a('0x14')](_0x128a('0x15'),_0x30e462,_0x128a('0x16'));_0x548bae(_0x1d5651['result'][_0x128a('0x1a')]);}})['catch'](function(_0x13d78e){logger[_0x128a('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x30e462,_0x13d78e);_0x239635(_0x13d78e);});});}exports[_0x128a('0x1b')]=function(_0x17f585){var _0x5f4250=this;return new Promise(function(_0x22d1eb,_0xb2d968){return db[_0x128a('0x1c')][_0x128a('0x1d')](_0x17f585[_0x128a('0x1e')],{'raw':_0x17f585[_0x128a('0x1f')]?_0x17f585[_0x128a('0x1f')][_0x128a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f585[_0x128a('0x1f')]?_0x17f585[_0x128a('0x1f')]['where']||null:null,'attributes':_0x17f585[_0x128a('0x1f')]?_0x17f585[_0x128a('0x1f')]['attributes']||null:null,'limit':_0x17f585[_0x128a('0x1f')]?_0x17f585[_0x128a('0x1f')][_0x128a('0x21')]||null:null})[_0x128a('0x13')](function(_0x3f733d){logger['info'](_0x128a('0x1b'),_0x17f585);logger[_0x128a('0x22')](_0x128a('0x1b'),_0x17f585,JSON[_0x128a('0x18')](_0x3f733d));_0x22d1eb(_0x3f733d);})['catch'](function(_0x5763cb){logger['error'](_0x128a('0x1b'),_0x5763cb[_0x128a('0x1a')],_0x17f585);_0xb2d968(_0x5f4250[_0x128a('0x19')](0x1f4,_0x5763cb[_0x128a('0x1a')]));});});};exports[_0x128a('0x23')]=function(_0x4f94aa){return new Promise(function(_0x546ba5,_0x2db38d){return db['OpenchannelInteraction'][_0x128a('0x24')]({'where':_0x4f94aa[_0x128a('0x1f')]?_0x4f94aa['options']['where']||null:null})[_0x128a('0x13')](function(_0x8f2360){if(_0x8f2360){return _0x8f2360[_0x128a('0x25')](_0x4f94aa['body'][_0x128a('0x26')],_[_0x128a('0x27')](_0x4f94aa[_0x128a('0x1e')],[_0x128a('0x26'),'id'])||{});}})['spread'](function(_0x484ecd){logger['info'](_0x128a('0x28'),_0x4f94aa);logger[_0x128a('0x22')](_0x128a('0x28'),_0x4f94aa,JSON['stringify'](_0x484ecd));_0x546ba5(_0x484ecd);})[_0x128a('0x29')](function(_0x55b7bb){logger['error']('AddTags',_0x55b7bb[_0x128a('0x1a')],_0x4f94aa);_0x2db38d(_this[_0x128a('0x19')](0x1f4,_0x55b7bb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e9ae476..82c72f5 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 _0xfec1=['removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x1f2f49,_0x197e14){var _0x1e3e65=function(_0x44272d){while(--_0x44272d){_0x1f2f49['push'](_0x1f2f49['shift']());}};_0x1e3e65(++_0x197e14);}(_0xfec1,0x13b));var _0x1fec=function(_0x1f9559,_0x27ad92){_0x1f9559=_0x1f9559-0x0;var _0x1715fe=_0xfec1[_0x1f9559];return _0x1715fe;};'use strict';var OpenchannelInteractionEvents=require(_0x1fec('0x0'));var events=[_0x1fec('0x1'),_0x1fec('0x2'),_0x1fec('0x3')];function createListener(_0x4b01e3,_0x3bbea2){return function(_0x43d2bd){_0x3bbea2[_0x1fec('0x4')](_0x4b01e3,_0x43d2bd);};}function removeListener(_0x2bdc97,_0x48a140){return function(){OpenchannelInteractionEvents[_0x1fec('0x5')](_0x2bdc97,_0x48a140);};}exports['register']=function(_0x3b2349){for(var _0x200307=0x0,_0x51c2ea=events[_0x1fec('0x6')];_0x200307<_0x51c2ea;_0x200307++){var _0x26c841=events[_0x200307];var _0x265bb3=createListener(_0x1fec('0x7')+_0x26c841,_0x3b2349);OpenchannelInteractionEvents['on'](_0x26c841,_0x265bb3);}}; \ No newline at end of file +var _0xd3c0=['remove','update','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x25da6a,_0xd844e7){var _0x27bee7=function(_0x414645){while(--_0x414645){_0x25da6a['push'](_0x25da6a['shift']());}};_0x27bee7(++_0xd844e7);}(_0xd3c0,0x77));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0x0d3c('0x0'));var events=['save',_0x0d3c('0x1'),_0x0d3c('0x2')];function createListener(_0x5bd0bb,_0x5d55f7){return function(_0x50670f){_0x5d55f7['emit'](_0x5bd0bb,_0x50670f);};}function removeListener(_0x44a273,_0x18afba){return function(){OpenchannelInteractionEvents['removeListener'](_0x44a273,_0x18afba);};}exports[_0x0d3c('0x3')]=function(_0xc95520){for(var _0x58e8fb=0x0,_0x5096cd=events[_0x0d3c('0x4')];_0x58e8fb<_0x5096cd;_0x58e8fb++){var _0x20a450=events[_0x58e8fb];var _0x131960=createListener(_0x0d3c('0x5')+_0x20a450,_0xc95520);OpenchannelInteractionEvents['on'](_0x20a450,_0x131960);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1be7655..9906fe4 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 _0x2cf4=['util','connect-timeout','express','Router','../../components/auth/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','/:id/accept','put','/:id/reject','delete','destroy','multer'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x2cf4,0x77));var _0x42cf=function(_0x53a7af,_0x1408a5){_0x53a7af=_0x53a7af-0x0;var _0x3cc7f6=_0x2cf4[_0x53a7af];return _0x3cc7f6;};'use strict';var multer=require(_0x42cf('0x0'));var util=require(_0x42cf('0x1'));var path=require('path');var timeout=require(_0x42cf('0x2'));var express=require(_0x42cf('0x3'));var router=express[_0x42cf('0x4')]();var auth=require(_0x42cf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x42cf('0x6'));router[_0x42cf('0x7')]('/',auth[_0x42cf('0x8')](),controller[_0x42cf('0x9')]);router[_0x42cf('0x7')](_0x42cf('0xa'),auth['isAuthenticated'](),controller[_0x42cf('0xb')]);router[_0x42cf('0x7')](_0x42cf('0xc'),auth[_0x42cf('0x8')](),controller[_0x42cf('0xd')]);router[_0x42cf('0xe')]('/',auth['isAuthenticated'](),interaction[_0x42cf('0xf')](_0x42cf('0x10'),_0x42cf('0x11')),controller[_0x42cf('0x12')]);router['put'](_0x42cf('0xc'),auth[_0x42cf('0x8')](),controller['update']);router['put'](_0x42cf('0x13'),auth[_0x42cf('0x8')](),controller['accept']);router[_0x42cf('0x14')](_0x42cf('0x15'),auth[_0x42cf('0x8')](),controller['reject']);router[_0x42cf('0x16')](_0x42cf('0xc'),auth[_0x42cf('0x8')](),controller[_0x42cf('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6941=['tracked','openchannel','openchannelmessage:create','create','isAuthenticated','update','put','accept','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','describe','/:id','post'];(function(_0x1ae5ed,_0x436b6d){var _0x13d835=function(_0x510a77){while(--_0x510a77){_0x1ae5ed['push'](_0x1ae5ed['shift']());}};_0x13d835(++_0x436b6d);}(_0x6941,0x112));var _0x1694=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6941[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x1694('0x0'));var util=require(_0x1694('0x1'));var path=require(_0x1694('0x2'));var timeout=require(_0x1694('0x3'));var express=require('express');var router=express[_0x1694('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1694('0x5'));var config=require(_0x1694('0x6'));var controller=require(_0x1694('0x7'));router[_0x1694('0x8')]('/',auth['isAuthenticated'](),controller[_0x1694('0x9')]);router[_0x1694('0x8')](_0x1694('0xa'),auth['isAuthenticated'](),controller[_0x1694('0xb')]);router[_0x1694('0x8')](_0x1694('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1694('0xd')]('/',auth['isAuthenticated'](),interaction[_0x1694('0xe')](_0x1694('0xf'),_0x1694('0x10')),controller[_0x1694('0x11')]);router['put'](_0x1694('0xc'),auth[_0x1694('0x12')](),controller[_0x1694('0x13')]);router[_0x1694('0x14')]('/:id/accept',auth[_0x1694('0x12')](),controller[_0x1694('0x15')]);router['put']('/:id/reject',auth[_0x1694('0x12')](),controller['reject']);router[_0x1694('0x16')](_0x1694('0xc'),auth[_0x1694('0x12')](),controller[_0x1694('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5bed8aa..52ed730 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 _0x6350=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x25c760,_0x450723){var _0x333345=function(_0xbe28){while(--_0xbe28){_0x25c760['push'](_0x25c760['shift']());}};_0x333345(++_0x450723);}(_0x6350,0x1cb));var _0x0635=function(_0x11b399,_0x167da5){_0x11b399=_0x11b399-0x0;var _0x9b75a3=_0x6350[_0x11b399];return _0x9b75a3;};'use strict';var Sequelize=require(_0x0635('0x0'));module[_0x0635('0x1')]={'body':{'type':Sequelize[_0x0635('0x2')](_0x0635('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0635('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0635('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0635('0x5')]('in',_0x0635('0x6')),'defaultValue':_0x0635('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0635('0x7')]},'providerName':{'type':Sequelize[_0x0635('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xce00=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x3a5427,_0x1170cb){var _0xab59f4=function(_0x204bf7){while(--_0x204bf7){_0x3a5427['push'](_0x3a5427['shift']());}};_0xab59f4(++_0x1170cb);}(_0xce00,0x152));var _0x0ce0=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xce00[_0x57add2];return _0x4e3670;};'use strict';var Sequelize=require(_0x0ce0('0x0'));module[_0x0ce0('0x1')]={'body':{'type':Sequelize[_0x0ce0('0x2')](_0x0ce0('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0ce0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ce0('0x5')]('in',_0x0ce0('0x6')),'defaultValue':_0x0ce0('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0ce0('0x7')]},'providerName':{'type':Sequelize[_0x0ce0('0x8')]},'providerResponse':{'type':Sequelize[_0x0ce0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 2105e21..86869bc 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 _0x4ffa=['keys','filters','intersection','model','query','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','rows','rawAttributes','options','create','update','body','params','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','Contact','get','OpenchannelInteraction','isNil','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','OpenchannelMessage','fieldName','type','key','map'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4ffa,0x124));var _0xa4ff=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4ffa[_0x178e48];return _0x440d7e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa4ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ff('0x1'));var rp=require(_0xa4ff('0x2'));var moment=require(_0xa4ff('0x3'));var BPromise=require(_0xa4ff('0x4'));var Mustache=require(_0xa4ff('0x5'));var util=require(_0xa4ff('0x6'));var path=require('path');var sox=require(_0xa4ff('0x7'));var csv=require(_0xa4ff('0x8'));var ejs=require(_0xa4ff('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4ff('0xa'));var crypto=require('crypto');var jsforce=require(_0xa4ff('0xb'));var deskjs=require(_0xa4ff('0xc'));var toCsv=require(_0xa4ff('0x8'));var querystring=require('querystring');var Papa=require(_0xa4ff('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4ff('0xe'));var hardwareService=require(_0xa4ff('0xf'));var logger=require(_0xa4ff('0x10'))(_0xa4ff('0x11'));var utils=require('../../config/utils');var config=require(_0xa4ff('0x12'));var licenseUtil=require(_0xa4ff('0x13'));var db=require('../../mysqldb')['db'];config[_0xa4ff('0x14')]=_[_0xa4ff('0x15')](config['redis'],{'host':_0xa4ff('0x16'),'port':0x18eb});var socket=require(_0xa4ff('0x17'))(new Redis(config['redis']));require(_0xa4ff('0x18'))['register'](socket);var jayson=require(_0xa4ff('0x19'));var client=jayson['client'][_0xa4ff('0x1a')]({'port':0x232c});var client9002=jayson[_0xa4ff('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x308f00,_0x199d1e,_0x27f8d8,_0x139e7f){return new BPromise(function(_0x32bcf2,_0x380c2b){var _0x578c83=_0x139e7f||client;return _0x578c83[_0xa4ff('0x1c')](_0x308f00,_0x27f8d8)[_0xa4ff('0x1d')](function(_0x2fd522){logger['info'](_0xa4ff('0x1e'),_0x199d1e,_0xa4ff('0x1f'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x199d1e,_0xa4ff('0x1f'),JSON['stringify'](_0x2fd522));if(_0x2fd522['error']){if(_0x2fd522[_0xa4ff('0x20')][_0xa4ff('0x21')]===0x1f4){logger[_0xa4ff('0x20')](_0xa4ff('0x1e'),_0x199d1e,_0x2fd522[_0xa4ff('0x20')]['message']);return _0x380c2b(_0x2fd522[_0xa4ff('0x20')]['message']);}logger['error'](_0xa4ff('0x1e'),_0x199d1e,_0x2fd522['error'][_0xa4ff('0x22')]);return _0x32bcf2(_0x2fd522['error'][_0xa4ff('0x22')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x199d1e,_0xa4ff('0x1f'));_0x32bcf2(_0x2fd522[_0xa4ff('0x23')][_0xa4ff('0x22')]);}})[_0xa4ff('0x24')](function(_0x5f4c80){logger[_0xa4ff('0x20')](_0xa4ff('0x1e'),_0x199d1e,_0x5f4c80);_0x380c2b(_0x5f4c80);});});}function respondWithStatusCode(_0x38f633,_0x4527fc){_0x4527fc=_0x4527fc||0xcc;return function(_0x3532e3){if(_0x3532e3){return _0x38f633[_0xa4ff('0x25')](_0x4527fc);}return _0x38f633[_0xa4ff('0x26')](_0x4527fc)['end']();};}function respondWithResult(_0x1799dc,_0x241b82){_0x241b82=_0x241b82||0xc8;return function(_0x5aed16){if(_0x5aed16){return _0x1799dc['status'](_0x241b82)[_0xa4ff('0x27')](_0x5aed16);}};}function respondWithFilteredResult(_0x245479,_0x3c3431){return function(_0x56c618){if(_0x56c618){var _0x30d2aa=_0x56c618['count'],_0x31bf4d=_0x3c3431[_0xa4ff('0x28')],_0x3548e1=_0x3c3431[_0xa4ff('0x28')]+_0x3c3431['limit'],_0x340e2d;if(_0x3548e1>=_0x30d2aa){_0x3548e1=_0x30d2aa;_0x340e2d=0xc8;}else{_0x340e2d=0xce;}_0x245479[_0xa4ff('0x26')](_0x340e2d);return _0x245479[_0xa4ff('0x29')](_0xa4ff('0x2a'),_0x31bf4d+'-'+_0x3548e1+'/'+_0x30d2aa)[_0xa4ff('0x27')](_0x56c618);}return null;};}function patchUpdates(_0x28ce0e){return function(_0x2c67ee){try{jsonpatch[_0xa4ff('0x2b')](_0x2c67ee,_0x28ce0e,!![]);}catch(_0x65ce63){return BPromise[_0xa4ff('0x2c')](_0x65ce63);}return _0x2c67ee[_0xa4ff('0x2d')]();};}function saveUpdates(_0x58a68a,_0x1b7911){return function(_0x41999d){if(_0x41999d){return _0x41999d['update'](_0x58a68a)[_0xa4ff('0x1d')](function(_0x306e40){return _0x306e40;});}return null;};}function removeEntity(_0x40659,_0x2744a7){return function(_0x48aaf7){if(_0x48aaf7){return _0x48aaf7[_0xa4ff('0x2e')]()[_0xa4ff('0x1d')](function(){_0x40659[_0xa4ff('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594da7,_0x24d0ad){return function(_0x513aae){if(!_0x513aae){_0x594da7[_0xa4ff('0x25')](0x194);}return _0x513aae;};}function handleError(_0x1f5f1d,_0x326429){_0x326429=_0x326429||0x1f4;return function(_0x4bf879){logger[_0xa4ff('0x20')](_0x4bf879[_0xa4ff('0x2f')]);if(_0x4bf879[_0xa4ff('0x30')]){delete _0x4bf879[_0xa4ff('0x30')];}_0x1f5f1d['status'](_0x326429)[_0xa4ff('0x31')](_0x4bf879);};}exports[_0xa4ff('0x32')]=function(_0x3adf8e,_0x5f46de){var _0x343f26={},_0x20bd3e={},_0x4e5caa={'count':0x0,'rows':[]};var _0x129757=_['map'](db[_0xa4ff('0x33')]['rawAttributes'],function(_0x5c44a1){return{'name':_0x5c44a1[_0xa4ff('0x34')],'type':_0x5c44a1[_0xa4ff('0x35')][_0xa4ff('0x36')]};});_0x20bd3e['model']=_[_0xa4ff('0x37')](_0x129757,_0xa4ff('0x30'));_0x20bd3e['query']=_[_0xa4ff('0x38')](_0x3adf8e['query']);_0x20bd3e[_0xa4ff('0x39')]=_[_0xa4ff('0x3a')](_0x20bd3e[_0xa4ff('0x3b')],_0x20bd3e[_0xa4ff('0x3c')]);_0x343f26[_0xa4ff('0x3d')]=_[_0xa4ff('0x3a')](_0x20bd3e[_0xa4ff('0x3b')],qs[_0xa4ff('0x3e')](_0x3adf8e[_0xa4ff('0x3c')][_0xa4ff('0x3e')]));_0x343f26[_0xa4ff('0x3d')]=_0x343f26[_0xa4ff('0x3d')][_0xa4ff('0x3f')]?_0x343f26[_0xa4ff('0x3d')]:_0x20bd3e[_0xa4ff('0x3b')];if(!_0x3adf8e[_0xa4ff('0x3c')]['hasOwnProperty'](_0xa4ff('0x40'))){_0x343f26['limit']=qs[_0xa4ff('0x41')](_0x3adf8e[_0xa4ff('0x3c')]['limit']);_0x343f26[_0xa4ff('0x28')]=qs[_0xa4ff('0x28')](_0x3adf8e[_0xa4ff('0x3c')]['offset']);}_0x343f26[_0xa4ff('0x42')]=qs[_0xa4ff('0x43')](_0x3adf8e[_0xa4ff('0x3c')][_0xa4ff('0x43')]);_0x343f26['where']=qs[_0xa4ff('0x39')](_[_0xa4ff('0x44')](_0x3adf8e['query'],_0x20bd3e['filters']),_0x129757);if(_0x3adf8e[_0xa4ff('0x3c')][_0xa4ff('0x45')]){_0x343f26['where']=_['merge'](_0x343f26[_0xa4ff('0x46')],{'$or':_['map'](_0x129757,function(_0x3d6a66){if(_0x3d6a66[_0xa4ff('0x35')]!==_0xa4ff('0x47')){var _0x43d426={};_0x43d426[_0x3d6a66['name']]={'$like':'%'+_0x3adf8e[_0xa4ff('0x3c')][_0xa4ff('0x45')]+'%'};return _0x43d426;}})});}_0x343f26=_[_0xa4ff('0x48')]({},_0x343f26,_0x3adf8e['options']);var _0x1eb8e8={'where':_0x343f26[_0xa4ff('0x46')]};return db['OpenchannelMessage'][_0xa4ff('0x49')](_0x1eb8e8)[_0xa4ff('0x1d')](function(_0x57d2d4){_0x4e5caa[_0xa4ff('0x49')]=_0x57d2d4;if(_0x3adf8e[_0xa4ff('0x3c')][_0xa4ff('0x4a')]){_0x343f26[_0xa4ff('0x4b')]=[{'all':!![]}];}return db[_0xa4ff('0x33')][_0xa4ff('0x4c')](_0x343f26);})['then'](function(_0x1db9eb){_0x4e5caa[_0xa4ff('0x4d')]=_0x1db9eb;return _0x4e5caa;})[_0xa4ff('0x1d')](respondWithFilteredResult(_0x5f46de,_0x343f26))[_0xa4ff('0x24')](handleError(_0x5f46de,null));};exports['show']=function(_0x4ec06c,_0x517785){var _0x3bdacb={'raw':!![],'where':{'id':_0x4ec06c['params']['id']}},_0x588569={};_0x588569[_0xa4ff('0x3b')]=_['keys'](db[_0xa4ff('0x33')][_0xa4ff('0x4e')]);_0x588569[_0xa4ff('0x3c')]=_['keys'](_0x4ec06c[_0xa4ff('0x3c')]);_0x588569['filters']=_[_0xa4ff('0x3a')](_0x588569[_0xa4ff('0x3b')],_0x588569[_0xa4ff('0x3c')]);_0x3bdacb[_0xa4ff('0x3d')]=_[_0xa4ff('0x3a')](_0x588569[_0xa4ff('0x3b')],qs[_0xa4ff('0x3e')](_0x4ec06c[_0xa4ff('0x3c')][_0xa4ff('0x3e')]));_0x3bdacb[_0xa4ff('0x3d')]=_0x3bdacb['attributes'][_0xa4ff('0x3f')]?_0x3bdacb['attributes']:_0x588569[_0xa4ff('0x3b')];if(_0x4ec06c[_0xa4ff('0x3c')]['includeAll']){_0x3bdacb[_0xa4ff('0x4b')]=[{'all':!![]}];}_0x3bdacb=_[_0xa4ff('0x48')]({},_0x3bdacb,_0x4ec06c[_0xa4ff('0x4f')]);return db[_0xa4ff('0x33')]['find'](_0x3bdacb)[_0xa4ff('0x1d')](handleEntityNotFound(_0x517785,null))[_0xa4ff('0x1d')](respondWithResult(_0x517785,null))[_0xa4ff('0x24')](handleError(_0x517785,null));};exports[_0xa4ff('0x50')]=function(_0x5d1dfd,_0x5bab19){return db[_0xa4ff('0x33')][_0xa4ff('0x50')](_0x5d1dfd['body'],{})[_0xa4ff('0x1d')](respondWithResult(_0x5bab19,0xc9))[_0xa4ff('0x24')](handleError(_0x5bab19,null));};exports[_0xa4ff('0x51')]=function(_0x2f31e9,_0x2855c7){if(_0x2f31e9[_0xa4ff('0x52')]['id']){delete _0x2f31e9[_0xa4ff('0x52')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x2f31e9['params']['id']}})[_0xa4ff('0x1d')](handleEntityNotFound(_0x2855c7,null))[_0xa4ff('0x1d')](saveUpdates(_0x2f31e9[_0xa4ff('0x52')],null))[_0xa4ff('0x1d')](respondWithResult(_0x2855c7,null))[_0xa4ff('0x24')](handleError(_0x2855c7,null));};exports[_0xa4ff('0x2e')]=function(_0x5deca8,_0x32a60c){return db[_0xa4ff('0x33')]['find']({'where':{'id':_0x5deca8[_0xa4ff('0x53')]['id']}})[_0xa4ff('0x1d')](handleEntityNotFound(_0x32a60c,null))['then'](removeEntity(_0x32a60c,null))[_0xa4ff('0x24')](handleError(_0x32a60c,null));};exports[_0xa4ff('0x54')]=function(_0x438e0a,_0xb4189f){return db[_0xa4ff('0x33')]['describe']()[_0xa4ff('0x1d')](respondWithResult(_0xb4189f,null))[_0xa4ff('0x24')](handleError(_0xb4189f,null));};var interaction_log=require(_0xa4ff('0x10'))(_0xa4ff('0x55'));exports[_0xa4ff('0x56')]=function(_0x410e71,_0x1d97a2,_0x4fe350){var _0x500f03={'channel':_0xa4ff('0x57')};if(_0x410e71['body']['id']){delete _0x410e71[_0xa4ff('0x52')]['id'];}_0x410e71[_0xa4ff('0x52')][_0xa4ff('0x58')]=!![];_0x410e71[_0xa4ff('0x52')]['readAt']=moment()[_0xa4ff('0x59')](_0xa4ff('0x5a'));_0x410e71['body'][_0xa4ff('0x5b')]=_0x410e71[_0xa4ff('0x52')]['UserId']||_0x410e71[_0xa4ff('0x5c')]['id'];return db['OpenchannelMessage'][_0xa4ff('0x5d')]({'where':{'id':_0x410e71[_0xa4ff('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xa4ff('0x5e')}]})[_0xa4ff('0x1d')](handleEntityNotFound(_0x1d97a2,null))[_0xa4ff('0x1d')](saveUpdates(_0x410e71['body'],null))[_0xa4ff('0x1d')](function(_0x3ccaae){if(_0x3ccaae){_0x500f03[_0xa4ff('0x22')]=_0x3ccaae[_0xa4ff('0x5f')]({'plain':!![]});return db[_0xa4ff('0x60')][_0xa4ff('0x5d')]({'where':{'id':_0x3ccaae['OpenchannelInteractionId']}});}return null;})[_0xa4ff('0x1d')](handleEntityNotFound(_0x1d97a2,null))[_0xa4ff('0x1d')](function(_0x3ef6db){if(_0x3ef6db){return _0x3ef6db[_0xa4ff('0x51')]({'UserId':_0x410e71[_0xa4ff('0x52')]['UserId'],'read1stAt':_[_0xa4ff('0x61')](_0x3ef6db['read1stAt'])?moment()[_0xa4ff('0x59')](_0xa4ff('0x5a')):undefined});}return null;})[_0xa4ff('0x1d')](function(_0x4a6374){if(_0x4a6374){_0x500f03['interaction']=_0x4a6374[_0xa4ff('0x5f')]({'plain':!![]});interaction_log[_0xa4ff('0x62')](_0xa4ff('0x63'),_0x410e71['user']['id'],_0x410e71[_0xa4ff('0x5c')][_0xa4ff('0x30')],_0x410e71['user'][_0xa4ff('0x64')],_0x500f03[_0xa4ff('0x65')]['id'],_0x410e71[_0xa4ff('0x52')]?JSON[_0xa4ff('0x66')](_0x410e71[_0xa4ff('0x52')]):_0xa4ff('0x67'));return respondWithRpcPromise(_0xa4ff('0x68'),'acceptMessage',_0x500f03);}return null;})[_0xa4ff('0x1d')](function(_0x27c756){if(_0x27c756){if(_0x410e71[_0xa4ff('0x52')]['manual']){_0x500f03[_0xa4ff('0x22')][_0xa4ff('0x69')]=util['format'](_0xa4ff('0x6a'),_0x410e71[_0xa4ff('0x5c')][_0xa4ff('0x30')]);_0x500f03['message'][_0xa4ff('0x6b')]=_0x500f03[_0xa4ff('0x6b')];_0x500f03[_0xa4ff('0x22')]['event']=_0xa4ff('0x56');return respondWithRpcPromise(_0xa4ff('0x6c'),_0xa4ff('0x6c'),{'event':_0xa4ff('0x6d'),'message':_0x500f03[_0xa4ff('0x22')]},client9002)['then'](function(){return _0x500f03;});}return _0x500f03;}return null;})[_0xa4ff('0x1d')](respondWithResult(_0x1d97a2,null))['catch'](handleError(_0x1d97a2,null));};var interaction_log=require(_0xa4ff('0x10'))(_0xa4ff('0x55'));exports[_0xa4ff('0x2c')]=function(_0x3461c4,_0x4d76e8,_0x5dbb76){var _0x498645={'agent':{},'channel':_0xa4ff('0x57')};if(_0x3461c4['body']['id']){delete _0x3461c4[_0xa4ff('0x52')]['id'];}_0x3461c4[_0xa4ff('0x52')][_0xa4ff('0x5b')]=_0x3461c4[_0xa4ff('0x52')][_0xa4ff('0x5b')]||_0x3461c4[_0xa4ff('0x5c')]['id'];_0x498645[_0xa4ff('0x6e')]['id']=_0x3461c4[_0xa4ff('0x52')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x3461c4[_0xa4ff('0x53')]['id'],'UserId':null}})[_0xa4ff('0x1d')](handleEntityNotFound(_0x4d76e8,null))[_0xa4ff('0x1d')](function(_0x35eca4){if(_0x35eca4){_0x498645[_0xa4ff('0x22')]=_0x35eca4['get']({'plain':!![]});return db[_0xa4ff('0x60')][_0xa4ff('0x5d')]({'where':{'id':_0x35eca4['OpenchannelInteractionId']}});}return null;})[_0xa4ff('0x1d')](handleEntityNotFound(_0x4d76e8,null))[_0xa4ff('0x1d')](function(_0x2637c0){if(_0x2637c0){_0x498645[_0xa4ff('0x65')]=_0x2637c0[_0xa4ff('0x5f')]({'plain':!![]});interaction_log[_0xa4ff('0x62')](_0xa4ff('0x6f'),_0x3461c4[_0xa4ff('0x5c')]['id'],_0x3461c4[_0xa4ff('0x5c')]['name'],_0x3461c4[_0xa4ff('0x5c')][_0xa4ff('0x64')],_0x498645[_0xa4ff('0x65')]['id'],_0x3461c4[_0xa4ff('0x52')]?JSON['stringify'](_0x3461c4[_0xa4ff('0x52')]):_0xa4ff('0x67'));return respondWithRpcPromise(_0xa4ff('0x70'),_0xa4ff('0x71'),_0x498645);}return null;})['then'](function(_0x474ca0){if(_0x474ca0){_0x474ca0['message'][_0xa4ff('0x69')]=util[_0xa4ff('0x59')](_0xa4ff('0x6a'),_0x3461c4[_0xa4ff('0x5c')][_0xa4ff('0x30')]);_0x474ca0[_0xa4ff('0x22')][_0xa4ff('0x6b')]=_0x498645[_0xa4ff('0x6b')];_0x474ca0[_0xa4ff('0x22')][_0xa4ff('0x72')]=_0xa4ff('0x2c');respondWithRpcPromise('EventManager',_0xa4ff('0x6c'),{'event':_0xa4ff('0x73'),'message':_0x474ca0[_0xa4ff('0x22')]},client9002);return _0x498645;}return null;})['then'](respondWithResult(_0x4d76e8,null))['catch'](handleError(_0x4d76e8,null));}; \ No newline at end of file +var _0x2f56=['set','Content-Range','json','save','destroy','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','rows','show','params','keys','find','create','update','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','CmContact','get','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','count','offset'];(function(_0x43f88d,_0x54d8ce){var _0x1aae21=function(_0xa2d024){while(--_0xa2d024){_0x43f88d['push'](_0x43f88d['shift']());}};_0x1aae21(++_0x54d8ce);}(_0x2f56,0xb5));var _0x62f5=function(_0x504def,_0x21303a){_0x504def=_0x504def-0x0;var _0x1406e4=_0x2f56[_0x504def];return _0x1406e4;};'use strict';var pdf=require(_0x62f5('0x0'));var emlformat=require(_0x62f5('0x1'));var rimraf=require(_0x62f5('0x2'));var zipdir=require(_0x62f5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62f5('0x4'));var moment=require(_0x62f5('0x5'));var BPromise=require(_0x62f5('0x6'));var Mustache=require(_0x62f5('0x7'));var util=require(_0x62f5('0x8'));var path=require('path');var sox=require(_0x62f5('0x9'));var csv=require(_0x62f5('0xa'));var ejs=require(_0x62f5('0xb'));var fs=require('fs');var _=require(_0x62f5('0xc'));var squel=require('squel');var crypto=require(_0x62f5('0xd'));var jsforce=require(_0x62f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x62f5('0xa'));var querystring=require(_0x62f5('0xf'));var Papa=require('papaparse');var Redis=require(_0x62f5('0x10'));var authService=require(_0x62f5('0x11'));var qs=require(_0x62f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62f5('0x13'))(_0x62f5('0x14'));var utils=require(_0x62f5('0x15'));var config=require(_0x62f5('0x16'));var licenseUtil=require(_0x62f5('0x17'));var db=require(_0x62f5('0x18'))['db'];config[_0x62f5('0x19')]=_['defaults'](config[_0x62f5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x62f5('0x1a'))(new Redis(config[_0x62f5('0x19')]));require(_0x62f5('0x1b'))[_0x62f5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x62f5('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x62f5('0x1d')][_0x62f5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x11dc90,_0x256fe2,_0x12ac00,_0xbb421b){return new BPromise(function(_0x2756cb,_0x457721){var _0x5b49a1=_0xbb421b||client;return _0x5b49a1['request'](_0x11dc90,_0x12ac00)[_0x62f5('0x1f')](function(_0x3cf38b){logger['info'](_0x62f5('0x20'),_0x256fe2,_0x62f5('0x21'));logger[_0x62f5('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x256fe2,_0x62f5('0x21'),JSON[_0x62f5('0x23')](_0x3cf38b));if(_0x3cf38b[_0x62f5('0x24')]){if(_0x3cf38b['error']['code']===0x1f4){logger[_0x62f5('0x24')](_0x62f5('0x20'),_0x256fe2,_0x3cf38b[_0x62f5('0x24')][_0x62f5('0x25')]);return _0x457721(_0x3cf38b[_0x62f5('0x24')][_0x62f5('0x25')]);}logger[_0x62f5('0x24')](_0x62f5('0x20'),_0x256fe2,_0x3cf38b[_0x62f5('0x24')][_0x62f5('0x25')]);return _0x2756cb(_0x3cf38b[_0x62f5('0x24')]['message']);}else{logger['info'](_0x62f5('0x20'),_0x256fe2,_0x62f5('0x21'));_0x2756cb(_0x3cf38b[_0x62f5('0x26')][_0x62f5('0x25')]);}})[_0x62f5('0x27')](function(_0x289b75){logger['error'](_0x62f5('0x20'),_0x256fe2,_0x289b75);_0x457721(_0x289b75);});});}function respondWithStatusCode(_0x4ac356,_0x2bb867){_0x2bb867=_0x2bb867||0xcc;return function(_0x535f77){if(_0x535f77){return _0x4ac356[_0x62f5('0x28')](_0x2bb867);}return _0x4ac356[_0x62f5('0x29')](_0x2bb867)[_0x62f5('0x2a')]();};}function respondWithResult(_0x2327da,_0x2068dc){_0x2068dc=_0x2068dc||0xc8;return function(_0x12e994){if(_0x12e994){return _0x2327da[_0x62f5('0x29')](_0x2068dc)['json'](_0x12e994);}};}function respondWithFilteredResult(_0x21d2c1,_0x4fe969){return function(_0x50febc){if(_0x50febc){var _0x4ba9f6=_0x50febc[_0x62f5('0x2b')],_0x2426c7=_0x4fe969[_0x62f5('0x2c')],_0x3e907c=_0x4fe969[_0x62f5('0x2c')]+_0x4fe969['limit'],_0x1be567;if(_0x3e907c>=_0x4ba9f6){_0x3e907c=_0x4ba9f6;_0x1be567=0xc8;}else{_0x1be567=0xce;}_0x21d2c1[_0x62f5('0x29')](_0x1be567);return _0x21d2c1[_0x62f5('0x2d')](_0x62f5('0x2e'),_0x2426c7+'-'+_0x3e907c+'/'+_0x4ba9f6)[_0x62f5('0x2f')](_0x50febc);}return null;};}function patchUpdates(_0x91f54a){return function(_0xd344eb){try{jsonpatch['apply'](_0xd344eb,_0x91f54a,!![]);}catch(_0x177f89){return BPromise['reject'](_0x177f89);}return _0xd344eb[_0x62f5('0x30')]();};}function saveUpdates(_0xa08740,_0x5639a5){return function(_0x1d886d){if(_0x1d886d){return _0x1d886d['update'](_0xa08740)['then'](function(_0x175c5f){return _0x175c5f;});}return null;};}function removeEntity(_0x590313,_0x36413b){return function(_0x19c9c4){if(_0x19c9c4){return _0x19c9c4[_0x62f5('0x31')]()['then'](function(){_0x590313['status'](0xcc)[_0x62f5('0x2a')]();});}};}function handleEntityNotFound(_0x53b0ee,_0x4fbbd5){return function(_0x29466a){if(!_0x29466a){_0x53b0ee[_0x62f5('0x28')](0x194);}return _0x29466a;};}function handleError(_0x5be703,_0x1a277f){_0x1a277f=_0x1a277f||0x1f4;return function(_0x14e9a0){logger[_0x62f5('0x24')](_0x14e9a0[_0x62f5('0x32')]);if(_0x14e9a0['name']){delete _0x14e9a0[_0x62f5('0x33')];}_0x5be703['status'](_0x1a277f)[_0x62f5('0x34')](_0x14e9a0);};}exports[_0x62f5('0x35')]=function(_0x6c9086,_0x4fda7d){var _0x1badc1={},_0x2e4712={},_0x5a3934={'count':0x0,'rows':[]};var _0x5a862f=_[_0x62f5('0x36')](db['OpenchannelMessage']['rawAttributes'],function(_0x50919e){return{'name':_0x50919e[_0x62f5('0x37')],'type':_0x50919e[_0x62f5('0x38')][_0x62f5('0x39')]};});_0x2e4712[_0x62f5('0x3a')]=_[_0x62f5('0x36')](_0x5a862f,'name');_0x2e4712[_0x62f5('0x3b')]=_['keys'](_0x6c9086[_0x62f5('0x3b')]);_0x2e4712[_0x62f5('0x3c')]=_[_0x62f5('0x3d')](_0x2e4712['model'],_0x2e4712[_0x62f5('0x3b')]);_0x1badc1['attributes']=_[_0x62f5('0x3d')](_0x2e4712[_0x62f5('0x3a')],qs[_0x62f5('0x3e')](_0x6c9086['query'][_0x62f5('0x3e')]));_0x1badc1[_0x62f5('0x3f')]=_0x1badc1[_0x62f5('0x3f')][_0x62f5('0x40')]?_0x1badc1['attributes']:_0x2e4712[_0x62f5('0x3a')];if(!_0x6c9086['query']['hasOwnProperty'](_0x62f5('0x41'))){_0x1badc1[_0x62f5('0x42')]=qs['limit'](_0x6c9086[_0x62f5('0x3b')][_0x62f5('0x42')]);_0x1badc1[_0x62f5('0x2c')]=qs[_0x62f5('0x2c')](_0x6c9086['query'][_0x62f5('0x2c')]);}_0x1badc1['order']=qs['sort'](_0x6c9086[_0x62f5('0x3b')][_0x62f5('0x43')]);_0x1badc1[_0x62f5('0x44')]=qs[_0x62f5('0x3c')](_[_0x62f5('0x45')](_0x6c9086[_0x62f5('0x3b')],_0x2e4712[_0x62f5('0x3c')]),_0x5a862f);if(_0x6c9086[_0x62f5('0x3b')][_0x62f5('0x46')]){_0x1badc1['where']=_[_0x62f5('0x47')](_0x1badc1['where'],{'$or':_['map'](_0x5a862f,function(_0xc61def){if(_0xc61def[_0x62f5('0x38')]!==_0x62f5('0x48')){var _0x4e94ce={};_0x4e94ce[_0xc61def[_0x62f5('0x33')]]={'$like':'%'+_0x6c9086[_0x62f5('0x3b')]['filter']+'%'};return _0x4e94ce;}})});}_0x1badc1=_[_0x62f5('0x47')]({},_0x1badc1,_0x6c9086[_0x62f5('0x49')]);var _0x5a7bcb={'where':_0x1badc1[_0x62f5('0x44')]};return db[_0x62f5('0x4a')][_0x62f5('0x2b')](_0x5a7bcb)[_0x62f5('0x1f')](function(_0x49464b){_0x5a3934['count']=_0x49464b;if(_0x6c9086[_0x62f5('0x3b')][_0x62f5('0x4b')]){_0x1badc1[_0x62f5('0x4c')]=[{'all':!![]}];}return db[_0x62f5('0x4a')]['findAll'](_0x1badc1);})[_0x62f5('0x1f')](function(_0x345948){_0x5a3934[_0x62f5('0x4d')]=_0x345948;return _0x5a3934;})[_0x62f5('0x1f')](respondWithFilteredResult(_0x4fda7d,_0x1badc1))[_0x62f5('0x27')](handleError(_0x4fda7d,null));};exports[_0x62f5('0x4e')]=function(_0x1e8001,_0x2f9710){var _0x33f275={'raw':!![],'where':{'id':_0x1e8001[_0x62f5('0x4f')]['id']}},_0x11f7da={};_0x11f7da[_0x62f5('0x3a')]=_[_0x62f5('0x50')](db[_0x62f5('0x4a')]['rawAttributes']);_0x11f7da['query']=_[_0x62f5('0x50')](_0x1e8001[_0x62f5('0x3b')]);_0x11f7da[_0x62f5('0x3c')]=_[_0x62f5('0x3d')](_0x11f7da[_0x62f5('0x3a')],_0x11f7da[_0x62f5('0x3b')]);_0x33f275['attributes']=_[_0x62f5('0x3d')](_0x11f7da['model'],qs[_0x62f5('0x3e')](_0x1e8001[_0x62f5('0x3b')][_0x62f5('0x3e')]));_0x33f275[_0x62f5('0x3f')]=_0x33f275[_0x62f5('0x3f')][_0x62f5('0x40')]?_0x33f275[_0x62f5('0x3f')]:_0x11f7da[_0x62f5('0x3a')];if(_0x1e8001[_0x62f5('0x3b')]['includeAll']){_0x33f275[_0x62f5('0x4c')]=[{'all':!![]}];}_0x33f275=_['merge']({},_0x33f275,_0x1e8001['options']);return db[_0x62f5('0x4a')][_0x62f5('0x51')](_0x33f275)['then'](handleEntityNotFound(_0x2f9710,null))[_0x62f5('0x1f')](respondWithResult(_0x2f9710,null))['catch'](handleError(_0x2f9710,null));};exports['create']=function(_0x2d7d6a,_0xf05c7b){return db[_0x62f5('0x4a')][_0x62f5('0x52')](_0x2d7d6a['body'],{})[_0x62f5('0x1f')](respondWithResult(_0xf05c7b,0xc9))[_0x62f5('0x27')](handleError(_0xf05c7b,null));};exports[_0x62f5('0x53')]=function(_0x2b5a25,_0x585f6f){if(_0x2b5a25['body']['id']){delete _0x2b5a25[_0x62f5('0x54')]['id'];}return db['OpenchannelMessage'][_0x62f5('0x51')]({'where':{'id':_0x2b5a25[_0x62f5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x585f6f,null))[_0x62f5('0x1f')](saveUpdates(_0x2b5a25[_0x62f5('0x54')],null))[_0x62f5('0x1f')](respondWithResult(_0x585f6f,null))[_0x62f5('0x27')](handleError(_0x585f6f,null));};exports[_0x62f5('0x31')]=function(_0x14898f,_0x50c917){return db[_0x62f5('0x4a')][_0x62f5('0x51')]({'where':{'id':_0x14898f[_0x62f5('0x4f')]['id']}})[_0x62f5('0x1f')](handleEntityNotFound(_0x50c917,null))[_0x62f5('0x1f')](removeEntity(_0x50c917,null))['catch'](handleError(_0x50c917,null));};exports[_0x62f5('0x55')]=function(_0x41701f,_0xb834da){return db[_0x62f5('0x4a')][_0x62f5('0x55')]()['then'](respondWithResult(_0xb834da,null))[_0x62f5('0x27')](handleError(_0xb834da,null));};var interaction_log=require(_0x62f5('0x13'))(_0x62f5('0x56'));exports[_0x62f5('0x57')]=function(_0x13e00b,_0x5e9e5f,_0x46bada){var _0x2e8141={'channel':_0x62f5('0x58')};if(_0x13e00b[_0x62f5('0x54')]['id']){delete _0x13e00b['body']['id'];}_0x13e00b[_0x62f5('0x54')]['read']=!![];_0x13e00b[_0x62f5('0x54')][_0x62f5('0x59')]=moment()[_0x62f5('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x13e00b[_0x62f5('0x54')][_0x62f5('0x5b')]=_0x13e00b[_0x62f5('0x54')][_0x62f5('0x5b')]||_0x13e00b[_0x62f5('0x5c')]['id'];return db[_0x62f5('0x4a')]['find']({'where':{'id':_0x13e00b['params']['id'],'UserId':null},'include':[{'model':db[_0x62f5('0x5d')],'as':'Contact'}]})[_0x62f5('0x1f')](handleEntityNotFound(_0x5e9e5f,null))[_0x62f5('0x1f')](saveUpdates(_0x13e00b[_0x62f5('0x54')],null))[_0x62f5('0x1f')](function(_0x91e7b0){if(_0x91e7b0){_0x2e8141[_0x62f5('0x25')]=_0x91e7b0[_0x62f5('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0x62f5('0x51')]({'where':{'id':_0x91e7b0[_0x62f5('0x5f')]}});}return null;})[_0x62f5('0x1f')](handleEntityNotFound(_0x5e9e5f,null))['then'](function(_0x312922){if(_0x312922){return _0x312922['update']({'UserId':_0x13e00b[_0x62f5('0x54')][_0x62f5('0x5b')],'read1stAt':_['isNil'](_0x312922[_0x62f5('0x60')])?moment()[_0x62f5('0x5a')](_0x62f5('0x61')):undefined});}return null;})[_0x62f5('0x1f')](function(_0x5bafed){if(_0x5bafed){_0x2e8141[_0x62f5('0x62')]=_0x5bafed[_0x62f5('0x5e')]({'plain':!![]});interaction_log[_0x62f5('0x63')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13e00b['user']['id'],_0x13e00b[_0x62f5('0x5c')][_0x62f5('0x33')],_0x13e00b['user']['role'],_0x2e8141[_0x62f5('0x62')]['id'],_0x13e00b[_0x62f5('0x54')]?JSON[_0x62f5('0x23')](_0x13e00b['body']):_0x62f5('0x64'));return respondWithRpcPromise('AcceptMessage',_0x62f5('0x65'),_0x2e8141);}return null;})[_0x62f5('0x1f')](function(_0x41bac2){if(_0x41bac2){if(_0x13e00b[_0x62f5('0x54')][_0x62f5('0x66')]){_0x2e8141[_0x62f5('0x25')][_0x62f5('0x67')]=util[_0x62f5('0x5a')](_0x62f5('0x68'),_0x13e00b[_0x62f5('0x5c')][_0x62f5('0x33')]);_0x2e8141[_0x62f5('0x25')][_0x62f5('0x69')]=_0x2e8141[_0x62f5('0x69')];_0x2e8141[_0x62f5('0x25')]['event']=_0x62f5('0x57');return respondWithRpcPromise(_0x62f5('0x6a'),'EventManager',{'event':_0x62f5('0x6b'),'message':_0x2e8141[_0x62f5('0x25')]},client9002)[_0x62f5('0x1f')](function(){return _0x2e8141;});}return _0x2e8141;}return null;})[_0x62f5('0x1f')](respondWithResult(_0x5e9e5f,null))[_0x62f5('0x27')](handleError(_0x5e9e5f,null));};var interaction_log=require(_0x62f5('0x13'))('openchannel-interactions');exports[_0x62f5('0x6c')]=function(_0x2f1dd3,_0x39c5a5,_0x41f28d){var _0x595f20={'agent':{},'channel':_0x62f5('0x58')};if(_0x2f1dd3[_0x62f5('0x54')]['id']){delete _0x2f1dd3[_0x62f5('0x54')]['id'];}_0x2f1dd3[_0x62f5('0x54')]['UserId']=_0x2f1dd3[_0x62f5('0x54')][_0x62f5('0x5b')]||_0x2f1dd3['user']['id'];_0x595f20['agent']['id']=_0x2f1dd3[_0x62f5('0x54')][_0x62f5('0x5b')];return db[_0x62f5('0x4a')][_0x62f5('0x51')]({'where':{'id':_0x2f1dd3[_0x62f5('0x4f')]['id'],'UserId':null}})[_0x62f5('0x1f')](handleEntityNotFound(_0x39c5a5,null))[_0x62f5('0x1f')](function(_0x3cbf94){if(_0x3cbf94){_0x595f20[_0x62f5('0x25')]=_0x3cbf94[_0x62f5('0x5e')]({'plain':!![]});return db[_0x62f5('0x6d')][_0x62f5('0x51')]({'where':{'id':_0x3cbf94['OpenchannelInteractionId']}});}return null;})[_0x62f5('0x1f')](handleEntityNotFound(_0x39c5a5,null))[_0x62f5('0x1f')](function(_0x310760){if(_0x310760){_0x595f20[_0x62f5('0x62')]=_0x310760[_0x62f5('0x5e')]({'plain':!![]});interaction_log[_0x62f5('0x63')](_0x62f5('0x6e'),_0x2f1dd3[_0x62f5('0x5c')]['id'],_0x2f1dd3[_0x62f5('0x5c')][_0x62f5('0x33')],_0x2f1dd3[_0x62f5('0x5c')]['role'],_0x595f20['interaction']['id'],_0x2f1dd3['body']?JSON['stringify'](_0x2f1dd3[_0x62f5('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0x62f5('0x6f'),_0x595f20);}return null;})[_0x62f5('0x1f')](function(_0x4df2f0){if(_0x4df2f0){_0x4df2f0['message'][_0x62f5('0x67')]=util[_0x62f5('0x5a')](_0x62f5('0x68'),_0x2f1dd3[_0x62f5('0x5c')][_0x62f5('0x33')]);_0x4df2f0[_0x62f5('0x25')][_0x62f5('0x69')]=_0x595f20['channel'];_0x4df2f0[_0x62f5('0x25')][_0x62f5('0x70')]=_0x62f5('0x6c');respondWithRpcPromise(_0x62f5('0x6a'),_0x62f5('0x6a'),{'event':'rejectmessage','message':_0x4df2f0[_0x62f5('0x25')]},client9002);return _0x595f20;}return null;})[_0x62f5('0x1f')](respondWithResult(_0x39c5a5,null))[_0x62f5('0x27')](handleError(_0x39c5a5,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 03301eb..63088fb 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 _0x4a80=['emit','hasOwnProperty','events','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x5d7350,_0xe9f6f5){var _0x321ee2=function(_0x27cb35){while(--_0x27cb35){_0x5d7350['push'](_0x5d7350['shift']());}};_0x321ee2(++_0xe9f6f5);}(_0x4a80,0x14b));var _0x04a8=function(_0x328c9b,_0x12cecb){_0x328c9b=_0x328c9b-0x0;var _0x2c5ea8=_0x4a80[_0x328c9b];return _0x2c5ea8;};'use strict';var EventEmitter=require(_0x04a8('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x04a8('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x04a8('0x2')](0x0);var events={'afterCreate':_0x04a8('0x3'),'afterUpdate':_0x04a8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x9d807c){return function(_0x4b6d42,_0x49126d,_0x3de11b){OpenchannelMessageEvents['emit'](_0x9d807c+':'+_0x4b6d42['id'],_0x4b6d42);OpenchannelMessageEvents[_0x04a8('0x5')](_0x9d807c,_0x4b6d42);_0x3de11b(null);};}for(var e in events){if(events[_0x04a8('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x282f=['events','../../mysqldb','OpenchannelMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3cce51,_0x2133d7){var _0x10af8a=function(_0x10e70d){while(--_0x10e70d){_0x3cce51['push'](_0x3cce51['shift']());}};_0x10af8a(++_0x2133d7);}(_0x282f,0x1c2));var _0xf282=function(_0xb25497,_0x390fed){_0xb25497=_0xb25497-0x0;var _0x34ee95=_0x282f[_0xb25497];return _0x34ee95;};'use strict';var EventEmitter=require(_0xf282('0x0'));var OpenchannelMessage=require(_0xf282('0x1'))['db'][_0xf282('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf282('0x3'),'afterUpdate':_0xf282('0x4'),'afterDestroy':_0xf282('0x5')};function emitEvent(_0x56701a){return function(_0xa34feb,_0x5ed468,_0x1dd693){OpenchannelMessageEvents[_0xf282('0x6')](_0x56701a+':'+_0xa34feb['id'],_0xa34feb);OpenchannelMessageEvents[_0xf282('0x6')](_0x56701a,_0xa34feb);_0x1dd693(null);};}for(var e in events){if(events[_0xf282('0x7')](e)){var event=events[e];OpenchannelMessage[_0xf282('0x8')](e,emitEvent(event));}}module[_0xf282('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a880792..48e4149 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 _0x7141=['request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','direction','out','secret','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','CmContact','describe','OpenchannelAccount','find','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Interactions','length','Interaction','omit','POST','method','GET','info','afterCreate','threadId','update','error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x43de23,_0x4491a3){var _0x27ab85=function(_0x5df021){while(--_0x5df021){_0x43de23['push'](_0x43de23['shift']());}};_0x27ab85(++_0x4491a3);}(_0x7141,0x1ac));var _0x1714=function(_0x15ef8c,_0x2ea674){_0x15ef8c=_0x15ef8c-0x0;var _0x263d33=_0x7141[_0x15ef8c];return _0x263d33;};'use strict';var _=require(_0x1714('0x0'));var util=require(_0x1714('0x1'));var logger=require(_0x1714('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1714('0x3'));var rp=require(_0x1714('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1714('0x5'));var config=require('../../config/environment');var attributes=require(_0x1714('0x6'));module[_0x1714('0x7')]=function(_0x26d87a,_0x179a61){return _0x26d87a[_0x1714('0x8')](_0x1714('0x9'),attributes,{'tableName':_0x1714('0xa'),'paranoid':![],'indexes':[{'name':_0x1714('0xb'),'fields':[_0x1714('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c6b08,_0x31d2a5,_0xe6bf1f){var _0x5c1359=_0x26d87a[_0x1714('0xd')];var _0x402861=_0x3c6b08['get']({'plain':!![]});if(_0x402861['direction'][_0x1714('0xe')]()==='in'||_0x402861[_0x1714('0xf')][_0x1714('0xe')]()===_0x1714('0x10')&&!_0x402861[_0x1714('0x11')]&&!_['isNil'](_0x402861['UserId'])){_0x5c1359[_0x1714('0x12')]['findOne']({'where':{'id':_0x402861[_0x1714('0x13')]}})[_0x1714('0x14')](function(_0x3bd38d){if(_0x3bd38d){_0x3bd38d['update']({'lastMsgAt':_0x402861[_0x1714('0x15')],'lastMsgDirection':_0x402861[_0x1714('0xf')]['toLowerCase']()});}})[_0x1714('0x16')](function(_0x14abd2){console['error'](_0x14abd2);});}if(_0x402861[_0x1714('0xf')]===_0x1714('0x10')&&!_0x402861['secret']){var _0x310574;_0x5c1359[_0x1714('0x17')][_0x1714('0x18')]()[_0x1714('0x14')](function(_0x2cd0f1){return _0x5c1359[_0x1714('0x19')][_0x1714('0x1a')]({'where':{'id':_0x402861['OpenchannelAccountId']},'include':[{'model':_0x5c1359[_0x1714('0x12')],'as':'Interactions','where':{'id':_0x402861['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5c1359[_0x1714('0x17')],'as':_0x1714('0x1b'),'attributes':_[_0x1714('0x1c')](_0x2cd0f1)}]}]});})['then'](function(_0x284741){_0x310574=_0x284741[_0x1714('0x1d')]({'plain':!![]});if(_0x310574&&_0x310574[_0x1714('0x1e')]){logger['info'](_0x1714('0x1f'),'afterCreate',util[_0x1714('0x20')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x402861['id'],_0x310574['replyUri']));if(_0x310574[_0x1714('0x21')]&&_0x310574['Interactions'][_0x1714('0x22')]){_0x402861[_0x1714('0x23')]=_[_0x1714('0x24')](_0x310574['Interactions'][0x0],_0x1714('0x1b'));_0x402861[_0x1714('0x1b')]=_0x310574[_0x1714('0x21')][0x0][_0x1714('0x1b')];}var _0x31d2a5={'method':_0x1714('0x25'),'uri':encodeURI(_0x310574[_0x1714('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x31d2a5[_0x1714('0x26')]){case _0x1714('0x27'):_0x31d2a5['qs']=_0x402861;break;case _0x1714('0x25'):_0x31d2a5[_0x1714('0xc')]=_0x402861;break;}return rp(_0x31d2a5)['then'](function(_0x1cf0dd){logger[_0x1714('0x28')](_0x1714('0x1f'),_0x1714('0x29'),util[_0x1714('0x20')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x402861['id'],_0x310574[_0x1714('0x1e')]));if(_0x1cf0dd[_0x1714('0xc')][_0x1714('0x2a')]&&_0x1cf0dd[_0x1714('0xc')]['threadId']!=_0x402861['Interaction'][_0x1714('0x2a')]){return _0x5c1359['OpenchannelInteraction'][_0x1714('0x2b')]({'threadId':_0x1cf0dd[_0x1714('0xc')][_0x1714('0x2a')]},{'logging':!![],'where':{'id':_0x402861[_0x1714('0x23')]['id']}});}else{return;}})[_0x1714('0x14')](function(){return _0x3c6b08['update']({'read':!![]});})[_0x1714('0x16')](function(_0x115724){logger[_0x1714('0x2c')](_0x1714('0x1f'),_0x1714('0x29'),util['inspect'](_0x115724,{'showHidden':![],'depth':null}));_0xe6bf1f();});}else{_0xe6bf1f();}})[_0x1714('0x2d')](function(){_0xe6bf1f();});}else{_0xe6bf1f();}}},'charset':_0x1714('0x2e'),'collate':_0x1714('0x2f')});}; \ No newline at end of file +var _0xa694=['OpenchannelMessage','openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','afterCreate','format','length','Interaction','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define'];(function(_0x25b022,_0x394a08){var _0x2e13a5=function(_0xe9495d){while(--_0xe9495d){_0x25b022['push'](_0x25b022['shift']());}};_0x2e13a5(++_0x394a08);}(_0xa694,0xf9));var _0x4a69=function(_0x4bc783,_0xeff87f){_0x4bc783=_0x4bc783-0x0;var _0x58a6a5=_0xa694[_0x4bc783];return _0x58a6a5;};'use strict';var _=require(_0x4a69('0x0'));var util=require(_0x4a69('0x1'));var logger=require(_0x4a69('0x2'))(_0x4a69('0x3'));var moment=require(_0x4a69('0x4'));var BPromise=require('bluebird');var rp=require(_0x4a69('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a69('0x6'));var config=require(_0x4a69('0x7'));var attributes=require(_0x4a69('0x8'));module[_0x4a69('0x9')]=function(_0x26c8cd,_0xe720af){return _0x26c8cd[_0x4a69('0xa')](_0x4a69('0xb'),attributes,{'tableName':_0x4a69('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x4a69('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51d8b1,_0x4d080e,_0x55b2e0){var _0x15b527=_0x26c8cd[_0x4a69('0xe')];var _0x2d6c27=_0x51d8b1[_0x4a69('0xf')]({'plain':!![]});if(_0x2d6c27[_0x4a69('0x10')]['toLowerCase']()==='in'||_0x2d6c27['direction'][_0x4a69('0x11')]()===_0x4a69('0x12')&&!_0x2d6c27[_0x4a69('0x13')]&&!_[_0x4a69('0x14')](_0x2d6c27['UserId'])){_0x15b527[_0x4a69('0x15')][_0x4a69('0x16')]({'where':{'id':_0x2d6c27['OpenchannelInteractionId']}})[_0x4a69('0x17')](function(_0x2c0fae){if(_0x2c0fae){_0x2c0fae['update']({'lastMsgAt':_0x2d6c27[_0x4a69('0x18')],'lastMsgDirection':_0x2d6c27[_0x4a69('0x10')][_0x4a69('0x11')]()});}})[_0x4a69('0x19')](function(_0x5ecfaa){console[_0x4a69('0x1a')](_0x5ecfaa);});}if(_0x2d6c27[_0x4a69('0x10')]==='out'&&!_0x2d6c27[_0x4a69('0x13')]){var _0x368eee;_0x15b527[_0x4a69('0x1b')][_0x4a69('0x1c')]()[_0x4a69('0x17')](function(_0x58e2ed){return _0x15b527[_0x4a69('0x1d')][_0x4a69('0x1e')]({'where':{'id':_0x2d6c27['OpenchannelAccountId']},'include':[{'model':_0x15b527['OpenchannelInteraction'],'as':_0x4a69('0x1f'),'where':{'id':_0x2d6c27[_0x4a69('0x20')]},'limit':0x1,'include':[{'model':_0x15b527[_0x4a69('0x1b')],'as':_0x4a69('0x21'),'attributes':_[_0x4a69('0x22')](_0x58e2ed)}]}]});})[_0x4a69('0x17')](function(_0x50a172){_0x368eee=_0x50a172[_0x4a69('0xf')]({'plain':!![]});if(_0x368eee&&_0x368eee[_0x4a69('0x23')]){logger[_0x4a69('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x4a69('0x25'),util[_0x4a69('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2d6c27['id'],_0x368eee['replyUri']));if(_0x368eee[_0x4a69('0x1f')]&&_0x368eee[_0x4a69('0x1f')][_0x4a69('0x27')]){_0x2d6c27[_0x4a69('0x28')]=_[_0x4a69('0x29')](_0x368eee[_0x4a69('0x1f')][0x0],_0x4a69('0x21'));_0x2d6c27[_0x4a69('0x21')]=_0x368eee[_0x4a69('0x1f')][0x0][_0x4a69('0x21')];}var _0x4d080e={'method':_0x4a69('0x2a'),'uri':encodeURI(_0x368eee[_0x4a69('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d080e[_0x4a69('0x2b')]){case _0x4a69('0x2c'):_0x4d080e['qs']=_0x2d6c27;break;case'POST':_0x4d080e[_0x4a69('0xd')]=_0x2d6c27;break;}return rp(_0x4d080e)[_0x4a69('0x17')](function(_0x2cbf02){logger[_0x4a69('0x24')](_0x4a69('0x2d'),'afterCreate',util['format'](_0x4a69('0x2e'),_0x2d6c27['id'],_0x368eee['replyUri']));if(_0x2cbf02['body'][_0x4a69('0x2f')]&&_0x2cbf02[_0x4a69('0xd')][_0x4a69('0x2f')]!=_0x2d6c27[_0x4a69('0x28')][_0x4a69('0x2f')]){return _0x15b527[_0x4a69('0x15')][_0x4a69('0x30')]({'threadId':_0x2cbf02['body'][_0x4a69('0x2f')]},{'logging':!![],'where':{'id':_0x2d6c27[_0x4a69('0x28')]['id']}});}else{return;}})['then'](function(){return _0x51d8b1['update']({'read':!![]});})['catch'](function(_0x17e2e8){logger[_0x4a69('0x1a')](_0x4a69('0x2d'),_0x4a69('0x25'),util[_0x4a69('0x31')](_0x17e2e8,{'showHidden':![],'depth':null}));_0x55b2e0();});}else{_0x55b2e0();}})['finally'](function(){_0x55b2e0();});}else{_0x55b2e0();}}},'charset':_0x4a69('0x32'),'collate':_0x4a69('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1924037..1355d88 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(_0x226026,_0x3ffc6b){var _0x490b29=function(_0x587045){while(--_0x587045){_0x226026['push'](_0x226026['shift']());}};_0x490b29(++_0x3ffc6b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0xb10b[_0x3c4016];return _0x3cebbd;};'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 _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(_0x1ea9d9,_0x255fe7){var _0x530b5d=function(_0x18e734){while(--_0x18e734){_0x1ea9d9['push'](_0x1ea9d9['shift']());}};_0x530b5d(++_0x255fe7);}(_0xb10b,0x12a));var _0xbb10=function(_0x44be9a,_0x5ce1a6){_0x44be9a=_0x44be9a-0x0;var _0x3dbb78=_0xb10b[_0x44be9a];return _0x3dbb78;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d229dd7..a7d17ff 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 _0x9c44=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x3789fe,_0x1ff914){var _0x17e714=function(_0x6b163f){while(--_0x6b163f){_0x3789fe['push'](_0x3789fe['shift']());}};_0x17e714(++_0x1ff914);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){OpenchannelMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);OpenchannelMessageEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file +var _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x4b5541,_0x20adbb){var _0xae982c=function(_0x38c098){while(--_0x38c098){_0x4b5541['push'](_0x4b5541['shift']());}};_0xae982c(++_0x20adbb);}(_0xaa88,0x137));var _0x8aa8=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0xaa88[_0x3d2d6f];return _0x5c0022;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 7a27fe7..c67890f 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 _0xb242=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','/:id','delete','destroy','removeTeams','removeAgents','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb242,0x1f3));var _0x2b24=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0xb242[_0x54a2e4];return _0x4742d0;};'use strict';var multer=require('multer');var util=require(_0x2b24('0x0'));var path=require(_0x2b24('0x1'));var timeout=require(_0x2b24('0x2'));var express=require(_0x2b24('0x3'));var router=express[_0x2b24('0x4')]();var auth=require(_0x2b24('0x5'));var interaction=require(_0x2b24('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x2b24('0x7')]('/',auth[_0x2b24('0x8')](),controller['index']);router[_0x2b24('0x7')](_0x2b24('0x9'),auth[_0x2b24('0x8')](),controller['describe']);router[_0x2b24('0x7')]('/:id',auth[_0x2b24('0x8')](),controller[_0x2b24('0xa')]);router['get'](_0x2b24('0xb'),auth['isAuthenticated'](),controller[_0x2b24('0xc')]);router[_0x2b24('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2b24('0xd')]);router['get'](_0x2b24('0xe'),auth[_0x2b24('0x8')](),controller[_0x2b24('0xf')]);router[_0x2b24('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2b24('0x10')](_0x2b24('0x11'),auth[_0x2b24('0x8')](),controller[_0x2b24('0x12')]);router[_0x2b24('0x10')]('/:id/users',auth[_0x2b24('0x8')](),controller[_0x2b24('0x13')]);router['put'](_0x2b24('0x14'),auth[_0x2b24('0x8')](),controller['update']);router[_0x2b24('0x15')](_0x2b24('0x14'),auth[_0x2b24('0x8')](),controller[_0x2b24('0x16')]);router['delete'](_0x2b24('0x11'),auth[_0x2b24('0x8')](),controller[_0x2b24('0x17')]);router['delete'](_0x2b24('0xe'),auth[_0x2b24('0x8')](),controller[_0x2b24('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf3fe=['express','Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout'];(function(_0xa132f9,_0x32f20d){var _0x342190=function(_0x350278){while(--_0x350278){_0xa132f9['push'](_0xa132f9['shift']());}};_0x342190(++_0x32f20d);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x5a2c81,_0x4659b4){_0x5a2c81=_0x5a2c81-0x0;var _0x6cc53d=_0xf3fe[_0x5a2c81];return _0x6cc53d;};'use strict';var multer=require('multer');var util=require(_0xef3f('0x0'));var path=require(_0xef3f('0x1'));var timeout=require(_0xef3f('0x2'));var express=require(_0xef3f('0x3'));var router=express[_0xef3f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xef3f('0x5'));var config=require(_0xef3f('0x6'));var controller=require(_0xef3f('0x7'));router[_0xef3f('0x8')]('/',auth[_0xef3f('0x9')](),controller['index']);router['get'](_0xef3f('0xa'),auth[_0xef3f('0x9')](),controller[_0xef3f('0xb')]);router[_0xef3f('0x8')](_0xef3f('0xc'),auth[_0xef3f('0x9')](),controller[_0xef3f('0xd')]);router[_0xef3f('0x8')](_0xef3f('0xe'),auth['isAuthenticated'](),controller[_0xef3f('0xf')]);router['get'](_0xef3f('0x10'),auth[_0xef3f('0x9')](),controller[_0xef3f('0x11')]);router[_0xef3f('0x8')]('/:id/users',auth[_0xef3f('0x9')](),controller[_0xef3f('0x12')]);router['post']('/',auth[_0xef3f('0x9')](),controller['create']);router[_0xef3f('0x13')]('/:id/teams',auth[_0xef3f('0x9')](),controller[_0xef3f('0x14')]);router[_0xef3f('0x13')](_0xef3f('0x15'),auth[_0xef3f('0x9')](),controller[_0xef3f('0x16')]);router[_0xef3f('0x17')](_0xef3f('0xc'),auth[_0xef3f('0x9')](),controller[_0xef3f('0x18')]);router[_0xef3f('0x19')]('/:id',auth[_0xef3f('0x9')](),controller[_0xef3f('0x1a')]);router['delete'](_0xef3f('0x10'),auth[_0xef3f('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xef3f('0x1b')]);module[_0xef3f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 349535c..6edb3ac 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 _0x7510=['roundrobin','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7510,0xa9));var _0x0751=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7510[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0751('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0751('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0751('0x2')]},'timeout':{'type':Sequelize[_0x0751('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0751('0x4'),_0x0751('0x5'),_0x0751('0x6'))}}; \ No newline at end of file +var _0x38b8=['roundrobin','sequelize','STRING','name','INTEGER','beepall'];(function(_0x208c70,_0xa8e251){var _0x41d32d=function(_0x5b77cb){while(--_0x5b77cb){_0x208c70['push'](_0x208c70['shift']());}};_0x41d32d(++_0xa8e251);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x838b('0x0'));module['exports']={'name':{'type':Sequelize[_0x838b('0x1')],'unique':_0x838b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x838b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x838b('0x4'),_0x838b('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ac89a53..bfed2f5 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 _0x87dd=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','length','hasOwnProperty','OpenchannelQueueId','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','includes','all','union','compact','value','transaction','removeAgents','forEach','addAgents','omit','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../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','./openchannelQueue.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87dd,0x70));var _0xd87d=function(_0x4b7f28,_0x27d23a){_0x4b7f28=_0x4b7f28-0x0;var _0xf5b553=_0x87dd[_0x4b7f28];return _0xf5b553;};'use strict';var pdf=require(_0xd87d('0x0'));var emlformat=require(_0xd87d('0x1'));var rimraf=require(_0xd87d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd87d('0x3'));var rp=require(_0xd87d('0x4'));var moment=require('moment');var BPromise=require(_0xd87d('0x5'));var Mustache=require('mustache');var util=require(_0xd87d('0x6'));var path=require(_0xd87d('0x7'));var sox=require(_0xd87d('0x8'));var csv=require(_0xd87d('0x9'));var ejs=require(_0xd87d('0xa'));var fs=require('fs');var _=require(_0xd87d('0xb'));var squel=require(_0xd87d('0xc'));var crypto=require(_0xd87d('0xd'));var jsforce=require(_0xd87d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd87d('0x9'));var querystring=require(_0xd87d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd87d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd87d('0x11'));var hardwareService=require(_0xd87d('0x12'));var logger=require(_0xd87d('0x13'))(_0xd87d('0x14'));var utils=require(_0xd87d('0x15'));var config=require(_0xd87d('0x16'));var licenseUtil=require(_0xd87d('0x17'));var db=require(_0xd87d('0x18'))['db'];config[_0xd87d('0x19')]=_[_0xd87d('0x1a')](config[_0xd87d('0x19')],{'host':_0xd87d('0x1b'),'port':0x18eb});var socket=require(_0xd87d('0x1c'))(new Redis(config[_0xd87d('0x19')]));require(_0xd87d('0x1d'))[_0xd87d('0x1e')](socket);function respondWithStatusCode(_0x4a9737,_0x1c7ab3){_0x1c7ab3=_0x1c7ab3||0xcc;return function(_0x1c84e3){if(_0x1c84e3){return _0x4a9737[_0xd87d('0x1f')](_0x1c7ab3);}return _0x4a9737[_0xd87d('0x20')](_0x1c7ab3)[_0xd87d('0x21')]();};}function respondWithResult(_0x3207f2,_0x2373f7){_0x2373f7=_0x2373f7||0xc8;return function(_0x2f5c7e){if(_0x2f5c7e){return _0x3207f2['status'](_0x2373f7)[_0xd87d('0x22')](_0x2f5c7e);}};}function respondWithFilteredResult(_0x1b57e5,_0x31394e){return function(_0x2e11a6){if(_0x2e11a6){var _0x47375b=_0x2e11a6[_0xd87d('0x23')],_0x3115e9=_0x31394e[_0xd87d('0x24')],_0x28cfcf=_0x31394e[_0xd87d('0x24')]+_0x31394e[_0xd87d('0x25')],_0x5a3647;if(_0x28cfcf>=_0x47375b){_0x28cfcf=_0x47375b;_0x5a3647=0xc8;}else{_0x5a3647=0xce;}_0x1b57e5[_0xd87d('0x20')](_0x5a3647);return _0x1b57e5[_0xd87d('0x26')](_0xd87d('0x27'),_0x3115e9+'-'+_0x28cfcf+'/'+_0x47375b)[_0xd87d('0x22')](_0x2e11a6);}return null;};}function patchUpdates(_0x44b9bb){return function(_0x70f1fb){try{jsonpatch[_0xd87d('0x28')](_0x70f1fb,_0x44b9bb,!![]);}catch(_0x45626c){return BPromise['reject'](_0x45626c);}return _0x70f1fb[_0xd87d('0x29')]();};}function saveUpdates(_0x220c08,_0x5aa3c8){return function(_0x57cd5f){if(_0x57cd5f){return _0x57cd5f[_0xd87d('0x2a')](_0x220c08)[_0xd87d('0x2b')](function(_0x40185f){return _0x40185f;});}return null;};}function removeEntity(_0x2e97b5,_0x5035a9){return function(_0x3ade86){if(_0x3ade86){return _0x3ade86[_0xd87d('0x2c')]()[_0xd87d('0x2b')](function(){var _0x13d12a=_0x3ade86[_0xd87d('0x2d')]({'plain':!![]});var _0x4b7577='OpenchannelQueues';return db[_0xd87d('0x2e')]['destroy']({'where':{'type':_0x4b7577,'resourceId':_0x13d12a['id']}})[_0xd87d('0x2b')](function(){return _0x3ade86;});})['then'](function(){_0x2e97b5[_0xd87d('0x20')](0xcc)[_0xd87d('0x21')]();});}};}function handleEntityNotFound(_0xa582be,_0x38c4cc){return function(_0x41097f){if(!_0x41097f){_0xa582be[_0xd87d('0x1f')](0x194);}return _0x41097f;};}function handleError(_0x4b020c,_0x3b31ab){_0x3b31ab=_0x3b31ab||0x1f4;return function(_0x4913c0){logger['error'](_0x4913c0['stack']);if(_0x4913c0[_0xd87d('0x2f')]){delete _0x4913c0[_0xd87d('0x2f')];}_0x4b020c['status'](_0x3b31ab)[_0xd87d('0x30')](_0x4913c0);};}exports[_0xd87d('0x31')]=function(_0x4c0bf1,_0x27c001){var _0xffb143={},_0x4dec58={},_0x55bce9={'count':0x0,'rows':[]};var _0x5193a7=_['map'](db[_0xd87d('0x32')][_0xd87d('0x33')],function(_0x482964){return{'name':_0x482964[_0xd87d('0x34')],'type':_0x482964[_0xd87d('0x35')][_0xd87d('0x36')]};});_0x4dec58[_0xd87d('0x37')]=_[_0xd87d('0x38')](_0x5193a7,'name');_0x4dec58['query']=_[_0xd87d('0x39')](_0x4c0bf1[_0xd87d('0x3a')]);_0x4dec58[_0xd87d('0x3b')]=_[_0xd87d('0x3c')](_0x4dec58['model'],_0x4dec58['query']);_0xffb143['attributes']=_[_0xd87d('0x3c')](_0x4dec58['model'],qs['fields'](_0x4c0bf1[_0xd87d('0x3a')][_0xd87d('0x3d')]));_0xffb143[_0xd87d('0x3e')]=_0xffb143[_0xd87d('0x3e')]['length']?_0xffb143['attributes']:_0x4dec58[_0xd87d('0x37')];if(!_0x4c0bf1[_0xd87d('0x3a')]['hasOwnProperty'](_0xd87d('0x3f'))){_0xffb143[_0xd87d('0x25')]=qs[_0xd87d('0x25')](_0x4c0bf1['query'][_0xd87d('0x25')]);_0xffb143[_0xd87d('0x24')]=qs['offset'](_0x4c0bf1[_0xd87d('0x3a')]['offset']);}_0xffb143[_0xd87d('0x40')]=qs['sort'](_0x4c0bf1['query'][_0xd87d('0x41')]);_0xffb143[_0xd87d('0x42')]=qs[_0xd87d('0x3b')](_[_0xd87d('0x43')](_0x4c0bf1['query'],_0x4dec58['filters']),_0x5193a7);if(_0x4c0bf1[_0xd87d('0x3a')]['filter']){_0xffb143[_0xd87d('0x42')]=_['merge'](_0xffb143[_0xd87d('0x42')],{'$or':_['map'](_0x5193a7,function(_0x43338e){if(_0x43338e[_0xd87d('0x35')]!==_0xd87d('0x44')){var _0x39ce82={};_0x39ce82[_0x43338e[_0xd87d('0x2f')]]={'$like':'%'+_0x4c0bf1['query'][_0xd87d('0x45')]+'%'};return _0x39ce82;}})});}_0xffb143=_[_0xd87d('0x46')]({},_0xffb143,_0x4c0bf1[_0xd87d('0x47')]);var _0x2a4cf4={'where':_0xffb143[_0xd87d('0x42')]};return db[_0xd87d('0x32')][_0xd87d('0x23')](_0x2a4cf4)[_0xd87d('0x2b')](function(_0x3390c4){_0x55bce9[_0xd87d('0x23')]=_0x3390c4;if(_0x4c0bf1[_0xd87d('0x3a')][_0xd87d('0x48')]){_0xffb143[_0xd87d('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xd87d('0x4a')](_0xffb143);})[_0xd87d('0x2b')](function(_0x2023f7){_0x55bce9[_0xd87d('0x4b')]=_0x2023f7;return _0x55bce9;})[_0xd87d('0x2b')](respondWithFilteredResult(_0x27c001,_0xffb143))[_0xd87d('0x4c')](handleError(_0x27c001,null));};exports[_0xd87d('0x4d')]=function(_0x26fc31,_0x3f2e21){var _0x469929={'raw':!![],'where':{'id':_0x26fc31[_0xd87d('0x4e')]['id']}},_0x215974={};_0x215974['model']=_[_0xd87d('0x39')](db[_0xd87d('0x32')][_0xd87d('0x33')]);_0x215974[_0xd87d('0x3a')]=_['keys'](_0x26fc31[_0xd87d('0x3a')]);_0x215974[_0xd87d('0x3b')]=_[_0xd87d('0x3c')](_0x215974[_0xd87d('0x37')],_0x215974[_0xd87d('0x3a')]);_0x469929[_0xd87d('0x3e')]=_[_0xd87d('0x3c')](_0x215974['model'],qs[_0xd87d('0x3d')](_0x26fc31[_0xd87d('0x3a')][_0xd87d('0x3d')]));_0x469929['attributes']=_0x469929[_0xd87d('0x3e')]['length']?_0x469929['attributes']:_0x215974[_0xd87d('0x37')];if(_0x26fc31[_0xd87d('0x3a')][_0xd87d('0x48')]){_0x469929[_0xd87d('0x49')]=[{'all':!![]}];}_0x469929=_[_0xd87d('0x46')]({},_0x469929,_0x26fc31[_0xd87d('0x47')]);return db['OpenchannelQueue']['find'](_0x469929)[_0xd87d('0x2b')](handleEntityNotFound(_0x3f2e21,null))[_0xd87d('0x2b')](respondWithResult(_0x3f2e21,null))[_0xd87d('0x4c')](handleError(_0x3f2e21,null));};exports[_0xd87d('0x4f')]=function(_0x62f394,_0x5cb9be){return db[_0xd87d('0x32')][_0xd87d('0x4f')](_0x62f394[_0xd87d('0x50')],{})[_0xd87d('0x2b')](function(_0x2ff4d9){var _0x4ab729=_0x62f394[_0xd87d('0x51')]['get']({'plain':!![]});if(!_0x4ab729)throw new Error(_0xd87d('0x52'));if(_0x4ab729[_0xd87d('0x53')]===_0xd87d('0x51')){var _0x348314=_0x2ff4d9[_0xd87d('0x2d')]({'plain':!![]});var _0x3c5329=_0xd87d('0x54');return db[_0xd87d('0x55')][_0xd87d('0x56')]({'where':{'name':_0x3c5329,'userProfileId':_0x4ab729[_0xd87d('0x57')]},'raw':!![]})[_0xd87d('0x2b')](function(_0x10a55e){if(_0x10a55e&&_0x10a55e['autoAssociation']===0x0){return db[_0xd87d('0x2e')]['create']({'name':_0x348314['name'],'resourceId':_0x348314['id'],'type':_0x10a55e[_0xd87d('0x2f')],'sectionId':_0x10a55e['id']},{})['then'](function(){return _0x2ff4d9;});}else{return _0x2ff4d9;}})[_0xd87d('0x4c')](function(_0x4d4bf1){logger[_0xd87d('0x58')](_0xd87d('0x59'),_0x4d4bf1);throw _0x4d4bf1;});}return _0x2ff4d9;})['then'](respondWithResult(_0x5cb9be,0xc9))[_0xd87d('0x4c')](handleError(_0x5cb9be,null));};exports[_0xd87d('0x2a')]=function(_0x2a7d8d,_0x4b1322){if(_0x2a7d8d['body']['id']){delete _0x2a7d8d[_0xd87d('0x50')]['id'];}return db[_0xd87d('0x32')][_0xd87d('0x56')]({'where':{'id':_0x2a7d8d[_0xd87d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4b1322,null))[_0xd87d('0x2b')](saveUpdates(_0x2a7d8d[_0xd87d('0x50')],null))[_0xd87d('0x2b')](respondWithResult(_0x4b1322,null))[_0xd87d('0x4c')](handleError(_0x4b1322,null));};exports['destroy']=function(_0x1e2e05,_0x16ca18){return db[_0xd87d('0x32')]['find']({'where':{'id':_0x1e2e05[_0xd87d('0x4e')]['id']}})[_0xd87d('0x2b')](handleEntityNotFound(_0x16ca18,null))[_0xd87d('0x2b')](removeEntity(_0x16ca18,null))['catch'](handleError(_0x16ca18,null));};exports[_0xd87d('0x5a')]=function(_0x47be18,_0x261a44){return db[_0xd87d('0x32')][_0xd87d('0x5a')]()[_0xd87d('0x2b')](respondWithResult(_0x261a44,null))[_0xd87d('0x4c')](handleError(_0x261a44,null));};exports[_0xd87d('0x5b')]=function(_0xaf4da0,_0x44a710,_0x19f848){var _0x2f192f={'raw':!![],'where':{}},_0x397519={},_0x47ac52;return db[_0xd87d('0x32')]['findOne']({'where':{'id':_0xaf4da0[_0xd87d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x44a710,null))[_0xd87d('0x2b')](function(_0x228d5b){if(_0x228d5b){_0x47ac52=_0x228d5b[_0xd87d('0x2d')]({'plain':!![]});_0x397519['model']=_[_0xd87d('0x39')](db[_0xd87d('0x5c')][_0xd87d('0x33')]);_0x397519[_0xd87d('0x3a')]=_[_0xd87d('0x39')](_0xaf4da0['query']);_0x397519['filters']=_[_0xd87d('0x3c')](_0x397519['model'],_0x397519[_0xd87d('0x3a')]);_0x2f192f[_0xd87d('0x3e')]=_[_0xd87d('0x3c')](_0x397519[_0xd87d('0x37')],qs['fields'](_0xaf4da0['query'][_0xd87d('0x3d')]));_0x2f192f['attributes']=_0x2f192f[_0xd87d('0x3e')][_0xd87d('0x5d')]?_0x2f192f[_0xd87d('0x3e')]:_0x397519[_0xd87d('0x37')];if(!_0xaf4da0[_0xd87d('0x3a')][_0xd87d('0x5e')]('nolimit')){_0x2f192f[_0xd87d('0x25')]=qs['limit'](_0xaf4da0[_0xd87d('0x3a')][_0xd87d('0x25')]);_0x2f192f['offset']=qs[_0xd87d('0x24')](_0xaf4da0['query']['offset']);}_0x2f192f['order']=qs[_0xd87d('0x41')](_0xaf4da0[_0xd87d('0x3a')][_0xd87d('0x41')]);_0x2f192f[_0xd87d('0x42')]=qs['filters'](_[_0xd87d('0x43')](_0xaf4da0[_0xd87d('0x3a')],_0x397519['filters']));_0x2f192f[_0xd87d('0x42')][_0xd87d('0x5f')]=_0x228d5b['id'];if(_0xaf4da0['query'][_0xd87d('0x45')]){_0x2f192f[_0xd87d('0x42')]=_[_0xd87d('0x46')](_0x2f192f[_0xd87d('0x42')],{'$or':_[_0xd87d('0x38')](_0x2f192f[_0xd87d('0x3e')],function(_0x2623e8){var _0x40df4d={};_0x40df4d[_0x2623e8]={'$like':'%'+_0xaf4da0[_0xd87d('0x3a')]['filter']+'%'};return _0x40df4d;})});}_0x2f192f=_[_0xd87d('0x46')]({},_0x2f192f,_0xaf4da0[_0xd87d('0x47')]);return db[_0xd87d('0x5c')]['findAll'](_0x2f192f);}})[_0xd87d('0x2b')](function(_0x5e2b2e){if(_0x5e2b2e){return db['User']['findAndCountAll']({'where':{'id':_[_0xd87d('0x38')](_0x5e2b2e,_0xd87d('0x60')),'role':_0xd87d('0x61')},'attributes':['id',_0xd87d('0x2f'),_0xd87d('0x62'),_0xd87d('0x63'),_0xd87d('0x64')]});}})[_0xd87d('0x2b')](function(_0x51b45f){if(_0x51b45f){return{'count':_0x51b45f['count'],'rows':_[_0xd87d('0x38')](_0x51b45f[_0xd87d('0x4b')],function(_0x3baba3){return{'membername':_0x3baba3[_0xd87d('0x2f')],'UserId':_0x3baba3['id'],'queue_name':_0x47ac52[_0xd87d('0x2f')],'OpenchannelQueueId':_0x47ac52['id'],'interface':util[_0xd87d('0x65')](_0xd87d('0x66'),'SIP',_0x3baba3['name']),'penalty':0x0,'paused':_0x3baba3['openchannelPause'],'createdAt':_0x3baba3['createdAt'],'updatedAt':_0x3baba3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd87d('0x2b')](respondWithFilteredResult(_0x44a710,_0x2f192f))[_0xd87d('0x4c')](handleError(_0x44a710,null));};exports[_0xd87d('0x67')]=function(_0x1b49ab,_0x1e53be,_0xaa9fe8){var _0x1abcb5={};var _0x44e2ec={};var _0x2db4e9;var _0x525d99;return db['OpenchannelQueue'][_0xd87d('0x68')]({'where':{'id':_0x1b49ab[_0xd87d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e53be,null))[_0xd87d('0x2b')](function(_0x243070){if(_0x243070){_0x2db4e9=_0x243070;_0x44e2ec[_0xd87d('0x37')]=_[_0xd87d('0x39')](db[_0xd87d('0x69')][_0xd87d('0x33')]);_0x44e2ec[_0xd87d('0x3a')]=_['keys'](_0x1b49ab[_0xd87d('0x3a')]);_0x44e2ec['filters']=_[_0xd87d('0x3c')](_0x44e2ec[_0xd87d('0x37')],_0x44e2ec[_0xd87d('0x3a')]);_0x1abcb5[_0xd87d('0x3e')]=_['intersection'](_0x44e2ec[_0xd87d('0x37')],qs[_0xd87d('0x3d')](_0x1b49ab[_0xd87d('0x3a')][_0xd87d('0x3d')]));_0x1abcb5[_0xd87d('0x3e')]=_0x1abcb5[_0xd87d('0x3e')][_0xd87d('0x5d')]?_0x1abcb5['attributes']:_0x44e2ec['model'];_0x1abcb5[_0xd87d('0x40')]=qs[_0xd87d('0x41')](_0x1b49ab[_0xd87d('0x3a')][_0xd87d('0x41')]);_0x1abcb5['where']=qs[_0xd87d('0x3b')](_[_0xd87d('0x43')](_0x1b49ab[_0xd87d('0x3a')],_0x44e2ec[_0xd87d('0x3b')]));if(_0x1b49ab[_0xd87d('0x3a')][_0xd87d('0x45')]){_0x1abcb5[_0xd87d('0x42')]=_[_0xd87d('0x46')](_0x1abcb5[_0xd87d('0x42')],{'$or':_[_0xd87d('0x38')](_0x1abcb5[_0xd87d('0x3e')],function(_0x577095){var _0x2cf085={};_0x2cf085[_0x577095]={'$like':'%'+_0x1b49ab['query']['filter']+'%'};return _0x2cf085;})});}_0x1abcb5=_[_0xd87d('0x46')]({},_0x1abcb5,_0x1b49ab[_0xd87d('0x47')]);return _0x2db4e9['getTeams'](_0x1abcb5);}})['then'](function(_0x2f6f7a){if(_0x2f6f7a){_0x525d99=_0x2f6f7a[_0xd87d('0x5d')];if(!_0x1b49ab[_0xd87d('0x3a')][_0xd87d('0x5e')](_0xd87d('0x3f'))){_0x1abcb5[_0xd87d('0x25')]=qs['limit'](_0x1b49ab[_0xd87d('0x3a')][_0xd87d('0x25')]);_0x1abcb5[_0xd87d('0x24')]=qs[_0xd87d('0x24')](_0x1b49ab[_0xd87d('0x3a')][_0xd87d('0x24')]);}return _0x2db4e9[_0xd87d('0x67')](_0x1abcb5);}})['then'](function(_0x48f3bb){if(_0x48f3bb){return _0x48f3bb?{'count':_0x525d99,'rows':_0x48f3bb}:null;}})[_0xd87d('0x2b')](respondWithResult(_0x1e53be,null))[_0xd87d('0x4c')](handleError(_0x1e53be,null));};exports[_0xd87d('0x6a')]=function(_0x2ce7f2,_0x45c048,_0x2d8c70){var _0xac6782=_0x2ce7f2[_0xd87d('0x50')][_0xd87d('0x6b')];return db['Team'][_0xd87d('0x4a')]({'where':{'id':_0xac6782},'attributes':['id'],'include':[{'model':db[_0xd87d('0x6c')],'as':_0xd87d('0x6d'),'attributes':['id',_0xd87d('0x2f'),_0xd87d('0x6e'),_0xd87d('0x6f'),'interface'],'raw':!![]}]})[_0xd87d('0x2b')](function(_0x58e732){if(_0x58e732){var _0x3702a9=_[_0xd87d('0x70')](_0x58e732,function(_0x4ac074){var _0x1f0391=_0x4ac074['get']({'plain':!![]});return _0x1f0391[_0xd87d('0x6d')];});return db[_0xd87d('0x32')][_0xd87d('0x56')]({'where':{'id':_0x2ce7f2[_0xd87d('0x4e')]['id']}})[_0xd87d('0x2b')](function(_0x157c46){return db['sequelize']['transaction'](function(_0x274636){return _0x157c46['addTeams'](_0xac6782,{'transaction':_0x274636})[_0xd87d('0x2b')](function(){return BPromise[_0xd87d('0x71')](_0x3702a9,function(_0x4b70d4){return db[_0xd87d('0x5c')][_0xd87d('0x72')]({'where':{'UserId':_0x4b70d4['id'],'OpenchannelQueueId':_0x2ce7f2[_0xd87d('0x4e')]['id']},'transaction':_0x274636});});})[_0xd87d('0x2b')](function(){_0x3702a9['forEach'](function(_0x348b76){socket[_0xd87d('0x73')](_0xd87d('0x74'),{'UserId':_0x348b76['id'],'OpenchannelQueueId':_0x157c46['id']});});});});});}})[_0xd87d('0x2b')](respondWithStatusCode(_0x45c048,null))[_0xd87d('0x4c')](handleError(_0x45c048,null));};exports[_0xd87d('0x75')]=function(_0x13e9e0,_0x53c51c,_0x11a672){return db[_0xd87d('0x69')][_0xd87d('0x4a')]({'where':{'id':_0x13e9e0['query'][_0xd87d('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd87d('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xd87d('0x2b')](handleEntityNotFound(_0x53c51c,null))[_0xd87d('0x2b')](function(_0x1b1d45){var _0x4507b5=_[_0xd87d('0x38')](_0x1b1d45,'id');var _0x4a66db=[];var _0x196314=[];var _0x5ef68e=squel[_0xd87d('0x76')]();_0x5ef68e[_0xd87d('0x77')](_0xd87d('0x78'))['from']('team_has_openchannel_queues','tq')[_0xd87d('0x79')](_0xd87d('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd87d('0x42')](_0xd87d('0x7b'),_0x13e9e0['params']['id']);for(var _0x8cd741=0x0;_0x8cd741<_0x1b1d45['length'];_0x8cd741+=0x1){let _0x3d01a7=_0x1b1d45[_0x8cd741];for(var _0x4d5336=0x0;_0x4d5336<_0x3d01a7['Agents'][_0xd87d('0x5d')];_0x4d5336+=0x1){let _0x12e8a6=_0x3d01a7['Agents'][_0x4d5336];var _0x5391b5=_0x5ef68e[_0xd87d('0x7c')]();_0x5391b5[_0xd87d('0x42')](_0xd87d('0x7d'),_0x12e8a6['id']);_0x196314[_0xd87d('0x7e')](db[_0xd87d('0x7f')][_0xd87d('0x3a')](_0x5391b5[_0xd87d('0x80')](),{'type':db[_0xd87d('0x7f')][_0xd87d('0x81')][_0xd87d('0x82')]})[_0xd87d('0x2b')](function(_0x4d2ebc){if(_0x4d2ebc[_0xd87d('0x5d')]===0x1){return _0x12e8a6['id'];}else{var _0x3f1f0f=_['every'](_['map'](_0x4d2ebc,'TeamId'),function(_0x8455e2){return _[_0xd87d('0x83')](_0x4507b5,_0x8455e2);});if(_0x3f1f0f){return _0x12e8a6['id'];}}}));}}return BPromise[_0xd87d('0x84')](_0x196314)[_0xd87d('0x2b')](function(_0x1bf0f9){_0x4a66db=_(_0x4a66db)[_0xd87d('0x85')](_0x1bf0f9)[_0xd87d('0x86')]()[_0xd87d('0x87')]();return db[_0xd87d('0x32')][_0xd87d('0x56')]({'where':{'id':_0x13e9e0[_0xd87d('0x4e')]['id']}})[_0xd87d('0x2b')](function(_0xb30bae){return db['sequelize'][_0xd87d('0x88')](function(_0x5a09eb){return _0xb30bae['removeTeams'](_0x13e9e0[_0xd87d('0x3a')]['ids'],{'transaction':_0x5a09eb})[_0xd87d('0x2b')](function(){if(!_['isEmpty'](_0x4a66db)){return _0xb30bae[_0xd87d('0x89')](_0x4a66db,{'transaction':_0x5a09eb});}})[_0xd87d('0x2b')](function(){_0x4a66db[_0xd87d('0x8a')](function(_0x467706){socket[_0xd87d('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x467706,'OpenchannelQueueId':_0xb30bae['id']});});});});});});})[_0xd87d('0x2b')](respondWithStatusCode(_0x53c51c,null))['catch'](handleError(_0x53c51c,null));};exports['addAgents']=function(_0xbdc0ca,_0x2a724b,_0xd1c9b1){return db[_0xd87d('0x32')][_0xd87d('0x56')]({'where':{'id':_0xbdc0ca[_0xd87d('0x4e')]['id']}})[_0xd87d('0x2b')](handleEntityNotFound(_0x2a724b,null))[_0xd87d('0x2b')](function(_0xce86e7){if(_0xce86e7){return _0xce86e7[_0xd87d('0x8b')](_0xbdc0ca[_0xd87d('0x50')][_0xd87d('0x6b')],_[_0xd87d('0x8c')](_0xbdc0ca[_0xd87d('0x50')],['ids','id'])||{})['spread'](function(_0x5a07f8){for(var _0xb590e2=0x0;_0xb590e2<_0xbdc0ca[_0xd87d('0x50')][_0xd87d('0x6b')][_0xd87d('0x5d')];_0xb590e2+=0x1){socket[_0xd87d('0x73')](_0xd87d('0x74'),{'UserId':_0xbdc0ca[_0xd87d('0x50')][_0xd87d('0x6b')][_0xb590e2],'OpenchannelQueueId':_0xbdc0ca[_0xd87d('0x4e')]['id']});}return _0x5a07f8;});}})[_0xd87d('0x2b')](respondWithResult(_0x2a724b,null))[_0xd87d('0x4c')](handleError(_0x2a724b,null));};exports[_0xd87d('0x89')]=function(_0xf5d415,_0x3646ee,_0x3580c2){return db[_0xd87d('0x32')][_0xd87d('0x56')]({'where':{'id':_0xf5d415[_0xd87d('0x4e')]['id']}})[_0xd87d('0x2b')](handleEntityNotFound(_0x3646ee,null))['then'](function(_0x284be5){if(_0x284be5){return _0x284be5['removeAgents'](_0xf5d415[_0xd87d('0x3a')][_0xd87d('0x6b')])['then'](function(){if(_['isArray'](_0xf5d415['query'][_0xd87d('0x6b')])){for(var _0x3adc19=0x0;_0x3adc19<_0xf5d415[_0xd87d('0x3a')][_0xd87d('0x6b')][_0xd87d('0x5d')];_0x3adc19+=0x1){socket[_0xd87d('0x73')](_0xd87d('0x8d'),{'UserId':Number(_0xf5d415['query'][_0xd87d('0x6b')][_0x3adc19]),'OpenchannelQueueId':Number(_0xf5d415[_0xd87d('0x4e')]['id'])});}}else{socket[_0xd87d('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0xf5d415[_0xd87d('0x3a')]['ids']),'OpenchannelQueueId':Number(_0xf5d415[_0xd87d('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3646ee,null))[_0xd87d('0x4c')](handleError(_0x3646ee,null));};exports[_0xd87d('0x8e')]=function(_0x209805,_0x152475,_0x1a5af4){var _0xafc06a={};var _0xc6dd5a={};var _0x3b737b;var _0x323f70;return db[_0xd87d('0x32')]['findOne']({'where':{'id':_0x209805[_0xd87d('0x4e')]['id']}})[_0xd87d('0x2b')](handleEntityNotFound(_0x152475,null))[_0xd87d('0x2b')](function(_0x5636b3){if(_0x5636b3){_0x3b737b=_0x5636b3;_0xc6dd5a['model']=_[_0xd87d('0x39')](db[_0xd87d('0x6c')][_0xd87d('0x33')]);_0xc6dd5a['query']=_[_0xd87d('0x39')](_0x209805[_0xd87d('0x3a')]);_0xc6dd5a[_0xd87d('0x3b')]=_['intersection'](_0xc6dd5a[_0xd87d('0x37')],_0xc6dd5a[_0xd87d('0x3a')]);_0xafc06a['attributes']=_['intersection'](_0xc6dd5a[_0xd87d('0x37')],qs[_0xd87d('0x3d')](_0x209805[_0xd87d('0x3a')]['fields']));_0xafc06a[_0xd87d('0x3e')]=_0xafc06a[_0xd87d('0x3e')][_0xd87d('0x5d')]?_0xafc06a[_0xd87d('0x3e')]:_0xc6dd5a[_0xd87d('0x37')];_0xafc06a[_0xd87d('0x40')]=qs[_0xd87d('0x41')](_0x209805[_0xd87d('0x3a')]['sort']);_0xafc06a['where']=qs[_0xd87d('0x3b')](_[_0xd87d('0x43')](_0x209805[_0xd87d('0x3a')],_0xc6dd5a[_0xd87d('0x3b')]));if(_0x209805['query'][_0xd87d('0x45')]){_0xafc06a['where']=_['merge'](_0xafc06a[_0xd87d('0x42')],{'$or':_[_0xd87d('0x38')](_0xafc06a[_0xd87d('0x3e')],function(_0x1c268e){var _0x404b98={};_0x404b98[_0x1c268e]={'$like':'%'+_0x209805[_0xd87d('0x3a')][_0xd87d('0x45')]+'%'};return _0x404b98;})});}_0xafc06a=_[_0xd87d('0x46')]({},_0xafc06a,_0x209805[_0xd87d('0x47')]);return _0x3b737b[_0xd87d('0x8e')](_0xafc06a);}})[_0xd87d('0x2b')](function(_0x48a297){if(_0x48a297){_0x323f70=_0x48a297[_0xd87d('0x5d')];if(!_0x209805[_0xd87d('0x3a')][_0xd87d('0x5e')](_0xd87d('0x3f'))){_0xafc06a[_0xd87d('0x25')]=qs['limit'](_0x209805[_0xd87d('0x3a')][_0xd87d('0x25')]);_0xafc06a[_0xd87d('0x24')]=qs['offset'](_0x209805[_0xd87d('0x3a')][_0xd87d('0x24')]);}return _0x3b737b[_0xd87d('0x8e')](_0xafc06a);}})[_0xd87d('0x2b')](function(_0x6b3f4){if(_0x6b3f4){return _0x6b3f4?{'count':_0x323f70,'rows':_0x6b3f4}:null;}})['then'](respondWithResult(_0x152475,null))[_0xd87d('0x4c')](handleError(_0x152475,null));}; \ No newline at end of file +var _0xe0dd=['moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','SIP','Team','nolimit','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x40a1db,_0x59f2bc){var _0x51a111=function(_0x44b4cb){while(--_0x44b4cb){_0x40a1db['push'](_0x40a1db['shift']());}};_0x51a111(++_0x59f2bc);}(_0xe0dd,0x115));var _0xde0d=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xe0dd[_0x3cea78];return _0x33b66b;};'use strict';var pdf=require(_0xde0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde0d('0x1'));var zipdir=require(_0xde0d('0x2'));var jsonpatch=require(_0xde0d('0x3'));var rp=require(_0xde0d('0x4'));var moment=require(_0xde0d('0x5'));var BPromise=require(_0xde0d('0x6'));var Mustache=require(_0xde0d('0x7'));var util=require(_0xde0d('0x8'));var path=require('path');var sox=require(_0xde0d('0x9'));var csv=require(_0xde0d('0xa'));var ejs=require(_0xde0d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xde0d('0xc'));var deskjs=require(_0xde0d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xde0d('0xe'));var Papa=require(_0xde0d('0xf'));var Redis=require(_0xde0d('0x10'));var authService=require(_0xde0d('0x11'));var qs=require(_0xde0d('0x12'));var as=require(_0xde0d('0x13'));var hardwareService=require(_0xde0d('0x14'));var logger=require(_0xde0d('0x15'))(_0xde0d('0x16'));var utils=require(_0xde0d('0x17'));var config=require(_0xde0d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xde0d('0x19')]=_[_0xde0d('0x1a')](config[_0xde0d('0x19')],{'host':_0xde0d('0x1b'),'port':0x18eb});var socket=require(_0xde0d('0x1c'))(new Redis(config[_0xde0d('0x19')]));require(_0xde0d('0x1d'))['register'](socket);function respondWithStatusCode(_0xe3e234,_0x5af37f){_0x5af37f=_0x5af37f||0xcc;return function(_0xc90786){if(_0xc90786){return _0xe3e234[_0xde0d('0x1e')](_0x5af37f);}return _0xe3e234[_0xde0d('0x1f')](_0x5af37f)[_0xde0d('0x20')]();};}function respondWithResult(_0x51942a,_0x1b2b5f){_0x1b2b5f=_0x1b2b5f||0xc8;return function(_0x1f70c5){if(_0x1f70c5){return _0x51942a['status'](_0x1b2b5f)[_0xde0d('0x21')](_0x1f70c5);}};}function respondWithFilteredResult(_0xd5eb3c,_0x4a7c46){return function(_0x3ebc29){if(_0x3ebc29){var _0x5235cf=_0x3ebc29[_0xde0d('0x22')],_0x57ef55=_0x4a7c46['offset'],_0x229c6a=_0x4a7c46[_0xde0d('0x23')]+_0x4a7c46[_0xde0d('0x24')],_0x369de0;if(_0x229c6a>=_0x5235cf){_0x229c6a=_0x5235cf;_0x369de0=0xc8;}else{_0x369de0=0xce;}_0xd5eb3c['status'](_0x369de0);return _0xd5eb3c['set'](_0xde0d('0x25'),_0x57ef55+'-'+_0x229c6a+'/'+_0x5235cf)['json'](_0x3ebc29);}return null;};}function patchUpdates(_0x3fec95){return function(_0x2c4863){try{jsonpatch[_0xde0d('0x26')](_0x2c4863,_0x3fec95,!![]);}catch(_0x2370df){return BPromise[_0xde0d('0x27')](_0x2370df);}return _0x2c4863[_0xde0d('0x28')]();};}function saveUpdates(_0x23db0b,_0x2fba40){return function(_0x4f2257){if(_0x4f2257){return _0x4f2257[_0xde0d('0x29')](_0x23db0b)[_0xde0d('0x2a')](function(_0x5e5700){return _0x5e5700;});}return null;};}function removeEntity(_0x371f20,_0x3d1d39){return function(_0x39ece6){if(_0x39ece6){return _0x39ece6[_0xde0d('0x2b')]()[_0xde0d('0x2a')](function(){var _0x76d922=_0x39ece6[_0xde0d('0x2c')]({'plain':!![]});var _0x29321d=_0xde0d('0x2d');return db['UserProfileResource'][_0xde0d('0x2b')]({'where':{'type':_0x29321d,'resourceId':_0x76d922['id']}})[_0xde0d('0x2a')](function(){return _0x39ece6;});})[_0xde0d('0x2a')](function(){_0x371f20[_0xde0d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d558a,_0x219b58){return function(_0x45efb3){if(!_0x45efb3){_0x5d558a[_0xde0d('0x1e')](0x194);}return _0x45efb3;};}function handleError(_0x1b8195,_0x5b2fa6){_0x5b2fa6=_0x5b2fa6||0x1f4;return function(_0x24d6f0){logger[_0xde0d('0x2e')](_0x24d6f0[_0xde0d('0x2f')]);if(_0x24d6f0[_0xde0d('0x30')]){delete _0x24d6f0[_0xde0d('0x30')];}_0x1b8195[_0xde0d('0x1f')](_0x5b2fa6)[_0xde0d('0x31')](_0x24d6f0);};}exports[_0xde0d('0x32')]=function(_0x401404,_0x5cd072){var _0x3b0d9e={},_0x1091c3={},_0x157649={'count':0x0,'rows':[]};var _0x3ca562=_[_0xde0d('0x33')](db[_0xde0d('0x34')][_0xde0d('0x35')],function(_0x32fa02){return{'name':_0x32fa02[_0xde0d('0x36')],'type':_0x32fa02['type'][_0xde0d('0x37')]};});_0x1091c3[_0xde0d('0x38')]=_[_0xde0d('0x33')](_0x3ca562,_0xde0d('0x30'));_0x1091c3[_0xde0d('0x39')]=_[_0xde0d('0x3a')](_0x401404[_0xde0d('0x39')]);_0x1091c3[_0xde0d('0x3b')]=_[_0xde0d('0x3c')](_0x1091c3['model'],_0x1091c3['query']);_0x3b0d9e[_0xde0d('0x3d')]=_[_0xde0d('0x3c')](_0x1091c3[_0xde0d('0x38')],qs[_0xde0d('0x3e')](_0x401404[_0xde0d('0x39')]['fields']));_0x3b0d9e[_0xde0d('0x3d')]=_0x3b0d9e[_0xde0d('0x3d')]['length']?_0x3b0d9e[_0xde0d('0x3d')]:_0x1091c3['model'];if(!_0x401404['query']['hasOwnProperty']('nolimit')){_0x3b0d9e['limit']=qs[_0xde0d('0x24')](_0x401404[_0xde0d('0x39')][_0xde0d('0x24')]);_0x3b0d9e['offset']=qs[_0xde0d('0x23')](_0x401404[_0xde0d('0x39')][_0xde0d('0x23')]);}_0x3b0d9e[_0xde0d('0x3f')]=qs[_0xde0d('0x40')](_0x401404[_0xde0d('0x39')][_0xde0d('0x40')]);_0x3b0d9e[_0xde0d('0x41')]=qs[_0xde0d('0x3b')](_[_0xde0d('0x42')](_0x401404[_0xde0d('0x39')],_0x1091c3[_0xde0d('0x3b')]),_0x3ca562);if(_0x401404['query']['filter']){_0x3b0d9e[_0xde0d('0x41')]=_['merge'](_0x3b0d9e[_0xde0d('0x41')],{'$or':_[_0xde0d('0x33')](_0x3ca562,function(_0x933709){if(_0x933709['type']!==_0xde0d('0x43')){var _0x58a169={};_0x58a169[_0x933709[_0xde0d('0x30')]]={'$like':'%'+_0x401404[_0xde0d('0x39')][_0xde0d('0x44')]+'%'};return _0x58a169;}})});}_0x3b0d9e=_[_0xde0d('0x45')]({},_0x3b0d9e,_0x401404[_0xde0d('0x46')]);var _0x4ab36c={'where':_0x3b0d9e[_0xde0d('0x41')]};return db[_0xde0d('0x34')][_0xde0d('0x22')](_0x4ab36c)[_0xde0d('0x2a')](function(_0x197a1d){_0x157649[_0xde0d('0x22')]=_0x197a1d;if(_0x401404[_0xde0d('0x39')]['includeAll']){_0x3b0d9e[_0xde0d('0x47')]=[{'all':!![]}];}return db[_0xde0d('0x34')][_0xde0d('0x48')](_0x3b0d9e);})[_0xde0d('0x2a')](function(_0x285011){_0x157649['rows']=_0x285011;return _0x157649;})['then'](respondWithFilteredResult(_0x5cd072,_0x3b0d9e))[_0xde0d('0x49')](handleError(_0x5cd072,null));};exports['show']=function(_0x5c9a8f,_0x271ae9){var _0x509216={'raw':!![],'where':{'id':_0x5c9a8f[_0xde0d('0x4a')]['id']}},_0x37b24e={};_0x37b24e[_0xde0d('0x38')]=_['keys'](db[_0xde0d('0x34')][_0xde0d('0x35')]);_0x37b24e[_0xde0d('0x39')]=_[_0xde0d('0x3a')](_0x5c9a8f[_0xde0d('0x39')]);_0x37b24e['filters']=_['intersection'](_0x37b24e['model'],_0x37b24e[_0xde0d('0x39')]);_0x509216['attributes']=_['intersection'](_0x37b24e[_0xde0d('0x38')],qs['fields'](_0x5c9a8f[_0xde0d('0x39')]['fields']));_0x509216[_0xde0d('0x3d')]=_0x509216['attributes'][_0xde0d('0x4b')]?_0x509216['attributes']:_0x37b24e['model'];if(_0x5c9a8f[_0xde0d('0x39')][_0xde0d('0x4c')]){_0x509216[_0xde0d('0x47')]=[{'all':!![]}];}_0x509216=_['merge']({},_0x509216,_0x5c9a8f[_0xde0d('0x46')]);return db[_0xde0d('0x34')][_0xde0d('0x4d')](_0x509216)[_0xde0d('0x2a')](handleEntityNotFound(_0x271ae9,null))[_0xde0d('0x2a')](respondWithResult(_0x271ae9,null))[_0xde0d('0x49')](handleError(_0x271ae9,null));};exports[_0xde0d('0x4e')]=function(_0x5531b5,_0x36ecca){return db[_0xde0d('0x34')]['create'](_0x5531b5['body'],{})[_0xde0d('0x2a')](function(_0x526c9c){var _0x5b354d=_0x5531b5[_0xde0d('0x4f')][_0xde0d('0x2c')]({'plain':!![]});if(!_0x5b354d)throw new Error(_0xde0d('0x50'));if(_0x5b354d['role']===_0xde0d('0x4f')){var _0x230a95=_0x526c9c[_0xde0d('0x2c')]({'plain':!![]});var _0x238340=_0xde0d('0x2d');return db[_0xde0d('0x51')][_0xde0d('0x4d')]({'where':{'name':_0x238340,'userProfileId':_0x5b354d[_0xde0d('0x52')]},'raw':!![]})[_0xde0d('0x2a')](function(_0x302414){if(_0x302414&&_0x302414['autoAssociation']===0x0){return db[_0xde0d('0x53')][_0xde0d('0x4e')]({'name':_0x230a95['name'],'resourceId':_0x230a95['id'],'type':_0x302414[_0xde0d('0x30')],'sectionId':_0x302414['id']},{})[_0xde0d('0x2a')](function(){return _0x526c9c;});}else{return _0x526c9c;}})[_0xde0d('0x49')](function(_0x1ba375){logger[_0xde0d('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ba375);throw _0x1ba375;});}return _0x526c9c;})[_0xde0d('0x2a')](respondWithResult(_0x36ecca,0xc9))[_0xde0d('0x49')](handleError(_0x36ecca,null));};exports[_0xde0d('0x29')]=function(_0x17ff4f,_0x4277a2){if(_0x17ff4f[_0xde0d('0x54')]['id']){delete _0x17ff4f[_0xde0d('0x54')]['id'];}return db['OpenchannelQueue'][_0xde0d('0x4d')]({'where':{'id':_0x17ff4f[_0xde0d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4277a2,null))[_0xde0d('0x2a')](saveUpdates(_0x17ff4f[_0xde0d('0x54')],null))[_0xde0d('0x2a')](respondWithResult(_0x4277a2,null))[_0xde0d('0x49')](handleError(_0x4277a2,null));};exports[_0xde0d('0x2b')]=function(_0x11e7ae,_0x5ca75c){return db[_0xde0d('0x34')][_0xde0d('0x4d')]({'where':{'id':_0x11e7ae[_0xde0d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ca75c,null))[_0xde0d('0x2a')](removeEntity(_0x5ca75c,null))['catch'](handleError(_0x5ca75c,null));};exports[_0xde0d('0x55')]=function(_0x18f572,_0x58ffca){return db[_0xde0d('0x34')]['describe']()[_0xde0d('0x2a')](respondWithResult(_0x58ffca,null))[_0xde0d('0x49')](handleError(_0x58ffca,null));};exports[_0xde0d('0x56')]=function(_0xc5724e,_0x3e081e,_0x5dc7bd){var _0x58d088={'raw':!![],'where':{}},_0x27ca4b={},_0x116c8d;return db[_0xde0d('0x34')][_0xde0d('0x57')]({'where':{'id':_0xc5724e[_0xde0d('0x4a')]['id']}})[_0xde0d('0x2a')](handleEntityNotFound(_0x3e081e,null))[_0xde0d('0x2a')](function(_0x3398d1){if(_0x3398d1){_0x116c8d=_0x3398d1[_0xde0d('0x2c')]({'plain':!![]});_0x27ca4b[_0xde0d('0x38')]=_[_0xde0d('0x3a')](db[_0xde0d('0x58')][_0xde0d('0x35')]);_0x27ca4b[_0xde0d('0x39')]=_['keys'](_0xc5724e[_0xde0d('0x39')]);_0x27ca4b['filters']=_['intersection'](_0x27ca4b[_0xde0d('0x38')],_0x27ca4b[_0xde0d('0x39')]);_0x58d088[_0xde0d('0x3d')]=_[_0xde0d('0x3c')](_0x27ca4b['model'],qs[_0xde0d('0x3e')](_0xc5724e[_0xde0d('0x39')][_0xde0d('0x3e')]));_0x58d088['attributes']=_0x58d088[_0xde0d('0x3d')][_0xde0d('0x4b')]?_0x58d088['attributes']:_0x27ca4b['model'];if(!_0xc5724e['query'][_0xde0d('0x59')]('nolimit')){_0x58d088[_0xde0d('0x24')]=qs['limit'](_0xc5724e[_0xde0d('0x39')]['limit']);_0x58d088[_0xde0d('0x23')]=qs[_0xde0d('0x23')](_0xc5724e['query']['offset']);}_0x58d088['order']=qs[_0xde0d('0x40')](_0xc5724e['query'][_0xde0d('0x40')]);_0x58d088[_0xde0d('0x41')]=qs[_0xde0d('0x3b')](_['pick'](_0xc5724e[_0xde0d('0x39')],_0x27ca4b[_0xde0d('0x3b')]));_0x58d088[_0xde0d('0x41')][_0xde0d('0x5a')]=_0x3398d1['id'];if(_0xc5724e[_0xde0d('0x39')][_0xde0d('0x44')]){_0x58d088[_0xde0d('0x41')]=_[_0xde0d('0x45')](_0x58d088['where'],{'$or':_['map'](_0x58d088[_0xde0d('0x3d')],function(_0x51ef85){var _0x52f00a={};_0x52f00a[_0x51ef85]={'$like':'%'+_0xc5724e['query'][_0xde0d('0x44')]+'%'};return _0x52f00a;})});}_0x58d088=_[_0xde0d('0x45')]({},_0x58d088,_0xc5724e['options']);return db['UserOpenchannelQueue'][_0xde0d('0x48')](_0x58d088);}})[_0xde0d('0x2a')](function(_0x55f21e){if(_0x55f21e){return db[_0xde0d('0x5b')][_0xde0d('0x5c')]({'where':{'id':_[_0xde0d('0x33')](_0x55f21e,_0xde0d('0x5d')),'role':_0xde0d('0x5e')},'attributes':['id',_0xde0d('0x30'),_0xde0d('0x5f'),_0xde0d('0x60'),_0xde0d('0x61')]});}})[_0xde0d('0x2a')](function(_0x4b3de6){if(_0x4b3de6){return{'count':_0x4b3de6['count'],'rows':_[_0xde0d('0x33')](_0x4b3de6[_0xde0d('0x62')],function(_0x1c233e){return{'membername':_0x1c233e[_0xde0d('0x30')],'UserId':_0x1c233e['id'],'queue_name':_0x116c8d[_0xde0d('0x30')],'OpenchannelQueueId':_0x116c8d['id'],'interface':util['format'](_0xde0d('0x63'),_0xde0d('0x64'),_0x1c233e[_0xde0d('0x30')]),'penalty':0x0,'paused':_0x1c233e[_0xde0d('0x5f')],'createdAt':_0x1c233e[_0xde0d('0x61')],'updatedAt':_0x1c233e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3e081e,_0x58d088))[_0xde0d('0x49')](handleError(_0x3e081e,null));};exports['getTeams']=function(_0x40d6aa,_0x22b34d,_0x284eab){var _0x540bf6={};var _0x1fd2df={};var _0x289292;var _0x21ce24;return db[_0xde0d('0x34')][_0xde0d('0x57')]({'where':{'id':_0x40d6aa['params']['id']}})[_0xde0d('0x2a')](handleEntityNotFound(_0x22b34d,null))[_0xde0d('0x2a')](function(_0x640877){if(_0x640877){_0x289292=_0x640877;_0x1fd2df[_0xde0d('0x38')]=_['keys'](db[_0xde0d('0x65')][_0xde0d('0x35')]);_0x1fd2df[_0xde0d('0x39')]=_[_0xde0d('0x3a')](_0x40d6aa[_0xde0d('0x39')]);_0x1fd2df[_0xde0d('0x3b')]=_[_0xde0d('0x3c')](_0x1fd2df['model'],_0x1fd2df[_0xde0d('0x39')]);_0x540bf6[_0xde0d('0x3d')]=_['intersection'](_0x1fd2df[_0xde0d('0x38')],qs[_0xde0d('0x3e')](_0x40d6aa['query']['fields']));_0x540bf6[_0xde0d('0x3d')]=_0x540bf6[_0xde0d('0x3d')][_0xde0d('0x4b')]?_0x540bf6[_0xde0d('0x3d')]:_0x1fd2df[_0xde0d('0x38')];_0x540bf6[_0xde0d('0x3f')]=qs[_0xde0d('0x40')](_0x40d6aa[_0xde0d('0x39')][_0xde0d('0x40')]);_0x540bf6[_0xde0d('0x41')]=qs[_0xde0d('0x3b')](_[_0xde0d('0x42')](_0x40d6aa[_0xde0d('0x39')],_0x1fd2df[_0xde0d('0x3b')]));if(_0x40d6aa[_0xde0d('0x39')][_0xde0d('0x44')]){_0x540bf6[_0xde0d('0x41')]=_[_0xde0d('0x45')](_0x540bf6[_0xde0d('0x41')],{'$or':_[_0xde0d('0x33')](_0x540bf6[_0xde0d('0x3d')],function(_0x5e48a6){var _0x1bfdb1={};_0x1bfdb1[_0x5e48a6]={'$like':'%'+_0x40d6aa[_0xde0d('0x39')]['filter']+'%'};return _0x1bfdb1;})});}_0x540bf6=_['merge']({},_0x540bf6,_0x40d6aa['options']);return _0x289292['getTeams'](_0x540bf6);}})[_0xde0d('0x2a')](function(_0x18c8e3){if(_0x18c8e3){_0x21ce24=_0x18c8e3[_0xde0d('0x4b')];if(!_0x40d6aa['query']['hasOwnProperty'](_0xde0d('0x66'))){_0x540bf6[_0xde0d('0x24')]=qs[_0xde0d('0x24')](_0x40d6aa[_0xde0d('0x39')][_0xde0d('0x24')]);_0x540bf6[_0xde0d('0x23')]=qs['offset'](_0x40d6aa['query'][_0xde0d('0x23')]);}return _0x289292[_0xde0d('0x67')](_0x540bf6);}})['then'](function(_0x3fac33){if(_0x3fac33){return _0x3fac33?{'count':_0x21ce24,'rows':_0x3fac33}:null;}})[_0xde0d('0x2a')](respondWithResult(_0x22b34d,null))[_0xde0d('0x49')](handleError(_0x22b34d,null));};exports[_0xde0d('0x68')]=function(_0x3e6c8f,_0x1dda36,_0x5701be){var _0x12f9e2=_0x3e6c8f[_0xde0d('0x54')][_0xde0d('0x69')];return db[_0xde0d('0x65')][_0xde0d('0x48')]({'where':{'id':_0x12f9e2},'attributes':['id'],'include':[{'model':db['User'],'as':_0xde0d('0x6a'),'attributes':['id',_0xde0d('0x30'),_0xde0d('0x6b'),_0xde0d('0x6c'),_0xde0d('0x6d')],'raw':!![]}]})[_0xde0d('0x2a')](function(_0x4c22d6){if(_0x4c22d6){var _0x106670=_[_0xde0d('0x6e')](_0x4c22d6,function(_0x32180d){var _0x596bee=_0x32180d[_0xde0d('0x2c')]({'plain':!![]});return _0x596bee[_0xde0d('0x6a')];});return db[_0xde0d('0x34')][_0xde0d('0x4d')]({'where':{'id':_0x3e6c8f[_0xde0d('0x4a')]['id']}})['then'](function(_0x23885a){return db[_0xde0d('0x6f')]['transaction'](function(_0x4efb99){return _0x23885a[_0xde0d('0x68')](_0x12f9e2,{'transaction':_0x4efb99})['then'](function(){return BPromise[_0xde0d('0x70')](_0x106670,function(_0x558bbb){return db[_0xde0d('0x58')]['findOrCreate']({'where':{'UserId':_0x558bbb['id'],'OpenchannelQueueId':_0x3e6c8f[_0xde0d('0x4a')]['id']},'transaction':_0x4efb99});});})[_0xde0d('0x2a')](function(){_0x106670[_0xde0d('0x71')](function(_0x5cf659){socket[_0xde0d('0x72')](_0xde0d('0x73'),{'UserId':_0x5cf659['id'],'OpenchannelQueueId':_0x23885a['id']});});});});});}})['then'](respondWithStatusCode(_0x1dda36,null))['catch'](handleError(_0x1dda36,null));};exports['removeTeams']=function(_0x35aaf5,_0x4b8bc6,_0x4a570b){return db[_0xde0d('0x65')][_0xde0d('0x48')]({'where':{'id':_0x35aaf5['query'][_0xde0d('0x69')]},'attributes':['id'],'include':[{'model':db[_0xde0d('0x5b')],'as':_0xde0d('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xde0d('0x2a')](handleEntityNotFound(_0x4b8bc6,null))['then'](function(_0x1d3272){var _0x2098a6=_['map'](_0x1d3272,'id');var _0x56ba5c=[];var _0x5f1176=[];var _0x39d905=squel[_0xde0d('0x74')]();_0x39d905[_0xde0d('0x75')](_0xde0d('0x76'))['from']('team_has_openchannel_queues','tq')[_0xde0d('0x77')](_0xde0d('0x78'),'ut',_0xde0d('0x79'))['where'](_0xde0d('0x7a'),_0x35aaf5[_0xde0d('0x4a')]['id']);for(var _0x1a6568=0x0;_0x1a6568<_0x1d3272[_0xde0d('0x4b')];_0x1a6568+=0x1){let _0x1649bb=_0x1d3272[_0x1a6568];for(var _0xce0bee=0x0;_0xce0bee<_0x1649bb[_0xde0d('0x6a')]['length'];_0xce0bee+=0x1){let _0x56ef9d=_0x1649bb[_0xde0d('0x6a')][_0xce0bee];var _0x1479a3=_0x39d905[_0xde0d('0x7b')]();_0x1479a3[_0xde0d('0x41')](_0xde0d('0x7c'),_0x56ef9d['id']);_0x5f1176[_0xde0d('0x7d')](db['sequelize'][_0xde0d('0x39')](_0x1479a3[_0xde0d('0x7e')](),{'type':db[_0xde0d('0x6f')][_0xde0d('0x7f')][_0xde0d('0x80')]})[_0xde0d('0x2a')](function(_0x14d3db){if(_0x14d3db[_0xde0d('0x4b')]===0x1){return _0x56ef9d['id'];}else{var _0x409419=_[_0xde0d('0x81')](_[_0xde0d('0x33')](_0x14d3db,'TeamId'),function(_0x2e10a8){return _[_0xde0d('0x82')](_0x2098a6,_0x2e10a8);});if(_0x409419){return _0x56ef9d['id'];}}}));}}return BPromise[_0xde0d('0x83')](_0x5f1176)[_0xde0d('0x2a')](function(_0x2e6880){_0x56ba5c=_(_0x56ba5c)['union'](_0x2e6880)['compact']()[_0xde0d('0x84')]();return db[_0xde0d('0x34')]['find']({'where':{'id':_0x35aaf5[_0xde0d('0x4a')]['id']}})['then'](function(_0x1e4177){return db[_0xde0d('0x6f')]['transaction'](function(_0xc7c6d0){return _0x1e4177[_0xde0d('0x85')](_0x35aaf5[_0xde0d('0x39')]['ids'],{'transaction':_0xc7c6d0})[_0xde0d('0x2a')](function(){if(!_[_0xde0d('0x86')](_0x56ba5c)){return _0x1e4177[_0xde0d('0x87')](_0x56ba5c,{'transaction':_0xc7c6d0});}})[_0xde0d('0x2a')](function(){_0x56ba5c['forEach'](function(_0x4efc5b){socket['emit'](_0xde0d('0x88'),{'UserId':_0x4efc5b,'OpenchannelQueueId':_0x1e4177['id']});});});});});});})[_0xde0d('0x2a')](respondWithStatusCode(_0x4b8bc6,null))['catch'](handleError(_0x4b8bc6,null));};exports[_0xde0d('0x89')]=function(_0x1499c6,_0x4f455f,_0x2c6043){return db[_0xde0d('0x34')][_0xde0d('0x4d')]({'where':{'id':_0x1499c6[_0xde0d('0x4a')]['id']}})[_0xde0d('0x2a')](handleEntityNotFound(_0x4f455f,null))[_0xde0d('0x2a')](function(_0x1082b1){if(_0x1082b1){return _0x1082b1['addAgents'](_0x1499c6[_0xde0d('0x54')][_0xde0d('0x69')],_[_0xde0d('0x8a')](_0x1499c6['body'],['ids','id'])||{})['spread'](function(_0x212a1e){for(var _0x174010=0x0;_0x174010<_0x1499c6['body']['ids'][_0xde0d('0x4b')];_0x174010+=0x1){socket[_0xde0d('0x72')](_0xde0d('0x73'),{'UserId':_0x1499c6[_0xde0d('0x54')][_0xde0d('0x69')][_0x174010],'OpenchannelQueueId':_0x1499c6[_0xde0d('0x4a')]['id']});}return _0x212a1e;});}})[_0xde0d('0x2a')](respondWithResult(_0x4f455f,null))['catch'](handleError(_0x4f455f,null));};exports[_0xde0d('0x87')]=function(_0x59341d,_0x3a4b4b,_0x6bcc2b){return db[_0xde0d('0x34')]['find']({'where':{'id':_0x59341d['params']['id']}})[_0xde0d('0x2a')](handleEntityNotFound(_0x3a4b4b,null))['then'](function(_0x1cc209){if(_0x1cc209){return _0x1cc209[_0xde0d('0x87')](_0x59341d['query'][_0xde0d('0x69')])[_0xde0d('0x2a')](function(){if(_[_0xde0d('0x8b')](_0x59341d['query']['ids'])){for(var _0x4fac67=0x0;_0x4fac67<_0x59341d[_0xde0d('0x39')][_0xde0d('0x69')][_0xde0d('0x4b')];_0x4fac67+=0x1){socket[_0xde0d('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x59341d[_0xde0d('0x39')][_0xde0d('0x69')][_0x4fac67]),'OpenchannelQueueId':Number(_0x59341d['params']['id'])});}}else{socket[_0xde0d('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x59341d[_0xde0d('0x39')]['ids']),'OpenchannelQueueId':Number(_0x59341d[_0xde0d('0x4a')]['id'])});}});}})[_0xde0d('0x2a')](respondWithStatusCode(_0x3a4b4b,null))[_0xde0d('0x49')](handleError(_0x3a4b4b,null));};exports[_0xde0d('0x8c')]=function(_0x5f0861,_0x7ee532,_0x2640e7){var _0x138d43={};var _0x4b116b={};var _0x24425b;var _0x25348f;return db[_0xde0d('0x34')][_0xde0d('0x57')]({'where':{'id':_0x5f0861[_0xde0d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7ee532,null))[_0xde0d('0x2a')](function(_0x1711ca){if(_0x1711ca){_0x24425b=_0x1711ca;_0x4b116b['model']=_[_0xde0d('0x3a')](db[_0xde0d('0x5b')][_0xde0d('0x35')]);_0x4b116b[_0xde0d('0x39')]=_[_0xde0d('0x3a')](_0x5f0861[_0xde0d('0x39')]);_0x4b116b[_0xde0d('0x3b')]=_['intersection'](_0x4b116b[_0xde0d('0x38')],_0x4b116b[_0xde0d('0x39')]);_0x138d43[_0xde0d('0x3d')]=_['intersection'](_0x4b116b[_0xde0d('0x38')],qs[_0xde0d('0x3e')](_0x5f0861[_0xde0d('0x39')][_0xde0d('0x3e')]));_0x138d43['attributes']=_0x138d43[_0xde0d('0x3d')][_0xde0d('0x4b')]?_0x138d43[_0xde0d('0x3d')]:_0x4b116b[_0xde0d('0x38')];_0x138d43['order']=qs[_0xde0d('0x40')](_0x5f0861['query'][_0xde0d('0x40')]);_0x138d43['where']=qs[_0xde0d('0x3b')](_['pick'](_0x5f0861[_0xde0d('0x39')],_0x4b116b[_0xde0d('0x3b')]));if(_0x5f0861[_0xde0d('0x39')][_0xde0d('0x44')]){_0x138d43[_0xde0d('0x41')]=_[_0xde0d('0x45')](_0x138d43[_0xde0d('0x41')],{'$or':_[_0xde0d('0x33')](_0x138d43['attributes'],function(_0x2415a0){var _0x1e0ad8={};_0x1e0ad8[_0x2415a0]={'$like':'%'+_0x5f0861['query'][_0xde0d('0x44')]+'%'};return _0x1e0ad8;})});}_0x138d43=_[_0xde0d('0x45')]({},_0x138d43,_0x5f0861['options']);return _0x24425b['getAgents'](_0x138d43);}})[_0xde0d('0x2a')](function(_0x43850c){if(_0x43850c){_0x25348f=_0x43850c[_0xde0d('0x4b')];if(!_0x5f0861['query'][_0xde0d('0x59')](_0xde0d('0x66'))){_0x138d43[_0xde0d('0x24')]=qs['limit'](_0x5f0861[_0xde0d('0x39')][_0xde0d('0x24')]);_0x138d43[_0xde0d('0x23')]=qs[_0xde0d('0x23')](_0x5f0861[_0xde0d('0x39')][_0xde0d('0x23')]);}return _0x24425b[_0xde0d('0x8c')](_0x138d43);}})[_0xde0d('0x2a')](function(_0x3fd578){if(_0x3fd578){return _0x3fd578?{'count':_0x25348f,'rows':_0x3fd578}:null;}})[_0xde0d('0x2a')](respondWithResult(_0x7ee532,null))[_0xde0d('0x49')](handleError(_0x7ee532,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 11b6045..b51be9b 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 _0xbd51=['hook','exports','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x29e61b,_0x32acb6){var _0x5eebc0=function(_0x24809c){while(--_0x24809c){_0x29e61b['push'](_0x29e61b['shift']());}};_0x5eebc0(++_0x32acb6);}(_0xbd51,0x9a));var _0x1bd5=function(_0x1cacb5,_0x558829){_0x1cacb5=_0x1cacb5-0x0;var _0x3b2d79=_0xbd51[_0x1cacb5];return _0x3b2d79;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x1bd5('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1bd5('0x1')](0x0);var events={'afterCreate':_0x1bd5('0x2'),'afterUpdate':'update','afterDestroy':_0x1bd5('0x3')};function emitEvent(_0x304bd4){return function(_0x4e8141,_0x183d74,_0x2699a2){OpenchannelQueueEvents[_0x1bd5('0x4')](_0x304bd4+':'+_0x4e8141['id'],_0x4e8141);OpenchannelQueueEvents['emit'](_0x304bd4,_0x4e8141);_0x2699a2(null);};}for(var e in events){if(events[_0x1bd5('0x5')](e)){var event=events[e];OpenchannelQueue[_0x1bd5('0x6')](e,emitEvent(event));}}module[_0x1bd5('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xdf80=['OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','events'];(function(_0x2d3138,_0x39ea8f){var _0x543d35=function(_0x701a35){while(--_0x701a35){_0x2d3138['push'](_0x2d3138['shift']());}};_0x543d35(++_0x39ea8f);}(_0xdf80,0x156));var _0x0df8=function(_0x537e89,_0x575254){_0x537e89=_0x537e89-0x0;var _0x58e0c0=_0xdf80[_0x537e89];return _0x58e0c0;};'use strict';var EventEmitter=require(_0x0df8('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x0df8('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0df8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0df8('0x3'),'afterDestroy':_0x0df8('0x4')};function emitEvent(_0xdbc91c){return function(_0x59a58f,_0xf35c06,_0x2a882e){OpenchannelQueueEvents[_0x0df8('0x5')](_0xdbc91c+':'+_0x59a58f['id'],_0x59a58f);OpenchannelQueueEvents[_0x0df8('0x5')](_0xdbc91c,_0x59a58f);_0x2a882e(null);};}for(var e in events){if(events[_0x0df8('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](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 b034ecd..c5c948b 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 _0xa8e2=['api','moment','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger'];(function(_0x52dfb6,_0xd5f97){var _0x45d9e9=function(_0x35ff42){while(--_0x35ff42){_0x52dfb6['push'](_0x52dfb6['shift']());}};_0x45d9e9(++_0xd5f97);}(_0xa8e2,0xa6));var _0x2a8e=function(_0x1c2482,_0x29e23f){_0x1c2482=_0x1c2482-0x0;var _0x268ab7=_0xa8e2[_0x1c2482];return _0x268ab7;};'use strict';var _=require('lodash');var util=require(_0x2a8e('0x0'));var logger=require(_0x2a8e('0x1'))(_0x2a8e('0x2'));var moment=require(_0x2a8e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a8e('0x4'));var rimraf=require(_0x2a8e('0x5'));var config=require(_0x2a8e('0x6'));var attributes=require(_0x2a8e('0x7'));module[_0x2a8e('0x8')]=function(_0x13e7ea,_0xbe3722){return _0x13e7ea[_0x2a8e('0x9')](_0x2a8e('0xa'),attributes,{'tableName':_0x2a8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0219=['bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x0219,0x15a));var _0x9021=function(_0x5eb766,_0x19baac){_0x5eb766=_0x5eb766-0x0;var _0x49396=_0x0219[_0x5eb766];return _0x49396;};'use strict';var _=require(_0x9021('0x0'));var util=require(_0x9021('0x1'));var logger=require(_0x9021('0x2'))(_0x9021('0x3'));var moment=require(_0x9021('0x4'));var BPromise=require(_0x9021('0x5'));var rp=require(_0x9021('0x6'));var fs=require('fs');var path=require(_0x9021('0x7'));var rimraf=require('rimraf');var config=require(_0x9021('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0x9021('0x9')]=function(_0x18ea10,_0x2f0ef2){return _0x18ea10[_0x9021('0xa')](_0x9021('0xb'),attributes,{'tableName':_0x9021('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index eff5802..dee6dd7 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 _0x9bb5=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowOpenchannelQueue','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info'];(function(_0x54d6fa,_0x4d561f){var _0x3499b4=function(_0x1fb1b1){while(--_0x1fb1b1){_0x54d6fa['push'](_0x54d6fa['shift']());}};_0x3499b4(++_0x4d561f);}(_0x9bb5,0x10d));var _0x59bb=function(_0x3eaeee,_0x90b21e){_0x3eaeee=_0x3eaeee-0x0;var _0x393caf=_0x9bb5[_0x3eaeee];return _0x393caf;};'use strict';var _=require('lodash');var util=require(_0x59bb('0x0'));var moment=require(_0x59bb('0x1'));var BPromise=require(_0x59bb('0x2'));var rs=require(_0x59bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x59bb('0x4'));var logger=require(_0x59bb('0x5'))(_0x59bb('0x6'));var config=require(_0x59bb('0x7'));var jayson=require(_0x59bb('0x8'));var client=jayson[_0x59bb('0x9')][_0x59bb('0xa')]({'port':0x232a});config[_0x59bb('0xb')]=_['defaults'](config[_0x59bb('0xb')],{'host':_0x59bb('0xc'),'port':0x18eb});var socket=require(_0x59bb('0xd'))(new Redis(config[_0x59bb('0xb')]));require(_0x59bb('0xe'))[_0x59bb('0xf')](socket);function respondWithRpcPromise(_0x4146f7,_0x3eda4e,_0x5d8b15){return new BPromise(function(_0x1a82f4,_0x2dbf43){return client[_0x59bb('0x10')](_0x4146f7,_0x5d8b15)['then'](function(_0x416c52){logger[_0x59bb('0x11')](_0x59bb('0x12'),_0x3eda4e,_0x59bb('0x13'));logger[_0x59bb('0x14')](_0x59bb('0x15'),_0x3eda4e,_0x59bb('0x13'),JSON[_0x59bb('0x16')](_0x416c52));if(_0x416c52[_0x59bb('0x17')]){if(_0x416c52[_0x59bb('0x17')][_0x59bb('0x18')]===0x1f4){logger[_0x59bb('0x17')](_0x59bb('0x12'),_0x3eda4e,_0x416c52['error'][_0x59bb('0x19')]);return _0x2dbf43(_0x416c52[_0x59bb('0x17')][_0x59bb('0x19')]);}logger[_0x59bb('0x17')](_0x59bb('0x12'),_0x3eda4e,_0x416c52[_0x59bb('0x17')]['message']);return _0x1a82f4(_0x416c52[_0x59bb('0x17')][_0x59bb('0x19')]);}else{logger[_0x59bb('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x3eda4e,_0x59bb('0x13'));_0x1a82f4(_0x416c52[_0x59bb('0x1a')]['message']);}})[_0x59bb('0x1b')](function(_0x59633e){logger[_0x59bb('0x17')](_0x59bb('0x12'),_0x3eda4e,_0x59633e);_0x2dbf43(_0x59633e);});});}exports[_0x59bb('0x1c')]=function(_0x4b8c66){var _0x1df3c7=this;return new Promise(function(_0x532a1e,_0x1a43bb){return db[_0x59bb('0x1d')][_0x59bb('0x1e')]({'raw':_0x4b8c66[_0x59bb('0x1f')]?_0x4b8c66['options'][_0x59bb('0x20')]===undefined?!![]:![]:!![],'where':_0x4b8c66['options']?_0x4b8c66[_0x59bb('0x1f')][_0x59bb('0x21')]||null:null,'attributes':_0x4b8c66[_0x59bb('0x1f')]?_0x4b8c66[_0x59bb('0x1f')][_0x59bb('0x22')]||null:null,'limit':_0x4b8c66[_0x59bb('0x1f')]?_0x4b8c66['options']['limit']||null:null,'include':_0x4b8c66[_0x59bb('0x1f')]?_0x4b8c66['options'][_0x59bb('0x23')]?_[_0x59bb('0x24')](_0x4b8c66[_0x59bb('0x1f')][_0x59bb('0x23')],function(_0x3135b1){return{'model':db[_0x3135b1[_0x59bb('0x25')]],'as':_0x3135b1['as'],'attributes':_0x3135b1[_0x59bb('0x22')],'include':_0x3135b1[_0x59bb('0x23')]?_[_0x59bb('0x24')](_0x3135b1[_0x59bb('0x23')],function(_0x28bb43){return{'model':db[_0x28bb43[_0x59bb('0x25')]],'as':_0x28bb43['as'],'attributes':_0x28bb43[_0x59bb('0x22')],'include':_0x28bb43[_0x59bb('0x23')]?_[_0x59bb('0x24')](_0x28bb43[_0x59bb('0x23')],function(_0x2a5f0c){return{'model':db[_0x2a5f0c[_0x59bb('0x25')]],'as':_0x2a5f0c['as'],'attributes':_0x2a5f0c['attributes']};}):[]};}):[]};}):[]:[]})[_0x59bb('0x26')](function(_0x195b8b){logger[_0x59bb('0x11')](_0x59bb('0x1c'),_0x4b8c66);logger[_0x59bb('0x14')]('GetOpenchannelQueue',_0x4b8c66,JSON['stringify'](_0x195b8b));_0x532a1e(_0x195b8b);})[_0x59bb('0x1b')](function(_0x387cbc){logger[_0x59bb('0x17')](_0x59bb('0x1c'),_0x387cbc[_0x59bb('0x19')],_0x4b8c66);_0x1a43bb(_0x1df3c7[_0x59bb('0x17')](0x1f4,_0x387cbc['message']));});});};exports[_0x59bb('0x27')]=function(_0x48b4be){var _0xc07ee5=this;return new Promise(function(_0xbbe8b0,_0x44367b){return db['OpenchannelQueue'][_0x59bb('0x28')]({'raw':_0x48b4be[_0x59bb('0x1f')]?_0x48b4be[_0x59bb('0x1f')][_0x59bb('0x20')]===undefined?!![]:![]:!![],'where':_0x48b4be[_0x59bb('0x1f')]?_0x48b4be['options'][_0x59bb('0x21')]||null:null,'attributes':_0x48b4be['options']?_0x48b4be[_0x59bb('0x1f')][_0x59bb('0x22')]||null:null,'include':_0x48b4be[_0x59bb('0x1f')]?_0x48b4be[_0x59bb('0x1f')][_0x59bb('0x23')]?_[_0x59bb('0x24')](_0x48b4be['options'][_0x59bb('0x23')],function(_0x33a852){return{'model':db[_0x33a852[_0x59bb('0x25')]],'as':_0x33a852['as'],'attributes':_0x33a852[_0x59bb('0x22')],'include':_0x33a852['include']?_[_0x59bb('0x24')](_0x33a852['include'],function(_0x41e6f2){return{'model':db[_0x41e6f2['model']],'as':_0x41e6f2['as'],'attributes':_0x41e6f2[_0x59bb('0x22')],'include':_0x41e6f2[_0x59bb('0x23')]?_[_0x59bb('0x24')](_0x41e6f2['include'],function(_0x4698a5){return{'model':db[_0x4698a5['model']],'as':_0x4698a5['as'],'attributes':_0x4698a5[_0x59bb('0x22')]};}):[]};}):[]};}):[]:[]})[_0x59bb('0x26')](function(_0xa6c9b0){logger[_0x59bb('0x11')](_0x59bb('0x27'),_0x48b4be);logger[_0x59bb('0x14')]('ShowOpenchannelQueue',_0x48b4be,JSON['stringify'](_0xa6c9b0));_0xbbe8b0(_0xa6c9b0);})[_0x59bb('0x1b')](function(_0x2e0a77){logger[_0x59bb('0x17')](_0x59bb('0x27'),_0x2e0a77[_0x59bb('0x19')],_0x48b4be);_0x44367b(_0xc07ee5['error'](0x1f4,_0x2e0a77[_0x59bb('0x19')]));});});}; \ No newline at end of file +var _0x20f1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','lodash','util','moment'];(function(_0x5ed46a,_0x1ed3bd){var _0x2eebd3=function(_0x4d3073){while(--_0x4d3073){_0x5ed46a['push'](_0x5ed46a['shift']());}};_0x2eebd3(++_0x1ed3bd);}(_0x20f1,0xa5));var _0x120f=function(_0xc9f4bb,_0x120716){_0xc9f4bb=_0xc9f4bb-0x0;var _0x33e037=_0x20f1[_0xc9f4bb];return _0x33e037;};'use strict';var _=require(_0x120f('0x0'));var util=require(_0x120f('0x1'));var moment=require(_0x120f('0x2'));var BPromise=require(_0x120f('0x3'));var rs=require(_0x120f('0x4'));var fs=require('fs');var Redis=require(_0x120f('0x5'));var db=require(_0x120f('0x6'))['db'];var utils=require(_0x120f('0x7'));var logger=require(_0x120f('0x8'))('rpc');var config=require(_0x120f('0x9'));var jayson=require(_0x120f('0xa'));var client=jayson[_0x120f('0xb')][_0x120f('0xc')]({'port':0x232a});config[_0x120f('0xd')]=_['defaults'](config[_0x120f('0xd')],{'host':_0x120f('0xe'),'port':0x18eb});var socket=require(_0x120f('0xf'))(new Redis(config[_0x120f('0xd')]));require('./openchannelQueue.socket')[_0x120f('0x10')](socket);function respondWithRpcPromise(_0x558f89,_0x14feb4,_0x2c1416){return new BPromise(function(_0x24ac46,_0x730695){return client[_0x120f('0x11')](_0x558f89,_0x2c1416)[_0x120f('0x12')](function(_0x9aa725){logger[_0x120f('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x14feb4,_0x120f('0x14'));logger['debug'](_0x120f('0x15'),_0x14feb4,_0x120f('0x14'),JSON[_0x120f('0x16')](_0x9aa725));if(_0x9aa725['error']){if(_0x9aa725[_0x120f('0x17')][_0x120f('0x18')]===0x1f4){logger['error'](_0x120f('0x19'),_0x14feb4,_0x9aa725[_0x120f('0x17')][_0x120f('0x1a')]);return _0x730695(_0x9aa725[_0x120f('0x17')][_0x120f('0x1a')]);}logger[_0x120f('0x17')](_0x120f('0x19'),_0x14feb4,_0x9aa725[_0x120f('0x17')]['message']);return _0x24ac46(_0x9aa725[_0x120f('0x17')][_0x120f('0x1a')]);}else{logger[_0x120f('0x13')](_0x120f('0x19'),_0x14feb4,_0x120f('0x14'));_0x24ac46(_0x9aa725[_0x120f('0x1b')][_0x120f('0x1a')]);}})['catch'](function(_0x9dc296){logger[_0x120f('0x17')](_0x120f('0x19'),_0x14feb4,_0x9dc296);_0x730695(_0x9dc296);});});}exports[_0x120f('0x1c')]=function(_0x2c3e3e){var _0xff65de=this;return new Promise(function(_0x2e7573,_0x258278){return db[_0x120f('0x1d')][_0x120f('0x1e')]({'raw':_0x2c3e3e[_0x120f('0x1f')]?_0x2c3e3e[_0x120f('0x1f')][_0x120f('0x20')]===undefined?!![]:![]:!![],'where':_0x2c3e3e[_0x120f('0x1f')]?_0x2c3e3e[_0x120f('0x1f')][_0x120f('0x21')]||null:null,'attributes':_0x2c3e3e[_0x120f('0x1f')]?_0x2c3e3e[_0x120f('0x1f')][_0x120f('0x22')]||null:null,'limit':_0x2c3e3e[_0x120f('0x1f')]?_0x2c3e3e['options'][_0x120f('0x23')]||null:null,'include':_0x2c3e3e[_0x120f('0x1f')]?_0x2c3e3e[_0x120f('0x1f')][_0x120f('0x24')]?_[_0x120f('0x25')](_0x2c3e3e[_0x120f('0x1f')]['include'],function(_0x506c71){return{'model':db[_0x506c71['model']],'as':_0x506c71['as'],'attributes':_0x506c71[_0x120f('0x22')],'include':_0x506c71[_0x120f('0x24')]?_['map'](_0x506c71[_0x120f('0x24')],function(_0x36fde1){return{'model':db[_0x36fde1['model']],'as':_0x36fde1['as'],'attributes':_0x36fde1['attributes'],'include':_0x36fde1[_0x120f('0x24')]?_[_0x120f('0x25')](_0x36fde1['include'],function(_0x82b0d0){return{'model':db[_0x82b0d0[_0x120f('0x26')]],'as':_0x82b0d0['as'],'attributes':_0x82b0d0[_0x120f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x120f('0x12')](function(_0x3a1675){logger[_0x120f('0x13')](_0x120f('0x1c'),_0x2c3e3e);logger[_0x120f('0x27')]('GetOpenchannelQueue',_0x2c3e3e,JSON['stringify'](_0x3a1675));_0x2e7573(_0x3a1675);})['catch'](function(_0x41f487){logger[_0x120f('0x17')](_0x120f('0x1c'),_0x41f487[_0x120f('0x1a')],_0x2c3e3e);_0x258278(_0xff65de[_0x120f('0x17')](0x1f4,_0x41f487[_0x120f('0x1a')]));});});};exports[_0x120f('0x28')]=function(_0x1c27a6){var _0x31f41d=this;return new Promise(function(_0x35ade7,_0x5db31a){return db[_0x120f('0x1d')][_0x120f('0x29')]({'raw':_0x1c27a6[_0x120f('0x1f')]?_0x1c27a6[_0x120f('0x1f')][_0x120f('0x20')]===undefined?!![]:![]:!![],'where':_0x1c27a6[_0x120f('0x1f')]?_0x1c27a6['options'][_0x120f('0x21')]||null:null,'attributes':_0x1c27a6['options']?_0x1c27a6[_0x120f('0x1f')][_0x120f('0x22')]||null:null,'include':_0x1c27a6[_0x120f('0x1f')]?_0x1c27a6[_0x120f('0x1f')]['include']?_[_0x120f('0x25')](_0x1c27a6[_0x120f('0x1f')][_0x120f('0x24')],function(_0x2dce7b){return{'model':db[_0x2dce7b['model']],'as':_0x2dce7b['as'],'attributes':_0x2dce7b[_0x120f('0x22')],'include':_0x2dce7b[_0x120f('0x24')]?_['map'](_0x2dce7b[_0x120f('0x24')],function(_0x2119b4){return{'model':db[_0x2119b4['model']],'as':_0x2119b4['as'],'attributes':_0x2119b4[_0x120f('0x22')],'include':_0x2119b4[_0x120f('0x24')]?_[_0x120f('0x25')](_0x2119b4[_0x120f('0x24')],function(_0x46f8b1){return{'model':db[_0x46f8b1[_0x120f('0x26')]],'as':_0x46f8b1['as'],'attributes':_0x46f8b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x120f('0x12')](function(_0x1f53c7){logger[_0x120f('0x13')](_0x120f('0x28'),_0x1c27a6);logger[_0x120f('0x27')]('ShowOpenchannelQueue',_0x1c27a6,JSON[_0x120f('0x16')](_0x1f53c7));_0x35ade7(_0x1f53c7);})['catch'](function(_0x9b562f){logger['error'](_0x120f('0x28'),_0x9b562f[_0x120f('0x1a')],_0x1c27a6);_0x5db31a(_0x31f41d[_0x120f('0x17')](0x1f4,_0x9b562f[_0x120f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e73251f..06493c5 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 _0x7834=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit'];(function(_0x55b95f,_0x303974){var _0x5d7db1=function(_0x11d714){while(--_0x11d714){_0x55b95f['push'](_0x55b95f['shift']());}};_0x5d7db1(++_0x303974);}(_0x7834,0x194));var _0x4783=function(_0x1476ba,_0x446421){_0x1476ba=_0x1476ba-0x0;var _0x5e7bc1=_0x7834[_0x1476ba];return _0x5e7bc1;};'use strict';var OpenchannelQueueEvents=require(_0x4783('0x0'));var events=[_0x4783('0x1'),'remove',_0x4783('0x2')];function createListener(_0x5f4486,_0x5ab64e){return function(_0x49e52b){_0x5ab64e[_0x4783('0x3')](_0x5f4486,_0x49e52b);};}function removeListener(_0x3bd5ee,_0x5da0ab){return function(){OpenchannelQueueEvents['removeListener'](_0x3bd5ee,_0x5da0ab);};}exports['register']=function(_0x16631f){for(var _0x2b1bde=0x0,_0x2a8c11=events[_0x4783('0x4')];_0x2b1bde<_0x2a8c11;_0x2b1bde++){var _0x42262a=events[_0x2b1bde];var _0x194af5=createListener(_0x4783('0x5')+_0x42262a,_0x16631f);OpenchannelQueueEvents['on'](_0x42262a,_0x194af5);}}; \ No newline at end of file +var _0x6034=['register','length','./openchannelQueue.events','remove','update','emit','removeListener'];(function(_0x38c4a4,_0x17e86d){var _0x4f7505=function(_0x59bfd4){while(--_0x59bfd4){_0x38c4a4['push'](_0x38c4a4['shift']());}};_0x4f7505(++_0x17e86d);}(_0x6034,0xb1));var _0x4603=function(_0x243484,_0x5eb415){_0x243484=_0x243484-0x0;var _0x5aa374=_0x6034[_0x243484];return _0x5aa374;};'use strict';var OpenchannelQueueEvents=require(_0x4603('0x0'));var events=['save',_0x4603('0x1'),_0x4603('0x2')];function createListener(_0x2ee79d,_0x18d764){return function(_0x3f877f){_0x18d764[_0x4603('0x3')](_0x2ee79d,_0x3f877f);};}function removeListener(_0x587f16,_0x49791c){return function(){OpenchannelQueueEvents[_0x4603('0x4')](_0x587f16,_0x49791c);};}exports[_0x4603('0x5')]=function(_0x1dd004){for(var _0x1770b6=0x0,_0xd1717a=events[_0x4603('0x6')];_0x1770b6<_0xd1717a;_0x1770b6++){var _0x40dc6c=events[_0x1770b6];var _0x522341=createListener('openchannelQueue:'+_0x40dc6c,_0x1dd004);OpenchannelQueueEvents['on'](_0x40dc6c,_0x522341);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index bfef039..44ff67c 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 _0xe3fd=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x37e40e,_0x1ca409){var _0x18b9c4=function(_0x2dc90a){while(--_0x2dc90a){_0x37e40e['push'](_0x37e40e['shift']());}};_0x18b9c4(++_0x1ca409);}(_0xe3fd,0x73));var _0xde3f=function(_0x452d1e,_0x3ba31d){_0x452d1e=_0x452d1e-0x0;var _0x430651=_0xe3fd[_0x452d1e];return _0x430651;};'use strict';var multer=require(_0xde3f('0x0'));var util=require('util');var path=require(_0xde3f('0x1'));var timeout=require(_0xde3f('0x2'));var express=require(_0xde3f('0x3'));var router=express[_0xde3f('0x4')]();var auth=require(_0xde3f('0x5'));var interaction=require(_0xde3f('0x6'));var config=require('../../config/environment');var controller=require(_0xde3f('0x7'));router[_0xde3f('0x8')]('/',auth[_0xde3f('0x9')](),controller[_0xde3f('0xa')]);router['get'](_0xde3f('0xb'),auth[_0xde3f('0x9')](),controller[_0xde3f('0xc')]);router['get'](_0xde3f('0xd'),auth[_0xde3f('0x9')](),controller[_0xde3f('0xe')]);router[_0xde3f('0xf')]('/',auth[_0xde3f('0x9')](),controller[_0xde3f('0x10')]);router[_0xde3f('0x11')](_0xde3f('0xd'),auth['isAuthenticated'](),controller[_0xde3f('0x12')]);router[_0xde3f('0x13')](_0xde3f('0xd'),auth[_0xde3f('0x9')](),controller[_0xde3f('0x14')]);module[_0xde3f('0x15')]=router; \ No newline at end of file +var _0xd9b3=['path','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','exports','util'];(function(_0x1be7f3,_0x2f1d12){var _0x35a967=function(_0x51ea63){while(--_0x51ea63){_0x1be7f3['push'](_0x1be7f3['shift']());}};_0x35a967(++_0x2f1d12);}(_0xd9b3,0xb3));var _0x3d9b=function(_0x3630a4,_0x129ba4){_0x3630a4=_0x3630a4-0x0;var _0x5a1ec3=_0xd9b3[_0x3630a4];return _0x5a1ec3;};'use strict';var multer=require('multer');var util=require(_0x3d9b('0x0'));var path=require(_0x3d9b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3d9b('0x2')]();var auth=require(_0x3d9b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3d9b('0x4'));var controller=require(_0x3d9b('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3d9b('0x6')]('/describe',auth[_0x3d9b('0x7')](),controller[_0x3d9b('0x8')]);router[_0x3d9b('0x6')](_0x3d9b('0x9'),auth[_0x3d9b('0x7')](),controller[_0x3d9b('0xa')]);router[_0x3d9b('0xb')]('/',auth[_0x3d9b('0x7')](),controller['create']);router[_0x3d9b('0xc')](_0x3d9b('0x9'),auth[_0x3d9b('0x7')](),controller[_0x3d9b('0xd')]);router['delete'](_0x3d9b('0x9'),auth[_0x3d9b('0x7')](),controller['destroy']);module[_0x3d9b('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4d07164..e13c7ce 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 _0xb20e=['STRING','DATE','moment','exports'];(function(_0x5e9b89,_0x5653d8){var _0x2b3776=function(_0x453bfb){while(--_0x453bfb){_0x5e9b89['push'](_0x5e9b89['shift']());}};_0x2b3776(++_0x5653d8);}(_0xb20e,0x19a));var _0xeb20=function(_0x90b39,_0x5eaa79){_0x90b39=_0x90b39-0x0;var _0x33b978=_0xb20e[_0x90b39];return _0x33b978;};'use strict';var moment=require(_0xeb20('0x0'));var Sequelize=require('sequelize');module[_0xeb20('0x1')]={'uniqueid':{'type':Sequelize[_0xeb20('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xeb20('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xeb20('0x3')]},'acceptAt':{'type':Sequelize[_0xeb20('0x3')]},'exitAt':{'type':Sequelize[_0xeb20('0x3')]},'reason':{'type':Sequelize[_0xeb20('0x2')]}}; \ No newline at end of file +var _0x95ed=['DATE','moment','sequelize','exports','STRING'];(function(_0x12a942,_0x128344){var _0x594255=function(_0x31e48a){while(--_0x31e48a){_0x12a942['push'](_0x12a942['shift']());}};_0x594255(++_0x128344);}(_0x95ed,0x114));var _0xd95e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x95ed[_0x164eca];return _0x2ce562;};'use strict';var moment=require(_0xd95e('0x0'));var Sequelize=require(_0xd95e('0x1'));module[_0xd95e('0x2')]={'uniqueid':{'type':Sequelize[_0xd95e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd95e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd95e('0x4')]},'acceptAt':{'type':Sequelize[_0xd95e('0x4')]},'exitAt':{'type':Sequelize[_0xd95e('0x4')]},'reason':{'type':Sequelize[_0xd95e('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 96c7593..96cdacb 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 _0xa900=['set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xa900,0x101));var _0x0a90=function(_0x41e8f2,_0x17797c){_0x41e8f2=_0x41e8f2-0x0;var _0x20e3fc=_0xa900[_0x41e8f2];return _0x20e3fc;};'use strict';var pdf=require(_0x0a90('0x0'));var emlformat=require(_0x0a90('0x1'));var rimraf=require(_0x0a90('0x2'));var zipdir=require(_0x0a90('0x3'));var jsonpatch=require(_0x0a90('0x4'));var rp=require(_0x0a90('0x5'));var moment=require('moment');var BPromise=require(_0x0a90('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0a90('0x7'));var sox=require(_0x0a90('0x8'));var csv=require(_0x0a90('0x9'));var ejs=require(_0x0a90('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a90('0xb'));var crypto=require(_0x0a90('0xc'));var jsforce=require(_0x0a90('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a90('0x9'));var querystring=require(_0x0a90('0xe'));var Papa=require(_0x0a90('0xf'));var Redis=require('ioredis');var authService=require(_0x0a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0a90('0x11'));var hardwareService=require(_0x0a90('0x12'));var logger=require('../../config/logger')(_0x0a90('0x13'));var utils=require(_0x0a90('0x14'));var config=require(_0x0a90('0x15'));var licenseUtil=require(_0x0a90('0x16'));var db=require(_0x0a90('0x17'))['db'];function respondWithStatusCode(_0x37fd09,_0x198fec){_0x198fec=_0x198fec||0xcc;return function(_0x1f82d3){if(_0x1f82d3){return _0x37fd09[_0x0a90('0x18')](_0x198fec);}return _0x37fd09[_0x0a90('0x19')](_0x198fec)[_0x0a90('0x1a')]();};}function respondWithResult(_0x391bd7,_0x1f0dca){_0x1f0dca=_0x1f0dca||0xc8;return function(_0x50dfee){if(_0x50dfee){return _0x391bd7['status'](_0x1f0dca)[_0x0a90('0x1b')](_0x50dfee);}};}function respondWithFilteredResult(_0x91163a,_0x44237d){return function(_0x166806){if(_0x166806){var _0x87365=_0x166806[_0x0a90('0x1c')],_0x3f2c7d=_0x44237d[_0x0a90('0x1d')],_0x5d99b8=_0x44237d['offset']+_0x44237d[_0x0a90('0x1e')],_0x4c5979;if(_0x5d99b8>=_0x87365){_0x5d99b8=_0x87365;_0x4c5979=0xc8;}else{_0x4c5979=0xce;}_0x91163a[_0x0a90('0x19')](_0x4c5979);return _0x91163a[_0x0a90('0x1f')](_0x0a90('0x20'),_0x3f2c7d+'-'+_0x5d99b8+'/'+_0x87365)[_0x0a90('0x1b')](_0x166806);}return null;};}function patchUpdates(_0x770d50){return function(_0x4c2916){try{jsonpatch[_0x0a90('0x21')](_0x4c2916,_0x770d50,!![]);}catch(_0x2af720){return BPromise[_0x0a90('0x22')](_0x2af720);}return _0x4c2916['save']();};}function saveUpdates(_0x4ba044,_0x7808b0){return function(_0x4a7227){if(_0x4a7227){return _0x4a7227[_0x0a90('0x23')](_0x4ba044)['then'](function(_0x435a8b){return _0x435a8b;});}return null;};}function removeEntity(_0x30eb4a,_0xf3e76f){return function(_0x35b503){if(_0x35b503){return _0x35b503[_0x0a90('0x24')]()[_0x0a90('0x25')](function(){_0x30eb4a[_0x0a90('0x19')](0xcc)[_0x0a90('0x1a')]();});}};}function handleEntityNotFound(_0x2c3431,_0x228279){return function(_0x5a1bf3){if(!_0x5a1bf3){_0x2c3431[_0x0a90('0x18')](0x194);}return _0x5a1bf3;};}function handleError(_0x413814,_0x10e621){_0x10e621=_0x10e621||0x1f4;return function(_0x569dc3){logger[_0x0a90('0x26')](_0x569dc3[_0x0a90('0x27')]);if(_0x569dc3[_0x0a90('0x28')]){delete _0x569dc3[_0x0a90('0x28')];}_0x413814['status'](_0x10e621)[_0x0a90('0x29')](_0x569dc3);};}exports[_0x0a90('0x2a')]=function(_0x74f558,_0x328294){var _0xe4729b={},_0x7e6d1a={},_0x3c3715={'count':0x0,'rows':[]};var _0x341cdc=_[_0x0a90('0x2b')](db[_0x0a90('0x2c')]['rawAttributes'],function(_0x3c194e){return{'name':_0x3c194e[_0x0a90('0x2d')],'type':_0x3c194e[_0x0a90('0x2e')]['key']};});_0x7e6d1a[_0x0a90('0x2f')]=_['map'](_0x341cdc,_0x0a90('0x28'));_0x7e6d1a[_0x0a90('0x30')]=_['keys'](_0x74f558[_0x0a90('0x30')]);_0x7e6d1a['filters']=_[_0x0a90('0x31')](_0x7e6d1a['model'],_0x7e6d1a[_0x0a90('0x30')]);_0xe4729b[_0x0a90('0x32')]=_[_0x0a90('0x31')](_0x7e6d1a[_0x0a90('0x2f')],qs[_0x0a90('0x33')](_0x74f558[_0x0a90('0x30')][_0x0a90('0x33')]));_0xe4729b[_0x0a90('0x32')]=_0xe4729b[_0x0a90('0x32')]['length']?_0xe4729b[_0x0a90('0x32')]:_0x7e6d1a[_0x0a90('0x2f')];if(!_0x74f558['query']['hasOwnProperty'](_0x0a90('0x34'))){_0xe4729b['limit']=qs['limit'](_0x74f558[_0x0a90('0x30')][_0x0a90('0x1e')]);_0xe4729b[_0x0a90('0x1d')]=qs[_0x0a90('0x1d')](_0x74f558[_0x0a90('0x30')][_0x0a90('0x1d')]);}_0xe4729b[_0x0a90('0x35')]=qs['sort'](_0x74f558[_0x0a90('0x30')][_0x0a90('0x36')]);_0xe4729b[_0x0a90('0x37')]=qs[_0x0a90('0x38')](_['pick'](_0x74f558['query'],_0x7e6d1a['filters']),_0x341cdc);if(_0x74f558['query'][_0x0a90('0x39')]){_0xe4729b[_0x0a90('0x37')]=_['merge'](_0xe4729b[_0x0a90('0x37')],{'$or':_[_0x0a90('0x2b')](_0x341cdc,function(_0x57a239){if(_0x57a239[_0x0a90('0x2e')]!=='VIRTUAL'){var _0x1c12d2={};_0x1c12d2[_0x57a239[_0x0a90('0x28')]]={'$like':'%'+_0x74f558['query']['filter']+'%'};return _0x1c12d2;}})});}_0xe4729b=_['merge']({},_0xe4729b,_0x74f558[_0x0a90('0x3a')]);var _0x3b3139={'where':_0xe4729b[_0x0a90('0x37')]};return db['OpenchannelQueueReport'][_0x0a90('0x1c')](_0x3b3139)['then'](function(_0x3d99e9){_0x3c3715['count']=_0x3d99e9;if(_0x74f558[_0x0a90('0x30')][_0x0a90('0x3b')]){_0xe4729b[_0x0a90('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x0a90('0x3d')](_0xe4729b);})[_0x0a90('0x25')](function(_0x5a5b17){_0x3c3715[_0x0a90('0x3e')]=_0x5a5b17;return _0x3c3715;})['then'](respondWithFilteredResult(_0x328294,_0xe4729b))[_0x0a90('0x3f')](handleError(_0x328294,null));};exports[_0x0a90('0x40')]=function(_0x517ef3,_0x2e77b4){var _0x13ea18={'raw':!![],'where':{'id':_0x517ef3[_0x0a90('0x41')]['id']}},_0x11fc96={};_0x11fc96[_0x0a90('0x2f')]=_['keys'](db[_0x0a90('0x2c')]['rawAttributes']);_0x11fc96[_0x0a90('0x30')]=_[_0x0a90('0x42')](_0x517ef3[_0x0a90('0x30')]);_0x11fc96[_0x0a90('0x38')]=_[_0x0a90('0x31')](_0x11fc96[_0x0a90('0x2f')],_0x11fc96[_0x0a90('0x30')]);_0x13ea18[_0x0a90('0x32')]=_[_0x0a90('0x31')](_0x11fc96[_0x0a90('0x2f')],qs[_0x0a90('0x33')](_0x517ef3['query'][_0x0a90('0x33')]));_0x13ea18[_0x0a90('0x32')]=_0x13ea18[_0x0a90('0x32')][_0x0a90('0x43')]?_0x13ea18[_0x0a90('0x32')]:_0x11fc96[_0x0a90('0x2f')];if(_0x517ef3[_0x0a90('0x30')][_0x0a90('0x3b')]){_0x13ea18[_0x0a90('0x3c')]=[{'all':!![]}];}_0x13ea18=_['merge']({},_0x13ea18,_0x517ef3[_0x0a90('0x3a')]);return db[_0x0a90('0x2c')]['find'](_0x13ea18)['then'](handleEntityNotFound(_0x2e77b4,null))[_0x0a90('0x25')](respondWithResult(_0x2e77b4,null))[_0x0a90('0x3f')](handleError(_0x2e77b4,null));};exports[_0x0a90('0x44')]=function(_0x13fd16,_0x301d00){return db[_0x0a90('0x2c')][_0x0a90('0x44')](_0x13fd16[_0x0a90('0x45')],{})[_0x0a90('0x25')](respondWithResult(_0x301d00,0xc9))['catch'](handleError(_0x301d00,null));};exports[_0x0a90('0x23')]=function(_0x2afd51,_0x3db3b0){if(_0x2afd51[_0x0a90('0x45')]['id']){delete _0x2afd51[_0x0a90('0x45')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x2afd51[_0x0a90('0x41')]['id']}})[_0x0a90('0x25')](handleEntityNotFound(_0x3db3b0,null))[_0x0a90('0x25')](saveUpdates(_0x2afd51[_0x0a90('0x45')],null))[_0x0a90('0x25')](respondWithResult(_0x3db3b0,null))[_0x0a90('0x3f')](handleError(_0x3db3b0,null));};exports[_0x0a90('0x24')]=function(_0x55968c,_0x5d7cb4){return db[_0x0a90('0x2c')][_0x0a90('0x46')]({'where':{'id':_0x55968c['params']['id']}})[_0x0a90('0x25')](handleEntityNotFound(_0x5d7cb4,null))[_0x0a90('0x25')](removeEntity(_0x5d7cb4,null))['catch'](handleError(_0x5d7cb4,null));};exports['describe']=function(_0x2b9809,_0x33becd){return db[_0x0a90('0x2c')][_0x0a90('0x47')]()[_0x0a90('0x25')](respondWithResult(_0x33becd,null))['catch'](handleError(_0x33becd,null));}; \ No newline at end of file +var _0xee53=['pick','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2316cd,_0x35c70b){var _0x26ca6c=function(_0x31bd7f){while(--_0x31bd7f){_0x2316cd['push'](_0x2316cd['shift']());}};_0x26ca6c(++_0x35c70b);}(_0xee53,0xa8));var _0x3ee5=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0xee53[_0x127783];return _0x14f298;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3ee5('0x0'));var zipdir=require(_0x3ee5('0x1'));var jsonpatch=require(_0x3ee5('0x2'));var rp=require('request-promise');var moment=require(_0x3ee5('0x3'));var BPromise=require(_0x3ee5('0x4'));var Mustache=require(_0x3ee5('0x5'));var util=require(_0x3ee5('0x6'));var path=require(_0x3ee5('0x7'));var sox=require(_0x3ee5('0x8'));var csv=require(_0x3ee5('0x9'));var ejs=require(_0x3ee5('0xa'));var fs=require('fs');var _=require(_0x3ee5('0xb'));var squel=require(_0x3ee5('0xc'));var crypto=require(_0x3ee5('0xd'));var jsforce=require(_0x3ee5('0xe'));var deskjs=require(_0x3ee5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3ee5('0x10'));var Papa=require(_0x3ee5('0x11'));var Redis=require(_0x3ee5('0x12'));var authService=require(_0x3ee5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3ee5('0x14'));var hardwareService=require(_0x3ee5('0x15'));var logger=require(_0x3ee5('0x16'))(_0x3ee5('0x17'));var utils=require('../../config/utils');var config=require(_0x3ee5('0x18'));var licenseUtil=require(_0x3ee5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbf85a3,_0x509a41){_0x509a41=_0x509a41||0xcc;return function(_0x10da9f){if(_0x10da9f){return _0xbf85a3['sendStatus'](_0x509a41);}return _0xbf85a3['status'](_0x509a41)[_0x3ee5('0x1a')]();};}function respondWithResult(_0x27816b,_0x244ca2){_0x244ca2=_0x244ca2||0xc8;return function(_0x21c9b6){if(_0x21c9b6){return _0x27816b[_0x3ee5('0x1b')](_0x244ca2)[_0x3ee5('0x1c')](_0x21c9b6);}};}function respondWithFilteredResult(_0x3ee06d,_0x1452b5){return function(_0x4023a9){if(_0x4023a9){var _0x5568f3=_0x4023a9[_0x3ee5('0x1d')],_0x221afa=_0x1452b5[_0x3ee5('0x1e')],_0x57fb10=_0x1452b5[_0x3ee5('0x1e')]+_0x1452b5[_0x3ee5('0x1f')],_0xab5013;if(_0x57fb10>=_0x5568f3){_0x57fb10=_0x5568f3;_0xab5013=0xc8;}else{_0xab5013=0xce;}_0x3ee06d[_0x3ee5('0x1b')](_0xab5013);return _0x3ee06d[_0x3ee5('0x20')]('Content-Range',_0x221afa+'-'+_0x57fb10+'/'+_0x5568f3)[_0x3ee5('0x1c')](_0x4023a9);}return null;};}function patchUpdates(_0x338168){return function(_0x150187){try{jsonpatch[_0x3ee5('0x21')](_0x150187,_0x338168,!![]);}catch(_0x487f98){return BPromise[_0x3ee5('0x22')](_0x487f98);}return _0x150187[_0x3ee5('0x23')]();};}function saveUpdates(_0x203a60,_0xa872c4){return function(_0x45d433){if(_0x45d433){return _0x45d433['update'](_0x203a60)[_0x3ee5('0x24')](function(_0x179d10){return _0x179d10;});}return null;};}function removeEntity(_0x591bde,_0x4a3b83){return function(_0x1b5139){if(_0x1b5139){return _0x1b5139[_0x3ee5('0x25')]()[_0x3ee5('0x24')](function(){_0x591bde['status'](0xcc)[_0x3ee5('0x1a')]();});}};}function handleEntityNotFound(_0x4d7114,_0x318c36){return function(_0x11415e){if(!_0x11415e){_0x4d7114['sendStatus'](0x194);}return _0x11415e;};}function handleError(_0x3e9b6c,_0x3180eb){_0x3180eb=_0x3180eb||0x1f4;return function(_0x31d980){logger[_0x3ee5('0x26')](_0x31d980[_0x3ee5('0x27')]);if(_0x31d980[_0x3ee5('0x28')]){delete _0x31d980[_0x3ee5('0x28')];}_0x3e9b6c[_0x3ee5('0x1b')](_0x3180eb)[_0x3ee5('0x29')](_0x31d980);};}exports[_0x3ee5('0x2a')]=function(_0x27819d,_0x4795e2){var _0x2f6f4f={},_0x574519={},_0x145603={'count':0x0,'rows':[]};var _0x379a70=_[_0x3ee5('0x2b')](db['OpenchannelQueueReport'][_0x3ee5('0x2c')],function(_0x10cd45){return{'name':_0x10cd45[_0x3ee5('0x2d')],'type':_0x10cd45[_0x3ee5('0x2e')]['key']};});_0x574519[_0x3ee5('0x2f')]=_[_0x3ee5('0x2b')](_0x379a70,_0x3ee5('0x28'));_0x574519[_0x3ee5('0x30')]=_[_0x3ee5('0x31')](_0x27819d['query']);_0x574519[_0x3ee5('0x32')]=_['intersection'](_0x574519['model'],_0x574519[_0x3ee5('0x30')]);_0x2f6f4f[_0x3ee5('0x33')]=_[_0x3ee5('0x34')](_0x574519['model'],qs[_0x3ee5('0x35')](_0x27819d[_0x3ee5('0x30')][_0x3ee5('0x35')]));_0x2f6f4f[_0x3ee5('0x33')]=_0x2f6f4f['attributes'][_0x3ee5('0x36')]?_0x2f6f4f[_0x3ee5('0x33')]:_0x574519[_0x3ee5('0x2f')];if(!_0x27819d[_0x3ee5('0x30')][_0x3ee5('0x37')](_0x3ee5('0x38'))){_0x2f6f4f[_0x3ee5('0x1f')]=qs[_0x3ee5('0x1f')](_0x27819d[_0x3ee5('0x30')]['limit']);_0x2f6f4f[_0x3ee5('0x1e')]=qs[_0x3ee5('0x1e')](_0x27819d[_0x3ee5('0x30')][_0x3ee5('0x1e')]);}_0x2f6f4f[_0x3ee5('0x39')]=qs[_0x3ee5('0x3a')](_0x27819d[_0x3ee5('0x30')][_0x3ee5('0x3a')]);_0x2f6f4f[_0x3ee5('0x3b')]=qs[_0x3ee5('0x32')](_[_0x3ee5('0x3c')](_0x27819d['query'],_0x574519['filters']),_0x379a70);if(_0x27819d[_0x3ee5('0x30')]['filter']){_0x2f6f4f[_0x3ee5('0x3b')]=_[_0x3ee5('0x3d')](_0x2f6f4f['where'],{'$or':_[_0x3ee5('0x2b')](_0x379a70,function(_0x3f8e00){if(_0x3f8e00['type']!==_0x3ee5('0x3e')){var _0xe26bea={};_0xe26bea[_0x3f8e00[_0x3ee5('0x28')]]={'$like':'%'+_0x27819d[_0x3ee5('0x30')]['filter']+'%'};return _0xe26bea;}})});}_0x2f6f4f=_[_0x3ee5('0x3d')]({},_0x2f6f4f,_0x27819d[_0x3ee5('0x3f')]);var _0x4a3da8={'where':_0x2f6f4f['where']};return db[_0x3ee5('0x40')][_0x3ee5('0x1d')](_0x4a3da8)[_0x3ee5('0x24')](function(_0x48915f){_0x145603[_0x3ee5('0x1d')]=_0x48915f;if(_0x27819d['query'][_0x3ee5('0x41')]){_0x2f6f4f[_0x3ee5('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x3ee5('0x43')](_0x2f6f4f);})[_0x3ee5('0x24')](function(_0x30f541){_0x145603[_0x3ee5('0x44')]=_0x30f541;return _0x145603;})['then'](respondWithFilteredResult(_0x4795e2,_0x2f6f4f))[_0x3ee5('0x45')](handleError(_0x4795e2,null));};exports['show']=function(_0x468b87,_0x3c8565){var _0x5a3ba1={'raw':!![],'where':{'id':_0x468b87[_0x3ee5('0x46')]['id']}},_0x22fe5c={};_0x22fe5c['model']=_['keys'](db[_0x3ee5('0x40')][_0x3ee5('0x2c')]);_0x22fe5c[_0x3ee5('0x30')]=_[_0x3ee5('0x31')](_0x468b87['query']);_0x22fe5c['filters']=_['intersection'](_0x22fe5c[_0x3ee5('0x2f')],_0x22fe5c['query']);_0x5a3ba1[_0x3ee5('0x33')]=_[_0x3ee5('0x34')](_0x22fe5c['model'],qs[_0x3ee5('0x35')](_0x468b87[_0x3ee5('0x30')][_0x3ee5('0x35')]));_0x5a3ba1[_0x3ee5('0x33')]=_0x5a3ba1['attributes'][_0x3ee5('0x36')]?_0x5a3ba1[_0x3ee5('0x33')]:_0x22fe5c['model'];if(_0x468b87[_0x3ee5('0x30')][_0x3ee5('0x41')]){_0x5a3ba1[_0x3ee5('0x42')]=[{'all':!![]}];}_0x5a3ba1=_[_0x3ee5('0x3d')]({},_0x5a3ba1,_0x468b87[_0x3ee5('0x3f')]);return db[_0x3ee5('0x40')][_0x3ee5('0x47')](_0x5a3ba1)[_0x3ee5('0x24')](handleEntityNotFound(_0x3c8565,null))[_0x3ee5('0x24')](respondWithResult(_0x3c8565,null))[_0x3ee5('0x45')](handleError(_0x3c8565,null));};exports[_0x3ee5('0x48')]=function(_0x5ea717,_0x5b997c){return db[_0x3ee5('0x40')]['create'](_0x5ea717[_0x3ee5('0x49')],{})[_0x3ee5('0x24')](respondWithResult(_0x5b997c,0xc9))[_0x3ee5('0x45')](handleError(_0x5b997c,null));};exports[_0x3ee5('0x4a')]=function(_0xb0c6c7,_0x4afb46){if(_0xb0c6c7[_0x3ee5('0x49')]['id']){delete _0xb0c6c7[_0x3ee5('0x49')]['id'];}return db[_0x3ee5('0x40')][_0x3ee5('0x47')]({'where':{'id':_0xb0c6c7['params']['id']}})[_0x3ee5('0x24')](handleEntityNotFound(_0x4afb46,null))[_0x3ee5('0x24')](saveUpdates(_0xb0c6c7[_0x3ee5('0x49')],null))[_0x3ee5('0x24')](respondWithResult(_0x4afb46,null))[_0x3ee5('0x45')](handleError(_0x4afb46,null));};exports[_0x3ee5('0x25')]=function(_0x80a75,_0x3b6379){return db[_0x3ee5('0x40')][_0x3ee5('0x47')]({'where':{'id':_0x80a75[_0x3ee5('0x46')]['id']}})[_0x3ee5('0x24')](handleEntityNotFound(_0x3b6379,null))[_0x3ee5('0x24')](removeEntity(_0x3b6379,null))['catch'](handleError(_0x3b6379,null));};exports[_0x3ee5('0x4b')]=function(_0x5ed928,_0x20cad3){return db['OpenchannelQueueReport'][_0x3ee5('0x4b')]()[_0x3ee5('0x24')](respondWithResult(_0x20cad3,null))[_0x3ee5('0x45')](handleError(_0x20cad3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 97c3d63..d73bff7 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 _0xdd54=['api','bluebird','request-promise','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x446e34,_0x2668bb){var _0x38b57d=function(_0x30b541){while(--_0x30b541){_0x446e34['push'](_0x446e34['shift']());}};_0x38b57d(++_0x2668bb);}(_0xdd54,0x159));var _0x4dd5=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0xdd54[_0x5400a1];return _0x4006c7;};'use strict';var _=require(_0x4dd5('0x0'));var util=require(_0x4dd5('0x1'));var logger=require(_0x4dd5('0x2'))(_0x4dd5('0x3'));var moment=require('moment');var BPromise=require(_0x4dd5('0x4'));var rp=require(_0x4dd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4dd5('0x6'));var attributes=require(_0x4dd5('0x7'));module[_0x4dd5('0x8')]=function(_0x20b2ec,_0x380e40){return _0x20b2ec[_0x4dd5('0x9')](_0x4dd5('0xa'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x4dd5('0xb'),'fields':[_0x4dd5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad36=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xad36,0x11c));var _0x6ad3=function(_0xbd6b57,_0x1268cd){_0xbd6b57=_0xbd6b57-0x0;var _0x241503=_0xad36[_0xbd6b57];return _0x241503;};'use strict';var _=require('lodash');var util=require(_0x6ad3('0x0'));var logger=require(_0x6ad3('0x1'))(_0x6ad3('0x2'));var moment=require(_0x6ad3('0x3'));var BPromise=require(_0x6ad3('0x4'));var rp=require(_0x6ad3('0x5'));var fs=require('fs');var path=require(_0x6ad3('0x6'));var rimraf=require(_0x6ad3('0x7'));var config=require(_0x6ad3('0x8'));var attributes=require('./openchannelQueueReport.attributes');module[_0x6ad3('0x9')]=function(_0x3d669f,_0x3c3041){return _0x3d669f[_0x6ad3('0xa')]('OpenchannelQueueReport',attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 12fd20f..18fa98f 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 _0x067f=['jayson/promise','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3ad00a,_0x11b46a){var _0x582dcc=function(_0x427aca){while(--_0x427aca){_0x3ad00a['push'](_0x3ad00a['shift']());}};_0x582dcc(++_0x11b46a);}(_0x067f,0xb8));var _0xf067=function(_0x196e02,_0x29aeea){_0x196e02=_0x196e02-0x0;var _0x57f7da=_0x067f[_0x196e02];return _0x57f7da;};'use strict';var _=require(_0xf067('0x0'));var util=require(_0xf067('0x1'));var moment=require('moment');var BPromise=require(_0xf067('0x2'));var rs=require(_0xf067('0x3'));var fs=require('fs');var Redis=require(_0xf067('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf067('0x5'));var logger=require(_0xf067('0x6'))('rpc');var config=require(_0xf067('0x7'));var jayson=require(_0xf067('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc685eb,_0x54ad1c,_0x4129cf){return new BPromise(function(_0x365b4b,_0x5851f9){return client[_0xf067('0x9')](_0xc685eb,_0x4129cf)[_0xf067('0xa')](function(_0x152283){logger[_0xf067('0xb')](_0xf067('0xc'),_0x54ad1c,_0xf067('0xd'));logger[_0xf067('0xe')](_0xf067('0xf'),_0x54ad1c,_0xf067('0xd'),JSON[_0xf067('0x10')](_0x152283));if(_0x152283['error']){if(_0x152283['error']['code']===0x1f4){logger[_0xf067('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x54ad1c,_0x152283[_0xf067('0x11')]['message']);return _0x5851f9(_0x152283[_0xf067('0x11')][_0xf067('0x12')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x54ad1c,_0x152283[_0xf067('0x11')][_0xf067('0x12')]);return _0x365b4b(_0x152283[_0xf067('0x11')]['message']);}else{logger[_0xf067('0xb')](_0xf067('0xc'),_0x54ad1c,_0xf067('0xd'));_0x365b4b(_0x152283[_0xf067('0x13')][_0xf067('0x12')]);}})[_0xf067('0x14')](function(_0xe992a3){logger[_0xf067('0x11')](_0xf067('0xc'),_0x54ad1c,_0xe992a3);_0x5851f9(_0xe992a3);});});}exports[_0xf067('0x15')]=function(_0x2736c8){var _0x42f118=this;return new Promise(function(_0x2e53da,_0xc31a06){return db[_0xf067('0x16')][_0xf067('0x17')](_0x2736c8[_0xf067('0x18')],{'raw':_0x2736c8[_0xf067('0x19')]?_0x2736c8['options']['raw']===undefined?!![]:![]:!![]})[_0xf067('0xa')](function(_0x45d64e){logger[_0xf067('0xb')]('CreateOpenchannelQueueReport',_0x2736c8);logger[_0xf067('0xe')](_0xf067('0x15'),_0x2736c8,JSON['stringify'](_0x45d64e));_0x2e53da(_0x45d64e);})[_0xf067('0x14')](function(_0x4fd06f){logger['error'](_0xf067('0x15'),_0x4fd06f[_0xf067('0x12')],_0x2736c8);_0xc31a06(_0x42f118[_0xf067('0x11')](0x1f4,_0x4fd06f[_0xf067('0x12')]));});});};exports[_0xf067('0x1a')]=function(_0x51bc35){var _0x3baf41=this;return new Promise(function(_0x364677,_0x2b8742){return db[_0xf067('0x16')][_0xf067('0x1b')](_0x51bc35[_0xf067('0x18')],{'raw':_0x51bc35[_0xf067('0x19')]?_0x51bc35[_0xf067('0x19')][_0xf067('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51bc35[_0xf067('0x19')]?_0x51bc35[_0xf067('0x19')][_0xf067('0x1d')]||null:null,'attributes':_0x51bc35[_0xf067('0x19')]?_0x51bc35['options'][_0xf067('0x1e')]||null:null,'limit':_0x51bc35[_0xf067('0x19')]?_0x51bc35['options'][_0xf067('0x1f')]||null:null})[_0xf067('0xa')](function(_0x43468e){logger[_0xf067('0xb')](_0xf067('0x1a'),_0x51bc35);logger['debug'](_0xf067('0x1a'),_0x51bc35,JSON[_0xf067('0x10')](_0x43468e));_0x364677(_0x43468e);})[_0xf067('0x14')](function(_0x2f7f2e){logger['error']('UpdateOpenchannelQueueReport',_0x2f7f2e['message'],_0x51bc35);_0x2b8742(_0x3baf41['error'](0x1f4,_0x2f7f2e[_0xf067('0x12')]));});});}; \ No newline at end of file +var _0x1f8c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','bluebird','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1f8c,0xc2));var _0xc1f8=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x1f8c[_0x41c381];return _0x427981;};'use strict';var _=require(_0xc1f8('0x0'));var util=require(_0xc1f8('0x1'));var moment=require('moment');var BPromise=require(_0xc1f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1f8('0x4'));var logger=require(_0xc1f8('0x5'))('rpc');var config=require(_0xc1f8('0x6'));var jayson=require(_0xc1f8('0x7'));var client=jayson[_0xc1f8('0x8')][_0xc1f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x312a98,_0x3ff4d1,_0x26ec5a){return new BPromise(function(_0x3a2dba,_0x357163){return client[_0xc1f8('0xa')](_0x312a98,_0x26ec5a)['then'](function(_0x426f4c){logger[_0xc1f8('0xb')](_0xc1f8('0xc'),_0x3ff4d1,_0xc1f8('0xd'));logger[_0xc1f8('0xe')](_0xc1f8('0xf'),_0x3ff4d1,_0xc1f8('0xd'),JSON[_0xc1f8('0x10')](_0x426f4c));if(_0x426f4c[_0xc1f8('0x11')]){if(_0x426f4c['error']['code']===0x1f4){logger[_0xc1f8('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3ff4d1,_0x426f4c[_0xc1f8('0x11')][_0xc1f8('0x12')]);return _0x357163(_0x426f4c[_0xc1f8('0x11')][_0xc1f8('0x12')]);}logger[_0xc1f8('0x11')](_0xc1f8('0xc'),_0x3ff4d1,_0x426f4c[_0xc1f8('0x11')][_0xc1f8('0x12')]);return _0x3a2dba(_0x426f4c[_0xc1f8('0x11')][_0xc1f8('0x12')]);}else{logger[_0xc1f8('0xb')](_0xc1f8('0xc'),_0x3ff4d1,_0xc1f8('0xd'));_0x3a2dba(_0x426f4c[_0xc1f8('0x13')][_0xc1f8('0x12')]);}})[_0xc1f8('0x14')](function(_0x2bc573){logger[_0xc1f8('0x11')](_0xc1f8('0xc'),_0x3ff4d1,_0x2bc573);_0x357163(_0x2bc573);});});}exports[_0xc1f8('0x15')]=function(_0x49eed5){var _0xfb36f9=this;return new Promise(function(_0x28ce56,_0x1554d2){return db[_0xc1f8('0x16')][_0xc1f8('0x17')](_0x49eed5[_0xc1f8('0x18')],{'raw':_0x49eed5[_0xc1f8('0x19')]?_0x49eed5[_0xc1f8('0x19')][_0xc1f8('0x1a')]===undefined?!![]:![]:!![]})[_0xc1f8('0x1b')](function(_0x2cf18e){logger['info'](_0xc1f8('0x15'),_0x49eed5);logger[_0xc1f8('0xe')](_0xc1f8('0x15'),_0x49eed5,JSON[_0xc1f8('0x10')](_0x2cf18e));_0x28ce56(_0x2cf18e);})[_0xc1f8('0x14')](function(_0xf08d6d){logger[_0xc1f8('0x11')](_0xc1f8('0x15'),_0xf08d6d[_0xc1f8('0x12')],_0x49eed5);_0x1554d2(_0xfb36f9[_0xc1f8('0x11')](0x1f4,_0xf08d6d[_0xc1f8('0x12')]));});});};exports[_0xc1f8('0x1c')]=function(_0x301f86){var _0x390a9a=this;return new Promise(function(_0x344691,_0x59eed1){return db['OpenchannelQueueReport'][_0xc1f8('0x1d')](_0x301f86[_0xc1f8('0x18')],{'raw':_0x301f86['options']?_0x301f86['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x301f86[_0xc1f8('0x19')]?_0x301f86[_0xc1f8('0x19')][_0xc1f8('0x1e')]||null:null,'attributes':_0x301f86['options']?_0x301f86[_0xc1f8('0x19')][_0xc1f8('0x1f')]||null:null,'limit':_0x301f86[_0xc1f8('0x19')]?_0x301f86['options'][_0xc1f8('0x20')]||null:null})['then'](function(_0x56dd15){logger[_0xc1f8('0xb')](_0xc1f8('0x1c'),_0x301f86);logger['debug']('UpdateOpenchannelQueueReport',_0x301f86,JSON[_0xc1f8('0x10')](_0x56dd15));_0x344691(_0x56dd15);})[_0xc1f8('0x14')](function(_0x24e68b){logger[_0xc1f8('0x11')]('UpdateOpenchannelQueueReport',_0x24e68b['message'],_0x301f86);_0x59eed1(_0x390a9a['error'](0x1f4,_0x24e68b[_0xc1f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index dcbbee2..20b1f4c 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(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 ce9be16..22de229 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 _0x73b1=['queue','DATE','sequelize','exports','account','agent'];(function(_0x161760,_0x2fa89e){var _0x5645f7=function(_0x504987){while(--_0x504987){_0x161760['push'](_0x161760['shift']());}};_0x5645f7(++_0x2fa89e);}(_0x73b1,0xe6));var _0x173b=function(_0x225915,_0x2eaa2f){_0x225915=_0x225915-0x0;var _0x3b8d10=_0x73b1[_0x225915];return _0x3b8d10;};'use strict';var moment=require('moment');var Sequelize=require(_0x173b('0x0'));module[_0x173b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x173b('0x2'),_0x173b('0x3'),_0x173b('0x4')),'allowNull':![],'defaultValue':_0x173b('0x4')},'transferredAt':{'type':Sequelize[_0x173b('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x7265=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x1736e8,_0x28cb17){var _0x23024e=function(_0x55b69c){while(--_0x55b69c){_0x1736e8['push'](_0x1736e8['shift']());}};_0x23024e(++_0x28cb17);}(_0x7265,0x92));var _0x5726=function(_0x3d75e1,_0x4c4eb5){_0x3d75e1=_0x3d75e1-0x0;var _0x49403f=_0x7265[_0x3d75e1];return _0x49403f;};'use strict';var moment=require(_0x5726('0x0'));var Sequelize=require(_0x5726('0x1'));module[_0x5726('0x2')]={'uniqueid':{'type':Sequelize[_0x5726('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5726('0x4')]('account',_0x5726('0x5'),'queue'),'allowNull':![],'defaultValue':_0x5726('0x6')},'transferredAt':{'type':Sequelize[_0x5726('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x5726('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ef2957c..b8be49c 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 _0x7a22=['update','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','body'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x7a22,0x171));var _0x27a2=function(_0x5bbc08,_0x2927b1){_0x5bbc08=_0x5bbc08-0x0;var _0x2afcaf=_0x7a22[_0x5bbc08];return _0x2afcaf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x27a2('0x0'));var rimraf=require(_0x27a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27a2('0x2'));var rp=require(_0x27a2('0x3'));var moment=require(_0x27a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27a2('0x5'));var util=require(_0x27a2('0x6'));var path=require(_0x27a2('0x7'));var sox=require(_0x27a2('0x8'));var csv=require(_0x27a2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x27a2('0xa'));var crypto=require(_0x27a2('0xb'));var jsforce=require(_0x27a2('0xc'));var deskjs=require(_0x27a2('0xd'));var toCsv=require(_0x27a2('0x9'));var querystring=require(_0x27a2('0xe'));var Papa=require('papaparse');var Redis=require(_0x27a2('0xf'));var authService=require(_0x27a2('0x10'));var qs=require(_0x27a2('0x11'));var as=require(_0x27a2('0x12'));var hardwareService=require(_0x27a2('0x13'));var logger=require('../../config/logger')(_0x27a2('0x14'));var utils=require(_0x27a2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x27a2('0x16'))['db'];function respondWithStatusCode(_0x465f90,_0x184d0e){_0x184d0e=_0x184d0e||0xcc;return function(_0x2cf540){if(_0x2cf540){return _0x465f90[_0x27a2('0x17')](_0x184d0e);}return _0x465f90[_0x27a2('0x18')](_0x184d0e)[_0x27a2('0x19')]();};}function respondWithResult(_0x16b1d6,_0x22cd9c){_0x22cd9c=_0x22cd9c||0xc8;return function(_0x16c951){if(_0x16c951){return _0x16b1d6['status'](_0x22cd9c)[_0x27a2('0x1a')](_0x16c951);}};}function respondWithFilteredResult(_0xdf3312,_0x3863bc){return function(_0x11134f){if(_0x11134f){var _0x18aa51=_0x11134f['count'],_0x1e90b3=_0x3863bc[_0x27a2('0x1b')],_0xf36ef8=_0x3863bc[_0x27a2('0x1b')]+_0x3863bc[_0x27a2('0x1c')],_0x10c2a5;if(_0xf36ef8>=_0x18aa51){_0xf36ef8=_0x18aa51;_0x10c2a5=0xc8;}else{_0x10c2a5=0xce;}_0xdf3312[_0x27a2('0x18')](_0x10c2a5);return _0xdf3312[_0x27a2('0x1d')]('Content-Range',_0x1e90b3+'-'+_0xf36ef8+'/'+_0x18aa51)[_0x27a2('0x1a')](_0x11134f);}return null;};}function patchUpdates(_0x26d9d0){return function(_0xf68500){try{jsonpatch[_0x27a2('0x1e')](_0xf68500,_0x26d9d0,!![]);}catch(_0x53d816){return BPromise['reject'](_0x53d816);}return _0xf68500[_0x27a2('0x1f')]();};}function saveUpdates(_0x4200e8,_0x524c4b){return function(_0x568be5){if(_0x568be5){return _0x568be5['update'](_0x4200e8)[_0x27a2('0x20')](function(_0x1b43ee){return _0x1b43ee;});}return null;};}function removeEntity(_0x2b5dc6,_0x70b625){return function(_0x4858d0){if(_0x4858d0){return _0x4858d0['destroy']()[_0x27a2('0x20')](function(){_0x2b5dc6[_0x27a2('0x18')](0xcc)[_0x27a2('0x19')]();});}};}function handleEntityNotFound(_0x36bd7a,_0x345f4e){return function(_0x574705){if(!_0x574705){_0x36bd7a['sendStatus'](0x194);}return _0x574705;};}function handleError(_0x487421,_0x2b3e44){_0x2b3e44=_0x2b3e44||0x1f4;return function(_0x38e854){logger[_0x27a2('0x21')](_0x38e854[_0x27a2('0x22')]);if(_0x38e854[_0x27a2('0x23')]){delete _0x38e854[_0x27a2('0x23')];}_0x487421['status'](_0x2b3e44)[_0x27a2('0x24')](_0x38e854);};}exports[_0x27a2('0x25')]=function(_0x462ec6,_0x550b27){var _0x42fc6f={},_0x30b37b={},_0x226022={'count':0x0,'rows':[]};var _0x40af33=_[_0x27a2('0x26')](db[_0x27a2('0x27')][_0x27a2('0x28')],function(_0x40fd2a){return{'name':_0x40fd2a[_0x27a2('0x29')],'type':_0x40fd2a[_0x27a2('0x2a')][_0x27a2('0x2b')]};});_0x30b37b[_0x27a2('0x2c')]=_[_0x27a2('0x26')](_0x40af33,'name');_0x30b37b[_0x27a2('0x2d')]=_[_0x27a2('0x2e')](_0x462ec6[_0x27a2('0x2d')]);_0x30b37b[_0x27a2('0x2f')]=_[_0x27a2('0x30')](_0x30b37b['model'],_0x30b37b[_0x27a2('0x2d')]);_0x42fc6f[_0x27a2('0x31')]=_[_0x27a2('0x30')](_0x30b37b[_0x27a2('0x2c')],qs[_0x27a2('0x32')](_0x462ec6[_0x27a2('0x2d')][_0x27a2('0x32')]));_0x42fc6f[_0x27a2('0x31')]=_0x42fc6f[_0x27a2('0x31')][_0x27a2('0x33')]?_0x42fc6f[_0x27a2('0x31')]:_0x30b37b[_0x27a2('0x2c')];if(!_0x462ec6['query']['hasOwnProperty'](_0x27a2('0x34'))){_0x42fc6f[_0x27a2('0x1c')]=qs[_0x27a2('0x1c')](_0x462ec6[_0x27a2('0x2d')][_0x27a2('0x1c')]);_0x42fc6f['offset']=qs['offset'](_0x462ec6['query'][_0x27a2('0x1b')]);}_0x42fc6f[_0x27a2('0x35')]=qs[_0x27a2('0x36')](_0x462ec6[_0x27a2('0x2d')]['sort']);_0x42fc6f[_0x27a2('0x37')]=qs[_0x27a2('0x2f')](_[_0x27a2('0x38')](_0x462ec6[_0x27a2('0x2d')],_0x30b37b[_0x27a2('0x2f')]),_0x40af33);if(_0x462ec6['query']['filter']){_0x42fc6f[_0x27a2('0x37')]=_[_0x27a2('0x39')](_0x42fc6f[_0x27a2('0x37')],{'$or':_[_0x27a2('0x26')](_0x40af33,function(_0x4b4ee2){if(_0x4b4ee2['type']!==_0x27a2('0x3a')){var _0x426e7b={};_0x426e7b[_0x4b4ee2[_0x27a2('0x23')]]={'$like':'%'+_0x462ec6[_0x27a2('0x2d')]['filter']+'%'};return _0x426e7b;}})});}_0x42fc6f=_[_0x27a2('0x39')]({},_0x42fc6f,_0x462ec6[_0x27a2('0x3b')]);var _0x18e50f={'where':_0x42fc6f[_0x27a2('0x37')]};return db[_0x27a2('0x27')][_0x27a2('0x3c')](_0x18e50f)[_0x27a2('0x20')](function(_0x862355){_0x226022[_0x27a2('0x3c')]=_0x862355;if(_0x462ec6[_0x27a2('0x2d')][_0x27a2('0x3d')]){_0x42fc6f[_0x27a2('0x3e')]=[{'all':!![]}];}return db[_0x27a2('0x27')][_0x27a2('0x3f')](_0x42fc6f);})[_0x27a2('0x20')](function(_0x326c73){_0x226022[_0x27a2('0x40')]=_0x326c73;return _0x226022;})['then'](respondWithFilteredResult(_0x550b27,_0x42fc6f))[_0x27a2('0x41')](handleError(_0x550b27,null));};exports[_0x27a2('0x42')]=function(_0x4869eb,_0x247f41){var _0x1e5bf2={'raw':!![],'where':{'id':_0x4869eb['params']['id']}},_0x1019d2={};_0x1019d2['model']=_['keys'](db[_0x27a2('0x27')][_0x27a2('0x28')]);_0x1019d2[_0x27a2('0x2d')]=_['keys'](_0x4869eb[_0x27a2('0x2d')]);_0x1019d2[_0x27a2('0x2f')]=_[_0x27a2('0x30')](_0x1019d2['model'],_0x1019d2['query']);_0x1e5bf2['attributes']=_[_0x27a2('0x30')](_0x1019d2[_0x27a2('0x2c')],qs[_0x27a2('0x32')](_0x4869eb[_0x27a2('0x2d')][_0x27a2('0x32')]));_0x1e5bf2[_0x27a2('0x31')]=_0x1e5bf2[_0x27a2('0x31')][_0x27a2('0x33')]?_0x1e5bf2['attributes']:_0x1019d2[_0x27a2('0x2c')];if(_0x4869eb[_0x27a2('0x2d')]['includeAll']){_0x1e5bf2['include']=[{'all':!![]}];}_0x1e5bf2=_[_0x27a2('0x39')]({},_0x1e5bf2,_0x4869eb[_0x27a2('0x3b')]);return db[_0x27a2('0x27')][_0x27a2('0x43')](_0x1e5bf2)['then'](handleEntityNotFound(_0x247f41,null))[_0x27a2('0x20')](respondWithResult(_0x247f41,null))[_0x27a2('0x41')](handleError(_0x247f41,null));};exports['create']=function(_0x30ae22,_0x4b2ae2){return db[_0x27a2('0x27')]['create'](_0x30ae22[_0x27a2('0x44')],{})[_0x27a2('0x20')](respondWithResult(_0x4b2ae2,0xc9))[_0x27a2('0x41')](handleError(_0x4b2ae2,null));};exports[_0x27a2('0x45')]=function(_0x2b6786,_0x18bc5d){if(_0x2b6786[_0x27a2('0x44')]['id']){delete _0x2b6786[_0x27a2('0x44')]['id'];}return db['OpenchannelTransferReport'][_0x27a2('0x43')]({'where':{'id':_0x2b6786[_0x27a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x18bc5d,null))[_0x27a2('0x20')](saveUpdates(_0x2b6786[_0x27a2('0x44')],null))[_0x27a2('0x20')](respondWithResult(_0x18bc5d,null))[_0x27a2('0x41')](handleError(_0x18bc5d,null));};exports[_0x27a2('0x47')]=function(_0x5151f5,_0x53f618){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5151f5[_0x27a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x53f618,null))[_0x27a2('0x20')](removeEntity(_0x53f618,null))[_0x27a2('0x41')](handleError(_0x53f618,null));};exports['describe']=function(_0x176d42,_0x3246bc){return db[_0x27a2('0x27')][_0x27a2('0x48')]()['then'](respondWithResult(_0x3246bc,null))[_0x27a2('0x41')](handleError(_0x3246bc,null));}; \ No newline at end of file +var _0x2edc=['attributes','intersection','model','fields','length','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','query','keys','filters'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x2edc,0x68));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc2ed('0x0'));var emlformat=require(_0xc2ed('0x1'));var rimraf=require(_0xc2ed('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2ed('0x3'));var rp=require(_0xc2ed('0x4'));var moment=require(_0xc2ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2ed('0x6'));var util=require(_0xc2ed('0x7'));var path=require(_0xc2ed('0x8'));var sox=require('sox');var csv=require(_0xc2ed('0x9'));var ejs=require(_0xc2ed('0xa'));var fs=require('fs');var _=require(_0xc2ed('0xb'));var squel=require('squel');var crypto=require(_0xc2ed('0xc'));var jsforce=require(_0xc2ed('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc2ed('0x9'));var querystring=require('querystring');var Papa=require(_0xc2ed('0xe'));var Redis=require(_0xc2ed('0xf'));var authService=require(_0xc2ed('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc2ed('0x11'));var hardwareService=require(_0xc2ed('0x12'));var logger=require(_0xc2ed('0x13'))(_0xc2ed('0x14'));var utils=require(_0xc2ed('0x15'));var config=require(_0xc2ed('0x16'));var licenseUtil=require(_0xc2ed('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe480b7,_0x3299b4){_0x3299b4=_0x3299b4||0xcc;return function(_0x529110){if(_0x529110){return _0xe480b7[_0xc2ed('0x18')](_0x3299b4);}return _0xe480b7[_0xc2ed('0x19')](_0x3299b4)[_0xc2ed('0x1a')]();};}function respondWithResult(_0x412a41,_0x527595){_0x527595=_0x527595||0xc8;return function(_0x5d6366){if(_0x5d6366){return _0x412a41[_0xc2ed('0x19')](_0x527595)[_0xc2ed('0x1b')](_0x5d6366);}};}function respondWithFilteredResult(_0xf69e4f,_0x690cd){return function(_0x155827){if(_0x155827){var _0x3c404c=_0x155827['count'],_0x525133=_0x690cd['offset'],_0x4b3083=_0x690cd['offset']+_0x690cd['limit'],_0x2df723;if(_0x4b3083>=_0x3c404c){_0x4b3083=_0x3c404c;_0x2df723=0xc8;}else{_0x2df723=0xce;}_0xf69e4f[_0xc2ed('0x19')](_0x2df723);return _0xf69e4f['set'](_0xc2ed('0x1c'),_0x525133+'-'+_0x4b3083+'/'+_0x3c404c)[_0xc2ed('0x1b')](_0x155827);}return null;};}function patchUpdates(_0x2317d8){return function(_0x16d6f2){try{jsonpatch[_0xc2ed('0x1d')](_0x16d6f2,_0x2317d8,!![]);}catch(_0x5849ce){return BPromise[_0xc2ed('0x1e')](_0x5849ce);}return _0x16d6f2['save']();};}function saveUpdates(_0x1b1268,_0x586bcc){return function(_0x15ea3a){if(_0x15ea3a){return _0x15ea3a[_0xc2ed('0x1f')](_0x1b1268)['then'](function(_0x3262f3){return _0x3262f3;});}return null;};}function removeEntity(_0x30cf34,_0x29d805){return function(_0x37f02b){if(_0x37f02b){return _0x37f02b[_0xc2ed('0x20')]()['then'](function(){_0x30cf34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e6a2,_0x4e7574){return function(_0x59dd6e){if(!_0x59dd6e){_0x35e6a2[_0xc2ed('0x18')](0x194);}return _0x59dd6e;};}function handleError(_0x4f6b53,_0xb7003c){_0xb7003c=_0xb7003c||0x1f4;return function(_0x4681d0){logger[_0xc2ed('0x21')](_0x4681d0[_0xc2ed('0x22')]);if(_0x4681d0[_0xc2ed('0x23')]){delete _0x4681d0[_0xc2ed('0x23')];}_0x4f6b53[_0xc2ed('0x19')](_0xb7003c)[_0xc2ed('0x24')](_0x4681d0);};}exports[_0xc2ed('0x25')]=function(_0x373425,_0x4cd234){var _0x3fb23e={},_0x4c4006={},_0x3de259={'count':0x0,'rows':[]};var _0x2afac9=_[_0xc2ed('0x26')](db[_0xc2ed('0x27')][_0xc2ed('0x28')],function(_0x5bcca6){return{'name':_0x5bcca6['fieldName'],'type':_0x5bcca6[_0xc2ed('0x29')][_0xc2ed('0x2a')]};});_0x4c4006['model']=_[_0xc2ed('0x26')](_0x2afac9,_0xc2ed('0x23'));_0x4c4006[_0xc2ed('0x2b')]=_[_0xc2ed('0x2c')](_0x373425[_0xc2ed('0x2b')]);_0x4c4006[_0xc2ed('0x2d')]=_['intersection'](_0x4c4006['model'],_0x4c4006[_0xc2ed('0x2b')]);_0x3fb23e[_0xc2ed('0x2e')]=_[_0xc2ed('0x2f')](_0x4c4006[_0xc2ed('0x30')],qs['fields'](_0x373425[_0xc2ed('0x2b')][_0xc2ed('0x31')]));_0x3fb23e[_0xc2ed('0x2e')]=_0x3fb23e[_0xc2ed('0x2e')][_0xc2ed('0x32')]?_0x3fb23e[_0xc2ed('0x2e')]:_0x4c4006[_0xc2ed('0x30')];if(!_0x373425[_0xc2ed('0x2b')]['hasOwnProperty'](_0xc2ed('0x33'))){_0x3fb23e['limit']=qs[_0xc2ed('0x34')](_0x373425[_0xc2ed('0x2b')][_0xc2ed('0x34')]);_0x3fb23e[_0xc2ed('0x35')]=qs[_0xc2ed('0x35')](_0x373425['query'][_0xc2ed('0x35')]);}_0x3fb23e[_0xc2ed('0x36')]=qs[_0xc2ed('0x37')](_0x373425['query'][_0xc2ed('0x37')]);_0x3fb23e[_0xc2ed('0x38')]=qs['filters'](_[_0xc2ed('0x39')](_0x373425[_0xc2ed('0x2b')],_0x4c4006[_0xc2ed('0x2d')]),_0x2afac9);if(_0x373425[_0xc2ed('0x2b')][_0xc2ed('0x3a')]){_0x3fb23e[_0xc2ed('0x38')]=_[_0xc2ed('0x3b')](_0x3fb23e[_0xc2ed('0x38')],{'$or':_['map'](_0x2afac9,function(_0x45a165){if(_0x45a165['type']!==_0xc2ed('0x3c')){var _0x3ce37f={};_0x3ce37f[_0x45a165[_0xc2ed('0x23')]]={'$like':'%'+_0x373425['query'][_0xc2ed('0x3a')]+'%'};return _0x3ce37f;}})});}_0x3fb23e=_['merge']({},_0x3fb23e,_0x373425[_0xc2ed('0x3d')]);var _0x9e6f7a={'where':_0x3fb23e[_0xc2ed('0x38')]};return db['OpenchannelTransferReport'][_0xc2ed('0x3e')](_0x9e6f7a)[_0xc2ed('0x3f')](function(_0x3fc9c5){_0x3de259[_0xc2ed('0x3e')]=_0x3fc9c5;if(_0x373425[_0xc2ed('0x2b')][_0xc2ed('0x40')]){_0x3fb23e[_0xc2ed('0x41')]=[{'all':!![]}];}return db[_0xc2ed('0x27')][_0xc2ed('0x42')](_0x3fb23e);})['then'](function(_0x3e5668){_0x3de259[_0xc2ed('0x43')]=_0x3e5668;return _0x3de259;})['then'](respondWithFilteredResult(_0x4cd234,_0x3fb23e))[_0xc2ed('0x44')](handleError(_0x4cd234,null));};exports[_0xc2ed('0x45')]=function(_0x1bf037,_0x3e8843){var _0x1e27c7={'raw':!![],'where':{'id':_0x1bf037[_0xc2ed('0x46')]['id']}},_0x3ffe0b={};_0x3ffe0b[_0xc2ed('0x30')]=_[_0xc2ed('0x2c')](db['OpenchannelTransferReport'][_0xc2ed('0x28')]);_0x3ffe0b['query']=_[_0xc2ed('0x2c')](_0x1bf037[_0xc2ed('0x2b')]);_0x3ffe0b[_0xc2ed('0x2d')]=_[_0xc2ed('0x2f')](_0x3ffe0b['model'],_0x3ffe0b[_0xc2ed('0x2b')]);_0x1e27c7[_0xc2ed('0x2e')]=_[_0xc2ed('0x2f')](_0x3ffe0b[_0xc2ed('0x30')],qs[_0xc2ed('0x31')](_0x1bf037[_0xc2ed('0x2b')][_0xc2ed('0x31')]));_0x1e27c7[_0xc2ed('0x2e')]=_0x1e27c7[_0xc2ed('0x2e')][_0xc2ed('0x32')]?_0x1e27c7[_0xc2ed('0x2e')]:_0x3ffe0b['model'];if(_0x1bf037[_0xc2ed('0x2b')][_0xc2ed('0x40')]){_0x1e27c7[_0xc2ed('0x41')]=[{'all':!![]}];}_0x1e27c7=_['merge']({},_0x1e27c7,_0x1bf037[_0xc2ed('0x3d')]);return db[_0xc2ed('0x27')]['find'](_0x1e27c7)['then'](handleEntityNotFound(_0x3e8843,null))[_0xc2ed('0x3f')](respondWithResult(_0x3e8843,null))[_0xc2ed('0x44')](handleError(_0x3e8843,null));};exports[_0xc2ed('0x47')]=function(_0x541d32,_0x4219e1){return db[_0xc2ed('0x27')][_0xc2ed('0x47')](_0x541d32[_0xc2ed('0x48')],{})[_0xc2ed('0x3f')](respondWithResult(_0x4219e1,0xc9))[_0xc2ed('0x44')](handleError(_0x4219e1,null));};exports[_0xc2ed('0x1f')]=function(_0x5026af,_0x261937){if(_0x5026af[_0xc2ed('0x48')]['id']){delete _0x5026af[_0xc2ed('0x48')]['id'];}return db['OpenchannelTransferReport'][_0xc2ed('0x49')]({'where':{'id':_0x5026af[_0xc2ed('0x46')]['id']}})[_0xc2ed('0x3f')](handleEntityNotFound(_0x261937,null))[_0xc2ed('0x3f')](saveUpdates(_0x5026af[_0xc2ed('0x48')],null))[_0xc2ed('0x3f')](respondWithResult(_0x261937,null))[_0xc2ed('0x44')](handleError(_0x261937,null));};exports[_0xc2ed('0x20')]=function(_0x425c5e,_0x548697){return db[_0xc2ed('0x27')][_0xc2ed('0x49')]({'where':{'id':_0x425c5e['params']['id']}})[_0xc2ed('0x3f')](handleEntityNotFound(_0x548697,null))[_0xc2ed('0x3f')](removeEntity(_0x548697,null))[_0xc2ed('0x44')](handleError(_0x548697,null));};exports[_0xc2ed('0x4a')]=function(_0x3b9d81,_0x55ba99){return db[_0xc2ed('0x27')][_0xc2ed('0x4a')]()['then'](respondWithResult(_0x55ba99,null))[_0xc2ed('0x44')](handleError(_0x55ba99,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9eec0be..5e74d6a 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 _0xd95e=['path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x30cbe4,_0x519b42){var _0x237219=function(_0x189443){while(--_0x189443){_0x30cbe4['push'](_0x30cbe4['shift']());}};_0x237219(++_0x519b42);}(_0xd95e,0xfe));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xed95('0x0'));var util=require(_0xed95('0x1'));var logger=require(_0xed95('0x2'))(_0xed95('0x3'));var moment=require('moment');var BPromise=require(_0xed95('0x4'));var rp=require(_0xed95('0x5'));var fs=require('fs');var path=require(_0xed95('0x6'));var rimraf=require('rimraf');var config=require(_0xed95('0x7'));var attributes=require(_0xed95('0x8'));module[_0xed95('0x9')]=function(_0x30639b,_0x311768){return _0x30639b[_0xed95('0xa')](_0xed95('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xed95('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e7c=['request-promise','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','moment','bluebird'];(function(_0x43d4ad,_0x110e14){var _0x4dfd0c=function(_0x5a3a0f){while(--_0x5a3a0f){_0x43d4ad['push'](_0x43d4ad['shift']());}};_0x4dfd0c(++_0x110e14);}(_0x1e7c,0x182));var _0xc1e7=function(_0x4d0f8e,_0x47fd7d){_0x4d0f8e=_0x4d0f8e-0x0;var _0x1e37ab=_0x1e7c[_0x4d0f8e];return _0x1e37ab;};'use strict';var _=require(_0xc1e7('0x0'));var util=require(_0xc1e7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc1e7('0x2'));var BPromise=require(_0xc1e7('0x3'));var rp=require(_0xc1e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1e7('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1e7('0x6'));module['exports']=function(_0x56c219,_0x4fd8a8){return _0x56c219[_0xc1e7('0x7')](_0xc1e7('0x8'),attributes,{'tableName':_0xc1e7('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9134595..8c232c8 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 _0xcfbd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash'];(function(_0x177c0f,_0x324360){var _0x1f4d28=function(_0x49d3f0){while(--_0x49d3f0){_0x177c0f['push'](_0x177c0f['shift']());}};_0x1f4d28(++_0x324360);}(_0xcfbd,0x1a1));var _0xdcfb=function(_0x3388a2,_0xbf7e4){_0x3388a2=_0x3388a2-0x0;var _0x11f0e8=_0xcfbd[_0x3388a2];return _0x11f0e8;};'use strict';var _=require(_0xdcfb('0x0'));var util=require(_0xdcfb('0x1'));var moment=require(_0xdcfb('0x2'));var BPromise=require(_0xdcfb('0x3'));var rs=require(_0xdcfb('0x4'));var fs=require('fs');var Redis=require(_0xdcfb('0x5'));var db=require(_0xdcfb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcfb('0x7'))(_0xdcfb('0x8'));var config=require(_0xdcfb('0x9'));var jayson=require(_0xdcfb('0xa'));var client=jayson['client'][_0xdcfb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1f19,_0x5d0b03,_0x3634a1){return new BPromise(function(_0x3d3973,_0x7f49de){return client[_0xdcfb('0xc')](_0x1b1f19,_0x3634a1)[_0xdcfb('0xd')](function(_0x178260){logger[_0xdcfb('0xe')](_0xdcfb('0xf'),_0x5d0b03,_0xdcfb('0x10'));logger[_0xdcfb('0x11')](_0xdcfb('0x12'),_0x5d0b03,'request\x20sent',JSON['stringify'](_0x178260));if(_0x178260['error']){if(_0x178260['error']['code']===0x1f4){logger[_0xdcfb('0x13')](_0xdcfb('0xf'),_0x5d0b03,_0x178260['error'][_0xdcfb('0x14')]);return _0x7f49de(_0x178260['error'][_0xdcfb('0x14')]);}logger[_0xdcfb('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5d0b03,_0x178260['error']['message']);return _0x3d3973(_0x178260[_0xdcfb('0x13')][_0xdcfb('0x14')]);}else{logger[_0xdcfb('0xe')](_0xdcfb('0xf'),_0x5d0b03,_0xdcfb('0x10'));_0x3d3973(_0x178260['result'][_0xdcfb('0x14')]);}})[_0xdcfb('0x15')](function(_0x55bbd8){logger[_0xdcfb('0x13')](_0xdcfb('0xf'),_0x5d0b03,_0x55bbd8);_0x7f49de(_0x55bbd8);});});} \ No newline at end of file +var _0x4b16=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4b16,0xb7));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x64b1('0x0'));var util=require(_0x64b1('0x1'));var moment=require(_0x64b1('0x2'));var BPromise=require(_0x64b1('0x3'));var rs=require(_0x64b1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64b1('0x5'))['db'];var utils=require(_0x64b1('0x6'));var logger=require('../../config/logger')(_0x64b1('0x7'));var config=require(_0x64b1('0x8'));var jayson=require(_0x64b1('0x9'));var client=jayson[_0x64b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38c071,_0x55e0f9,_0x3016da){return new BPromise(function(_0x3c8776,_0xbec7cd){return client[_0x64b1('0xb')](_0x38c071,_0x3016da)[_0x64b1('0xc')](function(_0x2afc22){logger[_0x64b1('0xd')](_0x64b1('0xe'),_0x55e0f9,_0x64b1('0xf'));logger[_0x64b1('0x10')](_0x64b1('0x11'),_0x55e0f9,'request\x20sent',JSON[_0x64b1('0x12')](_0x2afc22));if(_0x2afc22['error']){if(_0x2afc22[_0x64b1('0x13')]['code']===0x1f4){logger[_0x64b1('0x13')](_0x64b1('0xe'),_0x55e0f9,_0x2afc22[_0x64b1('0x13')][_0x64b1('0x14')]);return _0xbec7cd(_0x2afc22[_0x64b1('0x13')][_0x64b1('0x14')]);}logger[_0x64b1('0x13')](_0x64b1('0xe'),_0x55e0f9,_0x2afc22[_0x64b1('0x13')][_0x64b1('0x14')]);return _0x3c8776(_0x2afc22[_0x64b1('0x13')][_0x64b1('0x14')]);}else{logger['info'](_0x64b1('0xe'),_0x55e0f9,'request\x20sent');_0x3c8776(_0x2afc22[_0x64b1('0x15')][_0x64b1('0x14')]);}})[_0x64b1('0x16')](function(_0x312bb4){logger[_0x64b1('0x13')](_0x64b1('0xe'),_0x55e0f9,_0x312bb4);_0xbec7cd(_0x312bb4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 72e92a2..5b8177d 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 _0x2912=['show','post','create','put','delete','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x34f4cd,_0x799315){var _0x1330fc=function(_0x2a3595){while(--_0x2a3595){_0x34f4cd['push'](_0x34f4cd['shift']());}};_0x1330fc(++_0x799315);}(_0x2912,0x1d8));var _0x2291=function(_0x3b8d8f,_0x54639a){_0x3b8d8f=_0x3b8d8f-0x0;var _0x22c060=_0x2912[_0x3b8d8f];return _0x22c060;};'use strict';var multer=require(_0x2291('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2291('0x1'));var router=express['Router']();var auth=require(_0x2291('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2291('0x3'));var controller=require('./pause.controller');router[_0x2291('0x4')]('/',auth[_0x2291('0x5')](),controller[_0x2291('0x6')]);router['get'](_0x2291('0x7'),auth['isAuthenticated'](),controller[_0x2291('0x8')]);router[_0x2291('0x9')]('/',auth[_0x2291('0x5')](),controller[_0x2291('0xa')]);router[_0x2291('0xb')](_0x2291('0x7'),auth[_0x2291('0x5')](),controller['update']);router[_0x2291('0xc')]('/:id',auth[_0x2291('0x5')](),controller[_0x2291('0xd')]);module[_0x2291('0xe')]=router; \ No newline at end of file +var _0x670f=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x670f,0x1c3));var _0xf670=function(_0x207993,_0x28ca68){_0x207993=_0x207993-0x0;var _0x149942=_0x670f[_0x207993];return _0x149942;};'use strict';var multer=require(_0xf670('0x0'));var util=require(_0xf670('0x1'));var path=require(_0xf670('0x2'));var timeout=require('connect-timeout');var express=require(_0xf670('0x3'));var router=express['Router']();var auth=require(_0xf670('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf670('0x5'));var controller=require('./pause.controller');router[_0xf670('0x6')]('/',auth[_0xf670('0x7')](),controller[_0xf670('0x8')]);router['get'](_0xf670('0x9'),auth[_0xf670('0x7')](),controller[_0xf670('0xa')]);router['post']('/',auth[_0xf670('0x7')](),controller['create']);router[_0xf670('0xb')](_0xf670('0x9'),auth[_0xf670('0x7')](),controller[_0xf670('0xc')]);router[_0xf670('0xd')](_0xf670('0x9'),auth[_0xf670('0x7')](),controller[_0xf670('0xe')]);module[_0xf670('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 764283b..6c29826 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 _0x9b2c=['name','sequelize','STRING'];(function(_0x38c58a,_0x48fb00){var _0x3b59ed=function(_0x3128d5){while(--_0x3128d5){_0x38c58a['push'](_0x38c58a['shift']());}};_0x3b59ed(++_0x48fb00);}(_0x9b2c,0x106));var _0xc9b2=function(_0x1dad92,_0x2f948c){_0x1dad92=_0x1dad92-0x0;var _0x90a9f6=_0x9b2c[_0x1dad92];return _0x90a9f6;};'use strict';var Sequelize=require(_0xc9b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9b2('0x1')],'unique':_0xc9b2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc9b2('0x1')]}}; \ No newline at end of file +var _0x4f63=['exports','STRING','name','sequelize'];(function(_0x5f2178,_0x10f254){var _0x284a88=function(_0x26fa14){while(--_0x26fa14){_0x5f2178['push'](_0x5f2178['shift']());}};_0x284a88(++_0x10f254);}(_0x4f63,0x1b3));var _0x34f6=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0x4f63[_0x68a0b0];return _0x4b4ee6;};'use strict';var Sequelize=require(_0x34f6('0x0'));module[_0x34f6('0x1')]={'name':{'type':Sequelize[_0x34f6('0x2')],'unique':_0x34f6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x34f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 74852b0..ca7c406 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 _0xaf3c=['attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','include','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','destroy','then','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xaf3c,0x109));var _0xcaf3=function(_0x499ab0,_0x1f2edf){_0x499ab0=_0x499ab0-0x0;var _0x330cf8=_0xaf3c[_0x499ab0];return _0x330cf8;};'use strict';var pdf=require(_0xcaf3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcaf3('0x1'));var zipdir=require(_0xcaf3('0x2'));var jsonpatch=require(_0xcaf3('0x3'));var rp=require(_0xcaf3('0x4'));var moment=require('moment');var BPromise=require(_0xcaf3('0x5'));var Mustache=require(_0xcaf3('0x6'));var util=require(_0xcaf3('0x7'));var path=require(_0xcaf3('0x8'));var sox=require('sox');var csv=require(_0xcaf3('0x9'));var ejs=require(_0xcaf3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcaf3('0xb'));var crypto=require(_0xcaf3('0xc'));var jsforce=require(_0xcaf3('0xd'));var deskjs=require(_0xcaf3('0xe'));var toCsv=require(_0xcaf3('0x9'));var querystring=require('querystring');var Papa=require(_0xcaf3('0xf'));var Redis=require(_0xcaf3('0x10'));var authService=require(_0xcaf3('0x11'));var qs=require(_0xcaf3('0x12'));var as=require(_0xcaf3('0x13'));var hardwareService=require(_0xcaf3('0x14'));var logger=require('../../config/logger')(_0xcaf3('0x15'));var utils=require(_0xcaf3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcaf3('0x17'));var db=require(_0xcaf3('0x18'))['db'];function respondWithStatusCode(_0x44f754,_0x3ee380){_0x3ee380=_0x3ee380||0xcc;return function(_0x16e10b){if(_0x16e10b){return _0x44f754['sendStatus'](_0x3ee380);}return _0x44f754[_0xcaf3('0x19')](_0x3ee380)[_0xcaf3('0x1a')]();};}function respondWithResult(_0x1b4f0a,_0x55a5e7){_0x55a5e7=_0x55a5e7||0xc8;return function(_0x160cfc){if(_0x160cfc){return _0x1b4f0a[_0xcaf3('0x19')](_0x55a5e7)[_0xcaf3('0x1b')](_0x160cfc);}};}function respondWithFilteredResult(_0x1072a3,_0x2059dc){return function(_0x5eb690){if(_0x5eb690){var _0xcbcb1e=_0x5eb690[_0xcaf3('0x1c')],_0x24f1c8=_0x2059dc['offset'],_0xf4b47e=_0x2059dc[_0xcaf3('0x1d')]+_0x2059dc[_0xcaf3('0x1e')],_0x5021a4;if(_0xf4b47e>=_0xcbcb1e){_0xf4b47e=_0xcbcb1e;_0x5021a4=0xc8;}else{_0x5021a4=0xce;}_0x1072a3[_0xcaf3('0x19')](_0x5021a4);return _0x1072a3['set']('Content-Range',_0x24f1c8+'-'+_0xf4b47e+'/'+_0xcbcb1e)[_0xcaf3('0x1b')](_0x5eb690);}return null;};}function patchUpdates(_0x5e343a){return function(_0x243f9f){try{jsonpatch[_0xcaf3('0x1f')](_0x243f9f,_0x5e343a,!![]);}catch(_0x44d24e){return BPromise[_0xcaf3('0x20')](_0x44d24e);}return _0x243f9f[_0xcaf3('0x21')]();};}function saveUpdates(_0x12a545,_0xc62145){return function(_0x19cefe){if(_0x19cefe){return _0x19cefe['update'](_0x12a545)['then'](function(_0x242ad2){return _0x242ad2;});}return null;};}function removeEntity(_0x4b7a44,_0x1f59c3){return function(_0xc9d93a){if(_0xc9d93a){return _0xc9d93a[_0xcaf3('0x22')]()[_0xcaf3('0x23')](function(){var _0x14e92e=_0xc9d93a['get']({'plain':!![]});var _0x121a44=_0xcaf3('0x24');return db[_0xcaf3('0x25')][_0xcaf3('0x22')]({'where':{'type':_0x121a44,'resourceId':_0x14e92e['id']}})[_0xcaf3('0x23')](function(){return _0xc9d93a;});})[_0xcaf3('0x23')](function(){_0x4b7a44[_0xcaf3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be6fe,_0x29b9bf){return function(_0x5f374a){if(!_0x5f374a){_0x1be6fe[_0xcaf3('0x26')](0x194);}return _0x5f374a;};}function handleError(_0x7c3553,_0xdad829){_0xdad829=_0xdad829||0x1f4;return function(_0x1adc4e){logger[_0xcaf3('0x27')](_0x1adc4e[_0xcaf3('0x28')]);if(_0x1adc4e[_0xcaf3('0x29')]){delete _0x1adc4e['name'];}_0x7c3553[_0xcaf3('0x19')](_0xdad829)[_0xcaf3('0x2a')](_0x1adc4e);};}exports[_0xcaf3('0x2b')]=function(_0x4105ef,_0x17b964){var _0x13414b={},_0x3d456a={},_0x4f4d0a={'count':0x0,'rows':[]};var _0x2cba02=_[_0xcaf3('0x2c')](db[_0xcaf3('0x2d')][_0xcaf3('0x2e')],function(_0x33ed35){return{'name':_0x33ed35[_0xcaf3('0x2f')],'type':_0x33ed35[_0xcaf3('0x30')][_0xcaf3('0x31')]};});_0x3d456a[_0xcaf3('0x32')]=_[_0xcaf3('0x2c')](_0x2cba02,'name');_0x3d456a[_0xcaf3('0x33')]=_[_0xcaf3('0x34')](_0x4105ef[_0xcaf3('0x33')]);_0x3d456a[_0xcaf3('0x35')]=_[_0xcaf3('0x36')](_0x3d456a[_0xcaf3('0x32')],_0x3d456a[_0xcaf3('0x33')]);_0x13414b[_0xcaf3('0x37')]=_['intersection'](_0x3d456a[_0xcaf3('0x32')],qs['fields'](_0x4105ef[_0xcaf3('0x33')][_0xcaf3('0x38')]));_0x13414b['attributes']=_0x13414b['attributes'][_0xcaf3('0x39')]?_0x13414b[_0xcaf3('0x37')]:_0x3d456a[_0xcaf3('0x32')];if(!_0x4105ef[_0xcaf3('0x33')][_0xcaf3('0x3a')]('nolimit')){_0x13414b['limit']=qs[_0xcaf3('0x1e')](_0x4105ef[_0xcaf3('0x33')]['limit']);_0x13414b[_0xcaf3('0x1d')]=qs[_0xcaf3('0x1d')](_0x4105ef[_0xcaf3('0x33')][_0xcaf3('0x1d')]);}_0x13414b['order']=qs['sort'](_0x4105ef['query'][_0xcaf3('0x3b')]);_0x13414b[_0xcaf3('0x3c')]=qs['filters'](_[_0xcaf3('0x3d')](_0x4105ef[_0xcaf3('0x33')],_0x3d456a[_0xcaf3('0x35')]),_0x2cba02);if(_0x4105ef[_0xcaf3('0x33')][_0xcaf3('0x3e')]){_0x13414b[_0xcaf3('0x3c')]=_[_0xcaf3('0x3f')](_0x13414b[_0xcaf3('0x3c')],{'$or':_[_0xcaf3('0x2c')](_0x2cba02,function(_0x4c28ae){if(_0x4c28ae[_0xcaf3('0x30')]!==_0xcaf3('0x40')){var _0x1408dc={};_0x1408dc[_0x4c28ae['name']]={'$like':'%'+_0x4105ef['query'][_0xcaf3('0x3e')]+'%'};return _0x1408dc;}})});}_0x13414b=_[_0xcaf3('0x3f')]({},_0x13414b,_0x4105ef[_0xcaf3('0x41')]);var _0x33d32b={'where':_0x13414b['where']};return db[_0xcaf3('0x2d')][_0xcaf3('0x1c')](_0x33d32b)[_0xcaf3('0x23')](function(_0x44eb19){_0x4f4d0a[_0xcaf3('0x1c')]=_0x44eb19;if(_0x4105ef[_0xcaf3('0x33')]['includeAll']){_0x13414b['include']=[{'all':!![]}];}return db[_0xcaf3('0x2d')]['findAll'](_0x13414b);})[_0xcaf3('0x23')](function(_0x50a72e){_0x4f4d0a[_0xcaf3('0x42')]=_0x50a72e;return _0x4f4d0a;})['then'](respondWithFilteredResult(_0x17b964,_0x13414b))[_0xcaf3('0x43')](handleError(_0x17b964,null));};exports[_0xcaf3('0x44')]=function(_0x57d4bc,_0x1d3819){var _0x524487={'raw':!![],'where':{'id':_0x57d4bc[_0xcaf3('0x45')]['id']}},_0x405ea8={};_0x405ea8[_0xcaf3('0x32')]=_[_0xcaf3('0x34')](db[_0xcaf3('0x2d')]['rawAttributes']);_0x405ea8[_0xcaf3('0x33')]=_[_0xcaf3('0x34')](_0x57d4bc[_0xcaf3('0x33')]);_0x405ea8[_0xcaf3('0x35')]=_['intersection'](_0x405ea8['model'],_0x405ea8[_0xcaf3('0x33')]);_0x524487[_0xcaf3('0x37')]=_[_0xcaf3('0x36')](_0x405ea8[_0xcaf3('0x32')],qs[_0xcaf3('0x38')](_0x57d4bc[_0xcaf3('0x33')][_0xcaf3('0x38')]));_0x524487[_0xcaf3('0x37')]=_0x524487[_0xcaf3('0x37')][_0xcaf3('0x39')]?_0x524487[_0xcaf3('0x37')]:_0x405ea8['model'];if(_0x57d4bc[_0xcaf3('0x33')]['includeAll']){_0x524487[_0xcaf3('0x46')]=[{'all':!![]}];}_0x524487=_[_0xcaf3('0x3f')]({},_0x524487,_0x57d4bc[_0xcaf3('0x41')]);return db[_0xcaf3('0x2d')]['find'](_0x524487)[_0xcaf3('0x23')](handleEntityNotFound(_0x1d3819,null))[_0xcaf3('0x23')](respondWithResult(_0x1d3819,null))['catch'](handleError(_0x1d3819,null));};exports[_0xcaf3('0x47')]=function(_0x5595da,_0x51cac4){return db['Pause']['create'](_0x5595da[_0xcaf3('0x48')],{})['then'](function(_0x321961){var _0x1817fa=_0x5595da[_0xcaf3('0x49')][_0xcaf3('0x4a')]({'plain':!![]});if(!_0x1817fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1817fa[_0xcaf3('0x4b')]===_0xcaf3('0x49')){var _0x494063=_0x321961[_0xcaf3('0x4a')]({'plain':!![]});var _0x32075c=_0xcaf3('0x24');return db['UserProfileSection'][_0xcaf3('0x4c')]({'where':{'name':_0x32075c,'userProfileId':_0x1817fa[_0xcaf3('0x4d')]},'raw':!![]})[_0xcaf3('0x23')](function(_0x543af6){if(_0x543af6&&_0x543af6[_0xcaf3('0x4e')]===0x0){return db[_0xcaf3('0x25')]['create']({'name':_0x494063[_0xcaf3('0x29')],'resourceId':_0x494063['id'],'type':_0x543af6[_0xcaf3('0x29')],'sectionId':_0x543af6['id']},{})[_0xcaf3('0x23')](function(){return _0x321961;});}else{return _0x321961;}})[_0xcaf3('0x43')](function(_0x10bd69){logger[_0xcaf3('0x27')](_0xcaf3('0x4f'),_0x10bd69);throw _0x10bd69;});}return _0x321961;})['then'](respondWithResult(_0x51cac4,0xc9))[_0xcaf3('0x43')](handleError(_0x51cac4,null));};exports['update']=function(_0x37e18c,_0x9fc74a){if(_0x37e18c['body']['id']){delete _0x37e18c[_0xcaf3('0x48')]['id'];}return db[_0xcaf3('0x2d')][_0xcaf3('0x4c')]({'where':{'id':_0x37e18c[_0xcaf3('0x45')]['id']}})[_0xcaf3('0x23')](handleEntityNotFound(_0x9fc74a,null))[_0xcaf3('0x23')](saveUpdates(_0x37e18c[_0xcaf3('0x48')],null))[_0xcaf3('0x23')](respondWithResult(_0x9fc74a,null))[_0xcaf3('0x43')](handleError(_0x9fc74a,null));};exports['destroy']=function(_0x4aea0b,_0x43e44d){return db[_0xcaf3('0x2d')][_0xcaf3('0x4c')]({'where':{'id':_0x4aea0b['params']['id']}})[_0xcaf3('0x23')](handleEntityNotFound(_0x43e44d,null))[_0xcaf3('0x23')](removeEntity(_0x43e44d,null))[_0xcaf3('0x43')](handleError(_0x43e44d,null));}; \ No newline at end of file +var _0x19ce=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','index','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19ce,0xf9));var _0xe19c=function(_0x58f147,_0x467c0f){_0x58f147=_0x58f147-0x0;var _0x25b4e1=_0x19ce[_0x58f147];return _0x25b4e1;};'use strict';var pdf=require(_0xe19c('0x0'));var emlformat=require(_0xe19c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe19c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe19c('0x3'));var moment=require(_0xe19c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe19c('0x5'));var util=require(_0xe19c('0x6'));var path=require(_0xe19c('0x7'));var sox=require(_0xe19c('0x8'));var csv=require('to-csv');var ejs=require(_0xe19c('0x9'));var fs=require('fs');var _=require(_0xe19c('0xa'));var squel=require(_0xe19c('0xb'));var crypto=require(_0xe19c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe19c('0xd'));var toCsv=require(_0xe19c('0xe'));var querystring=require(_0xe19c('0xf'));var Papa=require(_0xe19c('0x10'));var Redis=require(_0xe19c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe19c('0x12'));var as=require(_0xe19c('0x13'));var hardwareService=require(_0xe19c('0x14'));var logger=require('../../config/logger')(_0xe19c('0x15'));var utils=require(_0xe19c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe19c('0x17'));var db=require(_0xe19c('0x18'))['db'];function respondWithStatusCode(_0xf3aad6,_0x8bb932){_0x8bb932=_0x8bb932||0xcc;return function(_0x32e501){if(_0x32e501){return _0xf3aad6[_0xe19c('0x19')](_0x8bb932);}return _0xf3aad6[_0xe19c('0x1a')](_0x8bb932)[_0xe19c('0x1b')]();};}function respondWithResult(_0x4bf54a,_0x5c5f03){_0x5c5f03=_0x5c5f03||0xc8;return function(_0x6efd9){if(_0x6efd9){return _0x4bf54a[_0xe19c('0x1a')](_0x5c5f03)[_0xe19c('0x1c')](_0x6efd9);}};}function respondWithFilteredResult(_0x4a6617,_0x469847){return function(_0x3132c6){if(_0x3132c6){var _0x5240f7=_0x3132c6[_0xe19c('0x1d')],_0x2e00aa=_0x469847[_0xe19c('0x1e')],_0x2f349a=_0x469847[_0xe19c('0x1e')]+_0x469847[_0xe19c('0x1f')],_0xb95e1a;if(_0x2f349a>=_0x5240f7){_0x2f349a=_0x5240f7;_0xb95e1a=0xc8;}else{_0xb95e1a=0xce;}_0x4a6617[_0xe19c('0x1a')](_0xb95e1a);return _0x4a6617['set'](_0xe19c('0x20'),_0x2e00aa+'-'+_0x2f349a+'/'+_0x5240f7)[_0xe19c('0x1c')](_0x3132c6);}return null;};}function patchUpdates(_0x1ea74e){return function(_0x1d8af8){try{jsonpatch['apply'](_0x1d8af8,_0x1ea74e,!![]);}catch(_0x2267c8){return BPromise[_0xe19c('0x21')](_0x2267c8);}return _0x1d8af8[_0xe19c('0x22')]();};}function saveUpdates(_0x5a66a0,_0x24c86c){return function(_0x334faa){if(_0x334faa){return _0x334faa[_0xe19c('0x23')](_0x5a66a0)[_0xe19c('0x24')](function(_0x13c11a){return _0x13c11a;});}return null;};}function removeEntity(_0x2d1c0e,_0x3fc743){return function(_0xb01f90){if(_0xb01f90){return _0xb01f90['destroy']()[_0xe19c('0x24')](function(){var _0x52dc5d=_0xb01f90[_0xe19c('0x25')]({'plain':!![]});var _0x22ee6f=_0xe19c('0x26');return db[_0xe19c('0x27')][_0xe19c('0x28')]({'where':{'type':_0x22ee6f,'resourceId':_0x52dc5d['id']}})[_0xe19c('0x24')](function(){return _0xb01f90;});})[_0xe19c('0x24')](function(){_0x2d1c0e[_0xe19c('0x1a')](0xcc)[_0xe19c('0x1b')]();});}};}function handleEntityNotFound(_0x1d950c,_0x514466){return function(_0x1fd82d){if(!_0x1fd82d){_0x1d950c['sendStatus'](0x194);}return _0x1fd82d;};}function handleError(_0x30d3a9,_0x25eac7){_0x25eac7=_0x25eac7||0x1f4;return function(_0x4f85d9){logger[_0xe19c('0x29')](_0x4f85d9[_0xe19c('0x2a')]);if(_0x4f85d9['name']){delete _0x4f85d9[_0xe19c('0x2b')];}_0x30d3a9['status'](_0x25eac7)['send'](_0x4f85d9);};}exports[_0xe19c('0x2c')]=function(_0x59e69d,_0x260966){var _0x2d0025={},_0x46ab76={},_0x494225={'count':0x0,'rows':[]};var _0x31cddd=_[_0xe19c('0x2d')](db[_0xe19c('0x2e')][_0xe19c('0x2f')],function(_0x141829){return{'name':_0x141829[_0xe19c('0x30')],'type':_0x141829['type'][_0xe19c('0x31')]};});_0x46ab76[_0xe19c('0x32')]=_[_0xe19c('0x2d')](_0x31cddd,_0xe19c('0x2b'));_0x46ab76[_0xe19c('0x33')]=_[_0xe19c('0x34')](_0x59e69d['query']);_0x46ab76[_0xe19c('0x35')]=_['intersection'](_0x46ab76[_0xe19c('0x32')],_0x46ab76[_0xe19c('0x33')]);_0x2d0025[_0xe19c('0x36')]=_[_0xe19c('0x37')](_0x46ab76[_0xe19c('0x32')],qs['fields'](_0x59e69d[_0xe19c('0x33')][_0xe19c('0x38')]));_0x2d0025['attributes']=_0x2d0025['attributes'][_0xe19c('0x39')]?_0x2d0025[_0xe19c('0x36')]:_0x46ab76[_0xe19c('0x32')];if(!_0x59e69d[_0xe19c('0x33')]['hasOwnProperty'](_0xe19c('0x3a'))){_0x2d0025['limit']=qs[_0xe19c('0x1f')](_0x59e69d[_0xe19c('0x33')][_0xe19c('0x1f')]);_0x2d0025['offset']=qs[_0xe19c('0x1e')](_0x59e69d['query'][_0xe19c('0x1e')]);}_0x2d0025['order']=qs[_0xe19c('0x3b')](_0x59e69d[_0xe19c('0x33')][_0xe19c('0x3b')]);_0x2d0025[_0xe19c('0x3c')]=qs[_0xe19c('0x35')](_['pick'](_0x59e69d['query'],_0x46ab76[_0xe19c('0x35')]),_0x31cddd);if(_0x59e69d['query'][_0xe19c('0x3d')]){_0x2d0025['where']=_[_0xe19c('0x3e')](_0x2d0025[_0xe19c('0x3c')],{'$or':_[_0xe19c('0x2d')](_0x31cddd,function(_0x24c2be){if(_0x24c2be[_0xe19c('0x3f')]!==_0xe19c('0x40')){var _0x549f4d={};_0x549f4d[_0x24c2be[_0xe19c('0x2b')]]={'$like':'%'+_0x59e69d[_0xe19c('0x33')]['filter']+'%'};return _0x549f4d;}})});}_0x2d0025=_[_0xe19c('0x3e')]({},_0x2d0025,_0x59e69d[_0xe19c('0x41')]);var _0x162715={'where':_0x2d0025['where']};return db[_0xe19c('0x2e')][_0xe19c('0x1d')](_0x162715)[_0xe19c('0x24')](function(_0x2d6e18){_0x494225['count']=_0x2d6e18;if(_0x59e69d[_0xe19c('0x33')][_0xe19c('0x42')]){_0x2d0025[_0xe19c('0x43')]=[{'all':!![]}];}return db[_0xe19c('0x2e')][_0xe19c('0x44')](_0x2d0025);})[_0xe19c('0x24')](function(_0x2cbca1){_0x494225['rows']=_0x2cbca1;return _0x494225;})[_0xe19c('0x24')](respondWithFilteredResult(_0x260966,_0x2d0025))['catch'](handleError(_0x260966,null));};exports[_0xe19c('0x45')]=function(_0x30b2a8,_0x4471fd){var _0x1bf098={'raw':!![],'where':{'id':_0x30b2a8[_0xe19c('0x46')]['id']}},_0x55d780={};_0x55d780[_0xe19c('0x32')]=_[_0xe19c('0x34')](db[_0xe19c('0x2e')][_0xe19c('0x2f')]);_0x55d780[_0xe19c('0x33')]=_[_0xe19c('0x34')](_0x30b2a8[_0xe19c('0x33')]);_0x55d780[_0xe19c('0x35')]=_['intersection'](_0x55d780[_0xe19c('0x32')],_0x55d780[_0xe19c('0x33')]);_0x1bf098[_0xe19c('0x36')]=_[_0xe19c('0x37')](_0x55d780['model'],qs['fields'](_0x30b2a8[_0xe19c('0x33')][_0xe19c('0x38')]));_0x1bf098[_0xe19c('0x36')]=_0x1bf098[_0xe19c('0x36')][_0xe19c('0x39')]?_0x1bf098[_0xe19c('0x36')]:_0x55d780['model'];if(_0x30b2a8[_0xe19c('0x33')][_0xe19c('0x42')]){_0x1bf098[_0xe19c('0x43')]=[{'all':!![]}];}_0x1bf098=_[_0xe19c('0x3e')]({},_0x1bf098,_0x30b2a8[_0xe19c('0x41')]);return db[_0xe19c('0x2e')][_0xe19c('0x47')](_0x1bf098)['then'](handleEntityNotFound(_0x4471fd,null))[_0xe19c('0x24')](respondWithResult(_0x4471fd,null))['catch'](handleError(_0x4471fd,null));};exports[_0xe19c('0x48')]=function(_0x364019,_0x1c7a0c){return db['Pause'][_0xe19c('0x48')](_0x364019[_0xe19c('0x49')],{})[_0xe19c('0x24')](function(_0x8f9269){var _0x1fefe6=_0x364019[_0xe19c('0x4a')][_0xe19c('0x25')]({'plain':!![]});if(!_0x1fefe6)throw new Error(_0xe19c('0x4b'));if(_0x1fefe6[_0xe19c('0x4c')]===_0xe19c('0x4a')){var _0x33ab9e=_0x8f9269[_0xe19c('0x25')]({'plain':!![]});var _0x5f0f9d='Pauses';return db[_0xe19c('0x4d')][_0xe19c('0x47')]({'where':{'name':_0x5f0f9d,'userProfileId':_0x1fefe6['userProfileId']},'raw':!![]})[_0xe19c('0x24')](function(_0x33db52){if(_0x33db52&&_0x33db52[_0xe19c('0x4e')]===0x0){return db[_0xe19c('0x27')][_0xe19c('0x48')]({'name':_0x33ab9e[_0xe19c('0x2b')],'resourceId':_0x33ab9e['id'],'type':_0x33db52[_0xe19c('0x2b')],'sectionId':_0x33db52['id']},{})[_0xe19c('0x24')](function(){return _0x8f9269;});}else{return _0x8f9269;}})['catch'](function(_0x239303){logger['error'](_0xe19c('0x4f'),_0x239303);throw _0x239303;});}return _0x8f9269;})[_0xe19c('0x24')](respondWithResult(_0x1c7a0c,0xc9))['catch'](handleError(_0x1c7a0c,null));};exports[_0xe19c('0x23')]=function(_0x2eed66,_0x300072){if(_0x2eed66[_0xe19c('0x49')]['id']){delete _0x2eed66['body']['id'];}return db['Pause'][_0xe19c('0x47')]({'where':{'id':_0x2eed66['params']['id']}})[_0xe19c('0x24')](handleEntityNotFound(_0x300072,null))['then'](saveUpdates(_0x2eed66[_0xe19c('0x49')],null))[_0xe19c('0x24')](respondWithResult(_0x300072,null))[_0xe19c('0x50')](handleError(_0x300072,null));};exports[_0xe19c('0x28')]=function(_0x127785,_0x22ed21){return db[_0xe19c('0x2e')]['find']({'where':{'id':_0x127785['params']['id']}})[_0xe19c('0x24')](handleEntityNotFound(_0x22ed21,null))['then'](removeEntity(_0x22ed21,null))[_0xe19c('0x50')](handleError(_0x22ed21,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6064406..32329ff 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 _0xd1ca=['lodash','util','bluebird','request-promise','path','../../config/environment','define','tools_pauses'];(function(_0x459f4a,_0x2b20bd){var _0x315c48=function(_0x3b2ca2){while(--_0x3b2ca2){_0x459f4a['push'](_0x459f4a['shift']());}};_0x315c48(++_0x2b20bd);}(_0xd1ca,0x140));var _0xad1c=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd1ca[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xad1c('0x2'));var rp=require(_0xad1c('0x3'));var fs=require('fs');var path=require(_0xad1c('0x4'));var rimraf=require('rimraf');var config=require(_0xad1c('0x5'));var attributes=require('./pause.attributes');module['exports']=function(_0xd08c6,_0x44ae9c){return _0xd08c6[_0xad1c('0x6')]('Pause',attributes,{'tableName':_0xad1c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c91=['util','api','moment','bluebird','path','../../config/environment','define','Pause'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x2c91,0xe0));var _0x12c9=function(_0xe6fa45,_0x5a334b){_0xe6fa45=_0xe6fa45-0x0;var _0x53afca=_0x2c91[_0xe6fa45];return _0x53afca;};'use strict';var _=require('lodash');var util=require(_0x12c9('0x0'));var logger=require('../../config/logger')(_0x12c9('0x1'));var moment=require(_0x12c9('0x2'));var BPromise=require(_0x12c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12c9('0x4'));var rimraf=require('rimraf');var config=require(_0x12c9('0x5'));var attributes=require('./pause.attributes');module['exports']=function(_0x57f5bb,_0x471299){return _0x57f5bb[_0x12c9('0x6')](_0x12c9('0x7'),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 ecb462b..12007c1 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 _0xdcbb=['then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Pause','find','options','where','include','map','model','attributes','ShowPause','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request'];(function(_0x3e65bd,_0xadf15d){var _0x20234b=function(_0x50ddea){while(--_0x50ddea){_0x3e65bd['push'](_0x3e65bd['shift']());}};_0x20234b(++_0xadf15d);}(_0xdcbb,0x18c));var _0xbdcb=function(_0x32b327,_0x3ccb9d){_0x32b327=_0x32b327-0x0;var _0x79055=_0xdcbb[_0x32b327];return _0x79055;};'use strict';var _=require(_0xbdcb('0x0'));var util=require(_0xbdcb('0x1'));var moment=require(_0xbdcb('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdcb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdcb('0x4'))['db'];var utils=require(_0xbdcb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbdcb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbdcb('0x7')][_0xbdcb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41e6ea,_0x360bad,_0x31ddb5){return new BPromise(function(_0x3d9c4e,_0x48f2e4){return client[_0xbdcb('0x9')](_0x41e6ea,_0x31ddb5)[_0xbdcb('0xa')](function(_0x361004){logger[_0xbdcb('0xb')](_0xbdcb('0xc'),_0x360bad,_0xbdcb('0xd'));logger[_0xbdcb('0xe')](_0xbdcb('0xf'),_0x360bad,_0xbdcb('0xd'),JSON[_0xbdcb('0x10')](_0x361004));if(_0x361004[_0xbdcb('0x11')]){if(_0x361004['error']['code']===0x1f4){logger[_0xbdcb('0x11')]('Pause,\x20%s,\x20%s',_0x360bad,_0x361004[_0xbdcb('0x11')][_0xbdcb('0x12')]);return _0x48f2e4(_0x361004[_0xbdcb('0x11')][_0xbdcb('0x12')]);}logger[_0xbdcb('0x11')]('Pause,\x20%s,\x20%s',_0x360bad,_0x361004[_0xbdcb('0x11')][_0xbdcb('0x12')]);return _0x3d9c4e(_0x361004['error'][_0xbdcb('0x12')]);}else{logger[_0xbdcb('0xb')](_0xbdcb('0xc'),_0x360bad,'request\x20sent');_0x3d9c4e(_0x361004['result'][_0xbdcb('0x12')]);}})[_0xbdcb('0x13')](function(_0x3b876b){logger[_0xbdcb('0x11')](_0xbdcb('0xc'),_0x360bad,_0x3b876b);_0x48f2e4(_0x3b876b);});});}exports['ShowPause']=function(_0x99c4f1){var _0x15ab2=this;return new Promise(function(_0x39d2b2,_0x132b8f){return db[_0xbdcb('0x14')][_0xbdcb('0x15')]({'raw':_0x99c4f1[_0xbdcb('0x16')]?_0x99c4f1['options']['raw']===undefined?!![]:![]:!![],'where':_0x99c4f1[_0xbdcb('0x16')]?_0x99c4f1[_0xbdcb('0x16')][_0xbdcb('0x17')]||null:null,'attributes':_0x99c4f1['options']?_0x99c4f1[_0xbdcb('0x16')]['attributes']||null:null,'include':_0x99c4f1[_0xbdcb('0x16')]?_0x99c4f1['options'][_0xbdcb('0x18')]?_[_0xbdcb('0x19')](_0x99c4f1['options']['include'],function(_0x593a62){return{'model':db[_0x593a62[_0xbdcb('0x1a')]],'as':_0x593a62['as'],'attributes':_0x593a62['attributes'],'include':_0x593a62[_0xbdcb('0x18')]?_['map'](_0x593a62[_0xbdcb('0x18')],function(_0x4c2ddc){return{'model':db[_0x4c2ddc[_0xbdcb('0x1a')]],'as':_0x4c2ddc['as'],'attributes':_0x4c2ddc[_0xbdcb('0x1b')],'include':_0x4c2ddc[_0xbdcb('0x18')]?_[_0xbdcb('0x19')](_0x4c2ddc[_0xbdcb('0x18')],function(_0x5d05dd){return{'model':db[_0x5d05dd[_0xbdcb('0x1a')]],'as':_0x5d05dd['as'],'attributes':_0x5d05dd[_0xbdcb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbdcb('0xa')](function(_0x16fea9){logger[_0xbdcb('0xb')](_0xbdcb('0x1c'),_0x99c4f1);logger[_0xbdcb('0xe')]('ShowPause',_0x99c4f1,JSON[_0xbdcb('0x10')](_0x16fea9));_0x39d2b2(_0x16fea9);})[_0xbdcb('0x13')](function(_0x8e02f3){logger[_0xbdcb('0x11')](_0xbdcb('0x1c'),_0x8e02f3[_0xbdcb('0x12')],_0x99c4f1);_0x132b8f(_0x15ab2[_0xbdcb('0x11')](0x1f4,_0x8e02f3['message']));});});}; \ No newline at end of file +var _0x1738=['Pause','find','options','raw','where','map','include','model','attributes','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowPause'];(function(_0x29e643,_0x3a00fc){var _0x4c7eb9=function(_0x50aede){while(--_0x50aede){_0x29e643['push'](_0x29e643['shift']());}};_0x4c7eb9(++_0x3a00fc);}(_0x1738,0x1bc));var _0x8173=function(_0x5db07a,_0x87d434){_0x5db07a=_0x5db07a-0x0;var _0x10a58a=_0x1738[_0x5db07a];return _0x10a58a;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8173('0x2'));var fs=require('fs');var Redis=require(_0x8173('0x3'));var db=require(_0x8173('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8173('0x5'));var config=require(_0x8173('0x6'));var jayson=require(_0x8173('0x7'));var client=jayson[_0x8173('0x8')][_0x8173('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438550,_0x3e4c85,_0x234f2d){return new BPromise(function(_0x13a621,_0x3e37b1){return client['request'](_0x438550,_0x234f2d)['then'](function(_0x1b787d){logger[_0x8173('0xa')](_0x8173('0xb'),_0x3e4c85,'request\x20sent');logger['debug'](_0x8173('0xc'),_0x3e4c85,_0x8173('0xd'),JSON[_0x8173('0xe')](_0x1b787d));if(_0x1b787d[_0x8173('0xf')]){if(_0x1b787d[_0x8173('0xf')]['code']===0x1f4){logger[_0x8173('0xf')]('Pause,\x20%s,\x20%s',_0x3e4c85,_0x1b787d[_0x8173('0xf')][_0x8173('0x10')]);return _0x3e37b1(_0x1b787d[_0x8173('0xf')][_0x8173('0x10')]);}logger[_0x8173('0xf')]('Pause,\x20%s,\x20%s',_0x3e4c85,_0x1b787d[_0x8173('0xf')][_0x8173('0x10')]);return _0x13a621(_0x1b787d[_0x8173('0xf')]['message']);}else{logger['info'](_0x8173('0xb'),_0x3e4c85,_0x8173('0xd'));_0x13a621(_0x1b787d[_0x8173('0x11')]['message']);}})[_0x8173('0x12')](function(_0x114b42){logger['error'](_0x8173('0xb'),_0x3e4c85,_0x114b42);_0x3e37b1(_0x114b42);});});}exports[_0x8173('0x13')]=function(_0x1caca9){var _0x312eae=this;return new Promise(function(_0x1c78cd,_0x4951b2){return db[_0x8173('0x14')][_0x8173('0x15')]({'raw':_0x1caca9[_0x8173('0x16')]?_0x1caca9[_0x8173('0x16')][_0x8173('0x17')]===undefined?!![]:![]:!![],'where':_0x1caca9[_0x8173('0x16')]?_0x1caca9[_0x8173('0x16')][_0x8173('0x18')]||null:null,'attributes':_0x1caca9[_0x8173('0x16')]?_0x1caca9[_0x8173('0x16')]['attributes']||null:null,'include':_0x1caca9[_0x8173('0x16')]?_0x1caca9[_0x8173('0x16')]['include']?_[_0x8173('0x19')](_0x1caca9['options'][_0x8173('0x1a')],function(_0x4be006){return{'model':db[_0x4be006[_0x8173('0x1b')]],'as':_0x4be006['as'],'attributes':_0x4be006['attributes'],'include':_0x4be006[_0x8173('0x1a')]?_[_0x8173('0x19')](_0x4be006['include'],function(_0x2dd5a6){return{'model':db[_0x2dd5a6['model']],'as':_0x2dd5a6['as'],'attributes':_0x2dd5a6[_0x8173('0x1c')],'include':_0x2dd5a6[_0x8173('0x1a')]?_[_0x8173('0x19')](_0x2dd5a6[_0x8173('0x1a')],function(_0x273820){return{'model':db[_0x273820[_0x8173('0x1b')]],'as':_0x273820['as'],'attributes':_0x273820[_0x8173('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b80cb){logger[_0x8173('0xa')]('ShowPause',_0x1caca9);logger['debug'](_0x8173('0x13'),_0x1caca9,JSON[_0x8173('0xe')](_0x2b80cb));_0x1c78cd(_0x2b80cb);})[_0x8173('0x12')](function(_0x5ee6e0){logger['error'](_0x8173('0x13'),_0x5ee6e0[_0x8173('0x10')],_0x1caca9);_0x4951b2(_0x312eae[_0x8173('0xf')](0x1f4,_0x5ee6e0[_0x8173('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 151bdc0..1759410 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 _0x7090=['../../components/interaction/service','../../config/environment','get','/webhook','webhookGet','/:id/download','isAuthenticated','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','post','single','file','upload','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0x7090,0x1bb));var _0x0709=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x7090[_0x1f1e31];return _0x229b56;};'use strict';var multer=require(_0x0709('0x0'));var util=require(_0x0709('0x1'));var path=require(_0x0709('0x2'));var timeout=require(_0x0709('0x3'));var express=require(_0x0709('0x4'));var router=express[_0x0709('0x5')]();var auth=require(_0x0709('0x6'));var interaction=require(_0x0709('0x7'));var config=require(_0x0709('0x8'));var controller=require('./plugin.controller');router[_0x0709('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0709('0x9')](_0x0709('0xa'),controller[_0x0709('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x0709('0xc'),auth[_0x0709('0xd')](),controller['download']);var upload=multer({'storage':multer[_0x0709('0xe')]({'destination':function(_0x5690a4,_0x3a969f,_0x5c392){_0x5c392(null,path['join'](config[_0x0709('0xf')],_0x0709('0x10')));},'filename':function(_0x5b85e3,_0x114317,_0x16daeb){_0x114317[_0x0709('0x11')]=_0x114317['originalname'][_0x0709('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16daeb(null,util[_0x0709('0x13')](_0x0709('0x14'),path[_0x0709('0x15')](_0x114317[_0x0709('0x11')],path['extname'](_0x114317['originalname'])),Date['now'](),path['extname'](_0x114317[_0x0709('0x11')])));}})});router[_0x0709('0x16')]('/',upload[_0x0709('0x17')](_0x0709('0x18')),controller[_0x0709('0x19')]);router[_0x0709('0x16')](_0x0709('0xa'),controller['webhookPost']);router['put']('/:id',auth[_0x0709('0xd')](),controller[_0x0709('0x1a')]);router[_0x0709('0x1b')](_0x0709('0x1c'),auth['isAuthenticated'](),controller['delete']);module[_0x0709('0x1d')]=router; \ No newline at end of file +var _0x4c34=['update','delete','/:id','exports','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','show','diskStorage','server/files/plugins','originalname','replace','format','basename','extname','post','single','upload','webhookPost','put'];(function(_0x28019c,_0x67743){var _0x48ca39=function(_0x4c161e){while(--_0x4c161e){_0x28019c['push'](_0x28019c['shift']());}};_0x48ca39(++_0x67743);}(_0x4c34,0x1ad));var _0x44c3=function(_0xe640bc,_0x4cc93f){_0xe640bc=_0xe640bc-0x0;var _0x2bba13=_0x4c34[_0xe640bc];return _0x2bba13;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44c3('0x0'));var router=express[_0x44c3('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x44c3('0x2'));var config=require(_0x44c3('0x3'));var controller=require(_0x44c3('0x4'));router['get']('/',auth[_0x44c3('0x5')](),controller['index']);router[_0x44c3('0x6')](_0x44c3('0x7'),controller['webhookGet']);router[_0x44c3('0x6')]('/:id',auth[_0x44c3('0x5')](),controller[_0x44c3('0x8')]);router[_0x44c3('0x6')]('/:id/download',auth[_0x44c3('0x5')](),controller['download']);var upload=multer({'storage':multer[_0x44c3('0x9')]({'destination':function(_0xea8ae0,_0xcad4af,_0x2a189f){_0x2a189f(null,path['join'](config['root'],_0x44c3('0xa')));},'filename':function(_0x59cf37,_0x2f29b2,_0x54e1dc){_0x2f29b2[_0x44c3('0xb')]=_0x2f29b2['originalname'][_0x44c3('0xc')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x54e1dc(null,util[_0x44c3('0xd')]('%s-%s%s',path[_0x44c3('0xe')](_0x2f29b2['originalname'],path[_0x44c3('0xf')](_0x2f29b2[_0x44c3('0xb')])),Date['now'](),path[_0x44c3('0xf')](_0x2f29b2[_0x44c3('0xb')])));}})});router[_0x44c3('0x10')]('/',upload[_0x44c3('0x11')]('file'),controller[_0x44c3('0x12')]);router[_0x44c3('0x10')](_0x44c3('0x7'),controller[_0x44c3('0x13')]);router[_0x44c3('0x14')]('/:id',auth[_0x44c3('0x5')](),controller[_0x44c3('0x15')]);router[_0x44c3('0x16')](_0x44c3('0x17'),auth[_0x44c3('0x5')](),controller['delete']);module[_0x44c3('0x18')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a14e3d7..92e56cb 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 _0x8fed=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x4bca4e,_0xa76903){var _0x5cd4d1=function(_0x2e13a8){while(--_0x2e13a8){_0x4bca4e['push'](_0x4bca4e['shift']());}};_0x5cd4d1(++_0xa76903);}(_0x8fed,0xc0));var _0xd8fe=function(_0x4ebe02,_0x139834){_0x4ebe02=_0x4ebe02-0x0;var _0x31dee5=_0x8fed[_0x4ebe02];return _0x31dee5;};'use strict';var Sequelize=require(_0xd8fe('0x0'));module[_0xd8fe('0x1')]={'name':{'type':Sequelize[_0xd8fe('0x2')]},'type':{'type':Sequelize[_0xd8fe('0x3')](_0xd8fe('0x4'),'script')},'description':{'type':Sequelize[_0xd8fe('0x5')]},'version':{'type':Sequelize[_0xd8fe('0x5')]},'path':{'type':Sequelize[_0xd8fe('0x2')],'comment':_0xd8fe('0x6')},'active':{'type':Sequelize[_0xd8fe('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xd8fe('0x8'),_0xd8fe('0x9'),_0xd8fe('0xa'),_0xd8fe('0xb')),'defaultValue':_0xd8fe('0xa'),'comment':_0xd8fe('0xc')},'icon':{'type':Sequelize[_0xd8fe('0x2')]},'adminUrl':{'type':Sequelize[_0xd8fe('0x2')]},'agentUrl':{'type':Sequelize[_0xd8fe('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xd8fe('0x2')]}}; \ No newline at end of file +var _0xd5a2=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','never','always'];(function(_0x3aef06,_0x5b0aea){var _0x551683=function(_0x29f1b9){while(--_0x29f1b9){_0x3aef06['push'](_0x3aef06['shift']());}};_0x551683(++_0x5b0aea);}(_0xd5a2,0x79));var _0x2d5a=function(_0x1c9cde,_0x1433b7){_0x1c9cde=_0x1c9cde-0x0;var _0x32191d=_0xd5a2[_0x1c9cde];return _0x32191d;};'use strict';var Sequelize=require('sequelize');module[_0x2d5a('0x0')]={'name':{'type':Sequelize[_0x2d5a('0x1')]},'type':{'type':Sequelize[_0x2d5a('0x2')](_0x2d5a('0x3'),_0x2d5a('0x4'))},'description':{'type':Sequelize[_0x2d5a('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x2d5a('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2d5a('0x6')],'defaultValue':0x0,'comment':_0x2d5a('0x7')},'sidebar':{'type':Sequelize[_0x2d5a('0x2')]('adminOnly',_0x2d5a('0x8'),'always',_0x2d5a('0x9')),'defaultValue':_0x2d5a('0xa'),'comment':_0x2d5a('0xb')},'icon':{'type':Sequelize[_0x2d5a('0x1')]},'adminUrl':{'type':Sequelize[_0x2d5a('0x1')]},'agentUrl':{'type':Sequelize[_0x2d5a('0x1')]},'scriptName':{'type':Sequelize[_0x2d5a('0x1')]},'scriptPath':{'type':Sequelize[_0x2d5a('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c426931..cebe75e 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 _0xba66=['merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','download','server/files/plugins','format','basename','createWriteStream','zip','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','root','dirname','node_modules/**/*','attachments/**/*','close','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','views','admin','plugins','agent','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','resolve','method','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','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./plugin.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','destroy','then','get','Plugins','UserProfileResource','stack','name','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x1de87c,_0x52ebaf){var _0x38a8e9=function(_0x28721e){while(--_0x28721e){_0x1de87c['push'](_0x1de87c['shift']());}};_0x38a8e9(++_0x52ebaf);}(_0xba66,0x68));var _0x6ba6=function(_0x4e7251,_0x33356c){_0x4e7251=_0x4e7251-0x0;var _0x3c7cec=_0xba66[_0x4e7251];return _0x3c7cec;};'use strict';var pdf=require(_0x6ba6('0x0'));var emlformat=require(_0x6ba6('0x1'));var rimraf=require(_0x6ba6('0x2'));var zipdir=require(_0x6ba6('0x3'));var jsonpatch=require(_0x6ba6('0x4'));var rp=require(_0x6ba6('0x5'));var moment=require(_0x6ba6('0x6'));var BPromise=require(_0x6ba6('0x7'));var Mustache=require(_0x6ba6('0x8'));var util=require(_0x6ba6('0x9'));var path=require(_0x6ba6('0xa'));var sox=require(_0x6ba6('0xb'));var csv=require(_0x6ba6('0xc'));var ejs=require(_0x6ba6('0xd'));var fs=require('fs');var _=require(_0x6ba6('0xe'));var squel=require(_0x6ba6('0xf'));var crypto=require(_0x6ba6('0x10'));var jsforce=require(_0x6ba6('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x6ba6('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x6ba6('0x12'));var rimraf=require('rimraf');var archiver=require(_0x6ba6('0x13'));var Redis=require('ioredis');var authService=require(_0x6ba6('0x14'));var qs=require(_0x6ba6('0x15'));var as=require(_0x6ba6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ba6('0x17'))(_0x6ba6('0x18'));var utils=require(_0x6ba6('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6ba6('0x1a'));var db=require(_0x6ba6('0x1b'))['db'];config[_0x6ba6('0x1c')]=_['defaults'](config[_0x6ba6('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ba6('0x1d'))[_0x6ba6('0x1e')](socket);function respondWithStatusCode(_0x3fcf8c,_0x1b2743){_0x1b2743=_0x1b2743||0xcc;return function(_0x1e326e){if(_0x1e326e){return _0x3fcf8c[_0x6ba6('0x1f')](_0x1b2743);}return _0x3fcf8c[_0x6ba6('0x20')](_0x1b2743)['end']();};}function respondWithResult(_0x18d882,_0x1f6f2f){_0x1f6f2f=_0x1f6f2f||0xc8;return function(_0x17ee0a){if(_0x17ee0a){return _0x18d882[_0x6ba6('0x20')](_0x1f6f2f)[_0x6ba6('0x21')](_0x17ee0a);}};}function respondWithFilteredResult(_0xf68edb,_0x3a913c){return function(_0x5133f6){if(_0x5133f6){var _0x4518b9=_0x5133f6[_0x6ba6('0x22')],_0x58405c=_0x3a913c['offset'],_0xa36c19=_0x3a913c[_0x6ba6('0x23')]+_0x3a913c[_0x6ba6('0x24')],_0x4c542a;if(_0xa36c19>=_0x4518b9){_0xa36c19=_0x4518b9;_0x4c542a=0xc8;}else{_0x4c542a=0xce;}_0xf68edb[_0x6ba6('0x20')](_0x4c542a);return _0xf68edb['set'](_0x6ba6('0x25'),_0x58405c+'-'+_0xa36c19+'/'+_0x4518b9)[_0x6ba6('0x21')](_0x5133f6);}return null;};}function patchUpdates(_0x16aae7){return function(_0x58dd91){try{jsonpatch[_0x6ba6('0x26')](_0x58dd91,_0x16aae7,!![]);}catch(_0xb4bdf1){return BPromise['reject'](_0xb4bdf1);}return _0x58dd91['save']();};}function saveUpdates(_0x2bc8c2,_0x192198){return function(_0x53bb74){if(_0x53bb74){return _0x53bb74[_0x6ba6('0x27')](_0x2bc8c2)['then'](function(_0x214712){return _0x214712;});}return null;};}function removeEntity(_0x39354c,_0x1eb2ec){return function(_0x51cd64){if(_0x51cd64){return _0x51cd64[_0x6ba6('0x28')]()[_0x6ba6('0x29')](function(){var _0x5044ac=_0x51cd64[_0x6ba6('0x2a')]({'plain':!![]});var _0x49b188=_0x6ba6('0x2b');return db[_0x6ba6('0x2c')][_0x6ba6('0x28')]({'where':{'type':_0x49b188,'resourceId':_0x5044ac['id']}})[_0x6ba6('0x29')](function(){return _0x51cd64;});})[_0x6ba6('0x29')](function(){_0x39354c[_0x6ba6('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dd783,_0x33e324){return function(_0x39a0ba){if(!_0x39a0ba){_0x3dd783[_0x6ba6('0x1f')](0x194);}return _0x39a0ba;};}function handleError(_0x40bd4d,_0x1359d3){_0x1359d3=_0x1359d3||0x1f4;return function(_0x3439cb){logger['error'](_0x3439cb[_0x6ba6('0x2d')]);if(_0x3439cb[_0x6ba6('0x2e')]){delete _0x3439cb[_0x6ba6('0x2e')];}_0x40bd4d[_0x6ba6('0x20')](_0x1359d3)['send'](_0x3439cb);};}exports[_0x6ba6('0x2f')]=function(_0x527bcf,_0x466912){var _0x26e472={},_0x2a641e={},_0x3e8465={'count':0x0,'rows':[]};var _0x12272a=_[_0x6ba6('0x30')](db[_0x6ba6('0x31')][_0x6ba6('0x32')],function(_0xd4c208){return{'name':_0xd4c208[_0x6ba6('0x33')],'type':_0xd4c208[_0x6ba6('0x34')]['key']};});_0x2a641e[_0x6ba6('0x35')]=_[_0x6ba6('0x30')](_0x12272a,_0x6ba6('0x2e'));_0x2a641e[_0x6ba6('0x36')]=_[_0x6ba6('0x37')](_0x527bcf[_0x6ba6('0x36')]);_0x2a641e[_0x6ba6('0x38')]=_[_0x6ba6('0x39')](_0x2a641e['model'],_0x2a641e[_0x6ba6('0x36')]);_0x26e472[_0x6ba6('0x3a')]=_[_0x6ba6('0x39')](_0x2a641e[_0x6ba6('0x35')],qs[_0x6ba6('0x3b')](_0x527bcf[_0x6ba6('0x36')]['fields']));_0x26e472['attributes']=_0x26e472[_0x6ba6('0x3a')][_0x6ba6('0x3c')]?_0x26e472['attributes']:_0x2a641e[_0x6ba6('0x35')];if(!_0x527bcf[_0x6ba6('0x36')][_0x6ba6('0x3d')](_0x6ba6('0x3e'))){_0x26e472['limit']=qs[_0x6ba6('0x24')](_0x527bcf[_0x6ba6('0x36')][_0x6ba6('0x24')]);_0x26e472[_0x6ba6('0x23')]=qs[_0x6ba6('0x23')](_0x527bcf[_0x6ba6('0x36')][_0x6ba6('0x23')]);}_0x26e472[_0x6ba6('0x3f')]=qs[_0x6ba6('0x40')](_0x527bcf['query'][_0x6ba6('0x40')]);_0x26e472[_0x6ba6('0x41')]=qs['filters'](_['pick'](_0x527bcf[_0x6ba6('0x36')],_0x2a641e[_0x6ba6('0x38')]),_0x12272a);if(_0x527bcf[_0x6ba6('0x36')][_0x6ba6('0x42')]){_0x26e472[_0x6ba6('0x41')]=_[_0x6ba6('0x43')](_0x26e472[_0x6ba6('0x41')],{'$or':_['map'](_0x12272a,function(_0x168641){if(_0x168641[_0x6ba6('0x34')]!==_0x6ba6('0x44')){var _0x2ab7d5={};_0x2ab7d5[_0x168641[_0x6ba6('0x2e')]]={'$like':'%'+_0x527bcf[_0x6ba6('0x36')]['filter']+'%'};return _0x2ab7d5;}})});}_0x26e472=_[_0x6ba6('0x43')]({},_0x26e472,_0x527bcf[_0x6ba6('0x45')]);var _0x1a66be={'where':_0x26e472[_0x6ba6('0x41')]};return db['Plugin'][_0x6ba6('0x22')](_0x1a66be)[_0x6ba6('0x29')](function(_0x22a00e){_0x3e8465[_0x6ba6('0x22')]=_0x22a00e;if(_0x527bcf['query']['includeAll']){_0x26e472[_0x6ba6('0x46')]=[{'all':!![]}];}return db[_0x6ba6('0x31')][_0x6ba6('0x47')](_0x26e472);})[_0x6ba6('0x29')](function(_0x8733){_0x3e8465[_0x6ba6('0x48')]=_0x8733;return _0x3e8465;})['then'](respondWithFilteredResult(_0x466912,_0x26e472))['catch'](handleError(_0x466912,null));};exports[_0x6ba6('0x49')]=function(_0x5b4c27,_0x469701){var _0x5b3958={'raw':!![],'where':{'id':_0x5b4c27[_0x6ba6('0x4a')]['id']}},_0xab57ab={};_0xab57ab[_0x6ba6('0x35')]=_[_0x6ba6('0x37')](db[_0x6ba6('0x31')][_0x6ba6('0x32')]);_0xab57ab[_0x6ba6('0x36')]=_[_0x6ba6('0x37')](_0x5b4c27[_0x6ba6('0x36')]);_0xab57ab['filters']=_[_0x6ba6('0x39')](_0xab57ab[_0x6ba6('0x35')],_0xab57ab[_0x6ba6('0x36')]);_0x5b3958[_0x6ba6('0x3a')]=_[_0x6ba6('0x39')](_0xab57ab[_0x6ba6('0x35')],qs[_0x6ba6('0x3b')](_0x5b4c27[_0x6ba6('0x36')][_0x6ba6('0x3b')]));_0x5b3958[_0x6ba6('0x3a')]=_0x5b3958[_0x6ba6('0x3a')][_0x6ba6('0x3c')]?_0x5b3958[_0x6ba6('0x3a')]:_0xab57ab['model'];if(_0x5b4c27['query'][_0x6ba6('0x4b')]){_0x5b3958[_0x6ba6('0x46')]=[{'all':!![]}];}_0x5b3958=_[_0x6ba6('0x43')]({},_0x5b3958,_0x5b4c27[_0x6ba6('0x45')]);return db[_0x6ba6('0x31')][_0x6ba6('0x4c')](_0x5b3958)[_0x6ba6('0x29')](handleEntityNotFound(_0x469701,null))[_0x6ba6('0x29')](respondWithResult(_0x469701,null))[_0x6ba6('0x4d')](handleError(_0x469701,null));};exports[_0x6ba6('0x4e')]=function(_0x3a9849,_0x5d7204,_0x389064){return db['Plugin'][_0x6ba6('0x4c')]({'where':{'id':_0x3a9849['params']['id']},'attributes':[_0x6ba6('0x2e'),_0x6ba6('0xa')],'raw':!![]})['then'](handleEntityNotFound(_0x5d7204,null))[_0x6ba6('0x29')](function(_0x39976f){if(_0x39976f){var _0x24e0b4=path['join'](config['root'],_0x6ba6('0x4f'),util[_0x6ba6('0x50')]('%s.zip',path[_0x6ba6('0x51')](_0x39976f[_0x6ba6('0xa')])));var _0x205420=fs[_0x6ba6('0x52')](_0x24e0b4);var _0x5786e8=archiver(_0x6ba6('0x53'),{'zlib':{'level':0x9}});_0x5786e8['on']('warning',function(_0x520c11){if(_0x520c11['code']==='ENOENT'){logger[_0x6ba6('0x54')](_0x520c11);}else{throw new db[(_0x6ba6('0x55'))][(_0x6ba6('0x56'))](_0x6ba6('0x57'));}});_0x5786e8['on'](_0x6ba6('0x54'),function(_0x949dde){throw new db[(_0x6ba6('0x55'))]['Error'](_0x6ba6('0x57'));});_0x5786e8['pipe'](_0x205420);_0x5786e8[_0x6ba6('0x58')](_0x6ba6('0x59'),{'cwd':path[_0x6ba6('0x5a')](config[_0x6ba6('0x5b')],'server/files/plugins',path[_0x6ba6('0x5c')](_0x39976f[_0x6ba6('0xa')])),'ignore':[path[_0x6ba6('0x5a')](path[_0x6ba6('0x51')](_0x39976f[_0x6ba6('0xa')]),_0x6ba6('0x5d')),path['join'](path[_0x6ba6('0x51')](_0x39976f[_0x6ba6('0xa')]),_0x6ba6('0x5e'))],'nodir':!![]})['finalize']();_0x205420['on'](_0x6ba6('0x5f'),function(){if(!fs[_0x6ba6('0x60')](_0x24e0b4)){throw new db[(_0x6ba6('0x55'))][(_0x6ba6('0x56'))]('Plugin\x20not\x20found');}return _0x5d7204[_0x6ba6('0x4e')](_0x24e0b4,util['format'](_0x6ba6('0x61'),path[_0x6ba6('0x51')](_0x39976f[_0x6ba6('0xa')])),function(_0x365fcc){if(_0x365fcc){throw new db[(_0x6ba6('0x55'))][(_0x6ba6('0x56'))](_0x6ba6('0x62'));}fs['unlinkSync'](_0x24e0b4);logger['info'](_0x6ba6('0x63'));logger[_0x6ba6('0x64')]('Temporary\x20file\x20removed');});});}return null;})[_0x6ba6('0x4d')](handleError(_0x5d7204,null));};exports[_0x6ba6('0x65')]=function(_0x3fbbfc,_0xf0069e,_0x55b864){var _0x182a75=path[_0x6ba6('0x51')](_0x3fbbfc[_0x6ba6('0x66')][_0x6ba6('0x67')],path['extname'](_0x3fbbfc['file'][_0x6ba6('0x67')]));var _0x14ffcc=path[_0x6ba6('0x5a')](config[_0x6ba6('0x5b')],'server/files/plugins',_0x3fbbfc[_0x6ba6('0x66')][_0x6ba6('0x67')]);var _0x48b2f4=path[_0x6ba6('0x5a')](config['root'],_0x6ba6('0x4f'),_0x182a75);logger['info'](_0x6ba6('0x68'),_0x14ffcc);logger[_0x6ba6('0x64')](_0x6ba6('0x69'),_0x48b2f4);try{fs[_0x6ba6('0x6a')](_0x14ffcc,parseInt(_0x6ba6('0x6b'),0x8));extract(_0x14ffcc,{'dir':_0x48b2f4},function(_0x27083f){if(_0x27083f){logger[_0x6ba6('0x54')](_0x27083f);handleError(_0x27083f,!![]);};var _0x1cfef9=fs['readdirSync'](_0x48b2f4);if(_0x1cfef9[_0x6ba6('0x3c')]>0x1){removeReferences(_0x14ffcc,_0x48b2f4);logger[_0x6ba6('0x54')](_0x6ba6('0x6c'));return _0x55b864(new Error(_0x6ba6('0x6c')));}var _0x2adfc1=fs[_0x6ba6('0x6d')](path['join'](_0x48b2f4,_0x1cfef9[0x0]));if(_0x2adfc1[_0x6ba6('0x6e')]()){removeReferences(_0x14ffcc,_0x48b2f4);logger[_0x6ba6('0x54')](_0x6ba6('0x6c'));return _0x55b864(new Error('Invalid\x20plugin\x20structure'));}if(_0x2adfc1[_0x6ba6('0x6f')]()){var _0x553ff2=fs[_0x6ba6('0x70')](path['join'](_0x48b2f4,_0x1cfef9[0x0]));if(_0x553ff2[_0x6ba6('0x3c')]===0x0){removeReferences(_0x14ffcc,_0x48b2f4);logger[_0x6ba6('0x54')](_0x6ba6('0x6c'));return _0x55b864(new Error(_0x6ba6('0x6c')));}var _0x24c10e=_0x553ff2[_0x6ba6('0x71')](function(_0x1894a5){return _0x1894a5===_0x6ba6('0x72');});if(!_0x24c10e){return _0x55b864(new Error(_0x6ba6('0x73')));}var _0x3b3aed=fs[_0x6ba6('0x74')](path[_0x6ba6('0x5a')](_0x48b2f4,_0x1cfef9[0x0],_0x6ba6('0x72')));var _0xf1bb80=JSON[_0x6ba6('0x75')](_0x3b3aed);if(_0x6ba6('0x76')==typeof _0xf1bb80[_0x6ba6('0x2e')]){return _0x55b864(new Error(_0x6ba6('0x77')));}if(_0x6ba6('0x76')==typeof _0xf1bb80[_0x6ba6('0x34')]){return _0x55b864(new Error(_0x6ba6('0x78')));}if(_0x6ba6('0x76')==typeof _0xf1bb80[_0x6ba6('0x79')]){return _0x55b864(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x6ba6('0x76')==typeof _0xf1bb80[_0x6ba6('0x7a')]){return _0x55b864(new Error(_0x6ba6('0x7b')));}if(_0xf1bb80[_0x6ba6('0x34')]===_0x6ba6('0x7c')){if('undefined'==typeof _0xf1bb80[_0x6ba6('0x7a')]['views']){return _0x55b864(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0xf1bb80[_0x6ba6('0x7a')]['views']['admin']&&'undefined'==typeof _0xf1bb80[_0x6ba6('0x7a')]['views']['agent']){return _0x55b864(new Error(_0x6ba6('0x7d')));}}else if(_0xf1bb80[_0x6ba6('0x34')]===_0x6ba6('0x7e')){if(_0x6ba6('0x76')==typeof _0xf1bb80['parameters'][_0x6ba6('0x7f')]){return _0x55b864(new Error(_0x6ba6('0x80')));}if(_0x6ba6('0x76')==typeof _0xf1bb80['parameters'][_0x6ba6('0x81')]){return _0x55b864(new Error(_0x6ba6('0x82')));}}else{return _0x55b864(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x3d4549=_0xf1bb80[_0x6ba6('0x2e')];var _0x4289b9=_0xf1bb80[_0x6ba6('0x83')];var _0x28aaff=_0xf1bb80[_0x6ba6('0x34')];var _0x2b50a9=_0xf1bb80[_0x6ba6('0x84')]?_0xf1bb80[_0x6ba6('0x84')]:_0x6ba6('0x85');var _0x4a4c89=_0xf1bb80['icon']?_0xf1bb80[_0x6ba6('0x86')]:_0x6ba6('0x87');var _0x498b28='';var _0x386e80='';var _0x48873a='';var _0x2e9ad4='';var _0x206e41=_0xf1bb80['version'];if(_0x28aaff==='html'){if('undefined'!=typeof _0xf1bb80['parameters'][_0x6ba6('0x88')]['admin']){var _0x139f92=_0xf1bb80['parameters'][_0x6ba6('0x88')][_0x6ba6('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x139f92)){_0x498b28=path[_0x6ba6('0x5a')](_0x6ba6('0x8a'),_0x182a75,_0x1cfef9[0x0],_0x139f92);}else{_0x498b28=_0x139f92;}}else{logger[_0x6ba6('0x64')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x6ba6('0x76')!=typeof _0xf1bb80[_0x6ba6('0x7a')][_0x6ba6('0x88')][_0x6ba6('0x8b')]){var _0x4aa253=_0xf1bb80[_0x6ba6('0x7a')][_0x6ba6('0x88')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6ba6('0x8c')](_0x4aa253)){_0x386e80=path[_0x6ba6('0x5a')](_0x6ba6('0x8a'),_0x182a75,_0x1cfef9[0x0],_0x4aa253);}else{_0x386e80=_0x4aa253;}}else{logger[_0x6ba6('0x64')](_0x6ba6('0x8d'));}}else if(_0x28aaff===_0x6ba6('0x7e')){_0x48873a=_0xf1bb80[_0x6ba6('0x7a')]['scriptName'];_0x2e9ad4=_0xf1bb80[_0x6ba6('0x7a')]['scriptPath'];if(_0x6ba6('0x76')!=typeof _0xf1bb80[_0x6ba6('0x7a')]['views']){if('undefined'!=typeof _0xf1bb80[_0x6ba6('0x7a')][_0x6ba6('0x88')][_0x6ba6('0x89')]){var _0x139f92=_0xf1bb80[_0x6ba6('0x7a')]['views'][_0x6ba6('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x139f92)){_0x498b28=path[_0x6ba6('0x5a')](_0x6ba6('0x8a'),_0x182a75,_0x1cfef9[0x0],_0x139f92);}else{_0x498b28=_0x139f92;}}if(_0x6ba6('0x76')!=typeof _0xf1bb80[_0x6ba6('0x7a')]['views'][_0x6ba6('0x8b')]){var _0x4aa253=_0xf1bb80[_0x6ba6('0x7a')][_0x6ba6('0x88')][_0x6ba6('0x8b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4aa253)){_0x386e80=path[_0x6ba6('0x5a')](_0x6ba6('0x8a'),_0x182a75,_0x1cfef9[0x0],_0x4aa253);}else{_0x386e80=_0x4aa253;}}}}var _0x56d67b={'name':_0x3d4549,'description':_0x4289b9,'path':path[_0x6ba6('0x5a')](_0x182a75,_0x1cfef9[0x0]),'type':_0x28aaff,'sidebar':_0x2b50a9,'icon':_0x4a4c89,'adminUrl':_0x498b28,'agentUrl':_0x386e80,'scriptName':_0x48873a,'scriptPath':_0x2e9ad4,'version':_0x206e41};removeReferences(_0x14ffcc,null);return db[_0x6ba6('0x31')][_0x6ba6('0x8e')](_0x56d67b)['then'](function(_0x1b7f62){var _0x50e559={'role':_0x3fbbfc[_0x6ba6('0x8f')]['role'],'userProfileId':_0x3fbbfc[_0x6ba6('0x8f')][_0x6ba6('0x90')]};if(!_0x50e559)throw new Error(_0x6ba6('0x91'));if(_0x50e559[_0x6ba6('0x92')]===_0x6ba6('0x93')){var _0x14d7e5=_0x1b7f62[_0x6ba6('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x6ba6('0x4c')]({'where':{'name':_0x6ba6('0x2b'),'userProfileId':_0x50e559[_0x6ba6('0x90')]},'raw':!![]})['then'](function(_0x1efe88){if(_0x1efe88&&_0x1efe88[_0x6ba6('0x94')]===0x0){return db[_0x6ba6('0x2c')]['create']({'name':_0x14d7e5['name'],'resourceId':_0x14d7e5['id'],'type':_0x1efe88['name'],'sectionId':_0x1efe88['id']},{})[_0x6ba6('0x29')](function(){return _0x1b7f62;});}else{return _0x1b7f62;}})[_0x6ba6('0x4d')](function(_0x32a69b){logger[_0x6ba6('0x54')](_0x6ba6('0x95'),_0x32a69b);throw _0x32a69b;});}return _0x1b7f62;})[_0x6ba6('0x29')](respondWithResult(_0xf0069e,null))[_0x6ba6('0x4d')](handleError(_0xf0069e,null));}});}catch(_0x42986a){_0xf0069e[_0x6ba6('0x20')](0x1f4)[_0x6ba6('0x96')](_0x42986a);}};function removeReferences(_0x7fe55,_0x3b5a7e){try{if(_0x7fe55){fs[_0x6ba6('0x97')](_0x7fe55);logger[_0x6ba6('0x64')](_0x6ba6('0x98'));}if(_0x3b5a7e){rimraf(_0x3b5a7e,function(){});logger[_0x6ba6('0x64')](_0x6ba6('0x99'));}}catch(_0x38ce70){logger['error'](_0x38ce70);}}exports[_0x6ba6('0x27')]=function(_0x1f0322,_0x701c9c,_0x3a5870){return db[_0x6ba6('0x31')]['find']({'where':{'id':_0x1f0322['params']['id']}})['then'](handleEntityNotFound(_0x701c9c,null))[_0x6ba6('0x29')](saveUpdates(_0x1f0322[_0x6ba6('0x8f')],null))[_0x6ba6('0x29')](respondWithResult(_0x701c9c,null))[_0x6ba6('0x4d')](handleError(_0x701c9c,null));};exports[_0x6ba6('0x9a')]=function(_0x524dfc,_0x304283,_0x4a9015){return db[_0x6ba6('0x31')][_0x6ba6('0x4c')]({'where':{'id':_0x524dfc[_0x6ba6('0x4a')]['id']}})['then'](function(_0x56e543){if(_0x56e543){return _0x56e543[_0x6ba6('0x28')]();}})['then'](function(_0x2e3ceb){rimraf(path[_0x6ba6('0x5a')](config['root'],'server/files/plugins',path[_0x6ba6('0x5c')](_0x2e3ceb[_0x6ba6('0xa')])),function(){});return _0x2e3ceb;})[_0x6ba6('0x29')](handleEntityNotFound(_0x304283,null))['then'](respondWithStatusCode(_0x304283,null))[_0x6ba6('0x4d')](handleError(_0x304283,null));};exports[_0x6ba6('0x9b')]=function(_0x1f3a91,_0x324652,_0x1760d6){return BPromise['resolve']()[_0x6ba6('0x29')](function(){if(!_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0xa')]){throw new Error(_0x6ba6('0x9c'));}if(!_0x1f3a91[_0x6ba6('0x36')]['port']){throw new Error(_0x6ba6('0x9d'));}var _0xa04dbb=_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0x9e')]?_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0x9e')]+':'+_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0x9f')]:_0x6ba6('0xa0')+_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0x9f')];var _0x474140=_0x1f3a91[_0x6ba6('0x36')]['json']?_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0x21')]:!![];var _0x1d696f=_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0xa1')]?_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0xa1')]:null;var _0x1f4bf5={'method':_0x1f3a91['method'],'uri':util[_0x6ba6('0x50')](_0x6ba6('0xa2'),_0xa04dbb,_0x1f3a91[_0x6ba6('0x36')][_0x6ba6('0xa')]),'json':_0x474140,'resolveWithFullResponse':!![],'encoding':_0x1d696f,'qs':_0x1f3a91[_0x6ba6('0x36')]};if(_0x1f3a91[_0x6ba6('0xa3')]){_0x1f4bf5['headers']=_0x1f3a91[_0x6ba6('0xa3')];if(_0x1f4bf5[_0x6ba6('0xa3')]['content-length']){delete _0x1f4bf5['headers'][_0x6ba6('0xa4')];}}if(_0x1f4bf5[_0x6ba6('0xa3')][_0x6ba6('0xa5')]){delete _0x1f4bf5[_0x6ba6('0xa3')][_0x6ba6('0xa5')];}return rp(_0x1f4bf5);})['then'](function(_0x9e08d8){if(_0x9e08d8){_0x324652[_0x6ba6('0xa6')](_0x9e08d8[_0x6ba6('0xa3')]);logger[_0x6ba6('0x64')](_0x9e08d8[_0x6ba6('0x8f')]);if(_['endsWith'](_0x1f3a91[_0x6ba6('0x36')]['path'],_0x6ba6('0x4e'))&&_0x9e08d8[_0x6ba6('0xa7')]==0x1f4){return _0x324652['sendStatus'](_0x9e08d8[_0x6ba6('0xa7')]);}else{return _0x324652['status'](_0x9e08d8[_0x6ba6('0xa7')])[_0x6ba6('0x96')](_0x9e08d8['body']);}}else{return _0x324652['sendStatus'](0xc8);}})['catch'](handleError(_0x324652,null));};exports[_0x6ba6('0xa8')]=function(_0x43b73a,_0x2ddc8d,_0x192ca2){return BPromise[_0x6ba6('0xa9')]()['then'](function(){if(!_0x43b73a[_0x6ba6('0x36')][_0x6ba6('0xa')]){throw new Error(_0x6ba6('0x9c'));}if(!_0x43b73a[_0x6ba6('0x36')][_0x6ba6('0x9f')]){throw new Error(_0x6ba6('0x9d'));}var _0x2d81f5=_0x43b73a['query'][_0x6ba6('0x9e')]?_0x43b73a[_0x6ba6('0x36')][_0x6ba6('0x9e')]+':'+_0x43b73a[_0x6ba6('0x36')][_0x6ba6('0x9f')]:_0x6ba6('0xa0')+_0x43b73a[_0x6ba6('0x36')]['port'];var _0x21ebb1=_0x43b73a[_0x6ba6('0x36')][_0x6ba6('0x21')]?_0x43b73a['query'][_0x6ba6('0x21')]:!![];var _0x30e598=_0x43b73a[_0x6ba6('0x36')]['encoding']?_0x43b73a['query']['encoding']:null;var _0xfda2ee={'method':_0x43b73a[_0x6ba6('0xaa')],'uri':util['format'](_0x6ba6('0xa2'),_0x2d81f5,_0x43b73a['query'][_0x6ba6('0xa')]),'json':_0x21ebb1,'resolveWithFullResponse':!![],'encoding':_0x30e598,'body':_0x43b73a['body']};if(_0x43b73a['headers']){_0xfda2ee['headers']=_0x43b73a[_0x6ba6('0xa3')];if(_0xfda2ee['headers'][_0x6ba6('0xa4')]){delete _0xfda2ee[_0x6ba6('0xa3')][_0x6ba6('0xa4')];}}if(_0xfda2ee[_0x6ba6('0xa3')][_0x6ba6('0xa5')]){delete _0xfda2ee[_0x6ba6('0xa3')]['content-type'];}return rp(_0xfda2ee);})[_0x6ba6('0x29')](function(_0x45a2ec){if(_0x45a2ec){_0x2ddc8d['set'](_0x45a2ec['headers']);logger[_0x6ba6('0x64')](_0x45a2ec[_0x6ba6('0x8f')]);return _0x2ddc8d[_0x6ba6('0x20')](_0x45a2ec['statusCode'])[_0x6ba6('0x96')](_0x45a2ec[_0x6ba6('0x8f')]);}else{return _0x2ddc8d[_0x6ba6('0x1f')](0xc8);}})[_0x6ba6('0x4d')](handleError(_0x2ddc8d,null));}; \ No newline at end of file +var _0xd645=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','params','catch','find','path','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','length','some','manifest.json','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','script','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','extract-zip','rimraf','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xd645,0x12c));var _0x5d64=function(_0x4ae183,_0x4996a9){_0x4ae183=_0x4ae183-0x0;var _0x5242cf=_0xd645[_0x4ae183];return _0x5242cf;};'use strict';var pdf=require(_0x5d64('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5d64('0x1'));var jsonpatch=require(_0x5d64('0x2'));var rp=require(_0x5d64('0x3'));var moment=require(_0x5d64('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d64('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5d64('0x6'));var fs=require('fs');var _=require(_0x5d64('0x7'));var squel=require('squel');var crypto=require(_0x5d64('0x8'));var jsforce=require(_0x5d64('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5d64('0xa'));var querystring=require(_0x5d64('0xb'));var Papa=require(_0x5d64('0xc'));var extract=require(_0x5d64('0xd'));var rimraf=require(_0x5d64('0xe'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d64('0xf'));var hardwareService=require(_0x5d64('0x10'));var logger=require(_0x5d64('0x11'))(_0x5d64('0x12'));var utils=require('../../config/utils');var config=require(_0x5d64('0x13'));var licenseUtil=require(_0x5d64('0x14'));var db=require(_0x5d64('0x15'))['db'];config['redis']=_[_0x5d64('0x16')](config['redis'],{'host':_0x5d64('0x17'),'port':0x18eb});var socket=require(_0x5d64('0x18'))(new Redis(config[_0x5d64('0x19')]));require('./plugin.socket')[_0x5d64('0x1a')](socket);function respondWithStatusCode(_0x2eea7f,_0x3d85f4){_0x3d85f4=_0x3d85f4||0xcc;return function(_0xceb3be){if(_0xceb3be){return _0x2eea7f[_0x5d64('0x1b')](_0x3d85f4);}return _0x2eea7f[_0x5d64('0x1c')](_0x3d85f4)[_0x5d64('0x1d')]();};}function respondWithResult(_0x30a598,_0x430687){_0x430687=_0x430687||0xc8;return function(_0x13943c){if(_0x13943c){return _0x30a598[_0x5d64('0x1c')](_0x430687)[_0x5d64('0x1e')](_0x13943c);}};}function respondWithFilteredResult(_0x238a4c,_0x26cf50){return function(_0x96ac70){if(_0x96ac70){var _0xefa437=_0x96ac70[_0x5d64('0x1f')],_0x22d0c9=_0x26cf50[_0x5d64('0x20')],_0x3e24bf=_0x26cf50[_0x5d64('0x20')]+_0x26cf50[_0x5d64('0x21')],_0x243b8f;if(_0x3e24bf>=_0xefa437){_0x3e24bf=_0xefa437;_0x243b8f=0xc8;}else{_0x243b8f=0xce;}_0x238a4c['status'](_0x243b8f);return _0x238a4c[_0x5d64('0x22')](_0x5d64('0x23'),_0x22d0c9+'-'+_0x3e24bf+'/'+_0xefa437)[_0x5d64('0x1e')](_0x96ac70);}return null;};}function patchUpdates(_0x23517e){return function(_0xb5e16){try{jsonpatch[_0x5d64('0x24')](_0xb5e16,_0x23517e,!![]);}catch(_0x5128f8){return BPromise['reject'](_0x5128f8);}return _0xb5e16[_0x5d64('0x25')]();};}function saveUpdates(_0x4f8d66,_0x2b8dc5){return function(_0x278249){if(_0x278249){return _0x278249['update'](_0x4f8d66)[_0x5d64('0x26')](function(_0x4a3c86){return _0x4a3c86;});}return null;};}function removeEntity(_0x504f62,_0x239faa){return function(_0x23571e){if(_0x23571e){return _0x23571e[_0x5d64('0x27')]()[_0x5d64('0x26')](function(){var _0x58104e=_0x23571e[_0x5d64('0x28')]({'plain':!![]});var _0x53eb8e='Plugins';return db[_0x5d64('0x29')][_0x5d64('0x27')]({'where':{'type':_0x53eb8e,'resourceId':_0x58104e['id']}})[_0x5d64('0x26')](function(){return _0x23571e;});})[_0x5d64('0x26')](function(){_0x504f62[_0x5d64('0x1c')](0xcc)[_0x5d64('0x1d')]();});}};}function handleEntityNotFound(_0xbd996b,_0x11e606){return function(_0x42076e){if(!_0x42076e){_0xbd996b['sendStatus'](0x194);}return _0x42076e;};}function handleError(_0x309746,_0x5d7c2e){_0x5d7c2e=_0x5d7c2e||0x1f4;return function(_0x4ae93d){logger[_0x5d64('0x2a')](_0x4ae93d[_0x5d64('0x2b')]);if(_0x4ae93d[_0x5d64('0x2c')]){delete _0x4ae93d[_0x5d64('0x2c')];}_0x309746[_0x5d64('0x1c')](_0x5d7c2e)[_0x5d64('0x2d')](_0x4ae93d);};}exports[_0x5d64('0x2e')]=function(_0x52916c,_0x1e7c1e){var _0x2c81c7={},_0x5ec6c9={},_0x10fd9c={'count':0x0,'rows':[]};var _0x45461c=_[_0x5d64('0x2f')](db['Plugin'][_0x5d64('0x30')],function(_0x1a3f15){return{'name':_0x1a3f15[_0x5d64('0x31')],'type':_0x1a3f15[_0x5d64('0x32')][_0x5d64('0x33')]};});_0x5ec6c9['model']=_[_0x5d64('0x2f')](_0x45461c,_0x5d64('0x2c'));_0x5ec6c9[_0x5d64('0x34')]=_[_0x5d64('0x35')](_0x52916c['query']);_0x5ec6c9[_0x5d64('0x36')]=_[_0x5d64('0x37')](_0x5ec6c9[_0x5d64('0x38')],_0x5ec6c9[_0x5d64('0x34')]);_0x2c81c7['attributes']=_[_0x5d64('0x37')](_0x5ec6c9[_0x5d64('0x38')],qs[_0x5d64('0x39')](_0x52916c[_0x5d64('0x34')][_0x5d64('0x39')]));_0x2c81c7[_0x5d64('0x3a')]=_0x2c81c7[_0x5d64('0x3a')]['length']?_0x2c81c7[_0x5d64('0x3a')]:_0x5ec6c9[_0x5d64('0x38')];if(!_0x52916c['query'][_0x5d64('0x3b')](_0x5d64('0x3c'))){_0x2c81c7[_0x5d64('0x21')]=qs[_0x5d64('0x21')](_0x52916c[_0x5d64('0x34')][_0x5d64('0x21')]);_0x2c81c7[_0x5d64('0x20')]=qs[_0x5d64('0x20')](_0x52916c[_0x5d64('0x34')]['offset']);}_0x2c81c7[_0x5d64('0x3d')]=qs[_0x5d64('0x3e')](_0x52916c[_0x5d64('0x34')][_0x5d64('0x3e')]);_0x2c81c7[_0x5d64('0x3f')]=qs[_0x5d64('0x36')](_[_0x5d64('0x40')](_0x52916c[_0x5d64('0x34')],_0x5ec6c9[_0x5d64('0x36')]),_0x45461c);if(_0x52916c['query'][_0x5d64('0x41')]){_0x2c81c7[_0x5d64('0x3f')]=_[_0x5d64('0x42')](_0x2c81c7['where'],{'$or':_['map'](_0x45461c,function(_0x5ea0d6){if(_0x5ea0d6[_0x5d64('0x32')]!==_0x5d64('0x43')){var _0x4baa59={};_0x4baa59[_0x5ea0d6['name']]={'$like':'%'+_0x52916c[_0x5d64('0x34')]['filter']+'%'};return _0x4baa59;}})});}_0x2c81c7=_[_0x5d64('0x42')]({},_0x2c81c7,_0x52916c[_0x5d64('0x44')]);var _0x50185b={'where':_0x2c81c7[_0x5d64('0x3f')]};return db[_0x5d64('0x45')][_0x5d64('0x1f')](_0x50185b)[_0x5d64('0x26')](function(_0x292a9e){_0x10fd9c[_0x5d64('0x1f')]=_0x292a9e;if(_0x52916c[_0x5d64('0x34')][_0x5d64('0x46')]){_0x2c81c7[_0x5d64('0x47')]=[{'all':!![]}];}return db['Plugin'][_0x5d64('0x48')](_0x2c81c7);})[_0x5d64('0x26')](function(_0x171af0){_0x10fd9c[_0x5d64('0x49')]=_0x171af0;return _0x10fd9c;})[_0x5d64('0x26')](respondWithFilteredResult(_0x1e7c1e,_0x2c81c7))['catch'](handleError(_0x1e7c1e,null));};exports['show']=function(_0x1e02a9,_0x51516b){var _0x3489f1={'raw':!![],'where':{'id':_0x1e02a9[_0x5d64('0x4a')]['id']}},_0x1fbe98={};_0x1fbe98['model']=_[_0x5d64('0x35')](db[_0x5d64('0x45')]['rawAttributes']);_0x1fbe98['query']=_['keys'](_0x1e02a9[_0x5d64('0x34')]);_0x1fbe98[_0x5d64('0x36')]=_[_0x5d64('0x37')](_0x1fbe98['model'],_0x1fbe98[_0x5d64('0x34')]);_0x3489f1[_0x5d64('0x3a')]=_[_0x5d64('0x37')](_0x1fbe98[_0x5d64('0x38')],qs[_0x5d64('0x39')](_0x1e02a9['query'][_0x5d64('0x39')]));_0x3489f1['attributes']=_0x3489f1[_0x5d64('0x3a')]['length']?_0x3489f1[_0x5d64('0x3a')]:_0x1fbe98[_0x5d64('0x38')];if(_0x1e02a9[_0x5d64('0x34')][_0x5d64('0x46')]){_0x3489f1[_0x5d64('0x47')]=[{'all':!![]}];}_0x3489f1=_[_0x5d64('0x42')]({},_0x3489f1,_0x1e02a9[_0x5d64('0x44')]);return db[_0x5d64('0x45')]['find'](_0x3489f1)[_0x5d64('0x26')](handleEntityNotFound(_0x51516b,null))['then'](respondWithResult(_0x51516b,null))[_0x5d64('0x4b')](handleError(_0x51516b,null));};exports['download']=function(_0x348cc0,_0x42baad,_0x513865){return db['Plugin'][_0x5d64('0x4c')]({'where':{'id':_0x348cc0['params']['id']},'attributes':[_0x5d64('0x2c'),_0x5d64('0x4d')],'raw':!![]})[_0x5d64('0x26')](handleEntityNotFound(_0x42baad,null))[_0x5d64('0x26')](function(_0x4c3747){if(_0x4c3747){var _0x2d6b6a=path[_0x5d64('0x4e')](config[_0x5d64('0x4f')],_0x5d64('0x50'),util['format'](_0x5d64('0x51'),path[_0x5d64('0x52')](_0x4c3747[_0x5d64('0x4d')])));var _0x4f216f=fs[_0x5d64('0x53')](_0x2d6b6a);var _0x255751=archiver(_0x5d64('0x54'),{'zlib':{'level':0x9}});_0x255751['on'](_0x5d64('0x55'),function(_0x485f08){if(_0x485f08[_0x5d64('0x56')]===_0x5d64('0x57')){logger[_0x5d64('0x2a')](_0x485f08);}else{throw new db[(_0x5d64('0x58'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x255751['on'](_0x5d64('0x2a'),function(_0x52fb61){throw new db['Sequelize'][(_0x5d64('0x59'))](_0x5d64('0x5a'));});_0x255751['pipe'](_0x4f216f);_0x255751[_0x5d64('0x5b')](_0x5d64('0x5c'),{'cwd':path[_0x5d64('0x4e')](config[_0x5d64('0x4f')],'server/files/plugins',path[_0x5d64('0x5d')](_0x4c3747[_0x5d64('0x4d')])),'ignore':[path['join'](path[_0x5d64('0x52')](_0x4c3747[_0x5d64('0x4d')]),_0x5d64('0x5e')),path[_0x5d64('0x4e')](path[_0x5d64('0x52')](_0x4c3747['path']),_0x5d64('0x5f'))],'nodir':!![]})[_0x5d64('0x60')]();_0x4f216f['on'](_0x5d64('0x61'),function(){if(!fs[_0x5d64('0x62')](_0x2d6b6a)){throw new db[(_0x5d64('0x58'))]['Error'](_0x5d64('0x63'));}return _0x42baad[_0x5d64('0x64')](_0x2d6b6a,util[_0x5d64('0x65')](_0x5d64('0x51'),path[_0x5d64('0x52')](_0x4c3747[_0x5d64('0x4d')])),function(_0x332633){if(_0x332633){throw new db[(_0x5d64('0x58'))][(_0x5d64('0x59'))](_0x5d64('0x66'));}fs[_0x5d64('0x67')](_0x2d6b6a);logger[_0x5d64('0x68')]('Download\x20completed');logger[_0x5d64('0x68')](_0x5d64('0x69'));});});}return null;})['catch'](handleError(_0x42baad,null));};exports['upload']=function(_0x22ccb3,_0x50b3a3,_0x1bb0b4){var _0x38e4d5=path[_0x5d64('0x52')](_0x22ccb3[_0x5d64('0x6a')][_0x5d64('0x6b')],path[_0x5d64('0x6c')](_0x22ccb3[_0x5d64('0x6a')]['filename']));var _0x4acf17=path[_0x5d64('0x4e')](config[_0x5d64('0x4f')],'server/files/plugins',_0x22ccb3['file'][_0x5d64('0x6b')]);var _0x224e1f=path['join'](config[_0x5d64('0x4f')],'server/files/plugins',_0x38e4d5);logger[_0x5d64('0x68')]('Plugin\x20upload\x20filepath:\x20%s',_0x4acf17);logger[_0x5d64('0x68')](_0x5d64('0x6d'),_0x224e1f);try{fs[_0x5d64('0x6e')](_0x4acf17,parseInt(_0x5d64('0x6f'),0x8));extract(_0x4acf17,{'dir':_0x224e1f},function(_0x1f15e5){if(_0x1f15e5){logger[_0x5d64('0x2a')](_0x1f15e5);handleError(_0x1f15e5,!![]);};var _0xef67a8=fs[_0x5d64('0x70')](_0x224e1f);if(_0xef67a8['length']>0x1){removeReferences(_0x4acf17,_0x224e1f);logger[_0x5d64('0x2a')](_0x5d64('0x71'));return _0x1bb0b4(new Error(_0x5d64('0x71')));}var _0x1bf908=fs[_0x5d64('0x72')](path['join'](_0x224e1f,_0xef67a8[0x0]));if(_0x1bf908[_0x5d64('0x73')]()){removeReferences(_0x4acf17,_0x224e1f);logger[_0x5d64('0x2a')](_0x5d64('0x71'));return _0x1bb0b4(new Error(_0x5d64('0x71')));}if(_0x1bf908[_0x5d64('0x74')]()){var _0xff4161=fs[_0x5d64('0x70')](path[_0x5d64('0x4e')](_0x224e1f,_0xef67a8[0x0]));if(_0xff4161[_0x5d64('0x75')]===0x0){removeReferences(_0x4acf17,_0x224e1f);logger['error'](_0x5d64('0x71'));return _0x1bb0b4(new Error(_0x5d64('0x71')));}var _0x154215=_0xff4161[_0x5d64('0x76')](function(_0x36313b){return _0x36313b===_0x5d64('0x77');});if(!_0x154215){return _0x1bb0b4(new Error('Plugin\x20manifest\x20missing'));}var _0x48ff38=fs['readFileSync'](path['join'](_0x224e1f,_0xef67a8[0x0],_0x5d64('0x77')));var _0x4a28f2=JSON['parse'](_0x48ff38);if(_0x5d64('0x78')==typeof _0x4a28f2['name']){return _0x1bb0b4(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x32')]){return _0x1bb0b4(new Error(_0x5d64('0x79')));}if(_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x7a')]){return _0x1bb0b4(new Error(_0x5d64('0x7b')));}if(_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x7c')]){return _0x1bb0b4(new Error(_0x5d64('0x7d')));}if(_0x4a28f2['type']===_0x5d64('0x7e')){if(_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x7c')][_0x5d64('0x7f')]){return _0x1bb0b4(new Error(_0x5d64('0x80')));}if(_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x7c')][_0x5d64('0x7f')][_0x5d64('0x81')]&&_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x7c')][_0x5d64('0x7f')][_0x5d64('0x82')]){return _0x1bb0b4(new Error(_0x5d64('0x83')));}}else if(_0x4a28f2[_0x5d64('0x32')]==='script'){if('undefined'==typeof _0x4a28f2['parameters'][_0x5d64('0x84')]){return _0x1bb0b4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5d64('0x78')==typeof _0x4a28f2[_0x5d64('0x7c')]['scriptPath']){return _0x1bb0b4(new Error(_0x5d64('0x85')));}}else{return _0x1bb0b4(new Error(_0x5d64('0x86')));}var _0x5e042d=_0x4a28f2['name'];var _0x591f66=_0x4a28f2[_0x5d64('0x87')];var _0x26a558=_0x4a28f2[_0x5d64('0x32')];var _0x1084e9=_0x4a28f2[_0x5d64('0x88')]?_0x4a28f2['sidebar']:_0x5d64('0x89');var _0x3de133=_0x4a28f2['icon']?_0x4a28f2[_0x5d64('0x8a')]:'icon-apps';var _0x363f83='';var _0x24e6c8='';var _0x5d1ad1='';var _0x167549='';var _0x2f9da1=_0x4a28f2['version'];if(_0x26a558===_0x5d64('0x7e')){if(_0x5d64('0x78')!=typeof _0x4a28f2[_0x5d64('0x7c')][_0x5d64('0x7f')][_0x5d64('0x81')]){var _0x141c51=_0x4a28f2['parameters'][_0x5d64('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x5d64('0x8b')](_0x141c51)){_0x363f83=path['join'](_0x5d64('0x8c'),_0x38e4d5,_0xef67a8[0x0],_0x141c51);}else{_0x363f83=_0x141c51;}}else{logger[_0x5d64('0x68')](_0x5d64('0x8d'));}if(_0x5d64('0x78')!=typeof _0x4a28f2[_0x5d64('0x7c')]['views']['agent']){var _0x22e11f=_0x4a28f2[_0x5d64('0x7c')]['views'][_0x5d64('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x22e11f)){_0x24e6c8=path[_0x5d64('0x4e')](_0x5d64('0x8c'),_0x38e4d5,_0xef67a8[0x0],_0x22e11f);}else{_0x24e6c8=_0x22e11f;}}else{logger[_0x5d64('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x26a558===_0x5d64('0x8e')){_0x5d1ad1=_0x4a28f2[_0x5d64('0x7c')][_0x5d64('0x84')];_0x167549=_0x4a28f2['parameters'][_0x5d64('0x8f')];if(_0x5d64('0x78')!=typeof _0x4a28f2[_0x5d64('0x7c')]['views']){if(_0x5d64('0x78')!=typeof _0x4a28f2['parameters'][_0x5d64('0x7f')][_0x5d64('0x81')]){var _0x141c51=_0x4a28f2['parameters']['views'][_0x5d64('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x5d64('0x8b')](_0x141c51)){_0x363f83=path[_0x5d64('0x4e')](_0x5d64('0x8c'),_0x38e4d5,_0xef67a8[0x0],_0x141c51);}else{_0x363f83=_0x141c51;}}if('undefined'!=typeof _0x4a28f2[_0x5d64('0x7c')]['views']['agent']){var _0x22e11f=_0x4a28f2['parameters'][_0x5d64('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x22e11f)){_0x24e6c8=path[_0x5d64('0x4e')](_0x5d64('0x8c'),_0x38e4d5,_0xef67a8[0x0],_0x22e11f);}else{_0x24e6c8=_0x22e11f;}}}}var _0x11fd3f={'name':_0x5e042d,'description':_0x591f66,'path':path[_0x5d64('0x4e')](_0x38e4d5,_0xef67a8[0x0]),'type':_0x26a558,'sidebar':_0x1084e9,'icon':_0x3de133,'adminUrl':_0x363f83,'agentUrl':_0x24e6c8,'scriptName':_0x5d1ad1,'scriptPath':_0x167549,'version':_0x2f9da1};removeReferences(_0x4acf17,null);return db[_0x5d64('0x45')][_0x5d64('0x90')](_0x11fd3f)['then'](function(_0x4ccc65){var _0x27c35e={'role':_0x22ccb3[_0x5d64('0x91')]['role'],'userProfileId':_0x22ccb3[_0x5d64('0x91')][_0x5d64('0x92')]};if(!_0x27c35e)throw new Error(_0x5d64('0x93'));if(_0x27c35e[_0x5d64('0x94')]===_0x5d64('0x95')){var _0x4ce480=_0x4ccc65['get']({'plain':!![]});return db[_0x5d64('0x96')]['find']({'where':{'name':_0x5d64('0x97'),'userProfileId':_0x27c35e['userProfileId']},'raw':!![]})[_0x5d64('0x26')](function(_0x421caa){if(_0x421caa&&_0x421caa[_0x5d64('0x98')]===0x0){return db['UserProfileResource'][_0x5d64('0x90')]({'name':_0x4ce480['name'],'resourceId':_0x4ce480['id'],'type':_0x421caa[_0x5d64('0x2c')],'sectionId':_0x421caa['id']},{})['then'](function(){return _0x4ccc65;});}else{return _0x4ccc65;}})[_0x5d64('0x4b')](function(_0x343c3f){logger[_0x5d64('0x2a')](_0x5d64('0x99'),_0x343c3f);throw _0x343c3f;});}return _0x4ccc65;})['then'](respondWithResult(_0x50b3a3,null))[_0x5d64('0x4b')](handleError(_0x50b3a3,null));}});}catch(_0x359395){_0x50b3a3['status'](0x1f4)[_0x5d64('0x2d')](_0x359395);}};function removeReferences(_0x284a63,_0x413c59){try{if(_0x284a63){fs['unlinkSync'](_0x284a63);logger[_0x5d64('0x68')]('Zip\x20archive\x20removed');}if(_0x413c59){rimraf(_0x413c59,function(){});logger[_0x5d64('0x68')](_0x5d64('0x9a'));}}catch(_0x42881d){logger[_0x5d64('0x2a')](_0x42881d);}}exports[_0x5d64('0x9b')]=function(_0x3389b5,_0x16b046,_0x38f598){return db[_0x5d64('0x45')][_0x5d64('0x4c')]({'where':{'id':_0x3389b5[_0x5d64('0x4a')]['id']}})[_0x5d64('0x26')](handleEntityNotFound(_0x16b046,null))[_0x5d64('0x26')](saveUpdates(_0x3389b5['body'],null))[_0x5d64('0x26')](respondWithResult(_0x16b046,null))[_0x5d64('0x4b')](handleError(_0x16b046,null));};exports[_0x5d64('0x9c')]=function(_0x24b869,_0x3ecd80,_0x36db66){return db[_0x5d64('0x45')][_0x5d64('0x4c')]({'where':{'id':_0x24b869[_0x5d64('0x4a')]['id']}})[_0x5d64('0x26')](function(_0x5ecf71){if(_0x5ecf71){return _0x5ecf71[_0x5d64('0x27')]();}})[_0x5d64('0x26')](function(_0x2b1ea5){rimraf(path['join'](config[_0x5d64('0x4f')],_0x5d64('0x50'),path[_0x5d64('0x5d')](_0x2b1ea5[_0x5d64('0x4d')])),function(){});return _0x2b1ea5;})[_0x5d64('0x26')](handleEntityNotFound(_0x3ecd80,null))['then'](respondWithStatusCode(_0x3ecd80,null))['catch'](handleError(_0x3ecd80,null));};exports['webhookGet']=function(_0x5a50a1,_0x486fcc,_0x20d074){return BPromise['resolve']()[_0x5d64('0x26')](function(){if(!_0x5a50a1[_0x5d64('0x34')][_0x5d64('0x4d')]){throw new Error(_0x5d64('0x9d'));}if(!_0x5a50a1['query'][_0x5d64('0x9e')]){throw new Error(_0x5d64('0x9f'));}var _0x59e22e=_0x5a50a1[_0x5d64('0x34')]['hostname']?_0x5a50a1[_0x5d64('0x34')][_0x5d64('0xa0')]+':'+_0x5a50a1[_0x5d64('0x34')][_0x5d64('0x9e')]:_0x5d64('0xa1')+_0x5a50a1[_0x5d64('0x34')]['port'];var _0x2294cb=_0x5a50a1[_0x5d64('0x34')][_0x5d64('0x1e')]?_0x5a50a1['query'][_0x5d64('0x1e')]:!![];var _0x51b6bc=_0x5a50a1['query'][_0x5d64('0xa2')]?_0x5a50a1[_0x5d64('0x34')][_0x5d64('0xa2')]:null;var _0x3d187c={'method':_0x5a50a1[_0x5d64('0xa3')],'uri':util['format'](_0x5d64('0xa4'),_0x59e22e,_0x5a50a1[_0x5d64('0x34')][_0x5d64('0x4d')]),'json':_0x2294cb,'resolveWithFullResponse':!![],'encoding':_0x51b6bc,'qs':_0x5a50a1[_0x5d64('0x34')]};if(_0x5a50a1['headers']){_0x3d187c[_0x5d64('0xa5')]=_0x5a50a1[_0x5d64('0xa5')];if(_0x3d187c[_0x5d64('0xa5')][_0x5d64('0xa6')]){delete _0x3d187c[_0x5d64('0xa5')][_0x5d64('0xa6')];}}if(_0x3d187c['headers'][_0x5d64('0xa7')]){delete _0x3d187c[_0x5d64('0xa5')][_0x5d64('0xa7')];}return rp(_0x3d187c);})[_0x5d64('0x26')](function(_0xb5aaed){if(_0xb5aaed){_0x486fcc[_0x5d64('0x22')](_0xb5aaed['headers']);logger[_0x5d64('0x68')](_0xb5aaed[_0x5d64('0x91')]);if(_[_0x5d64('0xa8')](_0x5a50a1[_0x5d64('0x34')][_0x5d64('0x4d')],'download')&&_0xb5aaed[_0x5d64('0xa9')]==0x1f4){return _0x486fcc[_0x5d64('0x1b')](_0xb5aaed[_0x5d64('0xa9')]);}else{return _0x486fcc[_0x5d64('0x1c')](_0xb5aaed[_0x5d64('0xa9')])[_0x5d64('0x2d')](_0xb5aaed[_0x5d64('0x91')]);}}else{return _0x486fcc[_0x5d64('0x1b')](0xc8);}})[_0x5d64('0x4b')](handleError(_0x486fcc,null));};exports[_0x5d64('0xaa')]=function(_0x257a72,_0x152291,_0x1db1b1){return BPromise[_0x5d64('0xab')]()['then'](function(){if(!_0x257a72[_0x5d64('0x34')][_0x5d64('0x4d')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x257a72[_0x5d64('0x34')][_0x5d64('0x9e')]){throw new Error(_0x5d64('0x9f'));}var _0x44ee1d=_0x257a72[_0x5d64('0x34')][_0x5d64('0xa0')]?_0x257a72[_0x5d64('0x34')][_0x5d64('0xa0')]+':'+_0x257a72[_0x5d64('0x34')][_0x5d64('0x9e')]:_0x5d64('0xa1')+_0x257a72['query']['port'];var _0x190756=_0x257a72['query'][_0x5d64('0x1e')]?_0x257a72[_0x5d64('0x34')][_0x5d64('0x1e')]:!![];var _0x40f707=_0x257a72['query'][_0x5d64('0xa2')]?_0x257a72[_0x5d64('0x34')][_0x5d64('0xa2')]:null;var _0x3b6a3d={'method':_0x257a72[_0x5d64('0xa3')],'uri':util[_0x5d64('0x65')]('%s%s',_0x44ee1d,_0x257a72[_0x5d64('0x34')][_0x5d64('0x4d')]),'json':_0x190756,'resolveWithFullResponse':!![],'encoding':_0x40f707,'body':_0x257a72['body']};if(_0x257a72[_0x5d64('0xa5')]){_0x3b6a3d[_0x5d64('0xa5')]=_0x257a72[_0x5d64('0xa5')];if(_0x3b6a3d[_0x5d64('0xa5')][_0x5d64('0xa6')]){delete _0x3b6a3d['headers'][_0x5d64('0xa6')];}}if(_0x3b6a3d[_0x5d64('0xa5')][_0x5d64('0xa7')]){delete _0x3b6a3d[_0x5d64('0xa5')]['content-type'];}return rp(_0x3b6a3d);})[_0x5d64('0x26')](function(_0x177185){if(_0x177185){_0x152291['set'](_0x177185[_0x5d64('0xa5')]);logger[_0x5d64('0x68')](_0x177185[_0x5d64('0x91')]);return _0x152291[_0x5d64('0x1c')](_0x177185['statusCode'])[_0x5d64('0x2d')](_0x177185[_0x5d64('0x91')]);}else{return _0x152291[_0x5d64('0x1b')](0xc8);}})[_0x5d64('0x4b')](handleError(_0x152291,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c28f789..b81ad19 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 _0x2542=['exports','events','../../mysqldb','Plugin','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x2279be,_0x3e6881){var _0x2a4d8d=function(_0x4dd67a){while(--_0x4dd67a){_0x2279be['push'](_0x2279be['shift']());}};_0x2a4d8d(++_0x3e6881);}(_0x2542,0x169));var _0x2254=function(_0x409f59,_0xd060c3){_0x409f59=_0x409f59-0x0;var _0x471dfe=_0x2542[_0x409f59];return _0x471dfe;};'use strict';var EventEmitter=require(_0x2254('0x0'));var Plugin=require(_0x2254('0x1'))['db'][_0x2254('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x2254('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2254('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4059d1){return function(_0x3b3dcb,_0x27f5c9,_0x456612){PluginEvents[_0x2254('0x5')](_0x4059d1+':'+_0x3b3dcb['id'],_0x3b3dcb);PluginEvents['emit'](_0x4059d1,_0x3b3dcb);_0x456612(null);};}for(var e in events){if(events[_0x2254('0x6')](e)){var event=events[e];Plugin[_0x2254('0x7')](e,emitEvent(event));}}module[_0x2254('0x8')]=PluginEvents; \ No newline at end of file +var _0x4213=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4e177b,_0xa5349c){var _0x4ce857=function(_0x6dbb80){while(--_0x6dbb80){_0x4e177b['push'](_0x4e177b['shift']());}};_0x4ce857(++_0xa5349c);}(_0x4213,0x77));var _0x3421=function(_0x51680c,_0xf70653){_0x51680c=_0x51680c-0x0;var _0x32bdda=_0x4213[_0x51680c];return _0x32bdda;};'use strict';var EventEmitter=require(_0x3421('0x0'));var Plugin=require(_0x3421('0x1'))['db'][_0x3421('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3421('0x3')](0x0);var events={'afterCreate':_0x3421('0x4'),'afterUpdate':_0x3421('0x5'),'afterDestroy':_0x3421('0x6')};function emitEvent(_0x5a303d){return function(_0xdbd54e,_0x5c3719,_0x459c5e){PluginEvents[_0x3421('0x7')](_0x5a303d+':'+_0xdbd54e['id'],_0xdbd54e);PluginEvents[_0x3421('0x7')](_0x5a303d,_0xdbd54e);_0x459c5e(null);};}for(var e in events){if(events[_0x3421('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x3421('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6f8d139..541b3fb 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 _0xf2ca=['define','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x9c5335,_0x1ec4d6){var _0xee123e=function(_0x405d06){while(--_0x405d06){_0x9c5335['push'](_0x9c5335['shift']());}};_0xee123e(++_0x1ec4d6);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0xf2ca[_0x44c325];return _0x55f09e;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./plugin.attributes');module[_0xaf2c('0x9')]=function(_0x100d17,_0x297740){return _0x100d17[_0xaf2c('0xa')]('Plugin',attributes,{'tableName':_0xaf2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x32a85d,_0x2e16a7){var _0x615b5e=function(_0x42c571){while(--_0x42c571){_0x32a85d['push'](_0x32a85d['shift']());}};_0x615b5e(++_0x2e16a7);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1ec328,_0x3e3cff){_0x1ec328=_0x1ec328-0x0;var _0x3e79ca=_0x8ef6[_0x1ec328];return _0x3e79ca;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 feb8550..047b4f3 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 _0x8276=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','info','result','catch','create','body','options','raw','CreatePlugin','lodash','util','moment'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x8276,0xf5));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var moment=require(_0x6827('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6827('0x4'));var logger=require(_0x6827('0x5'))(_0x6827('0x6'));var config=require('../../config/environment');var jayson=require(_0x6827('0x7'));var client=jayson[_0x6827('0x8')][_0x6827('0x9')]({'port':0x232a});config[_0x6827('0xa')]=_[_0x6827('0xb')](config[_0x6827('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6827('0xc'))(new Redis(config[_0x6827('0xa')]));require('./plugin.socket')[_0x6827('0xd')](socket);function respondWithRpcPromise(_0x1b623c,_0x3dcf5e,_0x5640f1){return new BPromise(function(_0x49f0cc,_0x315780){return client[_0x6827('0xe')](_0x1b623c,_0x5640f1)[_0x6827('0xf')](function(_0x4079e8){logger['info']('Plugin,\x20%s,\x20%s',_0x3dcf5e,_0x6827('0x10'));logger[_0x6827('0x11')](_0x6827('0x12'),_0x3dcf5e,_0x6827('0x10'),JSON[_0x6827('0x13')](_0x4079e8));if(_0x4079e8['error']){if(_0x4079e8[_0x6827('0x14')]['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x3dcf5e,_0x4079e8['error'][_0x6827('0x15')]);return _0x315780(_0x4079e8['error']['message']);}logger[_0x6827('0x14')](_0x6827('0x16'),_0x3dcf5e,_0x4079e8[_0x6827('0x14')][_0x6827('0x15')]);return _0x49f0cc(_0x4079e8[_0x6827('0x14')][_0x6827('0x15')]);}else{logger[_0x6827('0x17')](_0x6827('0x16'),_0x3dcf5e,_0x6827('0x10'));_0x49f0cc(_0x4079e8[_0x6827('0x18')][_0x6827('0x15')]);}})[_0x6827('0x19')](function(_0x308e20){logger['error'](_0x6827('0x16'),_0x3dcf5e,_0x308e20);_0x315780(_0x308e20);});});}exports['CreatePlugin']=function(_0x2876b8){var _0x437b2e=this;return new Promise(function(_0x3126eb,_0x2d078a){return db['Plugin'][_0x6827('0x1a')](_0x2876b8[_0x6827('0x1b')],{'raw':_0x2876b8[_0x6827('0x1c')]?_0x2876b8[_0x6827('0x1c')][_0x6827('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x342076){logger['info'](_0x6827('0x1e'),_0x2876b8);logger['debug'](_0x6827('0x1e'),_0x2876b8,JSON[_0x6827('0x13')](_0x342076));_0x3126eb(_0x342076);})[_0x6827('0x19')](function(_0x22d828){logger[_0x6827('0x14')](_0x6827('0x1e'),_0x22d828['message'],_0x2876b8);_0x2d078a(_0x437b2e['error'](0x1f4,_0x22d828[_0x6827('0x15')]));});});}; \ No newline at end of file +var _0x8aa2=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','options','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3e212b,_0x3f92ba){var _0x2ea189=function(_0x42af60){while(--_0x42af60){_0x3e212b['push'](_0x3e212b['shift']());}};_0x2ea189(++_0x3f92ba);}(_0x8aa2,0x138));var _0x28aa=function(_0x39adef,_0x39645c){_0x39adef=_0x39adef-0x0;var _0x43af1e=_0x8aa2[_0x39adef];return _0x43af1e;};'use strict';var _=require('lodash');var util=require(_0x28aa('0x0'));var moment=require(_0x28aa('0x1'));var BPromise=require(_0x28aa('0x2'));var rs=require(_0x28aa('0x3'));var fs=require('fs');var Redis=require(_0x28aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x28aa('0x5'));var logger=require(_0x28aa('0x6'))(_0x28aa('0x7'));var config=require(_0x28aa('0x8'));var jayson=require(_0x28aa('0x9'));var client=jayson[_0x28aa('0xa')][_0x28aa('0xb')]({'port':0x232a});config['redis']=_[_0x28aa('0xc')](config[_0x28aa('0xd')],{'host':_0x28aa('0xe'),'port':0x18eb});var socket=require(_0x28aa('0xf'))(new Redis(config['redis']));require(_0x28aa('0x10'))[_0x28aa('0x11')](socket);function respondWithRpcPromise(_0x209b19,_0x2f760d,_0x9c76aa){return new BPromise(function(_0x3ea99e,_0x4a95d8){return client[_0x28aa('0x12')](_0x209b19,_0x9c76aa)[_0x28aa('0x13')](function(_0x53bdda){logger[_0x28aa('0x14')](_0x28aa('0x15'),_0x2f760d,_0x28aa('0x16'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x2f760d,_0x28aa('0x16'),JSON['stringify'](_0x53bdda));if(_0x53bdda[_0x28aa('0x17')]){if(_0x53bdda['error'][_0x28aa('0x18')]===0x1f4){logger['error'](_0x28aa('0x15'),_0x2f760d,_0x53bdda[_0x28aa('0x17')]['message']);return _0x4a95d8(_0x53bdda[_0x28aa('0x17')]['message']);}logger[_0x28aa('0x17')](_0x28aa('0x15'),_0x2f760d,_0x53bdda[_0x28aa('0x17')][_0x28aa('0x19')]);return _0x3ea99e(_0x53bdda[_0x28aa('0x17')][_0x28aa('0x19')]);}else{logger[_0x28aa('0x14')]('Plugin,\x20%s,\x20%s',_0x2f760d,_0x28aa('0x16'));_0x3ea99e(_0x53bdda[_0x28aa('0x1a')][_0x28aa('0x19')]);}})[_0x28aa('0x1b')](function(_0x19fd5c){logger[_0x28aa('0x17')](_0x28aa('0x15'),_0x2f760d,_0x19fd5c);_0x4a95d8(_0x19fd5c);});});}exports[_0x28aa('0x1c')]=function(_0x200723){var _0x2eb74e=this;return new Promise(function(_0x58a4e7,_0x4264a8){return db[_0x28aa('0x1d')]['create'](_0x200723['body'],{'raw':_0x200723[_0x28aa('0x1e')]?_0x200723[_0x28aa('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x28aa('0x13')](function(_0x23a15d){logger[_0x28aa('0x14')](_0x28aa('0x1c'),_0x200723);logger['debug']('CreatePlugin',_0x200723,JSON[_0x28aa('0x1f')](_0x23a15d));_0x58a4e7(_0x23a15d);})[_0x28aa('0x1b')](function(_0x134fd2){logger[_0x28aa('0x17')]('CreatePlugin',_0x134fd2[_0x28aa('0x19')],_0x200723);_0x4264a8(_0x2eb74e[_0x28aa('0x17')](0x1f4,_0x134fd2['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c2a8d03..40d2cdc 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 _0xaa83=['update','emit','removeListener','length','plugin:','./plugin.events','save'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xaa83,0x16a));var _0x3aa8=function(_0x23d685,_0x49e250){_0x23d685=_0x23d685-0x0;var _0x599c12=_0xaa83[_0x23d685];return _0x599c12;};'use strict';var PluginEvents=require(_0x3aa8('0x0'));var events=[_0x3aa8('0x1'),'remove',_0x3aa8('0x2')];function createListener(_0x3d58f4,_0x1225a8){return function(_0xabeb8e){_0x1225a8[_0x3aa8('0x3')](_0x3d58f4,_0xabeb8e);};}function removeListener(_0x4449ec,_0x328ba0){return function(){PluginEvents[_0x3aa8('0x4')](_0x4449ec,_0x328ba0);};}exports['register']=function(_0x5501ce){for(var _0x7e4c27=0x0,_0x59cd73=events[_0x3aa8('0x5')];_0x7e4c27<_0x59cd73;_0x7e4c27++){var _0x48b254=events[_0x7e4c27];var _0x32984b=createListener(_0x3aa8('0x6')+_0x48b254,_0x5501ce);PluginEvents['on'](_0x48b254,_0x32984b);}}; \ No newline at end of file +var _0x87f9=['length','plugin:','save','remove','update','emit','removeListener','register'];(function(_0x2130db,_0x926d5c){var _0x7f4cae=function(_0x4d37e4){while(--_0x4d37e4){_0x2130db['push'](_0x2130db['shift']());}};_0x7f4cae(++_0x926d5c);}(_0x87f9,0x1a2));var _0x987f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x87f9[_0x1facfa];return _0x9ec701;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x987f('0x0'),_0x987f('0x1'),_0x987f('0x2')];function createListener(_0x30b2a9,_0xdc3ff3){return function(_0x5069aa){_0xdc3ff3[_0x987f('0x3')](_0x30b2a9,_0x5069aa);};}function removeListener(_0x4a8ebb,_0x96e4ed){return function(){PluginEvents[_0x987f('0x4')](_0x4a8ebb,_0x96e4ed);};}exports[_0x987f('0x5')]=function(_0x4500bb){for(var _0x2b3ac2=0x0,_0x8c7eae=events[_0x987f('0x6')];_0x2b3ac2<_0x8c7eae;_0x2b3ac2++){var _0x43161c=events[_0x2b3ac2];var _0x42c0cc=createListener(_0x987f('0x7')+_0x43161c,_0x4500bb);PluginEvents['on'](_0x43161c,_0x42c0cc);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 33494a7..12be3ec 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 _0xf501=['delete','destroy','exports','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x364149,_0x3d75fa){var _0x5b8a78=function(_0x52f990){while(--_0x52f990){_0x364149['push'](_0x364149['shift']());}};_0x5b8a78(++_0x3d75fa);}(_0xf501,0xe3));var _0x1f50=function(_0x2c68a4,_0x4b225d){_0x2c68a4=_0x2c68a4-0x0;var _0x2b613f=_0xf501[_0x2c68a4];return _0x2b613f;};'use strict';var express=require('express');var router=express[_0x1f50('0x0')]();var auth=require(_0x1f50('0x1'));var controller=require(_0x1f50('0x2'));router[_0x1f50('0x3')]('/',auth[_0x1f50('0x4')](),controller[_0x1f50('0x5')]);router['get'](_0x1f50('0x6'),auth[_0x1f50('0x4')](),controller[_0x1f50('0x7')]);router[_0x1f50('0x8')]('/',auth[_0x1f50('0x4')](),controller['create']);router[_0x1f50('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1f50('0xa')]);router[_0x1f50('0xb')](_0x1f50('0x6'),auth['isAuthenticated'](),controller[_0x1f50('0xc')]);module[_0x1f50('0xd')]=router; \ No newline at end of file +var _0x5a9b=['create','put','update','destroy','exports','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x191ff4,_0x3dfd34){var _0x1fd126=function(_0x30a9f3){while(--_0x30a9f3){_0x191ff4['push'](_0x191ff4['shift']());}};_0x1fd126(++_0x3dfd34);}(_0x5a9b,0x164));var _0xb5a9=function(_0x347b36,_0x2620db){_0x347b36=_0x347b36-0x0;var _0x470d99=_0x5a9b[_0x347b36];return _0x470d99;};'use strict';var express=require('express');var router=express[_0xb5a9('0x0')]();var auth=require(_0xb5a9('0x1'));var controller=require('./pm2.controller');router[_0xb5a9('0x2')]('/',auth[_0xb5a9('0x3')](),controller[_0xb5a9('0x4')]);router[_0xb5a9('0x2')](_0xb5a9('0x5'),auth[_0xb5a9('0x3')](),controller[_0xb5a9('0x6')]);router[_0xb5a9('0x7')]('/',auth[_0xb5a9('0x3')](),controller[_0xb5a9('0x8')]);router[_0xb5a9('0x9')](_0xb5a9('0x5'),auth[_0xb5a9('0x3')](),controller[_0xb5a9('0xa')]);router['delete'](_0xb5a9('0x5'),auth[_0xb5a9('0x3')](),controller[_0xb5a9('0xb')]);module[_0xb5a9('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 89eafb2..d9cddb8 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 _0x342f=['params','destroy','delete','Unknown\x20id','lodash','api','path','exec','json','error','stack','name','status','npm\x20install','info','index','list','then','length','catch','show','create','body','script','join','../../files/plugins','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty'];(function(_0x20a232,_0x222f85){var _0x6cb29a=function(_0x564eaf){while(--_0x564eaf){_0x20a232['push'](_0x20a232['shift']());}};_0x6cb29a(++_0x222f85);}(_0x342f,0x1be));var _0xf342=function(_0x48dba4,_0x1619e8){_0x48dba4=_0x48dba4-0x0;var _0x3ff0a0=_0x342f[_0x48dba4];return _0x3ff0a0;};'use strict';var _=require(_0xf342('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xf342('0x1'));var path=require(_0xf342('0x2'));var exec=require('child_process')[_0xf342('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x28dc76,_0x523a88){return function(_0xdec820){if(!_0xdec820){_0x28dc76['sendStatus'](0x194);;}return _0xdec820;};}function respondWithResult(_0x282af0,_0x161c76){_0x161c76=_0x161c76||0xc8;return function(_0x126d2a){if(_0x126d2a){return _0x282af0['status'](_0x161c76)[_0xf342('0x4')](_0x126d2a);}return null;};}function handleError(_0x200ae8,_0x304f0d){_0x304f0d=_0x304f0d||0x1f4;return function(_0x245cb1){logger[_0xf342('0x5')](_0x245cb1[_0xf342('0x6')]);if(_0x245cb1[_0xf342('0x7')]){delete _0x245cb1[_0xf342('0x7')];}_0x200ae8[_0xf342('0x8')](_0x304f0d)['send'](_0x245cb1);};}function execChildProcess(){return new BPromise(function(_0x4524e2,_0x5d7dd3){exec(_0xf342('0x9'),function(_0x41604c,_0x5a3dcc,_0x3e6bd8){logger[_0xf342('0xa')](_0x5a3dcc);logger[_0xf342('0xa')](_0x3e6bd8);if(_0x41604c){logger[_0xf342('0x5')](_0x41604c);return _0x5d7dd3(_0x41604c);}return _0x4524e2(_0x5a3dcc);});});}exports[_0xf342('0xb')]=function(_0x3224e1,_0x28d238){return pm2[_0xf342('0xc')]()[_0xf342('0xd')](function(_0x1655cc){if(_0x1655cc){var _0x472f81=_['reject'](_0x1655cc,function(_0x385a0c){return _0x385a0c[_0xf342('0x7')]==='express'||_0x385a0c[_0xf342('0x7')]==='motion2';});return{'rows':_0x472f81,'count':_0x472f81[_0xf342('0xe')]};}return null;})[_0xf342('0xd')](respondWithResult(_0x28d238,null))[_0xf342('0xf')](handleError(_0x28d238,null));};exports[_0xf342('0x10')]=function(_0x9d7628,_0x16fe59){return pm2['describe'](_0x9d7628['params']['id'])[_0xf342('0xd')](respondWithResult(_0x16fe59,null))[_0xf342('0xd')](handleEntityNotFound(_0x16fe59,null))[_0xf342('0xf')](handleError(_0x16fe59,null));};exports[_0xf342('0x11')]=function(_0x273b65,_0x27e6e6){if(_0x273b65[_0xf342('0x12')][_0xf342('0x7')]&&_0x273b65[_0xf342('0x12')][_0xf342('0x13')]){var _0x2c83d4=path[_0xf342('0x14')](__dirname,_0xf342('0x15'),_0x273b65['body'][_0xf342('0x13')]);var _0x57350c=process['cwd']();process[_0xf342('0x16')](path[_0xf342('0x17')](_0x2c83d4));return execChildProcess()['then'](function(_0x5aa7a0){process[_0xf342('0x16')](_0x57350c);return pm2['start']({'name':_0x273b65[_0xf342('0x12')][_0xf342('0x7')],'script':_0x2c83d4});})[_0xf342('0xd')](function(_0x1d619e){pm2[_0xf342('0x18')]();return _0x1d619e[0x0];})[_0xf342('0xd')](respondWithResult(_0x27e6e6,0xc9))['catch'](handleError(_0x27e6e6,null));}else{return _0x27e6e6[_0xf342('0x8')](0x1f4)[_0xf342('0x19')]({'message':_0xf342('0x1a')});}};exports[_0xf342('0x1b')]=function(_0x5d282e,_0x9fb414){if(_0x5d282e[_0xf342('0x12')]['id']){delete _0x5d282e[_0xf342('0x12')]['id'];}var _0x170f3e={'online':_0xf342('0x1c'),'stopped':'stop'};if(_0x170f3e[_0xf342('0x1d')](_0x5d282e[_0xf342('0x12')][_0xf342('0x8')])){return pm2[_0x170f3e[_0x5d282e[_0xf342('0x12')]['status']]](_0x5d282e[_0xf342('0x1e')]['id'])[_0xf342('0xd')](respondWithResult(_0x9fb414,0xc8))[_0xf342('0xf')](handleError(_0x9fb414,null));}else{return _0x9fb414[_0xf342('0x8')](0x1f4)[_0xf342('0x19')]({'message':'Unknown\x20status'});}};exports[_0xf342('0x1f')]=function(_0x48b89b,_0x54dce2){if(_0x48b89b[_0xf342('0x12')]['id']){delete _0x48b89b[_0xf342('0x12')]['id'];}if(_0x48b89b[_0xf342('0x1e')]['id']){return pm2[_0xf342('0x20')](_0x48b89b[_0xf342('0x1e')]['id'])['then'](function(_0x35eea7){pm2[_0xf342('0x18')]();return _0x35eea7[0x0];})[_0xf342('0xd')](respondWithResult(_0x54dce2,null))[_0xf342('0xf')](handleError(_0x54dce2,null));}else{return _0x54dce2[_0xf342('0x8')](0x1f4)[_0xf342('0x19')]({'message':_0xf342('0x21')});}}; \ No newline at end of file +var _0x29e1=['Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','bluebird','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','chdir','dirname','Missing\x20name\x20and/or\x20path','update','restart','stop','destroy','delete','dump'];(function(_0x2865ff,_0x1ee0aa){var _0x1fb341=function(_0x2bdacb){while(--_0x2bdacb){_0x2865ff['push'](_0x2865ff['shift']());}};_0x1fb341(++_0x1ee0aa);}(_0x29e1,0xf1));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x129e('0x0'));var pm2=require(_0x129e('0x1'));var logger=require(_0x129e('0x2'))(_0x129e('0x3'));var path=require(_0x129e('0x4'));var exec=require(_0x129e('0x5'))['exec'];var BPromise=require(_0x129e('0x6'));function handleEntityNotFound(_0x2cc8e1,_0x2d2c23){return function(_0x37c4f1){if(!_0x37c4f1){_0x2cc8e1[_0x129e('0x7')](0x194);;}return _0x37c4f1;};}function respondWithResult(_0x4ff109,_0x5f060f){_0x5f060f=_0x5f060f||0xc8;return function(_0xcff0ec){if(_0xcff0ec){return _0x4ff109[_0x129e('0x8')](_0x5f060f)['json'](_0xcff0ec);}return null;};}function handleError(_0x149ddb,_0x39a3ea){_0x39a3ea=_0x39a3ea||0x1f4;return function(_0x19bbda){logger[_0x129e('0x9')](_0x19bbda['stack']);if(_0x19bbda[_0x129e('0xa')]){delete _0x19bbda[_0x129e('0xa')];}_0x149ddb[_0x129e('0x8')](_0x39a3ea)[_0x129e('0xb')](_0x19bbda);};}function execChildProcess(){return new BPromise(function(_0x1a6276,_0x5fffb6){exec(_0x129e('0xc'),function(_0x2aa78f,_0x5a1ebb,_0x2102f0){logger[_0x129e('0xd')](_0x5a1ebb);logger['info'](_0x2102f0);if(_0x2aa78f){logger[_0x129e('0x9')](_0x2aa78f);return _0x5fffb6(_0x2aa78f);}return _0x1a6276(_0x5a1ebb);});});}exports[_0x129e('0xe')]=function(_0x35da4f,_0x2297ef){return pm2[_0x129e('0xf')]()[_0x129e('0x10')](function(_0x3c076c){if(_0x3c076c){var _0x25fc74=_[_0x129e('0x11')](_0x3c076c,function(_0x71b50){return _0x71b50[_0x129e('0xa')]==='express'||_0x71b50[_0x129e('0xa')]===_0x129e('0x12');});return{'rows':_0x25fc74,'count':_0x25fc74[_0x129e('0x13')]};}return null;})['then'](respondWithResult(_0x2297ef,null))[_0x129e('0x14')](handleError(_0x2297ef,null));};exports[_0x129e('0x15')]=function(_0x299dcc,_0x5b277f){return pm2[_0x129e('0x16')](_0x299dcc[_0x129e('0x17')]['id'])[_0x129e('0x10')](respondWithResult(_0x5b277f,null))[_0x129e('0x10')](handleEntityNotFound(_0x5b277f,null))[_0x129e('0x14')](handleError(_0x5b277f,null));};exports[_0x129e('0x18')]=function(_0x3f1f12,_0x399859){if(_0x3f1f12['body'][_0x129e('0xa')]&&_0x3f1f12[_0x129e('0x19')]['script']){var _0x4537e6=path[_0x129e('0x1a')](__dirname,_0x129e('0x1b'),_0x3f1f12[_0x129e('0x19')][_0x129e('0x1c')]);var _0x5d5035=process[_0x129e('0x1d')]();process[_0x129e('0x1e')](path[_0x129e('0x1f')](_0x4537e6));return execChildProcess()[_0x129e('0x10')](function(_0x2722f5){process[_0x129e('0x1e')](_0x5d5035);return pm2['start']({'name':_0x3f1f12['body']['name'],'script':_0x4537e6});})[_0x129e('0x10')](function(_0x24742b){pm2['dump']();return _0x24742b[0x0];})[_0x129e('0x10')](respondWithResult(_0x399859,0xc9))[_0x129e('0x14')](handleError(_0x399859,null));}else{return _0x399859[_0x129e('0x8')](0x1f4)[_0x129e('0xb')]({'message':_0x129e('0x20')});}};exports[_0x129e('0x21')]=function(_0x4000b3,_0x441e7d){if(_0x4000b3[_0x129e('0x19')]['id']){delete _0x4000b3[_0x129e('0x19')]['id'];}var _0x2c3357={'online':_0x129e('0x22'),'stopped':_0x129e('0x23')};if(_0x2c3357['hasOwnProperty'](_0x4000b3[_0x129e('0x19')]['status'])){return pm2[_0x2c3357[_0x4000b3[_0x129e('0x19')]['status']]](_0x4000b3[_0x129e('0x17')]['id'])['then'](respondWithResult(_0x441e7d,0xc8))['catch'](handleError(_0x441e7d,null));}else{return _0x441e7d[_0x129e('0x8')](0x1f4)[_0x129e('0xb')]({'message':'Unknown\x20status'});}};exports[_0x129e('0x24')]=function(_0x3d9a9a,_0x11bc13){if(_0x3d9a9a[_0x129e('0x19')]['id']){delete _0x3d9a9a[_0x129e('0x19')]['id'];}if(_0x3d9a9a['params']['id']){return pm2[_0x129e('0x25')](_0x3d9a9a[_0x129e('0x17')]['id'])['then'](function(_0x2db498){pm2[_0x129e('0x26')]();return _0x2db498[0x0];})[_0x129e('0x10')](respondWithResult(_0x11bc13,null))[_0x129e('0x14')](handleError(_0x11bc13,null));}else{return _0x11bc13[_0x129e('0x8')](0x1f4)[_0x129e('0xb')]({'message':_0x129e('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 56e9bea..b3d68d4 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 _0xbadc=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbadc,0x126));var _0xcbad=function(_0x46b295,_0x554b00){_0x46b295=_0x46b295-0x0;var _0x1c4c10=_0xbadc[_0x46b295];return _0x1c4c10;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcbad('0x0'));var timeout=require(_0xcbad('0x1'));var express=require(_0xcbad('0x2'));var router=express[_0xcbad('0x3')]();var auth=require(_0xcbad('0x4'));var interaction=require(_0xcbad('0x5'));var config=require('../../config/environment');module[_0xcbad('0x6')]=router; \ No newline at end of file +var _0xd192=['../../components/auth/service','../../config/environment','exports','util','connect-timeout','express','Router'];(function(_0xdbb6dc,_0x470111){var _0x6f3409=function(_0x16848d){while(--_0x16848d){_0xdbb6dc['push'](_0xdbb6dc['shift']());}};_0x6f3409(++_0x470111);}(_0xd192,0x130));var _0x2d19=function(_0x68aa2e,_0x5b5b16){_0x68aa2e=_0x68aa2e-0x0;var _0x2e8c79=_0xd192[_0x68aa2e];return _0x2e8c79;};'use strict';var multer=require('multer');var util=require(_0x2d19('0x0'));var path=require('path');var timeout=require(_0x2d19('0x1'));var express=require(_0x2d19('0x2'));var router=express[_0x2d19('0x3')]();var auth=require(_0x2d19('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2d19('0x5'));module[_0x2d19('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 8f8b157..aea30ec 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 _0x7b8c=['DATE','STRING','sequelize','INTEGER'];(function(_0x275043,_0x39887e){var _0x52f9dd=function(_0x1a3b0d){while(--_0x1a3b0d){_0x275043['push'](_0x275043['shift']());}};_0x52f9dd(++_0x39887e);}(_0x7b8c,0x1a6));var _0xc7b8=function(_0x14d90a,_0x512764){_0x14d90a=_0x14d90a-0x0;var _0xf8cbb2=_0x7b8c[_0x14d90a];return _0xf8cbb2;};'use strict';var Sequelize=require(_0xc7b8('0x0'));module['exports']={'state':{'type':Sequelize[_0xc7b8('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc7b8('0x2')]},'uniqueid':{'type':Sequelize[_0xc7b8('0x3')]},'starttime':{'type':Sequelize[_0xc7b8('0x2')]},'responsetime':{'type':Sequelize[_0xc7b8('0x2')]},'ringtime':{'type':Sequelize[_0xc7b8('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc7b8('0x3')]},'campaigntype':{'type':Sequelize[_0xc7b8('0x3')]},'membername':{'type':Sequelize[_0xc7b8('0x3')]}}; \ No newline at end of file +var _0xdb67=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x48231d,_0x3554c9){var _0x317ae3=function(_0x50920d){while(--_0x50920d){_0x48231d['push'](_0x48231d['shift']());}};_0x317ae3(++_0x3554c9);}(_0xdb67,0x1a3));var _0x7db6=function(_0x4bfcbe,_0x304ce7){_0x4bfcbe=_0x4bfcbe-0x0;var _0xf036b8=_0xdb67[_0x4bfcbe];return _0xf036b8;};'use strict';var Sequelize=require(_0x7db6('0x0'));module[_0x7db6('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7db6('0x2')]},'uniqueid':{'type':Sequelize[_0x7db6('0x3')]},'starttime':{'type':Sequelize[_0x7db6('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7db6('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7db6('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9210f3c..8860e88 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 _0x9e40=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','ReportAgentPreview'];(function(_0x36176d,_0x1865ac){var _0x38e458=function(_0xd94993){while(--_0xd94993){_0x36176d['push'](_0x36176d['shift']());}};_0x38e458(++_0x1865ac);}(_0x9e40,0x1dd));var _0x09e4=function(_0x1a5d82,_0x235389){_0x1a5d82=_0x1a5d82-0x0;var _0xaa1dfb=_0x9e40[_0x1a5d82];return _0xaa1dfb;};'use strict';var _=require('lodash');var util=require(_0x09e4('0x0'));var logger=require(_0x09e4('0x1'))(_0x09e4('0x2'));var moment=require(_0x09e4('0x3'));var BPromise=require(_0x09e4('0x4'));var rp=require(_0x09e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09e4('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x09e4('0x7')]=function(_0x1ec756,_0x482976){return _0x1ec756['define'](_0x09e4('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x572f=['moment','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger'];(function(_0x310c41,_0x26db37){var _0x132a5b=function(_0x13e6e6){while(--_0x13e6e6){_0x310c41['push'](_0x310c41['shift']());}};_0x132a5b(++_0x26db37);}(_0x572f,0x1c1));var _0xf572=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x572f[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xf572('0x0'));var logger=require(_0xf572('0x1'))('api');var moment=require(_0xf572('0x2'));var BPromise=require('bluebird');var rp=require(_0xf572('0x3'));var fs=require('fs');var path=require(_0xf572('0x4'));var rimraf=require(_0xf572('0x5'));var config=require('../../config/environment');var attributes=require(_0xf572('0x6'));module[_0xf572('0x7')]=function(_0x183933,_0x2679a8){return _0x183933[_0xf572('0x8')](_0xf572('0x9'),attributes,{'tableName':_0xf572('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 566c6bd..719aa90 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 _0x96f1=['../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','lodash','moment','randomstring','../../config/utils'];(function(_0x2d8396,_0x27bd28){var _0x5bdb6f=function(_0x3e0b71){while(--_0x3e0b71){_0x2d8396['push'](_0x2d8396['shift']());}};_0x5bdb6f(++_0x27bd28);}(_0x96f1,0x1f0));var _0x196f=function(_0x46121b,_0x17bfa9){_0x46121b=_0x46121b-0x0;var _0xe6bc03=_0x96f1[_0x46121b];return _0xe6bc03;};'use strict';var _=require(_0x196f('0x0'));var util=require('util');var moment=require(_0x196f('0x1'));var BPromise=require('bluebird');var rs=require(_0x196f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x196f('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x196f('0x4'));var jayson=require(_0x196f('0x5'));var client=jayson[_0x196f('0x6')][_0x196f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d7b24,_0x90be46,_0x5271c8){return new BPromise(function(_0x32c79b,_0x5ba3ac){return client[_0x196f('0x8')](_0x1d7b24,_0x5271c8)[_0x196f('0x9')](function(_0x1af18e){logger['info'](_0x196f('0xa'),_0x90be46,'request\x20sent');logger[_0x196f('0xb')](_0x196f('0xc'),_0x90be46,'request\x20sent',JSON[_0x196f('0xd')](_0x1af18e));if(_0x1af18e['error']){if(_0x1af18e['error'][_0x196f('0xe')]===0x1f4){logger[_0x196f('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x90be46,_0x1af18e[_0x196f('0xf')]['message']);return _0x5ba3ac(_0x1af18e[_0x196f('0xf')]['message']);}logger['error'](_0x196f('0xa'),_0x90be46,_0x1af18e['error'][_0x196f('0x10')]);return _0x32c79b(_0x1af18e[_0x196f('0xf')][_0x196f('0x10')]);}else{logger[_0x196f('0x11')](_0x196f('0xa'),_0x90be46,_0x196f('0x12'));_0x32c79b(_0x1af18e['result'][_0x196f('0x10')]);}})[_0x196f('0x13')](function(_0x53c8dc){logger[_0x196f('0xf')](_0x196f('0xa'),_0x90be46,_0x53c8dc);_0x5ba3ac(_0x53c8dc);});});}exports['CreateReportAgentPreview']=function(_0x5b862e){var _0x4a65b9=this;return new Promise(function(_0x255e65,_0x431930){return db[_0x196f('0x14')][_0x196f('0x15')](_0x5b862e['body'],{'raw':_0x5b862e[_0x196f('0x16')]?_0x5b862e[_0x196f('0x16')][_0x196f('0x17')]===undefined?!![]:![]:!![]})[_0x196f('0x9')](function(_0x426ac0){logger['info'](_0x196f('0x18'),_0x5b862e);logger[_0x196f('0xb')](_0x196f('0x18'),_0x5b862e,JSON[_0x196f('0xd')](_0x426ac0));_0x255e65(_0x426ac0);})[_0x196f('0x13')](function(_0x3c8f14){logger[_0x196f('0xf')]('CreateReportAgentPreview',_0x3c8f14[_0x196f('0x10')],_0x5b862e);_0x431930(_0x4a65b9[_0x196f('0xf')](0x1f4,_0x3c8f14[_0x196f('0x10')]));});});}; \ No newline at end of file +var _0x1638=['util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash'];(function(_0xdc76d4,_0x55c5e1){var _0x2de820=function(_0x47c5d7){while(--_0x47c5d7){_0xdc76d4['push'](_0xdc76d4['shift']());}};_0x2de820(++_0x55c5e1);}(_0x1638,0x195));var _0x8163=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0x1638[_0x46d14b];return _0x367dfd;};'use strict';var _=require(_0x8163('0x0'));var util=require(_0x8163('0x1'));var moment=require(_0x8163('0x2'));var BPromise=require(_0x8163('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8163('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8163('0x5'));var config=require(_0x8163('0x6'));var jayson=require(_0x8163('0x7'));var client=jayson[_0x8163('0x8')][_0x8163('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f6,_0x26ef11,_0x20acb8){return new BPromise(function(_0x4aca39,_0x4e1989){return client[_0x8163('0xa')](_0x24f2f6,_0x20acb8)[_0x8163('0xb')](function(_0x6ff62c){logger[_0x8163('0xc')](_0x8163('0xd'),_0x26ef11,_0x8163('0xe'));logger[_0x8163('0xf')](_0x8163('0x10'),_0x26ef11,'request\x20sent',JSON[_0x8163('0x11')](_0x6ff62c));if(_0x6ff62c[_0x8163('0x12')]){if(_0x6ff62c[_0x8163('0x12')][_0x8163('0x13')]===0x1f4){logger[_0x8163('0x12')](_0x8163('0xd'),_0x26ef11,_0x6ff62c['error']['message']);return _0x4e1989(_0x6ff62c[_0x8163('0x12')]['message']);}logger[_0x8163('0x12')](_0x8163('0xd'),_0x26ef11,_0x6ff62c[_0x8163('0x12')][_0x8163('0x14')]);return _0x4aca39(_0x6ff62c['error']['message']);}else{logger[_0x8163('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x26ef11,_0x8163('0xe'));_0x4aca39(_0x6ff62c[_0x8163('0x15')][_0x8163('0x14')]);}})[_0x8163('0x16')](function(_0x59198b){logger['error'](_0x8163('0xd'),_0x26ef11,_0x59198b);_0x4e1989(_0x59198b);});});}exports[_0x8163('0x17')]=function(_0xfe12d1){var _0x509a4b=this;return new Promise(function(_0x21f8a2,_0x33ada8){return db[_0x8163('0x18')][_0x8163('0x19')](_0xfe12d1[_0x8163('0x1a')],{'raw':_0xfe12d1[_0x8163('0x1b')]?_0xfe12d1[_0x8163('0x1b')][_0x8163('0x1c')]===undefined?!![]:![]:!![]})[_0x8163('0xb')](function(_0x18f52e){logger[_0x8163('0xc')]('CreateReportAgentPreview',_0xfe12d1);logger[_0x8163('0xf')]('CreateReportAgentPreview',_0xfe12d1,JSON[_0x8163('0x11')](_0x18f52e));_0x21f8a2(_0x18f52e);})[_0x8163('0x16')](function(_0xe9ff70){logger[_0x8163('0x12')](_0x8163('0x17'),_0xe9ff70[_0x8163('0x14')],_0xfe12d1);_0x33ada8(_0x509a4b[_0x8163('0x12')](0x1f4,_0xe9ff70['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2df1ab2..4db9f87 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 _0x8f71=['/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','util','path','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','/sms/queues','smsQueues','/fax/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','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify'];(function(_0x14a7e3,_0x3fa49c){var _0x162ee1=function(_0x52e605){while(--_0x52e605){_0x14a7e3['push'](_0x14a7e3['shift']());}};_0x162ee1(++_0x3fa49c);}(_0x8f71,0x9b));var _0x18f7=function(_0x5cff66,_0x4734a2){_0x5cff66=_0x5cff66-0x0;var _0x37a88e=_0x8f71[_0x5cff66];return _0x37a88e;};'use strict';var multer=require('multer');var util=require(_0x18f7('0x0'));var path=require(_0x18f7('0x1'));var express=require(_0x18f7('0x2'));var router=express['Router']();var auth=require(_0x18f7('0x3'));var controller=require(_0x18f7('0x4'));router[_0x18f7('0x5')]('/voice/channels',auth[_0x18f7('0x6')](),controller[_0x18f7('0x7')]);router[_0x18f7('0x5')](_0x18f7('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x18f7('0x5')](_0x18f7('0x9'),auth[_0x18f7('0x6')](),controller[_0x18f7('0xa')]);router[_0x18f7('0x5')]('/voice/queues',auth['isAuthenticated'](),controller[_0x18f7('0xb')]);router[_0x18f7('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x18f7('0xc')]);router['get'](_0x18f7('0xd'),auth[_0x18f7('0x6')](),controller['mailQueues']);router[_0x18f7('0x5')](_0x18f7('0xe'),auth[_0x18f7('0x6')](),controller['mailAccounts']);router[_0x18f7('0x5')](_0x18f7('0xf'),auth[_0x18f7('0x6')](),controller['openchannelQueues']);router[_0x18f7('0x5')](_0x18f7('0x10'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x11')]);router[_0x18f7('0x5')]('/whatsapp/queues',auth[_0x18f7('0x6')](),controller['whatsappQueues']);router['get'](_0x18f7('0x12'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x13')]);router[_0x18f7('0x5')](_0x18f7('0x14'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x15')]);router[_0x18f7('0x5')](_0x18f7('0x16'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x17')]);router[_0x18f7('0x5')](_0x18f7('0x18'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x19')]);router[_0x18f7('0x5')](_0x18f7('0x1a'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x1b')]);router[_0x18f7('0x5')](_0x18f7('0x1c'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x1d')]);router[_0x18f7('0x5')]('/voice/queues/:id',auth[_0x18f7('0x6')](),controller[_0x18f7('0x1e')]);router[_0x18f7('0x5')](_0x18f7('0x1f'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x20')]);router['get']('/outbound/channels',auth[_0x18f7('0x6')](),controller[_0x18f7('0x21')]);router[_0x18f7('0x5')](_0x18f7('0x22'),auth['isAuthenticated'](),controller[_0x18f7('0x23')]);router[_0x18f7('0x24')](_0x18f7('0x25'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x26')]);router[_0x18f7('0x5')]('/telephones',auth[_0x18f7('0x6')](),controller[_0x18f7('0x27')]);router[_0x18f7('0x5')](_0x18f7('0x28'),auth['isAuthenticated'](),controller[_0x18f7('0x29')]);router[_0x18f7('0x5')](_0x18f7('0x2a'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x2b')]);router[_0x18f7('0x5')](_0x18f7('0x2c'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x2d')]);router['get'](_0x18f7('0x2e'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x2f')]);router[_0x18f7('0x5')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x18f7('0x30')]);router['get'](_0x18f7('0x31'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x32')]);router[_0x18f7('0x5')](_0x18f7('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x18f7('0x34'),auth[_0x18f7('0x6')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x18f7('0x35')]);router['post']('/mail/queues/:id/notify',auth[_0x18f7('0x6')](),controller[_0x18f7('0x36')](_0x18f7('0x37')));router['get'](_0x18f7('0x38'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x39')]);router['post'](_0x18f7('0x3a'),auth[_0x18f7('0x6')](),controller['queueNotify'](_0x18f7('0x3b')));router[_0x18f7('0x5')](_0x18f7('0x3c'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x3d')]);router[_0x18f7('0x3e')](_0x18f7('0x3f'),auth['isAuthenticated'](),controller[_0x18f7('0x36')]('fax'));router[_0x18f7('0x5')]('/fax/queues/:id',auth[_0x18f7('0x6')](),controller[_0x18f7('0x40')]);router[_0x18f7('0x3e')](_0x18f7('0x41'),auth[_0x18f7('0x6')](),controller['queueNotify']('openchannel'));router['get'](_0x18f7('0x42'),auth[_0x18f7('0x6')](),controller['showOpenchannelQueues']);router[_0x18f7('0x3e')](_0x18f7('0x43'),auth[_0x18f7('0x6')](),controller['queueNotify'](_0x18f7('0x44')));router[_0x18f7('0x3e')](_0x18f7('0x45'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x36')]('whatsapp'));router['get'](_0x18f7('0x46'),auth[_0x18f7('0x6')](),controller['showSmsQueues']);router[_0x18f7('0x5')](_0x18f7('0x47'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x48')]);router[_0x18f7('0x3e')](_0x18f7('0x49'),auth[_0x18f7('0x6')](),controller[_0x18f7('0x4a')]);module['exports']=router; \ No newline at end of file +var _0xc033=['showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id'];(function(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0xc033,0x17c));var _0x3c03=function(_0x23a5e8,_0x37faab){_0x23a5e8=_0x23a5e8-0x0;var _0x3a145d=_0xc033[_0x23a5e8];return _0x3a145d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x3c03('0x0'));var controller=require('./rpc.controller');router['get'](_0x3c03('0x1'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x3')]);router['get'](_0x3c03('0x4'),auth[_0x3c03('0x2')](),controller['voiceChannelMixMonitor']);router[_0x3c03('0x5')](_0x3c03('0x6'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x7')]);router[_0x3c03('0x5')](_0x3c03('0x8'),auth[_0x3c03('0x2')](),controller['voiceQueues']);router[_0x3c03('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x3c03('0x9')]);router[_0x3c03('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0x3c03('0xa')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x3c03('0xb')]);router[_0x3c03('0x5')](_0x3c03('0xc'),auth[_0x3c03('0x2')](),controller['openchannelQueues']);router[_0x3c03('0x5')]('/sms/queues',auth['isAuthenticated'](),controller[_0x3c03('0xd')]);router[_0x3c03('0x5')](_0x3c03('0xe'),auth[_0x3c03('0x2')](),controller[_0x3c03('0xf')]);router['get'](_0x3c03('0x10'),auth[_0x3c03('0x2')](),controller['faxQueues']);router['get'](_0x3c03('0x11'),auth['isAuthenticated'](),controller[_0x3c03('0x12')]);router[_0x3c03('0x5')](_0x3c03('0x13'),auth['isAuthenticated'](),controller[_0x3c03('0x14')]);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x3c03('0x15')]);router[_0x3c03('0x5')](_0x3c03('0x16'),auth['isAuthenticated'](),controller[_0x3c03('0x17')]);router['get'](_0x3c03('0x18'),auth[_0x3c03('0x2')](),controller['voiceQueuesChannelRedirect']);router[_0x3c03('0x5')](_0x3c03('0x19'),auth['isAuthenticated'](),controller[_0x3c03('0x1a')]);router[_0x3c03('0x5')](_0x3c03('0x1b'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x1c')]);router[_0x3c03('0x5')](_0x3c03('0x1d'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x1e')]);router['get']('/agents',auth[_0x3c03('0x2')](),controller['agents']);router[_0x3c03('0x1f')](_0x3c03('0x20'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x21')]);router[_0x3c03('0x5')](_0x3c03('0x22'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x23')]);router[_0x3c03('0x5')](_0x3c03('0x24'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x25')]);router[_0x3c03('0x5')](_0x3c03('0x26'),auth[_0x3c03('0x2')](),controller['campaigns']);router[_0x3c03('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x3c03('0x27')]);router[_0x3c03('0x5')](_0x3c03('0x28'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x29')]);router['get'](_0x3c03('0x2a'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x2b')]);router[_0x3c03('0x5')](_0x3c03('0x2c'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x3c03('0x5')](_0x3c03('0x2d'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x2e')]);router[_0x3c03('0x5')]('/sms/queues/waitinginteractions',auth[_0x3c03('0x2')](),controller[_0x3c03('0x2f')]);router[_0x3c03('0x5')](_0x3c03('0x30'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x31')]);router[_0x3c03('0x5')](_0x3c03('0x32'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x33')]);router[_0x3c03('0x34')](_0x3c03('0x35'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x36')](_0x3c03('0x37')));router[_0x3c03('0x5')](_0x3c03('0x38'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x39')]);router[_0x3c03('0x34')](_0x3c03('0x3a'),auth['isAuthenticated'](),controller['queueNotify']('chat'));router[_0x3c03('0x5')](_0x3c03('0x3b'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x3c')]);router[_0x3c03('0x34')]('/fax/queues/:id/notify',auth[_0x3c03('0x2')](),controller['queueNotify'](_0x3c03('0x3d')));router[_0x3c03('0x5')](_0x3c03('0x3e'),auth[_0x3c03('0x2')](),controller['showFaxQueues']);router[_0x3c03('0x34')](_0x3c03('0x3f'),auth['isAuthenticated'](),controller[_0x3c03('0x36')](_0x3c03('0x40')));router[_0x3c03('0x5')]('/openchannel/queues/:id',auth[_0x3c03('0x2')](),controller[_0x3c03('0x41')]);router[_0x3c03('0x34')](_0x3c03('0x42'),auth['isAuthenticated'](),controller[_0x3c03('0x36')]('sms'));router[_0x3c03('0x34')](_0x3c03('0x43'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x36')](_0x3c03('0x44')));router[_0x3c03('0x5')](_0x3c03('0x45'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x46')]);router['get'](_0x3c03('0x47'),auth[_0x3c03('0x2')](),controller[_0x3c03('0x48')]);router[_0x3c03('0x34')]('/agents/:id/notify',auth[_0x3c03('0x2')](),controller[_0x3c03('0x49')]);module[_0x3c03('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9124a11..0ea1d3b 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 _0x2cd2=['agentTransferTimeout','bluebird','lodash','util','api','client','http','request','error','code','message','result','catch','json','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','MessageId','InteractionId','Account','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Website','User','agent','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','From','TransferReport'];(function(_0x25a7e0,_0xac0fcb){var _0x2cf17e=function(_0x21358d){while(--_0x21358d){_0x25a7e0['push'](_0x25a7e0['shift']());}};_0x2cf17e(++_0xac0fcb);}(_0x2cd2,0xfb));var _0x22cd=function(_0x428d5c,_0x2d627f){_0x428d5c=_0x428d5c-0x0;var _0x2f9262=_0x2cd2[_0x428d5c];return _0x2f9262;};'use strict';var BPromise=require(_0x22cd('0x0'));var moment=require('moment');var _=require(_0x22cd('0x1'));var util=require(_0x22cd('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x22cd('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x22cd('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x22cd('0x4')][_0x22cd('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x22cd('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x7de80b,_0x3cd098,_0x3296be){return new BPromise(function(_0x383a46,_0x2f0453){var _0x32c250=_0x3296be?_0x3296be:amiClient;return _0x32c250[_0x22cd('0x6')](_0x7de80b,_0x3cd098)['then'](function(_0x4b7a86){if(_0x4b7a86[_0x22cd('0x7')]){if(_0x4b7a86[_0x22cd('0x7')][_0x22cd('0x8')]===0x1f4){return _0x2f0453(_0x4b7a86[_0x22cd('0x7')]['message']);}return _0x383a46(_0x4b7a86[_0x22cd('0x7')][_0x22cd('0x9')]);}else{_0x383a46(_0x4b7a86[_0x22cd('0xa')]);}})[_0x22cd('0xb')](function(_0x17a365){_0x2f0453(_0x17a365);});});}function respondWithResult(_0x5c8829,_0x39035b){_0x39035b=_0x39035b||0xc8;return function(_0x2da638){if(_0x2da638){return _0x5c8829['status'](_0x39035b)[_0x22cd('0xc')](_0x2da638);}return _0x5c8829['sendStatus'](0x194);};}function handleError(_0x4744e8,_0x16520a){_0x16520a=_0x16520a||0x1f4;return function(_0x208324){logger[_0x22cd('0x7')](_0x208324[_0x22cd('0xd')]);if(_0x208324['name']){delete _0x208324[_0x22cd('0xe')];}_0x4744e8['status'](_0x16520a)[_0x22cd('0xf')](_0x208324);};}function findById(_0x11465a){return function(_0x542ad8){if(!_[_0x22cd('0x10')](_0x11465a)&&!_['isNil'](_0x542ad8)&&!_['isNil'](_0x542ad8['rows'])){return _[_0x22cd('0x11')](_0x542ad8[_0x22cd('0x12')],function(_0x1b836a){return _0x1b836a['id']==_0x11465a;});}return null;};}exports[_0x22cd('0x13')]=function(_0x4c0a4a,_0x618e8c){return respondWithRpcPromise(_0x22cd('0x14'),_0x4c0a4a['query'])[_0x22cd('0x15')](respondWithResult(_0x618e8c,null))[_0x22cd('0xb')](handleError(_0x618e8c,null));};exports[_0x22cd('0x16')]=function(_0x3b31a2,_0x468134){return respondWithRpcPromise(_0x22cd('0x17'),_[_0x22cd('0x18')](_0x3b31a2[_0x22cd('0x19')],_0x3b31a2[_0x22cd('0x1a')]))[_0x22cd('0x15')](respondWithResult(_0x468134,null))[_0x22cd('0xb')](handleError(_0x468134,null));};exports['voiceChannelStopMixMonitor']=function(_0x524499,_0x35a903){return respondWithRpcPromise(_0x22cd('0x1b'),_[_0x22cd('0x18')](_0x524499[_0x22cd('0x19')],_0x524499['params']))[_0x22cd('0x15')](respondWithResult(_0x35a903,null))[_0x22cd('0xb')](handleError(_0x35a903,null));};exports[_0x22cd('0x1c')]=function(_0x5bfd82,_0x3aa12a){return respondWithRpcPromise(_0x22cd('0x1d'),_0x5bfd82['query'])['then'](respondWithResult(_0x3aa12a,null))[_0x22cd('0xb')](handleError(_0x3aa12a,null));};exports[_0x22cd('0x1e')]=function(_0x34d771,_0x24a44f){return respondWithRpcPromise(_0x22cd('0x1d'),_0x34d771[_0x22cd('0x19')])[_0x22cd('0x15')](findById(_0x34d771['params']['id']))[_0x22cd('0x15')](respondWithResult(_0x24a44f,null))[_0x22cd('0xb')](handleError(_0x24a44f,null));};exports['voiceQueuesPreview']=function(_0x4679d2,_0x2d52b4){return respondWithRpcPromise(_0x22cd('0x1f'),_[_0x22cd('0x18')](_0x4679d2[_0x22cd('0x19')],_0x4679d2['params']))[_0x22cd('0x15')](respondWithResult(_0x2d52b4,null))[_0x22cd('0xb')](handleError(_0x2d52b4,null));};exports[_0x22cd('0x20')]=function(_0x6e3f6a,_0x1b33fa){return respondWithRpcPromise(_0x22cd('0x21'),_0x6e3f6a['query'])[_0x22cd('0x15')](respondWithResult(_0x1b33fa,null))[_0x22cd('0xb')](handleError(_0x1b33fa,null));};exports['voiceQueuesChannel']=function(_0x1d658b,_0xed800c){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x22cd('0x18')](_0x1d658b[_0x22cd('0x19')],_0x1d658b[_0x22cd('0x1a')]))[_0x22cd('0x15')](respondWithResult(_0xed800c,null))[_0x22cd('0xb')](handleError(_0xed800c,null));};exports[_0x22cd('0x22')]=function(_0x35650c,_0x24a9c9){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x22cd('0x18')](_0x35650c[_0x22cd('0x19')],_0x35650c['params']))[_0x22cd('0x15')](respondWithResult(_0x24a9c9,null))[_0x22cd('0xb')](handleError(_0x24a9c9,null));};exports['voiceQueuesChannelRedirect']=function(_0x102225,_0x32513d){return respondWithRpcPromise(_0x22cd('0x23'),_[_0x22cd('0x18')](_0x102225[_0x22cd('0x19')],_0x102225[_0x22cd('0x1a')]))[_0x22cd('0x15')](respondWithResult(_0x32513d,null))[_0x22cd('0xb')](handleError(_0x32513d,null));};exports[_0x22cd('0x24')]=function(_0x47d3c9,_0x3cae69){return respondWithRpcPromise(_0x22cd('0x25'),_0x47d3c9['query'])[_0x22cd('0x15')](respondWithResult(_0x3cae69,null))[_0x22cd('0xb')](handleError(_0x3cae69,null));};exports['outboundChannels']=function(_0x5afc04,_0x39d8c2){return respondWithRpcPromise('OutboundChannels',_0x5afc04[_0x22cd('0x19')])[_0x22cd('0x15')](respondWithResult(_0x39d8c2,null))[_0x22cd('0xb')](handleError(_0x39d8c2,null));};exports[_0x22cd('0x26')]=function(_0x560b83,_0x5a0114){var _0x40141d;return respondWithRpcPromise(_0x22cd('0x27'),_0x560b83[_0x22cd('0x19')])[_0x22cd('0x15')](function(_0x114d63){_0x40141d=_0x114d63;return respondWithRpcPromise(_0x22cd('0x27'),_0x560b83['query'],routingClient);})[_0x22cd('0x15')](function(_0x4a6b90){return _[_0x22cd('0x18')]({},_0x4a6b90,_0x40141d);})['then'](respondWithResult(_0x5a0114,null))[_0x22cd('0xb')](handleError(_0x5a0114,null));};exports['agentCapacity']=function(_0x1d6012,_0x392249){if(_0x1d6012['body']&&_0x1d6012[_0x22cd('0x28')]['interaction']&&_0x1d6012[_0x22cd('0x29')]&&_0x1d6012[_0x22cd('0x29')]['name']){for(var _0xede17c in _0x1d6012[_0x22cd('0x28')][_0x22cd('0x2a')]){if(_0x1d6012['body'][_0x22cd('0x2a')][_0x22cd('0x2b')](_0xede17c)){db[_0x22cd('0x2c')][_0x22cd('0x2d')]({'where':{'channel':_0xede17c,'membername':_0x1d6012[_0x22cd('0x29')][_0x22cd('0xe')],'type':_0x22cd('0x2e'),'exitAt':null,'uniqueid':_0x1d6012[_0x22cd('0x28')]['interaction'][_0xede17c]&&_0x1d6012[_0x22cd('0x28')]['interaction'][_0xede17c][_0x22cd('0x2f')]?{'$notIn':_0x1d6012[_0x22cd('0x28')]['interaction'][_0xede17c]}:{'$ne':null}}})['then'](function(_0x2263aa){var _0x1ec615=moment()[_0x22cd('0x30')](_0x22cd('0x31'));for(var _0x3c280a=0x0,_0x1262ed=_0x2263aa[_0x22cd('0x2f')];_0x3c280a<_0x1262ed;_0x3c280a+=0x1){_0x2263aa[_0x3c280a][_0x22cd('0x32')]({'exitAt':_0x1ec615});}});for(var _0x2eb259=0x0;_0x2eb259<_0x1d6012[_0x22cd('0x28')][_0x22cd('0x2a')][_0xede17c][_0x22cd('0x2f')];_0x2eb259+=0x1){db[_0x22cd('0x2c')][_0x22cd('0x33')]({'where':{'channel':_0xede17c,'membername':_0x1d6012[_0x22cd('0x29')][_0x22cd('0xe')],'type':_0x22cd('0x2e'),'uniqueid':_0x1d6012['body'][_0x22cd('0x2a')][_0xede17c][_0x2eb259],'exitAt':null},'defaults':{'channel':_0xede17c,'membername':_0x1d6012['user']['name'],'interface':_[_0x22cd('0x10')](_0x1d6012[_0x22cd('0x29')][_0x22cd('0x34')])?util[_0x22cd('0x30')]('SIP/%s',_0x1d6012[_0x22cd('0x29')][_0x22cd('0xe')]):_0x1d6012['user'][_0x22cd('0x34')],'type':_0x22cd('0x2e'),'enterAt':moment()['format'](_0x22cd('0x31')),'role':'agent','internal':_0x1d6012[_0x22cd('0x29')][_0x22cd('0x35')],'uniqueid':_0x1d6012[_0x22cd('0x28')][_0x22cd('0x2a')][_0xede17c][_0x2eb259]}});}}}}return respondWithRpcPromise(_0x22cd('0x36'),{'id':_0x1d6012[_0x22cd('0x1a')]['id'],'capacity':_0x1d6012[_0x22cd('0x28')][_0x22cd('0x37')]},routingClient)[_0x22cd('0x15')](respondWithResult(_0x392249,null))[_0x22cd('0xb')](handleError(_0x392249,null));};exports[_0x22cd('0x38')]=function(_0x1b3276,_0x2e4cfa){return respondWithRpcPromise(_0x22cd('0x39'),_0x1b3276[_0x22cd('0x19')])[_0x22cd('0x15')](respondWithResult(_0x2e4cfa,null))[_0x22cd('0xb')](handleError(_0x2e4cfa,null));};exports[_0x22cd('0x3a')]=function(_0x41c980,_0x7378ad){return respondWithRpcPromise(_0x22cd('0x3b'),_0x41c980[_0x22cd('0x19')])[_0x22cd('0x15')](respondWithResult(_0x7378ad,null))[_0x22cd('0xb')](handleError(_0x7378ad,null));};exports[_0x22cd('0x3c')]=function(_0x222029,_0x1964f7){return respondWithRpcPromise('Campaigns',_0x222029['query'])[_0x22cd('0x15')](respondWithResult(_0x1964f7,null))[_0x22cd('0xb')](handleError(_0x1964f7,null));};exports['chatQueues']=function(_0x333dd0,_0x368ce6){return respondWithRpcPromise(_0x22cd('0x3d'),_0x333dd0[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](respondWithResult(_0x368ce6,null))[_0x22cd('0xb')](handleError(_0x368ce6,null));};exports[_0x22cd('0x3e')]=function(_0x2511c5,_0x2eea95){return respondWithRpcPromise(_0x22cd('0x3d'),_0x2511c5[_0x22cd('0x19')],routingClient)['then'](findById(_0x2511c5[_0x22cd('0x1a')]['id']))[_0x22cd('0x15')](respondWithResult(_0x2eea95,null))[_0x22cd('0xb')](handleError(_0x2eea95,null));};exports[_0x22cd('0x3f')]=function(_0x507339,_0x245a25){return respondWithRpcPromise(_0x22cd('0x40'),_0x507339['query'],routingClient)['then'](respondWithResult(_0x245a25,null))[_0x22cd('0xb')](handleError(_0x245a25,null));};exports[_0x22cd('0x41')]=function(_0x1e9da9,_0x125588){return respondWithRpcPromise(_0x22cd('0x40'),_0x1e9da9[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](findById(_0x1e9da9[_0x22cd('0x1a')]['id']))[_0x22cd('0x15')](respondWithResult(_0x125588,null))['catch'](handleError(_0x125588,null));};exports[_0x22cd('0x42')]=function(_0x14aa0a,_0x390741){return respondWithRpcPromise(_0x22cd('0x43'),_0x14aa0a[_0x22cd('0x19')],mailClient)[_0x22cd('0x15')](respondWithResult(_0x390741,null))[_0x22cd('0xb')](handleError(_0x390741,null));};exports[_0x22cd('0x44')]=function(_0x48b52d,_0x30ad19){return respondWithRpcPromise(_0x22cd('0x45'),_0x48b52d[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](respondWithResult(_0x30ad19,null))['catch'](handleError(_0x30ad19,null));};exports[_0x22cd('0x46')]=function(_0x2f7462,_0x5cc071){return respondWithRpcPromise(_0x22cd('0x45'),_0x2f7462['query'],routingClient)[_0x22cd('0x15')](findById(_0x2f7462[_0x22cd('0x1a')]['id']))[_0x22cd('0x15')](respondWithResult(_0x5cc071,null))[_0x22cd('0xb')](handleError(_0x5cc071,null));};exports['smsQueues']=function(_0x4939ab,_0x200b8d){return respondWithRpcPromise(_0x22cd('0x47'),_0x4939ab['query'],routingClient)[_0x22cd('0x15')](respondWithResult(_0x200b8d,null))[_0x22cd('0xb')](handleError(_0x200b8d,null));};exports[_0x22cd('0x48')]=function(_0x285528,_0xa32b35){return respondWithRpcPromise(_0x22cd('0x47'),_0x285528[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](findById(_0x285528[_0x22cd('0x1a')]['id']))[_0x22cd('0x15')](respondWithResult(_0xa32b35,null))[_0x22cd('0xb')](handleError(_0xa32b35,null));};exports['whatsappQueues']=function(_0x48148d,_0x3b4a29){return respondWithRpcPromise(_0x22cd('0x49'),_0x48148d[_0x22cd('0x19')],routingClient)['then'](respondWithResult(_0x3b4a29,null))[_0x22cd('0xb')](handleError(_0x3b4a29,null));};exports[_0x22cd('0x4a')]=function(_0x21bb81,_0x43826c){return respondWithRpcPromise(_0x22cd('0x49'),_0x21bb81[_0x22cd('0x19')],routingClient)['then'](findById(_0x21bb81[_0x22cd('0x1a')]['id']))[_0x22cd('0x15')](respondWithResult(_0x43826c,null))[_0x22cd('0xb')](handleError(_0x43826c,null));};exports['faxQueues']=function(_0x2f110d,_0xd0b372){return respondWithRpcPromise(_0x22cd('0x4b'),_0x2f110d[_0x22cd('0x19')],routingClient)['then'](respondWithResult(_0xd0b372,null))[_0x22cd('0xb')](handleError(_0xd0b372,null));};exports[_0x22cd('0x4c')]=function(_0x1f3654,_0x4c52ba){return respondWithRpcPromise(_0x22cd('0x4b'),_0x1f3654[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](findById(_0x1f3654['params']['id']))['then'](respondWithResult(_0x4c52ba,null))[_0x22cd('0xb')](handleError(_0x4c52ba,null));};exports[_0x22cd('0x4d')]=function(_0x52b0cd,_0x347279){return respondWithRpcPromise('FaxAccounts',_0x52b0cd['query'])['then'](respondWithResult(_0x347279,null))[_0x22cd('0xb')](handleError(_0x347279,null));};exports[_0x22cd('0x4e')]=function(_0x1f42d7,_0xa4f12f){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x1f42d7[_0x22cd('0x19')],routingClient)['then'](respondWithResult(_0xa4f12f,null))['catch'](handleError(_0xa4f12f,null));};exports[_0x22cd('0x4f')]=function(_0x1b9ae9,_0x1c6f39){return respondWithRpcPromise(_0x22cd('0x50'),_0x1b9ae9[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](respondWithResult(_0x1c6f39,null))[_0x22cd('0xb')](handleError(_0x1c6f39,null));};exports[_0x22cd('0x51')]=function(_0x16a8ae,_0x40980c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x16a8ae[_0x22cd('0x19')],routingClient)['then'](respondWithResult(_0x40980c,null))['catch'](handleError(_0x40980c,null));};exports[_0x22cd('0x52')]=function(_0x5d41f3,_0x275970){return respondWithRpcPromise(_0x22cd('0x53'),_0x5d41f3['query'],routingClient)[_0x22cd('0x15')](function(_0x594a8b){if(_0x5d41f3['query'][_0x22cd('0x54')]!==undefined){var _0x12dd12=_(_0x594a8b[_0x22cd('0x12')])[_0x22cd('0x55')]([_0x5d41f3['query'][_0x22cd('0x54')],_0x5d41f3[_0x22cd('0x1a')]['id']])[_0x22cd('0x56')](_0x22cd('0x57'))[_0x22cd('0x58')]()[_0x22cd('0x59')]();return _0x594a8b['rows'][_0x22cd('0x55')](function(_0x54575e){return _0x12dd12[_0x22cd('0x5a')](_0x54575e[_0x22cd('0x57')])>-0x1;});}else{return _0x594a8b['rows'][_0x22cd('0x55')](function(_0x6d38fa){return _0x6d38fa[_0x22cd('0x57')]===parseInt(_0x5d41f3[_0x22cd('0x1a')]['id']);});}})[_0x22cd('0x15')](respondWithResult(_0x275970,null))[_0x22cd('0xb')](handleError(_0x275970,null));};exports['smsQueuesWaitingInteractions']=function(_0x4170cf,_0x27e658){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x4170cf[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](respondWithResult(_0x27e658,null))['catch'](handleError(_0x27e658,null));};exports[_0x22cd('0x5b')]=function(_0x29111f,_0xc2d506){return respondWithRpcPromise(_0x22cd('0x5c'),_0x29111f[_0x22cd('0x19')],routingClient)['then'](respondWithResult(_0xc2d506,null))[_0x22cd('0xb')](handleError(_0xc2d506,null));};exports[_0x22cd('0x5d')]=function(_0xf29eb5,_0x29fde4){return respondWithRpcPromise(_0x22cd('0x5e'),_0xf29eb5[_0x22cd('0x19')],routingClient)[_0x22cd('0x15')](respondWithResult(_0x29fde4,null))[_0x22cd('0xb')](handleError(_0x29fde4,null));};exports[_0x22cd('0x5f')]=function(_0x1118b3){return function(_0x47de13,_0x535275){var _0x8f7fc0,_0x5c97bc;var _0xf6299f=_[_0x22cd('0x60')](_0x1118b3);var _0x14b558=_0x1118b3===_0x22cd('0x61')?'Website':'Account';return db[_0xf6299f+_0x22cd('0x62')][_0x22cd('0x63')]({'raw':!![],'where':{'id':_0x47de13['params']['id']}})[_0x22cd('0x15')](function(_0xc0fc19){if(_[_0x22cd('0x10')](_0xc0fc19)){throw new Error(_0xf6299f+_0x22cd('0x64'));}_0x8f7fc0=_0xc0fc19;return db[_0xf6299f+'Message']['findOne']({'where':{'id':_0x47de13[_0x22cd('0x28')][_0x22cd('0x65')]},'include':[{'model':db[_0xf6299f+'Interaction'],'as':_0x22cd('0x66')},{'model':db[_0xf6299f+_0x14b558],'as':'Account'}]});})[_0x22cd('0x15')](function(_0x49be7d){if(_[_0x22cd('0x10')](_0x49be7d)){throw new Error(_0xf6299f+'\x20Message\x20not\x20found');}_0x5c97bc=_0x49be7d;return _0x49be7d[_0x22cd('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x22cd('0x15')](function(){var _0x3aea71={'uniqueid':_0x1118b3+'.'+_0x5c97bc['id']+'.'+_0x5c97bc[_0x22cd('0x66')]['id'],'FromUserId':_0x47de13[_0x22cd('0x29')]['id'],'type':'queue'};_0x3aea71[_0xf6299f+_0x22cd('0x68')]=_0x5c97bc['id'];_0x3aea71[_0xf6299f+_0x22cd('0x69')]=_0x5c97bc[_0x22cd('0x66')]['id'];_0x3aea71['From'+_0xf6299f+_0x14b558+'Id']=_0x5c97bc[_0x22cd('0x6a')]['id'];_0x3aea71['To'+_0xf6299f+_0x22cd('0x6b')]=_0x8f7fc0['id'];return db[_0xf6299f+'TransferReport'][_0x22cd('0x6c')](_0x3aea71);})[_0x22cd('0x15')](function(){return respondWithRpcPromise(_0x22cd('0x6d'),{'channel':_0x1118b3,'interaction':_0x5c97bc[_0x22cd('0x66')],'message':_0x5c97bc,'account':_0x5c97bc[_0x22cd('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x22cd('0x6e'),'appdata':_0x8f7fc0[_0x22cd('0xe')]+','+(_0x5c97bc[_0x22cd('0x6a')][_0x22cd('0x6f')]||0x12c),'interval':_0x22cd('0x70')}]},routingClient);})[_0x22cd('0x15')](respondWithResult(_0x535275,null))[_0x22cd('0xb')](handleError(_0x535275,null));};};exports[_0x22cd('0x71')]=function(_0x5f3132,_0x33d494){var _0xec6acc,_0x3f4d0e;if(_[_0x22cd('0x10')](_0x5f3132[_0x22cd('0x28')]['channel'])){throw new Error(_0x22cd('0x72'));}var _0x2e3788=_0x5f3132['body'][_0x22cd('0x73')];var _0x11c2ee=_[_0x22cd('0x60')](_0x2e3788);var _0x393ca0=_0x2e3788===_0x22cd('0x61')?_0x22cd('0x74'):_0x22cd('0x6a');return db[_0x22cd('0x75')][_0x22cd('0x63')]({'raw':!![],'where':{'id':_0x5f3132[_0x22cd('0x1a')]['id'],'role':_0x22cd('0x76')}})[_0x22cd('0x15')](function(_0x445bae){if(_[_0x22cd('0x10')](_0x445bae)){throw new Error(_0x22cd('0x77'));}_0xec6acc=_0x445bae;return db[_0x11c2ee+_0x22cd('0x78')]['findOne']({'where':{'id':_0x5f3132[_0x22cd('0x28')][_0x22cd('0x65')]},'include':[{'model':db[_0x11c2ee+'Interaction'],'as':_0x22cd('0x66')},{'model':db[_0x11c2ee+_0x393ca0],'as':_0x22cd('0x6a')}]});})[_0x22cd('0x15')](function(_0x34ce0b){if(_[_0x22cd('0x10')](_0x34ce0b)){throw new Error(_0x11c2ee+_0x22cd('0x79'));}_0x3f4d0e=_0x34ce0b;return _0x34ce0b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x22cd('0x15')](function(){var _0x3fa156={'uniqueid':_0x2e3788+'.'+_0x3f4d0e['id']+'.'+_0x3f4d0e[_0x22cd('0x66')]['id'],'FromUserId':_0x5f3132[_0x22cd('0x29')]['id'],'type':_0x22cd('0x6e'),'ToUserId':_0xec6acc['id']};_0x3fa156[_0x11c2ee+_0x22cd('0x68')]=_0x3f4d0e['id'];_0x3fa156[_0x11c2ee+_0x22cd('0x69')]=_0x3f4d0e[_0x22cd('0x66')]['id'];_0x3fa156[_0x22cd('0x7a')+_0x11c2ee+_0x393ca0+'Id']=_0x3f4d0e[_0x22cd('0x6a')]['id'];return db[_0x11c2ee+_0x22cd('0x7b')]['create'](_0x3fa156);})['then'](function(){return respondWithRpcPromise(_0x22cd('0x6d'),{'channel':_0x2e3788,'interaction':_0x3f4d0e[_0x22cd('0x66')],'message':_0x3f4d0e,'account':_0x3f4d0e[_0x22cd('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x22cd('0x76'),'appdata':_0xec6acc[_0x22cd('0xe')]+','+(_0x3f4d0e[_0x22cd('0x6a')][_0x22cd('0x7c')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x22cd('0x15')](respondWithResult(_0x33d494,null))['catch'](handleError(_0x33d494,null));}; \ No newline at end of file +var _0xb2b7=['params','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','capitalize','User','Agent\x20not\x20found','agentTransferTimeout','moment','util','../../config/logger','api','jayson/promise','http','client','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge'];(function(_0x24e010,_0x376de5){var _0x177520=function(_0x1bef3d){while(--_0x1bef3d){_0x24e010['push'](_0x24e010['shift']());}};_0x177520(++_0x376de5);}(_0xb2b7,0x14e));var _0x7b2b=function(_0x5c762e,_0x4cf8f6){_0x5c762e=_0x5c762e-0x0;var _0x53c71a=_0xb2b7[_0x5c762e];return _0x53c71a;};'use strict';var BPromise=require('bluebird');var moment=require(_0x7b2b('0x0'));var _=require('lodash');var util=require(_0x7b2b('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x7b2b('0x2'))(_0x7b2b('0x3'));var jayson=require(_0x7b2b('0x4'));var amiClient=jayson['client'][_0x7b2b('0x5')]({'port':0x232a});var mailClient=jayson[_0x7b2b('0x6')][_0x7b2b('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x7b2b('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x48d3ee,_0x598316,_0x5afc5b){return new BPromise(function(_0x170cb1,_0x14a9c5){var _0x2c7fd6=_0x5afc5b?_0x5afc5b:amiClient;return _0x2c7fd6[_0x7b2b('0x7')](_0x48d3ee,_0x598316)['then'](function(_0x1e44b1){if(_0x1e44b1[_0x7b2b('0x8')]){if(_0x1e44b1[_0x7b2b('0x8')]['code']===0x1f4){return _0x14a9c5(_0x1e44b1[_0x7b2b('0x8')][_0x7b2b('0x9')]);}return _0x170cb1(_0x1e44b1[_0x7b2b('0x8')]['message']);}else{_0x170cb1(_0x1e44b1[_0x7b2b('0xa')]);}})[_0x7b2b('0xb')](function(_0x367e1a){_0x14a9c5(_0x367e1a);});});}function respondWithResult(_0x3544f4,_0x1a6cc9){_0x1a6cc9=_0x1a6cc9||0xc8;return function(_0x36c46a){if(_0x36c46a){return _0x3544f4[_0x7b2b('0xc')](_0x1a6cc9)[_0x7b2b('0xd')](_0x36c46a);}return _0x3544f4[_0x7b2b('0xe')](0x194);};}function handleError(_0x8e2d3c,_0x4968ee){_0x4968ee=_0x4968ee||0x1f4;return function(_0x5cf2a6){logger[_0x7b2b('0x8')](_0x5cf2a6['stack']);if(_0x5cf2a6[_0x7b2b('0xf')]){delete _0x5cf2a6['name'];}_0x8e2d3c['status'](_0x4968ee)[_0x7b2b('0x10')](_0x5cf2a6);};}function findById(_0x1f6a4d){return function(_0x16c423){if(!_[_0x7b2b('0x11')](_0x1f6a4d)&&!_[_0x7b2b('0x11')](_0x16c423)&&!_[_0x7b2b('0x11')](_0x16c423[_0x7b2b('0x12')])){return _[_0x7b2b('0x13')](_0x16c423[_0x7b2b('0x12')],function(_0x49cfdb){return _0x49cfdb['id']==_0x1f6a4d;});}return null;};}exports[_0x7b2b('0x14')]=function(_0x2bc955,_0x3a72da){return respondWithRpcPromise(_0x7b2b('0x15'),_0x2bc955[_0x7b2b('0x16')])['then'](respondWithResult(_0x3a72da,null))[_0x7b2b('0xb')](handleError(_0x3a72da,null));};exports[_0x7b2b('0x17')]=function(_0x47deab,_0x1f3d73){return respondWithRpcPromise(_0x7b2b('0x18'),_[_0x7b2b('0x19')](_0x47deab[_0x7b2b('0x16')],_0x47deab[_0x7b2b('0x1a')]))[_0x7b2b('0x1b')](respondWithResult(_0x1f3d73,null))[_0x7b2b('0xb')](handleError(_0x1f3d73,null));};exports[_0x7b2b('0x1c')]=function(_0x2e2482,_0x3c3b2e){return respondWithRpcPromise(_0x7b2b('0x1d'),_[_0x7b2b('0x19')](_0x2e2482[_0x7b2b('0x16')],_0x2e2482['params']))['then'](respondWithResult(_0x3c3b2e,null))[_0x7b2b('0xb')](handleError(_0x3c3b2e,null));};exports['voiceQueues']=function(_0x4e1963,_0x5825f5){return respondWithRpcPromise(_0x7b2b('0x1e'),_0x4e1963[_0x7b2b('0x16')])['then'](respondWithResult(_0x5825f5,null))[_0x7b2b('0xb')](handleError(_0x5825f5,null));};exports[_0x7b2b('0x1f')]=function(_0x31cb53,_0x3b702a){return respondWithRpcPromise(_0x7b2b('0x1e'),_0x31cb53['query'])[_0x7b2b('0x1b')](findById(_0x31cb53['params']['id']))[_0x7b2b('0x1b')](respondWithResult(_0x3b702a,null))[_0x7b2b('0xb')](handleError(_0x3b702a,null));};exports[_0x7b2b('0x20')]=function(_0x577105,_0x12dc1c){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x7b2b('0x19')](_0x577105[_0x7b2b('0x16')],_0x577105['params']))[_0x7b2b('0x1b')](respondWithResult(_0x12dc1c,null))['catch'](handleError(_0x12dc1c,null));};exports[_0x7b2b('0x21')]=function(_0xfe295e,_0x3b0ceb){return respondWithRpcPromise(_0x7b2b('0x22'),_0xfe295e[_0x7b2b('0x16')])['then'](respondWithResult(_0x3b0ceb,null))['catch'](handleError(_0x3b0ceb,null));};exports['voiceQueuesChannel']=function(_0xca52fc,_0xcda603){return respondWithRpcPromise(_0x7b2b('0x23'),_[_0x7b2b('0x19')](_0xca52fc['query'],_0xca52fc['params']))[_0x7b2b('0x1b')](respondWithResult(_0xcda603,null))[_0x7b2b('0xb')](handleError(_0xcda603,null));};exports['voiceQueuesChannelHangup']=function(_0x4e6131,_0x38e72e){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x4e6131[_0x7b2b('0x16')],_0x4e6131[_0x7b2b('0x1a')]))[_0x7b2b('0x1b')](respondWithResult(_0x38e72e,null))[_0x7b2b('0xb')](handleError(_0x38e72e,null));};exports[_0x7b2b('0x24')]=function(_0x4f74af,_0xd37c4f){return respondWithRpcPromise(_0x7b2b('0x25'),_['merge'](_0x4f74af[_0x7b2b('0x16')],_0x4f74af[_0x7b2b('0x1a')]))['then'](respondWithResult(_0xd37c4f,null))['catch'](handleError(_0xd37c4f,null));};exports[_0x7b2b('0x26')]=function(_0x490949,_0x1caa7b){return respondWithRpcPromise(_0x7b2b('0x27'),_0x490949[_0x7b2b('0x16')])[_0x7b2b('0x1b')](respondWithResult(_0x1caa7b,null))[_0x7b2b('0xb')](handleError(_0x1caa7b,null));};exports[_0x7b2b('0x28')]=function(_0x2ac299,_0x479edf){return respondWithRpcPromise(_0x7b2b('0x29'),_0x2ac299[_0x7b2b('0x16')])['then'](respondWithResult(_0x479edf,null))[_0x7b2b('0xb')](handleError(_0x479edf,null));};exports[_0x7b2b('0x2a')]=function(_0x3e78cd,_0x4d5af6){var _0x45b4d6;return respondWithRpcPromise(_0x7b2b('0x2b'),_0x3e78cd['query'])[_0x7b2b('0x1b')](function(_0x36f322){_0x45b4d6=_0x36f322;return respondWithRpcPromise(_0x7b2b('0x2b'),_0x3e78cd[_0x7b2b('0x16')],routingClient);})[_0x7b2b('0x1b')](function(_0x57f520){return _[_0x7b2b('0x19')]({},_0x57f520,_0x45b4d6);})[_0x7b2b('0x1b')](respondWithResult(_0x4d5af6,null))[_0x7b2b('0xb')](handleError(_0x4d5af6,null));};exports[_0x7b2b('0x2c')]=function(_0xb10b0b,_0x1a5457){if(_0xb10b0b[_0x7b2b('0x2d')]&&_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x2e')]&&_0xb10b0b[_0x7b2b('0x2f')]&&_0xb10b0b[_0x7b2b('0x2f')][_0x7b2b('0xf')]){for(var _0x3a6835 in _0xb10b0b[_0x7b2b('0x2d')]['interaction']){if(_0xb10b0b['body'][_0x7b2b('0x2e')][_0x7b2b('0x30')](_0x3a6835)){db[_0x7b2b('0x31')][_0x7b2b('0x32')]({'where':{'channel':_0x3a6835,'membername':_0xb10b0b[_0x7b2b('0x2f')][_0x7b2b('0xf')],'type':_0x7b2b('0x33'),'exitAt':null,'uniqueid':_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x2e')][_0x3a6835]&&_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x2e')][_0x3a6835][_0x7b2b('0x34')]?{'$notIn':_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x2e')][_0x3a6835]}:{'$ne':null}}})[_0x7b2b('0x1b')](function(_0x4e577c){var _0x35fa3c=moment()[_0x7b2b('0x35')](_0x7b2b('0x36'));for(var _0x2bc370=0x0,_0xd97df4=_0x4e577c[_0x7b2b('0x34')];_0x2bc370<_0xd97df4;_0x2bc370+=0x1){_0x4e577c[_0x2bc370]['updateAttributes']({'exitAt':_0x35fa3c});}});for(var _0x25067d=0x0;_0x25067d<_0xb10b0b[_0x7b2b('0x2d')]['interaction'][_0x3a6835][_0x7b2b('0x34')];_0x25067d+=0x1){db['MemberReport'][_0x7b2b('0x37')]({'where':{'channel':_0x3a6835,'membername':_0xb10b0b[_0x7b2b('0x2f')][_0x7b2b('0xf')],'type':'INTERACTION','uniqueid':_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x2e')][_0x3a6835][_0x25067d],'exitAt':null},'defaults':{'channel':_0x3a6835,'membername':_0xb10b0b[_0x7b2b('0x2f')][_0x7b2b('0xf')],'interface':_['isNil'](_0xb10b0b[_0x7b2b('0x2f')]['interface'])?util[_0x7b2b('0x35')]('SIP/%s',_0xb10b0b[_0x7b2b('0x2f')]['name']):_0xb10b0b[_0x7b2b('0x2f')]['interface'],'type':_0x7b2b('0x33'),'enterAt':moment()[_0x7b2b('0x35')](_0x7b2b('0x36')),'role':_0x7b2b('0x38'),'internal':_0xb10b0b['user']['internal'],'uniqueid':_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x2e')][_0x3a6835][_0x25067d]}});}}}}return respondWithRpcPromise(_0x7b2b('0x39'),{'id':_0xb10b0b[_0x7b2b('0x1a')]['id'],'capacity':_0xb10b0b[_0x7b2b('0x2d')][_0x7b2b('0x3a')]},routingClient)['then'](respondWithResult(_0x1a5457,null))['catch'](handleError(_0x1a5457,null));};exports[_0x7b2b('0x3b')]=function(_0x45e9c6,_0xdf293a){return respondWithRpcPromise(_0x7b2b('0x3c'),_0x45e9c6['query'])[_0x7b2b('0x1b')](respondWithResult(_0xdf293a,null))['catch'](handleError(_0xdf293a,null));};exports[_0x7b2b('0x3d')]=function(_0x5887e2,_0x38eeb3){return respondWithRpcPromise('Trunks',_0x5887e2[_0x7b2b('0x16')])['then'](respondWithResult(_0x38eeb3,null))['catch'](handleError(_0x38eeb3,null));};exports[_0x7b2b('0x3e')]=function(_0x1ceb17,_0x2f3a57){return respondWithRpcPromise('Campaigns',_0x1ceb17[_0x7b2b('0x16')])[_0x7b2b('0x1b')](respondWithResult(_0x2f3a57,null))[_0x7b2b('0xb')](handleError(_0x2f3a57,null));};exports['chatQueues']=function(_0x370504,_0x5935ac){return respondWithRpcPromise(_0x7b2b('0x3f'),_0x370504[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x5935ac,null))['catch'](handleError(_0x5935ac,null));};exports[_0x7b2b('0x40')]=function(_0x349adf,_0x171bf8){return respondWithRpcPromise(_0x7b2b('0x3f'),_0x349adf['query'],routingClient)['then'](findById(_0x349adf[_0x7b2b('0x1a')]['id']))[_0x7b2b('0x1b')](respondWithResult(_0x171bf8,null))[_0x7b2b('0xb')](handleError(_0x171bf8,null));};exports[_0x7b2b('0x41')]=function(_0x52ed45,_0x3cee82){return respondWithRpcPromise('MailQueues',_0x52ed45[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x3cee82,null))['catch'](handleError(_0x3cee82,null));};exports[_0x7b2b('0x42')]=function(_0x485888,_0x46b385){return respondWithRpcPromise('MailQueues',_0x485888[_0x7b2b('0x16')],routingClient)['then'](findById(_0x485888[_0x7b2b('0x1a')]['id']))[_0x7b2b('0x1b')](respondWithResult(_0x46b385,null))[_0x7b2b('0xb')](handleError(_0x46b385,null));};exports[_0x7b2b('0x43')]=function(_0x2d72ce,_0x5a17a4){return respondWithRpcPromise('MailAccounts',_0x2d72ce[_0x7b2b('0x16')],mailClient)[_0x7b2b('0x1b')](respondWithResult(_0x5a17a4,null))['catch'](handleError(_0x5a17a4,null));};exports[_0x7b2b('0x44')]=function(_0x57dfdd,_0x231872){return respondWithRpcPromise('OpenchannelQueues',_0x57dfdd['query'],routingClient)['then'](respondWithResult(_0x231872,null))[_0x7b2b('0xb')](handleError(_0x231872,null));};exports[_0x7b2b('0x45')]=function(_0x2a648d,_0x5541c8){return respondWithRpcPromise(_0x7b2b('0x46'),_0x2a648d[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](findById(_0x2a648d['params']['id']))['then'](respondWithResult(_0x5541c8,null))[_0x7b2b('0xb')](handleError(_0x5541c8,null));};exports[_0x7b2b('0x47')]=function(_0x18b5da,_0x5a4c0d){return respondWithRpcPromise('SmsQueues',_0x18b5da[_0x7b2b('0x16')],routingClient)['then'](respondWithResult(_0x5a4c0d,null))[_0x7b2b('0xb')](handleError(_0x5a4c0d,null));};exports[_0x7b2b('0x48')]=function(_0x58f869,_0x29f5ce){return respondWithRpcPromise('SmsQueues',_0x58f869[_0x7b2b('0x16')],routingClient)['then'](findById(_0x58f869[_0x7b2b('0x1a')]['id']))[_0x7b2b('0x1b')](respondWithResult(_0x29f5ce,null))[_0x7b2b('0xb')](handleError(_0x29f5ce,null));};exports[_0x7b2b('0x49')]=function(_0x2837df,_0xf413b2){return respondWithRpcPromise(_0x7b2b('0x4a'),_0x2837df[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0xf413b2,null))[_0x7b2b('0xb')](handleError(_0xf413b2,null));};exports['showWhatsappQueues']=function(_0x2a4273,_0x2b2792){return respondWithRpcPromise(_0x7b2b('0x4a'),_0x2a4273[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](findById(_0x2a4273[_0x7b2b('0x1a')]['id']))[_0x7b2b('0x1b')](respondWithResult(_0x2b2792,null))[_0x7b2b('0xb')](handleError(_0x2b2792,null));};exports[_0x7b2b('0x4b')]=function(_0x271b3c,_0x213049){return respondWithRpcPromise(_0x7b2b('0x4c'),_0x271b3c[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x213049,null))[_0x7b2b('0xb')](handleError(_0x213049,null));};exports[_0x7b2b('0x4d')]=function(_0x15f0c0,_0x4e315f){return respondWithRpcPromise(_0x7b2b('0x4c'),_0x15f0c0['query'],routingClient)['then'](findById(_0x15f0c0[_0x7b2b('0x1a')]['id']))[_0x7b2b('0x1b')](respondWithResult(_0x4e315f,null))[_0x7b2b('0xb')](handleError(_0x4e315f,null));};exports['faxAccounts']=function(_0x452ffc,_0x263f09){return respondWithRpcPromise('FaxAccounts',_0x452ffc['query'])[_0x7b2b('0x1b')](respondWithResult(_0x263f09,null))[_0x7b2b('0xb')](handleError(_0x263f09,null));};exports[_0x7b2b('0x4e')]=function(_0x2e616f,_0x285a88){return respondWithRpcPromise(_0x7b2b('0x4f'),_0x2e616f['query'],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x285a88,null))[_0x7b2b('0xb')](handleError(_0x285a88,null));};exports[_0x7b2b('0x50')]=function(_0x35240d,_0x29e54c){return respondWithRpcPromise(_0x7b2b('0x51'),_0x35240d[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x29e54c,null))['catch'](handleError(_0x29e54c,null));};exports[_0x7b2b('0x52')]=function(_0x59b6c8,_0x524703){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x59b6c8['query'],routingClient)['then'](respondWithResult(_0x524703,null))[_0x7b2b('0xb')](handleError(_0x524703,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x1b8534,_0x52550e){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1b8534['query'],routingClient)[_0x7b2b('0x1b')](function(_0x4629ee){if(_0x1b8534['query'][_0x7b2b('0x53')]!==undefined){var _0x181342=_(_0x4629ee[_0x7b2b('0x12')])[_0x7b2b('0x54')]([_0x1b8534[_0x7b2b('0x16')][_0x7b2b('0x53')],_0x1b8534[_0x7b2b('0x1a')]['id']])[_0x7b2b('0x55')](_0x7b2b('0x56'))[_0x7b2b('0x57')]()['value']();return _0x4629ee[_0x7b2b('0x12')][_0x7b2b('0x54')](function(_0x5c6586){return _0x181342[_0x7b2b('0x58')](_0x5c6586[_0x7b2b('0x56')])>-0x1;});}else{return _0x4629ee[_0x7b2b('0x12')][_0x7b2b('0x54')](function(_0x535a2a){return _0x535a2a['queue_id']===parseInt(_0x1b8534['params']['id']);});}})[_0x7b2b('0x1b')](respondWithResult(_0x52550e,null))[_0x7b2b('0xb')](handleError(_0x52550e,null));};exports[_0x7b2b('0x59')]=function(_0x19c3c3,_0x33c264){return respondWithRpcPromise(_0x7b2b('0x5a'),_0x19c3c3['query'],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x33c264,null))[_0x7b2b('0xb')](handleError(_0x33c264,null));};exports[_0x7b2b('0x5b')]=function(_0x59fd5e,_0xba464e){return respondWithRpcPromise(_0x7b2b('0x5c'),_0x59fd5e[_0x7b2b('0x16')],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0xba464e,null))[_0x7b2b('0xb')](handleError(_0xba464e,null));};exports[_0x7b2b('0x5d')]=function(_0x219c40,_0x2ed438){return respondWithRpcPromise(_0x7b2b('0x5e'),_0x219c40['query'],routingClient)[_0x7b2b('0x1b')](respondWithResult(_0x2ed438,null))[_0x7b2b('0xb')](handleError(_0x2ed438,null));};exports['queueNotify']=function(_0x4bc291){return function(_0xfcb4d8,_0x38d708){var _0x2c52fd,_0x1df129;var _0x371929=_['capitalize'](_0x4bc291);var _0x426acf=_0x4bc291===_0x7b2b('0x5f')?_0x7b2b('0x60'):_0x7b2b('0x61');return db[_0x371929+'Queue'][_0x7b2b('0x62')]({'raw':!![],'where':{'id':_0xfcb4d8[_0x7b2b('0x1a')]['id']}})[_0x7b2b('0x1b')](function(_0x3e9b80){if(_[_0x7b2b('0x11')](_0x3e9b80)){throw new Error(_0x371929+_0x7b2b('0x63'));}_0x2c52fd=_0x3e9b80;return db[_0x371929+_0x7b2b('0x64')][_0x7b2b('0x62')]({'where':{'id':_0xfcb4d8[_0x7b2b('0x2d')][_0x7b2b('0x65')]},'include':[{'model':db[_0x371929+_0x7b2b('0x66')],'as':_0x7b2b('0x66')},{'model':db[_0x371929+_0x426acf],'as':_0x7b2b('0x61')}]});})[_0x7b2b('0x1b')](function(_0x367f19){if(_[_0x7b2b('0x11')](_0x367f19)){throw new Error(_0x371929+_0x7b2b('0x67'));}_0x1df129=_0x367f19;return _0x367f19[_0x7b2b('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b2b('0x1b')](function(){var _0x36bb56={'uniqueid':_0x4bc291+'.'+_0x1df129['id']+'.'+_0x1df129[_0x7b2b('0x66')]['id'],'FromUserId':_0xfcb4d8['user']['id'],'type':_0x7b2b('0x69')};_0x36bb56[_0x371929+_0x7b2b('0x6a')]=_0x1df129['id'];_0x36bb56[_0x371929+_0x7b2b('0x6b')]=_0x1df129[_0x7b2b('0x66')]['id'];_0x36bb56[_0x7b2b('0x6c')+_0x371929+_0x426acf+'Id']=_0x1df129['Account']['id'];_0x36bb56['To'+_0x371929+_0x7b2b('0x6d')]=_0x2c52fd['id'];return db[_0x371929+_0x7b2b('0x6e')][_0x7b2b('0x6f')](_0x36bb56);})['then'](function(){return respondWithRpcPromise(_0x7b2b('0x70'),{'channel':_0x4bc291,'interaction':_0x1df129[_0x7b2b('0x66')],'message':_0x1df129,'account':_0x1df129['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x7b2b('0x69'),'appdata':_0x2c52fd[_0x7b2b('0xf')]+','+(_0x1df129['Account'][_0x7b2b('0x71')]||0x12c),'interval':_0x7b2b('0x72')}]},routingClient);})[_0x7b2b('0x1b')](respondWithResult(_0x38d708,null))[_0x7b2b('0xb')](handleError(_0x38d708,null));};};exports['agentNotify']=function(_0x27f3de,_0x1dc9fb){var _0x3f899f,_0x770730;if(_[_0x7b2b('0x11')](_0x27f3de['body'][_0x7b2b('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x5f1a82=_0x27f3de[_0x7b2b('0x2d')][_0x7b2b('0x73')];var _0x536f81=_[_0x7b2b('0x74')](_0x5f1a82);var _0x2d9524=_0x5f1a82==='chat'?_0x7b2b('0x60'):'Account';return db[_0x7b2b('0x75')][_0x7b2b('0x62')]({'raw':!![],'where':{'id':_0x27f3de[_0x7b2b('0x1a')]['id'],'role':_0x7b2b('0x38')}})['then'](function(_0x21d138){if(_[_0x7b2b('0x11')](_0x21d138)){throw new Error(_0x7b2b('0x76'));}_0x3f899f=_0x21d138;return db[_0x536f81+'Message']['findOne']({'where':{'id':_0x27f3de[_0x7b2b('0x2d')][_0x7b2b('0x65')]},'include':[{'model':db[_0x536f81+_0x7b2b('0x66')],'as':_0x7b2b('0x66')},{'model':db[_0x536f81+_0x2d9524],'as':'Account'}]});})[_0x7b2b('0x1b')](function(_0x4cd4d3){if(_[_0x7b2b('0x11')](_0x4cd4d3)){throw new Error(_0x536f81+_0x7b2b('0x67'));}_0x770730=_0x4cd4d3;return _0x4cd4d3[_0x7b2b('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b2b('0x1b')](function(){var _0x5b3802={'uniqueid':_0x5f1a82+'.'+_0x770730['id']+'.'+_0x770730[_0x7b2b('0x66')]['id'],'FromUserId':_0x27f3de[_0x7b2b('0x2f')]['id'],'type':_0x7b2b('0x69'),'ToUserId':_0x3f899f['id']};_0x5b3802[_0x536f81+_0x7b2b('0x6a')]=_0x770730['id'];_0x5b3802[_0x536f81+_0x7b2b('0x6b')]=_0x770730[_0x7b2b('0x66')]['id'];_0x5b3802['From'+_0x536f81+_0x2d9524+'Id']=_0x770730[_0x7b2b('0x61')]['id'];return db[_0x536f81+_0x7b2b('0x6e')][_0x7b2b('0x6f')](_0x5b3802);})['then'](function(){return respondWithRpcPromise(_0x7b2b('0x70'),{'channel':_0x5f1a82,'interaction':_0x770730[_0x7b2b('0x66')],'message':_0x770730,'account':_0x770730[_0x7b2b('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3f899f[_0x7b2b('0xf')]+','+(_0x770730['Account'][_0x7b2b('0x77')]||0x12c),'interval':_0x7b2b('0x72')}]},routingClient);})[_0x7b2b('0x1b')](respondWithResult(_0x1dc9fb,null))[_0x7b2b('0xb')](handleError(_0x1dc9fb,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ba4ec28..da95c82 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 _0x6121=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/run','post','update','delete','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6121,0x1b3));var _0x1612=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6121[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x1612('0x0'));var util=require('util');var path=require(_0x1612('0x1'));var timeout=require('connect-timeout');var express=require(_0x1612('0x2'));var router=express[_0x1612('0x3')]();var auth=require(_0x1612('0x4'));var interaction=require(_0x1612('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x1612('0x6')]('/',auth[_0x1612('0x7')](),controller[_0x1612('0x8')]);router[_0x1612('0x6')](_0x1612('0x9'),auth[_0x1612('0x7')](),controller['show']);router[_0x1612('0x6')](_0x1612('0xa'),auth['isAuthenticated'](),controller['run']);router[_0x1612('0xb')]('/',auth[_0x1612('0x7')](),controller['create']);router['put'](_0x1612('0x9'),auth[_0x1612('0x7')](),controller[_0x1612('0xc')]);router[_0x1612('0xd')](_0x1612('0x9'),auth[_0x1612('0x7')](),controller['destroy']);module[_0x1612('0xe')]=router; \ No newline at end of file +var _0xb6a6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','run','put','/:id','update','delete','destroy','multer','util'];(function(_0x4a2854,_0x3a0b75){var _0xaf21e=function(_0x1fa2bd){while(--_0x1fa2bd){_0x4a2854['push'](_0x4a2854['shift']());}};_0xaf21e(++_0x3a0b75);}(_0xb6a6,0xfe));var _0x6b6a=function(_0xbedf9,_0xa224d8){_0xbedf9=_0xbedf9-0x0;var _0x28c2c7=_0xb6a6[_0xbedf9];return _0x28c2c7;};'use strict';var multer=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var path=require('path');var timeout=require(_0x6b6a('0x2'));var express=require(_0x6b6a('0x3'));var router=express[_0x6b6a('0x4')]();var auth=require(_0x6b6a('0x5'));var interaction=require(_0x6b6a('0x6'));var config=require(_0x6b6a('0x7'));var controller=require('./schedule.controller');router[_0x6b6a('0x8')]('/',auth[_0x6b6a('0x9')](),controller['index']);router['get']('/:id',auth[_0x6b6a('0x9')](),controller['show']);router[_0x6b6a('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x6b6a('0xa')]);router['post']('/',auth[_0x6b6a('0x9')](),controller['create']);router[_0x6b6a('0xb')](_0x6b6a('0xc'),auth[_0x6b6a('0x9')](),controller[_0x6b6a('0xd')]);router[_0x6b6a('0xe')](_0x6b6a('0xc'),auth[_0x6b6a('0x9')](),controller[_0x6b6a('0xf')]);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 c14485b..acb01c0 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 _0x723e=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','pdf','xlsx','csv','custom','default','TEXT','exports','STRING','BOOLEAN'];(function(_0x33c2bc,_0xc62ac4){var _0x3e5973=function(_0x251e1e){while(--_0x251e1e){_0x33c2bc['push'](_0x33c2bc['shift']());}};_0x3e5973(++_0xc62ac4);}(_0x723e,0x179));var _0xe723=function(_0x1f9e17,_0x127015){_0x1f9e17=_0x1f9e17-0x0;var _0x4fda50=_0x723e[_0x1f9e17];return _0x4fda50;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'name':{'type':Sequelize[_0xe723('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe723('0x1')]},'active':{'type':Sequelize[_0xe723('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe723('0x1')],'allowNull':![],'defaultValue':_0xe723('0x3')},'startAt':{'type':Sequelize[_0xe723('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe723('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe723('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe723('0x6')]('years',_0xe723('0x7'),_0xe723('0x8'),_0xe723('0x9'),_0xe723('0xa'),_0xe723('0xb'),_0xe723('0xc')),'allowNull':![],'defaultValue':_0xe723('0xa')},'output':{'type':Sequelize[_0xe723('0x6')]('csv',_0xe723('0xd'),_0xe723('0xe')),'allowNull':![],'defaultValue':_0xe723('0xf')},'type':{'type':Sequelize['ENUM'](_0xe723('0x10'),_0xe723('0x11')),'allowNull':![],'defaultValue':_0xe723('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe723('0x1')]},'cc':{'type':Sequelize[_0xe723('0x12')]},'bcc':{'type':Sequelize[_0xe723('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xe723('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xad5f=['csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xad5f,0x1a8));var _0xfad5=function(_0x1879a4,_0x581a4a){_0x1879a4=_0x1879a4-0x0;var _0x38e837=_0xad5f[_0x1879a4];return _0x38e837;};'use strict';var Sequelize=require(_0xfad5('0x0'));module[_0xfad5('0x1')]={'name':{'type':Sequelize[_0xfad5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xfad5('0x2')]},'active':{'type':Sequelize[_0xfad5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfad5('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfad5('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfad5('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfad5('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfad5('0x6')](_0xfad5('0x7'),_0xfad5('0x8'),_0xfad5('0x9'),'weeks',_0xfad5('0xa'),_0xfad5('0xb'),_0xfad5('0xc')),'allowNull':![],'defaultValue':_0xfad5('0xa')},'output':{'type':Sequelize['ENUM'](_0xfad5('0xd'),_0xfad5('0xe'),_0xfad5('0xf')),'allowNull':![],'defaultValue':_0xfad5('0xd')},'type':{'type':Sequelize[_0xfad5('0x6')](_0xfad5('0x10'),_0xfad5('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xfad5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfad5('0x2')]},'cc':{'type':Sequelize[_0xfad5('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b7ed866..16e9008 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 _0x3cfb=['to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','Scheduler','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x3cfb,0x187));var _0xb3cf=function(_0x5f159d,_0x209c87){_0x5f159d=_0x5f159d-0x0;var _0x3a46b7=_0x3cfb[_0x5f159d];return _0x3a46b7;};'use strict';var pdf=require(_0xb3cf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb3cf('0x1'));var zipdir=require(_0xb3cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3cf('0x3'));var moment=require(_0xb3cf('0x4'));var BPromise=require(_0xb3cf('0x5'));var Mustache=require(_0xb3cf('0x6'));var util=require(_0xb3cf('0x7'));var path=require('path');var sox=require(_0xb3cf('0x8'));var csv=require(_0xb3cf('0x9'));var ejs=require(_0xb3cf('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3cf('0xb'));var jsforce=require(_0xb3cf('0xc'));var deskjs=require(_0xb3cf('0xd'));var toCsv=require(_0xb3cf('0x9'));var querystring=require(_0xb3cf('0xe'));var Papa=require(_0xb3cf('0xf'));var Redis=require(_0xb3cf('0x10'));var authService=require(_0xb3cf('0x11'));var qs=require(_0xb3cf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3cf('0x13'))(_0xb3cf('0x14'));var utils=require('../../config/utils');var config=require(_0xb3cf('0x15'));var licenseUtil=require(_0xb3cf('0x16'));var db=require(_0xb3cf('0x17'))['db'];function respondWithStatusCode(_0x519a13,_0x238f99){_0x238f99=_0x238f99||0xcc;return function(_0x41ac4d){if(_0x41ac4d){return _0x519a13[_0xb3cf('0x18')](_0x238f99);}return _0x519a13[_0xb3cf('0x19')](_0x238f99)[_0xb3cf('0x1a')]();};}function respondWithResult(_0x17a879,_0x437889){_0x437889=_0x437889||0xc8;return function(_0x1c7a89){if(_0x1c7a89){return _0x17a879[_0xb3cf('0x19')](_0x437889)[_0xb3cf('0x1b')](_0x1c7a89);}};}function respondWithFilteredResult(_0x4c8fc1,_0x42594f){return function(_0x44ccf3){if(_0x44ccf3){var _0xeef1f6=_0x44ccf3[_0xb3cf('0x1c')],_0x10f972=_0x42594f[_0xb3cf('0x1d')],_0x6fc7cb=_0x42594f[_0xb3cf('0x1d')]+_0x42594f[_0xb3cf('0x1e')],_0x3c0d9;if(_0x6fc7cb>=_0xeef1f6){_0x6fc7cb=_0xeef1f6;_0x3c0d9=0xc8;}else{_0x3c0d9=0xce;}_0x4c8fc1[_0xb3cf('0x19')](_0x3c0d9);return _0x4c8fc1['set'](_0xb3cf('0x1f'),_0x10f972+'-'+_0x6fc7cb+'/'+_0xeef1f6)[_0xb3cf('0x1b')](_0x44ccf3);}return null;};}function patchUpdates(_0x428fed){return function(_0x56ffcc){try{jsonpatch['apply'](_0x56ffcc,_0x428fed,!![]);}catch(_0x1887b3){return BPromise[_0xb3cf('0x20')](_0x1887b3);}return _0x56ffcc[_0xb3cf('0x21')]();};}function saveUpdates(_0x44d707,_0xbc8f24){return function(_0x308779){if(_0x308779){return _0x308779[_0xb3cf('0x22')](_0x44d707)[_0xb3cf('0x23')](function(_0x388c23){return _0x388c23;});}return null;};}function removeEntity(_0x537a60,_0x35dde8){return function(_0x23e27a){if(_0x23e27a){return _0x23e27a[_0xb3cf('0x24')]()[_0xb3cf('0x23')](function(){var _0x205e27=_0x23e27a[_0xb3cf('0x25')]({'plain':!![]});var _0x1f8090=_0xb3cf('0x26');return db['UserProfileResource'][_0xb3cf('0x24')]({'where':{'type':_0x1f8090,'resourceId':_0x205e27['id']}})[_0xb3cf('0x23')](function(){return _0x23e27a;});})[_0xb3cf('0x23')](function(){_0x537a60[_0xb3cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5881ce,_0x47eecb){return function(_0x529832){if(!_0x529832){_0x5881ce['sendStatus'](0x194);}return _0x529832;};}function handleError(_0xf68dbc,_0x360ec6){_0x360ec6=_0x360ec6||0x1f4;return function(_0x213b85){logger[_0xb3cf('0x27')](_0x213b85['stack']);if(_0x213b85['name']){delete _0x213b85[_0xb3cf('0x28')];}_0xf68dbc[_0xb3cf('0x19')](_0x360ec6)[_0xb3cf('0x29')](_0x213b85);};}exports[_0xb3cf('0x2a')]=function(_0x540787,_0x5f5997){var _0x9643c0={},_0x4bf156={},_0x44ab30={'count':0x0,'rows':[]};var _0x1d9787=_[_0xb3cf('0x2b')](db[_0xb3cf('0x2c')][_0xb3cf('0x2d')],function(_0x227085){return{'name':_0x227085[_0xb3cf('0x2e')],'type':_0x227085[_0xb3cf('0x2f')][_0xb3cf('0x30')]};});_0x4bf156[_0xb3cf('0x31')]=_[_0xb3cf('0x2b')](_0x1d9787,_0xb3cf('0x28'));_0x4bf156['query']=_[_0xb3cf('0x32')](_0x540787[_0xb3cf('0x33')]);_0x4bf156[_0xb3cf('0x34')]=_['intersection'](_0x4bf156[_0xb3cf('0x31')],_0x4bf156[_0xb3cf('0x33')]);_0x9643c0[_0xb3cf('0x35')]=_[_0xb3cf('0x36')](_0x4bf156[_0xb3cf('0x31')],qs[_0xb3cf('0x37')](_0x540787['query'][_0xb3cf('0x37')]));_0x9643c0[_0xb3cf('0x35')]=_0x9643c0[_0xb3cf('0x35')][_0xb3cf('0x38')]?_0x9643c0[_0xb3cf('0x35')]:_0x4bf156[_0xb3cf('0x31')];if(!_0x540787[_0xb3cf('0x33')]['hasOwnProperty']('nolimit')){_0x9643c0[_0xb3cf('0x1e')]=qs[_0xb3cf('0x1e')](_0x540787[_0xb3cf('0x33')][_0xb3cf('0x1e')]);_0x9643c0[_0xb3cf('0x1d')]=qs[_0xb3cf('0x1d')](_0x540787[_0xb3cf('0x33')]['offset']);}_0x9643c0[_0xb3cf('0x39')]=qs[_0xb3cf('0x3a')](_0x540787['query']['sort']);_0x9643c0[_0xb3cf('0x3b')]=qs[_0xb3cf('0x34')](_[_0xb3cf('0x3c')](_0x540787[_0xb3cf('0x33')],_0x4bf156[_0xb3cf('0x34')]),_0x1d9787);if(_0x540787[_0xb3cf('0x33')]['filter']){_0x9643c0[_0xb3cf('0x3b')]=_[_0xb3cf('0x3d')](_0x9643c0[_0xb3cf('0x3b')],{'$or':_[_0xb3cf('0x2b')](_0x1d9787,function(_0x11e828){if(_0x11e828['type']!==_0xb3cf('0x3e')){var _0x44d569={};_0x44d569[_0x11e828['name']]={'$like':'%'+_0x540787[_0xb3cf('0x33')]['filter']+'%'};return _0x44d569;}})});}_0x9643c0=_[_0xb3cf('0x3d')]({},_0x9643c0,_0x540787['options']);var _0x1c84fc={'where':_0x9643c0[_0xb3cf('0x3b')]};return db['Schedule'][_0xb3cf('0x1c')](_0x1c84fc)[_0xb3cf('0x23')](function(_0x4f8df7){_0x44ab30[_0xb3cf('0x1c')]=_0x4f8df7;if(_0x540787['query'][_0xb3cf('0x3f')]){_0x9643c0[_0xb3cf('0x40')]=[{'all':!![]}];}return db[_0xb3cf('0x2c')][_0xb3cf('0x41')](_0x9643c0);})['then'](function(_0x414b80){_0x44ab30[_0xb3cf('0x42')]=_0x414b80;return _0x44ab30;})[_0xb3cf('0x23')](respondWithFilteredResult(_0x5f5997,_0x9643c0))[_0xb3cf('0x43')](handleError(_0x5f5997,null));};exports[_0xb3cf('0x44')]=function(_0x3a2dff,_0x2799af){var _0xc15d93={'raw':![],'where':{'id':_0x3a2dff[_0xb3cf('0x45')]['id']}},_0x33dd29={};_0x33dd29['model']=_[_0xb3cf('0x32')](db[_0xb3cf('0x2c')]['rawAttributes']);_0x33dd29[_0xb3cf('0x33')]=_[_0xb3cf('0x32')](_0x3a2dff[_0xb3cf('0x33')]);_0x33dd29['filters']=_[_0xb3cf('0x36')](_0x33dd29[_0xb3cf('0x31')],_0x33dd29['query']);_0xc15d93['attributes']=_[_0xb3cf('0x36')](_0x33dd29[_0xb3cf('0x31')],qs[_0xb3cf('0x37')](_0x3a2dff[_0xb3cf('0x33')][_0xb3cf('0x37')]));_0xc15d93[_0xb3cf('0x35')]=_0xc15d93[_0xb3cf('0x35')][_0xb3cf('0x38')]?_0xc15d93[_0xb3cf('0x35')]:_0x33dd29[_0xb3cf('0x31')];if(_0x3a2dff[_0xb3cf('0x33')]['includeAll']){_0xc15d93[_0xb3cf('0x40')]=[{'all':!![]}];}_0xc15d93=_[_0xb3cf('0x3d')]({},_0xc15d93,_0x3a2dff['options']);return db[_0xb3cf('0x2c')][_0xb3cf('0x46')](_0xc15d93)[_0xb3cf('0x23')](handleEntityNotFound(_0x2799af,null))['then'](respondWithResult(_0x2799af,null))[_0xb3cf('0x43')](handleError(_0x2799af,null));};exports[_0xb3cf('0x47')]=function(_0x49abb1,_0x1da464){return db['Schedule']['create'](_0x49abb1['body'],{})[_0xb3cf('0x23')](function(_0x1454b7){var _0x56755e=_0x49abb1[_0xb3cf('0x48')]['get']({'plain':!![]});if(!_0x56755e)throw new Error(_0xb3cf('0x49'));if(_0x56755e[_0xb3cf('0x4a')]==='user'){var _0x32f560=_0x1454b7['get']({'plain':!![]});var _0x30994e='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x30994e,'userProfileId':_0x56755e['userProfileId']},'raw':!![]})[_0xb3cf('0x23')](function(_0x759bb6){if(_0x759bb6&&_0x759bb6[_0xb3cf('0x4b')]===0x0){return db['UserProfileResource'][_0xb3cf('0x47')]({'name':_0x32f560[_0xb3cf('0x28')],'resourceId':_0x32f560['id'],'type':_0x759bb6[_0xb3cf('0x28')],'sectionId':_0x759bb6['id']},{})[_0xb3cf('0x23')](function(){return _0x1454b7;});}else{return _0x1454b7;}})['catch'](function(_0x2662d4){logger['error'](_0xb3cf('0x4c'),_0x2662d4);throw _0x2662d4;});}return _0x1454b7;})[_0xb3cf('0x23')](respondWithResult(_0x1da464,0xc9))[_0xb3cf('0x43')](handleError(_0x1da464,null));};exports[_0xb3cf('0x22')]=function(_0x26fa76,_0x40dcd1){if(_0x26fa76['body']['id']){delete _0x26fa76[_0xb3cf('0x4d')]['id'];}return db[_0xb3cf('0x2c')][_0xb3cf('0x46')]({'where':{'id':_0x26fa76[_0xb3cf('0x45')]['id']}})['then'](handleEntityNotFound(_0x40dcd1,null))[_0xb3cf('0x23')](saveUpdates(_0x26fa76[_0xb3cf('0x4d')],null))[_0xb3cf('0x23')](respondWithResult(_0x40dcd1,null))[_0xb3cf('0x43')](handleError(_0x40dcd1,null));};exports[_0xb3cf('0x24')]=function(_0x47993d,_0x19e5d5){return db[_0xb3cf('0x2c')]['find']({'where':{'id':_0x47993d[_0xb3cf('0x45')]['id']}})[_0xb3cf('0x23')](handleEntityNotFound(_0x19e5d5,null))['then'](removeEntity(_0x19e5d5,null))[_0xb3cf('0x43')](handleError(_0x19e5d5,null));};exports[_0xb3cf('0x4e')]=function(_0x51d120,_0x184a9a,_0x549c33){var _0x38e848=require(_0xb3cf('0x4f'));return db['Schedule'][_0xb3cf('0x46')]({'where':{'id':_0x51d120[_0xb3cf('0x45')]['id']},'raw':!![]})[_0xb3cf('0x23')](handleEntityNotFound(_0x184a9a,null))[_0xb3cf('0x23')](function(){_0x38e848['run'](_0x51d120[_0xb3cf('0x45')]['id']);})[_0xb3cf('0x23')](respondWithStatusCode(_0x184a9a,null))[_0xb3cf('0x43')](handleError(_0x184a9a,null));}; \ No newline at end of file +var _0xdc78=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','end','error','stack','send','index','Schedule','fieldName','type','key','model','map','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','keys','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv'];(function(_0x3e505c,_0x2f6e15){var _0x145e48=function(_0x56650d){while(--_0x56650d){_0x3e505c['push'](_0x3e505c['shift']());}};_0x145e48(++_0x2f6e15);}(_0xdc78,0x1e8));var _0x8dc7=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0xdc78[_0x4a29a9];return _0x386570;};'use strict';var pdf=require(_0x8dc7('0x0'));var emlformat=require(_0x8dc7('0x1'));var rimraf=require(_0x8dc7('0x2'));var zipdir=require(_0x8dc7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8dc7('0x4'));var moment=require('moment');var BPromise=require(_0x8dc7('0x5'));var Mustache=require(_0x8dc7('0x6'));var util=require(_0x8dc7('0x7'));var path=require('path');var sox=require(_0x8dc7('0x8'));var csv=require(_0x8dc7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8dc7('0xa'));var squel=require('squel');var crypto=require(_0x8dc7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8dc7('0xc'));var toCsv=require(_0x8dc7('0x9'));var querystring=require(_0x8dc7('0xd'));var Papa=require(_0x8dc7('0xe'));var Redis=require(_0x8dc7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8dc7('0x10'));var as=require(_0x8dc7('0x11'));var hardwareService=require(_0x8dc7('0x12'));var logger=require(_0x8dc7('0x13'))(_0x8dc7('0x14'));var utils=require(_0x8dc7('0x15'));var config=require(_0x8dc7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dc7('0x17'))['db'];function respondWithStatusCode(_0x22df46,_0x56d109){_0x56d109=_0x56d109||0xcc;return function(_0x35cb9e){if(_0x35cb9e){return _0x22df46[_0x8dc7('0x18')](_0x56d109);}return _0x22df46['status'](_0x56d109)['end']();};}function respondWithResult(_0x355256,_0x3ce27e){_0x3ce27e=_0x3ce27e||0xc8;return function(_0x225f69){if(_0x225f69){return _0x355256[_0x8dc7('0x19')](_0x3ce27e)['json'](_0x225f69);}};}function respondWithFilteredResult(_0x65c2a,_0x4ccec8){return function(_0x39bc4d){if(_0x39bc4d){var _0x1bf6a9=_0x39bc4d[_0x8dc7('0x1a')],_0x5df3f9=_0x4ccec8['offset'],_0x1957e6=_0x4ccec8[_0x8dc7('0x1b')]+_0x4ccec8[_0x8dc7('0x1c')],_0x5cf5a9;if(_0x1957e6>=_0x1bf6a9){_0x1957e6=_0x1bf6a9;_0x5cf5a9=0xc8;}else{_0x5cf5a9=0xce;}_0x65c2a['status'](_0x5cf5a9);return _0x65c2a['set'](_0x8dc7('0x1d'),_0x5df3f9+'-'+_0x1957e6+'/'+_0x1bf6a9)['json'](_0x39bc4d);}return null;};}function patchUpdates(_0x429bba){return function(_0x4563cb){try{jsonpatch[_0x8dc7('0x1e')](_0x4563cb,_0x429bba,!![]);}catch(_0x20921a){return BPromise[_0x8dc7('0x1f')](_0x20921a);}return _0x4563cb[_0x8dc7('0x20')]();};}function saveUpdates(_0x577fb7,_0x4669a2){return function(_0x12d7cd){if(_0x12d7cd){return _0x12d7cd[_0x8dc7('0x21')](_0x577fb7)[_0x8dc7('0x22')](function(_0x570a87){return _0x570a87;});}return null;};}function removeEntity(_0x188195,_0x20f274){return function(_0xd2f669){if(_0xd2f669){return _0xd2f669[_0x8dc7('0x23')]()['then'](function(){var _0xe48173=_0xd2f669[_0x8dc7('0x24')]({'plain':!![]});var _0x2efaa8=_0x8dc7('0x25');return db['UserProfileResource'][_0x8dc7('0x23')]({'where':{'type':_0x2efaa8,'resourceId':_0xe48173['id']}})['then'](function(){return _0xd2f669;});})[_0x8dc7('0x22')](function(){_0x188195[_0x8dc7('0x19')](0xcc)[_0x8dc7('0x26')]();});}};}function handleEntityNotFound(_0x50670f,_0x83093){return function(_0x20703a){if(!_0x20703a){_0x50670f[_0x8dc7('0x18')](0x194);}return _0x20703a;};}function handleError(_0x2bfd32,_0x32ee30){_0x32ee30=_0x32ee30||0x1f4;return function(_0x96a258){logger[_0x8dc7('0x27')](_0x96a258[_0x8dc7('0x28')]);if(_0x96a258['name']){delete _0x96a258['name'];}_0x2bfd32[_0x8dc7('0x19')](_0x32ee30)[_0x8dc7('0x29')](_0x96a258);};}exports[_0x8dc7('0x2a')]=function(_0x4f273e,_0x11e06b){var _0x24fab2={},_0x1ccc72={},_0x54a497={'count':0x0,'rows':[]};var _0x1760ac=_['map'](db[_0x8dc7('0x2b')]['rawAttributes'],function(_0x3dcfc5){return{'name':_0x3dcfc5[_0x8dc7('0x2c')],'type':_0x3dcfc5[_0x8dc7('0x2d')][_0x8dc7('0x2e')]};});_0x1ccc72[_0x8dc7('0x2f')]=_[_0x8dc7('0x30')](_0x1760ac,_0x8dc7('0x31'));_0x1ccc72['query']=_['keys'](_0x4f273e['query']);_0x1ccc72[_0x8dc7('0x32')]=_[_0x8dc7('0x33')](_0x1ccc72[_0x8dc7('0x2f')],_0x1ccc72[_0x8dc7('0x34')]);_0x24fab2[_0x8dc7('0x35')]=_['intersection'](_0x1ccc72[_0x8dc7('0x2f')],qs[_0x8dc7('0x36')](_0x4f273e[_0x8dc7('0x34')][_0x8dc7('0x36')]));_0x24fab2[_0x8dc7('0x35')]=_0x24fab2[_0x8dc7('0x35')][_0x8dc7('0x37')]?_0x24fab2['attributes']:_0x1ccc72[_0x8dc7('0x2f')];if(!_0x4f273e[_0x8dc7('0x34')][_0x8dc7('0x38')](_0x8dc7('0x39'))){_0x24fab2[_0x8dc7('0x1c')]=qs[_0x8dc7('0x1c')](_0x4f273e[_0x8dc7('0x34')][_0x8dc7('0x1c')]);_0x24fab2[_0x8dc7('0x1b')]=qs['offset'](_0x4f273e[_0x8dc7('0x34')][_0x8dc7('0x1b')]);}_0x24fab2[_0x8dc7('0x3a')]=qs[_0x8dc7('0x3b')](_0x4f273e['query'][_0x8dc7('0x3b')]);_0x24fab2[_0x8dc7('0x3c')]=qs[_0x8dc7('0x32')](_[_0x8dc7('0x3d')](_0x4f273e['query'],_0x1ccc72[_0x8dc7('0x32')]),_0x1760ac);if(_0x4f273e[_0x8dc7('0x34')][_0x8dc7('0x3e')]){_0x24fab2['where']=_['merge'](_0x24fab2[_0x8dc7('0x3c')],{'$or':_[_0x8dc7('0x30')](_0x1760ac,function(_0x142d36){if(_0x142d36[_0x8dc7('0x2d')]!=='VIRTUAL'){var _0x58d10c={};_0x58d10c[_0x142d36[_0x8dc7('0x31')]]={'$like':'%'+_0x4f273e[_0x8dc7('0x34')][_0x8dc7('0x3e')]+'%'};return _0x58d10c;}})});}_0x24fab2=_[_0x8dc7('0x3f')]({},_0x24fab2,_0x4f273e[_0x8dc7('0x40')]);var _0x41fdae={'where':_0x24fab2[_0x8dc7('0x3c')]};return db[_0x8dc7('0x2b')]['count'](_0x41fdae)['then'](function(_0x410cd2){_0x54a497[_0x8dc7('0x1a')]=_0x410cd2;if(_0x4f273e[_0x8dc7('0x34')]['includeAll']){_0x24fab2[_0x8dc7('0x41')]=[{'all':!![]}];}return db[_0x8dc7('0x2b')][_0x8dc7('0x42')](_0x24fab2);})[_0x8dc7('0x22')](function(_0x5b7ad4){_0x54a497['rows']=_0x5b7ad4;return _0x54a497;})[_0x8dc7('0x22')](respondWithFilteredResult(_0x11e06b,_0x24fab2))[_0x8dc7('0x43')](handleError(_0x11e06b,null));};exports[_0x8dc7('0x44')]=function(_0x1aa790,_0x215184){var _0x9756d={'raw':![],'where':{'id':_0x1aa790['params']['id']}},_0x1023d5={};_0x1023d5[_0x8dc7('0x2f')]=_[_0x8dc7('0x45')](db[_0x8dc7('0x2b')]['rawAttributes']);_0x1023d5['query']=_[_0x8dc7('0x45')](_0x1aa790[_0x8dc7('0x34')]);_0x1023d5['filters']=_[_0x8dc7('0x33')](_0x1023d5['model'],_0x1023d5['query']);_0x9756d[_0x8dc7('0x35')]=_['intersection'](_0x1023d5[_0x8dc7('0x2f')],qs[_0x8dc7('0x36')](_0x1aa790[_0x8dc7('0x34')][_0x8dc7('0x36')]));_0x9756d['attributes']=_0x9756d[_0x8dc7('0x35')][_0x8dc7('0x37')]?_0x9756d[_0x8dc7('0x35')]:_0x1023d5[_0x8dc7('0x2f')];if(_0x1aa790['query'][_0x8dc7('0x46')]){_0x9756d[_0x8dc7('0x41')]=[{'all':!![]}];}_0x9756d=_['merge']({},_0x9756d,_0x1aa790[_0x8dc7('0x40')]);return db[_0x8dc7('0x2b')][_0x8dc7('0x47')](_0x9756d)[_0x8dc7('0x22')](handleEntityNotFound(_0x215184,null))[_0x8dc7('0x22')](respondWithResult(_0x215184,null))[_0x8dc7('0x43')](handleError(_0x215184,null));};exports[_0x8dc7('0x48')]=function(_0x99b481,_0xa2c7f5){return db[_0x8dc7('0x2b')][_0x8dc7('0x48')](_0x99b481[_0x8dc7('0x49')],{})[_0x8dc7('0x22')](function(_0x436013){var _0x30fef7=_0x99b481[_0x8dc7('0x4a')][_0x8dc7('0x24')]({'plain':!![]});if(!_0x30fef7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30fef7[_0x8dc7('0x4b')]===_0x8dc7('0x4a')){var _0x5e4b94=_0x436013[_0x8dc7('0x24')]({'plain':!![]});var _0x1696ec='Scheduler';return db[_0x8dc7('0x4c')][_0x8dc7('0x47')]({'where':{'name':_0x1696ec,'userProfileId':_0x30fef7[_0x8dc7('0x4d')]},'raw':!![]})['then'](function(_0x46cf51){if(_0x46cf51&&_0x46cf51[_0x8dc7('0x4e')]===0x0){return db[_0x8dc7('0x4f')]['create']({'name':_0x5e4b94[_0x8dc7('0x31')],'resourceId':_0x5e4b94['id'],'type':_0x46cf51[_0x8dc7('0x31')],'sectionId':_0x46cf51['id']},{})[_0x8dc7('0x22')](function(){return _0x436013;});}else{return _0x436013;}})['catch'](function(_0xa04926){logger[_0x8dc7('0x27')](_0x8dc7('0x50'),_0xa04926);throw _0xa04926;});}return _0x436013;})[_0x8dc7('0x22')](respondWithResult(_0xa2c7f5,0xc9))[_0x8dc7('0x43')](handleError(_0xa2c7f5,null));};exports[_0x8dc7('0x21')]=function(_0x190e65,_0x2585f2){if(_0x190e65[_0x8dc7('0x49')]['id']){delete _0x190e65[_0x8dc7('0x49')]['id'];}return db[_0x8dc7('0x2b')][_0x8dc7('0x47')]({'where':{'id':_0x190e65[_0x8dc7('0x51')]['id']}})[_0x8dc7('0x22')](handleEntityNotFound(_0x2585f2,null))[_0x8dc7('0x22')](saveUpdates(_0x190e65[_0x8dc7('0x49')],null))[_0x8dc7('0x22')](respondWithResult(_0x2585f2,null))[_0x8dc7('0x43')](handleError(_0x2585f2,null));};exports[_0x8dc7('0x23')]=function(_0x21f9db,_0x27d81e){return db['Schedule'][_0x8dc7('0x47')]({'where':{'id':_0x21f9db[_0x8dc7('0x51')]['id']}})[_0x8dc7('0x22')](handleEntityNotFound(_0x27d81e,null))[_0x8dc7('0x22')](removeEntity(_0x27d81e,null))[_0x8dc7('0x43')](handleError(_0x27d81e,null));};exports[_0x8dc7('0x52')]=function(_0x51c741,_0x55fa54,_0x5b26dc){var _0x4260c5=require('../../config/schedule');return db['Schedule'][_0x8dc7('0x47')]({'where':{'id':_0x51c741[_0x8dc7('0x51')]['id']},'raw':!![]})[_0x8dc7('0x22')](handleEntityNotFound(_0x55fa54,null))[_0x8dc7('0x22')](function(){_0x4260c5[_0x8dc7('0x52')](_0x51c741[_0x8dc7('0x51')]['id']);})[_0x8dc7('0x22')](respondWithStatusCode(_0x55fa54,null))[_0x8dc7('0x43')](handleError(_0x55fa54,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 82d5b62..5b8eaf2 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 _0xb549=['bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','api'];(function(_0x11a4a8,_0x4eb10f){var _0x30dc6c=function(_0x59e1d4){while(--_0x59e1d4){_0x11a4a8['push'](_0x11a4a8['shift']());}};_0x30dc6c(++_0x4eb10f);}(_0xb549,0x1dd));var _0x9b54=function(_0x14593a,_0xdfefb7){_0x14593a=_0x14593a-0x0;var _0x330b92=_0xb549[_0x14593a];return _0x330b92;};'use strict';var _=require('lodash');var util=require(_0x9b54('0x0'));var logger=require(_0x9b54('0x1'))(_0x9b54('0x2'));var moment=require('moment');var BPromise=require(_0x9b54('0x3'));var rp=require(_0x9b54('0x4'));var fs=require('fs');var path=require(_0x9b54('0x5'));var rimraf=require('rimraf');var config=require(_0x9b54('0x6'));var attributes=require(_0x9b54('0x7'));module[_0x9b54('0x8')]=function(_0x43b03a,_0x4555d3){return _0x43b03a[_0x9b54('0x9')](_0x9b54('0xa'),attributes,{'tableName':_0x9b54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe47e=['moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','api'];(function(_0x1220dc,_0x448145){var _0x264ada=function(_0x171972){while(--_0x171972){_0x1220dc['push'](_0x1220dc['shift']());}};_0x264ada(++_0x448145);}(_0xe47e,0xa6));var _0xee47=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0xe47e[_0x207a02];return _0xd995c3;};'use strict';var _=require(_0xee47('0x0'));var util=require(_0xee47('0x1'));var logger=require('../../config/logger')(_0xee47('0x2'));var moment=require(_0xee47('0x3'));var BPromise=require(_0xee47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee47('0x5'));var rimraf=require(_0xee47('0x6'));var config=require(_0xee47('0x7'));var attributes=require(_0xee47('0x8'));module[_0xee47('0x9')]=function(_0x38739c,_0x70fd9e){return _0x38739c[_0xee47('0xa')](_0xee47('0xb'),attributes,{'tableName':_0xee47('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 b1385de..0833cdc 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 _0xe373=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch'];(function(_0x37655c,_0x1422ed){var _0x817126=function(_0x21124c){while(--_0x21124c){_0x37655c['push'](_0x37655c['shift']());}};_0x817126(++_0x1422ed);}(_0xe373,0x145));var _0x3e37=function(_0x43905b,_0x1d869f){_0x43905b=_0x43905b-0x0;var _0x320e10=_0xe373[_0x43905b];return _0x320e10;};'use strict';var _=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));var moment=require(_0x3e37('0x2'));var BPromise=require(_0x3e37('0x3'));var rs=require(_0x3e37('0x4'));var fs=require('fs');var Redis=require(_0x3e37('0x5'));var db=require(_0x3e37('0x6'))['db'];var utils=require(_0x3e37('0x7'));var logger=require(_0x3e37('0x8'))(_0x3e37('0x9'));var config=require(_0x3e37('0xa'));var jayson=require(_0x3e37('0xb'));var client=jayson[_0x3e37('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42f134,_0x2751ce,_0x59d9ed){return new BPromise(function(_0x3d61a3,_0x3da3d7){return client[_0x3e37('0xd')](_0x42f134,_0x59d9ed)['then'](function(_0x2ba43e){logger[_0x3e37('0xe')]('Schedule,\x20%s,\x20%s',_0x2751ce,_0x3e37('0xf'));logger[_0x3e37('0x10')](_0x3e37('0x11'),_0x2751ce,'request\x20sent',JSON[_0x3e37('0x12')](_0x2ba43e));if(_0x2ba43e[_0x3e37('0x13')]){if(_0x2ba43e[_0x3e37('0x13')][_0x3e37('0x14')]===0x1f4){logger[_0x3e37('0x13')](_0x3e37('0x15'),_0x2751ce,_0x2ba43e['error'][_0x3e37('0x16')]);return _0x3da3d7(_0x2ba43e[_0x3e37('0x13')][_0x3e37('0x16')]);}logger['error'](_0x3e37('0x15'),_0x2751ce,_0x2ba43e[_0x3e37('0x13')]['message']);return _0x3d61a3(_0x2ba43e['error']['message']);}else{logger[_0x3e37('0xe')](_0x3e37('0x15'),_0x2751ce,_0x3e37('0xf'));_0x3d61a3(_0x2ba43e[_0x3e37('0x17')][_0x3e37('0x16')]);}})[_0x3e37('0x18')](function(_0x337429){logger[_0x3e37('0x13')](_0x3e37('0x15'),_0x2751ce,_0x337429);_0x3da3d7(_0x337429);});});} \ No newline at end of file +var _0x754d=['../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x500665,_0x2f0853){var _0x3f2b77=function(_0x2b7733){while(--_0x2b7733){_0x500665['push'](_0x500665['shift']());}};_0x3f2b77(++_0x2f0853);}(_0x754d,0x8d));var _0xd754=function(_0x272eb7,_0x35b9d4){_0x272eb7=_0x272eb7-0x0;var _0x1cbc08=_0x754d[_0x272eb7];return _0x1cbc08;};'use strict';var _=require(_0xd754('0x0'));var util=require(_0xd754('0x1'));var moment=require(_0xd754('0x2'));var BPromise=require(_0xd754('0x3'));var rs=require(_0xd754('0x4'));var fs=require('fs');var Redis=require(_0xd754('0x5'));var db=require(_0xd754('0x6'))['db'];var utils=require(_0xd754('0x7'));var logger=require(_0xd754('0x8'))(_0xd754('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34ad93,_0x369233,_0x43131c){return new BPromise(function(_0x535197,_0x17232e){return client[_0xd754('0xa')](_0x34ad93,_0x43131c)[_0xd754('0xb')](function(_0x671037){logger['info'](_0xd754('0xc'),_0x369233,_0xd754('0xd'));logger[_0xd754('0xe')](_0xd754('0xf'),_0x369233,_0xd754('0xd'),JSON['stringify'](_0x671037));if(_0x671037[_0xd754('0x10')]){if(_0x671037[_0xd754('0x10')]['code']===0x1f4){logger['error'](_0xd754('0xc'),_0x369233,_0x671037[_0xd754('0x10')][_0xd754('0x11')]);return _0x17232e(_0x671037[_0xd754('0x10')][_0xd754('0x11')]);}logger[_0xd754('0x10')](_0xd754('0xc'),_0x369233,_0x671037[_0xd754('0x10')][_0xd754('0x11')]);return _0x535197(_0x671037[_0xd754('0x10')][_0xd754('0x11')]);}else{logger[_0xd754('0x12')](_0xd754('0xc'),_0x369233,'request\x20sent');_0x535197(_0x671037[_0xd754('0x13')][_0xd754('0x11')]);}})[_0xd754('0x14')](function(_0x4c6c9c){logger[_0xd754('0x10')](_0xd754('0xc'),_0x369233,_0x4c6c9c);_0x17232e(_0x4c6c9c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index bd2303d..2017fc7 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 _0xcd78=['describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x116a11,_0x419829){var _0x17792d=function(_0x38f296){while(--_0x38f296){_0x116a11['push'](_0x116a11['shift']());}};_0x17792d(++_0x419829);}(_0xcd78,0xf9));var _0x8cd7=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0xcd78[_0x2c1aa8];return _0x4019f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cd7('0x0'));var timeout=require(_0x8cd7('0x1'));var express=require(_0x8cd7('0x2'));var router=express['Router']();var auth=require(_0x8cd7('0x3'));var interaction=require(_0x8cd7('0x4'));var config=require(_0x8cd7('0x5'));var controller=require(_0x8cd7('0x6'));router[_0x8cd7('0x7')]('/',auth[_0x8cd7('0x8')](),controller[_0x8cd7('0x9')]);router['get'](_0x8cd7('0xa'),auth[_0x8cd7('0x8')](),controller[_0x8cd7('0xb')]);router['get'](_0x8cd7('0xc'),auth['isAuthenticated'](),controller[_0x8cd7('0xd')]);router['get']('/:id/download',auth[_0x8cd7('0x8')](),controller['download']);router['post']('/',auth[_0x8cd7('0x8')](),controller[_0x8cd7('0xe')]);router[_0x8cd7('0xf')](_0x8cd7('0xc'),auth[_0x8cd7('0x8')](),controller[_0x8cd7('0x10')]);router[_0x8cd7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8cd7('0x12')]);module[_0x8cd7('0x13')]=router; \ No newline at end of file +var _0x36e8=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','create'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0x36e8,0x10d));var _0x836e=function(_0xde371c,_0xc001b8){_0xde371c=_0xde371c-0x0;var _0x2e4cd5=_0x36e8[_0xde371c];return _0x2e4cd5;};'use strict';var multer=require(_0x836e('0x0'));var util=require(_0x836e('0x1'));var path=require(_0x836e('0x2'));var timeout=require(_0x836e('0x3'));var express=require('express');var router=express[_0x836e('0x4')]();var auth=require(_0x836e('0x5'));var interaction=require(_0x836e('0x6'));var config=require(_0x836e('0x7'));var controller=require(_0x836e('0x8'));router[_0x836e('0x9')]('/',auth[_0x836e('0xa')](),controller['index']);router[_0x836e('0x9')](_0x836e('0xb'),auth[_0x836e('0xa')](),controller[_0x836e('0xc')]);router[_0x836e('0x9')](_0x836e('0xd'),auth[_0x836e('0xa')](),controller[_0x836e('0xe')]);router['get'](_0x836e('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x836e('0x10')]);router[_0x836e('0x11')](_0x836e('0xd'),auth[_0x836e('0xa')](),controller[_0x836e('0x12')]);router[_0x836e('0x13')]('/:id',auth[_0x836e('0xa')](),controller[_0x836e('0x14')]);module[_0x836e('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 750f784..2eb2035 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 _0xa630=['sequelize','moment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x31a5fa,_0x4d19a7){var _0x3e2497=function(_0x1519ee){while(--_0x1519ee){_0x31a5fa['push'](_0x31a5fa['shift']());}};_0x3e2497(++_0x4d19a7);}(_0xa630,0xbe));var _0x0a63=function(_0x56b899,_0x5b17cf){_0x56b899=_0x56b899-0x0;var _0x3250de=_0xa630[_0x56b899];return _0x3250de;};'use strict';var Sequelize=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x0a63('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a63('0x3')]('value')?path[_0x0a63('0x4')](this[_0x0a63('0x3')](_0x0a63('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x0a63('0x6')]},'channel':{'type':Sequelize[_0x0a63('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2760b0){var _0x3d5f0b=_0x2760b0[_0x0a63('0x7')](/\\/g,'/');this[_0x0a63('0x8')](_0x0a63('0x5'),_0x3d5f0b);}},'rating':{'type':Sequelize[_0x0a63('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x688acd){this[_0x0a63('0x8')](_0x0a63('0xa'),moment()[_0x0a63('0xb')](_0x688acd,'ms'));this[_0x0a63('0x8')](_0x0a63('0xc'),moment());this[_0x0a63('0x8')](_0x0a63('0xd'),_0x688acd);}},'startedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')]('startedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'closedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this['getDataValue'](_0x0a63('0xc')))['format'](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'createdAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')](_0x0a63('0x12')))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a63('0x3')]('updatedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}}}; \ No newline at end of file +var _0x3eea=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path'];(function(_0x547bbf,_0x31144b){var _0x31f943=function(_0x11939b){while(--_0x11939b){_0x547bbf['push'](_0x547bbf['shift']());}};_0x31f943(++_0x31144b);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3e7504,_0x4716c3){_0x3e7504=_0x3e7504-0x0;var _0x5145b1=_0x3eea[_0x3e7504];return _0x5145b1;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');var path=require(_0xa3ee('0x1'));var config=require(_0xa3ee('0x2'));module[_0xa3ee('0x3')]={'format':{'type':Sequelize[_0xa3ee('0x4')],'get':function(){return this[_0xa3ee('0x5')](_0xa3ee('0x6'))?path[_0xa3ee('0x7')](this[_0xa3ee('0x5')](_0xa3ee('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa3ee('0x8')]},'channel':{'type':Sequelize[_0xa3ee('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x538bf9){var _0x4183ee=_0x538bf9['replace'](/\\/g,'/');this[_0xa3ee('0x9')]('value',_0x4183ee);}},'rating':{'type':Sequelize[_0xa3ee('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb1b96d){this['setDataValue'](_0xa3ee('0xb'),moment()[_0xa3ee('0xc')](_0xb1b96d,'ms'));this[_0xa3ee('0x9')]('closedAt',moment());this[_0xa3ee('0x9')](_0xa3ee('0xd'),_0xb1b96d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa3ee('0xb')))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')]('closedAt'))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'createdAt':{'type':Sequelize[_0xa3ee('0x11')],'get':function(){return moment(this['getDataValue'](_0xa3ee('0x12')))[_0xa3ee('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')](_0xa3ee('0x13')))[_0xa3ee('0xe')](_0xa3ee('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e598274..332d209 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 _0x2d3d=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','createdAt','closedAt','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','isNil','info'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x2d3d,0xcb));var _0xd2d3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2d3d[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd2d3('0x0'));var rimraf=require(_0xd2d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2d3('0x2'));var rp=require(_0xd2d3('0x3'));var moment=require(_0xd2d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2d3('0x5'));var util=require('util');var path=require(_0xd2d3('0x6'));var sox=require(_0xd2d3('0x7'));var csv=require(_0xd2d3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd2d3('0x9'));var squel=require(_0xd2d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd2d3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd2d3('0xc'));var Redis=require(_0xd2d3('0xd'));var authService=require(_0xd2d3('0xe'));var qs=require(_0xd2d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2d3('0x10'));var logger=require('../../config/logger')(_0xd2d3('0x11'));var utils=require(_0xd2d3('0x12'));var config=require(_0xd2d3('0x13'));var licenseUtil=require(_0xd2d3('0x14'));var db=require(_0xd2d3('0x15'))['db'];function respondWithStatusCode(_0x5cb4af,_0x3a3e31){_0x3a3e31=_0x3a3e31||0xcc;return function(_0x89bb00){if(_0x89bb00){return _0x5cb4af[_0xd2d3('0x16')](_0x3a3e31);}return _0x5cb4af['status'](_0x3a3e31)[_0xd2d3('0x17')]();};}function respondWithResult(_0x550f28,_0x1d405c){_0x1d405c=_0x1d405c||0xc8;return function(_0x1b8370){if(_0x1b8370){return _0x550f28[_0xd2d3('0x18')](_0x1d405c)[_0xd2d3('0x19')](_0x1b8370);}};}function respondWithFilteredResult(_0x217620,_0x3b0c4a){return function(_0x1d93d5){if(_0x1d93d5){var _0x49f1d3=_0x1d93d5[_0xd2d3('0x1a')],_0x333f07=_0x3b0c4a[_0xd2d3('0x1b')],_0x115c59=_0x3b0c4a['offset']+_0x3b0c4a[_0xd2d3('0x1c')],_0x51ee26;if(_0x115c59>=_0x49f1d3){_0x115c59=_0x49f1d3;_0x51ee26=0xc8;}else{_0x51ee26=0xce;}_0x217620['status'](_0x51ee26);return _0x217620[_0xd2d3('0x1d')](_0xd2d3('0x1e'),_0x333f07+'-'+_0x115c59+'/'+_0x49f1d3)[_0xd2d3('0x19')](_0x1d93d5);}return null;};}function patchUpdates(_0x2a6453){return function(_0x6cd19a){try{jsonpatch[_0xd2d3('0x1f')](_0x6cd19a,_0x2a6453,!![]);}catch(_0x3bb191){return BPromise[_0xd2d3('0x20')](_0x3bb191);}return _0x6cd19a['save']();};}function saveUpdates(_0x698d8,_0x28c147){return function(_0x234011){if(_0x234011){return _0x234011['update'](_0x698d8)[_0xd2d3('0x21')](function(_0x171fb7){return _0x171fb7;});}return null;};}function removeEntity(_0x1a0dbb,_0x3fe5fc){return function(_0x4c9d8d){if(_0x4c9d8d){return _0x4c9d8d[_0xd2d3('0x22')]()[_0xd2d3('0x21')](function(){_0x1a0dbb[_0xd2d3('0x18')](0xcc)[_0xd2d3('0x17')]();});}};}function handleEntityNotFound(_0x11e5df,_0x10aa2b){return function(_0x471afc){if(!_0x471afc){_0x11e5df[_0xd2d3('0x16')](0x194);}return _0x471afc;};}function handleError(_0x2fb56f,_0xc933db){_0xc933db=_0xc933db||0x1f4;return function(_0x56cd0a){logger[_0xd2d3('0x23')](_0x56cd0a[_0xd2d3('0x24')]);if(_0x56cd0a['name']){delete _0x56cd0a[_0xd2d3('0x25')];}_0x2fb56f[_0xd2d3('0x18')](_0xc933db)[_0xd2d3('0x26')](_0x56cd0a);};}exports[_0xd2d3('0x27')]=function(_0x23642b,_0xf40117){var _0x40f554={},_0x10b0c6={},_0x55650e={'count':0x0,'rows':[]};var _0x518ef2=_[_0xd2d3('0x28')](db[_0xd2d3('0x29')][_0xd2d3('0x2a')],function(_0xa50cf5){return{'name':_0xa50cf5['fieldName'],'type':_0xa50cf5[_0xd2d3('0x2b')][_0xd2d3('0x2c')]};});_0x10b0c6[_0xd2d3('0x2d')]=_[_0xd2d3('0x2e')](_['map'](_0x518ef2,_0xd2d3('0x25')),[_0xd2d3('0x2f')]);_0x10b0c6[_0xd2d3('0x30')]=_['keys'](_0x23642b[_0xd2d3('0x30')]);_0x10b0c6['filters']=_[_0xd2d3('0x31')](_0x10b0c6[_0xd2d3('0x2d')],_0x10b0c6[_0xd2d3('0x30')]);_0x40f554[_0xd2d3('0x32')]=_[_0xd2d3('0x31')](_0x10b0c6[_0xd2d3('0x2d')],qs[_0xd2d3('0x33')](_0x23642b[_0xd2d3('0x30')]['fields']));_0x40f554[_0xd2d3('0x32')]=_0x40f554[_0xd2d3('0x32')][_0xd2d3('0x34')]?_0x40f554[_0xd2d3('0x32')]:_0x10b0c6[_0xd2d3('0x2d')];if(!_0x23642b[_0xd2d3('0x30')][_0xd2d3('0x35')](_0xd2d3('0x36'))){_0x40f554[_0xd2d3('0x1c')]=qs[_0xd2d3('0x1c')](_0x23642b['query'][_0xd2d3('0x1c')]);_0x40f554[_0xd2d3('0x1b')]=qs[_0xd2d3('0x1b')](_0x23642b[_0xd2d3('0x30')][_0xd2d3('0x1b')]);}_0x40f554['order']=qs[_0xd2d3('0x37')](_0x23642b[_0xd2d3('0x30')][_0xd2d3('0x37')]);_0x40f554['where']=qs[_0xd2d3('0x38')](_['pick'](_0x23642b[_0xd2d3('0x30')],_0x10b0c6[_0xd2d3('0x38')]),_0x518ef2);if(_0x23642b[_0xd2d3('0x30')][_0xd2d3('0x39')]){_0x40f554[_0xd2d3('0x3a')]=_[_0xd2d3('0x3b')](_0x40f554[_0xd2d3('0x3a')],{'$or':_['map'](_0x518ef2,function(_0x36156b){if(_0x36156b['type']!==_0xd2d3('0x3c')){var _0x47b040={};_0x47b040[_0x36156b[_0xd2d3('0x25')]]={'$like':'%'+_0x23642b[_0xd2d3('0x30')]['filter']+'%'};return _0x47b040;}})});}_0x40f554=_[_0xd2d3('0x3b')]({},_0x40f554,_0x23642b[_0xd2d3('0x3d')]);var _0x3d30e4={'where':_0x40f554[_0xd2d3('0x3a')]};return db[_0xd2d3('0x29')][_0xd2d3('0x1a')](_0x3d30e4)[_0xd2d3('0x21')](function(_0x500448){_0x55650e[_0xd2d3('0x1a')]=_0x500448;if(_0x23642b[_0xd2d3('0x30')][_0xd2d3('0x3e')]){_0x40f554[_0xd2d3('0x3f')]=[{'all':!![]}];}return db[_0xd2d3('0x29')][_0xd2d3('0x40')](_0x40f554);})[_0xd2d3('0x21')](function(_0x41b486){_0x55650e['rows']=_0x41b486;return _0x55650e;})[_0xd2d3('0x21')](respondWithFilteredResult(_0xf40117,_0x40f554))[_0xd2d3('0x41')](handleError(_0xf40117,null));};exports[_0xd2d3('0x42')]=function(_0x4b93fe,_0x13e944){var _0x20d7d0={'raw':![],'where':{'id':_0x4b93fe[_0xd2d3('0x43')]['id']}},_0x4a6604={};_0x4a6604['model']=_[_0xd2d3('0x44')](db['ScreenRecording'][_0xd2d3('0x2a')]);_0x4a6604[_0xd2d3('0x30')]=_[_0xd2d3('0x44')](_0x4b93fe[_0xd2d3('0x30')]);_0x4a6604[_0xd2d3('0x38')]=_[_0xd2d3('0x31')](_0x4a6604[_0xd2d3('0x2d')],_0x4a6604[_0xd2d3('0x30')]);_0x20d7d0[_0xd2d3('0x32')]=_[_0xd2d3('0x31')](_0x4a6604[_0xd2d3('0x2d')],qs['fields'](_0x4b93fe[_0xd2d3('0x30')][_0xd2d3('0x33')]));_0x20d7d0[_0xd2d3('0x32')]=_0x20d7d0[_0xd2d3('0x32')][_0xd2d3('0x34')]?_0x20d7d0[_0xd2d3('0x32')]:_0x4a6604[_0xd2d3('0x2d')];if(_0x4b93fe[_0xd2d3('0x30')][_0xd2d3('0x3e')]){_0x20d7d0['include']=[{'all':!![]}];}_0x20d7d0=_[_0xd2d3('0x3b')]({},_0x20d7d0,_0x4b93fe[_0xd2d3('0x3d')]);return db[_0xd2d3('0x29')][_0xd2d3('0x45')](_0x20d7d0)['then'](handleEntityNotFound(_0x13e944,null))['then'](respondWithResult(_0x13e944,null))[_0xd2d3('0x41')](handleError(_0x13e944,null));};exports[_0xd2d3('0x46')]=function(_0x1a1b8b,_0x1f2245){return db[_0xd2d3('0x29')][_0xd2d3('0x46')](_0x1a1b8b[_0xd2d3('0x47')],{})[_0xd2d3('0x21')](respondWithResult(_0x1f2245,0xc9))['catch'](handleError(_0x1f2245,null));};exports[_0xd2d3('0x48')]=function(_0x591cfd,_0x55749a){if(_0x591cfd['body']['id']){delete _0x591cfd[_0xd2d3('0x47')]['id'];}delete _0x591cfd['body']['duration'];delete _0x591cfd['body'][_0xd2d3('0x49')];delete _0x591cfd[_0xd2d3('0x47')][_0xd2d3('0x4a')];delete _0x591cfd[_0xd2d3('0x47')]['value'];return db[_0xd2d3('0x29')]['find']({'where':{'id':_0x591cfd[_0xd2d3('0x43')]['id']}})[_0xd2d3('0x21')](handleEntityNotFound(_0x55749a,null))[_0xd2d3('0x21')](saveUpdates(_0x591cfd['body'],null))[_0xd2d3('0x21')](respondWithResult(_0x55749a,null))[_0xd2d3('0x41')](handleError(_0x55749a,null));};exports['describe']=function(_0x3879d5,_0x1dcd59){return db['ScreenRecording']['describe']()[_0xd2d3('0x21')](respondWithResult(_0x1dcd59,null))[_0xd2d3('0x41')](handleError(_0x1dcd59,null));};exports[_0xd2d3('0x4b')]=function(_0x5c7c4c,_0x1bacd1,_0x494b8d){var _0x312b4d=require(_0xd2d3('0x4c'));var _0x12a8a1=![];var _0x12cc4d={};if(_0x5c7c4c['query']['type']&&_0x5c7c4c[_0xd2d3('0x30')][_0xd2d3('0x2b')]===_0xd2d3('0x4d')){_0x12cc4d[_0xd2d3('0x4d')]=_0x5c7c4c[_0xd2d3('0x43')]['id'];}else{_0x12cc4d['id']=_0x5c7c4c[_0xd2d3('0x43')]['id'];}return db[_0xd2d3('0x29')][_0xd2d3('0x45')]({'where':_0x12cc4d,'attributes':['id',_0xd2d3('0x4e')],'raw':!![]})[_0xd2d3('0x21')](handleEntityNotFound(_0x1bacd1,null))[_0xd2d3('0x21')](function(_0x17c983){if(_0x17c983){var _0x3bd171=path[_0xd2d3('0x4f')](config['root'],_0xd2d3('0x50'),_0x17c983[_0xd2d3('0x4e')]);var _0x176310=util[_0xd2d3('0x2f')]('%s.cypher',_0x3bd171);if(fs[_0xd2d3('0x51')](_0x176310)){_0x12a8a1=!![];return _0x312b4d[_0xd2d3('0x52')](_0x176310,_0x3bd171,config[_0xd2d3('0x53')][_0xd2d3('0x54')])[_0xd2d3('0x21')](function(){return _0x17c983;});}return _0x17c983;}})['then'](function(_0x189589){if(_0x189589){var _0x303760=path[_0xd2d3('0x4f')](config[_0xd2d3('0x55')],_0xd2d3('0x50'),_0x189589[_0xd2d3('0x4e')]);if(!fs[_0xd2d3('0x51')](_0x303760)){throw new db[(_0xd2d3('0x56'))][(_0xd2d3('0x57'))](_0xd2d3('0x58'));}if(_0x189589['filename']){return _0x1bacd1[_0xd2d3('0x4b')](_0x303760,_0x189589[_0xd2d3('0x59')]+path[_0xd2d3('0x5a')](_0x303760),function(){if(_0x12a8a1){fs[_0xd2d3('0x5b')](_0x303760);}});}else{return _0x1bacd1['download'](_0x303760,function(_0x355de9){if(_0x12a8a1){fs[_0xd2d3('0x5b')](_0x303760);}});}}})['catch'](function(_0x5c97b0){if(_0x5c97b0[_0xd2d3('0x5c')]==='ScreenRecording\x20not\x20found'){_0x1bacd1['status'](0x194)[_0xd2d3('0x26')](_0xd2d3('0x5d'));}else{return handleError(_0x1bacd1,null);}});};exports[_0xd2d3('0x22')]=function(_0x29640f,_0x18bae0){return db[_0xd2d3('0x29')][_0xd2d3('0x45')]({'where':{'id':_0x29640f[_0xd2d3('0x43')]['id']}})['then'](function(_0x261be7){if(!_0x261be7)throw new ReferenceError(_0xd2d3('0x5e'));return _0x261be7;})[_0xd2d3('0x21')](function(_0x48ae23){var _0x5785bc=path[_0xd2d3('0x4f')](config[_0xd2d3('0x55')],'server/files/screen_recordings',_0x48ae23[_0xd2d3('0x4e')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5785bc);if(!_[_0xd2d3('0x5f')](_0x48ae23[_0xd2d3('0x4e')])&&fs['existsSync'](_0x5785bc)){logger[_0xd2d3('0x60')]('File:\x20\x22'+_0x5785bc+_0xd2d3('0x61'));fs[_0xd2d3('0x62')](_0x5785bc);}_0x5785bc=_0x5785bc+'.cypher';if(!_[_0xd2d3('0x5f')](_0x48ae23['value'])&&fs[_0xd2d3('0x51')](_0x5785bc)){logger[_0xd2d3('0x60')](_0xd2d3('0x63')+_0x5785bc+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd2d3('0x62')](_0x5785bc);}return _0x48ae23;})[_0xd2d3('0x21')](function(_0x141198){if(!_0x141198)throw new InternalError();return _0x141198[_0xd2d3('0x22')]();})['then'](function(){_0x18bae0[_0xd2d3('0x18')](0xcc)[_0xd2d3('0x17')]();})[_0xd2d3('0x41')](handleError(_0x18bae0,null));}; \ No newline at end of file +var _0x3c4d=['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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','find','catch','create','body','duration','closedAt','value','describe','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','filename','download','unlink','Not\x20found','destroy','params','Entity\x20not\x20found','root','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','eml-format','rimraf','zip-dir','moment'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x3c4d,0x18b));var _0xd3c4=function(_0x23bd0c,_0x3afa82){_0x23bd0c=_0x23bd0c-0x0;var _0x21bbfe=_0x3c4d[_0x23bd0c];return _0x21bbfe;};'use strict';var pdf=require(_0xd3c4('0x0'));var emlformat=require(_0xd3c4('0x1'));var rimraf=require(_0xd3c4('0x2'));var zipdir=require(_0xd3c4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd3c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd3c4('0x5'));var util=require(_0xd3c4('0x6'));var path=require(_0xd3c4('0x7'));var sox=require(_0xd3c4('0x8'));var csv=require('to-csv');var ejs=require(_0xd3c4('0x9'));var fs=require('fs');var _=require(_0xd3c4('0xa'));var squel=require(_0xd3c4('0xb'));var crypto=require(_0xd3c4('0xc'));var jsforce=require(_0xd3c4('0xd'));var deskjs=require(_0xd3c4('0xe'));var toCsv=require(_0xd3c4('0xf'));var querystring=require(_0xd3c4('0x10'));var Papa=require(_0xd3c4('0x11'));var Redis=require(_0xd3c4('0x12'));var authService=require(_0xd3c4('0x13'));var qs=require(_0xd3c4('0x14'));var as=require(_0xd3c4('0x15'));var hardwareService=require(_0xd3c4('0x16'));var logger=require(_0xd3c4('0x17'))('api');var utils=require(_0xd3c4('0x18'));var config=require(_0xd3c4('0x19'));var licenseUtil=require(_0xd3c4('0x1a'));var db=require(_0xd3c4('0x1b'))['db'];function respondWithStatusCode(_0x2bf5b7,_0x5724ba){_0x5724ba=_0x5724ba||0xcc;return function(_0x46f21e){if(_0x46f21e){return _0x2bf5b7[_0xd3c4('0x1c')](_0x5724ba);}return _0x2bf5b7[_0xd3c4('0x1d')](_0x5724ba)[_0xd3c4('0x1e')]();};}function respondWithResult(_0x5e46eb,_0x5c9868){_0x5c9868=_0x5c9868||0xc8;return function(_0x5d7db1){if(_0x5d7db1){return _0x5e46eb[_0xd3c4('0x1d')](_0x5c9868)[_0xd3c4('0x1f')](_0x5d7db1);}};}function respondWithFilteredResult(_0xcc1ab6,_0x2b232c){return function(_0x102c03){if(_0x102c03){var _0x8468de=_0x102c03[_0xd3c4('0x20')],_0x2c66fc=_0x2b232c[_0xd3c4('0x21')],_0x489f0b=_0x2b232c[_0xd3c4('0x21')]+_0x2b232c[_0xd3c4('0x22')],_0x3e92ff;if(_0x489f0b>=_0x8468de){_0x489f0b=_0x8468de;_0x3e92ff=0xc8;}else{_0x3e92ff=0xce;}_0xcc1ab6['status'](_0x3e92ff);return _0xcc1ab6[_0xd3c4('0x23')]('Content-Range',_0x2c66fc+'-'+_0x489f0b+'/'+_0x8468de)[_0xd3c4('0x1f')](_0x102c03);}return null;};}function patchUpdates(_0x59adfa){return function(_0x317eec){try{jsonpatch[_0xd3c4('0x24')](_0x317eec,_0x59adfa,!![]);}catch(_0x1b207b){return BPromise[_0xd3c4('0x25')](_0x1b207b);}return _0x317eec[_0xd3c4('0x26')]();};}function saveUpdates(_0x992556,_0x43b8c9){return function(_0x25c305){if(_0x25c305){return _0x25c305[_0xd3c4('0x27')](_0x992556)[_0xd3c4('0x28')](function(_0x7d2e5){return _0x7d2e5;});}return null;};}function removeEntity(_0x2ae577,_0x1333e7){return function(_0x58ae73){if(_0x58ae73){return _0x58ae73['destroy']()['then'](function(){_0x2ae577[_0xd3c4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d9b8,_0x39f793){return function(_0x36ffe8){if(!_0x36ffe8){_0x53d9b8[_0xd3c4('0x1c')](0x194);}return _0x36ffe8;};}function handleError(_0x2436cb,_0xa7ea46){_0xa7ea46=_0xa7ea46||0x1f4;return function(_0x37dbdd){logger['error'](_0x37dbdd[_0xd3c4('0x29')]);if(_0x37dbdd[_0xd3c4('0x2a')]){delete _0x37dbdd[_0xd3c4('0x2a')];}_0x2436cb[_0xd3c4('0x1d')](_0xa7ea46)[_0xd3c4('0x2b')](_0x37dbdd);};}exports[_0xd3c4('0x2c')]=function(_0x6023ac,_0x4e93b3){var _0x3f2450={},_0x167fab={},_0x1c0fbd={'count':0x0,'rows':[]};var _0x362b58=_[_0xd3c4('0x2d')](db['ScreenRecording'][_0xd3c4('0x2e')],function(_0x5a62eb){return{'name':_0x5a62eb[_0xd3c4('0x2f')],'type':_0x5a62eb[_0xd3c4('0x30')]['key']};});_0x167fab[_0xd3c4('0x31')]=_[_0xd3c4('0x32')](_[_0xd3c4('0x2d')](_0x362b58,'name'),[_0xd3c4('0x33')]);_0x167fab[_0xd3c4('0x34')]=_['keys'](_0x6023ac[_0xd3c4('0x34')]);_0x167fab['filters']=_[_0xd3c4('0x35')](_0x167fab[_0xd3c4('0x31')],_0x167fab[_0xd3c4('0x34')]);_0x3f2450[_0xd3c4('0x36')]=_[_0xd3c4('0x35')](_0x167fab['model'],qs[_0xd3c4('0x37')](_0x6023ac['query'][_0xd3c4('0x37')]));_0x3f2450[_0xd3c4('0x36')]=_0x3f2450[_0xd3c4('0x36')][_0xd3c4('0x38')]?_0x3f2450[_0xd3c4('0x36')]:_0x167fab[_0xd3c4('0x31')];if(!_0x6023ac[_0xd3c4('0x34')][_0xd3c4('0x39')](_0xd3c4('0x3a'))){_0x3f2450[_0xd3c4('0x22')]=qs[_0xd3c4('0x22')](_0x6023ac[_0xd3c4('0x34')]['limit']);_0x3f2450[_0xd3c4('0x21')]=qs[_0xd3c4('0x21')](_0x6023ac[_0xd3c4('0x34')]['offset']);}_0x3f2450[_0xd3c4('0x3b')]=qs[_0xd3c4('0x3c')](_0x6023ac[_0xd3c4('0x34')][_0xd3c4('0x3c')]);_0x3f2450[_0xd3c4('0x3d')]=qs['filters'](_['pick'](_0x6023ac[_0xd3c4('0x34')],_0x167fab[_0xd3c4('0x3e')]),_0x362b58);if(_0x6023ac[_0xd3c4('0x34')][_0xd3c4('0x3f')]){_0x3f2450[_0xd3c4('0x3d')]=_[_0xd3c4('0x40')](_0x3f2450[_0xd3c4('0x3d')],{'$or':_[_0xd3c4('0x2d')](_0x362b58,function(_0x13dd63){if(_0x13dd63[_0xd3c4('0x30')]!==_0xd3c4('0x41')){var _0x2fc96b={};_0x2fc96b[_0x13dd63[_0xd3c4('0x2a')]]={'$like':'%'+_0x6023ac[_0xd3c4('0x34')]['filter']+'%'};return _0x2fc96b;}})});}_0x3f2450=_['merge']({},_0x3f2450,_0x6023ac[_0xd3c4('0x42')]);var _0x409fdb={'where':_0x3f2450['where']};return db[_0xd3c4('0x43')][_0xd3c4('0x20')](_0x409fdb)[_0xd3c4('0x28')](function(_0x46b0a8){_0x1c0fbd[_0xd3c4('0x20')]=_0x46b0a8;if(_0x6023ac[_0xd3c4('0x34')][_0xd3c4('0x44')]){_0x3f2450[_0xd3c4('0x45')]=[{'all':!![]}];}return db[_0xd3c4('0x43')][_0xd3c4('0x46')](_0x3f2450);})[_0xd3c4('0x28')](function(_0x21b264){_0x1c0fbd[_0xd3c4('0x47')]=_0x21b264;return _0x1c0fbd;})['then'](respondWithFilteredResult(_0x4e93b3,_0x3f2450))['catch'](handleError(_0x4e93b3,null));};exports[_0xd3c4('0x48')]=function(_0x48f60f,_0x8bf098){var _0x2ef894={'raw':![],'where':{'id':_0x48f60f['params']['id']}},_0x321ca7={};_0x321ca7[_0xd3c4('0x31')]=_['keys'](db[_0xd3c4('0x43')][_0xd3c4('0x2e')]);_0x321ca7['query']=_['keys'](_0x48f60f[_0xd3c4('0x34')]);_0x321ca7[_0xd3c4('0x3e')]=_[_0xd3c4('0x35')](_0x321ca7[_0xd3c4('0x31')],_0x321ca7[_0xd3c4('0x34')]);_0x2ef894[_0xd3c4('0x36')]=_[_0xd3c4('0x35')](_0x321ca7['model'],qs[_0xd3c4('0x37')](_0x48f60f['query'][_0xd3c4('0x37')]));_0x2ef894[_0xd3c4('0x36')]=_0x2ef894['attributes']['length']?_0x2ef894[_0xd3c4('0x36')]:_0x321ca7[_0xd3c4('0x31')];if(_0x48f60f[_0xd3c4('0x34')][_0xd3c4('0x44')]){_0x2ef894['include']=[{'all':!![]}];}_0x2ef894=_[_0xd3c4('0x40')]({},_0x2ef894,_0x48f60f['options']);return db[_0xd3c4('0x43')][_0xd3c4('0x49')](_0x2ef894)['then'](handleEntityNotFound(_0x8bf098,null))[_0xd3c4('0x28')](respondWithResult(_0x8bf098,null))[_0xd3c4('0x4a')](handleError(_0x8bf098,null));};exports[_0xd3c4('0x4b')]=function(_0xae7c19,_0x352e2f){return db[_0xd3c4('0x43')][_0xd3c4('0x4b')](_0xae7c19['body'],{})['then'](respondWithResult(_0x352e2f,0xc9))[_0xd3c4('0x4a')](handleError(_0x352e2f,null));};exports['update']=function(_0x4407a5,_0xcef938){if(_0x4407a5[_0xd3c4('0x4c')]['id']){delete _0x4407a5[_0xd3c4('0x4c')]['id'];}delete _0x4407a5[_0xd3c4('0x4c')][_0xd3c4('0x4d')];delete _0x4407a5[_0xd3c4('0x4c')]['createdAt'];delete _0x4407a5['body'][_0xd3c4('0x4e')];delete _0x4407a5[_0xd3c4('0x4c')][_0xd3c4('0x4f')];return db[_0xd3c4('0x43')][_0xd3c4('0x49')]({'where':{'id':_0x4407a5['params']['id']}})['then'](handleEntityNotFound(_0xcef938,null))[_0xd3c4('0x28')](saveUpdates(_0x4407a5['body'],null))[_0xd3c4('0x28')](respondWithResult(_0xcef938,null))[_0xd3c4('0x4a')](handleError(_0xcef938,null));};exports[_0xd3c4('0x50')]=function(_0x21931f,_0x196107){return db['ScreenRecording'][_0xd3c4('0x50')]()['then'](respondWithResult(_0x196107,null))[_0xd3c4('0x4a')](handleError(_0x196107,null));};exports['download']=function(_0x5ef0f3,_0x110552,_0x4b52c0){var _0x34528f=require('../../components/encryptor');var _0xc735ac=![];var _0x16a39e={};if(_0x5ef0f3[_0xd3c4('0x34')][_0xd3c4('0x30')]&&_0x5ef0f3[_0xd3c4('0x34')]['type']===_0xd3c4('0x51')){_0x16a39e[_0xd3c4('0x51')]=_0x5ef0f3['params']['id'];}else{_0x16a39e['id']=_0x5ef0f3['params']['id'];}return db[_0xd3c4('0x43')][_0xd3c4('0x49')]({'where':_0x16a39e,'attributes':['id',_0xd3c4('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x110552,null))[_0xd3c4('0x28')](function(_0xd9f223){if(_0xd9f223){var _0x4d9ebc=path[_0xd3c4('0x52')](config['root'],_0xd3c4('0x53'),_0xd9f223['value']);var _0x3dee07=util[_0xd3c4('0x33')](_0xd3c4('0x54'),_0x4d9ebc);if(fs['existsSync'](_0x3dee07)){_0xc735ac=!![];return _0x34528f['decryptFile'](_0x3dee07,_0x4d9ebc,config['secrets']['recording'])[_0xd3c4('0x28')](function(){return _0xd9f223;});}return _0xd9f223;}})[_0xd3c4('0x28')](function(_0x303eba){if(_0x303eba){var _0x504038=path[_0xd3c4('0x52')](config['root'],_0xd3c4('0x53'),_0x303eba[_0xd3c4('0x4f')]);if(!fs[_0xd3c4('0x55')](_0x504038)){throw new db[(_0xd3c4('0x56'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x303eba[_0xd3c4('0x57')]){return _0x110552[_0xd3c4('0x58')](_0x504038,_0x303eba['filename']+path['extname'](_0x504038),function(){if(_0xc735ac){fs[_0xd3c4('0x59')](_0x504038);}});}else{return _0x110552[_0xd3c4('0x58')](_0x504038,function(_0x34a0e0){if(_0xc735ac){fs['unlink'](_0x504038);}});}}})[_0xd3c4('0x4a')](function(_0x358a94){if(_0x358a94['message']==='ScreenRecording\x20not\x20found'){_0x110552['status'](0x194)[_0xd3c4('0x2b')](_0xd3c4('0x5a'));}else{return handleError(_0x110552,null);}});};exports[_0xd3c4('0x5b')]=function(_0x99eebd,_0x240410){return db[_0xd3c4('0x43')][_0xd3c4('0x49')]({'where':{'id':_0x99eebd[_0xd3c4('0x5c')]['id']}})['then'](function(_0x3fc3bc){if(!_0x3fc3bc)throw new ReferenceError(_0xd3c4('0x5d'));return _0x3fc3bc;})[_0xd3c4('0x28')](function(_0x836b59){var _0x24706e=path[_0xd3c4('0x52')](config[_0xd3c4('0x5e')],'server/files/screen_recordings',_0x836b59[_0xd3c4('0x4f')]);logger[_0xd3c4('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x24706e);if(!_['isNil'](_0x836b59['value'])&&fs[_0xd3c4('0x55')](_0x24706e)){logger[_0xd3c4('0x5f')](_0xd3c4('0x60')+_0x24706e+_0xd3c4('0x61'));fs[_0xd3c4('0x62')](_0x24706e);}_0x24706e=_0x24706e+'.cypher';if(!_[_0xd3c4('0x63')](_0x836b59['value'])&&fs[_0xd3c4('0x55')](_0x24706e)){logger['info']('File:\x20\x22'+_0x24706e+_0xd3c4('0x61'));fs[_0xd3c4('0x62')](_0x24706e);}return _0x836b59;})[_0xd3c4('0x28')](function(_0x517473){if(!_0x517473)throw new InternalError();return _0x517473[_0xd3c4('0x5b')]();})[_0xd3c4('0x28')](function(){_0x240410['status'](0xcc)[_0xd3c4('0x1e')]();})[_0xd3c4('0x4a')](handleError(_0x240410,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bef6997..950d403 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 _0xc424=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0xc424,0xe3));var _0x4c42=function(_0x5108b1,_0x3906b1){_0x5108b1=_0x5108b1-0x0;var _0x5398ad=_0xc424[_0x5108b1];return _0x5398ad;};'use strict';var _=require(_0x4c42('0x0'));var util=require(_0x4c42('0x1'));var logger=require(_0x4c42('0x2'))(_0x4c42('0x3'));var moment=require(_0x4c42('0x4'));var BPromise=require(_0x4c42('0x5'));var rp=require(_0x4c42('0x6'));var fs=require('fs');var path=require(_0x4c42('0x7'));var rimraf=require(_0x4c42('0x8'));var config=require(_0x4c42('0x9'));var attributes=require(_0x4c42('0xa'));module['exports']=function(_0x49aca3,_0x3283c7){return _0x49aca3[_0x4c42('0xb')](_0x4c42('0xc'),attributes,{'tableName':_0x4c42('0xd'),'paranoid':![],'indexes':[{'name':_0x4c42('0xe'),'fields':[_0x4c42('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf9=['../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xdbf9,0x6f));var _0x9dbf=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xdbf9[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x9dbf('0x0'));var util=require(_0x9dbf('0x1'));var logger=require(_0x9dbf('0x2'))(_0x9dbf('0x3'));var moment=require(_0x9dbf('0x4'));var BPromise=require(_0x9dbf('0x5'));var rp=require(_0x9dbf('0x6'));var fs=require('fs');var path=require(_0x9dbf('0x7'));var rimraf=require(_0x9dbf('0x8'));var config=require(_0x9dbf('0x9'));var attributes=require(_0x9dbf('0xa'));module[_0x9dbf('0xb')]=function(_0x38f7b0,_0x212ec9){return _0x38f7b0['define'](_0x9dbf('0xc'),attributes,{'tableName':_0x9dbf('0xd'),'paranoid':![],'indexes':[{'name':_0x9dbf('0xe'),'fields':[_0x9dbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 50fdd45..0e3ffb4 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(_0x2929d4,_0x584696){var _0x33c8d4=function(_0x2da15f){while(--_0x2da15f){_0x2929d4['push'](_0x2929d4['shift']());}};_0x33c8d4(++_0x584696);}(_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);});});} \ 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(_0x453583,_0x55bdc4){var _0x23c36c=function(_0x4ee51e){while(--_0x4ee51e){_0x453583['push'](_0x453583['shift']());}};_0x23c36c(++_0x55bdc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 cfb0b79..3cdd210 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 _0x5f9f=['logologin','file','addLogoLogin','/:id/preferred','addPreferred','favicon','/:id/favicon','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getFavicon','diskStorage','join','root','server/files/images/logos/','format','extname','originalname','post','single','addLogo','%s%s'];(function(_0x52f516,_0x12894c){var _0x2f8695=function(_0x26b1d9){while(--_0x26b1d9){_0x52f516['push'](_0x52f516['shift']());}};_0x2f8695(++_0x12894c);}(_0x5f9f,0x81));var _0xf5f9=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x5f9f[_0x521929];return _0x632436;};'use strict';var multer=require(_0xf5f9('0x0'));var util=require(_0xf5f9('0x1'));var path=require(_0xf5f9('0x2'));var timeout=require(_0xf5f9('0x3'));var express=require(_0xf5f9('0x4'));var router=express[_0xf5f9('0x5')]();var auth=require(_0xf5f9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f9('0x7'));router[_0xf5f9('0x8')]('/',auth[_0xf5f9('0x9')](),controller[_0xf5f9('0xa')]);router[_0xf5f9('0x8')](_0xf5f9('0xb'),controller[_0xf5f9('0xc')]);router[_0xf5f9('0x8')](_0xf5f9('0xd'),controller['show']);router[_0xf5f9('0x8')](_0xf5f9('0xe'),controller[_0xf5f9('0xf')]);router[_0xf5f9('0x8')](_0xf5f9('0x10'),controller[_0xf5f9('0x11')]);router[_0xf5f9('0x8')](_0xf5f9('0x12'),controller['gdpr']);router[_0xf5f9('0x8')]('/:id/preferred',controller['getPreferred']);router[_0xf5f9('0x8')]('/:id/favicon',controller[_0xf5f9('0x13')]);var upload=multer({'storage':multer[_0xf5f9('0x14')]({'destination':function(_0x285559,_0x347075,_0xbd2e6){_0xbd2e6(null,path[_0xf5f9('0x15')](config[_0xf5f9('0x16')],_0xf5f9('0x17')));},'filename':function(_0x206c38,_0x17c09c,_0x509a49){_0x509a49(null,util[_0xf5f9('0x18')]('%s%s','logo',path[_0xf5f9('0x19')](_0x17c09c[_0xf5f9('0x1a')])));}})});router[_0xf5f9('0x1b')](_0xf5f9('0xe'),upload[_0xf5f9('0x1c')]('file'),controller[_0xf5f9('0x1d')]);var upload=multer({'storage':multer[_0xf5f9('0x14')]({'destination':function(_0x2d62d1,_0x38c956,_0x31f3cb){_0x31f3cb(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x36d22b,_0x5f173b,_0x283bf3){_0x283bf3(null,util['format'](_0xf5f9('0x1e'),_0xf5f9('0x1f'),path[_0xf5f9('0x19')](_0x5f173b[_0xf5f9('0x1a')])));}})});router['post'](_0xf5f9('0x10'),upload[_0xf5f9('0x1c')](_0xf5f9('0x20')),controller[_0xf5f9('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf86c95,_0x4485bb,_0x2eea0d){_0x2eea0d(null,path[_0xf5f9('0x15')](config[_0xf5f9('0x16')],_0xf5f9('0x17')));},'filename':function(_0x103d56,_0x2311bc,_0x3e2533){_0x3e2533(null,util[_0xf5f9('0x18')](_0xf5f9('0x1e'),'preferred',path[_0xf5f9('0x19')](_0x2311bc[_0xf5f9('0x1a')])));}})});router[_0xf5f9('0x1b')](_0xf5f9('0x22'),upload[_0xf5f9('0x1c')]('file'),controller[_0xf5f9('0x23')]);var upload=multer({'storage':multer[_0xf5f9('0x14')]({'destination':function(_0x515be1,_0x5ca6b7,_0x512024){_0x512024(null,path[_0xf5f9('0x15')](config[_0xf5f9('0x16')],'server/files/images/logos/'));},'filename':function(_0x22b578,_0x2f28d7,_0x52030a){_0x52030a(null,util['format'](_0xf5f9('0x1e'),_0xf5f9('0x24'),path['extname'](_0x2f28d7[_0xf5f9('0x1a')])));}})});router[_0xf5f9('0x1b')](_0xf5f9('0x25'),upload[_0xf5f9('0x1c')]('file'),controller['addFavicon']);router['put']('/:id',auth[_0xf5f9('0x9')](),controller[_0xf5f9('0x26')]);module[_0xf5f9('0x27')]=router; \ No newline at end of file +var _0x375b=['/:id','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','root','format','%s%s','logo','extname','originalname','single','addLogo','join','server/files/images/logos/','logologin','post','file','addLogoLogin','/:id/preferred','put'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x375b,0x14b));var _0xb375=function(_0x2f8727,_0x32247a){_0x2f8727=_0x2f8727-0x0;var _0x3dd8b3=_0x375b[_0x2f8727];return _0x3dd8b3;};'use strict';var multer=require(_0xb375('0x0'));var util=require(_0xb375('0x1'));var path=require(_0xb375('0x2'));var timeout=require(_0xb375('0x3'));var express=require(_0xb375('0x4'));var router=express['Router']();var auth=require(_0xb375('0x5'));var interaction=require(_0xb375('0x6'));var config=require(_0xb375('0x7'));var controller=require('./setting.controller');router[_0xb375('0x8')]('/',auth[_0xb375('0x9')](),controller[_0xb375('0xa')]);router[_0xb375('0x8')](_0xb375('0xb'),controller[_0xb375('0xc')]);router[_0xb375('0x8')]('/:id',controller[_0xb375('0xd')]);router[_0xb375('0x8')](_0xb375('0xe'),controller[_0xb375('0xf')]);router['get'](_0xb375('0x10'),controller[_0xb375('0x11')]);router[_0xb375('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0xb375('0x12')]);router[_0xb375('0x8')](_0xb375('0x13'),controller[_0xb375('0x14')]);var upload=multer({'storage':multer[_0xb375('0x15')]({'destination':function(_0x483d7b,_0xda62eb,_0x11abac){_0x11abac(null,path['join'](config[_0xb375('0x16')],'server/files/images/logos/'));},'filename':function(_0x3771fd,_0x46b2e5,_0x1793ea){_0x1793ea(null,util[_0xb375('0x17')](_0xb375('0x18'),_0xb375('0x19'),path[_0xb375('0x1a')](_0x46b2e5[_0xb375('0x1b')])));}})});router['post']('/:id/logo',upload[_0xb375('0x1c')]('file'),controller[_0xb375('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f441b,_0x1fc82c,_0x2386eb){_0x2386eb(null,path[_0xb375('0x1e')](config[_0xb375('0x16')],_0xb375('0x1f')));},'filename':function(_0x1ddc56,_0x20bfb8,_0x31381f){_0x31381f(null,util[_0xb375('0x17')](_0xb375('0x18'),_0xb375('0x20'),path['extname'](_0x20bfb8['originalname'])));}})});router[_0xb375('0x21')](_0xb375('0x10'),upload['single'](_0xb375('0x22')),controller[_0xb375('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49a89d,_0x3a5bd3,_0x52e8a4){_0x52e8a4(null,path[_0xb375('0x1e')](config[_0xb375('0x16')],_0xb375('0x1f')));},'filename':function(_0x3b19ad,_0x45d25a,_0x2a0797){_0x2a0797(null,util[_0xb375('0x17')](_0xb375('0x18'),'preferred',path[_0xb375('0x1a')](_0x45d25a['originalname'])));}})});router['post'](_0xb375('0x24'),upload[_0xb375('0x1c')](_0xb375('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xb375('0x15')]({'destination':function(_0x4431df,_0x178b3c,_0x2f253d){_0x2f253d(null,path['join'](config[_0xb375('0x16')],_0xb375('0x1f')));},'filename':function(_0x3a3978,_0x3b5a8c,_0x48a217){_0x48a217(null,util[_0xb375('0x17')](_0xb375('0x18'),'favicon',path['extname'](_0x3b5a8c['originalname'])));}})});router['post']('/:id/favicon',upload[_0xb375('0x1c')]('file'),controller['addFavicon']);router[_0xb375('0x25')](_0xb375('0x26'),auth[_0xb375('0x9')](),controller[_0xb375('0x27')]);module[_0xb375('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7bfdcdb..49d9945 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 _0x3056=['alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0x5353a7,_0x35c20f){var _0x2c86ac=function(_0x105d9e){while(--_0x105d9e){_0x5353a7['push'](_0x5353a7['shift']());}};_0x2c86ac(++_0x35c20f);}(_0x3056,0x12b));var _0x6305=function(_0x150fe3,_0x5b7e8d){_0x150fe3=_0x150fe3-0x0;var _0x5d255a=_0x3056[_0x150fe3];return _0x5d255a;};'use strict';var Sequelize=require(_0x6305('0x0'));module[_0x6305('0x1')]={'min_internal':{'type':Sequelize[_0x6305('0x2')](0xb),'unique':_0x6305('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6305('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x6305('0x4')},'logo':{'type':Sequelize[_0x6305('0x5')]},'defaultLogo':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6305('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6305('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6305('0x5')]},'turnaddr':{'type':Sequelize[_0x6305('0x5')]},'turnusername':{'type':Sequelize[_0x6305('0x5')]},'turnpassword':{'type':Sequelize[_0x6305('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6305('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6305('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6305('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6305('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6305('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6305('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x6305('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6305('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6305('0x5')]},'defaultFavicon':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6305('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6305('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6305('0x2')]},'sentimentRegion':{'type':Sequelize[_0x6305('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x6305('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x6305('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6305('0x2')](0x2)[_0x6305('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x6305('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3cde=['exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize'];(function(_0x2047d3,_0x2aface){var _0x125096=function(_0x169ac2){while(--_0x169ac2){_0x2047d3['push'](_0x2047d3['shift']());}};_0x125096(++_0x2aface);}(_0x3cde,0x117));var _0xe3cd=function(_0x11be5b,_0x512b49){_0x11be5b=_0x11be5b-0x0;var _0x19cf71=_0x3cde[_0x11be5b];return _0x19cf71;};'use strict';var Sequelize=require(_0xe3cd('0x0'));module[_0xe3cd('0x1')]={'min_internal':{'type':Sequelize[_0xe3cd('0x2')](0xb),'unique':_0xe3cd('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xe3cd('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe3cd('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xe3cd('0x5')},'logo':{'type':Sequelize[_0xe3cd('0x6')]},'defaultLogo':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe3cd('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xe3cd('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe3cd('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xe3cd('0x8')},'enableEmailPreview':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe3cd('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe3cd('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe3cd('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xe3cd('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe3cd('0x6')]},'defaultPreferred':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe3cd('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0xe3cd('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe3cd('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe3cd('0x6')]},'defaultFavicon':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xe3cd('0x2')]},'transcribeRegion':{'type':Sequelize[_0xe3cd('0x6')]},'sentiment':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xe3cd('0x6')]},'language':{'type':Sequelize[_0xe3cd('0x6')]},'bucket':{'type':Sequelize[_0xe3cd('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe3cd('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xe3cd('0x2')](0x2)[_0xe3cd('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 969e19d..dbe8f7b 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 _0x5483=['sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Setting','includeAll','include','findAll','catch','params','length','find','body','file','logo','addLogoLogin','filename','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','download','getLogoLogin','default_loginLogo.svg','Sequelize','\x20not\x20found','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xb4dea0,_0x49f72f){var _0x1eb7c8=function(_0x509da9){while(--_0x509da9){_0xb4dea0['push'](_0xb4dea0['shift']());}};_0x1eb7c8(++_0x49f72f);}(_0x5483,0x6b));var _0x3548=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x5483[_0xe719ec];return _0x4842a1;};'use strict';var pdf=require(_0x3548('0x0'));var emlformat=require(_0x3548('0x1'));var rimraf=require(_0x3548('0x2'));var zipdir=require(_0x3548('0x3'));var jsonpatch=require(_0x3548('0x4'));var rp=require(_0x3548('0x5'));var moment=require(_0x3548('0x6'));var BPromise=require(_0x3548('0x7'));var Mustache=require(_0x3548('0x8'));var util=require(_0x3548('0x9'));var path=require('path');var sox=require(_0x3548('0xa'));var csv=require('to-csv');var ejs=require(_0x3548('0xb'));var fs=require('fs');var _=require(_0x3548('0xc'));var squel=require(_0x3548('0xd'));var crypto=require('crypto');var jsforce=require(_0x3548('0xe'));var deskjs=require(_0x3548('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3548('0x10'));var Redis=require(_0x3548('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3548('0x12'));var as=require(_0x3548('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3548('0x14'));var licenseUtil=require(_0x3548('0x15'));var db=require(_0x3548('0x16'))['db'];var jayson=require(_0x3548('0x17'));var client=jayson['client'][_0x3548('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1923f1,_0x581177,_0x775820,_0x3401be){return new BPromise(function(_0x408036,_0x2c8bbe){var _0x491478=_0x3401be||client;return _0x491478[_0x3548('0x19')](_0x1923f1,_0x775820)[_0x3548('0x1a')](function(_0x34f69e){logger['info'](_0x3548('0x1b'),_0x581177,_0x3548('0x1c'));logger['debug'](_0x3548('0x1d'),_0x581177,_0x3548('0x1c'),JSON[_0x3548('0x1e')](_0x34f69e));if(_0x34f69e[_0x3548('0x1f')]){if(_0x34f69e[_0x3548('0x1f')][_0x3548('0x20')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x581177,_0x34f69e[_0x3548('0x1f')][_0x3548('0x21')]);return _0x2c8bbe(_0x34f69e['error'][_0x3548('0x21')]);}logger['error']('Setting,\x20%s,\x20%s',_0x581177,_0x34f69e['error']['message']);return _0x408036(_0x34f69e['error'][_0x3548('0x21')]);}else{logger[_0x3548('0x22')](_0x3548('0x1b'),_0x581177,'request\x20sent');_0x408036(_0x34f69e[_0x3548('0x23')]['message']);}})['catch'](function(_0x1bca7d){logger[_0x3548('0x1f')](_0x3548('0x1b'),_0x581177,_0x1bca7d);_0x2c8bbe(_0x1bca7d);});});}function respondWithStatusCode(_0x4aafda,_0x31e6a1){_0x31e6a1=_0x31e6a1||0xcc;return function(_0x1ef4b7){if(_0x1ef4b7){return _0x4aafda[_0x3548('0x24')](_0x31e6a1);}return _0x4aafda[_0x3548('0x25')](_0x31e6a1)[_0x3548('0x26')]();};}function respondWithResult(_0x338a14,_0x276f61){_0x276f61=_0x276f61||0xc8;return function(_0x158eff){if(_0x158eff){return _0x338a14['status'](_0x276f61)[_0x3548('0x27')](_0x158eff);}};}function respondWithFilteredResult(_0x1b6506,_0x110d6a){return function(_0x4235b0){if(_0x4235b0){var _0x13914e=_0x4235b0[_0x3548('0x28')],_0x5db172=_0x110d6a[_0x3548('0x29')],_0xd081e9=_0x110d6a[_0x3548('0x29')]+_0x110d6a[_0x3548('0x2a')],_0x23d241;if(_0xd081e9>=_0x13914e){_0xd081e9=_0x13914e;_0x23d241=0xc8;}else{_0x23d241=0xce;}_0x1b6506[_0x3548('0x25')](_0x23d241);return _0x1b6506[_0x3548('0x2b')]('Content-Range',_0x5db172+'-'+_0xd081e9+'/'+_0x13914e)[_0x3548('0x27')](_0x4235b0);}return null;};}function patchUpdates(_0x152b6b){return function(_0x3f834b){try{jsonpatch['apply'](_0x3f834b,_0x152b6b,!![]);}catch(_0x3d6c94){return BPromise[_0x3548('0x2c')](_0x3d6c94);}return _0x3f834b[_0x3548('0x2d')]();};}function saveUpdates(_0x2fc294,_0x325720){return function(_0x167977){if(_0x167977){return _0x167977[_0x3548('0x2e')](_0x2fc294)['then'](function(_0x4e61d0){return _0x4e61d0;});}return null;};}function removeEntity(_0x1673d5,_0x268028){return function(_0x184218){if(_0x184218){return _0x184218[_0x3548('0x2f')]()['then'](function(){_0x1673d5[_0x3548('0x25')](0xcc)[_0x3548('0x26')]();});}};}function handleEntityNotFound(_0x469255,_0xabda0d){return function(_0x13ad04){if(!_0x13ad04){_0x469255[_0x3548('0x24')](0x194);}return _0x13ad04;};}function handleError(_0x1e5348,_0x5afb2d){_0x5afb2d=_0x5afb2d||0x1f4;return function(_0x3cb140){logger['error'](_0x3cb140[_0x3548('0x30')]);if(_0x3cb140[_0x3548('0x31')]){delete _0x3cb140[_0x3548('0x31')];}_0x1e5348[_0x3548('0x25')](_0x5afb2d)[_0x3548('0x32')](_0x3cb140);};}exports[_0x3548('0x33')]=function(_0x42e953,_0x441fa4){var _0x3aa552={},_0x3fd7ad={},_0x18193d={'count':0x0,'rows':[]};var _0x107de2=_[_0x3548('0x34')](db['Setting']['rawAttributes'],function(_0x2f942a){return{'name':_0x2f942a[_0x3548('0x35')],'type':_0x2f942a[_0x3548('0x36')][_0x3548('0x37')]};});_0x3fd7ad[_0x3548('0x38')]=_[_0x3548('0x34')](_0x107de2,'name');_0x3fd7ad[_0x3548('0x39')]=_[_0x3548('0x3a')](_0x42e953['query']);_0x3fd7ad[_0x3548('0x3b')]=_['intersection'](_0x3fd7ad[_0x3548('0x38')],_0x3fd7ad['query']);_0x3aa552[_0x3548('0x3c')]=_[_0x3548('0x3d')](_0x3fd7ad[_0x3548('0x38')],qs[_0x3548('0x3e')](_0x42e953[_0x3548('0x39')]['fields']));_0x3aa552[_0x3548('0x3c')]=_0x3aa552['attributes']['length']?_0x3aa552[_0x3548('0x3c')]:_0x3fd7ad['model'];if(!_0x42e953[_0x3548('0x39')]['hasOwnProperty'](_0x3548('0x3f'))){_0x3aa552[_0x3548('0x2a')]=qs['limit'](_0x42e953[_0x3548('0x39')][_0x3548('0x2a')]);_0x3aa552[_0x3548('0x29')]=qs[_0x3548('0x29')](_0x42e953[_0x3548('0x39')]['offset']);}_0x3aa552[_0x3548('0x40')]=qs['sort'](_0x42e953[_0x3548('0x39')][_0x3548('0x41')]);_0x3aa552[_0x3548('0x42')]=qs[_0x3548('0x3b')](_[_0x3548('0x43')](_0x42e953[_0x3548('0x39')],_0x3fd7ad['filters']),_0x107de2);if(_0x42e953[_0x3548('0x39')][_0x3548('0x44')]){_0x3aa552['where']=_['merge'](_0x3aa552[_0x3548('0x42')],{'$or':_[_0x3548('0x34')](_0x107de2,function(_0x15ec27){if(_0x15ec27['type']!==_0x3548('0x45')){var _0x44d9ef={};_0x44d9ef[_0x15ec27['name']]={'$like':'%'+_0x42e953['query'][_0x3548('0x44')]+'%'};return _0x44d9ef;}})});}_0x3aa552=_[_0x3548('0x46')]({},_0x3aa552,_0x42e953[_0x3548('0x47')]);var _0x484cf0={'where':_0x3aa552[_0x3548('0x42')]};return db[_0x3548('0x48')][_0x3548('0x28')](_0x484cf0)[_0x3548('0x1a')](function(_0x1b13fa){_0x18193d[_0x3548('0x28')]=_0x1b13fa;if(_0x42e953[_0x3548('0x39')][_0x3548('0x49')]){_0x3aa552[_0x3548('0x4a')]=[{'all':!![]}];}return db['Setting'][_0x3548('0x4b')](_0x3aa552);})[_0x3548('0x1a')](function(_0x46b47e){_0x18193d['rows']=_0x46b47e;return _0x18193d;})[_0x3548('0x1a')](respondWithFilteredResult(_0x441fa4,_0x3aa552))[_0x3548('0x4c')](handleError(_0x441fa4,null));};exports['show']=function(_0x151aa7,_0x171427){var _0xdd7403={'raw':![],'where':{'id':_0x151aa7[_0x3548('0x4d')]['id']}},_0x253e6e={};_0x253e6e[_0x3548('0x38')]=_['keys'](db[_0x3548('0x48')]['rawAttributes']);_0x253e6e[_0x3548('0x39')]=_[_0x3548('0x3a')](_0x151aa7[_0x3548('0x39')]);_0x253e6e[_0x3548('0x3b')]=_[_0x3548('0x3d')](_0x253e6e[_0x3548('0x38')],_0x253e6e[_0x3548('0x39')]);_0xdd7403[_0x3548('0x3c')]=_[_0x3548('0x3d')](_0x253e6e[_0x3548('0x38')],qs[_0x3548('0x3e')](_0x151aa7['query'][_0x3548('0x3e')]));_0xdd7403[_0x3548('0x3c')]=_0xdd7403[_0x3548('0x3c')][_0x3548('0x4e')]?_0xdd7403[_0x3548('0x3c')]:_0x253e6e[_0x3548('0x38')];if(_0x151aa7[_0x3548('0x39')]['includeAll']){_0xdd7403[_0x3548('0x4a')]=[{'all':!![]}];}_0xdd7403=_[_0x3548('0x46')]({},_0xdd7403,_0x151aa7[_0x3548('0x47')]);return db['Setting'][_0x3548('0x4f')](_0xdd7403)[_0x3548('0x1a')](handleEntityNotFound(_0x171427,null))[_0x3548('0x1a')](respondWithResult(_0x171427,null))['catch'](handleError(_0x171427,null));};exports[_0x3548('0x2e')]=function(_0x3b93e7,_0x4ab0cd){if(_0x3b93e7[_0x3548('0x50')]['id']){delete _0x3b93e7[_0x3548('0x50')]['id'];}return db['Setting'][_0x3548('0x4f')]({'where':{'id':_0x3b93e7[_0x3548('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4ab0cd,null))[_0x3548('0x1a')](saveUpdates(_0x3b93e7['body'],null))[_0x3548('0x1a')](respondWithResult(_0x4ab0cd,null))[_0x3548('0x4c')](handleError(_0x4ab0cd,null));};exports['addLogo']=function(_0x173fba,_0x14f019,_0x99ec1c){if(_0x173fba['file']&&_0x173fba[_0x3548('0x51')]['filename']){_0x173fba['body'][_0x3548('0x52')]=_0x173fba[_0x3548('0x51')]['filename'];}return db['Setting'][_0x3548('0x4f')]({'where':{'id':_0x173fba['params']['id']}})[_0x3548('0x1a')](handleEntityNotFound(_0x14f019,null))[_0x3548('0x1a')](saveUpdates(_0x173fba[_0x3548('0x50')],null))[_0x3548('0x1a')](respondWithResult(_0x14f019,null))['catch'](handleError(_0x14f019,null));};exports[_0x3548('0x53')]=function(_0x22ec08,_0x1085c7,_0x9aadea){if(_0x22ec08[_0x3548('0x51')]&&_0x22ec08['file'][_0x3548('0x54')]){_0x22ec08['body'][_0x3548('0x55')]=_0x22ec08['file'][_0x3548('0x54')];}return db[_0x3548('0x48')][_0x3548('0x4f')]({'where':{'id':_0x22ec08[_0x3548('0x4d')]['id']}})[_0x3548('0x1a')](handleEntityNotFound(_0x1085c7,null))['then'](saveUpdates(_0x22ec08[_0x3548('0x50')],null))[_0x3548('0x1a')](respondWithResult(_0x1085c7,null))[_0x3548('0x4c')](handleError(_0x1085c7,null));};var utilLicense=require(_0x3548('0x15'));exports[_0x3548('0x56')]=function(_0x5d91b1,_0x10d163,_0x2bddd2){var _0xfc147b=_0x3548('0x57');var _0x39ef0b={'custom':![]};return utilLicense[_0x3548('0x58')]()[_0x3548('0x1a')](function(_0x1c6e47){if(_0x1c6e47){_0x39ef0b=_0x1c6e47;}return db[_0x3548('0x48')][_0x3548('0x4f')]({'where':{'id':_0x5d91b1[_0x3548('0x4d')]['id']},'attributes':[_0x3548('0x52'),'loginLogo',_0x3548('0x59'),_0x3548('0x5a'),_0x3548('0x5b'),_0x3548('0x5c'),_0x3548('0x5d'),_0x3548('0x5e')],'raw':!![]});})[_0x3548('0x1a')](handleEntityNotFound(_0x10d163,null))[_0x3548('0x1a')](function(_0x2fc7d1){if(_0x2fc7d1){var _0x985e29=_0x2fc7d1[_0x3548('0x52')]&&fs[_0x3548('0x5f')](path[_0x3548('0x60')](config[_0x3548('0x61')],_0xfc147b,_['toLower'](_0x2fc7d1[_0x3548('0x52')])))?path['join'](config['root'],_0xfc147b,_[_0x3548('0x62')](_0x2fc7d1['logo'])):path[_0x3548('0x60')](config[_0x3548('0x61')],_0xfc147b,_[_0x3548('0x62')](_0x3548('0x63')));var _0x4b04d9=_0x3548('0x64')+_[_0x3548('0x65')](_0x3548('0x52'));if(_0x2fc7d1[_0x4b04d9]||!_0x39ef0b[_0x3548('0x66')]){_0x985e29=path[_0x3548('0x60')](config['root'],_0xfc147b,_['toLower'](_0x3548('0x63')));}if(!fs['existsSync'](_0x985e29)){throw new db['Sequelize'][(_0x3548('0x67'))](_[_0x3548('0x65')](_0x3548('0x52'))+'\x20not\x20found');}return _0x10d163[_0x3548('0x68')](_0x985e29);}})[_0x3548('0x4c')](handleError(_0x10d163,null));};var utilLicense=require(_0x3548('0x15'));exports[_0x3548('0x69')]=function(_0x285229,_0x5878e7,_0x183268){var _0x11777d='server/files/images/logos';var _0x1dd27f={'custom':![]};return utilLicense[_0x3548('0x58')]()[_0x3548('0x1a')](function(_0xf608b8){if(_0xf608b8){_0x1dd27f=_0xf608b8;}return db['Setting']['find']({'where':{'id':_0x285229[_0x3548('0x4d')]['id']},'attributes':[_0x3548('0x52'),_0x3548('0x55'),_0x3548('0x59'),_0x3548('0x5a'),_0x3548('0x5b'),_0x3548('0x5c'),_0x3548('0x5d'),_0x3548('0x5e')],'raw':!![]});})[_0x3548('0x1a')](handleEntityNotFound(_0x5878e7,null))['then'](function(_0x1bd39c){if(_0x1bd39c){var _0x22f151=_0x1bd39c['loginLogo']&&fs[_0x3548('0x5f')](path[_0x3548('0x60')](config[_0x3548('0x61')],_0x11777d,_[_0x3548('0x62')](_0x1bd39c[_0x3548('0x55')])))?path[_0x3548('0x60')](config[_0x3548('0x61')],_0x11777d,_[_0x3548('0x62')](_0x1bd39c[_0x3548('0x55')])):path[_0x3548('0x60')](config[_0x3548('0x61')],_0x11777d,_[_0x3548('0x62')](_0x3548('0x6a')));var _0x4e8a83=_0x3548('0x64')+_[_0x3548('0x65')](_0x3548('0x55'));if(_0x1bd39c[_0x4e8a83]||!_0x1dd27f[_0x3548('0x66')]){_0x22f151=path[_0x3548('0x60')](config[_0x3548('0x61')],_0x11777d,_[_0x3548('0x62')](_0x3548('0x6a')));}if(!fs[_0x3548('0x5f')](_0x22f151)){throw new db[(_0x3548('0x6b'))][(_0x3548('0x67'))](_[_0x3548('0x65')](_0x3548('0x55'))+_0x3548('0x6c'));}return _0x5878e7[_0x3548('0x68')](_0x22f151);}})['catch'](handleError(_0x5878e7,null));};exports['gdpr']=function(_0x4157a8,_0x225e9a){return db['Setting'][_0x3548('0x4f')]({'where':{'id':_0x4157a8[_0x3548('0x4d')]['id']},'attributes':['securePassword']})[_0x3548('0x1a')](respondWithResult(_0x225e9a,null))[_0x3548('0x4c')](handleError(_0x225e9a,null));};exports['addPreferred']=function(_0x23e126,_0xdadefb,_0x280461){if(_0x23e126[_0x3548('0x51')]&&_0x23e126[_0x3548('0x51')][_0x3548('0x54')]){_0x23e126[_0x3548('0x50')][_0x3548('0x59')]=_0x23e126[_0x3548('0x51')][_0x3548('0x54')];}return db[_0x3548('0x48')][_0x3548('0x4f')]({'where':{'id':_0x23e126[_0x3548('0x4d')]['id']}})[_0x3548('0x1a')](handleEntityNotFound(_0xdadefb,null))[_0x3548('0x1a')](saveUpdates(_0x23e126[_0x3548('0x50')],null))[_0x3548('0x1a')](respondWithResult(_0xdadefb,null))['catch'](handleError(_0xdadefb,null));};var utilLicense=require(_0x3548('0x15'));exports[_0x3548('0x6d')]=function(_0x17ee6a,_0x18c99b,_0x3a21fa){var _0x48b08f='server/files/images/logos';var _0x362265={'custom':![]};return utilLicense[_0x3548('0x58')]()[_0x3548('0x1a')](function(_0x5aef91){if(_0x5aef91){_0x362265=_0x5aef91;}return db[_0x3548('0x48')]['find']({'where':{'id':_0x17ee6a[_0x3548('0x4d')]['id']},'attributes':[_0x3548('0x52'),_0x3548('0x55'),_0x3548('0x59'),_0x3548('0x5a'),_0x3548('0x5b'),_0x3548('0x5c'),_0x3548('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x3548('0x1a')](handleEntityNotFound(_0x18c99b,null))[_0x3548('0x1a')](function(_0xa639ab){if(_0xa639ab){var _0x50cfaf=_0xa639ab[_0x3548('0x59')]&&fs[_0x3548('0x5f')](path[_0x3548('0x60')](config['root'],_0x48b08f,_[_0x3548('0x62')](_0xa639ab[_0x3548('0x59')])))?path[_0x3548('0x60')](config[_0x3548('0x61')],_0x48b08f,_[_0x3548('0x62')](_0xa639ab[_0x3548('0x59')])):path['join'](config[_0x3548('0x61')],_0x48b08f,_[_0x3548('0x62')](_0x3548('0x6e')));var _0xdef0aa='default'+_[_0x3548('0x65')](_0x3548('0x59'));if(_0xa639ab[_0xdef0aa]||!_0x362265[_0x3548('0x66')]||!_0x362265[_0x3548('0x59')]){_0x50cfaf=path[_0x3548('0x60')](config['root'],_0x48b08f,_[_0x3548('0x62')]('default_preferred.png'));}if(!fs[_0x3548('0x5f')](_0x50cfaf)){throw new db[(_0x3548('0x6b'))][(_0x3548('0x67'))](_[_0x3548('0x65')](_0x3548('0x59'))+_0x3548('0x6c'));}return _0x18c99b[_0x3548('0x68')](_0x50cfaf);}})[_0x3548('0x4c')](handleError(_0x18c99b,null));};exports[_0x3548('0x6f')]=function(_0x419703,_0x14bff9,_0x3bc0d9){if(_0x419703['file']&&_0x419703[_0x3548('0x51')][_0x3548('0x54')]){_0x419703[_0x3548('0x50')][_0x3548('0x5a')]=_0x419703[_0x3548('0x51')]['filename'];}return db[_0x3548('0x48')][_0x3548('0x4f')]({'where':{'id':_0x419703['params']['id']}})['then'](handleEntityNotFound(_0x14bff9,null))['then'](saveUpdates(_0x419703[_0x3548('0x50')],null))[_0x3548('0x1a')](respondWithResult(_0x14bff9,null))[_0x3548('0x4c')](handleError(_0x14bff9,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x552897,_0x33a4a3,_0x561996){var _0x6fb3c3=_0x3548('0x57');var _0x29b7e5={'custom':![]};return utilLicense[_0x3548('0x58')]()[_0x3548('0x1a')](function(_0x212408){if(_0x212408){_0x29b7e5=_0x212408;}return db[_0x3548('0x48')][_0x3548('0x4f')]({'where':{'id':_0x552897[_0x3548('0x4d')]['id']},'attributes':[_0x3548('0x52'),_0x3548('0x55'),_0x3548('0x59'),'favicon',_0x3548('0x5b'),_0x3548('0x5c'),_0x3548('0x5d'),_0x3548('0x5e')],'raw':!![]});})[_0x3548('0x1a')](handleEntityNotFound(_0x33a4a3,null))[_0x3548('0x1a')](function(_0x2cad2e){if(_0x2cad2e){var _0x57b252=_0x2cad2e['favicon']&&fs[_0x3548('0x5f')](path[_0x3548('0x60')](config['root'],_0x6fb3c3,_['toLower'](_0x2cad2e['favicon'])))?path['join'](config[_0x3548('0x61')],_0x6fb3c3,_[_0x3548('0x62')](_0x2cad2e[_0x3548('0x5a')])):path[_0x3548('0x60')](config['root'],_0x6fb3c3,_[_0x3548('0x62')](_0x3548('0x70')));var _0xf9c2b0='default'+_[_0x3548('0x65')](_0x3548('0x5a'));if(_0x2cad2e[_0xf9c2b0]||!_0x29b7e5['custom']){_0x57b252=path[_0x3548('0x60')](config['root'],_0x6fb3c3,_['toLower'](_0x3548('0x70')));}if(!fs[_0x3548('0x5f')](_0x57b252)){throw new db[(_0x3548('0x6b'))]['ValidationError'](_[_0x3548('0x65')]('favicon')+_0x3548('0x6c'));}return _0x33a4a3[_0x3548('0x68')](_0x57b252);}})[_0x3548('0x4c')](handleError(_0x33a4a3,null));};exports[_0x3548('0x71')]=function(_0x5912e3,_0x542978){var _0x401629={'offset':moment()[_0x3548('0x72')]()};_0x401629['now']=moment()[_0x3548('0x72')](_0x401629[_0x3548('0x29')])[_0x3548('0x73')](_0x3548('0x74'));return _0x542978[_0x3548('0x25')](0xc8)['send'](_0x401629);}; \ No newline at end of file +var _0x135a=['body','addLogo','file','logo','filename','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','favicon','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','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','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','Setting','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','limit','order','sort','filters','pick','VIRTUAL','filter','merge','options','where','findAll','show','includeAll','include','find'];(function(_0x67a49,_0x378f8c){var _0x36c7c6=function(_0x1b7e44){while(--_0x1b7e44){_0x67a49['push'](_0x67a49['shift']());}};_0x36c7c6(++_0x378f8c);}(_0x135a,0x123));var _0xa135=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x135a[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0xa135('0x0'));var emlformat=require(_0xa135('0x1'));var rimraf=require(_0xa135('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa135('0x3'));var rp=require(_0xa135('0x4'));var moment=require('moment');var BPromise=require(_0xa135('0x5'));var Mustache=require(_0xa135('0x6'));var util=require(_0xa135('0x7'));var path=require(_0xa135('0x8'));var sox=require(_0xa135('0x9'));var csv=require(_0xa135('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa135('0xb'));var squel=require(_0xa135('0xc'));var crypto=require(_0xa135('0xd'));var jsforce=require(_0xa135('0xe'));var deskjs=require(_0xa135('0xf'));var toCsv=require(_0xa135('0xa'));var querystring=require(_0xa135('0x10'));var Papa=require(_0xa135('0x11'));var Redis=require(_0xa135('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa135('0x13'));var as=require(_0xa135('0x14'));var hardwareService=require(_0xa135('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa135('0x16'));var config=require(_0xa135('0x17'));var licenseUtil=require(_0xa135('0x18'));var db=require(_0xa135('0x19'))['db'];var jayson=require(_0xa135('0x1a'));var client=jayson[_0xa135('0x1b')][_0xa135('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x56c1a4,_0x446bad,_0x566457,_0x51c13e){return new BPromise(function(_0x1f1b10,_0x5be65a){var _0x1b48e0=_0x51c13e||client;return _0x1b48e0[_0xa135('0x1d')](_0x56c1a4,_0x566457)[_0xa135('0x1e')](function(_0xf425a7){logger[_0xa135('0x1f')](_0xa135('0x20'),_0x446bad,_0xa135('0x21'));logger[_0xa135('0x22')](_0xa135('0x23'),_0x446bad,_0xa135('0x21'),JSON[_0xa135('0x24')](_0xf425a7));if(_0xf425a7[_0xa135('0x25')]){if(_0xf425a7[_0xa135('0x25')][_0xa135('0x26')]===0x1f4){logger[_0xa135('0x25')]('Setting,\x20%s,\x20%s',_0x446bad,_0xf425a7[_0xa135('0x25')][_0xa135('0x27')]);return _0x5be65a(_0xf425a7[_0xa135('0x25')][_0xa135('0x27')]);}logger[_0xa135('0x25')](_0xa135('0x20'),_0x446bad,_0xf425a7['error'][_0xa135('0x27')]);return _0x1f1b10(_0xf425a7[_0xa135('0x25')]['message']);}else{logger[_0xa135('0x1f')](_0xa135('0x20'),_0x446bad,_0xa135('0x21'));_0x1f1b10(_0xf425a7[_0xa135('0x28')][_0xa135('0x27')]);}})[_0xa135('0x29')](function(_0x11abaf){logger[_0xa135('0x25')](_0xa135('0x20'),_0x446bad,_0x11abaf);_0x5be65a(_0x11abaf);});});}function respondWithStatusCode(_0x561614,_0x3a01ae){_0x3a01ae=_0x3a01ae||0xcc;return function(_0x1d0389){if(_0x1d0389){return _0x561614[_0xa135('0x2a')](_0x3a01ae);}return _0x561614[_0xa135('0x2b')](_0x3a01ae)[_0xa135('0x2c')]();};}function respondWithResult(_0x584dc2,_0x169017){_0x169017=_0x169017||0xc8;return function(_0x351d92){if(_0x351d92){return _0x584dc2['status'](_0x169017)[_0xa135('0x2d')](_0x351d92);}};}function respondWithFilteredResult(_0x39f291,_0x46d916){return function(_0x39eb12){if(_0x39eb12){var _0x210536=_0x39eb12[_0xa135('0x2e')],_0x399536=_0x46d916['offset'],_0x5a274c=_0x46d916[_0xa135('0x2f')]+_0x46d916['limit'],_0x10dece;if(_0x5a274c>=_0x210536){_0x5a274c=_0x210536;_0x10dece=0xc8;}else{_0x10dece=0xce;}_0x39f291[_0xa135('0x2b')](_0x10dece);return _0x39f291[_0xa135('0x30')](_0xa135('0x31'),_0x399536+'-'+_0x5a274c+'/'+_0x210536)['json'](_0x39eb12);}return null;};}function patchUpdates(_0x1d150c){return function(_0xea3c77){try{jsonpatch[_0xa135('0x32')](_0xea3c77,_0x1d150c,!![]);}catch(_0x10f4e5){return BPromise[_0xa135('0x33')](_0x10f4e5);}return _0xea3c77[_0xa135('0x34')]();};}function saveUpdates(_0x4fc68f,_0x45c09e){return function(_0x296391){if(_0x296391){return _0x296391[_0xa135('0x35')](_0x4fc68f)['then'](function(_0x3b8f4c){return _0x3b8f4c;});}return null;};}function removeEntity(_0x53c756,_0x47cf31){return function(_0x2c6c38){if(_0x2c6c38){return _0x2c6c38['destroy']()[_0xa135('0x1e')](function(){_0x53c756[_0xa135('0x2b')](0xcc)[_0xa135('0x2c')]();});}};}function handleEntityNotFound(_0x28f1b9,_0x4d51ea){return function(_0x1162a7){if(!_0x1162a7){_0x28f1b9['sendStatus'](0x194);}return _0x1162a7;};}function handleError(_0x59f15b,_0x3f49ba){_0x3f49ba=_0x3f49ba||0x1f4;return function(_0x232d33){logger[_0xa135('0x25')](_0x232d33[_0xa135('0x36')]);if(_0x232d33[_0xa135('0x37')]){delete _0x232d33[_0xa135('0x37')];}_0x59f15b['status'](_0x3f49ba)[_0xa135('0x38')](_0x232d33);};}exports['index']=function(_0x367a3e,_0x345f5b){var _0x578e92={},_0x22eb06={},_0x26ef13={'count':0x0,'rows':[]};var _0x22caeb=_[_0xa135('0x39')](db[_0xa135('0x3a')][_0xa135('0x3b')],function(_0x771eb9){return{'name':_0x771eb9['fieldName'],'type':_0x771eb9[_0xa135('0x3c')][_0xa135('0x3d')]};});_0x22eb06['model']=_[_0xa135('0x39')](_0x22caeb,_0xa135('0x37'));_0x22eb06[_0xa135('0x3e')]=_[_0xa135('0x3f')](_0x367a3e['query']);_0x22eb06['filters']=_['intersection'](_0x22eb06[_0xa135('0x40')],_0x22eb06[_0xa135('0x3e')]);_0x578e92[_0xa135('0x41')]=_[_0xa135('0x42')](_0x22eb06[_0xa135('0x40')],qs[_0xa135('0x43')](_0x367a3e[_0xa135('0x3e')][_0xa135('0x43')]));_0x578e92[_0xa135('0x41')]=_0x578e92[_0xa135('0x41')][_0xa135('0x44')]?_0x578e92[_0xa135('0x41')]:_0x22eb06[_0xa135('0x40')];if(!_0x367a3e[_0xa135('0x3e')]['hasOwnProperty']('nolimit')){_0x578e92[_0xa135('0x45')]=qs[_0xa135('0x45')](_0x367a3e[_0xa135('0x3e')][_0xa135('0x45')]);_0x578e92[_0xa135('0x2f')]=qs[_0xa135('0x2f')](_0x367a3e[_0xa135('0x3e')]['offset']);}_0x578e92[_0xa135('0x46')]=qs[_0xa135('0x47')](_0x367a3e[_0xa135('0x3e')][_0xa135('0x47')]);_0x578e92['where']=qs[_0xa135('0x48')](_[_0xa135('0x49')](_0x367a3e['query'],_0x22eb06[_0xa135('0x48')]),_0x22caeb);if(_0x367a3e['query']['filter']){_0x578e92['where']=_['merge'](_0x578e92['where'],{'$or':_['map'](_0x22caeb,function(_0x5420d2){if(_0x5420d2[_0xa135('0x3c')]!==_0xa135('0x4a')){var _0x259e8c={};_0x259e8c[_0x5420d2[_0xa135('0x37')]]={'$like':'%'+_0x367a3e[_0xa135('0x3e')][_0xa135('0x4b')]+'%'};return _0x259e8c;}})});}_0x578e92=_[_0xa135('0x4c')]({},_0x578e92,_0x367a3e[_0xa135('0x4d')]);var _0x541bf3={'where':_0x578e92[_0xa135('0x4e')]};return db[_0xa135('0x3a')][_0xa135('0x2e')](_0x541bf3)[_0xa135('0x1e')](function(_0x24771d){_0x26ef13[_0xa135('0x2e')]=_0x24771d;if(_0x367a3e['query']['includeAll']){_0x578e92['include']=[{'all':!![]}];}return db[_0xa135('0x3a')][_0xa135('0x4f')](_0x578e92);})[_0xa135('0x1e')](function(_0x5a497a){_0x26ef13['rows']=_0x5a497a;return _0x26ef13;})['then'](respondWithFilteredResult(_0x345f5b,_0x578e92))[_0xa135('0x29')](handleError(_0x345f5b,null));};exports[_0xa135('0x50')]=function(_0xa475fb,_0x136c0d){var _0x4a0b52={'raw':![],'where':{'id':_0xa475fb['params']['id']}},_0x3328eb={};_0x3328eb[_0xa135('0x40')]=_[_0xa135('0x3f')](db[_0xa135('0x3a')][_0xa135('0x3b')]);_0x3328eb['query']=_[_0xa135('0x3f')](_0xa475fb[_0xa135('0x3e')]);_0x3328eb[_0xa135('0x48')]=_[_0xa135('0x42')](_0x3328eb[_0xa135('0x40')],_0x3328eb['query']);_0x4a0b52[_0xa135('0x41')]=_[_0xa135('0x42')](_0x3328eb[_0xa135('0x40')],qs[_0xa135('0x43')](_0xa475fb[_0xa135('0x3e')][_0xa135('0x43')]));_0x4a0b52[_0xa135('0x41')]=_0x4a0b52[_0xa135('0x41')]['length']?_0x4a0b52[_0xa135('0x41')]:_0x3328eb[_0xa135('0x40')];if(_0xa475fb[_0xa135('0x3e')][_0xa135('0x51')]){_0x4a0b52[_0xa135('0x52')]=[{'all':!![]}];}_0x4a0b52=_[_0xa135('0x4c')]({},_0x4a0b52,_0xa475fb[_0xa135('0x4d')]);return db[_0xa135('0x3a')][_0xa135('0x53')](_0x4a0b52)['then'](handleEntityNotFound(_0x136c0d,null))[_0xa135('0x1e')](respondWithResult(_0x136c0d,null))['catch'](handleError(_0x136c0d,null));};exports[_0xa135('0x35')]=function(_0x2e9018,_0x2d95e5){if(_0x2e9018[_0xa135('0x54')]['id']){delete _0x2e9018['body']['id'];}return db['Setting'][_0xa135('0x53')]({'where':{'id':_0x2e9018['params']['id']}})[_0xa135('0x1e')](handleEntityNotFound(_0x2d95e5,null))['then'](saveUpdates(_0x2e9018[_0xa135('0x54')],null))[_0xa135('0x1e')](respondWithResult(_0x2d95e5,null))[_0xa135('0x29')](handleError(_0x2d95e5,null));};exports[_0xa135('0x55')]=function(_0x1b443b,_0x35c754,_0x1a9689){if(_0x1b443b[_0xa135('0x56')]&&_0x1b443b[_0xa135('0x56')]['filename']){_0x1b443b[_0xa135('0x54')][_0xa135('0x57')]=_0x1b443b[_0xa135('0x56')][_0xa135('0x58')];}return db[_0xa135('0x3a')]['find']({'where':{'id':_0x1b443b[_0xa135('0x59')]['id']}})[_0xa135('0x1e')](handleEntityNotFound(_0x35c754,null))['then'](saveUpdates(_0x1b443b['body'],null))[_0xa135('0x1e')](respondWithResult(_0x35c754,null))[_0xa135('0x29')](handleError(_0x35c754,null));};exports[_0xa135('0x5a')]=function(_0x579792,_0xdeb989,_0x4eebd3){if(_0x579792[_0xa135('0x56')]&&_0x579792['file'][_0xa135('0x58')]){_0x579792[_0xa135('0x54')][_0xa135('0x5b')]=_0x579792[_0xa135('0x56')][_0xa135('0x58')];}return db[_0xa135('0x3a')][_0xa135('0x53')]({'where':{'id':_0x579792['params']['id']}})[_0xa135('0x1e')](handleEntityNotFound(_0xdeb989,null))[_0xa135('0x1e')](saveUpdates(_0x579792['body'],null))['then'](respondWithResult(_0xdeb989,null))['catch'](handleError(_0xdeb989,null));};var utilLicense=require('../../config/license/util');exports[_0xa135('0x5c')]=function(_0x210fdd,_0x15789a,_0x4ac610){var _0x2a3cb7=_0xa135('0x5d');var _0x477789={'custom':![]};return utilLicense[_0xa135('0x5e')]()['then'](function(_0x993b92){if(_0x993b92){_0x477789=_0x993b92;}return db[_0xa135('0x3a')][_0xa135('0x53')]({'where':{'id':_0x210fdd[_0xa135('0x59')]['id']},'attributes':[_0xa135('0x57'),'loginLogo','preferred','favicon',_0xa135('0x5f'),_0xa135('0x60'),_0xa135('0x61'),_0xa135('0x62')],'raw':!![]});})[_0xa135('0x1e')](handleEntityNotFound(_0x15789a,null))[_0xa135('0x1e')](function(_0x2d2eec){if(_0x2d2eec){var _0x579b77=_0x2d2eec[_0xa135('0x57')]&&fs[_0xa135('0x63')](path[_0xa135('0x64')](config[_0xa135('0x65')],_0x2a3cb7,_[_0xa135('0x66')](_0x2d2eec['logo'])))?path[_0xa135('0x64')](config[_0xa135('0x65')],_0x2a3cb7,_[_0xa135('0x66')](_0x2d2eec[_0xa135('0x57')])):path[_0xa135('0x64')](config[_0xa135('0x65')],_0x2a3cb7,_[_0xa135('0x66')](_0xa135('0x67')));var _0xeaedb6=_0xa135('0x68')+_[_0xa135('0x69')]('logo');if(_0x2d2eec[_0xeaedb6]||!_0x477789[_0xa135('0x6a')]){_0x579b77=path[_0xa135('0x64')](config[_0xa135('0x65')],_0x2a3cb7,_['toLower']('default_logo.svg'));}if(!fs[_0xa135('0x63')](_0x579b77)){throw new db[(_0xa135('0x6b'))][(_0xa135('0x6c'))](_[_0xa135('0x69')]('logo')+_0xa135('0x6d'));}return _0x15789a[_0xa135('0x6e')](_0x579b77);}})[_0xa135('0x29')](handleError(_0x15789a,null));};var utilLicense=require(_0xa135('0x18'));exports[_0xa135('0x6f')]=function(_0x33ac40,_0x330c46,_0x171a07){var _0x1a303c='server/files/images/logos';var _0x4bcc54={'custom':![]};return utilLicense[_0xa135('0x5e')]()[_0xa135('0x1e')](function(_0x5244ec){if(_0x5244ec){_0x4bcc54=_0x5244ec;}return db['Setting'][_0xa135('0x53')]({'where':{'id':_0x33ac40[_0xa135('0x59')]['id']},'attributes':[_0xa135('0x57'),_0xa135('0x5b'),_0xa135('0x70'),_0xa135('0x71'),_0xa135('0x5f'),'defaultLoginLogo',_0xa135('0x61'),_0xa135('0x62')],'raw':!![]});})[_0xa135('0x1e')](handleEntityNotFound(_0x330c46,null))['then'](function(_0x54ac80){if(_0x54ac80){var _0x106a01=_0x54ac80[_0xa135('0x5b')]&&fs['existsSync'](path[_0xa135('0x64')](config[_0xa135('0x65')],_0x1a303c,_[_0xa135('0x66')](_0x54ac80[_0xa135('0x5b')])))?path[_0xa135('0x64')](config[_0xa135('0x65')],_0x1a303c,_[_0xa135('0x66')](_0x54ac80[_0xa135('0x5b')])):path[_0xa135('0x64')](config[_0xa135('0x65')],_0x1a303c,_[_0xa135('0x66')](_0xa135('0x72')));var _0x3c10d9=_0xa135('0x68')+_[_0xa135('0x69')]('loginLogo');if(_0x54ac80[_0x3c10d9]||!_0x4bcc54[_0xa135('0x6a')]){_0x106a01=path[_0xa135('0x64')](config[_0xa135('0x65')],_0x1a303c,_['toLower'](_0xa135('0x72')));}if(!fs['existsSync'](_0x106a01)){throw new db[(_0xa135('0x6b'))]['ValidationError'](_['upperFirst']('loginLogo')+'\x20not\x20found');}return _0x330c46[_0xa135('0x6e')](_0x106a01);}})['catch'](handleError(_0x330c46,null));};exports['gdpr']=function(_0x16dae1,_0x2afa50){return db[_0xa135('0x3a')][_0xa135('0x53')]({'where':{'id':_0x16dae1[_0xa135('0x59')]['id']},'attributes':[_0xa135('0x73')]})[_0xa135('0x1e')](respondWithResult(_0x2afa50,null))[_0xa135('0x29')](handleError(_0x2afa50,null));};exports[_0xa135('0x74')]=function(_0x64d4c5,_0x4edcc9,_0x14e112){if(_0x64d4c5[_0xa135('0x56')]&&_0x64d4c5[_0xa135('0x56')][_0xa135('0x58')]){_0x64d4c5[_0xa135('0x54')][_0xa135('0x70')]=_0x64d4c5[_0xa135('0x56')][_0xa135('0x58')];}return db[_0xa135('0x3a')]['find']({'where':{'id':_0x64d4c5[_0xa135('0x59')]['id']}})[_0xa135('0x1e')](handleEntityNotFound(_0x4edcc9,null))[_0xa135('0x1e')](saveUpdates(_0x64d4c5['body'],null))['then'](respondWithResult(_0x4edcc9,null))[_0xa135('0x29')](handleError(_0x4edcc9,null));};var utilLicense=require(_0xa135('0x18'));exports[_0xa135('0x75')]=function(_0x3631ea,_0x234730,_0x108c85){var _0x491ea1=_0xa135('0x5d');var _0x394fee={'custom':![]};return utilLicense[_0xa135('0x5e')]()[_0xa135('0x1e')](function(_0x1836b8){if(_0x1836b8){_0x394fee=_0x1836b8;}return db[_0xa135('0x3a')][_0xa135('0x53')]({'where':{'id':_0x3631ea[_0xa135('0x59')]['id']},'attributes':[_0xa135('0x57'),'loginLogo',_0xa135('0x70'),_0xa135('0x71'),_0xa135('0x5f'),_0xa135('0x60'),_0xa135('0x61'),'defaultFavicon'],'raw':!![]});})[_0xa135('0x1e')](handleEntityNotFound(_0x234730,null))['then'](function(_0x30b11a){if(_0x30b11a){var _0x1d42d9=_0x30b11a['preferred']&&fs[_0xa135('0x63')](path['join'](config['root'],_0x491ea1,_['toLower'](_0x30b11a[_0xa135('0x70')])))?path[_0xa135('0x64')](config[_0xa135('0x65')],_0x491ea1,_[_0xa135('0x66')](_0x30b11a[_0xa135('0x70')])):path['join'](config[_0xa135('0x65')],_0x491ea1,_['toLower'](_0xa135('0x76')));var _0x5dca3d=_0xa135('0x68')+_[_0xa135('0x69')](_0xa135('0x70'));if(_0x30b11a[_0x5dca3d]||!_0x394fee[_0xa135('0x6a')]||!_0x394fee['preferred']){_0x1d42d9=path[_0xa135('0x64')](config[_0xa135('0x65')],_0x491ea1,_['toLower'](_0xa135('0x76')));}if(!fs[_0xa135('0x63')](_0x1d42d9)){throw new db[(_0xa135('0x6b'))][(_0xa135('0x6c'))](_['upperFirst']('preferred')+_0xa135('0x6d'));}return _0x234730[_0xa135('0x6e')](_0x1d42d9);}})['catch'](handleError(_0x234730,null));};exports['addFavicon']=function(_0x353440,_0x6cbd09,_0x7f9346){if(_0x353440[_0xa135('0x56')]&&_0x353440[_0xa135('0x56')]['filename']){_0x353440[_0xa135('0x54')][_0xa135('0x71')]=_0x353440[_0xa135('0x56')][_0xa135('0x58')];}return db['Setting']['find']({'where':{'id':_0x353440[_0xa135('0x59')]['id']}})[_0xa135('0x1e')](handleEntityNotFound(_0x6cbd09,null))['then'](saveUpdates(_0x353440['body'],null))[_0xa135('0x1e')](respondWithResult(_0x6cbd09,null))['catch'](handleError(_0x6cbd09,null));};var utilLicense=require(_0xa135('0x18'));exports['getFavicon']=function(_0x612c58,_0x3ec340,_0x3782c1){var _0x451408=_0xa135('0x5d');var _0x23e273={'custom':![]};return utilLicense['getLicense']()[_0xa135('0x1e')](function(_0x47ee1c){if(_0x47ee1c){_0x23e273=_0x47ee1c;}return db[_0xa135('0x3a')]['find']({'where':{'id':_0x612c58[_0xa135('0x59')]['id']},'attributes':['logo','loginLogo',_0xa135('0x70'),'favicon','defaultLogo',_0xa135('0x60'),_0xa135('0x61'),_0xa135('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x3ec340,null))[_0xa135('0x1e')](function(_0x3e6cdc){if(_0x3e6cdc){var _0xc29803=_0x3e6cdc[_0xa135('0x71')]&&fs[_0xa135('0x63')](path[_0xa135('0x64')](config[_0xa135('0x65')],_0x451408,_[_0xa135('0x66')](_0x3e6cdc[_0xa135('0x71')])))?path[_0xa135('0x64')](config[_0xa135('0x65')],_0x451408,_[_0xa135('0x66')](_0x3e6cdc['favicon'])):path[_0xa135('0x64')](config[_0xa135('0x65')],_0x451408,_[_0xa135('0x66')](_0xa135('0x77')));var _0x5974b2=_0xa135('0x68')+_['upperFirst']('favicon');if(_0x3e6cdc[_0x5974b2]||!_0x23e273[_0xa135('0x6a')]){_0xc29803=path['join'](config['root'],_0x451408,_[_0xa135('0x66')](_0xa135('0x77')));}if(!fs[_0xa135('0x63')](_0xc29803)){throw new db[(_0xa135('0x6b'))]['ValidationError'](_['upperFirst'](_0xa135('0x71'))+_0xa135('0x6d'));}return _0x3ec340['download'](_0xc29803);}})[_0xa135('0x29')](handleError(_0x3ec340,null));};exports[_0xa135('0x78')]=function(_0x29a912,_0x4dcecf){var _0x2e89d0={'offset':moment()[_0xa135('0x79')]()};_0x2e89d0[_0xa135('0x7a')]=moment()[_0xa135('0x79')](_0x2e89d0[_0xa135('0x2f')])[_0xa135('0x7b')](_0xa135('0x7c'));return _0x4dcecf[_0xa135('0x2b')](0xc8)['send'](_0x2e89d0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2b1a84f..6f925d5 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 _0x7ea3=['define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','path','./setting.attributes','exports'];(function(_0x4fb683,_0x43736a){var _0x3b4599=function(_0xe1369f){while(--_0xe1369f){_0x4fb683['push'](_0x4fb683['shift']());}};_0x3b4599(++_0x43736a);}(_0x7ea3,0x18f));var _0x37ea=function(_0xcfed91,_0x29b51b){_0xcfed91=_0xcfed91-0x0;var _0x42e245=_0x7ea3[_0xcfed91];return _0x42e245;};'use strict';var _=require(_0x37ea('0x0'));var util=require(_0x37ea('0x1'));var logger=require(_0x37ea('0x2'))(_0x37ea('0x3'));var moment=require(_0x37ea('0x4'));var BPromise=require(_0x37ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ea('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x37ea('0x7'));module[_0x37ea('0x8')]=function(_0x4c7904,_0x15fc92){return _0x4c7904[_0x37ea('0x9')](_0x37ea('0xa'),attributes,{'tableName':_0x37ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x540a=['Setting','lodash','util','../../config/logger','api','request-promise','path','rimraf','./setting.attributes','exports','define'];(function(_0x17ea1e,_0x53ad70){var _0x1d0889=function(_0x3971e7){while(--_0x3971e7){_0x17ea1e['push'](_0x17ea1e['shift']());}};_0x1d0889(++_0x53ad70);}(_0x540a,0x12a));var _0xa540=function(_0xc72b00,_0xc36fea){_0xc72b00=_0xc72b00-0x0;var _0x2120ae=_0x540a[_0xc72b00];return _0x2120ae;};'use strict';var _=require(_0xa540('0x0'));var util=require(_0xa540('0x1'));var logger=require(_0xa540('0x2'))(_0xa540('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa540('0x4'));var fs=require('fs');var path=require(_0xa540('0x5'));var rimraf=require(_0xa540('0x6'));var config=require('../../config/environment');var attributes=require(_0xa540('0x7'));module[_0xa540('0x8')]=function(_0x1159e8,_0x4976e7){return _0x1159e8[_0xa540('0x9')](_0xa540('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3fd8799..58cd3a6 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 _0xe584=['debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x5df2b4,_0xebbff7){var _0x1e51f5=function(_0x3bf5df){while(--_0x3bf5df){_0x5df2b4['push'](_0x5df2b4['shift']());}};_0x1e51f5(++_0xebbff7);}(_0xe584,0x194));var _0x4e58=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0xe584[_0x3fb166];return _0x5e91be;};'use strict';var _=require(_0x4e58('0x0'));var util=require(_0x4e58('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4e58('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e58('0x3'))['db'];var utils=require(_0x4e58('0x4'));var logger=require(_0x4e58('0x5'))(_0x4e58('0x6'));var config=require(_0x4e58('0x7'));var jayson=require(_0x4e58('0x8'));var client=jayson['client'][_0x4e58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48a35b,_0x3d0ffb,_0x1f1fae){return new BPromise(function(_0x1c3bc9,_0x53c5ba){return client[_0x4e58('0xa')](_0x48a35b,_0x1f1fae)[_0x4e58('0xb')](function(_0x33f8b0){logger['info'](_0x4e58('0xc'),_0x3d0ffb,_0x4e58('0xd'));logger[_0x4e58('0xe')](_0x4e58('0xf'),_0x3d0ffb,_0x4e58('0xd'),JSON[_0x4e58('0x10')](_0x33f8b0));if(_0x33f8b0[_0x4e58('0x11')]){if(_0x33f8b0[_0x4e58('0x11')]['code']===0x1f4){logger[_0x4e58('0x11')](_0x4e58('0xc'),_0x3d0ffb,_0x33f8b0[_0x4e58('0x11')]['message']);return _0x53c5ba(_0x33f8b0[_0x4e58('0x11')]['message']);}logger[_0x4e58('0x11')]('Setting,\x20%s,\x20%s',_0x3d0ffb,_0x33f8b0[_0x4e58('0x11')][_0x4e58('0x12')]);return _0x1c3bc9(_0x33f8b0[_0x4e58('0x11')]['message']);}else{logger[_0x4e58('0x13')]('Setting,\x20%s,\x20%s',_0x3d0ffb,_0x4e58('0xd'));_0x1c3bc9(_0x33f8b0[_0x4e58('0x14')][_0x4e58('0x12')]);}})[_0x4e58('0x15')](function(_0x4f2f5d){logger[_0x4e58('0x11')](_0x4e58('0xc'),_0x3d0ffb,_0x4f2f5d);_0x53c5ba(_0x4f2f5d);});});} \ No newline at end of file +var _0xbc1f=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4aac4d,_0x151efc){var _0x423ad6=function(_0x196122){while(--_0x196122){_0x4aac4d['push'](_0x4aac4d['shift']());}};_0x423ad6(++_0x151efc);}(_0xbc1f,0x9a));var _0xfbc1=function(_0x5183fa,_0x1bfed0){_0x5183fa=_0x5183fa-0x0;var _0x2a0854=_0xbc1f[_0x5183fa];return _0x2a0854;};'use strict';var _=require(_0xfbc1('0x0'));var util=require('util');var moment=require(_0xfbc1('0x1'));var BPromise=require(_0xfbc1('0x2'));var rs=require(_0xfbc1('0x3'));var fs=require('fs');var Redis=require(_0xfbc1('0x4'));var db=require(_0xfbc1('0x5'))['db'];var utils=require(_0xfbc1('0x6'));var logger=require(_0xfbc1('0x7'))(_0xfbc1('0x8'));var config=require(_0xfbc1('0x9'));var jayson=require(_0xfbc1('0xa'));var client=jayson[_0xfbc1('0xb')][_0xfbc1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x566b2f,_0x40c319,_0x3b519c){return new BPromise(function(_0x300ac4,_0xa28b2b){return client[_0xfbc1('0xd')](_0x566b2f,_0x3b519c)[_0xfbc1('0xe')](function(_0x38f337){logger[_0xfbc1('0xf')](_0xfbc1('0x10'),_0x40c319,_0xfbc1('0x11'));logger[_0xfbc1('0x12')](_0xfbc1('0x13'),_0x40c319,_0xfbc1('0x11'),JSON[_0xfbc1('0x14')](_0x38f337));if(_0x38f337['error']){if(_0x38f337[_0xfbc1('0x15')]['code']===0x1f4){logger[_0xfbc1('0x15')]('Setting,\x20%s,\x20%s',_0x40c319,_0x38f337[_0xfbc1('0x15')][_0xfbc1('0x16')]);return _0xa28b2b(_0x38f337[_0xfbc1('0x15')][_0xfbc1('0x16')]);}logger[_0xfbc1('0x15')](_0xfbc1('0x10'),_0x40c319,_0x38f337[_0xfbc1('0x15')][_0xfbc1('0x16')]);return _0x300ac4(_0x38f337['error']['message']);}else{logger[_0xfbc1('0xf')]('Setting,\x20%s,\x20%s',_0x40c319,'request\x20sent');_0x300ac4(_0x38f337[_0xfbc1('0x17')][_0xfbc1('0x16')]);}})['catch'](function(_0xf364b2){logger['error'](_0xfbc1('0x10'),_0x40c319,_0xf364b2);_0xa28b2b(_0xf364b2);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 549e929..2a5a1cb 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 _0xb10b=['destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update','delete'];(function(_0x341a16,_0x432c34){var _0x1ca84b=function(_0x5f250a){while(--_0x5f250a){_0x341a16['push'](_0x341a16['shift']());}};_0x1ca84b(++_0x432c34);}(_0xb10b,0x12a));var _0xbb10=function(_0x46c59b,_0x5635dd){_0x46c59b=_0x46c59b-0x0;var _0x16dd2d=_0xb10b[_0x46c59b];return _0x16dd2d;};'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['getDispositions']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x8')](_0xbb10('0x13'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x8')]('/:id/status',controller[_0xbb10('0x15')]);router[_0xbb10('0x8')](_0xbb10('0x16'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x18')](_0xbb10('0xe'),auth['isAuthenticated'](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x18')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x18')](_0xbb10('0x1c'),controller[_0xbb10('0x1d')]);router[_0xbb10('0x18')](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x18')](_0xbb10('0x1f'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x20')]);router[_0xbb10('0x18')]('/:id/status',controller[_0xbb10('0x21')]);router[_0xbb10('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x22')]);router[_0xbb10('0x23')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xbb10('0x9')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0x9')](),controller[_0xbb10('0x28')]);module[_0xbb10('0x29')]=router; \ No newline at end of file +var _0x757a=['/:id/interactions','/:id/users','getAgents','post','create','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','/:id/status','status','addAgents','put','update','delete','removeAgents','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x1d5af8,_0x4f041b){var _0x427556=function(_0x2287d3){while(--_0x2287d3){_0x1d5af8['push'](_0x1d5af8['shift']());}};_0x427556(++_0x4f041b);}(_0x757a,0xde));var _0xa757=function(_0x55a25b,_0x4aff22){_0x55a25b=_0x55a25b-0x0;var _0x43ff1b=_0x757a[_0x55a25b];return _0x43ff1b;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['get'](_0xa757('0xc'),auth[_0xa757('0x7')](),controller[_0xa757('0xd')]);router[_0xa757('0x6')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller[_0xa757('0xf')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xa757('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa757('0x6')]('/:id/status',controller['statusGet']);router[_0xa757('0x6')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x12')]);router[_0xa757('0x13')]('/',auth[_0xa757('0x7')](),controller[_0xa757('0x14')]);router[_0xa757('0x13')](_0xa757('0xc'),auth[_0xa757('0x7')](),controller['addDisposition']);router[_0xa757('0x13')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['addAnswer']);router['post'](_0xa757('0x15'),controller[_0xa757('0x16')]);router[_0xa757('0x13')](_0xa757('0x17'),auth[_0xa757('0x7')](),controller[_0xa757('0x18')]);router['post'](_0xa757('0x19'),auth['isAuthenticated'](),controller[_0xa757('0x1a')]);router[_0xa757('0x13')](_0xa757('0x1b'),controller[_0xa757('0x1c')]);router['post']('/:id/users',auth[_0xa757('0x7')](),controller[_0xa757('0x1d')]);router[_0xa757('0x1e')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0x1f')]);router[_0xa757('0x20')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller['destroy']);router[_0xa757('0x20')]('/:id/dispositions',auth[_0xa757('0x7')](),controller['removeDispositions']);router[_0xa757('0x20')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['removeAnswers']);router[_0xa757('0x20')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 362fb94..eb92bb6 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 _0xb389=['intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','twilio','skebby','connectel','clicksend','plivo','clickatell'];(function(_0x4732e9,_0x410370){var _0x2cf89b=function(_0x513742){while(--_0x513742){_0x4732e9['push'](_0x4732e9['shift']());}};_0x2cf89b(++_0x410370);}(_0xb389,0x13b));var _0x9b38=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xb389[_0x737a1f];return _0x16eba1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9b38('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b38('0x1')],'unique':_0x9b38('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9b38('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9b38('0x1')]},'type':{'type':Sequelize['ENUM'](_0x9b38('0x3'),_0x9b38('0x4'),_0x9b38('0x5'),_0x9b38('0x6'),_0x9b38('0x7'),_0x9b38('0x8'),'csc','infobip',_0x9b38('0x9'))},'accountSid':{'type':Sequelize[_0x9b38('0x1')]},'authId':{'type':Sequelize[_0x9b38('0x1')]},'authToken':{'type':Sequelize[_0x9b38('0x1')]},'smsMethod':{'type':Sequelize[_0x9b38('0xa')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x9b38('0x1')]},'senderString':{'type':Sequelize[_0x9b38('0x1')]},'deliveryReport':{'type':Sequelize[_0x9b38('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9b38('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9b38('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9b38('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9b38('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9b38('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9b38('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9b38('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9b38('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9b38('0xb')],'defaultValue':![],'comment':_0x9b38('0xe'),'set':function(_0x149a60){if(!_0x149a60)this[_0x9b38('0xf')](_0x9b38('0x10'),null);this['setDataValue'](_0x9b38('0x11'),_0x149a60);}}}; \ No newline at end of file +var _0xa675=['sequelize','randomstring','exports','STRING','generate','ENUM','skebby','clicksend','plivo','csc','intelepeer','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3a11df,_0x287b5e){var _0x2cc1dd=function(_0x1f984b){while(--_0x1f984b){_0x3a11df['push'](_0x3a11df['shift']());}};_0x2cc1dd(++_0x287b5e);}(_0xa675,0x17c));var _0x5a67=function(_0x2445e2,_0xc4a747){_0x2445e2=_0x2445e2-0x0;var _0x1e5736=_0xa675[_0x2445e2];return _0x1e5736;};'use strict';var Sequelize=require(_0x5a67('0x0'));var rs=require(_0x5a67('0x1'));module[_0x5a67('0x2')]={'name':{'type':Sequelize[_0x5a67('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5a67('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5a67('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5a67('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5a67('0x5')]('twilio',_0x5a67('0x6'),'connectel',_0x5a67('0x7'),_0x5a67('0x8'),'clickatell',_0x5a67('0x9'),'infobip',_0x5a67('0xa'))},'accountSid':{'type':Sequelize[_0x5a67('0x3')]},'authId':{'type':Sequelize[_0x5a67('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x5a67('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5a67('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x5a67('0x3')]},'senderString':{'type':Sequelize[_0x5a67('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5a67('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5a67('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5a67('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5a67('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5a67('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5a67('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a67('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5a67('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5a67('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5a67('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a67('0xd')],'comment':_0x5a67('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x5a67('0xc')],'defaultValue':![],'comment':_0x5a67('0xf'),'set':function(_0x638ab7){if(!_0x638ab7)this[_0x5a67('0x10')](_0x5a67('0x11'),null);this['setDataValue'](_0x5a67('0x12'),_0x638ab7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 608d4fe..f310e80 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 _0xf30d=['redif','skebby','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','intelepeer','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','html-pdf','eml-format','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsAccount.socket','register','http','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','count','includeAll','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','Disposition','getDispositions','findOne','length','nolimit','SmsAccountId','include','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','ListId','mobile','from','From','messageId','MessageSid','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','replyMessageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','omit','contact','SmsInteraction','interaction','created','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','\x0a','addApplications','findAndCountAll','getApplications','filter','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','defaults','out','spread','dataValues','Messages','log','received\x20delivery\x20report\x20from','skebby_dispatch_id','statusInt','status_code','groupName'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xf30d,0x1c5));var _0xdf30=function(_0x23103,_0x3dadb5){_0x23103=_0x23103-0x0;var _0x36b2a7=_0xf30d[_0x23103];return _0x36b2a7;};'use strict';var pdf=require(_0xdf30('0x0'));var emlformat=require(_0xdf30('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf30('0x2'));var moment=require('moment');var BPromise=require(_0xdf30('0x3'));var Mustache=require('mustache');var util=require(_0xdf30('0x4'));var path=require(_0xdf30('0x5'));var sox=require(_0xdf30('0x6'));var csv=require(_0xdf30('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf30('0x8'));var squel=require(_0xdf30('0x9'));var crypto=require(_0xdf30('0xa'));var jsforce=require(_0xdf30('0xb'));var deskjs=require(_0xdf30('0xc'));var toCsv=require(_0xdf30('0x7'));var querystring=require(_0xdf30('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf30('0xe'));var authService=require(_0xdf30('0xf'));var qs=require(_0xdf30('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf30('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdf30('0x12'));var config=require(_0xdf30('0x13'));var licenseUtil=require(_0xdf30('0x14'));var db=require(_0xdf30('0x15'))['db'];config[_0xdf30('0x16')]=_['defaults'](config[_0xdf30('0x16')],{'host':_0xdf30('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf30('0x16')]));require(_0xdf30('0x18'))[_0xdf30('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdf30('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x47b907,_0x466e83,_0x2cdc3d,_0x29ff2e){return new BPromise(function(_0x17eacd,_0x529d6a){var _0x22f622=_0x29ff2e||client;return _0x22f622['request'](_0x47b907,_0x2cdc3d)['then'](function(_0x3eae08){logger[_0xdf30('0x1b')](_0xdf30('0x1c'),_0x466e83,'request\x20sent');logger[_0xdf30('0x1d')](_0xdf30('0x1e'),_0x466e83,_0xdf30('0x1f'),JSON['stringify'](_0x3eae08));if(_0x3eae08[_0xdf30('0x20')]){if(_0x3eae08['error'][_0xdf30('0x21')]===0x1f4){logger[_0xdf30('0x20')](_0xdf30('0x1c'),_0x466e83,_0x3eae08[_0xdf30('0x20')][_0xdf30('0x22')]);return _0x529d6a(_0x3eae08['error'][_0xdf30('0x22')]);}logger['error'](_0xdf30('0x1c'),_0x466e83,_0x3eae08[_0xdf30('0x20')][_0xdf30('0x22')]);return _0x17eacd(_0x3eae08[_0xdf30('0x20')][_0xdf30('0x22')]);}else{logger[_0xdf30('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x466e83,_0xdf30('0x1f'));_0x17eacd(_0x3eae08[_0xdf30('0x23')]['message']);}})['catch'](function(_0x5636f1){logger['error']('SmsAccount,\x20%s,\x20%s',_0x466e83,_0x5636f1);_0x529d6a(_0x5636f1);});});}function respondWithStatusCode(_0x52288b,_0x28f014){_0x28f014=_0x28f014||0xcc;return function(_0x16f9e3){if(_0x16f9e3){return _0x52288b[_0xdf30('0x24')](_0x28f014);}return _0x52288b[_0xdf30('0x25')](_0x28f014)[_0xdf30('0x26')]();};}function respondWithResult(_0x126417,_0x1d335e){_0x1d335e=_0x1d335e||0xc8;return function(_0x49a9e7){if(_0x49a9e7){return _0x126417[_0xdf30('0x25')](_0x1d335e)[_0xdf30('0x27')](_0x49a9e7);}};}function respondWithFilteredResult(_0x29a1c2,_0x3a67dd){return function(_0x2a962c){if(_0x2a962c){var _0x3b5a2b=_0x2a962c['count'],_0x32e4fe=_0x3a67dd[_0xdf30('0x28')],_0x8d0518=_0x3a67dd['offset']+_0x3a67dd[_0xdf30('0x29')],_0x5ef663;if(_0x8d0518>=_0x3b5a2b){_0x8d0518=_0x3b5a2b;_0x5ef663=0xc8;}else{_0x5ef663=0xce;}_0x29a1c2['status'](_0x5ef663);return _0x29a1c2['set'](_0xdf30('0x2a'),_0x32e4fe+'-'+_0x8d0518+'/'+_0x3b5a2b)[_0xdf30('0x27')](_0x2a962c);}return null;};}function patchUpdates(_0x299057){return function(_0x18f115){try{jsonpatch[_0xdf30('0x2b')](_0x18f115,_0x299057,!![]);}catch(_0x24d92b){return BPromise[_0xdf30('0x2c')](_0x24d92b);}return _0x18f115[_0xdf30('0x2d')]();};}function saveUpdates(_0x483b11,_0x8ec8f5){return function(_0x5d6956){if(_0x5d6956){return _0x5d6956[_0xdf30('0x2e')](_0x483b11)[_0xdf30('0x2f')](function(_0x23b260){return _0x23b260;});}return null;};}function removeEntity(_0x5ac152,_0x564417){return function(_0x3ac08d){if(_0x3ac08d){return _0x3ac08d[_0xdf30('0x30')]()['then'](function(){var _0x30ca78=_0x3ac08d[_0xdf30('0x31')]({'plain':!![]});var _0x2427dd=_0xdf30('0x32');return db[_0xdf30('0x33')][_0xdf30('0x30')]({'where':{'type':_0x2427dd,'resourceId':_0x30ca78['id']}})[_0xdf30('0x2f')](function(){return _0x3ac08d;});})[_0xdf30('0x2f')](function(){_0x5ac152[_0xdf30('0x25')](0xcc)[_0xdf30('0x26')]();});}};}function handleEntityNotFound(_0x579bc1,_0x4bbe5d){return function(_0x455da8){if(!_0x455da8){_0x579bc1[_0xdf30('0x24')](0x194);}return _0x455da8;};}function handleError(_0x3ef71e,_0x4985ba){_0x4985ba=_0x4985ba||0x1f4;return function(_0x15f9d3){logger[_0xdf30('0x20')](_0x15f9d3[_0xdf30('0x34')]);if(_0x15f9d3[_0xdf30('0x35')]){delete _0x15f9d3[_0xdf30('0x35')];}_0x3ef71e['status'](_0x4985ba)[_0xdf30('0x36')](_0x15f9d3);};}exports['index']=function(_0x5c0841,_0x4d3185){var _0x429085={'include':[{'model':db[_0xdf30('0x37')],'as':_0xdf30('0x38')}]},_0x145df6={},_0x370ebe={'count':0x0,'rows':[]};var _0x44ff17=_[_0xdf30('0x39')](db[_0xdf30('0x3a')][_0xdf30('0x3b')],function(_0x166666){return{'name':_0x166666['fieldName'],'type':_0x166666['type'][_0xdf30('0x3c')]};});_0x145df6[_0xdf30('0x3d')]=_[_0xdf30('0x39')](_0x44ff17,_0xdf30('0x35'));_0x145df6[_0xdf30('0x3e')]=_[_0xdf30('0x3f')](_0x5c0841['query']);_0x145df6[_0xdf30('0x40')]=_[_0xdf30('0x41')](_0x145df6[_0xdf30('0x3d')],_0x145df6[_0xdf30('0x3e')]);_0x429085[_0xdf30('0x42')]=_[_0xdf30('0x41')](_0x145df6[_0xdf30('0x3d')],qs[_0xdf30('0x43')](_0x5c0841['query'][_0xdf30('0x43')]));_0x429085[_0xdf30('0x42')]=_0x429085[_0xdf30('0x42')]['length']?_0x429085[_0xdf30('0x42')]:_0x145df6[_0xdf30('0x3d')];if(!_0x5c0841[_0xdf30('0x3e')][_0xdf30('0x44')]('nolimit')){_0x429085[_0xdf30('0x29')]=qs[_0xdf30('0x29')](_0x5c0841[_0xdf30('0x3e')][_0xdf30('0x29')]);_0x429085['offset']=qs[_0xdf30('0x28')](_0x5c0841['query'][_0xdf30('0x28')]);}_0x429085[_0xdf30('0x45')]=qs[_0xdf30('0x46')](_0x5c0841[_0xdf30('0x3e')][_0xdf30('0x46')]);_0x429085[_0xdf30('0x47')]=qs[_0xdf30('0x40')](_[_0xdf30('0x48')](_0x5c0841[_0xdf30('0x3e')],_0x145df6[_0xdf30('0x40')]),_0x44ff17);if(_0x5c0841[_0xdf30('0x3e')]['filter']){_0x429085[_0xdf30('0x47')]=_[_0xdf30('0x49')](_0x429085[_0xdf30('0x47')],{'$or':_['map'](_0x44ff17,function(_0x2338af){if(_0x2338af[_0xdf30('0x4a')]!==_0xdf30('0x4b')){var _0x321c41={};_0x321c41[_0x2338af['name']]={'$like':'%'+_0x5c0841[_0xdf30('0x3e')]['filter']+'%'};return _0x321c41;}})});}_0x429085=_[_0xdf30('0x49')]({},_0x429085,_0x5c0841['options']);var _0x390ea0={'where':_0x429085['where']};return db[_0xdf30('0x3a')]['count'](_0x390ea0)['then'](function(_0x1db5cd){_0x370ebe[_0xdf30('0x4c')]=_0x1db5cd;if(_0x5c0841[_0xdf30('0x3e')][_0xdf30('0x4d')]){_0x429085['include']=[{'all':!![]}];}return db[_0xdf30('0x3a')][_0xdf30('0x4e')](_0x429085);})[_0xdf30('0x2f')](function(_0x5d20a9){_0x370ebe[_0xdf30('0x4f')]=_0x5d20a9;return _0x370ebe;})[_0xdf30('0x2f')](respondWithFilteredResult(_0x4d3185,_0x429085))[_0xdf30('0x50')](handleError(_0x4d3185,null));};exports[_0xdf30('0x51')]=function(_0x5d1a8f,_0x2e45be){var _0x3f1031={'raw':![],'where':{'id':_0x5d1a8f['params']['id']},'include':[{'model':db['Pause'],'as':_0xdf30('0x38')}]},_0x3595a7={};_0x3595a7['model']=_[_0xdf30('0x3f')](db['SmsAccount'][_0xdf30('0x3b')]);_0x3595a7[_0xdf30('0x3e')]=_[_0xdf30('0x3f')](_0x5d1a8f['query']);_0x3595a7['filters']=_[_0xdf30('0x41')](_0x3595a7[_0xdf30('0x3d')],_0x3595a7['query']);_0x3f1031[_0xdf30('0x42')]=_[_0xdf30('0x41')](_0x3595a7['model'],qs[_0xdf30('0x43')](_0x5d1a8f[_0xdf30('0x3e')]['fields']));_0x3f1031[_0xdf30('0x42')]=_0x3f1031[_0xdf30('0x42')]['length']?_0x3f1031[_0xdf30('0x42')]:_0x3595a7['model'];if(_0x5d1a8f['query']['includeAll']){_0x3f1031['include']=[{'all':!![]}];}_0x3f1031=_[_0xdf30('0x49')]({},_0x3f1031,_0x5d1a8f[_0xdf30('0x52')]);return db[_0xdf30('0x3a')][_0xdf30('0x53')](_0x3f1031)[_0xdf30('0x2f')](handleEntityNotFound(_0x2e45be,null))[_0xdf30('0x2f')](respondWithResult(_0x2e45be,null))['catch'](handleError(_0x2e45be,null));};exports[_0xdf30('0x54')]=function(_0x5953d4,_0x37d8f4){return db[_0xdf30('0x3a')][_0xdf30('0x54')](_0x5953d4[_0xdf30('0x55')],{})[_0xdf30('0x2f')](function(_0x16c4b8){var _0x44ac67=_0x5953d4[_0xdf30('0x56')][_0xdf30('0x31')]({'plain':!![]});if(!_0x44ac67)throw new Error(_0xdf30('0x57'));if(_0x44ac67['role']===_0xdf30('0x56')){var _0x3ec3f2=_0x16c4b8[_0xdf30('0x31')]({'plain':!![]});var _0x48ba8d='SmsAccounts';return db[_0xdf30('0x58')]['find']({'where':{'name':_0x48ba8d,'userProfileId':_0x44ac67[_0xdf30('0x59')]},'raw':!![]})['then'](function(_0x16b22d){if(_0x16b22d&&_0x16b22d[_0xdf30('0x5a')]===0x0){return db['UserProfileResource'][_0xdf30('0x54')]({'name':_0x3ec3f2[_0xdf30('0x35')],'resourceId':_0x3ec3f2['id'],'type':_0x16b22d[_0xdf30('0x35')],'sectionId':_0x16b22d['id']},{})[_0xdf30('0x2f')](function(){return _0x16c4b8;});}else{return _0x16c4b8;}})['catch'](function(_0x36854d){logger['error'](_0xdf30('0x5b'),_0x36854d);throw _0x36854d;});}return _0x16c4b8;})[_0xdf30('0x2f')](respondWithResult(_0x37d8f4,0xc9))[_0xdf30('0x50')](handleError(_0x37d8f4,null));};exports[_0xdf30('0x2e')]=function(_0x207a6c,_0x32c849){if(_0x207a6c['body']['id']){delete _0x207a6c[_0xdf30('0x55')]['id'];}return db[_0xdf30('0x3a')][_0xdf30('0x53')]({'where':{'id':_0x207a6c[_0xdf30('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xdf30('0x38')}]})['then'](handleEntityNotFound(_0x32c849,null))['then'](saveUpdates(_0x207a6c[_0xdf30('0x55')],null))['then'](respondWithResult(_0x32c849,null))[_0xdf30('0x50')](handleError(_0x32c849,null));};exports[_0xdf30('0x30')]=function(_0xb242f5,_0x51f219){return db[_0xdf30('0x3a')]['find']({'where':{'id':_0xb242f5[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x51f219,null))[_0xdf30('0x2f')](removeEntity(_0x51f219,null))['catch'](handleError(_0x51f219,null));};exports['describe']=function(_0x47352d,_0x62ba14){return db[_0xdf30('0x3a')]['describe']()[_0xdf30('0x2f')](respondWithResult(_0x62ba14,null))[_0xdf30('0x50')](handleError(_0x62ba14,null));};exports[_0xdf30('0x5d')]=function(_0x4aa321,_0x21ead6,_0x150435){if(_0x4aa321['body']['id']){delete _0x4aa321['body']['id'];}return db[_0xdf30('0x3a')]['find']({'where':{'id':_0x4aa321['params']['id']}})['then'](handleEntityNotFound(_0x21ead6,null))['then'](function(_0x3b5a92){if(_0x3b5a92){_0x4aa321[_0xdf30('0x55')]['SmsAccountId']=_0x3b5a92['id'];return db[_0xdf30('0x5e')][_0xdf30('0x54')](_0x4aa321[_0xdf30('0x55')]);}})[_0xdf30('0x2f')](respondWithResult(_0x21ead6,null))[_0xdf30('0x50')](handleError(_0x21ead6,null));};exports[_0xdf30('0x5f')]=function(_0x5a15b5,_0x655934,_0x266dee){var _0x3fe063={'raw':![],'where':{}};var _0x5150cd={};var _0x5b3cfa={'count':0x0,'rows':[]};return db[_0xdf30('0x3a')][_0xdf30('0x60')]({'where':{'id':_0x5a15b5[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x655934,null))[_0xdf30('0x2f')](function(_0x11fec7){if(_0x11fec7){_0x5150cd[_0xdf30('0x3d')]=_['keys'](db[_0xdf30('0x5e')][_0xdf30('0x3b')]);_0x5150cd[_0xdf30('0x3e')]=_[_0xdf30('0x3f')](_0x5a15b5['query']);_0x5150cd[_0xdf30('0x40')]=_[_0xdf30('0x41')](_0x5150cd[_0xdf30('0x3d')],_0x5150cd['query']);_0x3fe063[_0xdf30('0x42')]=_[_0xdf30('0x41')](_0x5150cd[_0xdf30('0x3d')],qs['fields'](_0x5a15b5[_0xdf30('0x3e')][_0xdf30('0x43')]));_0x3fe063['attributes']=_0x3fe063['attributes'][_0xdf30('0x61')]?_0x3fe063[_0xdf30('0x42')]:_0x5150cd[_0xdf30('0x3d')];if(!_0x5a15b5[_0xdf30('0x3e')][_0xdf30('0x44')](_0xdf30('0x62'))){_0x3fe063[_0xdf30('0x29')]=qs['limit'](_0x5a15b5['query'][_0xdf30('0x29')]);_0x3fe063[_0xdf30('0x28')]=qs[_0xdf30('0x28')](_0x5a15b5[_0xdf30('0x3e')][_0xdf30('0x28')]);}_0x3fe063['order']=qs[_0xdf30('0x46')](_0x5a15b5['query'][_0xdf30('0x46')]);_0x3fe063['where']=qs['filters'](_[_0xdf30('0x48')](_0x5a15b5[_0xdf30('0x3e')],_0x5150cd[_0xdf30('0x40')]));_0x3fe063[_0xdf30('0x47')][_0xdf30('0x63')]=_0x11fec7['id'];if(_0x5a15b5[_0xdf30('0x3e')]['filter']){_0x3fe063[_0xdf30('0x47')]=_[_0xdf30('0x49')](_0x3fe063[_0xdf30('0x47')],{'$or':_['map'](_0x3fe063[_0xdf30('0x42')],function(_0x358fb1){var _0x44b513={};_0x44b513[_0x358fb1]={'$like':'%'+_0x5a15b5[_0xdf30('0x3e')]['filter']+'%'};return _0x44b513;})});}_0x3fe063=_[_0xdf30('0x49')]({},_0x3fe063,_0x5a15b5[_0xdf30('0x52')]);return db[_0xdf30('0x5e')][_0xdf30('0x4c')]({'where':_0x3fe063[_0xdf30('0x47')]})[_0xdf30('0x2f')](function(_0x7cf736){_0x5b3cfa[_0xdf30('0x4c')]=_0x7cf736;if(_0x5a15b5[_0xdf30('0x3e')][_0xdf30('0x4d')]){_0x3fe063[_0xdf30('0x64')]=[{'all':!![]}];}return db[_0xdf30('0x5e')]['findAll'](_0x3fe063);})['then'](function(_0x3397a8){_0x5b3cfa['rows']=_0x3397a8;return _0x5b3cfa;});}})['then'](respondWithFilteredResult(_0x655934,_0x3fe063))[_0xdf30('0x50')](handleError(_0x655934,null));};exports[_0xdf30('0x65')]=function(_0x41cf21,_0x42f620,_0x55a226){return db[_0xdf30('0x3a')][_0xdf30('0x53')]({'where':{'id':_0x41cf21[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x42f620,null))[_0xdf30('0x2f')](function(_0x52458c){if(_0x52458c){return _0x52458c[_0xdf30('0x65')](_0x41cf21[_0xdf30('0x3e')][_0xdf30('0x66')]);}})[_0xdf30('0x2f')](respondWithStatusCode(_0x42f620,null))[_0xdf30('0x50')](handleError(_0x42f620,null));};exports[_0xdf30('0x67')]=function(_0x3fdaed,_0x3ccafa,_0x20cefe){if(_0x3fdaed[_0xdf30('0x55')]['id']){delete _0x3fdaed[_0xdf30('0x55')]['id'];}return db['SmsAccount'][_0xdf30('0x53')]({'where':{'id':_0x3fdaed[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x3ccafa,null))['then'](function(_0x268c9e){if(_0x268c9e){_0x3fdaed[_0xdf30('0x55')][_0xdf30('0x63')]=_0x268c9e['id'];return db['CannedAnswer'][_0xdf30('0x54')](_0x3fdaed[_0xdf30('0x55')]);}})[_0xdf30('0x2f')](respondWithResult(_0x3ccafa,null))[_0xdf30('0x50')](handleError(_0x3ccafa,null));};exports[_0xdf30('0x68')]=function(_0x1055b0,_0x23fe02,_0x10d7a2){var _0x2d1550={'raw':![],'where':{}};var _0x31991c={};var _0x255ae6={'count':0x0,'rows':[]};return db[_0xdf30('0x3a')][_0xdf30('0x60')]({'where':{'id':_0x1055b0[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x23fe02,null))[_0xdf30('0x2f')](function(_0x3419bc){if(_0x3419bc){_0x31991c[_0xdf30('0x3d')]=_['keys'](db[_0xdf30('0x69')][_0xdf30('0x3b')]);_0x31991c['query']=_[_0xdf30('0x3f')](_0x1055b0[_0xdf30('0x3e')]);_0x31991c[_0xdf30('0x40')]=_[_0xdf30('0x41')](_0x31991c[_0xdf30('0x3d')],_0x31991c[_0xdf30('0x3e')]);_0x2d1550['attributes']=_[_0xdf30('0x41')](_0x31991c['model'],qs[_0xdf30('0x43')](_0x1055b0['query'][_0xdf30('0x43')]));_0x2d1550[_0xdf30('0x42')]=_0x2d1550[_0xdf30('0x42')][_0xdf30('0x61')]?_0x2d1550[_0xdf30('0x42')]:_0x31991c[_0xdf30('0x3d')];if(!_0x1055b0['query'][_0xdf30('0x44')](_0xdf30('0x62'))){_0x2d1550['limit']=qs[_0xdf30('0x29')](_0x1055b0[_0xdf30('0x3e')]['limit']);_0x2d1550[_0xdf30('0x28')]=qs[_0xdf30('0x28')](_0x1055b0[_0xdf30('0x3e')][_0xdf30('0x28')]);}_0x2d1550['order']=qs[_0xdf30('0x46')](_0x1055b0['query'][_0xdf30('0x46')]);_0x2d1550[_0xdf30('0x47')]=qs[_0xdf30('0x40')](_[_0xdf30('0x48')](_0x1055b0[_0xdf30('0x3e')],_0x31991c[_0xdf30('0x40')]));_0x2d1550[_0xdf30('0x47')]['SmsAccountId']=_0x3419bc['id'];if(_0x1055b0[_0xdf30('0x3e')]['filter']){_0x2d1550['where']=_['merge'](_0x2d1550['where'],{'$or':_[_0xdf30('0x39')](_0x2d1550[_0xdf30('0x42')],function(_0x2576b8){var _0x111be0={};_0x111be0[_0x2576b8]={'$like':'%'+_0x1055b0[_0xdf30('0x3e')]['filter']+'%'};return _0x111be0;})});}_0x2d1550=_['merge']({},_0x2d1550,_0x1055b0[_0xdf30('0x52')]);return db['CannedAnswer'][_0xdf30('0x4c')]({'where':_0x2d1550[_0xdf30('0x47')]})[_0xdf30('0x2f')](function(_0x13ee79){_0x255ae6['count']=_0x13ee79;if(_0x1055b0[_0xdf30('0x3e')][_0xdf30('0x4d')]){_0x2d1550[_0xdf30('0x64')]=[{'all':!![]}];}return db[_0xdf30('0x69')][_0xdf30('0x4e')](_0x2d1550);})[_0xdf30('0x2f')](function(_0x315fad){_0x255ae6[_0xdf30('0x4f')]=_0x315fad;return _0x255ae6;});}})[_0xdf30('0x2f')](respondWithFilteredResult(_0x23fe02,_0x2d1550))['catch'](handleError(_0x23fe02,null));};exports[_0xdf30('0x6a')]=function(_0x2c978f,_0x161903,_0x33cf46){return db[_0xdf30('0x3a')]['find']({'where':{'id':_0x2c978f['params']['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x161903,null))[_0xdf30('0x2f')](function(_0x3f5bf9){if(_0x3f5bf9){return _0x3f5bf9[_0xdf30('0x6a')](_0x2c978f[_0xdf30('0x3e')][_0xdf30('0x66')]);}})[_0xdf30('0x2f')](respondWithStatusCode(_0x161903,null))['catch'](handleError(_0x161903,null));};exports[_0xdf30('0x6b')]=function(_0x2984ea,_0x2c27da,_0x47028b){var _0x2b263={'channel':'sms'};var _0x530f1b=[];var _0x82051=[];var _0x204459={};return db[_0xdf30('0x3a')][_0xdf30('0x53')]({'where':{'id':_0x2984ea['params']['id']},'include':[{'model':db[_0xdf30('0x6c')],'as':_0xdf30('0x6d')}]})[_0xdf30('0x2f')](handleEntityNotFound(_0x2c27da,null))['then'](function(_0x17411f){_0x2b263[_0xdf30('0x6e')]=_0x17411f;_0x2b263[_0xdf30('0x6f')]=_[_0xdf30('0x70')](_0x17411f[_0xdf30('0x6d')],[_0xdf30('0x71')],[_0xdf30('0x72')]);if(_0x2b263[_0xdf30('0x6e')][_0xdf30('0x6d')]){delete _0x2b263[_0xdf30('0x6e')]['Applications'];}return db[_0xdf30('0x73')][_0xdf30('0x74')]();})['then'](function(_0x2b4c0f){if(!_0x2b4c0f){throw new db[(_0xdf30('0x75'))][(_0xdf30('0x76'))](_0xdf30('0x77'));}_0x530f1b=_[_0xdf30('0x78')](_[_0xdf30('0x3f')](_0x2b4c0f),['createdAt','updatedAt']);_0x82051=_[_0xdf30('0x78')](_[_0xdf30('0x3f')](_0x2b4c0f),['createdAt','updatedAt',_0xdf30('0x79'),_0xdf30('0x7a')]);_0x2b263[_0xdf30('0x55')]={'mapKey':_0xdf30('0x7b')};if(_0x2b263[_0xdf30('0x6e')][_0xdf30('0x4a')]){switch(_0x2b263[_0xdf30('0x6e')][_0xdf30('0x4a')]){case'twilio':_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')]=_0x2984ea['body'][_0xdf30('0x7d')];_0x2b263[_0xdf30('0x55')]['body']=_0x2984ea[_0xdf30('0x55')]['Body'];_0x2b263[_0xdf30('0x55')][_0xdf30('0x7e')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x7f')];break;case'skebby':_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')]='+'+_0x2984ea[_0xdf30('0x55')][_0xdf30('0x80')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x55')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x81')];break;case _0xdf30('0x82'):_0x2b263[_0xdf30('0x55')]['from']=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x7c')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x55')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x22')];break;case _0xdf30('0x83'):_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x7c')];_0x2b263[_0xdf30('0x55')]['body']=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x55')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x7e')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x84')];break;case'plivo':_0x2b263[_0xdf30('0x55')]['from']=_0x2984ea['body'][_0xdf30('0x7d')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x55')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x85')];_0x2b263['body'][_0xdf30('0x7e')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x86')];break;case _0xdf30('0x87'):_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')]='+'+_0x2984ea['body'][_0xdf30('0x88')][0x0][_0xdf30('0x7c')];_0x2b263['body'][_0xdf30('0x55')]=_0x2984ea['body']['results'][0x0][_0xdf30('0x81')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x7e')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x88')][0x0]['messageId'];break;case'csc':_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')]=_0x2984ea['body'][_0xdf30('0x89')];_0x2b263[_0xdf30('0x55')]['body']=_0x2984ea[_0xdf30('0x55')]['segmentedMessage'][_0xdf30('0x22')];break;case _0xdf30('0x8a'):_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x8b')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x55')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x81')];_0x2b263[_0xdf30('0x55')][_0xdf30('0x7e')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x8c')];break;case'intelepeer':_0x2b263[_0xdf30('0x55')]['from']=_0x2984ea['body']['from'];_0x2b263[_0xdf30('0x55')][_0xdf30('0x55')]=_0x2984ea[_0xdf30('0x55')][_0xdf30('0x22')];_0x2b263[_0xdf30('0x55')]['messageId']=_0x2984ea[_0xdf30('0x55')]['refid'];break;}}if(_0x2b263[_0xdf30('0x55')]['id']){delete _0x2b263[_0xdf30('0x55')]['id'];}if(_[_0xdf30('0x8d')](_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')])){throw new db[(_0xdf30('0x75'))][(_0xdf30('0x76'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2b263[_0xdf30('0x55')][_0xdf30('0x55')])||_0x2b263['body'][_0xdf30('0x55')]===''){throw new db[(_0xdf30('0x75'))]['ValidationError'](_0xdf30('0x8e'));}if(_[_0xdf30('0x8d')](_0x2b263[_0xdf30('0x55')][_0xdf30('0x8f')])){throw new db[(_0xdf30('0x75'))]['ValidationError'](_0xdf30('0x90')+_0x82051);}if(!_[_0xdf30('0x91')](_0x82051,_0x2b263['body']['mapKey'])){throw new db[(_0xdf30('0x75'))][(_0xdf30('0x76'))](_0xdf30('0x92')+_0x82051);}_0x204459[_0x2b263[_0xdf30('0x55')]['mapKey']]=_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')];return db[_0xdf30('0x93')][_0xdf30('0x53')]({'where':{'id':_0x2b263[_0xdf30('0x6e')]['ListId']},'include':[{'model':db['CmContact'],'as':_0xdf30('0x94'),'where':_0x204459,'limit':0x1,'order':[[_0xdf30('0x95'),_0xdf30('0x96')]]}]});})[_0xdf30('0x2f')](handleEntityNotFound(_0x2c27da,null))['then'](function(_0x3aa3c5){if(_0x3aa3c5){_0x2b263['list']=_[_0xdf30('0x97')](_0x3aa3c5,[_0xdf30('0x94')]);if(_0x3aa3c5[_0xdf30('0x94')][_0xdf30('0x61')]){return _0x3aa3c5[_0xdf30('0x94')][0x0];}var _0x1c2e5b=_['defaults'](_0x2b263['body'],{'firstName':_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')],'ListId':_0x3aa3c5['id']});_0x1c2e5b[_0x2b263[_0xdf30('0x55')][_0xdf30('0x8f')]]=_0x2b263['body']['from'];return db['CmContact'][_0xdf30('0x54')](_0x1c2e5b,{'fields':_0x530f1b,'raw':!![]});}})[_0xdf30('0x2f')](handleEntityNotFound(_0x2c27da,null))[_0xdf30('0x2f')](function(_0x9693f2){if(_0x9693f2){_0x2b263[_0xdf30('0x98')]=_0x9693f2;var _0x1ae58d={'ContactId':_0x9693f2['id'],'phone':_0x2b263[_0xdf30('0x55')][_0xdf30('0x7c')],'SmsAccountId':_0x2984ea[_0xdf30('0x5c')]['id']};var _0x388aad={'ContactId':_0x9693f2['id'],'SmsAccountId':_0x2984ea[_0xdf30('0x5c')]['id'],'closed':![]};return db[_0xdf30('0x99')]['find']({'where':_0x388aad})['then'](function(_0x2a55f6){if(_0x2a55f6){return[_0x2a55f6,![]];}return db['SmsInteraction'][_0xdf30('0x54')](_0x1ae58d)[_0xdf30('0x2f')](function(_0x30b9d9){return[_0x30b9d9,!![]];});});}})['spread'](function(_0x23a2c6,_0x5fa398){_0x2b263[_0xdf30('0x9a')]=_0x23a2c6['get']({'plain':!![]});_0x2b263[_0xdf30('0x9a')][_0xdf30('0x9b')]=![];if(_0x5fa398){if(_0x2b263[_0xdf30('0x6e')]['autoclose']){_0x2b263['applications'][_0xdf30('0x9c')]({'id':0x0,'priority':_0x2b263[_0xdf30('0x6f')][_0xdf30('0x61')]+0x1,'app':_0xdf30('0x9d'),'appdata':'unmanaged','interval':_0xdf30('0x9e')});}_0x2b263[_0xdf30('0x9a')][_0xdf30('0x9b')]=!![];}return db[_0xdf30('0x9f')][_0xdf30('0x54')]({'phone':_0x2b263[_0xdf30('0x55')]['from'],'messageId':_0x2b263[_0xdf30('0x55')]['messageId'],'body':_0x2b263['body']['body'],'SmsAccountId':_0x2984ea[_0xdf30('0x5c')]['id'],'SmsInteractionId':_0x23a2c6['id'],'direction':'in','ContactId':_0x23a2c6[_0xdf30('0xa0')],'AttachmentId':_0x2b263[_0xdf30('0x55')][_0xdf30('0xa1')]});})[_0xdf30('0x2f')](function(_0x4bd539){_0x2b263[_0xdf30('0x22')]=_0x4bd539;if(_0x2b263[_0xdf30('0x9a')][_0xdf30('0xa2')]){return db[_0xdf30('0xa3')][_0xdf30('0x53')]({'attributes':['id',_0xdf30('0x35')],'where':{'id':_0x2b263['interaction'][_0xdf30('0xa2')]}})[_0xdf30('0x2f')](function(_0x2c1010){if(_0x2c1010){_0x2b263[_0xdf30('0x6f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdf30('0xa4'),'appdata':_0x2c1010[_0xdf30('0x35')]+','+(_0x2b263[_0xdf30('0x6e')][_0xdf30('0xa5')]||0xa),'interval':_0xdf30('0x9e')});}return respondWithRpcPromise(_0xdf30('0xa6'),'startRouting',_0x2b263);});}return respondWithRpcPromise('Start','startRouting',_0x2b263);})[_0xdf30('0x2f')](function(_0x42ac8c){if(_0x42ac8c){var _0x212f3f=0xc8;var _0x484115=_0xdf30('0xa7');logger[_0xdf30('0x1b')](_0xdf30('0x1e'),_0x484115,_0x212f3f,_0xdf30('0xa8'));logger[_0xdf30('0x1d')](_0xdf30('0xa9'),_0x484115,_0x212f3f,_0xdf30('0xa8'),JSON['stringify'](_0x42ac8c));if(_0x2b263[_0xdf30('0x6e')][_0xdf30('0x4a')]===_0xdf30('0xaa')){return _0x2c27da['status'](_0x212f3f)[_0xdf30('0xab')](_0xdf30('0xac'),'text/xml')['send'](_0xdf30('0xad'));}else{return _0x2c27da[_0xdf30('0x25')](_0x212f3f)[_0xdf30('0x27')](_0x42ac8c);}}})[_0xdf30('0x50')](handleError(_0x2c27da,null));};exports[_0xdf30('0xae')]=function(_0x149479,_0x22e0a0,_0x1568cb){return db[_0xdf30('0x3a')]['findOne']({'where':{'id':_0x149479[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x22e0a0,null))['then'](function(_0xdd5b9c){if(_0xdd5b9c){return db['sequelize']['transaction'](function(_0x272bce){return db['SmsApplication'][_0xdf30('0x30')]({'where':{'SmsAccountId':_0x149479[_0xdf30('0x5c')]['id']},'transaction':_0x272bce})['then'](function(_0xcc672e){var _0x5d4b8=_[_0xdf30('0x39')](_0x149479[_0xdf30('0x55')],function(_0x557079){_0x557079[_0xdf30('0x63')]=_0x149479['params']['id'];return _0x557079;});return db[_0xdf30('0x6c')]['bulkCreate'](_0x5d4b8,{'transaction':_0x272bce});});})[_0xdf30('0x2f')](function(){return db[_0xdf30('0x6c')][_0xdf30('0xaf')]({'where':{'SmsAccountId':_0x149479[_0xdf30('0x5c')]['id']},'order':_0xdf30('0x71')});});}})[_0xdf30('0x2f')](respondWithResult(_0x22e0a0,null))['catch'](handleError(_0x22e0a0,null));};exports[_0xdf30('0xb0')]=function(_0xa80162,_0x412cab,_0x52212b){var _0x1cd0a4={};var _0xcfbdf2={};var _0xf77801;var _0x323afe;return db[_0xdf30('0x3a')][_0xdf30('0x60')]({'where':{'id':_0xa80162['params']['id']}})['then'](handleEntityNotFound(_0x412cab,null))[_0xdf30('0x2f')](function(_0x1d83f0){if(_0x1d83f0){_0xf77801=_0x1d83f0;_0xcfbdf2[_0xdf30('0x3d')]=_['keys'](db[_0xdf30('0x6c')][_0xdf30('0x3b')]);_0xcfbdf2[_0xdf30('0x3e')]=_[_0xdf30('0x3f')](_0xa80162[_0xdf30('0x3e')]);_0xcfbdf2[_0xdf30('0x40')]=_[_0xdf30('0x41')](_0xcfbdf2['model'],_0xcfbdf2[_0xdf30('0x3e')]);_0x1cd0a4['attributes']=_[_0xdf30('0x41')](_0xcfbdf2['model'],qs[_0xdf30('0x43')](_0xa80162['query'][_0xdf30('0x43')]));_0x1cd0a4[_0xdf30('0x42')]=_0x1cd0a4[_0xdf30('0x42')]['length']?_0x1cd0a4[_0xdf30('0x42')]:_0xcfbdf2[_0xdf30('0x3d')];_0x1cd0a4[_0xdf30('0x45')]=qs[_0xdf30('0x46')](_0xa80162['query'][_0xdf30('0x46')]);_0x1cd0a4['where']=qs[_0xdf30('0x40')](_[_0xdf30('0x48')](_0xa80162[_0xdf30('0x3e')],_0xcfbdf2[_0xdf30('0x40')]));if(_0xa80162[_0xdf30('0x3e')]['filter']){_0x1cd0a4[_0xdf30('0x47')]=_['merge'](_0x1cd0a4['where'],{'$or':_[_0xdf30('0x39')](_0x1cd0a4[_0xdf30('0x42')],function(_0x18862a){var _0x12e766={};_0x12e766[_0x18862a]={'$like':'%'+_0xa80162[_0xdf30('0x3e')][_0xdf30('0xb1')]+'%'};return _0x12e766;})});}_0x1cd0a4=_['merge']({},_0x1cd0a4,_0xa80162[_0xdf30('0x52')]);return _0xf77801[_0xdf30('0xb0')](_0x1cd0a4);}})[_0xdf30('0x2f')](function(_0x35f950){if(_0x35f950){_0x323afe=_0x35f950[_0xdf30('0x61')];if(!_0xa80162[_0xdf30('0x3e')][_0xdf30('0x44')](_0xdf30('0x62'))){_0x1cd0a4[_0xdf30('0x29')]=qs[_0xdf30('0x29')](_0xa80162[_0xdf30('0x3e')][_0xdf30('0x29')]);_0x1cd0a4[_0xdf30('0x28')]=qs[_0xdf30('0x28')](_0xa80162[_0xdf30('0x3e')][_0xdf30('0x28')]);}return _0xf77801[_0xdf30('0xb0')](_0x1cd0a4);}})[_0xdf30('0x2f')](function(_0x100525){if(_0x100525){return _0x100525?{'count':_0x323afe,'rows':_0x100525}:null;}})[_0xdf30('0x2f')](respondWithResult(_0x412cab,null))['catch'](handleError(_0x412cab,null));};exports['getInteractions']=function(_0x49239e,_0xafd31f,_0x547500){var _0x36c87a={'raw':![],'where':{}};var _0x42c392={};var _0x291635={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x49239e[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0xafd31f,null))[_0xdf30('0x2f')](function(_0x349a0e){if(_0x349a0e){_0x42c392[_0xdf30('0x3d')]=_[_0xdf30('0x3f')](db[_0xdf30('0x99')][_0xdf30('0x3b')]);_0x42c392[_0xdf30('0x3e')]=_['keys'](_0x49239e[_0xdf30('0x3e')]);_0x42c392[_0xdf30('0x40')]=_['intersection'](_0x42c392[_0xdf30('0x3d')],_0x42c392[_0xdf30('0x3e')]);_0x36c87a[_0xdf30('0x42')]=_['intersection'](_0x42c392[_0xdf30('0x3d')],qs[_0xdf30('0x43')](_0x49239e[_0xdf30('0x3e')][_0xdf30('0x43')]));_0x36c87a['attributes']=_0x36c87a[_0xdf30('0x42')][_0xdf30('0x61')]?_0x36c87a['attributes']:_0x42c392[_0xdf30('0x3d')];if(!_0x49239e['query']['hasOwnProperty']('nolimit')){_0x36c87a[_0xdf30('0x29')]=qs[_0xdf30('0x29')](_0x49239e[_0xdf30('0x3e')][_0xdf30('0x29')]);_0x36c87a[_0xdf30('0x28')]=qs[_0xdf30('0x28')](_0x49239e[_0xdf30('0x3e')][_0xdf30('0x28')]);}_0x36c87a[_0xdf30('0x45')]=qs[_0xdf30('0x46')](_0x49239e['query'][_0xdf30('0x46')]);_0x36c87a[_0xdf30('0x47')]=qs['filters'](_[_0xdf30('0x48')](_0x49239e[_0xdf30('0x3e')],_0x42c392[_0xdf30('0x40')]));_0x36c87a['where']['SmsAccountId']=_0x349a0e['id'];if(_0x49239e[_0xdf30('0x3e')][_0xdf30('0xb1')]){_0x36c87a[_0xdf30('0x47')]=_[_0xdf30('0x49')](_0x36c87a[_0xdf30('0x47')],{'$or':_['map'](_0x36c87a[_0xdf30('0x42')],function(_0x15380c){var _0x4c1361={};_0x4c1361[_0x15380c]={'$like':'%'+_0x49239e[_0xdf30('0x3e')][_0xdf30('0xb1')]+'%'};return _0x4c1361;})});}_0x36c87a=_['merge']({},_0x36c87a,_0x49239e['options']);return db[_0xdf30('0x99')][_0xdf30('0x4c')]({'where':_0x36c87a[_0xdf30('0x47')]})['then'](function(_0x2c4af0){_0x291635[_0xdf30('0x4c')]=_0x2c4af0;if(_0x49239e[_0xdf30('0x3e')]['includeAll']){_0x36c87a[_0xdf30('0x64')]=[{'model':db[_0xdf30('0x73')],'as':_0xdf30('0xb2'),'required':![]},{'model':db[_0xdf30('0xa3')],'as':'Owner','attributes':[_0xdf30('0x35'),_0xdf30('0xb3'),_0xdf30('0xb4')],'required':![]},{'model':db[_0xdf30('0xb5')],'as':_0xdf30('0xb6'),'attributes':['id',_0xdf30('0x35'),_0xdf30('0xb7')],'where':_0x49239e['query'][_0xdf30('0xb8')]?{'id':_0x49239e[_0xdf30('0x3e')][_0xdf30('0xb8')]}:undefined,'required':_0x49239e[_0xdf30('0x3e')]['tag']?!![]:![]}];}return db[_0xdf30('0x99')][_0xdf30('0x4e')](_0x36c87a);})[_0xdf30('0x2f')](function(_0x496556){_0x291635[_0xdf30('0x4f')]=_0x496556;return _0x291635;});}})['then'](respondWithFilteredResult(_0xafd31f,_0x36c87a))[_0xdf30('0x50')](handleError(_0xafd31f,null));};exports[_0xdf30('0x36')]=function(_0x28b6b4,_0x255486,_0x814aa4){var _0x855b50,_0xfc454,_0x1f325d;if(_[_0xdf30('0x8d')](_0x28b6b4[_0xdf30('0x55')][_0xdf30('0x55')])||_0x28b6b4[_0xdf30('0x55')][_0xdf30('0x55')]===''){throw new db['Sequelize'][(_0xdf30('0x76'))](_0xdf30('0x8e'));}if(_['isNil'](_0x28b6b4['body']['to'])){throw new db[(_0xdf30('0x75'))]['ValidationError'](_0xdf30('0xb9'));}_0x855b50=_0x28b6b4[_0xdf30('0x55')]['to'];return db['SmsAccount'][_0xdf30('0x53')]({'where':{'id':_0x28b6b4[_0xdf30('0x5c')]['id']},'include':[{'model':db[_0xdf30('0x93')],'as':'List','include':[{'model':db[_0xdf30('0x73')],'as':_0xdf30('0x94'),'where':{'mobile':_0x855b50},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xdf30('0x2f')](handleEntityNotFound(_0x255486,null))[_0xdf30('0x2f')](function(_0x3ed858){if(_0x3ed858&&_0x3ed858[_0xdf30('0xba')]){_0xfc454=_0x3ed858[_0xdf30('0x31')]({'plain':!![]});if(_0xfc454[_0xdf30('0xba')]&&_0xfc454[_0xdf30('0xba')]['Contacts'][_0xdf30('0x61')]){return _0xfc454[_0xdf30('0xba')][_0xdf30('0x94')][0x0];}return db['CmContact']['create'](_[_0xdf30('0xbb')](_0x28b6b4[_0xdf30('0x55')],{'firstName':_0x855b50,'mobile':_0x855b50,'phone':_0x855b50,'ListId':_0xfc454['ListId']}));}})[_0xdf30('0x2f')](handleEntityNotFound(_0x255486,null))[_0xdf30('0x2f')](function(_0x565ac7){if(_0x565ac7){_0x1f325d=_0x565ac7;return db['SmsInteraction'][_0xdf30('0x53')]({'where':{'ContactId':_0x1f325d['id'],'closed':![],'SmsAccountId':_0xfc454['id']}})['then'](function(_0x39ffc9){if(_0x39ffc9){return[_0x39ffc9,![]];}return db[_0xdf30('0x99')]['create']({'UserId':_0x28b6b4[_0xdf30('0x56')]['id'],'ContactId':_0x1f325d['id'],'SmsAccountId':_0xfc454['id'],'phone':_0x855b50,'firstMsgDirection':_0xdf30('0xbc'),'Messages':[_[_0xdf30('0x49')](_0x28b6b4['body'],{'read':![],'body':_0x28b6b4[_0xdf30('0x55')][_0xdf30('0x55')],'phone':_0x855b50,'SmsAccountId':_0xfc454['id'],'UserId':_0x28b6b4['user']['id'],'ContactId':_0x1f325d['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xdf30('0x2f')](function(_0x13e495){return[_0x13e495,!![]];});});}})[_0xdf30('0xbd')](function(_0x3e018f,_0x31677c){if(_0x31677c){return _0x3e018f;}return db[_0xdf30('0x9f')]['create'](_[_0xdf30('0x49')](_0x28b6b4[_0xdf30('0x55')],{'read':![],'body':_0x28b6b4[_0xdf30('0x55')][_0xdf30('0x55')],'phone':_0x855b50,'SmsAccountId':_0xfc454['id'],'SmsInteractionId':_0x3e018f['id'],'UserId':_0x28b6b4[_0xdf30('0x56')]['id'],'ContactId':_0x1f325d['id']}))[_0xdf30('0x2f')](function(_0x12a665){_0x3e018f[_0xdf30('0xbe')][_0xdf30('0xbf')]=[];_0x3e018f[_0xdf30('0xbe')]['Messages'][_0xdf30('0x9c')](_0x12a665[_0xdf30('0xbe')]);return _0x3e018f;});})[_0xdf30('0x2f')](respondWithResult(_0x255486,null))[_0xdf30('0x50')](handleError(_0x255486,null));};exports[_0xdf30('0x25')]=function(_0x50185d,_0x22653f,_0x1e18c1){if(_0x50185d['body']['id']){delete _0x50185d[_0xdf30('0x55')]['id'];}console[_0xdf30('0xc0')]('endpoint\x20/status\x20POST\x20/',_0x50185d['body']);var _0x38f06e,_0x109fa9,_0x450716;return db['SmsAccount'][_0xdf30('0x53')]({'where':{'id':_0x50185d[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x22653f,null))['then'](function(_0xc5ba8){if(_0xc5ba8){_0x450716=_0xc5ba8;logger[_0xdf30('0x1d')](_0xdf30('0x1e'),_0xdf30('0x25'),_0xdf30('0xc1'),_0xc5ba8['type'],util['inspect'](_0x50185d[_0xdf30('0x55')],{'showHidden':![],'depth':null}));switch(_0xc5ba8[_0xdf30('0x4a')]){case'skebby':if(_0x50185d[_0xdf30('0x55')][_0xdf30('0xc2')]&&_0x50185d['body'][_0xdf30('0x25')]){_0x109fa9=_0x50185d['body'][_0xdf30('0x25')];return db[_0xdf30('0x9f')][_0xdf30('0x53')]({'where':{'messageId':_0x50185d[_0xdf30('0x55')][_0xdf30('0xc2')]}});}break;case _0xdf30('0x82'):if(_0x50185d[_0xdf30('0x55')]['requestid']&&_0x50185d[_0xdf30('0x55')][_0xdf30('0xc3')]){_0x109fa9=_0x50185d['body'][_0xdf30('0xc3')];return db[_0xdf30('0x9f')][_0xdf30('0x53')]({'where':{'messageId':_0x50185d[_0xdf30('0x55')]['requestid']}});}break;case _0xdf30('0x83'):if(_0x50185d[_0xdf30('0x55')]['message_id']&&_0x50185d[_0xdf30('0x55')][_0xdf30('0xc4')]){_0x109fa9=_0x50185d['body'][_0xdf30('0xc4')];return db[_0xdf30('0x9f')][_0xdf30('0x53')]({'where':{'messageId':_0x50185d['body']['message_id']}});}break;case'infobip':var _0x2de4b8=_0x50185d[_0xdf30('0x55')][_0xdf30('0x88')][0x0];if(_0x2de4b8[_0xdf30('0x7e')]&&_0x2de4b8[_0xdf30('0x25')][_0xdf30('0xc5')]==='DELIVERED'){_0x109fa9=_0x2de4b8[_0xdf30('0x25')]['groupName'];return db[_0xdf30('0x9f')][_0xdf30('0x53')]({'where':{'messageId':_0x2de4b8[_0xdf30('0x7e')]}});}break;case'clickatell':if(_0x50185d[_0xdf30('0x55')][_0xdf30('0x7e')]&&_0x50185d[_0xdf30('0x55')][_0xdf30('0x25')]){_0x109fa9=_0x50185d[_0xdf30('0x55')][_0xdf30('0x25')];return db[_0xdf30('0x9f')][_0xdf30('0x53')]({'where':{'messageId':_0x50185d[_0xdf30('0x55')][_0xdf30('0x7e')]}});}break;case'intelepeer':if(_0x50185d[_0xdf30('0x55')][_0xdf30('0xc6')]&&_0x50185d['body'][_0xdf30('0x25')]){_0x109fa9=_0x50185d[_0xdf30('0x55')][_0xdf30('0x25')];return db['SmsMessage'][_0xdf30('0x53')]({'where':{'messageId':_0x50185d['body'][_0xdf30('0xc6')]}});}break;}}})[_0xdf30('0x2f')](handleEntityNotFound(_0x22653f,null))[_0xdf30('0x2f')](function(_0x3c1fd2){if(_0x3c1fd2){_0x38f06e=_0x3c1fd2;switch(_0x450716[_0xdf30('0x4a')]){case _0xdf30('0xc7'):if(_0x109fa9===_0xdf30('0xc8')){return _0x38f06e[_0xdf30('0x2e')]({'read':!![]});}else{logger[_0xdf30('0x20')](_0xdf30('0x1e'),_0xdf30('0x25'),_0xdf30('0xc7'),util[_0xdf30('0xc9')](_0x50185d['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x109fa9==='1'){return _0x38f06e['update']({'read':!![]});}else{logger[_0xdf30('0x20')](_0xdf30('0x1e'),_0xdf30('0x25'),_0xdf30('0xc7'),util[_0xdf30('0xc9')](_0x50185d[_0xdf30('0x55')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x50185d[_0xdf30('0x55')][_0xdf30('0xca')]&&_0x109fa9>=0xc8&&_0x109fa9<=0xce){return _0x38f06e[_0xdf30('0x2e')]({'read':!![]});}else{logger['error'](_0xdf30('0x1e'),_0xdf30('0x25'),_0xdf30('0x83'),util[_0xdf30('0xc9')](_0x50185d[_0xdf30('0x55')],{'showHidden':![],'depth':null}));}break;case _0xdf30('0x87'):var _0x3ebbdd=_0x50185d[_0xdf30('0x55')][_0xdf30('0x88')][0x0];if(_0x3ebbdd[_0xdf30('0x25')]['groupName']===_0xdf30('0xc8')){return _0x38f06e[_0xdf30('0x2e')]({'read':!![]});}else{logger[_0xdf30('0x20')](_0xdf30('0x1e'),'status',_0xdf30('0x87'),util[_0xdf30('0xc9')](_0x50185d[_0xdf30('0x55')],{'showHidden':![],'depth':null}));}break;case _0xdf30('0x8a'):if(_0x109fa9==_0xdf30('0xcb')||_0x109fa9==_0xdf30('0xcc')){return _0x38f06e[_0xdf30('0x2e')]({'read':!![]});}else{logger['error'](_0xdf30('0x1e'),'status','clickatell',util['inspect'](_0x50185d['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x109fa9===_0xdf30('0xcd')||_0x109fa9===_0xdf30('0xce')){return _0x38f06e['update']({'read':!![]});}else{logger[_0xdf30('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdf30('0x25'),_0xdf30('0xcf'),util[_0xdf30('0xc9')](_0x50185d[_0xdf30('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x38f06e;}})[_0xdf30('0x2f')](respondWithResult(_0x22653f,null))[_0xdf30('0x50')](handleError(_0x22653f,null));};exports[_0xdf30('0xd0')]=function(_0x1c530e,_0x1d5047,_0x24fca5){var _0xdb5f2d,_0x1ee84e,_0xc0a6dc;return db['SmsAccount'][_0xdf30('0x53')]({'where':{'id':_0x1c530e['params']['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x1d5047,null))['then'](function(_0x4ec1b0){if(_0x4ec1b0){_0xc0a6dc=_0x4ec1b0;logger[_0xdf30('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdf30('0x25'),_0xdf30('0xc1'),_0x4ec1b0['type'],util[_0xdf30('0xc9')](_0x1c530e[_0xdf30('0x3e')],{'showHidden':![],'depth':null}));switch(_0x4ec1b0[_0xdf30('0x4a')]){case _0xdf30('0xd1'):if(_0x1c530e[_0xdf30('0x3e')][_0xdf30('0xd2')]&&_0x1c530e[_0xdf30('0x3e')][_0xdf30('0xd3')]){_0x1ee84e=_0x1c530e[_0xdf30('0x3e')][_0xdf30('0xd3')];return db[_0xdf30('0x9f')][_0xdf30('0x53')]({'where':{'messageId':_0x1c530e[_0xdf30('0x3e')][_0xdf30('0xd2')]}});}break;}}})[_0xdf30('0x2f')](handleEntityNotFound(_0x1d5047,null))[_0xdf30('0x2f')](function(_0x44e096){if(_0x44e096){_0xdb5f2d=_0x44e096;switch(_0xc0a6dc[_0xdf30('0x4a')]){case _0xdf30('0xd1'):if(_0x1ee84e==='2'||_0x1ee84e==='6'){return _0xdb5f2d[_0xdf30('0x2e')]({'read':!![]});}else{logger['error'](_0xdf30('0x1e'),_0xdf30('0x25'),'csc',util[_0xdf30('0xc9')](_0x1c530e[_0xdf30('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0xdb5f2d;}})[_0xdf30('0x2f')](respondWithResult(_0x1d5047,null))[_0xdf30('0x50')](handleError(_0x1d5047,null));};exports['addAgents']=function(_0x295aee,_0x1dc215,_0x378963){return db[_0xdf30('0x3a')]['find']({'where':{'id':_0x295aee[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x1dc215,null))[_0xdf30('0x2f')](function(_0x2c8041){if(_0x2c8041){return _0x2c8041[_0xdf30('0xd4')](_0x295aee[_0xdf30('0x55')]['ids'],_[_0xdf30('0x97')](_0x295aee[_0xdf30('0x55')],[_0xdf30('0x66'),'id'])||{})[_0xdf30('0xbd')](function(_0x15376a){for(var _0x18c65a=0x0;_0x18c65a<_0x295aee[_0xdf30('0x55')][_0xdf30('0x66')]['length'];_0x18c65a+=0x1){socket[_0xdf30('0xd5')](_0xdf30('0xd6'),{'UserId':_0x295aee[_0xdf30('0x55')][_0xdf30('0x66')][_0x18c65a],'SmsAccountId':_0x295aee['params']['id']});}return _0x15376a;});}})[_0xdf30('0x2f')](respondWithResult(_0x1dc215,null))['catch'](handleError(_0x1dc215,null));};exports[_0xdf30('0xd7')]=function(_0x154bc9,_0x3f5ed4,_0x5a7e5e){return db[_0xdf30('0x3a')][_0xdf30('0x53')]({'where':{'id':_0x154bc9[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x3f5ed4,null))[_0xdf30('0x2f')](function(_0x525e2e){if(_0x525e2e){return _0x525e2e[_0xdf30('0xd7')](_0x154bc9[_0xdf30('0x3e')]['ids'])[_0xdf30('0x2f')](function(){if(_['isArray'](_0x154bc9['query'][_0xdf30('0x66')])){for(var _0x3ea9b4=0x0;_0x3ea9b4<_0x154bc9['query'][_0xdf30('0x66')][_0xdf30('0x61')];_0x3ea9b4+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x154bc9[_0xdf30('0x3e')][_0xdf30('0x66')][_0x3ea9b4]),'SmsAccountId':Number(_0x154bc9[_0xdf30('0x5c')]['id'])});}}else{socket[_0xdf30('0xd5')]('userSmsAccount:remove',{'UserId':Number(_0x154bc9['query'][_0xdf30('0x66')]),'SmsAccountId':Number(_0x154bc9[_0xdf30('0x5c')]['id'])});}});}})[_0xdf30('0x2f')](respondWithStatusCode(_0x3f5ed4,null))[_0xdf30('0x50')](handleError(_0x3f5ed4,null));};exports[_0xdf30('0xd8')]=function(_0x22ae30,_0x42c8a2,_0x92892d){var _0x311078={};var _0x3c503a={};var _0x366a7e;var _0x53d535;return db[_0xdf30('0x3a')][_0xdf30('0x60')]({'where':{'id':_0x22ae30[_0xdf30('0x5c')]['id']}})[_0xdf30('0x2f')](handleEntityNotFound(_0x42c8a2,null))[_0xdf30('0x2f')](function(_0x2bf64e){if(_0x2bf64e){_0x366a7e=_0x2bf64e;_0x3c503a[_0xdf30('0x3d')]=_[_0xdf30('0x3f')](db[_0xdf30('0xa3')][_0xdf30('0x3b')]);_0x3c503a['query']=_[_0xdf30('0x3f')](_0x22ae30[_0xdf30('0x3e')]);_0x3c503a['filters']=_[_0xdf30('0x41')](_0x3c503a[_0xdf30('0x3d')],_0x3c503a[_0xdf30('0x3e')]);_0x311078[_0xdf30('0x42')]=_['intersection'](_0x3c503a[_0xdf30('0x3d')],qs['fields'](_0x22ae30[_0xdf30('0x3e')][_0xdf30('0x43')]));_0x311078[_0xdf30('0x42')]=_0x311078[_0xdf30('0x42')][_0xdf30('0x61')]?_0x311078['attributes']:_0x3c503a['model'];_0x311078[_0xdf30('0x45')]=qs['sort'](_0x22ae30[_0xdf30('0x3e')]['sort']);_0x311078[_0xdf30('0x47')]=qs[_0xdf30('0x40')](_[_0xdf30('0x48')](_0x22ae30[_0xdf30('0x3e')],_0x3c503a['filters']));if(_0x22ae30['query']['filter']){_0x311078[_0xdf30('0x47')]=_[_0xdf30('0x49')](_0x311078['where'],{'$or':_[_0xdf30('0x39')](_0x311078['attributes'],function(_0x3fbf2a){var _0x13a553={};_0x13a553[_0x3fbf2a]={'$like':'%'+_0x22ae30['query']['filter']+'%'};return _0x13a553;})});}_0x311078=_['merge']({},_0x311078,_0x22ae30[_0xdf30('0x52')]);return _0x366a7e[_0xdf30('0xd8')](_0x311078);}})[_0xdf30('0x2f')](function(_0x28b3ca){if(_0x28b3ca){_0x53d535=_0x28b3ca[_0xdf30('0x61')];if(!_0x22ae30[_0xdf30('0x3e')]['hasOwnProperty'](_0xdf30('0x62'))){_0x311078['limit']=qs[_0xdf30('0x29')](_0x22ae30[_0xdf30('0x3e')][_0xdf30('0x29')]);_0x311078['offset']=qs['offset'](_0x22ae30['query'][_0xdf30('0x28')]);}return _0x366a7e[_0xdf30('0xd8')](_0x311078);}})['then'](function(_0x5c1c88){if(_0x5c1c88){return _0x5c1c88?{'count':_0x53d535,'rows':_0x5c1c88}:null;}})[_0xdf30('0x2f')](respondWithResult(_0x42c8a2,null))[_0xdf30('0x50')](handleError(_0x42c8a2,null));}; \ No newline at end of file +var _0x4021=['clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','intelepeer','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','state','message-id','csc','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','SmsAccount','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','Disposition','getDispositions','order','rows','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','sms','SmsApplication','Applications','account','orderBy','priority','asc','Sequelize','ValidationError','difference','createdAt','updatedAt','mobile','from','From','Body','MessageSid','skebby','messageId','message_id','plivo','Text','infobip','text','results','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','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','CmContact','Contacts','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','findOne','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','dataValues','log','debug','inspect','skebby_dispatch_id','connectel','requestid','statusInt'];(function(_0x425d5e,_0x3b9040){var _0x3cc67b=function(_0x121446){while(--_0x121446){_0x425d5e['push'](_0x425d5e['shift']());}};_0x3cc67b(++_0x3b9040);}(_0x4021,0x1e1));var _0x1402=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x4021[_0x322522];return _0x293bcf;};'use strict';var pdf=require(_0x1402('0x0'));var emlformat=require(_0x1402('0x1'));var rimraf=require(_0x1402('0x2'));var zipdir=require(_0x1402('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1402('0x4'));var moment=require(_0x1402('0x5'));var BPromise=require(_0x1402('0x6'));var Mustache=require(_0x1402('0x7'));var util=require(_0x1402('0x8'));var path=require(_0x1402('0x9'));var sox=require(_0x1402('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1402('0xb'));var squel=require(_0x1402('0xc'));var crypto=require(_0x1402('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1402('0xe'));var toCsv=require(_0x1402('0xf'));var querystring=require(_0x1402('0x10'));var Papa=require(_0x1402('0x11'));var Redis=require(_0x1402('0x12'));var authService=require(_0x1402('0x13'));var qs=require(_0x1402('0x14'));var as=require(_0x1402('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1402('0x16'))(_0x1402('0x17'));var utils=require('../../config/utils');var config=require(_0x1402('0x18'));var licenseUtil=require(_0x1402('0x19'));var db=require(_0x1402('0x1a'))['db'];config[_0x1402('0x1b')]=_['defaults'](config[_0x1402('0x1b')],{'host':_0x1402('0x1c'),'port':0x18eb});var socket=require(_0x1402('0x1d'))(new Redis(config[_0x1402('0x1b')]));require(_0x1402('0x1e'))[_0x1402('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1402('0x20')][_0x1402('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x235c6b,_0x596077,_0x1235b1,_0x162f21){return new BPromise(function(_0x4cfb6b,_0x297dc9){var _0x323748=_0x162f21||client;return _0x323748['request'](_0x235c6b,_0x1235b1)['then'](function(_0x52fc32){logger[_0x1402('0x22')](_0x1402('0x23'),_0x596077,_0x1402('0x24'));logger['debug'](_0x1402('0x25'),_0x596077,'request\x20sent',JSON[_0x1402('0x26')](_0x52fc32));if(_0x52fc32[_0x1402('0x27')]){if(_0x52fc32[_0x1402('0x27')][_0x1402('0x28')]===0x1f4){logger[_0x1402('0x27')](_0x1402('0x23'),_0x596077,_0x52fc32[_0x1402('0x27')][_0x1402('0x29')]);return _0x297dc9(_0x52fc32[_0x1402('0x27')][_0x1402('0x29')]);}logger[_0x1402('0x27')](_0x1402('0x23'),_0x596077,_0x52fc32['error'][_0x1402('0x29')]);return _0x4cfb6b(_0x52fc32[_0x1402('0x27')][_0x1402('0x29')]);}else{logger[_0x1402('0x22')](_0x1402('0x23'),_0x596077,'request\x20sent');_0x4cfb6b(_0x52fc32[_0x1402('0x2a')]['message']);}})[_0x1402('0x2b')](function(_0x23d1e1){logger[_0x1402('0x27')](_0x1402('0x23'),_0x596077,_0x23d1e1);_0x297dc9(_0x23d1e1);});});}function respondWithStatusCode(_0x5b1e6f,_0xfa210d){_0xfa210d=_0xfa210d||0xcc;return function(_0x406fdc){if(_0x406fdc){return _0x5b1e6f[_0x1402('0x2c')](_0xfa210d);}return _0x5b1e6f['status'](_0xfa210d)[_0x1402('0x2d')]();};}function respondWithResult(_0x4c3fb3,_0x5edda1){_0x5edda1=_0x5edda1||0xc8;return function(_0xb3b77d){if(_0xb3b77d){return _0x4c3fb3[_0x1402('0x2e')](_0x5edda1)[_0x1402('0x2f')](_0xb3b77d);}};}function respondWithFilteredResult(_0x1a021b,_0x4bc293){return function(_0x55ddd9){if(_0x55ddd9){var _0x1b3ad2=_0x55ddd9[_0x1402('0x30')],_0x38fc01=_0x4bc293['offset'],_0x4eb29f=_0x4bc293[_0x1402('0x31')]+_0x4bc293[_0x1402('0x32')],_0x13b5ee;if(_0x4eb29f>=_0x1b3ad2){_0x4eb29f=_0x1b3ad2;_0x13b5ee=0xc8;}else{_0x13b5ee=0xce;}_0x1a021b[_0x1402('0x2e')](_0x13b5ee);return _0x1a021b[_0x1402('0x33')](_0x1402('0x34'),_0x38fc01+'-'+_0x4eb29f+'/'+_0x1b3ad2)[_0x1402('0x2f')](_0x55ddd9);}return null;};}function patchUpdates(_0xe63472){return function(_0x35802b){try{jsonpatch['apply'](_0x35802b,_0xe63472,!![]);}catch(_0x3ba360){return BPromise[_0x1402('0x35')](_0x3ba360);}return _0x35802b[_0x1402('0x36')]();};}function saveUpdates(_0x470d9f,_0x254543){return function(_0x5d9dd0){if(_0x5d9dd0){return _0x5d9dd0[_0x1402('0x37')](_0x470d9f)[_0x1402('0x38')](function(_0x5e2c04){return _0x5e2c04;});}return null;};}function removeEntity(_0x1ee082,_0x47b7e9){return function(_0x9ebd10){if(_0x9ebd10){return _0x9ebd10[_0x1402('0x39')]()['then'](function(){var _0x47e393=_0x9ebd10[_0x1402('0x3a')]({'plain':!![]});var _0x5dc4f7=_0x1402('0x3b');return db[_0x1402('0x3c')][_0x1402('0x39')]({'where':{'type':_0x5dc4f7,'resourceId':_0x47e393['id']}})[_0x1402('0x38')](function(){return _0x9ebd10;});})['then'](function(){_0x1ee082[_0x1402('0x2e')](0xcc)[_0x1402('0x2d')]();});}};}function handleEntityNotFound(_0x2606bd,_0x354f18){return function(_0x2ab3e2){if(!_0x2ab3e2){_0x2606bd[_0x1402('0x2c')](0x194);}return _0x2ab3e2;};}function handleError(_0x854fdd,_0x129dbb){_0x129dbb=_0x129dbb||0x1f4;return function(_0x528189){logger['error'](_0x528189[_0x1402('0x3d')]);if(_0x528189[_0x1402('0x3e')]){delete _0x528189[_0x1402('0x3e')];}_0x854fdd[_0x1402('0x2e')](_0x129dbb)[_0x1402('0x3f')](_0x528189);};}exports[_0x1402('0x40')]=function(_0x44ea46,_0x340929){var _0x595b7d={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2815e2={},_0x5b8fd4={'count':0x0,'rows':[]};var _0x2d1712=_['map'](db[_0x1402('0x41')][_0x1402('0x42')],function(_0xe2f540){return{'name':_0xe2f540[_0x1402('0x43')],'type':_0xe2f540['type']['key']};});_0x2815e2[_0x1402('0x44')]=_[_0x1402('0x45')](_0x2d1712,_0x1402('0x3e'));_0x2815e2[_0x1402('0x46')]=_[_0x1402('0x47')](_0x44ea46[_0x1402('0x46')]);_0x2815e2['filters']=_[_0x1402('0x48')](_0x2815e2[_0x1402('0x44')],_0x2815e2[_0x1402('0x46')]);_0x595b7d[_0x1402('0x49')]=_[_0x1402('0x48')](_0x2815e2[_0x1402('0x44')],qs[_0x1402('0x4a')](_0x44ea46['query'][_0x1402('0x4a')]));_0x595b7d[_0x1402('0x49')]=_0x595b7d['attributes']['length']?_0x595b7d[_0x1402('0x49')]:_0x2815e2[_0x1402('0x44')];if(!_0x44ea46[_0x1402('0x46')][_0x1402('0x4b')](_0x1402('0x4c'))){_0x595b7d[_0x1402('0x32')]=qs[_0x1402('0x32')](_0x44ea46[_0x1402('0x46')]['limit']);_0x595b7d[_0x1402('0x31')]=qs['offset'](_0x44ea46[_0x1402('0x46')]['offset']);}_0x595b7d['order']=qs[_0x1402('0x4d')](_0x44ea46['query'][_0x1402('0x4d')]);_0x595b7d[_0x1402('0x4e')]=qs[_0x1402('0x4f')](_[_0x1402('0x50')](_0x44ea46[_0x1402('0x46')],_0x2815e2[_0x1402('0x4f')]),_0x2d1712);if(_0x44ea46[_0x1402('0x46')][_0x1402('0x51')]){_0x595b7d['where']=_[_0x1402('0x52')](_0x595b7d[_0x1402('0x4e')],{'$or':_[_0x1402('0x45')](_0x2d1712,function(_0x2bf9a3){if(_0x2bf9a3[_0x1402('0x53')]!=='VIRTUAL'){var _0x151f64={};_0x151f64[_0x2bf9a3[_0x1402('0x3e')]]={'$like':'%'+_0x44ea46[_0x1402('0x46')][_0x1402('0x51')]+'%'};return _0x151f64;}})});}_0x595b7d=_[_0x1402('0x52')]({},_0x595b7d,_0x44ea46[_0x1402('0x54')]);var _0x4f415a={'where':_0x595b7d['where']};return db['SmsAccount'][_0x1402('0x30')](_0x4f415a)[_0x1402('0x38')](function(_0x4ffd3b){_0x5b8fd4[_0x1402('0x30')]=_0x4ffd3b;if(_0x44ea46[_0x1402('0x46')][_0x1402('0x55')]){_0x595b7d[_0x1402('0x56')]=[{'all':!![]}];}return db[_0x1402('0x41')][_0x1402('0x57')](_0x595b7d);})['then'](function(_0x242fe5){_0x5b8fd4['rows']=_0x242fe5;return _0x5b8fd4;})[_0x1402('0x38')](respondWithFilteredResult(_0x340929,_0x595b7d))[_0x1402('0x2b')](handleError(_0x340929,null));};exports[_0x1402('0x58')]=function(_0x3c0327,_0x3dfb77){var _0x2c37e0={'raw':![],'where':{'id':_0x3c0327[_0x1402('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x1402('0x5a')}]},_0x363761={};_0x363761[_0x1402('0x44')]=_[_0x1402('0x47')](db[_0x1402('0x41')]['rawAttributes']);_0x363761[_0x1402('0x46')]=_[_0x1402('0x47')](_0x3c0327[_0x1402('0x46')]);_0x363761[_0x1402('0x4f')]=_['intersection'](_0x363761[_0x1402('0x44')],_0x363761[_0x1402('0x46')]);_0x2c37e0[_0x1402('0x49')]=_[_0x1402('0x48')](_0x363761[_0x1402('0x44')],qs[_0x1402('0x4a')](_0x3c0327[_0x1402('0x46')][_0x1402('0x4a')]));_0x2c37e0[_0x1402('0x49')]=_0x2c37e0['attributes'][_0x1402('0x5b')]?_0x2c37e0['attributes']:_0x363761['model'];if(_0x3c0327['query'][_0x1402('0x55')]){_0x2c37e0['include']=[{'all':!![]}];}_0x2c37e0=_[_0x1402('0x52')]({},_0x2c37e0,_0x3c0327[_0x1402('0x54')]);return db['SmsAccount'][_0x1402('0x5c')](_0x2c37e0)['then'](handleEntityNotFound(_0x3dfb77,null))[_0x1402('0x38')](respondWithResult(_0x3dfb77,null))[_0x1402('0x2b')](handleError(_0x3dfb77,null));};exports[_0x1402('0x5d')]=function(_0x1a0eef,_0x3aec2d){return db[_0x1402('0x41')][_0x1402('0x5d')](_0x1a0eef[_0x1402('0x5e')],{})[_0x1402('0x38')](function(_0x1180bb){var _0x5f37c5=_0x1a0eef['user'][_0x1402('0x3a')]({'plain':!![]});if(!_0x5f37c5)throw new Error(_0x1402('0x5f'));if(_0x5f37c5[_0x1402('0x60')]===_0x1402('0x61')){var _0x2eff01=_0x1180bb[_0x1402('0x3a')]({'plain':!![]});var _0x1bc941=_0x1402('0x3b');return db[_0x1402('0x62')][_0x1402('0x5c')]({'where':{'name':_0x1bc941,'userProfileId':_0x5f37c5[_0x1402('0x63')]},'raw':!![]})[_0x1402('0x38')](function(_0x33e48a){if(_0x33e48a&&_0x33e48a['autoAssociation']===0x0){return db[_0x1402('0x3c')][_0x1402('0x5d')]({'name':_0x2eff01[_0x1402('0x3e')],'resourceId':_0x2eff01['id'],'type':_0x33e48a[_0x1402('0x3e')],'sectionId':_0x33e48a['id']},{})[_0x1402('0x38')](function(){return _0x1180bb;});}else{return _0x1180bb;}})[_0x1402('0x2b')](function(_0x3ebb6a){logger[_0x1402('0x27')](_0x1402('0x64'),_0x3ebb6a);throw _0x3ebb6a;});}return _0x1180bb;})[_0x1402('0x38')](respondWithResult(_0x3aec2d,0xc9))['catch'](handleError(_0x3aec2d,null));};exports[_0x1402('0x37')]=function(_0x4ac70a,_0x1034e3){if(_0x4ac70a[_0x1402('0x5e')]['id']){delete _0x4ac70a[_0x1402('0x5e')]['id'];}return db[_0x1402('0x41')][_0x1402('0x5c')]({'where':{'id':_0x4ac70a[_0x1402('0x59')]['id']},'include':[{'model':db[_0x1402('0x65')],'as':_0x1402('0x5a')}]})[_0x1402('0x38')](handleEntityNotFound(_0x1034e3,null))[_0x1402('0x38')](saveUpdates(_0x4ac70a[_0x1402('0x5e')],null))[_0x1402('0x38')](respondWithResult(_0x1034e3,null))[_0x1402('0x2b')](handleError(_0x1034e3,null));};exports[_0x1402('0x39')]=function(_0x3e8ca3,_0xb4c58f){return db['SmsAccount'][_0x1402('0x5c')]({'where':{'id':_0x3e8ca3['params']['id']}})[_0x1402('0x38')](handleEntityNotFound(_0xb4c58f,null))[_0x1402('0x38')](removeEntity(_0xb4c58f,null))['catch'](handleError(_0xb4c58f,null));};exports[_0x1402('0x66')]=function(_0x15555b,_0x997fa2){return db['SmsAccount'][_0x1402('0x66')]()[_0x1402('0x38')](respondWithResult(_0x997fa2,null))[_0x1402('0x2b')](handleError(_0x997fa2,null));};exports[_0x1402('0x67')]=function(_0x432476,_0x3220b6,_0x1e965){if(_0x432476['body']['id']){delete _0x432476['body']['id'];}return db['SmsAccount'][_0x1402('0x5c')]({'where':{'id':_0x432476['params']['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x3220b6,null))[_0x1402('0x38')](function(_0x3a5cd2){if(_0x3a5cd2){_0x432476[_0x1402('0x5e')]['SmsAccountId']=_0x3a5cd2['id'];return db[_0x1402('0x68')]['create'](_0x432476['body']);}})['then'](respondWithResult(_0x3220b6,null))[_0x1402('0x2b')](handleError(_0x3220b6,null));};exports[_0x1402('0x69')]=function(_0x5b25ab,_0x1c134d,_0x48db39){var _0x15d0b8={'raw':![],'where':{}};var _0x1769a3={};var _0x22f27f={'count':0x0,'rows':[]};return db[_0x1402('0x41')]['findOne']({'where':{'id':_0x5b25ab[_0x1402('0x59')]['id']}})['then'](handleEntityNotFound(_0x1c134d,null))[_0x1402('0x38')](function(_0x64f7b0){if(_0x64f7b0){_0x1769a3[_0x1402('0x44')]=_[_0x1402('0x47')](db[_0x1402('0x68')][_0x1402('0x42')]);_0x1769a3[_0x1402('0x46')]=_['keys'](_0x5b25ab[_0x1402('0x46')]);_0x1769a3[_0x1402('0x4f')]=_[_0x1402('0x48')](_0x1769a3[_0x1402('0x44')],_0x1769a3[_0x1402('0x46')]);_0x15d0b8[_0x1402('0x49')]=_['intersection'](_0x1769a3[_0x1402('0x44')],qs['fields'](_0x5b25ab[_0x1402('0x46')][_0x1402('0x4a')]));_0x15d0b8[_0x1402('0x49')]=_0x15d0b8[_0x1402('0x49')][_0x1402('0x5b')]?_0x15d0b8[_0x1402('0x49')]:_0x1769a3[_0x1402('0x44')];if(!_0x5b25ab[_0x1402('0x46')]['hasOwnProperty'](_0x1402('0x4c'))){_0x15d0b8[_0x1402('0x32')]=qs[_0x1402('0x32')](_0x5b25ab[_0x1402('0x46')][_0x1402('0x32')]);_0x15d0b8[_0x1402('0x31')]=qs[_0x1402('0x31')](_0x5b25ab[_0x1402('0x46')][_0x1402('0x31')]);}_0x15d0b8[_0x1402('0x6a')]=qs[_0x1402('0x4d')](_0x5b25ab[_0x1402('0x46')]['sort']);_0x15d0b8[_0x1402('0x4e')]=qs[_0x1402('0x4f')](_[_0x1402('0x50')](_0x5b25ab['query'],_0x1769a3[_0x1402('0x4f')]));_0x15d0b8[_0x1402('0x4e')]['SmsAccountId']=_0x64f7b0['id'];if(_0x5b25ab['query']['filter']){_0x15d0b8[_0x1402('0x4e')]=_[_0x1402('0x52')](_0x15d0b8['where'],{'$or':_['map'](_0x15d0b8[_0x1402('0x49')],function(_0x389d4e){var _0x4d56ae={};_0x4d56ae[_0x389d4e]={'$like':'%'+_0x5b25ab[_0x1402('0x46')][_0x1402('0x51')]+'%'};return _0x4d56ae;})});}_0x15d0b8=_[_0x1402('0x52')]({},_0x15d0b8,_0x5b25ab['options']);return db[_0x1402('0x68')]['count']({'where':_0x15d0b8[_0x1402('0x4e')]})[_0x1402('0x38')](function(_0x544665){_0x22f27f[_0x1402('0x30')]=_0x544665;if(_0x5b25ab['query'][_0x1402('0x55')]){_0x15d0b8[_0x1402('0x56')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x15d0b8);})['then'](function(_0x334176){_0x22f27f[_0x1402('0x6b')]=_0x334176;return _0x22f27f;});}})[_0x1402('0x38')](respondWithFilteredResult(_0x1c134d,_0x15d0b8))['catch'](handleError(_0x1c134d,null));};exports[_0x1402('0x6c')]=function(_0x1b18a4,_0x3cfccf,_0x214af5){return db['SmsAccount'][_0x1402('0x5c')]({'where':{'id':_0x1b18a4[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x3cfccf,null))[_0x1402('0x38')](function(_0x56e18f){if(_0x56e18f){return _0x56e18f['removeDispositions'](_0x1b18a4[_0x1402('0x46')][_0x1402('0x6d')]);}})[_0x1402('0x38')](respondWithStatusCode(_0x3cfccf,null))[_0x1402('0x2b')](handleError(_0x3cfccf,null));};exports[_0x1402('0x6e')]=function(_0xf69794,_0x496249,_0x13b6b8){if(_0xf69794['body']['id']){delete _0xf69794['body']['id'];}return db['SmsAccount'][_0x1402('0x5c')]({'where':{'id':_0xf69794[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x496249,null))[_0x1402('0x38')](function(_0x3b75c4){if(_0x3b75c4){_0xf69794[_0x1402('0x5e')][_0x1402('0x6f')]=_0x3b75c4['id'];return db['CannedAnswer'][_0x1402('0x5d')](_0xf69794[_0x1402('0x5e')]);}})[_0x1402('0x38')](respondWithResult(_0x496249,null))['catch'](handleError(_0x496249,null));};exports['getAnswers']=function(_0x221ef3,_0x11deb5,_0x313765){var _0x1a557a={'raw':![],'where':{}};var _0xf6a512={};var _0x140786={'count':0x0,'rows':[]};return db[_0x1402('0x41')]['findOne']({'where':{'id':_0x221ef3['params']['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x11deb5,null))['then'](function(_0x22969d){if(_0x22969d){_0xf6a512[_0x1402('0x44')]=_[_0x1402('0x47')](db[_0x1402('0x70')][_0x1402('0x42')]);_0xf6a512[_0x1402('0x46')]=_['keys'](_0x221ef3['query']);_0xf6a512[_0x1402('0x4f')]=_[_0x1402('0x48')](_0xf6a512[_0x1402('0x44')],_0xf6a512[_0x1402('0x46')]);_0x1a557a[_0x1402('0x49')]=_[_0x1402('0x48')](_0xf6a512[_0x1402('0x44')],qs['fields'](_0x221ef3['query']['fields']));_0x1a557a['attributes']=_0x1a557a['attributes'][_0x1402('0x5b')]?_0x1a557a[_0x1402('0x49')]:_0xf6a512[_0x1402('0x44')];if(!_0x221ef3[_0x1402('0x46')]['hasOwnProperty'](_0x1402('0x4c'))){_0x1a557a[_0x1402('0x32')]=qs[_0x1402('0x32')](_0x221ef3[_0x1402('0x46')][_0x1402('0x32')]);_0x1a557a[_0x1402('0x31')]=qs[_0x1402('0x31')](_0x221ef3['query'][_0x1402('0x31')]);}_0x1a557a[_0x1402('0x6a')]=qs[_0x1402('0x4d')](_0x221ef3[_0x1402('0x46')][_0x1402('0x4d')]);_0x1a557a['where']=qs['filters'](_[_0x1402('0x50')](_0x221ef3['query'],_0xf6a512[_0x1402('0x4f')]));_0x1a557a[_0x1402('0x4e')]['SmsAccountId']=_0x22969d['id'];if(_0x221ef3[_0x1402('0x46')][_0x1402('0x51')]){_0x1a557a['where']=_[_0x1402('0x52')](_0x1a557a[_0x1402('0x4e')],{'$or':_[_0x1402('0x45')](_0x1a557a[_0x1402('0x49')],function(_0xbdf9f8){var _0x342308={};_0x342308[_0xbdf9f8]={'$like':'%'+_0x221ef3[_0x1402('0x46')]['filter']+'%'};return _0x342308;})});}_0x1a557a=_[_0x1402('0x52')]({},_0x1a557a,_0x221ef3[_0x1402('0x54')]);return db['CannedAnswer'][_0x1402('0x30')]({'where':_0x1a557a[_0x1402('0x4e')]})[_0x1402('0x38')](function(_0x52e42b){_0x140786[_0x1402('0x30')]=_0x52e42b;if(_0x221ef3['query'][_0x1402('0x55')]){_0x1a557a['include']=[{'all':!![]}];}return db[_0x1402('0x70')][_0x1402('0x57')](_0x1a557a);})[_0x1402('0x38')](function(_0x2cb72c){_0x140786[_0x1402('0x6b')]=_0x2cb72c;return _0x140786;});}})[_0x1402('0x38')](respondWithFilteredResult(_0x11deb5,_0x1a557a))[_0x1402('0x2b')](handleError(_0x11deb5,null));};exports['removeAnswers']=function(_0x310c79,_0x21ed83,_0x2e1298){return db[_0x1402('0x41')][_0x1402('0x5c')]({'where':{'id':_0x310c79[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x21ed83,null))['then'](function(_0x479aa6){if(_0x479aa6){return _0x479aa6['removeAnswers'](_0x310c79[_0x1402('0x46')]['ids']);}})[_0x1402('0x38')](respondWithStatusCode(_0x21ed83,null))[_0x1402('0x2b')](handleError(_0x21ed83,null));};exports['notify']=function(_0x144fe2,_0x209de9,_0x8e63c1){var _0x33cc2a={'channel':_0x1402('0x71')};var _0x5dc0f7=[];var _0x3114b6=[];var _0x5ce132={};return db[_0x1402('0x41')][_0x1402('0x5c')]({'where':{'id':_0x144fe2[_0x1402('0x59')]['id']},'include':[{'model':db[_0x1402('0x72')],'as':_0x1402('0x73')}]})[_0x1402('0x38')](handleEntityNotFound(_0x209de9,null))[_0x1402('0x38')](function(_0x33dd5d){_0x33cc2a[_0x1402('0x74')]=_0x33dd5d;_0x33cc2a['applications']=_[_0x1402('0x75')](_0x33dd5d['Applications'],[_0x1402('0x76')],[_0x1402('0x77')]);if(_0x33cc2a[_0x1402('0x74')][_0x1402('0x73')]){delete _0x33cc2a['account'][_0x1402('0x73')];}return db['CmContact'][_0x1402('0x66')]();})[_0x1402('0x38')](function(_0x38c582){if(!_0x38c582){throw new db[(_0x1402('0x78'))][(_0x1402('0x79'))]('no\x20available\x20attributes');}_0x5dc0f7=_[_0x1402('0x7a')](_[_0x1402('0x47')](_0x38c582),[_0x1402('0x7b'),_0x1402('0x7c')]);_0x3114b6=_[_0x1402('0x7a')](_[_0x1402('0x47')](_0x38c582),['createdAt','updatedAt','CompanyId','ListId']);_0x33cc2a['body']={'mapKey':_0x1402('0x7d')};if(_0x33cc2a['account'][_0x1402('0x53')]){switch(_0x33cc2a[_0x1402('0x74')][_0x1402('0x53')]){case'twilio':_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')]=_0x144fe2['body'][_0x1402('0x7f')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]=_0x144fe2['body'][_0x1402('0x80')];_0x33cc2a[_0x1402('0x5e')]['messageId']=_0x144fe2[_0x1402('0x5e')][_0x1402('0x81')];break;case _0x1402('0x82'):_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')]='+'+_0x144fe2[_0x1402('0x5e')]['sender'];_0x33cc2a[_0x1402('0x5e')]['body']=_0x144fe2[_0x1402('0x5e')]['text'];break;case'connectel':_0x33cc2a[_0x1402('0x5e')]['from']=_0x144fe2[_0x1402('0x5e')][_0x1402('0x7e')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]=_0x144fe2['body'][_0x1402('0x29')];break;case'clicksend':_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')]=_0x144fe2['body'][_0x1402('0x7e')];_0x33cc2a['body'][_0x1402('0x5e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x5e')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x83')]=_0x144fe2['body'][_0x1402('0x84')];break;case _0x1402('0x85'):_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x7f')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x86')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x83')]=_0x144fe2[_0x1402('0x5e')]['MessageUUID'];break;case _0x1402('0x87'):_0x33cc2a[_0x1402('0x5e')]['from']='+'+_0x144fe2[_0x1402('0x5e')]['results'][0x0]['from'];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]=_0x144fe2[_0x1402('0x5e')]['results'][0x0][_0x1402('0x88')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x83')]=_0x144fe2['body'][_0x1402('0x89')][0x0]['messageId'];break;case'csc':_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x8a')];_0x33cc2a[_0x1402('0x5e')]['body']=_0x144fe2[_0x1402('0x5e')][_0x1402('0x8b')][_0x1402('0x29')];break;case _0x1402('0x8c'):_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x8d')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x88')];_0x33cc2a[_0x1402('0x5e')]['messageId']=_0x144fe2[_0x1402('0x5e')]['replyMessageId'];break;case'intelepeer':_0x33cc2a[_0x1402('0x5e')]['from']=_0x144fe2['body'][_0x1402('0x7e')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x29')];_0x33cc2a[_0x1402('0x5e')][_0x1402('0x83')]=_0x144fe2[_0x1402('0x5e')][_0x1402('0x8e')];break;}}if(_0x33cc2a[_0x1402('0x5e')]['id']){delete _0x33cc2a['body']['id'];}if(_[_0x1402('0x8f')](_0x33cc2a['body'][_0x1402('0x7e')])){throw new db[(_0x1402('0x78'))][(_0x1402('0x79'))](_0x1402('0x90'));}if(_[_0x1402('0x8f')](_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')])||_0x33cc2a[_0x1402('0x5e')][_0x1402('0x5e')]===''){throw new db[(_0x1402('0x78'))][(_0x1402('0x79'))](_0x1402('0x91'));}if(_[_0x1402('0x8f')](_0x33cc2a['body'][_0x1402('0x92')])){throw new db[(_0x1402('0x78'))][(_0x1402('0x79'))](_0x1402('0x93')+_0x3114b6);}if(!_[_0x1402('0x94')](_0x3114b6,_0x33cc2a[_0x1402('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0x1402('0x79'))](_0x1402('0x95')+_0x3114b6);}_0x5ce132[_0x33cc2a['body'][_0x1402('0x92')]]=_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')];return db[_0x1402('0x96')]['find']({'where':{'id':_0x33cc2a[_0x1402('0x74')][_0x1402('0x97')]},'include':[{'model':db[_0x1402('0x98')],'as':_0x1402('0x99'),'where':_0x5ce132,'limit':0x1,'order':[[_0x1402('0x7c'),'DESC']]}]});})[_0x1402('0x38')](handleEntityNotFound(_0x209de9,null))[_0x1402('0x38')](function(_0x15637c){if(_0x15637c){_0x33cc2a['list']=_[_0x1402('0x9a')](_0x15637c,[_0x1402('0x99')]);if(_0x15637c['Contacts'][_0x1402('0x5b')]){return _0x15637c[_0x1402('0x99')][0x0];}var _0x637cf9=_['defaults'](_0x33cc2a[_0x1402('0x5e')],{'firstName':_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')],'ListId':_0x15637c['id']});_0x637cf9[_0x33cc2a[_0x1402('0x5e')][_0x1402('0x92')]]=_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')];return db['CmContact']['create'](_0x637cf9,{'fields':_0x5dc0f7,'raw':!![]});}})[_0x1402('0x38')](handleEntityNotFound(_0x209de9,null))[_0x1402('0x38')](function(_0xa1a99f){if(_0xa1a99f){_0x33cc2a[_0x1402('0x9b')]=_0xa1a99f;var _0x56f35e={'ContactId':_0xa1a99f['id'],'phone':_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')],'SmsAccountId':_0x144fe2[_0x1402('0x59')]['id']};var _0x27226e={'ContactId':_0xa1a99f['id'],'SmsAccountId':_0x144fe2[_0x1402('0x59')]['id'],'closed':![]};return db[_0x1402('0x9c')][_0x1402('0x5c')]({'where':_0x27226e})[_0x1402('0x38')](function(_0x5f42cf){if(_0x5f42cf){return[_0x5f42cf,![]];}return db[_0x1402('0x9c')][_0x1402('0x5d')](_0x56f35e)[_0x1402('0x38')](function(_0x2de2df){return[_0x2de2df,!![]];});});}})[_0x1402('0x9d')](function(_0x1e771c,_0x4a0f2b){_0x33cc2a[_0x1402('0x9e')]=_0x1e771c[_0x1402('0x3a')]({'plain':!![]});_0x33cc2a[_0x1402('0x9e')][_0x1402('0x9f')]=![];if(_0x4a0f2b){if(_0x33cc2a['account'][_0x1402('0xa0')]){_0x33cc2a['applications'][_0x1402('0xa1')]({'id':0x0,'priority':_0x33cc2a[_0x1402('0xa2')]['length']+0x1,'app':_0x1402('0xa3'),'appdata':_0x1402('0xa4'),'interval':_0x1402('0xa5')});}_0x33cc2a[_0x1402('0x9e')][_0x1402('0x9f')]=!![];}return db['SmsMessage'][_0x1402('0x5d')]({'phone':_0x33cc2a[_0x1402('0x5e')][_0x1402('0x7e')],'messageId':_0x33cc2a['body'][_0x1402('0x83')],'body':_0x33cc2a['body'][_0x1402('0x5e')],'SmsAccountId':_0x144fe2[_0x1402('0x59')]['id'],'SmsInteractionId':_0x1e771c['id'],'direction':'in','ContactId':_0x1e771c['ContactId'],'AttachmentId':_0x33cc2a['body'][_0x1402('0xa6')]});})['then'](function(_0x2fb14b){_0x33cc2a['message']=_0x2fb14b;if(_0x33cc2a[_0x1402('0x9e')]['UserId']){return db[_0x1402('0xa7')]['find']({'attributes':['id',_0x1402('0x3e')],'where':{'id':_0x33cc2a[_0x1402('0x9e')][_0x1402('0xa8')]}})[_0x1402('0x38')](function(_0x43254a){if(_0x43254a){_0x33cc2a['applications'][_0x1402('0xa9')]({'id':0x0,'priority':0x0,'app':_0x1402('0xaa'),'appdata':_0x43254a['name']+','+(_0x33cc2a[_0x1402('0x74')][_0x1402('0xab')]||0xa),'interval':_0x1402('0xa5')});}return respondWithRpcPromise(_0x1402('0xac'),_0x1402('0xad'),_0x33cc2a);});}return respondWithRpcPromise(_0x1402('0xac'),_0x1402('0xad'),_0x33cc2a);})['then'](function(_0x5cd442){if(_0x5cd442){var _0x119e4f=0xc8;var _0x41ec07=_0x1402('0xae');logger[_0x1402('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x41ec07,_0x119e4f,_0x1402('0xaf'));logger['debug'](_0x1402('0xb0'),_0x41ec07,_0x119e4f,_0x1402('0xaf'),JSON['stringify'](_0x5cd442));if(_0x33cc2a[_0x1402('0x74')][_0x1402('0x53')]===_0x1402('0xb1')){return _0x209de9[_0x1402('0x2e')](_0x119e4f)[_0x1402('0x33')]('Content-Type',_0x1402('0xb2'))[_0x1402('0x3f')](_0x1402('0xb3'));}else{return _0x209de9['status'](_0x119e4f)[_0x1402('0x2f')](_0x5cd442);}}})[_0x1402('0x2b')](handleError(_0x209de9,null));};exports[_0x1402('0xb4')]=function(_0x207c03,_0x155592,_0x183e50){return db['SmsAccount']['findOne']({'where':{'id':_0x207c03[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x155592,null))['then'](function(_0x3e1ebc){if(_0x3e1ebc){return db[_0x1402('0xb5')][_0x1402('0xb6')](function(_0x21db1d){return db[_0x1402('0x72')][_0x1402('0x39')]({'where':{'SmsAccountId':_0x207c03['params']['id']},'transaction':_0x21db1d})[_0x1402('0x38')](function(_0x5f49b6){var _0x481195=_[_0x1402('0x45')](_0x207c03['body'],function(_0x3692a6){_0x3692a6['SmsAccountId']=_0x207c03[_0x1402('0x59')]['id'];return _0x3692a6;});return db[_0x1402('0x72')][_0x1402('0xb7')](_0x481195,{'transaction':_0x21db1d});});})[_0x1402('0x38')](function(){return db[_0x1402('0x72')][_0x1402('0xb8')]({'where':{'SmsAccountId':_0x207c03['params']['id']},'order':_0x1402('0x76')});});}})[_0x1402('0x38')](respondWithResult(_0x155592,null))[_0x1402('0x2b')](handleError(_0x155592,null));};exports[_0x1402('0xb9')]=function(_0x513ee2,_0x5297cd,_0x2bfc98){var _0x132c02={};var _0x2c794e={};var _0x155f79;var _0x173c86;return db[_0x1402('0x41')][_0x1402('0xba')]({'where':{'id':_0x513ee2[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x5297cd,null))[_0x1402('0x38')](function(_0x52415d){if(_0x52415d){_0x155f79=_0x52415d;_0x2c794e[_0x1402('0x44')]=_[_0x1402('0x47')](db[_0x1402('0x72')][_0x1402('0x42')]);_0x2c794e['query']=_['keys'](_0x513ee2[_0x1402('0x46')]);_0x2c794e['filters']=_['intersection'](_0x2c794e['model'],_0x2c794e[_0x1402('0x46')]);_0x132c02[_0x1402('0x49')]=_['intersection'](_0x2c794e[_0x1402('0x44')],qs[_0x1402('0x4a')](_0x513ee2[_0x1402('0x46')][_0x1402('0x4a')]));_0x132c02[_0x1402('0x49')]=_0x132c02[_0x1402('0x49')][_0x1402('0x5b')]?_0x132c02[_0x1402('0x49')]:_0x2c794e['model'];_0x132c02[_0x1402('0x6a')]=qs[_0x1402('0x4d')](_0x513ee2[_0x1402('0x46')][_0x1402('0x4d')]);_0x132c02[_0x1402('0x4e')]=qs[_0x1402('0x4f')](_['pick'](_0x513ee2[_0x1402('0x46')],_0x2c794e[_0x1402('0x4f')]));if(_0x513ee2[_0x1402('0x46')]['filter']){_0x132c02[_0x1402('0x4e')]=_[_0x1402('0x52')](_0x132c02[_0x1402('0x4e')],{'$or':_[_0x1402('0x45')](_0x132c02[_0x1402('0x49')],function(_0x4b38c6){var _0x283856={};_0x283856[_0x4b38c6]={'$like':'%'+_0x513ee2['query'][_0x1402('0x51')]+'%'};return _0x283856;})});}_0x132c02=_[_0x1402('0x52')]({},_0x132c02,_0x513ee2[_0x1402('0x54')]);return _0x155f79['getApplications'](_0x132c02);}})['then'](function(_0x29c898){if(_0x29c898){_0x173c86=_0x29c898['length'];if(!_0x513ee2[_0x1402('0x46')][_0x1402('0x4b')]('nolimit')){_0x132c02[_0x1402('0x32')]=qs[_0x1402('0x32')](_0x513ee2[_0x1402('0x46')][_0x1402('0x32')]);_0x132c02[_0x1402('0x31')]=qs[_0x1402('0x31')](_0x513ee2[_0x1402('0x46')][_0x1402('0x31')]);}return _0x155f79[_0x1402('0xb9')](_0x132c02);}})[_0x1402('0x38')](function(_0x23d0c9){if(_0x23d0c9){return _0x23d0c9?{'count':_0x173c86,'rows':_0x23d0c9}:null;}})[_0x1402('0x38')](respondWithResult(_0x5297cd,null))[_0x1402('0x2b')](handleError(_0x5297cd,null));};exports[_0x1402('0xbb')]=function(_0x2e962f,_0x48c7f1,_0x459e81){var _0x2345a1={'raw':![],'where':{}};var _0x1603d3={};var _0x12f7f5={'count':0x0,'rows':[]};return db[_0x1402('0x41')][_0x1402('0xba')]({'where':{'id':_0x2e962f[_0x1402('0x59')]['id']}})['then'](handleEntityNotFound(_0x48c7f1,null))['then'](function(_0x1d20b4){if(_0x1d20b4){_0x1603d3[_0x1402('0x44')]=_[_0x1402('0x47')](db[_0x1402('0x9c')][_0x1402('0x42')]);_0x1603d3['query']=_['keys'](_0x2e962f[_0x1402('0x46')]);_0x1603d3[_0x1402('0x4f')]=_[_0x1402('0x48')](_0x1603d3[_0x1402('0x44')],_0x1603d3['query']);_0x2345a1[_0x1402('0x49')]=_['intersection'](_0x1603d3[_0x1402('0x44')],qs[_0x1402('0x4a')](_0x2e962f[_0x1402('0x46')][_0x1402('0x4a')]));_0x2345a1[_0x1402('0x49')]=_0x2345a1['attributes'][_0x1402('0x5b')]?_0x2345a1['attributes']:_0x1603d3[_0x1402('0x44')];if(!_0x2e962f[_0x1402('0x46')][_0x1402('0x4b')](_0x1402('0x4c'))){_0x2345a1[_0x1402('0x32')]=qs[_0x1402('0x32')](_0x2e962f[_0x1402('0x46')][_0x1402('0x32')]);_0x2345a1[_0x1402('0x31')]=qs['offset'](_0x2e962f[_0x1402('0x46')][_0x1402('0x31')]);}_0x2345a1[_0x1402('0x6a')]=qs[_0x1402('0x4d')](_0x2e962f[_0x1402('0x46')]['sort']);_0x2345a1['where']=qs[_0x1402('0x4f')](_[_0x1402('0x50')](_0x2e962f[_0x1402('0x46')],_0x1603d3[_0x1402('0x4f')]));_0x2345a1[_0x1402('0x4e')][_0x1402('0x6f')]=_0x1d20b4['id'];if(_0x2e962f['query']['filter']){_0x2345a1[_0x1402('0x4e')]=_[_0x1402('0x52')](_0x2345a1[_0x1402('0x4e')],{'$or':_[_0x1402('0x45')](_0x2345a1['attributes'],function(_0xab36c8){var _0x1a4716={};_0x1a4716[_0xab36c8]={'$like':'%'+_0x2e962f[_0x1402('0x46')][_0x1402('0x51')]+'%'};return _0x1a4716;})});}_0x2345a1=_[_0x1402('0x52')]({},_0x2345a1,_0x2e962f[_0x1402('0x54')]);return db['SmsInteraction'][_0x1402('0x30')]({'where':_0x2345a1[_0x1402('0x4e')]})[_0x1402('0x38')](function(_0xcfe63d){_0x12f7f5['count']=_0xcfe63d;if(_0x2e962f[_0x1402('0x46')]['includeAll']){_0x2345a1[_0x1402('0x56')]=[{'model':db[_0x1402('0x98')],'as':_0x1402('0xbc'),'required':![]},{'model':db['User'],'as':_0x1402('0xbd'),'attributes':[_0x1402('0x3e'),_0x1402('0xbe'),_0x1402('0xbf')],'required':![]},{'model':db[_0x1402('0xc0')],'as':'Tags','attributes':['id',_0x1402('0x3e'),_0x1402('0xc1')],'where':_0x2e962f['query'][_0x1402('0xc2')]?{'id':_0x2e962f['query']['tag']}:undefined,'required':_0x2e962f['query'][_0x1402('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x1402('0x57')](_0x2345a1);})[_0x1402('0x38')](function(_0x209a21){_0x12f7f5[_0x1402('0x6b')]=_0x209a21;return _0x12f7f5;});}})['then'](respondWithFilteredResult(_0x48c7f1,_0x2345a1))[_0x1402('0x2b')](handleError(_0x48c7f1,null));};exports[_0x1402('0x3f')]=function(_0x2f49b7,_0x36ff26,_0xf086ba){var _0x35d791,_0x17065b,_0xe3d09;if(_[_0x1402('0x8f')](_0x2f49b7['body']['body'])||_0x2f49b7[_0x1402('0x5e')][_0x1402('0x5e')]===''){throw new db[(_0x1402('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1402('0x8f')](_0x2f49b7[_0x1402('0x5e')]['to'])){throw new db[(_0x1402('0x78'))]['ValidationError'](_0x1402('0xc3'));}_0x35d791=_0x2f49b7[_0x1402('0x5e')]['to'];return db[_0x1402('0x41')][_0x1402('0x5c')]({'where':{'id':_0x2f49b7['params']['id']},'include':[{'model':db['CmList'],'as':_0x1402('0xc4'),'include':[{'model':db[_0x1402('0x98')],'as':_0x1402('0x99'),'where':{'mobile':_0x35d791},'limit':0x1,'order':[['updatedAt',_0x1402('0xc5')]]}]}]})[_0x1402('0x38')](handleEntityNotFound(_0x36ff26,null))[_0x1402('0x38')](function(_0x4326b5){if(_0x4326b5&&_0x4326b5[_0x1402('0xc4')]){_0x17065b=_0x4326b5['get']({'plain':!![]});if(_0x17065b[_0x1402('0xc4')]&&_0x17065b[_0x1402('0xc4')]['Contacts'][_0x1402('0x5b')]){return _0x17065b['List']['Contacts'][0x0];}return db['CmContact'][_0x1402('0x5d')](_['defaults'](_0x2f49b7[_0x1402('0x5e')],{'firstName':_0x35d791,'mobile':_0x35d791,'phone':_0x35d791,'ListId':_0x17065b[_0x1402('0x97')]}));}})[_0x1402('0x38')](handleEntityNotFound(_0x36ff26,null))[_0x1402('0x38')](function(_0x27d724){if(_0x27d724){_0xe3d09=_0x27d724;return db[_0x1402('0x9c')][_0x1402('0x5c')]({'where':{'ContactId':_0xe3d09['id'],'closed':![],'SmsAccountId':_0x17065b['id']}})[_0x1402('0x38')](function(_0xef8325){if(_0xef8325){return[_0xef8325,![]];}return db[_0x1402('0x9c')][_0x1402('0x5d')]({'UserId':_0x2f49b7[_0x1402('0x61')]['id'],'ContactId':_0xe3d09['id'],'SmsAccountId':_0x17065b['id'],'phone':_0x35d791,'firstMsgDirection':_0x1402('0xc6'),'Messages':[_[_0x1402('0x52')](_0x2f49b7[_0x1402('0x5e')],{'read':![],'body':_0x2f49b7['body'][_0x1402('0x5e')],'phone':_0x35d791,'SmsAccountId':_0x17065b['id'],'UserId':_0x2f49b7[_0x1402('0x61')]['id'],'ContactId':_0xe3d09['id']})]},{'include':[{'model':db[_0x1402('0xc7')],'as':_0x1402('0xc8')}]})[_0x1402('0x38')](function(_0x2725f6){return[_0x2725f6,!![]];});});}})[_0x1402('0x9d')](function(_0x589665,_0x301d13){if(_0x301d13){return _0x589665;}return db[_0x1402('0xc7')]['create'](_[_0x1402('0x52')](_0x2f49b7['body'],{'read':![],'body':_0x2f49b7[_0x1402('0x5e')]['body'],'phone':_0x35d791,'SmsAccountId':_0x17065b['id'],'SmsInteractionId':_0x589665['id'],'UserId':_0x2f49b7[_0x1402('0x61')]['id'],'ContactId':_0xe3d09['id']}))['then'](function(_0x282a99){_0x589665[_0x1402('0xc9')][_0x1402('0xc8')]=[];_0x589665[_0x1402('0xc9')][_0x1402('0xc8')][_0x1402('0xa1')](_0x282a99[_0x1402('0xc9')]);return _0x589665;});})[_0x1402('0x38')](respondWithResult(_0x36ff26,null))[_0x1402('0x2b')](handleError(_0x36ff26,null));};exports[_0x1402('0x2e')]=function(_0x2c3bea,_0x29547b,_0x2d9e62){if(_0x2c3bea['body']['id']){delete _0x2c3bea[_0x1402('0x5e')]['id'];}console[_0x1402('0xca')]('endpoint\x20/status\x20POST\x20/',_0x2c3bea[_0x1402('0x5e')]);var _0x647518,_0x1d891a,_0x3b00fb;return db[_0x1402('0x41')]['find']({'where':{'id':_0x2c3bea[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x29547b,null))[_0x1402('0x38')](function(_0xc8c4c7){if(_0xc8c4c7){_0x3b00fb=_0xc8c4c7;logger[_0x1402('0xcb')](_0x1402('0x25'),_0x1402('0x2e'),'received\x20delivery\x20report\x20from',_0xc8c4c7[_0x1402('0x53')],util[_0x1402('0xcc')](_0x2c3bea[_0x1402('0x5e')],{'showHidden':![],'depth':null}));switch(_0xc8c4c7[_0x1402('0x53')]){case _0x1402('0x82'):if(_0x2c3bea[_0x1402('0x5e')]['skebby_dispatch_id']&&_0x2c3bea[_0x1402('0x5e')][_0x1402('0x2e')]){_0x1d891a=_0x2c3bea[_0x1402('0x5e')][_0x1402('0x2e')];return db[_0x1402('0xc7')]['find']({'where':{'messageId':_0x2c3bea[_0x1402('0x5e')][_0x1402('0xcd')]}});}break;case _0x1402('0xce'):if(_0x2c3bea[_0x1402('0x5e')][_0x1402('0xcf')]&&_0x2c3bea[_0x1402('0x5e')][_0x1402('0xd0')]){_0x1d891a=_0x2c3bea['body'][_0x1402('0xd0')];return db[_0x1402('0xc7')][_0x1402('0x5c')]({'where':{'messageId':_0x2c3bea[_0x1402('0x5e')][_0x1402('0xcf')]}});}break;case _0x1402('0xd1'):if(_0x2c3bea['body'][_0x1402('0x84')]&&_0x2c3bea[_0x1402('0x5e')][_0x1402('0xd2')]){_0x1d891a=_0x2c3bea[_0x1402('0x5e')][_0x1402('0xd2')];return db[_0x1402('0xc7')]['find']({'where':{'messageId':_0x2c3bea[_0x1402('0x5e')][_0x1402('0x84')]}});}break;case'infobip':var _0x4d6413=_0x2c3bea[_0x1402('0x5e')][_0x1402('0x89')][0x0];if(_0x4d6413['messageId']&&_0x4d6413['status'][_0x1402('0xd3')]===_0x1402('0xd4')){_0x1d891a=_0x4d6413[_0x1402('0x2e')][_0x1402('0xd3')];return db[_0x1402('0xc7')][_0x1402('0x5c')]({'where':{'messageId':_0x4d6413[_0x1402('0x83')]}});}break;case _0x1402('0x8c'):if(_0x2c3bea[_0x1402('0x5e')][_0x1402('0x83')]&&_0x2c3bea['body']['status']){_0x1d891a=_0x2c3bea[_0x1402('0x5e')][_0x1402('0x2e')];return db['SmsMessage'][_0x1402('0x5c')]({'where':{'messageId':_0x2c3bea[_0x1402('0x5e')][_0x1402('0x83')]}});}break;case'intelepeer':if(_0x2c3bea['body'][_0x1402('0xd5')]&&_0x2c3bea['body'][_0x1402('0x2e')]){_0x1d891a=_0x2c3bea[_0x1402('0x5e')][_0x1402('0x2e')];return db[_0x1402('0xc7')][_0x1402('0x5c')]({'where':{'messageId':_0x2c3bea['body'][_0x1402('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x29547b,null))[_0x1402('0x38')](function(_0x22c672){if(_0x22c672){_0x647518=_0x22c672;switch(_0x3b00fb[_0x1402('0x53')]){case _0x1402('0x82'):if(_0x1d891a===_0x1402('0xd4')){return _0x647518[_0x1402('0x37')]({'read':!![]});}else{logger['error'](_0x1402('0x25'),'status','skebby',util[_0x1402('0xcc')](_0x2c3bea[_0x1402('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1d891a==='1'){return _0x647518[_0x1402('0x37')]({'read':!![]});}else{logger[_0x1402('0x27')](_0x1402('0x25'),'status',_0x1402('0x82'),util[_0x1402('0xcc')](_0x2c3bea['body'],{'showHidden':![],'depth':null}));}break;case _0x1402('0xd1'):if(!_0x2c3bea[_0x1402('0x5e')][_0x1402('0xd6')]&&_0x1d891a>=0xc8&&_0x1d891a<=0xce){return _0x647518[_0x1402('0x37')]({'read':!![]});}else{logger['error'](_0x1402('0x25'),'status',_0x1402('0xd1'),util[_0x1402('0xcc')](_0x2c3bea['body'],{'showHidden':![],'depth':null}));}break;case _0x1402('0x87'):var _0x11caa=_0x2c3bea[_0x1402('0x5e')][_0x1402('0x89')][0x0];if(_0x11caa[_0x1402('0x2e')][_0x1402('0xd3')]===_0x1402('0xd4')){return _0x647518[_0x1402('0x37')]({'read':!![]});}else{logger[_0x1402('0x27')](_0x1402('0x25'),'status','infobip',util[_0x1402('0xcc')](_0x2c3bea[_0x1402('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1d891a==_0x1402('0xd7')||_0x1d891a==_0x1402('0xd8')){return _0x647518[_0x1402('0x37')]({'read':!![]});}else{logger[_0x1402('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1402('0x8c'),util['inspect'](_0x2c3bea[_0x1402('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x1402('0xd9'):if(_0x1d891a===_0x1402('0xda')||_0x1d891a===_0x1402('0xdb')){return _0x647518['update']({'read':!![]});}else{logger[_0x1402('0x27')](_0x1402('0x25'),_0x1402('0x2e'),_0x1402('0xd9'),util['inspect'](_0x2c3bea[_0x1402('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x647518;}})['then'](respondWithResult(_0x29547b,null))[_0x1402('0x2b')](handleError(_0x29547b,null));};exports['statusGet']=function(_0x2a3b9f,_0xcdd6f1,_0x202860){var _0x4484ca,_0x1fff31,_0x27aa85;return db[_0x1402('0x41')][_0x1402('0x5c')]({'where':{'id':_0x2a3b9f[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0xcdd6f1,null))[_0x1402('0x38')](function(_0x2126b6){if(_0x2126b6){_0x27aa85=_0x2126b6;logger[_0x1402('0xcb')](_0x1402('0x25'),_0x1402('0x2e'),_0x1402('0xdc'),_0x2126b6[_0x1402('0x53')],util[_0x1402('0xcc')](_0x2a3b9f[_0x1402('0x46')],{'showHidden':![],'depth':null}));switch(_0x2126b6[_0x1402('0x53')]){case'csc':if(_0x2a3b9f[_0x1402('0x46')]['message-id']&&_0x2a3b9f[_0x1402('0x46')][_0x1402('0xdd')]){_0x1fff31=_0x2a3b9f[_0x1402('0x46')]['state'];return db[_0x1402('0xc7')][_0x1402('0x5c')]({'where':{'messageId':_0x2a3b9f[_0x1402('0x46')][_0x1402('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0xcdd6f1,null))[_0x1402('0x38')](function(_0x41f851){if(_0x41f851){_0x4484ca=_0x41f851;switch(_0x27aa85[_0x1402('0x53')]){case _0x1402('0xdf'):if(_0x1fff31==='2'||_0x1fff31==='6'){return _0x4484ca['update']({'read':!![]});}else{logger[_0x1402('0x27')](_0x1402('0x25'),_0x1402('0x2e'),_0x1402('0xdf'),util['inspect'](_0x2a3b9f['query'],{'showHidden':![],'depth':null}));};break;}return _0x4484ca;}})[_0x1402('0x38')](respondWithResult(_0xcdd6f1,null))[_0x1402('0x2b')](handleError(_0xcdd6f1,null));};exports[_0x1402('0xe0')]=function(_0x3c525d,_0x53de6c,_0x8e4cef){return db[_0x1402('0x41')]['find']({'where':{'id':_0x3c525d[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x53de6c,null))[_0x1402('0x38')](function(_0x55d6a1){if(_0x55d6a1){return _0x55d6a1[_0x1402('0xe0')](_0x3c525d[_0x1402('0x5e')][_0x1402('0x6d')],_[_0x1402('0x9a')](_0x3c525d[_0x1402('0x5e')],[_0x1402('0x6d'),'id'])||{})[_0x1402('0x9d')](function(_0x5e64df){for(var _0x254669=0x0;_0x254669<_0x3c525d['body'][_0x1402('0x6d')][_0x1402('0x5b')];_0x254669+=0x1){socket['emit'](_0x1402('0xe1'),{'UserId':_0x3c525d[_0x1402('0x5e')][_0x1402('0x6d')][_0x254669],'SmsAccountId':_0x3c525d[_0x1402('0x59')]['id']});}return _0x5e64df;});}})[_0x1402('0x38')](respondWithResult(_0x53de6c,null))[_0x1402('0x2b')](handleError(_0x53de6c,null));};exports[_0x1402('0xe2')]=function(_0x35b177,_0x599a15,_0x3ca0b0){return db[_0x1402('0x41')][_0x1402('0x5c')]({'where':{'id':_0x35b177['params']['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x599a15,null))[_0x1402('0x38')](function(_0x3e768c){if(_0x3e768c){return _0x3e768c[_0x1402('0xe2')](_0x35b177['query'][_0x1402('0x6d')])[_0x1402('0x38')](function(){if(_[_0x1402('0xe3')](_0x35b177[_0x1402('0x46')][_0x1402('0x6d')])){for(var _0x3200e7=0x0;_0x3200e7<_0x35b177['query'][_0x1402('0x6d')][_0x1402('0x5b')];_0x3200e7+=0x1){socket[_0x1402('0xe4')](_0x1402('0xe5'),{'UserId':Number(_0x35b177[_0x1402('0x46')][_0x1402('0x6d')][_0x3200e7]),'SmsAccountId':Number(_0x35b177[_0x1402('0x59')]['id'])});}}else{socket['emit'](_0x1402('0xe5'),{'UserId':Number(_0x35b177[_0x1402('0x46')][_0x1402('0x6d')]),'SmsAccountId':Number(_0x35b177[_0x1402('0x59')]['id'])});}});}})[_0x1402('0x38')](respondWithStatusCode(_0x599a15,null))[_0x1402('0x2b')](handleError(_0x599a15,null));};exports['getAgents']=function(_0x3d1c45,_0x4e2151,_0x2744e9){var _0xaf6944={};var _0x90e473={};var _0x5b8cf8;var _0x391782;return db[_0x1402('0x41')]['findOne']({'where':{'id':_0x3d1c45[_0x1402('0x59')]['id']}})[_0x1402('0x38')](handleEntityNotFound(_0x4e2151,null))[_0x1402('0x38')](function(_0x4771e7){if(_0x4771e7){_0x5b8cf8=_0x4771e7;_0x90e473[_0x1402('0x44')]=_[_0x1402('0x47')](db['User'][_0x1402('0x42')]);_0x90e473['query']=_[_0x1402('0x47')](_0x3d1c45['query']);_0x90e473['filters']=_[_0x1402('0x48')](_0x90e473['model'],_0x90e473[_0x1402('0x46')]);_0xaf6944[_0x1402('0x49')]=_['intersection'](_0x90e473['model'],qs[_0x1402('0x4a')](_0x3d1c45[_0x1402('0x46')][_0x1402('0x4a')]));_0xaf6944['attributes']=_0xaf6944[_0x1402('0x49')][_0x1402('0x5b')]?_0xaf6944[_0x1402('0x49')]:_0x90e473[_0x1402('0x44')];_0xaf6944[_0x1402('0x6a')]=qs['sort'](_0x3d1c45[_0x1402('0x46')]['sort']);_0xaf6944['where']=qs[_0x1402('0x4f')](_[_0x1402('0x50')](_0x3d1c45['query'],_0x90e473[_0x1402('0x4f')]));if(_0x3d1c45[_0x1402('0x46')][_0x1402('0x51')]){_0xaf6944[_0x1402('0x4e')]=_[_0x1402('0x52')](_0xaf6944[_0x1402('0x4e')],{'$or':_[_0x1402('0x45')](_0xaf6944[_0x1402('0x49')],function(_0x552e0b){var _0x13d667={};_0x13d667[_0x552e0b]={'$like':'%'+_0x3d1c45['query'][_0x1402('0x51')]+'%'};return _0x13d667;})});}_0xaf6944=_[_0x1402('0x52')]({},_0xaf6944,_0x3d1c45[_0x1402('0x54')]);return _0x5b8cf8['getAgents'](_0xaf6944);}})[_0x1402('0x38')](function(_0x168ebf){if(_0x168ebf){_0x391782=_0x168ebf[_0x1402('0x5b')];if(!_0x3d1c45[_0x1402('0x46')][_0x1402('0x4b')](_0x1402('0x4c'))){_0xaf6944[_0x1402('0x32')]=qs[_0x1402('0x32')](_0x3d1c45[_0x1402('0x46')][_0x1402('0x32')]);_0xaf6944[_0x1402('0x31')]=qs[_0x1402('0x31')](_0x3d1c45[_0x1402('0x46')][_0x1402('0x31')]);}return _0x5b8cf8['getAgents'](_0xaf6944);}})['then'](function(_0x5f20bb){if(_0x5f20bb){return _0x5f20bb?{'count':_0x391782,'rows':_0x5f20bb}:null;}})['then'](respondWithResult(_0x4e2151,null))[_0x1402('0x2b')](handleError(_0x4e2151,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b472453..622b53c 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 _0x7cf8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x3e3d0a,_0x4745dd){var _0x3fc765=function(_0x3b64c5){while(--_0x3b64c5){_0x3e3d0a['push'](_0x3e3d0a['shift']());}};_0x3fc765(++_0x4745dd);}(_0x7cf8,0xa9));var _0x87cf=function(_0x30f63c,_0x37dbbc){_0x30f63c=_0x30f63c-0x0;var _0x58ad29=_0x7cf8[_0x30f63c];return _0x58ad29;};'use strict';var EventEmitter=require(_0x87cf('0x0'));var SmsAccount=require(_0x87cf('0x1'))['db'][_0x87cf('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x87cf('0x3')](0x0);var events={'afterCreate':_0x87cf('0x4'),'afterUpdate':_0x87cf('0x5'),'afterDestroy':_0x87cf('0x6')};function emitEvent(_0x53d3b5){return function(_0x5cc8e5,_0x3720f5,_0x13727a){SmsAccountEvents[_0x87cf('0x7')](_0x53d3b5+':'+_0x5cc8e5['id'],_0x5cc8e5);SmsAccountEvents[_0x87cf('0x7')](_0x53d3b5,_0x5cc8e5);_0x13727a(null);};}for(var e in events){if(events[_0x87cf('0x8')](e)){var event=events[e];SmsAccount[_0x87cf('0x9')](e,emitEvent(event));}}module[_0x87cf('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x484c=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x484c,0xfd));var _0xc484=function(_0xbe92cb,_0x52e811){_0xbe92cb=_0xbe92cb-0x0;var _0x34b713=_0x484c[_0xbe92cb];return _0x34b713;};'use strict';var EventEmitter=require(_0xc484('0x0'));var SmsAccount=require(_0xc484('0x1'))['db'][_0xc484('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc484('0x3')](0x0);var events={'afterCreate':_0xc484('0x4'),'afterUpdate':_0xc484('0x5'),'afterDestroy':_0xc484('0x6')};function emitEvent(_0x4c0705){return function(_0x343f2a,_0x3e3141,_0x5b7dfd){SmsAccountEvents[_0xc484('0x7')](_0x4c0705+':'+_0x343f2a['id'],_0x343f2a);SmsAccountEvents[_0xc484('0x7')](_0x4c0705,_0x343f2a);_0x5b7dfd(null);};}for(var e in events){if(events[_0xc484('0x8')](e)){var event=events[e];SmsAccount[_0xc484('0x9')](e,emitEvent(event));}}module[_0xc484('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0d81a58..6657325 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 _0x8c44=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts'];(function(_0x29379a,_0x16b64f){var _0x125b52=function(_0xea6150){while(--_0xea6150){_0x29379a['push'](_0x29379a['shift']());}};_0x125b52(++_0x16b64f);}(_0x8c44,0x186));var _0x48c4=function(_0x1e37be,_0x405f43){_0x1e37be=_0x1e37be-0x0;var _0x749eca=_0x8c44[_0x1e37be];return _0x749eca;};'use strict';var _=require(_0x48c4('0x0'));var util=require(_0x48c4('0x1'));var logger=require('../../config/logger')(_0x48c4('0x2'));var moment=require(_0x48c4('0x3'));var BPromise=require(_0x48c4('0x4'));var rp=require(_0x48c4('0x5'));var fs=require('fs');var path=require(_0x48c4('0x6'));var rimraf=require(_0x48c4('0x7'));var config=require(_0x48c4('0x8'));var attributes=require(_0x48c4('0x9'));module[_0x48c4('0xa')]=function(_0x4bf03b,_0xe3a046){return _0x4bf03b['define'](_0x48c4('0xb'),attributes,{'tableName':_0x48c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc3d=['exports','define','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes'];(function(_0x170998,_0x1e6ee0){var _0x7db81a=function(_0x52ff21){while(--_0x52ff21){_0x170998['push'](_0x170998['shift']());}};_0x7db81a(++_0x1e6ee0);}(_0xdc3d,0x1a7));var _0xddc3=function(_0x1ac23c,_0x431460){_0x1ac23c=_0x1ac23c-0x0;var _0xc1255f=_0xdc3d[_0x1ac23c];return _0xc1255f;};'use strict';var _=require(_0xddc3('0x0'));var util=require('util');var logger=require(_0xddc3('0x1'))(_0xddc3('0x2'));var moment=require(_0xddc3('0x3'));var BPromise=require(_0xddc3('0x4'));var rp=require(_0xddc3('0x5'));var fs=require('fs');var path=require(_0xddc3('0x6'));var rimraf=require(_0xddc3('0x7'));var config=require('../../config/environment');var attributes=require(_0xddc3('0x8'));module[_0xddc3('0x9')]=function(_0x300b12,_0x3da4cd){return _0x300b12[_0xddc3('0xa')]('SmsAccount',attributes,{'tableName':_0xddc3('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 a114299..9722d43 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 _0x2fae=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','catch','SmsAccount','find','options','raw','attributes','include','map','model','then','ShowSmsAccount','debug','lodash','bluebird','randomstring','ioredis'];(function(_0x3329eb,_0x4b1975){var _0xf76a0c=function(_0x2f19fc){while(--_0x2f19fc){_0x3329eb['push'](_0x3329eb['shift']());}};_0xf76a0c(++_0x4b1975);}(_0x2fae,0x1ac));var _0xe2fa=function(_0x2ada52,_0x3e0824){_0x2ada52=_0x2ada52-0x0;var _0x17a0dd=_0x2fae[_0x2ada52];return _0x17a0dd;};'use strict';var _=require(_0xe2fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe2fa('0x1'));var rs=require(_0xe2fa('0x2'));var fs=require('fs');var Redis=require(_0xe2fa('0x3'));var db=require(_0xe2fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2fa('0x5'));var config=require(_0xe2fa('0x6'));var jayson=require(_0xe2fa('0x7'));var client=jayson[_0xe2fa('0x8')][_0xe2fa('0x9')]({'port':0x232a});config['redis']=_[_0xe2fa('0xa')](config[_0xe2fa('0xb')],{'host':_0xe2fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2fa('0xb')]));require(_0xe2fa('0xd'))[_0xe2fa('0xe')](socket);function respondWithRpcPromise(_0x5a2624,_0x3474b6,_0x2ca2dc){return new BPromise(function(_0x22b0cc,_0x51dd4a){return client[_0xe2fa('0xf')](_0x5a2624,_0x2ca2dc)['then'](function(_0x5a3b55){logger[_0xe2fa('0x10')](_0xe2fa('0x11'),_0x3474b6,'request\x20sent');logger['debug'](_0xe2fa('0x12'),_0x3474b6,_0xe2fa('0x13'),JSON[_0xe2fa('0x14')](_0x5a3b55));if(_0x5a3b55['error']){if(_0x5a3b55['error'][_0xe2fa('0x15')]===0x1f4){logger['error'](_0xe2fa('0x11'),_0x3474b6,_0x5a3b55['error'][_0xe2fa('0x16')]);return _0x51dd4a(_0x5a3b55['error'][_0xe2fa('0x16')]);}logger[_0xe2fa('0x17')](_0xe2fa('0x11'),_0x3474b6,_0x5a3b55['error'][_0xe2fa('0x16')]);return _0x22b0cc(_0x5a3b55[_0xe2fa('0x17')][_0xe2fa('0x16')]);}else{logger['info'](_0xe2fa('0x11'),_0x3474b6,'request\x20sent');_0x22b0cc(_0x5a3b55['result'][_0xe2fa('0x16')]);}})[_0xe2fa('0x18')](function(_0x325af9){logger[_0xe2fa('0x17')]('SmsAccount,\x20%s,\x20%s',_0x3474b6,_0x325af9);_0x51dd4a(_0x325af9);});});}exports['ShowSmsAccount']=function(_0x550b38){var _0x54f352=this;return new Promise(function(_0x2a4deb,_0xcedbec){return db[_0xe2fa('0x19')][_0xe2fa('0x1a')]({'raw':_0x550b38[_0xe2fa('0x1b')]?_0x550b38[_0xe2fa('0x1b')][_0xe2fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x550b38[_0xe2fa('0x1b')]?_0x550b38[_0xe2fa('0x1b')]['where']||null:null,'attributes':_0x550b38[_0xe2fa('0x1b')]?_0x550b38['options'][_0xe2fa('0x1d')]||null:null,'include':_0x550b38['options']?_0x550b38[_0xe2fa('0x1b')][_0xe2fa('0x1e')]?_[_0xe2fa('0x1f')](_0x550b38[_0xe2fa('0x1b')][_0xe2fa('0x1e')],function(_0x44c3f5){return{'model':db[_0x44c3f5['model']],'as':_0x44c3f5['as'],'attributes':_0x44c3f5[_0xe2fa('0x1d')],'include':_0x44c3f5['include']?_[_0xe2fa('0x1f')](_0x44c3f5['include'],function(_0x5a51f4){return{'model':db[_0x5a51f4[_0xe2fa('0x20')]],'as':_0x5a51f4['as'],'attributes':_0x5a51f4[_0xe2fa('0x1d')],'include':_0x5a51f4[_0xe2fa('0x1e')]?_['map'](_0x5a51f4['include'],function(_0x2eec0f){return{'model':db[_0x2eec0f[_0xe2fa('0x20')]],'as':_0x2eec0f['as'],'attributes':_0x2eec0f[_0xe2fa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe2fa('0x21')](function(_0xe52836){logger[_0xe2fa('0x10')](_0xe2fa('0x22'),_0x550b38);logger[_0xe2fa('0x23')](_0xe2fa('0x22'),_0x550b38,JSON[_0xe2fa('0x14')](_0xe52836));_0x2a4deb(_0xe52836);})['catch'](function(_0x16c128){logger[_0xe2fa('0x17')](_0xe2fa('0x22'),_0x16c128[_0xe2fa('0x16')],_0x550b38);_0xcedbec(_0x54f352['error'](0x1f4,_0x16c128[_0xe2fa('0x16')]));});});}; \ No newline at end of file +var _0xce3e=['message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0xce3e,0x183));var _0xece3=function(_0x41cae7,_0x307030){_0x41cae7=_0x41cae7-0x0;var _0x49ca95=_0xce3e[_0x41cae7];return _0x49ca95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xece3('0x0'));var BPromise=require(_0xece3('0x1'));var rs=require(_0xece3('0x2'));var fs=require('fs');var Redis=require(_0xece3('0x3'));var db=require(_0xece3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xece3('0x5'))('rpc');var config=require(_0xece3('0x6'));var jayson=require(_0xece3('0x7'));var client=jayson[_0xece3('0x8')]['http']({'port':0x232a});config[_0xece3('0x9')]=_[_0xece3('0xa')](config[_0xece3('0x9')],{'host':_0xece3('0xb'),'port':0x18eb});var socket=require(_0xece3('0xc'))(new Redis(config[_0xece3('0x9')]));require(_0xece3('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d8ae4,_0x546b11,_0x2cb4dd){return new BPromise(function(_0x5205fc,_0x1b113e){return client['request'](_0x2d8ae4,_0x2cb4dd)[_0xece3('0xe')](function(_0x178647){logger[_0xece3('0xf')](_0xece3('0x10'),_0x546b11,_0xece3('0x11'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x546b11,_0xece3('0x11'),JSON[_0xece3('0x12')](_0x178647));if(_0x178647[_0xece3('0x13')]){if(_0x178647[_0xece3('0x13')][_0xece3('0x14')]===0x1f4){logger[_0xece3('0x13')](_0xece3('0x10'),_0x546b11,_0x178647[_0xece3('0x13')]['message']);return _0x1b113e(_0x178647[_0xece3('0x13')]['message']);}logger[_0xece3('0x13')]('SmsAccount,\x20%s,\x20%s',_0x546b11,_0x178647['error']['message']);return _0x5205fc(_0x178647['error'][_0xece3('0x15')]);}else{logger['info'](_0xece3('0x10'),_0x546b11,_0xece3('0x11'));_0x5205fc(_0x178647['result'][_0xece3('0x15')]);}})[_0xece3('0x16')](function(_0x4b3e20){logger['error'](_0xece3('0x10'),_0x546b11,_0x4b3e20);_0x1b113e(_0x4b3e20);});});}exports[_0xece3('0x17')]=function(_0x14c98c){var _0x606b0=this;return new Promise(function(_0x510969,_0x38c956){return db[_0xece3('0x18')][_0xece3('0x19')]({'raw':_0x14c98c['options']?_0x14c98c[_0xece3('0x1a')][_0xece3('0x1b')]===undefined?!![]:![]:!![],'where':_0x14c98c[_0xece3('0x1a')]?_0x14c98c[_0xece3('0x1a')][_0xece3('0x1c')]||null:null,'attributes':_0x14c98c['options']?_0x14c98c[_0xece3('0x1a')][_0xece3('0x1d')]||null:null,'include':_0x14c98c[_0xece3('0x1a')]?_0x14c98c['options'][_0xece3('0x1e')]?_[_0xece3('0x1f')](_0x14c98c[_0xece3('0x1a')]['include'],function(_0x3ccc07){return{'model':db[_0x3ccc07[_0xece3('0x20')]],'as':_0x3ccc07['as'],'attributes':_0x3ccc07['attributes'],'include':_0x3ccc07[_0xece3('0x1e')]?_[_0xece3('0x1f')](_0x3ccc07[_0xece3('0x1e')],function(_0x406d42){return{'model':db[_0x406d42[_0xece3('0x20')]],'as':_0x406d42['as'],'attributes':_0x406d42[_0xece3('0x1d')],'include':_0x406d42['include']?_[_0xece3('0x1f')](_0x406d42[_0xece3('0x1e')],function(_0x429c79){return{'model':db[_0x429c79[_0xece3('0x20')]],'as':_0x429c79['as'],'attributes':_0x429c79[_0xece3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xece3('0xe')](function(_0x28d965){logger[_0xece3('0xf')](_0xece3('0x17'),_0x14c98c);logger[_0xece3('0x21')]('ShowSmsAccount',_0x14c98c,JSON[_0xece3('0x12')](_0x28d965));_0x510969(_0x28d965);})[_0xece3('0x16')](function(_0x4772ec){logger[_0xece3('0x13')](_0xece3('0x17'),_0x4772ec[_0xece3('0x15')],_0x14c98c);_0x38c956(_0x606b0[_0xece3('0x13')](0x1f4,_0x4772ec['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index de9f038..2a7899c 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 _0xa0b1=['length','smsAccount:','./smsAccount.events','update','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0b1,0x156));var _0x1a0b=function(_0x53a382,_0x21cfcf){_0x53a382=_0x53a382-0x0;var _0x150aca=_0xa0b1[_0x53a382];return _0x150aca;};'use strict';var SmsAccountEvents=require(_0x1a0b('0x0'));var events=['save','remove',_0x1a0b('0x1')];function createListener(_0x1ef462,_0x41dbfa){return function(_0xa6b2e5){_0x41dbfa['emit'](_0x1ef462,_0xa6b2e5);};}function removeListener(_0x30e9cc,_0x55f1e4){return function(){SmsAccountEvents['removeListener'](_0x30e9cc,_0x55f1e4);};}exports[_0x1a0b('0x2')]=function(_0x199939){for(var _0x155299=0x0,_0x445078=events[_0x1a0b('0x3')];_0x155299<_0x445078;_0x155299++){var _0x43e4da=events[_0x155299];var _0x45ead3=createListener(_0x1a0b('0x4')+_0x43e4da,_0x199939);SmsAccountEvents['on'](_0x43e4da,_0x45ead3);}}; \ No newline at end of file +var _0x8ea8=['register','length','smsAccount:','save','remove','update','emit','removeListener'];(function(_0x2383ca,_0x58532e){var _0x39ac6c=function(_0x2a82dc){while(--_0x2a82dc){_0x2383ca['push'](_0x2383ca['shift']());}};_0x39ac6c(++_0x58532e);}(_0x8ea8,0x193));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x88ea('0x0'),_0x88ea('0x1'),_0x88ea('0x2')];function createListener(_0x4cbec2,_0x295239){return function(_0x45ab32){_0x295239[_0x88ea('0x3')](_0x4cbec2,_0x45ab32);};}function removeListener(_0x253b66,_0x320a62){return function(){SmsAccountEvents[_0x88ea('0x4')](_0x253b66,_0x320a62);};}exports[_0x88ea('0x5')]=function(_0x5b0091){for(var _0x4981e5=0x0,_0x131891=events[_0x88ea('0x6')];_0x4981e5<_0x131891;_0x4981e5++){var _0x2784e8=events[_0x4981e5];var _0x32131c=createListener(_0x88ea('0x7')+_0x2784e8,_0x5b0091);SmsAccountEvents['on'](_0x2784e8,_0x32131c);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 6d31ca3..6bdb94f 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 _0x5b91=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./smsApplication.controller','isAuthenticated','index','/:id','show','post'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5b91,0x6b));var _0x15b9=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x5b91[_0x3861f7];return _0x50879f;};'use strict';var multer=require(_0x15b9('0x0'));var util=require(_0x15b9('0x1'));var path=require(_0x15b9('0x2'));var timeout=require(_0x15b9('0x3'));var express=require(_0x15b9('0x4'));var router=express['Router']();var auth=require(_0x15b9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x15b9('0x6'));router['get']('/',auth[_0x15b9('0x7')](),controller[_0x15b9('0x8')]);router['get'](_0x15b9('0x9'),auth[_0x15b9('0x7')](),controller[_0x15b9('0xa')]);router[_0x15b9('0xb')]('/',auth[_0x15b9('0x7')](),controller['create']);router[_0x15b9('0xc')]('/:id',auth[_0x15b9('0x7')](),controller[_0x15b9('0xd')]);router[_0x15b9('0xe')]('/:id',auth[_0x15b9('0x7')](),controller[_0x15b9('0xf')]);module[_0x15b9('0x10')]=router; \ No newline at end of file +var _0xe0ec=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe0ec,0xf8));var _0xce0e=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0xe0ec[_0x588011];return _0x3b3773;};'use strict';var multer=require(_0xce0e('0x0'));var util=require(_0xce0e('0x1'));var path=require('path');var timeout=require(_0xce0e('0x2'));var express=require(_0xce0e('0x3'));var router=express[_0xce0e('0x4')]();var auth=require(_0xce0e('0x5'));var interaction=require(_0xce0e('0x6'));var config=require(_0xce0e('0x7'));var controller=require('./smsApplication.controller');router[_0xce0e('0x8')]('/',auth['isAuthenticated'](),controller[_0xce0e('0x9')]);router[_0xce0e('0x8')](_0xce0e('0xa'),auth[_0xce0e('0xb')](),controller[_0xce0e('0xc')]);router[_0xce0e('0xd')]('/',auth[_0xce0e('0xb')](),controller['create']);router[_0xce0e('0xe')]('/:id',auth[_0xce0e('0xb')](),controller[_0xce0e('0xf')]);router[_0xce0e('0x10')]('/:id',auth[_0xce0e('0xb')](),controller[_0xce0e('0x11')]);module[_0xce0e('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8141705..3d78ce9 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 _0x16f5=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x8eb4eb,_0xa70079){var _0x1ff8e3=function(_0x1e118e){while(--_0x1e118e){_0x8eb4eb['push'](_0x8eb4eb['shift']());}};_0x1ff8e3(++_0xa70079);}(_0x16f5,0x84));var _0x516f=function(_0x903a09,_0x19c2c4){_0x903a09=_0x903a09-0x0;var _0x351169=_0x16f5[_0x903a09];return _0x351169;};'use strict';var Sequelize=require(_0x516f('0x0'));module[_0x516f('0x1')]={'priority':{'type':Sequelize[_0x516f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x516f('0x3')],'allowNull':![],'defaultValue':_0x516f('0x4')},'appdata':{'type':Sequelize[_0x516f('0x5')]()},'description':{'type':Sequelize[_0x516f('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x61c2=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x61c2,0x147));var _0x261c=function(_0x4adbcd,_0x58ed6a){_0x4adbcd=_0x4adbcd-0x0;var _0x2e7a58=_0x61c2[_0x4adbcd];return _0x2e7a58;};'use strict';var Sequelize=require(_0x261c('0x0'));module[_0x261c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x261c('0x2')},'appdata':{'type':Sequelize[_0x261c('0x3')]()},'description':{'type':Sequelize[_0x261c('0x4')]},'interval':{'type':Sequelize[_0x261c('0x4')],'defaultValue':_0x261c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ab45fe1..b47d860 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 _0x65cb=['filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys'];(function(_0x3891fe,_0x4101bb){var _0x575c3a=function(_0x2fab54){while(--_0x2fab54){_0x3891fe['push'](_0x3891fe['shift']());}};_0x575c3a(++_0x4101bb);}(_0x65cb,0xa4));var _0xb65c=function(_0x3169d9,_0x365029){_0x3169d9=_0x3169d9-0x0;var _0x5147be=_0x65cb[_0x3169d9];return _0x5147be;};'use strict';var pdf=require(_0xb65c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb65c('0x1'));var zipdir=require(_0xb65c('0x2'));var jsonpatch=require(_0xb65c('0x3'));var rp=require('request-promise');var moment=require(_0xb65c('0x4'));var BPromise=require(_0xb65c('0x5'));var Mustache=require(_0xb65c('0x6'));var util=require(_0xb65c('0x7'));var path=require(_0xb65c('0x8'));var sox=require('sox');var csv=require(_0xb65c('0x9'));var ejs=require(_0xb65c('0xa'));var fs=require('fs');var _=require(_0xb65c('0xb'));var squel=require(_0xb65c('0xc'));var crypto=require(_0xb65c('0xd'));var jsforce=require(_0xb65c('0xe'));var deskjs=require(_0xb65c('0xf'));var toCsv=require(_0xb65c('0x9'));var querystring=require('querystring');var Papa=require(_0xb65c('0x10'));var Redis=require(_0xb65c('0x11'));var authService=require(_0xb65c('0x12'));var qs=require(_0xb65c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb65c('0x14'));var logger=require('../../config/logger')(_0xb65c('0x15'));var utils=require(_0xb65c('0x16'));var config=require(_0xb65c('0x17'));var licenseUtil=require(_0xb65c('0x18'));var db=require(_0xb65c('0x19'))['db'];function respondWithStatusCode(_0xbab2df,_0x4eb271){_0x4eb271=_0x4eb271||0xcc;return function(_0x340e60){if(_0x340e60){return _0xbab2df[_0xb65c('0x1a')](_0x4eb271);}return _0xbab2df[_0xb65c('0x1b')](_0x4eb271)[_0xb65c('0x1c')]();};}function respondWithResult(_0x3f1e8b,_0x11ebca){_0x11ebca=_0x11ebca||0xc8;return function(_0x2821e2){if(_0x2821e2){return _0x3f1e8b['status'](_0x11ebca)[_0xb65c('0x1d')](_0x2821e2);}};}function respondWithFilteredResult(_0x22eb85,_0x5a4354){return function(_0x288314){if(_0x288314){var _0x5c6d66=_0x288314[_0xb65c('0x1e')],_0x32f4b5=_0x5a4354[_0xb65c('0x1f')],_0x20b28e=_0x5a4354[_0xb65c('0x1f')]+_0x5a4354[_0xb65c('0x20')],_0x2666e4;if(_0x20b28e>=_0x5c6d66){_0x20b28e=_0x5c6d66;_0x2666e4=0xc8;}else{_0x2666e4=0xce;}_0x22eb85[_0xb65c('0x1b')](_0x2666e4);return _0x22eb85[_0xb65c('0x21')](_0xb65c('0x22'),_0x32f4b5+'-'+_0x20b28e+'/'+_0x5c6d66)[_0xb65c('0x1d')](_0x288314);}return null;};}function patchUpdates(_0x1e7d8d){return function(_0x2fe603){try{jsonpatch[_0xb65c('0x23')](_0x2fe603,_0x1e7d8d,!![]);}catch(_0x1d36f9){return BPromise['reject'](_0x1d36f9);}return _0x2fe603[_0xb65c('0x24')]();};}function saveUpdates(_0x2733c6,_0x45b7e9){return function(_0x43a2ab){if(_0x43a2ab){return _0x43a2ab[_0xb65c('0x25')](_0x2733c6)[_0xb65c('0x26')](function(_0xe9bac4){return _0xe9bac4;});}return null;};}function removeEntity(_0x2727cc,_0x248364){return function(_0x33fa4c){if(_0x33fa4c){return _0x33fa4c[_0xb65c('0x27')]()[_0xb65c('0x26')](function(){_0x2727cc[_0xb65c('0x1b')](0xcc)[_0xb65c('0x1c')]();});}};}function handleEntityNotFound(_0xe16c8f,_0x5ed03){return function(_0x108eb9){if(!_0x108eb9){_0xe16c8f['sendStatus'](0x194);}return _0x108eb9;};}function handleError(_0xe6e1b0,_0x11ba0b){_0x11ba0b=_0x11ba0b||0x1f4;return function(_0x29c0c0){logger['error'](_0x29c0c0[_0xb65c('0x28')]);if(_0x29c0c0[_0xb65c('0x29')]){delete _0x29c0c0['name'];}_0xe6e1b0['status'](_0x11ba0b)[_0xb65c('0x2a')](_0x29c0c0);};}exports[_0xb65c('0x2b')]=function(_0xeb8e29,_0xc65b5a){var _0x4a9b0c={},_0x22bf5b={},_0x186f32={'count':0x0,'rows':[]};var _0x3e372d=_[_0xb65c('0x2c')](db[_0xb65c('0x2d')][_0xb65c('0x2e')],function(_0x5158d9){return{'name':_0x5158d9[_0xb65c('0x2f')],'type':_0x5158d9[_0xb65c('0x30')][_0xb65c('0x31')]};});_0x22bf5b['model']=_[_0xb65c('0x2c')](_0x3e372d,'name');_0x22bf5b[_0xb65c('0x32')]=_[_0xb65c('0x33')](_0xeb8e29['query']);_0x22bf5b[_0xb65c('0x34')]=_[_0xb65c('0x35')](_0x22bf5b[_0xb65c('0x36')],_0x22bf5b[_0xb65c('0x32')]);_0x4a9b0c[_0xb65c('0x37')]=_[_0xb65c('0x35')](_0x22bf5b[_0xb65c('0x36')],qs[_0xb65c('0x38')](_0xeb8e29['query'][_0xb65c('0x38')]));_0x4a9b0c[_0xb65c('0x37')]=_0x4a9b0c[_0xb65c('0x37')]['length']?_0x4a9b0c['attributes']:_0x22bf5b[_0xb65c('0x36')];if(!_0xeb8e29['query'][_0xb65c('0x39')]('nolimit')){_0x4a9b0c[_0xb65c('0x20')]=qs[_0xb65c('0x20')](_0xeb8e29[_0xb65c('0x32')][_0xb65c('0x20')]);_0x4a9b0c['offset']=qs[_0xb65c('0x1f')](_0xeb8e29['query'][_0xb65c('0x1f')]);}_0x4a9b0c['order']=qs[_0xb65c('0x3a')](_0xeb8e29[_0xb65c('0x32')][_0xb65c('0x3a')]);_0x4a9b0c[_0xb65c('0x3b')]=qs['filters'](_[_0xb65c('0x3c')](_0xeb8e29[_0xb65c('0x32')],_0x22bf5b[_0xb65c('0x34')]),_0x3e372d);if(_0xeb8e29['query'][_0xb65c('0x3d')]){_0x4a9b0c[_0xb65c('0x3b')]=_['merge'](_0x4a9b0c['where'],{'$or':_[_0xb65c('0x2c')](_0x3e372d,function(_0x18f21c){if(_0x18f21c[_0xb65c('0x30')]!==_0xb65c('0x3e')){var _0x599a8e={};_0x599a8e[_0x18f21c[_0xb65c('0x29')]]={'$like':'%'+_0xeb8e29[_0xb65c('0x32')][_0xb65c('0x3d')]+'%'};return _0x599a8e;}})});}_0x4a9b0c=_[_0xb65c('0x3f')]({},_0x4a9b0c,_0xeb8e29['options']);var _0x12c685={'where':_0x4a9b0c[_0xb65c('0x3b')]};return db[_0xb65c('0x2d')][_0xb65c('0x1e')](_0x12c685)[_0xb65c('0x26')](function(_0x12a8c0){_0x186f32[_0xb65c('0x1e')]=_0x12a8c0;if(_0xeb8e29[_0xb65c('0x32')][_0xb65c('0x40')]){_0x4a9b0c[_0xb65c('0x41')]=[{'all':!![]}];}return db[_0xb65c('0x2d')][_0xb65c('0x42')](_0x4a9b0c);})[_0xb65c('0x26')](function(_0x5b7d0f){_0x186f32['rows']=_0x5b7d0f;return _0x186f32;})[_0xb65c('0x26')](respondWithFilteredResult(_0xc65b5a,_0x4a9b0c))[_0xb65c('0x43')](handleError(_0xc65b5a,null));};exports[_0xb65c('0x44')]=function(_0x536bad,_0x42acd6){var _0x2ba544={'raw':!![],'where':{'id':_0x536bad['params']['id']}},_0x52addb={};_0x52addb[_0xb65c('0x36')]=_[_0xb65c('0x33')](db[_0xb65c('0x2d')][_0xb65c('0x2e')]);_0x52addb[_0xb65c('0x32')]=_[_0xb65c('0x33')](_0x536bad['query']);_0x52addb[_0xb65c('0x34')]=_[_0xb65c('0x35')](_0x52addb[_0xb65c('0x36')],_0x52addb[_0xb65c('0x32')]);_0x2ba544[_0xb65c('0x37')]=_[_0xb65c('0x35')](_0x52addb['model'],qs[_0xb65c('0x38')](_0x536bad[_0xb65c('0x32')][_0xb65c('0x38')]));_0x2ba544[_0xb65c('0x37')]=_0x2ba544[_0xb65c('0x37')]['length']?_0x2ba544[_0xb65c('0x37')]:_0x52addb[_0xb65c('0x36')];if(_0x536bad[_0xb65c('0x32')][_0xb65c('0x40')]){_0x2ba544[_0xb65c('0x41')]=[{'all':!![]}];}_0x2ba544=_['merge']({},_0x2ba544,_0x536bad['options']);return db[_0xb65c('0x2d')][_0xb65c('0x45')](_0x2ba544)[_0xb65c('0x26')](handleEntityNotFound(_0x42acd6,null))[_0xb65c('0x26')](respondWithResult(_0x42acd6,null))['catch'](handleError(_0x42acd6,null));};exports[_0xb65c('0x46')]=function(_0x461e91,_0x5f560f){return db[_0xb65c('0x2d')]['create'](_0x461e91[_0xb65c('0x47')],{})[_0xb65c('0x26')](respondWithResult(_0x5f560f,0xc9))[_0xb65c('0x43')](handleError(_0x5f560f,null));};exports[_0xb65c('0x25')]=function(_0x530e34,_0xe4b55d){if(_0x530e34[_0xb65c('0x47')]['id']){delete _0x530e34[_0xb65c('0x47')]['id'];}return db[_0xb65c('0x2d')][_0xb65c('0x45')]({'where':{'id':_0x530e34['params']['id']}})['then'](handleEntityNotFound(_0xe4b55d,null))[_0xb65c('0x26')](saveUpdates(_0x530e34[_0xb65c('0x47')],null))[_0xb65c('0x26')](respondWithResult(_0xe4b55d,null))['catch'](handleError(_0xe4b55d,null));};exports[_0xb65c('0x27')]=function(_0x59c168,_0x2ca61f){return db['SmsApplication']['find']({'where':{'id':_0x59c168['params']['id']}})[_0xb65c('0x26')](handleEntityNotFound(_0x2ca61f,null))['then'](removeEntity(_0x2ca61f,null))['catch'](handleError(_0x2ca61f,null));}; \ No newline at end of file +var _0xd837=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd837,0x1f2));var _0x7d83=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0xd837[_0x3fa296];return _0x10b19f;};'use strict';var pdf=require(_0x7d83('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d83('0x1'));var zipdir=require(_0x7d83('0x2'));var jsonpatch=require(_0x7d83('0x3'));var rp=require('request-promise');var moment=require(_0x7d83('0x4'));var BPromise=require(_0x7d83('0x5'));var Mustache=require(_0x7d83('0x6'));var util=require(_0x7d83('0x7'));var path=require(_0x7d83('0x8'));var sox=require(_0x7d83('0x9'));var csv=require(_0x7d83('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d83('0xb'));var squel=require(_0x7d83('0xc'));var crypto=require(_0x7d83('0xd'));var jsforce=require(_0x7d83('0xe'));var deskjs=require(_0x7d83('0xf'));var toCsv=require(_0x7d83('0xa'));var querystring=require(_0x7d83('0x10'));var Papa=require(_0x7d83('0x11'));var Redis=require(_0x7d83('0x12'));var authService=require(_0x7d83('0x13'));var qs=require(_0x7d83('0x14'));var as=require(_0x7d83('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d83('0x16'))(_0x7d83('0x17'));var utils=require('../../config/utils');var config=require(_0x7d83('0x18'));var licenseUtil=require(_0x7d83('0x19'));var db=require(_0x7d83('0x1a'))['db'];function respondWithStatusCode(_0x24df23,_0x2259d1){_0x2259d1=_0x2259d1||0xcc;return function(_0x23d717){if(_0x23d717){return _0x24df23[_0x7d83('0x1b')](_0x2259d1);}return _0x24df23[_0x7d83('0x1c')](_0x2259d1)[_0x7d83('0x1d')]();};}function respondWithResult(_0x1f2724,_0x286054){_0x286054=_0x286054||0xc8;return function(_0x3e870d){if(_0x3e870d){return _0x1f2724[_0x7d83('0x1c')](_0x286054)[_0x7d83('0x1e')](_0x3e870d);}};}function respondWithFilteredResult(_0x569cb6,_0x22205b){return function(_0xf74ca6){if(_0xf74ca6){var _0x2b4d35=_0xf74ca6[_0x7d83('0x1f')],_0x4ff257=_0x22205b[_0x7d83('0x20')],_0x1d38c9=_0x22205b[_0x7d83('0x20')]+_0x22205b[_0x7d83('0x21')],_0x328ad3;if(_0x1d38c9>=_0x2b4d35){_0x1d38c9=_0x2b4d35;_0x328ad3=0xc8;}else{_0x328ad3=0xce;}_0x569cb6['status'](_0x328ad3);return _0x569cb6['set'](_0x7d83('0x22'),_0x4ff257+'-'+_0x1d38c9+'/'+_0x2b4d35)['json'](_0xf74ca6);}return null;};}function patchUpdates(_0x11119b){return function(_0x4a3961){try{jsonpatch[_0x7d83('0x23')](_0x4a3961,_0x11119b,!![]);}catch(_0x22dbfa){return BPromise[_0x7d83('0x24')](_0x22dbfa);}return _0x4a3961[_0x7d83('0x25')]();};}function saveUpdates(_0x132e02,_0x8dc296){return function(_0xc0e1f7){if(_0xc0e1f7){return _0xc0e1f7[_0x7d83('0x26')](_0x132e02)[_0x7d83('0x27')](function(_0x518f5){return _0x518f5;});}return null;};}function removeEntity(_0x8e63e3,_0x1cbae1){return function(_0x441a82){if(_0x441a82){return _0x441a82[_0x7d83('0x28')]()['then'](function(){_0x8e63e3[_0x7d83('0x1c')](0xcc)[_0x7d83('0x1d')]();});}};}function handleEntityNotFound(_0x31d738,_0x131642){return function(_0xf87669){if(!_0xf87669){_0x31d738[_0x7d83('0x1b')](0x194);}return _0xf87669;};}function handleError(_0x1288a5,_0x3b5136){_0x3b5136=_0x3b5136||0x1f4;return function(_0xb1f9d0){logger['error'](_0xb1f9d0[_0x7d83('0x29')]);if(_0xb1f9d0['name']){delete _0xb1f9d0[_0x7d83('0x2a')];}_0x1288a5[_0x7d83('0x1c')](_0x3b5136)[_0x7d83('0x2b')](_0xb1f9d0);};}exports[_0x7d83('0x2c')]=function(_0x3faca8,_0x5739f7){var _0x54dc9e={},_0x3bc9c4={},_0x1db2f6={'count':0x0,'rows':[]};var _0x4b8254=_[_0x7d83('0x2d')](db[_0x7d83('0x2e')][_0x7d83('0x2f')],function(_0x3ba8ef){return{'name':_0x3ba8ef['fieldName'],'type':_0x3ba8ef[_0x7d83('0x30')][_0x7d83('0x31')]};});_0x3bc9c4[_0x7d83('0x32')]=_[_0x7d83('0x2d')](_0x4b8254,'name');_0x3bc9c4[_0x7d83('0x33')]=_[_0x7d83('0x34')](_0x3faca8['query']);_0x3bc9c4[_0x7d83('0x35')]=_[_0x7d83('0x36')](_0x3bc9c4['model'],_0x3bc9c4[_0x7d83('0x33')]);_0x54dc9e[_0x7d83('0x37')]=_['intersection'](_0x3bc9c4['model'],qs['fields'](_0x3faca8[_0x7d83('0x33')][_0x7d83('0x38')]));_0x54dc9e['attributes']=_0x54dc9e[_0x7d83('0x37')][_0x7d83('0x39')]?_0x54dc9e['attributes']:_0x3bc9c4[_0x7d83('0x32')];if(!_0x3faca8[_0x7d83('0x33')]['hasOwnProperty']('nolimit')){_0x54dc9e[_0x7d83('0x21')]=qs['limit'](_0x3faca8[_0x7d83('0x33')][_0x7d83('0x21')]);_0x54dc9e[_0x7d83('0x20')]=qs[_0x7d83('0x20')](_0x3faca8[_0x7d83('0x33')][_0x7d83('0x20')]);}_0x54dc9e['order']=qs['sort'](_0x3faca8[_0x7d83('0x33')]['sort']);_0x54dc9e[_0x7d83('0x3a')]=qs[_0x7d83('0x35')](_[_0x7d83('0x3b')](_0x3faca8['query'],_0x3bc9c4[_0x7d83('0x35')]),_0x4b8254);if(_0x3faca8[_0x7d83('0x33')][_0x7d83('0x3c')]){_0x54dc9e[_0x7d83('0x3a')]=_[_0x7d83('0x3d')](_0x54dc9e[_0x7d83('0x3a')],{'$or':_[_0x7d83('0x2d')](_0x4b8254,function(_0x52c7f8){if(_0x52c7f8['type']!==_0x7d83('0x3e')){var _0xe19bf8={};_0xe19bf8[_0x52c7f8[_0x7d83('0x2a')]]={'$like':'%'+_0x3faca8[_0x7d83('0x33')]['filter']+'%'};return _0xe19bf8;}})});}_0x54dc9e=_['merge']({},_0x54dc9e,_0x3faca8[_0x7d83('0x3f')]);var _0x7aac41={'where':_0x54dc9e[_0x7d83('0x3a')]};return db[_0x7d83('0x2e')][_0x7d83('0x1f')](_0x7aac41)[_0x7d83('0x27')](function(_0x130a50){_0x1db2f6[_0x7d83('0x1f')]=_0x130a50;if(_0x3faca8[_0x7d83('0x33')][_0x7d83('0x40')]){_0x54dc9e[_0x7d83('0x41')]=[{'all':!![]}];}return db[_0x7d83('0x2e')][_0x7d83('0x42')](_0x54dc9e);})['then'](function(_0x49135e){_0x1db2f6[_0x7d83('0x43')]=_0x49135e;return _0x1db2f6;})[_0x7d83('0x27')](respondWithFilteredResult(_0x5739f7,_0x54dc9e))[_0x7d83('0x44')](handleError(_0x5739f7,null));};exports[_0x7d83('0x45')]=function(_0x273699,_0x55a27d){var _0x26437f={'raw':!![],'where':{'id':_0x273699[_0x7d83('0x46')]['id']}},_0x439556={};_0x439556[_0x7d83('0x32')]=_[_0x7d83('0x34')](db[_0x7d83('0x2e')][_0x7d83('0x2f')]);_0x439556['query']=_[_0x7d83('0x34')](_0x273699[_0x7d83('0x33')]);_0x439556[_0x7d83('0x35')]=_[_0x7d83('0x36')](_0x439556[_0x7d83('0x32')],_0x439556[_0x7d83('0x33')]);_0x26437f[_0x7d83('0x37')]=_[_0x7d83('0x36')](_0x439556[_0x7d83('0x32')],qs[_0x7d83('0x38')](_0x273699[_0x7d83('0x33')][_0x7d83('0x38')]));_0x26437f[_0x7d83('0x37')]=_0x26437f[_0x7d83('0x37')]['length']?_0x26437f[_0x7d83('0x37')]:_0x439556['model'];if(_0x273699[_0x7d83('0x33')][_0x7d83('0x40')]){_0x26437f['include']=[{'all':!![]}];}_0x26437f=_['merge']({},_0x26437f,_0x273699[_0x7d83('0x3f')]);return db[_0x7d83('0x2e')][_0x7d83('0x47')](_0x26437f)['then'](handleEntityNotFound(_0x55a27d,null))[_0x7d83('0x27')](respondWithResult(_0x55a27d,null))[_0x7d83('0x44')](handleError(_0x55a27d,null));};exports[_0x7d83('0x48')]=function(_0x730693,_0x4cd30b){return db[_0x7d83('0x2e')][_0x7d83('0x48')](_0x730693[_0x7d83('0x49')],{})[_0x7d83('0x27')](respondWithResult(_0x4cd30b,0xc9))[_0x7d83('0x44')](handleError(_0x4cd30b,null));};exports[_0x7d83('0x26')]=function(_0x2e450a,_0x482572){if(_0x2e450a[_0x7d83('0x49')]['id']){delete _0x2e450a[_0x7d83('0x49')]['id'];}return db[_0x7d83('0x2e')]['find']({'where':{'id':_0x2e450a[_0x7d83('0x46')]['id']}})[_0x7d83('0x27')](handleEntityNotFound(_0x482572,null))[_0x7d83('0x27')](saveUpdates(_0x2e450a[_0x7d83('0x49')],null))[_0x7d83('0x27')](respondWithResult(_0x482572,null))[_0x7d83('0x44')](handleError(_0x482572,null));};exports['destroy']=function(_0x7972ee,_0x5e7327){return db[_0x7d83('0x2e')][_0x7d83('0x47')]({'where':{'id':_0x7972ee[_0x7d83('0x46')]['id']}})[_0x7d83('0x27')](handleEntityNotFound(_0x5e7327,null))[_0x7d83('0x27')](removeEntity(_0x5e7327,null))[_0x7d83('0x44')](handleError(_0x5e7327,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d6d19ab..e7e4d85 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 _0x387b=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x387b,0x1ca));var _0xb387=function(_0xe5ddfc,_0x59a8ae){_0xe5ddfc=_0xe5ddfc-0x0;var _0x3fb423=_0x387b[_0xe5ddfc];return _0x3fb423;};'use strict';var _=require(_0xb387('0x0'));var util=require(_0xb387('0x1'));var logger=require(_0xb387('0x2'))(_0xb387('0x3'));var moment=require(_0xb387('0x4'));var BPromise=require(_0xb387('0x5'));var rp=require(_0xb387('0x6'));var fs=require('fs');var path=require(_0xb387('0x7'));var rimraf=require(_0xb387('0x8'));var config=require(_0xb387('0x9'));var attributes=require(_0xb387('0xa'));module[_0xb387('0xb')]=function(_0x3279d1,_0x15251c){return _0x3279d1[_0xb387('0xc')]('SmsApplication',attributes,{'tableName':_0xb387('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb387('0xe'),'collate':_0xb387('0xf')});}; \ No newline at end of file +var _0xc87c=['exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./smsApplication.attributes'];(function(_0x104ee3,_0x71dc19){var _0x24af58=function(_0x194406){while(--_0x194406){_0x104ee3['push'](_0x104ee3['shift']());}};_0x24af58(++_0x71dc19);}(_0xc87c,0x19d));var _0xcc87=function(_0x20bd44,_0x514a66){_0x20bd44=_0x20bd44-0x0;var _0x27bb75=_0xc87c[_0x20bd44];return _0x27bb75;};'use strict';var _=require('lodash');var util=require(_0xcc87('0x0'));var logger=require(_0xcc87('0x1'))('api');var moment=require(_0xcc87('0x2'));var BPromise=require(_0xcc87('0x3'));var rp=require(_0xcc87('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc87('0x5'));var attributes=require(_0xcc87('0x6'));module[_0xcc87('0x7')]=function(_0x6a12b6,_0x26c289){return _0x6a12b6[_0xcc87('0x8')](_0xcc87('0x9'),attributes,{'tableName':_0xcc87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcc87('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 87a0d79..e0eb15e 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 _0xb3d8=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d1c6b,_0x2b5236){var _0x249475=function(_0xab55e4){while(--_0xab55e4){_0x4d1c6b['push'](_0x4d1c6b['shift']());}};_0x249475(++_0x2b5236);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x1f34e5,_0x53fde2){_0x1f34e5=_0x1f34e5-0x0;var _0x23cdb4=_0xb3d8[_0x1f34e5];return _0x23cdb4;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var moment=require(_0x8b3d('0x1'));var BPromise=require(_0x8b3d('0x2'));var rs=require(_0x8b3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b3d('0x4'));var logger=require(_0x8b3d('0x5'))(_0x8b3d('0x6'));var config=require(_0x8b3d('0x7'));var jayson=require(_0x8b3d('0x8'));var client=jayson[_0x8b3d('0x9')][_0x8b3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4447a2,_0x7ddf10,_0x5d3aeb){return new BPromise(function(_0x278a75,_0x2fef94){return client[_0x8b3d('0xb')](_0x4447a2,_0x5d3aeb)[_0x8b3d('0xc')](function(_0x375fa7){logger[_0x8b3d('0xd')](_0x8b3d('0xe'),_0x7ddf10,_0x8b3d('0xf'));logger[_0x8b3d('0x10')](_0x8b3d('0x11'),_0x7ddf10,'request\x20sent',JSON['stringify'](_0x375fa7));if(_0x375fa7[_0x8b3d('0x12')]){if(_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x13')]===0x1f4){logger[_0x8b3d('0x12')](_0x8b3d('0xe'),_0x7ddf10,_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);return _0x2fef94(_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);}logger[_0x8b3d('0x12')](_0x8b3d('0xe'),_0x7ddf10,_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);return _0x278a75(_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);}else{logger[_0x8b3d('0xd')]('SmsApplication,\x20%s,\x20%s',_0x7ddf10,_0x8b3d('0xf'));_0x278a75(_0x375fa7[_0x8b3d('0x15')]['message']);}})[_0x8b3d('0x16')](function(_0x1652e7){logger['error'](_0x8b3d('0xe'),_0x7ddf10,_0x1652e7);_0x2fef94(_0x1652e7);});});} \ No newline at end of file +var _0x50b9=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x180e0a,_0x176213){var _0x1595e0=function(_0x3ad2a6){while(--_0x3ad2a6){_0x180e0a['push'](_0x180e0a['shift']());}};_0x1595e0(++_0x176213);}(_0x50b9,0x171));var _0x950b=function(_0x20b18f,_0xf29421){_0x20b18f=_0x20b18f-0x0;var _0x510ea8=_0x50b9[_0x20b18f];return _0x510ea8;};'use strict';var _=require(_0x950b('0x0'));var util=require('util');var moment=require(_0x950b('0x1'));var BPromise=require('bluebird');var rs=require(_0x950b('0x2'));var fs=require('fs');var Redis=require(_0x950b('0x3'));var db=require(_0x950b('0x4'))['db'];var utils=require(_0x950b('0x5'));var logger=require(_0x950b('0x6'))(_0x950b('0x7'));var config=require(_0x950b('0x8'));var jayson=require(_0x950b('0x9'));var client=jayson[_0x950b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26ff96,_0x34133e,_0x9258eb){return new BPromise(function(_0x585413,_0x4b7a6a){return client['request'](_0x26ff96,_0x9258eb)[_0x950b('0xb')](function(_0x26b30f){logger[_0x950b('0xc')](_0x950b('0xd'),_0x34133e,_0x950b('0xe'));logger[_0x950b('0xf')](_0x950b('0x10'),_0x34133e,'request\x20sent',JSON[_0x950b('0x11')](_0x26b30f));if(_0x26b30f[_0x950b('0x12')]){if(_0x26b30f['error'][_0x950b('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x34133e,_0x26b30f[_0x950b('0x12')][_0x950b('0x14')]);return _0x4b7a6a(_0x26b30f[_0x950b('0x12')][_0x950b('0x14')]);}logger[_0x950b('0x12')](_0x950b('0xd'),_0x34133e,_0x26b30f[_0x950b('0x12')][_0x950b('0x14')]);return _0x585413(_0x26b30f[_0x950b('0x12')][_0x950b('0x14')]);}else{logger[_0x950b('0xc')](_0x950b('0xd'),_0x34133e,_0x950b('0xe'));_0x585413(_0x26b30f[_0x950b('0x15')][_0x950b('0x14')]);}})[_0x950b('0x16')](function(_0x14cb6b){logger[_0x950b('0x12')]('SmsApplication,\x20%s,\x20%s',_0x34133e,_0x14cb6b);_0x4b7a6a(_0x14cb6b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7b53bd5..725069a 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 _0xe2c2=['download','post','addMessage','/:id/tags','tracked','sms','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download'];(function(_0x22b4c4,_0x5f033c){var _0x3540b9=function(_0x5204ec){while(--_0x5204ec){_0x22b4c4['push'](_0x22b4c4['shift']());}};_0x3540b9(++_0x5f033c);}(_0xe2c2,0xbc));var _0x2e2c=function(_0x233cce,_0x3e2f51){_0x233cce=_0x233cce-0x0;var _0x5e1a05=_0xe2c2[_0x233cce];return _0x5e1a05;};'use strict';var multer=require('multer');var util=require(_0x2e2c('0x0'));var path=require(_0x2e2c('0x1'));var timeout=require(_0x2e2c('0x2'));var express=require('express');var router=express[_0x2e2c('0x3')]();var auth=require(_0x2e2c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e2c('0x5'));var controller=require(_0x2e2c('0x6'));router[_0x2e2c('0x7')]('/',auth[_0x2e2c('0x8')](),controller[_0x2e2c('0x9')]);router[_0x2e2c('0x7')](_0x2e2c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2e2c('0x7')](_0x2e2c('0xb'),auth[_0x2e2c('0x8')](),controller['show']);router['get'](_0x2e2c('0xc'),auth[_0x2e2c('0x8')](),controller[_0x2e2c('0xd')]);router[_0x2e2c('0x7')](_0x2e2c('0xe'),auth[_0x2e2c('0x8')](),controller[_0x2e2c('0xf')]);router[_0x2e2c('0x10')]('/',auth[_0x2e2c('0x8')](),controller['create']);router[_0x2e2c('0x10')](_0x2e2c('0xc'),auth[_0x2e2c('0x8')](),controller[_0x2e2c('0x11')]);router[_0x2e2c('0x10')](_0x2e2c('0x12'),auth[_0x2e2c('0x8')](),interaction[_0x2e2c('0x13')](_0x2e2c('0x14'),'smsinteraction:addtags'),controller['addTags']);router[_0x2e2c('0x15')]('/:id',auth[_0x2e2c('0x8')](),interaction[_0x2e2c('0x13')](_0x2e2c('0x14'),_0x2e2c('0x16')),controller[_0x2e2c('0x17')]);router[_0x2e2c('0x18')](_0x2e2c('0xb'),auth[_0x2e2c('0x8')](),interaction[_0x2e2c('0x13')](_0x2e2c('0x14'),_0x2e2c('0x19')),controller[_0x2e2c('0x1a')]);router['delete'](_0x2e2c('0x12'),auth[_0x2e2c('0x8')](),controller[_0x2e2c('0x1b')]);module[_0x2e2c('0x1c')]=router; \ No newline at end of file +var _0x4a9f=['post','create','/:id/messages','tracked','sms','smsinteraction:addtags','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download'];(function(_0x4eb4a6,_0x171da6){var _0xb09035=function(_0x30fcf9){while(--_0x30fcf9){_0x4eb4a6['push'](_0x4eb4a6['shift']());}};_0xb09035(++_0x171da6);}(_0x4a9f,0x182));var _0xf4a9=function(_0x43347e,_0x12f3ac){_0x43347e=_0x43347e-0x0;var _0xcb5363=_0x4a9f[_0x43347e];return _0xcb5363;};'use strict';var multer=require(_0xf4a9('0x0'));var util=require(_0xf4a9('0x1'));var path=require(_0xf4a9('0x2'));var timeout=require(_0xf4a9('0x3'));var express=require('express');var router=express[_0xf4a9('0x4')]();var auth=require(_0xf4a9('0x5'));var interaction=require(_0xf4a9('0x6'));var config=require('../../config/environment');var controller=require(_0xf4a9('0x7'));router[_0xf4a9('0x8')]('/',auth[_0xf4a9('0x9')](),controller[_0xf4a9('0xa')]);router[_0xf4a9('0x8')]('/describe',auth[_0xf4a9('0x9')](),controller[_0xf4a9('0xb')]);router[_0xf4a9('0x8')](_0xf4a9('0xc'),auth[_0xf4a9('0x9')](),controller[_0xf4a9('0xd')]);router[_0xf4a9('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf4a9('0xe')]);router[_0xf4a9('0x8')](_0xf4a9('0xf'),auth[_0xf4a9('0x9')](),controller[_0xf4a9('0x10')]);router[_0xf4a9('0x11')]('/',auth['isAuthenticated'](),controller[_0xf4a9('0x12')]);router['post'](_0xf4a9('0x13'),auth[_0xf4a9('0x9')](),controller['addMessage']);router['post']('/:id/tags',auth[_0xf4a9('0x9')](),interaction[_0xf4a9('0x14')](_0xf4a9('0x15'),_0xf4a9('0x16')),controller['addTags']);router['put'](_0xf4a9('0xc'),auth[_0xf4a9('0x9')](),interaction[_0xf4a9('0x14')](_0xf4a9('0x15'),_0xf4a9('0x17')),controller[_0xf4a9('0x18')]);router['delete'](_0xf4a9('0xc'),auth[_0xf4a9('0x9')](),interaction[_0xf4a9('0x14')](_0xf4a9('0x15'),_0xf4a9('0x19')),controller[_0xf4a9('0x1a')]);router[_0xf4a9('0x1b')](_0xf4a9('0x1c'),auth[_0xf4a9('0x9')](),controller[_0xf4a9('0x1d')]);module[_0xf4a9('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 905764f..afbd3e2 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 _0x3ab5=['STRING','ENUM','out','moment','exports','BOOLEAN','DATE'];(function(_0x364b65,_0x18484b){var _0x4e1ae4=function(_0x36cc19){while(--_0x36cc19){_0x364b65['push'](_0x364b65['shift']());}};_0x4e1ae4(++_0x18484b);}(_0x3ab5,0x199));var _0x53ab=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3ab5[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x53ab('0x0'));module[_0x53ab('0x1')]={'closed':{'type':Sequelize[_0x53ab('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x53ab('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x53ab('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x53ab('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x53ab('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x53ab('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x53ab('0x5')]('in',_0x53ab('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2646=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x15d3ad,_0x17e3cb){var _0x7b262d=function(_0x1e4f53){while(--_0x1e4f53){_0x15d3ad['push'](_0x15d3ad['shift']());}};_0x7b262d(++_0x17e3cb);}(_0x2646,0x13b));var _0x6264=function(_0x58c513,_0x15deec){_0x58c513=_0x58c513-0x0;var _0x4da4c4=_0x2646[_0x58c513];return _0x4da4c4;};'use strict';var Sequelize=require(_0x6264('0x0'));var moment=require(_0x6264('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6264('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6264('0x3')]},'disposition':{'type':Sequelize[_0x6264('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6264('0x4')]},'note':{'type':Sequelize[_0x6264('0x4')]},'phone':{'type':Sequelize[_0x6264('0x4')]},'read1stAt':{'type':Sequelize[_0x6264('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6264('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6264('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9f13239..5b43af6 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 _0xc483=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','show','params','include','options','create','describe','addMessage','ids','SmsMessage','nolimit','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','emit','smsInteractionTags:save','removeTags','download','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','Account','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Owner','N.A.','closedAt','disposition','direction','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','operator','UserId','body','some','compact','SmsAccountId','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','isEmpty','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','sequelize','toString','SmsInteraction','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','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email'];(function(_0x309a75,_0x3f1a22){var _0x21fea9=function(_0x4f85f5){while(--_0x4f85f5){_0x309a75['push'](_0x309a75['shift']());}};_0x21fea9(++_0x3f1a22);}(_0xc483,0x12b));var _0x3c48=function(_0x3bd2da,_0x2210e0){_0x3bd2da=_0x3bd2da-0x0;var _0x457b8f=_0xc483[_0x3bd2da];return _0x457b8f;};'use strict';var pdf=require(_0x3c48('0x0'));var emlformat=require(_0x3c48('0x1'));var rimraf=require(_0x3c48('0x2'));var zipdir=require(_0x3c48('0x3'));var jsonpatch=require(_0x3c48('0x4'));var rp=require(_0x3c48('0x5'));var moment=require(_0x3c48('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3c48('0x7'));var sox=require(_0x3c48('0x8'));var csv=require('to-csv');var ejs=require(_0x3c48('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c48('0xa'));var crypto=require(_0x3c48('0xb'));var jsforce=require(_0x3c48('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c48('0xd'));var querystring=require(_0x3c48('0xe'));var Papa=require(_0x3c48('0xf'));var Redis=require(_0x3c48('0x10'));var authService=require(_0x3c48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c48('0x12'));var hardwareService=require(_0x3c48('0x13'));var logger=require('../../config/logger')(_0x3c48('0x14'));var utils=require(_0x3c48('0x15'));var config=require(_0x3c48('0x16'));var licenseUtil=require(_0x3c48('0x17'));var db=require(_0x3c48('0x18'))['db'];config[_0x3c48('0x19')]=_['defaults'](config[_0x3c48('0x19')],{'host':_0x3c48('0x1a'),'port':0x18eb});var socket=require(_0x3c48('0x1b'))(new Redis(config[_0x3c48('0x19')]));require(_0x3c48('0x1c'))['register'](socket);function respondWithStatusCode(_0x58eeb4,_0x616e6a){_0x616e6a=_0x616e6a||0xcc;return function(_0x2c5ff5){if(_0x2c5ff5){return _0x58eeb4[_0x3c48('0x1d')](_0x616e6a);}return _0x58eeb4[_0x3c48('0x1e')](_0x616e6a)['end']();};}function respondWithResult(_0x575a1c,_0x308249){_0x308249=_0x308249||0xc8;return function(_0x53c3cd){if(_0x53c3cd){return _0x575a1c[_0x3c48('0x1e')](_0x308249)[_0x3c48('0x1f')](_0x53c3cd);}};}function respondWithFilteredResult(_0x35f4c8,_0x5626e4){return function(_0x4e0736){if(_0x4e0736){var _0x2510f1=_0x4e0736[_0x3c48('0x20')],_0x5655a2=_0x5626e4[_0x3c48('0x21')],_0x3c78a2=_0x5626e4[_0x3c48('0x21')]+_0x5626e4[_0x3c48('0x22')],_0x3c7fad;if(_0x3c78a2>=_0x2510f1){_0x3c78a2=_0x2510f1;_0x3c7fad=0xc8;}else{_0x3c7fad=0xce;}_0x35f4c8[_0x3c48('0x1e')](_0x3c7fad);return _0x35f4c8[_0x3c48('0x23')](_0x3c48('0x24'),_0x5655a2+'-'+_0x3c78a2+'/'+_0x2510f1)[_0x3c48('0x1f')](_0x4e0736);}return null;};}function patchUpdates(_0x172226){return function(_0x45aee4){try{jsonpatch[_0x3c48('0x25')](_0x45aee4,_0x172226,!![]);}catch(_0x192e41){return BPromise['reject'](_0x192e41);}return _0x45aee4['save']();};}function saveUpdates(_0xf7a288,_0x64a915){return function(_0x7f82b0){if(_0x7f82b0){return _0x7f82b0[_0x3c48('0x26')](_0xf7a288)[_0x3c48('0x27')](function(_0x24bef1){return _0x24bef1;});}return null;};}function removeEntity(_0x426075,_0x24f4e5){return function(_0x18768c){if(_0x18768c){return _0x18768c[_0x3c48('0x28')]()['then'](function(){_0x426075[_0x3c48('0x1e')](0xcc)[_0x3c48('0x29')]();});}};}function handleEntityNotFound(_0x135d63,_0x166e24){return function(_0x1c4d59){if(!_0x1c4d59){_0x135d63['sendStatus'](0x194);}return _0x1c4d59;};}function handleError(_0x3773dc,_0x164a13){_0x164a13=_0x164a13||0x1f4;return function(_0x4aebaa){logger[_0x3c48('0x2a')](_0x4aebaa[_0x3c48('0x2b')]);if(_0x4aebaa[_0x3c48('0x2c')]){delete _0x4aebaa[_0x3c48('0x2c')];}_0x3773dc['status'](_0x164a13)[_0x3c48('0x2d')](_0x4aebaa);};}function getInteractionUsers(_0x14895c,_0x144727){return new BPromise(function(_0x17115b,_0x2fb4c0){try{if(_0x144727[_0x14895c['id']]){_0x14895c['Users']=_[_0x3c48('0x2e')](_0x144727[_0x14895c['id']],function(_0x53eac3){return{'id':_0x53eac3['id'],'fullname':_0x53eac3[_0x3c48('0x2f')]};});}}catch(_0x290f84){_0x2fb4c0(_0x290f84);}_0x17115b(_0x14895c);});}function getInteractionTags(_0x2a6d80,_0x3353aa){return new BPromise(function(_0x7af97f,_0x228f2d){try{if(_0x2a6d80['TagIds']){_0x2a6d80[_0x3c48('0x30')]=[];_0x2a6d80[_0x3c48('0x31')][_0x3c48('0x32')](',')[_0x3c48('0x33')](function(_0x54eec8){_0x2a6d80[_0x3c48('0x30')][_0x3c48('0x34')](_0x3353aa[_0x54eec8]);});}delete _0x2a6d80[_0x3c48('0x31')];}catch(_0x36c82c){_0x228f2d(_0x36c82c);}_0x7af97f(_0x2a6d80);});}function updateSmsInteraction(_0x291cdb,_0x23cd06,_0x4b6e52){return new BPromise(function(_0x3b60fe,_0x1a0d10){return getInteractionUsers(_0x291cdb,_0x4b6e52)[_0x3c48('0x27')](function(_0xf628ba){return getInteractionTags(_0xf628ba,_0x23cd06);})[_0x3c48('0x27')](function(_0x3a531a){_0x3b60fe(_0x3a531a);})[_0x3c48('0x35')](function(_0x2b9ef8){_0x1a0d10(_0x2b9ef8);});});}exports['index']=function(_0x13f603,_0x32d878){var _0x404672={},_0x59548f={},_0x382d5a={'count':0x0,'rows':[]};var _0x381407=_[_0x3c48('0x2e')](db['SmsInteraction'][_0x3c48('0x36')],function(_0x5cab2a){return{'name':_0x5cab2a['fieldName'],'type':_0x5cab2a[_0x3c48('0x37')]['key']};});_0x59548f[_0x3c48('0x38')]=_[_0x3c48('0x2e')](_0x381407,'name');_0x59548f[_0x3c48('0x39')]=_[_0x3c48('0x3a')](_0x13f603[_0x3c48('0x39')]);_0x59548f[_0x3c48('0x3b')]=_[_0x3c48('0x3c')](_0x59548f['model'],_0x59548f[_0x3c48('0x39')]);_0x404672[_0x3c48('0x3d')]=_['intersection'](_0x59548f['model'],qs[_0x3c48('0x3e')](_0x13f603[_0x3c48('0x39')]['fields']));_0x404672[_0x3c48('0x3d')]=_0x404672[_0x3c48('0x3d')][_0x3c48('0x3f')]?_0x404672[_0x3c48('0x3d')]:_0x59548f[_0x3c48('0x38')];if(!_0x13f603['query'][_0x3c48('0x40')]('nolimit')){_0x404672[_0x3c48('0x22')]=qs[_0x3c48('0x22')](_0x13f603['query'][_0x3c48('0x22')]);_0x404672[_0x3c48('0x21')]=qs[_0x3c48('0x21')](_0x13f603[_0x3c48('0x39')][_0x3c48('0x21')]);}_0x404672[_0x3c48('0x41')]=qs[_0x3c48('0x42')](_0x13f603[_0x3c48('0x39')][_0x3c48('0x42')]);_0x404672[_0x3c48('0x43')]=qs['filters'](_[_0x3c48('0x44')](_0x13f603['query'],_0x59548f[_0x3c48('0x3b')]),_0x381407);var _0x3a0631=[];var _0x2223d0=squel[_0x3c48('0x45')]()[_0x3c48('0x46')]('id')[_0x3c48('0x46')](_0x3c48('0x2c'))[_0x3c48('0x46')](_0x3c48('0x47'))[_0x3c48('0x48')](_0x3c48('0x49'));var _0x162e77=squel['select']()['field'](_0x3c48('0x4a'))[_0x3c48('0x46')](_0x3c48('0x4b'))[_0x3c48('0x46')](_0x3c48('0x4c'))[_0x3c48('0x48')](_0x3c48('0x4d'),'ui')['left_join'](_0x3c48('0x4e'),'u',_0x3c48('0x4f'));var _0x1bf056=squel[_0x3c48('0x45')]()['from'](_0x3c48('0x50'),'i')[_0x3c48('0x51')](_0x3c48('0x52'),'c',_0x3c48('0x53'))[_0x3c48('0x51')](_0x3c48('0x4e'),'o','o.id\x20=\x20i.UserId')[_0x3c48('0x51')](_0x3c48('0x54'),'a',_0x3c48('0x55'))[_0x3c48('0x51')](_0x3c48('0x56'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x3c48('0x51')](_0x3c48('0x57'),'it',_0x3c48('0x58'))[_0x3c48('0x51')](_0x3c48('0x49'),'t',_0x3c48('0x59'));var _0x534f09=squel[_0x3c48('0x5a')]();var _0x1fdf68=[];var _0x4d3811=squel['expr']();var _0x1428b9;if(_0x13f603[_0x3c48('0x39')][_0x3c48('0x5b')]){_0x1428b9=as['parseSearch'](_0x13f603[_0x3c48('0x39')][_0x3c48('0x5b')]);var _0xe78914=_0x1428b9['sqlOperator'];for(var _0x3618e4=0x0;_0x3618e4<_0x1428b9[_0x3c48('0x5c')][_0x3c48('0x3f')];_0x3618e4++){var _0x373234=_0x1428b9[_0x3c48('0x5c')][_0x3618e4];var _0x50e82b='i';var _0x1e6e9d=_[_0x3c48('0x5d')](_0x381407,['name',_0x373234['field']]);if(!_0x1e6e9d){switch(_0x373234[_0x3c48('0x46')]){case'unreadMessages':if(_0x373234[_0x3c48('0x5e')]==0x1){_0x1bf056['having']('`'+_0x373234[_0x3c48('0x46')]+'`\x20=\x200');}else{_0x1bf056[_0x3c48('0x5f')]('`'+_0x373234['field']+_0x3c48('0x60'));}break;case _0x3c48('0x61'):if(_0x373234['operator']===_0x3c48('0x62')){if(_0x373234[_0x3c48('0x5e')][_0x3c48('0x32')]('\x20')['length']>0x1){_0x534f09[_0xe78914](_0x3c48('0x63'),qs[_0x3c48('0x64')](_0x373234[_0x3c48('0x5e')]),null);}else{var _0x2cb4df='%'+_0x373234[_0x3c48('0x5e')]+'%';_0x534f09[_0xe78914](_0x3c48('0x65'),_0x2cb4df,_0x2cb4df,_0x2cb4df);}}else{_0x1e6e9d=_[_0x3c48('0x5d')](_0x381407,[_0x3c48('0x2c'),_0x3c48('0x66')]);_0x373234[_0x3c48('0x46')]=_0x3c48('0x66');_0x37ab0a=as[_0x3c48('0x67')](_0x50e82b,_0x1e6e9d[_0x3c48('0x37')],_0x373234);_0x534f09[_0xe78914](_0x37ab0a[_0x3c48('0x68')],_0x37ab0a['value'][_0x3c48('0x69')],_0x37ab0a['value'][_0x3c48('0x29')]);}break;case _0x3c48('0x6a'):var _0x33ea33=_0x373234[_0x3c48('0x5e')]['split'](',')['map'](function(_0x32f2fe){return Number(_0x32f2fe);});_0x33ea33['forEach'](function(_0x5404df){_0x4d3811['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5404df+',%');});_0x1fdf68=_[_0x3c48('0x6b')](_0x1fdf68,_0x33ea33);break;case _0x3c48('0x6c'):if(_0x373234[_0x3c48('0x6d')]===_0x3c48('0x62')){_0x534f09[_0xe78914]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x373234[_0x3c48('0x5e')]+'%',null);}else{_0x1e6e9d=_[_0x3c48('0x5d')](_0x381407,[_0x3c48('0x2c'),_0x3c48('0x6e')]);_0x373234[_0x3c48('0x46')]='UserId';_0x37ab0a=as[_0x3c48('0x67')](_0x50e82b,_0x1e6e9d['type'],_0x373234);_0x534f09[_0xe78914](_0x37ab0a[_0x3c48('0x68')],_0x37ab0a[_0x3c48('0x5e')]['start'],_0x37ab0a[_0x3c48('0x5e')][_0x3c48('0x29')]);}break;case _0x3c48('0x6f'):_0x37ab0a=as[_0x3c48('0x67')]('me',null,_0x373234);_0x534f09[_0xe78914](_0x37ab0a[_0x3c48('0x68')],_0x37ab0a[_0x3c48('0x5e')][_0x3c48('0x69')],_0x37ab0a[_0x3c48('0x5e')][_0x3c48('0x29')]);break;}}else{var _0x37ab0a=as[_0x3c48('0x67')](_0x50e82b,_0x1e6e9d[_0x3c48('0x37')],_0x373234);_0x534f09[_0xe78914](_0x37ab0a[_0x3c48('0x68')],_0x37ab0a[_0x3c48('0x5e')][_0x3c48('0x69')],_0x37ab0a['value'][_0x3c48('0x29')]);}}}else{var _0x157962=_(_0x13f603['query'])[_0x3c48('0x3a')]()[_0x3c48('0x2e')](function(_0xb8c5ac){return _[_0x3c48('0x70')](_0x381407,[_0x3c48('0x2c'),_0xb8c5ac])?_0xb8c5ac:undefined;})[_0x3c48('0x71')]()[_0x3c48('0x5e')]();if(!_['isEmpty'](_0x157962)){_0x157962[_0x3c48('0x33')](function(_0x4337e3){if(_0x4337e3===_0x3c48('0x72')){_0x1bf056[_0x3c48('0x43')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x13f603[_0x3c48('0x39')][_0x4337e3]));}else if(_0x4337e3===_0x3c48('0x73')){var _0x23fe92=JSON[_0x3c48('0x74')](_0x13f603[_0x3c48('0x39')][_0x4337e3])[_0x3c48('0x75')];var _0x4985cb=JSON['parse'](_0x13f603[_0x3c48('0x39')][_0x4337e3])['$lte'];_0x1bf056[_0x3c48('0x43')](_0x3c48('0x76'),_0x23fe92,_0x4985cb);}else{if(_0x13f603[_0x3c48('0x39')][_0x4337e3]===_0x3c48('0x77')){_0x1bf056[_0x3c48('0x43')]('i.'+_0x4337e3+_0x3c48('0x78'));}else{_0x1bf056['where']('i.'+_0x4337e3+_0x3c48('0x79'),_0x13f603[_0x3c48('0x39')][_0x4337e3]);}}});}if(_0x13f603[_0x3c48('0x39')][_0x3c48('0x7a')]){if(_0x13f603[_0x3c48('0x39')][_0x3c48('0x7a')]==0x1){_0x1bf056[_0x3c48('0x5f')](_0x3c48('0x7b'));}else{_0x1bf056[_0x3c48('0x5f')](_0x3c48('0x7c'));}}if(_0x13f603[_0x3c48('0x39')][_0x3c48('0x7d')]){_0x1fdf68=_[_0x3c48('0x7e')](_0x13f603[_0x3c48('0x39')][_0x3c48('0x7d')])?_0x13f603[_0x3c48('0x39')][_0x3c48('0x7d')]:new Array(_0x13f603['query'][_0x3c48('0x7d')]);_0x1fdf68[_0x3c48('0x33')](function(_0x457e5e){_0x4d3811['or'](_0x3c48('0x7f'),'%,'+_0x457e5e+',%');});}if(_0x13f603[_0x3c48('0x39')][_0x3c48('0x80')]){var _0x393ebf=_0x13f603['query']['filter'][_0x3c48('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x393ebf)){_0x534f09['or'](_0x3c48('0x82'),_0x393ebf+'%')['or'](_0x3c48('0x83'),_0x393ebf+'%');}else{_0x534f09['or'](_0x3c48('0x84'),qs[_0x3c48('0x64')](_0x393ebf))['or'](_0x3c48('0x85'),_0x393ebf+'%');}}}_0x1bf056[_0x3c48('0x43')](_0x534f09);_0x1bf056['group'](_0x3c48('0x86'));var _0x3b759e={'type':db[_0x3c48('0x87')][_0x3c48('0x88')][_0x3c48('0x89')],'raw':!![]};var _0x461069=_0x1bf056[_0x3c48('0x8a')]();_0x461069[_0x3c48('0x46')](_0x3c48('0x86'));_0x461069['field'](_0x3c48('0x8b'),_0x3c48('0x8c'));if(_0x404672[_0x3c48('0x41')]){_0x404672[_0x3c48('0x41')][_0x3c48('0x33')](function(_0xf1ef66){var _0x3acd93=_0xf1ef66[0x0]==='contactName'?_0xf1ef66[0x0]:'i.'+_0xf1ef66[0x0];_0x1bf056[_0x3c48('0x41')](_0x3acd93,_0xf1ef66[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3c48('0x8d')](_0x1fdf68)){_0x1bf056[_0x3c48('0x5f')](_0x4d3811);_0x461069['where'](_0x3c48('0x8e'),_0x1fdf68);}BPromise['resolve']()['then'](function(){if(!_0x1428b9){if(_0x13f603[_0x3c48('0x39')][_0x3c48('0x72')]||_0x13f603[_0x3c48('0x39')][_0x3c48('0x8f')])return;_0x461069['where'](_0x3c48('0x90'));_0x1bf056[_0x3c48('0x43')](_0x3c48('0x90'));return;}if(_0x13f603['user']['role']!==_0x3c48('0x91'))return;return _0x13f603[_0x3c48('0x92')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x3c48('0x27')](function(_0xab1f5a){if(_['isEmpty'](_0xab1f5a)){_0x461069[_0x3c48('0x43')]('i.SmsAccountId\x20IS\x20NULL');_0x1bf056[_0x3c48('0x43')](_0x3c48('0x93'));}else{_0x461069[_0x3c48('0x43')](_0x3c48('0x94'),_[_0x3c48('0x2e')](_0xab1f5a,'id'));_0x1bf056[_0x3c48('0x43')](_0x3c48('0x94'),_[_0x3c48('0x2e')](_0xab1f5a,'id'));}});})[_0x3c48('0x27')](function(){if(_0x13f603[_0x3c48('0x92')][_0x3c48('0x95')]==='agent'&&!_0x1428b9&&!_0x13f603[_0x3c48('0x39')][_0x3c48('0x72')])return[];return db[_0x3c48('0x96')][_0x3c48('0x39')](_0x461069[_0x3c48('0x97')](),_0x3b759e);})[_0x3c48('0x27')](function(_0x1862bb){_0x382d5a[_0x3c48('0x20')]=_0x1862bb[_0x3c48('0x3f')];if(_0x382d5a[_0x3c48('0x20')]===0x0)return[];return db[_0x3c48('0x96')][_0x3c48('0x39')](_0x2223d0[_0x3c48('0x97')](),_0x3b759e)[_0x3c48('0x27')](function(_0x86bf66){_0x3a0631=_['keyBy'](_0x86bf66,'id');_0x3b759e=_['merge'](_0x3b759e,{'model':db[_0x3c48('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13f603[_0x3c48('0x39')]['fields']){_0x404672[_0x3c48('0x3d')][_0x3c48('0x33')](function(_0x57fd39){_0x1bf056[_0x3c48('0x46')]('i.'+_0x57fd39);});}else{_0x1bf056['field'](_0x3c48('0x8b'),'unreadMessages');_0x1bf056['field'](_0x3c48('0x99'),_0x3c48('0x9a'));_0x1bf056[_0x3c48('0x46')]('a.mandatoryDisposition',_0x3c48('0x9b'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0x9c'),_0x3c48('0x9d'));_0x1bf056['field'](_0x3c48('0x9e'));_0x1bf056[_0x3c48('0x46')]('c.firstName',_0x3c48('0x9f'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xa0'),_0x3c48('0xa1'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xa2'),_0x3c48('0xa3'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xa4'),_0x3c48('0xa5'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xa6'),_0x3c48('0xa7'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xa8'),'Contact.fax');_0x1bf056[_0x3c48('0x46')]('o.fullname',_0x3c48('0xa9'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xaa'),_0x3c48('0xab'));_0x1bf056[_0x3c48('0x46')](_0x3c48('0xac'),_0x3c48('0x31'));}if(_0x404672[_0x3c48('0x22')])_0x1bf056[_0x3c48('0x22')](_0x404672[_0x3c48('0x22')]);if(_0x404672[_0x3c48('0x21')])_0x1bf056[_0x3c48('0x21')](_0x404672[_0x3c48('0x21')]);return db[_0x3c48('0x96')][_0x3c48('0x39')](_0x1bf056[_0x3c48('0x97')](),_0x3b759e);})[_0x3c48('0x27')](function(_0xe2affa){_0x162e77[_0x3c48('0x43')](_0x3c48('0xad'),_['map'](_0xe2affa,'id'));return db['sequelize'][_0x3c48('0x39')](_0x162e77[_0x3c48('0x97')](),_0x3b759e)[_0x3c48('0x27')](function(_0x27d4c2){var _0x31d81c=_['groupBy'](_0x27d4c2,_0x3c48('0xae'));var _0x973224=[];_0xe2affa[_0x3c48('0x33')](function(_0x1a238e){_0x973224['push'](updateSmsInteraction(_0x1a238e,_0x3a0631,_0x31d81c));});return BPromise['all'](_0x973224);});});})[_0x3c48('0x27')](function(_0x4e0d0d){_0x382d5a['rows']=_0x4e0d0d;return _0x382d5a;})[_0x3c48('0x27')](respondWithFilteredResult(_0x32d878,_0x404672))[_0x3c48('0x35')](handleError(_0x32d878,null));};exports[_0x3c48('0xaf')]=function(_0xf02bf9,_0x1baa85){var _0x37fe71={'raw':![],'where':{'id':_0xf02bf9[_0x3c48('0xb0')]['id']}},_0x3d1f1d={};_0x3d1f1d[_0x3c48('0x38')]=_[_0x3c48('0x3a')](db[_0x3c48('0x98')][_0x3c48('0x36')]);_0x3d1f1d['query']=_['keys'](_0xf02bf9[_0x3c48('0x39')]);_0x3d1f1d[_0x3c48('0x3b')]=_[_0x3c48('0x3c')](_0x3d1f1d[_0x3c48('0x38')],_0x3d1f1d['query']);_0x37fe71['attributes']=_[_0x3c48('0x3c')](_0x3d1f1d[_0x3c48('0x38')],qs[_0x3c48('0x3e')](_0xf02bf9[_0x3c48('0x39')][_0x3c48('0x3e')]));_0x37fe71['attributes']=_0x37fe71[_0x3c48('0x3d')]['length']?_0x37fe71[_0x3c48('0x3d')]:_0x3d1f1d[_0x3c48('0x38')];if(_0xf02bf9[_0x3c48('0x39')]['includeAll']){_0x37fe71[_0x3c48('0xb1')]=[{'all':!![]}];}_0x37fe71=_['merge']({},_0x37fe71,_0xf02bf9[_0x3c48('0xb2')]);return db[_0x3c48('0x98')][_0x3c48('0x5d')](_0x37fe71)[_0x3c48('0x27')](handleEntityNotFound(_0x1baa85,null))['then'](respondWithResult(_0x1baa85,null))['catch'](handleError(_0x1baa85,null));};exports[_0x3c48('0xb3')]=function(_0x27d9b8,_0x4a4067){return db['SmsInteraction'][_0x3c48('0xb3')](_0x27d9b8[_0x3c48('0x6f')],{})[_0x3c48('0x27')](respondWithResult(_0x4a4067,0xc9))[_0x3c48('0x35')](handleError(_0x4a4067,null));};exports[_0x3c48('0x26')]=function(_0x94853e,_0x3ed582){if(_0x94853e[_0x3c48('0x6f')]['id']){delete _0x94853e[_0x3c48('0x6f')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x94853e[_0x3c48('0xb0')]['id']}})[_0x3c48('0x27')](handleEntityNotFound(_0x3ed582,null))[_0x3c48('0x27')](saveUpdates(_0x94853e[_0x3c48('0x6f')],null))[_0x3c48('0x27')](respondWithResult(_0x3ed582,null))[_0x3c48('0x35')](handleError(_0x3ed582,null));};exports[_0x3c48('0x28')]=function(_0x30c5c5,_0x57ef29){return db[_0x3c48('0x98')][_0x3c48('0x5d')]({'where':{'id':_0x30c5c5[_0x3c48('0xb0')]['id']}})[_0x3c48('0x27')](handleEntityNotFound(_0x57ef29,null))['then'](removeEntity(_0x57ef29,null))[_0x3c48('0x35')](handleError(_0x57ef29,null));};exports[_0x3c48('0xb4')]=function(_0xea5212,_0x5dcff3){return db[_0x3c48('0x98')][_0x3c48('0xb4')]()['then'](respondWithResult(_0x5dcff3,null))['catch'](handleError(_0x5dcff3,null));};exports[_0x3c48('0xb5')]=function(_0x426f61,_0x4bbb68,_0x1c1b43){return db['SmsMessage'][_0x3c48('0x5d')]({'where':{'id':_0x426f61[_0x3c48('0xb0')]['id']}})['then'](handleEntityNotFound(_0x4bbb68,null))[_0x3c48('0x27')](function(_0x20ad3c){if(_0x20ad3c){return _0x20ad3c[_0x3c48('0xb5')](_0x426f61[_0x3c48('0x6f')]['ids'],_['omit'](_0x426f61[_0x3c48('0x6f')],[_0x3c48('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x4bbb68,null))[_0x3c48('0x35')](handleError(_0x4bbb68,null));};exports['getMessages']=function(_0x1236d9,_0x1e21fe,_0x172ba4){var _0xa200={'raw':![],'where':{}};var _0x3db224={};var _0x565a20={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1236d9[_0x3c48('0xb0')]['id']}})['then'](handleEntityNotFound(_0x1e21fe,null))[_0x3c48('0x27')](function(_0x3d69e0){if(_0x3d69e0){_0x3db224[_0x3c48('0x38')]=_[_0x3c48('0x3a')](db[_0x3c48('0xb7')][_0x3c48('0x36')]);_0x3db224['query']=_[_0x3c48('0x3a')](_0x1236d9[_0x3c48('0x39')]);_0x3db224['filters']=_['intersection'](_0x3db224[_0x3c48('0x38')],_0x3db224['query']);_0xa200[_0x3c48('0x3d')]=_[_0x3c48('0x3c')](_0x3db224[_0x3c48('0x38')],qs[_0x3c48('0x3e')](_0x1236d9[_0x3c48('0x39')][_0x3c48('0x3e')]));_0xa200[_0x3c48('0x3d')]=_0xa200[_0x3c48('0x3d')][_0x3c48('0x3f')]?_0xa200[_0x3c48('0x3d')]:_0x3db224[_0x3c48('0x38')];if(!_0x1236d9[_0x3c48('0x39')]['hasOwnProperty'](_0x3c48('0xb8'))){_0xa200[_0x3c48('0x22')]=qs['limit'](_0x1236d9[_0x3c48('0x39')]['limit']);_0xa200[_0x3c48('0x21')]=qs[_0x3c48('0x21')](_0x1236d9[_0x3c48('0x39')][_0x3c48('0x21')]);}_0xa200[_0x3c48('0x41')]=qs['sort'](_0x1236d9[_0x3c48('0x39')]['sort']);_0xa200[_0x3c48('0x43')]=qs[_0x3c48('0x3b')](_[_0x3c48('0x44')](_0x1236d9[_0x3c48('0x39')],_0x3db224[_0x3c48('0x3b')]));_0xa200[_0x3c48('0x43')][_0x3c48('0xae')]=_0x3d69e0['id'];if(_0x1236d9[_0x3c48('0x39')]['filter']){_0xa200['where']=_[_0x3c48('0xb9')](_0xa200['where'],{'$or':_[_0x3c48('0x2e')](_0xa200[_0x3c48('0x3d')],function(_0x221e64){var _0x45b136={};_0x45b136[_0x221e64]={'$like':'%'+_0x1236d9['query']['filter']+'%'};return _0x45b136;})});}if(_0x1236d9['query'][_0x3c48('0x75')]){var _0x3c9909=_0x1236d9[_0x3c48('0x39')]['$gte'][_0x3c48('0x32')](',');var _0x1210c1={};_0x1210c1[_0x3c9909[0x0]]={'$gte':moment(_0x3c9909[0x1])[_0x3c48('0xba')](_0x3c48('0xbb'))};_0xa200['where']=_[_0x3c48('0xb9')](_0xa200[_0x3c48('0x43')],_0x1210c1);}_0xa200=_[_0x3c48('0xb9')]({},_0xa200,_0x1236d9[_0x3c48('0xb2')]);return db[_0x3c48('0xb7')][_0x3c48('0x20')]({'where':_0xa200[_0x3c48('0x43')]})[_0x3c48('0x27')](function(_0x2e2bd3){_0x565a20[_0x3c48('0x20')]=_0x2e2bd3;if(_0x1236d9['query']['includeAll']){_0xa200[_0x3c48('0xb1')]=[{'all':!![]}];}return db['SmsMessage'][_0x3c48('0xbc')](_0xa200);})[_0x3c48('0x27')](function(_0x39c67b){_0x565a20[_0x3c48('0xbd')]=_0x39c67b;return _0x565a20;});}})[_0x3c48('0x27')](respondWithFilteredResult(_0x1e21fe,_0xa200))['catch'](handleError(_0x1e21fe,null));};exports['addTags']=function(_0x2c3732,_0x9f399c,_0x346e0f){return db[_0x3c48('0x98')][_0x3c48('0x5d')]({'where':{'id':_0x2c3732[_0x3c48('0xb0')]['id']}})[_0x3c48('0x27')](handleEntityNotFound(_0x9f399c,null))[_0x3c48('0x27')](function(_0x196e56){if(_0x196e56){return _0x196e56[_0x3c48('0xbe')](_0x2c3732[_0x3c48('0x6f')][_0x3c48('0xb6')],_['omit'](_0x2c3732['body'],[_0x3c48('0xb6'),'id'])||{})['spread'](function(){return db[_0x3c48('0x6a')]['findAll']({'attributes':['id',_0x3c48('0x2c'),'color'],'where':{'id':_0x2c3732['body'][_0x3c48('0xb6')]}});})[_0x3c48('0x27')](function(_0x35a901){socket[_0x3c48('0xbf')](_0x3c48('0xc0'),{'id':Number(_0x2c3732[_0x3c48('0xb0')]['id']),'tags':_0x35a901||[]});return{'id':Number(_0x2c3732[_0x3c48('0xb0')]['id']),'tags':_0x35a901||[]};});}})[_0x3c48('0x27')](respondWithResult(_0x9f399c,null))[_0x3c48('0x35')](handleError(_0x9f399c,null));};exports[_0x3c48('0xc1')]=function(_0x1e2dbc,_0x509ca1,_0x5e8566){return db[_0x3c48('0x98')][_0x3c48('0x5d')]({'where':{'id':_0x1e2dbc['params']['id']}})[_0x3c48('0x27')](handleEntityNotFound(_0x509ca1,null))[_0x3c48('0x27')](function(_0x1f2bf2){if(_0x1f2bf2){return _0x1f2bf2[_0x3c48('0xc1')](_0x1e2dbc[_0x3c48('0x39')][_0x3c48('0xb6')]);}})[_0x3c48('0x27')](respondWithStatusCode(_0x509ca1,null))['catch'](handleError(_0x509ca1,null));};exports[_0x3c48('0xc2')]=function(_0x132102,_0x45257a){var _0x5b2364=moment()['unix']()[_0x3c48('0x97')]();var _0x3a2bb4=path['join'](config[_0x3c48('0xc3')],'server',_0x3c48('0xc4'),_0x3c48('0xc5'));var _0xf2b07c=path[_0x3c48('0xc6')](config[_0x3c48('0xc3')],_0x3c48('0xc7'),_0x3c48('0xc4'),_0x3c48('0xc8'));var _0x510859=path[_0x3c48('0xc6')](_0x3a2bb4,_0x5b2364);var _0x1720ee=util[_0x3c48('0xba')](_0x3c48('0xc9'),_0x132102['params']['id'],_0x5b2364);var _0x2f62f0=path[_0x3c48('0xc6')](_0x3a2bb4,_0x1720ee);var _0xc573d3=[];_0xc573d3[_0x3c48('0x34')]({'model':db[_0x3c48('0x6c')],'as':_0x3c48('0x6c'),'attributes':['id','fullname'],'raw':!![]});_0xc573d3[_0x3c48('0x34')]({'model':db[_0x3c48('0xca')],'as':'Contact','attributes':['id','firstName',_0x3c48('0xcb')],'raw':!![]});var _0x286d24=[{'model':db['SmsMessage'],'as':_0x3c48('0xcc'),'attributes':['id','body',_0x3c48('0x73'),'direction',_0x3c48('0xcd'),_0x3c48('0x7a')],'include':_0xc573d3}];_0x286d24[_0x3c48('0x34')]({'model':db['SmsAccount'],'as':_0x3c48('0xce'),'attributes':['id','name']});_0x286d24[_0x3c48('0x34')]({'model':db['User'],'as':'Owner','attributes':['id',_0x3c48('0x2f')]});return db[_0x3c48('0x98')][_0x3c48('0x5d')]({'where':{'id':_0x132102[_0x3c48('0xb0')]['id']},'include':_0x286d24})[_0x3c48('0x27')](handleEntityNotFound(_0x45257a,null))[_0x3c48('0x27')](function(_0x129c09){if(_0x129c09){var _0x30dec6=_0x129c09[_0x3c48('0xcf')]({'plain':!![]});fs[_0x3c48('0xd0')](_0x510859);var _0x2b302a={'format':'A4','border':_0x3c48('0xd1'),'header':{'height':_0x3c48('0xd2'),'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':_0x3c48('0xd3'),'contents':{'default':util[_0x3c48('0xba')](_0x3c48('0xd4'),util[_0x3c48('0xba')](_0x3c48('0xd5'),_0x3c48('0xd6'),_0x30dec6['id']),moment()[_0x3c48('0xba')](_0x3c48('0xd7'))[_0x3c48('0x97')]())}}};var _0x1f6bc7={'channel':_0x3c48('0xd6'),'account':_0x30dec6[_0x3c48('0xce')][_0x3c48('0x2c')],'agent':_0x30dec6[_0x3c48('0xd8')]?_0x30dec6[_0x3c48('0xd8')][_0x3c48('0x2f')]:_0x3c48('0xd9'),'createdAt':moment(_0x30dec6[_0x3c48('0x73')])['format'](_0x3c48('0xbb'))[_0x3c48('0x97')](),'closedAt':_0x30dec6['closed']?moment(_0x30dec6[_0x3c48('0xda')])[_0x3c48('0xba')](_0x3c48('0xbb'))[_0x3c48('0x97')]():'','disposition':_0x30dec6[_0x3c48('0xdb')],'messages':_(_0x30dec6[_0x3c48('0xcc')])[_0x3c48('0x80')]({'secret':![]})['map'](function(_0x238681){return{'date':moment(_0x238681[_0x3c48('0x73')])[_0x3c48('0xba')](_0x3c48('0xbb'))['toString'](),'sender':_0x238681[_0x3c48('0xdc')]===_0x3c48('0xdd')?_0x238681[_0x3c48('0x6c')]?_0x238681[_0x3c48('0x6c')][_0x3c48('0x2f')]:_0x3c48('0xde'):_0x238681['Contact']['firstName']+(_0x238681['Contact'][_0x3c48('0xcb')]?'\x20'+_0x238681['Contact'][_0x3c48('0xcb')]:''),'body':_0x238681[_0x3c48('0x6f')],'direction':_0x238681[_0x3c48('0xdc')]===_0x3c48('0xdd')?'A':'C','secret':_0x238681[_0x3c48('0xcd')],'read':_0x238681[_0x3c48('0x7a')]};})[_0x3c48('0x5e')]()};return ejs[_0x3c48('0xdf')](path['join'](config[_0x3c48('0xc3')],'server',_0x3c48('0xe0'),_0x3c48('0xe1')),{'interaction':_0x1f6bc7})[_0x3c48('0x27')](function(_0x51667e){return new BPromise(function(_0x24e80b,_0x106fcf){pdf[_0x3c48('0xb3')](_0x51667e,_0x2b302a)[_0x3c48('0xe2')](path[_0x3c48('0xc6')](_0x510859,_0x3c48('0xe3')+_0x30dec6['id']+'-'+_0x5b2364+'.pdf'),function(_0x8c29b3,_0x406b09){if(_0x8c29b3)return _0x106fcf(_0x8c29b3);_0x24e80b(_0x406b09);});});})[_0x3c48('0x27')](function(){return new BPromise(function(_0x35a0e3,_0x51bf57){zipdir(_0x510859,{'saveTo':_0x2f62f0},function(_0x59b900,_0x1db979){if(_0x59b900)return _0x51bf57(_0x59b900);return _0x35a0e3(_0x1db979);});})[_0x3c48('0x27')](function(){return new BPromise(function(_0x4c480c,_0x451e9f){rimraf(_0x510859,function(_0x3de82e){if(_0x3de82e)_0x451e9f(_0x3de82e);return _0x4c480c();});});})[_0x3c48('0x27')](function(){return _0x45257a[_0x3c48('0xc2')](_0x2f62f0,_0x1720ee,function(_0x5ecb09){if(_0x5ecb09){console[_0x3c48('0xe4')](_0x3c48('0xe5'),_0x5ecb09);}else{fs[_0x3c48('0xe6')](_0x2f62f0);}});});});}else{return _0x45257a[_0x3c48('0x1d')](0xc8);}})[_0x3c48('0x35')](handleError(_0x45257a,null));}; \ No newline at end of file +var _0x3dbd=['then','catch','index','SmsInteraction','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','field','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','value','having','`\x20=\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','compact','isEmpty','forEach','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','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?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','findOne','rawAttributes','merge','format','findAll','addTags','omit','spread','color','emit','smsInteractionTags:save','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','User','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','end','status','offset','limit','set','apply','reject','update','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags'];(function(_0x30336e,_0x2f6314){var _0x47d4a3=function(_0x499244){while(--_0x499244){_0x30336e['push'](_0x30336e['shift']());}};_0x47d4a3(++_0x2f6314);}(_0x3dbd,0xb6));var _0xd3db=function(_0x9eae4f,_0x8e6916){_0x9eae4f=_0x9eae4f-0x0;var _0x393ec5=_0x3dbd[_0x9eae4f];return _0x393ec5;};'use strict';var pdf=require(_0xd3db('0x0'));var emlformat=require(_0xd3db('0x1'));var rimraf=require(_0xd3db('0x2'));var zipdir=require(_0xd3db('0x3'));var jsonpatch=require(_0xd3db('0x4'));var rp=require(_0xd3db('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3db('0x6'));var util=require(_0xd3db('0x7'));var path=require(_0xd3db('0x8'));var sox=require(_0xd3db('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3db('0xa'));var squel=require(_0xd3db('0xb'));var crypto=require('crypto');var jsforce=require(_0xd3db('0xc'));var deskjs=require(_0xd3db('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd3db('0xe'));var Redis=require(_0xd3db('0xf'));var authService=require(_0xd3db('0x10'));var qs=require(_0xd3db('0x11'));var as=require(_0xd3db('0x12'));var hardwareService=require(_0xd3db('0x13'));var logger=require(_0xd3db('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd3db('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3db('0x16'))['db'];config[_0xd3db('0x17')]=_[_0xd3db('0x18')](config[_0xd3db('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3db('0x17')]));require(_0xd3db('0x19'))['register'](socket);function respondWithStatusCode(_0x5a1ecc,_0x1d046f){_0x1d046f=_0x1d046f||0xcc;return function(_0x4cc135){if(_0x4cc135){return _0x5a1ecc['sendStatus'](_0x1d046f);}return _0x5a1ecc['status'](_0x1d046f)[_0xd3db('0x1a')]();};}function respondWithResult(_0x46ae54,_0x43f549){_0x43f549=_0x43f549||0xc8;return function(_0x425eba){if(_0x425eba){return _0x46ae54[_0xd3db('0x1b')](_0x43f549)['json'](_0x425eba);}};}function respondWithFilteredResult(_0x58794f,_0x207f7f){return function(_0x625ddd){if(_0x625ddd){var _0x2bbe70=_0x625ddd['count'],_0x1e7d80=_0x207f7f[_0xd3db('0x1c')],_0x1a1c55=_0x207f7f[_0xd3db('0x1c')]+_0x207f7f[_0xd3db('0x1d')],_0x2ad28d;if(_0x1a1c55>=_0x2bbe70){_0x1a1c55=_0x2bbe70;_0x2ad28d=0xc8;}else{_0x2ad28d=0xce;}_0x58794f[_0xd3db('0x1b')](_0x2ad28d);return _0x58794f[_0xd3db('0x1e')]('Content-Range',_0x1e7d80+'-'+_0x1a1c55+'/'+_0x2bbe70)['json'](_0x625ddd);}return null;};}function patchUpdates(_0x5385e1){return function(_0x13c8b3){try{jsonpatch[_0xd3db('0x1f')](_0x13c8b3,_0x5385e1,!![]);}catch(_0x46d27c){return BPromise[_0xd3db('0x20')](_0x46d27c);}return _0x13c8b3['save']();};}function saveUpdates(_0x5a01ee,_0x30b472){return function(_0x2f6848){if(_0x2f6848){return _0x2f6848[_0xd3db('0x21')](_0x5a01ee)['then'](function(_0x525cc4){return _0x525cc4;});}return null;};}function removeEntity(_0x29dfc5,_0x3d0a0d){return function(_0x17fb4e){if(_0x17fb4e){return _0x17fb4e[_0xd3db('0x22')]()['then'](function(){_0x29dfc5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12bc2a,_0x38fe35){return function(_0x45a579){if(!_0x45a579){_0x12bc2a[_0xd3db('0x23')](0x194);}return _0x45a579;};}function handleError(_0x22ca01,_0x15d207){_0x15d207=_0x15d207||0x1f4;return function(_0x29f68d){logger[_0xd3db('0x24')](_0x29f68d[_0xd3db('0x25')]);if(_0x29f68d[_0xd3db('0x26')]){delete _0x29f68d[_0xd3db('0x26')];}_0x22ca01[_0xd3db('0x1b')](_0x15d207)[_0xd3db('0x27')](_0x29f68d);};}function getInteractionUsers(_0x225246,_0x97d5d0){return new BPromise(function(_0x552d6c,_0x561623){try{if(_0x97d5d0[_0x225246['id']]){_0x225246[_0xd3db('0x28')]=_[_0xd3db('0x29')](_0x97d5d0[_0x225246['id']],function(_0x2d5716){return{'id':_0x2d5716['id'],'fullname':_0x2d5716[_0xd3db('0x2a')]};});}}catch(_0x137871){_0x561623(_0x137871);}_0x552d6c(_0x225246);});}function getInteractionTags(_0x3fe1dc,_0x4e682a){return new BPromise(function(_0x602741,_0x43bae5){try{if(_0x3fe1dc[_0xd3db('0x2b')]){_0x3fe1dc[_0xd3db('0x2c')]=[];_0x3fe1dc[_0xd3db('0x2b')]['split'](',')['forEach'](function(_0x5b8171){_0x3fe1dc['Tags']['push'](_0x4e682a[_0x5b8171]);});}delete _0x3fe1dc[_0xd3db('0x2b')];}catch(_0x4c8bfd){_0x43bae5(_0x4c8bfd);}_0x602741(_0x3fe1dc);});}function updateSmsInteraction(_0x5995b4,_0x37f64c,_0x18ad13){return new BPromise(function(_0x36815a,_0x342c63){return getInteractionUsers(_0x5995b4,_0x18ad13)[_0xd3db('0x2d')](function(_0x1051a6){return getInteractionTags(_0x1051a6,_0x37f64c);})[_0xd3db('0x2d')](function(_0x235eb5){_0x36815a(_0x235eb5);})[_0xd3db('0x2e')](function(_0x1e1b38){_0x342c63(_0x1e1b38);});});}exports[_0xd3db('0x2f')]=function(_0x36458a,_0x28648e){var _0x597a54={},_0x28aa0b={},_0x604f06={'count':0x0,'rows':[]};var _0x54c9df=_[_0xd3db('0x29')](db[_0xd3db('0x30')]['rawAttributes'],function(_0x56f52d){return{'name':_0x56f52d[_0xd3db('0x31')],'type':_0x56f52d[_0xd3db('0x32')]['key']};});_0x28aa0b[_0xd3db('0x33')]=_['map'](_0x54c9df,_0xd3db('0x26'));_0x28aa0b[_0xd3db('0x34')]=_['keys'](_0x36458a[_0xd3db('0x34')]);_0x28aa0b['filters']=_[_0xd3db('0x35')](_0x28aa0b['model'],_0x28aa0b[_0xd3db('0x34')]);_0x597a54[_0xd3db('0x36')]=_[_0xd3db('0x35')](_0x28aa0b['model'],qs['fields'](_0x36458a[_0xd3db('0x34')][_0xd3db('0x37')]));_0x597a54['attributes']=_0x597a54[_0xd3db('0x36')][_0xd3db('0x38')]?_0x597a54[_0xd3db('0x36')]:_0x28aa0b[_0xd3db('0x33')];if(!_0x36458a[_0xd3db('0x34')][_0xd3db('0x39')](_0xd3db('0x3a'))){_0x597a54[_0xd3db('0x1d')]=qs[_0xd3db('0x1d')](_0x36458a[_0xd3db('0x34')]['limit']);_0x597a54[_0xd3db('0x1c')]=qs[_0xd3db('0x1c')](_0x36458a['query'][_0xd3db('0x1c')]);}_0x597a54[_0xd3db('0x3b')]=qs[_0xd3db('0x3c')](_0x36458a['query']['sort']);_0x597a54[_0xd3db('0x3d')]=qs['filters'](_[_0xd3db('0x3e')](_0x36458a['query'],_0x28aa0b[_0xd3db('0x3f')]),_0x54c9df);var _0x1149c7=[];var _0x8d1a69=squel['select']()[_0xd3db('0x40')]('id')['field']('name')[_0xd3db('0x40')]('color')[_0xd3db('0x41')]('tools_tags');var _0x36b35b=squel['select']()[_0xd3db('0x40')](_0xd3db('0x42'))[_0xd3db('0x40')](_0xd3db('0x43'))[_0xd3db('0x40')](_0xd3db('0x44'))[_0xd3db('0x41')](_0xd3db('0x45'),'ui')[_0xd3db('0x46')]('users','u',_0xd3db('0x47'));var _0x1765c2=squel['select']()[_0xd3db('0x41')]('sms_interactions','i')['left_join']('cm_contacts','c',_0xd3db('0x48'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xd3db('0x49'),'a',_0xd3db('0x4a'))[_0xd3db('0x46')](_0xd3db('0x4b'),'me',_0xd3db('0x4c'))[_0xd3db('0x46')](_0xd3db('0x4d'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xd3db('0x46')](_0xd3db('0x4e'),'t',_0xd3db('0x4f'));var _0x2d96a8=squel[_0xd3db('0x50')]();var _0x112a55=[];var _0xb7404d=squel['expr']();var _0x314ba8;if(_0x36458a['query']['search']){_0x314ba8=as[_0xd3db('0x51')](_0x36458a[_0xd3db('0x34')][_0xd3db('0x52')]);var _0x3e47d0=_0x314ba8[_0xd3db('0x53')];for(var _0x22c596=0x0;_0x22c596<_0x314ba8[_0xd3db('0x54')]['length'];_0x22c596++){var _0x10ab0c=_0x314ba8['conditions'][_0x22c596];var _0x44b43d='i';var _0x36124d=_['find'](_0x54c9df,['name',_0x10ab0c[_0xd3db('0x40')]]);if(!_0x36124d){switch(_0x10ab0c[_0xd3db('0x40')]){case'unreadMessages':if(_0x10ab0c[_0xd3db('0x55')]==0x1){_0x1765c2[_0xd3db('0x56')]('`'+_0x10ab0c[_0xd3db('0x40')]+_0xd3db('0x57'));}else{_0x1765c2[_0xd3db('0x56')]('`'+_0x10ab0c[_0xd3db('0x40')]+'`\x20>\x200');}break;case _0xd3db('0x58'):if(_0x10ab0c['operator']===_0xd3db('0x59')){if(_0x10ab0c[_0xd3db('0x55')][_0xd3db('0x5a')]('\x20')['length']>0x1){_0x2d96a8[_0x3e47d0](_0xd3db('0x5b'),qs[_0xd3db('0x5c')](_0x10ab0c[_0xd3db('0x55')]),null);}else{var _0x5a71fe='%'+_0x10ab0c['value']+'%';_0x2d96a8[_0x3e47d0](_0xd3db('0x5d'),_0x5a71fe,_0x5a71fe,_0x5a71fe);}}else{_0x36124d=_[_0xd3db('0x5e')](_0x54c9df,[_0xd3db('0x26'),_0xd3db('0x5f')]);_0x10ab0c[_0xd3db('0x40')]='ContactId';_0x267dcd=as[_0xd3db('0x60')](_0x44b43d,_0x36124d[_0xd3db('0x32')],_0x10ab0c);_0x2d96a8[_0x3e47d0](_0x267dcd[_0xd3db('0x61')],_0x267dcd[_0xd3db('0x55')]['start'],_0x267dcd['value'][_0xd3db('0x1a')]);}break;case _0xd3db('0x62'):var _0x3be34b=_0x10ab0c[_0xd3db('0x55')]['split'](',')[_0xd3db('0x29')](function(_0x41a5a7){return Number(_0x41a5a7);});_0x3be34b['forEach'](function(_0x425739){_0xb7404d['or'](_0xd3db('0x63'),'%,'+_0x425739+',%');});_0x112a55=_[_0xd3db('0x64')](_0x112a55,_0x3be34b);break;case'User':if(_0x10ab0c[_0xd3db('0x65')]==='$substring'){_0x2d96a8[_0x3e47d0](_0xd3db('0x66'),'%'+_0x10ab0c['value']+'%',null);}else{_0x36124d=_[_0xd3db('0x5e')](_0x54c9df,[_0xd3db('0x26'),_0xd3db('0x67')]);_0x10ab0c['field']=_0xd3db('0x67');_0x267dcd=as[_0xd3db('0x60')](_0x44b43d,_0x36124d['type'],_0x10ab0c);_0x2d96a8[_0x3e47d0](_0x267dcd[_0xd3db('0x61')],_0x267dcd[_0xd3db('0x55')][_0xd3db('0x68')],_0x267dcd[_0xd3db('0x55')][_0xd3db('0x1a')]);}break;case _0xd3db('0x69'):_0x267dcd=as[_0xd3db('0x60')]('me',null,_0x10ab0c);_0x2d96a8[_0x3e47d0](_0x267dcd['text'],_0x267dcd[_0xd3db('0x55')][_0xd3db('0x68')],_0x267dcd[_0xd3db('0x55')][_0xd3db('0x1a')]);break;}}else{var _0x267dcd=as['buildExpression'](_0x44b43d,_0x36124d['type'],_0x10ab0c);_0x2d96a8[_0x3e47d0](_0x267dcd[_0xd3db('0x61')],_0x267dcd['value'][_0xd3db('0x68')],_0x267dcd[_0xd3db('0x55')][_0xd3db('0x1a')]);}}}else{var _0x102c54=_(_0x36458a[_0xd3db('0x34')])[_0xd3db('0x6a')]()[_0xd3db('0x29')](function(_0x26f1d7){return _['some'](_0x54c9df,[_0xd3db('0x26'),_0x26f1d7])?_0x26f1d7:undefined;})[_0xd3db('0x6b')]()[_0xd3db('0x55')]();if(!_[_0xd3db('0x6c')](_0x102c54)){_0x102c54[_0xd3db('0x6d')](function(_0x3d0132){if(_0x3d0132===_0xd3db('0x6e')){_0x1765c2['where'](_0xd3db('0x6f'),[][_0xd3db('0x70')](_0x36458a['query'][_0x3d0132]));}else if(_0x3d0132===_0xd3db('0x71')){var _0x4c8e19=JSON['parse'](_0x36458a[_0xd3db('0x34')][_0x3d0132])[_0xd3db('0x72')];var _0x624396=JSON['parse'](_0x36458a[_0xd3db('0x34')][_0x3d0132])['$lte'];_0x1765c2[_0xd3db('0x3d')](_0xd3db('0x73'),_0x4c8e19,_0x624396);}else{if(_0x36458a[_0xd3db('0x34')][_0x3d0132]===_0xd3db('0x74')){_0x1765c2[_0xd3db('0x3d')]('i.'+_0x3d0132+_0xd3db('0x75'));}else{_0x1765c2[_0xd3db('0x3d')]('i.'+_0x3d0132+_0xd3db('0x76'),_0x36458a[_0xd3db('0x34')][_0x3d0132]);}}});}if(_0x36458a[_0xd3db('0x34')][_0xd3db('0x77')]){if(_0x36458a['query'][_0xd3db('0x77')]==0x1){_0x1765c2[_0xd3db('0x56')]('`unreadMessages`\x20=\x200');}else{_0x1765c2[_0xd3db('0x56')](_0xd3db('0x78'));}}if(_0x36458a[_0xd3db('0x34')][_0xd3db('0x79')]){_0x112a55=_[_0xd3db('0x7a')](_0x36458a['query'][_0xd3db('0x79')])?_0x36458a[_0xd3db('0x34')][_0xd3db('0x79')]:new Array(_0x36458a[_0xd3db('0x34')][_0xd3db('0x79')]);_0x112a55[_0xd3db('0x6d')](function(_0x589cc1){_0xb7404d['or'](_0xd3db('0x63'),'%,'+_0x589cc1+',%');});}if(_0x36458a['query'][_0xd3db('0x7b')]){var _0x1a471f=_0x36458a['query'][_0xd3db('0x7b')]['replace']('\x5c','\x5c\x5c')[_0xd3db('0x7c')](/'/g,'\x27\x27');if(qs[_0xd3db('0x7d')](_0x1a471f)){_0x2d96a8['or'](_0xd3db('0x7e'),_0x1a471f+'%')['or'](_0xd3db('0x7f'),_0x1a471f+'%');}else{_0x2d96a8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd3db('0x5c')](_0x1a471f))['or'](_0xd3db('0x80'),_0x1a471f+'%');}}}_0x1765c2[_0xd3db('0x3d')](_0x2d96a8);_0x1765c2['group']('i.id');var _0x408987={'type':db[_0xd3db('0x81')][_0xd3db('0x82')][_0xd3db('0x83')],'raw':!![]};var _0x1dc0a6=_0x1765c2[_0xd3db('0x84')]();_0x1dc0a6[_0xd3db('0x40')]('i.id');_0x1dc0a6[_0xd3db('0x40')](_0xd3db('0x85'),'unreadMessages');if(_0x597a54[_0xd3db('0x3b')]){_0x597a54[_0xd3db('0x3b')][_0xd3db('0x6d')](function(_0x143317){var _0x121adb=_0x143317[0x0]===_0xd3db('0x86')?_0x143317[0x0]:'i.'+_0x143317[0x0];_0x1765c2[_0xd3db('0x3b')](_0x121adb,_0x143317[0x1]===_0xd3db('0x87')?![]:!![]);});}if(!_['isEmpty'](_0x112a55)){_0x1765c2[_0xd3db('0x56')](_0xb7404d);_0x1dc0a6['where'](_0xd3db('0x88'),_0x112a55);}BPromise[_0xd3db('0x89')]()[_0xd3db('0x2d')](function(){if(!_0x314ba8){if(_0x36458a[_0xd3db('0x34')][_0xd3db('0x6e')]||_0x36458a[_0xd3db('0x34')]['journey'])return;_0x1dc0a6[_0xd3db('0x3d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1765c2[_0xd3db('0x3d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x36458a[_0xd3db('0x8a')][_0xd3db('0x8b')]!==_0xd3db('0x8c'))return;return _0x36458a[_0xd3db('0x8a')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xd3db('0x2d')](function(_0x28528c){if(_[_0xd3db('0x6c')](_0x28528c)){_0x1dc0a6[_0xd3db('0x3d')]('i.SmsAccountId\x20IS\x20NULL');_0x1765c2[_0xd3db('0x3d')](_0xd3db('0x8d'));}else{_0x1dc0a6[_0xd3db('0x3d')](_0xd3db('0x6f'),_[_0xd3db('0x29')](_0x28528c,'id'));_0x1765c2[_0xd3db('0x3d')](_0xd3db('0x6f'),_['map'](_0x28528c,'id'));}});})[_0xd3db('0x2d')](function(){if(_0x36458a['user'][_0xd3db('0x8b')]==='agent'&&!_0x314ba8&&!_0x36458a[_0xd3db('0x34')]['SmsAccountId'])return[];return db[_0xd3db('0x8e')][_0xd3db('0x34')](_0x1dc0a6[_0xd3db('0x8f')](),_0x408987);})[_0xd3db('0x2d')](function(_0x198cda){_0x604f06[_0xd3db('0x90')]=_0x198cda[_0xd3db('0x38')];if(_0x604f06['count']===0x0)return[];return db[_0xd3db('0x8e')][_0xd3db('0x34')](_0x8d1a69[_0xd3db('0x8f')](),_0x408987)[_0xd3db('0x2d')](function(_0x37bca8){_0x1149c7=_[_0xd3db('0x91')](_0x37bca8,'id');_0x408987=_['merge'](_0x408987,{'model':db[_0xd3db('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36458a[_0xd3db('0x34')][_0xd3db('0x37')]){_0x597a54['attributes'][_0xd3db('0x6d')](function(_0x509769){_0x1765c2[_0xd3db('0x40')]('i.'+_0x509769);});}else{_0x1765c2['field'](_0xd3db('0x85'),'unreadMessages');_0x1765c2[_0xd3db('0x40')](_0xd3db('0x92'),_0xd3db('0x93'));_0x1765c2[_0xd3db('0x40')]('a.mandatoryDisposition',_0xd3db('0x94'));_0x1765c2['field'](_0xd3db('0x95'),_0xd3db('0x86'));_0x1765c2[_0xd3db('0x40')](_0xd3db('0x96'));_0x1765c2[_0xd3db('0x40')](_0xd3db('0x97'),'Contact.firstName');_0x1765c2[_0xd3db('0x40')](_0xd3db('0x98'),_0xd3db('0x99'));_0x1765c2[_0xd3db('0x40')](_0xd3db('0x9a'),'Contact.email');_0x1765c2['field'](_0xd3db('0x9b'),'Contact.phone');_0x1765c2[_0xd3db('0x40')]('c.mobile',_0xd3db('0x9c'));_0x1765c2[_0xd3db('0x40')](_0xd3db('0x9d'),_0xd3db('0x9e'));_0x1765c2[_0xd3db('0x40')]('o.fullname',_0xd3db('0x9f'));_0x1765c2[_0xd3db('0x40')](_0xd3db('0xa0'),'Owner.internal');_0x1765c2['field'](_0xd3db('0xa1'),_0xd3db('0x2b'));}if(_0x597a54[_0xd3db('0x1d')])_0x1765c2[_0xd3db('0x1d')](_0x597a54['limit']);if(_0x597a54[_0xd3db('0x1c')])_0x1765c2['offset'](_0x597a54[_0xd3db('0x1c')]);return db[_0xd3db('0x8e')][_0xd3db('0x34')](_0x1765c2[_0xd3db('0x8f')](),_0x408987);})[_0xd3db('0x2d')](function(_0x2e6665){_0x36b35b[_0xd3db('0x3d')](_0xd3db('0xa2'),_[_0xd3db('0x29')](_0x2e6665,'id'));return db[_0xd3db('0x8e')][_0xd3db('0x34')](_0x36b35b[_0xd3db('0x8f')](),_0x408987)[_0xd3db('0x2d')](function(_0xafaa00){var _0x55fdb9=_[_0xd3db('0xa3')](_0xafaa00,_0xd3db('0xa4'));var _0x154da2=[];_0x2e6665[_0xd3db('0x6d')](function(_0x26208f){_0x154da2[_0xd3db('0xa5')](updateSmsInteraction(_0x26208f,_0x1149c7,_0x55fdb9));});return BPromise[_0xd3db('0xa6')](_0x154da2);});});})['then'](function(_0x21e5c6){_0x604f06[_0xd3db('0xa7')]=_0x21e5c6;return _0x604f06;})[_0xd3db('0x2d')](respondWithFilteredResult(_0x28648e,_0x597a54))[_0xd3db('0x2e')](handleError(_0x28648e,null));};exports[_0xd3db('0xa8')]=function(_0x4cf1b0,_0x2c1015){var _0x2b57c4={'raw':![],'where':{'id':_0x4cf1b0[_0xd3db('0xa9')]['id']}},_0x307844={};_0x307844[_0xd3db('0x33')]=_[_0xd3db('0x6a')](db['SmsInteraction']['rawAttributes']);_0x307844[_0xd3db('0x34')]=_[_0xd3db('0x6a')](_0x4cf1b0[_0xd3db('0x34')]);_0x307844[_0xd3db('0x3f')]=_['intersection'](_0x307844['model'],_0x307844[_0xd3db('0x34')]);_0x2b57c4['attributes']=_[_0xd3db('0x35')](_0x307844[_0xd3db('0x33')],qs[_0xd3db('0x37')](_0x4cf1b0[_0xd3db('0x34')][_0xd3db('0x37')]));_0x2b57c4[_0xd3db('0x36')]=_0x2b57c4[_0xd3db('0x36')]['length']?_0x2b57c4['attributes']:_0x307844[_0xd3db('0x33')];if(_0x4cf1b0[_0xd3db('0x34')][_0xd3db('0xaa')]){_0x2b57c4[_0xd3db('0xab')]=[{'all':!![]}];}_0x2b57c4=_['merge']({},_0x2b57c4,_0x4cf1b0[_0xd3db('0xac')]);return db['SmsInteraction']['find'](_0x2b57c4)[_0xd3db('0x2d')](handleEntityNotFound(_0x2c1015,null))[_0xd3db('0x2d')](respondWithResult(_0x2c1015,null))[_0xd3db('0x2e')](handleError(_0x2c1015,null));};exports[_0xd3db('0xad')]=function(_0x237f0a,_0x1dab83){return db[_0xd3db('0x30')]['create'](_0x237f0a[_0xd3db('0x69')],{})[_0xd3db('0x2d')](respondWithResult(_0x1dab83,0xc9))['catch'](handleError(_0x1dab83,null));};exports[_0xd3db('0x21')]=function(_0x55c1d4,_0x2d0543){if(_0x55c1d4[_0xd3db('0x69')]['id']){delete _0x55c1d4['body']['id'];}return db[_0xd3db('0x30')][_0xd3db('0x5e')]({'where':{'id':_0x55c1d4[_0xd3db('0xa9')]['id']}})[_0xd3db('0x2d')](handleEntityNotFound(_0x2d0543,null))[_0xd3db('0x2d')](saveUpdates(_0x55c1d4[_0xd3db('0x69')],null))[_0xd3db('0x2d')](respondWithResult(_0x2d0543,null))[_0xd3db('0x2e')](handleError(_0x2d0543,null));};exports[_0xd3db('0x22')]=function(_0x45dbbc,_0x153216){return db[_0xd3db('0x30')][_0xd3db('0x5e')]({'where':{'id':_0x45dbbc[_0xd3db('0xa9')]['id']}})['then'](handleEntityNotFound(_0x153216,null))[_0xd3db('0x2d')](removeEntity(_0x153216,null))[_0xd3db('0x2e')](handleError(_0x153216,null));};exports[_0xd3db('0xae')]=function(_0xdc255e,_0x402e5e){return db[_0xd3db('0x30')]['describe']()[_0xd3db('0x2d')](respondWithResult(_0x402e5e,null))[_0xd3db('0x2e')](handleError(_0x402e5e,null));};exports[_0xd3db('0xaf')]=function(_0x38b210,_0x864c8e,_0x4679dc){return db[_0xd3db('0xb0')][_0xd3db('0x5e')]({'where':{'id':_0x38b210[_0xd3db('0xa9')]['id']}})[_0xd3db('0x2d')](handleEntityNotFound(_0x864c8e,null))[_0xd3db('0x2d')](function(_0x2eb77a){if(_0x2eb77a){return _0x2eb77a[_0xd3db('0xaf')](_0x38b210[_0xd3db('0x69')][_0xd3db('0xb1')],_['omit'](_0x38b210[_0xd3db('0x69')],[_0xd3db('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x864c8e,null))[_0xd3db('0x2e')](handleError(_0x864c8e,null));};exports['getMessages']=function(_0x5dab43,_0x500aa0,_0x2b7234){var _0x54802b={'raw':![],'where':{}};var _0x13758e={};var _0x156f54={'count':0x0,'rows':[]};return db[_0xd3db('0x30')][_0xd3db('0xb2')]({'where':{'id':_0x5dab43['params']['id']}})[_0xd3db('0x2d')](handleEntityNotFound(_0x500aa0,null))[_0xd3db('0x2d')](function(_0x18f52c){if(_0x18f52c){_0x13758e[_0xd3db('0x33')]=_[_0xd3db('0x6a')](db['SmsMessage'][_0xd3db('0xb3')]);_0x13758e[_0xd3db('0x34')]=_[_0xd3db('0x6a')](_0x5dab43[_0xd3db('0x34')]);_0x13758e['filters']=_['intersection'](_0x13758e['model'],_0x13758e[_0xd3db('0x34')]);_0x54802b[_0xd3db('0x36')]=_[_0xd3db('0x35')](_0x13758e[_0xd3db('0x33')],qs[_0xd3db('0x37')](_0x5dab43[_0xd3db('0x34')][_0xd3db('0x37')]));_0x54802b[_0xd3db('0x36')]=_0x54802b[_0xd3db('0x36')][_0xd3db('0x38')]?_0x54802b[_0xd3db('0x36')]:_0x13758e[_0xd3db('0x33')];if(!_0x5dab43[_0xd3db('0x34')][_0xd3db('0x39')](_0xd3db('0x3a'))){_0x54802b[_0xd3db('0x1d')]=qs[_0xd3db('0x1d')](_0x5dab43['query']['limit']);_0x54802b[_0xd3db('0x1c')]=qs[_0xd3db('0x1c')](_0x5dab43['query']['offset']);}_0x54802b[_0xd3db('0x3b')]=qs['sort'](_0x5dab43[_0xd3db('0x34')][_0xd3db('0x3c')]);_0x54802b['where']=qs['filters'](_['pick'](_0x5dab43[_0xd3db('0x34')],_0x13758e[_0xd3db('0x3f')]));_0x54802b[_0xd3db('0x3d')]['SmsInteractionId']=_0x18f52c['id'];if(_0x5dab43[_0xd3db('0x34')][_0xd3db('0x7b')]){_0x54802b['where']=_[_0xd3db('0xb4')](_0x54802b['where'],{'$or':_['map'](_0x54802b[_0xd3db('0x36')],function(_0x51a9c3){var _0x15141c={};_0x15141c[_0x51a9c3]={'$like':'%'+_0x5dab43[_0xd3db('0x34')]['filter']+'%'};return _0x15141c;})});}if(_0x5dab43[_0xd3db('0x34')][_0xd3db('0x72')]){var _0x595b5a=_0x5dab43['query'][_0xd3db('0x72')][_0xd3db('0x5a')](',');var _0x191eab={};_0x191eab[_0x595b5a[0x0]]={'$gte':moment(_0x595b5a[0x1])[_0xd3db('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x54802b['where']=_[_0xd3db('0xb4')](_0x54802b['where'],_0x191eab);}_0x54802b=_[_0xd3db('0xb4')]({},_0x54802b,_0x5dab43[_0xd3db('0xac')]);return db['SmsMessage']['count']({'where':_0x54802b['where']})[_0xd3db('0x2d')](function(_0x37dc7f){_0x156f54['count']=_0x37dc7f;if(_0x5dab43[_0xd3db('0x34')][_0xd3db('0xaa')]){_0x54802b[_0xd3db('0xab')]=[{'all':!![]}];}return db[_0xd3db('0xb0')][_0xd3db('0xb6')](_0x54802b);})[_0xd3db('0x2d')](function(_0x51ccc8){_0x156f54[_0xd3db('0xa7')]=_0x51ccc8;return _0x156f54;});}})['then'](respondWithFilteredResult(_0x500aa0,_0x54802b))['catch'](handleError(_0x500aa0,null));};exports[_0xd3db('0xb7')]=function(_0x18ff42,_0x587914,_0x25c683){return db[_0xd3db('0x30')][_0xd3db('0x5e')]({'where':{'id':_0x18ff42[_0xd3db('0xa9')]['id']}})['then'](handleEntityNotFound(_0x587914,null))[_0xd3db('0x2d')](function(_0x3a19e7){if(_0x3a19e7){return _0x3a19e7['setTags'](_0x18ff42[_0xd3db('0x69')][_0xd3db('0xb1')],_[_0xd3db('0xb8')](_0x18ff42['body'],['ids','id'])||{})[_0xd3db('0xb9')](function(){return db[_0xd3db('0x62')][_0xd3db('0xb6')]({'attributes':['id',_0xd3db('0x26'),_0xd3db('0xba')],'where':{'id':_0x18ff42['body'][_0xd3db('0xb1')]}});})[_0xd3db('0x2d')](function(_0x5e0fc5){socket[_0xd3db('0xbb')](_0xd3db('0xbc'),{'id':Number(_0x18ff42[_0xd3db('0xa9')]['id']),'tags':_0x5e0fc5||[]});return{'id':Number(_0x18ff42['params']['id']),'tags':_0x5e0fc5||[]};});}})['then'](respondWithResult(_0x587914,null))[_0xd3db('0x2e')](handleError(_0x587914,null));};exports['removeTags']=function(_0x21c5c0,_0x29810f,_0x3a9907){return db[_0xd3db('0x30')][_0xd3db('0x5e')]({'where':{'id':_0x21c5c0[_0xd3db('0xa9')]['id']}})['then'](handleEntityNotFound(_0x29810f,null))['then'](function(_0x5643c4){if(_0x5643c4){return _0x5643c4['removeTags'](_0x21c5c0[_0xd3db('0x34')][_0xd3db('0xb1')]);}})[_0xd3db('0x2d')](respondWithStatusCode(_0x29810f,null))[_0xd3db('0x2e')](handleError(_0x29810f,null));};exports[_0xd3db('0xbd')]=function(_0x4deaa6,_0x3667fc){var _0x17d07f=moment()[_0xd3db('0xbe')]()[_0xd3db('0x8f')]();var _0x17e63e=path[_0xd3db('0xbf')](config[_0xd3db('0xc0')],'server',_0xd3db('0xc1'),'tmp');var _0x18ea9a=path[_0xd3db('0xbf')](config[_0xd3db('0xc0')],_0xd3db('0xc2'),_0xd3db('0xc1'),_0xd3db('0xc3'));var _0x19396e=path[_0xd3db('0xbf')](_0x17e63e,_0x17d07f);var _0x585f72=util[_0xd3db('0xb5')](_0xd3db('0xc4'),_0x4deaa6[_0xd3db('0xa9')]['id'],_0x17d07f);var _0x2a3da5=path[_0xd3db('0xbf')](_0x17e63e,_0x585f72);var _0x49c23b=[];_0x49c23b[_0xd3db('0xa5')]({'model':db[_0xd3db('0xc5')],'as':_0xd3db('0xc5'),'attributes':['id',_0xd3db('0x2a')],'raw':!![]});_0x49c23b['push']({'model':db['CmContact'],'as':_0xd3db('0x58'),'attributes':['id',_0xd3db('0xc6'),_0xd3db('0xc7')],'raw':!![]});var _0x5c97be=[{'model':db[_0xd3db('0xb0')],'as':_0xd3db('0xc8'),'attributes':['id',_0xd3db('0x69'),_0xd3db('0x71'),_0xd3db('0xc9'),_0xd3db('0xca'),_0xd3db('0x77')],'include':_0x49c23b}];_0x5c97be[_0xd3db('0xa5')]({'model':db[_0xd3db('0xcb')],'as':_0xd3db('0xcc'),'attributes':['id',_0xd3db('0x26')]});_0x5c97be[_0xd3db('0xa5')]({'model':db[_0xd3db('0xc5')],'as':_0xd3db('0xcd'),'attributes':['id',_0xd3db('0x2a')]});return db[_0xd3db('0x30')]['find']({'where':{'id':_0x4deaa6[_0xd3db('0xa9')]['id']},'include':_0x5c97be})[_0xd3db('0x2d')](handleEntityNotFound(_0x3667fc,null))[_0xd3db('0x2d')](function(_0x36f988){if(_0x36f988){var _0xcb49ca=_0x36f988['get']({'plain':!![]});fs[_0xd3db('0xce')](_0x19396e);var _0x28b6bc={'format':'A4','border':_0xd3db('0xcf'),'header':{'height':_0xd3db('0xd0'),'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':_0xd3db('0xd1'),'contents':{'default':util[_0xd3db('0xb5')](_0xd3db('0xd2'),util['format']('%s\x20#%d',_0xd3db('0xd3'),_0xcb49ca['id']),moment()[_0xd3db('0xb5')](_0xd3db('0xd4'))['toString']())}}};var _0x98c13f={'channel':_0xd3db('0xd3'),'account':_0xcb49ca[_0xd3db('0xcc')][_0xd3db('0x26')],'agent':_0xcb49ca[_0xd3db('0xcd')]?_0xcb49ca['Owner'][_0xd3db('0x2a')]:_0xd3db('0xd5'),'createdAt':moment(_0xcb49ca[_0xd3db('0x71')])[_0xd3db('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd3db('0x8f')](),'closedAt':_0xcb49ca[_0xd3db('0xd6')]?moment(_0xcb49ca[_0xd3db('0xd7')])[_0xd3db('0xb5')](_0xd3db('0xd8'))[_0xd3db('0x8f')]():'','disposition':_0xcb49ca[_0xd3db('0xd9')],'messages':_(_0xcb49ca[_0xd3db('0xc8')])[_0xd3db('0x7b')]({'secret':![]})['map'](function(_0x2b7700){return{'date':moment(_0x2b7700[_0xd3db('0x71')])[_0xd3db('0xb5')](_0xd3db('0xd8'))['toString'](),'sender':_0x2b7700[_0xd3db('0xc9')]===_0xd3db('0xda')?_0x2b7700[_0xd3db('0xc5')]?_0x2b7700['User'][_0xd3db('0x2a')]:'System':_0x2b7700['Contact'][_0xd3db('0xc6')]+(_0x2b7700['Contact'][_0xd3db('0xc7')]?'\x20'+_0x2b7700[_0xd3db('0x58')][_0xd3db('0xc7')]:''),'body':_0x2b7700[_0xd3db('0x69')],'direction':_0x2b7700[_0xd3db('0xc9')]===_0xd3db('0xda')?'A':'C','secret':_0x2b7700['secret'],'read':_0x2b7700[_0xd3db('0x77')]};})[_0xd3db('0x55')]()};return ejs[_0xd3db('0xdb')](path[_0xd3db('0xbf')](config[_0xd3db('0xc0')],_0xd3db('0xc2'),_0xd3db('0xdc'),_0xd3db('0xdd')),{'interaction':_0x98c13f})[_0xd3db('0x2d')](function(_0x37042c){return new BPromise(function(_0x45a168,_0x468ff5){pdf[_0xd3db('0xad')](_0x37042c,_0x28b6bc)[_0xd3db('0xde')](path[_0xd3db('0xbf')](_0x19396e,_0xd3db('0xdf')+_0xcb49ca['id']+'-'+_0x17d07f+_0xd3db('0xe0')),function(_0x18bbb2,_0x37e668){if(_0x18bbb2)return _0x468ff5(_0x18bbb2);_0x45a168(_0x37e668);});});})[_0xd3db('0x2d')](function(){return new BPromise(function(_0x3f2faa,_0x9165b2){zipdir(_0x19396e,{'saveTo':_0x2a3da5},function(_0x2ac5ce,_0x1f3acb){if(_0x2ac5ce)return _0x9165b2(_0x2ac5ce);return _0x3f2faa(_0x1f3acb);});})[_0xd3db('0x2d')](function(){return new BPromise(function(_0x5786a2,_0x5d8a1e){rimraf(_0x19396e,function(_0xcab422){if(_0xcab422)_0x5d8a1e(_0xcab422);return _0x5786a2();});});})[_0xd3db('0x2d')](function(){return _0x3667fc[_0xd3db('0xbd')](_0x2a3da5,_0x585f72,function(_0x323ced){if(_0x323ced){console['log'](_0xd3db('0xe1'),_0x323ced);}else{fs[_0xd3db('0xe2')](_0x2a3da5);}});});});}else{return _0x3667fc[_0xd3db('0x23')](0xc8);}})['catch'](handleError(_0x3667fc,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 29e8890..64fdaa1 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 _0xb4c7=['SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction'];(function(_0x3a4dbf,_0x1ec8cd){var _0x418a25=function(_0x134886){while(--_0x134886){_0x3a4dbf['push'](_0x3a4dbf['shift']());}};_0x418a25(++_0x1ec8cd);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3db73e,_0x3b39d1){_0x3db73e=_0x3db73e-0x0;var _0x5f4474=_0xb4c7[_0x3db73e];return _0x5f4474;};'use strict';var EventEmitter=require(_0x7b4c('0x0'));var SmsInteraction=require(_0x7b4c('0x1'))['db'][_0x7b4c('0x2')];var SmsMessage=require(_0x7b4c('0x1'))['db'][_0x7b4c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b4c('0x4'),'afterUpdate':_0x7b4c('0x5'),'afterDestroy':_0x7b4c('0x6')};function emitEvent(_0x17cea2){return function(_0x2d9945,_0x5adec9,_0x1b0f57){_0x2d9945[_0x7b4c('0x7')]({'attributes':['id'],'raw':!![]})[_0x7b4c('0x8')](function(_0x4bf85d){_0x2d9945[_0x7b4c('0x9')](_0x7b4c('0xa'),_0x4bf85d['map'](function(_0x433aa2){return{'id':_0x433aa2['id']};}));return SmsMessage[_0x7b4c('0xb')]({'where':{'SmsInteractionId':_0x2d9945['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b4c('0x8')](function(_0x237e28){_0x2d9945[_0x7b4c('0x9')](_0x7b4c('0xc'),_0x237e28[_0x7b4c('0xd')]);SmsInteractionEvents[_0x7b4c('0xe')](_0x17cea2+':'+_0x2d9945['id'],_0x2d9945);SmsInteractionEvents[_0x7b4c('0xe')](_0x17cea2,_0x2d9945);_0x1b0f57(null);})[_0x7b4c('0xf')](_0x1b0f57(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x7b4c('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x8ce1=['setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x5c568e,_0xc5e4b0){var _0x5aff74=function(_0x125fa6){while(--_0x125fa6){_0x5c568e['push'](_0x5c568e['shift']());}};_0x5aff74(++_0xc5e4b0);}(_0x8ce1,0x183));var _0x18ce=function(_0x42d9fb,_0x5466df){_0x42d9fb=_0x42d9fb-0x0;var _0x37dcfb=_0x8ce1[_0x42d9fb];return _0x37dcfb;};'use strict';var EventEmitter=require(_0x18ce('0x0'));var SmsInteraction=require(_0x18ce('0x1'))['db'][_0x18ce('0x2')];var SmsMessage=require(_0x18ce('0x1'))['db'][_0x18ce('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x18ce('0x4')](0x0);var events={'afterCreate':_0x18ce('0x5'),'afterUpdate':_0x18ce('0x6'),'afterDestroy':_0x18ce('0x7')};function emitEvent(_0x15f55e){return function(_0x1797e6,_0x280142,_0x13ff9d){_0x1797e6[_0x18ce('0x8')]({'attributes':['id'],'raw':!![]})[_0x18ce('0x9')](function(_0x359094){_0x1797e6['setDataValue'](_0x18ce('0xa'),_0x359094[_0x18ce('0xb')](function(_0x29f1ea){return{'id':_0x29f1ea['id']};}));return SmsMessage[_0x18ce('0xc')]({'where':{'SmsInteractionId':_0x1797e6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3082bb){_0x1797e6[_0x18ce('0xd')](_0x18ce('0xe'),_0x3082bb[_0x18ce('0xf')]);SmsInteractionEvents['emit'](_0x15f55e+':'+_0x1797e6['id'],_0x1797e6);SmsInteractionEvents['emit'](_0x15f55e,_0x1797e6);_0x13ff9d(null);})[_0x18ce('0x10')](_0x13ff9d(null));};}for(var e in events){if(events[_0x18ce('0x11')](e)){var event=events[e];SmsInteraction[_0x18ce('0x12')](e,emitEvent(event));}}module[_0x18ce('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 84cfcf6..4bb855c 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 _0xe301=['format','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0xe301,0x9b));var _0x1e30=function(_0x5d819b,_0x5225a5){_0x5d819b=_0x5d819b-0x0;var _0x361835=_0xe301[_0x5d819b];return _0x361835;};'use strict';var _=require(_0x1e30('0x0'));var util=require('util');var logger=require(_0x1e30('0x1'))(_0x1e30('0x2'));var moment=require(_0x1e30('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e30('0x4'));var fs=require('fs');var path=require(_0x1e30('0x5'));var rimraf=require(_0x1e30('0x6'));var config=require(_0x1e30('0x7'));var attributes=require(_0x1e30('0x8'));module[_0x1e30('0x9')]=function(_0x53bfcd,_0x223dbc){return _0x53bfcd[_0x1e30('0xa')](_0x1e30('0xb'),attributes,{'tableName':_0x1e30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x201474,_0x5ba053,_0x46e26c){if(_0x201474['changed']('closed')){_0x201474['closedAt']=moment()[_0x1e30('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46e26c(null,_0x201474);}}});}; \ No newline at end of file +var _0xe294=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','SmsInteraction','sms_interactions','closed','closedAt','format'];(function(_0x2cce02,_0x2ef856){var _0x32aaed=function(_0x3dfaf2){while(--_0x3dfaf2){_0x2cce02['push'](_0x2cce02['shift']());}};_0x32aaed(++_0x2ef856);}(_0xe294,0x91));var _0x4e29=function(_0x42f805,_0x1d41cc){_0x42f805=_0x42f805-0x0;var _0x321fc3=_0xe294[_0x42f805];return _0x321fc3;};'use strict';var _=require(_0x4e29('0x0'));var util=require('util');var logger=require(_0x4e29('0x1'))(_0x4e29('0x2'));var moment=require(_0x4e29('0x3'));var BPromise=require(_0x4e29('0x4'));var rp=require(_0x4e29('0x5'));var fs=require('fs');var path=require(_0x4e29('0x6'));var rimraf=require(_0x4e29('0x7'));var config=require(_0x4e29('0x8'));var attributes=require(_0x4e29('0x9'));module['exports']=function(_0x9ff276,_0x3b7f76){return _0x9ff276['define'](_0x4e29('0xa'),attributes,{'tableName':_0x4e29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2245e1,_0x4b5c7e,_0x5f1d71){if(_0x2245e1['changed'](_0x4e29('0xc'))){_0x2245e1[_0x4e29('0xd')]=moment()[_0x4e29('0xe')](_0x4e29('0xf'));}_0x5f1d71(null,_0x2245e1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 351fab3..c78718a 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 _0x5515=['redis','defaults','localhost','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','AddTagsToSmsInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x48d9b7,_0x54f529){var _0x5863cd=function(_0x2e7fc4){while(--_0x2e7fc4){_0x48d9b7['push'](_0x48d9b7['shift']());}};_0x5863cd(++_0x54f529);}(_0x5515,0xe1));var _0x5551=function(_0x3724a0,_0x1d1275){_0x3724a0=_0x3724a0-0x0;var _0x2d49c9=_0x5515[_0x3724a0];return _0x2d49c9;};'use strict';var _=require(_0x5551('0x0'));var util=require(_0x5551('0x1'));var moment=require(_0x5551('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5551('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5551('0x4'));var logger=require('../../config/logger')(_0x5551('0x5'));var config=require(_0x5551('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5551('0x7')][_0x5551('0x8')]({'port':0x232a});config[_0x5551('0x9')]=_[_0x5551('0xa')](config[_0x5551('0x9')],{'host':_0x5551('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5551('0x9')]));require(_0x5551('0xc'))['register'](socket);function respondWithRpcPromise(_0x486d22,_0x49497d,_0x10a269){return new BPromise(function(_0x56d010,_0x5cb377){return client[_0x5551('0xd')](_0x486d22,_0x10a269)[_0x5551('0xe')](function(_0x22d60f){logger['info'](_0x5551('0xf'),_0x49497d,_0x5551('0x10'));logger[_0x5551('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x49497d,_0x5551('0x10'),JSON[_0x5551('0x12')](_0x22d60f));if(_0x22d60f[_0x5551('0x13')]){if(_0x22d60f[_0x5551('0x13')][_0x5551('0x14')]===0x1f4){logger[_0x5551('0x13')](_0x5551('0xf'),_0x49497d,_0x22d60f[_0x5551('0x13')][_0x5551('0x15')]);return _0x5cb377(_0x22d60f['error']['message']);}logger[_0x5551('0x13')](_0x5551('0xf'),_0x49497d,_0x22d60f['error']['message']);return _0x56d010(_0x22d60f[_0x5551('0x13')][_0x5551('0x15')]);}else{logger[_0x5551('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x49497d,_0x5551('0x10'));_0x56d010(_0x22d60f[_0x5551('0x17')][_0x5551('0x15')]);}})[_0x5551('0x18')](function(_0x57c4eb){logger[_0x5551('0x13')](_0x5551('0xf'),_0x49497d,_0x57c4eb);_0x5cb377(_0x57c4eb);});});}exports[_0x5551('0x19')]=function(_0x45d334){var _0x137f83=this;return new Promise(function(_0x342ea6,_0x2cd14d){return db[_0x5551('0x1a')][_0x5551('0x1b')](_0x45d334['body'],{'raw':_0x45d334[_0x5551('0x1c')]?_0x45d334[_0x5551('0x1c')][_0x5551('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45d334[_0x5551('0x1c')]?_0x45d334[_0x5551('0x1c')][_0x5551('0x1e')]||null:null,'attributes':_0x45d334[_0x5551('0x1c')]?_0x45d334['options'][_0x5551('0x1f')]||null:null,'limit':_0x45d334['options']?_0x45d334[_0x5551('0x1c')]['limit']||null:null})[_0x5551('0xe')](function(_0x28838c){logger[_0x5551('0x16')]('UpdateSmsInteraction',_0x45d334);logger[_0x5551('0x11')]('UpdateSmsInteraction',_0x45d334,JSON['stringify'](_0x28838c));_0x342ea6(_0x28838c);})[_0x5551('0x18')](function(_0x58ac89){logger['error'](_0x5551('0x19'),_0x58ac89[_0x5551('0x15')],_0x45d334);_0x2cd14d(_0x137f83[_0x5551('0x13')](0x1f4,_0x58ac89[_0x5551('0x15')]));});});};exports[_0x5551('0x20')]=function(_0x41fc39){return new Promise(function(_0x5bb01e,_0xe7caa6){return db[_0x5551('0x1a')][_0x5551('0x21')]({'where':_0x41fc39[_0x5551('0x1c')]?_0x41fc39[_0x5551('0x1c')][_0x5551('0x1e')]||null:null})['then'](function(_0x27bdf8){if(_0x27bdf8){return _0x27bdf8[_0x5551('0x22')](_0x41fc39[_0x5551('0x23')][_0x5551('0x24')],_[_0x5551('0x25')](_0x41fc39[_0x5551('0x23')],[_0x5551('0x24'),'id'])||{});}})['spread'](function(_0x3f0405){logger[_0x5551('0x16')](_0x5551('0x26'),_0x41fc39);logger[_0x5551('0x11')](_0x5551('0x26'),_0x41fc39,JSON[_0x5551('0x12')](_0x3f0405));_0x5bb01e(_0x3f0405);})[_0x5551('0x18')](function(_0xece755){logger[_0x5551('0x13')](_0x5551('0x26'),_0xece755[_0x5551('0x15')],_0x41fc39);_0xe7caa6(_this[_0x5551('0x13')](0x1f4,_0xece755[_0x5551('0x15')]));});});}; \ No newline at end of file +var _0x6625=['stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','body','options','where','attributes','limit','debug','catch','AddTagsToSmsInteraction','then','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4a565c,_0x274cb6){var _0x5504a7=function(_0x2bef8e){while(--_0x2bef8e){_0x4a565c['push'](_0x4a565c['shift']());}};_0x5504a7(++_0x274cb6);}(_0x6625,0x141));var _0x5662=function(_0x323e47,_0x5e31ce){_0x323e47=_0x323e47-0x0;var _0xc53588=_0x6625[_0x323e47];return _0xc53588;};'use strict';var _=require(_0x5662('0x0'));var util=require(_0x5662('0x1'));var moment=require(_0x5662('0x2'));var BPromise=require(_0x5662('0x3'));var rs=require(_0x5662('0x4'));var fs=require('fs');var Redis=require(_0x5662('0x5'));var db=require(_0x5662('0x6'))['db'];var utils=require(_0x5662('0x7'));var logger=require(_0x5662('0x8'))(_0x5662('0x9'));var config=require(_0x5662('0xa'));var jayson=require(_0x5662('0xb'));var client=jayson[_0x5662('0xc')][_0x5662('0xd')]({'port':0x232a});config[_0x5662('0xe')]=_['defaults'](config[_0x5662('0xe')],{'host':_0x5662('0xf'),'port':0x18eb});var socket=require(_0x5662('0x10'))(new Redis(config[_0x5662('0xe')]));require(_0x5662('0x11'))['register'](socket);function respondWithRpcPromise(_0x3e04be,_0x3ea6bc,_0x14c74f){return new BPromise(function(_0x130876,_0x4d0b92){return client[_0x5662('0x12')](_0x3e04be,_0x14c74f)['then'](function(_0x3c7ba8){logger[_0x5662('0x13')](_0x5662('0x14'),_0x3ea6bc,_0x5662('0x15'));logger['debug'](_0x5662('0x16'),_0x3ea6bc,'request\x20sent',JSON[_0x5662('0x17')](_0x3c7ba8));if(_0x3c7ba8[_0x5662('0x18')]){if(_0x3c7ba8['error'][_0x5662('0x19')]===0x1f4){logger[_0x5662('0x18')](_0x5662('0x14'),_0x3ea6bc,_0x3c7ba8['error'][_0x5662('0x1a')]);return _0x4d0b92(_0x3c7ba8[_0x5662('0x18')][_0x5662('0x1a')]);}logger[_0x5662('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x3ea6bc,_0x3c7ba8[_0x5662('0x18')][_0x5662('0x1a')]);return _0x130876(_0x3c7ba8[_0x5662('0x18')]['message']);}else{logger[_0x5662('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x3ea6bc,_0x5662('0x15'));_0x130876(_0x3c7ba8[_0x5662('0x1b')]['message']);}})['catch'](function(_0xfa323a){logger[_0x5662('0x18')](_0x5662('0x14'),_0x3ea6bc,_0xfa323a);_0x4d0b92(_0xfa323a);});});}exports[_0x5662('0x1c')]=function(_0x35f83c){var _0x1ebf52=this;return new Promise(function(_0x2255dc,_0x2a454b){return db[_0x5662('0x1d')]['update'](_0x35f83c[_0x5662('0x1e')],{'raw':_0x35f83c['options']?_0x35f83c[_0x5662('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f83c[_0x5662('0x1f')]?_0x35f83c[_0x5662('0x1f')][_0x5662('0x20')]||null:null,'attributes':_0x35f83c[_0x5662('0x1f')]?_0x35f83c[_0x5662('0x1f')][_0x5662('0x21')]||null:null,'limit':_0x35f83c[_0x5662('0x1f')]?_0x35f83c[_0x5662('0x1f')][_0x5662('0x22')]||null:null})['then'](function(_0x3ced75){logger[_0x5662('0x13')]('UpdateSmsInteraction',_0x35f83c);logger[_0x5662('0x23')](_0x5662('0x1c'),_0x35f83c,JSON['stringify'](_0x3ced75));_0x2255dc(_0x3ced75);})[_0x5662('0x24')](function(_0x240a7f){logger[_0x5662('0x18')](_0x5662('0x1c'),_0x240a7f['message'],_0x35f83c);_0x2a454b(_0x1ebf52[_0x5662('0x18')](0x1f4,_0x240a7f['message']));});});};exports[_0x5662('0x25')]=function(_0xe2dc59){return new Promise(function(_0x54dd66,_0x2383f5){return db['SmsInteraction']['find']({'where':_0xe2dc59[_0x5662('0x1f')]?_0xe2dc59[_0x5662('0x1f')][_0x5662('0x20')]||null:null})[_0x5662('0x26')](function(_0x7b48fd){if(_0x7b48fd){return _0x7b48fd[_0x5662('0x27')](_0xe2dc59[_0x5662('0x1e')]['ids'],_[_0x5662('0x28')](_0xe2dc59[_0x5662('0x1e')],[_0x5662('0x29'),'id'])||{});}})['spread'](function(_0xdc0210){logger[_0x5662('0x13')](_0x5662('0x2a'),_0xe2dc59);logger[_0x5662('0x23')]('AddTags',_0xe2dc59,JSON[_0x5662('0x17')](_0xdc0210));_0x54dd66(_0xdc0210);})[_0x5662('0x24')](function(_0x54db74){logger[_0x5662('0x18')](_0x5662('0x2a'),_0x54db74[_0x5662('0x1a')],_0xe2dc59);_0x2383f5(_this[_0x5662('0x18')](0x1f4,_0x54db74[_0x5662('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 23a1e9d..7d4c7f2 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f6037,_0x8e0a90){_0x4f6037=_0x4f6037-0x0;var _0x2542e2=_0xb10b[_0x4f6037];return _0x2542e2;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x2032,0xd9));var _0x2203=function(_0x344507,_0xb5acc6){_0x344507=_0x344507-0x0;var _0x108c45=_0x2032[_0x344507];return _0x108c45;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e7eb3ff..7a0a83d 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 _0xe961=['/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','express','Router','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe961,0x100));var _0x1e96=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe961[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x1e96('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e96('0x1'));var router=express[_0x1e96('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e96('0x3'));var controller=require(_0x1e96('0x4'));router[_0x1e96('0x5')]('/',auth[_0x1e96('0x6')](),controller[_0x1e96('0x7')]);router[_0x1e96('0x5')](_0x1e96('0x8'),auth[_0x1e96('0x6')](),controller[_0x1e96('0x9')]);router[_0x1e96('0x5')](_0x1e96('0xa'),auth['isAuthenticated'](),controller[_0x1e96('0xb')]);router[_0x1e96('0xc')]('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x1e96('0xd')),controller[_0x1e96('0xe')]);router[_0x1e96('0xc')](_0x1e96('0xf'),controller['status']);router[_0x1e96('0x10')](_0x1e96('0xa'),auth['isAuthenticated'](),controller[_0x1e96('0x11')]);router[_0x1e96('0x10')](_0x1e96('0x12'),auth['isAuthenticated'](),controller[_0x1e96('0x13')]);router[_0x1e96('0x10')](_0x1e96('0x14'),auth[_0x1e96('0x6')](),controller[_0x1e96('0x15')]);router[_0x1e96('0x16')](_0x1e96('0xa'),auth[_0x1e96('0x6')](),controller['destroy']);module[_0x1e96('0x17')]=router; \ No newline at end of file +var _0x520f=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','show','post','sms','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x4399a6,_0x4f3ef7){var _0x20ba25=function(_0x5c9e3c){while(--_0x5c9e3c){_0x4399a6['push'](_0x4399a6['shift']());}};_0x20ba25(++_0x4f3ef7);}(_0x520f,0x1de));var _0xf520=function(_0x555552,_0x576279){_0x555552=_0x555552-0x0;var _0x5b280d=_0x520f[_0x555552];return _0x5b280d;};'use strict';var multer=require(_0xf520('0x0'));var util=require(_0xf520('0x1'));var path=require('path');var timeout=require(_0xf520('0x2'));var express=require(_0xf520('0x3'));var router=express[_0xf520('0x4')]();var auth=require(_0xf520('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf520('0x6'));var controller=require(_0xf520('0x7'));router[_0xf520('0x8')]('/',auth['isAuthenticated'](),controller[_0xf520('0x9')]);router[_0xf520('0x8')](_0xf520('0xa'),auth[_0xf520('0xb')](),controller['describe']);router[_0xf520('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf520('0xc')]);router[_0xf520('0xd')]('/',auth[_0xf520('0xb')](),interaction['tracked'](_0xf520('0xe'),'smsmessage:create'),controller['create']);router['post']('/:id/status',controller[_0xf520('0xf')]);router[_0xf520('0x10')]('/:id',auth[_0xf520('0xb')](),controller[_0xf520('0x11')]);router[_0xf520('0x10')](_0xf520('0x12'),auth[_0xf520('0xb')](),controller[_0xf520('0x13')]);router[_0xf520('0x10')](_0xf520('0x14'),auth[_0xf520('0xb')](),controller[_0xf520('0x15')]);router[_0xf520('0x16')]('/:id',auth[_0xf520('0xb')](),controller[_0xf520('0x17')]);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 4628b6c..632244b 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 _0x82cc=['out','STRING','DATE','TEXT','exports','medium','BOOLEAN','ENUM'];(function(_0x17b287,_0x4bed1c){var _0x177054=function(_0x380f78){while(--_0x380f78){_0x17b287['push'](_0x17b287['shift']());}};_0x177054(++_0x4bed1c);}(_0x82cc,0x1c4));var _0xc82c=function(_0x269d65,_0x2ad40f){_0x269d65=_0x269d65-0x0;var _0x5d795d=_0x82cc[_0x269d65];return _0x5d795d;};'use strict';var Sequelize=require('sequelize');module[_0xc82c('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc82c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc82c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc82c('0x3')]('in','out'),'defaultValue':_0xc82c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc82c('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc82c('0x5')]},'readAt':{'type':Sequelize[_0xc82c('0x6')]},'secret':{'type':Sequelize[_0xc82c('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc82c('0x7')]}}; \ No newline at end of file +var _0xafc9=['STRING','DATE','exports','BOOLEAN','out'];(function(_0x474674,_0x1217cf){var _0x4ca2e9=function(_0x354b1b){while(--_0x354b1b){_0x474674['push'](_0x474674['shift']());}};_0x4ca2e9(++_0x1217cf);}(_0xafc9,0x1e7));var _0x9afc=function(_0x2ae948,_0x460897){_0x2ae948=_0x2ae948-0x0;var _0x13d189=_0xafc9[_0x2ae948];return _0x13d189;};'use strict';var Sequelize=require('sequelize');module[_0x9afc('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9afc('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9afc('0x2'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9afc('0x3')]},'readAt':{'type':Sequelize[_0x9afc('0x4')]},'secret':{'type':Sequelize[_0x9afc('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9afc('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4778512..271cd02 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 _0x8e7f=['event','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','request\x20sent','error','code','message','SmsMessage,\x20%s,\x20%s','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','body','destroy','describe','sms-interactions','accept','sms','read','format','UserId','user','CmContact','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e7f,0x1a5));var _0xf8e7=function(_0x1c3e9b,_0x18f31b){_0x1c3e9b=_0x1c3e9b-0x0;var _0x258774=_0x8e7f[_0x1c3e9b];return _0x258774;};'use strict';var pdf=require(_0xf8e7('0x0'));var emlformat=require(_0xf8e7('0x1'));var rimraf=require(_0xf8e7('0x2'));var zipdir=require(_0xf8e7('0x3'));var jsonpatch=require(_0xf8e7('0x4'));var rp=require(_0xf8e7('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf8e7('0x6'));var path=require(_0xf8e7('0x7'));var sox=require(_0xf8e7('0x8'));var csv=require(_0xf8e7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf8e7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf8e7('0xb'));var deskjs=require(_0xf8e7('0xc'));var toCsv=require(_0xf8e7('0x9'));var querystring=require(_0xf8e7('0xd'));var Papa=require(_0xf8e7('0xe'));var Redis=require(_0xf8e7('0xf'));var authService=require(_0xf8e7('0x10'));var qs=require(_0xf8e7('0x11'));var as=require(_0xf8e7('0x12'));var hardwareService=require(_0xf8e7('0x13'));var logger=require(_0xf8e7('0x14'))(_0xf8e7('0x15'));var utils=require(_0xf8e7('0x16'));var config=require(_0xf8e7('0x17'));var licenseUtil=require(_0xf8e7('0x18'));var db=require(_0xf8e7('0x19'))['db'];config[_0xf8e7('0x1a')]=_[_0xf8e7('0x1b')](config[_0xf8e7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8e7('0x1c'))(new Redis(config[_0xf8e7('0x1a')]));require(_0xf8e7('0x1d'))['register'](socket);var jayson=require(_0xf8e7('0x1e'));var client=jayson[_0xf8e7('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xf8e7('0x1f')][_0xf8e7('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x55c747,_0x1b7917,_0x5c980b,_0x2905fd){return new BPromise(function(_0x270804,_0x55f4e2){var _0x3ac674=_0x2905fd||client;return _0x3ac674['request'](_0x55c747,_0x5c980b)[_0xf8e7('0x21')](function(_0x377382){logger[_0xf8e7('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1b7917,_0xf8e7('0x23'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1b7917,_0xf8e7('0x23'),JSON['stringify'](_0x377382));if(_0x377382[_0xf8e7('0x24')]){if(_0x377382[_0xf8e7('0x24')][_0xf8e7('0x25')]===0x1f4){logger[_0xf8e7('0x24')]('SmsMessage,\x20%s,\x20%s',_0x1b7917,_0x377382['error'][_0xf8e7('0x26')]);return _0x55f4e2(_0x377382['error']['message']);}logger[_0xf8e7('0x24')](_0xf8e7('0x27'),_0x1b7917,_0x377382[_0xf8e7('0x24')][_0xf8e7('0x26')]);return _0x270804(_0x377382[_0xf8e7('0x24')][_0xf8e7('0x26')]);}else{logger[_0xf8e7('0x22')](_0xf8e7('0x27'),_0x1b7917,_0xf8e7('0x23'));_0x270804(_0x377382['result']['message']);}})[_0xf8e7('0x28')](function(_0x442391){logger[_0xf8e7('0x24')](_0xf8e7('0x27'),_0x1b7917,_0x442391);_0x55f4e2(_0x442391);});});}function respondWithStatusCode(_0x424c42,_0x3d8d3d){_0x3d8d3d=_0x3d8d3d||0xcc;return function(_0x46d9f8){if(_0x46d9f8){return _0x424c42[_0xf8e7('0x29')](_0x3d8d3d);}return _0x424c42['status'](_0x3d8d3d)[_0xf8e7('0x2a')]();};}function respondWithResult(_0x506147,_0x5b58ce){_0x5b58ce=_0x5b58ce||0xc8;return function(_0x48e046){if(_0x48e046){return _0x506147[_0xf8e7('0x2b')](_0x5b58ce)[_0xf8e7('0x2c')](_0x48e046);}};}function respondWithFilteredResult(_0x2380ce,_0x2c573e){return function(_0x18666c){if(_0x18666c){var _0x117794=_0x18666c[_0xf8e7('0x2d')],_0x45e408=_0x2c573e[_0xf8e7('0x2e')],_0x124099=_0x2c573e['offset']+_0x2c573e[_0xf8e7('0x2f')],_0x258f9c;if(_0x124099>=_0x117794){_0x124099=_0x117794;_0x258f9c=0xc8;}else{_0x258f9c=0xce;}_0x2380ce[_0xf8e7('0x2b')](_0x258f9c);return _0x2380ce[_0xf8e7('0x30')](_0xf8e7('0x31'),_0x45e408+'-'+_0x124099+'/'+_0x117794)['json'](_0x18666c);}return null;};}function patchUpdates(_0x4163b2){return function(_0x2df141){try{jsonpatch[_0xf8e7('0x32')](_0x2df141,_0x4163b2,!![]);}catch(_0x16e33b){return BPromise['reject'](_0x16e33b);}return _0x2df141[_0xf8e7('0x33')]();};}function saveUpdates(_0x268ebc,_0x1f4e7a){return function(_0x5ce15a){if(_0x5ce15a){return _0x5ce15a[_0xf8e7('0x34')](_0x268ebc)[_0xf8e7('0x21')](function(_0x29b583){return _0x29b583;});}return null;};}function removeEntity(_0x8d3393,_0x1024b5){return function(_0x277979){if(_0x277979){return _0x277979['destroy']()[_0xf8e7('0x21')](function(){_0x8d3393[_0xf8e7('0x2b')](0xcc)[_0xf8e7('0x2a')]();});}};}function handleEntityNotFound(_0xc72b9d,_0x33c86a){return function(_0x3b2a75){if(!_0x3b2a75){_0xc72b9d[_0xf8e7('0x29')](0x194);}return _0x3b2a75;};}function handleError(_0xebf7d5,_0x3773f8){_0x3773f8=_0x3773f8||0x1f4;return function(_0x1da1eb){logger[_0xf8e7('0x24')](_0x1da1eb[_0xf8e7('0x35')]);if(_0x1da1eb[_0xf8e7('0x36')]){delete _0x1da1eb[_0xf8e7('0x36')];}_0xebf7d5['status'](_0x3773f8)[_0xf8e7('0x37')](_0x1da1eb);};}exports['index']=function(_0x86e17d,_0x4a512e){var _0x5bbce4={},_0x3fe784={},_0x118e79={'count':0x0,'rows':[]};var _0xf1aa22=_[_0xf8e7('0x38')](db[_0xf8e7('0x39')][_0xf8e7('0x3a')],function(_0x2d67b9){return{'name':_0x2d67b9[_0xf8e7('0x3b')],'type':_0x2d67b9[_0xf8e7('0x3c')][_0xf8e7('0x3d')]};});_0x3fe784[_0xf8e7('0x3e')]=_[_0xf8e7('0x38')](_0xf1aa22,_0xf8e7('0x36'));_0x3fe784['query']=_['keys'](_0x86e17d[_0xf8e7('0x3f')]);_0x3fe784[_0xf8e7('0x40')]=_[_0xf8e7('0x41')](_0x3fe784[_0xf8e7('0x3e')],_0x3fe784[_0xf8e7('0x3f')]);_0x5bbce4[_0xf8e7('0x42')]=_[_0xf8e7('0x41')](_0x3fe784[_0xf8e7('0x3e')],qs[_0xf8e7('0x43')](_0x86e17d['query'][_0xf8e7('0x43')]));_0x5bbce4[_0xf8e7('0x42')]=_0x5bbce4[_0xf8e7('0x42')][_0xf8e7('0x44')]?_0x5bbce4[_0xf8e7('0x42')]:_0x3fe784['model'];if(!_0x86e17d['query']['hasOwnProperty'](_0xf8e7('0x45'))){_0x5bbce4[_0xf8e7('0x2f')]=qs[_0xf8e7('0x2f')](_0x86e17d['query'][_0xf8e7('0x2f')]);_0x5bbce4[_0xf8e7('0x2e')]=qs[_0xf8e7('0x2e')](_0x86e17d[_0xf8e7('0x3f')][_0xf8e7('0x2e')]);}_0x5bbce4[_0xf8e7('0x46')]=qs[_0xf8e7('0x47')](_0x86e17d[_0xf8e7('0x3f')][_0xf8e7('0x47')]);_0x5bbce4['where']=qs[_0xf8e7('0x40')](_[_0xf8e7('0x48')](_0x86e17d[_0xf8e7('0x3f')],_0x3fe784['filters']),_0xf1aa22);if(_0x86e17d[_0xf8e7('0x3f')]['filter']){_0x5bbce4[_0xf8e7('0x49')]=_[_0xf8e7('0x4a')](_0x5bbce4[_0xf8e7('0x49')],{'$or':_[_0xf8e7('0x38')](_0xf1aa22,function(_0xe76395){if(_0xe76395[_0xf8e7('0x3c')]!==_0xf8e7('0x4b')){var _0x1ea8e4={};_0x1ea8e4[_0xe76395[_0xf8e7('0x36')]]={'$like':'%'+_0x86e17d[_0xf8e7('0x3f')]['filter']+'%'};return _0x1ea8e4;}})});}_0x5bbce4=_['merge']({},_0x5bbce4,_0x86e17d[_0xf8e7('0x4c')]);var _0x31e2a1={'where':_0x5bbce4[_0xf8e7('0x49')]};return db[_0xf8e7('0x39')][_0xf8e7('0x2d')](_0x31e2a1)['then'](function(_0x3d1612){_0x118e79[_0xf8e7('0x2d')]=_0x3d1612;if(_0x86e17d[_0xf8e7('0x3f')][_0xf8e7('0x4d')]){_0x5bbce4[_0xf8e7('0x4e')]=[{'all':!![]}];}return db[_0xf8e7('0x39')][_0xf8e7('0x4f')](_0x5bbce4);})[_0xf8e7('0x21')](function(_0x3cae08){_0x118e79['rows']=_0x3cae08;return _0x118e79;})['then'](respondWithFilteredResult(_0x4a512e,_0x5bbce4))['catch'](handleError(_0x4a512e,null));};exports[_0xf8e7('0x50')]=function(_0x42dbd9,_0x10d27d){var _0x48576a={'raw':!![],'where':{'id':_0x42dbd9[_0xf8e7('0x51')]['id']}},_0x5b4aa8={};_0x5b4aa8['model']=_[_0xf8e7('0x52')](db[_0xf8e7('0x39')]['rawAttributes']);_0x5b4aa8['query']=_[_0xf8e7('0x52')](_0x42dbd9[_0xf8e7('0x3f')]);_0x5b4aa8['filters']=_[_0xf8e7('0x41')](_0x5b4aa8[_0xf8e7('0x3e')],_0x5b4aa8[_0xf8e7('0x3f')]);_0x48576a['attributes']=_[_0xf8e7('0x41')](_0x5b4aa8[_0xf8e7('0x3e')],qs['fields'](_0x42dbd9['query'][_0xf8e7('0x43')]));_0x48576a['attributes']=_0x48576a[_0xf8e7('0x42')][_0xf8e7('0x44')]?_0x48576a[_0xf8e7('0x42')]:_0x5b4aa8['model'];if(_0x42dbd9[_0xf8e7('0x3f')]['includeAll']){_0x48576a[_0xf8e7('0x4e')]=[{'all':!![]}];}_0x48576a=_[_0xf8e7('0x4a')]({},_0x48576a,_0x42dbd9['options']);return db[_0xf8e7('0x39')][_0xf8e7('0x53')](_0x48576a)[_0xf8e7('0x21')](handleEntityNotFound(_0x10d27d,null))['then'](respondWithResult(_0x10d27d,null))[_0xf8e7('0x28')](handleError(_0x10d27d,null));};exports['create']=function(_0x4a3384,_0xeaa6cb){return db['SmsMessage']['create'](_0x4a3384[_0xf8e7('0x54')],{})[_0xf8e7('0x21')](respondWithResult(_0xeaa6cb,0xc9))[_0xf8e7('0x28')](handleError(_0xeaa6cb,null));};exports[_0xf8e7('0x34')]=function(_0xa42d2b,_0x3ea197){if(_0xa42d2b[_0xf8e7('0x54')]['id']){delete _0xa42d2b[_0xf8e7('0x54')]['id'];}return db['SmsMessage'][_0xf8e7('0x53')]({'where':{'id':_0xa42d2b[_0xf8e7('0x51')]['id']}})[_0xf8e7('0x21')](handleEntityNotFound(_0x3ea197,null))['then'](saveUpdates(_0xa42d2b[_0xf8e7('0x54')],null))['then'](respondWithResult(_0x3ea197,null))[_0xf8e7('0x28')](handleError(_0x3ea197,null));};exports[_0xf8e7('0x55')]=function(_0x3555d5,_0x108105){return db['SmsMessage'][_0xf8e7('0x53')]({'where':{'id':_0x3555d5['params']['id']}})[_0xf8e7('0x21')](handleEntityNotFound(_0x108105,null))['then'](removeEntity(_0x108105,null))[_0xf8e7('0x28')](handleError(_0x108105,null));};exports[_0xf8e7('0x56')]=function(_0x428752,_0x1fe95a){return db[_0xf8e7('0x39')][_0xf8e7('0x56')]()[_0xf8e7('0x21')](respondWithResult(_0x1fe95a,null))[_0xf8e7('0x28')](handleError(_0x1fe95a,null));};var interaction_log=require('../../config/logger')(_0xf8e7('0x57'));exports[_0xf8e7('0x58')]=function(_0x184d62,_0x50d72f,_0x37b53f){var _0x4a3fc5={'channel':_0xf8e7('0x59')};if(_0x184d62[_0xf8e7('0x54')]['id']){delete _0x184d62['body']['id'];}_0x184d62[_0xf8e7('0x54')][_0xf8e7('0x5a')]=!![];_0x184d62[_0xf8e7('0x54')]['readAt']=moment()[_0xf8e7('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x184d62[_0xf8e7('0x54')][_0xf8e7('0x5c')]=_0x184d62['body'][_0xf8e7('0x5c')]||_0x184d62[_0xf8e7('0x5d')]['id'];return db[_0xf8e7('0x39')]['find']({'where':{'id':_0x184d62[_0xf8e7('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xf8e7('0x5e')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x50d72f,null))[_0xf8e7('0x21')](saveUpdates(_0x184d62[_0xf8e7('0x54')],null))[_0xf8e7('0x21')](function(_0x372178){if(_0x372178){_0x4a3fc5[_0xf8e7('0x26')]=_0x372178['get']({'plain':!![]});return db[_0xf8e7('0x5f')][_0xf8e7('0x53')]({'where':{'id':_0x372178[_0xf8e7('0x60')]}});}return null;})[_0xf8e7('0x21')](handleEntityNotFound(_0x50d72f,null))[_0xf8e7('0x21')](function(_0x444804){if(_0x444804){return _0x444804[_0xf8e7('0x34')]({'UserId':_0x184d62[_0xf8e7('0x54')][_0xf8e7('0x5c')],'read1stAt':_[_0xf8e7('0x61')](_0x444804['read1stAt'])?moment()[_0xf8e7('0x5b')](_0xf8e7('0x62')):undefined});}return null;})[_0xf8e7('0x21')](function(_0x465dba){if(_0x465dba){_0x4a3fc5[_0xf8e7('0x63')]=_0x465dba[_0xf8e7('0x64')]({'plain':!![]});interaction_log[_0xf8e7('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x184d62[_0xf8e7('0x5d')]['id'],_0x184d62[_0xf8e7('0x5d')]['name'],_0x184d62[_0xf8e7('0x5d')][_0xf8e7('0x65')],_0x4a3fc5[_0xf8e7('0x63')]['id'],_0x184d62[_0xf8e7('0x54')]?JSON['stringify'](_0x184d62[_0xf8e7('0x54')]):_0xf8e7('0x66'));return respondWithRpcPromise(_0xf8e7('0x67'),_0xf8e7('0x68'),_0x4a3fc5);}return null;})[_0xf8e7('0x21')](function(_0x1eb2a7){if(_0x1eb2a7){if(_0x184d62['body'][_0xf8e7('0x69')]){_0x4a3fc5[_0xf8e7('0x26')]['interface']=util[_0xf8e7('0x5b')](_0xf8e7('0x6a'),_0x184d62['user']['name']);_0x4a3fc5[_0xf8e7('0x26')][_0xf8e7('0x6b')]=_0x4a3fc5[_0xf8e7('0x6b')];_0x4a3fc5[_0xf8e7('0x26')]['event']=_0xf8e7('0x58');return respondWithRpcPromise(_0xf8e7('0x6c'),_0xf8e7('0x6c'),{'event':_0xf8e7('0x6d'),'message':_0x4a3fc5[_0xf8e7('0x26')]},client9002)[_0xf8e7('0x21')](function(){return _0x4a3fc5;});}return _0x4a3fc5;}return null;})['then'](respondWithResult(_0x50d72f,null))[_0xf8e7('0x28')](handleError(_0x50d72f,null));};var interaction_log=require(_0xf8e7('0x14'))(_0xf8e7('0x57'));exports[_0xf8e7('0x6e')]=function(_0x436bdb,_0x2e2482,_0x36387c){var _0x3c5bdc={'agent':{},'channel':'sms'};if(_0x436bdb[_0xf8e7('0x54')]['id']){delete _0x436bdb[_0xf8e7('0x54')]['id'];}_0x436bdb[_0xf8e7('0x54')][_0xf8e7('0x5c')]=_0x436bdb['body'][_0xf8e7('0x5c')]||_0x436bdb[_0xf8e7('0x5d')]['id'];_0x3c5bdc[_0xf8e7('0x6f')]['id']=_0x436bdb[_0xf8e7('0x54')]['UserId'];return db[_0xf8e7('0x39')][_0xf8e7('0x53')]({'where':{'id':_0x436bdb[_0xf8e7('0x51')]['id'],'UserId':null}})[_0xf8e7('0x21')](handleEntityNotFound(_0x2e2482,null))[_0xf8e7('0x21')](function(_0x4a9155){if(_0x4a9155){_0x3c5bdc[_0xf8e7('0x26')]=_0x4a9155['get']({'plain':!![]});return db[_0xf8e7('0x5f')]['find']({'where':{'id':_0x4a9155[_0xf8e7('0x60')]}});}return null;})[_0xf8e7('0x21')](handleEntityNotFound(_0x2e2482,null))[_0xf8e7('0x21')](function(_0x599f73){if(_0x599f73){_0x3c5bdc[_0xf8e7('0x63')]=_0x599f73[_0xf8e7('0x64')]({'plain':!![]});interaction_log[_0xf8e7('0x22')](_0xf8e7('0x70'),_0x436bdb['user']['id'],_0x436bdb[_0xf8e7('0x5d')][_0xf8e7('0x36')],_0x436bdb[_0xf8e7('0x5d')][_0xf8e7('0x65')],_0x3c5bdc[_0xf8e7('0x63')]['id'],_0x436bdb[_0xf8e7('0x54')]?JSON['stringify'](_0x436bdb['body']):_0xf8e7('0x66'));return respondWithRpcPromise(_0xf8e7('0x71'),_0xf8e7('0x72'),_0x3c5bdc);}return null;})[_0xf8e7('0x21')](function(_0x840ceb){if(_0x840ceb){_0x840ceb[_0xf8e7('0x26')]['interface']=util[_0xf8e7('0x5b')](_0xf8e7('0x6a'),_0x436bdb['user']['name']);_0x840ceb[_0xf8e7('0x26')][_0xf8e7('0x6b')]=_0x3c5bdc[_0xf8e7('0x6b')];_0x840ceb[_0xf8e7('0x26')][_0xf8e7('0x73')]=_0xf8e7('0x6e');respondWithRpcPromise(_0xf8e7('0x6c'),_0xf8e7('0x6c'),{'event':'rejectmessage','message':_0x840ceb[_0xf8e7('0x26')]},client9002);return _0x3c5bdc;}return null;})[_0xf8e7('0x21')](respondWithResult(_0x2e2482,null))['catch'](handleError(_0x2e2482,null));};exports[_0xf8e7('0x2b')]=function(_0x40c1d7,_0x382e5e,_0x12bd32){if(_0x40c1d7['body']['id']){delete _0x40c1d7[_0xf8e7('0x54')]['id'];}var _0x59bb8b;return db['SmsMessage'][_0xf8e7('0x53')]({'where':{'id':_0x40c1d7[_0xf8e7('0x51')]['id']}})['then'](handleEntityNotFound(_0x382e5e,null))['then'](function(_0x4268ea){if(_0x4268ea){_0x59bb8b=_0x4268ea;return db['SmsAccount'][_0xf8e7('0x53')]({'where':{'id':_0x4268ea[_0xf8e7('0x74')]}});}})['then'](handleEntityNotFound(_0x382e5e,null))[_0xf8e7('0x21')](function(_0x5b3a3f){if(_0x5b3a3f){logger[_0xf8e7('0x75')](_0xf8e7('0x76'),_0xf8e7('0x2b'),_0xf8e7('0x77'),_0x5b3a3f[_0xf8e7('0x3c')],util['inspect'](_0x40c1d7[_0xf8e7('0x54')],{'showHidden':![],'depth':null}));switch(_0x5b3a3f[_0xf8e7('0x3c')]){case _0xf8e7('0x78'):if(_0x40c1d7[_0xf8e7('0x54')][_0xf8e7('0x79')]&&_0x40c1d7['body'][_0xf8e7('0x79')]===_0x59bb8b[_0xf8e7('0x7a')]){return _0x59bb8b[_0xf8e7('0x34')]({'read':!![]});}else{logger[_0xf8e7('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf8e7('0x2b'),_0xf8e7('0x78'),util[_0xf8e7('0x7b')](_0x40c1d7['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x40c1d7[_0xf8e7('0x54')][_0xf8e7('0x7c')]&&_0x40c1d7[_0xf8e7('0x54')]['MessageUUID']===_0x59bb8b[_0xf8e7('0x7a')]&&_[_0xf8e7('0x7d')]([_0xf8e7('0x7e'),_0xf8e7('0x7f')],_0x40c1d7[_0xf8e7('0x54')][_0xf8e7('0x80')])>=0x0){return _0x59bb8b[_0xf8e7('0x34')]({'read':!![]});}else{logger['error'](_0xf8e7('0x81'),'status',_0xf8e7('0x82'),util[_0xf8e7('0x7b')](_0x40c1d7['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3df374=_0x40c1d7[_0xf8e7('0x54')][_0xf8e7('0x83')][0x0];if(_0x3df374[_0xf8e7('0x2b')]['groupName']===_0xf8e7('0x84')){return _0x59bb8b['update']({'read':!![]});}else{logger[_0xf8e7('0x24')](_0xf8e7('0x81'),_0xf8e7('0x2b'),_0xf8e7('0x85'),util[_0xf8e7('0x7b')](_0x40c1d7[_0xf8e7('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x59bb8b;}})[_0xf8e7('0x21')](respondWithResult(_0x382e5e,null))[_0xf8e7('0x28')](handleError(_0x382e5e,null));}; \ No newline at end of file +var _0xba17=['util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','status','json','offset','set','Content-Range','apply','reject','update','destroy','end','sendStatus','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','fields','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x158e63,_0x1cb91d){var _0x7b732c=function(_0x5c546c){while(--_0x5c546c){_0x158e63['push'](_0x158e63['shift']());}};_0x7b732c(++_0x1cb91d);}(_0xba17,0x110));var _0x7ba1=function(_0xdfb881,_0x3849ab){_0xdfb881=_0xdfb881-0x0;var _0x1ce6ae=_0xba17[_0xdfb881];return _0x1ce6ae;};'use strict';var pdf=require(_0x7ba1('0x0'));var emlformat=require(_0x7ba1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7ba1('0x2'));var jsonpatch=require(_0x7ba1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ba1('0x4'));var Mustache=require(_0x7ba1('0x5'));var util=require(_0x7ba1('0x6'));var path=require(_0x7ba1('0x7'));var sox=require(_0x7ba1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ba1('0x9'));var squel=require(_0x7ba1('0xa'));var crypto=require(_0x7ba1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7ba1('0xc'));var toCsv=require(_0x7ba1('0xd'));var querystring=require(_0x7ba1('0xe'));var Papa=require('papaparse');var Redis=require(_0x7ba1('0xf'));var authService=require(_0x7ba1('0x10'));var qs=require(_0x7ba1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ba1('0x12'));var logger=require(_0x7ba1('0x13'))(_0x7ba1('0x14'));var utils=require(_0x7ba1('0x15'));var config=require(_0x7ba1('0x16'));var licenseUtil=require(_0x7ba1('0x17'));var db=require(_0x7ba1('0x18'))['db'];config[_0x7ba1('0x19')]=_[_0x7ba1('0x1a')](config[_0x7ba1('0x19')],{'host':_0x7ba1('0x1b'),'port':0x18eb});var socket=require(_0x7ba1('0x1c'))(new Redis(config[_0x7ba1('0x19')]));require(_0x7ba1('0x1d'))['register'](socket);var jayson=require(_0x7ba1('0x1e'));var client=jayson['client'][_0x7ba1('0x1f')]({'port':0x232c});var client9002=jayson[_0x7ba1('0x20')][_0x7ba1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x19dc96,_0x45022b,_0x2c4963,_0x35428d){return new BPromise(function(_0x58854f,_0x1b6d40){var _0x4c3855=_0x35428d||client;return _0x4c3855[_0x7ba1('0x21')](_0x19dc96,_0x2c4963)[_0x7ba1('0x22')](function(_0x2add62){logger['info'](_0x7ba1('0x23'),_0x45022b,_0x7ba1('0x24'));logger[_0x7ba1('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x45022b,'request\x20sent',JSON[_0x7ba1('0x26')](_0x2add62));if(_0x2add62['error']){if(_0x2add62[_0x7ba1('0x27')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x45022b,_0x2add62[_0x7ba1('0x27')][_0x7ba1('0x28')]);return _0x1b6d40(_0x2add62[_0x7ba1('0x27')][_0x7ba1('0x28')]);}logger['error'](_0x7ba1('0x23'),_0x45022b,_0x2add62[_0x7ba1('0x27')][_0x7ba1('0x28')]);return _0x58854f(_0x2add62[_0x7ba1('0x27')][_0x7ba1('0x28')]);}else{logger[_0x7ba1('0x29')](_0x7ba1('0x23'),_0x45022b,'request\x20sent');_0x58854f(_0x2add62['result'][_0x7ba1('0x28')]);}})['catch'](function(_0x234fe9){logger[_0x7ba1('0x27')]('SmsMessage,\x20%s,\x20%s',_0x45022b,_0x234fe9);_0x1b6d40(_0x234fe9);});});}function respondWithStatusCode(_0x38844b,_0x2cf807){_0x2cf807=_0x2cf807||0xcc;return function(_0x5a28c7){if(_0x5a28c7){return _0x38844b['sendStatus'](_0x2cf807);}return _0x38844b[_0x7ba1('0x2a')](_0x2cf807)['end']();};}function respondWithResult(_0x3431d6,_0x2fb182){_0x2fb182=_0x2fb182||0xc8;return function(_0x2f25a6){if(_0x2f25a6){return _0x3431d6[_0x7ba1('0x2a')](_0x2fb182)[_0x7ba1('0x2b')](_0x2f25a6);}};}function respondWithFilteredResult(_0x363be4,_0x28d02c){return function(_0x4b98c3){if(_0x4b98c3){var _0x122cf1=_0x4b98c3['count'],_0x3fd3b3=_0x28d02c[_0x7ba1('0x2c')],_0x15b49b=_0x28d02c['offset']+_0x28d02c['limit'],_0x480378;if(_0x15b49b>=_0x122cf1){_0x15b49b=_0x122cf1;_0x480378=0xc8;}else{_0x480378=0xce;}_0x363be4[_0x7ba1('0x2a')](_0x480378);return _0x363be4[_0x7ba1('0x2d')](_0x7ba1('0x2e'),_0x3fd3b3+'-'+_0x15b49b+'/'+_0x122cf1)[_0x7ba1('0x2b')](_0x4b98c3);}return null;};}function patchUpdates(_0x396046){return function(_0x3f2bb){try{jsonpatch[_0x7ba1('0x2f')](_0x3f2bb,_0x396046,!![]);}catch(_0x2a9a2a){return BPromise[_0x7ba1('0x30')](_0x2a9a2a);}return _0x3f2bb['save']();};}function saveUpdates(_0x424ce2,_0x168c7c){return function(_0x505a77){if(_0x505a77){return _0x505a77[_0x7ba1('0x31')](_0x424ce2)['then'](function(_0x1b62d9){return _0x1b62d9;});}return null;};}function removeEntity(_0x4319b2,_0x33c179){return function(_0x151f0b){if(_0x151f0b){return _0x151f0b[_0x7ba1('0x32')]()['then'](function(){_0x4319b2[_0x7ba1('0x2a')](0xcc)[_0x7ba1('0x33')]();});}};}function handleEntityNotFound(_0x586b50,_0x562a13){return function(_0x1655a7){if(!_0x1655a7){_0x586b50[_0x7ba1('0x34')](0x194);}return _0x1655a7;};}function handleError(_0x264178,_0x9225f3){_0x9225f3=_0x9225f3||0x1f4;return function(_0x1266f6){logger[_0x7ba1('0x27')](_0x1266f6['stack']);if(_0x1266f6[_0x7ba1('0x35')]){delete _0x1266f6[_0x7ba1('0x35')];}_0x264178[_0x7ba1('0x2a')](_0x9225f3)[_0x7ba1('0x36')](_0x1266f6);};}exports[_0x7ba1('0x37')]=function(_0x535e96,_0x54dcdf){var _0x28478e={},_0x5e6739={},_0x9eb36f={'count':0x0,'rows':[]};var _0x54da6a=_['map'](db[_0x7ba1('0x38')][_0x7ba1('0x39')],function(_0x233bc8){return{'name':_0x233bc8[_0x7ba1('0x3a')],'type':_0x233bc8[_0x7ba1('0x3b')][_0x7ba1('0x3c')]};});_0x5e6739[_0x7ba1('0x3d')]=_[_0x7ba1('0x3e')](_0x54da6a,_0x7ba1('0x35'));_0x5e6739['query']=_[_0x7ba1('0x3f')](_0x535e96['query']);_0x5e6739[_0x7ba1('0x40')]=_['intersection'](_0x5e6739[_0x7ba1('0x3d')],_0x5e6739[_0x7ba1('0x41')]);_0x28478e[_0x7ba1('0x42')]=_['intersection'](_0x5e6739['model'],qs[_0x7ba1('0x43')](_0x535e96['query']['fields']));_0x28478e['attributes']=_0x28478e[_0x7ba1('0x42')]['length']?_0x28478e[_0x7ba1('0x42')]:_0x5e6739[_0x7ba1('0x3d')];if(!_0x535e96[_0x7ba1('0x41')]['hasOwnProperty']('nolimit')){_0x28478e['limit']=qs[_0x7ba1('0x44')](_0x535e96['query'][_0x7ba1('0x44')]);_0x28478e[_0x7ba1('0x2c')]=qs[_0x7ba1('0x2c')](_0x535e96['query'][_0x7ba1('0x2c')]);}_0x28478e[_0x7ba1('0x45')]=qs[_0x7ba1('0x46')](_0x535e96[_0x7ba1('0x41')][_0x7ba1('0x46')]);_0x28478e[_0x7ba1('0x47')]=qs['filters'](_[_0x7ba1('0x48')](_0x535e96[_0x7ba1('0x41')],_0x5e6739['filters']),_0x54da6a);if(_0x535e96['query']['filter']){_0x28478e['where']=_[_0x7ba1('0x49')](_0x28478e['where'],{'$or':_['map'](_0x54da6a,function(_0x404d29){if(_0x404d29['type']!==_0x7ba1('0x4a')){var _0x586ee8={};_0x586ee8[_0x404d29[_0x7ba1('0x35')]]={'$like':'%'+_0x535e96['query'][_0x7ba1('0x4b')]+'%'};return _0x586ee8;}})});}_0x28478e=_[_0x7ba1('0x49')]({},_0x28478e,_0x535e96[_0x7ba1('0x4c')]);var _0x23a16b={'where':_0x28478e[_0x7ba1('0x47')]};return db['SmsMessage'][_0x7ba1('0x4d')](_0x23a16b)['then'](function(_0x1987a2){_0x9eb36f[_0x7ba1('0x4d')]=_0x1987a2;if(_0x535e96[_0x7ba1('0x41')][_0x7ba1('0x4e')]){_0x28478e[_0x7ba1('0x4f')]=[{'all':!![]}];}return db[_0x7ba1('0x38')]['findAll'](_0x28478e);})['then'](function(_0xd4006e){_0x9eb36f[_0x7ba1('0x50')]=_0xd4006e;return _0x9eb36f;})['then'](respondWithFilteredResult(_0x54dcdf,_0x28478e))[_0x7ba1('0x51')](handleError(_0x54dcdf,null));};exports[_0x7ba1('0x52')]=function(_0x20b005,_0x7f0b6e){var _0x557983={'raw':!![],'where':{'id':_0x20b005[_0x7ba1('0x53')]['id']}},_0x45b4ab={};_0x45b4ab[_0x7ba1('0x3d')]=_[_0x7ba1('0x3f')](db[_0x7ba1('0x38')][_0x7ba1('0x39')]);_0x45b4ab[_0x7ba1('0x41')]=_[_0x7ba1('0x3f')](_0x20b005[_0x7ba1('0x41')]);_0x45b4ab[_0x7ba1('0x40')]=_[_0x7ba1('0x54')](_0x45b4ab[_0x7ba1('0x3d')],_0x45b4ab[_0x7ba1('0x41')]);_0x557983[_0x7ba1('0x42')]=_[_0x7ba1('0x54')](_0x45b4ab['model'],qs[_0x7ba1('0x43')](_0x20b005['query']['fields']));_0x557983[_0x7ba1('0x42')]=_0x557983[_0x7ba1('0x42')][_0x7ba1('0x55')]?_0x557983[_0x7ba1('0x42')]:_0x45b4ab['model'];if(_0x20b005[_0x7ba1('0x41')][_0x7ba1('0x4e')]){_0x557983[_0x7ba1('0x4f')]=[{'all':!![]}];}_0x557983=_[_0x7ba1('0x49')]({},_0x557983,_0x20b005[_0x7ba1('0x4c')]);return db[_0x7ba1('0x38')][_0x7ba1('0x56')](_0x557983)['then'](handleEntityNotFound(_0x7f0b6e,null))[_0x7ba1('0x22')](respondWithResult(_0x7f0b6e,null))[_0x7ba1('0x51')](handleError(_0x7f0b6e,null));};exports[_0x7ba1('0x57')]=function(_0x47c04c,_0x23d4fd){return db['SmsMessage']['create'](_0x47c04c[_0x7ba1('0x58')],{})[_0x7ba1('0x22')](respondWithResult(_0x23d4fd,0xc9))[_0x7ba1('0x51')](handleError(_0x23d4fd,null));};exports['update']=function(_0x5d74da,_0x4d17c0){if(_0x5d74da[_0x7ba1('0x58')]['id']){delete _0x5d74da[_0x7ba1('0x58')]['id'];}return db['SmsMessage'][_0x7ba1('0x56')]({'where':{'id':_0x5d74da[_0x7ba1('0x53')]['id']}})[_0x7ba1('0x22')](handleEntityNotFound(_0x4d17c0,null))[_0x7ba1('0x22')](saveUpdates(_0x5d74da[_0x7ba1('0x58')],null))[_0x7ba1('0x22')](respondWithResult(_0x4d17c0,null))[_0x7ba1('0x51')](handleError(_0x4d17c0,null));};exports[_0x7ba1('0x32')]=function(_0x2bf04c,_0x2bd26f){return db[_0x7ba1('0x38')]['find']({'where':{'id':_0x2bf04c[_0x7ba1('0x53')]['id']}})['then'](handleEntityNotFound(_0x2bd26f,null))[_0x7ba1('0x22')](removeEntity(_0x2bd26f,null))[_0x7ba1('0x51')](handleError(_0x2bd26f,null));};exports[_0x7ba1('0x59')]=function(_0x182579,_0x25cb5b){return db[_0x7ba1('0x38')][_0x7ba1('0x59')]()[_0x7ba1('0x22')](respondWithResult(_0x25cb5b,null))['catch'](handleError(_0x25cb5b,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x7ba1('0x5a')]=function(_0x5cf22d,_0x24653a,_0x4ba1b7){var _0x505479={'channel':_0x7ba1('0x5b')};if(_0x5cf22d['body']['id']){delete _0x5cf22d[_0x7ba1('0x58')]['id'];}_0x5cf22d[_0x7ba1('0x58')][_0x7ba1('0x5c')]=!![];_0x5cf22d[_0x7ba1('0x58')][_0x7ba1('0x5d')]=moment()[_0x7ba1('0x5e')](_0x7ba1('0x5f'));_0x5cf22d['body']['UserId']=_0x5cf22d[_0x7ba1('0x58')][_0x7ba1('0x60')]||_0x5cf22d['user']['id'];return db[_0x7ba1('0x38')][_0x7ba1('0x56')]({'where':{'id':_0x5cf22d[_0x7ba1('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x7ba1('0x61')],'as':_0x7ba1('0x62')}]})[_0x7ba1('0x22')](handleEntityNotFound(_0x24653a,null))['then'](saveUpdates(_0x5cf22d['body'],null))[_0x7ba1('0x22')](function(_0x507ad1){if(_0x507ad1){_0x505479[_0x7ba1('0x28')]=_0x507ad1[_0x7ba1('0x63')]({'plain':!![]});return db[_0x7ba1('0x64')][_0x7ba1('0x56')]({'where':{'id':_0x507ad1[_0x7ba1('0x65')]}});}return null;})[_0x7ba1('0x22')](handleEntityNotFound(_0x24653a,null))[_0x7ba1('0x22')](function(_0x55aa10){if(_0x55aa10){return _0x55aa10[_0x7ba1('0x31')]({'UserId':_0x5cf22d['body']['UserId'],'read1stAt':_[_0x7ba1('0x66')](_0x55aa10[_0x7ba1('0x67')])?moment()['format'](_0x7ba1('0x5f')):undefined});}return null;})[_0x7ba1('0x22')](function(_0x43483b){if(_0x43483b){_0x505479[_0x7ba1('0x68')]=_0x43483b[_0x7ba1('0x63')]({'plain':!![]});interaction_log[_0x7ba1('0x29')](_0x7ba1('0x69'),_0x5cf22d[_0x7ba1('0x6a')]['id'],_0x5cf22d['user'][_0x7ba1('0x35')],_0x5cf22d[_0x7ba1('0x6a')]['role'],_0x505479[_0x7ba1('0x68')]['id'],_0x5cf22d[_0x7ba1('0x58')]?JSON[_0x7ba1('0x26')](_0x5cf22d[_0x7ba1('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x7ba1('0x6b'),_0x505479);}return null;})[_0x7ba1('0x22')](function(_0x1e3462){if(_0x1e3462){if(_0x5cf22d['body']['manual']){_0x505479[_0x7ba1('0x28')][_0x7ba1('0x6c')]=util['format'](_0x7ba1('0x6d'),_0x5cf22d[_0x7ba1('0x6a')][_0x7ba1('0x35')]);_0x505479[_0x7ba1('0x28')][_0x7ba1('0x6e')]=_0x505479[_0x7ba1('0x6e')];_0x505479['message'][_0x7ba1('0x6f')]='accept';return respondWithRpcPromise(_0x7ba1('0x70'),_0x7ba1('0x70'),{'event':_0x7ba1('0x71'),'message':_0x505479['message']},client9002)[_0x7ba1('0x22')](function(){return _0x505479;});}return _0x505479;}return null;})[_0x7ba1('0x22')](respondWithResult(_0x24653a,null))[_0x7ba1('0x51')](handleError(_0x24653a,null));};var interaction_log=require(_0x7ba1('0x13'))(_0x7ba1('0x72'));exports[_0x7ba1('0x30')]=function(_0x4dd432,_0x4c2ac4,_0x191209){var _0x43c07c={'agent':{},'channel':_0x7ba1('0x5b')};if(_0x4dd432['body']['id']){delete _0x4dd432['body']['id'];}_0x4dd432[_0x7ba1('0x58')][_0x7ba1('0x60')]=_0x4dd432['body'][_0x7ba1('0x60')]||_0x4dd432['user']['id'];_0x43c07c[_0x7ba1('0x73')]['id']=_0x4dd432[_0x7ba1('0x58')]['UserId'];return db[_0x7ba1('0x38')]['find']({'where':{'id':_0x4dd432[_0x7ba1('0x53')]['id'],'UserId':null}})[_0x7ba1('0x22')](handleEntityNotFound(_0x4c2ac4,null))['then'](function(_0x348b5d){if(_0x348b5d){_0x43c07c[_0x7ba1('0x28')]=_0x348b5d['get']({'plain':!![]});return db[_0x7ba1('0x64')][_0x7ba1('0x56')]({'where':{'id':_0x348b5d['SmsInteractionId']}});}return null;})[_0x7ba1('0x22')](handleEntityNotFound(_0x4c2ac4,null))['then'](function(_0x1ddad6){if(_0x1ddad6){_0x43c07c[_0x7ba1('0x68')]=_0x1ddad6[_0x7ba1('0x63')]({'plain':!![]});interaction_log[_0x7ba1('0x29')](_0x7ba1('0x74'),_0x4dd432[_0x7ba1('0x6a')]['id'],_0x4dd432['user'][_0x7ba1('0x35')],_0x4dd432[_0x7ba1('0x6a')]['role'],_0x43c07c[_0x7ba1('0x68')]['id'],_0x4dd432[_0x7ba1('0x58')]?JSON[_0x7ba1('0x26')](_0x4dd432[_0x7ba1('0x58')]):_0x7ba1('0x75'));return respondWithRpcPromise('RejectMessage',_0x7ba1('0x76'),_0x43c07c);}return null;})['then'](function(_0x58a2b7){if(_0x58a2b7){_0x58a2b7['message']['interface']=util[_0x7ba1('0x5e')]('SIP/%s',_0x4dd432['user'][_0x7ba1('0x35')]);_0x58a2b7[_0x7ba1('0x28')][_0x7ba1('0x6e')]=_0x43c07c[_0x7ba1('0x6e')];_0x58a2b7[_0x7ba1('0x28')][_0x7ba1('0x6f')]=_0x7ba1('0x30');respondWithRpcPromise('EventManager',_0x7ba1('0x70'),{'event':_0x7ba1('0x77'),'message':_0x58a2b7[_0x7ba1('0x28')]},client9002);return _0x43c07c;}return null;})['then'](respondWithResult(_0x4c2ac4,null))[_0x7ba1('0x51')](handleError(_0x4c2ac4,null));};exports['status']=function(_0x166c3f,_0xa9c1f2,_0x1d895f){if(_0x166c3f['body']['id']){delete _0x166c3f[_0x7ba1('0x58')]['id'];}var _0x2626fe;return db[_0x7ba1('0x38')][_0x7ba1('0x56')]({'where':{'id':_0x166c3f[_0x7ba1('0x53')]['id']}})[_0x7ba1('0x22')](handleEntityNotFound(_0xa9c1f2,null))[_0x7ba1('0x22')](function(_0x21c0bd){if(_0x21c0bd){_0x2626fe=_0x21c0bd;return db[_0x7ba1('0x78')][_0x7ba1('0x56')]({'where':{'id':_0x21c0bd[_0x7ba1('0x79')]}});}})[_0x7ba1('0x22')](handleEntityNotFound(_0xa9c1f2,null))[_0x7ba1('0x22')](function(_0x28d71d){if(_0x28d71d){logger[_0x7ba1('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2a'),_0x7ba1('0x7a'),_0x28d71d[_0x7ba1('0x3b')],util['inspect'](_0x166c3f[_0x7ba1('0x58')],{'showHidden':![],'depth':null}));switch(_0x28d71d[_0x7ba1('0x3b')]){case _0x7ba1('0x7b'):if(_0x166c3f['body'][_0x7ba1('0x7c')]&&_0x166c3f[_0x7ba1('0x58')][_0x7ba1('0x7c')]===_0x2626fe[_0x7ba1('0x7d')]){return _0x2626fe[_0x7ba1('0x31')]({'read':!![]});}else{logger[_0x7ba1('0x27')](_0x7ba1('0x7e'),_0x7ba1('0x2a'),_0x7ba1('0x7b'),util[_0x7ba1('0x7f')](_0x166c3f['body'],{'showHidden':![],'depth':null}));}break;case _0x7ba1('0x80'):if(_0x166c3f[_0x7ba1('0x58')][_0x7ba1('0x81')]&&_0x166c3f[_0x7ba1('0x58')][_0x7ba1('0x81')]===_0x2626fe['messageId']&&_[_0x7ba1('0x82')]([_0x7ba1('0x83'),_0x7ba1('0x84')],_0x166c3f[_0x7ba1('0x58')][_0x7ba1('0x85')])>=0x0){return _0x2626fe[_0x7ba1('0x31')]({'read':!![]});}else{logger['error'](_0x7ba1('0x7e'),'status',_0x7ba1('0x86'),util[_0x7ba1('0x7f')](_0x166c3f['body'],{'showHidden':![],'depth':null}));}break;case _0x7ba1('0x87'):var _0x26350b=_0x166c3f[_0x7ba1('0x58')][_0x7ba1('0x88')][0x0];if(_0x26350b['status'][_0x7ba1('0x89')]===_0x7ba1('0x8a')){return _0x2626fe[_0x7ba1('0x31')]({'read':!![]});}else{logger[_0x7ba1('0x27')](_0x7ba1('0x7e'),_0x7ba1('0x2a'),'infobip',util['inspect'](_0x166c3f[_0x7ba1('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2626fe;}})[_0x7ba1('0x22')](respondWithResult(_0xa9c1f2,null))[_0x7ba1('0x51')](handleError(_0xa9c1f2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c587d0b..5dc70c4 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 _0x4ad2=['emit','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2265b0,_0x279abe){var _0xc4900b=function(_0x549d54){while(--_0x549d54){_0x2265b0['push'](_0x2265b0['shift']());}};_0xc4900b(++_0x279abe);}(_0x4ad2,0x1a2));var _0x24ad=function(_0x37b86b,_0xef631b){_0x37b86b=_0x37b86b-0x0;var _0x258ec7=_0x4ad2[_0x37b86b];return _0x258ec7;};'use strict';var EventEmitter=require(_0x24ad('0x0'));var SmsMessage=require(_0x24ad('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x24ad('0x2')](0x0);var events={'afterCreate':_0x24ad('0x3'),'afterUpdate':_0x24ad('0x4'),'afterDestroy':_0x24ad('0x5')};function emitEvent(_0x1118cf){return function(_0x1b3d8d,_0x49c2ec,_0x33ea8f){SmsMessageEvents[_0x24ad('0x6')](_0x1118cf+':'+_0x1b3d8d['id'],_0x1b3d8d);SmsMessageEvents['emit'](_0x1118cf,_0x1b3d8d);_0x33ea8f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x24ad('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x60cb=['emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','update','remove'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x60cb,0x19c));var _0xb60c=function(_0x5b8704,_0x1fe73f){_0x5b8704=_0x5b8704-0x0;var _0x147dbd=_0x60cb[_0x5b8704];return _0x147dbd;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xb60c('0x0'))['db'][_0xb60c('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb60c('0x2'),'afterDestroy':_0xb60c('0x3')};function emitEvent(_0x273c62){return function(_0x4c0d4d,_0x4e9fd2,_0x4668ae){SmsMessageEvents[_0xb60c('0x4')](_0x273c62+':'+_0x4c0d4d['id'],_0x4c0d4d);SmsMessageEvents['emit'](_0x273c62,_0x4c0d4d);_0x4668ae(null);};}for(var e in events){if(events[_0xb60c('0x5')](e)){var event=events[e];SmsMessage[_0xb60c('0x6')](e,emitEvent(event));}}module[_0xb60c('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4136a6e..4ffa77f 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 _0x3aff=['session_key','total_sent','internal_order_id','deliveryReport','read','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','crypto','apiKey','sender','text','timestamp','keys','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','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','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','accountSid','messages','body','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key'];(function(_0x55eb57,_0x4f6443){var _0x31b66f=function(_0x552e85){while(--_0x552e85){_0x55eb57['push'](_0x55eb57['shift']());}};_0x31b66f(++_0x4f6443);}(_0x3aff,0x1b4));var _0xf3af=function(_0x14e866,_0xb5001f){_0x14e866=_0x14e866-0x0;var _0x184212=_0x3aff[_0x14e866];return _0x184212;};'use strict';var _=require('lodash');var util=require(_0xf3af('0x0'));var logger=require(_0xf3af('0x1'))(_0xf3af('0x2'));var moment=require(_0xf3af('0x3'));var BPromise=require(_0xf3af('0x4'));var rp=require(_0xf3af('0x5'));var fs=require('fs');var path=require(_0xf3af('0x6'));var rimraf=require(_0xf3af('0x7'));var config=require(_0xf3af('0x8'));var attributes=require(_0xf3af('0x9'));module['exports']=function(_0x5ba687,_0xdff490){return _0x5ba687[_0xf3af('0xa')](_0xf3af('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xf3af('0xc'),'fields':[_0xf3af('0xc')]},{'name':_0xf3af('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b01ad,_0x136ebd,_0x5dd67f){var _0xb97782=_0x5ba687['models'];var _0x126ab5=_0x4b01ad[_0xf3af('0xe')]({'plain':!![]});if(_0x126ab5[_0xf3af('0xf')][_0xf3af('0x10')]()==='in'||_0x126ab5[_0xf3af('0xf')][_0xf3af('0x10')]()===_0xf3af('0x11')&&!_0x126ab5[_0xf3af('0x12')]&&!_[_0xf3af('0x13')](_0x126ab5['UserId'])){_0xb97782[_0xf3af('0x14')][_0xf3af('0x15')]({'where':{'id':_0x126ab5['SmsInteractionId']}})[_0xf3af('0x16')](function(_0x3ea214){if(_0x3ea214){_0x3ea214[_0xf3af('0x17')]({'lastMsgAt':_0x126ab5[_0xf3af('0x18')],'lastMsgDirection':_0x126ab5[_0xf3af('0xf')]['toLowerCase']()});}})[_0xf3af('0x19')](function(_0x4d7786){console[_0xf3af('0x1a')](_0x4d7786);});}if(_0x126ab5[_0xf3af('0xf')]===_0xf3af('0x11')&&!_0x126ab5[_0xf3af('0x12')]){var _0x10e659;_0xb97782['SmsAccount'][_0xf3af('0x1b')]({'where':{'id':_0x126ab5[_0xf3af('0x1c')]},'raw':!![]})[_0xf3af('0x16')](function(_0x5f40b8){_0x10e659=_0x5f40b8;if(_0x10e659&&_0x10e659[_0xf3af('0x1d')]){switch(_0x10e659['type']){case _0xf3af('0x1e'):var _0xbd8f69=require('twilio');if(_0x10e659['accountSid']&&_0x10e659[_0xf3af('0x1f')]&&_0x10e659['phone']){var _0x101533=new _0xbd8f69(_0x10e659[_0xf3af('0x20')],_0x10e659['authToken']);_0x101533[_0xf3af('0x21')]['create']({'body':_0x126ab5[_0xf3af('0x22')],'to':_0x126ab5[_0xf3af('0x23')],'from':_0x10e659[_0xf3af('0x23')],'statusCallback':_0x10e659[_0xf3af('0x24')]+_0xf3af('0x25')+_0x126ab5['id']+'/status?token='+_0x10e659[_0xf3af('0x26')]})[_0xf3af('0x16')](function(_0x4368e6){if(_0x4368e6[_0xf3af('0x27')]){return _0x4b01ad['update']({'messageId':_0x4368e6[_0xf3af('0x27')]});}})['catch'](function(_0x47c491){logger['error'](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x1e'),util[_0xf3af('0x2a')](_0x47c491,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x1e'),_0xf3af('0x2b'));}break;case _0xf3af('0x2c'):var _0x140872=_0xf3af('0x2d');if(_0x10e659[_0xf3af('0x2e')]&&_0x10e659[_0xf3af('0x2f')]){var _0x592f27={'recipient':[_0x126ab5[_0xf3af('0x23')]],'message':_0x126ab5['body'],'message_type':_0x10e659[_0xf3af('0x30')]};if(_0x10e659[_0xf3af('0x30')]&&_0x10e659[_0xf3af('0x30')]!=='SI'){_0x592f27['sender']=_0x10e659[_0xf3af('0x23')];}var _0x4a6802={'url':_0x140872+_0xf3af('0x31')+_0x10e659[_0xf3af('0x2e')]+_0xf3af('0x32')+_0x10e659[_0xf3af('0x2f')],'method':_0xf3af('0x33')};rp(_0x4a6802)['then'](function(_0x4d8f99){var _0x1e4a0c=_0x4d8f99[_0xf3af('0x34')](';');var _0x18969f={'user_key':_0x1e4a0c[0x0],'session_key':_0x1e4a0c[0x1]};_0x4a6802={'url':_0x140872+_0xf3af('0x35'),'method':_0xf3af('0x36'),'headers':{'user_key':_0x18969f[_0xf3af('0x37')],'Session_key':_0x18969f[_0xf3af('0x38')]},'json':!![],'body':_0x592f27};return rp(_0x4a6802);})['then'](function(_0x5db0cd){if(_0x5db0cd[_0xf3af('0x39')]>=0x1){var _0x25ddff={'messageId':_0x5db0cd[_0xf3af('0x3a')]};if(_0x10e659[_0xf3af('0x30')]!=='GP'||!_0x10e659[_0xf3af('0x3b')]){_0x25ddff[_0xf3af('0x3c')]=!![];}return _0x4b01ad[_0xf3af('0x17')](_0x25ddff);}else{return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x2c'),util['inspect'](_0x5db0cd,{'showHidden':![],'depth':null}));}})[_0xf3af('0x19')](function(_0xdebf76){return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x2c'),util[_0xf3af('0x2a')](_0xdebf76,{'showHidden':![],'depth':null}));});}else{logger[_0xf3af('0x1a')](_0xf3af('0x28'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xf3af('0x3d'):if(_0x10e659[_0xf3af('0x1f')]){var _0x35040d={'recipient':_0x126ab5[_0xf3af('0x23')],'message':_0x126ab5[_0xf3af('0x22')],'sender':_0x10e659['senderString']||_0x10e659[_0xf3af('0x23')],'authorization':_0x10e659[_0xf3af('0x1f')]};var _0x136ebd={'method':_0xf3af('0x36'),'uri':_0xf3af('0x3e'),'body':_0x35040d,'json':!![]};rp(_0x136ebd)[_0xf3af('0x16')](function(_0x46851e){var _0x35bea5={'messageId':_0x46851e[_0xf3af('0x3f')]};if(!_0x10e659['deliveryReport']){_0x35bea5[_0xf3af('0x3c')]=!![];}return _0x4b01ad[_0xf3af('0x17')](_0x35bea5);})[_0xf3af('0x19')](function(_0x9b5563){logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),'connectel',util[_0xf3af('0x2a')](_0x9b5563,{'showHidden':![],'depth':null}));});}else{logger[_0xf3af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf3af('0x3d'),_0xf3af('0x40'));}break;case _0xf3af('0x41'):if(_0x10e659[_0xf3af('0x2e')]&&_0x10e659[_0xf3af('0x2f')]){var _0x35040d={'messages':[{'source':_0xf3af('0x42'),'to':_0x126ab5['phone'],'body':_0x126ab5['body'],'from':_0x10e659[_0xf3af('0x43')]||_0x10e659['phone']}]};var _0x35533c=util['format'](_0xf3af('0x44'),_0x10e659[_0xf3af('0x2e')],_0x10e659[_0xf3af('0x2f')]);var _0x136ebd={'method':_0xf3af('0x36'),'uri':_0xf3af('0x45'),'body':_0x35040d,'headers':{'Authorization':util[_0xf3af('0x46')](_0xf3af('0x47'),new Buffer(_0x35533c)[_0xf3af('0x48')]('base64'))},'json':!![]};rp(_0x136ebd)['then'](function(_0x5ad670){if(_0x5ad670[_0xf3af('0x49')]>=0xc8&&_0x5ad670[_0xf3af('0x49')]<=0xce){if(_0x5ad670[_0xf3af('0x4a')]&&_0x5ad670[_0xf3af('0x4a')][_0xf3af('0x4b')]>0x0){var _0x4162f7=_[_0xf3af('0x4c')](_0x5ad670[_0xf3af('0x4a')][_0xf3af('0x21')]);var _0x39b242={'messageId':_0x4162f7[_0xf3af('0x4d')]};if(!_0x10e659[_0xf3af('0x3b')]){_0x39b242[_0xf3af('0x3c')]=!![];}return _0x4b01ad['update'](_0x39b242);}else{logger[_0xf3af('0x1a')](_0xf3af('0x28'),'afterCreate','clickSend',util[_0xf3af('0x2a')](_0x5ad670,{'showHidden':![],'depth':null}));}}else{logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),'clickSend',util[_0xf3af('0x2a')](_0x5ad670,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2bb7b4){logger['error'](_0xf3af('0x28'),_0xf3af('0x29'),'clickSend',util[_0xf3af('0x2a')](_0x2bb7b4,{'showHidden':![],'depth':null}));});}else{logger[_0xf3af('0x1a')](_0xf3af('0x28'),'afterCreate','clickSend',_0xf3af('0x4e'));}break;case _0xf3af('0x4f'):if(_0x10e659[_0xf3af('0x50')]&&_0x10e659[_0xf3af('0x1f')]){var _0x35040d={'dst':_0x126ab5[_0xf3af('0x23')],'text':_0x126ab5[_0xf3af('0x22')],'src':_0x10e659['senderString']||_0x10e659['phone'],'url':_0x10e659[_0xf3af('0x24')]+_0xf3af('0x25')+_0x126ab5['id']+'/status?token='+_0x10e659['token']};var _0x35533c=util[_0xf3af('0x46')](_0xf3af('0x44'),_0x10e659[_0xf3af('0x50')],_0x10e659[_0xf3af('0x1f')]);var _0x136ebd={'method':_0xf3af('0x36'),'uri':util[_0xf3af('0x46')](_0xf3af('0x51'),_0x10e659['authId']),'body':_0x35040d,'headers':{'Authorization':util['format'](_0xf3af('0x47'),new Buffer(_0x35533c)[_0xf3af('0x48')](_0xf3af('0x52')))},'json':!![]};rp(_0x136ebd)[_0xf3af('0x16')](function(_0x4d3813){var _0x26f527={'messageId':_0x4d3813[_0xf3af('0x53')][0x0]};return _0x4b01ad[_0xf3af('0x17')](_0x26f527);})[_0xf3af('0x19')](function(_0x38dda5){logger[_0xf3af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3af('0x29'),_0xf3af('0x4f'),util['inspect'](_0x38dda5,{'showHidden':![],'depth':null}));});}else{logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x4f'),_0xf3af('0x54'));}break;case _0xf3af('0x55'):if(_0x10e659['username']&&_0x10e659[_0xf3af('0x2f')]){if(_0x10e659[_0xf3af('0x56')]){var _0x2d81af={'method':_0xf3af('0x36'),'uri':_0x10e659[_0xf3af('0x56')]+_0xf3af('0x57'),'body':{'username':_0x10e659[_0xf3af('0x2e')],'password':_0x10e659[_0xf3af('0x2f')]},'json':!![]};return rp(_0x2d81af)[_0xf3af('0x16')](function(_0xc81bf1){var _0x2de2c5={'method':_0xf3af('0x36'),'uri':_0x10e659[_0xf3af('0x56')]+_0xf3af('0x58'),'body':{'messages':[{'from':_0x10e659[_0xf3af('0x23')],'destinations':[{'to':_0x126ab5['phone']}],'text':_0x126ab5[_0xf3af('0x22')],'notifyUrl':_0x10e659[_0xf3af('0x24')]+'/api/sms/messages/'+_0x126ab5['id']+_0xf3af('0x59')+_0x10e659[_0xf3af('0x26')],'notifyContentType':_0xf3af('0x5a'),'callbackData':_0x10e659[_0xf3af('0x23')]+';'+_0x126ab5[_0xf3af('0x22')]}]},'headers':{'Authorization':_0xf3af('0x5b')+_0xc81bf1[_0xf3af('0x26')]},'json':!![]};return rp(_0x2de2c5)[_0xf3af('0x16')](function(_0x4ab285){if(_0x4ab285[_0xf3af('0x21')]){var _0x5926e5={'messageId':_0x4ab285[_0xf3af('0x21')][0x0][_0xf3af('0xc')]};if(!_0x10e659[_0xf3af('0x3b')]){_0x5926e5[_0xf3af('0x3c')]=!![];}return _0x4b01ad['update'](_0x5926e5);}else{return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x55'),util[_0xf3af('0x2a')](_0x4ab285,{'showHidden':![],'depth':null}));}});})[_0xf3af('0x19')](function(_0x55a3dd){return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x55'),util[_0xf3af('0x2a')](_0x55a3dd,{'showHidden':![],'depth':null}));});}else{logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x55'),_0xf3af('0x4e'));}break;case'csc':var _0x3fb4de=require(_0xf3af('0x5c'));if(_0x10e659[_0xf3af('0x5d')]){var _0x3bd538={};_0x3bd538['login']=_0x10e659['username'];_0x3bd538[_0xf3af('0x23')]=_0x126ab5[_0xf3af('0x23')];_0x3bd538[_0xf3af('0x5e')]=_0x10e659[_0xf3af('0x23')];_0x3bd538[_0xf3af('0x5f')]=_0x126ab5[_0xf3af('0x22')];_0x3bd538[_0xf3af('0x60')]=+new Date();var _0x1dbb00='';var _0x538ebf='';var _0x49001c=Object[_0xf3af('0x61')](_0x3bd538);_0x49001c[_0xf3af('0x62')]();for(var _0x2f74c0=0x0;_0x2f74c0<_0x49001c[_0xf3af('0x63')];_0x2f74c0++){if(_0x1dbb00!=''){_0x1dbb00+='&';}_0x1dbb00+=_0x49001c[_0x2f74c0]+'='+encodeURIComponent(_0x3bd538[_0x49001c[_0x2f74c0]]);_0x538ebf+=_0x3bd538[_0x49001c[_0x2f74c0]];}_0x538ebf+=_0x10e659[_0xf3af('0x5d')];_0x538ebf=_0x3fb4de[_0xf3af('0x64')]('md5')[_0xf3af('0x17')](_0x538ebf)[_0xf3af('0x65')](_0xf3af('0x66'));if(_0x1dbb00!==''){_0x1dbb00+='&';}_0x1dbb00+=_0xf3af('0x67')+_0x538ebf;var _0x4a6802={'method':'GET','uri':_0x10e659[_0xf3af('0x56')]+_0xf3af('0x68')+_0x1dbb00,'json':!![]};return rp(_0x4a6802)[_0xf3af('0x16')](function(_0x279c51){var _0x155db2=Object[_0xf3af('0x61')](_0x279c51);if(_0x279c51[_0x155db2[0x0]]['error']&&parseInt(_0x279c51[_0x155db2[0x0]][_0xf3af('0x1a')])===0x0){var _0x57a832={'messageId':_0x279c51[_0x155db2[0x0]]['id_sms']};if(!_0x10e659[_0xf3af('0x3b')]){_0x57a832['read']=!![];}return _0x4b01ad[_0xf3af('0x17')](_0x57a832);}else{return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),_0xf3af('0x69'),util[_0xf3af('0x2a')](_0x279c51[_0xf3af('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf3af('0x19')](function(_0x50c38a){return logger['error'](_0xf3af('0x28'),_0xf3af('0x29'),'csc',util[_0xf3af('0x2a')](_0x50c38a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3af('0x29'),'csc',_0xf3af('0x6a'));}break;case _0xf3af('0x6b'):if(_0x10e659[_0xf3af('0x5d')]){var _0x47f50b={'method':_0xf3af('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x10e659[_0xf3af('0x5d')]},'body':{'content':_0x126ab5[_0xf3af('0x22')],'to':[_0x126ab5['phone']],'from':_0x10e659['phone'],'binary':![],'clientMessageId':_0xf3af('0x6c'),'charset':_0xf3af('0x6d')},'json':!![]};rp(_0x47f50b)[_0xf3af('0x16')](function(_0x33e994){if(!_0x33e994[_0xf3af('0x1a')]){var _0x22d8d1={'messageId':_0x33e994[_0xf3af('0x21')][0x0][_0xf3af('0x6e')]};if(!_0x10e659['deliveryReport']){_0x22d8d1['read']=!![];}return _0x4b01ad[_0xf3af('0x17')](_0x22d8d1);}else{return logger[_0xf3af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf3af('0x6b'),util[_0xf3af('0x2a')](_0x33e994[_0xf3af('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf3af('0x19')](function(_0x471582){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3af('0x29'),'clickatell',util['inspect'](_0x471582,{'showHidden':![],'depth':null}));});}else{logger[_0xf3af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf3af('0x6b'),_0xf3af('0x6a'));}break;case _0xf3af('0x6f'):if(_0x10e659[_0xf3af('0x5d')]){var _0x448fde={};var _0x4a6802={'method':_0xf3af('0x36'),'uri':_0xf3af('0x70'),'headers':{'Authorization':_0xf3af('0x71')+_0x10e659[_0xf3af('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x10e659[_0xf3af('0x23')],'to':_0x126ab5[_0xf3af('0x23')],'text':_0x126ab5[_0xf3af('0x22')]},'json':!![]};return rp(_0x4a6802)['then'](function(_0x213bf8){if(_0x213bf8[_0xf3af('0x72')]==0xca){_0x448fde['message']=_0x213bf8;var _0x2d41ee={'method':_0xf3af('0x36'),'uri':_0xf3af('0x73'),'headers':{'Authorization':_0xf3af('0x71')+_0x10e659[_0xf3af('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x448fde[_0xf3af('0x74')][_0xf3af('0x75')]},'json':!![]};return rp(_0x2d41ee)[_0xf3af('0x16')](function(_0x5be636){_0x448fde[_0xf3af('0x76')]=_0x5be636;var _0x1bdc24={'messageId':_0x448fde[_0xf3af('0x74')]['refid'],'read':!![]};return _0x4b01ad[_0xf3af('0x17')](_0x1bdc24);});}else{return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),'intelepeer',util[_0xf3af('0x2a')](_0x213bf8,{'showHidden':![],'depth':null}));}})[_0xf3af('0x19')](function(_0x2013e3){return logger[_0xf3af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3af('0x29'),_0xf3af('0x6f'),util[_0xf3af('0x2a')](_0x2013e3,{'showHidden':![],'depth':null}));});}else{return logger[_0xf3af('0x1a')](_0xf3af('0x28'),_0xf3af('0x29'),'intelepeer',_0xf3af('0x77'));}break;}}})[_0xf3af('0x78')](function(){_0x5dd67f();});}else{_0x5dd67f();}}},'charset':_0xf3af('0x79'),'collate':_0xf3af('0x7a')});}; \ No newline at end of file +var _0x06b1=['http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','timestamp','keys','sort','length','createHash','md5','digest','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','get','direction','toLowerCase','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote','/api/sms/messages/','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','password','smsMethod','login?username=','username','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64'];(function(_0x4a55e8,_0x14a69c){var _0x4cf642=function(_0xe8a40a){while(--_0xe8a40a){_0x4a55e8['push'](_0x4a55e8['shift']());}};_0x4cf642(++_0x14a69c);}(_0x06b1,0x128));var _0x106b=function(_0x20949b,_0x46490e){_0x20949b=_0x20949b-0x0;var _0x35d9fa=_0x06b1[_0x20949b];return _0x35d9fa;};'use strict';var _=require(_0x106b('0x0'));var util=require(_0x106b('0x1'));var logger=require(_0x106b('0x2'))(_0x106b('0x3'));var moment=require(_0x106b('0x4'));var BPromise=require(_0x106b('0x5'));var rp=require(_0x106b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x106b('0x7'));var config=require(_0x106b('0x8'));var attributes=require(_0x106b('0x9'));module[_0x106b('0xa')]=function(_0x2e730b,_0x1bfb43){return _0x2e730b[_0x106b('0xb')](_0x106b('0xc'),attributes,{'tableName':_0x106b('0xd'),'paranoid':![],'indexes':[{'name':_0x106b('0xe'),'fields':[_0x106b('0xe')]},{'name':_0x106b('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24d211,_0x485e29,_0x547d25){var _0x4418ee=_0x2e730b['models'];var _0x3ae966=_0x24d211[_0x106b('0x10')]({'plain':!![]});if(_0x3ae966[_0x106b('0x11')][_0x106b('0x12')]()==='in'||_0x3ae966[_0x106b('0x11')]['toLowerCase']()===_0x106b('0x13')&&!_0x3ae966['secret']&&!_[_0x106b('0x14')](_0x3ae966['UserId'])){_0x4418ee[_0x106b('0x15')][_0x106b('0x16')]({'where':{'id':_0x3ae966[_0x106b('0x17')]}})[_0x106b('0x18')](function(_0x54ac98){if(_0x54ac98){_0x54ac98['update']({'lastMsgAt':_0x3ae966[_0x106b('0x19')],'lastMsgDirection':_0x3ae966['direction'][_0x106b('0x12')]()});}})[_0x106b('0x1a')](function(_0x5a332b){console[_0x106b('0x1b')](_0x5a332b);});}if(_0x3ae966['direction']==='out'&&!_0x3ae966['secret']){var _0x5c57bd;_0x4418ee[_0x106b('0x1c')][_0x106b('0x1d')]({'where':{'id':_0x3ae966[_0x106b('0x1e')]},'raw':!![]})['then'](function(_0xbbabf9){_0x5c57bd=_0xbbabf9;if(_0x5c57bd&&_0x5c57bd[_0x106b('0x1f')]){switch(_0x5c57bd[_0x106b('0x1f')]){case _0x106b('0x20'):var _0x538701=require(_0x106b('0x20'));if(_0x5c57bd[_0x106b('0x21')]&&_0x5c57bd['authToken']&&_0x5c57bd['phone']){var _0x1b5e8a=new _0x538701(_0x5c57bd[_0x106b('0x21')],_0x5c57bd[_0x106b('0x22')]);_0x1b5e8a[_0x106b('0x23')][_0x106b('0x24')]({'body':_0x3ae966[_0x106b('0x25')],'to':_0x3ae966[_0x106b('0x26')],'from':_0x5c57bd[_0x106b('0x26')],'statusCallback':_0x5c57bd[_0x106b('0x27')]+_0x106b('0x28')+_0x3ae966['id']+'/status?token='+_0x5c57bd[_0x106b('0x29')]})[_0x106b('0x18')](function(_0x4ea6c2){if(_0x4ea6c2[_0x106b('0x2a')]){return _0x24d211[_0x106b('0x2b')]({'messageId':_0x4ea6c2[_0x106b('0x2a')]});}})['catch'](function(_0x1f35ab){logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x20'),util['inspect'](_0x1f35ab,{'showHidden':![],'depth':null}));});}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x3843eb='https://api.skebby.it/API/v1.0/REST/';if(_0x5c57bd['username']&&_0x5c57bd[_0x106b('0x2e')]){var _0x4b39ec={'recipient':[_0x3ae966[_0x106b('0x26')]],'message':_0x3ae966[_0x106b('0x25')],'message_type':_0x5c57bd[_0x106b('0x2f')]};if(_0x5c57bd[_0x106b('0x2f')]&&_0x5c57bd[_0x106b('0x2f')]!=='SI'){_0x4b39ec['sender']=_0x5c57bd[_0x106b('0x26')];}var _0x3a078e={'url':_0x3843eb+_0x106b('0x30')+_0x5c57bd[_0x106b('0x31')]+'&password='+_0x5c57bd['password'],'method':'GET'};rp(_0x3a078e)[_0x106b('0x18')](function(_0x5dc9d9){var _0x193cf0=_0x5dc9d9[_0x106b('0x32')](';');var _0x4afcda={'user_key':_0x193cf0[0x0],'session_key':_0x193cf0[0x1]};_0x3a078e={'url':_0x3843eb+_0x106b('0x33'),'method':_0x106b('0x34'),'headers':{'user_key':_0x4afcda[_0x106b('0x35')],'Session_key':_0x4afcda[_0x106b('0x36')]},'json':!![],'body':_0x4b39ec};return rp(_0x3a078e);})[_0x106b('0x18')](function(_0x70a72f){if(_0x70a72f[_0x106b('0x37')]>=0x1){var _0x577a0f={'messageId':_0x70a72f[_0x106b('0x38')]};if(_0x5c57bd[_0x106b('0x2f')]!=='GP'||!_0x5c57bd[_0x106b('0x39')]){_0x577a0f[_0x106b('0x3a')]=!![];}return _0x24d211[_0x106b('0x2b')](_0x577a0f);}else{return logger['error'](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x3b'),util['inspect'](_0x70a72f,{'showHidden':![],'depth':null}));}})[_0x106b('0x1a')](function(_0x4f69c9){return logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),'skebby',util[_0x106b('0x3c')](_0x4f69c9,{'showHidden':![],'depth':null}));});}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x106b('0x3d'):if(_0x5c57bd['authToken']){var _0x3cd981={'recipient':_0x3ae966[_0x106b('0x26')],'message':_0x3ae966['body'],'sender':_0x5c57bd[_0x106b('0x3e')]||_0x5c57bd[_0x106b('0x26')],'authorization':_0x5c57bd[_0x106b('0x22')]};var _0x485e29={'method':_0x106b('0x34'),'uri':_0x106b('0x3f'),'body':_0x3cd981,'json':!![]};rp(_0x485e29)[_0x106b('0x18')](function(_0x967849){var _0x7b563={'messageId':_0x967849[_0x106b('0x40')]};if(!_0x5c57bd[_0x106b('0x39')]){_0x7b563[_0x106b('0x3a')]=!![];}return _0x24d211[_0x106b('0x2b')](_0x7b563);})[_0x106b('0x1a')](function(_0xf57b6c){logger[_0x106b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x106b('0x3d'),util['inspect'](_0xf57b6c,{'showHidden':![],'depth':null}));});}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x3d'),_0x106b('0x41'));}break;case _0x106b('0x42'):if(_0x5c57bd[_0x106b('0x31')]&&_0x5c57bd['password']){var _0x3cd981={'messages':[{'source':_0x106b('0x43'),'to':_0x3ae966['phone'],'body':_0x3ae966[_0x106b('0x25')],'from':_0x5c57bd[_0x106b('0x3e')]||_0x5c57bd[_0x106b('0x26')]}]};var _0x2ed994=util['format'](_0x106b('0x44'),_0x5c57bd[_0x106b('0x31')],_0x5c57bd[_0x106b('0x2e')]);var _0x485e29={'method':_0x106b('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3cd981,'headers':{'Authorization':util[_0x106b('0x45')](_0x106b('0x46'),new Buffer(_0x2ed994)[_0x106b('0x47')](_0x106b('0x48')))},'json':!![]};rp(_0x485e29)[_0x106b('0x18')](function(_0x2d7be3){if(_0x2d7be3[_0x106b('0x49')]>=0xc8&&_0x2d7be3['http_code']<=0xce){if(_0x2d7be3[_0x106b('0x4a')]&&_0x2d7be3['data'][_0x106b('0x4b')]>0x0){var _0x13f09a=_[_0x106b('0x4c')](_0x2d7be3[_0x106b('0x4a')][_0x106b('0x23')]);var _0x2a6dec={'messageId':_0x13f09a[_0x106b('0x4d')]};if(!_0x5c57bd[_0x106b('0x39')]){_0x2a6dec[_0x106b('0x3a')]=!![];}return _0x24d211[_0x106b('0x2b')](_0x2a6dec);}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate',_0x106b('0x4e'),util[_0x106b('0x3c')](_0x2d7be3,{'showHidden':![],'depth':null}));}}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x4e'),util[_0x106b('0x3c')](_0x2d7be3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5d385d){logger[_0x106b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x106b('0x2d'),'clickSend',util[_0x106b('0x3c')](_0x5d385d,{'showHidden':![],'depth':null}));});}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate','clickSend',_0x106b('0x4f'));}break;case'plivo':if(_0x5c57bd[_0x106b('0x50')]&&_0x5c57bd[_0x106b('0x22')]){var _0x3cd981={'dst':_0x3ae966['phone'],'text':_0x3ae966[_0x106b('0x25')],'src':_0x5c57bd[_0x106b('0x3e')]||_0x5c57bd[_0x106b('0x26')],'url':_0x5c57bd['remote']+_0x106b('0x28')+_0x3ae966['id']+_0x106b('0x51')+_0x5c57bd[_0x106b('0x29')]};var _0x2ed994=util['format'](_0x106b('0x44'),_0x5c57bd['authId'],_0x5c57bd[_0x106b('0x22')]);var _0x485e29={'method':_0x106b('0x34'),'uri':util[_0x106b('0x45')](_0x106b('0x52'),_0x5c57bd[_0x106b('0x50')]),'body':_0x3cd981,'headers':{'Authorization':util['format'](_0x106b('0x46'),new Buffer(_0x2ed994)[_0x106b('0x47')]('base64'))},'json':!![]};rp(_0x485e29)['then'](function(_0x17ff5f){var _0xf65037={'messageId':_0x17ff5f[_0x106b('0x53')][0x0]};return _0x24d211[_0x106b('0x2b')](_0xf65037);})[_0x106b('0x1a')](function(_0x47b1cc){logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate',_0x106b('0x54'),util[_0x106b('0x3c')](_0x47b1cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x106b('0x2c'),_0x106b('0x2d'),'plivo',_0x106b('0x55'));}break;case _0x106b('0x56'):if(_0x5c57bd[_0x106b('0x31')]&&_0x5c57bd[_0x106b('0x2e')]){if(_0x5c57bd[_0x106b('0x57')]){var _0x14b28b={'method':_0x106b('0x34'),'uri':_0x5c57bd['baseUrl']+_0x106b('0x58'),'body':{'username':_0x5c57bd[_0x106b('0x31')],'password':_0x5c57bd[_0x106b('0x2e')]},'json':!![]};return rp(_0x14b28b)['then'](function(_0x11844e){var _0x280ff1={'method':_0x106b('0x34'),'uri':_0x5c57bd[_0x106b('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5c57bd['phone'],'destinations':[{'to':_0x3ae966[_0x106b('0x26')]}],'text':_0x3ae966[_0x106b('0x25')],'notifyUrl':_0x5c57bd[_0x106b('0x27')]+_0x106b('0x28')+_0x3ae966['id']+'/status?token='+_0x5c57bd[_0x106b('0x29')],'notifyContentType':_0x106b('0x59'),'callbackData':_0x5c57bd[_0x106b('0x26')]+';'+_0x3ae966['body']}]},'headers':{'Authorization':_0x106b('0x5a')+_0x11844e[_0x106b('0x29')]},'json':!![]};return rp(_0x280ff1)[_0x106b('0x18')](function(_0x335ed8){if(_0x335ed8[_0x106b('0x23')]){var _0x5e29ba={'messageId':_0x335ed8[_0x106b('0x23')][0x0][_0x106b('0xe')]};if(!_0x5c57bd[_0x106b('0x39')]){_0x5e29ba[_0x106b('0x3a')]=!![];}return _0x24d211[_0x106b('0x2b')](_0x5e29ba);}else{return logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate','infobip',util['inspect'](_0x335ed8,{'showHidden':![],'depth':null}));}});})[_0x106b('0x1a')](function(_0x389f72){return logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x56'),util['inspect'](_0x389f72,{'showHidden':![],'depth':null}));});}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x56'),_0x106b('0x5b'));}}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x56'),_0x106b('0x4f'));}break;case _0x106b('0x5c'):var _0x5327cb=require(_0x106b('0x5d'));if(_0x5c57bd[_0x106b('0x5e')]){var _0x5415db={};_0x5415db[_0x106b('0x5f')]=_0x5c57bd['username'];_0x5415db['phone']=_0x3ae966[_0x106b('0x26')];_0x5415db[_0x106b('0x60')]=_0x5c57bd[_0x106b('0x26')];_0x5415db['text']=_0x3ae966[_0x106b('0x25')];_0x5415db[_0x106b('0x61')]=+new Date();var _0x269979='';var _0x44d360='';var _0x414d72=Object[_0x106b('0x62')](_0x5415db);_0x414d72[_0x106b('0x63')]();for(var _0x5211d6=0x0;_0x5211d6<_0x414d72[_0x106b('0x64')];_0x5211d6++){if(_0x269979!=''){_0x269979+='&';}_0x269979+=_0x414d72[_0x5211d6]+'='+encodeURIComponent(_0x5415db[_0x414d72[_0x5211d6]]);_0x44d360+=_0x5415db[_0x414d72[_0x5211d6]];}_0x44d360+=_0x5c57bd[_0x106b('0x5e')];_0x44d360=_0x5327cb[_0x106b('0x65')](_0x106b('0x66'))[_0x106b('0x2b')](_0x44d360)[_0x106b('0x67')]('hex');if(_0x269979!==''){_0x269979+='&';}_0x269979+='signature='+_0x44d360;var _0x3a078e={'method':_0x106b('0x68'),'uri':_0x5c57bd[_0x106b('0x57')]+_0x106b('0x69')+_0x269979,'json':!![]};return rp(_0x3a078e)[_0x106b('0x18')](function(_0x1944bc){var _0x2314fe=Object[_0x106b('0x62')](_0x1944bc);if(_0x1944bc[_0x2314fe[0x0]]['error']&&parseInt(_0x1944bc[_0x2314fe[0x0]][_0x106b('0x1b')])===0x0){var _0x45d5db={'messageId':_0x1944bc[_0x2314fe[0x0]][_0x106b('0x6a')]};if(!_0x5c57bd[_0x106b('0x39')]){_0x45d5db['read']=!![];}return _0x24d211[_0x106b('0x2b')](_0x45d5db);}else{return logger[_0x106b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x106b('0x2d'),'csc',util['inspect'](_0x1944bc[_0x106b('0x1b')],{'showHidden':![],'depth':null}));}})[_0x106b('0x1a')](function(_0x4cd378){return logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x5c'),util[_0x106b('0x3c')](_0x4cd378,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x5c'),_0x106b('0x6b'));}break;case'clickatell':if(_0x5c57bd[_0x106b('0x5e')]){var _0x5fa6a5={'method':_0x106b('0x34'),'uri':_0x106b('0x6c'),'headers':{'Authorization':_0x5c57bd[_0x106b('0x5e')]},'body':{'content':_0x3ae966[_0x106b('0x25')],'to':[_0x3ae966[_0x106b('0x26')]],'from':_0x5c57bd[_0x106b('0x26')],'binary':![],'clientMessageId':_0x106b('0x6d'),'charset':_0x106b('0x6e')},'json':!![]};rp(_0x5fa6a5)[_0x106b('0x18')](function(_0x436e79){if(!_0x436e79['error']){var _0x5bf336={'messageId':_0x436e79[_0x106b('0x23')][0x0][_0x106b('0x6f')]};if(!_0x5c57bd[_0x106b('0x39')]){_0x5bf336['read']=!![];}return _0x24d211[_0x106b('0x2b')](_0x5bf336);}else{return logger['error'](_0x106b('0x2c'),_0x106b('0x2d'),_0x106b('0x70'),util['inspect'](_0x436e79[_0x106b('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x491375){return logger[_0x106b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x106b('0x2d'),_0x106b('0x70'),util['inspect'](_0x491375,{'showHidden':![],'depth':null}));});}else{logger[_0x106b('0x1b')](_0x106b('0x2c'),'afterCreate',_0x106b('0x70'),_0x106b('0x6b'));}break;case'intelepeer':if(_0x5c57bd[_0x106b('0x5e')]){var _0x2c4d9b={};var _0x3a078e={'method':'POST','uri':_0x106b('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x5c57bd[_0x106b('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x5c57bd['phone'],'to':_0x3ae966['phone'],'text':_0x3ae966[_0x106b('0x25')]},'json':!![]};return rp(_0x3a078e)[_0x106b('0x18')](function(_0x58c3d4){if(_0x58c3d4[_0x106b('0x72')]==0xca){_0x2c4d9b[_0x106b('0x73')]=_0x58c3d4;var _0x2a63e7={'method':_0x106b('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x5c57bd[_0x106b('0x5e')],'Content-Type':_0x106b('0x59')},'body':{'refid':_0x2c4d9b['message']['refid']},'json':!![]};return rp(_0x2a63e7)[_0x106b('0x18')](function(_0x2d2e97){_0x2c4d9b[_0x106b('0x74')]=_0x2d2e97;var _0x25b1a4={'messageId':_0x2c4d9b[_0x106b('0x73')][_0x106b('0x75')],'read':!![]};return _0x24d211['update'](_0x25b1a4);});}else{return logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),'intelepeer',util[_0x106b('0x3c')](_0x58c3d4,{'showHidden':![],'depth':null}));}})[_0x106b('0x1a')](function(_0x26f2ff){return logger[_0x106b('0x1b')](_0x106b('0x2c'),_0x106b('0x2d'),'intelepeer',util[_0x106b('0x3c')](_0x26f2ff,{'showHidden':![],'depth':null}));});}else{return logger[_0x106b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x106b('0x2d'),_0x106b('0x76'),_0x106b('0x77'));}break;}}})[_0x106b('0x78')](function(){_0x547d25();});}else{_0x547d25();}}},'charset':_0x106b('0x79'),'collate':_0x106b('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5ad8ae9..36beb1a 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 _0xabf2=['catch','CreateSmsMessage','SmsMessage','create','body','options','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsMessage.socket','register','request','request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','result'];(function(_0x1fc3aa,_0x1b92fd){var _0x11dd40=function(_0x4b8205){while(--_0x4b8205){_0x1fc3aa['push'](_0x1fc3aa['shift']());}};_0x11dd40(++_0x1b92fd);}(_0xabf2,0x13e));var _0x2abf=function(_0x330a37,_0x470105){_0x330a37=_0x330a37-0x0;var _0x114aaf=_0xabf2[_0x330a37];return _0x114aaf;};'use strict';var _=require(_0x2abf('0x0'));var util=require('util');var moment=require(_0x2abf('0x1'));var BPromise=require(_0x2abf('0x2'));var rs=require(_0x2abf('0x3'));var fs=require('fs');var Redis=require(_0x2abf('0x4'));var db=require(_0x2abf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2abf('0x6'));var config=require(_0x2abf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2abf('0x8')][_0x2abf('0x9')]({'port':0x232a});config[_0x2abf('0xa')]=_[_0x2abf('0xb')](config[_0x2abf('0xa')],{'host':_0x2abf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2abf('0xa')]));require(_0x2abf('0xd'))[_0x2abf('0xe')](socket);function respondWithRpcPromise(_0x246a2d,_0x40ad11,_0xbf5951){return new BPromise(function(_0x33069e,_0x93de73){return client[_0x2abf('0xf')](_0x246a2d,_0xbf5951)['then'](function(_0xb76dec){logger['info']('SmsMessage,\x20%s,\x20%s',_0x40ad11,_0x2abf('0x10'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x40ad11,'request\x20sent',JSON[_0x2abf('0x11')](_0xb76dec));if(_0xb76dec['error']){if(_0xb76dec[_0x2abf('0x12')]['code']===0x1f4){logger['error'](_0x2abf('0x13'),_0x40ad11,_0xb76dec[_0x2abf('0x12')][_0x2abf('0x14')]);return _0x93de73(_0xb76dec[_0x2abf('0x12')][_0x2abf('0x14')]);}logger[_0x2abf('0x12')](_0x2abf('0x13'),_0x40ad11,_0xb76dec[_0x2abf('0x12')]['message']);return _0x33069e(_0xb76dec['error'][_0x2abf('0x14')]);}else{logger[_0x2abf('0x15')](_0x2abf('0x13'),_0x40ad11,_0x2abf('0x10'));_0x33069e(_0xb76dec[_0x2abf('0x16')][_0x2abf('0x14')]);}})[_0x2abf('0x17')](function(_0x12fcf2){logger['error']('SmsMessage,\x20%s,\x20%s',_0x40ad11,_0x12fcf2);_0x93de73(_0x12fcf2);});});}exports[_0x2abf('0x18')]=function(_0x599155){var _0x451e4d=this;return new Promise(function(_0x22e6c6,_0x3ba9d3){return db[_0x2abf('0x19')][_0x2abf('0x1a')](_0x599155[_0x2abf('0x1b')],{'raw':_0x599155[_0x2abf('0x1c')]?_0x599155[_0x2abf('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x2abf('0x1d')](function(_0x10abcf){logger['info']('CreateSmsMessage',_0x599155);logger[_0x2abf('0x1e')](_0x2abf('0x18'),_0x599155,JSON[_0x2abf('0x11')](_0x10abcf));_0x22e6c6(_0x10abcf);})[_0x2abf('0x17')](function(_0x49c655){logger[_0x2abf('0x12')]('CreateSmsMessage',_0x49c655['message'],_0x599155);_0x3ba9d3(_0x451e4d[_0x2abf('0x12')](0x1f4,_0x49c655['message']));});});}; \ No newline at end of file +var _0x550b=['request','then','info','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','result','body','options','CreateSmsMessage','stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register'];(function(_0x1196c3,_0x4e6a62){var _0x1a773e=function(_0x145727){while(--_0x145727){_0x1196c3['push'](_0x1196c3['shift']());}};_0x1a773e(++_0x4e6a62);}(_0x550b,0x87));var _0xb550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb550('0x0'));var BPromise=require(_0xb550('0x1'));var rs=require(_0xb550('0x2'));var fs=require('fs');var Redis=require(_0xb550('0x3'));var db=require(_0xb550('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb550('0x5'));var config=require(_0xb550('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb550('0x7')][_0xb550('0x8')]({'port':0x232a});config[_0xb550('0x9')]=_[_0xb550('0xa')](config[_0xb550('0x9')],{'host':_0xb550('0xb'),'port':0x18eb});var socket=require(_0xb550('0xc'))(new Redis(config[_0xb550('0x9')]));require(_0xb550('0xd'))[_0xb550('0xe')](socket);function respondWithRpcPromise(_0x23df8e,_0x2ed21f,_0x1e2d4c){return new BPromise(function(_0x112c59,_0x317bea){return client[_0xb550('0xf')](_0x23df8e,_0x1e2d4c)[_0xb550('0x10')](function(_0x271b64){logger[_0xb550('0x11')]('SmsMessage,\x20%s,\x20%s',_0x2ed21f,_0xb550('0x12'));logger[_0xb550('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ed21f,'request\x20sent',JSON['stringify'](_0x271b64));if(_0x271b64[_0xb550('0x14')]){if(_0x271b64[_0xb550('0x14')][_0xb550('0x15')]===0x1f4){logger[_0xb550('0x14')](_0xb550('0x16'),_0x2ed21f,_0x271b64[_0xb550('0x14')][_0xb550('0x17')]);return _0x317bea(_0x271b64[_0xb550('0x14')][_0xb550('0x17')]);}logger[_0xb550('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2ed21f,_0x271b64[_0xb550('0x14')][_0xb550('0x17')]);return _0x112c59(_0x271b64[_0xb550('0x14')][_0xb550('0x17')]);}else{logger['info'](_0xb550('0x16'),_0x2ed21f,'request\x20sent');_0x112c59(_0x271b64[_0xb550('0x18')][_0xb550('0x17')]);}})['catch'](function(_0x2064b8){logger[_0xb550('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2ed21f,_0x2064b8);_0x317bea(_0x2064b8);});});}exports['CreateSmsMessage']=function(_0x501a48){var _0x4a922f=this;return new Promise(function(_0x10e707,_0xea978a){return db['SmsMessage']['create'](_0x501a48[_0xb550('0x19')],{'raw':_0x501a48[_0xb550('0x1a')]?_0x501a48[_0xb550('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb550('0x10')](function(_0x34dbdc){logger[_0xb550('0x11')](_0xb550('0x1b'),_0x501a48);logger[_0xb550('0x13')]('CreateSmsMessage',_0x501a48,JSON[_0xb550('0x1c')](_0x34dbdc));_0x10e707(_0x34dbdc);})[_0xb550('0x1d')](function(_0x553bcf){logger[_0xb550('0x14')]('CreateSmsMessage',_0x553bcf[_0xb550('0x17')],_0x501a48);_0xea978a(_0x4a922f[_0xb550('0x14')](0x1f4,_0x553bcf[_0xb550('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 99b8b94..f580e8d 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 _0x8dab=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x24dc5f,_0x2bd5e6){var _0x3cb769=function(_0x466d7f){while(--_0x466d7f){_0x24dc5f['push'](_0x24dc5f['shift']());}};_0x3cb769(++_0x2bd5e6);}(_0x8dab,0xea));var _0xb8da=function(_0x3e7b67,_0x2f6f3f){_0x3e7b67=_0x3e7b67-0x0;var _0x40de5f=_0x8dab[_0x3e7b67];return _0x40de5f;};'use strict';var SmsMessageEvents=require(_0xb8da('0x0'));var events=[_0xb8da('0x1'),_0xb8da('0x2'),_0xb8da('0x3')];function createListener(_0xa1d3e,_0x3cff07){return function(_0x488293){_0x3cff07[_0xb8da('0x4')](_0xa1d3e,_0x488293);};}function removeListener(_0x3f6054,_0x212364){return function(){SmsMessageEvents[_0xb8da('0x5')](_0x3f6054,_0x212364);};}exports[_0xb8da('0x6')]=function(_0x35f090){for(var _0x26901a=0x0,_0x285412=events[_0xb8da('0x7')];_0x26901a<_0x285412;_0x26901a++){var _0x1c7ec4=events[_0x26901a];var _0x3ad494=createListener(_0xb8da('0x8')+_0x1c7ec4,_0x35f090);SmsMessageEvents['on'](_0x1c7ec4,_0x3ad494);}}; \ No newline at end of file +var _0x9167=['smsMessage:','./smsMessage.events','remove','removeListener','length'];(function(_0x59d980,_0x1f2185){var _0x505478=function(_0x4c775a){while(--_0x4c775a){_0x59d980['push'](_0x59d980['shift']());}};_0x505478(++_0x1f2185);}(_0x9167,0x141));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x7916('0x0'));var events=['save',_0x7916('0x1'),'update'];function createListener(_0x4bdc51,_0x283594){return function(_0x8fc2c9){_0x283594['emit'](_0x4bdc51,_0x8fc2c9);};}function removeListener(_0x4155ac,_0x2e2a5c){return function(){SmsMessageEvents[_0x7916('0x2')](_0x4155ac,_0x2e2a5c);};}exports['register']=function(_0x31ca6e){for(var _0x270c89=0x0,_0x4210e0=events[_0x7916('0x3')];_0x270c89<_0x4210e0;_0x270c89++){var _0x5c3521=events[_0x270c89];var _0x12178f=createListener(_0x7916('0x4')+_0x5c3521,_0x31ca6e);SmsMessageEvents['on'](_0x5c3521,_0x12178f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e6d7246..365f82c 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 _0xa4dc=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers'];(function(_0x1476ba,_0x446421){var _0x5e7bc1=function(_0x4aa99c){while(--_0x4aa99c){_0x1476ba['push'](_0x1476ba['shift']());}};_0x5e7bc1(++_0x446421);}(_0xa4dc,0x16a));var _0xca4d=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xa4dc[_0x5a3cf0];return _0x5a64ee;};'use strict';var multer=require(_0xca4d('0x0'));var util=require(_0xca4d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca4d('0x2'));var router=express[_0xca4d('0x3')]();var auth=require(_0xca4d('0x4'));var interaction=require(_0xca4d('0x5'));var config=require(_0xca4d('0x6'));var controller=require('./smsQueue.controller');router[_0xca4d('0x7')]('/',auth[_0xca4d('0x8')](),controller[_0xca4d('0x9')]);router['get'](_0xca4d('0xa'),auth['isAuthenticated'](),controller[_0xca4d('0xb')]);router[_0xca4d('0x7')](_0xca4d('0xc'),auth[_0xca4d('0x8')](),controller['show']);router[_0xca4d('0x7')](_0xca4d('0xd'),auth['isAuthenticated'](),controller[_0xca4d('0xe')]);router['get'](_0xca4d('0xf'),auth[_0xca4d('0x8')](),controller[_0xca4d('0x10')]);router[_0xca4d('0x7')](_0xca4d('0x11'),auth[_0xca4d('0x8')](),controller[_0xca4d('0x12')]);router[_0xca4d('0x13')]('/',auth['isAuthenticated'](),controller[_0xca4d('0x14')]);router['post'](_0xca4d('0xf'),auth[_0xca4d('0x8')](),controller[_0xca4d('0x15')]);router['post'](_0xca4d('0x11'),auth['isAuthenticated'](),controller[_0xca4d('0x16')]);router[_0xca4d('0x17')](_0xca4d('0xc'),auth[_0xca4d('0x8')](),controller[_0xca4d('0x18')]);router[_0xca4d('0x19')](_0xca4d('0xc'),auth['isAuthenticated'](),controller[_0xca4d('0x1a')]);router[_0xca4d('0x19')](_0xca4d('0xf'),auth[_0xca4d('0x8')](),controller[_0xca4d('0x1b')]);router[_0xca4d('0x19')](_0xca4d('0x11'),auth[_0xca4d('0x8')](),controller[_0xca4d('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xe9ef=['isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','describe','/:id'];(function(_0x398b86,_0x2d0d59){var _0x1050bf=function(_0xd2a666){while(--_0xd2a666){_0x398b86['push'](_0x398b86['shift']());}};_0x1050bf(++_0x2d0d59);}(_0xe9ef,0x16e));var _0xfe9e=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xe9ef[_0xfc0976];return _0x23579f;};'use strict';var multer=require(_0xfe9e('0x0'));var util=require('util');var path=require(_0xfe9e('0x1'));var timeout=require(_0xfe9e('0x2'));var express=require('express');var router=express[_0xfe9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfe9e('0x4'));var config=require(_0xfe9e('0x5'));var controller=require(_0xfe9e('0x6'));router[_0xfe9e('0x7')]('/',auth['isAuthenticated'](),controller[_0xfe9e('0x8')]);router[_0xfe9e('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xfe9e('0x9')]);router['get'](_0xfe9e('0xa'),auth[_0xfe9e('0xb')](),controller[_0xfe9e('0xc')]);router['get'](_0xfe9e('0xd'),auth[_0xfe9e('0xb')](),controller[_0xfe9e('0xe')]);router['get'](_0xfe9e('0xf'),auth['isAuthenticated'](),controller[_0xfe9e('0x10')]);router[_0xfe9e('0x7')](_0xfe9e('0x11'),auth[_0xfe9e('0xb')](),controller[_0xfe9e('0x12')]);router[_0xfe9e('0x13')]('/',auth[_0xfe9e('0xb')](),controller[_0xfe9e('0x14')]);router[_0xfe9e('0x13')]('/:id/teams',auth[_0xfe9e('0xb')](),controller[_0xfe9e('0x15')]);router['post'](_0xfe9e('0x11'),auth[_0xfe9e('0xb')](),controller[_0xfe9e('0x16')]);router[_0xfe9e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xfe9e('0x18')]);router[_0xfe9e('0x19')](_0xfe9e('0xa'),auth[_0xfe9e('0xb')](),controller['destroy']);router[_0xfe9e('0x19')](_0xfe9e('0xf'),auth[_0xfe9e('0xb')](),controller[_0xfe9e('0x1a')]);router['delete'](_0xfe9e('0x11'),auth[_0xfe9e('0xb')](),controller[_0xfe9e('0x1b')]);module[_0xfe9e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f66e661..2f5028d 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 _0x740e=['rrmemory','beepall','roundrobin','sequelize','STRING','ENUM'];(function(_0x3177ca,_0xb98ca){var _0x4f2e70=function(_0x896110){while(--_0x896110){_0x3177ca['push'](_0x3177ca['shift']());}};_0x4f2e70(++_0xb98ca);}(_0x740e,0x1c5));var _0xe740=function(_0xdcaa65,_0x6c7082){_0xdcaa65=_0xdcaa65-0x0;var _0x11791c=_0x740e[_0xdcaa65];return _0x11791c;};'use strict';var Sequelize=require(_0xe740('0x0'));module['exports']={'name':{'type':Sequelize[_0xe740('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe740('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe740('0x2')](_0xe740('0x3'),_0xe740('0x4'),_0xe740('0x5'))}}; \ No newline at end of file +var _0x6a24=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x35a2c9,_0x2cf750){var _0x149857=function(_0x5310ce){while(--_0x5310ce){_0x35a2c9['push'](_0x35a2c9['shift']());}};_0x149857(++_0x2cf750);}(_0x6a24,0x86));var _0x46a2=function(_0x280c4f,_0x2dc89f){_0x280c4f=_0x280c4f-0x0;var _0xa4a273=_0x6a24[_0x280c4f];return _0xa4a273;};'use strict';var Sequelize=require(_0x46a2('0x0'));module[_0x46a2('0x1')]={'name':{'type':Sequelize[_0x46a2('0x2')],'unique':_0x46a2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x46a2('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46a2('0x4')](_0x46a2('0x5'),'beepall',_0x46a2('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f3af540..660a636 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 _0x98a8=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','value','isEmpty','removeAgents','addAgents','omit','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','./smsQueue.socket','register','status','json','offset','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','nolimit','limit','order','sort','pick','filter','where','merge','options','count','includeAll','include','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','fields','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','length','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit'];(function(_0x185fbf,_0x3d147f){var _0x169eef=function(_0x4f8a33){while(--_0x4f8a33){_0x185fbf['push'](_0x185fbf['shift']());}};_0x169eef(++_0x3d147f);}(_0x98a8,0x12c));var _0x898a=function(_0x281136,_0x1156f5){_0x281136=_0x281136-0x0;var _0x532b7a=_0x98a8[_0x281136];return _0x532b7a;};'use strict';var pdf=require(_0x898a('0x0'));var emlformat=require(_0x898a('0x1'));var rimraf=require(_0x898a('0x2'));var zipdir=require(_0x898a('0x3'));var jsonpatch=require(_0x898a('0x4'));var rp=require(_0x898a('0x5'));var moment=require(_0x898a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x898a('0x7'));var util=require(_0x898a('0x8'));var path=require(_0x898a('0x9'));var sox=require(_0x898a('0xa'));var csv=require(_0x898a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xb'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];config[_0x898a('0x19')]=_[_0x898a('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x898a('0x19')]));require(_0x898a('0x1b'))[_0x898a('0x1c')](socket);function respondWithStatusCode(_0x116fbe,_0x1873e9){_0x1873e9=_0x1873e9||0xcc;return function(_0x15177d){if(_0x15177d){return _0x116fbe['sendStatus'](_0x1873e9);}return _0x116fbe[_0x898a('0x1d')](_0x1873e9)['end']();};}function respondWithResult(_0x3fec7a,_0x5c96a6){_0x5c96a6=_0x5c96a6||0xc8;return function(_0x303321){if(_0x303321){return _0x3fec7a['status'](_0x5c96a6)[_0x898a('0x1e')](_0x303321);}};}function respondWithFilteredResult(_0x56f8f9,_0xee4408){return function(_0x3197f7){if(_0x3197f7){var _0x28cc63=_0x3197f7['count'],_0x4ddd4d=_0xee4408[_0x898a('0x1f')],_0x1faf4c=_0xee4408[_0x898a('0x1f')]+_0xee4408['limit'],_0x5960e0;if(_0x1faf4c>=_0x28cc63){_0x1faf4c=_0x28cc63;_0x5960e0=0xc8;}else{_0x5960e0=0xce;}_0x56f8f9['status'](_0x5960e0);return _0x56f8f9[_0x898a('0x20')](_0x898a('0x21'),_0x4ddd4d+'-'+_0x1faf4c+'/'+_0x28cc63)[_0x898a('0x1e')](_0x3197f7);}return null;};}function patchUpdates(_0x2917ff){return function(_0x2da52d){try{jsonpatch[_0x898a('0x22')](_0x2da52d,_0x2917ff,!![]);}catch(_0x259541){return BPromise['reject'](_0x259541);}return _0x2da52d[_0x898a('0x23')]();};}function saveUpdates(_0x50718e,_0x11cae2){return function(_0x3cfd9c){if(_0x3cfd9c){return _0x3cfd9c[_0x898a('0x24')](_0x50718e)[_0x898a('0x25')](function(_0x4e254d){return _0x4e254d;});}return null;};}function removeEntity(_0x274cdf,_0x16c318){return function(_0x85d383){if(_0x85d383){return _0x85d383[_0x898a('0x26')]()[_0x898a('0x25')](function(){var _0x1426e3=_0x85d383['get']({'plain':!![]});var _0x20bde0='SmsQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x20bde0,'resourceId':_0x1426e3['id']}})[_0x898a('0x25')](function(){return _0x85d383;});})[_0x898a('0x25')](function(){_0x274cdf[_0x898a('0x1d')](0xcc)[_0x898a('0x27')]();});}};}function handleEntityNotFound(_0x28ae6a,_0x2efde2){return function(_0x398e98){if(!_0x398e98){_0x28ae6a[_0x898a('0x28')](0x194);}return _0x398e98;};}function handleError(_0xd31922,_0x58149d){_0x58149d=_0x58149d||0x1f4;return function(_0x4b3e68){logger['error'](_0x4b3e68[_0x898a('0x29')]);if(_0x4b3e68[_0x898a('0x2a')]){delete _0x4b3e68[_0x898a('0x2a')];}_0xd31922[_0x898a('0x1d')](_0x58149d)[_0x898a('0x2b')](_0x4b3e68);};}exports[_0x898a('0x2c')]=function(_0xe3c983,_0xf74645){var _0x18773a={},_0x4287da={},_0x44c5d2={'count':0x0,'rows':[]};var _0x194d74=_['map'](db[_0x898a('0x2d')][_0x898a('0x2e')],function(_0x26eead){return{'name':_0x26eead[_0x898a('0x2f')],'type':_0x26eead[_0x898a('0x30')]['key']};});_0x4287da['model']=_[_0x898a('0x31')](_0x194d74,_0x898a('0x2a'));_0x4287da[_0x898a('0x32')]=_['keys'](_0xe3c983[_0x898a('0x32')]);_0x4287da[_0x898a('0x33')]=_[_0x898a('0x34')](_0x4287da[_0x898a('0x35')],_0x4287da[_0x898a('0x32')]);_0x18773a[_0x898a('0x36')]=_[_0x898a('0x34')](_0x4287da[_0x898a('0x35')],qs['fields'](_0xe3c983[_0x898a('0x32')]['fields']));_0x18773a['attributes']=_0x18773a[_0x898a('0x36')]['length']?_0x18773a[_0x898a('0x36')]:_0x4287da['model'];if(!_0xe3c983[_0x898a('0x32')]['hasOwnProperty'](_0x898a('0x37'))){_0x18773a[_0x898a('0x38')]=qs[_0x898a('0x38')](_0xe3c983['query']['limit']);_0x18773a['offset']=qs[_0x898a('0x1f')](_0xe3c983[_0x898a('0x32')]['offset']);}_0x18773a[_0x898a('0x39')]=qs[_0x898a('0x3a')](_0xe3c983[_0x898a('0x32')][_0x898a('0x3a')]);_0x18773a['where']=qs['filters'](_[_0x898a('0x3b')](_0xe3c983[_0x898a('0x32')],_0x4287da['filters']),_0x194d74);if(_0xe3c983['query'][_0x898a('0x3c')]){_0x18773a[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0x18773a[_0x898a('0x3d')],{'$or':_['map'](_0x194d74,function(_0x67114b){if(_0x67114b[_0x898a('0x30')]!=='VIRTUAL'){var _0x516b8c={};_0x516b8c[_0x67114b['name']]={'$like':'%'+_0xe3c983[_0x898a('0x32')][_0x898a('0x3c')]+'%'};return _0x516b8c;}})});}_0x18773a=_[_0x898a('0x3e')]({},_0x18773a,_0xe3c983[_0x898a('0x3f')]);var _0x20a6eb={'where':_0x18773a[_0x898a('0x3d')]};return db[_0x898a('0x2d')][_0x898a('0x40')](_0x20a6eb)[_0x898a('0x25')](function(_0x235fcf){_0x44c5d2[_0x898a('0x40')]=_0x235fcf;if(_0xe3c983[_0x898a('0x32')][_0x898a('0x41')]){_0x18773a[_0x898a('0x42')]=[{'all':!![]}];}return db[_0x898a('0x2d')]['findAll'](_0x18773a);})[_0x898a('0x25')](function(_0x11c437){_0x44c5d2[_0x898a('0x43')]=_0x11c437;return _0x44c5d2;})['then'](respondWithFilteredResult(_0xf74645,_0x18773a))[_0x898a('0x44')](handleError(_0xf74645,null));};exports[_0x898a('0x45')]=function(_0x3a8663,_0x6ab441){var _0x2cd3c5={'raw':!![],'where':{'id':_0x3a8663[_0x898a('0x46')]['id']}},_0x477e2e={};_0x477e2e[_0x898a('0x35')]=_['keys'](db[_0x898a('0x2d')][_0x898a('0x2e')]);_0x477e2e[_0x898a('0x32')]=_[_0x898a('0x47')](_0x3a8663['query']);_0x477e2e[_0x898a('0x33')]=_[_0x898a('0x34')](_0x477e2e['model'],_0x477e2e[_0x898a('0x32')]);_0x2cd3c5['attributes']=_[_0x898a('0x34')](_0x477e2e['model'],qs['fields'](_0x3a8663[_0x898a('0x32')]['fields']));_0x2cd3c5[_0x898a('0x36')]=_0x2cd3c5[_0x898a('0x36')]['length']?_0x2cd3c5[_0x898a('0x36')]:_0x477e2e[_0x898a('0x35')];if(_0x3a8663['query'][_0x898a('0x41')]){_0x2cd3c5[_0x898a('0x42')]=[{'all':!![]}];}_0x2cd3c5=_[_0x898a('0x3e')]({},_0x2cd3c5,_0x3a8663[_0x898a('0x3f')]);return db['SmsQueue'][_0x898a('0x48')](_0x2cd3c5)[_0x898a('0x25')](handleEntityNotFound(_0x6ab441,null))['then'](respondWithResult(_0x6ab441,null))[_0x898a('0x44')](handleError(_0x6ab441,null));};exports[_0x898a('0x49')]=function(_0x4ab441,_0x28525b){return db['SmsQueue'][_0x898a('0x49')](_0x4ab441[_0x898a('0x4a')],{})[_0x898a('0x25')](function(_0x50f9e3){var _0x2f6cb3=_0x4ab441[_0x898a('0x4b')][_0x898a('0x4c')]({'plain':!![]});if(!_0x2f6cb3)throw new Error(_0x898a('0x4d'));if(_0x2f6cb3['role']===_0x898a('0x4b')){var _0x529d7c=_0x50f9e3[_0x898a('0x4c')]({'plain':!![]});var _0x2feb38=_0x898a('0x4e');return db['UserProfileSection'][_0x898a('0x48')]({'where':{'name':_0x2feb38,'userProfileId':_0x2f6cb3[_0x898a('0x4f')]},'raw':!![]})[_0x898a('0x25')](function(_0x5d325a){if(_0x5d325a&&_0x5d325a['autoAssociation']===0x0){return db[_0x898a('0x50')][_0x898a('0x49')]({'name':_0x529d7c[_0x898a('0x2a')],'resourceId':_0x529d7c['id'],'type':_0x5d325a[_0x898a('0x2a')],'sectionId':_0x5d325a['id']},{})[_0x898a('0x25')](function(){return _0x50f9e3;});}else{return _0x50f9e3;}})[_0x898a('0x44')](function(_0x369f33){logger[_0x898a('0x51')](_0x898a('0x52'),_0x369f33);throw _0x369f33;});}return _0x50f9e3;})[_0x898a('0x25')](respondWithResult(_0x28525b,0xc9))[_0x898a('0x44')](handleError(_0x28525b,null));};exports['update']=function(_0x345e19,_0x356c84){if(_0x345e19['body']['id']){delete _0x345e19[_0x898a('0x4a')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x345e19[_0x898a('0x46')]['id']}})[_0x898a('0x25')](handleEntityNotFound(_0x356c84,null))[_0x898a('0x25')](saveUpdates(_0x345e19['body'],null))['then'](respondWithResult(_0x356c84,null))[_0x898a('0x44')](handleError(_0x356c84,null));};exports[_0x898a('0x26')]=function(_0x515725,_0xaa96f7){return db[_0x898a('0x2d')]['find']({'where':{'id':_0x515725[_0x898a('0x46')]['id']}})[_0x898a('0x25')](handleEntityNotFound(_0xaa96f7,null))[_0x898a('0x25')](removeEntity(_0xaa96f7,null))['catch'](handleError(_0xaa96f7,null));};exports[_0x898a('0x53')]=function(_0x2ef2f1,_0x9c25ee){return db[_0x898a('0x2d')][_0x898a('0x53')]()[_0x898a('0x25')](respondWithResult(_0x9c25ee,null))['catch'](handleError(_0x9c25ee,null));};exports[_0x898a('0x54')]=function(_0x4df5f0,_0x253f51,_0x1dc177){var _0x15b203={'raw':!![],'where':{}},_0x43780e={},_0x46f0b8;return db[_0x898a('0x2d')][_0x898a('0x55')]({'where':{'id':_0x4df5f0[_0x898a('0x46')]['id']}})[_0x898a('0x25')](handleEntityNotFound(_0x253f51,null))['then'](function(_0xd558e1){if(_0xd558e1){_0x46f0b8=_0xd558e1[_0x898a('0x4c')]({'plain':!![]});_0x43780e[_0x898a('0x35')]=_[_0x898a('0x47')](db[_0x898a('0x56')][_0x898a('0x2e')]);_0x43780e[_0x898a('0x32')]=_[_0x898a('0x47')](_0x4df5f0[_0x898a('0x32')]);_0x43780e[_0x898a('0x33')]=_[_0x898a('0x34')](_0x43780e[_0x898a('0x35')],_0x43780e[_0x898a('0x32')]);_0x15b203[_0x898a('0x36')]=_[_0x898a('0x34')](_0x43780e['model'],qs[_0x898a('0x57')](_0x4df5f0[_0x898a('0x32')]['fields']));_0x15b203[_0x898a('0x36')]=_0x15b203[_0x898a('0x36')]['length']?_0x15b203[_0x898a('0x36')]:_0x43780e[_0x898a('0x35')];if(!_0x4df5f0[_0x898a('0x32')][_0x898a('0x58')]('nolimit')){_0x15b203[_0x898a('0x38')]=qs[_0x898a('0x38')](_0x4df5f0[_0x898a('0x32')][_0x898a('0x38')]);_0x15b203['offset']=qs[_0x898a('0x1f')](_0x4df5f0[_0x898a('0x32')]['offset']);}_0x15b203[_0x898a('0x39')]=qs[_0x898a('0x3a')](_0x4df5f0['query'][_0x898a('0x3a')]);_0x15b203['where']=qs[_0x898a('0x33')](_['pick'](_0x4df5f0['query'],_0x43780e['filters']));_0x15b203[_0x898a('0x3d')][_0x898a('0x59')]=_0xd558e1['id'];if(_0x4df5f0[_0x898a('0x32')][_0x898a('0x3c')]){_0x15b203['where']=_['merge'](_0x15b203[_0x898a('0x3d')],{'$or':_[_0x898a('0x31')](_0x15b203[_0x898a('0x36')],function(_0x5dc44e){var _0x3d9966={};_0x3d9966[_0x5dc44e]={'$like':'%'+_0x4df5f0[_0x898a('0x32')][_0x898a('0x3c')]+'%'};return _0x3d9966;})});}_0x15b203=_[_0x898a('0x3e')]({},_0x15b203,_0x4df5f0['options']);return db[_0x898a('0x56')][_0x898a('0x5a')](_0x15b203);}})['then'](function(_0x42fda8){if(_0x42fda8){return db[_0x898a('0x5b')][_0x898a('0x5c')]({'where':{'id':_[_0x898a('0x31')](_0x42fda8,_0x898a('0x5d')),'role':_0x898a('0x5e')},'attributes':['id',_0x898a('0x2a'),_0x898a('0x5f'),_0x898a('0x60'),_0x898a('0x61')]});}})[_0x898a('0x25')](function(_0x307849){if(_0x307849){return{'count':_0x307849[_0x898a('0x40')],'rows':_['map'](_0x307849[_0x898a('0x43')],function(_0x554cb7){return{'membername':_0x554cb7[_0x898a('0x2a')],'UserId':_0x554cb7['id'],'queue_name':_0x46f0b8[_0x898a('0x2a')],'SmsQueueId':_0x46f0b8['id'],'interface':util[_0x898a('0x62')]('%s/%s',_0x898a('0x63'),_0x554cb7[_0x898a('0x2a')]),'penalty':0x0,'paused':_0x554cb7[_0x898a('0x5f')],'createdAt':_0x554cb7[_0x898a('0x61')],'updatedAt':_0x554cb7[_0x898a('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x253f51,_0x15b203))[_0x898a('0x44')](handleError(_0x253f51,null));};exports[_0x898a('0x64')]=function(_0x37b1d0,_0x3f3aa0,_0xc1c3fe){var _0x4ba378={};var _0x119d67={};var _0x3d3451;var _0x474029;return db[_0x898a('0x2d')][_0x898a('0x55')]({'where':{'id':_0x37b1d0[_0x898a('0x46')]['id']}})[_0x898a('0x25')](handleEntityNotFound(_0x3f3aa0,null))[_0x898a('0x25')](function(_0x51836c){if(_0x51836c){_0x3d3451=_0x51836c;_0x119d67[_0x898a('0x35')]=_[_0x898a('0x47')](db['Team'][_0x898a('0x2e')]);_0x119d67['query']=_[_0x898a('0x47')](_0x37b1d0['query']);_0x119d67[_0x898a('0x33')]=_[_0x898a('0x34')](_0x119d67[_0x898a('0x35')],_0x119d67[_0x898a('0x32')]);_0x4ba378[_0x898a('0x36')]=_[_0x898a('0x34')](_0x119d67[_0x898a('0x35')],qs[_0x898a('0x57')](_0x37b1d0[_0x898a('0x32')]['fields']));_0x4ba378[_0x898a('0x36')]=_0x4ba378[_0x898a('0x36')][_0x898a('0x65')]?_0x4ba378[_0x898a('0x36')]:_0x119d67[_0x898a('0x35')];_0x4ba378[_0x898a('0x39')]=qs[_0x898a('0x3a')](_0x37b1d0[_0x898a('0x32')][_0x898a('0x3a')]);_0x4ba378[_0x898a('0x3d')]=qs['filters'](_['pick'](_0x37b1d0[_0x898a('0x32')],_0x119d67[_0x898a('0x33')]));if(_0x37b1d0['query']['filter']){_0x4ba378[_0x898a('0x3d')]=_['merge'](_0x4ba378[_0x898a('0x3d')],{'$or':_[_0x898a('0x31')](_0x4ba378['attributes'],function(_0x3f6815){var _0x1c782e={};_0x1c782e[_0x3f6815]={'$like':'%'+_0x37b1d0[_0x898a('0x32')][_0x898a('0x3c')]+'%'};return _0x1c782e;})});}_0x4ba378=_[_0x898a('0x3e')]({},_0x4ba378,_0x37b1d0[_0x898a('0x3f')]);return _0x3d3451[_0x898a('0x64')](_0x4ba378);}})['then'](function(_0x3237e8){if(_0x3237e8){_0x474029=_0x3237e8[_0x898a('0x65')];if(!_0x37b1d0[_0x898a('0x32')]['hasOwnProperty'](_0x898a('0x37'))){_0x4ba378[_0x898a('0x38')]=qs['limit'](_0x37b1d0[_0x898a('0x32')]['limit']);_0x4ba378['offset']=qs['offset'](_0x37b1d0[_0x898a('0x32')][_0x898a('0x1f')]);}return _0x3d3451[_0x898a('0x64')](_0x4ba378);}})[_0x898a('0x25')](function(_0x3feee3){if(_0x3feee3){return _0x3feee3?{'count':_0x474029,'rows':_0x3feee3}:null;}})[_0x898a('0x25')](respondWithResult(_0x3f3aa0,null))[_0x898a('0x44')](handleError(_0x3f3aa0,null));};exports['addTeams']=function(_0xe6ac74,_0x4f29b6,_0x456288){var _0x3da2c1=_0xe6ac74['body'][_0x898a('0x66')];return db[_0x898a('0x67')][_0x898a('0x5a')]({'where':{'id':_0x3da2c1},'attributes':['id'],'include':[{'model':db[_0x898a('0x5b')],'as':_0x898a('0x68'),'attributes':['id','name','online','voicePause',_0x898a('0x69')],'raw':!![]}]})[_0x898a('0x25')](function(_0x18caad){if(_0x18caad){var _0x5c2243=_[_0x898a('0x6a')](_0x18caad,function(_0x53a80d){var _0x5c0aed=_0x53a80d[_0x898a('0x4c')]({'plain':!![]});return _0x5c0aed[_0x898a('0x68')];});return db[_0x898a('0x2d')][_0x898a('0x48')]({'where':{'id':_0xe6ac74[_0x898a('0x46')]['id']}})[_0x898a('0x25')](function(_0x227210){return db[_0x898a('0x6b')][_0x898a('0x6c')](function(_0x1414ec){return _0x227210[_0x898a('0x6d')](_0x3da2c1,{'transaction':_0x1414ec})[_0x898a('0x25')](function(){return BPromise[_0x898a('0x6e')](_0x5c2243,function(_0x26ffcc){return db[_0x898a('0x56')][_0x898a('0x6f')]({'where':{'UserId':_0x26ffcc['id'],'SmsQueueId':_0xe6ac74['params']['id']},'transaction':_0x1414ec});});})[_0x898a('0x25')](function(){_0x5c2243[_0x898a('0x70')](function(_0x310a8c){socket[_0x898a('0x71')](_0x898a('0x72'),{'UserId':_0x310a8c['id'],'SmsQueueId':_0x227210['id']});});});});});}})[_0x898a('0x25')](respondWithStatusCode(_0x4f29b6,null))[_0x898a('0x44')](handleError(_0x4f29b6,null));};exports[_0x898a('0x73')]=function(_0x20639a,_0x427eff,_0x3ba9dc){return db[_0x898a('0x67')]['findAll']({'where':{'id':_0x20639a[_0x898a('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x898a('0x5b')],'as':_0x898a('0x68'),'attributes':['id'],'raw':!![]}]})[_0x898a('0x25')](handleEntityNotFound(_0x427eff,null))['then'](function(_0x30e42f){var _0x223775=_['map'](_0x30e42f,'id');var _0x169e55=[];var _0x3ebb81=[];var _0x16c7bc=squel[_0x898a('0x74')]();_0x16c7bc[_0x898a('0x75')](_0x898a('0x76'))['from']('team_has_sms_queues','tq')[_0x898a('0x77')]('user_has_teams','ut',_0x898a('0x78'))[_0x898a('0x3d')](_0x898a('0x79'),_0x20639a[_0x898a('0x46')]['id']);for(var _0x13b3f9=0x0;_0x13b3f9<_0x30e42f[_0x898a('0x65')];_0x13b3f9+=0x1){let _0x500b3c=_0x30e42f[_0x13b3f9];for(var _0x4d7431=0x0;_0x4d7431<_0x500b3c[_0x898a('0x68')]['length'];_0x4d7431+=0x1){let _0x37a963=_0x500b3c[_0x898a('0x68')][_0x4d7431];var _0x57b50d=_0x16c7bc[_0x898a('0x7a')]();_0x57b50d['where'](_0x898a('0x7b'),_0x37a963['id']);_0x3ebb81[_0x898a('0x7c')](db[_0x898a('0x6b')]['query'](_0x57b50d['toString'](),{'type':db['sequelize'][_0x898a('0x7d')][_0x898a('0x7e')]})[_0x898a('0x25')](function(_0x93f959){if(_0x93f959[_0x898a('0x65')]===0x1){return _0x37a963['id'];}else{var _0x1c989f=_['every'](_[_0x898a('0x31')](_0x93f959,_0x898a('0x7f')),function(_0x5677fe){return _['includes'](_0x223775,_0x5677fe);});if(_0x1c989f){return _0x37a963['id'];}}}));}}return BPromise[_0x898a('0x80')](_0x3ebb81)[_0x898a('0x25')](function(_0x47e557){_0x169e55=_(_0x169e55)[_0x898a('0x81')](_0x47e557)['compact']()[_0x898a('0x82')]();return db[_0x898a('0x2d')][_0x898a('0x48')]({'where':{'id':_0x20639a[_0x898a('0x46')]['id']}})[_0x898a('0x25')](function(_0x1d8078){return db[_0x898a('0x6b')][_0x898a('0x6c')](function(_0x154172){return _0x1d8078[_0x898a('0x73')](_0x20639a[_0x898a('0x32')][_0x898a('0x66')],{'transaction':_0x154172})[_0x898a('0x25')](function(){if(!_[_0x898a('0x83')](_0x169e55)){return _0x1d8078[_0x898a('0x84')](_0x169e55,{'transaction':_0x154172});}})['then'](function(){_0x169e55['forEach'](function(_0x56da5f){socket[_0x898a('0x71')]('userSmsQueue:remove',{'UserId':_0x56da5f,'SmsQueueId':_0x1d8078['id']});});});});});});})[_0x898a('0x25')](respondWithStatusCode(_0x427eff,null))[_0x898a('0x44')](handleError(_0x427eff,null));};exports[_0x898a('0x85')]=function(_0x1d1ad9,_0x29b86f,_0x3899db){return db[_0x898a('0x2d')][_0x898a('0x48')]({'where':{'id':_0x1d1ad9['params']['id']}})[_0x898a('0x25')](handleEntityNotFound(_0x29b86f,null))['then'](function(_0x4a73f7){if(_0x4a73f7){return _0x4a73f7['addAgents'](_0x1d1ad9[_0x898a('0x4a')]['ids'],_[_0x898a('0x86')](_0x1d1ad9[_0x898a('0x4a')],[_0x898a('0x66'),'id'])||{})['spread'](function(_0x49e0ad){for(var _0x26ba1f=0x0;_0x26ba1f<_0x1d1ad9[_0x898a('0x4a')][_0x898a('0x66')][_0x898a('0x65')];_0x26ba1f+=0x1){socket[_0x898a('0x71')](_0x898a('0x72'),{'UserId':_0x1d1ad9[_0x898a('0x4a')][_0x898a('0x66')][_0x26ba1f],'SmsQueueId':_0x1d1ad9[_0x898a('0x46')]['id']});}return _0x49e0ad;});}})['then'](respondWithResult(_0x29b86f,null))[_0x898a('0x44')](handleError(_0x29b86f,null));};exports[_0x898a('0x84')]=function(_0x490640,_0x41cf99,_0x745781){return db[_0x898a('0x2d')][_0x898a('0x48')]({'where':{'id':_0x490640[_0x898a('0x46')]['id']}})['then'](handleEntityNotFound(_0x41cf99,null))[_0x898a('0x25')](function(_0x406347){if(_0x406347){return _0x406347[_0x898a('0x84')](_0x490640[_0x898a('0x32')]['ids'])['then'](function(){if(_[_0x898a('0x87')](_0x490640['query'][_0x898a('0x66')])){for(var _0x1a3c92=0x0;_0x1a3c92<_0x490640[_0x898a('0x32')][_0x898a('0x66')][_0x898a('0x65')];_0x1a3c92+=0x1){socket[_0x898a('0x71')](_0x898a('0x88'),{'UserId':Number(_0x490640['query'][_0x898a('0x66')][_0x1a3c92]),'SmsQueueId':Number(_0x490640['params']['id'])});}}else{socket[_0x898a('0x71')](_0x898a('0x88'),{'UserId':Number(_0x490640['query'][_0x898a('0x66')]),'SmsQueueId':Number(_0x490640[_0x898a('0x46')]['id'])});}});}})[_0x898a('0x25')](respondWithStatusCode(_0x41cf99,null))[_0x898a('0x44')](handleError(_0x41cf99,null));};exports[_0x898a('0x89')]=function(_0x31b05a,_0x1faaef,_0x4bd6f4){var _0x114727={};var _0x35ba13={};var _0x18d10d;var _0xea0f98;return db[_0x898a('0x2d')][_0x898a('0x55')]({'where':{'id':_0x31b05a[_0x898a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1faaef,null))[_0x898a('0x25')](function(_0x93dce5){if(_0x93dce5){_0x18d10d=_0x93dce5;_0x35ba13['model']=_['keys'](db[_0x898a('0x5b')]['rawAttributes']);_0x35ba13[_0x898a('0x32')]=_[_0x898a('0x47')](_0x31b05a[_0x898a('0x32')]);_0x35ba13['filters']=_[_0x898a('0x34')](_0x35ba13[_0x898a('0x35')],_0x35ba13[_0x898a('0x32')]);_0x114727[_0x898a('0x36')]=_[_0x898a('0x34')](_0x35ba13[_0x898a('0x35')],qs[_0x898a('0x57')](_0x31b05a[_0x898a('0x32')][_0x898a('0x57')]));_0x114727[_0x898a('0x36')]=_0x114727['attributes'][_0x898a('0x65')]?_0x114727[_0x898a('0x36')]:_0x35ba13[_0x898a('0x35')];_0x114727[_0x898a('0x39')]=qs[_0x898a('0x3a')](_0x31b05a[_0x898a('0x32')][_0x898a('0x3a')]);_0x114727['where']=qs['filters'](_[_0x898a('0x3b')](_0x31b05a[_0x898a('0x32')],_0x35ba13['filters']));if(_0x31b05a[_0x898a('0x32')]['filter']){_0x114727[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0x114727['where'],{'$or':_[_0x898a('0x31')](_0x114727[_0x898a('0x36')],function(_0x160e0a){var _0x4d30ac={};_0x4d30ac[_0x160e0a]={'$like':'%'+_0x31b05a['query']['filter']+'%'};return _0x4d30ac;})});}_0x114727=_[_0x898a('0x3e')]({},_0x114727,_0x31b05a[_0x898a('0x3f')]);return _0x18d10d['getAgents'](_0x114727);}})[_0x898a('0x25')](function(_0x4a9c3b){if(_0x4a9c3b){_0xea0f98=_0x4a9c3b[_0x898a('0x65')];if(!_0x31b05a[_0x898a('0x32')][_0x898a('0x58')](_0x898a('0x37'))){_0x114727[_0x898a('0x38')]=qs[_0x898a('0x38')](_0x31b05a[_0x898a('0x32')][_0x898a('0x38')]);_0x114727[_0x898a('0x1f')]=qs[_0x898a('0x1f')](_0x31b05a[_0x898a('0x32')][_0x898a('0x1f')]);}return _0x18d10d[_0x898a('0x89')](_0x114727);}})['then'](function(_0x57a879){if(_0x57a879){return _0x57a879?{'count':_0xea0f98,'rows':_0x57a879}:null;}})[_0x898a('0x25')](respondWithResult(_0x1faaef,null))[_0x898a('0x44')](handleError(_0x1faaef,null));}; \ No newline at end of file +var _0xf873=['%s/%s','smsPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','includes','all','union','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','SmsQueues','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','SmsQueueId','UserSmsQueue','User','UserId','agent','updatedAt','createdAt'];(function(_0x88748f,_0x1f7077){var _0x19f11f=function(_0x13cb7b){while(--_0x13cb7b){_0x88748f['push'](_0x88748f['shift']());}};_0x19f11f(++_0x1f7077);}(_0xf873,0xb2));var _0x3f87=function(_0x4b976,_0x136fff){_0x4b976=_0x4b976-0x0;var _0x3d25a8=_0xf873[_0x4b976];return _0x3d25a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f87('0x0'));var rimraf=require(_0x3f87('0x1'));var zipdir=require(_0x3f87('0x2'));var jsonpatch=require(_0x3f87('0x3'));var rp=require(_0x3f87('0x4'));var moment=require(_0x3f87('0x5'));var BPromise=require(_0x3f87('0x6'));var Mustache=require(_0x3f87('0x7'));var util=require(_0x3f87('0x8'));var path=require('path');var sox=require(_0x3f87('0x9'));var csv=require(_0x3f87('0xa'));var ejs=require(_0x3f87('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f87('0xc'));var crypto=require(_0x3f87('0xd'));var jsforce=require(_0x3f87('0xe'));var deskjs=require(_0x3f87('0xf'));var toCsv=require(_0x3f87('0xa'));var querystring=require(_0x3f87('0x10'));var Papa=require('papaparse');var Redis=require(_0x3f87('0x11'));var authService=require(_0x3f87('0x12'));var qs=require(_0x3f87('0x13'));var as=require(_0x3f87('0x14'));var hardwareService=require(_0x3f87('0x15'));var logger=require(_0x3f87('0x16'))(_0x3f87('0x17'));var utils=require(_0x3f87('0x18'));var config=require(_0x3f87('0x19'));var licenseUtil=require(_0x3f87('0x1a'));var db=require(_0x3f87('0x1b'))['db'];config[_0x3f87('0x1c')]=_[_0x3f87('0x1d')](config[_0x3f87('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f87('0x1e'))(new Redis(config[_0x3f87('0x1c')]));require('./smsQueue.socket')[_0x3f87('0x1f')](socket);function respondWithStatusCode(_0x14324f,_0xabd141){_0xabd141=_0xabd141||0xcc;return function(_0x28cb47){if(_0x28cb47){return _0x14324f[_0x3f87('0x20')](_0xabd141);}return _0x14324f[_0x3f87('0x21')](_0xabd141)[_0x3f87('0x22')]();};}function respondWithResult(_0x2ccf4d,_0x5f0b2b){_0x5f0b2b=_0x5f0b2b||0xc8;return function(_0x6d1455){if(_0x6d1455){return _0x2ccf4d[_0x3f87('0x21')](_0x5f0b2b)[_0x3f87('0x23')](_0x6d1455);}};}function respondWithFilteredResult(_0x4e1df8,_0x3c6fbe){return function(_0x56d79e){if(_0x56d79e){var _0x190d7d=_0x56d79e[_0x3f87('0x24')],_0x13550c=_0x3c6fbe['offset'],_0x285b2c=_0x3c6fbe[_0x3f87('0x25')]+_0x3c6fbe[_0x3f87('0x26')],_0x279eba;if(_0x285b2c>=_0x190d7d){_0x285b2c=_0x190d7d;_0x279eba=0xc8;}else{_0x279eba=0xce;}_0x4e1df8[_0x3f87('0x21')](_0x279eba);return _0x4e1df8[_0x3f87('0x27')]('Content-Range',_0x13550c+'-'+_0x285b2c+'/'+_0x190d7d)['json'](_0x56d79e);}return null;};}function patchUpdates(_0x507c43){return function(_0x73aba6){try{jsonpatch[_0x3f87('0x28')](_0x73aba6,_0x507c43,!![]);}catch(_0x322cd5){return BPromise['reject'](_0x322cd5);}return _0x73aba6[_0x3f87('0x29')]();};}function saveUpdates(_0xb01673,_0x1b2f4a){return function(_0x8fe4fa){if(_0x8fe4fa){return _0x8fe4fa[_0x3f87('0x2a')](_0xb01673)[_0x3f87('0x2b')](function(_0x30b061){return _0x30b061;});}return null;};}function removeEntity(_0xea7dda,_0x197ff4){return function(_0x40bd51){if(_0x40bd51){return _0x40bd51[_0x3f87('0x2c')]()[_0x3f87('0x2b')](function(){var _0x5ca13a=_0x40bd51[_0x3f87('0x2d')]({'plain':!![]});var _0x9ed827=_0x3f87('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x9ed827,'resourceId':_0x5ca13a['id']}})[_0x3f87('0x2b')](function(){return _0x40bd51;});})[_0x3f87('0x2b')](function(){_0xea7dda[_0x3f87('0x21')](0xcc)[_0x3f87('0x22')]();});}};}function handleEntityNotFound(_0xcbb2b1,_0x148d8e){return function(_0x371d91){if(!_0x371d91){_0xcbb2b1[_0x3f87('0x20')](0x194);}return _0x371d91;};}function handleError(_0x113e40,_0x2e18cb){_0x2e18cb=_0x2e18cb||0x1f4;return function(_0x43576d){logger[_0x3f87('0x2f')](_0x43576d[_0x3f87('0x30')]);if(_0x43576d[_0x3f87('0x31')]){delete _0x43576d[_0x3f87('0x31')];}_0x113e40[_0x3f87('0x21')](_0x2e18cb)['send'](_0x43576d);};}exports[_0x3f87('0x32')]=function(_0x29a77f,_0x2546d2){var _0x2f0f05={},_0x5495ed={},_0x5c6082={'count':0x0,'rows':[]};var _0x55d4d0=_[_0x3f87('0x33')](db[_0x3f87('0x34')][_0x3f87('0x35')],function(_0x1d731a){return{'name':_0x1d731a[_0x3f87('0x36')],'type':_0x1d731a['type'][_0x3f87('0x37')]};});_0x5495ed['model']=_[_0x3f87('0x33')](_0x55d4d0,_0x3f87('0x31'));_0x5495ed[_0x3f87('0x38')]=_[_0x3f87('0x39')](_0x29a77f[_0x3f87('0x38')]);_0x5495ed[_0x3f87('0x3a')]=_[_0x3f87('0x3b')](_0x5495ed['model'],_0x5495ed['query']);_0x2f0f05[_0x3f87('0x3c')]=_[_0x3f87('0x3b')](_0x5495ed[_0x3f87('0x3d')],qs[_0x3f87('0x3e')](_0x29a77f[_0x3f87('0x38')][_0x3f87('0x3e')]));_0x2f0f05[_0x3f87('0x3c')]=_0x2f0f05['attributes'][_0x3f87('0x3f')]?_0x2f0f05['attributes']:_0x5495ed[_0x3f87('0x3d')];if(!_0x29a77f[_0x3f87('0x38')][_0x3f87('0x40')](_0x3f87('0x41'))){_0x2f0f05['limit']=qs[_0x3f87('0x26')](_0x29a77f['query'][_0x3f87('0x26')]);_0x2f0f05[_0x3f87('0x25')]=qs[_0x3f87('0x25')](_0x29a77f[_0x3f87('0x38')][_0x3f87('0x25')]);}_0x2f0f05['order']=qs['sort'](_0x29a77f['query'][_0x3f87('0x42')]);_0x2f0f05[_0x3f87('0x43')]=qs[_0x3f87('0x3a')](_[_0x3f87('0x44')](_0x29a77f[_0x3f87('0x38')],_0x5495ed[_0x3f87('0x3a')]),_0x55d4d0);if(_0x29a77f['query'][_0x3f87('0x45')]){_0x2f0f05['where']=_[_0x3f87('0x46')](_0x2f0f05[_0x3f87('0x43')],{'$or':_['map'](_0x55d4d0,function(_0x456b22){if(_0x456b22[_0x3f87('0x47')]!==_0x3f87('0x48')){var _0x49d3d8={};_0x49d3d8[_0x456b22[_0x3f87('0x31')]]={'$like':'%'+_0x29a77f['query']['filter']+'%'};return _0x49d3d8;}})});}_0x2f0f05=_[_0x3f87('0x46')]({},_0x2f0f05,_0x29a77f[_0x3f87('0x49')]);var _0x2123be={'where':_0x2f0f05[_0x3f87('0x43')]};return db[_0x3f87('0x34')]['count'](_0x2123be)[_0x3f87('0x2b')](function(_0x14ac14){_0x5c6082[_0x3f87('0x24')]=_0x14ac14;if(_0x29a77f[_0x3f87('0x38')]['includeAll']){_0x2f0f05[_0x3f87('0x4a')]=[{'all':!![]}];}return db[_0x3f87('0x34')][_0x3f87('0x4b')](_0x2f0f05);})[_0x3f87('0x2b')](function(_0x1fc2c2){_0x5c6082[_0x3f87('0x4c')]=_0x1fc2c2;return _0x5c6082;})[_0x3f87('0x2b')](respondWithFilteredResult(_0x2546d2,_0x2f0f05))[_0x3f87('0x4d')](handleError(_0x2546d2,null));};exports['show']=function(_0x4b7dbb,_0x59bdd3){var _0x2a234={'raw':!![],'where':{'id':_0x4b7dbb[_0x3f87('0x4e')]['id']}},_0x29cb50={};_0x29cb50[_0x3f87('0x3d')]=_[_0x3f87('0x39')](db[_0x3f87('0x34')][_0x3f87('0x35')]);_0x29cb50[_0x3f87('0x38')]=_[_0x3f87('0x39')](_0x4b7dbb[_0x3f87('0x38')]);_0x29cb50['filters']=_[_0x3f87('0x3b')](_0x29cb50[_0x3f87('0x3d')],_0x29cb50[_0x3f87('0x38')]);_0x2a234[_0x3f87('0x3c')]=_[_0x3f87('0x3b')](_0x29cb50[_0x3f87('0x3d')],qs[_0x3f87('0x3e')](_0x4b7dbb[_0x3f87('0x38')][_0x3f87('0x3e')]));_0x2a234[_0x3f87('0x3c')]=_0x2a234[_0x3f87('0x3c')]['length']?_0x2a234[_0x3f87('0x3c')]:_0x29cb50[_0x3f87('0x3d')];if(_0x4b7dbb[_0x3f87('0x38')]['includeAll']){_0x2a234[_0x3f87('0x4a')]=[{'all':!![]}];}_0x2a234=_[_0x3f87('0x46')]({},_0x2a234,_0x4b7dbb[_0x3f87('0x49')]);return db[_0x3f87('0x34')][_0x3f87('0x4f')](_0x2a234)[_0x3f87('0x2b')](handleEntityNotFound(_0x59bdd3,null))[_0x3f87('0x2b')](respondWithResult(_0x59bdd3,null))['catch'](handleError(_0x59bdd3,null));};exports[_0x3f87('0x50')]=function(_0x5e1240,_0x1b8ea3){return db[_0x3f87('0x34')][_0x3f87('0x50')](_0x5e1240[_0x3f87('0x51')],{})[_0x3f87('0x2b')](function(_0x37e9f1){var _0x1632c9=_0x5e1240[_0x3f87('0x52')][_0x3f87('0x2d')]({'plain':!![]});if(!_0x1632c9)throw new Error(_0x3f87('0x53'));if(_0x1632c9['role']===_0x3f87('0x52')){var _0x5d3df0=_0x37e9f1[_0x3f87('0x2d')]({'plain':!![]});var _0x463501=_0x3f87('0x2e');return db[_0x3f87('0x54')][_0x3f87('0x4f')]({'where':{'name':_0x463501,'userProfileId':_0x1632c9[_0x3f87('0x55')]},'raw':!![]})['then'](function(_0x46dee4){if(_0x46dee4&&_0x46dee4[_0x3f87('0x56')]===0x0){return db[_0x3f87('0x57')][_0x3f87('0x50')]({'name':_0x5d3df0[_0x3f87('0x31')],'resourceId':_0x5d3df0['id'],'type':_0x46dee4[_0x3f87('0x31')],'sectionId':_0x46dee4['id']},{})[_0x3f87('0x2b')](function(){return _0x37e9f1;});}else{return _0x37e9f1;}})[_0x3f87('0x4d')](function(_0x4564be){logger[_0x3f87('0x2f')](_0x3f87('0x58'),_0x4564be);throw _0x4564be;});}return _0x37e9f1;})[_0x3f87('0x2b')](respondWithResult(_0x1b8ea3,0xc9))[_0x3f87('0x4d')](handleError(_0x1b8ea3,null));};exports[_0x3f87('0x2a')]=function(_0x41e5f8,_0x39c78b){if(_0x41e5f8['body']['id']){delete _0x41e5f8['body']['id'];}return db['SmsQueue'][_0x3f87('0x4f')]({'where':{'id':_0x41e5f8['params']['id']}})[_0x3f87('0x2b')](handleEntityNotFound(_0x39c78b,null))[_0x3f87('0x2b')](saveUpdates(_0x41e5f8[_0x3f87('0x51')],null))[_0x3f87('0x2b')](respondWithResult(_0x39c78b,null))['catch'](handleError(_0x39c78b,null));};exports[_0x3f87('0x2c')]=function(_0x2265a8,_0x120854){return db['SmsQueue']['find']({'where':{'id':_0x2265a8['params']['id']}})[_0x3f87('0x2b')](handleEntityNotFound(_0x120854,null))[_0x3f87('0x2b')](removeEntity(_0x120854,null))['catch'](handleError(_0x120854,null));};exports[_0x3f87('0x59')]=function(_0x23b68c,_0x18e3bd){return db[_0x3f87('0x34')][_0x3f87('0x59')]()[_0x3f87('0x2b')](respondWithResult(_0x18e3bd,null))[_0x3f87('0x4d')](handleError(_0x18e3bd,null));};exports[_0x3f87('0x5a')]=function(_0x45865b,_0x42e49c,_0x22ab63){var _0x1b3ad3={'raw':!![],'where':{}},_0x4b505a={},_0x3985d3;return db[_0x3f87('0x34')][_0x3f87('0x5b')]({'where':{'id':_0x45865b[_0x3f87('0x4e')]['id']}})[_0x3f87('0x2b')](handleEntityNotFound(_0x42e49c,null))[_0x3f87('0x2b')](function(_0x82b690){if(_0x82b690){_0x3985d3=_0x82b690[_0x3f87('0x2d')]({'plain':!![]});_0x4b505a[_0x3f87('0x3d')]=_[_0x3f87('0x39')](db['UserSmsQueue'][_0x3f87('0x35')]);_0x4b505a['query']=_[_0x3f87('0x39')](_0x45865b[_0x3f87('0x38')]);_0x4b505a[_0x3f87('0x3a')]=_[_0x3f87('0x3b')](_0x4b505a['model'],_0x4b505a['query']);_0x1b3ad3[_0x3f87('0x3c')]=_[_0x3f87('0x3b')](_0x4b505a[_0x3f87('0x3d')],qs['fields'](_0x45865b[_0x3f87('0x38')][_0x3f87('0x3e')]));_0x1b3ad3[_0x3f87('0x3c')]=_0x1b3ad3['attributes'][_0x3f87('0x3f')]?_0x1b3ad3[_0x3f87('0x3c')]:_0x4b505a[_0x3f87('0x3d')];if(!_0x45865b['query']['hasOwnProperty'](_0x3f87('0x41'))){_0x1b3ad3['limit']=qs[_0x3f87('0x26')](_0x45865b[_0x3f87('0x38')]['limit']);_0x1b3ad3[_0x3f87('0x25')]=qs[_0x3f87('0x25')](_0x45865b['query']['offset']);}_0x1b3ad3[_0x3f87('0x5c')]=qs[_0x3f87('0x42')](_0x45865b[_0x3f87('0x38')][_0x3f87('0x42')]);_0x1b3ad3[_0x3f87('0x43')]=qs[_0x3f87('0x3a')](_[_0x3f87('0x44')](_0x45865b[_0x3f87('0x38')],_0x4b505a[_0x3f87('0x3a')]));_0x1b3ad3[_0x3f87('0x43')][_0x3f87('0x5d')]=_0x82b690['id'];if(_0x45865b[_0x3f87('0x38')][_0x3f87('0x45')]){_0x1b3ad3[_0x3f87('0x43')]=_[_0x3f87('0x46')](_0x1b3ad3[_0x3f87('0x43')],{'$or':_['map'](_0x1b3ad3[_0x3f87('0x3c')],function(_0x46aff2){var _0x31cb87={};_0x31cb87[_0x46aff2]={'$like':'%'+_0x45865b[_0x3f87('0x38')]['filter']+'%'};return _0x31cb87;})});}_0x1b3ad3=_[_0x3f87('0x46')]({},_0x1b3ad3,_0x45865b[_0x3f87('0x49')]);return db[_0x3f87('0x5e')][_0x3f87('0x4b')](_0x1b3ad3);}})[_0x3f87('0x2b')](function(_0x37a0f4){if(_0x37a0f4){return db[_0x3f87('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x37a0f4,_0x3f87('0x60')),'role':_0x3f87('0x61')},'attributes':['id','name','smsPause',_0x3f87('0x62'),_0x3f87('0x63')]});}})['then'](function(_0x35a949){if(_0x35a949){return{'count':_0x35a949[_0x3f87('0x24')],'rows':_['map'](_0x35a949['rows'],function(_0x100153){return{'membername':_0x100153[_0x3f87('0x31')],'UserId':_0x100153['id'],'queue_name':_0x3985d3[_0x3f87('0x31')],'SmsQueueId':_0x3985d3['id'],'interface':util['format'](_0x3f87('0x64'),'SIP',_0x100153[_0x3f87('0x31')]),'penalty':0x0,'paused':_0x100153[_0x3f87('0x65')],'createdAt':_0x100153[_0x3f87('0x63')],'updatedAt':_0x100153[_0x3f87('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f87('0x2b')](respondWithFilteredResult(_0x42e49c,_0x1b3ad3))[_0x3f87('0x4d')](handleError(_0x42e49c,null));};exports['getTeams']=function(_0x1f44dc,_0x263ea6,_0x374007){var _0x1b6ba6={};var _0x6f508d={};var _0x410054;var _0x392efd;return db['SmsQueue'][_0x3f87('0x5b')]({'where':{'id':_0x1f44dc[_0x3f87('0x4e')]['id']}})[_0x3f87('0x2b')](handleEntityNotFound(_0x263ea6,null))[_0x3f87('0x2b')](function(_0x5e23d8){if(_0x5e23d8){_0x410054=_0x5e23d8;_0x6f508d[_0x3f87('0x3d')]=_[_0x3f87('0x39')](db[_0x3f87('0x66')][_0x3f87('0x35')]);_0x6f508d[_0x3f87('0x38')]=_['keys'](_0x1f44dc['query']);_0x6f508d[_0x3f87('0x3a')]=_['intersection'](_0x6f508d[_0x3f87('0x3d')],_0x6f508d[_0x3f87('0x38')]);_0x1b6ba6[_0x3f87('0x3c')]=_[_0x3f87('0x3b')](_0x6f508d[_0x3f87('0x3d')],qs[_0x3f87('0x3e')](_0x1f44dc[_0x3f87('0x38')][_0x3f87('0x3e')]));_0x1b6ba6[_0x3f87('0x3c')]=_0x1b6ba6['attributes'][_0x3f87('0x3f')]?_0x1b6ba6[_0x3f87('0x3c')]:_0x6f508d['model'];_0x1b6ba6[_0x3f87('0x5c')]=qs[_0x3f87('0x42')](_0x1f44dc['query']['sort']);_0x1b6ba6[_0x3f87('0x43')]=qs[_0x3f87('0x3a')](_[_0x3f87('0x44')](_0x1f44dc[_0x3f87('0x38')],_0x6f508d[_0x3f87('0x3a')]));if(_0x1f44dc[_0x3f87('0x38')][_0x3f87('0x45')]){_0x1b6ba6[_0x3f87('0x43')]=_[_0x3f87('0x46')](_0x1b6ba6[_0x3f87('0x43')],{'$or':_[_0x3f87('0x33')](_0x1b6ba6[_0x3f87('0x3c')],function(_0x175e8c){var _0x580919={};_0x580919[_0x175e8c]={'$like':'%'+_0x1f44dc[_0x3f87('0x38')][_0x3f87('0x45')]+'%'};return _0x580919;})});}_0x1b6ba6=_[_0x3f87('0x46')]({},_0x1b6ba6,_0x1f44dc['options']);return _0x410054[_0x3f87('0x67')](_0x1b6ba6);}})[_0x3f87('0x2b')](function(_0x4d94f7){if(_0x4d94f7){_0x392efd=_0x4d94f7[_0x3f87('0x3f')];if(!_0x1f44dc[_0x3f87('0x38')][_0x3f87('0x40')]('nolimit')){_0x1b6ba6[_0x3f87('0x26')]=qs[_0x3f87('0x26')](_0x1f44dc['query'][_0x3f87('0x26')]);_0x1b6ba6[_0x3f87('0x25')]=qs['offset'](_0x1f44dc[_0x3f87('0x38')][_0x3f87('0x25')]);}return _0x410054[_0x3f87('0x67')](_0x1b6ba6);}})[_0x3f87('0x2b')](function(_0xf6d438){if(_0xf6d438){return _0xf6d438?{'count':_0x392efd,'rows':_0xf6d438}:null;}})['then'](respondWithResult(_0x263ea6,null))['catch'](handleError(_0x263ea6,null));};exports[_0x3f87('0x68')]=function(_0x4cdea5,_0x4dae45,_0x46dd17){var _0x49c4c1=_0x4cdea5[_0x3f87('0x51')][_0x3f87('0x69')];return db['Team'][_0x3f87('0x4b')]({'where':{'id':_0x49c4c1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f87('0x6a'),'attributes':['id','name',_0x3f87('0x6b'),_0x3f87('0x6c'),_0x3f87('0x6d')],'raw':!![]}]})[_0x3f87('0x2b')](function(_0x3e6185){if(_0x3e6185){var _0x1d217b=_[_0x3f87('0x6e')](_0x3e6185,function(_0x21b6af){var _0x3d8846=_0x21b6af[_0x3f87('0x2d')]({'plain':!![]});return _0x3d8846[_0x3f87('0x6a')];});return db[_0x3f87('0x34')][_0x3f87('0x4f')]({'where':{'id':_0x4cdea5['params']['id']}})['then'](function(_0x5ad10a){return db[_0x3f87('0x6f')][_0x3f87('0x70')](function(_0x59e616){return _0x5ad10a['addTeams'](_0x49c4c1,{'transaction':_0x59e616})[_0x3f87('0x2b')](function(){return BPromise[_0x3f87('0x71')](_0x1d217b,function(_0x416ace){return db[_0x3f87('0x5e')][_0x3f87('0x72')]({'where':{'UserId':_0x416ace['id'],'SmsQueueId':_0x4cdea5['params']['id']},'transaction':_0x59e616});});})[_0x3f87('0x2b')](function(){_0x1d217b[_0x3f87('0x73')](function(_0x39f519){socket[_0x3f87('0x74')](_0x3f87('0x75'),{'UserId':_0x39f519['id'],'SmsQueueId':_0x5ad10a['id']});});});});});}})[_0x3f87('0x2b')](respondWithStatusCode(_0x4dae45,null))[_0x3f87('0x4d')](handleError(_0x4dae45,null));};exports[_0x3f87('0x76')]=function(_0x1c18ae,_0x5b5ffb,_0x1c5ede){return db[_0x3f87('0x66')][_0x3f87('0x4b')]({'where':{'id':_0x1c18ae['query'][_0x3f87('0x69')]},'attributes':['id'],'include':[{'model':db[_0x3f87('0x5f')],'as':_0x3f87('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b5ffb,null))[_0x3f87('0x2b')](function(_0x1fd5e9){var _0xa67941=_[_0x3f87('0x33')](_0x1fd5e9,'id');var _0x15c23a=[];var _0x2dd7bf=[];var _0x58db8f=squel[_0x3f87('0x77')]();_0x58db8f['field'](_0x3f87('0x78'))['from'](_0x3f87('0x79'),'tq')[_0x3f87('0x7a')](_0x3f87('0x7b'),'ut',_0x3f87('0x7c'))['where']('SmsQueueId\x20=\x20?',_0x1c18ae[_0x3f87('0x4e')]['id']);for(var _0x508130=0x0;_0x508130<_0x1fd5e9['length'];_0x508130+=0x1){let _0x4cd1a8=_0x1fd5e9[_0x508130];for(var _0x4af6a4=0x0;_0x4af6a4<_0x4cd1a8[_0x3f87('0x6a')][_0x3f87('0x3f')];_0x4af6a4+=0x1){let _0x41b879=_0x4cd1a8['Agents'][_0x4af6a4];var _0x28e9ca=_0x58db8f[_0x3f87('0x7d')]();_0x28e9ca[_0x3f87('0x43')]('ut.UserId\x20=\x20?',_0x41b879['id']);_0x2dd7bf[_0x3f87('0x7e')](db[_0x3f87('0x6f')]['query'](_0x28e9ca[_0x3f87('0x7f')](),{'type':db[_0x3f87('0x6f')]['QueryTypes'][_0x3f87('0x80')]})[_0x3f87('0x2b')](function(_0x46a2f9){if(_0x46a2f9['length']===0x1){return _0x41b879['id'];}else{var _0x3b017e=_[_0x3f87('0x81')](_['map'](_0x46a2f9,'TeamId'),function(_0x2b46ec){return _[_0x3f87('0x82')](_0xa67941,_0x2b46ec);});if(_0x3b017e){return _0x41b879['id'];}}}));}}return BPromise[_0x3f87('0x83')](_0x2dd7bf)['then'](function(_0xdffdf){_0x15c23a=_(_0x15c23a)[_0x3f87('0x84')](_0xdffdf)['compact']()[_0x3f87('0x85')]();return db[_0x3f87('0x34')][_0x3f87('0x4f')]({'where':{'id':_0x1c18ae['params']['id']}})[_0x3f87('0x2b')](function(_0x3359c0){return db[_0x3f87('0x6f')][_0x3f87('0x70')](function(_0x1cf8b5){return _0x3359c0[_0x3f87('0x76')](_0x1c18ae[_0x3f87('0x38')][_0x3f87('0x69')],{'transaction':_0x1cf8b5})[_0x3f87('0x2b')](function(){if(!_['isEmpty'](_0x15c23a)){return _0x3359c0[_0x3f87('0x86')](_0x15c23a,{'transaction':_0x1cf8b5});}})[_0x3f87('0x2b')](function(){_0x15c23a[_0x3f87('0x73')](function(_0x5bac8d){socket[_0x3f87('0x74')](_0x3f87('0x87'),{'UserId':_0x5bac8d,'SmsQueueId':_0x3359c0['id']});});});});});});})[_0x3f87('0x2b')](respondWithStatusCode(_0x5b5ffb,null))[_0x3f87('0x4d')](handleError(_0x5b5ffb,null));};exports[_0x3f87('0x88')]=function(_0x325248,_0x5e979b,_0x29be4e){return db[_0x3f87('0x34')][_0x3f87('0x4f')]({'where':{'id':_0x325248[_0x3f87('0x4e')]['id']}})[_0x3f87('0x2b')](handleEntityNotFound(_0x5e979b,null))[_0x3f87('0x2b')](function(_0x8aed96){if(_0x8aed96){return _0x8aed96[_0x3f87('0x88')](_0x325248[_0x3f87('0x51')][_0x3f87('0x69')],_[_0x3f87('0x89')](_0x325248[_0x3f87('0x51')],[_0x3f87('0x69'),'id'])||{})[_0x3f87('0x8a')](function(_0x410fb9){for(var _0x1aff04=0x0;_0x1aff04<_0x325248[_0x3f87('0x51')][_0x3f87('0x69')]['length'];_0x1aff04+=0x1){socket[_0x3f87('0x74')](_0x3f87('0x75'),{'UserId':_0x325248[_0x3f87('0x51')][_0x3f87('0x69')][_0x1aff04],'SmsQueueId':_0x325248[_0x3f87('0x4e')]['id']});}return _0x410fb9;});}})['then'](respondWithResult(_0x5e979b,null))[_0x3f87('0x4d')](handleError(_0x5e979b,null));};exports[_0x3f87('0x86')]=function(_0xe60737,_0x3105c3,_0x146d75){return db[_0x3f87('0x34')][_0x3f87('0x4f')]({'where':{'id':_0xe60737[_0x3f87('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3105c3,null))[_0x3f87('0x2b')](function(_0xd6faa5){if(_0xd6faa5){return _0xd6faa5[_0x3f87('0x86')](_0xe60737[_0x3f87('0x38')][_0x3f87('0x69')])['then'](function(){if(_['isArray'](_0xe60737['query'][_0x3f87('0x69')])){for(var _0x48f923=0x0;_0x48f923<_0xe60737[_0x3f87('0x38')][_0x3f87('0x69')][_0x3f87('0x3f')];_0x48f923+=0x1){socket[_0x3f87('0x74')](_0x3f87('0x87'),{'UserId':Number(_0xe60737[_0x3f87('0x38')][_0x3f87('0x69')][_0x48f923]),'SmsQueueId':Number(_0xe60737[_0x3f87('0x4e')]['id'])});}}else{socket[_0x3f87('0x74')](_0x3f87('0x87'),{'UserId':Number(_0xe60737[_0x3f87('0x38')][_0x3f87('0x69')]),'SmsQueueId':Number(_0xe60737[_0x3f87('0x4e')]['id'])});}});}})[_0x3f87('0x2b')](respondWithStatusCode(_0x3105c3,null))[_0x3f87('0x4d')](handleError(_0x3105c3,null));};exports['getAgents']=function(_0x13986d,_0x5b19ca,_0x501cac){var _0x38b10f={};var _0x3f1487={};var _0x13cc89;var _0x58b8fd;return db[_0x3f87('0x34')][_0x3f87('0x5b')]({'where':{'id':_0x13986d['params']['id']}})[_0x3f87('0x2b')](handleEntityNotFound(_0x5b19ca,null))[_0x3f87('0x2b')](function(_0x388870){if(_0x388870){_0x13cc89=_0x388870;_0x3f1487['model']=_[_0x3f87('0x39')](db[_0x3f87('0x5f')]['rawAttributes']);_0x3f1487[_0x3f87('0x38')]=_[_0x3f87('0x39')](_0x13986d['query']);_0x3f1487['filters']=_[_0x3f87('0x3b')](_0x3f1487[_0x3f87('0x3d')],_0x3f1487[_0x3f87('0x38')]);_0x38b10f[_0x3f87('0x3c')]=_[_0x3f87('0x3b')](_0x3f1487[_0x3f87('0x3d')],qs[_0x3f87('0x3e')](_0x13986d['query'][_0x3f87('0x3e')]));_0x38b10f['attributes']=_0x38b10f['attributes'][_0x3f87('0x3f')]?_0x38b10f[_0x3f87('0x3c')]:_0x3f1487['model'];_0x38b10f[_0x3f87('0x5c')]=qs['sort'](_0x13986d['query'][_0x3f87('0x42')]);_0x38b10f['where']=qs[_0x3f87('0x3a')](_['pick'](_0x13986d['query'],_0x3f1487[_0x3f87('0x3a')]));if(_0x13986d[_0x3f87('0x38')][_0x3f87('0x45')]){_0x38b10f[_0x3f87('0x43')]=_['merge'](_0x38b10f[_0x3f87('0x43')],{'$or':_[_0x3f87('0x33')](_0x38b10f[_0x3f87('0x3c')],function(_0x5315b0){var _0x570429={};_0x570429[_0x5315b0]={'$like':'%'+_0x13986d[_0x3f87('0x38')][_0x3f87('0x45')]+'%'};return _0x570429;})});}_0x38b10f=_[_0x3f87('0x46')]({},_0x38b10f,_0x13986d[_0x3f87('0x49')]);return _0x13cc89['getAgents'](_0x38b10f);}})[_0x3f87('0x2b')](function(_0x3ae8ac){if(_0x3ae8ac){_0x58b8fd=_0x3ae8ac[_0x3f87('0x3f')];if(!_0x13986d[_0x3f87('0x38')][_0x3f87('0x40')](_0x3f87('0x41'))){_0x38b10f[_0x3f87('0x26')]=qs[_0x3f87('0x26')](_0x13986d[_0x3f87('0x38')][_0x3f87('0x26')]);_0x38b10f[_0x3f87('0x25')]=qs[_0x3f87('0x25')](_0x13986d['query'][_0x3f87('0x25')]);}return _0x13cc89['getAgents'](_0x38b10f);}})['then'](function(_0x49835b){if(_0x49835b){return _0x49835b?{'count':_0x58b8fd,'rows':_0x49835b}:null;}})[_0x3f87('0x2b')](respondWithResult(_0x5b19ca,null))['catch'](handleError(_0x5b19ca,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e7badf7..c237029 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 _0xc68f=['remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x57834a,_0xfac574){var _0x5788d9=function(_0x290392){while(--_0x290392){_0x57834a['push'](_0x57834a['shift']());}};_0x5788d9(++_0xfac574);}(_0xc68f,0xfe));var _0xfc68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc68f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfc68('0x0'));var SmsQueue=require(_0xfc68('0x1'))['db'][_0xfc68('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfc68('0x3')](0x0);var events={'afterCreate':_0xfc68('0x4'),'afterUpdate':_0xfc68('0x5'),'afterDestroy':_0xfc68('0x6')};function emitEvent(_0x4da4a6){return function(_0x4f473a,_0x52d7cb,_0x16b0c2){SmsQueueEvents[_0xfc68('0x7')](_0x4da4a6+':'+_0x4f473a['id'],_0x4f473a);SmsQueueEvents[_0xfc68('0x7')](_0x4da4a6,_0x4f473a);_0x16b0c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xfc68('0x8')](e,emitEvent(event));}}module[_0xfc68('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xcb98=['update','remove','emit','hasOwnProperty','hook','exports','events','SmsQueue','save'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xcb98,0xf9));var _0x8cb9=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0xcb98[_0x44cb92];return _0x56b9e6;};'use strict';var EventEmitter=require(_0x8cb9('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x8cb9('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8cb9('0x2'),'afterUpdate':_0x8cb9('0x3'),'afterDestroy':_0x8cb9('0x4')};function emitEvent(_0x1666ac){return function(_0x920571,_0x1aecbd,_0x1ddb0a){SmsQueueEvents['emit'](_0x1666ac+':'+_0x920571['id'],_0x920571);SmsQueueEvents[_0x8cb9('0x5')](_0x1666ac,_0x920571);_0x1ddb0a(null);};}for(var e in events){if(events[_0x8cb9('0x6')](e)){var event=events[e];SmsQueue[_0x8cb9('0x7')](e,emitEvent(event));}}module[_0x8cb9('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 28f13b7..9884a5c 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 _0x0150=['exports','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x3b6f53,_0x230a92){var _0x5219c2=function(_0x58bf1b){while(--_0x58bf1b){_0x3b6f53['push'](_0x3b6f53['shift']());}};_0x5219c2(++_0x230a92);}(_0x0150,0xc3));var _0x0015=function(_0x2ef45f,_0x33cfd8){_0x2ef45f=_0x2ef45f-0x0;var _0x4367c6=_0x0150[_0x2ef45f];return _0x4367c6;};'use strict';var _=require(_0x0015('0x0'));var util=require('util');var logger=require(_0x0015('0x1'))(_0x0015('0x2'));var moment=require(_0x0015('0x3'));var BPromise=require('bluebird');var rp=require(_0x0015('0x4'));var fs=require('fs');var path=require(_0x0015('0x5'));var rimraf=require(_0x0015('0x6'));var config=require(_0x0015('0x7'));var attributes=require(_0x0015('0x8'));module[_0x0015('0x9')]=function(_0x9cae87,_0x517d4e){return _0x9cae87['define'](_0x0015('0xa'),attributes,{'tableName':_0x0015('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c83=['exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x5e7b60,_0x5ca6df){var _0x221b41=function(_0x4546a6){while(--_0x4546a6){_0x5e7b60['push'](_0x5e7b60['shift']());}};_0x221b41(++_0x5ca6df);}(_0x0c83,0x1d2));var _0x30c8=function(_0xf4c72a,_0x4393bd){_0xf4c72a=_0xf4c72a-0x0;var _0x4bdd55=_0x0c83[_0xf4c72a];return _0x4bdd55;};'use strict';var _=require(_0x30c8('0x0'));var util=require(_0x30c8('0x1'));var logger=require(_0x30c8('0x2'))(_0x30c8('0x3'));var moment=require(_0x30c8('0x4'));var BPromise=require('bluebird');var rp=require(_0x30c8('0x5'));var fs=require('fs');var path=require(_0x30c8('0x6'));var rimraf=require(_0x30c8('0x7'));var config=require(_0x30c8('0x8'));var attributes=require(_0x30c8('0x9'));module[_0x30c8('0xa')]=function(_0x568bae,_0x4783de){return _0x568bae[_0x30c8('0xb')](_0x30c8('0xc'),attributes,{'tableName':_0x30c8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6b55f63..8a574fb 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 _0x2449=['request\x20sent','debug','stringify','error','code','message','result','catch','SmsQueue','findAll','raw','options','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x220606,_0x4b6630){var _0x1308ff=function(_0x5243bc){while(--_0x5243bc){_0x220606['push'](_0x220606['shift']());}};_0x1308ff(++_0x4b6630);}(_0x2449,0xad));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9244('0x0'));var moment=require(_0x9244('0x1'));var BPromise=require(_0x9244('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9244('0x3'));var db=require(_0x9244('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9244('0x5'))(_0x9244('0x6'));var config=require('../../config/environment');var jayson=require(_0x9244('0x7'));var client=jayson[_0x9244('0x8')]['http']({'port':0x232a});config[_0x9244('0x9')]=_[_0x9244('0xa')](config[_0x9244('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9244('0xb'))(new Redis(config[_0x9244('0x9')]));require(_0x9244('0xc'))[_0x9244('0xd')](socket);function respondWithRpcPromise(_0x31908d,_0x2ae972,_0x254a34){return new BPromise(function(_0x30df5c,_0x482505){return client['request'](_0x31908d,_0x254a34)[_0x9244('0xe')](function(_0x3d0747){logger[_0x9244('0xf')](_0x9244('0x10'),_0x2ae972,_0x9244('0x11'));logger[_0x9244('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2ae972,_0x9244('0x11'),JSON[_0x9244('0x13')](_0x3d0747));if(_0x3d0747[_0x9244('0x14')]){if(_0x3d0747['error'][_0x9244('0x15')]===0x1f4){logger[_0x9244('0x14')](_0x9244('0x10'),_0x2ae972,_0x3d0747[_0x9244('0x14')][_0x9244('0x16')]);return _0x482505(_0x3d0747[_0x9244('0x14')][_0x9244('0x16')]);}logger[_0x9244('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2ae972,_0x3d0747['error'][_0x9244('0x16')]);return _0x30df5c(_0x3d0747[_0x9244('0x14')][_0x9244('0x16')]);}else{logger['info'](_0x9244('0x10'),_0x2ae972,_0x9244('0x11'));_0x30df5c(_0x3d0747[_0x9244('0x17')][_0x9244('0x16')]);}})[_0x9244('0x18')](function(_0x25832c){logger[_0x9244('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2ae972,_0x25832c);_0x482505(_0x25832c);});});}exports['GetSmsQueue']=function(_0x57e850){var _0x156acb=this;return new Promise(function(_0x1fee42,_0x2d9dc5){return db[_0x9244('0x19')][_0x9244('0x1a')]({'raw':_0x57e850['options']?_0x57e850['options'][_0x9244('0x1b')]===undefined?!![]:![]:!![],'where':_0x57e850[_0x9244('0x1c')]?_0x57e850[_0x9244('0x1c')]['where']||null:null,'attributes':_0x57e850['options']?_0x57e850[_0x9244('0x1c')][_0x9244('0x1d')]||null:null,'limit':_0x57e850[_0x9244('0x1c')]?_0x57e850[_0x9244('0x1c')][_0x9244('0x1e')]||null:null,'include':_0x57e850[_0x9244('0x1c')]?_0x57e850[_0x9244('0x1c')][_0x9244('0x1f')]?_[_0x9244('0x20')](_0x57e850[_0x9244('0x1c')]['include'],function(_0x1ec104){return{'model':db[_0x1ec104['model']],'as':_0x1ec104['as'],'attributes':_0x1ec104[_0x9244('0x1d')],'include':_0x1ec104[_0x9244('0x1f')]?_['map'](_0x1ec104[_0x9244('0x1f')],function(_0x58d332){return{'model':db[_0x58d332['model']],'as':_0x58d332['as'],'attributes':_0x58d332[_0x9244('0x1d')],'include':_0x58d332['include']?_[_0x9244('0x20')](_0x58d332[_0x9244('0x1f')],function(_0x1ced31){return{'model':db[_0x1ced31[_0x9244('0x21')]],'as':_0x1ced31['as'],'attributes':_0x1ced31[_0x9244('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9244('0xe')](function(_0x5041ee){logger['info'](_0x9244('0x22'),_0x57e850);logger['debug'](_0x9244('0x22'),_0x57e850,JSON[_0x9244('0x13')](_0x5041ee));_0x1fee42(_0x5041ee);})[_0x9244('0x18')](function(_0x39048d){logger['error']('GetSmsQueue',_0x39048d[_0x9244('0x16')],_0x57e850);_0x2d9dc5(_0x156acb['error'](0x1f4,_0x39048d[_0x9244('0x16')]));});});};exports[_0x9244('0x23')]=function(_0x572907){var _0x391ec6=this;return new Promise(function(_0x48c51c,_0x469604){return db[_0x9244('0x19')][_0x9244('0x24')]({'raw':_0x572907[_0x9244('0x1c')]?_0x572907[_0x9244('0x1c')][_0x9244('0x1b')]===undefined?!![]:![]:!![],'where':_0x572907[_0x9244('0x1c')]?_0x572907[_0x9244('0x1c')][_0x9244('0x25')]||null:null,'attributes':_0x572907[_0x9244('0x1c')]?_0x572907[_0x9244('0x1c')][_0x9244('0x1d')]||null:null,'include':_0x572907[_0x9244('0x1c')]?_0x572907[_0x9244('0x1c')][_0x9244('0x1f')]?_['map'](_0x572907[_0x9244('0x1c')][_0x9244('0x1f')],function(_0x22486){return{'model':db[_0x22486[_0x9244('0x21')]],'as':_0x22486['as'],'attributes':_0x22486[_0x9244('0x1d')],'include':_0x22486[_0x9244('0x1f')]?_['map'](_0x22486['include'],function(_0x3489db){return{'model':db[_0x3489db[_0x9244('0x21')]],'as':_0x3489db['as'],'attributes':_0x3489db[_0x9244('0x1d')],'include':_0x3489db['include']?_[_0x9244('0x20')](_0x3489db[_0x9244('0x1f')],function(_0x52432e){return{'model':db[_0x52432e[_0x9244('0x21')]],'as':_0x52432e['as'],'attributes':_0x52432e[_0x9244('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9244('0xe')](function(_0x5dab3f){logger[_0x9244('0xf')](_0x9244('0x23'),_0x572907);logger[_0x9244('0x12')](_0x9244('0x23'),_0x572907,JSON[_0x9244('0x13')](_0x5dab3f));_0x48c51c(_0x5dab3f);})[_0x9244('0x18')](function(_0x5f662){logger['error'](_0x9244('0x23'),_0x5f662[_0x9244('0x16')],_0x572907);_0x469604(_0x391ec6[_0x9244('0x14')](0x1f4,_0x5f662['message']));});});}; \ No newline at end of file +var _0x0da3=['GetSmsQueue','SmsQueue','options','raw','attributes','limit','include','map','model','ShowSmsQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x41f977,_0x19f250){var _0x334acd=function(_0x425760){while(--_0x425760){_0x41f977['push'](_0x41f977['shift']());}};_0x334acd(++_0x19f250);}(_0x0da3,0x1ce));var _0x30da=function(_0x2077bc,_0x4dc6d9){_0x2077bc=_0x2077bc-0x0;var _0x338666=_0x0da3[_0x2077bc];return _0x338666;};'use strict';var _=require(_0x30da('0x0'));var util=require('util');var moment=require(_0x30da('0x1'));var BPromise=require(_0x30da('0x2'));var rs=require(_0x30da('0x3'));var fs=require('fs');var Redis=require(_0x30da('0x4'));var db=require(_0x30da('0x5'))['db'];var utils=require(_0x30da('0x6'));var logger=require(_0x30da('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x30da('0x8'));var client=jayson[_0x30da('0x9')][_0x30da('0xa')]({'port':0x232a});config[_0x30da('0xb')]=_[_0x30da('0xc')](config[_0x30da('0xb')],{'host':_0x30da('0xd'),'port':0x18eb});var socket=require(_0x30da('0xe'))(new Redis(config['redis']));require(_0x30da('0xf'))[_0x30da('0x10')](socket);function respondWithRpcPromise(_0x3414a6,_0x4fa762,_0x5412a2){return new BPromise(function(_0x3ef97c,_0x3d11a2){return client[_0x30da('0x11')](_0x3414a6,_0x5412a2)[_0x30da('0x12')](function(_0x1f7eca){logger[_0x30da('0x13')](_0x30da('0x14'),_0x4fa762,'request\x20sent');logger[_0x30da('0x15')](_0x30da('0x16'),_0x4fa762,_0x30da('0x17'),JSON[_0x30da('0x18')](_0x1f7eca));if(_0x1f7eca[_0x30da('0x19')]){if(_0x1f7eca[_0x30da('0x19')][_0x30da('0x1a')]===0x1f4){logger['error'](_0x30da('0x14'),_0x4fa762,_0x1f7eca[_0x30da('0x19')][_0x30da('0x1b')]);return _0x3d11a2(_0x1f7eca[_0x30da('0x19')][_0x30da('0x1b')]);}logger[_0x30da('0x19')](_0x30da('0x14'),_0x4fa762,_0x1f7eca[_0x30da('0x19')][_0x30da('0x1b')]);return _0x3ef97c(_0x1f7eca[_0x30da('0x19')][_0x30da('0x1b')]);}else{logger[_0x30da('0x13')](_0x30da('0x14'),_0x4fa762,_0x30da('0x17'));_0x3ef97c(_0x1f7eca[_0x30da('0x1c')][_0x30da('0x1b')]);}})[_0x30da('0x1d')](function(_0xcf4ed9){logger[_0x30da('0x19')]('SmsQueue,\x20%s,\x20%s',_0x4fa762,_0xcf4ed9);_0x3d11a2(_0xcf4ed9);});});}exports[_0x30da('0x1e')]=function(_0x29068d){var _0x2c875c=this;return new Promise(function(_0x407e7c,_0x5b71c3){return db[_0x30da('0x1f')]['findAll']({'raw':_0x29068d[_0x30da('0x20')]?_0x29068d['options'][_0x30da('0x21')]===undefined?!![]:![]:!![],'where':_0x29068d[_0x30da('0x20')]?_0x29068d[_0x30da('0x20')]['where']||null:null,'attributes':_0x29068d[_0x30da('0x20')]?_0x29068d['options'][_0x30da('0x22')]||null:null,'limit':_0x29068d[_0x30da('0x20')]?_0x29068d[_0x30da('0x20')][_0x30da('0x23')]||null:null,'include':_0x29068d[_0x30da('0x20')]?_0x29068d[_0x30da('0x20')][_0x30da('0x24')]?_[_0x30da('0x25')](_0x29068d['options'][_0x30da('0x24')],function(_0x2d7a1c){return{'model':db[_0x2d7a1c[_0x30da('0x26')]],'as':_0x2d7a1c['as'],'attributes':_0x2d7a1c['attributes'],'include':_0x2d7a1c[_0x30da('0x24')]?_['map'](_0x2d7a1c['include'],function(_0x1ff5c2){return{'model':db[_0x1ff5c2[_0x30da('0x26')]],'as':_0x1ff5c2['as'],'attributes':_0x1ff5c2[_0x30da('0x22')],'include':_0x1ff5c2[_0x30da('0x24')]?_[_0x30da('0x25')](_0x1ff5c2[_0x30da('0x24')],function(_0x8cb97b){return{'model':db[_0x8cb97b[_0x30da('0x26')]],'as':_0x8cb97b['as'],'attributes':_0x8cb97b[_0x30da('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9dd01b){logger[_0x30da('0x13')](_0x30da('0x1e'),_0x29068d);logger[_0x30da('0x15')](_0x30da('0x1e'),_0x29068d,JSON[_0x30da('0x18')](_0x9dd01b));_0x407e7c(_0x9dd01b);})[_0x30da('0x1d')](function(_0xd8cb7d){logger['error'](_0x30da('0x1e'),_0xd8cb7d[_0x30da('0x1b')],_0x29068d);_0x5b71c3(_0x2c875c[_0x30da('0x19')](0x1f4,_0xd8cb7d[_0x30da('0x1b')]));});});};exports[_0x30da('0x27')]=function(_0x568126){var _0x5d4fdc=this;return new Promise(function(_0x282e54,_0x5e3c2e){return db[_0x30da('0x1f')]['find']({'raw':_0x568126[_0x30da('0x20')]?_0x568126[_0x30da('0x20')][_0x30da('0x21')]===undefined?!![]:![]:!![],'where':_0x568126['options']?_0x568126[_0x30da('0x20')][_0x30da('0x28')]||null:null,'attributes':_0x568126[_0x30da('0x20')]?_0x568126[_0x30da('0x20')][_0x30da('0x22')]||null:null,'include':_0x568126[_0x30da('0x20')]?_0x568126[_0x30da('0x20')][_0x30da('0x24')]?_[_0x30da('0x25')](_0x568126['options'][_0x30da('0x24')],function(_0x2f16a2){return{'model':db[_0x2f16a2[_0x30da('0x26')]],'as':_0x2f16a2['as'],'attributes':_0x2f16a2[_0x30da('0x22')],'include':_0x2f16a2[_0x30da('0x24')]?_[_0x30da('0x25')](_0x2f16a2[_0x30da('0x24')],function(_0x374614){return{'model':db[_0x374614['model']],'as':_0x374614['as'],'attributes':_0x374614[_0x30da('0x22')],'include':_0x374614['include']?_['map'](_0x374614[_0x30da('0x24')],function(_0x43cc1a){return{'model':db[_0x43cc1a[_0x30da('0x26')]],'as':_0x43cc1a['as'],'attributes':_0x43cc1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x30da('0x12')](function(_0x45fc06){logger[_0x30da('0x13')](_0x30da('0x27'),_0x568126);logger[_0x30da('0x15')]('ShowSmsQueue',_0x568126,JSON['stringify'](_0x45fc06));_0x282e54(_0x45fc06);})[_0x30da('0x1d')](function(_0x9e940b){logger['error'](_0x30da('0x27'),_0x9e940b[_0x30da('0x1b')],_0x568126);_0x5e3c2e(_0x5d4fdc['error'](0x1f4,_0x9e940b[_0x30da('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5e18c7b..54f97ff 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 _0xaac0=['emit','removeListener','length','smsQueue:','update'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xaac0,0x17b));var _0x0aac=function(_0x16c1a5,_0x17dfb0){_0x16c1a5=_0x16c1a5-0x0;var _0x421b5e=_0xaac0[_0x16c1a5];return _0x421b5e;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x0aac('0x0')];function createListener(_0x5234f7,_0x59a572){return function(_0x77b934){_0x59a572[_0x0aac('0x1')](_0x5234f7,_0x77b934);};}function removeListener(_0x186fca,_0x2659bb){return function(){SmsQueueEvents[_0x0aac('0x2')](_0x186fca,_0x2659bb);};}exports['register']=function(_0x455f60){for(var _0x43beba=0x0,_0x5b732f=events[_0x0aac('0x3')];_0x43beba<_0x5b732f;_0x43beba++){var _0x3bfe8f=events[_0x43beba];var _0x4c048e=createListener(_0x0aac('0x4')+_0x3bfe8f,_0x455f60);SmsQueueEvents['on'](_0x3bfe8f,_0x4c048e);}}; \ No newline at end of file +var _0x77fb=['length','smsQueue:','./smsQueue.events','save','emit','removeListener','register'];(function(_0x542185,_0x325852){var _0x2504b3=function(_0x5912fe){while(--_0x5912fe){_0x542185['push'](_0x542185['shift']());}};_0x2504b3(++_0x325852);}(_0x77fb,0x167));var _0xb77f=function(_0x1e65fd,_0x53c972){_0x1e65fd=_0x1e65fd-0x0;var _0x17f5e7=_0x77fb[_0x1e65fd];return _0x17f5e7;};'use strict';var SmsQueueEvents=require(_0xb77f('0x0'));var events=[_0xb77f('0x1'),'remove','update'];function createListener(_0x50ea17,_0x1bef69){return function(_0xc03b31){_0x1bef69[_0xb77f('0x2')](_0x50ea17,_0xc03b31);};}function removeListener(_0x1c0198,_0x427678){return function(){SmsQueueEvents[_0xb77f('0x3')](_0x1c0198,_0x427678);};}exports[_0xb77f('0x4')]=function(_0x3dbf4c){for(var _0x3b7d2a=0x0,_0x46c84e=events[_0xb77f('0x5')];_0x3b7d2a<_0x46c84e;_0x3b7d2a++){var _0xc88d2=events[_0x3b7d2a];var _0x4a6c34=createListener(_0xb77f('0x6')+_0xc88d2,_0x3dbf4c);SmsQueueEvents['on'](_0xc88d2,_0x4a6c34);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6f0277a..830d8e0 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 _0xb49b=['/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','put','delete'];(function(_0x36e429,_0x28f1eb){var _0x4d6d38=function(_0x3f39cd){while(--_0x3f39cd){_0x36e429['push'](_0x36e429['shift']());}};_0x4d6d38(++_0x28f1eb);}(_0xb49b,0xf1));var _0xbb49=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb49b[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xbb49('0x0'));var util=require(_0xbb49('0x1'));var path=require(_0xbb49('0x2'));var timeout=require(_0xbb49('0x3'));var express=require(_0xbb49('0x4'));var router=express[_0xbb49('0x5')]();var auth=require(_0xbb49('0x6'));var interaction=require(_0xbb49('0x7'));var config=require(_0xbb49('0x8'));var controller=require(_0xbb49('0x9'));router[_0xbb49('0xa')]('/',auth[_0xbb49('0xb')](),controller[_0xbb49('0xc')]);router['get']('/describe',auth[_0xbb49('0xb')](),controller[_0xbb49('0xd')]);router[_0xbb49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbb49('0xe')]);router[_0xbb49('0xf')]('/',auth[_0xbb49('0xb')](),controller[_0xbb49('0x10')]);router[_0xbb49('0x11')]('/:id',auth[_0xbb49('0xb')](),controller['update']);router[_0xbb49('0x12')](_0xbb49('0x13'),auth[_0xbb49('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x42be=['multer','util','path','connect-timeout','express','./smsQueueReport.controller','get','index','/:id','show','isAuthenticated','create','update','delete','exports'];(function(_0x34b7bb,_0x559503){var _0x5186f7=function(_0x3b46c5){while(--_0x3b46c5){_0x34b7bb['push'](_0x34b7bb['shift']());}};_0x5186f7(++_0x559503);}(_0x42be,0x12c));var _0xe42b=function(_0x38c57d,_0x2da88a){_0x38c57d=_0x38c57d-0x0;var _0x40a17e=_0x42be[_0x38c57d];return _0x40a17e;};'use strict';var multer=require(_0xe42b('0x0'));var util=require(_0xe42b('0x1'));var path=require(_0xe42b('0x2'));var timeout=require(_0xe42b('0x3'));var express=require(_0xe42b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe42b('0x5'));router[_0xe42b('0x6')]('/',auth['isAuthenticated'](),controller[_0xe42b('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe42b('0x6')](_0xe42b('0x8'),auth['isAuthenticated'](),controller[_0xe42b('0x9')]);router['post']('/',auth[_0xe42b('0xa')](),controller[_0xe42b('0xb')]);router['put']('/:id',auth[_0xe42b('0xa')](),controller[_0xe42b('0xc')]);router[_0xe42b('0xd')](_0xe42b('0x8'),auth[_0xe42b('0xa')](),controller['destroy']);module[_0xe42b('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ffc0c84..332e348 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 _0xff00=['moment','sequelize','exports','STRING','DATE'];(function(_0xf84186,_0x4dbffe){var _0x4e397c=function(_0x396721){while(--_0x396721){_0xf84186['push'](_0xf84186['shift']());}};_0x4e397c(++_0x4dbffe);}(_0xff00,0x1a4));var _0x0ff0=function(_0x4e3179,_0x23c4a5){_0x4e3179=_0x4e3179-0x0;var _0x2651d5=_0xff00[_0x4e3179];return _0x2651d5;};'use strict';var moment=require(_0x0ff0('0x0'));var Sequelize=require(_0x0ff0('0x1'));module[_0x0ff0('0x2')]={'uniqueid':{'type':Sequelize[_0x0ff0('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0ff0('0x4')]},'acceptAt':{'type':Sequelize[_0x0ff0('0x4')]},'exitAt':{'type':Sequelize[_0x0ff0('0x4')]},'reason':{'type':Sequelize[_0x0ff0('0x3')]}}; \ No newline at end of file +var _0x705a=['DATE','sequelize','exports','STRING'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x705a,0x1c9));var _0xa705=function(_0x275841,_0x2a506b){_0x275841=_0x275841-0x0;var _0xed93db=_0x705a[_0x275841];return _0xed93db;};'use strict';var moment=require('moment');var Sequelize=require(_0xa705('0x0'));module[_0xa705('0x1')]={'uniqueid':{'type':Sequelize[_0xa705('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa705('0x2')]},'joinAt':{'type':Sequelize[_0xa705('0x3')]},'leaveAt':{'type':Sequelize[_0xa705('0x3')]},'acceptAt':{'type':Sequelize[_0xa705('0x3')]},'exitAt':{'type':Sequelize[_0xa705('0x3')]},'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 605ddbf..b47407d 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 _0x25fc=['update','destroy','then','sendStatus','error','stack','name','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','set','Content-Range','json','reject','save'];(function(_0x447e39,_0x32f95e){var _0x39b150=function(_0x4ed35e){while(--_0x4ed35e){_0x447e39['push'](_0x447e39['shift']());}};_0x39b150(++_0x32f95e);}(_0x25fc,0x14f));var _0xc25f=function(_0x50102d,_0x15e9c6){_0x50102d=_0x50102d-0x0;var _0xc7b28a=_0x25fc[_0x50102d];return _0xc7b28a;};'use strict';var pdf=require(_0xc25f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc25f('0x1'));var zipdir=require(_0xc25f('0x2'));var jsonpatch=require(_0xc25f('0x3'));var rp=require(_0xc25f('0x4'));var moment=require('moment');var BPromise=require(_0xc25f('0x5'));var Mustache=require('mustache');var util=require(_0xc25f('0x6'));var path=require(_0xc25f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc25f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc25f('0x9'));var crypto=require(_0xc25f('0xa'));var jsforce=require(_0xc25f('0xb'));var deskjs=require(_0xc25f('0xc'));var toCsv=require(_0xc25f('0xd'));var querystring=require('querystring');var Papa=require(_0xc25f('0xe'));var Redis=require(_0xc25f('0xf'));var authService=require(_0xc25f('0x10'));var qs=require(_0xc25f('0x11'));var as=require(_0xc25f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc25f('0x13'))('api');var utils=require(_0xc25f('0x14'));var config=require(_0xc25f('0x15'));var licenseUtil=require(_0xc25f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50efac,_0x14551e){_0x14551e=_0x14551e||0xcc;return function(_0x34cdc1){if(_0x34cdc1){return _0x50efac['sendStatus'](_0x14551e);}return _0x50efac['status'](_0x14551e)['end']();};}function respondWithResult(_0xf2d8cc,_0x47a650){_0x47a650=_0x47a650||0xc8;return function(_0xd94f8a){if(_0xd94f8a){return _0xf2d8cc[_0xc25f('0x17')](_0x47a650)['json'](_0xd94f8a);}};}function respondWithFilteredResult(_0x5cb18c,_0xab2d1a){return function(_0x6d1974){if(_0x6d1974){var _0x5231a1=_0x6d1974['count'],_0x344713=_0xab2d1a[_0xc25f('0x18')],_0x2226b7=_0xab2d1a['offset']+_0xab2d1a['limit'],_0x1d0b81;if(_0x2226b7>=_0x5231a1){_0x2226b7=_0x5231a1;_0x1d0b81=0xc8;}else{_0x1d0b81=0xce;}_0x5cb18c[_0xc25f('0x17')](_0x1d0b81);return _0x5cb18c[_0xc25f('0x19')](_0xc25f('0x1a'),_0x344713+'-'+_0x2226b7+'/'+_0x5231a1)[_0xc25f('0x1b')](_0x6d1974);}return null;};}function patchUpdates(_0x60438a){return function(_0x8b2f6f){try{jsonpatch['apply'](_0x8b2f6f,_0x60438a,!![]);}catch(_0x1dc022){return BPromise[_0xc25f('0x1c')](_0x1dc022);}return _0x8b2f6f[_0xc25f('0x1d')]();};}function saveUpdates(_0x5645ae,_0x172c75){return function(_0xa45812){if(_0xa45812){return _0xa45812[_0xc25f('0x1e')](_0x5645ae)['then'](function(_0x4b5623){return _0x4b5623;});}return null;};}function removeEntity(_0x40e6dc,_0x244126){return function(_0x3799d8){if(_0x3799d8){return _0x3799d8[_0xc25f('0x1f')]()[_0xc25f('0x20')](function(){_0x40e6dc[_0xc25f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18aba0,_0x9845ea){return function(_0x4ea0ba){if(!_0x4ea0ba){_0x18aba0[_0xc25f('0x21')](0x194);}return _0x4ea0ba;};}function handleError(_0x388031,_0x272d58){_0x272d58=_0x272d58||0x1f4;return function(_0x3c23bb){logger[_0xc25f('0x22')](_0x3c23bb[_0xc25f('0x23')]);if(_0x3c23bb[_0xc25f('0x24')]){delete _0x3c23bb[_0xc25f('0x24')];}_0x388031[_0xc25f('0x17')](_0x272d58)['send'](_0x3c23bb);};}exports[_0xc25f('0x25')]=function(_0x2c4fe8,_0x161983){var _0x137193={},_0x364a31={},_0x5e0237={'count':0x0,'rows':[]};var _0x36a465=_[_0xc25f('0x26')](db[_0xc25f('0x27')][_0xc25f('0x28')],function(_0x49d2fa){return{'name':_0x49d2fa['fieldName'],'type':_0x49d2fa[_0xc25f('0x29')][_0xc25f('0x2a')]};});_0x364a31[_0xc25f('0x2b')]=_[_0xc25f('0x26')](_0x36a465,'name');_0x364a31[_0xc25f('0x2c')]=_[_0xc25f('0x2d')](_0x2c4fe8[_0xc25f('0x2c')]);_0x364a31[_0xc25f('0x2e')]=_[_0xc25f('0x2f')](_0x364a31[_0xc25f('0x2b')],_0x364a31['query']);_0x137193[_0xc25f('0x30')]=_[_0xc25f('0x2f')](_0x364a31[_0xc25f('0x2b')],qs['fields'](_0x2c4fe8[_0xc25f('0x2c')]['fields']));_0x137193[_0xc25f('0x30')]=_0x137193[_0xc25f('0x30')]['length']?_0x137193['attributes']:_0x364a31[_0xc25f('0x2b')];if(!_0x2c4fe8[_0xc25f('0x2c')][_0xc25f('0x31')](_0xc25f('0x32'))){_0x137193[_0xc25f('0x33')]=qs['limit'](_0x2c4fe8[_0xc25f('0x2c')][_0xc25f('0x33')]);_0x137193['offset']=qs[_0xc25f('0x18')](_0x2c4fe8[_0xc25f('0x2c')][_0xc25f('0x18')]);}_0x137193[_0xc25f('0x34')]=qs[_0xc25f('0x35')](_0x2c4fe8[_0xc25f('0x2c')][_0xc25f('0x35')]);_0x137193[_0xc25f('0x36')]=qs[_0xc25f('0x2e')](_[_0xc25f('0x37')](_0x2c4fe8[_0xc25f('0x2c')],_0x364a31[_0xc25f('0x2e')]),_0x36a465);if(_0x2c4fe8[_0xc25f('0x2c')]['filter']){_0x137193[_0xc25f('0x36')]=_[_0xc25f('0x38')](_0x137193[_0xc25f('0x36')],{'$or':_[_0xc25f('0x26')](_0x36a465,function(_0x4fa1c6){if(_0x4fa1c6[_0xc25f('0x29')]!==_0xc25f('0x39')){var _0x49e5ab={};_0x49e5ab[_0x4fa1c6[_0xc25f('0x24')]]={'$like':'%'+_0x2c4fe8[_0xc25f('0x2c')][_0xc25f('0x3a')]+'%'};return _0x49e5ab;}})});}_0x137193=_[_0xc25f('0x38')]({},_0x137193,_0x2c4fe8[_0xc25f('0x3b')]);var _0x2bf14f={'where':_0x137193[_0xc25f('0x36')]};return db[_0xc25f('0x27')][_0xc25f('0x3c')](_0x2bf14f)[_0xc25f('0x20')](function(_0x1a0cec){_0x5e0237[_0xc25f('0x3c')]=_0x1a0cec;if(_0x2c4fe8['query'][_0xc25f('0x3d')]){_0x137193[_0xc25f('0x3e')]=[{'all':!![]}];}return db[_0xc25f('0x27')][_0xc25f('0x3f')](_0x137193);})[_0xc25f('0x20')](function(_0x5b6cfc){_0x5e0237[_0xc25f('0x40')]=_0x5b6cfc;return _0x5e0237;})[_0xc25f('0x20')](respondWithFilteredResult(_0x161983,_0x137193))[_0xc25f('0x41')](handleError(_0x161983,null));};exports[_0xc25f('0x42')]=function(_0x51f29b,_0x124883){var _0xb15a1a={'raw':!![],'where':{'id':_0x51f29b[_0xc25f('0x43')]['id']}},_0x529af5={};_0x529af5[_0xc25f('0x2b')]=_[_0xc25f('0x2d')](db[_0xc25f('0x27')][_0xc25f('0x28')]);_0x529af5[_0xc25f('0x2c')]=_[_0xc25f('0x2d')](_0x51f29b[_0xc25f('0x2c')]);_0x529af5[_0xc25f('0x2e')]=_['intersection'](_0x529af5[_0xc25f('0x2b')],_0x529af5[_0xc25f('0x2c')]);_0xb15a1a[_0xc25f('0x30')]=_['intersection'](_0x529af5[_0xc25f('0x2b')],qs[_0xc25f('0x44')](_0x51f29b[_0xc25f('0x2c')][_0xc25f('0x44')]));_0xb15a1a[_0xc25f('0x30')]=_0xb15a1a['attributes']['length']?_0xb15a1a[_0xc25f('0x30')]:_0x529af5[_0xc25f('0x2b')];if(_0x51f29b['query'][_0xc25f('0x3d')]){_0xb15a1a[_0xc25f('0x3e')]=[{'all':!![]}];}_0xb15a1a=_[_0xc25f('0x38')]({},_0xb15a1a,_0x51f29b['options']);return db[_0xc25f('0x27')][_0xc25f('0x45')](_0xb15a1a)[_0xc25f('0x20')](handleEntityNotFound(_0x124883,null))[_0xc25f('0x20')](respondWithResult(_0x124883,null))[_0xc25f('0x41')](handleError(_0x124883,null));};exports['create']=function(_0x1955f0,_0x58a5b6){return db[_0xc25f('0x27')][_0xc25f('0x46')](_0x1955f0[_0xc25f('0x47')],{})[_0xc25f('0x20')](respondWithResult(_0x58a5b6,0xc9))[_0xc25f('0x41')](handleError(_0x58a5b6,null));};exports[_0xc25f('0x1e')]=function(_0x4715e5,_0x4896b3){if(_0x4715e5[_0xc25f('0x47')]['id']){delete _0x4715e5['body']['id'];}return db[_0xc25f('0x27')][_0xc25f('0x45')]({'where':{'id':_0x4715e5[_0xc25f('0x43')]['id']}})['then'](handleEntityNotFound(_0x4896b3,null))[_0xc25f('0x20')](saveUpdates(_0x4715e5[_0xc25f('0x47')],null))[_0xc25f('0x20')](respondWithResult(_0x4896b3,null))[_0xc25f('0x41')](handleError(_0x4896b3,null));};exports[_0xc25f('0x1f')]=function(_0x5318c3,_0x47e1a9){return db[_0xc25f('0x27')]['find']({'where':{'id':_0x5318c3[_0xc25f('0x43')]['id']}})[_0xc25f('0x20')](handleEntityNotFound(_0x47e1a9,null))['then'](removeEntity(_0x47e1a9,null))[_0xc25f('0x41')](handleError(_0x47e1a9,null));};exports[_0xc25f('0x48')]=function(_0x5400a3,_0x2f5c89){return db[_0xc25f('0x27')]['describe']()[_0xc25f('0x20')](respondWithResult(_0x2f5c89,null))['catch'](handleError(_0x2f5c89,null));}; \ No newline at end of file +var _0x7128=['VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x5f4a51,_0x308b1d){var _0x40afc4=function(_0x417065){while(--_0x417065){_0x5f4a51['push'](_0x5f4a51['shift']());}};_0x40afc4(++_0x308b1d);}(_0x7128,0x1f2));var _0x8712=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x7128[_0x374ada];return _0x449ed8;};'use strict';var pdf=require(_0x8712('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8712('0x1'));var zipdir=require(_0x8712('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8712('0x3'));var BPromise=require(_0x8712('0x4'));var Mustache=require(_0x8712('0x5'));var util=require(_0x8712('0x6'));var path=require(_0x8712('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8712('0x8'));var fs=require('fs');var _=require(_0x8712('0x9'));var squel=require(_0x8712('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8712('0xb'));var Papa=require('papaparse');var Redis=require(_0x8712('0xc'));var authService=require(_0x8712('0xd'));var qs=require(_0x8712('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8712('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x8712('0x10'));var licenseUtil=require(_0x8712('0x11'));var db=require(_0x8712('0x12'))['db'];function respondWithStatusCode(_0xc862cb,_0x351a3c){_0x351a3c=_0x351a3c||0xcc;return function(_0x2b66a0){if(_0x2b66a0){return _0xc862cb['sendStatus'](_0x351a3c);}return _0xc862cb['status'](_0x351a3c)['end']();};}function respondWithResult(_0x3db415,_0x4b94d9){_0x4b94d9=_0x4b94d9||0xc8;return function(_0x15053d){if(_0x15053d){return _0x3db415['status'](_0x4b94d9)[_0x8712('0x13')](_0x15053d);}};}function respondWithFilteredResult(_0xc29f68,_0x12f0da){return function(_0x33f130){if(_0x33f130){var _0x1afc4f=_0x33f130[_0x8712('0x14')],_0xd6243c=_0x12f0da[_0x8712('0x15')],_0x154c95=_0x12f0da['offset']+_0x12f0da[_0x8712('0x16')],_0x392aab;if(_0x154c95>=_0x1afc4f){_0x154c95=_0x1afc4f;_0x392aab=0xc8;}else{_0x392aab=0xce;}_0xc29f68[_0x8712('0x17')](_0x392aab);return _0xc29f68[_0x8712('0x18')](_0x8712('0x19'),_0xd6243c+'-'+_0x154c95+'/'+_0x1afc4f)[_0x8712('0x13')](_0x33f130);}return null;};}function patchUpdates(_0x5c1169){return function(_0x45bb05){try{jsonpatch[_0x8712('0x1a')](_0x45bb05,_0x5c1169,!![]);}catch(_0x2b3998){return BPromise[_0x8712('0x1b')](_0x2b3998);}return _0x45bb05[_0x8712('0x1c')]();};}function saveUpdates(_0x5d3a02,_0x3333a5){return function(_0x3ecb9f){if(_0x3ecb9f){return _0x3ecb9f['update'](_0x5d3a02)[_0x8712('0x1d')](function(_0x345eab){return _0x345eab;});}return null;};}function removeEntity(_0x54cf7d,_0x1deec7){return function(_0x54a8a0){if(_0x54a8a0){return _0x54a8a0[_0x8712('0x1e')]()[_0x8712('0x1d')](function(){_0x54cf7d[_0x8712('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358c2e,_0x262203){return function(_0x347593){if(!_0x347593){_0x358c2e[_0x8712('0x1f')](0x194);}return _0x347593;};}function handleError(_0x5ba76d,_0x1f4cfb){_0x1f4cfb=_0x1f4cfb||0x1f4;return function(_0x43b28f){logger['error'](_0x43b28f[_0x8712('0x20')]);if(_0x43b28f[_0x8712('0x21')]){delete _0x43b28f[_0x8712('0x21')];}_0x5ba76d['status'](_0x1f4cfb)[_0x8712('0x22')](_0x43b28f);};}exports[_0x8712('0x23')]=function(_0x3a5ef9,_0x52fa8c){var _0x492440={},_0x26136c={},_0x53274b={'count':0x0,'rows':[]};var _0x4581af=_[_0x8712('0x24')](db['SmsQueueReport'][_0x8712('0x25')],function(_0x2f2e06){return{'name':_0x2f2e06['fieldName'],'type':_0x2f2e06[_0x8712('0x26')][_0x8712('0x27')]};});_0x26136c[_0x8712('0x28')]=_[_0x8712('0x24')](_0x4581af,_0x8712('0x21'));_0x26136c[_0x8712('0x29')]=_['keys'](_0x3a5ef9[_0x8712('0x29')]);_0x26136c[_0x8712('0x2a')]=_[_0x8712('0x2b')](_0x26136c[_0x8712('0x28')],_0x26136c[_0x8712('0x29')]);_0x492440[_0x8712('0x2c')]=_[_0x8712('0x2b')](_0x26136c[_0x8712('0x28')],qs[_0x8712('0x2d')](_0x3a5ef9[_0x8712('0x29')][_0x8712('0x2d')]));_0x492440[_0x8712('0x2c')]=_0x492440['attributes']['length']?_0x492440['attributes']:_0x26136c[_0x8712('0x28')];if(!_0x3a5ef9[_0x8712('0x29')][_0x8712('0x2e')](_0x8712('0x2f'))){_0x492440['limit']=qs['limit'](_0x3a5ef9[_0x8712('0x29')]['limit']);_0x492440[_0x8712('0x15')]=qs[_0x8712('0x15')](_0x3a5ef9[_0x8712('0x29')][_0x8712('0x15')]);}_0x492440[_0x8712('0x30')]=qs[_0x8712('0x31')](_0x3a5ef9[_0x8712('0x29')][_0x8712('0x31')]);_0x492440[_0x8712('0x32')]=qs['filters'](_[_0x8712('0x33')](_0x3a5ef9[_0x8712('0x29')],_0x26136c['filters']),_0x4581af);if(_0x3a5ef9['query'][_0x8712('0x34')]){_0x492440['where']=_[_0x8712('0x35')](_0x492440[_0x8712('0x32')],{'$or':_[_0x8712('0x24')](_0x4581af,function(_0x2c088e){if(_0x2c088e[_0x8712('0x26')]!==_0x8712('0x36')){var _0x252aa3={};_0x252aa3[_0x2c088e['name']]={'$like':'%'+_0x3a5ef9[_0x8712('0x29')][_0x8712('0x34')]+'%'};return _0x252aa3;}})});}_0x492440=_[_0x8712('0x35')]({},_0x492440,_0x3a5ef9[_0x8712('0x37')]);var _0x5b0c42={'where':_0x492440[_0x8712('0x32')]};return db[_0x8712('0x38')]['count'](_0x5b0c42)[_0x8712('0x1d')](function(_0x3feaf2){_0x53274b[_0x8712('0x14')]=_0x3feaf2;if(_0x3a5ef9[_0x8712('0x29')][_0x8712('0x39')]){_0x492440[_0x8712('0x3a')]=[{'all':!![]}];}return db[_0x8712('0x38')][_0x8712('0x3b')](_0x492440);})[_0x8712('0x1d')](function(_0x2dbec9){_0x53274b['rows']=_0x2dbec9;return _0x53274b;})[_0x8712('0x1d')](respondWithFilteredResult(_0x52fa8c,_0x492440))[_0x8712('0x3c')](handleError(_0x52fa8c,null));};exports[_0x8712('0x3d')]=function(_0x8cc6a5,_0x28a13d){var _0x495a6e={'raw':!![],'where':{'id':_0x8cc6a5[_0x8712('0x3e')]['id']}},_0x314c68={};_0x314c68[_0x8712('0x28')]=_[_0x8712('0x3f')](db[_0x8712('0x38')]['rawAttributes']);_0x314c68[_0x8712('0x29')]=_[_0x8712('0x3f')](_0x8cc6a5[_0x8712('0x29')]);_0x314c68[_0x8712('0x2a')]=_['intersection'](_0x314c68[_0x8712('0x28')],_0x314c68[_0x8712('0x29')]);_0x495a6e['attributes']=_[_0x8712('0x2b')](_0x314c68[_0x8712('0x28')],qs[_0x8712('0x2d')](_0x8cc6a5['query']['fields']));_0x495a6e[_0x8712('0x2c')]=_0x495a6e['attributes'][_0x8712('0x40')]?_0x495a6e[_0x8712('0x2c')]:_0x314c68[_0x8712('0x28')];if(_0x8cc6a5[_0x8712('0x29')][_0x8712('0x39')]){_0x495a6e[_0x8712('0x3a')]=[{'all':!![]}];}_0x495a6e=_[_0x8712('0x35')]({},_0x495a6e,_0x8cc6a5[_0x8712('0x37')]);return db[_0x8712('0x38')][_0x8712('0x41')](_0x495a6e)['then'](handleEntityNotFound(_0x28a13d,null))[_0x8712('0x1d')](respondWithResult(_0x28a13d,null))[_0x8712('0x3c')](handleError(_0x28a13d,null));};exports['create']=function(_0x36c6ca,_0x24eaa7){return db[_0x8712('0x38')][_0x8712('0x42')](_0x36c6ca['body'],{})[_0x8712('0x1d')](respondWithResult(_0x24eaa7,0xc9))[_0x8712('0x3c')](handleError(_0x24eaa7,null));};exports['update']=function(_0x4943c0,_0xf7811b){if(_0x4943c0[_0x8712('0x43')]['id']){delete _0x4943c0[_0x8712('0x43')]['id'];}return db[_0x8712('0x38')][_0x8712('0x41')]({'where':{'id':_0x4943c0[_0x8712('0x3e')]['id']}})[_0x8712('0x1d')](handleEntityNotFound(_0xf7811b,null))[_0x8712('0x1d')](saveUpdates(_0x4943c0[_0x8712('0x43')],null))[_0x8712('0x1d')](respondWithResult(_0xf7811b,null))[_0x8712('0x3c')](handleError(_0xf7811b,null));};exports[_0x8712('0x1e')]=function(_0x1a401f,_0x3ae6c9){return db['SmsQueueReport'][_0x8712('0x41')]({'where':{'id':_0x1a401f[_0x8712('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ae6c9,null))[_0x8712('0x1d')](removeEntity(_0x3ae6c9,null))[_0x8712('0x3c')](handleError(_0x3ae6c9,null));};exports[_0x8712('0x44')]=function(_0x6e9e80,_0x4bef78){return db['SmsQueueReport'][_0x8712('0x44')]()[_0x8712('0x1d')](respondWithResult(_0x4bef78,null))[_0x8712('0x3c')](handleError(_0x4bef78,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c3f20b5..6cc2ff3 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 _0xb281=['request-promise','path','../../config/environment','report_sms_queue','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb281,0x176));var _0x1b28=function(_0x5de803,_0x13f995){_0x5de803=_0x5de803-0x0;var _0x500c7a=_0xb281[_0x5de803];return _0x500c7a;};'use strict';var _=require(_0x1b28('0x0'));var util=require('util');var logger=require(_0x1b28('0x1'))('api');var moment=require(_0x1b28('0x2'));var BPromise=require(_0x1b28('0x3'));var rp=require(_0x1b28('0x4'));var fs=require('fs');var path=require(_0x1b28('0x5'));var rimraf=require('rimraf');var config=require(_0x1b28('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x55d854,_0x32b49c){return _0x55d854['define']('SmsQueueReport',attributes,{'tableName':_0x1b28('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1b28('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0582=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger'];(function(_0x1e2ea7,_0x3f0d7f){var _0x28b7e9=function(_0x196bc1){while(--_0x196bc1){_0x1e2ea7['push'](_0x1e2ea7['shift']());}};_0x28b7e9(++_0x3f0d7f);}(_0x0582,0x150));var _0x2058=function(_0x42eba8,_0x495794){_0x42eba8=_0x42eba8-0x0;var _0x2e42cc=_0x0582[_0x42eba8];return _0x2e42cc;};'use strict';var _=require('lodash');var util=require(_0x2058('0x0'));var logger=require(_0x2058('0x1'))(_0x2058('0x2'));var moment=require(_0x2058('0x3'));var BPromise=require(_0x2058('0x4'));var rp=require(_0x2058('0x5'));var fs=require('fs');var path=require(_0x2058('0x6'));var rimraf=require(_0x2058('0x7'));var config=require(_0x2058('0x8'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0xd30a13,_0x260ff4){return _0xd30a13[_0x2058('0x9')](_0x2058('0xa'),attributes,{'tableName':_0x2058('0xb'),'paranoid':![],'indexes':[{'name':_0x2058('0xc'),'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 e8e2004..fb67820 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 _0xef16=['request\x20sent','stringify','error','code','message','catch','SmsQueueReport','body','options','info','CreateSmsQueueReport','debug','UpdateSmsQueueReport','where','attributes','lodash','util','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x17ba7d,_0x3d1ace){var _0x8fd171=function(_0xc08d1f){while(--_0xc08d1f){_0x17ba7d['push'](_0x17ba7d['shift']());}};_0x8fd171(++_0x3d1ace);}(_0xef16,0x15f));var _0x6ef1=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xef16[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x6ef1('0x0'));var util=require(_0x6ef1('0x1'));var moment=require(_0x6ef1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ef1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6ef1('0x4'));var config=require(_0x6ef1('0x5'));var jayson=require(_0x6ef1('0x6'));var client=jayson[_0x6ef1('0x7')][_0x6ef1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x321631,_0x4f5628,_0x27f99e){return new BPromise(function(_0xdc226c,_0x290659){return client[_0x6ef1('0x9')](_0x321631,_0x27f99e)[_0x6ef1('0xa')](function(_0x3e5cad){logger['info'](_0x6ef1('0xb'),_0x4f5628,'request\x20sent');logger['debug'](_0x6ef1('0xc'),_0x4f5628,_0x6ef1('0xd'),JSON[_0x6ef1('0xe')](_0x3e5cad));if(_0x3e5cad['error']){if(_0x3e5cad[_0x6ef1('0xf')][_0x6ef1('0x10')]===0x1f4){logger[_0x6ef1('0xf')](_0x6ef1('0xb'),_0x4f5628,_0x3e5cad['error'][_0x6ef1('0x11')]);return _0x290659(_0x3e5cad[_0x6ef1('0xf')]['message']);}logger[_0x6ef1('0xf')](_0x6ef1('0xb'),_0x4f5628,_0x3e5cad[_0x6ef1('0xf')][_0x6ef1('0x11')]);return _0xdc226c(_0x3e5cad[_0x6ef1('0xf')][_0x6ef1('0x11')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x4f5628,'request\x20sent');_0xdc226c(_0x3e5cad['result'][_0x6ef1('0x11')]);}})[_0x6ef1('0x12')](function(_0x4eb020){logger['error'](_0x6ef1('0xb'),_0x4f5628,_0x4eb020);_0x290659(_0x4eb020);});});}exports['CreateSmsQueueReport']=function(_0x33ef24){var _0x51a2e4=this;return new Promise(function(_0x30d84f,_0xaebe69){return db[_0x6ef1('0x13')]['create'](_0x33ef24[_0x6ef1('0x14')],{'raw':_0x33ef24[_0x6ef1('0x15')]?_0x33ef24['options']['raw']===undefined?!![]:![]:!![]})[_0x6ef1('0xa')](function(_0x17fdb6){logger[_0x6ef1('0x16')](_0x6ef1('0x17'),_0x33ef24);logger[_0x6ef1('0x18')](_0x6ef1('0x17'),_0x33ef24,JSON[_0x6ef1('0xe')](_0x17fdb6));_0x30d84f(_0x17fdb6);})[_0x6ef1('0x12')](function(_0x16fac4){logger[_0x6ef1('0xf')](_0x6ef1('0x17'),_0x16fac4[_0x6ef1('0x11')],_0x33ef24);_0xaebe69(_0x51a2e4['error'](0x1f4,_0x16fac4[_0x6ef1('0x11')]));});});};exports[_0x6ef1('0x19')]=function(_0x3ca0b7){var _0x1e21ea=this;return new Promise(function(_0x5cc22b,_0x7080ac){return db[_0x6ef1('0x13')]['update'](_0x3ca0b7['body'],{'raw':_0x3ca0b7[_0x6ef1('0x15')]?_0x3ca0b7[_0x6ef1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ca0b7[_0x6ef1('0x15')]?_0x3ca0b7[_0x6ef1('0x15')][_0x6ef1('0x1a')]||null:null,'attributes':_0x3ca0b7[_0x6ef1('0x15')]?_0x3ca0b7[_0x6ef1('0x15')][_0x6ef1('0x1b')]||null:null,'limit':_0x3ca0b7[_0x6ef1('0x15')]?_0x3ca0b7[_0x6ef1('0x15')]['limit']||null:null})[_0x6ef1('0xa')](function(_0x53773d){logger[_0x6ef1('0x16')](_0x6ef1('0x19'),_0x3ca0b7);logger['debug'](_0x6ef1('0x19'),_0x3ca0b7,JSON[_0x6ef1('0xe')](_0x53773d));_0x5cc22b(_0x53773d);})[_0x6ef1('0x12')](function(_0x37f385){logger[_0x6ef1('0xf')](_0x6ef1('0x19'),_0x37f385['message'],_0x3ca0b7);_0x7080ac(_0x1e21ea[_0x6ef1('0xf')](0x1f4,_0x37f385[_0x6ef1('0x11')]));});});}; \ No newline at end of file +var _0x7fd1=['../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','raw','stringify','UpdateSmsQueueReport','options','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b90f6,_0x4df258){var _0x45040f=function(_0x1276f5){while(--_0x1276f5){_0x5b90f6['push'](_0x5b90f6['shift']());}};_0x45040f(++_0x4df258);}(_0x7fd1,0x156));var _0x17fd=function(_0x28570c,_0x22eef4){_0x28570c=_0x28570c-0x0;var _0x445b26=_0x7fd1[_0x28570c];return _0x445b26;};'use strict';var _=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var moment=require(_0x17fd('0x2'));var BPromise=require(_0x17fd('0x3'));var rs=require(_0x17fd('0x4'));var fs=require('fs');var Redis=require(_0x17fd('0x5'));var db=require(_0x17fd('0x6'))['db'];var utils=require(_0x17fd('0x7'));var logger=require(_0x17fd('0x8'))(_0x17fd('0x9'));var config=require(_0x17fd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x17fd('0xb')][_0x17fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dc47b,_0x4073dd,_0x52c022){return new BPromise(function(_0x279071,_0x48669e){return client[_0x17fd('0xd')](_0x2dc47b,_0x52c022)[_0x17fd('0xe')](function(_0xc2aba0){logger[_0x17fd('0xf')](_0x17fd('0x10'),_0x4073dd,_0x17fd('0x11'));logger[_0x17fd('0x12')](_0x17fd('0x13'),_0x4073dd,'request\x20sent',JSON['stringify'](_0xc2aba0));if(_0xc2aba0[_0x17fd('0x14')]){if(_0xc2aba0[_0x17fd('0x14')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x4073dd,_0xc2aba0['error'][_0x17fd('0x15')]);return _0x48669e(_0xc2aba0[_0x17fd('0x14')]['message']);}logger[_0x17fd('0x14')](_0x17fd('0x10'),_0x4073dd,_0xc2aba0[_0x17fd('0x14')][_0x17fd('0x15')]);return _0x279071(_0xc2aba0['error'][_0x17fd('0x15')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x4073dd,_0x17fd('0x11'));_0x279071(_0xc2aba0['result'][_0x17fd('0x15')]);}})[_0x17fd('0x16')](function(_0x546393){logger[_0x17fd('0x14')](_0x17fd('0x10'),_0x4073dd,_0x546393);_0x48669e(_0x546393);});});}exports[_0x17fd('0x17')]=function(_0x26781d){var _0x11bcbf=this;return new Promise(function(_0x196c2e,_0xb4c614){return db[_0x17fd('0x18')][_0x17fd('0x19')](_0x26781d[_0x17fd('0x1a')],{'raw':_0x26781d['options']?_0x26781d['options'][_0x17fd('0x1b')]===undefined?!![]:![]:!![]})[_0x17fd('0xe')](function(_0x472b30){logger[_0x17fd('0xf')]('CreateSmsQueueReport',_0x26781d);logger[_0x17fd('0x12')](_0x17fd('0x17'),_0x26781d,JSON[_0x17fd('0x1c')](_0x472b30));_0x196c2e(_0x472b30);})['catch'](function(_0x2138a7){logger[_0x17fd('0x14')](_0x17fd('0x17'),_0x2138a7[_0x17fd('0x15')],_0x26781d);_0xb4c614(_0x11bcbf[_0x17fd('0x14')](0x1f4,_0x2138a7[_0x17fd('0x15')]));});});};exports[_0x17fd('0x1d')]=function(_0x3600fe){var _0x552238=this;return new Promise(function(_0x4c2151,_0x379d95){return db['SmsQueueReport']['update'](_0x3600fe[_0x17fd('0x1a')],{'raw':_0x3600fe[_0x17fd('0x1e')]?_0x3600fe['options'][_0x17fd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3600fe['options']?_0x3600fe['options'][_0x17fd('0x1f')]||null:null,'attributes':_0x3600fe['options']?_0x3600fe[_0x17fd('0x1e')]['attributes']||null:null,'limit':_0x3600fe[_0x17fd('0x1e')]?_0x3600fe[_0x17fd('0x1e')]['limit']||null:null})[_0x17fd('0xe')](function(_0x3dcc95){logger['info'](_0x17fd('0x1d'),_0x3600fe);logger[_0x17fd('0x12')](_0x17fd('0x1d'),_0x3600fe,JSON['stringify'](_0x3dcc95));_0x4c2151(_0x3dcc95);})[_0x17fd('0x16')](function(_0x5c5562){logger['error'](_0x17fd('0x1d'),_0x5c5562[_0x17fd('0x15')],_0x3600fe);_0x379d95(_0x552238[_0x17fd('0x14')](0x1f4,_0x5c5562[_0x17fd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3b57dbb..3ae771b 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 _0x9ffd=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer'];(function(_0x4ba52d,_0x27a93a){var _0x2cabce=function(_0x3cc872){while(--_0x3cc872){_0x4ba52d['push'](_0x4ba52d['shift']());}};_0x2cabce(++_0x27a93a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x479a41,_0x556675){_0x479a41=_0x479a41-0x0;var _0xc7ca7c=_0x9ffd[_0x479a41];return _0xc7ca7c;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0xbdb7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','post','isAuthenticated','create','put','update','delete','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xbdb7[_0x575446];return _0x2fb644;};'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('./smsTransferReport.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0xc')]('/',auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0xf')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7bdb('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 85d16e5..d3b14f5 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 _0x155c=['queue','DATE','NOW','moment','exports','STRING','account','agent'];(function(_0x28e96c,_0x2d75ed){var _0x1db3d5=function(_0x101ebd){while(--_0x101ebd){_0x28e96c['push'](_0x28e96c['shift']());}};_0x1db3d5(++_0x2d75ed);}(_0x155c,0x1b3));var _0xc155=function(_0x3dbed3,_0x25fd47){_0x3dbed3=_0x3dbed3-0x0;var _0x232114=_0x155c[_0x3dbed3];return _0x232114;};'use strict';var moment=require(_0xc155('0x0'));var Sequelize=require('sequelize');module[_0xc155('0x1')]={'uniqueid':{'type':Sequelize[_0xc155('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc155('0x3'),_0xc155('0x4'),'queue'),'allowNull':![],'defaultValue':_0xc155('0x5')},'transferredAt':{'type':Sequelize[_0xc155('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc155('0x7')]}}; \ No newline at end of file +var _0x82d3=['NOW','sequelize','exports','ENUM','account','queue'];(function(_0x1d89c0,_0x5bbd8b){var _0x334179=function(_0xf61f3d){while(--_0xf61f3d){_0x1d89c0['push'](_0x1d89c0['shift']());}};_0x334179(++_0x5bbd8b);}(_0x82d3,0x12d));var _0x382d=function(_0x142358,_0x37e36e){_0x142358=_0x142358-0x0;var _0x1db168=_0x82d3[_0x142358];return _0x1db168;};'use strict';var moment=require('moment');var Sequelize=require(_0x382d('0x0'));module[_0x382d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x382d('0x2')](_0x382d('0x3'),'agent',_0x382d('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x382d('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ee2a450..2cb6486 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 _0xe2cc=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName'];(function(_0x1a0b13,_0xbbfd56){var _0x5a569a=function(_0x5c1469){while(--_0x5c1469){_0x1a0b13['push'](_0x1a0b13['shift']());}};_0x5a569a(++_0xbbfd56);}(_0xe2cc,0x69));var _0xce2c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe2cc[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0xce2c('0x0'));var emlformat=require(_0xce2c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xce2c('0x2'));var rp=require(_0xce2c('0x3'));var moment=require(_0xce2c('0x4'));var BPromise=require(_0xce2c('0x5'));var Mustache=require(_0xce2c('0x6'));var util=require(_0xce2c('0x7'));var path=require(_0xce2c('0x8'));var sox=require(_0xce2c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xce2c('0xa'));var squel=require(_0xce2c('0xb'));var crypto=require(_0xce2c('0xc'));var jsforce=require(_0xce2c('0xd'));var deskjs=require(_0xce2c('0xe'));var toCsv=require(_0xce2c('0xf'));var querystring=require('querystring');var Papa=require(_0xce2c('0x10'));var Redis=require(_0xce2c('0x11'));var authService=require(_0xce2c('0x12'));var qs=require(_0xce2c('0x13'));var as=require(_0xce2c('0x14'));var hardwareService=require(_0xce2c('0x15'));var logger=require(_0xce2c('0x16'))(_0xce2c('0x17'));var utils=require(_0xce2c('0x18'));var config=require(_0xce2c('0x19'));var licenseUtil=require(_0xce2c('0x1a'));var db=require(_0xce2c('0x1b'))['db'];function respondWithStatusCode(_0x2f3b17,_0x27928d){_0x27928d=_0x27928d||0xcc;return function(_0x2421f6){if(_0x2421f6){return _0x2f3b17['sendStatus'](_0x27928d);}return _0x2f3b17['status'](_0x27928d)[_0xce2c('0x1c')]();};}function respondWithResult(_0x57c898,_0x214c62){_0x214c62=_0x214c62||0xc8;return function(_0x179855){if(_0x179855){return _0x57c898[_0xce2c('0x1d')](_0x214c62)[_0xce2c('0x1e')](_0x179855);}};}function respondWithFilteredResult(_0x4873e6,_0xb99213){return function(_0x1c3046){if(_0x1c3046){var _0x146830=_0x1c3046[_0xce2c('0x1f')],_0x46a5b5=_0xb99213['offset'],_0x45a8b0=_0xb99213[_0xce2c('0x20')]+_0xb99213[_0xce2c('0x21')],_0x35136f;if(_0x45a8b0>=_0x146830){_0x45a8b0=_0x146830;_0x35136f=0xc8;}else{_0x35136f=0xce;}_0x4873e6[_0xce2c('0x1d')](_0x35136f);return _0x4873e6[_0xce2c('0x22')](_0xce2c('0x23'),_0x46a5b5+'-'+_0x45a8b0+'/'+_0x146830)['json'](_0x1c3046);}return null;};}function patchUpdates(_0x248ab8){return function(_0xcc8a80){try{jsonpatch['apply'](_0xcc8a80,_0x248ab8,!![]);}catch(_0x534f88){return BPromise[_0xce2c('0x24')](_0x534f88);}return _0xcc8a80[_0xce2c('0x25')]();};}function saveUpdates(_0x43ee21,_0x2f409c){return function(_0x121836){if(_0x121836){return _0x121836[_0xce2c('0x26')](_0x43ee21)[_0xce2c('0x27')](function(_0x4b6835){return _0x4b6835;});}return null;};}function removeEntity(_0x30380e,_0xb8057b){return function(_0x399f67){if(_0x399f67){return _0x399f67[_0xce2c('0x28')]()[_0xce2c('0x27')](function(){_0x30380e[_0xce2c('0x1d')](0xcc)[_0xce2c('0x1c')]();});}};}function handleEntityNotFound(_0x39880d,_0x451e86){return function(_0x1d6e55){if(!_0x1d6e55){_0x39880d['sendStatus'](0x194);}return _0x1d6e55;};}function handleError(_0x452cfa,_0x2bb049){_0x2bb049=_0x2bb049||0x1f4;return function(_0x333471){logger[_0xce2c('0x29')](_0x333471[_0xce2c('0x2a')]);if(_0x333471[_0xce2c('0x2b')]){delete _0x333471['name'];}_0x452cfa[_0xce2c('0x1d')](_0x2bb049)['send'](_0x333471);};}exports[_0xce2c('0x2c')]=function(_0x1aea2c,_0xbb1756){var _0x2b6ce6={},_0x3c4735={},_0x19846d={'count':0x0,'rows':[]};var _0x253ca2=_[_0xce2c('0x2d')](db[_0xce2c('0x2e')][_0xce2c('0x2f')],function(_0x4358ee){return{'name':_0x4358ee[_0xce2c('0x30')],'type':_0x4358ee[_0xce2c('0x31')]['key']};});_0x3c4735[_0xce2c('0x32')]=_[_0xce2c('0x2d')](_0x253ca2,_0xce2c('0x2b'));_0x3c4735[_0xce2c('0x33')]=_[_0xce2c('0x34')](_0x1aea2c['query']);_0x3c4735[_0xce2c('0x35')]=_[_0xce2c('0x36')](_0x3c4735['model'],_0x3c4735[_0xce2c('0x33')]);_0x2b6ce6[_0xce2c('0x37')]=_[_0xce2c('0x36')](_0x3c4735[_0xce2c('0x32')],qs[_0xce2c('0x38')](_0x1aea2c['query'][_0xce2c('0x38')]));_0x2b6ce6['attributes']=_0x2b6ce6[_0xce2c('0x37')][_0xce2c('0x39')]?_0x2b6ce6['attributes']:_0x3c4735[_0xce2c('0x32')];if(!_0x1aea2c[_0xce2c('0x33')][_0xce2c('0x3a')](_0xce2c('0x3b'))){_0x2b6ce6['limit']=qs[_0xce2c('0x21')](_0x1aea2c[_0xce2c('0x33')]['limit']);_0x2b6ce6[_0xce2c('0x20')]=qs[_0xce2c('0x20')](_0x1aea2c[_0xce2c('0x33')][_0xce2c('0x20')]);}_0x2b6ce6[_0xce2c('0x3c')]=qs[_0xce2c('0x3d')](_0x1aea2c[_0xce2c('0x33')][_0xce2c('0x3d')]);_0x2b6ce6['where']=qs[_0xce2c('0x35')](_[_0xce2c('0x3e')](_0x1aea2c['query'],_0x3c4735[_0xce2c('0x35')]),_0x253ca2);if(_0x1aea2c[_0xce2c('0x33')][_0xce2c('0x3f')]){_0x2b6ce6[_0xce2c('0x40')]=_[_0xce2c('0x41')](_0x2b6ce6[_0xce2c('0x40')],{'$or':_[_0xce2c('0x2d')](_0x253ca2,function(_0x2ac63d){if(_0x2ac63d[_0xce2c('0x31')]!==_0xce2c('0x42')){var _0x2624dc={};_0x2624dc[_0x2ac63d['name']]={'$like':'%'+_0x1aea2c[_0xce2c('0x33')][_0xce2c('0x3f')]+'%'};return _0x2624dc;}})});}_0x2b6ce6=_[_0xce2c('0x41')]({},_0x2b6ce6,_0x1aea2c[_0xce2c('0x43')]);var _0x317dce={'where':_0x2b6ce6[_0xce2c('0x40')]};return db[_0xce2c('0x2e')][_0xce2c('0x1f')](_0x317dce)[_0xce2c('0x27')](function(_0x2a4775){_0x19846d[_0xce2c('0x1f')]=_0x2a4775;if(_0x1aea2c[_0xce2c('0x33')][_0xce2c('0x44')]){_0x2b6ce6[_0xce2c('0x45')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x2b6ce6);})['then'](function(_0x56fc63){_0x19846d[_0xce2c('0x46')]=_0x56fc63;return _0x19846d;})[_0xce2c('0x27')](respondWithFilteredResult(_0xbb1756,_0x2b6ce6))['catch'](handleError(_0xbb1756,null));};exports['show']=function(_0xe4cad9,_0x29a022){var _0x7577c7={'raw':!![],'where':{'id':_0xe4cad9[_0xce2c('0x47')]['id']}},_0x345da3={};_0x345da3[_0xce2c('0x32')]=_[_0xce2c('0x34')](db[_0xce2c('0x2e')]['rawAttributes']);_0x345da3[_0xce2c('0x33')]=_[_0xce2c('0x34')](_0xe4cad9[_0xce2c('0x33')]);_0x345da3['filters']=_[_0xce2c('0x36')](_0x345da3[_0xce2c('0x32')],_0x345da3['query']);_0x7577c7['attributes']=_[_0xce2c('0x36')](_0x345da3[_0xce2c('0x32')],qs['fields'](_0xe4cad9['query']['fields']));_0x7577c7[_0xce2c('0x37')]=_0x7577c7[_0xce2c('0x37')]['length']?_0x7577c7[_0xce2c('0x37')]:_0x345da3[_0xce2c('0x32')];if(_0xe4cad9['query']['includeAll']){_0x7577c7['include']=[{'all':!![]}];}_0x7577c7=_[_0xce2c('0x41')]({},_0x7577c7,_0xe4cad9['options']);return db[_0xce2c('0x2e')][_0xce2c('0x48')](_0x7577c7)['then'](handleEntityNotFound(_0x29a022,null))[_0xce2c('0x27')](respondWithResult(_0x29a022,null))[_0xce2c('0x49')](handleError(_0x29a022,null));};exports[_0xce2c('0x4a')]=function(_0x103a2a,_0x4e72fe){return db[_0xce2c('0x2e')][_0xce2c('0x4a')](_0x103a2a[_0xce2c('0x4b')],{})['then'](respondWithResult(_0x4e72fe,0xc9))[_0xce2c('0x49')](handleError(_0x4e72fe,null));};exports[_0xce2c('0x26')]=function(_0x535b66,_0x1d040b){if(_0x535b66['body']['id']){delete _0x535b66[_0xce2c('0x4b')]['id'];}return db[_0xce2c('0x2e')][_0xce2c('0x48')]({'where':{'id':_0x535b66[_0xce2c('0x47')]['id']}})[_0xce2c('0x27')](handleEntityNotFound(_0x1d040b,null))[_0xce2c('0x27')](saveUpdates(_0x535b66['body'],null))[_0xce2c('0x27')](respondWithResult(_0x1d040b,null))[_0xce2c('0x49')](handleError(_0x1d040b,null));};exports[_0xce2c('0x28')]=function(_0x2644c2,_0x4621be){return db[_0xce2c('0x2e')][_0xce2c('0x48')]({'where':{'id':_0x2644c2[_0xce2c('0x47')]['id']}})[_0xce2c('0x27')](handleEntityNotFound(_0x4621be,null))[_0xce2c('0x27')](removeEntity(_0x4621be,null))[_0xce2c('0x49')](handleError(_0x4621be,null));};exports[_0xce2c('0x4c')]=function(_0x3c2268,_0x4c3ef1){return db['SmsTransferReport']['describe']()[_0xce2c('0x27')](respondWithResult(_0x4c3ef1,null))[_0xce2c('0x49')](handleError(_0x4c3ef1,null));}; \ No newline at end of file +var _0x4bd1=['sort','where','filters','filter','merge','includeAll','include','catch','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','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','count','offset','set','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','limit'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0x4bd1,0x90));var _0x14bd=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x4bd1[_0x5d80de];return _0x1c7556;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x14bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14bd('0x1'));var jsonpatch=require(_0x14bd('0x2'));var rp=require('request-promise');var moment=require(_0x14bd('0x3'));var BPromise=require(_0x14bd('0x4'));var Mustache=require('mustache');var util=require(_0x14bd('0x5'));var path=require(_0x14bd('0x6'));var sox=require(_0x14bd('0x7'));var csv=require(_0x14bd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x14bd('0x9'));var squel=require(_0x14bd('0xa'));var crypto=require(_0x14bd('0xb'));var jsforce=require(_0x14bd('0xc'));var deskjs=require(_0x14bd('0xd'));var toCsv=require(_0x14bd('0x8'));var querystring=require(_0x14bd('0xe'));var Papa=require(_0x14bd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14bd('0x10'));var hardwareService=require(_0x14bd('0x11'));var logger=require(_0x14bd('0x12'))('api');var utils=require(_0x14bd('0x13'));var config=require(_0x14bd('0x14'));var licenseUtil=require(_0x14bd('0x15'));var db=require(_0x14bd('0x16'))['db'];function respondWithStatusCode(_0x29475f,_0x316e4e){_0x316e4e=_0x316e4e||0xcc;return function(_0x12f60a){if(_0x12f60a){return _0x29475f[_0x14bd('0x17')](_0x316e4e);}return _0x29475f['status'](_0x316e4e)[_0x14bd('0x18')]();};}function respondWithResult(_0x567356,_0x3ee1b9){_0x3ee1b9=_0x3ee1b9||0xc8;return function(_0x47e495){if(_0x47e495){return _0x567356[_0x14bd('0x19')](_0x3ee1b9)[_0x14bd('0x1a')](_0x47e495);}};}function respondWithFilteredResult(_0x5b9470,_0x3797d9){return function(_0x49ed59){if(_0x49ed59){var _0x10e47e=_0x49ed59[_0x14bd('0x1b')],_0x6579a9=_0x3797d9[_0x14bd('0x1c')],_0x3833ed=_0x3797d9['offset']+_0x3797d9['limit'],_0x1853ba;if(_0x3833ed>=_0x10e47e){_0x3833ed=_0x10e47e;_0x1853ba=0xc8;}else{_0x1853ba=0xce;}_0x5b9470[_0x14bd('0x19')](_0x1853ba);return _0x5b9470[_0x14bd('0x1d')]('Content-Range',_0x6579a9+'-'+_0x3833ed+'/'+_0x10e47e)['json'](_0x49ed59);}return null;};}function patchUpdates(_0x1f09fa){return function(_0x24a5a3){try{jsonpatch['apply'](_0x24a5a3,_0x1f09fa,!![]);}catch(_0x338962){return BPromise['reject'](_0x338962);}return _0x24a5a3[_0x14bd('0x1e')]();};}function saveUpdates(_0x568a21,_0x792fdb){return function(_0x5cf869){if(_0x5cf869){return _0x5cf869[_0x14bd('0x1f')](_0x568a21)[_0x14bd('0x20')](function(_0x38eac5){return _0x38eac5;});}return null;};}function removeEntity(_0x521e3d,_0x253e93){return function(_0x28b06c){if(_0x28b06c){return _0x28b06c[_0x14bd('0x21')]()['then'](function(){_0x521e3d[_0x14bd('0x19')](0xcc)[_0x14bd('0x18')]();});}};}function handleEntityNotFound(_0xe011b3,_0x4afb0e){return function(_0x58a44c){if(!_0x58a44c){_0xe011b3['sendStatus'](0x194);}return _0x58a44c;};}function handleError(_0x2495d2,_0x2dd5fe){_0x2dd5fe=_0x2dd5fe||0x1f4;return function(_0x67d318){logger[_0x14bd('0x22')](_0x67d318[_0x14bd('0x23')]);if(_0x67d318[_0x14bd('0x24')]){delete _0x67d318[_0x14bd('0x24')];}_0x2495d2[_0x14bd('0x19')](_0x2dd5fe)[_0x14bd('0x25')](_0x67d318);};}exports['index']=function(_0x1112f0,_0x424c74){var _0x4be185={},_0x18d834={},_0x5e4306={'count':0x0,'rows':[]};var _0x4d5760=_[_0x14bd('0x26')](db[_0x14bd('0x27')][_0x14bd('0x28')],function(_0x1c51ac){return{'name':_0x1c51ac['fieldName'],'type':_0x1c51ac[_0x14bd('0x29')][_0x14bd('0x2a')]};});_0x18d834[_0x14bd('0x2b')]=_[_0x14bd('0x26')](_0x4d5760,_0x14bd('0x24'));_0x18d834[_0x14bd('0x2c')]=_['keys'](_0x1112f0[_0x14bd('0x2c')]);_0x18d834['filters']=_[_0x14bd('0x2d')](_0x18d834[_0x14bd('0x2b')],_0x18d834[_0x14bd('0x2c')]);_0x4be185[_0x14bd('0x2e')]=_[_0x14bd('0x2d')](_0x18d834[_0x14bd('0x2b')],qs[_0x14bd('0x2f')](_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x2f')]));_0x4be185[_0x14bd('0x2e')]=_0x4be185[_0x14bd('0x2e')][_0x14bd('0x30')]?_0x4be185[_0x14bd('0x2e')]:_0x18d834[_0x14bd('0x2b')];if(!_0x1112f0[_0x14bd('0x2c')]['hasOwnProperty'](_0x14bd('0x31'))){_0x4be185['limit']=qs[_0x14bd('0x32')](_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x32')]);_0x4be185[_0x14bd('0x1c')]=qs[_0x14bd('0x1c')](_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x1c')]);}_0x4be185['order']=qs[_0x14bd('0x33')](_0x1112f0[_0x14bd('0x2c')]['sort']);_0x4be185[_0x14bd('0x34')]=qs[_0x14bd('0x35')](_['pick'](_0x1112f0['query'],_0x18d834[_0x14bd('0x35')]),_0x4d5760);if(_0x1112f0['query'][_0x14bd('0x36')]){_0x4be185[_0x14bd('0x34')]=_[_0x14bd('0x37')](_0x4be185[_0x14bd('0x34')],{'$or':_[_0x14bd('0x26')](_0x4d5760,function(_0x58d4c5){if(_0x58d4c5[_0x14bd('0x29')]!=='VIRTUAL'){var _0x3204d5={};_0x3204d5[_0x58d4c5['name']]={'$like':'%'+_0x1112f0[_0x14bd('0x2c')]['filter']+'%'};return _0x3204d5;}})});}_0x4be185=_[_0x14bd('0x37')]({},_0x4be185,_0x1112f0['options']);var _0x44ee87={'where':_0x4be185[_0x14bd('0x34')]};return db[_0x14bd('0x27')][_0x14bd('0x1b')](_0x44ee87)[_0x14bd('0x20')](function(_0xe913b1){_0x5e4306[_0x14bd('0x1b')]=_0xe913b1;if(_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x38')]){_0x4be185[_0x14bd('0x39')]=[{'all':!![]}];}return db[_0x14bd('0x27')]['findAll'](_0x4be185);})['then'](function(_0x5c4f69){_0x5e4306['rows']=_0x5c4f69;return _0x5e4306;})[_0x14bd('0x20')](respondWithFilteredResult(_0x424c74,_0x4be185))[_0x14bd('0x3a')](handleError(_0x424c74,null));};exports['show']=function(_0x3456c1,_0x1b4159){var _0x5ca724={'raw':!![],'where':{'id':_0x3456c1[_0x14bd('0x3b')]['id']}},_0x20fa19={};_0x20fa19['model']=_['keys'](db['SmsTransferReport'][_0x14bd('0x28')]);_0x20fa19[_0x14bd('0x2c')]=_['keys'](_0x3456c1[_0x14bd('0x2c')]);_0x20fa19['filters']=_['intersection'](_0x20fa19[_0x14bd('0x2b')],_0x20fa19[_0x14bd('0x2c')]);_0x5ca724[_0x14bd('0x2e')]=_['intersection'](_0x20fa19[_0x14bd('0x2b')],qs[_0x14bd('0x2f')](_0x3456c1['query'][_0x14bd('0x2f')]));_0x5ca724[_0x14bd('0x2e')]=_0x5ca724[_0x14bd('0x2e')]['length']?_0x5ca724[_0x14bd('0x2e')]:_0x20fa19[_0x14bd('0x2b')];if(_0x3456c1[_0x14bd('0x2c')][_0x14bd('0x38')]){_0x5ca724['include']=[{'all':!![]}];}_0x5ca724=_[_0x14bd('0x37')]({},_0x5ca724,_0x3456c1[_0x14bd('0x3c')]);return db[_0x14bd('0x27')]['find'](_0x5ca724)[_0x14bd('0x20')](handleEntityNotFound(_0x1b4159,null))[_0x14bd('0x20')](respondWithResult(_0x1b4159,null))[_0x14bd('0x3a')](handleError(_0x1b4159,null));};exports[_0x14bd('0x3d')]=function(_0x3dcf14,_0x33d2cc){return db[_0x14bd('0x27')][_0x14bd('0x3d')](_0x3dcf14[_0x14bd('0x3e')],{})[_0x14bd('0x20')](respondWithResult(_0x33d2cc,0xc9))[_0x14bd('0x3a')](handleError(_0x33d2cc,null));};exports['update']=function(_0x595093,_0x47cba4){if(_0x595093[_0x14bd('0x3e')]['id']){delete _0x595093[_0x14bd('0x3e')]['id'];}return db[_0x14bd('0x27')]['find']({'where':{'id':_0x595093[_0x14bd('0x3b')]['id']}})[_0x14bd('0x20')](handleEntityNotFound(_0x47cba4,null))['then'](saveUpdates(_0x595093['body'],null))[_0x14bd('0x20')](respondWithResult(_0x47cba4,null))[_0x14bd('0x3a')](handleError(_0x47cba4,null));};exports['destroy']=function(_0x5966ac,_0x1b85ab){return db[_0x14bd('0x27')][_0x14bd('0x3f')]({'where':{'id':_0x5966ac[_0x14bd('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1b85ab,null))[_0x14bd('0x20')](removeEntity(_0x1b85ab,null))['catch'](handleError(_0x1b85ab,null));};exports[_0x14bd('0x40')]=function(_0x442614,_0x2c0064){return db[_0x14bd('0x27')][_0x14bd('0x40')]()[_0x14bd('0x20')](respondWithResult(_0x2c0064,null))[_0x14bd('0x3a')](handleError(_0x2c0064,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5863627..ab166cb 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 _0x01d9=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x470e51,_0x485451){var _0x177fa4=function(_0x2e687c){while(--_0x2e687c){_0x470e51['push'](_0x470e51['shift']());}};_0x177fa4(++_0x485451);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x5918a2,_0x2b66a1){var _0x1fa274=function(_0x15f600){while(--_0x15f600){_0x5918a2['push'](_0x5918a2['shift']());}};_0x1fa274(++_0x2b66a1);}(_0xf494,0x1c6));var _0x4f49=function(_0x192b80,_0x3fb3fe){_0x192b80=_0x192b80-0x0;var _0xc975ec=_0xf494[_0x192b80];return _0xc975ec;};'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')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6bcf5c9..79fd585 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 _0xc16e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x280904,_0x33c65b){var _0x397429=function(_0x5b5524){while(--_0x5b5524){_0x280904['push'](_0x280904['shift']());}};_0x397429(++_0x33c65b);}(_0xc16e,0x182));var _0xec16=function(_0x573420,_0x580d53){_0x573420=_0x573420-0x0;var _0xbc31b5=_0xc16e[_0x573420];return _0xbc31b5;};'use strict';var _=require(_0xec16('0x0'));var util=require(_0xec16('0x1'));var moment=require(_0xec16('0x2'));var BPromise=require(_0xec16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec16('0x4'));var db=require(_0xec16('0x5'))['db'];var utils=require(_0xec16('0x6'));var logger=require(_0xec16('0x7'))(_0xec16('0x8'));var config=require(_0xec16('0x9'));var jayson=require(_0xec16('0xa'));var client=jayson[_0xec16('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e49e6,_0x42f563,_0x39c287){return new BPromise(function(_0x12b28d,_0x506695){return client[_0xec16('0xc')](_0x5e49e6,_0x39c287)[_0xec16('0xd')](function(_0x23ed1d){logger[_0xec16('0xe')](_0xec16('0xf'),_0x42f563,_0xec16('0x10'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x42f563,_0xec16('0x10'),JSON[_0xec16('0x11')](_0x23ed1d));if(_0x23ed1d[_0xec16('0x12')]){if(_0x23ed1d[_0xec16('0x12')][_0xec16('0x13')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x42f563,_0x23ed1d['error'][_0xec16('0x14')]);return _0x506695(_0x23ed1d[_0xec16('0x12')][_0xec16('0x14')]);}logger[_0xec16('0x12')](_0xec16('0xf'),_0x42f563,_0x23ed1d['error'][_0xec16('0x14')]);return _0x12b28d(_0x23ed1d[_0xec16('0x12')]['message']);}else{logger[_0xec16('0xe')](_0xec16('0xf'),_0x42f563,_0xec16('0x10'));_0x12b28d(_0x23ed1d[_0xec16('0x15')]['message']);}})[_0xec16('0x16')](function(_0x3f3926){logger[_0xec16('0x12')](_0xec16('0xf'),_0x42f563,_0x3f3926);_0x506695(_0x3f3926);});});} \ No newline at end of file +var _0x2ff3=['request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug'];(function(_0x50b2ff,_0x46ca56){var _0x143efc=function(_0x56bae9){while(--_0x56bae9){_0x50b2ff['push'](_0x50b2ff['shift']());}};_0x143efc(++_0x46ca56);}(_0x2ff3,0x7e));var _0x32ff=function(_0x29d387,_0x4ab1f8){_0x29d387=_0x29d387-0x0;var _0x540fa4=_0x2ff3[_0x29d387];return _0x540fa4;};'use strict';var _=require('lodash');var util=require(_0x32ff('0x0'));var moment=require(_0x32ff('0x1'));var BPromise=require(_0x32ff('0x2'));var rs=require(_0x32ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x32ff('0x5'))(_0x32ff('0x6'));var config=require('../../config/environment');var jayson=require(_0x32ff('0x7'));var client=jayson[_0x32ff('0x8')][_0x32ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178112,_0x19e518,_0x22f9f3){return new BPromise(function(_0x22fad8,_0x1f5bd9){return client[_0x32ff('0xa')](_0x178112,_0x22f9f3)['then'](function(_0x4062d9){logger[_0x32ff('0xb')](_0x32ff('0xc'),_0x19e518,'request\x20sent');logger[_0x32ff('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x19e518,_0x32ff('0xe'),JSON[_0x32ff('0xf')](_0x4062d9));if(_0x4062d9[_0x32ff('0x10')]){if(_0x4062d9[_0x32ff('0x10')]['code']===0x1f4){logger[_0x32ff('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x19e518,_0x4062d9['error'][_0x32ff('0x11')]);return _0x1f5bd9(_0x4062d9[_0x32ff('0x10')][_0x32ff('0x11')]);}logger[_0x32ff('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x19e518,_0x4062d9[_0x32ff('0x10')]['message']);return _0x22fad8(_0x4062d9[_0x32ff('0x10')]['message']);}else{logger[_0x32ff('0xb')](_0x32ff('0xc'),_0x19e518,_0x32ff('0xe'));_0x22fad8(_0x4062d9[_0x32ff('0x12')][_0x32ff('0x11')]);}})[_0x32ff('0x13')](function(_0x3bf389){logger[_0x32ff('0x10')](_0x32ff('0xc'),_0x19e518,_0x3bf389);_0x1f5bd9(_0x3bf389);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 6894da6..8295e1f 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 _0x195c=['%s-%s%s','basename','extname','post','single','file','create','put','update','delete','exports','Router','../../components/auth/service','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x195c,0xa7));var _0xc195=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x195c[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc195('0x0')]();var auth=require(_0xc195('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc195('0x2'));router['get']('/',auth[_0xc195('0x3')](),controller[_0xc195('0x4')]);router[_0xc195('0x5')](_0xc195('0x6'),auth['isAuthenticated'](),controller[_0xc195('0x7')]);router[_0xc195('0x5')](_0xc195('0x8'),auth[_0xc195('0x3')](),controller[_0xc195('0x9')]);var upload=multer({'storage':multer[_0xc195('0xa')]({'destination':function(_0x3d3278,_0x69e286,_0x3c0960){_0x3c0960(null,path[_0xc195('0xb')](config['root'],_0xc195('0xc')));},'filename':function(_0x5a48a7,_0x236213,_0x448dce){_0x236213[_0xc195('0xd')]=_0x236213['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x448dce(null,util[_0xc195('0xe')](_0xc195('0xf'),path[_0xc195('0x10')](_0x236213['originalname'],path['extname'](_0x236213['originalname'])),Date['now'](),path[_0xc195('0x11')](_0x236213[_0xc195('0xd')])));}})});router[_0xc195('0x12')]('/',upload[_0xc195('0x13')](_0xc195('0x14')),controller[_0xc195('0x15')]);router[_0xc195('0x16')](_0xc195('0x6'),auth[_0xc195('0x3')](),controller[_0xc195('0x17')]);router[_0xc195('0x18')](_0xc195('0x6'),auth['isAuthenticated'](),controller[_0xc195('0x18')]);module[_0xc195('0x19')]=router; \ No newline at end of file +var _0x81c7=['download','diskStorage','join','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','get','show','/:id/download'];(function(_0x2a750d,_0x57d33d){var _0x130358=function(_0x17fbc6){while(--_0x17fbc6){_0x2a750d['push'](_0x2a750d['shift']());}};_0x130358(++_0x57d33d);}(_0x81c7,0xa8));var _0x781c=function(_0x44fd81,_0x4003db){_0x44fd81=_0x44fd81-0x0;var _0x32d50c=_0x81c7[_0x44fd81];return _0x32d50c;};'use strict';var multer=require('multer');var util=require(_0x781c('0x0'));var path=require(_0x781c('0x1'));var timeout=require(_0x781c('0x2'));var express=require(_0x781c('0x3'));var router=express[_0x781c('0x4')]();var auth=require(_0x781c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x781c('0x6'));var controller=require(_0x781c('0x7'));router['get']('/',auth[_0x781c('0x8')](),controller['index']);router[_0x781c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x781c('0xa')]);router['get'](_0x781c('0xb'),auth[_0x781c('0x8')](),controller[_0x781c('0xc')]);var upload=multer({'storage':multer[_0x781c('0xd')]({'destination':function(_0x2a03f1,_0x3323cd,_0x1311fd){_0x1311fd(null,path[_0x781c('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x307297,_0x3efbde,_0x14b94a){_0x3efbde[_0x781c('0xf')]=_0x3efbde[_0x781c('0xf')][_0x781c('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x14b94a(null,util[_0x781c('0x11')](_0x781c('0x12'),path[_0x781c('0x13')](_0x3efbde['originalname'],path[_0x781c('0x14')](_0x3efbde[_0x781c('0xf')])),Date['now'](),path['extname'](_0x3efbde['originalname'])));}})});router[_0x781c('0x15')]('/',upload[_0x781c('0x16')](_0x781c('0x17')),controller[_0x781c('0x18')]);router[_0x781c('0x19')](_0x781c('0x1a'),auth[_0x781c('0x8')](),controller[_0x781c('0x1b')]);router[_0x781c('0x1c')](_0x781c('0x1a'),auth[_0x781c('0x8')](),controller[_0x781c('0x1c')]);module[_0x781c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a2aead2..bf7724b 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 _0x1063=['exports','STRING','name','BIGINT','INTEGER','sequelize'];(function(_0x2724d1,_0x4d739a){var _0xa54702=function(_0x5dcaaa){while(--_0x5dcaaa){_0x2724d1['push'](_0x2724d1['shift']());}};_0xa54702(++_0x4d739a);}(_0x1063,0x13d));var _0x3106=function(_0xfa54b7,_0x82437e){_0xfa54b7=_0xfa54b7-0x0;var _0x3b2343=_0x1063[_0xfa54b7];return _0x3b2343;};'use strict';var Sequelize=require(_0x3106('0x0'));module[_0x3106('0x1')]={'name':{'type':Sequelize[_0x3106('0x2')],'unique':_0x3106('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3106('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x3106('0x4')]},'original_channelCount':{'type':Sequelize[_0x3106('0x5')]},'original_bitRate':{'type':Sequelize[_0x3106('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3106('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3106('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3106('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x3106('0x5')]}}; \ No newline at end of file +var _0x41cf=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x41cf,0x11a));var _0xf41c=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0x41cf[_0x593d89];return _0x4aa403;};'use strict';var Sequelize=require(_0xf41c('0x0'));module[_0xf41c('0x1')]={'name':{'type':Sequelize[_0xf41c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xf41c('0x2')]},'display_name':{'type':Sequelize[_0xf41c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xf41c('0x2')]},'original_format':{'type':Sequelize[_0xf41c('0x2')]},'original_duration':{'type':Sequelize[_0xf41c('0x3')]},'original_sampleCount':{'type':Sequelize[_0xf41c('0x4')]},'original_channelCount':{'type':Sequelize[_0xf41c('0x5')]},'original_bitRate':{'type':Sequelize[_0xf41c('0x4')]},'original_sampleRate':{'type':Sequelize[_0xf41c('0x5')]},'converted_format':{'type':Sequelize[_0xf41c('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xf41c('0x4')]},'converted_channelCount':{'type':Sequelize[_0xf41c('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf41c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xf41c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cf59090..6da0a13 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 _0x1f7c=['Sound\x20not\x20found','server/files/sounds/converted','%s.%s','format','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','send','src','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','description','delete','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','Sounds','UserProfileResource','then','end','error','name','index','map','Sound','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','keys','rawAttributes','length','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError'];(function(_0x18225c,_0x58e497){var _0x3250f8=function(_0x59aad5){while(--_0x59aad5){_0x18225c['push'](_0x18225c['shift']());}};_0x3250f8(++_0x58e497);}(_0x1f7c,0xb1));var _0xc1f7=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x1f7c[_0x354164];return _0x5db9a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc1f7('0x0'));var rimraf=require(_0xc1f7('0x1'));var zipdir=require(_0xc1f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1f7('0x3'));var moment=require(_0xc1f7('0x4'));var BPromise=require(_0xc1f7('0x5'));var Mustache=require(_0xc1f7('0x6'));var util=require(_0xc1f7('0x7'));var path=require(_0xc1f7('0x8'));var sox=require('sox');var csv=require(_0xc1f7('0x9'));var ejs=require(_0xc1f7('0xa'));var fs=require('fs');var _=require(_0xc1f7('0xb'));var squel=require(_0xc1f7('0xc'));var crypto=require(_0xc1f7('0xd'));var jsforce=require(_0xc1f7('0xe'));var deskjs=require(_0xc1f7('0xf'));var toCsv=require(_0xc1f7('0x9'));var querystring=require(_0xc1f7('0x10'));var Papa=require(_0xc1f7('0x11'));var Redis=require(_0xc1f7('0x12'));var authService=require(_0xc1f7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1f7('0x14'));var logger=require(_0xc1f7('0x15'))(_0xc1f7('0x16'));var utils=require(_0xc1f7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1f7('0x18'))['db'];function respondWithStatusCode(_0x14bffe,_0x251c45){_0x251c45=_0x251c45||0xcc;return function(_0x4fb4dc){if(_0x4fb4dc){return _0x14bffe[_0xc1f7('0x19')](_0x251c45);}return _0x14bffe[_0xc1f7('0x1a')](_0x251c45)['end']();};}function respondWithResult(_0x34beb5,_0x4c6936){_0x4c6936=_0x4c6936||0xc8;return function(_0x37791f){if(_0x37791f){return _0x34beb5[_0xc1f7('0x1a')](_0x4c6936)[_0xc1f7('0x1b')](_0x37791f);}};}function respondWithFilteredResult(_0x51ae5b,_0x24ba1d){return function(_0x16da5b){if(_0x16da5b){var _0x4f4bea=_0x16da5b[_0xc1f7('0x1c')],_0x2782a5=_0x24ba1d['offset'],_0x3b5c48=_0x24ba1d['offset']+_0x24ba1d[_0xc1f7('0x1d')],_0x20106d;if(_0x3b5c48>=_0x4f4bea){_0x3b5c48=_0x4f4bea;_0x20106d=0xc8;}else{_0x20106d=0xce;}_0x51ae5b[_0xc1f7('0x1a')](_0x20106d);return _0x51ae5b[_0xc1f7('0x1e')](_0xc1f7('0x1f'),_0x2782a5+'-'+_0x3b5c48+'/'+_0x4f4bea)['json'](_0x16da5b);}return null;};}function patchUpdates(_0x1cf059){return function(_0x3f5277){try{jsonpatch[_0xc1f7('0x20')](_0x3f5277,_0x1cf059,!![]);}catch(_0x184701){return BPromise[_0xc1f7('0x21')](_0x184701);}return _0x3f5277[_0xc1f7('0x22')]();};}function saveUpdates(_0x238013,_0x25b2ee){return function(_0x2e71ca){if(_0x2e71ca){return _0x2e71ca[_0xc1f7('0x23')](_0x238013)['then'](function(_0x1bf798){return _0x1bf798;});}return null;};}function removeEntity(_0x22838d,_0x2295fc){return function(_0xf72459){if(_0xf72459){return _0xf72459[_0xc1f7('0x24')]()['then'](function(){var _0x1e6b0d=_0xf72459[_0xc1f7('0x25')]({'plain':!![]});var _0x20b544=_0xc1f7('0x26');return db[_0xc1f7('0x27')]['destroy']({'where':{'type':_0x20b544,'resourceId':_0x1e6b0d['id']}})[_0xc1f7('0x28')](function(){return _0xf72459;});})[_0xc1f7('0x28')](function(){_0x22838d[_0xc1f7('0x1a')](0xcc)[_0xc1f7('0x29')]();});}};}function handleEntityNotFound(_0x4502e6,_0x24df1b){return function(_0x28c666){if(!_0x28c666){_0x4502e6[_0xc1f7('0x19')](0x194);}return _0x28c666;};}function handleError(_0x4dc092,_0x5bea85){_0x5bea85=_0x5bea85||0x1f4;return function(_0x42093c){logger[_0xc1f7('0x2a')](_0x42093c['stack']);if(_0x42093c[_0xc1f7('0x2b')]){delete _0x42093c[_0xc1f7('0x2b')];}_0x4dc092[_0xc1f7('0x1a')](_0x5bea85)['send'](_0x42093c);};}exports[_0xc1f7('0x2c')]=function(_0x52ef8d,_0x1ea5ff){var _0x423447={},_0x67d57c={},_0x356253={'count':0x0,'rows':[]};var _0x22ffe9=_[_0xc1f7('0x2d')](db[_0xc1f7('0x2e')]['rawAttributes'],function(_0x3b3ce8){return{'name':_0x3b3ce8[_0xc1f7('0x2f')],'type':_0x3b3ce8['type'][_0xc1f7('0x30')]};});_0x67d57c[_0xc1f7('0x31')]=_['map'](_0x22ffe9,'name');_0x67d57c[_0xc1f7('0x32')]=_['keys'](_0x52ef8d[_0xc1f7('0x32')]);_0x67d57c[_0xc1f7('0x33')]=_[_0xc1f7('0x34')](_0x67d57c[_0xc1f7('0x31')],_0x67d57c['query']);_0x423447[_0xc1f7('0x35')]=_[_0xc1f7('0x34')](_0x67d57c['model'],qs[_0xc1f7('0x36')](_0x52ef8d[_0xc1f7('0x32')][_0xc1f7('0x36')]));_0x423447['attributes']=_0x423447[_0xc1f7('0x35')]['length']?_0x423447['attributes']:_0x67d57c[_0xc1f7('0x31')];if(!_0x52ef8d['query'][_0xc1f7('0x37')](_0xc1f7('0x38'))){_0x423447[_0xc1f7('0x1d')]=qs['limit'](_0x52ef8d[_0xc1f7('0x32')][_0xc1f7('0x1d')]);_0x423447[_0xc1f7('0x39')]=qs['offset'](_0x52ef8d[_0xc1f7('0x32')][_0xc1f7('0x39')]);}_0x423447[_0xc1f7('0x3a')]=qs[_0xc1f7('0x3b')](_0x52ef8d[_0xc1f7('0x32')][_0xc1f7('0x3b')]);_0x423447['where']=qs['filters'](_[_0xc1f7('0x3c')](_0x52ef8d['query'],_0x67d57c[_0xc1f7('0x33')]),_0x22ffe9);if(_0x52ef8d[_0xc1f7('0x32')]['filter']){_0x423447[_0xc1f7('0x3d')]=_[_0xc1f7('0x3e')](_0x423447[_0xc1f7('0x3d')],{'$or':_[_0xc1f7('0x2d')](_0x22ffe9,function(_0x11416f){if(_0x11416f[_0xc1f7('0x3f')]!==_0xc1f7('0x40')){var _0x59106f={};_0x59106f[_0x11416f['name']]={'$like':'%'+_0x52ef8d[_0xc1f7('0x32')]['filter']+'%'};return _0x59106f;}})});}_0x423447=_[_0xc1f7('0x3e')]({},_0x423447,_0x52ef8d[_0xc1f7('0x41')]);var _0x5c0e03={'where':_0x423447['where']};return db[_0xc1f7('0x2e')]['count'](_0x5c0e03)[_0xc1f7('0x28')](function(_0x56b769){_0x356253[_0xc1f7('0x1c')]=_0x56b769;if(_0x52ef8d['query']['includeAll']){_0x423447['include']=[{'all':!![]}];}return db['Sound'][_0xc1f7('0x42')](_0x423447);})[_0xc1f7('0x28')](function(_0x31ef64){_0x356253[_0xc1f7('0x43')]=_0x31ef64;return _0x356253;})[_0xc1f7('0x28')](respondWithFilteredResult(_0x1ea5ff,_0x423447))[_0xc1f7('0x44')](handleError(_0x1ea5ff,null));};exports[_0xc1f7('0x45')]=function(_0x1259cf,_0x18f71f){var _0x31e400={'raw':!![],'where':{'id':_0x1259cf['params']['id']}},_0x2f5c24={};_0x2f5c24['model']=_[_0xc1f7('0x46')](db[_0xc1f7('0x2e')][_0xc1f7('0x47')]);_0x2f5c24[_0xc1f7('0x32')]=_[_0xc1f7('0x46')](_0x1259cf[_0xc1f7('0x32')]);_0x2f5c24[_0xc1f7('0x33')]=_[_0xc1f7('0x34')](_0x2f5c24[_0xc1f7('0x31')],_0x2f5c24[_0xc1f7('0x32')]);_0x31e400[_0xc1f7('0x35')]=_[_0xc1f7('0x34')](_0x2f5c24[_0xc1f7('0x31')],qs[_0xc1f7('0x36')](_0x1259cf['query'][_0xc1f7('0x36')]));_0x31e400['attributes']=_0x31e400['attributes'][_0xc1f7('0x48')]?_0x31e400[_0xc1f7('0x35')]:_0x2f5c24[_0xc1f7('0x31')];if(_0x1259cf['query']['includeAll']){_0x31e400['include']=[{'all':!![]}];}_0x31e400=_[_0xc1f7('0x3e')]({},_0x31e400,_0x1259cf[_0xc1f7('0x41')]);return db['Sound']['find'](_0x31e400)[_0xc1f7('0x28')](handleEntityNotFound(_0x18f71f,null))[_0xc1f7('0x28')](respondWithResult(_0x18f71f,null))[_0xc1f7('0x44')](handleError(_0x18f71f,null));};exports[_0xc1f7('0x49')]=function(_0x3abae8,_0x57f074,_0x14892b){return db[_0xc1f7('0x2e')]['find']({'where':{'id':_0x3abae8['params']['id']},'attributes':[_0xc1f7('0x2b'),_0xc1f7('0x4a'),_0xc1f7('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x57f074,null))[_0xc1f7('0x28')](function(_0x102002){if(_0x102002){if(!fs[_0xc1f7('0x4c')](path[_0xc1f7('0x4d')](config[_0xc1f7('0x4e')],'server/files/sounds/converted',_0x102002['save_name']+'.'+_0x102002[_0xc1f7('0x4b')]))){throw new db[(_0xc1f7('0x4f'))][(_0xc1f7('0x50'))](_0xc1f7('0x51'));}return _0x57f074[_0xc1f7('0x49')](path[_0xc1f7('0x4d')](config[_0xc1f7('0x4e')],_0xc1f7('0x52'),util['format'](_0xc1f7('0x53'),_0x102002['save_name'],_0x102002[_0xc1f7('0x4b')])),util[_0xc1f7('0x54')]('%s.%s',_0x102002[_0xc1f7('0x2b')],_0x102002['converted_format']));}return null;})['catch'](handleError(_0x57f074,null));};exports[_0xc1f7('0x55')]=function(_0x5824b9,_0x5b4004,_0x4d5909){var _0x32ce29={'name':path[_0xc1f7('0x56')](_0x5824b9[_0xc1f7('0x57')][_0xc1f7('0x58')],path['extname'](_0x5824b9[_0xc1f7('0x57')][_0xc1f7('0x58')])),'save_name':path[_0xc1f7('0x56')](_0x5824b9[_0xc1f7('0x57')][_0xc1f7('0x59')],path[_0xc1f7('0x5a')](_0x5824b9[_0xc1f7('0x57')][_0xc1f7('0x59')])),'original_format':path[_0xc1f7('0x5a')](_0x5824b9[_0xc1f7('0x57')]['originalname'])[_0xc1f7('0x5b')](0x1),'converted_format':'wav'};var _0x204f7b=path['join'](config['root'],_0xc1f7('0x5c'),_0x5824b9['file'][_0xc1f7('0x59')]);var _0x38c3df=path[_0xc1f7('0x4d')](config[_0xc1f7('0x4e')],_0xc1f7('0x52'),util[_0xc1f7('0x54')](_0xc1f7('0x53'),path[_0xc1f7('0x56')](_0x5824b9['file'][_0xc1f7('0x59')],path[_0xc1f7('0x5a')](_0x5824b9[_0xc1f7('0x57')]['filename'])),_0x32ce29[_0xc1f7('0x4b')]));logger[_0xc1f7('0x5d')](_0xc1f7('0x5e'),_0x204f7b);logger['info'](_0xc1f7('0x5f'),_0x38c3df);try{fs[_0xc1f7('0x60')](_0x204f7b,parseInt(_0xc1f7('0x61'),0x8));var _0x5101bb=sox[_0xc1f7('0x62')](_0x204f7b,_0x38c3df,{'sampleRate':0x1f40,'format':_0xc1f7('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5101bb['on'](_0xc1f7('0x2a'),function(_0xc8deef){fs[_0xc1f7('0x64')](_0x204f7b);_0x5b4004[_0xc1f7('0x1a')](0x1f4)[_0xc1f7('0x65')](_0xc8deef);});_0x5101bb['on'](_0xc1f7('0x66'),function(_0x4f28d8){_0x32ce29['original_duration']=isNaN(_0x4f28d8['duration'])?null:_0x4f28d8['duration']*0x3e8;_0x32ce29[_0xc1f7('0x67')]=isNaN(_0x4f28d8[_0xc1f7('0x68')])?null:_0x4f28d8[_0xc1f7('0x68')];_0x32ce29[_0xc1f7('0x69')]=isNaN(_0x4f28d8['channelCount'])?null:_0x4f28d8['channelCount'];_0x32ce29[_0xc1f7('0x6a')]=isNaN(_0x4f28d8[_0xc1f7('0x6b')])?null:_0x4f28d8[_0xc1f7('0x6b')];_0x32ce29[_0xc1f7('0x6c')]=isNaN(_0x4f28d8[_0xc1f7('0x6d')])?null:_0x4f28d8[_0xc1f7('0x6d')];});_0x5101bb['on'](_0xc1f7('0x6e'),function(_0xbfe039){_0x32ce29[_0xc1f7('0x6f')]=isNaN(_0xbfe039['duration'])?null:_0xbfe039[_0xc1f7('0x70')]*0x3e8;_0x32ce29['converted_sampleCount']=isNaN(_0xbfe039['sampleCount'])?null:_0xbfe039['sampleCount'];_0x32ce29[_0xc1f7('0x71')]=isNaN(_0xbfe039[_0xc1f7('0x72')])?null:_0xbfe039[_0xc1f7('0x72')];_0x32ce29[_0xc1f7('0x73')]=isNaN(_0xbfe039[_0xc1f7('0x6b')])?null:_0xbfe039['bitRate'];_0x32ce29[_0xc1f7('0x74')]=isNaN(_0xbfe039[_0xc1f7('0x6d')])?null:_0xbfe039[_0xc1f7('0x6d')];});_0x5101bb['on'](_0xc1f7('0x29'),function(){fs[_0xc1f7('0x60')](_0x38c3df,parseInt('0777',0x8));return db[_0xc1f7('0x2e')][_0xc1f7('0x55')](_0x32ce29)[_0xc1f7('0x28')](function(_0x54a42f){var _0x277fe2={'role':_0x5824b9[_0xc1f7('0x75')][_0xc1f7('0x76')],'userProfileId':_0x5824b9[_0xc1f7('0x75')][_0xc1f7('0x77')]};if(!_0x277fe2)throw new Error(_0xc1f7('0x78'));if(_0x277fe2[_0xc1f7('0x76')]===_0xc1f7('0x79')){var _0xbd5351=_0x54a42f[_0xc1f7('0x25')]({'plain':!![]});return db[_0xc1f7('0x7a')][_0xc1f7('0x7b')]({'where':{'name':_0xc1f7('0x26'),'userProfileId':_0x277fe2[_0xc1f7('0x77')]},'raw':!![]})[_0xc1f7('0x28')](function(_0x3619ff){if(_0x3619ff&&_0x3619ff[_0xc1f7('0x7c')]===0x0){return db[_0xc1f7('0x27')][_0xc1f7('0x55')]({'name':_0xbd5351['name'],'resourceId':_0xbd5351['id'],'type':_0x3619ff[_0xc1f7('0x2b')],'sectionId':_0x3619ff['id']},{})['then'](function(){return _0x54a42f;});}else{return _0x54a42f;}})[_0xc1f7('0x44')](function(_0x4489c0){logger['error'](_0xc1f7('0x7d'),_0x4489c0);throw _0x4489c0;});}return _0x54a42f;})[_0xc1f7('0x28')](respondWithResult(_0x5b4004,null))['catch'](handleError(_0x5b4004,null));});_0x5101bb['start']();}catch(_0x519bfe){_0x5b4004['status'](0x1f4)[_0xc1f7('0x65')](_0x519bfe);}};exports['update']=function(_0x2a2efb,_0x30b1e3,_0x166f71){return db[_0xc1f7('0x2e')]['find']({'where':{'id':_0x2a2efb[_0xc1f7('0x7e')]['id']}})['then'](handleEntityNotFound(_0x30b1e3,null))['then'](saveUpdates(_[_0xc1f7('0x3c')](_0x2a2efb[_0xc1f7('0x75')],['name',_0xc1f7('0x7f')]),null))[_0xc1f7('0x28')](respondWithResult(_0x30b1e3,null))['catch'](handleError(_0x30b1e3,null));};exports[_0xc1f7('0x80')]=function(_0x1f7ede,_0x177649,_0x40135c){return db[_0xc1f7('0x2e')][_0xc1f7('0x7b')]({'where':{'id':_0x1f7ede[_0xc1f7('0x7e')]['id']}})[_0xc1f7('0x28')](function(_0x2b413d){if(_0x2b413d){return _0x2b413d['destroy']();}})[_0xc1f7('0x28')](function(_0x48c5e8){var _0x5ad84c=path[_0xc1f7('0x4d')](config['root'],_0xc1f7('0x5c'),util['format'](_0xc1f7('0x53'),_0x48c5e8[_0xc1f7('0x4a')],_0x48c5e8['original_format']));var _0x3c2773=path['join'](config[_0xc1f7('0x4e')],_0xc1f7('0x52'),util[_0xc1f7('0x54')](_0xc1f7('0x53'),_0x48c5e8[_0xc1f7('0x4a')],_0x48c5e8[_0xc1f7('0x4b')]));fs[_0xc1f7('0x64')](_0x5ad84c);fs[_0xc1f7('0x64')](_0x3c2773);return _0x48c5e8;})[_0xc1f7('0x28')](function(_0x5f4ae4){if(_0x5f4ae4){return _0x177649[_0xc1f7('0x1a')](0xcc)[_0xc1f7('0x29')]();}})[_0xc1f7('0x28')](handleEntityNotFound(_0x177649,null))[_0xc1f7('0x44')](handleError(_0x177649,null));}; \ No newline at end of file +var _0x891c=['../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','download','format','%s.%s','create','originalname','extname','file','filename','substring','wav','server/files/sounds/original','basename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x956d6d,_0x52a10a){var _0x3e608b=function(_0x252a7a){while(--_0x252a7a){_0x956d6d['push'](_0x956d6d['shift']());}};_0x3e608b(++_0x52a10a);}(_0x891c,0x66));var _0xc891=function(_0x6cb6da,_0x4e8e82){_0x6cb6da=_0x6cb6da-0x0;var _0x3980e3=_0x891c[_0x6cb6da];return _0x3980e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc891('0x0'));var rimraf=require(_0xc891('0x1'));var zipdir=require(_0xc891('0x2'));var jsonpatch=require(_0xc891('0x3'));var rp=require(_0xc891('0x4'));var moment=require(_0xc891('0x5'));var BPromise=require(_0xc891('0x6'));var Mustache=require(_0xc891('0x7'));var util=require('util');var path=require(_0xc891('0x8'));var sox=require(_0xc891('0x9'));var csv=require(_0xc891('0xa'));var ejs=require(_0xc891('0xb'));var fs=require('fs');var _=require(_0xc891('0xc'));var squel=require(_0xc891('0xd'));var crypto=require(_0xc891('0xe'));var jsforce=require(_0xc891('0xf'));var deskjs=require(_0xc891('0x10'));var toCsv=require(_0xc891('0xa'));var querystring=require('querystring');var Papa=require(_0xc891('0x11'));var Redis=require(_0xc891('0x12'));var authService=require(_0xc891('0x13'));var qs=require(_0xc891('0x14'));var as=require(_0xc891('0x15'));var hardwareService=require(_0xc891('0x16'));var logger=require('../../config/logger')(_0xc891('0x17'));var utils=require('../../config/utils');var config=require(_0xc891('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15097a,_0x25b2cc){_0x25b2cc=_0x25b2cc||0xcc;return function(_0x7700da){if(_0x7700da){return _0x15097a[_0xc891('0x19')](_0x25b2cc);}return _0x15097a[_0xc891('0x1a')](_0x25b2cc)[_0xc891('0x1b')]();};}function respondWithResult(_0x4d29f4,_0x35f5a3){_0x35f5a3=_0x35f5a3||0xc8;return function(_0x3940c7){if(_0x3940c7){return _0x4d29f4[_0xc891('0x1a')](_0x35f5a3)[_0xc891('0x1c')](_0x3940c7);}};}function respondWithFilteredResult(_0x1b4da0,_0x345003){return function(_0x3b30d4){if(_0x3b30d4){var _0x12b4e7=_0x3b30d4[_0xc891('0x1d')],_0x565546=_0x345003[_0xc891('0x1e')],_0xa6b4ab=_0x345003['offset']+_0x345003[_0xc891('0x1f')],_0x364091;if(_0xa6b4ab>=_0x12b4e7){_0xa6b4ab=_0x12b4e7;_0x364091=0xc8;}else{_0x364091=0xce;}_0x1b4da0[_0xc891('0x1a')](_0x364091);return _0x1b4da0[_0xc891('0x20')](_0xc891('0x21'),_0x565546+'-'+_0xa6b4ab+'/'+_0x12b4e7)[_0xc891('0x1c')](_0x3b30d4);}return null;};}function patchUpdates(_0x1839b0){return function(_0x263e62){try{jsonpatch[_0xc891('0x22')](_0x263e62,_0x1839b0,!![]);}catch(_0x507b65){return BPromise['reject'](_0x507b65);}return _0x263e62[_0xc891('0x23')]();};}function saveUpdates(_0x524f77,_0x96dda1){return function(_0x381bd7){if(_0x381bd7){return _0x381bd7[_0xc891('0x24')](_0x524f77)[_0xc891('0x25')](function(_0x4cbeb4){return _0x4cbeb4;});}return null;};}function removeEntity(_0x269bca,_0x3cd0f4){return function(_0x20d57d){if(_0x20d57d){return _0x20d57d[_0xc891('0x26')]()[_0xc891('0x25')](function(){var _0x3a563c=_0x20d57d[_0xc891('0x27')]({'plain':!![]});var _0x248433='Sounds';return db[_0xc891('0x28')][_0xc891('0x26')]({'where':{'type':_0x248433,'resourceId':_0x3a563c['id']}})['then'](function(){return _0x20d57d;});})[_0xc891('0x25')](function(){_0x269bca[_0xc891('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52dd71,_0x49a67e){return function(_0x22f65b){if(!_0x22f65b){_0x52dd71['sendStatus'](0x194);}return _0x22f65b;};}function handleError(_0x557dae,_0x337808){_0x337808=_0x337808||0x1f4;return function(_0x31f912){logger['error'](_0x31f912['stack']);if(_0x31f912[_0xc891('0x29')]){delete _0x31f912[_0xc891('0x29')];}_0x557dae[_0xc891('0x1a')](_0x337808)[_0xc891('0x2a')](_0x31f912);};}exports[_0xc891('0x2b')]=function(_0x210537,_0x537f18){var _0x5b5fe7={},_0x6cbe78={},_0x2406a8={'count':0x0,'rows':[]};var _0x259492=_[_0xc891('0x2c')](db[_0xc891('0x2d')][_0xc891('0x2e')],function(_0x3e4693){return{'name':_0x3e4693[_0xc891('0x2f')],'type':_0x3e4693[_0xc891('0x30')][_0xc891('0x31')]};});_0x6cbe78[_0xc891('0x32')]=_[_0xc891('0x2c')](_0x259492,_0xc891('0x29'));_0x6cbe78[_0xc891('0x33')]=_[_0xc891('0x34')](_0x210537[_0xc891('0x33')]);_0x6cbe78[_0xc891('0x35')]=_[_0xc891('0x36')](_0x6cbe78[_0xc891('0x32')],_0x6cbe78[_0xc891('0x33')]);_0x5b5fe7['attributes']=_[_0xc891('0x36')](_0x6cbe78[_0xc891('0x32')],qs[_0xc891('0x37')](_0x210537[_0xc891('0x33')][_0xc891('0x37')]));_0x5b5fe7[_0xc891('0x38')]=_0x5b5fe7['attributes']['length']?_0x5b5fe7['attributes']:_0x6cbe78[_0xc891('0x32')];if(!_0x210537['query'][_0xc891('0x39')]('nolimit')){_0x5b5fe7[_0xc891('0x1f')]=qs[_0xc891('0x1f')](_0x210537[_0xc891('0x33')][_0xc891('0x1f')]);_0x5b5fe7['offset']=qs[_0xc891('0x1e')](_0x210537['query'][_0xc891('0x1e')]);}_0x5b5fe7[_0xc891('0x3a')]=qs['sort'](_0x210537[_0xc891('0x33')]['sort']);_0x5b5fe7[_0xc891('0x3b')]=qs['filters'](_['pick'](_0x210537[_0xc891('0x33')],_0x6cbe78[_0xc891('0x35')]),_0x259492);if(_0x210537[_0xc891('0x33')][_0xc891('0x3c')]){_0x5b5fe7[_0xc891('0x3b')]=_[_0xc891('0x3d')](_0x5b5fe7['where'],{'$or':_[_0xc891('0x2c')](_0x259492,function(_0x5a3797){if(_0x5a3797['type']!==_0xc891('0x3e')){var _0x140db6={};_0x140db6[_0x5a3797[_0xc891('0x29')]]={'$like':'%'+_0x210537[_0xc891('0x33')]['filter']+'%'};return _0x140db6;}})});}_0x5b5fe7=_[_0xc891('0x3d')]({},_0x5b5fe7,_0x210537[_0xc891('0x3f')]);var _0x448ebe={'where':_0x5b5fe7[_0xc891('0x3b')]};return db['Sound']['count'](_0x448ebe)[_0xc891('0x25')](function(_0x13ddc4){_0x2406a8['count']=_0x13ddc4;if(_0x210537[_0xc891('0x33')][_0xc891('0x40')]){_0x5b5fe7[_0xc891('0x41')]=[{'all':!![]}];}return db[_0xc891('0x2d')][_0xc891('0x42')](_0x5b5fe7);})[_0xc891('0x25')](function(_0x3c4f18){_0x2406a8[_0xc891('0x43')]=_0x3c4f18;return _0x2406a8;})[_0xc891('0x25')](respondWithFilteredResult(_0x537f18,_0x5b5fe7))[_0xc891('0x44')](handleError(_0x537f18,null));};exports[_0xc891('0x45')]=function(_0x7abd08,_0x114692){var _0x2208c6={'raw':!![],'where':{'id':_0x7abd08[_0xc891('0x46')]['id']}},_0x5c73f9={};_0x5c73f9[_0xc891('0x32')]=_[_0xc891('0x34')](db[_0xc891('0x2d')][_0xc891('0x2e')]);_0x5c73f9[_0xc891('0x33')]=_[_0xc891('0x34')](_0x7abd08[_0xc891('0x33')]);_0x5c73f9[_0xc891('0x35')]=_['intersection'](_0x5c73f9[_0xc891('0x32')],_0x5c73f9[_0xc891('0x33')]);_0x2208c6['attributes']=_['intersection'](_0x5c73f9['model'],qs[_0xc891('0x37')](_0x7abd08[_0xc891('0x33')][_0xc891('0x37')]));_0x2208c6['attributes']=_0x2208c6['attributes'][_0xc891('0x47')]?_0x2208c6[_0xc891('0x38')]:_0x5c73f9[_0xc891('0x32')];if(_0x7abd08[_0xc891('0x33')][_0xc891('0x40')]){_0x2208c6[_0xc891('0x41')]=[{'all':!![]}];}_0x2208c6=_[_0xc891('0x3d')]({},_0x2208c6,_0x7abd08['options']);return db['Sound'][_0xc891('0x48')](_0x2208c6)[_0xc891('0x25')](handleEntityNotFound(_0x114692,null))['then'](respondWithResult(_0x114692,null))['catch'](handleError(_0x114692,null));};exports['download']=function(_0x177d4d,_0x361252,_0x3594bf){return db[_0xc891('0x2d')][_0xc891('0x48')]({'where':{'id':_0x177d4d['params']['id']},'attributes':[_0xc891('0x29'),_0xc891('0x49'),_0xc891('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x361252,null))[_0xc891('0x25')](function(_0x3cc301){if(_0x3cc301){if(!fs['existsSync'](path[_0xc891('0x4b')](config[_0xc891('0x4c')],_0xc891('0x4d'),_0x3cc301[_0xc891('0x49')]+'.'+_0x3cc301[_0xc891('0x4a')]))){throw new db[(_0xc891('0x4e'))][(_0xc891('0x4f'))]('Sound\x20not\x20found');}return _0x361252[_0xc891('0x50')](path['join'](config[_0xc891('0x4c')],_0xc891('0x4d'),util['format']('%s.%s',_0x3cc301[_0xc891('0x49')],_0x3cc301['converted_format'])),util[_0xc891('0x51')](_0xc891('0x52'),_0x3cc301[_0xc891('0x29')],_0x3cc301[_0xc891('0x4a')]));}return null;})[_0xc891('0x44')](handleError(_0x361252,null));};exports[_0xc891('0x53')]=function(_0x1d6bab,_0x22b236,_0x56aab3){var _0x1f8a28={'name':path['basename'](_0x1d6bab['file'][_0xc891('0x54')],path[_0xc891('0x55')](_0x1d6bab['file'][_0xc891('0x54')])),'save_name':path['basename'](_0x1d6bab[_0xc891('0x56')][_0xc891('0x57')],path['extname'](_0x1d6bab[_0xc891('0x56')][_0xc891('0x57')])),'original_format':path[_0xc891('0x55')](_0x1d6bab[_0xc891('0x56')][_0xc891('0x54')])[_0xc891('0x58')](0x1),'converted_format':_0xc891('0x59')};var _0x3ba17c=path[_0xc891('0x4b')](config[_0xc891('0x4c')],_0xc891('0x5a'),_0x1d6bab[_0xc891('0x56')][_0xc891('0x57')]);var _0x229a69=path[_0xc891('0x4b')](config[_0xc891('0x4c')],_0xc891('0x4d'),util['format']('%s.%s',path[_0xc891('0x5b')](_0x1d6bab[_0xc891('0x56')][_0xc891('0x57')],path[_0xc891('0x55')](_0x1d6bab[_0xc891('0x56')][_0xc891('0x57')])),_0x1f8a28[_0xc891('0x4a')]));logger['info'](_0xc891('0x5c'),_0x3ba17c);logger[_0xc891('0x5d')](_0xc891('0x5e'),_0x229a69);try{fs[_0xc891('0x5f')](_0x3ba17c,parseInt(_0xc891('0x60'),0x8));var _0x2b3a57=sox[_0xc891('0x61')](_0x3ba17c,_0x229a69,{'sampleRate':0x1f40,'format':_0xc891('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b3a57['on'](_0xc891('0x62'),function(_0x5d1bc8){fs[_0xc891('0x63')](_0x3ba17c);_0x22b236[_0xc891('0x1a')](0x1f4)['send'](_0x5d1bc8);});_0x2b3a57['on'](_0xc891('0x64'),function(_0x57cb63){_0x1f8a28[_0xc891('0x65')]=isNaN(_0x57cb63[_0xc891('0x66')])?null:_0x57cb63[_0xc891('0x66')]*0x3e8;_0x1f8a28['original_sampleCount']=isNaN(_0x57cb63[_0xc891('0x67')])?null:_0x57cb63['sampleCount'];_0x1f8a28['original_channelCount']=isNaN(_0x57cb63[_0xc891('0x68')])?null:_0x57cb63['channelCount'];_0x1f8a28[_0xc891('0x69')]=isNaN(_0x57cb63[_0xc891('0x6a')])?null:_0x57cb63[_0xc891('0x6a')];_0x1f8a28[_0xc891('0x6b')]=isNaN(_0x57cb63['sampleRate'])?null:_0x57cb63['sampleRate'];});_0x2b3a57['on'](_0xc891('0x6c'),function(_0x2433fa){_0x1f8a28['converted_duration']=isNaN(_0x2433fa[_0xc891('0x66')])?null:_0x2433fa[_0xc891('0x66')]*0x3e8;_0x1f8a28[_0xc891('0x6d')]=isNaN(_0x2433fa[_0xc891('0x67')])?null:_0x2433fa['sampleCount'];_0x1f8a28[_0xc891('0x6e')]=isNaN(_0x2433fa[_0xc891('0x68')])?null:_0x2433fa['channelCount'];_0x1f8a28['converted_bitRate']=isNaN(_0x2433fa['bitRate'])?null:_0x2433fa[_0xc891('0x6a')];_0x1f8a28[_0xc891('0x6f')]=isNaN(_0x2433fa[_0xc891('0x70')])?null:_0x2433fa[_0xc891('0x70')];});_0x2b3a57['on']('end',function(){fs[_0xc891('0x5f')](_0x229a69,parseInt(_0xc891('0x60'),0x8));return db[_0xc891('0x2d')]['create'](_0x1f8a28)['then'](function(_0x469364){var _0x223e7b={'role':_0x1d6bab[_0xc891('0x71')]['role'],'userProfileId':_0x1d6bab['body'][_0xc891('0x72')]};if(!_0x223e7b)throw new Error(_0xc891('0x73'));if(_0x223e7b[_0xc891('0x74')]===_0xc891('0x75')){var _0x60d5b=_0x469364['get']({'plain':!![]});return db['UserProfileSection'][_0xc891('0x48')]({'where':{'name':_0xc891('0x76'),'userProfileId':_0x223e7b['userProfileId']},'raw':!![]})[_0xc891('0x25')](function(_0x14f782){if(_0x14f782&&_0x14f782[_0xc891('0x77')]===0x0){return db[_0xc891('0x28')][_0xc891('0x53')]({'name':_0x60d5b[_0xc891('0x29')],'resourceId':_0x60d5b['id'],'type':_0x14f782[_0xc891('0x29')],'sectionId':_0x14f782['id']},{})[_0xc891('0x25')](function(){return _0x469364;});}else{return _0x469364;}})[_0xc891('0x44')](function(_0x310433){logger[_0xc891('0x62')](_0xc891('0x78'),_0x310433);throw _0x310433;});}return _0x469364;})[_0xc891('0x25')](respondWithResult(_0x22b236,null))[_0xc891('0x44')](handleError(_0x22b236,null));});_0x2b3a57[_0xc891('0x79')]();}catch(_0x3039e2){_0x22b236[_0xc891('0x1a')](0x1f4)[_0xc891('0x2a')](_0x3039e2);}};exports[_0xc891('0x24')]=function(_0x41e00c,_0x73dac7,_0x5a8691){return db[_0xc891('0x2d')][_0xc891('0x48')]({'where':{'id':_0x41e00c[_0xc891('0x46')]['id']}})[_0xc891('0x25')](handleEntityNotFound(_0x73dac7,null))[_0xc891('0x25')](saveUpdates(_['pick'](_0x41e00c[_0xc891('0x71')],[_0xc891('0x29'),'description']),null))[_0xc891('0x25')](respondWithResult(_0x73dac7,null))[_0xc891('0x44')](handleError(_0x73dac7,null));};exports[_0xc891('0x7a')]=function(_0x55d846,_0x329778,_0x2f2ecb){return db[_0xc891('0x2d')][_0xc891('0x48')]({'where':{'id':_0x55d846[_0xc891('0x46')]['id']}})[_0xc891('0x25')](function(_0x29eb9e){if(_0x29eb9e){return _0x29eb9e[_0xc891('0x26')]();}})[_0xc891('0x25')](function(_0x4eb771){var _0x3cd1ff=path[_0xc891('0x4b')](config[_0xc891('0x4c')],_0xc891('0x5a'),util['format'](_0xc891('0x52'),_0x4eb771[_0xc891('0x49')],_0x4eb771[_0xc891('0x7b')]));var _0x2dce17=path[_0xc891('0x4b')](config[_0xc891('0x4c')],_0xc891('0x4d'),util[_0xc891('0x51')](_0xc891('0x52'),_0x4eb771[_0xc891('0x49')],_0x4eb771[_0xc891('0x4a')]));fs[_0xc891('0x63')](_0x3cd1ff);fs['unlinkSync'](_0x2dce17);return _0x4eb771;})[_0xc891('0x25')](function(_0x487a91){if(_0x487a91){return _0x329778[_0xc891('0x1a')](0xcc)[_0xc891('0x1b')]();}})[_0xc891('0x25')](handleEntityNotFound(_0x329778,null))['catch'](handleError(_0x329778,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2e5d3b6..7fc2053 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 _0xacc2=['api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x41b8ff,_0x415800){var _0x358c49=function(_0x4a41d0){while(--_0x4a41d0){_0x41b8ff['push'](_0x41b8ff['shift']());}};_0x358c49(++_0x415800);}(_0xacc2,0x14d));var _0x2acc=function(_0x4bcca2,_0x19e6cf){_0x4bcca2=_0x4bcca2-0x0;var _0x7821f9=_0xacc2[_0x4bcca2];return _0x7821f9;};'use strict';var _=require(_0x2acc('0x0'));var util=require(_0x2acc('0x1'));var logger=require(_0x2acc('0x2'))(_0x2acc('0x3'));var moment=require(_0x2acc('0x4'));var BPromise=require('bluebird');var rp=require(_0x2acc('0x5'));var fs=require('fs');var path=require(_0x2acc('0x6'));var rimraf=require(_0x2acc('0x7'));var config=require(_0x2acc('0x8'));var attributes=require(_0x2acc('0x9'));module[_0x2acc('0xa')]=function(_0x1e3f5f,_0x5415a1){return _0x1e3f5f[_0x2acc('0xb')](_0x2acc('0xc'),attributes,{'tableName':_0x2acc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8873=['rimraf','exports','define','Sound','tools_sounds','lodash','api','moment','bluebird','request-promise','path'];(function(_0x42c77e,_0x5c0fd5){var _0x58baaf=function(_0x1b72a9){while(--_0x1b72a9){_0x42c77e['push'](_0x42c77e['shift']());}};_0x58baaf(++_0x5c0fd5);}(_0x8873,0x186));var _0x3887=function(_0x1b9c2a,_0x50582e){_0x1b9c2a=_0x1b9c2a-0x0;var _0x21ab47=_0x8873[_0x1b9c2a];return _0x21ab47;};'use strict';var _=require(_0x3887('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3887('0x1'));var moment=require(_0x3887('0x2'));var BPromise=require(_0x3887('0x3'));var rp=require(_0x3887('0x4'));var fs=require('fs');var path=require(_0x3887('0x5'));var rimraf=require(_0x3887('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x3887('0x7')]=function(_0x3dda1f,_0x2788ed){return _0x3dda1f[_0x3887('0x8')](_0x3887('0x9'),attributes,{'tableName':_0x3887('0xa'),'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 0453275..7c16c85 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 _0xcd02=['../../config/environment','jayson/promise','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','find','raw','where','options','attributes','map','include','model','lodash','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0xcd02,0xc5));var _0x2cd0=function(_0x180b73,_0x5a301d){_0x180b73=_0x180b73-0x0;var _0x58ba34=_0xcd02[_0x180b73];return _0x58ba34;};'use strict';var _=require(_0x2cd0('0x0'));var util=require('util');var moment=require(_0x2cd0('0x1'));var BPromise=require(_0x2cd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2cd0('0x4'));var logger=require('../../config/logger')(_0x2cd0('0x5'));var config=require(_0x2cd0('0x6'));var jayson=require(_0x2cd0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa53e69,_0x1a5cdf,_0x4970d8){return new BPromise(function(_0x48f078,_0x1fb103){return client['request'](_0xa53e69,_0x4970d8)[_0x2cd0('0x8')](function(_0x58b3eb){logger[_0x2cd0('0x9')](_0x2cd0('0xa'),_0x1a5cdf,'request\x20sent');logger[_0x2cd0('0xb')](_0x2cd0('0xc'),_0x1a5cdf,_0x2cd0('0xd'),JSON[_0x2cd0('0xe')](_0x58b3eb));if(_0x58b3eb[_0x2cd0('0xf')]){if(_0x58b3eb['error'][_0x2cd0('0x10')]===0x1f4){logger[_0x2cd0('0xf')](_0x2cd0('0xa'),_0x1a5cdf,_0x58b3eb[_0x2cd0('0xf')]['message']);return _0x1fb103(_0x58b3eb[_0x2cd0('0xf')]['message']);}logger['error'](_0x2cd0('0xa'),_0x1a5cdf,_0x58b3eb['error'][_0x2cd0('0x11')]);return _0x48f078(_0x58b3eb[_0x2cd0('0xf')]['message']);}else{logger[_0x2cd0('0x9')](_0x2cd0('0xa'),_0x1a5cdf,_0x2cd0('0xd'));_0x48f078(_0x58b3eb[_0x2cd0('0x12')][_0x2cd0('0x11')]);}})[_0x2cd0('0x13')](function(_0x52073e){logger[_0x2cd0('0xf')](_0x2cd0('0xa'),_0x1a5cdf,_0x52073e);_0x1fb103(_0x52073e);});});}exports[_0x2cd0('0x14')]=function(_0x1f1960){var _0x31ba15=this;return new Promise(function(_0x26f83e,_0x2a315f){return db['Sound'][_0x2cd0('0x15')]({'raw':_0x1f1960['options']?_0x1f1960['options'][_0x2cd0('0x16')]===undefined?!![]:![]:!![],'where':_0x1f1960['options']?_0x1f1960['options'][_0x2cd0('0x17')]||null:null,'attributes':_0x1f1960[_0x2cd0('0x18')]?_0x1f1960[_0x2cd0('0x18')][_0x2cd0('0x19')]||null:null,'include':_0x1f1960[_0x2cd0('0x18')]?_0x1f1960[_0x2cd0('0x18')]['include']?_[_0x2cd0('0x1a')](_0x1f1960[_0x2cd0('0x18')][_0x2cd0('0x1b')],function(_0xef34ee){return{'model':db[_0xef34ee[_0x2cd0('0x1c')]],'as':_0xef34ee['as'],'attributes':_0xef34ee[_0x2cd0('0x19')],'include':_0xef34ee[_0x2cd0('0x1b')]?_[_0x2cd0('0x1a')](_0xef34ee[_0x2cd0('0x1b')],function(_0x1de42f){return{'model':db[_0x1de42f['model']],'as':_0x1de42f['as'],'attributes':_0x1de42f[_0x2cd0('0x19')],'include':_0x1de42f['include']?_[_0x2cd0('0x1a')](_0x1de42f['include'],function(_0x53fbb5){return{'model':db[_0x53fbb5[_0x2cd0('0x1c')]],'as':_0x53fbb5['as'],'attributes':_0x53fbb5[_0x2cd0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cd0('0x8')](function(_0x187bb9){logger[_0x2cd0('0x9')](_0x2cd0('0x14'),_0x1f1960);logger['debug'](_0x2cd0('0x14'),_0x1f1960,JSON['stringify'](_0x187bb9));_0x26f83e(_0x187bb9);})[_0x2cd0('0x13')](function(_0x45b16a){logger[_0x2cd0('0xf')](_0x2cd0('0x14'),_0x45b16a[_0x2cd0('0x11')],_0x1f1960);_0x2a315f(_0x31ba15[_0x2cd0('0xf')](0x1f4,_0x45b16a['message']));});});}; \ No newline at end of file +var _0xefce=['stringify','error','code','message','info','result','catch','ShowSound','Sound','options','model','attributes','include','map','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xefce,0xcb));var _0xeefc=function(_0x1dad92,_0x2f948c){_0x1dad92=_0x1dad92-0x0;var _0x90a9f6=_0xefce[_0x1dad92];return _0x90a9f6;};'use strict';var _=require('lodash');var util=require(_0xeefc('0x0'));var moment=require('moment');var BPromise=require(_0xeefc('0x1'));var rs=require(_0xeefc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeefc('0x3'));var logger=require(_0xeefc('0x4'))(_0xeefc('0x5'));var config=require(_0xeefc('0x6'));var jayson=require(_0xeefc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45eaab,_0x2016e2,_0x451e53){return new BPromise(function(_0x4be252,_0xf65cab){return client[_0xeefc('0x8')](_0x45eaab,_0x451e53)[_0xeefc('0x9')](function(_0x57756b){logger['info'](_0xeefc('0xa'),_0x2016e2,_0xeefc('0xb'));logger[_0xeefc('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x2016e2,'request\x20sent',JSON[_0xeefc('0xd')](_0x57756b));if(_0x57756b[_0xeefc('0xe')]){if(_0x57756b['error'][_0xeefc('0xf')]===0x1f4){logger[_0xeefc('0xe')](_0xeefc('0xa'),_0x2016e2,_0x57756b[_0xeefc('0xe')][_0xeefc('0x10')]);return _0xf65cab(_0x57756b[_0xeefc('0xe')][_0xeefc('0x10')]);}logger['error'](_0xeefc('0xa'),_0x2016e2,_0x57756b[_0xeefc('0xe')]['message']);return _0x4be252(_0x57756b['error']['message']);}else{logger[_0xeefc('0x11')]('Sound,\x20%s,\x20%s',_0x2016e2,_0xeefc('0xb'));_0x4be252(_0x57756b[_0xeefc('0x12')][_0xeefc('0x10')]);}})[_0xeefc('0x13')](function(_0x4b5044){logger['error'](_0xeefc('0xa'),_0x2016e2,_0x4b5044);_0xf65cab(_0x4b5044);});});}exports[_0xeefc('0x14')]=function(_0x5d226d){var _0x58a6b6=this;return new Promise(function(_0x55feb1,_0x5e85cc){return db[_0xeefc('0x15')]['find']({'raw':_0x5d226d[_0xeefc('0x16')]?_0x5d226d[_0xeefc('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5d226d[_0xeefc('0x16')]?_0x5d226d[_0xeefc('0x16')]['where']||null:null,'attributes':_0x5d226d[_0xeefc('0x16')]?_0x5d226d[_0xeefc('0x16')]['attributes']||null:null,'include':_0x5d226d[_0xeefc('0x16')]?_0x5d226d[_0xeefc('0x16')]['include']?_['map'](_0x5d226d[_0xeefc('0x16')]['include'],function(_0x1483f9){return{'model':db[_0x1483f9[_0xeefc('0x17')]],'as':_0x1483f9['as'],'attributes':_0x1483f9[_0xeefc('0x18')],'include':_0x1483f9[_0xeefc('0x19')]?_[_0xeefc('0x1a')](_0x1483f9['include'],function(_0x28d45b){return{'model':db[_0x28d45b[_0xeefc('0x17')]],'as':_0x28d45b['as'],'attributes':_0x28d45b[_0xeefc('0x18')],'include':_0x28d45b['include']?_['map'](_0x28d45b[_0xeefc('0x19')],function(_0x24cd26){return{'model':db[_0x24cd26[_0xeefc('0x17')]],'as':_0x24cd26['as'],'attributes':_0x24cd26[_0xeefc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeefc('0x9')](function(_0x4366b2){logger[_0xeefc('0x11')](_0xeefc('0x14'),_0x5d226d);logger[_0xeefc('0xc')](_0xeefc('0x14'),_0x5d226d,JSON['stringify'](_0x4366b2));_0x55feb1(_0x4366b2);})['catch'](function(_0x35872c){logger[_0xeefc('0xe')](_0xeefc('0x14'),_0x35872c[_0xeefc('0x10')],_0x5d226d);_0x5e85cc(_0x58a6b6[_0xeefc('0xe')](0x1f4,_0x35872c[_0xeefc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0a66a98..429bc22 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 _0x1dfa=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','/:id'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x1dfa,0xc6));var _0xa1df=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x1dfa[_0x934425];return _0x31d596;};'use strict';var multer=require('multer');var util=require(_0xa1df('0x0'));var path=require(_0xa1df('0x1'));var timeout=require(_0xa1df('0x2'));var express=require(_0xa1df('0x3'));var router=express[_0xa1df('0x4')]();var auth=require(_0xa1df('0x5'));var interaction=require(_0xa1df('0x6'));var config=require(_0xa1df('0x7'));var controller=require(_0xa1df('0x8'));router[_0xa1df('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1df('0xa')]);router[_0xa1df('0x9')](_0xa1df('0xb'),auth['isAuthenticated'](),controller[_0xa1df('0xc')]);router[_0xa1df('0xd')]('/',auth[_0xa1df('0xe')](),controller[_0xa1df('0xf')]);router[_0xa1df('0x10')](_0xa1df('0xb'),auth[_0xa1df('0xe')](),controller[_0xa1df('0x11')]);router[_0xa1df('0x12')](_0xa1df('0xb'),auth[_0xa1df('0xe')](),controller[_0xa1df('0x13')]);module[_0xa1df('0x14')]=router; \ No newline at end of file +var _0xb80d=['../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0xb80d,0x1bc));var _0xdb80=function(_0x2db3ce,_0x360607){_0x2db3ce=_0x2db3ce-0x0;var _0x4f45ec=_0xb80d[_0x2db3ce];return _0x4f45ec;};'use strict';var multer=require(_0xdb80('0x0'));var util=require('util');var path=require(_0xdb80('0x1'));var timeout=require(_0xdb80('0x2'));var express=require(_0xdb80('0x3'));var router=express[_0xdb80('0x4')]();var auth=require(_0xdb80('0x5'));var interaction=require(_0xdb80('0x6'));var config=require(_0xdb80('0x7'));var controller=require(_0xdb80('0x8'));router[_0xdb80('0x9')]('/',auth[_0xdb80('0xa')](),controller[_0xdb80('0xb')]);router[_0xdb80('0x9')](_0xdb80('0xc'),auth[_0xdb80('0xa')](),controller[_0xdb80('0xd')]);router[_0xdb80('0xe')]('/',auth[_0xdb80('0xa')](),controller['create']);router[_0xdb80('0xf')](_0xdb80('0xc'),auth[_0xdb80('0xa')](),controller[_0xdb80('0x10')]);router['delete'](_0xdb80('0xc'),auth[_0xdb80('0xa')](),controller['destroy']);module[_0xdb80('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7194f8f..c31a126 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 _0xe0ae=['out','STRING','TEXT','ENUM'];(function(_0x2077be,_0x26136a){var _0x198bbf=function(_0x2fd7e3){while(--_0x2fd7e3){_0x2077be['push'](_0x2077be['shift']());}};_0x198bbf(++_0x26136a);}(_0xe0ae,0xa1));var _0xee0a=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0xe0ae[_0xa4f636];return _0x37e02a;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xee0a('0x0')]},'body':{'type':Sequelize[_0xee0a('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xee0a('0x2')]('in','out'),'defaultValue':_0xee0a('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xee0a('0x0')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9c5a=['ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5bf9c1,_0x143acb){_0x5bf9c1=_0x5bf9c1-0x0;var _0x3a56a9=_0x9c5a[_0x5bf9c1];return _0x3a56a9;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xa9c5('0x2')](_0xa9c5('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xa9c5('0x4')]('in',_0xa9c5('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xa9c5('0x6')]},'providerResponse':{'type':Sequelize[_0xa9c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2979df4..73827bf 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 _0x6b3a=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','destroy','then','error','name','send','SquareMessage','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1bbe38,_0x2bff53){var _0x49eb7c=function(_0x4a4db3){while(--_0x4a4db3){_0x1bbe38['push'](_0x1bbe38['shift']());}};_0x49eb7c(++_0x2bff53);}(_0x6b3a,0x14a));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa6b3('0x0'));var emlformat=require(_0xa6b3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa6b3('0x2'));var jsonpatch=require(_0xa6b3('0x3'));var rp=require(_0xa6b3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa6b3('0x5'));var util=require(_0xa6b3('0x6'));var path=require('path');var sox=require(_0xa6b3('0x7'));var csv=require(_0xa6b3('0x8'));var ejs=require(_0xa6b3('0x9'));var fs=require('fs');var _=require(_0xa6b3('0xa'));var squel=require(_0xa6b3('0xb'));var crypto=require(_0xa6b3('0xc'));var jsforce=require(_0xa6b3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa6b3('0x8'));var querystring=require(_0xa6b3('0xe'));var Papa=require(_0xa6b3('0xf'));var Redis=require('ioredis');var authService=require(_0xa6b3('0x10'));var qs=require(_0xa6b3('0x11'));var as=require(_0xa6b3('0x12'));var hardwareService=require(_0xa6b3('0x13'));var logger=require(_0xa6b3('0x14'))(_0xa6b3('0x15'));var utils=require(_0xa6b3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa6b3('0x17'));var db=require(_0xa6b3('0x18'))['db'];function respondWithStatusCode(_0x19731d,_0x3dac6a){_0x3dac6a=_0x3dac6a||0xcc;return function(_0x51ba54){if(_0x51ba54){return _0x19731d[_0xa6b3('0x19')](_0x3dac6a);}return _0x19731d[_0xa6b3('0x1a')](_0x3dac6a)[_0xa6b3('0x1b')]();};}function respondWithResult(_0x3f6150,_0x3e9f1e){_0x3e9f1e=_0x3e9f1e||0xc8;return function(_0x380e50){if(_0x380e50){return _0x3f6150[_0xa6b3('0x1a')](_0x3e9f1e)['json'](_0x380e50);}};}function respondWithFilteredResult(_0x59622b,_0x3de531){return function(_0x2093a4){if(_0x2093a4){var _0x497c26=_0x2093a4[_0xa6b3('0x1c')],_0x1181bd=_0x3de531[_0xa6b3('0x1d')],_0x58c858=_0x3de531[_0xa6b3('0x1d')]+_0x3de531[_0xa6b3('0x1e')],_0x46cc90;if(_0x58c858>=_0x497c26){_0x58c858=_0x497c26;_0x46cc90=0xc8;}else{_0x46cc90=0xce;}_0x59622b['status'](_0x46cc90);return _0x59622b[_0xa6b3('0x1f')]('Content-Range',_0x1181bd+'-'+_0x58c858+'/'+_0x497c26)[_0xa6b3('0x20')](_0x2093a4);}return null;};}function patchUpdates(_0x27b763){return function(_0x58fe4f){try{jsonpatch['apply'](_0x58fe4f,_0x27b763,!![]);}catch(_0x443de){return BPromise[_0xa6b3('0x21')](_0x443de);}return _0x58fe4f[_0xa6b3('0x22')]();};}function saveUpdates(_0x15e5ec,_0x4f7d69){return function(_0x24d8b6){if(_0x24d8b6){return _0x24d8b6[_0xa6b3('0x23')](_0x15e5ec)['then'](function(_0x3bf113){return _0x3bf113;});}return null;};}function removeEntity(_0x503fa9,_0x48c42f){return function(_0x4e70d2){if(_0x4e70d2){return _0x4e70d2[_0xa6b3('0x24')]()[_0xa6b3('0x25')](function(){_0x503fa9[_0xa6b3('0x1a')](0xcc)[_0xa6b3('0x1b')]();});}};}function handleEntityNotFound(_0x32abc6,_0x1293c2){return function(_0x46cc9b){if(!_0x46cc9b){_0x32abc6['sendStatus'](0x194);}return _0x46cc9b;};}function handleError(_0x4fdae6,_0x35d518){_0x35d518=_0x35d518||0x1f4;return function(_0x11199d){logger[_0xa6b3('0x26')](_0x11199d['stack']);if(_0x11199d[_0xa6b3('0x27')]){delete _0x11199d['name'];}_0x4fdae6[_0xa6b3('0x1a')](_0x35d518)[_0xa6b3('0x28')](_0x11199d);};}exports['index']=function(_0x236dbe,_0x28537d){var _0x5aeecd={},_0x5b903c={},_0x1a98f1={'count':0x0,'rows':[]};var _0x25f22e=_['map'](db[_0xa6b3('0x29')][_0xa6b3('0x2a')],function(_0x23cbdf){return{'name':_0x23cbdf['fieldName'],'type':_0x23cbdf[_0xa6b3('0x2b')]['key']};});_0x5b903c[_0xa6b3('0x2c')]=_[_0xa6b3('0x2d')](_0x25f22e,_0xa6b3('0x27'));_0x5b903c[_0xa6b3('0x2e')]=_[_0xa6b3('0x2f')](_0x236dbe[_0xa6b3('0x2e')]);_0x5b903c[_0xa6b3('0x30')]=_[_0xa6b3('0x31')](_0x5b903c[_0xa6b3('0x2c')],_0x5b903c[_0xa6b3('0x2e')]);_0x5aeecd[_0xa6b3('0x32')]=_[_0xa6b3('0x31')](_0x5b903c[_0xa6b3('0x2c')],qs[_0xa6b3('0x33')](_0x236dbe['query']['fields']));_0x5aeecd['attributes']=_0x5aeecd[_0xa6b3('0x32')][_0xa6b3('0x34')]?_0x5aeecd[_0xa6b3('0x32')]:_0x5b903c[_0xa6b3('0x2c')];if(!_0x236dbe[_0xa6b3('0x2e')][_0xa6b3('0x35')](_0xa6b3('0x36'))){_0x5aeecd[_0xa6b3('0x1e')]=qs[_0xa6b3('0x1e')](_0x236dbe[_0xa6b3('0x2e')][_0xa6b3('0x1e')]);_0x5aeecd[_0xa6b3('0x1d')]=qs[_0xa6b3('0x1d')](_0x236dbe[_0xa6b3('0x2e')][_0xa6b3('0x1d')]);}_0x5aeecd[_0xa6b3('0x37')]=qs[_0xa6b3('0x38')](_0x236dbe[_0xa6b3('0x2e')][_0xa6b3('0x38')]);_0x5aeecd[_0xa6b3('0x39')]=qs[_0xa6b3('0x30')](_['pick'](_0x236dbe['query'],_0x5b903c[_0xa6b3('0x30')]),_0x25f22e);if(_0x236dbe[_0xa6b3('0x2e')][_0xa6b3('0x3a')]){_0x5aeecd[_0xa6b3('0x39')]=_[_0xa6b3('0x3b')](_0x5aeecd[_0xa6b3('0x39')],{'$or':_['map'](_0x25f22e,function(_0x46b089){if(_0x46b089[_0xa6b3('0x2b')]!==_0xa6b3('0x3c')){var _0x11edab={};_0x11edab[_0x46b089['name']]={'$like':'%'+_0x236dbe['query'][_0xa6b3('0x3a')]+'%'};return _0x11edab;}})});}_0x5aeecd=_[_0xa6b3('0x3b')]({},_0x5aeecd,_0x236dbe['options']);var _0x2c69d0={'where':_0x5aeecd[_0xa6b3('0x39')]};return db[_0xa6b3('0x29')][_0xa6b3('0x1c')](_0x2c69d0)[_0xa6b3('0x25')](function(_0x4279c4){_0x1a98f1[_0xa6b3('0x1c')]=_0x4279c4;if(_0x236dbe[_0xa6b3('0x2e')]['includeAll']){_0x5aeecd[_0xa6b3('0x3d')]=[{'all':!![]}];}return db[_0xa6b3('0x29')][_0xa6b3('0x3e')](_0x5aeecd);})[_0xa6b3('0x25')](function(_0x14393b){_0x1a98f1[_0xa6b3('0x3f')]=_0x14393b;return _0x1a98f1;})['then'](respondWithFilteredResult(_0x28537d,_0x5aeecd))[_0xa6b3('0x40')](handleError(_0x28537d,null));};exports['show']=function(_0x5a6dc7,_0x52b1cc){var _0x40ae07={'raw':!![],'where':{'id':_0x5a6dc7[_0xa6b3('0x41')]['id']}},_0x5096ca={};_0x5096ca[_0xa6b3('0x2c')]=_['keys'](db[_0xa6b3('0x29')]['rawAttributes']);_0x5096ca[_0xa6b3('0x2e')]=_[_0xa6b3('0x2f')](_0x5a6dc7[_0xa6b3('0x2e')]);_0x5096ca[_0xa6b3('0x30')]=_['intersection'](_0x5096ca[_0xa6b3('0x2c')],_0x5096ca[_0xa6b3('0x2e')]);_0x40ae07[_0xa6b3('0x32')]=_[_0xa6b3('0x31')](_0x5096ca[_0xa6b3('0x2c')],qs[_0xa6b3('0x33')](_0x5a6dc7[_0xa6b3('0x2e')][_0xa6b3('0x33')]));_0x40ae07['attributes']=_0x40ae07[_0xa6b3('0x32')]['length']?_0x40ae07[_0xa6b3('0x32')]:_0x5096ca[_0xa6b3('0x2c')];if(_0x5a6dc7[_0xa6b3('0x2e')][_0xa6b3('0x42')]){_0x40ae07['include']=[{'all':!![]}];}_0x40ae07=_[_0xa6b3('0x3b')]({},_0x40ae07,_0x5a6dc7['options']);return db['SquareMessage'][_0xa6b3('0x43')](_0x40ae07)[_0xa6b3('0x25')](handleEntityNotFound(_0x52b1cc,null))['then'](respondWithResult(_0x52b1cc,null))[_0xa6b3('0x40')](handleError(_0x52b1cc,null));};exports[_0xa6b3('0x44')]=function(_0x39542f,_0x427da6){return db[_0xa6b3('0x29')][_0xa6b3('0x44')](_0x39542f[_0xa6b3('0x45')],{})[_0xa6b3('0x25')](respondWithResult(_0x427da6,0xc9))[_0xa6b3('0x40')](handleError(_0x427da6,null));};exports[_0xa6b3('0x23')]=function(_0x1b07ca,_0x3b9ba5){if(_0x1b07ca['body']['id']){delete _0x1b07ca[_0xa6b3('0x45')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x1b07ca[_0xa6b3('0x41')]['id']}})[_0xa6b3('0x25')](handleEntityNotFound(_0x3b9ba5,null))['then'](saveUpdates(_0x1b07ca[_0xa6b3('0x45')],null))[_0xa6b3('0x25')](respondWithResult(_0x3b9ba5,null))['catch'](handleError(_0x3b9ba5,null));};exports['destroy']=function(_0x14e8f0,_0x28af22){return db['SquareMessage'][_0xa6b3('0x43')]({'where':{'id':_0x14e8f0['params']['id']}})[_0xa6b3('0x25')](handleEntityNotFound(_0x28af22,null))[_0xa6b3('0x25')](removeEntity(_0x28af22,null))[_0xa6b3('0x40')](handleError(_0x28af22,null));}; \ No newline at end of file +var _0x8977=['catch','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','params','keys','includeAll'];(function(_0x5caee2,_0x325a65){var _0x3f8747=function(_0x2d86bc){while(--_0x2d86bc){_0x5caee2['push'](_0x5caee2['shift']());}};_0x3f8747(++_0x325a65);}(_0x8977,0x1af));var _0x7897=function(_0x7dd38b,_0x3abdc1){_0x7dd38b=_0x7dd38b-0x0;var _0x183ef5=_0x8977[_0x7dd38b];return _0x183ef5;};'use strict';var pdf=require(_0x7897('0x0'));var emlformat=require(_0x7897('0x1'));var rimraf=require(_0x7897('0x2'));var zipdir=require(_0x7897('0x3'));var jsonpatch=require(_0x7897('0x4'));var rp=require(_0x7897('0x5'));var moment=require(_0x7897('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7897('0x7'));var util=require(_0x7897('0x8'));var path=require(_0x7897('0x9'));var sox=require(_0x7897('0xa'));var csv=require(_0x7897('0xb'));var ejs=require(_0x7897('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7897('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7897('0xb'));var querystring=require(_0x7897('0xe'));var Papa=require(_0x7897('0xf'));var Redis=require('ioredis');var authService=require(_0x7897('0x10'));var qs=require(_0x7897('0x11'));var as=require(_0x7897('0x12'));var hardwareService=require(_0x7897('0x13'));var logger=require('../../config/logger')(_0x7897('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7897('0x15'));var db=require(_0x7897('0x16'))['db'];function respondWithStatusCode(_0x1c7b6e,_0x4cc174){_0x4cc174=_0x4cc174||0xcc;return function(_0x1cb1f5){if(_0x1cb1f5){return _0x1c7b6e['sendStatus'](_0x4cc174);}return _0x1c7b6e['status'](_0x4cc174)['end']();};}function respondWithResult(_0x2a1f75,_0x16fa90){_0x16fa90=_0x16fa90||0xc8;return function(_0x2600b9){if(_0x2600b9){return _0x2a1f75[_0x7897('0x17')](_0x16fa90)[_0x7897('0x18')](_0x2600b9);}};}function respondWithFilteredResult(_0x14e532,_0x1afb96){return function(_0x4f31f2){if(_0x4f31f2){var _0xfc3366=_0x4f31f2[_0x7897('0x19')],_0x48f100=_0x1afb96[_0x7897('0x1a')],_0x587f2c=_0x1afb96[_0x7897('0x1a')]+_0x1afb96[_0x7897('0x1b')],_0x38a995;if(_0x587f2c>=_0xfc3366){_0x587f2c=_0xfc3366;_0x38a995=0xc8;}else{_0x38a995=0xce;}_0x14e532[_0x7897('0x17')](_0x38a995);return _0x14e532[_0x7897('0x1c')](_0x7897('0x1d'),_0x48f100+'-'+_0x587f2c+'/'+_0xfc3366)[_0x7897('0x18')](_0x4f31f2);}return null;};}function patchUpdates(_0x281f53){return function(_0x97b864){try{jsonpatch[_0x7897('0x1e')](_0x97b864,_0x281f53,!![]);}catch(_0x2e9bc5){return BPromise[_0x7897('0x1f')](_0x2e9bc5);}return _0x97b864['save']();};}function saveUpdates(_0xd8d095,_0x1e9829){return function(_0x31774c){if(_0x31774c){return _0x31774c['update'](_0xd8d095)[_0x7897('0x20')](function(_0xeee2a7){return _0xeee2a7;});}return null;};}function removeEntity(_0x341244,_0x2e3798){return function(_0x3290e3){if(_0x3290e3){return _0x3290e3[_0x7897('0x21')]()[_0x7897('0x20')](function(){_0x341244['status'](0xcc)[_0x7897('0x22')]();});}};}function handleEntityNotFound(_0x4a7d85,_0x5371e4){return function(_0x3c592f){if(!_0x3c592f){_0x4a7d85['sendStatus'](0x194);}return _0x3c592f;};}function handleError(_0x2dc2b5,_0xc4f688){_0xc4f688=_0xc4f688||0x1f4;return function(_0x2ded55){logger[_0x7897('0x23')](_0x2ded55['stack']);if(_0x2ded55[_0x7897('0x24')]){delete _0x2ded55[_0x7897('0x24')];}_0x2dc2b5[_0x7897('0x17')](_0xc4f688)[_0x7897('0x25')](_0x2ded55);};}exports[_0x7897('0x26')]=function(_0x339739,_0x4b59b5){var _0x20d513={},_0x38666b={},_0x50fcc9={'count':0x0,'rows':[]};var _0xbd3a18=_[_0x7897('0x27')](db[_0x7897('0x28')][_0x7897('0x29')],function(_0x10b807){return{'name':_0x10b807[_0x7897('0x2a')],'type':_0x10b807[_0x7897('0x2b')][_0x7897('0x2c')]};});_0x38666b[_0x7897('0x2d')]=_[_0x7897('0x27')](_0xbd3a18,_0x7897('0x24'));_0x38666b[_0x7897('0x2e')]=_['keys'](_0x339739[_0x7897('0x2e')]);_0x38666b[_0x7897('0x2f')]=_[_0x7897('0x30')](_0x38666b['model'],_0x38666b[_0x7897('0x2e')]);_0x20d513[_0x7897('0x31')]=_[_0x7897('0x30')](_0x38666b[_0x7897('0x2d')],qs[_0x7897('0x32')](_0x339739[_0x7897('0x2e')][_0x7897('0x32')]));_0x20d513[_0x7897('0x31')]=_0x20d513['attributes'][_0x7897('0x33')]?_0x20d513[_0x7897('0x31')]:_0x38666b[_0x7897('0x2d')];if(!_0x339739['query']['hasOwnProperty'](_0x7897('0x34'))){_0x20d513[_0x7897('0x1b')]=qs['limit'](_0x339739[_0x7897('0x2e')][_0x7897('0x1b')]);_0x20d513[_0x7897('0x1a')]=qs[_0x7897('0x1a')](_0x339739['query'][_0x7897('0x1a')]);}_0x20d513[_0x7897('0x35')]=qs[_0x7897('0x36')](_0x339739[_0x7897('0x2e')]['sort']);_0x20d513[_0x7897('0x37')]=qs[_0x7897('0x2f')](_['pick'](_0x339739[_0x7897('0x2e')],_0x38666b[_0x7897('0x2f')]),_0xbd3a18);if(_0x339739[_0x7897('0x2e')]['filter']){_0x20d513[_0x7897('0x37')]=_[_0x7897('0x38')](_0x20d513[_0x7897('0x37')],{'$or':_[_0x7897('0x27')](_0xbd3a18,function(_0x261aad){if(_0x261aad['type']!==_0x7897('0x39')){var _0x44b2c2={};_0x44b2c2[_0x261aad[_0x7897('0x24')]]={'$like':'%'+_0x339739['query'][_0x7897('0x3a')]+'%'};return _0x44b2c2;}})});}_0x20d513=_['merge']({},_0x20d513,_0x339739[_0x7897('0x3b')]);var _0x5f3698={'where':_0x20d513[_0x7897('0x37')]};return db[_0x7897('0x28')][_0x7897('0x19')](_0x5f3698)[_0x7897('0x20')](function(_0x26aa2c){_0x50fcc9[_0x7897('0x19')]=_0x26aa2c;if(_0x339739[_0x7897('0x2e')]['includeAll']){_0x20d513[_0x7897('0x3c')]=[{'all':!![]}];}return db[_0x7897('0x28')][_0x7897('0x3d')](_0x20d513);})[_0x7897('0x20')](function(_0x354a28){_0x50fcc9[_0x7897('0x3e')]=_0x354a28;return _0x50fcc9;})[_0x7897('0x20')](respondWithFilteredResult(_0x4b59b5,_0x20d513))['catch'](handleError(_0x4b59b5,null));};exports['show']=function(_0x3037f6,_0x244f04){var _0x56dec8={'raw':!![],'where':{'id':_0x3037f6[_0x7897('0x3f')]['id']}},_0x1b4436={};_0x1b4436[_0x7897('0x2d')]=_['keys'](db[_0x7897('0x28')][_0x7897('0x29')]);_0x1b4436[_0x7897('0x2e')]=_[_0x7897('0x40')](_0x3037f6['query']);_0x1b4436[_0x7897('0x2f')]=_[_0x7897('0x30')](_0x1b4436['model'],_0x1b4436[_0x7897('0x2e')]);_0x56dec8[_0x7897('0x31')]=_['intersection'](_0x1b4436[_0x7897('0x2d')],qs[_0x7897('0x32')](_0x3037f6[_0x7897('0x2e')][_0x7897('0x32')]));_0x56dec8[_0x7897('0x31')]=_0x56dec8[_0x7897('0x31')][_0x7897('0x33')]?_0x56dec8[_0x7897('0x31')]:_0x1b4436[_0x7897('0x2d')];if(_0x3037f6[_0x7897('0x2e')][_0x7897('0x41')]){_0x56dec8[_0x7897('0x3c')]=[{'all':!![]}];}_0x56dec8=_[_0x7897('0x38')]({},_0x56dec8,_0x3037f6[_0x7897('0x3b')]);return db[_0x7897('0x28')]['find'](_0x56dec8)[_0x7897('0x20')](handleEntityNotFound(_0x244f04,null))[_0x7897('0x20')](respondWithResult(_0x244f04,null))[_0x7897('0x42')](handleError(_0x244f04,null));};exports[_0x7897('0x43')]=function(_0x4ae200,_0x263f40){return db[_0x7897('0x28')][_0x7897('0x43')](_0x4ae200[_0x7897('0x44')],{})[_0x7897('0x20')](respondWithResult(_0x263f40,0xc9))[_0x7897('0x42')](handleError(_0x263f40,null));};exports[_0x7897('0x45')]=function(_0x404982,_0x94df08){if(_0x404982[_0x7897('0x44')]['id']){delete _0x404982[_0x7897('0x44')]['id'];}return db[_0x7897('0x28')][_0x7897('0x46')]({'where':{'id':_0x404982[_0x7897('0x3f')]['id']}})[_0x7897('0x20')](handleEntityNotFound(_0x94df08,null))[_0x7897('0x20')](saveUpdates(_0x404982['body'],null))[_0x7897('0x20')](respondWithResult(_0x94df08,null))[_0x7897('0x42')](handleError(_0x94df08,null));};exports[_0x7897('0x21')]=function(_0x5969d5,_0x159cc5){return db[_0x7897('0x28')]['find']({'where':{'id':_0x5969d5[_0x7897('0x3f')]['id']}})[_0x7897('0x20')](handleEntityNotFound(_0x159cc5,null))[_0x7897('0x20')](removeEntity(_0x159cc5,null))[_0x7897('0x42')](handleError(_0x159cc5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 60447b2..8f5faeb 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 _0x9f15=['util','../../config/logger','api','moment','bluebird','request-promise','path','./squareMessage.attributes','exports','square_messages'];(function(_0x582bec,_0x4ac6fa){var _0x5c0753=function(_0x1c329e){while(--_0x1c329e){_0x582bec['push'](_0x582bec['shift']());}};_0x5c0753(++_0x4ac6fa);}(_0x9f15,0x96));var _0x59f1=function(_0x2c065a,_0x44e071){_0x2c065a=_0x2c065a-0x0;var _0x16dcf0=_0x9f15[_0x2c065a];return _0x16dcf0;};'use strict';var _=require('lodash');var util=require(_0x59f1('0x0'));var logger=require(_0x59f1('0x1'))(_0x59f1('0x2'));var moment=require(_0x59f1('0x3'));var BPromise=require(_0x59f1('0x4'));var rp=require(_0x59f1('0x5'));var fs=require('fs');var path=require(_0x59f1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x59f1('0x7'));module[_0x59f1('0x8')]=function(_0x1ad428,_0x25a073){return _0x1ad428['define']('SquareMessage',attributes,{'tableName':_0x59f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb8=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareMessage.attributes','define','SquareMessage','square_messages'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xdbb8,0x79));var _0x8dbb=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xdbb8[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x8dbb('0x0'));var util=require('util');var logger=require(_0x8dbb('0x1'))(_0x8dbb('0x2'));var moment=require('moment');var BPromise=require(_0x8dbb('0x3'));var rp=require(_0x8dbb('0x4'));var fs=require('fs');var path=require(_0x8dbb('0x5'));var rimraf=require(_0x8dbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x8dbb('0x7'));module['exports']=function(_0x36b56c,_0x51249f){return _0x36b56c[_0x8dbb('0x8')](_0x8dbb('0x9'),attributes,{'tableName':_0x8dbb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f98adca..fb42a99 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(_0x322152,_0xec57e3){var _0xf3bf66=function(_0x44d418){while(--_0x44d418){_0x322152['push'](_0x322152['shift']());}};_0xf3bf66(++_0xec57e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2b2424,_0x17b35f){var _0x3a2625=function(_0x334c14){while(--_0x334c14){_0x2b2424['push'](_0x2b2424['shift']());}};_0x3a2625(++_0x17b35f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 0785cfc..b341e5b 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 _0x9386=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x590a32,_0x3741b6){var _0x86d697=function(_0x355944){while(--_0x355944){_0x590a32['push'](_0x590a32['shift']());}};_0x86d697(++_0x3741b6);}(_0x9386,0x6b));var _0x6938=function(_0x4c3366,_0x46e8ac){_0x4c3366=_0x4c3366-0x0;var _0x28d21b=_0x9386[_0x4c3366];return _0x28d21b;};'use strict';var multer=require(_0x6938('0x0'));var util=require(_0x6938('0x1'));var path=require('path');var timeout=require(_0x6938('0x2'));var express=require(_0x6938('0x3'));var router=express[_0x6938('0x4')]();var auth=require(_0x6938('0x5'));var interaction=require(_0x6938('0x6'));var config=require(_0x6938('0x7'));var controller=require(_0x6938('0x8'));router[_0x6938('0x9')]('/',auth[_0x6938('0xa')](),controller['index']);router[_0x6938('0x9')](_0x6938('0xb'),auth[_0x6938('0xa')](),controller[_0x6938('0xc')]);router['get'](_0x6938('0xd'),auth[_0x6938('0xa')](),timeout(_0x6938('0xe')),controller[_0x6938('0xf')]);router[_0x6938('0x10')]('/',auth[_0x6938('0xa')](),controller[_0x6938('0x11')]);router[_0x6938('0x12')](_0x6938('0xb'),auth[_0x6938('0xa')](),controller[_0x6938('0x13')]);router['delete'](_0x6938('0xb'),auth[_0x6938('0xa')](),controller[_0x6938('0x14')]);module[_0x6938('0x15')]=router; \ No newline at end of file +var _0x0282=['./squareOdbc.controller','get','/:id','show','/:id/test','isAuthenticated','15s','create','put','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x30ea76,_0x1c2ea5){var _0x1e301f=function(_0x5cf645){while(--_0x5cf645){_0x30ea76['push'](_0x30ea76['shift']());}};_0x1e301f(++_0x1c2ea5);}(_0x0282,0xd6));var _0x2028=function(_0x4a369c,_0xeff761){_0x4a369c=_0x4a369c-0x0;var _0x1e803c=_0x0282[_0x4a369c];return _0x1e803c;};'use strict';var multer=require(_0x2028('0x0'));var util=require(_0x2028('0x1'));var path=require(_0x2028('0x2'));var timeout=require('connect-timeout');var express=require(_0x2028('0x3'));var router=express[_0x2028('0x4')]();var auth=require(_0x2028('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2028('0x6'));var controller=require(_0x2028('0x7'));router[_0x2028('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2028('0x8')](_0x2028('0x9'),auth['isAuthenticated'](),controller[_0x2028('0xa')]);router[_0x2028('0x8')](_0x2028('0xb'),auth[_0x2028('0xc')](),timeout(_0x2028('0xd')),controller['test']);router['post']('/',auth[_0x2028('0xc')](),controller[_0x2028('0xe')]);router[_0x2028('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2028('0x9'),auth[_0x2028('0xc')](),controller['destroy']);module[_0x2028('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 eda9f5e..d0e6893 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 _0xe9cd=['STRING','name','sequelize','exports'];(function(_0x9ae832,_0x3610ff){var _0x29322c=function(_0x214e36){while(--_0x214e36){_0x9ae832['push'](_0x9ae832['shift']());}};_0x29322c(++_0x3610ff);}(_0xe9cd,0x182));var _0xde9c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe9cd[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0xde9c('0x0'));module[_0xde9c('0x1')]={'name':{'type':Sequelize[_0xde9c('0x2')],'unique':_0xde9c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde9c('0x2')]}}; \ No newline at end of file +var _0x1063=['name','sequelize','STRING'];(function(_0x35af7b,_0x59171d){var _0x4984e1=function(_0x8a0eaf){while(--_0x8a0eaf){_0x35af7b['push'](_0x35af7b['shift']());}};_0x4984e1(++_0x59171d);}(_0x1063,0xb5));var _0x3106=function(_0x387f7c,_0x99426c){_0x387f7c=_0x387f7c-0x0;var _0x40b07f=_0x1063[_0x387f7c];return _0x40b07f;};'use strict';var Sequelize=require(_0x3106('0x0'));module['exports']={'name':{'type':Sequelize[_0x3106('0x1')],'unique':_0x3106('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3106('0x1')]},'description':{'type':Sequelize[_0x3106('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2d62fba..194ff7b 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 _0x7890=['get','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','test','dsn','odbc','openSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x7890,0xd2));var _0x0789=function(_0x2f1c20,_0x20b719){_0x2f1c20=_0x2f1c20-0x0;var _0x1531b8=_0x7890[_0x2f1c20];return _0x1531b8;};'use strict';var pdf=require(_0x0789('0x0'));var emlformat=require(_0x0789('0x1'));var rimraf=require(_0x0789('0x2'));var zipdir=require(_0x0789('0x3'));var jsonpatch=require(_0x0789('0x4'));var rp=require(_0x0789('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0789('0x6'));var sox=require(_0x0789('0x7'));var csv=require(_0x0789('0x8'));var ejs=require(_0x0789('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0789('0xa'));var crypto=require(_0x0789('0xb'));var jsforce=require(_0x0789('0xc'));var deskjs=require(_0x0789('0xd'));var toCsv=require(_0x0789('0x8'));var querystring=require('querystring');var Papa=require(_0x0789('0xe'));var Redis=require(_0x0789('0xf'));var authService=require(_0x0789('0x10'));var qs=require(_0x0789('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0789('0x12'));var logger=require(_0x0789('0x13'))(_0x0789('0x14'));var utils=require(_0x0789('0x15'));var config=require(_0x0789('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0789('0x17'))['db'];function respondWithStatusCode(_0x345b2d,_0x25257e){_0x25257e=_0x25257e||0xcc;return function(_0x438f72){if(_0x438f72){return _0x345b2d[_0x0789('0x18')](_0x25257e);}return _0x345b2d[_0x0789('0x19')](_0x25257e)[_0x0789('0x1a')]();};}function respondWithResult(_0x5351d6,_0xcd956f){_0xcd956f=_0xcd956f||0xc8;return function(_0x5ed152){if(_0x5ed152){return _0x5351d6[_0x0789('0x19')](_0xcd956f)[_0x0789('0x1b')](_0x5ed152);}};}function respondWithFilteredResult(_0x3a7c36,_0x103d08){return function(_0x5a391d){if(_0x5a391d){var _0xc45852=_0x5a391d[_0x0789('0x1c')],_0xb805e=_0x103d08['offset'],_0x17eb9f=_0x103d08[_0x0789('0x1d')]+_0x103d08[_0x0789('0x1e')],_0x484d45;if(_0x17eb9f>=_0xc45852){_0x17eb9f=_0xc45852;_0x484d45=0xc8;}else{_0x484d45=0xce;}_0x3a7c36[_0x0789('0x19')](_0x484d45);return _0x3a7c36[_0x0789('0x1f')](_0x0789('0x20'),_0xb805e+'-'+_0x17eb9f+'/'+_0xc45852)[_0x0789('0x1b')](_0x5a391d);}return null;};}function patchUpdates(_0x218a16){return function(_0x3b968f){try{jsonpatch[_0x0789('0x21')](_0x3b968f,_0x218a16,!![]);}catch(_0x4e35af){return BPromise[_0x0789('0x22')](_0x4e35af);}return _0x3b968f[_0x0789('0x23')]();};}function saveUpdates(_0xad5ac,_0x1c831e){return function(_0x26e92a){if(_0x26e92a){return _0x26e92a[_0x0789('0x24')](_0xad5ac)['then'](function(_0xa7ec6b){return _0xa7ec6b;});}return null;};}function removeEntity(_0x58530f,_0x41c6b4){return function(_0x51c66a){if(_0x51c66a){return _0x51c66a[_0x0789('0x25')]()[_0x0789('0x26')](function(){var _0xb48e1f=_0x51c66a[_0x0789('0x27')]({'plain':!![]});var _0x5bc012=_0x0789('0x28');return db[_0x0789('0x29')][_0x0789('0x25')]({'where':{'type':_0x5bc012,'resourceId':_0xb48e1f['id']}})[_0x0789('0x26')](function(){return _0x51c66a;});})['then'](function(){_0x58530f[_0x0789('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea865,_0x17f354){return function(_0x34da97){if(!_0x34da97){_0x2ea865[_0x0789('0x18')](0x194);}return _0x34da97;};}function handleError(_0x68336a,_0x2522ec){_0x2522ec=_0x2522ec||0x1f4;return function(_0xd500ea){logger[_0x0789('0x2a')](_0xd500ea[_0x0789('0x2b')]);if(_0xd500ea[_0x0789('0x2c')]){delete _0xd500ea[_0x0789('0x2c')];}_0x68336a[_0x0789('0x19')](_0x2522ec)[_0x0789('0x2d')](_0xd500ea);};}exports['index']=function(_0x837e7e,_0x37c3ea){var _0x45ac01={},_0x26eecf={},_0x3d6631={'count':0x0,'rows':[]};var _0x2ecb10=_[_0x0789('0x2e')](db[_0x0789('0x2f')][_0x0789('0x30')],function(_0x4df95e){return{'name':_0x4df95e[_0x0789('0x31')],'type':_0x4df95e['type'][_0x0789('0x32')]};});_0x26eecf[_0x0789('0x33')]=_[_0x0789('0x2e')](_0x2ecb10,'name');_0x26eecf[_0x0789('0x34')]=_[_0x0789('0x35')](_0x837e7e[_0x0789('0x34')]);_0x26eecf[_0x0789('0x36')]=_[_0x0789('0x37')](_0x26eecf['model'],_0x26eecf[_0x0789('0x34')]);_0x45ac01['attributes']=_[_0x0789('0x37')](_0x26eecf[_0x0789('0x33')],qs['fields'](_0x837e7e[_0x0789('0x34')][_0x0789('0x38')]));_0x45ac01[_0x0789('0x39')]=_0x45ac01[_0x0789('0x39')][_0x0789('0x3a')]?_0x45ac01['attributes']:_0x26eecf['model'];if(!_0x837e7e['query']['hasOwnProperty'](_0x0789('0x3b'))){_0x45ac01[_0x0789('0x1e')]=qs[_0x0789('0x1e')](_0x837e7e['query'][_0x0789('0x1e')]);_0x45ac01[_0x0789('0x1d')]=qs[_0x0789('0x1d')](_0x837e7e[_0x0789('0x34')][_0x0789('0x1d')]);}_0x45ac01['order']=qs['sort'](_0x837e7e[_0x0789('0x34')]['sort']);_0x45ac01[_0x0789('0x3c')]=qs[_0x0789('0x36')](_['pick'](_0x837e7e['query'],_0x26eecf['filters']),_0x2ecb10);if(_0x837e7e[_0x0789('0x34')]['filter']){_0x45ac01['where']=_[_0x0789('0x3d')](_0x45ac01[_0x0789('0x3c')],{'$or':_[_0x0789('0x2e')](_0x2ecb10,function(_0x445dbc){if(_0x445dbc['type']!==_0x0789('0x3e')){var _0x336f39={};_0x336f39[_0x445dbc['name']]={'$like':'%'+_0x837e7e['query']['filter']+'%'};return _0x336f39;}})});}_0x45ac01=_[_0x0789('0x3d')]({},_0x45ac01,_0x837e7e[_0x0789('0x3f')]);var _0x570b03={'where':_0x45ac01[_0x0789('0x3c')]};return db['SquareOdbc']['count'](_0x570b03)['then'](function(_0x1f3166){_0x3d6631['count']=_0x1f3166;if(_0x837e7e['query'][_0x0789('0x40')]){_0x45ac01[_0x0789('0x41')]=[{'all':!![]}];}return db[_0x0789('0x2f')][_0x0789('0x42')](_0x45ac01);})[_0x0789('0x26')](function(_0x505ee7){_0x3d6631[_0x0789('0x43')]=_0x505ee7;return _0x3d6631;})[_0x0789('0x26')](respondWithFilteredResult(_0x37c3ea,_0x45ac01))[_0x0789('0x44')](handleError(_0x37c3ea,null));};exports[_0x0789('0x45')]=function(_0x7bb335,_0x54621b){var _0x113abd={'raw':!![],'where':{'id':_0x7bb335[_0x0789('0x46')]['id']}},_0x245747={};_0x245747['model']=_['keys'](db['SquareOdbc'][_0x0789('0x30')]);_0x245747['query']=_['keys'](_0x7bb335[_0x0789('0x34')]);_0x245747[_0x0789('0x36')]=_['intersection'](_0x245747['model'],_0x245747[_0x0789('0x34')]);_0x113abd['attributes']=_['intersection'](_0x245747[_0x0789('0x33')],qs[_0x0789('0x38')](_0x7bb335[_0x0789('0x34')][_0x0789('0x38')]));_0x113abd[_0x0789('0x39')]=_0x113abd['attributes'][_0x0789('0x3a')]?_0x113abd[_0x0789('0x39')]:_0x245747['model'];if(_0x7bb335[_0x0789('0x34')][_0x0789('0x40')]){_0x113abd['include']=[{'all':!![]}];}_0x113abd=_[_0x0789('0x3d')]({},_0x113abd,_0x7bb335['options']);return db[_0x0789('0x2f')][_0x0789('0x47')](_0x113abd)['then'](handleEntityNotFound(_0x54621b,null))[_0x0789('0x26')](respondWithResult(_0x54621b,null))[_0x0789('0x44')](handleError(_0x54621b,null));};exports[_0x0789('0x48')]=function(_0x359311,_0x20cf99){return db[_0x0789('0x2f')][_0x0789('0x48')](_0x359311[_0x0789('0x49')],{})[_0x0789('0x26')](function(_0x220dee){var _0x2bb49b=_0x359311['user'][_0x0789('0x27')]({'plain':!![]});if(!_0x2bb49b)throw new Error(_0x0789('0x4a'));if(_0x2bb49b[_0x0789('0x4b')]===_0x0789('0x4c')){var _0x239eac=_0x220dee[_0x0789('0x27')]({'plain':!![]});var _0x633aca=_0x0789('0x28');return db[_0x0789('0x4d')][_0x0789('0x47')]({'where':{'name':_0x633aca,'userProfileId':_0x2bb49b['userProfileId']},'raw':!![]})[_0x0789('0x26')](function(_0x3c7465){if(_0x3c7465&&_0x3c7465[_0x0789('0x4e')]===0x0){return db['UserProfileResource'][_0x0789('0x48')]({'name':_0x239eac[_0x0789('0x2c')],'resourceId':_0x239eac['id'],'type':_0x3c7465[_0x0789('0x2c')],'sectionId':_0x3c7465['id']},{})[_0x0789('0x26')](function(){return _0x220dee;});}else{return _0x220dee;}})['catch'](function(_0x465e23){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x465e23);throw _0x465e23;});}return _0x220dee;})[_0x0789('0x26')](respondWithResult(_0x20cf99,0xc9))['catch'](handleError(_0x20cf99,null));};exports[_0x0789('0x24')]=function(_0x52337b,_0x585883){if(_0x52337b[_0x0789('0x49')]['id']){delete _0x52337b[_0x0789('0x49')]['id'];}return db[_0x0789('0x2f')]['find']({'where':{'id':_0x52337b['params']['id']}})[_0x0789('0x26')](handleEntityNotFound(_0x585883,null))[_0x0789('0x26')](saveUpdates(_0x52337b[_0x0789('0x49')],null))['then'](respondWithResult(_0x585883,null))[_0x0789('0x44')](handleError(_0x585883,null));};exports[_0x0789('0x25')]=function(_0x2d9e5f,_0x2be6c8){return db[_0x0789('0x2f')][_0x0789('0x47')]({'where':{'id':_0x2d9e5f[_0x0789('0x46')]['id']}})[_0x0789('0x26')](handleEntityNotFound(_0x2be6c8,null))[_0x0789('0x26')](removeEntity(_0x2be6c8,null))['catch'](handleError(_0x2be6c8,null));};exports[_0x0789('0x4f')]=function(_0x45ed6a,_0x269151,_0x1e77b5){var _0xcc929a;return db[_0x0789('0x2f')][_0x0789('0x47')]({'where':{'id':_0x45ed6a[_0x0789('0x46')]['id']},'attributes':['id',_0x0789('0x50')]})[_0x0789('0x26')](handleEntityNotFound(_0x269151,null))['then'](function(_0x5efd9b){if(_0x5efd9b){var _0x350cb0=require(_0x0789('0x51'))();_0x350cb0[_0x0789('0x52')](_0x5efd9b[_0x0789('0x50')]);_0x350cb0['closeSync']();return _0x5efd9b;}})[_0x0789('0x26')](respondWithResult(_0x269151,null))[_0x0789('0x44')](handleError(_0x269151,null));}; \ No newline at end of file +var _0xee78=['error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','end'];(function(_0x443d70,_0x5662e4){var _0x321533=function(_0x399a39){while(--_0x399a39){_0x443d70['push'](_0x443d70['shift']());}};_0x321533(++_0x5662e4);}(_0xee78,0x80));var _0x8ee7=function(_0x13dedd,_0x4e1e97){_0x13dedd=_0x13dedd-0x0;var _0x2b2dbe=_0xee78[_0x13dedd];return _0x2b2dbe;};'use strict';var pdf=require(_0x8ee7('0x0'));var emlformat=require(_0x8ee7('0x1'));var rimraf=require(_0x8ee7('0x2'));var zipdir=require(_0x8ee7('0x3'));var jsonpatch=require(_0x8ee7('0x4'));var rp=require(_0x8ee7('0x5'));var moment=require(_0x8ee7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8ee7('0x7'));var util=require('util');var path=require(_0x8ee7('0x8'));var sox=require(_0x8ee7('0x9'));var csv=require(_0x8ee7('0xa'));var ejs=require(_0x8ee7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8ee7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ee7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8ee7('0xe'));var Papa=require('papaparse');var Redis=require(_0x8ee7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ee7('0x10'));var as=require(_0x8ee7('0x11'));var hardwareService=require(_0x8ee7('0x12'));var logger=require('../../config/logger')(_0x8ee7('0x13'));var utils=require('../../config/utils');var config=require(_0x8ee7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ee7('0x15'))['db'];function respondWithStatusCode(_0x3baad6,_0x5b6381){_0x5b6381=_0x5b6381||0xcc;return function(_0x3bc76f){if(_0x3bc76f){return _0x3baad6[_0x8ee7('0x16')](_0x5b6381);}return _0x3baad6[_0x8ee7('0x17')](_0x5b6381)['end']();};}function respondWithResult(_0xf5fab3,_0x3d2a84){_0x3d2a84=_0x3d2a84||0xc8;return function(_0x20dc9c){if(_0x20dc9c){return _0xf5fab3[_0x8ee7('0x17')](_0x3d2a84)[_0x8ee7('0x18')](_0x20dc9c);}};}function respondWithFilteredResult(_0x269ac0,_0x242522){return function(_0x178c05){if(_0x178c05){var _0x1a8913=_0x178c05[_0x8ee7('0x19')],_0x23eafa=_0x242522[_0x8ee7('0x1a')],_0x5cfb8a=_0x242522[_0x8ee7('0x1a')]+_0x242522['limit'],_0x158e56;if(_0x5cfb8a>=_0x1a8913){_0x5cfb8a=_0x1a8913;_0x158e56=0xc8;}else{_0x158e56=0xce;}_0x269ac0[_0x8ee7('0x17')](_0x158e56);return _0x269ac0[_0x8ee7('0x1b')](_0x8ee7('0x1c'),_0x23eafa+'-'+_0x5cfb8a+'/'+_0x1a8913)[_0x8ee7('0x18')](_0x178c05);}return null;};}function patchUpdates(_0x330b87){return function(_0x272d2c){try{jsonpatch[_0x8ee7('0x1d')](_0x272d2c,_0x330b87,!![]);}catch(_0x2ed34f){return BPromise[_0x8ee7('0x1e')](_0x2ed34f);}return _0x272d2c[_0x8ee7('0x1f')]();};}function saveUpdates(_0x1cf900,_0x394eb6){return function(_0x280790){if(_0x280790){return _0x280790['update'](_0x1cf900)[_0x8ee7('0x20')](function(_0x4d0a52){return _0x4d0a52;});}return null;};}function removeEntity(_0x1864de,_0x1cde3f){return function(_0x21d816){if(_0x21d816){return _0x21d816[_0x8ee7('0x21')]()[_0x8ee7('0x20')](function(){var _0x52d15c=_0x21d816[_0x8ee7('0x22')]({'plain':!![]});var _0x48cb12=_0x8ee7('0x23');return db[_0x8ee7('0x24')]['destroy']({'where':{'type':_0x48cb12,'resourceId':_0x52d15c['id']}})[_0x8ee7('0x20')](function(){return _0x21d816;});})['then'](function(){_0x1864de[_0x8ee7('0x17')](0xcc)[_0x8ee7('0x25')]();});}};}function handleEntityNotFound(_0xf761d5,_0x4558b9){return function(_0xdb611d){if(!_0xdb611d){_0xf761d5[_0x8ee7('0x16')](0x194);}return _0xdb611d;};}function handleError(_0x5584ff,_0x468c74){_0x468c74=_0x468c74||0x1f4;return function(_0x41cda0){logger[_0x8ee7('0x26')](_0x41cda0[_0x8ee7('0x27')]);if(_0x41cda0[_0x8ee7('0x28')]){delete _0x41cda0[_0x8ee7('0x28')];}_0x5584ff['status'](_0x468c74)['send'](_0x41cda0);};}exports[_0x8ee7('0x29')]=function(_0x5a1cc8,_0x15a945){var _0x1e3e2f={},_0x3cbb06={},_0x2e5c2b={'count':0x0,'rows':[]};var _0x31ee05=_[_0x8ee7('0x2a')](db[_0x8ee7('0x2b')][_0x8ee7('0x2c')],function(_0x266c3e){return{'name':_0x266c3e[_0x8ee7('0x2d')],'type':_0x266c3e[_0x8ee7('0x2e')][_0x8ee7('0x2f')]};});_0x3cbb06[_0x8ee7('0x30')]=_[_0x8ee7('0x2a')](_0x31ee05,_0x8ee7('0x28'));_0x3cbb06[_0x8ee7('0x31')]=_[_0x8ee7('0x32')](_0x5a1cc8['query']);_0x3cbb06[_0x8ee7('0x33')]=_[_0x8ee7('0x34')](_0x3cbb06['model'],_0x3cbb06['query']);_0x1e3e2f[_0x8ee7('0x35')]=_[_0x8ee7('0x34')](_0x3cbb06[_0x8ee7('0x30')],qs[_0x8ee7('0x36')](_0x5a1cc8[_0x8ee7('0x31')][_0x8ee7('0x36')]));_0x1e3e2f[_0x8ee7('0x35')]=_0x1e3e2f[_0x8ee7('0x35')][_0x8ee7('0x37')]?_0x1e3e2f[_0x8ee7('0x35')]:_0x3cbb06['model'];if(!_0x5a1cc8[_0x8ee7('0x31')][_0x8ee7('0x38')](_0x8ee7('0x39'))){_0x1e3e2f[_0x8ee7('0x3a')]=qs[_0x8ee7('0x3a')](_0x5a1cc8[_0x8ee7('0x31')][_0x8ee7('0x3a')]);_0x1e3e2f['offset']=qs[_0x8ee7('0x1a')](_0x5a1cc8[_0x8ee7('0x31')]['offset']);}_0x1e3e2f[_0x8ee7('0x3b')]=qs[_0x8ee7('0x3c')](_0x5a1cc8[_0x8ee7('0x31')][_0x8ee7('0x3c')]);_0x1e3e2f[_0x8ee7('0x3d')]=qs[_0x8ee7('0x33')](_['pick'](_0x5a1cc8['query'],_0x3cbb06[_0x8ee7('0x33')]),_0x31ee05);if(_0x5a1cc8['query']['filter']){_0x1e3e2f[_0x8ee7('0x3d')]=_[_0x8ee7('0x3e')](_0x1e3e2f[_0x8ee7('0x3d')],{'$or':_[_0x8ee7('0x2a')](_0x31ee05,function(_0x422b52){if(_0x422b52[_0x8ee7('0x2e')]!=='VIRTUAL'){var _0x20ca90={};_0x20ca90[_0x422b52[_0x8ee7('0x28')]]={'$like':'%'+_0x5a1cc8['query'][_0x8ee7('0x3f')]+'%'};return _0x20ca90;}})});}_0x1e3e2f=_[_0x8ee7('0x3e')]({},_0x1e3e2f,_0x5a1cc8['options']);var _0x2274e3={'where':_0x1e3e2f[_0x8ee7('0x3d')]};return db[_0x8ee7('0x2b')]['count'](_0x2274e3)['then'](function(_0x5cf583){_0x2e5c2b[_0x8ee7('0x19')]=_0x5cf583;if(_0x5a1cc8[_0x8ee7('0x31')][_0x8ee7('0x40')]){_0x1e3e2f[_0x8ee7('0x41')]=[{'all':!![]}];}return db[_0x8ee7('0x2b')][_0x8ee7('0x42')](_0x1e3e2f);})['then'](function(_0x30da97){_0x2e5c2b['rows']=_0x30da97;return _0x2e5c2b;})['then'](respondWithFilteredResult(_0x15a945,_0x1e3e2f))[_0x8ee7('0x43')](handleError(_0x15a945,null));};exports[_0x8ee7('0x44')]=function(_0x42fafc,_0x4c0cac){var _0x5e3ad5={'raw':!![],'where':{'id':_0x42fafc[_0x8ee7('0x45')]['id']}},_0x1a9379={};_0x1a9379['model']=_['keys'](db['SquareOdbc'][_0x8ee7('0x2c')]);_0x1a9379[_0x8ee7('0x31')]=_['keys'](_0x42fafc[_0x8ee7('0x31')]);_0x1a9379[_0x8ee7('0x33')]=_[_0x8ee7('0x34')](_0x1a9379[_0x8ee7('0x30')],_0x1a9379[_0x8ee7('0x31')]);_0x5e3ad5[_0x8ee7('0x35')]=_[_0x8ee7('0x34')](_0x1a9379[_0x8ee7('0x30')],qs[_0x8ee7('0x36')](_0x42fafc[_0x8ee7('0x31')]['fields']));_0x5e3ad5[_0x8ee7('0x35')]=_0x5e3ad5[_0x8ee7('0x35')][_0x8ee7('0x37')]?_0x5e3ad5[_0x8ee7('0x35')]:_0x1a9379['model'];if(_0x42fafc[_0x8ee7('0x31')]['includeAll']){_0x5e3ad5[_0x8ee7('0x41')]=[{'all':!![]}];}_0x5e3ad5=_[_0x8ee7('0x3e')]({},_0x5e3ad5,_0x42fafc['options']);return db[_0x8ee7('0x2b')]['find'](_0x5e3ad5)[_0x8ee7('0x20')](handleEntityNotFound(_0x4c0cac,null))[_0x8ee7('0x20')](respondWithResult(_0x4c0cac,null))[_0x8ee7('0x43')](handleError(_0x4c0cac,null));};exports['create']=function(_0x4868ac,_0x559d58){return db[_0x8ee7('0x2b')][_0x8ee7('0x46')](_0x4868ac[_0x8ee7('0x47')],{})['then'](function(_0x464ac2){var _0x73e860=_0x4868ac[_0x8ee7('0x48')][_0x8ee7('0x22')]({'plain':!![]});if(!_0x73e860)throw new Error(_0x8ee7('0x49'));if(_0x73e860[_0x8ee7('0x4a')]===_0x8ee7('0x48')){var _0x3470b8=_0x464ac2[_0x8ee7('0x22')]({'plain':!![]});var _0xf1f409=_0x8ee7('0x23');return db[_0x8ee7('0x4b')][_0x8ee7('0x4c')]({'where':{'name':_0xf1f409,'userProfileId':_0x73e860[_0x8ee7('0x4d')]},'raw':!![]})['then'](function(_0xf44098){if(_0xf44098&&_0xf44098['autoAssociation']===0x0){return db[_0x8ee7('0x24')][_0x8ee7('0x46')]({'name':_0x3470b8[_0x8ee7('0x28')],'resourceId':_0x3470b8['id'],'type':_0xf44098[_0x8ee7('0x28')],'sectionId':_0xf44098['id']},{})[_0x8ee7('0x20')](function(){return _0x464ac2;});}else{return _0x464ac2;}})[_0x8ee7('0x43')](function(_0x54ad61){logger['error'](_0x8ee7('0x4e'),_0x54ad61);throw _0x54ad61;});}return _0x464ac2;})[_0x8ee7('0x20')](respondWithResult(_0x559d58,0xc9))[_0x8ee7('0x43')](handleError(_0x559d58,null));};exports['update']=function(_0x9cb96b,_0x657f9d){if(_0x9cb96b[_0x8ee7('0x47')]['id']){delete _0x9cb96b['body']['id'];}return db[_0x8ee7('0x2b')][_0x8ee7('0x4c')]({'where':{'id':_0x9cb96b[_0x8ee7('0x45')]['id']}})[_0x8ee7('0x20')](handleEntityNotFound(_0x657f9d,null))['then'](saveUpdates(_0x9cb96b['body'],null))['then'](respondWithResult(_0x657f9d,null))['catch'](handleError(_0x657f9d,null));};exports['destroy']=function(_0x595a9d,_0x1b444b){return db[_0x8ee7('0x2b')][_0x8ee7('0x4c')]({'where':{'id':_0x595a9d[_0x8ee7('0x45')]['id']}})[_0x8ee7('0x20')](handleEntityNotFound(_0x1b444b,null))['then'](removeEntity(_0x1b444b,null))[_0x8ee7('0x43')](handleError(_0x1b444b,null));};exports[_0x8ee7('0x4f')]=function(_0x5c60b4,_0x1bb3df,_0x21b9ef){var _0x351b85;return db[_0x8ee7('0x2b')][_0x8ee7('0x4c')]({'where':{'id':_0x5c60b4['params']['id']},'attributes':['id','dsn']})[_0x8ee7('0x20')](handleEntityNotFound(_0x1bb3df,null))[_0x8ee7('0x20')](function(_0xafc6ef){if(_0xafc6ef){var _0x4e730d=require(_0x8ee7('0x50'))();_0x4e730d['openSync'](_0xafc6ef[_0x8ee7('0x51')]);_0x4e730d[_0x8ee7('0x52')]();return _0xafc6ef;}})[_0x8ee7('0x20')](respondWithResult(_0x1bb3df,null))[_0x8ee7('0x43')](handleError(_0x1bb3df,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 130a5ea..8ee06f3 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 _0x6bdd=['./squareOdbc.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x310990,_0x245984){_0x310990=_0x310990-0x0;var _0x648534=_0x6bdd[_0x310990];return _0x648534;};'use strict';var _=require('lodash');var util=require(_0xd6bd('0x0'));var logger=require(_0xd6bd('0x1'))(_0xd6bd('0x2'));var moment=require(_0xd6bd('0x3'));var BPromise=require(_0xd6bd('0x4'));var rp=require(_0xd6bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6bd('0x6'));var config=require('../../config/environment');var attributes=require(_0xd6bd('0x7'));module[_0xd6bd('0x8')]=function(_0x4f4a05,_0x122321){return _0x4f4a05[_0xd6bd('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a69=['api','request-promise','path','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5a69,0x1c0));var _0x95a6=function(_0x286434,_0x48a738){_0x286434=_0x286434-0x0;var _0x596d8c=_0x5a69[_0x286434];return _0x596d8c;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var logger=require('../../config/logger')(_0x95a6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95a6('0x3'));var fs=require('fs');var path=require(_0x95a6('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x95a6('0x5'));module[_0x95a6('0x6')]=function(_0x23c00c,_0x30fbd2){return _0x23c00c[_0x95a6('0x7')](_0x95a6('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9346188..4645250 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','where','include','map','attributes'];(function(_0x775fcf,_0x19b2d7){var _0x530cd9=function(_0x48da45){while(--_0x48da45){_0x775fcf['push'](_0x775fcf['shift']());}};_0x530cd9(++_0x19b2d7);}(_0x814b,0x1a2));var _0xb814=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0x814b[_0x5b7963];return _0x57f611;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['SquareOdbc']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowSquareOdbc',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x451e44,_0x2a4226){var _0x58f6ca=function(_0x504c35){while(--_0x504c35){_0x451e44['push'](_0x451e44['shift']());}};_0x58f6ca(++_0x2a4226);}(_0x55ca,0x126));var _0xa55c=function(_0x2bfd4f,_0x1bbf2c){_0x2bfd4f=_0x2bfd4f-0x0;var _0x341849=_0x55ca[_0x2bfd4f];return _0x341849;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 381a205..a682ae8 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 _0x0123=['post','create','addUsers','delete','destroy','removeUsers','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0123,0xe2));var _0x3012=function(_0x45caf1,_0x444021){_0x45caf1=_0x45caf1-0x0;var _0x31c737=_0x0123[_0x45caf1];return _0x31c737;};'use strict';var multer=require('multer');var util=require(_0x3012('0x0'));var path=require(_0x3012('0x1'));var timeout=require('connect-timeout');var express=require(_0x3012('0x2'));var router=express[_0x3012('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3012('0x4'));var config=require(_0x3012('0x5'));var controller=require(_0x3012('0x6'));router[_0x3012('0x7')]('/',auth[_0x3012('0x8')](),controller[_0x3012('0x9')]);router[_0x3012('0x7')](_0x3012('0xa'),auth[_0x3012('0x8')](),controller[_0x3012('0xb')]);router[_0x3012('0x7')](_0x3012('0xc'),auth[_0x3012('0x8')](),controller[_0x3012('0xd')]);router[_0x3012('0xe')]('/',auth[_0x3012('0x8')](),controller[_0x3012('0xf')]);router['post'](_0x3012('0xc'),auth[_0x3012('0x8')](),controller[_0x3012('0x10')]);router['put'](_0x3012('0xa'),auth[_0x3012('0x8')](),controller['update']);router[_0x3012('0x11')](_0x3012('0xa'),auth['isAuthenticated'](),controller[_0x3012('0x12')]);router[_0x3012('0x11')](_0x3012('0xc'),auth[_0x3012('0x8')](),controller[_0x3012('0x13')]);module['exports']=router; \ No newline at end of file +var _0xccff=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','put','/:id','update','destroy','removeUsers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4bffc8,_0x306878){var _0x36bd0e=function(_0x53aa5c){while(--_0x53aa5c){_0x4bffc8['push'](_0x4bffc8['shift']());}};_0x36bd0e(++_0x306878);}(_0xccff,0x198));var _0xfccf=function(_0x9884e3,_0x34a043){_0x9884e3=_0x9884e3-0x0;var _0x6e3ec=_0xccff[_0x9884e3];return _0x6e3ec;};'use strict';var multer=require(_0xfccf('0x0'));var util=require(_0xfccf('0x1'));var path=require('path');var timeout=require(_0xfccf('0x2'));var express=require(_0xfccf('0x3'));var router=express[_0xfccf('0x4')]();var auth=require(_0xfccf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfccf('0x6'));var controller=require(_0xfccf('0x7'));router[_0xfccf('0x8')]('/',auth[_0xfccf('0x9')](),controller[_0xfccf('0xa')]);router[_0xfccf('0x8')]('/:id',auth[_0xfccf('0x9')](),controller[_0xfccf('0xb')]);router[_0xfccf('0x8')](_0xfccf('0xc'),auth[_0xfccf('0x9')](),controller[_0xfccf('0xd')]);router[_0xfccf('0xe')]('/',auth[_0xfccf('0x9')](),controller[_0xfccf('0xf')]);router['post'](_0xfccf('0xc'),auth['isAuthenticated'](),controller[_0xfccf('0x10')]);router[_0xfccf('0x11')](_0xfccf('0x12'),auth[_0xfccf('0x9')](),controller[_0xfccf('0x13')]);router['delete'](_0xfccf('0x12'),auth['isAuthenticated'](),controller[_0xfccf('0x14')]);router['delete'](_0xfccf('0xc'),auth[_0xfccf('0x9')](),controller[_0xfccf('0x15')]);module[_0xfccf('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index fa5061e..7fbc131 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 _0xf8ea=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xf8ea,0x71));var _0xaf8e=function(_0x6e5577,_0x3839c2){_0x6e5577=_0x6e5577-0x0;var _0x640c17=_0xf8ea[_0x6e5577];return _0x640c17;};'use strict';var Sequelize=require(_0xaf8e('0x0'));module[_0xaf8e('0x1')]={'name':{'type':Sequelize[_0xaf8e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xaf8e('0x3')]},'preproduction':{'type':Sequelize[_0xaf8e('0x4')](_0xaf8e('0x5')),'get':function(){if(this[_0xaf8e('0x6')](_0xaf8e('0x7'))){return this['getDataValue']('preproduction')[_0xaf8e('0x8')](_0xaf8e('0x9'));}}},'production':{'type':Sequelize[_0xaf8e('0x4')]('long'),'get':function(){if(this[_0xaf8e('0x6')](_0xaf8e('0xa'))){return this[_0xaf8e('0x6')](_0xaf8e('0xa'))[_0xaf8e('0x8')](_0xaf8e('0x9'));}}},'savedAt':{'type':Sequelize[_0xaf8e('0xb')]},'publishedAt':{'type':Sequelize[_0xaf8e('0xb')]}}; \ No newline at end of file +var _0x61ee=['long','getDataValue','preproduction','toString','production','utf8','DATE','exports','STRING','TEXT','BLOB'];(function(_0x1df515,_0x1dcd56){var _0x3292b7=function(_0x23338d){while(--_0x23338d){_0x1df515['push'](_0x1df515['shift']());}};_0x3292b7(++_0x1dcd56);}(_0x61ee,0xee));var _0xe61e=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x61ee[_0x3be7ff];return _0x186721;};'use strict';var Sequelize=require('sequelize');module[_0xe61e('0x0')]={'name':{'type':Sequelize[_0xe61e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe61e('0x2')]},'preproduction':{'type':Sequelize[_0xe61e('0x3')](_0xe61e('0x4')),'get':function(){if(this[_0xe61e('0x5')]('preproduction')){return this[_0xe61e('0x5')](_0xe61e('0x6'))[_0xe61e('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xe61e('0x5')](_0xe61e('0x8'))){return this['getDataValue'](_0xe61e('0x8'))[_0xe61e('0x7')](_0xe61e('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe61e('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1d4a1cb..5a00a47 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 _0x1cf1=['json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SquareProject','includeAll','include','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1cf1,0xa4));var _0x11cf=function(_0x49b849,_0x5af34c){_0x49b849=_0x49b849-0x0;var _0x1bef72=_0x1cf1[_0x49b849];return _0x1bef72;};'use strict';var pdf=require(_0x11cf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x11cf('0x1'));var zipdir=require(_0x11cf('0x2'));var jsonpatch=require(_0x11cf('0x3'));var rp=require(_0x11cf('0x4'));var moment=require(_0x11cf('0x5'));var BPromise=require(_0x11cf('0x6'));var Mustache=require(_0x11cf('0x7'));var util=require(_0x11cf('0x8'));var path=require('path');var sox=require(_0x11cf('0x9'));var csv=require(_0x11cf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11cf('0xb'));var squel=require(_0x11cf('0xc'));var crypto=require('crypto');var jsforce=require(_0x11cf('0xd'));var deskjs=require(_0x11cf('0xe'));var toCsv=require(_0x11cf('0xa'));var querystring=require(_0x11cf('0xf'));var Papa=require(_0x11cf('0x10'));var Redis=require(_0x11cf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x11cf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11cf('0x13'));var logger=require(_0x11cf('0x14'))(_0x11cf('0x15'));var utils=require(_0x11cf('0x16'));var config=require(_0x11cf('0x17'));var licenseUtil=require(_0x11cf('0x18'));var db=require('../../mysqldb')['db'];config[_0x11cf('0x19')]=_[_0x11cf('0x1a')](config[_0x11cf('0x19')],{'host':_0x11cf('0x1b'),'port':0x18eb});var socket=require(_0x11cf('0x1c'))(new Redis(config[_0x11cf('0x19')]));require(_0x11cf('0x1d'))[_0x11cf('0x1e')](socket);function respondWithStatusCode(_0x21048d,_0x51e7c5){_0x51e7c5=_0x51e7c5||0xcc;return function(_0x538f35){if(_0x538f35){return _0x21048d[_0x11cf('0x1f')](_0x51e7c5);}return _0x21048d[_0x11cf('0x20')](_0x51e7c5)[_0x11cf('0x21')]();};}function respondWithResult(_0x223e67,_0x3c9a00){_0x3c9a00=_0x3c9a00||0xc8;return function(_0x4b0fe0){if(_0x4b0fe0){return _0x223e67['status'](_0x3c9a00)[_0x11cf('0x22')](_0x4b0fe0);}};}function respondWithFilteredResult(_0x17a876,_0x56e35f){return function(_0x54de7b){if(_0x54de7b){var _0x1e90dc=_0x54de7b[_0x11cf('0x23')],_0x31665b=_0x56e35f[_0x11cf('0x24')],_0x4c5c03=_0x56e35f[_0x11cf('0x24')]+_0x56e35f[_0x11cf('0x25')],_0x4701f2;if(_0x4c5c03>=_0x1e90dc){_0x4c5c03=_0x1e90dc;_0x4701f2=0xc8;}else{_0x4701f2=0xce;}_0x17a876[_0x11cf('0x20')](_0x4701f2);return _0x17a876[_0x11cf('0x26')](_0x11cf('0x27'),_0x31665b+'-'+_0x4c5c03+'/'+_0x1e90dc)[_0x11cf('0x22')](_0x54de7b);}return null;};}function patchUpdates(_0x2c9d63){return function(_0x3dbfed){try{jsonpatch[_0x11cf('0x28')](_0x3dbfed,_0x2c9d63,!![]);}catch(_0x156497){return BPromise['reject'](_0x156497);}return _0x3dbfed[_0x11cf('0x29')]();};}function saveUpdates(_0x269dfb,_0x34d98b){return function(_0x3d5d3e){if(_0x3d5d3e){return _0x3d5d3e[_0x11cf('0x2a')](_0x269dfb)[_0x11cf('0x2b')](function(_0x85e752){return _0x85e752;});}return null;};}function removeEntity(_0x3a5af0,_0x50e43b){return function(_0x5dbad8){if(_0x5dbad8){return _0x5dbad8['destroy']()[_0x11cf('0x2b')](function(){var _0x11ad6f=_0x5dbad8[_0x11cf('0x2c')]({'plain':!![]});var _0x49fea6='SquareProjects';return db[_0x11cf('0x2d')][_0x11cf('0x2e')]({'where':{'type':_0x49fea6,'resourceId':_0x11ad6f['id']}})['then'](function(){return _0x5dbad8;});})[_0x11cf('0x2b')](function(){_0x3a5af0[_0x11cf('0x20')](0xcc)[_0x11cf('0x21')]();});}};}function handleEntityNotFound(_0x18d577,_0x3c0809){return function(_0x4f2a10){if(!_0x4f2a10){_0x18d577['sendStatus'](0x194);}return _0x4f2a10;};}function handleError(_0x1a4f7a,_0x24f369){_0x24f369=_0x24f369||0x1f4;return function(_0x3e4de8){logger[_0x11cf('0x2f')](_0x3e4de8[_0x11cf('0x30')]);if(_0x3e4de8[_0x11cf('0x31')]){delete _0x3e4de8[_0x11cf('0x31')];}_0x1a4f7a['status'](_0x24f369)[_0x11cf('0x32')](_0x3e4de8);};}exports[_0x11cf('0x33')]=function(_0x24f7ef,_0x16e0b2){var _0x5baced={},_0x23cc26={},_0x5f3ac3={'count':0x0,'rows':[]};var _0x22fb88=_[_0x11cf('0x34')](db['SquareProject'][_0x11cf('0x35')],function(_0x40e609){return{'name':_0x40e609[_0x11cf('0x36')],'type':_0x40e609[_0x11cf('0x37')][_0x11cf('0x38')]};});_0x23cc26[_0x11cf('0x39')]=_[_0x11cf('0x34')](_0x22fb88,_0x11cf('0x31'));_0x23cc26['query']=_[_0x11cf('0x3a')](_0x24f7ef[_0x11cf('0x3b')]);_0x23cc26[_0x11cf('0x3c')]=_['intersection'](_0x23cc26[_0x11cf('0x39')],_0x23cc26[_0x11cf('0x3b')]);_0x5baced[_0x11cf('0x3d')]=_[_0x11cf('0x3e')](_0x23cc26[_0x11cf('0x39')],qs['fields'](_0x24f7ef['query'][_0x11cf('0x3f')]));_0x5baced[_0x11cf('0x3d')]=_0x5baced[_0x11cf('0x3d')][_0x11cf('0x40')]?_0x5baced['attributes']:_0x23cc26['model'];if(!_0x24f7ef['query'][_0x11cf('0x41')](_0x11cf('0x42'))){_0x5baced['limit']=qs[_0x11cf('0x25')](_0x24f7ef[_0x11cf('0x3b')][_0x11cf('0x25')]);_0x5baced[_0x11cf('0x24')]=qs[_0x11cf('0x24')](_0x24f7ef[_0x11cf('0x3b')][_0x11cf('0x24')]);}_0x5baced['order']=qs[_0x11cf('0x43')](_0x24f7ef[_0x11cf('0x3b')][_0x11cf('0x43')]);_0x5baced[_0x11cf('0x44')]=qs[_0x11cf('0x3c')](_[_0x11cf('0x45')](_0x24f7ef[_0x11cf('0x3b')],_0x23cc26[_0x11cf('0x3c')]),_0x22fb88);if(_0x24f7ef[_0x11cf('0x3b')][_0x11cf('0x46')]){_0x5baced[_0x11cf('0x44')]=_[_0x11cf('0x47')](_0x5baced[_0x11cf('0x44')],{'$or':_[_0x11cf('0x34')](_0x22fb88,function(_0x3b8b1e){if(_0x3b8b1e[_0x11cf('0x37')]!=='VIRTUAL'){var _0x1c8337={};_0x1c8337[_0x3b8b1e[_0x11cf('0x31')]]={'$like':'%'+_0x24f7ef[_0x11cf('0x3b')][_0x11cf('0x46')]+'%'};return _0x1c8337;}})});}_0x5baced=_[_0x11cf('0x47')]({},_0x5baced,_0x24f7ef[_0x11cf('0x48')]);var _0x2a9610={'where':_0x5baced['where']};return db[_0x11cf('0x49')][_0x11cf('0x23')](_0x2a9610)[_0x11cf('0x2b')](function(_0x3dfa11){_0x5f3ac3[_0x11cf('0x23')]=_0x3dfa11;if(_0x24f7ef[_0x11cf('0x3b')][_0x11cf('0x4a')]){_0x5baced[_0x11cf('0x4b')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x5baced);})[_0x11cf('0x2b')](function(_0x328ca6){_0x5f3ac3['rows']=_0x328ca6;return _0x5f3ac3;})[_0x11cf('0x2b')](respondWithFilteredResult(_0x16e0b2,_0x5baced))['catch'](handleError(_0x16e0b2,null));};exports[_0x11cf('0x4c')]=function(_0x101e85,_0x3b629c){var _0x4d2c76={'raw':![],'where':{'id':_0x101e85['params']['id']}},_0x533b24={};_0x533b24[_0x11cf('0x39')]=_[_0x11cf('0x3a')](db['SquareProject'][_0x11cf('0x35')]);_0x533b24['query']=_[_0x11cf('0x3a')](_0x101e85[_0x11cf('0x3b')]);_0x533b24[_0x11cf('0x3c')]=_[_0x11cf('0x3e')](_0x533b24[_0x11cf('0x39')],_0x533b24['query']);_0x4d2c76[_0x11cf('0x3d')]=_['intersection'](_0x533b24['model'],qs[_0x11cf('0x3f')](_0x101e85[_0x11cf('0x3b')]['fields']));_0x4d2c76[_0x11cf('0x3d')]=_0x4d2c76[_0x11cf('0x3d')][_0x11cf('0x40')]?_0x4d2c76[_0x11cf('0x3d')]:_0x533b24[_0x11cf('0x39')];if(_0x101e85['query'][_0x11cf('0x4a')]){_0x4d2c76[_0x11cf('0x4b')]=[{'all':!![]}];}_0x4d2c76=_[_0x11cf('0x47')]({},_0x4d2c76,_0x101e85[_0x11cf('0x48')]);return db['SquareProject'][_0x11cf('0x4d')](_0x4d2c76)[_0x11cf('0x2b')](handleEntityNotFound(_0x3b629c,null))[_0x11cf('0x2b')](respondWithResult(_0x3b629c,null))['catch'](handleError(_0x3b629c,null));};exports[_0x11cf('0x4e')]=function(_0x575a22,_0x36ddeb){return db[_0x11cf('0x49')][_0x11cf('0x4e')](_0x575a22['body'],{})[_0x11cf('0x2b')](function(_0x307b5b){var _0x4f597e=_0x575a22['user'][_0x11cf('0x2c')]({'plain':!![]});if(!_0x4f597e)throw new Error(_0x11cf('0x4f'));if(_0x4f597e[_0x11cf('0x50')]===_0x11cf('0x51')){var _0x5f07c4=_0x307b5b[_0x11cf('0x2c')]({'plain':!![]});var _0x15eaa9=_0x11cf('0x52');return db[_0x11cf('0x53')][_0x11cf('0x4d')]({'where':{'name':_0x15eaa9,'userProfileId':_0x4f597e[_0x11cf('0x54')]},'raw':!![]})[_0x11cf('0x2b')](function(_0x4a49b5){if(_0x4a49b5&&_0x4a49b5[_0x11cf('0x55')]===0x0){return db[_0x11cf('0x2d')][_0x11cf('0x4e')]({'name':_0x5f07c4[_0x11cf('0x31')],'resourceId':_0x5f07c4['id'],'type':_0x4a49b5[_0x11cf('0x31')],'sectionId':_0x4a49b5['id']},{})[_0x11cf('0x2b')](function(){return _0x307b5b;});}else{return _0x307b5b;}})[_0x11cf('0x56')](function(_0x38b4c5){logger['error'](_0x11cf('0x57'),_0x38b4c5);throw _0x38b4c5;});}return _0x307b5b;})[_0x11cf('0x2b')](respondWithResult(_0x36ddeb,0xc9))[_0x11cf('0x56')](handleError(_0x36ddeb,null));};exports[_0x11cf('0x2a')]=function(_0x194744,_0x51f8fd){if(_0x194744[_0x11cf('0x58')]['id']){delete _0x194744[_0x11cf('0x58')]['id'];}return db[_0x11cf('0x49')][_0x11cf('0x4d')]({'where':{'id':_0x194744[_0x11cf('0x59')]['id']}})['then'](handleEntityNotFound(_0x51f8fd,null))[_0x11cf('0x2b')](saveUpdates(_0x194744[_0x11cf('0x58')],null))[_0x11cf('0x2b')](respondWithResult(_0x51f8fd,null))[_0x11cf('0x56')](handleError(_0x51f8fd,null));};exports['destroy']=function(_0xd149a6,_0x94afd1){return db[_0x11cf('0x49')][_0x11cf('0x4d')]({'where':{'id':_0xd149a6[_0x11cf('0x59')]['id']}})['then'](handleEntityNotFound(_0x94afd1,null))[_0x11cf('0x2b')](removeEntity(_0x94afd1,null))['catch'](handleError(_0x94afd1,null));};exports[_0x11cf('0x5a')]=function(_0xab97df,_0x3cc9f0,_0xb717e5){return db['SquareProject']['find']({'where':{'id':_0xab97df[_0x11cf('0x59')]['id']}})['then'](handleEntityNotFound(_0x3cc9f0,null))[_0x11cf('0x2b')](function(_0x15c7dc){if(_0x15c7dc){return _0x15c7dc['addUsers'](_0xab97df['body']['ids'],_['omit'](_0xab97df[_0x11cf('0x58')],[_0x11cf('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x3cc9f0,null))[_0x11cf('0x56')](handleError(_0x3cc9f0,null));};exports[_0x11cf('0x5c')]=function(_0x589984,_0x325337,_0x6f205c){return db[_0x11cf('0x49')][_0x11cf('0x4d')]({'where':{'id':_0x589984['params']['id']}})[_0x11cf('0x2b')](handleEntityNotFound(_0x325337,null))[_0x11cf('0x2b')](function(_0x30276e){if(_0x30276e){return _0x30276e['removeUsers'](_0x589984['query']['ids'])[_0x11cf('0x2b')](function(){if(_['isArray'](_0x589984['query'][_0x11cf('0x5b')])){for(var _0x24b497=0x0;_0x24b497<_0x589984[_0x11cf('0x3b')][_0x11cf('0x5b')][_0x11cf('0x40')];_0x24b497+=0x1){socket[_0x11cf('0x5d')](_0x11cf('0x5e'),{'UserId':Number(_0x589984[_0x11cf('0x3b')][_0x11cf('0x5b')][_0x24b497]),'SquareProjectId':Number(_0x589984[_0x11cf('0x59')]['id'])});}}else{socket['emit'](_0x11cf('0x5e'),{'UserId':Number(_0x589984['query'][_0x11cf('0x5b')]),'SquareProjectId':Number(_0x589984[_0x11cf('0x59')]['id'])});}});}})[_0x11cf('0x2b')](respondWithStatusCode(_0x325337,null))[_0x11cf('0x56')](handleError(_0x325337,null));};exports[_0x11cf('0x5f')]=function(_0x2cb401,_0x5641c6,_0x2631d5){var _0x1042ee={};var _0xde8161={};var _0x1698e9;var _0x223ad9;return db[_0x11cf('0x49')][_0x11cf('0x60')]({'where':{'id':_0x2cb401[_0x11cf('0x59')]['id']}})['then'](handleEntityNotFound(_0x5641c6,null))[_0x11cf('0x2b')](function(_0x3abc84){if(_0x3abc84){_0x1698e9=_0x3abc84;_0xde8161[_0x11cf('0x39')]=_[_0x11cf('0x3a')](db[_0x11cf('0x61')]['rawAttributes']);_0xde8161['query']=_['keys'](_0x2cb401[_0x11cf('0x3b')]);_0xde8161[_0x11cf('0x3c')]=_[_0x11cf('0x3e')](_0xde8161[_0x11cf('0x39')],_0xde8161[_0x11cf('0x3b')]);_0x1042ee['attributes']=_['intersection'](_0xde8161['model'],qs[_0x11cf('0x3f')](_0x2cb401[_0x11cf('0x3b')]['fields']));_0x1042ee['attributes']=_0x1042ee[_0x11cf('0x3d')][_0x11cf('0x40')]?_0x1042ee[_0x11cf('0x3d')]:_0xde8161[_0x11cf('0x39')];_0x1042ee[_0x11cf('0x62')]=qs['sort'](_0x2cb401[_0x11cf('0x3b')][_0x11cf('0x43')]);_0x1042ee[_0x11cf('0x44')]=qs[_0x11cf('0x3c')](_[_0x11cf('0x45')](_0x2cb401['query'],_0xde8161[_0x11cf('0x3c')]));if(_0x2cb401['query'][_0x11cf('0x46')]){_0x1042ee[_0x11cf('0x44')]=_['merge'](_0x1042ee[_0x11cf('0x44')],{'$or':_[_0x11cf('0x34')](_0x1042ee[_0x11cf('0x3d')],function(_0x5231d7){var _0x1476ac={};_0x1476ac[_0x5231d7]={'$like':'%'+_0x2cb401[_0x11cf('0x3b')][_0x11cf('0x46')]+'%'};return _0x1476ac;})});}_0x1042ee=_[_0x11cf('0x47')]({},_0x1042ee,_0x2cb401[_0x11cf('0x48')]);return _0x1698e9[_0x11cf('0x5f')](_0x1042ee);}})[_0x11cf('0x2b')](function(_0x5eef63){if(_0x5eef63){_0x223ad9=_0x5eef63[_0x11cf('0x40')];if(!_0x2cb401[_0x11cf('0x3b')][_0x11cf('0x41')](_0x11cf('0x42'))){_0x1042ee[_0x11cf('0x25')]=qs[_0x11cf('0x25')](_0x2cb401[_0x11cf('0x3b')][_0x11cf('0x25')]);_0x1042ee[_0x11cf('0x24')]=qs[_0x11cf('0x24')](_0x2cb401[_0x11cf('0x3b')][_0x11cf('0x24')]);}return _0x1698e9['getUsers'](_0x1042ee);}})['then'](function(_0x3010ba){if(_0x3010ba){return _0x3010ba?{'count':_0x223ad9,'rows':_0x3010ba}:null;}})[_0x11cf('0x2b')](respondWithResult(_0x5641c6,null))[_0x11cf('0x56')](handleError(_0x5641c6,null));}; \ No newline at end of file +var _0x5bec=['show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','index','SquareProject','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x4739b1,_0x428e79){var _0x229da0=function(_0x554ed3){while(--_0x554ed3){_0x4739b1['push'](_0x4739b1['shift']());}};_0x229da0(++_0x428e79);}(_0x5bec,0x74));var _0xc5be=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x5bec[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require(_0xc5be('0x0'));var emlformat=require(_0xc5be('0x1'));var rimraf=require(_0xc5be('0x2'));var zipdir=require(_0xc5be('0x3'));var jsonpatch=require(_0xc5be('0x4'));var rp=require(_0xc5be('0x5'));var moment=require(_0xc5be('0x6'));var BPromise=require(_0xc5be('0x7'));var Mustache=require(_0xc5be('0x8'));var util=require(_0xc5be('0x9'));var path=require(_0xc5be('0xa'));var sox=require(_0xc5be('0xb'));var csv=require(_0xc5be('0xc'));var ejs=require(_0xc5be('0xd'));var fs=require('fs');var _=require(_0xc5be('0xe'));var squel=require(_0xc5be('0xf'));var crypto=require(_0xc5be('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xc5be('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5be('0x12'));var authService=require(_0xc5be('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc5be('0x14'));var hardwareService=require(_0xc5be('0x15'));var logger=require(_0xc5be('0x16'))('api');var utils=require(_0xc5be('0x17'));var config=require(_0xc5be('0x18'));var licenseUtil=require(_0xc5be('0x19'));var db=require(_0xc5be('0x1a'))['db'];config[_0xc5be('0x1b')]=_[_0xc5be('0x1c')](config[_0xc5be('0x1b')],{'host':_0xc5be('0x1d'),'port':0x18eb});var socket=require(_0xc5be('0x1e'))(new Redis(config[_0xc5be('0x1b')]));require(_0xc5be('0x1f'))[_0xc5be('0x20')](socket);function respondWithStatusCode(_0x51d5af,_0x5a7e92){_0x5a7e92=_0x5a7e92||0xcc;return function(_0x3e69ee){if(_0x3e69ee){return _0x51d5af['sendStatus'](_0x5a7e92);}return _0x51d5af['status'](_0x5a7e92)[_0xc5be('0x21')]();};}function respondWithResult(_0x379ad4,_0x3da487){_0x3da487=_0x3da487||0xc8;return function(_0x339d90){if(_0x339d90){return _0x379ad4[_0xc5be('0x22')](_0x3da487)[_0xc5be('0x23')](_0x339d90);}};}function respondWithFilteredResult(_0x2f423e,_0x279cd3){return function(_0x13dc64){if(_0x13dc64){var _0x405b2a=_0x13dc64[_0xc5be('0x24')],_0x31e914=_0x279cd3[_0xc5be('0x25')],_0x307e5c=_0x279cd3[_0xc5be('0x25')]+_0x279cd3[_0xc5be('0x26')],_0x23188d;if(_0x307e5c>=_0x405b2a){_0x307e5c=_0x405b2a;_0x23188d=0xc8;}else{_0x23188d=0xce;}_0x2f423e['status'](_0x23188d);return _0x2f423e['set'](_0xc5be('0x27'),_0x31e914+'-'+_0x307e5c+'/'+_0x405b2a)[_0xc5be('0x23')](_0x13dc64);}return null;};}function patchUpdates(_0x4ecf8b){return function(_0x543166){try{jsonpatch[_0xc5be('0x28')](_0x543166,_0x4ecf8b,!![]);}catch(_0x5c17c4){return BPromise[_0xc5be('0x29')](_0x5c17c4);}return _0x543166['save']();};}function saveUpdates(_0x56d83e,_0x59fdae){return function(_0x4b87d3){if(_0x4b87d3){return _0x4b87d3[_0xc5be('0x2a')](_0x56d83e)[_0xc5be('0x2b')](function(_0x10322d){return _0x10322d;});}return null;};}function removeEntity(_0x52b6b1,_0x41c62e){return function(_0x4fd451){if(_0x4fd451){return _0x4fd451[_0xc5be('0x2c')]()[_0xc5be('0x2b')](function(){var _0x20bb79=_0x4fd451[_0xc5be('0x2d')]({'plain':!![]});var _0x1cf802=_0xc5be('0x2e');return db[_0xc5be('0x2f')]['destroy']({'where':{'type':_0x1cf802,'resourceId':_0x20bb79['id']}})[_0xc5be('0x2b')](function(){return _0x4fd451;});})[_0xc5be('0x2b')](function(){_0x52b6b1['status'](0xcc)[_0xc5be('0x21')]();});}};}function handleEntityNotFound(_0x217ed3,_0x274d8b){return function(_0x1a5418){if(!_0x1a5418){_0x217ed3['sendStatus'](0x194);}return _0x1a5418;};}function handleError(_0x38fb88,_0x5e0997){_0x5e0997=_0x5e0997||0x1f4;return function(_0x461072){logger[_0xc5be('0x30')](_0x461072['stack']);if(_0x461072[_0xc5be('0x31')]){delete _0x461072[_0xc5be('0x31')];}_0x38fb88['status'](_0x5e0997)[_0xc5be('0x32')](_0x461072);};}exports[_0xc5be('0x33')]=function(_0x26329e,_0x5cc571){var _0x1908b7={},_0x5624bc={},_0xeedfbb={'count':0x0,'rows':[]};var _0x12b9fe=_['map'](db[_0xc5be('0x34')][_0xc5be('0x35')],function(_0x317fc5){return{'name':_0x317fc5[_0xc5be('0x36')],'type':_0x317fc5[_0xc5be('0x37')]['key']};});_0x5624bc['model']=_[_0xc5be('0x38')](_0x12b9fe,_0xc5be('0x31'));_0x5624bc[_0xc5be('0x39')]=_['keys'](_0x26329e['query']);_0x5624bc[_0xc5be('0x3a')]=_['intersection'](_0x5624bc['model'],_0x5624bc['query']);_0x1908b7['attributes']=_[_0xc5be('0x3b')](_0x5624bc[_0xc5be('0x3c')],qs[_0xc5be('0x3d')](_0x26329e[_0xc5be('0x39')]['fields']));_0x1908b7[_0xc5be('0x3e')]=_0x1908b7['attributes'][_0xc5be('0x3f')]?_0x1908b7['attributes']:_0x5624bc[_0xc5be('0x3c')];if(!_0x26329e[_0xc5be('0x39')][_0xc5be('0x40')]('nolimit')){_0x1908b7[_0xc5be('0x26')]=qs[_0xc5be('0x26')](_0x26329e[_0xc5be('0x39')]['limit']);_0x1908b7[_0xc5be('0x25')]=qs[_0xc5be('0x25')](_0x26329e[_0xc5be('0x39')][_0xc5be('0x25')]);}_0x1908b7[_0xc5be('0x41')]=qs[_0xc5be('0x42')](_0x26329e['query'][_0xc5be('0x42')]);_0x1908b7[_0xc5be('0x43')]=qs['filters'](_[_0xc5be('0x44')](_0x26329e[_0xc5be('0x39')],_0x5624bc[_0xc5be('0x3a')]),_0x12b9fe);if(_0x26329e[_0xc5be('0x39')][_0xc5be('0x45')]){_0x1908b7[_0xc5be('0x43')]=_[_0xc5be('0x46')](_0x1908b7[_0xc5be('0x43')],{'$or':_[_0xc5be('0x38')](_0x12b9fe,function(_0x3ffe5e){if(_0x3ffe5e[_0xc5be('0x37')]!==_0xc5be('0x47')){var _0x37292e={};_0x37292e[_0x3ffe5e[_0xc5be('0x31')]]={'$like':'%'+_0x26329e[_0xc5be('0x39')][_0xc5be('0x45')]+'%'};return _0x37292e;}})});}_0x1908b7=_['merge']({},_0x1908b7,_0x26329e[_0xc5be('0x48')]);var _0x3b59ef={'where':_0x1908b7[_0xc5be('0x43')]};return db[_0xc5be('0x34')][_0xc5be('0x24')](_0x3b59ef)['then'](function(_0x23b294){_0xeedfbb['count']=_0x23b294;if(_0x26329e['query'][_0xc5be('0x49')]){_0x1908b7[_0xc5be('0x4a')]=[{'all':!![]}];}return db[_0xc5be('0x34')][_0xc5be('0x4b')](_0x1908b7);})[_0xc5be('0x2b')](function(_0x5713af){_0xeedfbb[_0xc5be('0x4c')]=_0x5713af;return _0xeedfbb;})[_0xc5be('0x2b')](respondWithFilteredResult(_0x5cc571,_0x1908b7))[_0xc5be('0x4d')](handleError(_0x5cc571,null));};exports[_0xc5be('0x4e')]=function(_0x4a7609,_0x209b77){var _0x10ceba={'raw':![],'where':{'id':_0x4a7609[_0xc5be('0x4f')]['id']}},_0x510079={};_0x510079['model']=_['keys'](db['SquareProject'][_0xc5be('0x35')]);_0x510079[_0xc5be('0x39')]=_[_0xc5be('0x50')](_0x4a7609[_0xc5be('0x39')]);_0x510079[_0xc5be('0x3a')]=_[_0xc5be('0x3b')](_0x510079['model'],_0x510079[_0xc5be('0x39')]);_0x10ceba['attributes']=_[_0xc5be('0x3b')](_0x510079[_0xc5be('0x3c')],qs[_0xc5be('0x3d')](_0x4a7609[_0xc5be('0x39')][_0xc5be('0x3d')]));_0x10ceba['attributes']=_0x10ceba['attributes']['length']?_0x10ceba['attributes']:_0x510079['model'];if(_0x4a7609[_0xc5be('0x39')][_0xc5be('0x49')]){_0x10ceba[_0xc5be('0x4a')]=[{'all':!![]}];}_0x10ceba=_['merge']({},_0x10ceba,_0x4a7609[_0xc5be('0x48')]);return db[_0xc5be('0x34')][_0xc5be('0x51')](_0x10ceba)['then'](handleEntityNotFound(_0x209b77,null))[_0xc5be('0x2b')](respondWithResult(_0x209b77,null))[_0xc5be('0x4d')](handleError(_0x209b77,null));};exports[_0xc5be('0x52')]=function(_0x4f23f3,_0x1d4b36){return db[_0xc5be('0x34')][_0xc5be('0x52')](_0x4f23f3[_0xc5be('0x53')],{})['then'](function(_0x55adab){var _0x13bef3=_0x4f23f3[_0xc5be('0x54')][_0xc5be('0x2d')]({'plain':!![]});if(!_0x13bef3)throw new Error(_0xc5be('0x55'));if(_0x13bef3[_0xc5be('0x56')]===_0xc5be('0x54')){var _0x46a05d=_0x55adab[_0xc5be('0x2d')]({'plain':!![]});var _0x18cfed='SquareProjects';return db['UserProfileSection'][_0xc5be('0x51')]({'where':{'name':_0x18cfed,'userProfileId':_0x13bef3[_0xc5be('0x57')]},'raw':!![]})[_0xc5be('0x2b')](function(_0xa641e6){if(_0xa641e6&&_0xa641e6['autoAssociation']===0x0){return db[_0xc5be('0x2f')]['create']({'name':_0x46a05d[_0xc5be('0x31')],'resourceId':_0x46a05d['id'],'type':_0xa641e6[_0xc5be('0x31')],'sectionId':_0xa641e6['id']},{})[_0xc5be('0x2b')](function(){return _0x55adab;});}else{return _0x55adab;}})[_0xc5be('0x4d')](function(_0xbf51a0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbf51a0);throw _0xbf51a0;});}return _0x55adab;})[_0xc5be('0x2b')](respondWithResult(_0x1d4b36,0xc9))[_0xc5be('0x4d')](handleError(_0x1d4b36,null));};exports[_0xc5be('0x2a')]=function(_0x446df4,_0x428018){if(_0x446df4[_0xc5be('0x53')]['id']){delete _0x446df4['body']['id'];}return db[_0xc5be('0x34')][_0xc5be('0x51')]({'where':{'id':_0x446df4[_0xc5be('0x4f')]['id']}})[_0xc5be('0x2b')](handleEntityNotFound(_0x428018,null))[_0xc5be('0x2b')](saveUpdates(_0x446df4[_0xc5be('0x53')],null))[_0xc5be('0x2b')](respondWithResult(_0x428018,null))[_0xc5be('0x4d')](handleError(_0x428018,null));};exports['destroy']=function(_0x49e12,_0x34b5f2){return db['SquareProject'][_0xc5be('0x51')]({'where':{'id':_0x49e12[_0xc5be('0x4f')]['id']}})[_0xc5be('0x2b')](handleEntityNotFound(_0x34b5f2,null))[_0xc5be('0x2b')](removeEntity(_0x34b5f2,null))[_0xc5be('0x4d')](handleError(_0x34b5f2,null));};exports[_0xc5be('0x58')]=function(_0x4356f5,_0xef20b,_0x5dff19){return db[_0xc5be('0x34')]['find']({'where':{'id':_0x4356f5['params']['id']}})[_0xc5be('0x2b')](handleEntityNotFound(_0xef20b,null))[_0xc5be('0x2b')](function(_0x440bef){if(_0x440bef){return _0x440bef[_0xc5be('0x58')](_0x4356f5[_0xc5be('0x53')][_0xc5be('0x59')],_[_0xc5be('0x5a')](_0x4356f5[_0xc5be('0x53')],[_0xc5be('0x59'),'id'])||{});}})[_0xc5be('0x2b')](respondWithResult(_0xef20b,null))[_0xc5be('0x4d')](handleError(_0xef20b,null));};exports[_0xc5be('0x5b')]=function(_0x55450a,_0x3c0872,_0x2422a4){return db[_0xc5be('0x34')]['find']({'where':{'id':_0x55450a[_0xc5be('0x4f')]['id']}})[_0xc5be('0x2b')](handleEntityNotFound(_0x3c0872,null))['then'](function(_0xad36fe){if(_0xad36fe){return _0xad36fe[_0xc5be('0x5b')](_0x55450a[_0xc5be('0x39')][_0xc5be('0x59')])[_0xc5be('0x2b')](function(){if(_[_0xc5be('0x5c')](_0x55450a[_0xc5be('0x39')][_0xc5be('0x59')])){for(var _0x3b77ea=0x0;_0x3b77ea<_0x55450a[_0xc5be('0x39')][_0xc5be('0x59')][_0xc5be('0x3f')];_0x3b77ea+=0x1){socket[_0xc5be('0x5d')](_0xc5be('0x5e'),{'UserId':Number(_0x55450a[_0xc5be('0x39')]['ids'][_0x3b77ea]),'SquareProjectId':Number(_0x55450a[_0xc5be('0x4f')]['id'])});}}else{socket[_0xc5be('0x5d')](_0xc5be('0x5e'),{'UserId':Number(_0x55450a['query'][_0xc5be('0x59')]),'SquareProjectId':Number(_0x55450a['params']['id'])});}});}})[_0xc5be('0x2b')](respondWithStatusCode(_0x3c0872,null))[_0xc5be('0x4d')](handleError(_0x3c0872,null));};exports[_0xc5be('0x5f')]=function(_0x53e32d,_0x278565,_0x1145f1){var _0x591526={};var _0x4e74a9={};var _0x152b2b;var _0x51c937;return db[_0xc5be('0x34')]['findOne']({'where':{'id':_0x53e32d[_0xc5be('0x4f')]['id']}})['then'](handleEntityNotFound(_0x278565,null))[_0xc5be('0x2b')](function(_0xce3655){if(_0xce3655){_0x152b2b=_0xce3655;_0x4e74a9[_0xc5be('0x3c')]=_[_0xc5be('0x50')](db[_0xc5be('0x60')][_0xc5be('0x35')]);_0x4e74a9[_0xc5be('0x39')]=_[_0xc5be('0x50')](_0x53e32d[_0xc5be('0x39')]);_0x4e74a9['filters']=_[_0xc5be('0x3b')](_0x4e74a9['model'],_0x4e74a9[_0xc5be('0x39')]);_0x591526[_0xc5be('0x3e')]=_[_0xc5be('0x3b')](_0x4e74a9[_0xc5be('0x3c')],qs[_0xc5be('0x3d')](_0x53e32d[_0xc5be('0x39')][_0xc5be('0x3d')]));_0x591526[_0xc5be('0x3e')]=_0x591526['attributes']['length']?_0x591526[_0xc5be('0x3e')]:_0x4e74a9['model'];_0x591526['order']=qs[_0xc5be('0x42')](_0x53e32d[_0xc5be('0x39')][_0xc5be('0x42')]);_0x591526[_0xc5be('0x43')]=qs[_0xc5be('0x3a')](_[_0xc5be('0x44')](_0x53e32d['query'],_0x4e74a9[_0xc5be('0x3a')]));if(_0x53e32d[_0xc5be('0x39')][_0xc5be('0x45')]){_0x591526[_0xc5be('0x43')]=_['merge'](_0x591526['where'],{'$or':_[_0xc5be('0x38')](_0x591526[_0xc5be('0x3e')],function(_0x4bac4a){var _0x5bc26f={};_0x5bc26f[_0x4bac4a]={'$like':'%'+_0x53e32d[_0xc5be('0x39')][_0xc5be('0x45')]+'%'};return _0x5bc26f;})});}_0x591526=_['merge']({},_0x591526,_0x53e32d[_0xc5be('0x48')]);return _0x152b2b['getUsers'](_0x591526);}})[_0xc5be('0x2b')](function(_0x4f9b55){if(_0x4f9b55){_0x51c937=_0x4f9b55[_0xc5be('0x3f')];if(!_0x53e32d[_0xc5be('0x39')][_0xc5be('0x40')]('nolimit')){_0x591526[_0xc5be('0x26')]=qs[_0xc5be('0x26')](_0x53e32d[_0xc5be('0x39')][_0xc5be('0x26')]);_0x591526['offset']=qs[_0xc5be('0x25')](_0x53e32d[_0xc5be('0x39')]['offset']);}return _0x152b2b[_0xc5be('0x5f')](_0x591526);}})[_0xc5be('0x2b')](function(_0x57ddd0){if(_0x57ddd0){return _0x57ddd0?{'count':_0x51c937,'rows':_0x57ddd0}:null;}})[_0xc5be('0x2b')](respondWithResult(_0x278565,null))[_0xc5be('0x4d')](handleError(_0x278565,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b99121f..8cfae7b 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 _0xb7b4=['events','../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5cdb17,_0x315b05){var _0x3cfe36=function(_0x550ee7){while(--_0x550ee7){_0x5cdb17['push'](_0x5cdb17['shift']());}};_0x3cfe36(++_0x315b05);}(_0xb7b4,0x122));var _0x4b7b=function(_0x56e8ec,_0x4a205e){_0x56e8ec=_0x56e8ec-0x0;var _0x3b9b14=_0xb7b4[_0x56e8ec];return _0x3b9b14;};'use strict';var EventEmitter=require(_0x4b7b('0x0'));var SquareProject=require(_0x4b7b('0x1'))['db'][_0x4b7b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4b7b('0x3')](0x0);var events={'afterCreate':_0x4b7b('0x4'),'afterUpdate':'update','afterDestroy':_0x4b7b('0x5')};function emitEvent(_0x5da25d){return function(_0x192522,_0x2b2f4d,_0x15134f){SquareProjectEvents['emit'](_0x5da25d+':'+_0x192522['id'],_0x192522);SquareProjectEvents[_0x4b7b('0x6')](_0x5da25d,_0x192522);_0x15134f(null);};}for(var e in events){if(events[_0x4b7b('0x7')](e)){var event=events[e];SquareProject[_0x4b7b('0x8')](e,emitEvent(event));}}module[_0x4b7b('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xfabe=['hasOwnProperty','events','setMaxListeners','save','update','remove','emit'];(function(_0xc69046,_0x3ab5a6){var _0x691b0c=function(_0xfcd6f){while(--_0xfcd6f){_0xc69046['push'](_0xc69046['shift']());}};_0x691b0c(++_0x3ab5a6);}(_0xfabe,0x9b));var _0xefab=function(_0x1e7ec2,_0x219936){_0x1e7ec2=_0x1e7ec2-0x0;var _0x1d9cac=_0xfabe[_0x1e7ec2];return _0x1d9cac;};'use strict';var EventEmitter=require(_0xefab('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xefab('0x1')](0x0);var events={'afterCreate':_0xefab('0x2'),'afterUpdate':_0xefab('0x3'),'afterDestroy':_0xefab('0x4')};function emitEvent(_0x341a8f){return function(_0x18212a,_0x4d0035,_0x5e453b){SquareProjectEvents[_0xefab('0x5')](_0x341a8f+':'+_0x18212a['id'],_0x18212a);SquareProjectEvents[_0xefab('0x5')](_0x341a8f,_0x18212a);_0x5e453b(null);};}for(var e in events){if(events[_0xefab('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0dc6f56..9637990 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 _0xff96=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger'];(function(_0x23150d,_0x20df25){var _0x2b2863=function(_0x5b9070){while(--_0x5b9070){_0x23150d['push'](_0x23150d['shift']());}};_0x2b2863(++_0x20df25);}(_0xff96,0x179));var _0x6ff9=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0xff96[_0x3d0016];return _0x1dcb28;};'use strict';var _=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var logger=require(_0x6ff9('0x2'))(_0x6ff9('0x3'));var moment=require(_0x6ff9('0x4'));var BPromise=require(_0x6ff9('0x5'));var rp=require(_0x6ff9('0x6'));var fs=require('fs');var path=require(_0x6ff9('0x7'));var rimraf=require(_0x6ff9('0x8'));var config=require(_0x6ff9('0x9'));var attributes=require(_0x6ff9('0xa'));module[_0x6ff9('0xb')]=function(_0x4adb77,_0x3efaff){return _0x4adb77['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d56f4,_0x2b1b7d,_0x31747a){if(_0x5d56f4[_0x6ff9('0xc')](_0x6ff9('0xd'))){_0x5d56f4[_0x6ff9('0xe')]=moment()['format'](_0x6ff9('0xf'));}if(_0x5d56f4[_0x6ff9('0xc')](_0x6ff9('0x10'))){_0x5d56f4[_0x6ff9('0x11')]=moment()[_0x6ff9('0x12')](_0x6ff9('0xf'));}_0x31747a(null,_0x5d56f4);}}});}; \ No newline at end of file +var _0x8b04=['api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','lodash','util'];(function(_0x26c668,_0x68a315){var _0x5e98c2=function(_0x4c7c75){while(--_0x4c7c75){_0x26c668['push'](_0x26c668['shift']());}};_0x5e98c2(++_0x68a315);}(_0x8b04,0x130));var _0x48b0=function(_0x5610dc,_0x49484a){_0x5610dc=_0x5610dc-0x0;var _0x4443d5=_0x8b04[_0x5610dc];return _0x4443d5;};'use strict';var _=require(_0x48b0('0x0'));var util=require(_0x48b0('0x1'));var logger=require('../../config/logger')(_0x48b0('0x2'));var moment=require('moment');var BPromise=require(_0x48b0('0x3'));var rp=require(_0x48b0('0x4'));var fs=require('fs');var path=require(_0x48b0('0x5'));var rimraf=require(_0x48b0('0x6'));var config=require(_0x48b0('0x7'));var attributes=require(_0x48b0('0x8'));module[_0x48b0('0x9')]=function(_0x43e21c,_0x357849){return _0x43e21c[_0x48b0('0xa')]('SquareProject',attributes,{'tableName':_0x48b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fe681,_0x38d496,_0x1f3905){if(_0x2fe681[_0x48b0('0xc')](_0x48b0('0xd'))){_0x2fe681[_0x48b0('0xe')]=moment()['format'](_0x48b0('0xf'));}if(_0x2fe681[_0x48b0('0xc')]('production')){_0x2fe681[_0x48b0('0x10')]=moment()[_0x48b0('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f3905(null,_0x2fe681);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f67ada1..78c7706 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 _0x4ee5=['options','raw','where','include','map','attributes','model','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','ShowSquareProject','SquareProject'];(function(_0x386294,_0x4e40b7){var _0x5185f1=function(_0x56c994){while(--_0x56c994){_0x386294['push'](_0x386294['shift']());}};_0x5185f1(++_0x4e40b7);}(_0x4ee5,0xc1));var _0x54ee=function(_0x2a2155,_0x45ebc6){_0x2a2155=_0x2a2155-0x0;var _0x19f79c=_0x4ee5[_0x2a2155];return _0x19f79c;};'use strict';var _=require('lodash');var util=require(_0x54ee('0x0'));var moment=require('moment');var BPromise=require(_0x54ee('0x1'));var rs=require(_0x54ee('0x2'));var fs=require('fs');var Redis=require(_0x54ee('0x3'));var db=require(_0x54ee('0x4'))['db'];var utils=require(_0x54ee('0x5'));var logger=require('../../config/logger')(_0x54ee('0x6'));var config=require(_0x54ee('0x7'));var jayson=require(_0x54ee('0x8'));var client=jayson[_0x54ee('0x9')][_0x54ee('0xa')]({'port':0x232a});config[_0x54ee('0xb')]=_['defaults'](config[_0x54ee('0xb')],{'host':_0x54ee('0xc'),'port':0x18eb});var socket=require(_0x54ee('0xd'))(new Redis(config[_0x54ee('0xb')]));require(_0x54ee('0xe'))['register'](socket);function respondWithRpcPromise(_0xf80952,_0x281b05,_0x4a7b2a){return new BPromise(function(_0x59692e,_0x1080f2){return client[_0x54ee('0xf')](_0xf80952,_0x4a7b2a)[_0x54ee('0x10')](function(_0x3de4b2){logger[_0x54ee('0x11')](_0x54ee('0x12'),_0x281b05,'request\x20sent');logger[_0x54ee('0x13')](_0x54ee('0x14'),_0x281b05,'request\x20sent',JSON['stringify'](_0x3de4b2));if(_0x3de4b2[_0x54ee('0x15')]){if(_0x3de4b2[_0x54ee('0x15')][_0x54ee('0x16')]===0x1f4){logger[_0x54ee('0x15')](_0x54ee('0x12'),_0x281b05,_0x3de4b2[_0x54ee('0x15')]['message']);return _0x1080f2(_0x3de4b2['error'][_0x54ee('0x17')]);}logger[_0x54ee('0x15')](_0x54ee('0x12'),_0x281b05,_0x3de4b2[_0x54ee('0x15')][_0x54ee('0x17')]);return _0x59692e(_0x3de4b2[_0x54ee('0x15')]['message']);}else{logger[_0x54ee('0x11')](_0x54ee('0x12'),_0x281b05,_0x54ee('0x18'));_0x59692e(_0x3de4b2[_0x54ee('0x19')][_0x54ee('0x17')]);}})[_0x54ee('0x1a')](function(_0x5459ab){logger[_0x54ee('0x15')]('SquareProject,\x20%s,\x20%s',_0x281b05,_0x5459ab);_0x1080f2(_0x5459ab);});});}exports[_0x54ee('0x1b')]=function(_0x354fd4){var _0x9573a7=this;return new Promise(function(_0x42874d,_0xc588a3){return db[_0x54ee('0x1c')]['find']({'raw':_0x354fd4['options']?_0x354fd4[_0x54ee('0x1d')][_0x54ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x354fd4['options']?_0x354fd4[_0x54ee('0x1d')][_0x54ee('0x1f')]||null:null,'attributes':_0x354fd4[_0x54ee('0x1d')]?_0x354fd4[_0x54ee('0x1d')]['attributes']||null:null,'include':_0x354fd4[_0x54ee('0x1d')]?_0x354fd4[_0x54ee('0x1d')][_0x54ee('0x20')]?_[_0x54ee('0x21')](_0x354fd4['options'][_0x54ee('0x20')],function(_0x8ddded){return{'model':db[_0x8ddded['model']],'as':_0x8ddded['as'],'attributes':_0x8ddded[_0x54ee('0x22')],'include':_0x8ddded[_0x54ee('0x20')]?_['map'](_0x8ddded[_0x54ee('0x20')],function(_0x12f2cc){return{'model':db[_0x12f2cc['model']],'as':_0x12f2cc['as'],'attributes':_0x12f2cc[_0x54ee('0x22')],'include':_0x12f2cc[_0x54ee('0x20')]?_['map'](_0x12f2cc[_0x54ee('0x20')],function(_0x42b4de){return{'model':db[_0x42b4de[_0x54ee('0x23')]],'as':_0x42b4de['as'],'attributes':_0x42b4de['attributes']};}):[]};}):[]};}):[]:[]})[_0x54ee('0x10')](function(_0x3a1052){logger[_0x54ee('0x11')](_0x54ee('0x1b'),_0x354fd4);logger['debug']('ShowSquareProject',_0x354fd4,JSON[_0x54ee('0x24')](_0x3a1052));_0x42874d(_0x3a1052);})[_0x54ee('0x1a')](function(_0x1f09c6){logger[_0x54ee('0x15')](_0x54ee('0x1b'),_0x1f09c6[_0x54ee('0x17')],_0x354fd4);_0xc588a3(_0x9573a7['error'](0x1f4,_0x1f09c6[_0x54ee('0x17')]));});});}; \ No newline at end of file +var _0xf161=['defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xf161,0x153));var _0x1f16=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf161[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x1f16('0x0'));var util=require('util');var moment=require(_0x1f16('0x1'));var BPromise=require(_0x1f16('0x2'));var rs=require(_0x1f16('0x3'));var fs=require('fs');var Redis=require(_0x1f16('0x4'));var db=require(_0x1f16('0x5'))['db'];var utils=require(_0x1f16('0x6'));var logger=require(_0x1f16('0x7'))(_0x1f16('0x8'));var config=require(_0x1f16('0x9'));var jayson=require(_0x1f16('0xa'));var client=jayson['client'][_0x1f16('0xb')]({'port':0x232a});config['redis']=_[_0x1f16('0xc')](config[_0x1f16('0xd')],{'host':_0x1f16('0xe'),'port':0x18eb});var socket=require(_0x1f16('0xf'))(new Redis(config[_0x1f16('0xd')]));require(_0x1f16('0x10'))[_0x1f16('0x11')](socket);function respondWithRpcPromise(_0x58e0ab,_0x59aaba,_0x24a87a){return new BPromise(function(_0x2210a5,_0x4389ae){return client[_0x1f16('0x12')](_0x58e0ab,_0x24a87a)[_0x1f16('0x13')](function(_0x531b75){logger[_0x1f16('0x14')](_0x1f16('0x15'),_0x59aaba,'request\x20sent');logger['debug'](_0x1f16('0x16'),_0x59aaba,'request\x20sent',JSON['stringify'](_0x531b75));if(_0x531b75[_0x1f16('0x17')]){if(_0x531b75[_0x1f16('0x17')][_0x1f16('0x18')]===0x1f4){logger[_0x1f16('0x17')]('SquareProject,\x20%s,\x20%s',_0x59aaba,_0x531b75[_0x1f16('0x17')][_0x1f16('0x19')]);return _0x4389ae(_0x531b75[_0x1f16('0x17')][_0x1f16('0x19')]);}logger[_0x1f16('0x17')](_0x1f16('0x15'),_0x59aaba,_0x531b75[_0x1f16('0x17')][_0x1f16('0x19')]);return _0x2210a5(_0x531b75[_0x1f16('0x17')][_0x1f16('0x19')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x59aaba,_0x1f16('0x1a'));_0x2210a5(_0x531b75[_0x1f16('0x1b')][_0x1f16('0x19')]);}})[_0x1f16('0x1c')](function(_0xff896e){logger[_0x1f16('0x17')](_0x1f16('0x15'),_0x59aaba,_0xff896e);_0x4389ae(_0xff896e);});});}exports[_0x1f16('0x1d')]=function(_0x305c31){var _0x4a7e63=this;return new Promise(function(_0x3386f1,_0xd9c455){return db[_0x1f16('0x1e')]['find']({'raw':_0x305c31[_0x1f16('0x1f')]?_0x305c31['options'][_0x1f16('0x20')]===undefined?!![]:![]:!![],'where':_0x305c31[_0x1f16('0x1f')]?_0x305c31['options'][_0x1f16('0x21')]||null:null,'attributes':_0x305c31[_0x1f16('0x1f')]?_0x305c31[_0x1f16('0x1f')][_0x1f16('0x22')]||null:null,'include':_0x305c31[_0x1f16('0x1f')]?_0x305c31[_0x1f16('0x1f')][_0x1f16('0x23')]?_[_0x1f16('0x24')](_0x305c31[_0x1f16('0x1f')][_0x1f16('0x23')],function(_0x2c643c){return{'model':db[_0x2c643c[_0x1f16('0x25')]],'as':_0x2c643c['as'],'attributes':_0x2c643c[_0x1f16('0x22')],'include':_0x2c643c[_0x1f16('0x23')]?_['map'](_0x2c643c[_0x1f16('0x23')],function(_0x429e2f){return{'model':db[_0x429e2f['model']],'as':_0x429e2f['as'],'attributes':_0x429e2f['attributes'],'include':_0x429e2f[_0x1f16('0x23')]?_['map'](_0x429e2f[_0x1f16('0x23')],function(_0x49bb9c){return{'model':db[_0x49bb9c[_0x1f16('0x25')]],'as':_0x49bb9c['as'],'attributes':_0x49bb9c[_0x1f16('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1f16('0x13')](function(_0x4358ac){logger[_0x1f16('0x14')]('ShowSquareProject',_0x305c31);logger[_0x1f16('0x26')](_0x1f16('0x1d'),_0x305c31,JSON['stringify'](_0x4358ac));_0x3386f1(_0x4358ac);})[_0x1f16('0x1c')](function(_0x218fff){logger[_0x1f16('0x17')](_0x1f16('0x1d'),_0x218fff[_0x1f16('0x19')],_0x305c31);_0xd9c455(_0x4a7e63[_0x1f16('0x17')](0x1f4,_0x218fff[_0x1f16('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a278ed4..bbe754c 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 _0x2eb2=['squareProject:','save','remove','update','register','length'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x2eb2,0x19f));var _0x22eb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2eb2[_0x501510];return _0x1e6ee5;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x22eb('0x0'),_0x22eb('0x1'),_0x22eb('0x2')];function createListener(_0x1a002b,_0x1dd079){return function(_0xaf32cf){_0x1dd079['emit'](_0x1a002b,_0xaf32cf);};}function removeListener(_0x27732f,_0x4efe67){return function(){SquareProjectEvents['removeListener'](_0x27732f,_0x4efe67);};}exports[_0x22eb('0x3')]=function(_0x10e116){for(var _0x35dd5b=0x0,_0x2a9850=events[_0x22eb('0x4')];_0x35dd5b<_0x2a9850;_0x35dd5b++){var _0x396806=events[_0x35dd5b];var _0x33ddef=createListener(_0x22eb('0x5')+_0x396806,_0x10e116);SquareProjectEvents['on'](_0x396806,_0x33ddef);}}; \ No newline at end of file +var _0x5d17=['./squareProject.events','save','removeListener','register','length','squareProject:'];(function(_0x3770f8,_0x3a2713){var _0x43123e=function(_0x2710b4){while(--_0x2710b4){_0x3770f8['push'](_0x3770f8['shift']());}};_0x43123e(++_0x3a2713);}(_0x5d17,0x114));var _0x75d1=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0x5d17[_0xa223ad];return _0x306d47;};'use strict';var SquareProjectEvents=require(_0x75d1('0x0'));var events=[_0x75d1('0x1'),'remove','update'];function createListener(_0x39c0ec,_0x426717){return function(_0x1c9ba6){_0x426717['emit'](_0x39c0ec,_0x1c9ba6);};}function removeListener(_0x177460,_0x45d03a){return function(){SquareProjectEvents[_0x75d1('0x2')](_0x177460,_0x45d03a);};}exports[_0x75d1('0x3')]=function(_0x56ac0a){for(var _0x458681=0x0,_0x116a51=events[_0x75d1('0x4')];_0x458681<_0x116a51;_0x458681++){var _0x1ee61b=events[_0x458681];var _0x3a9d5e=createListener(_0x75d1('0x5')+_0x1ee61b,_0x56ac0a);SquareProjectEvents['on'](_0x1ee61b,_0x3a9d5e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 199ad84..c45f778 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 _0x503b=['isAuthenticated','index','/:id','show','get','/:id/download','post','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4b4113,_0x2c6041){var _0x1a73b0=function(_0x117ce1){while(--_0x117ce1){_0x4b4113['push'](_0x4b4113['shift']());}};_0x1a73b0(++_0x2c6041);}(_0x503b,0x15f));var _0xb503=function(_0x2d04ef,_0x5443f3){_0x2d04ef=_0x2d04ef-0x0;var _0x2c3e3e=_0x503b[_0x2d04ef];return _0x2c3e3e;};'use strict';var multer=require(_0xb503('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb503('0x1'));var express=require(_0xb503('0x2'));var router=express[_0xb503('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb503('0x4'));var config=require(_0xb503('0x5'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xb503('0x6')](),controller[_0xb503('0x7')]);router['get'](_0xb503('0x8'),auth[_0xb503('0x6')](),controller[_0xb503('0x9')]);router[_0xb503('0xa')](_0xb503('0xb'),auth[_0xb503('0x6')](),controller['download']);router[_0xb503('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb503('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb503('0xe')]);router[_0xb503('0xf')]('/:id/delete',auth[_0xb503('0x6')](),controller['destroy']);module[_0xb503('0x10')]=router; \ No newline at end of file +var _0x2b09=['/:id/download','download','post','create','put','update','delete','/:id/delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4ca88f,_0xbd5b23){var _0x4bd853=function(_0xac771f){while(--_0xac771f){_0x4ca88f['push'](_0x4ca88f['shift']());}};_0x4bd853(++_0xbd5b23);}(_0x2b09,0x1a7));var _0x92b0=function(_0x2c0c3b,_0x590417){_0x2c0c3b=_0x2c0c3b-0x0;var _0x1a74da=_0x2b09[_0x2c0c3b];return _0x1a74da;};'use strict';var multer=require(_0x92b0('0x0'));var util=require(_0x92b0('0x1'));var path=require(_0x92b0('0x2'));var timeout=require(_0x92b0('0x3'));var express=require(_0x92b0('0x4'));var router=express[_0x92b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x92b0('0x6'));var config=require(_0x92b0('0x7'));var controller=require(_0x92b0('0x8'));router[_0x92b0('0x9')]('/',auth[_0x92b0('0xa')](),controller[_0x92b0('0xb')]);router['get'](_0x92b0('0xc'),auth[_0x92b0('0xa')](),controller[_0x92b0('0xd')]);router['get'](_0x92b0('0xe'),auth[_0x92b0('0xa')](),controller[_0x92b0('0xf')]);router[_0x92b0('0x10')]('/',auth[_0x92b0('0xa')](),controller[_0x92b0('0x11')]);router[_0x92b0('0x12')](_0x92b0('0xc'),auth[_0x92b0('0xa')](),controller[_0x92b0('0x13')]);router[_0x92b0('0x14')](_0x92b0('0x15'),auth[_0x92b0('0xa')](),controller[_0x92b0('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0583ab7..4a74af2 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 _0xc591=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x34bf95,_0x3fc38d){var _0x24a1e5=function(_0x1eb127){while(--_0x1eb127){_0x34bf95['push'](_0x34bf95['shift']());}};_0x24a1e5(++_0x3fc38d);}(_0xc591,0xe0));var _0x1c59=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0xc591[_0x135904];return _0x1ce7d5;};'use strict';var Sequelize=require(_0x1c59('0x0'));module[_0x1c59('0x1')]={'uniqueid':{'type':Sequelize[_0x1c59('0x2')]},'callerid':{'type':Sequelize[_0x1c59('0x2')]},'calleridname':{'type':Sequelize[_0x1c59('0x2')]},'context':{'type':Sequelize[_0x1c59('0x2')]},'extension':{'type':Sequelize[_0x1c59('0x2')]},'priority':{'type':Sequelize[_0x1c59('0x2')]},'accountcode':{'type':Sequelize[_0x1c59('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1c59('0x2')]},'saveName':{'type':Sequelize[_0x1c59('0x2')]},'filename':{'type':Sequelize[_0x1c59('0x2')]},'savePath':{'type':Sequelize[_0x1c59('0x2')]},'format':{'type':Sequelize[_0x1c59('0x3')],'get':function(){var _0x456f18='';var _0xc747a8=this[_0x1c59('0x4')](_0x1c59('0x5'));if(_0xc747a8){_0x456f18=_0xc747a8['substring'](_0xc747a8[_0x1c59('0x6')]('.'));}return _0x456f18;}}}; \ No newline at end of file +var _0xc3b1=['lastIndexOf','STRING','VIRTUAL','savePath'];(function(_0x349b00,_0x5b58c3){var _0x45744f=function(_0x3caf27){while(--_0x3caf27){_0x349b00['push'](_0x349b00['shift']());}};_0x45744f(++_0x5b58c3);}(_0xc3b1,0xdd));var _0x1c3b=function(_0x5321cb,_0x2b00f8){_0x5321cb=_0x5321cb-0x0;var _0x490ca7=_0xc3b1[_0x5321cb];return _0x490ca7;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1c3b('0x0')]},'calleridname':{'type':Sequelize[_0x1c3b('0x0')]},'context':{'type':Sequelize[_0x1c3b('0x0')]},'extension':{'type':Sequelize[_0x1c3b('0x0')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1c3b('0x0')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x1c3b('0x0')]},'filename':{'type':Sequelize[_0x1c3b('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1c3b('0x1')],'get':function(){var _0x4d5c7a='';var _0x178097=this['getDataValue'](_0x1c3b('0x2'));if(_0x178097){_0x4d5c7a=_0x178097['substring'](_0x178097[_0x1c3b('0x3')]('.'));}return _0x4d5c7a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 65f0962..40be4f7 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 _0xfde8=['save','update','destroy','then','error','name','send','index','map','SquareRecording','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','rawAttributes','include','find','catch','create','body','download','../../components/encryptor','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\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','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','status','set','Content-Range','apply','reject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfde8,0x106));var _0x8fde=function(_0x185c13,_0x453aa9){_0x185c13=_0x185c13-0x0;var _0x38d2d8=_0xfde8[_0x185c13];return _0x38d2d8;};'use strict';var pdf=require(_0x8fde('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8fde('0x1'));var zipdir=require(_0x8fde('0x2'));var jsonpatch=require(_0x8fde('0x3'));var rp=require('request-promise');var moment=require(_0x8fde('0x4'));var BPromise=require(_0x8fde('0x5'));var Mustache=require(_0x8fde('0x6'));var util=require(_0x8fde('0x7'));var path=require(_0x8fde('0x8'));var sox=require(_0x8fde('0x9'));var csv=require(_0x8fde('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8fde('0xb'));var squel=require(_0x8fde('0xc'));var crypto=require(_0x8fde('0xd'));var jsforce=require(_0x8fde('0xe'));var deskjs=require(_0x8fde('0xf'));var toCsv=require(_0x8fde('0xa'));var querystring=require(_0x8fde('0x10'));var Papa=require(_0x8fde('0x11'));var Redis=require(_0x8fde('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8fde('0x13'));var hardwareService=require(_0x8fde('0x14'));var logger=require(_0x8fde('0x15'))('api');var utils=require(_0x8fde('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8fde('0x17'))['db'];function respondWithStatusCode(_0x2ae426,_0x9bb217){_0x9bb217=_0x9bb217||0xcc;return function(_0x492895){if(_0x492895){return _0x2ae426[_0x8fde('0x18')](_0x9bb217);}return _0x2ae426['status'](_0x9bb217)[_0x8fde('0x19')]();};}function respondWithResult(_0x25ddba,_0x2b89b4){_0x2b89b4=_0x2b89b4||0xc8;return function(_0x27a577){if(_0x27a577){return _0x25ddba['status'](_0x2b89b4)[_0x8fde('0x1a')](_0x27a577);}};}function respondWithFilteredResult(_0xc051ed,_0x14066f){return function(_0x2132a7){if(_0x2132a7){var _0x395c48=_0x2132a7['count'],_0x703f3a=_0x14066f['offset'],_0x2321dc=_0x14066f['offset']+_0x14066f['limit'],_0xbe3cfe;if(_0x2321dc>=_0x395c48){_0x2321dc=_0x395c48;_0xbe3cfe=0xc8;}else{_0xbe3cfe=0xce;}_0xc051ed[_0x8fde('0x1b')](_0xbe3cfe);return _0xc051ed[_0x8fde('0x1c')](_0x8fde('0x1d'),_0x703f3a+'-'+_0x2321dc+'/'+_0x395c48)['json'](_0x2132a7);}return null;};}function patchUpdates(_0x4eafea){return function(_0x2439f4){try{jsonpatch[_0x8fde('0x1e')](_0x2439f4,_0x4eafea,!![]);}catch(_0x777ef7){return BPromise[_0x8fde('0x1f')](_0x777ef7);}return _0x2439f4[_0x8fde('0x20')]();};}function saveUpdates(_0x23769f,_0x27320f){return function(_0x5317ea){if(_0x5317ea){return _0x5317ea[_0x8fde('0x21')](_0x23769f)['then'](function(_0x5bc45e){return _0x5bc45e;});}return null;};}function removeEntity(_0xc54b2d,_0x363b24){return function(_0x3484ee){if(_0x3484ee){return _0x3484ee[_0x8fde('0x22')]()[_0x8fde('0x23')](function(){_0xc54b2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3177a9,_0xd8ae38){return function(_0x5a7586){if(!_0x5a7586){_0x3177a9[_0x8fde('0x18')](0x194);}return _0x5a7586;};}function handleError(_0x3bfdff,_0x10f9e0){_0x10f9e0=_0x10f9e0||0x1f4;return function(_0x332384){logger[_0x8fde('0x24')](_0x332384['stack']);if(_0x332384[_0x8fde('0x25')]){delete _0x332384['name'];}_0x3bfdff[_0x8fde('0x1b')](_0x10f9e0)[_0x8fde('0x26')](_0x332384);};}exports[_0x8fde('0x27')]=function(_0x3ab30a,_0x14490e){var _0x39f914={},_0xcb1ae2={},_0x5b11ea={'count':0x0,'rows':[]};var _0x92b27e=_[_0x8fde('0x28')](db[_0x8fde('0x29')]['rawAttributes'],function(_0x4a0b49){return{'name':_0x4a0b49[_0x8fde('0x2a')],'type':_0x4a0b49['type'][_0x8fde('0x2b')]};});_0xcb1ae2[_0x8fde('0x2c')]=_['map'](_0x92b27e,_0x8fde('0x25'));_0xcb1ae2[_0x8fde('0x2d')]=_[_0x8fde('0x2e')](_0x3ab30a[_0x8fde('0x2d')]);_0xcb1ae2[_0x8fde('0x2f')]=_['intersection'](_0xcb1ae2['model'],_0xcb1ae2[_0x8fde('0x2d')]);_0x39f914[_0x8fde('0x30')]=_[_0x8fde('0x31')](_0xcb1ae2['model'],qs[_0x8fde('0x32')](_0x3ab30a[_0x8fde('0x2d')][_0x8fde('0x32')]));_0x39f914[_0x8fde('0x30')]=_0x39f914[_0x8fde('0x30')]['length']?_0x39f914[_0x8fde('0x30')]:_0xcb1ae2[_0x8fde('0x2c')];if(!_0x3ab30a[_0x8fde('0x2d')][_0x8fde('0x33')](_0x8fde('0x34'))){_0x39f914['limit']=qs[_0x8fde('0x35')](_0x3ab30a[_0x8fde('0x2d')][_0x8fde('0x35')]);_0x39f914[_0x8fde('0x36')]=qs['offset'](_0x3ab30a['query'][_0x8fde('0x36')]);}_0x39f914[_0x8fde('0x37')]=qs['sort'](_0x3ab30a[_0x8fde('0x2d')][_0x8fde('0x38')]);_0x39f914[_0x8fde('0x39')]=qs[_0x8fde('0x2f')](_[_0x8fde('0x3a')](_0x3ab30a[_0x8fde('0x2d')],_0xcb1ae2[_0x8fde('0x2f')]),_0x92b27e);if(_0x3ab30a[_0x8fde('0x2d')][_0x8fde('0x3b')]){_0x39f914[_0x8fde('0x39')]=_['merge'](_0x39f914[_0x8fde('0x39')],{'$or':_[_0x8fde('0x28')](_0x92b27e,function(_0x3c1c73){if(_0x3c1c73[_0x8fde('0x3c')]!==_0x8fde('0x3d')){var _0x2570a4={};_0x2570a4[_0x3c1c73[_0x8fde('0x25')]]={'$like':'%'+_0x3ab30a[_0x8fde('0x2d')][_0x8fde('0x3b')]+'%'};return _0x2570a4;}})});}_0x39f914=_[_0x8fde('0x3e')]({},_0x39f914,_0x3ab30a[_0x8fde('0x3f')]);var _0x3e332c={'where':_0x39f914[_0x8fde('0x39')]};return db[_0x8fde('0x29')][_0x8fde('0x40')](_0x3e332c)[_0x8fde('0x23')](function(_0xae4f12){_0x5b11ea[_0x8fde('0x40')]=_0xae4f12;if(_0x3ab30a['query'][_0x8fde('0x41')]){_0x39f914['include']=[{'all':!![]}];}return db[_0x8fde('0x29')][_0x8fde('0x42')](_0x39f914);})[_0x8fde('0x23')](function(_0x2d65fa){_0x5b11ea[_0x8fde('0x43')]=_0x2d65fa;return _0x5b11ea;})[_0x8fde('0x23')](respondWithFilteredResult(_0x14490e,_0x39f914))['catch'](handleError(_0x14490e,null));};exports['show']=function(_0x239b5c,_0xc5dda1){var _0x3192ac={'raw':!![],'where':{'id':_0x239b5c['params']['id']}},_0x3253ab={};_0x3253ab[_0x8fde('0x2c')]=_[_0x8fde('0x2e')](db[_0x8fde('0x29')][_0x8fde('0x44')]);_0x3253ab['query']=_[_0x8fde('0x2e')](_0x239b5c[_0x8fde('0x2d')]);_0x3253ab[_0x8fde('0x2f')]=_[_0x8fde('0x31')](_0x3253ab['model'],_0x3253ab[_0x8fde('0x2d')]);_0x3192ac[_0x8fde('0x30')]=_['intersection'](_0x3253ab[_0x8fde('0x2c')],qs['fields'](_0x239b5c[_0x8fde('0x2d')]['fields']));_0x3192ac[_0x8fde('0x30')]=_0x3192ac['attributes']['length']?_0x3192ac[_0x8fde('0x30')]:_0x3253ab[_0x8fde('0x2c')];if(_0x239b5c['query'][_0x8fde('0x41')]){_0x3192ac[_0x8fde('0x45')]=[{'all':!![]}];}_0x3192ac=_[_0x8fde('0x3e')]({},_0x3192ac,_0x239b5c[_0x8fde('0x3f')]);return db[_0x8fde('0x29')][_0x8fde('0x46')](_0x3192ac)[_0x8fde('0x23')](handleEntityNotFound(_0xc5dda1,null))['then'](respondWithResult(_0xc5dda1,null))[_0x8fde('0x47')](handleError(_0xc5dda1,null));};exports[_0x8fde('0x48')]=function(_0x3ec375,_0x12dd89){return db[_0x8fde('0x29')][_0x8fde('0x48')](_0x3ec375[_0x8fde('0x49')],{})[_0x8fde('0x23')](respondWithResult(_0x12dd89,0xc9))[_0x8fde('0x47')](handleError(_0x12dd89,null));};exports[_0x8fde('0x21')]=function(_0x321a81,_0x5650bf){if(_0x321a81[_0x8fde('0x49')]['id']){delete _0x321a81[_0x8fde('0x49')]['id'];}return db[_0x8fde('0x29')][_0x8fde('0x46')]({'where':{'id':_0x321a81['params']['id']}})[_0x8fde('0x23')](handleEntityNotFound(_0x5650bf,null))[_0x8fde('0x23')](saveUpdates(_0x321a81[_0x8fde('0x49')],null))['then'](respondWithResult(_0x5650bf,null))[_0x8fde('0x47')](handleError(_0x5650bf,null));};exports[_0x8fde('0x4a')]=function(_0x5a3c06,_0x4bca1b,_0xa44c7b){var _0x1c0a7d=require(_0x8fde('0x4b'));var _0x1909dc=![];var _0x52b23f={};if(_0x5a3c06[_0x8fde('0x2d')][_0x8fde('0x3c')]&&_0x5a3c06[_0x8fde('0x2d')]['type']===_0x8fde('0x4c')){_0x52b23f[_0x8fde('0x4c')]=_0x5a3c06[_0x8fde('0x4d')]['id'];}else{_0x52b23f['id']=_0x5a3c06[_0x8fde('0x4d')]['id'];}return db[_0x8fde('0x29')]['find']({'where':_0x52b23f,'attributes':['id',_0x8fde('0x4e'),_0x8fde('0x4f')],'raw':!![]})[_0x8fde('0x23')](handleEntityNotFound(_0x4bca1b,null))[_0x8fde('0x23')](function(_0x657fd3){if(_0x657fd3){var _0x18a55f=_0x657fd3['savePath'];var _0x3a1758=util[_0x8fde('0x50')](_0x8fde('0x51'),_0x18a55f);if(fs[_0x8fde('0x52')](_0x3a1758)){_0x1909dc=!![];return _0x1c0a7d['decryptFile'](_0x3a1758,_0x18a55f,config[_0x8fde('0x53')][_0x8fde('0x54')])[_0x8fde('0x23')](function(){return _0x657fd3;});}return _0x657fd3;}})[_0x8fde('0x23')](function(_0x1e0c93){if(_0x1e0c93){var _0x1a9043=_0x1e0c93['savePath'];if(!fs[_0x8fde('0x52')](_0x1a9043)){throw new db['Sequelize'][(_0x8fde('0x55'))](_0x8fde('0x56'));}if(_0x1e0c93[_0x8fde('0x4f')]){return _0x4bca1b['download'](_0x1a9043,_0x1e0c93['filename']+path[_0x8fde('0x57')](_0x1a9043),function(){if(_0x1909dc){fs[_0x8fde('0x58')](_0x1a9043);}});}else{return _0x4bca1b[_0x8fde('0x4a')](_0x1a9043,function(_0x360714){if(_0x1909dc){fs['unlink'](_0x1a9043);}});}}})['catch'](function(_0x43ef3f){if(_0x43ef3f[_0x8fde('0x59')]===_0x8fde('0x56')){_0x4bca1b['status'](0x194)['send'](_0x8fde('0x5a'));}else{return handleError(_0x4bca1b,null);}});};exports[_0x8fde('0x22')]=function(_0x34d936,_0x506f43){return db[_0x8fde('0x29')][_0x8fde('0x46')]({'where':{'id':_0x34d936['params']['id']}})[_0x8fde('0x23')](function(_0xae774e){if(!_0xae774e)throw new ReferenceError('Entity\x20not\x20found');return _0xae774e;})[_0x8fde('0x23')](function(_0x876508){var _0x543a76=_0x876508[_0x8fde('0x4e')];logger['info'](_0x8fde('0x5b'),_0x543a76);if(!_[_0x8fde('0x5c')](_0x876508[_0x8fde('0x4e')])&&fs[_0x8fde('0x52')](_0x543a76)){logger[_0x8fde('0x5d')](_0x8fde('0x5e')+_0x543a76+_0x8fde('0x5f'));fs[_0x8fde('0x60')](_0x543a76);}_0x543a76=_0x543a76+_0x8fde('0x61');if(!_[_0x8fde('0x5c')](_0x876508[_0x8fde('0x4e')])&&fs[_0x8fde('0x52')](_0x543a76)){logger[_0x8fde('0x5d')]('File:\x20\x22'+_0x543a76+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8fde('0x60')](_0x543a76);}return _0x876508;})[_0x8fde('0x23')](function(_0x4536de){if(!_0x4536de)throw new InternalError();return _0x4536de[_0x8fde('0x22')]();})['then'](function(){_0x506f43[_0x8fde('0x1b')](0xcc)[_0x8fde('0x19')]();})['catch'](handleError(_0x506f43,null));}; \ No newline at end of file +var _0x6758=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','error','stack','name','send','map','SquareRecording','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','includeAll','findAll','show','params','include','options','find','catch','create','body','update','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','destroy','Entity\x20not\x20found','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x3cc9bb,_0x5db616){var _0x55f4f2=function(_0x2253bf){while(--_0x2253bf){_0x3cc9bb['push'](_0x3cc9bb['shift']());}};_0x55f4f2(++_0x5db616);}(_0x6758,0x1b6));var _0x8675=function(_0x20adcc,_0x4de433){_0x20adcc=_0x20adcc-0x0;var _0x17476a=_0x6758[_0x20adcc];return _0x17476a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8675('0x0'));var rimraf=require(_0x8675('0x1'));var zipdir=require(_0x8675('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8675('0x3'));var moment=require(_0x8675('0x4'));var BPromise=require(_0x8675('0x5'));var Mustache=require(_0x8675('0x6'));var util=require(_0x8675('0x7'));var path=require(_0x8675('0x8'));var sox=require('sox');var csv=require(_0x8675('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8675('0xa'));var squel=require('squel');var crypto=require(_0x8675('0xb'));var jsforce=require(_0x8675('0xc'));var deskjs=require(_0x8675('0xd'));var toCsv=require(_0x8675('0x9'));var querystring=require(_0x8675('0xe'));var Papa=require(_0x8675('0xf'));var Redis=require('ioredis');var authService=require(_0x8675('0x10'));var qs=require(_0x8675('0x11'));var as=require(_0x8675('0x12'));var hardwareService=require(_0x8675('0x13'));var logger=require(_0x8675('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8675('0x15'));var licenseUtil=require(_0x8675('0x16'));var db=require(_0x8675('0x17'))['db'];function respondWithStatusCode(_0x32fcf3,_0x4b9410){_0x4b9410=_0x4b9410||0xcc;return function(_0x1f7122){if(_0x1f7122){return _0x32fcf3[_0x8675('0x18')](_0x4b9410);}return _0x32fcf3[_0x8675('0x19')](_0x4b9410)[_0x8675('0x1a')]();};}function respondWithResult(_0x4dfcb6,_0x38e26b){_0x38e26b=_0x38e26b||0xc8;return function(_0x27fb0b){if(_0x27fb0b){return _0x4dfcb6[_0x8675('0x19')](_0x38e26b)[_0x8675('0x1b')](_0x27fb0b);}};}function respondWithFilteredResult(_0xa2f813,_0x46b075){return function(_0x38ac68){if(_0x38ac68){var _0x4d7e45=_0x38ac68[_0x8675('0x1c')],_0x16ef1c=_0x46b075[_0x8675('0x1d')],_0x378aa4=_0x46b075[_0x8675('0x1d')]+_0x46b075[_0x8675('0x1e')],_0x2e2eb2;if(_0x378aa4>=_0x4d7e45){_0x378aa4=_0x4d7e45;_0x2e2eb2=0xc8;}else{_0x2e2eb2=0xce;}_0xa2f813[_0x8675('0x19')](_0x2e2eb2);return _0xa2f813[_0x8675('0x1f')]('Content-Range',_0x16ef1c+'-'+_0x378aa4+'/'+_0x4d7e45)['json'](_0x38ac68);}return null;};}function patchUpdates(_0x2cd1af){return function(_0x3d5a74){try{jsonpatch['apply'](_0x3d5a74,_0x2cd1af,!![]);}catch(_0x40012e){return BPromise[_0x8675('0x20')](_0x40012e);}return _0x3d5a74[_0x8675('0x21')]();};}function saveUpdates(_0x34ee20,_0x1e677c){return function(_0x1cb5aa){if(_0x1cb5aa){return _0x1cb5aa['update'](_0x34ee20)[_0x8675('0x22')](function(_0x562420){return _0x562420;});}return null;};}function removeEntity(_0x30d256,_0x2ec313){return function(_0x66fc13){if(_0x66fc13){return _0x66fc13['destroy']()[_0x8675('0x22')](function(){_0x30d256[_0x8675('0x19')](0xcc)[_0x8675('0x1a')]();});}};}function handleEntityNotFound(_0x4a92e9,_0x47bc6e){return function(_0x1e2e77){if(!_0x1e2e77){_0x4a92e9[_0x8675('0x18')](0x194);}return _0x1e2e77;};}function handleError(_0x127207,_0x4514aa){_0x4514aa=_0x4514aa||0x1f4;return function(_0x38d80c){logger[_0x8675('0x23')](_0x38d80c[_0x8675('0x24')]);if(_0x38d80c[_0x8675('0x25')]){delete _0x38d80c[_0x8675('0x25')];}_0x127207[_0x8675('0x19')](_0x4514aa)[_0x8675('0x26')](_0x38d80c);};}exports['index']=function(_0x168549,_0x3f490c){var _0x448df1={},_0x20ec61={},_0x1c6366={'count':0x0,'rows':[]};var _0x2e8981=_[_0x8675('0x27')](db[_0x8675('0x28')][_0x8675('0x29')],function(_0x397bef){return{'name':_0x397bef['fieldName'],'type':_0x397bef[_0x8675('0x2a')]['key']};});_0x20ec61[_0x8675('0x2b')]=_['map'](_0x2e8981,'name');_0x20ec61['query']=_[_0x8675('0x2c')](_0x168549[_0x8675('0x2d')]);_0x20ec61['filters']=_[_0x8675('0x2e')](_0x20ec61[_0x8675('0x2b')],_0x20ec61[_0x8675('0x2d')]);_0x448df1[_0x8675('0x2f')]=_[_0x8675('0x2e')](_0x20ec61[_0x8675('0x2b')],qs[_0x8675('0x30')](_0x168549['query'][_0x8675('0x30')]));_0x448df1['attributes']=_0x448df1['attributes'][_0x8675('0x31')]?_0x448df1[_0x8675('0x2f')]:_0x20ec61[_0x8675('0x2b')];if(!_0x168549[_0x8675('0x2d')][_0x8675('0x32')](_0x8675('0x33'))){_0x448df1['limit']=qs[_0x8675('0x1e')](_0x168549[_0x8675('0x2d')][_0x8675('0x1e')]);_0x448df1['offset']=qs[_0x8675('0x1d')](_0x168549['query'][_0x8675('0x1d')]);}_0x448df1['order']=qs['sort'](_0x168549[_0x8675('0x2d')][_0x8675('0x34')]);_0x448df1['where']=qs[_0x8675('0x35')](_[_0x8675('0x36')](_0x168549[_0x8675('0x2d')],_0x20ec61[_0x8675('0x35')]),_0x2e8981);if(_0x168549[_0x8675('0x2d')]['filter']){_0x448df1[_0x8675('0x37')]=_[_0x8675('0x38')](_0x448df1[_0x8675('0x37')],{'$or':_['map'](_0x2e8981,function(_0x428620){if(_0x428620[_0x8675('0x2a')]!=='VIRTUAL'){var _0xd88d7c={};_0xd88d7c[_0x428620[_0x8675('0x25')]]={'$like':'%'+_0x168549[_0x8675('0x2d')][_0x8675('0x39')]+'%'};return _0xd88d7c;}})});}_0x448df1=_[_0x8675('0x38')]({},_0x448df1,_0x168549['options']);var _0x1e3d7b={'where':_0x448df1[_0x8675('0x37')]};return db[_0x8675('0x28')][_0x8675('0x1c')](_0x1e3d7b)[_0x8675('0x22')](function(_0x415fde){_0x1c6366[_0x8675('0x1c')]=_0x415fde;if(_0x168549[_0x8675('0x2d')][_0x8675('0x3a')]){_0x448df1['include']=[{'all':!![]}];}return db[_0x8675('0x28')][_0x8675('0x3b')](_0x448df1);})[_0x8675('0x22')](function(_0x3c64c8){_0x1c6366['rows']=_0x3c64c8;return _0x1c6366;})['then'](respondWithFilteredResult(_0x3f490c,_0x448df1))['catch'](handleError(_0x3f490c,null));};exports[_0x8675('0x3c')]=function(_0x35f9a2,_0x1ab7a2){var _0x3abdf1={'raw':!![],'where':{'id':_0x35f9a2[_0x8675('0x3d')]['id']}},_0x20aaa7={};_0x20aaa7[_0x8675('0x2b')]=_[_0x8675('0x2c')](db['SquareRecording'][_0x8675('0x29')]);_0x20aaa7[_0x8675('0x2d')]=_[_0x8675('0x2c')](_0x35f9a2[_0x8675('0x2d')]);_0x20aaa7['filters']=_['intersection'](_0x20aaa7[_0x8675('0x2b')],_0x20aaa7[_0x8675('0x2d')]);_0x3abdf1['attributes']=_[_0x8675('0x2e')](_0x20aaa7[_0x8675('0x2b')],qs[_0x8675('0x30')](_0x35f9a2['query'][_0x8675('0x30')]));_0x3abdf1[_0x8675('0x2f')]=_0x3abdf1[_0x8675('0x2f')][_0x8675('0x31')]?_0x3abdf1['attributes']:_0x20aaa7[_0x8675('0x2b')];if(_0x35f9a2[_0x8675('0x2d')][_0x8675('0x3a')]){_0x3abdf1[_0x8675('0x3e')]=[{'all':!![]}];}_0x3abdf1=_[_0x8675('0x38')]({},_0x3abdf1,_0x35f9a2[_0x8675('0x3f')]);return db[_0x8675('0x28')][_0x8675('0x40')](_0x3abdf1)['then'](handleEntityNotFound(_0x1ab7a2,null))[_0x8675('0x22')](respondWithResult(_0x1ab7a2,null))[_0x8675('0x41')](handleError(_0x1ab7a2,null));};exports[_0x8675('0x42')]=function(_0x2927ee,_0x569482){return db[_0x8675('0x28')][_0x8675('0x42')](_0x2927ee[_0x8675('0x43')],{})[_0x8675('0x22')](respondWithResult(_0x569482,0xc9))[_0x8675('0x41')](handleError(_0x569482,null));};exports[_0x8675('0x44')]=function(_0x3b07ef,_0x10b248){if(_0x3b07ef[_0x8675('0x43')]['id']){delete _0x3b07ef['body']['id'];}return db[_0x8675('0x28')][_0x8675('0x40')]({'where':{'id':_0x3b07ef[_0x8675('0x3d')]['id']}})[_0x8675('0x22')](handleEntityNotFound(_0x10b248,null))['then'](saveUpdates(_0x3b07ef[_0x8675('0x43')],null))[_0x8675('0x22')](respondWithResult(_0x10b248,null))['catch'](handleError(_0x10b248,null));};exports[_0x8675('0x45')]=function(_0x50600f,_0x358859,_0x22a83d){var _0x2a0546=require('../../components/encryptor');var _0x10fffb=![];var _0x3f80c1={};if(_0x50600f['query'][_0x8675('0x2a')]&&_0x50600f[_0x8675('0x2d')][_0x8675('0x2a')]===_0x8675('0x46')){_0x3f80c1[_0x8675('0x46')]=_0x50600f[_0x8675('0x3d')]['id'];}else{_0x3f80c1['id']=_0x50600f[_0x8675('0x3d')]['id'];}return db['SquareRecording'][_0x8675('0x40')]({'where':_0x3f80c1,'attributes':['id',_0x8675('0x47'),_0x8675('0x48')],'raw':!![]})[_0x8675('0x22')](handleEntityNotFound(_0x358859,null))[_0x8675('0x22')](function(_0x4c68eb){if(_0x4c68eb){var _0x2b5846=_0x4c68eb[_0x8675('0x47')];var _0x1e4af0=util[_0x8675('0x49')](_0x8675('0x4a'),_0x2b5846);if(fs[_0x8675('0x4b')](_0x1e4af0)){_0x10fffb=!![];return _0x2a0546[_0x8675('0x4c')](_0x1e4af0,_0x2b5846,config[_0x8675('0x4d')][_0x8675('0x4e')])['then'](function(){return _0x4c68eb;});}return _0x4c68eb;}})['then'](function(_0x3ade0b){if(_0x3ade0b){var _0x270aa7=_0x3ade0b['savePath'];if(!fs[_0x8675('0x4b')](_0x270aa7)){throw new db[(_0x8675('0x4f'))][(_0x8675('0x50'))](_0x8675('0x51'));}if(_0x3ade0b['filename']){return _0x358859[_0x8675('0x45')](_0x270aa7,_0x3ade0b[_0x8675('0x48')]+path[_0x8675('0x52')](_0x270aa7),function(){if(_0x10fffb){fs[_0x8675('0x53')](_0x270aa7);}});}else{return _0x358859[_0x8675('0x45')](_0x270aa7,function(_0xf05a33){if(_0x10fffb){fs[_0x8675('0x53')](_0x270aa7);}});}}})[_0x8675('0x41')](function(_0x4f1e39){if(_0x4f1e39['message']===_0x8675('0x51')){_0x358859[_0x8675('0x19')](0x194)['send'](_0x8675('0x54'));}else{return handleError(_0x358859,null);}});};exports[_0x8675('0x55')]=function(_0x26a78b,_0x5a2897){return db[_0x8675('0x28')][_0x8675('0x40')]({'where':{'id':_0x26a78b[_0x8675('0x3d')]['id']}})[_0x8675('0x22')](function(_0xb6d7e3){if(!_0xb6d7e3)throw new ReferenceError(_0x8675('0x56'));return _0xb6d7e3;})['then'](function(_0x46ca1e){var _0x419628=_0x46ca1e['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x419628);if(!_[_0x8675('0x57')](_0x46ca1e[_0x8675('0x47')])&&fs[_0x8675('0x4b')](_0x419628)){logger['info'](_0x8675('0x58')+_0x419628+_0x8675('0x59'));fs[_0x8675('0x5a')](_0x419628);}_0x419628=_0x419628+_0x8675('0x5b');if(!_[_0x8675('0x57')](_0x46ca1e['savePath'])&&fs[_0x8675('0x4b')](_0x419628)){logger['info'](_0x8675('0x58')+_0x419628+_0x8675('0x59'));fs[_0x8675('0x5a')](_0x419628);}return _0x46ca1e;})[_0x8675('0x22')](function(_0x41749a){if(!_0x41749a)throw new InternalError();return _0x41749a[_0x8675('0x55')]();})[_0x8675('0x22')](function(){_0x5a2897[_0x8675('0x19')](0xcc)[_0x8675('0x1a')]();})[_0x8675('0x41')](handleError(_0x5a2897,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e9f0f7c..a89c3bb 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 _0x3fce=['SquareRecording','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb4b913,_0x58ade4){var _0x21836e=function(_0x490a68){while(--_0x490a68){_0xb4b913['push'](_0xb4b913['shift']());}};_0x21836e(++_0x58ade4);}(_0x3fce,0x121));var _0xe3fc=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0x3fce[_0x12a020];return _0x63cddd;};'use strict';var _=require('lodash');var util=require(_0xe3fc('0x0'));var logger=require(_0xe3fc('0x1'))(_0xe3fc('0x2'));var moment=require(_0xe3fc('0x3'));var BPromise=require(_0xe3fc('0x4'));var rp=require(_0xe3fc('0x5'));var fs=require('fs');var path=require(_0xe3fc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x36eff8,_0x2dc84d){return _0x36eff8['define'](_0xe3fc('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','../../config/logger'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0xb10b,0x12a));var _0xbb10=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xb10b[_0x47b15f];return _0x55bf25;};'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')]('SquareRecording',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 490a5fe..29fdcaf 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 _0xb53f=['info','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options'];(function(_0x3c7c0c,_0x1de2f2){var _0x363209=function(_0x492e3b){while(--_0x492e3b){_0x3c7c0c['push'](_0x3c7c0c['shift']());}};_0x363209(++_0x1de2f2);}(_0xb53f,0x13a));var _0xfb53=function(_0x27c837,_0x54eb95){_0x27c837=_0x27c837-0x0;var _0x2fad9b=_0xb53f[_0x27c837];return _0x2fad9b;};'use strict';var _=require(_0xfb53('0x0'));var util=require(_0xfb53('0x1'));var moment=require(_0xfb53('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb53('0x3'));var db=require(_0xfb53('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb53('0x5'))(_0xfb53('0x6'));var config=require(_0xfb53('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1e9e,_0x213fd3,_0x1784a9){return new BPromise(function(_0x298ac8,_0x17a23f){return client['request'](_0x1a1e9e,_0x1784a9)[_0xfb53('0x8')](function(_0x1019d6){logger['info'](_0xfb53('0x9'),_0x213fd3,_0xfb53('0xa'));logger[_0xfb53('0xb')](_0xfb53('0xc'),_0x213fd3,_0xfb53('0xa'),JSON['stringify'](_0x1019d6));if(_0x1019d6[_0xfb53('0xd')]){if(_0x1019d6[_0xfb53('0xd')][_0xfb53('0xe')]===0x1f4){logger[_0xfb53('0xd')]('SquareRecording,\x20%s,\x20%s',_0x213fd3,_0x1019d6[_0xfb53('0xd')]['message']);return _0x17a23f(_0x1019d6[_0xfb53('0xd')][_0xfb53('0xf')]);}logger['error'](_0xfb53('0x9'),_0x213fd3,_0x1019d6[_0xfb53('0xd')][_0xfb53('0xf')]);return _0x298ac8(_0x1019d6[_0xfb53('0xd')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x213fd3,_0xfb53('0xa'));_0x298ac8(_0x1019d6[_0xfb53('0x10')][_0xfb53('0xf')]);}})[_0xfb53('0x11')](function(_0x288f3f){logger[_0xfb53('0xd')](_0xfb53('0x9'),_0x213fd3,_0x288f3f);_0x17a23f(_0x288f3f);});});}exports[_0xfb53('0x12')]=function(_0x1f8591){var _0x38f169=this;return new Promise(function(_0x46dcab,_0x3b3c0a){return db[_0xfb53('0x13')][_0xfb53('0x14')](_0x1f8591['body'],{'raw':_0x1f8591[_0xfb53('0x15')]?_0x1f8591[_0xfb53('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xfb53('0x8')](function(_0xea8d83){logger[_0xfb53('0x16')](_0xfb53('0x12'),_0x1f8591);logger[_0xfb53('0xb')](_0xfb53('0x12'),_0x1f8591,JSON[_0xfb53('0x17')](_0xea8d83));_0x46dcab(_0xea8d83);})['catch'](function(_0xb96328){logger[_0xfb53('0xd')](_0xfb53('0x12'),_0xb96328[_0xfb53('0xf')],_0x1f8591);_0x3b3c0a(_0x38f169[_0xfb53('0xd')](0x1f4,_0xb96328[_0xfb53('0xf')]));});});}; \ No newline at end of file +var _0x85b3=['CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x85b3,0xd2));var _0x385b=function(_0x2f2363,_0x131d85){_0x2f2363=_0x2f2363-0x0;var _0x3c8878=_0x85b3[_0x2f2363];return _0x3c8878;};'use strict';var _=require(_0x385b('0x0'));var util=require(_0x385b('0x1'));var moment=require(_0x385b('0x2'));var BPromise=require(_0x385b('0x3'));var rs=require(_0x385b('0x4'));var fs=require('fs');var Redis=require(_0x385b('0x5'));var db=require(_0x385b('0x6'))['db'];var utils=require(_0x385b('0x7'));var logger=require(_0x385b('0x8'))('rpc');var config=require(_0x385b('0x9'));var jayson=require(_0x385b('0xa'));var client=jayson[_0x385b('0xb')][_0x385b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4614ba,_0x2f1be2,_0x481024){return new BPromise(function(_0x22b74b,_0x1cebde){return client['request'](_0x4614ba,_0x481024)[_0x385b('0xd')](function(_0x193e3c){logger[_0x385b('0xe')](_0x385b('0xf'),_0x2f1be2,_0x385b('0x10'));logger['debug'](_0x385b('0x11'),_0x2f1be2,_0x385b('0x10'),JSON[_0x385b('0x12')](_0x193e3c));if(_0x193e3c[_0x385b('0x13')]){if(_0x193e3c[_0x385b('0x13')]['code']===0x1f4){logger[_0x385b('0x13')](_0x385b('0xf'),_0x2f1be2,_0x193e3c[_0x385b('0x13')][_0x385b('0x14')]);return _0x1cebde(_0x193e3c[_0x385b('0x13')][_0x385b('0x14')]);}logger[_0x385b('0x13')]('SquareRecording,\x20%s,\x20%s',_0x2f1be2,_0x193e3c[_0x385b('0x13')]['message']);return _0x22b74b(_0x193e3c[_0x385b('0x13')]['message']);}else{logger[_0x385b('0xe')](_0x385b('0xf'),_0x2f1be2,_0x385b('0x10'));_0x22b74b(_0x193e3c['result'][_0x385b('0x14')]);}})[_0x385b('0x15')](function(_0x21ccc4){logger[_0x385b('0x13')]('SquareRecording,\x20%s,\x20%s',_0x2f1be2,_0x21ccc4);_0x1cebde(_0x21ccc4);});});}exports[_0x385b('0x16')]=function(_0x3a622b){var _0x12751=this;return new Promise(function(_0x20de1f,_0x5d75ad){return db[_0x385b('0x17')][_0x385b('0x18')](_0x3a622b[_0x385b('0x19')],{'raw':_0x3a622b['options']?_0x3a622b[_0x385b('0x1a')][_0x385b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d3a18){logger[_0x385b('0xe')](_0x385b('0x16'),_0x3a622b);logger[_0x385b('0x1c')](_0x385b('0x16'),_0x3a622b,JSON[_0x385b('0x12')](_0x3d3a18));_0x20de1f(_0x3d3a18);})[_0x385b('0x15')](function(_0x36c122){logger[_0x385b('0x13')](_0x385b('0x16'),_0x36c122[_0x385b('0x14')],_0x3a622b);_0x5d75ad(_0x12751[_0x385b('0x13')](0x1f4,_0x36c122[_0x385b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 70699bd..b6f5ace 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 _0xd731=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xd731,0x153));var _0x1d73=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd731[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1d73('0x0'));var util=require(_0x1d73('0x1'));var path=require(_0x1d73('0x2'));var timeout=require(_0x1d73('0x3'));var express=require(_0x1d73('0x4'));var router=express['Router']();var auth=require(_0x1d73('0x5'));var interaction=require(_0x1d73('0x6'));var config=require(_0x1d73('0x7'));var controller=require('./squareReport.controller');router[_0x1d73('0x8')]('/',auth[_0x1d73('0x9')](),controller[_0x1d73('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1d73('0xb')]);router[_0x1d73('0x8')]('/:id',auth[_0x1d73('0x9')](),controller['show']);router[_0x1d73('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d73('0xd')](_0x1d73('0xe'),auth[_0x1d73('0x9')](),controller[_0x1d73('0xf')]);router[_0x1d73('0x10')](_0x1d73('0xe'),auth[_0x1d73('0x9')](),controller[_0x1d73('0x11')]);module[_0x1d73('0x12')]=router; \ No newline at end of file +var _0x048e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReport.controller','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x048e,0x1ca));var _0xe048=function(_0x4785fa,_0x5763b4){_0x4785fa=_0x4785fa-0x0;var _0x5cd6a2=_0x048e[_0x4785fa];return _0x5cd6a2;};'use strict';var multer=require(_0xe048('0x0'));var util=require(_0xe048('0x1'));var path=require(_0xe048('0x2'));var timeout=require(_0xe048('0x3'));var express=require(_0xe048('0x4'));var router=express[_0xe048('0x5')]();var auth=require(_0xe048('0x6'));var interaction=require(_0xe048('0x7'));var config=require('../../config/environment');var controller=require(_0xe048('0x8'));router['get']('/',auth[_0xe048('0x9')](),controller['index']);router['get'](_0xe048('0xa'),auth[_0xe048('0x9')](),controller[_0xe048('0xb')]);router['get'](_0xe048('0xc'),auth[_0xe048('0x9')](),controller[_0xe048('0xd')]);router[_0xe048('0xe')]('/',auth['isAuthenticated'](),controller[_0xe048('0xf')]);router[_0xe048('0x10')]('/:id',auth[_0xe048('0x9')](),controller[_0xe048('0x11')]);router[_0xe048('0x12')](_0xe048('0xc'),auth[_0xe048('0x9')](),controller[_0xe048('0x13')]);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 b693649..fde035a 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 _0x9f9c=['DATE','sequelize','exports','STRING'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9f9c,0xc5));var _0xc9f9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9f9c[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xc9f9('0x0'));module[_0xc9f9('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xc9f9('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc9f9('0x2')]},'language':{'type':Sequelize[_0xc9f9('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc9f9('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc9f9('0x2')]},'calleridname':{'type':Sequelize[_0xc9f9('0x2')]},'callingpres':{'type':Sequelize[_0xc9f9('0x2')]},'callingani2':{'type':Sequelize[_0xc9f9('0x2')]},'callington':{'type':Sequelize[_0xc9f9('0x2')]},'callingtns':{'type':Sequelize[_0xc9f9('0x2')]},'dnid':{'type':Sequelize[_0xc9f9('0x2')]},'rdnis':{'type':Sequelize[_0xc9f9('0x2')]},'context':{'type':Sequelize[_0xc9f9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc9f9('0x2')]},'enhanced':{'type':Sequelize[_0xc9f9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xc9f9('0x2')]},'project_name':{'type':Sequelize[_0xc9f9('0x2')]},'joinAt':{'type':Sequelize[_0xc9f9('0x3')]},'leaveAt':{'type':Sequelize[_0xc9f9('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb8bf=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x411ec5,_0x1f7153){var _0x13f458=function(_0x355013){while(--_0x355013){_0x411ec5['push'](_0x411ec5['shift']());}};_0x13f458(++_0x1f7153);}(_0xb8bf,0x1a9));var _0xfb8b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb8bf[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xfb8b('0x0'));module[_0xfb8b('0x1')]={'network':{'type':Sequelize[_0xfb8b('0x2')]},'network_script':{'type':Sequelize[_0xfb8b('0x2')]},'request':{'type':Sequelize[_0xfb8b('0x2')]},'channel':{'type':Sequelize[_0xfb8b('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfb8b('0x2')]},'uniqueid':{'type':Sequelize[_0xfb8b('0x2')]},'version':{'type':Sequelize[_0xfb8b('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfb8b('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xfb8b('0x2')]},'callington':{'type':Sequelize[_0xfb8b('0x2')]},'callingtns':{'type':Sequelize[_0xfb8b('0x2')]},'dnid':{'type':Sequelize[_0xfb8b('0x2')]},'rdnis':{'type':Sequelize[_0xfb8b('0x2')]},'context':{'type':Sequelize[_0xfb8b('0x2')]},'extension':{'type':Sequelize[_0xfb8b('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xfb8b('0x2')]},'accountcode':{'type':Sequelize[_0xfb8b('0x2')]},'threadid':{'type':Sequelize[_0xfb8b('0x2')]},'project_name':{'type':Sequelize[_0xfb8b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfb8b('0x3')]},'bot':{'type':Sequelize[_0xfb8b('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7e651dc..ae8a8bd 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 _0xa751=['filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','SquareReport','rawAttributes','fieldName','model','query','keys'];(function(_0x5ccf30,_0x2a3e67){var _0x1d3f0c=function(_0x2f7b06){while(--_0x2f7b06){_0x5ccf30['push'](_0x5ccf30['shift']());}};_0x1d3f0c(++_0x2a3e67);}(_0xa751,0x175));var _0x1a75=function(_0x24c54e,_0x5cdea8){_0x24c54e=_0x24c54e-0x0;var _0x4f498b=_0xa751[_0x24c54e];return _0x4f498b;};'use strict';var pdf=require(_0x1a75('0x0'));var emlformat=require(_0x1a75('0x1'));var rimraf=require(_0x1a75('0x2'));var zipdir=require(_0x1a75('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a75('0x4'));var moment=require('moment');var BPromise=require(_0x1a75('0x5'));var Mustache=require(_0x1a75('0x6'));var util=require(_0x1a75('0x7'));var path=require('path');var sox=require(_0x1a75('0x8'));var csv=require(_0x1a75('0x9'));var ejs=require(_0x1a75('0xa'));var fs=require('fs');var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=_0x15a1ec[_0x1a75('0x1a')],_0x557574=_0xb4a245[_0x1a75('0x1b')],_0x4c89b7=_0xb4a245[_0x1a75('0x1b')]+_0xb4a245[_0x1a75('0x1c')],_0x471b90;if(_0x4c89b7>=_0x5883df){_0x4c89b7=_0x5883df;_0x471b90=0xc8;}else{_0x471b90=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x471b90);return _0x1f3c38['set'](_0x1a75('0x1d'),_0x557574+'-'+_0x4c89b7+'/'+_0x5883df)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x486cd8){return function(_0x42df2c){try{jsonpatch[_0x1a75('0x1e')](_0x42df2c,_0x486cd8,!![]);}catch(_0x5ae0f4){return BPromise[_0x1a75('0x1f')](_0x5ae0f4);}return _0x42df2c['save']();};}function saveUpdates(_0x4699c9,_0x3e3549){return function(_0x4e84c0){if(_0x4e84c0){return _0x4e84c0[_0x1a75('0x20')](_0x4699c9)[_0x1a75('0x21')](function(_0x3f0bf4){return _0x3f0bf4;});}return null;};}function removeEntity(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')]()[_0x1a75('0x21')](function(){_0x5a0ad7[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443ff8,_0x5e6617){return function(_0x42232d){if(!_0x42232d){_0x443ff8[_0x1a75('0x23')](0x194);}return _0x42232d;};}function handleError(_0x3dd52d,_0x4ed6f8){_0x4ed6f8=_0x4ed6f8||0x1f4;return function(_0x9fe9fe){logger[_0x1a75('0x24')](_0x9fe9fe['stack']);if(_0x9fe9fe[_0x1a75('0x25')]){delete _0x9fe9fe[_0x1a75('0x25')];}_0x3dd52d['status'](_0x4ed6f8)[_0x1a75('0x26')](_0x9fe9fe);};}exports[_0x1a75('0x27')]=function(_0x34c106,_0x184d87){var _0x4ba38b={},_0x2e16b7={},_0x2744ab={'count':0x0,'rows':[]};var _0x19dc59=_[_0x1a75('0x28')](db[_0x1a75('0x29')][_0x1a75('0x2a')],function(_0x3b6e1d){return{'name':_0x3b6e1d[_0x1a75('0x2b')],'type':_0x3b6e1d['type']['key']};});_0x2e16b7[_0x1a75('0x2c')]=_[_0x1a75('0x28')](_0x19dc59,_0x1a75('0x25'));_0x2e16b7[_0x1a75('0x2d')]=_[_0x1a75('0x2e')](_0x34c106[_0x1a75('0x2d')]);_0x2e16b7[_0x1a75('0x2f')]=_[_0x1a75('0x30')](_0x2e16b7['model'],_0x2e16b7['query']);_0x4ba38b['attributes']=_[_0x1a75('0x30')](_0x2e16b7[_0x1a75('0x2c')],qs[_0x1a75('0x31')](_0x34c106[_0x1a75('0x2d')]['fields']));_0x4ba38b['attributes']=_0x4ba38b['attributes'][_0x1a75('0x32')]?_0x4ba38b[_0x1a75('0x33')]:_0x2e16b7['model'];if(!_0x34c106['query'][_0x1a75('0x34')]('nolimit')){_0x4ba38b[_0x1a75('0x1c')]=qs[_0x1a75('0x1c')](_0x34c106[_0x1a75('0x2d')]['limit']);_0x4ba38b['offset']=qs[_0x1a75('0x1b')](_0x34c106[_0x1a75('0x2d')][_0x1a75('0x1b')]);}_0x4ba38b[_0x1a75('0x35')]=qs[_0x1a75('0x36')](_0x34c106[_0x1a75('0x2d')][_0x1a75('0x36')]);_0x4ba38b[_0x1a75('0x37')]=qs[_0x1a75('0x2f')](_[_0x1a75('0x38')](_0x34c106[_0x1a75('0x2d')],_0x2e16b7[_0x1a75('0x2f')]),_0x19dc59);if(_0x34c106[_0x1a75('0x2d')][_0x1a75('0x39')]){_0x4ba38b[_0x1a75('0x37')]=_[_0x1a75('0x3a')](_0x4ba38b['where'],{'$or':_[_0x1a75('0x28')](_0x19dc59,function(_0x54bbce){if(_0x54bbce['type']!==_0x1a75('0x3b')){var _0x345712={};_0x345712[_0x54bbce[_0x1a75('0x25')]]={'$like':'%'+_0x34c106[_0x1a75('0x2d')][_0x1a75('0x39')]+'%'};return _0x345712;}})});}_0x4ba38b=_['merge']({},_0x4ba38b,_0x34c106[_0x1a75('0x3c')]);var _0xc88c40={'where':_0x4ba38b[_0x1a75('0x37')]};return db[_0x1a75('0x29')][_0x1a75('0x1a')](_0xc88c40)['then'](function(_0x3cf3f2){_0x2744ab['count']=_0x3cf3f2;if(_0x34c106[_0x1a75('0x2d')][_0x1a75('0x3d')]){_0x4ba38b[_0x1a75('0x3e')]=[{'all':!![]}];}return db[_0x1a75('0x29')][_0x1a75('0x3f')](_0x4ba38b);})[_0x1a75('0x21')](function(_0xa5002c){_0x2744ab['rows']=_0xa5002c;return _0x2744ab;})['then'](respondWithFilteredResult(_0x184d87,_0x4ba38b))[_0x1a75('0x40')](handleError(_0x184d87,null));};exports['show']=function(_0x7d462,_0x14abcf){var _0x3d97ce={'raw':!![],'where':{'id':_0x7d462[_0x1a75('0x41')]['id']}},_0x4b07f4={};_0x4b07f4[_0x1a75('0x2c')]=_[_0x1a75('0x2e')](db['SquareReport'][_0x1a75('0x2a')]);_0x4b07f4[_0x1a75('0x2d')]=_[_0x1a75('0x2e')](_0x7d462[_0x1a75('0x2d')]);_0x4b07f4[_0x1a75('0x2f')]=_[_0x1a75('0x30')](_0x4b07f4[_0x1a75('0x2c')],_0x4b07f4['query']);_0x3d97ce[_0x1a75('0x33')]=_[_0x1a75('0x30')](_0x4b07f4[_0x1a75('0x2c')],qs[_0x1a75('0x31')](_0x7d462[_0x1a75('0x2d')]['fields']));_0x3d97ce[_0x1a75('0x33')]=_0x3d97ce[_0x1a75('0x33')]['length']?_0x3d97ce[_0x1a75('0x33')]:_0x4b07f4['model'];if(_0x7d462[_0x1a75('0x2d')]['includeAll']){_0x3d97ce[_0x1a75('0x3e')]=[{'all':!![]}];}_0x3d97ce=_[_0x1a75('0x3a')]({},_0x3d97ce,_0x7d462[_0x1a75('0x3c')]);return db[_0x1a75('0x29')][_0x1a75('0x42')](_0x3d97ce)[_0x1a75('0x21')](handleEntityNotFound(_0x14abcf,null))[_0x1a75('0x21')](respondWithResult(_0x14abcf,null))['catch'](handleError(_0x14abcf,null));};exports[_0x1a75('0x43')]=function(_0x5e188b,_0x2c2be0){return db[_0x1a75('0x29')][_0x1a75('0x43')](_0x5e188b[_0x1a75('0x44')],{})[_0x1a75('0x21')](respondWithResult(_0x2c2be0,0xc9))[_0x1a75('0x40')](handleError(_0x2c2be0,null));};exports[_0x1a75('0x20')]=function(_0xd0557f,_0x545145){if(_0xd0557f[_0x1a75('0x44')]['id']){delete _0xd0557f[_0x1a75('0x44')]['id'];}return db[_0x1a75('0x29')][_0x1a75('0x42')]({'where':{'id':_0xd0557f[_0x1a75('0x41')]['id']}})[_0x1a75('0x21')](handleEntityNotFound(_0x545145,null))[_0x1a75('0x21')](saveUpdates(_0xd0557f[_0x1a75('0x44')],null))[_0x1a75('0x21')](respondWithResult(_0x545145,null))[_0x1a75('0x40')](handleError(_0x545145,null));};exports[_0x1a75('0x22')]=function(_0x2428f3,_0xc66315){return db[_0x1a75('0x29')][_0x1a75('0x42')]({'where':{'id':_0x2428f3['params']['id']}})[_0x1a75('0x21')](handleEntityNotFound(_0xc66315,null))[_0x1a75('0x21')](removeEntity(_0xc66315,null))[_0x1a75('0x40')](handleError(_0xc66315,null));};exports[_0x1a75('0x45')]=function(_0x36ff53,_0x12fe7c){return db[_0x1a75('0x29')][_0x1a75('0x45')]()['then'](respondWithResult(_0x12fe7c,null))[_0x1a75('0x40')](handleError(_0x12fe7c,null));}; \ No newline at end of file +var _0x6299=['describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','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','save','update','then','error','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','keys','filters','includeAll','find','body','destroy','params'];(function(_0x535868,_0x3c0309){var _0x4d654a=function(_0x543af3){while(--_0x543af3){_0x535868['push'](_0x535868['shift']());}};_0x4d654a(++_0x3c0309);}(_0x6299,0x169));var _0x9629=function(_0x4aa8a1,_0x55123b){_0x4aa8a1=_0x4aa8a1-0x0;var _0x212b44=_0x6299[_0x4aa8a1];return _0x212b44;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9629('0x0'));var zipdir=require(_0x9629('0x1'));var jsonpatch=require(_0x9629('0x2'));var rp=require(_0x9629('0x3'));var moment=require(_0x9629('0x4'));var BPromise=require(_0x9629('0x5'));var Mustache=require('mustache');var util=require(_0x9629('0x6'));var path=require(_0x9629('0x7'));var sox=require(_0x9629('0x8'));var csv=require(_0x9629('0x9'));var ejs=require(_0x9629('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9629('0xb'));var jsforce=require(_0x9629('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9629('0xd'));var Redis=require(_0x9629('0xe'));var authService=require(_0x9629('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9629('0x10'));var hardwareService=require(_0x9629('0x11'));var logger=require(_0x9629('0x12'))('api');var utils=require(_0x9629('0x13'));var config=require(_0x9629('0x14'));var licenseUtil=require(_0x9629('0x15'));var db=require(_0x9629('0x16'))['db'];function respondWithStatusCode(_0x37a60e,_0x4e7334){_0x4e7334=_0x4e7334||0xcc;return function(_0x2e2964){if(_0x2e2964){return _0x37a60e[_0x9629('0x17')](_0x4e7334);}return _0x37a60e[_0x9629('0x18')](_0x4e7334)[_0x9629('0x19')]();};}function respondWithResult(_0x216adc,_0x196eef){_0x196eef=_0x196eef||0xc8;return function(_0x5358c5){if(_0x5358c5){return _0x216adc[_0x9629('0x18')](_0x196eef)[_0x9629('0x1a')](_0x5358c5);}};}function respondWithFilteredResult(_0x73793b,_0x1fdf53){return function(_0xa4b554){if(_0xa4b554){var _0x365c6d=_0xa4b554[_0x9629('0x1b')],_0x4b281a=_0x1fdf53[_0x9629('0x1c')],_0x2cd6a6=_0x1fdf53[_0x9629('0x1c')]+_0x1fdf53[_0x9629('0x1d')],_0x3524f8;if(_0x2cd6a6>=_0x365c6d){_0x2cd6a6=_0x365c6d;_0x3524f8=0xc8;}else{_0x3524f8=0xce;}_0x73793b[_0x9629('0x18')](_0x3524f8);return _0x73793b[_0x9629('0x1e')](_0x9629('0x1f'),_0x4b281a+'-'+_0x2cd6a6+'/'+_0x365c6d)['json'](_0xa4b554);}return null;};}function patchUpdates(_0x5cb4b1){return function(_0x57ce58){try{jsonpatch[_0x9629('0x20')](_0x57ce58,_0x5cb4b1,!![]);}catch(_0x3dc1ed){return BPromise['reject'](_0x3dc1ed);}return _0x57ce58[_0x9629('0x21')]();};}function saveUpdates(_0x4ab24f,_0x3a4c7a){return function(_0x2393b7){if(_0x2393b7){return _0x2393b7[_0x9629('0x22')](_0x4ab24f)['then'](function(_0x4b3759){return _0x4b3759;});}return null;};}function removeEntity(_0x248d17,_0x169576){return function(_0x2956ed){if(_0x2956ed){return _0x2956ed['destroy']()[_0x9629('0x23')](function(){_0x248d17[_0x9629('0x18')](0xcc)[_0x9629('0x19')]();});}};}function handleEntityNotFound(_0x4ae0c7,_0x5caac4){return function(_0x558e99){if(!_0x558e99){_0x4ae0c7[_0x9629('0x17')](0x194);}return _0x558e99;};}function handleError(_0x200095,_0x19dbbb){_0x19dbbb=_0x19dbbb||0x1f4;return function(_0x1232ec){logger[_0x9629('0x24')](_0x1232ec['stack']);if(_0x1232ec[_0x9629('0x25')]){delete _0x1232ec['name'];}_0x200095[_0x9629('0x18')](_0x19dbbb)[_0x9629('0x26')](_0x1232ec);};}exports[_0x9629('0x27')]=function(_0x8811b9,_0x13a3b2){var _0xe7c85c={},_0x41b821={},_0x4248f3={'count':0x0,'rows':[]};var _0xf05efd=_['map'](db[_0x9629('0x28')][_0x9629('0x29')],function(_0x596376){return{'name':_0x596376[_0x9629('0x2a')],'type':_0x596376[_0x9629('0x2b')][_0x9629('0x2c')]};});_0x41b821[_0x9629('0x2d')]=_['map'](_0xf05efd,_0x9629('0x25'));_0x41b821[_0x9629('0x2e')]=_['keys'](_0x8811b9[_0x9629('0x2e')]);_0x41b821['filters']=_[_0x9629('0x2f')](_0x41b821[_0x9629('0x2d')],_0x41b821['query']);_0xe7c85c['attributes']=_[_0x9629('0x2f')](_0x41b821[_0x9629('0x2d')],qs[_0x9629('0x30')](_0x8811b9[_0x9629('0x2e')][_0x9629('0x30')]));_0xe7c85c[_0x9629('0x31')]=_0xe7c85c[_0x9629('0x31')][_0x9629('0x32')]?_0xe7c85c[_0x9629('0x31')]:_0x41b821[_0x9629('0x2d')];if(!_0x8811b9[_0x9629('0x2e')]['hasOwnProperty'](_0x9629('0x33'))){_0xe7c85c['limit']=qs[_0x9629('0x1d')](_0x8811b9[_0x9629('0x2e')][_0x9629('0x1d')]);_0xe7c85c[_0x9629('0x1c')]=qs[_0x9629('0x1c')](_0x8811b9['query'][_0x9629('0x1c')]);}_0xe7c85c[_0x9629('0x34')]=qs[_0x9629('0x35')](_0x8811b9[_0x9629('0x2e')][_0x9629('0x35')]);_0xe7c85c[_0x9629('0x36')]=qs['filters'](_[_0x9629('0x37')](_0x8811b9[_0x9629('0x2e')],_0x41b821['filters']),_0xf05efd);if(_0x8811b9['query'][_0x9629('0x38')]){_0xe7c85c[_0x9629('0x36')]=_[_0x9629('0x39')](_0xe7c85c['where'],{'$or':_[_0x9629('0x3a')](_0xf05efd,function(_0x3b8d6b){if(_0x3b8d6b[_0x9629('0x2b')]!==_0x9629('0x3b')){var _0x324e8d={};_0x324e8d[_0x3b8d6b[_0x9629('0x25')]]={'$like':'%'+_0x8811b9[_0x9629('0x2e')][_0x9629('0x38')]+'%'};return _0x324e8d;}})});}_0xe7c85c=_[_0x9629('0x39')]({},_0xe7c85c,_0x8811b9[_0x9629('0x3c')]);var _0x29c189={'where':_0xe7c85c['where']};return db[_0x9629('0x28')][_0x9629('0x1b')](_0x29c189)[_0x9629('0x23')](function(_0x5de7a8){_0x4248f3[_0x9629('0x1b')]=_0x5de7a8;if(_0x8811b9[_0x9629('0x2e')]['includeAll']){_0xe7c85c[_0x9629('0x3d')]=[{'all':!![]}];}return db[_0x9629('0x28')]['findAll'](_0xe7c85c);})['then'](function(_0x4011b7){_0x4248f3[_0x9629('0x3e')]=_0x4011b7;return _0x4248f3;})[_0x9629('0x23')](respondWithFilteredResult(_0x13a3b2,_0xe7c85c))[_0x9629('0x3f')](handleError(_0x13a3b2,null));};exports['show']=function(_0x22a409,_0x16734a){var _0x310c19={'raw':!![],'where':{'id':_0x22a409['params']['id']}},_0x229ce0={};_0x229ce0[_0x9629('0x2d')]=_[_0x9629('0x40')](db[_0x9629('0x28')]['rawAttributes']);_0x229ce0['query']=_[_0x9629('0x40')](_0x22a409[_0x9629('0x2e')]);_0x229ce0[_0x9629('0x41')]=_['intersection'](_0x229ce0['model'],_0x229ce0[_0x9629('0x2e')]);_0x310c19[_0x9629('0x31')]=_[_0x9629('0x2f')](_0x229ce0[_0x9629('0x2d')],qs[_0x9629('0x30')](_0x22a409[_0x9629('0x2e')]['fields']));_0x310c19[_0x9629('0x31')]=_0x310c19[_0x9629('0x31')][_0x9629('0x32')]?_0x310c19[_0x9629('0x31')]:_0x229ce0[_0x9629('0x2d')];if(_0x22a409[_0x9629('0x2e')][_0x9629('0x42')]){_0x310c19['include']=[{'all':!![]}];}_0x310c19=_['merge']({},_0x310c19,_0x22a409[_0x9629('0x3c')]);return db[_0x9629('0x28')][_0x9629('0x43')](_0x310c19)[_0x9629('0x23')](handleEntityNotFound(_0x16734a,null))[_0x9629('0x23')](respondWithResult(_0x16734a,null))['catch'](handleError(_0x16734a,null));};exports['create']=function(_0xd8fb44,_0xb78aaa){return db[_0x9629('0x28')]['create'](_0xd8fb44[_0x9629('0x44')],{})['then'](respondWithResult(_0xb78aaa,0xc9))[_0x9629('0x3f')](handleError(_0xb78aaa,null));};exports[_0x9629('0x22')]=function(_0x2362cd,_0x2d6151){if(_0x2362cd[_0x9629('0x44')]['id']){delete _0x2362cd['body']['id'];}return db[_0x9629('0x28')][_0x9629('0x43')]({'where':{'id':_0x2362cd['params']['id']}})[_0x9629('0x23')](handleEntityNotFound(_0x2d6151,null))['then'](saveUpdates(_0x2362cd[_0x9629('0x44')],null))['then'](respondWithResult(_0x2d6151,null))[_0x9629('0x3f')](handleError(_0x2d6151,null));};exports[_0x9629('0x45')]=function(_0x20f7f7,_0x3c1baa){return db[_0x9629('0x28')][_0x9629('0x43')]({'where':{'id':_0x20f7f7[_0x9629('0x46')]['id']}})[_0x9629('0x23')](handleEntityNotFound(_0x3c1baa,null))['then'](removeEntity(_0x3c1baa,null))[_0x9629('0x3f')](handleError(_0x3c1baa,null));};exports[_0x9629('0x47')]=function(_0x39ea2e,_0x10db38){return db[_0x9629('0x28')][_0x9629('0x47')]()[_0x9629('0x23')](respondWithResult(_0x10db38,null))[_0x9629('0x3f')](handleError(_0x10db38,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c537b7c..912ef95 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 _0x8e0e=['../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','moment','request-promise','path'];(function(_0x27d0d8,_0x2b657d){var _0x2b79d1=function(_0x249ec1){while(--_0x249ec1){_0x27d0d8['push'](_0x27d0d8['shift']());}};_0x2b79d1(++_0x2b657d);}(_0x8e0e,0x1ad));var _0xe8e0=function(_0x1d1ec3,_0x9ddb61){_0x1d1ec3=_0x1d1ec3-0x0;var _0x411b3b=_0x8e0e[_0x1d1ec3];return _0x411b3b;};'use strict';var _=require(_0xe8e0('0x0'));var util=require(_0xe8e0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe8e0('0x2'));var BPromise=require('bluebird');var rp=require(_0xe8e0('0x3'));var fs=require('fs');var path=require(_0xe8e0('0x4'));var rimraf=require('rimraf');var config=require(_0xe8e0('0x5'));var attributes=require(_0xe8e0('0x6'));module[_0xe8e0('0x7')]=function(_0x103e95,_0x5a4601){return _0x103e95['define'](_0xe8e0('0x8'),attributes,{'tableName':_0xe8e0('0x9'),'paranoid':![],'indexes':[{'name':_0xe8e0('0xa'),'fields':[_0xe8e0('0xb'),_0xe8e0('0xc')]},{'name':_0xe8e0('0xd'),'fields':[_0xe8e0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfe5=['api','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','project_name','leaveAt','util','../../config/logger'];(function(_0x1ecad1,_0x3acc16){var _0x20972c=function(_0x51844d){while(--_0x51844d){_0x1ecad1['push'](_0x1ecad1['shift']());}};_0x20972c(++_0x3acc16);}(_0xdfe5,0x108));var _0x5dfe=function(_0x1b0e78,_0x26df0c){_0x1b0e78=_0x1b0e78-0x0;var _0x2faef1=_0xdfe5[_0x1b0e78];return _0x2faef1;};'use strict';var _=require('lodash');var util=require(_0x5dfe('0x0'));var logger=require(_0x5dfe('0x1'))(_0x5dfe('0x2'));var moment=require('moment');var BPromise=require(_0x5dfe('0x3'));var rp=require(_0x5dfe('0x4'));var fs=require('fs');var path=require(_0x5dfe('0x5'));var rimraf=require('rimraf');var config=require(_0x5dfe('0x6'));var attributes=require(_0x5dfe('0x7'));module[_0x5dfe('0x8')]=function(_0x3d9b59,_0x2d3999){return _0x3d9b59[_0x5dfe('0x9')](_0x5dfe('0xa'),attributes,{'tableName':_0x5dfe('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x5dfe('0xc')]},{'name':_0x5dfe('0xd'),'fields':[_0x5dfe('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 f78ea95..356e130 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 _0x8d0e=['../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','CreateSquareReport','debug','update','body','raw','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a966d,_0x3646e1){var _0x347523=function(_0x191a49){while(--_0x191a49){_0x3a966d['push'](_0x3a966d['shift']());}};_0x347523(++_0x3646e1);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x15f6d1,_0x1fc543){_0x15f6d1=_0x15f6d1-0x0;var _0x19969e=_0x8d0e[_0x15f6d1];return _0x19969e;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});}exports['CreateSquareReport']=function(_0x47c67a){var _0x1bdd94=this;return new Promise(function(_0x384854,_0x27b910){return db[_0xe8d0('0x16')][_0xe8d0('0x17')](_0x47c67a['body'],{'raw':_0x47c67a[_0xe8d0('0x18')]?_0x47c67a[_0xe8d0('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x554402){logger[_0xe8d0('0xd')](_0xe8d0('0x19'),_0x47c67a);logger[_0xe8d0('0x1a')](_0xe8d0('0x19'),_0x47c67a,JSON[_0xe8d0('0x10')](_0x554402));_0x384854(_0x554402);})[_0xe8d0('0x15')](function(_0x1bd25c){logger[_0xe8d0('0x11')](_0xe8d0('0x19'),_0x1bd25c['message'],_0x47c67a);_0x27b910(_0x1bdd94[_0xe8d0('0x11')](0x1f4,_0x1bd25c[_0xe8d0('0x13')]));});});};exports['UpdateSquareReport']=function(_0x106614){var _0x2e69d1=this;return new Promise(function(_0x274cac,_0xd86c76){return db[_0xe8d0('0x16')][_0xe8d0('0x1b')](_0x106614[_0xe8d0('0x1c')],{'raw':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')][_0xe8d0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106614[_0xe8d0('0x18')]?_0x106614['options'][_0xe8d0('0x1e')]||null:null,'attributes':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['attributes']||null:null,'limit':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['limit']||null:null})[_0xe8d0('0xc')](function(_0x3ffcb7){logger[_0xe8d0('0xd')](_0xe8d0('0x1f'),_0x106614);logger[_0xe8d0('0x1a')]('UpdateSquareReport',_0x106614,JSON[_0xe8d0('0x10')](_0x3ffcb7));_0x274cac(_0x3ffcb7);})['catch'](function(_0x5d3276){logger['error'](_0xe8d0('0x1f'),_0x5d3276[_0xe8d0('0x13')],_0x106614);_0xd86c76(_0x2e69d1[_0xe8d0('0x11')](0x1f4,_0x5d3276['message']));});});}; \ No newline at end of file +var _0x00bb=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SquareReport','body','options','then','CreateSquareReport','update','raw','attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring'];(function(_0x471dd2,_0x1d956f){var _0x80e425=function(_0x4501bb){while(--_0x4501bb){_0x471dd2['push'](_0x471dd2['shift']());}};_0x80e425(++_0x1d956f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x00bb[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateSquareReport']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});};exports['UpdateSquareReport']=function(_0x3ab3cc){var _0x1f04d3=this;return new Promise(function(_0x5568bb,_0x44efe5){return db[_0xb00b('0x12')][_0xb00b('0x17')](_0x3ab3cc[_0xb00b('0x13')],{'raw':_0x3ab3cc['options']?_0x3ab3cc['options'][_0xb00b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ab3cc['options']?_0x3ab3cc['options']['where']||null:null,'attributes':_0x3ab3cc[_0xb00b('0x14')]?_0x3ab3cc[_0xb00b('0x14')][_0xb00b('0x19')]||null:null,'limit':_0x3ab3cc[_0xb00b('0x14')]?_0x3ab3cc[_0xb00b('0x14')][_0xb00b('0x1a')]||null:null})[_0xb00b('0x15')](function(_0x4a8d2b){logger[_0xb00b('0x9')]('UpdateSquareReport',_0x3ab3cc);logger[_0xb00b('0xc')](_0xb00b('0x1b'),_0x3ab3cc,JSON[_0xb00b('0xe')](_0x4a8d2b));_0x5568bb(_0x4a8d2b);})['catch'](function(_0x2fc11a){logger[_0xb00b('0xf')](_0xb00b('0x1b'),_0x2fc11a[_0xb00b('0x10')],_0x3ab3cc);_0x44efe5(_0x1f04d3[_0xb00b('0xf')](0x1f4,_0x2fc11a[_0xb00b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f96de53..88a6be2 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(_0x469179,_0xdbe154){var _0x31d5b0=function(_0x18aa06){while(--_0x18aa06){_0x469179['push'](_0x469179['shift']());}};_0x31d5b0(++_0xdbe154);}(_0x7a54,0x106));var _0x47a5=function(_0x41ec2b,_0x189043){_0x41ec2b=_0x41ec2b-0x0;var _0x43c04e=_0x7a54[_0x41ec2b];return _0x43c04e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0xd50011,_0x46c46e){var _0x3c9cb0=function(_0x16dde2){while(--_0x16dde2){_0xd50011['push'](_0xd50011['shift']());}};_0x3c9cb0(++_0x46c46e);}(_0x7a54,0x106));var _0x47a5=function(_0x1b1e43,_0x49c562){_0x1b1e43=_0x1b1e43-0x0;var _0x46cbcf=_0x7a54[_0x1b1e43];return _0x46cbcf;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index ff20c8b..f5c1fa5 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 _0x2f07=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f07,0x12e));var _0x72f0=function(_0x259126,_0x5b2e92){_0x259126=_0x259126-0x0;var _0x12db5c=_0x2f07[_0x259126];return _0x12db5c;};'use strict';var Sequelize=require(_0x72f0('0x0'));module[_0x72f0('0x1')]={'uniqueid':{'type':Sequelize[_0x72f0('0x2')]},'node':{'type':Sequelize[_0x72f0('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x72f0('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x72f0('0x2')]}}; \ No newline at end of file +var _0xf658=['exports','STRING','TEXT','sequelize'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf658,0x9f));var _0x8f65=function(_0x2195b0,_0x1734db){_0x2195b0=_0x2195b0-0x0;var _0x40af94=_0xf658[_0x2195b0];return _0x40af94;};'use strict';var Sequelize=require(_0x8f65('0x0'));module[_0x8f65('0x1')]={'uniqueid':{'type':Sequelize[_0x8f65('0x2')]},'node':{'type':Sequelize[_0x8f65('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x8f65('0x3')]},'project_name':{'type':Sequelize[_0x8f65('0x2')]},'callerid':{'type':Sequelize[_0x8f65('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7b50705..9d72da8 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 _0x0a17=['../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','count','SquareDetailsReport','rows','catch','show','params','includeAll','include','find','create','body','update','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5f15d7,_0x5c7c58){var _0x4317e9=function(_0x31e35b){while(--_0x31e35b){_0x5f15d7['push'](_0x5f15d7['shift']());}};_0x4317e9(++_0x5c7c58);}(_0x0a17,0x1a6));var _0x70a1=function(_0x4e9cc2,_0x5e4885){_0x4e9cc2=_0x4e9cc2-0x0;var _0x3b7ea6=_0x0a17[_0x4e9cc2];return _0x3b7ea6;};'use strict';var pdf=require(_0x70a1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x70a1('0x2'));var moment=require(_0x70a1('0x3'));var BPromise=require(_0x70a1('0x4'));var Mustache=require(_0x70a1('0x5'));var util=require('util');var path=require(_0x70a1('0x6'));var sox=require(_0x70a1('0x7'));var csv=require(_0x70a1('0x8'));var ejs=require(_0x70a1('0x9'));var fs=require('fs');var _=require(_0x70a1('0xa'));var squel=require(_0x70a1('0xb'));var crypto=require(_0x70a1('0xc'));var jsforce=require(_0x70a1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x70a1('0x8'));var querystring=require(_0x70a1('0xe'));var Papa=require(_0x70a1('0xf'));var Redis=require(_0x70a1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x70a1('0x11'));var as=require(_0x70a1('0x12'));var hardwareService=require(_0x70a1('0x13'));var logger=require(_0x70a1('0x14'))(_0x70a1('0x15'));var utils=require(_0x70a1('0x16'));var config=require(_0x70a1('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcdd77b,_0x23cadf){_0x23cadf=_0x23cadf||0xcc;return function(_0x2675cd){if(_0x2675cd){return _0xcdd77b[_0x70a1('0x18')](_0x23cadf);}return _0xcdd77b[_0x70a1('0x19')](_0x23cadf)['end']();};}function respondWithResult(_0x278929,_0x101036){_0x101036=_0x101036||0xc8;return function(_0x24bb61){if(_0x24bb61){return _0x278929['status'](_0x101036)[_0x70a1('0x1a')](_0x24bb61);}};}function respondWithFilteredResult(_0xa1f78a,_0x1188fd){return function(_0x5d55cb){if(_0x5d55cb){var _0x16028c=_0x5d55cb['count'],_0x283ee0=_0x1188fd[_0x70a1('0x1b')],_0x4fad24=_0x1188fd[_0x70a1('0x1b')]+_0x1188fd[_0x70a1('0x1c')],_0x1ca218;if(_0x4fad24>=_0x16028c){_0x4fad24=_0x16028c;_0x1ca218=0xc8;}else{_0x1ca218=0xce;}_0xa1f78a[_0x70a1('0x19')](_0x1ca218);return _0xa1f78a[_0x70a1('0x1d')](_0x70a1('0x1e'),_0x283ee0+'-'+_0x4fad24+'/'+_0x16028c)[_0x70a1('0x1a')](_0x5d55cb);}return null;};}function patchUpdates(_0x14db37){return function(_0x174dbe){try{jsonpatch['apply'](_0x174dbe,_0x14db37,!![]);}catch(_0x31b3cb){return BPromise[_0x70a1('0x1f')](_0x31b3cb);}return _0x174dbe[_0x70a1('0x20')]();};}function saveUpdates(_0x452150,_0x22d40a){return function(_0x2b95f7){if(_0x2b95f7){return _0x2b95f7['update'](_0x452150)[_0x70a1('0x21')](function(_0x10d6f4){return _0x10d6f4;});}return null;};}function removeEntity(_0x31448e,_0x2f85b5){return function(_0x3b12db){if(_0x3b12db){return _0x3b12db[_0x70a1('0x22')]()[_0x70a1('0x21')](function(){_0x31448e['status'](0xcc)[_0x70a1('0x23')]();});}};}function handleEntityNotFound(_0x1169dd,_0x8ae127){return function(_0x1e3e23){if(!_0x1e3e23){_0x1169dd[_0x70a1('0x18')](0x194);}return _0x1e3e23;};}function handleError(_0x5d764e,_0x5256ba){_0x5256ba=_0x5256ba||0x1f4;return function(_0x2afcf5){logger[_0x70a1('0x24')](_0x2afcf5[_0x70a1('0x25')]);if(_0x2afcf5[_0x70a1('0x26')]){delete _0x2afcf5['name'];}_0x5d764e[_0x70a1('0x19')](_0x5256ba)[_0x70a1('0x27')](_0x2afcf5);};}exports[_0x70a1('0x28')]=function(_0x1b7d0d,_0x3725dc){var _0x186d3d={},_0x56cf3f={},_0x1155b8={'count':0x0,'rows':[]};var _0x34ab27=_['map'](db['SquareDetailsReport'][_0x70a1('0x29')],function(_0x1e9771){return{'name':_0x1e9771[_0x70a1('0x2a')],'type':_0x1e9771[_0x70a1('0x2b')]['key']};});_0x56cf3f['model']=_['map'](_0x34ab27,_0x70a1('0x26'));_0x56cf3f[_0x70a1('0x2c')]=_[_0x70a1('0x2d')](_0x1b7d0d[_0x70a1('0x2c')]);_0x56cf3f['filters']=_[_0x70a1('0x2e')](_0x56cf3f[_0x70a1('0x2f')],_0x56cf3f[_0x70a1('0x2c')]);_0x186d3d['attributes']=_['intersection'](_0x56cf3f[_0x70a1('0x2f')],qs[_0x70a1('0x30')](_0x1b7d0d[_0x70a1('0x2c')][_0x70a1('0x30')]));_0x186d3d[_0x70a1('0x31')]=_0x186d3d[_0x70a1('0x31')][_0x70a1('0x32')]?_0x186d3d['attributes']:_0x56cf3f[_0x70a1('0x2f')];if(!_0x1b7d0d[_0x70a1('0x2c')]['hasOwnProperty'](_0x70a1('0x33'))){_0x186d3d['limit']=qs[_0x70a1('0x1c')](_0x1b7d0d['query']['limit']);_0x186d3d[_0x70a1('0x1b')]=qs[_0x70a1('0x1b')](_0x1b7d0d[_0x70a1('0x2c')][_0x70a1('0x1b')]);}_0x186d3d[_0x70a1('0x34')]=qs[_0x70a1('0x35')](_0x1b7d0d[_0x70a1('0x2c')]['sort']);_0x186d3d[_0x70a1('0x36')]=qs['filters'](_[_0x70a1('0x37')](_0x1b7d0d[_0x70a1('0x2c')],_0x56cf3f[_0x70a1('0x38')]),_0x34ab27);if(_0x1b7d0d[_0x70a1('0x2c')]['filter']){_0x186d3d[_0x70a1('0x36')]=_[_0x70a1('0x39')](_0x186d3d[_0x70a1('0x36')],{'$or':_['map'](_0x34ab27,function(_0x1db249){if(_0x1db249[_0x70a1('0x2b')]!==_0x70a1('0x3a')){var _0x59502f={};_0x59502f[_0x1db249[_0x70a1('0x26')]]={'$like':'%'+_0x1b7d0d[_0x70a1('0x2c')][_0x70a1('0x3b')]+'%'};return _0x59502f;}})});}_0x186d3d=_[_0x70a1('0x39')]({},_0x186d3d,_0x1b7d0d[_0x70a1('0x3c')]);var _0x379b59={'where':_0x186d3d['where']};return db['SquareDetailsReport'][_0x70a1('0x3d')](_0x379b59)['then'](function(_0x932be6){_0x1155b8[_0x70a1('0x3d')]=_0x932be6;if(_0x1b7d0d['query']['includeAll']){_0x186d3d['include']=[{'all':!![]}];}return db[_0x70a1('0x3e')]['findAll'](_0x186d3d);})[_0x70a1('0x21')](function(_0x4ebffd){_0x1155b8[_0x70a1('0x3f')]=_0x4ebffd;return _0x1155b8;})['then'](respondWithFilteredResult(_0x3725dc,_0x186d3d))[_0x70a1('0x40')](handleError(_0x3725dc,null));};exports[_0x70a1('0x41')]=function(_0x5a290a,_0x2372ed){var _0x26efc4={'raw':!![],'where':{'id':_0x5a290a[_0x70a1('0x42')]['id']}},_0x5a1bf2={};_0x5a1bf2[_0x70a1('0x2f')]=_['keys'](db[_0x70a1('0x3e')][_0x70a1('0x29')]);_0x5a1bf2[_0x70a1('0x2c')]=_[_0x70a1('0x2d')](_0x5a290a[_0x70a1('0x2c')]);_0x5a1bf2['filters']=_[_0x70a1('0x2e')](_0x5a1bf2['model'],_0x5a1bf2[_0x70a1('0x2c')]);_0x26efc4['attributes']=_['intersection'](_0x5a1bf2[_0x70a1('0x2f')],qs[_0x70a1('0x30')](_0x5a290a[_0x70a1('0x2c')][_0x70a1('0x30')]));_0x26efc4[_0x70a1('0x31')]=_0x26efc4[_0x70a1('0x31')][_0x70a1('0x32')]?_0x26efc4[_0x70a1('0x31')]:_0x5a1bf2[_0x70a1('0x2f')];if(_0x5a290a[_0x70a1('0x2c')][_0x70a1('0x43')]){_0x26efc4[_0x70a1('0x44')]=[{'all':!![]}];}_0x26efc4=_[_0x70a1('0x39')]({},_0x26efc4,_0x5a290a['options']);return db[_0x70a1('0x3e')][_0x70a1('0x45')](_0x26efc4)[_0x70a1('0x21')](handleEntityNotFound(_0x2372ed,null))['then'](respondWithResult(_0x2372ed,null))[_0x70a1('0x40')](handleError(_0x2372ed,null));};exports[_0x70a1('0x46')]=function(_0x3b12c6,_0x572385){return db[_0x70a1('0x3e')][_0x70a1('0x46')](_0x3b12c6[_0x70a1('0x47')],{})[_0x70a1('0x21')](respondWithResult(_0x572385,0xc9))[_0x70a1('0x40')](handleError(_0x572385,null));};exports[_0x70a1('0x48')]=function(_0x239a77,_0x1874d9){if(_0x239a77[_0x70a1('0x47')]['id']){delete _0x239a77[_0x70a1('0x47')]['id'];}return db[_0x70a1('0x3e')][_0x70a1('0x45')]({'where':{'id':_0x239a77[_0x70a1('0x42')]['id']}})['then'](handleEntityNotFound(_0x1874d9,null))[_0x70a1('0x21')](saveUpdates(_0x239a77[_0x70a1('0x47')],null))[_0x70a1('0x21')](respondWithResult(_0x1874d9,null))[_0x70a1('0x40')](handleError(_0x1874d9,null));};exports[_0x70a1('0x22')]=function(_0x43fed3,_0x216e29){return db[_0x70a1('0x3e')][_0x70a1('0x45')]({'where':{'id':_0x43fed3[_0x70a1('0x42')]['id']}})[_0x70a1('0x21')](handleEntityNotFound(_0x216e29,null))[_0x70a1('0x21')](removeEntity(_0x216e29,null))[_0x70a1('0x40')](handleError(_0x216e29,null));};exports[_0x70a1('0x49')]=function(_0x20ae2d,_0x39d197){return db[_0x70a1('0x3e')]['describe']()[_0x70a1('0x21')](respondWithResult(_0x39d197,null))[_0x70a1('0x40')](handleError(_0x39d197,null));}; \ No newline at end of file +var _0x62a8=['end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','keys','length','options','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3a23b4,_0x49d839){var _0x302bca=function(_0x5e478f){while(--_0x5e478f){_0x3a23b4['push'](_0x3a23b4['shift']());}};_0x302bca(++_0x49d839);}(_0x62a8,0x16b));var _0x862a=function(_0x3d009c,_0x2c8945){_0x3d009c=_0x3d009c-0x0;var _0x437d64=_0x62a8[_0x3d009c];return _0x437d64;};'use strict';var pdf=require(_0x862a('0x0'));var emlformat=require(_0x862a('0x1'));var rimraf=require(_0x862a('0x2'));var zipdir=require(_0x862a('0x3'));var jsonpatch=require(_0x862a('0x4'));var rp=require('request-promise');var moment=require(_0x862a('0x5'));var BPromise=require(_0x862a('0x6'));var Mustache=require('mustache');var util=require(_0x862a('0x7'));var path=require('path');var sox=require(_0x862a('0x8'));var csv=require('to-csv');var ejs=require(_0x862a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x862a('0xa'));var crypto=require(_0x862a('0xb'));var jsforce=require(_0x862a('0xc'));var deskjs=require(_0x862a('0xd'));var toCsv=require(_0x862a('0xe'));var querystring=require(_0x862a('0xf'));var Papa=require(_0x862a('0x10'));var Redis=require(_0x862a('0x11'));var authService=require(_0x862a('0x12'));var qs=require(_0x862a('0x13'));var as=require(_0x862a('0x14'));var hardwareService=require(_0x862a('0x15'));var logger=require(_0x862a('0x16'))(_0x862a('0x17'));var utils=require('../../config/utils');var config=require(_0x862a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x862a('0x19'))['db'];function respondWithStatusCode(_0x34f0fe,_0x2c83df){_0x2c83df=_0x2c83df||0xcc;return function(_0x37a770){if(_0x37a770){return _0x34f0fe[_0x862a('0x1a')](_0x2c83df);}return _0x34f0fe['status'](_0x2c83df)[_0x862a('0x1b')]();};}function respondWithResult(_0x101545,_0x89c7a1){_0x89c7a1=_0x89c7a1||0xc8;return function(_0x5a03e7){if(_0x5a03e7){return _0x101545[_0x862a('0x1c')](_0x89c7a1)[_0x862a('0x1d')](_0x5a03e7);}};}function respondWithFilteredResult(_0x5c84ef,_0x223c72){return function(_0x4edb39){if(_0x4edb39){var _0x374231=_0x4edb39[_0x862a('0x1e')],_0x4dcff1=_0x223c72[_0x862a('0x1f')],_0xabfa57=_0x223c72[_0x862a('0x1f')]+_0x223c72['limit'],_0x4cbef4;if(_0xabfa57>=_0x374231){_0xabfa57=_0x374231;_0x4cbef4=0xc8;}else{_0x4cbef4=0xce;}_0x5c84ef[_0x862a('0x1c')](_0x4cbef4);return _0x5c84ef[_0x862a('0x20')](_0x862a('0x21'),_0x4dcff1+'-'+_0xabfa57+'/'+_0x374231)[_0x862a('0x1d')](_0x4edb39);}return null;};}function patchUpdates(_0x1b082d){return function(_0x2c8f6c){try{jsonpatch[_0x862a('0x22')](_0x2c8f6c,_0x1b082d,!![]);}catch(_0xba3729){return BPromise[_0x862a('0x23')](_0xba3729);}return _0x2c8f6c[_0x862a('0x24')]();};}function saveUpdates(_0x20f212,_0x5cc286){return function(_0x3b5d8d){if(_0x3b5d8d){return _0x3b5d8d['update'](_0x20f212)[_0x862a('0x25')](function(_0x39e322){return _0x39e322;});}return null;};}function removeEntity(_0x585465,_0x3179af){return function(_0x163ec2){if(_0x163ec2){return _0x163ec2[_0x862a('0x26')]()[_0x862a('0x25')](function(){_0x585465['status'](0xcc)[_0x862a('0x1b')]();});}};}function handleEntityNotFound(_0x49043c,_0x48d42e){return function(_0x16bc71){if(!_0x16bc71){_0x49043c[_0x862a('0x1a')](0x194);}return _0x16bc71;};}function handleError(_0x415764,_0x4b3c2e){_0x4b3c2e=_0x4b3c2e||0x1f4;return function(_0xa8e60d){logger[_0x862a('0x27')](_0xa8e60d[_0x862a('0x28')]);if(_0xa8e60d[_0x862a('0x29')]){delete _0xa8e60d[_0x862a('0x29')];}_0x415764['status'](_0x4b3c2e)['send'](_0xa8e60d);};}exports[_0x862a('0x2a')]=function(_0x3f2e9a,_0x56be01){var _0x33ff6d={},_0x52403e={},_0x525dbf={'count':0x0,'rows':[]};var _0x2b844b=_[_0x862a('0x2b')](db[_0x862a('0x2c')][_0x862a('0x2d')],function(_0x4c6284){return{'name':_0x4c6284['fieldName'],'type':_0x4c6284[_0x862a('0x2e')][_0x862a('0x2f')]};});_0x52403e[_0x862a('0x30')]=_[_0x862a('0x2b')](_0x2b844b,'name');_0x52403e['query']=_['keys'](_0x3f2e9a[_0x862a('0x31')]);_0x52403e[_0x862a('0x32')]=_[_0x862a('0x33')](_0x52403e[_0x862a('0x30')],_0x52403e[_0x862a('0x31')]);_0x33ff6d[_0x862a('0x34')]=_[_0x862a('0x33')](_0x52403e[_0x862a('0x30')],qs[_0x862a('0x35')](_0x3f2e9a[_0x862a('0x31')]['fields']));_0x33ff6d['attributes']=_0x33ff6d[_0x862a('0x34')]['length']?_0x33ff6d[_0x862a('0x34')]:_0x52403e['model'];if(!_0x3f2e9a[_0x862a('0x31')][_0x862a('0x36')](_0x862a('0x37'))){_0x33ff6d[_0x862a('0x38')]=qs[_0x862a('0x38')](_0x3f2e9a['query'][_0x862a('0x38')]);_0x33ff6d[_0x862a('0x1f')]=qs[_0x862a('0x1f')](_0x3f2e9a[_0x862a('0x31')]['offset']);}_0x33ff6d[_0x862a('0x39')]=qs[_0x862a('0x3a')](_0x3f2e9a['query']['sort']);_0x33ff6d[_0x862a('0x3b')]=qs['filters'](_[_0x862a('0x3c')](_0x3f2e9a[_0x862a('0x31')],_0x52403e[_0x862a('0x32')]),_0x2b844b);if(_0x3f2e9a['query']['filter']){_0x33ff6d[_0x862a('0x3b')]=_[_0x862a('0x3d')](_0x33ff6d['where'],{'$or':_[_0x862a('0x2b')](_0x2b844b,function(_0x29f3b2){if(_0x29f3b2['type']!==_0x862a('0x3e')){var _0x44616a={};_0x44616a[_0x29f3b2[_0x862a('0x29')]]={'$like':'%'+_0x3f2e9a[_0x862a('0x31')][_0x862a('0x3f')]+'%'};return _0x44616a;}})});}_0x33ff6d=_['merge']({},_0x33ff6d,_0x3f2e9a['options']);var _0x1d586b={'where':_0x33ff6d[_0x862a('0x3b')]};return db[_0x862a('0x2c')]['count'](_0x1d586b)['then'](function(_0x54e409){_0x525dbf[_0x862a('0x1e')]=_0x54e409;if(_0x3f2e9a['query'][_0x862a('0x40')]){_0x33ff6d[_0x862a('0x41')]=[{'all':!![]}];}return db[_0x862a('0x2c')][_0x862a('0x42')](_0x33ff6d);})['then'](function(_0x11e6d7){_0x525dbf[_0x862a('0x43')]=_0x11e6d7;return _0x525dbf;})[_0x862a('0x25')](respondWithFilteredResult(_0x56be01,_0x33ff6d))[_0x862a('0x44')](handleError(_0x56be01,null));};exports['show']=function(_0x4958a8,_0xbf3768){var _0x2f5e9c={'raw':!![],'where':{'id':_0x4958a8[_0x862a('0x45')]['id']}},_0x2fafa8={};_0x2fafa8[_0x862a('0x30')]=_[_0x862a('0x46')](db[_0x862a('0x2c')][_0x862a('0x2d')]);_0x2fafa8[_0x862a('0x31')]=_[_0x862a('0x46')](_0x4958a8[_0x862a('0x31')]);_0x2fafa8[_0x862a('0x32')]=_[_0x862a('0x33')](_0x2fafa8[_0x862a('0x30')],_0x2fafa8[_0x862a('0x31')]);_0x2f5e9c[_0x862a('0x34')]=_['intersection'](_0x2fafa8[_0x862a('0x30')],qs[_0x862a('0x35')](_0x4958a8[_0x862a('0x31')][_0x862a('0x35')]));_0x2f5e9c[_0x862a('0x34')]=_0x2f5e9c['attributes'][_0x862a('0x47')]?_0x2f5e9c['attributes']:_0x2fafa8[_0x862a('0x30')];if(_0x4958a8[_0x862a('0x31')][_0x862a('0x40')]){_0x2f5e9c['include']=[{'all':!![]}];}_0x2f5e9c=_[_0x862a('0x3d')]({},_0x2f5e9c,_0x4958a8[_0x862a('0x48')]);return db[_0x862a('0x2c')]['find'](_0x2f5e9c)[_0x862a('0x25')](handleEntityNotFound(_0xbf3768,null))[_0x862a('0x25')](respondWithResult(_0xbf3768,null))[_0x862a('0x44')](handleError(_0xbf3768,null));};exports['create']=function(_0x5f4981,_0x4753cc){return db[_0x862a('0x2c')][_0x862a('0x49')](_0x5f4981[_0x862a('0x4a')],{})[_0x862a('0x25')](respondWithResult(_0x4753cc,0xc9))[_0x862a('0x44')](handleError(_0x4753cc,null));};exports[_0x862a('0x4b')]=function(_0x55cba8,_0x8d034b){if(_0x55cba8[_0x862a('0x4a')]['id']){delete _0x55cba8['body']['id'];}return db['SquareDetailsReport'][_0x862a('0x4c')]({'where':{'id':_0x55cba8[_0x862a('0x45')]['id']}})[_0x862a('0x25')](handleEntityNotFound(_0x8d034b,null))['then'](saveUpdates(_0x55cba8[_0x862a('0x4a')],null))[_0x862a('0x25')](respondWithResult(_0x8d034b,null))['catch'](handleError(_0x8d034b,null));};exports[_0x862a('0x26')]=function(_0x4a269d,_0x395b1f){return db[_0x862a('0x2c')][_0x862a('0x4c')]({'where':{'id':_0x4a269d[_0x862a('0x45')]['id']}})[_0x862a('0x25')](handleEntityNotFound(_0x395b1f,null))['then'](removeEntity(_0x395b1f,null))[_0x862a('0x44')](handleError(_0x395b1f,null));};exports['describe']=function(_0x2f858e,_0x3a3e6c){return db['SquareDetailsReport'][_0x862a('0x4d')]()[_0x862a('0x25')](respondWithResult(_0x3a3e6c,null))[_0x862a('0x44')](handleError(_0x3a3e6c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a3d9d1f..23fba7e 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 _0x0a1f=['request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','util','../../config/logger','moment','bluebird'];(function(_0x30806e,_0x41bb0d){var _0x2777c6=function(_0x2557b6){while(--_0x2557b6){_0x30806e['push'](_0x30806e['shift']());}};_0x2777c6(++_0x41bb0d);}(_0x0a1f,0x88));var _0xf0a1=function(_0x117cf9,_0x2131fa){_0x117cf9=_0x117cf9-0x0;var _0x1bec82=_0x0a1f[_0x117cf9];return _0x1bec82;};'use strict';var _=require('lodash');var util=require(_0xf0a1('0x0'));var logger=require(_0xf0a1('0x1'))('api');var moment=require(_0xf0a1('0x2'));var BPromise=require(_0xf0a1('0x3'));var rp=require(_0xf0a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf0a1('0x5'));var attributes=require(_0xf0a1('0x6'));module[_0xf0a1('0x7')]=function(_0x3aa1ee,_0x222a7f){return _0x3aa1ee[_0xf0a1('0x8')](_0xf0a1('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6755=['../../config/environment','exports','define','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x56822b,_0x588899){var _0x3ea21d=function(_0x144b7a){while(--_0x144b7a){_0x56822b['push'](_0x56822b['shift']());}};_0x3ea21d(++_0x588899);}(_0x6755,0x193));var _0x5675=function(_0x182d16,_0x233e42){_0x182d16=_0x182d16-0x0;var _0x41cae3=_0x6755[_0x182d16];return _0x41cae3;};'use strict';var _=require(_0x5675('0x0'));var util=require(_0x5675('0x1'));var logger=require('../../config/logger')(_0x5675('0x2'));var moment=require(_0x5675('0x3'));var BPromise=require('bluebird');var rp=require(_0x5675('0x4'));var fs=require('fs');var path=require(_0x5675('0x5'));var rimraf=require(_0x5675('0x6'));var config=require(_0x5675('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x5675('0x8')]=function(_0x256fc6,_0x425a6c){return _0x256fc6[_0x5675('0x9')]('SquareDetailsReport',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 561bd82..f310109 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 _0x159b=['rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareDetailsReport,\x20%s,\x20%s','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x437563,_0x55e906){var _0x39d3a3=function(_0x23e733){while(--_0x23e733){_0x437563['push'](_0x437563['shift']());}};_0x39d3a3(++_0x55e906);}(_0x159b,0x1d8));var _0xb159=function(_0x4753ff,_0x30542e){_0x4753ff=_0x4753ff-0x0;var _0x2192e0=_0x159b[_0x4753ff];return _0x2192e0;};'use strict';var _=require(_0xb159('0x0'));var util=require(_0xb159('0x1'));var moment=require(_0xb159('0x2'));var BPromise=require(_0xb159('0x3'));var rs=require(_0xb159('0x4'));var fs=require('fs');var Redis=require(_0xb159('0x5'));var db=require(_0xb159('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb159('0x7'))(_0xb159('0x8'));var config=require(_0xb159('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb159('0xa')][_0xb159('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f0db,_0x2d7cc5,_0x5dd400){return new BPromise(function(_0x4bd9b4,_0x35a9a1){return client[_0xb159('0xc')](_0x58f0db,_0x5dd400)[_0xb159('0xd')](function(_0x5a155e){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x2d7cc5,_0xb159('0xe'));logger[_0xb159('0xf')](_0xb159('0x10'),_0x2d7cc5,_0xb159('0xe'),JSON[_0xb159('0x11')](_0x5a155e));if(_0x5a155e['error']){if(_0x5a155e[_0xb159('0x12')]['code']===0x1f4){logger[_0xb159('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x2d7cc5,_0x5a155e[_0xb159('0x12')][_0xb159('0x13')]);return _0x35a9a1(_0x5a155e['error'][_0xb159('0x13')]);}logger[_0xb159('0x12')](_0xb159('0x14'),_0x2d7cc5,_0x5a155e[_0xb159('0x12')][_0xb159('0x13')]);return _0x4bd9b4(_0x5a155e[_0xb159('0x12')][_0xb159('0x13')]);}else{logger[_0xb159('0x15')](_0xb159('0x14'),_0x2d7cc5,_0xb159('0xe'));_0x4bd9b4(_0x5a155e[_0xb159('0x16')][_0xb159('0x13')]);}})[_0xb159('0x17')](function(_0x555552){logger[_0xb159('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x2d7cc5,_0x555552);_0x35a9a1(_0x555552);});});}exports[_0xb159('0x18')]=function(_0xf06131){var _0x5a50b6=this;return new Promise(function(_0x592f42,_0x5a0e99){return db[_0xb159('0x19')][_0xb159('0x1a')](_0xf06131[_0xb159('0x1b')],{'raw':_0xf06131['options']?_0xf06131[_0xb159('0x1c')][_0xb159('0x1d')]===undefined?!![]:![]:!![]})[_0xb159('0xd')](function(_0x1e1cf1){logger['info']('CreateSquareDetailsReport',_0xf06131);logger[_0xb159('0xf')]('CreateSquareDetailsReport',_0xf06131,JSON['stringify'](_0x1e1cf1));_0x592f42(_0x1e1cf1);})[_0xb159('0x17')](function(_0x249bc5){logger[_0xb159('0x12')](_0xb159('0x18'),_0x249bc5['message'],_0xf06131);_0x5a0e99(_0x5a50b6[_0xb159('0x12')](0x1f4,_0x249bc5[_0xb159('0x13')]));});});}; \ No newline at end of file +var _0xd3ae=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xe451cd,_0x82e290){var _0x30859d=function(_0x3213cf){while(--_0x3213cf){_0xe451cd['push'](_0xe451cd['shift']());}};_0x30859d(++_0x82e290);}(_0xd3ae,0xdb));var _0xed3a=function(_0x365056,_0x5afa4f){_0x365056=_0x365056-0x0;var _0x412743=_0xd3ae[_0x365056];return _0x412743;};'use strict';var _=require(_0xed3a('0x0'));var util=require('util');var moment=require(_0xed3a('0x1'));var BPromise=require(_0xed3a('0x2'));var rs=require(_0xed3a('0x3'));var fs=require('fs');var Redis=require(_0xed3a('0x4'));var db=require(_0xed3a('0x5'))['db'];var utils=require(_0xed3a('0x6'));var logger=require(_0xed3a('0x7'))('rpc');var config=require(_0xed3a('0x8'));var jayson=require(_0xed3a('0x9'));var client=jayson[_0xed3a('0xa')][_0xed3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31197a,_0x35fa91,_0x58e46b){return new BPromise(function(_0x55e360,_0x4339b3){return client[_0xed3a('0xc')](_0x31197a,_0x58e46b)[_0xed3a('0xd')](function(_0x3ff2d8){logger['info'](_0xed3a('0xe'),_0x35fa91,'request\x20sent');logger['debug'](_0xed3a('0xf'),_0x35fa91,'request\x20sent',JSON[_0xed3a('0x10')](_0x3ff2d8));if(_0x3ff2d8['error']){if(_0x3ff2d8[_0xed3a('0x11')][_0xed3a('0x12')]===0x1f4){logger['error'](_0xed3a('0xe'),_0x35fa91,_0x3ff2d8[_0xed3a('0x11')][_0xed3a('0x13')]);return _0x4339b3(_0x3ff2d8[_0xed3a('0x11')][_0xed3a('0x13')]);}logger[_0xed3a('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x35fa91,_0x3ff2d8[_0xed3a('0x11')][_0xed3a('0x13')]);return _0x55e360(_0x3ff2d8[_0xed3a('0x11')][_0xed3a('0x13')]);}else{logger[_0xed3a('0x14')](_0xed3a('0xe'),_0x35fa91,_0xed3a('0x15'));_0x55e360(_0x3ff2d8[_0xed3a('0x16')][_0xed3a('0x13')]);}})[_0xed3a('0x17')](function(_0x2f7be2){logger[_0xed3a('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x35fa91,_0x2f7be2);_0x4339b3(_0x2f7be2);});});}exports[_0xed3a('0x18')]=function(_0x26041a){var _0x53825f=this;return new Promise(function(_0x4dc984,_0xec1464){return db[_0xed3a('0x19')]['create'](_0x26041a['body'],{'raw':_0x26041a[_0xed3a('0x1a')]?_0x26041a[_0xed3a('0x1a')][_0xed3a('0x1b')]===undefined?!![]:![]:!![]})[_0xed3a('0xd')](function(_0x800675){logger[_0xed3a('0x14')](_0xed3a('0x18'),_0x26041a);logger['debug'](_0xed3a('0x18'),_0x26041a,JSON[_0xed3a('0x10')](_0x800675));_0x4dc984(_0x800675);})[_0xed3a('0x17')](function(_0x187f2b){logger[_0xed3a('0x11')](_0xed3a('0x18'),_0x187f2b[_0xed3a('0x13')],_0x26041a);_0xec1464(_0x53825f[_0xed3a('0x11')](0x1f4,_0x187f2b[_0xed3a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b1eb5d1..4489b4c 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 _0x6a11=['exports','express','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x33a1c1,_0x28b6b3){var _0x34fbc6=function(_0xc05e22){while(--_0xc05e22){_0x33a1c1['push'](_0x33a1c1['shift']());}};_0x34fbc6(++_0x28b6b3);}(_0x6a11,0x172));var _0x16a1=function(_0x4ff6c6,_0x2ad8d6){_0x4ff6c6=_0x4ff6c6-0x0;var _0x2711a6=_0x6a11[_0x4ff6c6];return _0x2711a6;};'use strict';var express=require(_0x16a1('0x0'));var router=express['Router']();var auth=require(_0x16a1('0x1'));var controller=require(_0x16a1('0x2'));router[_0x16a1('0x3')]('/',auth[_0x16a1('0x4')](),controller[_0x16a1('0x5')]);router[_0x16a1('0x3')](_0x16a1('0x6'),auth[_0x16a1('0x4')](),controller[_0x16a1('0x7')]);module[_0x16a1('0x8')]=router; \ No newline at end of file +var _0xa82b=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router'];(function(_0x2d628e,_0x4f0bbf){var _0x2861d9=function(_0x51d225){while(--_0x51d225){_0x2d628e['push'](_0x2d628e['shift']());}};_0x2861d9(++_0x4f0bbf);}(_0xa82b,0x86));var _0xba82=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa82b[_0x7e2eb0];return _0xd92de4;};'use strict';var express=require(_0xba82('0x0'));var router=express[_0xba82('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xba82('0x2'));router[_0xba82('0x3')]('/',auth[_0xba82('0x4')](),controller[_0xba82('0x5')]);router[_0xba82('0x3')](_0xba82('0x6'),auth[_0xba82('0x4')](),controller[_0xba82('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0212c51..c7d3ad7 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 _0xae3e=['exec','../../config/logger','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','SIGINT','systeminformation','child_process'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xae3e,0x17e));var _0xeae3=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0xae3e[_0x2dfd28];return _0x49c016;};'use strict';var info=require(_0xeae3('0x0'));var exec=require(_0xeae3('0x1'))[_0xeae3('0x2')];var logger=require(_0xeae3('0x3'))('api');var util=require('util');var BPromise=require(_0xeae3('0x4'));var _=require('lodash');function handleError(_0x5d1327,_0x1e3a15,_0xb59b48){_0x1e3a15=_0x1e3a15||0x1f4;return function(_0x28d1b5){logger[_0xeae3('0x5')](_0xeae3('0x6'),_0xb59b48,_0x1e3a15,util[_0xeae3('0x7')](_0x28d1b5,{'showHidden':![],'depth':null}));delete _0x28d1b5['name'];_0x5d1327[_0xeae3('0x8')](_0x1e3a15)[_0xeae3('0x9')](_0x28d1b5);};}exports['index']=function(_0x3978e0,_0x53e51c){return info['getAllData']()[_0xeae3('0xa')](function(_0x40dcf8){return _0x53e51c[_0xeae3('0x8')](0xc8)[_0xeae3('0xb')](_0x40dcf8);})[_0xeae3('0xc')](function(_0x12fb52){return _0x53e51c[_0xeae3('0x8')](0x1f4)[_0xeae3('0xb')](_0x12fb52);});};exports[_0xeae3('0xd')]=function(_0x185805,_0x410e41){var _0x4fc537=[_0xeae3('0xe')];return new BPromise(function(_0xc51121,_0x924ca5){return exec(util[_0xeae3('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x185805[_0xeae3('0x10')]['pid']),function(_0x3626ab,_0x158aaa,_0x2db73a){if(_0x3626ab){return _0x924ca5(_0x3626ab);}return _0xc51121(_0x158aaa);});})[_0xeae3('0xa')](function(_0x51c809){var _0x15dd41=![];var _0x3f5fc4=_0x51c809[_0xeae3('0x11')](/\n/);for(var _0x318f22=0x0,_0x37651a=_0x4fc537[_0xeae3('0x12')];_0x318f22<_0x37651a,_0x15dd41===![];_0x318f22+=0x1){if(_0x51c809[_0xeae3('0x13')](_0x4fc537[_0x318f22])>=0x0){_0x15dd41=!![];}}if(!_0x15dd41){throw new Error(util[_0xeae3('0xf')](_0xeae3('0x14'),_0x185805[_0xeae3('0x10')]['pid']));}process[_0xeae3('0x15')](_0x185805[_0xeae3('0x10')][_0xeae3('0x16')],_0xeae3('0x17'));return _0x410e41[_0xeae3('0x8')](0xc8)[_0xeae3('0xb')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x185805[_0xeae3('0x10')][_0xeae3('0x16')])});})[_0xeae3('0xc')](handleError(_0x410e41,null,_0xeae3('0xd')));}; \ No newline at end of file +var _0xe60e=['killProcess','systeminformation','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','catch','json','components/import/cm','format','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe60e,0x8d));var _0xee60=function(_0x57b563,_0x10cfcc){_0x57b563=_0x57b563-0x0;var _0x7789fe=_0xe60e[_0x57b563];return _0x7789fe;};'use strict';var info=require(_0xee60('0x0'));var exec=require('child_process')[_0xee60('0x1')];var logger=require(_0xee60('0x2'))(_0xee60('0x3'));var util=require(_0xee60('0x4'));var BPromise=require('bluebird');var _=require(_0xee60('0x5'));function handleError(_0x4e6fa1,_0x3e2308,_0x2f2794){_0x3e2308=_0x3e2308||0x1f4;return function(_0x979e52){logger[_0xee60('0x6')](_0xee60('0x7'),_0x2f2794,_0x3e2308,util[_0xee60('0x8')](_0x979e52,{'showHidden':![],'depth':null}));delete _0x979e52[_0xee60('0x9')];_0x4e6fa1['status'](_0x3e2308)[_0xee60('0xa')](_0x979e52);};}exports[_0xee60('0xb')]=function(_0x57ca3d,_0x49b76b){return info[_0xee60('0xc')]()[_0xee60('0xd')](function(_0x33f739){return _0x49b76b[_0xee60('0xe')](0xc8)['json'](_0x33f739);})[_0xee60('0xf')](function(_0x24203b){return _0x49b76b[_0xee60('0xe')](0x1f4)[_0xee60('0x10')](_0x24203b);});};exports['killProcess']=function(_0x558ec5,_0x40e4aa){var _0x5dcee6=[_0xee60('0x11')];return new BPromise(function(_0xad75b2,_0x14a474){return exec(util[_0xee60('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x558ec5[_0xee60('0x13')][_0xee60('0x14')]),function(_0x30ab3a,_0x1bb35e,_0x5cdbbd){if(_0x30ab3a){return _0x14a474(_0x30ab3a);}return _0xad75b2(_0x1bb35e);});})['then'](function(_0x2b9e4c){var _0x3bb68b=![];var _0x434e9f=_0x2b9e4c['split'](/\n/);for(var _0x2e3473=0x0,_0x40f987=_0x5dcee6[_0xee60('0x15')];_0x2e3473<_0x40f987,_0x3bb68b===![];_0x2e3473+=0x1){if(_0x2b9e4c[_0xee60('0x16')](_0x5dcee6[_0x2e3473])>=0x0){_0x3bb68b=!![];}}if(!_0x3bb68b){throw new Error(util[_0xee60('0x12')](_0xee60('0x17'),_0x558ec5[_0xee60('0x13')][_0xee60('0x14')]));}process[_0xee60('0x18')](_0x558ec5[_0xee60('0x13')][_0xee60('0x14')],_0xee60('0x19'));return _0x40e4aa[_0xee60('0xe')](0xc8)[_0xee60('0x10')]({'message':util['format'](_0xee60('0x1a'),_0x558ec5[_0xee60('0x13')][_0xee60('0x14')])});})[_0xee60('0xf')](handleError(_0x40e4aa,null,_0xee60('0x1b')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6a65e3f..9601b29 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 _0x9f62=['update','destroy','util','connect-timeout','express','Router','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post'];(function(_0x39f2f6,_0xf15c48){var _0x4b60d7=function(_0x2df545){while(--_0x2df545){_0x39f2f6['push'](_0x39f2f6['shift']());}};_0x4b60d7(++_0xf15c48);}(_0x9f62,0x154));var _0x29f6=function(_0x9dc13c,_0x1e2126){_0x9dc13c=_0x9dc13c-0x0;var _0x38ba70=_0x9f62[_0x9dc13c];return _0x38ba70;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xb')]);router['delete']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1be1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9713d4,_0x191452){var _0x1bfaa4=function(_0x2cc983){while(--_0x2cc983){_0x9713d4['push'](_0x9713d4['shift']());}};_0x1bfaa4(++_0x191452);}(_0x1be1,0x192));var _0x11be=function(_0x5752f5,_0x10fc6f){_0x5752f5=_0x5752f5-0x0;var _0x47ee97=_0x1be1[_0x5752f5];return _0x47ee97;};'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('./tag.controller');router[_0x11be('0x6')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0x8')]);router['get'](_0x11be('0x9'),auth['isAuthenticated'](),controller[_0x11be('0xa')]);router[_0x11be('0xb')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/:id',auth[_0x11be('0x7')](),controller[_0x11be('0xe')]);router['delete'](_0x11be('0x9'),auth[_0x11be('0x7')](),controller[_0x11be('0xf')]);module[_0x11be('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 17b3574..f5d2c55 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 _0xbdb7=['name','#0091EA','sequelize','exports','STRING'];(function(_0x14ef3e,_0x508efb){var _0x3b4b08=function(_0x392e6b){while(--_0x392e6b){_0x14ef3e['push'](_0x14ef3e['shift']());}};_0x3b4b08(++_0x508efb);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3710a4,_0x411b57){_0x3710a4=_0x3710a4-0x0;var _0x470675=_0xbdb7[_0x3710a4];return _0x470675;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'unique':_0x7bdb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x368696,_0x2894c3){var _0x5c8e0c=function(_0x2bec98){while(--_0x2bec98){_0x368696['push'](_0x368696['shift']());}};_0x5c8e0c(++_0x2894c3);}(_0x757a,0xde));var _0xa757=function(_0x5552e4,_0x2edb49){_0x5552e4=_0x5552e4-0x0;var _0x55e48a=_0x757a[_0x5552e4];return _0x55e48a;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa757('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 406c4b6..c6f427d 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 _0x1eb7=['params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','save','update','destroy','then','get','Tags','UserProfileResource','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show'];(function(_0x297772,_0x4bf2b4){var _0x2d017b=function(_0x2bc879){while(--_0x2bc879){_0x297772['push'](_0x297772['shift']());}};_0x2d017b(++_0x4bf2b4);}(_0x1eb7,0x14f));var _0x71eb=function(_0x59beb1,_0x8937b7){_0x59beb1=_0x59beb1-0x0;var _0x40d269=_0x1eb7[_0x59beb1];return _0x40d269;};'use strict';var pdf=require(_0x71eb('0x0'));var emlformat=require(_0x71eb('0x1'));var rimraf=require(_0x71eb('0x2'));var zipdir=require(_0x71eb('0x3'));var jsonpatch=require(_0x71eb('0x4'));var rp=require(_0x71eb('0x5'));var moment=require(_0x71eb('0x6'));var BPromise=require(_0x71eb('0x7'));var Mustache=require(_0x71eb('0x8'));var util=require(_0x71eb('0x9'));var path=require(_0x71eb('0xa'));var sox=require('sox');var csv=require(_0x71eb('0xb'));var ejs=require(_0x71eb('0xc'));var fs=require('fs');var _=require(_0x71eb('0xd'));var squel=require('squel');var crypto=require(_0x71eb('0xe'));var jsforce=require(_0x71eb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x71eb('0xb'));var querystring=require(_0x71eb('0x10'));var Papa=require('papaparse');var Redis=require(_0x71eb('0x11'));var authService=require(_0x71eb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x71eb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x71eb('0x14'));var licenseUtil=require(_0x71eb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c3421,_0x131fe6){_0x131fe6=_0x131fe6||0xcc;return function(_0x5ab344){if(_0x5ab344){return _0x4c3421[_0x71eb('0x16')](_0x131fe6);}return _0x4c3421[_0x71eb('0x17')](_0x131fe6)[_0x71eb('0x18')]();};}function respondWithResult(_0x59f46f,_0x560518){_0x560518=_0x560518||0xc8;return function(_0x14ae4c){if(_0x14ae4c){return _0x59f46f[_0x71eb('0x17')](_0x560518)[_0x71eb('0x19')](_0x14ae4c);}};}function respondWithFilteredResult(_0x4b05f9,_0x142a62){return function(_0x3890af){if(_0x3890af){var _0xe7e62d=_0x3890af['count'],_0x3c41e7=_0x142a62['offset'],_0x1dcab3=_0x142a62[_0x71eb('0x1a')]+_0x142a62[_0x71eb('0x1b')],_0x23c5d0;if(_0x1dcab3>=_0xe7e62d){_0x1dcab3=_0xe7e62d;_0x23c5d0=0xc8;}else{_0x23c5d0=0xce;}_0x4b05f9[_0x71eb('0x17')](_0x23c5d0);return _0x4b05f9[_0x71eb('0x1c')]('Content-Range',_0x3c41e7+'-'+_0x1dcab3+'/'+_0xe7e62d)['json'](_0x3890af);}return null;};}function patchUpdates(_0x98e9ed){return function(_0x589835){try{jsonpatch['apply'](_0x589835,_0x98e9ed,!![]);}catch(_0x465740){return BPromise['reject'](_0x465740);}return _0x589835[_0x71eb('0x1d')]();};}function saveUpdates(_0x612c6d,_0x1448a3){return function(_0x5aea6a){if(_0x5aea6a){return _0x5aea6a[_0x71eb('0x1e')](_0x612c6d)['then'](function(_0x53b1d4){return _0x53b1d4;});}return null;};}function removeEntity(_0x251b0c,_0x6a2bff){return function(_0x2b3c39){if(_0x2b3c39){return _0x2b3c39[_0x71eb('0x1f')]()[_0x71eb('0x20')](function(){var _0x2e43a5=_0x2b3c39[_0x71eb('0x21')]({'plain':!![]});var _0x4be407=_0x71eb('0x22');return db[_0x71eb('0x23')]['destroy']({'where':{'type':_0x4be407,'resourceId':_0x2e43a5['id']}})[_0x71eb('0x20')](function(){return _0x2b3c39;});})[_0x71eb('0x20')](function(){_0x251b0c[_0x71eb('0x17')](0xcc)[_0x71eb('0x18')]();});}};}function handleEntityNotFound(_0x282af7,_0x25dddb){return function(_0x137ad9){if(!_0x137ad9){_0x282af7[_0x71eb('0x16')](0x194);}return _0x137ad9;};}function handleError(_0x5b2ed9,_0x5bb41c){_0x5bb41c=_0x5bb41c||0x1f4;return function(_0x3a91ca){logger['error'](_0x3a91ca[_0x71eb('0x24')]);if(_0x3a91ca[_0x71eb('0x25')]){delete _0x3a91ca[_0x71eb('0x25')];}_0x5b2ed9['status'](_0x5bb41c)[_0x71eb('0x26')](_0x3a91ca);};}exports[_0x71eb('0x27')]=function(_0x285609,_0x1eadc0){var _0x4d5d38={},_0x370d89={},_0x57eb78={'count':0x0,'rows':[]};var _0x2ebc72=_[_0x71eb('0x28')](db[_0x71eb('0x29')][_0x71eb('0x2a')],function(_0x27320d){return{'name':_0x27320d[_0x71eb('0x2b')],'type':_0x27320d[_0x71eb('0x2c')][_0x71eb('0x2d')]};});_0x370d89[_0x71eb('0x2e')]=_[_0x71eb('0x28')](_0x2ebc72,_0x71eb('0x25'));_0x370d89[_0x71eb('0x2f')]=_[_0x71eb('0x30')](_0x285609[_0x71eb('0x2f')]);_0x370d89[_0x71eb('0x31')]=_[_0x71eb('0x32')](_0x370d89[_0x71eb('0x2e')],_0x370d89[_0x71eb('0x2f')]);_0x4d5d38[_0x71eb('0x33')]=_['intersection'](_0x370d89[_0x71eb('0x2e')],qs[_0x71eb('0x34')](_0x285609['query']['fields']));_0x4d5d38[_0x71eb('0x33')]=_0x4d5d38[_0x71eb('0x33')][_0x71eb('0x35')]?_0x4d5d38[_0x71eb('0x33')]:_0x370d89[_0x71eb('0x2e')];if(!_0x285609['query'][_0x71eb('0x36')](_0x71eb('0x37'))){_0x4d5d38[_0x71eb('0x1b')]=qs[_0x71eb('0x1b')](_0x285609[_0x71eb('0x2f')][_0x71eb('0x1b')]);_0x4d5d38['offset']=qs[_0x71eb('0x1a')](_0x285609[_0x71eb('0x2f')][_0x71eb('0x1a')]);}_0x4d5d38[_0x71eb('0x38')]=qs[_0x71eb('0x39')](_0x285609[_0x71eb('0x2f')][_0x71eb('0x39')]);_0x4d5d38[_0x71eb('0x3a')]=qs['filters'](_[_0x71eb('0x3b')](_0x285609['query'],_0x370d89[_0x71eb('0x31')]),_0x2ebc72);if(_0x285609[_0x71eb('0x2f')]['filter']){_0x4d5d38[_0x71eb('0x3a')]=_[_0x71eb('0x3c')](_0x4d5d38[_0x71eb('0x3a')],{'$or':_[_0x71eb('0x28')](_0x2ebc72,function(_0x41a5cc){if(_0x41a5cc[_0x71eb('0x2c')]!==_0x71eb('0x3d')){var _0x264243={};_0x264243[_0x41a5cc[_0x71eb('0x25')]]={'$like':'%'+_0x285609[_0x71eb('0x2f')][_0x71eb('0x3e')]+'%'};return _0x264243;}})});}_0x4d5d38=_[_0x71eb('0x3c')]({},_0x4d5d38,_0x285609[_0x71eb('0x3f')]);var _0x2b53d7={'where':_0x4d5d38[_0x71eb('0x3a')]};return db['Tag'][_0x71eb('0x40')](_0x2b53d7)[_0x71eb('0x20')](function(_0x30b172){_0x57eb78[_0x71eb('0x40')]=_0x30b172;if(_0x285609[_0x71eb('0x2f')][_0x71eb('0x41')]){_0x4d5d38[_0x71eb('0x42')]=[{'all':!![]}];}return db['Tag'][_0x71eb('0x43')](_0x4d5d38);})[_0x71eb('0x20')](function(_0x11e61a){_0x57eb78[_0x71eb('0x44')]=_0x11e61a;return _0x57eb78;})[_0x71eb('0x20')](respondWithFilteredResult(_0x1eadc0,_0x4d5d38))['catch'](handleError(_0x1eadc0,null));};exports[_0x71eb('0x45')]=function(_0x5cde79,_0x1ec28b){var _0x2ac5c2={'raw':!![],'where':{'id':_0x5cde79[_0x71eb('0x46')]['id']}},_0x49cbf1={};_0x49cbf1[_0x71eb('0x2e')]=_[_0x71eb('0x30')](db[_0x71eb('0x29')][_0x71eb('0x2a')]);_0x49cbf1[_0x71eb('0x2f')]=_['keys'](_0x5cde79[_0x71eb('0x2f')]);_0x49cbf1[_0x71eb('0x31')]=_['intersection'](_0x49cbf1[_0x71eb('0x2e')],_0x49cbf1[_0x71eb('0x2f')]);_0x2ac5c2['attributes']=_['intersection'](_0x49cbf1[_0x71eb('0x2e')],qs[_0x71eb('0x34')](_0x5cde79[_0x71eb('0x2f')][_0x71eb('0x34')]));_0x2ac5c2['attributes']=_0x2ac5c2[_0x71eb('0x33')][_0x71eb('0x35')]?_0x2ac5c2[_0x71eb('0x33')]:_0x49cbf1['model'];if(_0x5cde79[_0x71eb('0x2f')][_0x71eb('0x41')]){_0x2ac5c2[_0x71eb('0x42')]=[{'all':!![]}];}_0x2ac5c2=_[_0x71eb('0x3c')]({},_0x2ac5c2,_0x5cde79[_0x71eb('0x3f')]);return db['Tag']['find'](_0x2ac5c2)['then'](handleEntityNotFound(_0x1ec28b,null))['then'](respondWithResult(_0x1ec28b,null))['catch'](handleError(_0x1ec28b,null));};exports[_0x71eb('0x47')]=function(_0x422d67,_0x2991fe){return db[_0x71eb('0x29')][_0x71eb('0x47')](_0x422d67[_0x71eb('0x48')],{})['then'](function(_0x26f13e){var _0x22925a=_0x422d67[_0x71eb('0x49')]['get']({'plain':!![]});if(!_0x22925a)throw new Error(_0x71eb('0x4a'));if(_0x22925a['role']==='user'){var _0x3760fc=_0x26f13e[_0x71eb('0x21')]({'plain':!![]});var _0x4f07a5=_0x71eb('0x22');return db['UserProfileSection'][_0x71eb('0x4b')]({'where':{'name':_0x4f07a5,'userProfileId':_0x22925a[_0x71eb('0x4c')]},'raw':!![]})[_0x71eb('0x20')](function(_0x441b57){if(_0x441b57&&_0x441b57[_0x71eb('0x4d')]===0x0){return db[_0x71eb('0x23')][_0x71eb('0x47')]({'name':_0x3760fc['name'],'resourceId':_0x3760fc['id'],'type':_0x441b57[_0x71eb('0x25')],'sectionId':_0x441b57['id']},{})['then'](function(){return _0x26f13e;});}else{return _0x26f13e;}})[_0x71eb('0x4e')](function(_0x4d132c){logger[_0x71eb('0x4f')](_0x71eb('0x50'),_0x4d132c);throw _0x4d132c;});}return _0x26f13e;})['then'](respondWithResult(_0x2991fe,0xc9))[_0x71eb('0x4e')](handleError(_0x2991fe,null));};exports[_0x71eb('0x1e')]=function(_0x35c123,_0x2cf513){if(_0x35c123[_0x71eb('0x48')]['id']){delete _0x35c123[_0x71eb('0x48')]['id'];}return db[_0x71eb('0x29')][_0x71eb('0x4b')]({'where':{'id':_0x35c123[_0x71eb('0x46')]['id']}})[_0x71eb('0x20')](handleEntityNotFound(_0x2cf513,null))['then'](saveUpdates(_0x35c123[_0x71eb('0x48')],null))['then'](respondWithResult(_0x2cf513,null))[_0x71eb('0x4e')](handleError(_0x2cf513,null));};exports[_0x71eb('0x1f')]=function(_0x39257f,_0x7941d){return db[_0x71eb('0x29')][_0x71eb('0x4b')]({'where':{'id':_0x39257f[_0x71eb('0x46')]['id']}})[_0x71eb('0x20')](handleEntityNotFound(_0x7941d,null))[_0x71eb('0x20')](removeEntity(_0x7941d,null))[_0x71eb('0x4e')](handleError(_0x7941d,null));}; \ No newline at end of file +var _0xbb61=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../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','apply','reject','update','destroy','then','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','nolimit','order','sort'];(function(_0x2a4ee3,_0x596601){var _0x33f07a=function(_0x467b20){while(--_0x467b20){_0x2a4ee3['push'](_0x2a4ee3['shift']());}};_0x33f07a(++_0x596601);}(_0xbb61,0x64));var _0x1bb6=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbb61[_0x6cf19c];return _0xce14f3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1bb6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bb6('0x1'));var jsonpatch=require(_0x1bb6('0x2'));var rp=require(_0x1bb6('0x3'));var moment=require(_0x1bb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1bb6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1bb6('0x6'));var csv=require(_0x1bb6('0x7'));var ejs=require(_0x1bb6('0x8'));var fs=require('fs');var _=require(_0x1bb6('0x9'));var squel=require(_0x1bb6('0xa'));var crypto=require(_0x1bb6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1bb6('0x7'));var querystring=require(_0x1bb6('0xc'));var Papa=require(_0x1bb6('0xd'));var Redis=require(_0x1bb6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1bb6('0xf'));var as=require(_0x1bb6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bb6('0x11'))(_0x1bb6('0x12'));var utils=require(_0x1bb6('0x13'));var config=require(_0x1bb6('0x14'));var licenseUtil=require(_0x1bb6('0x15'));var db=require(_0x1bb6('0x16'))['db'];function respondWithStatusCode(_0x4bdf81,_0xc411c0){_0xc411c0=_0xc411c0||0xcc;return function(_0xb02813){if(_0xb02813){return _0x4bdf81[_0x1bb6('0x17')](_0xc411c0);}return _0x4bdf81[_0x1bb6('0x18')](_0xc411c0)[_0x1bb6('0x19')]();};}function respondWithResult(_0x42b445,_0x29db6a){_0x29db6a=_0x29db6a||0xc8;return function(_0x4279ff){if(_0x4279ff){return _0x42b445['status'](_0x29db6a)[_0x1bb6('0x1a')](_0x4279ff);}};}function respondWithFilteredResult(_0x4c54c6,_0x6fe322){return function(_0x6cde8f){if(_0x6cde8f){var _0x16ae15=_0x6cde8f[_0x1bb6('0x1b')],_0xa1bc02=_0x6fe322[_0x1bb6('0x1c')],_0x32533c=_0x6fe322[_0x1bb6('0x1c')]+_0x6fe322[_0x1bb6('0x1d')],_0x13dec2;if(_0x32533c>=_0x16ae15){_0x32533c=_0x16ae15;_0x13dec2=0xc8;}else{_0x13dec2=0xce;}_0x4c54c6[_0x1bb6('0x18')](_0x13dec2);return _0x4c54c6[_0x1bb6('0x1e')]('Content-Range',_0xa1bc02+'-'+_0x32533c+'/'+_0x16ae15)[_0x1bb6('0x1a')](_0x6cde8f);}return null;};}function patchUpdates(_0x16b517){return function(_0x101926){try{jsonpatch[_0x1bb6('0x1f')](_0x101926,_0x16b517,!![]);}catch(_0x44e2e2){return BPromise[_0x1bb6('0x20')](_0x44e2e2);}return _0x101926['save']();};}function saveUpdates(_0x541ebc,_0x351537){return function(_0x534206){if(_0x534206){return _0x534206[_0x1bb6('0x21')](_0x541ebc)['then'](function(_0x18ee6e){return _0x18ee6e;});}return null;};}function removeEntity(_0x192a96,_0xead3ff){return function(_0x20ca3f){if(_0x20ca3f){return _0x20ca3f[_0x1bb6('0x22')]()[_0x1bb6('0x23')](function(){var _0x58d467=_0x20ca3f['get']({'plain':!![]});var _0x3be623=_0x1bb6('0x24');return db[_0x1bb6('0x25')][_0x1bb6('0x22')]({'where':{'type':_0x3be623,'resourceId':_0x58d467['id']}})['then'](function(){return _0x20ca3f;});})[_0x1bb6('0x23')](function(){_0x192a96['status'](0xcc)[_0x1bb6('0x19')]();});}};}function handleEntityNotFound(_0x477ccf,_0x55b4b1){return function(_0x30b874){if(!_0x30b874){_0x477ccf[_0x1bb6('0x17')](0x194);}return _0x30b874;};}function handleError(_0x1a3760,_0x4a5a78){_0x4a5a78=_0x4a5a78||0x1f4;return function(_0xf06c0f){logger[_0x1bb6('0x26')](_0xf06c0f[_0x1bb6('0x27')]);if(_0xf06c0f[_0x1bb6('0x28')]){delete _0xf06c0f[_0x1bb6('0x28')];}_0x1a3760[_0x1bb6('0x18')](_0x4a5a78)[_0x1bb6('0x29')](_0xf06c0f);};}exports[_0x1bb6('0x2a')]=function(_0x22edf6,_0x61e87b){var _0x106d68={},_0x342023={},_0x1fe305={'count':0x0,'rows':[]};var _0x460401=_[_0x1bb6('0x2b')](db[_0x1bb6('0x2c')][_0x1bb6('0x2d')],function(_0x135b54){return{'name':_0x135b54[_0x1bb6('0x2e')],'type':_0x135b54[_0x1bb6('0x2f')][_0x1bb6('0x30')]};});_0x342023['model']=_[_0x1bb6('0x2b')](_0x460401,_0x1bb6('0x28'));_0x342023[_0x1bb6('0x31')]=_[_0x1bb6('0x32')](_0x22edf6['query']);_0x342023['filters']=_[_0x1bb6('0x33')](_0x342023[_0x1bb6('0x34')],_0x342023['query']);_0x106d68['attributes']=_[_0x1bb6('0x33')](_0x342023[_0x1bb6('0x34')],qs['fields'](_0x22edf6[_0x1bb6('0x31')][_0x1bb6('0x35')]));_0x106d68[_0x1bb6('0x36')]=_0x106d68['attributes']['length']?_0x106d68[_0x1bb6('0x36')]:_0x342023['model'];if(!_0x22edf6[_0x1bb6('0x31')]['hasOwnProperty'](_0x1bb6('0x37'))){_0x106d68[_0x1bb6('0x1d')]=qs['limit'](_0x22edf6['query'][_0x1bb6('0x1d')]);_0x106d68[_0x1bb6('0x1c')]=qs[_0x1bb6('0x1c')](_0x22edf6[_0x1bb6('0x31')][_0x1bb6('0x1c')]);}_0x106d68[_0x1bb6('0x38')]=qs[_0x1bb6('0x39')](_0x22edf6[_0x1bb6('0x31')][_0x1bb6('0x39')]);_0x106d68['where']=qs['filters'](_[_0x1bb6('0x3a')](_0x22edf6[_0x1bb6('0x31')],_0x342023['filters']),_0x460401);if(_0x22edf6[_0x1bb6('0x31')][_0x1bb6('0x3b')]){_0x106d68[_0x1bb6('0x3c')]=_[_0x1bb6('0x3d')](_0x106d68[_0x1bb6('0x3c')],{'$or':_[_0x1bb6('0x2b')](_0x460401,function(_0x592682){if(_0x592682[_0x1bb6('0x2f')]!==_0x1bb6('0x3e')){var _0x1e40d9={};_0x1e40d9[_0x592682[_0x1bb6('0x28')]]={'$like':'%'+_0x22edf6[_0x1bb6('0x31')][_0x1bb6('0x3b')]+'%'};return _0x1e40d9;}})});}_0x106d68=_[_0x1bb6('0x3d')]({},_0x106d68,_0x22edf6[_0x1bb6('0x3f')]);var _0x4771c0={'where':_0x106d68[_0x1bb6('0x3c')]};return db['Tag']['count'](_0x4771c0)[_0x1bb6('0x23')](function(_0xa783a6){_0x1fe305['count']=_0xa783a6;if(_0x22edf6[_0x1bb6('0x31')][_0x1bb6('0x40')]){_0x106d68[_0x1bb6('0x41')]=[{'all':!![]}];}return db['Tag'][_0x1bb6('0x42')](_0x106d68);})[_0x1bb6('0x23')](function(_0x3ba641){_0x1fe305[_0x1bb6('0x43')]=_0x3ba641;return _0x1fe305;})[_0x1bb6('0x23')](respondWithFilteredResult(_0x61e87b,_0x106d68))[_0x1bb6('0x44')](handleError(_0x61e87b,null));};exports['show']=function(_0x251589,_0x507252){var _0x58cb03={'raw':!![],'where':{'id':_0x251589[_0x1bb6('0x45')]['id']}},_0x1c6803={};_0x1c6803['model']=_['keys'](db['Tag'][_0x1bb6('0x2d')]);_0x1c6803[_0x1bb6('0x31')]=_[_0x1bb6('0x32')](_0x251589[_0x1bb6('0x31')]);_0x1c6803[_0x1bb6('0x46')]=_[_0x1bb6('0x33')](_0x1c6803['model'],_0x1c6803['query']);_0x58cb03[_0x1bb6('0x36')]=_[_0x1bb6('0x33')](_0x1c6803[_0x1bb6('0x34')],qs['fields'](_0x251589[_0x1bb6('0x31')][_0x1bb6('0x35')]));_0x58cb03[_0x1bb6('0x36')]=_0x58cb03[_0x1bb6('0x36')][_0x1bb6('0x47')]?_0x58cb03[_0x1bb6('0x36')]:_0x1c6803[_0x1bb6('0x34')];if(_0x251589[_0x1bb6('0x31')][_0x1bb6('0x40')]){_0x58cb03[_0x1bb6('0x41')]=[{'all':!![]}];}_0x58cb03=_['merge']({},_0x58cb03,_0x251589[_0x1bb6('0x3f')]);return db[_0x1bb6('0x2c')][_0x1bb6('0x48')](_0x58cb03)[_0x1bb6('0x23')](handleEntityNotFound(_0x507252,null))[_0x1bb6('0x23')](respondWithResult(_0x507252,null))[_0x1bb6('0x44')](handleError(_0x507252,null));};exports[_0x1bb6('0x49')]=function(_0x3d347b,_0x43c825){return db[_0x1bb6('0x2c')][_0x1bb6('0x49')](_0x3d347b[_0x1bb6('0x4a')],{})[_0x1bb6('0x23')](function(_0x5e66e8){var _0x101245=_0x3d347b[_0x1bb6('0x4b')]['get']({'plain':!![]});if(!_0x101245)throw new Error(_0x1bb6('0x4c'));if(_0x101245[_0x1bb6('0x4d')]===_0x1bb6('0x4b')){var _0x1a73ca=_0x5e66e8['get']({'plain':!![]});var _0x3dc313=_0x1bb6('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x3dc313,'userProfileId':_0x101245[_0x1bb6('0x4e')]},'raw':!![]})[_0x1bb6('0x23')](function(_0x5b9a40){if(_0x5b9a40&&_0x5b9a40['autoAssociation']===0x0){return db[_0x1bb6('0x25')][_0x1bb6('0x49')]({'name':_0x1a73ca[_0x1bb6('0x28')],'resourceId':_0x1a73ca['id'],'type':_0x5b9a40['name'],'sectionId':_0x5b9a40['id']},{})[_0x1bb6('0x23')](function(){return _0x5e66e8;});}else{return _0x5e66e8;}})[_0x1bb6('0x44')](function(_0x5d19d9){logger[_0x1bb6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d19d9);throw _0x5d19d9;});}return _0x5e66e8;})[_0x1bb6('0x23')](respondWithResult(_0x43c825,0xc9))[_0x1bb6('0x44')](handleError(_0x43c825,null));};exports[_0x1bb6('0x21')]=function(_0x28826a,_0x5e7321){if(_0x28826a['body']['id']){delete _0x28826a['body']['id'];}return db[_0x1bb6('0x2c')][_0x1bb6('0x48')]({'where':{'id':_0x28826a[_0x1bb6('0x45')]['id']}})[_0x1bb6('0x23')](handleEntityNotFound(_0x5e7321,null))[_0x1bb6('0x23')](saveUpdates(_0x28826a[_0x1bb6('0x4a')],null))[_0x1bb6('0x23')](respondWithResult(_0x5e7321,null))['catch'](handleError(_0x5e7321,null));};exports[_0x1bb6('0x22')]=function(_0x2ff99c,_0x232d14){return db[_0x1bb6('0x2c')][_0x1bb6('0x48')]({'where':{'id':_0x2ff99c[_0x1bb6('0x45')]['id']}})[_0x1bb6('0x23')](handleEntityNotFound(_0x232d14,null))[_0x1bb6('0x23')](removeEntity(_0x232d14,null))[_0x1bb6('0x44')](handleError(_0x232d14,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 463e9c2..ba008bb 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 _0x13ef=['define','Tag','lodash','util','../../config/logger','api','path','../../config/environment','./tag.attributes','exports'];(function(_0x5398c6,_0x4c56c7){var _0x2e0b78=function(_0x2dd220){while(--_0x2dd220){_0x5398c6['push'](_0x5398c6['shift']());}};_0x2e0b78(++_0x4c56c7);}(_0x13ef,0x19c));var _0xf13e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x13ef[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0xf13e('0x0'));var util=require(_0xf13e('0x1'));var logger=require(_0xf13e('0x2'))(_0xf13e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf13e('0x4'));var rimraf=require('rimraf');var config=require(_0xf13e('0x5'));var attributes=require(_0xf13e('0x6'));module[_0xf13e('0x7')]=function(_0x5223c7,_0x897e34){return _0x5223c7[_0xf13e('0x8')](_0xf13e('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b68=['tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Tag'];(function(_0x4eb9ae,_0x5eaac4){var _0x54c234=function(_0x1dfb08){while(--_0x1dfb08){_0x4eb9ae['push'](_0x4eb9ae['shift']());}};_0x54c234(++_0x5eaac4);}(_0x3b68,0x1bd));var _0x83b6=function(_0x37cdec,_0x5aa47e){_0x37cdec=_0x37cdec-0x0;var _0x3b0427=_0x3b68[_0x37cdec];return _0x3b0427;};'use strict';var _=require('lodash');var util=require(_0x83b6('0x0'));var logger=require(_0x83b6('0x1'))(_0x83b6('0x2'));var moment=require(_0x83b6('0x3'));var BPromise=require(_0x83b6('0x4'));var rp=require(_0x83b6('0x5'));var fs=require('fs');var path=require(_0x83b6('0x6'));var rimraf=require(_0x83b6('0x7'));var config=require(_0x83b6('0x8'));var attributes=require('./tag.attributes');module[_0x83b6('0x9')]=function(_0x1b43b7,_0x1438d9){return _0x1b43b7['define'](_0x83b6('0xa'),attributes,{'tableName':_0x83b6('0xb'),'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 e023b1e..b4ac80e 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 _0x9b9b=['http','request','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xe9280c,_0x1f79ba){var _0x3e77a1=function(_0x5665e7){while(--_0x5665e7){_0xe9280c['push'](_0xe9280c['shift']());}};_0x3e77a1(++_0x1f79ba);}(_0x9b9b,0x114));var _0xb9b9=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0x9b9b[_0xc753c8];return _0xd02f5c;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9b9('0x1'));var fs=require('fs');var Redis=require(_0xb9b9('0x2'));var db=require(_0xb9b9('0x3'))['db'];var utils=require(_0xb9b9('0x4'));var logger=require(_0xb9b9('0x5'))(_0xb9b9('0x6'));var config=require(_0xb9b9('0x7'));var jayson=require(_0xb9b9('0x8'));var client=jayson[_0xb9b9('0x9')][_0xb9b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x85eec,_0x3ef9c1,_0x5be5bc){return new BPromise(function(_0x297cb6,_0x222cba){return client[_0xb9b9('0xb')](_0x85eec,_0x5be5bc)['then'](function(_0x4a645a){logger[_0xb9b9('0xc')](_0xb9b9('0xd'),_0x3ef9c1,_0xb9b9('0xe'));logger['debug'](_0xb9b9('0xf'),_0x3ef9c1,_0xb9b9('0xe'),JSON[_0xb9b9('0x10')](_0x4a645a));if(_0x4a645a['error']){if(_0x4a645a[_0xb9b9('0x11')][_0xb9b9('0x12')]===0x1f4){logger[_0xb9b9('0x11')](_0xb9b9('0xd'),_0x3ef9c1,_0x4a645a[_0xb9b9('0x11')][_0xb9b9('0x13')]);return _0x222cba(_0x4a645a['error']['message']);}logger[_0xb9b9('0x11')]('Tag,\x20%s,\x20%s',_0x3ef9c1,_0x4a645a[_0xb9b9('0x11')]['message']);return _0x297cb6(_0x4a645a[_0xb9b9('0x11')][_0xb9b9('0x13')]);}else{logger[_0xb9b9('0xc')](_0xb9b9('0xd'),_0x3ef9c1,_0xb9b9('0xe'));_0x297cb6(_0x4a645a[_0xb9b9('0x14')][_0xb9b9('0x13')]);}})[_0xb9b9('0x15')](function(_0x4ae8e6){logger[_0xb9b9('0x11')]('Tag,\x20%s,\x20%s',_0x3ef9c1,_0x4ae8e6);_0x222cba(_0x4ae8e6);});});} \ No newline at end of file +var _0x70e0=['code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x10d7df,_0x982d28){var _0x560370=function(_0x5a7424){while(--_0x5a7424){_0x10d7df['push'](_0x10d7df['shift']());}};_0x560370(++_0x982d28);}(_0x70e0,0x17b));var _0x070e=function(_0x484890,_0x569912){_0x484890=_0x484890-0x0;var _0x510198=_0x70e0[_0x484890];return _0x510198;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Tag,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Tag,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9e3bc37..1ab141c 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 _0x31c2=['addAgents','put','update','destroy','removeQueues','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','isAuthenticated','index','get','/:id','/:id/queues','getQueues','/:id/users','getAgents','create','post','addQueues'];(function(_0xeea892,_0x3c45a9){var _0x8bfe7d=function(_0x4557fe){while(--_0x4557fe){_0xeea892['push'](_0xeea892['shift']());}};_0x8bfe7d(++_0x3c45a9);}(_0x31c2,0x13b));var _0x231c=function(_0x3400b2,_0x35fb8e){_0x3400b2=_0x3400b2-0x0;var _0x59f6c7=_0x31c2[_0x3400b2];return _0x59f6c7;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var auth=require(_0x231c('0x6'));var interaction=require(_0x231c('0x7'));var config=require(_0x231c('0x8'));var controller=require(_0x231c('0x9'));router['get']('/',auth[_0x231c('0xa')](),controller[_0x231c('0xb')]);router[_0x231c('0xc')](_0x231c('0xd'),auth[_0x231c('0xa')](),controller['show']);router[_0x231c('0xc')](_0x231c('0xe'),auth[_0x231c('0xa')](),controller[_0x231c('0xf')]);router[_0x231c('0xc')](_0x231c('0x10'),auth[_0x231c('0xa')](),controller[_0x231c('0x11')]);router['post']('/',auth[_0x231c('0xa')](),controller[_0x231c('0x12')]);router[_0x231c('0x13')](_0x231c('0xe'),auth[_0x231c('0xa')](),controller[_0x231c('0x14')]);router[_0x231c('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x231c('0x15')]);router[_0x231c('0x16')](_0x231c('0xd'),auth[_0x231c('0xa')](),controller[_0x231c('0x17')]);router['delete']('/:id',auth[_0x231c('0xa')](),controller[_0x231c('0x18')]);router['delete'](_0x231c('0xe'),auth[_0x231c('0xa')](),controller[_0x231c('0x19')]);router[_0x231c('0x1a')](_0x231c('0x10'),auth[_0x231c('0xa')](),controller['removeAgents']);module[_0x231c('0x1b')]=router; \ No newline at end of file +var _0x745e=['delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id/users','getAgents','post','/:id/queues','addQueues','put','/:id'];(function(_0x33007f,_0x4b38d2){var _0x10d38c=function(_0x497992){while(--_0x497992){_0x33007f['push'](_0x33007f['shift']());}};_0x10d38c(++_0x4b38d2);}(_0x745e,0xcd));var _0xe745=function(_0x3216f5,_0xe32e8a){_0x3216f5=_0x3216f5-0x0;var _0x17035a=_0x745e[_0x3216f5];return _0x17035a;};'use strict';var multer=require(_0xe745('0x0'));var util=require(_0xe745('0x1'));var path=require(_0xe745('0x2'));var timeout=require(_0xe745('0x3'));var express=require(_0xe745('0x4'));var router=express[_0xe745('0x5')]();var auth=require(_0xe745('0x6'));var interaction=require(_0xe745('0x7'));var config=require(_0xe745('0x8'));var controller=require(_0xe745('0x9'));router[_0xe745('0xa')]('/',auth[_0xe745('0xb')](),controller[_0xe745('0xc')]);router['get']('/:id',auth[_0xe745('0xb')](),controller['show']);router[_0xe745('0xa')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router['get'](_0xe745('0xd'),auth[_0xe745('0xb')](),controller[_0xe745('0xe')]);router[_0xe745('0xf')]('/',auth[_0xe745('0xb')](),controller['create']);router[_0xe745('0xf')](_0xe745('0x10'),auth[_0xe745('0xb')](),controller[_0xe745('0x11')]);router[_0xe745('0xf')](_0xe745('0xd'),auth[_0xe745('0xb')](),controller['addAgents']);router[_0xe745('0x12')](_0xe745('0x13'),auth[_0xe745('0xb')](),controller['update']);router[_0xe745('0x14')](_0xe745('0x13'),auth[_0xe745('0xb')](),controller[_0xe745('0x15')]);router[_0xe745('0x14')](_0xe745('0x10'),auth[_0xe745('0xb')](),controller[_0xe745('0x16')]);router[_0xe745('0x14')](_0xe745('0xd'),auth[_0xe745('0xb')](),controller[_0xe745('0x17')]);module[_0xe745('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index e0b3b48..abb6ad1 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 _0x2de5=['name','exports'];(function(_0x969ea2,_0x15c378){var _0x381330=function(_0x160e40){while(--_0x160e40){_0x969ea2['push'](_0x969ea2['shift']());}};_0x381330(++_0x15c378);}(_0x2de5,0x77));var _0x52de=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x2de5[_0x560448];return _0x550276;};'use strict';var Sequelize=require('sequelize');module[_0x52de('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x52de('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6dda=['sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6dda,0xd2));var _0xa6dd=function(_0x16d5bb,_0x1fc01e){_0x16d5bb=_0x16d5bb-0x0;var _0x36cb24=_0x6dda[_0x16d5bb];return _0x36cb24;};'use strict';var Sequelize=require(_0xa6dd('0x0'));module[_0xa6dd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa6dd('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index d8ab436..a2aadc0 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 _0x5448=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','then','get','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','filter','merge','options','includeAll','include','Team','findAll','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','pick','Queues','Sequelize','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','voicePause','spread','chat','fax','openchannel','whatsapp','removeAgents','emit','userTeam:remove','getAgents','html-pdf','eml-format','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x325b08,_0xd3fe6d){var _0x3cf588=function(_0x19e0e2){while(--_0x19e0e2){_0x325b08['push'](_0x325b08['shift']());}};_0x3cf588(++_0xd3fe6d);}(_0x5448,0x6d));var _0x8544=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x5448[_0x4b2863];return _0x567d67;};'use strict';var pdf=require(_0x8544('0x0'));var emlformat=require(_0x8544('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8544('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8544('0x3'));var path=require(_0x8544('0x4'));var sox=require(_0x8544('0x5'));var csv=require(_0x8544('0x6'));var ejs=require(_0x8544('0x7'));var fs=require('fs');var _=require(_0x8544('0x8'));var squel=require(_0x8544('0x9'));var crypto=require(_0x8544('0xa'));var jsforce=require(_0x8544('0xb'));var deskjs=require(_0x8544('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8544('0xd'));var Papa=require('papaparse');var Redis=require(_0x8544('0xe'));var authService=require(_0x8544('0xf'));var qs=require(_0x8544('0x10'));var as=require(_0x8544('0x11'));var hardwareService=require(_0x8544('0x12'));var logger=require(_0x8544('0x13'))(_0x8544('0x14'));var utils=require(_0x8544('0x15'));var config=require(_0x8544('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8544('0x17'))['db'];config[_0x8544('0x18')]=_['defaults'](config[_0x8544('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8544('0x19'))(new Redis(config[_0x8544('0x18')]));require('./team.socket')[_0x8544('0x1a')](socket);function respondWithStatusCode(_0x4dd19a,_0xe1ee82){_0xe1ee82=_0xe1ee82||0xcc;return function(_0x22d1ae){if(_0x22d1ae){return _0x4dd19a[_0x8544('0x1b')](_0xe1ee82);}return _0x4dd19a['status'](_0xe1ee82)[_0x8544('0x1c')]();};}function respondWithResult(_0x36abba,_0x4c51b6){_0x4c51b6=_0x4c51b6||0xc8;return function(_0x1bee9a){if(_0x1bee9a){return _0x36abba['status'](_0x4c51b6)[_0x8544('0x1d')](_0x1bee9a);}};}function respondWithFilteredResult(_0x517a5a,_0x5a8b6d){return function(_0x2732eb){if(_0x2732eb){var _0x11dfd9=_0x2732eb[_0x8544('0x1e')],_0x276041=_0x5a8b6d[_0x8544('0x1f')],_0x47732b=_0x5a8b6d[_0x8544('0x1f')]+_0x5a8b6d[_0x8544('0x20')],_0x3ca437;if(_0x47732b>=_0x11dfd9){_0x47732b=_0x11dfd9;_0x3ca437=0xc8;}else{_0x3ca437=0xce;}_0x517a5a[_0x8544('0x21')](_0x3ca437);return _0x517a5a[_0x8544('0x22')](_0x8544('0x23'),_0x276041+'-'+_0x47732b+'/'+_0x11dfd9)[_0x8544('0x1d')](_0x2732eb);}return null;};}function patchUpdates(_0x25b288){return function(_0x3e2ffb){try{jsonpatch[_0x8544('0x24')](_0x3e2ffb,_0x25b288,!![]);}catch(_0x10fadb){return BPromise['reject'](_0x10fadb);}return _0x3e2ffb[_0x8544('0x25')]();};}function saveUpdates(_0x183198,_0x16f007){return function(_0x1f7777){if(_0x1f7777){return _0x1f7777[_0x8544('0x26')](_0x183198)['then'](function(_0x2d30ba){return _0x2d30ba;});}return null;};}function removeEntity(_0x27e523,_0x56019d){return function(_0x247fec){if(_0x247fec){return _0x247fec[_0x8544('0x27')]()[_0x8544('0x28')](function(){var _0x4128c3=_0x247fec[_0x8544('0x29')]({'plain':!![]});var _0x9b7cbd='Teams';return db['UserProfileResource'][_0x8544('0x27')]({'where':{'type':_0x9b7cbd,'resourceId':_0x4128c3['id']}})[_0x8544('0x28')](function(){return _0x247fec;});})[_0x8544('0x28')](function(){_0x27e523[_0x8544('0x21')](0xcc)[_0x8544('0x1c')]();});}};}function handleEntityNotFound(_0x39ab7f,_0x3ef1ab){return function(_0x1dd11e){if(!_0x1dd11e){_0x39ab7f['sendStatus'](0x194);}return _0x1dd11e;};}function handleError(_0x2a7442,_0x4aea1f){_0x4aea1f=_0x4aea1f||0x1f4;return function(_0x46658e){logger['error'](_0x46658e[_0x8544('0x2a')]);if(_0x46658e['name']){delete _0x46658e[_0x8544('0x2b')];}_0x2a7442[_0x8544('0x21')](_0x4aea1f)['send'](_0x46658e);};}exports[_0x8544('0x2c')]=function(_0x447ade,_0x35f64b){var _0x280e8e={},_0x1f930d={},_0x7ea21b={'count':0x0,'rows':[]};var _0x44a3af=_[_0x8544('0x2d')](db['Team'][_0x8544('0x2e')],function(_0x4cb5b1){return{'name':_0x4cb5b1[_0x8544('0x2f')],'type':_0x4cb5b1[_0x8544('0x30')][_0x8544('0x31')]};});_0x1f930d[_0x8544('0x32')]=_[_0x8544('0x2d')](_0x44a3af,_0x8544('0x2b'));_0x1f930d[_0x8544('0x33')]=_[_0x8544('0x34')](_0x447ade['query']);_0x1f930d['filters']=_[_0x8544('0x35')](_0x1f930d[_0x8544('0x32')],_0x1f930d[_0x8544('0x33')]);_0x280e8e[_0x8544('0x36')]=_[_0x8544('0x35')](_0x1f930d[_0x8544('0x32')],qs[_0x8544('0x37')](_0x447ade[_0x8544('0x33')][_0x8544('0x37')]));_0x280e8e[_0x8544('0x36')]=_0x280e8e[_0x8544('0x36')][_0x8544('0x38')]?_0x280e8e[_0x8544('0x36')]:_0x1f930d[_0x8544('0x32')];if(!_0x447ade[_0x8544('0x33')][_0x8544('0x39')]('nolimit')){_0x280e8e['limit']=qs[_0x8544('0x20')](_0x447ade[_0x8544('0x33')]['limit']);_0x280e8e[_0x8544('0x1f')]=qs['offset'](_0x447ade[_0x8544('0x33')][_0x8544('0x1f')]);}_0x280e8e[_0x8544('0x3a')]=qs['sort'](_0x447ade['query']['sort']);_0x280e8e[_0x8544('0x3b')]=qs[_0x8544('0x3c')](_['pick'](_0x447ade[_0x8544('0x33')],_0x1f930d['filters']),_0x44a3af);if(_0x447ade[_0x8544('0x33')][_0x8544('0x3d')]){_0x280e8e[_0x8544('0x3b')]=_[_0x8544('0x3e')](_0x280e8e['where'],{'$or':_['map'](_0x44a3af,function(_0x5b7566){if(_0x5b7566['type']!=='VIRTUAL'){var _0x37c123={};_0x37c123[_0x5b7566[_0x8544('0x2b')]]={'$like':'%'+_0x447ade[_0x8544('0x33')][_0x8544('0x3d')]+'%'};return _0x37c123;}})});}_0x280e8e=_['merge']({},_0x280e8e,_0x447ade[_0x8544('0x3f')]);var _0x52dd6a={'where':_0x280e8e[_0x8544('0x3b')]};return db['Team'][_0x8544('0x1e')](_0x52dd6a)['then'](function(_0x39a380){_0x7ea21b[_0x8544('0x1e')]=_0x39a380;if(_0x447ade['query'][_0x8544('0x40')]){_0x280e8e[_0x8544('0x41')]=[{'all':!![]}];}return db[_0x8544('0x42')][_0x8544('0x43')](_0x280e8e);})[_0x8544('0x28')](function(_0xf395c6){_0x7ea21b['rows']=_0xf395c6;return _0x7ea21b;})[_0x8544('0x28')](respondWithFilteredResult(_0x35f64b,_0x280e8e))[_0x8544('0x44')](handleError(_0x35f64b,null));};exports[_0x8544('0x45')]=function(_0x407741,_0x20ed88){var _0x20f89d={'raw':![],'where':{'id':_0x407741[_0x8544('0x46')]['id']}},_0x52536e={};_0x52536e[_0x8544('0x32')]=_[_0x8544('0x34')](db[_0x8544('0x42')][_0x8544('0x2e')]);_0x52536e['query']=_[_0x8544('0x34')](_0x407741['query']);_0x52536e[_0x8544('0x3c')]=_['intersection'](_0x52536e[_0x8544('0x32')],_0x52536e[_0x8544('0x33')]);_0x20f89d['attributes']=_[_0x8544('0x35')](_0x52536e[_0x8544('0x32')],qs[_0x8544('0x37')](_0x407741[_0x8544('0x33')][_0x8544('0x37')]));_0x20f89d['attributes']=_0x20f89d[_0x8544('0x36')][_0x8544('0x38')]?_0x20f89d[_0x8544('0x36')]:_0x52536e[_0x8544('0x32')];if(_0x407741['query']['includeAll']){_0x20f89d[_0x8544('0x41')]=[{'all':!![]}];}_0x20f89d=_['merge']({},_0x20f89d,_0x407741[_0x8544('0x3f')]);return db[_0x8544('0x42')][_0x8544('0x47')](_0x20f89d)['then'](handleEntityNotFound(_0x20ed88,null))['then'](respondWithResult(_0x20ed88,null))['catch'](handleError(_0x20ed88,null));};exports[_0x8544('0x48')]=function(_0xc60707,_0x5ea3ae){return db[_0x8544('0x42')]['create'](_0xc60707['body'],{})['then'](function(_0x5a9678){var _0x5534c5=_0xc60707['user']['get']({'plain':!![]});if(!_0x5534c5)throw new Error(_0x8544('0x49'));if(_0x5534c5[_0x8544('0x4a')]==='user'){var _0x58503d=_0x5a9678[_0x8544('0x29')]({'plain':!![]});var _0x353dea=_0x8544('0x4b');return db[_0x8544('0x4c')][_0x8544('0x47')]({'where':{'name':_0x353dea,'userProfileId':_0x5534c5['userProfileId']},'raw':!![]})[_0x8544('0x28')](function(_0x345d29){if(_0x345d29&&_0x345d29[_0x8544('0x4d')]===0x0){return db[_0x8544('0x4e')][_0x8544('0x48')]({'name':_0x58503d[_0x8544('0x2b')],'resourceId':_0x58503d['id'],'type':_0x345d29['name'],'sectionId':_0x345d29['id']},{})[_0x8544('0x28')](function(){return _0x5a9678;});}else{return _0x5a9678;}})['catch'](function(_0x33b0a3){logger[_0x8544('0x4f')](_0x8544('0x50'),_0x33b0a3);throw _0x33b0a3;});}return _0x5a9678;})[_0x8544('0x28')](respondWithResult(_0x5ea3ae,0xc9))[_0x8544('0x44')](handleError(_0x5ea3ae,null));};exports[_0x8544('0x26')]=function(_0xb535ab,_0x56a679){if(_0xb535ab['body']['id']){delete _0xb535ab[_0x8544('0x51')]['id'];}return db[_0x8544('0x42')]['find']({'where':{'id':_0xb535ab[_0x8544('0x46')]['id']}})[_0x8544('0x28')](handleEntityNotFound(_0x56a679,null))[_0x8544('0x28')](saveUpdates(_0xb535ab[_0x8544('0x51')],null))[_0x8544('0x28')](respondWithResult(_0x56a679,null))[_0x8544('0x44')](handleError(_0x56a679,null));};exports[_0x8544('0x27')]=function(_0x1c5be3,_0x2516d8){return db[_0x8544('0x42')]['find']({'where':{'id':_0x1c5be3[_0x8544('0x46')]['id']}})['then'](handleEntityNotFound(_0x2516d8,null))[_0x8544('0x28')](removeEntity(_0x2516d8,null))[_0x8544('0x44')](handleError(_0x2516d8,null));};exports[_0x8544('0x52')]=function(_0x5f56cb,_0x16f865,_0x3b8619){return db['Team'][_0x8544('0x53')]({'where':{'id':_0x5f56cb['params']['id']}})[_0x8544('0x28')](handleEntityNotFound(_0x16f865,null))[_0x8544('0x28')](function(_0x51d548){if(!_0x5f56cb[_0x8544('0x33')][_0x8544('0x54')]||!utils[_0x8544('0x55')](_0x5f56cb[_0x8544('0x33')][_0x8544('0x54')])){throw new db['Sequelize'][(_0x8544('0x56'))](_0x8544('0x57'));}var _0x2483f7={};var _0x2db01d={};_0x2db01d['model']=_['keys'](db[_[_0x8544('0x58')](_0x5f56cb['query']['channel'][_0x8544('0x59')]())+_0x8544('0x5a')][_0x8544('0x2e')]);_0x2db01d[_0x8544('0x33')]=_['keys'](_0x5f56cb['query']);_0x2db01d['filters']=_['intersection'](_0x2db01d[_0x8544('0x32')],_0x2db01d[_0x8544('0x33')]);_0x2483f7[_0x8544('0x36')]=_['intersection'](_0x2db01d['model'],qs[_0x8544('0x37')](_0x5f56cb[_0x8544('0x33')][_0x8544('0x37')]));_0x2483f7[_0x8544('0x36')]=_0x2483f7['attributes'][_0x8544('0x38')]?_0x2483f7['attributes']:_0x2db01d[_0x8544('0x32')];_0x2483f7[_0x8544('0x20')]=qs['limit'](_0x5f56cb['query'][_0x8544('0x20')]);_0x2483f7[_0x8544('0x1f')]=qs[_0x8544('0x1f')](_0x5f56cb['query'][_0x8544('0x1f')]);_0x2483f7[_0x8544('0x3a')]=qs[_0x8544('0x5b')](_0x5f56cb[_0x8544('0x33')][_0x8544('0x5b')]);_0x2483f7[_0x8544('0x3b')]=qs[_0x8544('0x3c')](_[_0x8544('0x5c')](_0x5f56cb[_0x8544('0x33')],_0x2db01d['filters']));_0x2483f7=_[_0x8544('0x3e')]({},_0x2483f7,_0x5f56cb[_0x8544('0x3f')]);return _0x51d548[_0x8544('0x29')+_[_0x8544('0x58')](_0x5f56cb[_0x8544('0x33')][_0x8544('0x54')]['toLowerCase']())+_0x8544('0x5d')](_0x2483f7);})[_0x8544('0x28')](respondWithResult(_0x16f865,null))[_0x8544('0x44')](handleError(_0x16f865,null));};exports['addQueues']=function(_0x1073fa,_0x3f06f6,_0x4b3fca){return db[_0x8544('0x42')][_0x8544('0x53')]({'where':{'id':_0x1073fa[_0x8544('0x46')]['id']}})[_0x8544('0x28')](function(_0x1c539e){if(_0x1c539e){if(!_0x1073fa[_0x8544('0x51')][_0x8544('0x54')]||!utils[_0x8544('0x55')](_0x1073fa[_0x8544('0x51')]['channel'])){throw new db[(_0x8544('0x5e'))][(_0x8544('0x56'))]('Unknown\x20channel');}return _0x1c539e[_0x8544('0x5f')+_['capitalize'](_0x1073fa[_0x8544('0x51')][_0x8544('0x54')][_0x8544('0x59')]())+_0x8544('0x5d')](_0x1073fa[_0x8544('0x51')][_0x8544('0x60')]);}return null;})['then'](handleEntityNotFound(_0x3f06f6,null))[_0x8544('0x28')](respondWithStatusCode(_0x3f06f6,null))[_0x8544('0x44')](handleError(_0x3f06f6,null));};exports[_0x8544('0x61')]=function(_0x270d7d,_0x1e84f5,_0x5b9a44){return db[_0x8544('0x42')][_0x8544('0x53')]({'where':{'id':_0x270d7d['params']['id']}})['then'](function(_0x200275){if(_0x200275){if(!_0x270d7d['query'][_0x8544('0x54')]||!utils['isValidChannel'](_0x270d7d['query'][_0x8544('0x54')])){throw new db[(_0x8544('0x5e'))][(_0x8544('0x56'))](_0x8544('0x57'));}return _0x200275[_0x8544('0x62')+_['capitalize'](_0x270d7d[_0x8544('0x33')][_0x8544('0x54')][_0x8544('0x59')]())+_0x8544('0x5d')](_0x270d7d[_0x8544('0x33')]['ids']);}return null;})[_0x8544('0x28')](handleEntityNotFound(_0x1e84f5,null))[_0x8544('0x28')](respondWithStatusCode(_0x1e84f5,null))['catch'](handleError(_0x1e84f5,null));};exports[_0x8544('0x63')]=function(_0x56ff96,_0x585abb,_0x4822b0){return db[_0x8544('0x42')][_0x8544('0x47')]({'where':{'id':_0x56ff96[_0x8544('0x46')]['id']}})['then'](handleEntityNotFound(_0x585abb,null))[_0x8544('0x28')](function(_0x2f1220){if(_0x2f1220){var _0x273809=[_0x8544('0x64'),_0x8544('0x65'),_0x8544('0x66'),_0x8544('0x67'),_0x8544('0x68'),_0x8544('0x69'),_0x8544('0x6a')];return BPromise[_0x8544('0x6b')](_0x273809,function(_0x4cc420){return _0x2f1220['get'+_0x4cc420+'Queues']({'attributes':['id',_0x8544('0x2b')]})[_0x8544('0x28')](function(_0x2b1af8){return BPromise[_0x8544('0x6b')](_0x2b1af8,function(_0x1b10dc){return _0x1b10dc[_0x8544('0x63')](_0x56ff96[_0x8544('0x51')][_0x8544('0x60')])[_0x8544('0x28')](function(){if(_0x4cc420===_0x8544('0x64')){return db[_0x8544('0x6c')][_0x8544('0x43')]({'where':{'id':_0x56ff96[_0x8544('0x51')]['ids']},'attributes':['id',_0x8544('0x2b'),_0x8544('0x6d'),'voicePause',_0x8544('0x6e')],'raw':!![]})[_0x8544('0x28')](function(_0x2a9bc8){return BPromise[_0x8544('0x6b')](_['filter'](_0x2a9bc8,{'online':0x1}),function(_0x319f6b){return db[_0x8544('0x6f')][_0x8544('0x70')]({'membername':_0x319f6b['name'],'UserId':_0x319f6b['id'],'queue_name':_0x1b10dc[_0x8544('0x2b')],'VoiceQueueId':_0x1b10dc['id'],'interface':_[_0x8544('0x71')](_0x319f6b['interface'])?util['format'](_0x8544('0x72'),_0x319f6b[_0x8544('0x2b')]):_0x319f6b[_0x8544('0x6e')],'paused':_0x319f6b[_0x8544('0x73')]||![],'penalty':0x0});});});}});});})[_0x8544('0x28')](function(){return _0x2f1220;});})[_0x8544('0x28')](function(){return _0x2f1220;});}})[_0x8544('0x28')](function(_0x4b8013){if(_0x4b8013){return _0x4b8013[_0x8544('0x63')](_0x56ff96[_0x8544('0x51')]['ids'],_['omit'](_0x56ff96[_0x8544('0x51')],['ids','id'])||{})[_0x8544('0x74')](function(_0x449423){for(var _0x354b4e=0x0;_0x354b4e<_0x56ff96[_0x8544('0x51')]['ids'][_0x8544('0x38')];_0x354b4e+=0x1){socket['emit']('userTeam:save',{'UserId':_0x56ff96[_0x8544('0x51')][_0x8544('0x60')][_0x354b4e],'TeamId':_0x56ff96['params']['id']});}return _0x449423;});}})[_0x8544('0x28')](respondWithResult(_0x585abb,null))[_0x8544('0x44')](handleError(_0x585abb,null));};exports['removeAgents']=function(_0x530ccb,_0x161ba0,_0x50e220){return db[_0x8544('0x42')]['find']({'where':{'id':_0x530ccb[_0x8544('0x46')]['id']}})[_0x8544('0x28')](handleEntityNotFound(_0x161ba0,null))['then'](function(_0x1ec868){if(_0x1ec868){return BPromise[_0x8544('0x6b')](['voice',_0x8544('0x75'),'mail','sms',_0x8544('0x76'),_0x8544('0x77'),_0x8544('0x78')],function(_0x509fa0){return _0x1ec868[_0x8544('0x29')+_[_0x8544('0x58')](_0x509fa0)+_0x8544('0x5d')]({'attributes':['id',_0x8544('0x2b')]})[_0x8544('0x28')](function(_0x5c8387){return BPromise[_0x8544('0x6b')](_0x5c8387,function(_0x4e4082){return _0x4e4082[_0x8544('0x79')](_0x530ccb[_0x8544('0x33')][_0x8544('0x60')])['then'](function(){if(_0x509fa0==='voice'){return db[_0x8544('0x6f')][_0x8544('0x27')]({'where':{'VoiceQueueId':_0x4e4082['id'],'UserId':_0x530ccb[_0x8544('0x33')][_0x8544('0x60')]}});}});});})[_0x8544('0x28')](function(){return _0x1ec868;});})[_0x8544('0x28')](function(){return _0x1ec868;});}})[_0x8544('0x28')](function(_0x1e72e0){if(_0x1e72e0){return _0x1e72e0[_0x8544('0x79')](_0x530ccb['query'][_0x8544('0x60')])[_0x8544('0x28')](function(){if(_['isArray'](_0x530ccb['query'][_0x8544('0x60')])){for(var _0x4f7994=0x0;_0x4f7994<_0x530ccb[_0x8544('0x33')][_0x8544('0x60')][_0x8544('0x38')];_0x4f7994+=0x1){socket[_0x8544('0x7a')](_0x8544('0x7b'),{'UserId':Number(_0x530ccb[_0x8544('0x33')][_0x8544('0x60')][_0x4f7994]),'TeamId':Number(_0x530ccb[_0x8544('0x46')]['id'])});}}else{socket['emit'](_0x8544('0x7b'),{'UserId':Number(_0x530ccb[_0x8544('0x33')][_0x8544('0x60')]),'TeamId':Number(_0x530ccb[_0x8544('0x46')]['id'])});}});}})[_0x8544('0x28')](respondWithStatusCode(_0x161ba0,null))['catch'](handleError(_0x161ba0,null));};exports[_0x8544('0x7c')]=function(_0x5c601f,_0x4c1057,_0x51aa60){var _0x5bec5b={};var _0x2df6cd={};var _0x4b6cec;var _0x9d2b84;return db['Team']['findOne']({'where':{'id':_0x5c601f[_0x8544('0x46')]['id']}})[_0x8544('0x28')](handleEntityNotFound(_0x4c1057,null))[_0x8544('0x28')](function(_0x71b235){if(_0x71b235){_0x4b6cec=_0x71b235;_0x2df6cd[_0x8544('0x32')]=_[_0x8544('0x34')](db[_0x8544('0x6c')][_0x8544('0x2e')]);_0x2df6cd[_0x8544('0x33')]=_[_0x8544('0x34')](_0x5c601f[_0x8544('0x33')]);_0x2df6cd['filters']=_[_0x8544('0x35')](_0x2df6cd[_0x8544('0x32')],_0x2df6cd[_0x8544('0x33')]);_0x5bec5b[_0x8544('0x36')]=_[_0x8544('0x35')](_0x2df6cd[_0x8544('0x32')],qs[_0x8544('0x37')](_0x5c601f[_0x8544('0x33')]['fields']));_0x5bec5b['attributes']=_0x5bec5b['attributes'][_0x8544('0x38')]?_0x5bec5b[_0x8544('0x36')]:_0x2df6cd['model'];_0x5bec5b['order']=qs['sort'](_0x5c601f[_0x8544('0x33')][_0x8544('0x5b')]);_0x5bec5b['where']=qs['filters'](_[_0x8544('0x5c')](_0x5c601f[_0x8544('0x33')],_0x2df6cd[_0x8544('0x3c')]));if(_0x5c601f[_0x8544('0x33')][_0x8544('0x3d')]){_0x5bec5b[_0x8544('0x3b')]=_[_0x8544('0x3e')](_0x5bec5b['where'],{'$or':_['map'](_0x5bec5b[_0x8544('0x36')],function(_0x14c299){var _0x1483a1={};_0x1483a1[_0x14c299]={'$like':'%'+_0x5c601f[_0x8544('0x33')]['filter']+'%'};return _0x1483a1;})});}_0x5bec5b=_['merge']({},_0x5bec5b,_0x5c601f[_0x8544('0x3f')]);return _0x4b6cec[_0x8544('0x7c')](_0x5bec5b);}})[_0x8544('0x28')](function(_0x1bb673){if(_0x1bb673){_0x9d2b84=_0x1bb673['length'];if(!_0x5c601f[_0x8544('0x33')][_0x8544('0x39')]('nolimit')){_0x5bec5b[_0x8544('0x20')]=qs['limit'](_0x5c601f[_0x8544('0x33')]['limit']);_0x5bec5b[_0x8544('0x1f')]=qs['offset'](_0x5c601f[_0x8544('0x33')][_0x8544('0x1f')]);}return _0x4b6cec['getAgents'](_0x5bec5b);}})[_0x8544('0x28')](function(_0x31cbba){if(_0x31cbba){return _0x31cbba?{'count':_0x9d2b84,'rows':_0x31cbba}:null;}})[_0x8544('0x28')](respondWithResult(_0x4c1057,null))[_0x8544('0x44')](handleError(_0x4c1057,null));}; \ No newline at end of file +var _0x7ae0=['query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','rows','catch','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','channel','capitalize','toLowerCase','Queue','Queues','addQueues','Sequelize','add','ids','removeQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','remove','Chat','Sms','Openchannel','Whatsapp','each','addAgents','Voice','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','fax','userTeam:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','get','destroy','name','send','map','Team','rawAttributes','fieldName','type','key','model'];(function(_0x3cf4d1,_0x465657){var _0x3fd68c=function(_0x150d01){while(--_0x150d01){_0x3cf4d1['push'](_0x3cf4d1['shift']());}};_0x3fd68c(++_0x465657);}(_0x7ae0,0x1d0));var _0x07ae=function(_0x41bc22,_0x18f647){_0x41bc22=_0x41bc22-0x0;var _0x56b23c=_0x7ae0[_0x41bc22];return _0x56b23c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07ae('0x1'));var jsonpatch=require(_0x07ae('0x2'));var rp=require(_0x07ae('0x3'));var moment=require(_0x07ae('0x4'));var BPromise=require(_0x07ae('0x5'));var Mustache=require(_0x07ae('0x6'));var util=require('util');var path=require('path');var sox=require(_0x07ae('0x7'));var csv=require(_0x07ae('0x8'));var ejs=require(_0x07ae('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x07ae('0xa'));var crypto=require(_0x07ae('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x07ae('0xc'));var toCsv=require(_0x07ae('0x8'));var querystring=require(_0x07ae('0xd'));var Papa=require('papaparse');var Redis=require(_0x07ae('0xe'));var authService=require(_0x07ae('0xf'));var qs=require(_0x07ae('0x10'));var as=require(_0x07ae('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07ae('0x12'))(_0x07ae('0x13'));var utils=require(_0x07ae('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x07ae('0x15'));var db=require(_0x07ae('0x16'))['db'];config[_0x07ae('0x17')]=_['defaults'](config['redis'],{'host':_0x07ae('0x18'),'port':0x18eb});var socket=require(_0x07ae('0x19'))(new Redis(config['redis']));require(_0x07ae('0x1a'))[_0x07ae('0x1b')](socket);function respondWithStatusCode(_0x32ac4e,_0x497934){_0x497934=_0x497934||0xcc;return function(_0x2ae0ee){if(_0x2ae0ee){return _0x32ac4e[_0x07ae('0x1c')](_0x497934);}return _0x32ac4e[_0x07ae('0x1d')](_0x497934)[_0x07ae('0x1e')]();};}function respondWithResult(_0x1b4267,_0x2e94c6){_0x2e94c6=_0x2e94c6||0xc8;return function(_0x2d26a6){if(_0x2d26a6){return _0x1b4267[_0x07ae('0x1d')](_0x2e94c6)['json'](_0x2d26a6);}};}function respondWithFilteredResult(_0x12bf6d,_0x2fcd62){return function(_0x4caa1d){if(_0x4caa1d){var _0xab32b5=_0x4caa1d[_0x07ae('0x1f')],_0x367c9a=_0x2fcd62[_0x07ae('0x20')],_0x96a51a=_0x2fcd62[_0x07ae('0x20')]+_0x2fcd62[_0x07ae('0x21')],_0x7c0ffa;if(_0x96a51a>=_0xab32b5){_0x96a51a=_0xab32b5;_0x7c0ffa=0xc8;}else{_0x7c0ffa=0xce;}_0x12bf6d[_0x07ae('0x1d')](_0x7c0ffa);return _0x12bf6d[_0x07ae('0x22')](_0x07ae('0x23'),_0x367c9a+'-'+_0x96a51a+'/'+_0xab32b5)[_0x07ae('0x24')](_0x4caa1d);}return null;};}function patchUpdates(_0x5ccc64){return function(_0x44617c){try{jsonpatch[_0x07ae('0x25')](_0x44617c,_0x5ccc64,!![]);}catch(_0x3542e9){return BPromise['reject'](_0x3542e9);}return _0x44617c[_0x07ae('0x26')]();};}function saveUpdates(_0x3b38cf,_0x31036c){return function(_0x2a5479){if(_0x2a5479){return _0x2a5479[_0x07ae('0x27')](_0x3b38cf)['then'](function(_0x21e09d){return _0x21e09d;});}return null;};}function removeEntity(_0x3ae9b6,_0x45e559){return function(_0x59aa61){if(_0x59aa61){return _0x59aa61['destroy']()[_0x07ae('0x28')](function(){var _0x292338=_0x59aa61[_0x07ae('0x29')]({'plain':!![]});var _0x46d45c='Teams';return db['UserProfileResource'][_0x07ae('0x2a')]({'where':{'type':_0x46d45c,'resourceId':_0x292338['id']}})[_0x07ae('0x28')](function(){return _0x59aa61;});})[_0x07ae('0x28')](function(){_0x3ae9b6[_0x07ae('0x1d')](0xcc)[_0x07ae('0x1e')]();});}};}function handleEntityNotFound(_0x259550,_0x37dae6){return function(_0x4a0147){if(!_0x4a0147){_0x259550[_0x07ae('0x1c')](0x194);}return _0x4a0147;};}function handleError(_0x529f7f,_0x133f41){_0x133f41=_0x133f41||0x1f4;return function(_0xa794b9){logger['error'](_0xa794b9['stack']);if(_0xa794b9[_0x07ae('0x2b')]){delete _0xa794b9[_0x07ae('0x2b')];}_0x529f7f[_0x07ae('0x1d')](_0x133f41)[_0x07ae('0x2c')](_0xa794b9);};}exports['index']=function(_0x262b81,_0x51b829){var _0x494c12={},_0x232a73={},_0x534afb={'count':0x0,'rows':[]};var _0x3d752a=_[_0x07ae('0x2d')](db[_0x07ae('0x2e')][_0x07ae('0x2f')],function(_0x52482a){return{'name':_0x52482a[_0x07ae('0x30')],'type':_0x52482a[_0x07ae('0x31')][_0x07ae('0x32')]};});_0x232a73[_0x07ae('0x33')]=_[_0x07ae('0x2d')](_0x3d752a,'name');_0x232a73[_0x07ae('0x34')]=_[_0x07ae('0x35')](_0x262b81[_0x07ae('0x34')]);_0x232a73['filters']=_[_0x07ae('0x36')](_0x232a73[_0x07ae('0x33')],_0x232a73[_0x07ae('0x34')]);_0x494c12[_0x07ae('0x37')]=_[_0x07ae('0x36')](_0x232a73[_0x07ae('0x33')],qs['fields'](_0x262b81[_0x07ae('0x34')]['fields']));_0x494c12[_0x07ae('0x37')]=_0x494c12['attributes'][_0x07ae('0x38')]?_0x494c12[_0x07ae('0x37')]:_0x232a73[_0x07ae('0x33')];if(!_0x262b81[_0x07ae('0x34')][_0x07ae('0x39')](_0x07ae('0x3a'))){_0x494c12[_0x07ae('0x21')]=qs[_0x07ae('0x21')](_0x262b81[_0x07ae('0x34')]['limit']);_0x494c12[_0x07ae('0x20')]=qs[_0x07ae('0x20')](_0x262b81['query'][_0x07ae('0x20')]);}_0x494c12[_0x07ae('0x3b')]=qs[_0x07ae('0x3c')](_0x262b81[_0x07ae('0x34')][_0x07ae('0x3c')]);_0x494c12[_0x07ae('0x3d')]=qs['filters'](_[_0x07ae('0x3e')](_0x262b81[_0x07ae('0x34')],_0x232a73[_0x07ae('0x3f')]),_0x3d752a);if(_0x262b81[_0x07ae('0x34')][_0x07ae('0x40')]){_0x494c12['where']=_[_0x07ae('0x41')](_0x494c12[_0x07ae('0x3d')],{'$or':_['map'](_0x3d752a,function(_0x11309e){if(_0x11309e[_0x07ae('0x31')]!==_0x07ae('0x42')){var _0x1e346={};_0x1e346[_0x11309e[_0x07ae('0x2b')]]={'$like':'%'+_0x262b81[_0x07ae('0x34')][_0x07ae('0x40')]+'%'};return _0x1e346;}})});}_0x494c12=_['merge']({},_0x494c12,_0x262b81['options']);var _0x2d8f47={'where':_0x494c12[_0x07ae('0x3d')]};return db[_0x07ae('0x2e')]['count'](_0x2d8f47)['then'](function(_0x3b5ca3){_0x534afb['count']=_0x3b5ca3;if(_0x262b81[_0x07ae('0x34')]['includeAll']){_0x494c12[_0x07ae('0x43')]=[{'all':!![]}];}return db[_0x07ae('0x2e')]['findAll'](_0x494c12);})[_0x07ae('0x28')](function(_0x3e912d){_0x534afb[_0x07ae('0x44')]=_0x3e912d;return _0x534afb;})[_0x07ae('0x28')](respondWithFilteredResult(_0x51b829,_0x494c12))[_0x07ae('0x45')](handleError(_0x51b829,null));};exports['show']=function(_0x543657,_0x14875f){var _0x3f3a20={'raw':![],'where':{'id':_0x543657['params']['id']}},_0x1cdfd1={};_0x1cdfd1[_0x07ae('0x33')]=_[_0x07ae('0x35')](db[_0x07ae('0x2e')][_0x07ae('0x2f')]);_0x1cdfd1[_0x07ae('0x34')]=_[_0x07ae('0x35')](_0x543657['query']);_0x1cdfd1[_0x07ae('0x3f')]=_[_0x07ae('0x36')](_0x1cdfd1[_0x07ae('0x33')],_0x1cdfd1[_0x07ae('0x34')]);_0x3f3a20['attributes']=_[_0x07ae('0x36')](_0x1cdfd1[_0x07ae('0x33')],qs[_0x07ae('0x46')](_0x543657[_0x07ae('0x34')]['fields']));_0x3f3a20[_0x07ae('0x37')]=_0x3f3a20[_0x07ae('0x37')][_0x07ae('0x38')]?_0x3f3a20[_0x07ae('0x37')]:_0x1cdfd1[_0x07ae('0x33')];if(_0x543657[_0x07ae('0x34')][_0x07ae('0x47')]){_0x3f3a20['include']=[{'all':!![]}];}_0x3f3a20=_[_0x07ae('0x41')]({},_0x3f3a20,_0x543657[_0x07ae('0x48')]);return db['Team']['find'](_0x3f3a20)['then'](handleEntityNotFound(_0x14875f,null))['then'](respondWithResult(_0x14875f,null))[_0x07ae('0x45')](handleError(_0x14875f,null));};exports[_0x07ae('0x49')]=function(_0x1a2331,_0x3affd2){return db[_0x07ae('0x2e')]['create'](_0x1a2331[_0x07ae('0x4a')],{})[_0x07ae('0x28')](function(_0x366586){var _0x5e296c=_0x1a2331[_0x07ae('0x4b')][_0x07ae('0x29')]({'plain':!![]});if(!_0x5e296c)throw new Error(_0x07ae('0x4c'));if(_0x5e296c['role']===_0x07ae('0x4b')){var _0x112512=_0x366586[_0x07ae('0x29')]({'plain':!![]});var _0x3f808e=_0x07ae('0x4d');return db[_0x07ae('0x4e')][_0x07ae('0x4f')]({'where':{'name':_0x3f808e,'userProfileId':_0x5e296c[_0x07ae('0x50')]},'raw':!![]})[_0x07ae('0x28')](function(_0x43f2f5){if(_0x43f2f5&&_0x43f2f5[_0x07ae('0x51')]===0x0){return db[_0x07ae('0x52')][_0x07ae('0x49')]({'name':_0x112512[_0x07ae('0x2b')],'resourceId':_0x112512['id'],'type':_0x43f2f5[_0x07ae('0x2b')],'sectionId':_0x43f2f5['id']},{})[_0x07ae('0x28')](function(){return _0x366586;});}else{return _0x366586;}})['catch'](function(_0x6ad00e){logger[_0x07ae('0x53')](_0x07ae('0x54'),_0x6ad00e);throw _0x6ad00e;});}return _0x366586;})[_0x07ae('0x28')](respondWithResult(_0x3affd2,0xc9))[_0x07ae('0x45')](handleError(_0x3affd2,null));};exports['update']=function(_0x10a635,_0x28bbab){if(_0x10a635['body']['id']){delete _0x10a635[_0x07ae('0x4a')]['id'];}return db[_0x07ae('0x2e')][_0x07ae('0x4f')]({'where':{'id':_0x10a635[_0x07ae('0x55')]['id']}})[_0x07ae('0x28')](handleEntityNotFound(_0x28bbab,null))[_0x07ae('0x28')](saveUpdates(_0x10a635[_0x07ae('0x4a')],null))[_0x07ae('0x28')](respondWithResult(_0x28bbab,null))[_0x07ae('0x45')](handleError(_0x28bbab,null));};exports['destroy']=function(_0x17e74b,_0x2eae18){return db[_0x07ae('0x2e')][_0x07ae('0x4f')]({'where':{'id':_0x17e74b['params']['id']}})[_0x07ae('0x28')](handleEntityNotFound(_0x2eae18,null))['then'](removeEntity(_0x2eae18,null))[_0x07ae('0x45')](handleError(_0x2eae18,null));};exports[_0x07ae('0x56')]=function(_0x5ad043,_0x17c7bd,_0x59ed55){return db[_0x07ae('0x2e')]['findOne']({'where':{'id':_0x5ad043[_0x07ae('0x55')]['id']}})[_0x07ae('0x28')](handleEntityNotFound(_0x17c7bd,null))[_0x07ae('0x28')](function(_0x9bb9bc){if(!_0x5ad043['query']['channel']||!utils['isValidChannel'](_0x5ad043[_0x07ae('0x34')][_0x07ae('0x57')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x2f246a={};var _0x4bbe85={};_0x4bbe85[_0x07ae('0x33')]=_[_0x07ae('0x35')](db[_[_0x07ae('0x58')](_0x5ad043['query']['channel'][_0x07ae('0x59')]())+_0x07ae('0x5a')][_0x07ae('0x2f')]);_0x4bbe85['query']=_[_0x07ae('0x35')](_0x5ad043[_0x07ae('0x34')]);_0x4bbe85[_0x07ae('0x3f')]=_[_0x07ae('0x36')](_0x4bbe85[_0x07ae('0x33')],_0x4bbe85[_0x07ae('0x34')]);_0x2f246a[_0x07ae('0x37')]=_[_0x07ae('0x36')](_0x4bbe85[_0x07ae('0x33')],qs[_0x07ae('0x46')](_0x5ad043[_0x07ae('0x34')][_0x07ae('0x46')]));_0x2f246a['attributes']=_0x2f246a[_0x07ae('0x37')][_0x07ae('0x38')]?_0x2f246a[_0x07ae('0x37')]:_0x4bbe85[_0x07ae('0x33')];_0x2f246a[_0x07ae('0x21')]=qs[_0x07ae('0x21')](_0x5ad043[_0x07ae('0x34')][_0x07ae('0x21')]);_0x2f246a[_0x07ae('0x20')]=qs[_0x07ae('0x20')](_0x5ad043['query'][_0x07ae('0x20')]);_0x2f246a[_0x07ae('0x3b')]=qs['sort'](_0x5ad043[_0x07ae('0x34')][_0x07ae('0x3c')]);_0x2f246a['where']=qs['filters'](_['pick'](_0x5ad043[_0x07ae('0x34')],_0x4bbe85[_0x07ae('0x3f')]));_0x2f246a=_['merge']({},_0x2f246a,_0x5ad043[_0x07ae('0x48')]);return _0x9bb9bc[_0x07ae('0x29')+_[_0x07ae('0x58')](_0x5ad043[_0x07ae('0x34')][_0x07ae('0x57')][_0x07ae('0x59')]())+_0x07ae('0x5b')](_0x2f246a);})[_0x07ae('0x28')](respondWithResult(_0x17c7bd,null))[_0x07ae('0x45')](handleError(_0x17c7bd,null));};exports[_0x07ae('0x5c')]=function(_0x1da4fc,_0x31007f,_0x4deee3){return db[_0x07ae('0x2e')]['findOne']({'where':{'id':_0x1da4fc['params']['id']}})['then'](function(_0x3eb7bc){if(_0x3eb7bc){if(!_0x1da4fc[_0x07ae('0x4a')][_0x07ae('0x57')]||!utils['isValidChannel'](_0x1da4fc[_0x07ae('0x4a')][_0x07ae('0x57')])){throw new db[(_0x07ae('0x5d'))]['ValidationError']('Unknown\x20channel');}return _0x3eb7bc[_0x07ae('0x5e')+_[_0x07ae('0x58')](_0x1da4fc[_0x07ae('0x4a')]['channel']['toLowerCase']())+'Queues'](_0x1da4fc[_0x07ae('0x4a')][_0x07ae('0x5f')]);}return null;})[_0x07ae('0x28')](handleEntityNotFound(_0x31007f,null))[_0x07ae('0x28')](respondWithStatusCode(_0x31007f,null))[_0x07ae('0x45')](handleError(_0x31007f,null));};exports[_0x07ae('0x60')]=function(_0xe6f0e4,_0x529f67,_0x537c17){return db[_0x07ae('0x2e')][_0x07ae('0x61')]({'where':{'id':_0xe6f0e4[_0x07ae('0x55')]['id']}})['then'](function(_0x1f3784){if(_0x1f3784){if(!_0xe6f0e4[_0x07ae('0x34')]['channel']||!utils[_0x07ae('0x62')](_0xe6f0e4[_0x07ae('0x34')][_0x07ae('0x57')])){throw new db[(_0x07ae('0x5d'))][(_0x07ae('0x63'))](_0x07ae('0x64'));}return _0x1f3784[_0x07ae('0x65')+_[_0x07ae('0x58')](_0xe6f0e4[_0x07ae('0x34')][_0x07ae('0x57')][_0x07ae('0x59')]())+_0x07ae('0x5b')](_0xe6f0e4['query']['ids']);}return null;})[_0x07ae('0x28')](handleEntityNotFound(_0x529f67,null))[_0x07ae('0x28')](respondWithStatusCode(_0x529f67,null))[_0x07ae('0x45')](handleError(_0x529f67,null));};exports['addAgents']=function(_0x57ad58,_0x2fc873,_0x49c9f1){return db[_0x07ae('0x2e')][_0x07ae('0x4f')]({'where':{'id':_0x57ad58[_0x07ae('0x55')]['id']}})['then'](handleEntityNotFound(_0x2fc873,null))['then'](function(_0x22d837){if(_0x22d837){var _0x35ba80=['Voice',_0x07ae('0x66'),'Mail',_0x07ae('0x67'),'Fax',_0x07ae('0x68'),_0x07ae('0x69')];return BPromise[_0x07ae('0x6a')](_0x35ba80,function(_0x40d884){return _0x22d837[_0x07ae('0x29')+_0x40d884+_0x07ae('0x5b')]({'attributes':['id',_0x07ae('0x2b')]})['then'](function(_0x3a6a36){return BPromise[_0x07ae('0x6a')](_0x3a6a36,function(_0x3b5c3e){return _0x3b5c3e[_0x07ae('0x6b')](_0x57ad58['body'][_0x07ae('0x5f')])[_0x07ae('0x28')](function(){if(_0x40d884===_0x07ae('0x6c')){return db[_0x07ae('0x6d')]['findAll']({'where':{'id':_0x57ad58['body']['ids']},'attributes':['id',_0x07ae('0x2b'),_0x07ae('0x6e'),_0x07ae('0x6f'),'interface'],'raw':!![]})[_0x07ae('0x28')](function(_0xd6c3db){return BPromise['each'](_['filter'](_0xd6c3db,{'online':0x1}),function(_0x1bc69e){return db[_0x07ae('0x70')][_0x07ae('0x71')]({'membername':_0x1bc69e[_0x07ae('0x2b')],'UserId':_0x1bc69e['id'],'queue_name':_0x3b5c3e['name'],'VoiceQueueId':_0x3b5c3e['id'],'interface':_[_0x07ae('0x72')](_0x1bc69e[_0x07ae('0x73')])?util[_0x07ae('0x74')](_0x07ae('0x75'),_0x1bc69e[_0x07ae('0x2b')]):_0x1bc69e[_0x07ae('0x73')],'paused':_0x1bc69e['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x22d837;});})[_0x07ae('0x28')](function(){return _0x22d837;});}})['then'](function(_0x4a817f){if(_0x4a817f){return _0x4a817f[_0x07ae('0x6b')](_0x57ad58[_0x07ae('0x4a')]['ids'],_['omit'](_0x57ad58[_0x07ae('0x4a')],[_0x07ae('0x5f'),'id'])||{})[_0x07ae('0x76')](function(_0xb814ea){for(var _0x2bbff9=0x0;_0x2bbff9<_0x57ad58[_0x07ae('0x4a')][_0x07ae('0x5f')][_0x07ae('0x38')];_0x2bbff9+=0x1){socket[_0x07ae('0x77')](_0x07ae('0x78'),{'UserId':_0x57ad58[_0x07ae('0x4a')][_0x07ae('0x5f')][_0x2bbff9],'TeamId':_0x57ad58['params']['id']});}return _0xb814ea;});}})['then'](respondWithResult(_0x2fc873,null))[_0x07ae('0x45')](handleError(_0x2fc873,null));};exports[_0x07ae('0x79')]=function(_0x99765b,_0x4810c3,_0x2dfde5){return db[_0x07ae('0x2e')][_0x07ae('0x4f')]({'where':{'id':_0x99765b[_0x07ae('0x55')]['id']}})['then'](handleEntityNotFound(_0x4810c3,null))['then'](function(_0x164730){if(_0x164730){return BPromise[_0x07ae('0x6a')]([_0x07ae('0x7a'),_0x07ae('0x7b'),_0x07ae('0x7c'),_0x07ae('0x7d'),_0x07ae('0x7e'),'openchannel','whatsapp'],function(_0x4240bc){return _0x164730[_0x07ae('0x29')+_[_0x07ae('0x58')](_0x4240bc)+_0x07ae('0x5b')]({'attributes':['id',_0x07ae('0x2b')]})['then'](function(_0x5b2b76){return BPromise[_0x07ae('0x6a')](_0x5b2b76,function(_0x39ad73){return _0x39ad73['removeAgents'](_0x99765b[_0x07ae('0x34')][_0x07ae('0x5f')])[_0x07ae('0x28')](function(){if(_0x4240bc===_0x07ae('0x7a')){return db['UserVoiceQueueRt'][_0x07ae('0x2a')]({'where':{'VoiceQueueId':_0x39ad73['id'],'UserId':_0x99765b[_0x07ae('0x34')][_0x07ae('0x5f')]}});}});});})[_0x07ae('0x28')](function(){return _0x164730;});})[_0x07ae('0x28')](function(){return _0x164730;});}})[_0x07ae('0x28')](function(_0x4153d9){if(_0x4153d9){return _0x4153d9['removeAgents'](_0x99765b['query'][_0x07ae('0x5f')])[_0x07ae('0x28')](function(){if(_['isArray'](_0x99765b['query'][_0x07ae('0x5f')])){for(var _0x18a483=0x0;_0x18a483<_0x99765b['query']['ids'][_0x07ae('0x38')];_0x18a483+=0x1){socket['emit'](_0x07ae('0x7f'),{'UserId':Number(_0x99765b[_0x07ae('0x34')]['ids'][_0x18a483]),'TeamId':Number(_0x99765b[_0x07ae('0x55')]['id'])});}}else{socket[_0x07ae('0x77')](_0x07ae('0x7f'),{'UserId':Number(_0x99765b[_0x07ae('0x34')][_0x07ae('0x5f')]),'TeamId':Number(_0x99765b[_0x07ae('0x55')]['id'])});}});}})[_0x07ae('0x28')](respondWithStatusCode(_0x4810c3,null))[_0x07ae('0x45')](handleError(_0x4810c3,null));};exports[_0x07ae('0x80')]=function(_0x446afb,_0x1ae1d0,_0x414019){var _0xf8abf8={};var _0x5b8997={};var _0x71b7b2;var _0x22aa1b;return db['Team'][_0x07ae('0x61')]({'where':{'id':_0x446afb[_0x07ae('0x55')]['id']}})[_0x07ae('0x28')](handleEntityNotFound(_0x1ae1d0,null))[_0x07ae('0x28')](function(_0x510196){if(_0x510196){_0x71b7b2=_0x510196;_0x5b8997['model']=_[_0x07ae('0x35')](db[_0x07ae('0x6d')][_0x07ae('0x2f')]);_0x5b8997[_0x07ae('0x34')]=_[_0x07ae('0x35')](_0x446afb['query']);_0x5b8997[_0x07ae('0x3f')]=_[_0x07ae('0x36')](_0x5b8997[_0x07ae('0x33')],_0x5b8997['query']);_0xf8abf8['attributes']=_['intersection'](_0x5b8997['model'],qs[_0x07ae('0x46')](_0x446afb[_0x07ae('0x34')][_0x07ae('0x46')]));_0xf8abf8[_0x07ae('0x37')]=_0xf8abf8[_0x07ae('0x37')][_0x07ae('0x38')]?_0xf8abf8['attributes']:_0x5b8997[_0x07ae('0x33')];_0xf8abf8['order']=qs[_0x07ae('0x3c')](_0x446afb['query'][_0x07ae('0x3c')]);_0xf8abf8[_0x07ae('0x3d')]=qs[_0x07ae('0x3f')](_['pick'](_0x446afb[_0x07ae('0x34')],_0x5b8997[_0x07ae('0x3f')]));if(_0x446afb[_0x07ae('0x34')][_0x07ae('0x40')]){_0xf8abf8[_0x07ae('0x3d')]=_['merge'](_0xf8abf8[_0x07ae('0x3d')],{'$or':_[_0x07ae('0x2d')](_0xf8abf8['attributes'],function(_0x2879a1){var _0x33e610={};_0x33e610[_0x2879a1]={'$like':'%'+_0x446afb[_0x07ae('0x34')][_0x07ae('0x40')]+'%'};return _0x33e610;})});}_0xf8abf8=_['merge']({},_0xf8abf8,_0x446afb[_0x07ae('0x48')]);return _0x71b7b2['getAgents'](_0xf8abf8);}})[_0x07ae('0x28')](function(_0x59f87d){if(_0x59f87d){_0x22aa1b=_0x59f87d[_0x07ae('0x38')];if(!_0x446afb[_0x07ae('0x34')][_0x07ae('0x39')](_0x07ae('0x3a'))){_0xf8abf8[_0x07ae('0x21')]=qs[_0x07ae('0x21')](_0x446afb[_0x07ae('0x34')][_0x07ae('0x21')]);_0xf8abf8['offset']=qs[_0x07ae('0x20')](_0x446afb['query']['offset']);}return _0x71b7b2[_0x07ae('0x80')](_0xf8abf8);}})[_0x07ae('0x28')](function(_0x5e5eef){if(_0x5e5eef){return _0x5e5eef?{'count':_0x22aa1b,'rows':_0x5e5eef}:null;}})[_0x07ae('0x28')](respondWithResult(_0x1ae1d0,null))[_0x07ae('0x45')](handleError(_0x1ae1d0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 3191e2b..de80c0f 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 _0x7095=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4fa1db,_0x1bc43b){var _0x47e696=function(_0x4c1b77){while(--_0x4c1b77){_0x4fa1db['push'](_0x4fa1db['shift']());}};_0x47e696(++_0x1bc43b);}(_0x7095,0x93));var _0x5709=function(_0x5d9cec,_0x4a587c){_0x5d9cec=_0x5d9cec-0x0;var _0x4225f4=_0x7095[_0x5d9cec];return _0x4225f4;};'use strict';var EventEmitter=require(_0x5709('0x0'));var Team=require(_0x5709('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x5709('0x2')](0x0);var events={'afterCreate':_0x5709('0x3'),'afterUpdate':_0x5709('0x4'),'afterDestroy':_0x5709('0x5')};function emitEvent(_0x109ea5){return function(_0xf06904,_0x34c38d,_0x536b58){TeamEvents[_0x5709('0x6')](_0x109ea5+':'+_0xf06904['id'],_0xf06904);TeamEvents[_0x5709('0x6')](_0x109ea5,_0xf06904);_0x536b58(null);};}for(var e in events){if(events[_0x5709('0x7')](e)){var event=events[e];Team[_0x5709('0x8')](e,emitEvent(event));}}module[_0x5709('0x9')]=TeamEvents; \ No newline at end of file +var _0x09d7=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','emit'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x09d7,0xad));var _0x709d=function(_0x112981,_0x35e64d){_0x112981=_0x112981-0x0;var _0x1ed30f=_0x09d7[_0x112981];return _0x1ed30f;};'use strict';var EventEmitter=require(_0x709d('0x0'));var Team=require(_0x709d('0x1'))['db'][_0x709d('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x709d('0x3')](0x0);var events={'afterCreate':_0x709d('0x4'),'afterUpdate':_0x709d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x90e398){return function(_0xc5b17b,_0x3ab4fb,_0x29f12c){TeamEvents[_0x709d('0x6')](_0x90e398+':'+_0xc5b17b['id'],_0xc5b17b);TeamEvents[_0x709d('0x6')](_0x90e398,_0xc5b17b);_0x29f12c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x709d('0x7')](e,emitEvent(event));}}module[_0x709d('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index bad56db..c9f5536 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 _0x5190=['api','bluebird','path','rimraf','../../config/environment','exports','define','teams','lodash'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x5190,0x86));var _0x0519=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x5190[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require(_0x0519('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0519('0x1'));var moment=require('moment');var BPromise=require(_0x0519('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0519('0x3'));var rimraf=require(_0x0519('0x4'));var config=require(_0x0519('0x5'));var attributes=require('./team.attributes');module[_0x0519('0x6')]=function(_0x2c475c,_0x1ba3be){return _0x2c475c[_0x0519('0x7')]('Team',attributes,{'tableName':_0x0519('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fbf=['moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','exports','define','teams','lodash','util','api'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0x3fbf,0x171));var _0xf3fb=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0x3fbf[_0x532d78];return _0x5990c4;};'use strict';var _=require(_0xf3fb('0x0'));var util=require(_0xf3fb('0x1'));var logger=require('../../config/logger')(_0xf3fb('0x2'));var moment=require(_0xf3fb('0x3'));var BPromise=require(_0xf3fb('0x4'));var rp=require(_0xf3fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3fb('0x6'));var config=require(_0xf3fb('0x7'));var attributes=require(_0xf3fb('0x8'));module[_0xf3fb('0x9')]=function(_0x55ba30,_0x51f8c3){return _0x55ba30[_0xf3fb('0xa')]('Team',attributes,{'tableName':_0xf3fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b3793ed..9599a4e 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 _0x8b10=['Team,\x20%s,\x20%s,\x20%s','error','Team,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./team.socket','register','request','then','info','request\x20sent'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8b10,0x119));var _0x08b1=function(_0x489ddc,_0x2b6a93){_0x489ddc=_0x489ddc-0x0;var _0x47e4f3=_0x8b10[_0x489ddc];return _0x47e4f3;};'use strict';var _=require('lodash');var util=require(_0x08b1('0x0'));var moment=require(_0x08b1('0x1'));var BPromise=require(_0x08b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08b1('0x3'));var db=require(_0x08b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x08b1('0x5'))(_0x08b1('0x6'));var config=require(_0x08b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x08b1('0x8')][_0x08b1('0x9')]({'port':0x232a});config[_0x08b1('0xa')]=_[_0x08b1('0xb')](config[_0x08b1('0xa')],{'host':_0x08b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08b1('0xa')]));require(_0x08b1('0xd'))[_0x08b1('0xe')](socket);function respondWithRpcPromise(_0x4003b7,_0x480945,_0x1550ef){return new BPromise(function(_0x577bbc,_0x8f9476){return client[_0x08b1('0xf')](_0x4003b7,_0x1550ef)[_0x08b1('0x10')](function(_0x6631c9){logger[_0x08b1('0x11')]('Team,\x20%s,\x20%s',_0x480945,_0x08b1('0x12'));logger['debug'](_0x08b1('0x13'),_0x480945,_0x08b1('0x12'),JSON['stringify'](_0x6631c9));if(_0x6631c9['error']){if(_0x6631c9[_0x08b1('0x14')]['code']===0x1f4){logger['error'](_0x08b1('0x15'),_0x480945,_0x6631c9[_0x08b1('0x14')][_0x08b1('0x16')]);return _0x8f9476(_0x6631c9[_0x08b1('0x14')][_0x08b1('0x16')]);}logger[_0x08b1('0x14')](_0x08b1('0x15'),_0x480945,_0x6631c9[_0x08b1('0x14')][_0x08b1('0x16')]);return _0x577bbc(_0x6631c9[_0x08b1('0x14')][_0x08b1('0x16')]);}else{logger[_0x08b1('0x11')](_0x08b1('0x15'),_0x480945,_0x08b1('0x12'));_0x577bbc(_0x6631c9[_0x08b1('0x17')][_0x08b1('0x16')]);}})[_0x08b1('0x18')](function(_0x543dc7){logger['error'](_0x08b1('0x15'),_0x480945,_0x543dc7);_0x8f9476(_0x543dc7);});});} \ No newline at end of file +var _0xf8ec=['Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','./team.socket','request','then'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf8ec,0xb8));var _0xcf8e=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xf8ec[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xcf8e('0x0'));var util=require('util');var moment=require(_0xcf8e('0x1'));var BPromise=require(_0xcf8e('0x2'));var rs=require(_0xcf8e('0x3'));var fs=require('fs');var Redis=require(_0xcf8e('0x4'));var db=require(_0xcf8e('0x5'))['db'];var utils=require(_0xcf8e('0x6'));var logger=require(_0xcf8e('0x7'))(_0xcf8e('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf8e('0x9'));var client=jayson['client'][_0xcf8e('0xa')]({'port':0x232a});config[_0xcf8e('0xb')]=_[_0xcf8e('0xc')](config[_0xcf8e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf8e('0xd'))['register'](socket);function respondWithRpcPromise(_0x3bf6a8,_0x20c0af,_0xc03b29){return new BPromise(function(_0x57df92,_0x18350a){return client[_0xcf8e('0xe')](_0x3bf6a8,_0xc03b29)[_0xcf8e('0xf')](function(_0x4906bb){logger['info'](_0xcf8e('0x10'),_0x20c0af,'request\x20sent');logger[_0xcf8e('0x11')](_0xcf8e('0x12'),_0x20c0af,_0xcf8e('0x13'),JSON[_0xcf8e('0x14')](_0x4906bb));if(_0x4906bb[_0xcf8e('0x15')]){if(_0x4906bb[_0xcf8e('0x15')]['code']===0x1f4){logger[_0xcf8e('0x15')](_0xcf8e('0x10'),_0x20c0af,_0x4906bb['error'][_0xcf8e('0x16')]);return _0x18350a(_0x4906bb[_0xcf8e('0x15')][_0xcf8e('0x16')]);}logger[_0xcf8e('0x15')](_0xcf8e('0x10'),_0x20c0af,_0x4906bb[_0xcf8e('0x15')][_0xcf8e('0x16')]);return _0x57df92(_0x4906bb['error'][_0xcf8e('0x16')]);}else{logger[_0xcf8e('0x17')](_0xcf8e('0x10'),_0x20c0af,_0xcf8e('0x13'));_0x57df92(_0x4906bb[_0xcf8e('0x18')][_0xcf8e('0x16')]);}})['catch'](function(_0x2d8134){logger['error']('Team,\x20%s,\x20%s',_0x20c0af,_0x2d8134);_0x18350a(_0x2d8134);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0b42048..8b709a1 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 _0xdb28=['remove','update','emit','register','length','team:','./team.events','save'];(function(_0x222a4b,_0x1dc16c){var _0x59355f=function(_0x292811){while(--_0x292811){_0x222a4b['push'](_0x222a4b['shift']());}};_0x59355f(++_0x1dc16c);}(_0xdb28,0x106));var _0x8db2=function(_0x1ba9de,_0x206277){_0x1ba9de=_0x1ba9de-0x0;var _0xe9f4e8=_0xdb28[_0x1ba9de];return _0xe9f4e8;};'use strict';var TeamEvents=require(_0x8db2('0x0'));var events=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3')];function createListener(_0x585da1,_0x1f4c45){return function(_0x11c26d){_0x1f4c45[_0x8db2('0x4')](_0x585da1,_0x11c26d);};}function removeListener(_0x4426fe,_0x11109e){return function(){TeamEvents['removeListener'](_0x4426fe,_0x11109e);};}exports[_0x8db2('0x5')]=function(_0x1d2dd3){for(var _0x5f42ee=0x0,_0x494b40=events[_0x8db2('0x6')];_0x5f42ee<_0x494b40;_0x5f42ee++){var _0x46932f=events[_0x5f42ee];var _0x131537=createListener(_0x8db2('0x7')+_0x46932f,_0x1d2dd3);TeamEvents['on'](_0x46932f,_0x131537);}}; \ No newline at end of file +var _0x3c85=['emit','removeListener','register','./team.events','save','remove','update'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x3c85,0x1a0));var _0x53c8=function(_0x5aa53f,_0x5aa375){_0x5aa53f=_0x5aa53f-0x0;var _0x5dd08a=_0x3c85[_0x5aa53f];return _0x5dd08a;};'use strict';var TeamEvents=require(_0x53c8('0x0'));var events=[_0x53c8('0x1'),_0x53c8('0x2'),_0x53c8('0x3')];function createListener(_0x5c2e85,_0x4ad111){return function(_0xe9fd49){_0x4ad111[_0x53c8('0x4')](_0x5c2e85,_0xe9fd49);};}function removeListener(_0x44a11e,_0x4be799){return function(){TeamEvents[_0x53c8('0x5')](_0x44a11e,_0x4be799);};}exports[_0x53c8('0x6')]=function(_0x4758fd){for(var _0x4c2e1b=0x0,_0x5271ad=events['length'];_0x4c2e1b<_0x5271ad;_0x4c2e1b++){var _0x4bb757=events[_0x4c2e1b];var _0x7d5c2a=createListener('team:'+_0x4bb757,_0x4758fd);TeamEvents['on'](_0x4bb757,_0x7d5c2a);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c70d531..dc05eee 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 _0x4d9d=['update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x19cb7a,_0x231074){var _0x26a9ac=function(_0xf1f0f1){while(--_0xf1f0f1){_0x19cb7a['push'](_0x19cb7a['shift']());}};_0x26a9ac(++_0x231074);}(_0x4d9d,0x7b));var _0xd4d9=function(_0x142be6,_0x55f613){_0x142be6=_0x142be6-0x0;var _0x3630d9=_0x4d9d[_0x142be6];return _0x3630d9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd4d9('0x0'));var express=require(_0xd4d9('0x1'));var router=express[_0xd4d9('0x2')]();var auth=require(_0xd4d9('0x3'));var interaction=require(_0xd4d9('0x4'));var config=require('../../config/environment');var controller=require(_0xd4d9('0x5'));router['get']('/',auth[_0xd4d9('0x6')](),controller[_0xd4d9('0x7')]);router['get'](_0xd4d9('0x8'),auth[_0xd4d9('0x6')](),controller[_0xd4d9('0x9')]);router[_0xd4d9('0xa')]('/',auth[_0xd4d9('0x6')](),controller[_0xd4d9('0xb')]);router[_0xd4d9('0xc')](_0xd4d9('0x8'),auth[_0xd4d9('0x6')](),controller[_0xd4d9('0xd')]);router[_0xd4d9('0xe')](_0xd4d9('0x8'),auth[_0xd4d9('0x6')](),controller[_0xd4d9('0xf')]);module[_0xd4d9('0x10')]=router; \ No newline at end of file +var _0x27a8=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','post','create','delete','destroy'];(function(_0x244ab3,_0x51f648){var _0x2753b3=function(_0x512bce){while(--_0x512bce){_0x244ab3['push'](_0x244ab3['shift']());}};_0x2753b3(++_0x51f648);}(_0x27a8,0x1d5));var _0x827a=function(_0x4ffb1c,_0x21303d){_0x4ffb1c=_0x4ffb1c-0x0;var _0x134386=_0x27a8[_0x4ffb1c];return _0x134386;};'use strict';var multer=require(_0x827a('0x0'));var util=require(_0x827a('0x1'));var path=require(_0x827a('0x2'));var timeout=require('connect-timeout');var express=require(_0x827a('0x3'));var router=express[_0x827a('0x4')]();var auth=require(_0x827a('0x5'));var interaction=require(_0x827a('0x6'));var config=require(_0x827a('0x7'));var controller=require(_0x827a('0x8'));router[_0x827a('0x9')]('/',auth['isAuthenticated'](),controller[_0x827a('0xa')]);router[_0x827a('0x9')](_0x827a('0xb'),auth[_0x827a('0xc')](),controller['show']);router[_0x827a('0xd')]('/',auth[_0x827a('0xc')](),controller[_0x827a('0xe')]);router['put'](_0x827a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x827a('0xf')](_0x827a('0xb'),auth['isAuthenticated'](),controller[_0x827a('0x10')]);module[_0x827a('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 6484570..99a1c14 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 _0xc24f=['TEXT','sequelize','STRING'];(function(_0x1e5465,_0x2486a3){var _0x33b150=function(_0x42c63e){while(--_0x42c63e){_0x1e5465['push'](_0x1e5465['shift']());}};_0x33b150(++_0x2486a3);}(_0xc24f,0x184));var _0xfc24=function(_0x1204d4,_0x2739c0){_0x1204d4=_0x1204d4-0x0;var _0x59390a=_0xc24f[_0x1204d4];return _0x59390a;};'use strict';var Sequelize=require(_0xfc24('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc24('0x1')]},'description':{'type':Sequelize[_0xfc24('0x1')]},'html':{'type':Sequelize[_0xfc24('0x2')]}}; \ No newline at end of file +var _0x8000=['exports','STRING','TEXT'];(function(_0x119b96,_0x587acd){var _0x516cbf=function(_0x5d4b36){while(--_0x5d4b36){_0x119b96['push'](_0x119b96['shift']());}};_0x516cbf(++_0x587acd);}(_0x8000,0xb7));var _0x0800=function(_0x20f4ca,_0x5bc2c5){_0x20f4ca=_0x20f4ca-0x0;var _0x47b391=_0x8000[_0x20f4ca];return _0x47b391;};'use strict';var Sequelize=require('sequelize');module[_0x0800('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0800('0x1')]},'html':{'type':Sequelize[_0x0800('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0f76bff..cdcd8d3 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 _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x3918fe,_0x5a76d9){var _0x54cd61=function(_0x52a5be){while(--_0x52a5be){_0x3918fe['push'](_0x3918fe['shift']());}};_0x54cd61(++_0x5a76d9);}(_0x814b,0x1a2));var _0xb814=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x814b[_0x261b8a];return _0x3455e8;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file +var _0x7a54=['fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','type','key','model','map','keys','query','intersection'];(function(_0x3a4dfe,_0x1b4352){var _0x2edf7f=function(_0x8bb1ae){while(--_0x8bb1ae){_0x3a4dfe['push'](_0x3a4dfe['shift']());}};_0x2edf7f(++_0x1b4352);}(_0x7a54,0x106));var _0x47a5=function(_0x4cded3,_0x267d4b){_0x4cded3=_0x4cded3-0x0;var _0x4de47f=_0x7a54[_0x4cded3];return _0x4de47f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='Templates';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filters']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d0459bb..5c5ea9f 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 _0xbe06=['path','../../config/environment','./template.attributes','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbe06,0x117));var _0x6be0=function(_0x48f145,_0x3495eb){_0x48f145=_0x48f145-0x0;var _0x5c9ffd=_0xbe06[_0x48f145];return _0x5c9ffd;};'use strict';var _=require(_0x6be0('0x0'));var util=require(_0x6be0('0x1'));var logger=require(_0x6be0('0x2'))(_0x6be0('0x3'));var moment=require(_0x6be0('0x4'));var BPromise=require(_0x6be0('0x5'));var rp=require(_0x6be0('0x6'));var fs=require('fs');var path=require(_0x6be0('0x7'));var rimraf=require('rimraf');var config=require(_0x6be0('0x8'));var attributes=require(_0x6be0('0x9'));module['exports']=function(_0x1dfed4,_0x517c79){return _0x1dfed4['define']('Template',attributes,{'tableName':_0x6be0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94fd=['request-promise','rimraf','../../config/environment','define','Template','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20205a,_0x39b3c1){var _0x59191e=function(_0x45dc35){while(--_0x45dc35){_0x20205a['push'](_0x20205a['shift']());}};_0x59191e(++_0x39b3c1);}(_0x94fd,0x19c));var _0xd94f=function(_0x39c629,_0x2c0836){_0x39c629=_0x39c629-0x0;var _0xa2681d=_0x94fd[_0x39c629];return _0xa2681d;};'use strict';var _=require(_0xd94f('0x0'));var util=require(_0xd94f('0x1'));var logger=require(_0xd94f('0x2'))(_0xd94f('0x3'));var moment=require(_0xd94f('0x4'));var BPromise=require(_0xd94f('0x5'));var rp=require(_0xd94f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd94f('0x7'));var config=require(_0xd94f('0x8'));var attributes=require('./template.attributes');module['exports']=function(_0x5ebd81,_0x168b0b){return _0x5ebd81[_0xd94f('0x9')](_0xd94f('0xa'),attributes,{'tableName':'tools_templates','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 28330a5..7aa56aa 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 _0xe5d8=['raw','where','attributes','limit','include','model','map','util','moment','bluebird','randomstring','../../mysqldb','../../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','error','message','catch','GetTemplate','Template','findAll','options'];(function(_0x5ea7a8,_0x257068){var _0x1b2e3a=function(_0x5d3cfa){while(--_0x5d3cfa){_0x5ea7a8['push'](_0x5ea7a8['shift']());}};_0x1b2e3a(++_0x257068);}(_0xe5d8,0x1b4));var _0x8e5d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe5d8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x8e5d('0x0'));var moment=require(_0x8e5d('0x1'));var BPromise=require(_0x8e5d('0x2'));var rs=require(_0x8e5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e5d('0x4'))['db'];var utils=require(_0x8e5d('0x5'));var logger=require(_0x8e5d('0x6'))(_0x8e5d('0x7'));var config=require(_0x8e5d('0x8'));var jayson=require(_0x8e5d('0x9'));var client=jayson[_0x8e5d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x62ace5,_0x14bc3d,_0x2c299a){return new BPromise(function(_0x24eb19,_0x1cebc4){return client[_0x8e5d('0xb')](_0x62ace5,_0x2c299a)[_0x8e5d('0xc')](function(_0x2ea035){logger[_0x8e5d('0xd')](_0x8e5d('0xe'),_0x14bc3d,_0x8e5d('0xf'));logger[_0x8e5d('0x10')](_0x8e5d('0x11'),_0x14bc3d,'request\x20sent',JSON[_0x8e5d('0x12')](_0x2ea035));if(_0x2ea035[_0x8e5d('0x13')]){if(_0x2ea035['error']['code']===0x1f4){logger[_0x8e5d('0x13')](_0x8e5d('0xe'),_0x14bc3d,_0x2ea035[_0x8e5d('0x13')][_0x8e5d('0x14')]);return _0x1cebc4(_0x2ea035[_0x8e5d('0x13')]['message']);}logger[_0x8e5d('0x13')](_0x8e5d('0xe'),_0x14bc3d,_0x2ea035[_0x8e5d('0x13')][_0x8e5d('0x14')]);return _0x24eb19(_0x2ea035[_0x8e5d('0x13')]['message']);}else{logger[_0x8e5d('0xd')](_0x8e5d('0xe'),_0x14bc3d,_0x8e5d('0xf'));_0x24eb19(_0x2ea035['result'][_0x8e5d('0x14')]);}})[_0x8e5d('0x15')](function(_0x42db82){logger[_0x8e5d('0x13')](_0x8e5d('0xe'),_0x14bc3d,_0x42db82);_0x1cebc4(_0x42db82);});});}exports[_0x8e5d('0x16')]=function(_0x2edf6f){var _0x5185a6=this;return new Promise(function(_0xc9c598,_0x53733e){return db[_0x8e5d('0x17')][_0x8e5d('0x18')]({'raw':_0x2edf6f[_0x8e5d('0x19')]?_0x2edf6f[_0x8e5d('0x19')][_0x8e5d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2edf6f[_0x8e5d('0x19')]?_0x2edf6f[_0x8e5d('0x19')][_0x8e5d('0x1b')]||null:null,'attributes':_0x2edf6f[_0x8e5d('0x19')]?_0x2edf6f['options'][_0x8e5d('0x1c')]||null:null,'limit':_0x2edf6f['options']?_0x2edf6f[_0x8e5d('0x19')][_0x8e5d('0x1d')]||null:null,'include':_0x2edf6f[_0x8e5d('0x19')]?_0x2edf6f[_0x8e5d('0x19')][_0x8e5d('0x1e')]?_['map'](_0x2edf6f[_0x8e5d('0x19')][_0x8e5d('0x1e')],function(_0x21942c){return{'model':db[_0x21942c[_0x8e5d('0x1f')]],'as':_0x21942c['as'],'attributes':_0x21942c['attributes'],'include':_0x21942c[_0x8e5d('0x1e')]?_[_0x8e5d('0x20')](_0x21942c[_0x8e5d('0x1e')],function(_0x3a8a2a){return{'model':db[_0x3a8a2a['model']],'as':_0x3a8a2a['as'],'attributes':_0x3a8a2a[_0x8e5d('0x1c')],'include':_0x3a8a2a[_0x8e5d('0x1e')]?_[_0x8e5d('0x20')](_0x3a8a2a[_0x8e5d('0x1e')],function(_0x24820d){return{'model':db[_0x24820d[_0x8e5d('0x1f')]],'as':_0x24820d['as'],'attributes':_0x24820d[_0x8e5d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8e5d('0xc')](function(_0x314bee){logger[_0x8e5d('0xd')](_0x8e5d('0x16'),_0x2edf6f);logger[_0x8e5d('0x10')](_0x8e5d('0x16'),_0x2edf6f,JSON[_0x8e5d('0x12')](_0x314bee));_0xc9c598(_0x314bee);})[_0x8e5d('0x15')](function(_0x27e4a9){logger[_0x8e5d('0x13')](_0x8e5d('0x16'),_0x27e4a9[_0x8e5d('0x14')],_0x2edf6f);_0x53733e(_0x5185a6['error'](0x1f4,_0x27e4a9[_0x8e5d('0x14')]));});});}; \ No newline at end of file +var _0x40ac=['debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','Template','findAll','options','where','limit','include','map','model','attributes','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x40ac,0x127));var _0xc40a=function(_0x3e226d,_0x3c23bd){_0x3e226d=_0x3e226d-0x0;var _0x40892c=_0x40ac[_0x3e226d];return _0x40892c;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var moment=require(_0xc40a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc40a('0x2'));var db=require(_0xc40a('0x3'))['db'];var utils=require(_0xc40a('0x4'));var logger=require(_0xc40a('0x5'))(_0xc40a('0x6'));var config=require(_0xc40a('0x7'));var jayson=require(_0xc40a('0x8'));var client=jayson['client'][_0xc40a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x539020,_0x38daca,_0x5aa0ce){return new BPromise(function(_0x123f47,_0x4ecc63){return client[_0xc40a('0xa')](_0x539020,_0x5aa0ce)[_0xc40a('0xb')](function(_0x507b33){logger[_0xc40a('0xc')](_0xc40a('0xd'),_0x38daca,_0xc40a('0xe'));logger[_0xc40a('0xf')](_0xc40a('0x10'),_0x38daca,_0xc40a('0xe'),JSON[_0xc40a('0x11')](_0x507b33));if(_0x507b33[_0xc40a('0x12')]){if(_0x507b33[_0xc40a('0x12')]['code']===0x1f4){logger[_0xc40a('0x12')](_0xc40a('0xd'),_0x38daca,_0x507b33[_0xc40a('0x12')][_0xc40a('0x13')]);return _0x4ecc63(_0x507b33[_0xc40a('0x12')][_0xc40a('0x13')]);}logger[_0xc40a('0x12')]('Template,\x20%s,\x20%s',_0x38daca,_0x507b33['error']['message']);return _0x123f47(_0x507b33['error'][_0xc40a('0x13')]);}else{logger[_0xc40a('0xc')](_0xc40a('0xd'),_0x38daca,'request\x20sent');_0x123f47(_0x507b33['result']['message']);}})[_0xc40a('0x14')](function(_0x144188){logger[_0xc40a('0x12')](_0xc40a('0xd'),_0x38daca,_0x144188);_0x4ecc63(_0x144188);});});}exports[_0xc40a('0x15')]=function(_0x515121){var _0x4ff033=this;return new Promise(function(_0x564a7f,_0x5f14b8){return db[_0xc40a('0x16')][_0xc40a('0x17')]({'raw':_0x515121[_0xc40a('0x18')]?_0x515121[_0xc40a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x515121[_0xc40a('0x18')]?_0x515121[_0xc40a('0x18')][_0xc40a('0x19')]||null:null,'attributes':_0x515121['options']?_0x515121['options']['attributes']||null:null,'limit':_0x515121['options']?_0x515121[_0xc40a('0x18')][_0xc40a('0x1a')]||null:null,'include':_0x515121[_0xc40a('0x18')]?_0x515121[_0xc40a('0x18')][_0xc40a('0x1b')]?_[_0xc40a('0x1c')](_0x515121[_0xc40a('0x18')]['include'],function(_0x363c3b){return{'model':db[_0x363c3b[_0xc40a('0x1d')]],'as':_0x363c3b['as'],'attributes':_0x363c3b['attributes'],'include':_0x363c3b['include']?_[_0xc40a('0x1c')](_0x363c3b[_0xc40a('0x1b')],function(_0xed9504){return{'model':db[_0xed9504[_0xc40a('0x1d')]],'as':_0xed9504['as'],'attributes':_0xed9504[_0xc40a('0x1e')],'include':_0xed9504[_0xc40a('0x1b')]?_[_0xc40a('0x1c')](_0xed9504[_0xc40a('0x1b')],function(_0x4a36f6){return{'model':db[_0x4a36f6[_0xc40a('0x1d')]],'as':_0x4a36f6['as'],'attributes':_0x4a36f6[_0xc40a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cbe9b){logger[_0xc40a('0xc')](_0xc40a('0x15'),_0x515121);logger[_0xc40a('0xf')](_0xc40a('0x15'),_0x515121,JSON['stringify'](_0x5cbe9b));_0x564a7f(_0x5cbe9b);})[_0xc40a('0x14')](function(_0x58fbe5){logger[_0xc40a('0x12')](_0xc40a('0x15'),_0x58fbe5[_0xc40a('0x13')],_0x515121);_0x5f14b8(_0x4ff033['error'](0x1f4,_0x58fbe5[_0xc40a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 89939f3..7153947 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 _0x56a2=['connect-timeout','express','../../config/environment','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','addAllCondition','addAnyCondition','addAction','put','delete','destroy','exports','multer','util','path'];(function(_0x334ead,_0x33b269){var _0x32c450=function(_0x215d82){while(--_0x215d82){_0x334ead['push'](_0x334ead['shift']());}};_0x32c450(++_0x33b269);}(_0x56a2,0x13f));var _0x256a=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x56a2[_0x46c1d5];return _0x40fe7b;};'use strict';var multer=require(_0x256a('0x0'));var util=require(_0x256a('0x1'));var path=require(_0x256a('0x2'));var timeout=require(_0x256a('0x3'));var express=require(_0x256a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x256a('0x5'));var controller=require('./trigger.controller');router['get']('/',auth[_0x256a('0x6')](),controller[_0x256a('0x7')]);router[_0x256a('0x8')](_0x256a('0x9'),auth[_0x256a('0x6')](),controller['show']);router[_0x256a('0x8')](_0x256a('0xa'),auth[_0x256a('0x6')](),controller[_0x256a('0xb')]);router[_0x256a('0x8')](_0x256a('0xc'),auth[_0x256a('0x6')](),controller['getAnyConditions']);router['get'](_0x256a('0xd'),auth[_0x256a('0x6')](),controller[_0x256a('0xe')]);router['post']('/',auth[_0x256a('0x6')](),controller[_0x256a('0xf')]);router['post']('/:id/all_conditions',auth[_0x256a('0x6')](),controller[_0x256a('0x10')]);router['post'](_0x256a('0xc'),auth[_0x256a('0x6')](),controller[_0x256a('0x11')]);router['post'](_0x256a('0xd'),auth[_0x256a('0x6')](),controller[_0x256a('0x12')]);router[_0x256a('0x13')](_0x256a('0x9'),auth[_0x256a('0x6')](),controller['update']);router[_0x256a('0x14')](_0x256a('0x9'),auth[_0x256a('0x6')](),controller[_0x256a('0x15')]);module[_0x256a('0x16')]=router; \ No newline at end of file +var _0x6a13=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./trigger.controller','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAction','put','update','delete'];(function(_0x448680,_0x3435dd){var _0x1c0975=function(_0x49db95){while(--_0x49db95){_0x448680['push'](_0x448680['shift']());}};_0x1c0975(++_0x3435dd);}(_0x6a13,0xb7));var _0x36a1=function(_0x21edb7,_0x3ba93a){_0x21edb7=_0x21edb7-0x0;var _0x37d75b=_0x6a13[_0x21edb7];return _0x37d75b;};'use strict';var multer=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var path=require(_0x36a1('0x2'));var timeout=require(_0x36a1('0x3'));var express=require(_0x36a1('0x4'));var router=express[_0x36a1('0x5')]();var auth=require(_0x36a1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x36a1('0x7'));router['get']('/',auth[_0x36a1('0x8')](),controller[_0x36a1('0x9')]);router[_0x36a1('0xa')](_0x36a1('0xb'),auth[_0x36a1('0x8')](),controller[_0x36a1('0xc')]);router[_0x36a1('0xa')](_0x36a1('0xd'),auth[_0x36a1('0x8')](),controller[_0x36a1('0xe')]);router['get'](_0x36a1('0xf'),auth[_0x36a1('0x8')](),controller[_0x36a1('0x10')]);router[_0x36a1('0xa')](_0x36a1('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x36a1('0x12')]('/',auth[_0x36a1('0x8')](),controller[_0x36a1('0x13')]);router[_0x36a1('0x12')](_0x36a1('0xd'),auth[_0x36a1('0x8')](),controller[_0x36a1('0x14')]);router['post']('/:id/any_conditions',auth[_0x36a1('0x8')](),controller['addAnyCondition']);router[_0x36a1('0x12')]('/:id/actions',auth['isAuthenticated'](),controller[_0x36a1('0x15')]);router[_0x36a1('0x16')]('/:id',auth[_0x36a1('0x8')](),controller[_0x36a1('0x17')]);router[_0x36a1('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x36a1('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index c03d201..34eb568 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 _0x0f8c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4f197f,_0x4c8da7){var _0x2a3efb=function(_0x40b8b5){while(--_0x40b8b5){_0x4f197f['push'](_0x4f197f['shift']());}};_0x2a3efb(++_0x4c8da7);}(_0x0f8c,0x165));var _0xc0f8=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x0f8c[_0x4e0359];return _0x450f0a;};'use strict';var Sequelize=require(_0xc0f8('0x0'));module[_0xc0f8('0x1')]={'name':{'type':Sequelize[_0xc0f8('0x2')]},'channel':{'type':Sequelize[_0xc0f8('0x2')]},'description':{'type':Sequelize[_0xc0f8('0x2')]},'status':{'type':Sequelize[_0xc0f8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9c39=['BOOLEAN','exports','STRING'];(function(_0xdb3451,_0x40daa2){var _0x469bab=function(_0x2113b8){while(--_0x2113b8){_0xdb3451['push'](_0xdb3451['shift']());}};_0x469bab(++_0x40daa2);}(_0x9c39,0x11e));var _0x99c3=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x9c39[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require('sequelize');module[_0x99c3('0x0')]={'name':{'type':Sequelize[_0x99c3('0x1')]},'channel':{'type':Sequelize[_0x99c3('0x1')]},'description':{'type':Sequelize[_0x99c3('0x1')]},'status':{'type':Sequelize[_0x99c3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4c3474d..3300b3e 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 _0x8781=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','index','Trigger','fieldName','type','key','map','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','pick','filter','where','merge','options','findAll','rows','catch','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','TriggerAnyId','findOne','sort','getAllConditions','hasOwnProperty','getAnyConditions','TriggerId','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','sendStatus','status'];(function(_0x5af6fd,_0x279268){var _0xad76a3=function(_0x7155e0){while(--_0x7155e0){_0x5af6fd['push'](_0x5af6fd['shift']());}};_0xad76a3(++_0x279268);}(_0x8781,0x1c8));var _0x1878=function(_0x131411,_0x11a63e){_0x131411=_0x131411-0x0;var _0x3f9ff6=_0x8781[_0x131411];return _0x3f9ff6;};'use strict';var pdf=require(_0x1878('0x0'));var emlformat=require(_0x1878('0x1'));var rimraf=require(_0x1878('0x2'));var zipdir=require(_0x1878('0x3'));var jsonpatch=require(_0x1878('0x4'));var rp=require(_0x1878('0x5'));var moment=require(_0x1878('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1878('0x7'));var util=require(_0x1878('0x8'));var path=require(_0x1878('0x9'));var sox=require(_0x1878('0xa'));var csv=require(_0x1878('0xb'));var ejs=require(_0x1878('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1878('0xd'));var crypto=require(_0x1878('0xe'));var jsforce=require(_0x1878('0xf'));var deskjs=require(_0x1878('0x10'));var toCsv=require(_0x1878('0xb'));var querystring=require(_0x1878('0x11'));var Papa=require(_0x1878('0x12'));var Redis=require(_0x1878('0x13'));var authService=require(_0x1878('0x14'));var qs=require(_0x1878('0x15'));var as=require(_0x1878('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1878('0x17'))(_0x1878('0x18'));var utils=require(_0x1878('0x19'));var config=require(_0x1878('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4272ab,_0x1ed9f0){_0x1ed9f0=_0x1ed9f0||0xcc;return function(_0x181e51){if(_0x181e51){return _0x4272ab[_0x1878('0x1b')](_0x1ed9f0);}return _0x4272ab['status'](_0x1ed9f0)['end']();};}function respondWithResult(_0x19ffaa,_0x396f3a){_0x396f3a=_0x396f3a||0xc8;return function(_0x49d3a1){if(_0x49d3a1){return _0x19ffaa[_0x1878('0x1c')](_0x396f3a)[_0x1878('0x1d')](_0x49d3a1);}};}function respondWithFilteredResult(_0xb324ba,_0x4a5ba9){return function(_0x562902){if(_0x562902){var _0x13e16d=_0x562902[_0x1878('0x1e')],_0x450103=_0x4a5ba9[_0x1878('0x1f')],_0x1ff9c1=_0x4a5ba9[_0x1878('0x1f')]+_0x4a5ba9[_0x1878('0x20')],_0x43b85e;if(_0x1ff9c1>=_0x13e16d){_0x1ff9c1=_0x13e16d;_0x43b85e=0xc8;}else{_0x43b85e=0xce;}_0xb324ba[_0x1878('0x1c')](_0x43b85e);return _0xb324ba[_0x1878('0x21')](_0x1878('0x22'),_0x450103+'-'+_0x1ff9c1+'/'+_0x13e16d)['json'](_0x562902);}return null;};}function patchUpdates(_0x5ecfe3){return function(_0xf80c60){try{jsonpatch[_0x1878('0x23')](_0xf80c60,_0x5ecfe3,!![]);}catch(_0x5b8fd9){return BPromise[_0x1878('0x24')](_0x5b8fd9);}return _0xf80c60[_0x1878('0x25')]();};}function saveUpdates(_0x1fae20,_0x387f5){return function(_0x383956){if(_0x383956){return _0x383956['update'](_0x1fae20)[_0x1878('0x26')](function(_0x537efd){return _0x537efd;});}return null;};}function removeEntity(_0x1c2b5d,_0x45e2b6){return function(_0x2bc65b){if(_0x2bc65b){return _0x2bc65b[_0x1878('0x27')]()[_0x1878('0x26')](function(){var _0x524e68=_0x2bc65b[_0x1878('0x28')]({'plain':!![]});var _0x10ce95=_0x1878('0x29');return db[_0x1878('0x2a')][_0x1878('0x27')]({'where':{'type':_0x10ce95,'resourceId':_0x524e68['id']}})[_0x1878('0x26')](function(){return _0x2bc65b;});})[_0x1878('0x26')](function(){_0x1c2b5d['status'](0xcc)[_0x1878('0x2b')]();});}};}function handleEntityNotFound(_0x10ab5c,_0x243329){return function(_0xb191d0){if(!_0xb191d0){_0x10ab5c[_0x1878('0x1b')](0x194);}return _0xb191d0;};}function handleError(_0x57580b,_0x2f7e55){_0x2f7e55=_0x2f7e55||0x1f4;return function(_0x16410e){logger[_0x1878('0x2c')](_0x16410e[_0x1878('0x2d')]);if(_0x16410e['name']){delete _0x16410e[_0x1878('0x2e')];}_0x57580b[_0x1878('0x1c')](_0x2f7e55)[_0x1878('0x2f')](_0x16410e);};}exports[_0x1878('0x30')]=function(_0x1eda2b,_0x45e3db){var _0x49112c={},_0x35750c={},_0x6ad492={'count':0x0,'rows':[]};var _0x4baef1=_['map'](db[_0x1878('0x31')]['rawAttributes'],function(_0x5e9d48){return{'name':_0x5e9d48[_0x1878('0x32')],'type':_0x5e9d48[_0x1878('0x33')][_0x1878('0x34')]};});_0x35750c['model']=_[_0x1878('0x35')](_0x4baef1,_0x1878('0x2e'));_0x35750c[_0x1878('0x36')]=_[_0x1878('0x37')](_0x1eda2b['query']);_0x35750c[_0x1878('0x38')]=_[_0x1878('0x39')](_0x35750c[_0x1878('0x3a')],_0x35750c['query']);_0x49112c['attributes']=_[_0x1878('0x39')](_0x35750c['model'],qs[_0x1878('0x3b')](_0x1eda2b[_0x1878('0x36')]['fields']));_0x49112c['attributes']=_0x49112c['attributes'][_0x1878('0x3c')]?_0x49112c[_0x1878('0x3d')]:_0x35750c[_0x1878('0x3a')];if(!_0x1eda2b[_0x1878('0x36')]['hasOwnProperty'](_0x1878('0x3e'))){_0x49112c['limit']=qs[_0x1878('0x20')](_0x1eda2b[_0x1878('0x36')]['limit']);_0x49112c[_0x1878('0x1f')]=qs[_0x1878('0x1f')](_0x1eda2b['query'][_0x1878('0x1f')]);}_0x49112c[_0x1878('0x3f')]=qs['sort'](_0x1eda2b[_0x1878('0x36')]['sort']);_0x49112c['where']=qs[_0x1878('0x38')](_[_0x1878('0x40')](_0x1eda2b['query'],_0x35750c[_0x1878('0x38')]),_0x4baef1);if(_0x1eda2b[_0x1878('0x36')][_0x1878('0x41')]){_0x49112c[_0x1878('0x42')]=_['merge'](_0x49112c[_0x1878('0x42')],{'$or':_[_0x1878('0x35')](_0x4baef1,function(_0x2a967a){if(_0x2a967a['type']!=='VIRTUAL'){var _0x17b51b={};_0x17b51b[_0x2a967a[_0x1878('0x2e')]]={'$like':'%'+_0x1eda2b[_0x1878('0x36')]['filter']+'%'};return _0x17b51b;}})});}_0x49112c=_[_0x1878('0x43')]({},_0x49112c,_0x1eda2b[_0x1878('0x44')]);var _0x736873={'where':_0x49112c['where']};return db[_0x1878('0x31')]['count'](_0x736873)[_0x1878('0x26')](function(_0x4cf1c4){_0x6ad492['count']=_0x4cf1c4;if(_0x1eda2b[_0x1878('0x36')]['includeAll']){_0x49112c['include']=[{'all':!![]}];}return db[_0x1878('0x31')][_0x1878('0x45')](_0x49112c);})[_0x1878('0x26')](function(_0xd6dd95){_0x6ad492[_0x1878('0x46')]=_0xd6dd95;return _0x6ad492;})[_0x1878('0x26')](respondWithFilteredResult(_0x45e3db,_0x49112c))[_0x1878('0x47')](handleError(_0x45e3db,null));};exports['show']=function(_0x5c646f,_0x5ceb54){var _0x4722ef={'raw':![],'where':{'id':_0x5c646f[_0x1878('0x48')]['id']}},_0x57b99d={};_0x57b99d[_0x1878('0x3a')]=_[_0x1878('0x37')](db['Trigger'][_0x1878('0x49')]);_0x57b99d[_0x1878('0x36')]=_[_0x1878('0x37')](_0x5c646f[_0x1878('0x36')]);_0x57b99d[_0x1878('0x38')]=_['intersection'](_0x57b99d['model'],_0x57b99d[_0x1878('0x36')]);_0x4722ef[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x57b99d[_0x1878('0x3a')],qs[_0x1878('0x3b')](_0x5c646f['query'][_0x1878('0x3b')]));_0x4722ef[_0x1878('0x3d')]=_0x4722ef[_0x1878('0x3d')][_0x1878('0x3c')]?_0x4722ef['attributes']:_0x57b99d[_0x1878('0x3a')];if(_0x5c646f[_0x1878('0x36')][_0x1878('0x4a')]){_0x4722ef[_0x1878('0x4b')]=[{'all':!![]}];}_0x4722ef=_[_0x1878('0x43')]({},_0x4722ef,_0x5c646f[_0x1878('0x44')]);return db[_0x1878('0x31')][_0x1878('0x4c')](_0x4722ef)['then'](handleEntityNotFound(_0x5ceb54,null))[_0x1878('0x26')](respondWithResult(_0x5ceb54,null))[_0x1878('0x47')](handleError(_0x5ceb54,null));};exports['create']=function(_0x2cc185,_0x30f3c9){return db[_0x1878('0x31')][_0x1878('0x4d')](_0x2cc185[_0x1878('0x4e')],{})['then'](function(_0x2e9bee){var _0x4f2ac1=_0x2cc185[_0x1878('0x4f')][_0x1878('0x28')]({'plain':!![]});if(!_0x4f2ac1)throw new Error(_0x1878('0x50'));if(_0x4f2ac1[_0x1878('0x51')]===_0x1878('0x4f')){var _0x1616ac=_0x2e9bee[_0x1878('0x28')]({'plain':!![]});var _0x111f4d=_0x1878('0x29');return db[_0x1878('0x52')][_0x1878('0x4c')]({'where':{'name':_0x111f4d,'userProfileId':_0x4f2ac1[_0x1878('0x53')]},'raw':!![]})['then'](function(_0x2cefa6){if(_0x2cefa6&&_0x2cefa6[_0x1878('0x54')]===0x0){return db[_0x1878('0x2a')][_0x1878('0x4d')]({'name':_0x1616ac[_0x1878('0x2e')],'resourceId':_0x1616ac['id'],'type':_0x2cefa6[_0x1878('0x2e')],'sectionId':_0x2cefa6['id']},{})[_0x1878('0x26')](function(){return _0x2e9bee;});}else{return _0x2e9bee;}})[_0x1878('0x47')](function(_0x1d8b91){logger[_0x1878('0x2c')](_0x1878('0x55'),_0x1d8b91);throw _0x1d8b91;});}return _0x2e9bee;})[_0x1878('0x26')](respondWithResult(_0x30f3c9,0xc9))[_0x1878('0x47')](handleError(_0x30f3c9,null));};exports[_0x1878('0x56')]=function(_0x56870c,_0x112f5e){if(_0x56870c[_0x1878('0x4e')]['id']){delete _0x56870c['body']['id'];}return db[_0x1878('0x31')][_0x1878('0x4c')]({'where':{'id':_0x56870c['params']['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x112f5e,null))[_0x1878('0x26')](saveUpdates(_0x56870c['body'],null))['then'](respondWithResult(_0x112f5e,null))['catch'](handleError(_0x112f5e,null));};exports['destroy']=function(_0x5deb9b,_0x251cd9){return db[_0x1878('0x31')][_0x1878('0x4c')]({'where':{'id':_0x5deb9b[_0x1878('0x48')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x251cd9,null))[_0x1878('0x26')](removeEntity(_0x251cd9,null))[_0x1878('0x47')](handleError(_0x251cd9,null));};exports['addAllCondition']=function(_0x2f07e3,_0xca569e,_0x44aabc){if(_0x2f07e3[_0x1878('0x4e')]['id']){delete _0x2f07e3[_0x1878('0x4e')]['id'];}return db['Trigger'][_0x1878('0x4c')]({'where':{'id':_0x2f07e3[_0x1878('0x48')]['id']}})['then'](handleEntityNotFound(_0xca569e,null))[_0x1878('0x26')](function(_0x184ef4){if(_0x184ef4){_0x2f07e3[_0x1878('0x4e')][_0x1878('0x57')]=_0x184ef4['id'];return db[_0x1878('0x58')][_0x1878('0x4d')](_0x2f07e3['body']);}})[_0x1878('0x26')](respondWithResult(_0xca569e,null))['catch'](handleError(_0xca569e,null));};exports['addAnyCondition']=function(_0x2d2d83,_0x3f6a2e,_0x1b114f){if(_0x2d2d83[_0x1878('0x4e')]['id']){delete _0x2d2d83[_0x1878('0x4e')]['id'];}return db[_0x1878('0x31')][_0x1878('0x4c')]({'where':{'id':_0x2d2d83[_0x1878('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f6a2e,null))['then'](function(_0x4ff687){if(_0x4ff687){_0x2d2d83[_0x1878('0x4e')][_0x1878('0x59')]=_0x4ff687['id'];return db[_0x1878('0x58')]['create'](_0x2d2d83['body']);}})[_0x1878('0x26')](respondWithResult(_0x3f6a2e,null))['catch'](handleError(_0x3f6a2e,null));};exports['getAllConditions']=function(_0x32cced,_0x544eba,_0x5e0afb){var _0x3630f6={};var _0x5c343b={};var _0x518422;var _0x1670a0;return db['Trigger'][_0x1878('0x5a')]({'where':{'id':_0x32cced[_0x1878('0x48')]['id']}})['then'](handleEntityNotFound(_0x544eba,null))[_0x1878('0x26')](function(_0x196803){if(_0x196803){_0x518422=_0x196803;_0x5c343b[_0x1878('0x3a')]=_[_0x1878('0x37')](db[_0x1878('0x58')][_0x1878('0x49')]);_0x5c343b[_0x1878('0x36')]=_[_0x1878('0x37')](_0x32cced['query']);_0x5c343b[_0x1878('0x38')]=_['intersection'](_0x5c343b[_0x1878('0x3a')],_0x5c343b[_0x1878('0x36')]);_0x3630f6[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x5c343b[_0x1878('0x3a')],qs['fields'](_0x32cced[_0x1878('0x36')]['fields']));_0x3630f6[_0x1878('0x3d')]=_0x3630f6['attributes'][_0x1878('0x3c')]?_0x3630f6[_0x1878('0x3d')]:_0x5c343b['model'];_0x3630f6[_0x1878('0x3f')]=qs[_0x1878('0x5b')](_0x32cced[_0x1878('0x36')][_0x1878('0x5b')]);_0x3630f6['where']=qs[_0x1878('0x38')](_[_0x1878('0x40')](_0x32cced[_0x1878('0x36')],_0x5c343b[_0x1878('0x38')]));if(_0x32cced[_0x1878('0x36')]['filter']){_0x3630f6[_0x1878('0x42')]=_[_0x1878('0x43')](_0x3630f6['where'],{'$or':_['map'](_0x3630f6[_0x1878('0x3d')],function(_0x50a506){var _0x356525={};_0x356525[_0x50a506]={'$like':'%'+_0x32cced[_0x1878('0x36')][_0x1878('0x41')]+'%'};return _0x356525;})});}_0x3630f6=_[_0x1878('0x43')]({},_0x3630f6,_0x32cced[_0x1878('0x44')]);return _0x518422[_0x1878('0x5c')](_0x3630f6);}})[_0x1878('0x26')](function(_0x298f8e){if(_0x298f8e){_0x1670a0=_0x298f8e[_0x1878('0x3c')];if(!_0x32cced[_0x1878('0x36')][_0x1878('0x5d')](_0x1878('0x3e'))){_0x3630f6[_0x1878('0x20')]=qs[_0x1878('0x20')](_0x32cced['query'][_0x1878('0x20')]);_0x3630f6[_0x1878('0x1f')]=qs['offset'](_0x32cced[_0x1878('0x36')][_0x1878('0x1f')]);}return _0x518422['getAllConditions'](_0x3630f6);}})[_0x1878('0x26')](function(_0x680ec3){if(_0x680ec3){return _0x680ec3?{'count':_0x1670a0,'rows':_0x680ec3}:null;}})['then'](respondWithResult(_0x544eba,null))['catch'](handleError(_0x544eba,null));};exports[_0x1878('0x5e')]=function(_0x36d8b3,_0x59f930,_0x3af824){var _0x3e3e12={};var _0x51e10c={};var _0x2d5ecf;var _0x255812;return db[_0x1878('0x31')][_0x1878('0x5a')]({'where':{'id':_0x36d8b3['params']['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x59f930,null))[_0x1878('0x26')](function(_0x40bce5){if(_0x40bce5){_0x2d5ecf=_0x40bce5;_0x51e10c['model']=_[_0x1878('0x37')](db['Condition'][_0x1878('0x49')]);_0x51e10c[_0x1878('0x36')]=_[_0x1878('0x37')](_0x36d8b3[_0x1878('0x36')]);_0x51e10c[_0x1878('0x38')]=_[_0x1878('0x39')](_0x51e10c[_0x1878('0x3a')],_0x51e10c[_0x1878('0x36')]);_0x3e3e12[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x51e10c[_0x1878('0x3a')],qs[_0x1878('0x3b')](_0x36d8b3[_0x1878('0x36')][_0x1878('0x3b')]));_0x3e3e12['attributes']=_0x3e3e12[_0x1878('0x3d')]['length']?_0x3e3e12[_0x1878('0x3d')]:_0x51e10c['model'];_0x3e3e12[_0x1878('0x3f')]=qs[_0x1878('0x5b')](_0x36d8b3[_0x1878('0x36')][_0x1878('0x5b')]);_0x3e3e12[_0x1878('0x42')]=qs[_0x1878('0x38')](_[_0x1878('0x40')](_0x36d8b3['query'],_0x51e10c[_0x1878('0x38')]));if(_0x36d8b3[_0x1878('0x36')][_0x1878('0x41')]){_0x3e3e12['where']=_[_0x1878('0x43')](_0x3e3e12[_0x1878('0x42')],{'$or':_[_0x1878('0x35')](_0x3e3e12[_0x1878('0x3d')],function(_0x56d929){var _0x50b54e={};_0x50b54e[_0x56d929]={'$like':'%'+_0x36d8b3[_0x1878('0x36')][_0x1878('0x41')]+'%'};return _0x50b54e;})});}_0x3e3e12=_['merge']({},_0x3e3e12,_0x36d8b3[_0x1878('0x44')]);return _0x2d5ecf[_0x1878('0x5e')](_0x3e3e12);}})[_0x1878('0x26')](function(_0x5a0787){if(_0x5a0787){_0x255812=_0x5a0787['length'];if(!_0x36d8b3[_0x1878('0x36')][_0x1878('0x5d')](_0x1878('0x3e'))){_0x3e3e12['limit']=qs['limit'](_0x36d8b3[_0x1878('0x36')]['limit']);_0x3e3e12[_0x1878('0x1f')]=qs[_0x1878('0x1f')](_0x36d8b3[_0x1878('0x36')][_0x1878('0x1f')]);}return _0x2d5ecf[_0x1878('0x5e')](_0x3e3e12);}})[_0x1878('0x26')](function(_0x19f843){if(_0x19f843){return _0x19f843?{'count':_0x255812,'rows':_0x19f843}:null;}})[_0x1878('0x26')](respondWithResult(_0x59f930,null))[_0x1878('0x47')](handleError(_0x59f930,null));};exports['addAction']=function(_0x3e7a03,_0x55fa1b,_0x29aa67){if(_0x3e7a03['body']['id']){delete _0x3e7a03[_0x1878('0x4e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3e7a03[_0x1878('0x48')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x55fa1b,null))[_0x1878('0x26')](function(_0x39d677){if(_0x39d677){_0x3e7a03['body'][_0x1878('0x5f')]=_0x39d677['id'];return db['Action'][_0x1878('0x4d')](_0x3e7a03[_0x1878('0x4e')]);}})['then'](respondWithResult(_0x55fa1b,null))[_0x1878('0x47')](handleError(_0x55fa1b,null));};exports['getActions']=function(_0x5714a5,_0x54c992,_0x20bbb3){var _0x1c7bc4={};var _0x59fabb={};var _0x234243;var _0x3834e3;return db[_0x1878('0x31')]['findOne']({'where':{'id':_0x5714a5[_0x1878('0x48')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x54c992,null))[_0x1878('0x26')](function(_0x137fb7){if(_0x137fb7){_0x234243=_0x137fb7;_0x59fabb[_0x1878('0x3a')]=_[_0x1878('0x37')](db['Action'][_0x1878('0x49')]);_0x59fabb[_0x1878('0x36')]=_[_0x1878('0x37')](_0x5714a5[_0x1878('0x36')]);_0x59fabb[_0x1878('0x38')]=_[_0x1878('0x39')](_0x59fabb[_0x1878('0x3a')],_0x59fabb[_0x1878('0x36')]);_0x1c7bc4[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x59fabb[_0x1878('0x3a')],qs[_0x1878('0x3b')](_0x5714a5[_0x1878('0x36')][_0x1878('0x3b')]));_0x1c7bc4['attributes']=_0x1c7bc4['attributes'][_0x1878('0x3c')]?_0x1c7bc4[_0x1878('0x3d')]:_0x59fabb[_0x1878('0x3a')];_0x1c7bc4[_0x1878('0x3f')]=qs[_0x1878('0x5b')](_0x5714a5['query'][_0x1878('0x5b')]);_0x1c7bc4[_0x1878('0x42')]=qs[_0x1878('0x38')](_['pick'](_0x5714a5[_0x1878('0x36')],_0x59fabb[_0x1878('0x38')]));if(_0x5714a5[_0x1878('0x36')][_0x1878('0x41')]){_0x1c7bc4[_0x1878('0x42')]=_[_0x1878('0x43')](_0x1c7bc4['where'],{'$or':_[_0x1878('0x35')](_0x1c7bc4[_0x1878('0x3d')],function(_0x34cd45){var _0x65987f={};_0x65987f[_0x34cd45]={'$like':'%'+_0x5714a5[_0x1878('0x36')]['filter']+'%'};return _0x65987f;})});}_0x1c7bc4=_[_0x1878('0x43')]({},_0x1c7bc4,_0x5714a5['options']);return _0x234243[_0x1878('0x60')](_0x1c7bc4);}})['then'](function(_0x4b173c){if(_0x4b173c){_0x3834e3=_0x4b173c[_0x1878('0x3c')];if(!_0x5714a5[_0x1878('0x36')][_0x1878('0x5d')](_0x1878('0x3e'))){_0x1c7bc4[_0x1878('0x20')]=qs[_0x1878('0x20')](_0x5714a5[_0x1878('0x36')]['limit']);_0x1c7bc4[_0x1878('0x1f')]=qs[_0x1878('0x1f')](_0x5714a5[_0x1878('0x36')][_0x1878('0x1f')]);}return _0x234243['getActions'](_0x1c7bc4);}})[_0x1878('0x26')](function(_0x41d057){if(_0x41d057){return _0x41d057?{'count':_0x3834e3,'rows':_0x41d057}:null;}})['then'](respondWithResult(_0x54c992,null))[_0x1878('0x47')](handleError(_0x54c992,null));}; \ No newline at end of file +var _0x37a7=['options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','getAllConditions','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','findAll','catch','show','params','intersection','fields','length','includeAll','include'];(function(_0x4b40db,_0x13593d){var _0x705d69=function(_0x54af02){while(--_0x54af02){_0x4b40db['push'](_0x4b40db['shift']());}};_0x705d69(++_0x13593d);}(_0x37a7,0x6f));var _0x737a=function(_0x2cd99c,_0xe3b8d){_0x2cd99c=_0x2cd99c-0x0;var _0x12684a=_0x37a7[_0x2cd99c];return _0x12684a;};'use strict';var pdf=require(_0x737a('0x0'));var emlformat=require(_0x737a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x737a('0x2'));var moment=require(_0x737a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x737a('0x4'));var sox=require(_0x737a('0x5'));var csv=require(_0x737a('0x6'));var ejs=require(_0x737a('0x7'));var fs=require('fs');var _=require(_0x737a('0x8'));var squel=require('squel');var crypto=require(_0x737a('0x9'));var jsforce=require(_0x737a('0xa'));var deskjs=require(_0x737a('0xb'));var toCsv=require(_0x737a('0x6'));var querystring=require('querystring');var Papa=require(_0x737a('0xc'));var Redis=require(_0x737a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x737a('0xe'));var as=require(_0x737a('0xf'));var hardwareService=require(_0x737a('0x10'));var logger=require(_0x737a('0x11'))(_0x737a('0x12'));var utils=require(_0x737a('0x13'));var config=require(_0x737a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x737a('0x15'))['db'];function respondWithStatusCode(_0x22cc58,_0x2c4e57){_0x2c4e57=_0x2c4e57||0xcc;return function(_0x202575){if(_0x202575){return _0x22cc58[_0x737a('0x16')](_0x2c4e57);}return _0x22cc58[_0x737a('0x17')](_0x2c4e57)[_0x737a('0x18')]();};}function respondWithResult(_0x216a1d,_0x59b844){_0x59b844=_0x59b844||0xc8;return function(_0x449a00){if(_0x449a00){return _0x216a1d[_0x737a('0x17')](_0x59b844)['json'](_0x449a00);}};}function respondWithFilteredResult(_0x597c9d,_0xbf359e){return function(_0x37fc59){if(_0x37fc59){var _0x64901f=_0x37fc59['count'],_0xd5dd7c=_0xbf359e[_0x737a('0x19')],_0x1064c3=_0xbf359e['offset']+_0xbf359e[_0x737a('0x1a')],_0x195749;if(_0x1064c3>=_0x64901f){_0x1064c3=_0x64901f;_0x195749=0xc8;}else{_0x195749=0xce;}_0x597c9d[_0x737a('0x17')](_0x195749);return _0x597c9d['set'](_0x737a('0x1b'),_0xd5dd7c+'-'+_0x1064c3+'/'+_0x64901f)['json'](_0x37fc59);}return null;};}function patchUpdates(_0x4bf188){return function(_0x3bf493){try{jsonpatch[_0x737a('0x1c')](_0x3bf493,_0x4bf188,!![]);}catch(_0x4eed38){return BPromise[_0x737a('0x1d')](_0x4eed38);}return _0x3bf493[_0x737a('0x1e')]();};}function saveUpdates(_0x8d8378,_0x5d8e46){return function(_0x2e1b65){if(_0x2e1b65){return _0x2e1b65['update'](_0x8d8378)[_0x737a('0x1f')](function(_0x5423ba){return _0x5423ba;});}return null;};}function removeEntity(_0x28a36e,_0x21d412){return function(_0x1e801d){if(_0x1e801d){return _0x1e801d[_0x737a('0x20')]()[_0x737a('0x1f')](function(){var _0xd334c0=_0x1e801d[_0x737a('0x21')]({'plain':!![]});var _0x379439='Triggers';return db['UserProfileResource'][_0x737a('0x20')]({'where':{'type':_0x379439,'resourceId':_0xd334c0['id']}})['then'](function(){return _0x1e801d;});})[_0x737a('0x1f')](function(){_0x28a36e['status'](0xcc)[_0x737a('0x18')]();});}};}function handleEntityNotFound(_0x1d1642,_0x515010){return function(_0x417033){if(!_0x417033){_0x1d1642[_0x737a('0x16')](0x194);}return _0x417033;};}function handleError(_0x49a1d3,_0x38d416){_0x38d416=_0x38d416||0x1f4;return function(_0xff0afc){logger[_0x737a('0x22')](_0xff0afc[_0x737a('0x23')]);if(_0xff0afc[_0x737a('0x24')]){delete _0xff0afc[_0x737a('0x24')];}_0x49a1d3[_0x737a('0x17')](_0x38d416)['send'](_0xff0afc);};}exports[_0x737a('0x25')]=function(_0x15a81c,_0x2e2a20){var _0x34d20e={},_0x22c841={},_0x552fb6={'count':0x0,'rows':[]};var _0x1bc474=_[_0x737a('0x26')](db[_0x737a('0x27')][_0x737a('0x28')],function(_0x50b09f){return{'name':_0x50b09f[_0x737a('0x29')],'type':_0x50b09f[_0x737a('0x2a')][_0x737a('0x2b')]};});_0x22c841[_0x737a('0x2c')]=_[_0x737a('0x26')](_0x1bc474,_0x737a('0x24'));_0x22c841[_0x737a('0x2d')]=_[_0x737a('0x2e')](_0x15a81c[_0x737a('0x2d')]);_0x22c841[_0x737a('0x2f')]=_['intersection'](_0x22c841['model'],_0x22c841['query']);_0x34d20e[_0x737a('0x30')]=_['intersection'](_0x22c841['model'],qs['fields'](_0x15a81c['query']['fields']));_0x34d20e[_0x737a('0x30')]=_0x34d20e['attributes']['length']?_0x34d20e[_0x737a('0x30')]:_0x22c841[_0x737a('0x2c')];if(!_0x15a81c[_0x737a('0x2d')][_0x737a('0x31')](_0x737a('0x32'))){_0x34d20e[_0x737a('0x1a')]=qs[_0x737a('0x1a')](_0x15a81c[_0x737a('0x2d')][_0x737a('0x1a')]);_0x34d20e[_0x737a('0x19')]=qs[_0x737a('0x19')](_0x15a81c[_0x737a('0x2d')][_0x737a('0x19')]);}_0x34d20e[_0x737a('0x33')]=qs[_0x737a('0x34')](_0x15a81c[_0x737a('0x2d')]['sort']);_0x34d20e[_0x737a('0x35')]=qs[_0x737a('0x2f')](_[_0x737a('0x36')](_0x15a81c[_0x737a('0x2d')],_0x22c841[_0x737a('0x2f')]),_0x1bc474);if(_0x15a81c['query'][_0x737a('0x37')]){_0x34d20e[_0x737a('0x35')]=_[_0x737a('0x38')](_0x34d20e['where'],{'$or':_['map'](_0x1bc474,function(_0x792b22){if(_0x792b22[_0x737a('0x2a')]!=='VIRTUAL'){var _0x1b26a6={};_0x1b26a6[_0x792b22[_0x737a('0x24')]]={'$like':'%'+_0x15a81c[_0x737a('0x2d')][_0x737a('0x37')]+'%'};return _0x1b26a6;}})});}_0x34d20e=_[_0x737a('0x38')]({},_0x34d20e,_0x15a81c['options']);var _0x2309fc={'where':_0x34d20e[_0x737a('0x35')]};return db[_0x737a('0x27')][_0x737a('0x39')](_0x2309fc)['then'](function(_0x3307da){_0x552fb6[_0x737a('0x39')]=_0x3307da;if(_0x15a81c[_0x737a('0x2d')]['includeAll']){_0x34d20e['include']=[{'all':!![]}];}return db[_0x737a('0x27')][_0x737a('0x3a')](_0x34d20e);})[_0x737a('0x1f')](function(_0x44ac55){_0x552fb6['rows']=_0x44ac55;return _0x552fb6;})[_0x737a('0x1f')](respondWithFilteredResult(_0x2e2a20,_0x34d20e))[_0x737a('0x3b')](handleError(_0x2e2a20,null));};exports[_0x737a('0x3c')]=function(_0x451598,_0xca416f){var _0x10dd16={'raw':![],'where':{'id':_0x451598[_0x737a('0x3d')]['id']}},_0x57bacc={};_0x57bacc['model']=_['keys'](db[_0x737a('0x27')][_0x737a('0x28')]);_0x57bacc[_0x737a('0x2d')]=_[_0x737a('0x2e')](_0x451598['query']);_0x57bacc['filters']=_[_0x737a('0x3e')](_0x57bacc[_0x737a('0x2c')],_0x57bacc[_0x737a('0x2d')]);_0x10dd16['attributes']=_[_0x737a('0x3e')](_0x57bacc[_0x737a('0x2c')],qs[_0x737a('0x3f')](_0x451598[_0x737a('0x2d')][_0x737a('0x3f')]));_0x10dd16[_0x737a('0x30')]=_0x10dd16[_0x737a('0x30')][_0x737a('0x40')]?_0x10dd16[_0x737a('0x30')]:_0x57bacc[_0x737a('0x2c')];if(_0x451598[_0x737a('0x2d')][_0x737a('0x41')]){_0x10dd16[_0x737a('0x42')]=[{'all':!![]}];}_0x10dd16=_[_0x737a('0x38')]({},_0x10dd16,_0x451598[_0x737a('0x43')]);return db[_0x737a('0x27')][_0x737a('0x44')](_0x10dd16)[_0x737a('0x1f')](handleEntityNotFound(_0xca416f,null))['then'](respondWithResult(_0xca416f,null))[_0x737a('0x3b')](handleError(_0xca416f,null));};exports[_0x737a('0x45')]=function(_0x3d73eb,_0x122895){return db['Trigger'][_0x737a('0x45')](_0x3d73eb[_0x737a('0x46')],{})[_0x737a('0x1f')](function(_0xd91856){var _0x3f9b66=_0x3d73eb[_0x737a('0x47')][_0x737a('0x21')]({'plain':!![]});if(!_0x3f9b66)throw new Error(_0x737a('0x48'));if(_0x3f9b66['role']===_0x737a('0x47')){var _0x3be1ab=_0xd91856[_0x737a('0x21')]({'plain':!![]});var _0x32f050=_0x737a('0x49');return db['UserProfileSection'][_0x737a('0x44')]({'where':{'name':_0x32f050,'userProfileId':_0x3f9b66[_0x737a('0x4a')]},'raw':!![]})[_0x737a('0x1f')](function(_0x4056df){if(_0x4056df&&_0x4056df[_0x737a('0x4b')]===0x0){return db[_0x737a('0x4c')]['create']({'name':_0x3be1ab[_0x737a('0x24')],'resourceId':_0x3be1ab['id'],'type':_0x4056df['name'],'sectionId':_0x4056df['id']},{})[_0x737a('0x1f')](function(){return _0xd91856;});}else{return _0xd91856;}})[_0x737a('0x3b')](function(_0x1d213c){logger[_0x737a('0x22')](_0x737a('0x4d'),_0x1d213c);throw _0x1d213c;});}return _0xd91856;})['then'](respondWithResult(_0x122895,0xc9))[_0x737a('0x3b')](handleError(_0x122895,null));};exports[_0x737a('0x4e')]=function(_0x4d53c0,_0x120af2){if(_0x4d53c0['body']['id']){delete _0x4d53c0['body']['id'];}return db[_0x737a('0x27')][_0x737a('0x44')]({'where':{'id':_0x4d53c0[_0x737a('0x3d')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x120af2,null))['then'](saveUpdates(_0x4d53c0[_0x737a('0x46')],null))['then'](respondWithResult(_0x120af2,null))[_0x737a('0x3b')](handleError(_0x120af2,null));};exports[_0x737a('0x20')]=function(_0x1c803d,_0x5b1fb1){return db[_0x737a('0x27')][_0x737a('0x44')]({'where':{'id':_0x1c803d[_0x737a('0x3d')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x5b1fb1,null))['then'](removeEntity(_0x5b1fb1,null))[_0x737a('0x3b')](handleError(_0x5b1fb1,null));};exports['addAllCondition']=function(_0x403339,_0x25f8dd,_0x151920){if(_0x403339['body']['id']){delete _0x403339[_0x737a('0x46')]['id'];}return db[_0x737a('0x27')][_0x737a('0x44')]({'where':{'id':_0x403339[_0x737a('0x3d')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x25f8dd,null))[_0x737a('0x1f')](function(_0x5d2200){if(_0x5d2200){_0x403339[_0x737a('0x46')][_0x737a('0x4f')]=_0x5d2200['id'];return db['Condition'][_0x737a('0x45')](_0x403339[_0x737a('0x46')]);}})['then'](respondWithResult(_0x25f8dd,null))[_0x737a('0x3b')](handleError(_0x25f8dd,null));};exports[_0x737a('0x50')]=function(_0x807ac7,_0x23ddcf,_0x33300f){if(_0x807ac7[_0x737a('0x46')]['id']){delete _0x807ac7['body']['id'];}return db[_0x737a('0x27')][_0x737a('0x44')]({'where':{'id':_0x807ac7[_0x737a('0x3d')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x23ddcf,null))[_0x737a('0x1f')](function(_0x453a5c){if(_0x453a5c){_0x807ac7['body'][_0x737a('0x51')]=_0x453a5c['id'];return db[_0x737a('0x52')]['create'](_0x807ac7['body']);}})[_0x737a('0x1f')](respondWithResult(_0x23ddcf,null))[_0x737a('0x3b')](handleError(_0x23ddcf,null));};exports['getAllConditions']=function(_0x142d1e,_0x2e46e3,_0x2fb1ae){var _0x12649e={};var _0xdcc369={};var _0x202eb6;var _0x2c3771;return db[_0x737a('0x27')][_0x737a('0x53')]({'where':{'id':_0x142d1e['params']['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x2e46e3,null))['then'](function(_0x2b14a9){if(_0x2b14a9){_0x202eb6=_0x2b14a9;_0xdcc369[_0x737a('0x2c')]=_['keys'](db['Condition']['rawAttributes']);_0xdcc369['query']=_[_0x737a('0x2e')](_0x142d1e[_0x737a('0x2d')]);_0xdcc369[_0x737a('0x2f')]=_['intersection'](_0xdcc369[_0x737a('0x2c')],_0xdcc369[_0x737a('0x2d')]);_0x12649e[_0x737a('0x30')]=_['intersection'](_0xdcc369[_0x737a('0x2c')],qs['fields'](_0x142d1e[_0x737a('0x2d')]['fields']));_0x12649e[_0x737a('0x30')]=_0x12649e[_0x737a('0x30')][_0x737a('0x40')]?_0x12649e[_0x737a('0x30')]:_0xdcc369['model'];_0x12649e[_0x737a('0x33')]=qs['sort'](_0x142d1e[_0x737a('0x2d')]['sort']);_0x12649e[_0x737a('0x35')]=qs[_0x737a('0x2f')](_[_0x737a('0x36')](_0x142d1e[_0x737a('0x2d')],_0xdcc369['filters']));if(_0x142d1e[_0x737a('0x2d')]['filter']){_0x12649e[_0x737a('0x35')]=_['merge'](_0x12649e[_0x737a('0x35')],{'$or':_[_0x737a('0x26')](_0x12649e[_0x737a('0x30')],function(_0x3010ec){var _0x5dce7b={};_0x5dce7b[_0x3010ec]={'$like':'%'+_0x142d1e[_0x737a('0x2d')][_0x737a('0x37')]+'%'};return _0x5dce7b;})});}_0x12649e=_[_0x737a('0x38')]({},_0x12649e,_0x142d1e[_0x737a('0x43')]);return _0x202eb6[_0x737a('0x54')](_0x12649e);}})[_0x737a('0x1f')](function(_0x3edd49){if(_0x3edd49){_0x2c3771=_0x3edd49[_0x737a('0x40')];if(!_0x142d1e[_0x737a('0x2d')][_0x737a('0x31')](_0x737a('0x32'))){_0x12649e[_0x737a('0x1a')]=qs[_0x737a('0x1a')](_0x142d1e[_0x737a('0x2d')][_0x737a('0x1a')]);_0x12649e[_0x737a('0x19')]=qs[_0x737a('0x19')](_0x142d1e[_0x737a('0x2d')][_0x737a('0x19')]);}return _0x202eb6[_0x737a('0x54')](_0x12649e);}})[_0x737a('0x1f')](function(_0x429513){if(_0x429513){return _0x429513?{'count':_0x2c3771,'rows':_0x429513}:null;}})[_0x737a('0x1f')](respondWithResult(_0x2e46e3,null))[_0x737a('0x3b')](handleError(_0x2e46e3,null));};exports[_0x737a('0x55')]=function(_0x4bba3f,_0x1a6425,_0x38e857){var _0x1357ec={};var _0x1c7e2f={};var _0x455f6b;var _0x328ae6;return db[_0x737a('0x27')][_0x737a('0x53')]({'where':{'id':_0x4bba3f[_0x737a('0x3d')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x1a6425,null))['then'](function(_0x52940a){if(_0x52940a){_0x455f6b=_0x52940a;_0x1c7e2f[_0x737a('0x2c')]=_[_0x737a('0x2e')](db[_0x737a('0x52')][_0x737a('0x28')]);_0x1c7e2f['query']=_[_0x737a('0x2e')](_0x4bba3f['query']);_0x1c7e2f[_0x737a('0x2f')]=_[_0x737a('0x3e')](_0x1c7e2f[_0x737a('0x2c')],_0x1c7e2f[_0x737a('0x2d')]);_0x1357ec['attributes']=_['intersection'](_0x1c7e2f[_0x737a('0x2c')],qs['fields'](_0x4bba3f['query'][_0x737a('0x3f')]));_0x1357ec[_0x737a('0x30')]=_0x1357ec[_0x737a('0x30')][_0x737a('0x40')]?_0x1357ec[_0x737a('0x30')]:_0x1c7e2f['model'];_0x1357ec['order']=qs['sort'](_0x4bba3f[_0x737a('0x2d')][_0x737a('0x34')]);_0x1357ec[_0x737a('0x35')]=qs['filters'](_['pick'](_0x4bba3f[_0x737a('0x2d')],_0x1c7e2f[_0x737a('0x2f')]));if(_0x4bba3f[_0x737a('0x2d')][_0x737a('0x37')]){_0x1357ec['where']=_['merge'](_0x1357ec[_0x737a('0x35')],{'$or':_[_0x737a('0x26')](_0x1357ec[_0x737a('0x30')],function(_0x334e35){var _0x115463={};_0x115463[_0x334e35]={'$like':'%'+_0x4bba3f[_0x737a('0x2d')][_0x737a('0x37')]+'%'};return _0x115463;})});}_0x1357ec=_[_0x737a('0x38')]({},_0x1357ec,_0x4bba3f['options']);return _0x455f6b[_0x737a('0x55')](_0x1357ec);}})[_0x737a('0x1f')](function(_0x33b90e){if(_0x33b90e){_0x328ae6=_0x33b90e[_0x737a('0x40')];if(!_0x4bba3f[_0x737a('0x2d')][_0x737a('0x31')](_0x737a('0x32'))){_0x1357ec['limit']=qs[_0x737a('0x1a')](_0x4bba3f[_0x737a('0x2d')][_0x737a('0x1a')]);_0x1357ec[_0x737a('0x19')]=qs[_0x737a('0x19')](_0x4bba3f[_0x737a('0x2d')][_0x737a('0x19')]);}return _0x455f6b[_0x737a('0x55')](_0x1357ec);}})[_0x737a('0x1f')](function(_0x54d5b7){if(_0x54d5b7){return _0x54d5b7?{'count':_0x328ae6,'rows':_0x54d5b7}:null;}})[_0x737a('0x1f')](respondWithResult(_0x1a6425,null))[_0x737a('0x3b')](handleError(_0x1a6425,null));};exports[_0x737a('0x56')]=function(_0x194e53,_0x502b82,_0x3597bf){if(_0x194e53['body']['id']){delete _0x194e53[_0x737a('0x46')]['id'];}return db[_0x737a('0x27')][_0x737a('0x44')]({'where':{'id':_0x194e53['params']['id']}})['then'](handleEntityNotFound(_0x502b82,null))[_0x737a('0x1f')](function(_0x5e35f4){if(_0x5e35f4){_0x194e53[_0x737a('0x46')]['TriggerId']=_0x5e35f4['id'];return db[_0x737a('0x57')][_0x737a('0x45')](_0x194e53[_0x737a('0x46')]);}})[_0x737a('0x1f')](respondWithResult(_0x502b82,null))[_0x737a('0x3b')](handleError(_0x502b82,null));};exports['getActions']=function(_0x27e55c,_0x568c2a,_0x5a82f4){var _0xf838b0={};var _0x58046b={};var _0x403ae3;var _0x65e7a7;return db[_0x737a('0x27')][_0x737a('0x53')]({'where':{'id':_0x27e55c[_0x737a('0x3d')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x568c2a,null))[_0x737a('0x1f')](function(_0x224f74){if(_0x224f74){_0x403ae3=_0x224f74;_0x58046b[_0x737a('0x2c')]=_[_0x737a('0x2e')](db['Action'][_0x737a('0x28')]);_0x58046b[_0x737a('0x2d')]=_[_0x737a('0x2e')](_0x27e55c[_0x737a('0x2d')]);_0x58046b['filters']=_[_0x737a('0x3e')](_0x58046b[_0x737a('0x2c')],_0x58046b[_0x737a('0x2d')]);_0xf838b0[_0x737a('0x30')]=_[_0x737a('0x3e')](_0x58046b[_0x737a('0x2c')],qs[_0x737a('0x3f')](_0x27e55c[_0x737a('0x2d')][_0x737a('0x3f')]));_0xf838b0[_0x737a('0x30')]=_0xf838b0['attributes']['length']?_0xf838b0[_0x737a('0x30')]:_0x58046b[_0x737a('0x2c')];_0xf838b0[_0x737a('0x33')]=qs[_0x737a('0x34')](_0x27e55c[_0x737a('0x2d')][_0x737a('0x34')]);_0xf838b0[_0x737a('0x35')]=qs[_0x737a('0x2f')](_[_0x737a('0x36')](_0x27e55c['query'],_0x58046b[_0x737a('0x2f')]));if(_0x27e55c['query']['filter']){_0xf838b0[_0x737a('0x35')]=_[_0x737a('0x38')](_0xf838b0['where'],{'$or':_['map'](_0xf838b0[_0x737a('0x30')],function(_0x3fb9c0){var _0x2b4f17={};_0x2b4f17[_0x3fb9c0]={'$like':'%'+_0x27e55c[_0x737a('0x2d')]['filter']+'%'};return _0x2b4f17;})});}_0xf838b0=_['merge']({},_0xf838b0,_0x27e55c[_0x737a('0x43')]);return _0x403ae3['getActions'](_0xf838b0);}})['then'](function(_0x5d91d5){if(_0x5d91d5){_0x65e7a7=_0x5d91d5[_0x737a('0x40')];if(!_0x27e55c[_0x737a('0x2d')][_0x737a('0x31')]('nolimit')){_0xf838b0[_0x737a('0x1a')]=qs[_0x737a('0x1a')](_0x27e55c[_0x737a('0x2d')]['limit']);_0xf838b0[_0x737a('0x19')]=qs['offset'](_0x27e55c[_0x737a('0x2d')][_0x737a('0x19')]);}return _0x403ae3[_0x737a('0x58')](_0xf838b0);}})[_0x737a('0x1f')](function(_0x24d2e8){if(_0x24d2e8){return _0x24d2e8?{'count':_0x65e7a7,'rows':_0x24d2e8}:null;}})[_0x737a('0x1f')](respondWithResult(_0x568c2a,null))[_0x737a('0x3b')](handleError(_0x568c2a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f444773..43b79f5 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 _0x4764=['Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','exports','define'];(function(_0x500fa2,_0x43ddfb){var _0x45dc60=function(_0x5acd2e){while(--_0x5acd2e){_0x500fa2['push'](_0x500fa2['shift']());}};_0x45dc60(++_0x43ddfb);}(_0x4764,0xd4));var _0x4476=function(_0x305f78,_0x26419e){_0x305f78=_0x305f78-0x0;var _0x1dc7fd=_0x4764[_0x305f78];return _0x1dc7fd;};'use strict';var _=require(_0x4476('0x0'));var util=require(_0x4476('0x1'));var logger=require(_0x4476('0x2'))(_0x4476('0x3'));var moment=require(_0x4476('0x4'));var BPromise=require(_0x4476('0x5'));var rp=require(_0x4476('0x6'));var fs=require('fs');var path=require(_0x4476('0x7'));var rimraf=require(_0x4476('0x8'));var config=require('../../config/environment');var attributes=require(_0x4476('0x9'));module[_0x4476('0xa')]=function(_0x81dc56,_0x1ff6ea){return _0x81dc56[_0x4476('0xb')](_0x4476('0xc'),attributes,{'tableName':_0x4476('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda35=['api','moment','bluebird','request-promise','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xda35,0x99));var _0x5da3=function(_0x458848,_0x2dcecd){_0x458848=_0x458848-0x0;var _0x20469e=_0xda35[_0x458848];return _0x20469e;};'use strict';var _=require(_0x5da3('0x0'));var util=require(_0x5da3('0x1'));var logger=require(_0x5da3('0x2'))(_0x5da3('0x3'));var moment=require(_0x5da3('0x4'));var BPromise=require(_0x5da3('0x5'));var rp=require(_0x5da3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5da3('0x7'));var attributes=require(_0x5da3('0x8'));module[_0x5da3('0x9')]=function(_0x55f3ef,_0x5e79c4){return _0x55f3ef[_0x5da3('0xa')]('Trigger',attributes,{'tableName':_0x5da3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 3295c55..2c275dc 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 _0xf45e=['options','raw','where','attributes','limit','include','model','map','Trigger','find','ShowTrigger','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll'];(function(_0x1e0ccc,_0x219c31){var _0x3924de=function(_0x7634ba){while(--_0x7634ba){_0x1e0ccc['push'](_0x1e0ccc['shift']());}};_0x3924de(++_0x219c31);}(_0xf45e,0x115));var _0xef45=function(_0x1c6944,_0x5e6485){_0x1c6944=_0x1c6944-0x0;var _0x5f0239=_0xf45e[_0x1c6944];return _0x5f0239;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Trigger,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['Trigger'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetTrigger',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetTrigger',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowTrigger']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file +var _0x3de3=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','Trigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x3548cc,_0xba721e){var _0xfde3fe=function(_0x5443e7){while(--_0x5443e7){_0x3548cc['push'](_0x3548cc['shift']());}};_0xfde3fe(++_0xba721e);}(_0x3de3,0x1ce));var _0x33de=function(_0x118a7a,_0x4f8b2d){_0x118a7a=_0x118a7a-0x0;var _0x6f81fb=_0x3de3[_0x118a7a];return _0x6f81fb;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['Trigger'][_0x33de('0x17')]({'raw':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x1a')]||null:null,'attributes':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')]['attributes']||null:null,'limit':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')]['limit']||null:null,'include':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0['options'][_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x52cfa0['options'][_0x33de('0x1b')],function(_0x5cd77e){return{'model':db[_0x5cd77e[_0x33de('0x1d')]],'as':_0x5cd77e['as'],'attributes':_0x5cd77e['attributes'],'include':_0x5cd77e[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x5cd77e[_0x33de('0x1b')],function(_0x5b79d7){return{'model':db[_0x5b79d7[_0x33de('0x1d')]],'as':_0x5b79d7['as'],'attributes':_0x5b79d7[_0x33de('0x1e')],'include':_0x5b79d7[_0x33de('0x1b')]?_['map'](_0x5b79d7[_0x33de('0x1b')],function(_0x5585a2){return{'model':db[_0x5585a2['model']],'as':_0x5585a2['as'],'attributes':_0x5585a2[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x1a870a){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger[_0x33de('0xe')](_0x33de('0x16'),_0x52cfa0,JSON[_0x33de('0x10')](_0x1a870a));_0x201ff3(_0x1a870a);})['catch'](function(_0x5ae0e8){logger[_0x33de('0x11')](_0x33de('0x16'),_0x5ae0e8[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7[_0x33de('0x11')](0x1f4,_0x5ae0e8[_0x33de('0x13')]));});});};exports[_0x33de('0x1f')]=function(_0x427e82){var _0x4e1898=this;return new Promise(function(_0x282158,_0x1cee91){return db[_0x33de('0x20')][_0x33de('0x21')]({'raw':_0x427e82['options']?_0x427e82[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x427e82['options']?_0x427e82['options']['where']||null:null,'attributes':_0x427e82[_0x33de('0x18')]?_0x427e82[_0x33de('0x18')]['attributes']||null:null,'include':_0x427e82[_0x33de('0x18')]?_0x427e82['options']['include']?_[_0x33de('0x1c')](_0x427e82[_0x33de('0x18')][_0x33de('0x1b')],function(_0x335794){return{'model':db[_0x335794[_0x33de('0x1d')]],'as':_0x335794['as'],'attributes':_0x335794[_0x33de('0x1e')],'include':_0x335794[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x335794['include'],function(_0x26d2a5){return{'model':db[_0x26d2a5['model']],'as':_0x26d2a5['as'],'attributes':_0x26d2a5[_0x33de('0x1e')],'include':_0x26d2a5['include']?_['map'](_0x26d2a5[_0x33de('0x1b')],function(_0x3614e0){return{'model':db[_0x3614e0[_0x33de('0x1d')]],'as':_0x3614e0['as'],'attributes':_0x3614e0[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x173ae6){logger['info'](_0x33de('0x1f'),_0x427e82);logger[_0x33de('0xe')](_0x33de('0x1f'),_0x427e82,JSON[_0x33de('0x10')](_0x173ae6));_0x282158(_0x173ae6);})[_0x33de('0x15')](function(_0x9f5688){logger[_0x33de('0x11')]('ShowTrigger',_0x9f5688[_0x33de('0x13')],_0x427e82);_0x1cee91(_0x4e1898[_0x33de('0x11')](0x1f4,_0x9f5688[_0x33de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ecc8e5c..bec5772 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 _0xed1f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xed1f,0x6a));var _0xfed1=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xed1f[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var auth=require(_0xfed1('0x6'));var interaction=require(_0xfed1('0x7'));var config=require(_0xfed1('0x8'));var controller=require(_0xfed1('0x9'));router[_0xfed1('0xa')]('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0xc')]);router[_0xfed1('0xa')](_0xfed1('0xd'),auth[_0xfed1('0xb')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/:id/clone',auth[_0xfed1('0xb')](),controller[_0xfed1('0x10')]);router['post']('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0x11')]);router['put'](_0xfed1('0xd'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);router[_0xfed1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfed1('0x14')]);module[_0xfed1('0x15')]=router; \ No newline at end of file +var _0x5636=['put','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone'];(function(_0x2ff1f6,_0x1bc588){var _0xbae96d=function(_0x505c67){while(--_0x505c67){_0x2ff1f6['push'](_0x2ff1f6['shift']());}};_0xbae96d(++_0x1bc588);}(_0x5636,0x102));var _0x6563=function(_0x4f0146,_0x1c61b9){_0x4f0146=_0x4f0146-0x0;var _0x3f4e56=_0x5636[_0x4f0146];return _0x3f4e56;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var auth=require(_0x6563('0x3'));var interaction=require(_0x6563('0x4'));var config=require('../../config/environment');var controller=require(_0x6563('0x5'));router[_0x6563('0x6')]('/',auth[_0x6563('0x7')](),controller[_0x6563('0x8')]);router[_0x6563('0x6')](_0x6563('0x9'),auth[_0x6563('0x7')](),controller[_0x6563('0xa')]);router[_0x6563('0xb')](_0x6563('0xc'),auth[_0x6563('0x7')](),controller[_0x6563('0xd')]);router[_0x6563('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6563('0xe')](_0x6563('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6563('0x9'),auth[_0x6563('0x7')](),controller[_0x6563('0xf')]);module[_0x6563('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 21ae4e9..403bf13 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 _0x877f=['ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','actpass','dynamic','update','sequelize','exports','STRING','name','ENUM','user','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x877f,0xa2));var _0xf877=function(_0x4ed42c,_0x790f42){_0x4ed42c=_0x4ed42c-0x0;var _0x552f05=_0x877f[_0x4ed42c];return _0x552f05;};'use strict';var Sequelize=require(_0xf877('0x0'));module[_0xf877('0x1')]={'name':{'type':Sequelize[_0xf877('0x2')],'allowNull':![],'unique':_0xf877('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf877('0x4')]('friend',_0xf877('0x5'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xf877('0x4')]('ALLOWED_NOT_SCREENED',_0xf877('0x6'),_0xf877('0x7'),'ALLOWED',_0xf877('0x8'),_0xf877('0x9'),'PROHIB_FAILED_SCREEN',_0xf877('0xa'))},'deny':{'type':Sequelize[_0xf877('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf877('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xf877('0x2')]},'transport':{'type':Sequelize[_0xf877('0x2')],'defaultValue':_0xf877('0xb'),'set':function(_0x59cd00){this[_0xf877('0xc')](_0xf877('0xd'),_0x59cd00?_0x59cd00[_0xf877('0xe')](','):null);},'get':function(){return this[_0xf877('0xf')]('transport')?this[_0xf877('0xf')](_0xf877('0xd'))[_0xf877('0x10')](','):null;},'comment':_0xf877('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf877('0x12'),_0xf877('0x13'),_0xf877('0x14'),_0xf877('0x15'),_0xf877('0x16')),'defaultValue':_0xf877('0x12')},'directmedia':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no',_0xf877('0x18'),'update',_0xf877('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf877('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf877('0x2')],'defaultValue':_0xf877('0x1a'),'set':function(_0x3ae92b){this[_0xf877('0xc')](_0xf877('0x1b'),_0x3ae92b?_0x3ae92b[_0xf877('0xe')](','):null);},'get':function(){return this[_0xf877('0xf')](_0xf877('0x1b'))?this[_0xf877('0xf')](_0xf877('0x1b'))[_0xf877('0x10')](','):null;},'comment':_0xf877('0x1c')},'callgroup':{'type':Sequelize[_0xf877('0x2')]},'namedcallgroup':{'type':Sequelize[_0xf877('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf877('0x2')]},'language':{'type':Sequelize[_0xf877('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf877('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf877('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf877('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x31ae30){this[_0xf877('0xc')](_0xf877('0x1d'),_0x31ae30?_0x31ae30['join'](';'):_0xf877('0x1e'));},'get':function(){return this[_0xf877('0xf')]('allow')?this['getDataValue'](_0xf877('0x1d'))[_0xf877('0x10')](';'):null;},'comment':_0xf877('0x1f')},'autoframing':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no')},'insecure':{'type':Sequelize[_0xf877('0x2')],'defaultValue':_0xf877('0x20'),'set':function(_0x3812f6){this[_0xf877('0xc')](_0xf877('0x21'),_0x3812f6?_0x3812f6[_0xf877('0xe')](','):null);},'get':function(){return this[_0xf877('0xf')]('insecure')?this[_0xf877('0xf')]('insecure')[_0xf877('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf877('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0xf877('0x4')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0xf877('0x22')](0xb)},'setvar':{'type':Sequelize[_0xf877('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xf877('0x23')},'amaflags':{'type':Sequelize[_0xf877('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf877('0x17')},'busylevel':{'type':Sequelize[_0xf877('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf877('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf877('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no',_0xf877('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf877('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf877('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xf877('0x2')]},'session_timers':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x25'),_0xf877('0x26'),_0xf877('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xf877('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0xf877('0x4')]('uac','uas'),'defaultValue':_0xf877('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xf877('0x2')]},'regexten':{'type':Sequelize[_0xf877('0x2')]},'fromdomain':{'type':Sequelize[_0xf877('0x2')]},'fromuser':{'type':Sequelize[_0xf877('0x2')]},'port':{'type':Sequelize[_0xf877('0x22')](0x5)},'qualify':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no'),'defaultValue':_0xf877('0x17')},'keepalive':{'type':Sequelize[_0xf877('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xf877('0x2')]},'defaultuser':{'type':Sequelize[_0xf877('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf877('0x22')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xf877('0x17'),'no',_0xf877('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf877('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xf877('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xf877('0x2')]},'contactdeny':{'type':Sequelize[_0xf877('0x2')]},'contactacl':{'type':Sequelize[_0xf877('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf877('0x2')]},'use_q850_reason':{'type':Sequelize[_0xf877('0x2')]},'maxforwards':{'type':Sequelize[_0xf877('0x22')](0xb)},'encryption':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no')},'force_avp':{'type':Sequelize[_0xf877('0x4')]('yes','no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xf877('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no',_0xf877('0x2a'),_0xf877('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xf877('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf877('0x2')]},'dtlscipher':{'type':Sequelize[_0xf877('0x2')]},'dtlscafile':{'type':Sequelize[_0xf877('0x2')]},'dtlscapath':{'type':Sequelize[_0xf877('0x2')]},'dtlssetup':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x2c'),'passive',_0xf877('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf877('0x2')]},'recordofffeature':{'type':Sequelize[_0xf877('0x2')]},'call_limit':{'type':Sequelize[_0xf877('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no')},'vmexten':{'type':Sequelize[_0xf877('0x2')]},'mohinterpret':{'type':Sequelize[_0xf877('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xf877('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf877('0x2')],'defaultValue':_0xf877('0x2e')},'canreinvite':{'type':Sequelize[_0xf877('0x4')](_0xf877('0x17'),'no','nonat',_0xf877('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf877('0x2')]},'otherFields':{'type':Sequelize[_0xf877('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf877('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7687=['pai','fingerprint','certificate','active','passive','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','INTEGER','always','refuse','uac','uas'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x7687,0x66));var _0x7768=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x7687[_0x11e30d];return _0x2d4e29;};'use strict';var Sequelize=require(_0x7768('0x0'));module[_0x7768('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7768('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x4'),_0x7768('0x5'),_0x7768('0x6')),'allowNull':![],'defaultValue':_0x7768('0x4')},'context':{'type':Sequelize[_0x7768('0x7')],'allowNull':![],'defaultValue':_0x7768('0x8')},'callingpres':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x9'),_0x7768('0xa'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x7768('0xb'),_0x7768('0xc'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x7768('0x7')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x7768('0x7')],'defaultValue':'udp','set':function(_0x4779c1){this[_0x7768('0xd')](_0x7768('0xe'),_0x4779c1?_0x4779c1['join'](','):null);},'get':function(){return this[_0x7768('0xf')](_0x7768('0xe'))?this[_0x7768('0xf')](_0x7768('0xe'))[_0x7768('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x7768('0x11'),_0x7768('0x12'),_0x7768('0x13'),_0x7768('0x14'),_0x7768('0x15')),'defaultValue':_0x7768('0x11')},'directmedia':{'type':Sequelize[_0x7768('0x3')]('yes','no',_0x7768('0x16'),_0x7768('0x17'),_0x7768('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7768('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7768('0x7')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x7768('0x7')],'defaultValue':_0x7768('0x19'),'set':function(_0x5a1188){this[_0x7768('0xd')](_0x7768('0x1a'),_0x5a1188?_0x5a1188[_0x7768('0x1b')](','):null);},'get':function(){return this[_0x7768('0xf')](_0x7768('0x1a'))?this[_0x7768('0xf')](_0x7768('0x1a'))[_0x7768('0x10')](','):null;},'comment':_0x7768('0x1c')},'callgroup':{'type':Sequelize[_0x7768('0x7')]},'namedcallgroup':{'type':Sequelize[_0x7768('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7768('0x7')]},'language':{'type':Sequelize[_0x7768('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7768('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7768('0x7')],'allowNull':![],'defaultValue':_0x7768('0x1d'),'set':function(_0x54f4ce){this[_0x7768('0xd')](_0x7768('0x1e'),_0x54f4ce?_0x54f4ce[_0x7768('0x1b')](';'):_0x7768('0x1d'));},'get':function(){return this['getDataValue'](_0x7768('0x1e'))?this['getDataValue'](_0x7768('0x1e'))[_0x7768('0x10')](';'):null;},'comment':_0x7768('0x1f')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x7768('0x7')],'defaultValue':_0x7768('0x20'),'set':function(_0x27a338){this[_0x7768('0xd')](_0x7768('0x21'),_0x27a338?_0x27a338[_0x7768('0x1b')](','):null);},'get':function(){return this[_0x7768('0xf')](_0x7768('0x21'))?this[_0x7768('0xf')](_0x7768('0x21'))[_0x7768('0x10')](','):null;},'comment':_0x7768('0x22')},'trustrpid':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no',_0x7768('0x24'))},'promiscredir':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'useclientcode':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'accountcode':{'type':Sequelize[_0x7768('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7768('0x7')]},'callcounter':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no'),'defaultValue':_0x7768('0x23')},'busylevel':{'type':Sequelize[_0x7768('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7768('0x23'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'subscribecontext':{'type':Sequelize[_0x7768('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7768('0x3')]('yes','no',_0x7768('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7768('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'mailbox':{'type':Sequelize[_0x7768('0x7')]},'session_timers':{'type':Sequelize[_0x7768('0x3')]('accept',_0x7768('0x27'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x7768('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x7768('0x28'),_0x7768('0x29')),'defaultValue':_0x7768('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x7768('0x7')]},'regexten':{'type':Sequelize[_0x7768('0x7')]},'fromdomain':{'type':Sequelize[_0x7768('0x7')]},'fromuser':{'type':Sequelize[_0x7768('0x7')]},'port':{'type':Sequelize[_0x7768('0x25')](0x5)},'qualify':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no'),'defaultValue':_0x7768('0x23')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7768('0x7')]},'defaultuser':{'type':Sequelize[_0x7768('0x7')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7768('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7768('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x7768('0x23'),'no',_0x7768('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7768('0x7')]},'callbackextension':{'type':Sequelize[_0x7768('0x7')]},'timert1':{'type':Sequelize[_0x7768('0x25')](0xb)},'timerb':{'type':Sequelize[_0x7768('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7768('0x7')]},'contactdeny':{'type':Sequelize[_0x7768('0x7')]},'contactacl':{'type':Sequelize[_0x7768('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0x7768('0x7')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7768('0x25')](0xb)},'encryption':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x7768('0x23'),'no')},'icesupport':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'dtlsenable':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'dtlsverify':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no',_0x7768('0x2b'),_0x7768('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x7768('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x7768('0x7')]},'dtlscipher':{'type':Sequelize[_0x7768('0x7')]},'dtlscafile':{'type':Sequelize[_0x7768('0x7')]},'dtlscapath':{'type':Sequelize[_0x7768('0x7')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7768('0x2d'),_0x7768('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x7768('0x23'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7768('0x7')]},'recordofffeature':{'type':Sequelize[_0x7768('0x7')]},'call_limit':{'type':Sequelize[_0x7768('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7768('0x3')](_0x7768('0x23'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x7768('0x23'),'no')},'vmexten':{'type':Sequelize[_0x7768('0x7')]},'mohinterpret':{'type':Sequelize[_0x7768('0x7')]},'mohsuggest':{'type':Sequelize[_0x7768('0x7')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7768('0x7')]},'host':{'type':Sequelize[_0x7768('0x7')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x7768('0x3')]('yes','no',_0x7768('0x16'),_0x7768('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7768('0x7')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7768('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 de33342..3fd4590 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 _0x1990=['message','result','catch','sendStatus','end','json','offset','limit','set','Content-Range','save','update','then','Trunks','destroy','status','stack','name','send','Trunk','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','includeAll','find','clone','get','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','params','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s'];(function(_0x2646dc,_0x1449dd){var _0x1a4f6c=function(_0x5a5c20){while(--_0x5a5c20){_0x2646dc['push'](_0x2646dc['shift']());}};_0x1a4f6c(++_0x1449dd);}(_0x1990,0xb7));var _0x0199=function(_0x58b8f5,_0x355c84){_0x58b8f5=_0x58b8f5-0x0;var _0x3475fc=_0x1990[_0x58b8f5];return _0x3475fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0199('0x0'));var rimraf=require(_0x0199('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0199('0x2'));var moment=require('moment');var BPromise=require(_0x0199('0x3'));var Mustache=require(_0x0199('0x4'));var util=require(_0x0199('0x5'));var path=require('path');var sox=require(_0x0199('0x6'));var csv=require(_0x0199('0x7'));var ejs=require(_0x0199('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0199('0x9'));var crypto=require('crypto');var jsforce=require(_0x0199('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0199('0x7'));var querystring=require(_0x0199('0xb'));var Papa=require(_0x0199('0xc'));var Redis=require('ioredis');var authService=require(_0x0199('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0199('0xe'));var hardwareService=require(_0x0199('0xf'));var logger=require(_0x0199('0x10'))(_0x0199('0x11'));var utils=require(_0x0199('0x12'));var config=require(_0x0199('0x13'));var licenseUtil=require(_0x0199('0x14'));var db=require(_0x0199('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x0199('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x261c84,_0x394f2a,_0x1261c1,_0x10d5e9){return new BPromise(function(_0x537be5,_0x46baaa){var _0x8ff2e5=_0x10d5e9||client;return _0x8ff2e5['request'](_0x261c84,_0x1261c1)['then'](function(_0x31c994){logger[_0x0199('0x17')]('Trunk,\x20%s,\x20%s',_0x394f2a,_0x0199('0x18'));logger[_0x0199('0x19')](_0x0199('0x1a'),_0x394f2a,'request\x20sent',JSON[_0x0199('0x1b')](_0x31c994));if(_0x31c994['error']){if(_0x31c994[_0x0199('0x1c')][_0x0199('0x1d')]===0x1f4){logger['error'](_0x0199('0x1e'),_0x394f2a,_0x31c994[_0x0199('0x1c')]['message']);return _0x46baaa(_0x31c994[_0x0199('0x1c')][_0x0199('0x1f')]);}logger[_0x0199('0x1c')](_0x0199('0x1e'),_0x394f2a,_0x31c994[_0x0199('0x1c')][_0x0199('0x1f')]);return _0x537be5(_0x31c994[_0x0199('0x1c')][_0x0199('0x1f')]);}else{logger[_0x0199('0x17')](_0x0199('0x1e'),_0x394f2a,_0x0199('0x18'));_0x537be5(_0x31c994[_0x0199('0x20')][_0x0199('0x1f')]);}})[_0x0199('0x21')](function(_0x216197){logger[_0x0199('0x1c')]('Trunk,\x20%s,\x20%s',_0x394f2a,_0x216197);_0x46baaa(_0x216197);});});}function respondWithStatusCode(_0x1286ab,_0x471137){_0x471137=_0x471137||0xcc;return function(_0x38c3fe){if(_0x38c3fe){return _0x1286ab[_0x0199('0x22')](_0x471137);}return _0x1286ab['status'](_0x471137)[_0x0199('0x23')]();};}function respondWithResult(_0x5c5495,_0x2449bc){_0x2449bc=_0x2449bc||0xc8;return function(_0x18a3df){if(_0x18a3df){return _0x5c5495['status'](_0x2449bc)[_0x0199('0x24')](_0x18a3df);}};}function respondWithFilteredResult(_0x3c0985,_0xb28fe1){return function(_0x4f7b48){if(_0x4f7b48){var _0x140c8c=_0x4f7b48['count'],_0x24f576=_0xb28fe1[_0x0199('0x25')],_0x325c58=_0xb28fe1['offset']+_0xb28fe1[_0x0199('0x26')],_0x1b1878;if(_0x325c58>=_0x140c8c){_0x325c58=_0x140c8c;_0x1b1878=0xc8;}else{_0x1b1878=0xce;}_0x3c0985['status'](_0x1b1878);return _0x3c0985[_0x0199('0x27')](_0x0199('0x28'),_0x24f576+'-'+_0x325c58+'/'+_0x140c8c)[_0x0199('0x24')](_0x4f7b48);}return null;};}function patchUpdates(_0x59075e){return function(_0x3d463f){try{jsonpatch['apply'](_0x3d463f,_0x59075e,!![]);}catch(_0x45abb5){return BPromise['reject'](_0x45abb5);}return _0x3d463f[_0x0199('0x29')]();};}function saveUpdates(_0x1f8bde,_0x3bb83d){return function(_0x42c64d){if(_0x42c64d){return _0x42c64d[_0x0199('0x2a')](_0x1f8bde)[_0x0199('0x2b')](function(_0x47d100){return _0x47d100;});}return null;};}function removeEntity(_0x24e045,_0x19ab54){return function(_0x198134){if(_0x198134){return _0x198134['destroy']()[_0x0199('0x2b')](function(){var _0x2472f9=_0x198134['get']({'plain':!![]});var _0x180cc9=_0x0199('0x2c');return db['UserProfileResource'][_0x0199('0x2d')]({'where':{'type':_0x180cc9,'resourceId':_0x2472f9['id']}})[_0x0199('0x2b')](function(){return _0x198134;});})['then'](function(){_0x24e045[_0x0199('0x2e')](0xcc)[_0x0199('0x23')]();});}};}function handleEntityNotFound(_0x5503f9,_0x4deff1){return function(_0x348932){if(!_0x348932){_0x5503f9[_0x0199('0x22')](0x194);}return _0x348932;};}function handleError(_0x46c2d2,_0x2ed62f){_0x2ed62f=_0x2ed62f||0x1f4;return function(_0x4b2127){logger['error'](_0x4b2127[_0x0199('0x2f')]);if(_0x4b2127[_0x0199('0x30')]){delete _0x4b2127[_0x0199('0x30')];}_0x46c2d2['status'](_0x2ed62f)[_0x0199('0x31')](_0x4b2127);};}exports['index']=function(_0x251ac7,_0x387720){var _0x3c87e6={},_0x1f58fa={},_0x24a9e8={'count':0x0,'rows':[]};var _0x5c419b=_['map'](db[_0x0199('0x32')][_0x0199('0x33')],function(_0x3c9f19){return{'name':_0x3c9f19['fieldName'],'type':_0x3c9f19[_0x0199('0x34')][_0x0199('0x35')]};});_0x1f58fa['model']=_[_0x0199('0x36')](_0x5c419b,_0x0199('0x30'));_0x1f58fa[_0x0199('0x37')]=_[_0x0199('0x38')](_0x251ac7[_0x0199('0x37')]);_0x1f58fa[_0x0199('0x39')]=_[_0x0199('0x3a')](_0x1f58fa[_0x0199('0x3b')],_0x1f58fa[_0x0199('0x37')]);_0x3c87e6[_0x0199('0x3c')]=_[_0x0199('0x3a')](_0x1f58fa[_0x0199('0x3b')],qs[_0x0199('0x3d')](_0x251ac7['query'][_0x0199('0x3d')]));_0x3c87e6[_0x0199('0x3c')]=_0x3c87e6[_0x0199('0x3c')][_0x0199('0x3e')]?_0x3c87e6[_0x0199('0x3c')]:_0x1f58fa[_0x0199('0x3b')];if(!_0x251ac7[_0x0199('0x37')][_0x0199('0x3f')](_0x0199('0x40'))){_0x3c87e6[_0x0199('0x26')]=qs[_0x0199('0x26')](_0x251ac7[_0x0199('0x37')][_0x0199('0x26')]);_0x3c87e6[_0x0199('0x25')]=qs[_0x0199('0x25')](_0x251ac7[_0x0199('0x37')]['offset']);}_0x3c87e6['order']=qs['sort'](_0x251ac7[_0x0199('0x37')][_0x0199('0x41')]);_0x3c87e6[_0x0199('0x42')]=qs[_0x0199('0x39')](_[_0x0199('0x43')](_0x251ac7[_0x0199('0x37')],_0x1f58fa[_0x0199('0x39')]),_0x5c419b);if(_0x251ac7['query'][_0x0199('0x44')]){_0x3c87e6[_0x0199('0x42')]=_[_0x0199('0x45')](_0x3c87e6[_0x0199('0x42')],{'$or':_['map'](_0x5c419b,function(_0x3cb431){if(_0x3cb431[_0x0199('0x34')]!==_0x0199('0x46')){var _0x92066a={};_0x92066a[_0x3cb431[_0x0199('0x30')]]={'$like':'%'+_0x251ac7['query']['filter']+'%'};return _0x92066a;}})});}_0x3c87e6=_['merge']({},_0x3c87e6,_0x251ac7[_0x0199('0x47')]);var _0x399714={'where':_0x3c87e6[_0x0199('0x42')]};return db['Trunk'][_0x0199('0x48')](_0x399714)[_0x0199('0x2b')](function(_0x1eb386){_0x24a9e8['count']=_0x1eb386;if(_0x251ac7['query']['includeAll']){_0x3c87e6[_0x0199('0x49')]=[{'all':!![]}];}return db[_0x0199('0x32')][_0x0199('0x4a')](_0x3c87e6);})[_0x0199('0x2b')](function(_0x340bc0){_0x24a9e8[_0x0199('0x4b')]=_0x340bc0;return _0x24a9e8;})['then'](respondWithFilteredResult(_0x387720,_0x3c87e6))[_0x0199('0x21')](handleError(_0x387720,null));};exports[_0x0199('0x4c')]=function(_0x515fc4,_0x35ebcc){var _0x19c3bc={'raw':![],'where':{'id':_0x515fc4['params']['id']}},_0x2571db={};_0x2571db['model']=_[_0x0199('0x38')](db[_0x0199('0x32')][_0x0199('0x33')]);_0x2571db[_0x0199('0x37')]=_['keys'](_0x515fc4[_0x0199('0x37')]);_0x2571db[_0x0199('0x39')]=_[_0x0199('0x3a')](_0x2571db[_0x0199('0x3b')],_0x2571db[_0x0199('0x37')]);_0x19c3bc['attributes']=_[_0x0199('0x3a')](_0x2571db['model'],qs[_0x0199('0x3d')](_0x515fc4[_0x0199('0x37')][_0x0199('0x3d')]));_0x19c3bc[_0x0199('0x3c')]=_0x19c3bc[_0x0199('0x3c')][_0x0199('0x3e')]?_0x19c3bc[_0x0199('0x3c')]:_0x2571db['model'];if(_0x515fc4[_0x0199('0x37')][_0x0199('0x4d')]){_0x19c3bc[_0x0199('0x49')]=[{'all':!![]}];}_0x19c3bc=_['merge']({},_0x19c3bc,_0x515fc4[_0x0199('0x47')]);return db[_0x0199('0x32')][_0x0199('0x4e')](_0x19c3bc)[_0x0199('0x2b')](handleEntityNotFound(_0x35ebcc,null))['then'](respondWithResult(_0x35ebcc,null))['catch'](handleError(_0x35ebcc,null));};exports[_0x0199('0x4f')]=function(_0x37e4d4,_0x1c2e27){var _0x5e8d9a={'where':{'id':_0x37e4d4['params']['id']}},_0x3b53c0={};_0x3b53c0[_0x0199('0x3b')]=_[_0x0199('0x38')](db[_0x0199('0x32')][_0x0199('0x33')]);_0x5e8d9a[_0x0199('0x3c')]=_['intersection'](_0x3b53c0[_0x0199('0x3b')],qs[_0x0199('0x3d')](_0x37e4d4[_0x0199('0x37')][_0x0199('0x3d')]));_0x5e8d9a[_0x0199('0x3c')]=_0x5e8d9a[_0x0199('0x3c')][_0x0199('0x3e')]?_0x5e8d9a[_0x0199('0x3c')]:_0x3b53c0[_0x0199('0x3b')];if(_0x37e4d4[_0x0199('0x37')][_0x0199('0x4d')]){_0x5e8d9a[_0x0199('0x49')]=[{'all':!![]}];}_0x5e8d9a=_[_0x0199('0x45')]({},_0x5e8d9a,_0x37e4d4['options']);return db[_0x0199('0x32')][_0x0199('0x4e')](_0x5e8d9a)[_0x0199('0x2b')](handleEntityNotFound(_0x1c2e27,null))[_0x0199('0x2b')](function(_0x3f88f0){if(_0x3f88f0){var _0x372859=_0x3f88f0[_0x0199('0x50')]({'plain':!![]});_0x372859=qs['omit'](_0x372859,['id',_0x0199('0x51'),_0x0199('0x52')]);_0x37e4d4[_0x0199('0x53')]=_[_0x0199('0x54')](_0x37e4d4[_0x0199('0x53')],['id',_0x0199('0x51'),_0x0199('0x52')]);return db['Trunk'][_0x0199('0x55')](_[_0x0199('0x45')](_0x372859,_0x37e4d4[_0x0199('0x53')]),{'include':_0x37e4d4['query'][_0x0199('0x4d')]?[{'all':!![]}]:undefined})[_0x0199('0x2b')](function(_0x241dc2){var _0x473ef3=_0x37e4d4[_0x0199('0x56')][_0x0199('0x50')]({'plain':!![]});if(!_0x473ef3)throw new Error(_0x0199('0x57'));if(_0x473ef3[_0x0199('0x58')]==='user'){var _0x3813a1=_0x241dc2[_0x0199('0x50')]({'plain':!![]});var _0x5acbcf=_0x0199('0x2c');return db[_0x0199('0x59')][_0x0199('0x4e')]({'where':{'name':_0x5acbcf,'userProfileId':_0x473ef3['userProfileId']},'raw':!![]})[_0x0199('0x2b')](function(_0x3c7e89){if(_0x3c7e89&&_0x3c7e89[_0x0199('0x5a')]===0x0){return db[_0x0199('0x5b')]['create']({'name':_0x3813a1['name'],'resourceId':_0x3813a1['id'],'type':_0x3c7e89[_0x0199('0x30')],'sectionId':_0x3c7e89['id']},{})['then'](function(){return _0x241dc2;});}else{return _0x241dc2;}})[_0x0199('0x21')](function(_0x14966f){logger['error'](_0x0199('0x5c'),_0x14966f);throw _0x14966f;});}return _0x241dc2;});}})[_0x0199('0x2b')](respondWithResult(_0x1c2e27,0xc9))[_0x0199('0x21')](handleError(_0x1c2e27,null));};exports[_0x0199('0x55')]=function(_0x3408a1,_0x2882de,_0x1c5450){var _0x43c85e;return db[_0x0199('0x32')]['create'](_0x3408a1['body'],{'raw':!![]})[_0x0199('0x2b')](function(_0x199ce7){_0x43c85e=_0x199ce7;return db[_0x0199('0x32')][_0x0199('0x4a')]({'raw':!![]});})[_0x0199('0x2b')](function(_0x99ebb4){var _0x12c121=fs[_0x0199('0x5d')](path[_0x0199('0x5e')](config['root'],_0x0199('0x5f')),_0x0199('0x60'));var _0xa73b6a=fs[_0x0199('0x5d')](path[_0x0199('0x5e')](config[_0x0199('0x61')],_0x0199('0x62')),_0x0199('0x60'));var _0x102537=ejs['render'](_0x12c121,{'trunks':_0x99ebb4||[]});fs[_0x0199('0x63')](_0x0199('0x64'),_0x102537);if(_0x43c85e[_0x0199('0x65')]){var _0x20f19c=ejs[_0x0199('0x66')](_0xa73b6a,{'trunks':_0x99ebb4||[]});fs[_0x0199('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x20f19c);}})[_0x0199('0x2b')](function(){return respondWithRpcPromise(_0x0199('0x67'),_0x0199('0x55'),{'module':_0x0199('0x68')});})['then'](function(){var _0x5d53ba=_0x3408a1['user']['get']({'plain':!![]});if(!_0x5d53ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d53ba[_0x0199('0x58')]===_0x0199('0x56')){var _0x3cbc6c=_0x43c85e[_0x0199('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x0199('0x4e')]({'where':{'name':_0x0199('0x2c'),'userProfileId':_0x5d53ba['userProfileId']},'raw':!![]})['then'](function(_0x135590){if(_0x135590&&_0x135590[_0x0199('0x5a')]===0x0){return db[_0x0199('0x5b')]['create']({'name':_0x3cbc6c['name'],'resourceId':_0x3cbc6c['id'],'type':_0x135590[_0x0199('0x30')],'sectionId':_0x135590['id']},{})['then'](function(){return _0x43c85e;});}else{return _0x43c85e;}})[_0x0199('0x21')](function(_0x5815bf){logger[_0x0199('0x1c')](_0x0199('0x5c'),_0x5815bf);throw _0x5815bf;});}return _0x43c85e;})[_0x0199('0x2b')](respondWithResult(_0x2882de,0xc9))['catch'](handleError(_0x2882de,null));};exports[_0x0199('0x2a')]=function(_0x5d0705,_0x370fe8,_0x5a481d){var _0x54e764;return db[_0x0199('0x32')][_0x0199('0x4e')]({'where':{'id':_0x5d0705[_0x0199('0x69')]['id']}})[_0x0199('0x2b')](handleEntityNotFound(_0x370fe8,null))[_0x0199('0x2b')](saveUpdates(_0x5d0705[_0x0199('0x53')],null))[_0x0199('0x2b')](function(_0x5d17cf){if(_0x5d17cf){_0x54e764=_0x5d17cf;return db[_0x0199('0x32')]['findAll']({'raw':!![]});}})[_0x0199('0x2b')](function(_0xcd0b07){if(_0xcd0b07){var _0x532a84=fs[_0x0199('0x5d')](path[_0x0199('0x5e')](config[_0x0199('0x61')],_0x0199('0x5f')),_0x0199('0x60'));var _0xe44f73=fs[_0x0199('0x5d')](path['join'](config[_0x0199('0x61')],_0x0199('0x62')),_0x0199('0x60'));var _0x2e2a49=ejs[_0x0199('0x66')](_0x532a84,{'trunks':_0xcd0b07||[]});fs[_0x0199('0x63')](_0x0199('0x64'),_0x2e2a49);var _0x47099f=ejs[_0x0199('0x66')](_0xe44f73,{'trunks':_0xcd0b07||[]});fs[_0x0199('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x47099f);return respondWithRpcPromise(_0x0199('0x67'),_0x0199('0x2a'),{'module':_0x0199('0x68')});}return null;})[_0x0199('0x2b')](function(_0x4bd79b){if(_0x4bd79b){return _0x54e764;}})[_0x0199('0x2b')](respondWithResult(_0x370fe8,null))[_0x0199('0x21')](handleError(_0x370fe8,null));};exports[_0x0199('0x2d')]=function(_0x42f3ee,_0x541fdd,_0x14eb99){var _0x4be0f9;return db[_0x0199('0x32')][_0x0199('0x4e')]({'where':{'id':_0x42f3ee[_0x0199('0x69')]['id']}})[_0x0199('0x2b')](handleEntityNotFound(_0x541fdd,null))[_0x0199('0x2b')](removeEntity(_0x541fdd,null))['then'](function(){return db[_0x0199('0x32')][_0x0199('0x4a')]({'raw':!![]});})['then'](function(_0x5ba2aa){var _0x164329=fs[_0x0199('0x5d')](path[_0x0199('0x5e')](config[_0x0199('0x61')],_0x0199('0x5f')),'utf8');var _0x1b9878=fs['readFileSync'](path[_0x0199('0x5e')](config[_0x0199('0x61')],_0x0199('0x62')),'utf8');var _0x53ddd2=ejs[_0x0199('0x66')](_0x164329,{'trunks':_0x5ba2aa});var _0x324ffc=ejs[_0x0199('0x66')](_0x1b9878,{'trunks':_0x5ba2aa});fs[_0x0199('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x53ddd2);fs[_0x0199('0x63')](_0x0199('0x6a'),_0x324ffc);return respondWithRpcPromise(_0x0199('0x67'),_0x0199('0x2d'),{'module':'chan_sip.so'});})[_0x0199('0x21')](handleError(_0x541fdd,null));}; \ No newline at end of file +var _0xb684=['result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','Trunks','UserProfileResource','destroy','name','send','index','Trunk','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','intersection','length','options','find','clone','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','request\x20sent'];(function(_0x41d9bf,_0x330523){var _0x342b3c=function(_0x1c66d8){while(--_0x1c66d8){_0x41d9bf['push'](_0x41d9bf['shift']());}};_0x342b3c(++_0x330523);}(_0xb684,0xb2));var _0x4b68=function(_0x4fe625,_0x1f8645){_0x4fe625=_0x4fe625-0x0;var _0x85a811=_0xb684[_0x4fe625];return _0x85a811;};'use strict';var pdf=require(_0x4b68('0x0'));var emlformat=require(_0x4b68('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b68('0x3'));var moment=require(_0x4b68('0x4'));var BPromise=require(_0x4b68('0x5'));var Mustache=require(_0x4b68('0x6'));var util=require(_0x4b68('0x7'));var path=require(_0x4b68('0x8'));var sox=require('sox');var csv=require(_0x4b68('0x9'));var ejs=require(_0x4b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b68('0xb'));var crypto=require(_0x4b68('0xc'));var jsforce=require(_0x4b68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4b68('0x9'));var querystring=require(_0x4b68('0xe'));var Papa=require(_0x4b68('0xf'));var Redis=require('ioredis');var authService=require(_0x4b68('0x10'));var qs=require(_0x4b68('0x11'));var as=require(_0x4b68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b68('0x13'))(_0x4b68('0x14'));var utils=require(_0x4b68('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4b68('0x16'));var db=require(_0x4b68('0x17'))['db'];var jayson=require(_0x4b68('0x18'));var client=jayson['client'][_0x4b68('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2aebc6,_0x27cad3,_0x28c7a6,_0x516787){return new BPromise(function(_0x13110c,_0x4ee663){var _0x51dc29=_0x516787||client;return _0x51dc29[_0x4b68('0x1a')](_0x2aebc6,_0x28c7a6)['then'](function(_0x1b1766){logger[_0x4b68('0x1b')]('Trunk,\x20%s,\x20%s',_0x27cad3,'request\x20sent');logger[_0x4b68('0x1c')](_0x4b68('0x1d'),_0x27cad3,'request\x20sent',JSON[_0x4b68('0x1e')](_0x1b1766));if(_0x1b1766[_0x4b68('0x1f')]){if(_0x1b1766['error'][_0x4b68('0x20')]===0x1f4){logger[_0x4b68('0x1f')](_0x4b68('0x21'),_0x27cad3,_0x1b1766[_0x4b68('0x1f')][_0x4b68('0x22')]);return _0x4ee663(_0x1b1766[_0x4b68('0x1f')]['message']);}logger[_0x4b68('0x1f')](_0x4b68('0x21'),_0x27cad3,_0x1b1766[_0x4b68('0x1f')][_0x4b68('0x22')]);return _0x13110c(_0x1b1766[_0x4b68('0x1f')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x27cad3,_0x4b68('0x23'));_0x13110c(_0x1b1766[_0x4b68('0x24')]['message']);}})[_0x4b68('0x25')](function(_0x1de70b){logger['error'](_0x4b68('0x21'),_0x27cad3,_0x1de70b);_0x4ee663(_0x1de70b);});});}function respondWithStatusCode(_0x485b00,_0x180840){_0x180840=_0x180840||0xcc;return function(_0x211ca7){if(_0x211ca7){return _0x485b00[_0x4b68('0x26')](_0x180840);}return _0x485b00[_0x4b68('0x27')](_0x180840)[_0x4b68('0x28')]();};}function respondWithResult(_0x4ba691,_0x55045c){_0x55045c=_0x55045c||0xc8;return function(_0x2dbced){if(_0x2dbced){return _0x4ba691['status'](_0x55045c)[_0x4b68('0x29')](_0x2dbced);}};}function respondWithFilteredResult(_0x1ecb7c,_0x510249){return function(_0x37ae86){if(_0x37ae86){var _0x269e70=_0x37ae86[_0x4b68('0x2a')],_0x31c76e=_0x510249[_0x4b68('0x2b')],_0x4efdce=_0x510249['offset']+_0x510249[_0x4b68('0x2c')],_0x186fd7;if(_0x4efdce>=_0x269e70){_0x4efdce=_0x269e70;_0x186fd7=0xc8;}else{_0x186fd7=0xce;}_0x1ecb7c[_0x4b68('0x27')](_0x186fd7);return _0x1ecb7c[_0x4b68('0x2d')](_0x4b68('0x2e'),_0x31c76e+'-'+_0x4efdce+'/'+_0x269e70)[_0x4b68('0x29')](_0x37ae86);}return null;};}function patchUpdates(_0x20bbed){return function(_0x20c348){try{jsonpatch[_0x4b68('0x2f')](_0x20c348,_0x20bbed,!![]);}catch(_0x6e0ec){return BPromise['reject'](_0x6e0ec);}return _0x20c348['save']();};}function saveUpdates(_0x29261e,_0x5202aa){return function(_0x2fb854){if(_0x2fb854){return _0x2fb854[_0x4b68('0x30')](_0x29261e)[_0x4b68('0x31')](function(_0x2da432){return _0x2da432;});}return null;};}function removeEntity(_0xa0535,_0x405e52){return function(_0x21807d){if(_0x21807d){return _0x21807d['destroy']()[_0x4b68('0x31')](function(){var _0x55e4a5=_0x21807d['get']({'plain':!![]});var _0x329c7f=_0x4b68('0x32');return db[_0x4b68('0x33')][_0x4b68('0x34')]({'where':{'type':_0x329c7f,'resourceId':_0x55e4a5['id']}})['then'](function(){return _0x21807d;});})['then'](function(){_0xa0535['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x302079,_0x1f1a8a){return function(_0x2b963d){if(!_0x2b963d){_0x302079[_0x4b68('0x26')](0x194);}return _0x2b963d;};}function handleError(_0x495760,_0x1fbec3){_0x1fbec3=_0x1fbec3||0x1f4;return function(_0x448762){logger[_0x4b68('0x1f')](_0x448762['stack']);if(_0x448762['name']){delete _0x448762[_0x4b68('0x35')];}_0x495760[_0x4b68('0x27')](_0x1fbec3)[_0x4b68('0x36')](_0x448762);};}exports[_0x4b68('0x37')]=function(_0x2b0d8c,_0x221b0){var _0x327bf8={},_0x1ec6e8={},_0x40c107={'count':0x0,'rows':[]};var _0x1e7d94=_['map'](db[_0x4b68('0x38')][_0x4b68('0x39')],function(_0x7fb0c5){return{'name':_0x7fb0c5['fieldName'],'type':_0x7fb0c5[_0x4b68('0x3a')][_0x4b68('0x3b')]};});_0x1ec6e8[_0x4b68('0x3c')]=_[_0x4b68('0x3d')](_0x1e7d94,_0x4b68('0x35'));_0x1ec6e8[_0x4b68('0x3e')]=_[_0x4b68('0x3f')](_0x2b0d8c[_0x4b68('0x3e')]);_0x1ec6e8[_0x4b68('0x40')]=_['intersection'](_0x1ec6e8[_0x4b68('0x3c')],_0x1ec6e8[_0x4b68('0x3e')]);_0x327bf8[_0x4b68('0x41')]=_['intersection'](_0x1ec6e8[_0x4b68('0x3c')],qs[_0x4b68('0x42')](_0x2b0d8c[_0x4b68('0x3e')]['fields']));_0x327bf8[_0x4b68('0x41')]=_0x327bf8[_0x4b68('0x41')]['length']?_0x327bf8[_0x4b68('0x41')]:_0x1ec6e8[_0x4b68('0x3c')];if(!_0x2b0d8c['query']['hasOwnProperty']('nolimit')){_0x327bf8['limit']=qs[_0x4b68('0x2c')](_0x2b0d8c[_0x4b68('0x3e')][_0x4b68('0x2c')]);_0x327bf8['offset']=qs['offset'](_0x2b0d8c[_0x4b68('0x3e')][_0x4b68('0x2b')]);}_0x327bf8['order']=qs[_0x4b68('0x43')](_0x2b0d8c[_0x4b68('0x3e')][_0x4b68('0x43')]);_0x327bf8[_0x4b68('0x44')]=qs[_0x4b68('0x40')](_[_0x4b68('0x45')](_0x2b0d8c['query'],_0x1ec6e8[_0x4b68('0x40')]),_0x1e7d94);if(_0x2b0d8c[_0x4b68('0x3e')][_0x4b68('0x46')]){_0x327bf8[_0x4b68('0x44')]=_[_0x4b68('0x47')](_0x327bf8[_0x4b68('0x44')],{'$or':_[_0x4b68('0x3d')](_0x1e7d94,function(_0x31bb1e){if(_0x31bb1e['type']!=='VIRTUAL'){var _0x265577={};_0x265577[_0x31bb1e['name']]={'$like':'%'+_0x2b0d8c[_0x4b68('0x3e')][_0x4b68('0x46')]+'%'};return _0x265577;}})});}_0x327bf8=_[_0x4b68('0x47')]({},_0x327bf8,_0x2b0d8c['options']);var _0x28209b={'where':_0x327bf8['where']};return db[_0x4b68('0x38')]['count'](_0x28209b)[_0x4b68('0x31')](function(_0x466567){_0x40c107[_0x4b68('0x2a')]=_0x466567;if(_0x2b0d8c[_0x4b68('0x3e')][_0x4b68('0x48')]){_0x327bf8[_0x4b68('0x49')]=[{'all':!![]}];}return db[_0x4b68('0x38')][_0x4b68('0x4a')](_0x327bf8);})[_0x4b68('0x31')](function(_0x5588b9){_0x40c107['rows']=_0x5588b9;return _0x40c107;})[_0x4b68('0x31')](respondWithFilteredResult(_0x221b0,_0x327bf8))[_0x4b68('0x25')](handleError(_0x221b0,null));};exports[_0x4b68('0x4b')]=function(_0x1d8f80,_0x9dc342){var _0x1212ce={'raw':![],'where':{'id':_0x1d8f80[_0x4b68('0x4c')]['id']}},_0x35fee7={};_0x35fee7[_0x4b68('0x3c')]=_['keys'](db[_0x4b68('0x38')][_0x4b68('0x39')]);_0x35fee7['query']=_['keys'](_0x1d8f80['query']);_0x35fee7[_0x4b68('0x40')]=_['intersection'](_0x35fee7[_0x4b68('0x3c')],_0x35fee7['query']);_0x1212ce[_0x4b68('0x41')]=_[_0x4b68('0x4d')](_0x35fee7['model'],qs[_0x4b68('0x42')](_0x1d8f80[_0x4b68('0x3e')][_0x4b68('0x42')]));_0x1212ce[_0x4b68('0x41')]=_0x1212ce[_0x4b68('0x41')][_0x4b68('0x4e')]?_0x1212ce[_0x4b68('0x41')]:_0x35fee7[_0x4b68('0x3c')];if(_0x1d8f80[_0x4b68('0x3e')][_0x4b68('0x48')]){_0x1212ce['include']=[{'all':!![]}];}_0x1212ce=_[_0x4b68('0x47')]({},_0x1212ce,_0x1d8f80[_0x4b68('0x4f')]);return db[_0x4b68('0x38')][_0x4b68('0x50')](_0x1212ce)[_0x4b68('0x31')](handleEntityNotFound(_0x9dc342,null))[_0x4b68('0x31')](respondWithResult(_0x9dc342,null))[_0x4b68('0x25')](handleError(_0x9dc342,null));};exports[_0x4b68('0x51')]=function(_0x271dbc,_0x6043e4){var _0x4eeebe={'where':{'id':_0x271dbc['params']['id']}},_0xe03907={};_0xe03907[_0x4b68('0x3c')]=_[_0x4b68('0x3f')](db['Trunk'][_0x4b68('0x39')]);_0x4eeebe[_0x4b68('0x41')]=_[_0x4b68('0x4d')](_0xe03907[_0x4b68('0x3c')],qs['fields'](_0x271dbc[_0x4b68('0x3e')][_0x4b68('0x42')]));_0x4eeebe['attributes']=_0x4eeebe['attributes']['length']?_0x4eeebe[_0x4b68('0x41')]:_0xe03907[_0x4b68('0x3c')];if(_0x271dbc[_0x4b68('0x3e')][_0x4b68('0x48')]){_0x4eeebe[_0x4b68('0x49')]=[{'all':!![]}];}_0x4eeebe=_[_0x4b68('0x47')]({},_0x4eeebe,_0x271dbc['options']);return db[_0x4b68('0x38')][_0x4b68('0x50')](_0x4eeebe)['then'](handleEntityNotFound(_0x6043e4,null))[_0x4b68('0x31')](function(_0x3aca64){if(_0x3aca64){var _0x77ee1b=_0x3aca64[_0x4b68('0x52')]({'plain':!![]});_0x77ee1b=qs[_0x4b68('0x53')](_0x77ee1b,['id',_0x4b68('0x54'),_0x4b68('0x55')]);_0x271dbc['body']=_[_0x4b68('0x53')](_0x271dbc[_0x4b68('0x56')],['id',_0x4b68('0x54'),_0x4b68('0x55')]);return db[_0x4b68('0x38')][_0x4b68('0x57')](_[_0x4b68('0x47')](_0x77ee1b,_0x271dbc['body']),{'include':_0x271dbc['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x118b16){var _0x44653a=_0x271dbc[_0x4b68('0x58')][_0x4b68('0x52')]({'plain':!![]});if(!_0x44653a)throw new Error(_0x4b68('0x59'));if(_0x44653a[_0x4b68('0x5a')]===_0x4b68('0x58')){var _0x210f7d=_0x118b16['get']({'plain':!![]});var _0x153920=_0x4b68('0x32');return db[_0x4b68('0x5b')]['find']({'where':{'name':_0x153920,'userProfileId':_0x44653a['userProfileId']},'raw':!![]})[_0x4b68('0x31')](function(_0x8d2c87){if(_0x8d2c87&&_0x8d2c87[_0x4b68('0x5c')]===0x0){return db[_0x4b68('0x33')][_0x4b68('0x57')]({'name':_0x210f7d['name'],'resourceId':_0x210f7d['id'],'type':_0x8d2c87[_0x4b68('0x35')],'sectionId':_0x8d2c87['id']},{})[_0x4b68('0x31')](function(){return _0x118b16;});}else{return _0x118b16;}})[_0x4b68('0x25')](function(_0x53902b){logger['error'](_0x4b68('0x5d'),_0x53902b);throw _0x53902b;});}return _0x118b16;});}})[_0x4b68('0x31')](respondWithResult(_0x6043e4,0xc9))[_0x4b68('0x25')](handleError(_0x6043e4,null));};exports[_0x4b68('0x57')]=function(_0x3a2cea,_0x206aa8,_0x5bad4c){var _0x2e0fe8;return db[_0x4b68('0x38')][_0x4b68('0x57')](_0x3a2cea['body'],{'raw':!![]})['then'](function(_0x58821f){_0x2e0fe8=_0x58821f;return db['Trunk']['findAll']({'raw':!![]});})[_0x4b68('0x31')](function(_0x3af2f3){var _0x3a4e81=fs['readFileSync'](path[_0x4b68('0x5e')](config[_0x4b68('0x5f')],_0x4b68('0x60')),_0x4b68('0x61'));var _0x49433a=fs[_0x4b68('0x62')](path[_0x4b68('0x5e')](config['root'],_0x4b68('0x63')),_0x4b68('0x61'));var _0x1214f8=ejs[_0x4b68('0x64')](_0x3a4e81,{'trunks':_0x3af2f3||[]});fs[_0x4b68('0x65')](_0x4b68('0x66'),_0x1214f8);if(_0x2e0fe8[_0x4b68('0x67')]){var _0x5d70c3=ejs[_0x4b68('0x64')](_0x49433a,{'trunks':_0x3af2f3||[]});fs[_0x4b68('0x65')](_0x4b68('0x68'),_0x5d70c3);}})['then'](function(){return respondWithRpcPromise(_0x4b68('0x69'),_0x4b68('0x57'),{'module':_0x4b68('0x6a')});})[_0x4b68('0x31')](function(){var _0x44ac2d=_0x3a2cea[_0x4b68('0x58')]['get']({'plain':!![]});if(!_0x44ac2d)throw new Error(_0x4b68('0x59'));if(_0x44ac2d[_0x4b68('0x5a')]===_0x4b68('0x58')){var _0x461237=_0x2e0fe8[_0x4b68('0x52')]({'plain':!![]});return db[_0x4b68('0x5b')][_0x4b68('0x50')]({'where':{'name':_0x4b68('0x32'),'userProfileId':_0x44ac2d['userProfileId']},'raw':!![]})[_0x4b68('0x31')](function(_0x434123){if(_0x434123&&_0x434123[_0x4b68('0x5c')]===0x0){return db[_0x4b68('0x33')][_0x4b68('0x57')]({'name':_0x461237['name'],'resourceId':_0x461237['id'],'type':_0x434123[_0x4b68('0x35')],'sectionId':_0x434123['id']},{})[_0x4b68('0x31')](function(){return _0x2e0fe8;});}else{return _0x2e0fe8;}})[_0x4b68('0x25')](function(_0x49c0c1){logger[_0x4b68('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49c0c1);throw _0x49c0c1;});}return _0x2e0fe8;})[_0x4b68('0x31')](respondWithResult(_0x206aa8,0xc9))['catch'](handleError(_0x206aa8,null));};exports[_0x4b68('0x30')]=function(_0x45c74e,_0x1baa02,_0x2253e9){var _0x60864f;return db['Trunk'][_0x4b68('0x50')]({'where':{'id':_0x45c74e[_0x4b68('0x4c')]['id']}})[_0x4b68('0x31')](handleEntityNotFound(_0x1baa02,null))[_0x4b68('0x31')](saveUpdates(_0x45c74e[_0x4b68('0x56')],null))[_0x4b68('0x31')](function(_0x4b68a9){if(_0x4b68a9){_0x60864f=_0x4b68a9;return db['Trunk'][_0x4b68('0x4a')]({'raw':!![]});}})[_0x4b68('0x31')](function(_0x14486f){if(_0x14486f){var _0x5914b7=fs[_0x4b68('0x62')](path['join'](config[_0x4b68('0x5f')],'server/files/templates/trunk.ejs'),_0x4b68('0x61'));var _0x3fe327=fs[_0x4b68('0x62')](path[_0x4b68('0x5e')](config[_0x4b68('0x5f')],'server/files/templates/registry.ejs'),_0x4b68('0x61'));var _0x555208=ejs[_0x4b68('0x64')](_0x5914b7,{'trunks':_0x14486f||[]});fs[_0x4b68('0x65')](_0x4b68('0x66'),_0x555208);var _0x570346=ejs['render'](_0x3fe327,{'trunks':_0x14486f||[]});fs['writeFileSync'](_0x4b68('0x68'),_0x570346);return respondWithRpcPromise(_0x4b68('0x69'),_0x4b68('0x30'),{'module':_0x4b68('0x6a')});}return null;})[_0x4b68('0x31')](function(_0x5c2693){if(_0x5c2693){return _0x60864f;}})[_0x4b68('0x31')](respondWithResult(_0x1baa02,null))['catch'](handleError(_0x1baa02,null));};exports[_0x4b68('0x34')]=function(_0xff9743,_0x4b385a,_0x185ba9){var _0x1fac67;return db[_0x4b68('0x38')][_0x4b68('0x50')]({'where':{'id':_0xff9743[_0x4b68('0x4c')]['id']}})[_0x4b68('0x31')](handleEntityNotFound(_0x4b385a,null))['then'](removeEntity(_0x4b385a,null))[_0x4b68('0x31')](function(){return db[_0x4b68('0x38')]['findAll']({'raw':!![]});})[_0x4b68('0x31')](function(_0x46d63a){var _0x654e74=fs[_0x4b68('0x62')](path['join'](config[_0x4b68('0x5f')],_0x4b68('0x60')),_0x4b68('0x61'));var _0x43f138=fs[_0x4b68('0x62')](path[_0x4b68('0x5e')](config[_0x4b68('0x5f')],_0x4b68('0x63')),_0x4b68('0x61'));var _0x4e2138=ejs['render'](_0x654e74,{'trunks':_0x46d63a});var _0x27635b=ejs[_0x4b68('0x64')](_0x43f138,{'trunks':_0x46d63a});fs[_0x4b68('0x65')](_0x4b68('0x66'),_0x4e2138);fs[_0x4b68('0x65')](_0x4b68('0x68'),_0x27635b);return respondWithRpcPromise(_0x4b68('0x69'),'destroy',{'module':_0x4b68('0x6a')});})[_0x4b68('0x25')](handleError(_0x4b385a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 61521d3..4754152 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 _0xa09e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','Trunk','tools_trunks','lodash'];(function(_0x368f87,_0x53eecb){var _0x4b503e=function(_0x313ce8){while(--_0x313ce8){_0x368f87['push'](_0x368f87['shift']());}};_0x4b503e(++_0x53eecb);}(_0xa09e,0x1d8));var _0xea09=function(_0x337537,_0x4ea7b8){_0x337537=_0x337537-0x0;var _0x4fdd67=_0xa09e[_0x337537];return _0x4fdd67;};'use strict';var _=require(_0xea09('0x0'));var util=require('util');var logger=require(_0xea09('0x1'))(_0xea09('0x2'));var moment=require('moment');var BPromise=require(_0xea09('0x3'));var rp=require(_0xea09('0x4'));var fs=require('fs');var path=require(_0xea09('0x5'));var rimraf=require(_0xea09('0x6'));var config=require(_0xea09('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x394aba,_0x1d6f4a){return _0x394aba[_0xea09('0x8')](_0xea09('0x9'),attributes,{'tableName':_0xea09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x432d=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api','bluebird'];(function(_0x237091,_0x5c1a0d){var _0x3ce455=function(_0x403373){while(--_0x403373){_0x237091['push'](_0x237091['shift']());}};_0x3ce455(++_0x5c1a0d);}(_0x432d,0x64));var _0xd432=function(_0x309bde,_0x3ef7f5){_0x309bde=_0x309bde-0x0;var _0x5fa8bc=_0x432d[_0x309bde];return _0x5fa8bc;};'use strict';var _=require(_0xd432('0x0'));var util=require('util');var logger=require(_0xd432('0x1'))(_0xd432('0x2'));var moment=require('moment');var BPromise=require(_0xd432('0x3'));var rp=require(_0xd432('0x4'));var fs=require('fs');var path=require(_0xd432('0x5'));var rimraf=require(_0xd432('0x6'));var config=require(_0xd432('0x7'));var attributes=require(_0xd432('0x8'));module[_0xd432('0x9')]=function(_0xd9b5ca,_0xd71352){return _0xd9b5ca[_0xd432('0xa')](_0xd432('0xb'),attributes,{'tableName':_0xd432('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index e9974af..20a1f2d 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(_0x50bcc7,_0x1e3053){var _0x3cbb5a=function(_0x1b2794){while(--_0x1b2794){_0x50bcc7['push'](_0x50bcc7['shift']());}};_0x3cbb5a(++_0x1e3053);}(_0x2032,0xd9));var _0x2203=function(_0x4fc6f2,_0x3aeb2f){_0x4fc6f2=_0x4fc6f2-0x0;var _0x198023=_0x2032[_0x4fc6f2];return _0x198023;};'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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','debug','stringify','ShowTrunk','find','lodash'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x66fa,0x117));var _0xa66f=function(_0x5baf31,_0x4f84b5){_0x5baf31=_0x5baf31-0x0;var _0x2ea96f=_0x66fa[_0x5baf31];return _0x2ea96f;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Trunk,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Trunk,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['GetTrunk']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')]({'raw':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x18')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'limit':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1a')]||null:null,'include':_0x1cbe64['options']?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0x1cbe64[_0xa66f('0x16')]['include'],function(_0x337602){return{'model':db[_0x337602[_0xa66f('0x1d')]],'as':_0x337602['as'],'attributes':_0x337602[_0xa66f('0x19')],'include':_0x337602[_0xa66f('0x1b')]?_['map'](_0x337602['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x19')],'include':_0xed98b9[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1d')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x17c103){logger[_0xa66f('0xc')](_0xa66f('0x1e'),_0x1cbe64);logger[_0xa66f('0x1f')](_0xa66f('0x1e'),_0x1cbe64,JSON[_0xa66f('0x20')](_0x17c103));_0x4a28d4(_0x17c103);})[_0xa66f('0x13')](function(_0x63650b){logger[_0xa66f('0xf')](_0xa66f('0x1e'),_0x63650b['message'],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x63650b[_0xa66f('0x12')]));});});};exports[_0xa66f('0x21')]=function(_0x55f309){var _0x44c79a=this;return new Promise(function(_0x2de5f3,_0x4cd7f2){return db[_0xa66f('0x14')][_0xa66f('0x22')]({'raw':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x55f309['options']?_0x55f309[_0xa66f('0x16')]['where']||null:null,'attributes':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'include':_0x55f309['options']?_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')]?_['map'](_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')],function(_0xba9457){return{'model':db[_0xba9457[_0xa66f('0x1d')]],'as':_0xba9457['as'],'attributes':_0xba9457[_0xa66f('0x19')],'include':_0xba9457[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xba9457[_0xa66f('0x1b')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1d')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1b')]?_['map'](_0x35ef27[_0xa66f('0x1b')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1d')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x201432){logger[_0xa66f('0xc')](_0xa66f('0x21'),_0x55f309);logger['debug'](_0xa66f('0x21'),_0x55f309,JSON['stringify'](_0x201432));_0x2de5f3(_0x201432);})[_0xa66f('0x13')](function(_0x45eeb8){logger[_0xa66f('0xf')]('ShowTrunk',_0x45eeb8['message'],_0x55f309);_0x4cd7f2(_0x44c79a[_0xa66f('0xf')](0x1f4,_0x45eeb8[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0b5e35d..953bfe3 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 _0x47b8=['/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','/:id/contacts','post','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','%s-%s','now','addAvatar','login','logout','/:id/pause','pause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','removeApiKey','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','/:id','show','/:id/avatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups'];(function(_0xfcd63a,_0x5d1f63){var _0x3d5688=function(_0xceb34e){while(--_0xceb34e){_0xfcd63a['push'](_0xfcd63a['shift']());}};_0x3d5688(++_0x5d1f63);}(_0x47b8,0x1e9));var _0x847b=function(_0x3c16fa,_0x2e3d19){_0x3c16fa=_0x3c16fa-0x0;var _0x48f9a1=_0x47b8[_0x3c16fa];return _0x48f9a1;};'use strict';var multer=require(_0x847b('0x0'));var util=require(_0x847b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x847b('0x2'));var interaction=require(_0x847b('0x3'));var config=require(_0x847b('0x4'));var controller=require(_0x847b('0x5'));router[_0x847b('0x6')]('/',auth[_0x847b('0x7')](),controller['index']);router[_0x847b('0x6')](_0x847b('0x8'),auth[_0x847b('0x7')](),controller['describe']);router[_0x847b('0x6')](_0x847b('0x9'),auth[_0x847b('0x7')](),controller[_0x847b('0xa')]);router['get'](_0x847b('0xb'),auth[_0x847b('0x7')](),controller[_0x847b('0xc')]);router[_0x847b('0x6')](_0x847b('0xd'),controller['getAvatar']);router[_0x847b('0x6')]('/:id/contacts',auth[_0x847b('0x7')](),controller[_0x847b('0xe')]);router[_0x847b('0x6')](_0x847b('0xf'),auth['isAuthenticated'](),controller[_0x847b('0x10')]);router[_0x847b('0x6')](_0x847b('0x11'),auth['isAuthenticated'](),controller[_0x847b('0x12')]);router['get'](_0x847b('0x13'),auth[_0x847b('0x7')](),controller[_0x847b('0x14')]);router[_0x847b('0x6')](_0x847b('0x15'),auth[_0x847b('0x7')](),controller['getRecordings']);router['get'](_0x847b('0x16'),auth[_0x847b('0x7')](),controller[_0x847b('0x17')]);router[_0x847b('0x6')](_0x847b('0x18'),auth[_0x847b('0x7')](),controller['getChatInteractions']);router[_0x847b('0x6')](_0x847b('0x19'),auth[_0x847b('0x7')](),controller[_0x847b('0x1a')]);router[_0x847b('0x6')](_0x847b('0x1b'),auth[_0x847b('0x7')](),controller['getMailInteractions']);router[_0x847b('0x6')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x847b('0x1c')]);router['get'](_0x847b('0x1d'),auth['isAuthenticated'](),controller[_0x847b('0x1e')]);router['get']('/:id/whatsapp/interactions',auth[_0x847b('0x7')](),controller[_0x847b('0x1f')]);router[_0x847b('0x6')](_0x847b('0x20'),auth[_0x847b('0x7')](),controller[_0x847b('0x21')]);router[_0x847b('0x6')](_0x847b('0x22'),auth[_0x847b('0x7')](),controller[_0x847b('0x23')]);router[_0x847b('0x6')]('/:id/agents',auth[_0x847b('0x7')](),controller['getAgents']);router[_0x847b('0x6')](_0x847b('0x24'),auth['isAuthenticated'](),controller[_0x847b('0x25')]);router['get'](_0x847b('0x26'),auth[_0x847b('0x7')](),controller[_0x847b('0x27')]);router[_0x847b('0x6')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['getMailAccounts']);router['get'](_0x847b('0x28'),auth['isAuthenticated'](),controller[_0x847b('0x29')]);router['get'](_0x847b('0x2a'),auth[_0x847b('0x7')](),controller[_0x847b('0x2b')]);router['get'](_0x847b('0x2c'),auth[_0x847b('0x7')](),controller['getChatWebsites']);router[_0x847b('0x6')](_0x847b('0x2d'),auth[_0x847b('0x7')](),controller[_0x847b('0x2e')]);router[_0x847b('0x6')](_0x847b('0x2f'),auth['isAuthenticated'](),controller[_0x847b('0x30')]);router[_0x847b('0x6')]('/:id/scheduled_calls',auth[_0x847b('0x7')](),controller[_0x847b('0x31')]);router[_0x847b('0x6')](_0x847b('0x32'),auth[_0x847b('0x7')](),controller['getApiKey']);router['post'](_0x847b('0x33'),auth[_0x847b('0x7')](),controller['addContacts']);router[_0x847b('0x34')]('/',auth['isAuthenticated'](),controller[_0x847b('0x35')]);router[_0x847b('0x34')](_0x847b('0x36'),auth[_0x847b('0x7')](),controller[_0x847b('0x37')]);router[_0x847b('0x34')](_0x847b('0xf'),auth[_0x847b('0x7')](),controller[_0x847b('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5825e1,_0x983a8b,_0x2a81a6){_0x2a81a6(null,path[_0x847b('0x39')](config[_0x847b('0x3a')],_0x847b('0x3b')));},'filename':function(_0x2794bc,_0x1feae6,_0x5c6415){_0x5c6415(null,util['format'](_0x847b('0x3c'),Date[_0x847b('0x3d')](),_0x1feae6['originalname']));}})});router['post'](_0x847b('0xd'),upload['single']('file'),controller[_0x847b('0x3e')]);router[_0x847b('0x34')]('/:id/login',auth[_0x847b('0x7')](),controller[_0x847b('0x3f')]);router[_0x847b('0x34')]('/:id/logout',auth[_0x847b('0x7')](),controller[_0x847b('0x40')]);router[_0x847b('0x34')](_0x847b('0x41'),auth[_0x847b('0x7')](),controller[_0x847b('0x42')]);router[_0x847b('0x34')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x847b('0x43')]);router[_0x847b('0x34')]('/:id/teams',auth[_0x847b('0x7')](),controller['addTeams']);router[_0x847b('0x34')](_0x847b('0x44'),auth[_0x847b('0x7')](),controller[_0x847b('0x45')]);router['post'](_0x847b('0x46'),auth[_0x847b('0x7')](),controller[_0x847b('0x47')]);router[_0x847b('0x34')]('/:id/fax_interactions',auth[_0x847b('0x7')](),controller[_0x847b('0x48')]);router['post'](_0x847b('0x49'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x847b('0x34')](_0x847b('0x4a'),auth[_0x847b('0x7')](),controller[_0x847b('0x4b')]);router['post'](_0x847b('0x4c'),auth[_0x847b('0x7')](),controller[_0x847b('0x4d')]);router[_0x847b('0x34')](_0x847b('0x26'),auth[_0x847b('0x7')](),controller[_0x847b('0x4e')]);router[_0x847b('0x34')](_0x847b('0x4f'),auth[_0x847b('0x7')](),controller[_0x847b('0x50')]);router[_0x847b('0x34')](_0x847b('0x28'),auth[_0x847b('0x7')](),controller[_0x847b('0x51')]);router[_0x847b('0x34')](_0x847b('0x2a'),auth[_0x847b('0x7')](),controller[_0x847b('0x52')]);router[_0x847b('0x34')](_0x847b('0x2c'),auth[_0x847b('0x7')](),controller[_0x847b('0x53')]);router['post'](_0x847b('0x2d'),auth[_0x847b('0x7')](),controller[_0x847b('0x54')]);router[_0x847b('0x34')](_0x847b('0x2f'),auth[_0x847b('0x7')](),controller[_0x847b('0x55')]);router[_0x847b('0x34')](_0x847b('0x32'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x847b('0x56')](_0x847b('0xb'),auth[_0x847b('0x7')](),controller[_0x847b('0x57')]);router['put'](_0x847b('0x58'),auth[_0x847b('0x7')](),controller['changePassword']);router['delete'](_0x847b('0xf'),auth[_0x847b('0x7')](),controller[_0x847b('0x59')]);router[_0x847b('0x5a')](_0x847b('0x20'),auth[_0x847b('0x7')](),controller[_0x847b('0x5b')]);router[_0x847b('0x5a')](_0x847b('0xb'),auth[_0x847b('0x7')](),controller['destroy']);router[_0x847b('0x5a')](_0x847b('0x44'),auth[_0x847b('0x7')](),controller[_0x847b('0x5c')]);router[_0x847b('0x5a')](_0x847b('0x46'),auth[_0x847b('0x7')](),controller[_0x847b('0x5d')]);router[_0x847b('0x5a')](_0x847b('0x5e'),auth[_0x847b('0x7')](),controller['removeFaxInteractions']);router[_0x847b('0x5a')](_0x847b('0x49'),auth[_0x847b('0x7')](),controller[_0x847b('0x5f')]);router['delete']('/:id/openchannel_interactions',auth[_0x847b('0x7')](),controller['removeOpenchannelInteractions']);router[_0x847b('0x5a')]('/:id/whatsapp_interactions',auth[_0x847b('0x7')](),controller[_0x847b('0x60')]);router['delete'](_0x847b('0x26'),auth[_0x847b('0x7')](),controller['removeFaxAccounts']);router[_0x847b('0x5a')](_0x847b('0x4f'),auth['isAuthenticated'](),controller[_0x847b('0x61')]);router[_0x847b('0x5a')](_0x847b('0x28'),auth['isAuthenticated'](),controller[_0x847b('0x62')]);router[_0x847b('0x5a')]('/:id/sms_accounts',auth[_0x847b('0x7')](),controller[_0x847b('0x63')]);router[_0x847b('0x5a')](_0x847b('0x2c'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x847b('0x5a')]('/:id/whatsapp_accounts',auth[_0x847b('0x7')](),controller['removeWhatsappAccounts']);router[_0x847b('0x5a')](_0x847b('0x2f'),auth[_0x847b('0x7')](),controller[_0x847b('0x64')]);router[_0x847b('0x5a')](_0x847b('0x32'),auth[_0x847b('0x7')](),controller[_0x847b('0x65')]);module['exports']=router; \ No newline at end of file +var _0xe6d7=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','/create_many','post','diskStorage','join','root','%s-%s','now','originalname','file','addAvatar','login','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util'];(function(_0x359c17,_0x4070d6){var _0x31a728=function(_0x320b98){while(--_0x320b98){_0x359c17['push'](_0x359c17['shift']());}};_0x31a728(++_0x4070d6);}(_0xe6d7,0x160));var _0x7e6d=function(_0x1b5b29,_0xfd5dd8){_0x1b5b29=_0x1b5b29-0x0;var _0x2b125e=_0xe6d7[_0x1b5b29];return _0x2b125e;};'use strict';var multer=require(_0x7e6d('0x0'));var util=require(_0x7e6d('0x1'));var path=require(_0x7e6d('0x2'));var timeout=require(_0x7e6d('0x3'));var express=require(_0x7e6d('0x4'));var router=express[_0x7e6d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e6d('0x6'));var config=require(_0x7e6d('0x7'));var controller=require(_0x7e6d('0x8'));router['get']('/',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0xa')]);router[_0x7e6d('0xb')](_0x7e6d('0xc'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0xd')]);router[_0x7e6d('0xb')](_0x7e6d('0xe'),auth['isAuthenticated'](),controller[_0x7e6d('0xf')]);router[_0x7e6d('0xb')](_0x7e6d('0x10'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x11')]);router[_0x7e6d('0xb')](_0x7e6d('0x12'),controller['getAvatar']);router['get'](_0x7e6d('0x13'),auth['isAuthenticated'](),controller[_0x7e6d('0x14')]);router[_0x7e6d('0xb')](_0x7e6d('0x15'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x16')]);router['get'](_0x7e6d('0x17'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x18')]);router['get'](_0x7e6d('0x19'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x1a')]);router[_0x7e6d('0xb')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x7e6d('0x1b')]);router[_0x7e6d('0xb')](_0x7e6d('0x1c'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x1d')]);router['get'](_0x7e6d('0x1e'),auth['isAuthenticated'](),controller[_0x7e6d('0x1f')]);router[_0x7e6d('0xb')](_0x7e6d('0x20'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x21')]);router[_0x7e6d('0xb')](_0x7e6d('0x22'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x23')]);router['get']('/:id/sms/interactions',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x24')]);router[_0x7e6d('0xb')](_0x7e6d('0x25'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x26')]);router[_0x7e6d('0xb')](_0x7e6d('0x27'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x28')]);router[_0x7e6d('0xb')](_0x7e6d('0x29'),auth[_0x7e6d('0x9')](),controller['getTeams']);router[_0x7e6d('0xb')](_0x7e6d('0x2a'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x2b')]);router[_0x7e6d('0xb')]('/:id/agents',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x2c')]);router[_0x7e6d('0xb')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x7e6d('0x2d')]);router[_0x7e6d('0xb')](_0x7e6d('0x2e'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x2f')]);router[_0x7e6d('0xb')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x7e6d('0x30')]);router[_0x7e6d('0xb')]('/:id/openchannel_accounts',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x31')]);router[_0x7e6d('0xb')](_0x7e6d('0x32'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x33')]);router['get']('/:id/chat_websites',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x34')]);router[_0x7e6d('0xb')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7e6d('0x35')]);router[_0x7e6d('0xb')]('/:id/square_projects',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x36')]);router[_0x7e6d('0xb')]('/:id/scheduled_calls',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x37')]);router['get'](_0x7e6d('0x38'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x39')]);router['post'](_0x7e6d('0x13'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x3a')]);router['post']('/',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x3b')]);router['post'](_0x7e6d('0x3c'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x7e6d('0x3d')](_0x7e6d('0x15'),auth[_0x7e6d('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x7e6d('0x3e')]({'destination':function(_0x1d56c5,_0x4d2f6b,_0x1ca906){_0x1ca906(null,path[_0x7e6d('0x3f')](config[_0x7e6d('0x40')],'server/files/images/'));},'filename':function(_0x3fc2d6,_0x20a96f,_0x1d79dd){_0x1d79dd(null,util['format'](_0x7e6d('0x41'),Date[_0x7e6d('0x42')](),_0x20a96f[_0x7e6d('0x43')]));}})});router[_0x7e6d('0x3d')](_0x7e6d('0x12'),upload['single'](_0x7e6d('0x44')),controller[_0x7e6d('0x45')]);router[_0x7e6d('0x3d')]('/:id/login',auth['isAuthenticated'](),controller[_0x7e6d('0x46')]);router[_0x7e6d('0x3d')]('/:id/logout',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x47')]);router[_0x7e6d('0x3d')]('/:id/pause',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x48')]);router['post'](_0x7e6d('0x49'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x4a')]);router[_0x7e6d('0x3d')](_0x7e6d('0x29'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x4b')]);router[_0x7e6d('0x3d')](_0x7e6d('0x4c'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x4d')]);router[_0x7e6d('0x3d')](_0x7e6d('0x4e'),auth['isAuthenticated'](),controller[_0x7e6d('0x4f')]);router[_0x7e6d('0x3d')](_0x7e6d('0x50'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x51')]);router[_0x7e6d('0x3d')](_0x7e6d('0x52'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x53')]);router[_0x7e6d('0x3d')](_0x7e6d('0x54'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x55')]);router[_0x7e6d('0x3d')]('/:id/whatsapp_interactions',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x56')]);router['post'](_0x7e6d('0x2e'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x57')]);router[_0x7e6d('0x3d')](_0x7e6d('0x58'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x59')]);router[_0x7e6d('0x3d')]('/:id/openchannel_accounts',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x5a')]);router[_0x7e6d('0x3d')](_0x7e6d('0x32'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x5b')]);router[_0x7e6d('0x3d')](_0x7e6d('0x5c'),auth[_0x7e6d('0x9')](),controller['addChatWebsites']);router['post'](_0x7e6d('0x5d'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x5e')]);router[_0x7e6d('0x3d')](_0x7e6d('0x5f'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x60')]);router['post'](_0x7e6d('0x38'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x61')]);router[_0x7e6d('0x62')](_0x7e6d('0x10'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x63')]);router[_0x7e6d('0x62')]('/:id/password',auth['isAuthenticated'](),controller[_0x7e6d('0x64')]);router[_0x7e6d('0x65')]('/:id/queues',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x66')]);router[_0x7e6d('0x65')](_0x7e6d('0x29'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x67')]);router[_0x7e6d('0x65')](_0x7e6d('0x10'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x68')]);router[_0x7e6d('0x65')](_0x7e6d('0x4c'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x69')]);router[_0x7e6d('0x65')](_0x7e6d('0x4e'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x6a')]);router[_0x7e6d('0x65')](_0x7e6d('0x50'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x6b')]);router[_0x7e6d('0x65')](_0x7e6d('0x52'),auth['isAuthenticated'](),controller[_0x7e6d('0x6c')]);router['delete']('/:id/openchannel_interactions',auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x6d')]);router['delete'](_0x7e6d('0x6e'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x6f')]);router[_0x7e6d('0x65')](_0x7e6d('0x2e'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x70')]);router[_0x7e6d('0x65')](_0x7e6d('0x58'),auth[_0x7e6d('0x9')](),controller['removeMailAccounts']);router[_0x7e6d('0x65')]('/:id/openchannel_accounts',auth[_0x7e6d('0x9')](),controller['removeOpenchannelAccounts']);router[_0x7e6d('0x65')](_0x7e6d('0x32'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x71')]);router['delete'](_0x7e6d('0x5c'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x72')]);router[_0x7e6d('0x65')](_0x7e6d('0x5d'),auth['isAuthenticated'](),controller[_0x7e6d('0x73')]);router['delete'](_0x7e6d('0x5f'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x74')]);router[_0x7e6d('0x65')](_0x7e6d('0x38'),auth[_0x7e6d('0x9')](),controller[_0x7e6d('0x75')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6ecf459..4e28db3 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 _0x26ff=['inband','auto','yes','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','uac','uas','active','passive','actpass','nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','dtlssetup','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','moment','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','telephone','local','INTEGER','accountcode','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','user','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x26ff,0xdf));var _0xf26f=function(_0x482223,_0x3808c6){_0x482223=_0x482223-0x0;var _0x40a395=_0x26ff[_0x482223];return _0x40a395;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf26f('0x0'));var util=require('util');var _=require('lodash');module[_0xf26f('0x1')]={'name':{'type':Sequelize[_0xf26f('0x2')],'allowNull':![],'unique':_0xf26f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x868e09){this[_0xf26f('0x4')]('name',_0x868e09);this[_0xf26f('0x4')](_0xf26f('0x5'),_0x868e09);},'comment':_0xf26f('0x6')},'fullname':{'type':Sequelize[_0xf26f('0x2')],'allowNull':![],'set':function(_0x4c487d){this['setDataValue']('fullname',_0x4c487d);this[_0xf26f('0x4')](_0xf26f('0x7'),util['format'](_0xf26f('0x8'),_0x4c487d,this[_0xf26f('0x9')](_0xf26f('0xa'))));}},'alias':{'type':Sequelize[_0xf26f('0x2')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf26f('0xb'),'validate':{'isEmail':!![]},'set':function(_0x9decae){if(_0x9decae){this[_0xf26f('0x4')](_0xf26f('0xb'),_0x9decae[_0xf26f('0xc')]());}}},'role':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0xe'),'user','agent',_0xf26f('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xf26f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xf26f('0x10')},'internal':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':![],'unique':_0xf26f('0xa'),'set':function(_0x577fd6){this['setDataValue'](_0xf26f('0xa'),_0x577fd6);this[_0xf26f('0x4')](_0xf26f('0x12'),_0x577fd6);this[_0xf26f('0x4')](_0xf26f('0x7'),util[_0xf26f('0x13')](_0xf26f('0x8'),this[_0xf26f('0x9')](_0xf26f('0x14')),_0x577fd6));}},'salt':{'type':Sequelize[_0xf26f('0x2')]},'phone':{'type':Sequelize[_0xf26f('0x2')]},'mobile':{'type':Sequelize[_0xf26f('0x2')]},'address':{'type':Sequelize[_0xf26f('0x2')]},'zipcode':{'type':Sequelize[_0xf26f('0x2')]},'userpic':{'type':Sequelize[_0xf26f('0x2')]},'city':{'type':Sequelize[_0xf26f('0x2')]},'country':{'type':Sequelize[_0xf26f('0x2')]},'online':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf26f('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf26f('0x2')],'defaultValue':_0xf26f('0x17')},'lastPauseAt':{'type':Sequelize[_0xf26f('0x16')]},'chatCapacity':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf26f('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf26f('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xf26f('0x18'),_0xf26f('0x19')),'allowNull':!![],'defaultValue':_0xf26f('0x1a')},'context':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![],'defaultValue':_0xf26f('0x1b')},'callingpres':{'type':Sequelize[_0xf26f('0xd')]('ALLOWED_NOT_SCREENED',_0xf26f('0x1c'),_0xf26f('0x1d'),_0xf26f('0x1e'),_0xf26f('0x1f'),'PROHIB_PASSED_SCREEN',_0xf26f('0x20'),_0xf26f('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![],'defaultValue':_0xf26f('0x22'),'set':function(_0x4b4016){this[_0xf26f('0x4')]('transport',_0x4b4016?_0x4b4016[_0xf26f('0x23')](','):null);},'get':function(){return this['getDataValue'](_0xf26f('0x24'))?this[_0xf26f('0x9')](_0xf26f('0x24'))[_0xf26f('0x25')](','):null;},'comment':_0xf26f('0x26')},'dtmfmode':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x27'),'info',_0xf26f('0x28'),_0xf26f('0x29'),_0xf26f('0x2a')),'allowNull':!![],'defaultValue':_0xf26f('0x27')},'directmedia':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no','nonat',_0xf26f('0x2c'),_0xf26f('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x733822){this['setDataValue']('nat',_0x733822?_0x733822[_0xf26f('0x23')](','):null);},'get':function(){return this[_0xf26f('0x9')](_0xf26f('0x2e'))?this[_0xf26f('0x9')](_0xf26f('0x2e'))['split'](','):null;},'comment':_0xf26f('0x2f')},'callgroup':{'type':Sequelize[_0xf26f('0x2')]},'namedcallgroup':{'type':Sequelize[_0xf26f('0x2')]},'pickupgroup':{'type':Sequelize[_0xf26f('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf26f('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xf26f('0x2')],'allowNull':![],'defaultValue':_0xf26f('0x30')},'allow':{'type':Sequelize[_0xf26f('0x2')],'allowNull':![],'defaultValue':_0xf26f('0x31'),'set':function(_0x10aae9){this[_0xf26f('0x4')]('allow',_0x10aae9?_0x10aae9[_0xf26f('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xf26f('0x32'))?this[_0xf26f('0x9')](_0xf26f('0x32'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x14509c){this['setDataValue']('insecure',_0x14509c?_0x14509c[_0xf26f('0x23')](','):null);},'get':function(){return this[_0xf26f('0x9')]('insecure')?this[_0xf26f('0x9')](_0xf26f('0x33'))[_0xf26f('0x25')](','):null;},'comment':_0xf26f('0x34')},'trustrpid':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf26f('0x2b'),'no',_0xf26f('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xf26f('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf26f('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf26f('0x36')},'amaflags':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xf26f('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf26f('0xd')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf26f('0xd')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xf26f('0x37'),_0xf26f('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x39'),'uas'),'allowNull':!![],'defaultValue':_0xf26f('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xf26f('0x2b')},'keepalive':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf26f('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xf26f('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf26f('0x3b'),_0xf26f('0x3c'),_0xf26f('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf26f('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no',_0xf26f('0x3e'),_0xf26f('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xf26f('0x16')]},'passwordResetAt':{'type':Sequelize[_0xf26f('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf26f('0x2')]},'showWebBar':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0,'set':function(_0x5d67c6){this[_0xf26f('0x4')](_0xf26f('0x3f'),_0x5d67c6);var _0x3a7854=this[_0xf26f('0x40')]({'plain':!![]});switch(_0x5d67c6){case 0x0:case 0x1:var _0x1dec2f=_0x3a7854[_0xf26f('0x24')]?_[_0xf26f('0x41')](_0x3a7854[_0xf26f('0x24')])?_0x3a7854[_0xf26f('0x24')][_0xf26f('0x23')]():_0x3a7854[_0xf26f('0x24')]:_0xf26f('0x22');if(_0x1dec2f===_0xf26f('0x42')){_0x1dec2f=_0xf26f('0x22');}this[_0xf26f('0x4')]('transport',_0x1dec2f);this[_0xf26f('0x4')](_0xf26f('0x43'),'no');this[_0xf26f('0x4')](_0xf26f('0x44'),null);this[_0xf26f('0x4')](_0xf26f('0x45'),null);this[_0xf26f('0x4')](_0xf26f('0x46'),null);this[_0xf26f('0x4')](_0xf26f('0x47'),null);this[_0xf26f('0x4')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this[_0xf26f('0x4')](_0xf26f('0x48'),null);this[_0xf26f('0x4')](_0xf26f('0x49'),null);this['setDataValue'](_0xf26f('0x4a'),'no');break;case 0x2:this[_0xf26f('0x4')](_0xf26f('0x24'),_0xf26f('0x42'));this[_0xf26f('0x4')](_0xf26f('0x43'),_0xf26f('0x2b'));this['setDataValue'](_0xf26f('0x44'),_0xf26f('0x2b'));this['setDataValue'](_0xf26f('0x45'),'yes');this[_0xf26f('0x4')](_0xf26f('0x46'),_0xf26f('0x2b'));this[_0xf26f('0x4')]('dtlsenable',_0xf26f('0x2b'));this['setDataValue'](_0xf26f('0x4b'),'no');this[_0xf26f('0x4')](_0xf26f('0x4c'),_0xf26f('0x3d'));this[_0xf26f('0x4')]('dtlscertfile',_0x3a7854['dtlscertfile']||_0xf26f('0x4d'));this[_0xf26f('0x4')](_0xf26f('0x49'),_0x3a7854[_0xf26f('0x49')]||'/etc/pki/tls/private/motion.key');this[_0xf26f('0x4')](_0xf26f('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xf26f('0x4e')],'set':function(_0x3ab8d2){this[_0xf26f('0x4')](_0xf26f('0x4f'),_0x3ab8d2?_0x3ab8d2[_0xf26f('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0xf26f('0x4f'))?_[_0xf26f('0x50')](this[_0xf26f('0x9')](_0xf26f('0x4f'))[_0xf26f('0x25')](','),function(_0x16505e){return parseInt(_0x16505e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf26f('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf26f('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0xf26f('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf26f('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf26f('0xd')](_0xf26f('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf26f('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf26f('0x9')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0xf26f('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xf26f('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf26f('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![],'set':function(_0x1b7c2a){if(typeof _0x1b7c2a===_0xf26f('0x52')){var _0x5cc526=_0x1b7c2a==='1'?!![]:_0x1b7c2a==='0'?![]:_0x1b7c2a===_0xf26f('0x53')?!![]:_0x1b7c2a==='false'?![]:![];this[_0xf26f('0x4')](_0xf26f('0x54'),_0x5cc526);}else{this[_0xf26f('0x4')](_0xf26f('0x54'),_0x1b7c2a);}}},'blocked':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![],'set':function(_0x1b00c8){this['setDataValue'](_0xf26f('0x55'),_0x1b00c8);if(_0x1b00c8===!![]){this['setDataValue'](_0xf26f('0x56'),moment());this[_0xf26f('0x4')](_0xf26f('0x57'),0x0);}else{this[_0xf26f('0x4')](_0xf26f('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xf26f('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf26f('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf26f('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x101c=['INTEGER','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uac','uas','fingerprint','passive','actpass','update','update,nonat','showWebBar','get','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','encryption','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','sequelize','moment','lodash','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local'];(function(_0x57afae,_0x2ef522){var _0x4b8195=function(_0x34418f){while(--_0x34418f){_0x57afae['push'](_0x57afae['shift']());}};_0x4b8195(++_0x2ef522);}(_0x101c,0x19c));var _0xc101=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x101c[_0x10d0f0];return _0x93e308;};'use strict';var Sequelize=require(_0xc101('0x0'));var moment=require(_0xc101('0x1'));var util=require('util');var _=require(_0xc101('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4d7c8f){this[_0xc101('0x3')](_0xc101('0x4'),_0x4d7c8f);this['setDataValue'](_0xc101('0x5'),_0x4d7c8f);},'comment':_0xc101('0x6')},'fullname':{'type':Sequelize[_0xc101('0x7')],'allowNull':![],'set':function(_0x23f832){this['setDataValue'](_0xc101('0x8'),_0x23f832);this[_0xc101('0x3')]('callerid',util['format'](_0xc101('0x9'),_0x23f832,this['getDataValue'](_0xc101('0xa'))));}},'alias':{'type':Sequelize[_0xc101('0x7')]},'email':{'type':Sequelize[_0xc101('0x7')],'allowNull':![],'unique':_0xc101('0xb'),'validate':{'isEmail':!![]},'set':function(_0xb73bdb){if(_0xb73bdb){this[_0xc101('0x3')](_0xc101('0xb'),_0xb73bdb['toLowerCase']());}}},'role':{'type':Sequelize[_0xc101('0xc')](_0xc101('0xd'),_0xc101('0xe'),_0xc101('0xf'),_0xc101('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xc101('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc101('0x7')],'defaultValue':_0xc101('0x11')},'internal':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':![],'unique':_0xc101('0xa'),'set':function(_0x1f8430){this[_0xc101('0x3')]('internal',_0x1f8430);this[_0xc101('0x3')](_0xc101('0x13'),_0x1f8430);this[_0xc101('0x3')]('callerid',util['format'](_0xc101('0x9'),this[_0xc101('0x14')](_0xc101('0x8')),_0x1f8430));}},'salt':{'type':Sequelize[_0xc101('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xc101('0x7')]},'address':{'type':Sequelize[_0xc101('0x7')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc101('0x7')]},'city':{'type':Sequelize[_0xc101('0x7')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc101('0x15')]},'voicePause':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc101('0x7')],'defaultValue':_0xc101('0x17')},'lastPauseAt':{'type':Sequelize[_0xc101('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc101('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc101('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc101('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![],'defaultValue':_0xc101('0x18')},'ipaddr':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0xc101('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x19'),'user',_0xc101('0x1a')),'allowNull':!![],'defaultValue':_0xc101('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x1b'),_0xc101('0x1c'),_0xc101('0x1d'),_0xc101('0x1e'),_0xc101('0x1f'),_0xc101('0x20'),'PROHIB_FAILED_SCREEN',_0xc101('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![],'defaultValue':_0xc101('0x22'),'set':function(_0x34be5c){this[_0xc101('0x3')]('transport',_0x34be5c?_0x34be5c[_0xc101('0x23')](','):null);},'get':function(){return this['getDataValue'](_0xc101('0x24'))?this[_0xc101('0x14')](_0xc101('0x24'))['split'](','):null;},'comment':_0xc101('0x25')},'dtmfmode':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x26'),'info',_0xc101('0x27'),'inband',_0xc101('0x28')),'allowNull':!![],'defaultValue':_0xc101('0x26')},'directmedia':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no',_0xc101('0x2a'),'update',_0xc101('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc101('0x2c'),'set':function(_0x321350){this['setDataValue'](_0xc101('0x2d'),_0x321350?_0x321350[_0xc101('0x23')](','):null);},'get':function(){return this['getDataValue'](_0xc101('0x2d'))?this[_0xc101('0x14')](_0xc101('0x2d'))[_0xc101('0x2e')](','):null;},'comment':_0xc101('0x2f')},'callgroup':{'type':Sequelize[_0xc101('0x7')]},'namedcallgroup':{'type':Sequelize[_0xc101('0x7')]},'pickupgroup':{'type':Sequelize[_0xc101('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xc101('0x7')]},'language':{'type':Sequelize[_0xc101('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc101('0x7')]},'disallow':{'type':Sequelize[_0xc101('0x7')],'allowNull':![],'defaultValue':_0xc101('0x30')},'allow':{'type':Sequelize[_0xc101('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2bca7f){this[_0xc101('0x3')](_0xc101('0x31'),_0x2bca7f?_0x2bca7f[_0xc101('0x23')](';'):_0xc101('0x32'));},'get':function(){return this['getDataValue'](_0xc101('0x31'))?this['getDataValue'](_0xc101('0x31'))[_0xc101('0x2e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![],'set':function(_0x366ebb){this[_0xc101('0x3')]('insecure',_0x366ebb?_0x366ebb[_0xc101('0x23')](','):null);},'get':function(){return this[_0xc101('0x14')](_0xc101('0x33'))?this[_0xc101('0x14')](_0xc101('0x33'))[_0xc101('0x2e')](','):null;},'comment':_0xc101('0x34')},'trustrpid':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc101('0x29'),'no',_0xc101('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':_0xc101('0x29')},'busylevel':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xc101('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc101('0xc')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x36'),_0xc101('0x37'),_0xc101('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x39'),_0xc101('0x3a')),'allowNull':!![],'defaultValue':_0xc101('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':_0xc101('0x29')},'keepalive':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xc101('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no',_0xc101('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xc101('0x3c'),_0xc101('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc101('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc101('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc101('0xc')](_0xc101('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xc101('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xc101('0x29'),'no','nonat',_0xc101('0x3e'),_0xc101('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc101('0x7')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xc101('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc101('0x7')]},'showWebBar':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0,'set':function(_0x57a0d0){this[_0xc101('0x3')](_0xc101('0x40'),_0x57a0d0);var _0x602e9d=this[_0xc101('0x41')]({'plain':!![]});switch(_0x57a0d0){case 0x0:case 0x1:var _0x307889=_0x602e9d['transport']?_['isArray'](_0x602e9d['transport'])?_0x602e9d[_0xc101('0x24')][_0xc101('0x23')]():_0x602e9d[_0xc101('0x24')]:_0xc101('0x22');if(_0x307889===_0xc101('0x42')){_0x307889=_0xc101('0x22');}this[_0xc101('0x3')](_0xc101('0x24'),_0x307889);this['setDataValue']('encryption','no');this[_0xc101('0x3')](_0xc101('0x43'),null);this[_0xc101('0x3')](_0xc101('0x44'),null);this[_0xc101('0x3')](_0xc101('0x45'),null);this['setDataValue'](_0xc101('0x46'),null);this[_0xc101('0x3')](_0xc101('0x47'),null);this[_0xc101('0x3')](_0xc101('0x48'),null);this[_0xc101('0x3')](_0xc101('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this[_0xc101('0x3')](_0xc101('0x4a'),'no');break;case 0x2:this[_0xc101('0x3')](_0xc101('0x24'),'wss');this['setDataValue'](_0xc101('0x4b'),_0xc101('0x29'));this[_0xc101('0x3')](_0xc101('0x43'),_0xc101('0x29'));this[_0xc101('0x3')](_0xc101('0x44'),_0xc101('0x29'));this[_0xc101('0x3')](_0xc101('0x45'),_0xc101('0x29'));this[_0xc101('0x3')](_0xc101('0x46'),_0xc101('0x29'));this[_0xc101('0x3')](_0xc101('0x47'),'no');this[_0xc101('0x3')](_0xc101('0x48'),'actpass');this['setDataValue'](_0xc101('0x49'),_0x602e9d[_0xc101('0x49')]||_0xc101('0x4c'));this['setDataValue']('dtlsprivatekey',_0x602e9d['dtlsprivatekey']||_0xc101('0x4d'));this[_0xc101('0x3')](_0xc101('0x4a'),_0xc101('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x510166){this[_0xc101('0x3')](_0xc101('0x4e'),_0x510166?_0x510166['join'](','):[]);},'get':function(){return this[_0xc101('0x14')](_0xc101('0x4e'))?_[_0xc101('0x4f')](this[_0xc101('0x14')](_0xc101('0x4e'))['split'](','),function(_0x467ff0){return parseInt(_0x467ff0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc101('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc101('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0xc101('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc101('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc101('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc101('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc101('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc101('0x14')]('phoneBarEnableScreenRecordingByAgent')?this[_0xc101('0x14')](_0xc101('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc101('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc101('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc101('0x16')],'defaultValue':![],'set':function(_0xa6911c){if(typeof _0xa6911c===_0xc101('0x51')){var _0x58fd7f=_0xa6911c==='1'?!![]:_0xa6911c==='0'?![]:_0xa6911c===_0xc101('0x52')?!![]:_0xa6911c==='false'?![]:![];this['setDataValue']('screenrecording',_0x58fd7f);}else{this[_0xc101('0x3')](_0xc101('0x53'),_0xa6911c);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x38b1da){this[_0xc101('0x3')](_0xc101('0x54'),_0x38b1da);if(_0x38b1da===!![]){this[_0xc101('0x3')](_0xc101('0x55'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xc101('0x3')](_0xc101('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0xc101('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc101('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc101('0x16')],'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 c4c7c60..10e5f90 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 _0xe614=['SmsAccount','getSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','lastName','phone','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','jayson/promise','http','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','role','admin','Users','user','agent','Telephones','telephone','filter','ignore','map','value','UserProfileResource','sendStatus','stack','name','send','index','User','rawAttributes','type','key','model','differenceBy','password','salt','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','sequelize','lower','col','options','count','rows','catch','show','keys','include','find','body','params','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','104','105','106','109','100','111','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','settingsEnabled','userProfileId','create','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','checkUserLimits','push','all','each','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','QueueId','emit','capitalize','VoiceQueue','findAll','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','getContacts','CmContact','includeAll','CmList','Tag','Tags','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','update','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','resolve','pause','PAUSE','bulkCreate','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','chat','fax','sms','openchannel','%s%s','QueuePause','getTeams','addTeams','Team','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','Queue:save','removeTeams','getSmsQueues','Whatsapp','Openchannel','removeAgent','getLists','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','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','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts'];(function(_0x29b2bf,_0x1445fa){var _0x34ab3e=function(_0x2e618c){while(--_0x2e618c){_0x29b2bf['push'](_0x29b2bf['shift']());}};_0x34ab3e(++_0x1445fa);}(_0xe614,0x1be));var _0x4e61=function(_0x3d192a,_0x38b1d8){_0x3d192a=_0x3d192a-0x0;var _0x47e842=_0xe614[_0x3d192a];return _0x47e842;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e61('0x0'));var rimraf=require(_0x4e61('0x1'));var zipdir=require(_0x4e61('0x2'));var jsonpatch=require(_0x4e61('0x3'));var rp=require(_0x4e61('0x4'));var moment=require(_0x4e61('0x5'));var BPromise=require(_0x4e61('0x6'));var Mustache=require(_0x4e61('0x7'));var util=require(_0x4e61('0x8'));var path=require(_0x4e61('0x9'));var sox=require(_0x4e61('0xa'));var csv=require(_0x4e61('0xb'));var ejs=require(_0x4e61('0xc'));var fs=require('fs');var _=require(_0x4e61('0xd'));var squel=require(_0x4e61('0xe'));var crypto=require(_0x4e61('0xf'));var jsforce=require(_0x4e61('0x10'));var deskjs=require(_0x4e61('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4e61('0x12'));var Papa=require(_0x4e61('0x13'));var Redis=require(_0x4e61('0x14'));var authService=require(_0x4e61('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x4e61('0x16'));var hardwareService=require(_0x4e61('0x17'));var logger=require(_0x4e61('0x18'))(_0x4e61('0x19'));var utils=require(_0x4e61('0x1a'));var config=require(_0x4e61('0x1b'));var licenseUtil=require(_0x4e61('0x1c'));var db=require(_0x4e61('0x1d'))['db'];config['redis']=_['defaults'](config[_0x4e61('0x1e')],{'host':_0x4e61('0x1f'),'port':0x18eb});var socket=require(_0x4e61('0x20'))(new Redis(config[_0x4e61('0x1e')]));require(_0x4e61('0x21'))[_0x4e61('0x22')](socket);var jayson=require(_0x4e61('0x23'));var client=jayson['client'][_0x4e61('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x17ae96,_0x1ffd4a,_0x164636,_0xe1d5cd){return new BPromise(function(_0x157dd4,_0x6fc48){var _0xc48f78=_0xe1d5cd||client;return _0xc48f78['request'](_0x17ae96,_0x164636)['then'](function(_0x3d829d){logger[_0x4e61('0x25')](_0x4e61('0x26'),_0x1ffd4a,_0x4e61('0x27'));logger[_0x4e61('0x28')](_0x4e61('0x29'),_0x1ffd4a,_0x4e61('0x27'),JSON[_0x4e61('0x2a')](_0x3d829d));if(_0x3d829d['error']){if(_0x3d829d['error'][_0x4e61('0x2b')]===0x1f4){logger[_0x4e61('0x2c')](_0x4e61('0x26'),_0x1ffd4a,_0x3d829d[_0x4e61('0x2c')][_0x4e61('0x2d')]);return _0x6fc48(_0x3d829d['error'][_0x4e61('0x2d')]);}logger[_0x4e61('0x2c')](_0x4e61('0x26'),_0x1ffd4a,_0x3d829d[_0x4e61('0x2c')]['message']);return _0x157dd4(_0x3d829d[_0x4e61('0x2c')][_0x4e61('0x2d')]);}else{logger[_0x4e61('0x25')](_0x4e61('0x26'),_0x1ffd4a,_0x4e61('0x27'));_0x157dd4(_0x3d829d[_0x4e61('0x2e')][_0x4e61('0x2d')]);}})['catch'](function(_0x576949){logger[_0x4e61('0x2c')]('User,\x20%s,\x20%s',_0x1ffd4a,_0x576949);_0x6fc48(_0x576949);});});}function respondWithStatusCode(_0x11506a,_0xce5848){_0xce5848=_0xce5848||0xcc;return function(_0x1a41f9){if(_0x1a41f9){return _0x11506a['sendStatus'](_0xce5848);}return _0x11506a[_0x4e61('0x2f')](_0xce5848)[_0x4e61('0x30')]();};}function respondWithResult(_0x5cab5a,_0x4d4148){_0x4d4148=_0x4d4148||0xc8;return function(_0x456e5c){if(_0x456e5c){return _0x5cab5a[_0x4e61('0x2f')](_0x4d4148)[_0x4e61('0x31')](_0x456e5c);}};}function respondWithFilteredResult(_0xaed39d,_0x179b9e){return function(_0x17913a){if(_0x17913a){var _0x4a58ea=_0x17913a['count'],_0x3026ba=_0x179b9e[_0x4e61('0x32')],_0x1f5240=_0x179b9e[_0x4e61('0x32')]+_0x179b9e[_0x4e61('0x33')],_0xcb6c70;if(_0x1f5240>=_0x4a58ea){_0x1f5240=_0x4a58ea;_0xcb6c70=0xc8;}else{_0xcb6c70=0xce;}_0xaed39d['status'](_0xcb6c70);return _0xaed39d[_0x4e61('0x34')](_0x4e61('0x35'),_0x3026ba+'-'+_0x1f5240+'/'+_0x4a58ea)['json'](_0x17913a);}return null;};}function patchUpdates(_0x149fb7){return function(_0x1e3ece){try{jsonpatch['apply'](_0x1e3ece,_0x149fb7,!![]);}catch(_0x4afa0e){return BPromise[_0x4e61('0x36')](_0x4afa0e);}return _0x1e3ece[_0x4e61('0x37')]();};}function saveUpdates(_0x594b42,_0x338e29){return function(_0x401373){if(_0x401373){return _0x401373['update'](_0x594b42)[_0x4e61('0x38')](function(_0x2f11d8){return _0x2f11d8;});}return null;};}function removeEntity(_0x3e6b42,_0x4136e8){return function(_0x260bfc){if(_0x260bfc){return _0x260bfc[_0x4e61('0x39')]()[_0x4e61('0x38')](function(){var _0x1a492c=_0x260bfc[_0x4e61('0x3a')]({'plain':!![]});if(_0x1a492c[_0x4e61('0x3b')]===_0x4e61('0x3c'))return;var _0x526363=[{'name':_0x4e61('0x3d'),'value':_0x4e61('0x3e'),'ignore':!![]},{'name':'Agents','value':_0x4e61('0x3f'),'ignore':![]},{'name':_0x4e61('0x40'),'value':_0x4e61('0x41'),'ignore':![]}];var _0x5553e6=_(_0x526363)[_0x4e61('0x42')](_0x4e61('0x43'))[_0x4e61('0x44')]('value')[_0x4e61('0x45')]();if(_['includes'](_0x5553e6,_0x1a492c[_0x4e61('0x3b')])){return;}var _0x10dbd6=_['find'](_0x526363,[_0x4e61('0x45'),_0x1a492c['role']])['name'];return db[_0x4e61('0x46')][_0x4e61('0x39')]({'where':{'type':_0x10dbd6,'resourceId':_0x1a492c['id']}})[_0x4e61('0x38')](function(){return _0x260bfc;});})[_0x4e61('0x38')](function(){_0x3e6b42['status'](0xcc)[_0x4e61('0x30')]();});}};}function handleEntityNotFound(_0x5caf6a,_0x58b693){return function(_0x480ebb){if(!_0x480ebb){_0x5caf6a[_0x4e61('0x47')](0x194);}return _0x480ebb;};}function handleError(_0x4d82af,_0xe9ea6b){_0xe9ea6b=_0xe9ea6b||0x1f4;return function(_0x49e7bf){logger['error'](_0x49e7bf[_0x4e61('0x48')]);if(_0x49e7bf[_0x4e61('0x49')]){delete _0x49e7bf[_0x4e61('0x49')];}_0x4d82af[_0x4e61('0x2f')](_0xe9ea6b)[_0x4e61('0x4a')](_0x49e7bf);};}exports[_0x4e61('0x4b')]=function(_0x2a1bfa,_0x174d17){var _0x1fd386={},_0xfb9927={},_0x465a78={'count':0x0,'rows':[]};var _0x1184f3=_[_0x4e61('0x44')](db[_0x4e61('0x4c')][_0x4e61('0x4d')],function(_0x5303cb){return{'name':_0x5303cb['fieldName'],'type':_0x5303cb[_0x4e61('0x4e')][_0x4e61('0x4f')]};});_0xfb9927[_0x4e61('0x50')]=_[_0x4e61('0x51')](_['map'](_0x1184f3,_0x4e61('0x49')),[_0x4e61('0x52'),_0x4e61('0x53')]);_0xfb9927[_0x4e61('0x54')]=_['keys'](_0x2a1bfa[_0x4e61('0x54')]);_0xfb9927[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0xfb9927[_0x4e61('0x50')],_0xfb9927[_0x4e61('0x54')]);_0x1fd386['attributes']=_[_0x4e61('0x56')](_0xfb9927[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x2a1bfa[_0x4e61('0x54')][_0x4e61('0x57')]));_0x1fd386[_0x4e61('0x58')]=_0x1fd386['attributes'][_0x4e61('0x59')]?_0x1fd386[_0x4e61('0x58')]:_0xfb9927[_0x4e61('0x50')];if(!_0x2a1bfa[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x1fd386[_0x4e61('0x33')]=qs[_0x4e61('0x33')](_0x2a1bfa[_0x4e61('0x54')][_0x4e61('0x33')]);_0x1fd386[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x2a1bfa[_0x4e61('0x54')][_0x4e61('0x32')]);}_0x1fd386[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x2a1bfa[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x1fd386['where']=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x2a1bfa[_0x4e61('0x54')],_0xfb9927[_0x4e61('0x55')]),_0x1184f3);if(_0x2a1bfa[_0x4e61('0x54')][_0x4e61('0x42')]){_0x1fd386[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x1fd386[_0x4e61('0x5f')],{'$or':_['map'](_0x1184f3,function(_0x138d16){if(_0x138d16[_0x4e61('0x4e')]!==_0x4e61('0x61')){return db[_0x4e61('0x62')][_0x4e61('0x5f')](db[_0x4e61('0x62')]['fn'](_0x4e61('0x63'),db['sequelize'][_0x4e61('0x64')](_0x138d16['name'])),{'$like':db[_0x4e61('0x62')]['fn'](_0x4e61('0x63'),'%'+_0x2a1bfa[_0x4e61('0x54')]['filter']+'%')});}})});}_0x1fd386=_[_0x4e61('0x60')]({},_0x1fd386,_0x2a1bfa[_0x4e61('0x65')]);var _0x3f7c39={'where':_0x1fd386[_0x4e61('0x5f')]};return db['User'][_0x4e61('0x66')](_0x3f7c39)[_0x4e61('0x38')](function(_0x52f858){_0x465a78['count']=_0x52f858;if(_0x2a1bfa[_0x4e61('0x54')]['includeAll']){_0x1fd386['include']=[{'all':!![]}];}return db['User']['findAll'](_0x1fd386);})['then'](function(_0x44c66d){_0x465a78[_0x4e61('0x67')]=_0x44c66d;return _0x465a78;})['then'](respondWithFilteredResult(_0x174d17,_0x1fd386))[_0x4e61('0x68')](handleError(_0x174d17,null));};exports[_0x4e61('0x69')]=function(_0x2bf750,_0x57cc71){var _0xe253f={'raw':![],'where':{'id':_0x2bf750['params']['id']}},_0x110853={};_0x110853[_0x4e61('0x50')]=_['differenceBy'](_[_0x4e61('0x6a')](db[_0x4e61('0x4c')]['rawAttributes']),[_0x4e61('0x52'),_0x4e61('0x53')]);_0x110853[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x2bf750[_0x4e61('0x54')]);_0x110853[_0x4e61('0x55')]=_['intersection'](_0x110853[_0x4e61('0x50')],_0x110853[_0x4e61('0x54')]);_0xe253f[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x110853[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x2bf750[_0x4e61('0x54')][_0x4e61('0x57')]));_0xe253f[_0x4e61('0x58')]=_0xe253f[_0x4e61('0x58')][_0x4e61('0x59')]?_0xe253f[_0x4e61('0x58')]:_0x110853[_0x4e61('0x50')];if(_0x2bf750[_0x4e61('0x54')]['includeAll']){_0xe253f[_0x4e61('0x6b')]=[{'all':!![]}];}_0xe253f=_[_0x4e61('0x60')]({},_0xe253f,_0x2bf750[_0x4e61('0x65')]);return db[_0x4e61('0x4c')][_0x4e61('0x6c')](_0xe253f)[_0x4e61('0x38')](handleEntityNotFound(_0x57cc71,null))['then'](respondWithResult(_0x57cc71,null))[_0x4e61('0x68')](handleError(_0x57cc71,null));};exports['update']=function(_0x486a85,_0x48a3f9){if(_0x486a85[_0x4e61('0x6d')]['id']){delete _0x486a85[_0x4e61('0x6d')]['id'];}delete _0x486a85['body'][_0x4e61('0x3b')];return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0x486a85[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x48a3f9,null))[_0x4e61('0x38')](saveUpdates(_0x486a85[_0x4e61('0x6d')],null))[_0x4e61('0x38')](respondWithResult(_0x48a3f9,null))[_0x4e61('0x68')](handleError(_0x48a3f9,null));};exports['describe']=function(_0x1adf91,_0x3d15f8){return db[_0x4e61('0x4c')][_0x4e61('0x6f')]()[_0x4e61('0x38')](respondWithResult(_0x3d15f8,null))[_0x4e61('0x68')](handleError(_0x3d15f8,null));};exports[_0x4e61('0x70')]=function(_0x2fbb5f,_0x3fbfe7,_0x501d20){return db['User'][_0x4e61('0x6c')]({'where':{'id':_0x2fbb5f['params']['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x3fbfe7,null))['then'](function(_0x5b8391){if(_0x5b8391){return _0x5b8391['addContacts'](_0x2fbb5f['body'][_0x4e61('0x71')],_[_0x4e61('0x72')](_0x2fbb5f[_0x4e61('0x6d')],[_0x4e61('0x71'),'id'])||{});}})[_0x4e61('0x38')](respondWithResult(_0x3fbfe7,null))[_0x4e61('0x68')](handleError(_0x3fbfe7,null));};function validateUser(_0x46860e){return new BPromise(function(_0x5e7202,_0x19ecfb){if(_0x46860e[_0x4e61('0x73')])return _0x5e7202(_0x46860e);return db[_0x4e61('0x74')]['findById'](0x1)[_0x4e61('0x38')](function(_0x1109dd){if(_0x1109dd[_0x4e61('0x75')])authService[_0x4e61('0x76')](_0x46860e[_0x4e61('0x52')]);db[_0x4e61('0x4c')][_0x4e61('0x77')](_0x4e61('0x73'))[_0x4e61('0x38')](function(_0x4e1d16){if(_[_0x4e61('0x78')](_0x4e1d16)){_0x46860e[_0x4e61('0x73')]=_0x1109dd[_0x4e61('0x79')]||0x1;return;}if(_[_0x4e61('0x78')](_0x1109dd[_0x4e61('0x79')])||_0x1109dd[_0x4e61('0x79')]===_0x4e1d16){_0x46860e[_0x4e61('0x73')]=_0x4e1d16+0x1;return;}if(_0x1109dd[_0x4e61('0x79')]>_0x4e1d16){_0x46860e[_0x4e61('0x73')]=_0x1109dd['min_internal'];return;}return db[_0x4e61('0x62')][_0x4e61('0x54')](_0x4e61('0x7a'),{'type':db['sequelize'][_0x4e61('0x7b')][_0x4e61('0x7c')]})['then'](function(_0x429967){if(_0x429967&&_0x429967['length']){for(var _0x4dcd34=0x0,_0x297ab3=_0x429967[_0x4e61('0x59')];_0x4dcd34<_0x297ab3&&_[_0x4e61('0x78')](_0x46860e[_0x4e61('0x73')]);_0x4dcd34++){if(_0x1109dd[_0x4e61('0x79')]<=_0x429967[_0x4dcd34][_0x4e61('0x7d')]){_0x46860e[_0x4e61('0x73')]=_0x429967[_0x4dcd34][_0x4e61('0x7d')];}else if(_0x1109dd[_0x4e61('0x79')]>_0x429967[_0x4dcd34][_0x4e61('0x7d')]&&_0x1109dd[_0x4e61('0x79')]<=_0x429967[_0x4dcd34]['to']){_0x46860e['internal']=_0x1109dd[_0x4e61('0x79')];}}}if(_['isNil'](_0x46860e['internal'])){_0x46860e[_0x4e61('0x73')]=_0x4e1d16+0x1;}return _0x5e7202(_0x46860e);});});})['catch'](function(_0x35b693){_0x19ecfb(_0x35b693);});});}function updateUser(_0x233c00){return new BPromise(function(_0x1f2238,_0x26045e){try{if(_0x233c00[_0x4e61('0x7e')]){_0x233c00[_0x4e61('0x7f')]=_0x233c00[_0x4e61('0x73')];_0x233c00[_0x4e61('0x80')]={'mailbox':_0x233c00['internal'],'password':_0x233c00['password'],'fullname':_0x233c00[_0x4e61('0x81')],'email':_0x233c00[_0x4e61('0x82')]};}if(_0x233c00[_0x4e61('0x3b')]===_0x4e61('0x3f')){if(!_0x233c00[_0x4e61('0x83')])_0x233c00[_0x4e61('0x83')]=[_0x4e61('0x84'),_0x4e61('0x85'),_0x4e61('0x86'),_0x4e61('0x87'),_0x4e61('0x88'),_0x4e61('0x89'),_0x4e61('0x8a'),_0x4e61('0x8b'),'107','108',_0x4e61('0x8c'),_0x4e61('0x8d'),_0x4e61('0x8e'),'114'];}_0x1f2238(_0x233c00);}catch(_0x47af62){_0x26045e(_0x47af62);}});}exports['create']=function(_0x4cb010,_0x76335d){if(_0x4cb010[_0x4e61('0x3e')][_0x4e61('0x3b')]===_0x4e61('0x3f'))throw new Error(_0x4e61('0x8f'));if(_0x4cb010[_0x4e61('0x6d')][_0x4e61('0x3b')]===_0x4e61('0x3e')&&_0x4cb010[_0x4e61('0x3e')][_0x4e61('0x3b')]!==_0x4e61('0x3c')){throw new Error(_0x4e61('0x90'));}if(_0x4cb010[_0x4e61('0x6d')][_0x4e61('0x3b')]==='admin'&&_0x4cb010['user'][_0x4e61('0x3b')]!==_0x4e61('0x3c')){throw new Error(_0x4e61('0x91'));}return licenseUtil['checkUserLimits']([_0x4cb010['body']])[_0x4e61('0x38')](function(){return validateUser(_0x4cb010['body']);})[_0x4e61('0x38')](function(_0x266112){return updateUser(_0x266112)[_0x4e61('0x38')](function(_0x48e27a){if(_0x48e27a[_0x4e61('0x3b')]===_0x4e61('0x3c')){_0x48e27a[_0x4e61('0x92')]=_0x4cb010[_0x4e61('0x3e')]['settingsEnabled'];delete _0x48e27a[_0x4e61('0x93')];}return _0x48e27a;});})[_0x4e61('0x38')](function(_0x25f8ba){return db[_0x4e61('0x4c')][_0x4e61('0x94')](_0x25f8ba,{'include':[{'model':db[_0x4e61('0x80')],'as':'VoiceMail'}]});})[_0x4e61('0x38')](function(_0x43808c){if(_0x4cb010['body'][_0x4e61('0x3b')]===_0x4e61('0x3e'))return _0x43808c;if(_0x4cb010['user']['role']!==_0x4e61('0x3e'))return _0x43808c;return db[_0x4e61('0x95')][_0x4e61('0x6c')]({'where':{'name':_0x43808c[_0x4e61('0x3b')]===_0x4e61('0x3f')?_0x4e61('0x96'):_0x4e61('0x40'),'userProfileId':_0x4cb010[_0x4e61('0x3e')][_0x4e61('0x93')]},'raw':!![]})[_0x4e61('0x38')](function(_0x28b2fa){if(!_0x28b2fa||_0x28b2fa[_0x4e61('0x97')]!=0x0)return _0x43808c;return db[_0x4e61('0x46')][_0x4e61('0x94')]({'name':_0x43808c[_0x4e61('0x49')],'resourceId':_0x43808c['id'],'type':_0x28b2fa[_0x4e61('0x49')],'sectionId':_0x28b2fa['id']},{})[_0x4e61('0x38')](function(){return _0x43808c;});})[_0x4e61('0x68')](function(_0xd95ed0){logger[_0x4e61('0x2c')](_0x4e61('0x98'),_0xd95ed0);throw _0xd95ed0;});})[_0x4e61('0x38')](respondWithResult(_0x76335d,0xc9))[_0x4e61('0x68')](handleError(_0x76335d,null));};exports['bulkCreate']=function(_0x4a1a1d,_0x11cf51){var _0x3e1e1c=_0x4a1a1d[_0x4e61('0x6d')];var _0x5b052e=[];if(_0x4a1a1d[_0x4e61('0x3e')][_0x4e61('0x3b')]==='agent')throw new Error(_0x4e61('0x8f'));if(_[_0x4e61('0x99')](_0x3e1e1c,[_0x4e61('0x3b'),'user'])&&_0x4a1a1d['user'][_0x4e61('0x3b')]!=='admin'){throw new Error(_0x4e61('0x90'));}if(_[_0x4e61('0x99')](_0x3e1e1c,[_0x4e61('0x3b'),_0x4e61('0x3c')])&&_0x4a1a1d[_0x4e61('0x3e')]['role']!==_0x4e61('0x3c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x4e61('0x9a')](_0x3e1e1c)[_0x4e61('0x38')](function(){return validateUser(_0x3e1e1c[0x0]);})[_0x4e61('0x38')](function(){for(var _0x3720f9=0x1;_0x3720f9<_0x3e1e1c[_0x4e61('0x59')];_0x3720f9++){var _0x54258c=_0x3e1e1c[_0x3720f9-0x1]['internal'];if(!_0x3e1e1c[_0x3720f9][_0x4e61('0x73')])_0x3e1e1c[_0x3720f9][_0x4e61('0x73')]=_0x54258c+0x1;_0x5b052e[_0x4e61('0x9b')](validateUser(_0x3e1e1c[_0x3720f9]));}return BPromise[_0x4e61('0x9c')](_0x5b052e);})[_0x4e61('0x38')](function(){_0x5b052e=[];for(var _0x35df5f=0x0;_0x35df5f<_0x3e1e1c[_0x4e61('0x59')];_0x35df5f++){_0x5b052e[_0x4e61('0x9b')](updateUser(_0x3e1e1c[_0x35df5f]));}return BPromise[_0x4e61('0x9c')](_0x5b052e);})[_0x4e61('0x38')](function(){return BPromise[_0x4e61('0x9d')](_0x3e1e1c,function(_0x5ccdf9){return db['User']['create'](_0x5ccdf9,{'include':[{'model':db[_0x4e61('0x80')],'as':_0x4e61('0x80')}]})[_0x4e61('0x38')](function(_0x55a3b0){_0x5ccdf9['id']=_0x55a3b0['id'];return _0x5ccdf9;});});})['then'](function(_0x555e4e){if(_0x4a1a1d['body']['role']==='user')return _0x555e4e;if(_0x4a1a1d[_0x4e61('0x3e')][_0x4e61('0x3b')]!==_0x4e61('0x3e'))return _0x555e4e;var _0x57736a=_[_0x4e61('0x99')](_0x555e4e,function(_0x4ec1b3){return _0x4ec1b3[_0x4e61('0x3b')]===_0x4e61('0x3f')||_0x4ec1b3[_0x4e61('0x3b')]===_0x4e61('0x41');});if(!_0x57736a)return _0x555e4e;return db[_0x4e61('0x95')]['findAll']({'where':{'name':{'$or':[_0x4e61('0x96'),_0x4e61('0x40')]},'userProfileId':_0x4a1a1d['user'][_0x4e61('0x93')]},'raw':!![]})[_0x4e61('0x38')](function(_0x259009){if(_[_0x4e61('0x9e')](_0x259009)||!_[_0x4e61('0x99')](_0x259009,[_0x4e61('0x97'),0x0]))return _0x555e4e;_0x5b052e=[];var _0x8dd989=_(_0x259009)[_0x4e61('0x44')](function(_0x11aeae){if(_0x11aeae[_0x4e61('0x97')]===0x1)return;return _0x11aeae['name']===_0x4e61('0x96')?'agent':_0x4e61('0x41');})[_0x4e61('0x9f')]()[_0x4e61('0x45')]();for(var _0x22720a=0x0;_0x22720a<_0x555e4e[_0x4e61('0x59')];_0x22720a++){if(!_['includes'](_0x8dd989,_0x555e4e[_0x22720a][_0x4e61('0x3b')]))return;var _0x56e71b=_0x555e4e[_0x22720a]['role']===_0x4e61('0x3f')?_0x4e61('0x96'):'Telephones';_0x5b052e['push'](db[_0x4e61('0x46')]['create']({'name':_0x555e4e[_0x22720a][_0x4e61('0x49')],'resourceId':_0x555e4e[_0x22720a]['id'],'type':_0x56e71b,'sectionId':_[_0x4e61('0x6c')](_0x259009,[_0x4e61('0x49'),_0x56e71b])['id']},{}));}return BPromise[_0x4e61('0x9c')](_0x5b052e);})[_0x4e61('0x38')](respondWithResult(_0x11cf51,0xc9))['catch'](handleError(_0x11cf51,null));});};exports[_0x4e61('0xa0')]=function(_0x591762,_0x30ee74,_0x3b40da){if(_0x591762[_0x4e61('0x6d')]['id']){delete _0x591762[_0x4e61('0x6d')]['id'];}return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0x591762[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](function(_0x37a382){if(!_0x37a382)return null;if(_0x37a382['id']===_0x591762[_0x4e61('0x3e')]['id']){if(!_0x591762[_0x4e61('0x6d')]['oldPassword']||!_0x591762[_0x4e61('0x6d')][_0x4e61('0xa1')]){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0xa4'));}if(!_0x37a382[_0x4e61('0xa5')](_0x591762[_0x4e61('0x6d')][_0x4e61('0xa6')])){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0xa7'));}if(_0x591762[_0x4e61('0x6d')][_0x4e61('0xa6')]===_0x591762[_0x4e61('0x6d')][_0x4e61('0xa1')]){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x591762['user'][_0x4e61('0x3b')]===_0x4e61('0x3c')){if(!_0x591762[_0x4e61('0x6d')][_0x4e61('0xa1')]){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0xa8'));}}else if(_0x591762[_0x4e61('0x3e')]['role']==='user'){if(!_0x591762['body'][_0x4e61('0xa1')]){throw new db[(_0x4e61('0xa2'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x37a382['role']!==_0x4e61('0x3f')){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0x8f'));}}else{throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0x8f'));}return _0x37a382;})[_0x4e61('0x38')](handleEntityNotFound(_0x30ee74,null))['then'](function(_0x4a6c61){return db['Setting'][_0x4e61('0xa9')]({'attributes':['id',_0x4e61('0x75'),_0x4e61('0xaa'),_0x4e61('0xab')]})[_0x4e61('0x38')](function(_0x1dd2a5){if(_0x1dd2a5[_0x4e61('0x75')])authService[_0x4e61('0x76')](_0x591762['body'][_0x4e61('0xa1')]);if(!_0x1dd2a5[_0x4e61('0xaa')]||!_0x4a6c61['previousPasswords'])return _0x4a6c61;authService['validatePasswordHistory'](_0x591762[_0x4e61('0x6d')]['newPassword'],_0x4a6c61[_0x4e61('0xac')],_0x1dd2a5['passwordHistoryLimit']);return _0x4a6c61;})[_0x4e61('0x38')](saveUpdates({'password':_0x591762[_0x4e61('0x6d')]['newPassword'],'passwordResetAt':_0x591762[_0x4e61('0x3e')]['id']==_0x591762[_0x4e61('0x6e')]['id']?moment():null,'previousPasswords':authService[_0x4e61('0xad')](_0x591762[_0x4e61('0x6d')][_0x4e61('0xa1')],_0x4a6c61[_0x4e61('0xac')])},null));})['then'](respondWithResult(_0x30ee74,null))[_0x4e61('0x68')](handleError(_0x30ee74,null));};exports[_0x4e61('0xae')]=function(_0x18a4b2,_0x1c689b,_0x8daf5e){var _0x38c1fb=_0x18a4b2['body'][_0x4e61('0xaf')];return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0x18a4b2[_0x4e61('0x6e')]['id']},'attributes':['id',_0x4e61('0x49'),'role',_0x4e61('0xb0'),_0x4e61('0xb1'),_0x4e61('0xb2'),_0x4e61('0xb3')]})[_0x4e61('0x38')](handleEntityNotFound(_0x1c689b,null))[_0x4e61('0x38')](function(_0x59805f){if(_0x59805f){if(!utils[_0x4e61('0xb4')](_0x38c1fb)){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0xb5'));}return _0x59805f[_0x4e61('0xb6')+_['capitalize'](_0x38c1fb[_0x4e61('0xb7')]())+_0x4e61('0xb8')](_0x18a4b2[_0x4e61('0x6d')][_0x4e61('0x71')],{'penalty':_0x18a4b2[_0x4e61('0x6d')][_0x4e61('0xb9')]||0x0})[_0x4e61('0xba')](function(_0x945dd){for(var _0x30ef70=0x0;_0x30ef70<_0x18a4b2['body']['ids'][_0x4e61('0x59')];_0x30ef70+=0x1){var _0x37f130={'UserId':_0x18a4b2['params']['id']};_0x37f130[_['capitalize'](_0x38c1fb[_0x4e61('0xb7')]())+_0x4e61('0xbb')]=_0x18a4b2[_0x4e61('0x6d')][_0x4e61('0x71')][_0x30ef70];socket[_0x4e61('0xbc')](_0x4e61('0x3e')+_[_0x4e61('0xbd')](_0x38c1fb[_0x4e61('0xb7')]())+'Queue:save',_0x37f130);}return _0x945dd;})['then'](function(){if(_0x38c1fb==='voice'){return db[_0x4e61('0xbe')][_0x4e61('0xbf')]({'where':{'id':_0x18a4b2[_0x4e61('0x6d')][_0x4e61('0x71')]||[]},'raw':!![],'attributes':['id',_0x4e61('0x49')]});}})[_0x4e61('0x38')](function(_0x11ac2e){var _0x5dadb2=_0x59805f[_0x4e61('0x3a')]({'plain':!![]});var _0x304f72=[];if(_0x38c1fb===_0x4e61('0xc0')&&_0x5dadb2[_0x4e61('0x3b')]==='agent'&&_0x5dadb2[_0x4e61('0xb0')]){for(var _0x56d54e=0x0;_0x56d54e<_0x11ac2e[_0x4e61('0x59')];_0x56d54e+=0x1){_0x304f72[_0x4e61('0x9b')]({'membername':_0x5dadb2[_0x4e61('0x49')],'UserId':_0x5dadb2['id'],'queue_name':_0x11ac2e[_0x56d54e][_0x4e61('0x49')],'VoiceQueueId':_0x11ac2e[_0x56d54e]['id'],'interface':_[_0x4e61('0x78')](_0x5dadb2[_0x4e61('0xb3')])?util[_0x4e61('0xc1')](_0x4e61('0xc2'),_0x5dadb2[_0x4e61('0x49')]):_0x5dadb2[_0x4e61('0xb3')],'paused':_0x5dadb2[_0x4e61('0xb2')]||![],'penalty':_0x18a4b2[_0x4e61('0x6d')][_0x4e61('0xb9')]||0x0});}return BPromise[_0x4e61('0x9d')](_0x304f72,function(_0x3dc9ff){return db[_0x4e61('0xc3')][_0x4e61('0xc4')](_0x3dc9ff);});}return _0x59805f;});}})[_0x4e61('0x38')](respondWithStatusCode(_0x1c689b,null))[_0x4e61('0x68')](handleError(_0x1c689b,null));};exports[_0x4e61('0xc5')]=function(_0x4f9b8d,_0x4aeeef,_0x1d961a){var _0x57badf;return db['User'][_0x4e61('0x6c')]({'where':{'id':_0x4f9b8d[_0x4e61('0x6e')]['id']},'attributes':['id',_0x4e61('0x49'),_0x4e61('0x3b')]})[_0x4e61('0x38')](handleEntityNotFound(_0x4aeeef,null))[_0x4e61('0x38')](function(_0x7d760e){if(_0x7d760e){_0x57badf=_0x7d760e;if(!_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0xaf')]||!utils['isValidChannel'](_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0xaf')])){throw new db[(_0x4e61('0xa2'))]['ValidationError']('Unknown\x20channel');}return _0x7d760e[_0x4e61('0xc6')+_[_0x4e61('0xbd')](_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0xaf')][_0x4e61('0xb7')]())+'Queues'](_0x4f9b8d['query']['ids']);}})[_0x4e61('0x38')](function(_0x5875da){for(var _0x495f20=0x0;_0x495f20<_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0x71')][_0x4e61('0x59')];_0x495f20+=0x1){var _0x218279={'UserId':_0x4f9b8d[_0x4e61('0x6e')]['id']};_0x218279[_[_0x4e61('0xbd')](_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0xaf')]['toLowerCase']())+_0x4e61('0xbb')]=_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0x71')][_0x495f20];socket[_0x4e61('0xbc')](_0x4e61('0x3e')+_[_0x4e61('0xbd')](_0x4f9b8d[_0x4e61('0x54')]['channel'][_0x4e61('0xb7')]())+_0x4e61('0xc7'),_0x218279);}return _0x5875da;})['then'](function(){if(_0x4f9b8d[_0x4e61('0x54')][_0x4e61('0xaf')]===_0x4e61('0xc0')){return db[_0x4e61('0xc3')][_0x4e61('0x39')]({'where':{'UserId':_0x4f9b8d[_0x4e61('0x6e')]['id'],'VoiceQueueId':_0x4f9b8d['query'][_0x4e61('0x71')]},'individualHooks':!![]})[_0x4e61('0x38')](function(){return _0x57badf;});}return _0x57badf;})[_0x4e61('0x38')](respondWithStatusCode(_0x4aeeef,null))[_0x4e61('0x68')](handleError(_0x4aeeef,null));};exports[_0x4e61('0xc8')]=function(_0xd2a424,_0x493bed,_0x5a6f7a){_0xd2a424[_0x4e61('0x6d')][_0x4e61('0xc9')]=_0xd2a424[_0x4e61('0xca')][_0x4e61('0xcb')];return db['User'][_0x4e61('0x6c')]({'where':{'id':_0xd2a424['params']['id']}})['then'](handleEntityNotFound(_0x493bed,null))[_0x4e61('0x38')](saveUpdates(_0xd2a424[_0x4e61('0x6d')],null))[_0x4e61('0x38')](respondWithResult(_0x493bed,null))[_0x4e61('0x68')](handleError(_0x493bed,null));};exports[_0x4e61('0xcc')]=function(_0xbbf01f,_0x55abc8,_0x544273){var _0x27775f=path[_0x4e61('0xcd')](config[_0x4e61('0xce')],_0x4e61('0xcf'));return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0xbbf01f['params']['id']},'attributes':['id',_0x4e61('0xc9')],'raw':!![]})[_0x4e61('0x38')](handleEntityNotFound(_0x55abc8,null))[_0x4e61('0x38')](function(_0x44804d){if(_0x44804d){if(_[_0x4e61('0x78')](_0x44804d['userpic'])){return _0x55abc8['download'](_0x27775f);}else{if(!fs[_0x4e61('0xd0')](path['join'](config[_0x4e61('0xce')],_0x4e61('0xd1'),_0x44804d['userpic']))){return _0x55abc8[_0x4e61('0xd2')](_0x27775f);}return _0x55abc8[_0x4e61('0xd2')](path[_0x4e61('0xcd')](config['root'],'server/files/images/',_0x44804d[_0x4e61('0xc9')]));}}})[_0x4e61('0x68')](handleError(_0x55abc8,null));};exports[_0x4e61('0xd3')]=function(_0x363466,_0x4a4579,_0x2dd76b){var _0x5cc1d6={};var _0x57bb3d={};var _0x13657f;var _0x4daead;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x363466[_0x4e61('0x6e')]['id']}})['then'](handleEntityNotFound(_0x4a4579,null))[_0x4e61('0x38')](function(_0xf7c12b){if(_0xf7c12b){_0x13657f=_0xf7c12b;_0x57bb3d['model']=_[_0x4e61('0x6a')](db[_0x4e61('0xd4')][_0x4e61('0x4d')]);_0x57bb3d[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x363466[_0x4e61('0x54')]);_0x57bb3d['filters']=_[_0x4e61('0x56')](_0x57bb3d[_0x4e61('0x50')],_0x57bb3d[_0x4e61('0x54')]);_0x5cc1d6[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x57bb3d[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x363466['query'][_0x4e61('0x57')]));_0x5cc1d6['attributes']=_0x5cc1d6['attributes']['length']?_0x5cc1d6[_0x4e61('0x58')]:_0x57bb3d['model'];_0x5cc1d6[_0x4e61('0x5c')]=qs['sort'](_0x363466[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x5cc1d6['where']=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x363466[_0x4e61('0x54')],_0x57bb3d[_0x4e61('0x55')]));if(_0x363466[_0x4e61('0x54')][_0x4e61('0x42')]){_0x5cc1d6[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x5cc1d6[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x5cc1d6[_0x4e61('0x58')],function(_0x3f85de){var _0x368585={};_0x368585[_0x3f85de]={'$like':'%'+_0x363466[_0x4e61('0x54')]['filter']+'%'};return _0x368585;})});}_0x5cc1d6=_[_0x4e61('0x60')]({},_0x5cc1d6,_0x363466[_0x4e61('0x65')]);return _0x13657f[_0x4e61('0xd3')](_0x5cc1d6);}})[_0x4e61('0x38')](function(_0x4e52b7){if(_0x4e52b7){_0x4daead=_0x4e52b7[_0x4e61('0x59')];if(_0x363466[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0xd5'))){_0x5cc1d6[_0x4e61('0x6b')]=[{'model':db[_0x4e61('0xd6')],'as':'List','required':![]},{'model':db[_0x4e61('0xd7')],'as':_0x4e61('0xd8'),'attributes':['id','name','color'],'where':_0x363466['query']['tag']?{'id':_0x363466[_0x4e61('0x54')][_0x4e61('0xd9')]}:undefined,'required':_0x363466['query']['tag']?!![]:![]}];}if(!_0x363466['query'][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x5cc1d6[_0x4e61('0x33')]=qs[_0x4e61('0x33')](_0x363466[_0x4e61('0x54')][_0x4e61('0x33')]);_0x5cc1d6[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x363466[_0x4e61('0x54')][_0x4e61('0x32')]);}return _0x13657f[_0x4e61('0xd3')](_0x5cc1d6);}})[_0x4e61('0x38')](function(_0x104ea4){if(_0x104ea4){return _0x104ea4?{'count':_0x4daead,'rows':_0x104ea4}:null;}})[_0x4e61('0x38')](respondWithResult(_0x4a4579,null))[_0x4e61('0x68')](handleError(_0x4a4579,null));};exports[_0x4e61('0xda')]=function(_0x75e382,_0x2b9fa9,_0x17e8c8){var _0x4db06f;var _0x2af62e;var _0x185c40={};var _0x5a3533;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x75e382[_0x4e61('0x6e')]['id']},'attributes':['id','name',_0x4e61('0x3b')]})[_0x4e61('0x38')](handleEntityNotFound(_0x2b9fa9,null))['then'](function(_0x540b7f){if(!utils[_0x4e61('0xb4')](_0x75e382[_0x4e61('0x54')][_0x4e61('0xaf')])){throw new db['Sequelize']['ValidationError'](_0x4e61('0xb5'));}_0x4db06f=_0x540b7f;var _0x4ec4ec={};_0x4ec4ec[_0x4e61('0x50')]=_['keys'](db[_[_0x4e61('0xbd')](_0x75e382[_0x4e61('0x54')][_0x4e61('0xaf')])+_0x4e61('0xdb')][_0x4e61('0x4d')]);_0x4ec4ec[_0x4e61('0x54')]=_['keys'](_0x75e382['query']);_0x4ec4ec[_0x4e61('0x55')]=_['intersection'](_0x4ec4ec[_0x4e61('0x50')],_0x4ec4ec[_0x4e61('0x54')]);_0x185c40[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x4ec4ec['model'],qs['fields'](_0x75e382[_0x4e61('0x54')][_0x4e61('0x57')]));_0x185c40[_0x4e61('0x58')]=_0x185c40[_0x4e61('0x58')]['length']?_0x185c40[_0x4e61('0x58')]:_0x4ec4ec[_0x4e61('0x50')];_0x185c40[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x75e382[_0x4e61('0x54')]['sort']);_0x185c40[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x75e382[_0x4e61('0x54')],_0x4ec4ec['filters']));if(_0x75e382[_0x4e61('0x54')][_0x4e61('0x42')]){_0x185c40['where']=_[_0x4e61('0x60')](_0x185c40['where'],{'$or':_[_0x4e61('0x44')](_0x185c40[_0x4e61('0x58')],function(_0x8689eb){var _0x54024b={};_0x54024b[_0x8689eb]={'$like':'%'+_0x75e382[_0x4e61('0x54')]['filter']+'%'};return _0x54024b;})});}_0x185c40=_[_0x4e61('0x60')]({},_0x185c40,_0x75e382[_0x4e61('0x65')]);switch(_0x4db06f[_0x4e61('0x3b')]){case _0x4e61('0x3c'):return db[_['capitalize'](_0x75e382[_0x4e61('0x54')][_0x4e61('0xaf')])+_0x4e61('0xdb')][_0x4e61('0xbf')](_0x185c40);case _0x4e61('0x3e'):case _0x4e61('0x3f'):return _0x4db06f[_0x4e61('0x3a')+_[_0x4e61('0xbd')](_0x75e382[_0x4e61('0x54')]['channel'])+'Queues'](_0x185c40);default:throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0xdc'));}})['then'](function(_0x3febec){_0x5a3533=_0x3febec[_0x4e61('0x59')];if(!_0x75e382[_0x4e61('0x54')][_0x4e61('0x5a')]('nolimit')){_0x185c40[_0x4e61('0x33')]=qs[_0x4e61('0x33')](_0x75e382[_0x4e61('0x54')][_0x4e61('0x33')]);_0x185c40[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x75e382[_0x4e61('0x54')][_0x4e61('0x32')]);}switch(_0x4db06f[_0x4e61('0x3b')]){case'admin':return db[_[_0x4e61('0xbd')](_0x75e382['query'][_0x4e61('0xaf')])+_0x4e61('0xdb')]['findAll'](_0x185c40);case _0x4e61('0x3e'):case'agent':return _0x4db06f[_0x4e61('0x3a')+_[_0x4e61('0xbd')](_0x75e382[_0x4e61('0x54')][_0x4e61('0xaf')])+'Queues'](_0x185c40);}})['then'](function(_0x544c5b){return{'count':_0x5a3533,'rows':_0x544c5b};})['then'](respondWithResult(_0x2b9fa9,null))[_0x4e61('0x68')](handleError(_0x2b9fa9,null));};exports[_0x4e61('0xdd')]=function(_0x40ecc1,_0x51208e,_0x32936b){var _0x1f2e0e={};var _0x2e248a={};var _0x26febc;var _0x5e3e7c;return db['User']['findOne']({'where':{'id':_0x40ecc1[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x51208e,null))[_0x4e61('0x38')](function(_0x1dce47){if(_0x1dce47){_0x26febc=_0x1dce47;_0x2e248a['model']=_[_0x4e61('0x6a')](db[_0x4e61('0xc3')]['rawAttributes']);_0x2e248a[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x40ecc1['query']);_0x2e248a['filters']=_[_0x4e61('0x56')](_0x2e248a[_0x4e61('0x50')],_0x2e248a['query']);_0x1f2e0e[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x2e248a['model'],qs[_0x4e61('0x57')](_0x40ecc1['query'][_0x4e61('0x57')]));_0x1f2e0e[_0x4e61('0x58')]=_0x1f2e0e[_0x4e61('0x58')][_0x4e61('0x59')]?_0x1f2e0e[_0x4e61('0x58')]:_0x2e248a['model'];_0x1f2e0e['order']=qs[_0x4e61('0x5d')](_0x40ecc1[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x1f2e0e[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_['pick'](_0x40ecc1[_0x4e61('0x54')],_0x2e248a['filters']));if(_0x40ecc1[_0x4e61('0x54')][_0x4e61('0x42')]){_0x1f2e0e[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x1f2e0e[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x1f2e0e[_0x4e61('0x58')],function(_0x4a2225){var _0xe6d9d={};_0xe6d9d[_0x4a2225]={'$like':'%'+_0x40ecc1[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0xe6d9d;})});}_0x1f2e0e=_[_0x4e61('0x60')]({},_0x1f2e0e,_0x40ecc1[_0x4e61('0x65')]);return _0x26febc[_0x4e61('0xdd')](_0x1f2e0e);}})[_0x4e61('0x38')](function(_0x8c8662){if(_0x8c8662){_0x5e3e7c=_0x8c8662[_0x4e61('0x59')];if(!_0x40ecc1['query'][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x1f2e0e[_0x4e61('0x33')]=qs['limit'](_0x40ecc1[_0x4e61('0x54')]['limit']);_0x1f2e0e['offset']=qs[_0x4e61('0x32')](_0x40ecc1['query'][_0x4e61('0x32')]);}return _0x26febc[_0x4e61('0xdd')](_0x1f2e0e);}})['then'](function(_0x570450){if(_0x570450){return _0x570450?{'count':_0x5e3e7c,'rows':_0x570450}:null;}})['then'](respondWithResult(_0x51208e,null))['catch'](handleError(_0x51208e,null));};exports[_0x4e61('0xde')]=function(_0xc3b66a,_0x12b1be,_0x2ff540){var _0x5b1e7f={};var _0x3097d6={};var _0x25f80c;var _0x25c00f;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0xc3b66a[_0x4e61('0x6e')]['id']}})['then'](handleEntityNotFound(_0x12b1be,null))[_0x4e61('0x38')](function(_0x48df2f){if(_0x48df2f){_0x25f80c=_0x48df2f;_0x3097d6[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db[_0x4e61('0xdf')]['rawAttributes']);_0x3097d6['query']=_[_0x4e61('0x6a')](_0xc3b66a['query']);_0x3097d6[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0x3097d6['model'],_0x3097d6[_0x4e61('0x54')]);_0x5b1e7f[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x3097d6[_0x4e61('0x50')],qs['fields'](_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x57')]));_0x5b1e7f[_0x4e61('0x58')]=_0x5b1e7f['attributes'][_0x4e61('0x59')]?_0x5b1e7f[_0x4e61('0x58')]:_0x3097d6[_0x4e61('0x50')];_0x5b1e7f[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x5b1e7f[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0xc3b66a[_0x4e61('0x54')],_0x3097d6[_0x4e61('0x55')]));if(_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x42')]){_0x5b1e7f[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x5b1e7f['where'],{'$or':_[_0x4e61('0x44')](_0x5b1e7f[_0x4e61('0x58')],function(_0x360e2e){var _0x440e57={};_0x440e57[_0x360e2e]={'$like':'%'+_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x440e57;})});}_0x5b1e7f=_[_0x4e61('0x60')]({},_0x5b1e7f,_0xc3b66a[_0x4e61('0x65')]);return _0x25f80c['getGroups'](_0x5b1e7f);}})[_0x4e61('0x38')](function(_0x54b6e5){if(_0x54b6e5){_0x25c00f=_0x54b6e5[_0x4e61('0x59')];if(!_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x5a')]('nolimit')){_0x5b1e7f[_0x4e61('0x33')]=qs[_0x4e61('0x33')](_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x33')]);_0x5b1e7f[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0xc3b66a[_0x4e61('0x54')][_0x4e61('0x32')]);}return _0x25f80c[_0x4e61('0xde')](_0x5b1e7f);}})[_0x4e61('0x38')](function(_0x1719f2){if(_0x1719f2){return _0x1719f2?{'count':_0x25c00f,'rows':_0x1719f2}:null;}})[_0x4e61('0x38')](respondWithResult(_0x12b1be,null))[_0x4e61('0x68')](handleError(_0x12b1be,null));};exports['getRecordings']=function(_0x4d68c9,_0x4ec338,_0x3d8311){var _0x50bdc3={'raw':!![],'where':{}};var _0xd6d9df={};var _0x17444d={'count':0x0,'rows':[]};return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x4d68c9[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x4ec338,null))[_0x4e61('0x38')](function(_0x447dc5){if(_0x447dc5){_0xd6d9df['model']=_[_0x4e61('0x6a')](db[_0x4e61('0xe0')][_0x4e61('0x4d')]);_0xd6d9df['query']=_[_0x4e61('0x6a')](_0x4d68c9[_0x4e61('0x54')]);_0xd6d9df['filters']=_[_0x4e61('0x56')](_0xd6d9df['model'],_0xd6d9df[_0x4e61('0x54')]);_0x50bdc3['attributes']=_[_0x4e61('0x56')](_0xd6d9df[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x4d68c9['query'][_0x4e61('0x57')]));_0x50bdc3['attributes']=_0x50bdc3['attributes'][_0x4e61('0x59')]?_0x50bdc3[_0x4e61('0x58')]:_0xd6d9df[_0x4e61('0x50')];if(!_0x4d68c9[_0x4e61('0x54')]['hasOwnProperty'](_0x4e61('0x5b'))){_0x50bdc3['limit']=qs[_0x4e61('0x33')](_0x4d68c9[_0x4e61('0x54')]['limit']);_0x50bdc3[_0x4e61('0x32')]=qs['offset'](_0x4d68c9['query'][_0x4e61('0x32')]);}_0x50bdc3['order']=qs[_0x4e61('0x5d')](_0x4d68c9[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x50bdc3[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x4d68c9[_0x4e61('0x54')],_0xd6d9df[_0x4e61('0x55')]));_0x50bdc3[_0x4e61('0x5f')][_0x4e61('0xe1')]=_0x447dc5['id'];if(_0x4d68c9['query'][_0x4e61('0x42')]){_0x50bdc3['where']=_['merge'](_0x50bdc3[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x50bdc3[_0x4e61('0x58')],function(_0x13697f){var _0x4706c9={};_0x4706c9[_0x13697f]={'$like':'%'+_0x4d68c9[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x4706c9;})});}_0x50bdc3=_[_0x4e61('0x60')]({},_0x50bdc3,_0x4d68c9[_0x4e61('0x65')]);return db[_0x4e61('0xe0')]['count']({'where':_0x50bdc3['where']})['then'](function(_0x12910b){_0x17444d[_0x4e61('0x66')]=_0x12910b;if(_0x4d68c9[_0x4e61('0x54')][_0x4e61('0xd5')]){_0x50bdc3[_0x4e61('0x6b')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4e61('0xbf')](_0x50bdc3);})[_0x4e61('0x38')](function(_0x1a2a49){_0x17444d['rows']=_0x1a2a49;return _0x17444d;});}})[_0x4e61('0x38')](respondWithFilteredResult(_0x4ec338,_0x50bdc3))['catch'](handleError(_0x4ec338,null));};exports[_0x4e61('0xe2')]=function(_0x310848,_0x3c7ad8,_0x35a349){var _0x1d6a38={'raw':!![],'where':{}};var _0x2bfcfa={};var _0x2825ab={'count':0x0,'rows':[]};return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x310848[_0x4e61('0x6e')]['id']}})['then'](handleEntityNotFound(_0x3c7ad8,null))[_0x4e61('0x38')](function(_0x24721f){if(_0x24721f){_0x2bfcfa[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db['ScreenRecording'][_0x4e61('0x4d')]);_0x2bfcfa[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x310848['query']);_0x2bfcfa['filters']=_[_0x4e61('0x56')](_0x2bfcfa[_0x4e61('0x50')],_0x2bfcfa[_0x4e61('0x54')]);_0x1d6a38['attributes']=_[_0x4e61('0x56')](_0x2bfcfa[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x310848[_0x4e61('0x54')][_0x4e61('0x57')]));_0x1d6a38[_0x4e61('0x58')]=_0x1d6a38[_0x4e61('0x58')][_0x4e61('0x59')]?_0x1d6a38[_0x4e61('0x58')]:_0x2bfcfa[_0x4e61('0x50')];if(!_0x310848[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x1d6a38['limit']=qs[_0x4e61('0x33')](_0x310848[_0x4e61('0x54')][_0x4e61('0x33')]);_0x1d6a38['offset']=qs[_0x4e61('0x32')](_0x310848[_0x4e61('0x54')][_0x4e61('0x32')]);}_0x1d6a38[_0x4e61('0x5c')]=qs['sort'](_0x310848[_0x4e61('0x54')]['sort']);_0x1d6a38[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x310848[_0x4e61('0x54')],_0x2bfcfa[_0x4e61('0x55')]));_0x1d6a38[_0x4e61('0x5f')][_0x4e61('0xe1')]=_0x24721f['id'];if(_0x310848[_0x4e61('0x54')][_0x4e61('0x42')]){_0x1d6a38[_0x4e61('0x5f')]=_['merge'](_0x1d6a38[_0x4e61('0x5f')],{'$or':_['map'](_0x1d6a38[_0x4e61('0x58')],function(_0xbf696d){var _0x42182e={};_0x42182e[_0xbf696d]={'$like':'%'+_0x310848['query'][_0x4e61('0x42')]+'%'};return _0x42182e;})});}_0x1d6a38=_[_0x4e61('0x60')]({},_0x1d6a38,_0x310848[_0x4e61('0x65')]);return db[_0x4e61('0xe3')]['count']({'where':_0x1d6a38[_0x4e61('0x5f')]})[_0x4e61('0x38')](function(_0x7d5df9){_0x2825ab[_0x4e61('0x66')]=_0x7d5df9;if(_0x310848[_0x4e61('0x54')]['includeAll']){_0x1d6a38[_0x4e61('0x6b')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x1d6a38);})['then'](function(_0x39c9a4){_0x2825ab[_0x4e61('0x67')]=_0x39c9a4;return _0x2825ab;});}})[_0x4e61('0x38')](respondWithFilteredResult(_0x3c7ad8,_0x1d6a38))[_0x4e61('0x68')](handleError(_0x3c7ad8,null));};exports[_0x4e61('0xe4')]=function(_0x22c62a,_0x26d431,_0x595708){var _0x5da4ee={};var _0x5212b2={};var _0x2bc067;var _0x25f815;return db[_0x4e61('0x4c')]['findOne']({'where':{'id':_0x22c62a[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x26d431,null))['then'](function(_0x4dbb0a){if(_0x4dbb0a){_0x2bc067=_0x4dbb0a;_0x5212b2[_0x4e61('0x50')]=_['keys'](db[_0x4e61('0xe5')][_0x4e61('0x4d')]);_0x5212b2[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x22c62a['query']);_0x5212b2[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0x5212b2['model'],_0x5212b2['query']);_0x5da4ee[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x5212b2[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x22c62a[_0x4e61('0x54')][_0x4e61('0x57')]));_0x5da4ee['attributes']=_0x5da4ee[_0x4e61('0x58')][_0x4e61('0x59')]?_0x5da4ee[_0x4e61('0x58')]:_0x5212b2[_0x4e61('0x50')];_0x5da4ee[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x22c62a[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x5da4ee[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x22c62a[_0x4e61('0x54')],_0x5212b2['filters']));if(_0x22c62a['query'][_0x4e61('0x42')]){_0x5da4ee[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x5da4ee[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x5da4ee['attributes'],function(_0x1dfcd4){var _0x10afe={};_0x10afe[_0x1dfcd4]={'$like':'%'+_0x22c62a[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x10afe;})});}_0x5da4ee=_['merge']({},_0x5da4ee,_0x22c62a[_0x4e61('0x65')]);return _0x2bc067[_0x4e61('0xe4')](_0x5da4ee);}})['then'](function(_0x1f6077){if(_0x1f6077){_0x25f815=_0x1f6077[_0x4e61('0x59')];if(!_0x22c62a[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x5da4ee[_0x4e61('0x33')]=qs['limit'](_0x22c62a[_0x4e61('0x54')]['limit']);_0x5da4ee[_0x4e61('0x32')]=qs['offset'](_0x22c62a[_0x4e61('0x54')][_0x4e61('0x32')]);}return _0x2bc067[_0x4e61('0xe4')](_0x5da4ee);}})[_0x4e61('0x38')](function(_0x30159c){if(_0x30159c){return _0x30159c?{'count':_0x25f815,'rows':_0x30159c}:null;}})[_0x4e61('0x38')](respondWithResult(_0x26d431,null))['catch'](handleError(_0x26d431,null));};exports[_0x4e61('0xe6')]=function(_0x2d8213,_0xaded8f,_0x3a16ae){var _0x43bc5d={};var _0x182bef={};var _0x497a4d;var _0x7e44cd;return db[_0x4e61('0x4c')]['findOne']({'where':{'id':_0x2d8213['params']['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0xaded8f,null))[_0x4e61('0x38')](function(_0x4ef87d){if(_0x4ef87d){_0x497a4d=_0x4ef87d;_0x182bef[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db[_0x4e61('0xe7')][_0x4e61('0x4d')]);_0x182bef['query']=_[_0x4e61('0x6a')](_0x2d8213[_0x4e61('0x54')]);_0x182bef[_0x4e61('0x55')]=_['intersection'](_0x182bef[_0x4e61('0x50')],_0x182bef[_0x4e61('0x54')]);_0x43bc5d[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x182bef[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x2d8213[_0x4e61('0x54')][_0x4e61('0x57')]));_0x43bc5d[_0x4e61('0x58')]=_0x43bc5d['attributes']['length']?_0x43bc5d[_0x4e61('0x58')]:_0x182bef[_0x4e61('0x50')];_0x43bc5d['order']=qs[_0x4e61('0x5d')](_0x2d8213['query'][_0x4e61('0x5d')]);_0x43bc5d[_0x4e61('0x5f')]=qs['filters'](_[_0x4e61('0x5e')](_0x2d8213[_0x4e61('0x54')],_0x182bef[_0x4e61('0x55')]));if(_0x2d8213['query']['filter']){_0x43bc5d[_0x4e61('0x5f')]=_['merge'](_0x43bc5d[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x43bc5d[_0x4e61('0x58')],function(_0x677128){var _0x4c58f2={};_0x4c58f2[_0x677128]={'$like':'%'+_0x2d8213[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x4c58f2;})});}_0x43bc5d=_['merge']({},_0x43bc5d,_0x2d8213[_0x4e61('0x65')]);return _0x497a4d[_0x4e61('0xe6')](_0x43bc5d);}})[_0x4e61('0x38')](function(_0x5a6610){if(_0x5a6610){_0x7e44cd=_0x5a6610[_0x4e61('0x59')];if(!_0x2d8213[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x43bc5d[_0x4e61('0x33')]=qs[_0x4e61('0x33')](_0x2d8213['query'][_0x4e61('0x33')]);_0x43bc5d[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x2d8213['query'][_0x4e61('0x32')]);}return _0x497a4d[_0x4e61('0xe6')](_0x43bc5d);}})[_0x4e61('0x38')](function(_0x152ce6){if(_0x152ce6){return _0x152ce6?{'count':_0x7e44cd,'rows':_0x152ce6}:null;}})[_0x4e61('0x38')](respondWithResult(_0xaded8f,null))[_0x4e61('0x68')](handleError(_0xaded8f,null));};exports['getMailInteractions']=function(_0x33bd2e,_0x51920e,_0x3a7d0c){var _0x5f019d={'raw':!![],'where':{}};var _0x10165d={};var _0x575002={'count':0x0,'rows':[]};return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x33bd2e['params']['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x51920e,null))['then'](function(_0xe78b22){if(_0xe78b22){_0x10165d[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db[_0x4e61('0xe8')][_0x4e61('0x4d')]);_0x10165d[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x33bd2e['query']);_0x10165d[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0x10165d[_0x4e61('0x50')],_0x10165d[_0x4e61('0x54')]);_0x5f019d[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x10165d['model'],qs[_0x4e61('0x57')](_0x33bd2e['query'][_0x4e61('0x57')]));_0x5f019d[_0x4e61('0x58')]=_0x5f019d[_0x4e61('0x58')][_0x4e61('0x59')]?_0x5f019d[_0x4e61('0x58')]:_0x10165d['model'];if(!_0x33bd2e[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x5f019d[_0x4e61('0x33')]=qs[_0x4e61('0x33')](_0x33bd2e['query'][_0x4e61('0x33')]);_0x5f019d['offset']=qs[_0x4e61('0x32')](_0x33bd2e['query'][_0x4e61('0x32')]);}_0x5f019d[_0x4e61('0x5c')]=qs['sort'](_0x33bd2e['query']['sort']);_0x5f019d[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x33bd2e[_0x4e61('0x54')],_0x10165d[_0x4e61('0x55')]));_0x5f019d[_0x4e61('0x5f')]['UserId']=_0xe78b22['id'];if(_0x33bd2e['query'][_0x4e61('0x42')]){_0x5f019d[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x5f019d[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x5f019d['attributes'],function(_0x12e4ec){var _0x284a7d={};_0x284a7d[_0x12e4ec]={'$like':'%'+_0x33bd2e[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x284a7d;})});}_0x5f019d=_['merge']({},_0x5f019d,_0x33bd2e['options']);return db[_0x4e61('0xe8')][_0x4e61('0x66')]({'where':_0x5f019d[_0x4e61('0x5f')]})['then'](function(_0x83d959){_0x575002[_0x4e61('0x66')]=_0x83d959;if(_0x33bd2e[_0x4e61('0x54')]['includeAll']){_0x5f019d[_0x4e61('0x6b')]=[{'all':!![]}];}return db[_0x4e61('0xe8')]['findAll'](_0x5f019d);})[_0x4e61('0x38')](function(_0xe5fee8){_0x575002[_0x4e61('0x67')]=_0xe5fee8;return _0x575002;});}})[_0x4e61('0x38')](respondWithFilteredResult(_0x51920e,_0x5f019d))[_0x4e61('0x68')](handleError(_0x51920e,null));};exports[_0x4e61('0xe9')]=function(_0x3de3e2,_0x3a51f1,_0x45e68a){var _0x35838d={};var _0xb0f2b3={};var _0x342638;var _0x4b5ad1;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x3de3e2[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x3a51f1,null))[_0x4e61('0x38')](function(_0x340f64){if(_0x340f64){_0x342638=_0x340f64;_0xb0f2b3[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db[_0x4e61('0xea')][_0x4e61('0x4d')]);_0xb0f2b3[_0x4e61('0x54')]=_['keys'](_0x3de3e2[_0x4e61('0x54')]);_0xb0f2b3[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0xb0f2b3[_0x4e61('0x50')],_0xb0f2b3[_0x4e61('0x54')]);_0x35838d[_0x4e61('0x58')]=_['intersection'](_0xb0f2b3[_0x4e61('0x50')],qs['fields'](_0x3de3e2[_0x4e61('0x54')][_0x4e61('0x57')]));_0x35838d[_0x4e61('0x58')]=_0x35838d[_0x4e61('0x58')]['length']?_0x35838d['attributes']:_0xb0f2b3[_0x4e61('0x50')];_0x35838d[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x3de3e2['query'][_0x4e61('0x5d')]);_0x35838d[_0x4e61('0x5f')]=qs['filters'](_[_0x4e61('0x5e')](_0x3de3e2[_0x4e61('0x54')],_0xb0f2b3['filters']));if(_0x3de3e2['query'][_0x4e61('0x42')]){_0x35838d[_0x4e61('0x5f')]=_['merge'](_0x35838d[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x35838d[_0x4e61('0x58')],function(_0x18f7d3){var _0x23d7b1={};_0x23d7b1[_0x18f7d3]={'$like':'%'+_0x3de3e2[_0x4e61('0x54')]['filter']+'%'};return _0x23d7b1;})});}_0x35838d=_['merge']({},_0x35838d,_0x3de3e2['options']);return _0x342638['getSmsInteractions'](_0x35838d);}})[_0x4e61('0x38')](function(_0x4738c3){if(_0x4738c3){_0x4b5ad1=_0x4738c3[_0x4e61('0x59')];if(!_0x3de3e2[_0x4e61('0x54')][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x35838d['limit']=qs['limit'](_0x3de3e2[_0x4e61('0x54')][_0x4e61('0x33')]);_0x35838d[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x3de3e2[_0x4e61('0x54')][_0x4e61('0x32')]);}return _0x342638[_0x4e61('0xe9')](_0x35838d);}})['then'](function(_0x4becb4){if(_0x4becb4){return _0x4becb4?{'count':_0x4b5ad1,'rows':_0x4becb4}:null;}})[_0x4e61('0x38')](respondWithResult(_0x3a51f1,null))[_0x4e61('0x68')](handleError(_0x3a51f1,null));};exports[_0x4e61('0xeb')]=function(_0x1b962e,_0x1157fa,_0x2317cf){var _0x45da11={};var _0x1bf271={};var _0xd8bf0f;var _0x28a6ff;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x1b962e[_0x4e61('0x6e')]['id']}})['then'](handleEntityNotFound(_0x1157fa,null))[_0x4e61('0x38')](function(_0x5a945f){if(_0x5a945f){_0xd8bf0f=_0x5a945f;_0x1bf271[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db['FaxInteraction'][_0x4e61('0x4d')]);_0x1bf271['query']=_[_0x4e61('0x6a')](_0x1b962e[_0x4e61('0x54')]);_0x1bf271[_0x4e61('0x55')]=_['intersection'](_0x1bf271['model'],_0x1bf271[_0x4e61('0x54')]);_0x45da11[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x1bf271[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x1b962e[_0x4e61('0x54')][_0x4e61('0x57')]));_0x45da11[_0x4e61('0x58')]=_0x45da11[_0x4e61('0x58')][_0x4e61('0x59')]?_0x45da11[_0x4e61('0x58')]:_0x1bf271[_0x4e61('0x50')];_0x45da11['order']=qs[_0x4e61('0x5d')](_0x1b962e[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x45da11['where']=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x1b962e[_0x4e61('0x54')],_0x1bf271[_0x4e61('0x55')]));if(_0x1b962e['query'][_0x4e61('0x42')]){_0x45da11['where']=_[_0x4e61('0x60')](_0x45da11[_0x4e61('0x5f')],{'$or':_[_0x4e61('0x44')](_0x45da11[_0x4e61('0x58')],function(_0x5c22f4){var _0x2a488b={};_0x2a488b[_0x5c22f4]={'$like':'%'+_0x1b962e[_0x4e61('0x54')]['filter']+'%'};return _0x2a488b;})});}_0x45da11=_[_0x4e61('0x60')]({},_0x45da11,_0x1b962e[_0x4e61('0x65')]);return _0xd8bf0f[_0x4e61('0xeb')](_0x45da11);}})[_0x4e61('0x38')](function(_0x10e47b){if(_0x10e47b){_0x28a6ff=_0x10e47b[_0x4e61('0x59')];if(!_0x1b962e[_0x4e61('0x54')][_0x4e61('0x5a')]('nolimit')){_0x45da11[_0x4e61('0x33')]=qs['limit'](_0x1b962e[_0x4e61('0x54')]['limit']);_0x45da11[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x1b962e['query'][_0x4e61('0x32')]);}return _0xd8bf0f[_0x4e61('0xeb')](_0x45da11);}})[_0x4e61('0x38')](function(_0x3fa1b3){if(_0x3fa1b3){return _0x3fa1b3?{'count':_0x28a6ff,'rows':_0x3fa1b3}:null;}})[_0x4e61('0x38')](respondWithResult(_0x1157fa,null))['catch'](handleError(_0x1157fa,null));};exports[_0x4e61('0xec')]=function(_0x10f131,_0x2323a4,_0x157824){var _0x1a1109={};var _0x3f9bf3={};var _0x22f022;var _0x257b47;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x10f131[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x2323a4,null))[_0x4e61('0x38')](function(_0x221b05){if(_0x221b05){_0x22f022=_0x221b05;_0x3f9bf3[_0x4e61('0x50')]=_['keys'](db[_0x4e61('0xed')][_0x4e61('0x4d')]);_0x3f9bf3[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x10f131[_0x4e61('0x54')]);_0x3f9bf3[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0x3f9bf3['model'],_0x3f9bf3['query']);_0x1a1109[_0x4e61('0x58')]=_['intersection'](_0x3f9bf3[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x10f131[_0x4e61('0x54')][_0x4e61('0x57')]));_0x1a1109['attributes']=_0x1a1109[_0x4e61('0x58')]['length']?_0x1a1109[_0x4e61('0x58')]:_0x3f9bf3[_0x4e61('0x50')];_0x1a1109[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x10f131[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x1a1109['where']=qs['filters'](_['pick'](_0x10f131['query'],_0x3f9bf3[_0x4e61('0x55')]));if(_0x10f131['query'][_0x4e61('0x42')]){_0x1a1109[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x1a1109['where'],{'$or':_[_0x4e61('0x44')](_0x1a1109[_0x4e61('0x58')],function(_0x4b0c51){var _0x3ac686={};_0x3ac686[_0x4b0c51]={'$like':'%'+_0x10f131[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x3ac686;})});}_0x1a1109=_[_0x4e61('0x60')]({},_0x1a1109,_0x10f131['options']);return _0x22f022['getWhatsappInteractions'](_0x1a1109);}})[_0x4e61('0x38')](function(_0x490e0f){if(_0x490e0f){_0x257b47=_0x490e0f['length'];if(!_0x10f131[_0x4e61('0x54')][_0x4e61('0x5a')]('nolimit')){_0x1a1109[_0x4e61('0x33')]=qs['limit'](_0x10f131[_0x4e61('0x54')]['limit']);_0x1a1109[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x10f131[_0x4e61('0x54')][_0x4e61('0x32')]);}return _0x22f022[_0x4e61('0xec')](_0x1a1109);}})['then'](function(_0x4e2bf1){if(_0x4e2bf1){return _0x4e2bf1?{'count':_0x257b47,'rows':_0x4e2bf1}:null;}})[_0x4e61('0x38')](respondWithResult(_0x2323a4,null))[_0x4e61('0x68')](handleError(_0x2323a4,null));};exports[_0x4e61('0xee')]=function(_0x578380,_0x16d2ee,_0x51573c){var _0x263487;var _0x2a9e17;var _0x4ccff4;var _0x303471=!_[_0x4e61('0x78')](_0x578380['params']['id'])?_0x578380[_0x4e61('0x6e')]['id']:!_['isNil'](_0x578380['user']['id'])?_0x578380['user']['id']:null;return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0x303471,'role':{'$or':[_0x4e61('0x3c'),_0x4e61('0x3e'),'agent']}},'attributes':['id',_0x4e61('0x49'),'phone',_0x4e61('0xef'),'role',_0x4e61('0x73'),'loginInPause']})[_0x4e61('0x38')](function(_0x562b91){if(_0x562b91){if(_0x562b91['role']===_0x4e61('0x3f')){_0x263487=_0x562b91;if(_0x578380[_0x4e61('0x6d')][_0x4e61('0xb3')]){_0x4ccff4=util[_0x4e61('0xc1')](_0x4e61('0xf0'),_0x263487[_0x578380[_0x4e61('0x6d')][_0x4e61('0xb3')]]);}else if(_0x578380[_0x4e61('0x6d')]['intrf']){_0x4ccff4=util[_0x4e61('0xc1')](_0x4e61('0xc2'),_0x578380[_0x4e61('0x6d')][_0x4e61('0xf1')]);}else{_0x4ccff4=util[_0x4e61('0xc1')](_0x4e61('0xc2'),_0x263487[_0x4e61('0x49')]);}socket['to'](util[_0x4e61('0xc1')](_0x4e61('0xf2'),_0x263487[_0x4e61('0x49')]))['emit'](_0x4e61('0xf3'),{'ip':_0x578380['headers']['x-forwarded-for']||_0x578380[_0x4e61('0xf4')]['remoteAddress']||_0x578380[_0x4e61('0xf5')][_0x4e61('0xf6')]||_0x578380['connection']['socket']['remoteAddress']});return db['UserVoiceQueueRt'][_0x4e61('0x39')]({'where':{'membername':_0x263487[_0x4e61('0x49')]},'individualHooks':!![]});}}else{throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))](_0x4e61('0xf7'));}})[_0x4e61('0x38')](function(){if(_0x263487){return _0x263487[_0x4e61('0xf8')]({'raw':!![]});}})[_0x4e61('0x38')](function(_0x5a1cc4){if(_0x263487){var _0x2304b5=[];if(_0x5a1cc4){_0x2a9e17=_0x5a1cc4;if(_0x2a9e17['length']){for(var _0x43e96f=0x0;_0x43e96f<_0x2a9e17[_0x4e61('0x59')];_0x43e96f++){_0x2304b5['push']({'membername':_0x263487[_0x4e61('0x49')],'UserId':_0x263487['id'],'queue_name':_0x2a9e17[_0x43e96f]['name'],'VoiceQueueId':_0x2a9e17[_0x43e96f]['id'],'interface':_0x4ccff4,'paused':_0x263487[_0x4e61('0xb1')]||![],'penalty':_0x2a9e17[_0x43e96f][_0x4e61('0xf9')]||0x0});}return BPromise[_0x4e61('0x9d')](_0x2304b5,function(_0x441033){return db[_0x4e61('0xc3')][_0x4e61('0xc4')](_0x441033);});}}}})[_0x4e61('0x38')](function(){if(_0x263487){return db[_0x4e61('0xfa')][_0x4e61('0xbf')]({'where':{'membername':_0x263487['name'],'exitAt':null}});}})[_0x4e61('0x38')](function(_0x3fc783){if(_0x263487){var _0x3fb079=[];_0x3fc783[_0x4e61('0xfb')](function(_0x4c0320){_0x3fb079[_0x4e61('0x9b')](_0x4c0320[_0x4e61('0xfc')]({'exitAt':moment()['format'](_0x4e61('0xfd'))}));});return BPromise[_0x4e61('0x9c')](_0x3fb079);}})[_0x4e61('0x38')](function(){if(_0x263487){var _0x5e299b=[];var _0x25d3a0=[];var _0x1cf405=utils[_0x4e61('0xfe')]();var _0x5101b3={'membername':_0x263487[_0x4e61('0x49')],'interface':_0x4ccff4,'enterAt':moment()['format'](_0x4e61('0xfd')),'role':_0x263487['role'],'internal':_0x263487[_0x4e61('0x73')]};_0x1cf405[_0x4e61('0xfb')](function(_0x2e7b4f){_0x5e299b[_0x4e61('0x9b')](_[_0x4e61('0x60')]({'channel':_0x2e7b4f,'type':_0x4e61('0xff'),'data1':_0x578380[_0x4e61('0x6d')][_0x4e61('0x100')],'data2':_0x4ccff4},_0x5101b3));if(_0x263487[_0x4e61('0xb1')]){_0x25d3a0[_0x4e61('0x9b')](_['merge']({'channel':_0x2e7b4f,'type':'PAUSE','data1':_0x4e61('0x101')},_0x5101b3));}});return db[_0x4e61('0xfa')]['bulkCreate'](_0x5e299b['concat'](_0x25d3a0),{'individualHooks':!![]});}})[_0x4e61('0x38')](function(){if(_0x263487){return _0x263487[_0x4e61('0xfc')]({'online':!![],'lastLoginAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd')),'voicePause':_0x263487[_0x4e61('0xb1')]||![],'mailPause':_0x263487[_0x4e61('0xb1')]||![],'chatPause':_0x263487['loginInPause']||![],'faxPause':_0x263487[_0x4e61('0xb1')]||![],'smsPause':_0x263487[_0x4e61('0xb1')]||![],'openchannelPause':_0x263487[_0x4e61('0xb1')]||![],'whatsappPause':_0x263487['loginInPause']||![],'pauseType':_0x263487[_0x4e61('0xb1')]?_0x4e61('0x101'):null,'interface':_0x4ccff4,'lastPauseAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd'))});}})['then'](function(_0x2b27a8){if(_0x578380['isMiddleware']){return _0x51573c();}else{return BPromise[_0x4e61('0x102')](_0x2b27a8)[_0x4e61('0x38')](respondWithResult(_0x16d2ee,null));}})[_0x4e61('0x68')](handleError(_0x16d2ee,null));};exports['logout']=function(_0x5e291d,_0x3ccd86,_0x388e85){var _0xf082;return db[_0x4e61('0x4c')]['find']({'where':{'id':_0x5e291d[_0x4e61('0x6e')]['id'],'role':_0x4e61('0x3f')},'attributes':['id',_0x4e61('0x49'),_0x4e61('0x3b')]})[_0x4e61('0x38')](handleEntityNotFound(_0x3ccd86,null))['then'](function(_0x48d1a5){if(_0x48d1a5){_0xf082=_0x48d1a5;return db[_0x4e61('0xc3')][_0x4e61('0x39')]({'where':{'membername':_0xf082[_0x4e61('0x49')]},'individualHooks':!![]});}})[_0x4e61('0x38')](function(){return db[_0x4e61('0xfa')]['findAll']({'where':{'membername':_0xf082['name'],'exitAt':null}});})['then'](function(_0x5a5c05){var _0x3f4ee2=[];_0x5a5c05['forEach'](function(_0x4f1b1a){_0x3f4ee2[_0x4e61('0x9b')](_0x4f1b1a[_0x4e61('0xfc')]({'exitAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd'))}));});return BPromise[_0x4e61('0x9c')](_0x3f4ee2);})[_0x4e61('0x38')](function(){return _0xf082['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3ccd86,null))['catch'](handleError(_0x3ccd86,null));};exports[_0x4e61('0x103')]=function(_0x315f76,_0x35eb3d,_0x27701f){var _0x14149b;return db['UserVoiceQueueRt'][_0x4e61('0xfc')]({'paused':0x1},{'where':{'UserId':_0x315f76[_0x4e61('0x6e')]['id']},'individualHooks':!![]})[_0x4e61('0x38')](function(){return db['User']['find']({'where':{'id':_0x315f76[_0x4e61('0x6e')]['id'],'role':_0x4e61('0x3f')},'attributes':['id',_0x4e61('0x49'),'role','internal',_0x4e61('0xb3')]});})['then'](handleEntityNotFound(_0x35eb3d,null))[_0x4e61('0x38')](function(_0x3dea41){if(_0x3dea41){_0x14149b=_0x3dea41;return respondWithRpcPromise('QueuePause',_0x4e61('0x103'),{'id':_0x14149b['id'],'name':_0x14149b['name'],'pause':!![]});}})[_0x4e61('0x38')](function(){if(_0x14149b){return db['MemberReport']['findAll']({'where':{'membername':_0x14149b[_0x4e61('0x49')],'type':_0x4e61('0x104'),'exitAt':null}});}})[_0x4e61('0x38')](function(_0x4e85ab){if(_0x4e85ab[_0x4e61('0x59')]){var _0x57a602=moment()[_0x4e61('0xc1')](_0x4e61('0xfd'));for(var _0xcb53ae=0x0,_0x41ecd7=_0x4e85ab['length'];_0xcb53ae<_0x41ecd7;_0xcb53ae++){_0x4e85ab[_0xcb53ae]['updateAttributes']({'exitAt':_0x57a602});}}})[_0x4e61('0x38')](function(){var _0x25034d=[];var _0x1f53d6=utils['getChannels']();_0x1f53d6['forEach'](function(_0x15baf8){_0x25034d[_0x4e61('0x9b')]({'channel':_0x15baf8,'membername':_0x14149b[_0x4e61('0x49')],'interface':_['isNil'](_0x14149b[_0x4e61('0xb3')])?util['format'](_0x4e61('0xc2'),_0x14149b['name']):_0x14149b[_0x4e61('0xb3')],'type':'PAUSE','enterAt':moment()['format'](_0x4e61('0xfd')),'data1':_0x315f76[_0x4e61('0x6d')]['type']||'DEFAULT\x20PAUSE','role':_0x14149b[_0x4e61('0x3b')],'internal':_0x14149b[_0x4e61('0x73')]});});return db[_0x4e61('0xfa')][_0x4e61('0x105')](_0x25034d,{'individualHooks':!![]});})[_0x4e61('0x38')](function(){return _0x14149b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x315f76[_0x4e61('0x6d')][_0x4e61('0x4e')]||_0x4e61('0x106'),'lastPauseAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd'))});})['then'](respondWithResult(_0x35eb3d,null))['catch'](handleError(_0x35eb3d,null));};exports[_0x4e61('0x107')]=function(_0xbdab7,_0xa832aa,_0x1fae98){var _0x96f35c;return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0xbdab7[_0x4e61('0x6e')]['id']},'attributes':['id','name','role',_0x4e61('0xb2'),_0x4e61('0x108'),_0x4e61('0x109'),_0x4e61('0x10a'),'openchannelPause',_0x4e61('0x10b'),_0x4e61('0x10c'),_0x4e61('0x10d'),_0x4e61('0x10e')]})[_0x4e61('0x38')](handleEntityNotFound(_0xa832aa,null))[_0x4e61('0x38')](function(_0x1e71bc){if(_0x1e71bc){_0x96f35c=_0x1e71bc;if(_0xbdab7[_0x4e61('0x6d')]['channel']&&!utils[_0x4e61('0xb4')](_0xbdab7['body']['channel'])){throw new db[(_0x4e61('0xa2'))][(_0x4e61('0xa3'))]('Unknown\x20channel');}switch(_0xbdab7[_0x4e61('0x6d')][_0x4e61('0xaf')]){case _0x4e61('0xc0'):return respondWithRpcPromise('QueuePause',_0x4e61('0x107'),{'id':_0x96f35c['id'],'name':_0x96f35c[_0x4e61('0x49')],'pause':![]})['then'](function(){return db[_0x4e61('0xc3')][_0x4e61('0xfc')]({'paused':0x0},{'where':{'UserId':_0x96f35c['id']},'individualHooks':!![]});})[_0x4e61('0x38')](function(){return db[_0x4e61('0xfa')][_0x4e61('0x6c')]({'where':{'channel':_0xbdab7[_0x4e61('0x6d')][_0x4e61('0xaf')],'membername':_0x96f35c[_0x4e61('0x49')],'type':_0x4e61('0x104'),'exitAt':null}});})[_0x4e61('0x38')](function(_0x4fe770){if(_0x4fe770){return _0x4fe770[_0x4e61('0xfc')]({'exitAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd')),'data2':_0x4e61('0x10f')},{'individualHooks':!![]});}return null;})[_0x4e61('0x38')](function(){return _0x96f35c['update']({'voicePause':![]});});case'mail':case _0x4e61('0x110'):case _0x4e61('0x111'):case _0x4e61('0x112'):case'whatsapp':case _0x4e61('0x113'):return db['MemberReport']['find']({'where':{'channel':_0xbdab7[_0x4e61('0x6d')][_0x4e61('0xaf')],'membername':_0x96f35c[_0x4e61('0x49')],'type':_0x4e61('0x104'),'exitAt':null}})[_0x4e61('0x38')](function(_0xc3bea){if(_0xc3bea){return _0xc3bea[_0x4e61('0xfc')]({'exitAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd')),'data2':_0x4e61('0x10f')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x1ce62={};_['set'](_0x1ce62,util['format'](_0x4e61('0x114'),_0xbdab7['body'][_0x4e61('0xaf')],'Pause'),![]);return _0x96f35c[_0x4e61('0xfc')](_0x1ce62);});default:return respondWithRpcPromise(_0x4e61('0x115'),_0x4e61('0x107'),{'id':_0x96f35c['id'],'name':_0x96f35c[_0x4e61('0x49')],'pause':![]})['then'](function(){return db[_0x4e61('0xc3')]['update']({'paused':0x0},{'where':{'UserId':_0x96f35c['id']}});})[_0x4e61('0x38')](function(){return db[_0x4e61('0xfa')]['findAll']({'where':{'membername':_0x96f35c[_0x4e61('0x49')],'type':_0x4e61('0x104'),'exitAt':null}});})[_0x4e61('0x38')](function(_0x176857){var _0x3583ff=[];_0x176857[_0x4e61('0xfb')](function(_0x214a2f){_0x3583ff[_0x4e61('0x9b')](_0x214a2f[_0x4e61('0xfc')]({'exitAt':moment()[_0x4e61('0xc1')](_0x4e61('0xfd')),'data2':_0x4e61('0x10f')}));});return BPromise[_0x4e61('0x9c')](_0x3583ff);})['then'](function(){return _0x96f35c[_0x4e61('0xfc')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4e61('0x38')](respondWithResult(_0xa832aa,null))[_0x4e61('0x68')](handleError(_0xa832aa,null));};exports[_0x4e61('0x116')]=function(_0x2d9486,_0x50b5d3,_0x4ab325){var _0x32efbb={};var _0x319806={};var _0x22003e;var _0x4d6a2;return db[_0x4e61('0x4c')]['findOne']({'where':{'id':_0x2d9486[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x50b5d3,null))['then'](function(_0x4e8e7a){if(_0x4e8e7a){_0x22003e=_0x4e8e7a;_0x319806[_0x4e61('0x50')]=_['keys'](db['Team'][_0x4e61('0x4d')]);_0x319806[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x2d9486[_0x4e61('0x54')]);_0x319806['filters']=_[_0x4e61('0x56')](_0x319806[_0x4e61('0x50')],_0x319806[_0x4e61('0x54')]);_0x32efbb[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x319806[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x2d9486[_0x4e61('0x54')]['fields']));_0x32efbb['attributes']=_0x32efbb['attributes']['length']?_0x32efbb[_0x4e61('0x58')]:_0x319806[_0x4e61('0x50')];_0x32efbb[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x2d9486[_0x4e61('0x54')]['sort']);_0x32efbb['where']=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x2d9486[_0x4e61('0x54')],_0x319806['filters']));if(_0x2d9486['query'][_0x4e61('0x42')]){_0x32efbb['where']=_['merge'](_0x32efbb['where'],{'$or':_[_0x4e61('0x44')](_0x32efbb[_0x4e61('0x58')],function(_0x438ca2){var _0x5aa704={};_0x5aa704[_0x438ca2]={'$like':'%'+_0x2d9486[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x5aa704;})});}_0x32efbb=_[_0x4e61('0x60')]({},_0x32efbb,_0x2d9486[_0x4e61('0x65')]);return _0x22003e['getTeams'](_0x32efbb);}})['then'](function(_0x43326f){if(_0x43326f){_0x4d6a2=_0x43326f[_0x4e61('0x59')];if(!_0x2d9486[_0x4e61('0x54')]['hasOwnProperty'](_0x4e61('0x5b'))){_0x32efbb['limit']=qs[_0x4e61('0x33')](_0x2d9486[_0x4e61('0x54')][_0x4e61('0x33')]);_0x32efbb[_0x4e61('0x32')]=qs[_0x4e61('0x32')](_0x2d9486['query'][_0x4e61('0x32')]);}return _0x22003e['getTeams'](_0x32efbb);}})['then'](function(_0x372031){if(_0x372031){return _0x372031?{'count':_0x4d6a2,'rows':_0x372031}:null;}})[_0x4e61('0x38')](respondWithResult(_0x50b5d3,null))[_0x4e61('0x68')](handleError(_0x50b5d3,null));};exports['addTeams']=function(_0x448220,_0x85fe7c){return db[_0x4e61('0x4c')][_0x4e61('0x6c')]({'where':{'id':_0x448220['params']['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x85fe7c,null))[_0x4e61('0x38')](function(_0x5a2d61){if(_0x5a2d61){var _0x4a5f6c=_0x5a2d61[_0x4e61('0x3a')]({'plain':!![]});return _0x5a2d61[_0x4e61('0x117')](_0x448220[_0x4e61('0x6d')][_0x4e61('0x71')],_[_0x4e61('0x72')](_0x448220[_0x4e61('0x6d')],[_0x4e61('0x71'),'id'])||{})[_0x4e61('0x38')](function(){for(var _0x97eef3=0x0;_0x97eef3<_0x448220[_0x4e61('0x6d')][_0x4e61('0x71')]['length'];_0x97eef3++){var _0xb62605=[];db[_0x4e61('0x118')]['findOne']({'where':{'id':_0x448220[_0x4e61('0x6d')][_0x4e61('0x71')][_0x97eef3]}})['then'](function(_0x4a9b19){_0xb62605[_0x4e61('0x9b')](_0x4a9b19[_0x4e61('0xf8')]()[_0x4e61('0x38')](function(_0x402ebf){for(var _0x2819c7=0x0;_0x2819c7<_0x402ebf[_0x4e61('0x59')];_0x2819c7++){_0x402ebf[_0x2819c7]['setDataValue'](_0x4e61('0xaf'),_0x4e61('0x119'));}return _0x402ebf;}));_0xb62605['push'](_0x4a9b19[_0x4e61('0x11a')]()[_0x4e61('0x38')](function(_0x5ebdf9){for(var _0x43a9a4=0x0;_0x43a9a4<_0x5ebdf9['length'];_0x43a9a4++){_0x5ebdf9[_0x43a9a4][_0x4e61('0x11b')](_0x4e61('0xaf'),_0x4e61('0x11c'));}return _0x5ebdf9;}));_0xb62605[_0x4e61('0x9b')](_0x4a9b19[_0x4e61('0x11d')]()[_0x4e61('0x38')](function(_0x2b6365){for(var _0x26303a=0x0;_0x26303a<_0x2b6365['length'];_0x26303a++){_0x2b6365[_0x26303a][_0x4e61('0x11b')](_0x4e61('0xaf'),_0x4e61('0x11e'));}return _0x2b6365;}));_0xb62605[_0x4e61('0x9b')](_0x4a9b19['getSmsQueues']()[_0x4e61('0x38')](function(_0x503929){for(var _0x5b4992=0x0;_0x5b4992<_0x503929[_0x4e61('0x59')];_0x5b4992++){_0x503929[_0x5b4992][_0x4e61('0x11b')]('channel',_0x4e61('0x11f'));}return _0x503929;}));_0xb62605[_0x4e61('0x9b')](_0x4a9b19[_0x4e61('0x120')]()[_0x4e61('0x38')](function(_0x2c52e3){for(var _0x558efb=0x0;_0x558efb<_0x2c52e3['length'];_0x558efb++){_0x2c52e3[_0x558efb][_0x4e61('0x11b')](_0x4e61('0xaf'),'Whatsapp');}return _0x2c52e3;}));_0xb62605[_0x4e61('0x9b')](_0x4a9b19[_0x4e61('0x121')]()[_0x4e61('0x38')](function(_0x12ab1b){for(var _0x3dcdbf=0x0;_0x3dcdbf<_0x12ab1b['length'];_0x3dcdbf++){_0x12ab1b[_0x3dcdbf][_0x4e61('0x11b')](_0x4e61('0xaf'),_0x4e61('0x122'));}return _0x12ab1b;}));_0xb62605['push'](_0x4a9b19[_0x4e61('0x123')]()[_0x4e61('0x38')](function(_0x52f83a){for(var _0x9aeb6a=0x0;_0x9aeb6a<_0x52f83a[_0x4e61('0x59')];_0x9aeb6a++){_0x52f83a[_0x9aeb6a]['setDataValue'](_0x4e61('0xaf'),'Openchannel');}return _0x52f83a;}));return BPromise[_0x4e61('0x9c')](_0xb62605);})[_0x4e61('0x38')](function(_0x184f06){var _0x2702aa=_[_0x4e61('0x124')](_0x184f06);_0xb62605=[];return db[_0x4e61('0x62')][_0x4e61('0x125')](function(_0x1b882e){for(var _0x4c44ad=0x0;_0x4c44ad<_0x2702aa[_0x4e61('0x59')];_0x4c44ad++){_0xb62605[_0x4e61('0x9b')](_0x2702aa[_0x4c44ad][_0x4e61('0x126')](_0x4a5f6c['id']),{'transaction':_0x1b882e});}return BPromise[_0x4e61('0x9c')](_0xb62605)[_0x4e61('0x38')](function(){if(_0x4a5f6c['online']){return BPromise[_0x4e61('0x9d')](_[_0x4e61('0x42')](_0x2702aa,function(_0x8cf960){return _0x8cf960[_0x4e61('0x127')](_0x4e61('0xaf'))===_0x4e61('0x119');}),function(_0x238a52){return db['UserVoiceQueueRt'][_0x4e61('0xc4')]({'membername':_0x4a5f6c['name'],'UserId':_0x4a5f6c['id'],'queue_name':_0x238a52['name'],'VoiceQueueId':_0x238a52['id'],'interface':_[_0x4e61('0x78')](_0x4a5f6c[_0x4e61('0xb3')])?util[_0x4e61('0xc1')]('SIP/%s',_0x4a5f6c[_0x4e61('0x49')]):_0x4a5f6c['interface'],'paused':_0x4a5f6c['voicePause']||![],'penalty':_0x4a5f6c[_0x4e61('0xb9')]},{'transaction':_0x1b882e});});}else{return;}})[_0x4e61('0x38')](function(){for(var _0x47f6db=0x0;_0x47f6db<_0x2702aa[_0x4e61('0x59')];_0x47f6db++){var _0x2d36ff=_0x2702aa[_0x47f6db]['getDataValue'](_0x4e61('0xaf'));var _0x1388fa=_0x2d36ff+'QueueId';socket[_0x4e61('0xbc')]('user'+_0x2d36ff+_0x4e61('0x128'),{'UserId':_0x4a5f6c['id'],['queueField']:_0x2702aa[_0x47f6db]['id']});}});});});}});}})[_0x4e61('0x38')](respondWithStatusCode(_0x85fe7c,null))[_0x4e61('0x68')](handleError(_0x85fe7c,null));};exports[_0x4e61('0x129')]=function(_0x5c8f52,_0x334c3e){return db[_0x4e61('0x4c')]['findOne']({'where':{'id':_0x5c8f52[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x334c3e,null))[_0x4e61('0x38')](function(_0x5ccd1b){if(_0x5ccd1b){var _0x39dde5=_0x5ccd1b[_0x4e61('0x3a')]({'plain':!![]});var _0x1bc3f2=_0x5c8f52[_0x4e61('0x54')]['ids'];return _0x5ccd1b[_0x4e61('0x129')](_0x1bc3f2)[_0x4e61('0x38')](function(){for(var _0x558e1c=0x0;_0x558e1c<_0x1bc3f2[_0x4e61('0x59')];_0x558e1c++){var _0x21eb23=[];db[_0x4e61('0x118')][_0x4e61('0xa9')]({'where':{'id':_0x1bc3f2[_0x558e1c]}})[_0x4e61('0x38')](function(_0x3461ef){_0x21eb23['push'](_0x3461ef[_0x4e61('0xf8')]()[_0x4e61('0x38')](function(_0x411173){for(var _0x26a08a=0x0;_0x26a08a<_0x411173[_0x4e61('0x59')];_0x26a08a++){_0x411173[_0x26a08a][_0x4e61('0x11b')](_0x4e61('0xaf'),_0x4e61('0x119'));}return _0x411173;}));_0x21eb23[_0x4e61('0x9b')](_0x3461ef[_0x4e61('0x11a')]()[_0x4e61('0x38')](function(_0x24dffd){for(var _0x3a0ccd=0x0;_0x3a0ccd<_0x24dffd[_0x4e61('0x59')];_0x3a0ccd++){_0x24dffd[_0x3a0ccd][_0x4e61('0x11b')]('channel',_0x4e61('0x11c'));}return _0x24dffd;}));_0x21eb23[_0x4e61('0x9b')](_0x3461ef[_0x4e61('0x11d')]()['then'](function(_0x445ea4){for(var _0x42a2b7=0x0;_0x42a2b7<_0x445ea4[_0x4e61('0x59')];_0x42a2b7++){_0x445ea4[_0x42a2b7]['setDataValue'](_0x4e61('0xaf'),'Mail');}return _0x445ea4;}));_0x21eb23[_0x4e61('0x9b')](_0x3461ef[_0x4e61('0x12a')]()[_0x4e61('0x38')](function(_0x5c0032){for(var _0x3d941e=0x0;_0x3d941e<_0x5c0032['length'];_0x3d941e++){_0x5c0032[_0x3d941e]['setDataValue'](_0x4e61('0xaf'),'Sms');}return _0x5c0032;}));_0x21eb23[_0x4e61('0x9b')](_0x3461ef[_0x4e61('0x120')]()['then'](function(_0x40bebf){for(var _0x2e1d1d=0x0;_0x2e1d1d<_0x40bebf['length'];_0x2e1d1d++){_0x40bebf[_0x2e1d1d]['setDataValue'](_0x4e61('0xaf'),_0x4e61('0x12b'));}return _0x40bebf;}));_0x21eb23[_0x4e61('0x9b')](_0x3461ef['getFaxQueues']()[_0x4e61('0x38')](function(_0x18eca1){for(var _0x2c9325=0x0;_0x2c9325<_0x18eca1['length'];_0x2c9325++){_0x18eca1[_0x2c9325][_0x4e61('0x11b')]('channel','Fax');}return _0x18eca1;}));_0x21eb23[_0x4e61('0x9b')](_0x3461ef[_0x4e61('0x123')]()['then'](function(_0x425be9){for(var _0x14f319=0x0;_0x14f319<_0x425be9['length'];_0x14f319++){_0x425be9[_0x14f319][_0x4e61('0x11b')]('channel',_0x4e61('0x12c'));}return _0x425be9;}));return BPromise['all'](_0x21eb23);})['then'](function(_0x39cdb8){var _0x183802=_['flatten'](_0x39cdb8);_0x21eb23=[];return db[_0x4e61('0x62')][_0x4e61('0x125')](function(_0x2da073){for(var _0x489ba1=0x0;_0x489ba1<_0x183802[_0x4e61('0x59')];_0x489ba1++){_0x21eb23[_0x4e61('0x9b')](_0x183802[_0x489ba1][_0x4e61('0x12d')](_0x39dde5['id']),{'transaction':_0x2da073});}return BPromise[_0x4e61('0x9c')](_0x21eb23)[_0x4e61('0x38')](function(){if(_0x39dde5[_0x4e61('0xb0')]){return BPromise[_0x4e61('0x9d')](_[_0x4e61('0x42')](_0x183802,function(_0x240405){return _0x240405[_0x4e61('0x127')](_0x4e61('0xaf'))===_0x4e61('0x119');}),function(_0x41d394){return db['UserVoiceQueueRt'][_0x4e61('0x39')]({'where':{'VoiceQueueId':_0x41d394['id'],'UserId':_0x39dde5['id']},'transaction':_0x2da073});});}else{return;}})[_0x4e61('0x38')](function(){for(var _0x435ec3=0x0;_0x435ec3<_0x183802[_0x4e61('0x59')];_0x435ec3++){var _0x478082=_0x183802[_0x435ec3][_0x4e61('0x127')]('channel');var _0xbd2258=_0x478082+_0x4e61('0xbb');socket['emit'](_0x4e61('0x3e')+_0x478082+'Queue:remove',{'UserId':_0x39dde5['id'],['queueField']:_0x183802[_0x435ec3]['id']});}});});});}});}})[_0x4e61('0x38')](respondWithStatusCode(_0x334c3e,null))[_0x4e61('0x68')](handleError(_0x334c3e,null));};exports[_0x4e61('0x12e')]=function(_0x28db47,_0x5b68ec,_0x37420e){var _0x2e1801={};var _0x4cbd26={};var _0x4331d7;var _0x401efa;return db['User'][_0x4e61('0xa9')]({'where':{'id':_0x28db47[_0x4e61('0x6e')]['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x5b68ec,null))[_0x4e61('0x38')](function(_0x32956e){if(_0x32956e){_0x4331d7=_0x32956e;_0x4cbd26[_0x4e61('0x50')]=_[_0x4e61('0x6a')](db[_0x4e61('0xd6')][_0x4e61('0x4d')]);_0x4cbd26[_0x4e61('0x54')]=_[_0x4e61('0x6a')](_0x28db47[_0x4e61('0x54')]);_0x4cbd26[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0x4cbd26['model'],_0x4cbd26['query']);_0x2e1801[_0x4e61('0x58')]=_[_0x4e61('0x56')](_0x4cbd26[_0x4e61('0x50')],qs[_0x4e61('0x57')](_0x28db47[_0x4e61('0x54')][_0x4e61('0x57')]));_0x2e1801['attributes']=_0x2e1801['attributes'][_0x4e61('0x59')]?_0x2e1801[_0x4e61('0x58')]:_0x4cbd26['model'];_0x2e1801[_0x4e61('0x5c')]=qs['sort'](_0x28db47[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x2e1801[_0x4e61('0x5f')]=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x28db47[_0x4e61('0x54')],_0x4cbd26[_0x4e61('0x55')]));if(_0x28db47[_0x4e61('0x54')][_0x4e61('0x42')]){_0x2e1801[_0x4e61('0x5f')]=_['merge'](_0x2e1801['where'],{'$or':_[_0x4e61('0x44')](_0x2e1801[_0x4e61('0x58')],function(_0x18210c){var _0x150137={};_0x150137[_0x18210c]={'$like':'%'+_0x28db47[_0x4e61('0x54')][_0x4e61('0x42')]+'%'};return _0x150137;})});}_0x2e1801=_[_0x4e61('0x60')]({},_0x2e1801,_0x28db47[_0x4e61('0x65')]);return _0x4331d7[_0x4e61('0x12e')](_0x2e1801);}})[_0x4e61('0x38')](function(_0x2940fe){if(_0x2940fe){_0x401efa=_0x2940fe[_0x4e61('0x59')];if(!_0x28db47['query'][_0x4e61('0x5a')](_0x4e61('0x5b'))){_0x2e1801['limit']=qs[_0x4e61('0x33')](_0x28db47[_0x4e61('0x54')][_0x4e61('0x33')]);_0x2e1801[_0x4e61('0x32')]=qs['offset'](_0x28db47[_0x4e61('0x54')][_0x4e61('0x32')]);}return _0x4331d7['getLists'](_0x2e1801);}})[_0x4e61('0x38')](function(_0x53e950){if(_0x53e950){return _0x53e950?{'count':_0x401efa,'rows':_0x53e950}:null;}})['then'](respondWithResult(_0x5b68ec,null))[_0x4e61('0x68')](handleError(_0x5b68ec,null));};exports['getAgents']=function(_0x377050,_0x3eda71,_0x40d0c1){var _0x398d39={};var _0x230fec={};var _0x490ae6;var _0x445f1a;return db[_0x4e61('0x4c')][_0x4e61('0xa9')]({'where':{'id':_0x377050['params']['id']}})[_0x4e61('0x38')](handleEntityNotFound(_0x3eda71,null))['then'](function(_0x38530e){if(_0x38530e){_0x490ae6=_0x38530e;_0x230fec['model']=_[_0x4e61('0x6a')](db[_0x4e61('0x4c')][_0x4e61('0x4d')]);_0x230fec['query']=_['keys'](_0x377050[_0x4e61('0x54')]);_0x230fec[_0x4e61('0x55')]=_[_0x4e61('0x56')](_0x230fec[_0x4e61('0x50')],_0x230fec[_0x4e61('0x54')]);_0x398d39['attributes']=_[_0x4e61('0x56')](_0x230fec['model'],qs['fields'](_0x377050[_0x4e61('0x54')][_0x4e61('0x57')]));_0x398d39['attributes']=_0x398d39[_0x4e61('0x58')][_0x4e61('0x59')]?_0x398d39[_0x4e61('0x58')]:_0x230fec[_0x4e61('0x50')];_0x398d39[_0x4e61('0x5c')]=qs[_0x4e61('0x5d')](_0x377050[_0x4e61('0x54')][_0x4e61('0x5d')]);_0x398d39['where']=qs[_0x4e61('0x55')](_[_0x4e61('0x5e')](_0x377050['query'],_0x230fec[_0x4e61('0x55')]));if(_0x377050[_0x4e61('0x54')][_0x4e61('0x42')]){_0x398d39[_0x4e61('0x5f')]=_[_0x4e61('0x60')](_0x398d39['where'],{'$or':_[_0x4e61('0x44')](_0x398d39[_0x4e61('0x58')],function(_0x38d0c1){var _0x5d1cd5={};_0x5d1cd5[_0x38d0c1]={'$like':'%'+_0x377050['query'][_0x4e61('0x42')]+'%'};return _0x5d1cd5;})});}_0x398d39[_0x4e61('0x50')]=db['User'];_0x398d39['as']=_0x4e61('0x96');_0x398d39=_['merge']({},_0x398d39,_0x377050[_0x4e61('0x65')]);return _0x490ae6[_0x4e61('0xf8')]({'include':[_0x398d39]});}})['then'](function(_0x1aa6e3){if(_0x1aa6e3){var _0x483739={},_0x22e042=[],_0x4692a0=0x0;for(var _0x2f7d66=0x0;_0x2f7d66<_0x1aa6e3[_0x4e61('0x59')];_0x2f7d66+=0x1){for(var _0x198f3c=0x0,_0x3b0532;_0x198f3c<_0x1aa6e3[_0x2f7d66][_0x4e61('0x96')][_0x4e61('0x59')];_0x198f3c+=0x1){_0x3b0532=_0x1aa6e3[_0x2f7d66][_0x4e61('0x96')][_0x198f3c]['get']({'plain':!![]});_0x483739[_0x3b0532['id']]=_0x3b0532;}}_0x483739=_['values'](_0x483739);for(var _0x49d9ae=qs[_0x4e61('0x32')](_0x377050[_0x4e61('0x54')][_0x4e61('0x32')]);_0x49d9ae<_0x483739[_0x4e61('0x59')]&&_0x22e042[_0x4e61('0x59')]=_0x882231){_0xd069d9=_0x882231;_0x3cd772=0xc8;}else{_0x3cd772=0xce;}_0x47e377[_0xb212('0x28')](_0x3cd772);return _0x47e377[_0xb212('0x2e')](_0xb212('0x2f'),_0xdf3d5d+'-'+_0xd069d9+'/'+_0x882231)[_0xb212('0x2a')](_0x277812);}return null;};}function patchUpdates(_0x1f99c1){return function(_0x5c00c7){try{jsonpatch['apply'](_0x5c00c7,_0x1f99c1,!![]);}catch(_0x71b27){return BPromise[_0xb212('0x30')](_0x71b27);}return _0x5c00c7['save']();};}function saveUpdates(_0x9424e7,_0x34e597){return function(_0x36ce04){if(_0x36ce04){return _0x36ce04[_0xb212('0x31')](_0x9424e7)[_0xb212('0x1d')](function(_0x18f100){return _0x18f100;});}return null;};}function removeEntity(_0x2ad759,_0x1a770f){return function(_0x58cc94){if(_0x58cc94){return _0x58cc94['destroy']()[_0xb212('0x1d')](function(){var _0x12b662=_0x58cc94[_0xb212('0x32')]({'plain':!![]});if(_0x12b662[_0xb212('0x33')]===_0xb212('0x34'))return;var _0x1483a4=[{'name':_0xb212('0x35'),'value':_0xb212('0x36'),'ignore':!![]},{'name':_0xb212('0x37'),'value':_0xb212('0x38'),'ignore':![]},{'name':_0xb212('0x39'),'value':_0xb212('0x3a'),'ignore':![]}];var _0x3dea7c=_(_0x1483a4)['filter'](_0xb212('0x3b'))[_0xb212('0x3c')](_0xb212('0x3d'))[_0xb212('0x3d')]();if(_[_0xb212('0x3e')](_0x3dea7c,_0x12b662['role'])){return;}var _0x39456f=_[_0xb212('0x3f')](_0x1483a4,['value',_0x12b662[_0xb212('0x33')]])['name'];return db[_0xb212('0x40')][_0xb212('0x41')]({'where':{'type':_0x39456f,'resourceId':_0x12b662['id']}})['then'](function(){return _0x58cc94;});})[_0xb212('0x1d')](function(){_0x2ad759[_0xb212('0x28')](0xcc)[_0xb212('0x29')]();});}};}function handleEntityNotFound(_0x2b36a0,_0x4f4c48){return function(_0x37b9a8){if(!_0x37b9a8){_0x2b36a0[_0xb212('0x42')](0x194);}return _0x37b9a8;};}function handleError(_0x563971,_0x43f1f3){_0x43f1f3=_0x43f1f3||0x1f4;return function(_0x4de9e7){logger['error'](_0x4de9e7[_0xb212('0x43')]);if(_0x4de9e7[_0xb212('0x44')]){delete _0x4de9e7[_0xb212('0x44')];}_0x563971[_0xb212('0x28')](_0x43f1f3)[_0xb212('0x45')](_0x4de9e7);};}exports[_0xb212('0x46')]=function(_0x6ac8e7,_0x50c33a){var _0x1c698b={},_0x10dbdf={},_0x104b36={'count':0x0,'rows':[]};var _0x99a173=_['map'](db[_0xb212('0x47')]['rawAttributes'],function(_0x48d758){return{'name':_0x48d758[_0xb212('0x48')],'type':_0x48d758[_0xb212('0x49')][_0xb212('0x4a')]};});_0x10dbdf[_0xb212('0x4b')]=_['differenceBy'](_[_0xb212('0x3c')](_0x99a173,_0xb212('0x44')),[_0xb212('0x4c'),_0xb212('0x4d')]);_0x10dbdf[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x6ac8e7[_0xb212('0x4e')]);_0x10dbdf[_0xb212('0x50')]=_[_0xb212('0x51')](_0x10dbdf['model'],_0x10dbdf[_0xb212('0x4e')]);_0x1c698b['attributes']=_[_0xb212('0x51')](_0x10dbdf['model'],qs[_0xb212('0x52')](_0x6ac8e7[_0xb212('0x4e')]['fields']));_0x1c698b[_0xb212('0x53')]=_0x1c698b[_0xb212('0x53')][_0xb212('0x54')]?_0x1c698b[_0xb212('0x53')]:_0x10dbdf[_0xb212('0x4b')];if(!_0x6ac8e7['query']['hasOwnProperty'](_0xb212('0x55'))){_0x1c698b[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x6ac8e7[_0xb212('0x4e')][_0xb212('0x2d')]);_0x1c698b[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x6ac8e7[_0xb212('0x4e')]['offset']);}_0x1c698b['order']=qs['sort'](_0x6ac8e7[_0xb212('0x4e')]['sort']);_0x1c698b[_0xb212('0x56')]=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x6ac8e7[_0xb212('0x4e')],_0x10dbdf[_0xb212('0x50')]),_0x99a173);if(_0x6ac8e7[_0xb212('0x4e')][_0xb212('0x58')]){_0x1c698b['where']=_['merge'](_0x1c698b[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x99a173,function(_0x838118){if(_0x838118['type']!==_0xb212('0x59')){return db[_0xb212('0x5a')][_0xb212('0x56')](db[_0xb212('0x5a')]['fn'](_0xb212('0x5b'),db[_0xb212('0x5a')][_0xb212('0x5c')](_0x838118[_0xb212('0x44')])),{'$like':db['sequelize']['fn'](_0xb212('0x5b'),'%'+_0x6ac8e7[_0xb212('0x4e')][_0xb212('0x58')]+'%')});}})});}_0x1c698b=_[_0xb212('0x5d')]({},_0x1c698b,_0x6ac8e7[_0xb212('0x5e')]);var _0x3e76f2={'where':_0x1c698b[_0xb212('0x56')]};return db[_0xb212('0x47')]['count'](_0x3e76f2)['then'](function(_0xf32ef){_0x104b36[_0xb212('0x2b')]=_0xf32ef;if(_0x6ac8e7['query'][_0xb212('0x5f')]){_0x1c698b[_0xb212('0x60')]=[{'all':!![]}];}return db[_0xb212('0x47')][_0xb212('0x61')](_0x1c698b);})[_0xb212('0x1d')](function(_0x4a8110){_0x104b36['rows']=_0x4a8110;return _0x104b36;})['then'](respondWithFilteredResult(_0x50c33a,_0x1c698b))[_0xb212('0x27')](handleError(_0x50c33a,null));};exports[_0xb212('0x62')]=function(_0x4a34cf,_0x203b02){var _0x2a94e6={'raw':![],'where':{'id':_0x4a34cf['params']['id']}},_0xa7a818={};_0xa7a818[_0xb212('0x4b')]=_['differenceBy'](_['keys'](db[_0xb212('0x47')][_0xb212('0x63')]),[_0xb212('0x4c'),_0xb212('0x4d')]);_0xa7a818[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x4a34cf[_0xb212('0x4e')]);_0xa7a818[_0xb212('0x50')]=_[_0xb212('0x51')](_0xa7a818[_0xb212('0x4b')],_0xa7a818[_0xb212('0x4e')]);_0x2a94e6[_0xb212('0x53')]=_[_0xb212('0x51')](_0xa7a818[_0xb212('0x4b')],qs['fields'](_0x4a34cf['query']['fields']));_0x2a94e6['attributes']=_0x2a94e6[_0xb212('0x53')]['length']?_0x2a94e6[_0xb212('0x53')]:_0xa7a818[_0xb212('0x4b')];if(_0x4a34cf[_0xb212('0x4e')][_0xb212('0x5f')]){_0x2a94e6[_0xb212('0x60')]=[{'all':!![]}];}_0x2a94e6=_[_0xb212('0x5d')]({},_0x2a94e6,_0x4a34cf[_0xb212('0x5e')]);return db[_0xb212('0x47')][_0xb212('0x3f')](_0x2a94e6)[_0xb212('0x1d')](handleEntityNotFound(_0x203b02,null))['then'](respondWithResult(_0x203b02,null))[_0xb212('0x27')](handleError(_0x203b02,null));};exports['update']=function(_0x5cf2c3,_0xdfda1a){if(_0x5cf2c3[_0xb212('0x64')]['id']){delete _0x5cf2c3['body']['id'];}delete _0x5cf2c3[_0xb212('0x64')][_0xb212('0x33')];return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x5cf2c3[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0xdfda1a,null))[_0xb212('0x1d')](saveUpdates(_0x5cf2c3[_0xb212('0x64')],null))[_0xb212('0x1d')](respondWithResult(_0xdfda1a,null))[_0xb212('0x27')](handleError(_0xdfda1a,null));};exports[_0xb212('0x66')]=function(_0x492954,_0x258b6b){return db[_0xb212('0x47')][_0xb212('0x66')]()[_0xb212('0x1d')](respondWithResult(_0x258b6b,null))[_0xb212('0x27')](handleError(_0x258b6b,null));};exports[_0xb212('0x67')]=function(_0x4c7873,_0x5da21,_0x18f926){return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x4c7873[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x5da21,null))[_0xb212('0x1d')](function(_0x17f695){if(_0x17f695){return _0x17f695[_0xb212('0x67')](_0x4c7873[_0xb212('0x64')]['ids'],_[_0xb212('0x68')](_0x4c7873['body'],[_0xb212('0x69'),'id'])||{});}})['then'](respondWithResult(_0x5da21,null))[_0xb212('0x27')](handleError(_0x5da21,null));};function validateUser(_0x19d342){return new BPromise(function(_0x472d98,_0x398991){if(_0x19d342[_0xb212('0x6a')])return _0x472d98(_0x19d342);return db[_0xb212('0x6b')][_0xb212('0x6c')](0x1)[_0xb212('0x1d')](function(_0x3d1823){if(_0x3d1823['securePassword'])authService[_0xb212('0x6d')](_0x19d342[_0xb212('0x4c')]);db[_0xb212('0x47')]['max'](_0xb212('0x6a'))['then'](function(_0x2615a2){if(_[_0xb212('0x6e')](_0x2615a2)){_0x19d342[_0xb212('0x6a')]=_0x3d1823[_0xb212('0x6f')]||0x1;return;}if(_[_0xb212('0x6e')](_0x3d1823[_0xb212('0x6f')])||_0x3d1823[_0xb212('0x6f')]===_0x2615a2){_0x19d342[_0xb212('0x6a')]=_0x2615a2+0x1;return;}if(_0x3d1823[_0xb212('0x6f')]>_0x2615a2){_0x19d342[_0xb212('0x6a')]=_0x3d1823[_0xb212('0x6f')];return;}return db[_0xb212('0x5a')]['query'](_0xb212('0x70'),{'type':db[_0xb212('0x5a')]['QueryTypes'][_0xb212('0x71')]})[_0xb212('0x1d')](function(_0x39f7fc){if(_0x39f7fc&&_0x39f7fc[_0xb212('0x54')]){for(var _0x470bca=0x0,_0x2ba351=_0x39f7fc[_0xb212('0x54')];_0x470bca<_0x2ba351&&_['isNil'](_0x19d342[_0xb212('0x6a')]);_0x470bca++){if(_0x3d1823[_0xb212('0x6f')]<=_0x39f7fc[_0x470bca][_0xb212('0x72')]){_0x19d342[_0xb212('0x6a')]=_0x39f7fc[_0x470bca]['from'];}else if(_0x3d1823[_0xb212('0x6f')]>_0x39f7fc[_0x470bca][_0xb212('0x72')]&&_0x3d1823[_0xb212('0x6f')]<=_0x39f7fc[_0x470bca]['to']){_0x19d342['internal']=_0x3d1823[_0xb212('0x6f')];}}}if(_[_0xb212('0x6e')](_0x19d342['internal'])){_0x19d342[_0xb212('0x6a')]=_0x2615a2+0x1;}return _0x472d98(_0x19d342);});});})[_0xb212('0x27')](function(_0x51c4a2){_0x398991(_0x51c4a2);});});}function updateUser(_0x254f1a){return new BPromise(function(_0x35db65,_0x3d7641){try{if(_0x254f1a[_0xb212('0x73')]){_0x254f1a[_0xb212('0x74')]=_0x254f1a[_0xb212('0x6a')];_0x254f1a['VoiceMail']={'mailbox':_0x254f1a[_0xb212('0x6a')],'password':_0x254f1a[_0xb212('0x4c')],'fullname':_0x254f1a[_0xb212('0x75')],'email':_0x254f1a[_0xb212('0x76')]};}if(_0x254f1a['role']===_0xb212('0x38')){if(!_0x254f1a[_0xb212('0x77')])_0x254f1a[_0xb212('0x77')]=[_0xb212('0x78'),_0xb212('0x79'),_0xb212('0x7a'),_0xb212('0x7b'),_0xb212('0x7c'),_0xb212('0x7d'),_0xb212('0x7e'),'106','107',_0xb212('0x7f'),_0xb212('0x80'),_0xb212('0x81'),'111','114'];}_0x35db65(_0x254f1a);}catch(_0x2f9e55){_0x3d7641(_0x2f9e55);}});}exports[_0xb212('0x82')]=function(_0x89d3e0,_0x2f80b2){if(_0x89d3e0[_0xb212('0x36')][_0xb212('0x33')]===_0xb212('0x38'))throw new Error(_0xb212('0x83'));if(_0x89d3e0[_0xb212('0x64')]['role']===_0xb212('0x36')&&_0x89d3e0[_0xb212('0x36')]['role']!=='admin'){throw new Error(_0xb212('0x84'));}if(_0x89d3e0[_0xb212('0x64')][_0xb212('0x33')]===_0xb212('0x34')&&_0x89d3e0['user'][_0xb212('0x33')]!==_0xb212('0x34')){throw new Error(_0xb212('0x85'));}return licenseUtil[_0xb212('0x86')]([_0x89d3e0[_0xb212('0x64')]])['then'](function(){return validateUser(_0x89d3e0[_0xb212('0x64')]);})['then'](function(_0x2dd85){return updateUser(_0x2dd85)['then'](function(_0xef8311){if(_0xef8311[_0xb212('0x33')]===_0xb212('0x34')){_0xef8311[_0xb212('0x87')]=_0x89d3e0['user'][_0xb212('0x87')];delete _0xef8311['userProfileId'];}return _0xef8311;});})['then'](function(_0x51ee80){return db[_0xb212('0x47')][_0xb212('0x82')](_0x51ee80,{'include':[{'model':db[_0xb212('0x88')],'as':_0xb212('0x88')}]});})[_0xb212('0x1d')](function(_0x1d9547){if(_0x89d3e0[_0xb212('0x64')][_0xb212('0x33')]===_0xb212('0x36'))return _0x1d9547;if(_0x89d3e0['user']['role']!==_0xb212('0x36'))return _0x1d9547;return db[_0xb212('0x89')]['find']({'where':{'name':_0x1d9547[_0xb212('0x33')]==='agent'?_0xb212('0x37'):'Telephones','userProfileId':_0x89d3e0[_0xb212('0x36')][_0xb212('0x8a')]},'raw':!![]})[_0xb212('0x1d')](function(_0x4bd126){if(!_0x4bd126||_0x4bd126[_0xb212('0x8b')]!=0x0)return _0x1d9547;return db[_0xb212('0x40')][_0xb212('0x82')]({'name':_0x1d9547[_0xb212('0x44')],'resourceId':_0x1d9547['id'],'type':_0x4bd126[_0xb212('0x44')],'sectionId':_0x4bd126['id']},{})[_0xb212('0x1d')](function(){return _0x1d9547;});})['catch'](function(_0xa883f5){logger['error'](_0xb212('0x8c'),_0xa883f5);throw _0xa883f5;});})[_0xb212('0x1d')](respondWithResult(_0x2f80b2,0xc9))['catch'](handleError(_0x2f80b2,null));};exports[_0xb212('0x8d')]=function(_0x335a6b,_0x3aaed4){var _0x4575d6=_0x335a6b['body'];var _0x2c6c90=[];if(_0x335a6b['user'][_0xb212('0x33')]==='agent')throw new Error('Unauthorized');if(_[_0xb212('0x8e')](_0x4575d6,[_0xb212('0x33'),_0xb212('0x36')])&&_0x335a6b[_0xb212('0x36')][_0xb212('0x33')]!=='admin'){throw new Error(_0xb212('0x84'));}if(_[_0xb212('0x8e')](_0x4575d6,['role',_0xb212('0x34')])&&_0x335a6b[_0xb212('0x36')][_0xb212('0x33')]!==_0xb212('0x34')){throw new Error(_0xb212('0x8f'));}return licenseUtil['checkUserLimits'](_0x4575d6)[_0xb212('0x1d')](function(){return validateUser(_0x4575d6[0x0]);})[_0xb212('0x1d')](function(){for(var _0x4905af=0x1;_0x4905af<_0x4575d6[_0xb212('0x54')];_0x4905af++){var _0x559306=_0x4575d6[_0x4905af-0x1][_0xb212('0x6a')];if(!_0x4575d6[_0x4905af]['internal'])_0x4575d6[_0x4905af]['internal']=_0x559306+0x1;_0x2c6c90[_0xb212('0x90')](validateUser(_0x4575d6[_0x4905af]));}return BPromise[_0xb212('0x91')](_0x2c6c90);})[_0xb212('0x1d')](function(){_0x2c6c90=[];for(var _0x53b857=0x0;_0x53b857<_0x4575d6[_0xb212('0x54')];_0x53b857++){_0x2c6c90['push'](updateUser(_0x4575d6[_0x53b857]));}return BPromise[_0xb212('0x91')](_0x2c6c90);})[_0xb212('0x1d')](function(){return BPromise[_0xb212('0x92')](_0x4575d6,function(_0x563b2f){return db[_0xb212('0x47')][_0xb212('0x82')](_0x563b2f,{'include':[{'model':db[_0xb212('0x88')],'as':'VoiceMail'}]})['then'](function(_0x3a06e4){_0x563b2f['id']=_0x3a06e4['id'];return _0x563b2f;});});})[_0xb212('0x1d')](function(_0x3aef1e){if(_0x335a6b[_0xb212('0x64')][_0xb212('0x33')]===_0xb212('0x36'))return _0x3aef1e;if(_0x335a6b[_0xb212('0x36')][_0xb212('0x33')]!==_0xb212('0x36'))return _0x3aef1e;var _0x2294f3=_[_0xb212('0x8e')](_0x3aef1e,function(_0x33ba1e){return _0x33ba1e['role']===_0xb212('0x38')||_0x33ba1e['role']===_0xb212('0x3a');});if(!_0x2294f3)return _0x3aef1e;return db[_0xb212('0x89')]['findAll']({'where':{'name':{'$or':[_0xb212('0x37'),_0xb212('0x39')]},'userProfileId':_0x335a6b[_0xb212('0x36')][_0xb212('0x8a')]},'raw':!![]})[_0xb212('0x1d')](function(_0x5b475c){if(_[_0xb212('0x93')](_0x5b475c)||!_[_0xb212('0x8e')](_0x5b475c,['autoAssociation',0x0]))return _0x3aef1e;_0x2c6c90=[];var _0x2fd1d9=_(_0x5b475c)[_0xb212('0x3c')](function(_0x3cc6a6){if(_0x3cc6a6['autoAssociation']===0x1)return;return _0x3cc6a6[_0xb212('0x44')]===_0xb212('0x37')?_0xb212('0x38'):_0xb212('0x3a');})[_0xb212('0x94')]()[_0xb212('0x3d')]();for(var _0x1c64c9=0x0;_0x1c64c9<_0x3aef1e[_0xb212('0x54')];_0x1c64c9++){if(!_[_0xb212('0x3e')](_0x2fd1d9,_0x3aef1e[_0x1c64c9]['role']))return;var _0x1f8604=_0x3aef1e[_0x1c64c9][_0xb212('0x33')]===_0xb212('0x38')?_0xb212('0x37'):'Telephones';_0x2c6c90[_0xb212('0x90')](db[_0xb212('0x40')][_0xb212('0x82')]({'name':_0x3aef1e[_0x1c64c9][_0xb212('0x44')],'resourceId':_0x3aef1e[_0x1c64c9]['id'],'type':_0x1f8604,'sectionId':_[_0xb212('0x3f')](_0x5b475c,[_0xb212('0x44'),_0x1f8604])['id']},{}));}return BPromise[_0xb212('0x91')](_0x2c6c90);})[_0xb212('0x1d')](respondWithResult(_0x3aaed4,0xc9))[_0xb212('0x27')](handleError(_0x3aaed4,null));});};exports['changePassword']=function(_0x64c26a,_0x242e6d,_0x19f1a5){if(_0x64c26a['body']['id']){delete _0x64c26a[_0xb212('0x64')]['id'];}return db['User'][_0xb212('0x3f')]({'where':{'id':_0x64c26a[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](function(_0x421a68){if(!_0x421a68)return null;if(_0x421a68['id']===_0x64c26a['user']['id']){if(!_0x64c26a[_0xb212('0x64')][_0xb212('0x95')]||!_0x64c26a[_0xb212('0x64')][_0xb212('0x96')]){throw new db['Sequelize'][(_0xb212('0x97'))](_0xb212('0x98'));}if(!_0x421a68['authenticate'](_0x64c26a[_0xb212('0x64')][_0xb212('0x95')])){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0x9a'));}if(_0x64c26a[_0xb212('0x64')][_0xb212('0x95')]===_0x64c26a[_0xb212('0x64')]['newPassword']){throw new db[(_0xb212('0x99'))]['ValidationError'](_0xb212('0x9b'));}}else if(_0x64c26a[_0xb212('0x36')]['role']===_0xb212('0x34')){if(!_0x64c26a[_0xb212('0x64')][_0xb212('0x96')]){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x64c26a[_0xb212('0x36')][_0xb212('0x33')]===_0xb212('0x36')){if(!_0x64c26a['body'][_0xb212('0x96')]){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0x9c'));}if(_0x421a68[_0xb212('0x33')]!==_0xb212('0x38')){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0x83'));}}else{throw new db[(_0xb212('0x99'))]['ValidationError']('Unauthorized');}return _0x421a68;})[_0xb212('0x1d')](handleEntityNotFound(_0x242e6d,null))[_0xb212('0x1d')](function(_0x553490){return db[_0xb212('0x6b')][_0xb212('0x9d')]({'attributes':['id',_0xb212('0x9e'),_0xb212('0x9f'),_0xb212('0xa0')]})['then'](function(_0x509206){if(_0x509206[_0xb212('0x9e')])authService[_0xb212('0x6d')](_0x64c26a[_0xb212('0x64')]['newPassword']);if(!_0x509206[_0xb212('0x9f')]||!_0x553490[_0xb212('0xa1')])return _0x553490;authService[_0xb212('0xa2')](_0x64c26a[_0xb212('0x64')][_0xb212('0x96')],_0x553490[_0xb212('0xa1')],_0x509206[_0xb212('0xa0')]);return _0x553490;})[_0xb212('0x1d')](saveUpdates({'password':_0x64c26a[_0xb212('0x64')][_0xb212('0x96')],'passwordResetAt':_0x64c26a[_0xb212('0x36')]['id']==_0x64c26a['params']['id']?moment():null,'previousPasswords':authService[_0xb212('0xa3')](_0x64c26a['body']['newPassword'],_0x553490[_0xb212('0xa1')])},null));})[_0xb212('0x1d')](respondWithResult(_0x242e6d,null))['catch'](handleError(_0x242e6d,null));};exports[_0xb212('0xa4')]=function(_0x363635,_0x5060b7,_0x5f53a7){var _0x11625e=_0x363635[_0xb212('0x64')]['channel'];return db['User'][_0xb212('0x3f')]({'where':{'id':_0x363635[_0xb212('0x65')]['id']},'attributes':['id',_0xb212('0x44'),_0xb212('0x33'),_0xb212('0xa5'),'loginInPause',_0xb212('0xa6'),_0xb212('0xa7')]})[_0xb212('0x1d')](handleEntityNotFound(_0x5060b7,null))[_0xb212('0x1d')](function(_0x19c9d2){if(_0x19c9d2){if(!utils[_0xb212('0xa8')](_0x11625e)){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0xa9'));}return _0x19c9d2[_0xb212('0xaa')+_[_0xb212('0xab')](_0x11625e['toLowerCase']())+_0xb212('0xac')](_0x363635[_0xb212('0x64')][_0xb212('0x69')],{'penalty':_0x363635[_0xb212('0x64')]['penalty']||0x0})[_0xb212('0xad')](function(_0x5d4326){for(var _0x103a16=0x0;_0x103a16<_0x363635['body'][_0xb212('0x69')][_0xb212('0x54')];_0x103a16+=0x1){var _0x32d0cf={'UserId':_0x363635[_0xb212('0x65')]['id']};_0x32d0cf[_['capitalize'](_0x11625e['toLowerCase']())+_0xb212('0xae')]=_0x363635[_0xb212('0x64')][_0xb212('0x69')][_0x103a16];socket[_0xb212('0xaf')](_0xb212('0x36')+_[_0xb212('0xab')](_0x11625e['toLowerCase']())+_0xb212('0xb0'),_0x32d0cf);}return _0x5d4326;})[_0xb212('0x1d')](function(){if(_0x11625e===_0xb212('0xb1')){return db['VoiceQueue'][_0xb212('0x61')]({'where':{'id':_0x363635[_0xb212('0x64')][_0xb212('0x69')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xb212('0x1d')](function(_0x1e9634){var _0x36817=_0x19c9d2[_0xb212('0x32')]({'plain':!![]});var _0x44e72f=[];if(_0x11625e===_0xb212('0xb1')&&_0x36817[_0xb212('0x33')]==='agent'&&_0x36817[_0xb212('0xa5')]){for(var _0x4e5a21=0x0;_0x4e5a21<_0x1e9634[_0xb212('0x54')];_0x4e5a21+=0x1){_0x44e72f[_0xb212('0x90')]({'membername':_0x36817[_0xb212('0x44')],'UserId':_0x36817['id'],'queue_name':_0x1e9634[_0x4e5a21]['name'],'VoiceQueueId':_0x1e9634[_0x4e5a21]['id'],'interface':_['isNil'](_0x36817[_0xb212('0xa7')])?util[_0xb212('0xb2')](_0xb212('0xb3'),_0x36817[_0xb212('0x44')]):_0x36817[_0xb212('0xa7')],'paused':_0x36817[_0xb212('0xa6')]||![],'penalty':_0x363635['body']['penalty']||0x0});}return BPromise[_0xb212('0x92')](_0x44e72f,function(_0x248107){return db['UserVoiceQueueRt'][_0xb212('0xb4')](_0x248107);});}return _0x19c9d2;});}})[_0xb212('0x1d')](respondWithStatusCode(_0x5060b7,null))[_0xb212('0x27')](handleError(_0x5060b7,null));};exports[_0xb212('0xb5')]=function(_0x88bc5c,_0x136100,_0x16678b){var _0x39e49d;return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x88bc5c['params']['id']},'attributes':['id',_0xb212('0x44'),_0xb212('0x33')]})[_0xb212('0x1d')](handleEntityNotFound(_0x136100,null))[_0xb212('0x1d')](function(_0x243c8a){if(_0x243c8a){_0x39e49d=_0x243c8a;if(!_0x88bc5c[_0xb212('0x4e')][_0xb212('0xb6')]||!utils['isValidChannel'](_0x88bc5c[_0xb212('0x4e')][_0xb212('0xb6')])){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0xa9'));}return _0x243c8a['remove'+_[_0xb212('0xab')](_0x88bc5c['query']['channel'][_0xb212('0xb7')]())+_0xb212('0xac')](_0x88bc5c[_0xb212('0x4e')]['ids']);}})['then'](function(_0x33e15d){for(var _0x5025f1=0x0;_0x5025f1<_0x88bc5c[_0xb212('0x4e')][_0xb212('0x69')][_0xb212('0x54')];_0x5025f1+=0x1){var _0x3f32f9={'UserId':_0x88bc5c['params']['id']};_0x3f32f9[_['capitalize'](_0x88bc5c[_0xb212('0x4e')][_0xb212('0xb6')][_0xb212('0xb7')]())+_0xb212('0xae')]=_0x88bc5c[_0xb212('0x4e')][_0xb212('0x69')][_0x5025f1];socket[_0xb212('0xaf')](_0xb212('0x36')+_[_0xb212('0xab')](_0x88bc5c[_0xb212('0x4e')][_0xb212('0xb6')][_0xb212('0xb7')]())+_0xb212('0xb8'),_0x3f32f9);}return _0x33e15d;})['then'](function(){if(_0x88bc5c[_0xb212('0x4e')][_0xb212('0xb6')]===_0xb212('0xb1')){return db[_0xb212('0xb9')][_0xb212('0x41')]({'where':{'UserId':_0x88bc5c[_0xb212('0x65')]['id'],'VoiceQueueId':_0x88bc5c[_0xb212('0x4e')][_0xb212('0x69')]},'individualHooks':!![]})['then'](function(){return _0x39e49d;});}return _0x39e49d;})['then'](respondWithStatusCode(_0x136100,null))[_0xb212('0x27')](handleError(_0x136100,null));};exports[_0xb212('0xba')]=function(_0x91aa50,_0x42364d,_0x260b93){_0x91aa50[_0xb212('0x64')][_0xb212('0xbb')]=_0x91aa50[_0xb212('0xbc')][_0xb212('0xbd')];return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x91aa50[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x42364d,null))[_0xb212('0x1d')](saveUpdates(_0x91aa50[_0xb212('0x64')],null))[_0xb212('0x1d')](respondWithResult(_0x42364d,null))[_0xb212('0x27')](handleError(_0x42364d,null));};exports[_0xb212('0xbe')]=function(_0x1ba432,_0x39f733,_0x5bfadf){var _0xf1989a=path[_0xb212('0xbf')](config[_0xb212('0xc0')],_0xb212('0xc1'));return db[_0xb212('0x47')]['find']({'where':{'id':_0x1ba432[_0xb212('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xb212('0x1d')](handleEntityNotFound(_0x39f733,null))[_0xb212('0x1d')](function(_0x68137){if(_0x68137){if(_['isNil'](_0x68137[_0xb212('0xbb')])){return _0x39f733[_0xb212('0xc2')](_0xf1989a);}else{if(!fs[_0xb212('0xc3')](path[_0xb212('0xbf')](config['root'],'server/files/images/',_0x68137[_0xb212('0xbb')]))){return _0x39f733['download'](_0xf1989a);}return _0x39f733[_0xb212('0xc2')](path[_0xb212('0xbf')](config[_0xb212('0xc0')],'server/files/images/',_0x68137[_0xb212('0xbb')]));}}})[_0xb212('0x27')](handleError(_0x39f733,null));};exports['getContacts']=function(_0x240667,_0x176f06,_0x4899aa){var _0x31d035={};var _0xd61f87={};var _0xfb8c7e;var _0x52917f;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x240667[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x176f06,null))['then'](function(_0x4476c5){if(_0x4476c5){_0xfb8c7e=_0x4476c5;_0xd61f87['model']=_[_0xb212('0x4f')](db[_0xb212('0xc4')][_0xb212('0x63')]);_0xd61f87[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x240667['query']);_0xd61f87[_0xb212('0x50')]=_[_0xb212('0x51')](_0xd61f87['model'],_0xd61f87[_0xb212('0x4e')]);_0x31d035[_0xb212('0x53')]=_['intersection'](_0xd61f87[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x240667[_0xb212('0x4e')]['fields']));_0x31d035[_0xb212('0x53')]=_0x31d035[_0xb212('0x53')]['length']?_0x31d035['attributes']:_0xd61f87[_0xb212('0x4b')];_0x31d035[_0xb212('0xc5')]=qs['sort'](_0x240667[_0xb212('0x4e')][_0xb212('0xc6')]);_0x31d035[_0xb212('0x56')]=qs['filters'](_[_0xb212('0x57')](_0x240667[_0xb212('0x4e')],_0xd61f87['filters']));if(_0x240667[_0xb212('0x4e')]['filter']){_0x31d035[_0xb212('0x56')]=_['merge'](_0x31d035[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x31d035[_0xb212('0x53')],function(_0x2986ff){var _0x4f7a6e={};_0x4f7a6e[_0x2986ff]={'$like':'%'+_0x240667[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0x4f7a6e;})});}_0x31d035=_['merge']({},_0x31d035,_0x240667['options']);return _0xfb8c7e[_0xb212('0xc7')](_0x31d035);}})['then'](function(_0x3462d7){if(_0x3462d7){_0x52917f=_0x3462d7[_0xb212('0x54')];if(_0x240667[_0xb212('0x4e')][_0xb212('0xc8')](_0xb212('0x5f'))){_0x31d035[_0xb212('0x60')]=[{'model':db[_0xb212('0xc9')],'as':_0xb212('0xca'),'required':![]},{'model':db[_0xb212('0xcb')],'as':_0xb212('0xcc'),'attributes':['id',_0xb212('0x44'),_0xb212('0xcd')],'where':_0x240667[_0xb212('0x4e')][_0xb212('0xce')]?{'id':_0x240667[_0xb212('0x4e')]['tag']}:undefined,'required':_0x240667[_0xb212('0x4e')][_0xb212('0xce')]?!![]:![]}];}if(!_0x240667['query'][_0xb212('0xc8')](_0xb212('0x55'))){_0x31d035[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x240667[_0xb212('0x4e')]['limit']);_0x31d035[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x240667['query'][_0xb212('0x2c')]);}return _0xfb8c7e[_0xb212('0xc7')](_0x31d035);}})[_0xb212('0x1d')](function(_0x2f370a){if(_0x2f370a){return _0x2f370a?{'count':_0x52917f,'rows':_0x2f370a}:null;}})[_0xb212('0x1d')](respondWithResult(_0x176f06,null))[_0xb212('0x27')](handleError(_0x176f06,null));};exports['getQueues']=function(_0x3790f0,_0x55a6a7,_0x5ccde1){var _0x2f7133;var _0x44291d;var _0x3e5212={};var _0x5c4a13;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x3790f0[_0xb212('0x65')]['id']},'attributes':['id',_0xb212('0x44'),_0xb212('0x33')]})[_0xb212('0x1d')](handleEntityNotFound(_0x55a6a7,null))[_0xb212('0x1d')](function(_0x124a62){if(!utils['isValidChannel'](_0x3790f0[_0xb212('0x4e')][_0xb212('0xb6')])){throw new db['Sequelize'][(_0xb212('0x97'))](_0xb212('0xa9'));}_0x2f7133=_0x124a62;var _0x325928={};_0x325928[_0xb212('0x4b')]=_[_0xb212('0x4f')](db[_[_0xb212('0xab')](_0x3790f0['query'][_0xb212('0xb6')])+'Queue'][_0xb212('0x63')]);_0x325928[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x3790f0[_0xb212('0x4e')]);_0x325928[_0xb212('0x50')]=_[_0xb212('0x51')](_0x325928[_0xb212('0x4b')],_0x325928[_0xb212('0x4e')]);_0x3e5212[_0xb212('0x53')]=_[_0xb212('0x51')](_0x325928[_0xb212('0x4b')],qs['fields'](_0x3790f0['query']['fields']));_0x3e5212[_0xb212('0x53')]=_0x3e5212[_0xb212('0x53')][_0xb212('0x54')]?_0x3e5212['attributes']:_0x325928[_0xb212('0x4b')];_0x3e5212['order']=qs[_0xb212('0xc6')](_0x3790f0['query'][_0xb212('0xc6')]);_0x3e5212[_0xb212('0x56')]=qs[_0xb212('0x50')](_['pick'](_0x3790f0[_0xb212('0x4e')],_0x325928['filters']));if(_0x3790f0['query'][_0xb212('0x58')]){_0x3e5212[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x3e5212[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x3e5212[_0xb212('0x53')],function(_0x2b55fc){var _0x31f8fa={};_0x31f8fa[_0x2b55fc]={'$like':'%'+_0x3790f0[_0xb212('0x4e')]['filter']+'%'};return _0x31f8fa;})});}_0x3e5212=_[_0xb212('0x5d')]({},_0x3e5212,_0x3790f0['options']);switch(_0x2f7133[_0xb212('0x33')]){case _0xb212('0x34'):return db[_[_0xb212('0xab')](_0x3790f0[_0xb212('0x4e')]['channel'])+_0xb212('0xcf')][_0xb212('0x61')](_0x3e5212);case _0xb212('0x36'):case _0xb212('0x38'):return _0x2f7133['get'+_['capitalize'](_0x3790f0[_0xb212('0x4e')]['channel'])+_0xb212('0xac')](_0x3e5212);default:throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))]('Unknown\x20role');}})[_0xb212('0x1d')](function(_0x943f4c){_0x5c4a13=_0x943f4c[_0xb212('0x54')];if(!_0x3790f0[_0xb212('0x4e')]['hasOwnProperty'](_0xb212('0x55'))){_0x3e5212[_0xb212('0x2d')]=qs['limit'](_0x3790f0['query'][_0xb212('0x2d')]);_0x3e5212[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x3790f0[_0xb212('0x4e')][_0xb212('0x2c')]);}switch(_0x2f7133[_0xb212('0x33')]){case _0xb212('0x34'):return db[_[_0xb212('0xab')](_0x3790f0[_0xb212('0x4e')][_0xb212('0xb6')])+_0xb212('0xcf')][_0xb212('0x61')](_0x3e5212);case'user':case _0xb212('0x38'):return _0x2f7133[_0xb212('0x32')+_[_0xb212('0xab')](_0x3790f0[_0xb212('0x4e')][_0xb212('0xb6')])+'Queues'](_0x3e5212);}})[_0xb212('0x1d')](function(_0x15a153){return{'count':_0x5c4a13,'rows':_0x15a153};})[_0xb212('0x1d')](respondWithResult(_0x55a6a7,null))[_0xb212('0x27')](handleError(_0x55a6a7,null));};exports[_0xb212('0xd0')]=function(_0x4b74d1,_0x167379,_0x2a3427){var _0x1e4951={};var _0x30de27={};var _0x2fba92;var _0x269bc8;return db[_0xb212('0x47')]['findOne']({'where':{'id':_0x4b74d1[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x167379,null))[_0xb212('0x1d')](function(_0x2bfaa8){if(_0x2bfaa8){_0x2fba92=_0x2bfaa8;_0x30de27[_0xb212('0x4b')]=_[_0xb212('0x4f')](db['UserVoiceQueueRt'][_0xb212('0x63')]);_0x30de27[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x4b74d1[_0xb212('0x4e')]);_0x30de27[_0xb212('0x50')]=_['intersection'](_0x30de27['model'],_0x30de27[_0xb212('0x4e')]);_0x1e4951[_0xb212('0x53')]=_[_0xb212('0x51')](_0x30de27[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x4b74d1[_0xb212('0x4e')][_0xb212('0x52')]));_0x1e4951[_0xb212('0x53')]=_0x1e4951[_0xb212('0x53')][_0xb212('0x54')]?_0x1e4951[_0xb212('0x53')]:_0x30de27[_0xb212('0x4b')];_0x1e4951['order']=qs[_0xb212('0xc6')](_0x4b74d1['query']['sort']);_0x1e4951['where']=qs[_0xb212('0x50')](_['pick'](_0x4b74d1[_0xb212('0x4e')],_0x30de27[_0xb212('0x50')]));if(_0x4b74d1[_0xb212('0x4e')][_0xb212('0x58')]){_0x1e4951[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x1e4951[_0xb212('0x56')],{'$or':_['map'](_0x1e4951[_0xb212('0x53')],function(_0x298b85){var _0x28fe02={};_0x28fe02[_0x298b85]={'$like':'%'+_0x4b74d1[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0x28fe02;})});}_0x1e4951=_[_0xb212('0x5d')]({},_0x1e4951,_0x4b74d1['options']);return _0x2fba92[_0xb212('0xd0')](_0x1e4951);}})['then'](function(_0x527beb){if(_0x527beb){_0x269bc8=_0x527beb['length'];if(!_0x4b74d1[_0xb212('0x4e')][_0xb212('0xc8')](_0xb212('0x55'))){_0x1e4951[_0xb212('0x2d')]=qs['limit'](_0x4b74d1[_0xb212('0x4e')][_0xb212('0x2d')]);_0x1e4951['offset']=qs[_0xb212('0x2c')](_0x4b74d1[_0xb212('0x4e')][_0xb212('0x2c')]);}return _0x2fba92[_0xb212('0xd0')](_0x1e4951);}})['then'](function(_0x68e81a){if(_0x68e81a){return _0x68e81a?{'count':_0x269bc8,'rows':_0x68e81a}:null;}})[_0xb212('0x1d')](respondWithResult(_0x167379,null))['catch'](handleError(_0x167379,null));};exports['getGroups']=function(_0x57d1b7,_0x2d8c97,_0x2ae36a){var _0x9c513f={};var _0x40a024={};var _0x247b09;var _0x3cc77d;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x57d1b7[_0xb212('0x65')]['id']}})['then'](handleEntityNotFound(_0x2d8c97,null))[_0xb212('0x1d')](function(_0x330808){if(_0x330808){_0x247b09=_0x330808;_0x40a024[_0xb212('0x4b')]=_[_0xb212('0x4f')](db[_0xb212('0xd1')][_0xb212('0x63')]);_0x40a024[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x57d1b7[_0xb212('0x4e')]);_0x40a024[_0xb212('0x50')]=_['intersection'](_0x40a024[_0xb212('0x4b')],_0x40a024[_0xb212('0x4e')]);_0x9c513f['attributes']=_[_0xb212('0x51')](_0x40a024[_0xb212('0x4b')],qs['fields'](_0x57d1b7[_0xb212('0x4e')][_0xb212('0x52')]));_0x9c513f[_0xb212('0x53')]=_0x9c513f[_0xb212('0x53')][_0xb212('0x54')]?_0x9c513f[_0xb212('0x53')]:_0x40a024['model'];_0x9c513f[_0xb212('0xc5')]=qs[_0xb212('0xc6')](_0x57d1b7[_0xb212('0x4e')][_0xb212('0xc6')]);_0x9c513f[_0xb212('0x56')]=qs[_0xb212('0x50')](_['pick'](_0x57d1b7[_0xb212('0x4e')],_0x40a024[_0xb212('0x50')]));if(_0x57d1b7[_0xb212('0x4e')][_0xb212('0x58')]){_0x9c513f['where']=_[_0xb212('0x5d')](_0x9c513f['where'],{'$or':_[_0xb212('0x3c')](_0x9c513f[_0xb212('0x53')],function(_0x1e4f5c){var _0x493fb3={};_0x493fb3[_0x1e4f5c]={'$like':'%'+_0x57d1b7[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0x493fb3;})});}_0x9c513f=_[_0xb212('0x5d')]({},_0x9c513f,_0x57d1b7[_0xb212('0x5e')]);return _0x247b09[_0xb212('0xd2')](_0x9c513f);}})['then'](function(_0x2d3032){if(_0x2d3032){_0x3cc77d=_0x2d3032[_0xb212('0x54')];if(!_0x57d1b7[_0xb212('0x4e')]['hasOwnProperty'](_0xb212('0x55'))){_0x9c513f[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x57d1b7[_0xb212('0x4e')]['limit']);_0x9c513f[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x57d1b7[_0xb212('0x4e')]['offset']);}return _0x247b09[_0xb212('0xd2')](_0x9c513f);}})[_0xb212('0x1d')](function(_0xebe794){if(_0xebe794){return _0xebe794?{'count':_0x3cc77d,'rows':_0xebe794}:null;}})['then'](respondWithResult(_0x2d8c97,null))[_0xb212('0x27')](handleError(_0x2d8c97,null));};exports['getRecordings']=function(_0x100844,_0x1e3b37,_0x295fa6){var _0x291b53={'raw':!![],'where':{}};var _0x33e2e3={};var _0x5cdc8a={'count':0x0,'rows':[]};return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x100844['params']['id']}})['then'](handleEntityNotFound(_0x1e3b37,null))[_0xb212('0x1d')](function(_0xf425f0){if(_0xf425f0){_0x33e2e3[_0xb212('0x4b')]=_['keys'](db['VoiceRecording'][_0xb212('0x63')]);_0x33e2e3[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x100844[_0xb212('0x4e')]);_0x33e2e3[_0xb212('0x50')]=_['intersection'](_0x33e2e3[_0xb212('0x4b')],_0x33e2e3[_0xb212('0x4e')]);_0x291b53[_0xb212('0x53')]=_[_0xb212('0x51')](_0x33e2e3['model'],qs[_0xb212('0x52')](_0x100844[_0xb212('0x4e')]['fields']));_0x291b53[_0xb212('0x53')]=_0x291b53[_0xb212('0x53')][_0xb212('0x54')]?_0x291b53[_0xb212('0x53')]:_0x33e2e3[_0xb212('0x4b')];if(!_0x100844['query'][_0xb212('0xc8')]('nolimit')){_0x291b53['limit']=qs[_0xb212('0x2d')](_0x100844[_0xb212('0x4e')][_0xb212('0x2d')]);_0x291b53[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x100844[_0xb212('0x4e')]['offset']);}_0x291b53['order']=qs[_0xb212('0xc6')](_0x100844['query']['sort']);_0x291b53[_0xb212('0x56')]=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x100844[_0xb212('0x4e')],_0x33e2e3['filters']));_0x291b53['where'][_0xb212('0xd3')]=_0xf425f0['id'];if(_0x100844[_0xb212('0x4e')]['filter']){_0x291b53[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x291b53['where'],{'$or':_[_0xb212('0x3c')](_0x291b53[_0xb212('0x53')],function(_0x160eef){var _0x4f6f66={};_0x4f6f66[_0x160eef]={'$like':'%'+_0x100844[_0xb212('0x4e')]['filter']+'%'};return _0x4f6f66;})});}_0x291b53=_[_0xb212('0x5d')]({},_0x291b53,_0x100844[_0xb212('0x5e')]);return db[_0xb212('0xd4')][_0xb212('0x2b')]({'where':_0x291b53[_0xb212('0x56')]})['then'](function(_0x560553){_0x5cdc8a[_0xb212('0x2b')]=_0x560553;if(_0x100844['query'][_0xb212('0x5f')]){_0x291b53['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x291b53);})['then'](function(_0x5767d5){_0x5cdc8a[_0xb212('0xd5')]=_0x5767d5;return _0x5cdc8a;});}})['then'](respondWithFilteredResult(_0x1e3b37,_0x291b53))[_0xb212('0x27')](handleError(_0x1e3b37,null));};exports[_0xb212('0xd6')]=function(_0x887138,_0x5857d5,_0x43e6e4){var _0x458818={'raw':!![],'where':{}};var _0x4173e7={};var _0x118fcb={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x887138[_0xb212('0x65')]['id']}})['then'](handleEntityNotFound(_0x5857d5,null))[_0xb212('0x1d')](function(_0x2c7169){if(_0x2c7169){_0x4173e7['model']=_[_0xb212('0x4f')](db[_0xb212('0xd7')][_0xb212('0x63')]);_0x4173e7['query']=_[_0xb212('0x4f')](_0x887138[_0xb212('0x4e')]);_0x4173e7[_0xb212('0x50')]=_[_0xb212('0x51')](_0x4173e7[_0xb212('0x4b')],_0x4173e7[_0xb212('0x4e')]);_0x458818[_0xb212('0x53')]=_[_0xb212('0x51')](_0x4173e7[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x887138[_0xb212('0x4e')][_0xb212('0x52')]));_0x458818[_0xb212('0x53')]=_0x458818[_0xb212('0x53')][_0xb212('0x54')]?_0x458818[_0xb212('0x53')]:_0x4173e7[_0xb212('0x4b')];if(!_0x887138[_0xb212('0x4e')][_0xb212('0xc8')](_0xb212('0x55'))){_0x458818[_0xb212('0x2d')]=qs['limit'](_0x887138['query']['limit']);_0x458818[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x887138[_0xb212('0x4e')][_0xb212('0x2c')]);}_0x458818['order']=qs[_0xb212('0xc6')](_0x887138['query']['sort']);_0x458818[_0xb212('0x56')]=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x887138[_0xb212('0x4e')],_0x4173e7[_0xb212('0x50')]));_0x458818[_0xb212('0x56')][_0xb212('0xd3')]=_0x2c7169['id'];if(_0x887138[_0xb212('0x4e')][_0xb212('0x58')]){_0x458818['where']=_[_0xb212('0x5d')](_0x458818['where'],{'$or':_[_0xb212('0x3c')](_0x458818[_0xb212('0x53')],function(_0x145c95){var _0xdbbc10={};_0xdbbc10[_0x145c95]={'$like':'%'+_0x887138[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0xdbbc10;})});}_0x458818=_[_0xb212('0x5d')]({},_0x458818,_0x887138[_0xb212('0x5e')]);return db[_0xb212('0xd7')][_0xb212('0x2b')]({'where':_0x458818['where']})[_0xb212('0x1d')](function(_0xb62c85){_0x118fcb[_0xb212('0x2b')]=_0xb62c85;if(_0x887138[_0xb212('0x4e')][_0xb212('0x5f')]){_0x458818[_0xb212('0x60')]=[{'all':!![]}];}return db['ScreenRecording'][_0xb212('0x61')](_0x458818);})['then'](function(_0x6c15a7){_0x118fcb['rows']=_0x6c15a7;return _0x118fcb;});}})[_0xb212('0x1d')](respondWithFilteredResult(_0x5857d5,_0x458818))[_0xb212('0x27')](handleError(_0x5857d5,null));};exports[_0xb212('0xd8')]=function(_0x3372cf,_0x381158,_0x2e371e){var _0x14d19b={};var _0x1695f3={};var _0x2dbed0;var _0x200fce;return db[_0xb212('0x47')]['findOne']({'where':{'id':_0x3372cf['params']['id']}})['then'](handleEntityNotFound(_0x381158,null))[_0xb212('0x1d')](function(_0x14b1db){if(_0x14b1db){_0x2dbed0=_0x14b1db;_0x1695f3[_0xb212('0x4b')]=_[_0xb212('0x4f')](db['ChatInteraction'][_0xb212('0x63')]);_0x1695f3[_0xb212('0x4e')]=_['keys'](_0x3372cf[_0xb212('0x4e')]);_0x1695f3[_0xb212('0x50')]=_[_0xb212('0x51')](_0x1695f3[_0xb212('0x4b')],_0x1695f3[_0xb212('0x4e')]);_0x14d19b[_0xb212('0x53')]=_[_0xb212('0x51')](_0x1695f3['model'],qs[_0xb212('0x52')](_0x3372cf['query'][_0xb212('0x52')]));_0x14d19b[_0xb212('0x53')]=_0x14d19b[_0xb212('0x53')][_0xb212('0x54')]?_0x14d19b[_0xb212('0x53')]:_0x1695f3['model'];_0x14d19b[_0xb212('0xc5')]=qs[_0xb212('0xc6')](_0x3372cf[_0xb212('0x4e')][_0xb212('0xc6')]);_0x14d19b[_0xb212('0x56')]=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x3372cf[_0xb212('0x4e')],_0x1695f3[_0xb212('0x50')]));if(_0x3372cf[_0xb212('0x4e')][_0xb212('0x58')]){_0x14d19b[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x14d19b[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x14d19b['attributes'],function(_0x43b4fb){var _0x35438a={};_0x35438a[_0x43b4fb]={'$like':'%'+_0x3372cf[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0x35438a;})});}_0x14d19b=_[_0xb212('0x5d')]({},_0x14d19b,_0x3372cf[_0xb212('0x5e')]);return _0x2dbed0[_0xb212('0xd8')](_0x14d19b);}})[_0xb212('0x1d')](function(_0x267a69){if(_0x267a69){_0x200fce=_0x267a69[_0xb212('0x54')];if(!_0x3372cf[_0xb212('0x4e')]['hasOwnProperty'](_0xb212('0x55'))){_0x14d19b['limit']=qs[_0xb212('0x2d')](_0x3372cf[_0xb212('0x4e')][_0xb212('0x2d')]);_0x14d19b['offset']=qs[_0xb212('0x2c')](_0x3372cf[_0xb212('0x4e')][_0xb212('0x2c')]);}return _0x2dbed0[_0xb212('0xd8')](_0x14d19b);}})[_0xb212('0x1d')](function(_0x12e9b1){if(_0x12e9b1){return _0x12e9b1?{'count':_0x200fce,'rows':_0x12e9b1}:null;}})[_0xb212('0x1d')](respondWithResult(_0x381158,null))['catch'](handleError(_0x381158,null));};exports[_0xb212('0xd9')]=function(_0xf7ab85,_0x27acfb,_0x52e1be){var _0x4c9544={};var _0x41deec={};var _0x3990b8;var _0x32c55e;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0xf7ab85[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x27acfb,null))[_0xb212('0x1d')](function(_0x1c2353){if(_0x1c2353){_0x3990b8=_0x1c2353;_0x41deec[_0xb212('0x4b')]=_[_0xb212('0x4f')](db[_0xb212('0xda')][_0xb212('0x63')]);_0x41deec[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0xf7ab85[_0xb212('0x4e')]);_0x41deec[_0xb212('0x50')]=_[_0xb212('0x51')](_0x41deec[_0xb212('0x4b')],_0x41deec[_0xb212('0x4e')]);_0x4c9544[_0xb212('0x53')]=_[_0xb212('0x51')](_0x41deec[_0xb212('0x4b')],qs[_0xb212('0x52')](_0xf7ab85[_0xb212('0x4e')][_0xb212('0x52')]));_0x4c9544[_0xb212('0x53')]=_0x4c9544[_0xb212('0x53')][_0xb212('0x54')]?_0x4c9544[_0xb212('0x53')]:_0x41deec[_0xb212('0x4b')];_0x4c9544[_0xb212('0xc5')]=qs[_0xb212('0xc6')](_0xf7ab85[_0xb212('0x4e')]['sort']);_0x4c9544['where']=qs[_0xb212('0x50')](_['pick'](_0xf7ab85[_0xb212('0x4e')],_0x41deec[_0xb212('0x50')]));if(_0xf7ab85['query'][_0xb212('0x58')]){_0x4c9544[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x4c9544[_0xb212('0x56')],{'$or':_['map'](_0x4c9544[_0xb212('0x53')],function(_0xa3115a){var _0xe366ae={};_0xe366ae[_0xa3115a]={'$like':'%'+_0xf7ab85[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0xe366ae;})});}_0x4c9544=_['merge']({},_0x4c9544,_0xf7ab85[_0xb212('0x5e')]);return _0x3990b8[_0xb212('0xd9')](_0x4c9544);}})[_0xb212('0x1d')](function(_0x100e37){if(_0x100e37){_0x32c55e=_0x100e37[_0xb212('0x54')];if(!_0xf7ab85[_0xb212('0x4e')][_0xb212('0xc8')]('nolimit')){_0x4c9544[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0xf7ab85['query'][_0xb212('0x2d')]);_0x4c9544['offset']=qs[_0xb212('0x2c')](_0xf7ab85[_0xb212('0x4e')][_0xb212('0x2c')]);}return _0x3990b8['getOpenchannelInteractions'](_0x4c9544);}})['then'](function(_0x6b4801){if(_0x6b4801){return _0x6b4801?{'count':_0x32c55e,'rows':_0x6b4801}:null;}})['then'](respondWithResult(_0x27acfb,null))[_0xb212('0x27')](handleError(_0x27acfb,null));};exports[_0xb212('0xdb')]=function(_0x3bf019,_0x17c940,_0x3055f3){var _0x29378c={'raw':!![],'where':{}};var _0x3644f3={};var _0x328236={'count':0x0,'rows':[]};return db[_0xb212('0x47')]['findOne']({'where':{'id':_0x3bf019[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x17c940,null))[_0xb212('0x1d')](function(_0x5e4516){if(_0x5e4516){_0x3644f3[_0xb212('0x4b')]=_[_0xb212('0x4f')](db[_0xb212('0xdc')][_0xb212('0x63')]);_0x3644f3[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x3bf019[_0xb212('0x4e')]);_0x3644f3[_0xb212('0x50')]=_[_0xb212('0x51')](_0x3644f3[_0xb212('0x4b')],_0x3644f3[_0xb212('0x4e')]);_0x29378c[_0xb212('0x53')]=_['intersection'](_0x3644f3[_0xb212('0x4b')],qs['fields'](_0x3bf019[_0xb212('0x4e')][_0xb212('0x52')]));_0x29378c[_0xb212('0x53')]=_0x29378c['attributes'][_0xb212('0x54')]?_0x29378c[_0xb212('0x53')]:_0x3644f3[_0xb212('0x4b')];if(!_0x3bf019[_0xb212('0x4e')][_0xb212('0xc8')](_0xb212('0x55'))){_0x29378c[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x3bf019[_0xb212('0x4e')][_0xb212('0x2d')]);_0x29378c['offset']=qs['offset'](_0x3bf019[_0xb212('0x4e')][_0xb212('0x2c')]);}_0x29378c[_0xb212('0xc5')]=qs[_0xb212('0xc6')](_0x3bf019[_0xb212('0x4e')]['sort']);_0x29378c['where']=qs['filters'](_[_0xb212('0x57')](_0x3bf019[_0xb212('0x4e')],_0x3644f3['filters']));_0x29378c[_0xb212('0x56')][_0xb212('0xd3')]=_0x5e4516['id'];if(_0x3bf019[_0xb212('0x4e')][_0xb212('0x58')]){_0x29378c[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x29378c[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x29378c['attributes'],function(_0xdff71a){var _0x31ee2a={};_0x31ee2a[_0xdff71a]={'$like':'%'+_0x3bf019[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0x31ee2a;})});}_0x29378c=_[_0xb212('0x5d')]({},_0x29378c,_0x3bf019['options']);return db[_0xb212('0xdc')][_0xb212('0x2b')]({'where':_0x29378c[_0xb212('0x56')]})[_0xb212('0x1d')](function(_0x45f25f){_0x328236[_0xb212('0x2b')]=_0x45f25f;if(_0x3bf019[_0xb212('0x4e')][_0xb212('0x5f')]){_0x29378c[_0xb212('0x60')]=[{'all':!![]}];}return db[_0xb212('0xdc')][_0xb212('0x61')](_0x29378c);})[_0xb212('0x1d')](function(_0x59432c){_0x328236['rows']=_0x59432c;return _0x328236;});}})[_0xb212('0x1d')](respondWithFilteredResult(_0x17c940,_0x29378c))[_0xb212('0x27')](handleError(_0x17c940,null));};exports[_0xb212('0xdd')]=function(_0x547401,_0x2e9356,_0x383903){var _0x306808={};var _0x2e39df={};var _0x3633d7;var _0x4f20aa;return db[_0xb212('0x47')]['findOne']({'where':{'id':_0x547401[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x2e9356,null))[_0xb212('0x1d')](function(_0x54a97f){if(_0x54a97f){_0x3633d7=_0x54a97f;_0x2e39df[_0xb212('0x4b')]=_['keys'](db[_0xb212('0xde')][_0xb212('0x63')]);_0x2e39df[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x547401['query']);_0x2e39df['filters']=_[_0xb212('0x51')](_0x2e39df['model'],_0x2e39df['query']);_0x306808[_0xb212('0x53')]=_[_0xb212('0x51')](_0x2e39df[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x547401[_0xb212('0x4e')][_0xb212('0x52')]));_0x306808[_0xb212('0x53')]=_0x306808[_0xb212('0x53')][_0xb212('0x54')]?_0x306808[_0xb212('0x53')]:_0x2e39df[_0xb212('0x4b')];_0x306808[_0xb212('0xc5')]=qs[_0xb212('0xc6')](_0x547401[_0xb212('0x4e')][_0xb212('0xc6')]);_0x306808[_0xb212('0x56')]=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x547401[_0xb212('0x4e')],_0x2e39df[_0xb212('0x50')]));if(_0x547401[_0xb212('0x4e')][_0xb212('0x58')]){_0x306808['where']=_[_0xb212('0x5d')](_0x306808[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x306808['attributes'],function(_0x84daaf){var _0x527689={};_0x527689[_0x84daaf]={'$like':'%'+_0x547401[_0xb212('0x4e')]['filter']+'%'};return _0x527689;})});}_0x306808=_[_0xb212('0x5d')]({},_0x306808,_0x547401[_0xb212('0x5e')]);return _0x3633d7[_0xb212('0xdd')](_0x306808);}})['then'](function(_0x5c46f5){if(_0x5c46f5){_0x4f20aa=_0x5c46f5['length'];if(!_0x547401[_0xb212('0x4e')][_0xb212('0xc8')](_0xb212('0x55'))){_0x306808[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x547401[_0xb212('0x4e')][_0xb212('0x2d')]);_0x306808['offset']=qs['offset'](_0x547401[_0xb212('0x4e')][_0xb212('0x2c')]);}return _0x3633d7[_0xb212('0xdd')](_0x306808);}})[_0xb212('0x1d')](function(_0xaa970b){if(_0xaa970b){return _0xaa970b?{'count':_0x4f20aa,'rows':_0xaa970b}:null;}})[_0xb212('0x1d')](respondWithResult(_0x2e9356,null))[_0xb212('0x27')](handleError(_0x2e9356,null));};exports['getFaxInteractions']=function(_0x4c62c2,_0x5a481c,_0xb8517){var _0x3dc265={};var _0x39b90f={};var _0x34c4ec;var _0x499f05;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x4c62c2[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x5a481c,null))[_0xb212('0x1d')](function(_0x30de17){if(_0x30de17){_0x34c4ec=_0x30de17;_0x39b90f['model']=_[_0xb212('0x4f')](db['FaxInteraction'][_0xb212('0x63')]);_0x39b90f['query']=_[_0xb212('0x4f')](_0x4c62c2['query']);_0x39b90f[_0xb212('0x50')]=_[_0xb212('0x51')](_0x39b90f['model'],_0x39b90f[_0xb212('0x4e')]);_0x3dc265[_0xb212('0x53')]=_['intersection'](_0x39b90f[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x4c62c2[_0xb212('0x4e')]['fields']));_0x3dc265[_0xb212('0x53')]=_0x3dc265['attributes'][_0xb212('0x54')]?_0x3dc265[_0xb212('0x53')]:_0x39b90f['model'];_0x3dc265['order']=qs[_0xb212('0xc6')](_0x4c62c2[_0xb212('0x4e')][_0xb212('0xc6')]);_0x3dc265['where']=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x4c62c2['query'],_0x39b90f[_0xb212('0x50')]));if(_0x4c62c2[_0xb212('0x4e')][_0xb212('0x58')]){_0x3dc265['where']=_[_0xb212('0x5d')](_0x3dc265[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0x3dc265[_0xb212('0x53')],function(_0x47b868){var _0x54e0f1={};_0x54e0f1[_0x47b868]={'$like':'%'+_0x4c62c2['query'][_0xb212('0x58')]+'%'};return _0x54e0f1;})});}_0x3dc265=_[_0xb212('0x5d')]({},_0x3dc265,_0x4c62c2[_0xb212('0x5e')]);return _0x34c4ec[_0xb212('0xdf')](_0x3dc265);}})['then'](function(_0x45a10e){if(_0x45a10e){_0x499f05=_0x45a10e[_0xb212('0x54')];if(!_0x4c62c2['query']['hasOwnProperty'](_0xb212('0x55'))){_0x3dc265['limit']=qs['limit'](_0x4c62c2[_0xb212('0x4e')][_0xb212('0x2d')]);_0x3dc265[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x4c62c2[_0xb212('0x4e')]['offset']);}return _0x34c4ec[_0xb212('0xdf')](_0x3dc265);}})[_0xb212('0x1d')](function(_0x4a745a){if(_0x4a745a){return _0x4a745a?{'count':_0x499f05,'rows':_0x4a745a}:null;}})[_0xb212('0x1d')](respondWithResult(_0x5a481c,null))[_0xb212('0x27')](handleError(_0x5a481c,null));};exports[_0xb212('0xe0')]=function(_0x199ae6,_0x4c89c0,_0x2ff4ff){var _0x56dc63={};var _0x5b0d3f={};var _0x5959c0;var _0x148a46;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x199ae6[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x4c89c0,null))[_0xb212('0x1d')](function(_0x45116f){if(_0x45116f){_0x5959c0=_0x45116f;_0x5b0d3f[_0xb212('0x4b')]=_[_0xb212('0x4f')](db[_0xb212('0xe1')][_0xb212('0x63')]);_0x5b0d3f[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x199ae6[_0xb212('0x4e')]);_0x5b0d3f['filters']=_[_0xb212('0x51')](_0x5b0d3f[_0xb212('0x4b')],_0x5b0d3f[_0xb212('0x4e')]);_0x56dc63[_0xb212('0x53')]=_[_0xb212('0x51')](_0x5b0d3f[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x199ae6['query'][_0xb212('0x52')]));_0x56dc63[_0xb212('0x53')]=_0x56dc63['attributes'][_0xb212('0x54')]?_0x56dc63['attributes']:_0x5b0d3f[_0xb212('0x4b')];_0x56dc63[_0xb212('0xc5')]=qs[_0xb212('0xc6')](_0x199ae6[_0xb212('0x4e')]['sort']);_0x56dc63[_0xb212('0x56')]=qs[_0xb212('0x50')](_['pick'](_0x199ae6[_0xb212('0x4e')],_0x5b0d3f[_0xb212('0x50')]));if(_0x199ae6['query'][_0xb212('0x58')]){_0x56dc63[_0xb212('0x56')]=_[_0xb212('0x5d')](_0x56dc63[_0xb212('0x56')],{'$or':_['map'](_0x56dc63[_0xb212('0x53')],function(_0x465ba0){var _0x359fc7={};_0x359fc7[_0x465ba0]={'$like':'%'+_0x199ae6[_0xb212('0x4e')][_0xb212('0x58')]+'%'};return _0x359fc7;})});}_0x56dc63=_['merge']({},_0x56dc63,_0x199ae6[_0xb212('0x5e')]);return _0x5959c0[_0xb212('0xe0')](_0x56dc63);}})[_0xb212('0x1d')](function(_0x2d7311){if(_0x2d7311){_0x148a46=_0x2d7311[_0xb212('0x54')];if(!_0x199ae6[_0xb212('0x4e')][_0xb212('0xc8')]('nolimit')){_0x56dc63[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x199ae6[_0xb212('0x4e')][_0xb212('0x2d')]);_0x56dc63['offset']=qs[_0xb212('0x2c')](_0x199ae6[_0xb212('0x4e')]['offset']);}return _0x5959c0['getWhatsappInteractions'](_0x56dc63);}})[_0xb212('0x1d')](function(_0xb50867){if(_0xb50867){return _0xb50867?{'count':_0x148a46,'rows':_0xb50867}:null;}})[_0xb212('0x1d')](respondWithResult(_0x4c89c0,null))[_0xb212('0x27')](handleError(_0x4c89c0,null));};exports['login']=function(_0xbd7282,_0x24151d,_0x3ca8c8){var _0x395878;var _0x4b7e66;var _0x108e3f;var _0x255a0d=!_[_0xb212('0x6e')](_0xbd7282[_0xb212('0x65')]['id'])?_0xbd7282[_0xb212('0x65')]['id']:!_[_0xb212('0x6e')](_0xbd7282['user']['id'])?_0xbd7282[_0xb212('0x36')]['id']:null;return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x255a0d,'role':{'$or':[_0xb212('0x34'),_0xb212('0x36'),_0xb212('0x38')]}},'attributes':['id',_0xb212('0x44'),_0xb212('0xe2'),_0xb212('0xe3'),_0xb212('0x33'),'internal',_0xb212('0xe4')]})[_0xb212('0x1d')](function(_0x12a8e7){if(_0x12a8e7){if(_0x12a8e7[_0xb212('0x33')]==='agent'){_0x395878=_0x12a8e7;if(_0xbd7282[_0xb212('0x64')][_0xb212('0xa7')]){_0x108e3f=util['format'](_0xb212('0xe5'),_0x395878[_0xbd7282[_0xb212('0x64')][_0xb212('0xa7')]]);}else if(_0xbd7282['body'][_0xb212('0xe6')]){_0x108e3f=util[_0xb212('0xb2')](_0xb212('0xb3'),_0xbd7282[_0xb212('0x64')][_0xb212('0xe6')]);}else{_0x108e3f=util[_0xb212('0xb2')](_0xb212('0xb3'),_0x395878[_0xb212('0x44')]);}socket['to'](util[_0xb212('0xb2')](_0xb212('0xe7'),_0x395878[_0xb212('0x44')]))[_0xb212('0xaf')]('user:forcelogout',{'ip':_0xbd7282[_0xb212('0xe8')]['x-forwarded-for']||_0xbd7282[_0xb212('0xe9')][_0xb212('0xea')]||_0xbd7282[_0xb212('0xeb')]['remoteAddress']||_0xbd7282[_0xb212('0xe9')]['socket'][_0xb212('0xea')]});return db[_0xb212('0xb9')][_0xb212('0x41')]({'where':{'membername':_0x395878[_0xb212('0x44')]},'individualHooks':!![]});}}else{throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0xec'));}})[_0xb212('0x1d')](function(){if(_0x395878){return _0x395878[_0xb212('0xed')]({'raw':!![]});}})[_0xb212('0x1d')](function(_0x5f0767){if(_0x395878){var _0x321ff1=[];if(_0x5f0767){_0x4b7e66=_0x5f0767;if(_0x4b7e66[_0xb212('0x54')]){for(var _0x22a29d=0x0;_0x22a29d<_0x4b7e66[_0xb212('0x54')];_0x22a29d++){_0x321ff1[_0xb212('0x90')]({'membername':_0x395878['name'],'UserId':_0x395878['id'],'queue_name':_0x4b7e66[_0x22a29d][_0xb212('0x44')],'VoiceQueueId':_0x4b7e66[_0x22a29d]['id'],'interface':_0x108e3f,'paused':_0x395878[_0xb212('0xe4')]||![],'penalty':_0x4b7e66[_0x22a29d][_0xb212('0xee')]||0x0});}return BPromise[_0xb212('0x92')](_0x321ff1,function(_0x456bb2){return db[_0xb212('0xb9')][_0xb212('0xb4')](_0x456bb2);});}}}})[_0xb212('0x1d')](function(){if(_0x395878){return db['MemberReport'][_0xb212('0x61')]({'where':{'membername':_0x395878[_0xb212('0x44')],'exitAt':null}});}})[_0xb212('0x1d')](function(_0x2fd33f){if(_0x395878){var _0x214137=[];_0x2fd33f[_0xb212('0xef')](function(_0x58ea15){_0x214137[_0xb212('0x90')](_0x58ea15[_0xb212('0x31')]({'exitAt':moment()[_0xb212('0xb2')](_0xb212('0xf0'))}));});return BPromise[_0xb212('0x91')](_0x214137);}})['then'](function(){if(_0x395878){var _0x41b00e=[];var _0x460b4a=[];var _0x53a170=utils[_0xb212('0xf1')]();var _0x4b47f1={'membername':_0x395878['name'],'interface':_0x108e3f,'enterAt':moment()[_0xb212('0xb2')](_0xb212('0xf0')),'role':_0x395878[_0xb212('0x33')],'internal':_0x395878['internal']};_0x53a170[_0xb212('0xef')](function(_0x2e1bcb){_0x41b00e[_0xb212('0x90')](_[_0xb212('0x5d')]({'channel':_0x2e1bcb,'type':_0xb212('0xf2'),'data1':_0xbd7282['body'][_0xb212('0xf3')],'data2':_0x108e3f},_0x4b47f1));if(_0x395878['loginInPause']){_0x460b4a[_0xb212('0x90')](_['merge']({'channel':_0x2e1bcb,'type':_0xb212('0xf4'),'data1':_0xb212('0xf5')},_0x4b47f1));}});return db[_0xb212('0xf6')][_0xb212('0x8d')](_0x41b00e[_0xb212('0xf7')](_0x460b4a),{'individualHooks':!![]});}})['then'](function(){if(_0x395878){return _0x395878['update']({'online':!![],'lastLoginAt':moment()['format'](_0xb212('0xf0')),'voicePause':_0x395878['loginInPause']||![],'mailPause':_0x395878[_0xb212('0xe4')]||![],'chatPause':_0x395878[_0xb212('0xe4')]||![],'faxPause':_0x395878['loginInPause']||![],'smsPause':_0x395878[_0xb212('0xe4')]||![],'openchannelPause':_0x395878[_0xb212('0xe4')]||![],'whatsappPause':_0x395878[_0xb212('0xe4')]||![],'pauseType':_0x395878[_0xb212('0xe4')]?'LOGININPAUSE':null,'interface':_0x108e3f,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb212('0x1d')](function(_0x3c5270){if(_0xbd7282[_0xb212('0xf8')]){return _0x3ca8c8();}else{return BPromise[_0xb212('0xf9')](_0x3c5270)[_0xb212('0x1d')](respondWithResult(_0x24151d,null));}})['catch'](handleError(_0x24151d,null));};exports[_0xb212('0xfa')]=function(_0x3e18b,_0x361386,_0x303280){var _0x424414;return db[_0xb212('0x47')]['find']({'where':{'id':_0x3e18b[_0xb212('0x65')]['id'],'role':_0xb212('0x38')},'attributes':['id',_0xb212('0x44'),_0xb212('0x33')]})[_0xb212('0x1d')](handleEntityNotFound(_0x361386,null))[_0xb212('0x1d')](function(_0x1d4987){if(_0x1d4987){_0x424414=_0x1d4987;return db[_0xb212('0xb9')][_0xb212('0x41')]({'where':{'membername':_0x424414['name']},'individualHooks':!![]});}})[_0xb212('0x1d')](function(){return db[_0xb212('0xf6')][_0xb212('0x61')]({'where':{'membername':_0x424414[_0xb212('0x44')],'exitAt':null}});})[_0xb212('0x1d')](function(_0x5e2ded){var _0x5a6bb3=[];_0x5e2ded['forEach'](function(_0x14b5eb){_0x5a6bb3[_0xb212('0x90')](_0x14b5eb[_0xb212('0x31')]({'exitAt':moment()[_0xb212('0xb2')](_0xb212('0xf0'))}));});return BPromise['all'](_0x5a6bb3);})['then'](function(){return _0x424414['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb212('0x1d')](respondWithResult(_0x361386,null))['catch'](handleError(_0x361386,null));};exports[_0xb212('0xfb')]=function(_0x3e98bf,_0x41ea57,_0x81e924){var _0x16f007;return db[_0xb212('0xb9')][_0xb212('0x31')]({'paused':0x1},{'where':{'UserId':_0x3e98bf[_0xb212('0x65')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x3e98bf['params']['id'],'role':_0xb212('0x38')},'attributes':['id','name',_0xb212('0x33'),_0xb212('0x6a'),_0xb212('0xa7')]});})[_0xb212('0x1d')](handleEntityNotFound(_0x41ea57,null))['then'](function(_0x8efb51){if(_0x8efb51){_0x16f007=_0x8efb51;return respondWithRpcPromise(_0xb212('0xfc'),'pause',{'id':_0x16f007['id'],'name':_0x16f007['name'],'pause':!![]});}})[_0xb212('0x1d')](function(){if(_0x16f007){return db[_0xb212('0xf6')]['findAll']({'where':{'membername':_0x16f007[_0xb212('0x44')],'type':_0xb212('0xf4'),'exitAt':null}});}})[_0xb212('0x1d')](function(_0x1ac61c){if(_0x1ac61c[_0xb212('0x54')]){var _0x542bd7=moment()[_0xb212('0xb2')](_0xb212('0xf0'));for(var _0x3a5847=0x0,_0x2de706=_0x1ac61c['length'];_0x3a5847<_0x2de706;_0x3a5847++){_0x1ac61c[_0x3a5847][_0xb212('0xfd')]({'exitAt':_0x542bd7});}}})[_0xb212('0x1d')](function(){var _0x52bf1c=[];var _0x176b70=utils[_0xb212('0xf1')]();_0x176b70[_0xb212('0xef')](function(_0x54b511){_0x52bf1c[_0xb212('0x90')]({'channel':_0x54b511,'membername':_0x16f007[_0xb212('0x44')],'interface':_['isNil'](_0x16f007[_0xb212('0xa7')])?util[_0xb212('0xb2')]('SIP/%s',_0x16f007[_0xb212('0x44')]):_0x16f007[_0xb212('0xa7')],'type':_0xb212('0xf4'),'enterAt':moment()[_0xb212('0xb2')](_0xb212('0xf0')),'data1':_0x3e98bf[_0xb212('0x64')][_0xb212('0x49')]||_0xb212('0xfe'),'role':_0x16f007['role'],'internal':_0x16f007[_0xb212('0x6a')]});});return db['MemberReport']['bulkCreate'](_0x52bf1c,{'individualHooks':!![]});})['then'](function(){return _0x16f007[_0xb212('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3e98bf['body'][_0xb212('0x49')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb212('0xb2')](_0xb212('0xf0'))});})['then'](respondWithResult(_0x41ea57,null))['catch'](handleError(_0x41ea57,null));};exports['unpause']=function(_0x1a8b0d,_0x33c64b,_0x450627){var _0x4b4b63;return db['User'][_0xb212('0x3f')]({'where':{'id':_0x1a8b0d['params']['id']},'attributes':['id',_0xb212('0x44'),_0xb212('0x33'),_0xb212('0xa6'),_0xb212('0xff'),_0xb212('0x100'),_0xb212('0x101'),_0xb212('0x102'),_0xb212('0x103'),_0xb212('0x104'),'pauseType','lastPauseAt']})[_0xb212('0x1d')](handleEntityNotFound(_0x33c64b,null))[_0xb212('0x1d')](function(_0x48c94e){if(_0x48c94e){_0x4b4b63=_0x48c94e;if(_0x1a8b0d[_0xb212('0x64')]['channel']&&!utils[_0xb212('0xa8')](_0x1a8b0d[_0xb212('0x64')]['channel'])){throw new db[(_0xb212('0x99'))][(_0xb212('0x97'))](_0xb212('0xa9'));}switch(_0x1a8b0d[_0xb212('0x64')]['channel']){case _0xb212('0xb1'):return respondWithRpcPromise('QueuePause',_0xb212('0x105'),{'id':_0x4b4b63['id'],'name':_0x4b4b63['name'],'pause':![]})[_0xb212('0x1d')](function(){return db[_0xb212('0xb9')][_0xb212('0x31')]({'paused':0x0},{'where':{'UserId':_0x4b4b63['id']},'individualHooks':!![]});})[_0xb212('0x1d')](function(){return db[_0xb212('0xf6')]['find']({'where':{'channel':_0x1a8b0d[_0xb212('0x64')][_0xb212('0xb6')],'membername':_0x4b4b63[_0xb212('0x44')],'type':'PAUSE','exitAt':null}});})[_0xb212('0x1d')](function(_0xa03420){if(_0xa03420){return _0xa03420['update']({'exitAt':moment()['format'](_0xb212('0xf0')),'data2':_0xb212('0x106')},{'individualHooks':!![]});}return null;})[_0xb212('0x1d')](function(){return _0x4b4b63[_0xb212('0x31')]({'voicePause':![]});});case _0xb212('0x107'):case'chat':case _0xb212('0x108'):case'sms':case _0xb212('0x109'):case _0xb212('0x10a'):return db[_0xb212('0xf6')][_0xb212('0x3f')]({'where':{'channel':_0x1a8b0d['body'][_0xb212('0xb6')],'membername':_0x4b4b63['name'],'type':_0xb212('0xf4'),'exitAt':null}})[_0xb212('0x1d')](function(_0x31eb9c){if(_0x31eb9c){return _0x31eb9c[_0xb212('0x31')]({'exitAt':moment()['format'](_0xb212('0xf0')),'data2':_0xb212('0x106')},{'individualHooks':!![]});}return null;})[_0xb212('0x1d')](function(){var _0x238902={};_[_0xb212('0x2e')](_0x238902,util[_0xb212('0xb2')](_0xb212('0x10b'),_0x1a8b0d[_0xb212('0x64')][_0xb212('0xb6')],'Pause'),![]);return _0x4b4b63['update'](_0x238902);});default:return respondWithRpcPromise(_0xb212('0xfc'),'unpause',{'id':_0x4b4b63['id'],'name':_0x4b4b63[_0xb212('0x44')],'pause':![]})[_0xb212('0x1d')](function(){return db[_0xb212('0xb9')][_0xb212('0x31')]({'paused':0x0},{'where':{'UserId':_0x4b4b63['id']}});})['then'](function(){return db['MemberReport'][_0xb212('0x61')]({'where':{'membername':_0x4b4b63[_0xb212('0x44')],'type':_0xb212('0xf4'),'exitAt':null}});})[_0xb212('0x1d')](function(_0x571e44){var _0x40c0c9=[];_0x571e44[_0xb212('0xef')](function(_0x20df2b){_0x40c0c9['push'](_0x20df2b['update']({'exitAt':moment()[_0xb212('0xb2')](_0xb212('0xf0')),'data2':_0xb212('0x106')}));});return BPromise[_0xb212('0x91')](_0x40c0c9);})[_0xb212('0x1d')](function(){return _0x4b4b63[_0xb212('0x31')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x33c64b,null))[_0xb212('0x27')](handleError(_0x33c64b,null));};exports[_0xb212('0x10c')]=function(_0x20e898,_0x44c89e,_0x5b468b){var _0xed4f48={};var _0x753774={};var _0x2ac7fe;var _0x566134;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x20e898['params']['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x44c89e,null))[_0xb212('0x1d')](function(_0x3d6ac6){if(_0x3d6ac6){_0x2ac7fe=_0x3d6ac6;_0x753774['model']=_['keys'](db['Team'][_0xb212('0x63')]);_0x753774[_0xb212('0x4e')]=_['keys'](_0x20e898[_0xb212('0x4e')]);_0x753774[_0xb212('0x50')]=_[_0xb212('0x51')](_0x753774['model'],_0x753774['query']);_0xed4f48[_0xb212('0x53')]=_[_0xb212('0x51')](_0x753774[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x20e898['query'][_0xb212('0x52')]));_0xed4f48['attributes']=_0xed4f48[_0xb212('0x53')]['length']?_0xed4f48[_0xb212('0x53')]:_0x753774[_0xb212('0x4b')];_0xed4f48['order']=qs[_0xb212('0xc6')](_0x20e898[_0xb212('0x4e')]['sort']);_0xed4f48[_0xb212('0x56')]=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x20e898[_0xb212('0x4e')],_0x753774['filters']));if(_0x20e898[_0xb212('0x4e')][_0xb212('0x58')]){_0xed4f48[_0xb212('0x56')]=_['merge'](_0xed4f48[_0xb212('0x56')],{'$or':_[_0xb212('0x3c')](_0xed4f48[_0xb212('0x53')],function(_0x47ea2d){var _0x45109b={};_0x45109b[_0x47ea2d]={'$like':'%'+_0x20e898[_0xb212('0x4e')]['filter']+'%'};return _0x45109b;})});}_0xed4f48=_[_0xb212('0x5d')]({},_0xed4f48,_0x20e898['options']);return _0x2ac7fe[_0xb212('0x10c')](_0xed4f48);}})['then'](function(_0x36a726){if(_0x36a726){_0x566134=_0x36a726[_0xb212('0x54')];if(!_0x20e898[_0xb212('0x4e')]['hasOwnProperty'](_0xb212('0x55'))){_0xed4f48['limit']=qs[_0xb212('0x2d')](_0x20e898[_0xb212('0x4e')][_0xb212('0x2d')]);_0xed4f48[_0xb212('0x2c')]=qs[_0xb212('0x2c')](_0x20e898[_0xb212('0x4e')]['offset']);}return _0x2ac7fe[_0xb212('0x10c')](_0xed4f48);}})[_0xb212('0x1d')](function(_0x41c299){if(_0x41c299){return _0x41c299?{'count':_0x566134,'rows':_0x41c299}:null;}})[_0xb212('0x1d')](respondWithResult(_0x44c89e,null))[_0xb212('0x27')](handleError(_0x44c89e,null));};exports[_0xb212('0x10d')]=function(_0x483489,_0x2f2a0b){return db[_0xb212('0x47')][_0xb212('0x3f')]({'where':{'id':_0x483489[_0xb212('0x65')]['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x2f2a0b,null))[_0xb212('0x1d')](function(_0x110196){if(_0x110196){var _0x55c410=_0x110196[_0xb212('0x32')]({'plain':!![]});return _0x110196[_0xb212('0x10d')](_0x483489[_0xb212('0x64')]['ids'],_['omit'](_0x483489[_0xb212('0x64')],[_0xb212('0x69'),'id'])||{})['then'](function(){for(var _0xd862a=0x0;_0xd862a<_0x483489[_0xb212('0x64')]['ids'][_0xb212('0x54')];_0xd862a++){var _0x1cbaa2=[];db[_0xb212('0x10e')][_0xb212('0x9d')]({'where':{'id':_0x483489['body']['ids'][_0xd862a]}})[_0xb212('0x1d')](function(_0x1e7147){_0x1cbaa2['push'](_0x1e7147['getVoiceQueues']()[_0xb212('0x1d')](function(_0x3c3baf){for(var _0x26bc59=0x0;_0x26bc59<_0x3c3baf[_0xb212('0x54')];_0x26bc59++){_0x3c3baf[_0x26bc59][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x110'));}return _0x3c3baf;}));_0x1cbaa2['push'](_0x1e7147[_0xb212('0x111')]()[_0xb212('0x1d')](function(_0x33d907){for(var _0x57bfc1=0x0;_0x57bfc1<_0x33d907[_0xb212('0x54')];_0x57bfc1++){_0x33d907[_0x57bfc1][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x112'));}return _0x33d907;}));_0x1cbaa2['push'](_0x1e7147[_0xb212('0x113')]()[_0xb212('0x1d')](function(_0x577a07){for(var _0x412d00=0x0;_0x412d00<_0x577a07[_0xb212('0x54')];_0x412d00++){_0x577a07[_0x412d00][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x114'));}return _0x577a07;}));_0x1cbaa2[_0xb212('0x90')](_0x1e7147['getSmsQueues']()[_0xb212('0x1d')](function(_0xaf0e49){for(var _0x46b073=0x0;_0x46b073<_0xaf0e49[_0xb212('0x54')];_0x46b073++){_0xaf0e49[_0x46b073][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x115'));}return _0xaf0e49;}));_0x1cbaa2['push'](_0x1e7147[_0xb212('0x116')]()[_0xb212('0x1d')](function(_0x4725c2){for(var _0x177f51=0x0;_0x177f51<_0x4725c2['length'];_0x177f51++){_0x4725c2[_0x177f51]['setDataValue'](_0xb212('0xb6'),_0xb212('0x117'));}return _0x4725c2;}));_0x1cbaa2[_0xb212('0x90')](_0x1e7147[_0xb212('0x118')]()[_0xb212('0x1d')](function(_0x11ca7b){for(var _0x5b8c6d=0x0;_0x5b8c6d<_0x11ca7b[_0xb212('0x54')];_0x5b8c6d++){_0x11ca7b[_0x5b8c6d][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x119'));}return _0x11ca7b;}));_0x1cbaa2[_0xb212('0x90')](_0x1e7147[_0xb212('0x11a')]()['then'](function(_0x251869){for(var _0x27e784=0x0;_0x27e784<_0x251869[_0xb212('0x54')];_0x27e784++){_0x251869[_0x27e784][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x11b'));}return _0x251869;}));return BPromise[_0xb212('0x91')](_0x1cbaa2);})['then'](function(_0x12d984){var _0x5cd8cc=_[_0xb212('0x11c')](_0x12d984);_0x1cbaa2=[];return db[_0xb212('0x5a')][_0xb212('0x11d')](function(_0x411d59){for(var _0x4c1294=0x0;_0x4c1294<_0x5cd8cc[_0xb212('0x54')];_0x4c1294++){_0x1cbaa2[_0xb212('0x90')](_0x5cd8cc[_0x4c1294][_0xb212('0x11e')](_0x55c410['id']),{'transaction':_0x411d59});}return BPromise[_0xb212('0x91')](_0x1cbaa2)[_0xb212('0x1d')](function(){if(_0x55c410[_0xb212('0xa5')]){return BPromise[_0xb212('0x92')](_[_0xb212('0x58')](_0x5cd8cc,function(_0x58d759){return _0x58d759['getDataValue'](_0xb212('0xb6'))===_0xb212('0x110');}),function(_0x40397c){return db[_0xb212('0xb9')]['upsert']({'membername':_0x55c410['name'],'UserId':_0x55c410['id'],'queue_name':_0x40397c[_0xb212('0x44')],'VoiceQueueId':_0x40397c['id'],'interface':_[_0xb212('0x6e')](_0x55c410[_0xb212('0xa7')])?util[_0xb212('0xb2')]('SIP/%s',_0x55c410[_0xb212('0x44')]):_0x55c410[_0xb212('0xa7')],'paused':_0x55c410[_0xb212('0xa6')]||![],'penalty':_0x55c410[_0xb212('0x11f')]},{'transaction':_0x411d59});});}else{return;}})['then'](function(){for(var _0x2ce52e=0x0;_0x2ce52e<_0x5cd8cc[_0xb212('0x54')];_0x2ce52e++){var _0x1c5361=_0x5cd8cc[_0x2ce52e]['getDataValue']('channel');var _0x284143=_0x1c5361+_0xb212('0xae');socket[_0xb212('0xaf')](_0xb212('0x36')+_0x1c5361+'Queue:save',{'UserId':_0x55c410['id'],['queueField']:_0x5cd8cc[_0x2ce52e]['id']});}});});});}});}})[_0xb212('0x1d')](respondWithStatusCode(_0x2f2a0b,null))['catch'](handleError(_0x2f2a0b,null));};exports['removeTeams']=function(_0x2fa846,_0x280e87){return db['User']['findOne']({'where':{'id':_0x2fa846[_0xb212('0x65')]['id']}})['then'](handleEntityNotFound(_0x280e87,null))[_0xb212('0x1d')](function(_0x5765a7){if(_0x5765a7){var _0x54107d=_0x5765a7[_0xb212('0x32')]({'plain':!![]});var _0x23d4e5=_0x2fa846[_0xb212('0x4e')]['ids'];return _0x5765a7[_0xb212('0x120')](_0x23d4e5)[_0xb212('0x1d')](function(){for(var _0x1fd3b9=0x0;_0x1fd3b9<_0x23d4e5[_0xb212('0x54')];_0x1fd3b9++){var _0xcb4a82=[];db[_0xb212('0x10e')][_0xb212('0x9d')]({'where':{'id':_0x23d4e5[_0x1fd3b9]}})[_0xb212('0x1d')](function(_0x3c60c0){_0xcb4a82[_0xb212('0x90')](_0x3c60c0[_0xb212('0xed')]()['then'](function(_0x5cf180){for(var _0x17a55c=0x0;_0x17a55c<_0x5cf180[_0xb212('0x54')];_0x17a55c++){_0x5cf180[_0x17a55c][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x110'));}return _0x5cf180;}));_0xcb4a82[_0xb212('0x90')](_0x3c60c0[_0xb212('0x111')]()[_0xb212('0x1d')](function(_0x249419){for(var _0x226101=0x0;_0x226101<_0x249419['length'];_0x226101++){_0x249419[_0x226101]['setDataValue']('channel',_0xb212('0x112'));}return _0x249419;}));_0xcb4a82[_0xb212('0x90')](_0x3c60c0[_0xb212('0x113')]()[_0xb212('0x1d')](function(_0x26bf26){for(var _0x2225c0=0x0;_0x2225c0<_0x26bf26[_0xb212('0x54')];_0x2225c0++){_0x26bf26[_0x2225c0][_0xb212('0x10f')](_0xb212('0xb6'),'Mail');}return _0x26bf26;}));_0xcb4a82[_0xb212('0x90')](_0x3c60c0['getSmsQueues']()[_0xb212('0x1d')](function(_0x2b1505){for(var _0x5aeda2=0x0;_0x5aeda2<_0x2b1505[_0xb212('0x54')];_0x5aeda2++){_0x2b1505[_0x5aeda2][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x115'));}return _0x2b1505;}));_0xcb4a82[_0xb212('0x90')](_0x3c60c0[_0xb212('0x116')]()[_0xb212('0x1d')](function(_0x351c30){for(var _0x13eb88=0x0;_0x13eb88<_0x351c30[_0xb212('0x54')];_0x13eb88++){_0x351c30[_0x13eb88][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x117'));}return _0x351c30;}));_0xcb4a82[_0xb212('0x90')](_0x3c60c0['getFaxQueues']()[_0xb212('0x1d')](function(_0x4d05c2){for(var _0x3bfc3d=0x0;_0x3bfc3d<_0x4d05c2[_0xb212('0x54')];_0x3bfc3d++){_0x4d05c2[_0x3bfc3d][_0xb212('0x10f')](_0xb212('0xb6'),'Fax');}return _0x4d05c2;}));_0xcb4a82['push'](_0x3c60c0['getOpenchannelQueues']()[_0xb212('0x1d')](function(_0x45f51a){for(var _0x1c1363=0x0;_0x1c1363<_0x45f51a[_0xb212('0x54')];_0x1c1363++){_0x45f51a[_0x1c1363][_0xb212('0x10f')](_0xb212('0xb6'),_0xb212('0x11b'));}return _0x45f51a;}));return BPromise[_0xb212('0x91')](_0xcb4a82);})[_0xb212('0x1d')](function(_0x51de87){var _0x4e39f9=_['flatten'](_0x51de87);_0xcb4a82=[];return db[_0xb212('0x5a')][_0xb212('0x11d')](function(_0x35cd3a){for(var _0xb2991b=0x0;_0xb2991b<_0x4e39f9[_0xb212('0x54')];_0xb2991b++){_0xcb4a82['push'](_0x4e39f9[_0xb2991b][_0xb212('0x121')](_0x54107d['id']),{'transaction':_0x35cd3a});}return BPromise[_0xb212('0x91')](_0xcb4a82)[_0xb212('0x1d')](function(){if(_0x54107d[_0xb212('0xa5')]){return BPromise['each'](_[_0xb212('0x58')](_0x4e39f9,function(_0x294b83){return _0x294b83[_0xb212('0x122')](_0xb212('0xb6'))==='Voice';}),function(_0x33cfe7){return db[_0xb212('0xb9')][_0xb212('0x41')]({'where':{'VoiceQueueId':_0x33cfe7['id'],'UserId':_0x54107d['id']},'transaction':_0x35cd3a});});}else{return;}})[_0xb212('0x1d')](function(){for(var _0x19f248=0x0;_0x19f248<_0x4e39f9[_0xb212('0x54')];_0x19f248++){var _0x51422a=_0x4e39f9[_0x19f248][_0xb212('0x122')](_0xb212('0xb6'));var _0x262fdc=_0x51422a+_0xb212('0xae');socket['emit'](_0xb212('0x36')+_0x51422a+_0xb212('0xb8'),{'UserId':_0x54107d['id'],['queueField']:_0x4e39f9[_0x19f248]['id']});}});});});}});}})[_0xb212('0x1d')](respondWithStatusCode(_0x280e87,null))['catch'](handleError(_0x280e87,null));};exports['getLists']=function(_0x9b23af,_0x43080e,_0xd3ca5b){var _0x955f8e={};var _0x2ac2a9={};var _0x1b4aa0;var _0x4093e7;return db[_0xb212('0x47')][_0xb212('0x9d')]({'where':{'id':_0x9b23af['params']['id']}})[_0xb212('0x1d')](handleEntityNotFound(_0x43080e,null))[_0xb212('0x1d')](function(_0x3f3aa8){if(_0x3f3aa8){_0x1b4aa0=_0x3f3aa8;_0x2ac2a9[_0xb212('0x4b')]=_[_0xb212('0x4f')](db['CmList'][_0xb212('0x63')]);_0x2ac2a9[_0xb212('0x4e')]=_[_0xb212('0x4f')](_0x9b23af[_0xb212('0x4e')]);_0x2ac2a9[_0xb212('0x50')]=_['intersection'](_0x2ac2a9['model'],_0x2ac2a9[_0xb212('0x4e')]);_0x955f8e[_0xb212('0x53')]=_[_0xb212('0x51')](_0x2ac2a9['model'],qs[_0xb212('0x52')](_0x9b23af[_0xb212('0x4e')]['fields']));_0x955f8e[_0xb212('0x53')]=_0x955f8e['attributes'][_0xb212('0x54')]?_0x955f8e['attributes']:_0x2ac2a9[_0xb212('0x4b')];_0x955f8e['order']=qs[_0xb212('0xc6')](_0x9b23af[_0xb212('0x4e')][_0xb212('0xc6')]);_0x955f8e[_0xb212('0x56')]=qs[_0xb212('0x50')](_['pick'](_0x9b23af[_0xb212('0x4e')],_0x2ac2a9[_0xb212('0x50')]));if(_0x9b23af[_0xb212('0x4e')][_0xb212('0x58')]){_0x955f8e[_0xb212('0x56')]=_['merge'](_0x955f8e[_0xb212('0x56')],{'$or':_['map'](_0x955f8e[_0xb212('0x53')],function(_0x4ac5fd){var _0xe87735={};_0xe87735[_0x4ac5fd]={'$like':'%'+_0x9b23af['query']['filter']+'%'};return _0xe87735;})});}_0x955f8e=_['merge']({},_0x955f8e,_0x9b23af['options']);return _0x1b4aa0[_0xb212('0x123')](_0x955f8e);}})[_0xb212('0x1d')](function(_0x59532d){if(_0x59532d){_0x4093e7=_0x59532d[_0xb212('0x54')];if(!_0x9b23af[_0xb212('0x4e')][_0xb212('0xc8')]('nolimit')){_0x955f8e[_0xb212('0x2d')]=qs[_0xb212('0x2d')](_0x9b23af[_0xb212('0x4e')][_0xb212('0x2d')]);_0x955f8e['offset']=qs[_0xb212('0x2c')](_0x9b23af[_0xb212('0x4e')][_0xb212('0x2c')]);}return _0x1b4aa0[_0xb212('0x123')](_0x955f8e);}})[_0xb212('0x1d')](function(_0x448e2c){if(_0x448e2c){return _0x448e2c?{'count':_0x4093e7,'rows':_0x448e2c}:null;}})[_0xb212('0x1d')](respondWithResult(_0x43080e,null))[_0xb212('0x27')](handleError(_0x43080e,null));};exports[_0xb212('0x124')]=function(_0x7d8a0d,_0x399224,_0x3ce8ac){var _0x5b74c4={};var _0x50d361={};var _0x1e2eb9;var _0x51604e;return db[_0xb212('0x47')]['findOne']({'where':{'id':_0x7d8a0d[_0xb212('0x65')]['id']}})['then'](handleEntityNotFound(_0x399224,null))['then'](function(_0x32e2df){if(_0x32e2df){_0x1e2eb9=_0x32e2df;_0x50d361[_0xb212('0x4b')]=_[_0xb212('0x4f')](db[_0xb212('0x47')]['rawAttributes']);_0x50d361[_0xb212('0x4e')]=_['keys'](_0x7d8a0d['query']);_0x50d361[_0xb212('0x50')]=_[_0xb212('0x51')](_0x50d361[_0xb212('0x4b')],_0x50d361[_0xb212('0x4e')]);_0x5b74c4['attributes']=_[_0xb212('0x51')](_0x50d361[_0xb212('0x4b')],qs[_0xb212('0x52')](_0x7d8a0d[_0xb212('0x4e')][_0xb212('0x52')]));_0x5b74c4[_0xb212('0x53')]=_0x5b74c4['attributes'][_0xb212('0x54')]?_0x5b74c4[_0xb212('0x53')]:_0x50d361[_0xb212('0x4b')];_0x5b74c4['order']=qs['sort'](_0x7d8a0d['query'][_0xb212('0xc6')]);_0x5b74c4['where']=qs[_0xb212('0x50')](_[_0xb212('0x57')](_0x7d8a0d[_0xb212('0x4e')],_0x50d361[_0xb212('0x50')]));if(_0x7d8a0d[_0xb212('0x4e')][_0xb212('0x58')]){_0x5b74c4['where']=_[_0xb212('0x5d')](_0x5b74c4[_0xb212('0x56')],{'$or':_['map'](_0x5b74c4[_0xb212('0x53')],function(_0x53c527){var _0x2b4f67={};_0x2b4f67[_0x53c527]={'$like':'%'+_0x7d8a0d[_0xb212('0x4e')]['filter']+'%'};return _0x2b4f67;})});}_0x5b74c4[_0xb212('0x4b')]=db[_0xb212('0x47')];_0x5b74c4['as']='Agents';_0x5b74c4=_[_0xb212('0x5d')]({},_0x5b74c4,_0x7d8a0d[_0xb212('0x5e')]);return _0x1e2eb9[_0xb212('0xed')]({'include':[_0x5b74c4]});}})[_0xb212('0x1d')](function(_0x30bd19){if(_0x30bd19){var _0x752318={},_0x359d4f=[],_0x4abccc=0x0;for(var _0x59d2d0=0x0;_0x59d2d0<_0x30bd19[_0xb212('0x54')];_0x59d2d0+=0x1){for(var _0x172a07=0x0,_0x182721;_0x172a07<_0x30bd19[_0x59d2d0]['Agents'][_0xb212('0x54')];_0x172a07+=0x1){_0x182721=_0x30bd19[_0x59d2d0]['Agents'][_0x172a07][_0xb212('0x32')]({'plain':!![]});_0x752318[_0x182721['id']]=_0x182721;}}_0x752318=_['values'](_0x752318);for(var _0x4ec65c=qs[_0xb212('0x2c')](_0x7d8a0d['query'][_0xb212('0x2c')]);_0x4ec65c<_0x752318[_0xb212('0x54')]&&_0x359d4f[_0xb212('0x54')]=_0x14231a['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x4c426a){return db[_0x458a('0x2d')]['destroy']({'where':{'membername':_0x4c426a[_0x458a('0x2f')]},'individualHooks':!![]});}})[_0x458a('0x11')](function(){if(_0x4c426a){return _0x4c426a[_0x458a('0x55')]({'raw':!![]});}})[_0x458a('0x11')](function(_0x259e54){if(_0x4c426a){if(_0x259e54){var _0x2246e9=[];_0x120b8e=_0x259e54;if(_0x120b8e[_0x458a('0x31')]){for(var _0x49f3ee=0x0;_0x49f3ee<_0x120b8e[_0x458a('0x31')];_0x49f3ee++){_0x2246e9[_0x458a('0x36')](db['UserVoiceQueueRt'][_0x458a('0x56')]({'membername':_0x4c426a['name'],'UserId':_0x4c426a['id'],'queue_name':_0x120b8e[_0x49f3ee][_0x458a('0x2f')],'VoiceQueueId':_0x120b8e[_0x49f3ee]['id'],'interface':_0x10dde3,'paused':_0x4c426a['loginInPause']||![],'penalty':_0x120b8e[_0x49f3ee][_0x458a('0x57')]||0x0}));}return BPromise[_0x458a('0x4a')](_0x2246e9);}}}})[_0x458a('0x11')](function(){if(_0x4c426a){return db[_0x458a('0x46')]['findAll']({'where':{'membername':_0x4c426a[_0x458a('0x2f')],'exitAt':null}});}})[_0x458a('0x11')](function(_0x3de0c5){if(_0x4c426a){if(_0x3de0c5&&_0x3de0c5[_0x458a('0x31')]){var _0x18fb71=[];_0x3de0c5[_0x458a('0x35')](function(_0x246c7b){_0x18fb71[_0x458a('0x36')](_0x246c7b['update']({'exitAt':moment()[_0x458a('0x32')](_0x458a('0x33'))}));});return BPromise[_0x458a('0x4a')](_0x18fb71);}}})[_0x458a('0x11')](function(_0x591dbb){if(_0x4c426a){var _0x353025=[];var _0x45569b=[];var _0x579352=utils[_0x458a('0x34')]();var _0x110801={'membername':_0x4c426a[_0x458a('0x2f')],'interface':_0x10dde3,'enterAt':moment()[_0x458a('0x32')](_0x458a('0x33')),'role':_0x4c426a['role'],'internal':_0x4c426a[_0x458a('0x2b')]};_0x579352[_0x458a('0x35')](function(_0x2ba226){_0x353025[_0x458a('0x36')](_[_0x458a('0x58')]({'channel':_0x2ba226,'type':_0x458a('0x59'),'data1':_0x458a('0x5a'),'data2':_0x10dde3},_0x110801));if(_0x4c426a['loginInPause']){_0x45569b[_0x458a('0x36')](_['merge']({'channel':_0x2ba226,'type':_0x458a('0x30'),'data1':_0x458a('0x5b')},_0x110801));}});return db[_0x458a('0x46')]['bulkCreate'](_0x353025[_0x458a('0x5c')](_0x45569b),{'individualHooks':!![]});}})['then'](function(){if(_0x4c426a){return _0x4c426a['update']({'online':!![],'lastLoginAt':moment()[_0x458a('0x32')](_0x458a('0x33')),'voicePause':_0x4c426a['loginInPause']||![],'mailPause':_0x4c426a['loginInPause']||![],'chatPause':_0x4c426a[_0x458a('0x4f')]||![],'faxPause':_0x4c426a[_0x458a('0x4f')]||![],'smsPause':_0x4c426a[_0x458a('0x4f')]||![],'openchannelPause':_0x4c426a[_0x458a('0x4f')]||![],'pauseType':_0x4c426a[_0x458a('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x458a('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x10dde3});}})[_0x458a('0x11')](function(_0xb4c7ef){_0x3948aa(_0xb4c7ef);})[_0x458a('0x19')](function(_0x54adb7){_0x2c131b(_0x435884[_0x458a('0x16')](0x1f4,_0x54adb7[_0x458a('0x17')]));});});}; \ No newline at end of file +var _0xa664=['updateAttributes','getChannels','forEach','push','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','update','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','findOne','channel','isValidChannel','mail','chat','fax','sms','whatsapp','system','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','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','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetUser','ShowUser','User','find','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','format'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xa664,0x132));var _0x4a66=function(_0x10f927,_0x5496b0){_0x10f927=_0x10f927-0x0;var _0x5af6a0=_0xa664[_0x10f927];return _0x5af6a0;};'use strict';var _=require('lodash');var util=require(_0x4a66('0x0'));var moment=require(_0x4a66('0x1'));var BPromise=require(_0x4a66('0x2'));var rs=require(_0x4a66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a66('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a66('0x5'));var config=require(_0x4a66('0x6'));var jayson=require(_0x4a66('0x7'));var client=jayson[_0x4a66('0x8')][_0x4a66('0x9')]({'port':0x232a});config[_0x4a66('0xa')]=_[_0x4a66('0xb')](config['redis'],{'host':_0x4a66('0xc'),'port':0x18eb});var socket=require(_0x4a66('0xd'))(new Redis(config[_0x4a66('0xa')]));require(_0x4a66('0xe'))['register'](socket);function respondWithRpcPromise(_0x1f553d,_0x124ed0,_0x5b7ccd){return new BPromise(function(_0x11b0b7,_0x33430f){return client[_0x4a66('0xf')](_0x1f553d,_0x5b7ccd)[_0x4a66('0x10')](function(_0x2bebf3){logger[_0x4a66('0x11')](_0x4a66('0x12'),_0x124ed0,_0x4a66('0x13'));logger[_0x4a66('0x14')](_0x4a66('0x15'),_0x124ed0,_0x4a66('0x13'),JSON[_0x4a66('0x16')](_0x2bebf3));if(_0x2bebf3[_0x4a66('0x17')]){if(_0x2bebf3[_0x4a66('0x17')][_0x4a66('0x18')]===0x1f4){logger[_0x4a66('0x17')](_0x4a66('0x12'),_0x124ed0,_0x2bebf3['error'][_0x4a66('0x19')]);return _0x33430f(_0x2bebf3[_0x4a66('0x17')][_0x4a66('0x19')]);}logger[_0x4a66('0x17')](_0x4a66('0x12'),_0x124ed0,_0x2bebf3[_0x4a66('0x17')][_0x4a66('0x19')]);return _0x11b0b7(_0x2bebf3[_0x4a66('0x17')]['message']);}else{logger[_0x4a66('0x11')](_0x4a66('0x12'),_0x124ed0,_0x4a66('0x13'));_0x11b0b7(_0x2bebf3[_0x4a66('0x1a')]['message']);}})[_0x4a66('0x1b')](function(_0x398374){logger[_0x4a66('0x17')]('User,\x20%s,\x20%s',_0x124ed0,_0x398374);_0x33430f(_0x398374);});});}exports['GetUser']=function(_0x1e01b8){var _0x83a690=this;return new Promise(function(_0x25fb2c,_0x4c78e1){return db['User'][_0x4a66('0x1c')]({'raw':_0x1e01b8[_0x4a66('0x1d')]?_0x1e01b8[_0x4a66('0x1d')][_0x4a66('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e01b8[_0x4a66('0x1d')]?_0x1e01b8[_0x4a66('0x1d')][_0x4a66('0x1f')]||null:null,'attributes':_0x1e01b8[_0x4a66('0x1d')]?_0x1e01b8[_0x4a66('0x1d')][_0x4a66('0x20')]||null:null,'limit':_0x1e01b8[_0x4a66('0x1d')]?_0x1e01b8[_0x4a66('0x1d')][_0x4a66('0x21')]||null:null,'include':_0x1e01b8[_0x4a66('0x1d')]?_0x1e01b8[_0x4a66('0x1d')][_0x4a66('0x22')]?_[_0x4a66('0x23')](_0x1e01b8['options'][_0x4a66('0x22')],function(_0x4d58c){return{'model':db[_0x4d58c['model']],'as':_0x4d58c['as'],'attributes':_0x4d58c[_0x4a66('0x20')],'include':_0x4d58c[_0x4a66('0x22')]?_[_0x4a66('0x23')](_0x4d58c[_0x4a66('0x22')],function(_0x3260d4){return{'model':db[_0x3260d4['model']],'as':_0x3260d4['as'],'attributes':_0x3260d4['attributes'],'include':_0x3260d4[_0x4a66('0x22')]?_[_0x4a66('0x23')](_0x3260d4[_0x4a66('0x22')],function(_0x257485){return{'model':db[_0x257485[_0x4a66('0x24')]],'as':_0x257485['as'],'attributes':_0x257485[_0x4a66('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4a66('0x10')](function(_0x32bd79){logger[_0x4a66('0x11')](_0x4a66('0x25'),_0x1e01b8);logger[_0x4a66('0x14')](_0x4a66('0x25'),_0x1e01b8,JSON['stringify'](_0x32bd79));_0x25fb2c(_0x32bd79);})['catch'](function(_0xc6938d){logger['error'](_0x4a66('0x25'),_0xc6938d[_0x4a66('0x19')],_0x1e01b8);_0x4c78e1(_0x83a690[_0x4a66('0x17')](0x1f4,_0xc6938d[_0x4a66('0x19')]));});});};exports['ShowUser']=function(_0x1fc788){var _0xe56dc=this;return new Promise(function(_0x33e098,_0x2acf4d){return db['User']['find']({'raw':_0x1fc788[_0x4a66('0x1d')]?_0x1fc788[_0x4a66('0x1d')][_0x4a66('0x1e')]===undefined?!![]:![]:!![],'where':_0x1fc788[_0x4a66('0x1d')]?_0x1fc788[_0x4a66('0x1d')][_0x4a66('0x1f')]||null:null,'attributes':_0x1fc788[_0x4a66('0x1d')]?_0x1fc788[_0x4a66('0x1d')][_0x4a66('0x20')]||null:null,'include':_0x1fc788[_0x4a66('0x1d')]?_0x1fc788['options']['include']?_['map'](_0x1fc788[_0x4a66('0x1d')][_0x4a66('0x22')],function(_0x46177a){return{'model':db[_0x46177a[_0x4a66('0x24')]],'as':_0x46177a['as'],'attributes':_0x46177a[_0x4a66('0x20')],'include':_0x46177a['include']?_[_0x4a66('0x23')](_0x46177a['include'],function(_0x48de00){return{'model':db[_0x48de00[_0x4a66('0x24')]],'as':_0x48de00['as'],'attributes':_0x48de00[_0x4a66('0x20')],'include':_0x48de00[_0x4a66('0x22')]?_[_0x4a66('0x23')](_0x48de00['include'],function(_0x1ef7ff){return{'model':db[_0x1ef7ff['model']],'as':_0x1ef7ff['as'],'attributes':_0x1ef7ff[_0x4a66('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4a66('0x10')](function(_0x3252c9){logger[_0x4a66('0x11')](_0x4a66('0x26'),_0x1fc788);logger[_0x4a66('0x14')](_0x4a66('0x26'),_0x1fc788,JSON[_0x4a66('0x16')](_0x3252c9));_0x33e098(_0x3252c9);})[_0x4a66('0x1b')](function(_0x3a3703){logger[_0x4a66('0x17')](_0x4a66('0x26'),_0x3a3703[_0x4a66('0x19')],_0x1fc788);_0x2acf4d(_0xe56dc[_0x4a66('0x17')](0x1f4,_0x3a3703[_0x4a66('0x19')]));});});};exports['PauseUser']=function(_0x58088f){var _0x1effa9=this;return new Promise(function(_0x106de8,_0xe1baeb){var _0x756cae;return db[_0x4a66('0x27')][_0x4a66('0x28')]({'where':_0x58088f[_0x4a66('0x1d')][_0x4a66('0x1f')]||{},'attributes':['id',_0x4a66('0x29'),_0x4a66('0x2a'),_0x4a66('0x2b'),_0x4a66('0x2c')]})[_0x4a66('0x10')](function(_0x113cc3){if(_0x113cc3){_0x756cae=_0x113cc3;return db[_0x4a66('0x2d')]['update']({'paused':0x1},{'where':{'UserId':_0x756cae['id']},'individualHooks':!![]});}})[_0x4a66('0x10')](function(){if(_0x756cae){return db[_0x4a66('0x2e')]['findAll']({'where':{'membername':_0x756cae[_0x4a66('0x29')],'type':_0x4a66('0x2f'),'exitAt':null}});}})[_0x4a66('0x10')](function(_0x5cc69d){if(_0x756cae){if(_0x5cc69d&&_0x5cc69d[_0x4a66('0x30')]){var _0x147be9=moment()[_0x4a66('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3bd9f7=0x0,_0x106cf1=_0x5cc69d['length'];_0x3bd9f7<_0x106cf1;_0x3bd9f7++){_0x5cc69d[_0x3bd9f7][_0x4a66('0x32')]({'exitAt':_0x147be9});}}}})['then'](function(){if(_0x756cae){var _0xb1c357=[];var _0x51be62=utils[_0x4a66('0x33')]();_0x51be62[_0x4a66('0x34')](function(_0x2689d5){_0xb1c357[_0x4a66('0x35')]({'channel':_0x2689d5,'membername':_0x756cae[_0x4a66('0x29')],'interface':_['isNil'](_0x756cae['interface'])?util[_0x4a66('0x31')](_0x4a66('0x36'),_0x756cae[_0x4a66('0x29')]):_0x756cae[_0x4a66('0x2c')],'type':_0x4a66('0x2f'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x58088f[_0x4a66('0x37')][_0x4a66('0x38')]||_0x4a66('0x39'),'role':_0x756cae['role'],'internal':_0x756cae[_0x4a66('0x2b')],'uniqueid':_0x58088f['body']['uniqueid']||null});});return db[_0x4a66('0x2e')][_0x4a66('0x3a')](_0xb1c357,{'individualHooks':!![]});}})['then'](function(){if(_0x756cae){return _0x756cae[_0x4a66('0x3b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x58088f[_0x4a66('0x37')]['type']||_0x4a66('0x39'),'lastPauseAt':moment()[_0x4a66('0x31')](_0x4a66('0x3c'))});}})[_0x4a66('0x10')](function(_0x46b9e7){_0x106de8(_0x46b9e7);})['catch'](function(_0x2a72dc){_0xe1baeb(_0x1effa9[_0x4a66('0x17')](0x1f4,_0x2a72dc[_0x4a66('0x19')]));});});};exports[_0x4a66('0x3d')]=function(_0xb573bf){var _0x2adcaf=this;return new Promise(function(_0x29d823,_0x3636b8){var _0x1fc0f8;return db[_0x4a66('0x27')][_0x4a66('0x3e')]({'where':_0xb573bf[_0x4a66('0x1d')][_0x4a66('0x1f')]||{},'attributes':['id','name']})['then'](function(_0x1a7abe){if(_0x1a7abe){_0x1fc0f8=_0x1a7abe;if(_0xb573bf[_0x4a66('0x37')][_0x4a66('0x3f')]&&!utils[_0x4a66('0x40')](_0xb573bf[_0x4a66('0x37')][_0x4a66('0x3f')])){throw new Error('Unknown\x20channel');}switch(_0xb573bf[_0x4a66('0x37')][_0x4a66('0x3f')]){case'voice':return db[_0x4a66('0x2d')][_0x4a66('0x3b')]({'paused':0x0},{'where':{'UserId':_0x1fc0f8['id']}})['then'](function(){return db[_0x4a66('0x2e')]['find']({'where':{'channel':_0xb573bf[_0x4a66('0x37')]['channel'],'membername':_0x1fc0f8['name'],'type':_0x4a66('0x2f'),'exitAt':null}});})[_0x4a66('0x10')](function(_0x4c83b8){if(_0x4c83b8){return _0x4c83b8['update']({'exitAt':moment()[_0x4a66('0x31')](_0x4a66('0x3c')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x4a66('0x10')](function(){return _0x1fc0f8[_0x4a66('0x3b')]({'voicePause':![]});});case _0x4a66('0x41'):case _0x4a66('0x42'):case _0x4a66('0x43'):case _0x4a66('0x44'):case'openchannel':case _0x4a66('0x45'):return db[_0x4a66('0x2e')][_0x4a66('0x28')]({'where':{'channel':_0xb573bf[_0x4a66('0x37')][_0x4a66('0x3f')],'membername':_0x1fc0f8['name'],'type':_0x4a66('0x2f'),'exitAt':null}})[_0x4a66('0x10')](function(_0x1df8a0){return _0x1df8a0[_0x4a66('0x3b')]({'exitAt':moment()['format'](_0x4a66('0x3c')),'data2':_0x4a66('0x46')},{'individualHooks':!![]});})[_0x4a66('0x10')](function(){var _0x12ec1e={};_['set'](_0x12ec1e,util[_0x4a66('0x31')](_0x4a66('0x47'),_0xb573bf[_0x4a66('0x37')][_0x4a66('0x3f')],_0x4a66('0x48')),![]);return _0x1fc0f8[_0x4a66('0x3b')](_0x12ec1e);});default:return db[_0x4a66('0x2d')][_0x4a66('0x3b')]({'paused':0x0},{'where':{'UserId':_0x1fc0f8['id']}})['then'](function(){return db[_0x4a66('0x2e')][_0x4a66('0x1c')]({'where':{'membername':_0x1fc0f8[_0x4a66('0x29')],'type':_0x4a66('0x2f'),'exitAt':null}});})[_0x4a66('0x10')](function(_0x2fb369){var _0x5241aa=[];_0x2fb369[_0x4a66('0x34')](function(_0x9ce558){_0x5241aa['push'](_0x9ce558['update']({'exitAt':moment()['format'](_0x4a66('0x3c')),'data2':_0x4a66('0x46')}));});return BPromise[_0x4a66('0x49')](_0x5241aa);})[_0x4a66('0x10')](function(){return _0x1fc0f8[_0x4a66('0x3b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x2692db){_0x29d823(_0x2692db);})[_0x4a66('0x1b')](function(_0x4bc9db){_0x3636b8(_0x2adcaf[_0x4a66('0x17')](0x1f4,_0x4bc9db[_0x4a66('0x19')]));});});};exports[_0x4a66('0x4a')]=function(_0x87a543){var _0x463c15=this;return new Promise(function(_0x577554,_0xc01192){var _0xf1aad;return db[_0x4a66('0x27')][_0x4a66('0x3e')]({'where':_0x87a543['options']['where']||{},'attributes':['id',_0x4a66('0x29')]})[_0x4a66('0x10')](function(_0x4157db){if(_0x4157db){_0xf1aad=_0x4157db;return db[_0x4a66('0x2d')][_0x4a66('0x4b')]({'where':{'membername':_0xf1aad['name']},'individualHooks':!![]});}})['then'](function(){if(_0xf1aad){return db[_0x4a66('0x2e')][_0x4a66('0x1c')]({'where':{'membername':_0xf1aad[_0x4a66('0x29')],'exitAt':null}});}})[_0x4a66('0x10')](function(_0x5f0a9b){if(_0xf1aad){if(_0x5f0a9b&&_0x5f0a9b[_0x4a66('0x30')]){var _0x35de1c=[];_0x5f0a9b[_0x4a66('0x34')](function(_0x14c77e){_0x35de1c[_0x4a66('0x35')](_0x14c77e[_0x4a66('0x3b')]({'exitAt':moment()[_0x4a66('0x31')](_0x4a66('0x3c'))}));});return BPromise[_0x4a66('0x49')](_0x35de1c);}}})[_0x4a66('0x10')](function(){if(_0xf1aad){return _0xf1aad[_0x4a66('0x3b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4a66('0x10')](function(_0x2c8c0a){_0x577554(_0x2c8c0a);})[_0x4a66('0x1b')](function(_0x204778){_0xc01192(_0x463c15[_0x4a66('0x17')](0x1f4,_0x204778[_0x4a66('0x19')]));});});};exports[_0x4a66('0x4c')]=function(_0x28947b){var _0x576445=this;return new Promise(function(_0x3faea7,_0xab4156){var _0x50b5dc;var _0xdfbfb7;var _0x2462f0;var _0x3159c3;return db[_0x4a66('0x27')][_0x4a66('0x3e')]({'where':_0x28947b[_0x4a66('0x1d')]['where']||{},'attributes':['id',_0x4a66('0x29'),_0x4a66('0x2a'),_0x4a66('0x4d'),_0x4a66('0x4e'),'internal',_0x4a66('0x4f'),'interface']})['then'](function(_0x26f436){if(_0x26f436){_0x50b5dc=_0x26f436;_0x3159c3=_0x28947b[_0x4a66('0x37')]['interface']?_0x28947b[_0x4a66('0x37')][_0x4a66('0x2c')]:util['format'](_0x4a66('0x36'),_0x50b5dc[_0x4a66('0x29')]);return db[_0x4a66('0x27')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x50b5dc['id']}}});}})[_0x4a66('0x10')](function(_0xb9519c){if(_0xb9519c){_0x2462f0=_0xb9519c;return require('../../config/license/util')['getLicense']();}})[_0x4a66('0x10')](function(_0x70cf21){if(_0x70cf21&&_0x70cf21[_0x4a66('0x50')]&&_0x2462f0>=_0x70cf21[_0x4a66('0x50')]){throw new Error(_0x4a66('0x51'));}})[_0x4a66('0x10')](function(){if(_0x50b5dc){return db[_0x4a66('0x2d')][_0x4a66('0x4b')]({'where':{'membername':_0x50b5dc['name']},'individualHooks':!![]});}})[_0x4a66('0x10')](function(){if(_0x50b5dc){return _0x50b5dc[_0x4a66('0x52')]({'raw':!![]});}})['then'](function(_0x51a208){if(_0x50b5dc){if(_0x51a208){var _0x4a5e19=[];_0xdfbfb7=_0x51a208;if(_0xdfbfb7[_0x4a66('0x30')]){for(var _0xfead3a=0x0;_0xfead3a<_0xdfbfb7[_0x4a66('0x30')];_0xfead3a++){_0x4a5e19[_0x4a66('0x35')](db[_0x4a66('0x2d')][_0x4a66('0x53')]({'membername':_0x50b5dc[_0x4a66('0x29')],'UserId':_0x50b5dc['id'],'queue_name':_0xdfbfb7[_0xfead3a][_0x4a66('0x29')],'VoiceQueueId':_0xdfbfb7[_0xfead3a]['id'],'interface':_0x3159c3,'paused':_0x50b5dc[_0x4a66('0x4f')]||![],'penalty':_0xdfbfb7[_0xfead3a][_0x4a66('0x54')]||0x0}));}return BPromise['all'](_0x4a5e19);}}}})[_0x4a66('0x10')](function(){if(_0x50b5dc){return db[_0x4a66('0x2e')]['findAll']({'where':{'membername':_0x50b5dc['name'],'exitAt':null}});}})['then'](function(_0x4e2569){if(_0x50b5dc){if(_0x4e2569&&_0x4e2569[_0x4a66('0x30')]){var _0x41b44b=[];_0x4e2569['forEach'](function(_0x47407a){_0x41b44b['push'](_0x47407a[_0x4a66('0x3b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4a66('0x49')](_0x41b44b);}}})['then'](function(_0x940395){if(_0x50b5dc){var _0x4c3d79=[];var _0x17408a=[];var _0x23110c=utils['getChannels']();var _0x469893={'membername':_0x50b5dc['name'],'interface':_0x3159c3,'enterAt':moment()['format'](_0x4a66('0x3c')),'role':_0x50b5dc[_0x4a66('0x2a')],'internal':_0x50b5dc[_0x4a66('0x2b')]};_0x23110c['forEach'](function(_0x15f4e8){_0x4c3d79[_0x4a66('0x35')](_[_0x4a66('0x55')]({'channel':_0x15f4e8,'type':_0x4a66('0x56'),'data1':'callysquare','data2':_0x3159c3},_0x469893));if(_0x50b5dc['loginInPause']){_0x17408a[_0x4a66('0x35')](_[_0x4a66('0x55')]({'channel':_0x15f4e8,'type':'PAUSE','data1':_0x4a66('0x57')},_0x469893));}});return db[_0x4a66('0x2e')][_0x4a66('0x3a')](_0x4c3d79[_0x4a66('0x58')](_0x17408a),{'individualHooks':!![]});}})[_0x4a66('0x10')](function(){if(_0x50b5dc){return _0x50b5dc[_0x4a66('0x3b')]({'online':!![],'lastLoginAt':moment()[_0x4a66('0x31')](_0x4a66('0x3c')),'voicePause':_0x50b5dc[_0x4a66('0x4f')]||![],'mailPause':_0x50b5dc[_0x4a66('0x4f')]||![],'chatPause':_0x50b5dc[_0x4a66('0x4f')]||![],'faxPause':_0x50b5dc[_0x4a66('0x4f')]||![],'smsPause':_0x50b5dc['loginInPause']||![],'openchannelPause':_0x50b5dc[_0x4a66('0x4f')]||![],'pauseType':_0x50b5dc[_0x4a66('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x4a66('0x31')](_0x4a66('0x3c')),'interface':_0x3159c3});}})[_0x4a66('0x10')](function(_0x74a5de){_0x3faea7(_0x74a5de);})[_0x4a66('0x1b')](function(_0x51f232){_0xab4156(_0x576445[_0x4a66('0x17')](0x1f4,_0x51f232[_0x4a66('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index cb55713..1292d09 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 _0xa6cd=['remove','removeListener','register','length','user:','./user.events'];(function(_0xe74768,_0x4c0bf9){var _0x302e8a=function(_0x5ba5c8){while(--_0x5ba5c8){_0xe74768['push'](_0xe74768['shift']());}};_0x302e8a(++_0x4c0bf9);}(_0xa6cd,0x1a9));var _0xda6c=function(_0x3c72de,_0x58ad58){_0x3c72de=_0x3c72de-0x0;var _0x3e1e15=_0xa6cd[_0x3c72de];return _0x3e1e15;};'use strict';var UserEvents=require(_0xda6c('0x0'));var events=['save',_0xda6c('0x1'),'update'];function createListener(_0x4a3458,_0x4b742){return function(_0x16ea79){_0x4b742['emit'](_0x4a3458,_0x16ea79);};}function removeListener(_0x274d21,_0x380dba){return function(){UserEvents[_0xda6c('0x2')](_0x274d21,_0x380dba);};}exports[_0xda6c('0x3')]=function(_0xf8b8e8){for(var _0x377989=0x0,_0xae3d51=events[_0xda6c('0x4')];_0x377989<_0xae3d51;_0x377989++){var _0x21ba38=events[_0x377989];var _0x1b5a91=createListener(_0xda6c('0x5')+_0x21ba38,_0xf8b8e8);UserEvents['on'](_0x21ba38,_0x1b5a91);}}; \ No newline at end of file +var _0xb984=['emit','register','user:','./user.events','remove','update'];(function(_0x4f2801,_0x366dd1){var _0x3ac22a=function(_0x39862a){while(--_0x39862a){_0x4f2801['push'](_0x4f2801['shift']());}};_0x3ac22a(++_0x366dd1);}(_0xb984,0x14d));var _0x4b98=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xb984[_0x220dbb];return _0x2b77de;};'use strict';var UserEvents=require(_0x4b98('0x0'));var events=['save',_0x4b98('0x1'),_0x4b98('0x2')];function createListener(_0x4044d3,_0x335020){return function(_0x404b0b){_0x335020[_0x4b98('0x3')](_0x4044d3,_0x404b0b);};}function removeListener(_0xf5d07d,_0x19857e){return function(){UserEvents['removeListener'](_0xf5d07d,_0x19857e);};}exports[_0x4b98('0x4')]=function(_0x3dfd5d){for(var _0x4fddeb=0x0,_0x4a8039=events['length'];_0x4fddeb<_0x4a8039;_0x4fddeb++){var _0x1b5cd0=events[_0x4fddeb];var _0x4e33ba=createListener(_0x4b98('0x5')+_0x1b5cd0,_0x3dfd5d);UserEvents['on'](_0x1b5cd0,_0x4e33ba);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d666a2e..885c588 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 _0x918b=['../../components/interaction/service','../../config/environment','path','express','../../components/auth/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x918b,0x1f1));var _0xb918=function(_0xb5e37f,_0xc624f1){_0xb5e37f=_0xb5e37f-0x0;var _0x23f431=_0x918b[_0xb5e37f];return _0x23f431;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb918('0x0'));var timeout=require('connect-timeout');var express=require(_0xb918('0x1'));var router=express['Router']();var auth=require(_0xb918('0x2'));var interaction=require(_0xb918('0x3'));var config=require(_0xb918('0x4'));module['exports']=router; \ No newline at end of file +var _0xc78f=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x40b81b,_0x1039be){var _0x4b1bef=function(_0x172336){while(--_0x172336){_0x40b81b['push'](_0x40b81b['shift']());}};_0x4b1bef(++_0x1039be);}(_0xc78f,0x161));var _0xfc78=function(_0x2c49cb,_0x53d468){_0x2c49cb=_0x2c49cb-0x0;var _0x21ebdc=_0xc78f[_0x2c49cb];return _0x21ebdc;};'use strict';var multer=require(_0xfc78('0x0'));var util=require(_0xfc78('0x1'));var path=require(_0xfc78('0x2'));var timeout=require(_0xfc78('0x3'));var express=require(_0xfc78('0x4'));var router=express[_0xfc78('0x5')]();var auth=require(_0xfc78('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfc78('0x7'));module[_0xfc78('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e09b155..0e16543 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3e88f3,_0x4c7928){var _0x43b42d=function(_0x3c9bcc){while(--_0x3c9bcc){_0x3e88f3['push'](_0x3e88f3['shift']());}};_0x43b42d(++_0x4c7928);}(_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(_0x4668a6,_0x4e8a1f){var _0x23215d=function(_0x4f4cfc){while(--_0x4f4cfc){_0x4668a6['push'](_0x4668a6['shift']());}};_0x23215d(++_0x4e8a1f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d77c94b..b23e97f 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 _0x6629=['UserChatQueue','user_has_chat_queues','lodash','util','api','bluebird','request-promise','path','define'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x6629,0x1a9));var _0x9662=function(_0x443178,_0x10101f){_0x443178=_0x443178-0x0;var _0x450c3a=_0x6629[_0x443178];return _0x450c3a;};'use strict';var _=require(_0x9662('0x0'));var util=require(_0x9662('0x1'));var logger=require('../../config/logger')(_0x9662('0x2'));var moment=require('moment');var BPromise=require(_0x9662('0x3'));var rp=require(_0x9662('0x4'));var fs=require('fs');var path=require(_0x9662('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module['exports']=function(_0xed6e5c,_0xbc3676){return _0xed6e5c[_0x9662('0x6')](_0x9662('0x7'),attributes,{'tableName':_0x9662('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf161=['moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x489e4a,_0x162bba){var _0x5e6075=function(_0x34ed5c){while(--_0x34ed5c){_0x489e4a['push'](_0x489e4a['shift']());}};_0x5e6075(++_0x162bba);}(_0xf161,0x1d1));var _0x1f16=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xf161[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var logger=require(_0x1f16('0x2'))('api');var moment=require(_0x1f16('0x3'));var BPromise=require(_0x1f16('0x4'));var rp=require(_0x1f16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f16('0x6'));var config=require(_0x1f16('0x7'));var attributes=require(_0x1f16('0x8'));module['exports']=function(_0x3e1736,_0x14c40a){return _0x3e1736[_0x1f16('0x9')](_0x1f16('0xa'),attributes,{'tableName':_0x1f16('0xb'),'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 3157a8b..26dd3eb 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 _0x804b=['stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x493f09,_0x3f81c9){var _0x4e5e38=function(_0x32275){while(--_0x32275){_0x493f09['push'](_0x493f09['shift']());}};_0x4e5e38(++_0x3f81c9);}(_0x804b,0xb7));var _0xb804=function(_0x46450a,_0x2f1b48){_0x46450a=_0x46450a-0x0;var _0x3fd1e6=_0x804b[_0x46450a];return _0x3fd1e6;};'use strict';var _=require(_0xb804('0x0'));var util=require(_0xb804('0x1'));var moment=require(_0xb804('0x2'));var BPromise=require(_0xb804('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb804('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb804('0x5'))(_0xb804('0x6'));var config=require(_0xb804('0x7'));var jayson=require(_0xb804('0x8'));var client=jayson['client'][_0xb804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc1af,_0x5a1ba2,_0x508055){return new BPromise(function(_0x1628f8,_0xddd624){return client[_0xb804('0xa')](_0x3dc1af,_0x508055)['then'](function(_0x389499){logger[_0xb804('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x5a1ba2,_0xb804('0xc'));logger[_0xb804('0xd')](_0xb804('0xe'),_0x5a1ba2,_0xb804('0xc'),JSON[_0xb804('0xf')](_0x389499));if(_0x389499[_0xb804('0x10')]){if(_0x389499['error'][_0xb804('0x11')]===0x1f4){logger[_0xb804('0x10')](_0xb804('0x12'),_0x5a1ba2,_0x389499[_0xb804('0x10')][_0xb804('0x13')]);return _0xddd624(_0x389499['error'][_0xb804('0x13')]);}logger[_0xb804('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5a1ba2,_0x389499[_0xb804('0x10')][_0xb804('0x13')]);return _0x1628f8(_0x389499[_0xb804('0x10')][_0xb804('0x13')]);}else{logger[_0xb804('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x5a1ba2,_0xb804('0xc'));_0x1628f8(_0x389499[_0xb804('0x14')][_0xb804('0x13')]);}})[_0xb804('0x15')](function(_0x186df5){logger[_0xb804('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5a1ba2,_0x186df5);_0xddd624(_0x186df5);});});} \ No newline at end of file +var _0x0741=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x37554e,_0x472c65){var _0x38d313=function(_0x5a8225){while(--_0x5a8225){_0x37554e['push'](_0x37554e['shift']());}};_0x38d313(++_0x472c65);}(_0x0741,0x1c3));var _0x1074=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0741[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x1074('0x0'));var util=require(_0x1074('0x1'));var moment=require(_0x1074('0x2'));var BPromise=require(_0x1074('0x3'));var rs=require(_0x1074('0x4'));var fs=require('fs');var Redis=require(_0x1074('0x5'));var db=require(_0x1074('0x6'))['db'];var utils=require(_0x1074('0x7'));var logger=require(_0x1074('0x8'))(_0x1074('0x9'));var config=require(_0x1074('0xa'));var jayson=require(_0x1074('0xb'));var client=jayson[_0x1074('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25439f,_0x541f0f,_0x11a3cc){return new BPromise(function(_0x5ebae0,_0x8aa831){return client[_0x1074('0xd')](_0x25439f,_0x11a3cc)[_0x1074('0xe')](function(_0x2c84ca){logger['info'](_0x1074('0xf'),_0x541f0f,_0x1074('0x10'));logger[_0x1074('0x11')](_0x1074('0x12'),_0x541f0f,'request\x20sent',JSON['stringify'](_0x2c84ca));if(_0x2c84ca[_0x1074('0x13')]){if(_0x2c84ca[_0x1074('0x13')][_0x1074('0x14')]===0x1f4){logger[_0x1074('0x13')](_0x1074('0xf'),_0x541f0f,_0x2c84ca[_0x1074('0x13')][_0x1074('0x15')]);return _0x8aa831(_0x2c84ca[_0x1074('0x13')][_0x1074('0x15')]);}logger[_0x1074('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x541f0f,_0x2c84ca[_0x1074('0x13')][_0x1074('0x15')]);return _0x5ebae0(_0x2c84ca[_0x1074('0x13')][_0x1074('0x15')]);}else{logger['info'](_0x1074('0xf'),_0x541f0f,_0x1074('0x10'));_0x5ebae0(_0x2c84ca[_0x1074('0x16')][_0x1074('0x15')]);}})[_0x1074('0x17')](function(_0x59078b){logger['error'](_0x1074('0xf'),_0x541f0f,_0x59078b);_0x8aa831(_0x59078b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f4e4e86..0ecd159 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 _0xa038=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xa038,0x1eb));var _0x8a03=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xa038[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0x8a03('0x0'));var util=require('util');var path=require(_0x8a03('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a03('0x2'));var router=express['Router']();var auth=require(_0x8a03('0x3'));var interaction=require(_0x8a03('0x4'));var config=require(_0x8a03('0x5'));module[_0x8a03('0x6')]=router; \ No newline at end of file +var _0xe6e7=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x43c1a2,_0x1de377){var _0x53b800=function(_0x19565b){while(--_0x19565b){_0x43c1a2['push'](_0x43c1a2['shift']());}};_0x53b800(++_0x1de377);}(_0xe6e7,0xac));var _0x7e6e=function(_0x3bdb65,_0x25efe5){_0x3bdb65=_0x3bdb65-0x0;var _0x3dfdd5=_0xe6e7[_0x3bdb65];return _0x3dfdd5;};'use strict';var multer=require(_0x7e6e('0x0'));var util=require(_0x7e6e('0x1'));var path=require(_0x7e6e('0x2'));var timeout=require(_0x7e6e('0x3'));var express=require(_0x7e6e('0x4'));var router=express[_0x7e6e('0x5')]();var auth=require(_0x7e6e('0x6'));var interaction=require(_0x7e6e('0x7'));var config=require(_0x7e6e('0x8'));module[_0x7e6e('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c33f1cc..1769a2a 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 _0xea28=['INTEGER','STRING','sequelize','exports'];(function(_0x54f4cb,_0x505e68){var _0x3563da=function(_0x75926d){while(--_0x75926d){_0x54f4cb['push'](_0x54f4cb['shift']());}};_0x3563da(++_0x505e68);}(_0xea28,0x13a));var _0x8ea2=function(_0x3a3b84,_0x447a5d){_0x3a3b84=_0x3a3b84-0x0;var _0x32a2f7=_0xea28[_0x3a3b84];return _0x32a2f7;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'penalty':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8ea2('0x3')]}}; \ No newline at end of file +var _0x6e6c=['exports','INTEGER','STRING','sequelize'];(function(_0xd84e8,_0x9ac7d9){var _0x19bc3d=function(_0x3355a7){while(--_0x3355a7){_0xd84e8['push'](_0xd84e8['shift']());}};_0x19bc3d(++_0x9ac7d9);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc6e6('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc6e6('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9e4db77..491f951 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 _0xd5e5=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','api','bluebird','request-promise','path'];(function(_0x39f4d2,_0x7a35e){var _0x41027c=function(_0x15cf67){while(--_0x15cf67){_0x39f4d2['push'](_0x39f4d2['shift']());}};_0x41027c(++_0x7a35e);}(_0xd5e5,0x187));var _0x5d5e=function(_0x545772,_0x535821){_0x545772=_0x545772-0x0;var _0x53b0e9=_0xd5e5[_0x545772];return _0x53b0e9;};'use strict';var _=require('lodash');var util=require(_0x5d5e('0x0'));var logger=require('../../config/logger')(_0x5d5e('0x1'));var moment=require('moment');var BPromise=require(_0x5d5e('0x2'));var rp=require(_0x5d5e('0x3'));var fs=require('fs');var path=require(_0x5d5e('0x4'));var rimraf=require(_0x5d5e('0x5'));var config=require(_0x5d5e('0x6'));var attributes=require(_0x5d5e('0x7'));module[_0x5d5e('0x8')]=function(_0x4ecfda,_0x38de77){return _0x4ecfda[_0x5d5e('0x9')](_0x5d5e('0xa'),attributes,{'tableName':_0x5d5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0711=['user_has_fax_queues','lodash','util','../../config/logger','moment','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x34901a,_0x1d58a4){var _0xaa0a9f=function(_0x15fadd){while(--_0x15fadd){_0x34901a['push'](_0x34901a['shift']());}};_0xaa0a9f(++_0x1d58a4);}(_0x0711,0x161));var _0x1071=function(_0x3113f5,_0x2f6d95){_0x3113f5=_0x3113f5-0x0;var _0x3a81f7=_0x0711[_0x3113f5];return _0x3a81f7;};'use strict';var _=require(_0x1071('0x0'));var util=require(_0x1071('0x1'));var logger=require(_0x1071('0x2'))('api');var moment=require(_0x1071('0x3'));var BPromise=require('bluebird');var rp=require(_0x1071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1071('0x5'));var config=require('../../config/environment');var attributes=require(_0x1071('0x6'));module[_0x1071('0x7')]=function(_0x3edaaf,_0x4f4328){return _0x3edaaf[_0x1071('0x8')](_0x1071('0x9'),attributes,{'tableName':_0x1071('0xa'),'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 5dbc2c5..8464eed 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 _0x0942=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4cbb3d,_0x29bd05){var _0xb649e=function(_0x266870){while(--_0x266870){_0x4cbb3d['push'](_0x4cbb3d['shift']());}};_0xb649e(++_0x29bd05);}(_0x0942,0x11a));var _0x2094=function(_0x13357b,_0x1a0874){_0x13357b=_0x13357b-0x0;var _0x23737e=_0x0942[_0x13357b];return _0x23737e;};'use strict';var _=require('lodash');var util=require(_0x2094('0x0'));var moment=require(_0x2094('0x1'));var BPromise=require(_0x2094('0x2'));var rs=require(_0x2094('0x3'));var fs=require('fs');var Redis=require(_0x2094('0x4'));var db=require(_0x2094('0x5'))['db'];var utils=require(_0x2094('0x6'));var logger=require(_0x2094('0x7'))('rpc');var config=require(_0x2094('0x8'));var jayson=require(_0x2094('0x9'));var client=jayson['client'][_0x2094('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a76f8,_0x380d92,_0x5a8de4){return new BPromise(function(_0x225f61,_0x173100){return client[_0x2094('0xb')](_0x3a76f8,_0x5a8de4)['then'](function(_0x77e61a){logger[_0x2094('0xc')](_0x2094('0xd'),_0x380d92,'request\x20sent');logger[_0x2094('0xe')](_0x2094('0xf'),_0x380d92,_0x2094('0x10'),JSON[_0x2094('0x11')](_0x77e61a));if(_0x77e61a[_0x2094('0x12')]){if(_0x77e61a[_0x2094('0x12')]['code']===0x1f4){logger[_0x2094('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x380d92,_0x77e61a[_0x2094('0x12')][_0x2094('0x13')]);return _0x173100(_0x77e61a[_0x2094('0x12')][_0x2094('0x13')]);}logger['error'](_0x2094('0xd'),_0x380d92,_0x77e61a['error'][_0x2094('0x13')]);return _0x225f61(_0x77e61a[_0x2094('0x12')]['message']);}else{logger[_0x2094('0xc')](_0x2094('0xd'),_0x380d92,_0x2094('0x10'));_0x225f61(_0x77e61a[_0x2094('0x14')][_0x2094('0x13')]);}})[_0x2094('0x15')](function(_0x39d104){logger['error'](_0x2094('0xd'),_0x380d92,_0x39d104);_0x173100(_0x39d104);});});} \ No newline at end of file +var _0x41d0=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0x41d0,0x1c6));var _0x041d=function(_0x3526ab,_0x347e8c){_0x3526ab=_0x3526ab-0x0;var _0x387cde=_0x41d0[_0x3526ab];return _0x387cde;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var moment=require(_0x041d('0x2'));var BPromise=require(_0x041d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x041d('0x4'));var db=require(_0x041d('0x5'))['db'];var utils=require(_0x041d('0x6'));var logger=require(_0x041d('0x7'))(_0x041d('0x8'));var config=require(_0x041d('0x9'));var jayson=require(_0x041d('0xa'));var client=jayson[_0x041d('0xb')][_0x041d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f083c,_0x372840,_0x50dae8){return new BPromise(function(_0xae8b94,_0x584adf){return client[_0x041d('0xd')](_0x5f083c,_0x50dae8)[_0x041d('0xe')](function(_0x556017){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x372840,_0x041d('0xf'));logger['debug'](_0x041d('0x10'),_0x372840,'request\x20sent',JSON[_0x041d('0x11')](_0x556017));if(_0x556017[_0x041d('0x12')]){if(_0x556017[_0x041d('0x12')][_0x041d('0x13')]===0x1f4){logger[_0x041d('0x12')](_0x041d('0x14'),_0x372840,_0x556017[_0x041d('0x12')][_0x041d('0x15')]);return _0x584adf(_0x556017[_0x041d('0x12')]['message']);}logger[_0x041d('0x12')](_0x041d('0x14'),_0x372840,_0x556017[_0x041d('0x12')][_0x041d('0x15')]);return _0xae8b94(_0x556017[_0x041d('0x12')][_0x041d('0x15')]);}else{logger['info'](_0x041d('0x14'),_0x372840,_0x041d('0xf'));_0xae8b94(_0x556017[_0x041d('0x16')][_0x041d('0x15')]);}})[_0x041d('0x17')](function(_0x1c581b){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x372840,_0x1c581b);_0x584adf(_0x1c581b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ab56a7d..467900d 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 _0x369c=['../../config/environment','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x369c,0xe2));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc369('0x0'));var util=require('util');var path=require(_0xc369('0x1'));var timeout=require('connect-timeout');var express=require(_0xc369('0x2'));var router=express[_0xc369('0x3')]();var auth=require(_0xc369('0x4'));var interaction=require(_0xc369('0x5'));var config=require(_0xc369('0x6'));module[_0xc369('0x7')]=router; \ No newline at end of file +var _0x9011=['Router','../../components/auth/service','exports','multer','express'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x9011,0x166));var _0x1901=function(_0x20ddb9,_0x3d3552){_0x20ddb9=_0x20ddb9-0x0;var _0x170c09=_0x9011[_0x20ddb9];return _0x170c09;};'use strict';var multer=require(_0x1901('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1901('0x1'));var router=express[_0x1901('0x2')]();var auth=require(_0x1901('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x1901('0x4')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index b19afb6..c98894a 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x16bcd4,_0x145f1c){var _0x86a7c9=function(_0x44b4f9){while(--_0x44b4f9){_0x16bcd4['push'](_0x16bcd4['shift']());}};_0x86a7c9(++_0x145f1c);}(_0xe706,0xa3));var _0x6e70=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xe706[_0x5dc03e];return _0x466a07;};'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(_0x11691c,_0x165143){var _0x4c683c=function(_0x3d1029){while(--_0x3d1029){_0x11691c['push'](_0x11691c['shift']());}};_0x4c683c(++_0x165143);}(_0xe706,0xa3));var _0x6e70=function(_0x56d0b2,_0x2f7c9e){_0x56d0b2=_0x56d0b2-0x0;var _0x37e421=_0xe706[_0x56d0b2];return _0x37e421;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 220c95a..7ebee76 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x2095ed,_0x156cfb){var _0x22dbb0=function(_0x385055){while(--_0x385055){_0x2095ed['push'](_0x2095ed['shift']());}};_0x22dbb0(++_0x156cfb);}(_0xb10b,0x12a));var _0xbb10=function(_0xa720e9,_0xf162db){_0xa720e9=_0xa720e9-0x0;var _0x902310=_0xb10b[_0xa720e9];return _0x902310;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xb10b,0x12a));var _0xbb10=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0xb10b[_0x43b487];return _0x2f707a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 95d696b..c249c83 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 _0x3d1f=['then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d1f,0xfb));var _0xf3d1=function(_0xa31a66,_0x2ccf5e){_0xa31a66=_0xa31a66-0x0;var _0x30a84f=_0x3d1f[_0xa31a66];return _0x30a84f;};'use strict';var _=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var moment=require(_0xf3d1('0x2'));var BPromise=require(_0xf3d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3d1('0x4'));var db=require(_0xf3d1('0x5'))['db'];var utils=require(_0xf3d1('0x6'));var logger=require(_0xf3d1('0x7'))(_0xf3d1('0x8'));var config=require(_0xf3d1('0x9'));var jayson=require(_0xf3d1('0xa'));var client=jayson['client'][_0xf3d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb126f1,_0x54cc8a,_0x251bb6){return new BPromise(function(_0xa1d749,_0x54309b){return client[_0xf3d1('0xc')](_0xb126f1,_0x251bb6)[_0xf3d1('0xd')](function(_0x499bf1){logger[_0xf3d1('0xe')](_0xf3d1('0xf'),_0x54cc8a,'request\x20sent');logger['debug'](_0xf3d1('0x10'),_0x54cc8a,_0xf3d1('0x11'),JSON[_0xf3d1('0x12')](_0x499bf1));if(_0x499bf1[_0xf3d1('0x13')]){if(_0x499bf1[_0xf3d1('0x13')][_0xf3d1('0x14')]===0x1f4){logger[_0xf3d1('0x13')](_0xf3d1('0xf'),_0x54cc8a,_0x499bf1[_0xf3d1('0x13')]['message']);return _0x54309b(_0x499bf1['error']['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x54cc8a,_0x499bf1[_0xf3d1('0x13')]['message']);return _0xa1d749(_0x499bf1[_0xf3d1('0x13')][_0xf3d1('0x15')]);}else{logger[_0xf3d1('0xe')](_0xf3d1('0xf'),_0x54cc8a,_0xf3d1('0x11'));_0xa1d749(_0x499bf1[_0xf3d1('0x16')][_0xf3d1('0x15')]);}})[_0xf3d1('0x17')](function(_0x5ac2d3){logger[_0xf3d1('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x54cc8a,_0x5ac2d3);_0x54309b(_0x5ac2d3);});});} \ No newline at end of file +var _0xf2a0=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xf2a0,0x7d));var _0x0f2a=function(_0x1bc2d6,_0x1257d3){_0x1bc2d6=_0x1bc2d6-0x0;var _0x559744=_0xf2a0[_0x1bc2d6];return _0x559744;};'use strict';var _=require('lodash');var util=require(_0x0f2a('0x0'));var moment=require(_0x0f2a('0x1'));var BPromise=require(_0x0f2a('0x2'));var rs=require(_0x0f2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f2a('0x4'))['db'];var utils=require(_0x0f2a('0x5'));var logger=require(_0x0f2a('0x6'))('rpc');var config=require(_0x0f2a('0x7'));var jayson=require(_0x0f2a('0x8'));var client=jayson['client'][_0x0f2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bba9e,_0x4c685e,_0xbeb280){return new BPromise(function(_0x4259f4,_0xcca97){return client['request'](_0x3bba9e,_0xbeb280)[_0x0f2a('0xa')](function(_0x45a74b){logger[_0x0f2a('0xb')](_0x0f2a('0xc'),_0x4c685e,_0x0f2a('0xd'));logger['debug'](_0x0f2a('0xe'),_0x4c685e,'request\x20sent',JSON[_0x0f2a('0xf')](_0x45a74b));if(_0x45a74b[_0x0f2a('0x10')]){if(_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x11')]===0x1f4){logger[_0x0f2a('0x10')](_0x0f2a('0xc'),_0x4c685e,_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);return _0xcca97(_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);}logger[_0x0f2a('0x10')](_0x0f2a('0xc'),_0x4c685e,_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);return _0x4259f4(_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x4c685e,_0x0f2a('0xd'));_0x4259f4(_0x45a74b['result'][_0x0f2a('0x12')]);}})[_0x0f2a('0x13')](function(_0x246b43){logger[_0x0f2a('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4c685e,_0x246b43);_0xcca97(_0x246b43);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 11e4af3..6d1856e 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 _0xbde8=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x1d0f25,_0x3f21d3){var _0xc7a0be=function(_0x28d80a){while(--_0x28d80a){_0x1d0f25['push'](_0x1d0f25['shift']());}};_0xc7a0be(++_0x3f21d3);}(_0xbde8,0x16c));var _0x8bde=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xbde8[_0x16629d];return _0x56ccee;};'use strict';var multer=require(_0x8bde('0x0'));var util=require(_0x8bde('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8bde('0x2'));var interaction=require(_0x8bde('0x3'));var config=require(_0x8bde('0x4'));module[_0x8bde('0x5')]=router; \ No newline at end of file +var _0x7801=['../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x27e916,_0x490784){var _0x582985=function(_0x42cc67){while(--_0x42cc67){_0x27e916['push'](_0x27e916['shift']());}};_0x582985(++_0x490784);}(_0x7801,0x11a));var _0x1780=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7801[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1780('0x0'));var path=require(_0x1780('0x1'));var timeout=require(_0x1780('0x2'));var express=require(_0x1780('0x3'));var router=express[_0x1780('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1780('0x5'));var config=require(_0x1780('0x6'));module[_0x1780('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b3b6e15..d2f728f 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(_0x2ef644,_0x2ab0ff){var _0x11f00e=function(_0x32983a){while(--_0x32983a){_0x2ef644['push'](_0x2ef644['shift']());}};_0x11f00e(++_0x2ab0ff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x44ed0a,_0xb76150){var _0x176324=function(_0x2b5bc6){while(--_0x2b5bc6){_0x44ed0a['push'](_0x44ed0a['shift']());}};_0x176324(++_0xb76150);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index e548f56..6b2aeb7 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 _0x806d=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','moment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x806d,0xfa));var _0xd806=function(_0x6489b1,_0x2ee325){_0x6489b1=_0x6489b1-0x0;var _0x5c886e=_0x806d[_0x6489b1];return _0x5c886e;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd806('0x2'));var BPromise=require(_0xd806('0x3'));var rp=require(_0xd806('0x4'));var fs=require('fs');var path=require(_0xd806('0x5'));var rimraf=require(_0xd806('0x6'));var config=require(_0xd806('0x7'));var attributes=require(_0xd806('0x8'));module['exports']=function(_0x5730e0,_0x3e24e7){return _0x5730e0['define'](_0xd806('0x9'),attributes,{'tableName':_0xd806('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x565b=['exports','user_has_openchannel_queues','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x29840d,_0x4bef48){var _0x4917cd=function(_0x5499b9){while(--_0x5499b9){_0x29840d['push'](_0x29840d['shift']());}};_0x4917cd(++_0x4bef48);}(_0x565b,0x13a));var _0xb565=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x565b[_0x3cea78];return _0x33b66b;};'use strict';var _=require('lodash');var util=require(_0xb565('0x0'));var logger=require(_0xb565('0x1'))('api');var moment=require(_0xb565('0x2'));var BPromise=require(_0xb565('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb565('0x4'));var rimraf=require('rimraf');var config=require(_0xb565('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xb565('0x6')]=function(_0x2b5507,_0x53f924){return _0x2b5507['define']('UserOpenchannelQueue',attributes,{'tableName':_0xb565('0x7'),'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 d9a2c92..a14b0a9 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 _0x243c=['rpc','../../config/environment','client','request','info','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x5b37f1,_0x44674c){var _0x2caf24=function(_0x2c502a){while(--_0x2c502a){_0x5b37f1['push'](_0x5b37f1['shift']());}};_0x2caf24(++_0x44674c);}(_0x243c,0x1aa));var _0xc243=function(_0xdfe4fa,_0x27c44b){_0xdfe4fa=_0xdfe4fa-0x0;var _0x5c1d65=_0x243c[_0xdfe4fa];return _0x5c1d65;};'use strict';var _=require(_0xc243('0x0'));var util=require(_0xc243('0x1'));var moment=require(_0xc243('0x2'));var BPromise=require(_0xc243('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc243('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc243('0x5'))(_0xc243('0x6'));var config=require(_0xc243('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc243('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1febc6,_0x3732be,_0x7935d7){return new BPromise(function(_0x5c2b4c,_0x328773){return client[_0xc243('0x9')](_0x1febc6,_0x7935d7)['then'](function(_0x1d5af3){logger[_0xc243('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3732be,_0xc243('0xb'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3732be,_0xc243('0xb'),JSON[_0xc243('0xc')](_0x1d5af3));if(_0x1d5af3[_0xc243('0xd')]){if(_0x1d5af3[_0xc243('0xd')]['code']===0x1f4){logger[_0xc243('0xd')](_0xc243('0xe'),_0x3732be,_0x1d5af3[_0xc243('0xd')][_0xc243('0xf')]);return _0x328773(_0x1d5af3[_0xc243('0xd')][_0xc243('0xf')]);}logger[_0xc243('0xd')](_0xc243('0xe'),_0x3732be,_0x1d5af3[_0xc243('0xd')]['message']);return _0x5c2b4c(_0x1d5af3[_0xc243('0xd')][_0xc243('0xf')]);}else{logger[_0xc243('0xa')](_0xc243('0xe'),_0x3732be,_0xc243('0xb'));_0x5c2b4c(_0x1d5af3[_0xc243('0x10')][_0xc243('0xf')]);}})[_0xc243('0x11')](function(_0x22ce99){logger[_0xc243('0xd')](_0xc243('0xe'),_0x3732be,_0x22ce99);_0x328773(_0x22ce99);});});} \ No newline at end of file +var _0x7345=['client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3831ed,_0x5e88ce){var _0x5521ce=function(_0x15fef7){while(--_0x15fef7){_0x3831ed['push'](_0x3831ed['shift']());}};_0x5521ce(++_0x5e88ce);}(_0x7345,0x69));var _0x5734=function(_0x26ff93,_0x23e7e9){_0x26ff93=_0x26ff93-0x0;var _0x598e7d=_0x7345[_0x26ff93];return _0x598e7d;};'use strict';var _=require('lodash');var util=require(_0x5734('0x0'));var moment=require(_0x5734('0x1'));var BPromise=require(_0x5734('0x2'));var rs=require(_0x5734('0x3'));var fs=require('fs');var Redis=require(_0x5734('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5734('0x5'))(_0x5734('0x6'));var config=require(_0x5734('0x7'));var jayson=require(_0x5734('0x8'));var client=jayson[_0x5734('0x9')][_0x5734('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409667,_0x169a88,_0x53afc2){return new BPromise(function(_0x385ba6,_0x4e9d7f){return client['request'](_0x409667,_0x53afc2)['then'](function(_0x3a84c5){logger[_0x5734('0xb')](_0x5734('0xc'),_0x169a88,_0x5734('0xd'));logger['debug'](_0x5734('0xe'),_0x169a88,_0x5734('0xd'),JSON['stringify'](_0x3a84c5));if(_0x3a84c5[_0x5734('0xf')]){if(_0x3a84c5[_0x5734('0xf')]['code']===0x1f4){logger[_0x5734('0xf')](_0x5734('0xc'),_0x169a88,_0x3a84c5['error'][_0x5734('0x10')]);return _0x4e9d7f(_0x3a84c5['error'][_0x5734('0x10')]);}logger[_0x5734('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x169a88,_0x3a84c5[_0x5734('0xf')]['message']);return _0x385ba6(_0x3a84c5[_0x5734('0xf')][_0x5734('0x10')]);}else{logger['info'](_0x5734('0xc'),_0x169a88,_0x5734('0xd'));_0x385ba6(_0x3a84c5[_0x5734('0x11')]['message']);}})[_0x5734('0x12')](function(_0x9d5325){logger[_0x5734('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x169a88,_0x9d5325);_0x4e9d7f(_0x9d5325);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 85b3af4..ec5bcb4 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 _0x6d2d=['/:id/sections','getSections','/:id/resources','post','clone','put','/:id','update','destroy','delete','removeResources','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','index','/describe','isAuthenticated','show'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x6d2d,0x120));var _0xd6d2=function(_0x59a184,_0x32f1a5){_0x59a184=_0x59a184-0x0;var _0x400a58=_0x6d2d[_0x59a184];return _0x400a58;};'use strict';var multer=require(_0xd6d2('0x0'));var util=require(_0xd6d2('0x1'));var path=require(_0xd6d2('0x2'));var timeout=require(_0xd6d2('0x3'));var express=require(_0xd6d2('0x4'));var router=express['Router']();var auth=require(_0xd6d2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xd6d2('0x6')]('/',auth['isAuthenticated'](),controller[_0xd6d2('0x7')]);router[_0xd6d2('0x6')](_0xd6d2('0x8'),auth[_0xd6d2('0x9')](),controller['describe']);router['get']('/:id',auth[_0xd6d2('0x9')](),controller[_0xd6d2('0xa')]);router['get'](_0xd6d2('0xb'),auth[_0xd6d2('0x9')](),controller[_0xd6d2('0xc')]);router[_0xd6d2('0x6')](_0xd6d2('0xd'),auth[_0xd6d2('0x9')](),controller['getResources']);router[_0xd6d2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6d2('0xe')]('/:id/clone',auth[_0xd6d2('0x9')](),controller[_0xd6d2('0xf')]);router[_0xd6d2('0xe')](_0xd6d2('0xb'),auth[_0xd6d2('0x9')](),controller['addSections']);router['post'](_0xd6d2('0xd'),auth[_0xd6d2('0x9')](),controller['addResources']);router[_0xd6d2('0x10')](_0xd6d2('0x11'),auth[_0xd6d2('0x9')](),controller[_0xd6d2('0x12')]);router['delete'](_0xd6d2('0x11'),auth[_0xd6d2('0x9')](),controller[_0xd6d2('0x13')]);router[_0xd6d2('0x14')]('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0xd6d2('0x14')]('/:id/resources',auth[_0xd6d2('0x9')](),controller[_0xd6d2('0x15')]);module[_0xd6d2('0x16')]=router; \ No newline at end of file +var _0xb5b2=['getResources','post','clone','addResources','put','update','delete','removeSections','/:id/resources','removeResources','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','/:id/sections','getSections'];(function(_0x2652ac,_0x43e7c6){var _0x47998c=function(_0x20d03d){while(--_0x20d03d){_0x2652ac['push'](_0x2652ac['shift']());}};_0x47998c(++_0x43e7c6);}(_0xb5b2,0x10f));var _0x2b5b=function(_0x4f6760,_0x2a917d){_0x4f6760=_0x4f6760-0x0;var _0x47cad8=_0xb5b2[_0x4f6760];return _0x47cad8;};'use strict';var multer=require(_0x2b5b('0x0'));var util=require(_0x2b5b('0x1'));var path=require('path');var timeout=require(_0x2b5b('0x2'));var express=require(_0x2b5b('0x3'));var router=express[_0x2b5b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b5b('0x5'));var config=require(_0x2b5b('0x6'));var controller=require(_0x2b5b('0x7'));router[_0x2b5b('0x8')]('/',auth[_0x2b5b('0x9')](),controller[_0x2b5b('0xa')]);router[_0x2b5b('0x8')]('/describe',auth[_0x2b5b('0x9')](),controller[_0x2b5b('0xb')]);router[_0x2b5b('0x8')](_0x2b5b('0xc'),auth[_0x2b5b('0x9')](),controller['show']);router[_0x2b5b('0x8')](_0x2b5b('0xd'),auth['isAuthenticated'](),controller[_0x2b5b('0xe')]);router[_0x2b5b('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x2b5b('0xf')]);router[_0x2b5b('0x10')]('/',auth[_0x2b5b('0x9')](),controller['create']);router[_0x2b5b('0x10')]('/:id/clone',auth[_0x2b5b('0x9')](),controller[_0x2b5b('0x11')]);router[_0x2b5b('0x10')](_0x2b5b('0xd'),auth[_0x2b5b('0x9')](),controller['addSections']);router[_0x2b5b('0x10')]('/:id/resources',auth[_0x2b5b('0x9')](),controller[_0x2b5b('0x12')]);router[_0x2b5b('0x13')](_0x2b5b('0xc'),auth['isAuthenticated'](),controller[_0x2b5b('0x14')]);router[_0x2b5b('0x15')](_0x2b5b('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x2b5b('0x15')]('/:id/sections',auth[_0x2b5b('0x9')](),controller[_0x2b5b('0x16')]);router[_0x2b5b('0x15')](_0x2b5b('0x17'),auth[_0x2b5b('0x9')](),controller[_0x2b5b('0x18')]);module[_0x2b5b('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dfdbbc4..c2a2359 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 _0xb82e=['getDataValue','split','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x16842c,_0x225466){var _0x4bd145=function(_0x4dafe0){while(--_0x4dafe0){_0x16842c['push'](_0x16842c['shift']());}};_0x4bd145(++_0x225466);}(_0xb82e,0x172));var _0xeb82=function(_0x487838,_0x1e764c){_0x487838=_0x487838-0x0;var _0x505279=_0xb82e[_0x487838];return _0x505279;};'use strict';var Sequelize=require(_0xeb82('0x0'));module[_0xeb82('0x1')]={'name':{'type':Sequelize[_0xeb82('0x2')],'allowNull':![],'unique':_0xeb82('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xd46180){this[_0xeb82('0x4')](_0xeb82('0x5'),_0xd46180?_0xd46180['join'](''):[]);},'get':function(){return this[_0xeb82('0x6')](_0xeb82('0x5'))?this['getDataValue'](_0xeb82('0x5'))[_0xeb82('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xeb82('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8a64=['name','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x3c6445,_0x1ab6c1){var _0x14ab41=function(_0x2eafb0){while(--_0x2eafb0){_0x3c6445['push'](_0x3c6445['shift']());}};_0x14ab41(++_0x1ab6c1);}(_0x8a64,0xfd));var _0x48a6=function(_0x13cd68,_0x56db3e){_0x13cd68=_0x13cd68-0x0;var _0x44e15a=_0x8a64[_0x13cd68];return _0x44e15a;};'use strict';var Sequelize=require(_0x48a6('0x0'));module[_0x48a6('0x1')]={'name':{'type':Sequelize[_0x48a6('0x2')],'allowNull':![],'unique':_0x48a6('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3b312f){this['setDataValue'](_0x48a6('0x4'),_0x3b312f?_0x3b312f[_0x48a6('0x5')](''):[]);},'get':function(){return this[_0x48a6('0x6')](_0x48a6('0x4'))?this['getDataValue']('crudPermissions')[_0x48a6('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x48a6('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3823851..2bdee1d 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 _0x0a9f=['status','end','json','count','offset','limit','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','length','include','find','create','body','clone','options','omit','createdAt','updatedAt','crudPermissions','transaction','get','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','sequelize','push','removeSections','destroy','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','addResources','userProfileId','bulkCreate','removeResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','undefined','Invalid\x20section\x20\x27','parentSections','ignore','childModel','nolimit','order','field','associatedResources','foreignKey','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CustomReports','Tags','color','tag','Tag','ThroughTags','value','SquareProject','squarerecordings','SquareRecording','projectName','projects','contacts','Lists','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','role','Telephones','User','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','WhatsappQueue','Team','voicequeues','queuecampaigns','agents','Users','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','sounds','Sound','tags','templates','Template','Trunk','variables','Variable','plugins','extractedreports','Reports','AnalyticMetric','whatsappaccounts','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','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','./userProfile.socket','register'];(function(_0x2d64a2,_0x59260f){var _0x2ce7ac=function(_0x2b1849){while(--_0x2b1849){_0x2d64a2['push'](_0x2d64a2['shift']());}};_0x2ce7ac(++_0x59260f);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0xace1ac,_0x2d20a8){_0xace1ac=_0xace1ac-0x0;var _0x103c4c=_0x0a9f[_0xace1ac];return _0x103c4c;};'use strict';var pdf=require(_0xf0a9('0x0'));var emlformat=require(_0xf0a9('0x1'));var rimraf=require(_0xf0a9('0x2'));var zipdir=require(_0xf0a9('0x3'));var jsonpatch=require(_0xf0a9('0x4'));var rp=require(_0xf0a9('0x5'));var moment=require(_0xf0a9('0x6'));var BPromise=require(_0xf0a9('0x7'));var Mustache=require(_0xf0a9('0x8'));var util=require(_0xf0a9('0x9'));var path=require(_0xf0a9('0xa'));var sox=require(_0xf0a9('0xb'));var csv=require('to-csv');var ejs=require(_0xf0a9('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0a9('0xd'));var crypto=require(_0xf0a9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0a9('0xf'));var toCsv=require(_0xf0a9('0x10'));var querystring=require('querystring');var Papa=require(_0xf0a9('0x11'));var Redis=require(_0xf0a9('0x12'));var authService=require(_0xf0a9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf0a9('0x14'));var hardwareService=require(_0xf0a9('0x15'));var logger=require(_0xf0a9('0x16'))(_0xf0a9('0x17'));var utils=require(_0xf0a9('0x18'));var config=require(_0xf0a9('0x19'));var licenseUtil=require(_0xf0a9('0x1a'));var db=require(_0xf0a9('0x1b'))['db'];config[_0xf0a9('0x1c')]=_[_0xf0a9('0x1d')](config[_0xf0a9('0x1c')],{'host':_0xf0a9('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0a9('0x1c')]));require(_0xf0a9('0x1f'))[_0xf0a9('0x20')](socket);function respondWithStatusCode(_0x17d869,_0x3ca693){_0x3ca693=_0x3ca693||0xcc;return function(_0x27cf6f){if(_0x27cf6f){return _0x17d869['sendStatus'](_0x3ca693);}return _0x17d869[_0xf0a9('0x21')](_0x3ca693)[_0xf0a9('0x22')]();};}function respondWithResult(_0x572607,_0x8f48f7){_0x8f48f7=_0x8f48f7||0xc8;return function(_0x5825de){if(_0x5825de){return _0x572607[_0xf0a9('0x21')](_0x8f48f7)[_0xf0a9('0x23')](_0x5825de);}};}function respondWithFilteredResult(_0x19953c,_0xe99ce2){return function(_0x41e4c3){if(_0x41e4c3){var _0x2a46c0=_0x41e4c3[_0xf0a9('0x24')],_0x4c82e7=_0xe99ce2[_0xf0a9('0x25')],_0x1952ab=_0xe99ce2[_0xf0a9('0x25')]+_0xe99ce2[_0xf0a9('0x26')],_0x3015ab;if(_0x1952ab>=_0x2a46c0){_0x1952ab=_0x2a46c0;_0x3015ab=0xc8;}else{_0x3015ab=0xce;}_0x19953c[_0xf0a9('0x21')](_0x3015ab);return _0x19953c['set']('Content-Range',_0x4c82e7+'-'+_0x1952ab+'/'+_0x2a46c0)[_0xf0a9('0x23')](_0x41e4c3);}return null;};}function patchUpdates(_0x13dd78){return function(_0x334ada){try{jsonpatch[_0xf0a9('0x27')](_0x334ada,_0x13dd78,!![]);}catch(_0x3b1410){return BPromise[_0xf0a9('0x28')](_0x3b1410);}return _0x334ada[_0xf0a9('0x29')]();};}function saveUpdates(_0x55b8cc,_0x46f161){return function(_0x247fe9){if(_0x247fe9){return _0x247fe9[_0xf0a9('0x2a')](_0x55b8cc)['then'](function(_0x4c4bbd){return _0x4c4bbd;});}return null;};}function removeEntity(_0x87063e,_0x260f82){return function(_0x408129){if(_0x408129){return _0x408129['destroy']()[_0xf0a9('0x2b')](function(){_0x87063e[_0xf0a9('0x21')](0xcc)[_0xf0a9('0x22')]();});}};}function handleEntityNotFound(_0x4be839,_0x474874){return function(_0x4efe08){if(!_0x4efe08){_0x4be839[_0xf0a9('0x2c')](0x194);}return _0x4efe08;};}function handleError(_0x508bfd,_0x3fe33f){_0x3fe33f=_0x3fe33f||0x1f4;return function(_0x584b69){logger[_0xf0a9('0x2d')](_0x584b69[_0xf0a9('0x2e')]);if(_0x584b69[_0xf0a9('0x2f')]){delete _0x584b69[_0xf0a9('0x2f')];}_0x508bfd[_0xf0a9('0x21')](_0x3fe33f)[_0xf0a9('0x30')](_0x584b69);};}exports[_0xf0a9('0x31')]=function(_0x43aa70,_0x460c00){var _0xbd6f52={},_0x3b1c79={},_0x2af2f9={'count':0x0,'rows':[]};var _0x37a902=_[_0xf0a9('0x32')](db[_0xf0a9('0x33')][_0xf0a9('0x34')],function(_0x5c021e){return{'name':_0x5c021e[_0xf0a9('0x35')],'type':_0x5c021e[_0xf0a9('0x36')][_0xf0a9('0x37')]};});_0x3b1c79[_0xf0a9('0x38')]=_['map'](_0x37a902,_0xf0a9('0x2f'));_0x3b1c79[_0xf0a9('0x39')]=_[_0xf0a9('0x3a')](_0x43aa70[_0xf0a9('0x39')]);_0x3b1c79[_0xf0a9('0x3b')]=_[_0xf0a9('0x3c')](_0x3b1c79[_0xf0a9('0x38')],_0x3b1c79['query']);_0xbd6f52['attributes']=_[_0xf0a9('0x3c')](_0x3b1c79[_0xf0a9('0x38')],qs[_0xf0a9('0x3d')](_0x43aa70['query'][_0xf0a9('0x3d')]));_0xbd6f52['attributes']=_0xbd6f52[_0xf0a9('0x3e')]['length']?_0xbd6f52[_0xf0a9('0x3e')]:_0x3b1c79[_0xf0a9('0x38')];if(!_0x43aa70['query'][_0xf0a9('0x3f')]('nolimit')){_0xbd6f52['limit']=qs['limit'](_0x43aa70[_0xf0a9('0x39')][_0xf0a9('0x26')]);_0xbd6f52[_0xf0a9('0x25')]=qs[_0xf0a9('0x25')](_0x43aa70[_0xf0a9('0x39')][_0xf0a9('0x25')]);}_0xbd6f52['order']=qs['sort'](_0x43aa70[_0xf0a9('0x39')][_0xf0a9('0x40')]);_0xbd6f52[_0xf0a9('0x41')]=qs[_0xf0a9('0x3b')](_[_0xf0a9('0x42')](_0x43aa70['query'],_0x3b1c79['filters']),_0x37a902);if(_0x43aa70[_0xf0a9('0x39')][_0xf0a9('0x43')]){_0xbd6f52[_0xf0a9('0x41')]=_['merge'](_0xbd6f52[_0xf0a9('0x41')],{'$or':_[_0xf0a9('0x32')](_0x37a902,function(_0x190e08){if(_0x190e08[_0xf0a9('0x36')]!==_0xf0a9('0x44')){var _0x5d944a={};_0x5d944a[_0x190e08[_0xf0a9('0x2f')]]={'$like':'%'+_0x43aa70[_0xf0a9('0x39')][_0xf0a9('0x43')]+'%'};return _0x5d944a;}})});}_0xbd6f52=_[_0xf0a9('0x45')]({},_0xbd6f52,_0x43aa70['options']);var _0x56068f={'where':_0xbd6f52[_0xf0a9('0x41')]};return db[_0xf0a9('0x33')][_0xf0a9('0x24')](_0x56068f)['then'](function(_0x4429b3){_0x2af2f9['count']=_0x4429b3;if(_0x43aa70[_0xf0a9('0x39')][_0xf0a9('0x46')]){_0xbd6f52['include']=[{'all':!![]}];}return db[_0xf0a9('0x33')]['findAll'](_0xbd6f52);})[_0xf0a9('0x2b')](function(_0x15c9e5){_0x2af2f9[_0xf0a9('0x47')]=_0x15c9e5;return _0x2af2f9;})[_0xf0a9('0x2b')](respondWithFilteredResult(_0x460c00,_0xbd6f52))[_0xf0a9('0x48')](handleError(_0x460c00,null));};exports[_0xf0a9('0x49')]=function(_0x50932c,_0x45931e){var _0x56373c={'raw':![],'where':{'id':_0x50932c[_0xf0a9('0x4a')]['id']}},_0x5e707e={};_0x5e707e['model']=_['keys'](db[_0xf0a9('0x33')]['rawAttributes']);_0x5e707e[_0xf0a9('0x39')]=_[_0xf0a9('0x3a')](_0x50932c['query']);_0x5e707e[_0xf0a9('0x3b')]=_[_0xf0a9('0x3c')](_0x5e707e[_0xf0a9('0x38')],_0x5e707e[_0xf0a9('0x39')]);_0x56373c['attributes']=_[_0xf0a9('0x3c')](_0x5e707e['model'],qs[_0xf0a9('0x3d')](_0x50932c[_0xf0a9('0x39')]['fields']));_0x56373c[_0xf0a9('0x3e')]=_0x56373c[_0xf0a9('0x3e')][_0xf0a9('0x4b')]?_0x56373c[_0xf0a9('0x3e')]:_0x5e707e[_0xf0a9('0x38')];if(_0x50932c[_0xf0a9('0x39')][_0xf0a9('0x46')]){_0x56373c[_0xf0a9('0x4c')]=[{'all':!![]}];}_0x56373c=_[_0xf0a9('0x45')]({},_0x56373c,_0x50932c['options']);return db[_0xf0a9('0x33')][_0xf0a9('0x4d')](_0x56373c)[_0xf0a9('0x2b')](handleEntityNotFound(_0x45931e,null))[_0xf0a9('0x2b')](respondWithResult(_0x45931e,null))['catch'](handleError(_0x45931e,null));};exports['create']=function(_0x1db81c,_0x5437ff){return db[_0xf0a9('0x33')][_0xf0a9('0x4e')](_0x1db81c[_0xf0a9('0x4f')],{})[_0xf0a9('0x2b')](respondWithResult(_0x5437ff,0xc9))[_0xf0a9('0x48')](handleError(_0x5437ff,null));};exports[_0xf0a9('0x50')]=function(_0x115145,_0x463798){var _0x9fdf8c={'where':{'id':_0x115145[_0xf0a9('0x4a')]['id']}},_0xdb8677={};_0xdb8677['model']=_['keys'](db[_0xf0a9('0x33')][_0xf0a9('0x34')]);_0x9fdf8c[_0xf0a9('0x3e')]=_['intersection'](_0xdb8677[_0xf0a9('0x38')],qs[_0xf0a9('0x3d')](_0x115145[_0xf0a9('0x39')][_0xf0a9('0x3d')]));_0x9fdf8c[_0xf0a9('0x3e')]=_0x9fdf8c[_0xf0a9('0x3e')][_0xf0a9('0x4b')]?_0x9fdf8c['attributes']:_0xdb8677[_0xf0a9('0x38')];if(_0x115145['query'][_0xf0a9('0x46')]){_0x9fdf8c['include']=[{'all':!![]}];}_0x9fdf8c=_['merge']({},_0x9fdf8c,_0x115145[_0xf0a9('0x51')]);return db[_0xf0a9('0x33')][_0xf0a9('0x4d')](_0x9fdf8c)[_0xf0a9('0x2b')](handleEntityNotFound(_0x463798,null))[_0xf0a9('0x2b')](function(_0x2b0b33){if(_0x2b0b33){var _0x28cbd7=_0x2b0b33['get']({'plain':!![]});_0x28cbd7=qs[_0xf0a9('0x52')](_0x28cbd7,['id',_0xf0a9('0x53'),_0xf0a9('0x54'),_0xf0a9('0x55')]);_0x115145[_0xf0a9('0x4f')]=_[_0xf0a9('0x52')](_0x115145[_0xf0a9('0x4f')],['id',_0xf0a9('0x53'),_0xf0a9('0x54')]);return db['sequelize'][_0xf0a9('0x56')](function(_0x5edfb5){return db[_0xf0a9('0x33')][_0xf0a9('0x4e')](_[_0xf0a9('0x45')](_0x28cbd7,_0x115145[_0xf0a9('0x4f')]),{'include':_0x115145[_0xf0a9('0x39')][_0xf0a9('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x5edfb5})[_0xf0a9('0x2b')](function(_0x24c3f3){var _0x31efe6=_0x24c3f3[_0xf0a9('0x57')]({'plain':!![]});return db[_0xf0a9('0x58')][_0xf0a9('0x59')]({'where':{'userProfileId':_0x115145[_0xf0a9('0x4a')]['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0xd7c2af){if(_0xd7c2af){return BPromise['each'](_0xd7c2af,function(_0x41c998){return new BPromise(function(_0x29094c,_0x1529a7){if(_0x41c998['autoAssociation']===null||_0x41c998[_0xf0a9('0x5a')]===0x1)_0x29094c(null);return db[_0xf0a9('0x5b')][_0xf0a9('0x59')]({'where':{'sectionId':_0x41c998['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0xbccdc4){var _0x5409e1=_[_0xf0a9('0x32')](_0xbccdc4,function(_0x214b8b){return qs['omit'](_0x214b8b,['id',_0xf0a9('0x53'),_0xf0a9('0x54'),_0xf0a9('0x5c')]);});_0x29094c(_0x5409e1);})[_0xf0a9('0x48')](function(_0x596116){_0x1529a7(_0x596116);});})[_0xf0a9('0x2b')](function(_0x814232){var _0xfa7051=qs[_0xf0a9('0x52')](_0x41c998,['id',_0xf0a9('0x53'),_0xf0a9('0x54')]);_0xfa7051['userProfileId']=_0x31efe6['id'];if(_0x814232)_0xfa7051['Resources']=_0x814232;return _0xfa7051;})[_0xf0a9('0x2b')](function(_0x5bd8a0){return db[_0xf0a9('0x58')][_0xf0a9('0x4e')](_0x5bd8a0,{'include':[{'model':db['UserProfileResource'],'as':_0xf0a9('0x5d')}],'raw':!![],'transaction':_0x5edfb5});});})[_0xf0a9('0x2b')](function(){return _0x31efe6;});}});});});}})[_0xf0a9('0x2b')](respondWithResult(_0x463798,0xc9))[_0xf0a9('0x48')](handleError(_0x463798,null));};exports[_0xf0a9('0x2a')]=function(_0xddf3d0,_0x5a43fc){if(_0xddf3d0[_0xf0a9('0x4f')]['id']){delete _0xddf3d0['body']['id'];}return db[_0xf0a9('0x33')][_0xf0a9('0x4d')]({'where':{'id':_0xddf3d0[_0xf0a9('0x4a')]['id']}})[_0xf0a9('0x2b')](handleEntityNotFound(_0x5a43fc,null))['then'](saveUpdates(_0xddf3d0['body'],null))[_0xf0a9('0x2b')](respondWithResult(_0x5a43fc,null))['catch'](handleError(_0x5a43fc,null));};exports['destroy']=function(_0x2a32b6,_0x1c3edf){return db[_0xf0a9('0x33')][_0xf0a9('0x4d')]({'where':{'id':_0x2a32b6[_0xf0a9('0x4a')]['id']}})[_0xf0a9('0x2b')](handleEntityNotFound(_0x1c3edf,null))['then'](removeEntity(_0x1c3edf,null))[_0xf0a9('0x48')](handleError(_0x1c3edf,null));};exports[_0xf0a9('0x5e')]=function(_0x55c24f,_0x4697cf){return db[_0xf0a9('0x33')][_0xf0a9('0x5e')]()[_0xf0a9('0x2b')](respondWithResult(_0x4697cf,null))[_0xf0a9('0x48')](handleError(_0x4697cf,null));};exports[_0xf0a9('0x5f')]=function(_0x33edd1,_0x925fa2){var _0x4ebfe8=_0x33edd1[_0xf0a9('0x4f')];return db[_0xf0a9('0x33')][_0xf0a9('0x4d')]({'where':{'id':_0x33edd1['params']['id']}})[_0xf0a9('0x2b')](handleEntityNotFound(_0x925fa2,null))['then'](function(_0x37dd67){if(_0x37dd67){return db[_0xf0a9('0x60')][_0xf0a9('0x56')](function(_0x29ec91){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x33edd1[_0xf0a9('0x4a')]['id'],'sectionId':_[_0xf0a9('0x32')](_0x4ebfe8,function(_0x5b9bfa){return _0x5b9bfa[_0xf0a9('0x5c')];})},'transaction':_0x29ec91})[_0xf0a9('0x2b')](function(){var _0x47903d=_[_0xf0a9('0x32')](_0x4ebfe8,function(_0x3e94eb){_0x3e94eb['userProfileId']=_0x33edd1['params']['id'];return _0x3e94eb;});var _0x277e95=[];return BPromise['each'](_0x47903d,function(_0x2946b7){return db[_0xf0a9('0x58')]['create'](_0x2946b7,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x29ec91})[_0xf0a9('0x2b')](function(_0x2153ed){_0x277e95[_0xf0a9('0x61')](_0x2153ed[_0xf0a9('0x57')]({'plain':!![]}));});})[_0xf0a9('0x2b')](function(){return _0x277e95;});});});}})['then'](function(_0x24713c){return _0x24713c;})[_0xf0a9('0x2b')](respondWithResult(_0x925fa2,null))['catch'](handleError(_0x925fa2,null));};exports[_0xf0a9('0x62')]=function(_0xa3b133,_0x27a615){var _0xff73aa;return db['UserProfile'][_0xf0a9('0x4d')]({'where':{'id':_0xa3b133[_0xf0a9('0x4a')]['id']},'attributes':['id','name']})[_0xf0a9('0x2b')](handleEntityNotFound(_0x27a615,null))[_0xf0a9('0x2b')](function(_0x317926){if(_0x317926){_0xff73aa=_0x317926;return db['UserProfileSection'][_0xf0a9('0x63')]({'where':{'userProfileId':_0xa3b133[_0xf0a9('0x4a')]['id'],'sectionId':_0xa3b133[_0xf0a9('0x39')][_0xf0a9('0x64')]}});}})[_0xf0a9('0x2b')](function(){return _0xff73aa;})[_0xf0a9('0x2b')](respondWithStatusCode(_0x27a615,null))[_0xf0a9('0x48')](handleError(_0x27a615,null));};exports[_0xf0a9('0x65')]=function(_0x1b6e7b,_0x142778){var _0x3bcbc1=[];var _0x3f330d=[];return db[_0xf0a9('0x58')][_0xf0a9('0x59')]({'where':{'userProfileId':_0x1b6e7b[_0xf0a9('0x4a')]['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0xdc3b32){_0x3bcbc1=_[_0xf0a9('0x43')](_0xdc3b32,function(_0x5a54ab){return _0x5a54ab[_0xf0a9('0x66')]===0x1||_[_0xf0a9('0x67')]([0x3eb,0x709],_0x5a54ab[_0xf0a9('0x5c')]);});if(!_[_0xf0a9('0x68')](_0x3bcbc1)){return _[_0xf0a9('0x32')](_0x3bcbc1,function(_0x19cec9){return _0x19cec9['sectionId'];});}else{return;}})[_0xf0a9('0x2b')](function(_0x168a76){if(_0x168a76)_0x3f330d=_0x168a76;if(_[_0xf0a9('0x67')](_0x3f330d,0x64)){var _0x5f4a27=_[_0xf0a9('0x4d')](_0x3bcbc1,{'sectionId':0x64});return hasDefaultDashboard(_0x5f4a27)['then'](function(_0x4d00f0){return _[_0xf0a9('0x32')](_0x3bcbc1,function(_0x2f65c9){if(_0x2f65c9[_0xf0a9('0x5c')]===0x64){_0x2f65c9[_0xf0a9('0x69')]=_0x4d00f0;}return _0x2f65c9;});});}else{return;}})[_0xf0a9('0x2b')](function(_0x1c1ac5){if(_0x1c1ac5)_0x3bcbc1=_0x1c1ac5;if(_[_0xf0a9('0x67')](_0x3f330d,0x3eb)){var _0x36032f=_[_0xf0a9('0x4d')](_0x3bcbc1,{'sectionId':0x3eb});return getCustomDashboards(_0x36032f)[_0xf0a9('0x2b')](function(_0x4afbda){return _[_0xf0a9('0x32')](_0x3bcbc1,function(_0x40259a){if(_0x36032f[_0xf0a9('0x66')]){if(_0x40259a[_0xf0a9('0x5c')]===0x3eb){_0x40259a[_0xf0a9('0x69')]=_0x4afbda;}}else{if(_0x40259a['sectionId']===0x64){_0x40259a[_0xf0a9('0x69')]=_0x4afbda;}}return _0x40259a;});});}else{return;}})['then'](function(_0x4689e6){if(_0x4689e6)_0x3bcbc1=_0x4689e6;if(_[_0xf0a9('0x67')](_0x3f330d,0x709)){var _0x23f1b3=_['find'](_0x3bcbc1,{'sectionId':0x709});return getPlugins(_0x23f1b3)[_0xf0a9('0x2b')](function(_0x45dd50){if(_0x23f1b3[_0xf0a9('0x66')]){return _['map'](_0x3bcbc1,function(_0x9080b4){if(_0x9080b4['sectionId']===0x709){_0x9080b4[_0xf0a9('0x69')]=_0x45dd50;}return _0x9080b4;});}else{var _0x38070d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x45dd50};var _0x5b6df2=_['map'](_0x3bcbc1);_0x5b6df2[_0xf0a9('0x61')](_0x38070d);return _0x5b6df2;}});}else{return;}})[_0xf0a9('0x2b')](function(_0x58232c){if(_0x58232c)_0x3bcbc1=_0x58232c;return _[_0xf0a9('0x43')](_0x3bcbc1,[_0xf0a9('0x66'),0x1]);})['then'](respondWithResult(_0x142778,null))['catch'](handleError(_0x142778,null));};function hasDefaultDashboard(_0x537f31){var _0x3a01b6=[0x65];return new BPromise(function(_0x414e80,_0x435009){try{if(_0x537f31[_0xf0a9('0x5a')]){_0x414e80(_0x3a01b6);}else{return db[_0xf0a9('0x5b')][_0xf0a9('0x6a')]({'where':{'sectionId':_0x537f31['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0x396da7){_0x396da7?_0x414e80(_0x3a01b6):_0x414e80();});}}catch(_0x1a8e87){_0x435009(_0x1a8e87);}});}function getCustomDashboards(_0xa19a23){var _0x5ce5eb=[];return new BPromise(function(_0x4ebd8e,_0x2fb8b9){try{if(_0xa19a23['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0xf0a9('0x2b')](function(_0x296021){_0x296021[_0xf0a9('0x6b')](function(_0x3ad673){_0x5ce5eb['push'](_0x3ad673['id']+0x1869f);});_0x4ebd8e(_0x5ce5eb);});}else{return db[_0xf0a9('0x5b')][_0xf0a9('0x59')]({'where':{'sectionId':_0xa19a23['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0x55fc81){_0x55fc81[_0xf0a9('0x6b')](function(_0x52269c){_0x5ce5eb[_0xf0a9('0x61')](_0x52269c[_0xf0a9('0x6c')]+0x1869f);});_0x4ebd8e(_0x5ce5eb);});}}catch(_0x26311b){_0x2fb8b9(_0x26311b);}});}function getPlugins(_0x3d2a7a){var _0x174ce7=[];return new BPromise(function(_0x52061e,_0x713c90){try{if(_0x3d2a7a[_0xf0a9('0x5a')]){return db[_0xf0a9('0x6d')][_0xf0a9('0x59')]({'raw':!![]})[_0xf0a9('0x2b')](function(_0x26450e){_0x26450e['forEach'](function(_0x2da9b0){_0x174ce7['push'](_0x2da9b0['id']+0x15b38);});_0x52061e(_0x174ce7);});}else{return db[_0xf0a9('0x5b')][_0xf0a9('0x59')]({'where':{'sectionId':_0x3d2a7a['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0x571808){_0x571808[_0xf0a9('0x6b')](function(_0x404c98){_0x174ce7[_0xf0a9('0x61')](_0x404c98[_0xf0a9('0x6c')]+0x15b38);});_0x52061e(_0x174ce7);});}}catch(_0x3c1cdf){_0x713c90(_0x3c1cdf);}});}exports[_0xf0a9('0x6e')]=function(_0x34cde6,_0x2a6f2d){return db[_0xf0a9('0x33')][_0xf0a9('0x4d')]({'where':{'id':_0x34cde6['params']['id']}})['then'](handleEntityNotFound(_0x2a6f2d,null))[_0xf0a9('0x2b')](function(_0x53bdc5){if(_0x53bdc5){return db[_0xf0a9('0x60')][_0xf0a9('0x56')](function(_0x9c81f1){return db[_0xf0a9('0x58')]['findAll']({'where':{'userProfileId':_0x34cde6[_0xf0a9('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xf0a9('0x2b')](function(_0x20424f){if(_0x20424f){return db[_0xf0a9('0x58')]['destroy']({'where':{'userProfileId':_0x34cde6[_0xf0a9('0x4a')]['id'],'id':_[_0xf0a9('0x32')](_0x20424f,function(_0x274813){return _0x274813['id'];})},'transaction':_0x9c81f1});}})[_0xf0a9('0x2b')](function(_0x241227){var _0x199b0d=_[_0xf0a9('0x32')](_0x34cde6[_0xf0a9('0x4f')],function(_0x2b9bcf){_0x2b9bcf[_0xf0a9('0x6f')]=_0x34cde6[_0xf0a9('0x4a')]['id'];return _0x2b9bcf;});return db[_0xf0a9('0x58')][_0xf0a9('0x70')](_0x199b0d,{'raw':!![],'transaction':_0x9c81f1});})[_0xf0a9('0x2b')](function(_0x5d42e5){var _0x770cef=_['filter'](_[_0xf0a9('0x32')](_0x5d42e5,function(_0x44f252){return _0x44f252[_0xf0a9('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x770cef){return db[_0xf0a9('0x58')][_0xf0a9('0x59')]({'where':{'userProfileId':_0x34cde6[_0xf0a9('0x4a')]['id'],'sectionId':_[_0xf0a9('0x32')](_0x770cef,function(_0x2cc8b3){return _0x2cc8b3[_0xf0a9('0x5c')];})},'attributes':['id',_0xf0a9('0x5c')],'raw':!![]})[_0xf0a9('0x2b')](function(_0xcb265f){var _0x2c6076=_[_0xf0a9('0x32')](_0x34cde6[_0xf0a9('0x4f')],function(_0x1bef71){_0x1bef71['userProfileId']=_0x34cde6[_0xf0a9('0x4a')]['id'];return _0x1bef71;});return db[_0xf0a9('0x5b')][_0xf0a9('0x70')](_0x2c6076,{'raw':!![],'transaction':_0x9c81f1});});}})['catch'](handleError(_0x2a6f2d,null));});}})[_0xf0a9('0x2b')](function(_0x162990){var _0x1595bf=_[_0xf0a9('0x32')](_0x162990,function(_0x3aaec2){return _0x3aaec2[_0xf0a9('0x57')]({'plain':!![]});});})[_0xf0a9('0x2b')](respondWithResult(_0x2a6f2d,null))[_0xf0a9('0x48')](handleError(_0x2a6f2d,null));};exports[_0xf0a9('0x71')]=function(_0x5de236,_0x415944,_0x2d9e13){return db[_0xf0a9('0x33')][_0xf0a9('0x4d')]({'where':{'id':_0x5de236[_0xf0a9('0x4a')]['id']}})[_0xf0a9('0x2b')](handleEntityNotFound(_0x415944,null))[_0xf0a9('0x2b')](function(_0x5e3565){if(_0x5e3565){return _0x5e3565[_0xf0a9('0x71')](_0x5de236[_0xf0a9('0x39')][_0xf0a9('0x64')]);}})[_0xf0a9('0x2b')](respondWithStatusCode(_0x415944,null))[_0xf0a9('0x48')](handleError(_0x415944,null));};exports['getResources']=function(_0x579f8c,_0xe6b539){var _0x463d14={'raw':![],'where':{}};var _0x14da60={};var _0x29feb9={'count':0x0,'rows':[]};var _0x442a39=_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x72')];if(typeof _0x442a39==='undefined'){throw new db[(_0xf0a9('0x73'))][(_0xf0a9('0x74'))](_0xf0a9('0x75'));}var _0x189ada=_0x579f8c['query'][_0xf0a9('0x76')]||![];var _0x5ac4cf=getQueryModels(_0x442a39,_0x189ada);if(typeof _0x5ac4cf['childModel']===_0xf0a9('0x77')){throw new db[(_0xf0a9('0x73'))][(_0xf0a9('0x74'))](_0xf0a9('0x78')+_0x442a39+'\x27');}var _0x40de92=[];if(!_['isEmpty'](_0x5ac4cf[_0xf0a9('0x79')])){_0x40de92=_0x5ac4cf[_0xf0a9('0x79')];}else{_0x40de92=[{'name':_0x442a39}];}return db['UserProfile'][_0xf0a9('0x6a')]({'where':{'id':_0x579f8c[_0xf0a9('0x4a')]['id']}})[_0xf0a9('0x2b')](handleEntityNotFound(_0xe6b539,null))[_0xf0a9('0x2b')](function(_0x556dea){if(_0x556dea){var _0x105f15=[];for(var _0x52a92d=0x0;_0x52a92d<_0x40de92[_0xf0a9('0x4b')];_0x52a92d++){_0x105f15[_0xf0a9('0x61')](db[_0xf0a9('0x58')][_0xf0a9('0x6a')]({'where':{'userProfileId':_0x556dea['id'],'name':_0x40de92[_0x52a92d][_0xf0a9('0x2f')]},'raw':!![]}));}return BPromise['all'](_0x105f15);}})[_0xf0a9('0x2b')](function(_0x38b749){var _0x4853f4=_[_0xf0a9('0x43')](_0x38b749,function(_0x3f8477){return _0x3f8477?_0x3f8477:undefined;});var _0x386499=_['filter'](_0x40de92,[_0xf0a9('0x7a'),!![]]);var _0x52fe39=_[_0xf0a9('0x68')](_0x4853f4)&&_[_0xf0a9('0x68')](_0x386499)?null:_['union'](_0x386499,_0x4853f4);if(_0x52fe39){var _0xa1e659=[];for(var _0x2fa590=0x0;_0x2fa590<_0x52fe39[_0xf0a9('0x4b')];_0x2fa590++){var _0xa3bad0=_[_0xf0a9('0x4d')](_0x40de92,function(_0x1f5887){return _0x52fe39[_0x2fa590]?_0x1f5887[_0xf0a9('0x2f')]===_0x52fe39[_0x2fa590][_0xf0a9('0x2f')]:null;});if(_0xa3bad0){if(_0x52fe39[_0x2fa590]['ignore']){_0xa1e659['push'](getAllResources(_0x5ac4cf[_0xf0a9('0x7b')],_0x52fe39[_0x2fa590]));}else{if(!_0x52fe39[_0x2fa590][_0xf0a9('0x5a')]){_0xa1e659[_0xf0a9('0x61')](getAllowedResources(_0xa3bad0,_0x52fe39[_0x2fa590],_0x5ac4cf[_0xf0a9('0x7b')]));}else{if(_0xa3bad0[_0xf0a9('0x38')]){_0xa1e659[_0xf0a9('0x61')](getAllFilteredResources(_0xa3bad0,_0x52fe39[_0x2fa590]));}}}}}return BPromise['all'](_0xa1e659);}else{return null;}})[_0xf0a9('0x2b')](function(_0x56624b){var _0x4ee230=_0x56624b;var _0x1da002=null;if(_0x4ee230){_0x1da002=_0x4ee230[_0xf0a9('0x4b')]===0x1?_0x4ee230[0x0]:null;}if(_0x1da002||_0x4ee230){var _0x13ef10=db[_0x5ac4cf[_0xf0a9('0x7b')]][_0xf0a9('0x34')];_0x14da60[_0xf0a9('0x38')]=_[_0xf0a9('0x3a')](_0x13ef10);_0x14da60[_0xf0a9('0x39')]=_['keys'](_0x579f8c[_0xf0a9('0x39')]);_0x14da60[_0xf0a9('0x3b')]=_[_0xf0a9('0x3c')](_0x14da60[_0xf0a9('0x38')],_0x14da60[_0xf0a9('0x39')]);_0x463d14[_0xf0a9('0x3e')]=_[_0xf0a9('0x3c')](_0x14da60['model'],qs[_0xf0a9('0x3d')](_0x579f8c[_0xf0a9('0x39')]['fields']));_0x463d14[_0xf0a9('0x3e')]=_0x463d14['attributes'][_0xf0a9('0x4b')]?_0x463d14['attributes']:_0x14da60['model'];if(!_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x3f')](_0xf0a9('0x7c'))){_0x463d14[_0xf0a9('0x26')]=qs[_0xf0a9('0x26')](_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x26')]);_0x463d14['offset']=qs[_0xf0a9('0x25')](_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x25')]);}_0x463d14[_0xf0a9('0x7d')]=qs[_0xf0a9('0x40')](_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x40')]);_0x463d14[_0xf0a9('0x41')]=qs[_0xf0a9('0x3b')](_[_0xf0a9('0x42')](_0x579f8c[_0xf0a9('0x39')],_0x14da60['filters']));if(_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x43')]){_0x463d14[_0xf0a9('0x41')]=_[_0xf0a9('0x45')](_0x463d14[_0xf0a9('0x41')],{'$or':_[_0xf0a9('0x32')](_0x13ef10,function(_0x4bb5f5){if(_0x4bb5f5['type'][_0xf0a9('0x37')]!==_0xf0a9('0x44')){var _0x31fbb2={};_0x31fbb2[_0x4bb5f5[_0xf0a9('0x7e')]]={'$like':'%'+_0x579f8c['query'][_0xf0a9('0x43')]+'%'};return _0x31fbb2;}})});}var _0x1633fa=[];if(_0x1da002){var _0x2c69d4=_[_0xf0a9('0x4d')](_0x40de92,[_0xf0a9('0x2f'),_0x1da002[_0xf0a9('0x2f')]]);if(_0x2c69d4[_0xf0a9('0x7e')]){var _0x5031bd={};if(_0x5ac4cf[_0xf0a9('0x7b')]==='AnalyticExtractedReport'){_0x5031bd[_0x2c69d4['foreignKey']]=_[_0xf0a9('0x32')](_0x1da002[_0xf0a9('0x7f')],'id');}else{_0x5031bd[_0x2c69d4[_0xf0a9('0x80')]]=_0x1da002[_0xf0a9('0x7f')];}_0x1633fa[_0xf0a9('0x61')](_0x5031bd);}else{_0x463d14[_0xf0a9('0x41')]['id']=_0x1da002['associatedResources'];}}else{for(var _0x5949e4=0x0;_0x5949e4<_0x4ee230[_0xf0a9('0x4b')];_0x5949e4++){var _0x2c69d4=_['find'](_0x40de92,[_0xf0a9('0x2f'),_0x4ee230[_0x5949e4]['name']]);if(_0x2c69d4['field']){var _0x5031bd={};_0x5031bd[_0x2c69d4[_0xf0a9('0x80')]]=_0x4ee230[_0x5949e4][_0xf0a9('0x7f')];_0x1633fa[_0xf0a9('0x61')](_0x5031bd);}else{if(!_0x463d14[_0xf0a9('0x41')]['id'])_0x463d14[_0xf0a9('0x41')]['id']=[];_0x4ee230[_0x5949e4]['associatedResources'][_0xf0a9('0x6b')](function(_0x147e21){_0x463d14[_0xf0a9('0x41')]['id']['push'](_0x147e21);});}}}if(!_[_0xf0a9('0x68')](_0x1633fa)){_0x463d14[_0xf0a9('0x41')]=_[_0xf0a9('0x45')](_0x463d14[_0xf0a9('0x41')],{'$and':{'$or':_0x1633fa}});}_0x463d14=_[_0xf0a9('0x45')]({},_0x463d14,_0x579f8c[_0xf0a9('0x51')]);if(_0x1da002&&!_0x1da002[_0xf0a9('0x5a')]&&_0x5ac4cf[_0xf0a9('0x7b')]===_0xf0a9('0x81')){if(_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x46')]){_0x463d14['include']=[{'all':!![]}];}return db[_0x5ac4cf[_0xf0a9('0x7b')]]['findAll'](_0x463d14)['then'](function(_0x14d721){var _0x20f0b6=[];_0x14d721['forEach'](function(_0x24336c){var _0x3d42eb;switch(_0x24336c[_0xf0a9('0x82')]){case _0xf0a9('0x83'):_0x3d42eb=_[_0xf0a9('0x4d')](_0x1da002[_0xf0a9('0x7f')],function(_0xa9cde8){return _0xa9cde8['id']===_0x24336c[_0xf0a9('0x84')]&&_0xa9cde8[_0xf0a9('0x36')]===_0xf0a9('0x85');});break;case _0xf0a9('0x86'):_0x3d42eb=_[_0xf0a9('0x4d')](_0x1da002['associatedResources'],function(_0x3967b9){return _0x3967b9['id']===_0x24336c[_0xf0a9('0x84')]&&_0x3967b9[_0xf0a9('0x36')]===_0xf0a9('0x87');});break;}if(_0x3d42eb)_0x20f0b6[_0xf0a9('0x61')](_0x24336c);});_0x29feb9['count']=_0x20f0b6[_0xf0a9('0x4b')];_0x29feb9[_0xf0a9('0x47')]=_0x20f0b6;return _0x29feb9;});}else{return db[_0x5ac4cf[_0xf0a9('0x7b')]][_0xf0a9('0x24')]({'where':_0x463d14[_0xf0a9('0x41')]})[_0xf0a9('0x2b')](function(_0x3bdb60){_0x29feb9['count']=_0x3bdb60;if(_0x579f8c[_0xf0a9('0x39')]['includeAll']){if(_0x5ac4cf['childModel']==='CmContact'){_0x463d14[_0xf0a9('0x4c')]=[{'model':db['Tag'],'as':_0xf0a9('0x88'),'attributes':['id',_0xf0a9('0x2f'),_0xf0a9('0x89')],'required':_0x579f8c['query'][_0xf0a9('0x8a')]?!![]:![]},{'model':db[_0xf0a9('0x8b')],'as':_0xf0a9('0x8c'),'attributes':['id','name',_0xf0a9('0x89')],'through':_0x579f8c[_0xf0a9('0x39')]['tag']?{'attributes':[],'where':{'TagId':_0x579f8c[_0xf0a9('0x39')][_0xf0a9('0x8a')]||undefined}}:{},'required':_0x579f8c['query']['tag']?!![]:![]}];}else{_0x463d14[_0xf0a9('0x4c')]=[{'all':!![]}];}}return db[_0x5ac4cf[_0xf0a9('0x7b')]]['findAll'](_0x463d14);})[_0xf0a9('0x2b')](function(_0x5a853b){_0x29feb9[_0xf0a9('0x47')]=_0x5a853b;return _0x29feb9;});}}else{return _0x29feb9;}})['then'](respondWithFilteredResult(_0xe6b539,_0x463d14))[_0xf0a9('0x48')](handleError(_0xe6b539,null));};function getAllResources(_0x5c733c,_0x32d4e2){return new BPromise(function(_0x538793,_0x280532){if(_0x32d4e2){var _0x4c6b5c=_0x32d4e2[_0xf0a9('0x43')]?{[_0x32d4e2[_0xf0a9('0x43')][_0xf0a9('0x7e')]]:_0x32d4e2['filter'][_0xf0a9('0x8d')]}:undefined;return db[_0x5c733c][_0xf0a9('0x59')]({'where':_0x4c6b5c,'raw':!![]})[_0xf0a9('0x2b')](function(_0xeb62cf){_0x32d4e2['associatedResources']=_['map'](_0xeb62cf,'id');_0x538793(_0x32d4e2);})[_0xf0a9('0x48')](function(_0x562c34){_0x280532(_0x562c34);});}else{_0x538793(null);}});}function getAllFilteredResources(_0x2b2a11,_0x447412){return new BPromise(function(_0x21868b,_0x54d0a7){var _0x42ea10=_0x2b2a11[_0xf0a9('0x43')]?{[_0x2b2a11[_0xf0a9('0x43')][_0xf0a9('0x7e')]]:_0x2b2a11['filter'][_0xf0a9('0x8d')]}:undefined;return db[_0x2b2a11['model']][_0xf0a9('0x59')]({'where':_0x42ea10,'raw':!![]})[_0xf0a9('0x2b')](function(_0x40655d){_0x447412[_0xf0a9('0x7f')]=_['map'](_0x40655d,function(_0x1f7f13){return _0x1f7f13[_0xf0a9('0x2f')];});_0x21868b(_0x447412);})[_0xf0a9('0x48')](function(_0x55cb91){_0x54d0a7(_0x55cb91);});});}function getAllowedResources(_0x31240a,_0x32c73b,_0x3acab2){return new BPromise(function(_0x38fc35,_0x1538ad){if(_0x32c73b){return db[_0xf0a9('0x5b')]['findAll']({'where':{'sectionId':_0x32c73b['id']},'raw':!![]})[_0xf0a9('0x2b')](function(_0x2363b6){if(_0x31240a[_0xf0a9('0x7e')]&&_0x31240a[_0xf0a9('0x7e')]!=='id'){_0x32c73b['associatedResources']=_[_0xf0a9('0x32')](_0x2363b6,function(_0x9591e){return _0x9591e[_0x31240a[_0xf0a9('0x7e')]];});}else{if(_0x3acab2===_0xf0a9('0x81')){_0x32c73b['associatedResources']=_[_0xf0a9('0x32')](_0x2363b6,function(_0x4aa9b0){return{'id':_0x4aa9b0[_0xf0a9('0x6c')],'type':_0x4aa9b0[_0xf0a9('0x36')]};});}else{_0x32c73b[_0xf0a9('0x7f')]=_['map'](_0x2363b6,function(_0x53f0c7){return _0x53f0c7[_0xf0a9('0x6c')];});}}_0x38fc35(_0x32c73b);})[_0xf0a9('0x48')](function(_0x387ce1){_0x1538ad(_0x387ce1);});}else{_0x38fc35(null);}});}function getQueryModels(_0x1df006,_0x319400){var _0x433eeb=_0x1df006['toLowerCase']();var _0x2c660b={'childModel':undefined,'parentSections':[]};switch(_0x433eeb){case'squareprojects':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x8e');break;case'odbc':_0x2c660b[_0xf0a9('0x7b')]='SquareOdbc';break;case _0xf0a9('0x8f'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x90');_0x2c660b[_0xf0a9('0x79')]=[{'name':'SquareProjects','field':_0xf0a9('0x2f'),'foreignKey':_0xf0a9('0x91')}];break;case _0xf0a9('0x92'):_0x2c660b[_0xf0a9('0x7b')]='JscriptyProject';break;case _0xf0a9('0x93'):_0x2c660b['childModel']='CmContact';_0x2c660b[_0xf0a9('0x79')]=[{'name':_0xf0a9('0x94'),'field':'id','foreignKey':'ListId'}];break;case _0xf0a9('0x95'):_0x2c660b['childModel']=_0xf0a9('0x96');break;case _0xf0a9('0x97'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x98');break;case'globalcustomfields':_0x2c660b['childModel']=_0xf0a9('0x99');break;case'chatqueues':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x9a');break;case _0xf0a9('0x9b'):_0x2c660b['childModel']=_0xf0a9('0x9c');break;case _0xf0a9('0x9d'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x9e');break;case _0xf0a9('0x9f'):_0x2c660b['childModel']=_0xf0a9('0xa0');break;case _0xf0a9('0xa1'):case _0xf0a9('0xa2'):case _0xf0a9('0xa3'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xa4');break;case _0xf0a9('0xa5'):_0x2c660b['childModel']=_0xf0a9('0xa6');break;case _0xf0a9('0xa7'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xa8');break;case'voicerecordings':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xa9');_0x2c660b[_0xf0a9('0x79')]=[{'name':_0xf0a9('0xaa'),'field':_0xf0a9('0x2f'),'foreignKey':_0xf0a9('0xab'),'model':'User','filter':{'field':_0xf0a9('0xac'),'value':['agent']}},{'name':_0xf0a9('0xad'),'field':'name','foreignKey':_0xf0a9('0xab'),'model':_0xf0a9('0xae'),'filter':{'field':_0xf0a9('0xac'),'value':['telephone']}},{'name':_0xf0a9('0xaf'),'field':'name','foreignKey':'queue','model':_0xf0a9('0xb0'),'filter':{'field':_0xf0a9('0x36'),'value':['inbound']}},{'name':_0xf0a9('0xb1'),'field':_0xf0a9('0x2f'),'foreignKey':_0xf0a9('0xb2'),'model':_0xf0a9('0xb0'),'filter':{'field':_0xf0a9('0x36'),'value':[_0xf0a9('0xb3')]}}];break;case _0xf0a9('0xb4'):_0x2c660b['childModel']='VoiceMusicOnHold';break;case _0xf0a9('0xb5'):_0x2c660b['childModel']=_0xf0a9('0xb6');break;case _0xf0a9('0xb7'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xb8');break;case _0xf0a9('0xb9'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xba');break;case _0xf0a9('0xbb'):_0x2c660b[_0xf0a9('0x7b')]='MailQueue';break;case _0xf0a9('0xbc'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xbd');break;case _0xf0a9('0xbe'):_0x2c660b[_0xf0a9('0x7b')]='MailSubstatus';break;case _0xf0a9('0xbf'):_0x2c660b['childModel']='OpenchannelQueue';break;case _0xf0a9('0xc0'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xc1');break;case _0xf0a9('0xc2'):_0x2c660b[_0xf0a9('0x7b')]='SmsQueue';break;case'smsaccounts':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xc3');break;case'whatsappqueues':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xc4');break;case'whatsappaccounts':_0x2c660b[_0xf0a9('0x7b')]='WhatsappAccount';break;case'teams':_0x2c660b['childModel']=_0xf0a9('0xc5');break;case _0xf0a9('0xc6'):case _0xf0a9('0xc7'):_0x2c660b['childModel']=_0xf0a9('0xb0');if(_0x319400){_0x2c660b[_0xf0a9('0x79')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0xf0a9('0xc8'):case'telephones':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xae');if(_0x319400){_0x2c660b[_0xf0a9('0x79')]=[{'name':_0xf0a9('0xc9'),'filter':{'field':_0xf0a9('0xac'),'value':[_0xf0a9('0xca'),'user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xf0a9('0xcb'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xcc');break;case'salesforceaccounts':_0x2c660b['childModel']=_0xf0a9('0xcd');break;case _0xf0a9('0xce'):_0x2c660b['childModel']=_0xf0a9('0xcf');break;case'sugarcrmaccounts':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xd0');break;case'deskaccounts':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xd1');break;case _0xf0a9('0xd2'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xd3');break;case _0xf0a9('0xd4'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xae');break;case _0xf0a9('0xd5'):_0x2c660b[_0xf0a9('0x7b')]='CannedAnswer';break;case'dispositions':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xd6');break;case _0xf0a9('0xd7'):_0x2c660b['childModel']=_0xf0a9('0xd8');break;case _0xf0a9('0xd9'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xda');break;case _0xf0a9('0xdb'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xdc');break;case'scheduler':_0x2c660b[_0xf0a9('0x7b')]='Schedule';break;case _0xf0a9('0xdd'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xde');break;case _0xf0a9('0xdf'):_0x2c660b['childModel']=_0xf0a9('0x8b');break;case _0xf0a9('0xe0'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xe1');break;case'triggers':_0x2c660b[_0xf0a9('0x7b')]='Trigger';break;case'trunks':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xe2');break;case _0xf0a9('0xe3'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xe4');break;case _0xf0a9('0xe5'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x6d');break;case _0xf0a9('0xe6'):_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0x81');_0x2c660b['parentSections']=[{'name':_0xf0a9('0xe7'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x2c660b[_0xf0a9('0x7b')]=_0xf0a9('0xe8');break;case _0xf0a9('0xe9'):_0x2c660b['childModel']=_0xf0a9('0xea');break;default:return _0x2c660b;}return _0x2c660b;} \ No newline at end of file +var _0xb67c=['push','removeSections','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','ValidationError','parentSections','findOne','all','ignore','union','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','telephone','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','chanspies','VoiceChanSpy','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','User','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','scheduler','Schedule','sounds','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Reports','metrics','AnalyticMetric','whatsappaccounts','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','UserProfile','includeAll','include','findAll','rows','show','params','create','body','catch','clone','find','createdAt','updatedAt','omit','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId'];(function(_0x1ac5c0,_0x186f54){var _0x1e4606=function(_0x53a2c5){while(--_0x53a2c5){_0x1ac5c0['push'](_0x1ac5c0['shift']());}};_0x1e4606(++_0x186f54);}(_0xb67c,0x183));var _0xcb67=function(_0x3b5377,_0x1cf47a){_0x3b5377=_0x3b5377-0x0;var _0x40ffde=_0xb67c[_0x3b5377];return _0x40ffde;};'use strict';var pdf=require(_0xcb67('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcb67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb67('0x2'));var rp=require(_0xcb67('0x3'));var moment=require(_0xcb67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb67('0x5'));var util=require(_0xcb67('0x6'));var path=require(_0xcb67('0x7'));var sox=require(_0xcb67('0x8'));var csv=require('to-csv');var ejs=require(_0xcb67('0x9'));var fs=require('fs');var _=require(_0xcb67('0xa'));var squel=require(_0xcb67('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb67('0xc'));var deskjs=require(_0xcb67('0xd'));var toCsv=require(_0xcb67('0xe'));var querystring=require(_0xcb67('0xf'));var Papa=require(_0xcb67('0x10'));var Redis=require(_0xcb67('0x11'));var authService=require(_0xcb67('0x12'));var qs=require(_0xcb67('0x13'));var as=require(_0xcb67('0x14'));var hardwareService=require(_0xcb67('0x15'));var logger=require(_0xcb67('0x16'))(_0xcb67('0x17'));var utils=require(_0xcb67('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcb67('0x19'));var db=require(_0xcb67('0x1a'))['db'];config['redis']=_[_0xcb67('0x1b')](config[_0xcb67('0x1c')],{'host':_0xcb67('0x1d'),'port':0x18eb});var socket=require(_0xcb67('0x1e'))(new Redis(config['redis']));require(_0xcb67('0x1f'))['register'](socket);function respondWithStatusCode(_0x48151f,_0x3710e5){_0x3710e5=_0x3710e5||0xcc;return function(_0xde7012){if(_0xde7012){return _0x48151f['sendStatus'](_0x3710e5);}return _0x48151f[_0xcb67('0x20')](_0x3710e5)[_0xcb67('0x21')]();};}function respondWithResult(_0x14f630,_0x5951e0){_0x5951e0=_0x5951e0||0xc8;return function(_0x369fe4){if(_0x369fe4){return _0x14f630[_0xcb67('0x20')](_0x5951e0)[_0xcb67('0x22')](_0x369fe4);}};}function respondWithFilteredResult(_0x1a1662,_0x32b5af){return function(_0x4cb7eb){if(_0x4cb7eb){var _0x586ffc=_0x4cb7eb[_0xcb67('0x23')],_0x18b4f5=_0x32b5af['offset'],_0x21dcff=_0x32b5af[_0xcb67('0x24')]+_0x32b5af[_0xcb67('0x25')],_0x2b7ec8;if(_0x21dcff>=_0x586ffc){_0x21dcff=_0x586ffc;_0x2b7ec8=0xc8;}else{_0x2b7ec8=0xce;}_0x1a1662[_0xcb67('0x20')](_0x2b7ec8);return _0x1a1662[_0xcb67('0x26')](_0xcb67('0x27'),_0x18b4f5+'-'+_0x21dcff+'/'+_0x586ffc)['json'](_0x4cb7eb);}return null;};}function patchUpdates(_0x4d2c6a){return function(_0x3b6c80){try{jsonpatch['apply'](_0x3b6c80,_0x4d2c6a,!![]);}catch(_0x14fed6){return BPromise[_0xcb67('0x28')](_0x14fed6);}return _0x3b6c80['save']();};}function saveUpdates(_0x4cfcec,_0x5e90eb){return function(_0xb5b1fa){if(_0xb5b1fa){return _0xb5b1fa[_0xcb67('0x29')](_0x4cfcec)[_0xcb67('0x2a')](function(_0x157ce0){return _0x157ce0;});}return null;};}function removeEntity(_0x480ab0,_0x20294d){return function(_0x3fd4a4){if(_0x3fd4a4){return _0x3fd4a4[_0xcb67('0x2b')]()[_0xcb67('0x2a')](function(){_0x480ab0[_0xcb67('0x20')](0xcc)[_0xcb67('0x21')]();});}};}function handleEntityNotFound(_0xecbfd7,_0xed994e){return function(_0xcaf5b0){if(!_0xcaf5b0){_0xecbfd7[_0xcb67('0x2c')](0x194);}return _0xcaf5b0;};}function handleError(_0x4e85f8,_0x551d88){_0x551d88=_0x551d88||0x1f4;return function(_0x3070a1){logger['error'](_0x3070a1[_0xcb67('0x2d')]);if(_0x3070a1['name']){delete _0x3070a1[_0xcb67('0x2e')];}_0x4e85f8[_0xcb67('0x20')](_0x551d88)[_0xcb67('0x2f')](_0x3070a1);};}exports[_0xcb67('0x30')]=function(_0x5b1455,_0x5b8fe6){var _0x4ebb64={},_0x4cfbb7={},_0x573f88={'count':0x0,'rows':[]};var _0x5f564a=_[_0xcb67('0x31')](db['UserProfile'][_0xcb67('0x32')],function(_0x31dc5e){return{'name':_0x31dc5e[_0xcb67('0x33')],'type':_0x31dc5e[_0xcb67('0x34')][_0xcb67('0x35')]};});_0x4cfbb7[_0xcb67('0x36')]=_['map'](_0x5f564a,_0xcb67('0x2e'));_0x4cfbb7['query']=_[_0xcb67('0x37')](_0x5b1455[_0xcb67('0x38')]);_0x4cfbb7[_0xcb67('0x39')]=_[_0xcb67('0x3a')](_0x4cfbb7[_0xcb67('0x36')],_0x4cfbb7['query']);_0x4ebb64[_0xcb67('0x3b')]=_[_0xcb67('0x3a')](_0x4cfbb7['model'],qs[_0xcb67('0x3c')](_0x5b1455['query'][_0xcb67('0x3c')]));_0x4ebb64[_0xcb67('0x3b')]=_0x4ebb64[_0xcb67('0x3b')][_0xcb67('0x3d')]?_0x4ebb64[_0xcb67('0x3b')]:_0x4cfbb7['model'];if(!_0x5b1455[_0xcb67('0x38')][_0xcb67('0x3e')](_0xcb67('0x3f'))){_0x4ebb64[_0xcb67('0x25')]=qs[_0xcb67('0x25')](_0x5b1455[_0xcb67('0x38')][_0xcb67('0x25')]);_0x4ebb64[_0xcb67('0x24')]=qs[_0xcb67('0x24')](_0x5b1455[_0xcb67('0x38')][_0xcb67('0x24')]);}_0x4ebb64[_0xcb67('0x40')]=qs[_0xcb67('0x41')](_0x5b1455[_0xcb67('0x38')][_0xcb67('0x41')]);_0x4ebb64['where']=qs['filters'](_[_0xcb67('0x42')](_0x5b1455[_0xcb67('0x38')],_0x4cfbb7[_0xcb67('0x39')]),_0x5f564a);if(_0x5b1455[_0xcb67('0x38')][_0xcb67('0x43')]){_0x4ebb64[_0xcb67('0x44')]=_[_0xcb67('0x45')](_0x4ebb64[_0xcb67('0x44')],{'$or':_[_0xcb67('0x31')](_0x5f564a,function(_0x1f8269){if(_0x1f8269['type']!=='VIRTUAL'){var _0x17ac7e={};_0x17ac7e[_0x1f8269[_0xcb67('0x2e')]]={'$like':'%'+_0x5b1455[_0xcb67('0x38')][_0xcb67('0x43')]+'%'};return _0x17ac7e;}})});}_0x4ebb64=_[_0xcb67('0x45')]({},_0x4ebb64,_0x5b1455[_0xcb67('0x46')]);var _0x1f0b53={'where':_0x4ebb64[_0xcb67('0x44')]};return db[_0xcb67('0x47')]['count'](_0x1f0b53)[_0xcb67('0x2a')](function(_0x514ae4){_0x573f88[_0xcb67('0x23')]=_0x514ae4;if(_0x5b1455[_0xcb67('0x38')][_0xcb67('0x48')]){_0x4ebb64[_0xcb67('0x49')]=[{'all':!![]}];}return db[_0xcb67('0x47')][_0xcb67('0x4a')](_0x4ebb64);})[_0xcb67('0x2a')](function(_0x7c4787){_0x573f88[_0xcb67('0x4b')]=_0x7c4787;return _0x573f88;})[_0xcb67('0x2a')](respondWithFilteredResult(_0x5b8fe6,_0x4ebb64))['catch'](handleError(_0x5b8fe6,null));};exports[_0xcb67('0x4c')]=function(_0x31b804,_0x45b38d){var _0x4748fa={'raw':![],'where':{'id':_0x31b804[_0xcb67('0x4d')]['id']}},_0x358112={};_0x358112['model']=_[_0xcb67('0x37')](db[_0xcb67('0x47')][_0xcb67('0x32')]);_0x358112['query']=_[_0xcb67('0x37')](_0x31b804[_0xcb67('0x38')]);_0x358112['filters']=_[_0xcb67('0x3a')](_0x358112[_0xcb67('0x36')],_0x358112['query']);_0x4748fa[_0xcb67('0x3b')]=_[_0xcb67('0x3a')](_0x358112[_0xcb67('0x36')],qs[_0xcb67('0x3c')](_0x31b804['query'][_0xcb67('0x3c')]));_0x4748fa[_0xcb67('0x3b')]=_0x4748fa['attributes'][_0xcb67('0x3d')]?_0x4748fa[_0xcb67('0x3b')]:_0x358112[_0xcb67('0x36')];if(_0x31b804[_0xcb67('0x38')][_0xcb67('0x48')]){_0x4748fa[_0xcb67('0x49')]=[{'all':!![]}];}_0x4748fa=_[_0xcb67('0x45')]({},_0x4748fa,_0x31b804[_0xcb67('0x46')]);return db['UserProfile']['find'](_0x4748fa)[_0xcb67('0x2a')](handleEntityNotFound(_0x45b38d,null))[_0xcb67('0x2a')](respondWithResult(_0x45b38d,null))['catch'](handleError(_0x45b38d,null));};exports[_0xcb67('0x4e')]=function(_0x5274c0,_0x12739b){return db[_0xcb67('0x47')][_0xcb67('0x4e')](_0x5274c0[_0xcb67('0x4f')],{})[_0xcb67('0x2a')](respondWithResult(_0x12739b,0xc9))[_0xcb67('0x50')](handleError(_0x12739b,null));};exports[_0xcb67('0x51')]=function(_0x1cdc0d,_0x592609){var _0x3dc7b7={'where':{'id':_0x1cdc0d[_0xcb67('0x4d')]['id']}},_0xb5d591={};_0xb5d591[_0xcb67('0x36')]=_[_0xcb67('0x37')](db[_0xcb67('0x47')]['rawAttributes']);_0x3dc7b7[_0xcb67('0x3b')]=_[_0xcb67('0x3a')](_0xb5d591[_0xcb67('0x36')],qs[_0xcb67('0x3c')](_0x1cdc0d[_0xcb67('0x38')][_0xcb67('0x3c')]));_0x3dc7b7[_0xcb67('0x3b')]=_0x3dc7b7['attributes'][_0xcb67('0x3d')]?_0x3dc7b7[_0xcb67('0x3b')]:_0xb5d591[_0xcb67('0x36')];if(_0x1cdc0d[_0xcb67('0x38')][_0xcb67('0x48')]){_0x3dc7b7['include']=[{'all':!![]}];}_0x3dc7b7=_[_0xcb67('0x45')]({},_0x3dc7b7,_0x1cdc0d[_0xcb67('0x46')]);return db[_0xcb67('0x47')][_0xcb67('0x52')](_0x3dc7b7)[_0xcb67('0x2a')](handleEntityNotFound(_0x592609,null))[_0xcb67('0x2a')](function(_0x4dfc89){if(_0x4dfc89){var _0xa39f7d=_0x4dfc89['get']({'plain':!![]});_0xa39f7d=qs['omit'](_0xa39f7d,['id',_0xcb67('0x53'),_0xcb67('0x54'),'crudPermissions']);_0x1cdc0d[_0xcb67('0x4f')]=_[_0xcb67('0x55')](_0x1cdc0d['body'],['id',_0xcb67('0x53'),_0xcb67('0x54')]);return db[_0xcb67('0x56')][_0xcb67('0x57')](function(_0x1a7236){return db[_0xcb67('0x47')][_0xcb67('0x4e')](_[_0xcb67('0x45')](_0xa39f7d,_0x1cdc0d[_0xcb67('0x4f')]),{'include':_0x1cdc0d['query'][_0xcb67('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x1a7236})[_0xcb67('0x2a')](function(_0x754342){var _0xdb266e=_0x754342[_0xcb67('0x58')]({'plain':!![]});return db[_0xcb67('0x59')]['findAll']({'where':{'userProfileId':_0x1cdc0d[_0xcb67('0x4d')]['id']},'raw':!![]})[_0xcb67('0x2a')](function(_0x517123){if(_0x517123){return BPromise['each'](_0x517123,function(_0x3fa5a8){return new BPromise(function(_0x242a8f,_0x7d107b){if(_0x3fa5a8[_0xcb67('0x5a')]===null||_0x3fa5a8['autoAssociation']===0x1)_0x242a8f(null);return db[_0xcb67('0x5b')][_0xcb67('0x4a')]({'where':{'sectionId':_0x3fa5a8['id']},'raw':!![]})[_0xcb67('0x2a')](function(_0x39bc01){var _0x24be56=_['map'](_0x39bc01,function(_0x5571a6){return qs[_0xcb67('0x55')](_0x5571a6,['id','createdAt',_0xcb67('0x54'),_0xcb67('0x5c')]);});_0x242a8f(_0x24be56);})[_0xcb67('0x50')](function(_0x2f9cfc){_0x7d107b(_0x2f9cfc);});})[_0xcb67('0x2a')](function(_0x4b7fbe){var _0x33592a=qs[_0xcb67('0x55')](_0x3fa5a8,['id',_0xcb67('0x53'),'updatedAt']);_0x33592a['userProfileId']=_0xdb266e['id'];if(_0x4b7fbe)_0x33592a[_0xcb67('0x5d')]=_0x4b7fbe;return _0x33592a;})[_0xcb67('0x2a')](function(_0x3147da){return db[_0xcb67('0x59')][_0xcb67('0x4e')](_0x3147da,{'include':[{'model':db['UserProfileResource'],'as':_0xcb67('0x5d')}],'raw':!![],'transaction':_0x1a7236});});})[_0xcb67('0x2a')](function(){return _0xdb266e;});}});});});}})['then'](respondWithResult(_0x592609,0xc9))['catch'](handleError(_0x592609,null));};exports['update']=function(_0x2adc75,_0x3fcc9b){if(_0x2adc75[_0xcb67('0x4f')]['id']){delete _0x2adc75[_0xcb67('0x4f')]['id'];}return db[_0xcb67('0x47')][_0xcb67('0x52')]({'where':{'id':_0x2adc75[_0xcb67('0x4d')]['id']}})[_0xcb67('0x2a')](handleEntityNotFound(_0x3fcc9b,null))[_0xcb67('0x2a')](saveUpdates(_0x2adc75[_0xcb67('0x4f')],null))[_0xcb67('0x2a')](respondWithResult(_0x3fcc9b,null))[_0xcb67('0x50')](handleError(_0x3fcc9b,null));};exports['destroy']=function(_0x31e73f,_0x54015c){return db['UserProfile']['find']({'where':{'id':_0x31e73f[_0xcb67('0x4d')]['id']}})[_0xcb67('0x2a')](handleEntityNotFound(_0x54015c,null))['then'](removeEntity(_0x54015c,null))[_0xcb67('0x50')](handleError(_0x54015c,null));};exports[_0xcb67('0x5e')]=function(_0x426e66,_0x51fb2b){return db['UserProfile'][_0xcb67('0x5e')]()[_0xcb67('0x2a')](respondWithResult(_0x51fb2b,null))[_0xcb67('0x50')](handleError(_0x51fb2b,null));};exports[_0xcb67('0x5f')]=function(_0x40849a,_0x117275){var _0x2d72ae=_0x40849a[_0xcb67('0x4f')];return db[_0xcb67('0x47')][_0xcb67('0x52')]({'where':{'id':_0x40849a[_0xcb67('0x4d')]['id']}})['then'](handleEntityNotFound(_0x117275,null))[_0xcb67('0x2a')](function(_0x12cc76){if(_0x12cc76){return db[_0xcb67('0x56')][_0xcb67('0x57')](function(_0x4b2983){return db[_0xcb67('0x59')][_0xcb67('0x2b')]({'where':{'userProfileId':_0x40849a['params']['id'],'sectionId':_['map'](_0x2d72ae,function(_0x506544){return _0x506544[_0xcb67('0x5c')];})},'transaction':_0x4b2983})[_0xcb67('0x2a')](function(){var _0x4c0196=_[_0xcb67('0x31')](_0x2d72ae,function(_0x1be634){_0x1be634[_0xcb67('0x60')]=_0x40849a[_0xcb67('0x4d')]['id'];return _0x1be634;});var _0x48be43=[];return BPromise['each'](_0x4c0196,function(_0x4e4127){return db[_0xcb67('0x59')][_0xcb67('0x4e')](_0x4e4127,{'include':[{'model':db['UserProfileResource'],'as':_0xcb67('0x5d')}],'raw':!![],'transaction':_0x4b2983})['then'](function(_0x4714c3){_0x48be43[_0xcb67('0x61')](_0x4714c3['get']({'plain':!![]}));});})[_0xcb67('0x2a')](function(){return _0x48be43;});});});}})['then'](function(_0x4c6a8e){return _0x4c6a8e;})[_0xcb67('0x2a')](respondWithResult(_0x117275,null))[_0xcb67('0x50')](handleError(_0x117275,null));};exports[_0xcb67('0x62')]=function(_0x5495d6,_0x4c1f83){var _0x538401;return db[_0xcb67('0x47')][_0xcb67('0x52')]({'where':{'id':_0x5495d6['params']['id']},'attributes':['id','name']})[_0xcb67('0x2a')](handleEntityNotFound(_0x4c1f83,null))[_0xcb67('0x2a')](function(_0x51ed0){if(_0x51ed0){_0x538401=_0x51ed0;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5495d6['params']['id'],'sectionId':_0x5495d6[_0xcb67('0x38')]['ids']}});}})[_0xcb67('0x2a')](function(){return _0x538401;})[_0xcb67('0x2a')](respondWithStatusCode(_0x4c1f83,null))['catch'](handleError(_0x4c1f83,null));};exports[_0xcb67('0x63')]=function(_0x1e0363,_0x18054d){var _0x195e50=[];var _0x16539e=[];return db[_0xcb67('0x59')][_0xcb67('0x4a')]({'where':{'userProfileId':_0x1e0363[_0xcb67('0x4d')]['id']},'raw':!![]})['then'](function(_0x53e884){_0x195e50=_[_0xcb67('0x43')](_0x53e884,function(_0x506e25){return _0x506e25[_0xcb67('0x64')]===0x1||_[_0xcb67('0x65')]([0x3eb,0x709],_0x506e25[_0xcb67('0x5c')]);});if(!_[_0xcb67('0x66')](_0x195e50)){return _[_0xcb67('0x31')](_0x195e50,function(_0x489a86){return _0x489a86[_0xcb67('0x5c')];});}else{return;}})[_0xcb67('0x2a')](function(_0x9f0f34){if(_0x9f0f34)_0x16539e=_0x9f0f34;if(_['includes'](_0x16539e,0x64)){var _0x49021d=_['find'](_0x195e50,{'sectionId':0x64});return hasDefaultDashboard(_0x49021d)[_0xcb67('0x2a')](function(_0x50cc08){return _['map'](_0x195e50,function(_0x198e66){if(_0x198e66[_0xcb67('0x5c')]===0x64){_0x198e66[_0xcb67('0x67')]=_0x50cc08;}return _0x198e66;});});}else{return;}})['then'](function(_0x446c27){if(_0x446c27)_0x195e50=_0x446c27;if(_[_0xcb67('0x65')](_0x16539e,0x3eb)){var _0x46080=_['find'](_0x195e50,{'sectionId':0x3eb});return getCustomDashboards(_0x46080)[_0xcb67('0x2a')](function(_0x6b278e){return _[_0xcb67('0x31')](_0x195e50,function(_0x48894d){if(_0x46080['enabled']){if(_0x48894d[_0xcb67('0x5c')]===0x3eb){_0x48894d[_0xcb67('0x67')]=_0x6b278e;}}else{if(_0x48894d[_0xcb67('0x5c')]===0x64){_0x48894d[_0xcb67('0x67')]=_0x6b278e;}}return _0x48894d;});});}else{return;}})['then'](function(_0x310d06){if(_0x310d06)_0x195e50=_0x310d06;if(_[_0xcb67('0x65')](_0x16539e,0x709)){var _0x49c540=_[_0xcb67('0x52')](_0x195e50,{'sectionId':0x709});return getPlugins(_0x49c540)['then'](function(_0x483318){if(_0x49c540[_0xcb67('0x64')]){return _[_0xcb67('0x31')](_0x195e50,function(_0x3e8fc6){if(_0x3e8fc6['sectionId']===0x709){_0x3e8fc6[_0xcb67('0x67')]=_0x483318;}return _0x3e8fc6;});}else{var _0x281020={'sectionId':0x76c,'enabled':0x1,'subsections':_0x483318};var _0x37bb02=_[_0xcb67('0x31')](_0x195e50);_0x37bb02[_0xcb67('0x61')](_0x281020);return _0x37bb02;}});}else{return;}})[_0xcb67('0x2a')](function(_0x4ee79f){if(_0x4ee79f)_0x195e50=_0x4ee79f;return _[_0xcb67('0x43')](_0x195e50,[_0xcb67('0x64'),0x1]);})[_0xcb67('0x2a')](respondWithResult(_0x18054d,null))[_0xcb67('0x50')](handleError(_0x18054d,null));};function hasDefaultDashboard(_0x4d3c03){var _0x828890=[0x65];return new BPromise(function(_0x216edc,_0x594f9f){try{if(_0x4d3c03[_0xcb67('0x5a')]){_0x216edc(_0x828890);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x4d3c03['id']},'raw':!![]})['then'](function(_0x4956df){_0x4956df?_0x216edc(_0x828890):_0x216edc();});}}catch(_0x4a0fa7){_0x594f9f(_0x4a0fa7);}});}function getCustomDashboards(_0x3a45b2){var _0x566880=[];return new BPromise(function(_0x55ab24,_0xb6b008){try{if(_0x3a45b2['autoAssociation']){return db[_0xcb67('0x68')][_0xcb67('0x4a')]({'raw':!![]})[_0xcb67('0x2a')](function(_0x22ae2a){_0x22ae2a[_0xcb67('0x69')](function(_0x4a4a4e){_0x566880[_0xcb67('0x61')](_0x4a4a4e['id']+0x1869f);});_0x55ab24(_0x566880);});}else{return db[_0xcb67('0x5b')][_0xcb67('0x4a')]({'where':{'sectionId':_0x3a45b2['id']},'raw':!![]})[_0xcb67('0x2a')](function(_0x437ea3){_0x437ea3[_0xcb67('0x69')](function(_0x587f39){_0x566880[_0xcb67('0x61')](_0x587f39[_0xcb67('0x6a')]+0x1869f);});_0x55ab24(_0x566880);});}}catch(_0x355e85){_0xb6b008(_0x355e85);}});}function getPlugins(_0x4081d4){var _0x5d59f4=[];return new BPromise(function(_0x36e732,_0x1f70c2){try{if(_0x4081d4['autoAssociation']){return db[_0xcb67('0x6b')]['findAll']({'raw':!![]})[_0xcb67('0x2a')](function(_0x1eb564){_0x1eb564[_0xcb67('0x69')](function(_0x458c67){_0x5d59f4[_0xcb67('0x61')](_0x458c67['id']+0x15b38);});_0x36e732(_0x5d59f4);});}else{return db[_0xcb67('0x5b')][_0xcb67('0x4a')]({'where':{'sectionId':_0x4081d4['id']},'raw':!![]})['then'](function(_0x30bca8){_0x30bca8[_0xcb67('0x69')](function(_0x38a28f){_0x5d59f4[_0xcb67('0x61')](_0x38a28f[_0xcb67('0x6a')]+0x15b38);});_0x36e732(_0x5d59f4);});}}catch(_0x4714c5){_0x1f70c2(_0x4714c5);}});}exports['addResources']=function(_0x36530f,_0x5df6d7){return db[_0xcb67('0x47')]['find']({'where':{'id':_0x36530f[_0xcb67('0x4d')]['id']}})[_0xcb67('0x2a')](handleEntityNotFound(_0x5df6d7,null))[_0xcb67('0x2a')](function(_0x993e8c){if(_0x993e8c){return db[_0xcb67('0x56')][_0xcb67('0x57')](function(_0x384bff){return db[_0xcb67('0x59')][_0xcb67('0x4a')]({'where':{'userProfileId':_0x36530f['params']['id']},'attributes':['id'],'raw':!![]})[_0xcb67('0x2a')](function(_0x29f0f4){if(_0x29f0f4){return db[_0xcb67('0x59')][_0xcb67('0x2b')]({'where':{'userProfileId':_0x36530f[_0xcb67('0x4d')]['id'],'id':_['map'](_0x29f0f4,function(_0x43d66f){return _0x43d66f['id'];})},'transaction':_0x384bff});}})['then'](function(_0x33f3e2){var _0x20755c=_[_0xcb67('0x31')](_0x36530f[_0xcb67('0x4f')],function(_0x40c380){_0x40c380[_0xcb67('0x60')]=_0x36530f['params']['id'];return _0x40c380;});return db[_0xcb67('0x59')][_0xcb67('0x6c')](_0x20755c,{'raw':!![],'transaction':_0x384bff});})['then'](function(_0xa7d7e0){var _0x5bc3d4=_[_0xcb67('0x43')](_[_0xcb67('0x31')](_0xa7d7e0,function(_0x22b98d){return _0x22b98d[_0xcb67('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x5bc3d4){return db[_0xcb67('0x59')][_0xcb67('0x4a')]({'where':{'userProfileId':_0x36530f['params']['id'],'sectionId':_[_0xcb67('0x31')](_0x5bc3d4,function(_0x20efa9){return _0x20efa9[_0xcb67('0x5c')];})},'attributes':['id',_0xcb67('0x5c')],'raw':!![]})[_0xcb67('0x2a')](function(_0x1dba45){var _0x5394c3=_['map'](_0x36530f[_0xcb67('0x4f')],function(_0x5db208){_0x5db208[_0xcb67('0x60')]=_0x36530f[_0xcb67('0x4d')]['id'];return _0x5db208;});return db[_0xcb67('0x5b')]['bulkCreate'](_0x5394c3,{'raw':!![],'transaction':_0x384bff});});}})['catch'](handleError(_0x5df6d7,null));});}})['then'](function(_0x5c2b24){var _0x2cd637=_[_0xcb67('0x31')](_0x5c2b24,function(_0x30e124){return _0x30e124[_0xcb67('0x58')]({'plain':!![]});});})[_0xcb67('0x2a')](respondWithResult(_0x5df6d7,null))[_0xcb67('0x50')](handleError(_0x5df6d7,null));};exports[_0xcb67('0x6d')]=function(_0x462c18,_0x343d10,_0x36bc17){return db[_0xcb67('0x47')][_0xcb67('0x52')]({'where':{'id':_0x462c18[_0xcb67('0x4d')]['id']}})[_0xcb67('0x2a')](handleEntityNotFound(_0x343d10,null))[_0xcb67('0x2a')](function(_0x55d578){if(_0x55d578){return _0x55d578['removeResources'](_0x462c18[_0xcb67('0x38')]['ids']);}})[_0xcb67('0x2a')](respondWithStatusCode(_0x343d10,null))[_0xcb67('0x50')](handleError(_0x343d10,null));};exports[_0xcb67('0x6e')]=function(_0x48b5b8,_0x36cd5f){var _0x176436={'raw':![],'where':{}};var _0xdda365={};var _0x15214f={'count':0x0,'rows':[]};var _0x5d6221=_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x6f')];if(typeof _0x5d6221===_0xcb67('0x70')){throw new db[(_0xcb67('0x71'))]['ValidationError'](_0xcb67('0x72'));}var _0xbfffce=_0x48b5b8['query'][_0xcb67('0x73')]||![];var _0x37dac0=getQueryModels(_0x5d6221,_0xbfffce);if(typeof _0x37dac0[_0xcb67('0x74')]===_0xcb67('0x70')){throw new db[(_0xcb67('0x71'))][(_0xcb67('0x75'))]('Invalid\x20section\x20\x27'+_0x5d6221+'\x27');}var _0x21cb39=[];if(!_[_0xcb67('0x66')](_0x37dac0[_0xcb67('0x76')])){_0x21cb39=_0x37dac0[_0xcb67('0x76')];}else{_0x21cb39=[{'name':_0x5d6221}];}return db[_0xcb67('0x47')][_0xcb67('0x77')]({'where':{'id':_0x48b5b8[_0xcb67('0x4d')]['id']}})[_0xcb67('0x2a')](handleEntityNotFound(_0x36cd5f,null))['then'](function(_0x28afc2){if(_0x28afc2){var _0x510a60=[];for(var _0x45b999=0x0;_0x45b999<_0x21cb39[_0xcb67('0x3d')];_0x45b999++){_0x510a60[_0xcb67('0x61')](db[_0xcb67('0x59')][_0xcb67('0x77')]({'where':{'userProfileId':_0x28afc2['id'],'name':_0x21cb39[_0x45b999][_0xcb67('0x2e')]},'raw':!![]}));}return BPromise[_0xcb67('0x78')](_0x510a60);}})[_0xcb67('0x2a')](function(_0x2d4eb0){var _0x47ddf5=_[_0xcb67('0x43')](_0x2d4eb0,function(_0x144d1c){return _0x144d1c?_0x144d1c:undefined;});var _0xfe3d4e=_[_0xcb67('0x43')](_0x21cb39,[_0xcb67('0x79'),!![]]);var _0x7e9844=_['isEmpty'](_0x47ddf5)&&_[_0xcb67('0x66')](_0xfe3d4e)?null:_[_0xcb67('0x7a')](_0xfe3d4e,_0x47ddf5);if(_0x7e9844){var _0x189c42=[];for(var _0x306152=0x0;_0x306152<_0x7e9844[_0xcb67('0x3d')];_0x306152++){var _0x587867=_['find'](_0x21cb39,function(_0x2dcfe0){return _0x7e9844[_0x306152]?_0x2dcfe0[_0xcb67('0x2e')]===_0x7e9844[_0x306152][_0xcb67('0x2e')]:null;});if(_0x587867){if(_0x7e9844[_0x306152]['ignore']){_0x189c42[_0xcb67('0x61')](getAllResources(_0x37dac0[_0xcb67('0x74')],_0x7e9844[_0x306152]));}else{if(!_0x7e9844[_0x306152][_0xcb67('0x5a')]){_0x189c42[_0xcb67('0x61')](getAllowedResources(_0x587867,_0x7e9844[_0x306152],_0x37dac0[_0xcb67('0x74')]));}else{if(_0x587867[_0xcb67('0x36')]){_0x189c42[_0xcb67('0x61')](getAllFilteredResources(_0x587867,_0x7e9844[_0x306152]));}}}}}return BPromise[_0xcb67('0x78')](_0x189c42);}else{return null;}})[_0xcb67('0x2a')](function(_0x2e130f){var _0x511e53=_0x2e130f;var _0x5b0488=null;if(_0x511e53){_0x5b0488=_0x511e53[_0xcb67('0x3d')]===0x1?_0x511e53[0x0]:null;}if(_0x5b0488||_0x511e53){var _0x5497cf=db[_0x37dac0[_0xcb67('0x74')]]['rawAttributes'];_0xdda365[_0xcb67('0x36')]=_[_0xcb67('0x37')](_0x5497cf);_0xdda365[_0xcb67('0x38')]=_[_0xcb67('0x37')](_0x48b5b8[_0xcb67('0x38')]);_0xdda365[_0xcb67('0x39')]=_[_0xcb67('0x3a')](_0xdda365[_0xcb67('0x36')],_0xdda365[_0xcb67('0x38')]);_0x176436[_0xcb67('0x3b')]=_[_0xcb67('0x3a')](_0xdda365['model'],qs['fields'](_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x3c')]));_0x176436['attributes']=_0x176436[_0xcb67('0x3b')][_0xcb67('0x3d')]?_0x176436[_0xcb67('0x3b')]:_0xdda365[_0xcb67('0x36')];if(!_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x3e')](_0xcb67('0x3f'))){_0x176436[_0xcb67('0x25')]=qs[_0xcb67('0x25')](_0x48b5b8['query'][_0xcb67('0x25')]);_0x176436['offset']=qs['offset'](_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x24')]);}_0x176436[_0xcb67('0x40')]=qs[_0xcb67('0x41')](_0x48b5b8['query'][_0xcb67('0x41')]);_0x176436['where']=qs[_0xcb67('0x39')](_[_0xcb67('0x42')](_0x48b5b8['query'],_0xdda365['filters']));if(_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x43')]){_0x176436[_0xcb67('0x44')]=_[_0xcb67('0x45')](_0x176436[_0xcb67('0x44')],{'$or':_[_0xcb67('0x31')](_0x5497cf,function(_0x324abc){if(_0x324abc[_0xcb67('0x34')][_0xcb67('0x35')]!==_0xcb67('0x7b')){var _0x186fe7={};_0x186fe7[_0x324abc[_0xcb67('0x7c')]]={'$like':'%'+_0x48b5b8[_0xcb67('0x38')]['filter']+'%'};return _0x186fe7;}})});}var _0x883479=[];if(_0x5b0488){var _0x4a9330=_['find'](_0x21cb39,['name',_0x5b0488['name']]);if(_0x4a9330[_0xcb67('0x7c')]){var _0x1229c0={};if(_0x37dac0[_0xcb67('0x74')]===_0xcb67('0x7d')){_0x1229c0[_0x4a9330[_0xcb67('0x7e')]]=_[_0xcb67('0x31')](_0x5b0488[_0xcb67('0x7f')],'id');}else{_0x1229c0[_0x4a9330[_0xcb67('0x7e')]]=_0x5b0488[_0xcb67('0x7f')];}_0x883479['push'](_0x1229c0);}else{_0x176436[_0xcb67('0x44')]['id']=_0x5b0488[_0xcb67('0x7f')];}}else{for(var _0x59d765=0x0;_0x59d765<_0x511e53[_0xcb67('0x3d')];_0x59d765++){var _0x4a9330=_['find'](_0x21cb39,[_0xcb67('0x2e'),_0x511e53[_0x59d765][_0xcb67('0x2e')]]);if(_0x4a9330[_0xcb67('0x7c')]){var _0x1229c0={};_0x1229c0[_0x4a9330['foreignKey']]=_0x511e53[_0x59d765][_0xcb67('0x7f')];_0x883479['push'](_0x1229c0);}else{if(!_0x176436[_0xcb67('0x44')]['id'])_0x176436[_0xcb67('0x44')]['id']=[];_0x511e53[_0x59d765][_0xcb67('0x7f')][_0xcb67('0x69')](function(_0x36c334){_0x176436[_0xcb67('0x44')]['id'][_0xcb67('0x61')](_0x36c334);});}}}if(!_[_0xcb67('0x66')](_0x883479)){_0x176436[_0xcb67('0x44')]=_['merge'](_0x176436[_0xcb67('0x44')],{'$and':{'$or':_0x883479}});}_0x176436=_[_0xcb67('0x45')]({},_0x176436,_0x48b5b8[_0xcb67('0x46')]);if(_0x5b0488&&!_0x5b0488[_0xcb67('0x5a')]&&_0x37dac0[_0xcb67('0x74')]===_0xcb67('0x7d')){if(_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x48')]){_0x176436['include']=[{'all':!![]}];}return db[_0x37dac0['childModel']][_0xcb67('0x4a')](_0x176436)[_0xcb67('0x2a')](function(_0x459599){var _0x306744=[];_0x459599['forEach'](function(_0x5f4341){var _0x1f0bc1;switch(_0x5f4341[_0xcb67('0x80')]){case _0xcb67('0x81'):_0x1f0bc1=_[_0xcb67('0x52')](_0x5b0488['associatedResources'],function(_0x38225e){return _0x38225e['id']===_0x5f4341[_0xcb67('0x82')]&&_0x38225e[_0xcb67('0x34')]===_0xcb67('0x83');});break;case _0xcb67('0x84'):_0x1f0bc1=_['find'](_0x5b0488[_0xcb67('0x7f')],function(_0x63a024){return _0x63a024['id']===_0x5f4341[_0xcb67('0x82')]&&_0x63a024[_0xcb67('0x34')]===_0xcb67('0x85');});break;}if(_0x1f0bc1)_0x306744['push'](_0x5f4341);});_0x15214f['count']=_0x306744['length'];_0x15214f[_0xcb67('0x4b')]=_0x306744;return _0x15214f;});}else{return db[_0x37dac0['childModel']]['count']({'where':_0x176436[_0xcb67('0x44')]})['then'](function(_0x44c2ab){_0x15214f[_0xcb67('0x23')]=_0x44c2ab;if(_0x48b5b8[_0xcb67('0x38')]['includeAll']){if(_0x37dac0[_0xcb67('0x74')]===_0xcb67('0x86')){_0x176436['include']=[{'model':db[_0xcb67('0x87')],'as':_0xcb67('0x88'),'attributes':['id',_0xcb67('0x2e'),_0xcb67('0x89')],'required':_0x48b5b8[_0xcb67('0x38')]['tag']?!![]:![]},{'model':db[_0xcb67('0x87')],'as':_0xcb67('0x8a'),'attributes':['id','name','color'],'through':_0x48b5b8[_0xcb67('0x38')][_0xcb67('0x8b')]?{'attributes':[],'where':{'TagId':_0x48b5b8['query']['tag']||undefined}}:{},'required':_0x48b5b8['query']['tag']?!![]:![]}];}else{_0x176436[_0xcb67('0x49')]=[{'all':!![]}];}}return db[_0x37dac0[_0xcb67('0x74')]][_0xcb67('0x4a')](_0x176436);})[_0xcb67('0x2a')](function(_0x469eae){_0x15214f[_0xcb67('0x4b')]=_0x469eae;return _0x15214f;});}}else{return _0x15214f;}})[_0xcb67('0x2a')](respondWithFilteredResult(_0x36cd5f,_0x176436))[_0xcb67('0x50')](handleError(_0x36cd5f,null));};function getAllResources(_0x2de5cb,_0x157f0e){return new BPromise(function(_0x474b37,_0x5093fe){if(_0x157f0e){var _0x38ed75=_0x157f0e['filter']?{[_0x157f0e[_0xcb67('0x43')][_0xcb67('0x7c')]]:_0x157f0e[_0xcb67('0x43')][_0xcb67('0x8c')]}:undefined;return db[_0x2de5cb][_0xcb67('0x4a')]({'where':_0x38ed75,'raw':!![]})[_0xcb67('0x2a')](function(_0x3cba27){_0x157f0e[_0xcb67('0x7f')]=_[_0xcb67('0x31')](_0x3cba27,'id');_0x474b37(_0x157f0e);})['catch'](function(_0x4d7284){_0x5093fe(_0x4d7284);});}else{_0x474b37(null);}});}function getAllFilteredResources(_0xde794a,_0xc95158){return new BPromise(function(_0x167db1,_0x4bf672){var _0x38d018=_0xde794a[_0xcb67('0x43')]?{[_0xde794a[_0xcb67('0x43')][_0xcb67('0x7c')]]:_0xde794a[_0xcb67('0x43')][_0xcb67('0x8c')]}:undefined;return db[_0xde794a['model']]['findAll']({'where':_0x38d018,'raw':!![]})[_0xcb67('0x2a')](function(_0xe94e5f){_0xc95158[_0xcb67('0x7f')]=_[_0xcb67('0x31')](_0xe94e5f,function(_0x196c05){return _0x196c05[_0xcb67('0x2e')];});_0x167db1(_0xc95158);})[_0xcb67('0x50')](function(_0x178a05){_0x4bf672(_0x178a05);});});}function getAllowedResources(_0x412a03,_0x4e2d1a,_0x4e8020){return new BPromise(function(_0x1052c0,_0x1d0cdf){if(_0x4e2d1a){return db['UserProfileResource'][_0xcb67('0x4a')]({'where':{'sectionId':_0x4e2d1a['id']},'raw':!![]})[_0xcb67('0x2a')](function(_0x2a3177){if(_0x412a03[_0xcb67('0x7c')]&&_0x412a03[_0xcb67('0x7c')]!=='id'){_0x4e2d1a[_0xcb67('0x7f')]=_[_0xcb67('0x31')](_0x2a3177,function(_0xbff825){return _0xbff825[_0x412a03['field']];});}else{if(_0x4e8020==='AnalyticExtractedReport'){_0x4e2d1a[_0xcb67('0x7f')]=_['map'](_0x2a3177,function(_0x140ccf){return{'id':_0x140ccf[_0xcb67('0x6a')],'type':_0x140ccf[_0xcb67('0x34')]};});}else{_0x4e2d1a[_0xcb67('0x7f')]=_[_0xcb67('0x31')](_0x2a3177,function(_0x2e8bd2){return _0x2e8bd2[_0xcb67('0x6a')];});}}_0x1052c0(_0x4e2d1a);})[_0xcb67('0x50')](function(_0x4385d0){_0x1d0cdf(_0x4385d0);});}else{_0x1052c0(null);}});}function getQueryModels(_0x414333,_0x4ceb92){var _0x20676e=_0x414333[_0xcb67('0x8d')]();var _0xe6bb5d={'childModel':undefined,'parentSections':[]};switch(_0x20676e){case _0xcb67('0x8e'):_0xe6bb5d['childModel']=_0xcb67('0x8f');break;case'odbc':_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x90');break;case _0xcb67('0x91'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x92');_0xe6bb5d[_0xcb67('0x76')]=[{'name':_0xcb67('0x93'),'field':'name','foreignKey':_0xcb67('0x94')}];break;case _0xcb67('0x95'):_0xe6bb5d[_0xcb67('0x74')]='JscriptyProject';break;case'contacts':_0xe6bb5d[_0xcb67('0x74')]='CmContact';_0xe6bb5d['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xcb67('0x96')}];break;case _0xcb67('0x97'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x98');break;case _0xcb67('0x99'):_0xe6bb5d['childModel']=_0xcb67('0x9a');break;case _0xcb67('0x9b'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x9c');break;case _0xcb67('0x9d'):_0xe6bb5d['childModel']=_0xcb67('0x9e');break;case'chatwebsites':_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x9f');break;case'faxqueues':_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xa0');break;case _0xcb67('0xa1'):_0xe6bb5d['childModel']=_0xcb67('0xa2');break;case _0xcb67('0xa3'):case _0xcb67('0xa4'):case _0xcb67('0xa5'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xa6');break;case _0xcb67('0xa7'):_0xe6bb5d[_0xcb67('0x74')]='VoiceContext';break;case _0xcb67('0xa8'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xa9');break;case _0xcb67('0xaa'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xab');_0xe6bb5d[_0xcb67('0x76')]=[{'name':_0xcb67('0xac'),'field':_0xcb67('0x2e'),'foreignKey':_0xcb67('0xad'),'model':'User','filter':{'field':_0xcb67('0xae'),'value':[_0xcb67('0xaf')]}},{'name':_0xcb67('0xb0'),'field':_0xcb67('0x2e'),'foreignKey':_0xcb67('0xad'),'model':'User','filter':{'field':_0xcb67('0xae'),'value':[_0xcb67('0xb1')]}},{'name':'VoiceQueues','field':_0xcb67('0x2e'),'foreignKey':'queue','model':_0xcb67('0xb2'),'filter':{'field':_0xcb67('0x34'),'value':[_0xcb67('0xb3')]}},{'name':_0xcb67('0xb4'),'field':_0xcb67('0x2e'),'foreignKey':_0xcb67('0xb5'),'model':_0xcb67('0xb2'),'filter':{'field':_0xcb67('0x34'),'value':[_0xcb67('0xb6')]}}];break;case _0xcb67('0xb7'):_0xe6bb5d['childModel']='VoiceMusicOnHold';break;case _0xcb67('0xb8'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xb9');break;case'voiceprefixes':_0xe6bb5d['childModel']='VoicePrefix';break;case _0xcb67('0xba'):_0xe6bb5d[_0xcb67('0x74')]='Campaign';break;case _0xcb67('0xbb'):_0xe6bb5d['childModel']=_0xcb67('0xbc');break;case _0xcb67('0xbd'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xbe');break;case'mailsubstatuses':_0xe6bb5d[_0xcb67('0x74')]='MailSubstatus';break;case _0xcb67('0xbf'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xc0');break;case _0xcb67('0xc1'):_0xe6bb5d[_0xcb67('0x74')]='OpenchannelAccount';break;case _0xcb67('0xc2'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xc3');break;case _0xcb67('0xc4'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xc5');break;case _0xcb67('0xc6'):_0xe6bb5d['childModel']='WhatsappQueue';break;case'whatsappaccounts':_0xe6bb5d['childModel']=_0xcb67('0xc7');break;case'teams':_0xe6bb5d['childModel']=_0xcb67('0xc8');break;case _0xcb67('0xc9'):case _0xcb67('0xca'):_0xe6bb5d[_0xcb67('0x74')]='VoiceQueue';if(_0x4ceb92){_0xe6bb5d[_0xcb67('0x76')]=[{'name':'VoiceQueues'},{'name':_0xcb67('0xb4')}];}break;case _0xcb67('0xcb'):case _0xcb67('0xcc'):case _0xcb67('0xcd'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xce');if(_0x4ceb92){_0xe6bb5d[_0xcb67('0x76')]=[{'name':_0xcb67('0xcf'),'filter':{'field':_0xcb67('0xae'),'value':['admin','user']},'ignore':!![]},{'name':_0xcb67('0xac')},{'name':'Telephones'}];}break;case _0xcb67('0xd0'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xd1');break;case _0xcb67('0xd2'):_0xe6bb5d['childModel']=_0xcb67('0xd3');break;case _0xcb67('0xd4'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xd5');break;case _0xcb67('0xd6'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xd7');break;case _0xcb67('0xd8'):_0xe6bb5d[_0xcb67('0x74')]='DeskAccount';break;case _0xcb67('0xd9'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xda');break;case _0xcb67('0xdb'):_0xe6bb5d['childModel']=_0xcb67('0xce');break;case'cannedanswers':_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xdc');break;case _0xcb67('0xdd'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xde');break;case _0xcb67('0xdf'):_0xe6bb5d[_0xcb67('0x74')]='Dashboard';break;case'intervals':_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xe0');break;case _0xcb67('0xe1'):_0xe6bb5d[_0xcb67('0x74')]='Pause';break;case _0xcb67('0xe2'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xe3');break;case _0xcb67('0xe4'):_0xe6bb5d['childModel']=_0xcb67('0xe5');break;case'tags':_0xe6bb5d[_0xcb67('0x74')]='Tag';break;case _0xcb67('0xe6'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xe7');break;case _0xcb67('0xe8'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xe9');break;case _0xcb67('0xea'):_0xe6bb5d['childModel']=_0xcb67('0xeb');break;case _0xcb67('0xec'):_0xe6bb5d['childModel']='Variable';break;case _0xcb67('0xed'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x6b');break;case'extractedreports':_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0x7d');_0xe6bb5d['parentSections']=[{'name':_0xcb67('0xee'),'field':'id','foreignKey':_0xcb67('0x82')}];break;case _0xcb67('0xef'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xf0');break;case _0xcb67('0xf1'):_0xe6bb5d[_0xcb67('0x74')]=_0xcb67('0xc7');break;default:return _0xe6bb5d;}return _0xe6bb5d;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c8b1be5..5634193 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 _0x32d0=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x32d0,0x8a));var _0x032d=function(_0x57e408,_0x2770a9){_0x57e408=_0x57e408-0x0;var _0x591b23=_0x32d0[_0x57e408];return _0x591b23;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x032d('0x0'))['db'][_0x032d('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x032d('0x2')](0x0);var events={'afterCreate':_0x032d('0x3'),'afterUpdate':_0x032d('0x4'),'afterDestroy':_0x032d('0x5')};function emitEvent(_0x58d6f5){return function(_0x27bfc8,_0x98df58,_0x554a51){UserProfileEvents[_0x032d('0x6')](_0x58d6f5+':'+_0x27bfc8['id'],_0x27bfc8);UserProfileEvents[_0x032d('0x6')](_0x58d6f5,_0x27bfc8);_0x554a51(null);};}for(var e in events){if(events[_0x032d('0x7')](e)){var event=events[e];UserProfile[_0x032d('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x0748=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hook'];(function(_0x1e2e89,_0x6b8fc6){var _0x43dafe=function(_0x5abb6a){while(--_0x5abb6a){_0x1e2e89['push'](_0x1e2e89['shift']());}};_0x43dafe(++_0x6b8fc6);}(_0x0748,0x1ba));var _0x8074=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x0748[_0xc6be3a];return _0x56a310;};'use strict';var EventEmitter=require(_0x8074('0x0'));var UserProfile=require(_0x8074('0x1'))['db'][_0x8074('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8074('0x3')](0x0);var events={'afterCreate':_0x8074('0x4'),'afterUpdate':'update','afterDestroy':_0x8074('0x5')};function emitEvent(_0x2556d8){return function(_0x4acb98,_0x5378e6,_0x335ca9){UserProfileEvents[_0x8074('0x6')](_0x2556d8+':'+_0x4acb98['id'],_0x4acb98);UserProfileEvents['emit'](_0x2556d8,_0x4acb98);_0x335ca9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8074('0x7')](e,emitEvent(event));}}module[_0x8074('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3bccb21..5442ece 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 _0x47de=['api','moment','bluebird','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','lodash','util'];(function(_0x3e2480,_0x2eed70){var _0x652c0=function(_0xaae5d2){while(--_0xaae5d2){_0x3e2480['push'](_0x3e2480['shift']());}};_0x652c0(++_0x2eed70);}(_0x47de,0x1ea));var _0xe47d=function(_0x1b194b,_0x1445b5){_0x1b194b=_0x1b194b-0x0;var _0x490c95=_0x47de[_0x1b194b];return _0x490c95;};'use strict';var _=require(_0xe47d('0x0'));var util=require(_0xe47d('0x1'));var logger=require('../../config/logger')(_0xe47d('0x2'));var moment=require(_0xe47d('0x3'));var BPromise=require(_0xe47d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe47d('0x5'));var rimraf=require(_0xe47d('0x6'));var config=require(_0xe47d('0x7'));var attributes=require(_0xe47d('0x8'));module[_0xe47d('0x9')]=function(_0x353354,_0x1137c1){return _0x353354[_0xe47d('0xa')]('UserProfile',attributes,{'tableName':_0xe47d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbea6=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','user_profiles'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbea6,0x78));var _0x6bea=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xbea6[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x6bea('0x0'));var util=require('util');var logger=require(_0x6bea('0x1'))('api');var moment=require(_0x6bea('0x2'));var BPromise=require(_0x6bea('0x3'));var rp=require(_0x6bea('0x4'));var fs=require('fs');var path=require(_0x6bea('0x5'));var rimraf=require('rimraf');var config=require(_0x6bea('0x6'));var attributes=require('./userProfile.attributes');module[_0x6bea('0x7')]=function(_0x5a9edd,_0x2faaff){return _0x5a9edd[_0x6bea('0x8')]('UserProfile',attributes,{'tableName':_0x6bea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e708b6c..c8be85d 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae24=['info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae24,0x182));var _0x4ae2=function(_0x1c5e1b,_0x1572e4){_0x1c5e1b=_0x1c5e1b-0x0;var _0x4dd798=_0xae24[_0x1c5e1b];return _0x4dd798;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var moment=require(_0x4ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ae2('0x4'))('rpc');var config=require(_0x4ae2('0x5'));var jayson=require(_0x4ae2('0x6'));var client=jayson[_0x4ae2('0x7')][_0x4ae2('0x8')]({'port':0x232a});config[_0x4ae2('0x9')]=_[_0x4ae2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ae2('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0x4ae2('0xc')](socket);function respondWithRpcPromise(_0xb01e8e,_0x5c32b7,_0x3b3acc){return new BPromise(function(_0x449e1a,_0x171449){return client[_0x4ae2('0xd')](_0xb01e8e,_0x3b3acc)['then'](function(_0x19b222){logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,'request\x20sent');logger[_0x4ae2('0x10')](_0x4ae2('0x11'),_0x5c32b7,_0x4ae2('0x12'),JSON[_0x4ae2('0x13')](_0x19b222));if(_0x19b222[_0x4ae2('0x14')]){if(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x15')]===0x1f4){logger[_0x4ae2('0x14')](_0x4ae2('0xf'),_0x5c32b7,_0x19b222['error']['message']);return _0x171449(_0x19b222['error'][_0x4ae2('0x16')]);}logger[_0x4ae2('0x14')]('UserProfile,\x20%s,\x20%s',_0x5c32b7,_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);return _0x449e1a(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);}else{logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,_0x4ae2('0x12'));_0x449e1a(_0x19b222[_0x4ae2('0x17')][_0x4ae2('0x16')]);}})[_0x4ae2('0x18')](function(_0x4d5071){logger['error'](_0x4ae2('0xf'),_0x5c32b7,_0x4d5071);_0x171449(_0x4d5071);});});} \ No newline at end of file +var _0x33c5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0xa02028,_0x4bc509){var _0x51502e=function(_0x346fb6){while(--_0x346fb6){_0xa02028['push'](_0xa02028['shift']());}};_0x51502e(++_0x4bc509);}(_0x33c5,0xe6));var _0x533c=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0x33c5[_0x1f6691];return _0xf786b6;};'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});config[_0x533c('0xb')]=_[_0x533c('0xc')](config[_0x533c('0xb')],{'host':_0x533c('0xd'),'port':0x18eb});var socket=require(_0x533c('0xe'))(new Redis(config[_0x533c('0xb')]));require(_0x533c('0xf'))[_0x533c('0x10')](socket);function respondWithRpcPromise(_0x2c0214,_0x249f1a,_0x430c51){return new BPromise(function(_0x1b312e,_0x5a150f){return client[_0x533c('0x11')](_0x2c0214,_0x430c51)[_0x533c('0x12')](function(_0x272a11){logger[_0x533c('0x13')](_0x533c('0x14'),_0x249f1a,_0x533c('0x15'));logger['debug'](_0x533c('0x16'),_0x249f1a,_0x533c('0x15'),JSON[_0x533c('0x17')](_0x272a11));if(_0x272a11[_0x533c('0x18')]){if(_0x272a11[_0x533c('0x18')][_0x533c('0x19')]===0x1f4){logger[_0x533c('0x18')](_0x533c('0x14'),_0x249f1a,_0x272a11['error'][_0x533c('0x1a')]);return _0x5a150f(_0x272a11[_0x533c('0x18')][_0x533c('0x1a')]);}logger[_0x533c('0x18')]('UserProfile,\x20%s,\x20%s',_0x249f1a,_0x272a11[_0x533c('0x18')][_0x533c('0x1a')]);return _0x1b312e(_0x272a11[_0x533c('0x18')][_0x533c('0x1a')]);}else{logger[_0x533c('0x13')](_0x533c('0x14'),_0x249f1a,_0x533c('0x15'));_0x1b312e(_0x272a11[_0x533c('0x1b')][_0x533c('0x1a')]);}})[_0x533c('0x1c')](function(_0x287b9e){logger[_0x533c('0x18')](_0x533c('0x14'),_0x249f1a,_0x287b9e);_0x5a150f(_0x287b9e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1e951f4..24a1c61 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 _0xd6ab=['save','remove','update','emit','removeListener','register','length','./userProfile.events'];(function(_0x5c4444,_0x119726){var _0x20d93d=function(_0x326a33){while(--_0x326a33){_0x5c4444['push'](_0x5c4444['shift']());}};_0x20d93d(++_0x119726);}(_0xd6ab,0xd7));var _0xbd6a=function(_0x9e5e04,_0x4397a4){_0x9e5e04=_0x9e5e04-0x0;var _0x2e8dc=_0xd6ab[_0x9e5e04];return _0x2e8dc;};'use strict';var UserProfileEvents=require(_0xbd6a('0x0'));var events=[_0xbd6a('0x1'),_0xbd6a('0x2'),_0xbd6a('0x3')];function createListener(_0x4c4635,_0x11aa29){return function(_0x5bf325){_0x11aa29[_0xbd6a('0x4')](_0x4c4635,_0x5bf325);};}function removeListener(_0x2fc695,_0x226bed){return function(){UserProfileEvents[_0xbd6a('0x5')](_0x2fc695,_0x226bed);};}exports[_0xbd6a('0x6')]=function(_0xe8a5c2){for(var _0x3927e3=0x0,_0x1b70a4=events[_0xbd6a('0x7')];_0x3927e3<_0x1b70a4;_0x3927e3++){var _0xc61743=events[_0x3927e3];var _0x13b25a=createListener('userProfile:'+_0xc61743,_0xe8a5c2);UserProfileEvents['on'](_0xc61743,_0x13b25a);}}; \ No newline at end of file +var _0x1454=['remove','update','removeListener','register','userProfile:','./userProfile.events','save'];(function(_0x3e2675,_0x1b9a98){var _0x540520=function(_0x3d039a){while(--_0x3d039a){_0x3e2675['push'](_0x3e2675['shift']());}};_0x540520(++_0x1b9a98);}(_0x1454,0x1da));var _0x4145=function(_0x2c1580,_0x58569f){_0x2c1580=_0x2c1580-0x0;var _0x1dc04c=_0x1454[_0x2c1580];return _0x1dc04c;};'use strict';var UserProfileEvents=require(_0x4145('0x0'));var events=[_0x4145('0x1'),_0x4145('0x2'),_0x4145('0x3')];function createListener(_0x11ff14,_0x2c57a6){return function(_0x8af3f7){_0x2c57a6['emit'](_0x11ff14,_0x8af3f7);};}function removeListener(_0x5c270d,_0x543784){return function(){UserProfileEvents[_0x4145('0x4')](_0x5c270d,_0x543784);};}exports[_0x4145('0x5')]=function(_0x455f0a){for(var _0x59d653=0x0,_0x42d3c0=events['length'];_0x59d653<_0x42d3c0;_0x59d653++){var _0x22186b=events[_0x59d653];var _0x1da3f8=createListener(_0x4145('0x6')+_0x22186b,_0x455f0a);UserProfileEvents['on'](_0x22186b,_0x1da3f8);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index af33be1..925ca98 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 _0xb2f3=['index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated'];(function(_0x6161c6,_0x1c805e){var _0x16e637=function(_0x3396d6){while(--_0x3396d6){_0x6161c6['push'](_0x6161c6['shift']());}};_0x16e637(++_0x1c805e);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb2f3[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var path=require(_0x3b2f('0x2'));var timeout=require(_0x3b2f('0x3'));var express=require(_0x3b2f('0x4'));var router=express[_0x3b2f('0x5')]();var auth=require(_0x3b2f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b2f('0x7'));var controller=require(_0x3b2f('0x8'));router[_0x3b2f('0x9')]('/',auth[_0x3b2f('0xa')](),controller[_0x3b2f('0xb')]);router[_0x3b2f('0x9')](_0x3b2f('0xc'),auth['isAuthenticated'](),controller[_0x3b2f('0xd')]);router['get'](_0x3b2f('0xe'),auth[_0x3b2f('0xa')](),controller[_0x3b2f('0xf')]);router[_0x3b2f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b2f('0x11')](_0x3b2f('0xe'),auth[_0x3b2f('0xa')](),controller[_0x3b2f('0x12')]);router[_0x3b2f('0x13')](_0x3b2f('0xe'),auth[_0x3b2f('0xa')](),controller[_0x3b2f('0x14')]);module[_0x3b2f('0x15')]=router; \ No newline at end of file +var _0xa5ea=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','post','update','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x506ab5,_0x4f1c3d){var _0x31f48c=function(_0x483f1e){while(--_0x483f1e){_0x506ab5['push'](_0x506ab5['shift']());}};_0x31f48c(++_0x4f1c3d);}(_0xa5ea,0x6d));var _0xaa5e=function(_0x4a6929,_0xe49fc6){_0x4a6929=_0x4a6929-0x0;var _0x31cc60=_0xa5ea[_0x4a6929];return _0x31cc60;};'use strict';var multer=require('multer');var util=require(_0xaa5e('0x0'));var path=require(_0xaa5e('0x1'));var timeout=require(_0xaa5e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xaa5e('0x3'));var interaction=require(_0xaa5e('0x4'));var config=require(_0xaa5e('0x5'));var controller=require(_0xaa5e('0x6'));router[_0xaa5e('0x7')]('/',auth[_0xaa5e('0x8')](),controller['index']);router['get'](_0xaa5e('0x9'),auth[_0xaa5e('0x8')](),controller[_0xaa5e('0xa')]);router[_0xaa5e('0x7')]('/:id',auth[_0xaa5e('0x8')](),controller['show']);router[_0xaa5e('0xb')]('/',auth[_0xaa5e('0x8')](),controller['create']);router['put']('/:id',auth[_0xaa5e('0x8')](),controller[_0xaa5e('0xc')]);router['delete'](_0xaa5e('0xd'),auth[_0xaa5e('0x8')](),controller[_0xaa5e('0xe')]);module[_0xaa5e('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e955704..39472f8 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 _0xc3c1=['exports','STRING'];(function(_0x16c8fb,_0x347454){var _0x7e7e43=function(_0x5cb8fb){while(--_0x5cb8fb){_0x16c8fb['push'](_0x16c8fb['shift']());}};_0x7e7e43(++_0x347454);}(_0xc3c1,0xd0));var _0x1c3c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc3c1[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require('sequelize');module[_0x1c3c('0x0')]={'name':{'type':Sequelize[_0x1c3c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x1c3c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1a8d=['exports','STRING','sequelize'];(function(_0x58bf91,_0x183f1a){var _0x272bcf=function(_0x324252){while(--_0x324252){_0x58bf91['push'](_0x58bf91['shift']());}};_0x272bcf(++_0x183f1a);}(_0x1a8d,0x1cd));var _0xd1a8=function(_0x1cc498,_0xcb045){_0x1cc498=_0x1cc498-0x0;var _0x4781ef=_0x1a8d[_0x1cc498];return _0x4781ef;};'use strict';var Sequelize=require(_0xd1a8('0x0'));module[_0xd1a8('0x1')]={'name':{'type':Sequelize[_0xd1a8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd1a8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 927c426..b4647b0 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 _0xf2ca=['util','sox','to-csv','ejs','lodash','crypto','jsforce','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','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','UserProfileResource','count','includeAll','include','rows','catch','show','params','length','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2a8cb7,_0x314d29){_0x2a8cb7=_0x2a8cb7-0x0;var _0x183a1f=_0xf2ca[_0x2a8cb7];return _0x183a1f;};'use strict';var pdf=require(_0xaf2c('0x0'));var emlformat=require(_0xaf2c('0x1'));var rimraf=require(_0xaf2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2c('0x3'));var rp=require(_0xaf2c('0x4'));var moment=require(_0xaf2c('0x5'));var BPromise=require(_0xaf2c('0x6'));var Mustache=require(_0xaf2c('0x7'));var util=require(_0xaf2c('0x8'));var path=require('path');var sox=require(_0xaf2c('0x9'));var csv=require(_0xaf2c('0xa'));var ejs=require(_0xaf2c('0xb'));var fs=require('fs');var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0xa'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=_0x6ac8e['count'],_0x26bf7b=_0x1d0633[_0xaf2c('0x1c')],_0x3432e4=_0x1d0633['offset']+_0x1d0633[_0xaf2c('0x1d')],_0x705d09;if(_0x3432e4>=_0x2b4d13){_0x3432e4=_0x2b4d13;_0x705d09=0xc8;}else{_0x705d09=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x705d09);return _0x2119c8[_0xaf2c('0x1e')]('Content-Range',_0x26bf7b+'-'+_0x3432e4+'/'+_0x2b4d13)[_0xaf2c('0x1b')](_0x6ac8e);}return null;};}function patchUpdates(_0x297bcd){return function(_0x1fec4c){try{jsonpatch[_0xaf2c('0x1f')](_0x1fec4c,_0x297bcd,!![]);}catch(_0x3f977c){return BPromise[_0xaf2c('0x20')](_0x3f977c);}return _0x1fec4c['save']();};}function saveUpdates(_0x35e712,_0x164bcb){return function(_0x8ffe13){if(_0x8ffe13){return _0x8ffe13[_0xaf2c('0x21')](_0x35e712)[_0xaf2c('0x22')](function(_0x486de2){return _0x486de2;});}return null;};}function removeEntity(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['destroy']()['then'](function(){_0x396646[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x1cafad,_0x99f78d){return function(_0x591aff){if(!_0x591aff){_0x1cafad[_0xaf2c('0x18')](0x194);}return _0x591aff;};}function handleError(_0xf1a7cf,_0x3a0145){_0x3a0145=_0x3a0145||0x1f4;return function(_0x3c1ae6){logger[_0xaf2c('0x23')](_0x3c1ae6[_0xaf2c('0x24')]);if(_0x3c1ae6[_0xaf2c('0x25')]){delete _0x3c1ae6['name'];}_0xf1a7cf[_0xaf2c('0x19')](_0x3a0145)[_0xaf2c('0x26')](_0x3c1ae6);};}exports[_0xaf2c('0x27')]=function(_0x410536,_0x4b7cf2){var _0x3fb190={},_0x589d47={},_0x38db1b={'count':0x0,'rows':[]};var _0x42f980=_[_0xaf2c('0x28')](db['UserProfileResource'][_0xaf2c('0x29')],function(_0x2ea490){return{'name':_0x2ea490[_0xaf2c('0x2a')],'type':_0x2ea490['type'][_0xaf2c('0x2b')]};});_0x589d47[_0xaf2c('0x2c')]=_[_0xaf2c('0x28')](_0x42f980,_0xaf2c('0x25'));_0x589d47['query']=_[_0xaf2c('0x2d')](_0x410536[_0xaf2c('0x2e')]);_0x589d47[_0xaf2c('0x2f')]=_['intersection'](_0x589d47['model'],_0x589d47[_0xaf2c('0x2e')]);_0x3fb190['attributes']=_[_0xaf2c('0x30')](_0x589d47['model'],qs[_0xaf2c('0x31')](_0x410536[_0xaf2c('0x2e')]['fields']));_0x3fb190[_0xaf2c('0x32')]=_0x3fb190[_0xaf2c('0x32')]['length']?_0x3fb190[_0xaf2c('0x32')]:_0x589d47[_0xaf2c('0x2c')];if(!_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x33')](_0xaf2c('0x34'))){_0x3fb190[_0xaf2c('0x1d')]=qs['limit'](_0x410536[_0xaf2c('0x2e')]['limit']);_0x3fb190[_0xaf2c('0x1c')]=qs['offset'](_0x410536[_0xaf2c('0x2e')]['offset']);}_0x3fb190[_0xaf2c('0x35')]=qs['sort'](_0x410536[_0xaf2c('0x2e')]['sort']);_0x3fb190[_0xaf2c('0x36')]=qs[_0xaf2c('0x2f')](_[_0xaf2c('0x37')](_0x410536[_0xaf2c('0x2e')],_0x589d47[_0xaf2c('0x2f')]),_0x42f980);if(_0x410536['query']['filter']){_0x3fb190[_0xaf2c('0x36')]=_[_0xaf2c('0x38')](_0x3fb190[_0xaf2c('0x36')],{'$or':_[_0xaf2c('0x28')](_0x42f980,function(_0x4eeecf){if(_0x4eeecf[_0xaf2c('0x39')]!=='VIRTUAL'){var _0xa1248e={};_0xa1248e[_0x4eeecf[_0xaf2c('0x25')]]={'$like':'%'+_0x410536['query'][_0xaf2c('0x3a')]+'%'};return _0xa1248e;}})});}_0x3fb190=_[_0xaf2c('0x38')]({},_0x3fb190,_0x410536[_0xaf2c('0x3b')]);var _0x71c597={'where':_0x3fb190[_0xaf2c('0x36')]};return db[_0xaf2c('0x3c')][_0xaf2c('0x3d')](_0x71c597)[_0xaf2c('0x22')](function(_0x296ca8){_0x38db1b[_0xaf2c('0x3d')]=_0x296ca8;if(_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x3fb190[_0xaf2c('0x3f')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x3fb190);})['then'](function(_0x189809){_0x38db1b[_0xaf2c('0x40')]=_0x189809;return _0x38db1b;})[_0xaf2c('0x22')](respondWithFilteredResult(_0x4b7cf2,_0x3fb190))[_0xaf2c('0x41')](handleError(_0x4b7cf2,null));};exports[_0xaf2c('0x42')]=function(_0x29460c,_0x51c441){var _0x1d58bd={'raw':![],'where':{'id':_0x29460c[_0xaf2c('0x43')]['id']}},_0x78632a={};_0x78632a['model']=_['keys'](db[_0xaf2c('0x3c')]['rawAttributes']);_0x78632a[_0xaf2c('0x2e')]=_[_0xaf2c('0x2d')](_0x29460c[_0xaf2c('0x2e')]);_0x78632a[_0xaf2c('0x2f')]=_['intersection'](_0x78632a[_0xaf2c('0x2c')],_0x78632a['query']);_0x1d58bd[_0xaf2c('0x32')]=_[_0xaf2c('0x30')](_0x78632a['model'],qs[_0xaf2c('0x31')](_0x29460c['query'][_0xaf2c('0x31')]));_0x1d58bd[_0xaf2c('0x32')]=_0x1d58bd[_0xaf2c('0x32')][_0xaf2c('0x44')]?_0x1d58bd[_0xaf2c('0x32')]:_0x78632a[_0xaf2c('0x2c')];if(_0x29460c[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x1d58bd[_0xaf2c('0x3f')]=[{'all':!![]}];}_0x1d58bd=_['merge']({},_0x1d58bd,_0x29460c['options']);return db[_0xaf2c('0x3c')]['find'](_0x1d58bd)['then'](handleEntityNotFound(_0x51c441,null))['then'](respondWithResult(_0x51c441,null))[_0xaf2c('0x41')](handleError(_0x51c441,null));};exports[_0xaf2c('0x45')]=function(_0x3cabd4,_0x35315e){return db['UserProfileResource'][_0xaf2c('0x45')](_0x3cabd4['body'],{})[_0xaf2c('0x22')](respondWithResult(_0x35315e,0xc9))['catch'](handleError(_0x35315e,null));};exports[_0xaf2c('0x21')]=function(_0x133e8c,_0x2d01b7){if(_0x133e8c[_0xaf2c('0x46')]['id']){delete _0x133e8c[_0xaf2c('0x46')]['id'];}return db['UserProfileResource'][_0xaf2c('0x47')]({'where':{'id':_0x133e8c[_0xaf2c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d01b7,null))['then'](saveUpdates(_0x133e8c[_0xaf2c('0x46')],null))['then'](respondWithResult(_0x2d01b7,null))[_0xaf2c('0x41')](handleError(_0x2d01b7,null));};exports[_0xaf2c('0x48')]=function(_0x17b9ec,_0x315b9f){return db[_0xaf2c('0x3c')][_0xaf2c('0x47')]({'where':{'id':_0x17b9ec[_0xaf2c('0x43')]['id']}})[_0xaf2c('0x22')](handleEntityNotFound(_0x315b9f,null))[_0xaf2c('0x22')](removeEntity(_0x315b9f,null))[_0xaf2c('0x41')](handleError(_0x315b9f,null));};exports[_0xaf2c('0x49')]=function(_0x5bf349,_0x22919a){return db[_0xaf2c('0x3c')]['describe']()['then'](respondWithResult(_0x22919a,null))['catch'](handleError(_0x22919a,null));}; \ No newline at end of file +var _0x24ca=['then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','describe','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','status','end','json','count','offset','set','Content-Range','apply','update'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x24ca,0x1bc));var _0xa24c=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x24ca[_0x20589d];return _0x422de9;};'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'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=_0xb80781[_0xa24c('0x1e')],_0x49ce53=_0x47a063['offset'],_0x5babb5=_0x47a063[_0xa24c('0x1f')]+_0x47a063['limit'],_0x221d21;if(_0x5babb5>=_0x87aa90){_0x5babb5=_0x87aa90;_0x221d21=0xc8;}else{_0x221d21=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x221d21);return _0x5d4727[_0xa24c('0x20')](_0xa24c('0x21'),_0x49ce53+'-'+_0x5babb5+'/'+_0x87aa90)[_0xa24c('0x1d')](_0xb80781);}return null;};}function patchUpdates(_0x4ff97c){return function(_0x16d363){try{jsonpatch[_0xa24c('0x22')](_0x16d363,_0x4ff97c,!![]);}catch(_0x773f70){return BPromise['reject'](_0x773f70);}return _0x16d363['save']();};}function saveUpdates(_0x506424,_0x4cd77e){return function(_0x2173f6){if(_0x2173f6){return _0x2173f6[_0xa24c('0x23')](_0x506424)[_0xa24c('0x24')](function(_0x180297){return _0x180297;});}return null;};}function removeEntity(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x25')]()[_0xa24c('0x24')](function(){_0x51a275['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x363d52,_0x43a0c0){return function(_0x188ee2){if(!_0x188ee2){_0x363d52[_0xa24c('0x26')](0x194);}return _0x188ee2;};}function handleError(_0x47e0eb,_0xec9167){_0xec9167=_0xec9167||0x1f4;return function(_0x5cc9cb){logger[_0xa24c('0x27')](_0x5cc9cb[_0xa24c('0x28')]);if(_0x5cc9cb[_0xa24c('0x29')]){delete _0x5cc9cb['name'];}_0x47e0eb[_0xa24c('0x1b')](_0xec9167)[_0xa24c('0x2a')](_0x5cc9cb);};}exports[_0xa24c('0x2b')]=function(_0x314121,_0x11e4e0){var _0x3ad0e6={},_0x39609a={},_0x5b23f4={'count':0x0,'rows':[]};var _0xa0c48e=_[_0xa24c('0x2c')](db[_0xa24c('0x2d')][_0xa24c('0x2e')],function(_0x5e491e){return{'name':_0x5e491e[_0xa24c('0x2f')],'type':_0x5e491e[_0xa24c('0x30')][_0xa24c('0x31')]};});_0x39609a['model']=_[_0xa24c('0x2c')](_0xa0c48e,_0xa24c('0x29'));_0x39609a[_0xa24c('0x32')]=_['keys'](_0x314121[_0xa24c('0x32')]);_0x39609a['filters']=_[_0xa24c('0x33')](_0x39609a[_0xa24c('0x34')],_0x39609a[_0xa24c('0x32')]);_0x3ad0e6['attributes']=_[_0xa24c('0x33')](_0x39609a[_0xa24c('0x34')],qs[_0xa24c('0x35')](_0x314121['query'][_0xa24c('0x35')]));_0x3ad0e6['attributes']=_0x3ad0e6[_0xa24c('0x36')][_0xa24c('0x37')]?_0x3ad0e6['attributes']:_0x39609a['model'];if(!_0x314121[_0xa24c('0x32')][_0xa24c('0x38')](_0xa24c('0x39'))){_0x3ad0e6[_0xa24c('0x3a')]=qs[_0xa24c('0x3a')](_0x314121[_0xa24c('0x32')][_0xa24c('0x3a')]);_0x3ad0e6['offset']=qs[_0xa24c('0x1f')](_0x314121[_0xa24c('0x32')][_0xa24c('0x1f')]);}_0x3ad0e6[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x314121[_0xa24c('0x32')][_0xa24c('0x3c')]);_0x3ad0e6[_0xa24c('0x3d')]=qs[_0xa24c('0x3e')](_[_0xa24c('0x3f')](_0x314121['query'],_0x39609a[_0xa24c('0x3e')]),_0xa0c48e);if(_0x314121[_0xa24c('0x32')][_0xa24c('0x40')]){_0x3ad0e6[_0xa24c('0x3d')]=_['merge'](_0x3ad0e6['where'],{'$or':_[_0xa24c('0x2c')](_0xa0c48e,function(_0x56ef4d){if(_0x56ef4d[_0xa24c('0x30')]!==_0xa24c('0x41')){var _0x22a316={};_0x22a316[_0x56ef4d[_0xa24c('0x29')]]={'$like':'%'+_0x314121[_0xa24c('0x32')]['filter']+'%'};return _0x22a316;}})});}_0x3ad0e6=_['merge']({},_0x3ad0e6,_0x314121[_0xa24c('0x42')]);var _0xc661c7={'where':_0x3ad0e6[_0xa24c('0x3d')]};return db[_0xa24c('0x2d')][_0xa24c('0x1e')](_0xc661c7)[_0xa24c('0x24')](function(_0x5080d0){_0x5b23f4['count']=_0x5080d0;if(_0x314121[_0xa24c('0x32')][_0xa24c('0x43')]){_0x3ad0e6[_0xa24c('0x44')]=[{'all':!![]}];}return db[_0xa24c('0x2d')][_0xa24c('0x45')](_0x3ad0e6);})['then'](function(_0x171c51){_0x5b23f4[_0xa24c('0x46')]=_0x171c51;return _0x5b23f4;})['then'](respondWithFilteredResult(_0x11e4e0,_0x3ad0e6))['catch'](handleError(_0x11e4e0,null));};exports[_0xa24c('0x47')]=function(_0x44f6ae,_0x231eea){var _0x537849={'raw':![],'where':{'id':_0x44f6ae[_0xa24c('0x48')]['id']}},_0x58ac8b={};_0x58ac8b[_0xa24c('0x34')]=_[_0xa24c('0x49')](db[_0xa24c('0x2d')][_0xa24c('0x2e')]);_0x58ac8b[_0xa24c('0x32')]=_[_0xa24c('0x49')](_0x44f6ae[_0xa24c('0x32')]);_0x58ac8b['filters']=_['intersection'](_0x58ac8b[_0xa24c('0x34')],_0x58ac8b[_0xa24c('0x32')]);_0x537849[_0xa24c('0x36')]=_['intersection'](_0x58ac8b[_0xa24c('0x34')],qs[_0xa24c('0x35')](_0x44f6ae[_0xa24c('0x32')][_0xa24c('0x35')]));_0x537849[_0xa24c('0x36')]=_0x537849[_0xa24c('0x36')][_0xa24c('0x37')]?_0x537849[_0xa24c('0x36')]:_0x58ac8b[_0xa24c('0x34')];if(_0x44f6ae[_0xa24c('0x32')]['includeAll']){_0x537849[_0xa24c('0x44')]=[{'all':!![]}];}_0x537849=_[_0xa24c('0x4a')]({},_0x537849,_0x44f6ae[_0xa24c('0x42')]);return db['UserProfileResource'][_0xa24c('0x4b')](_0x537849)[_0xa24c('0x24')](handleEntityNotFound(_0x231eea,null))[_0xa24c('0x24')](respondWithResult(_0x231eea,null))[_0xa24c('0x4c')](handleError(_0x231eea,null));};exports[_0xa24c('0x4d')]=function(_0x16d340,_0x1a20bd){return db[_0xa24c('0x2d')][_0xa24c('0x4d')](_0x16d340[_0xa24c('0x4e')],{})[_0xa24c('0x24')](respondWithResult(_0x1a20bd,0xc9))['catch'](handleError(_0x1a20bd,null));};exports[_0xa24c('0x23')]=function(_0x96b977,_0x42028b){if(_0x96b977[_0xa24c('0x4e')]['id']){delete _0x96b977[_0xa24c('0x4e')]['id'];}return db[_0xa24c('0x2d')][_0xa24c('0x4b')]({'where':{'id':_0x96b977[_0xa24c('0x48')]['id']}})[_0xa24c('0x24')](handleEntityNotFound(_0x42028b,null))['then'](saveUpdates(_0x96b977['body'],null))[_0xa24c('0x24')](respondWithResult(_0x42028b,null))['catch'](handleError(_0x42028b,null));};exports[_0xa24c('0x25')]=function(_0x1f436c,_0x4ec677){return db[_0xa24c('0x2d')][_0xa24c('0x4b')]({'where':{'id':_0x1f436c[_0xa24c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ec677,null))['then'](removeEntity(_0x4ec677,null))[_0xa24c('0x4c')](handleError(_0x4ec677,null));};exports['describe']=function(_0x4769a1,_0x2a3665){return db[_0xa24c('0x2d')][_0xa24c('0x4f')]()[_0xa24c('0x24')](respondWithResult(_0x2a3665,null))[_0xa24c('0x4c')](handleError(_0x2a3665,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index fe65e89..6ba556a 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 _0xaf58=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x1cd647,_0x1c1cd2){var _0x575563=function(_0x36c9dc){while(--_0x36c9dc){_0x1cd647['push'](_0x1cd647['shift']());}};_0x575563(++_0x1c1cd2);}(_0xaf58,0x160));var _0x8af5=function(_0x43f5d9,_0x2fb313){_0x43f5d9=_0x43f5d9-0x0;var _0x27800a=_0xaf58[_0x43f5d9];return _0x27800a;};'use strict';var _=require(_0x8af5('0x0'));var util=require(_0x8af5('0x1'));var logger=require(_0x8af5('0x2'))(_0x8af5('0x3'));var moment=require(_0x8af5('0x4'));var BPromise=require(_0x8af5('0x5'));var rp=require(_0x8af5('0x6'));var fs=require('fs');var path=require(_0x8af5('0x7'));var rimraf=require(_0x8af5('0x8'));var config=require(_0x8af5('0x9'));var attributes=require(_0x8af5('0xa'));module[_0x8af5('0xb')]=function(_0x168c85,_0x255c83){return _0x168c85[_0x8af5('0xc')]('UserProfileResource',attributes,{'tableName':_0x8af5('0xd'),'paranoid':![],'indexes':[{'name':_0x8af5('0xe'),'fields':[_0x8af5('0xf'),_0x8af5('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdde=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash'];(function(_0x361fbe,_0x4051b9){var _0x487cb4=function(_0x52419e){while(--_0x52419e){_0x361fbe['push'](_0x361fbe['shift']());}};_0x487cb4(++_0x4051b9);}(_0xbdde,0x7f));var _0xebdd=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xbdde[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xebdd('0x0'));var util=require(_0xebdd('0x1'));var logger=require(_0xebdd('0x2'))('api');var moment=require(_0xebdd('0x3'));var BPromise=require(_0xebdd('0x4'));var rp=require(_0xebdd('0x5'));var fs=require('fs');var path=require(_0xebdd('0x6'));var rimraf=require(_0xebdd('0x7'));var config=require(_0xebdd('0x8'));var attributes=require(_0xebdd('0x9'));module[_0xebdd('0xa')]=function(_0x3b02c2,_0x513ef9){return _0x3b02c2[_0xebdd('0xb')](_0xebdd('0xc'),attributes,{'tableName':_0xebdd('0xd'),'paranoid':![],'indexes':[{'name':_0xebdd('0xe'),'fields':['resourceId',_0xebdd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6157b66..b860841 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 _0x3d62=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util'];(function(_0x457549,_0x3e0f46){var _0x3c1d6f=function(_0xa15abe){while(--_0xa15abe){_0x457549['push'](_0x457549['shift']());}};_0x3c1d6f(++_0x3e0f46);}(_0x3d62,0x1b6));var _0x23d6=function(_0x507418,_0x2f4098){_0x507418=_0x507418-0x0;var _0x4bc864=_0x3d62[_0x507418];return _0x4bc864;};'use strict';var _=require(_0x23d6('0x0'));var util=require(_0x23d6('0x1'));var moment=require(_0x23d6('0x2'));var BPromise=require(_0x23d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23d6('0x4'));var db=require(_0x23d6('0x5'))['db'];var utils=require(_0x23d6('0x6'));var logger=require(_0x23d6('0x7'))(_0x23d6('0x8'));var config=require(_0x23d6('0x9'));var jayson=require(_0x23d6('0xa'));var client=jayson['client'][_0x23d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29bc13,_0x56a4ab,_0xca34d1){return new BPromise(function(_0x49ef26,_0x454f19){return client[_0x23d6('0xc')](_0x29bc13,_0xca34d1)['then'](function(_0x1c03fd){logger['info'](_0x23d6('0xd'),_0x56a4ab,_0x23d6('0xe'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x56a4ab,_0x23d6('0xe'),JSON[_0x23d6('0xf')](_0x1c03fd));if(_0x1c03fd['error']){if(_0x1c03fd['error'][_0x23d6('0x10')]===0x1f4){logger[_0x23d6('0x11')](_0x23d6('0xd'),_0x56a4ab,_0x1c03fd[_0x23d6('0x11')][_0x23d6('0x12')]);return _0x454f19(_0x1c03fd[_0x23d6('0x11')][_0x23d6('0x12')]);}logger['error'](_0x23d6('0xd'),_0x56a4ab,_0x1c03fd['error']['message']);return _0x49ef26(_0x1c03fd['error'][_0x23d6('0x12')]);}else{logger['info'](_0x23d6('0xd'),_0x56a4ab,'request\x20sent');_0x49ef26(_0x1c03fd[_0x23d6('0x13')][_0x23d6('0x12')]);}})['catch'](function(_0x4344a0){logger[_0x23d6('0x11')](_0x23d6('0xd'),_0x56a4ab,_0x4344a0);_0x454f19(_0x4344a0);});});} \ No newline at end of file +var _0x931f=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x931f,0x133));var _0xf931=function(_0x584513,_0x37c6c9){_0x584513=_0x584513-0x0;var _0xe4a14e=_0x931f[_0x584513];return _0xe4a14e;};'use strict';var _=require('lodash');var util=require(_0xf931('0x0'));var moment=require(_0xf931('0x1'));var BPromise=require(_0xf931('0x2'));var rs=require(_0xf931('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf931('0x4'))['db'];var utils=require(_0xf931('0x5'));var logger=require(_0xf931('0x6'))(_0xf931('0x7'));var config=require(_0xf931('0x8'));var jayson=require(_0xf931('0x9'));var client=jayson['client'][_0xf931('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513a08,_0x11e05f,_0x1615cf){return new BPromise(function(_0x46d4ae,_0x370e3c){return client[_0xf931('0xb')](_0x513a08,_0x1615cf)[_0xf931('0xc')](function(_0x3a3b54){logger[_0xf931('0xd')](_0xf931('0xe'),_0x11e05f,_0xf931('0xf'));logger['debug'](_0xf931('0x10'),_0x11e05f,_0xf931('0xf'),JSON[_0xf931('0x11')](_0x3a3b54));if(_0x3a3b54['error']){if(_0x3a3b54[_0xf931('0x12')][_0xf931('0x13')]===0x1f4){logger[_0xf931('0x12')](_0xf931('0xe'),_0x11e05f,_0x3a3b54['error'][_0xf931('0x14')]);return _0x370e3c(_0x3a3b54[_0xf931('0x12')]['message']);}logger[_0xf931('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x11e05f,_0x3a3b54[_0xf931('0x12')]['message']);return _0x46d4ae(_0x3a3b54[_0xf931('0x12')][_0xf931('0x14')]);}else{logger['info'](_0xf931('0xe'),_0x11e05f,_0xf931('0xf'));_0x46d4ae(_0x3a3b54[_0xf931('0x15')]['message']);}})[_0xf931('0x16')](function(_0x5c7bfb){logger[_0xf931('0x12')](_0xf931('0xe'),_0x11e05f,_0x5c7bfb);_0x370e3c(_0x5c7bfb);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6784056..7e41bef 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 _0x9113=['get','isAuthenticated','index','/:id','post','create','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x57b443,_0x5145b4){var _0x1a763d=function(_0x513b90){while(--_0x513b90){_0x57b443['push'](_0x57b443['shift']());}};_0x1a763d(++_0x5145b4);}(_0x9113,0x1cf));var _0x3911=function(_0x1083e6,_0x12440a){_0x1083e6=_0x1083e6-0x0;var _0x3b5198=_0x9113[_0x1083e6];return _0x3b5198;};'use strict';var multer=require('multer');var util=require(_0x3911('0x0'));var path=require('path');var timeout=require(_0x3911('0x1'));var express=require(_0x3911('0x2'));var router=express[_0x3911('0x3')]();var auth=require(_0x3911('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x3911('0x5')]('/',auth[_0x3911('0x6')](),controller[_0x3911('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3911('0x5')](_0x3911('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3911('0x9')]('/',auth[_0x3911('0x6')](),controller[_0x3911('0xa')]);router['put']('/:id',auth[_0x3911('0x6')](),controller['update']);router[_0x3911('0xb')](_0x3911('0x8'),auth['isAuthenticated'](),controller[_0x3911('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8a5e=['../../components/interaction/service','./userProfileSection.controller','isAuthenticated','get','/describe','describe','/:id','create','delete','exports','multer','path','connect-timeout'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x8a5e,0xc0));var _0xe8a5=function(_0x4de1d5,_0x127e9d){_0x4de1d5=_0x4de1d5-0x0;var _0x12ff6f=_0x8a5e[_0x4de1d5];return _0x12ff6f;};'use strict';var multer=require(_0xe8a5('0x0'));var util=require('util');var path=require(_0xe8a5('0x1'));var timeout=require(_0xe8a5('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe8a5('0x3'));var config=require('../../config/environment');var controller=require(_0xe8a5('0x4'));router['get']('/',auth[_0xe8a5('0x5')](),controller['index']);router[_0xe8a5('0x6')](_0xe8a5('0x7'),auth[_0xe8a5('0x5')](),controller[_0xe8a5('0x8')]);router[_0xe8a5('0x6')](_0xe8a5('0x9'),auth[_0xe8a5('0x5')](),controller['show']);router['post']('/',auth[_0xe8a5('0x5')](),controller[_0xe8a5('0xa')]);router['put'](_0xe8a5('0x9'),auth[_0xe8a5('0x5')](),controller['update']);router[_0xe8a5('0xb')](_0xe8a5('0x9'),auth[_0xe8a5('0x5')](),controller['destroy']);module[_0xe8a5('0xc')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 464021b..272fd9a 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 _0x34ea=['STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports'];(function(_0x2ebfb4,_0x2d642a){var _0xafd3b7=function(_0x8464a6){while(--_0x8464a6){_0x2ebfb4['push'](_0x2ebfb4['shift']());}};_0xafd3b7(++_0x2d642a);}(_0x34ea,0xa8));var _0xa34e=function(_0x22468c,_0x4d4c69){_0x22468c=_0x22468c-0x0;var _0x3caa26=_0x34ea[_0x22468c];return _0x3caa26;};'use strict';var Sequelize=require(_0xa34e('0x0'));module[_0xa34e('0x1')]={'name':{'type':Sequelize[_0xa34e('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xa34e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa34e('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa34e('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa34e('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa34e('0x2')],'set':function(_0x3989e0){this[_0xa34e('0x5')]('crudPermissions',_0x3989e0?_0x3989e0[_0xa34e('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xa34e('0x7')](_0xa34e('0x8'))[_0xa34e('0x9')](''):[];}}}; \ No newline at end of file +var _0x984b=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','split'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x984b,0xee));var _0xb984=function(_0x442933,_0x221c31){_0x442933=_0x442933-0x0;var _0x4b3da7=_0x984b[_0x442933];return _0x4b3da7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xb984('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb984('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb984('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x8384b0){this[_0xb984('0x3')]('crudPermissions',_0x8384b0?_0x8384b0['join'](''):[]);},'get':function(){return this[_0xb984('0x4')](_0xb984('0x5'))?this['getDataValue'](_0xb984('0x5'))[_0xb984('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 88c05f4..2b646bb 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 _0xc3a1=['catch','params','keys','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','name','send','map','UserProfileSection','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','then','rows'];(function(_0x40b0c9,_0x1b801b){var _0x408522=function(_0x1b8129){while(--_0x1b8129){_0x40b0c9['push'](_0x40b0c9['shift']());}};_0x408522(++_0x1b801b);}(_0xc3a1,0x171));var _0x1c3a=function(_0x56e752,_0x100618){_0x56e752=_0x56e752-0x0;var _0x290f90=_0xc3a1[_0x56e752];return _0x290f90;};'use strict';var pdf=require(_0x1c3a('0x0'));var emlformat=require(_0x1c3a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c3a('0x2'));var rp=require(_0x1c3a('0x3'));var moment=require(_0x1c3a('0x4'));var BPromise=require(_0x1c3a('0x5'));var Mustache=require(_0x1c3a('0x6'));var util=require(_0x1c3a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1c3a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c3a('0x9'));var squel=require(_0x1c3a('0xa'));var crypto=require(_0x1c3a('0xb'));var jsforce=require(_0x1c3a('0xc'));var deskjs=require(_0x1c3a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1c3a('0xe'));var Redis=require('ioredis');var authService=require(_0x1c3a('0xf'));var qs=require(_0x1c3a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1c3a('0x11'));var utils=require(_0x1c3a('0x12'));var config=require(_0x1c3a('0x13'));var licenseUtil=require(_0x1c3a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2187,_0x1e61ab){_0x1e61ab=_0x1e61ab||0xcc;return function(_0x186395){if(_0x186395){return _0x4f2187['sendStatus'](_0x1e61ab);}return _0x4f2187[_0x1c3a('0x15')](_0x1e61ab)[_0x1c3a('0x16')]();};}function respondWithResult(_0x5520d7,_0x5d9455){_0x5d9455=_0x5d9455||0xc8;return function(_0x7df8d){if(_0x7df8d){return _0x5520d7[_0x1c3a('0x15')](_0x5d9455)[_0x1c3a('0x17')](_0x7df8d);}};}function respondWithFilteredResult(_0x3e576f,_0x53b92b){return function(_0x404c9){if(_0x404c9){var _0x1b37e5=_0x404c9[_0x1c3a('0x18')],_0x3f9c30=_0x53b92b[_0x1c3a('0x19')],_0x12bfa6=_0x53b92b[_0x1c3a('0x19')]+_0x53b92b[_0x1c3a('0x1a')],_0x2bf857;if(_0x12bfa6>=_0x1b37e5){_0x12bfa6=_0x1b37e5;_0x2bf857=0xc8;}else{_0x2bf857=0xce;}_0x3e576f[_0x1c3a('0x15')](_0x2bf857);return _0x3e576f[_0x1c3a('0x1b')](_0x1c3a('0x1c'),_0x3f9c30+'-'+_0x12bfa6+'/'+_0x1b37e5)[_0x1c3a('0x17')](_0x404c9);}return null;};}function patchUpdates(_0x4196df){return function(_0x1fa671){try{jsonpatch[_0x1c3a('0x1d')](_0x1fa671,_0x4196df,!![]);}catch(_0x21a0b9){return BPromise[_0x1c3a('0x1e')](_0x21a0b9);}return _0x1fa671[_0x1c3a('0x1f')]();};}function saveUpdates(_0xfd6a7,_0x515ebb){return function(_0x118965){if(_0x118965){return _0x118965[_0x1c3a('0x20')](_0xfd6a7)['then'](function(_0x25f084){return _0x25f084;});}return null;};}function removeEntity(_0x2875e2,_0x2fc423){return function(_0x1077a8){if(_0x1077a8){return _0x1077a8[_0x1c3a('0x21')]()['then'](function(){_0x2875e2[_0x1c3a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36dc41,_0x4cab19){return function(_0x5d8bfc){if(!_0x5d8bfc){_0x36dc41[_0x1c3a('0x22')](0x194);}return _0x5d8bfc;};}function handleError(_0x5112af,_0x352e60){_0x352e60=_0x352e60||0x1f4;return function(_0x3e57f7){logger[_0x1c3a('0x23')](_0x3e57f7['stack']);if(_0x3e57f7[_0x1c3a('0x24')]){delete _0x3e57f7[_0x1c3a('0x24')];}_0x5112af[_0x1c3a('0x15')](_0x352e60)[_0x1c3a('0x25')](_0x3e57f7);};}exports['index']=function(_0x3a34d6,_0x36f3b5){var _0x5b8fc1={},_0x2afa29={},_0x341020={'count':0x0,'rows':[]};var _0x39cb00=_[_0x1c3a('0x26')](db[_0x1c3a('0x27')]['rawAttributes'],function(_0x138254){return{'name':_0x138254[_0x1c3a('0x28')],'type':_0x138254[_0x1c3a('0x29')][_0x1c3a('0x2a')]};});_0x2afa29[_0x1c3a('0x2b')]=_[_0x1c3a('0x26')](_0x39cb00,_0x1c3a('0x24'));_0x2afa29[_0x1c3a('0x2c')]=_['keys'](_0x3a34d6[_0x1c3a('0x2c')]);_0x2afa29[_0x1c3a('0x2d')]=_[_0x1c3a('0x2e')](_0x2afa29['model'],_0x2afa29['query']);_0x5b8fc1[_0x1c3a('0x2f')]=_[_0x1c3a('0x2e')](_0x2afa29[_0x1c3a('0x2b')],qs[_0x1c3a('0x30')](_0x3a34d6['query'][_0x1c3a('0x30')]));_0x5b8fc1['attributes']=_0x5b8fc1[_0x1c3a('0x2f')][_0x1c3a('0x31')]?_0x5b8fc1['attributes']:_0x2afa29['model'];if(!_0x3a34d6['query'][_0x1c3a('0x32')](_0x1c3a('0x33'))){_0x5b8fc1[_0x1c3a('0x1a')]=qs['limit'](_0x3a34d6[_0x1c3a('0x2c')][_0x1c3a('0x1a')]);_0x5b8fc1['offset']=qs['offset'](_0x3a34d6[_0x1c3a('0x2c')]['offset']);}_0x5b8fc1[_0x1c3a('0x34')]=qs[_0x1c3a('0x35')](_0x3a34d6[_0x1c3a('0x2c')][_0x1c3a('0x35')]);_0x5b8fc1[_0x1c3a('0x36')]=qs[_0x1c3a('0x2d')](_[_0x1c3a('0x37')](_0x3a34d6['query'],_0x2afa29[_0x1c3a('0x2d')]),_0x39cb00);if(_0x3a34d6[_0x1c3a('0x2c')]['filter']){_0x5b8fc1[_0x1c3a('0x36')]=_[_0x1c3a('0x38')](_0x5b8fc1[_0x1c3a('0x36')],{'$or':_[_0x1c3a('0x26')](_0x39cb00,function(_0x3dc161){if(_0x3dc161[_0x1c3a('0x29')]!==_0x1c3a('0x39')){var _0x427b61={};_0x427b61[_0x3dc161['name']]={'$like':'%'+_0x3a34d6['query'][_0x1c3a('0x3a')]+'%'};return _0x427b61;}})});}_0x5b8fc1=_[_0x1c3a('0x38')]({},_0x5b8fc1,_0x3a34d6['options']);var _0xef3f38={'where':_0x5b8fc1[_0x1c3a('0x36')]};return db[_0x1c3a('0x27')][_0x1c3a('0x18')](_0xef3f38)['then'](function(_0x226d09){_0x341020[_0x1c3a('0x18')]=_0x226d09;if(_0x3a34d6[_0x1c3a('0x2c')][_0x1c3a('0x3b')]){_0x5b8fc1['include']=[{'all':!![]}];}return db[_0x1c3a('0x27')][_0x1c3a('0x3c')](_0x5b8fc1);})[_0x1c3a('0x3d')](function(_0xfcdb6b){_0x341020[_0x1c3a('0x3e')]=_0xfcdb6b;return _0x341020;})[_0x1c3a('0x3d')](respondWithFilteredResult(_0x36f3b5,_0x5b8fc1))[_0x1c3a('0x3f')](handleError(_0x36f3b5,null));};exports['show']=function(_0x2f3c45,_0x280ef8){var _0x5055b4={'raw':![],'where':{'id':_0x2f3c45[_0x1c3a('0x40')]['id']}},_0x4b121d={};_0x4b121d[_0x1c3a('0x2b')]=_[_0x1c3a('0x41')](db[_0x1c3a('0x27')][_0x1c3a('0x42')]);_0x4b121d[_0x1c3a('0x2c')]=_[_0x1c3a('0x41')](_0x2f3c45[_0x1c3a('0x2c')]);_0x4b121d[_0x1c3a('0x2d')]=_[_0x1c3a('0x2e')](_0x4b121d['model'],_0x4b121d[_0x1c3a('0x2c')]);_0x5055b4[_0x1c3a('0x2f')]=_[_0x1c3a('0x2e')](_0x4b121d['model'],qs[_0x1c3a('0x30')](_0x2f3c45['query'][_0x1c3a('0x30')]));_0x5055b4[_0x1c3a('0x2f')]=_0x5055b4[_0x1c3a('0x2f')][_0x1c3a('0x31')]?_0x5055b4[_0x1c3a('0x2f')]:_0x4b121d[_0x1c3a('0x2b')];if(_0x2f3c45[_0x1c3a('0x2c')]['includeAll']){_0x5055b4[_0x1c3a('0x43')]=[{'all':!![]}];}_0x5055b4=_[_0x1c3a('0x38')]({},_0x5055b4,_0x2f3c45['options']);return db[_0x1c3a('0x27')][_0x1c3a('0x44')](_0x5055b4)[_0x1c3a('0x3d')](handleEntityNotFound(_0x280ef8,null))[_0x1c3a('0x3d')](respondWithResult(_0x280ef8,null))[_0x1c3a('0x3f')](handleError(_0x280ef8,null));};exports[_0x1c3a('0x45')]=function(_0x2dfe4a,_0x4745dd){return db[_0x1c3a('0x27')]['create'](_0x2dfe4a[_0x1c3a('0x46')],{})['then'](respondWithResult(_0x4745dd,0xc9))[_0x1c3a('0x3f')](handleError(_0x4745dd,null));};exports['update']=function(_0x344bf0,_0x1664bf){if(_0x344bf0[_0x1c3a('0x46')]['id']){delete _0x344bf0[_0x1c3a('0x46')]['id'];}return db['UserProfileSection'][_0x1c3a('0x44')]({'where':{'id':_0x344bf0[_0x1c3a('0x40')]['id']}})[_0x1c3a('0x3d')](handleEntityNotFound(_0x1664bf,null))[_0x1c3a('0x3d')](saveUpdates(_0x344bf0['body'],null))[_0x1c3a('0x3d')](respondWithResult(_0x1664bf,null))[_0x1c3a('0x3f')](handleError(_0x1664bf,null));};exports[_0x1c3a('0x21')]=function(_0x52d52c,_0x3ac6de){return db[_0x1c3a('0x27')][_0x1c3a('0x44')]({'where':{'id':_0x52d52c[_0x1c3a('0x40')]['id']}})[_0x1c3a('0x3d')](handleEntityNotFound(_0x3ac6de,null))[_0x1c3a('0x3d')](removeEntity(_0x3ac6de,null))[_0x1c3a('0x3f')](handleError(_0x3ac6de,null));};exports[_0x1c3a('0x47')]=function(_0x1909ad,_0x50ce91){return db[_0x1c3a('0x27')][_0x1c3a('0x47')]()[_0x1c3a('0x3d')](respondWithResult(_0x50ce91,null))['catch'](handleError(_0x50ce91,null));}; \ No newline at end of file +var _0x074b=['include','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','count','then','includeAll'];(function(_0x3e50e2,_0x56adfe){var _0x21dd7d=function(_0xb26eac){while(--_0xb26eac){_0x3e50e2['push'](_0x3e50e2['shift']());}};_0x21dd7d(++_0x56adfe);}(_0x074b,0x1cf));var _0xb074=function(_0xc27a50,_0x2bf8ba){_0xc27a50=_0xc27a50-0x0;var _0x28cb32=_0x074b[_0xc27a50];return _0x28cb32;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb074('0x0'));var rimraf=require(_0xb074('0x1'));var zipdir=require(_0xb074('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb074('0x3'));var moment=require(_0xb074('0x4'));var BPromise=require(_0xb074('0x5'));var Mustache=require(_0xb074('0x6'));var util=require(_0xb074('0x7'));var path=require(_0xb074('0x8'));var sox=require(_0xb074('0x9'));var csv=require(_0xb074('0xa'));var ejs=require(_0xb074('0xb'));var fs=require('fs');var _=require(_0xb074('0xc'));var squel=require(_0xb074('0xd'));var crypto=require('crypto');var jsforce=require(_0xb074('0xe'));var deskjs=require(_0xb074('0xf'));var toCsv=require(_0xb074('0xa'));var querystring=require(_0xb074('0x10'));var Papa=require(_0xb074('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb074('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb074('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb074('0x14'));var config=require(_0xb074('0x15'));var licenseUtil=require(_0xb074('0x16'));var db=require(_0xb074('0x17'))['db'];function respondWithStatusCode(_0x160a8d,_0x426d76){_0x426d76=_0x426d76||0xcc;return function(_0xbad3ba){if(_0xbad3ba){return _0x160a8d[_0xb074('0x18')](_0x426d76);}return _0x160a8d[_0xb074('0x19')](_0x426d76)[_0xb074('0x1a')]();};}function respondWithResult(_0x21b44a,_0x5ec184){_0x5ec184=_0x5ec184||0xc8;return function(_0x176cf2){if(_0x176cf2){return _0x21b44a[_0xb074('0x19')](_0x5ec184)[_0xb074('0x1b')](_0x176cf2);}};}function respondWithFilteredResult(_0x59eb10,_0x530e4f){return function(_0x120926){if(_0x120926){var _0x288b00=_0x120926['count'],_0x42d381=_0x530e4f['offset'],_0x3b2d0f=_0x530e4f['offset']+_0x530e4f[_0xb074('0x1c')],_0xa3abe0;if(_0x3b2d0f>=_0x288b00){_0x3b2d0f=_0x288b00;_0xa3abe0=0xc8;}else{_0xa3abe0=0xce;}_0x59eb10['status'](_0xa3abe0);return _0x59eb10['set'](_0xb074('0x1d'),_0x42d381+'-'+_0x3b2d0f+'/'+_0x288b00)[_0xb074('0x1b')](_0x120926);}return null;};}function patchUpdates(_0x5ab97e){return function(_0x23b82c){try{jsonpatch[_0xb074('0x1e')](_0x23b82c,_0x5ab97e,!![]);}catch(_0x253d7d){return BPromise[_0xb074('0x1f')](_0x253d7d);}return _0x23b82c[_0xb074('0x20')]();};}function saveUpdates(_0x2a9d1c,_0x56ace0){return function(_0x3be10b){if(_0x3be10b){return _0x3be10b[_0xb074('0x21')](_0x2a9d1c)['then'](function(_0x1bf279){return _0x1bf279;});}return null;};}function removeEntity(_0x186860,_0x2681b3){return function(_0x1e232c){if(_0x1e232c){return _0x1e232c[_0xb074('0x22')]()['then'](function(){_0x186860['status'](0xcc)[_0xb074('0x1a')]();});}};}function handleEntityNotFound(_0x31bbcc,_0x3df4f6){return function(_0x549a83){if(!_0x549a83){_0x31bbcc[_0xb074('0x18')](0x194);}return _0x549a83;};}function handleError(_0x48fd86,_0x408cb7){_0x408cb7=_0x408cb7||0x1f4;return function(_0x360463){logger[_0xb074('0x23')](_0x360463[_0xb074('0x24')]);if(_0x360463[_0xb074('0x25')]){delete _0x360463[_0xb074('0x25')];}_0x48fd86[_0xb074('0x19')](_0x408cb7)[_0xb074('0x26')](_0x360463);};}exports[_0xb074('0x27')]=function(_0x1c6488,_0x54ffb3){var _0x49a8a0={},_0x2e49e7={},_0x5b3de0={'count':0x0,'rows':[]};var _0x28a74a=_[_0xb074('0x28')](db[_0xb074('0x29')]['rawAttributes'],function(_0x5a44d9){return{'name':_0x5a44d9[_0xb074('0x2a')],'type':_0x5a44d9['type'][_0xb074('0x2b')]};});_0x2e49e7[_0xb074('0x2c')]=_[_0xb074('0x28')](_0x28a74a,_0xb074('0x25'));_0x2e49e7[_0xb074('0x2d')]=_['keys'](_0x1c6488['query']);_0x2e49e7[_0xb074('0x2e')]=_[_0xb074('0x2f')](_0x2e49e7[_0xb074('0x2c')],_0x2e49e7[_0xb074('0x2d')]);_0x49a8a0['attributes']=_[_0xb074('0x2f')](_0x2e49e7['model'],qs[_0xb074('0x30')](_0x1c6488[_0xb074('0x2d')]['fields']));_0x49a8a0['attributes']=_0x49a8a0[_0xb074('0x31')]['length']?_0x49a8a0[_0xb074('0x31')]:_0x2e49e7['model'];if(!_0x1c6488[_0xb074('0x2d')][_0xb074('0x32')](_0xb074('0x33'))){_0x49a8a0[_0xb074('0x1c')]=qs[_0xb074('0x1c')](_0x1c6488[_0xb074('0x2d')]['limit']);_0x49a8a0['offset']=qs[_0xb074('0x34')](_0x1c6488[_0xb074('0x2d')][_0xb074('0x34')]);}_0x49a8a0[_0xb074('0x35')]=qs['sort'](_0x1c6488[_0xb074('0x2d')][_0xb074('0x36')]);_0x49a8a0[_0xb074('0x37')]=qs['filters'](_[_0xb074('0x38')](_0x1c6488[_0xb074('0x2d')],_0x2e49e7[_0xb074('0x2e')]),_0x28a74a);if(_0x1c6488[_0xb074('0x2d')][_0xb074('0x39')]){_0x49a8a0[_0xb074('0x37')]=_[_0xb074('0x3a')](_0x49a8a0['where'],{'$or':_[_0xb074('0x28')](_0x28a74a,function(_0xee4ff4){if(_0xee4ff4['type']!=='VIRTUAL'){var _0x174cfc={};_0x174cfc[_0xee4ff4[_0xb074('0x25')]]={'$like':'%'+_0x1c6488[_0xb074('0x2d')][_0xb074('0x39')]+'%'};return _0x174cfc;}})});}_0x49a8a0=_[_0xb074('0x3a')]({},_0x49a8a0,_0x1c6488['options']);var _0x17b13d={'where':_0x49a8a0['where']};return db[_0xb074('0x29')][_0xb074('0x3b')](_0x17b13d)[_0xb074('0x3c')](function(_0xbdd753){_0x5b3de0['count']=_0xbdd753;if(_0x1c6488[_0xb074('0x2d')][_0xb074('0x3d')]){_0x49a8a0[_0xb074('0x3e')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x49a8a0);})[_0xb074('0x3c')](function(_0x29c12a){_0x5b3de0[_0xb074('0x3f')]=_0x29c12a;return _0x5b3de0;})[_0xb074('0x3c')](respondWithFilteredResult(_0x54ffb3,_0x49a8a0))[_0xb074('0x40')](handleError(_0x54ffb3,null));};exports[_0xb074('0x41')]=function(_0x46026a,_0x2ed710){var _0x389e08={'raw':![],'where':{'id':_0x46026a[_0xb074('0x42')]['id']}},_0x521e3e={};_0x521e3e[_0xb074('0x2c')]=_[_0xb074('0x43')](db['UserProfileSection'][_0xb074('0x44')]);_0x521e3e[_0xb074('0x2d')]=_[_0xb074('0x43')](_0x46026a[_0xb074('0x2d')]);_0x521e3e[_0xb074('0x2e')]=_[_0xb074('0x2f')](_0x521e3e[_0xb074('0x2c')],_0x521e3e[_0xb074('0x2d')]);_0x389e08['attributes']=_[_0xb074('0x2f')](_0x521e3e['model'],qs[_0xb074('0x30')](_0x46026a[_0xb074('0x2d')][_0xb074('0x30')]));_0x389e08[_0xb074('0x31')]=_0x389e08[_0xb074('0x31')][_0xb074('0x45')]?_0x389e08[_0xb074('0x31')]:_0x521e3e[_0xb074('0x2c')];if(_0x46026a['query'][_0xb074('0x3d')]){_0x389e08[_0xb074('0x3e')]=[{'all':!![]}];}_0x389e08=_[_0xb074('0x3a')]({},_0x389e08,_0x46026a[_0xb074('0x46')]);return db[_0xb074('0x29')][_0xb074('0x47')](_0x389e08)[_0xb074('0x3c')](handleEntityNotFound(_0x2ed710,null))[_0xb074('0x3c')](respondWithResult(_0x2ed710,null))[_0xb074('0x40')](handleError(_0x2ed710,null));};exports[_0xb074('0x48')]=function(_0x48a236,_0x11bafd){return db['UserProfileSection'][_0xb074('0x48')](_0x48a236['body'],{})[_0xb074('0x3c')](respondWithResult(_0x11bafd,0xc9))[_0xb074('0x40')](handleError(_0x11bafd,null));};exports[_0xb074('0x21')]=function(_0x3c1152,_0x497bc9){if(_0x3c1152['body']['id']){delete _0x3c1152[_0xb074('0x49')]['id'];}return db[_0xb074('0x29')][_0xb074('0x47')]({'where':{'id':_0x3c1152['params']['id']}})['then'](handleEntityNotFound(_0x497bc9,null))['then'](saveUpdates(_0x3c1152[_0xb074('0x49')],null))[_0xb074('0x3c')](respondWithResult(_0x497bc9,null))['catch'](handleError(_0x497bc9,null));};exports[_0xb074('0x22')]=function(_0x128f71,_0x53451b){return db['UserProfileSection']['find']({'where':{'id':_0x128f71['params']['id']}})[_0xb074('0x3c')](handleEntityNotFound(_0x53451b,null))[_0xb074('0x3c')](removeEntity(_0x53451b,null))[_0xb074('0x40')](handleError(_0x53451b,null));};exports[_0xb074('0x4a')]=function(_0x2be014,_0x50a5ba){return db[_0xb074('0x29')][_0xb074('0x4a')]()[_0xb074('0x3c')](respondWithResult(_0x50a5ba,null))[_0xb074('0x40')](handleError(_0x50a5ba,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 836c28a..d68b2e5 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 _0x7501=['request-promise','rimraf','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3f5d1a,_0x33400b){var _0x2db38a=function(_0x1bd67a){while(--_0x1bd67a){_0x3f5d1a['push'](_0x3f5d1a['shift']());}};_0x2db38a(++_0x33400b);}(_0x7501,0xcc));var _0x1750=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7501[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x1750('0x0'));var util=require(_0x1750('0x1'));var logger=require(_0x1750('0x2'))(_0x1750('0x3'));var moment=require(_0x1750('0x4'));var BPromise=require(_0x1750('0x5'));var rp=require(_0x1750('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1750('0x7'));var config=require('../../config/environment');var attributes=require(_0x1750('0x8'));module[_0x1750('0x9')]=function(_0x14517f,_0x45358f){return _0x14517f['define'](_0x1750('0xa'),attributes,{'tableName':_0x1750('0xb'),'paranoid':![],'indexes':[{'name':_0x1750('0xc'),'fields':[_0x1750('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7e8=['./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x24a9d2,_0x2f4da5){var _0xb44a75=function(_0x22b8a8){while(--_0x22b8a8){_0x24a9d2['push'](_0x24a9d2['shift']());}};_0xb44a75(++_0x2f4da5);}(_0xf7e8,0x1f0));var _0x8f7e=function(_0x289ef5,_0x525a93){_0x289ef5=_0x289ef5-0x0;var _0x97005c=_0xf7e8[_0x289ef5];return _0x97005c;};'use strict';var _=require(_0x8f7e('0x0'));var util=require(_0x8f7e('0x1'));var logger=require(_0x8f7e('0x2'))(_0x8f7e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f7e('0x4'));var fs=require('fs');var path=require(_0x8f7e('0x5'));var rimraf=require(_0x8f7e('0x6'));var config=require(_0x8f7e('0x7'));var attributes=require(_0x8f7e('0x8'));module[_0x8f7e('0x9')]=function(_0x4067df,_0x50915f){return _0x4067df[_0x8f7e('0xa')]('UserProfileSection',attributes,{'tableName':_0x8f7e('0xb'),'paranoid':![],'indexes':[{'name':_0x8f7e('0xc'),'fields':[_0x8f7e('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 2ea3991..41d1cb9 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 _0x37fc=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x53ce56,_0xb5ae3d){var _0x2c3107=function(_0xb2facf){while(--_0xb2facf){_0x53ce56['push'](_0x53ce56['shift']());}};_0x2c3107(++_0xb5ae3d);}(_0x37fc,0xba));var _0xc37f=function(_0x2fab22,_0x575286){_0x2fab22=_0x2fab22-0x0;var _0x3d6308=_0x37fc[_0x2fab22];return _0x3d6308;};'use strict';var _=require('lodash');var util=require(_0xc37f('0x0'));var moment=require(_0xc37f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc37f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xc37f('0x3'))(_0xc37f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc37f('0x5')][_0xc37f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x21ef74,_0x3189eb,_0xd06951){return new BPromise(function(_0x160f75,_0x142ece){return client[_0xc37f('0x7')](_0x21ef74,_0xd06951)[_0xc37f('0x8')](function(_0x371e2e){logger[_0xc37f('0x9')](_0xc37f('0xa'),_0x3189eb,_0xc37f('0xb'));logger['debug'](_0xc37f('0xc'),_0x3189eb,_0xc37f('0xb'),JSON[_0xc37f('0xd')](_0x371e2e));if(_0x371e2e[_0xc37f('0xe')]){if(_0x371e2e[_0xc37f('0xe')][_0xc37f('0xf')]===0x1f4){logger['error'](_0xc37f('0xa'),_0x3189eb,_0x371e2e[_0xc37f('0xe')][_0xc37f('0x10')]);return _0x142ece(_0x371e2e[_0xc37f('0xe')][_0xc37f('0x10')]);}logger[_0xc37f('0xe')](_0xc37f('0xa'),_0x3189eb,_0x371e2e[_0xc37f('0xe')][_0xc37f('0x10')]);return _0x160f75(_0x371e2e[_0xc37f('0xe')][_0xc37f('0x10')]);}else{logger['info'](_0xc37f('0xa'),_0x3189eb,'request\x20sent');_0x160f75(_0x371e2e['result'][_0xc37f('0x10')]);}})[_0xc37f('0x11')](function(_0x3f9070){logger[_0xc37f('0xe')](_0xc37f('0xa'),_0x3189eb,_0x3f9070);_0x142ece(_0x3f9070);});});} \ No newline at end of file +var _0x9c69=['UserProfileSection,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d28db,_0x59367b){var _0x2d9e9d=function(_0x407cea){while(--_0x407cea){_0x2d28db['push'](_0x2d28db['shift']());}};_0x2d9e9d(++_0x59367b);}(_0x9c69,0xb7));var _0x99c6=function(_0x2e5727,_0x1a1910){_0x2e5727=_0x2e5727-0x0;var _0x41faad=_0x9c69[_0x2e5727];return _0x41faad;};'use strict';var _=require(_0x99c6('0x0'));var util=require(_0x99c6('0x1'));var moment=require(_0x99c6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99c6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x99c6('0x4'))(_0x99c6('0x5'));var config=require(_0x99c6('0x6'));var jayson=require(_0x99c6('0x7'));var client=jayson[_0x99c6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x238d8,_0x71d8ac,_0x2838fb){return new BPromise(function(_0x3f6885,_0x288a94){return client[_0x99c6('0x9')](_0x238d8,_0x2838fb)['then'](function(_0xe6930b){logger[_0x99c6('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x71d8ac,_0x99c6('0xb'));logger[_0x99c6('0xc')](_0x99c6('0xd'),_0x71d8ac,_0x99c6('0xb'),JSON[_0x99c6('0xe')](_0xe6930b));if(_0xe6930b[_0x99c6('0xf')]){if(_0xe6930b[_0x99c6('0xf')][_0x99c6('0x10')]===0x1f4){logger['error'](_0x99c6('0x11'),_0x71d8ac,_0xe6930b[_0x99c6('0xf')][_0x99c6('0x12')]);return _0x288a94(_0xe6930b['error']['message']);}logger['error'](_0x99c6('0x11'),_0x71d8ac,_0xe6930b['error'][_0x99c6('0x12')]);return _0x3f6885(_0xe6930b[_0x99c6('0xf')][_0x99c6('0x12')]);}else{logger['info'](_0x99c6('0x11'),_0x71d8ac,_0x99c6('0xb'));_0x3f6885(_0xe6930b['result'][_0x99c6('0x12')]);}})[_0x99c6('0x13')](function(_0x3af1f1){logger['error'](_0x99c6('0x11'),_0x71d8ac,_0x3af1f1);_0x288a94(_0x3af1f1);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6e8d4a4..353fb79 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 _0x5900=['path','connect-timeout','../../components/auth/service','../../config/environment','exports'];(function(_0x3f33e7,_0x50959f){var _0x56f861=function(_0x7f51d4){while(--_0x7f51d4){_0x3f33e7['push'](_0x3f33e7['shift']());}};_0x56f861(++_0x50959f);}(_0x5900,0x131));var _0x0590=function(_0x1d6f1e,_0x22a3f2){_0x1d6f1e=_0x1d6f1e-0x0;var _0xc74a85=_0x5900[_0x1d6f1e];return _0xc74a85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0590('0x0'));var timeout=require(_0x0590('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x0590('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x0590('0x3'));module[_0x0590('0x4')]=router; \ No newline at end of file +var _0x0b7b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x0b7b,0x13b));var _0xb0b7=function(_0x4a9efa,_0x2f7e42){_0x4a9efa=_0x4a9efa-0x0;var _0x5d022d=_0x0b7b[_0x4a9efa];return _0x5d022d;};'use strict';var multer=require('multer');var util=require(_0xb0b7('0x0'));var path=require(_0xb0b7('0x1'));var timeout=require(_0xb0b7('0x2'));var express=require(_0xb0b7('0x3'));var router=express[_0xb0b7('0x4')]();var auth=require(_0xb0b7('0x5'));var interaction=require(_0xb0b7('0x6'));var config=require(_0xb0b7('0x7'));module[_0xb0b7('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2fda61f..93dc655 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 _0xb10b=['sequelize','INTEGER'];(function(_0x189acb,_0x1f50cc){var _0x10c455=function(_0x52a5df){while(--_0x52a5df){_0x189acb['push'](_0x189acb['shift']());}};_0x10c455(++_0x1f50cc);}(_0xb10b,0x12a));var _0xbb10=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0xb10b[_0x9e7f3a];return _0x5ab145;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 264852d..7a47be0 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 _0x7322=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0x7322,0x123));var _0x2732=function(_0x2badac,_0x4b93fa){_0x2badac=_0x2badac-0x0;var _0x28276c=_0x7322[_0x2badac];return _0x28276c;};'use strict';var _=require(_0x2732('0x0'));var util=require(_0x2732('0x1'));var logger=require(_0x2732('0x2'))(_0x2732('0x3'));var moment=require(_0x2732('0x4'));var BPromise=require(_0x2732('0x5'));var rp=require(_0x2732('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2732('0x7'));var config=require(_0x2732('0x8'));var attributes=require(_0x2732('0x9'));module[_0x2732('0xa')]=function(_0x1ef03f,_0x546010){return _0x1ef03f[_0x2732('0xb')](_0x2732('0xc'),attributes,{'tableName':_0x2732('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb30=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','api','bluebird','path'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0xdb30,0x188));var _0x0db3=function(_0x3233cb,_0x45ce67){_0x3233cb=_0x3233cb-0x0;var _0xd6adbe=_0xdb30[_0x3233cb];return _0xd6adbe;};'use strict';var _=require('lodash');var util=require(_0x0db3('0x0'));var logger=require('../../config/logger')(_0x0db3('0x1'));var moment=require('moment');var BPromise=require(_0x0db3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0db3('0x3'));var rimraf=require(_0x0db3('0x4'));var config=require(_0x0db3('0x5'));var attributes=require(_0x0db3('0x6'));module[_0x0db3('0x7')]=function(_0x3bd6b4,_0x34c337){return _0x3bd6b4[_0x0db3('0x8')](_0x0db3('0x9'),attributes,{'tableName':_0x0db3('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 43995ed..39b7ae1 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 _0x2242=['then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x3c304f,_0x242994){var _0x133b54=function(_0x174c98){while(--_0x174c98){_0x3c304f['push'](_0x3c304f['shift']());}};_0x133b54(++_0x242994);}(_0x2242,0x186));var _0x2224=function(_0x584a28,_0xe53da2){_0x584a28=_0x584a28-0x0;var _0x143fab=_0x2242[_0x584a28];return _0x143fab;};'use strict';var _=require('lodash');var util=require(_0x2224('0x0'));var moment=require('moment');var BPromise=require(_0x2224('0x1'));var rs=require(_0x2224('0x2'));var fs=require('fs');var Redis=require(_0x2224('0x3'));var db=require(_0x2224('0x4'))['db'];var utils=require(_0x2224('0x5'));var logger=require('../../config/logger')(_0x2224('0x6'));var config=require(_0x2224('0x7'));var jayson=require(_0x2224('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1c59,_0x59791a,_0x454e52){return new BPromise(function(_0x41b668,_0x36b3a3){return client[_0x2224('0x9')](_0x2a1c59,_0x454e52)[_0x2224('0xa')](function(_0x551c9a){logger[_0x2224('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x59791a,_0x2224('0xc'));logger[_0x2224('0xd')](_0x2224('0xe'),_0x59791a,_0x2224('0xc'),JSON[_0x2224('0xf')](_0x551c9a));if(_0x551c9a[_0x2224('0x10')]){if(_0x551c9a[_0x2224('0x10')][_0x2224('0x11')]===0x1f4){logger[_0x2224('0x10')](_0x2224('0x12'),_0x59791a,_0x551c9a['error']['message']);return _0x36b3a3(_0x551c9a[_0x2224('0x10')][_0x2224('0x13')]);}logger['error'](_0x2224('0x12'),_0x59791a,_0x551c9a[_0x2224('0x10')][_0x2224('0x13')]);return _0x41b668(_0x551c9a[_0x2224('0x10')][_0x2224('0x13')]);}else{logger[_0x2224('0xb')](_0x2224('0x12'),_0x59791a,_0x2224('0xc'));_0x41b668(_0x551c9a['result'][_0x2224('0x13')]);}})['catch'](function(_0x4aaeb8){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x59791a,_0x4aaeb8);_0x36b3a3(_0x4aaeb8);});});} \ No newline at end of file +var _0x5795=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x5795,0x179));var _0x5579=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5795[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x5579('0x0'));var util=require(_0x5579('0x1'));var moment=require('moment');var BPromise=require(_0x5579('0x2'));var rs=require(_0x5579('0x3'));var fs=require('fs');var Redis=require(_0x5579('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5579('0x5'));var logger=require(_0x5579('0x6'))(_0x5579('0x7'));var config=require(_0x5579('0x8'));var jayson=require(_0x5579('0x9'));var client=jayson['client'][_0x5579('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f0b4b,_0x331c8e,_0x4e480e){return new BPromise(function(_0x4cb398,_0x4c6b37){return client[_0x5579('0xb')](_0x5f0b4b,_0x4e480e)['then'](function(_0x2b97fc){logger[_0x5579('0xc')](_0x5579('0xd'),_0x331c8e,'request\x20sent');logger[_0x5579('0xe')](_0x5579('0xf'),_0x331c8e,_0x5579('0x10'),JSON[_0x5579('0x11')](_0x2b97fc));if(_0x2b97fc[_0x5579('0x12')]){if(_0x2b97fc[_0x5579('0x12')][_0x5579('0x13')]===0x1f4){logger['error'](_0x5579('0xd'),_0x331c8e,_0x2b97fc[_0x5579('0x12')]['message']);return _0x4c6b37(_0x2b97fc[_0x5579('0x12')][_0x5579('0x14')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x331c8e,_0x2b97fc[_0x5579('0x12')][_0x5579('0x14')]);return _0x4cb398(_0x2b97fc['error'][_0x5579('0x14')]);}else{logger['info'](_0x5579('0xd'),_0x331c8e,'request\x20sent');_0x4cb398(_0x2b97fc['result'][_0x5579('0x14')]);}})[_0x5579('0x15')](function(_0x5b7af0){logger[_0x5579('0x12')](_0x5579('0xd'),_0x331c8e,_0x5b7af0);_0x4c6b37(_0x5b7af0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 0063c7c..4f6d041 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 _0xd16f=['util','path','connect-timeout','express','Router','../../components/auth/service','exports','multer'];(function(_0x3d58c6,_0x21978b){var _0x42fc57=function(_0x4baac7){while(--_0x4baac7){_0x3d58c6['push'](_0x3d58c6['shift']());}};_0x42fc57(++_0x21978b);}(_0xd16f,0xdf));var _0xfd16=function(_0x15ac62,_0x16ea09){_0x15ac62=_0x15ac62-0x0;var _0x5c12f4=_0xd16f[_0x15ac62];return _0x5c12f4;};'use strict';var multer=require(_0xfd16('0x0'));var util=require(_0xfd16('0x1'));var path=require(_0xfd16('0x2'));var timeout=require(_0xfd16('0x3'));var express=require(_0xfd16('0x4'));var router=express[_0xfd16('0x5')]();var auth=require(_0xfd16('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xfd16('0x7')]=router; \ No newline at end of file +var _0x2c04=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x3bba1b,_0x350f70){var _0x32415b=function(_0x4f323d){while(--_0x4f323d){_0x3bba1b['push'](_0x3bba1b['shift']());}};_0x32415b(++_0x350f70);}(_0x2c04,0x1d5));var _0x42c0=function(_0xc45fc9,_0x29903a){_0xc45fc9=_0xc45fc9-0x0;var _0x589896=_0x2c04[_0xc45fc9];return _0x589896;};'use strict';var multer=require(_0x42c0('0x0'));var util=require(_0x42c0('0x1'));var path=require(_0x42c0('0x2'));var timeout=require(_0x42c0('0x3'));var express=require(_0x42c0('0x4'));var router=express[_0x42c0('0x5')]();var auth=require(_0x42c0('0x6'));var interaction=require(_0x42c0('0x7'));var config=require(_0x42c0('0x8'));module[_0x42c0('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f6894d8..939c8b1 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x34b9c5,_0x42700f){var _0x10b193=function(_0x14df10){while(--_0x14df10){_0x34b9c5['push'](_0x34b9c5['shift']());}};_0x10b193(++_0x42700f);}(_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 f0e1189..516a767 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 _0xb7c8=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xb7c8,0x119));var _0x8b7c=function(_0x2fdcbd,_0x5b30f1){_0x2fdcbd=_0x2fdcbd-0x0;var _0x2eda01=_0xb7c8[_0x2fdcbd];return _0x2eda01;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x984b=['api','moment','bluebird','rimraf','../../config/environment','UserVoiceQueue','user_has_voice_queues'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x984b,0xee));var _0xb984=function(_0x42ff12,_0x208c4d){_0x42ff12=_0x42ff12-0x0;var _0x5cccd7=_0x984b[_0x42ff12];return _0x5cccd7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb984('0x0'));var moment=require(_0xb984('0x1'));var BPromise=require(_0xb984('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb984('0x3'));var config=require(_0xb984('0x4'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x2cca53,_0x46c541){return _0x2cca53['define'](_0xb984('0x5'),attributes,{'tableName':_0xb984('0x6'),'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 f765f88..65e1182 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 _0x180b=['UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x180b,0x163));var _0xb180=function(_0x18745b,_0x58cf33){_0x18745b=_0x18745b-0x0;var _0x786031=_0x180b[_0x18745b];return _0x786031;};'use strict';var _=require(_0xb180('0x0'));var util=require('util');var moment=require(_0xb180('0x1'));var BPromise=require(_0xb180('0x2'));var rs=require(_0xb180('0x3'));var fs=require('fs');var Redis=require(_0xb180('0x4'));var db=require(_0xb180('0x5'))['db'];var utils=require(_0xb180('0x6'));var logger=require(_0xb180('0x7'))(_0xb180('0x8'));var config=require(_0xb180('0x9'));var jayson=require(_0xb180('0xa'));var client=jayson[_0xb180('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x772960,_0x312747,_0x270a7a){return new BPromise(function(_0x34f955,_0x132bad){return client[_0xb180('0xc')](_0x772960,_0x270a7a)[_0xb180('0xd')](function(_0xb8a81c){logger[_0xb180('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x312747,_0xb180('0xf'));logger[_0xb180('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x312747,_0xb180('0xf'),JSON[_0xb180('0x11')](_0xb8a81c));if(_0xb8a81c[_0xb180('0x12')]){if(_0xb8a81c[_0xb180('0x12')]['code']===0x1f4){logger[_0xb180('0x12')](_0xb180('0x13'),_0x312747,_0xb8a81c[_0xb180('0x12')][_0xb180('0x14')]);return _0x132bad(_0xb8a81c[_0xb180('0x12')][_0xb180('0x14')]);}logger[_0xb180('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x312747,_0xb8a81c[_0xb180('0x12')][_0xb180('0x14')]);return _0x34f955(_0xb8a81c[_0xb180('0x12')][_0xb180('0x14')]);}else{logger[_0xb180('0xe')](_0xb180('0x13'),_0x312747,_0xb180('0xf'));_0x34f955(_0xb8a81c[_0xb180('0x15')][_0xb180('0x14')]);}})['catch'](function(_0x29c11f){logger[_0xb180('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x312747,_0x29c11f);_0x132bad(_0x29c11f);});});} \ No newline at end of file +var _0x4645=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x784808,_0x17065e){var _0x4c974b=function(_0x329ac0){while(--_0x329ac0){_0x784808['push'](_0x784808['shift']());}};_0x4c974b(++_0x17065e);}(_0x4645,0x1cf));var _0x5464=function(_0x4503c0,_0xa5e57e){_0x4503c0=_0x4503c0-0x0;var _0x3ed3cd=_0x4645[_0x4503c0];return _0x3ed3cd;};'use strict';var _=require(_0x5464('0x0'));var util=require(_0x5464('0x1'));var moment=require('moment');var BPromise=require(_0x5464('0x2'));var rs=require(_0x5464('0x3'));var fs=require('fs');var Redis=require(_0x5464('0x4'));var db=require(_0x5464('0x5'))['db'];var utils=require(_0x5464('0x6'));var logger=require(_0x5464('0x7'))(_0x5464('0x8'));var config=require(_0x5464('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5464('0xa')][_0x5464('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ac02d,_0x53ae8e,_0x48c90b){return new BPromise(function(_0x9a3918,_0x4e2edd){return client[_0x5464('0xc')](_0x1ac02d,_0x48c90b)['then'](function(_0x347e5d){logger[_0x5464('0xd')](_0x5464('0xe'),_0x53ae8e,_0x5464('0xf'));logger[_0x5464('0x10')](_0x5464('0x11'),_0x53ae8e,_0x5464('0xf'),JSON[_0x5464('0x12')](_0x347e5d));if(_0x347e5d[_0x5464('0x13')]){if(_0x347e5d[_0x5464('0x13')][_0x5464('0x14')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x53ae8e,_0x347e5d[_0x5464('0x13')][_0x5464('0x15')]);return _0x4e2edd(_0x347e5d[_0x5464('0x13')][_0x5464('0x15')]);}logger[_0x5464('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x53ae8e,_0x347e5d[_0x5464('0x13')][_0x5464('0x15')]);return _0x9a3918(_0x347e5d['error'][_0x5464('0x15')]);}else{logger[_0x5464('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x53ae8e,_0x5464('0xf'));_0x9a3918(_0x347e5d[_0x5464('0x16')][_0x5464('0x15')]);}})['catch'](function(_0x5c7edc){logger[_0x5464('0x13')](_0x5464('0xe'),_0x53ae8e,_0x5c7edc);_0x4e2edd(_0x5c7edc);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index aadcd72..a70a03c 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 _0xbad6=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x50c50b,_0x3a6fb3){var _0x423c29=function(_0x223cf6){while(--_0x223cf6){_0x50c50b['push'](_0x50c50b['shift']());}};_0x423c29(++_0x3a6fb3);}(_0xbad6,0xa3));var _0x6bad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbad6[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x6bad('0x0'));var util=require(_0x6bad('0x1'));var path=require(_0x6bad('0x2'));var timeout=require(_0x6bad('0x3'));var express=require(_0x6bad('0x4'));var router=express[_0x6bad('0x5')]();var auth=require(_0x6bad('0x6'));var interaction=require(_0x6bad('0x7'));var config=require(_0x6bad('0x8'));module['exports']=router; \ No newline at end of file +var _0xbb0f=['../../components/interaction/service','exports','multer','util','Router','../../components/auth/service'];(function(_0x341c75,_0x799dff){var _0x2696ad=function(_0x13d737){while(--_0x13d737){_0x341c75['push'](_0x341c75['shift']());}};_0x2696ad(++_0x799dff);}(_0xbb0f,0x92));var _0xfbb0=function(_0x5cb936,_0x40d65f){_0x5cb936=_0x5cb936-0x0;var _0x1ef338=_0xbb0f[_0x5cb936];return _0x1ef338;};'use strict';var multer=require(_0xfbb0('0x0'));var util=require(_0xfbb0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfbb0('0x2')]();var auth=require(_0xfbb0('0x3'));var interaction=require(_0xfbb0('0x4'));var config=require('../../config/environment');module[_0xfbb0('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f8858bd..412ed7b 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 _0x89e4=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x9c8a97,_0x540bd1){var _0x28ed79=function(_0x1ca525){while(--_0x1ca525){_0x9c8a97['push'](_0x9c8a97['shift']());}};_0x28ed79(++_0x540bd1);}(_0x89e4,0xb7));var _0x489e=function(_0xe3e26e,_0x20503e){_0xe3e26e=_0xe3e26e-0x0;var _0x41926f=_0x89e4[_0xe3e26e];return _0x41926f;};'use strict';var Sequelize=require(_0x489e('0x0'));module[_0x489e('0x1')]={'uniqueid':{'type':Sequelize[_0x489e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x489e('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x489e('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x489e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x489e('0x4')],'allowNull':![],'unique':_0x489e('0x5'),'comment':_0x489e('0x3')},'penalty':{'type':Sequelize[_0x489e('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x489e('0x2')](0xb),'defaultValue':0x0,'comment':_0x489e('0x3')}}; \ No newline at end of file +var _0x6f29=['INTEGER','sequelize','exports','STRING','Required\x20by\x20Asterisk'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x6f29,0x1aa));var _0x96f2=function(_0x20a5df,_0x4e1567){_0x20a5df=_0x20a5df-0x0;var _0x2124e4=_0x6f29[_0x20a5df];return _0x2124e4;};'use strict';var Sequelize=require(_0x96f2('0x0'));module[_0x96f2('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x96f2('0x2')],'allowNull':![],'comment':_0x96f2('0x3')},'UserId':{'type':Sequelize[_0x96f2('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x96f2('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x96f2('0x3')},'VoiceQueueId':{'type':Sequelize[_0x96f2('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x96f2('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x96f2('0x3')},'penalty':{'type':Sequelize[_0x96f2('0x4')](0xb),'defaultValue':0x0,'comment':_0x96f2('0x3')},'paused':{'type':Sequelize[_0x96f2('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 05d1381..d81906c 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 _0xe61e=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','hasOwnProperty','hook'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xe61e,0x189));var _0xee61=function(_0x11bb5e,_0xc5cbe9){_0x11bb5e=_0x11bb5e-0x0;var _0x229cca=_0xe61e[_0x11bb5e];return _0x229cca;};'use strict';var EventEmitter=require(_0xee61('0x0'));var UserVoiceQueueRt=require(_0xee61('0x1'))['db'][_0xee61('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xee61('0x3')](0x0);var events={'afterCreate':_0xee61('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x19e479){return function(_0x35a1ef,_0x4ed2bf,_0x19531c){UserVoiceQueueRtEvents['emit'](_0x19e479+':'+_0x35a1ef['id'],_0x35a1ef);UserVoiceQueueRtEvents['emit'](_0x19e479,_0x35a1ef);_0x19531c(null);};}for(var e in events){if(events[_0xee61('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xee61('0x6')](e,emitEvent(event));}}module[_0xee61('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5bf6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x14b5e2,_0x1f0a6d){var _0xc6d09=function(_0xeb92e3){while(--_0xeb92e3){_0x14b5e2['push'](_0x14b5e2['shift']());}};_0xc6d09(++_0x1f0a6d);}(_0x5bf6,0x16c));var _0x65bf=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x5bf6[_0x3b3a82];return _0x267063;};'use strict';var EventEmitter=require(_0x65bf('0x0'));var UserVoiceQueueRt=require(_0x65bf('0x1'))['db'][_0x65bf('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x65bf('0x3')](0x0);var events={'afterCreate':_0x65bf('0x4'),'afterUpdate':_0x65bf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5221af){return function(_0x45b4f9,_0x15a2ab,_0x10e3a5){UserVoiceQueueRtEvents[_0x65bf('0x6')](_0x5221af+':'+_0x45b4f9['id'],_0x45b4f9);UserVoiceQueueRtEvents['emit'](_0x5221af,_0x45b4f9);_0x10e3a5(null);};}for(var e in events){if(events[_0x65bf('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x65bf('0x8')](e,emitEvent(event));}}module[_0x65bf('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 1841022..1861266 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 _0xb302=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird'];(function(_0xbd81b5,_0x5e3379){var _0x126182=function(_0x1f648c){while(--_0x1f648c){_0xbd81b5['push'](_0xbd81b5['shift']());}};_0x126182(++_0x5e3379);}(_0xb302,0x12f));var _0x2b30=function(_0x40485f,_0x22a777){_0x40485f=_0x40485f-0x0;var _0x3fd8c5=_0xb302[_0x40485f];return _0x3fd8c5;};'use strict';var _=require(_0x2b30('0x0'));var util=require(_0x2b30('0x1'));var logger=require(_0x2b30('0x2'))('api');var moment=require(_0x2b30('0x3'));var BPromise=require(_0x2b30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b30('0x5'));var attributes=require(_0x2b30('0x6'));module[_0x2b30('0x7')]=function(_0x23ee7a,_0x7a477a){return _0x23ee7a[_0x2b30('0x8')](_0x2b30('0x9'),attributes,{'tableName':_0x2b30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70bb=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x1c450e,_0x8cd2b5){var _0x3bc620=function(_0x224d7a){while(--_0x224d7a){_0x1c450e['push'](_0x1c450e['shift']());}};_0x3bc620(++_0x8cd2b5);}(_0x70bb,0x178));var _0xb70b=function(_0x385380,_0x1a8069){_0x385380=_0x385380-0x0;var _0x1cfcd3=_0x70bb[_0x385380];return _0x1cfcd3;};'use strict';var _=require(_0xb70b('0x0'));var util=require(_0xb70b('0x1'));var logger=require(_0xb70b('0x2'))(_0xb70b('0x3'));var moment=require(_0xb70b('0x4'));var BPromise=require('bluebird');var rp=require(_0xb70b('0x5'));var fs=require('fs');var path=require(_0xb70b('0x6'));var rimraf=require('rimraf');var config=require(_0xb70b('0x7'));var attributes=require(_0xb70b('0x8'));module[_0xb70b('0x9')]=function(_0x3fe8d0,_0x389ce4){return _0x3fe8d0['define'](_0xb70b('0xa'),attributes,{'tableName':_0xb70b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index ee49d97..9ed8333 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 _0x2d4c=['defaults','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis'];(function(_0x5de889,_0x115fc4){var _0x549a4f=function(_0x1255e8){while(--_0x1255e8){_0x5de889['push'](_0x5de889['shift']());}};_0x549a4f(++_0x115fc4);}(_0x2d4c,0x1bc));var _0xc2d4=function(_0x10e158,_0x4ae99e){_0x10e158=_0x10e158-0x0;var _0x1169d9=_0x2d4c[_0x10e158];return _0x1169d9;};'use strict';var _=require(_0xc2d4('0x0'));var util=require('util');var moment=require(_0xc2d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xc2d4('0x2'));var fs=require('fs');var Redis=require(_0xc2d4('0x3'));var db=require(_0xc2d4('0x4'))['db'];var utils=require(_0xc2d4('0x5'));var logger=require('../../config/logger')(_0xc2d4('0x6'));var config=require(_0xc2d4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc2d4('0x8')][_0xc2d4('0x9')]({'port':0x232a});config[_0xc2d4('0xa')]=_[_0xc2d4('0xb')](config['redis'],{'host':_0xc2d4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xc2d4('0xd')](socket);function respondWithRpcPromise(_0x123dc5,_0xe8ce76,_0x4e76fc){return new BPromise(function(_0x3e5c65,_0x34be6e){return client[_0xc2d4('0xe')](_0x123dc5,_0x4e76fc)[_0xc2d4('0xf')](function(_0x289400){logger[_0xc2d4('0x10')](_0xc2d4('0x11'),_0xe8ce76,_0xc2d4('0x12'));logger[_0xc2d4('0x13')](_0xc2d4('0x14'),_0xe8ce76,_0xc2d4('0x12'),JSON[_0xc2d4('0x15')](_0x289400));if(_0x289400[_0xc2d4('0x16')]){if(_0x289400[_0xc2d4('0x16')][_0xc2d4('0x17')]===0x1f4){logger[_0xc2d4('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xe8ce76,_0x289400[_0xc2d4('0x16')][_0xc2d4('0x18')]);return _0x34be6e(_0x289400['error'][_0xc2d4('0x18')]);}logger[_0xc2d4('0x16')](_0xc2d4('0x11'),_0xe8ce76,_0x289400['error'][_0xc2d4('0x18')]);return _0x3e5c65(_0x289400[_0xc2d4('0x16')][_0xc2d4('0x18')]);}else{logger['info'](_0xc2d4('0x11'),_0xe8ce76,_0xc2d4('0x12'));_0x3e5c65(_0x289400[_0xc2d4('0x19')][_0xc2d4('0x18')]);}})['catch'](function(_0x5ea7ef){logger[_0xc2d4('0x16')](_0xc2d4('0x11'),_0xe8ce76,_0x5ea7ef);_0x34be6e(_0x5ea7ef);});});}exports[_0xc2d4('0x1a')]=function(_0x4ab517){var _0x327a59=this;return new Promise(function(_0x16b4cf,_0x4e5b41){return db[_0xc2d4('0x1b')]['findAll']({'raw':_0x4ab517[_0xc2d4('0x1c')]?_0x4ab517[_0xc2d4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab517[_0xc2d4('0x1c')]?_0x4ab517[_0xc2d4('0x1c')][_0xc2d4('0x1d')]||null:null,'attributes':[[db[_0xc2d4('0x1e')]['fn'](_0xc2d4('0x1f'),db[_0xc2d4('0x1e')]['fn']('IF',db[_0xc2d4('0x1e')][_0xc2d4('0x20')](_0xc2d4('0x21')))),_0xc2d4('0x22')]]})['then'](function(_0x379604){logger[_0xc2d4('0x10')](_0xc2d4('0x1a'),_0x4ab517);logger['debug'](_0xc2d4('0x1a'),_0x4ab517,JSON[_0xc2d4('0x15')](_0x379604));_0x16b4cf(_0x379604);})['catch'](function(_0x2cad7c){logger[_0xc2d4('0x16')](_0xc2d4('0x1a'),_0x2cad7c['message'],_0x4ab517);_0x4e5b41(_0x327a59['error'](0x1f4,_0x2cad7c[_0xc2d4('0x18')]));});});}; \ No newline at end of file +var _0x05d6=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug'];(function(_0x4cc088,_0x1bc398){var _0x1eac8c=function(_0x4a8f6c){while(--_0x4a8f6c){_0x4cc088['push'](_0x4cc088['shift']());}};_0x1eac8c(++_0x1bc398);}(_0x05d6,0x15e));var _0x605d=function(_0x58c159,_0x1cf867){_0x58c159=_0x58c159-0x0;var _0x36e111=_0x05d6[_0x58c159];return _0x36e111;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x605d('0x0'));var rs=require(_0x605d('0x1'));var fs=require('fs');var Redis=require(_0x605d('0x2'));var db=require(_0x605d('0x3'))['db'];var utils=require(_0x605d('0x4'));var logger=require(_0x605d('0x5'))('rpc');var config=require(_0x605d('0x6'));var jayson=require(_0x605d('0x7'));var client=jayson['client'][_0x605d('0x8')]({'port':0x232a});config[_0x605d('0x9')]=_[_0x605d('0xa')](config[_0x605d('0x9')],{'host':_0x605d('0xb'),'port':0x18eb});var socket=require(_0x605d('0xc'))(new Redis(config[_0x605d('0x9')]));require(_0x605d('0xd'))[_0x605d('0xe')](socket);function respondWithRpcPromise(_0xa15c2c,_0x2652d0,_0x21a87d){return new BPromise(function(_0x5e4d3b,_0x38caee){return client[_0x605d('0xf')](_0xa15c2c,_0x21a87d)[_0x605d('0x10')](function(_0x2c3bd7){logger[_0x605d('0x11')](_0x605d('0x12'),_0x2652d0,'request\x20sent');logger[_0x605d('0x13')](_0x605d('0x14'),_0x2652d0,'request\x20sent',JSON[_0x605d('0x15')](_0x2c3bd7));if(_0x2c3bd7[_0x605d('0x16')]){if(_0x2c3bd7['error'][_0x605d('0x17')]===0x1f4){logger[_0x605d('0x16')](_0x605d('0x12'),_0x2652d0,_0x2c3bd7[_0x605d('0x16')][_0x605d('0x18')]);return _0x38caee(_0x2c3bd7[_0x605d('0x16')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2652d0,_0x2c3bd7[_0x605d('0x16')][_0x605d('0x18')]);return _0x5e4d3b(_0x2c3bd7[_0x605d('0x16')]['message']);}else{logger[_0x605d('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2652d0,_0x605d('0x19'));_0x5e4d3b(_0x2c3bd7[_0x605d('0x1a')][_0x605d('0x18')]);}})['catch'](function(_0x40e93d){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2652d0,_0x40e93d);_0x38caee(_0x40e93d);});});}exports[_0x605d('0x1b')]=function(_0x482a86){var _0x317e89=this;return new Promise(function(_0x191d9c,_0x2e9ea6){return db[_0x605d('0x1c')][_0x605d('0x1d')]({'raw':_0x482a86[_0x605d('0x1e')]?_0x482a86[_0x605d('0x1e')][_0x605d('0x1f')]===undefined?!![]:![]:!![],'where':_0x482a86[_0x605d('0x1e')]?_0x482a86[_0x605d('0x1e')][_0x605d('0x20')]||null:null,'attributes':[[db[_0x605d('0x21')]['fn']('COUNT',db[_0x605d('0x21')]['fn']('IF',db[_0x605d('0x21')]['literal'](_0x605d('0x22')))),_0x605d('0x23')]]})['then'](function(_0x208fdc){logger[_0x605d('0x11')](_0x605d('0x1b'),_0x482a86);logger['debug'](_0x605d('0x1b'),_0x482a86,JSON['stringify'](_0x208fdc));_0x191d9c(_0x208fdc);})[_0x605d('0x24')](function(_0x327cb8){logger['error']('GetVoiceQueueRtPauses',_0x327cb8['message'],_0x482a86);_0x2e9ea6(_0x317e89[_0x605d('0x16')](0x1f4,_0x327cb8[_0x605d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6fb72d4..cde7cd0 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 _0x5ec3=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1f99de,_0x150ae6){var _0x569d10=function(_0x39ff66){while(--_0x39ff66){_0x1f99de['push'](_0x1f99de['shift']());}};_0x569d10(++_0x150ae6);}(_0x5ec3,0x17b));var _0x35ec=function(_0x1f1df2,_0x18388b){_0x1f1df2=_0x1f1df2-0x0;var _0x3e6d0e=_0x5ec3[_0x1f1df2];return _0x3e6d0e;};'use strict';var UserVoiceQueueRtEvents=require(_0x35ec('0x0'));var events=[_0x35ec('0x1'),_0x35ec('0x2'),_0x35ec('0x3')];function createListener(_0x13076d,_0x3afba8){return function(_0x10c0d7){_0x3afba8[_0x35ec('0x4')](_0x13076d,_0x10c0d7);};}function removeListener(_0x17737d,_0x217618){return function(){UserVoiceQueueRtEvents[_0x35ec('0x5')](_0x17737d,_0x217618);};}exports[_0x35ec('0x6')]=function(_0x587d97){for(var _0x3ca978=0x0,_0x1057b8=events[_0x35ec('0x7')];_0x3ca978<_0x1057b8;_0x3ca978++){var _0x319601=events[_0x3ca978];var _0x3a02e0=createListener(_0x35ec('0x8')+_0x319601,_0x587d97);UserVoiceQueueRtEvents['on'](_0x319601,_0x3a02e0);}}; \ No newline at end of file +var _0x3af8=['save','remove','emit','removeListener','register','length','./userVoiceQueueRt.events'];(function(_0x4090c2,_0x1f6da9){var _0x14d3dd=function(_0x8d95d2){while(--_0x8d95d2){_0x4090c2['push'](_0x4090c2['shift']());}};_0x14d3dd(++_0x1f6da9);}(_0x3af8,0x1a3));var _0x83af=function(_0x52e1fd,_0xcc975d){_0x52e1fd=_0x52e1fd-0x0;var _0x29526d=_0x3af8[_0x52e1fd];return _0x29526d;};'use strict';var UserVoiceQueueRtEvents=require(_0x83af('0x0'));var events=[_0x83af('0x1'),_0x83af('0x2'),'update'];function createListener(_0x42b1b3,_0x4bbc38){return function(_0x11790e){_0x4bbc38[_0x83af('0x3')](_0x42b1b3,_0x11790e);};}function removeListener(_0x31d642,_0x2d13e1){return function(){UserVoiceQueueRtEvents[_0x83af('0x4')](_0x31d642,_0x2d13e1);};}exports[_0x83af('0x5')]=function(_0x5bb094){for(var _0x9e2522=0x0,_0x46d48b=events[_0x83af('0x6')];_0x9e2522<_0x46d48b;_0x9e2522++){var _0x1ed8dc=events[_0x9e2522];var _0x1eb0a8=createListener('userVoiceQueueRt:'+_0x1ed8dc,_0x5bb094);UserVoiceQueueRtEvents['on'](_0x1ed8dc,_0x1eb0a8);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ad6cac6..3109d8b 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 _0xcf71=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','util','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcf71,0xf3));var _0x1cf7=function(_0x9844c2,_0x4a6e0a){_0x9844c2=_0x9844c2-0x0;var _0x425407=_0xcf71[_0x9844c2];return _0x425407;};'use strict';var multer=require('multer');var util=require(_0x1cf7('0x0'));var path=require(_0x1cf7('0x1'));var timeout=require(_0x1cf7('0x2'));var express=require(_0x1cf7('0x3'));var router=express[_0x1cf7('0x4')]();var auth=require(_0x1cf7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1cf7('0x6'));module['exports']=router; \ No newline at end of file +var _0x6e0b=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x6e0b,0x77));var _0xb6e0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6e0b[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xb6e0('0x0'));var util=require(_0xb6e0('0x1'));var path=require(_0xb6e0('0x2'));var timeout=require(_0xb6e0('0x3'));var express=require(_0xb6e0('0x4'));var router=express[_0xb6e0('0x5')]();var auth=require(_0xb6e0('0x6'));var interaction=require(_0xb6e0('0x7'));var config=require('../../config/environment');module[_0xb6e0('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 8f00e94..b46d935 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 _0xb10b=['sequelize','INTEGER'];(function(_0x1ad3f3,_0x5d7aeb){var _0x54e7b2=function(_0x13d644){while(--_0x13d644){_0x1ad3f3['push'](_0x1ad3f3['shift']());}};_0x54e7b2(++_0x5d7aeb);}(_0xb10b,0x12a));var _0xbb10=function(_0xf98ec1,_0x4c73b8){_0xf98ec1=_0xf98ec1-0x0;var _0x514b6a=_0xb10b[_0xf98ec1];return _0x514b6a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x281bfc,_0x45a6cc){var _0x5588f6=function(_0x285218){while(--_0x285218){_0x281bfc['push'](_0x281bfc['shift']());}};_0x5588f6(++_0x45a6cc);}(_0xe706,0xa3));var _0x6e70=function(_0x585219,_0x23ba0b){_0x585219=_0x585219-0x0;var _0x32c6fe=_0xe706[_0x585219];return _0x32c6fe;};'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 9164161..223d20b 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','../../config/logger'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xc900,0xb3));var _0x0c90=function(_0x231b7d,_0x20bf38){_0x231b7d=_0x231b7d-0x0;var _0x4e23ed=_0xc900[_0x231b7d];return _0x4e23ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0598=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','request-promise','path','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0598,0x92));var _0x8059=function(_0x3a91a3,_0x1c6c24){_0x3a91a3=_0x3a91a3-0x0;var _0x291823=_0x0598[_0x3a91a3];return _0x291823;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'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 6e5ac3a..734c025 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(_0x1d6d68,_0x40e242){var _0x24225d=function(_0xae3e48){while(--_0xae3e48){_0x1d6d68['push'](_0x1d6d68['shift']());}};_0x24225d(++_0x40e242);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x3540fb,_0x419608){var _0x4154a7=function(_0x202259){while(--_0x202259){_0x3540fb['push'](_0x3540fb['shift']());}};_0x4154a7(++_0x419608);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 553b2e2..d4c7cc5 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 _0x555d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x264ed5,_0x47e325){var _0x1cd14c=function(_0x2c5a35){while(--_0x2c5a35){_0x264ed5['push'](_0x264ed5['shift']());}};_0x1cd14c(++_0x47e325);}(_0x555d,0x18d));var _0xd555=function(_0x5663b6,_0x1109bb){_0x5663b6=_0x5663b6-0x0;var _0x46e231=_0x555d[_0x5663b6];return _0x46e231;};'use strict';var multer=require(_0xd555('0x0'));var util=require(_0xd555('0x1'));var path=require(_0xd555('0x2'));var timeout=require(_0xd555('0x3'));var express=require(_0xd555('0x4'));var router=express[_0xd555('0x5')]();var auth=require(_0xd555('0x6'));var interaction=require(_0xd555('0x7'));var config=require('../../config/environment');var controller=require(_0xd555('0x8'));router[_0xd555('0x9')]('/',auth[_0xd555('0xa')](),controller[_0xd555('0xb')]);router[_0xd555('0x9')](_0xd555('0xc'),auth['isAuthenticated'](),controller[_0xd555('0xd')]);router['post']('/',auth[_0xd555('0xa')](),controller[_0xd555('0xe')]);router[_0xd555('0xf')](_0xd555('0xc'),auth['isAuthenticated'](),controller[_0xd555('0x10')]);router[_0xd555('0x11')]('/:id',auth[_0xd555('0xa')](),controller[_0xd555('0x12')]);module[_0xd555('0x13')]=router; \ No newline at end of file +var _0x9b52=['../../components/auth/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x6cd8b0,_0x14b8ab){var _0x49464c=function(_0x34cf25){while(--_0x34cf25){_0x6cd8b0['push'](_0x6cd8b0['shift']());}};_0x49464c(++_0x14b8ab);}(_0x9b52,0xc2));var _0x29b5=function(_0x17ff84,_0x513e44){_0x17ff84=_0x17ff84-0x0;var _0x4d6138=_0x9b52[_0x17ff84];return _0x4d6138;};'use strict';var multer=require(_0x29b5('0x0'));var util=require(_0x29b5('0x1'));var path=require(_0x29b5('0x2'));var timeout=require(_0x29b5('0x3'));var express=require(_0x29b5('0x4'));var router=express[_0x29b5('0x5')]();var auth=require(_0x29b5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x29b5('0x7'));router[_0x29b5('0x8')]('/',auth[_0x29b5('0x9')](),controller[_0x29b5('0xa')]);router['get'](_0x29b5('0xb'),auth[_0x29b5('0x9')](),controller[_0x29b5('0xc')]);router[_0x29b5('0xd')]('/',auth[_0x29b5('0x9')](),controller[_0x29b5('0xe')]);router[_0x29b5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x29b5('0x10')]);router[_0x29b5('0x11')](_0x29b5('0xb'),auth['isAuthenticated'](),controller[_0x29b5('0x12')]);module[_0x29b5('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index dbccb5e..2c17f8d 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 _0x9601=['STRING','exports'];(function(_0x31061a,_0x5ab647){var _0x48d92a=function(_0x421130){while(--_0x421130){_0x31061a['push'](_0x31061a['shift']());}};_0x48d92a(++_0x5ab647);}(_0x9601,0x195));var _0x1960=function(_0x35829e,_0x2b1279){_0x35829e=_0x35829e-0x0;var _0x1f053d=_0x9601[_0x35829e];return _0x1f053d;};'use strict';var Sequelize=require('sequelize');module[_0x1960('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1960('0x1')]}}; \ No newline at end of file +var _0xd0aa=['exports','STRING','name','sequelize'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xd0aa,0x197));var _0xad0a=function(_0x17889e,_0x59528a){_0x17889e=_0x17889e-0x0;var _0x1e54d1=_0xd0aa[_0x17889e];return _0x1e54d1;};'use strict';var Sequelize=require(_0xad0a('0x0'));module[_0xad0a('0x1')]={'name':{'type':Sequelize[_0xad0a('0x2')],'unique':_0xad0a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xad0a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index e3eb6c7..154f29e 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 _0x2d30=['apply','reject','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x2d30,0x1d8));var _0x02d3=function(_0x3c8499,_0x1e052e){_0x3c8499=_0x3c8499-0x0;var _0x51d346=_0x2d30[_0x3c8499];return _0x51d346;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02d3('0x0'));var jsonpatch=require(_0x02d3('0x1'));var rp=require(_0x02d3('0x2'));var moment=require(_0x02d3('0x3'));var BPromise=require(_0x02d3('0x4'));var Mustache=require(_0x02d3('0x5'));var util=require(_0x02d3('0x6'));var path=require(_0x02d3('0x7'));var sox=require('sox');var csv=require(_0x02d3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x02d3('0x9'));var squel=require(_0x02d3('0xa'));var crypto=require(_0x02d3('0xb'));var jsforce=require(_0x02d3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x02d3('0xd'));var Redis=require(_0x02d3('0xe'));var authService=require(_0x02d3('0xf'));var qs=require(_0x02d3('0x10'));var as=require(_0x02d3('0x11'));var hardwareService=require(_0x02d3('0x12'));var logger=require('../../config/logger')(_0x02d3('0x13'));var utils=require(_0x02d3('0x14'));var config=require(_0x02d3('0x15'));var licenseUtil=require(_0x02d3('0x16'));var db=require(_0x02d3('0x17'))['db'];function respondWithStatusCode(_0x40303b,_0x2b7ed6){_0x2b7ed6=_0x2b7ed6||0xcc;return function(_0x4844c4){if(_0x4844c4){return _0x40303b[_0x02d3('0x18')](_0x2b7ed6);}return _0x40303b[_0x02d3('0x19')](_0x2b7ed6)[_0x02d3('0x1a')]();};}function respondWithResult(_0x131d3b,_0x27c016){_0x27c016=_0x27c016||0xc8;return function(_0x50ac12){if(_0x50ac12){return _0x131d3b[_0x02d3('0x19')](_0x27c016)[_0x02d3('0x1b')](_0x50ac12);}};}function respondWithFilteredResult(_0x53864f,_0x325425){return function(_0x366ad6){if(_0x366ad6){var _0x5f28c7=_0x366ad6[_0x02d3('0x1c')],_0x4f6dac=_0x325425[_0x02d3('0x1d')],_0x49f691=_0x325425[_0x02d3('0x1d')]+_0x325425['limit'],_0x26f5f5;if(_0x49f691>=_0x5f28c7){_0x49f691=_0x5f28c7;_0x26f5f5=0xc8;}else{_0x26f5f5=0xce;}_0x53864f[_0x02d3('0x19')](_0x26f5f5);return _0x53864f[_0x02d3('0x1e')](_0x02d3('0x1f'),_0x4f6dac+'-'+_0x49f691+'/'+_0x5f28c7)[_0x02d3('0x1b')](_0x366ad6);}return null;};}function patchUpdates(_0x4b9544){return function(_0x5a9f7e){try{jsonpatch[_0x02d3('0x20')](_0x5a9f7e,_0x4b9544,!![]);}catch(_0x33cc04){return BPromise[_0x02d3('0x21')](_0x33cc04);}return _0x5a9f7e['save']();};}function saveUpdates(_0x4fb9a0,_0xd4a0f7){return function(_0x1bb085){if(_0x1bb085){return _0x1bb085[_0x02d3('0x22')](_0x4fb9a0)[_0x02d3('0x23')](function(_0x4875b8){return _0x4875b8;});}return null;};}function removeEntity(_0x1b0e95,_0x3b7daf){return function(_0x256769){if(_0x256769){return _0x256769[_0x02d3('0x24')]()[_0x02d3('0x23')](function(){var _0x137068=_0x256769[_0x02d3('0x25')]({'plain':!![]});var _0x137942=_0x02d3('0x26');return db[_0x02d3('0x27')][_0x02d3('0x24')]({'where':{'type':_0x137942,'resourceId':_0x137068['id']}})[_0x02d3('0x23')](function(){return _0x256769;});})['then'](function(){_0x1b0e95[_0x02d3('0x19')](0xcc)[_0x02d3('0x1a')]();});}};}function handleEntityNotFound(_0x10f411,_0x126394){return function(_0x3b7a10){if(!_0x3b7a10){_0x10f411[_0x02d3('0x18')](0x194);}return _0x3b7a10;};}function handleError(_0x1d171a,_0xd310d3){_0xd310d3=_0xd310d3||0x1f4;return function(_0x47c30c){logger[_0x02d3('0x28')](_0x47c30c[_0x02d3('0x29')]);if(_0x47c30c[_0x02d3('0x2a')]){delete _0x47c30c[_0x02d3('0x2a')];}_0x1d171a[_0x02d3('0x19')](_0xd310d3)[_0x02d3('0x2b')](_0x47c30c);};}exports[_0x02d3('0x2c')]=function(_0x4e63a8,_0x7c85bb){var _0x3f90dd={},_0x5e8c8f={},_0x3519f1={'count':0x0,'rows':[]};var _0x306355=_[_0x02d3('0x2d')](db[_0x02d3('0x2e')][_0x02d3('0x2f')],function(_0x5b8498){return{'name':_0x5b8498[_0x02d3('0x30')],'type':_0x5b8498[_0x02d3('0x31')]['key']};});_0x5e8c8f[_0x02d3('0x32')]=_['map'](_0x306355,'name');_0x5e8c8f['query']=_[_0x02d3('0x33')](_0x4e63a8['query']);_0x5e8c8f[_0x02d3('0x34')]=_[_0x02d3('0x35')](_0x5e8c8f[_0x02d3('0x32')],_0x5e8c8f[_0x02d3('0x36')]);_0x3f90dd[_0x02d3('0x37')]=_[_0x02d3('0x35')](_0x5e8c8f[_0x02d3('0x32')],qs['fields'](_0x4e63a8[_0x02d3('0x36')][_0x02d3('0x38')]));_0x3f90dd[_0x02d3('0x37')]=_0x3f90dd[_0x02d3('0x37')][_0x02d3('0x39')]?_0x3f90dd[_0x02d3('0x37')]:_0x5e8c8f[_0x02d3('0x32')];if(!_0x4e63a8['query'][_0x02d3('0x3a')](_0x02d3('0x3b'))){_0x3f90dd[_0x02d3('0x3c')]=qs['limit'](_0x4e63a8[_0x02d3('0x36')][_0x02d3('0x3c')]);_0x3f90dd['offset']=qs[_0x02d3('0x1d')](_0x4e63a8[_0x02d3('0x36')][_0x02d3('0x1d')]);}_0x3f90dd[_0x02d3('0x3d')]=qs[_0x02d3('0x3e')](_0x4e63a8[_0x02d3('0x36')][_0x02d3('0x3e')]);_0x3f90dd['where']=qs['filters'](_[_0x02d3('0x3f')](_0x4e63a8[_0x02d3('0x36')],_0x5e8c8f[_0x02d3('0x34')]),_0x306355);if(_0x4e63a8[_0x02d3('0x36')][_0x02d3('0x40')]){_0x3f90dd[_0x02d3('0x41')]=_['merge'](_0x3f90dd[_0x02d3('0x41')],{'$or':_['map'](_0x306355,function(_0x4a3df4){if(_0x4a3df4[_0x02d3('0x31')]!==_0x02d3('0x42')){var _0x18df9b={};_0x18df9b[_0x4a3df4['name']]={'$like':'%'+_0x4e63a8[_0x02d3('0x36')][_0x02d3('0x40')]+'%'};return _0x18df9b;}})});}_0x3f90dd=_[_0x02d3('0x43')]({},_0x3f90dd,_0x4e63a8[_0x02d3('0x44')]);var _0x30954d={'where':_0x3f90dd['where']};return db[_0x02d3('0x2e')][_0x02d3('0x1c')](_0x30954d)[_0x02d3('0x23')](function(_0x3469a0){_0x3519f1[_0x02d3('0x1c')]=_0x3469a0;if(_0x4e63a8['query'][_0x02d3('0x45')]){_0x3f90dd[_0x02d3('0x46')]=[{'all':!![]}];}return db['Variable'][_0x02d3('0x47')](_0x3f90dd);})[_0x02d3('0x23')](function(_0x38dc57){_0x3519f1[_0x02d3('0x48')]=_0x38dc57;return _0x3519f1;})[_0x02d3('0x23')](respondWithFilteredResult(_0x7c85bb,_0x3f90dd))['catch'](handleError(_0x7c85bb,null));};exports[_0x02d3('0x49')]=function(_0x427d4c,_0x58764e){var _0x68dfcc={'raw':!![],'where':{'id':_0x427d4c['params']['id']}},_0x3fcf5a={};_0x3fcf5a[_0x02d3('0x32')]=_[_0x02d3('0x33')](db[_0x02d3('0x2e')][_0x02d3('0x2f')]);_0x3fcf5a[_0x02d3('0x36')]=_[_0x02d3('0x33')](_0x427d4c[_0x02d3('0x36')]);_0x3fcf5a[_0x02d3('0x34')]=_[_0x02d3('0x35')](_0x3fcf5a['model'],_0x3fcf5a[_0x02d3('0x36')]);_0x68dfcc[_0x02d3('0x37')]=_[_0x02d3('0x35')](_0x3fcf5a[_0x02d3('0x32')],qs[_0x02d3('0x38')](_0x427d4c[_0x02d3('0x36')][_0x02d3('0x38')]));_0x68dfcc['attributes']=_0x68dfcc[_0x02d3('0x37')][_0x02d3('0x39')]?_0x68dfcc[_0x02d3('0x37')]:_0x3fcf5a['model'];if(_0x427d4c[_0x02d3('0x36')][_0x02d3('0x45')]){_0x68dfcc[_0x02d3('0x46')]=[{'all':!![]}];}_0x68dfcc=_[_0x02d3('0x43')]({},_0x68dfcc,_0x427d4c['options']);return db[_0x02d3('0x2e')]['find'](_0x68dfcc)[_0x02d3('0x23')](handleEntityNotFound(_0x58764e,null))[_0x02d3('0x23')](respondWithResult(_0x58764e,null))[_0x02d3('0x4a')](handleError(_0x58764e,null));};exports['create']=function(_0x21dbf8,_0x109000){return db['Variable'][_0x02d3('0x4b')](_0x21dbf8[_0x02d3('0x4c')],{})['then'](function(_0x185ca4){var _0x361e87=_0x21dbf8[_0x02d3('0x4d')][_0x02d3('0x25')]({'plain':!![]});if(!_0x361e87)throw new Error(_0x02d3('0x4e'));if(_0x361e87[_0x02d3('0x4f')]==='user'){var _0x22b6e7=_0x185ca4[_0x02d3('0x25')]({'plain':!![]});var _0x334df7=_0x02d3('0x26');return db[_0x02d3('0x50')][_0x02d3('0x51')]({'where':{'name':_0x334df7,'userProfileId':_0x361e87[_0x02d3('0x52')]},'raw':!![]})[_0x02d3('0x23')](function(_0x13d9df){if(_0x13d9df&&_0x13d9df[_0x02d3('0x53')]===0x0){return db[_0x02d3('0x27')][_0x02d3('0x4b')]({'name':_0x22b6e7['name'],'resourceId':_0x22b6e7['id'],'type':_0x13d9df['name'],'sectionId':_0x13d9df['id']},{})['then'](function(){return _0x185ca4;});}else{return _0x185ca4;}})[_0x02d3('0x4a')](function(_0x298fe5){logger[_0x02d3('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x298fe5);throw _0x298fe5;});}return _0x185ca4;})[_0x02d3('0x23')](respondWithResult(_0x109000,0xc9))[_0x02d3('0x4a')](handleError(_0x109000,null));};exports[_0x02d3('0x22')]=function(_0x34b2b1,_0x2e8632){if(_0x34b2b1[_0x02d3('0x4c')]['id']){delete _0x34b2b1[_0x02d3('0x4c')]['id'];}return db[_0x02d3('0x2e')][_0x02d3('0x51')]({'where':{'id':_0x34b2b1['params']['id']}})['then'](handleEntityNotFound(_0x2e8632,null))[_0x02d3('0x23')](saveUpdates(_0x34b2b1[_0x02d3('0x4c')],null))[_0x02d3('0x23')](respondWithResult(_0x2e8632,null))[_0x02d3('0x4a')](handleError(_0x2e8632,null));};exports[_0x02d3('0x24')]=function(_0x45735c,_0x13cdbd){return db['Variable'][_0x02d3('0x51')]({'where':{'id':_0x45735c['params']['id']}})[_0x02d3('0x23')](handleEntityNotFound(_0x13cdbd,null))[_0x02d3('0x23')](removeEntity(_0x13cdbd,null))[_0x02d3('0x4a')](handleError(_0x13cdbd,null));}; \ No newline at end of file +var _0x1351=['../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','apply','update','then','get','Variables','UserProfileResource','destroy','end','error','name','send','index','map','Variable','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','user','role','userProfileId','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x39a5b4,_0x3a445c){var _0x2b84e2=function(_0x34d924){while(--_0x34d924){_0x39a5b4['push'](_0x39a5b4['shift']());}};_0x2b84e2(++_0x3a445c);}(_0x1351,0xcb));var _0x1135=function(_0x301438,_0x209d35){_0x301438=_0x301438-0x0;var _0x2146fc=_0x1351[_0x301438];return _0x2146fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1135('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1135('0x1'));var jsonpatch=require(_0x1135('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1135('0x3'));var Mustache=require(_0x1135('0x4'));var util=require(_0x1135('0x5'));var path=require(_0x1135('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1135('0x7'));var squel=require(_0x1135('0x8'));var crypto=require(_0x1135('0x9'));var jsforce=require(_0x1135('0xa'));var deskjs=require(_0x1135('0xb'));var toCsv=require(_0x1135('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1135('0xd'));var authService=require(_0x1135('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1135('0xf'));var hardwareService=require(_0x1135('0x10'));var logger=require(_0x1135('0x11'))(_0x1135('0x12'));var utils=require('../../config/utils');var config=require(_0x1135('0x13'));var licenseUtil=require(_0x1135('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b7a9,_0x2921bf){_0x2921bf=_0x2921bf||0xcc;return function(_0x123eed){if(_0x123eed){return _0x33b7a9[_0x1135('0x15')](_0x2921bf);}return _0x33b7a9['status'](_0x2921bf)['end']();};}function respondWithResult(_0x3171ee,_0x3c382b){_0x3c382b=_0x3c382b||0xc8;return function(_0x5db72a){if(_0x5db72a){return _0x3171ee[_0x1135('0x16')](_0x3c382b)[_0x1135('0x17')](_0x5db72a);}};}function respondWithFilteredResult(_0x49f0f7,_0x1c3a82){return function(_0x18b172){if(_0x18b172){var _0x4176d9=_0x18b172[_0x1135('0x18')],_0xe33bf8=_0x1c3a82[_0x1135('0x19')],_0x40c525=_0x1c3a82[_0x1135('0x19')]+_0x1c3a82[_0x1135('0x1a')],_0xa933e9;if(_0x40c525>=_0x4176d9){_0x40c525=_0x4176d9;_0xa933e9=0xc8;}else{_0xa933e9=0xce;}_0x49f0f7[_0x1135('0x16')](_0xa933e9);return _0x49f0f7['set']('Content-Range',_0xe33bf8+'-'+_0x40c525+'/'+_0x4176d9)[_0x1135('0x17')](_0x18b172);}return null;};}function patchUpdates(_0x345e07){return function(_0x55fadc){try{jsonpatch[_0x1135('0x1b')](_0x55fadc,_0x345e07,!![]);}catch(_0x3c34c9){return BPromise['reject'](_0x3c34c9);}return _0x55fadc['save']();};}function saveUpdates(_0x4435f4,_0x2a0843){return function(_0x4f00dc){if(_0x4f00dc){return _0x4f00dc[_0x1135('0x1c')](_0x4435f4)[_0x1135('0x1d')](function(_0x137cec){return _0x137cec;});}return null;};}function removeEntity(_0x1827ed,_0x55b475){return function(_0x274b4a){if(_0x274b4a){return _0x274b4a['destroy']()[_0x1135('0x1d')](function(){var _0x1cdbc9=_0x274b4a[_0x1135('0x1e')]({'plain':!![]});var _0x339d44=_0x1135('0x1f');return db[_0x1135('0x20')][_0x1135('0x21')]({'where':{'type':_0x339d44,'resourceId':_0x1cdbc9['id']}})[_0x1135('0x1d')](function(){return _0x274b4a;});})['then'](function(){_0x1827ed['status'](0xcc)[_0x1135('0x22')]();});}};}function handleEntityNotFound(_0x421661,_0x2340e8){return function(_0x471437){if(!_0x471437){_0x421661[_0x1135('0x15')](0x194);}return _0x471437;};}function handleError(_0x5b53f4,_0xada14e){_0xada14e=_0xada14e||0x1f4;return function(_0x26b64a){logger[_0x1135('0x23')](_0x26b64a['stack']);if(_0x26b64a[_0x1135('0x24')]){delete _0x26b64a[_0x1135('0x24')];}_0x5b53f4[_0x1135('0x16')](_0xada14e)[_0x1135('0x25')](_0x26b64a);};}exports[_0x1135('0x26')]=function(_0x53157c,_0x4dc343){var _0x2159a3={},_0x59ad68={},_0xff2dc0={'count':0x0,'rows':[]};var _0x262976=_[_0x1135('0x27')](db[_0x1135('0x28')][_0x1135('0x29')],function(_0x2289d6){return{'name':_0x2289d6[_0x1135('0x2a')],'type':_0x2289d6[_0x1135('0x2b')]['key']};});_0x59ad68['model']=_[_0x1135('0x27')](_0x262976,_0x1135('0x24'));_0x59ad68[_0x1135('0x2c')]=_[_0x1135('0x2d')](_0x53157c[_0x1135('0x2c')]);_0x59ad68[_0x1135('0x2e')]=_['intersection'](_0x59ad68[_0x1135('0x2f')],_0x59ad68['query']);_0x2159a3[_0x1135('0x30')]=_['intersection'](_0x59ad68['model'],qs[_0x1135('0x31')](_0x53157c[_0x1135('0x2c')][_0x1135('0x31')]));_0x2159a3[_0x1135('0x30')]=_0x2159a3['attributes'][_0x1135('0x32')]?_0x2159a3[_0x1135('0x30')]:_0x59ad68[_0x1135('0x2f')];if(!_0x53157c[_0x1135('0x2c')][_0x1135('0x33')](_0x1135('0x34'))){_0x2159a3['limit']=qs[_0x1135('0x1a')](_0x53157c[_0x1135('0x2c')]['limit']);_0x2159a3[_0x1135('0x19')]=qs['offset'](_0x53157c[_0x1135('0x2c')][_0x1135('0x19')]);}_0x2159a3[_0x1135('0x35')]=qs[_0x1135('0x36')](_0x53157c[_0x1135('0x2c')][_0x1135('0x36')]);_0x2159a3['where']=qs[_0x1135('0x2e')](_[_0x1135('0x37')](_0x53157c[_0x1135('0x2c')],_0x59ad68[_0x1135('0x2e')]),_0x262976);if(_0x53157c['query'][_0x1135('0x38')]){_0x2159a3[_0x1135('0x39')]=_['merge'](_0x2159a3['where'],{'$or':_['map'](_0x262976,function(_0x37523a){if(_0x37523a['type']!==_0x1135('0x3a')){var _0x31f944={};_0x31f944[_0x37523a[_0x1135('0x24')]]={'$like':'%'+_0x53157c[_0x1135('0x2c')][_0x1135('0x38')]+'%'};return _0x31f944;}})});}_0x2159a3=_[_0x1135('0x3b')]({},_0x2159a3,_0x53157c[_0x1135('0x3c')]);var _0x1bb360={'where':_0x2159a3[_0x1135('0x39')]};return db[_0x1135('0x28')]['count'](_0x1bb360)['then'](function(_0x46e65c){_0xff2dc0['count']=_0x46e65c;if(_0x53157c[_0x1135('0x2c')][_0x1135('0x3d')]){_0x2159a3[_0x1135('0x3e')]=[{'all':!![]}];}return db['Variable'][_0x1135('0x3f')](_0x2159a3);})[_0x1135('0x1d')](function(_0x2f7a81){_0xff2dc0[_0x1135('0x40')]=_0x2f7a81;return _0xff2dc0;})[_0x1135('0x1d')](respondWithFilteredResult(_0x4dc343,_0x2159a3))[_0x1135('0x41')](handleError(_0x4dc343,null));};exports['show']=function(_0x503a78,_0x256cf4){var _0x47851f={'raw':!![],'where':{'id':_0x503a78[_0x1135('0x42')]['id']}},_0x39656b={};_0x39656b[_0x1135('0x2f')]=_[_0x1135('0x2d')](db[_0x1135('0x28')][_0x1135('0x29')]);_0x39656b[_0x1135('0x2c')]=_[_0x1135('0x2d')](_0x503a78[_0x1135('0x2c')]);_0x39656b['filters']=_[_0x1135('0x43')](_0x39656b[_0x1135('0x2f')],_0x39656b[_0x1135('0x2c')]);_0x47851f['attributes']=_[_0x1135('0x43')](_0x39656b[_0x1135('0x2f')],qs[_0x1135('0x31')](_0x503a78[_0x1135('0x2c')]['fields']));_0x47851f[_0x1135('0x30')]=_0x47851f[_0x1135('0x30')][_0x1135('0x32')]?_0x47851f[_0x1135('0x30')]:_0x39656b[_0x1135('0x2f')];if(_0x503a78['query']['includeAll']){_0x47851f['include']=[{'all':!![]}];}_0x47851f=_['merge']({},_0x47851f,_0x503a78[_0x1135('0x3c')]);return db[_0x1135('0x28')][_0x1135('0x44')](_0x47851f)[_0x1135('0x1d')](handleEntityNotFound(_0x256cf4,null))[_0x1135('0x1d')](respondWithResult(_0x256cf4,null))[_0x1135('0x41')](handleError(_0x256cf4,null));};exports['create']=function(_0x31668c,_0x4fff8e){return db[_0x1135('0x28')][_0x1135('0x45')](_0x31668c['body'],{})['then'](function(_0x32c7f2){var _0x5eca03=_0x31668c[_0x1135('0x46')][_0x1135('0x1e')]({'plain':!![]});if(!_0x5eca03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eca03[_0x1135('0x47')]===_0x1135('0x46')){var _0x37d140=_0x32c7f2[_0x1135('0x1e')]({'plain':!![]});var _0x2f7172=_0x1135('0x1f');return db['UserProfileSection'][_0x1135('0x44')]({'where':{'name':_0x2f7172,'userProfileId':_0x5eca03[_0x1135('0x48')]},'raw':!![]})[_0x1135('0x1d')](function(_0x5bd3a6){if(_0x5bd3a6&&_0x5bd3a6['autoAssociation']===0x0){return db[_0x1135('0x20')][_0x1135('0x45')]({'name':_0x37d140[_0x1135('0x24')],'resourceId':_0x37d140['id'],'type':_0x5bd3a6[_0x1135('0x24')],'sectionId':_0x5bd3a6['id']},{})[_0x1135('0x1d')](function(){return _0x32c7f2;});}else{return _0x32c7f2;}})[_0x1135('0x41')](function(_0x1c923c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c923c);throw _0x1c923c;});}return _0x32c7f2;})[_0x1135('0x1d')](respondWithResult(_0x4fff8e,0xc9))[_0x1135('0x41')](handleError(_0x4fff8e,null));};exports[_0x1135('0x1c')]=function(_0x249a78,_0x452b14){if(_0x249a78[_0x1135('0x49')]['id']){delete _0x249a78['body']['id'];}return db['Variable'][_0x1135('0x44')]({'where':{'id':_0x249a78['params']['id']}})['then'](handleEntityNotFound(_0x452b14,null))[_0x1135('0x1d')](saveUpdates(_0x249a78[_0x1135('0x49')],null))[_0x1135('0x1d')](respondWithResult(_0x452b14,null))[_0x1135('0x41')](handleError(_0x452b14,null));};exports[_0x1135('0x21')]=function(_0x20f892,_0x3beaa2){return db[_0x1135('0x28')][_0x1135('0x44')]({'where':{'id':_0x20f892[_0x1135('0x42')]['id']}})['then'](handleEntityNotFound(_0x3beaa2,null))[_0x1135('0x1d')](removeEntity(_0x3beaa2,null))[_0x1135('0x41')](handleError(_0x3beaa2,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index aa67d1f..e59ce93 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 _0xf7f3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x37870a,_0x76e56c){var _0x56d839=function(_0x40fd03){while(--_0x40fd03){_0x37870a['push'](_0x37870a['shift']());}};_0x56d839(++_0x76e56c);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x4b4c26,_0x49f502){_0x4b4c26=_0x4b4c26-0x0;var _0x494793=_0xf7f3[_0x4b4c26];return _0x494793;};'use strict';var _=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var logger=require(_0x3f7f('0x2'))(_0x3f7f('0x3'));var moment=require(_0x3f7f('0x4'));var BPromise=require(_0x3f7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var attributes=require('./variable.attributes');module[_0x3f7f('0x8')]=function(_0x4876e8,_0x2198f7){return _0x4876e8[_0x3f7f('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a8=['bluebird','request-promise','path','../../config/environment','./variable.attributes','Variable','tools_variables','util','../../config/logger','api','moment'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x97a8,0xe3));var _0x897a=function(_0x5191ac,_0x2ff4f9){_0x5191ac=_0x5191ac-0x0;var _0x113062=_0x97a8[_0x5191ac];return _0x113062;};'use strict';var _=require('lodash');var util=require(_0x897a('0x0'));var logger=require(_0x897a('0x1'))(_0x897a('0x2'));var moment=require(_0x897a('0x3'));var BPromise=require(_0x897a('0x4'));var rp=require(_0x897a('0x5'));var fs=require('fs');var path=require(_0x897a('0x6'));var rimraf=require('rimraf');var config=require(_0x897a('0x7'));var attributes=require(_0x897a('0x8'));module['exports']=function(_0x5adcfd,_0x55e647){return _0x5adcfd['define'](_0x897a('0x9'),attributes,{'tableName':_0x897a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 39f29b4..182844d 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 _0xf5ae=['client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowVariable','Variable','options','raw','where','attributes','include','map','model','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x3b7fd3,_0x7d8cfc){var _0x4368f1=function(_0x3dc607){while(--_0x3dc607){_0x3b7fd3['push'](_0x3b7fd3['shift']());}};_0x4368f1(++_0x7d8cfc);}(_0xf5ae,0x1e8));var _0xef5a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf5ae[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xef5a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xef5a('0x1'));var rs=require(_0xef5a('0x2'));var fs=require('fs');var Redis=require(_0xef5a('0x3'));var db=require(_0xef5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef5a('0x5'));var config=require(_0xef5a('0x6'));var jayson=require(_0xef5a('0x7'));var client=jayson[_0xef5a('0x8')][_0xef5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x350e02,_0x53a4a2,_0x4d5398){return new BPromise(function(_0x127519,_0x327c3c){return client[_0xef5a('0xa')](_0x350e02,_0x4d5398)[_0xef5a('0xb')](function(_0x2c157c){logger[_0xef5a('0xc')](_0xef5a('0xd'),_0x53a4a2,_0xef5a('0xe'));logger['debug'](_0xef5a('0xf'),_0x53a4a2,_0xef5a('0xe'),JSON[_0xef5a('0x10')](_0x2c157c));if(_0x2c157c[_0xef5a('0x11')]){if(_0x2c157c[_0xef5a('0x11')][_0xef5a('0x12')]===0x1f4){logger['error'](_0xef5a('0xd'),_0x53a4a2,_0x2c157c[_0xef5a('0x11')][_0xef5a('0x13')]);return _0x327c3c(_0x2c157c[_0xef5a('0x11')][_0xef5a('0x13')]);}logger[_0xef5a('0x11')]('Variable,\x20%s,\x20%s',_0x53a4a2,_0x2c157c[_0xef5a('0x11')][_0xef5a('0x13')]);return _0x127519(_0x2c157c[_0xef5a('0x11')]['message']);}else{logger[_0xef5a('0xc')](_0xef5a('0xd'),_0x53a4a2,'request\x20sent');_0x127519(_0x2c157c['result'][_0xef5a('0x13')]);}})[_0xef5a('0x14')](function(_0xa2cac7){logger[_0xef5a('0x11')](_0xef5a('0xd'),_0x53a4a2,_0xa2cac7);_0x327c3c(_0xa2cac7);});});}exports[_0xef5a('0x15')]=function(_0x3f7832){var _0xda6bd2=this;return new Promise(function(_0x5f2951,_0x339351){return db[_0xef5a('0x16')]['find']({'raw':_0x3f7832[_0xef5a('0x17')]?_0x3f7832[_0xef5a('0x17')][_0xef5a('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7832[_0xef5a('0x17')]?_0x3f7832[_0xef5a('0x17')][_0xef5a('0x19')]||null:null,'attributes':_0x3f7832['options']?_0x3f7832[_0xef5a('0x17')][_0xef5a('0x1a')]||null:null,'include':_0x3f7832['options']?_0x3f7832[_0xef5a('0x17')][_0xef5a('0x1b')]?_[_0xef5a('0x1c')](_0x3f7832['options'][_0xef5a('0x1b')],function(_0x129f41){return{'model':db[_0x129f41[_0xef5a('0x1d')]],'as':_0x129f41['as'],'attributes':_0x129f41[_0xef5a('0x1a')],'include':_0x129f41[_0xef5a('0x1b')]?_[_0xef5a('0x1c')](_0x129f41[_0xef5a('0x1b')],function(_0x22d59b){return{'model':db[_0x22d59b[_0xef5a('0x1d')]],'as':_0x22d59b['as'],'attributes':_0x22d59b[_0xef5a('0x1a')],'include':_0x22d59b[_0xef5a('0x1b')]?_[_0xef5a('0x1c')](_0x22d59b[_0xef5a('0x1b')],function(_0x3d5a97){return{'model':db[_0x3d5a97[_0xef5a('0x1d')]],'as':_0x3d5a97['as'],'attributes':_0x3d5a97[_0xef5a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xef5a('0xb')](function(_0x526696){logger[_0xef5a('0xc')](_0xef5a('0x15'),_0x3f7832);logger[_0xef5a('0x1e')](_0xef5a('0x15'),_0x3f7832,JSON[_0xef5a('0x10')](_0x526696));_0x5f2951(_0x526696);})['catch'](function(_0x27249c){logger[_0xef5a('0x11')](_0xef5a('0x15'),_0x27249c['message'],_0x3f7832);_0x339351(_0xda6bd2['error'](0x1f4,_0x27249c[_0xef5a('0x13')]));});});}; \ No newline at end of file +var _0x80ac=['ShowVariable','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Variable','find','options','raw','where','attributes','include','model','map'];(function(_0x131906,_0x11abe1){var _0x313aee=function(_0x5f2feb){while(--_0x5f2feb){_0x131906['push'](_0x131906['shift']());}};_0x313aee(++_0x11abe1);}(_0x80ac,0x1f1));var _0xc80a=function(_0x4eb7d0,_0x332589){_0x4eb7d0=_0x4eb7d0-0x0;var _0x37e21f=_0x80ac[_0x4eb7d0];return _0x37e21f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc80a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc80a('0x1'));var logger=require(_0xc80a('0x2'))(_0xc80a('0x3'));var config=require(_0xc80a('0x4'));var jayson=require(_0xc80a('0x5'));var client=jayson[_0xc80a('0x6')][_0xc80a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21a6da,_0x1abd00,_0x30b0df){return new BPromise(function(_0x4a6720,_0x474709){return client[_0xc80a('0x8')](_0x21a6da,_0x30b0df)[_0xc80a('0x9')](function(_0xf394f7){logger['info'](_0xc80a('0xa'),_0x1abd00,_0xc80a('0xb'));logger[_0xc80a('0xc')](_0xc80a('0xd'),_0x1abd00,_0xc80a('0xb'),JSON[_0xc80a('0xe')](_0xf394f7));if(_0xf394f7['error']){if(_0xf394f7[_0xc80a('0xf')][_0xc80a('0x10')]===0x1f4){logger[_0xc80a('0xf')]('Variable,\x20%s,\x20%s',_0x1abd00,_0xf394f7[_0xc80a('0xf')][_0xc80a('0x11')]);return _0x474709(_0xf394f7[_0xc80a('0xf')][_0xc80a('0x11')]);}logger['error'](_0xc80a('0xa'),_0x1abd00,_0xf394f7[_0xc80a('0xf')]['message']);return _0x4a6720(_0xf394f7[_0xc80a('0xf')][_0xc80a('0x11')]);}else{logger[_0xc80a('0x12')](_0xc80a('0xa'),_0x1abd00,_0xc80a('0xb'));_0x4a6720(_0xf394f7[_0xc80a('0x13')]['message']);}})[_0xc80a('0x14')](function(_0x3fc0bd){logger[_0xc80a('0xf')](_0xc80a('0xa'),_0x1abd00,_0x3fc0bd);_0x474709(_0x3fc0bd);});});}exports['ShowVariable']=function(_0x10a845){var _0x4c124e=this;return new Promise(function(_0x1869d2,_0x20a879){return db[_0xc80a('0x15')][_0xc80a('0x16')]({'raw':_0x10a845[_0xc80a('0x17')]?_0x10a845[_0xc80a('0x17')][_0xc80a('0x18')]===undefined?!![]:![]:!![],'where':_0x10a845[_0xc80a('0x17')]?_0x10a845[_0xc80a('0x17')][_0xc80a('0x19')]||null:null,'attributes':_0x10a845['options']?_0x10a845['options'][_0xc80a('0x1a')]||null:null,'include':_0x10a845['options']?_0x10a845[_0xc80a('0x17')][_0xc80a('0x1b')]?_['map'](_0x10a845[_0xc80a('0x17')][_0xc80a('0x1b')],function(_0x519b9f){return{'model':db[_0x519b9f[_0xc80a('0x1c')]],'as':_0x519b9f['as'],'attributes':_0x519b9f[_0xc80a('0x1a')],'include':_0x519b9f[_0xc80a('0x1b')]?_[_0xc80a('0x1d')](_0x519b9f['include'],function(_0x37e862){return{'model':db[_0x37e862[_0xc80a('0x1c')]],'as':_0x37e862['as'],'attributes':_0x37e862[_0xc80a('0x1a')],'include':_0x37e862['include']?_[_0xc80a('0x1d')](_0x37e862[_0xc80a('0x1b')],function(_0x50e146){return{'model':db[_0x50e146[_0xc80a('0x1c')]],'as':_0x50e146['as'],'attributes':_0x50e146['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c87d6){logger['info']('ShowVariable',_0x10a845);logger[_0xc80a('0xc')](_0xc80a('0x1e'),_0x10a845,JSON[_0xc80a('0xe')](_0x1c87d6));_0x1869d2(_0x1c87d6);})[_0xc80a('0x14')](function(_0x558c87){logger['error']('ShowVariable',_0x558c87[_0xc80a('0x11')],_0x10a845);_0x20a879(_0x4c124e[_0xc80a('0xf')](0x1f4,_0x558c87[_0xc80a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5c077be..494c961 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 _0x58d7=['exports','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','restart','/migrations'];(function(_0x2ba8e7,_0x5dd591){var _0x427856=function(_0x512259){while(--_0x512259){_0x2ba8e7['push'](_0x2ba8e7['shift']());}};_0x427856(++_0x5dd591);}(_0x58d7,0xd1));var _0x758d=function(_0x4c3d78,_0x29d89d){_0x4c3d78=_0x4c3d78-0x0;var _0x46d483=_0x58d7[_0x4c3d78];return _0x46d483;};'use strict';var express=require('express');var router=express[_0x758d('0x0')]();var auth=require(_0x758d('0x1'));var controller=require(_0x758d('0x2'));router[_0x758d('0x3')]('/',controller['index']);router[_0x758d('0x3')](_0x758d('0x4'),auth[_0x758d('0x5')](),auth[_0x758d('0x6')](),controller[_0x758d('0x7')]);router[_0x758d('0x3')](_0x758d('0x8'),auth['isAuthenticated'](),auth[_0x758d('0x6')](),controller[_0x758d('0x9')]);router[_0x758d('0x3')]('/pull',auth[_0x758d('0x5')](),auth[_0x758d('0x6')](),controller['pull']);router[_0x758d('0x3')]('/restart',auth['isAuthenticated'](),controller[_0x758d('0xa')]);router[_0x758d('0x3')](_0x758d('0xb'),controller['migrations']);module[_0x758d('0xc')]=router; \ No newline at end of file +var _0xb54d=['index','get','/fetch','fetch','/reset','isAuthenticated','reset','canUpdate','pull','restart','/migrations','migrations','exports','express','Router','./version.controller'];(function(_0x234d44,_0x24a158){var _0x463234=function(_0x397dd5){while(--_0x397dd5){_0x234d44['push'](_0x234d44['shift']());}};_0x463234(++_0x24a158);}(_0xb54d,0xdd));var _0xdb54=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0xb54d[_0x4a96ca];return _0x2aed48;};'use strict';var express=require(_0xdb54('0x0'));var router=express[_0xdb54('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xdb54('0x2'));router['get']('/',controller[_0xdb54('0x3')]);router[_0xdb54('0x4')](_0xdb54('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xdb54('0x6')]);router['get'](_0xdb54('0x7'),auth[_0xdb54('0x8')](),auth['canUpdate'](),controller[_0xdb54('0x9')]);router[_0xdb54('0x4')]('/pull',auth[_0xdb54('0x8')](),auth[_0xdb54('0xa')](),controller[_0xdb54('0xb')]);router['get']('/restart',auth[_0xdb54('0x8')](),controller[_0xdb54('0xc')]);router[_0xdb54('0x4')](_0xdb54('0xd'),controller[_0xdb54('0xe')]);module[_0xdb54('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1010ebd..e83b443 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 _0x06ae=['origin','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','migrations','readdirSync','join','server','length','replace','push','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.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','simple-git','root','index','exports','query','fetch','latest','status','json'];(function(_0x49232e,_0xbf16e5){var _0x219c41=function(_0x363027){while(--_0x363027){_0x49232e['push'](_0x49232e['shift']());}};_0x219c41(++_0xbf16e5);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var Umzug=require('umzug');var path=require(_0xe06a('0x0'));var fs=require('fs');var _=require(_0xe06a('0x1'));var pkginfo=require(_0xe06a('0x2'))(module,_0xe06a('0x3'));var compareVersions=require(_0xe06a('0x4'));var exec=require(_0xe06a('0x5'))[_0xe06a('0x6')];var db=require(_0xe06a('0x7'))['db'];var config=require(_0xe06a('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0xe06a('0x9'))(config[_0xe06a('0xa')]);exports[_0xe06a('0xb')]=function(_0x3dfa60,_0x1ea66c){var _0x563322={'current':module[_0xe06a('0xc')]['version'],'phonebar':0x2};if(_0x3dfa60['query']&&_0x3dfa60[_0xe06a('0xd')]['latest']){return git[_0xe06a('0xe')]()['tags'](function(_0x521741,_0xb420d2){_0x563322[_0xe06a('0xf')]=(_0x521741?module['exports'][_0xe06a('0x3')]:_0xb420d2[_0xe06a('0xf')])||'2.0.0';return _0x1ea66c[_0xe06a('0x10')](0xc8)[_0xe06a('0x11')](_0x563322);});}else{return _0x1ea66c[_0xe06a('0x10')](0xc8)['json'](_0x563322);}};exports[_0xe06a('0xe')]=function(_0x34e933,_0x359273){return git[_0xe06a('0xe')]([_0xe06a('0x12'),'master'],function(_0x1284bf){if(_0x1284bf){logger[_0xe06a('0x13')](_0x1284bf);return _0x359273[_0xe06a('0x10')](0x1f4)[_0xe06a('0x11')](_0x1284bf);}logger[_0xe06a('0x14')](_0xe06a('0x15'));return _0x359273['status'](0xc8)[_0xe06a('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x4941ce,_0x7a5a6f){return git[_0xe06a('0x16')]([_0xe06a('0x17'),'FETCH_HEAD'],function(_0x614743){if(_0x614743){logger[_0xe06a('0x13')](_0x614743);return _0x7a5a6f['status'](0x1f4)[_0xe06a('0x11')](_0x614743);}logger['info'](_0xe06a('0x18'));return _0x7a5a6f['status'](0xc8)['json']({'output':_0xe06a('0x19')});});};exports[_0xe06a('0x1a')]=function(_0x1e7f25,_0x216fda){exec(_0xe06a('0x1b'),function(_0xd2adcd,_0x2ab25f,_0x2c30c7){logger[_0xe06a('0x14')](_0x2ab25f);logger[_0xe06a('0x14')](_0x2c30c7);if(_0xd2adcd){logger['error'](_0xd2adcd);return _0x216fda[_0xe06a('0x10')](0x1f4)[_0xe06a('0x11')](_0xd2adcd);}return _0x216fda[_0xe06a('0x10')](0xc8)[_0xe06a('0x11')]({'output':_0x2ab25f});});};exports[_0xe06a('0x1c')]=function(_0x2c96bd,_0x3f468e){return pm2[_0xe06a('0x1c')](_0xe06a('0x1d'))['then'](function(_0x53bdca){logger[_0xe06a('0x14')]('pm2\x20restart\x20motion\x20%s',_0x53bdca);return _0x3f468e[_0xe06a('0x10')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x37ff49){logger[_0xe06a('0x13')](_0x37ff49);return _0x3f468e['status'](0x1f4)[_0xe06a('0x11')](_0x37ff49);});};exports[_0xe06a('0x1e')]=function(_0x4506b3,_0x1c5964){var _0x15cf61=fs[_0xe06a('0x1f')](path[_0xe06a('0x20')](config[_0xe06a('0xa')],_0xe06a('0x21'),'migrations'));var _0x4bee48=[];for(var _0x177d3e=0x0;_0x177d3e<_0x15cf61[_0xe06a('0x22')];_0x177d3e++){var _0x46c75a=_0x15cf61[_0x177d3e][_0xe06a('0x23')]('.js','');if(compareVersions(module[_0xe06a('0xc')]['version'],_0x46c75a)===-0x1){_0x4bee48[_0xe06a('0x24')](_0x46c75a);}}if(_0x4bee48[_0xe06a('0x22')]){var _0x470dd3=_0x4bee48[_0xe06a('0x25')](compareVersions);var _0x492919=new Umzug({'storage':_0xe06a('0x26'),'storageOptions':{'model':db[_0xe06a('0x27')],'modelName':_0xe06a('0x27'),'columnName':_0xe06a('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xe06a('0x26')][_0xe06a('0x28')],function(){throw new Error(_0xe06a('0x29'));}],'path':path[_0xe06a('0x20')](config[_0xe06a('0xa')],_0xe06a('0x21'),'migrations'),'pattern':/\.js$/}});_0x492919['up']({'migrations':_['map'](_0x470dd3,function(_0x3f362c){return _0x3f362c+'.js';})})[_0xe06a('0x2a')](function(){return _0x1c5964['status'](0xc8)[_0xe06a('0x11')]({'output':_0xe06a('0x2b')+module[_0xe06a('0xc')]['version']+'\x20to\x20'+_[_0xe06a('0x2c')](_0x470dd3),'migrations':_[_0xe06a('0x20')](_0x470dd3)});})[_0xe06a('0x2d')](function(_0x1e5512){if(_0x1e5512 instanceof db[_0xe06a('0x26')][_0xe06a('0x2e')]){return _0x1c5964['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1c5964['status'](0x1f4)[_0xe06a('0x11')](_0x1e5512);}});}else{return _0x1c5964[_0xe06a('0x10')](0xc8)[_0xe06a('0x11')]({'output':_0xe06a('0x2f')});}}; \ No newline at end of file +var _0xa5d7=['FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','replace','.js','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/logger','update','simple-git','index','version','query','fetch','tags','latest','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x594d59,_0x298e6f){_0x594d59=_0x594d59-0x0;var _0x25bfe7=_0xa5d7[_0x594d59];return _0x25bfe7;};'use strict';var Umzug=require(_0x7a5d('0x0'));var path=require(_0x7a5d('0x1'));var fs=require('fs');var _=require(_0x7a5d('0x2'));var pkginfo=require(_0x7a5d('0x3'))(module,'version');var compareVersions=require(_0x7a5d('0x4'));var exec=require('child_process')[_0x7a5d('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x7a5d('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x7a5d('0x7'))(_0x7a5d('0x8'));var git=require(_0x7a5d('0x9'))(config['root']);exports[_0x7a5d('0xa')]=function(_0xc34a6a,_0x5e6442){var _0x33aeaa={'current':module['exports'][_0x7a5d('0xb')],'phonebar':0x2};if(_0xc34a6a[_0x7a5d('0xc')]&&_0xc34a6a[_0x7a5d('0xc')]['latest']){return git[_0x7a5d('0xd')]()[_0x7a5d('0xe')](function(_0x25da61,_0xd91332){_0x33aeaa[_0x7a5d('0xf')]=(_0x25da61?module[_0x7a5d('0x10')][_0x7a5d('0xb')]:_0xd91332[_0x7a5d('0xf')])||_0x7a5d('0x11');return _0x5e6442[_0x7a5d('0x12')](0xc8)[_0x7a5d('0x13')](_0x33aeaa);});}else{return _0x5e6442[_0x7a5d('0x12')](0xc8)['json'](_0x33aeaa);}};exports['fetch']=function(_0x34d400,_0x5335f6){return git[_0x7a5d('0xd')]([_0x7a5d('0x14'),_0x7a5d('0x15')],function(_0x1650c7){if(_0x1650c7){logger[_0x7a5d('0x16')](_0x1650c7);return _0x5335f6[_0x7a5d('0x12')](0x1f4)['json'](_0x1650c7);}logger[_0x7a5d('0x17')](_0x7a5d('0x18'));return _0x5335f6[_0x7a5d('0x12')](0xc8)[_0x7a5d('0x13')]({'output':_0x7a5d('0x19')});});};exports['reset']=function(_0x2d06db,_0x3488e9){return git['reset'](['--hard',_0x7a5d('0x1a')],function(_0x4229f6){if(_0x4229f6){logger['error'](_0x4229f6);return _0x3488e9[_0x7a5d('0x12')](0x1f4)['json'](_0x4229f6);}logger[_0x7a5d('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3488e9[_0x7a5d('0x12')](0xc8)[_0x7a5d('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7a5d('0x1b')]=function(_0x4faec5,_0x3ed941){exec('npm\x20install\x20--production',function(_0x56183a,_0x1a0282,_0x77f35e){logger[_0x7a5d('0x17')](_0x1a0282);logger['info'](_0x77f35e);if(_0x56183a){logger[_0x7a5d('0x16')](_0x56183a);return _0x3ed941[_0x7a5d('0x12')](0x1f4)[_0x7a5d('0x13')](_0x56183a);}return _0x3ed941['status'](0xc8)[_0x7a5d('0x13')]({'output':_0x1a0282});});};exports['restart']=function(_0x476cd2,_0x393069){return pm2[_0x7a5d('0x1c')](_0x7a5d('0x1d'))[_0x7a5d('0x1e')](function(_0x65cc6f){logger['info'](_0x7a5d('0x1f'),_0x65cc6f);return _0x393069[_0x7a5d('0x12')](0xc8)['json']({'output':_0x7a5d('0x20')});})[_0x7a5d('0x21')](function(_0x2b1f0b){logger[_0x7a5d('0x16')](_0x2b1f0b);return _0x393069['status'](0x1f4)[_0x7a5d('0x13')](_0x2b1f0b);});};exports[_0x7a5d('0x22')]=function(_0x1e42a8,_0x2931ef){var _0x3975=fs[_0x7a5d('0x23')](path[_0x7a5d('0x24')](config[_0x7a5d('0x25')],'server',_0x7a5d('0x22')));var _0x10394a=[];for(var _0x263f61=0x0;_0x263f61<_0x3975[_0x7a5d('0x26')];_0x263f61++){var _0x46d2d7=_0x3975[_0x263f61][_0x7a5d('0x27')](_0x7a5d('0x28'),'');if(compareVersions(module[_0x7a5d('0x10')][_0x7a5d('0xb')],_0x46d2d7)===-0x1){_0x10394a[_0x7a5d('0x29')](_0x46d2d7);}}if(_0x10394a[_0x7a5d('0x26')]){var _0x253104=_0x10394a[_0x7a5d('0x2a')](compareVersions);var _0x6a9295=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7a5d('0x2b')],'modelName':'Migration','columnName':_0x7a5d('0xb')},'migrations':{'params':[db[_0x7a5d('0x2c')][_0x7a5d('0x2d')](),db['sequelize'][_0x7a5d('0x2e')],function(){throw new Error(_0x7a5d('0x2f'));}],'path':path[_0x7a5d('0x24')](config[_0x7a5d('0x25')],'server',_0x7a5d('0x22')),'pattern':/\.js$/}});_0x6a9295['up']({'migrations':_[_0x7a5d('0x30')](_0x253104,function(_0x330098){return _0x330098+_0x7a5d('0x28');})})[_0x7a5d('0x1e')](function(){return _0x2931ef[_0x7a5d('0x12')](0xc8)['json']({'output':_0x7a5d('0x31')+module[_0x7a5d('0x10')][_0x7a5d('0xb')]+'\x20to\x20'+_[_0x7a5d('0x32')](_0x253104),'migrations':_[_0x7a5d('0x24')](_0x253104)});})[_0x7a5d('0x21')](function(_0x79d832){if(_0x79d832 instanceof db[_0x7a5d('0x2c')][_0x7a5d('0x33')]){return _0x2931ef[_0x7a5d('0x12')](0xc8)[_0x7a5d('0x13')]({'output':_0x7a5d('0x34')});}else{return _0x2931ef[_0x7a5d('0x12')](0x1f4)[_0x7a5d('0x13')](_0x79d832);}});}else{return _0x2931ef[_0x7a5d('0x12')](0xc8)[_0x7a5d('0x13')]({'output':_0x7a5d('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a71cc71..502decc 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 _0x278a=['isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller'];(function(_0x27431c,_0x5d28a1){var _0x4bd29b=function(_0x3c1685){while(--_0x3c1685){_0x27431c['push'](_0x27431c['shift']());}};_0x4bd29b(++_0x5d28a1);}(_0x278a,0x1cd));var _0xa278=function(_0x2475ea,_0x196370){_0x2475ea=_0x2475ea-0x0;var _0x5d694e=_0x278a[_0x2475ea];return _0x5d694e;};'use strict';var multer=require(_0xa278('0x0'));var util=require(_0xa278('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa278('0x2'));var router=express[_0xa278('0x3')]();var auth=require(_0xa278('0x4'));var interaction=require(_0xa278('0x5'));var config=require('../../config/environment');var controller=require(_0xa278('0x6'));router['get']('/',auth[_0xa278('0x7')](),controller[_0xa278('0x8')]);router[_0xa278('0x9')](_0xa278('0xa'),auth[_0xa278('0x7')](),controller['describe']);router[_0xa278('0x9')](_0xa278('0xb'),auth['isAuthenticated'](),controller[_0xa278('0xc')]);router['post']('/',auth[_0xa278('0x7')](),controller['create']);router[_0xa278('0xd')](_0xa278('0xb'),auth[_0xa278('0x7')](),controller[_0xa278('0xe')]);router[_0xa278('0xf')](_0xa278('0xb'),auth[_0xa278('0x7')](),controller[_0xa278('0x10')]);module[_0xa278('0x11')]=router; \ No newline at end of file +var _0x4340=['../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d4948,_0xc2a48b){var _0x111be9=function(_0x348755){while(--_0x348755){_0x2d4948['push'](_0x2d4948['shift']());}};_0x111be9(++_0xc2a48b);}(_0x4340,0xc0));var _0x0434=function(_0x2f396e,_0x9f4c6a){_0x2f396e=_0x2f396e-0x0;var _0x297113=_0x4340[_0x2f396e];return _0x297113;};'use strict';var multer=require(_0x0434('0x0'));var util=require(_0x0434('0x1'));var path=require(_0x0434('0x2'));var timeout=require(_0x0434('0x3'));var express=require(_0x0434('0x4'));var router=express[_0x0434('0x5')]();var auth=require(_0x0434('0x6'));var interaction=require(_0x0434('0x7'));var config=require(_0x0434('0x8'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x0434('0x9')](),controller['index']);router[_0x0434('0xa')](_0x0434('0xb'),auth[_0x0434('0x9')](),controller[_0x0434('0xc')]);router['get'](_0x0434('0xd'),auth[_0x0434('0x9')](),controller[_0x0434('0xe')]);router[_0x0434('0xf')]('/',auth[_0x0434('0x9')](),controller[_0x0434('0x10')]);router['put'](_0x0434('0xd'),auth['isAuthenticated'](),controller[_0x0434('0x11')]);router[_0x0434('0x12')](_0x0434('0xd'),auth[_0x0434('0x9')](),controller['destroy']);module[_0x0434('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 85d1602..65c5d53 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 _0xd8fb=['DATE','BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x31cdff,_0x545438){var _0x14091f=function(_0x363721){while(--_0x363721){_0x31cdff['push'](_0x31cdff['shift']());}};_0x14091f(++_0x545438);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4aa3c7,_0x4c4daa){_0x4aa3c7=_0x4aa3c7-0x0;var _0x5ec2a1=_0xd8fb[_0x4aa3c7];return _0x5ec2a1;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'type':{'type':Sequelize[_0xbd8f('0x2')]},'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbd8f('0x2')]},'membername':{'type':Sequelize[_0xbd8f('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xbd8f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbd8f('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xbd8f('0x2')]},'lastevent':{'type':Sequelize[_0xbd8f('0x2')]},'channel':{'type':Sequelize[_0xbd8f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'context':{'type':Sequelize[_0xbd8f('0x2')]},'exten':{'type':Sequelize[_0xbd8f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbd8f('0x2')]},'destchannelstate':{'type':Sequelize[_0xbd8f('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridname':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbd8f('0x2')]},'destlanguage':{'type':Sequelize[_0xbd8f('0x2')]},'destaccountcode':{'type':Sequelize[_0xbd8f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbd8f('0x2')]},'destpriority':{'type':Sequelize[_0xbd8f('0x2')]},'destuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbd8f('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xbd8f('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x369706,_0x3e1cad){var _0x1f2fad=function(_0x176a63){while(--_0x176a63){_0x369706['push'](_0x369706['shift']());}};_0x1f2fad(++_0x3e1cad);}(_0x425d,0x1e0));var _0xd425=function(_0xd7e492,_0x27ca49){_0xd7e492=_0xd7e492-0x0;var _0x29f8a0=_0x425d[_0xd7e492];return _0x29f8a0;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'type':{'type':Sequelize[_0xd425('0x1')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'queue':{'type':Sequelize[_0xd425('0x1')]},'interface':{'type':Sequelize[_0xd425('0x1')]},'membername':{'type':Sequelize[_0xd425('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd425('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd425('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd425('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x3')]},'agentcomplete':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd425('0x3')]},'agentacw':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd425('0x3')]},'reason':{'type':Sequelize[_0xd425('0x1')]},'lastevent':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize[_0xd425('0x1')]},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x1')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd425('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd425('0x1')],'comment':_0xd425('0x5')},'transferexten':{'type':Sequelize[_0xd425('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd425('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7df5b28..ccfb807 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 _0xd36c=['VoiceAgentReport','includeAll','include','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','nolimit','limit','sort','where','filters','merge','VIRTUAL','options'];(function(_0x1fcf8d,_0x575872){var _0x5f5d85=function(_0x40d04e){while(--_0x40d04e){_0x1fcf8d['push'](_0x1fcf8d['shift']());}};_0x5f5d85(++_0x575872);}(_0xd36c,0x96));var _0xcd36=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xd36c[_0x3da832];return _0xe602f2;};'use strict';var pdf=require(_0xcd36('0x0'));var emlformat=require(_0xcd36('0x1'));var rimraf=require(_0xcd36('0x2'));var zipdir=require(_0xcd36('0x3'));var jsonpatch=require(_0xcd36('0x4'));var rp=require(_0xcd36('0x5'));var moment=require('moment');var BPromise=require(_0xcd36('0x6'));var Mustache=require(_0xcd36('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcd36('0x8'));var csv=require(_0xcd36('0x9'));var ejs=require(_0xcd36('0xa'));var fs=require('fs');var _=require(_0xcd36('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd36('0xc'));var deskjs=require(_0xcd36('0xd'));var toCsv=require(_0xcd36('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd36('0xe'));var authService=require(_0xcd36('0xf'));var qs=require(_0xcd36('0x10'));var as=require(_0xcd36('0x11'));var hardwareService=require(_0xcd36('0x12'));var logger=require(_0xcd36('0x13'))(_0xcd36('0x14'));var utils=require(_0xcd36('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd36('0x16'))['db'];function respondWithStatusCode(_0x3ba2dc,_0x126bb6){_0x126bb6=_0x126bb6||0xcc;return function(_0x43aba3){if(_0x43aba3){return _0x3ba2dc[_0xcd36('0x17')](_0x126bb6);}return _0x3ba2dc[_0xcd36('0x18')](_0x126bb6)['end']();};}function respondWithResult(_0x51498c,_0x4fb2af){_0x4fb2af=_0x4fb2af||0xc8;return function(_0x3c7e00){if(_0x3c7e00){return _0x51498c[_0xcd36('0x18')](_0x4fb2af)[_0xcd36('0x19')](_0x3c7e00);}};}function respondWithFilteredResult(_0x39838a,_0x435377){return function(_0x2f6be8){if(_0x2f6be8){var _0x4e7dc0=_0x2f6be8[_0xcd36('0x1a')],_0x4cabd6=_0x435377[_0xcd36('0x1b')],_0x410c30=_0x435377[_0xcd36('0x1b')]+_0x435377['limit'],_0x95b454;if(_0x410c30>=_0x4e7dc0){_0x410c30=_0x4e7dc0;_0x95b454=0xc8;}else{_0x95b454=0xce;}_0x39838a[_0xcd36('0x18')](_0x95b454);return _0x39838a[_0xcd36('0x1c')](_0xcd36('0x1d'),_0x4cabd6+'-'+_0x410c30+'/'+_0x4e7dc0)['json'](_0x2f6be8);}return null;};}function patchUpdates(_0x43d4be){return function(_0x301535){try{jsonpatch[_0xcd36('0x1e')](_0x301535,_0x43d4be,!![]);}catch(_0x6bdd91){return BPromise['reject'](_0x6bdd91);}return _0x301535[_0xcd36('0x1f')]();};}function saveUpdates(_0x5c7ee1,_0x3f4073){return function(_0x4556bd){if(_0x4556bd){return _0x4556bd[_0xcd36('0x20')](_0x5c7ee1)[_0xcd36('0x21')](function(_0x423aa7){return _0x423aa7;});}return null;};}function removeEntity(_0x49aa03,_0x169721){return function(_0x5821ce){if(_0x5821ce){return _0x5821ce[_0xcd36('0x22')]()[_0xcd36('0x21')](function(){_0x49aa03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x355e20,_0x76eb44){return function(_0x4f60d9){if(!_0x4f60d9){_0x355e20[_0xcd36('0x17')](0x194);}return _0x4f60d9;};}function handleError(_0x10b33d,_0x461c05){_0x461c05=_0x461c05||0x1f4;return function(_0x3e647d){logger[_0xcd36('0x23')](_0x3e647d[_0xcd36('0x24')]);if(_0x3e647d['name']){delete _0x3e647d[_0xcd36('0x25')];}_0x10b33d[_0xcd36('0x18')](_0x461c05)[_0xcd36('0x26')](_0x3e647d);};}exports[_0xcd36('0x27')]=function(_0x123660,_0xd2789d){var _0x59804d={},_0x3f022a={},_0x3a31a5={'count':0x0,'rows':[]};var _0x2354c1=_[_0xcd36('0x28')](db['VoiceAgentReport'][_0xcd36('0x29')],function(_0x4837fe){return{'name':_0x4837fe['fieldName'],'type':_0x4837fe['type'][_0xcd36('0x2a')]};});_0x3f022a[_0xcd36('0x2b')]=_[_0xcd36('0x28')](_0x2354c1,_0xcd36('0x25'));_0x3f022a[_0xcd36('0x2c')]=_[_0xcd36('0x2d')](_0x123660[_0xcd36('0x2c')]);_0x3f022a['filters']=_[_0xcd36('0x2e')](_0x3f022a['model'],_0x3f022a['query']);_0x59804d[_0xcd36('0x2f')]=_['intersection'](_0x3f022a[_0xcd36('0x2b')],qs[_0xcd36('0x30')](_0x123660[_0xcd36('0x2c')][_0xcd36('0x30')]));_0x59804d[_0xcd36('0x2f')]=_0x59804d[_0xcd36('0x2f')]['length']?_0x59804d[_0xcd36('0x2f')]:_0x3f022a[_0xcd36('0x2b')];if(!_0x123660[_0xcd36('0x2c')]['hasOwnProperty'](_0xcd36('0x31'))){_0x59804d[_0xcd36('0x32')]=qs[_0xcd36('0x32')](_0x123660['query'][_0xcd36('0x32')]);_0x59804d['offset']=qs[_0xcd36('0x1b')](_0x123660[_0xcd36('0x2c')][_0xcd36('0x1b')]);}_0x59804d['order']=qs[_0xcd36('0x33')](_0x123660['query'][_0xcd36('0x33')]);_0x59804d[_0xcd36('0x34')]=qs[_0xcd36('0x35')](_['pick'](_0x123660[_0xcd36('0x2c')],_0x3f022a[_0xcd36('0x35')]),_0x2354c1);if(_0x123660[_0xcd36('0x2c')]['filter']){_0x59804d[_0xcd36('0x34')]=_[_0xcd36('0x36')](_0x59804d[_0xcd36('0x34')],{'$or':_[_0xcd36('0x28')](_0x2354c1,function(_0x4fe086){if(_0x4fe086['type']!==_0xcd36('0x37')){var _0x2df784={};_0x2df784[_0x4fe086[_0xcd36('0x25')]]={'$like':'%'+_0x123660[_0xcd36('0x2c')]['filter']+'%'};return _0x2df784;}})});}_0x59804d=_[_0xcd36('0x36')]({},_0x59804d,_0x123660[_0xcd36('0x38')]);var _0x28dc23={'where':_0x59804d[_0xcd36('0x34')]};return db[_0xcd36('0x39')][_0xcd36('0x1a')](_0x28dc23)[_0xcd36('0x21')](function(_0x211850){_0x3a31a5[_0xcd36('0x1a')]=_0x211850;if(_0x123660[_0xcd36('0x2c')][_0xcd36('0x3a')]){_0x59804d[_0xcd36('0x3b')]=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x59804d);})[_0xcd36('0x21')](function(_0x108402){_0x3a31a5[_0xcd36('0x3c')]=_0x108402;return _0x3a31a5;})[_0xcd36('0x21')](respondWithFilteredResult(_0xd2789d,_0x59804d))[_0xcd36('0x3d')](handleError(_0xd2789d,null));};exports[_0xcd36('0x3e')]=function(_0x9db13a,_0x83864d){var _0x3cfadd={'raw':![],'where':{'id':_0x9db13a[_0xcd36('0x3f')]['id']}},_0x56bc5={};_0x56bc5['model']=_['keys'](db['VoiceAgentReport'][_0xcd36('0x29')]);_0x56bc5[_0xcd36('0x2c')]=_['keys'](_0x9db13a['query']);_0x56bc5[_0xcd36('0x35')]=_[_0xcd36('0x2e')](_0x56bc5[_0xcd36('0x2b')],_0x56bc5['query']);_0x3cfadd[_0xcd36('0x2f')]=_['intersection'](_0x56bc5[_0xcd36('0x2b')],qs['fields'](_0x9db13a[_0xcd36('0x2c')][_0xcd36('0x30')]));_0x3cfadd[_0xcd36('0x2f')]=_0x3cfadd[_0xcd36('0x2f')][_0xcd36('0x40')]?_0x3cfadd['attributes']:_0x56bc5[_0xcd36('0x2b')];if(_0x9db13a['query']['includeAll']){_0x3cfadd[_0xcd36('0x3b')]=[{'all':!![]}];}_0x3cfadd=_['merge']({},_0x3cfadd,_0x9db13a[_0xcd36('0x38')]);return db[_0xcd36('0x39')][_0xcd36('0x41')](_0x3cfadd)[_0xcd36('0x21')](handleEntityNotFound(_0x83864d,null))[_0xcd36('0x21')](respondWithResult(_0x83864d,null))[_0xcd36('0x3d')](handleError(_0x83864d,null));};exports[_0xcd36('0x42')]=function(_0x4a698d,_0x4ec37a){return db[_0xcd36('0x39')]['create'](_0x4a698d['body'],{})['then'](respondWithResult(_0x4ec37a,0xc9))['catch'](handleError(_0x4ec37a,null));};exports[_0xcd36('0x20')]=function(_0x229679,_0x3d5821){if(_0x229679[_0xcd36('0x43')]['id']){delete _0x229679[_0xcd36('0x43')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x229679['params']['id']}})[_0xcd36('0x21')](handleEntityNotFound(_0x3d5821,null))[_0xcd36('0x21')](saveUpdates(_0x229679[_0xcd36('0x43')],null))[_0xcd36('0x21')](respondWithResult(_0x3d5821,null))[_0xcd36('0x3d')](handleError(_0x3d5821,null));};exports[_0xcd36('0x22')]=function(_0xee5630,_0x3d7b2e){return db['VoiceAgentReport']['find']({'where':{'id':_0xee5630[_0xcd36('0x3f')]['id']}})[_0xcd36('0x21')](handleEntityNotFound(_0x3d7b2e,null))[_0xcd36('0x21')](removeEntity(_0x3d7b2e,null))[_0xcd36('0x3d')](handleError(_0x3d7b2e,null));};exports[_0xcd36('0x44')]=function(_0x3f0d38,_0x4b238f){return db[_0xcd36('0x39')]['describe']()[_0xcd36('0x21')](respondWithResult(_0x4b238f,null))['catch'](handleError(_0x4b238f,null));}; \ No newline at end of file +var _0xea87=['order','sort','where','merge','VIRTUAL','filter','options','VoiceAgentReport','includeAll','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x102ac5,_0x556f0b){var _0x14e5e1=function(_0x2cb44a){while(--_0x2cb44a){_0x102ac5['push'](_0x102ac5['shift']());}};_0x14e5e1(++_0x556f0b);}(_0xea87,0x1e0));var _0x7ea8=function(_0x3873e2,_0x4c0bcf){_0x3873e2=_0x3873e2-0x0;var _0x27571f=_0xea87[_0x3873e2];return _0x27571f;};'use strict';var pdf=require(_0x7ea8('0x0'));var emlformat=require(_0x7ea8('0x1'));var rimraf=require(_0x7ea8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ea8('0x3'));var rp=require(_0x7ea8('0x4'));var moment=require('moment');var BPromise=require(_0x7ea8('0x5'));var Mustache=require(_0x7ea8('0x6'));var util=require('util');var path=require(_0x7ea8('0x7'));var sox=require(_0x7ea8('0x8'));var csv=require('to-csv');var ejs=require(_0x7ea8('0x9'));var fs=require('fs');var _=require(_0x7ea8('0xa'));var squel=require(_0x7ea8('0xb'));var crypto=require(_0x7ea8('0xc'));var jsforce=require(_0x7ea8('0xd'));var deskjs=require(_0x7ea8('0xe'));var toCsv=require(_0x7ea8('0xf'));var querystring=require(_0x7ea8('0x10'));var Papa=require(_0x7ea8('0x11'));var Redis=require(_0x7ea8('0x12'));var authService=require(_0x7ea8('0x13'));var qs=require(_0x7ea8('0x14'));var as=require(_0x7ea8('0x15'));var hardwareService=require(_0x7ea8('0x16'));var logger=require(_0x7ea8('0x17'))(_0x7ea8('0x18'));var utils=require(_0x7ea8('0x19'));var config=require(_0x7ea8('0x1a'));var licenseUtil=require(_0x7ea8('0x1b'));var db=require(_0x7ea8('0x1c'))['db'];function respondWithStatusCode(_0x5d029b,_0x5d1cd6){_0x5d1cd6=_0x5d1cd6||0xcc;return function(_0xf50b7f){if(_0xf50b7f){return _0x5d029b['sendStatus'](_0x5d1cd6);}return _0x5d029b[_0x7ea8('0x1d')](_0x5d1cd6)[_0x7ea8('0x1e')]();};}function respondWithResult(_0x2e09ef,_0x2fc20c){_0x2fc20c=_0x2fc20c||0xc8;return function(_0x133f5a){if(_0x133f5a){return _0x2e09ef[_0x7ea8('0x1d')](_0x2fc20c)[_0x7ea8('0x1f')](_0x133f5a);}};}function respondWithFilteredResult(_0x3d6368,_0x1517ab){return function(_0x412c56){if(_0x412c56){var _0x3fc953=_0x412c56[_0x7ea8('0x20')],_0x4cb00a=_0x1517ab[_0x7ea8('0x21')],_0x29898c=_0x1517ab[_0x7ea8('0x21')]+_0x1517ab[_0x7ea8('0x22')],_0xd0a05c;if(_0x29898c>=_0x3fc953){_0x29898c=_0x3fc953;_0xd0a05c=0xc8;}else{_0xd0a05c=0xce;}_0x3d6368[_0x7ea8('0x1d')](_0xd0a05c);return _0x3d6368[_0x7ea8('0x23')](_0x7ea8('0x24'),_0x4cb00a+'-'+_0x29898c+'/'+_0x3fc953)[_0x7ea8('0x1f')](_0x412c56);}return null;};}function patchUpdates(_0x58c584){return function(_0x4df3e8){try{jsonpatch['apply'](_0x4df3e8,_0x58c584,!![]);}catch(_0x35da23){return BPromise['reject'](_0x35da23);}return _0x4df3e8['save']();};}function saveUpdates(_0x4c9e75,_0x3e9d50){return function(_0x4ef9fb){if(_0x4ef9fb){return _0x4ef9fb[_0x7ea8('0x25')](_0x4c9e75)[_0x7ea8('0x26')](function(_0x1f62ca){return _0x1f62ca;});}return null;};}function removeEntity(_0x13ef1d,_0x41c2b1){return function(_0x23f6f2){if(_0x23f6f2){return _0x23f6f2[_0x7ea8('0x27')]()[_0x7ea8('0x26')](function(){_0x13ef1d[_0x7ea8('0x1d')](0xcc)[_0x7ea8('0x1e')]();});}};}function handleEntityNotFound(_0x24cd8d,_0x9b33d8){return function(_0x5cffc6){if(!_0x5cffc6){_0x24cd8d[_0x7ea8('0x28')](0x194);}return _0x5cffc6;};}function handleError(_0x21cd4b,_0x341764){_0x341764=_0x341764||0x1f4;return function(_0x5b591e){logger[_0x7ea8('0x29')](_0x5b591e[_0x7ea8('0x2a')]);if(_0x5b591e['name']){delete _0x5b591e[_0x7ea8('0x2b')];}_0x21cd4b['status'](_0x341764)[_0x7ea8('0x2c')](_0x5b591e);};}exports[_0x7ea8('0x2d')]=function(_0x185542,_0x2f7c85){var _0x404ef1={},_0x1261c0={},_0x1d0a3c={'count':0x0,'rows':[]};var _0x5e1e4c=_['map'](db['VoiceAgentReport'][_0x7ea8('0x2e')],function(_0x18cc88){return{'name':_0x18cc88[_0x7ea8('0x2f')],'type':_0x18cc88[_0x7ea8('0x30')]['key']};});_0x1261c0[_0x7ea8('0x31')]=_['map'](_0x5e1e4c,_0x7ea8('0x2b'));_0x1261c0['query']=_[_0x7ea8('0x32')](_0x185542[_0x7ea8('0x33')]);_0x1261c0[_0x7ea8('0x34')]=_['intersection'](_0x1261c0[_0x7ea8('0x31')],_0x1261c0[_0x7ea8('0x33')]);_0x404ef1[_0x7ea8('0x35')]=_[_0x7ea8('0x36')](_0x1261c0[_0x7ea8('0x31')],qs[_0x7ea8('0x37')](_0x185542[_0x7ea8('0x33')][_0x7ea8('0x37')]));_0x404ef1['attributes']=_0x404ef1[_0x7ea8('0x35')][_0x7ea8('0x38')]?_0x404ef1[_0x7ea8('0x35')]:_0x1261c0['model'];if(!_0x185542[_0x7ea8('0x33')][_0x7ea8('0x39')](_0x7ea8('0x3a'))){_0x404ef1[_0x7ea8('0x22')]=qs[_0x7ea8('0x22')](_0x185542[_0x7ea8('0x33')][_0x7ea8('0x22')]);_0x404ef1['offset']=qs[_0x7ea8('0x21')](_0x185542[_0x7ea8('0x33')][_0x7ea8('0x21')]);}_0x404ef1[_0x7ea8('0x3b')]=qs[_0x7ea8('0x3c')](_0x185542[_0x7ea8('0x33')][_0x7ea8('0x3c')]);_0x404ef1[_0x7ea8('0x3d')]=qs[_0x7ea8('0x34')](_['pick'](_0x185542[_0x7ea8('0x33')],_0x1261c0[_0x7ea8('0x34')]),_0x5e1e4c);if(_0x185542[_0x7ea8('0x33')]['filter']){_0x404ef1[_0x7ea8('0x3d')]=_[_0x7ea8('0x3e')](_0x404ef1[_0x7ea8('0x3d')],{'$or':_['map'](_0x5e1e4c,function(_0x75e0f8){if(_0x75e0f8[_0x7ea8('0x30')]!==_0x7ea8('0x3f')){var _0x53ece7={};_0x53ece7[_0x75e0f8['name']]={'$like':'%'+_0x185542[_0x7ea8('0x33')][_0x7ea8('0x40')]+'%'};return _0x53ece7;}})});}_0x404ef1=_[_0x7ea8('0x3e')]({},_0x404ef1,_0x185542[_0x7ea8('0x41')]);var _0x4246d2={'where':_0x404ef1[_0x7ea8('0x3d')]};return db[_0x7ea8('0x42')][_0x7ea8('0x20')](_0x4246d2)[_0x7ea8('0x26')](function(_0xeaef74){_0x1d0a3c[_0x7ea8('0x20')]=_0xeaef74;if(_0x185542[_0x7ea8('0x33')][_0x7ea8('0x43')]){_0x404ef1['include']=[{'all':!![]}];}return db[_0x7ea8('0x42')][_0x7ea8('0x44')](_0x404ef1);})['then'](function(_0x5163cb){_0x1d0a3c[_0x7ea8('0x45')]=_0x5163cb;return _0x1d0a3c;})[_0x7ea8('0x26')](respondWithFilteredResult(_0x2f7c85,_0x404ef1))['catch'](handleError(_0x2f7c85,null));};exports[_0x7ea8('0x46')]=function(_0x5b7607,_0x316c08){var _0xe99447={'raw':![],'where':{'id':_0x5b7607[_0x7ea8('0x47')]['id']}},_0x48f90b={};_0x48f90b[_0x7ea8('0x31')]=_['keys'](db['VoiceAgentReport'][_0x7ea8('0x2e')]);_0x48f90b[_0x7ea8('0x33')]=_['keys'](_0x5b7607[_0x7ea8('0x33')]);_0x48f90b[_0x7ea8('0x34')]=_[_0x7ea8('0x36')](_0x48f90b[_0x7ea8('0x31')],_0x48f90b[_0x7ea8('0x33')]);_0xe99447['attributes']=_[_0x7ea8('0x36')](_0x48f90b[_0x7ea8('0x31')],qs[_0x7ea8('0x37')](_0x5b7607[_0x7ea8('0x33')][_0x7ea8('0x37')]));_0xe99447[_0x7ea8('0x35')]=_0xe99447[_0x7ea8('0x35')]['length']?_0xe99447[_0x7ea8('0x35')]:_0x48f90b['model'];if(_0x5b7607[_0x7ea8('0x33')][_0x7ea8('0x43')]){_0xe99447['include']=[{'all':!![]}];}_0xe99447=_[_0x7ea8('0x3e')]({},_0xe99447,_0x5b7607[_0x7ea8('0x41')]);return db[_0x7ea8('0x42')][_0x7ea8('0x48')](_0xe99447)[_0x7ea8('0x26')](handleEntityNotFound(_0x316c08,null))[_0x7ea8('0x26')](respondWithResult(_0x316c08,null))[_0x7ea8('0x49')](handleError(_0x316c08,null));};exports[_0x7ea8('0x4a')]=function(_0x405c6e,_0x14f442){return db[_0x7ea8('0x42')]['create'](_0x405c6e['body'],{})[_0x7ea8('0x26')](respondWithResult(_0x14f442,0xc9))['catch'](handleError(_0x14f442,null));};exports[_0x7ea8('0x25')]=function(_0xfb74ae,_0x16c1db){if(_0xfb74ae[_0x7ea8('0x4b')]['id']){delete _0xfb74ae[_0x7ea8('0x4b')]['id'];}return db[_0x7ea8('0x42')]['find']({'where':{'id':_0xfb74ae['params']['id']}})['then'](handleEntityNotFound(_0x16c1db,null))['then'](saveUpdates(_0xfb74ae[_0x7ea8('0x4b')],null))[_0x7ea8('0x26')](respondWithResult(_0x16c1db,null))[_0x7ea8('0x49')](handleError(_0x16c1db,null));};exports[_0x7ea8('0x27')]=function(_0x8a12ec,_0x1d3963){return db[_0x7ea8('0x42')][_0x7ea8('0x48')]({'where':{'id':_0x8a12ec[_0x7ea8('0x47')]['id']}})[_0x7ea8('0x26')](handleEntityNotFound(_0x1d3963,null))[_0x7ea8('0x26')](removeEntity(_0x1d3963,null))['catch'](handleError(_0x1d3963,null));};exports[_0x7ea8('0x4c')]=function(_0xed6208,_0x50a80d){return db[_0x7ea8('0x42')]['describe']()[_0x7ea8('0x26')](respondWithResult(_0x50a80d,null))[_0x7ea8('0x49')](handleError(_0x50a80d,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index dd8f0d6..9ace81a 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 _0xa9a7=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api'];(function(_0x96df4d,_0xa4c397){var _0x3075ab=function(_0x788ea4){while(--_0x788ea4){_0x96df4d['push'](_0x96df4d['shift']());}};_0x3075ab(++_0xa4c397);}(_0xa9a7,0xbd));var _0x7a9a=function(_0x5d11ad,_0x1adcb7){_0x5d11ad=_0x5d11ad-0x0;var _0x47e681=_0xa9a7[_0x5d11ad];return _0x47e681;};'use strict';var _=require(_0x7a9a('0x0'));var util=require('util');var logger=require(_0x7a9a('0x1'))(_0x7a9a('0x2'));var moment=require(_0x7a9a('0x3'));var BPromise=require(_0x7a9a('0x4'));var rp=require(_0x7a9a('0x5'));var fs=require('fs');var path=require(_0x7a9a('0x6'));var rimraf=require(_0x7a9a('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a9a('0x8'));module[_0x7a9a('0x9')]=function(_0x1e7b68,_0x2ad42d){return _0x1e7b68[_0x7a9a('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7a9a('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2598=['bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','report_agent','destuniqueid','util','api','moment'];(function(_0x341d13,_0x2a735e){var _0x11d0c5=function(_0x93921){while(--_0x93921){_0x341d13['push'](_0x341d13['shift']());}};_0x11d0c5(++_0x2a735e);}(_0x2598,0x101));var _0x8259=function(_0x1e6f9a,_0x37c6d8){_0x1e6f9a=_0x1e6f9a-0x0;var _0x2b65b0=_0x2598[_0x1e6f9a];return _0x2b65b0;};'use strict';var _=require('lodash');var util=require(_0x8259('0x0'));var logger=require('../../config/logger')(_0x8259('0x1'));var moment=require(_0x8259('0x2'));var BPromise=require(_0x8259('0x3'));var rp=require(_0x8259('0x4'));var fs=require('fs');var path=require(_0x8259('0x5'));var rimraf=require('rimraf');var config=require(_0x8259('0x6'));var attributes=require(_0x8259('0x7'));module['exports']=function(_0x4989a8,_0x267a92){return _0x4989a8['define']('VoiceAgentReport',attributes,{'tableName':_0x8259('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x8259('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 7529bf5..8567e80 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 _0xb0c1=['raw','UpdateVoiceAgentReport','limit','then','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options'];(function(_0xf7254a,_0x5f24e2){var _0x4029cc=function(_0x3d55cd){while(--_0x3d55cd){_0xf7254a['push'](_0xf7254a['shift']());}};_0x4029cc(++_0x5f24e2);}(_0xb0c1,0x160));var _0x1b0c=function(_0x5e3831,_0x3f99b8){_0x5e3831=_0x5e3831-0x0;var _0x24e0ae=_0xb0c1[_0x5e3831];return _0x24e0ae;};'use strict';var _=require('lodash');var util=require(_0x1b0c('0x0'));var moment=require(_0x1b0c('0x1'));var BPromise=require(_0x1b0c('0x2'));var rs=require(_0x1b0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b0c('0x4'));var logger=require(_0x1b0c('0x5'))(_0x1b0c('0x6'));var config=require('../../config/environment');var jayson=require(_0x1b0c('0x7'));var client=jayson[_0x1b0c('0x8')][_0x1b0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x604f69,_0x5461d4,_0x1f5326){return new BPromise(function(_0x1427fd,_0x2dda8d){return client['request'](_0x604f69,_0x1f5326)['then'](function(_0x2ddc85){logger['info'](_0x1b0c('0xa'),_0x5461d4,_0x1b0c('0xb'));logger[_0x1b0c('0xc')](_0x1b0c('0xd'),_0x5461d4,_0x1b0c('0xb'),JSON[_0x1b0c('0xe')](_0x2ddc85));if(_0x2ddc85['error']){if(_0x2ddc85[_0x1b0c('0xf')][_0x1b0c('0x10')]===0x1f4){logger[_0x1b0c('0xf')](_0x1b0c('0xa'),_0x5461d4,_0x2ddc85[_0x1b0c('0xf')][_0x1b0c('0x11')]);return _0x2dda8d(_0x2ddc85['error'][_0x1b0c('0x11')]);}logger[_0x1b0c('0xf')](_0x1b0c('0xa'),_0x5461d4,_0x2ddc85[_0x1b0c('0xf')][_0x1b0c('0x11')]);return _0x1427fd(_0x2ddc85[_0x1b0c('0xf')][_0x1b0c('0x11')]);}else{logger[_0x1b0c('0x12')](_0x1b0c('0xa'),_0x5461d4,_0x1b0c('0xb'));_0x1427fd(_0x2ddc85['result'][_0x1b0c('0x11')]);}})[_0x1b0c('0x13')](function(_0x6a0d3){logger[_0x1b0c('0xf')](_0x1b0c('0xa'),_0x5461d4,_0x6a0d3);_0x2dda8d(_0x6a0d3);});});}exports[_0x1b0c('0x14')]=function(_0x35dc74){var _0x283311=this;return new Promise(function(_0x2e0553,_0x3ff6a4){return db[_0x1b0c('0x15')][_0x1b0c('0x16')](_0x35dc74[_0x1b0c('0x17')],{'raw':_0x35dc74[_0x1b0c('0x18')]?_0x35dc74['options'][_0x1b0c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x84fa5f){logger[_0x1b0c('0x12')](_0x1b0c('0x14'),_0x35dc74);logger[_0x1b0c('0xc')](_0x1b0c('0x14'),_0x35dc74,JSON[_0x1b0c('0xe')](_0x84fa5f));_0x2e0553(_0x84fa5f);})['catch'](function(_0x1fb2de){logger[_0x1b0c('0xf')](_0x1b0c('0x14'),_0x1fb2de[_0x1b0c('0x11')],_0x35dc74);_0x3ff6a4(_0x283311[_0x1b0c('0xf')](0x1f4,_0x1fb2de[_0x1b0c('0x11')]));});});};exports[_0x1b0c('0x1a')]=function(_0x275066){var _0x335499=this;return new Promise(function(_0x5d0387,_0x591094){return db[_0x1b0c('0x15')]['update'](_0x275066['body'],{'raw':_0x275066['options']?_0x275066[_0x1b0c('0x18')][_0x1b0c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x275066[_0x1b0c('0x18')]?_0x275066[_0x1b0c('0x18')]['where']||null:null,'attributes':_0x275066[_0x1b0c('0x18')]?_0x275066['options']['attributes']||null:null,'limit':_0x275066['options']?_0x275066[_0x1b0c('0x18')][_0x1b0c('0x1b')]||null:null})[_0x1b0c('0x1c')](function(_0xc5bb4c){logger['info']('UpdateVoiceAgentReport',_0x275066);logger[_0x1b0c('0xc')](_0x1b0c('0x1a'),_0x275066,JSON[_0x1b0c('0xe')](_0xc5bb4c));_0x5d0387(_0xc5bb4c);})[_0x1b0c('0x13')](function(_0x426153){logger[_0x1b0c('0xf')]('UpdateVoiceAgentReport',_0x426153[_0x1b0c('0x11')],_0x275066);_0x591094(_0x335499[_0x1b0c('0xf')](0x1f4,_0x426153[_0x1b0c('0x11')]));});});}; \ No newline at end of file +var _0xa67d=['result','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xfc8df7,_0x2b320d){var _0x3a55be=function(_0x47aef1){while(--_0x47aef1){_0xfc8df7['push'](_0xfc8df7['shift']());}};_0x3a55be(++_0x2b320d);}(_0xa67d,0x191));var _0xda67=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xa67d[_0x3b150c];return _0x5cd414;};'use strict';var _=require(_0xda67('0x0'));var util=require('util');var moment=require(_0xda67('0x1'));var BPromise=require('bluebird');var rs=require(_0xda67('0x2'));var fs=require('fs');var Redis=require(_0xda67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda67('0x4'));var logger=require(_0xda67('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda67('0x6'));var client=jayson[_0xda67('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a85f,_0xb995a,_0x2f9cc7){return new BPromise(function(_0x41c2e5,_0x849973){return client[_0xda67('0x8')](_0x23a85f,_0x2f9cc7)[_0xda67('0x9')](function(_0x344c70){logger[_0xda67('0xa')](_0xda67('0xb'),_0xb995a,'request\x20sent');logger[_0xda67('0xc')](_0xda67('0xd'),_0xb995a,_0xda67('0xe'),JSON[_0xda67('0xf')](_0x344c70));if(_0x344c70[_0xda67('0x10')]){if(_0x344c70[_0xda67('0x10')][_0xda67('0x11')]===0x1f4){logger[_0xda67('0x10')](_0xda67('0xb'),_0xb995a,_0x344c70[_0xda67('0x10')][_0xda67('0x12')]);return _0x849973(_0x344c70['error'][_0xda67('0x12')]);}logger[_0xda67('0x10')](_0xda67('0xb'),_0xb995a,_0x344c70[_0xda67('0x10')][_0xda67('0x12')]);return _0x41c2e5(_0x344c70[_0xda67('0x10')][_0xda67('0x12')]);}else{logger['info'](_0xda67('0xb'),_0xb995a,_0xda67('0xe'));_0x41c2e5(_0x344c70[_0xda67('0x13')]['message']);}})[_0xda67('0x14')](function(_0x2a37a7){logger[_0xda67('0x10')](_0xda67('0xb'),_0xb995a,_0x2a37a7);_0x849973(_0x2a37a7);});});}exports['CreateVoiceAgentReport']=function(_0x36f382){var _0x3d6b1d=this;return new Promise(function(_0x1a3e42,_0x443209){return db[_0xda67('0x15')]['create'](_0x36f382[_0xda67('0x16')],{'raw':_0x36f382[_0xda67('0x17')]?_0x36f382[_0xda67('0x17')][_0xda67('0x18')]===undefined?!![]:![]:!![]})[_0xda67('0x9')](function(_0x860480){logger[_0xda67('0xa')](_0xda67('0x19'),_0x36f382);logger[_0xda67('0xc')]('CreateVoiceAgentReport',_0x36f382,JSON[_0xda67('0xf')](_0x860480));_0x1a3e42(_0x860480);})[_0xda67('0x14')](function(_0x165da6){logger[_0xda67('0x10')](_0xda67('0x19'),_0x165da6[_0xda67('0x12')],_0x36f382);_0x443209(_0x3d6b1d[_0xda67('0x10')](0x1f4,_0x165da6[_0xda67('0x12')]));});});};exports[_0xda67('0x1a')]=function(_0x15273b){var _0x457dce=this;return new Promise(function(_0x41314c,_0xedb29a){return db[_0xda67('0x15')][_0xda67('0x1b')](_0x15273b['body'],{'raw':_0x15273b['options']?_0x15273b[_0xda67('0x17')][_0xda67('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15273b['options']?_0x15273b[_0xda67('0x17')][_0xda67('0x1c')]||null:null,'attributes':_0x15273b[_0xda67('0x17')]?_0x15273b[_0xda67('0x17')][_0xda67('0x1d')]||null:null,'limit':_0x15273b[_0xda67('0x17')]?_0x15273b[_0xda67('0x17')]['limit']||null:null})[_0xda67('0x9')](function(_0x58de44){logger[_0xda67('0xa')](_0xda67('0x1a'),_0x15273b);logger[_0xda67('0xc')](_0xda67('0x1a'),_0x15273b,JSON['stringify'](_0x58de44));_0x41314c(_0x58de44);})[_0xda67('0x14')](function(_0x3417d8){logger[_0xda67('0x10')](_0xda67('0x1a'),_0x3417d8[_0xda67('0x12')],_0x15273b);_0xedb29a(_0x457dce[_0xda67('0x10')](0x1f4,_0x3417d8[_0xda67('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b7bb29e..533639a 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 _0xf4fa=['../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2bef93,_0x25e908){var _0x5b45b1=function(_0x427439){while(--_0x427439){_0x2bef93['push'](_0x2bef93['shift']());}};_0x5b45b1(++_0x25e908);}(_0xf4fa,0x13e));var _0xaf4f=function(_0x2bb24d,_0x16f000){_0x2bb24d=_0x2bb24d-0x0;var _0x527c1f=_0xf4fa[_0x2bb24d];return _0x527c1f;};'use strict';var multer=require(_0xaf4f('0x0'));var util=require(_0xaf4f('0x1'));var path=require(_0xaf4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf4f('0x3'));var router=express[_0xaf4f('0x4')]();var auth=require(_0xaf4f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf4f('0x6'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xaf4f('0x7')](),controller['index']);router[_0xaf4f('0x8')](_0xaf4f('0x9'),auth[_0xaf4f('0x7')](),controller[_0xaf4f('0xa')]);router[_0xaf4f('0x8')](_0xaf4f('0xb'),auth[_0xaf4f('0x7')](),controller[_0xaf4f('0xc')]);router['post']('/',auth[_0xaf4f('0x7')](),controller[_0xaf4f('0xd')]);router[_0xaf4f('0xe')](_0xaf4f('0xb'),auth['isAuthenticated'](),controller[_0xaf4f('0xf')]);router[_0xaf4f('0x10')](_0xaf4f('0xb'),auth[_0xaf4f('0x7')](),controller[_0xaf4f('0x11')]);module[_0xaf4f('0x12')]=router; \ No newline at end of file +var _0x28f2=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x28f2,0x181));var _0x228f=function(_0x460a8b,_0x24e7d8){_0x460a8b=_0x460a8b-0x0;var _0x4f225b=_0x28f2[_0x460a8b];return _0x4f225b;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require('path');var timeout=require(_0x228f('0x2'));var express=require('express');var router=express[_0x228f('0x3')]();var auth=require(_0x228f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x228f('0x5'));var controller=require(_0x228f('0x6'));router['get']('/',auth[_0x228f('0x7')](),controller[_0x228f('0x8')]);router[_0x228f('0x9')](_0x228f('0xa'),auth[_0x228f('0x7')](),controller[_0x228f('0xb')]);router[_0x228f('0x9')](_0x228f('0xc'),auth[_0x228f('0x7')](),controller[_0x228f('0xd')]);router[_0x228f('0xe')]('/',auth['isAuthenticated'](),controller[_0x228f('0xf')]);router[_0x228f('0x10')](_0x228f('0xc'),auth[_0x228f('0x7')](),controller[_0x228f('0x11')]);router['delete']('/:id',auth[_0x228f('0x7')](),controller[_0x228f('0x12')]);module[_0x228f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ce3898e..b507b24 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 _0x7fbe=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','STRING','ENUM','inbound'];(function(_0x1a97ae,_0x1858b4){var _0x2805e7=function(_0x809b21){while(--_0x809b21){_0x1a97ae['push'](_0x1a97ae['shift']());}};_0x2805e7(++_0x1858b4);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2de59e,_0x24b766){_0x2de59e=_0x2de59e-0x0;var _0x534d4b=_0x7fbe[_0x2de59e];return _0x534d4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')]},'type':{'type':Sequelize[_0xe7fb('0x1')](_0xe7fb('0x2'),_0xe7fb('0x3'),_0xe7fb('0x4'),_0xe7fb('0x5'),_0xe7fb('0x6'),_0xe7fb('0x7'))},'tag':{'type':Sequelize[_0xe7fb('0x0')]},'accountcode':{'type':Sequelize[_0xe7fb('0x0')]},'source':{'type':Sequelize[_0xe7fb('0x0')]},'destination':{'type':Sequelize[_0xe7fb('0x0')]},'destinationcontext':{'type':Sequelize[_0xe7fb('0x0')]},'callerid':{'type':Sequelize[_0xe7fb('0x0')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xe7fb('0x0')]},'lastapplication':{'type':Sequelize[_0xe7fb('0x0')]},'lastdata':{'type':Sequelize[_0xe7fb('0x8')]},'starttime':{'type':Sequelize[_0xe7fb('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe7fb('0x9')]},'duration':{'type':Sequelize[_0xe7fb('0xa')]},'billableseconds':{'type':Sequelize[_0xe7fb('0xa')]},'mohtime':{'type':Sequelize[_0xe7fb('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe7fb('0x0')]},'amaflags':{'type':Sequelize[_0xe7fb('0x0')]},'userfield':{'type':Sequelize[_0xe7fb('0x0')]},'userDisposition':{'type':Sequelize[_0xe7fb('0x0')]},'userSecondDisposition':{'type':Sequelize[_0xe7fb('0x0')]},'userThirdDisposition':{'type':Sequelize[_0xe7fb('0x0')]},'note':{'type':Sequelize[_0xe7fb('0x0')]},'prefix':{'type':Sequelize[_0xe7fb('0x0')]},'routeid':{'type':Sequelize[_0xe7fb('0xa')]},'sipcallid':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file +var _0x5162=['internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0x5162,0x103));var _0x2516=function(_0x3bfd9a,_0x5c5a47){_0x3bfd9a=_0x3bfd9a-0x0;var _0x34ae7c=_0x5162[_0x3bfd9a];return _0x34ae7c;};'use strict';var Sequelize=require(_0x2516('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('inbound',_0x2516('0x1'),_0x2516('0x2'),_0x2516('0x3'),_0x2516('0x4'),_0x2516('0x5'))},'tag':{'type':Sequelize[_0x2516('0x6')]},'accountcode':{'type':Sequelize[_0x2516('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2516('0x6')]},'channel':{'type':Sequelize[_0x2516('0x6')]},'destinationchannel':{'type':Sequelize[_0x2516('0x6')]},'lastapplication':{'type':Sequelize[_0x2516('0x6')]},'lastdata':{'type':Sequelize[_0x2516('0x7')]},'starttime':{'type':Sequelize[_0x2516('0x8')]},'systemanswertime':{'type':Sequelize[_0x2516('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2516('0x8')]},'duration':{'type':Sequelize[_0x2516('0x9')]},'billableseconds':{'type':Sequelize[_0x2516('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x2516('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x2516('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x2516('0x6')]},'note':{'type':Sequelize[_0x2516('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x2516('0x9')]},'sipcallid':{'type':Sequelize[_0x2516('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index fae1a46..8c3cf57 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 c45bce5..a72d45f 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 _0x1d8f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid'];(function(_0x13ca35,_0x377803){var _0x24efb1=function(_0x99c832){while(--_0x99c832){_0x13ca35['push'](_0x13ca35['shift']());}};_0x24efb1(++_0x377803);}(_0x1d8f,0x1a0));var _0xf1d8=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x1d8f[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require(_0xf1d8('0x0'));var logger=require(_0xf1d8('0x1'))(_0xf1d8('0x2'));var moment=require(_0xf1d8('0x3'));var BPromise=require(_0xf1d8('0x4'));var rp=require(_0xf1d8('0x5'));var fs=require('fs');var path=require(_0xf1d8('0x6'));var rimraf=require(_0xf1d8('0x7'));var config=require('../../config/environment');var attributes=require(_0xf1d8('0x8'));module[_0xf1d8('0x9')]=function(_0x5d9863,_0x311dee){return _0x5d9863[_0xf1d8('0xa')](_0xf1d8('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xf1d8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79c9=['moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','lodash','util','../../config/logger','api'];(function(_0x45e5e1,_0x7ba35d){var _0x525bf7=function(_0x2253ef){while(--_0x2253ef){_0x45e5e1['push'](_0x45e5e1['shift']());}};_0x525bf7(++_0x7ba35d);}(_0x79c9,0x1b6));var _0x979c=function(_0x3483b8,_0x117c1c){_0x3483b8=_0x3483b8-0x0;var _0x88cea3=_0x79c9[_0x3483b8];return _0x88cea3;};'use strict';var _=require(_0x979c('0x0'));var util=require(_0x979c('0x1'));var logger=require(_0x979c('0x2'))(_0x979c('0x3'));var moment=require(_0x979c('0x4'));var BPromise=require(_0x979c('0x5'));var rp=require(_0x979c('0x6'));var fs=require('fs');var path=require(_0x979c('0x7'));var rimraf=require('rimraf');var config=require(_0x979c('0x8'));var attributes=require(_0x979c('0x9'));module[_0x979c('0xa')]=function(_0x208391,_0x4c7fae){return _0x208391[_0x979c('0xb')]('VoiceCallReport',attributes,{'tableName':_0x979c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a231df6..baa9d77 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 _0xc7bc=['debug','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','stringify','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x151f5a,_0x40da3e){var _0x4c2117=function(_0x3168c2){while(--_0x3168c2){_0x151f5a['push'](_0x151f5a['shift']());}};_0x4c2117(++_0x40da3e);}(_0xc7bc,0x8c));var _0xcc7b=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xc7bc[_0x1cb0b4];return _0x525b60;};'use strict';var _=require(_0xcc7b('0x0'));var util=require(_0xcc7b('0x1'));var moment=require(_0xcc7b('0x2'));var BPromise=require(_0xcc7b('0x3'));var rs=require(_0xcc7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc7b('0x5'))['db'];var utils=require(_0xcc7b('0x6'));var logger=require(_0xcc7b('0x7'))(_0xcc7b('0x8'));var config=require(_0xcc7b('0x9'));var jayson=require(_0xcc7b('0xa'));var client=jayson[_0xcc7b('0xb')][_0xcc7b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e13de,_0x3cabb2,_0x59820d){return new BPromise(function(_0x4a14ac,_0x3848a3){return client[_0xcc7b('0xd')](_0x1e13de,_0x59820d)[_0xcc7b('0xe')](function(_0x1c0839){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3cabb2,_0xcc7b('0xf'));logger[_0xcc7b('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3cabb2,_0xcc7b('0xf'),JSON['stringify'](_0x1c0839));if(_0x1c0839['error']){if(_0x1c0839[_0xcc7b('0x11')][_0xcc7b('0x12')]===0x1f4){logger[_0xcc7b('0x11')](_0xcc7b('0x13'),_0x3cabb2,_0x1c0839[_0xcc7b('0x11')][_0xcc7b('0x14')]);return _0x3848a3(_0x1c0839[_0xcc7b('0x11')][_0xcc7b('0x14')]);}logger[_0xcc7b('0x11')](_0xcc7b('0x13'),_0x3cabb2,_0x1c0839[_0xcc7b('0x11')][_0xcc7b('0x14')]);return _0x4a14ac(_0x1c0839[_0xcc7b('0x11')]['message']);}else{logger[_0xcc7b('0x15')](_0xcc7b('0x13'),_0x3cabb2,_0xcc7b('0xf'));_0x4a14ac(_0x1c0839['result'][_0xcc7b('0x14')]);}})[_0xcc7b('0x16')](function(_0x558d95){logger[_0xcc7b('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3cabb2,_0x558d95);_0x3848a3(_0x558d95);});});}exports[_0xcc7b('0x17')]=function(_0x512cf7){var _0x2e6ded=this;return new Promise(function(_0x730f,_0x3a1d80){return db[_0xcc7b('0x18')][_0xcc7b('0x19')]({'raw':_0x512cf7[_0xcc7b('0x1a')]?_0x512cf7[_0xcc7b('0x1a')][_0xcc7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x512cf7['options']?_0x512cf7[_0xcc7b('0x1a')][_0xcc7b('0x1c')]||null:null,'attributes':_0x512cf7[_0xcc7b('0x1a')]?_0x512cf7[_0xcc7b('0x1a')][_0xcc7b('0x1d')]||null:null,'limit':_0x512cf7[_0xcc7b('0x1a')]?_0x512cf7['options']['limit']||null:null,'include':_0x512cf7['options']?_0x512cf7['options']['include']?_[_0xcc7b('0x1e')](_0x512cf7[_0xcc7b('0x1a')]['include'],function(_0x47581c){return{'model':db[_0x47581c['model']],'as':_0x47581c['as'],'attributes':_0x47581c[_0xcc7b('0x1d')],'include':_0x47581c[_0xcc7b('0x1f')]?_[_0xcc7b('0x1e')](_0x47581c[_0xcc7b('0x1f')],function(_0x3fd4f7){return{'model':db[_0x3fd4f7[_0xcc7b('0x20')]],'as':_0x3fd4f7['as'],'attributes':_0x3fd4f7[_0xcc7b('0x1d')],'include':_0x3fd4f7[_0xcc7b('0x1f')]?_[_0xcc7b('0x1e')](_0x3fd4f7[_0xcc7b('0x1f')],function(_0x3afc0b){return{'model':db[_0x3afc0b[_0xcc7b('0x20')]],'as':_0x3afc0b['as'],'attributes':_0x3afc0b[_0xcc7b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc7b('0xe')](function(_0x348526){logger['info']('GetVoiceCallReport',_0x512cf7);logger[_0xcc7b('0x10')]('GetVoiceCallReport',_0x512cf7,JSON[_0xcc7b('0x21')](_0x348526));_0x730f(_0x348526);})[_0xcc7b('0x16')](function(_0x16d1be){logger['error'](_0xcc7b('0x17'),_0x16d1be[_0xcc7b('0x14')],_0x512cf7);_0x3a1d80(_0x2e6ded['error'](0x1f4,_0x16d1be['message']));});});};exports[_0xcc7b('0x22')]=function(_0x5466a1){var _0x5add7b=this;return new Promise(function(_0x4fe3af,_0x117d80){return db[_0xcc7b('0x18')]['create'](_0x5466a1[_0xcc7b('0x23')],{'raw':_0x5466a1[_0xcc7b('0x1a')]?_0x5466a1[_0xcc7b('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcc7b('0xe')](function(_0x43cd2c){logger[_0xcc7b('0x15')]('CreateVoiceCallReport',_0x5466a1);logger[_0xcc7b('0x10')](_0xcc7b('0x22'),_0x5466a1,JSON[_0xcc7b('0x21')](_0x43cd2c));_0x4fe3af(_0x43cd2c);})['catch'](function(_0x111fa2){logger[_0xcc7b('0x11')](_0xcc7b('0x22'),_0x111fa2[_0xcc7b('0x14')],_0x5466a1);_0x117d80(_0x5add7b['error'](0x1f4,_0x111fa2[_0xcc7b('0x14')]));});});};exports[_0xcc7b('0x24')]=function(_0x3cbea4){var _0x13a85a=this;return new Promise(function(_0x39670a,_0x37cf50){return db[_0xcc7b('0x18')][_0xcc7b('0x25')](_0x3cbea4[_0xcc7b('0x23')],{'raw':_0x3cbea4['options']?_0x3cbea4[_0xcc7b('0x1a')][_0xcc7b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cbea4[_0xcc7b('0x1a')]?_0x3cbea4['options'][_0xcc7b('0x1c')]||null:null,'attributes':_0x3cbea4[_0xcc7b('0x1a')]?_0x3cbea4[_0xcc7b('0x1a')][_0xcc7b('0x1d')]||null:null,'limit':_0x3cbea4[_0xcc7b('0x1a')]?_0x3cbea4[_0xcc7b('0x1a')][_0xcc7b('0x26')]||null:null})[_0xcc7b('0xe')](function(_0x57beed){logger['info'](_0xcc7b('0x24'),_0x3cbea4);logger[_0xcc7b('0x10')](_0xcc7b('0x24'),_0x3cbea4,JSON[_0xcc7b('0x21')](_0x57beed));_0x39670a(_0x57beed);})[_0xcc7b('0x16')](function(_0x4b8a8e){logger[_0xcc7b('0x11')](_0xcc7b('0x24'),_0x4b8a8e[_0xcc7b('0x14')],_0x3cbea4);_0x37cf50(_0x13a85a[_0xcc7b('0x11')](0x1f4,_0x4b8a8e[_0xcc7b('0x14')]));});});}; \ No newline at end of file +var _0xb080=['GetVoiceCallReport','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','debug'];(function(_0x154eed,_0x461909){var _0x30f659=function(_0x5337c0){while(--_0x5337c0){_0x154eed['push'](_0x154eed['shift']());}};_0x30f659(++_0x461909);}(_0xb080,0x1a9));var _0x0b08=function(_0x413d11,_0x317373){_0x413d11=_0x413d11-0x0;var _0x2072ce=_0xb080[_0x413d11];return _0x2072ce;};'use strict';var _=require(_0x0b08('0x0'));var util=require(_0x0b08('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b08('0x2'));var fs=require('fs');var Redis=require(_0x0b08('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b08('0x4'));var logger=require(_0x0b08('0x5'))('rpc');var config=require(_0x0b08('0x6'));var jayson=require(_0x0b08('0x7'));var client=jayson['client'][_0x0b08('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x406b90,_0x5f0e5b,_0x45877c){return new BPromise(function(_0xbdd113,_0x3ee158){return client[_0x0b08('0x9')](_0x406b90,_0x45877c)[_0x0b08('0xa')](function(_0x57682a){logger[_0x0b08('0xb')](_0x0b08('0xc'),_0x5f0e5b,_0x0b08('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5f0e5b,'request\x20sent',JSON[_0x0b08('0xe')](_0x57682a));if(_0x57682a[_0x0b08('0xf')]){if(_0x57682a[_0x0b08('0xf')]['code']===0x1f4){logger[_0x0b08('0xf')](_0x0b08('0xc'),_0x5f0e5b,_0x57682a['error'][_0x0b08('0x10')]);return _0x3ee158(_0x57682a[_0x0b08('0xf')][_0x0b08('0x10')]);}logger[_0x0b08('0xf')](_0x0b08('0xc'),_0x5f0e5b,_0x57682a[_0x0b08('0xf')][_0x0b08('0x10')]);return _0xbdd113(_0x57682a['error']['message']);}else{logger[_0x0b08('0xb')](_0x0b08('0xc'),_0x5f0e5b,'request\x20sent');_0xbdd113(_0x57682a[_0x0b08('0x11')][_0x0b08('0x10')]);}})[_0x0b08('0x12')](function(_0x124cc6){logger[_0x0b08('0xf')](_0x0b08('0xc'),_0x5f0e5b,_0x124cc6);_0x3ee158(_0x124cc6);});});}exports['GetVoiceCallReport']=function(_0x4c5dee){var _0x3ec3d0=this;return new Promise(function(_0x5e8363,_0x49223a){return db[_0x0b08('0x13')][_0x0b08('0x14')]({'raw':_0x4c5dee[_0x0b08('0x15')]?_0x4c5dee[_0x0b08('0x15')][_0x0b08('0x16')]===undefined?!![]:![]:!![],'where':_0x4c5dee[_0x0b08('0x15')]?_0x4c5dee[_0x0b08('0x15')][_0x0b08('0x17')]||null:null,'attributes':_0x4c5dee[_0x0b08('0x15')]?_0x4c5dee['options'][_0x0b08('0x18')]||null:null,'limit':_0x4c5dee[_0x0b08('0x15')]?_0x4c5dee[_0x0b08('0x15')][_0x0b08('0x19')]||null:null,'include':_0x4c5dee['options']?_0x4c5dee[_0x0b08('0x15')][_0x0b08('0x1a')]?_['map'](_0x4c5dee['options'][_0x0b08('0x1a')],function(_0x19f0c7){return{'model':db[_0x19f0c7[_0x0b08('0x1b')]],'as':_0x19f0c7['as'],'attributes':_0x19f0c7[_0x0b08('0x18')],'include':_0x19f0c7[_0x0b08('0x1a')]?_[_0x0b08('0x1c')](_0x19f0c7[_0x0b08('0x1a')],function(_0x1c0aec){return{'model':db[_0x1c0aec[_0x0b08('0x1b')]],'as':_0x1c0aec['as'],'attributes':_0x1c0aec[_0x0b08('0x18')],'include':_0x1c0aec[_0x0b08('0x1a')]?_[_0x0b08('0x1c')](_0x1c0aec[_0x0b08('0x1a')],function(_0x529a6f){return{'model':db[_0x529a6f[_0x0b08('0x1b')]],'as':_0x529a6f['as'],'attributes':_0x529a6f[_0x0b08('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b08('0xa')](function(_0x1c89d5){logger[_0x0b08('0xb')]('GetVoiceCallReport',_0x4c5dee);logger[_0x0b08('0x1d')](_0x0b08('0x1e'),_0x4c5dee,JSON[_0x0b08('0xe')](_0x1c89d5));_0x5e8363(_0x1c89d5);})[_0x0b08('0x12')](function(_0x1df224){logger['error'](_0x0b08('0x1e'),_0x1df224['message'],_0x4c5dee);_0x49223a(_0x3ec3d0['error'](0x1f4,_0x1df224['message']));});});};exports[_0x0b08('0x1f')]=function(_0x5ed075){var _0x49f20f=this;return new Promise(function(_0x55641c,_0x412056){return db['VoiceCallReport']['create'](_0x5ed075[_0x0b08('0x20')],{'raw':_0x5ed075['options']?_0x5ed075[_0x0b08('0x15')][_0x0b08('0x16')]===undefined?!![]:![]:!![]})[_0x0b08('0xa')](function(_0x2fee6e){logger['info'](_0x0b08('0x1f'),_0x5ed075);logger[_0x0b08('0x1d')](_0x0b08('0x1f'),_0x5ed075,JSON[_0x0b08('0xe')](_0x2fee6e));_0x55641c(_0x2fee6e);})[_0x0b08('0x12')](function(_0x1f0c90){logger[_0x0b08('0xf')]('CreateVoiceCallReport',_0x1f0c90[_0x0b08('0x10')],_0x5ed075);_0x412056(_0x49f20f[_0x0b08('0xf')](0x1f4,_0x1f0c90[_0x0b08('0x10')]));});});};exports[_0x0b08('0x21')]=function(_0x4d4891){var _0x1928b4=this;return new Promise(function(_0x49bf94,_0x7949da){return db['VoiceCallReport'][_0x0b08('0x22')](_0x4d4891[_0x0b08('0x20')],{'raw':_0x4d4891[_0x0b08('0x15')]?_0x4d4891[_0x0b08('0x15')][_0x0b08('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d4891[_0x0b08('0x15')]?_0x4d4891[_0x0b08('0x15')][_0x0b08('0x17')]||null:null,'attributes':_0x4d4891['options']?_0x4d4891[_0x0b08('0x15')][_0x0b08('0x18')]||null:null,'limit':_0x4d4891[_0x0b08('0x15')]?_0x4d4891[_0x0b08('0x15')][_0x0b08('0x19')]||null:null})['then'](function(_0x2e4959){logger[_0x0b08('0xb')](_0x0b08('0x21'),_0x4d4891);logger[_0x0b08('0x1d')](_0x0b08('0x21'),_0x4d4891,JSON[_0x0b08('0xe')](_0x2e4959));_0x49bf94(_0x2e4959);})[_0x0b08('0x12')](function(_0x35ed83){logger[_0x0b08('0xf')]('UpdateVoiceCallReport',_0x35ed83[_0x0b08('0x10')],_0x4d4891);_0x7949da(_0x1928b4[_0x0b08('0xf')](0x1f4,_0x35ed83[_0x0b08('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index af663ec..d12c99b 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 _0x1134=['/:id','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','get','show','post','create','put'];(function(_0x5afacd,_0x36edf2){var _0x24d6d3=function(_0x30531c){while(--_0x30531c){_0x5afacd['push'](_0x5afacd['shift']());}};_0x24d6d3(++_0x36edf2);}(_0x1134,0x19c));var _0x4113=function(_0x5e2e62,_0x435057){_0x5e2e62=_0x5e2e62-0x0;var _0x2b2e48=_0x1134[_0x5e2e62];return _0x2b2e48;};'use strict';var multer=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var path=require('path');var timeout=require(_0x4113('0x2'));var express=require(_0x4113('0x3'));var router=express['Router']();var auth=require(_0x4113('0x4'));var interaction=require(_0x4113('0x5'));var config=require('../../config/environment');var controller=require(_0x4113('0x6'));router['get']('/',auth[_0x4113('0x7')](),controller['index']);router[_0x4113('0x8')]('/:id',auth[_0x4113('0x7')](),controller[_0x4113('0x9')]);router[_0x4113('0xa')]('/',auth[_0x4113('0x7')](),controller[_0x4113('0xb')]);router[_0x4113('0xc')](_0x4113('0xd'),auth[_0x4113('0x7')](),controller['update']);router[_0x4113('0xe')](_0x4113('0xd'),auth[_0x4113('0x7')](),controller[_0x4113('0xf')]);module[_0x4113('0x10')]=router; \ No newline at end of file +var _0x8463=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x36fb15,_0x2fb51e){var _0x4a0bf2=function(_0x3ecccd){while(--_0x3ecccd){_0x36fb15['push'](_0x36fb15['shift']());}};_0x4a0bf2(++_0x2fb51e);}(_0x8463,0x1b2));var _0x3846=function(_0x2dc90e,_0x13c5a4){_0x2dc90e=_0x2dc90e-0x0;var _0x23114e=_0x8463[_0x2dc90e];return _0x23114e;};'use strict';var multer=require(_0x3846('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3846('0x1'));var express=require(_0x3846('0x2'));var router=express[_0x3846('0x3')]();var auth=require(_0x3846('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3846('0x5'));router[_0x3846('0x6')]('/',auth[_0x3846('0x7')](),controller[_0x3846('0x8')]);router[_0x3846('0x6')](_0x3846('0x9'),auth[_0x3846('0x7')](),controller[_0x3846('0xa')]);router[_0x3846('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3846('0x9'),auth[_0x3846('0x7')](),controller[_0x3846('0xc')]);router[_0x3846('0xd')](_0x3846('0x9'),auth[_0x3846('0x7')](),controller[_0x3846('0xe')]);module[_0x3846('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 8533018..b564df4 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 _0xaee0=['exports','STRING','name','setDataValue','options','join','getDataValue','sequelize'];(function(_0x36d488,_0xe8c33d){var _0x32cdcb=function(_0x44cbb0){while(--_0x44cbb0){_0x36d488['push'](_0x36d488['shift']());}};_0x32cdcb(++_0xe8c33d);}(_0xaee0,0xa7));var _0x0aee=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0xaee0[_0x264d4d];return _0xc917e2;};'use strict';var Sequelize=require(_0x0aee('0x0'));module[_0x0aee('0x1')]={'name':{'type':Sequelize[_0x0aee('0x2')]},'prefix':{'type':Sequelize[_0x0aee('0x2')],'unique':_0x0aee('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0aee('0x2')],'set':function(_0x3be16f){this[_0x0aee('0x4')](_0x0aee('0x5'),_0x3be16f?_0x3be16f[_0x0aee('0x6')](''):[]);},'get':function(){return this[_0x0aee('0x7')](_0x0aee('0x5'))?this[_0x0aee('0x7')](_0x0aee('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0aee('0x2')]},'description':{'type':Sequelize[_0x0aee('0x2')]}}; \ No newline at end of file +var _0x043e=['STRING','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x043e,0x9e));var _0xe043=function(_0xbbc471,_0x945ee3){_0xbbc471=_0xbbc471-0x0;var _0x3ddbe9=_0x043e[_0xbbc471];return _0x3ddbe9;};'use strict';var Sequelize=require(_0xe043('0x0'));module[_0xe043('0x1')]={'name':{'type':Sequelize[_0xe043('0x2')]},'prefix':{'type':Sequelize[_0xe043('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xe043('0x2')],'set':function(_0x1b3033){this[_0xe043('0x3')](_0xe043('0x4'),_0x1b3033?_0x1b3033[_0xe043('0x5')](''):[]);},'get':function(){return this[_0xe043('0x6')]('options')?this[_0xe043('0x6')](_0xe043('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0xe043('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xe043('0x2')]},'record':{'type':Sequelize[_0xe043('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe043('0x2')]},'description':{'type':Sequelize[_0xe043('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b5574e2..a807e2c 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 _0x4e8a=['hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','status','error','stack','name','index','map','VoiceChanSpy','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x6a734c,_0x1b2d9f){var _0x494d0d=function(_0x36fd39){while(--_0x36fd39){_0x6a734c['push'](_0x6a734c['shift']());}};_0x494d0d(++_0x1b2d9f);}(_0x4e8a,0x1ed));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa4e8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa4e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4e8('0x2'));var rp=require(_0xa4e8('0x3'));var moment=require(_0xa4e8('0x4'));var BPromise=require(_0xa4e8('0x5'));var Mustache=require(_0xa4e8('0x6'));var util=require(_0xa4e8('0x7'));var path=require(_0xa4e8('0x8'));var sox=require('sox');var csv=require(_0xa4e8('0x9'));var ejs=require(_0xa4e8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4e8('0xb'));var crypto=require('crypto');var jsforce=require(_0xa4e8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4e8('0x9'));var querystring=require('querystring');var Papa=require(_0xa4e8('0xd'));var Redis=require(_0xa4e8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4e8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4e8('0x10'))(_0xa4e8('0x11'));var utils=require(_0xa4e8('0x12'));var config=require(_0xa4e8('0x13'));var licenseUtil=require(_0xa4e8('0x14'));var db=require(_0xa4e8('0x15'))['db'];function respondWithStatusCode(_0x335f11,_0x24be9f){_0x24be9f=_0x24be9f||0xcc;return function(_0x4e9692){if(_0x4e9692){return _0x335f11['sendStatus'](_0x24be9f);}return _0x335f11['status'](_0x24be9f)[_0xa4e8('0x16')]();};}function respondWithResult(_0x3aa776,_0xa64b25){_0xa64b25=_0xa64b25||0xc8;return function(_0x1ff97b){if(_0x1ff97b){return _0x3aa776['status'](_0xa64b25)[_0xa4e8('0x17')](_0x1ff97b);}};}function respondWithFilteredResult(_0x3ed183,_0x2e03ad){return function(_0x2054db){if(_0x2054db){var _0xfd018e=_0x2054db[_0xa4e8('0x18')],_0x30e883=_0x2e03ad['offset'],_0x4c238b=_0x2e03ad[_0xa4e8('0x19')]+_0x2e03ad['limit'],_0x469516;if(_0x4c238b>=_0xfd018e){_0x4c238b=_0xfd018e;_0x469516=0xc8;}else{_0x469516=0xce;}_0x3ed183['status'](_0x469516);return _0x3ed183[_0xa4e8('0x1a')](_0xa4e8('0x1b'),_0x30e883+'-'+_0x4c238b+'/'+_0xfd018e)[_0xa4e8('0x17')](_0x2054db);}return null;};}function patchUpdates(_0x54dd82){return function(_0x728fe7){try{jsonpatch[_0xa4e8('0x1c')](_0x728fe7,_0x54dd82,!![]);}catch(_0x5eaa85){return BPromise[_0xa4e8('0x1d')](_0x5eaa85);}return _0x728fe7[_0xa4e8('0x1e')]();};}function saveUpdates(_0x347c6a,_0x35f336){return function(_0x1aa800){if(_0x1aa800){return _0x1aa800['update'](_0x347c6a)[_0xa4e8('0x1f')](function(_0x32ddf8){return _0x32ddf8;});}return null;};}function removeEntity(_0x1f1093,_0xa68f35){return function(_0x199455){if(_0x199455){return _0x199455[_0xa4e8('0x20')]()[_0xa4e8('0x1f')](function(){var _0x488af0=_0x199455[_0xa4e8('0x21')]({'plain':!![]});var _0xbea5e9=_0xa4e8('0x22');return db[_0xa4e8('0x23')][_0xa4e8('0x20')]({'where':{'type':_0xbea5e9,'resourceId':_0x488af0['id']}})[_0xa4e8('0x1f')](function(){return _0x199455;});})['then'](function(){_0x1f1093[_0xa4e8('0x24')](0xcc)[_0xa4e8('0x16')]();});}};}function handleEntityNotFound(_0xba755b,_0x21014a){return function(_0x59a99b){if(!_0x59a99b){_0xba755b['sendStatus'](0x194);}return _0x59a99b;};}function handleError(_0x27117c,_0x587199){_0x587199=_0x587199||0x1f4;return function(_0x5b5ad4){logger[_0xa4e8('0x25')](_0x5b5ad4[_0xa4e8('0x26')]);if(_0x5b5ad4[_0xa4e8('0x27')]){delete _0x5b5ad4[_0xa4e8('0x27')];}_0x27117c[_0xa4e8('0x24')](_0x587199)['send'](_0x5b5ad4);};}exports[_0xa4e8('0x28')]=function(_0xd7e81f,_0x124fad){var _0x1e0a2d={},_0x3b3eeb={},_0x240873={'count':0x0,'rows':[]};var _0x1133f8=_[_0xa4e8('0x29')](db[_0xa4e8('0x2a')]['rawAttributes'],function(_0x390245){return{'name':_0x390245[_0xa4e8('0x2b')],'type':_0x390245[_0xa4e8('0x2c')]['key']};});_0x3b3eeb['model']=_[_0xa4e8('0x29')](_0x1133f8,'name');_0x3b3eeb[_0xa4e8('0x2d')]=_[_0xa4e8('0x2e')](_0xd7e81f[_0xa4e8('0x2d')]);_0x3b3eeb[_0xa4e8('0x2f')]=_[_0xa4e8('0x30')](_0x3b3eeb[_0xa4e8('0x31')],_0x3b3eeb['query']);_0x1e0a2d[_0xa4e8('0x32')]=_[_0xa4e8('0x30')](_0x3b3eeb[_0xa4e8('0x31')],qs[_0xa4e8('0x33')](_0xd7e81f[_0xa4e8('0x2d')][_0xa4e8('0x33')]));_0x1e0a2d[_0xa4e8('0x32')]=_0x1e0a2d['attributes'][_0xa4e8('0x34')]?_0x1e0a2d[_0xa4e8('0x32')]:_0x3b3eeb[_0xa4e8('0x31')];if(!_0xd7e81f['query'][_0xa4e8('0x35')](_0xa4e8('0x36'))){_0x1e0a2d['limit']=qs['limit'](_0xd7e81f[_0xa4e8('0x2d')]['limit']);_0x1e0a2d[_0xa4e8('0x19')]=qs['offset'](_0xd7e81f[_0xa4e8('0x2d')][_0xa4e8('0x19')]);}_0x1e0a2d[_0xa4e8('0x37')]=qs[_0xa4e8('0x38')](_0xd7e81f[_0xa4e8('0x2d')]['sort']);_0x1e0a2d[_0xa4e8('0x39')]=qs[_0xa4e8('0x2f')](_[_0xa4e8('0x3a')](_0xd7e81f[_0xa4e8('0x2d')],_0x3b3eeb[_0xa4e8('0x2f')]),_0x1133f8);if(_0xd7e81f['query']['filter']){_0x1e0a2d[_0xa4e8('0x39')]=_['merge'](_0x1e0a2d[_0xa4e8('0x39')],{'$or':_['map'](_0x1133f8,function(_0x30584d){if(_0x30584d['type']!==_0xa4e8('0x3b')){var _0x534106={};_0x534106[_0x30584d[_0xa4e8('0x27')]]={'$like':'%'+_0xd7e81f[_0xa4e8('0x2d')][_0xa4e8('0x3c')]+'%'};return _0x534106;}})});}_0x1e0a2d=_[_0xa4e8('0x3d')]({},_0x1e0a2d,_0xd7e81f[_0xa4e8('0x3e')]);var _0x396533={'where':_0x1e0a2d[_0xa4e8('0x39')]};return db[_0xa4e8('0x2a')][_0xa4e8('0x18')](_0x396533)['then'](function(_0x555100){_0x240873['count']=_0x555100;if(_0xd7e81f['query'][_0xa4e8('0x3f')]){_0x1e0a2d[_0xa4e8('0x40')]=[{'all':!![]}];}return db[_0xa4e8('0x2a')][_0xa4e8('0x41')](_0x1e0a2d);})[_0xa4e8('0x1f')](function(_0x5c65cf){_0x240873[_0xa4e8('0x42')]=_0x5c65cf;return _0x240873;})[_0xa4e8('0x1f')](respondWithFilteredResult(_0x124fad,_0x1e0a2d))[_0xa4e8('0x43')](handleError(_0x124fad,null));};exports[_0xa4e8('0x44')]=function(_0x5f3050,_0x2dfd37){var _0x2f5526={'raw':![],'where':{'id':_0x5f3050[_0xa4e8('0x45')]['id']}},_0xd3c9b0={};_0xd3c9b0[_0xa4e8('0x31')]=_[_0xa4e8('0x2e')](db['VoiceChanSpy'][_0xa4e8('0x46')]);_0xd3c9b0[_0xa4e8('0x2d')]=_[_0xa4e8('0x2e')](_0x5f3050[_0xa4e8('0x2d')]);_0xd3c9b0['filters']=_[_0xa4e8('0x30')](_0xd3c9b0['model'],_0xd3c9b0['query']);_0x2f5526[_0xa4e8('0x32')]=_[_0xa4e8('0x30')](_0xd3c9b0[_0xa4e8('0x31')],qs['fields'](_0x5f3050['query'][_0xa4e8('0x33')]));_0x2f5526[_0xa4e8('0x32')]=_0x2f5526[_0xa4e8('0x32')][_0xa4e8('0x34')]?_0x2f5526[_0xa4e8('0x32')]:_0xd3c9b0[_0xa4e8('0x31')];if(_0x5f3050[_0xa4e8('0x2d')][_0xa4e8('0x3f')]){_0x2f5526[_0xa4e8('0x40')]=[{'all':!![]}];}_0x2f5526=_[_0xa4e8('0x3d')]({},_0x2f5526,_0x5f3050[_0xa4e8('0x3e')]);return db['VoiceChanSpy']['find'](_0x2f5526)[_0xa4e8('0x1f')](handleEntityNotFound(_0x2dfd37,null))[_0xa4e8('0x1f')](respondWithResult(_0x2dfd37,null))[_0xa4e8('0x43')](handleError(_0x2dfd37,null));};exports['create']=function(_0x468b01,_0x235f98){return db[_0xa4e8('0x2a')]['create'](_0x468b01[_0xa4e8('0x47')],{})[_0xa4e8('0x1f')](function(_0x3b1989){var _0x59bdc4=_0x468b01[_0xa4e8('0x48')][_0xa4e8('0x21')]({'plain':!![]});if(!_0x59bdc4)throw new Error(_0xa4e8('0x49'));if(_0x59bdc4[_0xa4e8('0x4a')]===_0xa4e8('0x48')){var _0xe2ff56=_0x3b1989[_0xa4e8('0x21')]({'plain':!![]});var _0x50f5d4='ChanSpies';return db[_0xa4e8('0x4b')][_0xa4e8('0x4c')]({'where':{'name':_0x50f5d4,'userProfileId':_0x59bdc4['userProfileId']},'raw':!![]})[_0xa4e8('0x1f')](function(_0x591079){if(_0x591079&&_0x591079[_0xa4e8('0x4d')]===0x0){return db[_0xa4e8('0x23')]['create']({'name':_0xe2ff56[_0xa4e8('0x27')],'resourceId':_0xe2ff56['id'],'type':_0x591079['name'],'sectionId':_0x591079['id']},{})[_0xa4e8('0x1f')](function(){return _0x3b1989;});}else{return _0x3b1989;}})['catch'](function(_0x37f55c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37f55c);throw _0x37f55c;});}return _0x3b1989;})[_0xa4e8('0x1f')](respondWithResult(_0x235f98,0xc9))[_0xa4e8('0x43')](handleError(_0x235f98,null));};exports['update']=function(_0x1720ab,_0x38b20e){if(_0x1720ab[_0xa4e8('0x47')]['id']){delete _0x1720ab[_0xa4e8('0x47')]['id'];}return db[_0xa4e8('0x2a')][_0xa4e8('0x4c')]({'where':{'id':_0x1720ab['params']['id']}})['then'](handleEntityNotFound(_0x38b20e,null))[_0xa4e8('0x1f')](saveUpdates(_0x1720ab['body'],null))[_0xa4e8('0x1f')](respondWithResult(_0x38b20e,null))[_0xa4e8('0x43')](handleError(_0x38b20e,null));};exports['destroy']=function(_0x7bb464,_0x2324e0){return db['VoiceChanSpy'][_0xa4e8('0x4c')]({'where':{'id':_0x7bb464[_0xa4e8('0x45')]['id']}})[_0xa4e8('0x1f')](handleEntityNotFound(_0x2324e0,null))[_0xa4e8('0x1f')](removeEntity(_0x2324e0,null))[_0xa4e8('0x43')](handleError(_0x2324e0,null));}; \ No newline at end of file +var _0xf80b=['VoiceChanSpy','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','map','type','VIRTUAL','filter','merge','options','count','includeAll','include','rawAttributes','filters','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','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','set','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','index'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xf80b,0x126));var _0xbf80=function(_0x55b200,_0x2af221){_0x55b200=_0x55b200-0x0;var _0x31afee=_0xf80b[_0x55b200];return _0x31afee;};'use strict';var pdf=require(_0xbf80('0x0'));var emlformat=require(_0xbf80('0x1'));var rimraf=require(_0xbf80('0x2'));var zipdir=require(_0xbf80('0x3'));var jsonpatch=require(_0xbf80('0x4'));var rp=require(_0xbf80('0x5'));var moment=require(_0xbf80('0x6'));var BPromise=require(_0xbf80('0x7'));var Mustache=require(_0xbf80('0x8'));var util=require(_0xbf80('0x9'));var path=require(_0xbf80('0xa'));var sox=require(_0xbf80('0xb'));var csv=require(_0xbf80('0xc'));var ejs=require(_0xbf80('0xd'));var fs=require('fs');var _=require(_0xbf80('0xe'));var squel=require(_0xbf80('0xf'));var crypto=require(_0xbf80('0x10'));var jsforce=require(_0xbf80('0x11'));var deskjs=require(_0xbf80('0x12'));var toCsv=require(_0xbf80('0xc'));var querystring=require(_0xbf80('0x13'));var Papa=require('papaparse');var Redis=require(_0xbf80('0x14'));var authService=require(_0xbf80('0x15'));var qs=require(_0xbf80('0x16'));var as=require(_0xbf80('0x17'));var hardwareService=require(_0xbf80('0x18'));var logger=require(_0xbf80('0x19'))(_0xbf80('0x1a'));var utils=require(_0xbf80('0x1b'));var config=require(_0xbf80('0x1c'));var licenseUtil=require(_0xbf80('0x1d'));var db=require(_0xbf80('0x1e'))['db'];function respondWithStatusCode(_0x287e26,_0x5e0ca6){_0x5e0ca6=_0x5e0ca6||0xcc;return function(_0x278d44){if(_0x278d44){return _0x287e26['sendStatus'](_0x5e0ca6);}return _0x287e26[_0xbf80('0x1f')](_0x5e0ca6)[_0xbf80('0x20')]();};}function respondWithResult(_0x48515d,_0x3f7a9c){_0x3f7a9c=_0x3f7a9c||0xc8;return function(_0x497dc1){if(_0x497dc1){return _0x48515d[_0xbf80('0x1f')](_0x3f7a9c)[_0xbf80('0x21')](_0x497dc1);}};}function respondWithFilteredResult(_0x474b03,_0x1e4f61){return function(_0xbdb8ab){if(_0xbdb8ab){var _0x4a9d06=_0xbdb8ab['count'],_0x252eec=_0x1e4f61['offset'],_0x311b26=_0x1e4f61[_0xbf80('0x22')]+_0x1e4f61['limit'],_0x240dc5;if(_0x311b26>=_0x4a9d06){_0x311b26=_0x4a9d06;_0x240dc5=0xc8;}else{_0x240dc5=0xce;}_0x474b03[_0xbf80('0x1f')](_0x240dc5);return _0x474b03[_0xbf80('0x23')]('Content-Range',_0x252eec+'-'+_0x311b26+'/'+_0x4a9d06)[_0xbf80('0x21')](_0xbdb8ab);}return null;};}function patchUpdates(_0x530c8e){return function(_0x4420d4){try{jsonpatch[_0xbf80('0x24')](_0x4420d4,_0x530c8e,!![]);}catch(_0x71d800){return BPromise[_0xbf80('0x25')](_0x71d800);}return _0x4420d4[_0xbf80('0x26')]();};}function saveUpdates(_0x6a0ae8,_0x5abc12){return function(_0x297edf){if(_0x297edf){return _0x297edf['update'](_0x6a0ae8)['then'](function(_0x1465a0){return _0x1465a0;});}return null;};}function removeEntity(_0x11bf63,_0x3fd14f){return function(_0x206199){if(_0x206199){return _0x206199[_0xbf80('0x27')]()[_0xbf80('0x28')](function(){var _0x49311d=_0x206199['get']({'plain':!![]});var _0x4eda4f='ChanSpies';return db[_0xbf80('0x29')][_0xbf80('0x27')]({'where':{'type':_0x4eda4f,'resourceId':_0x49311d['id']}})[_0xbf80('0x28')](function(){return _0x206199;});})[_0xbf80('0x28')](function(){_0x11bf63[_0xbf80('0x1f')](0xcc)[_0xbf80('0x20')]();});}};}function handleEntityNotFound(_0x18e212,_0x210e07){return function(_0x1ca51d){if(!_0x1ca51d){_0x18e212['sendStatus'](0x194);}return _0x1ca51d;};}function handleError(_0x402ee6,_0x23566a){_0x23566a=_0x23566a||0x1f4;return function(_0x129466){logger[_0xbf80('0x2a')](_0x129466[_0xbf80('0x2b')]);if(_0x129466[_0xbf80('0x2c')]){delete _0x129466[_0xbf80('0x2c')];}_0x402ee6['status'](_0x23566a)['send'](_0x129466);};}exports[_0xbf80('0x2d')]=function(_0x3ce173,_0x22de5f){var _0x34553b={},_0x3e8269={},_0x5d6da2={'count':0x0,'rows':[]};var _0xda37d7=_['map'](db[_0xbf80('0x2e')]['rawAttributes'],function(_0xc6d92d){return{'name':_0xc6d92d[_0xbf80('0x2f')],'type':_0xc6d92d['type'][_0xbf80('0x30')]};});_0x3e8269[_0xbf80('0x31')]=_['map'](_0xda37d7,_0xbf80('0x2c'));_0x3e8269[_0xbf80('0x32')]=_[_0xbf80('0x33')](_0x3ce173['query']);_0x3e8269['filters']=_[_0xbf80('0x34')](_0x3e8269[_0xbf80('0x31')],_0x3e8269['query']);_0x34553b[_0xbf80('0x35')]=_[_0xbf80('0x34')](_0x3e8269[_0xbf80('0x31')],qs[_0xbf80('0x36')](_0x3ce173['query'][_0xbf80('0x36')]));_0x34553b[_0xbf80('0x35')]=_0x34553b[_0xbf80('0x35')]['length']?_0x34553b[_0xbf80('0x35')]:_0x3e8269['model'];if(!_0x3ce173[_0xbf80('0x32')][_0xbf80('0x37')]('nolimit')){_0x34553b[_0xbf80('0x38')]=qs[_0xbf80('0x38')](_0x3ce173['query']['limit']);_0x34553b[_0xbf80('0x22')]=qs[_0xbf80('0x22')](_0x3ce173[_0xbf80('0x32')]['offset']);}_0x34553b['order']=qs['sort'](_0x3ce173[_0xbf80('0x32')][_0xbf80('0x39')]);_0x34553b[_0xbf80('0x3a')]=qs['filters'](_[_0xbf80('0x3b')](_0x3ce173[_0xbf80('0x32')],_0x3e8269['filters']),_0xda37d7);if(_0x3ce173['query']['filter']){_0x34553b[_0xbf80('0x3a')]=_['merge'](_0x34553b['where'],{'$or':_[_0xbf80('0x3c')](_0xda37d7,function(_0x2e9ea4){if(_0x2e9ea4[_0xbf80('0x3d')]!==_0xbf80('0x3e')){var _0x498b75={};_0x498b75[_0x2e9ea4[_0xbf80('0x2c')]]={'$like':'%'+_0x3ce173[_0xbf80('0x32')][_0xbf80('0x3f')]+'%'};return _0x498b75;}})});}_0x34553b=_[_0xbf80('0x40')]({},_0x34553b,_0x3ce173[_0xbf80('0x41')]);var _0x3329c2={'where':_0x34553b[_0xbf80('0x3a')]};return db['VoiceChanSpy'][_0xbf80('0x42')](_0x3329c2)[_0xbf80('0x28')](function(_0x161c02){_0x5d6da2[_0xbf80('0x42')]=_0x161c02;if(_0x3ce173[_0xbf80('0x32')][_0xbf80('0x43')]){_0x34553b[_0xbf80('0x44')]=[{'all':!![]}];}return db[_0xbf80('0x2e')]['findAll'](_0x34553b);})[_0xbf80('0x28')](function(_0x173cba){_0x5d6da2['rows']=_0x173cba;return _0x5d6da2;})[_0xbf80('0x28')](respondWithFilteredResult(_0x22de5f,_0x34553b))['catch'](handleError(_0x22de5f,null));};exports['show']=function(_0x555122,_0x5f2dde){var _0x3213b3={'raw':![],'where':{'id':_0x555122['params']['id']}},_0x496d45={};_0x496d45[_0xbf80('0x31')]=_[_0xbf80('0x33')](db[_0xbf80('0x2e')][_0xbf80('0x45')]);_0x496d45[_0xbf80('0x32')]=_[_0xbf80('0x33')](_0x555122[_0xbf80('0x32')]);_0x496d45[_0xbf80('0x46')]=_[_0xbf80('0x34')](_0x496d45[_0xbf80('0x31')],_0x496d45[_0xbf80('0x32')]);_0x3213b3[_0xbf80('0x35')]=_['intersection'](_0x496d45[_0xbf80('0x31')],qs['fields'](_0x555122[_0xbf80('0x32')][_0xbf80('0x36')]));_0x3213b3[_0xbf80('0x35')]=_0x3213b3['attributes'][_0xbf80('0x47')]?_0x3213b3[_0xbf80('0x35')]:_0x496d45['model'];if(_0x555122[_0xbf80('0x32')][_0xbf80('0x43')]){_0x3213b3[_0xbf80('0x44')]=[{'all':!![]}];}_0x3213b3=_[_0xbf80('0x40')]({},_0x3213b3,_0x555122[_0xbf80('0x41')]);return db[_0xbf80('0x2e')][_0xbf80('0x48')](_0x3213b3)[_0xbf80('0x28')](handleEntityNotFound(_0x5f2dde,null))[_0xbf80('0x28')](respondWithResult(_0x5f2dde,null))[_0xbf80('0x49')](handleError(_0x5f2dde,null));};exports[_0xbf80('0x4a')]=function(_0x2443ac,_0x5a71cb){return db[_0xbf80('0x2e')][_0xbf80('0x4a')](_0x2443ac[_0xbf80('0x4b')],{})['then'](function(_0x55cf00){var _0x103ceb=_0x2443ac['user'][_0xbf80('0x4c')]({'plain':!![]});if(!_0x103ceb)throw new Error(_0xbf80('0x4d'));if(_0x103ceb[_0xbf80('0x4e')]===_0xbf80('0x4f')){var _0x5b4af1=_0x55cf00['get']({'plain':!![]});var _0x3bdfdd='ChanSpies';return db['UserProfileSection'][_0xbf80('0x48')]({'where':{'name':_0x3bdfdd,'userProfileId':_0x103ceb[_0xbf80('0x50')]},'raw':!![]})[_0xbf80('0x28')](function(_0x165312){if(_0x165312&&_0x165312[_0xbf80('0x51')]===0x0){return db[_0xbf80('0x29')]['create']({'name':_0x5b4af1[_0xbf80('0x2c')],'resourceId':_0x5b4af1['id'],'type':_0x165312[_0xbf80('0x2c')],'sectionId':_0x165312['id']},{})[_0xbf80('0x28')](function(){return _0x55cf00;});}else{return _0x55cf00;}})[_0xbf80('0x49')](function(_0x1d7096){logger['error'](_0xbf80('0x52'),_0x1d7096);throw _0x1d7096;});}return _0x55cf00;})[_0xbf80('0x28')](respondWithResult(_0x5a71cb,0xc9))[_0xbf80('0x49')](handleError(_0x5a71cb,null));};exports[_0xbf80('0x53')]=function(_0x33aa34,_0x47179a){if(_0x33aa34[_0xbf80('0x4b')]['id']){delete _0x33aa34['body']['id'];}return db[_0xbf80('0x2e')][_0xbf80('0x48')]({'where':{'id':_0x33aa34['params']['id']}})[_0xbf80('0x28')](handleEntityNotFound(_0x47179a,null))[_0xbf80('0x28')](saveUpdates(_0x33aa34['body'],null))[_0xbf80('0x28')](respondWithResult(_0x47179a,null))[_0xbf80('0x49')](handleError(_0x47179a,null));};exports['destroy']=function(_0x486ae6,_0x1965c8){return db['VoiceChanSpy'][_0xbf80('0x48')]({'where':{'id':_0x486ae6[_0xbf80('0x54')]['id']}})['then'](handleEntityNotFound(_0x1965c8,null))[_0xbf80('0x28')](removeEntity(_0x1965c8,null))[_0xbf80('0x49')](handleError(_0x1965c8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c514b8a..4359119 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 _0x6c50=['findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor','length','concat','internal','User'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6c50,0xa4));var _0x06c5=function(_0x3bb08e,_0x59d4b5){_0x3bb08e=_0x3bb08e-0x0;var _0x20fc19=_0x6c50[_0x3bb08e];return _0x20fc19;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var BPromise=require(_0x06c5('0x2'));var attributes=require(_0x06c5('0x3'));var getUserApplications=function(_0x495adf,_0xd66539,_0x494494){var _0x4271d1=0x1;var _0x2853be=[];var _0x434003={'context':_0xd66539[_0x06c5('0x4')]||_0x06c5('0x5'),'exten':util[_0x06c5('0x6')](_0x06c5('0x7'),_0x495adf[_0x06c5('0x8')],_0x494494),'type':_0x06c5('0x9'),'isApp':![],'ChanSpyId':_0x495adf['id'],'UserId':_0xd66539['id']};_0x2853be[_0x06c5('0xa')](_[_0x06c5('0xb')]({'app':'Set','appdata':util[_0x06c5('0x6')](_0x06c5('0xc'),_0x06c5('0xd')),'priority':_0x4271d1++},_0x434003));if(_0x495adf[_0x06c5('0xe')]){_0x2853be['push'](_['merge']({'app':'MixMonitor','appdata':util[_0x06c5('0x6')]('${UNIQUEID}.%s,a',_0x495adf['recordingFormat']),'priority':_0x4271d1++},_0x434003));}if(_0x495adf['auth']){_0x2853be[_0x06c5('0xa')](_['merge']({'app':_0x06c5('0xf'),'appdata':_0x495adf[_0x06c5('0x10')],'priority':_0x4271d1++},_0x434003));}_0x2853be[_0x06c5('0xa')](_['merge']({'app':_0x06c5('0x11'),'appdata':util[_0x06c5('0x6')](_0x06c5('0x12'),_0xd66539[_0x06c5('0x13')],_0x495adf['options']?_0x495adf['options'][_0x06c5('0x14')](''):''),'priority':_0x4271d1++},_0x434003));if(_0x495adf[_0x06c5('0xe')]){_0x2853be[_0x06c5('0xa')](_['merge']({'app':_0x06c5('0x15'),'priority':_0x4271d1++},_0x434003));}return _0x2853be;};var getChanSpyApplications=function(_0x117371,_0x4ba5df){var _0x3ab0f7=[];for(var _0x9045e6=0x0,_0x21aa11=0x1;_0x9045e6<_0x4ba5df[_0x06c5('0x16')];_0x9045e6++,_0x21aa11=0x1){_0x3ab0f7=_0x3ab0f7[_0x06c5('0x17')](getUserApplications(_0x117371,_0x4ba5df[_0x9045e6],_0x4ba5df[_0x9045e6][_0x06c5('0x18')]));if(_0x4ba5df[_0x9045e6][_0x06c5('0x18')]!=_0x4ba5df[_0x9045e6][_0x06c5('0x13')]){_0x3ab0f7=_0x3ab0f7[_0x06c5('0x17')](getUserApplications(_0x117371,_0x4ba5df[_0x9045e6],_0x4ba5df[_0x9045e6][_0x06c5('0x13')]));}}return _0x3ab0f7;};var getChanSpyPromise=function(_0x30dc0f,_0x46471b){return new BPromise(function(_0x359dbe,_0x1a959b){return _0x30dc0f[_0x06c5('0x19')][_0x06c5('0x1a')]({'attributes':['id',_0x06c5('0x13'),'internal'],'where':{'role':_0x06c5('0x1b'),'chanspy':!![]},'raw':!![]})[_0x06c5('0x1c')](function(_0x35496f){if(_0x35496f){return _0x359dbe(getChanSpyApplications(_0x46471b,_0x35496f));}return _0x359dbe([]);})[_0x06c5('0x1d')](function(_0xa3659b){_0x1a959b(_0xa3659b);});});};module[_0x06c5('0x1e')]=function(_0x29db18,_0x4c93cc){var _0x3ff85b=_0x29db18[_0x06c5('0x1f')];return _0x29db18[_0x06c5('0x20')](_0x06c5('0x21'),attributes,{'tableName':_0x06c5('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43f239,_0x1b506c,_0x51f2a6){return getChanSpyPromise(_0x3ff85b,_0x43f239)[_0x06c5('0x1c')](function(_0x5aeb6c){if(_0x5aeb6c&&_0x5aeb6c['length']){return _0x3ff85b['VoiceExtension']['bulkCreate'](_0x5aeb6c);}})[_0x06c5('0x1c')](function(){_0x51f2a6();})[_0x06c5('0x1d')](function(_0x1067e1){_0x51f2a6(_0x1067e1);});},'afterUpdate':function(_0xc73475,_0x2ead19,_0x547661){return _0x3ff85b[_0x06c5('0x23')][_0x06c5('0x24')]({'where':{'ChanSpyId':_0xc73475['id']}})[_0x06c5('0x1c')](function(){return getChanSpyPromise(_0x3ff85b,_0xc73475);})[_0x06c5('0x1c')](function(_0x2f8ac9){if(_0x2f8ac9&&_0x2f8ac9['length']){return _0x3ff85b[_0x06c5('0x23')][_0x06c5('0x25')](_0x2f8ac9);}})[_0x06c5('0x1c')](function(){_0x547661();})['catch'](function(_0x1e7d5e){_0x547661(_0x1e7d5e);});},'afterDestroy':function(_0x2ded2b,_0x22a29c,_0x5766ca){return _0x3ff85b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x2ded2b['id']}})[_0x06c5('0x1c')](function(){_0x5766ca();})['catch'](function(_0x456151){_0x5766ca(_0x456151);});}}});}; \ No newline at end of file +var _0x4631=['VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','agent','then','catch','exports','models'];(function(_0x57ccc0,_0x25364c){var _0x1e9320=function(_0x3e33d4){while(--_0x3e33d4){_0x57ccc0['push'](_0x57ccc0['shift']());}};_0x1e9320(++_0x25364c);}(_0x4631,0xb9));var _0x1463=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x4631[_0x32729c];return _0x482cfd;};'use strict';var _=require(_0x1463('0x0'));var util=require(_0x1463('0x1'));var BPromise=require('bluebird');var attributes=require(_0x1463('0x2'));var getUserApplications=function(_0x56fb20,_0x5a9f5e,_0x5bf8b7){var _0x4c1d5b=0x1;var _0x3524e4=[];var _0x296e9d={'context':_0x5a9f5e[_0x1463('0x3')]||_0x1463('0x4'),'exten':util[_0x1463('0x5')](_0x1463('0x6'),_0x56fb20[_0x1463('0x7')],_0x5bf8b7),'type':'system','isApp':![],'ChanSpyId':_0x56fb20['id'],'UserId':_0x5a9f5e['id']};_0x3524e4[_0x1463('0x8')](_[_0x1463('0x9')]({'app':_0x1463('0xa'),'appdata':util[_0x1463('0x5')]('CDR(type)=%s',_0x1463('0xb')),'priority':_0x4c1d5b++},_0x296e9d));if(_0x56fb20[_0x1463('0xc')]){_0x3524e4[_0x1463('0x8')](_['merge']({'app':_0x1463('0xd'),'appdata':util['format'](_0x1463('0xe'),_0x56fb20['recordingFormat']),'priority':_0x4c1d5b++},_0x296e9d));}if(_0x56fb20[_0x1463('0xf')]){_0x3524e4['push'](_['merge']({'app':'Authenticate','appdata':_0x56fb20[_0x1463('0x10')],'priority':_0x4c1d5b++},_0x296e9d));}_0x3524e4[_0x1463('0x8')](_[_0x1463('0x9')]({'app':_0x1463('0x11'),'appdata':util[_0x1463('0x5')](_0x1463('0x12'),_0x5a9f5e[_0x1463('0x13')],_0x56fb20[_0x1463('0x14')]?_0x56fb20[_0x1463('0x14')][_0x1463('0x15')](''):''),'priority':_0x4c1d5b++},_0x296e9d));if(_0x56fb20[_0x1463('0xc')]){_0x3524e4[_0x1463('0x8')](_[_0x1463('0x9')]({'app':_0x1463('0x16'),'priority':_0x4c1d5b++},_0x296e9d));}return _0x3524e4;};var getChanSpyApplications=function(_0x5e606d,_0x611c19){var _0x522994=[];for(var _0x3f0239=0x0,_0x17b4ba=0x1;_0x3f0239<_0x611c19['length'];_0x3f0239++,_0x17b4ba=0x1){_0x522994=_0x522994[_0x1463('0x17')](getUserApplications(_0x5e606d,_0x611c19[_0x3f0239],_0x611c19[_0x3f0239][_0x1463('0x18')]));if(_0x611c19[_0x3f0239][_0x1463('0x18')]!=_0x611c19[_0x3f0239][_0x1463('0x13')]){_0x522994=_0x522994[_0x1463('0x17')](getUserApplications(_0x5e606d,_0x611c19[_0x3f0239],_0x611c19[_0x3f0239][_0x1463('0x13')]));}}return _0x522994;};var getChanSpyPromise=function(_0x17bea1,_0x1a0173){return new BPromise(function(_0x380f14,_0x2d2db3){return _0x17bea1[_0x1463('0x19')]['findAll']({'attributes':['id','name',_0x1463('0x18')],'where':{'role':_0x1463('0x1a'),'chanspy':!![]},'raw':!![]})[_0x1463('0x1b')](function(_0x3a024c){if(_0x3a024c){return _0x380f14(getChanSpyApplications(_0x1a0173,_0x3a024c));}return _0x380f14([]);})[_0x1463('0x1c')](function(_0x6de5b1){_0x2d2db3(_0x6de5b1);});});};module[_0x1463('0x1d')]=function(_0xd8834a,_0x274229){var _0x50edb2=_0xd8834a[_0x1463('0x1e')];return _0xd8834a['define'](_0x1463('0x1f'),attributes,{'tableName':_0x1463('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ee12d,_0x129177,_0x1f7609){return getChanSpyPromise(_0x50edb2,_0x1ee12d)['then'](function(_0x1cb809){if(_0x1cb809&&_0x1cb809['length']){return _0x50edb2[_0x1463('0x21')][_0x1463('0x22')](_0x1cb809);}})['then'](function(){_0x1f7609();})[_0x1463('0x1c')](function(_0x37c69f){_0x1f7609(_0x37c69f);});},'afterUpdate':function(_0x10fc41,_0x515e3f,_0x45d64a){return _0x50edb2[_0x1463('0x21')]['destroy']({'where':{'ChanSpyId':_0x10fc41['id']}})[_0x1463('0x1b')](function(){return getChanSpyPromise(_0x50edb2,_0x10fc41);})[_0x1463('0x1b')](function(_0x42c280){if(_0x42c280&&_0x42c280['length']){return _0x50edb2[_0x1463('0x21')][_0x1463('0x22')](_0x42c280);}})[_0x1463('0x1b')](function(){_0x45d64a();})['catch'](function(_0x589258){_0x45d64a(_0x589258);});},'afterDestroy':function(_0x1b2a25,_0x4555f2,_0x282d3d){return _0x50edb2[_0x1463('0x21')][_0x1463('0x23')]({'where':{'ChanSpyId':_0x1b2a25['id']}})[_0x1463('0x1b')](function(){_0x282d3d();})[_0x1463('0x1c')](function(_0x35ff26){_0x282d3d(_0x35ff26);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index aba8b16..6f2f2ad 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 _0xb43c=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird'];(function(_0x14fb30,_0x2d3402){var _0x2a8a2f=function(_0x4b8d58){while(--_0x4b8d58){_0x14fb30['push'](_0x14fb30['shift']());}};_0x2a8a2f(++_0x2d3402);}(_0xb43c,0x15d));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcb43('0x0'));var util=require('util');var moment=require(_0xcb43('0x1'));var BPromise=require(_0xcb43('0x2'));var rs=require(_0xcb43('0x3'));var fs=require('fs');var Redis=require(_0xcb43('0x4'));var db=require(_0xcb43('0x5'))['db'];var utils=require(_0xcb43('0x6'));var logger=require('../../config/logger')(_0xcb43('0x7'));var config=require(_0xcb43('0x8'));var jayson=require(_0xcb43('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12ffaa,_0x422647,_0x425943){return new BPromise(function(_0x5cb879,_0x36e29e){return client[_0xcb43('0xa')](_0x12ffaa,_0x425943)[_0xcb43('0xb')](function(_0x559fc8){logger[_0xcb43('0xc')](_0xcb43('0xd'),_0x422647,'request\x20sent');logger[_0xcb43('0xe')](_0xcb43('0xf'),_0x422647,'request\x20sent',JSON[_0xcb43('0x10')](_0x559fc8));if(_0x559fc8[_0xcb43('0x11')]){if(_0x559fc8[_0xcb43('0x11')]['code']===0x1f4){logger[_0xcb43('0x11')](_0xcb43('0xd'),_0x422647,_0x559fc8[_0xcb43('0x11')]['message']);return _0x36e29e(_0x559fc8['error'][_0xcb43('0x12')]);}logger[_0xcb43('0x11')](_0xcb43('0xd'),_0x422647,_0x559fc8['error'][_0xcb43('0x12')]);return _0x5cb879(_0x559fc8['error']['message']);}else{logger[_0xcb43('0xc')](_0xcb43('0xd'),_0x422647,_0xcb43('0x13'));_0x5cb879(_0x559fc8[_0xcb43('0x14')]['message']);}})[_0xcb43('0x15')](function(_0x5c8cd3){logger[_0xcb43('0x11')](_0xcb43('0xd'),_0x422647,_0x5c8cd3);_0x36e29e(_0x5c8cd3);});});} \ No newline at end of file +var _0x773a=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x773a,0x19f));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa773('0x0'));var moment=require(_0xa773('0x1'));var BPromise=require(_0xa773('0x2'));var rs=require(_0xa773('0x3'));var fs=require('fs');var Redis=require(_0xa773('0x4'));var db=require(_0xa773('0x5'))['db'];var utils=require(_0xa773('0x6'));var logger=require(_0xa773('0x7'))(_0xa773('0x8'));var config=require('../../config/environment');var jayson=require(_0xa773('0x9'));var client=jayson[_0xa773('0xa')][_0xa773('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a9dfa,_0x4b909e,_0x45067f){return new BPromise(function(_0x3fb2f2,_0x27ecef){return client[_0xa773('0xc')](_0x4a9dfa,_0x45067f)[_0xa773('0xd')](function(_0x525787){logger[_0xa773('0xe')](_0xa773('0xf'),_0x4b909e,'request\x20sent');logger[_0xa773('0x10')](_0xa773('0x11'),_0x4b909e,_0xa773('0x12'),JSON[_0xa773('0x13')](_0x525787));if(_0x525787[_0xa773('0x14')]){if(_0x525787[_0xa773('0x14')]['code']===0x1f4){logger['error'](_0xa773('0xf'),_0x4b909e,_0x525787[_0xa773('0x14')][_0xa773('0x15')]);return _0x27ecef(_0x525787[_0xa773('0x14')][_0xa773('0x15')]);}logger[_0xa773('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4b909e,_0x525787['error']['message']);return _0x3fb2f2(_0x525787[_0xa773('0x14')][_0xa773('0x15')]);}else{logger[_0xa773('0xe')](_0xa773('0xf'),_0x4b909e,_0xa773('0x12'));_0x3fb2f2(_0x525787[_0xa773('0x16')][_0xa773('0x15')]);}})[_0xa773('0x17')](function(_0x31dda4){logger[_0xa773('0x14')](_0xa773('0xf'),_0x4b909e,_0x31dda4);_0x27ecef(_0x31dda4);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 391d62a..bc14bae 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 _0xee58=['get','show','post','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated'];(function(_0x403ac7,_0x3b4cc1){var _0x399175=function(_0x3e7c9f){while(--_0x3e7c9f){_0x403ac7['push'](_0x403ac7['shift']());}};_0x399175(++_0x3b4cc1);}(_0xee58,0x188));var _0x8ee5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xee58[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x8ee5('0x0'));var util=require(_0x8ee5('0x1'));var path=require(_0x8ee5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ee5('0x3')]();var auth=require(_0x8ee5('0x4'));var interaction=require(_0x8ee5('0x5'));var config=require('../../config/environment');var controller=require(_0x8ee5('0x6'));router['get']('/',auth[_0x8ee5('0x7')](),controller['index']);router[_0x8ee5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8ee5('0x9')]);router[_0x8ee5('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ee5('0xb')]);router[_0x8ee5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8ee5('0xd')]);router['delete']('/:id',auth[_0x8ee5('0x7')](),controller[_0x8ee5('0xe')]);module[_0x8ee5('0xf')]=router; \ No newline at end of file +var _0x1d45=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x1d45,0x71));var _0x51d4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1d45[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x51d4('0x0'));var util=require(_0x51d4('0x1'));var path=require(_0x51d4('0x2'));var timeout=require('connect-timeout');var express=require(_0x51d4('0x3'));var router=express[_0x51d4('0x4')]();var auth=require(_0x51d4('0x5'));var interaction=require(_0x51d4('0x6'));var config=require(_0x51d4('0x7'));var controller=require(_0x51d4('0x8'));router[_0x51d4('0x9')]('/',auth[_0x51d4('0xa')](),controller[_0x51d4('0xb')]);router['get'](_0x51d4('0xc'),auth[_0x51d4('0xa')](),controller[_0x51d4('0xd')]);router['post']('/',auth[_0x51d4('0xa')](),controller[_0x51d4('0xe')]);router[_0x51d4('0xf')](_0x51d4('0xc'),auth[_0x51d4('0xa')](),controller[_0x51d4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x51d4('0x11')]);module[_0x51d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3b4d8f8..28de885 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x1359de,_0x223d63){var _0x4fcc34=function(_0x5e0648){while(--_0x5e0648){_0x1359de['push'](_0x1359de['shift']());}};_0x4fcc34(++_0x223d63);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x26bd04,_0x24e880){var _0x48b6e4=function(_0x5b114d){while(--_0x5b114d){_0x26bd04['push'](_0x26bd04['shift']());}};_0x48b6e4(++_0x24e880);}(_0xe14b,0x93));var _0xbe14=function(_0x49437c,_0xd2783e){_0x49437c=_0x49437c-0x0;var _0x33140e=_0xe14b[_0x49437c];return _0x33140e;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index eb99ca4..c5b7ea2 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 _0x9567=['utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','index','VoiceContext','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','join','root','server/files/templates/context.ejs'];(function(_0x39633,_0x4b7b04){var _0x21f159=function(_0x19aa2a){while(--_0x19aa2a){_0x39633['push'](_0x39633['shift']());}};_0x21f159(++_0x4b7b04);}(_0x9567,0xdc));var _0x7956=function(_0x14b431,_0x380574){_0x14b431=_0x14b431-0x0;var _0x1da77e=_0x9567[_0x14b431];return _0x1da77e;};'use strict';var pdf=require(_0x7956('0x0'));var emlformat=require(_0x7956('0x1'));var rimraf=require(_0x7956('0x2'));var zipdir=require(_0x7956('0x3'));var jsonpatch=require(_0x7956('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7956('0x5'));var Mustache=require(_0x7956('0x6'));var util=require('util');var path=require(_0x7956('0x7'));var sox=require('sox');var csv=require(_0x7956('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7956('0x9'));var squel=require(_0x7956('0xa'));var crypto=require('crypto');var jsforce=require(_0x7956('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7956('0x8'));var querystring=require(_0x7956('0xc'));var Papa=require('papaparse');var Redis=require(_0x7956('0xd'));var authService=require(_0x7956('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7956('0xf'));var hardwareService=require(_0x7956('0x10'));var logger=require(_0x7956('0x11'))('api');var utils=require(_0x7956('0x12'));var config=require(_0x7956('0x13'));var licenseUtil=require(_0x7956('0x14'));var db=require(_0x7956('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7956('0x16')][_0x7956('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1368b2,_0x5dafc5,_0x14af6f,_0x43c7f6){return new BPromise(function(_0x248b79,_0x3a408a){var _0x1af337=_0x43c7f6||client;return _0x1af337[_0x7956('0x18')](_0x1368b2,_0x14af6f)[_0x7956('0x19')](function(_0x436573){logger[_0x7956('0x1a')](_0x7956('0x1b'),_0x5dafc5,_0x7956('0x1c'));logger[_0x7956('0x1d')](_0x7956('0x1e'),_0x5dafc5,_0x7956('0x1c'),JSON[_0x7956('0x1f')](_0x436573));if(_0x436573[_0x7956('0x20')]){if(_0x436573['error']['code']===0x1f4){logger[_0x7956('0x20')](_0x7956('0x1b'),_0x5dafc5,_0x436573['error'][_0x7956('0x21')]);return _0x3a408a(_0x436573['error'][_0x7956('0x21')]);}logger[_0x7956('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5dafc5,_0x436573[_0x7956('0x20')][_0x7956('0x21')]);return _0x248b79(_0x436573[_0x7956('0x20')]['message']);}else{logger[_0x7956('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x5dafc5,_0x7956('0x1c'));_0x248b79(_0x436573['result'][_0x7956('0x21')]);}})[_0x7956('0x22')](function(_0x1cbc0f){logger[_0x7956('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5dafc5,_0x1cbc0f);_0x3a408a(_0x1cbc0f);});});}function respondWithStatusCode(_0x19c033,_0x3f13b7){_0x3f13b7=_0x3f13b7||0xcc;return function(_0x432a2d){if(_0x432a2d){return _0x19c033['sendStatus'](_0x3f13b7);}return _0x19c033['status'](_0x3f13b7)[_0x7956('0x23')]();};}function respondWithResult(_0x24806f,_0x40d2d6){_0x40d2d6=_0x40d2d6||0xc8;return function(_0x1c407a){if(_0x1c407a){return _0x24806f[_0x7956('0x24')](_0x40d2d6)['json'](_0x1c407a);}};}function respondWithFilteredResult(_0x34c17f,_0x11eb8b){return function(_0xe39d1d){if(_0xe39d1d){var _0xf098fb=_0xe39d1d[_0x7956('0x25')],_0x16d978=_0x11eb8b[_0x7956('0x26')],_0x30392c=_0x11eb8b[_0x7956('0x26')]+_0x11eb8b[_0x7956('0x27')],_0x4821d7;if(_0x30392c>=_0xf098fb){_0x30392c=_0xf098fb;_0x4821d7=0xc8;}else{_0x4821d7=0xce;}_0x34c17f[_0x7956('0x24')](_0x4821d7);return _0x34c17f[_0x7956('0x28')](_0x7956('0x29'),_0x16d978+'-'+_0x30392c+'/'+_0xf098fb)[_0x7956('0x2a')](_0xe39d1d);}return null;};}function patchUpdates(_0x2f248d){return function(_0x401770){try{jsonpatch[_0x7956('0x2b')](_0x401770,_0x2f248d,!![]);}catch(_0xe64c4f){return BPromise[_0x7956('0x2c')](_0xe64c4f);}return _0x401770[_0x7956('0x2d')]();};}function saveUpdates(_0x3de2b5,_0x378e31){return function(_0x305e30){if(_0x305e30){return _0x305e30[_0x7956('0x2e')](_0x3de2b5)[_0x7956('0x19')](function(_0x134d24){return _0x134d24;});}return null;};}function removeEntity(_0x5bb0f1,_0x1edb4c){return function(_0x4781ec){if(_0x4781ec){return _0x4781ec[_0x7956('0x2f')]()[_0x7956('0x19')](function(){var _0x3e5e14=_0x4781ec[_0x7956('0x30')]({'plain':!![]});var _0x48c6da=_0x7956('0x31');return db[_0x7956('0x32')]['destroy']({'where':{'type':_0x48c6da,'resourceId':_0x3e5e14['id']}})[_0x7956('0x19')](function(){return _0x4781ec;});})[_0x7956('0x19')](function(){_0x5bb0f1[_0x7956('0x24')](0xcc)[_0x7956('0x23')]();});}};}function handleEntityNotFound(_0x11934f,_0x302d38){return function(_0x22c3fe){if(!_0x22c3fe){_0x11934f[_0x7956('0x33')](0x194);}return _0x22c3fe;};}function handleError(_0x5fb356,_0x25024d){_0x25024d=_0x25024d||0x1f4;return function(_0x3efd53){logger[_0x7956('0x20')](_0x3efd53[_0x7956('0x34')]);if(_0x3efd53[_0x7956('0x35')]){delete _0x3efd53[_0x7956('0x35')];}_0x5fb356[_0x7956('0x24')](_0x25024d)['send'](_0x3efd53);};}exports[_0x7956('0x36')]=function(_0x27f9ae,_0x57b5d1){var _0x3a758b={},_0x4fd2a9={},_0x56f18a={'count':0x0,'rows':[]};var _0x4d7dcd=_['map'](db[_0x7956('0x37')]['rawAttributes'],function(_0x1fc3aa){return{'name':_0x1fc3aa[_0x7956('0x38')],'type':_0x1fc3aa[_0x7956('0x39')][_0x7956('0x3a')]};});_0x4fd2a9[_0x7956('0x3b')]=_[_0x7956('0x3c')](_0x4d7dcd,_0x7956('0x35'));_0x4fd2a9[_0x7956('0x3d')]=_[_0x7956('0x3e')](_0x27f9ae['query']);_0x4fd2a9[_0x7956('0x3f')]=_['intersection'](_0x4fd2a9[_0x7956('0x3b')],_0x4fd2a9[_0x7956('0x3d')]);_0x3a758b[_0x7956('0x40')]=_[_0x7956('0x41')](_0x4fd2a9['model'],qs[_0x7956('0x42')](_0x27f9ae[_0x7956('0x3d')]['fields']));_0x3a758b['attributes']=_0x3a758b[_0x7956('0x40')]['length']?_0x3a758b[_0x7956('0x40')]:_0x4fd2a9[_0x7956('0x3b')];if(!_0x27f9ae[_0x7956('0x3d')]['hasOwnProperty'](_0x7956('0x43'))){_0x3a758b[_0x7956('0x27')]=qs['limit'](_0x27f9ae[_0x7956('0x3d')]['limit']);_0x3a758b[_0x7956('0x26')]=qs[_0x7956('0x26')](_0x27f9ae[_0x7956('0x3d')][_0x7956('0x26')]);}_0x3a758b[_0x7956('0x44')]=qs['sort'](_0x27f9ae['query'][_0x7956('0x45')]);_0x3a758b[_0x7956('0x46')]=qs[_0x7956('0x3f')](_[_0x7956('0x47')](_0x27f9ae[_0x7956('0x3d')],_0x4fd2a9[_0x7956('0x3f')]),_0x4d7dcd);if(_0x27f9ae['query'][_0x7956('0x48')]){_0x3a758b[_0x7956('0x46')]=_[_0x7956('0x49')](_0x3a758b[_0x7956('0x46')],{'$or':_[_0x7956('0x3c')](_0x4d7dcd,function(_0x164746){if(_0x164746[_0x7956('0x39')]!==_0x7956('0x4a')){var _0x1d64f2={};_0x1d64f2[_0x164746[_0x7956('0x35')]]={'$like':'%'+_0x27f9ae[_0x7956('0x3d')][_0x7956('0x48')]+'%'};return _0x1d64f2;}})});}_0x3a758b=_[_0x7956('0x49')]({},_0x3a758b,_0x27f9ae[_0x7956('0x4b')]);var _0x2d2c5e={'where':_0x3a758b['where']};return db[_0x7956('0x37')]['count'](_0x2d2c5e)['then'](function(_0x45209c){_0x56f18a[_0x7956('0x25')]=_0x45209c;if(_0x27f9ae[_0x7956('0x3d')][_0x7956('0x4c')]){_0x3a758b[_0x7956('0x4d')]=[{'all':!![]}];}return db[_0x7956('0x37')][_0x7956('0x4e')](_0x3a758b);})[_0x7956('0x19')](function(_0x118c87){_0x56f18a[_0x7956('0x4f')]=_0x118c87;return _0x56f18a;})[_0x7956('0x19')](respondWithFilteredResult(_0x57b5d1,_0x3a758b))[_0x7956('0x22')](handleError(_0x57b5d1,null));};exports[_0x7956('0x50')]=function(_0x2ba635,_0x3158aa){var _0x246cbf={'raw':![],'where':{'id':_0x2ba635[_0x7956('0x51')]['id']}},_0x1c2ecb={};_0x1c2ecb[_0x7956('0x3b')]=_[_0x7956('0x3e')](db[_0x7956('0x37')][_0x7956('0x52')]);_0x1c2ecb['query']=_[_0x7956('0x3e')](_0x2ba635[_0x7956('0x3d')]);_0x1c2ecb[_0x7956('0x3f')]=_['intersection'](_0x1c2ecb[_0x7956('0x3b')],_0x1c2ecb['query']);_0x246cbf[_0x7956('0x40')]=_[_0x7956('0x41')](_0x1c2ecb['model'],qs[_0x7956('0x42')](_0x2ba635[_0x7956('0x3d')]['fields']));_0x246cbf[_0x7956('0x40')]=_0x246cbf[_0x7956('0x40')]['length']?_0x246cbf[_0x7956('0x40')]:_0x1c2ecb[_0x7956('0x3b')];if(_0x2ba635[_0x7956('0x3d')][_0x7956('0x4c')]){_0x246cbf[_0x7956('0x4d')]=[{'all':!![]}];}_0x246cbf=_[_0x7956('0x49')]({},_0x246cbf,_0x2ba635[_0x7956('0x4b')]);return db['VoiceContext'][_0x7956('0x53')](_0x246cbf)[_0x7956('0x19')](handleEntityNotFound(_0x3158aa,null))[_0x7956('0x19')](respondWithResult(_0x3158aa,null))[_0x7956('0x22')](handleError(_0x3158aa,null));};exports['create']=function(_0x19789c,_0x4127bf,_0x369db1){var _0x1a601a;return db[_0x7956('0x37')][_0x7956('0x54')](_0x19789c[_0x7956('0x55')],{'raw':!![]})[_0x7956('0x19')](function(_0x3d7a33){_0x1a601a=_0x3d7a33;return db[_0x7956('0x37')][_0x7956('0x4e')]({'raw':!![]});})[_0x7956('0x19')](function(_0x11424e){var _0x121c79=fs['readFileSync'](path[_0x7956('0x56')](config[_0x7956('0x57')],_0x7956('0x58')),_0x7956('0x59'));var _0x483606=ejs[_0x7956('0x5a')](_0x121c79,{'contexts':_0x11424e||[]});fs[_0x7956('0x5b')](_0x7956('0x5c'),_0x483606);})[_0x7956('0x19')](function(){return respondWithRpcPromise(_0x7956('0x5d'),_0x7956('0x54'),{'module':_0x7956('0x5e')});})['then'](function(){var _0x551501=_0x19789c[_0x7956('0x5f')]['get']({'plain':!![]});if(!_0x551501)throw new Error(_0x7956('0x60'));if(_0x551501[_0x7956('0x61')]===_0x7956('0x5f')){var _0x2ec45f=_0x1a601a[_0x7956('0x30')]({'plain':!![]});return db[_0x7956('0x62')][_0x7956('0x53')]({'where':{'name':_0x7956('0x31'),'userProfileId':_0x551501[_0x7956('0x63')]},'raw':!![]})['then'](function(_0x29cc1f){if(_0x29cc1f&&_0x29cc1f[_0x7956('0x64')]===0x0){return db[_0x7956('0x32')]['create']({'name':_0x2ec45f[_0x7956('0x35')],'resourceId':_0x2ec45f['id'],'type':_0x29cc1f[_0x7956('0x35')],'sectionId':_0x29cc1f['id']},{})['then'](function(){return _0x1a601a;});}else{return _0x1a601a;}})[_0x7956('0x22')](function(_0x512088){logger[_0x7956('0x20')](_0x7956('0x65'),_0x512088);throw _0x512088;});}return _0x1a601a;})[_0x7956('0x19')](respondWithResult(_0x4127bf,0xc9))[_0x7956('0x22')](handleError(_0x4127bf,null));};exports['update']=function(_0x12d708,_0x1edd5b,_0x377c26){var _0x5e4565;return db[_0x7956('0x37')][_0x7956('0x53')]({'where':{'id':_0x12d708[_0x7956('0x51')]['id']}})[_0x7956('0x19')](handleEntityNotFound(_0x1edd5b,null))[_0x7956('0x19')](saveUpdates(_0x12d708[_0x7956('0x55')],null))['then'](function(_0x4fa4dd){if(_0x4fa4dd){_0x5e4565=_0x4fa4dd;return db[_0x7956('0x37')]['findAll']({'raw':!![]});}})[_0x7956('0x19')](function(_0x5f555d){var _0x28a06a=fs[_0x7956('0x66')](path[_0x7956('0x56')](config['root'],'server/files/templates/context.ejs'),_0x7956('0x59'));var _0x40cbad=ejs[_0x7956('0x5a')](_0x28a06a,{'contexts':_0x5f555d||[]});fs[_0x7956('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x40cbad);})[_0x7956('0x19')](function(){return respondWithRpcPromise(_0x7956('0x5d'),_0x7956('0x2e'),{'module':_0x7956('0x5e')});})[_0x7956('0x19')](function(){return _0x5e4565;})[_0x7956('0x19')](respondWithResult(_0x1edd5b,null))[_0x7956('0x22')](handleError(_0x1edd5b,null));};exports['destroy']=function(_0x42e6b8,_0x7a5d6a,_0x259e30){var _0x2d8dc4;return db[_0x7956('0x37')][_0x7956('0x53')]({'where':{'id':_0x42e6b8['params']['id']}})[_0x7956('0x19')](handleEntityNotFound(_0x7a5d6a,null))[_0x7956('0x19')](removeEntity(_0x7a5d6a,null))[_0x7956('0x19')](function(){return db[_0x7956('0x37')][_0x7956('0x4e')]({'raw':!![]});})[_0x7956('0x19')](function(_0xbfd1bc){var _0x303a03=fs[_0x7956('0x66')](path[_0x7956('0x56')](config[_0x7956('0x57')],_0x7956('0x58')),'utf8');var _0x46132a=ejs[_0x7956('0x5a')](_0x303a03,{'contexts':_0xbfd1bc});fs[_0x7956('0x5b')](_0x7956('0x5c'),_0x46132a);return respondWithRpcPromise(_0x7956('0x5d'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x7a5d6a,null));}; \ No newline at end of file +var _0x3fec=['root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','params','html-pdf','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','length','find','create','body','readFileSync'];(function(_0x2c463f,_0x2383c8){var _0x2988d4=function(_0xcbde3f){while(--_0xcbde3f){_0x2c463f['push'](_0x2c463f['shift']());}};_0x2988d4(++_0x2383c8);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xc3fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fe('0x1'));var jsonpatch=require(_0xc3fe('0x2'));var rp=require('request-promise');var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3fe('0x4'));var path=require('path');var sox=require(_0xc3fe('0x5'));var csv=require(_0xc3fe('0x6'));var ejs=require(_0xc3fe('0x7'));var fs=require('fs');var _=require(_0xc3fe('0x8'));var squel=require(_0xc3fe('0x9'));var crypto=require(_0xc3fe('0xa'));var jsforce=require(_0xc3fe('0xb'));var deskjs=require(_0xc3fe('0xc'));var toCsv=require(_0xc3fe('0x6'));var querystring=require(_0xc3fe('0xd'));var Papa=require(_0xc3fe('0xe'));var Redis=require(_0xc3fe('0xf'));var authService=require(_0xc3fe('0x10'));var qs=require(_0xc3fe('0x11'));var as=require(_0xc3fe('0x12'));var hardwareService=require(_0xc3fe('0x13'));var logger=require('../../config/logger')(_0xc3fe('0x14'));var utils=require(_0xc3fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc3fe('0x16'));var db=require(_0xc3fe('0x17'))['db'];var jayson=require(_0xc3fe('0x18'));var client=jayson[_0xc3fe('0x19')][_0xc3fe('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1b560f,_0x1ac4d7,_0x7d5e67,_0xb6a471){return new BPromise(function(_0x432539,_0x4b8088){var _0x400476=_0xb6a471||client;return _0x400476['request'](_0x1b560f,_0x7d5e67)[_0xc3fe('0x1b')](function(_0x18e5ed){logger[_0xc3fe('0x1c')](_0xc3fe('0x1d'),_0x1ac4d7,_0xc3fe('0x1e'));logger[_0xc3fe('0x1f')](_0xc3fe('0x20'),_0x1ac4d7,_0xc3fe('0x1e'),JSON[_0xc3fe('0x21')](_0x18e5ed));if(_0x18e5ed[_0xc3fe('0x22')]){if(_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x23')]===0x1f4){logger[_0xc3fe('0x22')](_0xc3fe('0x1d'),_0x1ac4d7,_0x18e5ed[_0xc3fe('0x22')]['message']);return _0x4b8088(_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x24')]);}logger[_0xc3fe('0x22')]('VoiceContext,\x20%s,\x20%s',_0x1ac4d7,_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x24')]);return _0x432539(_0x18e5ed['error']['message']);}else{logger[_0xc3fe('0x1c')](_0xc3fe('0x1d'),_0x1ac4d7,_0xc3fe('0x1e'));_0x432539(_0x18e5ed['result'][_0xc3fe('0x24')]);}})[_0xc3fe('0x25')](function(_0x3f9418){logger[_0xc3fe('0x22')](_0xc3fe('0x1d'),_0x1ac4d7,_0x3f9418);_0x4b8088(_0x3f9418);});});}function respondWithStatusCode(_0x474195,_0x1dcfec){_0x1dcfec=_0x1dcfec||0xcc;return function(_0x6b57a6){if(_0x6b57a6){return _0x474195[_0xc3fe('0x26')](_0x1dcfec);}return _0x474195[_0xc3fe('0x27')](_0x1dcfec)[_0xc3fe('0x28')]();};}function respondWithResult(_0x2999e7,_0x4da635){_0x4da635=_0x4da635||0xc8;return function(_0x3220e7){if(_0x3220e7){return _0x2999e7[_0xc3fe('0x27')](_0x4da635)[_0xc3fe('0x29')](_0x3220e7);}};}function respondWithFilteredResult(_0x3e8075,_0x416149){return function(_0x5672b9){if(_0x5672b9){var _0xcadfae=_0x5672b9[_0xc3fe('0x2a')],_0x431594=_0x416149[_0xc3fe('0x2b')],_0x2bfaa0=_0x416149[_0xc3fe('0x2b')]+_0x416149[_0xc3fe('0x2c')],_0x1593b0;if(_0x2bfaa0>=_0xcadfae){_0x2bfaa0=_0xcadfae;_0x1593b0=0xc8;}else{_0x1593b0=0xce;}_0x3e8075[_0xc3fe('0x27')](_0x1593b0);return _0x3e8075[_0xc3fe('0x2d')](_0xc3fe('0x2e'),_0x431594+'-'+_0x2bfaa0+'/'+_0xcadfae)[_0xc3fe('0x29')](_0x5672b9);}return null;};}function patchUpdates(_0x18dbc0){return function(_0x499b99){try{jsonpatch[_0xc3fe('0x2f')](_0x499b99,_0x18dbc0,!![]);}catch(_0x1339e7){return BPromise[_0xc3fe('0x30')](_0x1339e7);}return _0x499b99[_0xc3fe('0x31')]();};}function saveUpdates(_0x5ac845,_0x1e8a38){return function(_0x19d353){if(_0x19d353){return _0x19d353[_0xc3fe('0x32')](_0x5ac845)[_0xc3fe('0x1b')](function(_0x11a44e){return _0x11a44e;});}return null;};}function removeEntity(_0x293999,_0x3f4573){return function(_0x28fc3b){if(_0x28fc3b){return _0x28fc3b[_0xc3fe('0x33')]()[_0xc3fe('0x1b')](function(){var _0x7b42b9=_0x28fc3b['get']({'plain':!![]});var _0x5b6151='Contexts';return db[_0xc3fe('0x34')][_0xc3fe('0x33')]({'where':{'type':_0x5b6151,'resourceId':_0x7b42b9['id']}})['then'](function(){return _0x28fc3b;});})[_0xc3fe('0x1b')](function(){_0x293999[_0xc3fe('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b76ae,_0x38c948){return function(_0x237680){if(!_0x237680){_0x5b76ae[_0xc3fe('0x26')](0x194);}return _0x237680;};}function handleError(_0x2aa7b8,_0x5716b0){_0x5716b0=_0x5716b0||0x1f4;return function(_0x53dca7){logger[_0xc3fe('0x22')](_0x53dca7[_0xc3fe('0x35')]);if(_0x53dca7[_0xc3fe('0x36')]){delete _0x53dca7[_0xc3fe('0x36')];}_0x2aa7b8['status'](_0x5716b0)[_0xc3fe('0x37')](_0x53dca7);};}exports['index']=function(_0x1b0090,_0x4e694d){var _0x7fc7fb={},_0x201d72={},_0x51776c={'count':0x0,'rows':[]};var _0x40fdfc=_[_0xc3fe('0x38')](db['VoiceContext'][_0xc3fe('0x39')],function(_0x5bdc6d){return{'name':_0x5bdc6d[_0xc3fe('0x3a')],'type':_0x5bdc6d[_0xc3fe('0x3b')][_0xc3fe('0x3c')]};});_0x201d72[_0xc3fe('0x3d')]=_[_0xc3fe('0x38')](_0x40fdfc,'name');_0x201d72[_0xc3fe('0x3e')]=_[_0xc3fe('0x3f')](_0x1b0090[_0xc3fe('0x3e')]);_0x201d72[_0xc3fe('0x40')]=_[_0xc3fe('0x41')](_0x201d72[_0xc3fe('0x3d')],_0x201d72[_0xc3fe('0x3e')]);_0x7fc7fb['attributes']=_[_0xc3fe('0x41')](_0x201d72[_0xc3fe('0x3d')],qs[_0xc3fe('0x42')](_0x1b0090[_0xc3fe('0x3e')][_0xc3fe('0x42')]));_0x7fc7fb[_0xc3fe('0x43')]=_0x7fc7fb[_0xc3fe('0x43')]['length']?_0x7fc7fb['attributes']:_0x201d72[_0xc3fe('0x3d')];if(!_0x1b0090['query']['hasOwnProperty'](_0xc3fe('0x44'))){_0x7fc7fb[_0xc3fe('0x2c')]=qs[_0xc3fe('0x2c')](_0x1b0090[_0xc3fe('0x3e')]['limit']);_0x7fc7fb[_0xc3fe('0x2b')]=qs[_0xc3fe('0x2b')](_0x1b0090[_0xc3fe('0x3e')]['offset']);}_0x7fc7fb[_0xc3fe('0x45')]=qs[_0xc3fe('0x46')](_0x1b0090[_0xc3fe('0x3e')]['sort']);_0x7fc7fb['where']=qs['filters'](_[_0xc3fe('0x47')](_0x1b0090[_0xc3fe('0x3e')],_0x201d72[_0xc3fe('0x40')]),_0x40fdfc);if(_0x1b0090[_0xc3fe('0x3e')][_0xc3fe('0x48')]){_0x7fc7fb[_0xc3fe('0x49')]=_[_0xc3fe('0x4a')](_0x7fc7fb['where'],{'$or':_[_0xc3fe('0x38')](_0x40fdfc,function(_0x3b9569){if(_0x3b9569[_0xc3fe('0x3b')]!==_0xc3fe('0x4b')){var _0x367140={};_0x367140[_0x3b9569[_0xc3fe('0x36')]]={'$like':'%'+_0x1b0090['query'][_0xc3fe('0x48')]+'%'};return _0x367140;}})});}_0x7fc7fb=_[_0xc3fe('0x4a')]({},_0x7fc7fb,_0x1b0090[_0xc3fe('0x4c')]);var _0x3ab38c={'where':_0x7fc7fb[_0xc3fe('0x49')]};return db[_0xc3fe('0x4d')][_0xc3fe('0x2a')](_0x3ab38c)[_0xc3fe('0x1b')](function(_0x4328b0){_0x51776c[_0xc3fe('0x2a')]=_0x4328b0;if(_0x1b0090['query'][_0xc3fe('0x4e')]){_0x7fc7fb[_0xc3fe('0x4f')]=[{'all':!![]}];}return db[_0xc3fe('0x4d')][_0xc3fe('0x50')](_0x7fc7fb);})[_0xc3fe('0x1b')](function(_0xb8edd7){_0x51776c[_0xc3fe('0x51')]=_0xb8edd7;return _0x51776c;})[_0xc3fe('0x1b')](respondWithFilteredResult(_0x4e694d,_0x7fc7fb))[_0xc3fe('0x25')](handleError(_0x4e694d,null));};exports[_0xc3fe('0x52')]=function(_0x24c37c,_0x378c16){var _0xccbee9={'raw':![],'where':{'id':_0x24c37c['params']['id']}},_0x91221e={};_0x91221e[_0xc3fe('0x3d')]=_[_0xc3fe('0x3f')](db[_0xc3fe('0x4d')]['rawAttributes']);_0x91221e[_0xc3fe('0x3e')]=_[_0xc3fe('0x3f')](_0x24c37c[_0xc3fe('0x3e')]);_0x91221e[_0xc3fe('0x40')]=_[_0xc3fe('0x41')](_0x91221e['model'],_0x91221e['query']);_0xccbee9[_0xc3fe('0x43')]=_[_0xc3fe('0x41')](_0x91221e['model'],qs[_0xc3fe('0x42')](_0x24c37c[_0xc3fe('0x3e')]['fields']));_0xccbee9[_0xc3fe('0x43')]=_0xccbee9[_0xc3fe('0x43')][_0xc3fe('0x53')]?_0xccbee9[_0xc3fe('0x43')]:_0x91221e['model'];if(_0x24c37c['query'][_0xc3fe('0x4e')]){_0xccbee9[_0xc3fe('0x4f')]=[{'all':!![]}];}_0xccbee9=_[_0xc3fe('0x4a')]({},_0xccbee9,_0x24c37c['options']);return db[_0xc3fe('0x4d')][_0xc3fe('0x54')](_0xccbee9)[_0xc3fe('0x1b')](handleEntityNotFound(_0x378c16,null))['then'](respondWithResult(_0x378c16,null))[_0xc3fe('0x25')](handleError(_0x378c16,null));};exports[_0xc3fe('0x55')]=function(_0x5caf49,_0x228482,_0x39beab){var _0x89a042;return db[_0xc3fe('0x4d')][_0xc3fe('0x55')](_0x5caf49[_0xc3fe('0x56')],{'raw':!![]})[_0xc3fe('0x1b')](function(_0x2f3568){_0x89a042=_0x2f3568;return db[_0xc3fe('0x4d')]['findAll']({'raw':!![]});})[_0xc3fe('0x1b')](function(_0x5d1b6d){var _0x3d6045=fs[_0xc3fe('0x57')](path['join'](config[_0xc3fe('0x58')],_0xc3fe('0x59')),_0xc3fe('0x5a'));var _0x527027=ejs[_0xc3fe('0x5b')](_0x3d6045,{'contexts':_0x5d1b6d||[]});fs[_0xc3fe('0x5c')](_0xc3fe('0x5d'),_0x527027);})['then'](function(){return respondWithRpcPromise(_0xc3fe('0x5e'),_0xc3fe('0x55'),{'module':_0xc3fe('0x5f')});})[_0xc3fe('0x1b')](function(){var _0x17fc18=_0x5caf49[_0xc3fe('0x60')][_0xc3fe('0x61')]({'plain':!![]});if(!_0x17fc18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17fc18[_0xc3fe('0x62')]===_0xc3fe('0x60')){var _0x1ab9c8=_0x89a042[_0xc3fe('0x61')]({'plain':!![]});return db[_0xc3fe('0x63')][_0xc3fe('0x54')]({'where':{'name':_0xc3fe('0x64'),'userProfileId':_0x17fc18[_0xc3fe('0x65')]},'raw':!![]})[_0xc3fe('0x1b')](function(_0x3a64c6){if(_0x3a64c6&&_0x3a64c6[_0xc3fe('0x66')]===0x0){return db['UserProfileResource'][_0xc3fe('0x55')]({'name':_0x1ab9c8[_0xc3fe('0x36')],'resourceId':_0x1ab9c8['id'],'type':_0x3a64c6['name'],'sectionId':_0x3a64c6['id']},{})[_0xc3fe('0x1b')](function(){return _0x89a042;});}else{return _0x89a042;}})['catch'](function(_0xf42f67){logger[_0xc3fe('0x22')](_0xc3fe('0x67'),_0xf42f67);throw _0xf42f67;});}return _0x89a042;})[_0xc3fe('0x1b')](respondWithResult(_0x228482,0xc9))[_0xc3fe('0x25')](handleError(_0x228482,null));};exports['update']=function(_0x304dcc,_0x519596,_0x12a9ce){var _0x5e6d75;return db[_0xc3fe('0x4d')][_0xc3fe('0x54')]({'where':{'id':_0x304dcc['params']['id']}})[_0xc3fe('0x1b')](handleEntityNotFound(_0x519596,null))[_0xc3fe('0x1b')](saveUpdates(_0x304dcc[_0xc3fe('0x56')],null))[_0xc3fe('0x1b')](function(_0x3b2d01){if(_0x3b2d01){_0x5e6d75=_0x3b2d01;return db[_0xc3fe('0x4d')][_0xc3fe('0x50')]({'raw':!![]});}})[_0xc3fe('0x1b')](function(_0x5beeec){var _0x77b85b=fs[_0xc3fe('0x57')](path[_0xc3fe('0x68')](config[_0xc3fe('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x85224c=ejs[_0xc3fe('0x5b')](_0x77b85b,{'contexts':_0x5beeec||[]});fs[_0xc3fe('0x5c')](_0xc3fe('0x5d'),_0x85224c);})[_0xc3fe('0x1b')](function(){return respondWithRpcPromise(_0xc3fe('0x5e'),_0xc3fe('0x32'),{'module':_0xc3fe('0x5f')});})[_0xc3fe('0x1b')](function(){return _0x5e6d75;})['then'](respondWithResult(_0x519596,null))[_0xc3fe('0x25')](handleError(_0x519596,null));};exports[_0xc3fe('0x33')]=function(_0x1d943d,_0x4fcd43,_0xae8545){var _0x1935f3;return db[_0xc3fe('0x4d')][_0xc3fe('0x54')]({'where':{'id':_0x1d943d[_0xc3fe('0x69')]['id']}})[_0xc3fe('0x1b')](handleEntityNotFound(_0x4fcd43,null))[_0xc3fe('0x1b')](removeEntity(_0x4fcd43,null))[_0xc3fe('0x1b')](function(){return db[_0xc3fe('0x4d')][_0xc3fe('0x50')]({'raw':!![]});})[_0xc3fe('0x1b')](function(_0x432e09){var _0x3844e4=fs[_0xc3fe('0x57')](path['join'](config['root'],_0xc3fe('0x59')),'utf8');var _0x402b0b=ejs[_0xc3fe('0x5b')](_0x3844e4,{'contexts':_0x432e09});fs['writeFileSync'](_0xc3fe('0x5d'),_0x402b0b);return respondWithRpcPromise('Reload',_0xc3fe('0x33'),{'module':'chan_sip.so'});})[_0xc3fe('0x25')](handleError(_0x4fcd43,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e0c45f5..ffebf87 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 _0x3d14=['../../config/logger','api','bluebird','request-promise','path','./voiceContext.attributes','exports','define','VoiceContext','util'];(function(_0x43ed3f,_0x549cf9){var _0x1e59fa=function(_0x3a3f8e){while(--_0x3a3f8e){_0x43ed3f['push'](_0x43ed3f['shift']());}};_0x1e59fa(++_0x549cf9);}(_0x3d14,0x9f));var _0x43d1=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x3d14[_0x65c50e];return _0x4573e7;};'use strict';var _=require('lodash');var util=require(_0x43d1('0x0'));var logger=require(_0x43d1('0x1'))(_0x43d1('0x2'));var moment=require('moment');var BPromise=require(_0x43d1('0x3'));var rp=require(_0x43d1('0x4'));var fs=require('fs');var path=require(_0x43d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43d1('0x6'));module[_0x43d1('0x7')]=function(_0x24bf76,_0x25ea4c){return _0x24bf76[_0x43d1('0x8')](_0x43d1('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eba=['define','VoiceContext','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x37405b,_0x334478){var _0xbbc254=function(_0x94267c){while(--_0x94267c){_0x37405b['push'](_0x37405b['shift']());}};_0xbbc254(++_0x334478);}(_0x2eba,0x92));var _0xa2eb=function(_0x1db35c,_0x5cb245){_0x1db35c=_0x1db35c-0x0;var _0x394952=_0x2eba[_0x1db35c];return _0x394952;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))('api');var moment=require(_0xa2eb('0x2'));var BPromise=require(_0xa2eb('0x3'));var rp=require(_0xa2eb('0x4'));var fs=require('fs');var path=require(_0xa2eb('0x5'));var rimraf=require(_0xa2eb('0x6'));var config=require(_0xa2eb('0x7'));var attributes=require(_0xa2eb('0x8'));module[_0xa2eb('0x9')]=function(_0x52eb88,_0x4eceb6){return _0x52eb88[_0xa2eb('0xa')](_0xa2eb('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 3a722ce..db95675 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 _0xb3ba=['stringify','code','VoiceContext,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug'];(function(_0x4410d3,_0x2a4779){var _0x1bdac8=function(_0x411eba){while(--_0x411eba){_0x4410d3['push'](_0x4410d3['shift']());}};_0x1bdac8(++_0x2a4779);}(_0xb3ba,0xcd));var _0xab3b=function(_0x5edf88,_0x100b39){_0x5edf88=_0x5edf88-0x0;var _0x241223=_0xb3ba[_0x5edf88];return _0x241223;};'use strict';var _=require(_0xab3b('0x0'));var util=require(_0xab3b('0x1'));var moment=require('moment');var BPromise=require(_0xab3b('0x2'));var rs=require(_0xab3b('0x3'));var fs=require('fs');var Redis=require(_0xab3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab3b('0x5'));var logger=require(_0xab3b('0x6'))(_0xab3b('0x7'));var config=require(_0xab3b('0x8'));var jayson=require(_0xab3b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dae00,_0x1e38af,_0x34cf49){return new BPromise(function(_0x709e97,_0x48c761){return client[_0xab3b('0xa')](_0x3dae00,_0x34cf49)[_0xab3b('0xb')](function(_0x3d129c){logger[_0xab3b('0xc')]('VoiceContext,\x20%s,\x20%s',_0x1e38af,_0xab3b('0xd'));logger[_0xab3b('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1e38af,'request\x20sent',JSON[_0xab3b('0xf')](_0x3d129c));if(_0x3d129c['error']){if(_0x3d129c['error'][_0xab3b('0x10')]===0x1f4){logger['error'](_0xab3b('0x11'),_0x1e38af,_0x3d129c[_0xab3b('0x12')][_0xab3b('0x13')]);return _0x48c761(_0x3d129c[_0xab3b('0x12')][_0xab3b('0x13')]);}logger[_0xab3b('0x12')](_0xab3b('0x11'),_0x1e38af,_0x3d129c[_0xab3b('0x12')][_0xab3b('0x13')]);return _0x709e97(_0x3d129c['error'][_0xab3b('0x13')]);}else{logger[_0xab3b('0xc')](_0xab3b('0x11'),_0x1e38af,_0xab3b('0xd'));_0x709e97(_0x3d129c[_0xab3b('0x14')]['message']);}})[_0xab3b('0x15')](function(_0x19903d){logger['error'](_0xab3b('0x11'),_0x1e38af,_0x19903d);_0x48c761(_0x19903d);});});} \ No newline at end of file +var _0xef17=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent'];(function(_0x46dca6,_0x2c3e23){var _0x2cf3f=function(_0xe310f1){while(--_0xe310f1){_0x46dca6['push'](_0x46dca6['shift']());}};_0x2cf3f(++_0x2c3e23);}(_0xef17,0x1be));var _0x7ef1=function(_0x41be0a,_0x23e522){_0x41be0a=_0x41be0a-0x0;var _0x5c78c8=_0xef17[_0x41be0a];return _0x5c78c8;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var moment=require(_0x7ef1('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ef1('0x3'));var fs=require('fs');var Redis=require(_0x7ef1('0x4'));var db=require(_0x7ef1('0x5'))['db'];var utils=require(_0x7ef1('0x6'));var logger=require(_0x7ef1('0x7'))(_0x7ef1('0x8'));var config=require('../../config/environment');var jayson=require(_0x7ef1('0x9'));var client=jayson['client'][_0x7ef1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x109b59,_0x77785b,_0x595954){return new BPromise(function(_0x466d22,_0x2b200e){return client[_0x7ef1('0xb')](_0x109b59,_0x595954)['then'](function(_0x403337){logger[_0x7ef1('0xc')]('VoiceContext,\x20%s,\x20%s',_0x77785b,_0x7ef1('0xd'));logger[_0x7ef1('0xe')](_0x7ef1('0xf'),_0x77785b,'request\x20sent',JSON[_0x7ef1('0x10')](_0x403337));if(_0x403337[_0x7ef1('0x11')]){if(_0x403337[_0x7ef1('0x11')][_0x7ef1('0x12')]===0x1f4){logger[_0x7ef1('0x11')](_0x7ef1('0x13'),_0x77785b,_0x403337['error'][_0x7ef1('0x14')]);return _0x2b200e(_0x403337[_0x7ef1('0x11')][_0x7ef1('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x77785b,_0x403337[_0x7ef1('0x11')][_0x7ef1('0x14')]);return _0x466d22(_0x403337['error'][_0x7ef1('0x14')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x77785b,_0x7ef1('0xd'));_0x466d22(_0x403337[_0x7ef1('0x15')]['message']);}})[_0x7ef1('0x16')](function(_0x5ada1e){logger[_0x7ef1('0x11')]('VoiceContext,\x20%s,\x20%s',_0x77785b,_0x5ada1e);_0x2b200e(_0x5ada1e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index bfcbbc7..fa124dc 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 _0x7399=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x28d38c,_0x5c83cd){var _0x2e0faf=function(_0x260515){while(--_0x260515){_0x28d38c['push'](_0x28d38c['shift']());}};_0x2e0faf(++_0x5c83cd);}(_0x7399,0x1bc));var _0x9739=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x7399[_0x16771d];return _0x386f11;};'use strict';var multer=require(_0x9739('0x0'));var util=require(_0x9739('0x1'));var path=require('path');var timeout=require(_0x9739('0x2'));var express=require(_0x9739('0x3'));var router=express['Router']();var auth=require(_0x9739('0x4'));var interaction=require(_0x9739('0x5'));var config=require('../../config/environment');var controller=require(_0x9739('0x6'));router[_0x9739('0x7')]('/',auth[_0x9739('0x8')](),controller[_0x9739('0x9')]);router[_0x9739('0x7')](_0x9739('0xa'),auth[_0x9739('0x8')](),controller[_0x9739('0xb')]);router[_0x9739('0x7')](_0x9739('0xc'),auth[_0x9739('0x8')](),controller[_0x9739('0xd')]);router[_0x9739('0xe')]('/',auth[_0x9739('0x8')](),controller[_0x9739('0xf')]);router['put'](_0x9739('0xc'),auth[_0x9739('0x8')](),controller[_0x9739('0x10')]);router[_0x9739('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9739('0x12')]);module[_0x9739('0x13')]=router; \ No newline at end of file +var _0x04c2=['express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x04c2,0x1df));var _0x204c=function(_0x4984d5,_0xd1581b){_0x4984d5=_0x4984d5-0x0;var _0x95adb1=_0x04c2[_0x4984d5];return _0x95adb1;};'use strict';var multer=require(_0x204c('0x0'));var util=require(_0x204c('0x1'));var path=require(_0x204c('0x2'));var timeout=require(_0x204c('0x3'));var express=require(_0x204c('0x4'));var router=express[_0x204c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x204c('0x6'));var config=require(_0x204c('0x7'));var controller=require(_0x204c('0x8'));router['get']('/',auth[_0x204c('0x9')](),controller[_0x204c('0xa')]);router[_0x204c('0xb')](_0x204c('0xc'),auth[_0x204c('0x9')](),controller[_0x204c('0xd')]);router[_0x204c('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x204c('0xe')]('/',auth[_0x204c('0x9')](),controller[_0x204c('0xf')]);router[_0x204c('0x10')](_0x204c('0x11'),auth[_0x204c('0x9')](),controller[_0x204c('0x12')]);router['delete'](_0x204c('0x11'),auth[_0x204c('0x9')](),controller[_0x204c('0x13')]);module[_0x204c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3725eca..a4a2572 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 _0x7ff1=['DATE','INTEGER','sequelize','STRING'];(function(_0x519f2a,_0x30a56c){var _0x42f71b=function(_0x1c3ddd){while(--_0x1c3ddd){_0x519f2a['push'](_0x519f2a['shift']());}};_0x42f71b(++_0x30a56c);}(_0x7ff1,0x16a));var _0x17ff=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x7ff1[_0x3bceea];return _0x30a8d3;};'use strict';var Sequelize=require(_0x17ff('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x17ff('0x1')]},'channel':{'type':Sequelize[_0x17ff('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x17ff('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x17ff('0x1')]},'connectedlinenum':{'type':Sequelize[_0x17ff('0x1')]},'connectedlinename':{'type':Sequelize[_0x17ff('0x1')]},'language':{'type':Sequelize[_0x17ff('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x17ff('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x17ff('0x1')]},'linkedid':{'type':Sequelize[_0x17ff('0x1')]},'destchannel':{'type':Sequelize[_0x17ff('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x17ff('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x17ff('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x17ff('0x1')]},'destaccountcode':{'type':Sequelize[_0x17ff('0x1')]},'destcontext':{'type':Sequelize[_0x17ff('0x1')]},'destexten':{'type':Sequelize[_0x17ff('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x17ff('0x1')]},'destlinkedid':{'type':Sequelize[_0x17ff('0x1')]},'dialstring':{'type':Sequelize[_0x17ff('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x17ff('0x2')]},'answertime':{'type':Sequelize[_0x17ff('0x2')]},'endtime':{'type':Sequelize[_0x17ff('0x2')]},'lastevent':{'type':Sequelize[_0x17ff('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x17ff('0x3')]},'duration':{'type':Sequelize[_0x17ff('0x3')]},'holdtime':{'type':Sequelize[_0x17ff('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8abb=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x26bce1,_0xbbe9d5){var _0x38e870=function(_0x5ea043){while(--_0x5ea043){_0x26bce1['push'](_0x26bce1['shift']());}};_0x38e870(++_0xbbe9d5);}(_0x8abb,0xba));var _0xb8ab=function(_0x92a5dd,_0xf64c83){_0x92a5dd=_0x92a5dd-0x0;var _0x1a184f=_0x8abb[_0x92a5dd];return _0x1a184f;};'use strict';var Sequelize=require(_0xb8ab('0x0'));module[_0xb8ab('0x1')]={'privilege':{'type':Sequelize[_0xb8ab('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb8ab('0x2')]},'calleridname':{'type':Sequelize[_0xb8ab('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb8ab('0x2')]},'connectedlinename':{'type':Sequelize[_0xb8ab('0x2')]},'language':{'type':Sequelize[_0xb8ab('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb8ab('0x2')]},'exten':{'type':Sequelize[_0xb8ab('0x2')]},'priority':{'type':Sequelize[_0xb8ab('0x3')]},'uniqueid':{'type':Sequelize[_0xb8ab('0x2')]},'linkedid':{'type':Sequelize[_0xb8ab('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb8ab('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb8ab('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb8ab('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb8ab('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb8ab('0x2')]},'destcontext':{'type':Sequelize[_0xb8ab('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb8ab('0x3')]},'destuniqueid':{'type':Sequelize[_0xb8ab('0x2')]},'destlinkedid':{'type':Sequelize[_0xb8ab('0x2')]},'dialstring':{'type':Sequelize[_0xb8ab('0x2')]},'dialstatus':{'type':Sequelize[_0xb8ab('0x2')]},'starttime':{'type':Sequelize[_0xb8ab('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb8ab('0x4')]},'lastevent':{'type':Sequelize[_0xb8ab('0x2')],'comment':_0xb8ab('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xb8ab('0x3')]},'billableseconds':{'type':Sequelize[_0xb8ab('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e7cd783..6da6f03 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 _0x5022=['destroy','sendStatus','error','stack','name','send','index','VoiceDialReport','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','length','find','create','body','params','describe','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5022,0x10e));var _0x2502=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5022[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0x2502('0x0'));var emlformat=require(_0x2502('0x1'));var rimraf=require(_0x2502('0x2'));var zipdir=require(_0x2502('0x3'));var jsonpatch=require(_0x2502('0x4'));var rp=require(_0x2502('0x5'));var moment=require(_0x2502('0x6'));var BPromise=require(_0x2502('0x7'));var Mustache=require(_0x2502('0x8'));var util=require(_0x2502('0x9'));var path=require('path');var sox=require(_0x2502('0xa'));var csv=require(_0x2502('0xb'));var ejs=require(_0x2502('0xc'));var fs=require('fs');var _=require(_0x2502('0xd'));var squel=require(_0x2502('0xe'));var crypto=require(_0x2502('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2502('0x10'));var toCsv=require(_0x2502('0xb'));var querystring=require('querystring');var Papa=require(_0x2502('0x11'));var Redis=require(_0x2502('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2502('0x13'));var as=require(_0x2502('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2502('0x15'))(_0x2502('0x16'));var utils=require(_0x2502('0x17'));var config=require(_0x2502('0x18'));var licenseUtil=require(_0x2502('0x19'));var db=require(_0x2502('0x1a'))['db'];function respondWithStatusCode(_0xdc348f,_0x574a9f){_0x574a9f=_0x574a9f||0xcc;return function(_0x178331){if(_0x178331){return _0xdc348f['sendStatus'](_0x574a9f);}return _0xdc348f[_0x2502('0x1b')](_0x574a9f)[_0x2502('0x1c')]();};}function respondWithResult(_0xef3a64,_0x5d5196){_0x5d5196=_0x5d5196||0xc8;return function(_0xab1db9){if(_0xab1db9){return _0xef3a64[_0x2502('0x1b')](_0x5d5196)[_0x2502('0x1d')](_0xab1db9);}};}function respondWithFilteredResult(_0x3747a5,_0x1bc8e3){return function(_0x32cc02){if(_0x32cc02){var _0x52308f=_0x32cc02['count'],_0x28fb95=_0x1bc8e3['offset'],_0xd2a3e6=_0x1bc8e3['offset']+_0x1bc8e3[_0x2502('0x1e')],_0x4da2c9;if(_0xd2a3e6>=_0x52308f){_0xd2a3e6=_0x52308f;_0x4da2c9=0xc8;}else{_0x4da2c9=0xce;}_0x3747a5[_0x2502('0x1b')](_0x4da2c9);return _0x3747a5[_0x2502('0x1f')](_0x2502('0x20'),_0x28fb95+'-'+_0xd2a3e6+'/'+_0x52308f)[_0x2502('0x1d')](_0x32cc02);}return null;};}function patchUpdates(_0x5f5100){return function(_0x16765c){try{jsonpatch[_0x2502('0x21')](_0x16765c,_0x5f5100,!![]);}catch(_0x3436c4){return BPromise[_0x2502('0x22')](_0x3436c4);}return _0x16765c[_0x2502('0x23')]();};}function saveUpdates(_0xa37586,_0x10c072){return function(_0x31052f){if(_0x31052f){return _0x31052f[_0x2502('0x24')](_0xa37586)[_0x2502('0x25')](function(_0x536232){return _0x536232;});}return null;};}function removeEntity(_0x4ea4a9,_0x43c044){return function(_0x4ab753){if(_0x4ab753){return _0x4ab753[_0x2502('0x26')]()[_0x2502('0x25')](function(){_0x4ea4a9[_0x2502('0x1b')](0xcc)[_0x2502('0x1c')]();});}};}function handleEntityNotFound(_0x26132a,_0x500a66){return function(_0x314539){if(!_0x314539){_0x26132a[_0x2502('0x27')](0x194);}return _0x314539;};}function handleError(_0x1ba039,_0x583804){_0x583804=_0x583804||0x1f4;return function(_0x255217){logger[_0x2502('0x28')](_0x255217[_0x2502('0x29')]);if(_0x255217[_0x2502('0x2a')]){delete _0x255217['name'];}_0x1ba039[_0x2502('0x1b')](_0x583804)[_0x2502('0x2b')](_0x255217);};}exports[_0x2502('0x2c')]=function(_0x5c44c9,_0x176245){var _0x39c1d8={},_0x511ae6={},_0x46abed={'count':0x0,'rows':[]};var _0x49b21d=_['map'](db[_0x2502('0x2d')]['rawAttributes'],function(_0x2490d3){return{'name':_0x2490d3['fieldName'],'type':_0x2490d3['type'][_0x2502('0x2e')]};});_0x511ae6[_0x2502('0x2f')]=_[_0x2502('0x30')](_0x49b21d,_0x2502('0x2a'));_0x511ae6[_0x2502('0x31')]=_[_0x2502('0x32')](_0x5c44c9['query']);_0x511ae6['filters']=_[_0x2502('0x33')](_0x511ae6[_0x2502('0x2f')],_0x511ae6['query']);_0x39c1d8[_0x2502('0x34')]=_[_0x2502('0x33')](_0x511ae6[_0x2502('0x2f')],qs['fields'](_0x5c44c9[_0x2502('0x31')][_0x2502('0x35')]));_0x39c1d8[_0x2502('0x34')]=_0x39c1d8[_0x2502('0x34')]['length']?_0x39c1d8[_0x2502('0x34')]:_0x511ae6['model'];if(!_0x5c44c9[_0x2502('0x31')][_0x2502('0x36')](_0x2502('0x37'))){_0x39c1d8[_0x2502('0x1e')]=qs['limit'](_0x5c44c9[_0x2502('0x31')][_0x2502('0x1e')]);_0x39c1d8[_0x2502('0x38')]=qs[_0x2502('0x38')](_0x5c44c9['query']['offset']);}_0x39c1d8[_0x2502('0x39')]=qs[_0x2502('0x3a')](_0x5c44c9[_0x2502('0x31')]['sort']);_0x39c1d8[_0x2502('0x3b')]=qs[_0x2502('0x3c')](_[_0x2502('0x3d')](_0x5c44c9['query'],_0x511ae6[_0x2502('0x3c')]),_0x49b21d);if(_0x5c44c9[_0x2502('0x31')]['filter']){_0x39c1d8[_0x2502('0x3b')]=_[_0x2502('0x3e')](_0x39c1d8['where'],{'$or':_['map'](_0x49b21d,function(_0x17bd4c){if(_0x17bd4c[_0x2502('0x3f')]!==_0x2502('0x40')){var _0x5e150d={};_0x5e150d[_0x17bd4c[_0x2502('0x2a')]]={'$like':'%'+_0x5c44c9['query']['filter']+'%'};return _0x5e150d;}})});}_0x39c1d8=_[_0x2502('0x3e')]({},_0x39c1d8,_0x5c44c9[_0x2502('0x41')]);var _0x241b24={'where':_0x39c1d8[_0x2502('0x3b')]};return db[_0x2502('0x2d')]['count'](_0x241b24)[_0x2502('0x25')](function(_0x57bfd8){_0x46abed[_0x2502('0x42')]=_0x57bfd8;if(_0x5c44c9[_0x2502('0x31')][_0x2502('0x43')]){_0x39c1d8['include']=[{'all':!![]}];}return db[_0x2502('0x2d')][_0x2502('0x44')](_0x39c1d8);})['then'](function(_0x412866){_0x46abed[_0x2502('0x45')]=_0x412866;return _0x46abed;})[_0x2502('0x25')](respondWithFilteredResult(_0x176245,_0x39c1d8))[_0x2502('0x46')](handleError(_0x176245,null));};exports['show']=function(_0x386c8c,_0x5413da){var _0x47b76d={'raw':!![],'where':{'id':_0x386c8c['params']['id']}},_0x322c94={};_0x322c94['model']=_[_0x2502('0x32')](db['VoiceDialReport']['rawAttributes']);_0x322c94[_0x2502('0x31')]=_[_0x2502('0x32')](_0x386c8c[_0x2502('0x31')]);_0x322c94[_0x2502('0x3c')]=_[_0x2502('0x33')](_0x322c94[_0x2502('0x2f')],_0x322c94[_0x2502('0x31')]);_0x47b76d[_0x2502('0x34')]=_['intersection'](_0x322c94['model'],qs[_0x2502('0x35')](_0x386c8c[_0x2502('0x31')][_0x2502('0x35')]));_0x47b76d[_0x2502('0x34')]=_0x47b76d[_0x2502('0x34')][_0x2502('0x47')]?_0x47b76d[_0x2502('0x34')]:_0x322c94[_0x2502('0x2f')];if(_0x386c8c[_0x2502('0x31')]['includeAll']){_0x47b76d['include']=[{'all':!![]}];}_0x47b76d=_[_0x2502('0x3e')]({},_0x47b76d,_0x386c8c['options']);return db['VoiceDialReport'][_0x2502('0x48')](_0x47b76d)['then'](handleEntityNotFound(_0x5413da,null))[_0x2502('0x25')](respondWithResult(_0x5413da,null))[_0x2502('0x46')](handleError(_0x5413da,null));};exports[_0x2502('0x49')]=function(_0xbfe909,_0x2a6d0c){return db[_0x2502('0x2d')]['create'](_0xbfe909[_0x2502('0x4a')],{})[_0x2502('0x25')](respondWithResult(_0x2a6d0c,0xc9))[_0x2502('0x46')](handleError(_0x2a6d0c,null));};exports['update']=function(_0x1d1374,_0x21213f){if(_0x1d1374[_0x2502('0x4a')]['id']){delete _0x1d1374['body']['id'];}return db['VoiceDialReport'][_0x2502('0x48')]({'where':{'id':_0x1d1374['params']['id']}})['then'](handleEntityNotFound(_0x21213f,null))['then'](saveUpdates(_0x1d1374[_0x2502('0x4a')],null))['then'](respondWithResult(_0x21213f,null))[_0x2502('0x46')](handleError(_0x21213f,null));};exports[_0x2502('0x26')]=function(_0x466c14,_0x48141b){return db[_0x2502('0x2d')][_0x2502('0x48')]({'where':{'id':_0x466c14[_0x2502('0x4b')]['id']}})[_0x2502('0x25')](handleEntityNotFound(_0x48141b,null))[_0x2502('0x25')](removeEntity(_0x48141b,null))['catch'](handleError(_0x48141b,null));};exports[_0x2502('0x4c')]=function(_0x360efc,_0x30ca0e){return db[_0x2502('0x2d')][_0x2502('0x4c')]()[_0x2502('0x25')](respondWithResult(_0x30ca0e,null))[_0x2502('0x46')](handleError(_0x30ca0e,null));}; \ No newline at end of file +var _0x856e=['show','params','includeAll','find','create','body','catch','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','save','update','then','end','name','index','VoiceDialReport','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','count','include','findAll'];(function(_0x2d08a3,_0x1211da){var _0x4fcbb7=function(_0x832715){while(--_0x832715){_0x2d08a3['push'](_0x2d08a3['shift']());}};_0x4fcbb7(++_0x1211da);}(_0x856e,0xd5));var _0xe856=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x856e[_0x385c76];return _0x5c8367;};'use strict';var pdf=require(_0xe856('0x0'));var emlformat=require(_0xe856('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe856('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe856('0x3'));var moment=require(_0xe856('0x4'));var BPromise=require(_0xe856('0x5'));var Mustache=require(_0xe856('0x6'));var util=require(_0xe856('0x7'));var path=require('path');var sox=require(_0xe856('0x8'));var csv=require(_0xe856('0x9'));var ejs=require(_0xe856('0xa'));var fs=require('fs');var _=require(_0xe856('0xb'));var squel=require(_0xe856('0xc'));var crypto=require(_0xe856('0xd'));var jsforce=require(_0xe856('0xe'));var deskjs=require(_0xe856('0xf'));var toCsv=require(_0xe856('0x9'));var querystring=require(_0xe856('0x10'));var Papa=require(_0xe856('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe856('0x12'));var as=require(_0xe856('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe856('0x14'));var licenseUtil=require(_0xe856('0x15'));var db=require(_0xe856('0x16'))['db'];function respondWithStatusCode(_0x3ec06b,_0x4b8ed6){_0x4b8ed6=_0x4b8ed6||0xcc;return function(_0x288c90){if(_0x288c90){return _0x3ec06b[_0xe856('0x17')](_0x4b8ed6);}return _0x3ec06b['status'](_0x4b8ed6)['end']();};}function respondWithResult(_0x3773cf,_0x5e3845){_0x5e3845=_0x5e3845||0xc8;return function(_0x1bf0c2){if(_0x1bf0c2){return _0x3773cf[_0xe856('0x18')](_0x5e3845)['json'](_0x1bf0c2);}};}function respondWithFilteredResult(_0x34a377,_0x54f05a){return function(_0x2be794){if(_0x2be794){var _0x2a7ce9=_0x2be794['count'],_0x275497=_0x54f05a['offset'],_0x5dbad6=_0x54f05a[_0xe856('0x19')]+_0x54f05a[_0xe856('0x1a')],_0x3d4d86;if(_0x5dbad6>=_0x2a7ce9){_0x5dbad6=_0x2a7ce9;_0x3d4d86=0xc8;}else{_0x3d4d86=0xce;}_0x34a377[_0xe856('0x18')](_0x3d4d86);return _0x34a377[_0xe856('0x1b')]('Content-Range',_0x275497+'-'+_0x5dbad6+'/'+_0x2a7ce9)[_0xe856('0x1c')](_0x2be794);}return null;};}function patchUpdates(_0x66ca47){return function(_0x5c80d0){try{jsonpatch[_0xe856('0x1d')](_0x5c80d0,_0x66ca47,!![]);}catch(_0x2a9117){return BPromise[_0xe856('0x1e')](_0x2a9117);}return _0x5c80d0[_0xe856('0x1f')]();};}function saveUpdates(_0x256fd8,_0x212479){return function(_0x56db07){if(_0x56db07){return _0x56db07[_0xe856('0x20')](_0x256fd8)[_0xe856('0x21')](function(_0x307abd){return _0x307abd;});}return null;};}function removeEntity(_0x4167ce,_0x47f474){return function(_0x5ccdd8){if(_0x5ccdd8){return _0x5ccdd8['destroy']()[_0xe856('0x21')](function(){_0x4167ce['status'](0xcc)[_0xe856('0x22')]();});}};}function handleEntityNotFound(_0x2e8080,_0x18270c){return function(_0x37c67f){if(!_0x37c67f){_0x2e8080[_0xe856('0x17')](0x194);}return _0x37c67f;};}function handleError(_0xcccdc3,_0x205f9d){_0x205f9d=_0x205f9d||0x1f4;return function(_0x14e74c){logger['error'](_0x14e74c['stack']);if(_0x14e74c['name']){delete _0x14e74c[_0xe856('0x23')];}_0xcccdc3[_0xe856('0x18')](_0x205f9d)['send'](_0x14e74c);};}exports[_0xe856('0x24')]=function(_0x32a17b,_0x488fe7){var _0x1dd3d0={},_0x25acf2={},_0x1eb037={'count':0x0,'rows':[]};var _0x2f5160=_['map'](db[_0xe856('0x25')][_0xe856('0x26')],function(_0x70f258){return{'name':_0x70f258['fieldName'],'type':_0x70f258['type']['key']};});_0x25acf2[_0xe856('0x27')]=_[_0xe856('0x28')](_0x2f5160,_0xe856('0x23'));_0x25acf2[_0xe856('0x29')]=_[_0xe856('0x2a')](_0x32a17b[_0xe856('0x29')]);_0x25acf2[_0xe856('0x2b')]=_[_0xe856('0x2c')](_0x25acf2[_0xe856('0x27')],_0x25acf2[_0xe856('0x29')]);_0x1dd3d0[_0xe856('0x2d')]=_['intersection'](_0x25acf2[_0xe856('0x27')],qs[_0xe856('0x2e')](_0x32a17b[_0xe856('0x29')][_0xe856('0x2e')]));_0x1dd3d0['attributes']=_0x1dd3d0[_0xe856('0x2d')]['length']?_0x1dd3d0['attributes']:_0x25acf2['model'];if(!_0x32a17b[_0xe856('0x29')][_0xe856('0x2f')]('nolimit')){_0x1dd3d0[_0xe856('0x1a')]=qs[_0xe856('0x1a')](_0x32a17b[_0xe856('0x29')]['limit']);_0x1dd3d0['offset']=qs[_0xe856('0x19')](_0x32a17b['query'][_0xe856('0x19')]);}_0x1dd3d0[_0xe856('0x30')]=qs[_0xe856('0x31')](_0x32a17b[_0xe856('0x29')][_0xe856('0x31')]);_0x1dd3d0[_0xe856('0x32')]=qs[_0xe856('0x2b')](_[_0xe856('0x33')](_0x32a17b[_0xe856('0x29')],_0x25acf2[_0xe856('0x2b')]),_0x2f5160);if(_0x32a17b[_0xe856('0x29')]['filter']){_0x1dd3d0[_0xe856('0x32')]=_['merge'](_0x1dd3d0['where'],{'$or':_['map'](_0x2f5160,function(_0x19d27a){if(_0x19d27a['type']!==_0xe856('0x34')){var _0x109324={};_0x109324[_0x19d27a[_0xe856('0x23')]]={'$like':'%'+_0x32a17b[_0xe856('0x29')][_0xe856('0x35')]+'%'};return _0x109324;}})});}_0x1dd3d0=_[_0xe856('0x36')]({},_0x1dd3d0,_0x32a17b[_0xe856('0x37')]);var _0x522c13={'where':_0x1dd3d0[_0xe856('0x32')]};return db[_0xe856('0x25')]['count'](_0x522c13)[_0xe856('0x21')](function(_0x44a1d5){_0x1eb037[_0xe856('0x38')]=_0x44a1d5;if(_0x32a17b[_0xe856('0x29')]['includeAll']){_0x1dd3d0[_0xe856('0x39')]=[{'all':!![]}];}return db[_0xe856('0x25')][_0xe856('0x3a')](_0x1dd3d0);})[_0xe856('0x21')](function(_0x19f26d){_0x1eb037['rows']=_0x19f26d;return _0x1eb037;})[_0xe856('0x21')](respondWithFilteredResult(_0x488fe7,_0x1dd3d0))['catch'](handleError(_0x488fe7,null));};exports[_0xe856('0x3b')]=function(_0x2d1e86,_0x502212){var _0x2de96d={'raw':!![],'where':{'id':_0x2d1e86[_0xe856('0x3c')]['id']}},_0x575385={};_0x575385[_0xe856('0x27')]=_[_0xe856('0x2a')](db['VoiceDialReport'][_0xe856('0x26')]);_0x575385[_0xe856('0x29')]=_['keys'](_0x2d1e86[_0xe856('0x29')]);_0x575385['filters']=_[_0xe856('0x2c')](_0x575385[_0xe856('0x27')],_0x575385[_0xe856('0x29')]);_0x2de96d[_0xe856('0x2d')]=_[_0xe856('0x2c')](_0x575385[_0xe856('0x27')],qs['fields'](_0x2d1e86[_0xe856('0x29')][_0xe856('0x2e')]));_0x2de96d[_0xe856('0x2d')]=_0x2de96d[_0xe856('0x2d')]['length']?_0x2de96d['attributes']:_0x575385[_0xe856('0x27')];if(_0x2d1e86[_0xe856('0x29')][_0xe856('0x3d')]){_0x2de96d[_0xe856('0x39')]=[{'all':!![]}];}_0x2de96d=_[_0xe856('0x36')]({},_0x2de96d,_0x2d1e86[_0xe856('0x37')]);return db[_0xe856('0x25')][_0xe856('0x3e')](_0x2de96d)[_0xe856('0x21')](handleEntityNotFound(_0x502212,null))[_0xe856('0x21')](respondWithResult(_0x502212,null))['catch'](handleError(_0x502212,null));};exports[_0xe856('0x3f')]=function(_0x5a8cfb,_0xfd8343){return db[_0xe856('0x25')][_0xe856('0x3f')](_0x5a8cfb[_0xe856('0x40')],{})[_0xe856('0x21')](respondWithResult(_0xfd8343,0xc9))[_0xe856('0x41')](handleError(_0xfd8343,null));};exports[_0xe856('0x20')]=function(_0x1a6daa,_0x33e939){if(_0x1a6daa[_0xe856('0x40')]['id']){delete _0x1a6daa[_0xe856('0x40')]['id'];}return db['VoiceDialReport'][_0xe856('0x3e')]({'where':{'id':_0x1a6daa[_0xe856('0x3c')]['id']}})[_0xe856('0x21')](handleEntityNotFound(_0x33e939,null))['then'](saveUpdates(_0x1a6daa[_0xe856('0x40')],null))[_0xe856('0x21')](respondWithResult(_0x33e939,null))['catch'](handleError(_0x33e939,null));};exports[_0xe856('0x42')]=function(_0x4249db,_0xf3bce8){return db[_0xe856('0x25')]['find']({'where':{'id':_0x4249db['params']['id']}})[_0xe856('0x21')](handleEntityNotFound(_0xf3bce8,null))['then'](removeEntity(_0xf3bce8,null))[_0xe856('0x41')](handleError(_0xf3bce8,null));};exports[_0xe856('0x43')]=function(_0x1eb60c,_0x4f34d9){return db[_0xe856('0x25')][_0xe856('0x43')]()[_0xe856('0x21')](respondWithResult(_0x4f34d9,null))[_0xe856('0x41')](handleError(_0x4f34d9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 124d358..3b205bb 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 _0xdb67=['request-promise','rimraf','./voiceDialReport.attributes','define','report_dial','util','../../config/logger','api','moment','bluebird'];(function(_0x58e92d,_0x1181bd){var _0x45d179=function(_0xf162a4){while(--_0xf162a4){_0x58e92d['push'](_0x58e92d['shift']());}};_0x45d179(++_0x1181bd);}(_0xdb67,0x163));var _0x7db6=function(_0x203a51,_0x15e1f1){_0x203a51=_0x203a51-0x0;var _0x101c51=_0xdb67[_0x203a51];return _0x101c51;};'use strict';var _=require('lodash');var util=require(_0x7db6('0x0'));var logger=require(_0x7db6('0x1'))(_0x7db6('0x2'));var moment=require(_0x7db6('0x3'));var BPromise=require(_0x7db6('0x4'));var rp=require(_0x7db6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7db6('0x6'));var config=require('../../config/environment');var attributes=require(_0x7db6('0x7'));module['exports']=function(_0x249080,_0x7f90ca){return _0x249080[_0x7db6('0x8')]('VoiceDialReport',attributes,{'tableName':_0x7db6('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x41f3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid'];(function(_0x1d6fff,_0x31771c){var _0x3be0c4=function(_0x481701){while(--_0x481701){_0x1d6fff['push'](_0x1d6fff['shift']());}};_0x3be0c4(++_0x31771c);}(_0x41f3,0xb4));var _0x341f=function(_0x2a7516,_0x47a235){_0x2a7516=_0x2a7516-0x0;var _0x69c2a=_0x41f3[_0x2a7516];return _0x69c2a;};'use strict';var _=require(_0x341f('0x0'));var util=require('util');var logger=require(_0x341f('0x1'))(_0x341f('0x2'));var moment=require('moment');var BPromise=require(_0x341f('0x3'));var rp=require(_0x341f('0x4'));var fs=require('fs');var path=require(_0x341f('0x5'));var rimraf=require(_0x341f('0x6'));var config=require('../../config/environment');var attributes=require(_0x341f('0x7'));module[_0x341f('0x8')]=function(_0x3ca166,_0x5c51e4){return _0x3ca166['define'](_0x341f('0x9'),attributes,{'tableName':_0x341f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x341f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9b2a647..a94edfa 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 _0x6a29=['options','UpdateVoiceDialReport','VoiceDialReport','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body'];(function(_0x430524,_0x23b611){var _0x3a726d=function(_0x5cc39d){while(--_0x5cc39d){_0x430524['push'](_0x430524['shift']());}};_0x3a726d(++_0x23b611);}(_0x6a29,0x1b8));var _0x96a2=function(_0x4403b5,_0x35b4f6){_0x4403b5=_0x4403b5-0x0;var _0x3fadb0=_0x6a29[_0x4403b5];return _0x3fadb0;};'use strict';var _=require(_0x96a2('0x0'));var util=require(_0x96a2('0x1'));var moment=require(_0x96a2('0x2'));var BPromise=require(_0x96a2('0x3'));var rs=require(_0x96a2('0x4'));var fs=require('fs');var Redis=require(_0x96a2('0x5'));var db=require(_0x96a2('0x6'))['db'];var utils=require(_0x96a2('0x7'));var logger=require(_0x96a2('0x8'))(_0x96a2('0x9'));var config=require(_0x96a2('0xa'));var jayson=require(_0x96a2('0xb'));var client=jayson[_0x96a2('0xc')][_0x96a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x269eb0,_0x1ce316,_0x40fec1){return new BPromise(function(_0x11a84b,_0x4be0e9){return client[_0x96a2('0xe')](_0x269eb0,_0x40fec1)['then'](function(_0x117b69){logger[_0x96a2('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x1ce316,_0x96a2('0x10'));logger[_0x96a2('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1ce316,_0x96a2('0x10'),JSON[_0x96a2('0x12')](_0x117b69));if(_0x117b69[_0x96a2('0x13')]){if(_0x117b69['error'][_0x96a2('0x14')]===0x1f4){logger[_0x96a2('0x13')](_0x96a2('0x15'),_0x1ce316,_0x117b69[_0x96a2('0x13')][_0x96a2('0x16')]);return _0x4be0e9(_0x117b69[_0x96a2('0x13')]['message']);}logger['error'](_0x96a2('0x15'),_0x1ce316,_0x117b69[_0x96a2('0x13')][_0x96a2('0x16')]);return _0x11a84b(_0x117b69[_0x96a2('0x13')][_0x96a2('0x16')]);}else{logger[_0x96a2('0xf')](_0x96a2('0x15'),_0x1ce316,_0x96a2('0x10'));_0x11a84b(_0x117b69[_0x96a2('0x17')][_0x96a2('0x16')]);}})[_0x96a2('0x18')](function(_0x5f079e){logger[_0x96a2('0x13')](_0x96a2('0x15'),_0x1ce316,_0x5f079e);_0x4be0e9(_0x5f079e);});});}exports[_0x96a2('0x19')]=function(_0x70af52){var _0x404636=this;return new Promise(function(_0x52489a,_0x500a78){return db['VoiceDialReport'][_0x96a2('0x1a')](_0x70af52[_0x96a2('0x1b')],{'raw':_0x70af52[_0x96a2('0x1c')]?_0x70af52[_0x96a2('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4096fc){logger[_0x96a2('0xf')]('CreateVoiceDialReport',_0x70af52);logger['debug']('CreateVoiceDialReport',_0x70af52,JSON[_0x96a2('0x12')](_0x4096fc));_0x52489a(_0x4096fc);})[_0x96a2('0x18')](function(_0xc70cda){logger[_0x96a2('0x13')](_0x96a2('0x19'),_0xc70cda[_0x96a2('0x16')],_0x70af52);_0x500a78(_0x404636[_0x96a2('0x13')](0x1f4,_0xc70cda[_0x96a2('0x16')]));});});};exports[_0x96a2('0x1d')]=function(_0x26212c){var _0x11f629=this;return new Promise(function(_0x144486,_0x2f9576){return db[_0x96a2('0x1e')]['update'](_0x26212c[_0x96a2('0x1b')],{'raw':_0x26212c[_0x96a2('0x1c')]?_0x26212c['options'][_0x96a2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26212c['options']?_0x26212c[_0x96a2('0x1c')][_0x96a2('0x20')]||null:null,'attributes':_0x26212c['options']?_0x26212c[_0x96a2('0x1c')][_0x96a2('0x21')]||null:null,'limit':_0x26212c[_0x96a2('0x1c')]?_0x26212c[_0x96a2('0x1c')][_0x96a2('0x22')]||null:null})[_0x96a2('0x23')](function(_0x588290){logger[_0x96a2('0xf')](_0x96a2('0x1d'),_0x26212c);logger['debug'](_0x96a2('0x1d'),_0x26212c,JSON[_0x96a2('0x12')](_0x588290));_0x144486(_0x588290);})['catch'](function(_0x4c8fd6){logger[_0x96a2('0x13')](_0x96a2('0x1d'),_0x4c8fd6[_0x96a2('0x16')],_0x26212c);_0x2f9576(_0x11f629[_0x96a2('0x13')](0x1f4,_0x4c8fd6[_0x96a2('0x16')]));});});}; \ No newline at end of file +var _0x444e=['body','options','raw','then','stringify','UpdateVoiceDialReport','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport'];(function(_0x1522b0,_0x1e0456){var _0x1b00c6=function(_0x3a894e){while(--_0x3a894e){_0x1522b0['push'](_0x1522b0['shift']());}};_0x1b00c6(++_0x1e0456);}(_0x444e,0x16f));var _0xe444=function(_0x4b7b09,_0x51b969){_0x4b7b09=_0x4b7b09-0x0;var _0x1ad8de=_0x444e[_0x4b7b09];return _0x1ad8de;};'use strict';var _=require(_0xe444('0x0'));var util=require(_0xe444('0x1'));var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rs=require(_0xe444('0x3'));var fs=require('fs');var Redis=require(_0xe444('0x4'));var db=require(_0xe444('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe444('0x6'))(_0xe444('0x7'));var config=require(_0xe444('0x8'));var jayson=require(_0xe444('0x9'));var client=jayson['client'][_0xe444('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d7ae,_0x3393e9,_0x2910ed){return new BPromise(function(_0x23a245,_0x3c88d9){return client['request'](_0x41d7ae,_0x2910ed)['then'](function(_0x1247f4){logger[_0xe444('0xb')](_0xe444('0xc'),_0x3393e9,_0xe444('0xd'));logger[_0xe444('0xe')](_0xe444('0xf'),_0x3393e9,'request\x20sent',JSON['stringify'](_0x1247f4));if(_0x1247f4['error']){if(_0x1247f4[_0xe444('0x10')][_0xe444('0x11')]===0x1f4){logger[_0xe444('0x10')](_0xe444('0xc'),_0x3393e9,_0x1247f4[_0xe444('0x10')][_0xe444('0x12')]);return _0x3c88d9(_0x1247f4['error'][_0xe444('0x12')]);}logger[_0xe444('0x10')](_0xe444('0xc'),_0x3393e9,_0x1247f4[_0xe444('0x10')][_0xe444('0x12')]);return _0x23a245(_0x1247f4['error'][_0xe444('0x12')]);}else{logger[_0xe444('0xb')](_0xe444('0xc'),_0x3393e9,_0xe444('0xd'));_0x23a245(_0x1247f4[_0xe444('0x13')]['message']);}})[_0xe444('0x14')](function(_0x1a9ed8){logger['error'](_0xe444('0xc'),_0x3393e9,_0x1a9ed8);_0x3c88d9(_0x1a9ed8);});});}exports[_0xe444('0x15')]=function(_0x325284){var _0x399a37=this;return new Promise(function(_0x46b14a,_0x5c39d2){return db[_0xe444('0x16')]['create'](_0x325284[_0xe444('0x17')],{'raw':_0x325284[_0xe444('0x18')]?_0x325284[_0xe444('0x18')][_0xe444('0x19')]===undefined?!![]:![]:!![]})[_0xe444('0x1a')](function(_0x1bbb21){logger[_0xe444('0xb')](_0xe444('0x15'),_0x325284);logger[_0xe444('0xe')](_0xe444('0x15'),_0x325284,JSON[_0xe444('0x1b')](_0x1bbb21));_0x46b14a(_0x1bbb21);})['catch'](function(_0x2dfe4e){logger[_0xe444('0x10')](_0xe444('0x15'),_0x2dfe4e['message'],_0x325284);_0x5c39d2(_0x399a37[_0xe444('0x10')](0x1f4,_0x2dfe4e[_0xe444('0x12')]));});});};exports[_0xe444('0x1c')]=function(_0x4eaa2d){var _0x1e9429=this;return new Promise(function(_0xd55f3f,_0x50a1ae){return db[_0xe444('0x16')]['update'](_0x4eaa2d[_0xe444('0x17')],{'raw':_0x4eaa2d['options']?_0x4eaa2d[_0xe444('0x18')][_0xe444('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eaa2d['options']?_0x4eaa2d[_0xe444('0x18')]['where']||null:null,'attributes':_0x4eaa2d[_0xe444('0x18')]?_0x4eaa2d[_0xe444('0x18')]['attributes']||null:null,'limit':_0x4eaa2d[_0xe444('0x18')]?_0x4eaa2d[_0xe444('0x18')][_0xe444('0x1d')]||null:null})[_0xe444('0x1a')](function(_0x290f45){logger['info']('UpdateVoiceDialReport',_0x4eaa2d);logger['debug'](_0xe444('0x1c'),_0x4eaa2d,JSON[_0xe444('0x1b')](_0x290f45));_0xd55f3f(_0x290f45);})[_0xe444('0x14')](function(_0x17852e){logger[_0xe444('0x10')](_0xe444('0x1c'),_0x17852e[_0xe444('0x12')],_0x4eaa2d);_0x50a1ae(_0x1e9429[_0xe444('0x10')](0x1f4,_0x17852e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9cc762c..c5587b2 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 _0xe0c1=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','/:id','post','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2e0d88,_0x47ea20){var _0x52c931=function(_0x5df9e7){while(--_0x5df9e7){_0x2e0d88['push'](_0x2e0d88['shift']());}};_0x52c931(++_0x47ea20);}(_0xe0c1,0x175));var _0x1e0c=function(_0x2fe04a,_0x37a062){_0x2fe04a=_0x2fe04a-0x0;var _0x3a5841=_0xe0c1[_0x2fe04a];return _0x3a5841;};'use strict';var multer=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var path=require(_0x1e0c('0x2'));var timeout=require(_0x1e0c('0x3'));var express=require(_0x1e0c('0x4'));var router=express[_0x1e0c('0x5')]();var auth=require(_0x1e0c('0x6'));var interaction=require(_0x1e0c('0x7'));var config=require(_0x1e0c('0x8'));var controller=require(_0x1e0c('0x9'));router['get']('/',auth[_0x1e0c('0xa')](),controller['index']);router[_0x1e0c('0xb')](_0x1e0c('0xc'),auth[_0x1e0c('0xa')](),controller['show']);router['post']('/',auth[_0x1e0c('0xa')](),controller['create']);router[_0x1e0c('0xd')](_0x1e0c('0xe'),auth[_0x1e0c('0xa')](),controller[_0x1e0c('0xf')]);router[_0x1e0c('0x10')](_0x1e0c('0xc'),auth[_0x1e0c('0xa')](),controller['update']);router[_0x1e0c('0x11')](_0x1e0c('0xc'),auth[_0x1e0c('0xa')](),controller[_0x1e0c('0x12')]);module[_0x1e0c('0x13')]=router; \ No newline at end of file +var _0xad21=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','exports','multer','path','express','../../components/auth/service'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xad21,0x1c4));var _0x1ad2=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xad21[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x1ad2('0x0'));var util=require('util');var path=require(_0x1ad2('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ad2('0x2'));var router=express['Router']();var auth=require(_0x1ad2('0x3'));var interaction=require(_0x1ad2('0x4'));var config=require(_0x1ad2('0x5'));var controller=require(_0x1ad2('0x6'));router[_0x1ad2('0x7')]('/',auth[_0x1ad2('0x8')](),controller[_0x1ad2('0x9')]);router[_0x1ad2('0x7')](_0x1ad2('0xa'),auth[_0x1ad2('0x8')](),controller[_0x1ad2('0xb')]);router[_0x1ad2('0xc')]('/',auth[_0x1ad2('0x8')](),controller[_0x1ad2('0xd')]);router[_0x1ad2('0xc')](_0x1ad2('0xe'),auth[_0x1ad2('0x8')](),controller[_0x1ad2('0xf')]);router[_0x1ad2('0x10')](_0x1ad2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1ad2('0x11')](_0x1ad2('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1ad2('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 78eff0d..17c5995 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(_0x1ad659,_0x1ab26a){var _0x56d7e2=function(_0x3c3f02){while(--_0x3c3f02){_0x1ad659['push'](_0x1ad659['shift']());}};_0x56d7e2(++_0x1ab26a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x1691c8,_0x56ee80){var _0x5b19cd=function(_0x180b7b){while(--_0x180b7b){_0x1691c8['push'](_0x1691c8['shift']());}};_0x5b19cd(++_0x56ee80);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 56e05df..6615934 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 _0x4e22=['rows','show','params','catch','create','body','startsWith','exten','user','get','role','InboundRoutes','UserProfileSection','userProfileId','update','description','recordingFormat','cutdigits','mandatoryDisposition','context','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','merge','options','VoiceExtension','includeAll','include'];(function(_0xfe0474,_0x51efb0){var _0x41a21c=function(_0x41d8bc){while(--_0x41d8bc){_0xfe0474['push'](_0xfe0474['shift']());}};_0x41a21c(++_0x51efb0);}(_0x4e22,0x83));var _0x24e2=function(_0x25faac,_0x1ed0be){_0x25faac=_0x25faac-0x0;var _0x4a0b6c=_0x4e22[_0x25faac];return _0x4a0b6c;};'use strict';var pdf=require(_0x24e2('0x0'));var emlformat=require(_0x24e2('0x1'));var rimraf=require(_0x24e2('0x2'));var zipdir=require(_0x24e2('0x3'));var jsonpatch=require(_0x24e2('0x4'));var rp=require(_0x24e2('0x5'));var moment=require('moment');var BPromise=require(_0x24e2('0x6'));var Mustache=require(_0x24e2('0x7'));var util=require(_0x24e2('0x8'));var path=require(_0x24e2('0x9'));var sox=require(_0x24e2('0xa'));var csv=require(_0x24e2('0xb'));var ejs=require(_0x24e2('0xc'));var fs=require('fs');var _=require(_0x24e2('0xd'));var squel=require(_0x24e2('0xe'));var crypto=require('crypto');var jsforce=require(_0x24e2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x24e2('0xb'));var querystring=require('querystring');var Papa=require(_0x24e2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x24e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24e2('0x12'));var logger=require(_0x24e2('0x13'))(_0x24e2('0x14'));var utils=require(_0x24e2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x24e2('0x16'))['db'];config[_0x24e2('0x17')]=_[_0x24e2('0x18')](config[_0x24e2('0x17')],{'host':_0x24e2('0x19'),'port':0x18eb});var socket=require(_0x24e2('0x1a'))(new Redis(config['redis']));require(_0x24e2('0x1b'))['register'](socket);function respondWithStatusCode(_0x589407,_0x4bef5b){_0x4bef5b=_0x4bef5b||0xcc;return function(_0x10e758){if(_0x10e758){return _0x589407['sendStatus'](_0x4bef5b);}return _0x589407['status'](_0x4bef5b)[_0x24e2('0x1c')]();};}function respondWithResult(_0x5f24bf,_0x2f8268){_0x2f8268=_0x2f8268||0xc8;return function(_0x16d653){if(_0x16d653){return _0x5f24bf[_0x24e2('0x1d')](_0x2f8268)[_0x24e2('0x1e')](_0x16d653);}};}function respondWithFilteredResult(_0x182200,_0x20f3e1){return function(_0x5a1189){if(_0x5a1189){var _0x28c224=_0x5a1189[_0x24e2('0x1f')],_0x1a1171=_0x20f3e1[_0x24e2('0x20')],_0x1ee976=_0x20f3e1[_0x24e2('0x20')]+_0x20f3e1[_0x24e2('0x21')],_0x5e6819;if(_0x1ee976>=_0x28c224){_0x1ee976=_0x28c224;_0x5e6819=0xc8;}else{_0x5e6819=0xce;}_0x182200[_0x24e2('0x1d')](_0x5e6819);return _0x182200['set'](_0x24e2('0x22'),_0x1a1171+'-'+_0x1ee976+'/'+_0x28c224)[_0x24e2('0x1e')](_0x5a1189);}return null;};}function patchUpdates(_0x9167f2){return function(_0x2b77d6){try{jsonpatch[_0x24e2('0x23')](_0x2b77d6,_0x9167f2,!![]);}catch(_0x199719){return BPromise[_0x24e2('0x24')](_0x199719);}return _0x2b77d6[_0x24e2('0x25')]();};}function saveUpdates(_0x29be51,_0x2c382c){return function(_0x3138bf){if(_0x3138bf){return _0x3138bf['update'](_0x29be51)[_0x24e2('0x26')](function(_0x4e6424){return _0x4e6424;});}return null;};}function removeEntity(_0x3ce06a,_0x4a8d32){return function(_0x3c1ce1){if(_0x3c1ce1){return _0x3c1ce1['destroy']()[_0x24e2('0x26')](function(){var _0x3b2708=_0x3c1ce1['get']({'plain':!![]});var _0x4b81b8=[{'name':'InboundRoutes','value':_0x24e2('0x27'),'ignore':![]},{'name':_0x24e2('0x28'),'value':_0x24e2('0x29'),'ignore':![]},{'name':_0x24e2('0x2a'),'value':_0x24e2('0x2b'),'ignore':![]}];var _0x14c62b=_(_0x4b81b8)[_0x24e2('0x2c')]('ignore')[_0x24e2('0x2d')](_0x24e2('0x2e'))[_0x24e2('0x2e')]();if(_[_0x24e2('0x2f')](_0x14c62b,_0x3b2708[_0x24e2('0x30')])){return;}var _0x4f484f=_[_0x24e2('0x31')](_0x4b81b8,[_0x24e2('0x2e'),_0x3b2708['type']])[_0x24e2('0x32')];return db[_0x24e2('0x33')][_0x24e2('0x34')]({'where':{'type':_0x4f484f,'resourceId':_0x3b2708['id']}})[_0x24e2('0x26')](function(){return _0x3c1ce1;});})['then'](function(){_0x3ce06a[_0x24e2('0x1d')](0xcc)[_0x24e2('0x1c')]();});}};}function handleEntityNotFound(_0x11c55d,_0x521e85){return function(_0x3939fe){if(!_0x3939fe){_0x11c55d['sendStatus'](0x194);}return _0x3939fe;};}function handleError(_0xb9d91b,_0x598959){_0x598959=_0x598959||0x1f4;return function(_0xce78e8){logger[_0x24e2('0x35')](_0xce78e8[_0x24e2('0x36')]);if(_0xce78e8['name']){delete _0xce78e8['name'];}_0xb9d91b['status'](_0x598959)[_0x24e2('0x37')](_0xce78e8);};}exports[_0x24e2('0x38')]=function(_0x3d2b5a,_0x54bc35){var _0x3a4e08={},_0x31f401={},_0x139b58={'count':0x0,'rows':[]};var _0x3f8aa1=_[_0x24e2('0x2d')](db['VoiceExtension'][_0x24e2('0x39')],function(_0x54a786){return{'name':_0x54a786[_0x24e2('0x3a')],'type':_0x54a786[_0x24e2('0x30')][_0x24e2('0x3b')]};});_0x31f401['model']=_[_0x24e2('0x2d')](_0x3f8aa1,'name');_0x31f401[_0x24e2('0x3c')]=_[_0x24e2('0x3d')](_0x3d2b5a[_0x24e2('0x3c')]);_0x31f401[_0x24e2('0x3e')]=_[_0x24e2('0x3f')](_0x31f401[_0x24e2('0x40')],_0x31f401[_0x24e2('0x3c')]);_0x3a4e08[_0x24e2('0x41')]=_[_0x24e2('0x3f')](_0x31f401[_0x24e2('0x40')],qs[_0x24e2('0x42')](_0x3d2b5a[_0x24e2('0x3c')]['fields']));_0x3a4e08['attributes']=_0x3a4e08[_0x24e2('0x41')][_0x24e2('0x43')]?_0x3a4e08[_0x24e2('0x41')]:_0x31f401['model'];if(!_0x3d2b5a[_0x24e2('0x3c')][_0x24e2('0x44')](_0x24e2('0x45'))){_0x3a4e08[_0x24e2('0x21')]=qs['limit'](_0x3d2b5a[_0x24e2('0x3c')]['limit']);_0x3a4e08[_0x24e2('0x20')]=qs[_0x24e2('0x20')](_0x3d2b5a[_0x24e2('0x3c')][_0x24e2('0x20')]);}_0x3a4e08['order']=qs[_0x24e2('0x46')](_0x3d2b5a[_0x24e2('0x3c')][_0x24e2('0x46')]);_0x3a4e08['where']=qs[_0x24e2('0x3e')](_[_0x24e2('0x47')](_0x3d2b5a[_0x24e2('0x3c')],_0x31f401[_0x24e2('0x3e')]),_0x3f8aa1);if(_0x3d2b5a[_0x24e2('0x3c')][_0x24e2('0x2c')]){_0x3a4e08[_0x24e2('0x48')]=_['merge'](_0x3a4e08[_0x24e2('0x48')],{'$or':_[_0x24e2('0x2d')](_0x3f8aa1,function(_0x1fa8c6){if(_0x1fa8c6[_0x24e2('0x30')]!==_0x24e2('0x49')){var _0x4e34ae={};_0x4e34ae[_0x1fa8c6['name']]={'$like':'%'+_0x3d2b5a[_0x24e2('0x3c')][_0x24e2('0x2c')]+'%'};return _0x4e34ae;}})});}_0x3a4e08=_[_0x24e2('0x4a')]({},_0x3a4e08,_0x3d2b5a[_0x24e2('0x4b')]);var _0x974152={'where':_0x3a4e08[_0x24e2('0x48')]};return db[_0x24e2('0x4c')][_0x24e2('0x1f')](_0x974152)['then'](function(_0x385a9c){_0x139b58[_0x24e2('0x1f')]=_0x385a9c;if(_0x3d2b5a[_0x24e2('0x3c')][_0x24e2('0x4d')]){_0x3a4e08[_0x24e2('0x4e')]=[{'all':!![]}];}return db[_0x24e2('0x4c')]['findAll'](_0x3a4e08);})[_0x24e2('0x26')](function(_0x327756){_0x139b58[_0x24e2('0x4f')]=_0x327756;return _0x139b58;})['then'](respondWithFilteredResult(_0x54bc35,_0x3a4e08))['catch'](handleError(_0x54bc35,null));};exports[_0x24e2('0x50')]=function(_0x4227c9,_0x1e38cc){var _0x1472a6={'raw':![],'where':{'id':_0x4227c9[_0x24e2('0x51')]['id']}},_0x2f729a={};_0x2f729a[_0x24e2('0x40')]=_[_0x24e2('0x3d')](db['VoiceExtension'][_0x24e2('0x39')]);_0x2f729a[_0x24e2('0x3c')]=_[_0x24e2('0x3d')](_0x4227c9['query']);_0x2f729a['filters']=_[_0x24e2('0x3f')](_0x2f729a[_0x24e2('0x40')],_0x2f729a[_0x24e2('0x3c')]);_0x1472a6[_0x24e2('0x41')]=_[_0x24e2('0x3f')](_0x2f729a[_0x24e2('0x40')],qs['fields'](_0x4227c9['query'][_0x24e2('0x42')]));_0x1472a6[_0x24e2('0x41')]=_0x1472a6[_0x24e2('0x41')]['length']?_0x1472a6[_0x24e2('0x41')]:_0x2f729a[_0x24e2('0x40')];if(_0x4227c9[_0x24e2('0x3c')][_0x24e2('0x4d')]){_0x1472a6['include']=[{'all':!![]}];}_0x1472a6=_[_0x24e2('0x4a')]({},_0x1472a6,_0x4227c9[_0x24e2('0x4b')]);return db[_0x24e2('0x4c')]['find'](_0x1472a6)[_0x24e2('0x26')](handleEntityNotFound(_0x1e38cc,null))[_0x24e2('0x26')](respondWithResult(_0x1e38cc,null))[_0x24e2('0x52')](handleError(_0x1e38cc,null));};exports[_0x24e2('0x34')]=function(_0x21b125,_0x10f529){return db[_0x24e2('0x4c')][_0x24e2('0x31')]({'where':{'id':_0x21b125[_0x24e2('0x51')]['id']}})[_0x24e2('0x26')](handleEntityNotFound(_0x10f529,null))[_0x24e2('0x26')](removeEntity(_0x10f529,null))[_0x24e2('0x52')](handleError(_0x10f529,null));};exports[_0x24e2('0x53')]=function(_0x1d716e,_0x5710cf){if(_0x1d716e[_0x24e2('0x54')][_0x24e2('0x30')]===_0x24e2('0x29')&&!_[_0x24e2('0x55')](_0x1d716e[_0x24e2('0x54')]['exten'],'_')){_0x1d716e[_0x24e2('0x54')][_0x24e2('0x56')]='_'['concat'](_0x1d716e[_0x24e2('0x54')][_0x24e2('0x56')]);}return db['VoiceExtension'][_0x24e2('0x53')](_0x1d716e[_0x24e2('0x54')],{'raw':![]})['then'](function(_0x278274){var _0x594440=_0x1d716e[_0x24e2('0x57')][_0x24e2('0x58')]({'plain':!![]});if(!_0x594440)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x594440[_0x24e2('0x59')]===_0x24e2('0x57')){var _0x1a28f9=_0x278274[_0x24e2('0x58')]({'plain':!![]});var _0x547c97=[{'name':_0x24e2('0x5a'),'value':_0x24e2('0x27')},{'name':_0x24e2('0x28'),'value':'outbound'},{'name':_0x24e2('0x2a'),'value':_0x24e2('0x2b')}];var _0x4750fa=_[_0x24e2('0x31')](_0x547c97,[_0x24e2('0x2e'),_0x1a28f9[_0x24e2('0x30')]])[_0x24e2('0x32')];return db[_0x24e2('0x5b')][_0x24e2('0x31')]({'where':{'name':_0x4750fa,'userProfileId':_0x594440[_0x24e2('0x5c')]},'raw':!![]})['then'](function(_0x4632a9){if(_0x4632a9&&_0x4632a9['autoAssociation']===0x0){return db[_0x24e2('0x33')][_0x24e2('0x53')]({'name':_0x1a28f9['name'],'resourceId':_0x1a28f9['id'],'type':_0x4632a9['name'],'sectionId':_0x4632a9['id']},{})[_0x24e2('0x26')](function(){return _0x278274;});}else{return _0x278274;}})[_0x24e2('0x52')](function(_0x4f6a50){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f6a50);throw _0x4f6a50;});}return _0x278274;})[_0x24e2('0x26')](respondWithResult(_0x5710cf,0xc9))[_0x24e2('0x52')](handleError(_0x5710cf,null));};exports[_0x24e2('0x5d')]=function(_0xfe2b8f,_0x35b858){if(_0xfe2b8f[_0x24e2('0x54')]['id']){delete _0xfe2b8f['body']['id'];}return db[_0x24e2('0x4c')][_0x24e2('0x31')]({'where':{'id':_0xfe2b8f['params']['id']}})[_0x24e2('0x26')](handleEntityNotFound(_0x35b858,null))[_0x24e2('0x26')](function(_0x3fb92b){if(_0x3fb92b){return db[_0x24e2('0x4c')][_0x24e2('0x5d')](_[_0x24e2('0x47')](_0xfe2b8f[_0x24e2('0x54')],[_0x24e2('0x56'),'context',_0x24e2('0x5e'),_0x24e2('0x5f'),_0x24e2('0x60'),_0x24e2('0x61')]),{'where':{'context':_0x3fb92b[_0x24e2('0x62')],'exten':_0x3fb92b[_0x24e2('0x56')]},'individualHooks':!![]})[_0x24e2('0x26')](function(_0x5d38a3){return _0x5d38a3;});}return null;})['then'](respondWithStatusCode(_0x35b858,null))['catch'](handleError(_0x35b858,null));};exports['addApplications']=function(_0x5c97b6,_0x2a4a53,_0x2f0f6c){return db['VoiceExtension'][_0x24e2('0x63')]({'where':{'id':_0x5c97b6[_0x24e2('0x51')]['id']}})[_0x24e2('0x26')](handleEntityNotFound(_0x2a4a53,null))['then'](function(_0x289be3){if(_0x289be3){return db[_0x24e2('0x64')][_0x24e2('0x65')](function(_0x2b452d){return db['VoiceExtension'][_0x24e2('0x34')]({'where':{'VoiceExtensionId':_0x5c97b6[_0x24e2('0x51')]['id']},'transaction':_0x2b452d})[_0x24e2('0x26')](function(_0x459e06){var _0x2172f6=_['map'](_0x5c97b6[_0x24e2('0x54')],function(_0x1dd249){_0x1dd249[_0x24e2('0x66')]=_0x5c97b6[_0x24e2('0x51')]['id'];return _0x1dd249;});return db[_0x24e2('0x4c')]['bulkCreate'](_0x2172f6,{'transaction':_0x2b452d});});})[_0x24e2('0x26')](function(){return db[_0x24e2('0x4c')][_0x24e2('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5c97b6['params']['id']},'order':_0x24e2('0x68')});});}})['then'](respondWithResult(_0x2a4a53,null))[_0x24e2('0x52')](handleError(_0x2a4a53,null));}; \ No newline at end of file +var _0xf334=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','addApplications','findOne','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf334,0x169));var _0x4f33=function(_0x4cea07,_0x19a6f2){_0x4cea07=_0x4cea07-0x0;var _0xaa5bf8=_0xf334[_0x4cea07];return _0xaa5bf8;};'use strict';var pdf=require(_0x4f33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4f33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f33('0x2'));var rp=require('request-promise');var moment=require(_0x4f33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f33('0x4'));var util=require(_0x4f33('0x5'));var path=require(_0x4f33('0x6'));var sox=require(_0x4f33('0x7'));var csv=require(_0x4f33('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4f33('0x9'));var crypto=require(_0x4f33('0xa'));var jsforce=require(_0x4f33('0xb'));var deskjs=require(_0x4f33('0xc'));var toCsv=require(_0x4f33('0x8'));var querystring=require(_0x4f33('0xd'));var Papa=require(_0x4f33('0xe'));var Redis=require(_0x4f33('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4f33('0x10'));var as=require(_0x4f33('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f33('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4f33('0x13'));var licenseUtil=require(_0x4f33('0x14'));var db=require(_0x4f33('0x15'))['db'];config[_0x4f33('0x16')]=_[_0x4f33('0x17')](config[_0x4f33('0x16')],{'host':_0x4f33('0x18'),'port':0x18eb});var socket=require(_0x4f33('0x19'))(new Redis(config[_0x4f33('0x16')]));require(_0x4f33('0x1a'))[_0x4f33('0x1b')](socket);function respondWithStatusCode(_0x5d63f7,_0x3a080){_0x3a080=_0x3a080||0xcc;return function(_0x23fefc){if(_0x23fefc){return _0x5d63f7[_0x4f33('0x1c')](_0x3a080);}return _0x5d63f7[_0x4f33('0x1d')](_0x3a080)['end']();};}function respondWithResult(_0x36cef9,_0x4d56ff){_0x4d56ff=_0x4d56ff||0xc8;return function(_0x14df8e){if(_0x14df8e){return _0x36cef9[_0x4f33('0x1d')](_0x4d56ff)[_0x4f33('0x1e')](_0x14df8e);}};}function respondWithFilteredResult(_0x48b533,_0x58f324){return function(_0x66f926){if(_0x66f926){var _0x1ac48f=_0x66f926[_0x4f33('0x1f')],_0x27c561=_0x58f324[_0x4f33('0x20')],_0x3b01c0=_0x58f324[_0x4f33('0x20')]+_0x58f324[_0x4f33('0x21')],_0x22a1c1;if(_0x3b01c0>=_0x1ac48f){_0x3b01c0=_0x1ac48f;_0x22a1c1=0xc8;}else{_0x22a1c1=0xce;}_0x48b533[_0x4f33('0x1d')](_0x22a1c1);return _0x48b533[_0x4f33('0x22')](_0x4f33('0x23'),_0x27c561+'-'+_0x3b01c0+'/'+_0x1ac48f)[_0x4f33('0x1e')](_0x66f926);}return null;};}function patchUpdates(_0x144746){return function(_0x337f53){try{jsonpatch[_0x4f33('0x24')](_0x337f53,_0x144746,!![]);}catch(_0x338c36){return BPromise[_0x4f33('0x25')](_0x338c36);}return _0x337f53[_0x4f33('0x26')]();};}function saveUpdates(_0x1cb63b,_0x3d319a){return function(_0x15cf9f){if(_0x15cf9f){return _0x15cf9f[_0x4f33('0x27')](_0x1cb63b)[_0x4f33('0x28')](function(_0x33f9df){return _0x33f9df;});}return null;};}function removeEntity(_0x297a22,_0x182dca){return function(_0x15b912){if(_0x15b912){return _0x15b912[_0x4f33('0x29')]()[_0x4f33('0x28')](function(){var _0x14b2aa=_0x15b912[_0x4f33('0x2a')]({'plain':!![]});var _0x112f7e=[{'name':_0x4f33('0x2b'),'value':_0x4f33('0x2c'),'ignore':![]},{'name':'OutboundRoutes','value':_0x4f33('0x2d'),'ignore':![]},{'name':_0x4f33('0x2e'),'value':_0x4f33('0x2f'),'ignore':![]}];var _0x4dd5a9=_(_0x112f7e)['filter'](_0x4f33('0x30'))[_0x4f33('0x31')](_0x4f33('0x32'))[_0x4f33('0x32')]();if(_[_0x4f33('0x33')](_0x4dd5a9,_0x14b2aa[_0x4f33('0x34')])){return;}var _0xb5bbe5=_[_0x4f33('0x35')](_0x112f7e,['value',_0x14b2aa[_0x4f33('0x34')]])[_0x4f33('0x36')];return db[_0x4f33('0x37')]['destroy']({'where':{'type':_0xb5bbe5,'resourceId':_0x14b2aa['id']}})[_0x4f33('0x28')](function(){return _0x15b912;});})[_0x4f33('0x28')](function(){_0x297a22[_0x4f33('0x1d')](0xcc)[_0x4f33('0x38')]();});}};}function handleEntityNotFound(_0x27ef7b,_0x2a4854){return function(_0x568ba6){if(!_0x568ba6){_0x27ef7b[_0x4f33('0x1c')](0x194);}return _0x568ba6;};}function handleError(_0x49f50e,_0x969632){_0x969632=_0x969632||0x1f4;return function(_0x53f633){logger[_0x4f33('0x39')](_0x53f633[_0x4f33('0x3a')]);if(_0x53f633[_0x4f33('0x36')]){delete _0x53f633[_0x4f33('0x36')];}_0x49f50e['status'](_0x969632)[_0x4f33('0x3b')](_0x53f633);};}exports[_0x4f33('0x3c')]=function(_0x1b8a78,_0x4df48c){var _0x7e709f={},_0x442d4a={},_0x386ef1={'count':0x0,'rows':[]};var _0x3b1f2a=_['map'](db[_0x4f33('0x3d')][_0x4f33('0x3e')],function(_0x1c50c7){return{'name':_0x1c50c7[_0x4f33('0x3f')],'type':_0x1c50c7[_0x4f33('0x34')][_0x4f33('0x40')]};});_0x442d4a['model']=_['map'](_0x3b1f2a,_0x4f33('0x36'));_0x442d4a[_0x4f33('0x41')]=_[_0x4f33('0x42')](_0x1b8a78['query']);_0x442d4a[_0x4f33('0x43')]=_[_0x4f33('0x44')](_0x442d4a[_0x4f33('0x45')],_0x442d4a[_0x4f33('0x41')]);_0x7e709f[_0x4f33('0x46')]=_[_0x4f33('0x44')](_0x442d4a[_0x4f33('0x45')],qs[_0x4f33('0x47')](_0x1b8a78[_0x4f33('0x41')][_0x4f33('0x47')]));_0x7e709f['attributes']=_0x7e709f[_0x4f33('0x46')][_0x4f33('0x48')]?_0x7e709f[_0x4f33('0x46')]:_0x442d4a['model'];if(!_0x1b8a78['query'][_0x4f33('0x49')](_0x4f33('0x4a'))){_0x7e709f[_0x4f33('0x21')]=qs[_0x4f33('0x21')](_0x1b8a78[_0x4f33('0x41')][_0x4f33('0x21')]);_0x7e709f[_0x4f33('0x20')]=qs[_0x4f33('0x20')](_0x1b8a78[_0x4f33('0x41')][_0x4f33('0x20')]);}_0x7e709f['order']=qs['sort'](_0x1b8a78[_0x4f33('0x41')][_0x4f33('0x4b')]);_0x7e709f[_0x4f33('0x4c')]=qs['filters'](_[_0x4f33('0x4d')](_0x1b8a78[_0x4f33('0x41')],_0x442d4a[_0x4f33('0x43')]),_0x3b1f2a);if(_0x1b8a78['query'][_0x4f33('0x4e')]){_0x7e709f[_0x4f33('0x4c')]=_[_0x4f33('0x4f')](_0x7e709f['where'],{'$or':_[_0x4f33('0x31')](_0x3b1f2a,function(_0x1e9b8a){if(_0x1e9b8a[_0x4f33('0x34')]!=='VIRTUAL'){var _0x3d9fd9={};_0x3d9fd9[_0x1e9b8a[_0x4f33('0x36')]]={'$like':'%'+_0x1b8a78[_0x4f33('0x41')]['filter']+'%'};return _0x3d9fd9;}})});}_0x7e709f=_[_0x4f33('0x4f')]({},_0x7e709f,_0x1b8a78[_0x4f33('0x50')]);var _0xb95a46={'where':_0x7e709f[_0x4f33('0x4c')]};return db[_0x4f33('0x3d')][_0x4f33('0x1f')](_0xb95a46)['then'](function(_0x43cb3a){_0x386ef1[_0x4f33('0x1f')]=_0x43cb3a;if(_0x1b8a78['query'][_0x4f33('0x51')]){_0x7e709f[_0x4f33('0x52')]=[{'all':!![]}];}return db['VoiceExtension'][_0x4f33('0x53')](_0x7e709f);})[_0x4f33('0x28')](function(_0x2d7cb1){_0x386ef1[_0x4f33('0x54')]=_0x2d7cb1;return _0x386ef1;})[_0x4f33('0x28')](respondWithFilteredResult(_0x4df48c,_0x7e709f))[_0x4f33('0x55')](handleError(_0x4df48c,null));};exports[_0x4f33('0x56')]=function(_0x2a13ab,_0x1d6d5f){var _0x5e2b7c={'raw':![],'where':{'id':_0x2a13ab[_0x4f33('0x57')]['id']}},_0x1baa75={};_0x1baa75[_0x4f33('0x45')]=_[_0x4f33('0x42')](db[_0x4f33('0x3d')][_0x4f33('0x3e')]);_0x1baa75['query']=_[_0x4f33('0x42')](_0x2a13ab[_0x4f33('0x41')]);_0x1baa75[_0x4f33('0x43')]=_[_0x4f33('0x44')](_0x1baa75['model'],_0x1baa75['query']);_0x5e2b7c[_0x4f33('0x46')]=_[_0x4f33('0x44')](_0x1baa75[_0x4f33('0x45')],qs['fields'](_0x2a13ab[_0x4f33('0x41')][_0x4f33('0x47')]));_0x5e2b7c[_0x4f33('0x46')]=_0x5e2b7c[_0x4f33('0x46')][_0x4f33('0x48')]?_0x5e2b7c[_0x4f33('0x46')]:_0x1baa75[_0x4f33('0x45')];if(_0x2a13ab[_0x4f33('0x41')][_0x4f33('0x51')]){_0x5e2b7c['include']=[{'all':!![]}];}_0x5e2b7c=_[_0x4f33('0x4f')]({},_0x5e2b7c,_0x2a13ab[_0x4f33('0x50')]);return db['VoiceExtension'][_0x4f33('0x35')](_0x5e2b7c)[_0x4f33('0x28')](handleEntityNotFound(_0x1d6d5f,null))[_0x4f33('0x28')](respondWithResult(_0x1d6d5f,null))[_0x4f33('0x55')](handleError(_0x1d6d5f,null));};exports[_0x4f33('0x29')]=function(_0x22cfb0,_0x94f133){return db[_0x4f33('0x3d')][_0x4f33('0x35')]({'where':{'id':_0x22cfb0[_0x4f33('0x57')]['id']}})[_0x4f33('0x28')](handleEntityNotFound(_0x94f133,null))[_0x4f33('0x28')](removeEntity(_0x94f133,null))['catch'](handleError(_0x94f133,null));};exports[_0x4f33('0x58')]=function(_0x2adf47,_0x598f6d){if(_0x2adf47['body'][_0x4f33('0x34')]===_0x4f33('0x2d')&&!_[_0x4f33('0x59')](_0x2adf47['body']['exten'],'_')){_0x2adf47[_0x4f33('0x5a')][_0x4f33('0x5b')]='_'['concat'](_0x2adf47[_0x4f33('0x5a')][_0x4f33('0x5b')]);}return db['VoiceExtension'][_0x4f33('0x58')](_0x2adf47[_0x4f33('0x5a')],{'raw':![]})[_0x4f33('0x28')](function(_0x543a76){var _0x389ea5=_0x2adf47[_0x4f33('0x5c')]['get']({'plain':!![]});if(!_0x389ea5)throw new Error(_0x4f33('0x5d'));if(_0x389ea5[_0x4f33('0x5e')]===_0x4f33('0x5c')){var _0x151d0b=_0x543a76[_0x4f33('0x2a')]({'plain':!![]});var _0x1729a0=[{'name':'InboundRoutes','value':_0x4f33('0x2c')},{'name':_0x4f33('0x5f'),'value':_0x4f33('0x2d')},{'name':_0x4f33('0x2e'),'value':'internal'}];var _0x201950=_['find'](_0x1729a0,['value',_0x151d0b[_0x4f33('0x34')]])[_0x4f33('0x36')];return db[_0x4f33('0x60')]['find']({'where':{'name':_0x201950,'userProfileId':_0x389ea5[_0x4f33('0x61')]},'raw':!![]})[_0x4f33('0x28')](function(_0xfcf810){if(_0xfcf810&&_0xfcf810[_0x4f33('0x62')]===0x0){return db['UserProfileResource'][_0x4f33('0x58')]({'name':_0x151d0b[_0x4f33('0x36')],'resourceId':_0x151d0b['id'],'type':_0xfcf810[_0x4f33('0x36')],'sectionId':_0xfcf810['id']},{})['then'](function(){return _0x543a76;});}else{return _0x543a76;}})['catch'](function(_0x42a406){logger['error'](_0x4f33('0x63'),_0x42a406);throw _0x42a406;});}return _0x543a76;})[_0x4f33('0x28')](respondWithResult(_0x598f6d,0xc9))[_0x4f33('0x55')](handleError(_0x598f6d,null));};exports[_0x4f33('0x27')]=function(_0x5a79be,_0x19b66a){if(_0x5a79be[_0x4f33('0x5a')]['id']){delete _0x5a79be[_0x4f33('0x5a')]['id'];}return db[_0x4f33('0x3d')][_0x4f33('0x35')]({'where':{'id':_0x5a79be[_0x4f33('0x57')]['id']}})[_0x4f33('0x28')](handleEntityNotFound(_0x19b66a,null))[_0x4f33('0x28')](function(_0x1b13bd){if(_0x1b13bd){return db[_0x4f33('0x3d')][_0x4f33('0x27')](_[_0x4f33('0x4d')](_0x5a79be[_0x4f33('0x5a')],[_0x4f33('0x5b'),_0x4f33('0x64'),_0x4f33('0x65'),_0x4f33('0x66'),'cutdigits','mandatoryDisposition']),{'where':{'context':_0x1b13bd[_0x4f33('0x64')],'exten':_0x1b13bd[_0x4f33('0x5b')]},'individualHooks':!![]})[_0x4f33('0x28')](function(_0x6397d7){return _0x6397d7;});}return null;})[_0x4f33('0x28')](respondWithStatusCode(_0x19b66a,null))[_0x4f33('0x55')](handleError(_0x19b66a,null));};exports[_0x4f33('0x67')]=function(_0x29211b,_0x2c9c20,_0x58403a){return db['VoiceExtension'][_0x4f33('0x68')]({'where':{'id':_0x29211b[_0x4f33('0x57')]['id']}})[_0x4f33('0x28')](handleEntityNotFound(_0x2c9c20,null))[_0x4f33('0x28')](function(_0x404d5f){if(_0x404d5f){return db['sequelize'][_0x4f33('0x69')](function(_0x33e16e){return db[_0x4f33('0x3d')]['destroy']({'where':{'VoiceExtensionId':_0x29211b['params']['id']},'transaction':_0x33e16e})[_0x4f33('0x28')](function(_0x3bbb0a){var _0x3ae013=_[_0x4f33('0x31')](_0x29211b['body'],function(_0x3eac83){_0x3eac83[_0x4f33('0x6a')]=_0x29211b[_0x4f33('0x57')]['id'];return _0x3eac83;});return db[_0x4f33('0x3d')]['bulkCreate'](_0x3ae013,{'transaction':_0x33e16e});});})[_0x4f33('0x28')](function(){return db[_0x4f33('0x3d')][_0x4f33('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x29211b['params']['id']},'order':_0x4f33('0x6c')});});}})[_0x4f33('0x28')](respondWithResult(_0x2c9c20,null))[_0x4f33('0x55')](handleError(_0x2c9c20,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index eca2340..2f0873e 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 _0xf151=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x310747,_0x6dde4){var _0x9ca0ea=function(_0x46d86a){while(--_0x46d86a){_0x310747['push'](_0x310747['shift']());}};_0x9ca0ea(++_0x6dde4);}(_0xf151,0x183));var _0x1f15=function(_0x3d9edf,_0x900c7f){_0x3d9edf=_0x3d9edf-0x0;var _0x2ef086=_0xf151[_0x3d9edf];return _0x2ef086;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x1f15('0x0'))['db'][_0x1f15('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1f15('0x2')](0x0);var events={'afterCreate':_0x1f15('0x3'),'afterUpdate':_0x1f15('0x4'),'afterDestroy':_0x1f15('0x5')};function emitEvent(_0x2b98d2){return function(_0x236af4,_0x3e85ae,_0x532093){VoiceExtensionEvents[_0x1f15('0x6')](_0x2b98d2+':'+_0x236af4['id'],_0x236af4);VoiceExtensionEvents[_0x1f15('0x6')](_0x2b98d2,_0x236af4);_0x532093(null);};}for(var e in events){if(events[_0x1f15('0x7')](e)){var event=events[e];VoiceExtension[_0x1f15('0x8')](e,emitEvent(event));}}module[_0x1f15('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x75af=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x553ac2,_0x156cf0){var _0x2182d8=function(_0x594e0f){while(--_0x594e0f){_0x553ac2['push'](_0x553ac2['shift']());}};_0x2182d8(++_0x156cf0);}(_0x75af,0x17d));var _0xf75a=function(_0x31d362,_0x13b5e1){_0x31d362=_0x31d362-0x0;var _0x35d38e=_0x75af[_0x31d362];return _0x35d38e;};'use strict';var EventEmitter=require(_0xf75a('0x0'));var VoiceExtension=require(_0xf75a('0x1'))['db'][_0xf75a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf75a('0x3')](0x0);var events={'afterCreate':_0xf75a('0x4'),'afterUpdate':_0xf75a('0x5'),'afterDestroy':_0xf75a('0x6')};function emitEvent(_0x279e31){return function(_0x293a69,_0x571d5f,_0x25742d){VoiceExtensionEvents[_0xf75a('0x7')](_0x279e31+':'+_0x293a69['id'],_0x293a69);VoiceExtensionEvents[_0xf75a('0x7')](_0x279e31,_0x293a69);_0x25742d(null);};}for(var e in events){if(events[_0xf75a('0x8')](e)){var event=events[e];VoiceExtension[_0xf75a('0x9')](e,emitEvent(event));}}module[_0xf75a('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 1b97dd6..011a088 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 _0x6ad7=['path','./voiceExtension.attributes','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x6ad7,0x1bb));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ad('0x0'));var util=require(_0x76ad('0x1'));var logger=require(_0x76ad('0x2'))(_0x76ad('0x3'));var moment=require(_0x76ad('0x4'));var BPromise=require(_0x76ad('0x5'));var rp=require(_0x76ad('0x6'));var fs=require('fs');var path=require(_0x76ad('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x76ad('0x8'));module['exports']=function(_0x56a3fc,_0x4f5e26){return _0x56a3fc['define']('VoiceExtension',attributes,{'tableName':_0x76ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0837=['VoiceExtension','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define'];(function(_0x9c99a5,_0xae8147){var _0xf30677=function(_0x481f28){while(--_0x481f28){_0x9c99a5['push'](_0x9c99a5['shift']());}};_0xf30677(++_0xae8147);}(_0x0837,0x1d5));var _0x7083=function(_0x1994eb,_0x3d19ce){_0x1994eb=_0x1994eb-0x0;var _0x29be96=_0x0837[_0x1994eb];return _0x29be96;};'use strict';var _=require(_0x7083('0x0'));var util=require('util');var logger=require(_0x7083('0x1'))(_0x7083('0x2'));var moment=require(_0x7083('0x3'));var BPromise=require(_0x7083('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7083('0x5'));var rimraf=require(_0x7083('0x6'));var config=require(_0x7083('0x7'));var attributes=require(_0x7083('0x8'));module[_0x7083('0x9')]=function(_0x11b0d3,_0x458258){return _0x11b0d3[_0x7083('0xa')](_0x7083('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3670814..713bd58 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 _0xd0c1=['attributes','limit','include','map','model','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0c1,0x1db));var _0x1d0c=function(_0x97c824,_0x3bfa13){_0x97c824=_0x97c824-0x0;var _0x1c271c=_0xd0c1[_0x97c824];return _0x1c271c;};'use strict';var _=require(_0x1d0c('0x0'));var util=require('util');var moment=require(_0x1d0c('0x1'));var BPromise=require(_0x1d0c('0x2'));var rs=require(_0x1d0c('0x3'));var fs=require('fs');var Redis=require(_0x1d0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d0c('0x5'));var logger=require(_0x1d0c('0x6'))(_0x1d0c('0x7'));var config=require(_0x1d0c('0x8'));var jayson=require(_0x1d0c('0x9'));var client=jayson['client'][_0x1d0c('0xa')]({'port':0x232a});config[_0x1d0c('0xb')]=_[_0x1d0c('0xc')](config['redis'],{'host':_0x1d0c('0xd'),'port':0x18eb});var socket=require(_0x1d0c('0xe'))(new Redis(config['redis']));require(_0x1d0c('0xf'))[_0x1d0c('0x10')](socket);function respondWithRpcPromise(_0x5597bd,_0x441d2c,_0x3abc72){return new BPromise(function(_0x5733bb,_0x2868d4){return client[_0x1d0c('0x11')](_0x5597bd,_0x3abc72)['then'](function(_0x37fadd){logger[_0x1d0c('0x12')](_0x1d0c('0x13'),_0x441d2c,_0x1d0c('0x14'));logger['debug'](_0x1d0c('0x15'),_0x441d2c,_0x1d0c('0x14'),JSON[_0x1d0c('0x16')](_0x37fadd));if(_0x37fadd[_0x1d0c('0x17')]){if(_0x37fadd['error']['code']===0x1f4){logger[_0x1d0c('0x17')](_0x1d0c('0x13'),_0x441d2c,_0x37fadd[_0x1d0c('0x17')][_0x1d0c('0x18')]);return _0x2868d4(_0x37fadd[_0x1d0c('0x17')]['message']);}logger[_0x1d0c('0x17')](_0x1d0c('0x13'),_0x441d2c,_0x37fadd[_0x1d0c('0x17')][_0x1d0c('0x18')]);return _0x5733bb(_0x37fadd[_0x1d0c('0x17')][_0x1d0c('0x18')]);}else{logger['info'](_0x1d0c('0x13'),_0x441d2c,_0x1d0c('0x14'));_0x5733bb(_0x37fadd[_0x1d0c('0x19')][_0x1d0c('0x18')]);}})[_0x1d0c('0x1a')](function(_0x20ae33){logger[_0x1d0c('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x441d2c,_0x20ae33);_0x2868d4(_0x20ae33);});});}exports[_0x1d0c('0x1b')]=function(_0x315aa9){var _0x5a2a8b=this;return new Promise(function(_0xc4d567,_0x16b462){return db[_0x1d0c('0x1c')][_0x1d0c('0x1d')]({'raw':_0x315aa9[_0x1d0c('0x1e')]?_0x315aa9['options'][_0x1d0c('0x1f')]===undefined?!![]:![]:!![],'where':_0x315aa9[_0x1d0c('0x1e')]?_0x315aa9['options']['where']||null:null,'attributes':_0x315aa9[_0x1d0c('0x1e')]?_0x315aa9[_0x1d0c('0x1e')][_0x1d0c('0x20')]||null:null,'limit':_0x315aa9[_0x1d0c('0x1e')]?_0x315aa9[_0x1d0c('0x1e')][_0x1d0c('0x21')]||null:null,'include':_0x315aa9[_0x1d0c('0x1e')]?_0x315aa9[_0x1d0c('0x1e')][_0x1d0c('0x22')]?_[_0x1d0c('0x23')](_0x315aa9[_0x1d0c('0x1e')]['include'],function(_0x2ae65d){return{'model':db[_0x2ae65d[_0x1d0c('0x24')]],'as':_0x2ae65d['as'],'attributes':_0x2ae65d[_0x1d0c('0x20')],'include':_0x2ae65d[_0x1d0c('0x22')]?_['map'](_0x2ae65d[_0x1d0c('0x22')],function(_0x22c96b){return{'model':db[_0x22c96b[_0x1d0c('0x24')]],'as':_0x22c96b['as'],'attributes':_0x22c96b[_0x1d0c('0x20')],'include':_0x22c96b[_0x1d0c('0x22')]?_[_0x1d0c('0x23')](_0x22c96b[_0x1d0c('0x22')],function(_0x21349b){return{'model':db[_0x21349b[_0x1d0c('0x24')]],'as':_0x21349b['as'],'attributes':_0x21349b[_0x1d0c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1d0c('0x25')](function(_0x49c66f){logger['info']('GetVoiceExtension',_0x315aa9);logger[_0x1d0c('0x26')](_0x1d0c('0x1b'),_0x315aa9,JSON['stringify'](_0x49c66f));_0xc4d567(_0x49c66f);})[_0x1d0c('0x1a')](function(_0x2df480){logger[_0x1d0c('0x17')](_0x1d0c('0x1b'),_0x2df480[_0x1d0c('0x18')],_0x315aa9);_0x16b462(_0x5a2a8b[_0x1d0c('0x17')](0x1f4,_0x2df480[_0x1d0c('0x18')]));});});}; \ No newline at end of file +var _0xbc78=['message','catch','GetVoiceExtension','VoiceExtension','options','attributes','limit','map','include','model','then','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xbc78,0x7e));var _0x8bc7=function(_0x55e8a7,_0x4f5064){_0x55e8a7=_0x55e8a7-0x0;var _0x57860f=_0xbc78[_0x55e8a7];return _0x57860f;};'use strict';var _=require(_0x8bc7('0x0'));var util=require(_0x8bc7('0x1'));var moment=require(_0x8bc7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc7('0x3'));var db=require(_0x8bc7('0x4'))['db'];var utils=require(_0x8bc7('0x5'));var logger=require(_0x8bc7('0x6'))(_0x8bc7('0x7'));var config=require(_0x8bc7('0x8'));var jayson=require(_0x8bc7('0x9'));var client=jayson[_0x8bc7('0xa')][_0x8bc7('0xb')]({'port':0x232a});config[_0x8bc7('0xc')]=_[_0x8bc7('0xd')](config['redis'],{'host':_0x8bc7('0xe'),'port':0x18eb});var socket=require(_0x8bc7('0xf'))(new Redis(config[_0x8bc7('0xc')]));require(_0x8bc7('0x10'))[_0x8bc7('0x11')](socket);function respondWithRpcPromise(_0xa0282d,_0x2bca9e,_0x1b9c1c){return new BPromise(function(_0x186c52,_0x92ecb2){return client[_0x8bc7('0x12')](_0xa0282d,_0x1b9c1c)['then'](function(_0x4b4038){logger[_0x8bc7('0x13')](_0x8bc7('0x14'),_0x2bca9e,_0x8bc7('0x15'));logger['debug'](_0x8bc7('0x16'),_0x2bca9e,_0x8bc7('0x15'),JSON[_0x8bc7('0x17')](_0x4b4038));if(_0x4b4038[_0x8bc7('0x18')]){if(_0x4b4038[_0x8bc7('0x18')][_0x8bc7('0x19')]===0x1f4){logger['error'](_0x8bc7('0x14'),_0x2bca9e,_0x4b4038[_0x8bc7('0x18')]['message']);return _0x92ecb2(_0x4b4038[_0x8bc7('0x18')][_0x8bc7('0x1a')]);}logger[_0x8bc7('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x2bca9e,_0x4b4038[_0x8bc7('0x18')][_0x8bc7('0x1a')]);return _0x186c52(_0x4b4038[_0x8bc7('0x18')][_0x8bc7('0x1a')]);}else{logger[_0x8bc7('0x13')](_0x8bc7('0x14'),_0x2bca9e,_0x8bc7('0x15'));_0x186c52(_0x4b4038['result'][_0x8bc7('0x1a')]);}})[_0x8bc7('0x1b')](function(_0x4377df){logger[_0x8bc7('0x18')](_0x8bc7('0x14'),_0x2bca9e,_0x4377df);_0x92ecb2(_0x4377df);});});}exports[_0x8bc7('0x1c')]=function(_0x3e9cd6){var _0x3cea85=this;return new Promise(function(_0x596593,_0x307458){return db[_0x8bc7('0x1d')]['findAll']({'raw':_0x3e9cd6[_0x8bc7('0x1e')]?_0x3e9cd6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e9cd6[_0x8bc7('0x1e')]?_0x3e9cd6[_0x8bc7('0x1e')]['where']||null:null,'attributes':_0x3e9cd6[_0x8bc7('0x1e')]?_0x3e9cd6['options'][_0x8bc7('0x1f')]||null:null,'limit':_0x3e9cd6[_0x8bc7('0x1e')]?_0x3e9cd6[_0x8bc7('0x1e')][_0x8bc7('0x20')]||null:null,'include':_0x3e9cd6['options']?_0x3e9cd6[_0x8bc7('0x1e')]['include']?_[_0x8bc7('0x21')](_0x3e9cd6[_0x8bc7('0x1e')][_0x8bc7('0x22')],function(_0x4a277b){return{'model':db[_0x4a277b[_0x8bc7('0x23')]],'as':_0x4a277b['as'],'attributes':_0x4a277b['attributes'],'include':_0x4a277b[_0x8bc7('0x22')]?_[_0x8bc7('0x21')](_0x4a277b[_0x8bc7('0x22')],function(_0x4dea47){return{'model':db[_0x4dea47['model']],'as':_0x4dea47['as'],'attributes':_0x4dea47[_0x8bc7('0x1f')],'include':_0x4dea47[_0x8bc7('0x22')]?_['map'](_0x4dea47[_0x8bc7('0x22')],function(_0x3b2590){return{'model':db[_0x3b2590['model']],'as':_0x3b2590['as'],'attributes':_0x3b2590[_0x8bc7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8bc7('0x24')](function(_0x2fc6a2){logger[_0x8bc7('0x13')](_0x8bc7('0x1c'),_0x3e9cd6);logger[_0x8bc7('0x25')]('GetVoiceExtension',_0x3e9cd6,JSON[_0x8bc7('0x17')](_0x2fc6a2));_0x596593(_0x2fc6a2);})['catch'](function(_0x13607f){logger['error'](_0x8bc7('0x1c'),_0x13607f['message'],_0x3e9cd6);_0x307458(_0x3cea85['error'](0x1f4,_0x13607f[_0x8bc7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8e5a1f2..4f90407 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 _0xe35e=['removeListener','length','voiceExtension:','save','remove','update','emit'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xe35e,0x176));var _0xee35=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xe35e[_0x305486];return _0xa04940;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xee35('0x0'),_0xee35('0x1'),_0xee35('0x2')];function createListener(_0xc3087,_0xf3c4f0){return function(_0x4eea16){_0xf3c4f0[_0xee35('0x3')](_0xc3087,_0x4eea16);};}function removeListener(_0x55bca5,_0x1c64b3){return function(){VoiceExtensionEvents[_0xee35('0x4')](_0x55bca5,_0x1c64b3);};}exports['register']=function(_0x3c17a4){for(var _0x3ca43d=0x0,_0x4f4d53=events[_0xee35('0x5')];_0x3ca43d<_0x4f4d53;_0x3ca43d++){var _0x31ba03=events[_0x3ca43d];var _0x278c40=createListener(_0xee35('0x6')+_0x31ba03,_0x3c17a4);VoiceExtensionEvents['on'](_0x31ba03,_0x278c40);}}; \ No newline at end of file +var _0x7a34=['./voiceExtension.events','save','remove','update','register'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x7a34,0xb9));var _0x47a3=function(_0x2a11d8,_0x92cecc){_0x2a11d8=_0x2a11d8-0x0;var _0x9f2a5e=_0x7a34[_0x2a11d8];return _0x9f2a5e;};'use strict';var VoiceExtensionEvents=require(_0x47a3('0x0'));var events=[_0x47a3('0x1'),_0x47a3('0x2'),_0x47a3('0x3')];function createListener(_0x2dc627,_0x3744d1){return function(_0x9e1c96){_0x3744d1['emit'](_0x2dc627,_0x9e1c96);};}function removeListener(_0x4a1183,_0x3d632){return function(){VoiceExtensionEvents['removeListener'](_0x4a1183,_0x3d632);};}exports[_0x47a3('0x4')]=function(_0x30613f){for(var _0x3ed12f=0x0,_0x1ca6a8=events['length'];_0x3ed12f<_0x1ca6a8;_0x3ed12f++){var _0xa21663=events[_0x3ed12f];var _0xfd5435=createListener('voiceExtension:'+_0xa21663,_0x30613f);VoiceExtensionEvents['on'](_0xa21663,_0xfd5435);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 55ffc1d..dd5e1b7 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 _0x2cca=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','delete','destroy'];(function(_0x3e4aea,_0x2aa3c3){var _0x717b9b=function(_0xbcfb28){while(--_0xbcfb28){_0x3e4aea['push'](_0x3e4aea['shift']());}};_0x717b9b(++_0x2aa3c3);}(_0x2cca,0x1e5));var _0xa2cc=function(_0x3cfb5d,_0x50cdd7){_0x3cfb5d=_0x3cfb5d-0x0;var _0x329c6c=_0x2cca[_0x3cfb5d];return _0x329c6c;};'use strict';var multer=require(_0xa2cc('0x0'));var util=require(_0xa2cc('0x1'));var path=require(_0xa2cc('0x2'));var timeout=require(_0xa2cc('0x3'));var express=require(_0xa2cc('0x4'));var router=express[_0xa2cc('0x5')]();var auth=require(_0xa2cc('0x6'));var interaction=require(_0xa2cc('0x7'));var config=require(_0xa2cc('0x8'));var controller=require('./voiceMail.controller');router[_0xa2cc('0x9')]('/',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0xb')]);router['get'](_0xa2cc('0xc'),auth[_0xa2cc('0xa')](),controller[_0xa2cc('0xd')]);router[_0xa2cc('0x9')](_0xa2cc('0xe'),auth[_0xa2cc('0xa')](),controller[_0xa2cc('0xf')]);router[_0xa2cc('0x10')]('/',auth[_0xa2cc('0xa')](),controller['create']);router[_0xa2cc('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa2cc('0x12')]);router[_0xa2cc('0x13')]('/:id',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x14')]);module[_0xa2cc('0x15')]=router; \ No newline at end of file +var _0x3939=['index','/:id','isAuthenticated','/:id/messages','getMessages','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x3939,0x89));var _0x9393=function(_0xe4643a,_0x91d384){_0xe4643a=_0xe4643a-0x0;var _0x3e4561=_0x3939[_0xe4643a];return _0x3e4561;};'use strict';var multer=require(_0x9393('0x0'));var util=require(_0x9393('0x1'));var path=require('path');var timeout=require(_0x9393('0x2'));var express=require('express');var router=express[_0x9393('0x3')]();var auth=require(_0x9393('0x4'));var interaction=require(_0x9393('0x5'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x9393('0x6')]('/',auth['isAuthenticated'](),controller[_0x9393('0x7')]);router[_0x9393('0x6')](_0x9393('0x8'),auth[_0x9393('0x9')](),controller['show']);router['get'](_0x9393('0xa'),auth[_0x9393('0x9')](),controller[_0x9393('0xb')]);router[_0x9393('0xc')]('/',auth[_0x9393('0x9')](),controller['create']);router[_0x9393('0xd')](_0x9393('0x8'),auth[_0x9393('0x9')](),controller[_0x9393('0xe')]);router[_0x9393('0xf')](_0x9393('0x8'),auth[_0x9393('0x9')](),controller[_0x9393('0x10')]);module[_0x9393('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 65eae3e..72062d4 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 _0xb688=['STRING','from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0xb688,0xcf));var _0x8b68=function(_0x1689b0,_0x278b61){_0x1689b0=_0x1689b0-0x0;var _0x5c11ae=_0xb688[_0x1689b0];return _0x5c11ae;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'customer_id':{'type':Sequelize[_0x8b68('0x1')]},'context':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x2'),'unique':_0x8b68('0x3')},'mailbox':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x8b68('0x1')]},'fullname':{'type':Sequelize[_0x8b68('0x1')]},'email':{'type':Sequelize[_0x8b68('0x1')],'validate':{'isEmail':!![]},'set':function(_0x12d40e){this['setDataValue'](_0x8b68('0x4'),typeof _0x12d40e==='string'&&_0x12d40e[_0x8b68('0x5')]()?_0x12d40e[_0x8b68('0x5')]():null);}},'pager':{'type':Sequelize[_0x8b68('0x1')]},'tz':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x6')},'attach':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8b68('0x1')]},'callback':{'type':Sequelize[_0x8b68('0x1')]},'review':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8b68('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'stamp':{'type':_0x8b68('0xa')},'emailsubject':{'type':Sequelize[_0x8b68('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8b68('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8b68('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8b68('0xc')](_0x8b68('0xd'))+_0x8b68('0xe')+this[_0x8b68('0xc')](_0x8b68('0xf'));}}}; \ No newline at end of file +var _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x2e90e5,_0x25117c){var _0x1271b1=function(_0x4bad5c){while(--_0x4bad5c){_0x2e90e5['push'](_0x2e90e5['shift']());}};_0x1271b1(++_0x25117c);}(_0x13f6,0x124));var _0x613f=function(_0x33ef9d,_0x5e6403){_0x33ef9d=_0x33ef9d-0x0;var _0x4dc253=_0x13f6[_0x33ef9d];return _0x4dc253;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x613f('0x2'),'unique':_0x613f('0x3')},'mailbox':{'type':Sequelize[_0x613f('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x613f('0x4')]},'fullname':{'type':Sequelize[_0x613f('0x4')]},'email':{'type':Sequelize[_0x613f('0x4')],'validate':{'isEmail':!![]},'set':function(_0x5c9aa9){this[_0x613f('0x5')](_0x613f('0x6'),typeof _0x5c9aa9==='string'&&_0x5c9aa9['trim']()?_0x5c9aa9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x613f('0x4')],'defaultValue':_0x613f('0x7')},'attach':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x613f('0x4')]},'review':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x613f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x613f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'stamp':{'type':_0x613f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x613f('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x613f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x613f('0xd')],'get':function(){return this[_0x613f('0xe')](_0x613f('0xf'))+_0x613f('0x10')+this[_0x613f('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aa731ad..a1203ee 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 _0xc373=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','VoiceMail','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','userProfileId','autoAssociation','UserProfileResource','error','body','destroy','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','set','Content-Range','update','then','get','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2bbac4,_0x15c35a){var _0x4017df=function(_0x120ac5){while(--_0x120ac5){_0x2bbac4['push'](_0x2bbac4['shift']());}};_0x4017df(++_0x15c35a);}(_0xc373,0x1c7));var _0x3c37=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0xc373[_0x19d24c];return _0x2fae8d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c37('0x0'));var rimraf=require(_0x3c37('0x1'));var zipdir=require(_0x3c37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c37('0x3'));var BPromise=require(_0x3c37('0x4'));var Mustache=require(_0x3c37('0x5'));var util=require(_0x3c37('0x6'));var path=require(_0x3c37('0x7'));var sox=require(_0x3c37('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c37('0x9'));var squel=require(_0x3c37('0xa'));var crypto=require(_0x3c37('0xb'));var jsforce=require(_0x3c37('0xc'));var deskjs=require(_0x3c37('0xd'));var toCsv=require(_0x3c37('0xe'));var querystring=require(_0x3c37('0xf'));var Papa=require(_0x3c37('0x10'));var Redis=require(_0x3c37('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c37('0x12'));var hardwareService=require(_0x3c37('0x13'));var logger=require(_0x3c37('0x14'))(_0x3c37('0x15'));var utils=require(_0x3c37('0x16'));var config=require(_0x3c37('0x17'));var licenseUtil=require(_0x3c37('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc333c2,_0x454f92){_0x454f92=_0x454f92||0xcc;return function(_0x458002){if(_0x458002){return _0xc333c2['sendStatus'](_0x454f92);}return _0xc333c2['status'](_0x454f92)[_0x3c37('0x19')]();};}function respondWithResult(_0x57c33f,_0x52ab1f){_0x52ab1f=_0x52ab1f||0xc8;return function(_0x37904b){if(_0x37904b){return _0x57c33f[_0x3c37('0x1a')](_0x52ab1f)[_0x3c37('0x1b')](_0x37904b);}};}function respondWithFilteredResult(_0x1b70a6,_0x1268b3){return function(_0x22e851){if(_0x22e851){var _0x25d36e=_0x22e851[_0x3c37('0x1c')],_0x40d3ee=_0x1268b3[_0x3c37('0x1d')],_0x294ea3=_0x1268b3['offset']+_0x1268b3['limit'],_0x4e1560;if(_0x294ea3>=_0x25d36e){_0x294ea3=_0x25d36e;_0x4e1560=0xc8;}else{_0x4e1560=0xce;}_0x1b70a6[_0x3c37('0x1a')](_0x4e1560);return _0x1b70a6[_0x3c37('0x1e')](_0x3c37('0x1f'),_0x40d3ee+'-'+_0x294ea3+'/'+_0x25d36e)[_0x3c37('0x1b')](_0x22e851);}return null;};}function patchUpdates(_0x22de19){return function(_0x2b0f25){try{jsonpatch['apply'](_0x2b0f25,_0x22de19,!![]);}catch(_0x97c790){return BPromise['reject'](_0x97c790);}return _0x2b0f25['save']();};}function saveUpdates(_0x3bc0bb,_0x2882ba){return function(_0x46f60e){if(_0x46f60e){return _0x46f60e[_0x3c37('0x20')](_0x3bc0bb)[_0x3c37('0x21')](function(_0x5903ee){return _0x5903ee;});}return null;};}function removeEntity(_0x27f83e,_0x54776f){return function(_0x3399a7){if(_0x3399a7){return _0x3399a7['destroy']()[_0x3c37('0x21')](function(){var _0x2e4226=_0x3399a7[_0x3c37('0x22')]({'plain':!![]});var _0x574890='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x574890,'resourceId':_0x2e4226['id']}})['then'](function(){return _0x3399a7;});})[_0x3c37('0x21')](function(){_0x27f83e[_0x3c37('0x1a')](0xcc)[_0x3c37('0x19')]();});}};}function handleEntityNotFound(_0x3ab6bd,_0x5dc9af){return function(_0x52b5d9){if(!_0x52b5d9){_0x3ab6bd['sendStatus'](0x194);}return _0x52b5d9;};}function handleError(_0x65ac66,_0x163720){_0x163720=_0x163720||0x1f4;return function(_0x5e1df2){logger['error'](_0x5e1df2[_0x3c37('0x23')]);if(_0x5e1df2[_0x3c37('0x24')]){delete _0x5e1df2[_0x3c37('0x24')];}_0x65ac66[_0x3c37('0x1a')](_0x163720)[_0x3c37('0x25')](_0x5e1df2);};}exports[_0x3c37('0x26')]=function(_0x1ce403,_0x3abacf){var _0x415999={},_0xf1d5cb={},_0x5ebf81={'count':0x0,'rows':[]};var _0x22cf15=_[_0x3c37('0x27')](db['VoiceMail']['rawAttributes'],function(_0x14936d){return{'name':_0x14936d[_0x3c37('0x28')],'type':_0x14936d[_0x3c37('0x29')]['key']};});_0xf1d5cb[_0x3c37('0x2a')]=_['map'](_0x22cf15,_0x3c37('0x24'));_0xf1d5cb[_0x3c37('0x2b')]=_[_0x3c37('0x2c')](_0x1ce403[_0x3c37('0x2b')]);_0xf1d5cb[_0x3c37('0x2d')]=_[_0x3c37('0x2e')](_0xf1d5cb[_0x3c37('0x2a')],_0xf1d5cb[_0x3c37('0x2b')]);_0x415999[_0x3c37('0x2f')]=_[_0x3c37('0x2e')](_0xf1d5cb['model'],qs['fields'](_0x1ce403['query'][_0x3c37('0x30')]));_0x415999[_0x3c37('0x2f')]=_0x415999[_0x3c37('0x2f')][_0x3c37('0x31')]?_0x415999[_0x3c37('0x2f')]:_0xf1d5cb[_0x3c37('0x2a')];if(!_0x1ce403[_0x3c37('0x2b')][_0x3c37('0x32')](_0x3c37('0x33'))){_0x415999[_0x3c37('0x34')]=qs[_0x3c37('0x34')](_0x1ce403[_0x3c37('0x2b')]['limit']);_0x415999[_0x3c37('0x1d')]=qs[_0x3c37('0x1d')](_0x1ce403['query']['offset']);}_0x415999[_0x3c37('0x35')]=qs[_0x3c37('0x36')](_0x1ce403[_0x3c37('0x2b')][_0x3c37('0x36')]);_0x415999[_0x3c37('0x37')]=qs[_0x3c37('0x2d')](_[_0x3c37('0x38')](_0x1ce403[_0x3c37('0x2b')],_0xf1d5cb[_0x3c37('0x2d')]),_0x22cf15);if(_0x1ce403['query'][_0x3c37('0x39')]){_0x415999[_0x3c37('0x37')]=_[_0x3c37('0x3a')](_0x415999[_0x3c37('0x37')],{'$or':_[_0x3c37('0x27')](_0x22cf15,function(_0x41733f){if(_0x41733f[_0x3c37('0x29')]!==_0x3c37('0x3b')){var _0x3356d0={};_0x3356d0[_0x41733f[_0x3c37('0x24')]]={'$like':'%'+_0x1ce403['query'][_0x3c37('0x39')]+'%'};return _0x3356d0;}})});}_0x415999=_[_0x3c37('0x3a')]({},_0x415999,_0x1ce403[_0x3c37('0x3c')]);var _0xab1900={'where':_0x415999[_0x3c37('0x37')]};return db['VoiceMail'][_0x3c37('0x1c')](_0xab1900)[_0x3c37('0x21')](function(_0x36e060){_0x5ebf81[_0x3c37('0x1c')]=_0x36e060;if(_0x1ce403['query'][_0x3c37('0x3d')]){_0x415999['include']=[{'all':!![]}];}return db[_0x3c37('0x3e')]['findAll'](_0x415999);})[_0x3c37('0x21')](function(_0x90e1c5){_0x5ebf81[_0x3c37('0x3f')]=_0x90e1c5;return _0x5ebf81;})['then'](respondWithFilteredResult(_0x3abacf,_0x415999))[_0x3c37('0x40')](handleError(_0x3abacf,null));};exports[_0x3c37('0x41')]=function(_0x2e82d0,_0x2a4300){var _0x611518={'raw':!![],'where':{'id':_0x2e82d0[_0x3c37('0x42')]['id']}},_0x4f3bf1={};_0x4f3bf1[_0x3c37('0x2a')]=_[_0x3c37('0x2c')](db[_0x3c37('0x3e')][_0x3c37('0x43')]);_0x4f3bf1[_0x3c37('0x2b')]=_[_0x3c37('0x2c')](_0x2e82d0['query']);_0x4f3bf1[_0x3c37('0x2d')]=_[_0x3c37('0x2e')](_0x4f3bf1[_0x3c37('0x2a')],_0x4f3bf1['query']);_0x611518[_0x3c37('0x2f')]=_['intersection'](_0x4f3bf1[_0x3c37('0x2a')],qs[_0x3c37('0x30')](_0x2e82d0[_0x3c37('0x2b')][_0x3c37('0x30')]));_0x611518['attributes']=_0x611518['attributes']['length']?_0x611518[_0x3c37('0x2f')]:_0x4f3bf1[_0x3c37('0x2a')];if(_0x2e82d0['query']['includeAll']){_0x611518[_0x3c37('0x44')]=[{'all':!![]}];}_0x611518=_['merge']({},_0x611518,_0x2e82d0[_0x3c37('0x3c')]);return db[_0x3c37('0x3e')][_0x3c37('0x45')](_0x611518)[_0x3c37('0x21')](handleEntityNotFound(_0x2a4300,null))[_0x3c37('0x21')](respondWithResult(_0x2a4300,null))[_0x3c37('0x40')](handleError(_0x2a4300,null));};exports[_0x3c37('0x46')]=function(_0x39457e,_0x26396f){return db[_0x3c37('0x3e')][_0x3c37('0x46')](_0x39457e['body'],{})[_0x3c37('0x21')](function(_0x1869ad){var _0x4b8351=_0x39457e[_0x3c37('0x47')][_0x3c37('0x22')]({'plain':!![]});if(!_0x4b8351)throw new Error(_0x3c37('0x48'));if(_0x4b8351['role']===_0x3c37('0x47')){var _0x4c7686=_0x1869ad[_0x3c37('0x22')]({'plain':!![]});var _0xaa6056=_0x3c37('0x49');return db['UserProfileSection'][_0x3c37('0x45')]({'where':{'name':_0xaa6056,'userProfileId':_0x4b8351[_0x3c37('0x4a')]},'raw':!![]})[_0x3c37('0x21')](function(_0x158274){if(_0x158274&&_0x158274[_0x3c37('0x4b')]===0x0){return db[_0x3c37('0x4c')][_0x3c37('0x46')]({'name':_0x4c7686[_0x3c37('0x24')],'resourceId':_0x4c7686['id'],'type':_0x158274[_0x3c37('0x24')],'sectionId':_0x158274['id']},{})[_0x3c37('0x21')](function(){return _0x1869ad;});}else{return _0x1869ad;}})[_0x3c37('0x40')](function(_0x2aee66){logger[_0x3c37('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aee66);throw _0x2aee66;});}return _0x1869ad;})[_0x3c37('0x21')](respondWithResult(_0x26396f,0xc9))[_0x3c37('0x40')](handleError(_0x26396f,null));};exports[_0x3c37('0x20')]=function(_0x5803a6,_0x22d44e){if(_0x5803a6[_0x3c37('0x4e')]['id']){delete _0x5803a6[_0x3c37('0x4e')]['id'];}return db['VoiceMail'][_0x3c37('0x45')]({'where':{'id':_0x5803a6[_0x3c37('0x42')]['id']}})[_0x3c37('0x21')](handleEntityNotFound(_0x22d44e,null))[_0x3c37('0x21')](saveUpdates(_0x5803a6[_0x3c37('0x4e')],null))['then'](respondWithResult(_0x22d44e,null))[_0x3c37('0x40')](handleError(_0x22d44e,null));};exports[_0x3c37('0x4f')]=function(_0x68950b,_0x314b21){return db['VoiceMail']['find']({'where':{'id':_0x68950b[_0x3c37('0x42')]['id']}})['then'](handleEntityNotFound(_0x314b21,null))[_0x3c37('0x21')](removeEntity(_0x314b21,null))[_0x3c37('0x40')](handleError(_0x314b21,null));};exports[_0x3c37('0x50')]=function(_0x5c8757,_0x4c7042,_0x24fded){return db[_0x3c37('0x3e')][_0x3c37('0x51')]({'where':{'id':_0x5c8757[_0x3c37('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c7042,null))[_0x3c37('0x21')](function(_0x1858bf){var _0x56d3d2;var _0x548e2d={},_0x41117f={};_0x41117f['model']=_[_0x3c37('0x2c')](db[_0x3c37('0x52')][_0x3c37('0x43')]);_0x41117f[_0x3c37('0x2b')]=_['keys'](_0x5c8757[_0x3c37('0x2b')]);_0x41117f['filters']=_[_0x3c37('0x2e')](_0x41117f[_0x3c37('0x2a')],_0x41117f[_0x3c37('0x2b')]);_0x548e2d[_0x3c37('0x2f')]=_['intersection'](_0x41117f[_0x3c37('0x2a')],qs['fields'](_0x5c8757[_0x3c37('0x2b')][_0x3c37('0x30')]));_0x548e2d[_0x3c37('0x2f')]=_0x548e2d['attributes'][_0x3c37('0x31')]?_0x548e2d[_0x3c37('0x2f')]:_0x41117f['model'];if(!_0x5c8757[_0x3c37('0x2b')][_0x3c37('0x32')](_0x3c37('0x33'))){_0x548e2d['limit']=qs[_0x3c37('0x34')](_0x5c8757[_0x3c37('0x2b')]['limit']);_0x548e2d['offset']=qs['offset'](_0x5c8757[_0x3c37('0x2b')][_0x3c37('0x1d')]);}_0x548e2d[_0x3c37('0x35')]=qs[_0x3c37('0x36')](_0x5c8757[_0x3c37('0x2b')][_0x3c37('0x36')]);_0x548e2d[_0x3c37('0x37')]=qs[_0x3c37('0x2d')](_[_0x3c37('0x38')](_0x5c8757[_0x3c37('0x2b')],_0x41117f[_0x3c37('0x2d')]));if(_0x5c8757[_0x3c37('0x2b')][_0x3c37('0x39')]){_0x548e2d['where']=_[_0x3c37('0x3a')](_0x548e2d[_0x3c37('0x37')],{'$or':_[_0x3c37('0x27')](_0x548e2d[_0x3c37('0x2f')],function(_0x2e84f2){var _0x4d0e11={};_0x4d0e11[_0x2e84f2]={'$like':'%'+_0x5c8757[_0x3c37('0x2b')][_0x3c37('0x39')]+'%'};return _0x4d0e11;})});}_0x548e2d[_0x3c37('0x37')]=_[_0x3c37('0x3a')](_0x548e2d[_0x3c37('0x37')],{'mailboxuser':_0x1858bf['mailbox']});_0x548e2d=_['merge']({},_0x548e2d,_0x5c8757['options']);return db[_0x3c37('0x52')][_0x3c37('0x53')](_0x548e2d)[_0x3c37('0x21')](respondWithFilteredResult(_0x4c7042,_0x548e2d));})['catch'](handleError(_0x4c7042,null));}; \ No newline at end of file +var _0xdf92=['params','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','count','offset','limit','set','save','update','then','destroy','get','Voicemails','UserProfileResource','sendStatus','stack','name','index','map','VoiceMail','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x3664d3,_0x2799ac){var _0x458ad0=function(_0x7665dd){while(--_0x7665dd){_0x3664d3['push'](_0x3664d3['shift']());}};_0x458ad0(++_0x2799ac);}(_0xdf92,0x10c));var _0x2df9=function(_0x12d635,_0x2704e4){_0x12d635=_0x12d635-0x0;var _0x54ecef=_0xdf92[_0x12d635];return _0x54ecef;};'use strict';var pdf=require(_0x2df9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2df9('0x1'));var jsonpatch=require(_0x2df9('0x2'));var rp=require(_0x2df9('0x3'));var moment=require(_0x2df9('0x4'));var BPromise=require(_0x2df9('0x5'));var Mustache=require(_0x2df9('0x6'));var util=require(_0x2df9('0x7'));var path=require(_0x2df9('0x8'));var sox=require(_0x2df9('0x9'));var csv=require(_0x2df9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2df9('0xb'));var squel=require(_0x2df9('0xc'));var crypto=require(_0x2df9('0xd'));var jsforce=require(_0x2df9('0xe'));var deskjs=require(_0x2df9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2df9('0x10'));var Papa=require(_0x2df9('0x11'));var Redis=require(_0x2df9('0x12'));var authService=require(_0x2df9('0x13'));var qs=require(_0x2df9('0x14'));var as=require(_0x2df9('0x15'));var hardwareService=require(_0x2df9('0x16'));var logger=require(_0x2df9('0x17'))(_0x2df9('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2df9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6fc015,_0x4501a9){_0x4501a9=_0x4501a9||0xcc;return function(_0x4e643e){if(_0x4e643e){return _0x6fc015['sendStatus'](_0x4501a9);}return _0x6fc015[_0x2df9('0x1a')](_0x4501a9)[_0x2df9('0x1b')]();};}function respondWithResult(_0x23354a,_0x2be1d2){_0x2be1d2=_0x2be1d2||0xc8;return function(_0x5737dc){if(_0x5737dc){return _0x23354a[_0x2df9('0x1a')](_0x2be1d2)[_0x2df9('0x1c')](_0x5737dc);}};}function respondWithFilteredResult(_0xd96481,_0x1978ca){return function(_0x3e5ec5){if(_0x3e5ec5){var _0x544736=_0x3e5ec5[_0x2df9('0x1d')],_0x1a955a=_0x1978ca[_0x2df9('0x1e')],_0x42e773=_0x1978ca[_0x2df9('0x1e')]+_0x1978ca[_0x2df9('0x1f')],_0x5b3751;if(_0x42e773>=_0x544736){_0x42e773=_0x544736;_0x5b3751=0xc8;}else{_0x5b3751=0xce;}_0xd96481[_0x2df9('0x1a')](_0x5b3751);return _0xd96481[_0x2df9('0x20')]('Content-Range',_0x1a955a+'-'+_0x42e773+'/'+_0x544736)[_0x2df9('0x1c')](_0x3e5ec5);}return null;};}function patchUpdates(_0x5b6cb6){return function(_0x1aa810){try{jsonpatch['apply'](_0x1aa810,_0x5b6cb6,!![]);}catch(_0x449850){return BPromise['reject'](_0x449850);}return _0x1aa810[_0x2df9('0x21')]();};}function saveUpdates(_0x41535f,_0x2bf7ff){return function(_0x110d9b){if(_0x110d9b){return _0x110d9b[_0x2df9('0x22')](_0x41535f)[_0x2df9('0x23')](function(_0x254a24){return _0x254a24;});}return null;};}function removeEntity(_0x22a0a5,_0x4b70f5){return function(_0x5a1586){if(_0x5a1586){return _0x5a1586[_0x2df9('0x24')]()['then'](function(){var _0x3c3a47=_0x5a1586[_0x2df9('0x25')]({'plain':!![]});var _0x160a25=_0x2df9('0x26');return db[_0x2df9('0x27')][_0x2df9('0x24')]({'where':{'type':_0x160a25,'resourceId':_0x3c3a47['id']}})['then'](function(){return _0x5a1586;});})['then'](function(){_0x22a0a5['status'](0xcc)[_0x2df9('0x1b')]();});}};}function handleEntityNotFound(_0x5d0a20,_0x438331){return function(_0x378d13){if(!_0x378d13){_0x5d0a20[_0x2df9('0x28')](0x194);}return _0x378d13;};}function handleError(_0x19855e,_0x34ab67){_0x34ab67=_0x34ab67||0x1f4;return function(_0x84464c){logger['error'](_0x84464c[_0x2df9('0x29')]);if(_0x84464c[_0x2df9('0x2a')]){delete _0x84464c[_0x2df9('0x2a')];}_0x19855e[_0x2df9('0x1a')](_0x34ab67)['send'](_0x84464c);};}exports[_0x2df9('0x2b')]=function(_0x48e33b,_0xec5c9f){var _0x564aed={},_0x2c556a={},_0x2fc684={'count':0x0,'rows':[]};var _0x5687ab=_[_0x2df9('0x2c')](db[_0x2df9('0x2d')][_0x2df9('0x2e')],function(_0x1e010f){return{'name':_0x1e010f['fieldName'],'type':_0x1e010f[_0x2df9('0x2f')]['key']};});_0x2c556a[_0x2df9('0x30')]=_[_0x2df9('0x2c')](_0x5687ab,_0x2df9('0x2a'));_0x2c556a[_0x2df9('0x31')]=_[_0x2df9('0x32')](_0x48e33b[_0x2df9('0x31')]);_0x2c556a['filters']=_[_0x2df9('0x33')](_0x2c556a[_0x2df9('0x30')],_0x2c556a[_0x2df9('0x31')]);_0x564aed[_0x2df9('0x34')]=_[_0x2df9('0x33')](_0x2c556a[_0x2df9('0x30')],qs[_0x2df9('0x35')](_0x48e33b['query']['fields']));_0x564aed[_0x2df9('0x34')]=_0x564aed[_0x2df9('0x34')][_0x2df9('0x36')]?_0x564aed[_0x2df9('0x34')]:_0x2c556a[_0x2df9('0x30')];if(!_0x48e33b[_0x2df9('0x31')][_0x2df9('0x37')]('nolimit')){_0x564aed[_0x2df9('0x1f')]=qs[_0x2df9('0x1f')](_0x48e33b[_0x2df9('0x31')]['limit']);_0x564aed[_0x2df9('0x1e')]=qs[_0x2df9('0x1e')](_0x48e33b[_0x2df9('0x31')][_0x2df9('0x1e')]);}_0x564aed[_0x2df9('0x38')]=qs[_0x2df9('0x39')](_0x48e33b['query'][_0x2df9('0x39')]);_0x564aed[_0x2df9('0x3a')]=qs[_0x2df9('0x3b')](_['pick'](_0x48e33b[_0x2df9('0x31')],_0x2c556a[_0x2df9('0x3b')]),_0x5687ab);if(_0x48e33b[_0x2df9('0x31')][_0x2df9('0x3c')]){_0x564aed['where']=_[_0x2df9('0x3d')](_0x564aed['where'],{'$or':_['map'](_0x5687ab,function(_0x229e38){if(_0x229e38[_0x2df9('0x2f')]!==_0x2df9('0x3e')){var _0x265547={};_0x265547[_0x229e38['name']]={'$like':'%'+_0x48e33b[_0x2df9('0x31')][_0x2df9('0x3c')]+'%'};return _0x265547;}})});}_0x564aed=_[_0x2df9('0x3d')]({},_0x564aed,_0x48e33b[_0x2df9('0x3f')]);var _0xcc4fb={'where':_0x564aed[_0x2df9('0x3a')]};return db[_0x2df9('0x2d')][_0x2df9('0x1d')](_0xcc4fb)[_0x2df9('0x23')](function(_0x38ad21){_0x2fc684[_0x2df9('0x1d')]=_0x38ad21;if(_0x48e33b['query'][_0x2df9('0x40')]){_0x564aed[_0x2df9('0x41')]=[{'all':!![]}];}return db[_0x2df9('0x2d')][_0x2df9('0x42')](_0x564aed);})[_0x2df9('0x23')](function(_0x17b41b){_0x2fc684['rows']=_0x17b41b;return _0x2fc684;})[_0x2df9('0x23')](respondWithFilteredResult(_0xec5c9f,_0x564aed))[_0x2df9('0x43')](handleError(_0xec5c9f,null));};exports['show']=function(_0x3d1bfa,_0x5cded2){var _0xee9410={'raw':!![],'where':{'id':_0x3d1bfa[_0x2df9('0x44')]['id']}},_0x24c76d={};_0x24c76d[_0x2df9('0x30')]=_[_0x2df9('0x32')](db[_0x2df9('0x2d')][_0x2df9('0x2e')]);_0x24c76d[_0x2df9('0x31')]=_[_0x2df9('0x32')](_0x3d1bfa[_0x2df9('0x31')]);_0x24c76d[_0x2df9('0x3b')]=_[_0x2df9('0x33')](_0x24c76d[_0x2df9('0x30')],_0x24c76d[_0x2df9('0x31')]);_0xee9410['attributes']=_[_0x2df9('0x33')](_0x24c76d['model'],qs['fields'](_0x3d1bfa['query']['fields']));_0xee9410['attributes']=_0xee9410[_0x2df9('0x34')][_0x2df9('0x36')]?_0xee9410[_0x2df9('0x34')]:_0x24c76d[_0x2df9('0x30')];if(_0x3d1bfa[_0x2df9('0x31')][_0x2df9('0x40')]){_0xee9410[_0x2df9('0x41')]=[{'all':!![]}];}_0xee9410=_[_0x2df9('0x3d')]({},_0xee9410,_0x3d1bfa['options']);return db[_0x2df9('0x2d')]['find'](_0xee9410)[_0x2df9('0x23')](handleEntityNotFound(_0x5cded2,null))[_0x2df9('0x23')](respondWithResult(_0x5cded2,null))[_0x2df9('0x43')](handleError(_0x5cded2,null));};exports['create']=function(_0x2f6922,_0x23d704){return db['VoiceMail'][_0x2df9('0x45')](_0x2f6922['body'],{})[_0x2df9('0x23')](function(_0x524167){var _0x4bd0e8=_0x2f6922[_0x2df9('0x46')][_0x2df9('0x25')]({'plain':!![]});if(!_0x4bd0e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bd0e8[_0x2df9('0x47')]===_0x2df9('0x46')){var _0x15ad2d=_0x524167['get']({'plain':!![]});var _0x1d7e1f=_0x2df9('0x26');return db[_0x2df9('0x48')][_0x2df9('0x49')]({'where':{'name':_0x1d7e1f,'userProfileId':_0x4bd0e8[_0x2df9('0x4a')]},'raw':!![]})[_0x2df9('0x23')](function(_0x2d92bb){if(_0x2d92bb&&_0x2d92bb[_0x2df9('0x4b')]===0x0){return db[_0x2df9('0x27')][_0x2df9('0x45')]({'name':_0x15ad2d[_0x2df9('0x2a')],'resourceId':_0x15ad2d['id'],'type':_0x2d92bb[_0x2df9('0x2a')],'sectionId':_0x2d92bb['id']},{})[_0x2df9('0x23')](function(){return _0x524167;});}else{return _0x524167;}})[_0x2df9('0x43')](function(_0x316f86){logger[_0x2df9('0x4c')](_0x2df9('0x4d'),_0x316f86);throw _0x316f86;});}return _0x524167;})[_0x2df9('0x23')](respondWithResult(_0x23d704,0xc9))[_0x2df9('0x43')](handleError(_0x23d704,null));};exports['update']=function(_0x206713,_0x2efdef){if(_0x206713[_0x2df9('0x4e')]['id']){delete _0x206713[_0x2df9('0x4e')]['id'];}return db[_0x2df9('0x2d')]['find']({'where':{'id':_0x206713[_0x2df9('0x44')]['id']}})[_0x2df9('0x23')](handleEntityNotFound(_0x2efdef,null))[_0x2df9('0x23')](saveUpdates(_0x206713[_0x2df9('0x4e')],null))[_0x2df9('0x23')](respondWithResult(_0x2efdef,null))[_0x2df9('0x43')](handleError(_0x2efdef,null));};exports[_0x2df9('0x24')]=function(_0x4c6407,_0x4b08d8){return db[_0x2df9('0x2d')][_0x2df9('0x49')]({'where':{'id':_0x4c6407[_0x2df9('0x44')]['id']}})[_0x2df9('0x23')](handleEntityNotFound(_0x4b08d8,null))[_0x2df9('0x23')](removeEntity(_0x4b08d8,null))['catch'](handleError(_0x4b08d8,null));};exports[_0x2df9('0x4f')]=function(_0x117897,_0x3df368,_0x59a4ce){return db[_0x2df9('0x2d')]['findOne']({'where':{'id':_0x117897[_0x2df9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3df368,null))[_0x2df9('0x23')](function(_0x196e08){var _0x5e3196;var _0x6b0830={},_0x7fc7b8={};_0x7fc7b8[_0x2df9('0x30')]=_[_0x2df9('0x32')](db[_0x2df9('0x50')][_0x2df9('0x2e')]);_0x7fc7b8[_0x2df9('0x31')]=_[_0x2df9('0x32')](_0x117897[_0x2df9('0x31')]);_0x7fc7b8['filters']=_[_0x2df9('0x33')](_0x7fc7b8[_0x2df9('0x30')],_0x7fc7b8[_0x2df9('0x31')]);_0x6b0830[_0x2df9('0x34')]=_[_0x2df9('0x33')](_0x7fc7b8[_0x2df9('0x30')],qs[_0x2df9('0x35')](_0x117897[_0x2df9('0x31')][_0x2df9('0x35')]));_0x6b0830['attributes']=_0x6b0830[_0x2df9('0x34')][_0x2df9('0x36')]?_0x6b0830[_0x2df9('0x34')]:_0x7fc7b8[_0x2df9('0x30')];if(!_0x117897['query'][_0x2df9('0x37')](_0x2df9('0x51'))){_0x6b0830[_0x2df9('0x1f')]=qs[_0x2df9('0x1f')](_0x117897[_0x2df9('0x31')][_0x2df9('0x1f')]);_0x6b0830[_0x2df9('0x1e')]=qs['offset'](_0x117897[_0x2df9('0x31')][_0x2df9('0x1e')]);}_0x6b0830[_0x2df9('0x38')]=qs[_0x2df9('0x39')](_0x117897[_0x2df9('0x31')][_0x2df9('0x39')]);_0x6b0830[_0x2df9('0x3a')]=qs['filters'](_['pick'](_0x117897[_0x2df9('0x31')],_0x7fc7b8[_0x2df9('0x3b')]));if(_0x117897['query'][_0x2df9('0x3c')]){_0x6b0830[_0x2df9('0x3a')]=_[_0x2df9('0x3d')](_0x6b0830['where'],{'$or':_[_0x2df9('0x2c')](_0x6b0830[_0x2df9('0x34')],function(_0xa1459b){var _0x2864e7={};_0x2864e7[_0xa1459b]={'$like':'%'+_0x117897[_0x2df9('0x31')][_0x2df9('0x3c')]+'%'};return _0x2864e7;})});}_0x6b0830[_0x2df9('0x3a')]=_[_0x2df9('0x3d')](_0x6b0830[_0x2df9('0x3a')],{'mailboxuser':_0x196e08[_0x2df9('0x52')]});_0x6b0830=_[_0x2df9('0x3d')]({},_0x6b0830,_0x117897['options']);return db[_0x2df9('0x50')][_0x2df9('0x53')](_0x6b0830)[_0x2df9('0x23')](respondWithFilteredResult(_0x3df368,_0x6b0830));})[_0x2df9('0x43')](handleError(_0x3df368,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 59c69d9..c8e7de8 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 _0x762c=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4b6897,_0x5583e1){var _0x9e0b1a=function(_0x3993f6){while(--_0x3993f6){_0x4b6897['push'](_0x4b6897['shift']());}};_0x9e0b1a(++_0x5583e1);}(_0x762c,0x1d2));var _0xc762=function(_0x25ede4,_0x61a88b){_0x25ede4=_0x25ede4-0x0;var _0x1df063=_0x762c[_0x25ede4];return _0x1df063;};'use strict';var _=require(_0xc762('0x0'));var util=require(_0xc762('0x1'));var logger=require(_0xc762('0x2'))(_0xc762('0x3'));var moment=require('moment');var BPromise=require(_0xc762('0x4'));var rp=require(_0xc762('0x5'));var fs=require('fs');var path=require(_0xc762('0x6'));var rimraf=require(_0xc762('0x7'));var config=require(_0xc762('0x8'));var attributes=require('./voiceMail.attributes');module[_0xc762('0x9')]=function(_0x4e4f83,_0x1c8c1b){return _0x4e4f83['define']('VoiceMail',attributes,{'tableName':_0xc762('0xa'),'paranoid':![],'indexes':[{'name':_0xc762('0xb'),'fields':[_0xc762('0xc'),_0xc762('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65a9=['context','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x167f20,_0x2e78a7){var _0x56189c=function(_0xbc4a42){while(--_0xbc4a42){_0x167f20['push'](_0x167f20['shift']());}};_0x56189c(++_0x2e78a7);}(_0x65a9,0x81));var _0x965a=function(_0x1640d1,_0x22e6a8){_0x1640d1=_0x1640d1-0x0;var _0x1f94ef=_0x65a9[_0x1640d1];return _0x1f94ef;};'use strict';var _=require(_0x965a('0x0'));var util=require(_0x965a('0x1'));var logger=require(_0x965a('0x2'))(_0x965a('0x3'));var moment=require(_0x965a('0x4'));var BPromise=require(_0x965a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x965a('0x6'));var rimraf=require(_0x965a('0x7'));var config=require(_0x965a('0x8'));var attributes=require('./voiceMail.attributes');module[_0x965a('0x9')]=function(_0x36524e,_0x952d9a){return _0x36524e[_0x965a('0xa')](_0x965a('0xb'),attributes,{'tableName':_0x965a('0xc'),'paranoid':![],'indexes':[{'name':_0x965a('0xd'),'fields':[_0x965a('0xe'),_0x965a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a197061..2c12705 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 _0x1271=['http','request','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x417758,_0x1c531b){var _0x466ee2=function(_0x23e241){while(--_0x23e241){_0x417758['push'](_0x417758['shift']());}};_0x466ee2(++_0x1c531b);}(_0x1271,0x141));var _0x1127=function(_0x5ab448,_0x32da89){_0x5ab448=_0x5ab448-0x0;var _0x3362c8=_0x1271[_0x5ab448];return _0x3362c8;};'use strict';var _=require(_0x1127('0x0'));var util=require(_0x1127('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1127('0x2'));var db=require(_0x1127('0x3'))['db'];var utils=require(_0x1127('0x4'));var logger=require('../../config/logger')(_0x1127('0x5'));var config=require(_0x1127('0x6'));var jayson=require(_0x1127('0x7'));var client=jayson[_0x1127('0x8')][_0x1127('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48cca4,_0x16ba69,_0x1d4500){return new BPromise(function(_0x162e3b,_0x54b5a1){return client[_0x1127('0xa')](_0x48cca4,_0x1d4500)[_0x1127('0xb')](function(_0x52b3bd){logger[_0x1127('0xc')]('VoiceMail,\x20%s,\x20%s',_0x16ba69,_0x1127('0xd'));logger['debug'](_0x1127('0xe'),_0x16ba69,_0x1127('0xd'),JSON[_0x1127('0xf')](_0x52b3bd));if(_0x52b3bd[_0x1127('0x10')]){if(_0x52b3bd[_0x1127('0x10')][_0x1127('0x11')]===0x1f4){logger[_0x1127('0x10')]('VoiceMail,\x20%s,\x20%s',_0x16ba69,_0x52b3bd[_0x1127('0x10')][_0x1127('0x12')]);return _0x54b5a1(_0x52b3bd[_0x1127('0x10')][_0x1127('0x12')]);}logger[_0x1127('0x10')]('VoiceMail,\x20%s,\x20%s',_0x16ba69,_0x52b3bd['error'][_0x1127('0x12')]);return _0x162e3b(_0x52b3bd[_0x1127('0x10')][_0x1127('0x12')]);}else{logger[_0x1127('0xc')](_0x1127('0x13'),_0x16ba69,_0x1127('0xd'));_0x162e3b(_0x52b3bd[_0x1127('0x14')]['message']);}})[_0x1127('0x15')](function(_0x2c5073){logger[_0x1127('0x10')](_0x1127('0x13'),_0x16ba69,_0x2c5073);_0x54b5a1(_0x2c5073);});});} \ No newline at end of file +var _0x6ec9=['http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0x6ec9,0x194));var _0x96ec=function(_0x58cc87,_0x1f8228){_0x58cc87=_0x58cc87-0x0;var _0x57e9e7=_0x6ec9[_0x58cc87];return _0x57e9e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x96ec('0x0'));var BPromise=require(_0x96ec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ec('0x2'));var db=require(_0x96ec('0x3'))['db'];var utils=require(_0x96ec('0x4'));var logger=require(_0x96ec('0x5'))(_0x96ec('0x6'));var config=require(_0x96ec('0x7'));var jayson=require(_0x96ec('0x8'));var client=jayson[_0x96ec('0x9')][_0x96ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f5162,_0x2e5b5f,_0x202f97){return new BPromise(function(_0x40da14,_0x5921d6){return client[_0x96ec('0xb')](_0x2f5162,_0x202f97)[_0x96ec('0xc')](function(_0x561dae){logger[_0x96ec('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2e5b5f,_0x96ec('0xe'));logger[_0x96ec('0xf')](_0x96ec('0x10'),_0x2e5b5f,_0x96ec('0xe'),JSON[_0x96ec('0x11')](_0x561dae));if(_0x561dae['error']){if(_0x561dae[_0x96ec('0x12')][_0x96ec('0x13')]===0x1f4){logger['error'](_0x96ec('0x14'),_0x2e5b5f,_0x561dae[_0x96ec('0x12')]['message']);return _0x5921d6(_0x561dae[_0x96ec('0x12')]['message']);}logger[_0x96ec('0x12')](_0x96ec('0x14'),_0x2e5b5f,_0x561dae['error'][_0x96ec('0x15')]);return _0x40da14(_0x561dae[_0x96ec('0x12')][_0x96ec('0x15')]);}else{logger[_0x96ec('0xd')](_0x96ec('0x14'),_0x2e5b5f,'request\x20sent');_0x40da14(_0x561dae['result'][_0x96ec('0x15')]);}})[_0x96ec('0x16')](function(_0xe550af){logger[_0x96ec('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2e5b5f,_0xe550af);_0x5921d6(_0xe550af);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 893a1cb..fe45d6a 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 _0x7a54=['show','/:id/download','create','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x154a6a,_0x5c9463){var _0x1b224a=function(_0xbf6e42){while(--_0xbf6e42){_0x154a6a['push'](_0x154a6a['shift']());}};_0x1b224a(++_0x5c9463);}(_0x7a54,0x106));var _0x47a5=function(_0x4857c6,_0x38d6a4){_0x4857c6=_0x4857c6-0x0;var _0x2c2b10=_0x7a54[_0x4857c6];return _0x2c2b10;};'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')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xe')](_0x47a5('0xd'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x326f=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f504c,_0x319b4f){var _0x50d2e6=function(_0x47f98d){while(--_0x47f98d){_0x1f504c['push'](_0x1f504c['shift']());}};_0x50d2e6(++_0x319b4f);}(_0x326f,0xd1));var _0xf326=function(_0x7191e7,_0x356b63){_0x7191e7=_0x7191e7-0x0;var _0x139094=_0x326f[_0x7191e7];return _0x139094;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf326('0xd')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);router['delete'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 987e135..014a98b 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 _0xd42e=['VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','sequelize','exports'];(function(_0x2c988d,_0x582b17){var _0x514720=function(_0x462617){while(--_0x462617){_0x2c988d['push'](_0x2c988d['shift']());}};_0x514720(++_0x582b17);}(_0xd42e,0x1c6));var _0xed42=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xd42e[_0xd0a847];return _0x2536ec;};'use strict';var Sequelize=require(_0xed42('0x0'));module[_0xed42('0x1')]={'name':{'type':Sequelize[_0xed42('0x2')],'get':function(_0x24888d){return this[_0xed42('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xed42('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xed42('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xed42('0x5')],'defaultValue':''},'stamp':{'type':_0xed42('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0xbbe6=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xbbe6,0x1c0));var _0x6bbe=function(_0x43e3f9,_0x409967){_0x43e3f9=_0x43e3f9-0x0;var _0x582414=_0xbbe6[_0x43e3f9];return _0x582414;};'use strict';var Sequelize=require(_0x6bbe('0x0'));module[_0x6bbe('0x1')]={'name':{'type':Sequelize[_0x6bbe('0x2')],'get':function(_0x43e303){return this[_0x6bbe('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6bbe('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6bbe('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6bbe('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x6bbe('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x6bbe('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6bbe('0x5')],'defaultValue':''},'stamp':{'type':_0x6bbe('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 4ddc220..d8c38ce 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 _0x3a91=['set','json','apply','save','update','destroy','then','error','name','send','index','rawAttributes','fieldName','type','key','differenceBy','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','VoiceMailMessage','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','eml-format','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x1504e7,_0x393234){var _0x4fd6e9=function(_0x54a325){while(--_0x54a325){_0x1504e7['push'](_0x1504e7['shift']());}};_0x4fd6e9(++_0x393234);}(_0x3a91,0x1df));var _0x13a9=function(_0x212a2e,_0x5bc358){_0x212a2e=_0x212a2e-0x0;var _0x19e9c6=_0x3a91[_0x212a2e];return _0x19e9c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x13a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13a9('0x1'));var jsonpatch=require(_0x13a9('0x2'));var rp=require(_0x13a9('0x3'));var moment=require(_0x13a9('0x4'));var BPromise=require(_0x13a9('0x5'));var Mustache=require(_0x13a9('0x6'));var util=require('util');var path=require(_0x13a9('0x7'));var sox=require(_0x13a9('0x8'));var csv=require(_0x13a9('0x9'));var ejs=require(_0x13a9('0xa'));var fs=require('fs');var _=require(_0x13a9('0xb'));var squel=require('squel');var crypto=require(_0x13a9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x13a9('0xd'));var toCsv=require(_0x13a9('0x9'));var querystring=require(_0x13a9('0xe'));var Papa=require(_0x13a9('0xf'));var Redis=require(_0x13a9('0x10'));var authService=require(_0x13a9('0x11'));var qs=require(_0x13a9('0x12'));var as=require(_0x13a9('0x13'));var hardwareService=require(_0x13a9('0x14'));var logger=require('../../config/logger')(_0x13a9('0x15'));var utils=require(_0x13a9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x13a9('0x17'));var db=require(_0x13a9('0x18'))['db'];function respondWithStatusCode(_0xcf1ff2,_0x3391d3){_0x3391d3=_0x3391d3||0xcc;return function(_0x236f8c){if(_0x236f8c){return _0xcf1ff2[_0x13a9('0x19')](_0x3391d3);}return _0xcf1ff2[_0x13a9('0x1a')](_0x3391d3)[_0x13a9('0x1b')]();};}function respondWithResult(_0x1f88d0,_0x20256d){_0x20256d=_0x20256d||0xc8;return function(_0x2bddc4){if(_0x2bddc4){return _0x1f88d0['status'](_0x20256d)['json'](_0x2bddc4);}};}function respondWithFilteredResult(_0x571687,_0x38f8cc){return function(_0x24fcba){if(_0x24fcba){var _0x35a6a7=_0x24fcba[_0x13a9('0x1c')],_0x1d3d04=_0x38f8cc[_0x13a9('0x1d')],_0x25d1b9=_0x38f8cc[_0x13a9('0x1d')]+_0x38f8cc[_0x13a9('0x1e')],_0x32bd9d;if(_0x25d1b9>=_0x35a6a7){_0x25d1b9=_0x35a6a7;_0x32bd9d=0xc8;}else{_0x32bd9d=0xce;}_0x571687['status'](_0x32bd9d);return _0x571687[_0x13a9('0x1f')]('Content-Range',_0x1d3d04+'-'+_0x25d1b9+'/'+_0x35a6a7)[_0x13a9('0x20')](_0x24fcba);}return null;};}function patchUpdates(_0x1687a4){return function(_0x209c25){try{jsonpatch[_0x13a9('0x21')](_0x209c25,_0x1687a4,!![]);}catch(_0x2c7967){return BPromise['reject'](_0x2c7967);}return _0x209c25[_0x13a9('0x22')]();};}function saveUpdates(_0x3e8ac2,_0x5092e2){return function(_0x5d2d57){if(_0x5d2d57){return _0x5d2d57[_0x13a9('0x23')](_0x3e8ac2)['then'](function(_0x1a5d02){return _0x1a5d02;});}return null;};}function removeEntity(_0xc1138a,_0x416c59){return function(_0x310fd3){if(_0x310fd3){return _0x310fd3[_0x13a9('0x24')]()[_0x13a9('0x25')](function(){_0xc1138a[_0x13a9('0x1a')](0xcc)[_0x13a9('0x1b')]();});}};}function handleEntityNotFound(_0xc45caf,_0x47f021){return function(_0x4b45b6){if(!_0x4b45b6){_0xc45caf['sendStatus'](0x194);}return _0x4b45b6;};}function handleError(_0x3cc4b7,_0x4f758b){_0x4f758b=_0x4f758b||0x1f4;return function(_0x4194e3){logger[_0x13a9('0x26')](_0x4194e3['stack']);if(_0x4194e3[_0x13a9('0x27')]){delete _0x4194e3[_0x13a9('0x27')];}_0x3cc4b7['status'](_0x4f758b)[_0x13a9('0x28')](_0x4194e3);};}exports[_0x13a9('0x29')]=function(_0x31790b,_0x8fb826){var _0x309cec={},_0x1b56d2={},_0x5624e8={'count':0x0,'rows':[]};var _0x4f875a=_['map'](db['VoiceMailMessage'][_0x13a9('0x2a')],function(_0x2afd57){return{'name':_0x2afd57[_0x13a9('0x2b')],'type':_0x2afd57[_0x13a9('0x2c')][_0x13a9('0x2d')]};});_0x1b56d2['model']=_[_0x13a9('0x2e')](_['map'](_0x4f875a,_0x13a9('0x27')),['name']);_0x1b56d2[_0x13a9('0x2f')]=_['keys'](_0x31790b['query']);_0x1b56d2['filters']=_['intersection'](_0x1b56d2['model'],_0x1b56d2[_0x13a9('0x2f')]);_0x309cec['attributes']=_[_0x13a9('0x30')](_0x1b56d2[_0x13a9('0x31')],qs[_0x13a9('0x32')](_0x31790b[_0x13a9('0x2f')][_0x13a9('0x32')]));_0x309cec['attributes']=_0x309cec[_0x13a9('0x33')][_0x13a9('0x34')]?_0x309cec['attributes']:_0x1b56d2[_0x13a9('0x31')];if(!_0x31790b[_0x13a9('0x2f')][_0x13a9('0x35')](_0x13a9('0x36'))){_0x309cec[_0x13a9('0x1e')]=qs['limit'](_0x31790b[_0x13a9('0x2f')]['limit']);_0x309cec[_0x13a9('0x1d')]=qs['offset'](_0x31790b['query'][_0x13a9('0x1d')]);}_0x309cec[_0x13a9('0x37')]=qs[_0x13a9('0x38')](_0x31790b[_0x13a9('0x2f')]['sort']);_0x309cec[_0x13a9('0x39')]=qs[_0x13a9('0x3a')](_[_0x13a9('0x3b')](_0x31790b[_0x13a9('0x2f')],_0x1b56d2['filters']),_0x4f875a);if(_0x31790b[_0x13a9('0x2f')][_0x13a9('0x3c')]){_0x309cec['where']=_['merge'](_0x309cec['where'],{'$or':_[_0x13a9('0x3d')](_0x4f875a,function(_0x366715){if(_0x366715['type']!==_0x13a9('0x3e')){var _0x55de11={};_0x55de11[_0x366715['name']]={'$like':'%'+_0x31790b[_0x13a9('0x2f')][_0x13a9('0x3c')]+'%'};return _0x55de11;}})});}_0x309cec=_[_0x13a9('0x3f')]({},_0x309cec,_0x31790b[_0x13a9('0x40')]);var _0x48a8fe={'where':_0x309cec['where']};return db[_0x13a9('0x41')][_0x13a9('0x1c')](_0x48a8fe)[_0x13a9('0x25')](function(_0x358a7f){_0x5624e8[_0x13a9('0x1c')]=_0x358a7f;if(_0x31790b[_0x13a9('0x2f')][_0x13a9('0x42')]){_0x309cec[_0x13a9('0x43')]=[{'all':!![]}];}return db[_0x13a9('0x41')][_0x13a9('0x44')](_0x309cec);})['then'](function(_0x19fa0c){_0x5624e8[_0x13a9('0x45')]=_0x19fa0c;return _0x5624e8;})['then'](respondWithFilteredResult(_0x8fb826,_0x309cec))['catch'](handleError(_0x8fb826,null));};exports[_0x13a9('0x46')]=function(_0x2f9447,_0x24bcc0){var _0x21eadc={'raw':!![],'where':{'id':_0x2f9447[_0x13a9('0x47')]['id']}},_0x320d25={};_0x320d25[_0x13a9('0x31')]=_[_0x13a9('0x48')](db['VoiceMailMessage'][_0x13a9('0x2a')]);_0x320d25[_0x13a9('0x2f')]=_[_0x13a9('0x48')](_0x2f9447[_0x13a9('0x2f')]);_0x320d25[_0x13a9('0x3a')]=_['intersection'](_0x320d25[_0x13a9('0x31')],_0x320d25[_0x13a9('0x2f')]);_0x21eadc[_0x13a9('0x33')]=_[_0x13a9('0x30')](_0x320d25['model'],qs[_0x13a9('0x32')](_0x2f9447['query']['fields']));_0x21eadc['attributes']=_0x21eadc['attributes'][_0x13a9('0x34')]?_0x21eadc[_0x13a9('0x33')]:_0x320d25[_0x13a9('0x31')];if(_0x2f9447[_0x13a9('0x2f')][_0x13a9('0x42')]){_0x21eadc[_0x13a9('0x43')]=[{'all':!![]}];}_0x21eadc=_[_0x13a9('0x3f')]({},_0x21eadc,_0x2f9447['options']);return db['VoiceMailMessage'][_0x13a9('0x49')](_0x21eadc)['then'](handleEntityNotFound(_0x24bcc0,null))[_0x13a9('0x25')](respondWithResult(_0x24bcc0,null))[_0x13a9('0x4a')](handleError(_0x24bcc0,null));};exports[_0x13a9('0x4b')]=function(_0x29e5b1,_0xc417a){return db['VoiceMailMessage']['create'](_0x29e5b1[_0x13a9('0x4c')],{})[_0x13a9('0x25')](respondWithResult(_0xc417a,0xc9))[_0x13a9('0x4a')](handleError(_0xc417a,null));};exports[_0x13a9('0x23')]=function(_0x142906,_0x5c0392){if(_0x142906[_0x13a9('0x4c')]['id']){delete _0x142906['body']['id'];}return db['VoiceMailMessage'][_0x13a9('0x49')]({'where':{'id':_0x142906[_0x13a9('0x47')]['id']}})[_0x13a9('0x25')](handleEntityNotFound(_0x5c0392,null))[_0x13a9('0x25')](saveUpdates(_0x142906[_0x13a9('0x4c')],null))[_0x13a9('0x25')](respondWithResult(_0x5c0392,null))[_0x13a9('0x4a')](handleError(_0x5c0392,null));};exports['destroy']=function(_0x6bc359,_0x35345e){return db[_0x13a9('0x41')]['find']({'where':{'id':_0x6bc359['params']['id']}})[_0x13a9('0x25')](handleEntityNotFound(_0x35345e,null))[_0x13a9('0x25')](removeEntity(_0x35345e,null))['catch'](handleError(_0x35345e,null));};exports[_0x13a9('0x4d')]=function(_0xd8cd6b,_0x51852e,_0x598e79){return db[_0x13a9('0x41')]['find']({'where':{'id':_0xd8cd6b[_0x13a9('0x47')]['id']},'attributes':['id','recording',_0x13a9('0x4e')]})[_0x13a9('0x25')](handleEntityNotFound(_0x51852e,null))[_0x13a9('0x25')](function(_0x4a6466){if(_0x4a6466){if(!_0x4a6466[_0x13a9('0x4f')]){throw new db[(_0x13a9('0x50'))]['ValidationError'](_0x13a9('0x51'));}var _0x4dfc6e={'Content-Type':_0x13a9('0x52'),'Content-Disposition':_0x13a9('0x53')};if(_0x4a6466['msg_id']){_0x4dfc6e['Content-Disposition']=_0x13a9('0x54')+_0x4a6466[_0x13a9('0x4e')]+'.wav\x22';}_0x51852e[_0x13a9('0x1f')](_0x4dfc6e);return _0x51852e[_0x13a9('0x28')](new Buffer(_0x4a6466[_0x13a9('0x4f')]));}})[_0x13a9('0x4a')](handleError(_0x51852e,null));}; \ No newline at end of file +var _0x0caa=['audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','update','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found'];(function(_0x243481,_0x33ba56){var _0x3c7a5c=function(_0x4b07c1){while(--_0x4b07c1){_0x243481['push'](_0x243481['shift']());}};_0x3c7a5c(++_0x33ba56);}(_0x0caa,0x1b2));var _0xa0ca=function(_0x31fb16,_0x3a4f55){_0x31fb16=_0x31fb16-0x0;var _0x50f4b7=_0x0caa[_0x31fb16];return _0x50f4b7;};'use strict';var pdf=require(_0xa0ca('0x0'));var emlformat=require(_0xa0ca('0x1'));var rimraf=require(_0xa0ca('0x2'));var zipdir=require(_0xa0ca('0x3'));var jsonpatch=require(_0xa0ca('0x4'));var rp=require(_0xa0ca('0x5'));var moment=require(_0xa0ca('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa0ca('0x7'));var util=require('util');var path=require(_0xa0ca('0x8'));var sox=require(_0xa0ca('0x9'));var csv=require(_0xa0ca('0xa'));var ejs=require(_0xa0ca('0xb'));var fs=require('fs');var _=require(_0xa0ca('0xc'));var squel=require(_0xa0ca('0xd'));var crypto=require(_0xa0ca('0xe'));var jsforce=require(_0xa0ca('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa0ca('0x10'));var Papa=require(_0xa0ca('0x11'));var Redis=require(_0xa0ca('0x12'));var authService=require(_0xa0ca('0x13'));var qs=require(_0xa0ca('0x14'));var as=require(_0xa0ca('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0ca('0x16'))(_0xa0ca('0x17'));var utils=require(_0xa0ca('0x18'));var config=require(_0xa0ca('0x19'));var licenseUtil=require(_0xa0ca('0x1a'));var db=require(_0xa0ca('0x1b'))['db'];function respondWithStatusCode(_0x220440,_0x5536bd){_0x5536bd=_0x5536bd||0xcc;return function(_0x5f13f6){if(_0x5f13f6){return _0x220440[_0xa0ca('0x1c')](_0x5536bd);}return _0x220440[_0xa0ca('0x1d')](_0x5536bd)[_0xa0ca('0x1e')]();};}function respondWithResult(_0x7491d1,_0x251f99){_0x251f99=_0x251f99||0xc8;return function(_0x4562c0){if(_0x4562c0){return _0x7491d1[_0xa0ca('0x1d')](_0x251f99)[_0xa0ca('0x1f')](_0x4562c0);}};}function respondWithFilteredResult(_0x4ad6c0,_0x5b9bfd){return function(_0x2bcb62){if(_0x2bcb62){var _0x2ae23e=_0x2bcb62[_0xa0ca('0x20')],_0xdf5bbb=_0x5b9bfd[_0xa0ca('0x21')],_0x1da83e=_0x5b9bfd['offset']+_0x5b9bfd['limit'],_0x35ed10;if(_0x1da83e>=_0x2ae23e){_0x1da83e=_0x2ae23e;_0x35ed10=0xc8;}else{_0x35ed10=0xce;}_0x4ad6c0[_0xa0ca('0x1d')](_0x35ed10);return _0x4ad6c0[_0xa0ca('0x22')](_0xa0ca('0x23'),_0xdf5bbb+'-'+_0x1da83e+'/'+_0x2ae23e)[_0xa0ca('0x1f')](_0x2bcb62);}return null;};}function patchUpdates(_0x4c2966){return function(_0x49c90d){try{jsonpatch[_0xa0ca('0x24')](_0x49c90d,_0x4c2966,!![]);}catch(_0x4ce2e2){return BPromise['reject'](_0x4ce2e2);}return _0x49c90d[_0xa0ca('0x25')]();};}function saveUpdates(_0x49ff03,_0x1d0b16){return function(_0x519fe3){if(_0x519fe3){return _0x519fe3['update'](_0x49ff03)[_0xa0ca('0x26')](function(_0xae9606){return _0xae9606;});}return null;};}function removeEntity(_0xd51cec,_0x456065){return function(_0xf09e55){if(_0xf09e55){return _0xf09e55[_0xa0ca('0x27')]()[_0xa0ca('0x26')](function(){_0xd51cec[_0xa0ca('0x1d')](0xcc)[_0xa0ca('0x1e')]();});}};}function handleEntityNotFound(_0x387ccd,_0x40d80c){return function(_0x595e0d){if(!_0x595e0d){_0x387ccd['sendStatus'](0x194);}return _0x595e0d;};}function handleError(_0x4597f6,_0x4f8d9b){_0x4f8d9b=_0x4f8d9b||0x1f4;return function(_0x13ec19){logger[_0xa0ca('0x28')](_0x13ec19[_0xa0ca('0x29')]);if(_0x13ec19[_0xa0ca('0x2a')]){delete _0x13ec19[_0xa0ca('0x2a')];}_0x4597f6[_0xa0ca('0x1d')](_0x4f8d9b)[_0xa0ca('0x2b')](_0x13ec19);};}exports['index']=function(_0x409e3f,_0x4e95a3){var _0x20baee={},_0x29932c={},_0x590805={'count':0x0,'rows':[]};var _0xff01bd=_[_0xa0ca('0x2c')](db[_0xa0ca('0x2d')][_0xa0ca('0x2e')],function(_0x2e58bf){return{'name':_0x2e58bf[_0xa0ca('0x2f')],'type':_0x2e58bf[_0xa0ca('0x30')][_0xa0ca('0x31')]};});_0x29932c[_0xa0ca('0x32')]=_[_0xa0ca('0x33')](_[_0xa0ca('0x2c')](_0xff01bd,_0xa0ca('0x2a')),[_0xa0ca('0x2a')]);_0x29932c[_0xa0ca('0x34')]=_[_0xa0ca('0x35')](_0x409e3f['query']);_0x29932c['filters']=_[_0xa0ca('0x36')](_0x29932c[_0xa0ca('0x32')],_0x29932c[_0xa0ca('0x34')]);_0x20baee[_0xa0ca('0x37')]=_['intersection'](_0x29932c[_0xa0ca('0x32')],qs['fields'](_0x409e3f['query'][_0xa0ca('0x38')]));_0x20baee[_0xa0ca('0x37')]=_0x20baee['attributes']['length']?_0x20baee[_0xa0ca('0x37')]:_0x29932c[_0xa0ca('0x32')];if(!_0x409e3f['query'][_0xa0ca('0x39')]('nolimit')){_0x20baee[_0xa0ca('0x3a')]=qs[_0xa0ca('0x3a')](_0x409e3f[_0xa0ca('0x34')][_0xa0ca('0x3a')]);_0x20baee[_0xa0ca('0x21')]=qs['offset'](_0x409e3f['query'][_0xa0ca('0x21')]);}_0x20baee['order']=qs['sort'](_0x409e3f['query'][_0xa0ca('0x3b')]);_0x20baee[_0xa0ca('0x3c')]=qs['filters'](_[_0xa0ca('0x3d')](_0x409e3f[_0xa0ca('0x34')],_0x29932c['filters']),_0xff01bd);if(_0x409e3f[_0xa0ca('0x34')][_0xa0ca('0x3e')]){_0x20baee[_0xa0ca('0x3c')]=_['merge'](_0x20baee[_0xa0ca('0x3c')],{'$or':_[_0xa0ca('0x2c')](_0xff01bd,function(_0x5a67f2){if(_0x5a67f2[_0xa0ca('0x30')]!=='VIRTUAL'){var _0x180b59={};_0x180b59[_0x5a67f2[_0xa0ca('0x2a')]]={'$like':'%'+_0x409e3f[_0xa0ca('0x34')][_0xa0ca('0x3e')]+'%'};return _0x180b59;}})});}_0x20baee=_['merge']({},_0x20baee,_0x409e3f[_0xa0ca('0x3f')]);var _0x2412ca={'where':_0x20baee['where']};return db[_0xa0ca('0x2d')][_0xa0ca('0x20')](_0x2412ca)['then'](function(_0x238789){_0x590805[_0xa0ca('0x20')]=_0x238789;if(_0x409e3f[_0xa0ca('0x34')][_0xa0ca('0x40')]){_0x20baee[_0xa0ca('0x41')]=[{'all':!![]}];}return db[_0xa0ca('0x2d')][_0xa0ca('0x42')](_0x20baee);})[_0xa0ca('0x26')](function(_0x424d4e){_0x590805[_0xa0ca('0x43')]=_0x424d4e;return _0x590805;})['then'](respondWithFilteredResult(_0x4e95a3,_0x20baee))[_0xa0ca('0x44')](handleError(_0x4e95a3,null));};exports[_0xa0ca('0x45')]=function(_0x572a96,_0x1a442d){var _0x1063c1={'raw':!![],'where':{'id':_0x572a96['params']['id']}},_0x250150={};_0x250150[_0xa0ca('0x32')]=_[_0xa0ca('0x35')](db[_0xa0ca('0x2d')][_0xa0ca('0x2e')]);_0x250150[_0xa0ca('0x34')]=_[_0xa0ca('0x35')](_0x572a96[_0xa0ca('0x34')]);_0x250150['filters']=_[_0xa0ca('0x36')](_0x250150[_0xa0ca('0x32')],_0x250150[_0xa0ca('0x34')]);_0x1063c1[_0xa0ca('0x37')]=_[_0xa0ca('0x36')](_0x250150[_0xa0ca('0x32')],qs[_0xa0ca('0x38')](_0x572a96[_0xa0ca('0x34')][_0xa0ca('0x38')]));_0x1063c1[_0xa0ca('0x37')]=_0x1063c1['attributes'][_0xa0ca('0x46')]?_0x1063c1['attributes']:_0x250150[_0xa0ca('0x32')];if(_0x572a96[_0xa0ca('0x34')][_0xa0ca('0x40')]){_0x1063c1[_0xa0ca('0x41')]=[{'all':!![]}];}_0x1063c1=_[_0xa0ca('0x47')]({},_0x1063c1,_0x572a96[_0xa0ca('0x3f')]);return db['VoiceMailMessage'][_0xa0ca('0x48')](_0x1063c1)[_0xa0ca('0x26')](handleEntityNotFound(_0x1a442d,null))['then'](respondWithResult(_0x1a442d,null))[_0xa0ca('0x44')](handleError(_0x1a442d,null));};exports[_0xa0ca('0x49')]=function(_0x2cd349,_0x37b043){return db[_0xa0ca('0x2d')]['create'](_0x2cd349[_0xa0ca('0x4a')],{})[_0xa0ca('0x26')](respondWithResult(_0x37b043,0xc9))['catch'](handleError(_0x37b043,null));};exports[_0xa0ca('0x4b')]=function(_0x314e0f,_0x5c5b14){if(_0x314e0f[_0xa0ca('0x4a')]['id']){delete _0x314e0f['body']['id'];}return db[_0xa0ca('0x2d')][_0xa0ca('0x48')]({'where':{'id':_0x314e0f['params']['id']}})['then'](handleEntityNotFound(_0x5c5b14,null))[_0xa0ca('0x26')](saveUpdates(_0x314e0f[_0xa0ca('0x4a')],null))[_0xa0ca('0x26')](respondWithResult(_0x5c5b14,null))[_0xa0ca('0x44')](handleError(_0x5c5b14,null));};exports['destroy']=function(_0x468eab,_0x13a606){return db[_0xa0ca('0x2d')][_0xa0ca('0x48')]({'where':{'id':_0x468eab[_0xa0ca('0x4c')]['id']}})[_0xa0ca('0x26')](handleEntityNotFound(_0x13a606,null))[_0xa0ca('0x26')](removeEntity(_0x13a606,null))['catch'](handleError(_0x13a606,null));};exports['download']=function(_0x2a3d4c,_0x53c585,_0xab9e70){return db[_0xa0ca('0x2d')][_0xa0ca('0x48')]({'where':{'id':_0x2a3d4c[_0xa0ca('0x4c')]['id']},'attributes':['id',_0xa0ca('0x4d'),_0xa0ca('0x4e')]})['then'](handleEntityNotFound(_0x53c585,null))['then'](function(_0x5b1372){if(_0x5b1372){if(!_0x5b1372[_0xa0ca('0x4d')]){throw new db[(_0xa0ca('0x4f'))][(_0xa0ca('0x50'))](_0xa0ca('0x51'));}var _0x10db9b={'Content-Type':_0xa0ca('0x52'),'Content-Disposition':_0xa0ca('0x53')};if(_0x5b1372['msg_id']){_0x10db9b[_0xa0ca('0x54')]=_0xa0ca('0x55')+_0x5b1372[_0xa0ca('0x4e')]+'.wav\x22';}_0x53c585[_0xa0ca('0x22')](_0x10db9b);return _0x53c585['send'](new Buffer(_0x5b1372[_0xa0ca('0x4d')]));}})['catch'](handleError(_0x53c585,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3c60a85..dd1ba2a 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 _0xc3d4=['dir','util','moment','request-promise','path','rimraf','exports','VoiceMailMessage','voice_voicemail_messages'];(function(_0x24ee60,_0x4cb56b){var _0x21d75d=function(_0x1e74d1){while(--_0x1e74d1){_0x24ee60['push'](_0x24ee60['shift']());}};_0x21d75d(++_0x4cb56b);}(_0xc3d4,0x64));var _0x4c3d=function(_0x5e3115,_0x540600){_0x5e3115=_0x5e3115-0x0;var _0x5a1dc6=_0xc3d4[_0x5e3115];return _0x5a1dc6;};'use strict';var _=require('lodash');var util=require(_0x4c3d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4c3d('0x1'));var BPromise=require('bluebird');var rp=require(_0x4c3d('0x2'));var fs=require('fs');var path=require(_0x4c3d('0x3'));var rimraf=require(_0x4c3d('0x4'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x4c3d('0x5')]=function(_0x28fa25,_0x570a7c){return _0x28fa25['define'](_0x4c3d('0x6'),attributes,{'tableName':_0x4c3d('0x7'),'paranoid':![],'indexes':[{'name':_0x4c3d('0x8'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x7494=['rimraf','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xb591db,_0x403093){var _0x352688=function(_0xcbb1ab){while(--_0xcbb1ab){_0xb591db['push'](_0xb591db['shift']());}};_0x352688(++_0x403093);}(_0x7494,0x16d));var _0x4749=function(_0x4b6ee4,_0x159238){_0x4b6ee4=_0x4b6ee4-0x0;var _0x56b270=_0x7494[_0x4b6ee4];return _0x56b270;};'use strict';var _=require(_0x4749('0x0'));var util=require(_0x4749('0x1'));var logger=require(_0x4749('0x2'))(_0x4749('0x3'));var moment=require('moment');var BPromise=require(_0x4749('0x4'));var rp=require(_0x4749('0x5'));var fs=require('fs');var path=require(_0x4749('0x6'));var rimraf=require(_0x4749('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x4749('0x8')]=function(_0x269063,_0x283bf9){return _0x269063[_0x4749('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x4749('0xa'),'paranoid':![],'indexes':[{'name':_0x4749('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c0fce1a..3a1ca07 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2465ed,_0x54d08b){var _0x1654d3=function(_0x59d632){while(--_0x59d632){_0x2465ed['push'](_0x2465ed['shift']());}};_0x1654d3(++_0x54d08b);}(_0x57ca,0x108));var _0xa57c=function(_0x1736d4,_0x5b8ed9){_0x1736d4=_0x1736d4-0x0;var _0x49f6be=_0x57ca[_0x1736d4];return _0x49f6be;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5abe82,_0x3f4b65){var _0x2f8f38=function(_0x284981){while(--_0x284981){_0x5abe82['push'](_0x5abe82['shift']());}};_0x2f8f38(++_0x3f4b65);}(_0x2ef3,0xba));var _0x32ef=function(_0x5859b7,_0x49eedc){_0x5859b7=_0x5859b7-0x0;var _0x398d47=_0x2ef3[_0x5859b7];return _0x398d47;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f5b6d3e..2402579 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 _0xdf02=['get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','/:id/sounds/:id2','removeSound','exports','multer','util','path','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index'];(function(_0x2e178d,_0x44656b){var _0x507dc8=function(_0x3abaeb){while(--_0x3abaeb){_0x2e178d['push'](_0x2e178d['shift']());}};_0x507dc8(++_0x44656b);}(_0xdf02,0x71));var _0x2df0=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xdf02[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x2df0('0x0'));var util=require(_0x2df0('0x1'));var path=require(_0x2df0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2df0('0x3'));var config=require(_0x2df0('0x4'));var controller=require(_0x2df0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x2df0('0x6')]);router[_0x2df0('0x7')](_0x2df0('0x8'),auth[_0x2df0('0x9')](),controller[_0x2df0('0xa')]);router['get'](_0x2df0('0xb'),auth['isAuthenticated'](),controller[_0x2df0('0xc')]);router[_0x2df0('0xd')]('/',auth[_0x2df0('0x9')](),controller[_0x2df0('0xe')]);router[_0x2df0('0xd')](_0x2df0('0xb'),auth['isAuthenticated'](),controller[_0x2df0('0xf')]);router[_0x2df0('0x10')](_0x2df0('0x8'),auth[_0x2df0('0x9')](),controller['update']);router['delete'](_0x2df0('0x8'),auth[_0x2df0('0x9')](),controller['destroy']);router['delete'](_0x2df0('0x11'),auth[_0x2df0('0x9')](),controller[_0x2df0('0x12')]);module[_0x2df0('0x13')]=router; \ No newline at end of file +var _0xcbe2=['destroy','/:id/sounds/:id2','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','addSound','update','delete'];(function(_0x268916,_0x1c27e1){var _0x38f8a4=function(_0x5e9ea6){while(--_0x5e9ea6){_0x268916['push'](_0x268916['shift']());}};_0x38f8a4(++_0x1c27e1);}(_0xcbe2,0x179));var _0x2cbe=function(_0x305127,_0x29a587){_0x305127=_0x305127-0x0;var _0x35b4c4=_0xcbe2[_0x305127];return _0x35b4c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2cbe('0x0'));var timeout=require(_0x2cbe('0x1'));var express=require(_0x2cbe('0x2'));var router=express[_0x2cbe('0x3')]();var auth=require(_0x2cbe('0x4'));var interaction=require(_0x2cbe('0x5'));var config=require(_0x2cbe('0x6'));var controller=require(_0x2cbe('0x7'));router[_0x2cbe('0x8')]('/',auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xa')]);router['get'](_0x2cbe('0xb'),auth[_0x2cbe('0x9')](),controller['show']);router[_0x2cbe('0x8')](_0x2cbe('0xc'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xd')]);router[_0x2cbe('0xe')]('/',auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xf')]);router[_0x2cbe('0xe')](_0x2cbe('0xc'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0x10')]);router['put'](_0x2cbe('0xb'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0x11')]);router[_0x2cbe('0x12')](_0x2cbe('0xb'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0x13')]);router['delete'](_0x2cbe('0x14'),auth[_0x2cbe('0x9')](),controller['removeSound']);module[_0x2cbe('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 23c29cf..38588c9 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 _0x4dba=['exports','STRING','ENUM','custom','quietmp3nb','quietmp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x3772b5,_0x1c71cf){var _0x565d5d=function(_0x2ba763){while(--_0x2ba763){_0x3772b5['push'](_0x3772b5['shift']());}};_0x565d5d(++_0x1c71cf);}(_0x4dba,0x15f));var _0xa4db=function(_0x359ac8,_0x84653e){_0x359ac8=_0x359ac8-0x0;var _0x2d3e40=_0x4dba[_0x359ac8];return _0x2d3e40;};'use strict';var Sequelize=require(_0xa4db('0x0'));module[_0xa4db('0x1')]={'name':{'type':Sequelize[_0xa4db('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xa4db('0x3')](_0xa4db('0x4'),'files','mp3nb',_0xa4db('0x5'),_0xa4db('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xa4db('0x7')},'directory':{'type':Sequelize[_0xa4db('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa4db('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa4db('0x2')],'allowNull':!![],'defaultValue':_0xa4db('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa4db('0x9')},'defaultEntry':{'type':Sequelize[_0xa4db('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x877e=['TIMESTAMP','sequelize','exports','name','ENUM','files','quietmp3nb','quietmp3','mp3','STRING','alpha'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x877e,0xd2));var _0xe877=function(_0x2da68b,_0xa07065){_0x2da68b=_0x2da68b-0x0;var _0x5f0fbd=_0x877e[_0x2da68b];return _0x5f0fbd;};'use strict';var Sequelize=require(_0xe877('0x0'));module[_0xe877('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe877('0x2')},'mode':{'type':Sequelize[_0xe877('0x3')]('custom',_0xe877('0x4'),'mp3nb',_0xe877('0x5'),_0xe877('0x6'),_0xe877('0x7')),'allowNull':!![],'defaultValue':_0xe877('0x4')},'directory':{'type':Sequelize[_0xe877('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0xe877('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe877('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe877('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xe877('0xa')},'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 bfc5462..26e733c 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 _0x39f9=['symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound','getSounds','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','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','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','sequelize','transaction','body','files','directory','root','server/files/moh','create','mode','mkdirSync','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','message','addSound','findOne','converted_format','createdAt','server/files/sounds/converted','format','save_name','extname','%s.%s'];(function(_0x530eba,_0x52d67d){var _0x37dcf6=function(_0x4b7832){while(--_0x4b7832){_0x530eba['push'](_0x530eba['shift']());}};_0x37dcf6(++_0x52d67d);}(_0x39f9,0x7a));var _0x939f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39f9[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x939f('0x0'));var emlformat=require(_0x939f('0x1'));var rimraf=require(_0x939f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x939f('0x3'));var moment=require(_0x939f('0x4'));var BPromise=require(_0x939f('0x5'));var Mustache=require(_0x939f('0x6'));var util=require(_0x939f('0x7'));var path=require(_0x939f('0x8'));var sox=require('sox');var csv=require(_0x939f('0x9'));var ejs=require(_0x939f('0xa'));var fs=require('fs');var _=require(_0x939f('0xb'));var squel=require(_0x939f('0xc'));var crypto=require(_0x939f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x939f('0x9'));var querystring=require(_0x939f('0xe'));var Papa=require(_0x939f('0xf'));var Redis=require('ioredis');var authService=require(_0x939f('0x10'));var qs=require(_0x939f('0x11'));var as=require(_0x939f('0x12'));var hardwareService=require(_0x939f('0x13'));var logger=require(_0x939f('0x14'))('api');var utils=require(_0x939f('0x15'));var config=require(_0x939f('0x16'));var licenseUtil=require(_0x939f('0x17'));var db=require(_0x939f('0x18'))['db'];function respondWithStatusCode(_0x5a4a7f,_0xe83b94){_0xe83b94=_0xe83b94||0xcc;return function(_0x4a7094){if(_0x4a7094){return _0x5a4a7f[_0x939f('0x19')](_0xe83b94);}return _0x5a4a7f[_0x939f('0x1a')](_0xe83b94)[_0x939f('0x1b')]();};}function respondWithResult(_0x103882,_0xd6a809){_0xd6a809=_0xd6a809||0xc8;return function(_0x1c2b36){if(_0x1c2b36){return _0x103882[_0x939f('0x1a')](_0xd6a809)[_0x939f('0x1c')](_0x1c2b36);}};}function respondWithFilteredResult(_0xc7986f,_0x5cac5c){return function(_0x1e9ea1){if(_0x1e9ea1){var _0x23bbdb=_0x1e9ea1[_0x939f('0x1d')],_0x49ed4f=_0x5cac5c[_0x939f('0x1e')],_0x5c14f2=_0x5cac5c['offset']+_0x5cac5c['limit'],_0x3b12d3;if(_0x5c14f2>=_0x23bbdb){_0x5c14f2=_0x23bbdb;_0x3b12d3=0xc8;}else{_0x3b12d3=0xce;}_0xc7986f[_0x939f('0x1a')](_0x3b12d3);return _0xc7986f[_0x939f('0x1f')](_0x939f('0x20'),_0x49ed4f+'-'+_0x5c14f2+'/'+_0x23bbdb)[_0x939f('0x1c')](_0x1e9ea1);}return null;};}function patchUpdates(_0x5141bf){return function(_0x2fd88b){try{jsonpatch[_0x939f('0x21')](_0x2fd88b,_0x5141bf,!![]);}catch(_0x312360){return BPromise[_0x939f('0x22')](_0x312360);}return _0x2fd88b[_0x939f('0x23')]();};}function saveUpdates(_0x5d731c,_0x16f359){return function(_0x380f0b){if(_0x380f0b){return _0x380f0b[_0x939f('0x24')](_0x5d731c)[_0x939f('0x25')](function(_0x541188){return _0x541188;});}return null;};}function removeEntity(_0x42f24a,_0x53c84e){return function(_0x5c1536){if(_0x5c1536){return _0x5c1536[_0x939f('0x26')]()[_0x939f('0x25')](function(){var _0x2727e5=_0x5c1536[_0x939f('0x27')]({'plain':!![]});var _0x6fc4e5=_0x939f('0x28');return db['UserProfileResource'][_0x939f('0x26')]({'where':{'type':_0x6fc4e5,'resourceId':_0x2727e5['id']}})[_0x939f('0x25')](function(){return _0x5c1536;});})[_0x939f('0x25')](function(){_0x42f24a[_0x939f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a4671,_0x11ba05){return function(_0x57d3f0){if(!_0x57d3f0){_0x3a4671['sendStatus'](0x194);}return _0x57d3f0;};}function handleError(_0x5237a6,_0x18dcd7){_0x18dcd7=_0x18dcd7||0x1f4;return function(_0xc97c44){logger[_0x939f('0x29')](_0xc97c44[_0x939f('0x2a')]);if(_0xc97c44['name']){delete _0xc97c44[_0x939f('0x2b')];}_0x5237a6['status'](_0x18dcd7)[_0x939f('0x2c')](_0xc97c44);};}exports[_0x939f('0x2d')]=function(_0x464c42,_0x554ba1){var _0x39b7e2={},_0x2bc329={},_0x3bf475={'count':0x0,'rows':[]};var _0x32cdda=_[_0x939f('0x2e')](db[_0x939f('0x2f')][_0x939f('0x30')],function(_0xb10148){return{'name':_0xb10148['fieldName'],'type':_0xb10148[_0x939f('0x31')][_0x939f('0x32')]};});_0x2bc329[_0x939f('0x33')]=_[_0x939f('0x2e')](_0x32cdda,_0x939f('0x2b'));_0x2bc329[_0x939f('0x34')]=_[_0x939f('0x35')](_0x464c42[_0x939f('0x34')]);_0x2bc329['filters']=_[_0x939f('0x36')](_0x2bc329['model'],_0x2bc329[_0x939f('0x34')]);_0x39b7e2['attributes']=_[_0x939f('0x36')](_0x2bc329[_0x939f('0x33')],qs['fields'](_0x464c42['query'][_0x939f('0x37')]));_0x39b7e2[_0x939f('0x38')]=_0x39b7e2[_0x939f('0x38')][_0x939f('0x39')]?_0x39b7e2['attributes']:_0x2bc329['model'];if(!_0x464c42['query'][_0x939f('0x3a')](_0x939f('0x3b'))){_0x39b7e2[_0x939f('0x3c')]=qs['limit'](_0x464c42[_0x939f('0x34')][_0x939f('0x3c')]);_0x39b7e2['offset']=qs[_0x939f('0x1e')](_0x464c42[_0x939f('0x34')][_0x939f('0x1e')]);}_0x39b7e2[_0x939f('0x3d')]=qs[_0x939f('0x3e')](_0x464c42[_0x939f('0x34')][_0x939f('0x3e')]);_0x39b7e2[_0x939f('0x3f')]=qs[_0x939f('0x40')](_[_0x939f('0x41')](_0x464c42[_0x939f('0x34')],_0x2bc329['filters']),_0x32cdda);if(_0x464c42[_0x939f('0x34')][_0x939f('0x42')]){_0x39b7e2[_0x939f('0x3f')]=_[_0x939f('0x43')](_0x39b7e2[_0x939f('0x3f')],{'$or':_[_0x939f('0x2e')](_0x32cdda,function(_0x305b99){if(_0x305b99['type']!==_0x939f('0x44')){var _0x171d22={};_0x171d22[_0x305b99[_0x939f('0x2b')]]={'$like':'%'+_0x464c42[_0x939f('0x34')][_0x939f('0x42')]+'%'};return _0x171d22;}})});}_0x39b7e2=_[_0x939f('0x43')]({},_0x39b7e2,_0x464c42[_0x939f('0x45')]);var _0xa4a364={'where':_0x39b7e2[_0x939f('0x3f')]};return db[_0x939f('0x2f')][_0x939f('0x1d')](_0xa4a364)[_0x939f('0x25')](function(_0x518c04){_0x3bf475[_0x939f('0x1d')]=_0x518c04;if(_0x464c42['query'][_0x939f('0x46')]){_0x39b7e2[_0x939f('0x47')]=[{'all':!![]}];}return db[_0x939f('0x2f')][_0x939f('0x48')](_0x39b7e2);})[_0x939f('0x25')](function(_0xd8025a){_0x3bf475[_0x939f('0x49')]=_0xd8025a;return _0x3bf475;})[_0x939f('0x25')](respondWithFilteredResult(_0x554ba1,_0x39b7e2))[_0x939f('0x4a')](handleError(_0x554ba1,null));};exports[_0x939f('0x4b')]=function(_0x50e107,_0x421de6){var _0x4d19d6={'raw':![],'where':{'id':_0x50e107[_0x939f('0x4c')]['id']}},_0x11e08e={};_0x11e08e[_0x939f('0x33')]=_[_0x939f('0x35')](db[_0x939f('0x2f')][_0x939f('0x30')]);_0x11e08e[_0x939f('0x34')]=_['keys'](_0x50e107[_0x939f('0x34')]);_0x11e08e[_0x939f('0x40')]=_[_0x939f('0x36')](_0x11e08e['model'],_0x11e08e[_0x939f('0x34')]);_0x4d19d6[_0x939f('0x38')]=_['intersection'](_0x11e08e[_0x939f('0x33')],qs['fields'](_0x50e107['query']['fields']));_0x4d19d6[_0x939f('0x38')]=_0x4d19d6['attributes'][_0x939f('0x39')]?_0x4d19d6[_0x939f('0x38')]:_0x11e08e[_0x939f('0x33')];if(_0x50e107['query'][_0x939f('0x46')]){_0x4d19d6[_0x939f('0x47')]=[{'all':!![]}];}_0x4d19d6=_[_0x939f('0x43')]({},_0x4d19d6,_0x50e107['options']);return db[_0x939f('0x2f')][_0x939f('0x4d')](_0x4d19d6)[_0x939f('0x25')](handleEntityNotFound(_0x421de6,null))[_0x939f('0x25')](respondWithResult(_0x421de6,null))[_0x939f('0x4a')](handleError(_0x421de6,null));};exports[_0x939f('0x24')]=function(_0x2c2dfc,_0x491e34){if(_0x2c2dfc['body']['id']){delete _0x2c2dfc['body']['id'];}return db['VoiceMusicOnHold'][_0x939f('0x4d')]({'where':{'id':_0x2c2dfc[_0x939f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x491e34,null))[_0x939f('0x25')](saveUpdates(_0x2c2dfc['body'],null))['then'](respondWithResult(_0x491e34,null))[_0x939f('0x4a')](handleError(_0x491e34,null));};exports['create']=function(_0x488e4f,_0x38aa44,_0x56fd1){return db[_0x939f('0x4e')][_0x939f('0x4f')](function(_0x4cbadf){if(_0x488e4f[_0x939f('0x50')]['mode']===_0x939f('0x51')){_0x488e4f[_0x939f('0x50')][_0x939f('0x52')]=path['join'](config[_0x939f('0x53')],_0x939f('0x54'),_0x488e4f['body'][_0x939f('0x2b')]);}return db[_0x939f('0x2f')][_0x939f('0x55')](_0x488e4f['body'],{'transaction':_0x4cbadf})[_0x939f('0x25')](function(_0xda0275){if(_0x488e4f['body'][_0x939f('0x56')]===_0x939f('0x51')){fs[_0x939f('0x57')](_0xda0275['directory'],parseInt('0777',0x8));}var _0x3fbe7c=_0x488e4f['user'][_0x939f('0x27')]({'plain':!![]});if(!_0x3fbe7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fbe7c[_0x939f('0x58')]==='user'){var _0x47e23e=_0xda0275[_0x939f('0x27')]({'plain':!![]});return db[_0x939f('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x3fbe7c[_0x939f('0x5a')]},'raw':!![]})[_0x939f('0x25')](function(_0x58e1ad){if(_0x58e1ad&&_0x58e1ad[_0x939f('0x5b')]===0x0){return db[_0x939f('0x5c')][_0x939f('0x55')]({'name':_0x47e23e[_0x939f('0x2b')],'resourceId':_0x47e23e['id'],'type':_0x58e1ad[_0x939f('0x2b')],'sectionId':_0x58e1ad['id']},{})['then'](function(){return _0xda0275;});}else{return _0xda0275;}})[_0x939f('0x4a')](function(_0xea094a){logger[_0x939f('0x29')](_0x939f('0x5d'),_0xea094a);});}return _0xda0275;});})['then'](respondWithResult(_0x38aa44,0xc9))[_0x939f('0x4a')](handleError(_0x38aa44,null));};exports[_0x939f('0x26')]=function(_0x533001,_0x3b40fe,_0x348d77){var _0x4b8bd1;return db[_0x939f('0x2f')][_0x939f('0x4d')]({'where':{'id':_0x533001['params']['id']}})[_0x939f('0x25')](function(_0x56f1bb){if(_0x56f1bb){return db[_0x939f('0x4e')][_0x939f('0x4f')](function(_0x3595ed){return _0x56f1bb['destroy']({'transaction':_0x3595ed,'raw':!![]})[_0x939f('0x25')](function(_0x4c52ea){if(_0x4c52ea[_0x939f('0x52')]){fs[_0x939f('0x5e')](_0x4c52ea[_0x939f('0x52')])[_0x939f('0x5f')](function(_0x2e9127){fs[_0x939f('0x60')](path[_0x939f('0x61')](_0x4c52ea[_0x939f('0x52')],_0x2e9127));});fs['rmdirSync'](_0x4c52ea[_0x939f('0x52')]);}return _0x4c52ea;});})[_0x939f('0x4a')](function(_0x3cab67){throw new db['Sequelize']['ValidationError'](_0x3cab67[_0x939f('0x62')]);});}})[_0x939f('0x25')](handleEntityNotFound(_0x3b40fe,null))[_0x939f('0x25')](removeEntity(_0x3b40fe,null))[_0x939f('0x4a')](handleError(_0x3b40fe,null));};exports[_0x939f('0x63')]=function(_0x3eb342,_0x1b8b4e,_0x307bd1){return db[_0x939f('0x4e')][_0x939f('0x4f')](function(_0x1fd74d){var _0x2831af;return db[_0x939f('0x2f')]['find']({'where':{'id':_0x3eb342[_0x939f('0x4c')]['id']}})[_0x939f('0x25')](function(_0x4f965d){if(_0x4f965d){_0x2831af=_0x4f965d;return _0x4f965d['addSound'](_0x3eb342[_0x939f('0x50')]['id'],{'transaction':_0x1fd74d});}})['then'](function(_0x493d82){if(_0x493d82){return db['Sound'][_0x939f('0x64')]({'where':{'id':_0x3eb342[_0x939f('0x50')]['id']},'attributes':['id',_0x939f('0x2b'),'save_name',_0x939f('0x65'),_0x939f('0x66')],'raw':!![]});}})['then'](function(_0x59e4fd){if(_0x59e4fd){var _0x5212fd=path['join'](config[_0x939f('0x53')],_0x939f('0x67'),util[_0x939f('0x68')]('%s.%s',path['basename'](_0x59e4fd[_0x939f('0x69')],path[_0x939f('0x6a')](_0x59e4fd[_0x939f('0x69')])),_0x59e4fd['converted_format']));var _0x23ebcb=path[_0x939f('0x61')](config[_0x939f('0x53')],_0x939f('0x54'),_0x2831af['name'],util[_0x939f('0x68')](_0x939f('0x6b'),_0x59e4fd[_0x939f('0x2b')],_0x59e4fd[_0x939f('0x65')]));fs[_0x939f('0x6c')](_0x5212fd,_0x23ebcb);return _0x59e4fd;}})[_0x939f('0x4a')](function(_0x3d869f){throw new db[(_0x939f('0x6d'))][(_0x939f('0x6e'))](_0x3d869f[_0x939f('0x62')]);});})[_0x939f('0x25')](handleEntityNotFound(_0x1b8b4e,null))['then'](respondWithResult(_0x1b8b4e,0xc9))[_0x939f('0x4a')](handleError(_0x1b8b4e,null));};exports[_0x939f('0x6f')]=function(_0x3f4a61,_0x5154d7,_0x4eed0c){return db[_0x939f('0x4e')][_0x939f('0x4f')](function(_0x4f408d){var _0xd3457b;return db[_0x939f('0x2f')]['findOne']({'where':{'id':_0x3f4a61[_0x939f('0x4c')]['id']}})[_0x939f('0x25')](handleEntityNotFound(_0x5154d7,null))['then'](function(_0x52c050){if(_0x52c050){_0xd3457b=_0x52c050;return _0x52c050['removeSound'](_0x3f4a61[_0x939f('0x4c')][_0x939f('0x70')]);}})[_0x939f('0x25')](function(_0x20caef){if(_0x20caef){return db[_0x939f('0x71')]['findOne']({'where':{'id':_0x3f4a61['params'][_0x939f('0x70')]},'attributes':['id','name',_0x939f('0x69'),_0x939f('0x65'),_0x939f('0x66')],'raw':!![]});}})[_0x939f('0x25')](function(_0x1d6d22){if(_0x1d6d22){fs[_0x939f('0x60')](path[_0x939f('0x61')](_0xd3457b['directory'],util[_0x939f('0x68')](_0x939f('0x6b'),_0x1d6d22['name'],_0x1d6d22[_0x939f('0x65')])));return _0x1d6d22;}})[_0x939f('0x4a')](function(_0xba0d41){throw new db[(_0x939f('0x6d'))]['ValidationError'](_0xba0d41[_0x939f('0x62')]);});})['then'](handleEntityNotFound(_0x5154d7,null))['then'](respondWithStatusCode(_0x5154d7,0xcc))['catch'](handleError(_0x5154d7,null));};exports[_0x939f('0x72')]=function(_0x3ee102,_0x18a522,_0x15faa1){var _0x1c3422={};var _0x143139={};var _0x385de2;var _0x23712d;return db['VoiceMusicOnHold'][_0x939f('0x64')]({'where':{'id':_0x3ee102[_0x939f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18a522,null))['then'](function(_0x58d239){if(_0x58d239){_0x385de2=_0x58d239;_0x143139[_0x939f('0x33')]=_[_0x939f('0x35')](db[_0x939f('0x71')]['rawAttributes']);_0x143139['query']=_[_0x939f('0x35')](_0x3ee102['query']);_0x143139['filters']=_[_0x939f('0x36')](_0x143139['model'],_0x143139[_0x939f('0x34')]);_0x1c3422[_0x939f('0x38')]=_[_0x939f('0x36')](_0x143139['model'],qs['fields'](_0x3ee102['query'][_0x939f('0x37')]));_0x1c3422[_0x939f('0x38')]=_0x1c3422[_0x939f('0x38')]['length']?_0x1c3422[_0x939f('0x38')]:_0x143139[_0x939f('0x33')];_0x1c3422['order']=qs[_0x939f('0x3e')](_0x3ee102[_0x939f('0x34')]['sort']);_0x1c3422[_0x939f('0x3f')]=qs[_0x939f('0x40')](_[_0x939f('0x41')](_0x3ee102['query'],_0x143139[_0x939f('0x40')]));if(_0x3ee102['query'][_0x939f('0x42')]){_0x1c3422[_0x939f('0x3f')]=_[_0x939f('0x43')](_0x1c3422[_0x939f('0x3f')],{'$or':_[_0x939f('0x2e')](_0x1c3422[_0x939f('0x38')],function(_0x2759d1){var _0x55cc02={};_0x55cc02[_0x2759d1]={'$like':'%'+_0x3ee102[_0x939f('0x34')][_0x939f('0x42')]+'%'};return _0x55cc02;})});}_0x1c3422=_['merge']({},_0x1c3422,_0x3ee102[_0x939f('0x45')]);return _0x385de2[_0x939f('0x72')](_0x1c3422);}})[_0x939f('0x25')](function(_0x5521e6){if(_0x5521e6){_0x23712d=_0x5521e6['length'];if(!_0x3ee102['query'][_0x939f('0x3a')](_0x939f('0x3b'))){_0x1c3422[_0x939f('0x3c')]=qs['limit'](_0x3ee102['query'][_0x939f('0x3c')]);_0x1c3422[_0x939f('0x1e')]=qs[_0x939f('0x1e')](_0x3ee102['query'][_0x939f('0x1e')]);}return _0x385de2[_0x939f('0x72')](_0x1c3422);}})[_0x939f('0x25')](function(_0x3bcdf9){if(_0x3bcdf9){return _0x3bcdf9?{'count':_0x23712d,'rows':_0x3bcdf9}:null;}})[_0x939f('0x25')](respondWithResult(_0x18a522,null))['catch'](handleError(_0x18a522,null));}; \ No newline at end of file +var _0x72f2=['MusicOnHolds','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','mode','directory','join','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','%s.%s','basename','extname','format','removeSound','id2','getSounds','pick','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72f2,0x1a1));var _0x272f=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x72f2[_0x50aa2e];return _0x5e07f0;};'use strict';var pdf=require(_0x272f('0x0'));var emlformat=require(_0x272f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x272f('0x2'));var jsonpatch=require(_0x272f('0x3'));var rp=require(_0x272f('0x4'));var moment=require(_0x272f('0x5'));var BPromise=require(_0x272f('0x6'));var Mustache=require(_0x272f('0x7'));var util=require(_0x272f('0x8'));var path=require(_0x272f('0x9'));var sox=require(_0x272f('0xa'));var csv=require(_0x272f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x272f('0xc'));var squel=require(_0x272f('0xd'));var crypto=require('crypto');var jsforce=require(_0x272f('0xe'));var deskjs=require(_0x272f('0xf'));var toCsv=require(_0x272f('0xb'));var querystring=require(_0x272f('0x10'));var Papa=require(_0x272f('0x11'));var Redis=require(_0x272f('0x12'));var authService=require(_0x272f('0x13'));var qs=require(_0x272f('0x14'));var as=require(_0x272f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x272f('0x16'));var config=require(_0x272f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x272f('0x18'))['db'];function respondWithStatusCode(_0x23cb42,_0x2b2584){_0x2b2584=_0x2b2584||0xcc;return function(_0x43b1d9){if(_0x43b1d9){return _0x23cb42[_0x272f('0x19')](_0x2b2584);}return _0x23cb42[_0x272f('0x1a')](_0x2b2584)['end']();};}function respondWithResult(_0x2e4ddc,_0x5dd5f1){_0x5dd5f1=_0x5dd5f1||0xc8;return function(_0x4d4a74){if(_0x4d4a74){return _0x2e4ddc['status'](_0x5dd5f1)[_0x272f('0x1b')](_0x4d4a74);}};}function respondWithFilteredResult(_0x3f0736,_0x490e74){return function(_0x1c0256){if(_0x1c0256){var _0x45a865=_0x1c0256[_0x272f('0x1c')],_0x35531a=_0x490e74[_0x272f('0x1d')],_0x2bfeb0=_0x490e74[_0x272f('0x1d')]+_0x490e74['limit'],_0x2bd5a3;if(_0x2bfeb0>=_0x45a865){_0x2bfeb0=_0x45a865;_0x2bd5a3=0xc8;}else{_0x2bd5a3=0xce;}_0x3f0736[_0x272f('0x1a')](_0x2bd5a3);return _0x3f0736[_0x272f('0x1e')](_0x272f('0x1f'),_0x35531a+'-'+_0x2bfeb0+'/'+_0x45a865)[_0x272f('0x1b')](_0x1c0256);}return null;};}function patchUpdates(_0x281489){return function(_0x4c55b3){try{jsonpatch[_0x272f('0x20')](_0x4c55b3,_0x281489,!![]);}catch(_0x48c75e){return BPromise[_0x272f('0x21')](_0x48c75e);}return _0x4c55b3[_0x272f('0x22')]();};}function saveUpdates(_0x148f21,_0x41f778){return function(_0x353e86){if(_0x353e86){return _0x353e86[_0x272f('0x23')](_0x148f21)[_0x272f('0x24')](function(_0x1c1269){return _0x1c1269;});}return null;};}function removeEntity(_0x1e42d3,_0x569984){return function(_0x31b65a){if(_0x31b65a){return _0x31b65a[_0x272f('0x25')]()[_0x272f('0x24')](function(){var _0x35eb25=_0x31b65a[_0x272f('0x26')]({'plain':!![]});var _0x48412b=_0x272f('0x27');return db[_0x272f('0x28')][_0x272f('0x25')]({'where':{'type':_0x48412b,'resourceId':_0x35eb25['id']}})[_0x272f('0x24')](function(){return _0x31b65a;});})['then'](function(){_0x1e42d3[_0x272f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa6cd,_0x4fb4b2){return function(_0x19f642){if(!_0x19f642){_0x3fa6cd[_0x272f('0x19')](0x194);}return _0x19f642;};}function handleError(_0x3f447b,_0x5e5615){_0x5e5615=_0x5e5615||0x1f4;return function(_0x48c4b1){logger[_0x272f('0x29')](_0x48c4b1[_0x272f('0x2a')]);if(_0x48c4b1[_0x272f('0x2b')]){delete _0x48c4b1['name'];}_0x3f447b[_0x272f('0x1a')](_0x5e5615)[_0x272f('0x2c')](_0x48c4b1);};}exports['index']=function(_0x26a663,_0x473574){var _0x4f995={},_0x2862fb={},_0x393793={'count':0x0,'rows':[]};var _0x3dd4b1=_[_0x272f('0x2d')](db[_0x272f('0x2e')][_0x272f('0x2f')],function(_0x155765){return{'name':_0x155765['fieldName'],'type':_0x155765[_0x272f('0x30')][_0x272f('0x31')]};});_0x2862fb[_0x272f('0x32')]=_[_0x272f('0x2d')](_0x3dd4b1,_0x272f('0x2b'));_0x2862fb['query']=_[_0x272f('0x33')](_0x26a663['query']);_0x2862fb[_0x272f('0x34')]=_['intersection'](_0x2862fb[_0x272f('0x32')],_0x2862fb[_0x272f('0x35')]);_0x4f995[_0x272f('0x36')]=_[_0x272f('0x37')](_0x2862fb[_0x272f('0x32')],qs[_0x272f('0x38')](_0x26a663[_0x272f('0x35')]['fields']));_0x4f995[_0x272f('0x36')]=_0x4f995[_0x272f('0x36')][_0x272f('0x39')]?_0x4f995[_0x272f('0x36')]:_0x2862fb['model'];if(!_0x26a663[_0x272f('0x35')][_0x272f('0x3a')](_0x272f('0x3b'))){_0x4f995[_0x272f('0x3c')]=qs['limit'](_0x26a663[_0x272f('0x35')][_0x272f('0x3c')]);_0x4f995[_0x272f('0x1d')]=qs[_0x272f('0x1d')](_0x26a663[_0x272f('0x35')][_0x272f('0x1d')]);}_0x4f995['order']=qs[_0x272f('0x3d')](_0x26a663[_0x272f('0x35')][_0x272f('0x3d')]);_0x4f995[_0x272f('0x3e')]=qs['filters'](_['pick'](_0x26a663[_0x272f('0x35')],_0x2862fb[_0x272f('0x34')]),_0x3dd4b1);if(_0x26a663['query'][_0x272f('0x3f')]){_0x4f995['where']=_['merge'](_0x4f995[_0x272f('0x3e')],{'$or':_['map'](_0x3dd4b1,function(_0x527be0){if(_0x527be0[_0x272f('0x30')]!==_0x272f('0x40')){var _0x4a8dc1={};_0x4a8dc1[_0x527be0['name']]={'$like':'%'+_0x26a663[_0x272f('0x35')][_0x272f('0x3f')]+'%'};return _0x4a8dc1;}})});}_0x4f995=_[_0x272f('0x41')]({},_0x4f995,_0x26a663[_0x272f('0x42')]);var _0x19545a={'where':_0x4f995[_0x272f('0x3e')]};return db[_0x272f('0x2e')]['count'](_0x19545a)[_0x272f('0x24')](function(_0x5160d9){_0x393793[_0x272f('0x1c')]=_0x5160d9;if(_0x26a663['query'][_0x272f('0x43')]){_0x4f995[_0x272f('0x44')]=[{'all':!![]}];}return db[_0x272f('0x2e')][_0x272f('0x45')](_0x4f995);})[_0x272f('0x24')](function(_0x461485){_0x393793[_0x272f('0x46')]=_0x461485;return _0x393793;})[_0x272f('0x24')](respondWithFilteredResult(_0x473574,_0x4f995))[_0x272f('0x47')](handleError(_0x473574,null));};exports[_0x272f('0x48')]=function(_0x5c0cdf,_0x523fed){var _0x45887e={'raw':![],'where':{'id':_0x5c0cdf[_0x272f('0x49')]['id']}},_0x5932ae={};_0x5932ae[_0x272f('0x32')]=_[_0x272f('0x33')](db[_0x272f('0x2e')]['rawAttributes']);_0x5932ae[_0x272f('0x35')]=_['keys'](_0x5c0cdf[_0x272f('0x35')]);_0x5932ae['filters']=_['intersection'](_0x5932ae[_0x272f('0x32')],_0x5932ae['query']);_0x45887e['attributes']=_['intersection'](_0x5932ae['model'],qs[_0x272f('0x38')](_0x5c0cdf[_0x272f('0x35')][_0x272f('0x38')]));_0x45887e['attributes']=_0x45887e[_0x272f('0x36')][_0x272f('0x39')]?_0x45887e[_0x272f('0x36')]:_0x5932ae[_0x272f('0x32')];if(_0x5c0cdf[_0x272f('0x35')][_0x272f('0x43')]){_0x45887e[_0x272f('0x44')]=[{'all':!![]}];}_0x45887e=_[_0x272f('0x41')]({},_0x45887e,_0x5c0cdf['options']);return db['VoiceMusicOnHold']['find'](_0x45887e)[_0x272f('0x24')](handleEntityNotFound(_0x523fed,null))[_0x272f('0x24')](respondWithResult(_0x523fed,null))[_0x272f('0x47')](handleError(_0x523fed,null));};exports['update']=function(_0x5cbf68,_0x9c016f){if(_0x5cbf68['body']['id']){delete _0x5cbf68[_0x272f('0x4a')]['id'];}return db['VoiceMusicOnHold'][_0x272f('0x4b')]({'where':{'id':_0x5cbf68[_0x272f('0x49')]['id']}})['then'](handleEntityNotFound(_0x9c016f,null))[_0x272f('0x24')](saveUpdates(_0x5cbf68['body'],null))[_0x272f('0x24')](respondWithResult(_0x9c016f,null))[_0x272f('0x47')](handleError(_0x9c016f,null));};exports[_0x272f('0x4c')]=function(_0x404cca,_0x38d743,_0x2e373b){return db[_0x272f('0x4d')][_0x272f('0x4e')](function(_0xa63da0){if(_0x404cca['body'][_0x272f('0x4f')]==='files'){_0x404cca[_0x272f('0x4a')][_0x272f('0x50')]=path[_0x272f('0x51')](config['root'],_0x272f('0x52'),_0x404cca[_0x272f('0x4a')]['name']);}return db[_0x272f('0x2e')][_0x272f('0x4c')](_0x404cca['body'],{'transaction':_0xa63da0})[_0x272f('0x24')](function(_0x37598f){if(_0x404cca['body'][_0x272f('0x4f')]===_0x272f('0x53')){fs[_0x272f('0x54')](_0x37598f[_0x272f('0x50')],parseInt(_0x272f('0x55'),0x8));}var _0x7338dd=_0x404cca[_0x272f('0x56')]['get']({'plain':!![]});if(!_0x7338dd)throw new Error(_0x272f('0x57'));if(_0x7338dd[_0x272f('0x58')]===_0x272f('0x56')){var _0x3c3d19=_0x37598f[_0x272f('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x272f('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x7338dd[_0x272f('0x59')]},'raw':!![]})[_0x272f('0x24')](function(_0x385e0d){if(_0x385e0d&&_0x385e0d[_0x272f('0x5a')]===0x0){return db[_0x272f('0x28')][_0x272f('0x4c')]({'name':_0x3c3d19[_0x272f('0x2b')],'resourceId':_0x3c3d19['id'],'type':_0x385e0d[_0x272f('0x2b')],'sectionId':_0x385e0d['id']},{})['then'](function(){return _0x37598f;});}else{return _0x37598f;}})['catch'](function(_0x28ad1d){logger[_0x272f('0x29')](_0x272f('0x5b'),_0x28ad1d);});}return _0x37598f;});})['then'](respondWithResult(_0x38d743,0xc9))['catch'](handleError(_0x38d743,null));};exports['destroy']=function(_0x2b9677,_0x38e0de,_0x1619d4){var _0x7e9397;return db[_0x272f('0x2e')][_0x272f('0x4b')]({'where':{'id':_0x2b9677['params']['id']}})[_0x272f('0x24')](function(_0x4213de){if(_0x4213de){return db[_0x272f('0x4d')]['transaction'](function(_0x3cc9f8){return _0x4213de[_0x272f('0x25')]({'transaction':_0x3cc9f8,'raw':!![]})[_0x272f('0x24')](function(_0x28c6d4){if(_0x28c6d4[_0x272f('0x50')]){fs[_0x272f('0x5c')](_0x28c6d4['directory'])[_0x272f('0x5d')](function(_0x26bb09){fs[_0x272f('0x5e')](path[_0x272f('0x51')](_0x28c6d4[_0x272f('0x50')],_0x26bb09));});fs[_0x272f('0x5f')](_0x28c6d4['directory']);}return _0x28c6d4;});})['catch'](function(_0x8d847c){throw new db[(_0x272f('0x60'))][(_0x272f('0x61'))](_0x8d847c[_0x272f('0x62')]);});}})[_0x272f('0x24')](handleEntityNotFound(_0x38e0de,null))['then'](removeEntity(_0x38e0de,null))[_0x272f('0x47')](handleError(_0x38e0de,null));};exports[_0x272f('0x63')]=function(_0x348f82,_0x4d4b5d,_0x18ff8c){return db[_0x272f('0x4d')][_0x272f('0x4e')](function(_0x10bcb0){var _0xb9c0f8;return db['VoiceMusicOnHold'][_0x272f('0x4b')]({'where':{'id':_0x348f82[_0x272f('0x49')]['id']}})[_0x272f('0x24')](function(_0x206b51){if(_0x206b51){_0xb9c0f8=_0x206b51;return _0x206b51[_0x272f('0x63')](_0x348f82[_0x272f('0x4a')]['id'],{'transaction':_0x10bcb0});}})['then'](function(_0x2cbe73){if(_0x2cbe73){return db[_0x272f('0x64')][_0x272f('0x65')]({'where':{'id':_0x348f82[_0x272f('0x4a')]['id']},'attributes':['id',_0x272f('0x2b'),_0x272f('0x66'),_0x272f('0x67'),_0x272f('0x68')],'raw':!![]});}})['then'](function(_0x28818){if(_0x28818){var _0x14d44b=path[_0x272f('0x51')](config[_0x272f('0x69')],'server/files/sounds/converted',util['format'](_0x272f('0x6a'),path[_0x272f('0x6b')](_0x28818[_0x272f('0x66')],path[_0x272f('0x6c')](_0x28818[_0x272f('0x66')])),_0x28818[_0x272f('0x67')]));var _0x18f9f5=path[_0x272f('0x51')](config[_0x272f('0x69')],_0x272f('0x52'),_0xb9c0f8[_0x272f('0x2b')],util[_0x272f('0x6d')]('%s.%s',_0x28818[_0x272f('0x2b')],_0x28818[_0x272f('0x67')]));fs['symlinkSync'](_0x14d44b,_0x18f9f5);return _0x28818;}})[_0x272f('0x47')](function(_0x15eecb){throw new db[(_0x272f('0x60'))][(_0x272f('0x61'))](_0x15eecb[_0x272f('0x62')]);});})['then'](handleEntityNotFound(_0x4d4b5d,null))[_0x272f('0x24')](respondWithResult(_0x4d4b5d,0xc9))[_0x272f('0x47')](handleError(_0x4d4b5d,null));};exports[_0x272f('0x6e')]=function(_0x2b8b99,_0x22d40b,_0x3aee86){return db[_0x272f('0x4d')][_0x272f('0x4e')](function(_0x24e52d){var _0x27c5e8;return db[_0x272f('0x2e')][_0x272f('0x65')]({'where':{'id':_0x2b8b99['params']['id']}})[_0x272f('0x24')](handleEntityNotFound(_0x22d40b,null))[_0x272f('0x24')](function(_0x1b8552){if(_0x1b8552){_0x27c5e8=_0x1b8552;return _0x1b8552[_0x272f('0x6e')](_0x2b8b99[_0x272f('0x49')][_0x272f('0x6f')]);}})[_0x272f('0x24')](function(_0x53fabb){if(_0x53fabb){return db[_0x272f('0x64')][_0x272f('0x65')]({'where':{'id':_0x2b8b99[_0x272f('0x49')][_0x272f('0x6f')]},'attributes':['id',_0x272f('0x2b'),'save_name',_0x272f('0x67'),_0x272f('0x68')],'raw':!![]});}})['then'](function(_0x42efa6){if(_0x42efa6){fs[_0x272f('0x5e')](path[_0x272f('0x51')](_0x27c5e8[_0x272f('0x50')],util['format'](_0x272f('0x6a'),_0x42efa6[_0x272f('0x2b')],_0x42efa6[_0x272f('0x67')])));return _0x42efa6;}})['catch'](function(_0x2d09fe){throw new db[(_0x272f('0x60'))][(_0x272f('0x61'))](_0x2d09fe[_0x272f('0x62')]);});})['then'](handleEntityNotFound(_0x22d40b,null))[_0x272f('0x24')](respondWithStatusCode(_0x22d40b,0xcc))['catch'](handleError(_0x22d40b,null));};exports[_0x272f('0x70')]=function(_0x32603b,_0x70be47,_0x1695c3){var _0x23cb0d={};var _0x1297b9={};var _0x44bcd2;var _0x27327c;return db[_0x272f('0x2e')]['findOne']({'where':{'id':_0x32603b[_0x272f('0x49')]['id']}})[_0x272f('0x24')](handleEntityNotFound(_0x70be47,null))['then'](function(_0x47d2b5){if(_0x47d2b5){_0x44bcd2=_0x47d2b5;_0x1297b9[_0x272f('0x32')]=_[_0x272f('0x33')](db['Sound']['rawAttributes']);_0x1297b9[_0x272f('0x35')]=_[_0x272f('0x33')](_0x32603b['query']);_0x1297b9[_0x272f('0x34')]=_['intersection'](_0x1297b9[_0x272f('0x32')],_0x1297b9[_0x272f('0x35')]);_0x23cb0d[_0x272f('0x36')]=_[_0x272f('0x37')](_0x1297b9[_0x272f('0x32')],qs[_0x272f('0x38')](_0x32603b['query'][_0x272f('0x38')]));_0x23cb0d[_0x272f('0x36')]=_0x23cb0d[_0x272f('0x36')]['length']?_0x23cb0d[_0x272f('0x36')]:_0x1297b9['model'];_0x23cb0d['order']=qs[_0x272f('0x3d')](_0x32603b[_0x272f('0x35')][_0x272f('0x3d')]);_0x23cb0d['where']=qs[_0x272f('0x34')](_[_0x272f('0x71')](_0x32603b[_0x272f('0x35')],_0x1297b9[_0x272f('0x34')]));if(_0x32603b[_0x272f('0x35')]['filter']){_0x23cb0d[_0x272f('0x3e')]=_['merge'](_0x23cb0d['where'],{'$or':_[_0x272f('0x2d')](_0x23cb0d['attributes'],function(_0x29806c){var _0x5e60fc={};_0x5e60fc[_0x29806c]={'$like':'%'+_0x32603b[_0x272f('0x35')][_0x272f('0x3f')]+'%'};return _0x5e60fc;})});}_0x23cb0d=_[_0x272f('0x41')]({},_0x23cb0d,_0x32603b[_0x272f('0x42')]);return _0x44bcd2[_0x272f('0x70')](_0x23cb0d);}})[_0x272f('0x24')](function(_0x33beed){if(_0x33beed){_0x27327c=_0x33beed[_0x272f('0x39')];if(!_0x32603b[_0x272f('0x35')][_0x272f('0x3a')](_0x272f('0x3b'))){_0x23cb0d['limit']=qs['limit'](_0x32603b['query'][_0x272f('0x3c')]);_0x23cb0d[_0x272f('0x1d')]=qs[_0x272f('0x1d')](_0x32603b['query'][_0x272f('0x1d')]);}return _0x44bcd2['getSounds'](_0x23cb0d);}})['then'](function(_0x253b5f){if(_0x253b5f){return _0x253b5f?{'count':_0x27327c,'rows':_0x253b5f}:null;}})[_0x272f('0x24')](respondWithResult(_0x70be47,null))[_0x272f('0x47')](handleError(_0x70be47,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5312ecf..2680135 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 _0x5555=['api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5555,0x106));var _0x5555=function(_0x3eed03,_0x459239){_0x3eed03=_0x3eed03-0x0;var _0x26ffea=_0x5555[_0x3eed03];return _0x26ffea;};'use strict';var _=require(_0x5555('0x0'));var util=require('util');var logger=require(_0x5555('0x1'))(_0x5555('0x2'));var moment=require(_0x5555('0x3'));var BPromise=require(_0x5555('0x4'));var rp=require(_0x5555('0x5'));var fs=require('fs');var path=require(_0x5555('0x6'));var rimraf=require(_0x5555('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x5555('0x8')]=function(_0x9e3568,_0x4fd986){return _0x9e3568[_0x5555('0x9')](_0x5555('0xa'),attributes,{'tableName':_0x5555('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e7f=['bluebird','request-promise','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment'];(function(_0x31d9a7,_0x54ed98){var _0x240a51=function(_0x94cfc7){while(--_0x94cfc7){_0x31d9a7['push'](_0x31d9a7['shift']());}};_0x240a51(++_0x54ed98);}(_0x8e7f,0x100));var _0xf8e7=function(_0x39d1dc,_0x1dc490){_0x39d1dc=_0x39d1dc-0x0;var _0xaaaafa=_0x8e7f[_0x39d1dc];return _0xaaaafa;};'use strict';var _=require(_0xf8e7('0x0'));var util=require(_0xf8e7('0x1'));var logger=require('../../config/logger')(_0xf8e7('0x2'));var moment=require(_0xf8e7('0x3'));var BPromise=require(_0xf8e7('0x4'));var rp=require(_0xf8e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8e7('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x58c72f,_0xb436af){return _0x58c72f[_0xf8e7('0x7')](_0xf8e7('0x8'),attributes,{'tableName':_0xf8e7('0x9'),'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 9190701..f103aa7 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 _0xb29e=['../../config/environment','http','request','then','info','debug','request\x20sent','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xb29e,0x10b));var _0xeb29=function(_0x247064,_0x471718){_0x247064=_0x247064-0x0;var _0x287b72=_0xb29e[_0x247064];return _0x287b72;};'use strict';var _=require(_0xeb29('0x0'));var util=require(_0xeb29('0x1'));var moment=require(_0xeb29('0x2'));var BPromise=require(_0xeb29('0x3'));var rs=require(_0xeb29('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb29('0x5'))['db'];var utils=require(_0xeb29('0x6'));var logger=require(_0xeb29('0x7'))(_0xeb29('0x8'));var config=require(_0xeb29('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeb29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae565,_0xb8d19e,_0x4b05cc){return new BPromise(function(_0x1bd16a,_0x5de91a){return client[_0xeb29('0xb')](_0x3ae565,_0x4b05cc)[_0xeb29('0xc')](function(_0x5bd963){logger[_0xeb29('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xb8d19e,'request\x20sent');logger[_0xeb29('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xb8d19e,_0xeb29('0xf'),JSON[_0xeb29('0x10')](_0x5bd963));if(_0x5bd963[_0xeb29('0x11')]){if(_0x5bd963[_0xeb29('0x11')][_0xeb29('0x12')]===0x1f4){logger['error'](_0xeb29('0x13'),_0xb8d19e,_0x5bd963[_0xeb29('0x11')]['message']);return _0x5de91a(_0x5bd963[_0xeb29('0x11')][_0xeb29('0x14')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0xb8d19e,_0x5bd963['error'][_0xeb29('0x14')]);return _0x1bd16a(_0x5bd963[_0xeb29('0x11')]['message']);}else{logger[_0xeb29('0xd')](_0xeb29('0x13'),_0xb8d19e,_0xeb29('0xf'));_0x1bd16a(_0x5bd963[_0xeb29('0x15')][_0xeb29('0x14')]);}})[_0xeb29('0x16')](function(_0x4cbff9){logger[_0xeb29('0x11')](_0xeb29('0x13'),_0xb8d19e,_0x4cbff9);_0x5de91a(_0x4cbff9);});});} \ No newline at end of file +var _0x45eb=['jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x45eb,0x171));var _0xb45e=function(_0x2f128f,_0x287f55){_0x2f128f=_0x2f128f-0x0;var _0x434e4a=_0x45eb[_0x2f128f];return _0x434e4a;};'use strict';var _=require(_0xb45e('0x0'));var util=require(_0xb45e('0x1'));var moment=require(_0xb45e('0x2'));var BPromise=require(_0xb45e('0x3'));var rs=require(_0xb45e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb45e('0x5'))['db'];var utils=require(_0xb45e('0x6'));var logger=require('../../config/logger')(_0xb45e('0x7'));var config=require(_0xb45e('0x8'));var jayson=require(_0xb45e('0x9'));var client=jayson['client'][_0xb45e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45b7bc,_0x2096b1,_0x3e9bea){return new BPromise(function(_0x55fccc,_0x49f112){return client[_0xb45e('0xb')](_0x45b7bc,_0x3e9bea)['then'](function(_0x5e46ba){logger[_0xb45e('0xc')](_0xb45e('0xd'),_0x2096b1,'request\x20sent');logger[_0xb45e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2096b1,_0xb45e('0xf'),JSON['stringify'](_0x5e46ba));if(_0x5e46ba['error']){if(_0x5e46ba[_0xb45e('0x10')][_0xb45e('0x11')]===0x1f4){logger[_0xb45e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2096b1,_0x5e46ba[_0xb45e('0x10')][_0xb45e('0x12')]);return _0x49f112(_0x5e46ba[_0xb45e('0x10')][_0xb45e('0x12')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2096b1,_0x5e46ba[_0xb45e('0x10')]['message']);return _0x55fccc(_0x5e46ba[_0xb45e('0x10')][_0xb45e('0x12')]);}else{logger[_0xb45e('0xc')](_0xb45e('0xd'),_0x2096b1,_0xb45e('0xf'));_0x55fccc(_0x5e46ba[_0xb45e('0x13')]['message']);}})[_0xb45e('0x14')](function(_0x31d6cb){logger[_0xb45e('0x10')](_0xb45e('0xd'),_0x2096b1,_0x31d6cb);_0x49f112(_0x31d6cb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 41ebe5e..5eb3838 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 _0x36a6=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','post','/:id/users','addAgents','put','update'];(function(_0x58fffa,_0x35f1b2){var _0x454595=function(_0x523884){while(--_0x523884){_0x58fffa['push'](_0x58fffa['shift']());}};_0x454595(++_0x35f1b2);}(_0x36a6,0x13e));var _0x636a=function(_0x559fbe,_0x165810){_0x559fbe=_0x559fbe-0x0;var _0x1e8dcf=_0x36a6[_0x559fbe];return _0x1e8dcf;};'use strict';var multer=require(_0x636a('0x0'));var util=require(_0x636a('0x1'));var path=require(_0x636a('0x2'));var timeout=require(_0x636a('0x3'));var express=require(_0x636a('0x4'));var router=express[_0x636a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x636a('0x6'));var config=require(_0x636a('0x7'));var controller=require(_0x636a('0x8'));router[_0x636a('0x9')]('/',auth[_0x636a('0xa')](),controller['index']);router[_0x636a('0x9')](_0x636a('0xb'),auth[_0x636a('0xa')](),controller['describe']);router[_0x636a('0x9')](_0x636a('0xc'),auth[_0x636a('0xa')](),controller['show']);router[_0x636a('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x636a('0xa')](),controller['create']);router[_0x636a('0xd')](_0x636a('0xe'),auth['isAuthenticated'](),controller[_0x636a('0xf')]);router[_0x636a('0x10')]('/:id',auth[_0x636a('0xa')](),controller[_0x636a('0x11')]);router[_0x636a('0x12')](_0x636a('0xc'),auth[_0x636a('0xa')](),controller[_0x636a('0x13')]);router[_0x636a('0x12')](_0x636a('0xe'),auth[_0x636a('0xa')](),controller['removeAgents']);module[_0x636a('0x14')]=router; \ No newline at end of file +var _0x4e46=['removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','create','put','update','delete','destroy'];(function(_0x353fe4,_0x465733){var _0x33ccd8=function(_0x419a78){while(--_0x419a78){_0x353fe4['push'](_0x353fe4['shift']());}};_0x33ccd8(++_0x465733);}(_0x4e46,0x139));var _0x64e4=function(_0x1fc603,_0x592c65){_0x1fc603=_0x1fc603-0x0;var _0x3db71e=_0x4e46[_0x1fc603];return _0x3db71e;};'use strict';var multer=require('multer');var util=require(_0x64e4('0x0'));var path=require(_0x64e4('0x1'));var timeout=require(_0x64e4('0x2'));var express=require(_0x64e4('0x3'));var router=express[_0x64e4('0x4')]();var auth=require(_0x64e4('0x5'));var interaction=require(_0x64e4('0x6'));var config=require(_0x64e4('0x7'));var controller=require(_0x64e4('0x8'));router[_0x64e4('0x9')]('/',auth['isAuthenticated'](),controller[_0x64e4('0xa')]);router[_0x64e4('0x9')](_0x64e4('0xb'),auth[_0x64e4('0xc')](),controller[_0x64e4('0xd')]);router[_0x64e4('0x9')](_0x64e4('0xe'),auth['isAuthenticated'](),controller[_0x64e4('0xf')]);router[_0x64e4('0x9')](_0x64e4('0x10'),auth[_0x64e4('0xc')](),controller[_0x64e4('0x11')]);router['post']('/',auth[_0x64e4('0xc')](),controller[_0x64e4('0x12')]);router['post'](_0x64e4('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x64e4('0x13')]('/:id',auth[_0x64e4('0xc')](),controller[_0x64e4('0x14')]);router[_0x64e4('0x15')](_0x64e4('0xe'),auth[_0x64e4('0xc')](),controller[_0x64e4('0x16')]);router['delete']('/:id/users',auth[_0x64e4('0xc')](),controller[_0x64e4('0x17')]);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 ccf4319..6fd5bed 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 _0x487f=['STRING','INTEGER','exports','name','system-'];(function(_0x46d4ca,_0x4f6852){var _0x3fcd61=function(_0x54d1f8){while(--_0x54d1f8){_0x46d4ca['push'](_0x46d4ca['shift']());}};_0x3fcd61(++_0x4f6852);}(_0x487f,0x165));var _0xf487=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x487f[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require('sequelize');module[_0xf487('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf487('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1d4c51){return _0xf487('0x2')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xf487('0x3')]},'callerIdAll':{'type':Sequelize[_0xf487('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0xf487('0x4')]}}; \ No newline at end of file +var _0x3ee8=['exports','STRING','name','INTEGER','sequelize'];(function(_0x471db1,_0x218c74){var _0x41ae25=function(_0x3ee14d){while(--_0x3ee14d){_0x471db1['push'](_0x471db1['shift']());}};_0x41ae25(++_0x218c74);}(_0x3ee8,0x8b));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x83ee('0x0'));module[_0x83ee('0x1')]={'name':{'type':Sequelize[_0x83ee('0x2')],'allowNull':![],'unique':_0x83ee('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x56b070){return'system-'+this['getDataValue'](_0x83ee('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x83ee('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x83ee('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e16dc88..7b2f292 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 _0x9576=['PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','addAgents','params','ids','omit','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','User','pick','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','get','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','filters','merge','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push'];(function(_0xa93bab,_0x548332){var _0x444ff8=function(_0x497960){while(--_0x497960){_0xa93bab['push'](_0xa93bab['shift']());}};_0x444ff8(++_0x548332);}(_0x9576,0x182));var _0x6957=function(_0x489bdc,_0x1e9863){_0x489bdc=_0x489bdc-0x0;var _0x91207b=_0x9576[_0x489bdc];return _0x91207b;};'use strict';var pdf=require(_0x6957('0x0'));var emlformat=require(_0x6957('0x1'));var rimraf=require(_0x6957('0x2'));var zipdir=require(_0x6957('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6957('0x4'));var BPromise=require(_0x6957('0x5'));var Mustache=require(_0x6957('0x6'));var util=require(_0x6957('0x7'));var path=require(_0x6957('0x8'));var sox=require(_0x6957('0x9'));var csv=require(_0x6957('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6957('0xb'));var squel=require(_0x6957('0xc'));var crypto=require(_0x6957('0xd'));var jsforce=require(_0x6957('0xe'));var deskjs=require(_0x6957('0xf'));var toCsv=require(_0x6957('0xa'));var querystring=require('querystring');var Papa=require(_0x6957('0x10'));var Redis=require(_0x6957('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6957('0x12'));var hardwareService=require(_0x6957('0x13'));var logger=require(_0x6957('0x14'))(_0x6957('0x15'));var utils=require(_0x6957('0x16'));var config=require(_0x6957('0x17'));var licenseUtil=require(_0x6957('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6957('0x19')],{'host':_0x6957('0x1a'),'port':0x18eb});var socket=require(_0x6957('0x1b'))(new Redis(config[_0x6957('0x19')]));require(_0x6957('0x1c'))[_0x6957('0x1d')](socket);function respondWithStatusCode(_0x25d32e,_0x5e9758){_0x5e9758=_0x5e9758||0xcc;return function(_0x5807c4){if(_0x5807c4){return _0x25d32e['sendStatus'](_0x5e9758);}return _0x25d32e[_0x6957('0x1e')](_0x5e9758)[_0x6957('0x1f')]();};}function respondWithResult(_0x228f76,_0x2a5e0c){_0x2a5e0c=_0x2a5e0c||0xc8;return function(_0x4b3289){if(_0x4b3289){return _0x228f76[_0x6957('0x1e')](_0x2a5e0c)['json'](_0x4b3289);}};}function respondWithFilteredResult(_0x2a39b5,_0xabd232){return function(_0x49aa31){if(_0x49aa31){var _0x2ccd8e=_0x49aa31[_0x6957('0x20')],_0x448ff6=_0xabd232[_0x6957('0x21')],_0x26b577=_0xabd232[_0x6957('0x21')]+_0xabd232[_0x6957('0x22')],_0x4c527c;if(_0x26b577>=_0x2ccd8e){_0x26b577=_0x2ccd8e;_0x4c527c=0xc8;}else{_0x4c527c=0xce;}_0x2a39b5[_0x6957('0x1e')](_0x4c527c);return _0x2a39b5[_0x6957('0x23')](_0x6957('0x24'),_0x448ff6+'-'+_0x26b577+'/'+_0x2ccd8e)[_0x6957('0x25')](_0x49aa31);}return null;};}function patchUpdates(_0x55fdb9){return function(_0x5ee3f8){try{jsonpatch[_0x6957('0x26')](_0x5ee3f8,_0x55fdb9,!![]);}catch(_0xa6dd1f){return BPromise[_0x6957('0x27')](_0xa6dd1f);}return _0x5ee3f8[_0x6957('0x28')]();};}function saveUpdates(_0x3591fa,_0x137fd1){return function(_0x395e59){if(_0x395e59){return _0x395e59[_0x6957('0x29')](_0x3591fa)['then'](function(_0x2b2dcd){return _0x2b2dcd;});}return null;};}function removeEntity(_0x3c9de7,_0x1f1228){return function(_0x210502){if(_0x210502){return _0x210502['destroy']()['then'](function(){var _0xa1e6af=_0x210502[_0x6957('0x2a')]({'plain':!![]});var _0x5c4e49='VoicePrefixes';return db[_0x6957('0x2b')][_0x6957('0x2c')]({'where':{'type':_0x5c4e49,'resourceId':_0xa1e6af['id']}})[_0x6957('0x2d')](function(){return _0x210502;});})['then'](function(){_0x3c9de7[_0x6957('0x1e')](0xcc)[_0x6957('0x1f')]();});}};}function handleEntityNotFound(_0x35ba67,_0x6981c){return function(_0x134905){if(!_0x134905){_0x35ba67[_0x6957('0x2e')](0x194);}return _0x134905;};}function handleError(_0x2d33ef,_0x320e1a){_0x320e1a=_0x320e1a||0x1f4;return function(_0x595770){logger[_0x6957('0x2f')](_0x595770[_0x6957('0x30')]);if(_0x595770[_0x6957('0x31')]){delete _0x595770[_0x6957('0x31')];}_0x2d33ef[_0x6957('0x1e')](_0x320e1a)[_0x6957('0x32')](_0x595770);};}exports[_0x6957('0x33')]=function(_0xef7f63,_0x1300b1){var _0x28994a={},_0x3de770={},_0x4950eb={'count':0x0,'rows':[]};var _0x5bb96a=_[_0x6957('0x34')](db[_0x6957('0x35')][_0x6957('0x36')],function(_0x320197){return{'name':_0x320197['fieldName'],'type':_0x320197[_0x6957('0x37')][_0x6957('0x38')]};});_0x3de770[_0x6957('0x39')]=_['map'](_0x5bb96a,'name');_0x3de770[_0x6957('0x3a')]=_[_0x6957('0x3b')](_0xef7f63[_0x6957('0x3a')]);_0x3de770['filters']=_[_0x6957('0x3c')](_0x3de770[_0x6957('0x39')],_0x3de770[_0x6957('0x3a')]);_0x28994a[_0x6957('0x3d')]=_[_0x6957('0x3c')](_0x3de770[_0x6957('0x39')],qs[_0x6957('0x3e')](_0xef7f63[_0x6957('0x3a')][_0x6957('0x3e')]));_0x28994a['attributes']=_0x28994a[_0x6957('0x3d')][_0x6957('0x3f')]?_0x28994a[_0x6957('0x3d')]:_0x3de770['model'];if(!_0xef7f63['query']['hasOwnProperty'](_0x6957('0x40'))){_0x28994a['limit']=qs['limit'](_0xef7f63[_0x6957('0x3a')][_0x6957('0x22')]);_0x28994a['offset']=qs['offset'](_0xef7f63[_0x6957('0x3a')][_0x6957('0x21')]);}_0x28994a[_0x6957('0x41')]=qs[_0x6957('0x42')](_0xef7f63[_0x6957('0x3a')]['sort']);_0x28994a[_0x6957('0x43')]=qs['filters'](_['pick'](_0xef7f63['query'],_0x3de770['filters']),_0x5bb96a);if(_0xef7f63['query']['filter']){_0x28994a['where']=_['merge'](_0x28994a['where'],{'$or':_[_0x6957('0x34')](_0x5bb96a,function(_0x3483e2){if(_0x3483e2[_0x6957('0x37')]!==_0x6957('0x44')){var _0x396087={};_0x396087[_0x3483e2[_0x6957('0x31')]]={'$like':'%'+_0xef7f63[_0x6957('0x3a')][_0x6957('0x45')]+'%'};return _0x396087;}})});}_0x28994a=_['merge']({},_0x28994a,_0xef7f63[_0x6957('0x46')]);var _0x570450={'where':_0x28994a[_0x6957('0x43')]};return db[_0x6957('0x35')][_0x6957('0x20')](_0x570450)[_0x6957('0x2d')](function(_0x41a1ba){_0x4950eb[_0x6957('0x20')]=_0x41a1ba;if(_0xef7f63[_0x6957('0x3a')][_0x6957('0x47')]){_0x28994a[_0x6957('0x48')]=[{'all':!![]}];}return db[_0x6957('0x35')][_0x6957('0x49')](_0x28994a);})[_0x6957('0x2d')](function(_0x23d600){_0x4950eb[_0x6957('0x4a')]=_0x23d600;return _0x4950eb;})[_0x6957('0x2d')](respondWithFilteredResult(_0x1300b1,_0x28994a))[_0x6957('0x4b')](handleError(_0x1300b1,null));};exports['show']=function(_0x3dd236,_0x4e31d6){var _0x500a39={'raw':![],'where':{'id':_0x3dd236['params']['id']}},_0x12dab2={};_0x12dab2['model']=_[_0x6957('0x3b')](db[_0x6957('0x35')][_0x6957('0x36')]);_0x12dab2[_0x6957('0x3a')]=_[_0x6957('0x3b')](_0x3dd236[_0x6957('0x3a')]);_0x12dab2[_0x6957('0x4c')]=_[_0x6957('0x3c')](_0x12dab2[_0x6957('0x39')],_0x12dab2[_0x6957('0x3a')]);_0x500a39['attributes']=_['intersection'](_0x12dab2[_0x6957('0x39')],qs['fields'](_0x3dd236[_0x6957('0x3a')][_0x6957('0x3e')]));_0x500a39['attributes']=_0x500a39[_0x6957('0x3d')][_0x6957('0x3f')]?_0x500a39[_0x6957('0x3d')]:_0x12dab2[_0x6957('0x39')];if(_0x3dd236[_0x6957('0x3a')]['includeAll']){_0x500a39[_0x6957('0x48')]=[{'all':!![]}];}_0x500a39=_[_0x6957('0x4d')]({},_0x500a39,_0x3dd236[_0x6957('0x46')]);return db[_0x6957('0x35')]['find'](_0x500a39)[_0x6957('0x2d')](handleEntityNotFound(_0x4e31d6,null))[_0x6957('0x2d')](respondWithResult(_0x4e31d6,null))['catch'](handleError(_0x4e31d6,null));};exports[_0x6957('0x2c')]=function(_0x1a41d6,_0x3b1aac){return db[_0x6957('0x35')]['find']({'where':{'id':_0x1a41d6['params']['id']}})[_0x6957('0x2d')](handleEntityNotFound(_0x3b1aac,null))[_0x6957('0x2d')](removeEntity(_0x3b1aac,null))[_0x6957('0x4b')](handleError(_0x3b1aac,null));};exports[_0x6957('0x4e')]=function(_0x519e0c,_0x1681f9){return db[_0x6957('0x35')][_0x6957('0x4e')]()['then'](respondWithResult(_0x1681f9,null))[_0x6957('0x4b')](handleError(_0x1681f9,null));};exports['create']=function(_0x354ace,_0x4858b4){var _0x52128f;return db[_0x6957('0x4f')][_0x6957('0x50')](function(_0x38e917){return db[_0x6957('0x35')][_0x6957('0x51')](_0x354ace[_0x6957('0x52')],{'transaction':_0x38e917})[_0x6957('0x2d')](function(_0x1006a5){_0x52128f=_0x1006a5[_0x6957('0x2a')]({'plain':!![]});return db[_0x6957('0x53')]['find']({'where':{'id':_0x52128f[_0x6957('0x54')]},'raw':!![]})[_0x6957('0x2d')](function(_0x12b57e){return createVoicePrefixExtensions(_0x52128f,_0x12b57e,_0x38e917);});});})['then'](function(){var _0xa489ec=_0x354ace['user'][_0x6957('0x2a')]({'plain':!![]});if(!_0xa489ec)throw new Error(_0x6957('0x55'));if(_0xa489ec['role']===_0x6957('0x56')){var _0xba9f98=_0x52128f;return db[_0x6957('0x57')][_0x6957('0x58')]({'where':{'name':_0x6957('0x59'),'userProfileId':_0xa489ec[_0x6957('0x5a')]},'raw':!![]})[_0x6957('0x2d')](function(_0x4543e7){if(_0x4543e7&&_0x4543e7['autoAssociation']===0x0){return db[_0x6957('0x2b')]['create']({'name':_0xba9f98[_0x6957('0x31')],'resourceId':_0xba9f98['id'],'type':_0x4543e7[_0x6957('0x31')],'sectionId':_0x4543e7['id']},{})[_0x6957('0x2d')](function(){return _0x52128f;});}else{return _0x52128f;}})['catch'](function(_0x17f821){logger[_0x6957('0x2f')](_0x6957('0x5b'),_0x17f821);throw _0x17f821;});}return _0x52128f;})['then'](respondWithResult(_0x4858b4,null))[_0x6957('0x4b')](handleError(_0x4858b4,null));};function Extension(_0x113139,_0x3c5c93,_0x2d38d6,_0x53c58f){this[_0x6957('0x5c')]='from-sip';this[_0x6957('0x5d')]=_0x113139;this[_0x6957('0x5e')]=_0x2d38d6;this[_0x6957('0x37')]='system';this[_0x6957('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x6957('0x60')]=_0x3c5c93;this[_0x6957('0x61')]=_0x53c58f;}function createVoicePrefixExtensions(_0x4d91d4,_0x221b5a,_0x455770){return new BPromise(function(_0x3deb85,_0x854848){var _0x5ce857=new Extension(formatPrefixName(_0x4d91d4[_0x6957('0x62')]),0x1,'NoOp','Voice\x20Prefix');_0x5ce857[_0x6957('0x63')]=_0x4d91d4['id'];return db['VoiceExtension'][_0x6957('0x51')](_0x5ce857,{'transaction':_0x455770})[_0x6957('0x2d')](function(_0x471a43){var _0x308ed1=_0x471a43[_0x6957('0x2a')]({'plain':!![]});var _0x2956cb=_[_0x6957('0x34')](addVoicePrefixExtensions(_0x4d91d4,_0x221b5a),function(_0x4d3fda){_0x4d3fda[_0x6957('0x54')]=_0x308ed1['id'];_0x4d3fda[_0x6957('0x63')]=_0x4d91d4['id'];return _0x4d3fda;});return db[_0x6957('0x53')][_0x6957('0x64')](_0x2956cb,{'transaction':_0x455770})['then'](function(_0x37248e){if(!_0x37248e){return _0x854848(_0x6957('0x65'));}else{return _0x3deb85(_0x37248e);}})[_0x6957('0x4b')](function(_0x17d9e9){return _0x854848(_0x17d9e9);});});;});};function addVoicePrefixExtensions(_0x581447,_0x30dd3f){var _0x224b4e=[];var _0x6ec7fb=formatPrefixName(_0x581447[_0x6957('0x62')]);_0x224b4e['push'](new Extension(_0x6ec7fb,0x2,_0x6957('0x66'),_0x6957('0x67')+_0x581447[_0x6957('0x31')]));if(_0x581447[_0x6957('0x68')]){_0x224b4e[_0x6957('0x69')](new Extension(_0x6ec7fb,0x3,_0x6957('0x66'),_0x6957('0x6a')+_0x581447[_0x6957('0x68')]));}else{_0x224b4e['push'](new Extension(_0x6ec7fb,0x3,'NoOp',_0x6957('0x6b')));}_0x224b4e[_0x6957('0x69')](new Extension(_0x6ec7fb,0x4,_0x6957('0x6c'),_0x30dd3f[_0x6957('0x5c')]+','+_0x6957('0x6d')+(0x8+_0x581447[_0x6957('0x31')][_0x6957('0x3f')])+'}'+','+0x1));return _0x224b4e;}function formatPrefixName(_0xf6da54){var _0x4210dd='_';for(var _0x5f1935=0x0;_0x5f1935<_0xf6da54[_0x6957('0x3f')];_0x5f1935++){if(_0xf6da54[_0x6957('0x6e')](_0x5f1935)=='-'){_0x4210dd+=_0xf6da54['charAt'](_0x5f1935);}else{_0x4210dd+='['+_0xf6da54['charAt'](_0x5f1935)+']';}}_0x4210dd+='.';return _0x4210dd;}exports[_0x6957('0x29')]=function(_0x2174d7,_0x71970e,_0xd3bad6){var _0x3a80f7=_0x2174d7[_0x6957('0x52')];_0x3a80f7[_0x6957('0x62')]='system-'+_0x3a80f7[_0x6957('0x31')]+'-';return db['sequelize'][_0x6957('0x50')](function(_0x41a646){return db['VoicePrefix']['update'](_0x3a80f7,{'where':{'id':_0x3a80f7['id']},'transaction':_0x41a646})[_0x6957('0x2d')](function(){return db['VoiceExtension'][_0x6957('0x2c')]({'where':{'VoicePrefixId':_0x3a80f7['id']},'transaction':_0x41a646})[_0x6957('0x2d')](function(){return db[_0x6957('0x53')][_0x6957('0x58')]({'where':{'id':_0x3a80f7[_0x6957('0x54')]},'raw':!![]})[_0x6957('0x2d')](function(_0x3c9422){return createVoicePrefixExtensions(_0x3a80f7,_0x3c9422,_0x41a646);});});});})['then'](function(){return db[_0x6957('0x35')]['findById'](_0x3a80f7['id']);})['then'](respondWithResult(_0x71970e,null))['catch'](handleError(_0x71970e,null));};exports[_0x6957('0x6f')]=function(_0x29eb18,_0x53ec3d,_0x44a769){return db[_0x6957('0x35')]['find']({'where':{'id':_0x29eb18[_0x6957('0x70')]['id']}})[_0x6957('0x2d')](handleEntityNotFound(_0x53ec3d,null))['then'](function(_0x395e0f){if(_0x395e0f){return _0x395e0f[_0x6957('0x6f')](_0x29eb18[_0x6957('0x52')][_0x6957('0x71')],_[_0x6957('0x72')](_0x29eb18[_0x6957('0x52')],[_0x6957('0x71'),'id'])||{})['spread'](function(_0x67aa09){for(var _0x4a7701=0x0;_0x4a7701<_0x29eb18['body'][_0x6957('0x71')][_0x6957('0x3f')];_0x4a7701+=0x1){socket['emit'](_0x6957('0x73'),{'UserId':_0x29eb18['body']['ids'][_0x4a7701],'VoicePrefixId':_0x29eb18[_0x6957('0x70')]['id']});}return _0x67aa09;});}})['then'](respondWithResult(_0x53ec3d,null))[_0x6957('0x4b')](handleError(_0x53ec3d,null));};exports['removeAgents']=function(_0x1c768d,_0x558d81,_0x5290d6){return db['VoicePrefix'][_0x6957('0x58')]({'where':{'id':_0x1c768d['params']['id']}})['then'](handleEntityNotFound(_0x558d81,null))[_0x6957('0x2d')](function(_0x5cd6a7){if(_0x5cd6a7){return _0x5cd6a7[_0x6957('0x74')](_0x1c768d['query'][_0x6957('0x71')])['then'](function(){if(_[_0x6957('0x75')](_0x1c768d[_0x6957('0x3a')][_0x6957('0x71')])){for(var _0x281cfb=0x0;_0x281cfb<_0x1c768d[_0x6957('0x3a')][_0x6957('0x71')][_0x6957('0x3f')];_0x281cfb+=0x1){socket[_0x6957('0x76')](_0x6957('0x77'),{'UserId':Number(_0x1c768d[_0x6957('0x3a')][_0x6957('0x71')][_0x281cfb]),'VoicePrefixId':Number(_0x1c768d[_0x6957('0x70')]['id'])});}}else{socket[_0x6957('0x76')](_0x6957('0x77'),{'UserId':Number(_0x1c768d[_0x6957('0x3a')]['ids']),'VoicePrefixId':Number(_0x1c768d[_0x6957('0x70')]['id'])});}});}})[_0x6957('0x2d')](respondWithStatusCode(_0x558d81,null))[_0x6957('0x4b')](handleError(_0x558d81,null));};exports['getAgents']=function(_0x5783f6,_0x59b090,_0x447f82){var _0x31b699={};var _0xffd17c={};var _0x13790b;var _0x8475a9;return db[_0x6957('0x35')]['findOne']({'where':{'id':_0x5783f6['params']['id']}})[_0x6957('0x2d')](handleEntityNotFound(_0x59b090,null))[_0x6957('0x2d')](function(_0x284900){if(_0x284900){_0x13790b=_0x284900;_0xffd17c[_0x6957('0x39')]=_[_0x6957('0x3b')](db[_0x6957('0x78')]['rawAttributes']);_0xffd17c['query']=_[_0x6957('0x3b')](_0x5783f6[_0x6957('0x3a')]);_0xffd17c[_0x6957('0x4c')]=_[_0x6957('0x3c')](_0xffd17c[_0x6957('0x39')],_0xffd17c[_0x6957('0x3a')]);_0x31b699[_0x6957('0x3d')]=_[_0x6957('0x3c')](_0xffd17c[_0x6957('0x39')],qs['fields'](_0x5783f6[_0x6957('0x3a')]['fields']));_0x31b699[_0x6957('0x3d')]=_0x31b699[_0x6957('0x3d')][_0x6957('0x3f')]?_0x31b699[_0x6957('0x3d')]:_0xffd17c[_0x6957('0x39')];_0x31b699[_0x6957('0x41')]=qs[_0x6957('0x42')](_0x5783f6['query'][_0x6957('0x42')]);_0x31b699['where']=qs[_0x6957('0x4c')](_[_0x6957('0x79')](_0x5783f6[_0x6957('0x3a')],_0xffd17c[_0x6957('0x4c')]));if(_0x5783f6[_0x6957('0x3a')][_0x6957('0x45')]){_0x31b699[_0x6957('0x43')]=_[_0x6957('0x4d')](_0x31b699[_0x6957('0x43')],{'$or':_[_0x6957('0x34')](_0x31b699[_0x6957('0x3d')],function(_0x22888a){var _0x13b1b6={};_0x13b1b6[_0x22888a]={'$like':'%'+_0x5783f6[_0x6957('0x3a')]['filter']+'%'};return _0x13b1b6;})});}_0x31b699=_[_0x6957('0x4d')]({},_0x31b699,_0x5783f6[_0x6957('0x46')]);return _0x13790b['getAgents'](_0x31b699);}})[_0x6957('0x2d')](function(_0x1c30f9){if(_0x1c30f9){_0x8475a9=_0x1c30f9[_0x6957('0x3f')];if(!_0x5783f6['query'][_0x6957('0x7a')]('nolimit')){_0x31b699[_0x6957('0x22')]=qs[_0x6957('0x22')](_0x5783f6[_0x6957('0x3a')][_0x6957('0x22')]);_0x31b699[_0x6957('0x21')]=qs[_0x6957('0x21')](_0x5783f6['query'][_0x6957('0x21')]);}return _0x13790b['getAgents'](_0x31b699);}})[_0x6957('0x2d')](function(_0x433ba1){if(_0x433ba1){return _0x433ba1?{'count':_0x8475a9,'rows':_0x433ba1}:null;}})[_0x6957('0x2d')](respondWithResult(_0x59b090,null))[_0x6957('0x4b')](handleError(_0x59b090,null));}; \ No newline at end of file +var _0xd8af=['NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','goto','context','${EXTEN:','charAt','update','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','VoicePrefixes','error','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','VoicePrefix','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0xd8af,0x18d));var _0xfd8a=function(_0x1ea648,_0xa25dfc){_0x1ea648=_0x1ea648-0x0;var _0x495410=_0xd8af[_0x1ea648];return _0x495410;};'use strict';var pdf=require(_0xfd8a('0x0'));var emlformat=require(_0xfd8a('0x1'));var rimraf=require(_0xfd8a('0x2'));var zipdir=require(_0xfd8a('0x3'));var jsonpatch=require(_0xfd8a('0x4'));var rp=require('request-promise');var moment=require(_0xfd8a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfd8a('0x6'));var util=require(_0xfd8a('0x7'));var path=require(_0xfd8a('0x8'));var sox=require('sox');var csv=require(_0xfd8a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd8a('0xa'));var squel=require(_0xfd8a('0xb'));var crypto=require(_0xfd8a('0xc'));var jsforce=require(_0xfd8a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfd8a('0x9'));var querystring=require(_0xfd8a('0xe'));var Papa=require(_0xfd8a('0xf'));var Redis=require(_0xfd8a('0x10'));var authService=require(_0xfd8a('0x11'));var qs=require(_0xfd8a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd8a('0x13'))(_0xfd8a('0x14'));var utils=require(_0xfd8a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfd8a('0x16')]=_[_0xfd8a('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd8a('0x18'))(new Redis(config[_0xfd8a('0x16')]));require(_0xfd8a('0x19'))[_0xfd8a('0x1a')](socket);function respondWithStatusCode(_0x2b4189,_0x3581e8){_0x3581e8=_0x3581e8||0xcc;return function(_0x395ee1){if(_0x395ee1){return _0x2b4189[_0xfd8a('0x1b')](_0x3581e8);}return _0x2b4189[_0xfd8a('0x1c')](_0x3581e8)[_0xfd8a('0x1d')]();};}function respondWithResult(_0x24b1d7,_0x2fb2c1){_0x2fb2c1=_0x2fb2c1||0xc8;return function(_0x215205){if(_0x215205){return _0x24b1d7[_0xfd8a('0x1c')](_0x2fb2c1)[_0xfd8a('0x1e')](_0x215205);}};}function respondWithFilteredResult(_0xf44ccd,_0x97ec09){return function(_0x1d5e85){if(_0x1d5e85){var _0x45428e=_0x1d5e85[_0xfd8a('0x1f')],_0xc9ad9c=_0x97ec09['offset'],_0x288f9a=_0x97ec09[_0xfd8a('0x20')]+_0x97ec09[_0xfd8a('0x21')],_0x19e7ed;if(_0x288f9a>=_0x45428e){_0x288f9a=_0x45428e;_0x19e7ed=0xc8;}else{_0x19e7ed=0xce;}_0xf44ccd[_0xfd8a('0x1c')](_0x19e7ed);return _0xf44ccd['set'](_0xfd8a('0x22'),_0xc9ad9c+'-'+_0x288f9a+'/'+_0x45428e)['json'](_0x1d5e85);}return null;};}function patchUpdates(_0x27411a){return function(_0x5415bc){try{jsonpatch[_0xfd8a('0x23')](_0x5415bc,_0x27411a,!![]);}catch(_0x2d087a){return BPromise[_0xfd8a('0x24')](_0x2d087a);}return _0x5415bc[_0xfd8a('0x25')]();};}function saveUpdates(_0x292b75,_0x1108dc){return function(_0x12d230){if(_0x12d230){return _0x12d230['update'](_0x292b75)[_0xfd8a('0x26')](function(_0x2e3067){return _0x2e3067;});}return null;};}function removeEntity(_0x2e582f,_0x2715ea){return function(_0x3e59de){if(_0x3e59de){return _0x3e59de[_0xfd8a('0x27')]()[_0xfd8a('0x26')](function(){var _0x1d7042=_0x3e59de[_0xfd8a('0x28')]({'plain':!![]});var _0x5e101e=_0xfd8a('0x29');return db['UserProfileResource'][_0xfd8a('0x27')]({'where':{'type':_0x5e101e,'resourceId':_0x1d7042['id']}})[_0xfd8a('0x26')](function(){return _0x3e59de;});})[_0xfd8a('0x26')](function(){_0x2e582f[_0xfd8a('0x1c')](0xcc)[_0xfd8a('0x1d')]();});}};}function handleEntityNotFound(_0x25417b,_0x23634c){return function(_0x66c047){if(!_0x66c047){_0x25417b[_0xfd8a('0x1b')](0x194);}return _0x66c047;};}function handleError(_0x4a5926,_0x266f19){_0x266f19=_0x266f19||0x1f4;return function(_0xf5dfde){logger[_0xfd8a('0x2a')](_0xf5dfde['stack']);if(_0xf5dfde[_0xfd8a('0x2b')]){delete _0xf5dfde[_0xfd8a('0x2b')];}_0x4a5926[_0xfd8a('0x1c')](_0x266f19)[_0xfd8a('0x2c')](_0xf5dfde);};}exports['index']=function(_0x5992b6,_0x592e7c){var _0x345486={},_0x11f9e8={},_0x28404b={'count':0x0,'rows':[]};var _0x50420f=_[_0xfd8a('0x2d')](db['VoicePrefix']['rawAttributes'],function(_0xb7b183){return{'name':_0xb7b183[_0xfd8a('0x2e')],'type':_0xb7b183[_0xfd8a('0x2f')][_0xfd8a('0x30')]};});_0x11f9e8[_0xfd8a('0x31')]=_[_0xfd8a('0x2d')](_0x50420f,_0xfd8a('0x2b'));_0x11f9e8[_0xfd8a('0x32')]=_['keys'](_0x5992b6['query']);_0x11f9e8[_0xfd8a('0x33')]=_[_0xfd8a('0x34')](_0x11f9e8[_0xfd8a('0x31')],_0x11f9e8['query']);_0x345486[_0xfd8a('0x35')]=_['intersection'](_0x11f9e8[_0xfd8a('0x31')],qs[_0xfd8a('0x36')](_0x5992b6[_0xfd8a('0x32')][_0xfd8a('0x36')]));_0x345486['attributes']=_0x345486[_0xfd8a('0x35')][_0xfd8a('0x37')]?_0x345486[_0xfd8a('0x35')]:_0x11f9e8[_0xfd8a('0x31')];if(!_0x5992b6[_0xfd8a('0x32')]['hasOwnProperty']('nolimit')){_0x345486[_0xfd8a('0x21')]=qs[_0xfd8a('0x21')](_0x5992b6[_0xfd8a('0x32')]['limit']);_0x345486[_0xfd8a('0x20')]=qs['offset'](_0x5992b6['query']['offset']);}_0x345486[_0xfd8a('0x38')]=qs['sort'](_0x5992b6[_0xfd8a('0x32')][_0xfd8a('0x39')]);_0x345486[_0xfd8a('0x3a')]=qs[_0xfd8a('0x33')](_[_0xfd8a('0x3b')](_0x5992b6[_0xfd8a('0x32')],_0x11f9e8[_0xfd8a('0x33')]),_0x50420f);if(_0x5992b6['query'][_0xfd8a('0x3c')]){_0x345486[_0xfd8a('0x3a')]=_[_0xfd8a('0x3d')](_0x345486[_0xfd8a('0x3a')],{'$or':_[_0xfd8a('0x2d')](_0x50420f,function(_0x569ee1){if(_0x569ee1[_0xfd8a('0x2f')]!==_0xfd8a('0x3e')){var _0x1c24e3={};_0x1c24e3[_0x569ee1[_0xfd8a('0x2b')]]={'$like':'%'+_0x5992b6[_0xfd8a('0x32')][_0xfd8a('0x3c')]+'%'};return _0x1c24e3;}})});}_0x345486=_[_0xfd8a('0x3d')]({},_0x345486,_0x5992b6[_0xfd8a('0x3f')]);var _0x197dff={'where':_0x345486[_0xfd8a('0x3a')]};return db[_0xfd8a('0x40')][_0xfd8a('0x1f')](_0x197dff)['then'](function(_0x1b90da){_0x28404b[_0xfd8a('0x1f')]=_0x1b90da;if(_0x5992b6[_0xfd8a('0x32')]['includeAll']){_0x345486[_0xfd8a('0x41')]=[{'all':!![]}];}return db[_0xfd8a('0x40')][_0xfd8a('0x42')](_0x345486);})[_0xfd8a('0x26')](function(_0x5181ff){_0x28404b[_0xfd8a('0x43')]=_0x5181ff;return _0x28404b;})[_0xfd8a('0x26')](respondWithFilteredResult(_0x592e7c,_0x345486))[_0xfd8a('0x44')](handleError(_0x592e7c,null));};exports[_0xfd8a('0x45')]=function(_0x2a7236,_0x2cbe80){var _0x3edfb3={'raw':![],'where':{'id':_0x2a7236[_0xfd8a('0x46')]['id']}},_0x5a9249={};_0x5a9249[_0xfd8a('0x31')]=_[_0xfd8a('0x47')](db[_0xfd8a('0x40')][_0xfd8a('0x48')]);_0x5a9249['query']=_[_0xfd8a('0x47')](_0x2a7236['query']);_0x5a9249['filters']=_[_0xfd8a('0x34')](_0x5a9249[_0xfd8a('0x31')],_0x5a9249[_0xfd8a('0x32')]);_0x3edfb3[_0xfd8a('0x35')]=_[_0xfd8a('0x34')](_0x5a9249['model'],qs[_0xfd8a('0x36')](_0x2a7236[_0xfd8a('0x32')][_0xfd8a('0x36')]));_0x3edfb3[_0xfd8a('0x35')]=_0x3edfb3[_0xfd8a('0x35')][_0xfd8a('0x37')]?_0x3edfb3[_0xfd8a('0x35')]:_0x5a9249[_0xfd8a('0x31')];if(_0x2a7236[_0xfd8a('0x32')][_0xfd8a('0x49')]){_0x3edfb3[_0xfd8a('0x41')]=[{'all':!![]}];}_0x3edfb3=_['merge']({},_0x3edfb3,_0x2a7236[_0xfd8a('0x3f')]);return db[_0xfd8a('0x40')]['find'](_0x3edfb3)[_0xfd8a('0x26')](handleEntityNotFound(_0x2cbe80,null))[_0xfd8a('0x26')](respondWithResult(_0x2cbe80,null))[_0xfd8a('0x44')](handleError(_0x2cbe80,null));};exports[_0xfd8a('0x27')]=function(_0x3b0848,_0x51b620){return db[_0xfd8a('0x40')][_0xfd8a('0x4a')]({'where':{'id':_0x3b0848[_0xfd8a('0x46')]['id']}})['then'](handleEntityNotFound(_0x51b620,null))[_0xfd8a('0x26')](removeEntity(_0x51b620,null))[_0xfd8a('0x44')](handleError(_0x51b620,null));};exports[_0xfd8a('0x4b')]=function(_0x5e21ca,_0x964d81){return db[_0xfd8a('0x40')][_0xfd8a('0x4b')]()[_0xfd8a('0x26')](respondWithResult(_0x964d81,null))[_0xfd8a('0x44')](handleError(_0x964d81,null));};exports[_0xfd8a('0x4c')]=function(_0x39daa6,_0x4e70f9){var _0x1715dd;return db[_0xfd8a('0x4d')][_0xfd8a('0x4e')](function(_0x425b2c){return db[_0xfd8a('0x40')][_0xfd8a('0x4c')](_0x39daa6[_0xfd8a('0x4f')],{'transaction':_0x425b2c})[_0xfd8a('0x26')](function(_0x36c5d4){_0x1715dd=_0x36c5d4[_0xfd8a('0x28')]({'plain':!![]});return db[_0xfd8a('0x50')][_0xfd8a('0x4a')]({'where':{'id':_0x1715dd[_0xfd8a('0x51')]},'raw':!![]})[_0xfd8a('0x26')](function(_0x44fab1){return createVoicePrefixExtensions(_0x1715dd,_0x44fab1,_0x425b2c);});});})[_0xfd8a('0x26')](function(){var _0x29807e=_0x39daa6['user']['get']({'plain':!![]});if(!_0x29807e)throw new Error(_0xfd8a('0x52'));if(_0x29807e[_0xfd8a('0x53')]===_0xfd8a('0x54')){var _0x50cfa9=_0x1715dd;return db['UserProfileSection']['find']({'where':{'name':_0xfd8a('0x29'),'userProfileId':_0x29807e[_0xfd8a('0x55')]},'raw':!![]})[_0xfd8a('0x26')](function(_0x4f04bb){if(_0x4f04bb&&_0x4f04bb['autoAssociation']===0x0){return db[_0xfd8a('0x56')]['create']({'name':_0x50cfa9[_0xfd8a('0x2b')],'resourceId':_0x50cfa9['id'],'type':_0x4f04bb[_0xfd8a('0x2b')],'sectionId':_0x4f04bb['id']},{})[_0xfd8a('0x26')](function(){return _0x1715dd;});}else{return _0x1715dd;}})['catch'](function(_0x5d82a6){logger[_0xfd8a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d82a6);throw _0x5d82a6;});}return _0x1715dd;})[_0xfd8a('0x26')](respondWithResult(_0x4e70f9,null))[_0xfd8a('0x44')](handleError(_0x4e70f9,null));};function Extension(_0x411cf6,_0x58ca71,_0x16aed2,_0x502ba4){this['context']=_0xfd8a('0x57');this[_0xfd8a('0x58')]=_0x411cf6;this[_0xfd8a('0x59')]=_0x16aed2;this[_0xfd8a('0x2f')]=_0xfd8a('0x5a');this[_0xfd8a('0x5b')]=_0xfd8a('0x5c');this['priority']=_0x58ca71;this[_0xfd8a('0x5d')]=_0x502ba4;}function createVoicePrefixExtensions(_0x5266ec,_0x5ed1f4,_0x179236){return new BPromise(function(_0x474bc7,_0x38ecea){var _0x148a6b=new Extension(formatPrefixName(_0x5266ec[_0xfd8a('0x5e')]),0x1,_0xfd8a('0x5f'),_0xfd8a('0x60'));_0x148a6b[_0xfd8a('0x61')]=_0x5266ec['id'];return db[_0xfd8a('0x50')][_0xfd8a('0x4c')](_0x148a6b,{'transaction':_0x179236})[_0xfd8a('0x26')](function(_0xaf467){var _0x3f7895=_0xaf467[_0xfd8a('0x28')]({'plain':!![]});var _0x591d96=_[_0xfd8a('0x2d')](addVoicePrefixExtensions(_0x5266ec,_0x5ed1f4),function(_0x5a5723){_0x5a5723[_0xfd8a('0x51')]=_0x3f7895['id'];_0x5a5723[_0xfd8a('0x61')]=_0x5266ec['id'];return _0x5a5723;});return db[_0xfd8a('0x50')]['bulkCreate'](_0x591d96,{'transaction':_0x179236})['then'](function(_0x524cea){if(!_0x524cea){return _0x38ecea(_0xfd8a('0x62'));}else{return _0x474bc7(_0x524cea);}})[_0xfd8a('0x44')](function(_0x97656e){return _0x38ecea(_0x97656e);});});;});};function addVoicePrefixExtensions(_0xdaf7cb,_0x3e1a41){var _0x5a2fc3=[];var _0x1e0488=formatPrefixName(_0xdaf7cb[_0xfd8a('0x5e')]);_0x5a2fc3[_0xfd8a('0x63')](new Extension(_0x1e0488,0x2,'Set',_0xfd8a('0x64')+_0xdaf7cb['name']));if(_0xdaf7cb[_0xfd8a('0x65')]){_0x5a2fc3['push'](new Extension(_0x1e0488,0x3,_0xfd8a('0x66'),'PREFIX-CALLERIDALL='+_0xdaf7cb[_0xfd8a('0x65')]));}else{_0x5a2fc3[_0xfd8a('0x63')](new Extension(_0x1e0488,0x3,'NoOp','No\x20callerid\x20available'));}_0x5a2fc3['push'](new Extension(_0x1e0488,0x4,_0xfd8a('0x67'),_0x3e1a41[_0xfd8a('0x68')]+','+_0xfd8a('0x69')+(0x8+_0xdaf7cb[_0xfd8a('0x2b')][_0xfd8a('0x37')])+'}'+','+0x1));return _0x5a2fc3;}function formatPrefixName(_0x3bc971){var _0x20cf80='_';for(var _0x1145c7=0x0;_0x1145c7<_0x3bc971['length'];_0x1145c7++){if(_0x3bc971['charAt'](_0x1145c7)=='-'){_0x20cf80+=_0x3bc971[_0xfd8a('0x6a')](_0x1145c7);}else{_0x20cf80+='['+_0x3bc971[_0xfd8a('0x6a')](_0x1145c7)+']';}}_0x20cf80+='.';return _0x20cf80;}exports[_0xfd8a('0x6b')]=function(_0x8d4cfb,_0x51f230,_0x4e2601){var _0x2bb507=_0x8d4cfb[_0xfd8a('0x4f')];_0x2bb507['prefix']=_0xfd8a('0x6c')+_0x2bb507[_0xfd8a('0x2b')]+'-';return db[_0xfd8a('0x4d')][_0xfd8a('0x4e')](function(_0x276f5e){return db[_0xfd8a('0x40')][_0xfd8a('0x6b')](_0x2bb507,{'where':{'id':_0x2bb507['id']},'transaction':_0x276f5e})[_0xfd8a('0x26')](function(){return db['VoiceExtension'][_0xfd8a('0x27')]({'where':{'VoicePrefixId':_0x2bb507['id']},'transaction':_0x276f5e})[_0xfd8a('0x26')](function(){return db[_0xfd8a('0x50')][_0xfd8a('0x4a')]({'where':{'id':_0x2bb507[_0xfd8a('0x51')]},'raw':!![]})['then'](function(_0x36881c){return createVoicePrefixExtensions(_0x2bb507,_0x36881c,_0x276f5e);});});});})[_0xfd8a('0x26')](function(){return db[_0xfd8a('0x40')]['findById'](_0x2bb507['id']);})[_0xfd8a('0x26')](respondWithResult(_0x51f230,null))['catch'](handleError(_0x51f230,null));};exports[_0xfd8a('0x6d')]=function(_0x46acb5,_0x33e944,_0x81842d){return db[_0xfd8a('0x40')][_0xfd8a('0x4a')]({'where':{'id':_0x46acb5['params']['id']}})['then'](handleEntityNotFound(_0x33e944,null))[_0xfd8a('0x26')](function(_0x55cb10){if(_0x55cb10){return _0x55cb10[_0xfd8a('0x6d')](_0x46acb5[_0xfd8a('0x4f')][_0xfd8a('0x6e')],_[_0xfd8a('0x6f')](_0x46acb5[_0xfd8a('0x4f')],['ids','id'])||{})[_0xfd8a('0x70')](function(_0x1bf9d9){for(var _0x1ebdec=0x0;_0x1ebdec<_0x46acb5[_0xfd8a('0x4f')][_0xfd8a('0x6e')]['length'];_0x1ebdec+=0x1){socket[_0xfd8a('0x71')](_0xfd8a('0x72'),{'UserId':_0x46acb5['body'][_0xfd8a('0x6e')][_0x1ebdec],'VoicePrefixId':_0x46acb5['params']['id']});}return _0x1bf9d9;});}})[_0xfd8a('0x26')](respondWithResult(_0x33e944,null))[_0xfd8a('0x44')](handleError(_0x33e944,null));};exports[_0xfd8a('0x73')]=function(_0x33a650,_0x6e734,_0x9af82){return db[_0xfd8a('0x40')][_0xfd8a('0x4a')]({'where':{'id':_0x33a650[_0xfd8a('0x46')]['id']}})[_0xfd8a('0x26')](handleEntityNotFound(_0x6e734,null))[_0xfd8a('0x26')](function(_0x1f5ad2){if(_0x1f5ad2){return _0x1f5ad2[_0xfd8a('0x73')](_0x33a650[_0xfd8a('0x32')][_0xfd8a('0x6e')])['then'](function(){if(_[_0xfd8a('0x74')](_0x33a650[_0xfd8a('0x32')]['ids'])){for(var _0x1fc399=0x0;_0x1fc399<_0x33a650[_0xfd8a('0x32')][_0xfd8a('0x6e')][_0xfd8a('0x37')];_0x1fc399+=0x1){socket[_0xfd8a('0x71')](_0xfd8a('0x75'),{'UserId':Number(_0x33a650[_0xfd8a('0x32')][_0xfd8a('0x6e')][_0x1fc399]),'VoicePrefixId':Number(_0x33a650[_0xfd8a('0x46')]['id'])});}}else{socket[_0xfd8a('0x71')](_0xfd8a('0x75'),{'UserId':Number(_0x33a650[_0xfd8a('0x32')]['ids']),'VoicePrefixId':Number(_0x33a650[_0xfd8a('0x46')]['id'])});}});}})[_0xfd8a('0x26')](respondWithStatusCode(_0x6e734,null))['catch'](handleError(_0x6e734,null));};exports['getAgents']=function(_0x513064,_0x35e758,_0x21b4b2){var _0x590645={};var _0x4abd8d={};var _0xd586e5;var _0x25002c;return db[_0xfd8a('0x40')][_0xfd8a('0x76')]({'where':{'id':_0x513064[_0xfd8a('0x46')]['id']}})[_0xfd8a('0x26')](handleEntityNotFound(_0x35e758,null))[_0xfd8a('0x26')](function(_0x103172){if(_0x103172){_0xd586e5=_0x103172;_0x4abd8d[_0xfd8a('0x31')]=_[_0xfd8a('0x47')](db[_0xfd8a('0x77')][_0xfd8a('0x48')]);_0x4abd8d[_0xfd8a('0x32')]=_[_0xfd8a('0x47')](_0x513064[_0xfd8a('0x32')]);_0x4abd8d['filters']=_[_0xfd8a('0x34')](_0x4abd8d[_0xfd8a('0x31')],_0x4abd8d[_0xfd8a('0x32')]);_0x590645['attributes']=_[_0xfd8a('0x34')](_0x4abd8d[_0xfd8a('0x31')],qs[_0xfd8a('0x36')](_0x513064[_0xfd8a('0x32')][_0xfd8a('0x36')]));_0x590645[_0xfd8a('0x35')]=_0x590645[_0xfd8a('0x35')][_0xfd8a('0x37')]?_0x590645[_0xfd8a('0x35')]:_0x4abd8d[_0xfd8a('0x31')];_0x590645[_0xfd8a('0x38')]=qs['sort'](_0x513064['query']['sort']);_0x590645['where']=qs[_0xfd8a('0x33')](_['pick'](_0x513064['query'],_0x4abd8d[_0xfd8a('0x33')]));if(_0x513064['query']['filter']){_0x590645['where']=_[_0xfd8a('0x3d')](_0x590645['where'],{'$or':_[_0xfd8a('0x2d')](_0x590645[_0xfd8a('0x35')],function(_0x4e9fe1){var _0x190eca={};_0x190eca[_0x4e9fe1]={'$like':'%'+_0x513064['query'][_0xfd8a('0x3c')]+'%'};return _0x190eca;})});}_0x590645=_[_0xfd8a('0x3d')]({},_0x590645,_0x513064[_0xfd8a('0x3f')]);return _0xd586e5[_0xfd8a('0x78')](_0x590645);}})[_0xfd8a('0x26')](function(_0x17d447){if(_0x17d447){_0x25002c=_0x17d447[_0xfd8a('0x37')];if(!_0x513064['query'][_0xfd8a('0x79')](_0xfd8a('0x7a'))){_0x590645[_0xfd8a('0x21')]=qs['limit'](_0x513064['query'][_0xfd8a('0x21')]);_0x590645[_0xfd8a('0x20')]=qs[_0xfd8a('0x20')](_0x513064[_0xfd8a('0x32')][_0xfd8a('0x20')]);}return _0xd586e5['getAgents'](_0x590645);}})[_0xfd8a('0x26')](function(_0x1297f1){if(_0x1297f1){return _0x1297f1?{'count':_0x25002c,'rows':_0x1297f1}:null;}})[_0xfd8a('0x26')](respondWithResult(_0x35e758,null))[_0xfd8a('0x44')](handleError(_0x35e758,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 408502c..8b8edc6 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a6965,_0x28ce23){_0x4a6965=_0x4a6965-0x0;var _0x306607=_0xedd9[_0x4a6965];return _0x306607;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 90effd3..4f1c8b2 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 _0x307b=['define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x8bda20,_0x52ad98){var _0x29407b=function(_0x251b32){while(--_0x251b32){_0x8bda20['push'](_0x8bda20['shift']());}};_0x29407b(++_0x52ad98);}(_0x307b,0xfe));var _0xb307=function(_0x297282,_0xf2cee9){_0x297282=_0x297282-0x0;var _0x50500f=_0x307b[_0x297282];return _0x50500f;};'use strict';var _=require(_0xb307('0x0'));var util=require(_0xb307('0x1'));var logger=require(_0xb307('0x2'))(_0xb307('0x3'));var moment=require(_0xb307('0x4'));var BPromise=require(_0xb307('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb307('0x6'));var config=require(_0xb307('0x7'));var attributes=require(_0xb307('0x8'));module[_0xb307('0x9')]=function(_0x34bcdc,_0x4b7cd7){return _0x34bcdc[_0xb307('0xa')](_0xb307('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5177=['request-promise','path','rimraf','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','moment'];(function(_0x22e101,_0x412840){var _0xa51f61=function(_0x240122){while(--_0x240122){_0x22e101['push'](_0x22e101['shift']());}};_0xa51f61(++_0x412840);}(_0x5177,0x16f));var _0x7517=function(_0x3c8b0b,_0x2712df){_0x3c8b0b=_0x3c8b0b-0x0;var _0x58e5a5=_0x5177[_0x3c8b0b];return _0x58e5a5;};'use strict';var _=require('lodash');var util=require(_0x7517('0x0'));var logger=require(_0x7517('0x1'))('api');var moment=require(_0x7517('0x2'));var BPromise=require('bluebird');var rp=require(_0x7517('0x3'));var fs=require('fs');var path=require(_0x7517('0x4'));var rimraf=require(_0x7517('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x7517('0x6')]=function(_0x5c4223,_0x84fe6c){return _0x5c4223[_0x7517('0x7')](_0x7517('0x8'),attributes,{'tableName':_0x7517('0x9'),'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 e0cc781..4e11c08 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 _0xf333=['moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','./voicePrefix.socket','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','catch','lodash'];(function(_0xb5b99e,_0x188991){var _0xb0817b=function(_0x32048b){while(--_0x32048b){_0xb5b99e['push'](_0xb5b99e['shift']());}};_0xb0817b(++_0x188991);}(_0xf333,0x1cd));var _0x3f33=function(_0x5c56a8,_0x4a5dd7){_0x5c56a8=_0x5c56a8-0x0;var _0x2bcc04=_0xf333[_0x5c56a8];return _0x2bcc04;};'use strict';var _=require(_0x3f33('0x0'));var util=require('util');var moment=require(_0x3f33('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f33('0x2'));var fs=require('fs');var Redis=require(_0x3f33('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f33('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f33('0x5'));var jayson=require(_0x3f33('0x6'));var client=jayson[_0x3f33('0x7')]['http']({'port':0x232a});config[_0x3f33('0x8')]=_['defaults'](config[_0x3f33('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f33('0x9'))['register'](socket);function respondWithRpcPromise(_0x5a30e4,_0x39efa2,_0x4a826b){return new BPromise(function(_0x10dcbb,_0xe7a9e3){return client['request'](_0x5a30e4,_0x4a826b)[_0x3f33('0xa')](function(_0x346ee2){logger[_0x3f33('0xb')]('VoicePrefix,\x20%s,\x20%s',_0x39efa2,_0x3f33('0xc'));logger[_0x3f33('0xd')](_0x3f33('0xe'),_0x39efa2,'request\x20sent',JSON[_0x3f33('0xf')](_0x346ee2));if(_0x346ee2[_0x3f33('0x10')]){if(_0x346ee2[_0x3f33('0x10')][_0x3f33('0x11')]===0x1f4){logger[_0x3f33('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x39efa2,_0x346ee2[_0x3f33('0x10')]['message']);return _0xe7a9e3(_0x346ee2[_0x3f33('0x10')][_0x3f33('0x12')]);}logger['error'](_0x3f33('0x13'),_0x39efa2,_0x346ee2['error']['message']);return _0x10dcbb(_0x346ee2[_0x3f33('0x10')][_0x3f33('0x12')]);}else{logger[_0x3f33('0xb')]('VoicePrefix,\x20%s,\x20%s',_0x39efa2,_0x3f33('0xc'));_0x10dcbb(_0x346ee2['result'][_0x3f33('0x12')]);}})[_0x3f33('0x14')](function(_0x58f57b){logger[_0x3f33('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x39efa2,_0x58f57b);_0xe7a9e3(_0x58f57b);});});} \ No newline at end of file +var _0xfc65=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x428904,_0x769e9a){_0x428904=_0x428904-0x0;var _0x42747b=_0xfc65[_0x428904];return _0x42747b;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fc6('0x1'));var rs=require(_0x5fc6('0x2'));var fs=require('fs');var Redis=require(_0x5fc6('0x3'));var db=require(_0x5fc6('0x4'))['db'];var utils=require(_0x5fc6('0x5'));var logger=require(_0x5fc6('0x6'))(_0x5fc6('0x7'));var config=require(_0x5fc6('0x8'));var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});config[_0x5fc6('0xc')]=_[_0x5fc6('0xd')](config['redis'],{'host':_0x5fc6('0xe'),'port':0x18eb});var socket=require(_0x5fc6('0xf'))(new Redis(config[_0x5fc6('0xc')]));require(_0x5fc6('0x10'))[_0x5fc6('0x11')](socket);function respondWithRpcPromise(_0xbc3db9,_0x23c4e2,_0x27cad8){return new BPromise(function(_0x3d8781,_0x29781f){return client['request'](_0xbc3db9,_0x27cad8)[_0x5fc6('0x12')](function(_0x51ad7e){logger[_0x5fc6('0x13')](_0x5fc6('0x14'),_0x23c4e2,_0x5fc6('0x15'));logger[_0x5fc6('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23c4e2,_0x5fc6('0x15'),JSON[_0x5fc6('0x17')](_0x51ad7e));if(_0x51ad7e[_0x5fc6('0x18')]){if(_0x51ad7e[_0x5fc6('0x18')][_0x5fc6('0x19')]===0x1f4){logger[_0x5fc6('0x18')](_0x5fc6('0x14'),_0x23c4e2,_0x51ad7e[_0x5fc6('0x18')][_0x5fc6('0x1a')]);return _0x29781f(_0x51ad7e[_0x5fc6('0x18')]['message']);}logger['error'](_0x5fc6('0x14'),_0x23c4e2,_0x51ad7e[_0x5fc6('0x18')]['message']);return _0x3d8781(_0x51ad7e[_0x5fc6('0x18')][_0x5fc6('0x1a')]);}else{logger[_0x5fc6('0x13')](_0x5fc6('0x14'),_0x23c4e2,_0x5fc6('0x15'));_0x3d8781(_0x51ad7e[_0x5fc6('0x1b')]['message']);}})[_0x5fc6('0x1c')](function(_0x4363c1){logger[_0x5fc6('0x18')](_0x5fc6('0x14'),_0x23c4e2,_0x4363c1);_0x29781f(_0x4363c1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8bd51f0..b8857e5 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 _0xb597=['save','remove','emit','length','voicePrefix:'];(function(_0x21cc2c,_0x352b76){var _0x451978=function(_0x53e50b){while(--_0x53e50b){_0x21cc2c['push'](_0x21cc2c['shift']());}};_0x451978(++_0x352b76);}(_0xb597,0xa0));var _0x7b59=function(_0xe63692,_0xe65880){_0xe63692=_0xe63692-0x0;var _0x158dee=_0xb597[_0xe63692];return _0x158dee;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7b59('0x0'),_0x7b59('0x1'),'update'];function createListener(_0x551c7f,_0x553f48){return function(_0x51d7ec){_0x553f48[_0x7b59('0x2')](_0x551c7f,_0x51d7ec);};}function removeListener(_0x365722,_0x4e49c9){return function(){VoicePrefixEvents['removeListener'](_0x365722,_0x4e49c9);};}exports['register']=function(_0x1f0c8e){for(var _0xf9610b=0x0,_0x5ac1ce=events[_0x7b59('0x3')];_0xf9610b<_0x5ac1ce;_0xf9610b++){var _0x16ef2a=events[_0xf9610b];var _0xe47213=createListener(_0x7b59('0x4')+_0x16ef2a,_0x1f0c8e);VoicePrefixEvents['on'](_0x16ef2a,_0xe47213);}}; \ No newline at end of file +var _0x4987=['emit','register','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x4987,0x168));var _0x7498=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4987[_0xbb091];return _0x467a04;};'use strict';var VoicePrefixEvents=require(_0x7498('0x0'));var events=[_0x7498('0x1'),_0x7498('0x2'),_0x7498('0x3')];function createListener(_0x3af832,_0x43ee0a){return function(_0x2d1fc2){_0x43ee0a[_0x7498('0x4')](_0x3af832,_0x2d1fc2);};}function removeListener(_0x5a9f1c,_0x24308f){return function(){VoicePrefixEvents['removeListener'](_0x5a9f1c,_0x24308f);};}exports[_0x7498('0x5')]=function(_0x81c15f){for(var _0x2b3c1b=0x0,_0xb9c7c9=events['length'];_0x2b3c1b<_0xb9c7c9;_0x2b3c1b++){var _0x208cb1=events[_0x2b3c1b];var _0x5ebe1a=createListener(_0x7498('0x6')+_0x208cb1,_0x81c15f);VoicePrefixEvents['on'](_0x208cb1,_0x5ebe1a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 598e52a..8861e31 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 _0xec83=['update','delete','removeTeams','removeAgents','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','addAgents','put'];(function(_0x23a976,_0x1c261d){var _0xbaaa9d=function(_0x119197){while(--_0x119197){_0x23a976['push'](_0x23a976['shift']());}};_0xbaaa9d(++_0x1c261d);}(_0xec83,0x16e));var _0x3ec8=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0xec83[_0x347471];return _0x422b6a;};'use strict';var multer=require(_0x3ec8('0x0'));var util=require(_0x3ec8('0x1'));var path=require(_0x3ec8('0x2'));var timeout=require(_0x3ec8('0x3'));var express=require(_0x3ec8('0x4'));var router=express[_0x3ec8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ec8('0x6'));var config=require(_0x3ec8('0x7'));var controller=require('./voiceQueue.controller');router[_0x3ec8('0x8')]('/',auth[_0x3ec8('0x9')](),controller[_0x3ec8('0xa')]);router['get'](_0x3ec8('0xb'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0xc')]);router[_0x3ec8('0x8')](_0x3ec8('0xd'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0xe')]);router[_0x3ec8('0x8')](_0x3ec8('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x3ec8('0x8')]('/:id/hopper_finals',auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x10')]);router[_0x3ec8('0x8')](_0x3ec8('0x11'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x12')]);router[_0x3ec8('0x8')](_0x3ec8('0x13'),auth['isAuthenticated'](),controller[_0x3ec8('0x14')]);router[_0x3ec8('0x8')](_0x3ec8('0x15'),auth['isAuthenticated'](),controller[_0x3ec8('0x16')]);router[_0x3ec8('0x8')](_0x3ec8('0x17'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x18')]);router['get'](_0x3ec8('0x19'),auth['isAuthenticated'](),controller['getLists']);router[_0x3ec8('0x8')](_0x3ec8('0x1a'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x1b')]);router[_0x3ec8('0x1c')]('/',auth[_0x3ec8('0x9')](),controller['create']);router[_0x3ec8('0x1c')](_0x3ec8('0x1d'),auth['isAuthenticated'](),controller[_0x3ec8('0x1e')]);router[_0x3ec8('0x1c')](_0x3ec8('0x13'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x1f')]);router[_0x3ec8('0x1c')](_0x3ec8('0x15'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x20')]);router['post'](_0x3ec8('0x19'),auth[_0x3ec8('0x9')](),controller['addLists']);router['post'](_0x3ec8('0x1a'),auth[_0x3ec8('0x9')](),controller['addBlackLists']);router[_0x3ec8('0x21')]('/:id',auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x22')]);router[_0x3ec8('0x23')](_0x3ec8('0xb'),auth[_0x3ec8('0x9')](),controller['destroy']);router['delete'](_0x3ec8('0x13'),auth[_0x3ec8('0x9')](),controller[_0x3ec8('0x24')]);router[_0x3ec8('0x23')](_0x3ec8('0x15'),auth['isAuthenticated'](),controller[_0x3ec8('0x25')]);router[_0x3ec8('0x23')](_0x3ec8('0x19'),auth[_0x3ec8('0x9')](),controller['removeLists']);router[_0x3ec8('0x23')](_0x3ec8('0x1a'),auth['isAuthenticated'](),controller[_0x3ec8('0x26')]);module[_0x3ec8('0x27')]=router; \ No newline at end of file +var _0x274d=['../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','/:id/lists','addLists','put','update','delete','removeTeams','removeLists','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x274d,0x18b));var _0xd274=function(_0x31901b,_0x28436c){_0x31901b=_0x31901b-0x0;var _0x4988ed=_0x274d[_0x31901b];return _0x4988ed;};'use strict';var multer=require('multer');var util=require(_0xd274('0x0'));var path=require(_0xd274('0x1'));var timeout=require(_0xd274('0x2'));var express=require('express');var router=express[_0xd274('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd274('0x4'));var config=require(_0xd274('0x5'));var controller=require(_0xd274('0x6'));router[_0xd274('0x7')]('/',auth[_0xd274('0x8')](),controller[_0xd274('0x9')]);router[_0xd274('0x7')](_0xd274('0xa'),auth[_0xd274('0x8')](),controller['show']);router['get'](_0xd274('0xb'),auth[_0xd274('0x8')](),controller[_0xd274('0xc')]);router[_0xd274('0x7')](_0xd274('0xd'),auth['isAuthenticated'](),controller[_0xd274('0xe')]);router[_0xd274('0x7')](_0xd274('0xf'),auth[_0xd274('0x8')](),controller[_0xd274('0x10')]);router['get'](_0xd274('0x11'),auth[_0xd274('0x8')](),controller[_0xd274('0x12')]);router[_0xd274('0x7')](_0xd274('0x13'),auth[_0xd274('0x8')](),controller[_0xd274('0x14')]);router['get'](_0xd274('0x15'),auth[_0xd274('0x8')](),controller[_0xd274('0x16')]);router['get'](_0xd274('0x17'),auth['isAuthenticated'](),controller[_0xd274('0x18')]);router[_0xd274('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0xd274('0x19')]);router['get'](_0xd274('0x1a'),auth[_0xd274('0x8')](),controller[_0xd274('0x1b')]);router[_0xd274('0x1c')]('/',auth['isAuthenticated'](),controller[_0xd274('0x1d')]);router[_0xd274('0x1c')](_0xd274('0x1e'),auth[_0xd274('0x8')](),controller['clone']);router[_0xd274('0x1c')](_0xd274('0x13'),auth[_0xd274('0x8')](),controller[_0xd274('0x1f')]);router[_0xd274('0x1c')](_0xd274('0x15'),auth[_0xd274('0x8')](),controller[_0xd274('0x20')]);router[_0xd274('0x1c')](_0xd274('0x21'),auth[_0xd274('0x8')](),controller[_0xd274('0x22')]);router[_0xd274('0x1c')](_0xd274('0x1a'),auth[_0xd274('0x8')](),controller['addBlackLists']);router[_0xd274('0x23')](_0xd274('0xa'),auth[_0xd274('0x8')](),controller[_0xd274('0x24')]);router['delete'](_0xd274('0xa'),auth[_0xd274('0x8')](),controller['destroy']);router[_0xd274('0x25')](_0xd274('0x13'),auth[_0xd274('0x8')](),controller[_0xd274('0x26')]);router[_0xd274('0x25')](_0xd274('0x15'),auth[_0xd274('0x8')](),controller['removeAgents']);router[_0xd274('0x25')](_0xd274('0x21'),auth[_0xd274('0x8')](),controller[_0xd274('0x27')]);router[_0xd274('0x25')](_0xd274('0x1a'),auth[_0xd274('0x8')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 42fda5d..125eb66 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(_0x2dce5a,_0x2e992b){var _0x62fa90=function(_0x1fa3e9){while(--_0x1fa3e9){_0x2dce5a['push'](_0x2dce5a['shift']());}};_0x62fa90(++_0x2e992b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x2e3646,_0x412055){var _0x2b1dc1=function(_0x4e723a){while(--_0x4e723a){_0x2e3646['push'](_0x2e3646['shift']());}};_0x2b1dc1(++_0x412055);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 383343c..fee7c2d 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 _0x058e=['User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','each','findOrCreate','upsert','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','omit','format','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','type','find','name','UserProfileResource','end','sendStatus','error','stack','send','index','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','VoiceQueue','includeAll','rows','catch','show','params','rawAttributes','include','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','keys','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams'];(function(_0x4b2407,_0x3fa63e){var _0x5defa2=function(_0x3eaaf6){while(--_0x3eaaf6){_0x4b2407['push'](_0x4b2407['shift']());}};_0x5defa2(++_0x3fa63e);}(_0x058e,0x1bd));var _0xe058=function(_0x36ef9a,_0x7fc5c){_0x36ef9a=_0x36ef9a-0x0;var _0x2db2b3=_0x058e[_0x36ef9a];return _0x2db2b3;};'use strict';var pdf=require(_0xe058('0x0'));var emlformat=require(_0xe058('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe058('0x2'));var jsonpatch=require(_0xe058('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe058('0x4'));var Mustache=require(_0xe058('0x5'));var util=require(_0xe058('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe058('0x7'));var ejs=require(_0xe058('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe058('0x9'));var crypto=require(_0xe058('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe058('0xb'));var toCsv=require(_0xe058('0x7'));var querystring=require('querystring');var Papa=require(_0xe058('0xc'));var Redis=require(_0xe058('0xd'));var authService=require(_0xe058('0xe'));var qs=require(_0xe058('0xf'));var as=require(_0xe058('0x10'));var hardwareService=require(_0xe058('0x11'));var logger=require(_0xe058('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe058('0x13'));var licenseUtil=require(_0xe058('0x14'));var db=require(_0xe058('0x15'))['db'];config[_0xe058('0x16')]=_[_0xe058('0x17')](config[_0xe058('0x16')],{'host':_0xe058('0x18'),'port':0x18eb});var socket=require(_0xe058('0x19'))(new Redis(config[_0xe058('0x16')]));require(_0xe058('0x1a'))[_0xe058('0x1b')](socket);function respondWithStatusCode(_0x1793cc,_0x1c7c24){_0x1c7c24=_0x1c7c24||0xcc;return function(_0x5ee459){if(_0x5ee459){return _0x1793cc['sendStatus'](_0x1c7c24);}return _0x1793cc[_0xe058('0x1c')](_0x1c7c24)['end']();};}function respondWithResult(_0x5f3a14,_0x30e648){_0x30e648=_0x30e648||0xc8;return function(_0x5f2975){if(_0x5f2975){return _0x5f3a14[_0xe058('0x1c')](_0x30e648)[_0xe058('0x1d')](_0x5f2975);}};}function respondWithFilteredResult(_0x2eaf97,_0x2e2336){return function(_0x407382){if(_0x407382){var _0x403152=_0x407382[_0xe058('0x1e')],_0x39dc6e=_0x2e2336[_0xe058('0x1f')],_0x3d3da2=_0x2e2336[_0xe058('0x1f')]+_0x2e2336['limit'],_0x4a1851;if(_0x3d3da2>=_0x403152){_0x3d3da2=_0x403152;_0x4a1851=0xc8;}else{_0x4a1851=0xce;}_0x2eaf97['status'](_0x4a1851);return _0x2eaf97[_0xe058('0x20')](_0xe058('0x21'),_0x39dc6e+'-'+_0x3d3da2+'/'+_0x403152)[_0xe058('0x1d')](_0x407382);}return null;};}function patchUpdates(_0x17ae52){return function(_0x493798){try{jsonpatch[_0xe058('0x22')](_0x493798,_0x17ae52,!![]);}catch(_0x221ff1){return BPromise[_0xe058('0x23')](_0x221ff1);}return _0x493798[_0xe058('0x24')]();};}function saveUpdates(_0x25ae56,_0x2c33db){return function(_0x1b35cc){if(_0x1b35cc){return _0x1b35cc[_0xe058('0x25')](_0x25ae56)[_0xe058('0x26')](function(_0x5bdf9c){return _0x5bdf9c;});}return null;};}function removeEntity(_0x3eb668,_0x400510){return function(_0x180205){if(_0x180205){return _0x180205[_0xe058('0x27')]()[_0xe058('0x26')](function(){var _0x225223=_0x180205[_0xe058('0x28')]({'plain':!![]});var _0xa79cad=[{'name':_0xe058('0x29'),'value':_0xe058('0x2a'),'ignore':![]},{'name':_0xe058('0x2b'),'value':_0xe058('0x2c'),'ignore':![]}];var _0x21512e=_(_0xa79cad)[_0xe058('0x2d')]('ignore')[_0xe058('0x2e')](_0xe058('0x2f'))[_0xe058('0x2f')]();if(_['includes'](_0x21512e,_0x225223[_0xe058('0x30')])){return;}var _0x12f104=_[_0xe058('0x31')](_0xa79cad,[_0xe058('0x2f'),_0x225223[_0xe058('0x30')]])[_0xe058('0x32')];return db[_0xe058('0x33')][_0xe058('0x27')]({'where':{'type':_0x12f104,'resourceId':_0x225223['id']}})[_0xe058('0x26')](function(){return _0x180205;});})[_0xe058('0x26')](function(){_0x3eb668['status'](0xcc)[_0xe058('0x34')]();});}};}function handleEntityNotFound(_0xb42ed0,_0x57ca67){return function(_0x4922cf){if(!_0x4922cf){_0xb42ed0[_0xe058('0x35')](0x194);}return _0x4922cf;};}function handleError(_0x33ce5e,_0x472129){_0x472129=_0x472129||0x1f4;return function(_0xd4f47c){logger[_0xe058('0x36')](_0xd4f47c[_0xe058('0x37')]);if(_0xd4f47c[_0xe058('0x32')]){delete _0xd4f47c[_0xe058('0x32')];}_0x33ce5e['status'](_0x472129)[_0xe058('0x38')](_0xd4f47c);};}exports[_0xe058('0x39')]=function(_0x2f5234,_0x4bb34e){var _0x5b9e7a={},_0x4afc1c={},_0x36b9ce={'count':0x0,'rows':[]};var _0x490e6f=_[_0xe058('0x2e')](db['VoiceQueue']['rawAttributes'],function(_0x5330c9){return{'name':_0x5330c9[_0xe058('0x3a')],'type':_0x5330c9['type'][_0xe058('0x3b')]};});_0x4afc1c['model']=_[_0xe058('0x2e')](_0x490e6f,_0xe058('0x32'));_0x4afc1c[_0xe058('0x3c')]=_['keys'](_0x2f5234[_0xe058('0x3c')]);_0x4afc1c[_0xe058('0x3d')]=_[_0xe058('0x3e')](_0x4afc1c['model'],_0x4afc1c[_0xe058('0x3c')]);_0x5b9e7a[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x4afc1c[_0xe058('0x40')],qs[_0xe058('0x41')](_0x2f5234[_0xe058('0x3c')][_0xe058('0x41')]));_0x5b9e7a['attributes']=_0x5b9e7a[_0xe058('0x3f')][_0xe058('0x42')]?_0x5b9e7a[_0xe058('0x3f')]:_0x4afc1c['model'];if(!_0x2f5234['query'][_0xe058('0x43')](_0xe058('0x44'))){_0x5b9e7a['limit']=qs[_0xe058('0x45')](_0x2f5234[_0xe058('0x3c')][_0xe058('0x45')]);_0x5b9e7a[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0x2f5234[_0xe058('0x3c')][_0xe058('0x1f')]);}_0x5b9e7a[_0xe058('0x46')]=qs['sort'](_0x2f5234[_0xe058('0x3c')][_0xe058('0x47')]);_0x5b9e7a[_0xe058('0x48')]=qs['filters'](_[_0xe058('0x49')](_0x2f5234[_0xe058('0x3c')],_0x4afc1c['filters']),_0x490e6f);if(_0x2f5234[_0xe058('0x3c')][_0xe058('0x2d')]){_0x5b9e7a[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x5b9e7a[_0xe058('0x48')],{'$or':_[_0xe058('0x2e')](_0x490e6f,function(_0x1373ad){if(_0x1373ad[_0xe058('0x30')]!=='VIRTUAL'){var _0x3b8322={};_0x3b8322[_0x1373ad[_0xe058('0x32')]]={'$like':'%'+_0x2f5234['query'][_0xe058('0x2d')]+'%'};return _0x3b8322;}})});}_0x5b9e7a=_[_0xe058('0x4a')]({},_0x5b9e7a,_0x2f5234[_0xe058('0x4b')]);var _0x24e5dd={'where':_0x5b9e7a['where']};return db[_0xe058('0x4c')]['count'](_0x24e5dd)[_0xe058('0x26')](function(_0x439451){_0x36b9ce[_0xe058('0x1e')]=_0x439451;if(_0x2f5234[_0xe058('0x3c')][_0xe058('0x4d')]){_0x5b9e7a['include']=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x5b9e7a);})['then'](function(_0x6c42cd){_0x36b9ce[_0xe058('0x4e')]=_0x6c42cd;return _0x36b9ce;})[_0xe058('0x26')](respondWithFilteredResult(_0x4bb34e,_0x5b9e7a))[_0xe058('0x4f')](handleError(_0x4bb34e,null));};exports[_0xe058('0x50')]=function(_0x509307,_0x5dcc5f){var _0x49557c={'raw':![],'where':{'id':_0x509307[_0xe058('0x51')]['id']}},_0x27905c={};_0x27905c[_0xe058('0x40')]=_['keys'](db['VoiceQueue'][_0xe058('0x52')]);_0x27905c[_0xe058('0x3c')]=_['keys'](_0x509307[_0xe058('0x3c')]);_0x27905c['filters']=_[_0xe058('0x3e')](_0x27905c[_0xe058('0x40')],_0x27905c[_0xe058('0x3c')]);_0x49557c[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x27905c[_0xe058('0x40')],qs[_0xe058('0x41')](_0x509307['query'][_0xe058('0x41')]));_0x49557c[_0xe058('0x3f')]=_0x49557c[_0xe058('0x3f')][_0xe058('0x42')]?_0x49557c['attributes']:_0x27905c[_0xe058('0x40')];if(_0x509307[_0xe058('0x3c')][_0xe058('0x4d')]){_0x49557c[_0xe058('0x53')]=[{'all':!![]}];}_0x49557c=_['merge']({},_0x49557c,_0x509307['options']);return db['VoiceQueue'][_0xe058('0x31')](_0x49557c)[_0xe058('0x26')](handleEntityNotFound(_0x5dcc5f,null))[_0xe058('0x26')](respondWithResult(_0x5dcc5f,null))[_0xe058('0x4f')](handleError(_0x5dcc5f,null));};exports[_0xe058('0x54')]=function(_0x3c85eb,_0x33a490){return db['VoiceQueue'][_0xe058('0x54')](_0x3c85eb[_0xe058('0x55')],{})[_0xe058('0x26')](function(_0x4cfb71){var _0x4eba69=_0x3c85eb[_0xe058('0x56')][_0xe058('0x28')]({'plain':!![]});if(!_0x4eba69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4eba69[_0xe058('0x57')]===_0xe058('0x56')){var _0x12ce49=_0x4cfb71[_0xe058('0x28')]({'plain':!![]});var _0x15168c=[{'name':'VoiceQueues','value':_0xe058('0x2a')},{'name':_0xe058('0x2b'),'value':_0xe058('0x2c')}];var _0x15849a=_[_0xe058('0x31')](_0x15168c,[_0xe058('0x2f'),_0x12ce49['type']])['name'];return db[_0xe058('0x58')][_0xe058('0x31')]({'where':{'name':_0x15849a,'userProfileId':_0x4eba69[_0xe058('0x59')]},'raw':!![]})['then'](function(_0x3fb4d2){if(_0x3fb4d2&&_0x3fb4d2['autoAssociation']===0x0){return db[_0xe058('0x33')][_0xe058('0x54')]({'name':_0x12ce49[_0xe058('0x32')],'resourceId':_0x12ce49['id'],'type':_0x3fb4d2[_0xe058('0x32')],'sectionId':_0x3fb4d2['id']},{})[_0xe058('0x26')](function(){return _0x4cfb71;});}else{return _0x4cfb71;}})[_0xe058('0x4f')](function(_0x5a3a59){logger[_0xe058('0x36')](_0xe058('0x5a'),_0x5a3a59);throw _0x5a3a59;});}return _0x4cfb71;})[_0xe058('0x26')](respondWithResult(_0x33a490,0xc9))[_0xe058('0x4f')](handleError(_0x33a490,null));};exports[_0xe058('0x5b')]=function(_0x1c1a07,_0x551323){var _0x2f2fd0={'where':{'id':_0x1c1a07[_0xe058('0x51')]['id']}},_0x1471cf={};_0x1471cf[_0xe058('0x40')]=_['keys'](db[_0xe058('0x4c')]['rawAttributes']);_0x2f2fd0[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x1471cf[_0xe058('0x40')],qs[_0xe058('0x41')](_0x1c1a07[_0xe058('0x3c')][_0xe058('0x41')]));_0x2f2fd0['attributes']=_0x2f2fd0[_0xe058('0x3f')][_0xe058('0x42')]?_0x2f2fd0['attributes']:_0x1471cf[_0xe058('0x40')];if(_0x1c1a07[_0xe058('0x3c')][_0xe058('0x4d')]){_0x2f2fd0[_0xe058('0x53')]=[{'all':!![]}];}_0x2f2fd0=_[_0xe058('0x4a')]({},_0x2f2fd0,_0x1c1a07[_0xe058('0x4b')]);return db[_0xe058('0x4c')][_0xe058('0x31')](_0x2f2fd0)['then'](handleEntityNotFound(_0x551323,null))[_0xe058('0x26')](function(_0x20076d){if(_0x20076d){var _0x4ddbdc=_0x20076d[_0xe058('0x28')]({'plain':!![]});_0x4ddbdc=qs['omit'](_0x4ddbdc,['id','createdAt',_0xe058('0x5c')]);_0x1c1a07['body']=_['omit'](_0x1c1a07[_0xe058('0x55')],['id',_0xe058('0x5d'),_0xe058('0x5c')]);return db[_0xe058('0x4c')]['create'](_[_0xe058('0x4a')](_0x4ddbdc,_0x1c1a07[_0xe058('0x55')]),{'include':_0x1c1a07[_0xe058('0x3c')][_0xe058('0x4d')]?[{'all':!![]}]:undefined})[_0xe058('0x26')](function(_0x3abb11){var _0x4b4556=_0x1c1a07['user'][_0xe058('0x28')]({'plain':!![]});if(!_0x4b4556)throw new Error(_0xe058('0x5e'));if(_0x4b4556[_0xe058('0x57')]===_0xe058('0x56')){var _0x7e33a0=_0x3abb11[_0xe058('0x28')]({'plain':!![]});var _0x1c00de=[{'name':_0xe058('0x29'),'value':_0xe058('0x2a')},{'name':_0xe058('0x2b'),'value':_0xe058('0x2c')}];var _0xc7f030=_[_0xe058('0x31')](_0x1c00de,[_0xe058('0x2f'),_0x7e33a0[_0xe058('0x30')]])[_0xe058('0x32')];return db[_0xe058('0x58')]['find']({'where':{'name':_0xc7f030,'userProfileId':_0x4b4556[_0xe058('0x59')]},'raw':!![]})['then'](function(_0x57411a){if(_0x57411a&&_0x57411a['autoAssociation']===0x0){return db['UserProfileResource'][_0xe058('0x54')]({'name':_0x7e33a0['name'],'resourceId':_0x7e33a0['id'],'type':_0x57411a[_0xe058('0x32')],'sectionId':_0x57411a['id']},{})[_0xe058('0x26')](function(){return _0x3abb11;});}else{return _0x3abb11;}})[_0xe058('0x4f')](function(_0x47d857){logger[_0xe058('0x36')](_0xe058('0x5a'),_0x47d857);throw _0x47d857;});}return _0x3abb11;});}})[_0xe058('0x26')](respondWithResult(_0x551323,0xc9))[_0xe058('0x4f')](handleError(_0x551323,null));};exports['update']=function(_0x4b4a0d,_0xa80a1a){if(_0x4b4a0d['body']['id']){delete _0x4b4a0d[_0xe058('0x55')]['id'];}return db[_0xe058('0x4c')]['find']({'where':{'id':_0x4b4a0d['params']['id']}})['then'](handleEntityNotFound(_0xa80a1a,null))[_0xe058('0x26')](saveUpdates(_0x4b4a0d[_0xe058('0x55')],null))['then'](respondWithResult(_0xa80a1a,null))['catch'](handleError(_0xa80a1a,null));};exports[_0xe058('0x27')]=function(_0x1025dd,_0x515f45){return db[_0xe058('0x4c')]['find']({'where':{'id':_0x1025dd[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x515f45,null))[_0xe058('0x26')](removeEntity(_0x515f45,null))['catch'](handleError(_0x515f45,null));};exports['getHoppers']=function(_0x2af2f2,_0x40d09d,_0x4b5ba4){var _0x18476b={'raw':![],'where':{}};var _0x273639={};var _0x262dee={'count':0x0,'rows':[]};return db[_0xe058('0x4c')][_0xe058('0x5f')]({'where':{'id':_0x2af2f2['params']['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x40d09d,null))[_0xe058('0x26')](function(_0x32ef35){if(_0x32ef35){_0x273639[_0xe058('0x40')]=_[_0xe058('0x60')](db[_0xe058('0x61')]['rawAttributes']);_0x273639['query']=_[_0xe058('0x60')](_0x2af2f2[_0xe058('0x3c')]);_0x273639[_0xe058('0x3d')]=_['intersection'](_0x273639[_0xe058('0x40')],_0x273639[_0xe058('0x3c')]);_0x18476b[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x273639['model'],qs[_0xe058('0x41')](_0x2af2f2[_0xe058('0x3c')][_0xe058('0x41')]));_0x18476b['attributes']=_0x18476b[_0xe058('0x3f')][_0xe058('0x42')]?_0x18476b[_0xe058('0x3f')]:_0x273639[_0xe058('0x40')];if(!_0x2af2f2['query']['hasOwnProperty']('nolimit')){_0x18476b[_0xe058('0x45')]=qs[_0xe058('0x45')](_0x2af2f2[_0xe058('0x3c')][_0xe058('0x45')]);_0x18476b[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0x2af2f2[_0xe058('0x3c')][_0xe058('0x1f')]);}_0x18476b[_0xe058('0x46')]=qs[_0xe058('0x47')](_0x2af2f2[_0xe058('0x3c')][_0xe058('0x47')]);_0x18476b[_0xe058('0x48')]=qs[_0xe058('0x3d')](_[_0xe058('0x49')](_0x2af2f2[_0xe058('0x3c')],_0x273639[_0xe058('0x3d')]));_0x18476b[_0xe058('0x48')]['VoiceQueueId']=_0x32ef35['id'];if(_0x2af2f2['query'][_0xe058('0x2d')]){_0x18476b[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x18476b[_0xe058('0x48')],{'$or':_['map'](_0x18476b['attributes'],function(_0x26da7f){var _0x2d92a3={};_0x2d92a3[_0x26da7f]={'$like':'%'+_0x2af2f2['query'][_0xe058('0x2d')]+'%'};return _0x2d92a3;})});}_0x18476b=_['merge']({},_0x18476b,_0x2af2f2[_0xe058('0x4b')]);return db[_0xe058('0x61')][_0xe058('0x1e')]({'where':_0x18476b[_0xe058('0x48')]})['then'](function(_0x487967){_0x262dee[_0xe058('0x1e')]=_0x487967;if(_0x2af2f2[_0xe058('0x3c')][_0xe058('0x4d')]){_0x18476b['include']=[{'all':!![]}];}return db[_0xe058('0x61')][_0xe058('0x62')](_0x18476b);})[_0xe058('0x26')](function(_0x282437){_0x262dee[_0xe058('0x4e')]=_0x282437;return _0x262dee;});}})[_0xe058('0x26')](respondWithFilteredResult(_0x40d09d,_0x18476b))[_0xe058('0x4f')](handleError(_0x40d09d,null));};exports[_0xe058('0x63')]=function(_0xe7d5f3,_0x4b3891,_0x1e0edb){var _0x3fc227={'raw':!![],'where':{}};var _0x54f0bf={};var _0x57ff3f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe058('0x5f')]({'where':{'id':_0xe7d5f3[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x4b3891,null))[_0xe058('0x26')](function(_0x538248){if(_0x538248){_0x54f0bf['model']=_[_0xe058('0x60')](db[_0xe058('0x64')][_0xe058('0x52')]);_0x54f0bf[_0xe058('0x3c')]=_['keys'](_0xe7d5f3[_0xe058('0x3c')]);_0x54f0bf['filters']=_['intersection'](_0x54f0bf[_0xe058('0x40')],_0x54f0bf[_0xe058('0x3c')]);_0x3fc227['attributes']=_['intersection'](_0x54f0bf[_0xe058('0x40')],qs['fields'](_0xe7d5f3['query'][_0xe058('0x41')]));_0x3fc227['attributes']=_0x3fc227['attributes'][_0xe058('0x42')]?_0x3fc227[_0xe058('0x3f')]:_0x54f0bf[_0xe058('0x40')];if(!_0xe7d5f3[_0xe058('0x3c')]['hasOwnProperty'](_0xe058('0x44'))){_0x3fc227[_0xe058('0x45')]=qs[_0xe058('0x45')](_0xe7d5f3['query'][_0xe058('0x45')]);_0x3fc227[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0xe7d5f3[_0xe058('0x3c')][_0xe058('0x1f')]);}_0x3fc227[_0xe058('0x46')]=qs[_0xe058('0x47')](_0xe7d5f3['query'][_0xe058('0x47')]);_0x3fc227[_0xe058('0x48')]=qs['filters'](_[_0xe058('0x49')](_0xe7d5f3[_0xe058('0x3c')],_0x54f0bf[_0xe058('0x3d')]));_0x3fc227[_0xe058('0x48')]['VoiceQueueId']=_0x538248['id'];if(_0xe7d5f3[_0xe058('0x3c')][_0xe058('0x2d')]){_0x3fc227[_0xe058('0x48')]=_['merge'](_0x3fc227[_0xe058('0x48')],{'$or':_[_0xe058('0x2e')](_0x3fc227[_0xe058('0x3f')],function(_0x5d4f4a){var _0x3e0cf8={};_0x3e0cf8[_0x5d4f4a]={'$like':'%'+_0xe7d5f3[_0xe058('0x3c')]['filter']+'%'};return _0x3e0cf8;})});}_0x3fc227=_[_0xe058('0x4a')]({},_0x3fc227,_0xe7d5f3['options']);return db[_0xe058('0x64')][_0xe058('0x1e')]({'where':_0x3fc227[_0xe058('0x48')]})[_0xe058('0x26')](function(_0x56df88){_0x57ff3f[_0xe058('0x1e')]=_0x56df88;if(_0xe7d5f3[_0xe058('0x3c')][_0xe058('0x4d')]){_0x3fc227[_0xe058('0x53')]=[{'all':!![]}];}return db[_0xe058('0x64')][_0xe058('0x62')](_0x3fc227);})[_0xe058('0x26')](function(_0x5ef419){_0x57ff3f[_0xe058('0x4e')]=_0x5ef419;return _0x57ff3f;});}})['then'](respondWithFilteredResult(_0x4b3891,_0x3fc227))[_0xe058('0x4f')](handleError(_0x4b3891,null));};exports[_0xe058('0x65')]=function(_0x5b86b7,_0x344beb,_0x1e65e9){var _0x1298eb={'raw':!![],'where':{}};var _0x3f67f4={};var _0x4b462e={'count':0x0,'rows':[]};return db[_0xe058('0x4c')][_0xe058('0x5f')]({'where':{'id':_0x5b86b7[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x344beb,null))[_0xe058('0x26')](function(_0x2209ac){if(_0x2209ac){_0x3f67f4[_0xe058('0x40')]=_[_0xe058('0x60')](db[_0xe058('0x66')]['rawAttributes']);_0x3f67f4[_0xe058('0x3c')]=_[_0xe058('0x60')](_0x5b86b7[_0xe058('0x3c')]);_0x3f67f4[_0xe058('0x3d')]=_[_0xe058('0x3e')](_0x3f67f4['model'],_0x3f67f4['query']);_0x1298eb[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x3f67f4['model'],qs[_0xe058('0x41')](_0x5b86b7[_0xe058('0x3c')][_0xe058('0x41')]));_0x1298eb['attributes']=_0x1298eb[_0xe058('0x3f')][_0xe058('0x42')]?_0x1298eb[_0xe058('0x3f')]:_0x3f67f4[_0xe058('0x40')];if(!_0x5b86b7[_0xe058('0x3c')][_0xe058('0x43')](_0xe058('0x44'))){_0x1298eb[_0xe058('0x45')]=qs['limit'](_0x5b86b7[_0xe058('0x3c')][_0xe058('0x45')]);_0x1298eb[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0x5b86b7[_0xe058('0x3c')]['offset']);}_0x1298eb[_0xe058('0x46')]=qs[_0xe058('0x47')](_0x5b86b7[_0xe058('0x3c')][_0xe058('0x47')]);_0x1298eb[_0xe058('0x48')]=qs['filters'](_[_0xe058('0x49')](_0x5b86b7[_0xe058('0x3c')],_0x3f67f4['filters']));_0x1298eb[_0xe058('0x48')][_0xe058('0x67')]=_0x2209ac['id'];if(_0x5b86b7[_0xe058('0x3c')]['filter']){_0x1298eb[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x1298eb['where'],{'$or':_[_0xe058('0x2e')](_0x1298eb[_0xe058('0x3f')],function(_0x2dc491){var _0x21f9b6={};_0x21f9b6[_0x2dc491]={'$like':'%'+_0x5b86b7[_0xe058('0x3c')]['filter']+'%'};return _0x21f9b6;})});}_0x1298eb=_[_0xe058('0x4a')]({},_0x1298eb,_0x5b86b7['options']);return db[_0xe058('0x66')][_0xe058('0x1e')]({'where':_0x1298eb[_0xe058('0x48')]})[_0xe058('0x26')](function(_0x43a058){_0x4b462e['count']=_0x43a058;if(_0x5b86b7[_0xe058('0x3c')][_0xe058('0x4d')]){_0x1298eb[_0xe058('0x53')]=[{'all':!![]}];}return db[_0xe058('0x66')]['findAll'](_0x1298eb);})['then'](function(_0x37c8c6){_0x4b462e['rows']=_0x37c8c6;return _0x4b462e;});}})[_0xe058('0x26')](respondWithFilteredResult(_0x344beb,_0x1298eb))['catch'](handleError(_0x344beb,null));};exports[_0xe058('0x68')]=function(_0x1cfc87,_0x199791,_0xbf3041){var _0x3a8ec4={'raw':!![],'where':{}};var _0x5c2f1a={};var _0x397a0={'count':0x0,'rows':[]};return db[_0xe058('0x4c')]['findOne']({'where':{'id':_0x1cfc87[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x199791,null))[_0xe058('0x26')](function(_0x21891f){if(_0x21891f){_0x5c2f1a[_0xe058('0x40')]=_[_0xe058('0x60')](db['CmHopperBlack']['rawAttributes']);_0x5c2f1a[_0xe058('0x3c')]=_['keys'](_0x1cfc87['query']);_0x5c2f1a[_0xe058('0x3d')]=_[_0xe058('0x3e')](_0x5c2f1a[_0xe058('0x40')],_0x5c2f1a[_0xe058('0x3c')]);_0x3a8ec4[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x5c2f1a[_0xe058('0x40')],qs['fields'](_0x1cfc87['query'][_0xe058('0x41')]));_0x3a8ec4[_0xe058('0x3f')]=_0x3a8ec4[_0xe058('0x3f')][_0xe058('0x42')]?_0x3a8ec4[_0xe058('0x3f')]:_0x5c2f1a[_0xe058('0x40')];if(!_0x1cfc87[_0xe058('0x3c')][_0xe058('0x43')]('nolimit')){_0x3a8ec4['limit']=qs[_0xe058('0x45')](_0x1cfc87[_0xe058('0x3c')][_0xe058('0x45')]);_0x3a8ec4['offset']=qs['offset'](_0x1cfc87[_0xe058('0x3c')][_0xe058('0x1f')]);}_0x3a8ec4[_0xe058('0x46')]=qs['sort'](_0x1cfc87[_0xe058('0x3c')][_0xe058('0x47')]);_0x3a8ec4[_0xe058('0x48')]=qs[_0xe058('0x3d')](_[_0xe058('0x49')](_0x1cfc87[_0xe058('0x3c')],_0x5c2f1a[_0xe058('0x3d')]));_0x3a8ec4['where'][_0xe058('0x67')]=_0x21891f['id'];if(_0x1cfc87[_0xe058('0x3c')]['filter']){_0x3a8ec4[_0xe058('0x48')]=_['merge'](_0x3a8ec4['where'],{'$or':_[_0xe058('0x2e')](_0x3a8ec4['attributes'],function(_0x1dcb7d){var _0x3ce464={};_0x3ce464[_0x1dcb7d]={'$like':'%'+_0x1cfc87[_0xe058('0x3c')][_0xe058('0x2d')]+'%'};return _0x3ce464;})});}_0x3a8ec4=_['merge']({},_0x3a8ec4,_0x1cfc87[_0xe058('0x4b')]);return db['CmHopperBlack']['count']({'where':_0x3a8ec4[_0xe058('0x48')]})[_0xe058('0x26')](function(_0x420412){_0x397a0[_0xe058('0x1e')]=_0x420412;if(_0x1cfc87[_0xe058('0x3c')][_0xe058('0x4d')]){_0x3a8ec4[_0xe058('0x53')]=[{'all':!![]}];}return db[_0xe058('0x69')][_0xe058('0x62')](_0x3a8ec4);})[_0xe058('0x26')](function(_0x2f1505){_0x397a0[_0xe058('0x4e')]=_0x2f1505;return _0x397a0;});}})['then'](respondWithFilteredResult(_0x199791,_0x3a8ec4))[_0xe058('0x4f')](handleError(_0x199791,null));};exports[_0xe058('0x6a')]=function(_0x4d401e,_0xdc4ba7,_0x3185fa){var _0x7d65ee={};var _0x57e247={};var _0x3d5813;var _0x262048;return db[_0xe058('0x4c')][_0xe058('0x5f')]({'where':{'id':_0x4d401e[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0xdc4ba7,null))[_0xe058('0x26')](function(_0x178aec){if(_0x178aec){_0x3d5813=_0x178aec;_0x57e247[_0xe058('0x40')]=_[_0xe058('0x60')](db[_0xe058('0x6b')][_0xe058('0x52')]);_0x57e247[_0xe058('0x3c')]=_[_0xe058('0x60')](_0x4d401e[_0xe058('0x3c')]);_0x57e247['filters']=_[_0xe058('0x3e')](_0x57e247[_0xe058('0x40')],_0x57e247[_0xe058('0x3c')]);_0x7d65ee[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x57e247[_0xe058('0x40')],qs[_0xe058('0x41')](_0x4d401e[_0xe058('0x3c')]['fields']));_0x7d65ee['attributes']=_0x7d65ee[_0xe058('0x3f')][_0xe058('0x42')]?_0x7d65ee[_0xe058('0x3f')]:_0x57e247[_0xe058('0x40')];_0x7d65ee['order']=qs[_0xe058('0x47')](_0x4d401e[_0xe058('0x3c')][_0xe058('0x47')]);_0x7d65ee[_0xe058('0x48')]=qs[_0xe058('0x3d')](_[_0xe058('0x49')](_0x4d401e[_0xe058('0x3c')],_0x57e247[_0xe058('0x3d')]));if(_0x4d401e[_0xe058('0x3c')][_0xe058('0x2d')]){_0x7d65ee[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x7d65ee['where'],{'$or':_[_0xe058('0x2e')](_0x7d65ee['attributes'],function(_0x25134d){var _0x39cf1b={};_0x39cf1b[_0x25134d]={'$like':'%'+_0x4d401e[_0xe058('0x3c')][_0xe058('0x2d')]+'%'};return _0x39cf1b;})});}_0x7d65ee=_[_0xe058('0x4a')]({},_0x7d65ee,_0x4d401e[_0xe058('0x4b')]);return _0x3d5813[_0xe058('0x6a')](_0x7d65ee);}})[_0xe058('0x26')](function(_0x5e79c3){if(_0x5e79c3){_0x262048=_0x5e79c3['length'];if(!_0x4d401e['query'][_0xe058('0x43')](_0xe058('0x44'))){_0x7d65ee[_0xe058('0x45')]=qs[_0xe058('0x45')](_0x4d401e['query'][_0xe058('0x45')]);_0x7d65ee[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0x4d401e[_0xe058('0x3c')][_0xe058('0x1f')]);}return _0x3d5813[_0xe058('0x6a')](_0x7d65ee);}})[_0xe058('0x26')](function(_0x39c51c){if(_0x39c51c){return _0x39c51c?{'count':_0x262048,'rows':_0x39c51c}:null;}})[_0xe058('0x26')](respondWithResult(_0xdc4ba7,null))['catch'](handleError(_0xdc4ba7,null));};exports[_0xe058('0x6c')]=function(_0x35b680,_0x15cfb3,_0x8f7c86){var _0x50c907=_0x35b680[_0xe058('0x55')][_0xe058('0x6d')];var _0x54dc2c=_[_0xe058('0x2e')](_0x50c907,'id');return db[_0xe058('0x6b')][_0xe058('0x62')]({'where':{'id':_0x54dc2c},'attributes':['id'],'include':[{'model':db[_0xe058('0x6e')],'as':_0xe058('0x6f'),'attributes':['id',_0xe058('0x32'),_0xe058('0x70'),_0xe058('0x71'),_0xe058('0x72')],'raw':!![]}]})[_0xe058('0x26')](function(_0x58634e){if(_0x58634e){var _0x4fa538=_[_0xe058('0x73')](_0x58634e,function(_0x41512b){var _0x5f14fd=_0x41512b['get']({'plain':!![]});_0x5f14fd[_0xe058('0x6f')]['forEach'](function(_0x5f209a){_0x5f209a[_0xe058('0x74')]=_[_0xe058('0x31')](_0x50c907,{'id':_0x5f14fd['id']})[_0xe058('0x74')];});return _0x5f14fd[_0xe058('0x6f')];});return db[_0xe058('0x4c')][_0xe058('0x31')]({'where':{'id':_0x35b680[_0xe058('0x51')]['id']}})[_0xe058('0x26')](function(_0x4e3297){return db[_0xe058('0x75')][_0xe058('0x76')](function(_0x21b780){return _0x4e3297[_0xe058('0x6c')](_0x54dc2c,{'transaction':_0x21b780})[_0xe058('0x26')](function(){return BPromise[_0xe058('0x77')](_0x4fa538,function(_0x5c0f16){return db['UserVoiceQueue'][_0xe058('0x78')]({'where':{'UserId':_0x5c0f16['id'],'VoiceQueueId':_0x35b680['params']['id']},'defaults':{'penalty':_0x5c0f16['penalty']},'transaction':_0x21b780});});})[_0xe058('0x26')](function(){return BPromise['each'](_['filter'](_0x4fa538,{'online':!![]}),function(_0x16e783){return db['UserVoiceQueueRt'][_0xe058('0x79')]({'membername':_0x16e783['name'],'UserId':_0x16e783['id'],'queue_name':_0x4e3297[_0xe058('0x32')],'VoiceQueueId':_0x4e3297['id'],'interface':_[_0xe058('0x7a')](_0x16e783[_0xe058('0x72')])?util['format'](_0xe058('0x7b'),_0x16e783[_0xe058('0x32')]):_0x16e783[_0xe058('0x72')],'paused':_0x16e783[_0xe058('0x71')]||![],'penalty':_0x16e783['penalty']},{'transaction':_0x21b780});});})[_0xe058('0x26')](function(){_0x4fa538[_0xe058('0x7c')](function(_0x506727){socket[_0xe058('0x7d')](_0xe058('0x7e'),{'UserId':_0x506727['id'],'VoiceQueueId':_0x4e3297['id']});});});});});}})['then'](respondWithStatusCode(_0x15cfb3,null))[_0xe058('0x4f')](handleError(_0x15cfb3,null));};exports[_0xe058('0x7f')]=function(_0x9fc121,_0x135c25,_0x426258){return db[_0xe058('0x6b')][_0xe058('0x62')]({'where':{'id':_0x9fc121[_0xe058('0x3c')][_0xe058('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe058('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xe058('0x26')](handleEntityNotFound(_0x135c25,null))[_0xe058('0x26')](function(_0x28aaba){var _0x4e9db1=_['map'](_0x28aaba,'id');var _0x8a14d4=[];var _0x37f355=[];var _0x13ffd3=squel[_0xe058('0x81')]();_0x13ffd3[_0xe058('0x82')](_0xe058('0x83'))['from'](_0xe058('0x84'),'tq')['join'](_0xe058('0x85'),'ut',_0xe058('0x86'))[_0xe058('0x48')](_0xe058('0x87'),_0x9fc121['params']['id']);for(var _0x1e15a7=0x0;_0x1e15a7<_0x28aaba[_0xe058('0x42')];_0x1e15a7+=0x1){let _0x5438a0=_0x28aaba[_0x1e15a7];for(var _0x3101f3=0x0;_0x3101f3<_0x5438a0[_0xe058('0x6f')]['length'];_0x3101f3+=0x1){let _0x3554ee=_0x5438a0['Agents'][_0x3101f3];var _0x6e0915=_0x13ffd3[_0xe058('0x5b')]();_0x6e0915[_0xe058('0x48')](_0xe058('0x88'),_0x3554ee['id']);_0x37f355[_0xe058('0x89')](db[_0xe058('0x75')][_0xe058('0x3c')](_0x6e0915[_0xe058('0x8a')](),{'type':db[_0xe058('0x75')][_0xe058('0x8b')][_0xe058('0x8c')]})[_0xe058('0x26')](function(_0x432432){if(_0x432432[_0xe058('0x42')]===0x1){return _0x3554ee['id'];}else{var _0x76973e=_['every'](_[_0xe058('0x2e')](_0x432432,_0xe058('0x8d')),function(_0x2e648a){return _[_0xe058('0x8e')](_0x4e9db1,_0x2e648a);});if(_0x76973e){return _0x3554ee['id'];}}}));}}return BPromise[_0xe058('0x8f')](_0x37f355)[_0xe058('0x26')](function(_0xca67e3){_0x8a14d4=_(_0x8a14d4)[_0xe058('0x90')](_0xca67e3)[_0xe058('0x91')]()[_0xe058('0x2f')]();return db[_0xe058('0x4c')][_0xe058('0x31')]({'where':{'id':_0x9fc121['params']['id']}})[_0xe058('0x26')](function(_0x4217e9){return db[_0xe058('0x75')][_0xe058('0x76')](function(_0x3de56f){return _0x4217e9['removeTeams'](_0x9fc121[_0xe058('0x3c')]['ids'],{'transaction':_0x3de56f})[_0xe058('0x26')](function(){if(!_[_0xe058('0x92')](_0x8a14d4)){return _0x4217e9[_0xe058('0x93')](_0x8a14d4,{'transaction':_0x3de56f})[_0xe058('0x26')](function(){return db[_0xe058('0x94')][_0xe058('0x27')]({'where':{'VoiceQueueId':_0x9fc121[_0xe058('0x51')]['id'],'UserId':_0x8a14d4},'transaction':_0x3de56f});});}})[_0xe058('0x26')](function(){_0x8a14d4[_0xe058('0x7c')](function(_0x11a355){socket[_0xe058('0x7d')](_0xe058('0x95'),{'UserId':_0x11a355,'VoiceQueueId':_0x4217e9['id']});});});});});});})[_0xe058('0x26')](respondWithStatusCode(_0x135c25,null))[_0xe058('0x4f')](handleError(_0x135c25,null));};exports[_0xe058('0x96')]=function(_0x3f7908,_0x6e62fc,_0x4b41a2){var _0x57a27b,_0x5d3175;return db[_0xe058('0x4c')][_0xe058('0x31')]({'where':{'id':_0x3f7908[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x6e62fc,null))['then'](function(_0x39671d){if(_0x39671d){_0x5d3175=_0x39671d;return _0x39671d['addAgents'](_0x3f7908[_0xe058('0x55')][_0xe058('0x80')],_[_0xe058('0x97')](_0x3f7908[_0xe058('0x55')],[_0xe058('0x80'),'id'])||{})['spread'](function(_0x4b372f){for(var _0x3bfe9a=0x0;_0x3bfe9a<_0x3f7908[_0xe058('0x55')][_0xe058('0x80')][_0xe058('0x42')];_0x3bfe9a+=0x1){socket[_0xe058('0x7d')](_0xe058('0x7e'),{'UserId':_0x3f7908[_0xe058('0x55')][_0xe058('0x80')][_0x3bfe9a],'VoiceQueueId':_0x3f7908[_0xe058('0x51')]['id']});}return _0x4b372f;});}})[_0xe058('0x26')](function(_0x400e0e){_0x57a27b=_0x400e0e||[];if(_0x5d3175){return db[_0xe058('0x6e')][_0xe058('0x62')]({'where':{'id':_0x3f7908[_0xe058('0x55')][_0xe058('0x80')]},'attributes':['id','name','online',_0xe058('0x71'),'interface'],'raw':!![]});}})[_0xe058('0x26')](function(_0x385749){if(!_['isEmpty'](_0x385749)){var _0x3603a1=[];for(var _0x529d28=0x0;_0x529d28<_0x385749[_0xe058('0x42')];_0x529d28++){if(_0x385749[_0x529d28][_0xe058('0x70')]){_0x3603a1[_0xe058('0x89')](db[_0xe058('0x94')][_0xe058('0x79')]({'membername':_0x385749[_0x529d28][_0xe058('0x32')],'UserId':_0x385749[_0x529d28]['id'],'queue_name':_0x5d3175['name'],'VoiceQueueId':_0x5d3175['id'],'interface':_[_0xe058('0x7a')](_0x385749[_0x529d28][_0xe058('0x72')])?util[_0xe058('0x98')](_0xe058('0x7b'),_0x385749[_0x529d28][_0xe058('0x32')]):_0x385749[_0x529d28][_0xe058('0x72')],'paused':_0x385749[_0x529d28]['voicePause']||![],'penalty':_0x3f7908['body'][_0xe058('0x74')]||0x0}));}}return BPromise[_0xe058('0x8f')](_0x3603a1);}})[_0xe058('0x26')](function(){return _0x57a27b;})[_0xe058('0x26')](respondWithResult(_0x6e62fc,null))[_0xe058('0x4f')](handleError(_0x6e62fc,null));};exports[_0xe058('0x93')]=function(_0x1403e3,_0x47e2b5,_0x312a64){return db[_0xe058('0x4c')]['find']({'where':{'id':_0x1403e3[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x47e2b5,null))[_0xe058('0x26')](function(_0x41e8c1){if(_0x41e8c1){return _0x41e8c1[_0xe058('0x93')](_0x1403e3[_0xe058('0x3c')][_0xe058('0x80')])['then'](function(){if(_[_0xe058('0x99')](_0x1403e3[_0xe058('0x3c')][_0xe058('0x80')])){for(var _0x3ebae9=0x0;_0x3ebae9<_0x1403e3[_0xe058('0x3c')]['ids'][_0xe058('0x42')];_0x3ebae9+=0x1){socket[_0xe058('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0x1403e3[_0xe058('0x3c')][_0xe058('0x80')][_0x3ebae9]),'VoiceQueueId':Number(_0x1403e3['params']['id'])});}}else{socket[_0xe058('0x7d')](_0xe058('0x95'),{'UserId':Number(_0x1403e3[_0xe058('0x3c')][_0xe058('0x80')]),'VoiceQueueId':Number(_0x1403e3[_0xe058('0x51')]['id'])});}});}})[_0xe058('0x26')](function(_0x353745){return db[_0xe058('0x94')][_0xe058('0x27')]({'where':{'VoiceQueueId':_0x1403e3[_0xe058('0x51')]['id'],'UserId':_0x1403e3[_0xe058('0x3c')][_0xe058('0x80')]}})[_0xe058('0x26')](function(){return _0x353745;});})[_0xe058('0x26')](respondWithStatusCode(_0x47e2b5,null))[_0xe058('0x4f')](handleError(_0x47e2b5,null));};exports[_0xe058('0x9a')]=function(_0x23625e,_0x144e4b,_0x3a861a){var _0x39978d={};var _0x353a59={};var _0x3b28ba;var _0x36d036;return db[_0xe058('0x4c')]['findOne']({'where':{'id':_0x23625e[_0xe058('0x51')]['id']}})['then'](handleEntityNotFound(_0x144e4b,null))['then'](function(_0x23da61){if(_0x23da61){_0x3b28ba=_0x23da61;_0x353a59[_0xe058('0x40')]=_[_0xe058('0x60')](db[_0xe058('0x6e')][_0xe058('0x52')]);_0x353a59[_0xe058('0x3c')]=_[_0xe058('0x60')](_0x23625e[_0xe058('0x3c')]);_0x353a59[_0xe058('0x3d')]=_[_0xe058('0x3e')](_0x353a59['model'],_0x353a59['query']);_0x39978d[_0xe058('0x3f')]=_['intersection'](_0x353a59[_0xe058('0x40')],qs['fields'](_0x23625e[_0xe058('0x3c')]['fields']));_0x39978d['attributes']=_0x39978d[_0xe058('0x3f')]['length']?_0x39978d[_0xe058('0x3f')]:_0x353a59[_0xe058('0x40')];_0x39978d[_0xe058('0x46')]=qs[_0xe058('0x47')](_0x23625e[_0xe058('0x3c')][_0xe058('0x47')]);_0x39978d[_0xe058('0x48')]=qs[_0xe058('0x3d')](_['pick'](_0x23625e[_0xe058('0x3c')],_0x353a59[_0xe058('0x3d')]));if(_0x23625e[_0xe058('0x3c')][_0xe058('0x2d')]){_0x39978d['where']=_[_0xe058('0x4a')](_0x39978d[_0xe058('0x48')],{'$or':_[_0xe058('0x2e')](_0x39978d[_0xe058('0x3f')],function(_0x2c40c9){var _0x33c7c5={};_0x33c7c5[_0x2c40c9]={'$like':'%'+_0x23625e[_0xe058('0x3c')]['filter']+'%'};return _0x33c7c5;})});}_0x39978d=_[_0xe058('0x4a')]({},_0x39978d,_0x23625e['options']);return _0x3b28ba['getAgents'](_0x39978d);}})[_0xe058('0x26')](function(_0x58aeee){if(_0x58aeee){_0x36d036=_0x58aeee[_0xe058('0x42')];if(!_0x23625e[_0xe058('0x3c')]['hasOwnProperty']('nolimit')){_0x39978d[_0xe058('0x45')]=qs[_0xe058('0x45')](_0x23625e['query'][_0xe058('0x45')]);_0x39978d[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0x23625e['query']['offset']);}return _0x3b28ba['getAgents'](_0x39978d);}})[_0xe058('0x26')](function(_0x477189){if(_0x477189){return _0x477189?{'count':_0x36d036,'rows':_0x477189}:null;}})[_0xe058('0x26')](respondWithResult(_0x144e4b,null))[_0xe058('0x4f')](handleError(_0x144e4b,null));};exports[_0xe058('0x9b')]=function(_0x1de548,_0x41dc92,_0x245210){var _0x41b590={};var _0x42c493={};var _0x4911d3;var _0x1bc1a2;return db[_0xe058('0x4c')][_0xe058('0x5f')]({'where':{'id':_0x1de548['params']['id']}})['then'](handleEntityNotFound(_0x41dc92,null))[_0xe058('0x26')](function(_0x31f98e){if(_0x31f98e){_0x4911d3=_0x31f98e;_0x42c493[_0xe058('0x40')]=_['keys'](db[_0xe058('0x94')][_0xe058('0x52')]);_0x42c493[_0xe058('0x3c')]=_[_0xe058('0x60')](_0x1de548[_0xe058('0x3c')]);_0x42c493[_0xe058('0x3d')]=_[_0xe058('0x3e')](_0x42c493['model'],_0x42c493[_0xe058('0x3c')]);_0x41b590[_0xe058('0x3f')]=_[_0xe058('0x3e')](_0x42c493[_0xe058('0x40')],qs[_0xe058('0x41')](_0x1de548[_0xe058('0x3c')]['fields']));_0x41b590[_0xe058('0x3f')]=_0x41b590['attributes'][_0xe058('0x42')]?_0x41b590['attributes']:_0x42c493[_0xe058('0x40')];_0x41b590[_0xe058('0x46')]=qs[_0xe058('0x47')](_0x1de548['query'][_0xe058('0x47')]);_0x41b590[_0xe058('0x48')]=qs[_0xe058('0x3d')](_['pick'](_0x1de548[_0xe058('0x3c')],_0x42c493[_0xe058('0x3d')]));if(_0x1de548[_0xe058('0x3c')][_0xe058('0x2d')]){_0x41b590[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x41b590[_0xe058('0x48')],{'$or':_[_0xe058('0x2e')](_0x41b590[_0xe058('0x3f')],function(_0x4608fe){var _0x51faa7={};_0x51faa7[_0x4608fe]={'$like':'%'+_0x1de548[_0xe058('0x3c')][_0xe058('0x2d')]+'%'};return _0x51faa7;})});}_0x41b590=_['merge']({},_0x41b590,_0x1de548[_0xe058('0x4b')]);return _0x4911d3[_0xe058('0x9b')](_0x41b590);}})[_0xe058('0x26')](function(_0x24ffa5){if(_0x24ffa5){_0x1bc1a2=_0x24ffa5['length'];if(!_0x1de548['query'][_0xe058('0x43')](_0xe058('0x44'))){_0x41b590[_0xe058('0x45')]=qs[_0xe058('0x45')](_0x1de548[_0xe058('0x3c')][_0xe058('0x45')]);_0x41b590[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0x1de548[_0xe058('0x3c')][_0xe058('0x1f')]);}return _0x4911d3[_0xe058('0x9b')](_0x41b590);}})[_0xe058('0x26')](function(_0x114f8f){return _0x114f8f?{'count':_0x1bc1a2,'rows':_0x114f8f}:null;})[_0xe058('0x26')](respondWithResult(_0x41dc92,null))['catch'](handleError(_0x41dc92,null));};exports['getLists']=function(_0x489657,_0x314c40,_0x174dd7){var _0x10c936={};var _0x56b3a7={};var _0x538313;var _0x1dde34;return db[_0xe058('0x4c')][_0xe058('0x5f')]({'where':{'id':_0x489657[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x314c40,null))['then'](function(_0x37de7e){if(_0x37de7e){_0x538313=_0x37de7e;_0x56b3a7[_0xe058('0x40')]=_['keys'](db['CmList'][_0xe058('0x52')]);_0x56b3a7[_0xe058('0x3c')]=_[_0xe058('0x60')](_0x489657[_0xe058('0x3c')]);_0x56b3a7[_0xe058('0x3d')]=_['intersection'](_0x56b3a7[_0xe058('0x40')],_0x56b3a7[_0xe058('0x3c')]);_0x10c936['attributes']=_[_0xe058('0x3e')](_0x56b3a7[_0xe058('0x40')],qs[_0xe058('0x41')](_0x489657['query'][_0xe058('0x41')]));_0x10c936[_0xe058('0x3f')]=_0x10c936['attributes']['length']?_0x10c936[_0xe058('0x3f')]:_0x56b3a7['model'];_0x10c936['order']=qs[_0xe058('0x47')](_0x489657[_0xe058('0x3c')][_0xe058('0x47')]);_0x10c936['where']=qs[_0xe058('0x3d')](_[_0xe058('0x49')](_0x489657['query'],_0x56b3a7[_0xe058('0x3d')]));if(_0x489657[_0xe058('0x3c')][_0xe058('0x2d')]){_0x10c936[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x10c936[_0xe058('0x48')],{'$or':_[_0xe058('0x2e')](_0x10c936[_0xe058('0x3f')],function(_0x435375){var _0xe189={};_0xe189[_0x435375]={'$like':'%'+_0x489657['query'][_0xe058('0x2d')]+'%'};return _0xe189;})});}_0x10c936=_[_0xe058('0x4a')]({},_0x10c936,_0x489657[_0xe058('0x4b')]);return _0x538313[_0xe058('0x9c')](_0x10c936);}})['then'](function(_0x376f6c){if(_0x376f6c){_0x1dde34=_0x376f6c[_0xe058('0x42')];if(!_0x489657[_0xe058('0x3c')][_0xe058('0x43')]('nolimit')){_0x10c936[_0xe058('0x45')]=qs[_0xe058('0x45')](_0x489657['query'][_0xe058('0x45')]);_0x10c936[_0xe058('0x1f')]=qs['offset'](_0x489657[_0xe058('0x3c')][_0xe058('0x1f')]);}return _0x538313[_0xe058('0x9c')](_0x10c936);}})[_0xe058('0x26')](function(_0x2e195a){if(_0x2e195a){return _0x2e195a?{'count':_0x1dde34,'rows':_0x2e195a}:null;}})['then'](respondWithResult(_0x314c40,null))[_0xe058('0x4f')](handleError(_0x314c40,null));};exports[_0xe058('0x9d')]=function(_0x47958c,_0xaa08b3,_0x62a933){var _0x8f555c,_0x34eaff;return db[_0xe058('0x4c')][_0xe058('0x31')]({'where':{'id':_0x47958c[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0xaa08b3,null))[_0xe058('0x26')](function(_0x2e8a94){if(_0x2e8a94){_0x34eaff=_0x2e8a94;return _0x2e8a94[_0xe058('0x9d')](_0x47958c[_0xe058('0x55')]['ids'],_[_0xe058('0x97')](_0x47958c[_0xe058('0x55')],[_0xe058('0x80'),'id'])||{});}return null;})[_0xe058('0x9e')](function(_0x2e1887){var _0x1b26fb;_0x8f555c=_0x2e1887||[];var _0x1d0576=[];if(_0x2e1887){for(var _0x2add81=0x0;_0x2add81<_0x2e1887['length'];_0x2add81+=0x1){var _0x331ac7=_0x2e1887[_0x2add81]['get']({'plain':!![]});_0x34eaff[_0xe058('0x9f')]=_0x47958c[_0xe058('0x55')][_0xe058('0x9f')]?_0x47958c['body'][_0xe058('0x9f')]:_0x34eaff[_0xe058('0x9f')];switch(_0x34eaff[_0xe058('0x9f')]){case'always':_0x1b26fb=squel[_0xe058('0xa0')]()[_0xe058('0xa1')](_0xe058('0xa2'))[_0xe058('0xa3')]([_0xe058('0xa4'),_0xe058('0xa5'),_0xe058('0xa6'),_0xe058('0xa7'),_0xe058('0x67'),_0xe058('0x5d'),_0xe058('0x5c')],squel[_0xe058('0x81')]()['field']('phone',_0xe058('0xa4'))[_0xe058('0x82')]('NOW()',_0xe058('0xa5'))[_0xe058('0x82')]('id','ContactId')['field'](_0x331ac7[_0xe058('0xa8')][_0xe058('0x8a')](),_0xe058('0xa7'))['field'](_0x47958c[_0xe058('0x51')]['id']['toString'](),_0xe058('0x67'))[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0x5d'))[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0x5c'))[_0xe058('0xaa')](_0xe058('0xab'))[_0xe058('0x48')](_0xe058('0xac'))[_0xe058('0x48')](_0xe058('0xad'),_0x331ac7['CmListId'][_0xe058('0x8a')]())['where'](_0xe058('0xae'))[_0xe058('0x48')](_0xe058('0xaf'),squel['select']()[_0xe058('0x82')](_0xe058('0xb0'))[_0xe058('0xaa')](_0xe058('0xb1'))['where']('VoiceQueueId\x20=\x20?',_0x47958c[_0xe058('0x51')]['id'][_0xe058('0x8a')]()))[_0xe058('0x48')](_0xe058('0xaf'),squel[_0xe058('0x81')]()[_0xe058('0x82')](_0xe058('0xb2'))[_0xe058('0xaa')](_0xe058('0xa2'))[_0xe058('0x48')](_0xe058('0x87'),_0x47958c[_0xe058('0x51')]['id'][_0xe058('0x8a')]())))[_0xe058('0x8a')]();break;case'onlyIfOpen':_0x1b26fb=squel[_0xe058('0xa0')]()[_0xe058('0xa1')]('cm_hopper')[_0xe058('0xa3')](['phone',_0xe058('0xa5'),'ContactId',_0xe058('0xa7'),_0xe058('0x67'),_0xe058('0x5d'),_0xe058('0x5c')],squel[_0xe058('0x81')]()[_0xe058('0x82')](_0xe058('0xa4'),_0xe058('0xa4'))[_0xe058('0x82')]('NOW()',_0xe058('0xa5'))['field']('id',_0xe058('0xa6'))[_0xe058('0x82')](_0x331ac7[_0xe058('0xa8')][_0xe058('0x8a')](),_0xe058('0xa7'))[_0xe058('0x82')](_0x47958c[_0xe058('0x51')]['id'][_0xe058('0x8a')](),_0xe058('0x67'))[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0x5d'))['field']('NOW()',_0xe058('0x5c'))[_0xe058('0xaa')]('cm_contacts')[_0xe058('0x48')](_0xe058('0xac'))['where']('ListId\x20=\x20?',_0x331ac7['CmListId'][_0xe058('0x8a')]())[_0xe058('0x48')](_0xe058('0xae'))[_0xe058('0x48')](_0xe058('0xaf'),squel[_0xe058('0x81')]()[_0xe058('0x82')](_0xe058('0xb2'))[_0xe058('0xaa')](_0xe058('0xa2'))[_0xe058('0x48')](_0xe058('0x87'),_0x47958c[_0xe058('0x51')]['id'][_0xe058('0x8a')]())))[_0xe058('0x8a')]();break;default:_0x1b26fb=squel[_0xe058('0xa0')]()['into'](_0xe058('0xa2'))[_0xe058('0xa3')]([_0xe058('0xa4'),_0xe058('0xa5'),_0xe058('0xa6'),'ListId',_0xe058('0x67'),'createdAt','updatedAt'],squel[_0xe058('0x81')]()[_0xe058('0x82')](_0xe058('0xa4'),'phone')[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0xa5'))[_0xe058('0x82')]('id','ContactId')[_0xe058('0x82')](_0x331ac7[_0xe058('0xa8')][_0xe058('0x8a')](),_0xe058('0xa7'))[_0xe058('0x82')](_0x47958c['params']['id'][_0xe058('0x8a')](),'VoiceQueueId')['field'](_0xe058('0xa9'),_0xe058('0x5d'))[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0x5c'))['from'](_0xe058('0xab'))[_0xe058('0x48')](_0xe058('0xac'))[_0xe058('0x48')](_0xe058('0xad'),_0x331ac7[_0xe058('0xa8')][_0xe058('0x8a')]())[_0xe058('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0xe058('0x8a')]();}_0x1d0576['push'](db[_0xe058('0x75')]['query'](_0x1b26fb));}return BPromise[_0xe058('0x8f')](_0x1d0576);}})['then'](function(){return _0x8f555c;})[_0xe058('0x26')](respondWithResult(_0xaa08b3,null))[_0xe058('0x4f')](handleError(_0xaa08b3,null));};exports[_0xe058('0xb3')]=function(_0x11448a,_0x3f90f0,_0x1dbe0f){return db['VoiceQueue'][_0xe058('0x31')]({'where':{'id':_0x11448a['params']['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x3f90f0,null))['then'](function(_0x1875f2){if(_0x1875f2){return _0x1875f2['removeLists'](_0x11448a['query'][_0xe058('0x80')]);}})[_0xe058('0x26')](function(_0x50c3a8){if(_0x50c3a8){return db[_0xe058('0x61')][_0xe058('0x27')]({'where':{'ListId':_0x11448a[_0xe058('0x3c')][_0xe058('0x80')],'VoiceQueueId':_0x11448a[_0xe058('0x51')]['id']}})[_0xe058('0x26')](function(){return _0x50c3a8;});}})[_0xe058('0x26')](respondWithStatusCode(_0x3f90f0,null))[_0xe058('0x4f')](handleError(_0x3f90f0,null));};exports[_0xe058('0xb4')]=function(_0xf769e6,_0x1ae7ff,_0x5adf05){var _0x3e9ff7={};var _0x4794f1={};var _0x5b3554;var _0x3e4890;return db[_0xe058('0x4c')]['findOne']({'where':{'id':_0xf769e6[_0xe058('0x51')]['id']}})['then'](handleEntityNotFound(_0x1ae7ff,null))[_0xe058('0x26')](function(_0x3eaff7){if(_0x3eaff7){_0x5b3554=_0x3eaff7;_0x4794f1['model']=_['keys'](db[_0xe058('0xb5')]['rawAttributes']);_0x4794f1[_0xe058('0x3c')]=_['keys'](_0xf769e6['query']);_0x4794f1[_0xe058('0x3d')]=_[_0xe058('0x3e')](_0x4794f1['model'],_0x4794f1['query']);_0x3e9ff7['attributes']=_['intersection'](_0x4794f1[_0xe058('0x40')],qs[_0xe058('0x41')](_0xf769e6[_0xe058('0x3c')]['fields']));_0x3e9ff7[_0xe058('0x3f')]=_0x3e9ff7[_0xe058('0x3f')][_0xe058('0x42')]?_0x3e9ff7[_0xe058('0x3f')]:_0x4794f1[_0xe058('0x40')];_0x3e9ff7[_0xe058('0x46')]=qs[_0xe058('0x47')](_0xf769e6['query'][_0xe058('0x47')]);_0x3e9ff7[_0xe058('0x48')]=qs['filters'](_[_0xe058('0x49')](_0xf769e6[_0xe058('0x3c')],_0x4794f1[_0xe058('0x3d')]));if(_0xf769e6[_0xe058('0x3c')][_0xe058('0x2d')]){_0x3e9ff7[_0xe058('0x48')]=_[_0xe058('0x4a')](_0x3e9ff7[_0xe058('0x48')],{'$or':_['map'](_0x3e9ff7['attributes'],function(_0x2f9bfc){var _0x31c6fb={};_0x31c6fb[_0x2f9bfc]={'$like':'%'+_0xf769e6[_0xe058('0x3c')]['filter']+'%'};return _0x31c6fb;})});}_0x3e9ff7=_[_0xe058('0x4a')]({},_0x3e9ff7,_0xf769e6[_0xe058('0x4b')]);return _0x5b3554[_0xe058('0xb4')](_0x3e9ff7);}})['then'](function(_0x2faed7){if(_0x2faed7){_0x3e4890=_0x2faed7[_0xe058('0x42')];if(!_0xf769e6[_0xe058('0x3c')]['hasOwnProperty'](_0xe058('0x44'))){_0x3e9ff7[_0xe058('0x45')]=qs[_0xe058('0x45')](_0xf769e6[_0xe058('0x3c')][_0xe058('0x45')]);_0x3e9ff7[_0xe058('0x1f')]=qs[_0xe058('0x1f')](_0xf769e6[_0xe058('0x3c')]['offset']);}return _0x5b3554[_0xe058('0xb4')](_0x3e9ff7);}})[_0xe058('0x26')](function(_0x2968c1){if(_0x2968c1){return _0x2968c1?{'count':_0x3e4890,'rows':_0x2968c1}:null;}})['then'](respondWithResult(_0x1ae7ff,null))['catch'](handleError(_0x1ae7ff,null));};exports[_0xe058('0xb6')]=function(_0x569664,_0x236241,_0x2c11b0){var _0x545fbf,_0x459c42;return db['VoiceQueue'][_0xe058('0x31')]({'where':{'id':_0x569664[_0xe058('0x51')]['id']}})[_0xe058('0x26')](handleEntityNotFound(_0x236241,null))[_0xe058('0x26')](function(_0x18fb1b){if(_0x18fb1b){_0x459c42=_0x18fb1b;return _0x18fb1b['addBlackLists'](_0x569664[_0xe058('0x55')][_0xe058('0x80')],_[_0xe058('0x97')](_0x569664['body'],['ids','id'])||{});}return null;})[_0xe058('0x9e')](function(_0x4a86de){var _0x1843bb;_0x545fbf=_0x4a86de||[];var _0x394e7d=[];if(_0x4a86de){for(var _0x4597c7=0x0;_0x4597c7<_0x4a86de['length'];_0x4597c7+=0x1){var _0x509691=_0x4a86de[_0x4597c7]['get']({'plain':!![]});_0x1843bb=squel['insert']()['into'](_0xe058('0xb7'))[_0xe058('0xa3')](['phone',_0xe058('0xa6'),_0xe058('0xa7'),_0xe058('0x67'),'createdAt',_0xe058('0x5c')],squel[_0xe058('0x81')]()[_0xe058('0x82')](_0xe058('0xa4'),_0xe058('0xa4'))[_0xe058('0x82')]('id',_0xe058('0xa6'))[_0xe058('0x82')](_0x509691['CmListId'][_0xe058('0x8a')](),_0xe058('0xa7'))[_0xe058('0x82')](_0x569664[_0xe058('0x51')]['id'][_0xe058('0x8a')](),_0xe058('0x67'))[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0x5d'))[_0xe058('0x82')](_0xe058('0xa9'),_0xe058('0x5c'))[_0xe058('0xaa')](_0xe058('0xab'))[_0xe058('0x48')](_0xe058('0xac'))[_0xe058('0x48')](_0xe058('0xad'),_0x509691[_0xe058('0xa8')][_0xe058('0x8a')]())['where'](_0xe058('0xae')))['toString']();_0x394e7d[_0xe058('0x89')](db[_0xe058('0x75')]['query'](_0x1843bb));}return BPromise[_0xe058('0x8f')](_0x394e7d);}})[_0xe058('0x26')](function(){return _0x545fbf;})[_0xe058('0x26')](respondWithResult(_0x236241,null))[_0xe058('0x4f')](handleError(_0x236241,null));};exports[_0xe058('0xb8')]=function(_0x573ad3,_0x474626,_0x1d0e2f){return db[_0xe058('0x4c')][_0xe058('0x31')]({'where':{'id':_0x573ad3[_0xe058('0x51')]['id']}})['then'](handleEntityNotFound(_0x474626,null))[_0xe058('0x26')](function(_0x30190b){if(_0x30190b){return _0x30190b[_0xe058('0xb8')](_0x573ad3[_0xe058('0x3c')][_0xe058('0x80')]);}})['then'](function(_0x192a3b){if(_0x192a3b){return db[_0xe058('0x69')]['destroy']({'where':{'ListId':_0x573ad3[_0xe058('0x3c')][_0xe058('0x80')],'VoiceQueueId':_0x573ad3[_0xe058('0x51')]['id']}})[_0xe058('0x26')](function(){return _0x192a3b;});}})[_0xe058('0x26')](respondWithStatusCode(_0x474626,null))[_0xe058('0x4f')](handleError(_0x474626,null));}; \ No newline at end of file +var _0x1f6c=['spread','isEmpty','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./voiceQueue.socket','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','inbound','QueueCampaigns','outbound','ignore','value','type','find','name','UserProfileResource','end','sendStatus','error','stack','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','params','keys','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','body','omit','updatedAt','role','autoAssociation','update','findOne','options','CmHopper','findAll','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','online','voicePause','Agents','forEach','penalty','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeAgents','userVoiceQueue:remove','addAgents'];(function(_0x3e1fec,_0x55f4ba){var _0x222ecb=function(_0x4c6bf8){while(--_0x4c6bf8){_0x3e1fec['push'](_0x3e1fec['shift']());}};_0x222ecb(++_0x55f4ba);}(_0x1f6c,0x185));var _0xc1f6=function(_0xed6ef,_0x5dfd04){_0xed6ef=_0xed6ef-0x0;var _0x12e729=_0x1f6c[_0xed6ef];return _0x12e729;};'use strict';var pdf=require(_0xc1f6('0x0'));var emlformat=require(_0xc1f6('0x1'));var rimraf=require(_0xc1f6('0x2'));var zipdir=require(_0xc1f6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1f6('0x4'));var moment=require(_0xc1f6('0x5'));var BPromise=require(_0xc1f6('0x6'));var Mustache=require(_0xc1f6('0x7'));var util=require(_0xc1f6('0x8'));var path=require(_0xc1f6('0x9'));var sox=require(_0xc1f6('0xa'));var csv=require(_0xc1f6('0xb'));var ejs=require(_0xc1f6('0xc'));var fs=require('fs');var _=require(_0xc1f6('0xd'));var squel=require(_0xc1f6('0xe'));var crypto=require(_0xc1f6('0xf'));var jsforce=require(_0xc1f6('0x10'));var deskjs=require(_0xc1f6('0x11'));var toCsv=require(_0xc1f6('0xb'));var querystring=require('querystring');var Papa=require(_0xc1f6('0x12'));var Redis=require('ioredis');var authService=require(_0xc1f6('0x13'));var qs=require(_0xc1f6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1f6('0x15'));var logger=require(_0xc1f6('0x16'))(_0xc1f6('0x17'));var utils=require(_0xc1f6('0x18'));var config=require(_0xc1f6('0x19'));var licenseUtil=require(_0xc1f6('0x1a'));var db=require(_0xc1f6('0x1b'))['db'];config['redis']=_[_0xc1f6('0x1c')](config['redis'],{'host':_0xc1f6('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1f6('0x1e')]));require(_0xc1f6('0x1f'))['register'](socket);function respondWithStatusCode(_0x4dfbc4,_0x327874){_0x327874=_0x327874||0xcc;return function(_0x28d737){if(_0x28d737){return _0x4dfbc4['sendStatus'](_0x327874);}return _0x4dfbc4[_0xc1f6('0x20')](_0x327874)['end']();};}function respondWithResult(_0x53ef95,_0x2368f8){_0x2368f8=_0x2368f8||0xc8;return function(_0x588cb3){if(_0x588cb3){return _0x53ef95[_0xc1f6('0x20')](_0x2368f8)[_0xc1f6('0x21')](_0x588cb3);}};}function respondWithFilteredResult(_0x113f7d,_0x25ac3b){return function(_0x35fc88){if(_0x35fc88){var _0x4f8144=_0x35fc88[_0xc1f6('0x22')],_0x55fc38=_0x25ac3b[_0xc1f6('0x23')],_0x5ab642=_0x25ac3b[_0xc1f6('0x23')]+_0x25ac3b[_0xc1f6('0x24')],_0x1df5d0;if(_0x5ab642>=_0x4f8144){_0x5ab642=_0x4f8144;_0x1df5d0=0xc8;}else{_0x1df5d0=0xce;}_0x113f7d[_0xc1f6('0x20')](_0x1df5d0);return _0x113f7d[_0xc1f6('0x25')]('Content-Range',_0x55fc38+'-'+_0x5ab642+'/'+_0x4f8144)[_0xc1f6('0x21')](_0x35fc88);}return null;};}function patchUpdates(_0x31c13b){return function(_0xe5893d){try{jsonpatch[_0xc1f6('0x26')](_0xe5893d,_0x31c13b,!![]);}catch(_0x400e23){return BPromise[_0xc1f6('0x27')](_0x400e23);}return _0xe5893d[_0xc1f6('0x28')]();};}function saveUpdates(_0x3324b9,_0x250771){return function(_0x5526d3){if(_0x5526d3){return _0x5526d3['update'](_0x3324b9)[_0xc1f6('0x29')](function(_0x2c46b1){return _0x2c46b1;});}return null;};}function removeEntity(_0x48275f,_0x7ef019){return function(_0x1b8124){if(_0x1b8124){return _0x1b8124[_0xc1f6('0x2a')]()[_0xc1f6('0x29')](function(){var _0x1ec370=_0x1b8124[_0xc1f6('0x2b')]({'plain':!![]});var _0x522544=[{'name':'VoiceQueues','value':_0xc1f6('0x2c'),'ignore':![]},{'name':_0xc1f6('0x2d'),'value':_0xc1f6('0x2e'),'ignore':![]}];var _0x6c6c37=_(_0x522544)['filter'](_0xc1f6('0x2f'))['map'](_0xc1f6('0x30'))['value']();if(_['includes'](_0x6c6c37,_0x1ec370[_0xc1f6('0x31')])){return;}var _0x1cd3eb=_[_0xc1f6('0x32')](_0x522544,['value',_0x1ec370['type']])[_0xc1f6('0x33')];return db[_0xc1f6('0x34')]['destroy']({'where':{'type':_0x1cd3eb,'resourceId':_0x1ec370['id']}})[_0xc1f6('0x29')](function(){return _0x1b8124;});})[_0xc1f6('0x29')](function(){_0x48275f[_0xc1f6('0x20')](0xcc)[_0xc1f6('0x35')]();});}};}function handleEntityNotFound(_0x55bd63,_0x10be21){return function(_0x136d86){if(!_0x136d86){_0x55bd63[_0xc1f6('0x36')](0x194);}return _0x136d86;};}function handleError(_0x29661f,_0x53a292){_0x53a292=_0x53a292||0x1f4;return function(_0x169b9a){logger[_0xc1f6('0x37')](_0x169b9a[_0xc1f6('0x38')]);if(_0x169b9a[_0xc1f6('0x33')]){delete _0x169b9a[_0xc1f6('0x33')];}_0x29661f[_0xc1f6('0x20')](_0x53a292)['send'](_0x169b9a);};}exports['index']=function(_0x413e76,_0x10aedc){var _0x22bacc={},_0x212d24={},_0xde5106={'count':0x0,'rows':[]};var _0x4f115e=_['map'](db[_0xc1f6('0x39')][_0xc1f6('0x3a')],function(_0x43bf14){return{'name':_0x43bf14[_0xc1f6('0x3b')],'type':_0x43bf14[_0xc1f6('0x31')][_0xc1f6('0x3c')]};});_0x212d24[_0xc1f6('0x3d')]=_['map'](_0x4f115e,_0xc1f6('0x33'));_0x212d24[_0xc1f6('0x3e')]=_['keys'](_0x413e76[_0xc1f6('0x3e')]);_0x212d24[_0xc1f6('0x3f')]=_[_0xc1f6('0x40')](_0x212d24[_0xc1f6('0x3d')],_0x212d24[_0xc1f6('0x3e')]);_0x22bacc[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x212d24[_0xc1f6('0x3d')],qs['fields'](_0x413e76[_0xc1f6('0x3e')]['fields']));_0x22bacc[_0xc1f6('0x41')]=_0x22bacc[_0xc1f6('0x41')][_0xc1f6('0x42')]?_0x22bacc[_0xc1f6('0x41')]:_0x212d24['model'];if(!_0x413e76['query'][_0xc1f6('0x43')](_0xc1f6('0x44'))){_0x22bacc['limit']=qs[_0xc1f6('0x24')](_0x413e76['query'][_0xc1f6('0x24')]);_0x22bacc[_0xc1f6('0x23')]=qs[_0xc1f6('0x23')](_0x413e76[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}_0x22bacc[_0xc1f6('0x45')]=qs[_0xc1f6('0x46')](_0x413e76['query'][_0xc1f6('0x46')]);_0x22bacc[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_[_0xc1f6('0x48')](_0x413e76['query'],_0x212d24[_0xc1f6('0x3f')]),_0x4f115e);if(_0x413e76[_0xc1f6('0x3e')][_0xc1f6('0x49')]){_0x22bacc[_0xc1f6('0x47')]=_[_0xc1f6('0x4a')](_0x22bacc['where'],{'$or':_[_0xc1f6('0x4b')](_0x4f115e,function(_0xf96ec3){if(_0xf96ec3[_0xc1f6('0x31')]!=='VIRTUAL'){var _0x52a7d0={};_0x52a7d0[_0xf96ec3['name']]={'$like':'%'+_0x413e76['query'][_0xc1f6('0x49')]+'%'};return _0x52a7d0;}})});}_0x22bacc=_[_0xc1f6('0x4a')]({},_0x22bacc,_0x413e76['options']);var _0x4979bd={'where':_0x22bacc[_0xc1f6('0x47')]};return db[_0xc1f6('0x39')][_0xc1f6('0x22')](_0x4979bd)[_0xc1f6('0x29')](function(_0x5c5e51){_0xde5106[_0xc1f6('0x22')]=_0x5c5e51;if(_0x413e76[_0xc1f6('0x3e')][_0xc1f6('0x4c')]){_0x22bacc[_0xc1f6('0x4d')]=[{'all':!![]}];}return db[_0xc1f6('0x39')]['findAll'](_0x22bacc);})[_0xc1f6('0x29')](function(_0x1c420c){_0xde5106[_0xc1f6('0x4e')]=_0x1c420c;return _0xde5106;})['then'](respondWithFilteredResult(_0x10aedc,_0x22bacc))[_0xc1f6('0x4f')](handleError(_0x10aedc,null));};exports['show']=function(_0x3fcd35,_0x2c3d70){var _0x438675={'raw':![],'where':{'id':_0x3fcd35[_0xc1f6('0x50')]['id']}},_0x27bf1b={};_0x27bf1b['model']=_[_0xc1f6('0x51')](db['VoiceQueue'][_0xc1f6('0x3a')]);_0x27bf1b[_0xc1f6('0x3e')]=_[_0xc1f6('0x51')](_0x3fcd35[_0xc1f6('0x3e')]);_0x27bf1b['filters']=_[_0xc1f6('0x40')](_0x27bf1b[_0xc1f6('0x3d')],_0x27bf1b[_0xc1f6('0x3e')]);_0x438675[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x27bf1b[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x3fcd35[_0xc1f6('0x3e')][_0xc1f6('0x52')]));_0x438675[_0xc1f6('0x41')]=_0x438675[_0xc1f6('0x41')]['length']?_0x438675[_0xc1f6('0x41')]:_0x27bf1b[_0xc1f6('0x3d')];if(_0x3fcd35[_0xc1f6('0x3e')]['includeAll']){_0x438675['include']=[{'all':!![]}];}_0x438675=_[_0xc1f6('0x4a')]({},_0x438675,_0x3fcd35['options']);return db[_0xc1f6('0x39')][_0xc1f6('0x32')](_0x438675)[_0xc1f6('0x29')](handleEntityNotFound(_0x2c3d70,null))[_0xc1f6('0x29')](respondWithResult(_0x2c3d70,null))['catch'](handleError(_0x2c3d70,null));};exports['create']=function(_0x5c3a01,_0x190b57){return db[_0xc1f6('0x39')][_0xc1f6('0x53')](_0x5c3a01['body'],{})['then'](function(_0x4d28e6){var _0x21c945=_0x5c3a01[_0xc1f6('0x54')][_0xc1f6('0x2b')]({'plain':!![]});if(!_0x21c945)throw new Error(_0xc1f6('0x55'));if(_0x21c945['role']===_0xc1f6('0x54')){var _0xee2185=_0x4d28e6['get']({'plain':!![]});var _0x5aa3dd=[{'name':_0xc1f6('0x56'),'value':_0xc1f6('0x2c')},{'name':_0xc1f6('0x2d'),'value':_0xc1f6('0x2e')}];var _0x1a6bd2=_[_0xc1f6('0x32')](_0x5aa3dd,[_0xc1f6('0x30'),_0xee2185['type']])[_0xc1f6('0x33')];return db[_0xc1f6('0x57')][_0xc1f6('0x32')]({'where':{'name':_0x1a6bd2,'userProfileId':_0x21c945[_0xc1f6('0x58')]},'raw':!![]})['then'](function(_0x630844){if(_0x630844&&_0x630844['autoAssociation']===0x0){return db[_0xc1f6('0x34')][_0xc1f6('0x53')]({'name':_0xee2185[_0xc1f6('0x33')],'resourceId':_0xee2185['id'],'type':_0x630844[_0xc1f6('0x33')],'sectionId':_0x630844['id']},{})[_0xc1f6('0x29')](function(){return _0x4d28e6;});}else{return _0x4d28e6;}})[_0xc1f6('0x4f')](function(_0x23ffc8){logger['error'](_0xc1f6('0x59'),_0x23ffc8);throw _0x23ffc8;});}return _0x4d28e6;})['then'](respondWithResult(_0x190b57,0xc9))[_0xc1f6('0x4f')](handleError(_0x190b57,null));};exports['clone']=function(_0x136ab8,_0x3b4a95){var _0x3c5103={'where':{'id':_0x136ab8[_0xc1f6('0x50')]['id']}},_0x1f11a9={};_0x1f11a9[_0xc1f6('0x3d')]=_[_0xc1f6('0x51')](db[_0xc1f6('0x39')][_0xc1f6('0x3a')]);_0x3c5103['attributes']=_[_0xc1f6('0x40')](_0x1f11a9[_0xc1f6('0x3d')],qs['fields'](_0x136ab8[_0xc1f6('0x3e')]['fields']));_0x3c5103[_0xc1f6('0x41')]=_0x3c5103['attributes'][_0xc1f6('0x42')]?_0x3c5103[_0xc1f6('0x41')]:_0x1f11a9['model'];if(_0x136ab8[_0xc1f6('0x3e')][_0xc1f6('0x4c')]){_0x3c5103[_0xc1f6('0x4d')]=[{'all':!![]}];}_0x3c5103=_[_0xc1f6('0x4a')]({},_0x3c5103,_0x136ab8['options']);return db[_0xc1f6('0x39')][_0xc1f6('0x32')](_0x3c5103)['then'](handleEntityNotFound(_0x3b4a95,null))[_0xc1f6('0x29')](function(_0x54f860){if(_0x54f860){var _0x4777c0=_0x54f860[_0xc1f6('0x2b')]({'plain':!![]});_0x4777c0=qs['omit'](_0x4777c0,['id',_0xc1f6('0x5a'),'updatedAt']);_0x136ab8[_0xc1f6('0x5b')]=_[_0xc1f6('0x5c')](_0x136ab8['body'],['id','createdAt',_0xc1f6('0x5d')]);return db['VoiceQueue'][_0xc1f6('0x53')](_[_0xc1f6('0x4a')](_0x4777c0,_0x136ab8[_0xc1f6('0x5b')]),{'include':_0x136ab8[_0xc1f6('0x3e')][_0xc1f6('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x4edf20){var _0x57cd92=_0x136ab8['user'][_0xc1f6('0x2b')]({'plain':!![]});if(!_0x57cd92)throw new Error(_0xc1f6('0x55'));if(_0x57cd92[_0xc1f6('0x5e')]===_0xc1f6('0x54')){var _0x7f6992=_0x4edf20[_0xc1f6('0x2b')]({'plain':!![]});var _0x8d2f7a=[{'name':'VoiceQueues','value':_0xc1f6('0x2c')},{'name':_0xc1f6('0x2d'),'value':_0xc1f6('0x2e')}];var _0x1859bc=_[_0xc1f6('0x32')](_0x8d2f7a,[_0xc1f6('0x30'),_0x7f6992[_0xc1f6('0x31')]])[_0xc1f6('0x33')];return db[_0xc1f6('0x57')][_0xc1f6('0x32')]({'where':{'name':_0x1859bc,'userProfileId':_0x57cd92[_0xc1f6('0x58')]},'raw':!![]})[_0xc1f6('0x29')](function(_0x67b438){if(_0x67b438&&_0x67b438[_0xc1f6('0x5f')]===0x0){return db['UserProfileResource'][_0xc1f6('0x53')]({'name':_0x7f6992['name'],'resourceId':_0x7f6992['id'],'type':_0x67b438[_0xc1f6('0x33')],'sectionId':_0x67b438['id']},{})['then'](function(){return _0x4edf20;});}else{return _0x4edf20;}})[_0xc1f6('0x4f')](function(_0x5e3373){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e3373);throw _0x5e3373;});}return _0x4edf20;});}})['then'](respondWithResult(_0x3b4a95,0xc9))['catch'](handleError(_0x3b4a95,null));};exports[_0xc1f6('0x60')]=function(_0x23c8f6,_0x2e6a67){if(_0x23c8f6[_0xc1f6('0x5b')]['id']){delete _0x23c8f6[_0xc1f6('0x5b')]['id'];}return db[_0xc1f6('0x39')]['find']({'where':{'id':_0x23c8f6['params']['id']}})['then'](handleEntityNotFound(_0x2e6a67,null))[_0xc1f6('0x29')](saveUpdates(_0x23c8f6[_0xc1f6('0x5b')],null))[_0xc1f6('0x29')](respondWithResult(_0x2e6a67,null))[_0xc1f6('0x4f')](handleError(_0x2e6a67,null));};exports[_0xc1f6('0x2a')]=function(_0x146e04,_0x50729a){return db[_0xc1f6('0x39')][_0xc1f6('0x32')]({'where':{'id':_0x146e04[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x50729a,null))[_0xc1f6('0x29')](removeEntity(_0x50729a,null))[_0xc1f6('0x4f')](handleError(_0x50729a,null));};exports['getHoppers']=function(_0x1ce724,_0x5ab952,_0x227a38){var _0x33be90={'raw':![],'where':{}};var _0x5515df={};var _0x49305d={'count':0x0,'rows':[]};return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x1ce724[_0xc1f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ab952,null))[_0xc1f6('0x29')](function(_0x3c1d83){if(_0x3c1d83){_0x5515df[_0xc1f6('0x3d')]=_[_0xc1f6('0x51')](db['CmHopper'][_0xc1f6('0x3a')]);_0x5515df[_0xc1f6('0x3e')]=_['keys'](_0x1ce724[_0xc1f6('0x3e')]);_0x5515df['filters']=_[_0xc1f6('0x40')](_0x5515df['model'],_0x5515df[_0xc1f6('0x3e')]);_0x33be90[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x5515df[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x1ce724['query'][_0xc1f6('0x52')]));_0x33be90[_0xc1f6('0x41')]=_0x33be90[_0xc1f6('0x41')][_0xc1f6('0x42')]?_0x33be90[_0xc1f6('0x41')]:_0x5515df[_0xc1f6('0x3d')];if(!_0x1ce724[_0xc1f6('0x3e')][_0xc1f6('0x43')](_0xc1f6('0x44'))){_0x33be90[_0xc1f6('0x24')]=qs[_0xc1f6('0x24')](_0x1ce724['query'][_0xc1f6('0x24')]);_0x33be90[_0xc1f6('0x23')]=qs[_0xc1f6('0x23')](_0x1ce724['query'][_0xc1f6('0x23')]);}_0x33be90[_0xc1f6('0x45')]=qs[_0xc1f6('0x46')](_0x1ce724[_0xc1f6('0x3e')][_0xc1f6('0x46')]);_0x33be90['where']=qs['filters'](_[_0xc1f6('0x48')](_0x1ce724[_0xc1f6('0x3e')],_0x5515df[_0xc1f6('0x3f')]));_0x33be90[_0xc1f6('0x47')]['VoiceQueueId']=_0x3c1d83['id'];if(_0x1ce724[_0xc1f6('0x3e')]['filter']){_0x33be90['where']=_[_0xc1f6('0x4a')](_0x33be90[_0xc1f6('0x47')],{'$or':_[_0xc1f6('0x4b')](_0x33be90['attributes'],function(_0x264c4d){var _0x177b53={};_0x177b53[_0x264c4d]={'$like':'%'+_0x1ce724['query']['filter']+'%'};return _0x177b53;})});}_0x33be90=_[_0xc1f6('0x4a')]({},_0x33be90,_0x1ce724[_0xc1f6('0x62')]);return db['CmHopper']['count']({'where':_0x33be90[_0xc1f6('0x47')]})[_0xc1f6('0x29')](function(_0x18d38c){_0x49305d['count']=_0x18d38c;if(_0x1ce724[_0xc1f6('0x3e')][_0xc1f6('0x4c')]){_0x33be90[_0xc1f6('0x4d')]=[{'all':!![]}];}return db[_0xc1f6('0x63')][_0xc1f6('0x64')](_0x33be90);})[_0xc1f6('0x29')](function(_0x406137){_0x49305d[_0xc1f6('0x4e')]=_0x406137;return _0x49305d;});}})[_0xc1f6('0x29')](respondWithFilteredResult(_0x5ab952,_0x33be90))['catch'](handleError(_0x5ab952,null));};exports['getHopperHistories']=function(_0x3e9598,_0x453e3c,_0x1150f9){var _0x5a9a3b={'raw':!![],'where':{}};var _0x48d5f0={};var _0x4e0ddf={'count':0x0,'rows':[]};return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x3e9598['params']['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x453e3c,null))[_0xc1f6('0x29')](function(_0x3253e6){if(_0x3253e6){_0x48d5f0[_0xc1f6('0x3d')]=_[_0xc1f6('0x51')](db[_0xc1f6('0x65')][_0xc1f6('0x3a')]);_0x48d5f0['query']=_[_0xc1f6('0x51')](_0x3e9598[_0xc1f6('0x3e')]);_0x48d5f0['filters']=_[_0xc1f6('0x40')](_0x48d5f0['model'],_0x48d5f0[_0xc1f6('0x3e')]);_0x5a9a3b['attributes']=_['intersection'](_0x48d5f0[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x3e9598[_0xc1f6('0x3e')][_0xc1f6('0x52')]));_0x5a9a3b[_0xc1f6('0x41')]=_0x5a9a3b[_0xc1f6('0x41')][_0xc1f6('0x42')]?_0x5a9a3b[_0xc1f6('0x41')]:_0x48d5f0[_0xc1f6('0x3d')];if(!_0x3e9598[_0xc1f6('0x3e')]['hasOwnProperty'](_0xc1f6('0x44'))){_0x5a9a3b['limit']=qs[_0xc1f6('0x24')](_0x3e9598['query'][_0xc1f6('0x24')]);_0x5a9a3b['offset']=qs['offset'](_0x3e9598[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}_0x5a9a3b[_0xc1f6('0x45')]=qs['sort'](_0x3e9598[_0xc1f6('0x3e')][_0xc1f6('0x46')]);_0x5a9a3b['where']=qs[_0xc1f6('0x3f')](_['pick'](_0x3e9598[_0xc1f6('0x3e')],_0x48d5f0[_0xc1f6('0x3f')]));_0x5a9a3b[_0xc1f6('0x47')][_0xc1f6('0x66')]=_0x3253e6['id'];if(_0x3e9598['query'][_0xc1f6('0x49')]){_0x5a9a3b[_0xc1f6('0x47')]=_[_0xc1f6('0x4a')](_0x5a9a3b['where'],{'$or':_[_0xc1f6('0x4b')](_0x5a9a3b[_0xc1f6('0x41')],function(_0x45c1dd){var _0x6ac58={};_0x6ac58[_0x45c1dd]={'$like':'%'+_0x3e9598[_0xc1f6('0x3e')][_0xc1f6('0x49')]+'%'};return _0x6ac58;})});}_0x5a9a3b=_[_0xc1f6('0x4a')]({},_0x5a9a3b,_0x3e9598['options']);return db[_0xc1f6('0x65')][_0xc1f6('0x22')]({'where':_0x5a9a3b[_0xc1f6('0x47')]})[_0xc1f6('0x29')](function(_0x41c989){_0x4e0ddf[_0xc1f6('0x22')]=_0x41c989;if(_0x3e9598[_0xc1f6('0x3e')]['includeAll']){_0x5a9a3b['include']=[{'all':!![]}];}return db[_0xc1f6('0x65')][_0xc1f6('0x64')](_0x5a9a3b);})[_0xc1f6('0x29')](function(_0x32c01a){_0x4e0ddf[_0xc1f6('0x4e')]=_0x32c01a;return _0x4e0ddf;});}})[_0xc1f6('0x29')](respondWithFilteredResult(_0x453e3c,_0x5a9a3b))[_0xc1f6('0x4f')](handleError(_0x453e3c,null));};exports[_0xc1f6('0x67')]=function(_0x5da77b,_0x1d6cce,_0x1013d7){var _0x5cbd15={'raw':!![],'where':{}};var _0x859fb6={};var _0x1a2c38={'count':0x0,'rows':[]};return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x5da77b[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x1d6cce,null))[_0xc1f6('0x29')](function(_0x4d1663){if(_0x4d1663){_0x859fb6[_0xc1f6('0x3d')]=_[_0xc1f6('0x51')](db[_0xc1f6('0x68')][_0xc1f6('0x3a')]);_0x859fb6[_0xc1f6('0x3e')]=_[_0xc1f6('0x51')](_0x5da77b['query']);_0x859fb6[_0xc1f6('0x3f')]=_[_0xc1f6('0x40')](_0x859fb6[_0xc1f6('0x3d')],_0x859fb6[_0xc1f6('0x3e')]);_0x5cbd15[_0xc1f6('0x41')]=_['intersection'](_0x859fb6[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x5da77b[_0xc1f6('0x3e')][_0xc1f6('0x52')]));_0x5cbd15[_0xc1f6('0x41')]=_0x5cbd15[_0xc1f6('0x41')]['length']?_0x5cbd15['attributes']:_0x859fb6[_0xc1f6('0x3d')];if(!_0x5da77b[_0xc1f6('0x3e')][_0xc1f6('0x43')](_0xc1f6('0x44'))){_0x5cbd15[_0xc1f6('0x24')]=qs['limit'](_0x5da77b[_0xc1f6('0x3e')][_0xc1f6('0x24')]);_0x5cbd15[_0xc1f6('0x23')]=qs['offset'](_0x5da77b[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}_0x5cbd15[_0xc1f6('0x45')]=qs['sort'](_0x5da77b['query'][_0xc1f6('0x46')]);_0x5cbd15[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_[_0xc1f6('0x48')](_0x5da77b[_0xc1f6('0x3e')],_0x859fb6[_0xc1f6('0x3f')]));_0x5cbd15[_0xc1f6('0x47')][_0xc1f6('0x66')]=_0x4d1663['id'];if(_0x5da77b[_0xc1f6('0x3e')][_0xc1f6('0x49')]){_0x5cbd15[_0xc1f6('0x47')]=_['merge'](_0x5cbd15['where'],{'$or':_['map'](_0x5cbd15[_0xc1f6('0x41')],function(_0x568985){var _0x51cac8={};_0x51cac8[_0x568985]={'$like':'%'+_0x5da77b['query'][_0xc1f6('0x49')]+'%'};return _0x51cac8;})});}_0x5cbd15=_[_0xc1f6('0x4a')]({},_0x5cbd15,_0x5da77b[_0xc1f6('0x62')]);return db[_0xc1f6('0x68')][_0xc1f6('0x22')]({'where':_0x5cbd15[_0xc1f6('0x47')]})['then'](function(_0x4178f4){_0x1a2c38[_0xc1f6('0x22')]=_0x4178f4;if(_0x5da77b['query'][_0xc1f6('0x4c')]){_0x5cbd15[_0xc1f6('0x4d')]=[{'all':!![]}];}return db[_0xc1f6('0x68')][_0xc1f6('0x64')](_0x5cbd15);})['then'](function(_0x352d07){_0x1a2c38[_0xc1f6('0x4e')]=_0x352d07;return _0x1a2c38;});}})[_0xc1f6('0x29')](respondWithFilteredResult(_0x1d6cce,_0x5cbd15))[_0xc1f6('0x4f')](handleError(_0x1d6cce,null));};exports[_0xc1f6('0x69')]=function(_0x169c08,_0x177600,_0x406aac){var _0x354884={'raw':!![],'where':{}};var _0x447fa5={};var _0x2ce171={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc1f6('0x61')]({'where':{'id':_0x169c08[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x177600,null))['then'](function(_0x4849b7){if(_0x4849b7){_0x447fa5[_0xc1f6('0x3d')]=_[_0xc1f6('0x51')](db[_0xc1f6('0x6a')][_0xc1f6('0x3a')]);_0x447fa5['query']=_[_0xc1f6('0x51')](_0x169c08['query']);_0x447fa5['filters']=_[_0xc1f6('0x40')](_0x447fa5['model'],_0x447fa5[_0xc1f6('0x3e')]);_0x354884[_0xc1f6('0x41')]=_['intersection'](_0x447fa5[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x169c08[_0xc1f6('0x3e')]['fields']));_0x354884[_0xc1f6('0x41')]=_0x354884[_0xc1f6('0x41')][_0xc1f6('0x42')]?_0x354884[_0xc1f6('0x41')]:_0x447fa5['model'];if(!_0x169c08[_0xc1f6('0x3e')][_0xc1f6('0x43')](_0xc1f6('0x44'))){_0x354884[_0xc1f6('0x24')]=qs[_0xc1f6('0x24')](_0x169c08['query'][_0xc1f6('0x24')]);_0x354884[_0xc1f6('0x23')]=qs[_0xc1f6('0x23')](_0x169c08[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}_0x354884[_0xc1f6('0x45')]=qs[_0xc1f6('0x46')](_0x169c08[_0xc1f6('0x3e')][_0xc1f6('0x46')]);_0x354884[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_['pick'](_0x169c08[_0xc1f6('0x3e')],_0x447fa5[_0xc1f6('0x3f')]));_0x354884[_0xc1f6('0x47')]['VoiceQueueId']=_0x4849b7['id'];if(_0x169c08['query']['filter']){_0x354884['where']=_[_0xc1f6('0x4a')](_0x354884['where'],{'$or':_[_0xc1f6('0x4b')](_0x354884['attributes'],function(_0x3e3fe6){var _0x26a33a={};_0x26a33a[_0x3e3fe6]={'$like':'%'+_0x169c08[_0xc1f6('0x3e')][_0xc1f6('0x49')]+'%'};return _0x26a33a;})});}_0x354884=_['merge']({},_0x354884,_0x169c08[_0xc1f6('0x62')]);return db[_0xc1f6('0x6a')][_0xc1f6('0x22')]({'where':_0x354884[_0xc1f6('0x47')]})['then'](function(_0x5aa398){_0x2ce171['count']=_0x5aa398;if(_0x169c08[_0xc1f6('0x3e')][_0xc1f6('0x4c')]){_0x354884[_0xc1f6('0x4d')]=[{'all':!![]}];}return db[_0xc1f6('0x6a')]['findAll'](_0x354884);})[_0xc1f6('0x29')](function(_0x509586){_0x2ce171[_0xc1f6('0x4e')]=_0x509586;return _0x2ce171;});}})['then'](respondWithFilteredResult(_0x177600,_0x354884))[_0xc1f6('0x4f')](handleError(_0x177600,null));};exports[_0xc1f6('0x6b')]=function(_0x5078ef,_0x586a38,_0x21c9d7){var _0x44f9b7={};var _0x3d1861={};var _0x21ffe8;var _0x193360;return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x5078ef['params']['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x586a38,null))[_0xc1f6('0x29')](function(_0x3503b2){if(_0x3503b2){_0x21ffe8=_0x3503b2;_0x3d1861[_0xc1f6('0x3d')]=_[_0xc1f6('0x51')](db['Team'][_0xc1f6('0x3a')]);_0x3d1861[_0xc1f6('0x3e')]=_[_0xc1f6('0x51')](_0x5078ef[_0xc1f6('0x3e')]);_0x3d1861[_0xc1f6('0x3f')]=_[_0xc1f6('0x40')](_0x3d1861[_0xc1f6('0x3d')],_0x3d1861[_0xc1f6('0x3e')]);_0x44f9b7[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x3d1861['model'],qs[_0xc1f6('0x52')](_0x5078ef[_0xc1f6('0x3e')][_0xc1f6('0x52')]));_0x44f9b7[_0xc1f6('0x41')]=_0x44f9b7[_0xc1f6('0x41')]['length']?_0x44f9b7['attributes']:_0x3d1861[_0xc1f6('0x3d')];_0x44f9b7[_0xc1f6('0x45')]=qs[_0xc1f6('0x46')](_0x5078ef['query'][_0xc1f6('0x46')]);_0x44f9b7[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_['pick'](_0x5078ef[_0xc1f6('0x3e')],_0x3d1861[_0xc1f6('0x3f')]));if(_0x5078ef[_0xc1f6('0x3e')][_0xc1f6('0x49')]){_0x44f9b7[_0xc1f6('0x47')]=_[_0xc1f6('0x4a')](_0x44f9b7[_0xc1f6('0x47')],{'$or':_['map'](_0x44f9b7[_0xc1f6('0x41')],function(_0x430d78){var _0x19a415={};_0x19a415[_0x430d78]={'$like':'%'+_0x5078ef[_0xc1f6('0x3e')][_0xc1f6('0x49')]+'%'};return _0x19a415;})});}_0x44f9b7=_[_0xc1f6('0x4a')]({},_0x44f9b7,_0x5078ef[_0xc1f6('0x62')]);return _0x21ffe8[_0xc1f6('0x6b')](_0x44f9b7);}})[_0xc1f6('0x29')](function(_0x225c32){if(_0x225c32){_0x193360=_0x225c32[_0xc1f6('0x42')];if(!_0x5078ef[_0xc1f6('0x3e')]['hasOwnProperty'](_0xc1f6('0x44'))){_0x44f9b7['limit']=qs[_0xc1f6('0x24')](_0x5078ef[_0xc1f6('0x3e')][_0xc1f6('0x24')]);_0x44f9b7[_0xc1f6('0x23')]=qs[_0xc1f6('0x23')](_0x5078ef[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}return _0x21ffe8[_0xc1f6('0x6b')](_0x44f9b7);}})[_0xc1f6('0x29')](function(_0x414baa){if(_0x414baa){return _0x414baa?{'count':_0x193360,'rows':_0x414baa}:null;}})[_0xc1f6('0x29')](respondWithResult(_0x586a38,null))['catch'](handleError(_0x586a38,null));};exports[_0xc1f6('0x6c')]=function(_0x3efb3b,_0x2b634b,_0x3e43c7){var _0x4573c1=_0x3efb3b[_0xc1f6('0x5b')]['teams'];var _0x1d4bcf=_['map'](_0x4573c1,'id');return db[_0xc1f6('0x6d')][_0xc1f6('0x64')]({'where':{'id':_0x1d4bcf},'attributes':['id'],'include':[{'model':db[_0xc1f6('0x6e')],'as':'Agents','attributes':['id',_0xc1f6('0x33'),_0xc1f6('0x6f'),_0xc1f6('0x70'),'interface'],'raw':!![]}]})[_0xc1f6('0x29')](function(_0x52b987){if(_0x52b987){var _0x278d38=_['flatMap'](_0x52b987,function(_0x3afdb2){var _0x56734c=_0x3afdb2[_0xc1f6('0x2b')]({'plain':!![]});_0x56734c[_0xc1f6('0x71')][_0xc1f6('0x72')](function(_0x3be6a6){_0x3be6a6['penalty']=_[_0xc1f6('0x32')](_0x4573c1,{'id':_0x56734c['id']})[_0xc1f6('0x73')];});return _0x56734c[_0xc1f6('0x71')];});return db['VoiceQueue'][_0xc1f6('0x32')]({'where':{'id':_0x3efb3b['params']['id']}})[_0xc1f6('0x29')](function(_0x21e053){return db['sequelize'][_0xc1f6('0x74')](function(_0x108eb5){return _0x21e053[_0xc1f6('0x6c')](_0x1d4bcf,{'transaction':_0x108eb5})[_0xc1f6('0x29')](function(){return BPromise[_0xc1f6('0x75')](_0x278d38,function(_0x8d0302){return db[_0xc1f6('0x76')][_0xc1f6('0x77')]({'where':{'UserId':_0x8d0302['id'],'VoiceQueueId':_0x3efb3b[_0xc1f6('0x50')]['id']},'defaults':{'penalty':_0x8d0302['penalty']},'transaction':_0x108eb5});});})[_0xc1f6('0x29')](function(){return BPromise['each'](_[_0xc1f6('0x49')](_0x278d38,{'online':!![]}),function(_0x5eed85){return db[_0xc1f6('0x78')][_0xc1f6('0x79')]({'membername':_0x5eed85[_0xc1f6('0x33')],'UserId':_0x5eed85['id'],'queue_name':_0x21e053[_0xc1f6('0x33')],'VoiceQueueId':_0x21e053['id'],'interface':_[_0xc1f6('0x7a')](_0x5eed85[_0xc1f6('0x7b')])?util['format']('SIP/%s',_0x5eed85[_0xc1f6('0x33')]):_0x5eed85[_0xc1f6('0x7b')],'paused':_0x5eed85[_0xc1f6('0x70')]||![],'penalty':_0x5eed85[_0xc1f6('0x73')]},{'transaction':_0x108eb5});});})[_0xc1f6('0x29')](function(){_0x278d38[_0xc1f6('0x72')](function(_0x4cd7eb){socket[_0xc1f6('0x7c')](_0xc1f6('0x7d'),{'UserId':_0x4cd7eb['id'],'VoiceQueueId':_0x21e053['id']});});});});});}})[_0xc1f6('0x29')](respondWithStatusCode(_0x2b634b,null))[_0xc1f6('0x4f')](handleError(_0x2b634b,null));};exports[_0xc1f6('0x7e')]=function(_0xb2a645,_0xb6b0cd,_0x13ff19){return db[_0xc1f6('0x6d')][_0xc1f6('0x64')]({'where':{'id':_0xb2a645[_0xc1f6('0x3e')][_0xc1f6('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xc1f6('0x6e')],'as':_0xc1f6('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xb6b0cd,null))[_0xc1f6('0x29')](function(_0x1c5cae){var _0x63195d=_[_0xc1f6('0x4b')](_0x1c5cae,'id');var _0x40e3b4=[];var _0x4bc684=[];var _0x4eb018=squel[_0xc1f6('0x80')]();_0x4eb018[_0xc1f6('0x81')](_0xc1f6('0x82'))[_0xc1f6('0x83')](_0xc1f6('0x84'),'tq')[_0xc1f6('0x85')](_0xc1f6('0x86'),'ut',_0xc1f6('0x87'))[_0xc1f6('0x47')]('VoiceQueueId\x20=\x20?',_0xb2a645['params']['id']);for(var _0x34397d=0x0;_0x34397d<_0x1c5cae['length'];_0x34397d+=0x1){let _0x5feb8e=_0x1c5cae[_0x34397d];for(var _0x254276=0x0;_0x254276<_0x5feb8e[_0xc1f6('0x71')][_0xc1f6('0x42')];_0x254276+=0x1){let _0x300916=_0x5feb8e[_0xc1f6('0x71')][_0x254276];var _0x1a38fc=_0x4eb018['clone']();_0x1a38fc[_0xc1f6('0x47')](_0xc1f6('0x88'),_0x300916['id']);_0x4bc684['push'](db[_0xc1f6('0x89')]['query'](_0x1a38fc[_0xc1f6('0x8a')](),{'type':db[_0xc1f6('0x89')][_0xc1f6('0x8b')][_0xc1f6('0x8c')]})[_0xc1f6('0x29')](function(_0x3e1a83){if(_0x3e1a83[_0xc1f6('0x42')]===0x1){return _0x300916['id'];}else{var _0x4cb3a0=_[_0xc1f6('0x8d')](_['map'](_0x3e1a83,_0xc1f6('0x8e')),function(_0x3d42de){return _[_0xc1f6('0x8f')](_0x63195d,_0x3d42de);});if(_0x4cb3a0){return _0x300916['id'];}}}));}}return BPromise[_0xc1f6('0x90')](_0x4bc684)[_0xc1f6('0x29')](function(_0x2fdfd8){_0x40e3b4=_(_0x40e3b4)['union'](_0x2fdfd8)['compact']()[_0xc1f6('0x30')]();return db[_0xc1f6('0x39')][_0xc1f6('0x32')]({'where':{'id':_0xb2a645[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](function(_0x393e90){return db[_0xc1f6('0x89')]['transaction'](function(_0x1c84b1){return _0x393e90[_0xc1f6('0x7e')](_0xb2a645['query'][_0xc1f6('0x7f')],{'transaction':_0x1c84b1})[_0xc1f6('0x29')](function(){if(!_['isEmpty'](_0x40e3b4)){return _0x393e90[_0xc1f6('0x91')](_0x40e3b4,{'transaction':_0x1c84b1})[_0xc1f6('0x29')](function(){return db[_0xc1f6('0x78')][_0xc1f6('0x2a')]({'where':{'VoiceQueueId':_0xb2a645[_0xc1f6('0x50')]['id'],'UserId':_0x40e3b4},'transaction':_0x1c84b1});});}})['then'](function(){_0x40e3b4[_0xc1f6('0x72')](function(_0x11120d){socket[_0xc1f6('0x7c')](_0xc1f6('0x92'),{'UserId':_0x11120d,'VoiceQueueId':_0x393e90['id']});});});});});});})[_0xc1f6('0x29')](respondWithStatusCode(_0xb6b0cd,null))['catch'](handleError(_0xb6b0cd,null));};exports[_0xc1f6('0x93')]=function(_0x554154,_0x54a128,_0x49b084){var _0x517e3d,_0x4c0ea9;return db[_0xc1f6('0x39')][_0xc1f6('0x32')]({'where':{'id':_0x554154['params']['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x54a128,null))[_0xc1f6('0x29')](function(_0x3f34e0){if(_0x3f34e0){_0x4c0ea9=_0x3f34e0;return _0x3f34e0[_0xc1f6('0x93')](_0x554154[_0xc1f6('0x5b')][_0xc1f6('0x7f')],_[_0xc1f6('0x5c')](_0x554154[_0xc1f6('0x5b')],['ids','id'])||{})[_0xc1f6('0x94')](function(_0x2210de){for(var _0x148546=0x0;_0x148546<_0x554154[_0xc1f6('0x5b')]['ids'][_0xc1f6('0x42')];_0x148546+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x554154['body'][_0xc1f6('0x7f')][_0x148546],'VoiceQueueId':_0x554154[_0xc1f6('0x50')]['id']});}return _0x2210de;});}})[_0xc1f6('0x29')](function(_0xa52922){_0x517e3d=_0xa52922||[];if(_0x4c0ea9){return db[_0xc1f6('0x6e')][_0xc1f6('0x64')]({'where':{'id':_0x554154[_0xc1f6('0x5b')][_0xc1f6('0x7f')]},'attributes':['id',_0xc1f6('0x33'),_0xc1f6('0x6f'),_0xc1f6('0x70'),_0xc1f6('0x7b')],'raw':!![]});}})[_0xc1f6('0x29')](function(_0x104d41){if(!_[_0xc1f6('0x95')](_0x104d41)){var _0x52bc4f=[];for(var _0xb00010=0x0;_0xb00010<_0x104d41[_0xc1f6('0x42')];_0xb00010++){if(_0x104d41[_0xb00010][_0xc1f6('0x6f')]){_0x52bc4f[_0xc1f6('0x96')](db[_0xc1f6('0x78')]['upsert']({'membername':_0x104d41[_0xb00010][_0xc1f6('0x33')],'UserId':_0x104d41[_0xb00010]['id'],'queue_name':_0x4c0ea9[_0xc1f6('0x33')],'VoiceQueueId':_0x4c0ea9['id'],'interface':_[_0xc1f6('0x7a')](_0x104d41[_0xb00010]['interface'])?util['format']('SIP/%s',_0x104d41[_0xb00010][_0xc1f6('0x33')]):_0x104d41[_0xb00010][_0xc1f6('0x7b')],'paused':_0x104d41[_0xb00010]['voicePause']||![],'penalty':_0x554154[_0xc1f6('0x5b')][_0xc1f6('0x73')]||0x0}));}}return BPromise[_0xc1f6('0x90')](_0x52bc4f);}})[_0xc1f6('0x29')](function(){return _0x517e3d;})[_0xc1f6('0x29')](respondWithResult(_0x54a128,null))[_0xc1f6('0x4f')](handleError(_0x54a128,null));};exports[_0xc1f6('0x91')]=function(_0x282d0b,_0x5597f4,_0x1f1ad8){return db[_0xc1f6('0x39')]['find']({'where':{'id':_0x282d0b[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x5597f4,null))[_0xc1f6('0x29')](function(_0x1939e7){if(_0x1939e7){return _0x1939e7['removeAgents'](_0x282d0b[_0xc1f6('0x3e')]['ids'])[_0xc1f6('0x29')](function(){if(_[_0xc1f6('0x97')](_0x282d0b[_0xc1f6('0x3e')][_0xc1f6('0x7f')])){for(var _0x4d51a3=0x0;_0x4d51a3<_0x282d0b[_0xc1f6('0x3e')][_0xc1f6('0x7f')][_0xc1f6('0x42')];_0x4d51a3+=0x1){socket[_0xc1f6('0x7c')](_0xc1f6('0x92'),{'UserId':Number(_0x282d0b[_0xc1f6('0x3e')][_0xc1f6('0x7f')][_0x4d51a3]),'VoiceQueueId':Number(_0x282d0b[_0xc1f6('0x50')]['id'])});}}else{socket[_0xc1f6('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x282d0b[_0xc1f6('0x3e')][_0xc1f6('0x7f')]),'VoiceQueueId':Number(_0x282d0b['params']['id'])});}});}})['then'](function(_0x3600e8){return db[_0xc1f6('0x78')][_0xc1f6('0x2a')]({'where':{'VoiceQueueId':_0x282d0b[_0xc1f6('0x50')]['id'],'UserId':_0x282d0b['query']['ids']}})[_0xc1f6('0x29')](function(){return _0x3600e8;});})['then'](respondWithStatusCode(_0x5597f4,null))['catch'](handleError(_0x5597f4,null));};exports[_0xc1f6('0x98')]=function(_0x51156d,_0x34c434,_0x1da81f){var _0x3b8adc={};var _0x5bc16a={};var _0x168dd0;var _0x39e6ff;return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x51156d[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x34c434,null))['then'](function(_0x2e7598){if(_0x2e7598){_0x168dd0=_0x2e7598;_0x5bc16a[_0xc1f6('0x3d')]=_['keys'](db[_0xc1f6('0x6e')][_0xc1f6('0x3a')]);_0x5bc16a[_0xc1f6('0x3e')]=_[_0xc1f6('0x51')](_0x51156d[_0xc1f6('0x3e')]);_0x5bc16a[_0xc1f6('0x3f')]=_[_0xc1f6('0x40')](_0x5bc16a[_0xc1f6('0x3d')],_0x5bc16a['query']);_0x3b8adc[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x5bc16a[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x51156d[_0xc1f6('0x3e')][_0xc1f6('0x52')]));_0x3b8adc[_0xc1f6('0x41')]=_0x3b8adc[_0xc1f6('0x41')][_0xc1f6('0x42')]?_0x3b8adc['attributes']:_0x5bc16a[_0xc1f6('0x3d')];_0x3b8adc[_0xc1f6('0x45')]=qs[_0xc1f6('0x46')](_0x51156d['query'][_0xc1f6('0x46')]);_0x3b8adc[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_[_0xc1f6('0x48')](_0x51156d[_0xc1f6('0x3e')],_0x5bc16a[_0xc1f6('0x3f')]));if(_0x51156d[_0xc1f6('0x3e')][_0xc1f6('0x49')]){_0x3b8adc[_0xc1f6('0x47')]=_[_0xc1f6('0x4a')](_0x3b8adc[_0xc1f6('0x47')],{'$or':_['map'](_0x3b8adc[_0xc1f6('0x41')],function(_0x1a6790){var _0x127b2c={};_0x127b2c[_0x1a6790]={'$like':'%'+_0x51156d[_0xc1f6('0x3e')][_0xc1f6('0x49')]+'%'};return _0x127b2c;})});}_0x3b8adc=_[_0xc1f6('0x4a')]({},_0x3b8adc,_0x51156d[_0xc1f6('0x62')]);return _0x168dd0['getAgents'](_0x3b8adc);}})[_0xc1f6('0x29')](function(_0x511c9b){if(_0x511c9b){_0x39e6ff=_0x511c9b[_0xc1f6('0x42')];if(!_0x51156d[_0xc1f6('0x3e')][_0xc1f6('0x43')]('nolimit')){_0x3b8adc[_0xc1f6('0x24')]=qs[_0xc1f6('0x24')](_0x51156d['query'][_0xc1f6('0x24')]);_0x3b8adc['offset']=qs[_0xc1f6('0x23')](_0x51156d[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}return _0x168dd0['getAgents'](_0x3b8adc);}})[_0xc1f6('0x29')](function(_0x355eda){if(_0x355eda){return _0x355eda?{'count':_0x39e6ff,'rows':_0x355eda}:null;}})[_0xc1f6('0x29')](respondWithResult(_0x34c434,null))[_0xc1f6('0x4f')](handleError(_0x34c434,null));};exports[_0xc1f6('0x99')]=function(_0x18d890,_0x1b1475,_0x2066ce){var _0x481529={};var _0x332b15={};var _0x102f1d;var _0x324f2f;return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x18d890['params']['id']}})['then'](handleEntityNotFound(_0x1b1475,null))[_0xc1f6('0x29')](function(_0x205c05){if(_0x205c05){_0x102f1d=_0x205c05;_0x332b15[_0xc1f6('0x3d')]=_['keys'](db[_0xc1f6('0x78')]['rawAttributes']);_0x332b15['query']=_[_0xc1f6('0x51')](_0x18d890[_0xc1f6('0x3e')]);_0x332b15[_0xc1f6('0x3f')]=_[_0xc1f6('0x40')](_0x332b15[_0xc1f6('0x3d')],_0x332b15['query']);_0x481529[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x332b15[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x18d890[_0xc1f6('0x3e')][_0xc1f6('0x52')]));_0x481529['attributes']=_0x481529['attributes'][_0xc1f6('0x42')]?_0x481529['attributes']:_0x332b15[_0xc1f6('0x3d')];_0x481529['order']=qs['sort'](_0x18d890['query']['sort']);_0x481529[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_[_0xc1f6('0x48')](_0x18d890[_0xc1f6('0x3e')],_0x332b15[_0xc1f6('0x3f')]));if(_0x18d890[_0xc1f6('0x3e')][_0xc1f6('0x49')]){_0x481529['where']=_[_0xc1f6('0x4a')](_0x481529[_0xc1f6('0x47')],{'$or':_[_0xc1f6('0x4b')](_0x481529['attributes'],function(_0x145f1d){var _0x10cbd2={};_0x10cbd2[_0x145f1d]={'$like':'%'+_0x18d890[_0xc1f6('0x3e')]['filter']+'%'};return _0x10cbd2;})});}_0x481529=_[_0xc1f6('0x4a')]({},_0x481529,_0x18d890[_0xc1f6('0x62')]);return _0x102f1d[_0xc1f6('0x99')](_0x481529);}})['then'](function(_0x3f33c0){if(_0x3f33c0){_0x324f2f=_0x3f33c0[_0xc1f6('0x42')];if(!_0x18d890[_0xc1f6('0x3e')][_0xc1f6('0x43')](_0xc1f6('0x44'))){_0x481529[_0xc1f6('0x24')]=qs[_0xc1f6('0x24')](_0x18d890[_0xc1f6('0x3e')][_0xc1f6('0x24')]);_0x481529[_0xc1f6('0x23')]=qs[_0xc1f6('0x23')](_0x18d890[_0xc1f6('0x3e')][_0xc1f6('0x23')]);}return _0x102f1d[_0xc1f6('0x99')](_0x481529);}})[_0xc1f6('0x29')](function(_0x116e8d){return _0x116e8d?{'count':_0x324f2f,'rows':_0x116e8d}:null;})[_0xc1f6('0x29')](respondWithResult(_0x1b1475,null))[_0xc1f6('0x4f')](handleError(_0x1b1475,null));};exports[_0xc1f6('0x9a')]=function(_0x588d17,_0x4ead81,_0x4b9221){var _0x4b08cd={};var _0x39152a={};var _0x3ae0cc;var _0x4d4a5a;return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x588d17[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x4ead81,null))[_0xc1f6('0x29')](function(_0x2f4f6c){if(_0x2f4f6c){_0x3ae0cc=_0x2f4f6c;_0x39152a[_0xc1f6('0x3d')]=_['keys'](db[_0xc1f6('0x9b')][_0xc1f6('0x3a')]);_0x39152a['query']=_['keys'](_0x588d17[_0xc1f6('0x3e')]);_0x39152a['filters']=_[_0xc1f6('0x40')](_0x39152a[_0xc1f6('0x3d')],_0x39152a[_0xc1f6('0x3e')]);_0x4b08cd[_0xc1f6('0x41')]=_['intersection'](_0x39152a[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x588d17[_0xc1f6('0x3e')]['fields']));_0x4b08cd['attributes']=_0x4b08cd[_0xc1f6('0x41')][_0xc1f6('0x42')]?_0x4b08cd[_0xc1f6('0x41')]:_0x39152a[_0xc1f6('0x3d')];_0x4b08cd[_0xc1f6('0x45')]=qs['sort'](_0x588d17[_0xc1f6('0x3e')][_0xc1f6('0x46')]);_0x4b08cd['where']=qs['filters'](_[_0xc1f6('0x48')](_0x588d17[_0xc1f6('0x3e')],_0x39152a['filters']));if(_0x588d17['query']['filter']){_0x4b08cd['where']=_[_0xc1f6('0x4a')](_0x4b08cd['where'],{'$or':_[_0xc1f6('0x4b')](_0x4b08cd[_0xc1f6('0x41')],function(_0x14c7e0){var _0x292d89={};_0x292d89[_0x14c7e0]={'$like':'%'+_0x588d17[_0xc1f6('0x3e')][_0xc1f6('0x49')]+'%'};return _0x292d89;})});}_0x4b08cd=_['merge']({},_0x4b08cd,_0x588d17[_0xc1f6('0x62')]);return _0x3ae0cc['getLists'](_0x4b08cd);}})['then'](function(_0x184a76){if(_0x184a76){_0x4d4a5a=_0x184a76[_0xc1f6('0x42')];if(!_0x588d17[_0xc1f6('0x3e')][_0xc1f6('0x43')]('nolimit')){_0x4b08cd['limit']=qs[_0xc1f6('0x24')](_0x588d17['query']['limit']);_0x4b08cd[_0xc1f6('0x23')]=qs[_0xc1f6('0x23')](_0x588d17['query']['offset']);}return _0x3ae0cc['getLists'](_0x4b08cd);}})[_0xc1f6('0x29')](function(_0x19d67c){if(_0x19d67c){return _0x19d67c?{'count':_0x4d4a5a,'rows':_0x19d67c}:null;}})[_0xc1f6('0x29')](respondWithResult(_0x4ead81,null))[_0xc1f6('0x4f')](handleError(_0x4ead81,null));};exports['addLists']=function(_0x509431,_0x46da8f,_0x11fc8a){var _0x3b9441,_0x3debfc;return db[_0xc1f6('0x39')]['find']({'where':{'id':_0x509431[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x46da8f,null))[_0xc1f6('0x29')](function(_0x3bbe33){if(_0x3bbe33){_0x3debfc=_0x3bbe33;return _0x3bbe33['addLists'](_0x509431['body'][_0xc1f6('0x7f')],_['omit'](_0x509431[_0xc1f6('0x5b')],[_0xc1f6('0x7f'),'id'])||{});}return null;})[_0xc1f6('0x94')](function(_0x334f94){var _0x3bcac9;_0x3b9441=_0x334f94||[];var _0x438cac=[];if(_0x334f94){for(var _0x36aaf8=0x0;_0x36aaf8<_0x334f94['length'];_0x36aaf8+=0x1){var _0x5da725=_0x334f94[_0x36aaf8][_0xc1f6('0x2b')]({'plain':!![]});_0x3debfc[_0xc1f6('0x9c')]=_0x509431['body'][_0xc1f6('0x9c')]?_0x509431['body'][_0xc1f6('0x9c')]:_0x3debfc['dialCheckDuplicateType'];switch(_0x3debfc['dialCheckDuplicateType']){case _0xc1f6('0x9d'):_0x3bcac9=squel[_0xc1f6('0x9e')]()[_0xc1f6('0x9f')](_0xc1f6('0xa0'))['fromQuery']([_0xc1f6('0xa1'),_0xc1f6('0xa2'),_0xc1f6('0xa3'),'ListId','VoiceQueueId',_0xc1f6('0x5a'),'updatedAt'],squel[_0xc1f6('0x80')]()[_0xc1f6('0x81')]('phone',_0xc1f6('0xa1'))[_0xc1f6('0x81')](_0xc1f6('0xa4'),_0xc1f6('0xa2'))[_0xc1f6('0x81')]('id','ContactId')[_0xc1f6('0x81')](_0x5da725[_0xc1f6('0xa5')]['toString'](),_0xc1f6('0xa6'))[_0xc1f6('0x81')](_0x509431[_0xc1f6('0x50')]['id']['toString'](),_0xc1f6('0x66'))[_0xc1f6('0x81')](_0xc1f6('0xa4'),_0xc1f6('0x5a'))[_0xc1f6('0x81')](_0xc1f6('0xa4'),_0xc1f6('0x5d'))[_0xc1f6('0x83')]('cm_contacts')[_0xc1f6('0x47')]('deletedAt\x20IS\x20NULL')[_0xc1f6('0x47')](_0xc1f6('0xa7'),_0x5da725['CmListId']['toString']())[_0xc1f6('0x47')](_0xc1f6('0xa8'))[_0xc1f6('0x47')](_0xc1f6('0xa9'),squel[_0xc1f6('0x80')]()[_0xc1f6('0x81')]('COALESCE(calleridnum,\x27\x27)')[_0xc1f6('0x83')]('cm_hopper_final')[_0xc1f6('0x47')](_0xc1f6('0xaa'),_0x509431[_0xc1f6('0x50')]['id']['toString']()))[_0xc1f6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc1f6('0x80')]()[_0xc1f6('0x81')](_0xc1f6('0xab'))[_0xc1f6('0x83')](_0xc1f6('0xa0'))['where'](_0xc1f6('0xaa'),_0x509431[_0xc1f6('0x50')]['id'][_0xc1f6('0x8a')]())))[_0xc1f6('0x8a')]();break;case'onlyIfOpen':_0x3bcac9=squel['insert']()[_0xc1f6('0x9f')](_0xc1f6('0xa0'))[_0xc1f6('0xac')]([_0xc1f6('0xa1'),'scheduledAt',_0xc1f6('0xa3'),_0xc1f6('0xa6'),_0xc1f6('0x66'),_0xc1f6('0x5a'),_0xc1f6('0x5d')],squel['select']()['field'](_0xc1f6('0xa1'),_0xc1f6('0xa1'))['field'](_0xc1f6('0xa4'),'scheduledAt')[_0xc1f6('0x81')]('id','ContactId')[_0xc1f6('0x81')](_0x5da725[_0xc1f6('0xa5')][_0xc1f6('0x8a')](),'ListId')[_0xc1f6('0x81')](_0x509431[_0xc1f6('0x50')]['id'][_0xc1f6('0x8a')](),'VoiceQueueId')[_0xc1f6('0x81')](_0xc1f6('0xa4'),'createdAt')[_0xc1f6('0x81')](_0xc1f6('0xa4'),_0xc1f6('0x5d'))[_0xc1f6('0x83')](_0xc1f6('0xad'))[_0xc1f6('0x47')](_0xc1f6('0xae'))['where'](_0xc1f6('0xa7'),_0x5da725[_0xc1f6('0xa5')][_0xc1f6('0x8a')]())[_0xc1f6('0x47')](_0xc1f6('0xa8'))[_0xc1f6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc1f6('0x80')]()[_0xc1f6('0x81')](_0xc1f6('0xab'))[_0xc1f6('0x83')]('cm_hopper')[_0xc1f6('0x47')](_0xc1f6('0xaa'),_0x509431[_0xc1f6('0x50')]['id'][_0xc1f6('0x8a')]())))[_0xc1f6('0x8a')]();break;default:_0x3bcac9=squel[_0xc1f6('0x9e')]()[_0xc1f6('0x9f')]('cm_hopper')[_0xc1f6('0xac')]([_0xc1f6('0xa1'),_0xc1f6('0xa2'),_0xc1f6('0xa3'),'ListId','VoiceQueueId',_0xc1f6('0x5a'),_0xc1f6('0x5d')],squel[_0xc1f6('0x80')]()[_0xc1f6('0x81')](_0xc1f6('0xa1'),'phone')[_0xc1f6('0x81')]('NOW()',_0xc1f6('0xa2'))['field']('id',_0xc1f6('0xa3'))[_0xc1f6('0x81')](_0x5da725[_0xc1f6('0xa5')][_0xc1f6('0x8a')](),_0xc1f6('0xa6'))['field'](_0x509431[_0xc1f6('0x50')]['id'][_0xc1f6('0x8a')](),_0xc1f6('0x66'))[_0xc1f6('0x81')]('NOW()','createdAt')[_0xc1f6('0x81')](_0xc1f6('0xa4'),_0xc1f6('0x5d'))[_0xc1f6('0x83')]('cm_contacts')[_0xc1f6('0x47')]('deletedAt\x20IS\x20NULL')[_0xc1f6('0x47')](_0xc1f6('0xa7'),_0x5da725['CmListId']['toString']())[_0xc1f6('0x47')](_0xc1f6('0xa8')))[_0xc1f6('0x8a')]();}_0x438cac[_0xc1f6('0x96')](db['sequelize'][_0xc1f6('0x3e')](_0x3bcac9));}return BPromise['all'](_0x438cac);}})['then'](function(){return _0x3b9441;})[_0xc1f6('0x29')](respondWithResult(_0x46da8f,null))['catch'](handleError(_0x46da8f,null));};exports['removeLists']=function(_0x551409,_0x1cac71,_0x1bda1e){return db[_0xc1f6('0x39')][_0xc1f6('0x32')]({'where':{'id':_0x551409['params']['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x1cac71,null))['then'](function(_0x3d57b8){if(_0x3d57b8){return _0x3d57b8[_0xc1f6('0xaf')](_0x551409['query'][_0xc1f6('0x7f')]);}})[_0xc1f6('0x29')](function(_0x54d2da){if(_0x54d2da){return db[_0xc1f6('0x63')]['destroy']({'where':{'ListId':_0x551409[_0xc1f6('0x3e')][_0xc1f6('0x7f')],'VoiceQueueId':_0x551409[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](function(){return _0x54d2da;});}})['then'](respondWithStatusCode(_0x1cac71,null))[_0xc1f6('0x4f')](handleError(_0x1cac71,null));};exports[_0xc1f6('0xb0')]=function(_0x148fe3,_0xbee297,_0xd0dbb8){var _0x4b4096={};var _0x24e315={};var _0x27a68d;var _0x1a5ac0;return db[_0xc1f6('0x39')][_0xc1f6('0x61')]({'where':{'id':_0x148fe3['params']['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0xbee297,null))[_0xc1f6('0x29')](function(_0xe38547){if(_0xe38547){_0x27a68d=_0xe38547;_0x24e315['model']=_['keys'](db[_0xc1f6('0x9b')][_0xc1f6('0x3a')]);_0x24e315[_0xc1f6('0x3e')]=_[_0xc1f6('0x51')](_0x148fe3[_0xc1f6('0x3e')]);_0x24e315[_0xc1f6('0x3f')]=_['intersection'](_0x24e315[_0xc1f6('0x3d')],_0x24e315[_0xc1f6('0x3e')]);_0x4b4096[_0xc1f6('0x41')]=_[_0xc1f6('0x40')](_0x24e315[_0xc1f6('0x3d')],qs[_0xc1f6('0x52')](_0x148fe3[_0xc1f6('0x3e')]['fields']));_0x4b4096[_0xc1f6('0x41')]=_0x4b4096[_0xc1f6('0x41')]['length']?_0x4b4096[_0xc1f6('0x41')]:_0x24e315[_0xc1f6('0x3d')];_0x4b4096[_0xc1f6('0x45')]=qs[_0xc1f6('0x46')](_0x148fe3[_0xc1f6('0x3e')]['sort']);_0x4b4096[_0xc1f6('0x47')]=qs[_0xc1f6('0x3f')](_[_0xc1f6('0x48')](_0x148fe3[_0xc1f6('0x3e')],_0x24e315[_0xc1f6('0x3f')]));if(_0x148fe3['query'][_0xc1f6('0x49')]){_0x4b4096[_0xc1f6('0x47')]=_[_0xc1f6('0x4a')](_0x4b4096[_0xc1f6('0x47')],{'$or':_['map'](_0x4b4096['attributes'],function(_0x3f126f){var _0x225d16={};_0x225d16[_0x3f126f]={'$like':'%'+_0x148fe3[_0xc1f6('0x3e')][_0xc1f6('0x49')]+'%'};return _0x225d16;})});}_0x4b4096=_[_0xc1f6('0x4a')]({},_0x4b4096,_0x148fe3[_0xc1f6('0x62')]);return _0x27a68d['getBlackLists'](_0x4b4096);}})[_0xc1f6('0x29')](function(_0x1a1913){if(_0x1a1913){_0x1a5ac0=_0x1a1913[_0xc1f6('0x42')];if(!_0x148fe3['query'][_0xc1f6('0x43')](_0xc1f6('0x44'))){_0x4b4096[_0xc1f6('0x24')]=qs[_0xc1f6('0x24')](_0x148fe3[_0xc1f6('0x3e')]['limit']);_0x4b4096['offset']=qs[_0xc1f6('0x23')](_0x148fe3[_0xc1f6('0x3e')]['offset']);}return _0x27a68d['getBlackLists'](_0x4b4096);}})['then'](function(_0x21ce67){if(_0x21ce67){return _0x21ce67?{'count':_0x1a5ac0,'rows':_0x21ce67}:null;}})[_0xc1f6('0x29')](respondWithResult(_0xbee297,null))[_0xc1f6('0x4f')](handleError(_0xbee297,null));};exports['addBlackLists']=function(_0x5afad5,_0x485301,_0x29cc3c){var _0x5a5ba5,_0x3c491d;return db[_0xc1f6('0x39')]['find']({'where':{'id':_0x5afad5['params']['id']}})[_0xc1f6('0x29')](handleEntityNotFound(_0x485301,null))[_0xc1f6('0x29')](function(_0xb6f1c){if(_0xb6f1c){_0x3c491d=_0xb6f1c;return _0xb6f1c[_0xc1f6('0xb1')](_0x5afad5['body']['ids'],_[_0xc1f6('0x5c')](_0x5afad5[_0xc1f6('0x5b')],[_0xc1f6('0x7f'),'id'])||{});}return null;})['spread'](function(_0x52316c){var _0x1b04b2;_0x5a5ba5=_0x52316c||[];var _0x361207=[];if(_0x52316c){for(var _0x4c272b=0x0;_0x4c272b<_0x52316c[_0xc1f6('0x42')];_0x4c272b+=0x1){var _0x648616=_0x52316c[_0x4c272b][_0xc1f6('0x2b')]({'plain':!![]});_0x1b04b2=squel[_0xc1f6('0x9e')]()[_0xc1f6('0x9f')]('cm_hopper_black')[_0xc1f6('0xac')]([_0xc1f6('0xa1'),_0xc1f6('0xa3'),_0xc1f6('0xa6'),_0xc1f6('0x66'),_0xc1f6('0x5a'),_0xc1f6('0x5d')],squel['select']()[_0xc1f6('0x81')]('phone','phone')['field']('id',_0xc1f6('0xa3'))[_0xc1f6('0x81')](_0x648616[_0xc1f6('0xa5')][_0xc1f6('0x8a')](),'ListId')['field'](_0x5afad5[_0xc1f6('0x50')]['id']['toString'](),_0xc1f6('0x66'))[_0xc1f6('0x81')](_0xc1f6('0xa4'),'createdAt')['field'](_0xc1f6('0xa4'),_0xc1f6('0x5d'))['from']('cm_contacts')[_0xc1f6('0x47')]('deletedAt\x20IS\x20NULL')[_0xc1f6('0x47')](_0xc1f6('0xa7'),_0x648616['CmListId'][_0xc1f6('0x8a')]())[_0xc1f6('0x47')](_0xc1f6('0xa8')))[_0xc1f6('0x8a')]();_0x361207[_0xc1f6('0x96')](db[_0xc1f6('0x89')][_0xc1f6('0x3e')](_0x1b04b2));}return BPromise[_0xc1f6('0x90')](_0x361207);}})[_0xc1f6('0x29')](function(){return _0x5a5ba5;})['then'](respondWithResult(_0x485301,null))[_0xc1f6('0x4f')](handleError(_0x485301,null));};exports[_0xc1f6('0xb2')]=function(_0x57119c,_0x178cae,_0x476b96){return db[_0xc1f6('0x39')][_0xc1f6('0x32')]({'where':{'id':_0x57119c[_0xc1f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x178cae,null))['then'](function(_0x54ff16){if(_0x54ff16){return _0x54ff16[_0xc1f6('0xb2')](_0x57119c['query']['ids']);}})['then'](function(_0xaf52d9){if(_0xaf52d9){return db[_0xc1f6('0x6a')][_0xc1f6('0x2a')]({'where':{'ListId':_0x57119c[_0xc1f6('0x3e')][_0xc1f6('0x7f')],'VoiceQueueId':_0x57119c[_0xc1f6('0x50')]['id']}})[_0xc1f6('0x29')](function(){return _0xaf52d9;});}})[_0xc1f6('0x29')](respondWithStatusCode(_0x178cae,null))[_0xc1f6('0x4f')](handleError(_0x178cae,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d05d0a7..f6604bf 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 _0xee4c=['emit','exports','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x1c0abe,_0x1c46ac){var _0x4a6c95=function(_0x18b050){while(--_0x18b050){_0x1c0abe['push'](_0x1c0abe['shift']());}};_0x4a6c95(++_0x1c46ac);}(_0xee4c,0x14a));var _0xcee4=function(_0x250d7f,_0x412b7c){_0x250d7f=_0x250d7f-0x0;var _0x4caf3d=_0xee4c[_0x250d7f];return _0x4caf3d;};'use strict';var EventEmitter=require(_0xcee4('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xcee4('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcee4('0x2')](0x0);var events={'afterCreate':_0xcee4('0x3'),'afterUpdate':_0xcee4('0x4'),'afterDestroy':_0xcee4('0x5')};function emitEvent(_0x21978b){return function(_0x42c508,_0x74d8c6,_0x4271c2){VoiceQueueEvents['emit'](_0x21978b+':'+_0x42c508['id'],_0x42c508);VoiceQueueEvents[_0xcee4('0x6')](_0x21978b,_0x42c508);_0x4271c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xcee4('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xf20c=['exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x480409,_0x13b0a5){var _0x4201bf=function(_0x2f2569){while(--_0x2f2569){_0x480409['push'](_0x480409['shift']());}};_0x4201bf(++_0x13b0a5);}(_0xf20c,0x101));var _0xcf20=function(_0x187499,_0x5e416a){_0x187499=_0x187499-0x0;var _0x2965fe=_0xf20c[_0x187499];return _0x2965fe;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xcf20('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcf20('0x1')](0x0);var events={'afterCreate':_0xcf20('0x2'),'afterUpdate':'update','afterDestroy':_0xcf20('0x3')};function emitEvent(_0x3b4406){return function(_0x284d99,_0x1cb33a,_0xc532c7){VoiceQueueEvents[_0xcf20('0x4')](_0x3b4406+':'+_0x284d99['id'],_0x284d99);VoiceQueueEvents[_0xcf20('0x4')](_0x3b4406,_0x284d99);_0xc532c7(null);};}for(var e in events){if(events[_0xcf20('0x5')](e)){var event=events[e];VoiceQueue[_0xcf20('0x6')](e,emitEvent(event));}}module[_0xcf20('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9c955bc..3ef106c 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 _0xb9db=['request-promise','path','rimraf','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1e12b2,_0x15199f){var _0xdc75eb=function(_0x10f0ee){while(--_0x10f0ee){_0x1e12b2['push'](_0x1e12b2['shift']());}};_0xdc75eb(++_0x15199f);}(_0xb9db,0x11c));var _0xbb9d=function(_0x2afc10,_0x53f949){_0x2afc10=_0x2afc10-0x0;var _0x217924=_0xb9db[_0x2afc10];return _0x217924;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb9d('0x0'))(_0xbb9d('0x1'));var moment=require(_0xbb9d('0x2'));var BPromise=require(_0xbb9d('0x3'));var rp=require(_0xbb9d('0x4'));var fs=require('fs');var path=require(_0xbb9d('0x5'));var rimraf=require(_0xbb9d('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb9d('0x7'));module[_0xbb9d('0x8')]=function(_0x2a0d0d,_0x49466b){return _0x2a0d0d[_0xbb9d('0x9')](_0xbb9d('0xa'),attributes,{'tableName':_0xbb9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdedf=['VoiceQueue','voice_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xdedf,0x120));var _0xfded=function(_0x3e8419,_0x345b64){_0x3e8419=_0x3e8419-0x0;var _0x23509b=_0xdedf[_0x3e8419];return _0x23509b;};'use strict';var _=require('lodash');var util=require(_0xfded('0x0'));var logger=require(_0xfded('0x1'))(_0xfded('0x2'));var moment=require('moment');var BPromise=require(_0xfded('0x3'));var rp=require(_0xfded('0x4'));var fs=require('fs');var path=require(_0xfded('0x5'));var rimraf=require(_0xfded('0x6'));var config=require(_0xfded('0x7'));var attributes=require(_0xfded('0x8'));module[_0xfded('0x9')]=function(_0x1490bf,_0x17a77a){return _0x1490bf[_0xfded('0xa')](_0xfded('0xb'),attributes,{'tableName':_0xfded('0xc'),'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 dfc9e48..132cf68 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 _0x05a5=['code','message','result','catch','VoiceQueue','options','raw','where','include','map','model','attributes','GetVoiceQueue','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x1d2b63,_0x38b720){var _0x5a7088=function(_0x48bb3e){while(--_0x48bb3e){_0x1d2b63['push'](_0x1d2b63['shift']());}};_0x5a7088(++_0x38b720);}(_0x05a5,0x9e));var _0x505a=function(_0x59ab56,_0x4a624a){_0x59ab56=_0x59ab56-0x0;var _0x353f96=_0x05a5[_0x59ab56];return _0x353f96;};'use strict';var _=require(_0x505a('0x0'));var util=require(_0x505a('0x1'));var moment=require('moment');var BPromise=require(_0x505a('0x2'));var rs=require(_0x505a('0x3'));var fs=require('fs');var Redis=require(_0x505a('0x4'));var db=require(_0x505a('0x5'))['db'];var utils=require(_0x505a('0x6'));var logger=require(_0x505a('0x7'))('rpc');var config=require(_0x505a('0x8'));var jayson=require(_0x505a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x505a('0xa')]=_[_0x505a('0xb')](config[_0x505a('0xa')],{'host':_0x505a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x505a('0xa')]));require(_0x505a('0xd'))['register'](socket);function respondWithRpcPromise(_0x5b4bb9,_0x432320,_0x23eaa7){return new BPromise(function(_0x34ba6a,_0x57e133){return client[_0x505a('0xe')](_0x5b4bb9,_0x23eaa7)[_0x505a('0xf')](function(_0x5a7470){logger[_0x505a('0x10')](_0x505a('0x11'),_0x432320,_0x505a('0x12'));logger[_0x505a('0x13')](_0x505a('0x14'),_0x432320,_0x505a('0x12'),JSON['stringify'](_0x5a7470));if(_0x5a7470[_0x505a('0x15')]){if(_0x5a7470[_0x505a('0x15')][_0x505a('0x16')]===0x1f4){logger['error'](_0x505a('0x11'),_0x432320,_0x5a7470[_0x505a('0x15')][_0x505a('0x17')]);return _0x57e133(_0x5a7470[_0x505a('0x15')][_0x505a('0x17')]);}logger[_0x505a('0x15')](_0x505a('0x11'),_0x432320,_0x5a7470[_0x505a('0x15')][_0x505a('0x17')]);return _0x34ba6a(_0x5a7470[_0x505a('0x15')][_0x505a('0x17')]);}else{logger[_0x505a('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x432320,_0x505a('0x12'));_0x34ba6a(_0x5a7470[_0x505a('0x18')][_0x505a('0x17')]);}})[_0x505a('0x19')](function(_0x565523){logger[_0x505a('0x15')](_0x505a('0x11'),_0x432320,_0x565523);_0x57e133(_0x565523);});});}exports['GetVoiceQueue']=function(_0x423545){var _0x27e82f=this;return new Promise(function(_0x55e7e9,_0x466d2d){return db[_0x505a('0x1a')]['findAll']({'raw':_0x423545[_0x505a('0x1b')]?_0x423545[_0x505a('0x1b')][_0x505a('0x1c')]===undefined?!![]:![]:!![],'where':_0x423545[_0x505a('0x1b')]?_0x423545['options'][_0x505a('0x1d')]||null:null,'attributes':_0x423545[_0x505a('0x1b')]?_0x423545[_0x505a('0x1b')]['attributes']||null:null,'limit':_0x423545[_0x505a('0x1b')]?_0x423545[_0x505a('0x1b')]['limit']||null:null,'include':_0x423545[_0x505a('0x1b')]?_0x423545[_0x505a('0x1b')][_0x505a('0x1e')]?_[_0x505a('0x1f')](_0x423545[_0x505a('0x1b')][_0x505a('0x1e')],function(_0x1cc7ed){return{'model':db[_0x1cc7ed['model']],'as':_0x1cc7ed['as'],'attributes':_0x1cc7ed['attributes'],'include':_0x1cc7ed[_0x505a('0x1e')]?_[_0x505a('0x1f')](_0x1cc7ed[_0x505a('0x1e')],function(_0x2f95f3){return{'model':db[_0x2f95f3[_0x505a('0x20')]],'as':_0x2f95f3['as'],'attributes':_0x2f95f3['attributes'],'include':_0x2f95f3[_0x505a('0x1e')]?_[_0x505a('0x1f')](_0x2f95f3[_0x505a('0x1e')],function(_0x11abad){return{'model':db[_0x11abad[_0x505a('0x20')]],'as':_0x11abad['as'],'attributes':_0x11abad[_0x505a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x398a80){logger['info'](_0x505a('0x22'),_0x423545);logger[_0x505a('0x13')](_0x505a('0x22'),_0x423545,JSON['stringify'](_0x398a80));_0x55e7e9(_0x398a80);})[_0x505a('0x19')](function(_0x2c24a0){logger[_0x505a('0x15')](_0x505a('0x22'),_0x2c24a0['message'],_0x423545);_0x466d2d(_0x27e82f['error'](0x1f4,_0x2c24a0['message']));});});};exports[_0x505a('0x23')]=function(_0x2dc29d){var _0xcdba9a=this;return new Promise(function(_0x434de9,_0x1b0c5d){return db[_0x505a('0x1a')]['find']({'raw':_0x2dc29d[_0x505a('0x1b')]?_0x2dc29d[_0x505a('0x1b')][_0x505a('0x1c')]===undefined?!![]:![]:!![],'where':_0x2dc29d[_0x505a('0x1b')]?_0x2dc29d[_0x505a('0x1b')]['where']||null:null,'attributes':_0x2dc29d['options']?_0x2dc29d[_0x505a('0x1b')]['attributes']||null:null,'include':_0x2dc29d[_0x505a('0x1b')]?_0x2dc29d[_0x505a('0x1b')][_0x505a('0x1e')]?_[_0x505a('0x1f')](_0x2dc29d['options'][_0x505a('0x1e')],function(_0x42c0a2){return{'model':db[_0x42c0a2[_0x505a('0x20')]],'as':_0x42c0a2['as'],'attributes':_0x42c0a2[_0x505a('0x21')],'include':_0x42c0a2[_0x505a('0x1e')]?_['map'](_0x42c0a2[_0x505a('0x1e')],function(_0x168b90){return{'model':db[_0x168b90[_0x505a('0x20')]],'as':_0x168b90['as'],'attributes':_0x168b90[_0x505a('0x21')],'include':_0x168b90[_0x505a('0x1e')]?_[_0x505a('0x1f')](_0x168b90['include'],function(_0x4d9eb5){return{'model':db[_0x4d9eb5[_0x505a('0x20')]],'as':_0x4d9eb5['as'],'attributes':_0x4d9eb5[_0x505a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x505a('0xf')](function(_0x2e4fd9){logger[_0x505a('0x10')](_0x505a('0x23'),_0x2dc29d);logger[_0x505a('0x13')](_0x505a('0x23'),_0x2dc29d,JSON['stringify'](_0x2e4fd9));_0x434de9(_0x2e4fd9);})[_0x505a('0x19')](function(_0x4df5ad){logger[_0x505a('0x15')](_0x505a('0x23'),_0x4df5ad['message'],_0x2dc29d);_0x1b0c5d(_0xcdba9a[_0x505a('0x15')](0x1f4,_0x4df5ad[_0x505a('0x17')]));});});}; \ No newline at end of file +var _0xa6a2=['jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','model','attributes','map','stringify','ShowVoiceQueue','raw','lodash','util','moment','bluebird','randomstring','../../config/environment'];(function(_0x42766a,_0xc5c8f4){var _0x17ac97=function(_0x482731){while(--_0x482731){_0x42766a['push'](_0x42766a['shift']());}};_0x17ac97(++_0xc5c8f4);}(_0xa6a2,0x8e));var _0x2a6a=function(_0x4aed6f,_0xb9a95a){_0x4aed6f=_0x4aed6f-0x0;var _0x1011b1=_0xa6a2[_0x4aed6f];return _0x1011b1;};'use strict';var _=require(_0x2a6a('0x0'));var util=require(_0x2a6a('0x1'));var moment=require(_0x2a6a('0x2'));var BPromise=require(_0x2a6a('0x3'));var rs=require(_0x2a6a('0x4'));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(_0x2a6a('0x5'));var jayson=require(_0x2a6a('0x6'));var client=jayson['client'][_0x2a6a('0x7')]({'port':0x232a});config[_0x2a6a('0x8')]=_['defaults'](config[_0x2a6a('0x8')],{'host':_0x2a6a('0x9'),'port':0x18eb});var socket=require(_0x2a6a('0xa'))(new Redis(config['redis']));require(_0x2a6a('0xb'))[_0x2a6a('0xc')](socket);function respondWithRpcPromise(_0x1ffea8,_0x59ef70,_0x51d53f){return new BPromise(function(_0x586caa,_0x3b33a1){return client[_0x2a6a('0xd')](_0x1ffea8,_0x51d53f)[_0x2a6a('0xe')](function(_0x38c93b){logger['info'](_0x2a6a('0xf'),_0x59ef70,_0x2a6a('0x10'));logger[_0x2a6a('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x59ef70,_0x2a6a('0x10'),JSON['stringify'](_0x38c93b));if(_0x38c93b[_0x2a6a('0x12')]){if(_0x38c93b[_0x2a6a('0x12')][_0x2a6a('0x13')]===0x1f4){logger[_0x2a6a('0x12')](_0x2a6a('0xf'),_0x59ef70,_0x38c93b['error'][_0x2a6a('0x14')]);return _0x3b33a1(_0x38c93b['error'][_0x2a6a('0x14')]);}logger[_0x2a6a('0x12')](_0x2a6a('0xf'),_0x59ef70,_0x38c93b[_0x2a6a('0x12')][_0x2a6a('0x14')]);return _0x586caa(_0x38c93b[_0x2a6a('0x12')]['message']);}else{logger[_0x2a6a('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x59ef70,_0x2a6a('0x10'));_0x586caa(_0x38c93b[_0x2a6a('0x16')][_0x2a6a('0x14')]);}})[_0x2a6a('0x17')](function(_0x2bebec){logger['error'](_0x2a6a('0xf'),_0x59ef70,_0x2bebec);_0x3b33a1(_0x2bebec);});});}exports[_0x2a6a('0x18')]=function(_0x5b6185){var _0x51c09c=this;return new Promise(function(_0x1472b8,_0x386ae3){return db[_0x2a6a('0x19')][_0x2a6a('0x1a')]({'raw':_0x5b6185[_0x2a6a('0x1b')]?_0x5b6185[_0x2a6a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5b6185[_0x2a6a('0x1b')]?_0x5b6185[_0x2a6a('0x1b')][_0x2a6a('0x1c')]||null:null,'attributes':_0x5b6185[_0x2a6a('0x1b')]?_0x5b6185['options']['attributes']||null:null,'limit':_0x5b6185['options']?_0x5b6185[_0x2a6a('0x1b')][_0x2a6a('0x1d')]||null:null,'include':_0x5b6185[_0x2a6a('0x1b')]?_0x5b6185[_0x2a6a('0x1b')][_0x2a6a('0x1e')]?_['map'](_0x5b6185[_0x2a6a('0x1b')][_0x2a6a('0x1e')],function(_0x900eca){return{'model':db[_0x900eca[_0x2a6a('0x1f')]],'as':_0x900eca['as'],'attributes':_0x900eca[_0x2a6a('0x20')],'include':_0x900eca[_0x2a6a('0x1e')]?_[_0x2a6a('0x21')](_0x900eca['include'],function(_0x57bee0){return{'model':db[_0x57bee0[_0x2a6a('0x1f')]],'as':_0x57bee0['as'],'attributes':_0x57bee0[_0x2a6a('0x20')],'include':_0x57bee0[_0x2a6a('0x1e')]?_[_0x2a6a('0x21')](_0x57bee0[_0x2a6a('0x1e')],function(_0x4e279f){return{'model':db[_0x4e279f[_0x2a6a('0x1f')]],'as':_0x4e279f['as'],'attributes':_0x4e279f[_0x2a6a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2a6a('0xe')](function(_0x47c30a){logger[_0x2a6a('0x15')](_0x2a6a('0x18'),_0x5b6185);logger[_0x2a6a('0x11')]('GetVoiceQueue',_0x5b6185,JSON[_0x2a6a('0x22')](_0x47c30a));_0x1472b8(_0x47c30a);})[_0x2a6a('0x17')](function(_0x773612){logger[_0x2a6a('0x12')]('GetVoiceQueue',_0x773612[_0x2a6a('0x14')],_0x5b6185);_0x386ae3(_0x51c09c['error'](0x1f4,_0x773612['message']));});});};exports[_0x2a6a('0x23')]=function(_0xa3e3b8){var _0x2ba9f7=this;return new Promise(function(_0x277652,_0x5a221a){return db['VoiceQueue']['find']({'raw':_0xa3e3b8[_0x2a6a('0x1b')]?_0xa3e3b8['options'][_0x2a6a('0x24')]===undefined?!![]:![]:!![],'where':_0xa3e3b8[_0x2a6a('0x1b')]?_0xa3e3b8[_0x2a6a('0x1b')][_0x2a6a('0x1c')]||null:null,'attributes':_0xa3e3b8[_0x2a6a('0x1b')]?_0xa3e3b8['options'][_0x2a6a('0x20')]||null:null,'include':_0xa3e3b8[_0x2a6a('0x1b')]?_0xa3e3b8['options'][_0x2a6a('0x1e')]?_['map'](_0xa3e3b8['options'][_0x2a6a('0x1e')],function(_0x2a56b0){return{'model':db[_0x2a56b0['model']],'as':_0x2a56b0['as'],'attributes':_0x2a56b0[_0x2a6a('0x20')],'include':_0x2a56b0['include']?_['map'](_0x2a56b0[_0x2a6a('0x1e')],function(_0x88b089){return{'model':db[_0x88b089[_0x2a6a('0x1f')]],'as':_0x88b089['as'],'attributes':_0x88b089[_0x2a6a('0x20')],'include':_0x88b089[_0x2a6a('0x1e')]?_['map'](_0x88b089[_0x2a6a('0x1e')],function(_0x42bdbe){return{'model':db[_0x42bdbe[_0x2a6a('0x1f')]],'as':_0x42bdbe['as'],'attributes':_0x42bdbe[_0x2a6a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2a6a('0xe')](function(_0x42de57){logger[_0x2a6a('0x15')](_0x2a6a('0x23'),_0xa3e3b8);logger[_0x2a6a('0x11')](_0x2a6a('0x23'),_0xa3e3b8,JSON[_0x2a6a('0x22')](_0x42de57));_0x277652(_0x42de57);})[_0x2a6a('0x17')](function(_0x35dfac){logger[_0x2a6a('0x12')](_0x2a6a('0x23'),_0x35dfac[_0x2a6a('0x14')],_0xa3e3b8);_0x5a221a(_0x2ba9f7[_0x2a6a('0x12')](0x1f4,_0x35dfac[_0x2a6a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 58d2be5..fbf9bff 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 _0x7cfa=['update','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x58c67e,_0x3b2954){var _0x2471e0=function(_0x159461){while(--_0x159461){_0x58c67e['push'](_0x58c67e['shift']());}};_0x2471e0(++_0x3b2954);}(_0x7cfa,0x137));var _0xa7cf=function(_0x105d6d,_0x567aed){_0x105d6d=_0x105d6d-0x0;var _0x46fedf=_0x7cfa[_0x105d6d];return _0x46fedf;};'use strict';var VoiceQueueEvents=require(_0xa7cf('0x0'));var events=['save','remove',_0xa7cf('0x1')];function createListener(_0x1b4d3e,_0x27b7d2){return function(_0x16b138){_0x27b7d2['emit'](_0x1b4d3e,_0x16b138);};}function removeListener(_0x319aed,_0x5c135c){return function(){VoiceQueueEvents[_0xa7cf('0x2')](_0x319aed,_0x5c135c);};}exports[_0xa7cf('0x3')]=function(_0x7e0d37){for(var _0x10c2c3=0x0,_0x4efc61=events[_0xa7cf('0x4')];_0x10c2c3<_0x4efc61;_0x10c2c3++){var _0x23ae3a=events[_0x10c2c3];var _0xce234f=createListener(_0xa7cf('0x5')+_0x23ae3a,_0x7e0d37);VoiceQueueEvents['on'](_0x23ae3a,_0xce234f);}}; \ No newline at end of file +var _0xcebd=['emit','register','./voiceQueue.events','update'];(function(_0x470a80,_0x2cbefb){var _0x30617b=function(_0x11b2c7){while(--_0x11b2c7){_0x470a80['push'](_0x470a80['shift']());}};_0x30617b(++_0x2cbefb);}(_0xcebd,0xae));var _0xdceb=function(_0x3d2a7d,_0x161ff5){_0x3d2a7d=_0x3d2a7d-0x0;var _0x4f010a=_0xcebd[_0x3d2a7d];return _0x4f010a;};'use strict';var VoiceQueueEvents=require(_0xdceb('0x0'));var events=['save','remove',_0xdceb('0x1')];function createListener(_0x3e3b4d,_0x2dfa8e){return function(_0x17933c){_0x2dfa8e[_0xdceb('0x2')](_0x3e3b4d,_0x17933c);};}function removeListener(_0x5603ee,_0x14d2e0){return function(){VoiceQueueEvents['removeListener'](_0x5603ee,_0x14d2e0);};}exports[_0xdceb('0x3')]=function(_0x5b4436){for(var _0x124e67=0x0,_0x13e1d9=events['length'];_0x124e67<_0x13e1d9;_0x124e67++){var _0x4de30f=events[_0x124e67];var _0x39e9d4=createListener('voiceQueue:'+_0x4de30f,_0x5b4436);VoiceQueueEvents['on'](_0x4de30f,_0x39e9d4);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5867a75..c2edc23 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 _0x1967=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','getVoiceQueuesReport','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x19c5fa,_0x1ca701){var _0x2ee280=function(_0x2900f6){while(--_0x2900f6){_0x19c5fa['push'](_0x19c5fa['shift']());}};_0x2ee280(++_0x1ca701);}(_0x1967,0x173));var _0x7196=function(_0x5b3120,_0x293f78){_0x5b3120=_0x5b3120-0x0;var _0x45e93e=_0x1967[_0x5b3120];return _0x45e93e;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0x9')]('/index',auth[_0x7196('0xc')](),controller[_0x7196('0xe')]);router[_0x7196('0x9')](_0x7196('0xf'),auth[_0x7196('0xc')](),controller['show']);router['post']('/',auth[_0x7196('0xc')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')](_0x7196('0xf'),auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xc')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file +var _0xb511=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','get','/index','getVoiceQueuesReport','/:id','show','create','put','update','destroy','exports'];(function(_0x2a520e,_0x56f5a4){var _0x1eeecc=function(_0x3ccf56){while(--_0x3ccf56){_0x2a520e['push'](_0x2a520e['shift']());}};_0x1eeecc(++_0x56f5a4);}(_0xb511,0x165));var _0x1b51=function(_0x5e6418,_0x570eb9){_0x5e6418=_0x5e6418-0x0;var _0x369f19=_0xb511[_0x5e6418];return _0x369f19;};'use strict';var multer=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var path=require(_0x1b51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b51('0x3'));var router=express[_0x1b51('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b51('0x5'));var config=require(_0x1b51('0x6'));var controller=require(_0x1b51('0x7'));router['get']('/',auth[_0x1b51('0x8')](),controller[_0x1b51('0x9')]);router['get'](_0x1b51('0xa'),auth[_0x1b51('0x8')](),controller['describe']);router[_0x1b51('0xb')](_0x1b51('0xc'),auth[_0x1b51('0x8')](),controller[_0x1b51('0xd')]);router[_0x1b51('0xb')](_0x1b51('0xe'),auth[_0x1b51('0x8')](),controller[_0x1b51('0xf')]);router['post']('/',auth[_0x1b51('0x8')](),controller[_0x1b51('0x10')]);router[_0x1b51('0x11')](_0x1b51('0xe'),auth[_0x1b51('0x8')](),controller[_0x1b51('0x12')]);router['delete'](_0x1b51('0xe'),auth[_0x1b51('0x8')](),controller[_0x1b51('0x13')]);module[_0x1b51('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5b8f548..8f15758 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xcb91[_0x4382bc];return _0x13c82a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x198e13,_0x1af848){var _0x5bd675=function(_0x92da64){while(--_0x92da64){_0x198e13['push'](_0x198e13['shift']());}};_0x5bd675(++_0x1af848);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a9e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a9e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0a9e('0x4')],'set':function(_0x991246){var _0x981158=moment(_0x991246);var _0x57b080=moment(this[_0x0a9e('0x5')](_0x0a9e('0x6')))[_0x0a9e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x503809=_0x981158[_0x0a9e('0x8')](_0x57b080,'seconds');this['setDataValue'](_0x0a9e('0x9'),_0x991246);this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x503809||null);}},'position':{'type':Sequelize[_0x0a9e('0xc')]},'count':{'type':Sequelize[_0x0a9e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x0a9e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0a9e('0x3')],'comment':_0x0a9e('0xe')},'originalposition':{'type':Sequelize[_0x0a9e('0xc')]},'channel':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a9e('0x3')]},'context':{'type':Sequelize[_0x0a9e('0x3')]},'exten':{'type':Sequelize[_0x0a9e('0x3')]},'priority':{'type':Sequelize[_0x0a9e('0x3')]},'holdtime':{'type':Sequelize[_0x0a9e('0xc')]},'mohtime':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0a9e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0a9e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0a9e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0a9e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0a9e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2ec6c35..4788341 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(_0x27afa5,_0x19ff4f){var _0x4870ff=function(_0x13584c){while(--_0x13584c){_0x27afa5['push'](_0x27afa5['shift']());}};_0x4870ff(++_0x19ff4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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(_0x31e740,_0x247c8a){var _0x5b2f39=function(_0x58ee8a){while(--_0x58ee8a){_0x31e740['push'](_0x31e740['shift']());}};_0x5b2f39(++_0x247c8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 ef42589..3b6e352 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 _0x48bb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x23bb08,_0x435c08){var _0x2aeff8=function(_0x71cfe6){while(--_0x71cfe6){_0x23bb08['push'](_0x23bb08['shift']());}};_0x2aeff8(++_0x435c08);}(_0x48bb,0x1f3));var _0xb48b=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x48bb[_0x3826ad];return _0x17b900;};'use strict';var EventEmitter=require(_0xb48b('0x0'));var VoiceQueueReport=require(_0xb48b('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb48b('0x2')](0x0);var events={'afterCreate':_0xb48b('0x3'),'afterUpdate':'update','afterDestroy':_0xb48b('0x4')};function emitEvent(_0x574faa){return function(_0x17984e,_0x30fb4f,_0x4ffe7d){VoiceQueueReportEvents['emit'](_0x574faa+':'+_0x17984e['id'],_0x17984e);VoiceQueueReportEvents[_0xb48b('0x5')](_0x574faa,_0x17984e);_0x4ffe7d(null);};}for(var e in events){if(events[_0xb48b('0x6')](e)){var event=events[e];VoiceQueueReport[_0xb48b('0x7')](e,emitEvent(event));}}module[_0xb48b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x13bc=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3fb8d7,_0x2f721c){var _0x4b67e3=function(_0x568d94){while(--_0x568d94){_0x3fb8d7['push'](_0x3fb8d7['shift']());}};_0x4b67e3(++_0x2f721c);}(_0x13bc,0x1d4));var _0xc13b=function(_0x109126,_0x3d2a2a){_0x109126=_0x109126-0x0;var _0x369648=_0x13bc[_0x109126];return _0x369648;};'use strict';var EventEmitter=require(_0xc13b('0x0'));var VoiceQueueReport=require(_0xc13b('0x1'))['db'][_0xc13b('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc13b('0x3')](0x0);var events={'afterCreate':_0xc13b('0x4'),'afterUpdate':_0xc13b('0x5'),'afterDestroy':_0xc13b('0x6')};function emitEvent(_0x2e2d15){return function(_0x336f2b,_0x4b0ed3,_0x598b52){VoiceQueueReportEvents[_0xc13b('0x7')](_0x2e2d15+':'+_0x336f2b['id'],_0x336f2b);VoiceQueueReportEvents['emit'](_0x2e2d15,_0x336f2b);_0x598b52(null);};}for(var e in events){if(events[_0xc13b('0x8')](e)){var event=events[e];VoiceQueueReport[_0xc13b('0x9')](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 b79f08c..c89035f 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(_0x4e03ea,_0x273b2d){var _0x128412=function(_0x3143ca){while(--_0x3143ca){_0x4e03ea['push'](_0x4e03ea['shift']());}};_0x128412(++_0x273b2d);}(_0x757a,0xde));var _0xa757=function(_0x3a9f0f,_0x221b1f){_0x3a9f0f=_0x3a9f0f-0x0;var _0x284205=_0x757a[_0x3a9f0f];return _0x284205;};'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 _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x2032,0xd9));var _0x2203=function(_0x462070,_0x5bccf6){_0x462070=_0x462070-0x0;var _0x3f0781=_0x2032[_0x462070];return _0x3f0781;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 98dcd1c..ca902ea 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 _0x97b1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','lodash','util'];(function(_0x50da08,_0x273a62){var _0x653e9a=function(_0x356d99){while(--_0x356d99){_0x50da08['push'](_0x50da08['shift']());}};_0x653e9a(++_0x273a62);}(_0x97b1,0x147));var _0x197b=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x97b1[_0x3ff4a3];return _0x38676f;};'use strict';var _=require(_0x197b('0x0'));var util=require(_0x197b('0x1'));var moment=require(_0x197b('0x2'));var BPromise=require(_0x197b('0x3'));var rs=require(_0x197b('0x4'));var fs=require('fs');var Redis=require(_0x197b('0x5'));var db=require(_0x197b('0x6'))['db'];var utils=require(_0x197b('0x7'));var logger=require(_0x197b('0x8'))(_0x197b('0x9'));var config=require(_0x197b('0xa'));var jayson=require(_0x197b('0xb'));var client=jayson[_0x197b('0xc')][_0x197b('0xd')]({'port':0x232a});config['redis']=_[_0x197b('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x197b('0xf'))(new Redis(config[_0x197b('0x10')]));require(_0x197b('0x11'))[_0x197b('0x12')](socket);function respondWithRpcPromise(_0x1595c5,_0x253ebb,_0x50e9aa){return new BPromise(function(_0x9633c4,_0x32d304){return client[_0x197b('0x13')](_0x1595c5,_0x50e9aa)[_0x197b('0x14')](function(_0x1fdfa5){logger[_0x197b('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x253ebb,_0x197b('0x16'));logger[_0x197b('0x17')](_0x197b('0x18'),_0x253ebb,_0x197b('0x16'),JSON['stringify'](_0x1fdfa5));if(_0x1fdfa5[_0x197b('0x19')]){if(_0x1fdfa5[_0x197b('0x19')][_0x197b('0x1a')]===0x1f4){logger[_0x197b('0x19')](_0x197b('0x1b'),_0x253ebb,_0x1fdfa5[_0x197b('0x19')][_0x197b('0x1c')]);return _0x32d304(_0x1fdfa5[_0x197b('0x19')][_0x197b('0x1c')]);}logger[_0x197b('0x19')](_0x197b('0x1b'),_0x253ebb,_0x1fdfa5[_0x197b('0x19')][_0x197b('0x1c')]);return _0x9633c4(_0x1fdfa5[_0x197b('0x19')]['message']);}else{logger[_0x197b('0x15')](_0x197b('0x1b'),_0x253ebb,_0x197b('0x16'));_0x9633c4(_0x1fdfa5['result'][_0x197b('0x1c')]);}})[_0x197b('0x1d')](function(_0x13ef5b){logger[_0x197b('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x253ebb,_0x13ef5b);_0x32d304(_0x13ef5b);});});}exports[_0x197b('0x1e')]=function(_0x1d4bbf){var _0xa30af5=this;return new Promise(function(_0x5a1b6e,_0x26153c){return db[_0x197b('0x1f')][_0x197b('0x20')]({'raw':_0x1d4bbf['options']?_0x1d4bbf[_0x197b('0x21')][_0x197b('0x22')]===undefined?!![]:![]:!![],'where':_0x1d4bbf[_0x197b('0x21')]?_0x1d4bbf[_0x197b('0x21')]['where']||null:null,'attributes':_0x1d4bbf[_0x197b('0x21')]?_0x1d4bbf[_0x197b('0x21')][_0x197b('0x23')]||null:null,'limit':_0x1d4bbf[_0x197b('0x21')]?_0x1d4bbf[_0x197b('0x21')][_0x197b('0x24')]||null:null,'include':_0x1d4bbf['options']?_0x1d4bbf[_0x197b('0x21')][_0x197b('0x25')]?_[_0x197b('0x26')](_0x1d4bbf[_0x197b('0x21')]['include'],function(_0x237a32){return{'model':db[_0x237a32[_0x197b('0x27')]],'as':_0x237a32['as'],'attributes':_0x237a32[_0x197b('0x23')],'include':_0x237a32[_0x197b('0x25')]?_[_0x197b('0x26')](_0x237a32[_0x197b('0x25')],function(_0x50ada9){return{'model':db[_0x50ada9[_0x197b('0x27')]],'as':_0x50ada9['as'],'attributes':_0x50ada9[_0x197b('0x23')],'include':_0x50ada9[_0x197b('0x25')]?_[_0x197b('0x26')](_0x50ada9[_0x197b('0x25')],function(_0xbfda3c){return{'model':db[_0xbfda3c[_0x197b('0x27')]],'as':_0xbfda3c['as'],'attributes':_0xbfda3c[_0x197b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x197b('0x14')](function(_0x110079){logger['info'](_0x197b('0x1e'),_0x1d4bbf);logger[_0x197b('0x17')](_0x197b('0x1e'),_0x1d4bbf,JSON[_0x197b('0x28')](_0x110079));_0x5a1b6e(_0x110079);})['catch'](function(_0x2cc1b5){logger[_0x197b('0x19')](_0x197b('0x1e'),_0x2cc1b5[_0x197b('0x1c')],_0x1d4bbf);_0x26153c(_0xa30af5[_0x197b('0x19')](0x1f4,_0x2cc1b5[_0x197b('0x1c')]));});});};exports[_0x197b('0x29')]=function(_0x426c40){var _0x4240bd=this;return new Promise(function(_0x4aee6c,_0x2e4c9f){return db[_0x197b('0x1f')][_0x197b('0x2a')](_0x426c40[_0x197b('0x2b')],{'raw':_0x426c40[_0x197b('0x21')]?_0x426c40[_0x197b('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x197b('0x14')](function(_0x4d4264){logger[_0x197b('0x15')](_0x197b('0x29'),_0x426c40);logger['debug'](_0x197b('0x29'),_0x426c40,JSON[_0x197b('0x28')](_0x4d4264));_0x4aee6c(_0x4d4264);})['catch'](function(_0x206423){logger[_0x197b('0x19')](_0x197b('0x29'),_0x206423[_0x197b('0x1c')],_0x426c40);_0x2e4c9f(_0x4240bd['error'](0x1f4,_0x206423['message']));});});};exports[_0x197b('0x2c')]=function(_0x4b65ae){var _0x36eb7e=this;return new Promise(function(_0x467743,_0x56a3dd){return db[_0x197b('0x1f')][_0x197b('0x2d')](_0x4b65ae[_0x197b('0x2b')],{'raw':_0x4b65ae[_0x197b('0x21')]?_0x4b65ae[_0x197b('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b65ae[_0x197b('0x21')]?_0x4b65ae['options'][_0x197b('0x2e')]||null:null,'attributes':_0x4b65ae[_0x197b('0x21')]?_0x4b65ae[_0x197b('0x21')][_0x197b('0x23')]||null:null,'limit':_0x4b65ae[_0x197b('0x21')]?_0x4b65ae[_0x197b('0x21')][_0x197b('0x24')]||null:null})[_0x197b('0x14')](function(_0x4eca4e){logger[_0x197b('0x15')](_0x197b('0x2c'),_0x4b65ae);logger['debug']('UpdateVoiceQueueReport',_0x4b65ae,JSON[_0x197b('0x28')](_0x4eca4e));_0x467743(_0x4eca4e);})[_0x197b('0x1d')](function(_0x4e5888){logger[_0x197b('0x19')](_0x197b('0x2c'),_0x4e5888[_0x197b('0x1c')],_0x4b65ae);_0x56a3dd(_0x36eb7e[_0x197b('0x19')](0x1f4,_0x4e5888['message']));});});}; \ No newline at end of file +var _0xcd02=['model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','catch','options','raw','limit','include','map'];(function(_0x33fdf7,_0x151f90){var _0x3ac483=function(_0x31b535){while(--_0x31b535){_0x33fdf7['push'](_0x33fdf7['shift']());}};_0x3ac483(++_0x151f90);}(_0xcd02,0x1de));var _0x2cd0=function(_0x5022a3,_0x10828c){_0x5022a3=_0x5022a3-0x0;var _0x6c16cb=_0xcd02[_0x5022a3];return _0x6c16cb;};'use strict';var _=require('lodash');var util=require(_0x2cd0('0x0'));var moment=require(_0x2cd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cd0('0x2'))['db'];var utils=require(_0x2cd0('0x3'));var logger=require(_0x2cd0('0x4'))(_0x2cd0('0x5'));var config=require(_0x2cd0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2cd0('0x7')][_0x2cd0('0x8')]({'port':0x232a});config[_0x2cd0('0x9')]=_['defaults'](config[_0x2cd0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cd0('0xa'))(new Redis(config['redis']));require(_0x2cd0('0xb'))[_0x2cd0('0xc')](socket);function respondWithRpcPromise(_0x5494d7,_0x1471c6,_0xfded9d){return new BPromise(function(_0x66f995,_0x28c6fe){return client[_0x2cd0('0xd')](_0x5494d7,_0xfded9d)[_0x2cd0('0xe')](function(_0x4850d4){logger[_0x2cd0('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x1471c6,'request\x20sent');logger[_0x2cd0('0x10')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1471c6,_0x2cd0('0x11'),JSON[_0x2cd0('0x12')](_0x4850d4));if(_0x4850d4['error']){if(_0x4850d4[_0x2cd0('0x13')][_0x2cd0('0x14')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1471c6,_0x4850d4['error'][_0x2cd0('0x15')]);return _0x28c6fe(_0x4850d4[_0x2cd0('0x13')][_0x2cd0('0x15')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1471c6,_0x4850d4[_0x2cd0('0x13')][_0x2cd0('0x15')]);return _0x66f995(_0x4850d4[_0x2cd0('0x13')]['message']);}else{logger[_0x2cd0('0xf')](_0x2cd0('0x16'),_0x1471c6,_0x2cd0('0x11'));_0x66f995(_0x4850d4['result'][_0x2cd0('0x15')]);}})[_0x2cd0('0x17')](function(_0x21fe73){logger[_0x2cd0('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x1471c6,_0x21fe73);_0x28c6fe(_0x21fe73);});});}exports['GetVoiceQueueReport']=function(_0x215399){var _0x14c69b=this;return new Promise(function(_0x4fe2d3,_0x148539){return db['VoiceQueueReport']['findAll']({'raw':_0x215399[_0x2cd0('0x18')]?_0x215399[_0x2cd0('0x18')][_0x2cd0('0x19')]===undefined?!![]:![]:!![],'where':_0x215399['options']?_0x215399[_0x2cd0('0x18')]['where']||null:null,'attributes':_0x215399[_0x2cd0('0x18')]?_0x215399[_0x2cd0('0x18')]['attributes']||null:null,'limit':_0x215399[_0x2cd0('0x18')]?_0x215399['options'][_0x2cd0('0x1a')]||null:null,'include':_0x215399[_0x2cd0('0x18')]?_0x215399['options'][_0x2cd0('0x1b')]?_[_0x2cd0('0x1c')](_0x215399[_0x2cd0('0x18')]['include'],function(_0x119ae6){return{'model':db[_0x119ae6[_0x2cd0('0x1d')]],'as':_0x119ae6['as'],'attributes':_0x119ae6[_0x2cd0('0x1e')],'include':_0x119ae6['include']?_[_0x2cd0('0x1c')](_0x119ae6['include'],function(_0x242a32){return{'model':db[_0x242a32[_0x2cd0('0x1d')]],'as':_0x242a32['as'],'attributes':_0x242a32[_0x2cd0('0x1e')],'include':_0x242a32[_0x2cd0('0x1b')]?_[_0x2cd0('0x1c')](_0x242a32[_0x2cd0('0x1b')],function(_0x25e2db){return{'model':db[_0x25e2db[_0x2cd0('0x1d')]],'as':_0x25e2db['as'],'attributes':_0x25e2db['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12e5f8){logger[_0x2cd0('0xf')](_0x2cd0('0x1f'),_0x215399);logger[_0x2cd0('0x10')](_0x2cd0('0x1f'),_0x215399,JSON['stringify'](_0x12e5f8));_0x4fe2d3(_0x12e5f8);})[_0x2cd0('0x17')](function(_0x1f9c9c){logger[_0x2cd0('0x13')](_0x2cd0('0x1f'),_0x1f9c9c['message'],_0x215399);_0x148539(_0x14c69b[_0x2cd0('0x13')](0x1f4,_0x1f9c9c[_0x2cd0('0x15')]));});});};exports[_0x2cd0('0x20')]=function(_0x2b5f19){var _0x8dee5e=this;return new Promise(function(_0x39f60,_0x56d6d6){return db[_0x2cd0('0x21')][_0x2cd0('0x22')](_0x2b5f19[_0x2cd0('0x23')],{'raw':_0x2b5f19[_0x2cd0('0x18')]?_0x2b5f19['options'][_0x2cd0('0x19')]===undefined?!![]:![]:!![]})[_0x2cd0('0xe')](function(_0x1cd810){logger[_0x2cd0('0xf')](_0x2cd0('0x20'),_0x2b5f19);logger[_0x2cd0('0x10')](_0x2cd0('0x20'),_0x2b5f19,JSON['stringify'](_0x1cd810));_0x39f60(_0x1cd810);})[_0x2cd0('0x17')](function(_0x3675c5){logger[_0x2cd0('0x13')]('CreateVoiceQueueReport',_0x3675c5['message'],_0x2b5f19);_0x56d6d6(_0x8dee5e[_0x2cd0('0x13')](0x1f4,_0x3675c5[_0x2cd0('0x15')]));});});};exports[_0x2cd0('0x24')]=function(_0x1d8cbf){var _0x36c21f=this;return new Promise(function(_0x56e9cc,_0x31c494){return db[_0x2cd0('0x21')][_0x2cd0('0x25')](_0x1d8cbf['body'],{'raw':_0x1d8cbf[_0x2cd0('0x18')]?_0x1d8cbf[_0x2cd0('0x18')][_0x2cd0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d8cbf[_0x2cd0('0x18')]?_0x1d8cbf[_0x2cd0('0x18')][_0x2cd0('0x26')]||null:null,'attributes':_0x1d8cbf[_0x2cd0('0x18')]?_0x1d8cbf[_0x2cd0('0x18')][_0x2cd0('0x1e')]||null:null,'limit':_0x1d8cbf['options']?_0x1d8cbf[_0x2cd0('0x18')]['limit']||null:null})['then'](function(_0x332655){logger[_0x2cd0('0xf')](_0x2cd0('0x24'),_0x1d8cbf);logger[_0x2cd0('0x10')](_0x2cd0('0x24'),_0x1d8cbf,JSON[_0x2cd0('0x12')](_0x332655));_0x56e9cc(_0x332655);})[_0x2cd0('0x17')](function(_0x392793){logger['error']('UpdateVoiceQueueReport',_0x392793[_0x2cd0('0x15')],_0x1d8cbf);_0x31c494(_0x36c21f['error'](0x1f4,_0x392793[_0x2cd0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 231903e..ae1548f 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 _0xc4a6=['./voiceQueueReport.events','save','remove','removeListener','register','length','voiceQueueReport:'];(function(_0x3f7e8b,_0x7291d1){var _0x4eb892=function(_0x4ed54e){while(--_0x4ed54e){_0x3f7e8b['push'](_0x3f7e8b['shift']());}};_0x4eb892(++_0x7291d1);}(_0xc4a6,0x9a));var _0x6c4a=function(_0x57f74a,_0x3f8b13){_0x57f74a=_0x57f74a-0x0;var _0x15b677=_0xc4a6[_0x57f74a];return _0x15b677;};'use strict';var VoiceQueueReportEvents=require(_0x6c4a('0x0'));var events=[_0x6c4a('0x1'),_0x6c4a('0x2'),'update'];function createListener(_0x409347,_0xbb898){return function(_0x4f5837){_0xbb898['emit'](_0x409347,_0x4f5837);};}function removeListener(_0x1c06db,_0x351db7){return function(){VoiceQueueReportEvents[_0x6c4a('0x3')](_0x1c06db,_0x351db7);};}exports[_0x6c4a('0x4')]=function(_0x51a6a1){for(var _0x256840=0x0,_0xc91ac4=events[_0x6c4a('0x5')];_0x256840<_0xc91ac4;_0x256840++){var _0x2f0358=events[_0x256840];var _0x5221e9=createListener(_0x6c4a('0x6')+_0x2f0358,_0x51a6a1);VoiceQueueReportEvents['on'](_0x2f0358,_0x5221e9);}}; \ No newline at end of file +var _0x014c=['removeListener','register','length','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x014c,0x1bb));var _0xc014=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x014c[_0x52121d];return _0x448627;};'use strict';var VoiceQueueReportEvents=require(_0xc014('0x0'));var events=[_0xc014('0x1'),_0xc014('0x2'),_0xc014('0x3')];function createListener(_0xd6825f,_0xf4dbfa){return function(_0x39d03f){_0xf4dbfa[_0xc014('0x4')](_0xd6825f,_0x39d03f);};}function removeListener(_0x3fa5b2,_0x30fae1){return function(){VoiceQueueReportEvents[_0xc014('0x5')](_0x3fa5b2,_0x30fae1);};}exports[_0xc014('0x6')]=function(_0x47d427){for(var _0x266e11=0x0,_0x2ae530=events[_0xc014('0x7')];_0x266e11<_0x2ae530;_0x266e11++){var _0x1b7ab0=events[_0x266e11];var _0x187cc7=createListener('voiceQueueReport:'+_0x1b7ab0,_0x47d427);VoiceQueueReportEvents['on'](_0x1b7ab0,_0x187cc7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 087e22f..67fe9bf 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 _0x8a62=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8a62,0x130));var _0x28a6=function(_0x2326fe,_0xd6f6eb){_0x2326fe=_0x2326fe-0x0;var _0x4388f9=_0x8a62[_0x2326fe];return _0x4388f9;};'use strict';var multer=require(_0x28a6('0x0'));var util=require(_0x28a6('0x1'));var path=require('path');var timeout=require(_0x28a6('0x2'));var express=require(_0x28a6('0x3'));var router=express[_0x28a6('0x4')]();var auth=require(_0x28a6('0x5'));var interaction=require(_0x28a6('0x6'));var config=require(_0x28a6('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x28a6('0x8')]('/',auth[_0x28a6('0x9')](),controller[_0x28a6('0xa')]);router[_0x28a6('0x8')](_0x28a6('0xb'),auth[_0x28a6('0x9')](),controller[_0x28a6('0xc')]);router[_0x28a6('0xd')]('/',auth[_0x28a6('0x9')](),controller[_0x28a6('0xe')]);router[_0x28a6('0xf')](_0x28a6('0xb'),auth[_0x28a6('0x9')](),controller[_0x28a6('0x10')]);router['delete'](_0x28a6('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x28a6('0x11')]=router; \ No newline at end of file +var _0x74f3=['../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x74f3,0x164));var _0x374f=function(_0x26dec7,_0xb3ece){_0x26dec7=_0x26dec7-0x0;var _0x804167=_0x74f3[_0x26dec7];return _0x804167;};'use strict';var multer=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var path=require(_0x374f('0x2'));var timeout=require('connect-timeout');var express=require(_0x374f('0x3'));var router=express[_0x374f('0x4')]();var auth=require(_0x374f('0x5'));var interaction=require(_0x374f('0x6'));var config=require('../../config/environment');var controller=require(_0x374f('0x7'));router[_0x374f('0x8')]('/',auth['isAuthenticated'](),controller[_0x374f('0x9')]);router[_0x374f('0x8')](_0x374f('0xa'),auth[_0x374f('0xb')](),controller[_0x374f('0xc')]);router[_0x374f('0xd')]('/',auth[_0x374f('0xb')](),controller[_0x374f('0xe')]);router['put'](_0x374f('0xa'),auth[_0x374f('0xb')](),controller[_0x374f('0xf')]);router[_0x374f('0x10')](_0x374f('0xa'),auth['isAuthenticated'](),controller[_0x374f('0x11')]);module[_0x374f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e62aecc..1abf943 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 _0x4c97=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x530bbe,_0x34a3f){var _0x2b831d=function(_0x36fca9){while(--_0x36fca9){_0x530bbe['push'](_0x530bbe['shift']());}};_0x2b831d(++_0x34a3f);}(_0x4c97,0x1c7));var _0x74c9=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x4c97[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x74c9('0x0'));var moment=require(_0x74c9('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x74c9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x74c9('0x3')],'allowNull':![],'defaultValue':moment()[_0x74c9('0x4')](_0x74c9('0x5'))}}; \ No newline at end of file +var _0x39bc=['format','sequelize','moment','exports','STRING','DATE'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x39bc,0x169));var _0xc39b=function(_0x41b0bf,_0x4b6017){_0x41b0bf=_0x41b0bf-0x0;var _0x1868e4=_0x39bc[_0x41b0bf];return _0x1868e4;};'use strict';var Sequelize=require(_0xc39b('0x0'));var moment=require(_0xc39b('0x1'));module[_0xc39b('0x2')]={'time':{'type':Sequelize[_0xc39b('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc39b('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc39b('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc39b('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc39b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc39b('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc39b('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc39b('0x4')],'allowNull':![],'defaultValue':moment()[_0xc39b('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1416262..5aa629f 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 _0xabda=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse'];(function(_0xa0572c,_0x33616f){var _0x27d426=function(_0x5b659e){while(--_0x5b659e){_0xa0572c['push'](_0xa0572c['shift']());}};_0x27d426(++_0x33616f);}(_0xabda,0x145));var _0xaabd=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xabda[_0x548200];return _0x1a6d74;};'use strict';var pdf=require(_0xaabd('0x0'));var emlformat=require(_0xaabd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaabd('0x2'));var jsonpatch=require(_0xaabd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaabd('0x4'));var Mustache=require(_0xaabd('0x5'));var util=require(_0xaabd('0x6'));var path=require(_0xaabd('0x7'));var sox=require(_0xaabd('0x8'));var csv=require(_0xaabd('0x9'));var ejs=require(_0xaabd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaabd('0xb'));var jsforce=require(_0xaabd('0xc'));var deskjs=require(_0xaabd('0xd'));var toCsv=require(_0xaabd('0x9'));var querystring=require('querystring');var Papa=require(_0xaabd('0xe'));var Redis=require(_0xaabd('0xf'));var authService=require(_0xaabd('0x10'));var qs=require(_0xaabd('0x11'));var as=require(_0xaabd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaabd('0x13'));var config=require(_0xaabd('0x14'));var licenseUtil=require(_0xaabd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46326b,_0x1c575d){_0x1c575d=_0x1c575d||0xcc;return function(_0x50ce24){if(_0x50ce24){return _0x46326b['sendStatus'](_0x1c575d);}return _0x46326b[_0xaabd('0x16')](_0x1c575d)[_0xaabd('0x17')]();};}function respondWithResult(_0x19caed,_0x5b5096){_0x5b5096=_0x5b5096||0xc8;return function(_0x4088c7){if(_0x4088c7){return _0x19caed['status'](_0x5b5096)[_0xaabd('0x18')](_0x4088c7);}};}function respondWithFilteredResult(_0x1bbd6d,_0x2663a1){return function(_0x5e016c){if(_0x5e016c){var _0x15d1e2=_0x5e016c[_0xaabd('0x19')],_0x201dfa=_0x2663a1[_0xaabd('0x1a')],_0x4135c=_0x2663a1[_0xaabd('0x1a')]+_0x2663a1[_0xaabd('0x1b')],_0x343229;if(_0x4135c>=_0x15d1e2){_0x4135c=_0x15d1e2;_0x343229=0xc8;}else{_0x343229=0xce;}_0x1bbd6d[_0xaabd('0x16')](_0x343229);return _0x1bbd6d[_0xaabd('0x1c')](_0xaabd('0x1d'),_0x201dfa+'-'+_0x4135c+'/'+_0x15d1e2)[_0xaabd('0x18')](_0x5e016c);}return null;};}function patchUpdates(_0xcd4064){return function(_0x5a411d){try{jsonpatch[_0xaabd('0x1e')](_0x5a411d,_0xcd4064,!![]);}catch(_0x3ff000){return BPromise[_0xaabd('0x1f')](_0x3ff000);}return _0x5a411d[_0xaabd('0x20')]();};}function saveUpdates(_0x5becdd,_0x40ef4e){return function(_0x1de833){if(_0x1de833){return _0x1de833[_0xaabd('0x21')](_0x5becdd)[_0xaabd('0x22')](function(_0x1a6cf4){return _0x1a6cf4;});}return null;};}function removeEntity(_0x204088,_0x50a42b){return function(_0x48610a){if(_0x48610a){return _0x48610a[_0xaabd('0x23')]()[_0xaabd('0x22')](function(){_0x204088[_0xaabd('0x16')](0xcc)[_0xaabd('0x17')]();});}};}function handleEntityNotFound(_0x1cc274,_0x55f82c){return function(_0xc9e29e){if(!_0xc9e29e){_0x1cc274[_0xaabd('0x24')](0x194);}return _0xc9e29e;};}function handleError(_0x10ba9e,_0x244907){_0x244907=_0x244907||0x1f4;return function(_0x2e50c4){logger['error'](_0x2e50c4[_0xaabd('0x25')]);if(_0x2e50c4[_0xaabd('0x26')]){delete _0x2e50c4[_0xaabd('0x26')];}_0x10ba9e[_0xaabd('0x16')](_0x244907)[_0xaabd('0x27')](_0x2e50c4);};}exports[_0xaabd('0x28')]=function(_0x30e723,_0x2eded0){var _0x547628={},_0x43c5ab={},_0x1efb27={'count':0x0,'rows':[]};var _0x1dd67d=_[_0xaabd('0x29')](db[_0xaabd('0x2a')]['rawAttributes'],function(_0x7e7ad7){return{'name':_0x7e7ad7[_0xaabd('0x2b')],'type':_0x7e7ad7[_0xaabd('0x2c')]['key']};});_0x43c5ab[_0xaabd('0x2d')]=_[_0xaabd('0x29')](_0x1dd67d,_0xaabd('0x26'));_0x43c5ab[_0xaabd('0x2e')]=_[_0xaabd('0x2f')](_0x30e723[_0xaabd('0x2e')]);_0x43c5ab[_0xaabd('0x30')]=_[_0xaabd('0x31')](_0x43c5ab[_0xaabd('0x2d')],_0x43c5ab[_0xaabd('0x2e')]);_0x547628[_0xaabd('0x32')]=_['intersection'](_0x43c5ab[_0xaabd('0x2d')],qs['fields'](_0x30e723[_0xaabd('0x2e')][_0xaabd('0x33')]));_0x547628[_0xaabd('0x32')]=_0x547628[_0xaabd('0x32')][_0xaabd('0x34')]?_0x547628['attributes']:_0x43c5ab[_0xaabd('0x2d')];if(!_0x30e723[_0xaabd('0x2e')]['hasOwnProperty'](_0xaabd('0x35'))){_0x547628[_0xaabd('0x1b')]=qs[_0xaabd('0x1b')](_0x30e723[_0xaabd('0x2e')][_0xaabd('0x1b')]);_0x547628[_0xaabd('0x1a')]=qs[_0xaabd('0x1a')](_0x30e723['query'][_0xaabd('0x1a')]);}_0x547628['order']=qs[_0xaabd('0x36')](_0x30e723[_0xaabd('0x2e')][_0xaabd('0x36')]);_0x547628[_0xaabd('0x37')]=qs[_0xaabd('0x30')](_[_0xaabd('0x38')](_0x30e723[_0xaabd('0x2e')],_0x43c5ab[_0xaabd('0x30')]),_0x1dd67d);if(_0x30e723[_0xaabd('0x2e')]['filter']){_0x547628[_0xaabd('0x37')]=_[_0xaabd('0x39')](_0x547628['where'],{'$or':_[_0xaabd('0x29')](_0x1dd67d,function(_0x4ebe05){if(_0x4ebe05[_0xaabd('0x2c')]!=='VIRTUAL'){var _0x1b463f={};_0x1b463f[_0x4ebe05[_0xaabd('0x26')]]={'$like':'%'+_0x30e723[_0xaabd('0x2e')][_0xaabd('0x3a')]+'%'};return _0x1b463f;}})});}_0x547628=_['merge']({},_0x547628,_0x30e723[_0xaabd('0x3b')]);var _0x14501a={'where':_0x547628[_0xaabd('0x37')]};return db[_0xaabd('0x2a')][_0xaabd('0x19')](_0x14501a)['then'](function(_0x214b70){_0x1efb27[_0xaabd('0x19')]=_0x214b70;if(_0x30e723[_0xaabd('0x2e')][_0xaabd('0x3c')]){_0x547628[_0xaabd('0x3d')]=[{'all':!![]}];}return db[_0xaabd('0x2a')]['findAll'](_0x547628);})[_0xaabd('0x22')](function(_0xc6ff9d){_0x1efb27[_0xaabd('0x3e')]=_0xc6ff9d;return _0x1efb27;})[_0xaabd('0x22')](respondWithFilteredResult(_0x2eded0,_0x547628))[_0xaabd('0x3f')](handleError(_0x2eded0,null));};exports['show']=function(_0x4dedf1,_0xbc8be){var _0x1f9fff={'raw':!![],'where':{'id':_0x4dedf1[_0xaabd('0x40')]['id']}},_0x45f0e3={};_0x45f0e3[_0xaabd('0x2d')]=_['keys'](db[_0xaabd('0x2a')]['rawAttributes']);_0x45f0e3[_0xaabd('0x2e')]=_['keys'](_0x4dedf1[_0xaabd('0x2e')]);_0x45f0e3['filters']=_[_0xaabd('0x31')](_0x45f0e3['model'],_0x45f0e3[_0xaabd('0x2e')]);_0x1f9fff['attributes']=_[_0xaabd('0x31')](_0x45f0e3[_0xaabd('0x2d')],qs['fields'](_0x4dedf1[_0xaabd('0x2e')][_0xaabd('0x33')]));_0x1f9fff[_0xaabd('0x32')]=_0x1f9fff[_0xaabd('0x32')][_0xaabd('0x34')]?_0x1f9fff[_0xaabd('0x32')]:_0x45f0e3[_0xaabd('0x2d')];if(_0x4dedf1['query'][_0xaabd('0x3c')]){_0x1f9fff[_0xaabd('0x3d')]=[{'all':!![]}];}_0x1f9fff=_[_0xaabd('0x39')]({},_0x1f9fff,_0x4dedf1[_0xaabd('0x3b')]);return db[_0xaabd('0x2a')][_0xaabd('0x41')](_0x1f9fff)['then'](handleEntityNotFound(_0xbc8be,null))[_0xaabd('0x22')](respondWithResult(_0xbc8be,null))['catch'](handleError(_0xbc8be,null));};exports[_0xaabd('0x42')]=function(_0x113f0f,_0x36061a){return db[_0xaabd('0x2a')]['create'](_0x113f0f[_0xaabd('0x43')],{})[_0xaabd('0x22')](respondWithResult(_0x36061a,0xc9))['catch'](handleError(_0x36061a,null));};exports[_0xaabd('0x21')]=function(_0x2d7442,_0x1025a4){if(_0x2d7442[_0xaabd('0x43')]['id']){delete _0x2d7442[_0xaabd('0x43')]['id'];}return db[_0xaabd('0x2a')][_0xaabd('0x41')]({'where':{'id':_0x2d7442[_0xaabd('0x40')]['id']}})[_0xaabd('0x22')](handleEntityNotFound(_0x1025a4,null))['then'](saveUpdates(_0x2d7442['body'],null))[_0xaabd('0x22')](respondWithResult(_0x1025a4,null))['catch'](handleError(_0x1025a4,null));};exports['destroy']=function(_0x13c636,_0x42bc06){return db['VoiceQueuesLog'][_0xaabd('0x41')]({'where':{'id':_0x13c636[_0xaabd('0x40')]['id']}})[_0xaabd('0x22')](handleEntityNotFound(_0x42bc06,null))['then'](removeEntity(_0x42bc06,null))[_0xaabd('0x3f')](handleError(_0x42bc06,null));}; \ No newline at end of file +var _0x999c=['map','VoiceQueuesLog','fieldName','type','key','model','name','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','fields','find','create','update','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','then','error','stack','send'];(function(_0x20250b,_0x3d7258){var _0x22a1f8=function(_0x41c16d){while(--_0x41c16d){_0x20250b['push'](_0x20250b['shift']());}};_0x22a1f8(++_0x3d7258);}(_0x999c,0x14c));var _0xc999=function(_0x4f58db,_0x2804e0){_0x4f58db=_0x4f58db-0x0;var _0x18c3bc=_0x999c[_0x4f58db];return _0x18c3bc;};'use strict';var pdf=require(_0xc999('0x0'));var emlformat=require(_0xc999('0x1'));var rimraf=require(_0xc999('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc999('0x3'));var rp=require(_0xc999('0x4'));var moment=require('moment');var BPromise=require(_0xc999('0x5'));var Mustache=require('mustache');var util=require(_0xc999('0x6'));var path=require(_0xc999('0x7'));var sox=require('sox');var csv=require(_0xc999('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc999('0x9'));var squel=require(_0xc999('0xa'));var crypto=require('crypto');var jsforce=require(_0xc999('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc999('0x8'));var querystring=require(_0xc999('0xc'));var Papa=require('papaparse');var Redis=require(_0xc999('0xd'));var authService=require(_0xc999('0xe'));var qs=require(_0xc999('0xf'));var as=require(_0xc999('0x10'));var hardwareService=require(_0xc999('0x11'));var logger=require(_0xc999('0x12'))(_0xc999('0x13'));var utils=require(_0xc999('0x14'));var config=require(_0xc999('0x15'));var licenseUtil=require(_0xc999('0x16'));var db=require(_0xc999('0x17'))['db'];function respondWithStatusCode(_0x5e1dd0,_0x56eafd){_0x56eafd=_0x56eafd||0xcc;return function(_0x35cf48){if(_0x35cf48){return _0x5e1dd0[_0xc999('0x18')](_0x56eafd);}return _0x5e1dd0[_0xc999('0x19')](_0x56eafd)[_0xc999('0x1a')]();};}function respondWithResult(_0x205d8f,_0x56bb59){_0x56bb59=_0x56bb59||0xc8;return function(_0x48328d){if(_0x48328d){return _0x205d8f[_0xc999('0x19')](_0x56bb59)['json'](_0x48328d);}};}function respondWithFilteredResult(_0x158d09,_0x3ad610){return function(_0x584c1e){if(_0x584c1e){var _0x2681c6=_0x584c1e['count'],_0x59894b=_0x3ad610[_0xc999('0x1b')],_0x29de26=_0x3ad610['offset']+_0x3ad610[_0xc999('0x1c')],_0xbc9b43;if(_0x29de26>=_0x2681c6){_0x29de26=_0x2681c6;_0xbc9b43=0xc8;}else{_0xbc9b43=0xce;}_0x158d09['status'](_0xbc9b43);return _0x158d09[_0xc999('0x1d')](_0xc999('0x1e'),_0x59894b+'-'+_0x29de26+'/'+_0x2681c6)[_0xc999('0x1f')](_0x584c1e);}return null;};}function patchUpdates(_0x2c71e7){return function(_0x1ec64a){try{jsonpatch[_0xc999('0x20')](_0x1ec64a,_0x2c71e7,!![]);}catch(_0x3155b2){return BPromise[_0xc999('0x21')](_0x3155b2);}return _0x1ec64a['save']();};}function saveUpdates(_0x46c371,_0x2f5fea){return function(_0x30e92a){if(_0x30e92a){return _0x30e92a['update'](_0x46c371)[_0xc999('0x22')](function(_0x57ba3f){return _0x57ba3f;});}return null;};}function removeEntity(_0x287609,_0x30c9d5){return function(_0x47a632){if(_0x47a632){return _0x47a632['destroy']()['then'](function(){_0x287609[_0xc999('0x19')](0xcc)[_0xc999('0x1a')]();});}};}function handleEntityNotFound(_0x5e7a27,_0x127c3f){return function(_0x185ba1){if(!_0x185ba1){_0x5e7a27[_0xc999('0x18')](0x194);}return _0x185ba1;};}function handleError(_0x2756e9,_0xaa2a8c){_0xaa2a8c=_0xaa2a8c||0x1f4;return function(_0x1c1811){logger[_0xc999('0x23')](_0x1c1811[_0xc999('0x24')]);if(_0x1c1811['name']){delete _0x1c1811['name'];}_0x2756e9[_0xc999('0x19')](_0xaa2a8c)[_0xc999('0x25')](_0x1c1811);};}exports['index']=function(_0x2fcfa3,_0x39327e){var _0x2ff8f1={},_0x588ec7={},_0x5f4601={'count':0x0,'rows':[]};var _0x198ac7=_[_0xc999('0x26')](db[_0xc999('0x27')]['rawAttributes'],function(_0x4eb064){return{'name':_0x4eb064[_0xc999('0x28')],'type':_0x4eb064[_0xc999('0x29')][_0xc999('0x2a')]};});_0x588ec7[_0xc999('0x2b')]=_[_0xc999('0x26')](_0x198ac7,_0xc999('0x2c'));_0x588ec7[_0xc999('0x2d')]=_['keys'](_0x2fcfa3['query']);_0x588ec7[_0xc999('0x2e')]=_[_0xc999('0x2f')](_0x588ec7[_0xc999('0x2b')],_0x588ec7[_0xc999('0x2d')]);_0x2ff8f1[_0xc999('0x30')]=_[_0xc999('0x2f')](_0x588ec7[_0xc999('0x2b')],qs['fields'](_0x2fcfa3['query']['fields']));_0x2ff8f1[_0xc999('0x30')]=_0x2ff8f1[_0xc999('0x30')][_0xc999('0x31')]?_0x2ff8f1[_0xc999('0x30')]:_0x588ec7['model'];if(!_0x2fcfa3[_0xc999('0x2d')][_0xc999('0x32')](_0xc999('0x33'))){_0x2ff8f1[_0xc999('0x1c')]=qs[_0xc999('0x1c')](_0x2fcfa3[_0xc999('0x2d')]['limit']);_0x2ff8f1[_0xc999('0x1b')]=qs['offset'](_0x2fcfa3['query']['offset']);}_0x2ff8f1['order']=qs[_0xc999('0x34')](_0x2fcfa3[_0xc999('0x2d')][_0xc999('0x34')]);_0x2ff8f1[_0xc999('0x35')]=qs[_0xc999('0x2e')](_[_0xc999('0x36')](_0x2fcfa3[_0xc999('0x2d')],_0x588ec7[_0xc999('0x2e')]),_0x198ac7);if(_0x2fcfa3[_0xc999('0x2d')][_0xc999('0x37')]){_0x2ff8f1['where']=_[_0xc999('0x38')](_0x2ff8f1[_0xc999('0x35')],{'$or':_[_0xc999('0x26')](_0x198ac7,function(_0x1f21ed){if(_0x1f21ed['type']!==_0xc999('0x39')){var _0x41d7f7={};_0x41d7f7[_0x1f21ed[_0xc999('0x2c')]]={'$like':'%'+_0x2fcfa3[_0xc999('0x2d')][_0xc999('0x37')]+'%'};return _0x41d7f7;}})});}_0x2ff8f1=_[_0xc999('0x38')]({},_0x2ff8f1,_0x2fcfa3[_0xc999('0x3a')]);var _0x4b3f24={'where':_0x2ff8f1['where']};return db[_0xc999('0x27')][_0xc999('0x3b')](_0x4b3f24)['then'](function(_0x56c3f5){_0x5f4601['count']=_0x56c3f5;if(_0x2fcfa3[_0xc999('0x2d')][_0xc999('0x3c')]){_0x2ff8f1[_0xc999('0x3d')]=[{'all':!![]}];}return db[_0xc999('0x27')][_0xc999('0x3e')](_0x2ff8f1);})[_0xc999('0x22')](function(_0x49f907){_0x5f4601[_0xc999('0x3f')]=_0x49f907;return _0x5f4601;})['then'](respondWithFilteredResult(_0x39327e,_0x2ff8f1))[_0xc999('0x40')](handleError(_0x39327e,null));};exports['show']=function(_0x58ab6a,_0x34eb67){var _0x7b16a5={'raw':!![],'where':{'id':_0x58ab6a[_0xc999('0x41')]['id']}},_0x5babf1={};_0x5babf1[_0xc999('0x2b')]=_[_0xc999('0x42')](db['VoiceQueuesLog'][_0xc999('0x43')]);_0x5babf1[_0xc999('0x2d')]=_[_0xc999('0x42')](_0x58ab6a['query']);_0x5babf1[_0xc999('0x2e')]=_[_0xc999('0x2f')](_0x5babf1[_0xc999('0x2b')],_0x5babf1[_0xc999('0x2d')]);_0x7b16a5[_0xc999('0x30')]=_[_0xc999('0x2f')](_0x5babf1['model'],qs[_0xc999('0x44')](_0x58ab6a[_0xc999('0x2d')][_0xc999('0x44')]));_0x7b16a5[_0xc999('0x30')]=_0x7b16a5['attributes'][_0xc999('0x31')]?_0x7b16a5[_0xc999('0x30')]:_0x5babf1[_0xc999('0x2b')];if(_0x58ab6a[_0xc999('0x2d')]['includeAll']){_0x7b16a5[_0xc999('0x3d')]=[{'all':!![]}];}_0x7b16a5=_['merge']({},_0x7b16a5,_0x58ab6a['options']);return db[_0xc999('0x27')][_0xc999('0x45')](_0x7b16a5)['then'](handleEntityNotFound(_0x34eb67,null))[_0xc999('0x22')](respondWithResult(_0x34eb67,null))['catch'](handleError(_0x34eb67,null));};exports[_0xc999('0x46')]=function(_0x7b9215,_0x47145d){return db[_0xc999('0x27')][_0xc999('0x46')](_0x7b9215['body'],{})[_0xc999('0x22')](respondWithResult(_0x47145d,0xc9))[_0xc999('0x40')](handleError(_0x47145d,null));};exports[_0xc999('0x47')]=function(_0x5e980b,_0x2c1cea){if(_0x5e980b[_0xc999('0x48')]['id']){delete _0x5e980b[_0xc999('0x48')]['id'];}return db['VoiceQueuesLog'][_0xc999('0x45')]({'where':{'id':_0x5e980b[_0xc999('0x41')]['id']}})[_0xc999('0x22')](handleEntityNotFound(_0x2c1cea,null))[_0xc999('0x22')](saveUpdates(_0x5e980b[_0xc999('0x48')],null))[_0xc999('0x22')](respondWithResult(_0x2c1cea,null))[_0xc999('0x40')](handleError(_0x2c1cea,null));};exports[_0xc999('0x49')]=function(_0x302eb0,_0x46c7f5){return db[_0xc999('0x27')][_0xc999('0x45')]({'where':{'id':_0x302eb0['params']['id']}})[_0xc999('0x22')](handleEntityNotFound(_0x46c7f5,null))[_0xc999('0x22')](removeEntity(_0x46c7f5,null))[_0xc999('0x40')](handleError(_0x46c7f5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7d5f1a7..e6c8cf3 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 _0x5aa3=['event_dtm','dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x188d55,_0x204207){var _0x56961a=function(_0x3a8ffc){while(--_0x3a8ffc){_0x188d55['push'](_0x188d55['shift']());}};_0x56961a(++_0x204207);}(_0x5aa3,0x1f1));var _0x35aa=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5aa3[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x35aa('0x0'));var util=require('util');var logger=require(_0x35aa('0x1'))('api');var moment=require(_0x35aa('0x2'));var BPromise=require(_0x35aa('0x3'));var rp=require(_0x35aa('0x4'));var fs=require('fs');var path=require(_0x35aa('0x5'));var rimraf=require(_0x35aa('0x6'));var config=require(_0x35aa('0x7'));var attributes=require(_0x35aa('0x8'));module[_0x35aa('0x9')]=function(_0x13f0d6,_0x2d83bd){return _0x13f0d6[_0x35aa('0xa')](_0x35aa('0xb'),attributes,{'tableName':_0x35aa('0xc'),'paranoid':![],'indexes':[{'name':_0x35aa('0xd'),'fields':['event',_0x35aa('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4d53=['exports','define','VoiceQueuesLog','voice_queues_log','event','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2ae85f,_0x5b15d7){var _0x15d6c5=function(_0x54e09f){while(--_0x54e09f){_0x2ae85f['push'](_0x2ae85f['shift']());}};_0x15d6c5(++_0x5b15d7);}(_0x4d53,0x170));var _0x34d5=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4d53[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x34d5('0x0'));var util=require(_0x34d5('0x1'));var logger=require(_0x34d5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34d5('0x3'));var rp=require(_0x34d5('0x4'));var fs=require('fs');var path=require(_0x34d5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x34d5('0x6')]=function(_0x3254a9,_0x41d488){return _0x3254a9[_0x34d5('0x7')](_0x34d5('0x8'),attributes,{'tableName':_0x34d5('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x34d5('0xa'),'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 991e156..851748c 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 _0xeffd=['stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x1f5d42,_0x5bbf9a){var _0x1cc0a7=function(_0x18cf1e){while(--_0x18cf1e){_0x1f5d42['push'](_0x1f5d42['shift']());}};_0x1cc0a7(++_0x5bbf9a);}(_0xeffd,0x6b));var _0xdeff=function(_0x4f39be,_0x5cf6a6){_0x4f39be=_0x4f39be-0x0;var _0x4aa68b=_0xeffd[_0x4f39be];return _0x4aa68b;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});} \ No newline at end of file +var _0x4af8=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x79f195,_0x192e85){var _0x12b4e7=function(_0x4485ca){while(--_0x4485ca){_0x79f195['push'](_0x79f195['shift']());}};_0x12b4e7(++_0x192e85);}(_0x4af8,0x1ad));var _0x84af=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x4af8[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 5f56a8f..92cabf9 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 _0xd094=['index','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated'];(function(_0x3dacdc,_0x571892){var _0x449126=function(_0x18ab10){while(--_0x18ab10){_0x3dacdc['push'](_0x3dacdc['shift']());}};_0x449126(++_0x571892);}(_0xd094,0x100));var _0x4d09=function(_0x4ea4f7,_0x18b2af){_0x4ea4f7=_0x4ea4f7-0x0;var _0xde3fda=_0xd094[_0x4ea4f7];return _0xde3fda;};'use strict';var multer=require('multer');var util=require(_0x4d09('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d09('0x1'));var router=express['Router']();var auth=require(_0x4d09('0x2'));var interaction=require(_0x4d09('0x3'));var config=require(_0x4d09('0x4'));var controller=require(_0x4d09('0x5'));router[_0x4d09('0x6')]('/',auth[_0x4d09('0x7')](),controller[_0x4d09('0x8')]);router['get'](_0x4d09('0x9'),auth[_0x4d09('0x7')](),controller['describe']);router[_0x4d09('0x6')](_0x4d09('0xa'),auth[_0x4d09('0x7')](),controller[_0x4d09('0xb')]);router[_0x4d09('0x6')](_0x4d09('0xc'),auth[_0x4d09('0x7')](),controller[_0x4d09('0xd')]);router[_0x4d09('0x6')](_0x4d09('0xe'),controller[_0x4d09('0xf')]);router['get'](_0x4d09('0x10'),auth[_0x4d09('0x7')](),controller['downloadTranscribe']);router[_0x4d09('0x11')]('/',auth[_0x4d09('0x7')](),controller[_0x4d09('0x12')]);router['post'](_0x4d09('0x10'),auth[_0x4d09('0x7')](),controller[_0x4d09('0x13')]);router[_0x4d09('0x14')](_0x4d09('0xa'),auth[_0x4d09('0x7')](),controller['update']);router[_0x4d09('0x15')](_0x4d09('0xa'),auth[_0x4d09('0x7')](),controller[_0x4d09('0x16')]);module[_0x4d09('0x17')]=router; \ No newline at end of file +var _0x9cd6=['post','runTranscribe','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','download','downloads','/:id/transcribe','downloadTranscribe'];(function(_0x195fa5,_0x2fefc9){var _0x3f18ad=function(_0x4a3c3b){while(--_0x4a3c3b){_0x195fa5['push'](_0x195fa5['shift']());}};_0x3f18ad(++_0x2fefc9);}(_0x9cd6,0xbf));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x69cd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x69cd('0x1'));var express=require('express');var router=express[_0x69cd('0x2')]();var auth=require(_0x69cd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x69cd('0x4'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x69cd('0x5')](),controller[_0x69cd('0x6')]);router['get'](_0x69cd('0x7'),auth[_0x69cd('0x5')](),controller[_0x69cd('0x8')]);router[_0x69cd('0x9')](_0x69cd('0xa'),auth[_0x69cd('0x5')](),controller[_0x69cd('0xb')]);router[_0x69cd('0x9')]('/:id/download',auth[_0x69cd('0x5')](),controller[_0x69cd('0xc')]);router[_0x69cd('0x9')]('/:id/downloads',controller[_0x69cd('0xd')]);router[_0x69cd('0x9')](_0x69cd('0xe'),auth[_0x69cd('0x5')](),controller[_0x69cd('0xf')]);router[_0x69cd('0x10')]('/',auth[_0x69cd('0x5')](),controller['create']);router[_0x69cd('0x10')]('/:id/transcribe',auth[_0x69cd('0x5')](),controller[_0x69cd('0x11')]);router[_0x69cd('0x12')](_0x69cd('0xa'),auth['isAuthenticated'](),controller[_0x69cd('0x13')]);router[_0x69cd('0x14')](_0x69cd('0xa'),auth[_0x69cd('0x5')](),controller[_0x69cd('0x15')]);module[_0x69cd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4699a07..fcba45a 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 _0xb12f=['format','toString','sequelize','moment','exports','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','FLOAT','createdAt'];(function(_0x3846d3,_0x392fc4){var _0x5840a7=function(_0x1e17d5){while(--_0x1e17d5){_0x3846d3['push'](_0x3846d3['shift']());}};_0x5840a7(++_0x392fc4);}(_0xb12f,0x1ab));var _0xfb12=function(_0x53e359,_0x27a8ab){_0x53e359=_0x53e359-0x0;var _0xd875cd=_0xb12f[_0x53e359];return _0xd875cd;};'use strict';var Sequelize=require(_0xfb12('0x0'));var moment=require(_0xfb12('0x1'));var path=require('path');module[_0xfb12('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfb12('0x3')](_0xfb12('0x4'))?path[_0xfb12('0x5')](this[_0xfb12('0x3')](_0xfb12('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0xfb12('0x6')]},'channel':{'type':Sequelize[_0xfb12('0x6')],'set':function(_0x1f8adc){if(_0x1f8adc){this[_0xfb12('0x7')](_0xfb12('0x8'),_0x1f8adc);this[_0xfb12('0x7')](_0xfb12('0x9'),_0x1f8adc[_0xfb12('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xfb12('0x6')]},'calleridnum':{'type':Sequelize[_0xfb12('0x6')]},'calleridname':{'type':Sequelize[_0xfb12('0x6')]},'connectedlinenum':{'type':Sequelize[_0xfb12('0x6')]},'connectedlinename':{'type':Sequelize[_0xfb12('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfb12('0x6')]},'exten':{'type':Sequelize[_0xfb12('0x6')]},'value':{'type':Sequelize[_0xfb12('0x6')]},'type':{'type':Sequelize[_0xfb12('0x6')]},'rating':{'type':Sequelize[_0xfb12('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xfb12('0x6')]},'userDisposition':{'type':Sequelize[_0xfb12('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xfb12('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xfb12('0x6')]},'location':{'type':Sequelize[_0xfb12('0xc')]},'transcribeName':{'type':Sequelize[_0xfb12('0x6')]},'transcribeStatus':{'type':Sequelize[_0xfb12('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xfb12('0xc')]},'failureReason':{'type':Sequelize[_0xfb12('0xc')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xfb12('0xd')]},'sNegative':{'type':Sequelize[_0xfb12('0xd')]},'sNeutral':{'type':Sequelize[_0xfb12('0xd')]},'sMixed':{'type':Sequelize[_0xfb12('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xfb12('0x3')](_0xfb12('0xe')))[_0xfb12('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xfb12('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x19c6=['BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','INTEGER','TEXT','NEW','FLOAT'];(function(_0xa48141,_0x2ebee1){var _0x59cc10=function(_0x1652a8){while(--_0x1652a8){_0xa48141['push'](_0xa48141['shift']());}};_0x59cc10(++_0x2ebee1);}(_0x19c6,0xd8));var _0x619c=function(_0x3240d0,_0x45c298){_0x3240d0=_0x3240d0-0x0;var _0x216eac=_0x19c6[_0x3240d0];return _0x216eac;};'use strict';var Sequelize=require(_0x619c('0x0'));var moment=require(_0x619c('0x1'));var path=require(_0x619c('0x2'));module['exports']={'format':{'type':Sequelize[_0x619c('0x3')],'get':function(){return this[_0x619c('0x4')](_0x619c('0x5'))?path[_0x619c('0x6')](this['getDataValue'](_0x619c('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x619c('0x7')]},'channel':{'type':Sequelize[_0x619c('0x7')],'set':function(_0x409f92){if(_0x409f92){this[_0x619c('0x8')](_0x619c('0x9'),_0x409f92);this['setDataValue'](_0x619c('0xa'),_0x409f92['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x619c('0x7')]},'calleridnum':{'type':Sequelize[_0x619c('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x619c('0x7')]},'connectedlinename':{'type':Sequelize[_0x619c('0x7')]},'accountcode':{'type':Sequelize[_0x619c('0x7')]},'context':{'type':Sequelize[_0x619c('0x7')]},'exten':{'type':Sequelize[_0x619c('0x7')]},'value':{'type':Sequelize[_0x619c('0x7')]},'type':{'type':Sequelize[_0x619c('0x7')]},'rating':{'type':Sequelize[_0x619c('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x619c('0x7')]},'userDisposition':{'type':Sequelize[_0x619c('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x619c('0xc')]},'transcribeName':{'type':Sequelize[_0x619c('0x7')]},'transcribeStatus':{'type':Sequelize[_0x619c('0x7')],'defaultValue':_0x619c('0xd')},'fileUri':{'type':Sequelize[_0x619c('0xc')]},'fileText':{'type':Sequelize[_0x619c('0xc')]},'failureReason':{'type':Sequelize[_0x619c('0xc')]},'sentiment':{'type':Sequelize[_0x619c('0x7')]},'sPositive':{'type':Sequelize[_0x619c('0xe')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x619c('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x619c('0x10')],'get':function(){return moment(this[_0x619c('0x4')](_0x619c('0x11')))[_0x619c('0x12')](_0x619c('0x13'))[_0x619c('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x619c('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x619c('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 150d2a8..75027f5 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 _0xb470=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','VoiceRecording','rawAttributes','fieldName','key','format','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','describe','download','type','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x200548,_0x52603d){var _0x50970b=function(_0x3e761d){while(--_0x3e761d){_0x200548['push'](_0x200548['shift']());}};_0x50970b(++_0x52603d);}(_0xb470,0x11f));var _0x0b47=function(_0x428f29,_0x17afca){_0x428f29=_0x428f29-0x0;var _0x85db0=_0xb470[_0x428f29];return _0x85db0;};'use strict';var pdf=require(_0x0b47('0x0'));var emlformat=require(_0x0b47('0x1'));var rimraf=require(_0x0b47('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b47('0x3'));var rp=require(_0x0b47('0x4'));var moment=require(_0x0b47('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0b47('0x6'));var util=require(_0x0b47('0x7'));var path=require(_0x0b47('0x8'));var sox=require(_0x0b47('0x9'));var csv=require('to-csv');var ejs=require(_0x0b47('0xa'));var fs=require('fs');var _=require(_0x0b47('0xb'));var squel=require(_0x0b47('0xc'));var crypto=require(_0x0b47('0xd'));var jsforce=require(_0x0b47('0xe'));var deskjs=require(_0x0b47('0xf'));var toCsv=require(_0x0b47('0x10'));var querystring=require(_0x0b47('0x11'));var Papa=require(_0x0b47('0x12'));var AWS=require(_0x0b47('0x13'));var uuidv4=require(_0x0b47('0x14'));var Redis=require(_0x0b47('0x15'));var authService=require(_0x0b47('0x16'));var qs=require(_0x0b47('0x17'));var as=require(_0x0b47('0x18'));var hardwareService=require(_0x0b47('0x19'));var logger=require(_0x0b47('0x1a'))(_0x0b47('0x1b'));var utils=require(_0x0b47('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0x0b47('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4115ec,_0x1a8ecb){_0x1a8ecb=_0x1a8ecb||0xcc;return function(_0x541ada){if(_0x541ada){return _0x4115ec['sendStatus'](_0x1a8ecb);}return _0x4115ec[_0x0b47('0x1e')](_0x1a8ecb)[_0x0b47('0x1f')]();};}function respondWithResult(_0x28af2d,_0x1155bf){_0x1155bf=_0x1155bf||0xc8;return function(_0x3eabc0){if(_0x3eabc0){return _0x28af2d['status'](_0x1155bf)[_0x0b47('0x20')](_0x3eabc0);}};}function respondWithFilteredResult(_0x2fee75,_0x90023b){return function(_0x3b4f6d){if(_0x3b4f6d){var _0x1b32b8=_0x3b4f6d['count'],_0x4ce69e=_0x90023b[_0x0b47('0x21')],_0x1235e9=_0x90023b[_0x0b47('0x21')]+_0x90023b[_0x0b47('0x22')],_0x550a13;if(_0x1235e9>=_0x1b32b8){_0x1235e9=_0x1b32b8;_0x550a13=0xc8;}else{_0x550a13=0xce;}_0x2fee75[_0x0b47('0x1e')](_0x550a13);return _0x2fee75[_0x0b47('0x23')](_0x0b47('0x24'),_0x4ce69e+'-'+_0x1235e9+'/'+_0x1b32b8)['json'](_0x3b4f6d);}return null;};}function patchUpdates(_0x3c4b65){return function(_0x535473){try{jsonpatch[_0x0b47('0x25')](_0x535473,_0x3c4b65,!![]);}catch(_0x32ff3e){return BPromise[_0x0b47('0x26')](_0x32ff3e);}return _0x535473[_0x0b47('0x27')]();};}function saveUpdates(_0x490508,_0x438bb8){return function(_0x10a80){if(_0x10a80){return _0x10a80['update'](_0x490508)[_0x0b47('0x28')](function(_0x43ce63){return _0x43ce63;});}return null;};}function removeEntity(_0x3b6507,_0x18298d){return function(_0x52d608){if(_0x52d608){return _0x52d608[_0x0b47('0x29')]()[_0x0b47('0x28')](function(){_0x3b6507[_0x0b47('0x1e')](0xcc)[_0x0b47('0x1f')]();});}};}function handleEntityNotFound(_0x40bb65,_0x379697){return function(_0x25f10b){if(!_0x25f10b){_0x40bb65[_0x0b47('0x2a')](0x194);}return _0x25f10b;};}function handleError(_0x2f1674,_0x616e88){_0x616e88=_0x616e88||0x1f4;return function(_0x6fd7e7){logger[_0x0b47('0x2b')](_0x6fd7e7[_0x0b47('0x2c')]);if(_0x6fd7e7[_0x0b47('0x2d')]){delete _0x6fd7e7['name'];}_0x2f1674[_0x0b47('0x1e')](_0x616e88)['send'](_0x6fd7e7);};}exports['index']=function(_0x39ec5d,_0x1dd656){var _0x396b80={},_0x58db51={},_0x3fa7aa={'count':0x0,'rows':[]};var _0x58a71e=_[_0x0b47('0x2e')](db[_0x0b47('0x2f')][_0x0b47('0x30')],function(_0x3b75a2){return{'name':_0x3b75a2[_0x0b47('0x31')],'type':_0x3b75a2['type'][_0x0b47('0x32')]};});_0x58db51['model']=_['differenceBy'](_[_0x0b47('0x2e')](_0x58a71e,_0x0b47('0x2d')),[_0x0b47('0x33')]);_0x58db51['query']=_[_0x0b47('0x34')](_0x39ec5d[_0x0b47('0x35')]);_0x58db51['filters']=_[_0x0b47('0x36')](_0x58db51['model'],_0x58db51['query']);_0x396b80['attributes']=_[_0x0b47('0x36')](_0x58db51[_0x0b47('0x37')],qs[_0x0b47('0x38')](_0x39ec5d['query'][_0x0b47('0x38')]));_0x396b80[_0x0b47('0x39')]=_0x396b80[_0x0b47('0x39')]['length']?_0x396b80['attributes']:_0x58db51[_0x0b47('0x37')];if(!_0x39ec5d[_0x0b47('0x35')][_0x0b47('0x3a')](_0x0b47('0x3b'))){_0x396b80['limit']=qs['limit'](_0x39ec5d[_0x0b47('0x35')]['limit']);_0x396b80[_0x0b47('0x21')]=qs[_0x0b47('0x21')](_0x39ec5d[_0x0b47('0x35')][_0x0b47('0x21')]);}_0x396b80['order']=qs['sort'](_0x39ec5d[_0x0b47('0x35')][_0x0b47('0x3c')]);_0x396b80[_0x0b47('0x3d')]=qs[_0x0b47('0x3e')](_['pick'](_0x39ec5d[_0x0b47('0x35')],_0x58db51[_0x0b47('0x3e')]),_0x58a71e);if(_0x39ec5d['query'][_0x0b47('0x3f')]){_0x396b80[_0x0b47('0x3d')]=_[_0x0b47('0x40')](_0x396b80['where'],{'$or':_[_0x0b47('0x2e')](_0x58a71e,function(_0x5154d4){if(_0x5154d4['type']!==_0x0b47('0x41')){var _0x5e3139={};_0x5e3139[_0x5154d4[_0x0b47('0x2d')]]={'$like':'%'+_0x39ec5d[_0x0b47('0x35')]['filter']+'%'};return _0x5e3139;}})});}_0x396b80=_[_0x0b47('0x40')]({},_0x396b80,_0x39ec5d[_0x0b47('0x42')]);var _0xb321c8={'where':_0x396b80[_0x0b47('0x3d')]};return db[_0x0b47('0x2f')][_0x0b47('0x43')](_0xb321c8)[_0x0b47('0x28')](function(_0x48cbe2){_0x3fa7aa[_0x0b47('0x43')]=_0x48cbe2;if(_0x39ec5d['query'][_0x0b47('0x44')]){_0x396b80[_0x0b47('0x45')]=[{'all':!![]}];}return db[_0x0b47('0x2f')]['findAll'](_0x396b80);})[_0x0b47('0x28')](function(_0x159bde){_0x3fa7aa['rows']=_0x159bde;return _0x3fa7aa;})['then'](respondWithFilteredResult(_0x1dd656,_0x396b80))[_0x0b47('0x46')](handleError(_0x1dd656,null));};exports[_0x0b47('0x47')]=function(_0x3f75c4,_0x32ee29){var _0x239138={'raw':![],'where':{'id':_0x3f75c4[_0x0b47('0x48')]['id']}},_0x1a7699={};_0x1a7699['model']=_['keys'](db[_0x0b47('0x2f')]['rawAttributes']);_0x1a7699[_0x0b47('0x35')]=_[_0x0b47('0x34')](_0x3f75c4['query']);_0x1a7699[_0x0b47('0x3e')]=_[_0x0b47('0x36')](_0x1a7699[_0x0b47('0x37')],_0x1a7699[_0x0b47('0x35')]);_0x239138[_0x0b47('0x39')]=_[_0x0b47('0x36')](_0x1a7699[_0x0b47('0x37')],qs['fields'](_0x3f75c4[_0x0b47('0x35')][_0x0b47('0x38')]));_0x239138['attributes']=_0x239138['attributes']['length']?_0x239138['attributes']:_0x1a7699[_0x0b47('0x37')];if(_0x3f75c4[_0x0b47('0x35')][_0x0b47('0x44')]){_0x239138[_0x0b47('0x45')]=[{'all':!![]}];}_0x239138=_[_0x0b47('0x40')]({},_0x239138,_0x3f75c4[_0x0b47('0x42')]);return db[_0x0b47('0x2f')][_0x0b47('0x49')](_0x239138)['then'](handleEntityNotFound(_0x32ee29,null))[_0x0b47('0x28')](respondWithResult(_0x32ee29,null))[_0x0b47('0x46')](handleError(_0x32ee29,null));};exports[_0x0b47('0x4a')]=function(_0x45dfdb,_0x119965){return db[_0x0b47('0x2f')][_0x0b47('0x4a')](_0x45dfdb[_0x0b47('0x4b')],{})['then'](respondWithResult(_0x119965,0xc9))[_0x0b47('0x46')](handleError(_0x119965,null));};exports['update']=function(_0x5450aa,_0x1d88c0){if(_0x5450aa[_0x0b47('0x4b')]['id']){delete _0x5450aa[_0x0b47('0x4b')]['id'];}return db[_0x0b47('0x2f')]['find']({'where':{'id':_0x5450aa['params']['id']}})[_0x0b47('0x28')](handleEntityNotFound(_0x1d88c0,null))['then'](saveUpdates(_0x5450aa['body'],null))[_0x0b47('0x28')](respondWithResult(_0x1d88c0,null))[_0x0b47('0x46')](handleError(_0x1d88c0,null));};exports[_0x0b47('0x4c')]=function(_0x1414d1,_0x58ed2c){return db[_0x0b47('0x2f')][_0x0b47('0x4c')]()['then'](respondWithResult(_0x58ed2c,null))[_0x0b47('0x46')](handleError(_0x58ed2c,null));};exports[_0x0b47('0x4d')]=function(_0x30df11,_0x13c57c,_0x4ba5e8){var _0x2d0459=require('../../components/encryptor');var _0x511884=![];var _0xa75afa={};if(_0x30df11[_0x0b47('0x35')]['type']&&_0x30df11['query'][_0x0b47('0x4e')]===_0x0b47('0x4f')){_0xa75afa[_0x0b47('0x4f')]=_0x30df11[_0x0b47('0x48')]['id'];}else{_0xa75afa['id']=_0x30df11[_0x0b47('0x48')]['id'];}return db[_0x0b47('0x2f')]['find']({'where':_0xa75afa,'attributes':['id',_0x0b47('0x50')],'raw':!![]})[_0x0b47('0x28')](handleEntityNotFound(_0x13c57c,null))[_0x0b47('0x28')](function(_0x58c677){if(_0x58c677){var _0x55886c=_0x58c677['value'];var _0xd394b7=util['format'](_0x0b47('0x51'),_0x55886c);if(fs['existsSync'](_0xd394b7)){_0x511884=!![];return _0x2d0459[_0x0b47('0x52')](_0xd394b7,_0x55886c,config[_0x0b47('0x53')][_0x0b47('0x54')])['then'](function(){return _0x58c677;});}return _0x58c677;}})[_0x0b47('0x28')](function(_0x5376d9){if(_0x5376d9){var _0xbfd352=_0x5376d9[_0x0b47('0x50')];if(!fs[_0x0b47('0x55')](_0xbfd352)){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x58'));}if(_0x5376d9[_0x0b47('0x59')]){return _0x13c57c[_0x0b47('0x4d')](_0xbfd352,_0x5376d9['filename']+path[_0x0b47('0x5a')](_0xbfd352),function(){if(_0x511884){fs[_0x0b47('0x5b')](_0xbfd352);}});}else{return _0x13c57c[_0x0b47('0x4d')](_0xbfd352,function(_0x51e119){if(_0x511884){fs[_0x0b47('0x5b')](_0xbfd352);}});}}})[_0x0b47('0x46')](function(_0x313f43){if(_0x313f43[_0x0b47('0x5c')]===_0x0b47('0x58')){_0x13c57c['status'](0x194)[_0x0b47('0x5d')]('Not\x20found');}else{return handleError(_0x13c57c,null);}});};exports[_0x0b47('0x5e')]=function(_0x30984c,_0x3597c2,_0x279a35){var _0x176dea=require(_0x0b47('0x5f'));var _0x432261=![];var _0x5a27f0={'$and':[db[_0x0b47('0x60')]['where'](db[_0x0b47('0x60')]['fn'](_0x0b47('0x61'),db[_0x0b47('0x60')][_0x0b47('0x62')](_0x0b47('0x4f'))),_0x30984c[_0x0b47('0x35')][_0x0b47('0x63')])]};if(_0x30984c[_0x0b47('0x35')][_0x0b47('0x4e')]&&_0x30984c[_0x0b47('0x35')][_0x0b47('0x4e')]===_0x0b47('0x4f')){_0x5a27f0[_0x0b47('0x64')][_0x0b47('0x65')]({'uniqueid':_0x30984c[_0x0b47('0x48')]['id']});}else{_0x5a27f0[_0x0b47('0x64')][_0x0b47('0x65')]({'id':_0x30984c[_0x0b47('0x48')]['id']});}return db[_0x0b47('0x2f')][_0x0b47('0x49')]({'where':_0x5a27f0,'attributes':['id',_0x0b47('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x3597c2,null))[_0x0b47('0x28')](function(_0x37f274){if(_0x37f274){var _0x5c1459=util[_0x0b47('0x33')](_0x0b47('0x51'),_0x37f274[_0x0b47('0x50')]);if(fs[_0x0b47('0x55')](_0x5c1459)){_0x432261=!![];return _0x176dea[_0x0b47('0x52')](_0x5c1459,_0x37f274[_0x0b47('0x50')],config[_0x0b47('0x53')]['recording'])[_0x0b47('0x28')](function(){return _0x37f274;});}return _0x37f274;}})[_0x0b47('0x28')](function(_0x6b7552){if(_0x6b7552){if(!fs[_0x0b47('0x55')](_0x6b7552[_0x0b47('0x50')])){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x58'));}if(_0x6b7552[_0x0b47('0x59')]){return _0x3597c2[_0x0b47('0x4d')](_0x6b7552[_0x0b47('0x50')],_0x6b7552[_0x0b47('0x59')]+path[_0x0b47('0x5a')](_0x6b7552[_0x0b47('0x50')]),function(){if(_0x432261){fs[_0x0b47('0x5b')](_0x6b7552[_0x0b47('0x50')]);}});}else{return _0x3597c2[_0x0b47('0x4d')](_0x6b7552[_0x0b47('0x50')],function(_0x3aaf01){if(_0x432261){fs[_0x0b47('0x5b')](_0x6b7552[_0x0b47('0x50')]);}});}}})[_0x0b47('0x46')](handleError(_0x3597c2,null));};exports[_0x0b47('0x29')]=function(_0x49244d,_0x564084){return db[_0x0b47('0x2f')][_0x0b47('0x49')]({'where':{'id':_0x49244d[_0x0b47('0x48')]['id']}})[_0x0b47('0x28')](function(_0x33ee81){if(!_0x33ee81)throw new ReferenceError('Entity\x20not\x20found');return _0x33ee81;})['then'](function(_0x1f4005){var _0x62f63b=_0x1f4005[_0x0b47('0x50')];logger[_0x0b47('0x66')](_0x0b47('0x67'),_0x62f63b);if(!_[_0x0b47('0x68')](_0x1f4005[_0x0b47('0x50')])&&fs[_0x0b47('0x55')](_0x62f63b)){logger[_0x0b47('0x66')]('File:\x20\x22'+_0x62f63b+_0x0b47('0x69'));fs[_0x0b47('0x6a')](_0x62f63b);}_0x62f63b=_0x62f63b+_0x0b47('0x6b');if(!_['isNil'](_0x1f4005[_0x0b47('0x50')])&&fs[_0x0b47('0x55')](_0x62f63b)){logger[_0x0b47('0x66')]('File:\x20\x22'+_0x62f63b+_0x0b47('0x69'));fs[_0x0b47('0x6a')](_0x62f63b);}return _0x1f4005;})[_0x0b47('0x28')](function(_0x179d48){if(!_0x179d48)throw new InternalError();return _0x179d48['destroy']();})[_0x0b47('0x28')](function(){_0x564084['status'](0xcc)[_0x0b47('0x1f')]();})[_0x0b47('0x46')](handleError(_0x564084,null));};function getBucketslist(_0x495c13,_0xff036d,_0x2525d0){return new Promise(function(_0xc973b9,_0x3f71ec){var _0x1556f1=new AWS['S3']({'accessKeyId':_0xff036d,'secretAccessKey':_0x495c13,'region':_0x2525d0});_0x1556f1['listBuckets']({},function(_0x3f4788,_0x379f89){if(_0x3f4788){return _0x3f71ec(_0x3f4788);}else{return _0xc973b9(_0x379f89);}});});}function createBucket(_0x5574a0,_0x7943b,_0x220300,_0x4c2cac){return new Promise(function(_0x3eb2e8,_0x473e99){var _0x4cea26=new AWS['S3']({'accessKeyId':_0x7943b,'secretAccessKey':_0x5574a0,'region':_0x220300});_0x4cea26[_0x0b47('0x6c')]({'Bucket':_0x4c2cac},function(_0x82e42,_0x1ec98a){if(_0x82e42){return _0x473e99(_0x82e42);}else{return _0x3eb2e8(_0x1ec98a);}});});}function uploadFile(_0x5b1695,_0x687775,_0x3fe211,_0x59d70d,_0x12d58e,_0x41edc6){return new Promise(function(_0x4f3369,_0x4809c4){var _0x11b68c=new AWS['S3']({'accessKeyId':_0x687775,'secretAccessKey':_0x5b1695,'region':_0x3fe211});_0x11b68c[_0x0b47('0x6d')]({'Bucket':_0x59d70d,'Key':_0x12d58e,'Body':_0x41edc6},function(_0x43b076,_0xad1874){if(_0x43b076){return _0x4809c4(_0x43b076);}else{return _0x4f3369(_0xad1874);}});});}function startTranscribe(_0x3b4b75,_0x2746a8,_0x31b182,_0x23ddc8,_0x22e4e7,_0x4d035c){return new Promise(function(_0x5f24dd,_0x51e797){var _0x1cc1e2=new AWS[(_0x0b47('0x6e'))]({'accessKeyId':_0x2746a8,'secretAccessKey':_0x3b4b75,'region':_0x31b182});_0x1cc1e2[_0x0b47('0x6f')]({'TranscriptionJobName':_0x23ddc8,'LanguageCode':_0x22e4e7,'Media':{'MediaFileUri':_0x4d035c}},function(_0x3aef3c,_0x6f7021){if(_0x3aef3c){return _0x51e797(_0x3aef3c);}else{return _0x5f24dd(_0x6f7021);}});});}function transcribe(_0x2d7028,_0xd23b7d,_0x3810b6,_0x2cd278,_0x5db8d2,_0x515b4f,_0x1bc85a){return new Promise(function(_0x281c04,_0x2140f7){var _0x3b02dd={};logger[_0x0b47('0x66')](util[_0x0b47('0x33')](_0x0b47('0x70'),_0x2d7028,_0x5db8d2));return uploadFile(_0xd23b7d,_0x3810b6,_0x2cd278,_0x5db8d2,path[_0x0b47('0x71')](_0x515b4f),fs[_0x0b47('0x72')](_0x515b4f))[_0x0b47('0x28')](function(_0x8da8b4){logger[_0x0b47('0x66')](util[_0x0b47('0x33')](_0x0b47('0x73'),_0x2d7028,_0x5db8d2,_0x8da8b4[_0x0b47('0x74')]));_0x3b02dd[_0x0b47('0x75')]=_0x8da8b4['Bucket'];_0x3b02dd['location']=_0x8da8b4[_0x0b47('0x74')];logger['info'](util[_0x0b47('0x33')](_0x0b47('0x76'),_0x2d7028));return startTranscribe(_0xd23b7d,_0x3810b6,_0x2cd278,uuidv4(),_0x1bc85a,_0x8da8b4[_0x0b47('0x74')]);})[_0x0b47('0x28')](function(_0x272058){logger[_0x0b47('0x66')](util[_0x0b47('0x33')](_0x0b47('0x77'),_0x2d7028,_0x272058['TranscriptionJob']['TranscriptionJobName']));_0x3b02dd[_0x0b47('0x78')]=_0x272058[_0x0b47('0x79')][_0x0b47('0x7a')];_0x3b02dd[_0x0b47('0x7b')]=_0x272058[_0x0b47('0x79')][_0x0b47('0x7c')];return _0x281c04(_0x3b02dd);})['catch'](function(_0x2c46cd){return _0x2140f7(_0x2c46cd);});});}exports[_0x0b47('0x7d')]=function(_0x2d55fe,_0x583ee8,_0x33eee2){var _0x203df4;var _0x582506;var _0x9383d8;var _0x165435=require(_0x0b47('0x5f'));return db[_0x0b47('0x2f')][_0x0b47('0x7e')]({'where':{'id':_0x2d55fe[_0x0b47('0x48')]['id']}})[_0x0b47('0x28')](function(_0x4eec64){if(_0x4eec64){var _0x8d7b05=util['format']('%s.cypher',_0x4eec64[_0x0b47('0x50')]);if(fs[_0x0b47('0x55')](_0x8d7b05)){cypher=!![];return _0x165435[_0x0b47('0x52')](_0x8d7b05,_0x4eec64[_0x0b47('0x50')],config['secrets'][_0x0b47('0x54')])[_0x0b47('0x28')](function(){return _0x4eec64;});}return _0x4eec64;}})['then'](function(_0x4ad484){if(!_0x4ad484){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x7f'));}_0x582506=_0x4ad484;return db[_0x0b47('0x80')]['findOne']({'where':{'id':0x1}});})[_0x0b47('0x28')](handleEntityNotFound(_0x583ee8,null))[_0x0b47('0x28')](function(_0xb3a5a2){if(_0xb3a5a2){_0x203df4=_0xb3a5a2;if(!_0x203df4[_0x0b47('0x81')]||!_0x203df4[_0x0b47('0x82')]||!_0x203df4[_0x0b47('0x83')]||!_0x203df4[_0x0b47('0x84')]||!_0x203df4[_0x0b47('0x75')]){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x85'));}if(_0x2d55fe[_0x0b47('0x4b')][_0x0b47('0x86')]&&(!_0x203df4[_0x0b47('0x87')]||!_0x203df4['sentimentAccountId']||!_0x203df4['sentimentRegion']||!_0x203df4[_0x0b47('0x84')]||!_0x203df4[_0x0b47('0x75')])){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x88'));}return db['CloudProvider'][_0x0b47('0x7e')]({'where':{'id':_0x203df4['transcribeAccountId']}});}})[_0x0b47('0x28')](function(_0x27bd12){if(!_0x27bd12){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x27bd12[_0x0b47('0x89')]||!_0x27bd12[_0x0b47('0x8a')]){throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x8b'));}_0x9383d8=_0x27bd12;return getBucketslist(_0x9383d8[_0x0b47('0x89')],_0x9383d8[_0x0b47('0x8a')],_0x203df4[_0x0b47('0x83')]);})['then'](function(_0x377f32){if(_0x377f32&&_0x377f32['Buckets']){var _0x3c0d4d=_['find'](_0x377f32[_0x0b47('0x8c')],function(_0x58f9fe){return _0x58f9fe[_0x0b47('0x8d')]===_0x203df4[_0x0b47('0x75')];});if(!_0x3c0d4d){logger[_0x0b47('0x66')](util['format'](_0x0b47('0x8e'),_0x2d55fe[_0x0b47('0x48')]['id'],_0x203df4[_0x0b47('0x75')]));return createBucket(_0x9383d8[_0x0b47('0x89')],_0x9383d8[_0x0b47('0x8a')],_0x203df4['transcribeRegion'],_0x203df4[_0x0b47('0x75')]);}logger[_0x0b47('0x66')](util[_0x0b47('0x33')](_0x0b47('0x8f'),_0x2d55fe[_0x0b47('0x48')]['id'],_0x203df4[_0x0b47('0x75')]));return;}})[_0x0b47('0x28')](function(_0x1065d4){if(_0x582506['transcribeStatus']===_0x0b47('0x90')){return transcribe(_0x2d55fe[_0x0b47('0x48')]['id'],_0x9383d8[_0x0b47('0x89')],_0x9383d8[_0x0b47('0x8a')],_0x203df4[_0x0b47('0x83')],_0x203df4[_0x0b47('0x75')],_0x582506[_0x0b47('0x50')],_0x203df4[_0x0b47('0x84')]);}else{logger['info'](util[_0x0b47('0x33')](_0x0b47('0x91'),_0x2d55fe['params']['id']));return{'transcribeStatus':_0x0b47('0x92')};}})[_0x0b47('0x28')](function(_0x5ee7df){if(_0x5ee7df){_0x5ee7df['tempSentiment']=_0x2d55fe[_0x0b47('0x4b')][_0x0b47('0x86')];return _0x582506['updateAttributes'](_0x5ee7df);}})['then'](respondWithResult(_0x583ee8,null))[_0x0b47('0x46')](handleError(_0x583ee8,null));};function writeFile(_0x2d7219,_0x31f22b){return new Promise(function(_0x1296e7,_0x30c5e9){fs[_0x0b47('0x93')](_0x31f22b,_0x2d7219,function(_0x5e6e2e,_0x103196){if(_0x5e6e2e){return _0x30c5e9(_0x5e6e2e);}else{return _0x1296e7(_0x103196);}});});}exports[_0x0b47('0x94')]=function(_0x199026,_0x26a297,_0x4dca6e){return db[_0x0b47('0x2f')][_0x0b47('0x7e')]({'where':{'id':_0x199026[_0x0b47('0x48')]['id']}})[_0x0b47('0x28')](handleEntityNotFound(_0x26a297))['then'](function(_0x251216){if(_0x251216&&_0x251216['fileText']){var _0x33bea5=_0x251216[_0x0b47('0x95')];var _0x46a92b=config[_0x0b47('0x96')]+_0x0b47('0x97')+_0x251216['id']+_0x0b47('0x98');if(fs[_0x0b47('0x55')](_0x46a92b)){return _0x46a92b;}return writeFile(_0x33bea5,_0x46a92b)[_0x0b47('0x28')](function(){return _0x46a92b;});}else{throw new db[(_0x0b47('0x56'))][(_0x0b47('0x57'))](_0x0b47('0x99'));}})[_0x0b47('0x28')](function(_0x45f77d){return _0x26a297['download'](_0x45f77d);})[_0x0b47('0x46')](handleError(_0x26a297));}; \ No newline at end of file +var _0x044c=['transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','crypto','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','show','params','keys','includeAll','options','create','body','find','catch','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting'];(function(_0x4cee39,_0x1774b7){var _0x33e12e=function(_0x522037){while(--_0x522037){_0x4cee39['push'](_0x4cee39['shift']());}};_0x33e12e(++_0x1774b7);}(_0x044c,0x1d9));var _0xc044=function(_0x3fc9f1,_0x39e46f){_0x3fc9f1=_0x3fc9f1-0x0;var _0x5b7c86=_0x044c[_0x3fc9f1];return _0x5b7c86;};'use strict';var pdf=require(_0xc044('0x0'));var emlformat=require(_0xc044('0x1'));var rimraf=require(_0xc044('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc044('0x3'));var rp=require(_0xc044('0x4'));var moment=require(_0xc044('0x5'));var BPromise=require(_0xc044('0x6'));var Mustache=require(_0xc044('0x7'));var util=require(_0xc044('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc044('0x9'));var squel=require('squel');var crypto=require(_0xc044('0xa'));var jsforce=require(_0xc044('0xb'));var deskjs=require(_0xc044('0xc'));var toCsv=require(_0xc044('0xd'));var querystring=require('querystring');var Papa=require(_0xc044('0xe'));var AWS=require(_0xc044('0xf'));var uuidv4=require(_0xc044('0x10'));var Redis=require(_0xc044('0x11'));var authService=require(_0xc044('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc044('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc044('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc044('0x15'));var licenseUtil=require(_0xc044('0x16'));var db=require(_0xc044('0x17'))['db'];function respondWithStatusCode(_0x45d07b,_0x44243b){_0x44243b=_0x44243b||0xcc;return function(_0x56f924){if(_0x56f924){return _0x45d07b[_0xc044('0x18')](_0x44243b);}return _0x45d07b['status'](_0x44243b)[_0xc044('0x19')]();};}function respondWithResult(_0x2d5803,_0x18efb7){_0x18efb7=_0x18efb7||0xc8;return function(_0x40a604){if(_0x40a604){return _0x2d5803[_0xc044('0x1a')](_0x18efb7)[_0xc044('0x1b')](_0x40a604);}};}function respondWithFilteredResult(_0x5a7a5c,_0x200082){return function(_0x210828){if(_0x210828){var _0x5387fe=_0x210828[_0xc044('0x1c')],_0x394bc9=_0x200082[_0xc044('0x1d')],_0x288c02=_0x200082['offset']+_0x200082['limit'],_0x3c3834;if(_0x288c02>=_0x5387fe){_0x288c02=_0x5387fe;_0x3c3834=0xc8;}else{_0x3c3834=0xce;}_0x5a7a5c[_0xc044('0x1a')](_0x3c3834);return _0x5a7a5c[_0xc044('0x1e')](_0xc044('0x1f'),_0x394bc9+'-'+_0x288c02+'/'+_0x5387fe)[_0xc044('0x1b')](_0x210828);}return null;};}function patchUpdates(_0x2bd370){return function(_0x21332f){try{jsonpatch[_0xc044('0x20')](_0x21332f,_0x2bd370,!![]);}catch(_0x50c73a){return BPromise['reject'](_0x50c73a);}return _0x21332f[_0xc044('0x21')]();};}function saveUpdates(_0xbdb6bf,_0xbfbffc){return function(_0x9343b8){if(_0x9343b8){return _0x9343b8[_0xc044('0x22')](_0xbdb6bf)[_0xc044('0x23')](function(_0x54050b){return _0x54050b;});}return null;};}function removeEntity(_0x2f3ca1,_0xd5ba44){return function(_0x1f4ade){if(_0x1f4ade){return _0x1f4ade[_0xc044('0x24')]()['then'](function(){_0x2f3ca1[_0xc044('0x1a')](0xcc)[_0xc044('0x19')]();});}};}function handleEntityNotFound(_0x17737a,_0x2f09d7){return function(_0x555afd){if(!_0x555afd){_0x17737a[_0xc044('0x18')](0x194);}return _0x555afd;};}function handleError(_0x2cde00,_0x150520){_0x150520=_0x150520||0x1f4;return function(_0x1d9c11){logger[_0xc044('0x25')](_0x1d9c11[_0xc044('0x26')]);if(_0x1d9c11[_0xc044('0x27')]){delete _0x1d9c11['name'];}_0x2cde00[_0xc044('0x1a')](_0x150520)[_0xc044('0x28')](_0x1d9c11);};}exports[_0xc044('0x29')]=function(_0x564cc8,_0x24ff87){var _0x3df78={},_0x7060ea={},_0x5bea5f={'count':0x0,'rows':[]};var _0x8d4992=_[_0xc044('0x2a')](db[_0xc044('0x2b')][_0xc044('0x2c')],function(_0x5347cd){return{'name':_0x5347cd['fieldName'],'type':_0x5347cd[_0xc044('0x2d')][_0xc044('0x2e')]};});_0x7060ea[_0xc044('0x2f')]=_[_0xc044('0x30')](_[_0xc044('0x2a')](_0x8d4992,'name'),[_0xc044('0x31')]);_0x7060ea[_0xc044('0x32')]=_['keys'](_0x564cc8['query']);_0x7060ea[_0xc044('0x33')]=_[_0xc044('0x34')](_0x7060ea[_0xc044('0x2f')],_0x7060ea['query']);_0x3df78[_0xc044('0x35')]=_[_0xc044('0x34')](_0x7060ea[_0xc044('0x2f')],qs[_0xc044('0x36')](_0x564cc8[_0xc044('0x32')][_0xc044('0x36')]));_0x3df78[_0xc044('0x35')]=_0x3df78['attributes'][_0xc044('0x37')]?_0x3df78[_0xc044('0x35')]:_0x7060ea[_0xc044('0x2f')];if(!_0x564cc8[_0xc044('0x32')]['hasOwnProperty'](_0xc044('0x38'))){_0x3df78[_0xc044('0x39')]=qs[_0xc044('0x39')](_0x564cc8['query'][_0xc044('0x39')]);_0x3df78[_0xc044('0x1d')]=qs[_0xc044('0x1d')](_0x564cc8[_0xc044('0x32')][_0xc044('0x1d')]);}_0x3df78['order']=qs['sort'](_0x564cc8['query'][_0xc044('0x3a')]);_0x3df78[_0xc044('0x3b')]=qs['filters'](_[_0xc044('0x3c')](_0x564cc8[_0xc044('0x32')],_0x7060ea[_0xc044('0x33')]),_0x8d4992);if(_0x564cc8[_0xc044('0x32')][_0xc044('0x3d')]){_0x3df78['where']=_[_0xc044('0x3e')](_0x3df78[_0xc044('0x3b')],{'$or':_['map'](_0x8d4992,function(_0x40afcb){if(_0x40afcb['type']!==_0xc044('0x3f')){var _0x143102={};_0x143102[_0x40afcb['name']]={'$like':'%'+_0x564cc8['query'][_0xc044('0x3d')]+'%'};return _0x143102;}})});}_0x3df78=_['merge']({},_0x3df78,_0x564cc8['options']);var _0x14491b={'where':_0x3df78[_0xc044('0x3b')]};return db[_0xc044('0x2b')][_0xc044('0x1c')](_0x14491b)['then'](function(_0x4d7b7e){_0x5bea5f[_0xc044('0x1c')]=_0x4d7b7e;if(_0x564cc8[_0xc044('0x32')]['includeAll']){_0x3df78[_0xc044('0x40')]=[{'all':!![]}];}return db[_0xc044('0x2b')]['findAll'](_0x3df78);})['then'](function(_0x1c04fa){_0x5bea5f['rows']=_0x1c04fa;return _0x5bea5f;})[_0xc044('0x23')](respondWithFilteredResult(_0x24ff87,_0x3df78))['catch'](handleError(_0x24ff87,null));};exports[_0xc044('0x41')]=function(_0x5c868e,_0x7521eb){var _0x162586={'raw':![],'where':{'id':_0x5c868e[_0xc044('0x42')]['id']}},_0x2d8c10={};_0x2d8c10[_0xc044('0x2f')]=_[_0xc044('0x43')](db[_0xc044('0x2b')]['rawAttributes']);_0x2d8c10[_0xc044('0x32')]=_[_0xc044('0x43')](_0x5c868e['query']);_0x2d8c10[_0xc044('0x33')]=_[_0xc044('0x34')](_0x2d8c10['model'],_0x2d8c10['query']);_0x162586[_0xc044('0x35')]=_[_0xc044('0x34')](_0x2d8c10['model'],qs[_0xc044('0x36')](_0x5c868e['query'][_0xc044('0x36')]));_0x162586['attributes']=_0x162586[_0xc044('0x35')][_0xc044('0x37')]?_0x162586['attributes']:_0x2d8c10['model'];if(_0x5c868e[_0xc044('0x32')][_0xc044('0x44')]){_0x162586[_0xc044('0x40')]=[{'all':!![]}];}_0x162586=_[_0xc044('0x3e')]({},_0x162586,_0x5c868e[_0xc044('0x45')]);return db['VoiceRecording']['find'](_0x162586)[_0xc044('0x23')](handleEntityNotFound(_0x7521eb,null))[_0xc044('0x23')](respondWithResult(_0x7521eb,null))['catch'](handleError(_0x7521eb,null));};exports['create']=function(_0x20d968,_0x53ff8e){return db[_0xc044('0x2b')][_0xc044('0x46')](_0x20d968['body'],{})['then'](respondWithResult(_0x53ff8e,0xc9))['catch'](handleError(_0x53ff8e,null));};exports[_0xc044('0x22')]=function(_0x152075,_0xf97144){if(_0x152075[_0xc044('0x47')]['id']){delete _0x152075[_0xc044('0x47')]['id'];}return db[_0xc044('0x2b')][_0xc044('0x48')]({'where':{'id':_0x152075[_0xc044('0x42')]['id']}})[_0xc044('0x23')](handleEntityNotFound(_0xf97144,null))[_0xc044('0x23')](saveUpdates(_0x152075['body'],null))[_0xc044('0x23')](respondWithResult(_0xf97144,null))[_0xc044('0x49')](handleError(_0xf97144,null));};exports[_0xc044('0x4a')]=function(_0x3e968c,_0x528775){return db[_0xc044('0x2b')][_0xc044('0x4a')]()['then'](respondWithResult(_0x528775,null))[_0xc044('0x49')](handleError(_0x528775,null));};exports[_0xc044('0x4b')]=function(_0x498cf8,_0x5d924a,_0x16d570){var _0x5e8082=require(_0xc044('0x4c'));var _0x529321=![];var _0x50a212={};if(_0x498cf8['query']['type']&&_0x498cf8[_0xc044('0x32')][_0xc044('0x2d')]===_0xc044('0x4d')){_0x50a212[_0xc044('0x4d')]=_0x498cf8[_0xc044('0x42')]['id'];}else{_0x50a212['id']=_0x498cf8[_0xc044('0x42')]['id'];}return db[_0xc044('0x2b')][_0xc044('0x48')]({'where':_0x50a212,'attributes':['id',_0xc044('0x4e')],'raw':!![]})[_0xc044('0x23')](handleEntityNotFound(_0x5d924a,null))[_0xc044('0x23')](function(_0x12471f){if(_0x12471f){var _0x1881ad=_0x12471f[_0xc044('0x4e')];var _0x1991be=util[_0xc044('0x31')](_0xc044('0x4f'),_0x1881ad);if(fs[_0xc044('0x50')](_0x1991be)){_0x529321=!![];return _0x5e8082[_0xc044('0x51')](_0x1991be,_0x1881ad,config[_0xc044('0x52')][_0xc044('0x53')])[_0xc044('0x23')](function(){return _0x12471f;});}return _0x12471f;}})[_0xc044('0x23')](function(_0x1a3038){if(_0x1a3038){var _0x4a1d5c=_0x1a3038[_0xc044('0x4e')];if(!fs['existsSync'](_0x4a1d5c)){throw new db[(_0xc044('0x54'))][(_0xc044('0x55'))](_0xc044('0x56'));}if(_0x1a3038[_0xc044('0x57')]){return _0x5d924a[_0xc044('0x4b')](_0x4a1d5c,_0x1a3038[_0xc044('0x57')]+path[_0xc044('0x58')](_0x4a1d5c),function(){if(_0x529321){fs[_0xc044('0x59')](_0x4a1d5c);}});}else{return _0x5d924a[_0xc044('0x4b')](_0x4a1d5c,function(_0x142fbe){if(_0x529321){fs[_0xc044('0x59')](_0x4a1d5c);}});}}})[_0xc044('0x49')](function(_0x5ba939){if(_0x5ba939[_0xc044('0x5a')]===_0xc044('0x56')){_0x5d924a[_0xc044('0x1a')](0x194)['send'](_0xc044('0x5b'));}else{return handleError(_0x5d924a,null);}});};exports[_0xc044('0x5c')]=function(_0x59925b,_0x562437,_0x173b89){var _0x312992=require(_0xc044('0x4c'));var _0x229505=![];var _0x5d6c93={'$and':[db['sequelize'][_0xc044('0x3b')](db[_0xc044('0x5d')]['fn'](_0xc044('0x5e'),db['sequelize']['col'](_0xc044('0x4d'))),_0x59925b[_0xc044('0x32')][_0xc044('0x5f')])]};if(_0x59925b[_0xc044('0x32')][_0xc044('0x2d')]&&_0x59925b[_0xc044('0x32')]['type']===_0xc044('0x4d')){_0x5d6c93[_0xc044('0x60')]['push']({'uniqueid':_0x59925b[_0xc044('0x42')]['id']});}else{_0x5d6c93[_0xc044('0x60')][_0xc044('0x61')]({'id':_0x59925b[_0xc044('0x42')]['id']});}return db[_0xc044('0x2b')][_0xc044('0x48')]({'where':_0x5d6c93,'attributes':['id',_0xc044('0x4e')],'raw':!![]})[_0xc044('0x23')](handleEntityNotFound(_0x562437,null))['then'](function(_0x1073e4){if(_0x1073e4){var _0x1e1906=util[_0xc044('0x31')](_0xc044('0x4f'),_0x1073e4[_0xc044('0x4e')]);if(fs[_0xc044('0x50')](_0x1e1906)){_0x229505=!![];return _0x312992[_0xc044('0x51')](_0x1e1906,_0x1073e4[_0xc044('0x4e')],config[_0xc044('0x52')][_0xc044('0x53')])[_0xc044('0x23')](function(){return _0x1073e4;});}return _0x1073e4;}})[_0xc044('0x23')](function(_0x5028f1){if(_0x5028f1){if(!fs[_0xc044('0x50')](_0x5028f1[_0xc044('0x4e')])){throw new db[(_0xc044('0x54'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x5028f1['filename']){return _0x562437[_0xc044('0x4b')](_0x5028f1[_0xc044('0x4e')],_0x5028f1[_0xc044('0x57')]+path['extname'](_0x5028f1[_0xc044('0x4e')]),function(){if(_0x229505){fs[_0xc044('0x59')](_0x5028f1[_0xc044('0x4e')]);}});}else{return _0x562437[_0xc044('0x4b')](_0x5028f1[_0xc044('0x4e')],function(_0x4342a5){if(_0x229505){fs[_0xc044('0x59')](_0x5028f1[_0xc044('0x4e')]);}});}}})[_0xc044('0x49')](handleError(_0x562437,null));};exports[_0xc044('0x24')]=function(_0x1eee4d,_0x36ca50){return db[_0xc044('0x2b')]['find']({'where':{'id':_0x1eee4d['params']['id']}})['then'](function(_0x457922){if(!_0x457922)throw new ReferenceError(_0xc044('0x62'));return _0x457922;})[_0xc044('0x23')](function(_0x3be4ca){var _0x3ec9f6=_0x3be4ca['value'];logger[_0xc044('0x63')](_0xc044('0x64'),_0x3ec9f6);if(!_['isNil'](_0x3be4ca[_0xc044('0x4e')])&&fs[_0xc044('0x50')](_0x3ec9f6)){logger[_0xc044('0x63')](_0xc044('0x65')+_0x3ec9f6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc044('0x66')](_0x3ec9f6);}_0x3ec9f6=_0x3ec9f6+_0xc044('0x67');if(!_[_0xc044('0x68')](_0x3be4ca[_0xc044('0x4e')])&&fs[_0xc044('0x50')](_0x3ec9f6)){logger[_0xc044('0x63')]('File:\x20\x22'+_0x3ec9f6+_0xc044('0x69'));fs['unlinkSync'](_0x3ec9f6);}return _0x3be4ca;})[_0xc044('0x23')](function(_0x3dbd4b){if(!_0x3dbd4b)throw new InternalError();return _0x3dbd4b[_0xc044('0x24')]();})[_0xc044('0x23')](function(){_0x36ca50[_0xc044('0x1a')](0xcc)[_0xc044('0x19')]();})['catch'](handleError(_0x36ca50,null));};function getBucketslist(_0x3cc8ef,_0x3000c1,_0xfdca6f){return new Promise(function(_0x33a27d,_0x386f08){var _0x51af5c=new AWS['S3']({'accessKeyId':_0x3000c1,'secretAccessKey':_0x3cc8ef,'region':_0xfdca6f});_0x51af5c[_0xc044('0x6a')]({},function(_0x3eba86,_0x217f52){if(_0x3eba86){return _0x386f08(_0x3eba86);}else{return _0x33a27d(_0x217f52);}});});}function createBucket(_0x146367,_0x469811,_0x2b1d59,_0x554b6a){return new Promise(function(_0x2f4f07,_0x5af696){var _0x4f1808=new AWS['S3']({'accessKeyId':_0x469811,'secretAccessKey':_0x146367,'region':_0x2b1d59});_0x4f1808[_0xc044('0x6b')]({'Bucket':_0x554b6a},function(_0x488a50,_0x3d7742){if(_0x488a50){return _0x5af696(_0x488a50);}else{return _0x2f4f07(_0x3d7742);}});});}function uploadFile(_0x397fad,_0x4c4cf3,_0x4d9fdd,_0xf4bb08,_0x2c6ca6,_0x268492){return new Promise(function(_0x479d9d,_0x90886d){var _0x718dba=new AWS['S3']({'accessKeyId':_0x4c4cf3,'secretAccessKey':_0x397fad,'region':_0x4d9fdd});_0x718dba[_0xc044('0x6c')]({'Bucket':_0xf4bb08,'Key':_0x2c6ca6,'Body':_0x268492},function(_0x3f27b6,_0x482b01){if(_0x3f27b6){return _0x90886d(_0x3f27b6);}else{return _0x479d9d(_0x482b01);}});});}function startTranscribe(_0x2aebc8,_0xa1d3bb,_0x4d07e8,_0x260892,_0x4c7582,_0x5d3e03){return new Promise(function(_0x27de6d,_0x4b9384){var _0x35decf=new AWS['TranscribeService']({'accessKeyId':_0xa1d3bb,'secretAccessKey':_0x2aebc8,'region':_0x4d07e8});_0x35decf[_0xc044('0x6d')]({'TranscriptionJobName':_0x260892,'LanguageCode':_0x4c7582,'Media':{'MediaFileUri':_0x5d3e03}},function(_0x5984c4,_0x4d0518){if(_0x5984c4){return _0x4b9384(_0x5984c4);}else{return _0x27de6d(_0x4d0518);}});});}function transcribe(_0x3cfe8c,_0x54dd1f,_0x13aa11,_0x1065a0,_0x476821,_0x1ed2bb,_0x350805){return new Promise(function(_0x466dc6,_0x5d4d21){var _0xa5a954={};logger[_0xc044('0x63')](util[_0xc044('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3cfe8c,_0x476821));return uploadFile(_0x54dd1f,_0x13aa11,_0x1065a0,_0x476821,path[_0xc044('0x6e')](_0x1ed2bb),fs[_0xc044('0x6f')](_0x1ed2bb))[_0xc044('0x23')](function(_0x2bee94){logger[_0xc044('0x63')](util[_0xc044('0x31')](_0xc044('0x70'),_0x3cfe8c,_0x476821,_0x2bee94[_0xc044('0x71')]));_0xa5a954[_0xc044('0x72')]=_0x2bee94[_0xc044('0x73')];_0xa5a954['location']=_0x2bee94['Location'];logger[_0xc044('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3cfe8c));return startTranscribe(_0x54dd1f,_0x13aa11,_0x1065a0,uuidv4(),_0x350805,_0x2bee94[_0xc044('0x71')]);})[_0xc044('0x23')](function(_0x1aec84){logger[_0xc044('0x63')](util[_0xc044('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x3cfe8c,_0x1aec84['TranscriptionJob']['TranscriptionJobName']));_0xa5a954['transcribeName']=_0x1aec84[_0xc044('0x74')][_0xc044('0x75')];_0xa5a954[_0xc044('0x76')]=_0x1aec84[_0xc044('0x74')][_0xc044('0x77')];return _0x466dc6(_0xa5a954);})[_0xc044('0x49')](function(_0x19d9c9){return _0x5d4d21(_0x19d9c9);});});}exports[_0xc044('0x78')]=function(_0x9c92e9,_0x2c6302,_0x4f8ca9){var _0x3e435a;var _0x5ab513;var _0x241b89;var _0x1d2b17=require(_0xc044('0x4c'));return db[_0xc044('0x2b')][_0xc044('0x79')]({'where':{'id':_0x9c92e9[_0xc044('0x42')]['id']}})[_0xc044('0x23')](function(_0x22cbf0){if(_0x22cbf0){var _0x37b8a7=util['format']('%s.cypher',_0x22cbf0['value']);if(fs[_0xc044('0x50')](_0x37b8a7)){cypher=!![];return _0x1d2b17['decryptFile'](_0x37b8a7,_0x22cbf0[_0xc044('0x4e')],config[_0xc044('0x52')][_0xc044('0x53')])[_0xc044('0x23')](function(){return _0x22cbf0;});}return _0x22cbf0;}})[_0xc044('0x23')](function(_0x248382){if(!_0x248382){throw new db[(_0xc044('0x54'))][(_0xc044('0x55'))]('Voice\x20Recording\x20not\x20found');}_0x5ab513=_0x248382;return db[_0xc044('0x7a')][_0xc044('0x79')]({'where':{'id':0x1}});})[_0xc044('0x23')](handleEntityNotFound(_0x2c6302,null))[_0xc044('0x23')](function(_0x18ba92){if(_0x18ba92){_0x3e435a=_0x18ba92;if(!_0x3e435a[_0xc044('0x7b')]||!_0x3e435a['transcribeAccountId']||!_0x3e435a[_0xc044('0x7c')]||!_0x3e435a['language']||!_0x3e435a['bucket']){throw new db['Sequelize'][(_0xc044('0x55'))](_0xc044('0x7d'));}if(_0x9c92e9[_0xc044('0x47')][_0xc044('0x7e')]&&(!_0x3e435a['sentiment']||!_0x3e435a[_0xc044('0x7f')]||!_0x3e435a[_0xc044('0x80')]||!_0x3e435a[_0xc044('0x81')]||!_0x3e435a[_0xc044('0x72')])){throw new db[(_0xc044('0x54'))]['ValidationError'](_0xc044('0x82'));}return db[_0xc044('0x83')][_0xc044('0x79')]({'where':{'id':_0x3e435a[_0xc044('0x84')]}});}})[_0xc044('0x23')](function(_0x13dd3d){if(!_0x13dd3d){throw new db[(_0xc044('0x54'))][(_0xc044('0x55'))](_0xc044('0x85'));}if(!_0x13dd3d[_0xc044('0x86')]||!_0x13dd3d['data2']){throw new db[(_0xc044('0x54'))][(_0xc044('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x241b89=_0x13dd3d;return getBucketslist(_0x241b89[_0xc044('0x86')],_0x241b89[_0xc044('0x87')],_0x3e435a['transcribeRegion']);})[_0xc044('0x23')](function(_0x1f85f0){if(_0x1f85f0&&_0x1f85f0[_0xc044('0x88')]){var _0x2bef4a=_[_0xc044('0x48')](_0x1f85f0['Buckets'],function(_0x1c6b41){return _0x1c6b41[_0xc044('0x89')]===_0x3e435a['bucket'];});if(!_0x2bef4a){logger[_0xc044('0x63')](util[_0xc044('0x31')](_0xc044('0x8a'),_0x9c92e9[_0xc044('0x42')]['id'],_0x3e435a[_0xc044('0x72')]));return createBucket(_0x241b89[_0xc044('0x86')],_0x241b89[_0xc044('0x87')],_0x3e435a['transcribeRegion'],_0x3e435a[_0xc044('0x72')]);}logger[_0xc044('0x63')](util[_0xc044('0x31')](_0xc044('0x8b'),_0x9c92e9[_0xc044('0x42')]['id'],_0x3e435a[_0xc044('0x72')]));return;}})[_0xc044('0x23')](function(_0x3af610){if(_0x5ab513['transcribeStatus']===_0xc044('0x8c')){return transcribe(_0x9c92e9[_0xc044('0x42')]['id'],_0x241b89[_0xc044('0x86')],_0x241b89['data2'],_0x3e435a[_0xc044('0x7c')],_0x3e435a[_0xc044('0x72')],_0x5ab513[_0xc044('0x4e')],_0x3e435a['language']);}else{logger[_0xc044('0x63')](util[_0xc044('0x31')](_0xc044('0x8d'),_0x9c92e9['params']['id']));return{'transcribeStatus':_0xc044('0x8e')};}})['then'](function(_0x465587){if(_0x465587){_0x465587[_0xc044('0x8f')]=_0x9c92e9[_0xc044('0x47')][_0xc044('0x7e')];return _0x5ab513[_0xc044('0x90')](_0x465587);}})[_0xc044('0x23')](respondWithResult(_0x2c6302,null))[_0xc044('0x49')](handleError(_0x2c6302,null));};function writeFile(_0x1398a4,_0xdbd7f1){return new Promise(function(_0x35d7ea,_0x474505){fs[_0xc044('0x91')](_0xdbd7f1,_0x1398a4,function(_0x26b764,_0x4609a4){if(_0x26b764){return _0x474505(_0x26b764);}else{return _0x35d7ea(_0x4609a4);}});});}exports['downloadTranscribe']=function(_0x13544b,_0x20a6db,_0x5d5d56){return db[_0xc044('0x2b')][_0xc044('0x79')]({'where':{'id':_0x13544b['params']['id']}})[_0xc044('0x23')](handleEntityNotFound(_0x20a6db))[_0xc044('0x23')](function(_0x1eedb7){if(_0x1eedb7&&_0x1eedb7[_0xc044('0x92')]){var _0x188b25=_0x1eedb7[_0xc044('0x92')];var _0xbff38f=config[_0xc044('0x93')]+'/server/files/transcribes/transcribe_'+_0x1eedb7['id']+_0xc044('0x94');if(fs[_0xc044('0x50')](_0xbff38f)){return _0xbff38f;}return writeFile(_0x188b25,_0xbff38f)[_0xc044('0x23')](function(){return _0xbff38f;});}else{throw new db[(_0xc044('0x54'))]['ValidationError']('Transcript\x20not\x20available');}})[_0xc044('0x23')](function(_0x4bfd19){return _0x20a6db[_0xc044('0x4b')](_0x4bfd19);})[_0xc044('0x49')](handleError(_0x20a6db));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 97ab7f1..559e856 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 _0xdd55=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3d30a7,_0x27127d){var _0x4d433e=function(_0x5289c0){while(--_0x5289c0){_0x3d30a7['push'](_0x3d30a7['shift']());}};_0x4d433e(++_0x27127d);}(_0xdd55,0x109));var _0x5dd5=function(_0x404131,_0x56a960){_0x404131=_0x404131-0x0;var _0x1db931=_0xdd55[_0x404131];return _0x1db931;};'use strict';var _=require(_0x5dd5('0x0'));var util=require(_0x5dd5('0x1'));var logger=require(_0x5dd5('0x2'))(_0x5dd5('0x3'));var moment=require(_0x5dd5('0x4'));var BPromise=require(_0x5dd5('0x5'));var rp=require(_0x5dd5('0x6'));var fs=require('fs');var path=require(_0x5dd5('0x7'));var rimraf=require(_0x5dd5('0x8'));var config=require(_0x5dd5('0x9'));var attributes=require(_0x5dd5('0xa'));module['exports']=function(_0x6632f7,_0x279c41){return _0x6632f7[_0x5dd5('0xb')](_0x5dd5('0xc'),attributes,{'tableName':_0x5dd5('0xd'),'paranoid':![],'indexes':[{'name':_0x5dd5('0xe'),'fields':[_0x5dd5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8514=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x5c5fb4,_0x2cb903){var _0x4c0813=function(_0x13d311){while(--_0x13d311){_0x5c5fb4['push'](_0x5c5fb4['shift']());}};_0x4c0813(++_0x2cb903);}(_0x8514,0x159));var _0x4851=function(_0x30a182,_0x36b9f4){_0x30a182=_0x30a182-0x0;var _0x3c2c6c=_0x8514[_0x30a182];return _0x3c2c6c;};'use strict';var _=require(_0x4851('0x0'));var util=require(_0x4851('0x1'));var logger=require('../../config/logger')(_0x4851('0x2'));var moment=require(_0x4851('0x3'));var BPromise=require(_0x4851('0x4'));var rp=require(_0x4851('0x5'));var fs=require('fs');var path=require(_0x4851('0x6'));var rimraf=require(_0x4851('0x7'));var config=require(_0x4851('0x8'));var attributes=require(_0x4851('0x9'));module[_0x4851('0xa')]=function(_0x2f2383,_0x411e98){return _0x2f2383[_0x4851('0xb')]('VoiceRecording',attributes,{'tableName':_0x4851('0xc'),'paranoid':![],'indexes':[{'name':_0x4851('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5b59a3d..bbe5c07 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(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_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['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(_0x2a416a,_0x2f0660){var _0x52bb59=function(_0x411290){while(--_0x411290){_0x2a416a['push'](_0x2a416a['shift']());}};_0x52bb59(++_0x2f0660);}(_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['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 cecdda4..b966ea0 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0xc2caa2,_0x1204bb){var _0x545682=function(_0x966d43){while(--_0x966d43){_0xc2caa2['push'](_0xc2caa2['shift']());}};_0x545682(++_0x1204bb);}(_0x46ed,0x168));var _0xd46e=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x46ed[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')]('/:id',auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router['delete'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x52b31c,_0x299327){_0x52b31c=_0x52b31c-0x0;var _0x2af92c=_0xc6ac[_0x52b31c];return _0x2af92c;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 869a90a..86c1625 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 _0x7b28=['sequelize','moment','exports','blind','STRING','ENUM','Yes'];(function(_0x674cfa,_0x22f0d2){var _0x3450c1=function(_0x54b89b){while(--_0x54b89b){_0x674cfa['push'](_0x674cfa['shift']());}};_0x3450c1(++_0x22f0d2);}(_0x7b28,0xa1));var _0x87b2=function(_0x5328c4,_0x4f89e3){_0x5328c4=_0x5328c4-0x0;var _0x305665=_0x7b28[_0x5328c4];return _0x305665;};'use strict';var Sequelize=require(_0x87b2('0x0'));var moment=require(_0x87b2('0x1'));module[_0x87b2('0x2')]={'type':{'type':Sequelize['ENUM'](_0x87b2('0x3'),'attended')},'result':{'type':Sequelize[_0x87b2('0x4')]},'transfererchannel':{'type':Sequelize[_0x87b2('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x87b2('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x87b2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x87b2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x87b2('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x87b2('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x87b2('0x4')]},'transfereechannel':{'type':Sequelize[_0x87b2('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x87b2('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x87b2('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x87b2('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x87b2('0x4')]},'transfereecontext':{'type':Sequelize[_0x87b2('0x4')]},'transfereeexten':{'type':Sequelize[_0x87b2('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x87b2('0x5')](_0x87b2('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x87b2('0x4')]}}; \ No newline at end of file +var _0xff82=['moment','exports','ENUM','attended','STRING','Yes','sequelize'];(function(_0x1ce73b,_0x16892b){var _0x5d50d7=function(_0x48a813){while(--_0x48a813){_0x1ce73b['push'](_0x1ce73b['shift']());}};_0x5d50d7(++_0x16892b);}(_0xff82,0xd1));var _0x2ff8=function(_0x14e6d3,_0x1e4d03){_0x14e6d3=_0x14e6d3-0x0;var _0x4f520a=_0xff82[_0x14e6d3];return _0x4f520a;};'use strict';var Sequelize=require(_0x2ff8('0x0'));var moment=require(_0x2ff8('0x1'));module[_0x2ff8('0x2')]={'type':{'type':Sequelize[_0x2ff8('0x3')]('blind',_0x2ff8('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2ff8('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x2ff8('0x5')]},'transferercalleridname':{'type':Sequelize[_0x2ff8('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x2ff8('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x2ff8('0x5')]},'transferercontext':{'type':Sequelize[_0x2ff8('0x5')]},'transfererexten':{'type':Sequelize[_0x2ff8('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x2ff8('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2ff8('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2ff8('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x2ff8('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x2ff8('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x2ff8('0x5')]},'isexternal':{'type':Sequelize[_0x2ff8('0x3')](_0x2ff8('0x6'),'No')},'context':{'type':Sequelize[_0x2ff8('0x5')]},'extension':{'type':Sequelize[_0x2ff8('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 27a8814..d10adb1 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 _0x734a=['error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','Content-Range','json','reject','save','update','then','destroy','end'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x734a,0x1df));var _0xa734=function(_0x152b03,_0x2b427f){_0x152b03=_0x152b03-0x0;var _0x5a5d4b=_0x734a[_0x152b03];return _0x5a5d4b;};'use strict';var pdf=require(_0xa734('0x0'));var emlformat=require(_0xa734('0x1'));var rimraf=require(_0xa734('0x2'));var zipdir=require(_0xa734('0x3'));var jsonpatch=require(_0xa734('0x4'));var rp=require(_0xa734('0x5'));var moment=require(_0xa734('0x6'));var BPromise=require(_0xa734('0x7'));var Mustache=require(_0xa734('0x8'));var util=require(_0xa734('0x9'));var path=require(_0xa734('0xa'));var sox=require('sox');var csv=require(_0xa734('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa734('0xc'));var squel=require(_0xa734('0xd'));var crypto=require(_0xa734('0xe'));var jsforce=require(_0xa734('0xf'));var deskjs=require(_0xa734('0x10'));var toCsv=require(_0xa734('0xb'));var querystring=require(_0xa734('0x11'));var Papa=require(_0xa734('0x12'));var Redis=require(_0xa734('0x13'));var authService=require(_0xa734('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa734('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa734('0x16'))(_0xa734('0x17'));var utils=require(_0xa734('0x18'));var config=require(_0xa734('0x19'));var licenseUtil=require(_0xa734('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39615f,_0x49417b){_0x49417b=_0x49417b||0xcc;return function(_0x45276e){if(_0x45276e){return _0x39615f[_0xa734('0x1b')](_0x49417b);}return _0x39615f[_0xa734('0x1c')](_0x49417b)['end']();};}function respondWithResult(_0x517319,_0x18faee){_0x18faee=_0x18faee||0xc8;return function(_0x1cfb40){if(_0x1cfb40){return _0x517319['status'](_0x18faee)['json'](_0x1cfb40);}};}function respondWithFilteredResult(_0xbd7af2,_0x267af0){return function(_0x2c8bf0){if(_0x2c8bf0){var _0x1abded=_0x2c8bf0[_0xa734('0x1d')],_0x351b92=_0x267af0[_0xa734('0x1e')],_0x4a9aa8=_0x267af0['offset']+_0x267af0['limit'],_0x3b8c35;if(_0x4a9aa8>=_0x1abded){_0x4a9aa8=_0x1abded;_0x3b8c35=0xc8;}else{_0x3b8c35=0xce;}_0xbd7af2[_0xa734('0x1c')](_0x3b8c35);return _0xbd7af2['set'](_0xa734('0x1f'),_0x351b92+'-'+_0x4a9aa8+'/'+_0x1abded)[_0xa734('0x20')](_0x2c8bf0);}return null;};}function patchUpdates(_0x2a0c6f){return function(_0x43396c){try{jsonpatch['apply'](_0x43396c,_0x2a0c6f,!![]);}catch(_0x4e22c5){return BPromise[_0xa734('0x21')](_0x4e22c5);}return _0x43396c[_0xa734('0x22')]();};}function saveUpdates(_0xc3dd53,_0xaffae2){return function(_0x355c93){if(_0x355c93){return _0x355c93[_0xa734('0x23')](_0xc3dd53)[_0xa734('0x24')](function(_0x59ae73){return _0x59ae73;});}return null;};}function removeEntity(_0x5a0614,_0x119dad){return function(_0x1953fb){if(_0x1953fb){return _0x1953fb[_0xa734('0x25')]()['then'](function(){_0x5a0614[_0xa734('0x1c')](0xcc)[_0xa734('0x26')]();});}};}function handleEntityNotFound(_0x29dfeb,_0x412c28){return function(_0x359498){if(!_0x359498){_0x29dfeb[_0xa734('0x1b')](0x194);}return _0x359498;};}function handleError(_0x1d5632,_0x59c671){_0x59c671=_0x59c671||0x1f4;return function(_0x32c6ac){logger[_0xa734('0x27')](_0x32c6ac['stack']);if(_0x32c6ac[_0xa734('0x28')]){delete _0x32c6ac['name'];}_0x1d5632[_0xa734('0x1c')](_0x59c671)[_0xa734('0x29')](_0x32c6ac);};}exports[_0xa734('0x2a')]=function(_0x34ac65,_0x34472a){var _0x4d4709={},_0x49c6c8={},_0xe3eecf={'count':0x0,'rows':[]};var _0x513da4=_[_0xa734('0x2b')](db[_0xa734('0x2c')][_0xa734('0x2d')],function(_0x503b4c){return{'name':_0x503b4c[_0xa734('0x2e')],'type':_0x503b4c[_0xa734('0x2f')][_0xa734('0x30')]};});_0x49c6c8[_0xa734('0x31')]=_[_0xa734('0x2b')](_0x513da4,_0xa734('0x28'));_0x49c6c8['query']=_['keys'](_0x34ac65['query']);_0x49c6c8[_0xa734('0x32')]=_[_0xa734('0x33')](_0x49c6c8[_0xa734('0x31')],_0x49c6c8[_0xa734('0x34')]);_0x4d4709['attributes']=_[_0xa734('0x33')](_0x49c6c8['model'],qs[_0xa734('0x35')](_0x34ac65['query'][_0xa734('0x35')]));_0x4d4709[_0xa734('0x36')]=_0x4d4709[_0xa734('0x36')][_0xa734('0x37')]?_0x4d4709['attributes']:_0x49c6c8['model'];if(!_0x34ac65['query'][_0xa734('0x38')](_0xa734('0x39'))){_0x4d4709['limit']=qs[_0xa734('0x3a')](_0x34ac65[_0xa734('0x34')][_0xa734('0x3a')]);_0x4d4709['offset']=qs[_0xa734('0x1e')](_0x34ac65['query'][_0xa734('0x1e')]);}_0x4d4709[_0xa734('0x3b')]=qs[_0xa734('0x3c')](_0x34ac65[_0xa734('0x34')][_0xa734('0x3c')]);_0x4d4709['where']=qs[_0xa734('0x32')](_['pick'](_0x34ac65[_0xa734('0x34')],_0x49c6c8[_0xa734('0x32')]),_0x513da4);if(_0x34ac65['query']['filter']){_0x4d4709[_0xa734('0x3d')]=_[_0xa734('0x3e')](_0x4d4709['where'],{'$or':_['map'](_0x513da4,function(_0x5d6ed9){if(_0x5d6ed9[_0xa734('0x2f')]!==_0xa734('0x3f')){var _0x218012={};_0x218012[_0x5d6ed9['name']]={'$like':'%'+_0x34ac65[_0xa734('0x34')]['filter']+'%'};return _0x218012;}})});}_0x4d4709=_[_0xa734('0x3e')]({},_0x4d4709,_0x34ac65['options']);var _0x3d635c={'where':_0x4d4709[_0xa734('0x3d')]};return db[_0xa734('0x2c')]['count'](_0x3d635c)['then'](function(_0x26ad5a){_0xe3eecf[_0xa734('0x1d')]=_0x26ad5a;if(_0x34ac65[_0xa734('0x34')][_0xa734('0x40')]){_0x4d4709[_0xa734('0x41')]=[{'all':!![]}];}return db[_0xa734('0x2c')][_0xa734('0x42')](_0x4d4709);})[_0xa734('0x24')](function(_0x331fef){_0xe3eecf['rows']=_0x331fef;return _0xe3eecf;})[_0xa734('0x24')](respondWithFilteredResult(_0x34472a,_0x4d4709))[_0xa734('0x43')](handleError(_0x34472a,null));};exports[_0xa734('0x44')]=function(_0x55e3fa,_0x1d84ca){var _0x125f96={'raw':!![],'where':{'id':_0x55e3fa[_0xa734('0x45')]['id']}},_0x1e6bb5={};_0x1e6bb5[_0xa734('0x31')]=_[_0xa734('0x46')](db['VoiceTransferReport'][_0xa734('0x2d')]);_0x1e6bb5[_0xa734('0x34')]=_[_0xa734('0x46')](_0x55e3fa[_0xa734('0x34')]);_0x1e6bb5[_0xa734('0x32')]=_['intersection'](_0x1e6bb5[_0xa734('0x31')],_0x1e6bb5['query']);_0x125f96[_0xa734('0x36')]=_[_0xa734('0x33')](_0x1e6bb5[_0xa734('0x31')],qs[_0xa734('0x35')](_0x55e3fa[_0xa734('0x34')][_0xa734('0x35')]));_0x125f96['attributes']=_0x125f96['attributes']['length']?_0x125f96[_0xa734('0x36')]:_0x1e6bb5[_0xa734('0x31')];if(_0x55e3fa['query'][_0xa734('0x40')]){_0x125f96[_0xa734('0x41')]=[{'all':!![]}];}_0x125f96=_[_0xa734('0x3e')]({},_0x125f96,_0x55e3fa[_0xa734('0x47')]);return db[_0xa734('0x2c')][_0xa734('0x48')](_0x125f96)['then'](handleEntityNotFound(_0x1d84ca,null))[_0xa734('0x24')](respondWithResult(_0x1d84ca,null))[_0xa734('0x43')](handleError(_0x1d84ca,null));};exports['create']=function(_0x53bd12,_0x4a8f0d){return db[_0xa734('0x2c')]['create'](_0x53bd12[_0xa734('0x49')],{})[_0xa734('0x24')](respondWithResult(_0x4a8f0d,0xc9))[_0xa734('0x43')](handleError(_0x4a8f0d,null));};exports[_0xa734('0x23')]=function(_0x36519d,_0x153046){if(_0x36519d[_0xa734('0x49')]['id']){delete _0x36519d[_0xa734('0x49')]['id'];}return db['VoiceTransferReport'][_0xa734('0x48')]({'where':{'id':_0x36519d[_0xa734('0x45')]['id']}})['then'](handleEntityNotFound(_0x153046,null))[_0xa734('0x24')](saveUpdates(_0x36519d[_0xa734('0x49')],null))[_0xa734('0x24')](respondWithResult(_0x153046,null))['catch'](handleError(_0x153046,null));};exports[_0xa734('0x25')]=function(_0x3b67cb,_0x5a4444){return db[_0xa734('0x2c')]['find']({'where':{'id':_0x3b67cb[_0xa734('0x45')]['id']}})[_0xa734('0x24')](handleEntityNotFound(_0x5a4444,null))[_0xa734('0x24')](removeEntity(_0x5a4444,null))[_0xa734('0x43')](handleError(_0x5a4444,null));}; \ No newline at end of file +var _0xf0bb=['offset','limit','status','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','VoiceTransferReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count'];(function(_0x4b9f56,_0x47189e){var _0x15d92b=function(_0x596a3f){while(--_0x596a3f){_0x4b9f56['push'](_0x4b9f56['shift']());}};_0x15d92b(++_0x47189e);}(_0xf0bb,0x1e4));var _0xbf0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0bb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xbf0b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf0b('0x1'));var zipdir=require(_0xbf0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf0b('0x3'));var moment=require(_0xbf0b('0x4'));var BPromise=require(_0xbf0b('0x5'));var Mustache=require(_0xbf0b('0x6'));var util=require(_0xbf0b('0x7'));var path=require('path');var sox=require(_0xbf0b('0x8'));var csv=require(_0xbf0b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf0b('0xa'));var squel=require('squel');var crypto=require(_0xbf0b('0xb'));var jsforce=require(_0xbf0b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf0b('0xd'));var Papa=require(_0xbf0b('0xe'));var Redis=require(_0xbf0b('0xf'));var authService=require(_0xbf0b('0x10'));var qs=require(_0xbf0b('0x11'));var as=require(_0xbf0b('0x12'));var hardwareService=require(_0xbf0b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbf0b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbf0b('0x15'));var db=require(_0xbf0b('0x16'))['db'];function respondWithStatusCode(_0x59fa7d,_0x4b32ef){_0x4b32ef=_0x4b32ef||0xcc;return function(_0x4068c0){if(_0x4068c0){return _0x59fa7d[_0xbf0b('0x17')](_0x4b32ef);}return _0x59fa7d['status'](_0x4b32ef)[_0xbf0b('0x18')]();};}function respondWithResult(_0x2773f0,_0x186fe7){_0x186fe7=_0x186fe7||0xc8;return function(_0x28d78a){if(_0x28d78a){return _0x2773f0['status'](_0x186fe7)[_0xbf0b('0x19')](_0x28d78a);}};}function respondWithFilteredResult(_0x50d3e5,_0x474317){return function(_0x1c11d2){if(_0x1c11d2){var _0x1588e6=_0x1c11d2[_0xbf0b('0x1a')],_0x1c55ea=_0x474317['offset'],_0xdac448=_0x474317[_0xbf0b('0x1b')]+_0x474317[_0xbf0b('0x1c')],_0x57ba69;if(_0xdac448>=_0x1588e6){_0xdac448=_0x1588e6;_0x57ba69=0xc8;}else{_0x57ba69=0xce;}_0x50d3e5[_0xbf0b('0x1d')](_0x57ba69);return _0x50d3e5[_0xbf0b('0x1e')](_0xbf0b('0x1f'),_0x1c55ea+'-'+_0xdac448+'/'+_0x1588e6)[_0xbf0b('0x19')](_0x1c11d2);}return null;};}function patchUpdates(_0x4a080a){return function(_0x2b36e8){try{jsonpatch[_0xbf0b('0x20')](_0x2b36e8,_0x4a080a,!![]);}catch(_0x8e22e0){return BPromise['reject'](_0x8e22e0);}return _0x2b36e8[_0xbf0b('0x21')]();};}function saveUpdates(_0x1e3505,_0x2ba7c7){return function(_0x593197){if(_0x593197){return _0x593197[_0xbf0b('0x22')](_0x1e3505)['then'](function(_0x199912){return _0x199912;});}return null;};}function removeEntity(_0x42e091,_0x225de1){return function(_0x57ac8d){if(_0x57ac8d){return _0x57ac8d[_0xbf0b('0x23')]()[_0xbf0b('0x24')](function(){_0x42e091[_0xbf0b('0x1d')](0xcc)[_0xbf0b('0x18')]();});}};}function handleEntityNotFound(_0x57ff35,_0x498e4a){return function(_0x6353a6){if(!_0x6353a6){_0x57ff35['sendStatus'](0x194);}return _0x6353a6;};}function handleError(_0x78586b,_0x40eaf8){_0x40eaf8=_0x40eaf8||0x1f4;return function(_0x5c08e9){logger[_0xbf0b('0x25')](_0x5c08e9['stack']);if(_0x5c08e9[_0xbf0b('0x26')]){delete _0x5c08e9['name'];}_0x78586b[_0xbf0b('0x1d')](_0x40eaf8)[_0xbf0b('0x27')](_0x5c08e9);};}exports[_0xbf0b('0x28')]=function(_0x39f90e,_0x1c6ad5){var _0x2a100d={},_0x1324e3={},_0x3f8885={'count':0x0,'rows':[]};var _0xa31809=_[_0xbf0b('0x29')](db[_0xbf0b('0x2a')]['rawAttributes'],function(_0x2f1213){return{'name':_0x2f1213[_0xbf0b('0x2b')],'type':_0x2f1213[_0xbf0b('0x2c')]['key']};});_0x1324e3[_0xbf0b('0x2d')]=_[_0xbf0b('0x29')](_0xa31809,_0xbf0b('0x26'));_0x1324e3[_0xbf0b('0x2e')]=_[_0xbf0b('0x2f')](_0x39f90e['query']);_0x1324e3[_0xbf0b('0x30')]=_[_0xbf0b('0x31')](_0x1324e3[_0xbf0b('0x2d')],_0x1324e3['query']);_0x2a100d['attributes']=_[_0xbf0b('0x31')](_0x1324e3[_0xbf0b('0x2d')],qs[_0xbf0b('0x32')](_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x32')]));_0x2a100d[_0xbf0b('0x33')]=_0x2a100d['attributes'][_0xbf0b('0x34')]?_0x2a100d[_0xbf0b('0x33')]:_0x1324e3['model'];if(!_0x39f90e['query'][_0xbf0b('0x35')](_0xbf0b('0x36'))){_0x2a100d[_0xbf0b('0x1c')]=qs[_0xbf0b('0x1c')](_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x1c')]);_0x2a100d['offset']=qs['offset'](_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x1b')]);}_0x2a100d['order']=qs[_0xbf0b('0x37')](_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x37')]);_0x2a100d[_0xbf0b('0x38')]=qs['filters'](_[_0xbf0b('0x39')](_0x39f90e[_0xbf0b('0x2e')],_0x1324e3[_0xbf0b('0x30')]),_0xa31809);if(_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x3a')]){_0x2a100d[_0xbf0b('0x38')]=_[_0xbf0b('0x3b')](_0x2a100d[_0xbf0b('0x38')],{'$or':_[_0xbf0b('0x29')](_0xa31809,function(_0x39a41a){if(_0x39a41a[_0xbf0b('0x2c')]!==_0xbf0b('0x3c')){var _0x5eebfc={};_0x5eebfc[_0x39a41a['name']]={'$like':'%'+_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x3a')]+'%'};return _0x5eebfc;}})});}_0x2a100d=_[_0xbf0b('0x3b')]({},_0x2a100d,_0x39f90e[_0xbf0b('0x3d')]);var _0x58025c={'where':_0x2a100d[_0xbf0b('0x38')]};return db[_0xbf0b('0x2a')][_0xbf0b('0x1a')](_0x58025c)[_0xbf0b('0x24')](function(_0x5e1b6a){_0x3f8885[_0xbf0b('0x1a')]=_0x5e1b6a;if(_0x39f90e[_0xbf0b('0x2e')][_0xbf0b('0x3e')]){_0x2a100d[_0xbf0b('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xbf0b('0x40')](_0x2a100d);})[_0xbf0b('0x24')](function(_0x19d746){_0x3f8885[_0xbf0b('0x41')]=_0x19d746;return _0x3f8885;})[_0xbf0b('0x24')](respondWithFilteredResult(_0x1c6ad5,_0x2a100d))[_0xbf0b('0x42')](handleError(_0x1c6ad5,null));};exports[_0xbf0b('0x43')]=function(_0x11cf2b,_0x25e4bf){var _0x115b0e={'raw':!![],'where':{'id':_0x11cf2b[_0xbf0b('0x44')]['id']}},_0x2e06fc={};_0x2e06fc['model']=_[_0xbf0b('0x2f')](db[_0xbf0b('0x2a')][_0xbf0b('0x45')]);_0x2e06fc[_0xbf0b('0x2e')]=_[_0xbf0b('0x2f')](_0x11cf2b['query']);_0x2e06fc[_0xbf0b('0x30')]=_[_0xbf0b('0x31')](_0x2e06fc[_0xbf0b('0x2d')],_0x2e06fc['query']);_0x115b0e[_0xbf0b('0x33')]=_[_0xbf0b('0x31')](_0x2e06fc[_0xbf0b('0x2d')],qs[_0xbf0b('0x32')](_0x11cf2b[_0xbf0b('0x2e')]['fields']));_0x115b0e[_0xbf0b('0x33')]=_0x115b0e[_0xbf0b('0x33')][_0xbf0b('0x34')]?_0x115b0e[_0xbf0b('0x33')]:_0x2e06fc[_0xbf0b('0x2d')];if(_0x11cf2b[_0xbf0b('0x2e')][_0xbf0b('0x3e')]){_0x115b0e[_0xbf0b('0x3f')]=[{'all':!![]}];}_0x115b0e=_[_0xbf0b('0x3b')]({},_0x115b0e,_0x11cf2b[_0xbf0b('0x3d')]);return db[_0xbf0b('0x2a')][_0xbf0b('0x46')](_0x115b0e)[_0xbf0b('0x24')](handleEntityNotFound(_0x25e4bf,null))[_0xbf0b('0x24')](respondWithResult(_0x25e4bf,null))[_0xbf0b('0x42')](handleError(_0x25e4bf,null));};exports['create']=function(_0x455721,_0xa1be43){return db[_0xbf0b('0x2a')][_0xbf0b('0x47')](_0x455721[_0xbf0b('0x48')],{})['then'](respondWithResult(_0xa1be43,0xc9))[_0xbf0b('0x42')](handleError(_0xa1be43,null));};exports['update']=function(_0x4f9774,_0x386da7){if(_0x4f9774[_0xbf0b('0x48')]['id']){delete _0x4f9774['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x4f9774[_0xbf0b('0x44')]['id']}})[_0xbf0b('0x24')](handleEntityNotFound(_0x386da7,null))['then'](saveUpdates(_0x4f9774['body'],null))[_0xbf0b('0x24')](respondWithResult(_0x386da7,null))[_0xbf0b('0x42')](handleError(_0x386da7,null));};exports[_0xbf0b('0x23')]=function(_0xa1839f,_0x4731fb){return db[_0xbf0b('0x2a')][_0xbf0b('0x46')]({'where':{'id':_0xa1839f['params']['id']}})[_0xbf0b('0x24')](handleEntityNotFound(_0x4731fb,null))['then'](removeEntity(_0x4731fb,null))[_0xbf0b('0x42')](handleError(_0x4731fb,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 771e357..45853e7 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 _0x96da=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','moment','request-promise','path','rimraf','./voiceTransferReport.attributes'];(function(_0x47db3c,_0x5ff1f7){var _0x20ff62=function(_0x334f71){while(--_0x334f71){_0x47db3c['push'](_0x47db3c['shift']());}};_0x20ff62(++_0x5ff1f7);}(_0x96da,0x1d2));var _0xa96d=function(_0x512109,_0x11c56e){_0x512109=_0x512109-0x0;var _0x18fa62=_0x96da[_0x512109];return _0x18fa62;};'use strict';var _=require(_0xa96d('0x0'));var util=require(_0xa96d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa96d('0x2'));var BPromise=require('bluebird');var rp=require(_0xa96d('0x3'));var fs=require('fs');var path=require(_0xa96d('0x4'));var rimraf=require(_0xa96d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa96d('0x6'));module[_0xa96d('0x7')]=function(_0x197d1d,_0x755b10){return _0x197d1d[_0xa96d('0x8')](_0xa96d('0x9'),attributes,{'tableName':_0xa96d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5673=['report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport'];(function(_0x8f1619,_0x597af4){var _0xf0f020=function(_0x11a7cc){while(--_0x11a7cc){_0x8f1619['push'](_0x8f1619['shift']());}};_0xf0f020(++_0x597af4);}(_0x5673,0x145));var _0x3567=function(_0x53e29e,_0x17c540){_0x53e29e=_0x53e29e-0x0;var _0x54c118=_0x5673[_0x53e29e];return _0x54c118;};'use strict';var _=require(_0x3567('0x0'));var util=require(_0x3567('0x1'));var logger=require(_0x3567('0x2'))(_0x3567('0x3'));var moment=require(_0x3567('0x4'));var BPromise=require(_0x3567('0x5'));var rp=require(_0x3567('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3567('0x7'));var config=require('../../config/environment');var attributes=require(_0x3567('0x8'));module[_0x3567('0x9')]=function(_0x49ded1,_0x2864c3){return _0x49ded1['define'](_0x3567('0xa'),attributes,{'tableName':_0x3567('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b4bc02b..731003d 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 _0xa477=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa477,0xe6));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')](_0x5a4e79[_0x7a47('0x1b')],{'raw':_0x5a4e79[_0x7a47('0x1c')]?_0x5a4e79[_0x7a47('0x1c')][_0x7a47('0x1d')]===undefined?!![]:![]:!![]})[_0x7a47('0xd')](function(_0x46e58d){logger['info'](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON[_0x7a47('0x13')](_0x46e58d));_0x4a24b6(_0x46e58d);})[_0x7a47('0x1e')](function(_0x322426){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x322426[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x322426[_0x7a47('0x16')]));});});}; \ No newline at end of file +var _0x87df=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x87df,0x167));var _0xf87d=function(_0x3530d0,_0x4dfb47){_0x3530d0=_0x3530d0-0x0;var _0x2165c6=_0x87df[_0x3530d0];return _0x2165c6;};'use strict';var _=require(_0xf87d('0x0'));var util=require(_0xf87d('0x1'));var moment=require(_0xf87d('0x2'));var BPromise=require(_0xf87d('0x3'));var rs=require(_0xf87d('0x4'));var fs=require('fs');var Redis=require(_0xf87d('0x5'));var db=require(_0xf87d('0x6'))['db'];var utils=require(_0xf87d('0x7'));var logger=require(_0xf87d('0x8'))(_0xf87d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf87d('0xa')][_0xf87d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f6003,_0x24a795,_0x3870f8){return new BPromise(function(_0x339d17,_0x19956f){return client[_0xf87d('0xc')](_0x4f6003,_0x3870f8)[_0xf87d('0xd')](function(_0x210aef){logger[_0xf87d('0xe')](_0xf87d('0xf'),_0x24a795,_0xf87d('0x10'));logger[_0xf87d('0x11')](_0xf87d('0x12'),_0x24a795,_0xf87d('0x10'),JSON[_0xf87d('0x13')](_0x210aef));if(_0x210aef[_0xf87d('0x14')]){if(_0x210aef['error'][_0xf87d('0x15')]===0x1f4){logger[_0xf87d('0x14')](_0xf87d('0xf'),_0x24a795,_0x210aef['error'][_0xf87d('0x16')]);return _0x19956f(_0x210aef[_0xf87d('0x14')][_0xf87d('0x16')]);}logger[_0xf87d('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x24a795,_0x210aef[_0xf87d('0x14')][_0xf87d('0x16')]);return _0x339d17(_0x210aef['error'][_0xf87d('0x16')]);}else{logger[_0xf87d('0xe')](_0xf87d('0xf'),_0x24a795,_0xf87d('0x10'));_0x339d17(_0x210aef[_0xf87d('0x17')][_0xf87d('0x16')]);}})[_0xf87d('0x18')](function(_0x5cc044){logger[_0xf87d('0x14')](_0xf87d('0xf'),_0x24a795,_0x5cc044);_0x19956f(_0x5cc044);});});}exports[_0xf87d('0x19')]=function(_0x5986ec){var _0x9c080=this;return new Promise(function(_0x1e6627,_0x39461e){return db[_0xf87d('0x1a')][_0xf87d('0x1b')](_0x5986ec[_0xf87d('0x1c')],{'raw':_0x5986ec['options']?_0x5986ec[_0xf87d('0x1d')][_0xf87d('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2e5a73){logger[_0xf87d('0xe')](_0xf87d('0x19'),_0x5986ec);logger[_0xf87d('0x11')](_0xf87d('0x19'),_0x5986ec,JSON[_0xf87d('0x13')](_0x2e5a73));_0x1e6627(_0x2e5a73);})[_0xf87d('0x18')](function(_0x5b7ac5){logger[_0xf87d('0x14')](_0xf87d('0x19'),_0x5b7ac5[_0xf87d('0x16')],_0x5986ec);_0x39461e(_0x9c080[_0xf87d('0x14')](0x1f4,_0x5b7ac5[_0xf87d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 67ef760..4629ebf 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 _0x167e=['exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','hangup','/answer','/hold','hold','/unhold','unhold','calls','/transfer','transfer'];(function(_0x5dcd95,_0x1e72d4){var _0x271b17=function(_0x57b81b){while(--_0x57b81b){_0x5dcd95['push'](_0x5dcd95['shift']());}};_0x271b17(++_0x1e72d4);}(_0x167e,0xa3));var _0xe167=function(_0x5a8c50,_0x2f986a){_0x5a8c50=_0x5a8c50-0x0;var _0x185612=_0x167e[_0x5a8c50];return _0x185612;};'use strict';var express=require(_0xe167('0x0'));var router=express[_0xe167('0x1')]();var auth=require(_0xe167('0x2'));var controller=require(_0xe167('0x3'));router[_0xe167('0x4')](_0xe167('0x5'),auth[_0xe167('0x6')](),auth[_0xe167('0x7')](),controller['originate']);router[_0xe167('0x4')]('/hangup',auth[_0xe167('0x6')](),auth[_0xe167('0x7')](),controller[_0xe167('0x8')]);router[_0xe167('0x4')](_0xe167('0x9'),auth['isAuthenticated'](),auth[_0xe167('0x7')](),controller['answer']);router[_0xe167('0x4')](_0xe167('0xa'),auth[_0xe167('0x6')](),auth[_0xe167('0x7')](),controller[_0xe167('0xb')]);router[_0xe167('0x4')](_0xe167('0xc'),auth[_0xe167('0x6')](),auth['canUpdate'](),controller[_0xe167('0xd')]);router[_0xe167('0x4')]('/calls',auth[_0xe167('0x6')](),auth[_0xe167('0x7')](),controller[_0xe167('0xe')]);router[_0xe167('0x4')](_0xe167('0xf'),auth[_0xe167('0x6')](),auth[_0xe167('0x7')](),controller[_0xe167('0x10')]);module[_0xe167('0x11')]=router; \ No newline at end of file +var _0x0a34=['originate','isAuthenticated','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls','/transfer','transfer','exports','express','Router','./webbar.controller','post','/originate','canUpdate'];(function(_0x3acb3e,_0x5da839){var _0x41518b=function(_0x26a991){while(--_0x26a991){_0x3acb3e['push'](_0x3acb3e['shift']());}};_0x41518b(++_0x5da839);}(_0x0a34,0x12a));var _0x40a3=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0a34[_0x422905];return _0x33dc6c;};'use strict';var express=require(_0x40a3('0x0'));var router=express[_0x40a3('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x40a3('0x2'));router[_0x40a3('0x3')](_0x40a3('0x4'),auth['isAuthenticated'](),auth[_0x40a3('0x5')](),controller[_0x40a3('0x6')]);router[_0x40a3('0x3')]('/hangup',auth[_0x40a3('0x7')](),auth[_0x40a3('0x5')](),controller[_0x40a3('0x8')]);router[_0x40a3('0x3')](_0x40a3('0x9'),auth[_0x40a3('0x7')](),auth['canUpdate'](),controller[_0x40a3('0xa')]);router[_0x40a3('0x3')](_0x40a3('0xb'),auth[_0x40a3('0x7')](),auth[_0x40a3('0x5')](),controller[_0x40a3('0xc')]);router['post'](_0x40a3('0xd'),auth[_0x40a3('0x7')](),auth[_0x40a3('0x5')](),controller['unhold']);router[_0x40a3('0x3')](_0x40a3('0xe'),auth['isAuthenticated'](),auth[_0x40a3('0x5')](),controller[_0x40a3('0xf')]);router['post'](_0x40a3('0x10'),auth[_0x40a3('0x7')](),auth['canUpdate'](),controller[_0x40a3('0x11')]);module[_0x40a3('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index de4405d..0b17efe 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 _0xa2ab=['callerId','info','format','user:%s','webbar:originate','originate\x20executed!','hangup','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','entityFound:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber'];(function(_0xf77fee,_0x2e2285){var _0x3ce407=function(_0x2e49c8){while(--_0x2e49c8){_0xf77fee['push'](_0xf77fee['shift']());}};_0x3ce407(++_0x2e2285);}(_0xa2ab,0xa7));var _0xba2a=function(_0x3968c8,_0x4f3085){_0x3968c8=_0x3968c8-0x0;var _0x3536d2=_0xa2ab[_0x3968c8];return _0x3536d2;};'use strict';var path=require(_0xba2a('0x0'));var fs=require('fs');var _=require(_0xba2a('0x1'));var db=require(_0xba2a('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xba2a('0x3'));var BPromise=require(_0xba2a('0x4'));var jayson=require(_0xba2a('0x5'));var amiClient=jayson[_0xba2a('0x6')][_0xba2a('0x7')]({'port':0x232a});var logger=require(_0xba2a('0x8'))(_0xba2a('0x9'));var Redis=require('ioredis');config[_0xba2a('0xa')]=_[_0xba2a('0xb')](config[_0xba2a('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xba2a('0xc'))(new Redis(config[_0xba2a('0xa')]));var Schema=require(_0xba2a('0xd'));var originateValidation=new Schema({'userId':{'type':_0xba2a('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xba2a('0xf'),'required':[!![],_0xba2a('0x10')]},'callerId':{'type':_0xba2a('0xf')},'callbackUrl':{'type':_0xba2a('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xba2a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xba2a('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xba2a('0xe'),'required':[!![],_0xba2a('0x11')]},'sessionId':{'type':_0xba2a('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xba2a('0x11')]},'sessionId':{'type':_0xba2a('0xf'),'required':[!![],_0xba2a('0x12')]},'transferNumber':{'type':_0xba2a('0xf'),'required':[!![],_0xba2a('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xba2a('0x11')]},'sessionId':{'type':_0xba2a('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xba2a('0xe'),'required':[!![],_0xba2a('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xba2a('0xe'),'required':[!![],_0xba2a('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xba2a('0xe'),'required':[!![],_0xba2a('0x11')]}});function emit(_0x4b9f63,_0x404885,_0x25f517){logger['info'](_0x4b9f63,_0x404885,JSON[_0xba2a('0x14')](_0x25f517));io['to'](_0x4b9f63)['emit'](_0x404885,_0x25f517);}function handleError(_0x5d40f6){return function(_0x559c6e){console[_0xba2a('0x15')](_0xba2a('0x16'),_0x559c6e,_0x559c6e instanceof RangeError);logger[_0xba2a('0x17')](_0x559c6e[_0xba2a('0x18')]);if(_0x559c6e instanceof RangeError){if(_0x559c6e['name']){delete _0x559c6e[_0xba2a('0x19')];}_0x5d40f6[_0xba2a('0x1a')](0x194)['send'](_0x559c6e);}else{if(_0x559c6e[_0xba2a('0x19')]){delete _0x559c6e['name'];}_0x5d40f6[_0xba2a('0x1a')](0x1f4)[_0xba2a('0x1b')](_0x559c6e);}};}function checkError(){return function(_0x3e7afa){if(!_0x3e7afa){throw new RangeError(_0xba2a('0x1c'));}return _0x3e7afa;};}function respondWithRpcPromise(_0x3cd149,_0x3b4c40){return new BPromise(function(_0x55565d,_0x2e0712){var _0x2cc3db=amiClient;return _0x2cc3db[_0xba2a('0x1d')](_0x3cd149,_0x3b4c40)[_0xba2a('0x1e')](function(_0x3bc8e1){if(_0x3bc8e1['error']){if(_0x3bc8e1[_0xba2a('0x17')][_0xba2a('0x1f')]===0x1f4){return _0x2e0712(_0x3bc8e1[_0xba2a('0x17')][_0xba2a('0x20')]);}return _0x55565d(_0x3bc8e1[_0xba2a('0x17')][_0xba2a('0x20')]);}else{_0x55565d(_0x3bc8e1[_0xba2a('0x21')]);}})[_0xba2a('0x22')](function(_0x4bba7a){_0x2e0712(_0x4bba7a);});});}function getAgent(_0x1c990d){return db[_0xba2a('0x23')][_0xba2a('0x24')]({'where':{'id':_0x1c990d,'role':_0xba2a('0x25')}})['then'](checkError());}function getAgentCheckSession(_0x2e627b,_0x2c6b37){return new BPromise(function(_0x2af93a,_0x5a1b31){var _0x4fca78=respondWithRpcPromise(_0xba2a('0x26'));var _0x2f292b=getAgent(_0x2e627b);Promise[_0xba2a('0x27')]([_0x4fca78,_0x2f292b])[_0xba2a('0x1e')](function(_0x3aa95a){var _0x403372=_0x3aa95a[0x0];var _0x85d5a4=_0x3aa95a[0x1];var _0x46e861=_[_0xba2a('0x28')](_0x403372[_0xba2a('0x29')],function(_0x53f32d){return _0x53f32d[_0xba2a('0x2a')]==_0x85d5a4['id']&&_0x53f32d[_0xba2a('0x2b')]==_0x2c6b37;});if(_0x46e861[_0xba2a('0x2c')]==0x1){_0x2af93a(_0x85d5a4);}else{_0x5a1b31(new RangeError(_0xba2a('0x2d')+_0x2c6b37+'\x20not\x20found!'));}});});}exports[_0xba2a('0x2e')]=function(_0xf75143,_0x3ec14f){logger['info'](_0xba2a('0x2f'),_0xf75143[_0xba2a('0x30')]);var _0x12979d=originateValidation[_0xba2a('0xd')](_0xf75143[_0xba2a('0x30')]);if(_0x12979d[_0xba2a('0x2c')]>0x0){return _0x3ec14f[_0xba2a('0x1a')](0x190)[_0xba2a('0x31')](_0x12979d);}var _0x52e0ef=_0xf75143[_0xba2a('0x30')][_0xba2a('0x32')];var _0x286990=_0xf75143[_0xba2a('0x30')][_0xba2a('0x33')];var _0x5afca4=_0xf75143[_0xba2a('0x30')][_0xba2a('0x34')];var _0x408a0b=_0xf75143[_0xba2a('0x30')]['callbackUrl'];return getAgent(_0x52e0ef)[_0xba2a('0x1e')](function(_0x58b903){logger[_0xba2a('0x35')]('entityFound:',_0x58b903[_0xba2a('0x19')]);emit(util[_0xba2a('0x36')](_0xba2a('0x37'),_0x58b903['name']),_0xba2a('0x38'),{'callNumber':_0x286990,'callerId':_0x5afca4,'callbackUrl':_0x408a0b});return _0x3ec14f[_0xba2a('0x1a')](0xc8)[_0xba2a('0x31')]({'error':![],'message':_0xba2a('0x39')});})[_0xba2a('0x22')](handleError(_0x3ec14f));};exports[_0xba2a('0x3a')]=function(_0x31ecc4,_0x4c016c){logger[_0xba2a('0x35')]('hangup\x20fired:',_0x31ecc4[_0xba2a('0x30')]);var _0x380f30=hangupValidation['validate'](_0x31ecc4['body']);if(_0x380f30['length']>0x0){return _0x4c016c['status'](0x190)[_0xba2a('0x31')](_0x380f30);}var _0x5d69fe=_0x31ecc4[_0xba2a('0x30')][_0xba2a('0x32')];var _0x592e75=_0x31ecc4[_0xba2a('0x30')][_0xba2a('0x2b')];return getAgent(_0x5d69fe)[_0xba2a('0x1e')](function(_0x53fcc1){logger[_0xba2a('0x35')]('entityFound:',_0x53fcc1[_0xba2a('0x19')]);emit(util[_0xba2a('0x36')](_0xba2a('0x37'),_0x53fcc1['name']),_0xba2a('0x3b'),{'sessionId':_0x592e75});return _0x4c016c[_0xba2a('0x1a')](0xc8)[_0xba2a('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0xba2a('0x22')](handleError(_0x4c016c));};exports[_0xba2a('0x3c')]=function(_0x531a55,_0x23b3e7){logger[_0xba2a('0x35')](_0xba2a('0x3d'),_0x531a55[_0xba2a('0x30')]);var _0x38d98c=answerValidation[_0xba2a('0xd')](_0x531a55[_0xba2a('0x30')]);if(_0x38d98c[_0xba2a('0x2c')]>0x0){return _0x23b3e7[_0xba2a('0x1a')](0x190)['json'](_0x38d98c);}var _0x329b46=_0x531a55[_0xba2a('0x30')]['userId'];var _0x23b790=_0x531a55[_0xba2a('0x30')][_0xba2a('0x2b')];return getAgent(_0x329b46)[_0xba2a('0x1e')](function(_0x51ff70){logger['info']('entityFound:',_0x51ff70['name']);emit(util[_0xba2a('0x36')](_0xba2a('0x37'),_0x51ff70['name']),'webbar:answer',{'sessionId':_0x23b790});return _0x23b3e7['status'](0xc8)[_0xba2a('0x31')]({'error':![],'message':_0xba2a('0x3e')});})['catch'](handleError(_0x23b3e7));};exports['hold']=function(_0x3df4de,_0xf24d3d){logger['info'](_0xba2a('0x3f'),_0x3df4de[_0xba2a('0x30')]);var _0x365241=holdValidation['validate'](_0x3df4de[_0xba2a('0x30')]);if(_0x365241['length']>0x0){return _0xf24d3d[_0xba2a('0x1a')](0x190)['json'](_0x365241);}var _0x317bd8=_0x3df4de[_0xba2a('0x30')][_0xba2a('0x32')];var _0x2f1e90=_0x3df4de[_0xba2a('0x30')][_0xba2a('0x2b')];return getAgent(_0x317bd8)['then'](function(_0x46d4f8){logger['info'](_0xba2a('0x40'),_0x46d4f8['name']);emit(util[_0xba2a('0x36')](_0xba2a('0x37'),_0x46d4f8[_0xba2a('0x19')]),'webbar:hold',{'sessionId':_0x2f1e90});return _0xf24d3d[_0xba2a('0x1a')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0xba2a('0x22')](handleError(_0xf24d3d));};exports['unhold']=function(_0x4f16c2,_0x236a31){logger[_0xba2a('0x35')]('unhold\x20fired:',_0x4f16c2[_0xba2a('0x30')]);var _0x45ea28=unholdValidation[_0xba2a('0xd')](_0x4f16c2['body']);if(_0x45ea28['length']>0x0){return _0x236a31[_0xba2a('0x1a')](0x190)[_0xba2a('0x31')](_0x45ea28);}var _0x9e7df5=_0x4f16c2[_0xba2a('0x30')][_0xba2a('0x32')];var _0x2c51d1=_0x4f16c2[_0xba2a('0x30')][_0xba2a('0x2b')];return getAgent(_0x9e7df5)[_0xba2a('0x1e')](function(_0x40e655){logger['info'](_0xba2a('0x40'),_0x40e655['name']);emit(util[_0xba2a('0x36')](_0xba2a('0x37'),_0x40e655['name']),_0xba2a('0x41'),{'sessionId':_0x2c51d1});return _0x236a31[_0xba2a('0x1a')](0xc8)[_0xba2a('0x31')]({'error':![],'message':_0xba2a('0x42')});})[_0xba2a('0x22')](handleError(_0x236a31));};exports[_0xba2a('0x43')]=function(_0x58a823,_0x367c38){logger['info'](_0xba2a('0x44'),_0x367c38[_0xba2a('0x30')]);var _0x1db317=callsValidation['validate'](_0x58a823[_0xba2a('0x30')]);if(_0x1db317[_0xba2a('0x2c')]>0x0){return _0x367c38[_0xba2a('0x1a')](0x190)['json'](_0x1db317);}var _0x5b9e4a=_0x58a823[_0xba2a('0x30')][_0xba2a('0x32')];var _0x20c1ce=respondWithRpcPromise(_0xba2a('0x26'));var _0x3c3fad=getAgent(_0x5b9e4a);return Promise['all']([_0x20c1ce,_0x3c3fad])[_0xba2a('0x1e')](function(_0x34324f){var _0x24de23=_0x34324f[0x0];var _0x2a54f7=_0x34324f[0x1];var _0x52292b=_[_0xba2a('0x28')](_0x24de23[_0xba2a('0x29')],function(_0xabccb9){return _0xabccb9[_0xba2a('0x2a')]==_0x2a54f7['id'];});return _0x367c38['status'](0xc8)[_0xba2a('0x31')]({'count':_0x52292b[_0xba2a('0x2c')],'rows':_0x52292b});})[_0xba2a('0x22')](handleError(_0x367c38));};exports['conference']=function(_0x433e6f,_0x30afa4){logger[_0xba2a('0x35')]('conference\x20fired:',_0x433e6f['body']);var _0x284399=conferenceValidation[_0xba2a('0xd')](_0x433e6f['body']);if(_0x284399['length']>0x0){return _0x30afa4[_0xba2a('0x1a')](0x190)[_0xba2a('0x31')](_0x284399);}var _0x26cfb8=_0x433e6f['body'][_0xba2a('0x32')];return getAgent(_0x26cfb8)[_0xba2a('0x1e')](function(_0x517bd6){logger[_0xba2a('0x35')]('entityFound:',_0x517bd6[_0xba2a('0x19')]);emit(util[_0xba2a('0x36')]('user:%s',_0x517bd6[_0xba2a('0x19')]),_0xba2a('0x45'));return _0x30afa4[_0xba2a('0x1a')](0xc8)[_0xba2a('0x31')]({'error':![],'message':_0xba2a('0x46')});})[_0xba2a('0x22')](handleError(_0x30afa4));};exports['transfer']=function(_0x2f87e5,_0x330749){logger[_0xba2a('0x35')](_0xba2a('0x47'),_0x2f87e5[_0xba2a('0x30')]);var _0xd165cd=transferValidation['validate'](_0x2f87e5[_0xba2a('0x30')]);if(_0xd165cd[_0xba2a('0x2c')]>0x0){return _0x330749[_0xba2a('0x1a')](0x190)['json'](_0xd165cd);}var _0x585b1c=_0x2f87e5[_0xba2a('0x30')][_0xba2a('0x32')];var _0x592fd1=_0x2f87e5[_0xba2a('0x30')][_0xba2a('0x2b')];var _0x4de8d3=_0x2f87e5[_0xba2a('0x30')]['transferNumber'];return getAgent(_0x585b1c)['then'](function(_0x6c6c74){logger[_0xba2a('0x35')](_0xba2a('0x40'),_0x6c6c74[_0xba2a('0x19')]);emit(util[_0xba2a('0x36')](_0xba2a('0x37'),_0x6c6c74[_0xba2a('0x19')]),'webbar:transfer',{'sessionId':_0x592fd1,'transferNumber':_0x4de8d3});return _0x330749['status'](0xc8)[_0xba2a('0x31')]({'error':![],'message':_0xba2a('0x48')});})['catch'](handleError(_0x330749));}; \ No newline at end of file +var _0x6ede=['json','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','answer','format','webbar:answer','hold','hold\x20fired:','userId','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','callNumber\x20is\x20required','string','number','userId\x20is\x20required','info','stringify','emit','handleError:','name','status','send','NotFound','request','error','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','sessionId','sessionId\x20','originate\x20fired:','body','length'];(function(_0x58a686,_0x91cb1a){var _0xd3179c=function(_0x43814e){while(--_0x43814e){_0x58a686['push'](_0x58a686['shift']());}};_0xd3179c(++_0x91cb1a);}(_0x6ede,0x140));var _0xe6ed=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x6ede[_0xcb19e1];return _0x121872;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xe6ed('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xe6ed('0x1'));var util=require(_0xe6ed('0x2'));var BPromise=require(_0xe6ed('0x3'));var jayson=require(_0xe6ed('0x4'));var amiClient=jayson[_0xe6ed('0x5')][_0xe6ed('0x6')]({'port':0x232a});var logger=require(_0xe6ed('0x7'))('webbarapi');var Redis=require(_0xe6ed('0x8'));config[_0xe6ed('0x9')]=_[_0xe6ed('0xa')](config[_0xe6ed('0x9')],{'host':_0xe6ed('0xb'),'port':0x18eb});var io=require(_0xe6ed('0xc'))(new Redis(config[_0xe6ed('0x9')]));var Schema=require(_0xe6ed('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xe6ed('0xe')]},'callerId':{'type':_0xe6ed('0xf')},'callbackUrl':{'type':_0xe6ed('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xe6ed('0x10'),'required':[!![],_0xe6ed('0x11')]},'sessionId':{'type':_0xe6ed('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe6ed('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe6ed('0x11')]},'sessionId':{'type':_0xe6ed('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xe6ed('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe6ed('0x10'),'required':[!![],_0xe6ed('0x11')]},'sessionId':{'type':_0xe6ed('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe6ed('0x10'),'required':[!![],_0xe6ed('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe6ed('0x10'),'required':[!![],_0xe6ed('0x11')]}});function emit(_0x3f4e5d,_0x3f4322,_0x2ec35c){logger[_0xe6ed('0x12')](_0x3f4e5d,_0x3f4322,JSON[_0xe6ed('0x13')](_0x2ec35c));io['to'](_0x3f4e5d)[_0xe6ed('0x14')](_0x3f4322,_0x2ec35c);}function handleError(_0x5c40f0){return function(_0x25cd96){console['log'](_0xe6ed('0x15'),_0x25cd96,_0x25cd96 instanceof RangeError);logger['error'](_0x25cd96['stack']);if(_0x25cd96 instanceof RangeError){if(_0x25cd96[_0xe6ed('0x16')]){delete _0x25cd96[_0xe6ed('0x16')];}_0x5c40f0[_0xe6ed('0x17')](0x194)[_0xe6ed('0x18')](_0x25cd96);}else{if(_0x25cd96['name']){delete _0x25cd96[_0xe6ed('0x16')];}_0x5c40f0['status'](0x1f4)[_0xe6ed('0x18')](_0x25cd96);}};}function checkError(){return function(_0x556ecc){if(!_0x556ecc){throw new RangeError(_0xe6ed('0x19'));}return _0x556ecc;};}function respondWithRpcPromise(_0x5e96a5,_0x54f1d9){return new BPromise(function(_0xe9a1c3,_0x39bf78){var _0x314e1f=amiClient;return _0x314e1f[_0xe6ed('0x1a')](_0x5e96a5,_0x54f1d9)['then'](function(_0x1f5b45){if(_0x1f5b45[_0xe6ed('0x1b')]){if(_0x1f5b45['error'][_0xe6ed('0x1c')]===0x1f4){return _0x39bf78(_0x1f5b45[_0xe6ed('0x1b')]['message']);}return _0xe9a1c3(_0x1f5b45['error'][_0xe6ed('0x1d')]);}else{_0xe9a1c3(_0x1f5b45[_0xe6ed('0x1e')]);}})[_0xe6ed('0x1f')](function(_0x27012e){_0x39bf78(_0x27012e);});});}function getAgent(_0x21d820){return db[_0xe6ed('0x20')][_0xe6ed('0x21')]({'where':{'id':_0x21d820,'role':_0xe6ed('0x22')}})[_0xe6ed('0x23')](checkError());}function getAgentCheckSession(_0x407f68,_0x22cf27){return new BPromise(function(_0x4bce24,_0x1189e3){var _0x144257=respondWithRpcPromise(_0xe6ed('0x24'));var _0x58238e=getAgent(_0x407f68);Promise[_0xe6ed('0x25')]([_0x144257,_0x58238e])[_0xe6ed('0x23')](function(_0x1be999){var _0x462ff0=_0x1be999[0x0];var _0x1fe284=_0x1be999[0x1];var _0x1c881d=_[_0xe6ed('0x26')](_0x462ff0[_0xe6ed('0x27')],function(_0x42e8e6){return _0x42e8e6['UserId']==_0x1fe284['id']&&_0x42e8e6[_0xe6ed('0x28')]==_0x22cf27;});if(_0x1c881d['length']==0x1){_0x4bce24(_0x1fe284);}else{_0x1189e3(new RangeError(_0xe6ed('0x29')+_0x22cf27+'\x20not\x20found!'));}});});}exports['originate']=function(_0x370b9f,_0x2314b0){logger[_0xe6ed('0x12')](_0xe6ed('0x2a'),_0x370b9f[_0xe6ed('0x2b')]);var _0x9a2e41=originateValidation[_0xe6ed('0xd')](_0x370b9f[_0xe6ed('0x2b')]);if(_0x9a2e41[_0xe6ed('0x2c')]>0x0){return _0x2314b0[_0xe6ed('0x17')](0x190)[_0xe6ed('0x2d')](_0x9a2e41);}var _0xd1c047=_0x370b9f[_0xe6ed('0x2b')]['userId'];var _0x3d7c36=_0x370b9f[_0xe6ed('0x2b')][_0xe6ed('0x2e')];var _0x43a1a7=_0x370b9f[_0xe6ed('0x2b')]['callerId'];var _0x3d93fe=_0x370b9f[_0xe6ed('0x2b')][_0xe6ed('0x2f')];return getAgent(_0xd1c047)[_0xe6ed('0x23')](function(_0x19615d){logger['info'](_0xe6ed('0x30'),_0x19615d[_0xe6ed('0x16')]);emit(util['format'](_0xe6ed('0x31'),_0x19615d[_0xe6ed('0x16')]),_0xe6ed('0x32'),{'callNumber':_0x3d7c36,'callerId':_0x43a1a7,'callbackUrl':_0x3d93fe});return _0x2314b0[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':_0xe6ed('0x33')});})[_0xe6ed('0x1f')](handleError(_0x2314b0));};exports['hangup']=function(_0x317a1d,_0x1cb132){logger['info']('hangup\x20fired:',_0x317a1d['body']);var _0xbdd89b=hangupValidation[_0xe6ed('0xd')](_0x317a1d['body']);if(_0xbdd89b[_0xe6ed('0x2c')]>0x0){return _0x1cb132[_0xe6ed('0x17')](0x190)[_0xe6ed('0x2d')](_0xbdd89b);}var _0x74bfb4=_0x317a1d[_0xe6ed('0x2b')]['userId'];var _0x1acdb3=_0x317a1d[_0xe6ed('0x2b')][_0xe6ed('0x28')];return getAgent(_0x74bfb4)[_0xe6ed('0x23')](function(_0x339323){logger['info']('entityFound:',_0x339323[_0xe6ed('0x16')]);emit(util['format'](_0xe6ed('0x31'),_0x339323[_0xe6ed('0x16')]),_0xe6ed('0x34'),{'sessionId':_0x1acdb3});return _0x1cb132[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':'hangup\x20executed!'});})[_0xe6ed('0x1f')](handleError(_0x1cb132));};exports[_0xe6ed('0x35')]=function(_0x3f2c80,_0x35e477){logger[_0xe6ed('0x12')]('answer\x20fired:',_0x3f2c80[_0xe6ed('0x2b')]);var _0x5e5a36=answerValidation[_0xe6ed('0xd')](_0x3f2c80['body']);if(_0x5e5a36['length']>0x0){return _0x35e477[_0xe6ed('0x17')](0x190)[_0xe6ed('0x2d')](_0x5e5a36);}var _0x2b502f=_0x3f2c80[_0xe6ed('0x2b')]['userId'];var _0x597038=_0x3f2c80[_0xe6ed('0x2b')]['sessionId'];return getAgent(_0x2b502f)[_0xe6ed('0x23')](function(_0x544555){logger[_0xe6ed('0x12')]('entityFound:',_0x544555[_0xe6ed('0x16')]);emit(util[_0xe6ed('0x36')]('user:%s',_0x544555[_0xe6ed('0x16')]),_0xe6ed('0x37'),{'sessionId':_0x597038});return _0x35e477[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x35e477));};exports[_0xe6ed('0x38')]=function(_0x25c8bd,_0x5df6ae){logger[_0xe6ed('0x12')](_0xe6ed('0x39'),_0x25c8bd['body']);var _0x46c6bb=holdValidation['validate'](_0x25c8bd['body']);if(_0x46c6bb['length']>0x0){return _0x5df6ae[_0xe6ed('0x17')](0x190)[_0xe6ed('0x2d')](_0x46c6bb);}var _0x39e1ea=_0x25c8bd['body'][_0xe6ed('0x3a')];var _0x3dea78=_0x25c8bd['body'][_0xe6ed('0x28')];return getAgent(_0x39e1ea)[_0xe6ed('0x23')](function(_0x3ac16c){logger['info'](_0xe6ed('0x30'),_0x3ac16c[_0xe6ed('0x16')]);emit(util[_0xe6ed('0x36')](_0xe6ed('0x31'),_0x3ac16c[_0xe6ed('0x16')]),'webbar:hold',{'sessionId':_0x3dea78});return _0x5df6ae[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':_0xe6ed('0x3b')});})['catch'](handleError(_0x5df6ae));};exports['unhold']=function(_0x202f5b,_0x374093){logger[_0xe6ed('0x12')](_0xe6ed('0x3c'),_0x202f5b['body']);var _0x120a48=unholdValidation[_0xe6ed('0xd')](_0x202f5b[_0xe6ed('0x2b')]);if(_0x120a48[_0xe6ed('0x2c')]>0x0){return _0x374093[_0xe6ed('0x17')](0x190)['json'](_0x120a48);}var _0x230663=_0x202f5b['body'][_0xe6ed('0x3a')];var _0x513553=_0x202f5b[_0xe6ed('0x2b')][_0xe6ed('0x28')];return getAgent(_0x230663)[_0xe6ed('0x23')](function(_0x51b3fc){logger['info'](_0xe6ed('0x30'),_0x51b3fc[_0xe6ed('0x16')]);emit(util['format']('user:%s',_0x51b3fc['name']),_0xe6ed('0x3d'),{'sessionId':_0x513553});return _0x374093[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':_0xe6ed('0x3e')});})[_0xe6ed('0x1f')](handleError(_0x374093));};exports['calls']=function(_0x5ac322,_0x1c5e34){logger['info'](_0xe6ed('0x3f'),_0x1c5e34[_0xe6ed('0x2b')]);var _0x3c7e42=callsValidation[_0xe6ed('0xd')](_0x5ac322[_0xe6ed('0x2b')]);if(_0x3c7e42[_0xe6ed('0x2c')]>0x0){return _0x1c5e34[_0xe6ed('0x17')](0x190)['json'](_0x3c7e42);}var _0x15a2f5=_0x5ac322[_0xe6ed('0x2b')][_0xe6ed('0x3a')];var _0x35a616=respondWithRpcPromise(_0xe6ed('0x24'));var _0x124def=getAgent(_0x15a2f5);return Promise[_0xe6ed('0x25')]([_0x35a616,_0x124def])[_0xe6ed('0x23')](function(_0x1d6ec0){var _0x15774d=_0x1d6ec0[0x0];var _0x5cb872=_0x1d6ec0[0x1];var _0x2b986e=_[_0xe6ed('0x26')](_0x15774d[_0xe6ed('0x27')],function(_0xd45d57){return _0xd45d57[_0xe6ed('0x40')]==_0x5cb872['id'];});return _0x1c5e34['status'](0xc8)[_0xe6ed('0x2d')]({'count':_0x2b986e[_0xe6ed('0x2c')],'rows':_0x2b986e});})[_0xe6ed('0x1f')](handleError(_0x1c5e34));};exports[_0xe6ed('0x41')]=function(_0x23fea2,_0x36f3dc){logger[_0xe6ed('0x12')](_0xe6ed('0x42'),_0x23fea2[_0xe6ed('0x2b')]);var _0xd59f04=conferenceValidation[_0xe6ed('0xd')](_0x23fea2[_0xe6ed('0x2b')]);if(_0xd59f04['length']>0x0){return _0x36f3dc[_0xe6ed('0x17')](0x190)['json'](_0xd59f04);}var _0x3cbfdf=_0x23fea2[_0xe6ed('0x2b')][_0xe6ed('0x3a')];return getAgent(_0x3cbfdf)[_0xe6ed('0x23')](function(_0x5249f0){logger[_0xe6ed('0x12')]('entityFound:',_0x5249f0[_0xe6ed('0x16')]);emit(util[_0xe6ed('0x36')](_0xe6ed('0x31'),_0x5249f0[_0xe6ed('0x16')]),_0xe6ed('0x43'));return _0x36f3dc[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':_0xe6ed('0x44')});})[_0xe6ed('0x1f')](handleError(_0x36f3dc));};exports[_0xe6ed('0x45')]=function(_0x3a9d69,_0x4599fe){logger[_0xe6ed('0x12')](_0xe6ed('0x46'),_0x3a9d69[_0xe6ed('0x2b')]);var _0x55d423=transferValidation[_0xe6ed('0xd')](_0x3a9d69['body']);if(_0x55d423[_0xe6ed('0x2c')]>0x0){return _0x4599fe[_0xe6ed('0x17')](0x190)[_0xe6ed('0x2d')](_0x55d423);}var _0x330d67=_0x3a9d69[_0xe6ed('0x2b')]['userId'];var _0x1070eb=_0x3a9d69[_0xe6ed('0x2b')][_0xe6ed('0x28')];var _0x240a84=_0x3a9d69[_0xe6ed('0x2b')][_0xe6ed('0x47')];return getAgent(_0x330d67)[_0xe6ed('0x23')](function(_0x19af23){logger[_0xe6ed('0x12')](_0xe6ed('0x30'),_0x19af23[_0xe6ed('0x16')]);emit(util[_0xe6ed('0x36')]('user:%s',_0x19af23[_0xe6ed('0x16')]),_0xe6ed('0x48'),{'sessionId':_0x1070eb,'transferNumber':_0x240a84});return _0x4599fe[_0xe6ed('0x17')](0xc8)[_0xe6ed('0x2d')]({'error':![],'message':'transfer\x20executed!'});})[_0xe6ed('0x1f')](handleError(_0x4599fe));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 07578f0..d412286 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 _0x8e3f=['addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','create','post'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var auth=require(_0xf8e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e3('0x6'));var controller=require(_0xf8e3('0x7'));router['get']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x9')]);router[_0xf8e3('0xa')](_0xf8e3('0xb'),auth['isAuthenticated'](),controller[_0xf8e3('0xc')]);router[_0xf8e3('0xa')](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0xe')]);router[_0xf8e3('0xa')](_0xf8e3('0xf'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x10')]);router[_0xf8e3('0xa')](_0xf8e3('0x11'),auth[_0xf8e3('0x8')](),controller['getAnswers']);router[_0xf8e3('0xa')](_0xf8e3('0x12'),auth[_0xf8e3('0x8')](),controller['getAgents']);router[_0xf8e3('0xa')](_0xf8e3('0x13'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x14')]);router['post']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x15')]);router[_0xf8e3('0x16')]('/:id/dispositions',auth[_0xf8e3('0x8')](),controller['addDisposition']);router[_0xf8e3('0x16')](_0xf8e3('0x11'),auth[_0xf8e3('0x8')](),controller['addAnswer']);router['post'](_0xf8e3('0x12'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x17')]);router[_0xf8e3('0x16')](_0xf8e3('0x13'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x18')]);router[_0xf8e3('0x16')](_0xf8e3('0x19'),controller[_0xf8e3('0x1a')]);router['post'](_0xf8e3('0x1b'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x1c')]);router[_0xf8e3('0x1d')](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x1e')]);router[_0xf8e3('0x1f')]('/:id',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x20')]);router[_0xf8e3('0x1f')](_0xf8e3('0xf'),auth['isAuthenticated'](),controller[_0xf8e3('0x21')]);router['delete'](_0xf8e3('0x11'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x22')]);router[_0xf8e3('0x1f')](_0xf8e3('0x12'),auth[_0xf8e3('0x8')](),controller['removeAgents']);module[_0xf8e3('0x23')]=router; \ No newline at end of file +var _0x4e2e=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create','addAnswer','addAgents','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1cb2df,_0x4f1746){_0x1cb2df=_0x1cb2df-0x0;var _0x226fea=_0x4e2e[_0x1cb2df];return _0x226fea;};'use strict';var multer=require('multer');var util=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var timeout=require(_0xe4e2('0x2'));var express=require(_0xe4e2('0x3'));var router=express[_0xe4e2('0x4')]();var auth=require(_0xe4e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4e2('0x6'));var controller=require(_0xe4e2('0x7'));router[_0xe4e2('0x8')]('/',auth[_0xe4e2('0x9')](),controller['index']);router[_0xe4e2('0x8')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xb')]);router[_0xe4e2('0x8')](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xd')]);router['get'](_0xe4e2('0xe'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xf')]);router['get'](_0xe4e2('0x10'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x11')]);router[_0xe4e2('0x8')](_0xe4e2('0x12'),auth['isAuthenticated'](),controller[_0xe4e2('0x13')]);router[_0xe4e2('0x8')](_0xe4e2('0x14'),auth[_0xe4e2('0x9')](),controller['getApplications']);router[_0xe4e2('0x15')]('/',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x16')]);router[_0xe4e2('0x15')](_0xe4e2('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xe4e2('0x15')](_0xe4e2('0x10'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x17')]);router[_0xe4e2('0x15')]('/:id/users',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x18')]);router[_0xe4e2('0x15')]('/:id/applications',auth[_0xe4e2('0x9')](),controller['addApplications']);router[_0xe4e2('0x15')](_0xe4e2('0x19'),controller[_0xe4e2('0x1a')]);router[_0xe4e2('0x15')](_0xe4e2('0x1b'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x1c')]);router[_0xe4e2('0x1d')](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller['update']);router[_0xe4e2('0x1e')](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x1f')]);router[_0xe4e2('0x1e')](_0xe4e2('0xe'),auth[_0xe4e2('0x9')](),controller['removeDispositions']);router[_0xe4e2('0x1e')](_0xe4e2('0x10'),auth[_0xe4e2('0x9')](),controller['removeAnswers']);router[_0xe4e2('0x1e')](_0xe4e2('0x12'),auth['isAuthenticated'](),controller[_0xe4e2('0x20')]);module[_0xe4e2('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 96b2321..72efc69 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 _0x9c51=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x2d27d0,_0x5436c7){var _0x5cb840=function(_0x3fc79e){while(--_0x3fc79e){_0x2d27d0['push'](_0x2d27d0['shift']());}};_0x5cb840(++_0x5436c7);}(_0x9c51,0x115));var _0x19c5=function(_0xd5bc0e,_0x487905){_0xd5bc0e=_0xd5bc0e-0x0;var _0x32f07d=_0x9c51[_0xd5bc0e];return _0x32f07d;};'use strict';var Sequelize=require(_0x19c5('0x0'));var rs=require(_0x19c5('0x1'));module[_0x19c5('0x2')]={'name':{'type':Sequelize[_0x19c5('0x3')],'unique':_0x19c5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x19c5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x19c5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x19c5('0x3')],'defaultValue':function(){return rs[_0x19c5('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x19c5('0x6')](_0x19c5('0x7'))},'accountSid':{'type':Sequelize[_0x19c5('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x19c5('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x19c5('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x19c5('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x19c5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x19c5('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x19c5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x19c5('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x19c5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x19c5('0xa')],'comment':_0x19c5('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x19c5('0xc'),'set':function(_0xdc8c5f){if(!_0xdc8c5f){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x19c5('0xd')](_0x19c5('0xe'),_0xdc8c5f);}},'description':{'type':Sequelize[_0x19c5('0x3')]}}; \ No newline at end of file +var _0x9503=['sequelize','randomstring','exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x302d71,_0x473e70){var _0x2b42d3=function(_0x4fcaaf){while(--_0x4fcaaf){_0x302d71['push'](_0x302d71['shift']());}};_0x2b42d3(++_0x473e70);}(_0x9503,0x130));var _0x3950=function(_0x225b23,_0x41b812){_0x225b23=_0x225b23-0x0;var _0x5d46e9=_0x9503[_0x225b23];return _0x5d46e9;};'use strict';var Sequelize=require(_0x3950('0x0'));var rs=require(_0x3950('0x1'));module[_0x3950('0x2')]={'name':{'type':Sequelize[_0x3950('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x3950('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3950('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3950('0x3')],'defaultValue':function(){return rs[_0x3950('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3950('0x5')](_0x3950('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3950('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3950('0x7')],'defaultValue':function(){return _0x3950('0x8');}},'notificationSound':{'type':Sequelize[_0x3950('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3950('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3950('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3950('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3950('0xa')],'comment':_0x3950('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3950('0xc'),'set':function(_0x5c877c){if(!_0x5c877c){this[_0x3950('0xd')](_0x3950('0xe'),null);}this[_0x3950('0xd')](_0x3950('0xf'),_0x5c877c);}},'description':{'type':Sequelize[_0x3950('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index cf4ba5d..71d1c42 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 _0x91f5=['Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','ListId','spread','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','stack','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','params','create','body','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','emit','getAgents','User','sequelize','transaction','WhatsappApplication','findAndCountAll','getApplications','whatsapp','account','applications','priority','Applications','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','WhatsappMessage','ContactId','UserId','waitForTheAssignedAgent','*,*,*,*'];(function(_0x3caa12,_0x48c4ff){var _0x3f5587=function(_0x473d4f){while(--_0x473d4f){_0x3caa12['push'](_0x3caa12['shift']());}};_0x3f5587(++_0x48c4ff);}(_0x91f5,0xbc));var _0x591f=function(_0x36cd70,_0x25e1b9){_0x36cd70=_0x36cd70-0x0;var _0x28b1cd=_0x91f5[_0x36cd70];return _0x28b1cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x591f('0x0'));var rimraf=require(_0x591f('0x1'));var zipdir=require(_0x591f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x591f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x591f('0x4'));var util=require('util');var path=require(_0x591f('0x5'));var sox=require(_0x591f('0x6'));var csv=require(_0x591f('0x7'));var ejs=require(_0x591f('0x8'));var fs=require('fs');var _=require(_0x591f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x591f('0xa'));var deskjs=require(_0x591f('0xb'));var toCsv=require(_0x591f('0x7'));var querystring=require('querystring');var Papa=require(_0x591f('0xc'));var Redis=require(_0x591f('0xd'));var authService=require(_0x591f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x591f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x591f('0x10'))(_0x591f('0x11'));var utils=require(_0x591f('0x12'));var config=require(_0x591f('0x13'));var licenseUtil=require(_0x591f('0x14'));var db=require(_0x591f('0x15'))['db'];config[_0x591f('0x16')]=_['defaults'](config[_0x591f('0x16')],{'host':_0x591f('0x17'),'port':0x18eb});var socket=require(_0x591f('0x18'))(new Redis(config[_0x591f('0x16')]));require(_0x591f('0x19'))[_0x591f('0x1a')](socket);var jayson=require(_0x591f('0x1b'));var client=jayson[_0x591f('0x1c')][_0x591f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x507687,_0x4b8eb0,_0x521127,_0x11f01d){return new BPromise(function(_0x9f33b6,_0x30684f){var _0xf0a2f9=_0x11f01d||client;return _0xf0a2f9[_0x591f('0x1e')](_0x507687,_0x521127)[_0x591f('0x1f')](function(_0x569630){logger[_0x591f('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x4b8eb0,'request\x20sent');logger[_0x591f('0x21')](_0x591f('0x22'),_0x4b8eb0,_0x591f('0x23'),JSON[_0x591f('0x24')](_0x569630));if(_0x569630[_0x591f('0x25')]){if(_0x569630['error'][_0x591f('0x26')]===0x1f4){logger[_0x591f('0x25')](_0x591f('0x27'),_0x4b8eb0,_0x569630[_0x591f('0x25')][_0x591f('0x28')]);return _0x30684f(_0x569630[_0x591f('0x25')]['message']);}logger[_0x591f('0x25')](_0x591f('0x27'),_0x4b8eb0,_0x569630[_0x591f('0x25')]['message']);return _0x9f33b6(_0x569630[_0x591f('0x25')][_0x591f('0x28')]);}else{logger['info'](_0x591f('0x27'),_0x4b8eb0,_0x591f('0x23'));_0x9f33b6(_0x569630['result'][_0x591f('0x28')]);}})[_0x591f('0x29')](function(_0x32e6af){logger[_0x591f('0x25')](_0x591f('0x27'),_0x4b8eb0,_0x32e6af);_0x30684f(_0x32e6af);});});}function respondWithStatusCode(_0x33e769,_0x59e556){_0x59e556=_0x59e556||0xcc;return function(_0x4227d4){if(_0x4227d4){return _0x33e769[_0x591f('0x2a')](_0x59e556);}return _0x33e769['status'](_0x59e556)[_0x591f('0x2b')]();};}function respondWithResult(_0x37d2b6,_0x2a3fcd){_0x2a3fcd=_0x2a3fcd||0xc8;return function(_0x25663f){if(_0x25663f){return _0x37d2b6[_0x591f('0x2c')](_0x2a3fcd)[_0x591f('0x2d')](_0x25663f);}};}function respondWithFilteredResult(_0x39b28d,_0x4dd99c){return function(_0xb92b0b){if(_0xb92b0b){var _0x508074=_0xb92b0b[_0x591f('0x2e')],_0x1a9410=_0x4dd99c[_0x591f('0x2f')],_0x5dabea=_0x4dd99c[_0x591f('0x2f')]+_0x4dd99c[_0x591f('0x30')],_0x177cfa;if(_0x5dabea>=_0x508074){_0x5dabea=_0x508074;_0x177cfa=0xc8;}else{_0x177cfa=0xce;}_0x39b28d[_0x591f('0x2c')](_0x177cfa);return _0x39b28d[_0x591f('0x31')](_0x591f('0x32'),_0x1a9410+'-'+_0x5dabea+'/'+_0x508074)[_0x591f('0x2d')](_0xb92b0b);}return null;};}function patchUpdates(_0x1ce1e0){return function(_0x5a7123){try{jsonpatch['apply'](_0x5a7123,_0x1ce1e0,!![]);}catch(_0x447351){return BPromise[_0x591f('0x33')](_0x447351);}return _0x5a7123[_0x591f('0x34')]();};}function saveUpdates(_0x4caf72,_0xe8c05c){return function(_0x1efe65){if(_0x1efe65){return _0x1efe65[_0x591f('0x35')](_0x4caf72)[_0x591f('0x1f')](function(_0x542cba){return _0x542cba;});}return null;};}function removeEntity(_0x246370,_0x12d7d9){return function(_0x59688b){if(_0x59688b){return _0x59688b[_0x591f('0x36')]()['then'](function(){var _0x275b04=_0x59688b[_0x591f('0x37')]({'plain':!![]});var _0x15bd7c=_0x591f('0x38');return db['UserProfileResource'][_0x591f('0x36')]({'where':{'type':_0x15bd7c,'resourceId':_0x275b04['id']}})[_0x591f('0x1f')](function(){return _0x59688b;});})['then'](function(){_0x246370[_0x591f('0x2c')](0xcc)[_0x591f('0x2b')]();});}};}function handleEntityNotFound(_0x4de4ff,_0x4742e8){return function(_0x5b241c){if(!_0x5b241c){_0x4de4ff[_0x591f('0x2a')](0x194);}return _0x5b241c;};}function handleError(_0x369246,_0x1e2900){_0x1e2900=_0x1e2900||0x1f4;return function(_0x178646){logger[_0x591f('0x25')](_0x178646[_0x591f('0x39')]);if(_0x178646['name']){delete _0x178646['name'];}_0x369246[_0x591f('0x2c')](_0x1e2900)['send'](_0x178646);};}exports['index']=function(_0x4a6c46,_0x3c2fbe){var _0x3b5916={'include':[{'model':db[_0x591f('0x3a')],'as':_0x591f('0x3b')}]},_0x5d1ba2={},_0x4a021d={'count':0x0,'rows':[]};var _0x27bde7=_[_0x591f('0x3c')](db[_0x591f('0x3d')][_0x591f('0x3e')],function(_0x3c5abc){return{'name':_0x3c5abc['fieldName'],'type':_0x3c5abc[_0x591f('0x3f')]['key']};});_0x5d1ba2[_0x591f('0x40')]=_[_0x591f('0x3c')](_0x27bde7,_0x591f('0x41'));_0x5d1ba2['query']=_[_0x591f('0x42')](_0x4a6c46[_0x591f('0x43')]);_0x5d1ba2['filters']=_[_0x591f('0x44')](_0x5d1ba2[_0x591f('0x40')],_0x5d1ba2[_0x591f('0x43')]);_0x3b5916[_0x591f('0x45')]=_['intersection'](_0x5d1ba2['model'],qs[_0x591f('0x46')](_0x4a6c46[_0x591f('0x43')][_0x591f('0x46')]));_0x3b5916[_0x591f('0x45')]=_0x3b5916['attributes'][_0x591f('0x47')]?_0x3b5916[_0x591f('0x45')]:_0x5d1ba2[_0x591f('0x40')];if(!_0x4a6c46[_0x591f('0x43')][_0x591f('0x48')](_0x591f('0x49'))){_0x3b5916[_0x591f('0x30')]=qs[_0x591f('0x30')](_0x4a6c46[_0x591f('0x43')]['limit']);_0x3b5916[_0x591f('0x2f')]=qs[_0x591f('0x2f')](_0x4a6c46[_0x591f('0x43')][_0x591f('0x2f')]);}_0x3b5916[_0x591f('0x4a')]=qs[_0x591f('0x4b')](_0x4a6c46['query'][_0x591f('0x4b')]);_0x3b5916[_0x591f('0x4c')]=qs['filters'](_['pick'](_0x4a6c46[_0x591f('0x43')],_0x5d1ba2[_0x591f('0x4d')]),_0x27bde7);if(_0x4a6c46[_0x591f('0x43')][_0x591f('0x4e')]){_0x3b5916[_0x591f('0x4c')]=_[_0x591f('0x4f')](_0x3b5916[_0x591f('0x4c')],{'$or':_['map'](_0x27bde7,function(_0x476717){if(_0x476717[_0x591f('0x3f')]!==_0x591f('0x50')){var _0x27de1e={};_0x27de1e[_0x476717[_0x591f('0x41')]]={'$like':'%'+_0x4a6c46[_0x591f('0x43')]['filter']+'%'};return _0x27de1e;}})});}_0x3b5916=_[_0x591f('0x4f')]({},_0x3b5916,_0x4a6c46[_0x591f('0x51')]);var _0x357aca={'where':_0x3b5916['where']};return db[_0x591f('0x3d')][_0x591f('0x2e')](_0x357aca)[_0x591f('0x1f')](function(_0x1ca96d){_0x4a021d[_0x591f('0x2e')]=_0x1ca96d;if(_0x4a6c46[_0x591f('0x43')][_0x591f('0x52')]){_0x3b5916[_0x591f('0x53')]=[{'all':!![]}];}return db[_0x591f('0x3d')]['findAll'](_0x3b5916);})[_0x591f('0x1f')](function(_0x5c9059){_0x4a021d['rows']=_0x5c9059;return _0x4a021d;})[_0x591f('0x1f')](respondWithFilteredResult(_0x3c2fbe,_0x3b5916))[_0x591f('0x29')](handleError(_0x3c2fbe,null));};exports['show']=function(_0x58d550,_0x23801b){var _0xbf18e9={'raw':![],'where':{'id':_0x58d550[_0x591f('0x54')]['id']},'include':[{'model':db[_0x591f('0x3a')],'as':_0x591f('0x3b')}]},_0x2c01b9={};_0x2c01b9[_0x591f('0x40')]=_['keys'](db['WhatsappAccount'][_0x591f('0x3e')]);_0x2c01b9['query']=_[_0x591f('0x42')](_0x58d550['query']);_0x2c01b9['filters']=_[_0x591f('0x44')](_0x2c01b9[_0x591f('0x40')],_0x2c01b9[_0x591f('0x43')]);_0xbf18e9[_0x591f('0x45')]=_['intersection'](_0x2c01b9[_0x591f('0x40')],qs['fields'](_0x58d550[_0x591f('0x43')][_0x591f('0x46')]));_0xbf18e9[_0x591f('0x45')]=_0xbf18e9['attributes']['length']?_0xbf18e9[_0x591f('0x45')]:_0x2c01b9['model'];if(_0x58d550[_0x591f('0x43')][_0x591f('0x52')]){_0xbf18e9['include']=[{'all':!![]}];}_0xbf18e9=_[_0x591f('0x4f')]({},_0xbf18e9,_0x58d550['options']);return db['WhatsappAccount']['find'](_0xbf18e9)[_0x591f('0x1f')](handleEntityNotFound(_0x23801b,null))[_0x591f('0x1f')](respondWithResult(_0x23801b,null))['catch'](handleError(_0x23801b,null));};exports[_0x591f('0x55')]=function(_0x535f30,_0x1275f0){return db['WhatsappAccount'][_0x591f('0x55')](_0x535f30[_0x591f('0x56')],{})[_0x591f('0x1f')](function(_0x2b1ca3){var _0x37e82b=_0x535f30[_0x591f('0x57')]['get']({'plain':!![]});if(!_0x37e82b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37e82b[_0x591f('0x58')]===_0x591f('0x57')){var _0x52e553=_0x2b1ca3[_0x591f('0x37')]({'plain':!![]});var _0x4c2818=_0x591f('0x38');return db[_0x591f('0x59')][_0x591f('0x5a')]({'where':{'name':_0x4c2818,'userProfileId':_0x37e82b['userProfileId']},'raw':!![]})['then'](function(_0x1fd179){if(_0x1fd179&&_0x1fd179[_0x591f('0x5b')]===0x0){return db[_0x591f('0x5c')]['create']({'name':_0x52e553[_0x591f('0x41')],'resourceId':_0x52e553['id'],'type':_0x1fd179[_0x591f('0x41')],'sectionId':_0x1fd179['id']},{})[_0x591f('0x1f')](function(){return _0x2b1ca3;});}else{return _0x2b1ca3;}})['catch'](function(_0xae46dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xae46dd);throw _0xae46dd;});}return _0x2b1ca3;})[_0x591f('0x1f')](respondWithResult(_0x1275f0,0xc9))['catch'](handleError(_0x1275f0,null));};exports[_0x591f('0x35')]=function(_0x467656,_0xa6e887){if(_0x467656['body']['id']){delete _0x467656[_0x591f('0x56')]['id'];}return db[_0x591f('0x3d')]['find']({'where':{'id':_0x467656[_0x591f('0x54')]['id']},'include':[{'model':db[_0x591f('0x3a')],'as':_0x591f('0x3b')}]})['then'](handleEntityNotFound(_0xa6e887,null))[_0x591f('0x1f')](saveUpdates(_0x467656[_0x591f('0x56')],null))['then'](respondWithResult(_0xa6e887,null))[_0x591f('0x29')](handleError(_0xa6e887,null));};exports[_0x591f('0x36')]=function(_0x1e1360,_0xbd6ce9){return db[_0x591f('0x3d')][_0x591f('0x5a')]({'where':{'id':_0x1e1360['params']['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0xbd6ce9,null))[_0x591f('0x1f')](removeEntity(_0xbd6ce9,null))[_0x591f('0x29')](handleError(_0xbd6ce9,null));};exports[_0x591f('0x5d')]=function(_0x5ab5b2,_0x2ddda0){return db[_0x591f('0x3d')][_0x591f('0x5d')]()['then'](respondWithResult(_0x2ddda0,null))['catch'](handleError(_0x2ddda0,null));};exports[_0x591f('0x5e')]=function(_0x18eb29,_0xee8573,_0x48e58f){if(_0x18eb29[_0x591f('0x56')]['id']){delete _0x18eb29[_0x591f('0x56')]['id'];}return db[_0x591f('0x3d')]['find']({'where':{'id':_0x18eb29['params']['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0xee8573,null))[_0x591f('0x1f')](function(_0x328e64){if(_0x328e64){_0x18eb29[_0x591f('0x56')][_0x591f('0x5f')]=_0x328e64['id'];return db[_0x591f('0x60')]['create'](_0x18eb29[_0x591f('0x56')]);}})[_0x591f('0x1f')](respondWithResult(_0xee8573,null))[_0x591f('0x29')](handleError(_0xee8573,null));};exports[_0x591f('0x61')]=function(_0x583e39,_0x41555d,_0x50cdfc){var _0x505b5d={'raw':![],'where':{}};var _0x2a36f2={};var _0x472be8={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x583e39[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x41555d,null))[_0x591f('0x1f')](function(_0x4fe861){if(_0x4fe861){_0x2a36f2[_0x591f('0x40')]=_['keys'](db[_0x591f('0x60')][_0x591f('0x3e')]);_0x2a36f2[_0x591f('0x43')]=_[_0x591f('0x42')](_0x583e39['query']);_0x2a36f2[_0x591f('0x4d')]=_[_0x591f('0x44')](_0x2a36f2[_0x591f('0x40')],_0x2a36f2['query']);_0x505b5d['attributes']=_[_0x591f('0x44')](_0x2a36f2[_0x591f('0x40')],qs[_0x591f('0x46')](_0x583e39[_0x591f('0x43')]['fields']));_0x505b5d['attributes']=_0x505b5d[_0x591f('0x45')]['length']?_0x505b5d['attributes']:_0x2a36f2[_0x591f('0x40')];if(!_0x583e39[_0x591f('0x43')][_0x591f('0x48')](_0x591f('0x49'))){_0x505b5d['limit']=qs['limit'](_0x583e39['query'][_0x591f('0x30')]);_0x505b5d[_0x591f('0x2f')]=qs[_0x591f('0x2f')](_0x583e39[_0x591f('0x43')][_0x591f('0x2f')]);}_0x505b5d[_0x591f('0x4a')]=qs['sort'](_0x583e39[_0x591f('0x43')]['sort']);_0x505b5d['where']=qs[_0x591f('0x4d')](_['pick'](_0x583e39[_0x591f('0x43')],_0x2a36f2[_0x591f('0x4d')]));_0x505b5d['where'][_0x591f('0x5f')]=_0x4fe861['id'];if(_0x583e39[_0x591f('0x43')]['filter']){_0x505b5d[_0x591f('0x4c')]=_[_0x591f('0x4f')](_0x505b5d[_0x591f('0x4c')],{'$or':_['map'](_0x505b5d['attributes'],function(_0x4c7671){var _0x4ed29a={};_0x4ed29a[_0x4c7671]={'$like':'%'+_0x583e39['query'][_0x591f('0x4e')]+'%'};return _0x4ed29a;})});}_0x505b5d=_[_0x591f('0x4f')]({},_0x505b5d,_0x583e39[_0x591f('0x51')]);return db[_0x591f('0x60')][_0x591f('0x2e')]({'where':_0x505b5d[_0x591f('0x4c')]})[_0x591f('0x1f')](function(_0x575ab9){_0x472be8[_0x591f('0x2e')]=_0x575ab9;if(_0x583e39['query'][_0x591f('0x52')]){_0x505b5d[_0x591f('0x53')]=[{'all':!![]}];}return db[_0x591f('0x60')][_0x591f('0x62')](_0x505b5d);})[_0x591f('0x1f')](function(_0x4f47de){_0x472be8['rows']=_0x4f47de;return _0x472be8;});}})[_0x591f('0x1f')](respondWithFilteredResult(_0x41555d,_0x505b5d))['catch'](handleError(_0x41555d,null));};exports[_0x591f('0x63')]=function(_0x2cb55b,_0x57bfc5,_0x426e7b){return db[_0x591f('0x3d')]['find']({'where':{'id':_0x2cb55b[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x57bfc5,null))[_0x591f('0x1f')](function(_0x3fcc1a){if(_0x3fcc1a){return _0x3fcc1a[_0x591f('0x63')](_0x2cb55b['query'][_0x591f('0x64')]);}})[_0x591f('0x1f')](respondWithStatusCode(_0x57bfc5,null))[_0x591f('0x29')](handleError(_0x57bfc5,null));};exports[_0x591f('0x65')]=function(_0x47fcd8,_0x5474d3,_0xa33ae){if(_0x47fcd8[_0x591f('0x56')]['id']){delete _0x47fcd8[_0x591f('0x56')]['id'];}return db[_0x591f('0x3d')]['find']({'where':{'id':_0x47fcd8[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x5474d3,null))[_0x591f('0x1f')](function(_0x4e9b71){if(_0x4e9b71){_0x47fcd8[_0x591f('0x56')][_0x591f('0x5f')]=_0x4e9b71['id'];return db[_0x591f('0x66')][_0x591f('0x55')](_0x47fcd8[_0x591f('0x56')]);}})[_0x591f('0x1f')](respondWithResult(_0x5474d3,null))['catch'](handleError(_0x5474d3,null));};exports[_0x591f('0x67')]=function(_0xf43ed9,_0x1ff808,_0x309f08){var _0x41e8e2={'raw':![],'where':{}};var _0x521a69={};var _0x47d888={'count':0x0,'rows':[]};return db[_0x591f('0x3d')][_0x591f('0x68')]({'where':{'id':_0xf43ed9[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x1ff808,null))['then'](function(_0x32af09){if(_0x32af09){_0x521a69[_0x591f('0x40')]=_['keys'](db[_0x591f('0x66')][_0x591f('0x3e')]);_0x521a69['query']=_[_0x591f('0x42')](_0xf43ed9[_0x591f('0x43')]);_0x521a69[_0x591f('0x4d')]=_[_0x591f('0x44')](_0x521a69[_0x591f('0x40')],_0x521a69['query']);_0x41e8e2[_0x591f('0x45')]=_[_0x591f('0x44')](_0x521a69[_0x591f('0x40')],qs['fields'](_0xf43ed9[_0x591f('0x43')][_0x591f('0x46')]));_0x41e8e2['attributes']=_0x41e8e2[_0x591f('0x45')]['length']?_0x41e8e2[_0x591f('0x45')]:_0x521a69[_0x591f('0x40')];if(!_0xf43ed9[_0x591f('0x43')][_0x591f('0x48')](_0x591f('0x49'))){_0x41e8e2[_0x591f('0x30')]=qs[_0x591f('0x30')](_0xf43ed9[_0x591f('0x43')]['limit']);_0x41e8e2['offset']=qs[_0x591f('0x2f')](_0xf43ed9[_0x591f('0x43')][_0x591f('0x2f')]);}_0x41e8e2['order']=qs['sort'](_0xf43ed9['query'][_0x591f('0x4b')]);_0x41e8e2['where']=qs['filters'](_[_0x591f('0x69')](_0xf43ed9[_0x591f('0x43')],_0x521a69[_0x591f('0x4d')]));_0x41e8e2[_0x591f('0x4c')][_0x591f('0x5f')]=_0x32af09['id'];if(_0xf43ed9['query'][_0x591f('0x4e')]){_0x41e8e2[_0x591f('0x4c')]=_['merge'](_0x41e8e2[_0x591f('0x4c')],{'$or':_[_0x591f('0x3c')](_0x41e8e2['attributes'],function(_0x18acf9){var _0xae9adf={};_0xae9adf[_0x18acf9]={'$like':'%'+_0xf43ed9[_0x591f('0x43')][_0x591f('0x4e')]+'%'};return _0xae9adf;})});}_0x41e8e2=_['merge']({},_0x41e8e2,_0xf43ed9['options']);return db[_0x591f('0x66')][_0x591f('0x2e')]({'where':_0x41e8e2[_0x591f('0x4c')]})['then'](function(_0x5485b7){_0x47d888[_0x591f('0x2e')]=_0x5485b7;if(_0xf43ed9['query'][_0x591f('0x52')]){_0x41e8e2[_0x591f('0x53')]=[{'all':!![]}];}return db[_0x591f('0x66')][_0x591f('0x62')](_0x41e8e2);})['then'](function(_0x4210d7){_0x47d888['rows']=_0x4210d7;return _0x47d888;});}})['then'](respondWithFilteredResult(_0x1ff808,_0x41e8e2))[_0x591f('0x29')](handleError(_0x1ff808,null));};exports[_0x591f('0x6a')]=function(_0x25e0b7,_0x58df84,_0x3d8ffc){return db[_0x591f('0x3d')]['find']({'where':{'id':_0x25e0b7['params']['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x58df84,null))[_0x591f('0x1f')](function(_0x1f757e){if(_0x1f757e){return _0x1f757e['removeAnswers'](_0x25e0b7[_0x591f('0x43')][_0x591f('0x64')]);}})[_0x591f('0x1f')](respondWithStatusCode(_0x58df84,null))[_0x591f('0x29')](handleError(_0x58df84,null));};exports[_0x591f('0x6b')]=function(_0x4fb4ed,_0x191304,_0x48494b){return db[_0x591f('0x3d')][_0x591f('0x5a')]({'where':{'id':_0x4fb4ed[_0x591f('0x54')]['id']}})['then'](handleEntityNotFound(_0x191304,null))['then'](function(_0x59c73f){if(_0x59c73f){return _0x59c73f[_0x591f('0x6b')](_0x4fb4ed[_0x591f('0x56')]['ids'],_[_0x591f('0x6c')](_0x4fb4ed[_0x591f('0x56')],[_0x591f('0x64'),'id'])||{})['spread'](function(_0x363179){for(var _0x2a6ef0=0x0;_0x2a6ef0<_0x4fb4ed[_0x591f('0x56')][_0x591f('0x64')][_0x591f('0x47')];_0x2a6ef0+=0x1){socket['emit'](_0x591f('0x6d'),{'UserId':_0x4fb4ed['body'][_0x591f('0x64')][_0x2a6ef0],'WhatsappAccountId':_0x4fb4ed[_0x591f('0x54')]['id']});}return _0x363179;});}})[_0x591f('0x1f')](respondWithResult(_0x191304,null))[_0x591f('0x29')](handleError(_0x191304,null));};exports['removeAgents']=function(_0x3b9f3c,_0x845996,_0x12b534){return db[_0x591f('0x3d')][_0x591f('0x5a')]({'where':{'id':_0x3b9f3c['params']['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x845996,null))[_0x591f('0x1f')](function(_0x2d46a1){if(_0x2d46a1){return _0x2d46a1[_0x591f('0x6e')](_0x3b9f3c[_0x591f('0x43')]['ids'])[_0x591f('0x1f')](function(){if(_['isArray'](_0x3b9f3c[_0x591f('0x43')]['ids'])){for(var _0xe8c964=0x0;_0xe8c964<_0x3b9f3c[_0x591f('0x43')][_0x591f('0x64')][_0x591f('0x47')];_0xe8c964+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3b9f3c[_0x591f('0x43')][_0x591f('0x64')][_0xe8c964]),'WhatsappAccountId':Number(_0x3b9f3c['params']['id'])});}}else{socket[_0x591f('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x3b9f3c[_0x591f('0x43')][_0x591f('0x64')]),'WhatsappAccountId':Number(_0x3b9f3c[_0x591f('0x54')]['id'])});}});}})[_0x591f('0x1f')](respondWithStatusCode(_0x845996,null))[_0x591f('0x29')](handleError(_0x845996,null));};exports[_0x591f('0x70')]=function(_0x184f11,_0x7e28df,_0x9a7b96){var _0x34f722={};var _0x3cdc97={};var _0x506731;var _0x1bbbc8;return db[_0x591f('0x3d')][_0x591f('0x68')]({'where':{'id':_0x184f11[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x7e28df,null))[_0x591f('0x1f')](function(_0x425219){if(_0x425219){_0x506731=_0x425219;_0x3cdc97[_0x591f('0x40')]=_[_0x591f('0x42')](db[_0x591f('0x71')][_0x591f('0x3e')]);_0x3cdc97[_0x591f('0x43')]=_[_0x591f('0x42')](_0x184f11['query']);_0x3cdc97[_0x591f('0x4d')]=_[_0x591f('0x44')](_0x3cdc97[_0x591f('0x40')],_0x3cdc97[_0x591f('0x43')]);_0x34f722['attributes']=_[_0x591f('0x44')](_0x3cdc97[_0x591f('0x40')],qs[_0x591f('0x46')](_0x184f11[_0x591f('0x43')][_0x591f('0x46')]));_0x34f722[_0x591f('0x45')]=_0x34f722[_0x591f('0x45')][_0x591f('0x47')]?_0x34f722[_0x591f('0x45')]:_0x3cdc97[_0x591f('0x40')];_0x34f722[_0x591f('0x4a')]=qs[_0x591f('0x4b')](_0x184f11[_0x591f('0x43')]['sort']);_0x34f722[_0x591f('0x4c')]=qs['filters'](_[_0x591f('0x69')](_0x184f11[_0x591f('0x43')],_0x3cdc97[_0x591f('0x4d')]));if(_0x184f11['query'][_0x591f('0x4e')]){_0x34f722[_0x591f('0x4c')]=_[_0x591f('0x4f')](_0x34f722[_0x591f('0x4c')],{'$or':_[_0x591f('0x3c')](_0x34f722['attributes'],function(_0x22ff9d){var _0x360677={};_0x360677[_0x22ff9d]={'$like':'%'+_0x184f11[_0x591f('0x43')][_0x591f('0x4e')]+'%'};return _0x360677;})});}_0x34f722=_['merge']({},_0x34f722,_0x184f11[_0x591f('0x51')]);return _0x506731['getAgents'](_0x34f722);}})[_0x591f('0x1f')](function(_0x34068f){if(_0x34068f){_0x1bbbc8=_0x34068f[_0x591f('0x47')];if(!_0x184f11[_0x591f('0x43')][_0x591f('0x48')](_0x591f('0x49'))){_0x34f722[_0x591f('0x30')]=qs[_0x591f('0x30')](_0x184f11[_0x591f('0x43')][_0x591f('0x30')]);_0x34f722['offset']=qs[_0x591f('0x2f')](_0x184f11['query']['offset']);}return _0x506731[_0x591f('0x70')](_0x34f722);}})[_0x591f('0x1f')](function(_0x414d77){if(_0x414d77){return _0x414d77?{'count':_0x1bbbc8,'rows':_0x414d77}:null;}})['then'](respondWithResult(_0x7e28df,null))[_0x591f('0x29')](handleError(_0x7e28df,null));};exports['addApplications']=function(_0x2fda48,_0x5618fd,_0x9afd17){return db[_0x591f('0x3d')]['findOne']({'where':{'id':_0x2fda48[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x5618fd,null))[_0x591f('0x1f')](function(_0x4bef66){if(_0x4bef66){return db[_0x591f('0x72')][_0x591f('0x73')](function(_0x4a4502){return db[_0x591f('0x74')][_0x591f('0x36')]({'where':{'WhatsappAccountId':_0x2fda48[_0x591f('0x54')]['id']},'transaction':_0x4a4502})[_0x591f('0x1f')](function(_0x1e7775){var _0x439abf=_[_0x591f('0x3c')](_0x2fda48[_0x591f('0x56')],function(_0x43dda0){_0x43dda0[_0x591f('0x5f')]=_0x2fda48[_0x591f('0x54')]['id'];return _0x43dda0;});return db['WhatsappApplication']['bulkCreate'](_0x439abf,{'transaction':_0x4a4502});});})[_0x591f('0x1f')](function(){return db[_0x591f('0x74')][_0x591f('0x75')]({'where':{'WhatsappAccountId':_0x2fda48['params']['id']},'order':'priority'});});}})[_0x591f('0x1f')](respondWithResult(_0x5618fd,null))[_0x591f('0x29')](handleError(_0x5618fd,null));};exports[_0x591f('0x76')]=function(_0x930873,_0x1fae73,_0x2747a8){var _0x1c7f39={};var _0x52fb9f={};var _0xe12e71;var _0x36f90b;return db[_0x591f('0x3d')][_0x591f('0x68')]({'where':{'id':_0x930873[_0x591f('0x54')]['id']}})[_0x591f('0x1f')](handleEntityNotFound(_0x1fae73,null))['then'](function(_0x1a4b34){if(_0x1a4b34){_0xe12e71=_0x1a4b34;_0x52fb9f['model']=_[_0x591f('0x42')](db['WhatsappApplication'][_0x591f('0x3e')]);_0x52fb9f[_0x591f('0x43')]=_[_0x591f('0x42')](_0x930873['query']);_0x52fb9f[_0x591f('0x4d')]=_['intersection'](_0x52fb9f['model'],_0x52fb9f[_0x591f('0x43')]);_0x1c7f39['attributes']=_['intersection'](_0x52fb9f[_0x591f('0x40')],qs[_0x591f('0x46')](_0x930873['query'][_0x591f('0x46')]));_0x1c7f39[_0x591f('0x45')]=_0x1c7f39[_0x591f('0x45')][_0x591f('0x47')]?_0x1c7f39[_0x591f('0x45')]:_0x52fb9f[_0x591f('0x40')];_0x1c7f39[_0x591f('0x4a')]=qs[_0x591f('0x4b')](_0x930873['query'][_0x591f('0x4b')]);_0x1c7f39[_0x591f('0x4c')]=qs['filters'](_[_0x591f('0x69')](_0x930873[_0x591f('0x43')],_0x52fb9f[_0x591f('0x4d')]));if(_0x930873[_0x591f('0x43')][_0x591f('0x4e')]){_0x1c7f39['where']=_[_0x591f('0x4f')](_0x1c7f39[_0x591f('0x4c')],{'$or':_[_0x591f('0x3c')](_0x1c7f39['attributes'],function(_0x1e7f68){var _0x340986={};_0x340986[_0x1e7f68]={'$like':'%'+_0x930873['query'][_0x591f('0x4e')]+'%'};return _0x340986;})});}_0x1c7f39=_['merge']({},_0x1c7f39,_0x930873['options']);return _0xe12e71[_0x591f('0x76')](_0x1c7f39);}})[_0x591f('0x1f')](function(_0x22a65e){if(_0x22a65e){_0x36f90b=_0x22a65e[_0x591f('0x47')];if(!_0x930873[_0x591f('0x43')][_0x591f('0x48')]('nolimit')){_0x1c7f39[_0x591f('0x30')]=qs['limit'](_0x930873[_0x591f('0x43')][_0x591f('0x30')]);_0x1c7f39['offset']=qs[_0x591f('0x2f')](_0x930873[_0x591f('0x43')][_0x591f('0x2f')]);}return _0xe12e71[_0x591f('0x76')](_0x1c7f39);}})[_0x591f('0x1f')](function(_0x1e8e8e){if(_0x1e8e8e){return _0x1e8e8e?{'count':_0x36f90b,'rows':_0x1e8e8e}:null;}})[_0x591f('0x1f')](respondWithResult(_0x1fae73,null))[_0x591f('0x29')](handleError(_0x1fae73,null));};exports['notify']=function(_0x340720,_0x34168a,_0x26271c){var _0x32d5ed={'channel':_0x591f('0x77')};var _0x90c802=[];var _0xfb482c=[];var _0x277420={};return db[_0x591f('0x3d')][_0x591f('0x5a')]({'where':{'id':_0x340720[_0x591f('0x54')]['id']},'include':[{'model':db[_0x591f('0x74')],'as':'Applications'}]})[_0x591f('0x1f')](handleEntityNotFound(_0x34168a,null))[_0x591f('0x1f')](function(_0x2b1805){_0x32d5ed[_0x591f('0x78')]=_0x2b1805;_0x32d5ed[_0x591f('0x79')]=_['orderBy'](_0x2b1805['Applications'],[_0x591f('0x7a')],['asc']);if(_0x32d5ed[_0x591f('0x78')][_0x591f('0x7b')]){delete _0x32d5ed[_0x591f('0x78')]['Applications'];}return db[_0x591f('0x7c')][_0x591f('0x5d')]();})[_0x591f('0x1f')](function(_0x20be3b){if(!_0x20be3b){throw new db[(_0x591f('0x7d'))][(_0x591f('0x7e'))]('no\x20available\x20attributes');}_0x90c802=_['difference'](_[_0x591f('0x42')](_0x20be3b),[_0x591f('0x7f'),_0x591f('0x80')]);_0xfb482c=_[_0x591f('0x81')](_[_0x591f('0x42')](_0x20be3b),[_0x591f('0x7f'),'updatedAt',_0x591f('0x82'),'ListId']);_0x32d5ed[_0x591f('0x56')]={'mapKey':'mobile'};if(_0x32d5ed[_0x591f('0x78')][_0x591f('0x3f')]&&_0x32d5ed[_0x591f('0x78')][_0x591f('0x3f')]===_0x591f('0x83')){_0x32d5ed[_0x591f('0x56')][_0x591f('0x84')]=_0x340720['body'][_0x591f('0x85')][_0x591f('0x86')](_0x591f('0x87'),'');_0x32d5ed[_0x591f('0x56')][_0x591f('0x56')]=_0x340720[_0x591f('0x56')][_0x591f('0x88')];_0x32d5ed['body'][_0x591f('0x89')]=_0x340720[_0x591f('0x56')][_0x591f('0x8a')];}if(_0x32d5ed['body']['id']){delete _0x32d5ed[_0x591f('0x56')]['id'];}if(_[_0x591f('0x8b')](_0x32d5ed[_0x591f('0x56')]['from'])){throw new db[(_0x591f('0x7d'))]['ValidationError'](_0x591f('0x8c'));}if(_[_0x591f('0x8b')](_0x32d5ed[_0x591f('0x56')][_0x591f('0x56')])||_0x32d5ed[_0x591f('0x56')]['body']===''){throw new db[(_0x591f('0x7d'))][(_0x591f('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x591f('0x8b')](_0x32d5ed['body'][_0x591f('0x8d')])){throw new db[(_0x591f('0x7d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfb482c);}if(!_[_0x591f('0x8e')](_0xfb482c,_0x32d5ed[_0x591f('0x56')][_0x591f('0x8d')])){throw new db[(_0x591f('0x7d'))][(_0x591f('0x7e'))](_0x591f('0x8f')+_0xfb482c);}_0x277420[_0x32d5ed[_0x591f('0x56')][_0x591f('0x8d')]]=_0x32d5ed[_0x591f('0x56')]['from'];return db[_0x591f('0x90')][_0x591f('0x5a')]({'where':{'id':_0x32d5ed[_0x591f('0x78')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x591f('0x91'),'where':_0x277420,'limit':0x1,'order':[[_0x591f('0x80'),_0x591f('0x92')]]}]});})[_0x591f('0x1f')](handleEntityNotFound(_0x34168a,null))['then'](function(_0x598fa2){if(_0x598fa2){_0x32d5ed['list']=_[_0x591f('0x6c')](_0x598fa2,[_0x591f('0x91')]);if(_0x598fa2['Contacts'][_0x591f('0x47')]){return _0x598fa2[_0x591f('0x91')][0x0];}var _0x41ea64=_[_0x591f('0x93')](_0x32d5ed[_0x591f('0x56')],{'firstName':_0x32d5ed['body'][_0x591f('0x84')],'ListId':_0x598fa2['id']});_0x41ea64[_0x32d5ed[_0x591f('0x56')]['mapKey']]=_0x32d5ed[_0x591f('0x56')][_0x591f('0x84')];return db[_0x591f('0x7c')]['create'](_0x41ea64,{'fields':_0x90c802,'raw':!![]});}})[_0x591f('0x1f')](handleEntityNotFound(_0x34168a,null))[_0x591f('0x1f')](function(_0x194575){if(_0x194575){_0x32d5ed[_0x591f('0x94')]=_0x194575;var _0x5cf6a8={'ContactId':_0x194575['id'],'phone':_0x32d5ed[_0x591f('0x56')]['from'],'WhatsappAccountId':_0x340720[_0x591f('0x54')]['id']};var _0x23493f={'ContactId':_0x194575['id'],'WhatsappAccountId':_0x340720[_0x591f('0x54')]['id'],'closed':![]};return db[_0x591f('0x95')]['find']({'where':_0x23493f})[_0x591f('0x1f')](function(_0x3630e6){if(_0x3630e6){return[_0x3630e6,![]];}return db[_0x591f('0x95')][_0x591f('0x55')](_0x5cf6a8)['then'](function(_0x216ad0){return[_0x216ad0,!![]];});});}})['spread'](function(_0x59ce64,_0x3198f4){_0x32d5ed[_0x591f('0x96')]=_0x59ce64[_0x591f('0x37')]({'plain':!![]});_0x32d5ed[_0x591f('0x96')][_0x591f('0x97')]=![];if(_0x3198f4){if(_0x32d5ed[_0x591f('0x78')][_0x591f('0x98')]){_0x32d5ed['applications'][_0x591f('0x99')]({'id':0x0,'priority':_0x32d5ed[_0x591f('0x79')][_0x591f('0x47')]+0x1,'app':_0x591f('0x9a'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x32d5ed[_0x591f('0x96')]['created']=!![];}return db[_0x591f('0x9b')][_0x591f('0x55')]({'phone':_0x32d5ed[_0x591f('0x56')][_0x591f('0x84')],'messageId':_0x32d5ed[_0x591f('0x56')][_0x591f('0x89')],'body':_0x32d5ed[_0x591f('0x56')][_0x591f('0x56')],'WhatsappAccountId':_0x340720['params']['id'],'WhatsappInteractionId':_0x59ce64['id'],'direction':'in','ContactId':_0x59ce64[_0x591f('0x9c')],'AttachmentId':_0x32d5ed[_0x591f('0x56')]['AttachmentId']});})[_0x591f('0x1f')](function(_0x35ddf0){_0x32d5ed[_0x591f('0x28')]=_0x35ddf0;if(_0x32d5ed[_0x591f('0x96')][_0x591f('0x9d')]){return db[_0x591f('0x71')][_0x591f('0x5a')]({'attributes':['id',_0x591f('0x41')],'where':{'id':_0x32d5ed[_0x591f('0x96')][_0x591f('0x9d')]}})[_0x591f('0x1f')](function(_0x55b7d5){if(_0x55b7d5){_0x32d5ed[_0x591f('0x79')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x55b7d5[_0x591f('0x41')]+','+(_0x32d5ed[_0x591f('0x78')][_0x591f('0x9e')]||0xa),'interval':_0x591f('0x9f')});}return respondWithRpcPromise(_0x591f('0xa0'),_0x591f('0xa1'),_0x32d5ed);});}return respondWithRpcPromise(_0x591f('0xa0'),'startRouting',_0x32d5ed);})[_0x591f('0x1f')](function(_0x55ffac){if(_0x55ffac){var _0x12c14a=0xc8;var _0x3b46fd='receiveMessage';logger[_0x591f('0x20')](_0x591f('0x22'),_0x3b46fd,_0x12c14a,_0x591f('0xa2'));logger[_0x591f('0x21')](_0x591f('0xa3'),_0x3b46fd,_0x12c14a,'entity\x20found',JSON[_0x591f('0x24')](_0x55ffac));if(_0x32d5ed[_0x591f('0x78')][_0x591f('0x3f')]===_0x591f('0x83')){return _0x34168a['status'](_0x12c14a)[_0x591f('0x31')](_0x591f('0xa4'),_0x591f('0xa5'))[_0x591f('0xa6')](_0x591f('0xa7'));}else{return _0x34168a['status'](_0x12c14a)['json'](_0x55ffac);}}})[_0x591f('0x29')](handleError(_0x34168a,null));};exports['send']=function(_0xa39401,_0x39cbc0,_0x1188eb){var _0x32d614,_0x140901,_0x4d4b11;if(_['isNil'](_0xa39401['body']['body'])||_0xa39401[_0x591f('0x56')]['body']===''){throw new db[(_0x591f('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x591f('0x8b')](_0xa39401['body']['to'])){throw new db[(_0x591f('0x7d'))]['ValidationError'](_0x591f('0xa8'));}_0x32d614=_0xa39401[_0x591f('0x56')]['to'];return db['WhatsappAccount'][_0x591f('0x5a')]({'where':{'id':_0xa39401[_0x591f('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x591f('0xa9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x32d614},'limit':0x1,'order':[['updatedAt',_0x591f('0x92')]]}]}]})[_0x591f('0x1f')](handleEntityNotFound(_0x39cbc0,null))[_0x591f('0x1f')](function(_0x4532ad){if(_0x4532ad&&_0x4532ad['List']){_0x140901=_0x4532ad[_0x591f('0x37')]({'plain':!![]});if(_0x140901[_0x591f('0xa9')]&&_0x140901[_0x591f('0xa9')]['Contacts'][_0x591f('0x47')]){return _0x140901[_0x591f('0xa9')][_0x591f('0x91')][0x0];}return db['CmContact'][_0x591f('0x55')](_[_0x591f('0x93')](_0xa39401[_0x591f('0x56')],{'firstName':_0x32d614,'mobile':_0x32d614,'phone':_0x32d614,'ListId':_0x140901[_0x591f('0xaa')]}));}})[_0x591f('0x1f')](handleEntityNotFound(_0x39cbc0,null))[_0x591f('0x1f')](function(_0x4c55b2){if(_0x4c55b2){_0x4d4b11=_0x4c55b2;return db['WhatsappInteraction'][_0x591f('0x5a')]({'where':{'ContactId':_0x4d4b11['id'],'closed':![],'WhatsappAccountId':_0x140901['id']}})[_0x591f('0x1f')](function(_0x5ae69a){if(_0x5ae69a){return[_0x5ae69a,![]];}return db[_0x591f('0x95')]['create']({'UserId':_0xa39401[_0x591f('0x57')]['id'],'ContactId':_0x4d4b11['id'],'WhatsappAccountId':_0x140901['id'],'phone':_0x32d614,'firstMsgDirection':'out','Messages':[_['merge'](_0xa39401[_0x591f('0x56')],{'read':![],'body':_0xa39401[_0x591f('0x56')]['body'],'phone':_0x32d614,'WhatsappAccountId':_0x140901['id'],'UserId':_0xa39401[_0x591f('0x57')]['id'],'ContactId':_0x4d4b11['id']})]},{'include':[{'model':db[_0x591f('0x9b')],'as':'Messages'}]})[_0x591f('0x1f')](function(_0x34d93a){return[_0x34d93a,!![]];});});}})[_0x591f('0xab')](function(_0x3fe9c4,_0xbaa0ca){if(_0xbaa0ca){return _0x3fe9c4;}return db['WhatsappMessage'][_0x591f('0x55')](_['merge'](_0xa39401[_0x591f('0x56')],{'read':![],'body':_0xa39401[_0x591f('0x56')]['body'],'phone':_0x32d614,'WhatsappAccountId':_0x140901['id'],'WhatsappInteractionId':_0x3fe9c4['id'],'UserId':_0xa39401[_0x591f('0x57')]['id'],'ContactId':_0x4d4b11['id']}))[_0x591f('0x1f')](function(_0xc0d627){_0x3fe9c4['dataValues'][_0x591f('0xac')]=[];_0x3fe9c4[_0x591f('0xad')]['Messages']['push'](_0xc0d627[_0x591f('0xad')]);return _0x3fe9c4;});})[_0x591f('0x1f')](respondWithResult(_0x39cbc0,null))[_0x591f('0x29')](handleError(_0x39cbc0,null));}; \ No newline at end of file +var _0x6b16=['created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','to\x20is\x20mandatory','List','DESC','out','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','find','body','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','WhatsappAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','applications','account','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','from','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','contact','WhatsappInteraction','interaction'];(function(_0x53f932,_0x48b074){var _0xb5cd9b=function(_0x5e209a){while(--_0x5e209a){_0x53f932['push'](_0x53f932['shift']());}};_0xb5cd9b(++_0x48b074);}(_0x6b16,0xce));var _0x66b1=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x6b16[_0x576266];return _0x18234f;};'use strict';var pdf=require(_0x66b1('0x0'));var emlformat=require(_0x66b1('0x1'));var rimraf=require(_0x66b1('0x2'));var zipdir=require(_0x66b1('0x3'));var jsonpatch=require(_0x66b1('0x4'));var rp=require(_0x66b1('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66b1('0x6'));var util=require(_0x66b1('0x7'));var path=require(_0x66b1('0x8'));var sox=require(_0x66b1('0x9'));var csv=require(_0x66b1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66b1('0xb'));var squel=require(_0x66b1('0xc'));var crypto=require(_0x66b1('0xd'));var jsforce=require(_0x66b1('0xe'));var deskjs=require(_0x66b1('0xf'));var toCsv=require(_0x66b1('0xa'));var querystring=require('querystring');var Papa=require(_0x66b1('0x10'));var Redis=require(_0x66b1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66b1('0x12'));var hardwareService=require(_0x66b1('0x13'));var logger=require(_0x66b1('0x14'))(_0x66b1('0x15'));var utils=require(_0x66b1('0x16'));var config=require(_0x66b1('0x17'));var licenseUtil=require(_0x66b1('0x18'));var db=require(_0x66b1('0x19'))['db'];config[_0x66b1('0x1a')]=_[_0x66b1('0x1b')](config[_0x66b1('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66b1('0x1a')]));require(_0x66b1('0x1c'))['register'](socket);var jayson=require(_0x66b1('0x1d'));var client=jayson[_0x66b1('0x1e')][_0x66b1('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4ebee8,_0x4c8366,_0x4ee928,_0x5dbc4f){return new BPromise(function(_0x2027d8,_0x5062a1){var _0x3ce42b=_0x5dbc4f||client;return _0x3ce42b[_0x66b1('0x20')](_0x4ebee8,_0x4ee928)[_0x66b1('0x21')](function(_0x25db8b){logger[_0x66b1('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4c8366,_0x66b1('0x23'));logger[_0x66b1('0x24')](_0x66b1('0x25'),_0x4c8366,'request\x20sent',JSON[_0x66b1('0x26')](_0x25db8b));if(_0x25db8b[_0x66b1('0x27')]){if(_0x25db8b[_0x66b1('0x27')][_0x66b1('0x28')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4c8366,_0x25db8b[_0x66b1('0x27')]['message']);return _0x5062a1(_0x25db8b['error'][_0x66b1('0x29')]);}logger[_0x66b1('0x27')](_0x66b1('0x2a'),_0x4c8366,_0x25db8b[_0x66b1('0x27')][_0x66b1('0x29')]);return _0x2027d8(_0x25db8b['error'][_0x66b1('0x29')]);}else{logger[_0x66b1('0x22')](_0x66b1('0x2a'),_0x4c8366,_0x66b1('0x23'));_0x2027d8(_0x25db8b[_0x66b1('0x2b')][_0x66b1('0x29')]);}})[_0x66b1('0x2c')](function(_0x4bd0f5){logger[_0x66b1('0x27')](_0x66b1('0x2a'),_0x4c8366,_0x4bd0f5);_0x5062a1(_0x4bd0f5);});});}function respondWithStatusCode(_0x3a9e1b,_0x1928de){_0x1928de=_0x1928de||0xcc;return function(_0x41d4e8){if(_0x41d4e8){return _0x3a9e1b[_0x66b1('0x2d')](_0x1928de);}return _0x3a9e1b['status'](_0x1928de)[_0x66b1('0x2e')]();};}function respondWithResult(_0x10e9fd,_0x42bc31){_0x42bc31=_0x42bc31||0xc8;return function(_0x55f3ca){if(_0x55f3ca){return _0x10e9fd[_0x66b1('0x2f')](_0x42bc31)['json'](_0x55f3ca);}};}function respondWithFilteredResult(_0x484fc9,_0x13bbcc){return function(_0x2ebcfc){if(_0x2ebcfc){var _0x48c0ec=_0x2ebcfc[_0x66b1('0x30')],_0x4ea8cc=_0x13bbcc['offset'],_0x588bce=_0x13bbcc[_0x66b1('0x31')]+_0x13bbcc[_0x66b1('0x32')],_0x5bf28b;if(_0x588bce>=_0x48c0ec){_0x588bce=_0x48c0ec;_0x5bf28b=0xc8;}else{_0x5bf28b=0xce;}_0x484fc9[_0x66b1('0x2f')](_0x5bf28b);return _0x484fc9[_0x66b1('0x33')](_0x66b1('0x34'),_0x4ea8cc+'-'+_0x588bce+'/'+_0x48c0ec)[_0x66b1('0x35')](_0x2ebcfc);}return null;};}function patchUpdates(_0x2fce28){return function(_0x224f75){try{jsonpatch[_0x66b1('0x36')](_0x224f75,_0x2fce28,!![]);}catch(_0xe4fdd2){return BPromise['reject'](_0xe4fdd2);}return _0x224f75[_0x66b1('0x37')]();};}function saveUpdates(_0x8d0c1b,_0x1a853c){return function(_0x1d5305){if(_0x1d5305){return _0x1d5305[_0x66b1('0x38')](_0x8d0c1b)[_0x66b1('0x21')](function(_0x5c6859){return _0x5c6859;});}return null;};}function removeEntity(_0xc9d6cc,_0x4c29c6){return function(_0xc36104){if(_0xc36104){return _0xc36104[_0x66b1('0x39')]()['then'](function(){var _0x27d815=_0xc36104[_0x66b1('0x3a')]({'plain':!![]});var _0x356212=_0x66b1('0x3b');return db[_0x66b1('0x3c')][_0x66b1('0x39')]({'where':{'type':_0x356212,'resourceId':_0x27d815['id']}})[_0x66b1('0x21')](function(){return _0xc36104;});})[_0x66b1('0x21')](function(){_0xc9d6cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x390fb1,_0x479d59){return function(_0x47d5b7){if(!_0x47d5b7){_0x390fb1[_0x66b1('0x2d')](0x194);}return _0x47d5b7;};}function handleError(_0x56971a,_0x355944){_0x355944=_0x355944||0x1f4;return function(_0x5ecdc3){logger[_0x66b1('0x27')](_0x5ecdc3[_0x66b1('0x3d')]);if(_0x5ecdc3[_0x66b1('0x3e')]){delete _0x5ecdc3[_0x66b1('0x3e')];}_0x56971a[_0x66b1('0x2f')](_0x355944)[_0x66b1('0x3f')](_0x5ecdc3);};}exports[_0x66b1('0x40')]=function(_0x5d9c35,_0x10e5d7){var _0x25398f={'include':[{'model':db[_0x66b1('0x41')],'as':_0x66b1('0x42')}]},_0x5bf5d0={},_0x396578={'count':0x0,'rows':[]};var _0x20ea87=_[_0x66b1('0x43')](db[_0x66b1('0x44')][_0x66b1('0x45')],function(_0x1e97da){return{'name':_0x1e97da[_0x66b1('0x46')],'type':_0x1e97da[_0x66b1('0x47')][_0x66b1('0x48')]};});_0x5bf5d0['model']=_[_0x66b1('0x43')](_0x20ea87,_0x66b1('0x3e'));_0x5bf5d0[_0x66b1('0x49')]=_['keys'](_0x5d9c35[_0x66b1('0x49')]);_0x5bf5d0[_0x66b1('0x4a')]=_[_0x66b1('0x4b')](_0x5bf5d0[_0x66b1('0x4c')],_0x5bf5d0['query']);_0x25398f['attributes']=_[_0x66b1('0x4b')](_0x5bf5d0[_0x66b1('0x4c')],qs[_0x66b1('0x4d')](_0x5d9c35[_0x66b1('0x49')][_0x66b1('0x4d')]));_0x25398f[_0x66b1('0x4e')]=_0x25398f[_0x66b1('0x4e')][_0x66b1('0x4f')]?_0x25398f[_0x66b1('0x4e')]:_0x5bf5d0[_0x66b1('0x4c')];if(!_0x5d9c35['query'][_0x66b1('0x50')](_0x66b1('0x51'))){_0x25398f[_0x66b1('0x32')]=qs[_0x66b1('0x32')](_0x5d9c35['query'][_0x66b1('0x32')]);_0x25398f[_0x66b1('0x31')]=qs['offset'](_0x5d9c35[_0x66b1('0x49')][_0x66b1('0x31')]);}_0x25398f[_0x66b1('0x52')]=qs[_0x66b1('0x53')](_0x5d9c35[_0x66b1('0x49')][_0x66b1('0x53')]);_0x25398f[_0x66b1('0x54')]=qs[_0x66b1('0x4a')](_['pick'](_0x5d9c35[_0x66b1('0x49')],_0x5bf5d0[_0x66b1('0x4a')]),_0x20ea87);if(_0x5d9c35[_0x66b1('0x49')][_0x66b1('0x55')]){_0x25398f[_0x66b1('0x54')]=_[_0x66b1('0x56')](_0x25398f[_0x66b1('0x54')],{'$or':_['map'](_0x20ea87,function(_0x129a4b){if(_0x129a4b['type']!==_0x66b1('0x57')){var _0x47edfe={};_0x47edfe[_0x129a4b[_0x66b1('0x3e')]]={'$like':'%'+_0x5d9c35[_0x66b1('0x49')][_0x66b1('0x55')]+'%'};return _0x47edfe;}})});}_0x25398f=_[_0x66b1('0x56')]({},_0x25398f,_0x5d9c35[_0x66b1('0x58')]);var _0x35b5a2={'where':_0x25398f[_0x66b1('0x54')]};return db[_0x66b1('0x44')][_0x66b1('0x30')](_0x35b5a2)['then'](function(_0x469ef8){_0x396578[_0x66b1('0x30')]=_0x469ef8;if(_0x5d9c35[_0x66b1('0x49')][_0x66b1('0x59')]){_0x25398f[_0x66b1('0x5a')]=[{'all':!![]}];}return db[_0x66b1('0x44')][_0x66b1('0x5b')](_0x25398f);})[_0x66b1('0x21')](function(_0xa10273){_0x396578['rows']=_0xa10273;return _0x396578;})['then'](respondWithFilteredResult(_0x10e5d7,_0x25398f))['catch'](handleError(_0x10e5d7,null));};exports['show']=function(_0xe24019,_0x218ef4){var _0x44e452={'raw':![],'where':{'id':_0xe24019[_0x66b1('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x66b1('0x42')}]},_0x318f3a={};_0x318f3a[_0x66b1('0x4c')]=_[_0x66b1('0x5d')](db['WhatsappAccount'][_0x66b1('0x45')]);_0x318f3a[_0x66b1('0x49')]=_[_0x66b1('0x5d')](_0xe24019[_0x66b1('0x49')]);_0x318f3a[_0x66b1('0x4a')]=_[_0x66b1('0x4b')](_0x318f3a[_0x66b1('0x4c')],_0x318f3a[_0x66b1('0x49')]);_0x44e452[_0x66b1('0x4e')]=_['intersection'](_0x318f3a[_0x66b1('0x4c')],qs[_0x66b1('0x4d')](_0xe24019[_0x66b1('0x49')]['fields']));_0x44e452[_0x66b1('0x4e')]=_0x44e452[_0x66b1('0x4e')]['length']?_0x44e452[_0x66b1('0x4e')]:_0x318f3a[_0x66b1('0x4c')];if(_0xe24019['query'][_0x66b1('0x59')]){_0x44e452[_0x66b1('0x5a')]=[{'all':!![]}];}_0x44e452=_[_0x66b1('0x56')]({},_0x44e452,_0xe24019[_0x66b1('0x58')]);return db['WhatsappAccount'][_0x66b1('0x5e')](_0x44e452)[_0x66b1('0x21')](handleEntityNotFound(_0x218ef4,null))[_0x66b1('0x21')](respondWithResult(_0x218ef4,null))[_0x66b1('0x2c')](handleError(_0x218ef4,null));};exports['create']=function(_0x57079f,_0x16e613){return db['WhatsappAccount']['create'](_0x57079f[_0x66b1('0x5f')],{})[_0x66b1('0x21')](function(_0x9919ed){var _0x1f9bb5=_0x57079f[_0x66b1('0x60')][_0x66b1('0x3a')]({'plain':!![]});if(!_0x1f9bb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f9bb5['role']===_0x66b1('0x60')){var _0x11bfef=_0x9919ed['get']({'plain':!![]});var _0x5850aa=_0x66b1('0x3b');return db['UserProfileSection'][_0x66b1('0x5e')]({'where':{'name':_0x5850aa,'userProfileId':_0x1f9bb5[_0x66b1('0x61')]},'raw':!![]})[_0x66b1('0x21')](function(_0x46204b){if(_0x46204b&&_0x46204b[_0x66b1('0x62')]===0x0){return db[_0x66b1('0x3c')][_0x66b1('0x63')]({'name':_0x11bfef['name'],'resourceId':_0x11bfef['id'],'type':_0x46204b[_0x66b1('0x3e')],'sectionId':_0x46204b['id']},{})['then'](function(){return _0x9919ed;});}else{return _0x9919ed;}})[_0x66b1('0x2c')](function(_0x54ba50){logger['error'](_0x66b1('0x64'),_0x54ba50);throw _0x54ba50;});}return _0x9919ed;})['then'](respondWithResult(_0x16e613,0xc9))[_0x66b1('0x2c')](handleError(_0x16e613,null));};exports[_0x66b1('0x38')]=function(_0xf0bf74,_0x279267){if(_0xf0bf74[_0x66b1('0x5f')]['id']){delete _0xf0bf74['body']['id'];}return db[_0x66b1('0x44')][_0x66b1('0x5e')]({'where':{'id':_0xf0bf74['params']['id']},'include':[{'model':db[_0x66b1('0x41')],'as':_0x66b1('0x42')}]})[_0x66b1('0x21')](handleEntityNotFound(_0x279267,null))[_0x66b1('0x21')](saveUpdates(_0xf0bf74[_0x66b1('0x5f')],null))[_0x66b1('0x21')](respondWithResult(_0x279267,null))[_0x66b1('0x2c')](handleError(_0x279267,null));};exports['destroy']=function(_0x11743c,_0x5453c2){return db[_0x66b1('0x44')][_0x66b1('0x5e')]({'where':{'id':_0x11743c['params']['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x5453c2,null))[_0x66b1('0x21')](removeEntity(_0x5453c2,null))[_0x66b1('0x2c')](handleError(_0x5453c2,null));};exports[_0x66b1('0x65')]=function(_0x463ae1,_0xd76281){return db['WhatsappAccount'][_0x66b1('0x65')]()[_0x66b1('0x21')](respondWithResult(_0xd76281,null))['catch'](handleError(_0xd76281,null));};exports[_0x66b1('0x66')]=function(_0xd1f75a,_0x5c570e,_0x11fe15){if(_0xd1f75a[_0x66b1('0x5f')]['id']){delete _0xd1f75a['body']['id'];}return db[_0x66b1('0x44')][_0x66b1('0x5e')]({'where':{'id':_0xd1f75a[_0x66b1('0x5c')]['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x5c570e,null))[_0x66b1('0x21')](function(_0x192dba){if(_0x192dba){_0xd1f75a[_0x66b1('0x5f')]['WhatsappAccountId']=_0x192dba['id'];return db[_0x66b1('0x67')]['create'](_0xd1f75a[_0x66b1('0x5f')]);}})['then'](respondWithResult(_0x5c570e,null))[_0x66b1('0x2c')](handleError(_0x5c570e,null));};exports[_0x66b1('0x68')]=function(_0x40d620,_0x4dbbe3,_0x343f6b){var _0x362ca7={'raw':![],'where':{}};var _0x389174={};var _0x38fbc7={'count':0x0,'rows':[]};return db[_0x66b1('0x44')][_0x66b1('0x69')]({'where':{'id':_0x40d620['params']['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x4dbbe3,null))['then'](function(_0x4877e7){if(_0x4877e7){_0x389174['model']=_['keys'](db[_0x66b1('0x67')]['rawAttributes']);_0x389174[_0x66b1('0x49')]=_[_0x66b1('0x5d')](_0x40d620[_0x66b1('0x49')]);_0x389174[_0x66b1('0x4a')]=_[_0x66b1('0x4b')](_0x389174[_0x66b1('0x4c')],_0x389174[_0x66b1('0x49')]);_0x362ca7[_0x66b1('0x4e')]=_[_0x66b1('0x4b')](_0x389174[_0x66b1('0x4c')],qs[_0x66b1('0x4d')](_0x40d620[_0x66b1('0x49')]['fields']));_0x362ca7[_0x66b1('0x4e')]=_0x362ca7[_0x66b1('0x4e')][_0x66b1('0x4f')]?_0x362ca7[_0x66b1('0x4e')]:_0x389174['model'];if(!_0x40d620[_0x66b1('0x49')][_0x66b1('0x50')]('nolimit')){_0x362ca7[_0x66b1('0x32')]=qs['limit'](_0x40d620[_0x66b1('0x49')][_0x66b1('0x32')]);_0x362ca7[_0x66b1('0x31')]=qs['offset'](_0x40d620['query'][_0x66b1('0x31')]);}_0x362ca7[_0x66b1('0x52')]=qs['sort'](_0x40d620[_0x66b1('0x49')][_0x66b1('0x53')]);_0x362ca7[_0x66b1('0x54')]=qs[_0x66b1('0x4a')](_[_0x66b1('0x6a')](_0x40d620[_0x66b1('0x49')],_0x389174[_0x66b1('0x4a')]));_0x362ca7[_0x66b1('0x54')][_0x66b1('0x6b')]=_0x4877e7['id'];if(_0x40d620['query']['filter']){_0x362ca7[_0x66b1('0x54')]=_[_0x66b1('0x56')](_0x362ca7[_0x66b1('0x54')],{'$or':_[_0x66b1('0x43')](_0x362ca7[_0x66b1('0x4e')],function(_0x583abb){var _0x435c9f={};_0x435c9f[_0x583abb]={'$like':'%'+_0x40d620[_0x66b1('0x49')][_0x66b1('0x55')]+'%'};return _0x435c9f;})});}_0x362ca7=_[_0x66b1('0x56')]({},_0x362ca7,_0x40d620[_0x66b1('0x58')]);return db[_0x66b1('0x67')][_0x66b1('0x30')]({'where':_0x362ca7[_0x66b1('0x54')]})[_0x66b1('0x21')](function(_0x5127ca){_0x38fbc7[_0x66b1('0x30')]=_0x5127ca;if(_0x40d620['query']['includeAll']){_0x362ca7['include']=[{'all':!![]}];}return db[_0x66b1('0x67')]['findAll'](_0x362ca7);})[_0x66b1('0x21')](function(_0x386d54){_0x38fbc7[_0x66b1('0x6c')]=_0x386d54;return _0x38fbc7;});}})['then'](respondWithFilteredResult(_0x4dbbe3,_0x362ca7))[_0x66b1('0x2c')](handleError(_0x4dbbe3,null));};exports[_0x66b1('0x6d')]=function(_0x4e3bd9,_0xb5fb49,_0x337cfc){return db[_0x66b1('0x44')][_0x66b1('0x5e')]({'where':{'id':_0x4e3bd9[_0x66b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb5fb49,null))[_0x66b1('0x21')](function(_0x166782){if(_0x166782){return _0x166782[_0x66b1('0x6d')](_0x4e3bd9[_0x66b1('0x49')][_0x66b1('0x6e')]);}})[_0x66b1('0x21')](respondWithStatusCode(_0xb5fb49,null))[_0x66b1('0x2c')](handleError(_0xb5fb49,null));};exports[_0x66b1('0x6f')]=function(_0x47adb3,_0x5cfc12,_0x3cc71a){if(_0x47adb3['body']['id']){delete _0x47adb3[_0x66b1('0x5f')]['id'];}return db[_0x66b1('0x44')][_0x66b1('0x5e')]({'where':{'id':_0x47adb3[_0x66b1('0x5c')]['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x5cfc12,null))[_0x66b1('0x21')](function(_0x3787cd){if(_0x3787cd){_0x47adb3[_0x66b1('0x5f')][_0x66b1('0x6b')]=_0x3787cd['id'];return db['CannedAnswer'][_0x66b1('0x63')](_0x47adb3[_0x66b1('0x5f')]);}})[_0x66b1('0x21')](respondWithResult(_0x5cfc12,null))[_0x66b1('0x2c')](handleError(_0x5cfc12,null));};exports['getAnswers']=function(_0x3d2934,_0x5392f8,_0x26d82d){var _0x4990a0={'raw':![],'where':{}};var _0x5d6fd2={};var _0x5eb7f9={'count':0x0,'rows':[]};return db[_0x66b1('0x44')][_0x66b1('0x69')]({'where':{'id':_0x3d2934[_0x66b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5392f8,null))[_0x66b1('0x21')](function(_0x3c565e){if(_0x3c565e){_0x5d6fd2[_0x66b1('0x4c')]=_[_0x66b1('0x5d')](db[_0x66b1('0x70')][_0x66b1('0x45')]);_0x5d6fd2[_0x66b1('0x49')]=_[_0x66b1('0x5d')](_0x3d2934['query']);_0x5d6fd2[_0x66b1('0x4a')]=_[_0x66b1('0x4b')](_0x5d6fd2[_0x66b1('0x4c')],_0x5d6fd2[_0x66b1('0x49')]);_0x4990a0[_0x66b1('0x4e')]=_[_0x66b1('0x4b')](_0x5d6fd2['model'],qs['fields'](_0x3d2934['query'][_0x66b1('0x4d')]));_0x4990a0[_0x66b1('0x4e')]=_0x4990a0['attributes'][_0x66b1('0x4f')]?_0x4990a0[_0x66b1('0x4e')]:_0x5d6fd2[_0x66b1('0x4c')];if(!_0x3d2934[_0x66b1('0x49')][_0x66b1('0x50')](_0x66b1('0x51'))){_0x4990a0['limit']=qs[_0x66b1('0x32')](_0x3d2934[_0x66b1('0x49')][_0x66b1('0x32')]);_0x4990a0['offset']=qs[_0x66b1('0x31')](_0x3d2934[_0x66b1('0x49')][_0x66b1('0x31')]);}_0x4990a0[_0x66b1('0x52')]=qs[_0x66b1('0x53')](_0x3d2934[_0x66b1('0x49')][_0x66b1('0x53')]);_0x4990a0[_0x66b1('0x54')]=qs[_0x66b1('0x4a')](_[_0x66b1('0x6a')](_0x3d2934[_0x66b1('0x49')],_0x5d6fd2['filters']));_0x4990a0[_0x66b1('0x54')]['WhatsappAccountId']=_0x3c565e['id'];if(_0x3d2934[_0x66b1('0x49')][_0x66b1('0x55')]){_0x4990a0[_0x66b1('0x54')]=_[_0x66b1('0x56')](_0x4990a0[_0x66b1('0x54')],{'$or':_[_0x66b1('0x43')](_0x4990a0[_0x66b1('0x4e')],function(_0x1d5630){var _0x2c1afa={};_0x2c1afa[_0x1d5630]={'$like':'%'+_0x3d2934[_0x66b1('0x49')][_0x66b1('0x55')]+'%'};return _0x2c1afa;})});}_0x4990a0=_[_0x66b1('0x56')]({},_0x4990a0,_0x3d2934[_0x66b1('0x58')]);return db[_0x66b1('0x70')][_0x66b1('0x30')]({'where':_0x4990a0[_0x66b1('0x54')]})[_0x66b1('0x21')](function(_0x302271){_0x5eb7f9[_0x66b1('0x30')]=_0x302271;if(_0x3d2934[_0x66b1('0x49')][_0x66b1('0x59')]){_0x4990a0[_0x66b1('0x5a')]=[{'all':!![]}];}return db[_0x66b1('0x70')][_0x66b1('0x5b')](_0x4990a0);})[_0x66b1('0x21')](function(_0x2f0b54){_0x5eb7f9[_0x66b1('0x6c')]=_0x2f0b54;return _0x5eb7f9;});}})[_0x66b1('0x21')](respondWithFilteredResult(_0x5392f8,_0x4990a0))['catch'](handleError(_0x5392f8,null));};exports[_0x66b1('0x71')]=function(_0x13f517,_0x880e9f,_0x24c89c){return db[_0x66b1('0x44')]['find']({'where':{'id':_0x13f517['params']['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x880e9f,null))[_0x66b1('0x21')](function(_0x4cf088){if(_0x4cf088){return _0x4cf088[_0x66b1('0x71')](_0x13f517[_0x66b1('0x49')][_0x66b1('0x6e')]);}})[_0x66b1('0x21')](respondWithStatusCode(_0x880e9f,null))['catch'](handleError(_0x880e9f,null));};exports[_0x66b1('0x72')]=function(_0x679812,_0x783517,_0x510514){return db['WhatsappAccount'][_0x66b1('0x5e')]({'where':{'id':_0x679812[_0x66b1('0x5c')]['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x783517,null))[_0x66b1('0x21')](function(_0x5b7580){if(_0x5b7580){return _0x5b7580[_0x66b1('0x72')](_0x679812[_0x66b1('0x5f')][_0x66b1('0x6e')],_[_0x66b1('0x73')](_0x679812['body'],['ids','id'])||{})[_0x66b1('0x74')](function(_0x4f9be1){for(var _0x4ba2b1=0x0;_0x4ba2b1<_0x679812[_0x66b1('0x5f')][_0x66b1('0x6e')]['length'];_0x4ba2b1+=0x1){socket[_0x66b1('0x75')](_0x66b1('0x76'),{'UserId':_0x679812['body'][_0x66b1('0x6e')][_0x4ba2b1],'WhatsappAccountId':_0x679812[_0x66b1('0x5c')]['id']});}return _0x4f9be1;});}})[_0x66b1('0x21')](respondWithResult(_0x783517,null))[_0x66b1('0x2c')](handleError(_0x783517,null));};exports[_0x66b1('0x77')]=function(_0x54094a,_0x14b111,_0x472552){return db[_0x66b1('0x44')]['find']({'where':{'id':_0x54094a[_0x66b1('0x5c')]['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x14b111,null))['then'](function(_0xa8157c){if(_0xa8157c){return _0xa8157c['removeAgents'](_0x54094a[_0x66b1('0x49')]['ids'])[_0x66b1('0x21')](function(){if(_['isArray'](_0x54094a[_0x66b1('0x49')][_0x66b1('0x6e')])){for(var _0xa82f97=0x0;_0xa82f97<_0x54094a[_0x66b1('0x49')][_0x66b1('0x6e')][_0x66b1('0x4f')];_0xa82f97+=0x1){socket[_0x66b1('0x75')](_0x66b1('0x78'),{'UserId':Number(_0x54094a['query'][_0x66b1('0x6e')][_0xa82f97]),'WhatsappAccountId':Number(_0x54094a[_0x66b1('0x5c')]['id'])});}}else{socket[_0x66b1('0x75')](_0x66b1('0x78'),{'UserId':Number(_0x54094a[_0x66b1('0x49')][_0x66b1('0x6e')]),'WhatsappAccountId':Number(_0x54094a[_0x66b1('0x5c')]['id'])});}});}})[_0x66b1('0x21')](respondWithStatusCode(_0x14b111,null))['catch'](handleError(_0x14b111,null));};exports[_0x66b1('0x79')]=function(_0x3e1042,_0x2c48ad,_0x470622){var _0x3f59d5={};var _0x5a923e={};var _0x4641dc;var _0xf5253c;return db[_0x66b1('0x44')][_0x66b1('0x69')]({'where':{'id':_0x3e1042[_0x66b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2c48ad,null))[_0x66b1('0x21')](function(_0x482056){if(_0x482056){_0x4641dc=_0x482056;_0x5a923e[_0x66b1('0x4c')]=_['keys'](db[_0x66b1('0x7a')]['rawAttributes']);_0x5a923e['query']=_['keys'](_0x3e1042[_0x66b1('0x49')]);_0x5a923e['filters']=_[_0x66b1('0x4b')](_0x5a923e[_0x66b1('0x4c')],_0x5a923e[_0x66b1('0x49')]);_0x3f59d5[_0x66b1('0x4e')]=_[_0x66b1('0x4b')](_0x5a923e[_0x66b1('0x4c')],qs[_0x66b1('0x4d')](_0x3e1042[_0x66b1('0x49')]['fields']));_0x3f59d5[_0x66b1('0x4e')]=_0x3f59d5[_0x66b1('0x4e')]['length']?_0x3f59d5['attributes']:_0x5a923e['model'];_0x3f59d5['order']=qs['sort'](_0x3e1042[_0x66b1('0x49')][_0x66b1('0x53')]);_0x3f59d5[_0x66b1('0x54')]=qs[_0x66b1('0x4a')](_[_0x66b1('0x6a')](_0x3e1042[_0x66b1('0x49')],_0x5a923e[_0x66b1('0x4a')]));if(_0x3e1042[_0x66b1('0x49')][_0x66b1('0x55')]){_0x3f59d5[_0x66b1('0x54')]=_[_0x66b1('0x56')](_0x3f59d5[_0x66b1('0x54')],{'$or':_[_0x66b1('0x43')](_0x3f59d5[_0x66b1('0x4e')],function(_0x4bf2bf){var _0x3944fc={};_0x3944fc[_0x4bf2bf]={'$like':'%'+_0x3e1042['query'][_0x66b1('0x55')]+'%'};return _0x3944fc;})});}_0x3f59d5=_['merge']({},_0x3f59d5,_0x3e1042[_0x66b1('0x58')]);return _0x4641dc['getAgents'](_0x3f59d5);}})[_0x66b1('0x21')](function(_0x15260c){if(_0x15260c){_0xf5253c=_0x15260c[_0x66b1('0x4f')];if(!_0x3e1042[_0x66b1('0x49')][_0x66b1('0x50')](_0x66b1('0x51'))){_0x3f59d5[_0x66b1('0x32')]=qs[_0x66b1('0x32')](_0x3e1042[_0x66b1('0x49')]['limit']);_0x3f59d5[_0x66b1('0x31')]=qs[_0x66b1('0x31')](_0x3e1042[_0x66b1('0x49')][_0x66b1('0x31')]);}return _0x4641dc['getAgents'](_0x3f59d5);}})[_0x66b1('0x21')](function(_0x3182ef){if(_0x3182ef){return _0x3182ef?{'count':_0xf5253c,'rows':_0x3182ef}:null;}})[_0x66b1('0x21')](respondWithResult(_0x2c48ad,null))['catch'](handleError(_0x2c48ad,null));};exports[_0x66b1('0x7b')]=function(_0x108977,_0x5ba467,_0x33250d){return db['WhatsappAccount'][_0x66b1('0x69')]({'where':{'id':_0x108977['params']['id']}})['then'](handleEntityNotFound(_0x5ba467,null))['then'](function(_0xe39d93){if(_0xe39d93){return db[_0x66b1('0x7c')]['transaction'](function(_0x243d53){return db[_0x66b1('0x7d')][_0x66b1('0x39')]({'where':{'WhatsappAccountId':_0x108977[_0x66b1('0x5c')]['id']},'transaction':_0x243d53})['then'](function(_0x256e60){var _0xd31429=_[_0x66b1('0x43')](_0x108977[_0x66b1('0x5f')],function(_0x9eff7d){_0x9eff7d[_0x66b1('0x6b')]=_0x108977[_0x66b1('0x5c')]['id'];return _0x9eff7d;});return db['WhatsappApplication'][_0x66b1('0x7e')](_0xd31429,{'transaction':_0x243d53});});})['then'](function(){return db['WhatsappApplication'][_0x66b1('0x7f')]({'where':{'WhatsappAccountId':_0x108977[_0x66b1('0x5c')]['id']},'order':_0x66b1('0x80')});});}})[_0x66b1('0x21')](respondWithResult(_0x5ba467,null))[_0x66b1('0x2c')](handleError(_0x5ba467,null));};exports[_0x66b1('0x81')]=function(_0x43fa17,_0x3ec648,_0x43a02b){var _0x363593={};var _0x4b963b={};var _0x49345c;var _0x249848;return db[_0x66b1('0x44')]['findOne']({'where':{'id':_0x43fa17[_0x66b1('0x5c')]['id']}})[_0x66b1('0x21')](handleEntityNotFound(_0x3ec648,null))[_0x66b1('0x21')](function(_0x2a80f7){if(_0x2a80f7){_0x49345c=_0x2a80f7;_0x4b963b[_0x66b1('0x4c')]=_[_0x66b1('0x5d')](db[_0x66b1('0x7d')]['rawAttributes']);_0x4b963b['query']=_[_0x66b1('0x5d')](_0x43fa17[_0x66b1('0x49')]);_0x4b963b[_0x66b1('0x4a')]=_['intersection'](_0x4b963b[_0x66b1('0x4c')],_0x4b963b[_0x66b1('0x49')]);_0x363593[_0x66b1('0x4e')]=_['intersection'](_0x4b963b[_0x66b1('0x4c')],qs[_0x66b1('0x4d')](_0x43fa17['query'][_0x66b1('0x4d')]));_0x363593[_0x66b1('0x4e')]=_0x363593['attributes'][_0x66b1('0x4f')]?_0x363593[_0x66b1('0x4e')]:_0x4b963b[_0x66b1('0x4c')];_0x363593[_0x66b1('0x52')]=qs[_0x66b1('0x53')](_0x43fa17[_0x66b1('0x49')][_0x66b1('0x53')]);_0x363593[_0x66b1('0x54')]=qs[_0x66b1('0x4a')](_['pick'](_0x43fa17['query'],_0x4b963b['filters']));if(_0x43fa17['query'][_0x66b1('0x55')]){_0x363593[_0x66b1('0x54')]=_['merge'](_0x363593['where'],{'$or':_['map'](_0x363593['attributes'],function(_0x110a83){var _0x48ee86={};_0x48ee86[_0x110a83]={'$like':'%'+_0x43fa17['query'][_0x66b1('0x55')]+'%'};return _0x48ee86;})});}_0x363593=_[_0x66b1('0x56')]({},_0x363593,_0x43fa17[_0x66b1('0x58')]);return _0x49345c[_0x66b1('0x81')](_0x363593);}})[_0x66b1('0x21')](function(_0x2c0668){if(_0x2c0668){_0x249848=_0x2c0668[_0x66b1('0x4f')];if(!_0x43fa17[_0x66b1('0x49')][_0x66b1('0x50')](_0x66b1('0x51'))){_0x363593['limit']=qs[_0x66b1('0x32')](_0x43fa17[_0x66b1('0x49')][_0x66b1('0x32')]);_0x363593[_0x66b1('0x31')]=qs['offset'](_0x43fa17['query'][_0x66b1('0x31')]);}return _0x49345c[_0x66b1('0x81')](_0x363593);}})['then'](function(_0x2dd5ca){if(_0x2dd5ca){return _0x2dd5ca?{'count':_0x249848,'rows':_0x2dd5ca}:null;}})['then'](respondWithResult(_0x3ec648,null))[_0x66b1('0x2c')](handleError(_0x3ec648,null));};exports[_0x66b1('0x82')]=function(_0x4a1b17,_0x374026,_0x1d8fc5){var _0x3375ed={'channel':_0x66b1('0x83')};var _0x122ba5=[];var _0x412f20=[];var _0x4515f5={};return db['WhatsappAccount'][_0x66b1('0x5e')]({'where':{'id':_0x4a1b17[_0x66b1('0x5c')]['id']},'include':[{'model':db[_0x66b1('0x7d')],'as':'Applications'}]})[_0x66b1('0x21')](handleEntityNotFound(_0x374026,null))[_0x66b1('0x21')](function(_0x3a379c){_0x3375ed['account']=_0x3a379c;_0x3375ed[_0x66b1('0x84')]=_['orderBy'](_0x3a379c['Applications'],[_0x66b1('0x80')],['asc']);if(_0x3375ed[_0x66b1('0x85')]['Applications']){delete _0x3375ed[_0x66b1('0x85')][_0x66b1('0x86')];}return db[_0x66b1('0x87')][_0x66b1('0x65')]();})['then'](function(_0x562413){if(!_0x562413){throw new db[(_0x66b1('0x88'))][(_0x66b1('0x89'))](_0x66b1('0x8a'));}_0x122ba5=_['difference'](_[_0x66b1('0x5d')](_0x562413),[_0x66b1('0x8b'),_0x66b1('0x8c')]);_0x412f20=_[_0x66b1('0x8d')](_[_0x66b1('0x5d')](_0x562413),['createdAt',_0x66b1('0x8c'),_0x66b1('0x8e'),_0x66b1('0x8f')]);_0x3375ed['body']={'mapKey':'mobile'};if(_0x3375ed[_0x66b1('0x85')]['type']&&_0x3375ed['account'][_0x66b1('0x47')]===_0x66b1('0x90')){_0x3375ed[_0x66b1('0x5f')][_0x66b1('0x91')]=_0x4a1b17[_0x66b1('0x5f')]['From']['replace'](_0x66b1('0x92'),'');_0x3375ed['body']['body']=_0x4a1b17[_0x66b1('0x5f')][_0x66b1('0x93')];_0x3375ed['body'][_0x66b1('0x94')]=_0x4a1b17['body'][_0x66b1('0x95')];}if(_0x3375ed[_0x66b1('0x5f')]['id']){delete _0x3375ed['body']['id'];}if(_['isNil'](_0x3375ed[_0x66b1('0x5f')]['from'])){throw new db[(_0x66b1('0x88'))][(_0x66b1('0x89'))](_0x66b1('0x96'));}if(_[_0x66b1('0x97')](_0x3375ed[_0x66b1('0x5f')][_0x66b1('0x5f')])||_0x3375ed[_0x66b1('0x5f')]['body']===''){throw new db[(_0x66b1('0x88'))][(_0x66b1('0x89'))](_0x66b1('0x98'));}if(_[_0x66b1('0x97')](_0x3375ed[_0x66b1('0x5f')][_0x66b1('0x99')])){throw new db['Sequelize'][(_0x66b1('0x89'))](_0x66b1('0x9a')+_0x412f20);}if(!_[_0x66b1('0x9b')](_0x412f20,_0x3375ed[_0x66b1('0x5f')][_0x66b1('0x99')])){throw new db[(_0x66b1('0x88'))][(_0x66b1('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x412f20);}_0x4515f5[_0x3375ed[_0x66b1('0x5f')]['mapKey']]=_0x3375ed[_0x66b1('0x5f')][_0x66b1('0x91')];return db[_0x66b1('0x9c')][_0x66b1('0x5e')]({'where':{'id':_0x3375ed['account'][_0x66b1('0x8f')]},'include':[{'model':db[_0x66b1('0x87')],'as':_0x66b1('0x9d'),'where':_0x4515f5,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x66b1('0x21')](handleEntityNotFound(_0x374026,null))[_0x66b1('0x21')](function(_0xb56a0a){if(_0xb56a0a){_0x3375ed[_0x66b1('0x9e')]=_[_0x66b1('0x73')](_0xb56a0a,[_0x66b1('0x9d')]);if(_0xb56a0a['Contacts'][_0x66b1('0x4f')]){return _0xb56a0a['Contacts'][0x0];}var _0x196039=_[_0x66b1('0x1b')](_0x3375ed['body'],{'firstName':_0x3375ed[_0x66b1('0x5f')]['from'],'ListId':_0xb56a0a['id']});_0x196039[_0x3375ed['body']['mapKey']]=_0x3375ed['body'][_0x66b1('0x91')];return db['CmContact'][_0x66b1('0x63')](_0x196039,{'fields':_0x122ba5,'raw':!![]});}})[_0x66b1('0x21')](handleEntityNotFound(_0x374026,null))[_0x66b1('0x21')](function(_0x1b0d9d){if(_0x1b0d9d){_0x3375ed[_0x66b1('0x9f')]=_0x1b0d9d;var _0x250fe4={'ContactId':_0x1b0d9d['id'],'phone':_0x3375ed['body'][_0x66b1('0x91')],'WhatsappAccountId':_0x4a1b17[_0x66b1('0x5c')]['id']};var _0x1706b7={'ContactId':_0x1b0d9d['id'],'WhatsappAccountId':_0x4a1b17[_0x66b1('0x5c')]['id'],'closed':![]};return db[_0x66b1('0xa0')][_0x66b1('0x5e')]({'where':_0x1706b7})['then'](function(_0x20afc2){if(_0x20afc2){return[_0x20afc2,![]];}return db[_0x66b1('0xa0')]['create'](_0x250fe4)['then'](function(_0x194e9c){return[_0x194e9c,!![]];});});}})['spread'](function(_0xecaf9f,_0x5e755f){_0x3375ed[_0x66b1('0xa1')]=_0xecaf9f['get']({'plain':!![]});_0x3375ed['interaction'][_0x66b1('0xa2')]=![];if(_0x5e755f){if(_0x3375ed[_0x66b1('0x85')][_0x66b1('0xa3')]){_0x3375ed[_0x66b1('0x84')][_0x66b1('0xa4')]({'id':0x0,'priority':_0x3375ed[_0x66b1('0x84')][_0x66b1('0x4f')]+0x1,'app':_0x66b1('0xa5'),'appdata':'unmanaged','interval':_0x66b1('0xa6')});}_0x3375ed[_0x66b1('0xa1')][_0x66b1('0xa2')]=!![];}return db['WhatsappMessage'][_0x66b1('0x63')]({'phone':_0x3375ed[_0x66b1('0x5f')][_0x66b1('0x91')],'messageId':_0x3375ed['body'][_0x66b1('0x94')],'body':_0x3375ed['body'][_0x66b1('0x5f')],'WhatsappAccountId':_0x4a1b17[_0x66b1('0x5c')]['id'],'WhatsappInteractionId':_0xecaf9f['id'],'direction':'in','ContactId':_0xecaf9f['ContactId'],'AttachmentId':_0x3375ed[_0x66b1('0x5f')][_0x66b1('0xa7')]});})[_0x66b1('0x21')](function(_0x3a97e4){_0x3375ed[_0x66b1('0x29')]=_0x3a97e4;if(_0x3375ed['interaction'][_0x66b1('0xa8')]){return db[_0x66b1('0x7a')][_0x66b1('0x5e')]({'attributes':['id',_0x66b1('0x3e')],'where':{'id':_0x3375ed['interaction'][_0x66b1('0xa8')]}})['then'](function(_0x3fa73b){if(_0x3fa73b){_0x3375ed[_0x66b1('0x84')][_0x66b1('0xa9')]({'id':0x0,'priority':0x0,'app':_0x66b1('0xaa'),'appdata':_0x3fa73b[_0x66b1('0x3e')]+','+(_0x3375ed[_0x66b1('0x85')][_0x66b1('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x66b1('0xac'),_0x66b1('0xad'),_0x3375ed);});}return respondWithRpcPromise('Start',_0x66b1('0xad'),_0x3375ed);})[_0x66b1('0x21')](function(_0x5bfbd0){if(_0x5bfbd0){var _0x97bac1=0xc8;var _0x3da651=_0x66b1('0xae');logger['info'](_0x66b1('0x25'),_0x3da651,_0x97bac1,'entity\x20found');logger[_0x66b1('0x24')](_0x66b1('0xaf'),_0x3da651,_0x97bac1,'entity\x20found',JSON[_0x66b1('0x26')](_0x5bfbd0));if(_0x3375ed[_0x66b1('0x85')][_0x66b1('0x47')]===_0x66b1('0x90')){return _0x374026[_0x66b1('0x2f')](_0x97bac1)['set']('Content-Type',_0x66b1('0xb0'))[_0x66b1('0x3f')]('\x0a');}else{return _0x374026[_0x66b1('0x2f')](_0x97bac1)[_0x66b1('0x35')](_0x5bfbd0);}}})['catch'](handleError(_0x374026,null));};exports['send']=function(_0x4c2498,_0x2cc266,_0x4f73f0){var _0x484b2d,_0xf9263d,_0x280db6;if(_[_0x66b1('0x97')](_0x4c2498['body'][_0x66b1('0x5f')])||_0x4c2498['body'][_0x66b1('0x5f')]===''){throw new db[(_0x66b1('0x88'))][(_0x66b1('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x66b1('0x97')](_0x4c2498['body']['to'])){throw new db['Sequelize'][(_0x66b1('0x89'))](_0x66b1('0xb1'));}_0x484b2d=_0x4c2498[_0x66b1('0x5f')]['to'];return db[_0x66b1('0x44')][_0x66b1('0x5e')]({'where':{'id':_0x4c2498[_0x66b1('0x5c')]['id']},'include':[{'model':db[_0x66b1('0x9c')],'as':_0x66b1('0xb2'),'include':[{'model':db[_0x66b1('0x87')],'as':_0x66b1('0x9d'),'where':{'mobile':_0x484b2d},'limit':0x1,'order':[['updatedAt',_0x66b1('0xb3')]]}]}]})[_0x66b1('0x21')](handleEntityNotFound(_0x2cc266,null))[_0x66b1('0x21')](function(_0x4c583a){if(_0x4c583a&&_0x4c583a['List']){_0xf9263d=_0x4c583a[_0x66b1('0x3a')]({'plain':!![]});if(_0xf9263d[_0x66b1('0xb2')]&&_0xf9263d[_0x66b1('0xb2')]['Contacts'][_0x66b1('0x4f')]){return _0xf9263d[_0x66b1('0xb2')][_0x66b1('0x9d')][0x0];}return db[_0x66b1('0x87')][_0x66b1('0x63')](_[_0x66b1('0x1b')](_0x4c2498[_0x66b1('0x5f')],{'firstName':_0x484b2d,'mobile':_0x484b2d,'phone':_0x484b2d,'ListId':_0xf9263d['ListId']}));}})[_0x66b1('0x21')](handleEntityNotFound(_0x2cc266,null))[_0x66b1('0x21')](function(_0x1e1e76){if(_0x1e1e76){_0x280db6=_0x1e1e76;return db['WhatsappInteraction'][_0x66b1('0x5e')]({'where':{'ContactId':_0x280db6['id'],'closed':![],'WhatsappAccountId':_0xf9263d['id']}})[_0x66b1('0x21')](function(_0x179727){if(_0x179727){return[_0x179727,![]];}return db[_0x66b1('0xa0')]['create']({'UserId':_0x4c2498[_0x66b1('0x60')]['id'],'ContactId':_0x280db6['id'],'WhatsappAccountId':_0xf9263d['id'],'phone':_0x484b2d,'firstMsgDirection':_0x66b1('0xb4'),'Messages':[_[_0x66b1('0x56')](_0x4c2498['body'],{'read':![],'body':_0x4c2498['body'][_0x66b1('0x5f')],'phone':_0x484b2d,'WhatsappAccountId':_0xf9263d['id'],'UserId':_0x4c2498[_0x66b1('0x60')]['id'],'ContactId':_0x280db6['id']})]},{'include':[{'model':db[_0x66b1('0xb5')],'as':_0x66b1('0xb6')}]})[_0x66b1('0x21')](function(_0x151677){return[_0x151677,!![]];});});}})[_0x66b1('0x74')](function(_0x31c3d9,_0x1593e5){if(_0x1593e5){return _0x31c3d9;}return db[_0x66b1('0xb5')][_0x66b1('0x63')](_[_0x66b1('0x56')](_0x4c2498['body'],{'read':![],'body':_0x4c2498[_0x66b1('0x5f')]['body'],'phone':_0x484b2d,'WhatsappAccountId':_0xf9263d['id'],'WhatsappInteractionId':_0x31c3d9['id'],'UserId':_0x4c2498[_0x66b1('0x60')]['id'],'ContactId':_0x280db6['id']}))[_0x66b1('0x21')](function(_0x3c6d60){_0x31c3d9[_0x66b1('0xb7')]['Messages']=[];_0x31c3d9[_0x66b1('0xb7')]['Messages']['push'](_0x3c6d60[_0x66b1('0xb7')]);return _0x31c3d9;});})[_0x66b1('0x21')](respondWithResult(_0x2cc266,null))[_0x66b1('0x2c')](handleError(_0x2cc266,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index df6651b..dd5b8f8 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 _0x9f0e=['WhatsappAccount','setMaxListeners','save','emit','hook','exports','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5f37de,_0x1a5921){_0x5f37de=_0x5f37de-0x0;var _0x114e32=_0x9f0e[_0x5f37de];return _0x114e32;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var WhatsappAccount=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe9f0('0x3')](0x0);var events={'afterCreate':_0xe9f0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2325c6){return function(_0x150a03,_0x3c589d,_0x202d69){WhatsappAccountEvents[_0xe9f0('0x5')](_0x2325c6+':'+_0x150a03['id'],_0x150a03);WhatsappAccountEvents['emit'](_0x2325c6,_0x150a03);_0x202d69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xe9f0('0x6')](e,emitEvent(event));}}module[_0xe9f0('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcde7=['setMaxListeners','save','emit','hasOwnProperty','hook','WhatsappAccount'];(function(_0x209ddc,_0x468abe){var _0xdbe6b6=function(_0x2dc576){while(--_0x2dc576){_0x209ddc['push'](_0x209ddc['shift']());}};_0xdbe6b6(++_0x468abe);}(_0xcde7,0x65));var _0x7cde=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcde7[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x7cde('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7cde('0x1')](0x0);var events={'afterCreate':_0x7cde('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11004a){return function(_0x47962e,_0x23ec50,_0x5824bf){WhatsappAccountEvents[_0x7cde('0x3')](_0x11004a+':'+_0x47962e['id'],_0x47962e);WhatsappAccountEvents[_0x7cde('0x3')](_0x11004a,_0x47962e);_0x5824bf(null);};}for(var e in events){if(events[_0x7cde('0x4')](e)){var event=events[e];WhatsappAccount[_0x7cde('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8c44285..9d54173 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 _0xc124=['define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc124,0x123));var _0x4c12=function(_0x5a0c76,_0x253761){_0x5a0c76=_0x5a0c76-0x0;var _0x5b5663=_0xc124[_0x5a0c76];return _0x5b5663;};'use strict';var _=require('lodash');var util=require(_0x4c12('0x0'));var logger=require(_0x4c12('0x1'))(_0x4c12('0x2'));var moment=require(_0x4c12('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c12('0x4'));var fs=require('fs');var path=require(_0x4c12('0x5'));var rimraf=require(_0x4c12('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c12('0x7'));module[_0x4c12('0x8')]=function(_0x414fc9,_0x6f22d4){return _0x414fc9[_0x4c12('0x9')](_0x4c12('0xa'),attributes,{'tableName':_0x4c12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf033=['rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','../../config/logger','api','request-promise'];(function(_0x1ea8c4,_0x2cf052){var _0x4efd0d=function(_0x512afa){while(--_0x512afa){_0x1ea8c4['push'](_0x1ea8c4['shift']());}};_0x4efd0d(++_0x2cf052);}(_0xf033,0x135));var _0x3f03=function(_0x37b0e1,_0x5f3934){_0x37b0e1=_0x37b0e1-0x0;var _0x24e3b2=_0xf033[_0x37b0e1];return _0x24e3b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f03('0x0'))(_0x3f03('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f03('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f03('0x3'));var config=require(_0x3f03('0x4'));var attributes=require(_0x3f03('0x5'));module['exports']=function(_0x4bb1d7,_0x253a2f){return _0x4bb1d7[_0x3f03('0x6')](_0x3f03('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 321207a..79b743e 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 _0x477a=['where','include','map','model','attributes','then','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options'];(function(_0x3fe1f8,_0x17463c){var _0x2a2326=function(_0x402277){while(--_0x402277){_0x3fe1f8['push'](_0x3fe1f8['shift']());}};_0x2a2326(++_0x17463c);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa477('0x0'));var util=require('util');var moment=require(_0xa477('0x1'));var BPromise=require(_0xa477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa477('0x3'));var db=require(_0xa477('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa477('0x5'));var config=require(_0xa477('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa477('0x7')][_0xa477('0x8')]({'port':0x232a});config[_0xa477('0x9')]=_[_0xa477('0xa')](config[_0xa477('0x9')],{'host':_0xa477('0xb'),'port':0x18eb});var socket=require(_0xa477('0xc'))(new Redis(config[_0xa477('0x9')]));require(_0xa477('0xd'))['register'](socket);function respondWithRpcPromise(_0x210383,_0x3d46eb,_0x599eb7){return new BPromise(function(_0x4ce130,_0x559cb9){return client['request'](_0x210383,_0x599eb7)['then'](function(_0x3450d1){logger[_0xa477('0xe')](_0xa477('0xf'),_0x3d46eb,'request\x20sent');logger[_0xa477('0x10')](_0xa477('0x11'),_0x3d46eb,_0xa477('0x12'),JSON['stringify'](_0x3450d1));if(_0x3450d1[_0xa477('0x13')]){if(_0x3450d1[_0xa477('0x13')][_0xa477('0x14')]===0x1f4){logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x3450d1['error'][_0xa477('0x15')]);return _0x559cb9(_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);}logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);return _0x4ce130(_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);}else{logger[_0xa477('0xe')](_0xa477('0xf'),_0x3d46eb,_0xa477('0x12'));_0x4ce130(_0x3450d1[_0xa477('0x16')]['message']);}})[_0xa477('0x17')](function(_0x16c31d){logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x16c31d);_0x559cb9(_0x16c31d);});});}exports[_0xa477('0x18')]=function(_0x265169){var _0x2a3f54=this;return new Promise(function(_0x2c245b,_0x5af670){return db[_0xa477('0x19')][_0xa477('0x1a')]({'raw':_0x265169[_0xa477('0x1b')]?_0x265169['options']['raw']===undefined?!![]:![]:!![],'where':_0x265169['options']?_0x265169[_0xa477('0x1b')][_0xa477('0x1c')]||null:null,'attributes':_0x265169['options']?_0x265169[_0xa477('0x1b')]['attributes']||null:null,'include':_0x265169['options']?_0x265169[_0xa477('0x1b')][_0xa477('0x1d')]?_[_0xa477('0x1e')](_0x265169[_0xa477('0x1b')][_0xa477('0x1d')],function(_0xacd9d7){return{'model':db[_0xacd9d7[_0xa477('0x1f')]],'as':_0xacd9d7['as'],'attributes':_0xacd9d7['attributes'],'include':_0xacd9d7[_0xa477('0x1d')]?_[_0xa477('0x1e')](_0xacd9d7[_0xa477('0x1d')],function(_0x236416){return{'model':db[_0x236416[_0xa477('0x1f')]],'as':_0x236416['as'],'attributes':_0x236416[_0xa477('0x20')],'include':_0x236416[_0xa477('0x1d')]?_['map'](_0x236416[_0xa477('0x1d')],function(_0x3abe3a){return{'model':db[_0x3abe3a[_0xa477('0x1f')]],'as':_0x3abe3a['as'],'attributes':_0x3abe3a[_0xa477('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa477('0x21')](function(_0xdb15a9){logger[_0xa477('0xe')]('ShowWhatsappAccount',_0x265169);logger[_0xa477('0x10')]('ShowWhatsappAccount',_0x265169,JSON['stringify'](_0xdb15a9));_0x2c245b(_0xdb15a9);})[_0xa477('0x17')](function(_0x1fa6a5){logger['error'](_0xa477('0x18'),_0x1fa6a5[_0xa477('0x15')],_0x265169);_0x5af670(_0x2a3f54[_0xa477('0x13')](0x1f4,_0x1fa6a5[_0xa477('0x15')]));});});}; \ No newline at end of file +var _0x57fc=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis'];(function(_0x5a5f5c,_0x390878){var _0x288f36=function(_0x3d7030){while(--_0x3d7030){_0x5a5f5c['push'](_0x5a5f5c['shift']());}};_0x288f36(++_0x390878);}(_0x57fc,0x1c9));var _0xc57f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57fc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc57f('0x0'));var util=require('util');var moment=require(_0xc57f('0x1'));var BPromise=require(_0xc57f('0x2'));var rs=require(_0xc57f('0x3'));var fs=require('fs');var Redis=require(_0xc57f('0x4'));var db=require(_0xc57f('0x5'))['db'];var utils=require(_0xc57f('0x6'));var logger=require(_0xc57f('0x7'))('rpc');var config=require(_0xc57f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc57f('0x9')]({'port':0x232a});config[_0xc57f('0xa')]=_[_0xc57f('0xb')](config[_0xc57f('0xa')],{'host':_0xc57f('0xc'),'port':0x18eb});var socket=require(_0xc57f('0xd'))(new Redis(config[_0xc57f('0xa')]));require(_0xc57f('0xe'))[_0xc57f('0xf')](socket);function respondWithRpcPromise(_0x379b45,_0x285c21,_0x1a6a7f){return new BPromise(function(_0x533d06,_0x47b852){return client[_0xc57f('0x10')](_0x379b45,_0x1a6a7f)[_0xc57f('0x11')](function(_0x5a73a3){logger[_0xc57f('0x12')](_0xc57f('0x13'),_0x285c21,'request\x20sent');logger['debug'](_0xc57f('0x14'),_0x285c21,_0xc57f('0x15'),JSON[_0xc57f('0x16')](_0x5a73a3));if(_0x5a73a3[_0xc57f('0x17')]){if(_0x5a73a3['error'][_0xc57f('0x18')]===0x1f4){logger[_0xc57f('0x17')](_0xc57f('0x13'),_0x285c21,_0x5a73a3[_0xc57f('0x17')][_0xc57f('0x19')]);return _0x47b852(_0x5a73a3[_0xc57f('0x17')][_0xc57f('0x19')]);}logger['error'](_0xc57f('0x13'),_0x285c21,_0x5a73a3[_0xc57f('0x17')]['message']);return _0x533d06(_0x5a73a3[_0xc57f('0x17')][_0xc57f('0x19')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x285c21,_0xc57f('0x15'));_0x533d06(_0x5a73a3[_0xc57f('0x1a')][_0xc57f('0x19')]);}})[_0xc57f('0x1b')](function(_0x240bb6){logger['error'](_0xc57f('0x13'),_0x285c21,_0x240bb6);_0x47b852(_0x240bb6);});});}exports[_0xc57f('0x1c')]=function(_0x2f1381){var _0x378c92=this;return new Promise(function(_0x3edbb0,_0x1c275d){return db[_0xc57f('0x1d')][_0xc57f('0x1e')]({'raw':_0x2f1381[_0xc57f('0x1f')]?_0x2f1381[_0xc57f('0x1f')][_0xc57f('0x20')]===undefined?!![]:![]:!![],'where':_0x2f1381[_0xc57f('0x1f')]?_0x2f1381[_0xc57f('0x1f')][_0xc57f('0x21')]||null:null,'attributes':_0x2f1381[_0xc57f('0x1f')]?_0x2f1381[_0xc57f('0x1f')][_0xc57f('0x22')]||null:null,'include':_0x2f1381['options']?_0x2f1381[_0xc57f('0x1f')][_0xc57f('0x23')]?_[_0xc57f('0x24')](_0x2f1381[_0xc57f('0x1f')][_0xc57f('0x23')],function(_0x24b84c){return{'model':db[_0x24b84c['model']],'as':_0x24b84c['as'],'attributes':_0x24b84c[_0xc57f('0x22')],'include':_0x24b84c[_0xc57f('0x23')]?_['map'](_0x24b84c['include'],function(_0x2e10b5){return{'model':db[_0x2e10b5[_0xc57f('0x25')]],'as':_0x2e10b5['as'],'attributes':_0x2e10b5[_0xc57f('0x22')],'include':_0x2e10b5['include']?_[_0xc57f('0x24')](_0x2e10b5[_0xc57f('0x23')],function(_0x5092ce){return{'model':db[_0x5092ce[_0xc57f('0x25')]],'as':_0x5092ce['as'],'attributes':_0x5092ce[_0xc57f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc57f('0x11')](function(_0x3e92e4){logger[_0xc57f('0x12')](_0xc57f('0x1c'),_0x2f1381);logger[_0xc57f('0x26')](_0xc57f('0x1c'),_0x2f1381,JSON[_0xc57f('0x16')](_0x3e92e4));_0x3edbb0(_0x3e92e4);})[_0xc57f('0x1b')](function(_0x27a925){logger['error'](_0xc57f('0x1c'),_0x27a925['message'],_0x2f1381);_0x1c275d(_0x378c92[_0xc57f('0x17')](0x1f4,_0x27a925[_0xc57f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3209d68..374f76b 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 _0x1558=['save','emit','removeListener','whatsappAccount:'];(function(_0xd9b6eb,_0x157532){var _0x4e8be3=function(_0x5124d1){while(--_0x5124d1){_0xd9b6eb['push'](_0xd9b6eb['shift']());}};_0x4e8be3(++_0x157532);}(_0x1558,0x1d0));var _0x8155=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0x1558[_0x34e752];return _0x7c6347;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x8155('0x0'),'remove','update'];function createListener(_0x4cad4a,_0x5d875d){return function(_0x4de837){_0x5d875d[_0x8155('0x1')](_0x4cad4a,_0x4de837);};}function removeListener(_0x5d131a,_0x225ea1){return function(){WhatsappAccountEvents[_0x8155('0x2')](_0x5d131a,_0x225ea1);};}exports['register']=function(_0x49daac){for(var _0x1b4d7c=0x0,_0x5c291c=events['length'];_0x1b4d7c<_0x5c291c;_0x1b4d7c++){var _0x5f096e=events[_0x1b4d7c];var _0x453542=createListener(_0x8155('0x3')+_0x5f096e,_0x49daac);WhatsappAccountEvents['on'](_0x5f096e,_0x453542);}}; \ No newline at end of file +var _0x056a=['save','remove','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x056a,0x147));var _0xa056=function(_0x5543ff,_0x18c143){_0x5543ff=_0x5543ff-0x0;var _0x4fe510=_0x056a[_0x5543ff];return _0x4fe510;};'use strict';var WhatsappAccountEvents=require(_0xa056('0x0'));var events=[_0xa056('0x1'),_0xa056('0x2'),_0xa056('0x3')];function createListener(_0x14d994,_0x390d9c){return function(_0x32032c){_0x390d9c[_0xa056('0x4')](_0x14d994,_0x32032c);};}function removeListener(_0x50480e,_0x2f67b7){return function(){WhatsappAccountEvents[_0xa056('0x5')](_0x50480e,_0x2f67b7);};}exports['register']=function(_0x419a0f){for(var _0xc56614=0x0,_0x5dbea2=events[_0xa056('0x6')];_0xc56614<_0x5dbea2;_0xc56614++){var _0x279c6e=events[_0xc56614];var _0x9ef796=createListener(_0xa056('0x7')+_0x279c6e,_0x419a0f);WhatsappAccountEvents['on'](_0x279c6e,_0x9ef796);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7ddc084..32f5909 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 _0xa635=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa635,0x151));var _0x5a63=function(_0x1c8246,_0x2c142a){_0x1c8246=_0x1c8246-0x0;var _0x4d9881=_0xa635[_0x1c8246];return _0x4d9881;};'use strict';var multer=require(_0x5a63('0x0'));var util=require(_0x5a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5a63('0x2'));var router=express['Router']();var auth=require(_0x5a63('0x3'));var interaction=require(_0x5a63('0x4'));var config=require(_0x5a63('0x5'));var controller=require(_0x5a63('0x6'));router[_0x5a63('0x7')]('/',auth[_0x5a63('0x8')](),controller[_0x5a63('0x9')]);router['get'](_0x5a63('0xa'),auth[_0x5a63('0x8')](),controller[_0x5a63('0xb')]);router[_0x5a63('0xc')]('/',auth[_0x5a63('0x8')](),controller[_0x5a63('0xd')]);router[_0x5a63('0xe')](_0x5a63('0xa'),auth[_0x5a63('0x8')](),controller[_0x5a63('0xf')]);router['delete']('/:id',auth[_0x5a63('0x8')](),controller[_0x5a63('0x10')]);module[_0x5a63('0x11')]=router; \ No newline at end of file +var _0x3ec2=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x3b9b53,_0x5685a9){var _0x391e7a=function(_0xc4429){while(--_0xc4429){_0x3b9b53['push'](_0x3b9b53['shift']());}};_0x391e7a(++_0x5685a9);}(_0x3ec2,0x6c));var _0x23ec=function(_0x39d6c1,_0x2a7894){_0x39d6c1=_0x39d6c1-0x0;var _0x5da7bd=_0x3ec2[_0x39d6c1];return _0x5da7bd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x23ec('0x0'));var timeout=require(_0x23ec('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x23ec('0x2'));var interaction=require(_0x23ec('0x3'));var config=require(_0x23ec('0x4'));var controller=require('./whatsappApplication.controller');router[_0x23ec('0x5')]('/',auth[_0x23ec('0x6')](),controller[_0x23ec('0x7')]);router[_0x23ec('0x5')](_0x23ec('0x8'),auth['isAuthenticated'](),controller[_0x23ec('0x9')]);router[_0x23ec('0xa')]('/',auth[_0x23ec('0x6')](),controller[_0x23ec('0xb')]);router[_0x23ec('0xc')](_0x23ec('0x8'),auth['isAuthenticated'](),controller[_0x23ec('0xd')]);router['delete'](_0x23ec('0x8'),auth[_0x23ec('0x6')](),controller[_0x23ec('0xe')]);module[_0x23ec('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 42542b4..b1763f2 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 _0x6351=['STRING','*,*,*,*','sequelize','INTEGER','noop','TEXT'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x6351,0xec));var _0x1635=function(_0x45e56c,_0x4235d0){_0x45e56c=_0x45e56c-0x0;var _0x4826ef=_0x6351[_0x45e56c];return _0x4826ef;};'use strict';var Sequelize=require(_0x1635('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1635('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1635('0x2')},'appdata':{'type':Sequelize[_0x1635('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1635('0x4')],'defaultValue':_0x1635('0x5')}}; \ No newline at end of file +var _0x2a97=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x2a97,0x182));var _0x72a9=function(_0x23ae4a,_0x5c8284){_0x23ae4a=_0x23ae4a-0x0;var _0x526b42=_0x2a97[_0x23ae4a];return _0x526b42;};'use strict';var Sequelize=require(_0x72a9('0x0'));module['exports']={'priority':{'type':Sequelize[_0x72a9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x72a9('0x2')],'allowNull':![],'defaultValue':_0x72a9('0x3')},'appdata':{'type':Sequelize[_0x72a9('0x4')]()},'description':{'type':Sequelize[_0x72a9('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x72a9('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index bfa080e..ebd8d5d 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 _0x04b2=['intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','json','apply','save','then','destroy','sendStatus','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','attributes'];(function(_0x4d9c09,_0x20ee79){var _0x3156e7=function(_0x7ed4bb){while(--_0x7ed4bb){_0x4d9c09['push'](_0x4d9c09['shift']());}};_0x3156e7(++_0x20ee79);}(_0x04b2,0x126));var _0x204b=function(_0x534817,_0x55cc0a){_0x534817=_0x534817-0x0;var _0x4e3ecb=_0x04b2[_0x534817];return _0x4e3ecb;};'use strict';var pdf=require(_0x204b('0x0'));var emlformat=require(_0x204b('0x1'));var rimraf=require(_0x204b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x204b('0x3'));var moment=require(_0x204b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x204b('0x5'));var path=require(_0x204b('0x6'));var sox=require('sox');var csv=require(_0x204b('0x7'));var ejs=require(_0x204b('0x8'));var fs=require('fs');var _=require(_0x204b('0x9'));var squel=require(_0x204b('0xa'));var crypto=require(_0x204b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x204b('0x7'));var querystring=require('querystring');var Papa=require(_0x204b('0xc'));var Redis=require('ioredis');var authService=require(_0x204b('0xd'));var qs=require(_0x204b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x204b('0xf'));var logger=require(_0x204b('0x10'))(_0x204b('0x11'));var utils=require(_0x204b('0x12'));var config=require(_0x204b('0x13'));var licenseUtil=require(_0x204b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d0f7,_0x3b9aea){_0x3b9aea=_0x3b9aea||0xcc;return function(_0xc81a84){if(_0xc81a84){return _0x56d0f7['sendStatus'](_0x3b9aea);}return _0x56d0f7[_0x204b('0x15')](_0x3b9aea)[_0x204b('0x16')]();};}function respondWithResult(_0x4951a5,_0x4866dd){_0x4866dd=_0x4866dd||0xc8;return function(_0x5d38be){if(_0x5d38be){return _0x4951a5[_0x204b('0x15')](_0x4866dd)['json'](_0x5d38be);}};}function respondWithFilteredResult(_0x582b6a,_0x43a252){return function(_0x2738fe){if(_0x2738fe){var _0x27195c=_0x2738fe[_0x204b('0x17')],_0x2259e5=_0x43a252['offset'],_0x2a1e68=_0x43a252[_0x204b('0x18')]+_0x43a252[_0x204b('0x19')],_0x2cc3c1;if(_0x2a1e68>=_0x27195c){_0x2a1e68=_0x27195c;_0x2cc3c1=0xc8;}else{_0x2cc3c1=0xce;}_0x582b6a[_0x204b('0x15')](_0x2cc3c1);return _0x582b6a[_0x204b('0x1a')]('Content-Range',_0x2259e5+'-'+_0x2a1e68+'/'+_0x27195c)[_0x204b('0x1b')](_0x2738fe);}return null;};}function patchUpdates(_0x486af3){return function(_0x31d287){try{jsonpatch[_0x204b('0x1c')](_0x31d287,_0x486af3,!![]);}catch(_0x2345b5){return BPromise['reject'](_0x2345b5);}return _0x31d287[_0x204b('0x1d')]();};}function saveUpdates(_0x3a35c0,_0x90d625){return function(_0x1f42cb){if(_0x1f42cb){return _0x1f42cb['update'](_0x3a35c0)[_0x204b('0x1e')](function(_0x37aa74){return _0x37aa74;});}return null;};}function removeEntity(_0x2694dd,_0x3d61ed){return function(_0x510188){if(_0x510188){return _0x510188[_0x204b('0x1f')]()[_0x204b('0x1e')](function(){_0x2694dd[_0x204b('0x15')](0xcc)[_0x204b('0x16')]();});}};}function handleEntityNotFound(_0xa53e8,_0x34c1e9){return function(_0x295f97){if(!_0x295f97){_0xa53e8[_0x204b('0x20')](0x194);}return _0x295f97;};}function handleError(_0x304fa7,_0x5c722e){_0x5c722e=_0x5c722e||0x1f4;return function(_0x4be813){logger[_0x204b('0x21')](_0x4be813['stack']);if(_0x4be813[_0x204b('0x22')]){delete _0x4be813['name'];}_0x304fa7[_0x204b('0x15')](_0x5c722e)[_0x204b('0x23')](_0x4be813);};}exports[_0x204b('0x24')]=function(_0x41065d,_0x389813){var _0x20b997={},_0x5bd790={},_0x489c93={'count':0x0,'rows':[]};var _0x4e8744=_[_0x204b('0x25')](db[_0x204b('0x26')][_0x204b('0x27')],function(_0x72e992){return{'name':_0x72e992[_0x204b('0x28')],'type':_0x72e992['type'][_0x204b('0x29')]};});_0x5bd790[_0x204b('0x2a')]=_[_0x204b('0x25')](_0x4e8744,_0x204b('0x22'));_0x5bd790[_0x204b('0x2b')]=_[_0x204b('0x2c')](_0x41065d[_0x204b('0x2b')]);_0x5bd790['filters']=_['intersection'](_0x5bd790[_0x204b('0x2a')],_0x5bd790[_0x204b('0x2b')]);_0x20b997[_0x204b('0x2d')]=_[_0x204b('0x2e')](_0x5bd790[_0x204b('0x2a')],qs['fields'](_0x41065d['query'][_0x204b('0x2f')]));_0x20b997['attributes']=_0x20b997['attributes'][_0x204b('0x30')]?_0x20b997['attributes']:_0x5bd790[_0x204b('0x2a')];if(!_0x41065d[_0x204b('0x2b')]['hasOwnProperty'](_0x204b('0x31'))){_0x20b997[_0x204b('0x19')]=qs[_0x204b('0x19')](_0x41065d[_0x204b('0x2b')][_0x204b('0x19')]);_0x20b997[_0x204b('0x18')]=qs[_0x204b('0x18')](_0x41065d[_0x204b('0x2b')][_0x204b('0x18')]);}_0x20b997[_0x204b('0x32')]=qs[_0x204b('0x33')](_0x41065d['query'][_0x204b('0x33')]);_0x20b997[_0x204b('0x34')]=qs['filters'](_['pick'](_0x41065d['query'],_0x5bd790['filters']),_0x4e8744);if(_0x41065d[_0x204b('0x2b')][_0x204b('0x35')]){_0x20b997[_0x204b('0x34')]=_[_0x204b('0x36')](_0x20b997['where'],{'$or':_['map'](_0x4e8744,function(_0x247185){if(_0x247185[_0x204b('0x37')]!==_0x204b('0x38')){var _0x2802f8={};_0x2802f8[_0x247185[_0x204b('0x22')]]={'$like':'%'+_0x41065d[_0x204b('0x2b')][_0x204b('0x35')]+'%'};return _0x2802f8;}})});}_0x20b997=_[_0x204b('0x36')]({},_0x20b997,_0x41065d[_0x204b('0x39')]);var _0x43a0da={'where':_0x20b997[_0x204b('0x34')]};return db[_0x204b('0x26')][_0x204b('0x17')](_0x43a0da)['then'](function(_0x349584){_0x489c93[_0x204b('0x17')]=_0x349584;if(_0x41065d[_0x204b('0x2b')]['includeAll']){_0x20b997[_0x204b('0x3a')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x20b997);})[_0x204b('0x1e')](function(_0x2ad885){_0x489c93[_0x204b('0x3b')]=_0x2ad885;return _0x489c93;})[_0x204b('0x1e')](respondWithFilteredResult(_0x389813,_0x20b997))[_0x204b('0x3c')](handleError(_0x389813,null));};exports[_0x204b('0x3d')]=function(_0x4d4ec0,_0x188d11){var _0x220d27={'raw':!![],'where':{'id':_0x4d4ec0[_0x204b('0x3e')]['id']}},_0x1fe7fc={};_0x1fe7fc['model']=_['keys'](db[_0x204b('0x26')][_0x204b('0x27')]);_0x1fe7fc['query']=_[_0x204b('0x2c')](_0x4d4ec0[_0x204b('0x2b')]);_0x1fe7fc['filters']=_[_0x204b('0x2e')](_0x1fe7fc[_0x204b('0x2a')],_0x1fe7fc['query']);_0x220d27['attributes']=_[_0x204b('0x2e')](_0x1fe7fc['model'],qs[_0x204b('0x2f')](_0x4d4ec0[_0x204b('0x2b')]['fields']));_0x220d27[_0x204b('0x2d')]=_0x220d27[_0x204b('0x2d')][_0x204b('0x30')]?_0x220d27[_0x204b('0x2d')]:_0x1fe7fc[_0x204b('0x2a')];if(_0x4d4ec0[_0x204b('0x2b')][_0x204b('0x3f')]){_0x220d27[_0x204b('0x3a')]=[{'all':!![]}];}_0x220d27=_[_0x204b('0x36')]({},_0x220d27,_0x4d4ec0[_0x204b('0x39')]);return db[_0x204b('0x26')][_0x204b('0x40')](_0x220d27)['then'](handleEntityNotFound(_0x188d11,null))['then'](respondWithResult(_0x188d11,null))[_0x204b('0x3c')](handleError(_0x188d11,null));};exports[_0x204b('0x41')]=function(_0x481171,_0x33a5dc){return db['WhatsappApplication'][_0x204b('0x41')](_0x481171[_0x204b('0x42')],{})[_0x204b('0x1e')](respondWithResult(_0x33a5dc,0xc9))[_0x204b('0x3c')](handleError(_0x33a5dc,null));};exports[_0x204b('0x43')]=function(_0x3a9d41,_0xbddfd1){if(_0x3a9d41[_0x204b('0x42')]['id']){delete _0x3a9d41[_0x204b('0x42')]['id'];}return db[_0x204b('0x26')]['find']({'where':{'id':_0x3a9d41[_0x204b('0x3e')]['id']}})[_0x204b('0x1e')](handleEntityNotFound(_0xbddfd1,null))['then'](saveUpdates(_0x3a9d41[_0x204b('0x42')],null))[_0x204b('0x1e')](respondWithResult(_0xbddfd1,null))[_0x204b('0x3c')](handleError(_0xbddfd1,null));};exports['destroy']=function(_0x4e3d62,_0xeaf452){return db[_0x204b('0x26')][_0x204b('0x40')]({'where':{'id':_0x4e3d62['params']['id']}})[_0x204b('0x1e')](handleEntityNotFound(_0xeaf452,null))[_0x204b('0x1e')](removeEntity(_0xeaf452,null))[_0x204b('0x3c')](handleError(_0xeaf452,null));}; \ No newline at end of file +var _0x0ff9=['html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','error','stack','name','send','index','WhatsappApplication','rawAttributes','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','destroy','find'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x0ff9,0x9c));var _0x90ff=function(_0x492fa3,_0x28aed8){_0x492fa3=_0x492fa3-0x0;var _0x215607=_0x0ff9[_0x492fa3];return _0x215607;};'use strict';var pdf=require(_0x90ff('0x0'));var emlformat=require(_0x90ff('0x1'));var rimraf=require(_0x90ff('0x2'));var zipdir=require(_0x90ff('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90ff('0x4'));var moment=require('moment');var BPromise=require(_0x90ff('0x5'));var Mustache=require(_0x90ff('0x6'));var util=require(_0x90ff('0x7'));var path=require(_0x90ff('0x8'));var sox=require(_0x90ff('0x9'));var csv=require(_0x90ff('0xa'));var ejs=require(_0x90ff('0xb'));var fs=require('fs');var _=require(_0x90ff('0xc'));var squel=require(_0x90ff('0xd'));var crypto=require(_0x90ff('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x90ff('0xf'));var toCsv=require('to-csv');var querystring=require(_0x90ff('0x10'));var Papa=require('papaparse');var Redis=require(_0x90ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x90ff('0x12'));var as=require(_0x90ff('0x13'));var hardwareService=require(_0x90ff('0x14'));var logger=require(_0x90ff('0x15'))(_0x90ff('0x16'));var utils=require('../../config/utils');var config=require(_0x90ff('0x17'));var licenseUtil=require(_0x90ff('0x18'));var db=require(_0x90ff('0x19'))['db'];function respondWithStatusCode(_0x549c97,_0xe88008){_0xe88008=_0xe88008||0xcc;return function(_0x25ce00){if(_0x25ce00){return _0x549c97[_0x90ff('0x1a')](_0xe88008);}return _0x549c97['status'](_0xe88008)[_0x90ff('0x1b')]();};}function respondWithResult(_0x1cd1c1,_0x54d70e){_0x54d70e=_0x54d70e||0xc8;return function(_0x5ad1f3){if(_0x5ad1f3){return _0x1cd1c1[_0x90ff('0x1c')](_0x54d70e)[_0x90ff('0x1d')](_0x5ad1f3);}};}function respondWithFilteredResult(_0x243905,_0x2d629b){return function(_0x51d16a){if(_0x51d16a){var _0x43875a=_0x51d16a[_0x90ff('0x1e')],_0x914d93=_0x2d629b[_0x90ff('0x1f')],_0x23fece=_0x2d629b[_0x90ff('0x1f')]+_0x2d629b[_0x90ff('0x20')],_0x575875;if(_0x23fece>=_0x43875a){_0x23fece=_0x43875a;_0x575875=0xc8;}else{_0x575875=0xce;}_0x243905['status'](_0x575875);return _0x243905[_0x90ff('0x21')](_0x90ff('0x22'),_0x914d93+'-'+_0x23fece+'/'+_0x43875a)['json'](_0x51d16a);}return null;};}function patchUpdates(_0x26cdd4){return function(_0x13d99c){try{jsonpatch[_0x90ff('0x23')](_0x13d99c,_0x26cdd4,!![]);}catch(_0x10eefd){return BPromise['reject'](_0x10eefd);}return _0x13d99c[_0x90ff('0x24')]();};}function saveUpdates(_0x24a9ff,_0x5aa83c){return function(_0x511813){if(_0x511813){return _0x511813['update'](_0x24a9ff)[_0x90ff('0x25')](function(_0x711c89){return _0x711c89;});}return null;};}function removeEntity(_0x5d83b8,_0x51d42f){return function(_0x21c4b6){if(_0x21c4b6){return _0x21c4b6['destroy']()[_0x90ff('0x25')](function(){_0x5d83b8[_0x90ff('0x1c')](0xcc)[_0x90ff('0x1b')]();});}};}function handleEntityNotFound(_0x28076e,_0x2f6aae){return function(_0x35f302){if(!_0x35f302){_0x28076e[_0x90ff('0x1a')](0x194);}return _0x35f302;};}function handleError(_0x9ecfd3,_0x3e4a5c){_0x3e4a5c=_0x3e4a5c||0x1f4;return function(_0x4d6427){logger[_0x90ff('0x26')](_0x4d6427[_0x90ff('0x27')]);if(_0x4d6427[_0x90ff('0x28')]){delete _0x4d6427['name'];}_0x9ecfd3[_0x90ff('0x1c')](_0x3e4a5c)[_0x90ff('0x29')](_0x4d6427);};}exports[_0x90ff('0x2a')]=function(_0x192a2e,_0x252ecd){var _0xea0e0c={},_0x4e8162={},_0x44de97={'count':0x0,'rows':[]};var _0x394503=_['map'](db[_0x90ff('0x2b')][_0x90ff('0x2c')],function(_0x330072){return{'name':_0x330072['fieldName'],'type':_0x330072['type'][_0x90ff('0x2d')]};});_0x4e8162['model']=_[_0x90ff('0x2e')](_0x394503,_0x90ff('0x28'));_0x4e8162[_0x90ff('0x2f')]=_[_0x90ff('0x30')](_0x192a2e[_0x90ff('0x2f')]);_0x4e8162[_0x90ff('0x31')]=_[_0x90ff('0x32')](_0x4e8162['model'],_0x4e8162['query']);_0xea0e0c[_0x90ff('0x33')]=_[_0x90ff('0x32')](_0x4e8162[_0x90ff('0x34')],qs[_0x90ff('0x35')](_0x192a2e['query'][_0x90ff('0x35')]));_0xea0e0c['attributes']=_0xea0e0c[_0x90ff('0x33')][_0x90ff('0x36')]?_0xea0e0c[_0x90ff('0x33')]:_0x4e8162['model'];if(!_0x192a2e[_0x90ff('0x2f')][_0x90ff('0x37')](_0x90ff('0x38'))){_0xea0e0c[_0x90ff('0x20')]=qs[_0x90ff('0x20')](_0x192a2e[_0x90ff('0x2f')][_0x90ff('0x20')]);_0xea0e0c[_0x90ff('0x1f')]=qs[_0x90ff('0x1f')](_0x192a2e[_0x90ff('0x2f')][_0x90ff('0x1f')]);}_0xea0e0c[_0x90ff('0x39')]=qs['sort'](_0x192a2e['query'][_0x90ff('0x3a')]);_0xea0e0c['where']=qs[_0x90ff('0x31')](_[_0x90ff('0x3b')](_0x192a2e[_0x90ff('0x2f')],_0x4e8162[_0x90ff('0x31')]),_0x394503);if(_0x192a2e[_0x90ff('0x2f')][_0x90ff('0x3c')]){_0xea0e0c[_0x90ff('0x3d')]=_[_0x90ff('0x3e')](_0xea0e0c[_0x90ff('0x3d')],{'$or':_[_0x90ff('0x2e')](_0x394503,function(_0x582d97){if(_0x582d97[_0x90ff('0x3f')]!==_0x90ff('0x40')){var _0x4adf82={};_0x4adf82[_0x582d97['name']]={'$like':'%'+_0x192a2e[_0x90ff('0x2f')][_0x90ff('0x3c')]+'%'};return _0x4adf82;}})});}_0xea0e0c=_['merge']({},_0xea0e0c,_0x192a2e[_0x90ff('0x41')]);var _0x18628b={'where':_0xea0e0c[_0x90ff('0x3d')]};return db['WhatsappApplication'][_0x90ff('0x1e')](_0x18628b)['then'](function(_0x44d5b3){_0x44de97[_0x90ff('0x1e')]=_0x44d5b3;if(_0x192a2e[_0x90ff('0x2f')]['includeAll']){_0xea0e0c[_0x90ff('0x42')]=[{'all':!![]}];}return db[_0x90ff('0x2b')][_0x90ff('0x43')](_0xea0e0c);})[_0x90ff('0x25')](function(_0x225352){_0x44de97[_0x90ff('0x44')]=_0x225352;return _0x44de97;})['then'](respondWithFilteredResult(_0x252ecd,_0xea0e0c))[_0x90ff('0x45')](handleError(_0x252ecd,null));};exports[_0x90ff('0x46')]=function(_0x5aa645,_0x4e810b){var _0x5baeeb={'raw':!![],'where':{'id':_0x5aa645[_0x90ff('0x47')]['id']}},_0x45724f={};_0x45724f[_0x90ff('0x34')]=_['keys'](db[_0x90ff('0x2b')][_0x90ff('0x2c')]);_0x45724f[_0x90ff('0x2f')]=_[_0x90ff('0x30')](_0x5aa645['query']);_0x45724f['filters']=_[_0x90ff('0x32')](_0x45724f[_0x90ff('0x34')],_0x45724f[_0x90ff('0x2f')]);_0x5baeeb[_0x90ff('0x33')]=_['intersection'](_0x45724f[_0x90ff('0x34')],qs[_0x90ff('0x35')](_0x5aa645['query'][_0x90ff('0x35')]));_0x5baeeb['attributes']=_0x5baeeb[_0x90ff('0x33')][_0x90ff('0x36')]?_0x5baeeb[_0x90ff('0x33')]:_0x45724f['model'];if(_0x5aa645[_0x90ff('0x2f')][_0x90ff('0x48')]){_0x5baeeb[_0x90ff('0x42')]=[{'all':!![]}];}_0x5baeeb=_[_0x90ff('0x3e')]({},_0x5baeeb,_0x5aa645[_0x90ff('0x41')]);return db[_0x90ff('0x2b')]['find'](_0x5baeeb)[_0x90ff('0x25')](handleEntityNotFound(_0x4e810b,null))[_0x90ff('0x25')](respondWithResult(_0x4e810b,null))[_0x90ff('0x45')](handleError(_0x4e810b,null));};exports[_0x90ff('0x49')]=function(_0x1c41c9,_0x2c2be3){return db[_0x90ff('0x2b')][_0x90ff('0x49')](_0x1c41c9[_0x90ff('0x4a')],{})[_0x90ff('0x25')](respondWithResult(_0x2c2be3,0xc9))[_0x90ff('0x45')](handleError(_0x2c2be3,null));};exports[_0x90ff('0x4b')]=function(_0x18f0d4,_0x3ef44b){if(_0x18f0d4[_0x90ff('0x4a')]['id']){delete _0x18f0d4[_0x90ff('0x4a')]['id'];}return db[_0x90ff('0x2b')]['find']({'where':{'id':_0x18f0d4[_0x90ff('0x47')]['id']}})[_0x90ff('0x25')](handleEntityNotFound(_0x3ef44b,null))['then'](saveUpdates(_0x18f0d4[_0x90ff('0x4a')],null))[_0x90ff('0x25')](respondWithResult(_0x3ef44b,null))[_0x90ff('0x45')](handleError(_0x3ef44b,null));};exports[_0x90ff('0x4c')]=function(_0x265ea6,_0x31c8f9){return db['WhatsappApplication'][_0x90ff('0x4d')]({'where':{'id':_0x265ea6[_0x90ff('0x47')]['id']}})[_0x90ff('0x25')](handleEntityNotFound(_0x31c8f9,null))[_0x90ff('0x25')](removeEntity(_0x31c8f9,null))[_0x90ff('0x45')](handleError(_0x31c8f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a4f9429..ddff24e 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 _0x4c4a=['path','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x1658b2,_0x2d893d){var _0x21a9f7=function(_0x20afaf){while(--_0x20afaf){_0x1658b2['push'](_0x1658b2['shift']());}};_0x21a9f7(++_0x2d893d);}(_0x4c4a,0xf7));var _0xa4c4=function(_0x89cbc,_0x2c1df3){_0x89cbc=_0x89cbc-0x0;var _0x2131d2=_0x4c4a[_0x89cbc];return _0x2131d2;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa4c4('0x2'));var BPromise=require(_0xa4c4('0x3'));var rp=require(_0xa4c4('0x4'));var fs=require('fs');var path=require(_0xa4c4('0x5'));var rimraf=require('rimraf');var config=require(_0xa4c4('0x6'));var attributes=require(_0xa4c4('0x7'));module['exports']=function(_0x420ae5,_0x54ca4b){return _0x420ae5['define'](_0xa4c4('0x8'),attributes,{'tableName':_0xa4c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4c4('0xa'),'collate':_0xa4c4('0xb')});}; \ No newline at end of file +var _0x74d1=['define','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x41c513,_0x397aee){var _0x3897be=function(_0xf891f1){while(--_0xf891f1){_0x41c513['push'](_0x41c513['shift']());}};_0x3897be(++_0x397aee);}(_0x74d1,0x183));var _0x174d=function(_0x346ffc,_0x2e45a1){_0x346ffc=_0x346ffc-0x0;var _0x15189d=_0x74d1[_0x346ffc];return _0x15189d;};'use strict';var _=require(_0x174d('0x0'));var util=require(_0x174d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x174d('0x2'));var BPromise=require(_0x174d('0x3'));var rp=require(_0x174d('0x4'));var fs=require('fs');var path=require(_0x174d('0x5'));var rimraf=require(_0x174d('0x6'));var config=require(_0x174d('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x174d('0x8')]=function(_0x4762d8,_0x59318e){return _0x4762d8[_0x174d('0x9')]('WhatsappApplication',attributes,{'tableName':_0x174d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x174d('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9250c57..538ba2e 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 _0x44ff=['client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/logger','rpc'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x44ff,0x1c3));var _0xf44f=function(_0x4acb31,_0x4a3b03){_0x4acb31=_0x4acb31-0x0;var _0x5799fe=_0x44ff[_0x4acb31];return _0x5799fe;};'use strict';var _=require('lodash');var util=require(_0xf44f('0x0'));var moment=require(_0xf44f('0x1'));var BPromise=require(_0xf44f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf44f('0x3'))(_0xf44f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf44f('0x5')][_0xf44f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24baf4,_0x536b0e,_0x1aa3e5){return new BPromise(function(_0x2dae46,_0x1a1b8a){return client['request'](_0x24baf4,_0x1aa3e5)[_0xf44f('0x7')](function(_0x1f12d7){logger[_0xf44f('0x8')](_0xf44f('0x9'),_0x536b0e,_0xf44f('0xa'));logger[_0xf44f('0xb')](_0xf44f('0xc'),_0x536b0e,_0xf44f('0xa'),JSON[_0xf44f('0xd')](_0x1f12d7));if(_0x1f12d7[_0xf44f('0xe')]){if(_0x1f12d7['error'][_0xf44f('0xf')]===0x1f4){logger[_0xf44f('0xe')](_0xf44f('0x9'),_0x536b0e,_0x1f12d7[_0xf44f('0xe')][_0xf44f('0x10')]);return _0x1a1b8a(_0x1f12d7[_0xf44f('0xe')][_0xf44f('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x536b0e,_0x1f12d7[_0xf44f('0xe')]['message']);return _0x2dae46(_0x1f12d7['error']['message']);}else{logger[_0xf44f('0x8')](_0xf44f('0x9'),_0x536b0e,_0xf44f('0xa'));_0x2dae46(_0x1f12d7[_0xf44f('0x11')]['message']);}})[_0xf44f('0x12')](function(_0x56b1ca){logger[_0xf44f('0xe')](_0xf44f('0x9'),_0x536b0e,_0x56b1ca);_0x1a1b8a(_0x56b1ca);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xf494,0x1c6));var _0x4f49=function(_0x4b672c,_0x223499){_0x4b672c=_0x4b672c-0x0;var _0x182c65=_0xf494[_0x4b672c];return _0x182c65;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 81c074f..fe6e42a 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 _0xf027=['describe','/:id/messages','download','post','create','addMessage','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','whatsapp','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x24a0bb,_0x2da819){var _0x5df4a4=function(_0x12ed28){while(--_0x12ed28){_0x24a0bb['push'](_0x24a0bb['shift']());}};_0x5df4a4(++_0x2da819);}(_0xf027,0xb3));var _0x7f02=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf027[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x7f02('0x0'));var util=require(_0x7f02('0x1'));var path=require(_0x7f02('0x2'));var timeout=require(_0x7f02('0x3'));var express=require(_0x7f02('0x4'));var router=express[_0x7f02('0x5')]();var auth=require(_0x7f02('0x6'));var interaction=require(_0x7f02('0x7'));var config=require(_0x7f02('0x8'));var controller=require(_0x7f02('0x9'));router[_0x7f02('0xa')]('/',auth[_0x7f02('0xb')](),controller[_0x7f02('0xc')]);router[_0x7f02('0xa')]('/describe',auth[_0x7f02('0xb')](),controller[_0x7f02('0xd')]);router['get']('/:id',auth[_0x7f02('0xb')](),controller['show']);router[_0x7f02('0xa')](_0x7f02('0xe'),auth[_0x7f02('0xb')](),controller['getMessages']);router[_0x7f02('0xa')]('/:id/download',auth[_0x7f02('0xb')](),controller[_0x7f02('0xf')]);router[_0x7f02('0x10')]('/',auth['isAuthenticated'](),controller[_0x7f02('0x11')]);router['post'](_0x7f02('0xe'),auth[_0x7f02('0xb')](),controller[_0x7f02('0x12')]);router['post']('/:id/tags',auth[_0x7f02('0xb')](),interaction[_0x7f02('0x13')]('whatsapp',_0x7f02('0x14')),controller[_0x7f02('0x15')]);router[_0x7f02('0x16')](_0x7f02('0x17'),auth['isAuthenticated'](),interaction[_0x7f02('0x13')]('whatsapp',_0x7f02('0x18')),controller[_0x7f02('0x19')]);router['delete'](_0x7f02('0x17'),auth['isAuthenticated'](),interaction[_0x7f02('0x13')](_0x7f02('0x1a'),_0x7f02('0x1b')),controller[_0x7f02('0x1c')]);router[_0x7f02('0x1d')]('/:id/tags',auth[_0x7f02('0xb')](),controller[_0x7f02('0x1e')]);module[_0x7f02('0x1f')]=router; \ No newline at end of file +var _0x82c8=['update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update'];(function(_0x306b26,_0x12f9a1){var _0x43c861=function(_0x853dc9){while(--_0x853dc9){_0x306b26['push'](_0x306b26['shift']());}};_0x43c861(++_0x12f9a1);}(_0x82c8,0xd8));var _0x882c=function(_0x2584c2,_0x21221b){_0x2584c2=_0x2584c2-0x0;var _0x22e12d=_0x82c8[_0x2584c2];return _0x22e12d;};'use strict';var multer=require(_0x882c('0x0'));var util=require(_0x882c('0x1'));var path=require(_0x882c('0x2'));var timeout=require(_0x882c('0x3'));var express=require(_0x882c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x882c('0x5'));var config=require(_0x882c('0x6'));var controller=require(_0x882c('0x7'));router[_0x882c('0x8')]('/',auth[_0x882c('0x9')](),controller[_0x882c('0xa')]);router['get'](_0x882c('0xb'),auth[_0x882c('0x9')](),controller[_0x882c('0xc')]);router['get']('/:id',auth[_0x882c('0x9')](),controller[_0x882c('0xd')]);router[_0x882c('0x8')](_0x882c('0xe'),auth['isAuthenticated'](),controller[_0x882c('0xf')]);router['get'](_0x882c('0x10'),auth[_0x882c('0x9')](),controller[_0x882c('0x11')]);router[_0x882c('0x12')]('/',auth[_0x882c('0x9')](),controller[_0x882c('0x13')]);router[_0x882c('0x12')]('/:id/messages',auth[_0x882c('0x9')](),controller[_0x882c('0x14')]);router[_0x882c('0x12')](_0x882c('0x15'),auth[_0x882c('0x9')](),interaction[_0x882c('0x16')](_0x882c('0x17'),_0x882c('0x18')),controller[_0x882c('0x19')]);router[_0x882c('0x1a')](_0x882c('0x1b'),auth[_0x882c('0x9')](),interaction['tracked'](_0x882c('0x17'),_0x882c('0x1c')),controller[_0x882c('0x1d')]);router['delete'](_0x882c('0x1b'),auth[_0x882c('0x9')](),interaction[_0x882c('0x16')]('whatsapp',_0x882c('0x1e')),controller[_0x882c('0x1f')]);router[_0x882c('0x20')](_0x882c('0x15'),auth[_0x882c('0x9')](),controller[_0x882c('0x21')]);module[_0x882c('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index dada330..965d417 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 _0xfa12=['STRING','ENUM','sequelize','moment','BOOLEAN','DATE'];(function(_0x1984e4,_0x34d5a7){var _0x6069f1=function(_0x2a924f){while(--_0x2a924f){_0x1984e4['push'](_0x1984e4['shift']());}};_0x6069f1(++_0x34d5a7);}(_0xfa12,0x1b2));var _0x2fa1=function(_0xd41c6a,_0x5b54b5){_0xd41c6a=_0xd41c6a-0x0;var _0xafdc93=_0xfa12[_0xd41c6a];return _0xafdc93;};'use strict';var Sequelize=require(_0x2fa1('0x0'));var moment=require(_0x2fa1('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2fa1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2fa1('0x3')]},'disposition':{'type':Sequelize[_0x2fa1('0x4')]},'secondDisposition':{'type':Sequelize[_0x2fa1('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2fa1('0x4')]},'phone':{'type':Sequelize[_0x2fa1('0x4')]},'read1stAt':{'type':Sequelize[_0x2fa1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2fa1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2fa1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2fa1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc6a8=['DATE','ENUM','out','sequelize','moment','BOOLEAN','STRING'];(function(_0x9ba57c,_0x5ecc0d){var _0x627a6e=function(_0x3c702d){while(--_0x3c702d){_0x9ba57c['push'](_0x9ba57c['shift']());}};_0x627a6e(++_0x5ecc0d);}(_0xc6a8,0x106));var _0x8c6a=function(_0x180460,_0x5f03f9){_0x180460=_0x180460-0x0;var _0x490974=_0xc6a8[_0x180460];return _0x490974;};'use strict';var Sequelize=require(_0x8c6a('0x0'));var moment=require(_0x8c6a('0x1'));module['exports']={'closed':{'type':Sequelize[_0x8c6a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8c6a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8c6a('0x3')]},'note':{'type':Sequelize[_0x8c6a('0x3')]},'phone':{'type':Sequelize[_0x8c6a('0x3')]},'read1stAt':{'type':Sequelize[_0x8c6a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8c6a('0x5')]('in',_0x8c6a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8c6a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8c6a('0x5')]('in',_0x8c6a('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 cbeb37e..ce1881b 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 _0x5e92=['parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','WhatsappAccountId','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','sequelize','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','toString','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','rawAttributes','includeAll','include','options','catch','create','update','params','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','color','whatsappInteractionTags:save','removeTags','download','unix','join','server','tmp','root','attachments','User','Attachment','Messages','direction','WhatsappAccount','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','Account','N.A.','closed','closedAt','existsSync','createWriteStream','out','System','firstName','lastName','renderFile','views','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','zip-dir','moment','bluebird','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','map','WhatsappInteraction','fieldName','key','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','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','find','ContactId','buildExpression','type','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','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt'];(function(_0x4458d2,_0x1d0265){var _0x200417=function(_0x357f77){while(--_0x357f77){_0x4458d2['push'](_0x4458d2['shift']());}};_0x200417(++_0x1d0265);}(_0x5e92,0x15f));var _0x25e9=function(_0x13e7d6,_0x32b1cc){_0x13e7d6=_0x13e7d6-0x0;var _0x2f914b=_0x5e92[_0x13e7d6];return _0x2f914b;};'use strict';var pdf=require(_0x25e9('0x0'));var emlformat=require(_0x25e9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x25e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25e9('0x3'));var BPromise=require(_0x25e9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x25e9('0x5'));var sox=require(_0x25e9('0x6'));var csv=require(_0x25e9('0x7'));var ejs=require(_0x25e9('0x8'));var fs=require('fs');var _=require(_0x25e9('0x9'));var squel=require('squel');var crypto=require(_0x25e9('0xa'));var jsforce=require(_0x25e9('0xb'));var deskjs=require(_0x25e9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x25e9('0xd'));var Papa=require(_0x25e9('0xe'));var Redis=require(_0x25e9('0xf'));var authService=require(_0x25e9('0x10'));var qs=require(_0x25e9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25e9('0x12'));var logger=require(_0x25e9('0x13'))(_0x25e9('0x14'));var utils=require(_0x25e9('0x15'));var config=require(_0x25e9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x25e9('0x17'))['db'];config[_0x25e9('0x18')]=_[_0x25e9('0x19')](config[_0x25e9('0x18')],{'host':_0x25e9('0x1a'),'port':0x18eb});var socket=require(_0x25e9('0x1b'))(new Redis(config[_0x25e9('0x18')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4fd940,_0x182314){_0x182314=_0x182314||0xcc;return function(_0x413744){if(_0x413744){return _0x4fd940[_0x25e9('0x1c')](_0x182314);}return _0x4fd940[_0x25e9('0x1d')](_0x182314)[_0x25e9('0x1e')]();};}function respondWithResult(_0x34a5a8,_0x5452e8){_0x5452e8=_0x5452e8||0xc8;return function(_0x3fd13e){if(_0x3fd13e){return _0x34a5a8['status'](_0x5452e8)[_0x25e9('0x1f')](_0x3fd13e);}};}function respondWithFilteredResult(_0x57f22c,_0x2e7cde){return function(_0x2bb881){if(_0x2bb881){var _0x26a92f=_0x2bb881[_0x25e9('0x20')],_0x44dca9=_0x2e7cde[_0x25e9('0x21')],_0x28da0e=_0x2e7cde[_0x25e9('0x21')]+_0x2e7cde['limit'],_0x680800;if(_0x28da0e>=_0x26a92f){_0x28da0e=_0x26a92f;_0x680800=0xc8;}else{_0x680800=0xce;}_0x57f22c[_0x25e9('0x1d')](_0x680800);return _0x57f22c[_0x25e9('0x22')](_0x25e9('0x23'),_0x44dca9+'-'+_0x28da0e+'/'+_0x26a92f)[_0x25e9('0x1f')](_0x2bb881);}return null;};}function patchUpdates(_0x2501bf){return function(_0xe1c588){try{jsonpatch['apply'](_0xe1c588,_0x2501bf,!![]);}catch(_0x5d7dc9){return BPromise[_0x25e9('0x24')](_0x5d7dc9);}return _0xe1c588[_0x25e9('0x25')]();};}function saveUpdates(_0x265a56,_0x572fbf){return function(_0x35e7f2){if(_0x35e7f2){return _0x35e7f2['update'](_0x265a56)[_0x25e9('0x26')](function(_0x5552f0){return _0x5552f0;});}return null;};}function removeEntity(_0x2b4c94,_0x18c490){return function(_0x4e6b38){if(_0x4e6b38){return _0x4e6b38[_0x25e9('0x27')]()[_0x25e9('0x26')](function(){_0x2b4c94[_0x25e9('0x1d')](0xcc)[_0x25e9('0x1e')]();});}};}function handleEntityNotFound(_0x15e0fc,_0x1887b5){return function(_0x30c895){if(!_0x30c895){_0x15e0fc['sendStatus'](0x194);}return _0x30c895;};}function handleError(_0x369817,_0x9b6d00){_0x9b6d00=_0x9b6d00||0x1f4;return function(_0x274442){logger[_0x25e9('0x28')](_0x274442[_0x25e9('0x29')]);if(_0x274442[_0x25e9('0x2a')]){delete _0x274442[_0x25e9('0x2a')];}_0x369817['status'](_0x9b6d00)[_0x25e9('0x2b')](_0x274442);};}function getInteractionUsers(_0x468c76,_0x43971e){return new BPromise(function(_0x40742b,_0x179fc5){try{if(_0x43971e[_0x468c76['id']]){_0x468c76[_0x25e9('0x2c')]=_['map'](_0x43971e[_0x468c76['id']],function(_0x665c67){return{'id':_0x665c67['id'],'fullname':_0x665c67[_0x25e9('0x2d')]};});}}catch(_0xbd9bf6){_0x179fc5(_0xbd9bf6);}_0x40742b(_0x468c76);});}function getInteractionTags(_0x2d4718,_0x2ba41c){return new BPromise(function(_0x392839,_0x2c3e1d){try{if(_0x2d4718[_0x25e9('0x2e')]){_0x2d4718[_0x25e9('0x2f')]=[];_0x2d4718[_0x25e9('0x2e')][_0x25e9('0x30')](',')[_0x25e9('0x31')](function(_0x55e26e){_0x2d4718[_0x25e9('0x2f')][_0x25e9('0x32')](_0x2ba41c[_0x55e26e]);});}delete _0x2d4718[_0x25e9('0x2e')];}catch(_0x4b22c3){_0x2c3e1d(_0x4b22c3);}_0x392839(_0x2d4718);});}function updateWhatsappInteraction(_0x166ae8,_0x3ba56d,_0x119994){return new BPromise(function(_0xe38192,_0x298514){return getInteractionUsers(_0x166ae8,_0x119994)[_0x25e9('0x26')](function(_0x13d08){return getInteractionTags(_0x13d08,_0x3ba56d);})[_0x25e9('0x26')](function(_0x268883){_0xe38192(_0x268883);})['catch'](function(_0x7e628d){_0x298514(_0x7e628d);});});}exports['index']=function(_0x2be194,_0x4d0ede){var _0x9f4cd6={},_0x231236={},_0x1445be={'count':0x0,'rows':[]};var _0x2cfedb=_[_0x25e9('0x33')](db[_0x25e9('0x34')]['rawAttributes'],function(_0x103977){return{'name':_0x103977[_0x25e9('0x35')],'type':_0x103977['type'][_0x25e9('0x36')]};});_0x231236['model']=_[_0x25e9('0x33')](_0x2cfedb,'name');_0x231236['query']=_[_0x25e9('0x37')](_0x2be194[_0x25e9('0x38')]);_0x231236['filters']=_[_0x25e9('0x39')](_0x231236['model'],_0x231236[_0x25e9('0x38')]);_0x9f4cd6['attributes']=_[_0x25e9('0x39')](_0x231236[_0x25e9('0x3a')],qs['fields'](_0x2be194[_0x25e9('0x38')][_0x25e9('0x3b')]));_0x9f4cd6[_0x25e9('0x3c')]=_0x9f4cd6[_0x25e9('0x3c')]['length']?_0x9f4cd6[_0x25e9('0x3c')]:_0x231236['model'];if(!_0x2be194[_0x25e9('0x38')][_0x25e9('0x3d')](_0x25e9('0x3e'))){_0x9f4cd6['limit']=qs[_0x25e9('0x3f')](_0x2be194[_0x25e9('0x38')][_0x25e9('0x3f')]);_0x9f4cd6[_0x25e9('0x21')]=qs[_0x25e9('0x21')](_0x2be194[_0x25e9('0x38')][_0x25e9('0x21')]);}_0x9f4cd6['order']=qs[_0x25e9('0x40')](_0x2be194[_0x25e9('0x38')][_0x25e9('0x40')]);_0x9f4cd6[_0x25e9('0x41')]=qs[_0x25e9('0x42')](_[_0x25e9('0x43')](_0x2be194[_0x25e9('0x38')],_0x231236['filters']),_0x2cfedb);var _0x3b4472=[];var _0x40e017=squel[_0x25e9('0x44')]()[_0x25e9('0x45')]('id')[_0x25e9('0x45')](_0x25e9('0x2a'))[_0x25e9('0x45')]('color')[_0x25e9('0x46')](_0x25e9('0x47'));var _0x576885=squel[_0x25e9('0x44')]()[_0x25e9('0x45')](_0x25e9('0x48'))['field'](_0x25e9('0x49'))[_0x25e9('0x45')](_0x25e9('0x4a'))[_0x25e9('0x46')]('user_has_whatsapp_interactions','ui')['left_join'](_0x25e9('0x4b'),'u',_0x25e9('0x4c'));var _0xbab61d=squel[_0x25e9('0x44')]()['from'](_0x25e9('0x4d'),'i')[_0x25e9('0x4e')](_0x25e9('0x4f'),'c',_0x25e9('0x50'))[_0x25e9('0x4e')](_0x25e9('0x4b'),'o',_0x25e9('0x51'))[_0x25e9('0x4e')]('whatsapp_accounts','a',_0x25e9('0x52'))['left_join'](_0x25e9('0x53'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x25e9('0x4e')](_0x25e9('0x54'),'it',_0x25e9('0x55'))[_0x25e9('0x4e')](_0x25e9('0x47'),'t',_0x25e9('0x56'));var _0x1e1b6c=squel[_0x25e9('0x57')]();var _0x3c98d9=[];var _0x238560=squel[_0x25e9('0x57')]();var _0x54629d;if(_0x2be194[_0x25e9('0x38')][_0x25e9('0x58')]){_0x54629d=as[_0x25e9('0x59')](_0x2be194[_0x25e9('0x38')][_0x25e9('0x58')]);var _0x565b51=_0x54629d['sqlOperator'];for(var _0x130e1a=0x0;_0x130e1a<_0x54629d[_0x25e9('0x5a')][_0x25e9('0x5b')];_0x130e1a++){var _0x37f630=_0x54629d[_0x25e9('0x5a')][_0x130e1a];var _0x568a81='i';var _0xff3e35=_['find'](_0x2cfedb,[_0x25e9('0x2a'),_0x37f630[_0x25e9('0x45')]]);if(!_0xff3e35){switch(_0x37f630[_0x25e9('0x45')]){case'unreadMessages':if(_0x37f630[_0x25e9('0x5c')]==0x1){_0xbab61d[_0x25e9('0x5d')]('`'+_0x37f630[_0x25e9('0x45')]+_0x25e9('0x5e'));}else{_0xbab61d[_0x25e9('0x5d')]('`'+_0x37f630[_0x25e9('0x45')]+_0x25e9('0x5f'));}break;case _0x25e9('0x60'):if(_0x37f630[_0x25e9('0x61')]===_0x25e9('0x62')){if(_0x37f630[_0x25e9('0x5c')][_0x25e9('0x30')]('\x20')['length']>0x1){_0x1e1b6c[_0x565b51](_0x25e9('0x63'),qs[_0x25e9('0x64')](_0x37f630['value']),null);}else{var _0x12f24e='%'+_0x37f630[_0x25e9('0x5c')]+'%';_0x1e1b6c[_0x565b51]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x12f24e,_0x12f24e,_0x12f24e);}}else{_0xff3e35=_[_0x25e9('0x65')](_0x2cfedb,[_0x25e9('0x2a'),_0x25e9('0x66')]);_0x37f630[_0x25e9('0x45')]='ContactId';_0x1a7678=as[_0x25e9('0x67')](_0x568a81,_0xff3e35[_0x25e9('0x68')],_0x37f630);_0x1e1b6c[_0x565b51](_0x1a7678[_0x25e9('0x69')],_0x1a7678['value'][_0x25e9('0x6a')],_0x1a7678[_0x25e9('0x5c')][_0x25e9('0x1e')]);}break;case _0x25e9('0x6b'):var _0x566097=_0x37f630[_0x25e9('0x5c')][_0x25e9('0x30')](',')[_0x25e9('0x33')](function(_0x3aa4a9){return Number(_0x3aa4a9);});_0x566097[_0x25e9('0x31')](function(_0x256008){_0x238560['or'](_0x25e9('0x6c'),'%,'+_0x256008+',%');});_0x3c98d9=_[_0x25e9('0x6d')](_0x3c98d9,_0x566097);break;case'User':if(_0x37f630['operator']===_0x25e9('0x62')){_0x1e1b6c[_0x565b51](_0x25e9('0x6e'),'%'+_0x37f630[_0x25e9('0x5c')]+'%',null);}else{_0xff3e35=_[_0x25e9('0x65')](_0x2cfedb,[_0x25e9('0x2a'),_0x25e9('0x6f')]);_0x37f630[_0x25e9('0x45')]=_0x25e9('0x6f');_0x1a7678=as[_0x25e9('0x67')](_0x568a81,_0xff3e35[_0x25e9('0x68')],_0x37f630);_0x1e1b6c[_0x565b51](_0x1a7678[_0x25e9('0x69')],_0x1a7678['value']['start'],_0x1a7678[_0x25e9('0x5c')]['end']);}break;case _0x25e9('0x70'):_0x1a7678=as[_0x25e9('0x67')]('me',null,_0x37f630);_0x1e1b6c[_0x565b51](_0x1a7678['text'],_0x1a7678[_0x25e9('0x5c')][_0x25e9('0x6a')],_0x1a7678[_0x25e9('0x5c')][_0x25e9('0x1e')]);break;}}else{var _0x1a7678=as[_0x25e9('0x67')](_0x568a81,_0xff3e35[_0x25e9('0x68')],_0x37f630);_0x1e1b6c[_0x565b51](_0x1a7678[_0x25e9('0x69')],_0x1a7678[_0x25e9('0x5c')]['start'],_0x1a7678['value'][_0x25e9('0x1e')]);}}}else{var _0xb04474=_(_0x2be194[_0x25e9('0x38')])[_0x25e9('0x37')]()[_0x25e9('0x33')](function(_0x1ecbf3){return _[_0x25e9('0x71')](_0x2cfedb,[_0x25e9('0x2a'),_0x1ecbf3])?_0x1ecbf3:undefined;})[_0x25e9('0x72')]()[_0x25e9('0x5c')]();if(!_[_0x25e9('0x73')](_0xb04474)){_0xb04474[_0x25e9('0x31')](function(_0x146c0c){if(_0x146c0c==='WhatsappAccountId'){_0xbab61d[_0x25e9('0x41')](_0x25e9('0x74'),[][_0x25e9('0x75')](_0x2be194[_0x25e9('0x38')][_0x146c0c]));}else if(_0x146c0c===_0x25e9('0x76')){var _0xacae75=JSON[_0x25e9('0x77')](_0x2be194[_0x25e9('0x38')][_0x146c0c])['$gte'];var _0xe9973f=JSON[_0x25e9('0x77')](_0x2be194[_0x25e9('0x38')][_0x146c0c])[_0x25e9('0x78')];_0xbab61d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xacae75,_0xe9973f);}else{if(_0x2be194[_0x25e9('0x38')][_0x146c0c]===_0x25e9('0x79')){_0xbab61d['where']('i.'+_0x146c0c+_0x25e9('0x7a'));}else{_0xbab61d[_0x25e9('0x41')]('i.'+_0x146c0c+_0x25e9('0x7b'),_0x2be194[_0x25e9('0x38')][_0x146c0c]);}}});}if(_0x2be194['query'][_0x25e9('0x7c')]){if(_0x2be194[_0x25e9('0x38')][_0x25e9('0x7c')]==0x1){_0xbab61d[_0x25e9('0x5d')]('`unreadMessages`\x20=\x200');}else{_0xbab61d[_0x25e9('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x2be194[_0x25e9('0x38')]['tag']){_0x3c98d9=_[_0x25e9('0x7d')](_0x2be194[_0x25e9('0x38')][_0x25e9('0x7e')])?_0x2be194['query']['tag']:new Array(_0x2be194[_0x25e9('0x38')]['tag']);_0x3c98d9['forEach'](function(_0x525694){_0x238560['or'](_0x25e9('0x6c'),'%,'+_0x525694+',%');});}if(_0x2be194['query']['filter']){var _0x338e8a=_0x2be194[_0x25e9('0x38')][_0x25e9('0x7f')][_0x25e9('0x80')]('\x5c','\x5c\x5c')[_0x25e9('0x80')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x338e8a)){_0x1e1b6c['or'](_0x25e9('0x81'),_0x338e8a+'%')['or'](_0x25e9('0x82'),_0x338e8a+'%');}else{_0x1e1b6c['or'](_0x25e9('0x83'),qs[_0x25e9('0x64')](_0x338e8a))['or'](_0x25e9('0x84'),_0x338e8a+'%');}}}_0xbab61d[_0x25e9('0x41')](_0x1e1b6c);_0xbab61d['group'](_0x25e9('0x85'));var _0x35ef87={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x24cc37=_0xbab61d[_0x25e9('0x86')]();_0x24cc37[_0x25e9('0x45')]('i.id');_0x24cc37[_0x25e9('0x45')](_0x25e9('0x87'),'unreadMessages');if(_0x9f4cd6[_0x25e9('0x88')]){_0x9f4cd6[_0x25e9('0x88')][_0x25e9('0x31')](function(_0x4c0663){var _0x2899c1=_0x4c0663[0x0]===_0x25e9('0x89')?_0x4c0663[0x0]:'i.'+_0x4c0663[0x0];_0xbab61d[_0x25e9('0x88')](_0x2899c1,_0x4c0663[0x1]==='DESC'?![]:!![]);});}if(!_[_0x25e9('0x73')](_0x3c98d9)){_0xbab61d['having'](_0x238560);_0x24cc37[_0x25e9('0x41')](_0x25e9('0x8a'),_0x3c98d9);}BPromise['resolve']()[_0x25e9('0x26')](function(){if(!_0x54629d){if(_0x2be194[_0x25e9('0x38')][_0x25e9('0x8b')]||_0x2be194[_0x25e9('0x38')][_0x25e9('0x8c')])return;_0x24cc37[_0x25e9('0x41')](_0x25e9('0x8d'));_0xbab61d['where'](_0x25e9('0x8d'));return;}if(_0x2be194[_0x25e9('0x8e')][_0x25e9('0x8f')]!==_0x25e9('0x90'))return;return _0x2be194[_0x25e9('0x8e')][_0x25e9('0x91')]({'attributes':['id'],'raw':!![]})[_0x25e9('0x26')](function(_0x1391c8){if(_[_0x25e9('0x73')](_0x1391c8)){_0x24cc37[_0x25e9('0x41')]('i.WhatsappAccountId\x20IS\x20NULL');_0xbab61d[_0x25e9('0x41')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x24cc37['where'](_0x25e9('0x74'),_[_0x25e9('0x33')](_0x1391c8,'id'));_0xbab61d[_0x25e9('0x41')](_0x25e9('0x74'),_['map'](_0x1391c8,'id'));}});})['then'](function(){if(_0x2be194[_0x25e9('0x8e')][_0x25e9('0x8f')]===_0x25e9('0x90')&&!_0x54629d&&!_0x2be194[_0x25e9('0x38')][_0x25e9('0x8b')])return[];return db[_0x25e9('0x92')]['query'](_0x24cc37['toString'](),_0x35ef87);})[_0x25e9('0x26')](function(_0x5f230d){_0x1445be[_0x25e9('0x20')]=_0x5f230d[_0x25e9('0x5b')];if(_0x1445be[_0x25e9('0x20')]===0x0)return[];return db[_0x25e9('0x92')][_0x25e9('0x38')](_0x40e017['toString'](),_0x35ef87)['then'](function(_0x4fdb27){_0x3b4472=_[_0x25e9('0x93')](_0x4fdb27,'id');_0x35ef87=_[_0x25e9('0x94')](_0x35ef87,{'model':db[_0x25e9('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2be194[_0x25e9('0x38')][_0x25e9('0x3b')]){_0x9f4cd6[_0x25e9('0x3c')]['forEach'](function(_0x237f60){_0xbab61d[_0x25e9('0x45')]('i.'+_0x237f60);});}else{_0xbab61d['field'](_0x25e9('0x87'),_0x25e9('0x95'));_0xbab61d[_0x25e9('0x45')]('a.key',_0x25e9('0x96'));_0xbab61d['field'](_0x25e9('0x97'),'Account.mandatoryDisposition');_0xbab61d['field'](_0x25e9('0x98'),_0x25e9('0x89'));_0xbab61d[_0x25e9('0x45')](_0x25e9('0x99'));_0xbab61d[_0x25e9('0x45')](_0x25e9('0x9a'),_0x25e9('0x9b'));_0xbab61d[_0x25e9('0x45')](_0x25e9('0x9c'),_0x25e9('0x9d'));_0xbab61d[_0x25e9('0x45')](_0x25e9('0x9e'),_0x25e9('0x9f'));_0xbab61d['field'](_0x25e9('0xa0'),'Contact.phone');_0xbab61d[_0x25e9('0x45')](_0x25e9('0xa1'),_0x25e9('0xa2'));_0xbab61d[_0x25e9('0x45')](_0x25e9('0xa3'),'Contact.fax');_0xbab61d[_0x25e9('0x45')](_0x25e9('0xa4'),_0x25e9('0xa5'));_0xbab61d[_0x25e9('0x45')](_0x25e9('0xa6'),_0x25e9('0xa7'));_0xbab61d[_0x25e9('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x25e9('0x2e'));}if(_0x9f4cd6['limit'])_0xbab61d['limit'](_0x9f4cd6[_0x25e9('0x3f')]);if(_0x9f4cd6[_0x25e9('0x21')])_0xbab61d[_0x25e9('0x21')](_0x9f4cd6[_0x25e9('0x21')]);return db['sequelize'][_0x25e9('0x38')](_0xbab61d[_0x25e9('0xa8')](),_0x35ef87);})[_0x25e9('0x26')](function(_0x15f19f){_0x576885[_0x25e9('0x41')](_0x25e9('0xa9'),_[_0x25e9('0x33')](_0x15f19f,'id'));return db[_0x25e9('0x92')][_0x25e9('0x38')](_0x576885[_0x25e9('0xa8')](),_0x35ef87)[_0x25e9('0x26')](function(_0x32bc46){var _0x46cd23=_[_0x25e9('0xaa')](_0x32bc46,_0x25e9('0xab'));var _0x3ff839=[];_0x15f19f[_0x25e9('0x31')](function(_0x48644b){_0x3ff839[_0x25e9('0x32')](updateWhatsappInteraction(_0x48644b,_0x3b4472,_0x46cd23));});return BPromise['all'](_0x3ff839);});});})[_0x25e9('0x26')](function(_0x2cc367){_0x1445be[_0x25e9('0xac')]=_0x2cc367;return _0x1445be;})[_0x25e9('0x26')](respondWithFilteredResult(_0x4d0ede,_0x9f4cd6))['catch'](handleError(_0x4d0ede,null));};exports['show']=function(_0x13b9d1,_0x42e4b7){var _0x5c6167={'raw':![],'where':{'id':_0x13b9d1['params']['id']}},_0x578398={};_0x578398[_0x25e9('0x3a')]=_[_0x25e9('0x37')](db[_0x25e9('0x34')][_0x25e9('0xad')]);_0x578398[_0x25e9('0x38')]=_[_0x25e9('0x37')](_0x13b9d1[_0x25e9('0x38')]);_0x578398[_0x25e9('0x42')]=_[_0x25e9('0x39')](_0x578398[_0x25e9('0x3a')],_0x578398[_0x25e9('0x38')]);_0x5c6167[_0x25e9('0x3c')]=_[_0x25e9('0x39')](_0x578398['model'],qs[_0x25e9('0x3b')](_0x13b9d1[_0x25e9('0x38')]['fields']));_0x5c6167[_0x25e9('0x3c')]=_0x5c6167[_0x25e9('0x3c')][_0x25e9('0x5b')]?_0x5c6167['attributes']:_0x578398[_0x25e9('0x3a')];if(_0x13b9d1[_0x25e9('0x38')][_0x25e9('0xae')]){_0x5c6167[_0x25e9('0xaf')]=[{'all':!![]}];}_0x5c6167=_['merge']({},_0x5c6167,_0x13b9d1[_0x25e9('0xb0')]);return db['WhatsappInteraction'][_0x25e9('0x65')](_0x5c6167)['then'](handleEntityNotFound(_0x42e4b7,null))['then'](respondWithResult(_0x42e4b7,null))[_0x25e9('0xb1')](handleError(_0x42e4b7,null));};exports['create']=function(_0x26cab8,_0x4282bd){return db['WhatsappInteraction'][_0x25e9('0xb2')](_0x26cab8[_0x25e9('0x70')],{})[_0x25e9('0x26')](respondWithResult(_0x4282bd,0xc9))[_0x25e9('0xb1')](handleError(_0x4282bd,null));};exports[_0x25e9('0xb3')]=function(_0x1d50b7,_0x40f465){if(_0x1d50b7['body']['id']){delete _0x1d50b7[_0x25e9('0x70')]['id'];}return db[_0x25e9('0x34')][_0x25e9('0x65')]({'where':{'id':_0x1d50b7[_0x25e9('0xb4')]['id']}})[_0x25e9('0x26')](handleEntityNotFound(_0x40f465,null))[_0x25e9('0x26')](saveUpdates(_0x1d50b7[_0x25e9('0x70')],null))[_0x25e9('0x26')](respondWithResult(_0x40f465,null))[_0x25e9('0xb1')](handleError(_0x40f465,null));};exports[_0x25e9('0x27')]=function(_0x30ccb4,_0x3d85b8){return db[_0x25e9('0x34')][_0x25e9('0x65')]({'where':{'id':_0x30ccb4[_0x25e9('0xb4')]['id']}})[_0x25e9('0x26')](handleEntityNotFound(_0x3d85b8,null))[_0x25e9('0x26')](removeEntity(_0x3d85b8,null))[_0x25e9('0xb1')](handleError(_0x3d85b8,null));};exports[_0x25e9('0xb5')]=function(_0x4a6f1d,_0x3a5d2c){return db['WhatsappInteraction'][_0x25e9('0xb5')]()[_0x25e9('0x26')](respondWithResult(_0x3a5d2c,null))[_0x25e9('0xb1')](handleError(_0x3a5d2c,null));};exports[_0x25e9('0xb6')]=function(_0x182c21,_0x11ed7c,_0x4024d0){return db[_0x25e9('0xb7')][_0x25e9('0x65')]({'where':{'id':_0x182c21[_0x25e9('0xb4')]['id']}})[_0x25e9('0x26')](handleEntityNotFound(_0x11ed7c,null))[_0x25e9('0x26')](function(_0x26ebb3){if(_0x26ebb3){return _0x26ebb3[_0x25e9('0xb6')](_0x182c21[_0x25e9('0x70')]['ids'],_[_0x25e9('0xb8')](_0x182c21['body'],[_0x25e9('0xb9'),'id'])||{});}})[_0x25e9('0x26')](respondWithResult(_0x11ed7c,null))['catch'](handleError(_0x11ed7c,null));};exports[_0x25e9('0xba')]=function(_0x41ebc9,_0x5e8e36,_0x1d76e9){var _0x5ab051={'raw':![],'where':{}};var _0xe668d9={};var _0x2c68cd={'count':0x0,'rows':[]};return db[_0x25e9('0x34')][_0x25e9('0xbb')]({'where':{'id':_0x41ebc9['params']['id']}})[_0x25e9('0x26')](handleEntityNotFound(_0x5e8e36,null))[_0x25e9('0x26')](function(_0x50d854){if(_0x50d854){_0xe668d9['model']=_[_0x25e9('0x37')](db[_0x25e9('0xb7')][_0x25e9('0xad')]);_0xe668d9[_0x25e9('0x38')]=_['keys'](_0x41ebc9['query']);_0xe668d9[_0x25e9('0x42')]=_[_0x25e9('0x39')](_0xe668d9[_0x25e9('0x3a')],_0xe668d9[_0x25e9('0x38')]);_0x5ab051[_0x25e9('0x3c')]=_['intersection'](_0xe668d9['model'],qs[_0x25e9('0x3b')](_0x41ebc9[_0x25e9('0x38')]['fields']));_0x5ab051[_0x25e9('0x3c')]=_0x5ab051[_0x25e9('0x3c')]['length']?_0x5ab051[_0x25e9('0x3c')]:_0xe668d9['model'];if(!_0x41ebc9['query']['hasOwnProperty'](_0x25e9('0x3e'))){_0x5ab051[_0x25e9('0x3f')]=qs['limit'](_0x41ebc9[_0x25e9('0x38')][_0x25e9('0x3f')]);_0x5ab051[_0x25e9('0x21')]=qs['offset'](_0x41ebc9['query'][_0x25e9('0x21')]);}_0x5ab051[_0x25e9('0x88')]=qs[_0x25e9('0x40')](_0x41ebc9['query']['sort']);_0x5ab051['where']=qs['filters'](_[_0x25e9('0x43')](_0x41ebc9['query'],_0xe668d9[_0x25e9('0x42')]));_0x5ab051[_0x25e9('0x41')][_0x25e9('0xab')]=_0x50d854['id'];if(_0x41ebc9[_0x25e9('0x38')][_0x25e9('0x7f')]){_0x5ab051[_0x25e9('0x41')]=_['merge'](_0x5ab051['where'],{'$or':_[_0x25e9('0x33')](_0x5ab051[_0x25e9('0x3c')],function(_0x3c66b0){var _0x17b3f5={};_0x17b3f5[_0x3c66b0]={'$like':'%'+_0x41ebc9['query'][_0x25e9('0x7f')]+'%'};return _0x17b3f5;})});}if(_0x41ebc9[_0x25e9('0x38')][_0x25e9('0xbc')]){var _0x2a73aa=_0x41ebc9[_0x25e9('0x38')][_0x25e9('0xbc')][_0x25e9('0x30')](',');var _0x30007b={};_0x30007b[_0x2a73aa[0x0]]={'$gte':moment(_0x2a73aa[0x1])[_0x25e9('0xbd')](_0x25e9('0xbe'))};_0x5ab051['where']=_[_0x25e9('0x94')](_0x5ab051[_0x25e9('0x41')],_0x30007b);}_0x5ab051=_['merge']({},_0x5ab051,_0x41ebc9[_0x25e9('0xb0')]);return db[_0x25e9('0xb7')][_0x25e9('0x20')]({'where':_0x5ab051[_0x25e9('0x41')]})[_0x25e9('0x26')](function(_0x452e45){_0x2c68cd['count']=_0x452e45;if(_0x41ebc9[_0x25e9('0x38')]['includeAll']){_0x5ab051['include']=[{'all':!![]}];}return db[_0x25e9('0xb7')]['findAll'](_0x5ab051);})[_0x25e9('0x26')](function(_0x492235){_0x2c68cd['rows']=_0x492235;return _0x2c68cd;});}})['then'](respondWithFilteredResult(_0x5e8e36,_0x5ab051))[_0x25e9('0xb1')](handleError(_0x5e8e36,null));};exports[_0x25e9('0xbf')]=function(_0x5ae816,_0x43757c,_0x3de266){return db['WhatsappInteraction'][_0x25e9('0x65')]({'where':{'id':_0x5ae816[_0x25e9('0xb4')]['id']}})[_0x25e9('0x26')](handleEntityNotFound(_0x43757c,null))['then'](function(_0x2b20a9){if(_0x2b20a9){return _0x2b20a9['setTags'](_0x5ae816[_0x25e9('0x70')][_0x25e9('0xb9')],_[_0x25e9('0xb8')](_0x5ae816[_0x25e9('0x70')],[_0x25e9('0xb9'),'id'])||{})[_0x25e9('0xc0')](function(){return db[_0x25e9('0x6b')]['findAll']({'attributes':['id',_0x25e9('0x2a'),_0x25e9('0xc1')],'where':{'id':_0x5ae816[_0x25e9('0x70')][_0x25e9('0xb9')]}});})['then'](function(_0x4b096b){socket['emit'](_0x25e9('0xc2'),{'id':Number(_0x5ae816[_0x25e9('0xb4')]['id']),'tags':_0x4b096b||[]});return{'id':Number(_0x5ae816[_0x25e9('0xb4')]['id']),'tags':_0x4b096b||[]};});}})[_0x25e9('0x26')](respondWithResult(_0x43757c,null))[_0x25e9('0xb1')](handleError(_0x43757c,null));};exports['removeTags']=function(_0x3c53a0,_0x109088,_0x21ac2c){return db[_0x25e9('0x34')]['find']({'where':{'id':_0x3c53a0['params']['id']}})[_0x25e9('0x26')](handleEntityNotFound(_0x109088,null))[_0x25e9('0x26')](function(_0x66e5f9){if(_0x66e5f9){return _0x66e5f9[_0x25e9('0xc3')](_0x3c53a0['query']['ids']);}})[_0x25e9('0x26')](respondWithStatusCode(_0x109088,null))['catch'](handleError(_0x109088,null));};exports[_0x25e9('0xc4')]=function(_0x55a9a6,_0xe87a5){var _0x281e9a=moment()[_0x25e9('0xc5')]()[_0x25e9('0xa8')]();var _0x3326a7=path[_0x25e9('0xc6')](config['root'],_0x25e9('0xc7'),'files',_0x25e9('0xc8'));var _0x337ce1=path['join'](config[_0x25e9('0xc9')],'server','files',_0x25e9('0xca'));var _0x7759fc=path['join'](_0x3326a7,_0x281e9a);var _0x51db66=util[_0x25e9('0xbd')]('transcript-%d-%s.zip',_0x55a9a6['params']['id'],_0x281e9a);var _0x55e395=path[_0x25e9('0xc6')](_0x3326a7,_0x51db66);var _0x59fd6d=[];_0x59fd6d[_0x25e9('0x32')]({'model':db[_0x25e9('0xcb')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x59fd6d[_0x25e9('0x32')]({'model':db['CmContact'],'as':_0x25e9('0x60'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x55a9a6[_0x25e9('0x38')]['attachments']){_0x59fd6d[_0x25e9('0x32')]({'model':db[_0x25e9('0xcc')],'as':_0x25e9('0xcc'),'raw':!![]});}var _0x298066=[{'model':db['WhatsappMessage'],'as':_0x25e9('0xcd'),'attributes':['id',_0x25e9('0x70'),_0x25e9('0x76'),_0x25e9('0xce'),'secret','read'],'include':_0x59fd6d}];_0x298066[_0x25e9('0x32')]({'model':db[_0x25e9('0xcf')],'as':'Account','attributes':['id',_0x25e9('0x2a')]});_0x298066[_0x25e9('0x32')]({'model':db[_0x25e9('0xcb')],'as':_0x25e9('0xd0'),'attributes':['id','fullname']});return db[_0x25e9('0x34')][_0x25e9('0x65')]({'where':{'id':_0x55a9a6[_0x25e9('0xb4')]['id']},'include':_0x298066})[_0x25e9('0x26')](handleEntityNotFound(_0xe87a5,null))[_0x25e9('0x26')](function(_0x1066be){if(_0x1066be){var _0x28fed5=_0x1066be[_0x25e9('0xd1')]({'plain':!![]});fs[_0x25e9('0xd2')](_0x7759fc);var _0x17bdce={'format':'A4','border':_0x25e9('0xd3'),'header':{'height':_0x25e9('0xd4'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x25e9('0xd5'),'contents':{'default':util[_0x25e9('0xbd')](_0x25e9('0xd6'),util['format'](_0x25e9('0xd7'),_0x25e9('0xd8'),_0x28fed5['id']),moment()[_0x25e9('0xbd')](_0x25e9('0xd9'))[_0x25e9('0xa8')]())}}};var _0x2ac234={'channel':_0x25e9('0xd8'),'account':_0x28fed5[_0x25e9('0xda')][_0x25e9('0x2a')],'agent':_0x28fed5['Owner']?_0x28fed5[_0x25e9('0xd0')][_0x25e9('0x2d')]:_0x25e9('0xdb'),'createdAt':moment(_0x28fed5[_0x25e9('0x76')])[_0x25e9('0xbd')](_0x25e9('0xbe'))[_0x25e9('0xa8')](),'closedAt':_0x28fed5[_0x25e9('0xdc')]?moment(_0x28fed5[_0x25e9('0xdd')])[_0x25e9('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x28fed5['disposition'],'messages':_(_0x28fed5[_0x25e9('0xcd')])[_0x25e9('0x7f')]({'secret':![]})[_0x25e9('0x33')](function(_0x361ec3){if(_0x361ec3[_0x25e9('0xcc')]){var _0x3d884e=path['join'](_0x337ce1,_0x361ec3[_0x25e9('0xcc')]['basename']);if(fs[_0x25e9('0xde')](_0x3d884e)){fs['createReadStream'](_0x3d884e)['pipe'](fs[_0x25e9('0xdf')](path[_0x25e9('0xc6')](_0x7759fc,_0x361ec3[_0x25e9('0xcc')]['basename'])));}}return{'date':moment(_0x361ec3[_0x25e9('0x76')])['format'](_0x25e9('0xbe'))['toString'](),'sender':_0x361ec3[_0x25e9('0xce')]===_0x25e9('0xe0')?_0x361ec3[_0x25e9('0xcb')]?_0x361ec3['User'][_0x25e9('0x2d')]:_0x25e9('0xe1'):_0x361ec3[_0x25e9('0x60')][_0x25e9('0xe2')]+(_0x361ec3[_0x25e9('0x60')][_0x25e9('0xe3')]?'\x20'+_0x361ec3[_0x25e9('0x60')][_0x25e9('0xe3')]:''),'body':_0x361ec3[_0x25e9('0xcc')]?_0x361ec3[_0x25e9('0xcc')]['basename']:_0x361ec3[_0x25e9('0x70')],'direction':_0x361ec3[_0x25e9('0xce')]===_0x25e9('0xe0')?'A':'C','secret':_0x361ec3['secret'],'read':_0x361ec3[_0x25e9('0x7c')],'attachment':_0x361ec3[_0x25e9('0xcc')]};})[_0x25e9('0x5c')]()};return ejs[_0x25e9('0xe4')](path[_0x25e9('0xc6')](config['root'],_0x25e9('0xc7'),_0x25e9('0xe5'),'downloadInteraction.html'),{'interaction':_0x2ac234})[_0x25e9('0x26')](function(_0x573d6e){return new BPromise(function(_0x30b246,_0x31e4ae){pdf[_0x25e9('0xb2')](_0x573d6e,_0x17bdce)[_0x25e9('0xe6')](path[_0x25e9('0xc6')](_0x7759fc,_0x25e9('0xe7')+_0x28fed5['id']+'-'+_0x281e9a+_0x25e9('0xe8')),function(_0x37c4c0,_0x1e547f){if(_0x37c4c0)return _0x31e4ae(_0x37c4c0);_0x30b246(_0x1e547f);});});})[_0x25e9('0x26')](function(){return new BPromise(function(_0x2c9fe1,_0x4f4157){zipdir(_0x7759fc,{'saveTo':_0x55e395},function(_0x56525b,_0x557478){if(_0x56525b)return _0x4f4157(_0x56525b);return _0x2c9fe1(_0x557478);});})[_0x25e9('0x26')](function(){return new BPromise(function(_0x15aee1,_0x2ee4f4){rimraf(_0x7759fc,function(_0x1c4774){if(_0x1c4774)_0x2ee4f4(_0x1c4774);return _0x15aee1();});});})[_0x25e9('0x26')](function(){return _0xe87a5[_0x25e9('0xc4')](_0x55e395,_0x51db66,function(_0x5ee079){if(_0x5ee079){console['log'](_0x25e9('0xe9'),_0x5ee079);}else{fs[_0x25e9('0xea')](_0x55e395);}});});});}else{return _0xe87a5[_0x25e9('0x1c')](0xc8);}})[_0x25e9('0xb1')](handleError(_0xe87a5,null));}; \ No newline at end of file +var _0x66ec=['union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','WhatsappAccountId','toString','sequelize','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','params','keys','includeAll','include','create','describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','join','files','root','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','30px','Whatsapp','YYYY-MM-DD','N.A.','closedAt','disposition','basename','existsSync','createWriteStream','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','split','Tags','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?'];(function(_0x37e4e2,_0x2fecc1){var _0x4deaf0=function(_0x345c71){while(--_0x345c71){_0x37e4e2['push'](_0x37e4e2['shift']());}};_0x4deaf0(++_0x2fecc1);}(_0x66ec,0x166));var _0xc66e=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x66ec[_0x1d39f6];return _0x3dbd7a;};'use strict';var pdf=require(_0xc66e('0x0'));var emlformat=require(_0xc66e('0x1'));var rimraf=require(_0xc66e('0x2'));var zipdir=require(_0xc66e('0x3'));var jsonpatch=require(_0xc66e('0x4'));var rp=require(_0xc66e('0x5'));var moment=require(_0xc66e('0x6'));var BPromise=require(_0xc66e('0x7'));var Mustache=require(_0xc66e('0x8'));var util=require('util');var path=require(_0xc66e('0x9'));var sox=require(_0xc66e('0xa'));var csv=require('to-csv');var ejs=require(_0xc66e('0xb'));var fs=require('fs');var _=require(_0xc66e('0xc'));var squel=require(_0xc66e('0xd'));var crypto=require(_0xc66e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc66e('0xf'));var toCsv=require(_0xc66e('0x10'));var querystring=require(_0xc66e('0x11'));var Papa=require('papaparse');var Redis=require(_0xc66e('0x12'));var authService=require(_0xc66e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc66e('0x14'));var hardwareService=require(_0xc66e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc66e('0x16'));var config=require(_0xc66e('0x17'));var licenseUtil=require(_0xc66e('0x18'));var db=require(_0xc66e('0x19'))['db'];config[_0xc66e('0x1a')]=_[_0xc66e('0x1b')](config[_0xc66e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc66e('0x1c'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xc66e('0x1d')](socket);function respondWithStatusCode(_0x279c56,_0x5a47d3){_0x5a47d3=_0x5a47d3||0xcc;return function(_0x46a428){if(_0x46a428){return _0x279c56[_0xc66e('0x1e')](_0x5a47d3);}return _0x279c56[_0xc66e('0x1f')](_0x5a47d3)[_0xc66e('0x20')]();};}function respondWithResult(_0x138a08,_0x3b0292){_0x3b0292=_0x3b0292||0xc8;return function(_0x400309){if(_0x400309){return _0x138a08[_0xc66e('0x1f')](_0x3b0292)[_0xc66e('0x21')](_0x400309);}};}function respondWithFilteredResult(_0x25d676,_0x1eed7d){return function(_0x5a2baa){if(_0x5a2baa){var _0x40202e=_0x5a2baa[_0xc66e('0x22')],_0x59abbd=_0x1eed7d[_0xc66e('0x23')],_0x5052cc=_0x1eed7d[_0xc66e('0x23')]+_0x1eed7d[_0xc66e('0x24')],_0x19c1c7;if(_0x5052cc>=_0x40202e){_0x5052cc=_0x40202e;_0x19c1c7=0xc8;}else{_0x19c1c7=0xce;}_0x25d676['status'](_0x19c1c7);return _0x25d676['set']('Content-Range',_0x59abbd+'-'+_0x5052cc+'/'+_0x40202e)[_0xc66e('0x21')](_0x5a2baa);}return null;};}function patchUpdates(_0x53561f){return function(_0x1627df){try{jsonpatch[_0xc66e('0x25')](_0x1627df,_0x53561f,!![]);}catch(_0x5bd87e){return BPromise[_0xc66e('0x26')](_0x5bd87e);}return _0x1627df[_0xc66e('0x27')]();};}function saveUpdates(_0x47a678,_0x3b722f){return function(_0xe11e78){if(_0xe11e78){return _0xe11e78[_0xc66e('0x28')](_0x47a678)[_0xc66e('0x29')](function(_0x4c74ec){return _0x4c74ec;});}return null;};}function removeEntity(_0x3a4df2,_0x14f81e){return function(_0x5623f1){if(_0x5623f1){return _0x5623f1[_0xc66e('0x2a')]()[_0xc66e('0x29')](function(){_0x3a4df2[_0xc66e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0606,_0x368c6b){return function(_0x2caa6b){if(!_0x2caa6b){_0x5b0606[_0xc66e('0x1e')](0x194);}return _0x2caa6b;};}function handleError(_0x3fdfa6,_0x5d1585){_0x5d1585=_0x5d1585||0x1f4;return function(_0x39b090){logger[_0xc66e('0x2b')](_0x39b090[_0xc66e('0x2c')]);if(_0x39b090['name']){delete _0x39b090[_0xc66e('0x2d')];}_0x3fdfa6[_0xc66e('0x1f')](_0x5d1585)[_0xc66e('0x2e')](_0x39b090);};}function getInteractionUsers(_0x9358b8,_0x1279f8){return new BPromise(function(_0x441487,_0x3e670d){try{if(_0x1279f8[_0x9358b8['id']]){_0x9358b8[_0xc66e('0x2f')]=_['map'](_0x1279f8[_0x9358b8['id']],function(_0x3ac13e){return{'id':_0x3ac13e['id'],'fullname':_0x3ac13e[_0xc66e('0x30')]};});}}catch(_0x2147dd){_0x3e670d(_0x2147dd);}_0x441487(_0x9358b8);});}function getInteractionTags(_0x5b9e34,_0xbcd1d2){return new BPromise(function(_0x55f10b,_0x4c1999){try{if(_0x5b9e34[_0xc66e('0x31')]){_0x5b9e34['Tags']=[];_0x5b9e34['TagIds'][_0xc66e('0x32')](',')['forEach'](function(_0x3ce39a){_0x5b9e34[_0xc66e('0x33')][_0xc66e('0x34')](_0xbcd1d2[_0x3ce39a]);});}delete _0x5b9e34['TagIds'];}catch(_0x51a609){_0x4c1999(_0x51a609);}_0x55f10b(_0x5b9e34);});}function updateWhatsappInteraction(_0x508d11,_0x5dac76,_0x31c892){return new BPromise(function(_0x4dc3b1,_0x59171b){return getInteractionUsers(_0x508d11,_0x31c892)['then'](function(_0x3adcf3){return getInteractionTags(_0x3adcf3,_0x5dac76);})['then'](function(_0x154353){_0x4dc3b1(_0x154353);})[_0xc66e('0x35')](function(_0x5a1457){_0x59171b(_0x5a1457);});});}exports[_0xc66e('0x36')]=function(_0x559465,_0x417a36){var _0x41ffbe={},_0x2a03c9={},_0x4d8feb={'count':0x0,'rows':[]};var _0xb42c42=_['map'](db[_0xc66e('0x37')][_0xc66e('0x38')],function(_0x357d85){return{'name':_0x357d85[_0xc66e('0x39')],'type':_0x357d85[_0xc66e('0x3a')][_0xc66e('0x3b')]};});_0x2a03c9[_0xc66e('0x3c')]=_[_0xc66e('0x3d')](_0xb42c42,_0xc66e('0x2d'));_0x2a03c9['query']=_['keys'](_0x559465[_0xc66e('0x3e')]);_0x2a03c9['filters']=_['intersection'](_0x2a03c9[_0xc66e('0x3c')],_0x2a03c9[_0xc66e('0x3e')]);_0x41ffbe[_0xc66e('0x3f')]=_[_0xc66e('0x40')](_0x2a03c9[_0xc66e('0x3c')],qs[_0xc66e('0x41')](_0x559465['query']['fields']));_0x41ffbe[_0xc66e('0x3f')]=_0x41ffbe[_0xc66e('0x3f')][_0xc66e('0x42')]?_0x41ffbe[_0xc66e('0x3f')]:_0x2a03c9[_0xc66e('0x3c')];if(!_0x559465['query']['hasOwnProperty'](_0xc66e('0x43'))){_0x41ffbe[_0xc66e('0x24')]=qs[_0xc66e('0x24')](_0x559465['query'][_0xc66e('0x24')]);_0x41ffbe[_0xc66e('0x23')]=qs[_0xc66e('0x23')](_0x559465[_0xc66e('0x3e')]['offset']);}_0x41ffbe[_0xc66e('0x44')]=qs[_0xc66e('0x45')](_0x559465[_0xc66e('0x3e')][_0xc66e('0x45')]);_0x41ffbe[_0xc66e('0x46')]=qs[_0xc66e('0x47')](_[_0xc66e('0x48')](_0x559465[_0xc66e('0x3e')],_0x2a03c9[_0xc66e('0x47')]),_0xb42c42);var _0x1006fc=[];var _0x298ee3=squel['select']()['field']('id')[_0xc66e('0x49')](_0xc66e('0x2d'))[_0xc66e('0x49')]('color')[_0xc66e('0x4a')](_0xc66e('0x4b'));var _0x3f48b4=squel['select']()['field'](_0xc66e('0x4c'))[_0xc66e('0x49')](_0xc66e('0x4d'))['field'](_0xc66e('0x4e'))[_0xc66e('0x4a')](_0xc66e('0x4f'),'ui')[_0xc66e('0x50')]('users','u',_0xc66e('0x51'));var _0xfc17e7=squel['select']()[_0xc66e('0x4a')](_0xc66e('0x52'),'i')[_0xc66e('0x50')](_0xc66e('0x53'),'c',_0xc66e('0x54'))[_0xc66e('0x50')](_0xc66e('0x55'),'o',_0xc66e('0x56'))[_0xc66e('0x50')](_0xc66e('0x57'),'a',_0xc66e('0x58'))[_0xc66e('0x50')](_0xc66e('0x59'),'me',_0xc66e('0x5a'))[_0xc66e('0x50')]('whatsapp_interaction_has_tags','it',_0xc66e('0x5b'))[_0xc66e('0x50')]('tools_tags','t',_0xc66e('0x5c'));var _0x2b2979=squel[_0xc66e('0x5d')]();var _0x2577d6=[];var _0x554506=squel['expr']();var _0x39fd93;if(_0x559465[_0xc66e('0x3e')][_0xc66e('0x5e')]){_0x39fd93=as[_0xc66e('0x5f')](_0x559465[_0xc66e('0x3e')][_0xc66e('0x5e')]);var _0x160631=_0x39fd93[_0xc66e('0x60')];for(var _0xe05c99=0x0;_0xe05c99<_0x39fd93[_0xc66e('0x61')][_0xc66e('0x42')];_0xe05c99++){var _0x30d3d3=_0x39fd93[_0xc66e('0x61')][_0xe05c99];var _0x2b55ac='i';var _0x274d77=_[_0xc66e('0x62')](_0xb42c42,[_0xc66e('0x2d'),_0x30d3d3[_0xc66e('0x49')]]);if(!_0x274d77){switch(_0x30d3d3[_0xc66e('0x49')]){case _0xc66e('0x63'):if(_0x30d3d3['value']==0x1){_0xfc17e7['having']('`'+_0x30d3d3[_0xc66e('0x49')]+_0xc66e('0x64'));}else{_0xfc17e7[_0xc66e('0x65')]('`'+_0x30d3d3[_0xc66e('0x49')]+_0xc66e('0x66'));}break;case _0xc66e('0x67'):if(_0x30d3d3[_0xc66e('0x68')]===_0xc66e('0x69')){if(_0x30d3d3[_0xc66e('0x6a')]['split']('\x20')['length']>0x1){_0x2b2979[_0x160631](_0xc66e('0x6b'),qs[_0xc66e('0x6c')](_0x30d3d3[_0xc66e('0x6a')]),null);}else{var _0x8aa8e0='%'+_0x30d3d3[_0xc66e('0x6a')]+'%';_0x2b2979[_0x160631](_0xc66e('0x6d'),_0x8aa8e0,_0x8aa8e0,_0x8aa8e0);}}else{_0x274d77=_['find'](_0xb42c42,['name',_0xc66e('0x6e')]);_0x30d3d3[_0xc66e('0x49')]=_0xc66e('0x6e');_0x2364b9=as['buildExpression'](_0x2b55ac,_0x274d77['type'],_0x30d3d3);_0x2b2979[_0x160631](_0x2364b9[_0xc66e('0x6f')],_0x2364b9['value'][_0xc66e('0x70')],_0x2364b9['value']['end']);}break;case _0xc66e('0x71'):var _0xb9d869=_0x30d3d3[_0xc66e('0x6a')][_0xc66e('0x32')](',')[_0xc66e('0x3d')](function(_0x2ac6ef){return Number(_0x2ac6ef);});_0xb9d869[_0xc66e('0x72')](function(_0x2cf75f){_0x554506['or'](_0xc66e('0x73'),'%,'+_0x2cf75f+',%');});_0x2577d6=_[_0xc66e('0x74')](_0x2577d6,_0xb9d869);break;case _0xc66e('0x75'):if(_0x30d3d3[_0xc66e('0x68')]==='$substring'){_0x2b2979[_0x160631](_0xc66e('0x76'),'%'+_0x30d3d3[_0xc66e('0x6a')]+'%',null);}else{_0x274d77=_['find'](_0xb42c42,['name',_0xc66e('0x77')]);_0x30d3d3['field']='UserId';_0x2364b9=as[_0xc66e('0x78')](_0x2b55ac,_0x274d77[_0xc66e('0x3a')],_0x30d3d3);_0x2b2979[_0x160631](_0x2364b9[_0xc66e('0x6f')],_0x2364b9[_0xc66e('0x6a')][_0xc66e('0x70')],_0x2364b9[_0xc66e('0x6a')]['end']);}break;case _0xc66e('0x79'):_0x2364b9=as[_0xc66e('0x78')]('me',null,_0x30d3d3);_0x2b2979[_0x160631](_0x2364b9[_0xc66e('0x6f')],_0x2364b9[_0xc66e('0x6a')][_0xc66e('0x70')],_0x2364b9[_0xc66e('0x6a')]['end']);break;}}else{var _0x2364b9=as[_0xc66e('0x78')](_0x2b55ac,_0x274d77['type'],_0x30d3d3);_0x2b2979[_0x160631](_0x2364b9[_0xc66e('0x6f')],_0x2364b9[_0xc66e('0x6a')][_0xc66e('0x70')],_0x2364b9[_0xc66e('0x6a')][_0xc66e('0x20')]);}}}else{var _0x390d69=_(_0x559465[_0xc66e('0x3e')])['keys']()[_0xc66e('0x3d')](function(_0x252be3){return _[_0xc66e('0x7a')](_0xb42c42,['name',_0x252be3])?_0x252be3:undefined;})[_0xc66e('0x7b')]()['value']();if(!_[_0xc66e('0x7c')](_0x390d69)){_0x390d69[_0xc66e('0x72')](function(_0xad838d){if(_0xad838d==='WhatsappAccountId'){_0xfc17e7['where'](_0xc66e('0x7d'),[]['concat'](_0x559465[_0xc66e('0x3e')][_0xad838d]));}else if(_0xad838d===_0xc66e('0x7e')){var _0x590c2f=JSON[_0xc66e('0x7f')](_0x559465[_0xc66e('0x3e')][_0xad838d])['$gte'];var _0x13dab9=JSON['parse'](_0x559465[_0xc66e('0x3e')][_0xad838d])[_0xc66e('0x80')];_0xfc17e7[_0xc66e('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x590c2f,_0x13dab9);}else{if(_0x559465[_0xc66e('0x3e')][_0xad838d]==='null'){_0xfc17e7[_0xc66e('0x46')]('i.'+_0xad838d+_0xc66e('0x81'));}else{_0xfc17e7[_0xc66e('0x46')]('i.'+_0xad838d+_0xc66e('0x82'),_0x559465['query'][_0xad838d]);}}});}if(_0x559465[_0xc66e('0x3e')][_0xc66e('0x83')]){if(_0x559465['query']['read']==0x1){_0xfc17e7[_0xc66e('0x65')]('`unreadMessages`\x20=\x200');}else{_0xfc17e7[_0xc66e('0x65')](_0xc66e('0x84'));}}if(_0x559465[_0xc66e('0x3e')][_0xc66e('0x85')]){_0x2577d6=_['isArray'](_0x559465['query']['tag'])?_0x559465['query'][_0xc66e('0x85')]:new Array(_0x559465[_0xc66e('0x3e')]['tag']);_0x2577d6[_0xc66e('0x72')](function(_0x498503){_0x554506['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x498503+',%');});}if(_0x559465[_0xc66e('0x3e')][_0xc66e('0x86')]){var _0x13d228=_0x559465['query'][_0xc66e('0x86')][_0xc66e('0x87')]('\x5c','\x5c\x5c')[_0xc66e('0x87')](/'/g,'\x27\x27');if(qs[_0xc66e('0x88')](_0x13d228)){_0x2b2979['or']('i.id\x20LIKE\x20?',_0x13d228+'%')['or']('i.phone\x20LIKE\x20?',_0x13d228+'%');}else{_0x2b2979['or'](_0xc66e('0x89'),qs[_0xc66e('0x6c')](_0x13d228))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x13d228+'%');}}}_0xfc17e7[_0xc66e('0x46')](_0x2b2979);_0xfc17e7[_0xc66e('0x8a')](_0xc66e('0x8b'));var _0x355789={'type':db[_0xc66e('0x8c')]['QueryTypes'][_0xc66e('0x8d')],'raw':!![]};var _0x18bcb0=_0xfc17e7[_0xc66e('0x8e')]();_0x18bcb0[_0xc66e('0x49')]('i.id');_0x18bcb0['field'](_0xc66e('0x8f'),_0xc66e('0x63'));if(_0x41ffbe[_0xc66e('0x44')]){_0x41ffbe['order'][_0xc66e('0x72')](function(_0x3ad092){var _0x2744e6=_0x3ad092[0x0]==='contactName'?_0x3ad092[0x0]:'i.'+_0x3ad092[0x0];_0xfc17e7[_0xc66e('0x44')](_0x2744e6,_0x3ad092[0x1]===_0xc66e('0x90')?![]:!![]);});}if(!_[_0xc66e('0x7c')](_0x2577d6)){_0xfc17e7[_0xc66e('0x65')](_0x554506);_0x18bcb0[_0xc66e('0x46')](_0xc66e('0x91'),_0x2577d6);}BPromise['resolve']()[_0xc66e('0x29')](function(){if(!_0x39fd93){if(_0x559465[_0xc66e('0x3e')]['WhatsappAccountId']||_0x559465['query'][_0xc66e('0x92')])return;_0x18bcb0[_0xc66e('0x46')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0xfc17e7['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x559465['user'][_0xc66e('0x93')]!==_0xc66e('0x94'))return;return _0x559465[_0xc66e('0x95')][_0xc66e('0x96')]({'attributes':['id'],'raw':!![]})[_0xc66e('0x29')](function(_0x4dd96c){if(_[_0xc66e('0x7c')](_0x4dd96c)){_0x18bcb0[_0xc66e('0x46')]('i.WhatsappAccountId\x20IS\x20NULL');_0xfc17e7[_0xc66e('0x46')](_0xc66e('0x97'));}else{_0x18bcb0['where'](_0xc66e('0x7d'),_['map'](_0x4dd96c,'id'));_0xfc17e7[_0xc66e('0x46')](_0xc66e('0x7d'),_[_0xc66e('0x3d')](_0x4dd96c,'id'));}});})[_0xc66e('0x29')](function(){if(_0x559465[_0xc66e('0x95')]['role']===_0xc66e('0x94')&&!_0x39fd93&&!_0x559465[_0xc66e('0x3e')][_0xc66e('0x98')])return[];return db['sequelize'][_0xc66e('0x3e')](_0x18bcb0[_0xc66e('0x99')](),_0x355789);})['then'](function(_0x5164c1){_0x4d8feb[_0xc66e('0x22')]=_0x5164c1[_0xc66e('0x42')];if(_0x4d8feb['count']===0x0)return[];return db[_0xc66e('0x9a')][_0xc66e('0x3e')](_0x298ee3[_0xc66e('0x99')](),_0x355789)[_0xc66e('0x29')](function(_0x8d75d6){_0x1006fc=_['keyBy'](_0x8d75d6,'id');_0x355789=_['merge'](_0x355789,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x559465['query'][_0xc66e('0x41')]){_0x41ffbe[_0xc66e('0x3f')][_0xc66e('0x72')](function(_0x488ffb){_0xfc17e7[_0xc66e('0x49')]('i.'+_0x488ffb);});}else{_0xfc17e7[_0xc66e('0x49')](_0xc66e('0x8f'),_0xc66e('0x63'));_0xfc17e7['field']('a.key','Account.key');_0xfc17e7[_0xc66e('0x49')](_0xc66e('0x9b'),_0xc66e('0x9c'));_0xfc17e7[_0xc66e('0x49')]('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');_0xfc17e7['field']('i.*');_0xfc17e7[_0xc66e('0x49')](_0xc66e('0x9d'),_0xc66e('0x9e'));_0xfc17e7['field'](_0xc66e('0x9f'),'Contact.lastName');_0xfc17e7[_0xc66e('0x49')](_0xc66e('0xa0'),_0xc66e('0xa1'));_0xfc17e7[_0xc66e('0x49')]('c.phone',_0xc66e('0xa2'));_0xfc17e7[_0xc66e('0x49')](_0xc66e('0xa3'),_0xc66e('0xa4'));_0xfc17e7[_0xc66e('0x49')](_0xc66e('0xa5'),_0xc66e('0xa6'));_0xfc17e7[_0xc66e('0x49')](_0xc66e('0xa7'),_0xc66e('0xa8'));_0xfc17e7[_0xc66e('0x49')](_0xc66e('0xa9'),'Owner.internal');_0xfc17e7[_0xc66e('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc66e('0x31'));}if(_0x41ffbe[_0xc66e('0x24')])_0xfc17e7[_0xc66e('0x24')](_0x41ffbe[_0xc66e('0x24')]);if(_0x41ffbe[_0xc66e('0x23')])_0xfc17e7['offset'](_0x41ffbe['offset']);return db[_0xc66e('0x9a')][_0xc66e('0x3e')](_0xfc17e7[_0xc66e('0x99')](),_0x355789);})[_0xc66e('0x29')](function(_0xd3f321){_0x3f48b4[_0xc66e('0x46')](_0xc66e('0xaa'),_[_0xc66e('0x3d')](_0xd3f321,'id'));return db['sequelize']['query'](_0x3f48b4[_0xc66e('0x99')](),_0x355789)[_0xc66e('0x29')](function(_0x1d6992){var _0x58397b=_[_0xc66e('0xab')](_0x1d6992,_0xc66e('0xac'));var _0x11d539=[];_0xd3f321[_0xc66e('0x72')](function(_0x257e6b){_0x11d539[_0xc66e('0x34')](updateWhatsappInteraction(_0x257e6b,_0x1006fc,_0x58397b));});return BPromise[_0xc66e('0xad')](_0x11d539);});});})[_0xc66e('0x29')](function(_0x12189c){_0x4d8feb[_0xc66e('0xae')]=_0x12189c;return _0x4d8feb;})[_0xc66e('0x29')](respondWithFilteredResult(_0x417a36,_0x41ffbe))['catch'](handleError(_0x417a36,null));};exports['show']=function(_0x19d2d6,_0x50c719){var _0x7e3ff2={'raw':![],'where':{'id':_0x19d2d6[_0xc66e('0xaf')]['id']}},_0x455f7a={};_0x455f7a[_0xc66e('0x3c')]=_[_0xc66e('0xb0')](db[_0xc66e('0x37')][_0xc66e('0x38')]);_0x455f7a[_0xc66e('0x3e')]=_[_0xc66e('0xb0')](_0x19d2d6[_0xc66e('0x3e')]);_0x455f7a[_0xc66e('0x47')]=_[_0xc66e('0x40')](_0x455f7a[_0xc66e('0x3c')],_0x455f7a['query']);_0x7e3ff2[_0xc66e('0x3f')]=_[_0xc66e('0x40')](_0x455f7a[_0xc66e('0x3c')],qs[_0xc66e('0x41')](_0x19d2d6[_0xc66e('0x3e')][_0xc66e('0x41')]));_0x7e3ff2['attributes']=_0x7e3ff2[_0xc66e('0x3f')]['length']?_0x7e3ff2['attributes']:_0x455f7a[_0xc66e('0x3c')];if(_0x19d2d6[_0xc66e('0x3e')][_0xc66e('0xb1')]){_0x7e3ff2[_0xc66e('0xb2')]=[{'all':!![]}];}_0x7e3ff2=_['merge']({},_0x7e3ff2,_0x19d2d6['options']);return db[_0xc66e('0x37')][_0xc66e('0x62')](_0x7e3ff2)[_0xc66e('0x29')](handleEntityNotFound(_0x50c719,null))['then'](respondWithResult(_0x50c719,null))['catch'](handleError(_0x50c719,null));};exports[_0xc66e('0xb3')]=function(_0x36cda5,_0x34e58){return db[_0xc66e('0x37')]['create'](_0x36cda5[_0xc66e('0x79')],{})[_0xc66e('0x29')](respondWithResult(_0x34e58,0xc9))[_0xc66e('0x35')](handleError(_0x34e58,null));};exports[_0xc66e('0x28')]=function(_0x2141f4,_0x325687){if(_0x2141f4[_0xc66e('0x79')]['id']){delete _0x2141f4[_0xc66e('0x79')]['id'];}return db[_0xc66e('0x37')]['find']({'where':{'id':_0x2141f4['params']['id']}})['then'](handleEntityNotFound(_0x325687,null))['then'](saveUpdates(_0x2141f4[_0xc66e('0x79')],null))[_0xc66e('0x29')](respondWithResult(_0x325687,null))[_0xc66e('0x35')](handleError(_0x325687,null));};exports[_0xc66e('0x2a')]=function(_0x17823e,_0x23cbd6){return db[_0xc66e('0x37')][_0xc66e('0x62')]({'where':{'id':_0x17823e['params']['id']}})[_0xc66e('0x29')](handleEntityNotFound(_0x23cbd6,null))[_0xc66e('0x29')](removeEntity(_0x23cbd6,null))['catch'](handleError(_0x23cbd6,null));};exports[_0xc66e('0xb4')]=function(_0x15a4b0,_0x4bfa78){return db['WhatsappInteraction'][_0xc66e('0xb4')]()['then'](respondWithResult(_0x4bfa78,null))[_0xc66e('0x35')](handleError(_0x4bfa78,null));};exports['addMessage']=function(_0x210164,_0x373bc2,_0x1eb2df){return db[_0xc66e('0xb5')]['find']({'where':{'id':_0x210164['params']['id']}})[_0xc66e('0x29')](handleEntityNotFound(_0x373bc2,null))[_0xc66e('0x29')](function(_0x40a327){if(_0x40a327){return _0x40a327[_0xc66e('0xb6')](_0x210164[_0xc66e('0x79')]['ids'],_[_0xc66e('0xb7')](_0x210164[_0xc66e('0x79')],[_0xc66e('0xb8'),'id'])||{});}})[_0xc66e('0x29')](respondWithResult(_0x373bc2,null))['catch'](handleError(_0x373bc2,null));};exports[_0xc66e('0xb9')]=function(_0xbfe2e6,_0x4d70ee,_0x265842){var _0x1bd155={'raw':![],'where':{}};var _0x59e39f={};var _0x1cfa8a={'count':0x0,'rows':[]};return db[_0xc66e('0x37')][_0xc66e('0xba')]({'where':{'id':_0xbfe2e6[_0xc66e('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4d70ee,null))[_0xc66e('0x29')](function(_0x37af00){if(_0x37af00){_0x59e39f['model']=_[_0xc66e('0xb0')](db[_0xc66e('0xb5')][_0xc66e('0x38')]);_0x59e39f[_0xc66e('0x3e')]=_['keys'](_0xbfe2e6[_0xc66e('0x3e')]);_0x59e39f[_0xc66e('0x47')]=_[_0xc66e('0x40')](_0x59e39f[_0xc66e('0x3c')],_0x59e39f[_0xc66e('0x3e')]);_0x1bd155[_0xc66e('0x3f')]=_[_0xc66e('0x40')](_0x59e39f[_0xc66e('0x3c')],qs[_0xc66e('0x41')](_0xbfe2e6['query'][_0xc66e('0x41')]));_0x1bd155[_0xc66e('0x3f')]=_0x1bd155[_0xc66e('0x3f')][_0xc66e('0x42')]?_0x1bd155[_0xc66e('0x3f')]:_0x59e39f[_0xc66e('0x3c')];if(!_0xbfe2e6['query']['hasOwnProperty'](_0xc66e('0x43'))){_0x1bd155['limit']=qs[_0xc66e('0x24')](_0xbfe2e6[_0xc66e('0x3e')][_0xc66e('0x24')]);_0x1bd155['offset']=qs[_0xc66e('0x23')](_0xbfe2e6[_0xc66e('0x3e')][_0xc66e('0x23')]);}_0x1bd155[_0xc66e('0x44')]=qs[_0xc66e('0x45')](_0xbfe2e6['query'][_0xc66e('0x45')]);_0x1bd155['where']=qs[_0xc66e('0x47')](_[_0xc66e('0x48')](_0xbfe2e6[_0xc66e('0x3e')],_0x59e39f[_0xc66e('0x47')]));_0x1bd155[_0xc66e('0x46')][_0xc66e('0xac')]=_0x37af00['id'];if(_0xbfe2e6[_0xc66e('0x3e')][_0xc66e('0x86')]){_0x1bd155[_0xc66e('0x46')]=_['merge'](_0x1bd155[_0xc66e('0x46')],{'$or':_[_0xc66e('0x3d')](_0x1bd155[_0xc66e('0x3f')],function(_0x58ea34){var _0x5344e3={};_0x5344e3[_0x58ea34]={'$like':'%'+_0xbfe2e6['query'][_0xc66e('0x86')]+'%'};return _0x5344e3;})});}if(_0xbfe2e6[_0xc66e('0x3e')][_0xc66e('0xbb')]){var _0x522301=_0xbfe2e6[_0xc66e('0x3e')][_0xc66e('0xbb')][_0xc66e('0x32')](',');var _0x3b6493={};_0x3b6493[_0x522301[0x0]]={'$gte':moment(_0x522301[0x1])[_0xc66e('0xbc')](_0xc66e('0xbd'))};_0x1bd155[_0xc66e('0x46')]=_[_0xc66e('0xbe')](_0x1bd155[_0xc66e('0x46')],_0x3b6493);}_0x1bd155=_['merge']({},_0x1bd155,_0xbfe2e6[_0xc66e('0xbf')]);return db[_0xc66e('0xb5')][_0xc66e('0x22')]({'where':_0x1bd155[_0xc66e('0x46')]})[_0xc66e('0x29')](function(_0x5b46c1){_0x1cfa8a[_0xc66e('0x22')]=_0x5b46c1;if(_0xbfe2e6[_0xc66e('0x3e')][_0xc66e('0xb1')]){_0x1bd155[_0xc66e('0xb2')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xc66e('0xc0')](_0x1bd155);})[_0xc66e('0x29')](function(_0x4d3808){_0x1cfa8a[_0xc66e('0xae')]=_0x4d3808;return _0x1cfa8a;});}})[_0xc66e('0x29')](respondWithFilteredResult(_0x4d70ee,_0x1bd155))[_0xc66e('0x35')](handleError(_0x4d70ee,null));};exports[_0xc66e('0xc1')]=function(_0x1a75da,_0x3d28ce,_0x536a00){return db[_0xc66e('0x37')][_0xc66e('0x62')]({'where':{'id':_0x1a75da[_0xc66e('0xaf')]['id']}})[_0xc66e('0x29')](handleEntityNotFound(_0x3d28ce,null))['then'](function(_0x2b3b66){if(_0x2b3b66){return _0x2b3b66[_0xc66e('0xc2')](_0x1a75da[_0xc66e('0x79')]['ids'],_['omit'](_0x1a75da[_0xc66e('0x79')],[_0xc66e('0xb8'),'id'])||{})[_0xc66e('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id',_0xc66e('0x2d'),_0xc66e('0xc4')],'where':{'id':_0x1a75da[_0xc66e('0x79')][_0xc66e('0xb8')]}});})[_0xc66e('0x29')](function(_0x9c534f){socket[_0xc66e('0xc5')]('whatsappInteractionTags:save',{'id':Number(_0x1a75da[_0xc66e('0xaf')]['id']),'tags':_0x9c534f||[]});return{'id':Number(_0x1a75da['params']['id']),'tags':_0x9c534f||[]};});}})[_0xc66e('0x29')](respondWithResult(_0x3d28ce,null))[_0xc66e('0x35')](handleError(_0x3d28ce,null));};exports[_0xc66e('0xc6')]=function(_0x45aa58,_0x2d2ebf,_0x2ea3c9){return db['WhatsappInteraction'][_0xc66e('0x62')]({'where':{'id':_0x45aa58[_0xc66e('0xaf')]['id']}})[_0xc66e('0x29')](handleEntityNotFound(_0x2d2ebf,null))[_0xc66e('0x29')](function(_0x2751ec){if(_0x2751ec){return _0x2751ec['removeTags'](_0x45aa58['query']['ids']);}})[_0xc66e('0x29')](respondWithStatusCode(_0x2d2ebf,null))[_0xc66e('0x35')](handleError(_0x2d2ebf,null));};exports[_0xc66e('0xc7')]=function(_0x5573fb,_0x2edefd){var _0x19f36c=moment()[_0xc66e('0xc8')]()[_0xc66e('0x99')]();var _0x357944=path[_0xc66e('0xc9')](config['root'],'server',_0xc66e('0xca'),'tmp');var _0x2e2b7d=path[_0xc66e('0xc9')](config[_0xc66e('0xcb')],'server','files','attachments');var _0x53499d=path['join'](_0x357944,_0x19f36c);var _0x4c9931=util[_0xc66e('0xbc')](_0xc66e('0xcc'),_0x5573fb[_0xc66e('0xaf')]['id'],_0x19f36c);var _0x2a480f=path[_0xc66e('0xc9')](_0x357944,_0x4c9931);var _0x5b7ea2=[];_0x5b7ea2[_0xc66e('0x34')]({'model':db[_0xc66e('0x75')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5b7ea2[_0xc66e('0x34')]({'model':db[_0xc66e('0xcd')],'as':_0xc66e('0x67'),'attributes':['id',_0xc66e('0xce'),_0xc66e('0xcf')],'raw':!![]});if(_0x5573fb[_0xc66e('0x3e')][_0xc66e('0xd0')]){_0x5b7ea2[_0xc66e('0x34')]({'model':db[_0xc66e('0xd1')],'as':_0xc66e('0xd1'),'raw':!![]});}var _0x5b6929=[{'model':db[_0xc66e('0xb5')],'as':_0xc66e('0xd2'),'attributes':['id',_0xc66e('0x79'),_0xc66e('0x7e'),_0xc66e('0xd3'),_0xc66e('0xd4'),_0xc66e('0x83')],'include':_0x5b7ea2}];_0x5b6929['push']({'model':db['WhatsappAccount'],'as':_0xc66e('0xd5'),'attributes':['id','name']});_0x5b6929[_0xc66e('0x34')]({'model':db['User'],'as':_0xc66e('0xd6'),'attributes':['id',_0xc66e('0x30')]});return db[_0xc66e('0x37')][_0xc66e('0x62')]({'where':{'id':_0x5573fb[_0xc66e('0xaf')]['id']},'include':_0x5b6929})[_0xc66e('0x29')](handleEntityNotFound(_0x2edefd,null))[_0xc66e('0x29')](function(_0x52a4ef){if(_0x52a4ef){var _0x407353=_0x52a4ef[_0xc66e('0xd7')]({'plain':!![]});fs[_0xc66e('0xd8')](_0x53499d);var _0x47b399={'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':_0xc66e('0xd9'),'contents':{'default':util[_0xc66e('0xbc')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format']('%s\x20#%d',_0xc66e('0xda'),_0x407353['id']),moment()['format'](_0xc66e('0xdb'))[_0xc66e('0x99')]())}}};var _0x20e8ca={'channel':'Whatsapp','account':_0x407353[_0xc66e('0xd5')][_0xc66e('0x2d')],'agent':_0x407353[_0xc66e('0xd6')]?_0x407353[_0xc66e('0xd6')][_0xc66e('0x30')]:_0xc66e('0xdc'),'createdAt':moment(_0x407353['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x407353['closed']?moment(_0x407353[_0xc66e('0xdd')])[_0xc66e('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc66e('0x99')]():'','disposition':_0x407353[_0xc66e('0xde')],'messages':_(_0x407353['Messages'])[_0xc66e('0x86')]({'secret':![]})['map'](function(_0x4faae0){if(_0x4faae0[_0xc66e('0xd1')]){var _0x533ce6=path['join'](_0x2e2b7d,_0x4faae0[_0xc66e('0xd1')][_0xc66e('0xdf')]);if(fs[_0xc66e('0xe0')](_0x533ce6)){fs['createReadStream'](_0x533ce6)['pipe'](fs[_0xc66e('0xe1')](path[_0xc66e('0xc9')](_0x53499d,_0x4faae0[_0xc66e('0xd1')]['basename'])));}}return{'date':moment(_0x4faae0[_0xc66e('0x7e')])[_0xc66e('0xbc')](_0xc66e('0xbd'))[_0xc66e('0x99')](),'sender':_0x4faae0['direction']===_0xc66e('0xe2')?_0x4faae0[_0xc66e('0x75')]?_0x4faae0[_0xc66e('0x75')][_0xc66e('0x30')]:_0xc66e('0xe3'):_0x4faae0[_0xc66e('0x67')][_0xc66e('0xce')]+(_0x4faae0[_0xc66e('0x67')][_0xc66e('0xcf')]?'\x20'+_0x4faae0[_0xc66e('0x67')][_0xc66e('0xcf')]:''),'body':_0x4faae0[_0xc66e('0xd1')]?_0x4faae0[_0xc66e('0xd1')][_0xc66e('0xdf')]:_0x4faae0[_0xc66e('0x79')],'direction':_0x4faae0['direction']===_0xc66e('0xe2')?'A':'C','secret':_0x4faae0[_0xc66e('0xd4')],'read':_0x4faae0[_0xc66e('0x83')],'attachment':_0x4faae0[_0xc66e('0xd1')]};})['value']()};return ejs[_0xc66e('0xe4')](path[_0xc66e('0xc9')](config[_0xc66e('0xcb')],'server',_0xc66e('0xe5'),_0xc66e('0xe6')),{'interaction':_0x20e8ca})['then'](function(_0x15a242){return new BPromise(function(_0x2c8d04,_0x2aff94){pdf[_0xc66e('0xb3')](_0x15a242,_0x47b399)[_0xc66e('0xe7')](path['join'](_0x53499d,_0xc66e('0xe8')+_0x407353['id']+'-'+_0x19f36c+_0xc66e('0xe9')),function(_0x1cd705,_0x306693){if(_0x1cd705)return _0x2aff94(_0x1cd705);_0x2c8d04(_0x306693);});});})['then'](function(){return new BPromise(function(_0x58e495,_0xc5e962){zipdir(_0x53499d,{'saveTo':_0x2a480f},function(_0x324ed7,_0x4d9eaa){if(_0x324ed7)return _0xc5e962(_0x324ed7);return _0x58e495(_0x4d9eaa);});})['then'](function(){return new BPromise(function(_0x5c8fc8,_0xae31e){rimraf(_0x53499d,function(_0x359a21){if(_0x359a21)_0xae31e(_0x359a21);return _0x5c8fc8();});});})[_0xc66e('0x29')](function(){return _0x2edefd[_0xc66e('0xc7')](_0x2a480f,_0x4c9931,function(_0x5db36b){if(_0x5db36b){console[_0xc66e('0xea')](_0xc66e('0xeb'),_0x5db36b);}else{fs[_0xc66e('0xec')](_0x2a480f);}});});});}else{return _0x2edefd[_0xc66e('0x1e')](0xc8);}})[_0xc66e('0x35')](handleError(_0x2edefd,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 9fe1126..7a82099 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 _0xbf3a=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0xbf3a,0xf0));var _0xabf3=function(_0x487ee4,_0x3d3e66){_0x487ee4=_0x487ee4-0x0;var _0x3b0877=_0xbf3a[_0x487ee4];return _0x3b0877;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xabf3('0x0'))['db'][_0xabf3('0x1')];var WhatsappMessage=require(_0xabf3('0x0'))['db'][_0xabf3('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xabf3('0x3')](0x0);var events={'afterCreate':_0xabf3('0x4'),'afterUpdate':'update','afterDestroy':_0xabf3('0x5')};function emitEvent(_0x4087d3){return function(_0x51c434,_0x59d8f6,_0x4b9eb9){_0x51c434[_0xabf3('0x6')]({'attributes':['id'],'raw':!![]})[_0xabf3('0x7')](function(_0x1f29ff){_0x51c434['setDataValue']('Users',_0x1f29ff[_0xabf3('0x8')](function(_0x108962){return{'id':_0x108962['id']};}));return WhatsappMessage[_0xabf3('0x9')]({'where':{'WhatsappInteractionId':_0x51c434['id'],'direction':'in','read':![]},'raw':!![]});})[_0xabf3('0x7')](function(_0x5dc1a2){_0x51c434['setDataValue'](_0xabf3('0xa'),_0x5dc1a2['length']);WhatsappInteractionEvents[_0xabf3('0xb')](_0x4087d3+':'+_0x51c434['id'],_0x51c434);WhatsappInteractionEvents[_0xabf3('0xb')](_0x4087d3,_0x51c434);_0x4b9eb9(null);})[_0xabf3('0xc')](_0x4b9eb9(null));};}for(var e in events){if(events[_0xabf3('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xabf3('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x8eef=['events','../../mysqldb','setMaxListeners','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hook','exports'];(function(_0x1afad6,_0x4112b0){var _0x366c18=function(_0x52b162){while(--_0x52b162){_0x1afad6['push'](_0x1afad6['shift']());}};_0x366c18(++_0x4112b0);}(_0x8eef,0x15f));var _0xf8ee=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8eef[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0xf8ee('0x0'));var WhatsappInteraction=require(_0xf8ee('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xf8ee('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf8ee('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2da2b1){return function(_0x543d32,_0x3835d7,_0x40bb87){_0x543d32['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4483e1){_0x543d32[_0xf8ee('0x3')](_0xf8ee('0x4'),_0x4483e1['map'](function(_0x29c830){return{'id':_0x29c830['id']};}));return WhatsappMessage[_0xf8ee('0x5')]({'where':{'WhatsappInteractionId':_0x543d32['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf8ee('0x6')](function(_0x54a3d9){_0x543d32[_0xf8ee('0x3')](_0xf8ee('0x7'),_0x54a3d9[_0xf8ee('0x8')]);WhatsappInteractionEvents[_0xf8ee('0x9')](_0x2da2b1+':'+_0x543d32['id'],_0x543d32);WhatsappInteractionEvents['emit'](_0x2da2b1,_0x543d32);_0x40bb87(null);})[_0xf8ee('0xa')](_0x40bb87(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xf8ee('0xb')](e,emitEvent(event));}}module[_0xf8ee('0xc')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f0333e3..a0f470c 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 _0x9646=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x9646,0xef));var _0x6964=function(_0xa9f50a,_0x1d3836){_0xa9f50a=_0xa9f50a-0x0;var _0x48d268=_0x9646[_0xa9f50a];return _0x48d268;};'use strict';var _=require(_0x6964('0x0'));var util=require('util');var logger=require(_0x6964('0x1'))('api');var moment=require(_0x6964('0x2'));var BPromise=require(_0x6964('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6964('0x4'));var rimraf=require(_0x6964('0x5'));var config=require(_0x6964('0x6'));var attributes=require(_0x6964('0x7'));module['exports']=function(_0x572207,_0x1f0ded){return _0x572207[_0x6964('0x8')](_0x6964('0x9'),attributes,{'tableName':_0x6964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x286172,_0x2ef4e8,_0x4ef5ec){if(_0x286172[_0x6964('0xb')]('closed')){_0x286172[_0x6964('0xc')]=moment()[_0x6964('0xd')](_0x6964('0xe'));}_0x4ef5ec(null,_0x286172);}}});}; \ No newline at end of file +var _0x3fbd=['rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path'];(function(_0x5ea991,_0xa14ccf){var _0x4b24db=function(_0x46e7c0){while(--_0x46e7c0){_0x5ea991['push'](_0x5ea991['shift']());}};_0x4b24db(++_0xa14ccf);}(_0x3fbd,0x15b));var _0xd3fb=function(_0x51be43,_0x53e510){_0x51be43=_0x51be43-0x0;var _0x3b2d83=_0x3fbd[_0x51be43];return _0x3b2d83;};'use strict';var _=require('lodash');var util=require(_0xd3fb('0x0'));var logger=require(_0xd3fb('0x1'))('api');var moment=require(_0xd3fb('0x2'));var BPromise=require(_0xd3fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3fb('0x4'));var rimraf=require(_0xd3fb('0x5'));var config=require(_0xd3fb('0x6'));var attributes=require(_0xd3fb('0x7'));module[_0xd3fb('0x8')]=function(_0x5b60ab,_0x4ab0d5){return _0x5b60ab[_0xd3fb('0x9')](_0xd3fb('0xa'),attributes,{'tableName':_0xd3fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xde1cec,_0x27d56b,_0x56b587){if(_0xde1cec[_0xd3fb('0xc')]('closed')){_0xde1cec[_0xd3fb('0xd')]=moment()[_0xd3fb('0xe')](_0xd3fb('0xf'));}_0x56b587(null,_0xde1cec);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c4c0347..3306c80 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 _0x5fac=['request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','WhatsappInteraction,\x20%s,\x20%s','message','info','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','raw','options','attributes','limit','stringify','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','then'];(function(_0x207aeb,_0x24980f){var _0x3fe650=function(_0x2e3333){while(--_0x2e3333){_0x207aeb['push'](_0x207aeb['shift']());}};_0x3fe650(++_0x24980f);}(_0x5fac,0x85));var _0xc5fa=function(_0x24c4f2,_0x4b93d8){_0x24c4f2=_0x24c4f2-0x0;var _0x1e5994=_0x5fac[_0x24c4f2];return _0x1e5994;};'use strict';var _=require(_0xc5fa('0x0'));var util=require(_0xc5fa('0x1'));var moment=require(_0xc5fa('0x2'));var BPromise=require(_0xc5fa('0x3'));var rs=require(_0xc5fa('0x4'));var fs=require('fs');var Redis=require(_0xc5fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc5fa('0x6'));var config=require(_0xc5fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5fa('0x8')][_0xc5fa('0x9')]({'port':0x232a});config[_0xc5fa('0xa')]=_[_0xc5fa('0xb')](config[_0xc5fa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5fa('0xc'))(new Redis(config[_0xc5fa('0xa')]));require('./whatsappInteraction.socket')[_0xc5fa('0xd')](socket);function respondWithRpcPromise(_0x3b24d7,_0x402322,_0xf13c02){return new BPromise(function(_0xa6559d,_0x44faf1){return client['request'](_0x3b24d7,_0xf13c02)[_0xc5fa('0xe')](function(_0x42ab3c){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x402322,_0xc5fa('0xf'));logger[_0xc5fa('0x10')](_0xc5fa('0x11'),_0x402322,_0xc5fa('0xf'),JSON['stringify'](_0x42ab3c));if(_0x42ab3c[_0xc5fa('0x12')]){if(_0x42ab3c[_0xc5fa('0x12')]['code']===0x1f4){logger['error'](_0xc5fa('0x13'),_0x402322,_0x42ab3c[_0xc5fa('0x12')][_0xc5fa('0x14')]);return _0x44faf1(_0x42ab3c['error']['message']);}logger[_0xc5fa('0x12')](_0xc5fa('0x13'),_0x402322,_0x42ab3c['error'][_0xc5fa('0x14')]);return _0xa6559d(_0x42ab3c[_0xc5fa('0x12')][_0xc5fa('0x14')]);}else{logger[_0xc5fa('0x15')](_0xc5fa('0x13'),_0x402322,'request\x20sent');_0xa6559d(_0x42ab3c['result']['message']);}})[_0xc5fa('0x16')](function(_0x35122e){logger[_0xc5fa('0x12')](_0xc5fa('0x13'),_0x402322,_0x35122e);_0x44faf1(_0x35122e);});});}exports[_0xc5fa('0x17')]=function(_0x25b92b){var _0x194dbb=this;return new Promise(function(_0x1f1c2b,_0x19be17){return db[_0xc5fa('0x18')]['update'](_0x25b92b[_0xc5fa('0x19')],{'raw':_0x25b92b['options']?_0x25b92b['options'][_0xc5fa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25b92b[_0xc5fa('0x1b')]?_0x25b92b[_0xc5fa('0x1b')]['where']||null:null,'attributes':_0x25b92b[_0xc5fa('0x1b')]?_0x25b92b[_0xc5fa('0x1b')][_0xc5fa('0x1c')]||null:null,'limit':_0x25b92b['options']?_0x25b92b[_0xc5fa('0x1b')][_0xc5fa('0x1d')]||null:null})[_0xc5fa('0xe')](function(_0x272042){logger[_0xc5fa('0x15')]('UpdateWhatsappInteraction',_0x25b92b);logger[_0xc5fa('0x10')](_0xc5fa('0x17'),_0x25b92b,JSON[_0xc5fa('0x1e')](_0x272042));_0x1f1c2b(_0x272042);})['catch'](function(_0x521ff0){logger[_0xc5fa('0x12')](_0xc5fa('0x17'),_0x521ff0[_0xc5fa('0x14')],_0x25b92b);_0x19be17(_0x194dbb[_0xc5fa('0x12')](0x1f4,_0x521ff0[_0xc5fa('0x14')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x576a81){return new Promise(function(_0x382b46,_0x3dcb37){return db['WhatsappInteraction'][_0xc5fa('0x1f')]({'where':_0x576a81[_0xc5fa('0x1b')]?_0x576a81[_0xc5fa('0x1b')][_0xc5fa('0x20')]||null:null})[_0xc5fa('0xe')](function(_0x447080){if(_0x447080){return _0x447080[_0xc5fa('0x21')](_0x576a81[_0xc5fa('0x19')][_0xc5fa('0x22')],_[_0xc5fa('0x23')](_0x576a81[_0xc5fa('0x19')],['ids','id'])||{});}})['spread'](function(_0x137fb5){logger[_0xc5fa('0x15')](_0xc5fa('0x24'),_0x576a81);logger[_0xc5fa('0x10')](_0xc5fa('0x24'),_0x576a81,JSON['stringify'](_0x137fb5));_0x382b46(_0x137fb5);})['catch'](function(_0x40bdde){logger[_0xc5fa('0x12')](_0xc5fa('0x24'),_0x40bdde[_0xc5fa('0x14')],_0x576a81);_0x3dcb37(_this[_0xc5fa('0x12')](0x1f4,_0x40bdde['message']));});});}; \ No newline at end of file +var _0x396d=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','stringify','AddTagsToWhatsappInteraction','find','ids','omit'];(function(_0x42446c,_0x106c25){var _0x29059d=function(_0x217ff2){while(--_0x217ff2){_0x42446c['push'](_0x42446c['shift']());}};_0x29059d(++_0x106c25);}(_0x396d,0x162));var _0xd396=function(_0x5eec0a,_0x5a7365){_0x5eec0a=_0x5eec0a-0x0;var _0x79539f=_0x396d[_0x5eec0a];return _0x79539f;};'use strict';var _=require(_0xd396('0x0'));var util=require(_0xd396('0x1'));var moment=require(_0xd396('0x2'));var BPromise=require(_0xd396('0x3'));var rs=require(_0xd396('0x4'));var fs=require('fs');var Redis=require(_0xd396('0x5'));var db=require(_0xd396('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd396('0x7'));var config=require(_0xd396('0x8'));var jayson=require(_0xd396('0x9'));var client=jayson[_0xd396('0xa')][_0xd396('0xb')]({'port':0x232a});config[_0xd396('0xc')]=_[_0xd396('0xd')](config[_0xd396('0xc')],{'host':_0xd396('0xe'),'port':0x18eb});var socket=require(_0xd396('0xf'))(new Redis(config[_0xd396('0xc')]));require('./whatsappInteraction.socket')[_0xd396('0x10')](socket);function respondWithRpcPromise(_0x1b59e0,_0x782a82,_0x59f1a9){return new BPromise(function(_0x1232d5,_0x1978f6){return client['request'](_0x1b59e0,_0x59f1a9)['then'](function(_0x4e4b23){logger[_0xd396('0x11')](_0xd396('0x12'),_0x782a82,_0xd396('0x13'));logger[_0xd396('0x14')](_0xd396('0x15'),_0x782a82,_0xd396('0x13'),JSON['stringify'](_0x4e4b23));if(_0x4e4b23['error']){if(_0x4e4b23[_0xd396('0x16')][_0xd396('0x17')]===0x1f4){logger[_0xd396('0x16')](_0xd396('0x12'),_0x782a82,_0x4e4b23[_0xd396('0x16')][_0xd396('0x18')]);return _0x1978f6(_0x4e4b23[_0xd396('0x16')]['message']);}logger[_0xd396('0x16')](_0xd396('0x12'),_0x782a82,_0x4e4b23['error']['message']);return _0x1232d5(_0x4e4b23[_0xd396('0x16')]['message']);}else{logger[_0xd396('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x782a82,_0xd396('0x13'));_0x1232d5(_0x4e4b23[_0xd396('0x19')]['message']);}})[_0xd396('0x1a')](function(_0x28112d){logger[_0xd396('0x16')](_0xd396('0x12'),_0x782a82,_0x28112d);_0x1978f6(_0x28112d);});});}exports[_0xd396('0x1b')]=function(_0x3233b3){var _0x60d5ff=this;return new Promise(function(_0x195190,_0x5ee0c4){return db[_0xd396('0x1c')][_0xd396('0x1d')](_0x3233b3[_0xd396('0x1e')],{'raw':_0x3233b3[_0xd396('0x1f')]?_0x3233b3['options'][_0xd396('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3233b3[_0xd396('0x1f')]?_0x3233b3[_0xd396('0x1f')][_0xd396('0x21')]||null:null,'attributes':_0x3233b3[_0xd396('0x1f')]?_0x3233b3[_0xd396('0x1f')][_0xd396('0x22')]||null:null,'limit':_0x3233b3[_0xd396('0x1f')]?_0x3233b3['options'][_0xd396('0x23')]||null:null})[_0xd396('0x24')](function(_0x25d955){logger[_0xd396('0x11')]('UpdateWhatsappInteraction',_0x3233b3);logger['debug'](_0xd396('0x1b'),_0x3233b3,JSON[_0xd396('0x25')](_0x25d955));_0x195190(_0x25d955);})[_0xd396('0x1a')](function(_0x11bf7e){logger[_0xd396('0x16')](_0xd396('0x1b'),_0x11bf7e[_0xd396('0x18')],_0x3233b3);_0x5ee0c4(_0x60d5ff[_0xd396('0x16')](0x1f4,_0x11bf7e[_0xd396('0x18')]));});});};exports[_0xd396('0x26')]=function(_0x101642){return new Promise(function(_0x5791f4,_0x4f5718){return db[_0xd396('0x1c')][_0xd396('0x27')]({'where':_0x101642[_0xd396('0x1f')]?_0x101642[_0xd396('0x1f')][_0xd396('0x21')]||null:null})[_0xd396('0x24')](function(_0x182ecc){if(_0x182ecc){return _0x182ecc['addTags'](_0x101642[_0xd396('0x1e')][_0xd396('0x28')],_[_0xd396('0x29')](_0x101642[_0xd396('0x1e')],[_0xd396('0x28'),'id'])||{});}})[_0xd396('0x2a')](function(_0x4edbef){logger[_0xd396('0x11')](_0xd396('0x2b'),_0x101642);logger[_0xd396('0x14')]('AddTags',_0x101642,JSON['stringify'](_0x4edbef));_0x5791f4(_0x4edbef);})['catch'](function(_0x2e1c12){logger[_0xd396('0x16')]('AddTags',_0x2e1c12[_0xd396('0x18')],_0x101642);_0x4f5718(_this[_0xd396('0x16')](0x1f4,_0x2e1c12[_0xd396('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index dab4cab..7d0e6e5 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 _0xda4b=['save','remove','update','emit','removeListener','register','length'];(function(_0xb78c3c,_0x2de1a3){var _0x392c07=function(_0x49ba24){while(--_0x49ba24){_0xb78c3c['push'](_0xb78c3c['shift']());}};_0x392c07(++_0x2de1a3);}(_0xda4b,0xa1));var _0xbda4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xda4b[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xbda4('0x0'),_0xbda4('0x1'),_0xbda4('0x2')];function createListener(_0x1706ec,_0x445bb1){return function(_0x57b062){_0x445bb1[_0xbda4('0x3')](_0x1706ec,_0x57b062);};}function removeListener(_0x204b1d,_0x1e08a2){return function(){WhatsappInteractionEvents[_0xbda4('0x4')](_0x204b1d,_0x1e08a2);};}exports[_0xbda4('0x5')]=function(_0x27ffe3){for(var _0x4854aa=0x0,_0x572729=events[_0xbda4('0x6')];_0x4854aa<_0x572729;_0x4854aa++){var _0x1de269=events[_0x4854aa];var _0x19b116=createListener('whatsappInteraction:'+_0x1de269,_0x27ffe3);WhatsappInteractionEvents['on'](_0x1de269,_0x19b116);}}; \ No newline at end of file +var _0x7570=['./whatsappInteraction.events','save','update','emit','removeListener','length','whatsappInteraction:'];(function(_0x2f2089,_0x160876){var _0x387737=function(_0xe92a9b){while(--_0xe92a9b){_0x2f2089['push'](_0x2f2089['shift']());}};_0x387737(++_0x160876);}(_0x7570,0xd2));var _0x0757=function(_0x333b10,_0x29c476){_0x333b10=_0x333b10-0x0;var _0x362cb2=_0x7570[_0x333b10];return _0x362cb2;};'use strict';var WhatsappInteractionEvents=require(_0x0757('0x0'));var events=[_0x0757('0x1'),'remove',_0x0757('0x2')];function createListener(_0x320360,_0x5c095c){return function(_0x579dc8){_0x5c095c[_0x0757('0x3')](_0x320360,_0x579dc8);};}function removeListener(_0x2008c6,_0x489061){return function(){WhatsappInteractionEvents[_0x0757('0x4')](_0x2008c6,_0x489061);};}exports['register']=function(_0x55d764){for(var _0x415663=0x0,_0x20c3d1=events[_0x0757('0x5')];_0x415663<_0x20c3d1;_0x415663++){var _0x1d021a=events[_0x415663];var _0x3bcea0=createListener(_0x0757('0x6')+_0x1d021a,_0x55d764);WhatsappInteractionEvents['on'](_0x1d021a,_0x3bcea0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ec6f6a2..e5592d7 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 _0xaf05=['util','path','Router','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x3e1e3d,_0x1cb9d0){var _0x191f84=function(_0x3d4e11){while(--_0x3d4e11){_0x3e1e3d['push'](_0x3e1e3d['shift']());}};_0x191f84(++_0x1cb9d0);}(_0xaf05,0x137));var _0x5af0=function(_0x5d24c7,_0x58637c){_0x5d24c7=_0x5d24c7-0x0;var _0x12fbe9=_0xaf05[_0x5d24c7];return _0x12fbe9;};'use strict';var multer=require(_0x5af0('0x0'));var util=require(_0x5af0('0x1'));var path=require(_0x5af0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5af0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5af0('0x4'));router[_0x5af0('0x5')]('/',auth[_0x5af0('0x6')](),controller[_0x5af0('0x7')]);router[_0x5af0('0x5')](_0x5af0('0x8'),auth[_0x5af0('0x6')](),controller[_0x5af0('0x9')]);router['get'](_0x5af0('0xa'),auth['isAuthenticated'](),controller[_0x5af0('0xb')]);router[_0x5af0('0xc')]('/',auth[_0x5af0('0x6')](),interaction[_0x5af0('0xd')](_0x5af0('0xe'),_0x5af0('0xf')),controller[_0x5af0('0x10')]);router[_0x5af0('0xc')]('/:id/status',controller[_0x5af0('0x11')]);router[_0x5af0('0x12')](_0x5af0('0xa'),auth[_0x5af0('0x6')](),controller[_0x5af0('0x13')]);router[_0x5af0('0x12')]('/:id/accept',auth[_0x5af0('0x6')](),controller[_0x5af0('0x14')]);router[_0x5af0('0x12')](_0x5af0('0x15'),auth[_0x5af0('0x6')](),controller[_0x5af0('0x16')]);router[_0x5af0('0x17')]('/:id',auth[_0x5af0('0x6')](),controller[_0x5af0('0x18')]);module[_0x5af0('0x19')]=router; \ No newline at end of file +var _0x21aa=['/:id/accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x21aa,0xba));var _0xa21a=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x21aa[_0x22cb5f];return _0x274d36;};'use strict';var multer=require(_0xa21a('0x0'));var util=require(_0xa21a('0x1'));var path=require(_0xa21a('0x2'));var timeout=require(_0xa21a('0x3'));var express=require(_0xa21a('0x4'));var router=express[_0xa21a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa21a('0x6'));var config=require(_0xa21a('0x7'));var controller=require('./whatsappMessage.controller');router[_0xa21a('0x8')]('/',auth[_0xa21a('0x9')](),controller[_0xa21a('0xa')]);router[_0xa21a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa21a('0xb')]);router[_0xa21a('0x8')](_0xa21a('0xc'),auth[_0xa21a('0x9')](),controller[_0xa21a('0xd')]);router[_0xa21a('0xe')]('/',auth[_0xa21a('0x9')](),interaction[_0xa21a('0xf')](_0xa21a('0x10'),_0xa21a('0x11')),controller['create']);router[_0xa21a('0xe')](_0xa21a('0x12'),controller[_0xa21a('0x13')]);router[_0xa21a('0x14')](_0xa21a('0xc'),auth['isAuthenticated'](),controller[_0xa21a('0x15')]);router[_0xa21a('0x14')](_0xa21a('0x16'),auth[_0xa21a('0x9')](),controller['accept']);router[_0xa21a('0x14')](_0xa21a('0x17'),auth[_0xa21a('0x9')](),controller[_0xa21a('0x18')]);router[_0xa21a('0x19')](_0xa21a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c179ba7..462d4d1 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 _0x5451=['DATE','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x1f808f,_0x172b10){var _0x282348=function(_0xfa8c2){while(--_0xfa8c2){_0x1f808f['push'](_0x1f808f['shift']());}};_0x282348(++_0x172b10);}(_0x5451,0x6a));var _0x1545=function(_0x213cdd,_0x33d515){_0x213cdd=_0x213cdd-0x0;var _0x153242=_0x5451[_0x213cdd];return _0x153242;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x1545('0x0')](_0x1545('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1545('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1545('0x3')]('in',_0x1545('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1545('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1545('0x5')]},'readAt':{'type':Sequelize[_0x1545('0x6')]},'secret':{'type':Sequelize[_0x1545('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe713=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x5e0e90,_0x1c8363){var _0x33cfe3=function(_0x44f842){while(--_0x44f842){_0x5e0e90['push'](_0x5e0e90['shift']());}};_0x33cfe3(++_0x1c8363);}(_0xe713,0x88));var _0x3e71=function(_0x3a37a3,_0x3a74e6){_0x3a37a3=_0x3a37a3-0x0;var _0x19434d=_0xe713[_0x3a37a3];return _0x19434d;};'use strict';var Sequelize=require(_0x3e71('0x0'));module[_0x3e71('0x1')]={'body':{'type':Sequelize[_0x3e71('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3e71('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e71('0x4')]('in',_0x3e71('0x5')),'defaultValue':_0x3e71('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3e71('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3e71('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3e71('0x6')]},'providerResponse':{'type':Sequelize[_0x3e71('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0e4c591..6d9d7f4 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 _0xdb28=['MessageSid','messageId','MessageStatus','inspect','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','limit','set','apply','destroy','name','send','index','map','WhatsappMessage','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','update','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','WhatsappInteractionId','null','RejectMessage','rejectMessage','interface','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0xdb28,0x106));var _0x8db2=function(_0x270fde,_0x5df3bd){_0x270fde=_0x270fde-0x0;var _0x1f51c0=_0xdb28[_0x270fde];return _0x1f51c0;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];config[_0x8db2('0x19')]=_[_0x8db2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8db2('0x1b'))(new Redis(config[_0x8db2('0x19')]));require(_0x8db2('0x1c'))[_0x8db2('0x1d')](socket);var jayson=require(_0x8db2('0x1e'));var client=jayson[_0x8db2('0x1f')][_0x8db2('0x20')]({'port':0x232c});var client9002=jayson[_0x8db2('0x1f')][_0x8db2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x16c8c2,_0x5489a9,_0x13b0f5,_0x24da1b){return new BPromise(function(_0x48101e,_0x2b3f73){var _0x44957d=_0x24da1b||client;return _0x44957d[_0x8db2('0x21')](_0x16c8c2,_0x13b0f5)[_0x8db2('0x22')](function(_0x2efd06){logger[_0x8db2('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5489a9,'request\x20sent');logger[_0x8db2('0x24')](_0x8db2('0x25'),_0x5489a9,_0x8db2('0x26'),JSON[_0x8db2('0x27')](_0x2efd06));if(_0x2efd06['error']){if(_0x2efd06[_0x8db2('0x28')][_0x8db2('0x29')]===0x1f4){logger[_0x8db2('0x28')](_0x8db2('0x2a'),_0x5489a9,_0x2efd06[_0x8db2('0x28')]['message']);return _0x2b3f73(_0x2efd06[_0x8db2('0x28')][_0x8db2('0x2b')]);}logger[_0x8db2('0x28')](_0x8db2('0x2a'),_0x5489a9,_0x2efd06[_0x8db2('0x28')][_0x8db2('0x2b')]);return _0x48101e(_0x2efd06[_0x8db2('0x28')]['message']);}else{logger[_0x8db2('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5489a9,'request\x20sent');_0x48101e(_0x2efd06['result']['message']);}})[_0x8db2('0x2c')](function(_0x29b5cd){logger[_0x8db2('0x28')](_0x8db2('0x2a'),_0x5489a9,_0x29b5cd);_0x2b3f73(_0x29b5cd);});});}function respondWithStatusCode(_0x145328,_0x8d4f54){_0x8d4f54=_0x8d4f54||0xcc;return function(_0x58cd9d){if(_0x58cd9d){return _0x145328[_0x8db2('0x2d')](_0x8d4f54);}return _0x145328[_0x8db2('0x2e')](_0x8d4f54)[_0x8db2('0x2f')]();};}function respondWithResult(_0x8b7cec,_0x483aee){_0x483aee=_0x483aee||0xc8;return function(_0x2e0691){if(_0x2e0691){return _0x8b7cec[_0x8db2('0x2e')](_0x483aee)[_0x8db2('0x30')](_0x2e0691);}};}function respondWithFilteredResult(_0x1687ed,_0xbe5ece){return function(_0x21bae5){if(_0x21bae5){var _0xa54ea3=_0x21bae5[_0x8db2('0x31')],_0x3124d5=_0xbe5ece['offset'],_0xbc5366=_0xbe5ece['offset']+_0xbe5ece[_0x8db2('0x32')],_0x493cab;if(_0xbc5366>=_0xa54ea3){_0xbc5366=_0xa54ea3;_0x493cab=0xc8;}else{_0x493cab=0xce;}_0x1687ed[_0x8db2('0x2e')](_0x493cab);return _0x1687ed[_0x8db2('0x33')]('Content-Range',_0x3124d5+'-'+_0xbc5366+'/'+_0xa54ea3)[_0x8db2('0x30')](_0x21bae5);}return null;};}function patchUpdates(_0x56b71a){return function(_0x3f7aac){try{jsonpatch[_0x8db2('0x34')](_0x3f7aac,_0x56b71a,!![]);}catch(_0x14bd12){return BPromise['reject'](_0x14bd12);}return _0x3f7aac['save']();};}function saveUpdates(_0x35d337,_0x1a460b){return function(_0x4df530){if(_0x4df530){return _0x4df530['update'](_0x35d337)[_0x8db2('0x22')](function(_0x5178f3){return _0x5178f3;});}return null;};}function removeEntity(_0xc884a,_0x2a2d65){return function(_0x17ad44){if(_0x17ad44){return _0x17ad44[_0x8db2('0x35')]()[_0x8db2('0x22')](function(){_0xc884a[_0x8db2('0x2e')](0xcc)[_0x8db2('0x2f')]();});}};}function handleEntityNotFound(_0x451c29,_0x502a02){return function(_0x1ab5eb){if(!_0x1ab5eb){_0x451c29[_0x8db2('0x2d')](0x194);}return _0x1ab5eb;};}function handleError(_0x5d2a5b,_0x41594c){_0x41594c=_0x41594c||0x1f4;return function(_0x3ca80b){logger['error'](_0x3ca80b['stack']);if(_0x3ca80b[_0x8db2('0x36')]){delete _0x3ca80b['name'];}_0x5d2a5b[_0x8db2('0x2e')](_0x41594c)[_0x8db2('0x37')](_0x3ca80b);};}exports[_0x8db2('0x38')]=function(_0x22c896,_0x5cc419){var _0x2d3e98={},_0x5e34e0={},_0x227a08={'count':0x0,'rows':[]};var _0xd550ae=_[_0x8db2('0x39')](db[_0x8db2('0x3a')]['rawAttributes'],function(_0x50ee17){return{'name':_0x50ee17[_0x8db2('0x3b')],'type':_0x50ee17[_0x8db2('0x3c')]['key']};});_0x5e34e0[_0x8db2('0x3d')]=_[_0x8db2('0x39')](_0xd550ae,_0x8db2('0x36'));_0x5e34e0['query']=_[_0x8db2('0x3e')](_0x22c896[_0x8db2('0x3f')]);_0x5e34e0[_0x8db2('0x40')]=_[_0x8db2('0x41')](_0x5e34e0[_0x8db2('0x3d')],_0x5e34e0[_0x8db2('0x3f')]);_0x2d3e98[_0x8db2('0x42')]=_[_0x8db2('0x41')](_0x5e34e0[_0x8db2('0x3d')],qs[_0x8db2('0x43')](_0x22c896[_0x8db2('0x3f')][_0x8db2('0x43')]));_0x2d3e98[_0x8db2('0x42')]=_0x2d3e98['attributes'][_0x8db2('0x44')]?_0x2d3e98[_0x8db2('0x42')]:_0x5e34e0['model'];if(!_0x22c896['query'][_0x8db2('0x45')]('nolimit')){_0x2d3e98[_0x8db2('0x32')]=qs[_0x8db2('0x32')](_0x22c896[_0x8db2('0x3f')][_0x8db2('0x32')]);_0x2d3e98[_0x8db2('0x46')]=qs[_0x8db2('0x46')](_0x22c896[_0x8db2('0x3f')]['offset']);}_0x2d3e98[_0x8db2('0x47')]=qs[_0x8db2('0x48')](_0x22c896[_0x8db2('0x3f')][_0x8db2('0x48')]);_0x2d3e98['where']=qs[_0x8db2('0x40')](_[_0x8db2('0x49')](_0x22c896[_0x8db2('0x3f')],_0x5e34e0[_0x8db2('0x40')]),_0xd550ae);if(_0x22c896['query'][_0x8db2('0x4a')]){_0x2d3e98['where']=_[_0x8db2('0x4b')](_0x2d3e98[_0x8db2('0x4c')],{'$or':_[_0x8db2('0x39')](_0xd550ae,function(_0x4d2164){if(_0x4d2164['type']!==_0x8db2('0x4d')){var _0x47c556={};_0x47c556[_0x4d2164[_0x8db2('0x36')]]={'$like':'%'+_0x22c896[_0x8db2('0x3f')][_0x8db2('0x4a')]+'%'};return _0x47c556;}})});}_0x2d3e98=_[_0x8db2('0x4b')]({},_0x2d3e98,_0x22c896[_0x8db2('0x4e')]);var _0x40c6e6={'where':_0x2d3e98[_0x8db2('0x4c')]};return db[_0x8db2('0x3a')][_0x8db2('0x31')](_0x40c6e6)[_0x8db2('0x22')](function(_0x1362ed){_0x227a08[_0x8db2('0x31')]=_0x1362ed;if(_0x22c896['query'][_0x8db2('0x4f')]){_0x2d3e98[_0x8db2('0x50')]=[{'all':!![]}];}return db[_0x8db2('0x3a')][_0x8db2('0x51')](_0x2d3e98);})['then'](function(_0x4ffd9d){_0x227a08[_0x8db2('0x52')]=_0x4ffd9d;return _0x227a08;})[_0x8db2('0x22')](respondWithFilteredResult(_0x5cc419,_0x2d3e98))[_0x8db2('0x2c')](handleError(_0x5cc419,null));};exports['show']=function(_0x540d90,_0x494d6e){var _0x44ac56={'raw':!![],'where':{'id':_0x540d90[_0x8db2('0x53')]['id']}},_0x368c37={};_0x368c37[_0x8db2('0x3d')]=_[_0x8db2('0x3e')](db[_0x8db2('0x3a')][_0x8db2('0x54')]);_0x368c37['query']=_['keys'](_0x540d90[_0x8db2('0x3f')]);_0x368c37[_0x8db2('0x40')]=_[_0x8db2('0x41')](_0x368c37[_0x8db2('0x3d')],_0x368c37[_0x8db2('0x3f')]);_0x44ac56[_0x8db2('0x42')]=_[_0x8db2('0x41')](_0x368c37[_0x8db2('0x3d')],qs[_0x8db2('0x43')](_0x540d90[_0x8db2('0x3f')][_0x8db2('0x43')]));_0x44ac56[_0x8db2('0x42')]=_0x44ac56[_0x8db2('0x42')][_0x8db2('0x44')]?_0x44ac56[_0x8db2('0x42')]:_0x368c37['model'];if(_0x540d90[_0x8db2('0x3f')][_0x8db2('0x4f')]){_0x44ac56['include']=[{'all':!![]}];}_0x44ac56=_[_0x8db2('0x4b')]({},_0x44ac56,_0x540d90[_0x8db2('0x4e')]);return db[_0x8db2('0x3a')]['find'](_0x44ac56)[_0x8db2('0x22')](handleEntityNotFound(_0x494d6e,null))[_0x8db2('0x22')](respondWithResult(_0x494d6e,null))[_0x8db2('0x2c')](handleError(_0x494d6e,null));};exports[_0x8db2('0x55')]=function(_0x1167d5,_0x50fab4){return db[_0x8db2('0x3a')][_0x8db2('0x55')](_0x1167d5[_0x8db2('0x56')],{})['then'](respondWithResult(_0x50fab4,0xc9))[_0x8db2('0x2c')](handleError(_0x50fab4,null));};exports[_0x8db2('0x57')]=function(_0x33dddd,_0x7b0de8){if(_0x33dddd[_0x8db2('0x56')]['id']){delete _0x33dddd[_0x8db2('0x56')]['id'];}return db[_0x8db2('0x3a')]['find']({'where':{'id':_0x33dddd[_0x8db2('0x53')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0x7b0de8,null))['then'](saveUpdates(_0x33dddd[_0x8db2('0x56')],null))[_0x8db2('0x22')](respondWithResult(_0x7b0de8,null))['catch'](handleError(_0x7b0de8,null));};exports[_0x8db2('0x35')]=function(_0x927c01,_0x63e8f7){return db[_0x8db2('0x3a')][_0x8db2('0x58')]({'where':{'id':_0x927c01[_0x8db2('0x53')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0x63e8f7,null))[_0x8db2('0x22')](removeEntity(_0x63e8f7,null))[_0x8db2('0x2c')](handleError(_0x63e8f7,null));};exports[_0x8db2('0x59')]=function(_0x12fd12,_0x447a47){return db[_0x8db2('0x3a')][_0x8db2('0x59')]()[_0x8db2('0x22')](respondWithResult(_0x447a47,null))[_0x8db2('0x2c')](handleError(_0x447a47,null));};var interaction_log=require('../../config/logger')(_0x8db2('0x5a'));exports[_0x8db2('0x5b')]=function(_0x44118a,_0xc27a7e,_0x349db0){var _0x53b2dc={'channel':_0x8db2('0x5c')};if(_0x44118a[_0x8db2('0x56')]['id']){delete _0x44118a[_0x8db2('0x56')]['id'];}_0x44118a[_0x8db2('0x56')][_0x8db2('0x5d')]=!![];_0x44118a[_0x8db2('0x56')][_0x8db2('0x5e')]=moment()[_0x8db2('0x5f')](_0x8db2('0x60'));_0x44118a[_0x8db2('0x56')][_0x8db2('0x61')]=_0x44118a[_0x8db2('0x56')][_0x8db2('0x61')]||_0x44118a[_0x8db2('0x62')]['id'];return db[_0x8db2('0x3a')][_0x8db2('0x58')]({'where':{'id':_0x44118a[_0x8db2('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x8db2('0x63')],'as':'Contact'}]})[_0x8db2('0x22')](handleEntityNotFound(_0xc27a7e,null))['then'](saveUpdates(_0x44118a[_0x8db2('0x56')],null))['then'](function(_0x3de11e){if(_0x3de11e){_0x53b2dc[_0x8db2('0x2b')]=_0x3de11e[_0x8db2('0x64')]({'plain':!![]});return db[_0x8db2('0x65')][_0x8db2('0x58')]({'where':{'id':_0x3de11e['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xc27a7e,null))[_0x8db2('0x22')](function(_0x42019e){if(_0x42019e){return _0x42019e[_0x8db2('0x57')]({'UserId':_0x44118a[_0x8db2('0x56')][_0x8db2('0x61')],'read1stAt':_[_0x8db2('0x66')](_0x42019e[_0x8db2('0x67')])?moment()[_0x8db2('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8db2('0x22')](function(_0x2fdb10){if(_0x2fdb10){_0x53b2dc[_0x8db2('0x68')]=_0x2fdb10[_0x8db2('0x64')]({'plain':!![]});interaction_log[_0x8db2('0x23')](_0x8db2('0x69'),_0x44118a[_0x8db2('0x62')]['id'],_0x44118a[_0x8db2('0x62')]['name'],_0x44118a['user'][_0x8db2('0x6a')],_0x53b2dc[_0x8db2('0x68')]['id'],_0x44118a[_0x8db2('0x56')]?JSON[_0x8db2('0x27')](_0x44118a[_0x8db2('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8db2('0x6b'),_0x53b2dc);}return null;})[_0x8db2('0x22')](function(_0x54f0d4){if(_0x54f0d4){if(_0x44118a[_0x8db2('0x56')][_0x8db2('0x6c')]){_0x53b2dc[_0x8db2('0x2b')]['interface']=util[_0x8db2('0x5f')](_0x8db2('0x6d'),_0x44118a[_0x8db2('0x62')]['name']);_0x53b2dc[_0x8db2('0x2b')][_0x8db2('0x6e')]=_0x53b2dc[_0x8db2('0x6e')];_0x53b2dc[_0x8db2('0x2b')][_0x8db2('0x6f')]='accept';return respondWithRpcPromise(_0x8db2('0x70'),_0x8db2('0x70'),{'event':_0x8db2('0x71'),'message':_0x53b2dc['message']},client9002)['then'](function(){return _0x53b2dc;});}return _0x53b2dc;}return null;})[_0x8db2('0x22')](respondWithResult(_0xc27a7e,null))[_0x8db2('0x2c')](handleError(_0xc27a7e,null));};var interaction_log=require('../../config/logger')(_0x8db2('0x5a'));exports[_0x8db2('0x72')]=function(_0x199687,_0x3416de,_0xbf1fce){var _0x16848b={'agent':{},'channel':_0x8db2('0x5c')};if(_0x199687[_0x8db2('0x56')]['id']){delete _0x199687[_0x8db2('0x56')]['id'];}_0x199687[_0x8db2('0x56')][_0x8db2('0x61')]=_0x199687[_0x8db2('0x56')][_0x8db2('0x61')]||_0x199687['user']['id'];_0x16848b[_0x8db2('0x73')]['id']=_0x199687['body'][_0x8db2('0x61')];return db[_0x8db2('0x3a')]['find']({'where':{'id':_0x199687[_0x8db2('0x53')]['id'],'UserId':null}})[_0x8db2('0x22')](handleEntityNotFound(_0x3416de,null))['then'](function(_0x2159c4){if(_0x2159c4){_0x16848b[_0x8db2('0x2b')]=_0x2159c4[_0x8db2('0x64')]({'plain':!![]});return db[_0x8db2('0x65')][_0x8db2('0x58')]({'where':{'id':_0x2159c4[_0x8db2('0x74')]}});}return null;})[_0x8db2('0x22')](handleEntityNotFound(_0x3416de,null))[_0x8db2('0x22')](function(_0x1afd36){if(_0x1afd36){_0x16848b['interaction']=_0x1afd36['get']({'plain':!![]});interaction_log[_0x8db2('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x199687[_0x8db2('0x62')]['id'],_0x199687[_0x8db2('0x62')][_0x8db2('0x36')],_0x199687['user'][_0x8db2('0x6a')],_0x16848b[_0x8db2('0x68')]['id'],_0x199687[_0x8db2('0x56')]?JSON['stringify'](_0x199687[_0x8db2('0x56')]):_0x8db2('0x75'));return respondWithRpcPromise(_0x8db2('0x76'),_0x8db2('0x77'),_0x16848b);}return null;})['then'](function(_0x440824){if(_0x440824){_0x440824[_0x8db2('0x2b')][_0x8db2('0x78')]=util[_0x8db2('0x5f')](_0x8db2('0x6d'),_0x199687[_0x8db2('0x62')][_0x8db2('0x36')]);_0x440824[_0x8db2('0x2b')][_0x8db2('0x6e')]=_0x16848b[_0x8db2('0x6e')];_0x440824[_0x8db2('0x2b')]['event']=_0x8db2('0x72');respondWithRpcPromise(_0x8db2('0x70'),_0x8db2('0x70'),{'event':'rejectmessage','message':_0x440824['message']},client9002);return _0x16848b;}return null;})['then'](respondWithResult(_0x3416de,null))[_0x8db2('0x2c')](handleError(_0x3416de,null));};exports[_0x8db2('0x2e')]=function(_0x3191c8,_0x454377,_0x2ad024){if(_0x3191c8[_0x8db2('0x56')]['id']){delete _0x3191c8[_0x8db2('0x56')]['id'];}var _0x3c2d3c;return db[_0x8db2('0x3a')][_0x8db2('0x58')]({'where':{'id':_0x3191c8[_0x8db2('0x53')]['id']}})['then'](handleEntityNotFound(_0x454377,null))[_0x8db2('0x22')](function(_0xa2e293){if(_0xa2e293){_0x3c2d3c=_0xa2e293;return db[_0x8db2('0x79')][_0x8db2('0x58')]({'where':{'id':_0xa2e293['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x454377,null))[_0x8db2('0x22')](function(_0x3c3f3e){if(_0x3c3f3e){logger['debug'](_0x8db2('0x7a'),_0x8db2('0x2e'),_0x8db2('0x7b'),_0x3c3f3e['type'],util['inspect'](_0x3191c8['body'],{'showHidden':![],'depth':null}));switch(_0x3c3f3e[_0x8db2('0x3c')]){case _0x8db2('0x7c'):if(_0x3191c8[_0x8db2('0x56')][_0x8db2('0x7d')]&&_0x3191c8[_0x8db2('0x56')]['MessageSid']===_0x3c2d3c[_0x8db2('0x7e')]&&_0x3191c8['body'][_0x8db2('0x7f')]&&_0x3191c8[_0x8db2('0x56')][_0x8db2('0x7f')]===_0x8db2('0x5d')){return _0x3c2d3c[_0x8db2('0x57')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8db2('0x2e'),'twilio',util[_0x8db2('0x80')](_0x3191c8[_0x8db2('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3c2d3c;}})[_0x8db2('0x22')](respondWithResult(_0x454377,null))[_0x8db2('0x2c')](handleError(_0x454377,null));}; \ No newline at end of file +var _0x0295=['to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','acceptmessage','../../config/logger','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','update','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x4d765c,_0x1d876a){var _0x351ed8=function(_0xa8996c){while(--_0xa8996c){_0x4d765c['push'](_0x4d765c['shift']());}};_0x351ed8(++_0x1d876a);}(_0x0295,0x1f0));var _0x5029=function(_0x295b1a,_0x1e31a){_0x295b1a=_0x295b1a-0x0;var _0x2bb42b=_0x0295[_0x295b1a];return _0x2bb42b;};'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'];config[_0x5029('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5029('0x15')]));require(_0x5029('0x16'))[_0x5029('0x17')](socket);var jayson=require(_0x5029('0x18'));var client=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232c});var client9002=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10bf55,_0x326923,_0x457c73,_0x353cba){return new BPromise(function(_0x3786b5,_0x2c273c){var _0x343918=_0x353cba||client;return _0x343918['request'](_0x10bf55,_0x457c73)[_0x5029('0x1b')](function(_0x31a155){logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x326923,_0x5029('0x1e'));logger[_0x5029('0x1f')](_0x5029('0x20'),_0x326923,'request\x20sent',JSON[_0x5029('0x21')](_0x31a155));if(_0x31a155['error']){if(_0x31a155[_0x5029('0x22')][_0x5029('0x23')]===0x1f4){logger[_0x5029('0x22')](_0x5029('0x1d'),_0x326923,_0x31a155['error']['message']);return _0x2c273c(_0x31a155[_0x5029('0x22')]['message']);}logger[_0x5029('0x22')](_0x5029('0x1d'),_0x326923,_0x31a155[_0x5029('0x22')][_0x5029('0x24')]);return _0x3786b5(_0x31a155[_0x5029('0x22')][_0x5029('0x24')]);}else{logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x326923,_0x5029('0x1e'));_0x3786b5(_0x31a155['result']['message']);}})['catch'](function(_0x588d90){logger[_0x5029('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x326923,_0x588d90);_0x2c273c(_0x588d90);});});}function respondWithStatusCode(_0x5727e9,_0x181da0){_0x181da0=_0x181da0||0xcc;return function(_0x1e7e61){if(_0x1e7e61){return _0x5727e9[_0x5029('0x25')](_0x181da0);}return _0x5727e9['status'](_0x181da0)[_0x5029('0x26')]();};}function respondWithResult(_0xb14bc,_0x5e45c4){_0x5e45c4=_0x5e45c4||0xc8;return function(_0x2b6d99){if(_0x2b6d99){return _0xb14bc[_0x5029('0x27')](_0x5e45c4)[_0x5029('0x28')](_0x2b6d99);}};}function respondWithFilteredResult(_0x4a24b9,_0x32da06){return function(_0x251f99){if(_0x251f99){var _0xe5313e=_0x251f99['count'],_0x4b6f92=_0x32da06[_0x5029('0x29')],_0x2cedf6=_0x32da06[_0x5029('0x29')]+_0x32da06[_0x5029('0x2a')],_0x2bb398;if(_0x2cedf6>=_0xe5313e){_0x2cedf6=_0xe5313e;_0x2bb398=0xc8;}else{_0x2bb398=0xce;}_0x4a24b9[_0x5029('0x27')](_0x2bb398);return _0x4a24b9[_0x5029('0x2b')](_0x5029('0x2c'),_0x4b6f92+'-'+_0x2cedf6+'/'+_0xe5313e)[_0x5029('0x28')](_0x251f99);}return null;};}function patchUpdates(_0x465153){return function(_0x250156){try{jsonpatch[_0x5029('0x2d')](_0x250156,_0x465153,!![]);}catch(_0x358a2b){return BPromise[_0x5029('0x2e')](_0x358a2b);}return _0x250156['save']();};}function saveUpdates(_0x11ae38,_0x5cb04b){return function(_0x31c621){if(_0x31c621){return _0x31c621['update'](_0x11ae38)['then'](function(_0x2bc434){return _0x2bc434;});}return null;};}function removeEntity(_0x447680,_0x1f9173){return function(_0x4b7330){if(_0x4b7330){return _0x4b7330[_0x5029('0x2f')]()[_0x5029('0x1b')](function(){_0x447680[_0x5029('0x27')](0xcc)[_0x5029('0x26')]();});}};}function handleEntityNotFound(_0x1bb896,_0x4513b9){return function(_0x46ec59){if(!_0x46ec59){_0x1bb896[_0x5029('0x25')](0x194);}return _0x46ec59;};}function handleError(_0x456cfc,_0x5c9f10){_0x5c9f10=_0x5c9f10||0x1f4;return function(_0x1db45c){logger[_0x5029('0x22')](_0x1db45c[_0x5029('0x30')]);if(_0x1db45c[_0x5029('0x31')]){delete _0x1db45c['name'];}_0x456cfc[_0x5029('0x27')](_0x5c9f10)[_0x5029('0x32')](_0x1db45c);};}exports[_0x5029('0x33')]=function(_0x594549,_0x4904cc){var _0x2d1ccb={},_0x17756b={},_0x507443={'count':0x0,'rows':[]};var _0x57784c=_[_0x5029('0x34')](db[_0x5029('0x35')][_0x5029('0x36')],function(_0x3210cb){return{'name':_0x3210cb[_0x5029('0x37')],'type':_0x3210cb[_0x5029('0x38')][_0x5029('0x39')]};});_0x17756b[_0x5029('0x3a')]=_[_0x5029('0x34')](_0x57784c,_0x5029('0x31'));_0x17756b[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x594549[_0x5029('0x3b')]);_0x17756b[_0x5029('0x3d')]=_['intersection'](_0x17756b['model'],_0x17756b[_0x5029('0x3b')]);_0x2d1ccb[_0x5029('0x3e')]=_[_0x5029('0x3f')](_0x17756b['model'],qs[_0x5029('0x40')](_0x594549[_0x5029('0x3b')]['fields']));_0x2d1ccb[_0x5029('0x3e')]=_0x2d1ccb['attributes'][_0x5029('0x41')]?_0x2d1ccb['attributes']:_0x17756b[_0x5029('0x3a')];if(!_0x594549[_0x5029('0x3b')][_0x5029('0x42')](_0x5029('0x43'))){_0x2d1ccb[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x594549[_0x5029('0x3b')][_0x5029('0x2a')]);_0x2d1ccb[_0x5029('0x29')]=qs['offset'](_0x594549[_0x5029('0x3b')][_0x5029('0x29')]);}_0x2d1ccb[_0x5029('0x44')]=qs[_0x5029('0x45')](_0x594549[_0x5029('0x3b')][_0x5029('0x45')]);_0x2d1ccb['where']=qs[_0x5029('0x3d')](_[_0x5029('0x46')](_0x594549[_0x5029('0x3b')],_0x17756b[_0x5029('0x3d')]),_0x57784c);if(_0x594549[_0x5029('0x3b')]['filter']){_0x2d1ccb[_0x5029('0x47')]=_[_0x5029('0x48')](_0x2d1ccb[_0x5029('0x47')],{'$or':_[_0x5029('0x34')](_0x57784c,function(_0xfbfbb2){if(_0xfbfbb2[_0x5029('0x38')]!==_0x5029('0x49')){var _0x37660b={};_0x37660b[_0xfbfbb2[_0x5029('0x31')]]={'$like':'%'+_0x594549['query'][_0x5029('0x4a')]+'%'};return _0x37660b;}})});}_0x2d1ccb=_[_0x5029('0x48')]({},_0x2d1ccb,_0x594549[_0x5029('0x4b')]);var _0xdb3e78={'where':_0x2d1ccb['where']};return db['WhatsappMessage'][_0x5029('0x4c')](_0xdb3e78)[_0x5029('0x1b')](function(_0x2a07d4){_0x507443[_0x5029('0x4c')]=_0x2a07d4;if(_0x594549[_0x5029('0x3b')][_0x5029('0x4d')]){_0x2d1ccb[_0x5029('0x4e')]=[{'all':!![]}];}return db[_0x5029('0x35')][_0x5029('0x4f')](_0x2d1ccb);})[_0x5029('0x1b')](function(_0x2c2e0e){_0x507443[_0x5029('0x50')]=_0x2c2e0e;return _0x507443;})[_0x5029('0x1b')](respondWithFilteredResult(_0x4904cc,_0x2d1ccb))[_0x5029('0x51')](handleError(_0x4904cc,null));};exports[_0x5029('0x52')]=function(_0x175cc0,_0x10fc07){var _0x149cf6={'raw':!![],'where':{'id':_0x175cc0[_0x5029('0x53')]['id']}},_0x274beb={};_0x274beb[_0x5029('0x3a')]=_['keys'](db[_0x5029('0x35')]['rawAttributes']);_0x274beb[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x175cc0['query']);_0x274beb['filters']=_[_0x5029('0x3f')](_0x274beb['model'],_0x274beb['query']);_0x149cf6[_0x5029('0x3e')]=_[_0x5029('0x3f')](_0x274beb[_0x5029('0x3a')],qs['fields'](_0x175cc0['query'][_0x5029('0x40')]));_0x149cf6[_0x5029('0x3e')]=_0x149cf6['attributes'][_0x5029('0x41')]?_0x149cf6['attributes']:_0x274beb[_0x5029('0x3a')];if(_0x175cc0['query'][_0x5029('0x4d')]){_0x149cf6[_0x5029('0x4e')]=[{'all':!![]}];}_0x149cf6=_[_0x5029('0x48')]({},_0x149cf6,_0x175cc0[_0x5029('0x4b')]);return db[_0x5029('0x35')][_0x5029('0x54')](_0x149cf6)[_0x5029('0x1b')](handleEntityNotFound(_0x10fc07,null))[_0x5029('0x1b')](respondWithResult(_0x10fc07,null))['catch'](handleError(_0x10fc07,null));};exports[_0x5029('0x55')]=function(_0x5dd466,_0xc8b556){return db[_0x5029('0x35')]['create'](_0x5dd466[_0x5029('0x56')],{})['then'](respondWithResult(_0xc8b556,0xc9))['catch'](handleError(_0xc8b556,null));};exports['update']=function(_0x34e93a,_0x4b0c5f){if(_0x34e93a[_0x5029('0x56')]['id']){delete _0x34e93a[_0x5029('0x56')]['id'];}return db[_0x5029('0x35')]['find']({'where':{'id':_0x34e93a[_0x5029('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b0c5f,null))['then'](saveUpdates(_0x34e93a[_0x5029('0x56')],null))[_0x5029('0x1b')](respondWithResult(_0x4b0c5f,null))[_0x5029('0x51')](handleError(_0x4b0c5f,null));};exports[_0x5029('0x2f')]=function(_0x164179,_0x4e8d9f){return db[_0x5029('0x35')][_0x5029('0x54')]({'where':{'id':_0x164179[_0x5029('0x53')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x4e8d9f,null))['then'](removeEntity(_0x4e8d9f,null))[_0x5029('0x51')](handleError(_0x4e8d9f,null));};exports[_0x5029('0x57')]=function(_0x4d4a2d,_0x512de9){return db[_0x5029('0x35')][_0x5029('0x57')]()[_0x5029('0x1b')](respondWithResult(_0x512de9,null))[_0x5029('0x51')](handleError(_0x512de9,null));};var interaction_log=require('../../config/logger')(_0x5029('0x58'));exports[_0x5029('0x59')]=function(_0x77d63d,_0x2aebb3,_0x3a82f7){var _0x26f56f={'channel':'whatsapp'};if(_0x77d63d['body']['id']){delete _0x77d63d[_0x5029('0x56')]['id'];}_0x77d63d[_0x5029('0x56')][_0x5029('0x5a')]=!![];_0x77d63d['body'][_0x5029('0x5b')]=moment()[_0x5029('0x5c')](_0x5029('0x5d'));_0x77d63d[_0x5029('0x56')][_0x5029('0x5e')]=_0x77d63d['body'][_0x5029('0x5e')]||_0x77d63d[_0x5029('0x5f')]['id'];return db[_0x5029('0x35')]['find']({'where':{'id':_0x77d63d[_0x5029('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5029('0x60')}]})['then'](handleEntityNotFound(_0x2aebb3,null))[_0x5029('0x1b')](saveUpdates(_0x77d63d[_0x5029('0x56')],null))[_0x5029('0x1b')](function(_0x2f5301){if(_0x2f5301){_0x26f56f[_0x5029('0x24')]=_0x2f5301[_0x5029('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5029('0x54')]({'where':{'id':_0x2f5301[_0x5029('0x62')]}});}return null;})[_0x5029('0x1b')](handleEntityNotFound(_0x2aebb3,null))[_0x5029('0x1b')](function(_0x389700){if(_0x389700){return _0x389700['update']({'UserId':_0x77d63d[_0x5029('0x56')]['UserId'],'read1stAt':_[_0x5029('0x63')](_0x389700['read1stAt'])?moment()[_0x5029('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5029('0x1b')](function(_0x54daf9){if(_0x54daf9){_0x26f56f['interaction']=_0x54daf9[_0x5029('0x61')]({'plain':!![]});interaction_log['info'](_0x5029('0x64'),_0x77d63d[_0x5029('0x5f')]['id'],_0x77d63d[_0x5029('0x5f')]['name'],_0x77d63d[_0x5029('0x5f')]['role'],_0x26f56f[_0x5029('0x65')]['id'],_0x77d63d[_0x5029('0x56')]?JSON[_0x5029('0x21')](_0x77d63d[_0x5029('0x56')]):_0x5029('0x66'));return respondWithRpcPromise('AcceptMessage',_0x5029('0x67'),_0x26f56f);}return null;})[_0x5029('0x1b')](function(_0x5890ac){if(_0x5890ac){if(_0x77d63d[_0x5029('0x56')][_0x5029('0x68')]){_0x26f56f[_0x5029('0x24')][_0x5029('0x69')]=util[_0x5029('0x5c')](_0x5029('0x6a'),_0x77d63d['user']['name']);_0x26f56f[_0x5029('0x24')]['channel']=_0x26f56f[_0x5029('0x6b')];_0x26f56f[_0x5029('0x24')]['event']=_0x5029('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x5029('0x6c'),'message':_0x26f56f[_0x5029('0x24')]},client9002)[_0x5029('0x1b')](function(){return _0x26f56f;});}return _0x26f56f;}return null;})[_0x5029('0x1b')](respondWithResult(_0x2aebb3,null))['catch'](handleError(_0x2aebb3,null));};var interaction_log=require(_0x5029('0x6d'))(_0x5029('0x58'));exports['reject']=function(_0x269406,_0x73c036,_0x49e198){var _0x5b25b8={'agent':{},'channel':'whatsapp'};if(_0x269406[_0x5029('0x56')]['id']){delete _0x269406[_0x5029('0x56')]['id'];}_0x269406[_0x5029('0x56')][_0x5029('0x5e')]=_0x269406[_0x5029('0x56')][_0x5029('0x5e')]||_0x269406[_0x5029('0x5f')]['id'];_0x5b25b8[_0x5029('0x6e')]['id']=_0x269406[_0x5029('0x56')]['UserId'];return db['WhatsappMessage'][_0x5029('0x54')]({'where':{'id':_0x269406[_0x5029('0x53')]['id'],'UserId':null}})[_0x5029('0x1b')](handleEntityNotFound(_0x73c036,null))[_0x5029('0x1b')](function(_0x2d8c9a){if(_0x2d8c9a){_0x5b25b8[_0x5029('0x24')]=_0x2d8c9a[_0x5029('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5029('0x54')]({'where':{'id':_0x2d8c9a[_0x5029('0x62')]}});}return null;})[_0x5029('0x1b')](handleEntityNotFound(_0x73c036,null))['then'](function(_0x3bf700){if(_0x3bf700){_0x5b25b8[_0x5029('0x65')]=_0x3bf700[_0x5029('0x61')]({'plain':!![]});interaction_log['info'](_0x5029('0x6f'),_0x269406[_0x5029('0x5f')]['id'],_0x269406[_0x5029('0x5f')]['name'],_0x269406[_0x5029('0x5f')][_0x5029('0x70')],_0x5b25b8['interaction']['id'],_0x269406[_0x5029('0x56')]?JSON[_0x5029('0x21')](_0x269406[_0x5029('0x56')]):_0x5029('0x66'));return respondWithRpcPromise(_0x5029('0x71'),'rejectMessage',_0x5b25b8);}return null;})[_0x5029('0x1b')](function(_0x3b6833){if(_0x3b6833){_0x3b6833[_0x5029('0x24')][_0x5029('0x69')]=util[_0x5029('0x5c')]('SIP/%s',_0x269406[_0x5029('0x5f')][_0x5029('0x31')]);_0x3b6833[_0x5029('0x24')]['channel']=_0x5b25b8[_0x5029('0x6b')];_0x3b6833[_0x5029('0x24')][_0x5029('0x72')]=_0x5029('0x2e');respondWithRpcPromise(_0x5029('0x73'),_0x5029('0x73'),{'event':_0x5029('0x74'),'message':_0x3b6833['message']},client9002);return _0x5b25b8;}return null;})[_0x5029('0x1b')](respondWithResult(_0x73c036,null))[_0x5029('0x51')](handleError(_0x73c036,null));};exports[_0x5029('0x27')]=function(_0xde6006,_0x2dcfee,_0x4c40d1){if(_0xde6006[_0x5029('0x56')]['id']){delete _0xde6006[_0x5029('0x56')]['id'];}var _0x389931;return db['WhatsappMessage'][_0x5029('0x54')]({'where':{'id':_0xde6006[_0x5029('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dcfee,null))['then'](function(_0x524825){if(_0x524825){_0x389931=_0x524825;return db[_0x5029('0x75')][_0x5029('0x54')]({'where':{'id':_0x524825[_0x5029('0x76')]}});}})[_0x5029('0x1b')](handleEntityNotFound(_0x2dcfee,null))[_0x5029('0x1b')](function(_0x4c742f){if(_0x4c742f){logger[_0x5029('0x1f')](_0x5029('0x77'),_0x5029('0x27'),'received\x20delivery\x20report\x20from',_0x4c742f['type'],util[_0x5029('0x78')](_0xde6006[_0x5029('0x56')],{'showHidden':![],'depth':null}));switch(_0x4c742f[_0x5029('0x38')]){case _0x5029('0x79'):if(_0xde6006['body'][_0x5029('0x7a')]&&_0xde6006[_0x5029('0x56')][_0x5029('0x7a')]===_0x389931[_0x5029('0x7b')]&&_0xde6006[_0x5029('0x56')][_0x5029('0x7c')]&&_0xde6006[_0x5029('0x56')][_0x5029('0x7c')]==='read'){return _0x389931[_0x5029('0x7d')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5029('0x27'),'twilio',util[_0x5029('0x78')](_0xde6006[_0x5029('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x389931;}})[_0x5029('0x1b')](respondWithResult(_0x2dcfee,null))[_0x5029('0x51')](handleError(_0x2dcfee,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 754dec0..7ea2b20 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x351a5c,_0xf2e6bd){var _0x257a3b=function(_0xb478f0){while(--_0xb478f0){_0x351a5c['push'](_0x351a5c['shift']());}};_0x257a3b(++_0xf2e6bd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x454ea3,_0xc74a1c){_0x454ea3=_0x454ea3-0x0;var _0x5ad18a=_0x5f2f[_0x454ea3];return _0x5ad18a;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4ca01f,_0x57c5f9){var _0x5b83f1=function(_0x2ee3bb){while(--_0x2ee3bb){_0x4ca01f['push'](_0x4ca01f['shift']());}};_0x5b83f1(++_0x57c5f9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49fba6,_0x3789d5){_0x49fba6=_0x49fba6-0x0;var _0x2ccc8c=_0x5f2f[_0x49fba6];return _0x2ccc8c;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index b38926f..3518054 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 _0xcebb=['fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','out','WhatsappAccount','find','WhatsappAccountId','twilio','authToken','accountSid','messages','create','body','whatsapp:','phone','remote','/status?token=','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId'];(function(_0x2193b8,_0x3778f6){var _0x1da0a4=function(_0x5940ca){while(--_0x5940ca){_0x2193b8['push'](_0x2193b8['shift']());}};_0x1da0a4(++_0x3778f6);}(_0xcebb,0xc0));var _0xbceb=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xcebb[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0xbceb('0x0'));var logger=require('../../config/logger')(_0xbceb('0x1'));var moment=require(_0xbceb('0x2'));var BPromise=require(_0xbceb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbceb('0x4'));var rimraf=require(_0xbceb('0x5'));var config=require(_0xbceb('0x6'));var attributes=require(_0xbceb('0x7'));module[_0xbceb('0x8')]=function(_0x1b5edf,_0x926554){return _0x1b5edf[_0xbceb('0x9')]('WhatsappMessage',attributes,{'tableName':_0xbceb('0xa'),'paranoid':![],'indexes':[{'name':_0xbceb('0xb'),'fields':[_0xbceb('0xb')]},{'name':_0xbceb('0xc'),'fields':['body'],'type':_0xbceb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27a027,_0x1e01e0,_0x19df0e){var _0x478150=_0x1b5edf[_0xbceb('0xe')];var _0x5821a9=_0x27a027[_0xbceb('0xf')]({'plain':!![]});if(_0x5821a9[_0xbceb('0x10')][_0xbceb('0x11')]()==='in'||_0x5821a9[_0xbceb('0x10')][_0xbceb('0x11')]()==='out'&&!_0x5821a9[_0xbceb('0x12')]&&!_[_0xbceb('0x13')](_0x5821a9[_0xbceb('0x14')])){_0x478150[_0xbceb('0x15')][_0xbceb('0x16')]({'where':{'id':_0x5821a9[_0xbceb('0x17')]}})[_0xbceb('0x18')](function(_0x3b75ea){if(_0x3b75ea){_0x3b75ea[_0xbceb('0x19')]({'lastMsgAt':_0x5821a9[_0xbceb('0x1a')],'lastMsgDirection':_0x5821a9[_0xbceb('0x10')][_0xbceb('0x11')]()});}})['catch'](function(_0x96e800){console[_0xbceb('0x1b')](_0x96e800);});}if(_0x5821a9['direction']===_0xbceb('0x1c')&&!_0x5821a9[_0xbceb('0x12')]){var _0x30c112;_0x478150[_0xbceb('0x1d')][_0xbceb('0x1e')]({'where':{'id':_0x5821a9[_0xbceb('0x1f')]},'raw':!![]})[_0xbceb('0x18')](function(_0x3ed489){_0x30c112=_0x3ed489;if(_0x30c112&&_0x30c112['type']){switch(_0x30c112['type']){case _0xbceb('0x20'):var _0x11269e=require('twilio');if(_0x30c112['accountSid']&&_0x30c112[_0xbceb('0x21')]&&_0x30c112['phone']){var _0x9fcd66=new _0x11269e(_0x30c112[_0xbceb('0x22')],_0x30c112[_0xbceb('0x21')]);_0x9fcd66[_0xbceb('0x23')][_0xbceb('0x24')]({'body':_0x5821a9[_0xbceb('0x25')],'to':_0xbceb('0x26')+_0x5821a9[_0xbceb('0x27')],'from':_0xbceb('0x26')+_0x30c112[_0xbceb('0x27')],'statusCallback':_0x30c112[_0xbceb('0x28')]+'/api/whatsapp/messages/'+_0x5821a9['id']+_0xbceb('0x29')+_0x30c112[_0xbceb('0x2a')]})[_0xbceb('0x18')](function(_0x310e13){if(_0x310e13[_0xbceb('0x2b')]){return _0x27a027[_0xbceb('0x19')]({'messageId':_0x310e13[_0xbceb('0x2b')]});}})[_0xbceb('0x2c')](function(_0xbc45f7){logger[_0xbceb('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xbceb('0x2d'),_0xbceb('0x20'),util[_0xbceb('0x2e')](_0xbc45f7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbceb('0x2f'),'afterCreate','twilio',_0xbceb('0x30'));}break;}}})[_0xbceb('0x31')](function(){_0x19df0e();});}else{_0x19df0e();}}},'charset':'utf8mb4','collate':_0xbceb('0x32')});}; \ No newline at end of file +var _0x424a=['toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','direction','secret','WhatsappAccountId','type','twilio','accountSid','authToken','messages','phone','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT'];(function(_0x42420d,_0x12481d){var _0x31a5ea=function(_0x1e24f9){while(--_0x1e24f9){_0x42420d['push'](_0x42420d['shift']());}};_0x31a5ea(++_0x12481d);}(_0x424a,0x1e0));var _0xa424=function(_0x47500b,_0x302762){_0x47500b=_0x47500b-0x0;var _0x492943=_0x424a[_0x47500b];return _0x492943;};'use strict';var _=require(_0xa424('0x0'));var util=require(_0xa424('0x1'));var logger=require(_0xa424('0x2'))('api');var moment=require(_0xa424('0x3'));var BPromise=require('bluebird');var rp=require(_0xa424('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa424('0x5'));var config=require(_0xa424('0x6'));var attributes=require(_0xa424('0x7'));module[_0xa424('0x8')]=function(_0x28af2e,_0x463446){return _0x28af2e['define'](_0xa424('0x9'),attributes,{'tableName':_0xa424('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa424('0xb')]},{'name':_0xa424('0xc'),'fields':[_0xa424('0xd')],'type':_0xa424('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xff7859,_0xd3da7e,_0x14329e){var _0x4b0d1d=_0x28af2e['models'];var _0xb7c5bd=_0xff7859['get']({'plain':!![]});if(_0xb7c5bd['direction'][_0xa424('0xf')]()==='in'||_0xb7c5bd['direction'][_0xa424('0xf')]()===_0xa424('0x10')&&!_0xb7c5bd['secret']&&!_[_0xa424('0x11')](_0xb7c5bd[_0xa424('0x12')])){_0x4b0d1d[_0xa424('0x13')][_0xa424('0x14')]({'where':{'id':_0xb7c5bd[_0xa424('0x15')]}})[_0xa424('0x16')](function(_0x572a71){if(_0x572a71){_0x572a71[_0xa424('0x17')]({'lastMsgAt':_0xb7c5bd[_0xa424('0x18')],'lastMsgDirection':_0xb7c5bd['direction'][_0xa424('0xf')]()});}})[_0xa424('0x19')](function(_0x58d1df){console[_0xa424('0x1a')](_0x58d1df);});}if(_0xb7c5bd[_0xa424('0x1b')]==='out'&&!_0xb7c5bd[_0xa424('0x1c')]){var _0x131a42;_0x4b0d1d['WhatsappAccount']['find']({'where':{'id':_0xb7c5bd[_0xa424('0x1d')]},'raw':!![]})[_0xa424('0x16')](function(_0x4eb662){_0x131a42=_0x4eb662;if(_0x131a42&&_0x131a42[_0xa424('0x1e')]){switch(_0x131a42[_0xa424('0x1e')]){case _0xa424('0x1f'):var _0x2f6a3e=require(_0xa424('0x1f'));if(_0x131a42[_0xa424('0x20')]&&_0x131a42[_0xa424('0x21')]&&_0x131a42['phone']){var _0x3083f5=new _0x2f6a3e(_0x131a42['accountSid'],_0x131a42[_0xa424('0x21')]);_0x3083f5[_0xa424('0x22')]['create']({'body':_0xb7c5bd['body'],'to':'whatsapp:'+_0xb7c5bd[_0xa424('0x23')],'from':'whatsapp:'+_0x131a42['phone'],'statusCallback':_0x131a42['remote']+_0xa424('0x24')+_0xb7c5bd['id']+_0xa424('0x25')+_0x131a42[_0xa424('0x26')]})['then'](function(_0x2698aa){if(_0x2698aa[_0xa424('0x27')]){return _0xff7859[_0xa424('0x17')]({'messageId':_0x2698aa[_0xa424('0x27')]});}})['catch'](function(_0x17f141){logger[_0xa424('0x1a')](_0xa424('0x28'),'afterCreate',_0xa424('0x1f'),util['inspect'](_0x17f141,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa424('0x1f'),_0xa424('0x29'));}break;}}})[_0xa424('0x2a')](function(){_0x14329e();});}else{_0x14329e();}}},'charset':_0xa424('0x2b'),'collate':_0xa424('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 89e086b..34dae89 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 _0x41f1=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','WhatsappMessage','create','body','options','raw','then','CreateWhatsappMessage','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0x41f1,0x185));var _0x141f=function(_0x151e0b,_0x3bec86){_0x151e0b=_0x151e0b-0x0;var _0x5d4a5c=_0x41f1[_0x151e0b];return _0x5d4a5c;};'use strict';var _=require(_0x141f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x141f('0x1'));var rs=require(_0x141f('0x2'));var fs=require('fs');var Redis=require(_0x141f('0x3'));var db=require(_0x141f('0x4'))['db'];var utils=require(_0x141f('0x5'));var logger=require(_0x141f('0x6'))(_0x141f('0x7'));var config=require(_0x141f('0x8'));var jayson=require(_0x141f('0x9'));var client=jayson[_0x141f('0xa')][_0x141f('0xb')]({'port':0x232a});config[_0x141f('0xc')]=_[_0x141f('0xd')](config['redis'],{'host':_0x141f('0xe'),'port':0x18eb});var socket=require(_0x141f('0xf'))(new Redis(config[_0x141f('0xc')]));require(_0x141f('0x10'))[_0x141f('0x11')](socket);function respondWithRpcPromise(_0x396ac6,_0x27df4a,_0x12d83b){return new BPromise(function(_0x4f1905,_0x1a0fb5){return client[_0x141f('0x12')](_0x396ac6,_0x12d83b)['then'](function(_0x557723){logger[_0x141f('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x27df4a,_0x141f('0x14'));logger[_0x141f('0x15')](_0x141f('0x16'),_0x27df4a,'request\x20sent',JSON[_0x141f('0x17')](_0x557723));if(_0x557723[_0x141f('0x18')]){if(_0x557723[_0x141f('0x18')]['code']===0x1f4){logger[_0x141f('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x27df4a,_0x557723[_0x141f('0x18')][_0x141f('0x19')]);return _0x1a0fb5(_0x557723[_0x141f('0x18')][_0x141f('0x19')]);}logger[_0x141f('0x18')](_0x141f('0x1a'),_0x27df4a,_0x557723[_0x141f('0x18')][_0x141f('0x19')]);return _0x4f1905(_0x557723[_0x141f('0x18')][_0x141f('0x19')]);}else{logger['info'](_0x141f('0x1a'),_0x27df4a,_0x141f('0x14'));_0x4f1905(_0x557723[_0x141f('0x1b')][_0x141f('0x19')]);}})[_0x141f('0x1c')](function(_0x5954a9){logger[_0x141f('0x18')](_0x141f('0x1a'),_0x27df4a,_0x5954a9);_0x1a0fb5(_0x5954a9);});});}exports['CreateWhatsappMessage']=function(_0x2b1dca){var _0x109d1f=this;return new Promise(function(_0x1bc209,_0x5c6ded){return db[_0x141f('0x1d')][_0x141f('0x1e')](_0x2b1dca[_0x141f('0x1f')],{'raw':_0x2b1dca[_0x141f('0x20')]?_0x2b1dca['options'][_0x141f('0x21')]===undefined?!![]:![]:!![]})[_0x141f('0x22')](function(_0x426608){logger[_0x141f('0x13')](_0x141f('0x23'),_0x2b1dca);logger['debug'](_0x141f('0x23'),_0x2b1dca,JSON[_0x141f('0x17')](_0x426608));_0x1bc209(_0x426608);})['catch'](function(_0x3408b1){logger[_0x141f('0x18')](_0x141f('0x23'),_0x3408b1[_0x141f('0x19')],_0x2b1dca);_0x5c6ded(_0x109d1f[_0x141f('0x18')](0x1f4,_0x3408b1['message']));});});}; \ No newline at end of file +var _0x492c=['request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','WhatsappMessage','options','raw','CreateWhatsappMessage','debug','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x53d9a7,_0x44c4a3){var _0x1c8958=function(_0x597d99){while(--_0x597d99){_0x53d9a7['push'](_0x53d9a7['shift']());}};_0x1c8958(++_0x44c4a3);}(_0x492c,0x13c));var _0xc492=function(_0x33ea20,_0x233211){_0x33ea20=_0x33ea20-0x0;var _0x1cf728=_0x492c[_0x33ea20];return _0x1cf728;};'use strict';var _=require('lodash');var util=require(_0xc492('0x0'));var moment=require(_0xc492('0x1'));var BPromise=require('bluebird');var rs=require(_0xc492('0x2'));var fs=require('fs');var Redis=require(_0xc492('0x3'));var db=require(_0xc492('0x4'))['db'];var utils=require(_0xc492('0x5'));var logger=require('../../config/logger')(_0xc492('0x6'));var config=require(_0xc492('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc492('0x8')][_0xc492('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc492('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc492('0xb'))(new Redis(config['redis']));require(_0xc492('0xc'))[_0xc492('0xd')](socket);function respondWithRpcPromise(_0xeed1e9,_0x297148,_0x131f7b){return new BPromise(function(_0x2e80bd,_0x49a00b){return client[_0xc492('0xe')](_0xeed1e9,_0x131f7b)[_0xc492('0xf')](function(_0x2c734f){logger[_0xc492('0x10')](_0xc492('0x11'),_0x297148,'request\x20sent');logger['debug'](_0xc492('0x12'),_0x297148,'request\x20sent',JSON[_0xc492('0x13')](_0x2c734f));if(_0x2c734f['error']){if(_0x2c734f['error'][_0xc492('0x14')]===0x1f4){logger['error'](_0xc492('0x11'),_0x297148,_0x2c734f[_0xc492('0x15')]['message']);return _0x49a00b(_0x2c734f['error'][_0xc492('0x16')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x297148,_0x2c734f[_0xc492('0x15')]['message']);return _0x2e80bd(_0x2c734f[_0xc492('0x15')][_0xc492('0x16')]);}else{logger[_0xc492('0x10')](_0xc492('0x11'),_0x297148,'request\x20sent');_0x2e80bd(_0x2c734f[_0xc492('0x17')][_0xc492('0x16')]);}})['catch'](function(_0x2e3340){logger[_0xc492('0x15')](_0xc492('0x11'),_0x297148,_0x2e3340);_0x49a00b(_0x2e3340);});});}exports['CreateWhatsappMessage']=function(_0x49299c){var _0x133403=this;return new Promise(function(_0x40378a,_0x4aa348){return db[_0xc492('0x18')]['create'](_0x49299c['body'],{'raw':_0x49299c[_0xc492('0x19')]?_0x49299c[_0xc492('0x19')][_0xc492('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x519170){logger[_0xc492('0x10')](_0xc492('0x1b'),_0x49299c);logger[_0xc492('0x1c')](_0xc492('0x1b'),_0x49299c,JSON[_0xc492('0x13')](_0x519170));_0x40378a(_0x519170);})[_0xc492('0x1d')](function(_0x55d62e){logger[_0xc492('0x15')](_0xc492('0x1b'),_0x55d62e[_0xc492('0x16')],_0x49299c);_0x4aa348(_0x133403['error'](0x1f4,_0x55d62e[_0xc492('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index fc1f93e..369dc6c 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 _0xed4d=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','register'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xed4d,0x1d7));var _0xded4=function(_0x37ab62,_0x4f79d3){_0x37ab62=_0x37ab62-0x0;var _0x2b2c81=_0xed4d[_0x37ab62];return _0x2b2c81;};'use strict';var WhatsappMessageEvents=require(_0xded4('0x0'));var events=[_0xded4('0x1'),_0xded4('0x2'),_0xded4('0x3')];function createListener(_0x5d6f7f,_0x30facb){return function(_0x250143){_0x30facb['emit'](_0x5d6f7f,_0x250143);};}function removeListener(_0x51f376,_0x13d00b){return function(){WhatsappMessageEvents['removeListener'](_0x51f376,_0x13d00b);};}exports[_0xded4('0x4')]=function(_0x362602){for(var _0x43f7ab=0x0,_0x53242c=events[_0xded4('0x5')];_0x43f7ab<_0x53242c;_0x43f7ab++){var _0xb426e3=events[_0x43f7ab];var _0x2de486=createListener(_0xded4('0x6')+_0xb426e3,_0x362602);WhatsappMessageEvents['on'](_0xb426e3,_0x2de486);}}; \ No newline at end of file +var _0x2525=['remove','update','emit','removeListener','./whatsappMessage.events'];(function(_0x11d1a2,_0x28124f){var _0x38f537=function(_0x6c02b5){while(--_0x6c02b5){_0x11d1a2['push'](_0x11d1a2['shift']());}};_0x38f537(++_0x28124f);}(_0x2525,0x9f));var _0x5252=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x2525[_0x43d11d];return _0x38cd08;};'use strict';var WhatsappMessageEvents=require(_0x5252('0x0'));var events=['save',_0x5252('0x1'),_0x5252('0x2')];function createListener(_0x28ac34,_0x3f0be1){return function(_0x13cbe2){_0x3f0be1[_0x5252('0x3')](_0x28ac34,_0x13cbe2);};}function removeListener(_0x402797,_0x27bc10){return function(){WhatsappMessageEvents[_0x5252('0x4')](_0x402797,_0x27bc10);};}exports['register']=function(_0x1b6642){for(var _0xbd8c72=0x0,_0x3fe146=events['length'];_0xbd8c72<_0x3fe146;_0xbd8c72++){var _0x2aca84=events[_0xbd8c72];var _0x12e805=createListener('whatsappMessage:'+_0x2aca84,_0x1b6642);WhatsappMessageEvents['on'](_0x2aca84,_0x12e805);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 30c321b..c3456c2 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 _0x3573=['post','addTeams','put','delete','destroy','removeAgents','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3573,0x1b0));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3357('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3357('0x1'));var express=require('express');var router=express[_0x3357('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3357('0x3'));var config=require(_0x3357('0x4'));var controller=require(_0x3357('0x5'));router[_0x3357('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3357('0x6')](_0x3357('0x7'),auth[_0x3357('0x8')](),controller[_0x3357('0x9')]);router[_0x3357('0x6')](_0x3357('0xa'),auth[_0x3357('0x8')](),controller[_0x3357('0xb')]);router['get'](_0x3357('0xc'),auth[_0x3357('0x8')](),controller[_0x3357('0xd')]);router[_0x3357('0x6')](_0x3357('0xe'),auth['isAuthenticated'](),controller[_0x3357('0xf')]);router['get'](_0x3357('0x10'),auth[_0x3357('0x8')](),controller[_0x3357('0x11')]);router[_0x3357('0x12')]('/',auth[_0x3357('0x8')](),controller['create']);router[_0x3357('0x12')](_0x3357('0xe'),auth[_0x3357('0x8')](),controller[_0x3357('0x13')]);router[_0x3357('0x12')](_0x3357('0x10'),auth[_0x3357('0x8')](),controller['addAgents']);router[_0x3357('0x14')](_0x3357('0xa'),auth[_0x3357('0x8')](),controller['update']);router[_0x3357('0x15')](_0x3357('0xa'),auth[_0x3357('0x8')](),controller[_0x3357('0x16')]);router[_0x3357('0x15')]('/:id/teams',auth[_0x3357('0x8')](),controller['removeTeams']);router[_0x3357('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x3357('0x17')]);module[_0x3357('0x18')]=router; \ No newline at end of file +var _0x1e8a=['removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getAgents','post','create','addTeams','/:id/users','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1e8a,0x1a6));var _0xa1e8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1e8a[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xa1e8('0x0'));var util=require(_0xa1e8('0x1'));var path=require(_0xa1e8('0x2'));var timeout=require(_0xa1e8('0x3'));var express=require(_0xa1e8('0x4'));var router=express['Router']();var auth=require(_0xa1e8('0x5'));var interaction=require(_0xa1e8('0x6'));var config=require(_0xa1e8('0x7'));var controller=require(_0xa1e8('0x8'));router['get']('/',auth[_0xa1e8('0x9')](),controller[_0xa1e8('0xa')]);router[_0xa1e8('0xb')](_0xa1e8('0xc'),auth[_0xa1e8('0x9')](),controller[_0xa1e8('0xd')]);router[_0xa1e8('0xb')](_0xa1e8('0xe'),auth['isAuthenticated'](),controller[_0xa1e8('0xf')]);router['get'](_0xa1e8('0x10'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xa1e8('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xa1e8('0xb')]('/:id/users',auth[_0xa1e8('0x9')](),controller[_0xa1e8('0x12')]);router[_0xa1e8('0x13')]('/',auth['isAuthenticated'](),controller[_0xa1e8('0x14')]);router[_0xa1e8('0x13')](_0xa1e8('0x11'),auth['isAuthenticated'](),controller[_0xa1e8('0x15')]);router['post'](_0xa1e8('0x16'),auth[_0xa1e8('0x9')](),controller['addAgents']);router[_0xa1e8('0x17')](_0xa1e8('0xe'),auth['isAuthenticated'](),controller[_0xa1e8('0x18')]);router[_0xa1e8('0x19')]('/:id',auth[_0xa1e8('0x9')](),controller['destroy']);router[_0xa1e8('0x19')]('/:id/teams',auth[_0xa1e8('0x9')](),controller[_0xa1e8('0x1a')]);router[_0xa1e8('0x19')](_0xa1e8('0x16'),auth[_0xa1e8('0x9')](),controller[_0xa1e8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5d6b64c..a963830 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 _0x7f36=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x7f36,0x64));var _0x67f3=function(_0x36bd30,_0x30e41c){_0x36bd30=_0x36bd30-0x0;var _0x473e7c=_0x7f36[_0x36bd30];return _0x473e7c;};'use strict';var Sequelize=require(_0x67f3('0x0'));module[_0x67f3('0x1')]={'name':{'type':Sequelize[_0x67f3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x67f3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x67f3('0x4')](_0x67f3('0x5'),_0x67f3('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x67f3('0x2')]}}; \ No newline at end of file +var _0x424a=['INTEGER','ENUM','beepall','roundrobin','STRING','exports'];(function(_0x4a8428,_0x271b81){var _0x559859=function(_0x355ac4){while(--_0x355ac4){_0x4a8428['push'](_0x4a8428['shift']());}};_0x559859(++_0x271b81);}(_0x424a,0x161));var _0xa424=function(_0x210561,_0x3c1c59){_0x210561=_0x210561-0x0;var _0x435afc=_0x424a[_0x210561];return _0x435afc;};'use strict';var Sequelize=require('sequelize');module[_0xa424('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa424('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa424('0x2')]('rrmemory',_0xa424('0x3'),_0xa424('0x4'))},'description':{'type':Sequelize[_0xa424('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 03c8048..6862501 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 _0x339b=['each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','removeAgents','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','zip-dir','moment','mustache','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','then','get','WhatsappQueues','UserProfileResource','destroy','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','length','hasOwnProperty','nolimit','User','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x339b,0x12d));var _0xb339=function(_0x37247c,_0x5a1470){_0x37247c=_0x37247c-0x0;var _0x5f4612=_0x339b[_0x37247c];return _0x5f4612;};'use strict';var pdf=require(_0xb339('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb339('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb339('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb339('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb339('0x4'));var ejs=require(_0xb339('0x5'));var fs=require('fs');var _=require(_0xb339('0x6'));var squel=require(_0xb339('0x7'));var crypto=require(_0xb339('0x8'));var jsforce=require(_0xb339('0x9'));var deskjs=require(_0xb339('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb339('0xb'));var Papa=require('papaparse');var Redis=require(_0xb339('0xc'));var authService=require(_0xb339('0xd'));var qs=require(_0xb339('0xe'));var as=require(_0xb339('0xf'));var hardwareService=require(_0xb339('0x10'));var logger=require(_0xb339('0x11'))(_0xb339('0x12'));var utils=require(_0xb339('0x13'));var config=require(_0xb339('0x14'));var licenseUtil=require(_0xb339('0x15'));var db=require(_0xb339('0x16'))['db'];config[_0xb339('0x17')]=_[_0xb339('0x18')](config[_0xb339('0x17')],{'host':_0xb339('0x19'),'port':0x18eb});var socket=require(_0xb339('0x1a'))(new Redis(config[_0xb339('0x17')]));require(_0xb339('0x1b'))[_0xb339('0x1c')](socket);function respondWithStatusCode(_0x5c1897,_0x263cbe){_0x263cbe=_0x263cbe||0xcc;return function(_0x535235){if(_0x535235){return _0x5c1897[_0xb339('0x1d')](_0x263cbe);}return _0x5c1897[_0xb339('0x1e')](_0x263cbe)[_0xb339('0x1f')]();};}function respondWithResult(_0x40294a,_0xbc964b){_0xbc964b=_0xbc964b||0xc8;return function(_0xaa7d04){if(_0xaa7d04){return _0x40294a[_0xb339('0x1e')](_0xbc964b)['json'](_0xaa7d04);}};}function respondWithFilteredResult(_0x3b5ba0,_0x3d1c21){return function(_0x403c4b){if(_0x403c4b){var _0x1e536d=_0x403c4b[_0xb339('0x20')],_0x12a7ae=_0x3d1c21[_0xb339('0x21')],_0x5ab539=_0x3d1c21['offset']+_0x3d1c21['limit'],_0x4f817d;if(_0x5ab539>=_0x1e536d){_0x5ab539=_0x1e536d;_0x4f817d=0xc8;}else{_0x4f817d=0xce;}_0x3b5ba0[_0xb339('0x1e')](_0x4f817d);return _0x3b5ba0[_0xb339('0x22')](_0xb339('0x23'),_0x12a7ae+'-'+_0x5ab539+'/'+_0x1e536d)['json'](_0x403c4b);}return null;};}function patchUpdates(_0x2e881b){return function(_0x3d890b){try{jsonpatch[_0xb339('0x24')](_0x3d890b,_0x2e881b,!![]);}catch(_0x49aba4){return BPromise[_0xb339('0x25')](_0x49aba4);}return _0x3d890b['save']();};}function saveUpdates(_0x42aa91,_0x14e7af){return function(_0x312db0){if(_0x312db0){return _0x312db0['update'](_0x42aa91)[_0xb339('0x26')](function(_0x4b2f64){return _0x4b2f64;});}return null;};}function removeEntity(_0x177eba,_0x16a5e4){return function(_0x4a45f1){if(_0x4a45f1){return _0x4a45f1['destroy']()[_0xb339('0x26')](function(){var _0x305888=_0x4a45f1[_0xb339('0x27')]({'plain':!![]});var _0x373481=_0xb339('0x28');return db[_0xb339('0x29')][_0xb339('0x2a')]({'where':{'type':_0x373481,'resourceId':_0x305888['id']}})['then'](function(){return _0x4a45f1;});})[_0xb339('0x26')](function(){_0x177eba[_0xb339('0x1e')](0xcc)[_0xb339('0x1f')]();});}};}function handleEntityNotFound(_0x2ce312,_0x107549){return function(_0x282816){if(!_0x282816){_0x2ce312[_0xb339('0x1d')](0x194);}return _0x282816;};}function handleError(_0x4882cb,_0x3cad50){_0x3cad50=_0x3cad50||0x1f4;return function(_0x2c067a){logger[_0xb339('0x2b')](_0x2c067a['stack']);if(_0x2c067a['name']){delete _0x2c067a[_0xb339('0x2c')];}_0x4882cb[_0xb339('0x1e')](_0x3cad50)[_0xb339('0x2d')](_0x2c067a);};}exports[_0xb339('0x2e')]=function(_0x2cbcea,_0x411554){var _0x43265b={},_0x16717c={},_0x217c13={'count':0x0,'rows':[]};var _0x5bd8af=_[_0xb339('0x2f')](db[_0xb339('0x30')][_0xb339('0x31')],function(_0x23ca7c){return{'name':_0x23ca7c[_0xb339('0x32')],'type':_0x23ca7c[_0xb339('0x33')][_0xb339('0x34')]};});_0x16717c[_0xb339('0x35')]=_[_0xb339('0x2f')](_0x5bd8af,'name');_0x16717c[_0xb339('0x36')]=_['keys'](_0x2cbcea[_0xb339('0x36')]);_0x16717c['filters']=_[_0xb339('0x37')](_0x16717c[_0xb339('0x35')],_0x16717c[_0xb339('0x36')]);_0x43265b[_0xb339('0x38')]=_[_0xb339('0x37')](_0x16717c[_0xb339('0x35')],qs[_0xb339('0x39')](_0x2cbcea['query'][_0xb339('0x39')]));_0x43265b[_0xb339('0x38')]=_0x43265b[_0xb339('0x38')]['length']?_0x43265b[_0xb339('0x38')]:_0x16717c[_0xb339('0x35')];if(!_0x2cbcea['query']['hasOwnProperty']('nolimit')){_0x43265b[_0xb339('0x3a')]=qs[_0xb339('0x3a')](_0x2cbcea[_0xb339('0x36')][_0xb339('0x3a')]);_0x43265b[_0xb339('0x21')]=qs[_0xb339('0x21')](_0x2cbcea[_0xb339('0x36')][_0xb339('0x21')]);}_0x43265b[_0xb339('0x3b')]=qs['sort'](_0x2cbcea[_0xb339('0x36')][_0xb339('0x3c')]);_0x43265b[_0xb339('0x3d')]=qs[_0xb339('0x3e')](_[_0xb339('0x3f')](_0x2cbcea[_0xb339('0x36')],_0x16717c[_0xb339('0x3e')]),_0x5bd8af);if(_0x2cbcea['query'][_0xb339('0x40')]){_0x43265b[_0xb339('0x3d')]=_['merge'](_0x43265b[_0xb339('0x3d')],{'$or':_[_0xb339('0x2f')](_0x5bd8af,function(_0x30744e){if(_0x30744e['type']!==_0xb339('0x41')){var _0x368ddb={};_0x368ddb[_0x30744e['name']]={'$like':'%'+_0x2cbcea[_0xb339('0x36')][_0xb339('0x40')]+'%'};return _0x368ddb;}})});}_0x43265b=_[_0xb339('0x42')]({},_0x43265b,_0x2cbcea[_0xb339('0x43')]);var _0x425c76={'where':_0x43265b['where']};return db['WhatsappQueue'][_0xb339('0x20')](_0x425c76)[_0xb339('0x26')](function(_0x382192){_0x217c13[_0xb339('0x20')]=_0x382192;if(_0x2cbcea['query']['includeAll']){_0x43265b[_0xb339('0x44')]=[{'all':!![]}];}return db[_0xb339('0x30')][_0xb339('0x45')](_0x43265b);})[_0xb339('0x26')](function(_0x3c6da3){_0x217c13['rows']=_0x3c6da3;return _0x217c13;})['then'](respondWithFilteredResult(_0x411554,_0x43265b))[_0xb339('0x46')](handleError(_0x411554,null));};exports[_0xb339('0x47')]=function(_0x20a2aa,_0x44b2d3){var _0x3e132={'raw':!![],'where':{'id':_0x20a2aa[_0xb339('0x48')]['id']}},_0x448350={};_0x448350[_0xb339('0x35')]=_[_0xb339('0x49')](db[_0xb339('0x30')][_0xb339('0x31')]);_0x448350['query']=_[_0xb339('0x49')](_0x20a2aa[_0xb339('0x36')]);_0x448350['filters']=_[_0xb339('0x37')](_0x448350[_0xb339('0x35')],_0x448350[_0xb339('0x36')]);_0x3e132[_0xb339('0x38')]=_[_0xb339('0x37')](_0x448350[_0xb339('0x35')],qs[_0xb339('0x39')](_0x20a2aa[_0xb339('0x36')][_0xb339('0x39')]));_0x3e132[_0xb339('0x38')]=_0x3e132[_0xb339('0x38')]['length']?_0x3e132['attributes']:_0x448350['model'];if(_0x20a2aa[_0xb339('0x36')][_0xb339('0x4a')]){_0x3e132['include']=[{'all':!![]}];}_0x3e132=_[_0xb339('0x42')]({},_0x3e132,_0x20a2aa[_0xb339('0x43')]);return db[_0xb339('0x30')]['find'](_0x3e132)[_0xb339('0x26')](handleEntityNotFound(_0x44b2d3,null))[_0xb339('0x26')](respondWithResult(_0x44b2d3,null))[_0xb339('0x46')](handleError(_0x44b2d3,null));};exports[_0xb339('0x4b')]=function(_0x62d1b3,_0x28272b){return db['WhatsappQueue'][_0xb339('0x4b')](_0x62d1b3[_0xb339('0x4c')],{})[_0xb339('0x26')](function(_0x5bc897){var _0x3eebc3=_0x62d1b3[_0xb339('0x4d')][_0xb339('0x27')]({'plain':!![]});if(!_0x3eebc3)throw new Error(_0xb339('0x4e'));if(_0x3eebc3['role']===_0xb339('0x4d')){var _0x43b14b=_0x5bc897[_0xb339('0x27')]({'plain':!![]});var _0x33634c=_0xb339('0x28');return db[_0xb339('0x4f')][_0xb339('0x50')]({'where':{'name':_0x33634c,'userProfileId':_0x3eebc3['userProfileId']},'raw':!![]})[_0xb339('0x26')](function(_0x51ceda){if(_0x51ceda&&_0x51ceda[_0xb339('0x51')]===0x0){return db['UserProfileResource'][_0xb339('0x4b')]({'name':_0x43b14b[_0xb339('0x2c')],'resourceId':_0x43b14b['id'],'type':_0x51ceda[_0xb339('0x2c')],'sectionId':_0x51ceda['id']},{})[_0xb339('0x26')](function(){return _0x5bc897;});}else{return _0x5bc897;}})[_0xb339('0x46')](function(_0x215cfe){logger[_0xb339('0x2b')](_0xb339('0x52'),_0x215cfe);throw _0x215cfe;});}return _0x5bc897;})[_0xb339('0x26')](respondWithResult(_0x28272b,0xc9))[_0xb339('0x46')](handleError(_0x28272b,null));};exports[_0xb339('0x53')]=function(_0x18ef4b,_0xaff87d){if(_0x18ef4b[_0xb339('0x4c')]['id']){delete _0x18ef4b['body']['id'];}return db[_0xb339('0x30')][_0xb339('0x50')]({'where':{'id':_0x18ef4b['params']['id']}})[_0xb339('0x26')](handleEntityNotFound(_0xaff87d,null))['then'](saveUpdates(_0x18ef4b[_0xb339('0x4c')],null))[_0xb339('0x26')](respondWithResult(_0xaff87d,null))['catch'](handleError(_0xaff87d,null));};exports[_0xb339('0x2a')]=function(_0x288e14,_0x4c0804){return db[_0xb339('0x30')][_0xb339('0x50')]({'where':{'id':_0x288e14['params']['id']}})[_0xb339('0x26')](handleEntityNotFound(_0x4c0804,null))['then'](removeEntity(_0x4c0804,null))['catch'](handleError(_0x4c0804,null));};exports[_0xb339('0x54')]=function(_0x519ad7,_0x12a171){return db['WhatsappQueue'][_0xb339('0x54')]()[_0xb339('0x26')](respondWithResult(_0x12a171,null))[_0xb339('0x46')](handleError(_0x12a171,null));};exports[_0xb339('0x55')]=function(_0x1596ec,_0x9d60a,_0x36edd0){var _0x50dffa={'raw':!![],'where':{}},_0x445cd5={},_0x14f993;return db[_0xb339('0x30')][_0xb339('0x56')]({'where':{'id':_0x1596ec[_0xb339('0x48')]['id']}})[_0xb339('0x26')](handleEntityNotFound(_0x9d60a,null))[_0xb339('0x26')](function(_0x16fcef){if(_0x16fcef){_0x14f993=_0x16fcef[_0xb339('0x27')]({'plain':!![]});_0x445cd5[_0xb339('0x35')]=_[_0xb339('0x49')](db['UserWhatsappQueue'][_0xb339('0x31')]);_0x445cd5[_0xb339('0x36')]=_['keys'](_0x1596ec['query']);_0x445cd5[_0xb339('0x3e')]=_[_0xb339('0x37')](_0x445cd5[_0xb339('0x35')],_0x445cd5[_0xb339('0x36')]);_0x50dffa[_0xb339('0x38')]=_[_0xb339('0x37')](_0x445cd5['model'],qs[_0xb339('0x39')](_0x1596ec['query'][_0xb339('0x39')]));_0x50dffa[_0xb339('0x38')]=_0x50dffa[_0xb339('0x38')][_0xb339('0x57')]?_0x50dffa[_0xb339('0x38')]:_0x445cd5['model'];if(!_0x1596ec[_0xb339('0x36')][_0xb339('0x58')](_0xb339('0x59'))){_0x50dffa['limit']=qs[_0xb339('0x3a')](_0x1596ec['query']['limit']);_0x50dffa[_0xb339('0x21')]=qs['offset'](_0x1596ec[_0xb339('0x36')][_0xb339('0x21')]);}_0x50dffa[_0xb339('0x3b')]=qs[_0xb339('0x3c')](_0x1596ec[_0xb339('0x36')][_0xb339('0x3c')]);_0x50dffa[_0xb339('0x3d')]=qs['filters'](_[_0xb339('0x3f')](_0x1596ec[_0xb339('0x36')],_0x445cd5[_0xb339('0x3e')]));_0x50dffa[_0xb339('0x3d')]['WhatsappQueueId']=_0x16fcef['id'];if(_0x1596ec[_0xb339('0x36')]['filter']){_0x50dffa['where']=_['merge'](_0x50dffa[_0xb339('0x3d')],{'$or':_[_0xb339('0x2f')](_0x50dffa[_0xb339('0x38')],function(_0x312f1f){var _0x472e7d={};_0x472e7d[_0x312f1f]={'$like':'%'+_0x1596ec[_0xb339('0x36')]['filter']+'%'};return _0x472e7d;})});}_0x50dffa=_[_0xb339('0x42')]({},_0x50dffa,_0x1596ec[_0xb339('0x43')]);return db['UserWhatsappQueue'][_0xb339('0x45')](_0x50dffa);}})[_0xb339('0x26')](function(_0x200582){if(_0x200582){return db[_0xb339('0x5a')]['findAndCountAll']({'where':{'id':_[_0xb339('0x2f')](_0x200582,_0xb339('0x5b')),'role':_0xb339('0x5c')},'attributes':['id',_0xb339('0x2c'),_0xb339('0x5d'),_0xb339('0x5e'),_0xb339('0x5f')]});}})[_0xb339('0x26')](function(_0x44850a){if(_0x44850a){return{'count':_0x44850a['count'],'rows':_[_0xb339('0x2f')](_0x44850a[_0xb339('0x60')],function(_0x30cdb2){return{'membername':_0x30cdb2[_0xb339('0x2c')],'UserId':_0x30cdb2['id'],'queue_name':_0x14f993[_0xb339('0x2c')],'WhatsappQueueId':_0x14f993['id'],'interface':util[_0xb339('0x61')](_0xb339('0x62'),_0xb339('0x63'),_0x30cdb2[_0xb339('0x2c')]),'penalty':0x0,'paused':_0x30cdb2[_0xb339('0x5d')],'createdAt':_0x30cdb2['createdAt'],'updatedAt':_0x30cdb2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb339('0x26')](respondWithFilteredResult(_0x9d60a,_0x50dffa))['catch'](handleError(_0x9d60a,null));};exports[_0xb339('0x64')]=function(_0x3a35f5,_0x166056,_0x4e6ec6){var _0x1a446f={};var _0x575e46={};var _0x48f3fd;var _0x41fea6;return db[_0xb339('0x30')][_0xb339('0x56')]({'where':{'id':_0x3a35f5[_0xb339('0x48')]['id']}})[_0xb339('0x26')](handleEntityNotFound(_0x166056,null))[_0xb339('0x26')](function(_0x1734ff){if(_0x1734ff){_0x48f3fd=_0x1734ff;_0x575e46[_0xb339('0x35')]=_[_0xb339('0x49')](db['Team']['rawAttributes']);_0x575e46[_0xb339('0x36')]=_[_0xb339('0x49')](_0x3a35f5[_0xb339('0x36')]);_0x575e46[_0xb339('0x3e')]=_['intersection'](_0x575e46[_0xb339('0x35')],_0x575e46['query']);_0x1a446f[_0xb339('0x38')]=_[_0xb339('0x37')](_0x575e46[_0xb339('0x35')],qs['fields'](_0x3a35f5['query'][_0xb339('0x39')]));_0x1a446f[_0xb339('0x38')]=_0x1a446f['attributes']['length']?_0x1a446f[_0xb339('0x38')]:_0x575e46[_0xb339('0x35')];_0x1a446f[_0xb339('0x3b')]=qs[_0xb339('0x3c')](_0x3a35f5[_0xb339('0x36')][_0xb339('0x3c')]);_0x1a446f[_0xb339('0x3d')]=qs[_0xb339('0x3e')](_[_0xb339('0x3f')](_0x3a35f5['query'],_0x575e46[_0xb339('0x3e')]));if(_0x3a35f5['query'][_0xb339('0x40')]){_0x1a446f[_0xb339('0x3d')]=_[_0xb339('0x42')](_0x1a446f[_0xb339('0x3d')],{'$or':_[_0xb339('0x2f')](_0x1a446f[_0xb339('0x38')],function(_0xcc65c7){var _0x28d707={};_0x28d707[_0xcc65c7]={'$like':'%'+_0x3a35f5['query'][_0xb339('0x40')]+'%'};return _0x28d707;})});}_0x1a446f=_[_0xb339('0x42')]({},_0x1a446f,_0x3a35f5['options']);return _0x48f3fd[_0xb339('0x64')](_0x1a446f);}})[_0xb339('0x26')](function(_0x24db7a){if(_0x24db7a){_0x41fea6=_0x24db7a['length'];if(!_0x3a35f5[_0xb339('0x36')][_0xb339('0x58')](_0xb339('0x59'))){_0x1a446f[_0xb339('0x3a')]=qs[_0xb339('0x3a')](_0x3a35f5['query'][_0xb339('0x3a')]);_0x1a446f[_0xb339('0x21')]=qs[_0xb339('0x21')](_0x3a35f5[_0xb339('0x36')][_0xb339('0x21')]);}return _0x48f3fd['getTeams'](_0x1a446f);}})['then'](function(_0x2b9dd6){if(_0x2b9dd6){return _0x2b9dd6?{'count':_0x41fea6,'rows':_0x2b9dd6}:null;}})[_0xb339('0x26')](respondWithResult(_0x166056,null))[_0xb339('0x46')](handleError(_0x166056,null));};exports[_0xb339('0x65')]=function(_0x4150b1,_0x23183c,_0x3c01e8){var _0x2e8b6a=_0x4150b1['body'][_0xb339('0x66')];return db[_0xb339('0x67')][_0xb339('0x45')]({'where':{'id':_0x2e8b6a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb339('0x68'),'attributes':['id',_0xb339('0x2c'),_0xb339('0x69'),_0xb339('0x6a'),'interface'],'raw':!![]}]})[_0xb339('0x26')](function(_0x3d649a){if(_0x3d649a){var _0x41c4bd=_[_0xb339('0x6b')](_0x3d649a,function(_0x4ae346){var _0x320e98=_0x4ae346[_0xb339('0x27')]({'plain':!![]});return _0x320e98['Agents'];});return db[_0xb339('0x30')][_0xb339('0x50')]({'where':{'id':_0x4150b1[_0xb339('0x48')]['id']}})['then'](function(_0x5f145d){return db[_0xb339('0x6c')][_0xb339('0x6d')](function(_0x3d79db){return _0x5f145d['addTeams'](_0x2e8b6a,{'transaction':_0x3d79db})['then'](function(){return BPromise[_0xb339('0x6e')](_0x41c4bd,function(_0x3ae482){return db[_0xb339('0x6f')][_0xb339('0x70')]({'where':{'UserId':_0x3ae482['id'],'WhatsappQueueId':_0x4150b1[_0xb339('0x48')]['id']},'transaction':_0x3d79db});});})[_0xb339('0x26')](function(){_0x41c4bd[_0xb339('0x71')](function(_0xa72094){socket[_0xb339('0x72')](_0xb339('0x73'),{'UserId':_0xa72094['id'],'WhatsappQueueId':_0x5f145d['id']});});});});});}})[_0xb339('0x26')](respondWithStatusCode(_0x23183c,null))['catch'](handleError(_0x23183c,null));};exports[_0xb339('0x74')]=function(_0x5b5f2b,_0x19b0a3,_0x51f89d){return db[_0xb339('0x67')][_0xb339('0x45')]({'where':{'id':_0x5b5f2b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb339('0x5a')],'as':_0xb339('0x68'),'attributes':['id'],'raw':!![]}]})[_0xb339('0x26')](handleEntityNotFound(_0x19b0a3,null))['then'](function(_0x3f7117){var _0x35afcd=_['map'](_0x3f7117,'id');var _0xd9a06f=[];var _0x1304a6=[];var _0x241851=squel[_0xb339('0x75')]();_0x241851[_0xb339('0x76')](_0xb339('0x77'))['from']('team_has_whatsapp_queues','tq')['join']('user_has_teams','ut',_0xb339('0x78'))[_0xb339('0x3d')]('WhatsappQueueId\x20=\x20?',_0x5b5f2b[_0xb339('0x48')]['id']);for(var _0x27f771=0x0;_0x27f771<_0x3f7117[_0xb339('0x57')];_0x27f771+=0x1){let _0x4e1245=_0x3f7117[_0x27f771];for(var _0x5ca23b=0x0;_0x5ca23b<_0x4e1245['Agents'][_0xb339('0x57')];_0x5ca23b+=0x1){let _0x3b83cb=_0x4e1245[_0xb339('0x68')][_0x5ca23b];var _0x336a12=_0x241851[_0xb339('0x79')]();_0x336a12[_0xb339('0x3d')](_0xb339('0x7a'),_0x3b83cb['id']);_0x1304a6[_0xb339('0x7b')](db['sequelize'][_0xb339('0x36')](_0x336a12[_0xb339('0x7c')](),{'type':db[_0xb339('0x6c')][_0xb339('0x7d')][_0xb339('0x7e')]})[_0xb339('0x26')](function(_0x36cd1b){if(_0x36cd1b[_0xb339('0x57')]===0x1){return _0x3b83cb['id'];}else{var _0x20b1c4=_['every'](_[_0xb339('0x2f')](_0x36cd1b,_0xb339('0x7f')),function(_0x3ed4ce){return _[_0xb339('0x80')](_0x35afcd,_0x3ed4ce);});if(_0x20b1c4){return _0x3b83cb['id'];}}}));}}return BPromise[_0xb339('0x81')](_0x1304a6)[_0xb339('0x26')](function(_0xca201){_0xd9a06f=_(_0xd9a06f)['union'](_0xca201)[_0xb339('0x82')]()[_0xb339('0x83')]();return db[_0xb339('0x30')][_0xb339('0x50')]({'where':{'id':_0x5b5f2b[_0xb339('0x48')]['id']}})[_0xb339('0x26')](function(_0x3796f8){return db[_0xb339('0x6c')]['transaction'](function(_0x54f777){return _0x3796f8[_0xb339('0x74')](_0x5b5f2b[_0xb339('0x36')][_0xb339('0x66')],{'transaction':_0x54f777})[_0xb339('0x26')](function(){if(!_['isEmpty'](_0xd9a06f)){return _0x3796f8[_0xb339('0x84')](_0xd9a06f,{'transaction':_0x54f777});}})[_0xb339('0x26')](function(){_0xd9a06f['forEach'](function(_0x4ee81e){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x4ee81e,'WhatsappQueueId':_0x3796f8['id']});});});});});});})[_0xb339('0x26')](respondWithStatusCode(_0x19b0a3,null))['catch'](handleError(_0x19b0a3,null));};exports['addAgents']=function(_0x4abc1a,_0x229b9c,_0x58987c){return db[_0xb339('0x30')][_0xb339('0x50')]({'where':{'id':_0x4abc1a[_0xb339('0x48')]['id']}})[_0xb339('0x26')](handleEntityNotFound(_0x229b9c,null))[_0xb339('0x26')](function(_0x46cea5){if(_0x46cea5){return _0x46cea5['addAgents'](_0x4abc1a['body']['ids'],_['omit'](_0x4abc1a['body'],[_0xb339('0x66'),'id'])||{})[_0xb339('0x85')](function(_0x4e200f){for(var _0x37cebd=0x0;_0x37cebd<_0x4abc1a[_0xb339('0x4c')][_0xb339('0x66')][_0xb339('0x57')];_0x37cebd+=0x1){socket['emit'](_0xb339('0x73'),{'UserId':_0x4abc1a[_0xb339('0x4c')][_0xb339('0x66')][_0x37cebd],'WhatsappQueueId':_0x4abc1a[_0xb339('0x48')]['id']});}return _0x4e200f;});}})[_0xb339('0x26')](respondWithResult(_0x229b9c,null))['catch'](handleError(_0x229b9c,null));};exports['removeAgents']=function(_0x4c3679,_0x4c279e,_0x4f3ee5){return db[_0xb339('0x30')]['find']({'where':{'id':_0x4c3679[_0xb339('0x48')]['id']}})[_0xb339('0x26')](handleEntityNotFound(_0x4c279e,null))[_0xb339('0x26')](function(_0x3ad6){if(_0x3ad6){return _0x3ad6['removeAgents'](_0x4c3679['query'][_0xb339('0x66')])[_0xb339('0x26')](function(){if(_[_0xb339('0x86')](_0x4c3679[_0xb339('0x36')][_0xb339('0x66')])){for(var _0x57edc7=0x0;_0x57edc7<_0x4c3679[_0xb339('0x36')][_0xb339('0x66')][_0xb339('0x57')];_0x57edc7+=0x1){socket[_0xb339('0x72')](_0xb339('0x87'),{'UserId':Number(_0x4c3679[_0xb339('0x36')][_0xb339('0x66')][_0x57edc7]),'WhatsappQueueId':Number(_0x4c3679[_0xb339('0x48')]['id'])});}}else{socket['emit'](_0xb339('0x87'),{'UserId':Number(_0x4c3679[_0xb339('0x36')][_0xb339('0x66')]),'WhatsappQueueId':Number(_0x4c3679[_0xb339('0x48')]['id'])});}});}})[_0xb339('0x26')](respondWithStatusCode(_0x4c279e,null))[_0xb339('0x46')](handleError(_0x4c279e,null));};exports['getAgents']=function(_0x1d177f,_0x4b510d,_0x66986){var _0x13d200={};var _0x1b6785={};var _0x3b9098;var _0x532892;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1d177f[_0xb339('0x48')]['id']}})[_0xb339('0x26')](handleEntityNotFound(_0x4b510d,null))[_0xb339('0x26')](function(_0x508200){if(_0x508200){_0x3b9098=_0x508200;_0x1b6785[_0xb339('0x35')]=_['keys'](db[_0xb339('0x5a')]['rawAttributes']);_0x1b6785[_0xb339('0x36')]=_['keys'](_0x1d177f[_0xb339('0x36')]);_0x1b6785[_0xb339('0x3e')]=_['intersection'](_0x1b6785[_0xb339('0x35')],_0x1b6785[_0xb339('0x36')]);_0x13d200[_0xb339('0x38')]=_[_0xb339('0x37')](_0x1b6785[_0xb339('0x35')],qs[_0xb339('0x39')](_0x1d177f['query'][_0xb339('0x39')]));_0x13d200[_0xb339('0x38')]=_0x13d200['attributes'][_0xb339('0x57')]?_0x13d200[_0xb339('0x38')]:_0x1b6785[_0xb339('0x35')];_0x13d200[_0xb339('0x3b')]=qs[_0xb339('0x3c')](_0x1d177f[_0xb339('0x36')]['sort']);_0x13d200[_0xb339('0x3d')]=qs[_0xb339('0x3e')](_[_0xb339('0x3f')](_0x1d177f[_0xb339('0x36')],_0x1b6785['filters']));if(_0x1d177f['query'][_0xb339('0x40')]){_0x13d200[_0xb339('0x3d')]=_[_0xb339('0x42')](_0x13d200[_0xb339('0x3d')],{'$or':_[_0xb339('0x2f')](_0x13d200[_0xb339('0x38')],function(_0xb76931){var _0x3eff1c={};_0x3eff1c[_0xb76931]={'$like':'%'+_0x1d177f['query'][_0xb339('0x40')]+'%'};return _0x3eff1c;})});}_0x13d200=_['merge']({},_0x13d200,_0x1d177f['options']);return _0x3b9098[_0xb339('0x88')](_0x13d200);}})[_0xb339('0x26')](function(_0xf0772c){if(_0xf0772c){_0x532892=_0xf0772c[_0xb339('0x57')];if(!_0x1d177f[_0xb339('0x36')][_0xb339('0x58')](_0xb339('0x59'))){_0x13d200[_0xb339('0x3a')]=qs[_0xb339('0x3a')](_0x1d177f[_0xb339('0x36')]['limit']);_0x13d200[_0xb339('0x21')]=qs['offset'](_0x1d177f['query'][_0xb339('0x21')]);}return _0x3b9098[_0xb339('0x88')](_0x13d200);}})[_0xb339('0x26')](function(_0x3996e7){if(_0x3996e7){return _0x3996e7?{'count':_0x532892,'rows':_0x3996e7}:null;}})[_0xb339('0x26')](respondWithResult(_0x4b510d,null))[_0xb339('0x46')](handleError(_0x4b510d,null));}; \ No newline at end of file +var _0xc2e1=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','order','sort','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','nolimit','pick','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','hasOwnProperty','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','removeAgents','forEach','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash'];(function(_0xb39885,_0x517a43){var _0x1a196f=function(_0x14bc1e){while(--_0x14bc1e){_0xb39885['push'](_0xb39885['shift']());}};_0x1a196f(++_0x517a43);}(_0xc2e1,0x7f));var _0x1c2e=function(_0x319f71,_0x459f06){_0x319f71=_0x319f71-0x0;var _0x8a05a9=_0xc2e1[_0x319f71];return _0x8a05a9;};'use strict';var pdf=require(_0x1c2e('0x0'));var emlformat=require(_0x1c2e('0x1'));var rimraf=require(_0x1c2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c2e('0x3'));var rp=require(_0x1c2e('0x4'));var moment=require('moment');var BPromise=require(_0x1c2e('0x5'));var Mustache=require('mustache');var util=require(_0x1c2e('0x6'));var path=require(_0x1c2e('0x7'));var sox=require(_0x1c2e('0x8'));var csv=require(_0x1c2e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c2e('0xa'));var squel=require(_0x1c2e('0xb'));var crypto=require(_0x1c2e('0xc'));var jsforce=require(_0x1c2e('0xd'));var deskjs=require(_0x1c2e('0xe'));var toCsv=require(_0x1c2e('0x9'));var querystring=require('querystring');var Papa=require(_0x1c2e('0xf'));var Redis=require(_0x1c2e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1c2e('0x11'));var as=require(_0x1c2e('0x12'));var hardwareService=require(_0x1c2e('0x13'));var logger=require(_0x1c2e('0x14'))(_0x1c2e('0x15'));var utils=require(_0x1c2e('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c2e('0x17'))['db'];config[_0x1c2e('0x18')]=_[_0x1c2e('0x19')](config[_0x1c2e('0x18')],{'host':_0x1c2e('0x1a'),'port':0x18eb});var socket=require(_0x1c2e('0x1b'))(new Redis(config[_0x1c2e('0x18')]));require('./whatsappQueue.socket')[_0x1c2e('0x1c')](socket);function respondWithStatusCode(_0x211aab,_0x571948){_0x571948=_0x571948||0xcc;return function(_0x12bbc0){if(_0x12bbc0){return _0x211aab[_0x1c2e('0x1d')](_0x571948);}return _0x211aab[_0x1c2e('0x1e')](_0x571948)[_0x1c2e('0x1f')]();};}function respondWithResult(_0x19752d,_0x5abfbc){_0x5abfbc=_0x5abfbc||0xc8;return function(_0x5b9860){if(_0x5b9860){return _0x19752d[_0x1c2e('0x1e')](_0x5abfbc)[_0x1c2e('0x20')](_0x5b9860);}};}function respondWithFilteredResult(_0x4df31c,_0x10e9cd){return function(_0x38e2a0){if(_0x38e2a0){var _0x2e0fb2=_0x38e2a0[_0x1c2e('0x21')],_0x558cdf=_0x10e9cd[_0x1c2e('0x22')],_0x52af7f=_0x10e9cd['offset']+_0x10e9cd[_0x1c2e('0x23')],_0x4e1745;if(_0x52af7f>=_0x2e0fb2){_0x52af7f=_0x2e0fb2;_0x4e1745=0xc8;}else{_0x4e1745=0xce;}_0x4df31c['status'](_0x4e1745);return _0x4df31c['set'](_0x1c2e('0x24'),_0x558cdf+'-'+_0x52af7f+'/'+_0x2e0fb2)['json'](_0x38e2a0);}return null;};}function patchUpdates(_0x10db78){return function(_0x2933db){try{jsonpatch['apply'](_0x2933db,_0x10db78,!![]);}catch(_0x5225a8){return BPromise[_0x1c2e('0x25')](_0x5225a8);}return _0x2933db[_0x1c2e('0x26')]();};}function saveUpdates(_0x3b5ff1,_0x2bf975){return function(_0x1de362){if(_0x1de362){return _0x1de362[_0x1c2e('0x27')](_0x3b5ff1)[_0x1c2e('0x28')](function(_0xfe59e){return _0xfe59e;});}return null;};}function removeEntity(_0x1f4d74,_0x545837){return function(_0x3cd7bf){if(_0x3cd7bf){return _0x3cd7bf[_0x1c2e('0x29')]()['then'](function(){var _0x4deb3a=_0x3cd7bf[_0x1c2e('0x2a')]({'plain':!![]});var _0x5cf4a8=_0x1c2e('0x2b');return db[_0x1c2e('0x2c')][_0x1c2e('0x29')]({'where':{'type':_0x5cf4a8,'resourceId':_0x4deb3a['id']}})[_0x1c2e('0x28')](function(){return _0x3cd7bf;});})[_0x1c2e('0x28')](function(){_0x1f4d74[_0x1c2e('0x1e')](0xcc)[_0x1c2e('0x1f')]();});}};}function handleEntityNotFound(_0x2146ab,_0x5c7cb3){return function(_0x9aa01c){if(!_0x9aa01c){_0x2146ab[_0x1c2e('0x1d')](0x194);}return _0x9aa01c;};}function handleError(_0x224204,_0x2fa4f1){_0x2fa4f1=_0x2fa4f1||0x1f4;return function(_0x352a0f){logger[_0x1c2e('0x2d')](_0x352a0f[_0x1c2e('0x2e')]);if(_0x352a0f[_0x1c2e('0x2f')]){delete _0x352a0f['name'];}_0x224204[_0x1c2e('0x1e')](_0x2fa4f1)[_0x1c2e('0x30')](_0x352a0f);};}exports[_0x1c2e('0x31')]=function(_0x202e0b,_0x24cb6a){var _0x27998d={},_0x553ea2={},_0x430a95={'count':0x0,'rows':[]};var _0x531c9a=_[_0x1c2e('0x32')](db[_0x1c2e('0x33')]['rawAttributes'],function(_0x1103d7){return{'name':_0x1103d7[_0x1c2e('0x34')],'type':_0x1103d7[_0x1c2e('0x35')]['key']};});_0x553ea2[_0x1c2e('0x36')]=_['map'](_0x531c9a,_0x1c2e('0x2f'));_0x553ea2['query']=_[_0x1c2e('0x37')](_0x202e0b['query']);_0x553ea2[_0x1c2e('0x38')]=_[_0x1c2e('0x39')](_0x553ea2[_0x1c2e('0x36')],_0x553ea2[_0x1c2e('0x3a')]);_0x27998d[_0x1c2e('0x3b')]=_[_0x1c2e('0x39')](_0x553ea2[_0x1c2e('0x36')],qs[_0x1c2e('0x3c')](_0x202e0b[_0x1c2e('0x3a')]['fields']));_0x27998d[_0x1c2e('0x3b')]=_0x27998d[_0x1c2e('0x3b')][_0x1c2e('0x3d')]?_0x27998d[_0x1c2e('0x3b')]:_0x553ea2[_0x1c2e('0x36')];if(!_0x202e0b[_0x1c2e('0x3a')]['hasOwnProperty']('nolimit')){_0x27998d[_0x1c2e('0x23')]=qs[_0x1c2e('0x23')](_0x202e0b[_0x1c2e('0x3a')][_0x1c2e('0x23')]);_0x27998d[_0x1c2e('0x22')]=qs[_0x1c2e('0x22')](_0x202e0b[_0x1c2e('0x3a')][_0x1c2e('0x22')]);}_0x27998d[_0x1c2e('0x3e')]=qs[_0x1c2e('0x3f')](_0x202e0b[_0x1c2e('0x3a')][_0x1c2e('0x3f')]);_0x27998d['where']=qs[_0x1c2e('0x38')](_['pick'](_0x202e0b[_0x1c2e('0x3a')],_0x553ea2[_0x1c2e('0x38')]),_0x531c9a);if(_0x202e0b[_0x1c2e('0x3a')][_0x1c2e('0x40')]){_0x27998d['where']=_[_0x1c2e('0x41')](_0x27998d[_0x1c2e('0x42')],{'$or':_[_0x1c2e('0x32')](_0x531c9a,function(_0x56bc1f){if(_0x56bc1f[_0x1c2e('0x35')]!==_0x1c2e('0x43')){var _0x5ab3e9={};_0x5ab3e9[_0x56bc1f[_0x1c2e('0x2f')]]={'$like':'%'+_0x202e0b[_0x1c2e('0x3a')][_0x1c2e('0x40')]+'%'};return _0x5ab3e9;}})});}_0x27998d=_['merge']({},_0x27998d,_0x202e0b[_0x1c2e('0x44')]);var _0x2886c6={'where':_0x27998d['where']};return db[_0x1c2e('0x33')][_0x1c2e('0x21')](_0x2886c6)['then'](function(_0x40a48b){_0x430a95[_0x1c2e('0x21')]=_0x40a48b;if(_0x202e0b[_0x1c2e('0x3a')]['includeAll']){_0x27998d[_0x1c2e('0x45')]=[{'all':!![]}];}return db[_0x1c2e('0x33')][_0x1c2e('0x46')](_0x27998d);})[_0x1c2e('0x28')](function(_0x4f7899){_0x430a95[_0x1c2e('0x47')]=_0x4f7899;return _0x430a95;})[_0x1c2e('0x28')](respondWithFilteredResult(_0x24cb6a,_0x27998d))[_0x1c2e('0x48')](handleError(_0x24cb6a,null));};exports[_0x1c2e('0x49')]=function(_0x19bd75,_0x559384){var _0xbcefee={'raw':!![],'where':{'id':_0x19bd75[_0x1c2e('0x4a')]['id']}},_0x2d59b3={};_0x2d59b3['model']=_[_0x1c2e('0x37')](db[_0x1c2e('0x33')]['rawAttributes']);_0x2d59b3[_0x1c2e('0x3a')]=_[_0x1c2e('0x37')](_0x19bd75[_0x1c2e('0x3a')]);_0x2d59b3[_0x1c2e('0x38')]=_[_0x1c2e('0x39')](_0x2d59b3['model'],_0x2d59b3[_0x1c2e('0x3a')]);_0xbcefee[_0x1c2e('0x3b')]=_[_0x1c2e('0x39')](_0x2d59b3[_0x1c2e('0x36')],qs[_0x1c2e('0x3c')](_0x19bd75[_0x1c2e('0x3a')][_0x1c2e('0x3c')]));_0xbcefee[_0x1c2e('0x3b')]=_0xbcefee[_0x1c2e('0x3b')][_0x1c2e('0x3d')]?_0xbcefee['attributes']:_0x2d59b3['model'];if(_0x19bd75[_0x1c2e('0x3a')][_0x1c2e('0x4b')]){_0xbcefee[_0x1c2e('0x45')]=[{'all':!![]}];}_0xbcefee=_['merge']({},_0xbcefee,_0x19bd75[_0x1c2e('0x44')]);return db[_0x1c2e('0x33')][_0x1c2e('0x4c')](_0xbcefee)[_0x1c2e('0x28')](handleEntityNotFound(_0x559384,null))[_0x1c2e('0x28')](respondWithResult(_0x559384,null))[_0x1c2e('0x48')](handleError(_0x559384,null));};exports[_0x1c2e('0x4d')]=function(_0x23cf16,_0x5d9852){return db[_0x1c2e('0x33')][_0x1c2e('0x4d')](_0x23cf16[_0x1c2e('0x4e')],{})['then'](function(_0x32c020){var _0x1a9674=_0x23cf16[_0x1c2e('0x4f')][_0x1c2e('0x2a')]({'plain':!![]});if(!_0x1a9674)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9674['role']==='user'){var _0x99d7cb=_0x32c020['get']({'plain':!![]});var _0x2d6f81=_0x1c2e('0x2b');return db[_0x1c2e('0x50')]['find']({'where':{'name':_0x2d6f81,'userProfileId':_0x1a9674[_0x1c2e('0x51')]},'raw':!![]})[_0x1c2e('0x28')](function(_0x4b0411){if(_0x4b0411&&_0x4b0411[_0x1c2e('0x52')]===0x0){return db[_0x1c2e('0x2c')][_0x1c2e('0x4d')]({'name':_0x99d7cb[_0x1c2e('0x2f')],'resourceId':_0x99d7cb['id'],'type':_0x4b0411[_0x1c2e('0x2f')],'sectionId':_0x4b0411['id']},{})[_0x1c2e('0x28')](function(){return _0x32c020;});}else{return _0x32c020;}})['catch'](function(_0x30b3a1){logger[_0x1c2e('0x2d')](_0x1c2e('0x53'),_0x30b3a1);throw _0x30b3a1;});}return _0x32c020;})['then'](respondWithResult(_0x5d9852,0xc9))[_0x1c2e('0x48')](handleError(_0x5d9852,null));};exports[_0x1c2e('0x27')]=function(_0xe3ad26,_0x317a7b){if(_0xe3ad26[_0x1c2e('0x4e')]['id']){delete _0xe3ad26[_0x1c2e('0x4e')]['id'];}return db[_0x1c2e('0x33')][_0x1c2e('0x4c')]({'where':{'id':_0xe3ad26[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x317a7b,null))[_0x1c2e('0x28')](saveUpdates(_0xe3ad26[_0x1c2e('0x4e')],null))[_0x1c2e('0x28')](respondWithResult(_0x317a7b,null))[_0x1c2e('0x48')](handleError(_0x317a7b,null));};exports[_0x1c2e('0x29')]=function(_0x35af1f,_0x53a925){return db[_0x1c2e('0x33')]['find']({'where':{'id':_0x35af1f[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x53a925,null))['then'](removeEntity(_0x53a925,null))[_0x1c2e('0x48')](handleError(_0x53a925,null));};exports[_0x1c2e('0x54')]=function(_0x452c12,_0x21cd13){return db[_0x1c2e('0x33')]['describe']()['then'](respondWithResult(_0x21cd13,null))[_0x1c2e('0x48')](handleError(_0x21cd13,null));};exports[_0x1c2e('0x55')]=function(_0x487809,_0x2a68be,_0x3b5817){var _0x407f9b={'raw':!![],'where':{}},_0x444a1d={},_0x1ab1f7;return db[_0x1c2e('0x33')][_0x1c2e('0x56')]({'where':{'id':_0x487809[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x2a68be,null))['then'](function(_0x27bed7){if(_0x27bed7){_0x1ab1f7=_0x27bed7[_0x1c2e('0x2a')]({'plain':!![]});_0x444a1d[_0x1c2e('0x36')]=_[_0x1c2e('0x37')](db[_0x1c2e('0x57')][_0x1c2e('0x58')]);_0x444a1d[_0x1c2e('0x3a')]=_[_0x1c2e('0x37')](_0x487809[_0x1c2e('0x3a')]);_0x444a1d['filters']=_[_0x1c2e('0x39')](_0x444a1d[_0x1c2e('0x36')],_0x444a1d[_0x1c2e('0x3a')]);_0x407f9b['attributes']=_[_0x1c2e('0x39')](_0x444a1d[_0x1c2e('0x36')],qs[_0x1c2e('0x3c')](_0x487809[_0x1c2e('0x3a')][_0x1c2e('0x3c')]));_0x407f9b[_0x1c2e('0x3b')]=_0x407f9b[_0x1c2e('0x3b')][_0x1c2e('0x3d')]?_0x407f9b[_0x1c2e('0x3b')]:_0x444a1d[_0x1c2e('0x36')];if(!_0x487809[_0x1c2e('0x3a')]['hasOwnProperty'](_0x1c2e('0x59'))){_0x407f9b[_0x1c2e('0x23')]=qs[_0x1c2e('0x23')](_0x487809[_0x1c2e('0x3a')]['limit']);_0x407f9b[_0x1c2e('0x22')]=qs['offset'](_0x487809[_0x1c2e('0x3a')][_0x1c2e('0x22')]);}_0x407f9b[_0x1c2e('0x3e')]=qs[_0x1c2e('0x3f')](_0x487809['query'][_0x1c2e('0x3f')]);_0x407f9b['where']=qs[_0x1c2e('0x38')](_[_0x1c2e('0x5a')](_0x487809['query'],_0x444a1d['filters']));_0x407f9b[_0x1c2e('0x42')][_0x1c2e('0x5b')]=_0x27bed7['id'];if(_0x487809[_0x1c2e('0x3a')][_0x1c2e('0x40')]){_0x407f9b[_0x1c2e('0x42')]=_[_0x1c2e('0x41')](_0x407f9b['where'],{'$or':_[_0x1c2e('0x32')](_0x407f9b[_0x1c2e('0x3b')],function(_0x5cd758){var _0x231932={};_0x231932[_0x5cd758]={'$like':'%'+_0x487809['query'][_0x1c2e('0x40')]+'%'};return _0x231932;})});}_0x407f9b=_['merge']({},_0x407f9b,_0x487809[_0x1c2e('0x44')]);return db[_0x1c2e('0x57')][_0x1c2e('0x46')](_0x407f9b);}})[_0x1c2e('0x28')](function(_0x23dc66){if(_0x23dc66){return db[_0x1c2e('0x5c')]['findAndCountAll']({'where':{'id':_[_0x1c2e('0x32')](_0x23dc66,_0x1c2e('0x5d')),'role':_0x1c2e('0x5e')},'attributes':['id',_0x1c2e('0x2f'),_0x1c2e('0x5f'),_0x1c2e('0x60'),_0x1c2e('0x61')]});}})[_0x1c2e('0x28')](function(_0x37ffe5){if(_0x37ffe5){return{'count':_0x37ffe5[_0x1c2e('0x21')],'rows':_[_0x1c2e('0x32')](_0x37ffe5[_0x1c2e('0x47')],function(_0x3f83d6){return{'membername':_0x3f83d6['name'],'UserId':_0x3f83d6['id'],'queue_name':_0x1ab1f7['name'],'WhatsappQueueId':_0x1ab1f7['id'],'interface':util['format'](_0x1c2e('0x62'),_0x1c2e('0x63'),_0x3f83d6[_0x1c2e('0x2f')]),'penalty':0x0,'paused':_0x3f83d6['whatsappPause'],'createdAt':_0x3f83d6['createdAt'],'updatedAt':_0x3f83d6[_0x1c2e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1c2e('0x28')](respondWithFilteredResult(_0x2a68be,_0x407f9b))[_0x1c2e('0x48')](handleError(_0x2a68be,null));};exports['getTeams']=function(_0x198f5e,_0x1ebf57,_0xe1f9a7){var _0x1863aa={};var _0x4b6e5c={};var _0x4a1bd9;var _0x4f3185;return db[_0x1c2e('0x33')]['findOne']({'where':{'id':_0x198f5e[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x1ebf57,null))[_0x1c2e('0x28')](function(_0x17b41f){if(_0x17b41f){_0x4a1bd9=_0x17b41f;_0x4b6e5c[_0x1c2e('0x36')]=_[_0x1c2e('0x37')](db[_0x1c2e('0x64')][_0x1c2e('0x58')]);_0x4b6e5c[_0x1c2e('0x3a')]=_[_0x1c2e('0x37')](_0x198f5e[_0x1c2e('0x3a')]);_0x4b6e5c[_0x1c2e('0x38')]=_[_0x1c2e('0x39')](_0x4b6e5c['model'],_0x4b6e5c[_0x1c2e('0x3a')]);_0x1863aa[_0x1c2e('0x3b')]=_[_0x1c2e('0x39')](_0x4b6e5c[_0x1c2e('0x36')],qs[_0x1c2e('0x3c')](_0x198f5e[_0x1c2e('0x3a')][_0x1c2e('0x3c')]));_0x1863aa[_0x1c2e('0x3b')]=_0x1863aa[_0x1c2e('0x3b')][_0x1c2e('0x3d')]?_0x1863aa[_0x1c2e('0x3b')]:_0x4b6e5c[_0x1c2e('0x36')];_0x1863aa[_0x1c2e('0x3e')]=qs[_0x1c2e('0x3f')](_0x198f5e['query']['sort']);_0x1863aa[_0x1c2e('0x42')]=qs['filters'](_[_0x1c2e('0x5a')](_0x198f5e['query'],_0x4b6e5c['filters']));if(_0x198f5e[_0x1c2e('0x3a')][_0x1c2e('0x40')]){_0x1863aa[_0x1c2e('0x42')]=_[_0x1c2e('0x41')](_0x1863aa['where'],{'$or':_[_0x1c2e('0x32')](_0x1863aa[_0x1c2e('0x3b')],function(_0x4e5448){var _0xe3d5af={};_0xe3d5af[_0x4e5448]={'$like':'%'+_0x198f5e['query'][_0x1c2e('0x40')]+'%'};return _0xe3d5af;})});}_0x1863aa=_[_0x1c2e('0x41')]({},_0x1863aa,_0x198f5e[_0x1c2e('0x44')]);return _0x4a1bd9['getTeams'](_0x1863aa);}})['then'](function(_0x33be31){if(_0x33be31){_0x4f3185=_0x33be31[_0x1c2e('0x3d')];if(!_0x198f5e[_0x1c2e('0x3a')][_0x1c2e('0x65')]('nolimit')){_0x1863aa['limit']=qs[_0x1c2e('0x23')](_0x198f5e[_0x1c2e('0x3a')][_0x1c2e('0x23')]);_0x1863aa['offset']=qs['offset'](_0x198f5e[_0x1c2e('0x3a')]['offset']);}return _0x4a1bd9[_0x1c2e('0x66')](_0x1863aa);}})[_0x1c2e('0x28')](function(_0x1adada){if(_0x1adada){return _0x1adada?{'count':_0x4f3185,'rows':_0x1adada}:null;}})[_0x1c2e('0x28')](respondWithResult(_0x1ebf57,null))[_0x1c2e('0x48')](handleError(_0x1ebf57,null));};exports[_0x1c2e('0x67')]=function(_0x927523,_0x146b98,_0x493064){var _0x90d75a=_0x927523[_0x1c2e('0x4e')][_0x1c2e('0x68')];return db[_0x1c2e('0x64')][_0x1c2e('0x46')]({'where':{'id':_0x90d75a},'attributes':['id'],'include':[{'model':db[_0x1c2e('0x5c')],'as':_0x1c2e('0x69'),'attributes':['id',_0x1c2e('0x2f'),_0x1c2e('0x6a'),_0x1c2e('0x6b'),'interface'],'raw':!![]}]})[_0x1c2e('0x28')](function(_0x43a88c){if(_0x43a88c){var _0x12b669=_['flatMap'](_0x43a88c,function(_0x5430f4){var _0x4092d3=_0x5430f4[_0x1c2e('0x2a')]({'plain':!![]});return _0x4092d3[_0x1c2e('0x69')];});return db[_0x1c2e('0x33')]['find']({'where':{'id':_0x927523[_0x1c2e('0x4a')]['id']}})['then'](function(_0x389c37){return db[_0x1c2e('0x6c')][_0x1c2e('0x6d')](function(_0x4b9c64){return _0x389c37[_0x1c2e('0x67')](_0x90d75a,{'transaction':_0x4b9c64})['then'](function(){return BPromise[_0x1c2e('0x6e')](_0x12b669,function(_0x395347){return db[_0x1c2e('0x57')]['findOrCreate']({'where':{'UserId':_0x395347['id'],'WhatsappQueueId':_0x927523['params']['id']},'transaction':_0x4b9c64});});})[_0x1c2e('0x28')](function(){_0x12b669['forEach'](function(_0x3d8450){socket[_0x1c2e('0x6f')](_0x1c2e('0x70'),{'UserId':_0x3d8450['id'],'WhatsappQueueId':_0x389c37['id']});});});});});}})[_0x1c2e('0x28')](respondWithStatusCode(_0x146b98,null))['catch'](handleError(_0x146b98,null));};exports[_0x1c2e('0x71')]=function(_0x2d7d61,_0x462164,_0x3a7d58){return db[_0x1c2e('0x64')][_0x1c2e('0x46')]({'where':{'id':_0x2d7d61[_0x1c2e('0x3a')][_0x1c2e('0x68')]},'attributes':['id'],'include':[{'model':db[_0x1c2e('0x5c')],'as':_0x1c2e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x1c2e('0x28')](handleEntityNotFound(_0x462164,null))[_0x1c2e('0x28')](function(_0x533baa){var _0xaeb45f=_[_0x1c2e('0x32')](_0x533baa,'id');var _0x33e7be=[];var _0x18b9db=[];var _0x4f5d70=squel[_0x1c2e('0x72')]();_0x4f5d70['field']('tq.TeamId')[_0x1c2e('0x73')](_0x1c2e('0x74'),'tq')[_0x1c2e('0x75')](_0x1c2e('0x76'),'ut',_0x1c2e('0x77'))[_0x1c2e('0x42')]('WhatsappQueueId\x20=\x20?',_0x2d7d61[_0x1c2e('0x4a')]['id']);for(var _0xbd8536=0x0;_0xbd8536<_0x533baa[_0x1c2e('0x3d')];_0xbd8536+=0x1){let _0xefcd5e=_0x533baa[_0xbd8536];for(var _0x3da8cf=0x0;_0x3da8cf<_0xefcd5e[_0x1c2e('0x69')]['length'];_0x3da8cf+=0x1){let _0x2e6385=_0xefcd5e[_0x1c2e('0x69')][_0x3da8cf];var _0x1119dc=_0x4f5d70[_0x1c2e('0x78')]();_0x1119dc[_0x1c2e('0x42')](_0x1c2e('0x79'),_0x2e6385['id']);_0x18b9db['push'](db[_0x1c2e('0x6c')]['query'](_0x1119dc[_0x1c2e('0x7a')](),{'type':db[_0x1c2e('0x6c')][_0x1c2e('0x7b')][_0x1c2e('0x7c')]})[_0x1c2e('0x28')](function(_0x422f5b){if(_0x422f5b[_0x1c2e('0x3d')]===0x1){return _0x2e6385['id'];}else{var _0x241cc1=_[_0x1c2e('0x7d')](_[_0x1c2e('0x32')](_0x422f5b,_0x1c2e('0x7e')),function(_0x263a30){return _[_0x1c2e('0x7f')](_0xaeb45f,_0x263a30);});if(_0x241cc1){return _0x2e6385['id'];}}}));}}return BPromise[_0x1c2e('0x80')](_0x18b9db)[_0x1c2e('0x28')](function(_0x125a04){_0x33e7be=_(_0x33e7be)['union'](_0x125a04)[_0x1c2e('0x81')]()['value']();return db[_0x1c2e('0x33')]['find']({'where':{'id':_0x2d7d61[_0x1c2e('0x4a')]['id']}})['then'](function(_0x1bd379){return db[_0x1c2e('0x6c')][_0x1c2e('0x6d')](function(_0x576b59){return _0x1bd379[_0x1c2e('0x71')](_0x2d7d61['query'][_0x1c2e('0x68')],{'transaction':_0x576b59})[_0x1c2e('0x28')](function(){if(!_['isEmpty'](_0x33e7be)){return _0x1bd379[_0x1c2e('0x82')](_0x33e7be,{'transaction':_0x576b59});}})[_0x1c2e('0x28')](function(){_0x33e7be[_0x1c2e('0x83')](function(_0xfb1d27){socket['emit']('userWhatsappQueue:remove',{'UserId':_0xfb1d27,'WhatsappQueueId':_0x1bd379['id']});});});});});});})[_0x1c2e('0x28')](respondWithStatusCode(_0x462164,null))[_0x1c2e('0x48')](handleError(_0x462164,null));};exports[_0x1c2e('0x84')]=function(_0x1d0940,_0x1d2e6b,_0xbe115d){return db['WhatsappQueue'][_0x1c2e('0x4c')]({'where':{'id':_0x1d0940[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x1d2e6b,null))[_0x1c2e('0x28')](function(_0x38c983){if(_0x38c983){return _0x38c983[_0x1c2e('0x84')](_0x1d0940['body'][_0x1c2e('0x68')],_[_0x1c2e('0x85')](_0x1d0940[_0x1c2e('0x4e')],[_0x1c2e('0x68'),'id'])||{})[_0x1c2e('0x86')](function(_0x36defd){for(var _0x52837e=0x0;_0x52837e<_0x1d0940[_0x1c2e('0x4e')]['ids'][_0x1c2e('0x3d')];_0x52837e+=0x1){socket[_0x1c2e('0x6f')](_0x1c2e('0x70'),{'UserId':_0x1d0940[_0x1c2e('0x4e')][_0x1c2e('0x68')][_0x52837e],'WhatsappQueueId':_0x1d0940[_0x1c2e('0x4a')]['id']});}return _0x36defd;});}})[_0x1c2e('0x28')](respondWithResult(_0x1d2e6b,null))[_0x1c2e('0x48')](handleError(_0x1d2e6b,null));};exports[_0x1c2e('0x82')]=function(_0x4c5b87,_0x439f40,_0x5e43e4){return db[_0x1c2e('0x33')][_0x1c2e('0x4c')]({'where':{'id':_0x4c5b87[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x439f40,null))['then'](function(_0x1f9766){if(_0x1f9766){return _0x1f9766['removeAgents'](_0x4c5b87[_0x1c2e('0x3a')][_0x1c2e('0x68')])[_0x1c2e('0x28')](function(){if(_[_0x1c2e('0x87')](_0x4c5b87['query'][_0x1c2e('0x68')])){for(var _0x2fe07b=0x0;_0x2fe07b<_0x4c5b87[_0x1c2e('0x3a')][_0x1c2e('0x68')][_0x1c2e('0x3d')];_0x2fe07b+=0x1){socket[_0x1c2e('0x6f')](_0x1c2e('0x88'),{'UserId':Number(_0x4c5b87[_0x1c2e('0x3a')]['ids'][_0x2fe07b]),'WhatsappQueueId':Number(_0x4c5b87[_0x1c2e('0x4a')]['id'])});}}else{socket[_0x1c2e('0x6f')](_0x1c2e('0x88'),{'UserId':Number(_0x4c5b87[_0x1c2e('0x3a')][_0x1c2e('0x68')]),'WhatsappQueueId':Number(_0x4c5b87[_0x1c2e('0x4a')]['id'])});}});}})[_0x1c2e('0x28')](respondWithStatusCode(_0x439f40,null))['catch'](handleError(_0x439f40,null));};exports[_0x1c2e('0x89')]=function(_0x319de3,_0x2b0bf,_0x4c5e07){var _0x5f0f89={};var _0x56b688={};var _0x52ffe6;var _0x13a6d7;return db[_0x1c2e('0x33')][_0x1c2e('0x56')]({'where':{'id':_0x319de3[_0x1c2e('0x4a')]['id']}})[_0x1c2e('0x28')](handleEntityNotFound(_0x2b0bf,null))['then'](function(_0x255ca8){if(_0x255ca8){_0x52ffe6=_0x255ca8;_0x56b688['model']=_[_0x1c2e('0x37')](db['User'][_0x1c2e('0x58')]);_0x56b688[_0x1c2e('0x3a')]=_[_0x1c2e('0x37')](_0x319de3[_0x1c2e('0x3a')]);_0x56b688[_0x1c2e('0x38')]=_['intersection'](_0x56b688[_0x1c2e('0x36')],_0x56b688['query']);_0x5f0f89['attributes']=_[_0x1c2e('0x39')](_0x56b688[_0x1c2e('0x36')],qs['fields'](_0x319de3['query']['fields']));_0x5f0f89[_0x1c2e('0x3b')]=_0x5f0f89['attributes'][_0x1c2e('0x3d')]?_0x5f0f89[_0x1c2e('0x3b')]:_0x56b688['model'];_0x5f0f89[_0x1c2e('0x3e')]=qs['sort'](_0x319de3[_0x1c2e('0x3a')]['sort']);_0x5f0f89[_0x1c2e('0x42')]=qs['filters'](_[_0x1c2e('0x5a')](_0x319de3[_0x1c2e('0x3a')],_0x56b688[_0x1c2e('0x38')]));if(_0x319de3['query']['filter']){_0x5f0f89['where']=_[_0x1c2e('0x41')](_0x5f0f89[_0x1c2e('0x42')],{'$or':_[_0x1c2e('0x32')](_0x5f0f89['attributes'],function(_0x11a062){var _0x1db001={};_0x1db001[_0x11a062]={'$like':'%'+_0x319de3[_0x1c2e('0x3a')][_0x1c2e('0x40')]+'%'};return _0x1db001;})});}_0x5f0f89=_[_0x1c2e('0x41')]({},_0x5f0f89,_0x319de3[_0x1c2e('0x44')]);return _0x52ffe6[_0x1c2e('0x89')](_0x5f0f89);}})[_0x1c2e('0x28')](function(_0x18251b){if(_0x18251b){_0x13a6d7=_0x18251b['length'];if(!_0x319de3[_0x1c2e('0x3a')][_0x1c2e('0x65')](_0x1c2e('0x59'))){_0x5f0f89[_0x1c2e('0x23')]=qs[_0x1c2e('0x23')](_0x319de3[_0x1c2e('0x3a')][_0x1c2e('0x23')]);_0x5f0f89[_0x1c2e('0x22')]=qs[_0x1c2e('0x22')](_0x319de3[_0x1c2e('0x3a')][_0x1c2e('0x22')]);}return _0x52ffe6['getAgents'](_0x5f0f89);}})[_0x1c2e('0x28')](function(_0x45cdff){if(_0x45cdff){return _0x45cdff?{'count':_0x13a6d7,'rows':_0x45cdff}:null;}})[_0x1c2e('0x28')](respondWithResult(_0x2b0bf,null))[_0x1c2e('0x48')](handleError(_0x2b0bf,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6b9e7c7..0b89076 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 _0x6e29=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x513356,_0x55ee86){var _0x4bf4f4=function(_0x3999d3){while(--_0x3999d3){_0x513356['push'](_0x513356['shift']());}};_0x4bf4f4(++_0x55ee86);}(_0x6e29,0x1b6));var _0x96e2=function(_0x3d2651,_0xf384ff){_0x3d2651=_0x3d2651-0x0;var _0x384f78=_0x6e29[_0x3d2651];return _0x384f78;};'use strict';var EventEmitter=require(_0x96e2('0x0'));var WhatsappQueue=require(_0x96e2('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x96e2('0x2')](0x0);var events={'afterCreate':_0x96e2('0x3'),'afterUpdate':_0x96e2('0x4'),'afterDestroy':_0x96e2('0x5')};function emitEvent(_0xc98e19){return function(_0x10abcb,_0x1ad065,_0x3d6a2d){WhatsappQueueEvents[_0x96e2('0x6')](_0xc98e19+':'+_0x10abcb['id'],_0x10abcb);WhatsappQueueEvents[_0x96e2('0x6')](_0xc98e19,_0x10abcb);_0x3d6a2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x96e2('0x7')](e,emitEvent(event));}}module[_0x96e2('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x638b=['save','update','remove','emit','hasOwnProperty','exports','events','WhatsappQueue','setMaxListeners'];(function(_0x5be52f,_0xb87714){var _0x12b0a8=function(_0x26c185){while(--_0x26c185){_0x5be52f['push'](_0x5be52f['shift']());}};_0x12b0a8(++_0xb87714);}(_0x638b,0x1da));var _0xb638=function(_0x4cdfcd,_0x27d051){_0x4cdfcd=_0x4cdfcd-0x0;var _0x48393d=_0x638b[_0x4cdfcd];return _0x48393d;};'use strict';var EventEmitter=require(_0xb638('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb638('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb638('0x2')](0x0);var events={'afterCreate':_0xb638('0x3'),'afterUpdate':_0xb638('0x4'),'afterDestroy':_0xb638('0x5')};function emitEvent(_0x1f091f){return function(_0x345e7e,_0x1718fb,_0x497c12){WhatsappQueueEvents['emit'](_0x1f091f+':'+_0x345e7e['id'],_0x345e7e);WhatsappQueueEvents[_0xb638('0x6')](_0x1f091f,_0x345e7e);_0x497c12(null);};}for(var e in events){if(events[_0xb638('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xb638('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9770479..74d31d7 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 _0xaf2a=['WhatsappQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x4809ba,_0x1e5432){var _0x42acb7=function(_0x396aa8){while(--_0x396aa8){_0x4809ba['push'](_0x4809ba['shift']());}};_0x42acb7(++_0x1e5432);}(_0xaf2a,0x177));var _0xaaf2=function(_0x11c247,_0x3d554e){_0x11c247=_0x11c247-0x0;var _0x5a39a7=_0xaf2a[_0x11c247];return _0x5a39a7;};'use strict';var _=require(_0xaaf2('0x0'));var util=require('util');var logger=require(_0xaaf2('0x1'))('api');var moment=require(_0xaaf2('0x2'));var BPromise=require(_0xaaf2('0x3'));var rp=require(_0xaaf2('0x4'));var fs=require('fs');var path=require(_0xaaf2('0x5'));var rimraf=require('rimraf');var config=require(_0xaaf2('0x6'));var attributes=require(_0xaaf2('0x7'));module[_0xaaf2('0x8')]=function(_0x4d5ed0,_0x413a58){return _0x4d5ed0[_0xaaf2('0x9')](_0xaaf2('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37f9=['./whatsappQueue.attributes','exports','define','whatsapp_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x495c18,_0xae1131){var _0x27b50d=function(_0x44fbaf){while(--_0x44fbaf){_0x495c18['push'](_0x495c18['shift']());}};_0x27b50d(++_0xae1131);}(_0x37f9,0x94));var _0x937f=function(_0x58b3fb,_0x284618){_0x58b3fb=_0x58b3fb-0x0;var _0x3a8ef7=_0x37f9[_0x58b3fb];return _0x3a8ef7;};'use strict';var _=require('lodash');var util=require(_0x937f('0x0'));var logger=require(_0x937f('0x1'))(_0x937f('0x2'));var moment=require(_0x937f('0x3'));var BPromise=require('bluebird');var rp=require(_0x937f('0x4'));var fs=require('fs');var path=require(_0x937f('0x5'));var rimraf=require(_0x937f('0x6'));var config=require(_0x937f('0x7'));var attributes=require(_0x937f('0x8'));module[_0x937f('0x9')]=function(_0x3c6611,_0x5864e){return _0x3c6611[_0x937f('0xa')]('WhatsappQueue',attributes,{'tableName':_0x937f('0xb'),'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 1bdcf34..ea6cb90 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 _0x8660=['where','map','include','attributes','model','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw'];(function(_0x35a529,_0x408c2c){var _0x2aeb96=function(_0xa808b9){while(--_0xa808b9){_0x35a529['push'](_0x35a529['shift']());}};_0x2aeb96(++_0x408c2c);}(_0x8660,0x9f));var _0x0866=function(_0x3869c8,_0x2ff137){_0x3869c8=_0x3869c8-0x0;var _0x4caf60=_0x8660[_0x3869c8];return _0x4caf60;};'use strict';var _=require(_0x0866('0x0'));var util=require(_0x0866('0x1'));var moment=require('moment');var BPromise=require(_0x0866('0x2'));var rs=require(_0x0866('0x3'));var fs=require('fs');var Redis=require(_0x0866('0x4'));var db=require(_0x0866('0x5'))['db'];var utils=require(_0x0866('0x6'));var logger=require(_0x0866('0x7'))(_0x0866('0x8'));var config=require(_0x0866('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0866('0xa')][_0x0866('0xb')]({'port':0x232a});config[_0x0866('0xc')]=_['defaults'](config[_0x0866('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0866('0xc')]));require(_0x0866('0xd'))[_0x0866('0xe')](socket);function respondWithRpcPromise(_0x21a2ac,_0x1e3774,_0x423b5c){return new BPromise(function(_0x54e575,_0x420492){return client[_0x0866('0xf')](_0x21a2ac,_0x423b5c)[_0x0866('0x10')](function(_0x3314b1){logger[_0x0866('0x11')](_0x0866('0x12'),_0x1e3774,_0x0866('0x13'));logger[_0x0866('0x14')](_0x0866('0x15'),_0x1e3774,_0x0866('0x13'),JSON[_0x0866('0x16')](_0x3314b1));if(_0x3314b1['error']){if(_0x3314b1['error']['code']===0x1f4){logger['error'](_0x0866('0x12'),_0x1e3774,_0x3314b1[_0x0866('0x17')][_0x0866('0x18')]);return _0x420492(_0x3314b1[_0x0866('0x17')][_0x0866('0x18')]);}logger[_0x0866('0x17')](_0x0866('0x12'),_0x1e3774,_0x3314b1['error']['message']);return _0x54e575(_0x3314b1[_0x0866('0x17')][_0x0866('0x18')]);}else{logger['info'](_0x0866('0x12'),_0x1e3774,_0x0866('0x13'));_0x54e575(_0x3314b1[_0x0866('0x19')][_0x0866('0x18')]);}})[_0x0866('0x1a')](function(_0xf7d5c2){logger[_0x0866('0x17')](_0x0866('0x12'),_0x1e3774,_0xf7d5c2);_0x420492(_0xf7d5c2);});});}exports[_0x0866('0x1b')]=function(_0x483bfc){var _0x20c561=this;return new Promise(function(_0x265eb2,_0x1fe123){return db[_0x0866('0x1c')]['findAll']({'raw':_0x483bfc[_0x0866('0x1d')]?_0x483bfc[_0x0866('0x1d')][_0x0866('0x1e')]===undefined?!![]:![]:!![],'where':_0x483bfc[_0x0866('0x1d')]?_0x483bfc[_0x0866('0x1d')][_0x0866('0x1f')]||null:null,'attributes':_0x483bfc['options']?_0x483bfc['options']['attributes']||null:null,'limit':_0x483bfc[_0x0866('0x1d')]?_0x483bfc[_0x0866('0x1d')]['limit']||null:null,'include':_0x483bfc[_0x0866('0x1d')]?_0x483bfc[_0x0866('0x1d')]['include']?_[_0x0866('0x20')](_0x483bfc[_0x0866('0x1d')][_0x0866('0x21')],function(_0x4d7ab4){return{'model':db[_0x4d7ab4['model']],'as':_0x4d7ab4['as'],'attributes':_0x4d7ab4[_0x0866('0x22')],'include':_0x4d7ab4[_0x0866('0x21')]?_[_0x0866('0x20')](_0x4d7ab4[_0x0866('0x21')],function(_0x4340b7){return{'model':db[_0x4340b7['model']],'as':_0x4340b7['as'],'attributes':_0x4340b7[_0x0866('0x22')],'include':_0x4340b7[_0x0866('0x21')]?_[_0x0866('0x20')](_0x4340b7[_0x0866('0x21')],function(_0x539a06){return{'model':db[_0x539a06[_0x0866('0x23')]],'as':_0x539a06['as'],'attributes':_0x539a06[_0x0866('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0866('0x10')](function(_0x464eed){logger[_0x0866('0x11')]('GetWhatsappQueue',_0x483bfc);logger[_0x0866('0x14')]('GetWhatsappQueue',_0x483bfc,JSON['stringify'](_0x464eed));_0x265eb2(_0x464eed);})['catch'](function(_0x152fd1){logger[_0x0866('0x17')](_0x0866('0x1b'),_0x152fd1[_0x0866('0x18')],_0x483bfc);_0x1fe123(_0x20c561[_0x0866('0x17')](0x1f4,_0x152fd1[_0x0866('0x18')]));});});};exports[_0x0866('0x24')]=function(_0xda298){var _0x3b2520=this;return new Promise(function(_0x17cd77,_0x428307){return db[_0x0866('0x1c')][_0x0866('0x25')]({'raw':_0xda298[_0x0866('0x1d')]?_0xda298[_0x0866('0x1d')][_0x0866('0x1e')]===undefined?!![]:![]:!![],'where':_0xda298[_0x0866('0x1d')]?_0xda298['options'][_0x0866('0x1f')]||null:null,'attributes':_0xda298[_0x0866('0x1d')]?_0xda298[_0x0866('0x1d')][_0x0866('0x22')]||null:null,'include':_0xda298[_0x0866('0x1d')]?_0xda298['options']['include']?_[_0x0866('0x20')](_0xda298[_0x0866('0x1d')][_0x0866('0x21')],function(_0x27d69d){return{'model':db[_0x27d69d[_0x0866('0x23')]],'as':_0x27d69d['as'],'attributes':_0x27d69d[_0x0866('0x22')],'include':_0x27d69d[_0x0866('0x21')]?_[_0x0866('0x20')](_0x27d69d['include'],function(_0x3c479c){return{'model':db[_0x3c479c['model']],'as':_0x3c479c['as'],'attributes':_0x3c479c[_0x0866('0x22')],'include':_0x3c479c[_0x0866('0x21')]?_[_0x0866('0x20')](_0x3c479c[_0x0866('0x21')],function(_0x309ed8){return{'model':db[_0x309ed8['model']],'as':_0x309ed8['as'],'attributes':_0x309ed8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x71f9bf){logger[_0x0866('0x11')](_0x0866('0x24'),_0xda298);logger[_0x0866('0x14')](_0x0866('0x24'),_0xda298,JSON['stringify'](_0x71f9bf));_0x17cd77(_0x71f9bf);})[_0x0866('0x1a')](function(_0x50d325){logger[_0x0866('0x17')](_0x0866('0x24'),_0x50d325[_0x0866('0x18')],_0xda298);_0x428307(_0x3b2520[_0x0866('0x17')](0x1f4,_0x50d325[_0x0866('0x18')]));});});}; \ No newline at end of file +var _0xf74f=['where','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./whatsappQueue.socket','register','request','then','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','WhatsappQueue','findAll','options','attributes','include','map','model','info','GetWhatsappQueue','catch','ShowWhatsappQueue','find'];(function(_0x59d5f7,_0x4a25b3){var _0x35e3c8=function(_0x53481c){while(--_0x53481c){_0x59d5f7['push'](_0x59d5f7['shift']());}};_0x35e3c8(++_0x4a25b3);}(_0xf74f,0x15f));var _0xff74=function(_0x3e2034,_0xd947a0){_0x3e2034=_0x3e2034-0x0;var _0x5562a5=_0xf74f[_0x3e2034];return _0x5562a5;};'use strict';var _=require('lodash');var util=require(_0xff74('0x0'));var moment=require(_0xff74('0x1'));var BPromise=require('bluebird');var rs=require(_0xff74('0x2'));var fs=require('fs');var Redis=require(_0xff74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff74('0x4'))(_0xff74('0x5'));var config=require('../../config/environment');var jayson=require(_0xff74('0x6'));var client=jayson[_0xff74('0x7')][_0xff74('0x8')]({'port':0x232a});config[_0xff74('0x9')]=_['defaults'](config[_0xff74('0x9')],{'host':_0xff74('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff74('0x9')]));require(_0xff74('0xb'))[_0xff74('0xc')](socket);function respondWithRpcPromise(_0x453b02,_0x19d276,_0x78df0f){return new BPromise(function(_0x298470,_0x217ffe){return client[_0xff74('0xd')](_0x453b02,_0x78df0f)[_0xff74('0xe')](function(_0xc504ca){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x19d276,_0xff74('0xf'));logger[_0xff74('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x19d276,_0xff74('0xf'),JSON[_0xff74('0x11')](_0xc504ca));if(_0xc504ca[_0xff74('0x12')]){if(_0xc504ca[_0xff74('0x12')][_0xff74('0x13')]===0x1f4){logger[_0xff74('0x12')](_0xff74('0x14'),_0x19d276,_0xc504ca[_0xff74('0x12')]['message']);return _0x217ffe(_0xc504ca[_0xff74('0x12')][_0xff74('0x15')]);}logger[_0xff74('0x12')](_0xff74('0x14'),_0x19d276,_0xc504ca[_0xff74('0x12')][_0xff74('0x15')]);return _0x298470(_0xc504ca[_0xff74('0x12')][_0xff74('0x15')]);}else{logger['info'](_0xff74('0x14'),_0x19d276,'request\x20sent');_0x298470(_0xc504ca['result'][_0xff74('0x15')]);}})['catch'](function(_0x10df6a){logger['error'](_0xff74('0x14'),_0x19d276,_0x10df6a);_0x217ffe(_0x10df6a);});});}exports['GetWhatsappQueue']=function(_0x31c243){var _0x22a375=this;return new Promise(function(_0x211941,_0x2e54c8){return db[_0xff74('0x16')][_0xff74('0x17')]({'raw':_0x31c243[_0xff74('0x18')]?_0x31c243[_0xff74('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x31c243['options']?_0x31c243[_0xff74('0x18')]['where']||null:null,'attributes':_0x31c243['options']?_0x31c243[_0xff74('0x18')][_0xff74('0x19')]||null:null,'limit':_0x31c243[_0xff74('0x18')]?_0x31c243[_0xff74('0x18')]['limit']||null:null,'include':_0x31c243[_0xff74('0x18')]?_0x31c243[_0xff74('0x18')][_0xff74('0x1a')]?_[_0xff74('0x1b')](_0x31c243[_0xff74('0x18')][_0xff74('0x1a')],function(_0x17be2c){return{'model':db[_0x17be2c[_0xff74('0x1c')]],'as':_0x17be2c['as'],'attributes':_0x17be2c[_0xff74('0x19')],'include':_0x17be2c[_0xff74('0x1a')]?_[_0xff74('0x1b')](_0x17be2c[_0xff74('0x1a')],function(_0x5c4fb0){return{'model':db[_0x5c4fb0['model']],'as':_0x5c4fb0['as'],'attributes':_0x5c4fb0['attributes'],'include':_0x5c4fb0[_0xff74('0x1a')]?_[_0xff74('0x1b')](_0x5c4fb0['include'],function(_0x119cd7){return{'model':db[_0x119cd7[_0xff74('0x1c')]],'as':_0x119cd7['as'],'attributes':_0x119cd7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x163bc4){logger[_0xff74('0x1d')](_0xff74('0x1e'),_0x31c243);logger[_0xff74('0x10')]('GetWhatsappQueue',_0x31c243,JSON['stringify'](_0x163bc4));_0x211941(_0x163bc4);})[_0xff74('0x1f')](function(_0x22bd57){logger[_0xff74('0x12')](_0xff74('0x1e'),_0x22bd57[_0xff74('0x15')],_0x31c243);_0x2e54c8(_0x22a375[_0xff74('0x12')](0x1f4,_0x22bd57[_0xff74('0x15')]));});});};exports[_0xff74('0x20')]=function(_0x4a2118){var _0x22fd61=this;return new Promise(function(_0x527c40,_0x32f715){return db[_0xff74('0x16')][_0xff74('0x21')]({'raw':_0x4a2118['options']?_0x4a2118[_0xff74('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a2118[_0xff74('0x18')]?_0x4a2118['options'][_0xff74('0x22')]||null:null,'attributes':_0x4a2118[_0xff74('0x18')]?_0x4a2118[_0xff74('0x18')][_0xff74('0x19')]||null:null,'include':_0x4a2118[_0xff74('0x18')]?_0x4a2118[_0xff74('0x18')][_0xff74('0x1a')]?_[_0xff74('0x1b')](_0x4a2118[_0xff74('0x18')][_0xff74('0x1a')],function(_0x3d4d24){return{'model':db[_0x3d4d24[_0xff74('0x1c')]],'as':_0x3d4d24['as'],'attributes':_0x3d4d24[_0xff74('0x19')],'include':_0x3d4d24[_0xff74('0x1a')]?_[_0xff74('0x1b')](_0x3d4d24[_0xff74('0x1a')],function(_0x1c9d5e){return{'model':db[_0x1c9d5e[_0xff74('0x1c')]],'as':_0x1c9d5e['as'],'attributes':_0x1c9d5e[_0xff74('0x19')],'include':_0x1c9d5e[_0xff74('0x1a')]?_[_0xff74('0x1b')](_0x1c9d5e[_0xff74('0x1a')],function(_0x37b70f){return{'model':db[_0x37b70f['model']],'as':_0x37b70f['as'],'attributes':_0x37b70f[_0xff74('0x19')]};}):[]};}):[]};}):[]:[]})[_0xff74('0xe')](function(_0x51b82f){logger[_0xff74('0x1d')]('ShowWhatsappQueue',_0x4a2118);logger[_0xff74('0x10')](_0xff74('0x20'),_0x4a2118,JSON[_0xff74('0x11')](_0x51b82f));_0x527c40(_0x51b82f);})[_0xff74('0x1f')](function(_0x1eb45f){logger[_0xff74('0x12')](_0xff74('0x20'),_0x1eb45f[_0xff74('0x15')],_0x4a2118);_0x32f715(_0x22fd61[_0xff74('0x12')](0x1f4,_0x1eb45f[_0xff74('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a6dc2e6..d68c830 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 _0x2867=['removeListener','register','length','./whatsappQueue.events','save','remove','update','emit'];(function(_0x6c220a,_0x1defaa){var _0x1071aa=function(_0x494413){while(--_0x494413){_0x6c220a['push'](_0x6c220a['shift']());}};_0x1071aa(++_0x1defaa);}(_0x2867,0x17b));var _0x7286=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0x2867[_0x4b775b];return _0xf84d39;};'use strict';var WhatsappQueueEvents=require(_0x7286('0x0'));var events=[_0x7286('0x1'),_0x7286('0x2'),_0x7286('0x3')];function createListener(_0x13b792,_0x25af77){return function(_0xc5586b){_0x25af77[_0x7286('0x4')](_0x13b792,_0xc5586b);};}function removeListener(_0x511424,_0x495e18){return function(){WhatsappQueueEvents[_0x7286('0x5')](_0x511424,_0x495e18);};}exports[_0x7286('0x6')]=function(_0x1148f3){for(var _0x3fc3c2=0x0,_0x1a3d9e=events[_0x7286('0x7')];_0x3fc3c2<_0x1a3d9e;_0x3fc3c2++){var _0x2a50d5=events[_0x3fc3c2];var _0x53d90d=createListener('whatsappQueue:'+_0x2a50d5,_0x1148f3);WhatsappQueueEvents['on'](_0x2a50d5,_0x53d90d);}}; \ No newline at end of file +var _0xbcc2=['update','emit','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x1e69c4,_0x38d44a){var _0x3d959d=function(_0x5ed6ca){while(--_0x5ed6ca){_0x1e69c4['push'](_0x1e69c4['shift']());}};_0x3d959d(++_0x38d44a);}(_0xbcc2,0xcd));var _0x2bcc=function(_0xb3166e,_0x50ae77){_0xb3166e=_0xb3166e-0x0;var _0x3b9dc6=_0xbcc2[_0xb3166e];return _0x3b9dc6;};'use strict';var WhatsappQueueEvents=require(_0x2bcc('0x0'));var events=[_0x2bcc('0x1'),_0x2bcc('0x2'),_0x2bcc('0x3')];function createListener(_0x3f9661,_0x40e5c4){return function(_0x3c36d7){_0x40e5c4[_0x2bcc('0x4')](_0x3f9661,_0x3c36d7);};}function removeListener(_0x3a5611,_0x33ecff){return function(){WhatsappQueueEvents['removeListener'](_0x3a5611,_0x33ecff);};}exports[_0x2bcc('0x5')]=function(_0x4a80ec){for(var _0x66fe2a=0x0,_0x5dc5db=events[_0x2bcc('0x6')];_0x66fe2a<_0x5dc5db;_0x66fe2a++){var _0x383d07=events[_0x66fe2a];var _0x15dc7e=createListener(_0x2bcc('0x7')+_0x383d07,_0x4a80ec);WhatsappQueueEvents['on'](_0x383d07,_0x15dc7e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e446128..bbe4fd0 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 _0x745c=['isAuthenticated','index','/describe','describe','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0x745c,0x1e4));var _0xc745=function(_0x2bc68d,_0x561c96){_0x2bc68d=_0x2bc68d-0x0;var _0x1eaca9=_0x745c[_0x2bc68d];return _0x1eaca9;};'use strict';var multer=require(_0xc745('0x0'));var util=require(_0xc745('0x1'));var path=require('path');var timeout=require(_0xc745('0x2'));var express=require(_0xc745('0x3'));var router=express[_0xc745('0x4')]();var auth=require(_0xc745('0x5'));var interaction=require(_0xc745('0x6'));var config=require(_0xc745('0x7'));var controller=require(_0xc745('0x8'));router[_0xc745('0x9')]('/',auth[_0xc745('0xa')](),controller[_0xc745('0xb')]);router[_0xc745('0x9')](_0xc745('0xc'),auth[_0xc745('0xa')](),controller[_0xc745('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc745('0xa')](),controller[_0xc745('0xe')]);router['put'](_0xc745('0xf'),auth[_0xc745('0xa')](),controller['update']);router[_0xc745('0x10')]('/:id',auth[_0xc745('0xa')](),controller[_0xc745('0x11')]);module[_0xc745('0x12')]=router; \ No newline at end of file +var _0x65cb=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x1985cf,_0x2df7fb){var _0x3d1e99=function(_0x442ac6){while(--_0x442ac6){_0x1985cf['push'](_0x1985cf['shift']());}};_0x3d1e99(++_0x2df7fb);}(_0x65cb,0xa4));var _0xb65c=function(_0x38d20a,_0x199e2e){_0x38d20a=_0x38d20a-0x0;var _0x54aa0f=_0x65cb[_0x38d20a];return _0x54aa0f;};'use strict';var multer=require(_0xb65c('0x0'));var util=require('util');var path=require(_0xb65c('0x1'));var timeout=require(_0xb65c('0x2'));var express=require(_0xb65c('0x3'));var router=express['Router']();var auth=require(_0xb65c('0x4'));var interaction=require(_0xb65c('0x5'));var config=require(_0xb65c('0x6'));var controller=require(_0xb65c('0x7'));router[_0xb65c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb65c('0x9')]);router[_0xb65c('0x8')](_0xb65c('0xa'),auth[_0xb65c('0xb')](),controller[_0xb65c('0xc')]);router[_0xb65c('0x8')](_0xb65c('0xd'),auth[_0xb65c('0xb')](),controller['show']);router[_0xb65c('0xe')]('/',auth[_0xb65c('0xb')](),controller[_0xb65c('0xf')]);router[_0xb65c('0x10')]('/:id',auth[_0xb65c('0xb')](),controller['update']);router[_0xb65c('0x11')](_0xb65c('0xd'),auth[_0xb65c('0xb')](),controller[_0xb65c('0x12')]);module[_0xb65c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3a1b09e..4722058 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x3154b2,_0x2e0ff6){var _0x430df2=function(_0x4e224c){while(--_0x4e224c){_0x3154b2['push'](_0x3154b2['shift']());}};_0x430df2(++_0x2e0ff6);}(_0x34e8,0x12c));var _0x834e=function(_0x59d132,_0x3de71a){_0x59d132=_0x59d132-0x0;var _0x2a4be1=_0x34e8[_0x59d132];return _0x2a4be1;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x2f2b93,_0x418c5c){var _0x2c2999=function(_0x54e31c){while(--_0x54e31c){_0x2f2b93['push'](_0x2f2b93['shift']());}};_0x2c2999(++_0x418c5c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x4b84[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index cac3da3..f028852 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 _0x1724=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','update','params','find','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type'];(function(_0x2ae099,_0x1d9376){var _0x2ce323=function(_0x2acab1){while(--_0x2acab1){_0x2ae099['push'](_0x2ae099['shift']());}};_0x2ce323(++_0x1d9376);}(_0x1724,0x145));var _0x4172=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x1724[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x4172('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4172('0x1'));var zipdir=require(_0x4172('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4172('0x3'));var moment=require(_0x4172('0x4'));var BPromise=require(_0x4172('0x5'));var Mustache=require(_0x4172('0x6'));var util=require('util');var path=require(_0x4172('0x7'));var sox=require(_0x4172('0x8'));var csv=require(_0x4172('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4172('0xa'));var squel=require(_0x4172('0xb'));var crypto=require(_0x4172('0xc'));var jsforce=require(_0x4172('0xd'));var deskjs=require(_0x4172('0xe'));var toCsv=require(_0x4172('0x9'));var querystring=require(_0x4172('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4172('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4172('0x11'));var hardwareService=require(_0x4172('0x12'));var logger=require(_0x4172('0x13'))(_0x4172('0x14'));var utils=require(_0x4172('0x15'));var config=require(_0x4172('0x16'));var licenseUtil=require(_0x4172('0x17'));var db=require(_0x4172('0x18'))['db'];function respondWithStatusCode(_0x195f1e,_0x1f1940){_0x1f1940=_0x1f1940||0xcc;return function(_0x3e8dda){if(_0x3e8dda){return _0x195f1e[_0x4172('0x19')](_0x1f1940);}return _0x195f1e['status'](_0x1f1940)[_0x4172('0x1a')]();};}function respondWithResult(_0x3bf07e,_0x578a42){_0x578a42=_0x578a42||0xc8;return function(_0x1caed7){if(_0x1caed7){return _0x3bf07e[_0x4172('0x1b')](_0x578a42)[_0x4172('0x1c')](_0x1caed7);}};}function respondWithFilteredResult(_0x4d69d9,_0x27ebdb){return function(_0x29b092){if(_0x29b092){var _0x4183c8=_0x29b092[_0x4172('0x1d')],_0x21af08=_0x27ebdb['offset'],_0x1ae4c4=_0x27ebdb[_0x4172('0x1e')]+_0x27ebdb[_0x4172('0x1f')],_0x30268b;if(_0x1ae4c4>=_0x4183c8){_0x1ae4c4=_0x4183c8;_0x30268b=0xc8;}else{_0x30268b=0xce;}_0x4d69d9[_0x4172('0x1b')](_0x30268b);return _0x4d69d9['set'](_0x4172('0x20'),_0x21af08+'-'+_0x1ae4c4+'/'+_0x4183c8)[_0x4172('0x1c')](_0x29b092);}return null;};}function patchUpdates(_0x481747){return function(_0x4e7b85){try{jsonpatch['apply'](_0x4e7b85,_0x481747,!![]);}catch(_0x5d128b){return BPromise['reject'](_0x5d128b);}return _0x4e7b85['save']();};}function saveUpdates(_0x3a1160,_0xa302a6){return function(_0x4a3ecc){if(_0x4a3ecc){return _0x4a3ecc['update'](_0x3a1160)['then'](function(_0x521490){return _0x521490;});}return null;};}function removeEntity(_0x2e50aa,_0x2194fe){return function(_0x52c9c2){if(_0x52c9c2){return _0x52c9c2[_0x4172('0x21')]()[_0x4172('0x22')](function(){_0x2e50aa[_0x4172('0x1b')](0xcc)[_0x4172('0x1a')]();});}};}function handleEntityNotFound(_0xeb9e08,_0x4a5e9b){return function(_0x3b9381){if(!_0x3b9381){_0xeb9e08[_0x4172('0x19')](0x194);}return _0x3b9381;};}function handleError(_0x1432e2,_0x26f978){_0x26f978=_0x26f978||0x1f4;return function(_0x4bdba1){logger[_0x4172('0x23')](_0x4bdba1[_0x4172('0x24')]);if(_0x4bdba1[_0x4172('0x25')]){delete _0x4bdba1['name'];}_0x1432e2[_0x4172('0x1b')](_0x26f978)[_0x4172('0x26')](_0x4bdba1);};}exports[_0x4172('0x27')]=function(_0x3a637f,_0x5c9ed3){var _0x565e87={},_0x7e987b={},_0x2ae292={'count':0x0,'rows':[]};var _0x342950=_[_0x4172('0x28')](db[_0x4172('0x29')][_0x4172('0x2a')],function(_0xaa5521){return{'name':_0xaa5521[_0x4172('0x2b')],'type':_0xaa5521[_0x4172('0x2c')][_0x4172('0x2d')]};});_0x7e987b[_0x4172('0x2e')]=_[_0x4172('0x28')](_0x342950,_0x4172('0x25'));_0x7e987b[_0x4172('0x2f')]=_[_0x4172('0x30')](_0x3a637f[_0x4172('0x2f')]);_0x7e987b['filters']=_[_0x4172('0x31')](_0x7e987b[_0x4172('0x2e')],_0x7e987b[_0x4172('0x2f')]);_0x565e87['attributes']=_[_0x4172('0x31')](_0x7e987b[_0x4172('0x2e')],qs[_0x4172('0x32')](_0x3a637f[_0x4172('0x2f')][_0x4172('0x32')]));_0x565e87['attributes']=_0x565e87[_0x4172('0x33')][_0x4172('0x34')]?_0x565e87[_0x4172('0x33')]:_0x7e987b['model'];if(!_0x3a637f[_0x4172('0x2f')][_0x4172('0x35')](_0x4172('0x36'))){_0x565e87[_0x4172('0x1f')]=qs[_0x4172('0x1f')](_0x3a637f[_0x4172('0x2f')]['limit']);_0x565e87[_0x4172('0x1e')]=qs[_0x4172('0x1e')](_0x3a637f[_0x4172('0x2f')]['offset']);}_0x565e87['order']=qs[_0x4172('0x37')](_0x3a637f[_0x4172('0x2f')][_0x4172('0x37')]);_0x565e87['where']=qs[_0x4172('0x38')](_[_0x4172('0x39')](_0x3a637f[_0x4172('0x2f')],_0x7e987b[_0x4172('0x38')]),_0x342950);if(_0x3a637f[_0x4172('0x2f')][_0x4172('0x3a')]){_0x565e87[_0x4172('0x3b')]=_[_0x4172('0x3c')](_0x565e87[_0x4172('0x3b')],{'$or':_['map'](_0x342950,function(_0x17bcb6){if(_0x17bcb6[_0x4172('0x2c')]!==_0x4172('0x3d')){var _0x483ed7={};_0x483ed7[_0x17bcb6['name']]={'$like':'%'+_0x3a637f[_0x4172('0x2f')][_0x4172('0x3a')]+'%'};return _0x483ed7;}})});}_0x565e87=_['merge']({},_0x565e87,_0x3a637f[_0x4172('0x3e')]);var _0x3cfc48={'where':_0x565e87[_0x4172('0x3b')]};return db[_0x4172('0x29')][_0x4172('0x1d')](_0x3cfc48)[_0x4172('0x22')](function(_0x150776){_0x2ae292[_0x4172('0x1d')]=_0x150776;if(_0x3a637f[_0x4172('0x2f')][_0x4172('0x3f')]){_0x565e87[_0x4172('0x40')]=[{'all':!![]}];}return db[_0x4172('0x29')][_0x4172('0x41')](_0x565e87);})[_0x4172('0x22')](function(_0x3b20cb){_0x2ae292[_0x4172('0x42')]=_0x3b20cb;return _0x2ae292;})['then'](respondWithFilteredResult(_0x5c9ed3,_0x565e87))[_0x4172('0x43')](handleError(_0x5c9ed3,null));};exports['show']=function(_0x41fc59,_0x44bcbc){var _0x35afb9={'raw':!![],'where':{'id':_0x41fc59['params']['id']}},_0x63fc96={};_0x63fc96[_0x4172('0x2e')]=_['keys'](db['WhatsappQueueReport'][_0x4172('0x2a')]);_0x63fc96[_0x4172('0x2f')]=_['keys'](_0x41fc59['query']);_0x63fc96[_0x4172('0x38')]=_[_0x4172('0x31')](_0x63fc96[_0x4172('0x2e')],_0x63fc96[_0x4172('0x2f')]);_0x35afb9[_0x4172('0x33')]=_[_0x4172('0x31')](_0x63fc96[_0x4172('0x2e')],qs['fields'](_0x41fc59[_0x4172('0x2f')][_0x4172('0x32')]));_0x35afb9[_0x4172('0x33')]=_0x35afb9[_0x4172('0x33')][_0x4172('0x34')]?_0x35afb9[_0x4172('0x33')]:_0x63fc96[_0x4172('0x2e')];if(_0x41fc59[_0x4172('0x2f')][_0x4172('0x3f')]){_0x35afb9['include']=[{'all':!![]}];}_0x35afb9=_['merge']({},_0x35afb9,_0x41fc59['options']);return db[_0x4172('0x29')]['find'](_0x35afb9)[_0x4172('0x22')](handleEntityNotFound(_0x44bcbc,null))['then'](respondWithResult(_0x44bcbc,null))['catch'](handleError(_0x44bcbc,null));};exports[_0x4172('0x44')]=function(_0x46d435,_0x35257c){return db[_0x4172('0x29')][_0x4172('0x44')](_0x46d435[_0x4172('0x45')],{})[_0x4172('0x22')](respondWithResult(_0x35257c,0xc9))['catch'](handleError(_0x35257c,null));};exports[_0x4172('0x46')]=function(_0x102bb0,_0x4b5881){if(_0x102bb0[_0x4172('0x45')]['id']){delete _0x102bb0[_0x4172('0x45')]['id'];}return db[_0x4172('0x29')]['find']({'where':{'id':_0x102bb0[_0x4172('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b5881,null))[_0x4172('0x22')](saveUpdates(_0x102bb0[_0x4172('0x45')],null))[_0x4172('0x22')](respondWithResult(_0x4b5881,null))[_0x4172('0x43')](handleError(_0x4b5881,null));};exports[_0x4172('0x21')]=function(_0x2f1be0,_0x558ee9){return db['WhatsappQueueReport'][_0x4172('0x48')]({'where':{'id':_0x2f1be0[_0x4172('0x47')]['id']}})[_0x4172('0x22')](handleEntityNotFound(_0x558ee9,null))[_0x4172('0x22')](removeEntity(_0x558ee9,null))[_0x4172('0x43')](handleError(_0x558ee9,null));};exports[_0x4172('0x49')]=function(_0x2806a4,_0x1309a2){return db['WhatsappQueueReport']['describe']()[_0x4172('0x22')](respondWithResult(_0x1309a2,null))[_0x4172('0x43')](handleError(_0x1309a2,null));}; \ No newline at end of file +var _0xd72e=['html-pdf','eml-format','fast-json-patch','moment','bluebird','util','path','jsforce','desk.js','to-csv','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','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x5c076f,_0x5eb4f4){var _0x3d014d=function(_0x402a1a){while(--_0x402a1a){_0x5c076f['push'](_0x5c076f['shift']());}};_0x3d014d(++_0x5eb4f4);}(_0xd72e,0x1f1));var _0xed72=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xd72e[_0x3d4ef1];return _0x409423;};'use strict';var pdf=require(_0xed72('0x0'));var emlformat=require(_0xed72('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed72('0x2'));var rp=require('request-promise');var moment=require(_0xed72('0x3'));var BPromise=require(_0xed72('0x4'));var Mustache=require('mustache');var util=require(_0xed72('0x5'));var path=require(_0xed72('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed72('0x7'));var deskjs=require(_0xed72('0x8'));var toCsv=require(_0xed72('0x9'));var querystring=require(_0xed72('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xed72('0xb'));var qs=require(_0xed72('0xc'));var as=require(_0xed72('0xd'));var hardwareService=require(_0xed72('0xe'));var logger=require(_0xed72('0xf'))(_0xed72('0x10'));var utils=require(_0xed72('0x11'));var config=require(_0xed72('0x12'));var licenseUtil=require(_0xed72('0x13'));var db=require(_0xed72('0x14'))['db'];function respondWithStatusCode(_0x2cb91e,_0x153865){_0x153865=_0x153865||0xcc;return function(_0x3b70cc){if(_0x3b70cc){return _0x2cb91e[_0xed72('0x15')](_0x153865);}return _0x2cb91e['status'](_0x153865)['end']();};}function respondWithResult(_0xa271d5,_0x3bb75a){_0x3bb75a=_0x3bb75a||0xc8;return function(_0x41e2ef){if(_0x41e2ef){return _0xa271d5[_0xed72('0x16')](_0x3bb75a)['json'](_0x41e2ef);}};}function respondWithFilteredResult(_0x15ae9b,_0x12c1a6){return function(_0x1a0965){if(_0x1a0965){var _0x4c2b09=_0x1a0965[_0xed72('0x17')],_0x4ab69f=_0x12c1a6['offset'],_0x2babf6=_0x12c1a6[_0xed72('0x18')]+_0x12c1a6[_0xed72('0x19')],_0x2c9538;if(_0x2babf6>=_0x4c2b09){_0x2babf6=_0x4c2b09;_0x2c9538=0xc8;}else{_0x2c9538=0xce;}_0x15ae9b['status'](_0x2c9538);return _0x15ae9b[_0xed72('0x1a')](_0xed72('0x1b'),_0x4ab69f+'-'+_0x2babf6+'/'+_0x4c2b09)[_0xed72('0x1c')](_0x1a0965);}return null;};}function patchUpdates(_0x5ae24a){return function(_0x163b84){try{jsonpatch[_0xed72('0x1d')](_0x163b84,_0x5ae24a,!![]);}catch(_0x5f3d84){return BPromise[_0xed72('0x1e')](_0x5f3d84);}return _0x163b84[_0xed72('0x1f')]();};}function saveUpdates(_0x38b3cc,_0x37e1a1){return function(_0x2c406c){if(_0x2c406c){return _0x2c406c[_0xed72('0x20')](_0x38b3cc)[_0xed72('0x21')](function(_0x4da4ad){return _0x4da4ad;});}return null;};}function removeEntity(_0x5b6674,_0x42d59f){return function(_0x52d33a){if(_0x52d33a){return _0x52d33a[_0xed72('0x22')]()[_0xed72('0x21')](function(){_0x5b6674[_0xed72('0x16')](0xcc)[_0xed72('0x23')]();});}};}function handleEntityNotFound(_0x5e1cc2,_0x44fdfa){return function(_0x474103){if(!_0x474103){_0x5e1cc2[_0xed72('0x15')](0x194);}return _0x474103;};}function handleError(_0x514e24,_0x1a6cfa){_0x1a6cfa=_0x1a6cfa||0x1f4;return function(_0x534012){logger['error'](_0x534012[_0xed72('0x24')]);if(_0x534012[_0xed72('0x25')]){delete _0x534012['name'];}_0x514e24[_0xed72('0x16')](_0x1a6cfa)['send'](_0x534012);};}exports[_0xed72('0x26')]=function(_0x5e6170,_0x49dd94){var _0x215162={},_0x56b6f7={},_0x2a8143={'count':0x0,'rows':[]};var _0x5f22ff=_['map'](db['WhatsappQueueReport'][_0xed72('0x27')],function(_0x57e24e){return{'name':_0x57e24e['fieldName'],'type':_0x57e24e[_0xed72('0x28')]['key']};});_0x56b6f7[_0xed72('0x29')]=_[_0xed72('0x2a')](_0x5f22ff,_0xed72('0x25'));_0x56b6f7[_0xed72('0x2b')]=_[_0xed72('0x2c')](_0x5e6170['query']);_0x56b6f7[_0xed72('0x2d')]=_[_0xed72('0x2e')](_0x56b6f7[_0xed72('0x29')],_0x56b6f7[_0xed72('0x2b')]);_0x215162[_0xed72('0x2f')]=_[_0xed72('0x2e')](_0x56b6f7[_0xed72('0x29')],qs['fields'](_0x5e6170[_0xed72('0x2b')][_0xed72('0x30')]));_0x215162[_0xed72('0x2f')]=_0x215162[_0xed72('0x2f')][_0xed72('0x31')]?_0x215162['attributes']:_0x56b6f7[_0xed72('0x29')];if(!_0x5e6170[_0xed72('0x2b')][_0xed72('0x32')](_0xed72('0x33'))){_0x215162[_0xed72('0x19')]=qs['limit'](_0x5e6170[_0xed72('0x2b')][_0xed72('0x19')]);_0x215162[_0xed72('0x18')]=qs[_0xed72('0x18')](_0x5e6170[_0xed72('0x2b')][_0xed72('0x18')]);}_0x215162[_0xed72('0x34')]=qs['sort'](_0x5e6170[_0xed72('0x2b')][_0xed72('0x35')]);_0x215162[_0xed72('0x36')]=qs[_0xed72('0x2d')](_[_0xed72('0x37')](_0x5e6170['query'],_0x56b6f7[_0xed72('0x2d')]),_0x5f22ff);if(_0x5e6170[_0xed72('0x2b')][_0xed72('0x38')]){_0x215162[_0xed72('0x36')]=_[_0xed72('0x39')](_0x215162[_0xed72('0x36')],{'$or':_['map'](_0x5f22ff,function(_0x4cfcc0){if(_0x4cfcc0[_0xed72('0x28')]!=='VIRTUAL'){var _0x170367={};_0x170367[_0x4cfcc0['name']]={'$like':'%'+_0x5e6170['query'][_0xed72('0x38')]+'%'};return _0x170367;}})});}_0x215162=_[_0xed72('0x39')]({},_0x215162,_0x5e6170[_0xed72('0x3a')]);var _0x237036={'where':_0x215162['where']};return db[_0xed72('0x3b')]['count'](_0x237036)['then'](function(_0x5d7a95){_0x2a8143[_0xed72('0x17')]=_0x5d7a95;if(_0x5e6170[_0xed72('0x2b')][_0xed72('0x3c')]){_0x215162[_0xed72('0x3d')]=[{'all':!![]}];}return db[_0xed72('0x3b')][_0xed72('0x3e')](_0x215162);})[_0xed72('0x21')](function(_0x54c247){_0x2a8143[_0xed72('0x3f')]=_0x54c247;return _0x2a8143;})[_0xed72('0x21')](respondWithFilteredResult(_0x49dd94,_0x215162))[_0xed72('0x40')](handleError(_0x49dd94,null));};exports[_0xed72('0x41')]=function(_0x17275a,_0x274432){var _0x25d7bb={'raw':!![],'where':{'id':_0x17275a[_0xed72('0x42')]['id']}},_0x3b79af={};_0x3b79af[_0xed72('0x29')]=_[_0xed72('0x2c')](db[_0xed72('0x3b')]['rawAttributes']);_0x3b79af[_0xed72('0x2b')]=_[_0xed72('0x2c')](_0x17275a[_0xed72('0x2b')]);_0x3b79af[_0xed72('0x2d')]=_[_0xed72('0x2e')](_0x3b79af[_0xed72('0x29')],_0x3b79af[_0xed72('0x2b')]);_0x25d7bb[_0xed72('0x2f')]=_[_0xed72('0x2e')](_0x3b79af[_0xed72('0x29')],qs[_0xed72('0x30')](_0x17275a['query'][_0xed72('0x30')]));_0x25d7bb['attributes']=_0x25d7bb[_0xed72('0x2f')]['length']?_0x25d7bb[_0xed72('0x2f')]:_0x3b79af[_0xed72('0x29')];if(_0x17275a[_0xed72('0x2b')][_0xed72('0x3c')]){_0x25d7bb[_0xed72('0x3d')]=[{'all':!![]}];}_0x25d7bb=_[_0xed72('0x39')]({},_0x25d7bb,_0x17275a['options']);return db[_0xed72('0x3b')][_0xed72('0x43')](_0x25d7bb)['then'](handleEntityNotFound(_0x274432,null))['then'](respondWithResult(_0x274432,null))[_0xed72('0x40')](handleError(_0x274432,null));};exports['create']=function(_0x236cf8,_0x533ef1){return db[_0xed72('0x3b')][_0xed72('0x44')](_0x236cf8[_0xed72('0x45')],{})[_0xed72('0x21')](respondWithResult(_0x533ef1,0xc9))[_0xed72('0x40')](handleError(_0x533ef1,null));};exports[_0xed72('0x20')]=function(_0x3f159a,_0x3ecb44){if(_0x3f159a[_0xed72('0x45')]['id']){delete _0x3f159a[_0xed72('0x45')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x3f159a['params']['id']}})[_0xed72('0x21')](handleEntityNotFound(_0x3ecb44,null))[_0xed72('0x21')](saveUpdates(_0x3f159a[_0xed72('0x45')],null))['then'](respondWithResult(_0x3ecb44,null))['catch'](handleError(_0x3ecb44,null));};exports[_0xed72('0x22')]=function(_0x2202da,_0x4e184c){return db[_0xed72('0x3b')][_0xed72('0x43')]({'where':{'id':_0x2202da['params']['id']}})['then'](handleEntityNotFound(_0x4e184c,null))[_0xed72('0x21')](removeEntity(_0x4e184c,null))[_0xed72('0x40')](handleError(_0x4e184c,null));};exports['describe']=function(_0x208434,_0x5d2f40){return db[_0xed72('0x3b')][_0xed72('0x46')]()[_0xed72('0x21')](respondWithResult(_0x5d2f40,null))[_0xed72('0x40')](handleError(_0x5d2f40,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cc5a564..c2515fa 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 _0x4052=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x4da749,_0x33272a){var _0x59afaf=function(_0xd43a97){while(--_0xd43a97){_0x4da749['push'](_0x4da749['shift']());}};_0x59afaf(++_0x33272a);}(_0x4052,0x133));var _0x2405=function(_0x277e5b,_0x3dad48){_0x277e5b=_0x277e5b-0x0;var _0x2683c7=_0x4052[_0x277e5b];return _0x2683c7;};'use strict';var _=require(_0x2405('0x0'));var util=require(_0x2405('0x1'));var logger=require('../../config/logger')(_0x2405('0x2'));var moment=require(_0x2405('0x3'));var BPromise=require(_0x2405('0x4'));var rp=require(_0x2405('0x5'));var fs=require('fs');var path=require(_0x2405('0x6'));var rimraf=require(_0x2405('0x7'));var config=require(_0x2405('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2405('0x9')]=function(_0x59045c,_0xc0eb10){return _0x59045c[_0x2405('0xa')](_0x2405('0xb'),attributes,{'tableName':_0x2405('0xc'),'paranoid':![],'indexes':[{'name':_0x2405('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae5=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f9ee0,_0x2152a2){var _0x4274b5=function(_0x4c72bd){while(--_0x4c72bd){_0x1f9ee0['push'](_0x1f9ee0['shift']());}};_0x4274b5(++_0x2152a2);}(_0x5ae5,0x92));var _0x55ae=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x5ae5[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0x55ae('0x0'));var util=require(_0x55ae('0x1'));var logger=require(_0x55ae('0x2'))(_0x55ae('0x3'));var moment=require(_0x55ae('0x4'));var BPromise=require(_0x55ae('0x5'));var rp=require(_0x55ae('0x6'));var fs=require('fs');var path=require(_0x55ae('0x7'));var rimraf=require('rimraf');var config=require(_0x55ae('0x8'));var attributes=require(_0x55ae('0x9'));module[_0x55ae('0xa')]=function(_0x22b353,_0x452ef1){return _0x22b353[_0x55ae('0xb')](_0x55ae('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x55ae('0xd'),'fields':[_0x55ae('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 24091cb..047a95d 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 _0xc5bf=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','stringify','catch','UpdateWhatsappQueueReport','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xc5bf,0x76));var _0xfc5b=function(_0x33a443,_0x25e83){_0x33a443=_0x33a443-0x0;var _0x577b7=_0xc5bf[_0x33a443];return _0x577b7;};'use strict';var _=require(_0xfc5b('0x0'));var util=require('util');var moment=require(_0xfc5b('0x1'));var BPromise=require(_0xfc5b('0x2'));var rs=require(_0xfc5b('0x3'));var fs=require('fs');var Redis=require(_0xfc5b('0x4'));var db=require(_0xfc5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc5b('0x6'))(_0xfc5b('0x7'));var config=require(_0xfc5b('0x8'));var jayson=require(_0xfc5b('0x9'));var client=jayson[_0xfc5b('0xa')][_0xfc5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45039a,_0x4842c2,_0x3cc3c8){return new BPromise(function(_0x21c787,_0x441c14){return client[_0xfc5b('0xc')](_0x45039a,_0x3cc3c8)[_0xfc5b('0xd')](function(_0x466cb0){logger[_0xfc5b('0xe')](_0xfc5b('0xf'),_0x4842c2,_0xfc5b('0x10'));logger[_0xfc5b('0x11')](_0xfc5b('0x12'),_0x4842c2,_0xfc5b('0x10'),JSON['stringify'](_0x466cb0));if(_0x466cb0[_0xfc5b('0x13')]){if(_0x466cb0[_0xfc5b('0x13')][_0xfc5b('0x14')]===0x1f4){logger[_0xfc5b('0x13')](_0xfc5b('0xf'),_0x4842c2,_0x466cb0[_0xfc5b('0x13')][_0xfc5b('0x15')]);return _0x441c14(_0x466cb0['error'][_0xfc5b('0x15')]);}logger[_0xfc5b('0x13')](_0xfc5b('0xf'),_0x4842c2,_0x466cb0[_0xfc5b('0x13')][_0xfc5b('0x15')]);return _0x21c787(_0x466cb0[_0xfc5b('0x13')]['message']);}else{logger['info'](_0xfc5b('0xf'),_0x4842c2,_0xfc5b('0x10'));_0x21c787(_0x466cb0[_0xfc5b('0x16')][_0xfc5b('0x15')]);}})['catch'](function(_0x1fbd97){logger[_0xfc5b('0x13')](_0xfc5b('0xf'),_0x4842c2,_0x1fbd97);_0x441c14(_0x1fbd97);});});}exports[_0xfc5b('0x17')]=function(_0x52c6cf){var _0x569a1e=this;return new Promise(function(_0x370065,_0x5abb68){return db[_0xfc5b('0x18')]['create'](_0x52c6cf['body'],{'raw':_0x52c6cf[_0xfc5b('0x19')]?_0x52c6cf['options'][_0xfc5b('0x1a')]===undefined?!![]:![]:!![]})[_0xfc5b('0xd')](function(_0x3f8a35){logger[_0xfc5b('0xe')](_0xfc5b('0x17'),_0x52c6cf);logger[_0xfc5b('0x11')](_0xfc5b('0x17'),_0x52c6cf,JSON[_0xfc5b('0x1b')](_0x3f8a35));_0x370065(_0x3f8a35);})[_0xfc5b('0x1c')](function(_0x599ec7){logger['error'](_0xfc5b('0x17'),_0x599ec7['message'],_0x52c6cf);_0x5abb68(_0x569a1e['error'](0x1f4,_0x599ec7[_0xfc5b('0x15')]));});});};exports[_0xfc5b('0x1d')]=function(_0xe5e5cf){var _0x2c46e1=this;return new Promise(function(_0x16bb8a,_0x28d1f6){return db[_0xfc5b('0x18')]['update'](_0xe5e5cf['body'],{'raw':_0xe5e5cf[_0xfc5b('0x19')]?_0xe5e5cf[_0xfc5b('0x19')][_0xfc5b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe5e5cf[_0xfc5b('0x19')]?_0xe5e5cf[_0xfc5b('0x19')][_0xfc5b('0x1e')]||null:null,'attributes':_0xe5e5cf[_0xfc5b('0x19')]?_0xe5e5cf[_0xfc5b('0x19')][_0xfc5b('0x1f')]||null:null,'limit':_0xe5e5cf[_0xfc5b('0x19')]?_0xe5e5cf[_0xfc5b('0x19')]['limit']||null:null})[_0xfc5b('0xd')](function(_0x471a6f){logger[_0xfc5b('0xe')](_0xfc5b('0x1d'),_0xe5e5cf);logger[_0xfc5b('0x11')]('UpdateWhatsappQueueReport',_0xe5e5cf,JSON[_0xfc5b('0x1b')](_0x471a6f));_0x16bb8a(_0x471a6f);})[_0xfc5b('0x1c')](function(_0x375fe7){logger[_0xfc5b('0x13')](_0xfc5b('0x1d'),_0x375fe7[_0xfc5b('0x15')],_0xe5e5cf);_0x28d1f6(_0x2c46e1[_0xfc5b('0x13')](0x1f4,_0x375fe7['message']));});});}; \ No newline at end of file +var _0x8de6=['raw','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','body','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueueReport','create','options'];(function(_0x5c1329,_0x44d752){var _0x282631=function(_0x92755d){while(--_0x92755d){_0x5c1329['push'](_0x5c1329['shift']());}};_0x282631(++_0x44d752);}(_0x8de6,0x147));var _0x68de=function(_0x5774af,_0x411c94){_0x5774af=_0x5774af-0x0;var _0x480589=_0x8de6[_0x5774af];return _0x480589;};'use strict';var _=require(_0x68de('0x0'));var util=require(_0x68de('0x1'));var moment=require('moment');var BPromise=require(_0x68de('0x2'));var rs=require(_0x68de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x68de('0x5'))(_0x68de('0x6'));var config=require(_0x68de('0x7'));var jayson=require(_0x68de('0x8'));var client=jayson[_0x68de('0x9')][_0x68de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x587765,_0x13707a,_0xc4b314){return new BPromise(function(_0x2a429e,_0x52e50a){return client[_0x68de('0xb')](_0x587765,_0xc4b314)[_0x68de('0xc')](function(_0x558319){logger[_0x68de('0xd')](_0x68de('0xe'),_0x13707a,_0x68de('0xf'));logger['debug'](_0x68de('0x10'),_0x13707a,_0x68de('0xf'),JSON[_0x68de('0x11')](_0x558319));if(_0x558319[_0x68de('0x12')]){if(_0x558319['error'][_0x68de('0x13')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x13707a,_0x558319[_0x68de('0x12')][_0x68de('0x14')]);return _0x52e50a(_0x558319[_0x68de('0x12')]['message']);}logger[_0x68de('0x12')](_0x68de('0xe'),_0x13707a,_0x558319[_0x68de('0x12')][_0x68de('0x14')]);return _0x2a429e(_0x558319[_0x68de('0x12')][_0x68de('0x14')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x13707a,_0x68de('0xf'));_0x2a429e(_0x558319[_0x68de('0x15')][_0x68de('0x14')]);}})['catch'](function(_0x23339f){logger[_0x68de('0x12')](_0x68de('0xe'),_0x13707a,_0x23339f);_0x52e50a(_0x23339f);});});}exports['CreateWhatsappQueueReport']=function(_0x55a9c7){var _0x40a067=this;return new Promise(function(_0x46ee42,_0x583c8d){return db[_0x68de('0x16')][_0x68de('0x17')](_0x55a9c7['body'],{'raw':_0x55a9c7[_0x68de('0x18')]?_0x55a9c7[_0x68de('0x18')][_0x68de('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x315ac7){logger[_0x68de('0xd')](_0x68de('0x1a'),_0x55a9c7);logger['debug'](_0x68de('0x1a'),_0x55a9c7,JSON['stringify'](_0x315ac7));_0x46ee42(_0x315ac7);})[_0x68de('0x1b')](function(_0xfaeb4d){logger[_0x68de('0x12')](_0x68de('0x1a'),_0xfaeb4d[_0x68de('0x14')],_0x55a9c7);_0x583c8d(_0x40a067[_0x68de('0x12')](0x1f4,_0xfaeb4d['message']));});});};exports[_0x68de('0x1c')]=function(_0x955621){var _0x310580=this;return new Promise(function(_0x59a3b5,_0x18a64c){return db['WhatsappQueueReport']['update'](_0x955621[_0x68de('0x1d')],{'raw':_0x955621[_0x68de('0x18')]?_0x955621['options'][_0x68de('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x955621[_0x68de('0x18')]?_0x955621[_0x68de('0x18')]['where']||null:null,'attributes':_0x955621[_0x68de('0x18')]?_0x955621[_0x68de('0x18')][_0x68de('0x1e')]||null:null,'limit':_0x955621['options']?_0x955621['options'][_0x68de('0x1f')]||null:null})[_0x68de('0xc')](function(_0x112615){logger[_0x68de('0xd')]('UpdateWhatsappQueueReport',_0x955621);logger['debug'](_0x68de('0x1c'),_0x955621,JSON[_0x68de('0x11')](_0x112615));_0x59a3b5(_0x112615);})[_0x68de('0x1b')](function(_0x453632){logger['error'](_0x68de('0x1c'),_0x453632['message'],_0x955621);_0x18a64c(_0x310580['error'](0x1f4,_0x453632[_0x68de('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 933b40f..6d55e3b 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 _0x6c33=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x342782,_0x4236e0){var _0xadb50c=function(_0x33ff6f){while(--_0x33ff6f){_0x342782['push'](_0x342782['shift']());}};_0xadb50c(++_0x4236e0);}(_0x6c33,0x82));var _0x36c3=function(_0x29c2bb,_0x1bde54){_0x29c2bb=_0x29c2bb-0x0;var _0x5446f1=_0x6c33[_0x29c2bb];return _0x5446f1;};'use strict';var multer=require(_0x36c3('0x0'));var util=require(_0x36c3('0x1'));var path=require(_0x36c3('0x2'));var timeout=require(_0x36c3('0x3'));var express=require(_0x36c3('0x4'));var router=express['Router']();var auth=require(_0x36c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x36c3('0x6'));var controller=require(_0x36c3('0x7'));router[_0x36c3('0x8')]('/',auth[_0x36c3('0x9')](),controller[_0x36c3('0xa')]);router[_0x36c3('0x8')](_0x36c3('0xb'),auth[_0x36c3('0x9')](),controller['describe']);router[_0x36c3('0x8')](_0x36c3('0xc'),auth[_0x36c3('0x9')](),controller[_0x36c3('0xd')]);router[_0x36c3('0xe')]('/',auth[_0x36c3('0x9')](),controller[_0x36c3('0xf')]);router[_0x36c3('0x10')](_0x36c3('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x36c3('0xc'),auth['isAuthenticated'](),controller[_0x36c3('0x11')]);module[_0x36c3('0x12')]=router; \ No newline at end of file +var _0x256a=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3f0b15,_0xb88473){var _0x38f95f=function(_0x3ee319){while(--_0x3ee319){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x38f95f(++_0xb88473);}(_0x256a,0x83));var _0xa256=function(_0xaf20fc,_0x890328){_0xaf20fc=_0xaf20fc-0x0;var _0x367f67=_0x256a[_0xaf20fc];return _0x367f67;};'use strict';var multer=require('multer');var util=require(_0xa256('0x0'));var path=require(_0xa256('0x1'));var timeout=require(_0xa256('0x2'));var express=require('express');var router=express[_0xa256('0x3')]();var auth=require(_0xa256('0x4'));var interaction=require(_0xa256('0x5'));var config=require(_0xa256('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xa256('0x7')]('/',auth[_0xa256('0x8')](),controller[_0xa256('0x9')]);router[_0xa256('0x7')](_0xa256('0xa'),auth[_0xa256('0x8')](),controller[_0xa256('0xb')]);router[_0xa256('0x7')](_0xa256('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa256('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa256('0xe')]);router[_0xa256('0xf')](_0xa256('0xc'),auth[_0xa256('0x8')](),controller[_0xa256('0x10')]);module[_0xa256('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 1f3c619..99b2cc3 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3c3ff59..5f6c335 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 _0x59e7=['end','status','json','count','offset','limit','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','params','length','includeAll','options','find','create','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x59e7,0x1ce));var _0x759e=function(_0x3deae2,_0x2bd6ea){_0x3deae2=_0x3deae2-0x0;var _0x52683c=_0x59e7[_0x3deae2];return _0x52683c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x759e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x759e('0x1'));var jsonpatch=require(_0x759e('0x2'));var rp=require(_0x759e('0x3'));var moment=require(_0x759e('0x4'));var BPromise=require(_0x759e('0x5'));var Mustache=require(_0x759e('0x6'));var util=require(_0x759e('0x7'));var path=require(_0x759e('0x8'));var sox=require('sox');var csv=require(_0x759e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x759e('0xa'));var squel=require(_0x759e('0xb'));var crypto=require(_0x759e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x759e('0xd'));var toCsv=require(_0x759e('0x9'));var querystring=require('querystring');var Papa=require(_0x759e('0xe'));var Redis=require('ioredis');var authService=require(_0x759e('0xf'));var qs=require(_0x759e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x759e('0x11'));var logger=require(_0x759e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x759e('0x13'));var licenseUtil=require(_0x759e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55c03f,_0x15c326){_0x15c326=_0x15c326||0xcc;return function(_0x1e19c5){if(_0x1e19c5){return _0x55c03f['sendStatus'](_0x15c326);}return _0x55c03f['status'](_0x15c326)[_0x759e('0x15')]();};}function respondWithResult(_0x4e103a,_0x1e481c){_0x1e481c=_0x1e481c||0xc8;return function(_0x194b33){if(_0x194b33){return _0x4e103a[_0x759e('0x16')](_0x1e481c)[_0x759e('0x17')](_0x194b33);}};}function respondWithFilteredResult(_0x350e74,_0x49f839){return function(_0x297548){if(_0x297548){var _0x5ea4d6=_0x297548[_0x759e('0x18')],_0x291689=_0x49f839[_0x759e('0x19')],_0x4b7a6d=_0x49f839[_0x759e('0x19')]+_0x49f839[_0x759e('0x1a')],_0x1eec02;if(_0x4b7a6d>=_0x5ea4d6){_0x4b7a6d=_0x5ea4d6;_0x1eec02=0xc8;}else{_0x1eec02=0xce;}_0x350e74[_0x759e('0x16')](_0x1eec02);return _0x350e74['set'](_0x759e('0x1b'),_0x291689+'-'+_0x4b7a6d+'/'+_0x5ea4d6)[_0x759e('0x17')](_0x297548);}return null;};}function patchUpdates(_0x35bfdb){return function(_0x397c6f){try{jsonpatch['apply'](_0x397c6f,_0x35bfdb,!![]);}catch(_0x356fa2){return BPromise[_0x759e('0x1c')](_0x356fa2);}return _0x397c6f[_0x759e('0x1d')]();};}function saveUpdates(_0x54060f,_0x47ca9d){return function(_0x68d00f){if(_0x68d00f){return _0x68d00f[_0x759e('0x1e')](_0x54060f)['then'](function(_0x53f047){return _0x53f047;});}return null;};}function removeEntity(_0xe64160,_0x5b8f85){return function(_0x562d49){if(_0x562d49){return _0x562d49['destroy']()[_0x759e('0x1f')](function(){_0xe64160[_0x759e('0x16')](0xcc)[_0x759e('0x15')]();});}};}function handleEntityNotFound(_0x137a16,_0x2d24c3){return function(_0x46f739){if(!_0x46f739){_0x137a16[_0x759e('0x20')](0x194);}return _0x46f739;};}function handleError(_0x266625,_0x580d8e){_0x580d8e=_0x580d8e||0x1f4;return function(_0x1a8fc6){logger[_0x759e('0x21')](_0x1a8fc6[_0x759e('0x22')]);if(_0x1a8fc6['name']){delete _0x1a8fc6[_0x759e('0x23')];}_0x266625[_0x759e('0x16')](_0x580d8e)[_0x759e('0x24')](_0x1a8fc6);};}exports[_0x759e('0x25')]=function(_0x5d00ae,_0x3ea0bc){var _0x3965e1={},_0x4fa18b={},_0x4bcfbd={'count':0x0,'rows':[]};var _0x4f6508=_['map'](db[_0x759e('0x26')][_0x759e('0x27')],function(_0x4b0300){return{'name':_0x4b0300[_0x759e('0x28')],'type':_0x4b0300['type'][_0x759e('0x29')]};});_0x4fa18b['model']=_['map'](_0x4f6508,_0x759e('0x23'));_0x4fa18b[_0x759e('0x2a')]=_[_0x759e('0x2b')](_0x5d00ae[_0x759e('0x2a')]);_0x4fa18b[_0x759e('0x2c')]=_[_0x759e('0x2d')](_0x4fa18b[_0x759e('0x2e')],_0x4fa18b[_0x759e('0x2a')]);_0x3965e1[_0x759e('0x2f')]=_['intersection'](_0x4fa18b[_0x759e('0x2e')],qs['fields'](_0x5d00ae[_0x759e('0x2a')][_0x759e('0x30')]));_0x3965e1[_0x759e('0x2f')]=_0x3965e1[_0x759e('0x2f')]['length']?_0x3965e1[_0x759e('0x2f')]:_0x4fa18b[_0x759e('0x2e')];if(!_0x5d00ae['query']['hasOwnProperty'](_0x759e('0x31'))){_0x3965e1[_0x759e('0x1a')]=qs[_0x759e('0x1a')](_0x5d00ae['query'][_0x759e('0x1a')]);_0x3965e1[_0x759e('0x19')]=qs['offset'](_0x5d00ae[_0x759e('0x2a')][_0x759e('0x19')]);}_0x3965e1[_0x759e('0x32')]=qs['sort'](_0x5d00ae['query'][_0x759e('0x33')]);_0x3965e1[_0x759e('0x34')]=qs[_0x759e('0x2c')](_[_0x759e('0x35')](_0x5d00ae['query'],_0x4fa18b[_0x759e('0x2c')]),_0x4f6508);if(_0x5d00ae[_0x759e('0x2a')][_0x759e('0x36')]){_0x3965e1['where']=_[_0x759e('0x37')](_0x3965e1[_0x759e('0x34')],{'$or':_[_0x759e('0x38')](_0x4f6508,function(_0x4d17b1){if(_0x4d17b1['type']!==_0x759e('0x39')){var _0x427b21={};_0x427b21[_0x4d17b1[_0x759e('0x23')]]={'$like':'%'+_0x5d00ae['query']['filter']+'%'};return _0x427b21;}})});}_0x3965e1=_[_0x759e('0x37')]({},_0x3965e1,_0x5d00ae['options']);var _0x4af8af={'where':_0x3965e1[_0x759e('0x34')]};return db[_0x759e('0x26')][_0x759e('0x18')](_0x4af8af)[_0x759e('0x1f')](function(_0x44d13f){_0x4bcfbd[_0x759e('0x18')]=_0x44d13f;if(_0x5d00ae['query']['includeAll']){_0x3965e1[_0x759e('0x3a')]=[{'all':!![]}];}return db[_0x759e('0x26')][_0x759e('0x3b')](_0x3965e1);})[_0x759e('0x1f')](function(_0x48c854){_0x4bcfbd[_0x759e('0x3c')]=_0x48c854;return _0x4bcfbd;})[_0x759e('0x1f')](respondWithFilteredResult(_0x3ea0bc,_0x3965e1))[_0x759e('0x3d')](handleError(_0x3ea0bc,null));};exports['show']=function(_0x19a363,_0x430b20){var _0x1b3ad2={'raw':!![],'where':{'id':_0x19a363[_0x759e('0x3e')]['id']}},_0x5eb59a={};_0x5eb59a[_0x759e('0x2e')]=_[_0x759e('0x2b')](db[_0x759e('0x26')][_0x759e('0x27')]);_0x5eb59a[_0x759e('0x2a')]=_['keys'](_0x19a363[_0x759e('0x2a')]);_0x5eb59a[_0x759e('0x2c')]=_[_0x759e('0x2d')](_0x5eb59a[_0x759e('0x2e')],_0x5eb59a[_0x759e('0x2a')]);_0x1b3ad2[_0x759e('0x2f')]=_[_0x759e('0x2d')](_0x5eb59a[_0x759e('0x2e')],qs[_0x759e('0x30')](_0x19a363[_0x759e('0x2a')][_0x759e('0x30')]));_0x1b3ad2['attributes']=_0x1b3ad2[_0x759e('0x2f')][_0x759e('0x3f')]?_0x1b3ad2['attributes']:_0x5eb59a['model'];if(_0x19a363['query'][_0x759e('0x40')]){_0x1b3ad2[_0x759e('0x3a')]=[{'all':!![]}];}_0x1b3ad2=_['merge']({},_0x1b3ad2,_0x19a363[_0x759e('0x41')]);return db[_0x759e('0x26')][_0x759e('0x42')](_0x1b3ad2)['then'](handleEntityNotFound(_0x430b20,null))[_0x759e('0x1f')](respondWithResult(_0x430b20,null))[_0x759e('0x3d')](handleError(_0x430b20,null));};exports[_0x759e('0x43')]=function(_0x233d68,_0x35b18b){return db[_0x759e('0x26')][_0x759e('0x43')](_0x233d68['body'],{})['then'](respondWithResult(_0x35b18b,0xc9))['catch'](handleError(_0x35b18b,null));};exports[_0x759e('0x1e')]=function(_0xcc3af4,_0x56d6be){if(_0xcc3af4['body']['id']){delete _0xcc3af4['body']['id'];}return db[_0x759e('0x26')]['find']({'where':{'id':_0xcc3af4['params']['id']}})['then'](handleEntityNotFound(_0x56d6be,null))[_0x759e('0x1f')](saveUpdates(_0xcc3af4['body'],null))['then'](respondWithResult(_0x56d6be,null))[_0x759e('0x3d')](handleError(_0x56d6be,null));};exports['destroy']=function(_0x411589,_0x357e8a){return db['WhatsappTransferReport'][_0x759e('0x42')]({'where':{'id':_0x411589['params']['id']}})[_0x759e('0x1f')](handleEntityNotFound(_0x357e8a,null))[_0x759e('0x1f')](removeEntity(_0x357e8a,null))[_0x759e('0x3d')](handleError(_0x357e8a,null));};exports[_0x759e('0x44')]=function(_0x3cce6,_0x2c37c4){return db[_0x759e('0x26')][_0x759e('0x44')]()[_0x759e('0x1f')](respondWithResult(_0x2c37c4,null))[_0x759e('0x3d')](handleError(_0x2c37c4,null));}; \ No newline at end of file +var _0x92e9=['WhatsappTransferReport','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','fields','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','map'];(function(_0x10a118,_0x53eb94){var _0x4677a3=function(_0x81f345){while(--_0x81f345){_0x10a118['push'](_0x10a118['shift']());}};_0x4677a3(++_0x53eb94);}(_0x92e9,0x104));var _0x992e=function(_0x830371,_0x39629f){_0x830371=_0x830371-0x0;var _0x103107=_0x92e9[_0x830371];return _0x103107;};'use strict';var pdf=require(_0x992e('0x0'));var emlformat=require(_0x992e('0x1'));var rimraf=require(_0x992e('0x2'));var zipdir=require(_0x992e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x992e('0x4'));var moment=require(_0x992e('0x5'));var BPromise=require(_0x992e('0x6'));var Mustache=require(_0x992e('0x7'));var util=require(_0x992e('0x8'));var path=require(_0x992e('0x9'));var sox=require(_0x992e('0xa'));var csv=require(_0x992e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x992e('0xc'));var squel=require(_0x992e('0xd'));var crypto=require('crypto');var jsforce=require(_0x992e('0xe'));var deskjs=require(_0x992e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x992e('0x10'));var Papa=require(_0x992e('0x11'));var Redis=require(_0x992e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x992e('0x13'));var as=require(_0x992e('0x14'));var hardwareService=require(_0x992e('0x15'));var logger=require(_0x992e('0x16'))(_0x992e('0x17'));var utils=require('../../config/utils');var config=require(_0x992e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x992e('0x19'))['db'];function respondWithStatusCode(_0xc6f8da,_0x2397d7){_0x2397d7=_0x2397d7||0xcc;return function(_0x3bd5bb){if(_0x3bd5bb){return _0xc6f8da[_0x992e('0x1a')](_0x2397d7);}return _0xc6f8da[_0x992e('0x1b')](_0x2397d7)['end']();};}function respondWithResult(_0x546d2f,_0xdfa245){_0xdfa245=_0xdfa245||0xc8;return function(_0x1e17af){if(_0x1e17af){return _0x546d2f['status'](_0xdfa245)[_0x992e('0x1c')](_0x1e17af);}};}function respondWithFilteredResult(_0x1d8298,_0x21d1f9){return function(_0x48285c){if(_0x48285c){var _0x3ead55=_0x48285c['count'],_0x219e29=_0x21d1f9[_0x992e('0x1d')],_0x5181ea=_0x21d1f9[_0x992e('0x1d')]+_0x21d1f9[_0x992e('0x1e')],_0x34ea0c;if(_0x5181ea>=_0x3ead55){_0x5181ea=_0x3ead55;_0x34ea0c=0xc8;}else{_0x34ea0c=0xce;}_0x1d8298[_0x992e('0x1b')](_0x34ea0c);return _0x1d8298[_0x992e('0x1f')](_0x992e('0x20'),_0x219e29+'-'+_0x5181ea+'/'+_0x3ead55)['json'](_0x48285c);}return null;};}function patchUpdates(_0x153155){return function(_0x440aad){try{jsonpatch[_0x992e('0x21')](_0x440aad,_0x153155,!![]);}catch(_0x32a235){return BPromise[_0x992e('0x22')](_0x32a235);}return _0x440aad[_0x992e('0x23')]();};}function saveUpdates(_0x474911,_0x3146d5){return function(_0x2759a8){if(_0x2759a8){return _0x2759a8[_0x992e('0x24')](_0x474911)['then'](function(_0x181280){return _0x181280;});}return null;};}function removeEntity(_0x9c8f31,_0x1c32d5){return function(_0x37649a){if(_0x37649a){return _0x37649a[_0x992e('0x25')]()[_0x992e('0x26')](function(){_0x9c8f31[_0x992e('0x1b')](0xcc)[_0x992e('0x27')]();});}};}function handleEntityNotFound(_0x4e7bb9,_0x49eaba){return function(_0x66b0c9){if(!_0x66b0c9){_0x4e7bb9[_0x992e('0x1a')](0x194);}return _0x66b0c9;};}function handleError(_0x56cbd3,_0x20caab){_0x20caab=_0x20caab||0x1f4;return function(_0x26c7b6){logger[_0x992e('0x28')](_0x26c7b6['stack']);if(_0x26c7b6[_0x992e('0x29')]){delete _0x26c7b6[_0x992e('0x29')];}_0x56cbd3[_0x992e('0x1b')](_0x20caab)[_0x992e('0x2a')](_0x26c7b6);};}exports['index']=function(_0x14aafa,_0x567486){var _0x428f90={},_0x169615={},_0x15dfcd={'count':0x0,'rows':[]};var _0x1915f9=_[_0x992e('0x2b')](db[_0x992e('0x2c')][_0x992e('0x2d')],function(_0x89f64c){return{'name':_0x89f64c['fieldName'],'type':_0x89f64c[_0x992e('0x2e')][_0x992e('0x2f')]};});_0x169615['model']=_[_0x992e('0x2b')](_0x1915f9,_0x992e('0x29'));_0x169615['query']=_[_0x992e('0x30')](_0x14aafa[_0x992e('0x31')]);_0x169615[_0x992e('0x32')]=_[_0x992e('0x33')](_0x169615[_0x992e('0x34')],_0x169615['query']);_0x428f90[_0x992e('0x35')]=_['intersection'](_0x169615[_0x992e('0x34')],qs['fields'](_0x14aafa[_0x992e('0x31')]['fields']));_0x428f90[_0x992e('0x35')]=_0x428f90[_0x992e('0x35')][_0x992e('0x36')]?_0x428f90[_0x992e('0x35')]:_0x169615['model'];if(!_0x14aafa[_0x992e('0x31')][_0x992e('0x37')](_0x992e('0x38'))){_0x428f90[_0x992e('0x1e')]=qs[_0x992e('0x1e')](_0x14aafa[_0x992e('0x31')]['limit']);_0x428f90[_0x992e('0x1d')]=qs['offset'](_0x14aafa['query'][_0x992e('0x1d')]);}_0x428f90['order']=qs[_0x992e('0x39')](_0x14aafa['query'][_0x992e('0x39')]);_0x428f90['where']=qs[_0x992e('0x32')](_[_0x992e('0x3a')](_0x14aafa[_0x992e('0x31')],_0x169615[_0x992e('0x32')]),_0x1915f9);if(_0x14aafa[_0x992e('0x31')][_0x992e('0x3b')]){_0x428f90[_0x992e('0x3c')]=_['merge'](_0x428f90[_0x992e('0x3c')],{'$or':_[_0x992e('0x2b')](_0x1915f9,function(_0x9728e7){if(_0x9728e7[_0x992e('0x2e')]!==_0x992e('0x3d')){var _0x5baa8f={};_0x5baa8f[_0x9728e7[_0x992e('0x29')]]={'$like':'%'+_0x14aafa[_0x992e('0x31')][_0x992e('0x3b')]+'%'};return _0x5baa8f;}})});}_0x428f90=_[_0x992e('0x3e')]({},_0x428f90,_0x14aafa[_0x992e('0x3f')]);var _0x1d16a0={'where':_0x428f90[_0x992e('0x3c')]};return db[_0x992e('0x2c')][_0x992e('0x40')](_0x1d16a0)[_0x992e('0x26')](function(_0x53c5d7){_0x15dfcd[_0x992e('0x40')]=_0x53c5d7;if(_0x14aafa['query'][_0x992e('0x41')]){_0x428f90[_0x992e('0x42')]=[{'all':!![]}];}return db[_0x992e('0x2c')][_0x992e('0x43')](_0x428f90);})[_0x992e('0x26')](function(_0x64d9b1){_0x15dfcd[_0x992e('0x44')]=_0x64d9b1;return _0x15dfcd;})[_0x992e('0x26')](respondWithFilteredResult(_0x567486,_0x428f90))[_0x992e('0x45')](handleError(_0x567486,null));};exports[_0x992e('0x46')]=function(_0x4eda62,_0x46babb){var _0xcb7b65={'raw':!![],'where':{'id':_0x4eda62['params']['id']}},_0x1fc57e={};_0x1fc57e[_0x992e('0x34')]=_['keys'](db[_0x992e('0x2c')][_0x992e('0x2d')]);_0x1fc57e[_0x992e('0x31')]=_[_0x992e('0x30')](_0x4eda62[_0x992e('0x31')]);_0x1fc57e[_0x992e('0x32')]=_['intersection'](_0x1fc57e[_0x992e('0x34')],_0x1fc57e['query']);_0xcb7b65[_0x992e('0x35')]=_[_0x992e('0x33')](_0x1fc57e['model'],qs['fields'](_0x4eda62[_0x992e('0x31')][_0x992e('0x47')]));_0xcb7b65[_0x992e('0x35')]=_0xcb7b65[_0x992e('0x35')]['length']?_0xcb7b65['attributes']:_0x1fc57e[_0x992e('0x34')];if(_0x4eda62[_0x992e('0x31')][_0x992e('0x41')]){_0xcb7b65[_0x992e('0x42')]=[{'all':!![]}];}_0xcb7b65=_[_0x992e('0x3e')]({},_0xcb7b65,_0x4eda62['options']);return db[_0x992e('0x2c')]['find'](_0xcb7b65)[_0x992e('0x26')](handleEntityNotFound(_0x46babb,null))[_0x992e('0x26')](respondWithResult(_0x46babb,null))['catch'](handleError(_0x46babb,null));};exports['create']=function(_0x4c43e3,_0x19c512){return db['WhatsappTransferReport']['create'](_0x4c43e3['body'],{})[_0x992e('0x26')](respondWithResult(_0x19c512,0xc9))[_0x992e('0x45')](handleError(_0x19c512,null));};exports['update']=function(_0x323c65,_0x2fc34a){if(_0x323c65[_0x992e('0x48')]['id']){delete _0x323c65[_0x992e('0x48')]['id'];}return db[_0x992e('0x2c')][_0x992e('0x49')]({'where':{'id':_0x323c65[_0x992e('0x4a')]['id']}})[_0x992e('0x26')](handleEntityNotFound(_0x2fc34a,null))[_0x992e('0x26')](saveUpdates(_0x323c65['body'],null))[_0x992e('0x26')](respondWithResult(_0x2fc34a,null))['catch'](handleError(_0x2fc34a,null));};exports[_0x992e('0x25')]=function(_0x37b2ac,_0x25367a){return db[_0x992e('0x2c')][_0x992e('0x49')]({'where':{'id':_0x37b2ac[_0x992e('0x4a')]['id']}})[_0x992e('0x26')](handleEntityNotFound(_0x25367a,null))[_0x992e('0x26')](removeEntity(_0x25367a,null))[_0x992e('0x45')](handleError(_0x25367a,null));};exports[_0x992e('0x4b')]=function(_0x1bd1c3,_0x381b44){return db[_0x992e('0x2c')]['describe']()[_0x992e('0x26')](respondWithResult(_0x381b44,null))[_0x992e('0x45')](handleError(_0x381b44,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f2bc5bf..6b7cb5c 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 _0x3f39=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer'];(function(_0x3aa6a0,_0x15bc91){var _0x5c2602=function(_0x48a9f4){while(--_0x48a9f4){_0x3aa6a0['push'](_0x3aa6a0['shift']());}};_0x5c2602(++_0x15bc91);}(_0x3f39,0x155));var _0x93f3=function(_0xb44f2b,_0x1bd47b){_0xb44f2b=_0xb44f2b-0x0;var _0x2fa30b=_0x3f39[_0xb44f2b];return _0x2fa30b;};'use strict';var _=require(_0x93f3('0x0'));var util=require(_0x93f3('0x1'));var logger=require(_0x93f3('0x2'))(_0x93f3('0x3'));var moment=require('moment');var BPromise=require(_0x93f3('0x4'));var rp=require(_0x93f3('0x5'));var fs=require('fs');var path=require(_0x93f3('0x6'));var rimraf=require(_0x93f3('0x7'));var config=require('../../config/environment');var attributes=require(_0x93f3('0x8'));module[_0x93f3('0x9')]=function(_0x2dccbf,_0x76a85e){return _0x2dccbf['define']('WhatsappTransferReport',attributes,{'tableName':_0x93f3('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef0=['request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3bdb25,_0x2cb937){var _0x3445d2=function(_0x53297d){while(--_0x53297d){_0x3bdb25['push'](_0x3bdb25['shift']());}};_0x3445d2(++_0x2cb937);}(_0x0ef0,0x1d0));var _0x00ef=function(_0x1222fa,_0x39a7b9){_0x1222fa=_0x1222fa-0x0;var _0x1dcd74=_0x0ef0[_0x1222fa];return _0x1dcd74;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var logger=require(_0x00ef('0x2'))('api');var moment=require(_0x00ef('0x3'));var BPromise=require('bluebird');var rp=require(_0x00ef('0x4'));var fs=require('fs');var path=require(_0x00ef('0x5'));var rimraf=require(_0x00ef('0x6'));var config=require('../../config/environment');var attributes=require(_0x00ef('0x7'));module[_0x00ef('0x8')]=function(_0x134545,_0x3b2bb9){return _0x134545['define'](_0x00ef('0x9'),attributes,{'tableName':_0x00ef('0xa'),'paranoid':![],'indexes':[{'name':_0x00ef('0xb'),'fields':[_0x00ef('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 32adbc5..b3c8581 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(_0xc19c4b,_0x44fc4a){var _0x38e976=function(_0x583a72){while(--_0x583a72){_0xc19c4b['push'](_0xc19c4b['shift']());}};_0x38e976(++_0x44fc4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0xb46adf,_0x5a181d){var _0x1965fd=function(_0x19bad6){while(--_0x19bad6){_0xb46adf['push'](_0xb46adf['shift']());}};_0x1965fd(++_0x5a181d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 6829d60..603af83 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1f8=['seedDB','./config/seedDB','default','./config/license','catch','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','filter','online','name','Offline\x20apps:','map','status','join','None'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xd1f8,0x18e));var _0x8d1f=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xd1f8[_0xe5b349];return _0x26b0ad;};'use strict';var _=require(_0x8d1f('0x0'));var mysqldb=require(_0x8d1f('0x1'));var rpc=require(_0x8d1f('0x2'));var config=require(_0x8d1f('0x3'));var logger=require('./config/logger')(_0x8d1f('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x8d1f('0x5'));var schedule=require('./config/schedule');var chat=require(_0x8d1f('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8d1f('0x7'));function main(){return mysqldb['db'][_0x8d1f('0x8')]['sync']()[_0x8d1f('0x9')](function(){return rpc[_0x8d1f('0xa')]();})[_0x8d1f('0x9')](function(_0x264094){logger[_0x8d1f('0xb')](_0x264094);return chat['start']();})[_0x8d1f('0x9')](function(){return whatsapp[_0x8d1f('0xc')]();})['then'](function(){return schedule[_0x8d1f('0xc')]();})[_0x8d1f('0x9')](function(){return transcribe[_0x8d1f('0xc')]();})[_0x8d1f('0x9')](function(_0x10891a){logger['info'](_0x10891a);return pm2['start'](pm2Config);})[_0x8d1f('0x9')](function(_0x525334){logger[_0x8d1f('0xb')](_0x8d1f('0xd'),_['map'](_[_0x8d1f('0xe')](_0x525334,{'status':_0x8d1f('0xf')}),_0x8d1f('0x10'))['join']());logger[_0x8d1f('0xb')](_0x8d1f('0x11'),_[_0x8d1f('0x12')](_[_0x8d1f('0xe')](_0x525334,function(_0x63f46a){return _0x63f46a[_0x8d1f('0x13')]!==_0x8d1f('0xf');}),_0x8d1f('0x10'))[_0x8d1f('0x14')]()||_0x8d1f('0x15'));config[_0x8d1f('0x16')]&&require(_0x8d1f('0x17'))[_0x8d1f('0x18')]();require(_0x8d1f('0x19'))[_0x8d1f('0x18')]();})[_0x8d1f('0x1a')](function(_0x3fc761){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3fc761);process[_0x8d1f('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x34bd=['online','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','listen','then','info','start','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status'];(function(_0x2f038f,_0x330055){var _0x5e5ff2=function(_0x4be163){while(--_0x4be163){_0x2f038f['push'](_0x2f038f['shift']());}};_0x5e5ff2(++_0x330055);}(_0x34bd,0x1d2));var _0xd34b=function(_0x2a573d,_0x284675){_0x2a573d=_0x2a573d-0x0;var _0x370c3f=_0x34bd[_0x2a573d];return _0x370c3f;};'use strict';var _=require(_0xd34b('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xd34b('0x1'));var logger=require(_0xd34b('0x2'))(_0xd34b('0x3'));var pm2=require(_0xd34b('0x4'));var pm2Config=require(_0xd34b('0x5'));var schedule=require(_0xd34b('0x6'));var chat=require(_0xd34b('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd34b('0x8'));function main(){return mysqldb['db']['sequelize']['sync']()['then'](function(){return rpc[_0xd34b('0x9')]();})[_0xd34b('0xa')](function(_0xf51a08){logger[_0xd34b('0xb')](_0xf51a08);return chat[_0xd34b('0xc')]();})[_0xd34b('0xa')](function(){return whatsapp[_0xd34b('0xc')]();})[_0xd34b('0xa')](function(){return schedule[_0xd34b('0xc')]();})[_0xd34b('0xa')](function(){return transcribe[_0xd34b('0xc')]();})[_0xd34b('0xa')](function(_0x596cce){logger[_0xd34b('0xb')](_0x596cce);return pm2['start'](pm2Config);})[_0xd34b('0xa')](function(_0x2e0e8c){logger[_0xd34b('0xb')](_0xd34b('0xd'),_[_0xd34b('0xe')](_[_0xd34b('0xf')](_0x2e0e8c,{'status':'online'}),_0xd34b('0x10'))[_0xd34b('0x11')]());logger['info'](_0xd34b('0x12'),_[_0xd34b('0xe')](_[_0xd34b('0xf')](_0x2e0e8c,function(_0x494105){return _0x494105[_0xd34b('0x13')]!==_0xd34b('0x14');}),'name')[_0xd34b('0x11')]()||'None');config[_0xd34b('0x15')]&&require(_0xd34b('0x16'))[_0xd34b('0x17')]();require('./config/license')[_0xd34b('0x17')]();})[_0xd34b('0x18')](function(_0x1bbbb1){logger[_0xd34b('0x19')](_0xd34b('0x1a'),_0x1bbbb1);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 e10af93..fc6552f 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 _0x88a7=['apikey','User','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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','decryptString','length','splice','encryptString','join','promisify','options','floor','now','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','basic-auth','crypto','util','moment','secrets','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid'];(function(_0x1893b9,_0x47f536){var _0x416fc6=function(_0x398291){while(--_0x398291){_0x1893b9['push'](_0x1893b9['shift']());}};_0x416fc6(++_0x47f536);}(_0x88a7,0x198));var _0x788a=function(_0x4bd64d,_0x3c2b8a){_0x4bd64d=_0x4bd64d-0x0;var _0x37db2d=_0x88a7[_0x4bd64d];return _0x37db2d;};'use strict';var db=require(_0x788a('0x0'))['db'];var config=require(_0x788a('0x1'));var hardwareConf=require(_0x788a('0x2'));var licenseUtil=require(_0x788a('0x3'));var encryptor=require(_0x788a('0x4'));var _=require('lodash');var jwt=require(_0x788a('0x5'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x788a('0x6'));var crypto=require(_0x788a('0x7'));var BPromise=require('bluebird');var util=require(_0x788a('0x8'));var moment=require(_0x788a('0x9'));var validateJwt=expressJwt({'secret':config[_0x788a('0xa')][_0x788a('0xb')]});var userAttributes=['id',_0x788a('0xc'),_0x788a('0xd'),_0x788a('0xe'),_0x788a('0xf'),_0x788a('0x10'),'userpic',_0x788a('0x11'),_0x788a('0x12'),_0x788a('0x13'),_0x788a('0x14'),_0x788a('0x15'),_0x788a('0x16'),_0x788a('0x17'),'openchannelPause',_0x788a('0x18'),'showWebBar',_0x788a('0x19'),_0x788a('0x1a'),_0x788a('0x1b'),'allowmessenger',_0x788a('0x1c'),_0x788a('0x1d'),_0x788a('0x1e'),_0x788a('0x1f'),_0x788a('0x20'),_0x788a('0x21'),_0x788a('0x22'),_0x788a('0x23'),_0x788a('0x24'),_0x788a('0x25'),'phoneBarRemoteControl',_0x788a('0x26'),_0x788a('0x27'),_0x788a('0x28'),_0x788a('0x29'),_0x788a('0x2a')];exports[_0x788a('0x2b')]=function(){return this[_0x788a('0x2c')](!![])[_0x788a('0x2d')](function(_0x16d316,_0x17ea29,_0x100c35){if(_0x16d316[_0x788a('0x2e')]){_0x100c35();}else{return db[_0x788a('0x2f')][_0x788a('0x30')]({'where':{'id':_0x16d316[_0x788a('0x31')]['id']},'attributes':['id','closed',_0x788a('0x32')],'raw':!![]})[_0x788a('0x33')](function(_0x414cc3){if(_0x414cc3&&_0x414cc3['closed']){return _0x17ea29[_0x788a('0x34')](_0x414cc3[_0x788a('0x32')]===_0x788a('0x35')?0x195:0x193)['json']({'message':_0x414cc3[_0x788a('0x32')]==='unmanaged'?_0x788a('0x36'):_0x788a('0x37')});}else{_0x100c35();}})[_0x788a('0x38')](function(_0x156401){_0x100c35(_0x156401);});}});};exports[_0x788a('0x2c')]=function isAuthenticated(_0x20a715){return compose()[_0x788a('0x2d')](function(_0xec4c19,_0x5b3012,_0x3014f2){var _0x4f644a;if(_0xec4c19[_0x788a('0x39')][_0x788a('0x3a')]){if(_[_0x788a('0x3b')](_0xec4c19['headers']['authorization'],_0x788a('0x3c'))){var _0x138adf=basicAuth(_0xec4c19);db['User'][_0x788a('0x3d')]({'where':{'name':_0x138adf[_0x788a('0xe')]}})[_0x788a('0x33')](function(_0x567b7c){if(!_0x567b7c||!_0x567b7c['authenticate'](_0x138adf['pass'])){return _0x5b3012[_0x788a('0x34')](0x191)[_0x788a('0x3e')]({'message':_0x788a('0x3f')});}_0xec4c19[_0x788a('0x2e')]={'id':_0x567b7c['id']};_0x3014f2();})[_0x788a('0x38')](function(_0x4f8d6d){_0x3014f2(_0x4f8d6d);});}else if(_['startsWith'](_0xec4c19[_0x788a('0x39')][_0x788a('0x3a')],_0x788a('0x40'))){validateJwt(_0xec4c19,_0x5b3012,_0x3014f2);}else{if(_0x20a715){_0x3014f2();}else{return _0x5b3012['status'](0x193)[_0x788a('0x3e')]({'message':_0x788a('0x41')});}}}else if(_0xec4c19[_0x788a('0x42')]['apikey']){try{var _0x33ed7e={'audience':hardwareConf[_0x788a('0x43')](),'issuer':hardwareConf[_0x788a('0x43')]()};verifyJwt(_0xec4c19[_0x788a('0x42')][_0x788a('0x44')],_0x33ed7e)[_0x788a('0x33')](function(_0x57fa88){return db[_0x788a('0x45')]['find']({'where':{'id':_0x57fa88['sub']}})[_0x788a('0x33')](function(_0x3a16ff){_0x4f644a=_0x3a16ff;return db[_0x788a('0x46')][_0x788a('0x30')]({'where':{'id':0x1},'attributes':[_0x788a('0x47'),_0x788a('0x48')],'raw':!![]});})[_0x788a('0x33')](function(_0x4c7597){if(!_0x4f644a||!_[_0x788a('0x49')](_0x4f644a['apiKeyNonce'],_0x57fa88[_0x788a('0x4a')])){return _0x5b3012[_0x788a('0x34')](0x191)[_0x788a('0x3e')]({'message':_0x788a('0x4b')});}if(_0x4f644a['disabled']){return _0x5b3012[_0x788a('0x34')](0x191)[_0x788a('0x3e')]({'message':_0x788a('0x4c')});}if(_0x4f644a['blocked']){if(_0x4c7597[_0x788a('0x48')]>0x0){if(moment(_0x4f644a[_0x788a('0x4d')])['add'](_0x4c7597[_0x788a('0x48')],_0x788a('0x4e'))>moment()){return _0x5b3012[_0x788a('0x34')](0x191)[_0x788a('0x3e')]({'message':_0x788a('0x4c')});}}else{return _0x5b3012[_0x788a('0x34')](0x191)[_0x788a('0x3e')]({'message':_0x788a('0x4c')});}}_0xec4c19[_0x788a('0x2e')]={'id':_0x4f644a['id']};_0x3014f2();});})[_0x788a('0x38')](function(){return _0x5b3012[_0x788a('0x34')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x15b071){_0x3014f2(_0x15b071);}}else if(_0x20a715){_0x3014f2();}else{return _0x5b3012[_0x788a('0x34')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x788a('0x2d')](function(_0x207d1f,_0x297e75,_0x537517){if(_0x207d1f[_0x788a('0x2e')]){db[_0x788a('0x45')][_0x788a('0x3d')]({'where':{'id':_0x207d1f['user']['id']},'attributes':userAttributes})[_0x788a('0x33')](function(_0x35c493){if(!_0x35c493){return _0x297e75[_0x788a('0x34')](0x194)[_0x788a('0x3e')]({'message':_0x788a('0x4f')});}_0x207d1f[_0x788a('0x2e')]=_0x35c493;_0x537517();})[_0x788a('0x38')](function(_0x145007){_0x537517(_0x145007);});}else if(_0x20a715){_0x537517();}else{return _0x297e75[_0x788a('0x34')](0x194)[_0x788a('0x3e')]({'message':_0x788a('0x50')});}});};exports[_0x788a('0x51')]=function canUpdate(){return compose()[_0x788a('0x2d')](function(_0x24d14e,_0x22c824,_0x269375){return licenseUtil['getLicense']()['then'](function(_0x4c4ad0){if(_0x4c4ad0[_0x788a('0x52')]){_0x269375();}else{return _0x22c824['status'](0x193)['json']({'message':_0x788a('0x53')});}})['catch'](function(_0x2b864d){_0x269375(_0x2b864d);});});};exports['isMiddleware']=function(_0x34151b,_0x4eefd6,_0x3be364){_0x34151b[_0x788a('0x54')]=!![];return _0x3be364();};exports[_0x788a('0x55')]=function signToken(_0x441697){return signJwt(_0x441697);};exports[_0x788a('0x56')]=function(_0x4b9b5f,_0x704e0c){if(!_0x4b9b5f[_0x788a('0x2e')]){return _0x704e0c[_0x788a('0x34')](0x194)[_0x788a('0x3e')]({'message':_0x788a('0x57')});}var _0x17a998={'payload':{'id':_0x4b9b5f[_0x788a('0x2e')]['id'],'role':_0x4b9b5f[_0x788a('0x2e')][_0x788a('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x17a998)['then'](function(_0x149a0d){_0x704e0c[_0x788a('0x58')](_0x788a('0x59'),_0x149a0d);_0x704e0c[_0x788a('0x5a')](_0x788a('0x5b'));})[_0x788a('0x38')](function(_0xc18eb6){return _0x704e0c[_0x788a('0x34')](0x1f4)[_0x788a('0x5c')](_0xc18eb6);});};exports[_0x788a('0x5d')]=function(_0x329ac1){if(_['isNil'](_0x329ac1[_0x788a('0x5e')])||_[_0x788a('0x5f')](_0x329ac1[_0x788a('0x60')])){return null;}else{return createJwt(_0x329ac1);}};exports['generateApiKey']=function(_0x537013){_0x537013[_0x788a('0x5e')]=generateNonce();_0x537013[_0x788a('0x60')]=generateIssuedAt();return createJwt(_0x537013);};exports[_0x788a('0x61')]=function(_0x5420e5,_0x201705){var _0x3caf3a=_0x5420e5[_0x788a('0x42')][_0x788a('0x44')];if(_0x3caf3a){var _0x4269da={'nonce':_0x201705[_0x788a('0x5e')],'iat':_0x201705[_0x788a('0x60')],'audience':hardwareConf[_0x788a('0x43')](),'issuer':hardwareConf[_0x788a('0x43')]()};return verifyJwt(_0x3caf3a,_0x4269da)[_0x788a('0x33')](function(){return generateApiKey(_0x201705);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x788a('0x62')]=function(_0x5ed804){var _0x22cc73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x22cc73[_0x788a('0x63')](_0x5ed804))throw new db[(_0x788a('0x64'))]['ValidationError'](_0x788a('0x65'));return;};exports['validatePasswordHistory']=function(_0x334616,_0x107303,_0x4a514e){var _0x12fd63=encryptor['decryptString'](_0x107303)[_0x788a('0x66')](',');for(var _0x105f24=0x0;_0x105f24<_0x4a514e;_0x105f24++){if(!_0x12fd63[_0x105f24])break;if(_0x334616[_0x788a('0x67')]()===_0x12fd63[_0x105f24][_0x788a('0x67')]()){var _0x103d42=util[_0x788a('0x68')](_0x788a('0x69'),_0x4a514e);if(_0x4a514e===0x1){_0x103d42=_0x788a('0x6a');}throw new db[(_0x788a('0x64'))]['ValidationError'](_0x103d42);}}return;};exports[_0x788a('0x6b')]=function(_0x12d69f,_0xf35a8f){var _0x537bdc=_0xf35a8f?encryptor[_0x788a('0x6c')](_0xf35a8f)['split'](','):[];if(_0x537bdc[_0x788a('0x6d')]===0x5){_0x537bdc[_0x788a('0x6e')](-0x1,0x1);}_0x537bdc['unshift'](_0x12d69f);return encryptor[_0x788a('0x6f')](_0x537bdc[_0x788a('0x70')](','));};function signJwt(_0x3fda08){var _0x28809a=BPromise[_0x788a('0x71')](jwt['sign'],{'context':jwt});var _0xac738f=_0x3fda08['secret']||config[_0x788a('0xa')]['session'];return new BPromise(function(_0x4951ca,_0x2fd735){_0x28809a(_0x3fda08['payload'],_0xac738f,_0x3fda08[_0x788a('0x72')])[_0x788a('0x33')](function(_0x494690){_0x4951ca(_0x494690);})[_0x788a('0x38')](function(_0x2de6f7){_0x2fd735(_0x2de6f7);});});}function verifyJwt(_0x23b7e8,_0x25997b,_0x47b869){var _0x21c1e4=BPromise[_0x788a('0x71')](jwt['verify'],{'context':jwt});var _0x2639c4=_0x47b869||config[_0x788a('0xa')][_0x788a('0xb')];return new BPromise(function(_0x359999,_0x440a78){_0x21c1e4(_0x23b7e8,_0x2639c4,_0x25997b)[_0x788a('0x33')](function(_0x52fb6b){_0x359999(_0x52fb6b);})['catch'](function(_0x4ec635){_0x440a78(_0x4ec635);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x788a('0x73')](Date[_0x788a('0x74')]()/0x3e8)['toString']();}function createJwt(_0x1e214a){var _0x274be2={'payload':{'iat':_0x1e214a['apiKeyIat'],'nonce':_0x1e214a[_0x788a('0x5e')]},'options':{'algorithm':_0x788a('0x75'),'subject':_0x1e214a['id'][_0x788a('0x76')](),'issuer':hardwareConf[_0x788a('0x43')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x274be2)[_0x788a('0x33')](function(_0x43664a){return{'iat':_0x1e214a[_0x788a('0x60')],'nonce':_0x1e214a[_0x788a('0x5e')],'token':_0x43664a};});} \ No newline at end of file +var _0x3d7e=['util','moment','secrets','session','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','use','user','ChatInteraction','params','closed','disposition','then','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','headers','Basic','find','authenticate','pass','status','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','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','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto'];(function(_0x4fbde2,_0x364951){var _0x2bce29=function(_0x3a97c9){while(--_0x3a97c9){_0x4fbde2['push'](_0x4fbde2['shift']());}};_0x2bce29(++_0x364951);}(_0x3d7e,0x161));var _0xe3d7=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x3d7e[_0x35e92e];return _0x1205a8;};'use strict';var db=require(_0xe3d7('0x0'))['db'];var config=require(_0xe3d7('0x1'));var hardwareConf=require(_0xe3d7('0x2'));var licenseUtil=require(_0xe3d7('0x3'));var encryptor=require(_0xe3d7('0x4'));var _=require(_0xe3d7('0x5'));var jwt=require(_0xe3d7('0x6'));var expressJwt=require(_0xe3d7('0x7'));var compose=require(_0xe3d7('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0xe3d7('0x9'));var BPromise=require('bluebird');var util=require(_0xe3d7('0xa'));var moment=require(_0xe3d7('0xb'));var validateJwt=expressJwt({'secret':config[_0xe3d7('0xc')][_0xe3d7('0xd')]});var userAttributes=['id','role','fullname',_0xe3d7('0xe'),_0xe3d7('0xf'),_0xe3d7('0x10'),_0xe3d7('0x11'),_0xe3d7('0x12'),_0xe3d7('0x13'),_0xe3d7('0x14'),_0xe3d7('0x15'),_0xe3d7('0x16'),'faxPause',_0xe3d7('0x17'),_0xe3d7('0x18'),'pauseType',_0xe3d7('0x19'),_0xe3d7('0x1a'),_0xe3d7('0x1b'),_0xe3d7('0x1c'),_0xe3d7('0x1d'),'passwordResetAt',_0xe3d7('0x1e'),_0xe3d7('0x1f'),_0xe3d7('0x20'),'phoneBarDnd',_0xe3d7('0x21'),_0xe3d7('0x22'),_0xe3d7('0x23'),_0xe3d7('0x24'),'phoneBarPrefixRequired',_0xe3d7('0x25'),_0xe3d7('0x26'),_0xe3d7('0x27'),_0xe3d7('0x28'),_0xe3d7('0x29'),_0xe3d7('0x2a')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xe3d7('0x2b')](function(_0x474604,_0x3cc825,_0x39a951){if(_0x474604[_0xe3d7('0x2c')]){_0x39a951();}else{return db[_0xe3d7('0x2d')]['findOne']({'where':{'id':_0x474604[_0xe3d7('0x2e')]['id']},'attributes':['id',_0xe3d7('0x2f'),_0xe3d7('0x30')],'raw':!![]})[_0xe3d7('0x31')](function(_0x1ce7d3){if(_0x1ce7d3&&_0x1ce7d3[_0xe3d7('0x2f')]){return _0x3cc825['status'](_0x1ce7d3[_0xe3d7('0x30')]===_0xe3d7('0x32')?0x195:0x193)[_0xe3d7('0x33')]({'message':_0x1ce7d3[_0xe3d7('0x30')]===_0xe3d7('0x32')?'Unmanaged.':_0xe3d7('0x34')});}else{_0x39a951();}})[_0xe3d7('0x35')](function(_0x2bb3c0){_0x39a951(_0x2bb3c0);});}});};exports[_0xe3d7('0x36')]=function isAuthenticated(_0x42ed2d){return compose()['use'](function(_0x348c35,_0x1aaeee,_0x12a703){var _0x3345c6;if(_0x348c35['headers'][_0xe3d7('0x37')]){if(_['startsWith'](_0x348c35[_0xe3d7('0x38')][_0xe3d7('0x37')],_0xe3d7('0x39'))){var _0x51f2f0=basicAuth(_0x348c35);db['User'][_0xe3d7('0x3a')]({'where':{'name':_0x51f2f0[_0xe3d7('0xe')]}})[_0xe3d7('0x31')](function(_0x5f375a){if(!_0x5f375a||!_0x5f375a[_0xe3d7('0x3b')](_0x51f2f0[_0xe3d7('0x3c')])){return _0x1aaeee[_0xe3d7('0x3d')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x348c35['user']={'id':_0x5f375a['id']};_0x12a703();})[_0xe3d7('0x35')](function(_0x356e5e){_0x12a703(_0x356e5e);});}else if(_[_0xe3d7('0x3e')](_0x348c35[_0xe3d7('0x38')][_0xe3d7('0x37')],_0xe3d7('0x3f'))){validateJwt(_0x348c35,_0x1aaeee,_0x12a703);}else{if(_0x42ed2d){_0x12a703();}else{return _0x1aaeee[_0xe3d7('0x3d')](0x193)[_0xe3d7('0x33')]({'message':_0xe3d7('0x40')});}}}else if(_0x348c35[_0xe3d7('0x41')][_0xe3d7('0x42')]){try{var _0x43e838={'audience':hardwareConf[_0xe3d7('0x43')](),'issuer':hardwareConf[_0xe3d7('0x43')]()};verifyJwt(_0x348c35[_0xe3d7('0x41')][_0xe3d7('0x42')],_0x43e838)[_0xe3d7('0x31')](function(_0xe3f9eb){return db['User'][_0xe3d7('0x3a')]({'where':{'id':_0xe3f9eb[_0xe3d7('0x44')]}})[_0xe3d7('0x31')](function(_0x13e6df){_0x3345c6=_0x13e6df;return db[_0xe3d7('0x45')][_0xe3d7('0x46')]({'where':{'id':0x1},'attributes':[_0xe3d7('0x47'),_0xe3d7('0x48')],'raw':!![]});})[_0xe3d7('0x31')](function(_0x583245){if(!_0x3345c6||!_['isEqual'](_0x3345c6[_0xe3d7('0x49')],_0xe3f9eb['nonce'])){return _0x1aaeee[_0xe3d7('0x3d')](0x191)['json']({'message':_0xe3d7('0x4a')});}if(_0x3345c6['disabled']){return _0x1aaeee['status'](0x191)[_0xe3d7('0x33')]({'message':_0xe3d7('0x4b')});}if(_0x3345c6[_0xe3d7('0x4c')]){if(_0x583245[_0xe3d7('0x48')]>0x0){if(moment(_0x3345c6[_0xe3d7('0x4d')])[_0xe3d7('0x4e')](_0x583245[_0xe3d7('0x48')],_0xe3d7('0x4f'))>moment()){return _0x1aaeee['status'](0x191)[_0xe3d7('0x33')]({'message':_0xe3d7('0x4b')});}}else{return _0x1aaeee[_0xe3d7('0x3d')](0x191)[_0xe3d7('0x33')]({'message':_0xe3d7('0x4b')});}}_0x348c35[_0xe3d7('0x2c')]={'id':_0x3345c6['id']};_0x12a703();});})[_0xe3d7('0x35')](function(){return _0x1aaeee[_0xe3d7('0x3d')](0x191)[_0xe3d7('0x33')]({'message':_0xe3d7('0x4b')});});}catch(_0x30145a){_0x12a703(_0x30145a);}}else if(_0x42ed2d){_0x12a703();}else{return _0x1aaeee[_0xe3d7('0x3d')](0x193)[_0xe3d7('0x33')]({'message':_0xe3d7('0x40')});}})[_0xe3d7('0x2b')](function(_0x1308b7,_0x3f768a,_0x32f06b){if(_0x1308b7[_0xe3d7('0x2c')]){db['User']['find']({'where':{'id':_0x1308b7[_0xe3d7('0x2c')]['id']},'attributes':userAttributes})[_0xe3d7('0x31')](function(_0x41de55){if(!_0x41de55){return _0x3f768a[_0xe3d7('0x3d')](0x194)[_0xe3d7('0x33')]({'message':'User\x20not\x20found.'});}_0x1308b7['user']=_0x41de55;_0x32f06b();})[_0xe3d7('0x35')](function(_0x5352db){_0x32f06b(_0x5352db);});}else if(_0x42ed2d){_0x32f06b();}else{return _0x3f768a[_0xe3d7('0x3d')](0x194)['json']({'message':_0xe3d7('0x50')});}});};exports[_0xe3d7('0x51')]=function canUpdate(){return compose()[_0xe3d7('0x2b')](function(_0x38f9a6,_0x5843d9,_0x5afbac){return licenseUtil[_0xe3d7('0x52')]()['then'](function(_0xf97418){if(_0xf97418[_0xe3d7('0x53')]){_0x5afbac();}else{return _0x5843d9[_0xe3d7('0x3d')](0x193)['json']({'message':_0xe3d7('0x54')});}})[_0xe3d7('0x35')](function(_0x31877e){_0x5afbac(_0x31877e);});});};exports[_0xe3d7('0x55')]=function(_0x26e325,_0xea15ac,_0x19f22e){_0x26e325[_0xe3d7('0x55')]=!![];return _0x19f22e();};exports[_0xe3d7('0x56')]=function signToken(_0x3aa688){return signJwt(_0x3aa688);};exports[_0xe3d7('0x57')]=function(_0x487e37,_0x1af74b){if(!_0x487e37[_0xe3d7('0x2c')]){return _0x1af74b[_0xe3d7('0x3d')](0x194)[_0xe3d7('0x33')]({'message':_0xe3d7('0x58')});}var _0x13ce46={'payload':{'id':_0x487e37[_0xe3d7('0x2c')]['id'],'role':_0x487e37[_0xe3d7('0x2c')][_0xe3d7('0x59')]},'options':{'expiresIn':0x15180}};return signJwt(_0x13ce46)[_0xe3d7('0x31')](function(_0x5c14c0){_0x1af74b[_0xe3d7('0x5a')](_0xe3d7('0x5b'),_0x5c14c0);_0x1af74b[_0xe3d7('0x5c')](_0xe3d7('0x5d'));})[_0xe3d7('0x35')](function(_0x187b28){return _0x1af74b[_0xe3d7('0x3d')](0x1f4)[_0xe3d7('0x5e')](_0x187b28);});};exports[_0xe3d7('0x5f')]=function(_0x161413){if(_['isNil'](_0x161413['apiKeyNonce'])||_[_0xe3d7('0x60')](_0x161413[_0xe3d7('0x61')])){return null;}else{return createJwt(_0x161413);}};exports['generateApiKey']=function(_0x3cad65){_0x3cad65[_0xe3d7('0x49')]=generateNonce();_0x3cad65[_0xe3d7('0x61')]=generateIssuedAt();return createJwt(_0x3cad65);};exports[_0xe3d7('0x62')]=function(_0x5987e5,_0x1096ab){var _0x296902=_0x5987e5['query']['apikey'];if(_0x296902){var _0x5e91b0={'nonce':_0x1096ab[_0xe3d7('0x49')],'iat':_0x1096ab['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xe3d7('0x43')]()};return verifyJwt(_0x296902,_0x5e91b0)[_0xe3d7('0x31')](function(){return generateApiKey(_0x1096ab);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x3d5c09){var _0x2124ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2124ee[_0xe3d7('0x63')](_0x3d5c09))throw new db[(_0xe3d7('0x64'))][(_0xe3d7('0x65'))]('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[_0xe3d7('0x66')]=function(_0x5954f3,_0x27aa8f,_0x4b77e4){var _0x2b04b4=encryptor[_0xe3d7('0x67')](_0x27aa8f)[_0xe3d7('0x68')](',');for(var _0x2c3e84=0x0;_0x2c3e84<_0x4b77e4;_0x2c3e84++){if(!_0x2b04b4[_0x2c3e84])break;if(_0x5954f3[_0xe3d7('0x69')]()===_0x2b04b4[_0x2c3e84][_0xe3d7('0x69')]()){var _0x468c0=util[_0xe3d7('0x6a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x4b77e4);if(_0x4b77e4===0x1){_0x468c0=_0xe3d7('0x6b');}throw new db[(_0xe3d7('0x64'))]['ValidationError'](_0x468c0);}}return;};exports['updatePasswordsHistory']=function(_0x1522af,_0x2116d2){var _0x4845f2=_0x2116d2?encryptor[_0xe3d7('0x67')](_0x2116d2)['split'](','):[];if(_0x4845f2['length']===0x5){_0x4845f2[_0xe3d7('0x6c')](-0x1,0x1);}_0x4845f2['unshift'](_0x1522af);return encryptor[_0xe3d7('0x6d')](_0x4845f2['join'](','));};function signJwt(_0x219887){var _0x3446e8=BPromise[_0xe3d7('0x6e')](jwt[_0xe3d7('0x6f')],{'context':jwt});var _0x85cec6=_0x219887[_0xe3d7('0x70')]||config[_0xe3d7('0xc')][_0xe3d7('0xd')];return new BPromise(function(_0x474e18,_0xd2e279){_0x3446e8(_0x219887[_0xe3d7('0x71')],_0x85cec6,_0x219887[_0xe3d7('0x72')])[_0xe3d7('0x31')](function(_0x10c1eb){_0x474e18(_0x10c1eb);})[_0xe3d7('0x35')](function(_0x3fde4c){_0xd2e279(_0x3fde4c);});});}function verifyJwt(_0x42e189,_0xf0acb,_0x184553){var _0x2edf0d=BPromise[_0xe3d7('0x6e')](jwt[_0xe3d7('0x73')],{'context':jwt});var _0x58ee7c=_0x184553||config[_0xe3d7('0xc')][_0xe3d7('0xd')];return new BPromise(function(_0x43d255,_0x33c696){_0x2edf0d(_0x42e189,_0x58ee7c,_0xf0acb)[_0xe3d7('0x31')](function(_0x2ab5a9){_0x43d255(_0x2ab5a9);})['catch'](function(_0x18e310){_0x33c696(_0x18e310);});});}function generateNonce(){return crypto[_0xe3d7('0x74')](0x10)[_0xe3d7('0x75')](_0xe3d7('0x76'));}function generateIssuedAt(){return Math[_0xe3d7('0x77')](Date[_0xe3d7('0x78')]()/0x3e8)['toString']();}function createJwt(_0x2aaefe){var _0x53f77e={'payload':{'iat':_0x2aaefe[_0xe3d7('0x61')],'nonce':_0x2aaefe[_0xe3d7('0x49')]},'options':{'algorithm':'HS512','subject':_0x2aaefe['id'][_0xe3d7('0x75')](),'issuer':hardwareConf[_0xe3d7('0x43')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x53f77e)[_0xe3d7('0x31')](function(_0x1c553a){return{'iat':_0x2aaefe['apiKeyIat'],'nonce':_0x2aaefe[_0xe3d7('0x49')],'token':_0x1c553a};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 82ec85a..e633e9d 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 _0x7bd0=['binary','write','end','close','unlink','decryptFile','createDecipher','algorithm','final','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update'];(function(_0x3cb09b,_0x31c2a5){var _0x242048=function(_0x464aba){while(--_0x464aba){_0x3cb09b['push'](_0x3cb09b['shift']());}};_0x242048(++_0x31c2a5);}(_0x7bd0,0x111));var _0x07bd=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x7bd0[_0x124298];return _0x35ac24;};'use strict';var crypto=require(_0x07bd('0x0'));var fs=require('fs');var BPromise=require(_0x07bd('0x1'));var config=require(_0x07bd('0x2'));const stringOptions={'secret':config[_0x07bd('0x3')][_0x07bd('0x4')],'algorithm':_0x07bd('0x5')};const fileOptions={'algorithm':_0x07bd('0x6')};function combineOptions(_0x3633e7){var _0x5beba7={};for(var _0x2d7245 in fileOptions){if(fileOptions[_0x07bd('0x7')](_0x2d7245)){_0x5beba7[_0x2d7245]=fileOptions[_0x2d7245];}}if(_0x3633e7){for(var _0x38f3f1 in _0x3633e7){if(_0x3633e7[_0x07bd('0x7')](_0x38f3f1)){_0x5beba7[_0x38f3f1]=_0x3633e7[_0x38f3f1];}}}return _0x5beba7;}exports[_0x07bd('0x8')]=function(_0x422a22,_0x2e4cd1,_0x5a939d,_0x3968d9){return new BPromise(function(_0x5cd446,_0x8032dc){_0x3968d9=combineOptions(_0x3968d9);var _0xb10241=new Buffer(_0x5a939d);var _0x323724=fs['createReadStream'](_0x422a22);var _0x2bace8=fs[_0x07bd('0x9')](_0x2e4cd1);var _0x324a46=crypto[_0x07bd('0xa')](_0x3968d9['algorithm'],_0xb10241);_0x323724['on'](_0x07bd('0xb'),function(_0x313ca5){var _0x1b067a=new Buffer(_0x324a46[_0x07bd('0xc')](_0x313ca5),_0x07bd('0xd'));_0x2bace8[_0x07bd('0xe')](_0x1b067a);});_0x323724['on'](_0x07bd('0xf'),function(){try{var _0x2b8409=new Buffer(_0x324a46['final']('binary'),_0x07bd('0xd'));_0x2bace8[_0x07bd('0xe')](_0x2b8409);_0x2bace8[_0x07bd('0xf')]();_0x2bace8['on'](_0x07bd('0x10'),function(){return _0x5cd446(_0x2e4cd1);});}catch(_0x188f35){fs[_0x07bd('0x11')](_0x2e4cd1);return _0x8032dc(_0x188f35);}});});};exports[_0x07bd('0x12')]=function(_0x49d962,_0x418444,_0x505839,_0x229bf1){return new BPromise(function(_0x2dd97b,_0x31655a){_0x229bf1=combineOptions(_0x229bf1);var _0x1713ca=new Buffer(_0x505839);var _0x8aa645=fs['createReadStream'](_0x49d962);var _0x3f9f0b=fs[_0x07bd('0x9')](_0x418444);var _0x4948f4=crypto[_0x07bd('0x13')](_0x229bf1[_0x07bd('0x14')],_0x1713ca);_0x8aa645['on'](_0x07bd('0xb'),function(_0x2fcc59){var _0x36ccec=new Buffer(_0x4948f4[_0x07bd('0xc')](_0x2fcc59),_0x07bd('0xd'));_0x3f9f0b[_0x07bd('0xe')](_0x36ccec);});_0x8aa645['on'](_0x07bd('0xf'),function(){try{var _0x50109f=new Buffer(_0x4948f4[_0x07bd('0x15')](_0x07bd('0xd')),_0x07bd('0xd'));_0x3f9f0b[_0x07bd('0xe')](_0x50109f);_0x3f9f0b[_0x07bd('0xf')]();_0x3f9f0b['on']('close',function(){return _0x2dd97b(_0x418444);});}catch(_0x4c673a){fs[_0x07bd('0x11')](_0x418444);return _0x31655a(_0x4c673a);}});});};exports['encryptString']=function(_0x2b0dee,_0x480c9c,_0x50bd12){var _0x4165bc=_0x50bd12||stringOptions[_0x07bd('0x14')];var _0xf3b23c=_0x480c9c||stringOptions[_0x07bd('0x16')];var _0x28bd91=crypto[_0x07bd('0xa')](_0x4165bc,_0xf3b23c);var _0x557042=_0x28bd91[_0x07bd('0xc')](_0x2b0dee,_0x07bd('0x17'),_0x07bd('0x18'));_0x557042+=_0x28bd91[_0x07bd('0x15')](_0x07bd('0x18'));return _0x557042;};exports[_0x07bd('0x19')]=function(_0x571dab,_0x56687f,_0x5184dc){var _0x335d61=_0x5184dc||stringOptions[_0x07bd('0x14')];var _0x5b31f7=_0x56687f||stringOptions['secret'];var _0x1a3aa9=crypto[_0x07bd('0x13')](_0x335d61,_0x5b31f7);var _0x253dc0=_0x1a3aa9[_0x07bd('0xc')](_0x571dab,_0x07bd('0x18'),_0x07bd('0x17'));_0x253dc0+=_0x1a3aa9['final'](_0x07bd('0x17'));return _0x253dc0;}; \ No newline at end of file +var _0xbd51=['end','final','close','unlink','createDecipher','data','secret','utf8','base64','decryptString','crypto','../../config/environment','secrets','session','aes-256-ctr','hasOwnProperty','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write'];(function(_0x19248d,_0x5c876f){var _0x2198ca=function(_0x33a942){while(--_0x33a942){_0x19248d['push'](_0x19248d['shift']());}};_0x2198ca(++_0x5c876f);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1776cd,_0x47333a){_0x1776cd=_0x1776cd-0x0;var _0x42a775=_0xbd51[_0x1776cd];return _0x42a775;};'use strict';var crypto=require(_0x1bd5('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x1bd5('0x1'));const stringOptions={'secret':config[_0x1bd5('0x2')][_0x1bd5('0x3')],'algorithm':_0x1bd5('0x4')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x4d1bba){var _0x58af16={};for(var _0x531028 in fileOptions){if(fileOptions[_0x1bd5('0x5')](_0x531028)){_0x58af16[_0x531028]=fileOptions[_0x531028];}}if(_0x4d1bba){for(var _0x362b24 in _0x4d1bba){if(_0x4d1bba[_0x1bd5('0x5')](_0x362b24)){_0x58af16[_0x362b24]=_0x4d1bba[_0x362b24];}}}return _0x58af16;}exports['encryptFile']=function(_0x29abea,_0x30a385,_0x19077c,_0x27d58f){return new BPromise(function(_0xd8418f,_0x4a7f90){_0x27d58f=combineOptions(_0x27d58f);var _0x36ef1a=new Buffer(_0x19077c);var _0x5c8e0d=fs[_0x1bd5('0x6')](_0x29abea);var _0x28df8e=fs[_0x1bd5('0x7')](_0x30a385);var _0x1fbc68=crypto[_0x1bd5('0x8')](_0x27d58f[_0x1bd5('0x9')],_0x36ef1a);_0x5c8e0d['on']('data',function(_0x456ef8){var _0x4e666c=new Buffer(_0x1fbc68[_0x1bd5('0xa')](_0x456ef8),_0x1bd5('0xb'));_0x28df8e[_0x1bd5('0xc')](_0x4e666c);});_0x5c8e0d['on'](_0x1bd5('0xd'),function(){try{var _0x177be0=new Buffer(_0x1fbc68[_0x1bd5('0xe')](_0x1bd5('0xb')),'binary');_0x28df8e['write'](_0x177be0);_0x28df8e[_0x1bd5('0xd')]();_0x28df8e['on'](_0x1bd5('0xf'),function(){return _0xd8418f(_0x30a385);});}catch(_0x33f82a){fs[_0x1bd5('0x10')](_0x30a385);return _0x4a7f90(_0x33f82a);}});});};exports['decryptFile']=function(_0x5072c2,_0xa63190,_0xc7277e,_0x2b2c57){return new BPromise(function(_0x4793dd,_0x43ea3e){_0x2b2c57=combineOptions(_0x2b2c57);var _0x2d2e80=new Buffer(_0xc7277e);var _0x13cf34=fs[_0x1bd5('0x6')](_0x5072c2);var _0x4670b5=fs['createWriteStream'](_0xa63190);var _0x53ad5e=crypto[_0x1bd5('0x11')](_0x2b2c57[_0x1bd5('0x9')],_0x2d2e80);_0x13cf34['on'](_0x1bd5('0x12'),function(_0xb95d4e){var _0x459649=new Buffer(_0x53ad5e[_0x1bd5('0xa')](_0xb95d4e),_0x1bd5('0xb'));_0x4670b5[_0x1bd5('0xc')](_0x459649);});_0x13cf34['on'](_0x1bd5('0xd'),function(){try{var _0xb1ac1e=new Buffer(_0x53ad5e[_0x1bd5('0xe')](_0x1bd5('0xb')),_0x1bd5('0xb'));_0x4670b5[_0x1bd5('0xc')](_0xb1ac1e);_0x4670b5[_0x1bd5('0xd')]();_0x4670b5['on'](_0x1bd5('0xf'),function(){return _0x4793dd(_0xa63190);});}catch(_0x1f13e7){fs[_0x1bd5('0x10')](_0xa63190);return _0x43ea3e(_0x1f13e7);}});});};exports['encryptString']=function(_0x42c43d,_0x50c663,_0x18fd18){var _0x1e534e=_0x18fd18||stringOptions[_0x1bd5('0x9')];var _0x48316b=_0x50c663||stringOptions[_0x1bd5('0x13')];var _0x4fa37c=crypto[_0x1bd5('0x8')](_0x1e534e,_0x48316b);var _0x30676d=_0x4fa37c[_0x1bd5('0xa')](_0x42c43d,_0x1bd5('0x14'),'base64');_0x30676d+=_0x4fa37c[_0x1bd5('0xe')](_0x1bd5('0x15'));return _0x30676d;};exports[_0x1bd5('0x16')]=function(_0x3b1090,_0x4cebd0,_0xdba332){var _0x24d4d9=_0xdba332||stringOptions[_0x1bd5('0x9')];var _0x369b88=_0x4cebd0||stringOptions[_0x1bd5('0x13')];var _0xc73670=crypto['createDecipher'](_0x24d4d9,_0x369b88);var _0x289097=_0xc73670[_0x1bd5('0xa')](_0x3b1090,_0x1bd5('0x15'),'utf8');_0x289097+=_0xc73670[_0x1bd5('0xe')](_0x1bd5('0x14'));return _0x289097;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 454db00..8c8d6d0 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 _0xedd9=['path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','mkdirSync','join','each','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','inspect','Failed'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xedd9,0xfc));var _0x9edd=function(_0x50c818,_0x8e53bb){_0x50c818=_0x50c818-0x0;var _0x32c247=_0xedd9[_0x50c818];return _0x32c247;};'use strict';var util=require('util');var path=require(_0x9edd('0x0'));var _=require(_0x9edd('0x1'));var csv=require(_0x9edd('0x2'));var fs=require('fs');var BPromise=require(_0x9edd('0x3'));var zipdir=require(_0x9edd('0x4'));var rimraf=require(_0x9edd('0x5'));var db=require(_0x9edd('0x6'))['db'];var dbH=require(_0x9edd('0x6'))['dbH'];var logger=require(_0x9edd('0x7'))(_0x9edd('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x9edd('0x9')][0x2]);var QUERY=process[_0x9edd('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xf0b2d8,_0x571af9){var _0x172522={'status':_0xf0b2d8};var _0x190185={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x571af9){_0x172522[_0x9edd('0xa')]=_0x571af9;}return db[_0x9edd('0xb')]['update'](_0x172522,_0x190185);}function main(){var _0x494a24=0x1388;var _0x5d2f90;logger[_0x9edd('0xc')](util[_0x9edd('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9edd('0xe')));return db[_0x9edd('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9edd('0x10'),_0x9edd('0x11')]})[_0x9edd('0x12')](function(_0xfd544a){if(_0xfd544a){_0x5d2f90=_0xfd544a;_0x494a24=_0x5d2f90[_0x9edd('0x11')]||0x1388;}})[_0x9edd('0x12')](function(){return dbH[_0x9edd('0x13')][_0x9edd('0x14')](util['format'](_0x9edd('0x15'),QUERY),{'type':dbH[_0x9edd('0x13')][_0x9edd('0x16')][_0x9edd('0x17')]});})[_0x9edd('0x12')](function(_0x338f3c){if(!_0x338f3c[0x0][_0x9edd('0x18')]){return analyticExtractedReport(_0x9edd('0x19'));}var _0x4ea60f=[];var _0x5f5bf4=0x0;var _0x448996=!![];if(_0x338f3c&&_0x338f3c[_0x9edd('0x1a')]){var _0x5acf65=_0x338f3c[0x0][_0x9edd('0x18')]%(_0x5f5bf4+_0x494a24);if(_0x5d2f90[_0x9edd('0x10')]){for(;_0x448996;_0x5f5bf4+=_0x494a24,_0x5acf65=_0x338f3c[0x0][_0x9edd('0x18')]%(_0x5f5bf4+_0x494a24)){if(_0x5acf65==0x0||_0x5acf65==_0x338f3c[0x0]['num']){_0x448996=![];}_0x4ea60f[_0x9edd('0x1b')](dbH['sequelize'][_0x9edd('0x14')](util[_0x9edd('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x494a24,_0x5f5bf4),{'type':dbH['sequelize'][_0x9edd('0x16')]['SELECT']}));}}else{_0x4ea60f[_0x9edd('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x9edd('0x13')][_0x9edd('0x16')]['SELECT']}));}}var _0x5823bc=path[_0x9edd('0x1c')](PATH);var _0x186186=path[_0x9edd('0x1d')](PATH,'.csv');var _0x3741c8=_0x5d2f90[_0x9edd('0x10')]&&_0x4ea60f[_0x9edd('0x1a')]>0x1;var _0x2ca65f=[];if(!fs[_0x9edd('0x1e')](path['join'](_0x5823bc,_0x186186))&&_0x3741c8){fs[_0x9edd('0x1f')](path[_0x9edd('0x20')](_0x5823bc,_0x186186));}return BPromise[_0x9edd('0x21')](_0x4ea60f,function(_0x2f9f86){_0x2ca65f[_0x9edd('0x1b')](_0x2f9f86);})['then'](function(){for(var _0x4b3d1b=0x0;_0x4b3d1b<_0x2ca65f[_0x9edd('0x1a')];_0x4b3d1b+=0x1){var _0xfeca7b;var _0x8d67aa=_0x2ca65f[_0x4b3d1b];if(_0x3741c8){_0xfeca7b=path[_0x9edd('0x20')](_0x5823bc,_0x186186,util[_0x9edd('0xd')]('%s%d.%s',_0x186186,_0x4b3d1b,'csv'));}else{_0xfeca7b=path[_0x9edd('0x20')](_0x5823bc,util[_0x9edd('0xd')](_0x9edd('0x22'),_0x186186,'csv'));}fs[_0x9edd('0x23')](_0xfeca7b,csv(_0x8d67aa));}})[_0x9edd('0x12')](function(){if(_0x3741c8){zipdir(path[_0x9edd('0x20')](_0x5823bc,_0x186186),{'saveTo':path[_0x9edd('0x20')](_0x5823bc,util['format'](_0x9edd('0x22'),_0x186186,_0x9edd('0x24')))},function(_0xbe87e1,_0x12c1bc){});rimraf(path[_0x9edd('0x20')](_0x5823bc,_0x186186),function(){});}})[_0x9edd('0x12')](function(){logger[_0x9edd('0xc')](util[_0x9edd('0xd')](_0x9edd('0x25'),EXTRACTED_REPORT_ID,_0x9edd('0xe')));return analyticExtractedReport(_0x9edd('0x26'),_0x3741c8?util[_0x9edd('0xd')](_0x9edd('0x22'),_0x186186,_0x3741c8?_0x9edd('0x24'):_0x9edd('0x27')):null);});})['catch'](function(_0x1453d2){logger[_0x9edd('0xc')](util[_0x9edd('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9edd('0xe')),util[_0x9edd('0x28')](_0x1453d2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9edd('0x29'));});}main(); \ No newline at end of file +var _0xd2ea=['analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','query','SELECT','num','Empty','length','push','sequelize','QueryTypes','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','inspect','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x4a01bd,_0x4db411){var _0x500e41=function(_0x185564){while(--_0x185564){_0x4a01bd['push'](_0x4a01bd['shift']());}};_0x500e41(++_0x4db411);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1eb1b9,_0x11fa82){_0x1eb1b9=_0x1eb1b9-0x0;var _0x1624bf=_0xd2ea[_0x1eb1b9];return _0x1624bf;};'use strict';var util=require(_0xad2e('0x0'));var path=require(_0xad2e('0x1'));var _=require(_0xad2e('0x2'));var csv=require(_0xad2e('0x3'));var fs=require('fs');var BPromise=require(_0xad2e('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xad2e('0x5'));var db=require(_0xad2e('0x6'))['db'];var dbH=require(_0xad2e('0x6'))[_0xad2e('0x7')];var logger=require(_0xad2e('0x8'))(_0xad2e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xad2e('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xad2e('0xa')][0x4];function analyticExtractedReport(_0x3e3d1f,_0x2ff7b2){var _0x5710ac={'status':_0x3e3d1f};var _0x1e0e9e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ff7b2){_0x5710ac[_0xad2e('0xb')]=_0x2ff7b2;}return db['AnalyticExtractedReport'][_0xad2e('0xc')](_0x5710ac,_0x1e0e9e);}function main(){var _0x51f575=0x1388;var _0x430443;logger[_0xad2e('0xd')](util[_0xad2e('0xe')](_0xad2e('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xad2e('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xad2e('0x11'),_0xad2e('0x12')]})[_0xad2e('0x13')](function(_0x42e2f2){if(_0x42e2f2){_0x430443=_0x42e2f2;_0x51f575=_0x430443['splitSizeCsv']||0x1388;}})[_0xad2e('0x13')](function(){return dbH['sequelize'][_0xad2e('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xad2e('0x15')]});})[_0xad2e('0x13')](function(_0x1646d5){if(!_0x1646d5[0x0][_0xad2e('0x16')]){return analyticExtractedReport(_0xad2e('0x17'));}var _0x4180aa=[];var _0x2546e2=0x0;var _0x5941c5=!![];if(_0x1646d5&&_0x1646d5[_0xad2e('0x18')]){var _0xbc6df0=_0x1646d5[0x0][_0xad2e('0x16')]%(_0x2546e2+_0x51f575);if(_0x430443[_0xad2e('0x11')]){for(;_0x5941c5;_0x2546e2+=_0x51f575,_0xbc6df0=_0x1646d5[0x0][_0xad2e('0x16')]%(_0x2546e2+_0x51f575)){if(_0xbc6df0==0x0||_0xbc6df0==_0x1646d5[0x0][_0xad2e('0x16')]){_0x5941c5=![];}_0x4180aa[_0xad2e('0x19')](dbH['sequelize'][_0xad2e('0x14')](util[_0xad2e('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x51f575,_0x2546e2),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x4180aa[_0xad2e('0x19')](dbH[_0xad2e('0x1a')][_0xad2e('0x14')](QUERY,{'type':dbH[_0xad2e('0x1a')][_0xad2e('0x1b')][_0xad2e('0x15')]}));}}var _0x29dc4f=path[_0xad2e('0x1c')](PATH);var _0x102169=path[_0xad2e('0x1d')](PATH,_0xad2e('0x1e'));var _0x142631=_0x430443[_0xad2e('0x11')]&&_0x4180aa[_0xad2e('0x18')]>0x1;var _0x207517=[];if(!fs[_0xad2e('0x1f')](path['join'](_0x29dc4f,_0x102169))&&_0x142631){fs[_0xad2e('0x20')](path[_0xad2e('0x21')](_0x29dc4f,_0x102169));}return BPromise[_0xad2e('0x22')](_0x4180aa,function(_0x350c66){_0x207517[_0xad2e('0x19')](_0x350c66);})[_0xad2e('0x13')](function(){for(var _0x1161d5=0x0;_0x1161d5<_0x207517[_0xad2e('0x18')];_0x1161d5+=0x1){var _0xfd90a4;var _0x50d446=_0x207517[_0x1161d5];if(_0x142631){_0xfd90a4=path[_0xad2e('0x21')](_0x29dc4f,_0x102169,util['format'](_0xad2e('0x23'),_0x102169,_0x1161d5,_0xad2e('0x24')));}else{_0xfd90a4=path[_0xad2e('0x21')](_0x29dc4f,util[_0xad2e('0xe')](_0xad2e('0x25'),_0x102169,_0xad2e('0x24')));}fs[_0xad2e('0x26')](_0xfd90a4,csv(_0x50d446));}})[_0xad2e('0x13')](function(){if(_0x142631){zipdir(path[_0xad2e('0x21')](_0x29dc4f,_0x102169),{'saveTo':path[_0xad2e('0x21')](_0x29dc4f,util['format'](_0xad2e('0x25'),_0x102169,_0xad2e('0x27')))},function(_0x2a0dc7,_0x4379f4){});rimraf(path[_0xad2e('0x21')](_0x29dc4f,_0x102169),function(){});}})[_0xad2e('0x13')](function(){logger[_0xad2e('0xd')](util[_0xad2e('0xe')](_0xad2e('0x28'),EXTRACTED_REPORT_ID,_0xad2e('0x29')));return analyticExtractedReport(_0xad2e('0x2a'),_0x142631?util['format'](_0xad2e('0x25'),_0x102169,_0x142631?'zip':_0xad2e('0x24')):null);});})[_0xad2e('0x2b')](function(_0x5ac436){logger[_0xad2e('0xd')](util[_0xad2e('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xad2e('0x29')),util[_0xad2e('0x2c')](_0x5ac436,{'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 01e2cd5..108379d 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x4069f3,_0x2ea52a){var _0xa97bf8=function(_0x5563dc){while(--_0x5563dc){_0x4069f3['push'](_0x4069f3['shift']());}};_0xa97bf8(++_0x2ea52a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +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(_0x23c628,_0xe8211d){var _0x2f02b7=function(_0x4b04bd){while(--_0x4b04bd){_0x23c628['push'](_0x23c628['shift']());}};_0x2f02b7(++_0xe8211d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4aba49,_0x3da137){_0x4aba49=_0x4aba49-0x0;var _0x4ba51e=_0x5f2f[_0x4aba49];return _0x4ba51e;};'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 8eecf42..5bd8d43 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 _0xbabe=['Failed','util','path','json2xls','rimraf','../../mysqldb','dbH','analytics','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','then','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbabe,0x12e));var _0xebab=function(_0x337472,_0x443590){_0x337472=_0x337472-0x0;var _0x8de0be=_0xbabe[_0x337472];return _0x8de0be;};'use strict';var util=require(_0xebab('0x0'));var path=require(_0xebab('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xebab('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xebab('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xebab('0x4'))[_0xebab('0x5')];var logger=require('../../config/logger')(_0xebab('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xebab('0x7')][0x3];var PATH=process[_0xebab('0x7')][0x4];function analyticExtractedReport(_0x1b21a5,_0x4e231b){var _0x2f4db4={'status':_0x1b21a5};var _0xe7b7ab={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e231b){_0x2f4db4[_0xebab('0x8')]=_0x4e231b;}return db['AnalyticExtractedReport']['update'](_0x2f4db4,_0xe7b7ab);}function main(){var _0x36197e=0x1388;var _0x44914e;logger['info'](util[_0xebab('0x9')](_0xebab('0xa'),EXTRACTED_REPORT_ID,_0xebab('0xb')));return db[_0xebab('0xc')][_0xebab('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xebab('0xe')](function(_0x490c37){if(_0x490c37){_0x44914e=_0x490c37;_0x36197e=_0x44914e[_0xebab('0xf')]||0x1388;}})[_0xebab('0xe')](function(){return dbH[_0xebab('0x10')]['query'](util[_0xebab('0x9')](_0xebab('0x11'),QUERY),{'type':dbH[_0xebab('0x10')]['QueryTypes'][_0xebab('0x12')]});})[_0xebab('0xe')](function(_0x43455e){if(!_0x43455e[0x0][_0xebab('0x13')]){return analyticExtractedReport(_0xebab('0x14'));}var _0xcfe2c6=[];var _0x4c26bf=0x0;var _0x438780=!![];if(_0x44914e[_0xebab('0x15')]){if(_0x43455e&&_0x43455e[_0xebab('0x16')]){var _0x45eff7=_0x43455e[0x0][_0xebab('0x13')]%(_0x4c26bf+_0x36197e);for(;_0x438780;_0x4c26bf+=_0x36197e,_0x45eff7=_0x43455e[0x0]['num']%(_0x4c26bf+_0x36197e)){if(_0x45eff7==0x0||_0x45eff7==_0x43455e[0x0][_0xebab('0x13')]){_0x438780=![];}_0xcfe2c6[_0xebab('0x17')](dbH[_0xebab('0x10')][_0xebab('0x18')](util[_0xebab('0x9')](_0xebab('0x19'),QUERY,_0x36197e,_0x4c26bf),{'type':dbH[_0xebab('0x10')]['QueryTypes']['SELECT']}));}}}else{_0xcfe2c6[_0xebab('0x17')](dbH[_0xebab('0x10')]['query'](QUERY,{'type':dbH[_0xebab('0x10')][_0xebab('0x1a')][_0xebab('0x12')]}));}var _0x2778a3=path['dirname'](PATH);var _0x35bdf6=path['basename'](PATH,'.xlsx');var _0x10ed3c=_0x44914e['split']&&_0xcfe2c6['length']>0x1;var _0x1c0c5c=[];if(!fs[_0xebab('0x1b')](path[_0xebab('0x1c')](_0x2778a3,_0x35bdf6))&&_0x10ed3c){fs[_0xebab('0x1d')](path[_0xebab('0x1c')](_0x2778a3,_0x35bdf6));}return BPromise[_0xebab('0x1e')](_0xcfe2c6,function(_0x433df3){_0x1c0c5c[_0xebab('0x17')](_0x433df3);})[_0xebab('0xe')](function(){for(var _0x28563f=0x0;_0x28563f<_0x1c0c5c[_0xebab('0x16')];_0x28563f+=0x1){var _0x5b7673;var _0x42ea40=_0x1c0c5c[_0x28563f];if(_0x10ed3c){_0x5b7673=path[_0xebab('0x1c')](_0x2778a3,_0x35bdf6,util[_0xebab('0x9')](_0xebab('0x1f'),_0x35bdf6,_0x28563f,_0xebab('0x20')));}else{_0x5b7673=path[_0xebab('0x1c')](_0x2778a3,util['format']('%s.%s',_0x35bdf6,_0xebab('0x20')));}fs[_0xebab('0x21')](_0x5b7673,json2xls(_0x42ea40),_0xebab('0x22'));}})[_0xebab('0xe')](function(){if(_0x10ed3c){zipdir(path[_0xebab('0x1c')](_0x2778a3,_0x35bdf6),{'saveTo':path[_0xebab('0x1c')](_0x2778a3,util['format'](_0xebab('0x23'),_0x35bdf6,_0xebab('0x24')))},function(_0x4d74fe,_0x1643b8){});rimraf(path['join'](_0x2778a3,_0x35bdf6),function(){});}})[_0xebab('0xe')](function(){logger[_0xebab('0x25')](util[_0xebab('0x9')](_0xebab('0x26'),EXTRACTED_REPORT_ID,_0xebab('0xb')));return analyticExtractedReport(_0xebab('0x27'),_0x10ed3c?util['format'](_0xebab('0x23'),_0x35bdf6,_0x10ed3c?_0xebab('0x24'):_0xebab('0x20')):null);});})[_0xebab('0x28')](function(_0x183928){logger[_0xebab('0x25')](util[_0xebab('0x9')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xebab('0xb')),util[_0xebab('0x29')](_0x183928,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xebab('0x2a'));});}main(); \ No newline at end of file +var _0x794b=['num','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','writeFileSync','binary','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','json2xls','bluebird','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT'];(function(_0x1ce982,_0x3c015e){var _0x568b3b=function(_0xe95ab7){while(--_0xe95ab7){_0x1ce982['push'](_0x1ce982['shift']());}};_0x568b3b(++_0x3c015e);}(_0x794b,0x1c2));var _0xb794=function(_0x1a3be3,_0x359a45){_0x1a3be3=_0x1a3be3-0x0;var _0x4b1e61=_0x794b[_0x1a3be3];return _0x4b1e61;};'use strict';var util=require(_0xb794('0x0'));var path=require(_0xb794('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xb794('0x2'));var BPromise=require(_0xb794('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xb794('0x4'))['db'];var dbH=require(_0xb794('0x4'))['dbH'];var logger=require('../../config/logger')(_0xb794('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0xb794('0x6')][0x2]);var QUERY=process[_0xb794('0x6')][0x3];var PATH=process[_0xb794('0x6')][0x4];function analyticExtractedReport(_0x231206,_0x340863){var _0x5d099b={'status':_0x231206};var _0x30f03f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x340863){_0x5d099b[_0xb794('0x7')]=_0x340863;}return db[_0xb794('0x8')][_0xb794('0x9')](_0x5d099b,_0x30f03f);}function main(){var _0x2d0d36=0x1388;var _0xf87756;logger[_0xb794('0xa')](util[_0xb794('0xb')](_0xb794('0xc'),EXTRACTED_REPORT_ID,_0xb794('0xd')));return db[_0xb794('0xe')][_0xb794('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb794('0x10'),_0xb794('0x11')]})[_0xb794('0x12')](function(_0xe8442a){if(_0xe8442a){_0xf87756=_0xe8442a;_0x2d0d36=_0xf87756[_0xb794('0x11')]||0x1388;}})[_0xb794('0x12')](function(){return dbH[_0xb794('0x13')][_0xb794('0x14')](util[_0xb794('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb794('0x13')][_0xb794('0x15')][_0xb794('0x16')]});})[_0xb794('0x12')](function(_0xac1f87){if(!_0xac1f87[0x0][_0xb794('0x17')]){return analyticExtractedReport('Empty');}var _0x43bf13=[];var _0x33ac72=0x0;var _0x576ef5=!![];if(_0xf87756[_0xb794('0x10')]){if(_0xac1f87&&_0xac1f87[_0xb794('0x18')]){var _0x53788b=_0xac1f87[0x0][_0xb794('0x17')]%(_0x33ac72+_0x2d0d36);for(;_0x576ef5;_0x33ac72+=_0x2d0d36,_0x53788b=_0xac1f87[0x0][_0xb794('0x17')]%(_0x33ac72+_0x2d0d36)){if(_0x53788b==0x0||_0x53788b==_0xac1f87[0x0][_0xb794('0x17')]){_0x576ef5=![];}_0x43bf13['push'](dbH[_0xb794('0x13')][_0xb794('0x14')](util['format'](_0xb794('0x19'),QUERY,_0x2d0d36,_0x33ac72),{'type':dbH[_0xb794('0x13')][_0xb794('0x15')][_0xb794('0x16')]}));}}}else{_0x43bf13[_0xb794('0x1a')](dbH['sequelize'][_0xb794('0x14')](QUERY,{'type':dbH[_0xb794('0x13')]['QueryTypes'][_0xb794('0x16')]}));}var _0x240c06=path[_0xb794('0x1b')](PATH);var _0x1b93dd=path[_0xb794('0x1c')](PATH,_0xb794('0x1d'));var _0x375b41=_0xf87756[_0xb794('0x10')]&&_0x43bf13[_0xb794('0x18')]>0x1;var _0x43e077=[];if(!fs[_0xb794('0x1e')](path[_0xb794('0x1f')](_0x240c06,_0x1b93dd))&&_0x375b41){fs[_0xb794('0x20')](path['join'](_0x240c06,_0x1b93dd));}return BPromise[_0xb794('0x21')](_0x43bf13,function(_0x3f6b71){_0x43e077[_0xb794('0x1a')](_0x3f6b71);})['then'](function(){for(var _0x4bebc9=0x0;_0x4bebc9<_0x43e077[_0xb794('0x18')];_0x4bebc9+=0x1){var _0x536444;var _0xdb29d7=_0x43e077[_0x4bebc9];if(_0x375b41){_0x536444=path[_0xb794('0x1f')](_0x240c06,_0x1b93dd,util['format']('%s%d.%s',_0x1b93dd,_0x4bebc9,_0xb794('0x22')));}else{_0x536444=path[_0xb794('0x1f')](_0x240c06,util[_0xb794('0xb')]('%s.%s',_0x1b93dd,'xlsx'));}fs[_0xb794('0x23')](_0x536444,json2xls(_0xdb29d7),_0xb794('0x24'));}})[_0xb794('0x12')](function(){if(_0x375b41){zipdir(path[_0xb794('0x1f')](_0x240c06,_0x1b93dd),{'saveTo':path[_0xb794('0x1f')](_0x240c06,util[_0xb794('0xb')]('%s.%s',_0x1b93dd,'zip'))},function(_0x54d796,_0x65397a){});rimraf(path[_0xb794('0x1f')](_0x240c06,_0x1b93dd),function(){});}})[_0xb794('0x12')](function(){logger['info'](util[_0xb794('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb794('0xd')));return analyticExtractedReport(_0xb794('0x25'),_0x375b41?util['format'](_0xb794('0x26'),_0x1b93dd,_0x375b41?'zip':_0xb794('0x22')):null);});})[_0xb794('0x27')](function(_0x4ec8ad){logger[_0xb794('0xa')](util[_0xb794('0xb')](_0xb794('0x28'),EXTRACTED_REPORT_ID,_0xb794('0xd')),util[_0xb794('0x29')](_0x4ec8ad,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb794('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f637696..260b11f 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 _0x30ec=['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)','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','VoiceExtension','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll','then','intervals','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','updatedAt','interval','IntervalId','tag','CDR(tag)=','length'];(function(_0x2e2a93,_0x2425f3){var _0x57381f=function(_0x39a67e){while(--_0x39a67e){_0x2e2a93['push'](_0x2e2a93['shift']());}};_0x57381f(++_0x2425f3);}(_0x30ec,0x11c));var _0xc30e=function(_0x5234a6,_0x314a5d){_0x5234a6=_0x5234a6-0x0;var _0x1f8955=_0x30ec[_0x5234a6];return _0x1f8955;};'use strict';var _=require(_0xc30e('0x0'));var util=require(_0xc30e('0x1'));function rewrite(_0x5ec9e1,_0x56cd0f){var _0xb42fcd=this;return _0x5ec9e1[_0xc30e('0x2')][_0xc30e('0x3')][_0xc30e('0x4')]({'raw':!![]})[_0xc30e('0x5')](function(_0xb3cda2){_0xb42fcd[_0xc30e('0x6')]=_0xb3cda2;return _0x5ec9e1[_0xc30e('0x2')]['VoiceExtension'][_0xc30e('0x4')]({'where':{'IntervalId':_0x56cd0f['IntervalId']},'raw':!![]});})[_0xc30e('0x5')](function(_0x2af6f1){return _0x5ec9e1[_0xc30e('0x2')]['VoiceExtension'][_0xc30e('0x4')]({'where':{'exten':{'$in':_[_0xc30e('0x7')](_[_0xc30e('0x8')](_0x2af6f1,_0xc30e('0x9')))}},'order':[{'raw':_0xc30e('0xa')}],'raw':!![]});})['then'](function(_0x243927){var _0x591041=_[_0xc30e('0xb')](_0x243927,{'priority':'1'});var _0x48bbf9=_['filter'](_0x243927,{'isApp':0x1});var _0x1a9b38=_[_0xc30e('0xc')](_0x48bbf9,'exten');var _0x3e4721=[_0xc30e('0xd'),_0xc30e('0xe')];var _0x1bc46c=[];var _0x82abe1=[];for(var _0x4bfdd8 in _0x1a9b38){if(_0x1a9b38[_0xc30e('0xf')](_0x4bfdd8)){_0xb42fcd[_0xc30e('0x10')]=0x2;_0xb42fcd[_0xc30e('0x11')]=[];_0xb42fcd[_0xc30e('0x12')]=_[_0xc30e('0x13')](_0x591041,{'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')]});_0xb42fcd['extensions'][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')],'app':_0xc30e('0x16'),'appdata':util['format']('CDR(type)=%s',_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')]),'context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd['priority']++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});if(_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')]===_0xc30e('0x19')){if(_0xb42fcd['extension']){_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0]['type'],'app':'Set','appdata':_0xc30e('0x1a')+(_0xb42fcd[_0xc30e('0x12')][_0xc30e('0x1b')]?_0xc30e('0x1c')+_0xb42fcd['extension']['cutdigits']+'}':_0xc30e('0x1d')),'context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd['priority']++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0]['VoiceExtensionId']});}_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0]['type'],'app':_0xc30e('0x16'),'appdata':'CDR(routeid)='+_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')],'context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd['priority']++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});var _0x466d31=_0xb42fcd[_0xc30e('0x10')]++;_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')],'app':_0xc30e('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x466d31+0x2)+_0xc30e('0x1f')+(_0x466d31+0x1)+')','context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0x466d31,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});if(_0xb42fcd['extension']){_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0]['type'],'app':'Set','appdata':_0xb42fcd[_0xc30e('0x12')][_0xc30e('0x1b')]?_0xc30e('0x20')+_0xb42fcd[_0xc30e('0x12')][_0xc30e('0x1b')]+'}':_0xc30e('0x21'),'context':_0x1a9b38[_0x4bfdd8][0x0]['context'],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd[_0xc30e('0x10')]++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});}_0xb42fcd['extensions'][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')],'app':_0xc30e('0x16'),'appdata':'outboundrouteid='+_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')],'context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0]['exten'],'priority':_0xb42fcd[_0xc30e('0x10')]++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});if(_0xb42fcd[_0xc30e('0x12')]&&_0xb42fcd[_0xc30e('0x12')]['hasOwnProperty'](_0xc30e('0x22'))&&_0xb42fcd[_0xc30e('0x12')]['recordingFormat']!==_0xc30e('0x23')){_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd[_0xc30e('0x10')]++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')],'app':_0xc30e('0x16'),'appdata':_0xc30e('0x24')+_0xb42fcd[_0xc30e('0x12')]['recordingFormat']||'wav','context':_0x1a9b38[_0x4bfdd8][0x0]['context'],'exten':_0x1a9b38[_0x4bfdd8][0x0]['exten'],'priority':_0xb42fcd['priority']++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});}}_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0]['type'],'app':_0xc30e('0x16'),'appdata':_0xc30e('0x25'),'context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd[_0xc30e('0x10')]++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')],'app':_0xc30e('0x16'),'appdata':_0xc30e('0x26'),'context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd[_0xc30e('0x10')]++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0]['type'],'app':_0xc30e('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x17')],'exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'priority':_0xb42fcd[_0xc30e('0x10')]++,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});for(var _0x13f2cb=0x0,_0x517426=0x0;_0x13f2cb<_0x1a9b38[_0x4bfdd8]['length'];_0x13f2cb+=0x1,_0x517426=0x0){var _0x3f29e8=_0x1a9b38[_0x4bfdd8][_0x13f2cb];if(_0x3f29e8[_0xc30e('0x15')]){_0x3f29e8[_0xc30e('0x15')]=_0x3f29e8[_0xc30e('0x15')][_0xc30e('0x27')]();}var _0x93c068=[];var _0x5ab191=[];delete _0x3f29e8['id'];delete _0x3f29e8['createdAt'];delete _0x3f29e8[_0xc30e('0x28')];var _0x28faad=_0x3f29e8[_0xc30e('0x29')]!=='*,*,*,*'?[_0x3f29e8[_0xc30e('0x29')]]:_0x3f29e8['IntervalId']?_[_0xc30e('0x8')](_[_0xc30e('0xb')](_0xb42fcd[_0xc30e('0x6')],{'IntervalId':_0x3f29e8[_0xc30e('0x2a')]}),_0xc30e('0x29')):[];if(_0x3f29e8[_0xc30e('0xf')]('tag')){if(_0x3f29e8[_0xc30e('0x2b')]&&_0x3f29e8['tag']!=='--'){_0x93c068['push']({'type':_0x3f29e8[_0xc30e('0x15')],'app':'Set','appdata':_0xc30e('0x2c')+_0x3f29e8[_0xc30e('0x2b')],'context':_0x3f29e8[_0xc30e('0x17')],'exten':_0x3f29e8['exten'],'priority':_0x28faad[_0xc30e('0x2d')]+_0xb42fcd['priority']+_0x517426++,'VoiceExtensionId':_0x3f29e8[_0xc30e('0x18')]});}}if(_0x3f29e8[_0xc30e('0x15')]===_0xc30e('0x19')&&_0x3f29e8[_0xc30e('0xf')](_0xc30e('0x2e'))){if(_0x3f29e8[_0xc30e('0x2e')]){_0x93c068[_0xc30e('0x14')]({'type':_0x3f29e8[_0xc30e('0x15')],'app':_0xc30e('0x1e'),'appdata':_0xc30e('0x2f')+_0x3f29e8['callerID']+')','context':_0x3f29e8['context'],'exten':_0x3f29e8[_0xc30e('0x9')],'priority':_0x28faad['length']+_0xb42fcd['priority']+_0x517426++,'VoiceExtensionId':_0x3f29e8[_0xc30e('0x18')]});}else{_0x93c068[_0xc30e('0x14')]({'type':_0x3f29e8[_0xc30e('0x15')],'app':_0xc30e('0x1e'),'appdata':_0xc30e('0x30'),'context':_0x3f29e8['context'],'exten':_0x3f29e8[_0xc30e('0x9')],'priority':_0x28faad[_0xc30e('0x2d')]+_0xb42fcd[_0xc30e('0x10')]+_0x517426++,'VoiceExtensionId':_0x3f29e8[_0xc30e('0x18')]});}}if(_0x3f29e8['hasOwnProperty']('answer')){if(_0x3e4721['indexOf'](_0x3f29e8[_0xc30e('0x31')][_0xc30e('0x27')]())>=0x0&&_0x3f29e8[_0xc30e('0x32')]!=='custom'){if(_0x3f29e8[_0xc30e('0x33')]){_0x93c068['push']({'type':_0x3f29e8[_0xc30e('0x15')],'app':_0xc30e('0x1e'),'appdata':_0xc30e('0x34'),'context':_0x3f29e8[_0xc30e('0x17')],'exten':_0x3f29e8[_0xc30e('0x9')],'priority':_0x28faad[_0xc30e('0x2d')]+_0xb42fcd[_0xc30e('0x10')]+_0x517426++,'VoiceExtensionId':_0x3f29e8[_0xc30e('0x18')]});_0x93c068[_0xc30e('0x14')]({'type':_0x3f29e8[_0xc30e('0x15')],'app':_0xc30e('0x16'),'appdata':_0xc30e('0x35'),'context':_0x3f29e8[_0xc30e('0x17')],'exten':_0x3f29e8[_0xc30e('0x9')],'priority':_0x28faad['length']+_0xb42fcd['priority']+_0x517426++,'VoiceExtensionId':_0x3f29e8[_0xc30e('0x18')]});}else{_0x93c068[_0xc30e('0x14')]({'type':_0x3f29e8[_0xc30e('0x15')],'app':_0xc30e('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3f29e8[_0xc30e('0x17')],'exten':_0x3f29e8[_0xc30e('0x9')],'priority':_0x28faad[_0xc30e('0x2d')]+_0xb42fcd[_0xc30e('0x10')]+_0x517426++,'VoiceExtensionId':_0x3f29e8[_0xc30e('0x18')]});_0x93c068[_0xc30e('0x14')]({'type':_0x3f29e8['type'],'app':_0xc30e('0x16'),'appdata':_0xc30e('0x36'),'context':_0x3f29e8[_0xc30e('0x17')],'exten':_0x3f29e8[_0xc30e('0x9')],'priority':_0x28faad[_0xc30e('0x2d')]+_0xb42fcd['priority']+_0x517426++,'VoiceExtensionId':_0x3f29e8['VoiceExtensionId']});}}}for(var _0x4eee62=0x0;_0x4eee62<_0x28faad[_0xc30e('0x2d')];_0x4eee62+=0x1){var _0x3a92cb=_0xb42fcd[_0xc30e('0x10')]+_0x28faad['length'];var _0x559126=_0x4eee62===_0x28faad['length']-0x1?_0xb42fcd[_0xc30e('0x10')]+_0x93c068[_0xc30e('0x2d')]+_0x5ab191['length']+0x2:_0xb42fcd['priority']+_0x4eee62+0x1;_0x93c068['splice'](_0x4eee62,0x0,{'type':_0x3f29e8[_0xc30e('0x15')],'app':_0xc30e('0x37'),'appdata':_0x28faad[_0x4eee62]+'?'+_0x3f29e8[_0xc30e('0x17')]+_0xc30e('0x38')+_0x3a92cb+':'+_0x3f29e8['context']+_0xc30e('0x38')+_0x559126,'exten':_0x3f29e8[_0xc30e('0x9')],'context':_0x3f29e8[_0xc30e('0x17')],'priority':_0xb42fcd[_0xc30e('0x10')]+_0x4eee62,'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]});}_0x3f29e8[_0xc30e('0x10')]=_0x93c068[_0xc30e('0x2d')]?_['last'](_0x93c068)[_0xc30e('0x10')]+0x1:_0xb42fcd[_0xc30e('0x10')];_0xb42fcd[_0xc30e('0x10')]=(_0x5ab191[_0xc30e('0x2d')]?_[_0xc30e('0x39')](_0x5ab191)[_0xc30e('0x10')]:_0x3f29e8['priority'])+0x1;_0xb42fcd[_0xc30e('0x11')]=_[_0xc30e('0x3a')](_0xb42fcd['extensions'],_0x93c068,[_0x3f29e8],_0x5ab191);}_0xb42fcd[_0xc30e('0x11')][_0xc30e('0x14')]({'type':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x15')],'app':'Hangup','exten':_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x9')],'context':_0x1a9b38[_0x4bfdd8][0x0]['context'],'priority':_0xb42fcd[_0xc30e('0x10')],'VoiceExtensionId':_0x1a9b38[_0x4bfdd8][0x0]['VoiceExtensionId']});_0x1bc46c[_0xc30e('0x14')](_0x1a9b38[_0x4bfdd8][0x0][_0xc30e('0x18')]);_0x82abe1=_[_0xc30e('0x3a')](_0x82abe1,_0xb42fcd['extensions']);}}return _0x5ec9e1[_0xc30e('0x3b')](function(_0x4ba72b){return _0x5ec9e1[_0xc30e('0x2')]['VoiceExtension'][_0xc30e('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x1bc46c}},'transaction':_0x4ba72b})[_0xc30e('0x5')](function(_0x431d20){return _0x5ec9e1[_0xc30e('0x2')][_0xc30e('0x3d')][_0xc30e('0x3e')](_[_0xc30e('0x3f')](_0x82abe1,'priority'),{'transaction':_0x4ba72b});});});})[_0xc30e('0x40')](function(_0xa14471){console[_0xc30e('0x41')](_0xa14471);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xc36d=['extensions','extension','find','push','CDR(type)=%s','type','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','context','Set','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','filter','queue','playback','hasOwnProperty','priority'];(function(_0x57d52f,_0x569417){var _0x39906d=function(_0x407254){while(--_0x407254){_0x57d52f['push'](_0x57d52f['shift']());}};_0x39906d(++_0x569417);}(_0xc36d,0x7d));var _0xdc36=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xc36d[_0x29ce14];return _0x48f289;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));function rewrite(_0x2d50af,_0x16dd4a){var _0x471240=this;return _0x2d50af[_0xdc36('0x2')]['Interval'][_0xdc36('0x3')]({'raw':!![]})[_0xdc36('0x4')](function(_0x53ac17){_0x471240[_0xdc36('0x5')]=_0x53ac17;return _0x2d50af[_0xdc36('0x2')][_0xdc36('0x6')][_0xdc36('0x3')]({'where':{'IntervalId':_0x16dd4a[_0xdc36('0x7')]},'raw':!![]});})['then'](function(_0x20ba02){return _0x2d50af[_0xdc36('0x2')][_0xdc36('0x6')][_0xdc36('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0xdc36('0x8')](_0x20ba02,_0xdc36('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xdc36('0x4')](function(_0x1cb73d){var _0x2483bd=_['filter'](_0x1cb73d,{'priority':'1'});var _0x251189=_[_0xdc36('0xa')](_0x1cb73d,{'isApp':0x1});var _0x4fda43=_['groupBy'](_0x251189,_0xdc36('0x9'));var _0x276692=[_0xdc36('0xb'),_0xdc36('0xc')];var _0x522d33=[];var _0x2b3f64=[];for(var _0x3d36bc in _0x4fda43){if(_0x4fda43[_0xdc36('0xd')](_0x3d36bc)){_0x471240[_0xdc36('0xe')]=0x2;_0x471240[_0xdc36('0xf')]=[];_0x471240[_0xdc36('0x10')]=_[_0xdc36('0x11')](_0x2483bd,{'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')]});_0x471240['extensions'][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0]['type'],'app':'Set','appdata':util['format'](_0xdc36('0x13'),_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')]),'context':_0x4fda43[_0x3d36bc][0x0]['context'],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240[_0xdc36('0xe')]++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});if(_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')]===_0xdc36('0x16')){if(_0x471240[_0xdc36('0x10')]){_0x471240['extensions'][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':'Set','appdata':_0xdc36('0x17')+(_0x471240[_0xdc36('0x10')][_0xdc36('0x18')]?'${EXTEN:'+_0x471240[_0xdc36('0x10')][_0xdc36('0x18')]+'}':'${EXTEN}'),'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0]['exten'],'priority':_0x471240['priority']++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});}_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':_0xdc36('0x1a'),'appdata':_0xdc36('0x1b')+_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')],'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0]['exten'],'priority':_0x471240[_0xdc36('0xe')]++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0]['VoiceExtensionId']});var _0x2338d7=_0x471240[_0xdc36('0xe')]++;_0x471240[_0xdc36('0xf')]['push']({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':_0xdc36('0x1c'),'appdata':_0xdc36('0x1d')+(_0x2338d7+0x2)+'):Goto('+(_0x2338d7+0x1)+')','context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x2338d7,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});if(_0x471240['extension']){_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0]['type'],'app':_0xdc36('0x1a'),'appdata':_0x471240[_0xdc36('0x10')]['cutdigits']?_0xdc36('0x1e')+_0x471240['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240['priority']++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});}_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0]['type'],'app':_0xdc36('0x1a'),'appdata':_0xdc36('0x1f')+_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')],'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240[_0xdc36('0xe')]++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});if(_0x471240['extension']&&_0x471240[_0xdc36('0x10')][_0xdc36('0xd')]('recordingFormat')&&_0x471240['extension'][_0xdc36('0x20')]!==_0xdc36('0x21')){_0x471240[_0xdc36('0xf')]['push']({'type':_0x4fda43[_0x3d36bc][0x0]['type'],'app':_0xdc36('0x1a'),'appdata':_0xdc36('0x22'),'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240[_0xdc36('0xe')]++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':_0xdc36('0x1a'),'appdata':_0xdc36('0x23')+_0x471240['extension'][_0xdc36('0x20')]||_0xdc36('0x24'),'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240['priority']++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});}}_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':'Set','appdata':_0xdc36('0x25'),'context':_0x4fda43[_0x3d36bc][0x0]['context'],'exten':_0x4fda43[_0x3d36bc][0x0]['exten'],'priority':_0x471240[_0xdc36('0xe')]++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});_0x471240[_0xdc36('0xf')]['push']({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':'Set','appdata':_0xdc36('0x26'),'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240['priority']++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x14')],'app':'Set','appdata':_0xdc36('0x27'),'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'exten':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x9')],'priority':_0x471240['priority']++,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0]['VoiceExtensionId']});for(var _0x2cefcf=0x0,_0x2869c6=0x0;_0x2cefcf<_0x4fda43[_0x3d36bc]['length'];_0x2cefcf+=0x1,_0x2869c6=0x0){var _0x4a7580=_0x4fda43[_0x3d36bc][_0x2cefcf];if(_0x4a7580[_0xdc36('0x14')]){_0x4a7580[_0xdc36('0x14')]=_0x4a7580[_0xdc36('0x14')][_0xdc36('0x28')]();}var _0x26fb8c=[];var _0x3cb2ed=[];delete _0x4a7580['id'];delete _0x4a7580[_0xdc36('0x29')];delete _0x4a7580[_0xdc36('0x2a')];var _0x2f4c89=_0x4a7580[_0xdc36('0x2b')]!==_0xdc36('0x2c')?[_0x4a7580[_0xdc36('0x2b')]]:_0x4a7580[_0xdc36('0x7')]?_[_0xdc36('0x8')](_[_0xdc36('0xa')](_0x471240[_0xdc36('0x5')],{'IntervalId':_0x4a7580[_0xdc36('0x7')]}),_0xdc36('0x2b')):[];if(_0x4a7580[_0xdc36('0xd')](_0xdc36('0x2d'))){if(_0x4a7580[_0xdc36('0x2d')]&&_0x4a7580[_0xdc36('0x2d')]!=='--'){_0x26fb8c[_0xdc36('0x12')]({'type':_0x4a7580[_0xdc36('0x14')],'app':_0xdc36('0x1a'),'appdata':_0xdc36('0x2e')+_0x4a7580['tag'],'context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89['length']+_0x471240['priority']+_0x2869c6++,'VoiceExtensionId':_0x4a7580[_0xdc36('0x15')]});}}if(_0x4a7580['type']===_0xdc36('0x16')&&_0x4a7580['hasOwnProperty'](_0xdc36('0x2f'))){if(_0x4a7580[_0xdc36('0x2f')]){_0x26fb8c[_0xdc36('0x12')]({'type':_0x4a7580[_0xdc36('0x14')],'app':_0xdc36('0x1c'),'appdata':_0xdc36('0x30')+_0x4a7580[_0xdc36('0x2f')]+')','context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89[_0xdc36('0x31')]+_0x471240[_0xdc36('0xe')]+_0x2869c6++,'VoiceExtensionId':_0x4a7580[_0xdc36('0x15')]});}else{_0x26fb8c[_0xdc36('0x12')]({'type':_0x4a7580[_0xdc36('0x14')],'app':_0xdc36('0x1c'),'appdata':_0xdc36('0x32'),'context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89['length']+_0x471240['priority']+_0x2869c6++,'VoiceExtensionId':_0x4a7580[_0xdc36('0x15')]});}}if(_0x4a7580[_0xdc36('0xd')](_0xdc36('0x33'))){if(_0x276692[_0xdc36('0x34')](_0x4a7580[_0xdc36('0x35')][_0xdc36('0x28')]())>=0x0&&_0x4a7580['appType']!==_0xdc36('0x36')){if(_0x4a7580[_0xdc36('0x33')]){_0x26fb8c[_0xdc36('0x12')]({'type':_0x4a7580['type'],'app':_0xdc36('0x1c'),'appdata':_0xdc36('0x37'),'context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89[_0xdc36('0x31')]+_0x471240[_0xdc36('0xe')]+_0x2869c6++,'VoiceExtensionId':_0x4a7580['VoiceExtensionId']});_0x26fb8c[_0xdc36('0x12')]({'type':_0x4a7580[_0xdc36('0x14')],'app':_0xdc36('0x1a'),'appdata':_0xdc36('0x38'),'context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89[_0xdc36('0x31')]+_0x471240[_0xdc36('0xe')]+_0x2869c6++,'VoiceExtensionId':_0x4a7580['VoiceExtensionId']});}else{_0x26fb8c[_0xdc36('0x12')]({'type':_0x4a7580[_0xdc36('0x14')],'app':_0xdc36('0x1c'),'appdata':_0xdc36('0x39'),'context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89[_0xdc36('0x31')]+_0x471240[_0xdc36('0xe')]+_0x2869c6++,'VoiceExtensionId':_0x4a7580['VoiceExtensionId']});_0x26fb8c['push']({'type':_0x4a7580[_0xdc36('0x14')],'app':_0xdc36('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4a7580[_0xdc36('0x19')],'exten':_0x4a7580[_0xdc36('0x9')],'priority':_0x2f4c89['length']+_0x471240['priority']+_0x2869c6++,'VoiceExtensionId':_0x4a7580[_0xdc36('0x15')]});}}}for(var _0x5cf2ee=0x0;_0x5cf2ee<_0x2f4c89[_0xdc36('0x31')];_0x5cf2ee+=0x1){var _0x5eb1e5=_0x471240[_0xdc36('0xe')]+_0x2f4c89['length'];var _0x510837=_0x5cf2ee===_0x2f4c89[_0xdc36('0x31')]-0x1?_0x471240['priority']+_0x26fb8c[_0xdc36('0x31')]+_0x3cb2ed[_0xdc36('0x31')]+0x2:_0x471240[_0xdc36('0xe')]+_0x5cf2ee+0x1;_0x26fb8c[_0xdc36('0x3a')](_0x5cf2ee,0x0,{'type':_0x4a7580[_0xdc36('0x14')],'app':'GotoIfTime','appdata':_0x2f4c89[_0x5cf2ee]+'?'+_0x4a7580[_0xdc36('0x19')]+_0xdc36('0x3b')+_0x5eb1e5+':'+_0x4a7580[_0xdc36('0x19')]+',${EXTEN},'+_0x510837,'exten':_0x4a7580['exten'],'context':_0x4a7580[_0xdc36('0x19')],'priority':_0x471240['priority']+_0x5cf2ee,'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});}_0x4a7580[_0xdc36('0xe')]=_0x26fb8c[_0xdc36('0x31')]?_[_0xdc36('0x3c')](_0x26fb8c)['priority']+0x1:_0x471240['priority'];_0x471240[_0xdc36('0xe')]=(_0x3cb2ed[_0xdc36('0x31')]?_[_0xdc36('0x3c')](_0x3cb2ed)[_0xdc36('0xe')]:_0x4a7580[_0xdc36('0xe')])+0x1;_0x471240[_0xdc36('0xf')]=_[_0xdc36('0x3d')](_0x471240[_0xdc36('0xf')],_0x26fb8c,[_0x4a7580],_0x3cb2ed);}_0x471240[_0xdc36('0xf')][_0xdc36('0x12')]({'type':_0x4fda43[_0x3d36bc][0x0]['type'],'app':_0xdc36('0x3e'),'exten':_0x4fda43[_0x3d36bc][0x0]['exten'],'context':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x19')],'priority':_0x471240[_0xdc36('0xe')],'VoiceExtensionId':_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]});_0x522d33[_0xdc36('0x12')](_0x4fda43[_0x3d36bc][0x0][_0xdc36('0x15')]);_0x2b3f64=_[_0xdc36('0x3d')](_0x2b3f64,_0x471240[_0xdc36('0xf')]);}}return _0x2d50af[_0xdc36('0x3f')](function(_0x355530){return _0x2d50af[_0xdc36('0x2')][_0xdc36('0x6')][_0xdc36('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x522d33}},'transaction':_0x355530})[_0xdc36('0x4')](function(_0x309aec){return _0x2d50af[_0xdc36('0x2')][_0xdc36('0x6')][_0xdc36('0x41')](_[_0xdc36('0x42')](_0x2b3f64,_0xdc36('0xe')),{'transaction':_0x355530});});});})[_0xdc36('0x43')](function(_0x5e52e2){console[_0xdc36('0x44')](_0x5e52e2);});}exports[_0xdc36('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8c42851..912c3ec 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x16556d,_0x1d3277){var _0x3a22ae=function(_0x2475d3){while(--_0x2475d3){_0x16556d['push'](_0x16556d['shift']());}};_0x3a22ae(++_0x1d3277);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0x70e0=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect'];(function(_0x28184b,_0x2031d0){var _0xf68df4=function(_0x5aa742){while(--_0x5aa742){_0x28184b['push'](_0x28184b['shift']());}};_0xf68df4(++_0x2031d0);}(_0x70e0,0x17b));var _0x070e=function(_0x1abfc8,_0x5783cd){_0x1abfc8=_0x1abfc8-0x0;var _0xcdd2b7=_0x70e0[_0x1abfc8];return _0xcdd2b7;};'use strict';var BPromise=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('api');config[_0x070e('0x7')]=_['defaults'](config[_0x070e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x8'))[_0x070e('0x9')](socket);try{if(!process[_0x070e('0xa')][0x2]||process[_0x070e('0xa')][0x2]===_0x070e('0xb')||process[_0x070e('0xa')][0x2]===_0x070e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x070e('0xa')][0x3]||process[_0x070e('0xa')][0x3]===_0x070e('0xb')||process[_0x070e('0xa')][0x3]===_0x070e('0xc')||!process[_0x070e('0xa')][0x4]||process[_0x070e('0xa')][0x4]===_0x070e('0xb')||process[_0x070e('0xa')][0x4]===_0x070e('0xc')){throw new Error(_0x070e('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x070e('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x070e('0xa')][0x5]===_0x070e('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x070e('0xf'));}var LISTID=process[_0x070e('0xa')][0x5];var COMPANYID=process[_0x070e('0xa')][0x6]&&process[_0x070e('0xa')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0xc')?process[_0x070e('0xa')][0x6]:null;var DUPLICATES=process[_0x070e('0xa')][0x7]&&process[_0x070e('0xa')][0x7]!==_0x070e('0xb')&&process['argv'][0x7]!==_0x070e('0xc')?process[_0x070e('0xa')][0x7]:null;if(!process[_0x070e('0xa')][0x8]||process[_0x070e('0xa')][0x8]===_0x070e('0xb')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x070e('0xa')][0x8];}catch(_0x3004f0){logger[_0x070e('0x10')](_0x3004f0);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4be0d7,_0x5b184,_0x5dc5d2,_0xf8dd5d){var _0x3f6985={'message':_0x5b184};_0x3f6985[_0x4be0d7]=!![];if(_0x5dc5d2){_0x3f6985[_0x070e('0x11')]=_0x5dc5d2;}if(_0xf8dd5d){_0x3f6985[_0x070e('0x12')]=_0xf8dd5d;}return _0x3f6985;}function isEmail(_0x28a1c3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x070e('0x13')](_0x28a1c3);}function checkRow(_0xe405e,_0x164cdf,_0x595c7e){return new BPromise(function(_0x2f8055,_0x270061){if(_[_0x070e('0x14')](_0xe405e)){return _0x270061(handleCheckRowError('error',_0x070e('0x15'),null,_0x595c7e));}if(_0xe405e['errors']&&_0xe405e['errors'][_0x070e('0x16')]){var _0x25f6e=_[_0x070e('0x17')](_0xe405e[_0x070e('0x18')],_0x070e('0x19'))['join'](';');return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x25f6e,null,_0x595c7e));}var _0x219e48={};for(var _0x1d72d6 in FIELDS){if(FIELDS[_0x070e('0x1a')](_0x1d72d6)&&FIELDS[_0x1d72d6]){_0x219e48[_0x1d72d6]=_0xe405e[_0x070e('0x1b')][0x0][FIELDS[_0x1d72d6]]||_0xe405e[_0x070e('0x1b')][0x0]['\ufeff'+FIELDS[_0x1d72d6]];}}if(!_0x219e48[_0x070e('0x1c')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),'firstName\x20not\x20specified!',null,_0x595c7e));}if(!_0x219e48[_0x070e('0x1d')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1e'),null,_0x595c7e));}if(_0x219e48['birthDate']){var _0x5c5f0d=moment(_0x219e48[_0x070e('0x1f')],_0x070e('0x20'));if(!_0x5c5f0d[_0x070e('0x21')]()){return _0x270061(handleCheckRowError('error',_0x070e('0x22'),null,_0x595c7e));}}if(_0x219e48[_0x070e('0x23')]){if(!isEmail(_0x219e48[_0x070e('0x23')])){return _0x270061(handleCheckRowError(_0x070e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x595c7e));}}_0x219e48['ListId']=LISTID;_0x219e48['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x164cdf){var _0xdf8945={};for(var _0x4e0a7d=0x0,_0x1dff97=DUPLICATES[_0x070e('0x16')];_0x4e0a7d<_0x1dff97;_0x4e0a7d+=0x1){_0xdf8945[DUPLICATES[_0x4e0a7d]]=_0x219e48[DUPLICATES[_0x4e0a7d]];}var _0x4f8130=_['find'](_0x164cdf,_0xdf8945);if(_0x4f8130){return _0x270061(handleCheckRowError(_0x070e('0x24'),_0x070e('0x25'),_0x4f8130,_0x595c7e));}}return db['CmContact']['create'](_0x219e48,{'raw':!![],'hooks':![],'fields':_[_0x070e('0x26')](_0x219e48)})[_0x070e('0x27')](function(_0x444d02){if(DUPLICATES&&DUPLICATES[_0x070e('0x16')]&&_0x164cdf){_0x164cdf[_0x070e('0x28')](_['pick'](_0x219e48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d02['id'];return _0x2f8055();})['catch'](function(_0x24d17d){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x29')+(_0x24d17d[_0x070e('0x19')]||JSON[_0x070e('0x2a')](_0x24d17d)),null,_0x595c7e));});});}function checkHopper(){function _0x4deaf8(){return function(_0x22f3a9){logger[_0x070e('0x10')]('cmContact',_0x070e('0x2b'),util[_0x070e('0x2c')](_0x22f3a9,{'showHidden':![],'depth':null}));};}var _0x4ba6f0=function(_0x4d4ee8,_0x5ddbe9){var _0x363bff=squel[_0x070e('0x2d')]()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x5ddbe9,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone',_0x070e('0x1d'))[_0x070e('0x36')]('NOW()',_0x070e('0x31'))['field']('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x4d4ee8['id']['toString'](),_0x5ddbe9)[_0x070e('0x36')]('NOW()','createdAt')[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'))[_0x070e('0x3d')]('cm_hopper')[_0x070e('0x3a')](_0x5ddbe9+'\x20=\x20?',_0x4d4ee8['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x363bff;};var _0xff760c=function(_0x52fcea,_0x54285a){var _0x261a27=squel['insert']()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),'ListId',_0x54285a,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'),_0x070e('0x1d'))['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x52fcea['id'][_0x070e('0x37')](),_0x54285a)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))['where'](_0x070e('0x42'))['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()['field'](_0x070e('0x43'))[_0x070e('0x3d')](_0x070e('0x44'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]()))[_0x070e('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x35')]()['field']('phone')[_0x070e('0x3d')](_0x070e('0x2f'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x261a27;};function _0x440fa1(_0x343785,_0x53bea1){var _0x477e69=squel['insert']()['into'](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x53bea1,_0x070e('0x3e'),_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone','phone')['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))['field'](LISTID[_0x070e('0x37')](),'ListId')[_0x070e('0x36')](_0x343785['id'][_0x070e('0x37')](),_0x53bea1)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')]('NOW()',_0x070e('0x34'))[_0x070e('0x3d')](_0x070e('0x39'))['where'](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where'](_0x070e('0x40'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x477e69;}function _0x1ae5cb(_0x1100d8,_0x122198){var _0x3cb9ee=squel[_0x070e('0x2d')]()['into'](_0x070e('0x46'))['fromQuery']([_0x070e('0x1d'),'ContactId',_0x070e('0x33'),_0x122198,_0x070e('0x3e'),'updatedAt'],squel[_0x070e('0x35')]()['field'](_0x070e('0x1d'),_0x070e('0x1d'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x1100d8['id'][_0x070e('0x37')](),_0x122198)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),'updatedAt')[_0x070e('0x3d')](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))['where'](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))[_0x070e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x3cb9ee;}return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x070e('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x36373d){var _0x3a1ad2=[];if(_0x36373d){var _0x150bf6;for(var _0x2a20d4=0x0,_0x50ef9f;_0x2a20d4<_0x36373d[_0x070e('0x16')];_0x2a20d4+=0x1){_0x50ef9f=_0x36373d[_0x2a20d4][_0x070e('0x4b')]({'plain':!![]});switch(_0x50ef9f[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0xff760c(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case'onlyIfOpen':_0x3a1ad2[_0x070e('0x28')](db['sequelize'][_0x070e('0x51')](_0x4ba6f0(_0x50ef9f,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0x440fa1(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})['catch'](_0x4deaf8()));}}}return _0x3a1ad2;})['all']()[_0x070e('0x27')](function(){return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id'],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x332c8a){var _0x25b599=[];if(_0x332c8a){var _0x1d1f44;for(var _0x72077d=0x0,_0x25670e;_0x72077d<_0x332c8a[_0x070e('0x16')];_0x72077d+=0x1){_0x25670e=_0x332c8a[_0x72077d]['get']({'plain':!![]});_0x25b599[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x1ae5cb(_0x25670e,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x25b599;})[_0x070e('0x53')]();})[_0x070e('0x27')](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id',_0x070e('0x4c')],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x55'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x62800d){var _0x2084a1=[];if(_0x62800d){for(var _0x46ec49=0x0,_0x595e2e;_0x46ec49<_0x62800d['length'];_0x46ec49+=0x1){_0x595e2e=_0x62800d[_0x46ec49]['get']({'plain':!![]});switch(_0x595e2e[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0xff760c(_0x595e2e,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case _0x070e('0x57'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x4ba6f0(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x440fa1(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));}}}return _0x2084a1;})[_0x070e('0x53')]();})['then'](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0xf0aef8){var _0x4da906=[];if(_0xf0aef8){for(var _0x40d7e6=0x0,_0xe8c476;_0x40d7e6<_0xf0aef8[_0x070e('0x16')];_0x40d7e6+=0x1){_0xe8c476=_0xf0aef8[_0x40d7e6][_0x070e('0x4b')]({'plain':!![]});_0x4da906[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x1ae5cb(_0xe8c476,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x4da906;})[_0x070e('0x53')]();})[_0x070e('0x50')](function(_0x18c27a){logger['error'](_0x070e('0x58'),_0x070e('0x59'),_0x18c27a[_0x070e('0x19')]);});}var processPromises=function(_0x1b71dd){return BPromise[_0x070e('0x53')](promises)[_0x070e('0x27')](function(_0x5c4352){})['catch'](function(_0x4a8563){logger[_0x070e('0x10')](_0x070e('0x5a'),JSON[_0x070e('0x2a')](_0x4a8563));})[_0x070e('0x5b')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b71dd){return _0x1b71dd[_0x070e('0x5d')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x27')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5f')](FILEPATH);}catch(_0x59e6e5){logger['error'](_0x070e('0x60'),JSON[_0x070e('0x2a')](_0x59e6e5));}finally{process['exit'](0x0);}});};process['on'](_0x070e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x070e('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x070e('0xe')](',');return db[_0x070e('0x62')][_0x070e('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x070e('0x27')](function(_0x341756){var _0x2a12a1=fs[_0x070e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x64')](_0x2a12a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xdcc60a,_0x4e0f6e){total+=0x1;var _0x1306e6=total;promises[_0x070e('0x28')](checkRow(_0xdcc60a,_0x341756,_0x1306e6)[_0x070e('0x27')](function(){success+=0x1;})[_0x070e('0x50')](function(_0x3f2bb5){if(_0x3f2bb5[_0x070e('0x10')]){errors+=0x1;delete _0x3f2bb5[_0x070e('0x10')];}else if(_0x3f2bb5[_0x070e('0x24')]){duplicates+=0x1;delete _0x3f2bb5[_0x070e('0x24')];}rows[_0x070e('0x28')](_0x3f2bb5);}));if(total%0xc8===0x0){_0x4e0f6e[_0x070e('0x65')]();return processPromises(_0x4e0f6e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x070e('0x66')](_0x070e('0x67'));endCsv();});},'error':function(_0x449337,_0xe50b1b){logger['info'](_0x070e('0x68'),JSON[_0x070e('0x2a')](_0x449337));endCsv();}});})[_0x070e('0x50')](function(_0x2bad43){logger[_0x070e('0x10')](_0x070e('0x69'),JSON['stringify'](_0x2bad43));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 878651c..ab19042 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 _0xee39=['socket_timestamp','root','.csv','header','createReadStream','data','length','rows','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','UserId','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','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','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','from','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','select','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','field','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','push','catch','stringify','send','start','binding'];(function(_0x1e396a,_0x307e7e){var _0x31a805=function(_0x1e2e5c){while(--_0x1e2e5c){_0x1e396a['push'](_0x1e396a['shift']());}};_0x31a805(++_0x307e7e);}(_0xee39,0x142));var _0x9ee3=function(_0x2fb563,_0x93de6f){_0x2fb563=_0x2fb563-0x0;var _0x470d3b=_0xee39[_0x2fb563];return _0x470d3b;};'use strict';var fs=require('fs');var path=require(_0x9ee3('0x0'));var _=require(_0x9ee3('0x1'));var Papa=require(_0x9ee3('0x2'));var util=require(_0x9ee3('0x3'));var BPromise=require('bluebird');var moment=require(_0x9ee3('0x4'));var squel=require(_0x9ee3('0x5'));var Redis=require('ioredis');var db=require(_0x9ee3('0x6'))['db'];var config=require(_0x9ee3('0x7'));var logger=require('../../../config/logger')(_0x9ee3('0x8'));config['redis']=_[_0x9ee3('0x9')](config[_0x9ee3('0xa')],{'host':_0x9ee3('0xb'),'port':0x18eb});var socket=require(_0x9ee3('0xc'))(new Redis(config[_0x9ee3('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x9ee3('0xd')](_0x9ee3('0xe'));function isEmail(_0x5df999){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))*$/[_0x9ee3('0xf')](_0x5df999);}function selectNotIn(_0x29619e,_0x559c67,_0x51c5ae,_0x171e22,_0xf89e80){return squel['select']()['field'](_0x9ee3('0x10'))[_0x9ee3('0x11')](_0x171e22)['join'](_0x559c67,null,_0x559c67+'.id\x20=\x20'+_0x171e22+'.'+_0x51c5ae)[_0x9ee3('0x12')](_0x171e22+'.'+_0x51c5ae+_0x9ee3('0x13')+_0x29619e+'.'+_0x51c5ae)['where'](_0x559c67+'.dialCheckDuplicateType\x20IN\x20('+_0xf89e80['join']()+')');}function insertCmHopper(_0x44e65d,_0x167aa5,_0x114d2c,_0x240201,_0x4714aa){var _0x39e84b=[_0x9ee3('0x14'),_0x9ee3('0x15'),_0x9ee3('0x16'),_0x9ee3('0x17'),_0x167aa5+'.'+_0x240201,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x9ee3('0x18'),'\x22'+_0x4714aa+'\x22'];return squel[_0x9ee3('0x19')]()[_0x9ee3('0x1a')](_0x9ee3('0x1b'))[_0x9ee3('0x1c')]([_0x9ee3('0x10'),_0x9ee3('0x1d'),_0x9ee3('0x1e'),'ListId',_0x240201,_0x9ee3('0x1f'),_0x9ee3('0x20'),'priority','UserId','recallme'],squel[_0x9ee3('0x21')]()[_0x9ee3('0x22')](_0x39e84b)['from'](_0x167aa5)[_0x9ee3('0x23')](_0x9ee3('0x24'),null,_0x9ee3('0x25')+_0x167aa5+_0x9ee3('0x26'))[_0x9ee3('0x23')](_0x114d2c,null,_0x114d2c+_0x9ee3('0x27')+_0x167aa5+'.'+_0x240201)[_0x9ee3('0x12')](_0x167aa5+_0x9ee3('0x28'),_0x44e65d)[_0x9ee3('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9ee3('0x12')](_0x9ee3('0x29'),selectNotIn(_0x167aa5,_0x114d2c,_0x240201,_0x9ee3('0x1b'),[_0x9ee3('0x2a'),_0x9ee3('0x2b')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x167aa5,_0x114d2c,_0x240201,'cm_hopper',[_0x9ee3('0x2a')])))[_0x9ee3('0x2c')]();}function insertCmHopperBlack(_0x1b584e,_0x1f0eb4,_0x4a6299,_0x11ec10){var _0x5a94cc=[_0x9ee3('0x14'),'cm_contacts.id','cm_contacts.ListId',_0x1f0eb4+'.'+_0x11ec10,_0x9ee3('0x2d'),_0x9ee3('0x2e')];return squel[_0x9ee3('0x19')]()['into'](_0x9ee3('0x2f'))['fromQuery']([_0x9ee3('0x10'),'ContactId','ListId',_0x11ec10,_0x9ee3('0x1f'),_0x9ee3('0x20')],squel[_0x9ee3('0x21')]()['fields'](_0x5a94cc)[_0x9ee3('0x11')](_0x1f0eb4)[_0x9ee3('0x23')]('cm_contacts',null,_0x9ee3('0x25')+_0x1f0eb4+_0x9ee3('0x26'))[_0x9ee3('0x23')](_0x4a6299,null,_0x4a6299+_0x9ee3('0x27')+_0x1f0eb4+'.'+_0x11ec10)[_0x9ee3('0x12')](_0x1f0eb4+'.CmListId\x20=\x20?',_0x1b584e)[_0x9ee3('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9ee3('0x12')](_0x9ee3('0x29'),squel[_0x9ee3('0x21')]()['field'](_0x9ee3('0x10'))['from']('cm_hopper_black')[_0x9ee3('0x12')](_0x9ee3('0x30'),_0x1b584e)[_0x9ee3('0x12')](_0x11ec10+_0x9ee3('0x31'),_0x1f0eb4+'.'+_0x11ec10)))[_0x9ee3('0x2c')]();}function insertCmContact(_0x179657,_0x1c5e76,_0x4cf4a5,_0x97cf59){var _0xf5e98=_[_0x9ee3('0x32')](_[_0x9ee3('0x33')](_0x97cf59),[_0x9ee3('0x34'),_0x9ee3('0x35'),_0x9ee3('0x1f'),_0x9ee3('0x20')]);return squel['insert']()['into'](_0x9ee3('0x24'))[_0x9ee3('0x1c')](_0xf5e98,squel[_0x9ee3('0x21')]()['fields'](_0xf5e98)['from'](_0x1c5e76)[_0x9ee3('0x12')]('('+_0x4cf4a5['join'](',')+_0x9ee3('0x36'),squel['select']()[_0x9ee3('0x22')](_0x4cf4a5)['from'](_0x9ee3('0x24'))[_0x9ee3('0x12')](_0x9ee3('0x30'),_0x179657)[_0x9ee3('0x12')]('deletedAt\x20IS\x20NULL'))[_0x9ee3('0x12')](_0x9ee3('0x37'),squel['select']()[_0x9ee3('0x38')](_0x9ee3('0x39'),_0x9ee3('0x3a'))[_0x9ee3('0x11')](_0x1c5e76)['group'](_0x4cf4a5[_0x9ee3('0x23')](','))))[_0x9ee3('0x2c')]();}function handleStop(){logger[_0x9ee3('0x3b')](_0x9ee3('0x3c'));stopped=!![];}function handleUncaughtException(_0x34220e){logger[_0x9ee3('0x3d')](_0x34220e[_0x9ee3('0x3e')]);process[_0x9ee3('0x3f')](0x1);}function handleError(_0x78dade,_0x59d558){stats[_0x9ee3('0x40')]['push']({'name':_0x59d558[_0x9ee3('0x41')],'message':_0x59d558['message'],'row':_0x78dade});}function handleQuery(_0x1abd6e){logger['info'](_0x1abd6e);return db[_0x9ee3('0x42')][_0x9ee3('0x43')](_0x1abd6e)['spread'](function(_0x31aa89){results[_0x9ee3('0x44')](_0x31aa89);})[_0x9ee3('0x45')](function(_0x12d384){logger['error'](_0x12d384[_0x9ee3('0x3e')]);});}function main(_0x48776f,_0x304ab9,_0x200bc7,_0x777dfb){logger[_0x9ee3('0x3b')]('main',_0x48776f,JSON[_0x9ee3('0x46')](_0x304ab9));process[_0x9ee3('0x47')](_0x9ee3('0x48'));var _0x1f6b9d=_0x304ab9[_0x9ee3('0x49')];var _0x513824=_0x304ab9[_0x9ee3('0x4a')];var _0x4f79cf=path[_0x9ee3('0x23')](config[_0x9ee3('0x4b')],'server/files/tmp',_0x513824+_0x9ee3('0x4c'));var _0x37fc1a=_[_0x9ee3('0x33')](_0x1f6b9d)[_0x9ee3('0x23')]();logger[_0x9ee3('0x3b')](_0x9ee3('0x4d'),_0x37fc1a);fs['writeFileSync'](_0x4f79cf,_0x37fc1a+'\x0a');Papa['parse'](fs[_0x9ee3('0x4e')](_0x48776f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x19e4de,_0x5f4929){try{for(var _0x149c1d=0x0,_0x1e19f4=[];_0x149c1d<_0x19e4de[_0x9ee3('0x4f')][_0x9ee3('0x50')];_0x149c1d++){stats[_0x9ee3('0x51')]+=0x1;if(_0x19e4de['errors'][_0x149c1d]){handleError(_0x19e4de[_0x9ee3('0x4f')][_0x149c1d],_0x19e4de[_0x9ee3('0x40')][_0x149c1d]);}else{var _0x1df41f=[];for(var _0x465726 in _0x1f6b9d){if(_0x1f6b9d[_0x9ee3('0x52')](_0x465726)){if(_0x19e4de['data'][_0x149c1d][_0x1f6b9d[_0x465726]]){var _0x17ac2c=_['trim'](_0x19e4de[_0x9ee3('0x4f')][_0x149c1d][_0x1f6b9d[_0x465726]][_0x9ee3('0x53')](/"/g,'\x27'));switch(_0x465726){case _0x9ee3('0x1d'):var _0xa8347e=moment(_0x17ac2c,_0x9ee3('0xe'),!![]);if(_0xa8347e[_0x9ee3('0x54')]()){_0x1e19f4[_0x9ee3('0x44')]('\x22'+_0x17ac2c+'\x22');}else{_0x1df41f[_0x9ee3('0x44')](_0x9ee3('0x55'));}break;case _0x9ee3('0x56'):var _0x2b0faf=parseInt(_0x17ac2c);_0x17ac2c=_[_0x9ee3('0x57')](_0x2b0faf)||_0x2b0faf<0x0||_0x2b0faf>0x4?_0x777dfb?0x3:0x2:_0x2b0faf;_0x1e19f4[_0x9ee3('0x44')]('\x22'+_0x17ac2c+'\x22');break;case _0x9ee3('0x58'):var _0x852ea0=parseInt(_0x17ac2c);if(_[_0x9ee3('0x59')](_0x852ea0)&&_[_0x9ee3('0x5a')](_0x200bc7,_0x852ea0)){_0x1e19f4[_0x9ee3('0x44')]('\x22'+_0x852ea0+'\x22');}else{_0x1df41f['push']('agent\x20not\x20exists');}break;case _0x9ee3('0x5b'):if(isEmail(_0x17ac2c)){_0x1e19f4[_0x9ee3('0x44')]('\x22'+_0x17ac2c+'\x22');}else{_0x1df41f[_0x9ee3('0x44')](_0x9ee3('0x5c'));}break;case'dateOfBirth':var _0x985d60=moment(_0x17ac2c,_0x9ee3('0x5d'),!![]);if(_0x985d60[_0x9ee3('0x54')]()){_0x1e19f4['push']('\x22'+_0x17ac2c+'\x22');}else{_0x1df41f[_0x9ee3('0x44')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1e19f4[_0x9ee3('0x44')]('\x22'+_0x17ac2c+'\x22');}}else{switch(_0x465726){case _0x9ee3('0x5e'):case'phone':_0x1df41f[_0x9ee3('0x44')](_0x465726+'\x20not\x20specified');break;default:_0x1e19f4[_0x9ee3('0x44')]('\x22\x22');}}}}if(_0x1df41f[_0x9ee3('0x50')]){handleError(_0x19e4de[_0x9ee3('0x4f')][_0x149c1d],{'code':_0x9ee3('0x5f'),'message':_0x1df41f[_0x9ee3('0x23')]()});}else{fs[_0x9ee3('0x60')](_0x4f79cf,_0x1e19f4[_0x9ee3('0x23')]()+'\x0a');}_0x1e19f4=[];}if(!(stats['rows']%0xc8)){socket[_0x9ee3('0x61')](_0x9ee3('0x62')+_0x513824,stats);stats[_0x9ee3('0x40')]=[];}}if(stopped){logger[_0x9ee3('0x3b')](_0x9ee3('0x63'));_0x5f4929[_0x9ee3('0x64')]();}}catch(_0x4dd89e){handleError(_0x19e4de['data'][_0x149c1d],{'code':_0x9ee3('0x65'),'message':_0x4dd89e[_0x9ee3('0x3e')]});logger[_0x9ee3('0x3d')](_0x9ee3('0x66'),_0x4dd89e[_0x9ee3('0x3e')]);}},'complete':function(){try{var _0x57890d=[];var _0x11a6e1=_0x9ee3('0x24');if(_0x304ab9[_0x9ee3('0x67')]&&_0x304ab9[_0x9ee3('0x67')][_0x9ee3('0x50')]){_0x11a6e1='cm_contacts_'+_0x513824;_0x57890d[_0x9ee3('0x44')]('CREATE\x20TABLE\x20'+_0x11a6e1+'\x20LIKE\x20cm_contacts;');}var _0x1b7edc=util[_0x9ee3('0xd')](_0x9ee3('0x68'),_0x4f79cf,_0x11a6e1,_0x37fc1a,_0x304ab9['ListId'],_0x304ab9[_0x9ee3('0x35')]||null,NOW,NOW);if(_[_0x9ee3('0x69')](_0x1f6b9d[_0x9ee3('0x1d')])){_0x1b7edc+=_0x9ee3('0x6a');}_0x57890d[_0x9ee3('0x44')](_0x1b7edc);if(_0x304ab9[_0x9ee3('0x67')]&&_0x304ab9[_0x9ee3('0x67')][_0x9ee3('0x50')]){_0x57890d['push'](insertCmContact(_0x304ab9['ListId'],_0x11a6e1,_0x304ab9[_0x9ee3('0x67')],_0x1f6b9d));_0x57890d[_0x9ee3('0x44')](_0x9ee3('0x6b')+_0x11a6e1+';');}_0x57890d[_0x9ee3('0x44')](insertCmHopper(_0x304ab9[_0x9ee3('0x34')],'voice_queues_has_cm_lists',_0x9ee3('0x6c'),_0x9ee3('0x6d'),_0x777dfb));_0x57890d[_0x9ee3('0x44')](insertCmHopperBlack(_0x304ab9[_0x9ee3('0x34')],'voice_queues_has_cm_blacklists',_0x9ee3('0x6c'),'VoiceQueueId'));_0x57890d['push'](insertCmHopper(_0x304ab9[_0x9ee3('0x34')],_0x9ee3('0x6e'),_0x9ee3('0x6f'),'CampaignId',_0x777dfb));_0x57890d[_0x9ee3('0x44')](insertCmHopperBlack(_0x304ab9[_0x9ee3('0x34')],_0x9ee3('0x70'),_0x9ee3('0x6f'),_0x9ee3('0x71')));BPromise[_0x9ee3('0x72')](_0x57890d,handleQuery)[_0x9ee3('0x73')](function(_0x1cea36){stats[_0x9ee3('0x74')]=!![];stats[_0x9ee3('0x75')]=_0x304ab9[_0x9ee3('0x67')]&&_0x304ab9[_0x9ee3('0x67')][_0x9ee3('0x50')]?results[0x2][_0x9ee3('0x75')]:results[0x0][_0x9ee3('0x75')];socket['emit'](_0x9ee3('0x62')+_0x513824,stats);fs[_0x9ee3('0x76')](_0x48776f);fs[_0x9ee3('0x76')](_0x4f79cf);process['exit'](0x0);})['catch'](function(_0x127fa5){logger[_0x9ee3('0x3d')](_0x127fa5[_0x9ee3('0x3e')]);process[_0x9ee3('0x3f')](0x1);});}catch(_0x41ad9d){logger['error'](_0x9ee3('0x77'),_0x41ad9d[_0x9ee3('0x3e')]);process['exit'](0x1);}},'error':function(_0x8e3897,_0xe39b89,_0xc0a535,_0x1fec01){throw new Error(_0x1fec01);}});}function validate(){if(process['argv']&&process[_0x9ee3('0x78')][_0x9ee3('0x50')]<0x4){throw new Error(_0x9ee3('0x79'));}var _0x4c1d0c=path[_0x9ee3('0x23')](config[_0x9ee3('0x4b')],_0x9ee3('0x7a'),process['argv'][0x2]);if(!fs[_0x9ee3('0x7b')](_0x4c1d0c)){throw new Error(_0x9ee3('0x7c'));}var _0x4679d9={};try{_0x4679d9=JSON[_0x9ee3('0x7d')](process[_0x9ee3('0x78')][0x3]);if(!_0x4679d9['binding']){throw new Error(_0x9ee3('0x7e'));}if(!_0x4679d9[_0x9ee3('0x49')][_0x9ee3('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4679d9[_0x9ee3('0x49')][_0x9ee3('0x5e')]){throw new Error(_0x9ee3('0x7f'));}var _0x55dd31=0x0;if(_0x4679d9[_0x9ee3('0x49')][_0x9ee3('0x58')]){_0x55dd31=0x1;}if(!_0x4679d9['ListId']){throw new Error(_0x9ee3('0x80'));}}catch(_0x222954){throw new Error(_0x9ee3('0x81'));}var _0x49d491=[];try{_0x49d491=_[_0x9ee3('0x82')](JSON[_0x9ee3('0x7d')](process[_0x9ee3('0x78')][0x4]),'id');}catch(_0x4086e6){logger[_0x9ee3('0x3b')]('No\x20agent\x20available');}main(_0x4c1d0c,_0x4679d9,_0x49d491,_0x55dd31);}validate();process['on'](_0x9ee3('0x83'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xe603=['trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','existsSync','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','select','field','phone','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','into','cm_hopper_black','ListId','ListId\x20=\x20?','\x20=\x20?','toString','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','push','message','sequelize','query','main','start','socket_timestamp','root','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty'];(function(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0xe603,0x13f));var _0x3e60=function(_0xbab17,_0x3cdbc5){_0xbab17=_0xbab17-0x0;var _0x1f2916=_0xe603[_0xbab17];return _0x1f2916;};'use strict';var fs=require('fs');var path=require(_0x3e60('0x0'));var _=require(_0x3e60('0x1'));var Papa=require(_0x3e60('0x2'));var util=require(_0x3e60('0x3'));var BPromise=require(_0x3e60('0x4'));var moment=require(_0x3e60('0x5'));var squel=require(_0x3e60('0x6'));var Redis=require(_0x3e60('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x3e60('0x8'));var logger=require(_0x3e60('0x9'))(_0x3e60('0xa'));config['redis']=_[_0x3e60('0xb')](config[_0x3e60('0xc')],{'host':_0x3e60('0xd'),'port':0x18eb});var socket=require(_0x3e60('0xe'))(new Redis(config[_0x3e60('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4b3136){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'](_0x4b3136);}function selectNotIn(_0x1ed3d9,_0x37cb7d,_0x4a1e9c,_0x27477d,_0x45bfa1){return squel[_0x3e60('0xf')]()[_0x3e60('0x10')](_0x3e60('0x11'))['from'](_0x27477d)['join'](_0x37cb7d,null,_0x37cb7d+_0x3e60('0x12')+_0x27477d+'.'+_0x4a1e9c)['where'](_0x27477d+'.'+_0x4a1e9c+_0x3e60('0x13')+_0x1ed3d9+'.'+_0x4a1e9c)[_0x3e60('0x14')](_0x37cb7d+_0x3e60('0x15')+_0x45bfa1[_0x3e60('0x16')]()+')');}function insertCmHopper(_0x5d7f74,_0x2665ad,_0x3d0fe6,_0x3f9b8a,_0x2fed38){var _0x5b4e43=[_0x3e60('0x17'),_0x3e60('0x18'),_0x3e60('0x19'),'cm_contacts.ListId',_0x2665ad+'.'+_0x3f9b8a,_0x3e60('0x1a'),_0x3e60('0x1b'),_0x3e60('0x1c'),_0x3e60('0x1d'),'\x22'+_0x2fed38+'\x22'];return squel[_0x3e60('0x1e')]()['into']('cm_hopper')[_0x3e60('0x1f')]([_0x3e60('0x11'),_0x3e60('0x20'),_0x3e60('0x21'),'ListId',_0x3f9b8a,_0x3e60('0x22'),_0x3e60('0x23'),_0x3e60('0x24'),'UserId',_0x3e60('0x25')],squel['select']()[_0x3e60('0x26')](_0x5b4e43)[_0x3e60('0x27')](_0x2665ad)[_0x3e60('0x16')](_0x3e60('0x28'),null,_0x3e60('0x29')+_0x2665ad+_0x3e60('0x2a'))[_0x3e60('0x16')](_0x3d0fe6,null,_0x3d0fe6+_0x3e60('0x12')+_0x2665ad+'.'+_0x3f9b8a)['where'](_0x2665ad+_0x3e60('0x2b'),_0x5d7f74)[_0x3e60('0x14')](_0x3e60('0x2c'),NOW)['where'](_0x3e60('0x2d'),selectNotIn(_0x2665ad,_0x3d0fe6,_0x3f9b8a,_0x3e60('0x2e'),[_0x3e60('0x2f'),_0x3e60('0x30')]))[_0x3e60('0x14')](_0x3e60('0x2d'),selectNotIn(_0x2665ad,_0x3d0fe6,_0x3f9b8a,_0x3e60('0x2e'),[_0x3e60('0x2f')])))['toString']();}function insertCmHopperBlack(_0x2f0443,_0x54b9f0,_0x25ee40,_0x43012b){var _0x4613c3=[_0x3e60('0x17'),'cm_contacts.id',_0x3e60('0x31'),_0x54b9f0+'.'+_0x43012b,'cm_contacts.createdAt',_0x3e60('0x1b')];return squel[_0x3e60('0x1e')]()[_0x3e60('0x32')](_0x3e60('0x33'))['fromQuery'](['phone',_0x3e60('0x21'),_0x3e60('0x34'),_0x43012b,_0x3e60('0x22'),_0x3e60('0x23')],squel['select']()['fields'](_0x4613c3)[_0x3e60('0x27')](_0x54b9f0)[_0x3e60('0x16')](_0x3e60('0x28'),null,_0x3e60('0x29')+_0x54b9f0+_0x3e60('0x2a'))[_0x3e60('0x16')](_0x25ee40,null,_0x25ee40+_0x3e60('0x12')+_0x54b9f0+'.'+_0x43012b)[_0x3e60('0x14')](_0x54b9f0+_0x3e60('0x2b'),_0x2f0443)[_0x3e60('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x3e60('0x2d'),squel[_0x3e60('0xf')]()[_0x3e60('0x10')]('phone')[_0x3e60('0x27')](_0x3e60('0x33'))[_0x3e60('0x14')](_0x3e60('0x35'),_0x2f0443)[_0x3e60('0x14')](_0x43012b+_0x3e60('0x36'),_0x54b9f0+'.'+_0x43012b)))[_0x3e60('0x37')]();}function insertCmContact(_0x3716a5,_0x5851a4,_0x5958c9,_0x4d9909){var _0x2937cf=_[_0x3e60('0x38')](_['keys'](_0x4d9909),[_0x3e60('0x34'),_0x3e60('0x39'),'createdAt','updatedAt']);return squel[_0x3e60('0x1e')]()[_0x3e60('0x32')](_0x3e60('0x28'))[_0x3e60('0x1f')](_0x2937cf,squel[_0x3e60('0xf')]()[_0x3e60('0x26')](_0x2937cf)['from'](_0x5851a4)[_0x3e60('0x14')]('('+_0x5958c9[_0x3e60('0x16')](',')+')\x20NOT\x20IN\x20?',squel[_0x3e60('0xf')]()[_0x3e60('0x26')](_0x5958c9)[_0x3e60('0x27')](_0x3e60('0x28'))[_0x3e60('0x14')](_0x3e60('0x35'),_0x3716a5)[_0x3e60('0x14')](_0x3e60('0x3a')))[_0x3e60('0x14')](_0x3e60('0x3b'),squel[_0x3e60('0xf')]()[_0x3e60('0x10')](_0x3e60('0x3c'),_0x3e60('0x3d'))[_0x3e60('0x27')](_0x5851a4)['group'](_0x5958c9['join'](','))))[_0x3e60('0x37')]();}function handleStop(){logger[_0x3e60('0x3e')](_0x3e60('0x3f'));stopped=!![];}function handleUncaughtException(_0x1f3096){logger[_0x3e60('0x40')](_0x1f3096['message']);process[_0x3e60('0x41')](0x1);}function handleError(_0x4e4f67,_0x1033f1){stats[_0x3e60('0x42')][_0x3e60('0x43')]({'name':_0x1033f1['code'],'message':_0x1033f1[_0x3e60('0x44')],'row':_0x4e4f67});}function handleQuery(_0x25b780){logger[_0x3e60('0x3e')](_0x25b780);return db[_0x3e60('0x45')][_0x3e60('0x46')](_0x25b780)['spread'](function(_0x57c1c4){results[_0x3e60('0x43')](_0x57c1c4);})['catch'](function(_0x4116a0){logger['error'](_0x4116a0[_0x3e60('0x44')]);});}function main(_0xa60e1a,_0x223023,_0x81b595,_0xaa86d3){logger[_0x3e60('0x3e')](_0x3e60('0x47'),_0xa60e1a,JSON['stringify'](_0x223023));process['send'](_0x3e60('0x48'));var _0x2b48e2=_0x223023['binding'];var _0x1f31a5=_0x223023[_0x3e60('0x49')];var _0x46ad8b=path[_0x3e60('0x16')](config[_0x3e60('0x4a')],_0x3e60('0x4b'),_0x1f31a5+_0x3e60('0x4c'));var _0x367c07=_[_0x3e60('0x4d')](_0x2b48e2)[_0x3e60('0x16')]();logger[_0x3e60('0x3e')](_0x3e60('0x4e'),_0x367c07);fs[_0x3e60('0x4f')](_0x46ad8b,_0x367c07+'\x0a');Papa[_0x3e60('0x50')](fs[_0x3e60('0x51')](_0xa60e1a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d6e14,_0x325424){try{for(var _0xad8cec=0x0,_0x13fe6b=[];_0xad8cec<_0x5d6e14[_0x3e60('0x52')][_0x3e60('0x53')];_0xad8cec++){stats[_0x3e60('0x54')]+=0x1;if(_0x5d6e14[_0x3e60('0x42')][_0xad8cec]){handleError(_0x5d6e14['data'][_0xad8cec],_0x5d6e14[_0x3e60('0x42')][_0xad8cec]);}else{var _0x546b39=[];for(var _0x22ffa0 in _0x2b48e2){if(_0x2b48e2[_0x3e60('0x55')](_0x22ffa0)){if(_0x5d6e14['data'][_0xad8cec][_0x2b48e2[_0x22ffa0]]){var _0x14dfbd=_[_0x3e60('0x56')](_0x5d6e14[_0x3e60('0x52')][_0xad8cec][_0x2b48e2[_0x22ffa0]][_0x3e60('0x57')](/"/g,'\x27'));switch(_0x22ffa0){case _0x3e60('0x20'):var _0x239831=moment(_0x14dfbd,_0x3e60('0x58'),!![]);if(_0x239831[_0x3e60('0x59')]()){_0x13fe6b['push']('\x22'+_0x14dfbd+'\x22');}else{_0x546b39['push'](_0x3e60('0x5a'));}break;case _0x3e60('0x24'):var _0x3491a3=parseInt(_0x14dfbd);_0x14dfbd=_[_0x3e60('0x5b')](_0x3491a3)||_0x3491a3<0x0||_0x3491a3>0x4?_0xaa86d3?0x3:0x2:_0x3491a3;_0x13fe6b['push']('\x22'+_0x14dfbd+'\x22');break;case _0x3e60('0x5c'):var _0xe95f17=parseInt(_0x14dfbd);if(_['isNumber'](_0xe95f17)&&_[_0x3e60('0x5d')](_0x81b595,_0xe95f17)){_0x13fe6b[_0x3e60('0x43')]('\x22'+_0xe95f17+'\x22');}else{_0x546b39['push'](_0x3e60('0x5e'));}break;case'email':if(isEmail(_0x14dfbd)){_0x13fe6b[_0x3e60('0x43')]('\x22'+_0x14dfbd+'\x22');}else{_0x546b39[_0x3e60('0x43')]('email\x20wrong\x20format');}break;case _0x3e60('0x5f'):var _0x107008=moment(_0x14dfbd,_0x3e60('0x60'),!![]);if(_0x107008[_0x3e60('0x59')]()){_0x13fe6b[_0x3e60('0x43')]('\x22'+_0x14dfbd+'\x22');}else{_0x546b39['push'](_0x3e60('0x61'));}break;default:_0x13fe6b[_0x3e60('0x43')]('\x22'+_0x14dfbd+'\x22');}}else{switch(_0x22ffa0){case _0x3e60('0x62'):case _0x3e60('0x11'):_0x546b39[_0x3e60('0x43')](_0x22ffa0+_0x3e60('0x63'));break;default:_0x13fe6b['push']('\x22\x22');}}}}if(_0x546b39[_0x3e60('0x53')]){handleError(_0x5d6e14['data'][_0xad8cec],{'code':'SystemRow','message':_0x546b39[_0x3e60('0x16')]()});}else{fs[_0x3e60('0x64')](_0x46ad8b,_0x13fe6b[_0x3e60('0x16')]()+'\x0a');}_0x13fe6b=[];}if(!(stats['rows']%0xc8)){socket[_0x3e60('0x65')](_0x3e60('0x66')+_0x1f31a5,stats);stats[_0x3e60('0x42')]=[];}}if(stopped){logger[_0x3e60('0x3e')](_0x3e60('0x67'));_0x325424[_0x3e60('0x68')]();}}catch(_0x5aac03){handleError(_0x5d6e14[_0x3e60('0x52')][_0xad8cec],{'code':_0x3e60('0x69'),'message':_0x5aac03[_0x3e60('0x44')]});logger['error'](_0x3e60('0x6a'),_0x5aac03[_0x3e60('0x44')]);}},'complete':function(){try{var _0x17428e=[];var _0x206a76='cm_contacts';if(_0x223023[_0x3e60('0x6b')]&&_0x223023[_0x3e60('0x6b')][_0x3e60('0x53')]){_0x206a76=_0x3e60('0x6c')+_0x1f31a5;_0x17428e[_0x3e60('0x43')]('CREATE\x20TABLE\x20'+_0x206a76+_0x3e60('0x6d'));}var _0x5b9099=util[_0x3e60('0x6e')](_0x3e60('0x6f'),_0x46ad8b,_0x206a76,_0x367c07,_0x223023[_0x3e60('0x34')],_0x223023['CompanyId']||null,NOW,NOW);if(_[_0x3e60('0x70')](_0x2b48e2['scheduledat'])){_0x5b9099+=_0x3e60('0x71');}_0x17428e[_0x3e60('0x43')](_0x5b9099);if(_0x223023[_0x3e60('0x6b')]&&_0x223023['duplicates'][_0x3e60('0x53')]){_0x17428e[_0x3e60('0x43')](insertCmContact(_0x223023[_0x3e60('0x34')],_0x206a76,_0x223023['duplicates'],_0x2b48e2));_0x17428e[_0x3e60('0x43')](_0x3e60('0x72')+_0x206a76+';');}_0x17428e['push'](insertCmHopper(_0x223023[_0x3e60('0x34')],'voice_queues_has_cm_lists','voice_queues',_0x3e60('0x73'),_0xaa86d3));_0x17428e[_0x3e60('0x43')](insertCmHopperBlack(_0x223023['ListId'],_0x3e60('0x74'),'voice_queues','VoiceQueueId'));_0x17428e[_0x3e60('0x43')](insertCmHopper(_0x223023[_0x3e60('0x34')],_0x3e60('0x75'),_0x3e60('0x76'),_0x3e60('0x77'),_0xaa86d3));_0x17428e[_0x3e60('0x43')](insertCmHopperBlack(_0x223023['ListId'],_0x3e60('0x78'),_0x3e60('0x76'),_0x3e60('0x77')));BPromise[_0x3e60('0x79')](_0x17428e,handleQuery)[_0x3e60('0x7a')](function(_0x22d3d7){stats[_0x3e60('0x7b')]=!![];stats['affectedRows']=_0x223023['duplicates']&&_0x223023[_0x3e60('0x6b')][_0x3e60('0x53')]?results[0x2][_0x3e60('0x7c')]:results[0x0][_0x3e60('0x7c')];socket[_0x3e60('0x65')](_0x3e60('0x66')+_0x1f31a5,stats);fs[_0x3e60('0x7d')](_0xa60e1a);fs['unlink'](_0x46ad8b);process[_0x3e60('0x41')](0x0);})[_0x3e60('0x7e')](function(_0x571e7c){logger[_0x3e60('0x40')](_0x571e7c[_0x3e60('0x44')]);process['exit'](0x1);});}catch(_0x5c76f6){logger[_0x3e60('0x40')]('complete',_0x5c76f6[_0x3e60('0x44')]);process[_0x3e60('0x41')](0x1);}},'error':function(_0x1fd836,_0x22882d,_0x28f3fe,_0x4d4e19){throw new Error(_0x4d4e19);}});}function validate(){if(process[_0x3e60('0x7f')]&&process[_0x3e60('0x7f')][_0x3e60('0x53')]<0x4){throw new Error(_0x3e60('0x80'));}var _0x5a056f=path[_0x3e60('0x16')](config[_0x3e60('0x4a')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x3e60('0x81')](_0x5a056f)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2edc81={};try{_0x2edc81=JSON['parse'](process['argv'][0x3]);if(!_0x2edc81[_0x3e60('0x82')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2edc81[_0x3e60('0x82')][_0x3e60('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2edc81[_0x3e60('0x82')][_0x3e60('0x62')]){throw new Error(_0x3e60('0x83'));}var _0x2e4ec6=0x0;if(_0x2edc81[_0x3e60('0x82')][_0x3e60('0x5c')]){_0x2e4ec6=0x1;}if(!_0x2edc81['ListId']){throw new Error(_0x3e60('0x84'));}}catch(_0xc7be57){throw new Error(_0x3e60('0x85'));}var _0xcc5292=[];try{_0xcc5292=_['map'](JSON['parse'](process[_0x3e60('0x7f')][0x4]),'id');}catch(_0x348b28){logger[_0x3e60('0x3e')]('No\x20agent\x20available');}main(_0x5a056f,_0x2edc81,_0xcc5292,_0x2e4ec6);}validate();process['on']('SIGINT',handleStop);process['on'](_0x3e60('0x86'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 247bc73..3fc41ae 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 _0x777d=['answertime','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','push','queue','variable','string','Outbound\x20Call','destcalleridnum','getDescriptions','voice','inbound','keyValue','calleridnum','Caller\x20Name','destexten','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','Member\x20Name','membername','UniqueId','uniqueid','Answer\x20Time'];(function(_0x13aa64,_0x37f1c6){var _0x3ce7c8=function(_0x514813){while(--_0x514813){_0x13aa64['push'](_0x13aa64['shift']());}};_0x3ce7c8(++_0x37f1c6);}(_0x777d,0xe9));var _0xd777=function(_0x3401ce,_0x5d1579){_0x3401ce=_0x3401ce-0x0;var _0x1bb79d=_0x777d[_0x3401ce];return _0x1bb79d;};'use strict';exports['getSubjects']=function(_0x1dba51,_0xe6b7d9){var _0x2b6eab=[{'type':'string','content':_0xd777('0x0'),'variableName':null}];switch(_0x1dba51[_0xd777('0x1')]()){case'voice':switch(_0xe6b7d9['toLowerCase']()){case'inbound':_0x2b6eab[_0xd777('0x2')]({'type':'variable','content':'','variableName':_0xd777('0x3')});_0x2b6eab['push']({'type':_0xd777('0x4'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x2b6eab['push']({'type':_0xd777('0x5'),'content':_0xd777('0x6'),'variableName':null});_0x2b6eab[_0xd777('0x2')]({'type':_0xd777('0x4'),'content':'','variableName':_0xd777('0x7')});break;}}return _0x2b6eab;};exports[_0xd777('0x8')]=function(_0x28fedc,_0x234862){var _0x45afb5=[];switch(_0x28fedc[_0xd777('0x1')]()){case _0xd777('0x9'):switch(_0x234862[_0xd777('0x1')]()){case _0xd777('0xa'):_0x45afb5=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xd777('0xb'),'content':'','key':'Caller\x20Number','keyType':_0xd777('0x4'),'variableName':_0xd777('0xc')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0xd'),'keyType':_0xd777('0x4'),'variableName':'calleridname'},{'type':_0xd777('0xb'),'content':'','key':'Call\x20To','keyType':_0xd777('0x4'),'variableName':_0xd777('0xe')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0xf'),'keyType':_0xd777('0x4'),'variableName':'queue'},{'type':_0xd777('0xb'),'content':'','key':'UniqueId','keyType':_0xd777('0x4'),'variableName':'uniqueid'},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x10'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x11')},{'type':_0xd777('0x5'),'content':_0xd777('0x12'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xd777('0x4'),'variableName':'destcalleridname'},{'type':_0xd777('0xb'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':'destcalleridnum'},{'type':_0xd777('0x5'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':'variable','variableName':'agentcalledAt'},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x13'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x14')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x15'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x16')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x17'),'keyType':_0xd777('0x4'),'variableName':'holdtime'},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x18'),'keyType':_0xd777('0x4'),'variableName':_0xd777('0x19')}];break;case _0xd777('0x1a'):_0x45afb5=[{'type':'string','content':_0xd777('0x1b'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x7')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x1c'),'keyType':'variable','keyContent':'','variableName':_0xd777('0x1d')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x1e'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x1f')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x10'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0xd777('0x5'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0xd777('0x20'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x21')},{'type':_0xd777('0xb'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xd777('0x22')},{'type':_0xd777('0xb'),'content':'','key':_0xd777('0x23'),'keyType':_0xd777('0x4'),'keyContent':'','variableName':_0xd777('0x24')},{'type':_0xd777('0xb'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0xd777('0x25')}];break;}}return _0x45afb5;}; \ No newline at end of file +var _0x68a5=['Called\x20Number','Member\x20Name','membername','uniqueid','Date','starttime','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','push','queue','variable','calleridnum','Outbound\x20Call','destcalleridnum','inbound','string','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound'];(function(_0x53d9a7,_0x44c4a3){var _0x1c8958=function(_0x597d99){while(--_0x597d99){_0x53d9a7['push'](_0x53d9a7['shift']());}};_0x1c8958(++_0x44c4a3);}(_0x68a5,0xfc));var _0x568a=function(_0x13f1b8,_0x59f46e){_0x13f1b8=_0x13f1b8-0x0;var _0x1c5635=_0x68a5[_0x13f1b8];return _0x1c5635;};'use strict';exports[_0x568a('0x0')]=function(_0x507cb7,_0x21e4e6){var _0x319cf7=[{'type':'string','content':_0x568a('0x1'),'variableName':null}];switch(_0x507cb7[_0x568a('0x2')]()){case _0x568a('0x3'):switch(_0x21e4e6[_0x568a('0x2')]()){case'inbound':_0x319cf7[_0x568a('0x4')]({'type':'variable','content':'','variableName':_0x568a('0x5')});_0x319cf7[_0x568a('0x4')]({'type':_0x568a('0x6'),'content':'','variableName':_0x568a('0x7')});break;case'outbound':_0x319cf7[_0x568a('0x4')]({'type':'string','content':_0x568a('0x8'),'variableName':null});_0x319cf7[_0x568a('0x4')]({'type':_0x568a('0x6'),'content':'','variableName':_0x568a('0x9')});break;}}return _0x319cf7;};exports['getDescriptions']=function(_0x4e39d0,_0x3cbe63){var _0x3011b9=[];switch(_0x4e39d0['toLowerCase']()){case _0x568a('0x3'):switch(_0x3cbe63['toLowerCase']()){case _0x568a('0xa'):_0x3011b9=[{'type':_0x568a('0xb'),'content':_0x568a('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0xe'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x7')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0xf'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x10')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x11'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x12')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x13'),'keyType':'variable','variableName':_0x568a('0x5')},{'type':'keyValue','content':'','key':_0x568a('0x14'),'keyType':_0x568a('0x6'),'variableName':'uniqueid'},{'type':_0x568a('0xd'),'content':'','key':'Date','keyType':_0x568a('0x6'),'variableName':_0x568a('0x15')},{'type':_0x568a('0xb'),'content':_0x568a('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x568a('0x17'),'keyType':'variable','variableName':_0x568a('0x18')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x19'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x9')},{'type':_0x568a('0xb'),'content':_0x568a('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x568a('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x568a('0x6'),'variableName':_0x568a('0x15')},{'type':'keyValue','content':'','key':_0x568a('0x1b'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x1c')},{'type':'keyValue','content':'','key':_0x568a('0x1d'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x1e')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x1f'),'keyType':_0x568a('0x6'),'variableName':_0x568a('0x20')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x21'),'keyType':'variable','variableName':_0x568a('0x22')}];break;case _0x568a('0x23'):_0x3011b9=[{'type':_0x568a('0xb'),'content':_0x568a('0xc'),'variableName':null},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x24'),'keyType':'variable','keyContent':'','variableName':_0x568a('0x9')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x25'),'keyType':_0x568a('0x6'),'keyContent':'','variableName':_0x568a('0x26')},{'type':'keyValue','content':'','key':_0x568a('0x14'),'keyType':_0x568a('0x6'),'keyContent':'','variableName':_0x568a('0x27')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x28'),'keyType':_0x568a('0x6'),'keyContent':'','variableName':_0x568a('0x29')},{'type':_0x568a('0xb'),'content':_0x568a('0x1a')},{'type':_0x568a('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x568a('0x6'),'keyContent':'','variableName':_0x568a('0x2a')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x2b'),'keyType':_0x568a('0x6'),'keyContent':'','variableName':_0x568a('0x2c')},{'type':'keyValue','content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x568a('0x2d')},{'type':_0x568a('0xd'),'content':'','key':_0x568a('0x2e'),'keyType':_0x568a('0x6'),'keyContent':'','variableName':_0x568a('0x2f')}];break;}}return _0x3011b9;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 12cf7cf..0d7f0b0 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 _0xb258=['catch','error','tracked','user','body','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','null','Interaction','findOne','then','update','info'];(function(_0x3b15f3,_0xca10f7){var _0x1b7da2=function(_0x2d4d3c){while(--_0x2d4d3c){_0x3b15f3['push'](_0x3b15f3['shift']());}};_0x1b7da2(++_0xca10f7);}(_0xb258,0x12b));var _0x8b25=function(_0x163af8,_0x880cd0){_0x163af8=_0x163af8-0x0;var _0x59315d=_0xb258[_0x163af8];return _0x59315d;};'use strict';var _=require(_0x8b25('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x8b25('0x1'))(_0x8b25('0x2')),'mail':require('../../config/logger')(_0x8b25('0x3')),'fax':require(_0x8b25('0x1'))(_0x8b25('0x4')),'sms':require(_0x8b25('0x1'))(_0x8b25('0x5')),'chat':require(_0x8b25('0x1'))('chat-interactions'),'whatsapp':require(_0x8b25('0x1'))(_0x8b25('0x6'))};function getInteractionId(_0x3e2b50,_0xcf895b,_0x4fd8bb){if(_0x3e2b50&&_0x3e2b50[_[_0x8b25('0x7')](_0x4fd8bb)+_0x8b25('0x8')]){return _0x3e2b50[_['upperFirst'](_0x4fd8bb)+_0x8b25('0x8')];}else if(_0x3e2b50&&_0x3e2b50['id']){return _0x3e2b50['id'];}else if(_0xcf895b&&_0xcf895b['id']){return _0xcf895b['id'];}else{return _0x8b25('0x9');}}function log(_0x14687a,_0x127008,_0x4fca1a,_0x31eb92,_0x180be8,_0x2b49c9){loggers[_0x180be8[_0x8b25('0xa')]()][_0x14687a]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b49c9[_0x8b25('0xb')](),_0x127008?_0x127008['id']:null,_0x127008?_0x127008[_0x8b25('0xc')]:null,_0x127008?_0x127008[_0x8b25('0xd')]:null,getInteractionId(_0x4fca1a,_0x31eb92,_0x180be8),_0x4fca1a?JSON['stringify'](_0x4fca1a):_0x8b25('0xe'));}function updateUser(_0x102256,_0x2375a8,_0x1164c3,_0x52c10b,_0xf042af){db[_['upperFirst'](_0x52c10b)+_0x8b25('0xf')][_0x8b25('0x10')]({'where':{'id':getInteractionId(_0x2375a8,_0x1164c3,_0x52c10b)}})[_0x8b25('0x11')](function(_0x8efa6d){if(_0x8efa6d){return _0x8efa6d[_0x8b25('0x12')]({'UserId':_0x102256?_0x102256['id']:null});}})[_0x8b25('0x11')](function(_0x377870){if(_0x377870){log(_0x8b25('0x13'),_0x102256,_0x2375a8,_0x1164c3,_0x52c10b,_0xf042af);}})[_0x8b25('0x14')](function(){log(_0x8b25('0x15'),_0x102256,_0x2375a8,_0x1164c3,_0x52c10b,_0xf042af);});}exports[_0x8b25('0x16')]=function(_0x1aa09b,_0x73e18e){return function(_0x12a84c,_0x56dcf0,_0x3b09c1){var _0x1bd956=_0x12a84c[_0x8b25('0x17')];var _0x3f280e={};var _0x47dc21=_0x12a84c['query'];if(_0x3f280e){_0x3f280e=_['clone'](_0x12a84c[_0x8b25('0x18')]);_0x3f280e=_['omit'](_0x3f280e,[_0x8b25('0x18'),_0x8b25('0x19'),_0x8b25('0x1a'),_0x8b25('0x1b'),_0x8b25('0x1c')]);}updateUser(_0x1bd956,_0x3f280e,_0x47dc21,_0x1aa09b,_0x73e18e);_0x3b09c1(null);};}; \ No newline at end of file +var _0x8ebf=['role','stringify','then','info','error','tracked','user','query','clone','body','omit','phone','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x8ebf[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0xf8eb('0x0'));var db=require(_0xf8eb('0x1'))['db'];var loggers={'openchannel':require(_0xf8eb('0x2'))('openchannel-interactions'),'mail':require(_0xf8eb('0x2'))(_0xf8eb('0x3')),'fax':require('../../config/logger')(_0xf8eb('0x4')),'sms':require(_0xf8eb('0x2'))(_0xf8eb('0x5')),'chat':require('../../config/logger')(_0xf8eb('0x6')),'whatsapp':require(_0xf8eb('0x2'))('whatsapp-interactions')};function getInteractionId(_0x30c91c,_0x2c2489,_0x2a1fb6){if(_0x30c91c&&_0x30c91c[_['upperFirst'](_0x2a1fb6)+_0xf8eb('0x7')]){return _0x30c91c[_['upperFirst'](_0x2a1fb6)+_0xf8eb('0x7')];}else if(_0x30c91c&&_0x30c91c['id']){return _0x30c91c['id'];}else if(_0x2c2489&&_0x2c2489['id']){return _0x2c2489['id'];}else{return'unknown';}}function log(_0x30711a,_0x17d538,_0x166aa1,_0x4ca01b,_0x3c602f,_0x2d55dd){loggers[_0x3c602f[_0xf8eb('0x8')]()][_0x30711a](_0xf8eb('0x9'),_0x2d55dd[_0xf8eb('0xa')](),_0x17d538?_0x17d538['id']:null,_0x17d538?_0x17d538[_0xf8eb('0xb')]:null,_0x17d538?_0x17d538[_0xf8eb('0xc')]:null,getInteractionId(_0x166aa1,_0x4ca01b,_0x3c602f),_0x166aa1?JSON[_0xf8eb('0xd')](_0x166aa1):'null');}function updateUser(_0x325dcd,_0x15ee2f,_0x26f79f,_0xf092b6,_0x4bed5d){db[_['upperFirst'](_0xf092b6)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x15ee2f,_0x26f79f,_0xf092b6)}})[_0xf8eb('0xe')](function(_0x22af2e){if(_0x22af2e){return _0x22af2e['update']({'UserId':_0x325dcd?_0x325dcd['id']:null});}})[_0xf8eb('0xe')](function(_0x10415f){if(_0x10415f){log(_0xf8eb('0xf'),_0x325dcd,_0x15ee2f,_0x26f79f,_0xf092b6,_0x4bed5d);}})['catch'](function(){log(_0xf8eb('0x10'),_0x325dcd,_0x15ee2f,_0x26f79f,_0xf092b6,_0x4bed5d);});}exports[_0xf8eb('0x11')]=function(_0x2f052d,_0x14c331){return function(_0x3038b7,_0x1df079,_0x4b6e70){var _0x5458b4=_0x3038b7[_0xf8eb('0x12')];var _0x1d4e17={};var _0xce86f9=_0x3038b7[_0xf8eb('0x13')];if(_0x1d4e17){_0x1d4e17=_[_0xf8eb('0x14')](_0x3038b7[_0xf8eb('0x15')]);_0x1d4e17=_[_0xf8eb('0x16')](_0x1d4e17,[_0xf8eb('0x15'),'html',_0xf8eb('0x17'),'fax','mobile']);}updateUser(_0x5458b4,_0x1d4e17,_0xce86f9,_0x2f052d,_0x14c331);_0x4b6e70(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 4048421..4bde084 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 _0x5c68=['split','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','user','crypto','util','composable-middleware','../../mysqldb','data1','license'];(function(_0x5af484,_0x3c700b){var _0x7a54b5=function(_0x54d32b){while(--_0x54d32b){_0x5af484['push'](_0x5af484['shift']());}};_0x7a54b5(++_0x3c700b);}(_0x5c68,0x1ee));var _0x85c6=function(_0x3eb563,_0x50eb73){_0x3eb563=_0x3eb563-0x0;var _0x5cc0b2=_0x5c68[_0x3eb563];return _0x5cc0b2;};'use strict';var crypto=require(_0x85c6('0x0'));var util=require(_0x85c6('0x1'));var compose=require(_0x85c6('0x2'));var db=require(_0x85c6('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x28a70b,_0xb0fa1f){if(_0x28a70b&&_0xb0fa1f){if(_0xb0fa1f[_0x85c6('0x4')]&&_0xb0fa1f[_0x85c6('0x5')]){var _0x370eea=_0xb0fa1f[_0x85c6('0x4')];var _0x36565c=_0xb0fa1f[_0x85c6('0x5')];var _0xf63630=_0x370eea['split']('-')[0x4];var _0x1fbdf6=_0x370eea[_0x85c6('0x6')]('-')[0x0];var _0x38e90c=crypto['createDecipher'](_0x85c6('0x7'),util[_0x85c6('0x8')](_0x85c6('0x9'),_0xf63630,_0x370eea,_0x1fbdf6));var _0x4978ad=_0x38e90c[_0x85c6('0xa')](_0x36565c,'base64',_0x85c6('0xb'));_0x4978ad+=_0x38e90c[_0x85c6('0xc')](_0x85c6('0xb'));var _0x505807=JSON[_0x85c6('0xd')](_0x4978ad);return _0x505807[_0x85c6('0xe')](_0x28a70b)?_0x505807[_0x28a70b]:null;}}return null;}function isLimit(_0x2a9960,_0x38c25d,_0x4cbb24,_0x585011){var _0x2e73a2=_0x38c25d;return compose()[_0x85c6('0xf')](function(_0xd6ab7,_0x5e93cc,_0x11c348){return db[_0x85c6('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x85c6('0x11')](function(_0x524721){var _0x51ebb8=getValueFromLicense(_0x2a9960,_0x524721);return _0x51ebb8?_0x51ebb8:_0x2e73a2;})[_0x85c6('0x11')](function(_0x5e8ee3){_0x2e73a2=_0x5e8ee3;return _0x4cbb24[_0x85c6('0x12')](_0x585011);})[_0x85c6('0x11')](function(_0x365eda){if(_0x365eda>=_0x2e73a2){return _0x5e93cc[_0x85c6('0x13')](0x193)[_0x85c6('0x14')]({'message':util[_0x85c6('0x8')](_0x85c6('0x15'),_0x2a9960)});}_0x11c348();})['catch'](function(_0x58757a){_0x11c348(_0x58757a);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x85c6('0x16')],{'where':{'$or':[{'role':_0x85c6('0x17')},{'role':_0x85c6('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xb5f7=['data1','license','split','createDecipher','final','utf8','parse','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb5f7,0xb4));var _0x7b5f=function(_0x129759,_0x401197){_0x129759=_0x129759-0x0;var _0x3d9b37=_0xb5f7[_0x129759];return _0x3d9b37;};'use strict';var crypto=require('crypto');var util=require(_0x7b5f('0x0'));var compose=require(_0x7b5f('0x1'));var db=require(_0x7b5f('0x2'))['db'];var config=require(_0x7b5f('0x3'));function getValueFromLicense(_0x3e7dd1,_0x1d26ba){if(_0x3e7dd1&&_0x1d26ba){if(_0x1d26ba[_0x7b5f('0x4')]&&_0x1d26ba[_0x7b5f('0x5')]){var _0x4b2339=_0x1d26ba[_0x7b5f('0x4')];var _0x120167=_0x1d26ba['license'];var _0x302958=_0x4b2339[_0x7b5f('0x6')]('-')[0x4];var _0x53ad0c=_0x4b2339[_0x7b5f('0x6')]('-')[0x0];var _0x67941c=crypto[_0x7b5f('0x7')]('aes-256-ctr',util['format']('%s:%s:%s',_0x302958,_0x4b2339,_0x53ad0c));var _0x5f12da=_0x67941c['update'](_0x120167,'base64','utf8');_0x5f12da+=_0x67941c[_0x7b5f('0x8')](_0x7b5f('0x9'));var _0x25eb58=JSON[_0x7b5f('0xa')](_0x5f12da);return _0x25eb58['hasOwnProperty'](_0x3e7dd1)?_0x25eb58[_0x3e7dd1]:null;}}return null;}function isLimit(_0x93b50,_0xf88ff4,_0x401a9a,_0x52d88f){var _0x478e76=_0xf88ff4;return compose()['use'](function(_0x69b270,_0x40a0e0,_0x39846d){return db[_0x7b5f('0xb')][_0x7b5f('0xc')]({'where':{'id':0x1},'raw':!![]})[_0x7b5f('0xd')](function(_0x1981a3){var _0x363c38=getValueFromLicense(_0x93b50,_0x1981a3);return _0x363c38?_0x363c38:_0x478e76;})[_0x7b5f('0xd')](function(_0x4d67d6){_0x478e76=_0x4d67d6;return _0x401a9a[_0x7b5f('0xe')](_0x52d88f);})[_0x7b5f('0xd')](function(_0xafd680){if(_0xafd680>=_0x478e76){return _0x40a0e0[_0x7b5f('0xf')](0x193)[_0x7b5f('0x10')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x93b50)});}_0x39846d();})[_0x7b5f('0x11')](function(_0x4c3ed8){_0x39846d(_0x4c3ed8);});});}function isUserLimit(){return isLimit(_0x7b5f('0x12'),0x1,db[_0x7b5f('0x13')],{'where':{'$or':[{'role':_0x7b5f('0x14')},{'role':_0x7b5f('0x15')}]}});}exports[_0x7b5f('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index eae9907..db91ef1 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 _0xbf66=['length','split','slice','forEach','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf66,0x13d));var _0x6bf6=function(_0x2d42ce,_0x205968){_0x2d42ce=_0x2d42ce-0x0;var _0xe9e8d5=_0xbf66[_0x2d42ce];return _0xe9e8d5;};'use strict';var _=require(_0x6bf6('0x0'));var moment=require('moment');exports[_0x6bf6('0x1')]=function(_0x43ea6a){var _0x4e9a4b={'conditions':[]};_0x4e9a4b[_0x6bf6('0x2')]=_[_0x6bf6('0x3')](_0x43ea6a,_0x6bf6('0x4'))?'or':_0x6bf6('0x5');var _0x41cbdd=_0x43ea6a['replace'](_0x6bf6('0x6'),'')['replace']('[$or]','')['split']('||');for(var _0x4d45dd=0x0;_0x4d45dd<_0x41cbdd[_0x6bf6('0x7')];_0x4d45dd++){var _0xfafd46=_0x41cbdd[_0x4d45dd][_0x6bf6('0x8')](':=');var _0x4f4fc5=_0xfafd46[0x0];var _0x273c43=_0xfafd46[_0x6bf6('0x9')](0x1);_0x273c43[_0x6bf6('0xa')](function(_0x5d94df){var _0x3accf2=_0x5d94df[_0x6bf6('0x8')]('[')['shift']();var _0x943025=_0x5d94df[_0x6bf6('0xb')](/\[(.*?)\]/g);_0x943025[_0x6bf6('0xa')](function(_0x264aa7){var _0x39ba94=_0x264aa7['split']('[')[_0x6bf6('0xc')](function(_0x3302ca){return _0x3302ca[_0x6bf6('0xd')](']')>-0x1;})[_0x6bf6('0xe')](function(_0x8c2ef7){return _0x8c2ef7[_0x6bf6('0x8')](']')[0x0];})[0x0];_0x4e9a4b[_0x6bf6('0xf')]['push']({'field':_0x4f4fc5,'operator':_0x3accf2,'value':_0x39ba94});});});}return _0x4e9a4b;};exports[_0x6bf6('0x10')]=function(_0x3d7c1f,_0x38a04d,_0x50b6d1){var _0x5a11a0={};if(_0x38a04d===_0x6bf6('0x11')){if(_0x50b6d1[_0x6bf6('0x12')]==='$eq'){_0x50b6d1[_0x6bf6('0x12')]=_0x6bf6('0x13');_0x50b6d1[_0x6bf6('0x14')]+=','+_0x50b6d1[_0x6bf6('0x14')];}else if(_[_0x6bf6('0x15')]([_0x6bf6('0x16'),_0x6bf6('0x17')],_0x50b6d1['operator'])){_0x50b6d1[_0x6bf6('0x14')]=moment(_0x50b6d1['value'])[_0x6bf6('0x18')](0x1,'days')[_0x6bf6('0x19')](_0x6bf6('0x1a'));}}if(_0x50b6d1[_0x6bf6('0x1b')]){_0x38a04d=_0x50b6d1[_0x6bf6('0x1b')];_0x5a11a0[_0x6bf6('0x1c')]='CAST('+_0x3d7c1f+'.'+_0x50b6d1[_0x6bf6('0x1d')]+_0x6bf6('0x1e')+_0x50b6d1[_0x6bf6('0x1b')]+')\x20'+parseOperator(_0x50b6d1[_0x6bf6('0x12')]);}else{_0x5a11a0['text']=_0x3d7c1f+'.'+_0x50b6d1[_0x6bf6('0x1d')]+'\x20'+parseOperator(_0x50b6d1[_0x6bf6('0x12')]);}if(_[_0x6bf6('0x15')]([_0x6bf6('0x1f'),'$notIn'],_0x50b6d1[_0x6bf6('0x12')]))_0x5a11a0[_0x6bf6('0x1c')]='('+_0x5a11a0['text']+'\x20OR\x20'+_0x3d7c1f+'.'+_0x50b6d1[_0x6bf6('0x1d')]+'\x20IS\x20NULL)';_0x5a11a0[_0x6bf6('0x14')]=parseValue(_0x38a04d,_0x50b6d1[_0x6bf6('0x12')],_0x50b6d1[_0x6bf6('0x14')]);return _0x5a11a0;};function parseOperator(_0x52bed3){var _0x5122a7;switch(_0x52bed3){case _0x6bf6('0x20'):_0x5122a7=_0x6bf6('0x21');break;case _0x6bf6('0x22'):_0x5122a7=_0x6bf6('0x23');break;case _0x6bf6('0x24'):_0x5122a7=_0x6bf6('0x25');break;case _0x6bf6('0x1f'):_0x5122a7='<>\x20?';break;case _0x6bf6('0x26'):case _0x6bf6('0x27'):case _0x6bf6('0x28'):_0x5122a7=_0x6bf6('0x29');break;case _0x6bf6('0x2a'):_0x5122a7=_0x6bf6('0x2b');break;case _0x6bf6('0x16'):_0x5122a7=_0x6bf6('0x2c');break;case _0x6bf6('0x17'):_0x5122a7=_0x6bf6('0x2d');break;case _0x6bf6('0x2e'):_0x5122a7=_0x6bf6('0x2f');break;case'$between':_0x5122a7=_0x6bf6('0x30');break;}return _0x5122a7;}function parseValue(_0x2ab921,_0x41c2fc,_0x95ab59){var _0x12ec26={'start':undefined,'end':undefined};switch(_0x41c2fc){case _0x6bf6('0x20'):case _0x6bf6('0x22'):_0x12ec26[_0x6bf6('0x31')]=_0x95ab59[_0x6bf6('0x8')](',');break;case _0x6bf6('0x26'):_0x12ec26[_0x6bf6('0x31')]='%'+_0x95ab59+'%';break;case _0x6bf6('0x27'):_0x12ec26[_0x6bf6('0x31')]=_0x95ab59+'%';break;case _0x6bf6('0x28'):_0x12ec26[_0x6bf6('0x31')]='%'+_0x95ab59;break;case _0x6bf6('0x13'):var _0x226003=_0x95ab59['split'](',');var _0x95ab59=_0x226003['shift']();var _0x2cfd51=_0x226003[_0x6bf6('0x32')]();if(_0x2ab921===_0x6bf6('0x11')){_0x95ab59=moment(_0x95ab59)[_0x6bf6('0x33')](0x0,!![])[_0x6bf6('0x19')]();_0x2cfd51=moment(_0x2cfd51)['utcOffset'](0x0,!![])[_0x6bf6('0x18')](0x17,'hours')[_0x6bf6('0x18')](0x3b,_0x6bf6('0x34'))[_0x6bf6('0x18')](0x3b,_0x6bf6('0x35'))[_0x6bf6('0x19')]();}_0x12ec26={'start':_0x95ab59,'end':_0x2cfd51};break;default:_0x12ec26[_0x6bf6('0x31')]=_0x95ab59;break;}return _0x12ec26;} \ No newline at end of file +var _0xb4a0=['=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$lte','<=\x20?','$gte','>=\x20?','start','pop','DATE','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split','length','slice','forEach','shift','match','indexOf','map','conditions','buildExpression','operator','$between','value','includes','$gt','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$eq'];(function(_0x1139ea,_0x1e9cc7){var _0x2b3ab5=function(_0x15151f){while(--_0x15151f){_0x1139ea['push'](_0x1139ea['shift']());}};_0x2b3ab5(++_0x1e9cc7);}(_0xb4a0,0x12a));var _0x0b4a=function(_0x3abbf7,_0x4a2b98){_0x3abbf7=_0x3abbf7-0x0;var _0x3ed4c4=_0xb4a0[_0x3abbf7];return _0x3ed4c4;};'use strict';var _=require(_0x0b4a('0x0'));var moment=require(_0x0b4a('0x1'));exports[_0x0b4a('0x2')]=function(_0x2ad9ba){var _0x47f106={'conditions':[]};_0x47f106[_0x0b4a('0x3')]=_[_0x0b4a('0x4')](_0x2ad9ba,'[$or]')?'or':'and';var _0x19ab8b=_0x2ad9ba[_0x0b4a('0x5')](_0x0b4a('0x6'),'')[_0x0b4a('0x5')](_0x0b4a('0x7'),'')[_0x0b4a('0x8')]('||');for(var _0x11d55c=0x0;_0x11d55c<_0x19ab8b[_0x0b4a('0x9')];_0x11d55c++){var _0x829abf=_0x19ab8b[_0x11d55c][_0x0b4a('0x8')](':=');var _0x4f88aa=_0x829abf[0x0];var _0x10ec9b=_0x829abf[_0x0b4a('0xa')](0x1);_0x10ec9b[_0x0b4a('0xb')](function(_0x55cdf5){var _0x51be83=_0x55cdf5['split']('[')[_0x0b4a('0xc')]();var _0x2fbbb9=_0x55cdf5[_0x0b4a('0xd')](/\[(.*?)\]/g);_0x2fbbb9[_0x0b4a('0xb')](function(_0x1aa115){var _0x243ac6=_0x1aa115[_0x0b4a('0x8')]('[')['filter'](function(_0x27bb5a){return _0x27bb5a[_0x0b4a('0xe')](']')>-0x1;})[_0x0b4a('0xf')](function(_0x2cb1b8){return _0x2cb1b8['split'](']')[0x0];})[0x0];_0x47f106[_0x0b4a('0x10')]['push']({'field':_0x4f88aa,'operator':_0x51be83,'value':_0x243ac6});});});}return _0x47f106;};exports[_0x0b4a('0x11')]=function(_0x10002d,_0x3bb4d6,_0x9987c0){var _0x561f86={};if(_0x3bb4d6==='DATE'){if(_0x9987c0[_0x0b4a('0x12')]==='$eq'){_0x9987c0[_0x0b4a('0x12')]=_0x0b4a('0x13');_0x9987c0[_0x0b4a('0x14')]+=','+_0x9987c0[_0x0b4a('0x14')];}else if(_[_0x0b4a('0x15')]([_0x0b4a('0x16'),'$lte'],_0x9987c0['operator'])){_0x9987c0[_0x0b4a('0x14')]=moment(_0x9987c0[_0x0b4a('0x14')])[_0x0b4a('0x17')](0x1,_0x0b4a('0x18'))[_0x0b4a('0x19')]('YYYY-MM-DD');}}if(_0x9987c0['castTo']){_0x3bb4d6=_0x9987c0[_0x0b4a('0x1a')];_0x561f86[_0x0b4a('0x1b')]=_0x0b4a('0x1c')+_0x10002d+'.'+_0x9987c0[_0x0b4a('0x1d')]+_0x0b4a('0x1e')+_0x9987c0['castTo']+')\x20'+parseOperator(_0x9987c0[_0x0b4a('0x12')]);}else{_0x561f86[_0x0b4a('0x1b')]=_0x10002d+'.'+_0x9987c0[_0x0b4a('0x1d')]+'\x20'+parseOperator(_0x9987c0['operator']);}if(_[_0x0b4a('0x15')]([_0x0b4a('0x1f'),_0x0b4a('0x20')],_0x9987c0['operator']))_0x561f86[_0x0b4a('0x1b')]='('+_0x561f86[_0x0b4a('0x1b')]+_0x0b4a('0x21')+_0x10002d+'.'+_0x9987c0[_0x0b4a('0x1d')]+_0x0b4a('0x22');_0x561f86[_0x0b4a('0x14')]=parseValue(_0x3bb4d6,_0x9987c0[_0x0b4a('0x12')],_0x9987c0[_0x0b4a('0x14')]);return _0x561f86;};function parseOperator(_0x154bf4){var _0x59ee8a;switch(_0x154bf4){case _0x0b4a('0x23'):_0x59ee8a=_0x0b4a('0x24');break;case _0x0b4a('0x20'):_0x59ee8a='NOT\x20IN\x20?';break;case _0x0b4a('0x25'):_0x59ee8a=_0x0b4a('0x26');break;case _0x0b4a('0x1f'):_0x59ee8a=_0x0b4a('0x27');break;case _0x0b4a('0x28'):case _0x0b4a('0x29'):case _0x0b4a('0x2a'):_0x59ee8a=_0x0b4a('0x2b');break;case _0x0b4a('0x2c'):_0x59ee8a=_0x0b4a('0x2d');break;case _0x0b4a('0x16'):_0x59ee8a='>\x20?';break;case _0x0b4a('0x2e'):_0x59ee8a=_0x0b4a('0x2f');break;case _0x0b4a('0x30'):_0x59ee8a=_0x0b4a('0x31');break;case _0x0b4a('0x13'):_0x59ee8a='BETWEEN\x20?\x20AND\x20?';break;}return _0x59ee8a;}function parseValue(_0x3847b6,_0x4a5810,_0x11b623){var _0x47aa63={'start':undefined,'end':undefined};switch(_0x4a5810){case _0x0b4a('0x23'):case'$notIn':_0x47aa63['start']=_0x11b623[_0x0b4a('0x8')](',');break;case _0x0b4a('0x28'):_0x47aa63[_0x0b4a('0x32')]='%'+_0x11b623+'%';break;case _0x0b4a('0x29'):_0x47aa63[_0x0b4a('0x32')]=_0x11b623+'%';break;case _0x0b4a('0x2a'):_0x47aa63['start']='%'+_0x11b623;break;case _0x0b4a('0x13'):var _0x3dfcdc=_0x11b623[_0x0b4a('0x8')](',');var _0x11b623=_0x3dfcdc[_0x0b4a('0xc')]();var _0x482b4e=_0x3dfcdc[_0x0b4a('0x33')]();if(_0x3847b6===_0x0b4a('0x34')){_0x11b623=moment(_0x11b623)[_0x0b4a('0x35')](0x0,!![])[_0x0b4a('0x19')]();_0x482b4e=moment(_0x482b4e)['utcOffset'](0x0,!![])['add'](0x17,_0x0b4a('0x36'))[_0x0b4a('0x17')](0x3b,'minutes')[_0x0b4a('0x17')](0x3b,_0x0b4a('0x37'))[_0x0b4a('0x19')]();}_0x47aa63={'start':_0x11b623,'end':_0x482b4e};break;default:_0x47aa63[_0x0b4a('0x32')]=_0x11b623;break;}return _0x47aa63;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4f5e539..0c1739c 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 _0x539b=['$lte','isArray','offset','sort','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','includes','push','join','lodash','moment','split','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x539b,0x122));var _0xb539=function(_0x3da73c,_0x2e662c){_0x3da73c=_0x3da73c-0x0;var _0x58af8b=_0x539b[_0x3da73c];return _0x58af8b;};'use strict';var _=require(_0xb539('0x0'));var sequelize=require('sequelize');var moment=require(_0xb539('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x468dea){var _0x5b862e=null;if(_0x468dea){_0x5b862e=_0x468dea[_0xb539('0x2')](',');}return _0x5b862e;};exports['filters']=function(_0x2ece3f,_0x19d8b4){var _0x3633e8={};if(!_[_0xb539('0x3')](_0x2ece3f)){_[_0xb539('0x4')](_0x2ece3f,function(_0x5c046a,_0x4889d2){try{if(_0x19d8b4){var _0x560c22=_[_0xb539('0x5')](_0x19d8b4,{'name':_0x4889d2})||{};if(_0x560c22[_0xb539('0x6')]===_0xb539('0x7')&&_[_0xb539('0x8')](_0x5c046a)){var _0x3c5b5d=JSON[_0xb539('0x9')](_0x5c046a);var _0x4e2ad7={'$gte':moment(moment(_0x3c5b5d[_0xb539('0xa')])['format'](_0xb539('0xb')))[_0xb539('0xc')]()[_0xb539('0xd')](),'$lte':moment(moment(_0x3c5b5d[_0xb539('0xe')])[_0xb539('0xd')]('YYYY-MM-DD'))[_0xb539('0xc')]()['subtract'](0x1,'s')[_0xb539('0xd')]()};_0x3633e8[_0x4889d2]=_0x4e2ad7;}else{_0x3633e8[_0x4889d2]=_['isArray'](_0x5c046a)?_0x5c046a:JSON[_0xb539('0x9')](_0x5c046a);}}else{_0x3633e8[_0x4889d2]=_[_0xb539('0xf')](_0x5c046a)?_0x5c046a:JSON[_0xb539('0x9')](_0x5c046a);}}catch(_0x224c9d){_0x3633e8[_0x4889d2]=_0x5c046a['split'](',');}});}return _0x3633e8;};exports['limit']=function(_0xa023f8){_0xa023f8=parseInt(_0xa023f8,0xa);if(!_0xa023f8||_0xa023f8<0x0){_0xa023f8=LIMIT_VALUE;}return _0xa023f8;};exports[_0xb539('0x10')]=function(_0x5d29e2){_0x5d29e2=parseInt(_0x5d29e2,0xa);if(!_0x5d29e2||_0x5d29e2<0x0){_0x5d29e2=0x0;}return _0x5d29e2;};exports[_0xb539('0x11')]=function(_0x37d254){var _0x50ba45,_0x1f0aee=null;if(_0x37d254){_0x50ba45=_0x37d254['split'](',');_0x1f0aee=_['map'](_0x50ba45,function(_0x579e82){if(_0x579e82[_0xb539('0x12')]('-')===0x0){return[_0x579e82===_0xb539('0x13')?sequelize[_0xb539('0x14')](sequelize[_0xb539('0x15')](_0xb539('0x13')),_0xb539('0x16')):_0x579e82[_0xb539('0x17')](0x1),'DESC'];}else{return[_0x579e82===_0xb539('0x13')?sequelize[_0xb539('0x14')](sequelize[_0xb539('0x15')](_0xb539('0x13')),_0xb539('0x16')):_0x579e82,_0xb539('0x18')];}});}return _0x1f0aee;};exports[_0xb539('0x19')]=function(_0x283f80,_0x2c9ec4){if(_['isEmpty'](_0x283f80)){return _0x283f80;}if(_['isArray'](_0x283f80)){for(var _0x271142=0x0;_0x271142<_0x283f80[_0xb539('0x1a')];_0x271142+=0x1){_0x283f80[_0x271142]=this['omit'](_0x283f80[_0x271142],_0x2c9ec4);}return _0x283f80;}if(!_[_0xb539('0x1b')](_0x283f80)){return _0x283f80;}if(_[_0xb539('0x1c')](_0x2c9ec4)){_0x2c9ec4=[_0x2c9ec4];}if(!_[_0xb539('0xf')](_0x2c9ec4)){return _0x283f80;}for(var _0x4e05d6=0x0;_0x4e05d6<_0x2c9ec4[_0xb539('0x1a')];_0x4e05d6+=0x1){_['unset'](_0x283f80,_0x2c9ec4[_0x4e05d6]);}for(var _0x3b63e5 in _0x283f80){if(_0x283f80[_0xb539('0x1d')](_0x3b63e5)){_0x283f80[_0x3b63e5]=this[_0xb539('0x19')](_0x283f80[_0x3b63e5],_0x2c9ec4);}}return _0x283f80;};exports[_0xb539('0x1e')]=function(_0xc336c2){return _0xc336c2[_0xb539('0x1f')](RegExp(_0xb539('0x20')))?!![]:![];};exports['isEmail']=function(_0x5d036b){return _0x5d036b['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xb539('0x21')]=function(_0x308b11){var _0x22a8fb=[];_0x308b11[_0xb539('0x2')](/[ ,]+/)[_0xb539('0x22')](function(_0x1d7dd3){_0x1d7dd3=_0x1d7dd3['replace'](/([^:]")"+/g,'$1');_0x1d7dd3='+'+_0x1d7dd3+'*';if(_0x1d7dd3[_0xb539('0x23')]('@'))_0x1d7dd3='\x22'+_0x1d7dd3+'\x22';_0x22a8fb[_0xb539('0x24')](_0x1d7dd3);});return _0x22a8fb[_0xb539('0x25')]('\x20');}; \ No newline at end of file +var _0x72b4=['isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','join','lodash','sequelize','moment','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','isArray','limit','offset','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','length','omit','isObject','isString','unset','hasOwnProperty'];(function(_0x533268,_0x40821d){var _0x7a40d5=function(_0x55a77a){while(--_0x55a77a){_0x533268['push'](_0x533268['shift']());}};_0x7a40d5(++_0x40821d);}(_0x72b4,0x158));var _0x472b=function(_0x9e05d1,_0x3cef4a){_0x9e05d1=_0x9e05d1-0x0;var _0x4f7e97=_0x72b4[_0x9e05d1];return _0x4f7e97;};'use strict';var _=require(_0x472b('0x0'));var sequelize=require(_0x472b('0x1'));var moment=require(_0x472b('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x2161fc){var _0xc16ff5=null;if(_0x2161fc){_0xc16ff5=_0x2161fc[_0x472b('0x3')](',');}return _0xc16ff5;};exports[_0x472b('0x4')]=function(_0x33e970,_0x189126){var _0x3057ad={};if(!_[_0x472b('0x5')](_0x33e970)){_[_0x472b('0x6')](_0x33e970,function(_0x21a66c,_0x30031f){try{if(_0x189126){var _0x41e709=_[_0x472b('0x7')](_0x189126,{'name':_0x30031f})||{};if(_0x41e709[_0x472b('0x8')]===_0x472b('0x9')&&_[_0x472b('0xa')](_0x21a66c)){var _0x4efaa9=JSON[_0x472b('0xb')](_0x21a66c);var _0x4aea8a={'$gte':moment(moment(_0x4efaa9[_0x472b('0xc')])[_0x472b('0xd')](_0x472b('0xe')))[_0x472b('0xf')]()['format'](),'$lte':moment(moment(_0x4efaa9['$lte'])[_0x472b('0xd')]('YYYY-MM-DD'))[_0x472b('0xf')]()['subtract'](0x1,'s')[_0x472b('0xd')]()};_0x3057ad[_0x30031f]=_0x4aea8a;}else{_0x3057ad[_0x30031f]=_['isArray'](_0x21a66c)?_0x21a66c:JSON[_0x472b('0xb')](_0x21a66c);}}else{_0x3057ad[_0x30031f]=_[_0x472b('0x10')](_0x21a66c)?_0x21a66c:JSON[_0x472b('0xb')](_0x21a66c);}}catch(_0x35d149){_0x3057ad[_0x30031f]=_0x21a66c['split'](',');}});}return _0x3057ad;};exports[_0x472b('0x11')]=function(_0x43b34e){_0x43b34e=parseInt(_0x43b34e,0xa);if(!_0x43b34e||_0x43b34e<0x0){_0x43b34e=LIMIT_VALUE;}return _0x43b34e;};exports[_0x472b('0x12')]=function(_0x44e6dc){_0x44e6dc=parseInt(_0x44e6dc,0xa);if(!_0x44e6dc||_0x44e6dc<0x0){_0x44e6dc=0x0;}return _0x44e6dc;};exports[_0x472b('0x13')]=function(_0x5e1de2){var _0x2a61b9,_0x142e23=null;if(_0x5e1de2){_0x2a61b9=_0x5e1de2[_0x472b('0x3')](',');_0x142e23=_[_0x472b('0x14')](_0x2a61b9,function(_0x54aea6){if(_0x54aea6['indexOf']('-')===0x0){return[_0x54aea6===_0x472b('0x15')?sequelize[_0x472b('0x16')](sequelize[_0x472b('0x17')](_0x472b('0x15')),_0x472b('0x18')):_0x54aea6[_0x472b('0x19')](0x1),_0x472b('0x1a')];}else{return[_0x54aea6===_0x472b('0x15')?sequelize[_0x472b('0x16')](sequelize[_0x472b('0x17')](_0x472b('0x15')),_0x472b('0x18')):_0x54aea6,_0x472b('0x1b')];}});}return _0x142e23;};exports['omit']=function(_0x4567b5,_0x2b6730){if(_['isEmpty'](_0x4567b5)){return _0x4567b5;}if(_[_0x472b('0x10')](_0x4567b5)){for(var _0xd2b0ea=0x0;_0xd2b0ea<_0x4567b5[_0x472b('0x1c')];_0xd2b0ea+=0x1){_0x4567b5[_0xd2b0ea]=this[_0x472b('0x1d')](_0x4567b5[_0xd2b0ea],_0x2b6730);}return _0x4567b5;}if(!_[_0x472b('0x1e')](_0x4567b5)){return _0x4567b5;}if(_[_0x472b('0x1f')](_0x2b6730)){_0x2b6730=[_0x2b6730];}if(!_[_0x472b('0x10')](_0x2b6730)){return _0x4567b5;}for(var _0x456935=0x0;_0x456935<_0x2b6730[_0x472b('0x1c')];_0x456935+=0x1){_[_0x472b('0x20')](_0x4567b5,_0x2b6730[_0x456935]);}for(var _0x5e9acf in _0x4567b5){if(_0x4567b5[_0x472b('0x21')](_0x5e9acf)){_0x4567b5[_0x5e9acf]=this['omit'](_0x4567b5[_0x5e9acf],_0x2b6730);}}return _0x4567b5;};exports[_0x472b('0x22')]=function(_0x43e417){return _0x43e417[_0x472b('0x23')](RegExp(_0x472b('0x24')))?!![]:![];};exports[_0x472b('0x25')]=function(_0x4e1d20){return _0x4e1d20[_0x472b('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x472b('0x26')]=function(_0x306e99){var _0x4d9195=[];_0x306e99[_0x472b('0x3')](/[ ,]+/)[_0x472b('0x27')](function(_0x16928b){_0x16928b=_0x16928b['replace'](/([^:]")"+/g,'$1');_0x16928b='+'+_0x16928b+'*';if(_0x16928b[_0x472b('0x28')]('@'))_0x16928b='\x22'+_0x16928b+'\x22';_0x4d9195['push'](_0x16928b);});return _0x4d9195[_0x472b('0x29')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 98cce3a..09a8e03 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f06=['json','initialize','express','serve-favicon','cookie-parser','path','passport','cors','moment','default','get','env','production','set','appPath','join','root','public','test','client','json\x20replacer','toISOString','split','use','static','views','/server/views','view\x20engine','html','urlencoded','50mb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f06,0x1b4));var _0x66f0=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x6f06[_0x34f701];return _0x3e2429;};'use strict';var express=require(_0x66f0('0x0'));var favicon=require(_0x66f0('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x66f0('0x2'));var errorHandler=require('errorhandler');var path=require(_0x66f0('0x3'));var passport=require(_0x66f0('0x4'));var cors=require(_0x66f0('0x5'));var moment=require(_0x66f0('0x6'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x66f0('0x7')]=function(_0x5a8e53){var _0x3aa193=_0x5a8e53[_0x66f0('0x8')](_0x66f0('0x9'));if(_0x3aa193===_0x66f0('0xa')){_0x5a8e53[_0x66f0('0xb')](_0x66f0('0xc'),path[_0x66f0('0xd')](config[_0x66f0('0xe')],_0x66f0('0xf')));}if(_0x3aa193==='development'||_0x3aa193===_0x66f0('0x10')){_0x5a8e53[_0x66f0('0xb')](_0x66f0('0xc'),path[_0x66f0('0xd')](config[_0x66f0('0xe')],_0x66f0('0x11')));_0x5a8e53['use'](errorHandler());}_0x5a8e53[_0x66f0('0xb')](_0x66f0('0x12'),function(_0x27e643,_0x21266a){if(this[_0x27e643]instanceof Date){_0x21266a=this[_0x27e643][_0x66f0('0x13')]()[_0x66f0('0x14')]('.')[0x0]+'Z';}return _0x21266a;});_0x5a8e53[_0x66f0('0x15')](express[_0x66f0('0x16')](_0x5a8e53[_0x66f0('0x8')]('appPath')));_0x5a8e53[_0x66f0('0xb')](_0x66f0('0x17'),config[_0x66f0('0xe')]+_0x66f0('0x18'));_0x5a8e53['engine']('html',require('ejs')['renderFile']);_0x5a8e53[_0x66f0('0xb')](_0x66f0('0x19'),_0x66f0('0x1a'));_0x5a8e53[_0x66f0('0x15')](bodyParser[_0x66f0('0x1b')]({'limit':_0x66f0('0x1c'),'extended':!![]}));_0x5a8e53[_0x66f0('0x15')](bodyParser[_0x66f0('0x1d')]({'limit':_0x66f0('0x1c')}));_0x5a8e53['use'](cors());_0x5a8e53[_0x66f0('0x15')](methodOverride());_0x5a8e53[_0x66f0('0x15')](cookieParser());_0x5a8e53[_0x66f0('0x15')](passport[_0x66f0('0x1e')]());}; \ No newline at end of file +var _0x377c=['set','join','client','use','json\x20replacer','split','static','get','views','/server/views','html','ejs','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','method-override','errorhandler','path','cors','./environment','../mysqldb','default','env','production','appPath','root','public','development','test'];(function(_0x1f80e7,_0xaefa7a){var _0x59f861=function(_0x1226f9){while(--_0x1226f9){_0x1f80e7['push'](_0x1f80e7['shift']());}};_0x59f861(++_0xaefa7a);}(_0x377c,0x13a));var _0xc377=function(_0x16f8c6,_0x351149){_0x16f8c6=_0x16f8c6-0x0;var _0x1dcd00=_0x377c[_0x16f8c6];return _0x1dcd00;};'use strict';var express=require(_0xc377('0x0'));var favicon=require(_0xc377('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xc377('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xc377('0x3'));var path=require(_0xc377('0x4'));var passport=require('passport');var cors=require(_0xc377('0x5'));var moment=require('moment');var config=require(_0xc377('0x6'));var db=require(_0xc377('0x7'))['db'];exports[_0xc377('0x8')]=function(_0xadc795){var _0x54d8ae=_0xadc795['get'](_0xc377('0x9'));if(_0x54d8ae===_0xc377('0xa')){_0xadc795['set'](_0xc377('0xb'),path['join'](config[_0xc377('0xc')],_0xc377('0xd')));}if(_0x54d8ae===_0xc377('0xe')||_0x54d8ae===_0xc377('0xf')){_0xadc795[_0xc377('0x10')](_0xc377('0xb'),path[_0xc377('0x11')](config[_0xc377('0xc')],_0xc377('0x12')));_0xadc795[_0xc377('0x13')](errorHandler());}_0xadc795[_0xc377('0x10')](_0xc377('0x14'),function(_0x373d5d,_0x53dca5){if(this[_0x373d5d]instanceof Date){_0x53dca5=this[_0x373d5d]['toISOString']()[_0xc377('0x15')]('.')[0x0]+'Z';}return _0x53dca5;});_0xadc795[_0xc377('0x13')](express[_0xc377('0x16')](_0xadc795[_0xc377('0x17')](_0xc377('0xb'))));_0xadc795[_0xc377('0x10')](_0xc377('0x18'),config[_0xc377('0xc')]+_0xc377('0x19'));_0xadc795['engine'](_0xc377('0x1a'),require(_0xc377('0x1b'))[_0xc377('0x1c')]);_0xadc795['set'](_0xc377('0x1d'),_0xc377('0x1a'));_0xadc795[_0xc377('0x13')](bodyParser['urlencoded']({'limit':_0xc377('0x1e'),'extended':!![]}));_0xadc795[_0xc377('0x13')](bodyParser[_0xc377('0x1f')]({'limit':_0xc377('0x1e')}));_0xadc795[_0xc377('0x13')](cors());_0xadc795[_0xc377('0x13')](methodOverride());_0xadc795[_0xc377('0x13')](cookieParser());_0xadc795[_0xc377('0x13')](passport[_0xc377('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f879c5a..83727e5 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 _0x1670=['getFirstInterface','orderBy','cpus','map','model','createHash','update','hex','getUuid','platform','replace','ipAddress','digest','substring','lodash','crypto','child_process','networkInterfaces','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x5afe78,_0x313aeb){var _0xca56d0=function(_0x5ab58c){while(--_0x5ab58c){_0x5afe78['push'](_0x5afe78['shift']());}};_0xca56d0(++_0x313aeb);}(_0x1670,0x9a));var _0x0167=function(_0x5cfdb5,_0x4fcb41){_0x5cfdb5=_0x5cfdb5-0x0;var _0x1c5ef3=_0x1670[_0x5cfdb5];return _0x1c5ef3;};'use strict';var _=require(_0x0167('0x0'));var os=require('os');var crypto=require(_0x0167('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x0167('0x2'))['execSync'];function getInterfaces(){var _0x1c7a08=[];var _0x45bbfd=os[_0x0167('0x3')]();var _0x6f87ae=_['orderBy'](_['keys'](_0x45bbfd));for(var _0x8e2217=0x0;_0x8e2217<_0x6f87ae[_0x0167('0x4')];_0x8e2217++){var _0x295e51=_0x45bbfd[_0x6f87ae[_0x8e2217]][_0x0167('0x5')](function(_0x2120f2){return _0x2120f2[_0x0167('0x6')]===_0x0167('0x7')&&_0x2120f2[_0x0167('0x8')]===![];});_0x1c7a08=_0x1c7a08['concat'](_0x295e51);}return _0x1c7a08;}function getFirstInterface(){var _0x4c6b78=_[_0x0167('0x9')](getInterfaces());return{'macAddress':_0x4c6b78&&_0x4c6b78[_0x0167('0xa')]?_0x4c6b78[_0x0167('0xa')]:_0x0167('0xb'),'ipAddress':_0x4c6b78&&_0x4c6b78[_0x0167('0xc')]?_0x4c6b78[_0x0167('0xc')]:_0x0167('0xd')};}exports[_0x0167('0xe')]=getFirstInterface;function getCPUhash(){var _0x257ed6=_[_0x0167('0xf')](os[_0x0167('0x10')]()[_0x0167('0x11')](function(_0x34ac02){return _0x34ac02[_0x0167('0x12')];}))['join'](':');return crypto[_0x0167('0x13')]('md5')[_0x0167('0x14')](_0x257ed6)['digest'](_0x0167('0x15'));}exports[_0x0167('0x16')]=function(){switch(os[_0x0167('0x17')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x0167('0x18')]('\x0d\x0a','');default:var _0x7ae6e7=getFirstInterface();var _0x4c4cc7=getCPUhash();var _0xcb9473=_0x4c4cc7+'|'+os['hostname']()+'|'+_0x7ae6e7['macAddress']+'|'+_0x7ae6e7[_0x0167('0x19')];var _0x574f04=crypto[_0x0167('0x13')]('md5')[_0x0167('0x14')](_0xcb9473)[_0x0167('0x1a')](_0x0167('0x15'));return _0x574f04[_0x0167('0x1b')](0x0,0x8)+'-'+_0x574f04[_0x0167('0x1b')](0x8,0xc)+'-'+_0x574f04[_0x0167('0x1b')](0xc,0x10)+'-'+_0x574f04[_0x0167('0x1b')](0x10,0x14)+'-'+_0x574f04[_0x0167('0x1b')](0x14);}}; \ No newline at end of file +var _0x37cc=['dmidecode\x20--string\x20system-uuid','replace','hostname','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','update','digest','hex','getUuid','platform'];(function(_0x11899c,_0x3e0f54){var _0x5b9aef=function(_0x46dace){while(--_0x46dace){_0x11899c['push'](_0x11899c['shift']());}};_0x5b9aef(++_0x3e0f54);}(_0x37cc,0x185));var _0xc37c=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0x37cc[_0x36d8d9];return _0x1ac3a2;};'use strict';var _=require(_0xc37c('0x0'));var os=require('os');var crypto=require(_0xc37c('0x1'));var machine=require(_0xc37c('0x2'));var exec=require(_0xc37c('0x3'))[_0xc37c('0x4')];function getInterfaces(){var _0x2bc194=[];var _0x48bba7=os['networkInterfaces']();var _0x334d3c=_[_0xc37c('0x5')](_[_0xc37c('0x6')](_0x48bba7));for(var _0x3bdfc5=0x0;_0x3bdfc5<_0x334d3c[_0xc37c('0x7')];_0x3bdfc5++){var _0x582100=_0x48bba7[_0x334d3c[_0x3bdfc5]][_0xc37c('0x8')](function(_0x1eaa97){return _0x1eaa97[_0xc37c('0x9')]==='IPv4'&&_0x1eaa97[_0xc37c('0xa')]===![];});_0x2bc194=_0x2bc194[_0xc37c('0xb')](_0x582100);}return _0x2bc194;}function getFirstInterface(){var _0x2cfed2=_[_0xc37c('0xc')](getInterfaces());return{'macAddress':_0x2cfed2&&_0x2cfed2[_0xc37c('0xd')]?_0x2cfed2['mac']:_0xc37c('0xe'),'ipAddress':_0x2cfed2&&_0x2cfed2[_0xc37c('0xf')]?_0x2cfed2[_0xc37c('0xf')]:_0xc37c('0x10')};}exports[_0xc37c('0x11')]=getFirstInterface;function getCPUhash(){var _0x6feb0c=_[_0xc37c('0x5')](os[_0xc37c('0x12')]()[_0xc37c('0x13')](function(_0xd90fc8){return _0xd90fc8[_0xc37c('0x14')];}))['join'](':');return crypto['createHash'](_0xc37c('0x15'))[_0xc37c('0x16')](_0x6feb0c)[_0xc37c('0x17')](_0xc37c('0x18'));}exports[_0xc37c('0x19')]=function(){switch(os[_0xc37c('0x1a')]()){case'win32':return exec(_0xc37c('0x1b'),{'encoding':'utf8'})[_0xc37c('0x1c')]('\x0d\x0a','');default:var _0x128d81=getFirstInterface();var _0x9c1ee7=getCPUhash();var _0xb00fb1=_0x9c1ee7+'|'+os[_0xc37c('0x1d')]()+'|'+_0x128d81['macAddress']+'|'+_0x128d81['ipAddress'];var _0x49afc6=crypto[_0xc37c('0x1e')]('md5')[_0xc37c('0x16')](_0xb00fb1)[_0xc37c('0x17')]('hex');return _0x49afc6[_0xc37c('0x1f')](0x0,0x8)+'-'+_0x49afc6[_0xc37c('0x1f')](0x8,0xc)+'-'+_0x49afc6[_0xc37c('0x1f')](0xc,0x10)+'-'+_0x49afc6[_0xc37c('0x1f')](0x10,0x14)+'-'+_0x49afc6['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d5979ad..774475e 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 _0xd762=['format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','email','|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','../logger','../../api/jira/jira.controller','process','https://www.xcallymotion.com'];(function(_0x38ac7b,_0x2dc75f){var _0x2c3cd5=function(_0x10ddc9){while(--_0x10ddc9){_0x38ac7b['push'](_0x38ac7b['shift']());}};_0x2c3cd5(++_0x2dc75f);}(_0xd762,0xa1));var _0x2d76=function(_0x5d8d6d,_0x16e214){_0x5d8d6d=_0x5d8d6d-0x0;var _0x5c167b=_0xd762[_0x5d8d6d];return _0x5c167b;};'use strict';var util=require(_0x2d76('0x0'));var moment=require(_0x2d76('0x1'));var rp=require(_0x2d76('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x2d76('0x3'));var db=require(_0x2d76('0x4'))['db'];var encryptor=require(_0x2d76('0x5'));var hardware=require('./hardware');var logger=require(_0x2d76('0x6'))('license');var jira=require(_0x2d76('0x7'));const {config}=require(_0x2d76('0x8'));var HOST=_0x2d76('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5ee28f){return new BPromise(function(_0xad655,_0x58fe73){var _0x338fbc=util[_0x2d76('0xa')](_0x2d76('0xb'),HOST,_0x5ee28f,module[_0x2d76('0xc')][_0x2d76('0x3')]);if(oldToken){_0x338fbc=util[_0x2d76('0xa')](_0x2d76('0xd'),HOST,_0x5ee28f,module[_0x2d76('0xc')][_0x2d76('0x3')],oldToken);}var _0x4b726c={'uri':_0x338fbc,'method':_0x2d76('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4b726c)[_0x2d76('0xf')](function(_0x1bc059){_0xad655(_0x1bc059);})[_0x2d76('0x10')](function(_0x1c9955){_0x58fe73(_0x1c9955);});});}function sendJiraAlert(_0xb2023,_0x44c193,_0x292b96){var _0x254f05=_0x2d76('0x11');return db[_0x2d76('0x12')]['findOne']({'where':{'role':'admin'},'attributes':['fullname',_0x2d76('0x13')],'raw':!![]})['then'](function(_0x40db11){ADMIN=_0x40db11;_0x254f05+=_0x2d76('0x14')+_0x292b96+'|\x0a';_0x254f05+=_0x2d76('0x15')+_0xb2023+'|\x0a';_0x254f05+=_0x2d76('0x16')+_0x44c193+'|\x0a';_0x254f05+=_0x2d76('0x17')+ADMIN[_0x2d76('0x18')]+'|\x0a';_0x254f05+=_0x2d76('0x19')+ADMIN[_0x2d76('0x13')]+'|\x0a';return _0x254f05;})[_0x2d76('0xf')](function(_0x4b232d){var _0x449bc1=hardware[_0x2d76('0x1a')]()['ipAddress'];return jira[_0x2d76('0x1b')]({'key':_0x2d76('0x1c'),'summary':_0x2d76('0x1d'),'description':_0x4b232d,'issuetype':_0x2d76('0x1e'),'oldToken':_0xb2023,'newToken':_0x44c193,'email':ADMIN['email'],'name':ADMIN[_0x2d76('0x18')],'reason':GRAY_PERIOD_REASON,'ip':_0x449bc1});});}function manageLicense(_0x4720d1,_0x375d54){var _0x212168=_0x375d54[_0x2d76('0x1f')]({'plain':!![]});httpRequest(_0x4720d1)['then'](function(_0xe9e912){if(oldToken){oldToken=undefined;}if(_0xe9e912[_0x2d76('0x20')]){if(!_0x212168['license']&&_0x212168[_0x2d76('0x21')]!=_0xe9e912['license']||_0x212168['license']&&_0x212168['data2']){logger[_0x2d76('0x22')](_0x2d76('0x23'));}if(_0x212168[_0x2d76('0x21')]&&!_0x212168['data2']&&_0x212168[_0x2d76('0x21')]!=_0xe9e912['license']){logger[_0x2d76('0x22')](_0x2d76('0x24'));}if(_0x212168[_0x2d76('0x21')]&&!_0x212168[_0x2d76('0x25')]&&_0x212168[_0x2d76('0x21')]==_0xe9e912[_0x2d76('0x21')]){return _0x375d54;}return _0x375d54[_0x2d76('0x26')]({'data1':_0x4720d1,'data2':null,'license':_0xe9e912[_0x2d76('0x21')]});}else{if(_0xe9e912['license']||_0x212168[_0x2d76('0x21')]){if(!_0x212168['data2']){if(_0x212168['data1']==_0x4720d1){GRAY_PERIOD_REASON=_0x2d76('0x27');logger[_0x2d76('0x22')](_0x2d76('0x28'));}else{GRAY_PERIOD_REASON=_0x2d76('0x29');oldToken=_0x212168[_0x2d76('0x2a')];logger[_0x2d76('0x22')](_0x2d76('0x2b'),_0x212168['data1'],_0x4720d1);}sendJiraAlert(_0x212168['data1'],_0xe9e912[_0x2d76('0x2c')],GRAY_PERIOD_REASON);logger['info'](_0x2d76('0x2d'),GRAY_PERIOD_REASON[_0x2d76('0x2e')](),moment()[_0x2d76('0xa')](_0x2d76('0x2f')));return _0x375d54['update']({'data2':encryptor[_0x2d76('0x30')](moment()['format'](_0x2d76('0x2f')))});}else{if(moment()[_0x2d76('0x31')](encryptor[_0x2d76('0x32')](_0x212168[_0x2d76('0x25')]),'days')>DAYS){logger[_0x2d76('0x22')](_0x2d76('0x33'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x375d54['update']({'data1':_0x4720d1,'data2':null,'license':null});}}}else{if(_0x212168[_0x2d76('0x2a')]!=_0x4720d1){logger[_0x2d76('0x22')](_0x2d76('0x2b'),_0x212168[_0x2d76('0x2a')],_0x4720d1);return _0x375d54[_0x2d76('0x26')]({'data1':_0x4720d1,'data2':null,'license':null});}}}return _0x375d54;})[_0x2d76('0xf')](function(_0x358e7f){_0x375d54=_0x358e7f;})[_0x2d76('0x10')](function(_0x496425){logger[_0x2d76('0x34')](_0x496425[_0x2d76('0x35')]);})[_0x2d76('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0x2d76('0x37')](),_0x375d54);},TIME);});}function defaultLicense(){var _0x3949c1=hardware[_0x2d76('0x37')]();if(_0x3949c1){return db['License'][_0x2d76('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x3949c1}})['spread'](function(_0x1ed160,_0x495dc3){logger[_0x2d76('0x22')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3949c1);manageLicense(_0x3949c1,_0x1ed160);})[_0x2d76('0x10')](function(_0x150f23){logger[_0x2d76('0x34')](_0x150f23[_0x2d76('0x35')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xb805=['MOTLICENSE','Alert','get','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','license','../../api/jira/jira.controller','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','User','email','|reason|','|uuid|','|machineUuid|','|name|','ipAddress','openIssue'];(function(_0x4649d4,_0x187562){var _0x58ba0a=function(_0x1e47f3){while(--_0x1e47f3){_0x4649d4['push'](_0x4649d4['shift']());}};_0x58ba0a(++_0x187562);}(_0xb805,0x14e));var _0x5b80=function(_0x30567c,_0x4321f0){_0x30567c=_0x30567c-0x0;var _0x404887=_0xb805[_0x30567c];return _0x404887;};'use strict';var util=require('util');var moment=require(_0x5b80('0x0'));var rp=require(_0x5b80('0x1'));var BPromise=require(_0x5b80('0x2'));var pkginfo=require(_0x5b80('0x3'))(module,_0x5b80('0x4'));var db=require(_0x5b80('0x5'))['db'];var encryptor=require(_0x5b80('0x6'));var hardware=require('./hardware');var logger=require('../logger')(_0x5b80('0x7'));var jira=require(_0x5b80('0x8'));const {config}=require('process');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x1fcfd7){return new BPromise(function(_0x545bfc,_0x5a8596){var _0x1f9dbe=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x1fcfd7,module[_0x5b80('0x9')]['version']);if(oldToken){_0x1f9dbe=util[_0x5b80('0xa')](_0x5b80('0xb'),HOST,_0x1fcfd7,module[_0x5b80('0x9')][_0x5b80('0x4')],oldToken);}var _0x75b6dd={'uri':_0x1f9dbe,'method':_0x5b80('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x75b6dd)[_0x5b80('0xd')](function(_0x2ec2ea){_0x545bfc(_0x2ec2ea);})[_0x5b80('0xe')](function(_0x29dff9){_0x5a8596(_0x29dff9);});});}function sendJiraAlert(_0x202c5b,_0x42c988,_0x41a381){var _0x1306fc='||FIELD||VALUE||\x0a';return db[_0x5b80('0xf')]['findOne']({'where':{'role':'admin'},'attributes':['fullname',_0x5b80('0x10')],'raw':!![]})[_0x5b80('0xd')](function(_0x2cad3a){ADMIN=_0x2cad3a;_0x1306fc+=_0x5b80('0x11')+_0x41a381+'|\x0a';_0x1306fc+=_0x5b80('0x12')+_0x202c5b+'|\x0a';_0x1306fc+=_0x5b80('0x13')+_0x42c988+'|\x0a';_0x1306fc+=_0x5b80('0x14')+ADMIN['fullname']+'|\x0a';_0x1306fc+='|email|'+ADMIN[_0x5b80('0x10')]+'|\x0a';return _0x1306fc;})[_0x5b80('0xd')](function(_0x1ea668){var _0x435373=hardware['getFirstInterface']()[_0x5b80('0x15')];return jira[_0x5b80('0x16')]({'key':_0x5b80('0x17'),'summary':'Motion\x20License\x20Alert','description':_0x1ea668,'issuetype':_0x5b80('0x18'),'oldToken':_0x202c5b,'newToken':_0x42c988,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x435373});});}function manageLicense(_0x56d391,_0x2b29c2){var _0x33278d=_0x2b29c2[_0x5b80('0x19')]({'plain':!![]});httpRequest(_0x56d391)[_0x5b80('0xd')](function(_0x5a3fd7){if(oldToken){oldToken=undefined;}if(_0x5a3fd7[_0x5b80('0x1a')]){if(!_0x33278d[_0x5b80('0x7')]&&_0x33278d[_0x5b80('0x7')]!=_0x5a3fd7['license']||_0x33278d[_0x5b80('0x7')]&&_0x33278d['data2']){logger[_0x5b80('0x1b')](_0x5b80('0x1c'));}if(_0x33278d[_0x5b80('0x7')]&&!_0x33278d[_0x5b80('0x1d')]&&_0x33278d[_0x5b80('0x7')]!=_0x5a3fd7[_0x5b80('0x7')]){logger['info'](_0x5b80('0x1e'));}if(_0x33278d['license']&&!_0x33278d['data2']&&_0x33278d['license']==_0x5a3fd7[_0x5b80('0x7')]){return _0x2b29c2;}return _0x2b29c2['update']({'data1':_0x56d391,'data2':null,'license':_0x5a3fd7[_0x5b80('0x7')]});}else{if(_0x5a3fd7[_0x5b80('0x7')]||_0x33278d['license']){if(!_0x33278d['data2']){if(_0x33278d['data1']==_0x56d391){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x5b80('0x1f'));}else{GRAY_PERIOD_REASON=_0x5b80('0x20');oldToken=_0x33278d[_0x5b80('0x21')];logger[_0x5b80('0x1b')](_0x5b80('0x22'),_0x33278d[_0x5b80('0x21')],_0x56d391);}sendJiraAlert(_0x33278d['data1'],_0x5a3fd7['uuid'],GRAY_PERIOD_REASON);logger[_0x5b80('0x1b')](_0x5b80('0x23'),GRAY_PERIOD_REASON[_0x5b80('0x24')](),moment()[_0x5b80('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x2b29c2[_0x5b80('0x25')]({'data2':encryptor[_0x5b80('0x26')](moment()[_0x5b80('0xa')](_0x5b80('0x27')))});}else{if(moment()[_0x5b80('0x28')](encryptor[_0x5b80('0x29')](_0x33278d['data2']),_0x5b80('0x2a'))>DAYS){logger[_0x5b80('0x1b')](_0x5b80('0x2b'),moment()[_0x5b80('0xa')](_0x5b80('0x27')));return _0x2b29c2[_0x5b80('0x25')]({'data1':_0x56d391,'data2':null,'license':null});}}}else{if(_0x33278d[_0x5b80('0x21')]!=_0x56d391){logger['info'](_0x5b80('0x22'),_0x33278d[_0x5b80('0x21')],_0x56d391);return _0x2b29c2[_0x5b80('0x25')]({'data1':_0x56d391,'data2':null,'license':null});}}}return _0x2b29c2;})[_0x5b80('0xd')](function(_0x56ee35){_0x2b29c2=_0x56ee35;})[_0x5b80('0xe')](function(_0x8745a1){logger['error'](_0x8745a1[_0x5b80('0x2c')]);})[_0x5b80('0x2d')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2b29c2);},TIME);});}function defaultLicense(){var _0x217c4b=hardware[_0x5b80('0x2e')]();if(_0x217c4b){return db['License'][_0x5b80('0x2f')]({'where':{'id':0x1},'defaults':{'data1':_0x217c4b}})[_0x5b80('0x30')](function(_0x21e92a,_0x105c78){logger['info'](_0x5b80('0x31'),_0x217c4b);manageLicense(_0x217c4b,_0x21e92a);})[_0x5b80('0xe')](function(_0x23db48){logger['error'](_0x23db48[_0x5b80('0x2c')]);});}}exports[_0x5b80('0x32')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f3a12f9..a6a7a89 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 _0x1520=['add','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','forEach','count','catch','countBy','telephone','License\x20limit\x20reached\x20for\x20users','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString'];(function(_0x41647b,_0x3ce5ba){var _0x1a8681=function(_0x544b15){while(--_0x544b15){_0x41647b['push'](_0x41647b['shift']());}};_0x1a8681(++_0x3ce5ba);}(_0x1520,0x69));var _0x0152=function(_0x3cc684,_0xfb7df7){_0x3cc684=_0x3cc684-0x0;var _0x4ee5f1=_0x1520[_0x3cc684];return _0x4ee5f1;};'use strict';var util=require(_0x0152('0x0'));var _=require('lodash');var moment=require(_0x0152('0x1'));var BPromise=require(_0x0152('0x2'));var hardware=require(_0x0152('0x3'));var encryptor=require(_0x0152('0x4'));var db=require(_0x0152('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0152('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0152('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0152('0x6'),'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(_0x4fa9c5){return new BPromise(function(_0x2482d1,_0x29a0d9){return db['License'][_0x0152('0x8')](_[_0x0152('0x9')](_0x4fa9c5,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x304302){return checkLicense(_0x304302,null);})[_0x0152('0xa')](function(_0x2245ec){_0x2482d1(_0x2245ec);return;})['catch'](function(_0x567099){_0x29a0d9(_0x567099);});});}function checkLicense(_0x51283c,_0x1f66c5){if(!_0x51283c){demoLicense[_0x0152('0xb')]=_0x51283c[_0x0152('0xc')];return demoLicense;}try{var _0x47261f=_0x1f66c5||_0x51283c[_0x0152('0xd')];if(_[_0x0152('0xe')](_0x47261f)){throw new Error(_0x0152('0xf'));}var _0x3f60e9=_0x51283c[_0x0152('0xc')];var _0x4bb195=_0x51283c[_0x0152('0x10')];var _0x50da48=_0x3f60e9['split']('-')[0x4];var _0xffc0c1=_0x3f60e9[_0x0152('0x11')]('-')[0x0];var _0x2fff98=encryptor['decryptString'](_0x47261f,util[_0x0152('0x12')](_0x0152('0x13'),_0x50da48,_0x3f60e9,_0xffc0c1));var _0x5373cd=JSON[_0x0152('0x14')](_0x2fff98);_0x5373cd[_0x0152('0x15')]=![];_0x5373cd['uuid']=_0x3f60e9;_0x5373cd[_0x0152('0x16')]=hardware['getUuid']();if(_0x4bb195){var _0x3b7e59=encryptor[_0x0152('0x17')](_0x4bb195);_0x5373cd['gray']=_0x3b7e59;_0x5373cd['deadline']=moment(_0x3b7e59)[_0x0152('0x18')](0x7,'days')[_0x0152('0x12')]();_0x5373cd['grayReason']=_0x5373cd['uuid']!=_0x5373cd[_0x0152('0x16')]?_0x0152('0x19'):_0x0152('0x1a');}return _0x5373cd;}catch(_0x11600d){breakingLicense['uuid']=_0x51283c['data1'];breakingLicense[_0x0152('0x1b')]=_0x11600d[_0x0152('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xbde758,_0x2333a2){getLicense()['then'](function(_0x3747d6){return db[_0x0152('0x1c')][_0x0152('0x1d')]({'attributes':[_0x0152('0x1e'),[db[_0x0152('0x1f')]['fn'](_0x0152('0x20'),db[_0x0152('0x1f')][_0x0152('0x21')](_0x0152('0x1e'))),'count']],'group':_0x0152('0x1e'),'where':{'role':{'$or':[_0x0152('0x22'),_0x0152('0x23'),'telephone']}},'raw':!![]})[_0x0152('0xa')](function(_0xb5347d){var _0x2c0078={'user':_0x3747d6['users']||0x0,'telephone':_0x3747d6['telephones']||0x0};_0xb5347d[_0x0152('0x24')](function(_0x20f26e){var _0x1ca7a5=_0x20f26e[_0x0152('0x1e')]===_0x0152('0x22')?_0x0152('0x23'):_0x20f26e[_0x0152('0x1e')];_0x2c0078[_0x1ca7a5]-=_0x20f26e[_0x0152('0x25')];if(_0x2c0078[_0x1ca7a5]<0x0)_0x2c0078[_0x1ca7a5]=0x0;});_0xbde758(_0x2c0078);return;});})[_0x0152('0x26')](function(_0x10eac4){_0x2333a2(_0x10eac4);});});}function checkUserLimits(_0x89b4a1){return new BPromise(function(_0x409115,_0x1ebcaf){getLimits()['then'](function(_0x153bd0){var _0x51b5f8=_['pick'](_[_0x0152('0x27')](_0x89b4a1,'role'),[_0x0152('0x22'),'user',_0x0152('0x28')]);var _0x5333f6=(_0x51b5f8[_0x0152('0x22')]||0x0)+(_0x51b5f8[_0x0152('0x23')]||0x0);var _0x3ebfaa=_0x51b5f8[_0x0152('0x28')]||0x0;if(_0x5333f6>_0x153bd0[_0x0152('0x23')])return _0x1ebcaf(_0x0152('0x29'));if(_0x3ebfaa>_0x153bd0['telephone'])return _0x1ebcaf('License\x20limit\x20reached\x20for\x20telephones');return _0x409115();})[_0x0152('0x26')](function(_0x5d3ab7){_0x1ebcaf(_0x5d3ab7);});});}module[_0x0152('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe09b=['gray','deadline','add','uuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','defaults','then','catch','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid'];(function(_0x1cc98e,_0x5b6f77){var _0x1aa22d=function(_0x1c4315){while(--_0x1c4315){_0x1cc98e['push'](_0x1cc98e['shift']());}};_0x1aa22d(++_0x5b6f77);}(_0xe09b,0x7a));var _0xbe09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe09b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xbe09('0x0'));var moment=require(_0xbe09('0x1'));var BPromise=require(_0xbe09('0x2'));var hardware=require(_0xbe09('0x3'));var encryptor=require(_0xbe09('0x4'));var db=require(_0xbe09('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbe09('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbe09('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbe09('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbe09('0x8'),'machineUuid':hardware[_0xbe09('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4a69b4){return new BPromise(function(_0x80fecd,_0x1d0ebd){return db[_0xbe09('0xa')]['find'](_[_0xbe09('0xb')](_0x4a69b4,{'raw':!![],'where':{'id':0x1}}))[_0xbe09('0xc')](function(_0x5aa155){return checkLicense(_0x5aa155,null);})[_0xbe09('0xc')](function(_0x454cc0){_0x80fecd(_0x454cc0);return;})[_0xbe09('0xd')](function(_0x1f1261){_0x1d0ebd(_0x1f1261);});});}function checkLicense(_0x5443fb,_0x504590){if(!_0x5443fb){demoLicense['uuid']=_0x5443fb[_0xbe09('0xe')];return demoLicense;}try{var _0x2a657a=_0x504590||_0x5443fb[_0xbe09('0xf')];if(_[_0xbe09('0x10')](_0x2a657a)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4fc808=_0x5443fb[_0xbe09('0xe')];var _0x53aa7c=_0x5443fb[_0xbe09('0x11')];var _0x321810=_0x4fc808[_0xbe09('0x12')]('-')[0x4];var _0x55a4cb=_0x4fc808[_0xbe09('0x12')]('-')[0x0];var _0x2dde08=encryptor[_0xbe09('0x13')](_0x2a657a,util[_0xbe09('0x14')](_0xbe09('0x15'),_0x321810,_0x4fc808,_0x55a4cb));var _0x15da51=JSON[_0xbe09('0x16')](_0x2dde08);_0x15da51[_0xbe09('0x17')]=![];_0x15da51['uuid']=_0x4fc808;_0x15da51[_0xbe09('0x18')]=hardware[_0xbe09('0x9')]();if(_0x53aa7c){var _0x17a821=encryptor[_0xbe09('0x13')](_0x53aa7c);_0x15da51[_0xbe09('0x19')]=_0x17a821;_0x15da51[_0xbe09('0x1a')]=moment(_0x17a821)[_0xbe09('0x1b')](0x7,'days')[_0xbe09('0x14')]();_0x15da51['grayReason']=_0x15da51[_0xbe09('0x1c')]!=_0x15da51[_0xbe09('0x18')]?_0xbe09('0x1d'):_0xbe09('0x1e');}return _0x15da51;}catch(_0xe55726){breakingLicense[_0xbe09('0x1c')]=_0x5443fb[_0xbe09('0xe')];breakingLicense[_0xbe09('0x1f')]=_0xe55726[_0xbe09('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x596fe8,_0x3ed85f){getLicense()['then'](function(_0x4ac9fe){return db[_0xbe09('0x20')][_0xbe09('0x21')]({'attributes':[_0xbe09('0x22'),[db[_0xbe09('0x23')]['fn'](_0xbe09('0x24'),db[_0xbe09('0x23')][_0xbe09('0x25')](_0xbe09('0x22'))),_0xbe09('0x26')]],'group':_0xbe09('0x22'),'where':{'role':{'$or':[_0xbe09('0x27'),_0xbe09('0x28'),_0xbe09('0x29')]}},'raw':!![]})['then'](function(_0x48e8cd){var _0x2e9907={'user':_0x4ac9fe[_0xbe09('0x2a')]||0x0,'telephone':_0x4ac9fe[_0xbe09('0x2b')]||0x0};_0x48e8cd[_0xbe09('0x2c')](function(_0x51452c){var _0x317a42=_0x51452c[_0xbe09('0x22')]==='admin'?_0xbe09('0x28'):_0x51452c[_0xbe09('0x22')];_0x2e9907[_0x317a42]-=_0x51452c[_0xbe09('0x26')];if(_0x2e9907[_0x317a42]<0x0)_0x2e9907[_0x317a42]=0x0;});_0x596fe8(_0x2e9907);return;});})['catch'](function(_0x4c4181){_0x3ed85f(_0x4c4181);});});}function checkUserLimits(_0x5bb040){return new BPromise(function(_0x13a0a3,_0x41ab8e){getLimits()[_0xbe09('0xc')](function(_0x476c5c){var _0x2413f1=_['pick'](_[_0xbe09('0x2d')](_0x5bb040,_0xbe09('0x22')),['admin',_0xbe09('0x28'),_0xbe09('0x29')]);var _0x4f20cc=(_0x2413f1[_0xbe09('0x27')]||0x0)+(_0x2413f1['user']||0x0);var _0xe8434a=_0x2413f1['telephone']||0x0;if(_0x4f20cc>_0x476c5c['user'])return _0x41ab8e(_0xbe09('0x2e'));if(_0xe8434a>_0x476c5c[_0xbe09('0x29')])return _0x41ab8e(_0xbe09('0x2f'));return _0x13a0a3();})[_0xbe09('0xd')](function(_0xd34d6d){_0x41ab8e(_0xd34d6d);});});}module[_0xbe09('0x30')]={'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 70c3aff..dded71f 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 _0x3bb4=['http://localhost:9000','app-id','secret','exports'];(function(_0x22b30c,_0x2fb0ba){var _0xb5a49=function(_0x27ef04){while(--_0x27ef04){_0x22b30c['push'](_0x22b30c['shift']());}};_0xb5a49(++_0x2fb0ba);}(_0x3bb4,0x87));var _0x43bb=function(_0x33a522,_0x53d235){_0x33a522=_0x33a522-0x0;var _0x450e36=_0x3bb4[_0x33a522];return _0x450e36;};'use strict';module[_0x43bb('0x0')]={'DOMAIN':_0x43bb('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x43bb('0x2'),'GOOGLE_SECRET':_0x43bb('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x76cc=['http://localhost:9000','app-id','secret','exports'];(function(_0x419945,_0x55334d){var _0x34f08e=function(_0x128c61){while(--_0x128c61){_0x419945['push'](_0x419945['shift']());}};_0x34f08e(++_0x55334d);}(_0x76cc,0x117));var _0xc76c=function(_0x3d18d7,_0x20cf21){_0x3d18d7=_0x3d18d7-0x0;var _0xb2d488=_0x76cc[_0x3d18d7];return _0xb2d488;};'use strict';module[_0xc76c('0x0')]={'DOMAIN':_0xc76c('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xc76c('0x2'),'GOOGLE_SECRET':_0xc76c('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index dd8ae24..a5cceeb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9b6=['level','toUpperCase','transports','File','%s-%s','error','info','Console','env','debugLevel','util','path','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f4a8f,_0x417748){var _0x4ca676=function(_0x530724){while(--_0x530724){_0x2f4a8f['push'](_0x2f4a8f['shift']());}};_0x4ca676(++_0x417748);}(_0xa9b6,0x69));var _0x6a9b=function(_0x2dc5cc,_0x51391c){_0x2dc5cc=_0x2dc5cc-0x0;var _0x259366=_0xa9b6[_0x2dc5cc];return _0x259366;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x6a9b('0x0'));var path=require(_0x6a9b('0x1'));var debugLevel='INFO';function filename(_0x494a97,_0x3efe33){return path['join']('/var','log','xcally',util[_0x6a9b('0x2')](_0x6a9b('0x3'),_0x494a97,_0x3efe33));}function formatter(_0x226d0e,_0x33581e){_0x33581e[_0x6a9b('0x4')]=_0x33581e[_0x6a9b('0x4')][_0x6a9b('0x5')](/@@{/g,_0x6a9b('0x6'))[_0x6a9b('0x5')](/}@@/g,'}}}')[_0x6a9b('0x5')](/@{/g,'{{')[_0x6a9b('0x5')](/}@/g,'}}');return util[_0x6a9b('0x2')](_0x6a9b('0x7'),moment()[_0x6a9b('0x2')](_0x6a9b('0x8')),_0x33581e[_0x6a9b('0x9')][_0x6a9b('0xa')](),_0x226d0e,_0x33581e[_0x6a9b('0x4')]);}module['exports']=function(_0x3e27f1){return new winston['Logger']({'transports':[new winston[(_0x6a9b('0xb'))][(_0x6a9b('0xc'))]({'name':util[_0x6a9b('0x2')](_0x6a9b('0xd'),_0x3e27f1,_0x6a9b('0xe')),'filename':filename(_0x3e27f1,_0x6a9b('0xe')),'level':_0x6a9b('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x34280d){return formatter(_0x3e27f1,_0x34280d);}}),new winston[(_0x6a9b('0xb'))]['File']({'name':util['format'](_0x6a9b('0xd'),_0x3e27f1,_0x6a9b('0xf')),'filename':filename(_0x3e27f1,_0x6a9b('0xf')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b6c06){return formatter(_0x3e27f1,_0x5b6c06);}}),new winston[(_0x6a9b('0xb'))][(_0x6a9b('0x10'))]({'level':process[_0x6a9b('0x11')][_0x6a9b('0x12')]||debugLevel,'json':![],'formatter':function(_0x46dfb0){return formatter(_0x3e27f1,_0x46dfb0);}})]});}; \ No newline at end of file +var _0x6ebf=['exports','Logger','transports','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','/var','log','xcally','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x6ebf,0x10d));var _0xf6eb=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x6ebf[_0x4c184d];return _0x23d997;};'use strict';var moment=require(_0xf6eb('0x0'));var winston=require(_0xf6eb('0x1'));var util=require(_0xf6eb('0x2'));var path=require(_0xf6eb('0x3'));var debugLevel=_0xf6eb('0x4');function filename(_0x544f26,_0x3c26fa){return path['join'](_0xf6eb('0x5'),_0xf6eb('0x6'),_0xf6eb('0x7'),util['format'](_0xf6eb('0x8'),_0x544f26,_0x3c26fa));}function formatter(_0x5c9423,_0x4de265){_0x4de265[_0xf6eb('0x9')]=_0x4de265[_0xf6eb('0x9')][_0xf6eb('0xa')](/@@{/g,_0xf6eb('0xb'))[_0xf6eb('0xa')](/}@@/g,_0xf6eb('0xc'))[_0xf6eb('0xa')](/@{/g,'{{')[_0xf6eb('0xa')](/}@/g,'}}');return util[_0xf6eb('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xf6eb('0xd')](_0xf6eb('0xe')),_0x4de265[_0xf6eb('0xf')][_0xf6eb('0x10')](),_0x5c9423,_0x4de265['message']);}module[_0xf6eb('0x11')]=function(_0x56505f){return new winston[(_0xf6eb('0x12'))]({'transports':[new winston[(_0xf6eb('0x13'))]['File']({'name':util[_0xf6eb('0xd')](_0xf6eb('0x14'),_0x56505f,_0xf6eb('0x15')),'filename':filename(_0x56505f,_0xf6eb('0x15')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x192e91){return formatter(_0x56505f,_0x192e91);}}),new winston[(_0xf6eb('0x13'))]['File']({'name':util[_0xf6eb('0xd')]('%s-%s',_0x56505f,_0xf6eb('0x16')),'filename':filename(_0x56505f,_0xf6eb('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x6ec3b){return formatter(_0x56505f,_0x6ec3b);}}),new winston[(_0xf6eb('0x13'))][(_0xf6eb('0x17'))]({'level':process[_0xf6eb('0x18')][_0xf6eb('0x19')]||debugLevel,'json':![],'formatter':function(_0x1c8218){return formatter(_0x56505f,_0x1c8218);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a07d55f..8643843 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 _0x349a=['path','join','../../services/express/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0xf7b167,_0x5ae345){var _0x57d080=function(_0x293012){while(--_0x293012){_0xf7b167['push'](_0xf7b167['shift']());}};_0x57d080(++_0x5ae345);}(_0x349a,0xd8));var _0xa349=function(_0x549ffa,_0x4011d9){_0x549ffa=_0x549ffa-0x0;var _0x378324=_0x349a[_0x549ffa];return _0x378324;};'use strict';var path=require(_0xa349('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xa349('0x1')](__dirname,_0xa349('0x2'))},{'name':'ami','script':path[_0xa349('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0xa349('0x3'),'script':path[_0xa349('0x1')](__dirname,_0xa349('0x4'))},{'name':_0xa349('0x5'),'script':path[_0xa349('0x1')](__dirname,_0xa349('0x6'))},{'name':_0xa349('0x7'),'script':path[_0xa349('0x1')](__dirname,_0xa349('0x8'))},{'name':_0xa349('0x9'),'script':path[_0xa349('0x1')](__dirname,_0xa349('0xa'))}]};module[_0xa349('0xb')]=config; \ No newline at end of file +var _0xa83f=['path','join','../../services/express/index.js','ami','agi','../../services/email/index.js','xdr','../../services/xdr/index.js'];(function(_0x4861f7,_0x2bba5f){var _0x1c2c40=function(_0xd08828){while(--_0xd08828){_0x4861f7['push'](_0x4861f7['shift']());}};_0x1c2c40(++_0x2bba5f);}(_0xa83f,0xf8));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xfa83('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xfa83('0x1')](__dirname,_0xfa83('0x2'))},{'name':_0xfa83('0x3'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xfa83('0x4'),'script':path[_0xfa83('0x1')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xfa83('0x1')](__dirname,_0xfa83('0x5'))},{'name':'routing','script':path[_0xfa83('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0xfa83('0x6'),'script':path[_0xfa83('0x1')](__dirname,_0xfa83('0x7'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 17193a0..e239963 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 _0xae35=['restart','disconnect','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','stop','then'];(function(_0x27c710,_0x5af42b){var _0x258db4=function(_0x1a8fdb){while(--_0x1a8fdb){_0x27c710['push'](_0x27c710['shift']());}};_0x258db4(++_0x5af42b);}(_0xae35,0x172));var _0x5ae3=function(_0x1d3c22,_0x3001d9){_0x1d3c22=_0x1d3c22-0x0;var _0x3256fd=_0xae35[_0x1d3c22];return _0x3256fd;};'use strict';var pm2=require(_0x5ae3('0x0'));var BPromise=require(_0x5ae3('0x1'));var config=require(_0x5ae3('0x2'));function connect(){return new BPromise(function(_0x2aae7d,_0xbc7c72){return pm2[_0x5ae3('0x3')](function(_0x2bd1c8){if(_0x2bd1c8){return _0xbc7c72(_0x2bd1c8);}return _0x2aae7d(_0x5ae3('0x4'));});});};exports['start']=function(_0x6dffe3){return connect()['then'](function(){return new BPromise(function(_0x250536,_0x2de702){return pm2['start'](_0x6dffe3,function(_0x45e748,_0x1e1d6b){if(_0x45e748){return _0x2de702(_0x45e748);}pm2['disconnect']();return _0x250536(_0x1e1d6b);});});});};exports[_0x5ae3('0x5')]=function(_0x2c91a0){return connect()[_0x5ae3('0x6')](function(){return new BPromise(function(_0x58a13c,_0x36f616){return pm2[_0x5ae3('0x5')](_0x2c91a0,function(_0x5a8f92,_0x327eba){if(_0x5a8f92){return _0x36f616(_0x5a8f92);}pm2['disconnect']();return _0x58a13c(_0x327eba);});});});};exports[_0x5ae3('0x7')]=function(_0xa04069){return connect()[_0x5ae3('0x6')](function(){return new BPromise(function(_0x344165,_0x2d0ab3){return pm2[_0x5ae3('0x7')](_0xa04069,function(_0x499f4a,_0x294df1){if(_0x499f4a){return _0x2d0ab3(_0x499f4a);}pm2[_0x5ae3('0x8')]();return _0x344165(_0x294df1);});});});};exports[_0x5ae3('0x9')]=function(){return connect()[_0x5ae3('0x6')](function(){return new BPromise(function(_0x3d80c6,_0x350dca){return pm2['list'](function(_0x7a1e92,_0x331246){if(_0x7a1e92){return _0x350dca(_0x7a1e92);}pm2[_0x5ae3('0x8')]();return _0x3d80c6(_0x331246);});});});};exports[_0x5ae3('0xa')]=function(_0x1f4fb2){return connect()[_0x5ae3('0x6')](function(){return new BPromise(function(_0x560eb4,_0x459927){return pm2['describe'](_0x1f4fb2,function(_0x34354d,_0x5e2470){if(_0x34354d){return _0x459927(_0x34354d);}pm2[_0x5ae3('0x8')]();return _0x560eb4(_0x5e2470);});});});};exports[_0x5ae3('0xb')]=function(_0x10b13a){return connect()[_0x5ae3('0x6')](function(){return new BPromise(function(_0x3b34eb,_0x27be78){return pm2[_0x5ae3('0xb')](_0x10b13a,function(_0x2852bb,_0x5e76c6){if(_0x2852bb){return _0x27be78(_0x2852bb);}pm2[_0x5ae3('0x8')]();return _0x3b34eb(_0x5e76c6);});});});};exports[_0x5ae3('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2df9fc,_0x357e35){return pm2['dump'](function(_0xafae2a){if(_0xafae2a){return _0x357e35(_0xafae2a);}return _0x2df9fc('saved');});});});}; \ No newline at end of file +var _0x647c=['./config','connect','connected','start','disconnect','then','restart','list','describe','delete','dump','saved','pm2'];(function(_0x36032d,_0x121918){var _0x2f7bc2=function(_0x1144fb){while(--_0x1144fb){_0x36032d['push'](_0x36032d['shift']());}};_0x2f7bc2(++_0x121918);}(_0x647c,0x1d3));var _0xc647=function(_0x39da12,_0x2365e3){_0x39da12=_0x39da12-0x0;var _0x3c68a3=_0x647c[_0x39da12];return _0x3c68a3;};'use strict';var pm2=require(_0xc647('0x0'));var BPromise=require('bluebird');var config=require(_0xc647('0x1'));function connect(){return new BPromise(function(_0x13de9e,_0x5193ad){return pm2[_0xc647('0x2')](function(_0x144734){if(_0x144734){return _0x5193ad(_0x144734);}return _0x13de9e(_0xc647('0x3'));});});};exports[_0xc647('0x4')]=function(_0x2719dc){return connect()['then'](function(){return new BPromise(function(_0x10f33d,_0x202fea){return pm2[_0xc647('0x4')](_0x2719dc,function(_0x22bcc1,_0x119c36){if(_0x22bcc1){return _0x202fea(_0x22bcc1);}pm2[_0xc647('0x5')]();return _0x10f33d(_0x119c36);});});});};exports['stop']=function(_0x5b91af){return connect()[_0xc647('0x6')](function(){return new BPromise(function(_0x2dd2a9,_0x4494d1){return pm2['stop'](_0x5b91af,function(_0x3ba0ca,_0x65d65c){if(_0x3ba0ca){return _0x4494d1(_0x3ba0ca);}pm2[_0xc647('0x5')]();return _0x2dd2a9(_0x65d65c);});});});};exports[_0xc647('0x7')]=function(_0x1cafe3){return connect()[_0xc647('0x6')](function(){return new BPromise(function(_0x1e2d76,_0x5bf27d){return pm2[_0xc647('0x7')](_0x1cafe3,function(_0x2a291a,_0x333ed0){if(_0x2a291a){return _0x5bf27d(_0x2a291a);}pm2[_0xc647('0x5')]();return _0x1e2d76(_0x333ed0);});});});};exports[_0xc647('0x8')]=function(){return connect()[_0xc647('0x6')](function(){return new BPromise(function(_0x37246a,_0x5209b8){return pm2['list'](function(_0x7e11a0,_0x4b57f1){if(_0x7e11a0){return _0x5209b8(_0x7e11a0);}pm2[_0xc647('0x5')]();return _0x37246a(_0x4b57f1);});});});};exports['describe']=function(_0x353831){return connect()[_0xc647('0x6')](function(){return new BPromise(function(_0x2be197,_0x5a479a){return pm2[_0xc647('0x9')](_0x353831,function(_0x79328a,_0x564f2b){if(_0x79328a){return _0x5a479a(_0x79328a);}pm2[_0xc647('0x5')]();return _0x2be197(_0x564f2b);});});});};exports[_0xc647('0xa')]=function(_0x895c9d){return connect()[_0xc647('0x6')](function(){return new BPromise(function(_0x182de4,_0x1f502b){return pm2['delete'](_0x895c9d,function(_0x4d8807,_0x105f6d){if(_0x4d8807){return _0x1f502b(_0x4d8807);}pm2[_0xc647('0x5')]();return _0x182de4(_0x105f6d);});});});};exports[_0xc647('0xb')]=function(){return connect()[_0xc647('0x6')](function(){return new BPromise(function(_0x30eba7,_0x1ac3b0){return pm2['dump'](function(_0x35b36d){if(_0x35b36d){return _0x1ac3b0(_0x35b36d);}return _0x30eba7(_0xc647('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 599c27b..5dc19f7 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 _0x92e5=['error','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','join','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update'];(function(_0x37e014,_0x311bc3){var _0x782049=function(_0x1c0ea5){while(--_0x1c0ea5){_0x37e014['push'](_0x37e014['shift']());}};_0x782049(++_0x311bc3);}(_0x92e5,0x15e));var _0x592e=function(_0x500a1c,_0x176277){_0x500a1c=_0x500a1c-0x0;var _0x351d9c=_0x92e5[_0x500a1c];return _0x351d9c;};'use strict';var _=require('lodash');var moment=require(_0x592e('0x0'));var Redis=require(_0x592e('0x1'));var util=require(_0x592e('0x2'));var config=require(_0x592e('0x3'));var db=require(_0x592e('0x4'))['db'];var logger=require(_0x592e('0x5'))(_0x592e('0x6'));config[_0x592e('0x7')]=_[_0x592e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x592e('0x9'))(new Redis(config[_0x592e('0x7')]));function closeInteractions(){var _0x318ac2=0x0;var _0x3c5c8e=[];return db[_0x592e('0xa')][_0x592e('0xb')]({'raw':!![],'attributes':['id',_0x592e('0xc')],'where':{'id':0x1}})[_0x592e('0xd')](function(_0x535ffa){_0x318ac2=_0x535ffa[_0x592e('0xc')];if(_0x318ac2){return db[_0x592e('0xe')][_0x592e('0xf')]({'raw':!![],'attributes':['id',_0x592e('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x592e('0x11')](_0x535ffa['chatTimeout'],_0x592e('0x12'))}}});}else{return[];}})[_0x592e('0xd')](function(_0x427396){if(_0x427396&&_0x427396['length']){_0x3c5c8e=_['map'](_0x427396||[],'id');logger[_0x592e('0x13')](_0x592e('0x14'),_0x3c5c8e[_0x592e('0x15')]());return db[_0x592e('0xe')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x592e('0x16')](_0x592e('0x17'))},{'where':{'id':_0x3c5c8e}});}})[_0x592e('0xd')](function(){if(_0x3c5c8e&&_0x3c5c8e['length']){logger[_0x592e('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3c5c8e['join']());for(var _0xcb15b0=0x0;_0xcb15b0<_0x3c5c8e[_0x592e('0x18')];_0xcb15b0++){io[_0x592e('0x19')](_0x592e('0x1a'),{'id':_0x3c5c8e[_0xcb15b0],'closed':!![]});}}})['catch'](function(_0x411638){logger[_0x592e('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x411638?util[_0x592e('0x1c')](_0x411638,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4892=['moment','util','../../config/environment','schedule','defaults','redis','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash'];(function(_0x215ad7,_0x1b623f){var _0x49ee05=function(_0x16e803){while(--_0x16e803){_0x215ad7['push'](_0x215ad7['shift']());}};_0x49ee05(++_0x1b623f);}(_0x4892,0x1ef));var _0x2489=function(_0x38de86,_0x3c22bf){_0x38de86=_0x38de86-0x0;var _0x3a068f=_0x4892[_0x38de86];return _0x3a068f;};'use strict';var _=require(_0x2489('0x0'));var moment=require(_0x2489('0x1'));var Redis=require('ioredis');var util=require(_0x2489('0x2'));var config=require(_0x2489('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x2489('0x4'));config['redis']=_[_0x2489('0x5')](config[_0x2489('0x6')],{'host':_0x2489('0x7'),'port':0x18eb});var io=require(_0x2489('0x8'))(new Redis(config[_0x2489('0x6')]));function closeInteractions(){var _0x290df7=0x0;var _0x216dc1=[];return db['Setting'][_0x2489('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x2489('0xa')](function(_0x36bb8d){_0x290df7=_0x36bb8d[_0x2489('0xb')];if(_0x290df7){return db[_0x2489('0xc')][_0x2489('0xd')]({'raw':!![],'attributes':['id',_0x2489('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2489('0xf')](_0x36bb8d[_0x2489('0xb')],_0x2489('0x10'))}}});}else{return[];}})['then'](function(_0x366a6a){if(_0x366a6a&&_0x366a6a[_0x2489('0x11')]){_0x216dc1=_['map'](_0x366a6a||[],'id');logger[_0x2489('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x216dc1['join']());return db[_0x2489('0xc')][_0x2489('0x13')]({'closeReason':_0x2489('0x14'),'disposition':_0x2489('0x15'),'closed':!![],'closedAt':moment()[_0x2489('0x16')](_0x2489('0x17'))},{'where':{'id':_0x216dc1}});}})[_0x2489('0xa')](function(){if(_0x216dc1&&_0x216dc1[_0x2489('0x11')]){logger[_0x2489('0x12')](_0x2489('0x18'),_0x216dc1[_0x2489('0x19')]());for(var _0x530c6e=0x0;_0x530c6e<_0x216dc1['length'];_0x530c6e++){io[_0x2489('0x1a')]('chatInteraction:update',{'id':_0x216dc1[_0x530c6e],'closed':!![]});}}})[_0x2489('0x1b')](function(_0x43e6ab){logger[_0x2489('0x1c')](_0x2489('0x1d'),_0x43e6ab?util['inspect'](_0x43e6ab,{'showHidden':![],'depth':null}):'');});}exports[_0x2489('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 4ad4d24..90a90e1 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 _0xdf8f=['run\x20job','cron','active','isBetween','startAt','endAt','add','start','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','host','port','secure','auth','user','pass','email','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','../../files/reports','savename','%s.%s','basename','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','Schedule','MailServerOut','keys','toString','keyBy','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id'];(function(_0x3fb4ec,_0x1f4934){var _0x10408d=function(_0x27f7db){while(--_0x27f7db){_0x3fb4ec['push'](_0x3fb4ec['shift']());}};_0x10408d(++_0x1f4934);}(_0xdf8f,0x158));var _0xfdf8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdf8f[_0x1cc8fe];return _0x230054;};'use strict';var fs=require('fs');var util=require(_0xfdf8('0x0'));var path=require(_0xfdf8('0x1'));var _=require(_0xfdf8('0x2'));var moment=require(_0xfdf8('0x3'));var CronJobManager=require(_0xfdf8('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xfdf8('0x5'));var logger=require(_0xfdf8('0x6'))('schedule');var db=require(_0xfdf8('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xfdf8('0x8'));var client=jayson[_0xfdf8('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x8b09c6,_0x4e1195){return function(){logger['info'](_0xfdf8('0xa'),_0x8b09c6['email']);var _0x222845=!![];var _0x1202ff={'tls':{'rejectUnauthorized':![]}};if(_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')]['service']){_0x1202ff['service']=_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')]['service'];}else{_0x1202ff[_0xfdf8('0xd')]=_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')][_0xfdf8('0xd')];_0x1202ff[_0xfdf8('0xe')]=_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')][_0xfdf8('0xe')];_0x1202ff[_0xfdf8('0xf')]=_0x8b09c6[_0xfdf8('0xb')]['Smtp'][_0xfdf8('0xf')];}if(_0x8b09c6[_0xfdf8('0xb')]['Smtp']['authentication']){_0x1202ff[_0xfdf8('0x10')]={'user':_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')][_0xfdf8('0x11')],'pass':_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')][_0xfdf8('0x12')]};}var _0x4923b1={'account':_0x1202ff,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x8b09c6[_0xfdf8('0xb')]['name'],_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0x13')]||_0x8b09c6[_0xfdf8('0xb')][_0xfdf8('0xc')][_0xfdf8('0x11')]),'to':_0x8b09c6[_0xfdf8('0x13')],'cc':_0x8b09c6['cc'],'bcc':_0x8b09c6[_0xfdf8('0x14')],'subject':util[_0xfdf8('0x15')](_0xfdf8('0x16'),_0x4e1195[_0xfdf8('0x17')],_0x8b09c6['subtractNumber'],_0x8b09c6[_0xfdf8('0x18')])}};var _0x449b25=path[_0xfdf8('0x19')](__dirname,_0xfdf8('0x1a'));var _0x37ab40=_0x4e1195[_0xfdf8('0x1b')];var _0x1d359c=util['format'](_0xfdf8('0x1c'),path[_0xfdf8('0x1d')](_0x4e1195['savename'],path['extname'](_0x4e1195['savename'])),'zip');var _0x3dcb8b=path[_0xfdf8('0x19')](_0x449b25,_0x37ab40);var _0x3660bb=path['join'](_0x449b25,_0x1d359c);if(fs[_0xfdf8('0x1e')](_0x3dcb8b)){_0x4e1195[_0xfdf8('0x1f')]=_0xfdf8('0x20');_0x4923b1[_0xfdf8('0x21')][_0xfdf8('0x22')]=[{'filename':_0x37ab40,'path':_0x3dcb8b}];_0x4923b1[_0xfdf8('0x21')][_0xfdf8('0x23')]=util[_0xfdf8('0x15')](_0xfdf8('0x24'),JSON[_0xfdf8('0x25')](_0x4e1195,null,0x2));}else if(fs[_0xfdf8('0x1e')](_0x3660bb)){_0x4e1195[_0xfdf8('0x1f')]=_0xfdf8('0x20');_0x4923b1['message'][_0xfdf8('0x22')]=[{'filename':_0x1d359c,'path':_0x3660bb}];}else{_0x4923b1[_0xfdf8('0x21')][_0xfdf8('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x8b09c6[_0xfdf8('0x26')]){_0x222845=![];logger[_0xfdf8('0x27')](_0xfdf8('0x28'));}}if(_0x222845){return client[_0xfdf8('0x29')](_0xfdf8('0x2a'),_0x4923b1)[_0xfdf8('0x2b')](function(_0x7cae5c){if(_0x7cae5c[_0xfdf8('0x2c')]){return logger[_0xfdf8('0x2c')](_0xfdf8('0x2d'),JSON['stringify'](_0x7cae5c));}return logger[_0xfdf8('0x27')](_0xfdf8('0x2e'));})['catch'](function(_0x50cf1b){return logger[_0xfdf8('0x2c')](_0xfdf8('0x2d'),JSON[_0xfdf8('0x25')](_0x50cf1b));});}};}function handleError(){return function(_0x51df79){return logger[_0xfdf8('0x2c')](JSON[_0xfdf8('0x25')](_0x51df79));};}function handleResult(_0xe2603d){return function(_0x1ebb6a){logger[_0xfdf8('0x27')]('data',JSON['stringify'](_0x1ebb6a));if(_0xe2603d['MailAccount']&&_0xe2603d[_0xfdf8('0xb')][_0xfdf8('0xc')]&&!_[_0xfdf8('0x2f')](_0xe2603d[_0xfdf8('0x13')])){setTimeout(handleSendEmail(_0xe2603d,_0x1ebb6a),0x3c*0x3e8);}};}function handleJob(_0x4eabdd){return function(){try{if(_[_0xfdf8('0x2f')](_0x4eabdd[_0xfdf8('0x30')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xfdf8('0x2f')](_0x4eabdd['subtractUnit'])){return logger[_0xfdf8('0x27')](_0xfdf8('0x31'));}var _0x9cb874={'startDate':moment()['subtract'](_0x4eabdd[_0xfdf8('0x30')],_0x4eabdd[_0xfdf8('0x18')])[_0xfdf8('0x15')](_0xfdf8('0x32')),'endDate':moment()[_0xfdf8('0x15')](_0xfdf8('0x32')),'type':'scheduled','output':_0x4eabdd[_0xfdf8('0x33')],'name':_0x4eabdd['name']};if(!_[_0xfdf8('0x2f')](_0x4eabdd[_0xfdf8('0x34')])){logger[_0xfdf8('0x27')](_0xfdf8('0x35'),_0x4eabdd[_0xfdf8('0x34')]);return analyticDefaultReportController[_0xfdf8('0x36')]({'id':_0x4eabdd[_0xfdf8('0x34')]},_0x9cb874)[_0xfdf8('0x2b')](handleResult(_0x4eabdd))[_0xfdf8('0x37')](handleError());}if(!_[_0xfdf8('0x2f')](_0x4eabdd[_0xfdf8('0x38')])){logger[_0xfdf8('0x27')]('exec\x20custom\x20report\x20id:%s',_0x4eabdd[_0xfdf8('0x38')]);return analyticCustomReportController[_0xfdf8('0x36')]({'id':_0x4eabdd[_0xfdf8('0x38')]},_0x9cb874)[_0xfdf8('0x2b')](handleResult(_0x4eabdd))['catch'](handleError());}}catch(_0x2e5a49){logger[_0xfdf8('0x2c')](JSON[_0xfdf8('0x25')](_0x2e5a49));}return logger[_0xfdf8('0x27')]('no\x20report\x20id');};}function getJobs(_0x189aec){var _0x2d6071={};if(_0x189aec){_0x2d6071['id']=_0x189aec;}return db[_0xfdf8('0x39')]['findAll']({'where':_0x2d6071,'include':[{'model':db[_0xfdf8('0xb')],'attributes':['id',_0xfdf8('0x17'),_0xfdf8('0x13')],'include':[{'model':db[_0xfdf8('0x3a')],'as':_0xfdf8('0xc')}]}]})[_0xfdf8('0x2b')](function(_0x51927e){var _0x5a6c97=_[_0xfdf8('0x3b')](manager['jobs']);var _0x22339f=_['map'](_0x51927e,function(_0xd13c4d){return _0xd13c4d['id'][_0xfdf8('0x3c')]();});var _0x23c4ad=_[_0xfdf8('0x3d')](_0x51927e,function(_0x276719){return _0x276719['id'][_0xfdf8('0x3c')]();});var _0x408e2f=_0x189aec?_0x22339f:_['difference'](_0x22339f,_0x5a6c97);var _0x1ba186=_[_0xfdf8('0x3e')](_0x22339f,_0x5a6c97);var _0x1658fe=_['difference'](_0x5a6c97,_0x22339f);var _0x83ef1f;var _0x3512c0;for(_0x83ef1f=0x0;_0x83ef1f<_0x1658fe[_0xfdf8('0x3f')]&&!_0x189aec;_0x83ef1f+=0x1){_0x3512c0=_0x1658fe[_0x83ef1f][_0xfdf8('0x3c')]();if(manager[_0xfdf8('0x40')](_0x3512c0)){manager[_0xfdf8('0x41')](_0x3512c0);manager[_0xfdf8('0x42')](_0x3512c0);logger[_0xfdf8('0x27')](_0xfdf8('0x43'),_0x3512c0);}}logger[_0xfdf8('0x27')](_0xfdf8('0x44'),JSON[_0xfdf8('0x25')](_0x408e2f));for(_0x83ef1f=0x0;_0x83ef1f<_0x408e2f[_0xfdf8('0x3f')];_0x83ef1f+=0x1){_0x3512c0=_0x408e2f[_0x83ef1f][_0xfdf8('0x3c')]();logger['info'](_0xfdf8('0x45'),_0x3512c0);if(_0x189aec){logger[_0xfdf8('0x27')](_0xfdf8('0x46'),_0x189aec);logger[_0xfdf8('0x27')](JSON[_0xfdf8('0x25')](_0x23c4ad[_0x3512c0]));BPromise['resolve']()[_0xfdf8('0x2b')](handleJob(_0x23c4ad[_0x3512c0]));logger[_0xfdf8('0x27')](_0xfdf8('0x47'),_0x23c4ad[_0x3512c0][_0xfdf8('0x17')],_0x23c4ad[_0x3512c0][_0xfdf8('0x48')]);}else if(_0x23c4ad[_0x3512c0][_0xfdf8('0x48')]&&_0x23c4ad[_0x3512c0][_0xfdf8('0x49')]&&moment()[_0xfdf8('0x4a')](_0x23c4ad[_0x3512c0][_0xfdf8('0x4b')],_0x23c4ad[_0x3512c0][_0xfdf8('0x4c')])){manager[_0xfdf8('0x4d')](_0x3512c0,_0x23c4ad[_0x3512c0]['cron'],handleJob(_0x23c4ad[_0x3512c0]));manager[_0xfdf8('0x4e')](_0x3512c0);logger['info']('add\x20cron',_0x23c4ad[_0x3512c0][_0xfdf8('0x17')],_0x23c4ad[_0x3512c0][_0xfdf8('0x48')]);}else if(manager[_0xfdf8('0x40')](_0x3512c0)){manager[_0xfdf8('0x41')](_0x3512c0);manager[_0xfdf8('0x42')](_0x3512c0);logger[_0xfdf8('0x27')]('stop\x20cron',_0x23c4ad[_0x3512c0]['name'],_0x23c4ad[_0x3512c0]['cron']);}}for(_0x83ef1f=0x0,_0x3512c0;_0x83ef1f<_0x1ba186[_0xfdf8('0x3f')]&&!_0x189aec;_0x83ef1f+=0x1){_0x3512c0=_0x1ba186[_0x83ef1f][_0xfdf8('0x3c')]();if(manager['exists'](_0x3512c0)){if(_0x23c4ad[_0x3512c0]['cron']&&_0x23c4ad[_0x3512c0][_0xfdf8('0x49')]&&moment()[_0xfdf8('0x4a')](_0x23c4ad[_0x3512c0][_0xfdf8('0x4b')],_0x23c4ad[_0x3512c0][_0xfdf8('0x4c')])){manager[_0xfdf8('0x4f')](_0x3512c0,_0x23c4ad[_0x3512c0][_0xfdf8('0x48')],handleJob(_0x23c4ad[_0x3512c0]));logger[_0xfdf8('0x27')](_0xfdf8('0x50'),_0x23c4ad[_0x3512c0][_0xfdf8('0x17')],_0x23c4ad[_0x3512c0]['cron']);}else{manager[_0xfdf8('0x41')](_0x3512c0);manager[_0xfdf8('0x42')](_0x3512c0);logger['info'](_0xfdf8('0x51'),_0x23c4ad[_0x3512c0][_0xfdf8('0x17')],_0x23c4ad[_0x3512c0][_0xfdf8('0x48')]);}}}})[_0xfdf8('0x37')](function(_0x24af3a){logger['error'](JSON[_0xfdf8('0x25')](_0x24af3a));});}exports[_0xfdf8('0x52')]=function(_0x2551e2){return getJobs(_0x2551e2);};exports[_0xfdf8('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x81ef=['service','host','port','secure','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','stringify','attachments','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','error','error\x20mail','info','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','then','no\x20report\x20id','Schedule','jobs','toString','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','index','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','exists','stop\x20cron','startAt','update','run','util','path','lodash','moment','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x81ef,0xf4));var _0xf81e=function(_0x1e0c3a,_0x14b588){_0x1e0c3a=_0x1e0c3a-0x0;var _0x34ca4e=_0x81ef[_0x1e0c3a];return _0x34ca4e;};'use strict';var fs=require('fs');var util=require(_0xf81e('0x0'));var path=require(_0xf81e('0x1'));var _=require(_0xf81e('0x2'));var moment=require(_0xf81e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xf81e('0x4'));var BPromise=require(_0xf81e('0x5'));var logger=require('../logger')(_0xf81e('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xf81e('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xf81e('0x8')][_0xf81e('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x530d37,_0x1ef18c){return function(){logger['info'](_0xf81e('0xa'),_0x530d37[_0xf81e('0xb')]);var _0x57af1e=!![];var _0x1dfa65={'tls':{'rejectUnauthorized':![]}};if(_0x530d37[_0xf81e('0xc')][_0xf81e('0xd')][_0xf81e('0xe')]){_0x1dfa65['service']=_0x530d37[_0xf81e('0xc')][_0xf81e('0xd')][_0xf81e('0xe')];}else{_0x1dfa65[_0xf81e('0xf')]=_0x530d37[_0xf81e('0xc')]['Smtp'][_0xf81e('0xf')];_0x1dfa65[_0xf81e('0x10')]=_0x530d37[_0xf81e('0xc')]['Smtp']['port'];_0x1dfa65[_0xf81e('0x11')]=_0x530d37['MailAccount'][_0xf81e('0xd')][_0xf81e('0x11')];}if(_0x530d37[_0xf81e('0xc')][_0xf81e('0xd')]['authentication']){_0x1dfa65['auth']={'user':_0x530d37[_0xf81e('0xc')][_0xf81e('0xd')]['user'],'pass':_0x530d37['MailAccount']['Smtp'][_0xf81e('0x12')]};}var _0x5f4613={'account':_0x1dfa65,'message':{'from':util[_0xf81e('0x13')](_0xf81e('0x14'),_0x530d37[_0xf81e('0xc')][_0xf81e('0x15')],_0x530d37['MailAccount'][_0xf81e('0xb')]||_0x530d37[_0xf81e('0xc')][_0xf81e('0xd')][_0xf81e('0x16')]),'to':_0x530d37[_0xf81e('0xb')],'cc':_0x530d37['cc'],'bcc':_0x530d37[_0xf81e('0x17')],'subject':util[_0xf81e('0x13')](_0xf81e('0x18'),_0x1ef18c[_0xf81e('0x15')],_0x530d37[_0xf81e('0x19')],_0x530d37[_0xf81e('0x1a')])}};var _0x201f6d=path['join'](__dirname,_0xf81e('0x1b'));var _0x39831a=_0x1ef18c[_0xf81e('0x1c')];var _0x1712b8=util['format'](_0xf81e('0x1d'),path[_0xf81e('0x1e')](_0x1ef18c[_0xf81e('0x1c')],path[_0xf81e('0x1f')](_0x1ef18c[_0xf81e('0x1c')])),_0xf81e('0x20'));var _0x57c174=path['join'](_0x201f6d,_0x39831a);var _0x3fd579=path['join'](_0x201f6d,_0x1712b8);if(fs[_0xf81e('0x21')](_0x57c174)){_0x1ef18c[_0xf81e('0x22')]=_0xf81e('0x23');_0x5f4613[_0xf81e('0x24')]['attachments']=[{'filename':_0x39831a,'path':_0x57c174}];_0x5f4613['message'][_0xf81e('0x25')]=util[_0xf81e('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xf81e('0x26')](_0x1ef18c,null,0x2));}else if(fs['existsSync'](_0x3fd579)){_0x1ef18c[_0xf81e('0x22')]=_0xf81e('0x23');_0x5f4613[_0xf81e('0x24')][_0xf81e('0x27')]=[{'filename':_0x1712b8,'path':_0x3fd579}];}else{_0x5f4613[_0xf81e('0x24')]['text']=_0xf81e('0x28');if(!_0x530d37[_0xf81e('0x29')]){_0x57af1e=![];logger['info'](_0xf81e('0x2a'));}}if(_0x57af1e){return client[_0xf81e('0x2b')](_0xf81e('0x2c'),_0x5f4613)['then'](function(_0x4cacda){if(_0x4cacda[_0xf81e('0x2d')]){return logger[_0xf81e('0x2d')](_0xf81e('0x2e'),JSON['stringify'](_0x4cacda));}return logger[_0xf81e('0x2f')]('email\x20sent');})[_0xf81e('0x30')](function(_0x54787b){return logger['error'](_0xf81e('0x2e'),JSON[_0xf81e('0x26')](_0x54787b));});}};}function handleError(){return function(_0x3e0db2){return logger[_0xf81e('0x2d')](JSON[_0xf81e('0x26')](_0x3e0db2));};}function handleResult(_0x34b81d){return function(_0x123576){logger[_0xf81e('0x2f')](_0xf81e('0x31'),JSON[_0xf81e('0x26')](_0x123576));if(_0x34b81d['MailAccount']&&_0x34b81d['MailAccount'][_0xf81e('0xd')]&&!_[_0xf81e('0x32')](_0x34b81d[_0xf81e('0xb')])){setTimeout(handleSendEmail(_0x34b81d,_0x123576),0x3c*0x3e8);}};}function handleJob(_0x310381){return function(){try{if(_['isNil'](_0x310381['subtractNumber'])){return logger[_0xf81e('0x2f')](_0xf81e('0x33'));}if(_['isNil'](_0x310381['subtractUnit'])){return logger[_0xf81e('0x2f')]('subtractUnit\x20null\x20or\x20undefined');}var _0x270636={'startDate':moment()['subtract'](_0x310381[_0xf81e('0x19')],_0x310381[_0xf81e('0x1a')])[_0xf81e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xf81e('0x34')),'type':'scheduled','output':_0x310381[_0xf81e('0x35')],'name':_0x310381[_0xf81e('0x15')]};if(!_[_0xf81e('0x32')](_0x310381[_0xf81e('0x36')])){logger[_0xf81e('0x2f')](_0xf81e('0x37'),_0x310381[_0xf81e('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x310381['DefaultReportId']},_0x270636)['then'](handleResult(_0x310381))[_0xf81e('0x30')](handleError());}if(!_['isNil'](_0x310381[_0xf81e('0x38')])){logger['info'](_0xf81e('0x39'),_0x310381[_0xf81e('0x38')]);return analyticCustomReportController[_0xf81e('0x3a')]({'id':_0x310381[_0xf81e('0x38')]},_0x270636)[_0xf81e('0x3b')](handleResult(_0x310381))[_0xf81e('0x30')](handleError());}}catch(_0x3106a2){logger['error'](JSON['stringify'](_0x3106a2));}return logger['info'](_0xf81e('0x3c'));};}function getJobs(_0x1671ae){var _0x476d3a={};if(_0x1671ae){_0x476d3a['id']=_0x1671ae;}return db[_0xf81e('0x3d')]['findAll']({'where':_0x476d3a,'include':[{'model':db[_0xf81e('0xc')],'attributes':['id',_0xf81e('0x15'),_0xf81e('0xb')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})['then'](function(_0x295a07){var _0x3c8f23=_['keys'](manager[_0xf81e('0x3e')]);var _0x3abc3b=_['map'](_0x295a07,function(_0x414afc){return _0x414afc['id'][_0xf81e('0x3f')]();});var _0x483d60=_['keyBy'](_0x295a07,function(_0xac336e){return _0xac336e['id'][_0xf81e('0x3f')]();});var _0x222900=_0x1671ae?_0x3abc3b:_[_0xf81e('0x40')](_0x3abc3b,_0x3c8f23);var _0x21c2b3=_[_0xf81e('0x41')](_0x3abc3b,_0x3c8f23);var _0x176aeb=_['difference'](_0x3c8f23,_0x3abc3b);var _0x30c705;var _0x3e0e2f;for(_0x30c705=0x0;_0x30c705<_0x176aeb['length']&&!_0x1671ae;_0x30c705+=0x1){_0x3e0e2f=_0x176aeb[_0x30c705]['toString']();if(manager['exists'](_0x3e0e2f)){manager[_0xf81e('0x42')](_0x3e0e2f);manager[_0xf81e('0x43')](_0x3e0e2f);logger[_0xf81e('0x2f')](_0xf81e('0x44'),_0x3e0e2f);}}logger[_0xf81e('0x2f')](_0xf81e('0x45'),JSON['stringify'](_0x222900));for(_0x30c705=0x0;_0x30c705<_0x222900[_0xf81e('0x46')];_0x30c705+=0x1){_0x3e0e2f=_0x222900[_0x30c705]['toString']();logger[_0xf81e('0x2f')](_0xf81e('0x47'),_0x3e0e2f);if(_0x1671ae){logger[_0xf81e('0x2f')]('my\x20id',_0x1671ae);logger[_0xf81e('0x2f')](JSON[_0xf81e('0x26')](_0x483d60[_0x3e0e2f]));BPromise[_0xf81e('0x48')]()['then'](handleJob(_0x483d60[_0x3e0e2f]));logger[_0xf81e('0x2f')](_0xf81e('0x49'),_0x483d60[_0x3e0e2f][_0xf81e('0x15')],_0x483d60[_0x3e0e2f][_0xf81e('0x4a')]);}else if(_0x483d60[_0x3e0e2f][_0xf81e('0x4a')]&&_0x483d60[_0x3e0e2f][_0xf81e('0x4b')]&&moment()[_0xf81e('0x4c')](_0x483d60[_0x3e0e2f]['startAt'],_0x483d60[_0x3e0e2f][_0xf81e('0x4d')])){manager[_0xf81e('0x4e')](_0x3e0e2f,_0x483d60[_0x3e0e2f][_0xf81e('0x4a')],handleJob(_0x483d60[_0x3e0e2f]));manager[_0xf81e('0x4f')](_0x3e0e2f);logger[_0xf81e('0x2f')](_0xf81e('0x50'),_0x483d60[_0x3e0e2f]['name'],_0x483d60[_0x3e0e2f][_0xf81e('0x4a')]);}else if(manager[_0xf81e('0x51')](_0x3e0e2f)){manager[_0xf81e('0x42')](_0x3e0e2f);manager[_0xf81e('0x43')](_0x3e0e2f);logger[_0xf81e('0x2f')](_0xf81e('0x52'),_0x483d60[_0x3e0e2f][_0xf81e('0x15')],_0x483d60[_0x3e0e2f][_0xf81e('0x4a')]);}}for(_0x30c705=0x0,_0x3e0e2f;_0x30c705<_0x21c2b3[_0xf81e('0x46')]&&!_0x1671ae;_0x30c705+=0x1){_0x3e0e2f=_0x21c2b3[_0x30c705][_0xf81e('0x3f')]();if(manager['exists'](_0x3e0e2f)){if(_0x483d60[_0x3e0e2f][_0xf81e('0x4a')]&&_0x483d60[_0x3e0e2f]['active']&&moment()[_0xf81e('0x4c')](_0x483d60[_0x3e0e2f][_0xf81e('0x53')],_0x483d60[_0x3e0e2f][_0xf81e('0x4d')])){manager[_0xf81e('0x54')](_0x3e0e2f,_0x483d60[_0x3e0e2f][_0xf81e('0x4a')],handleJob(_0x483d60[_0x3e0e2f]));logger[_0xf81e('0x2f')]('update\x20cron',_0x483d60[_0x3e0e2f]['name'],_0x483d60[_0x3e0e2f]['cron']);}else{manager[_0xf81e('0x42')](_0x3e0e2f);manager[_0xf81e('0x43')](_0x3e0e2f);logger['info']('stop\x20cron',_0x483d60[_0x3e0e2f][_0xf81e('0x15')],_0x483d60[_0x3e0e2f][_0xf81e('0x4a')]);}}}})[_0xf81e('0x30')](function(_0x3da7e2){logger['error'](JSON[_0xf81e('0x26')](_0x3da7e2));});}exports[_0xf81e('0x55')]=function(_0x2f7ac5){return getJobs(_0x2f7ac5);};exports[_0xf81e('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 8483a2f..07bc662 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 _0x303a=['bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','Cloud\x20Provider\x20not\x20available','Mixed','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','getTranscriptionJob','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x303a,0x181));var _0xa303=function(_0xf3e4a0,_0x16a172){_0xf3e4a0=_0xf3e4a0-0x0;var _0x43f1cc=_0x303a[_0xf3e4a0];return _0x43f1cc;};var _=require(_0xa303('0x0'));var AWS=require(_0xa303('0x1'));var rp=require(_0xa303('0x2'));var util=require('util');var BPromise=require(_0xa303('0x3'));var db=require(_0xa303('0x4'))['db'];var logger=require('../../config/logger')(_0xa303('0x5'));function getTranscriptionJob(_0x55ec52,_0x118239,_0x11889a,_0xc2ef93){return new Promise(function(_0x4c8d33,_0x438717){var _0x5583d0=new AWS['TranscribeService']({'accessKeyId':_0x118239,'secretAccessKey':_0x55ec52,'region':_0x11889a});_0x5583d0[_0xa303('0x6')]({'TranscriptionJobName':_0xc2ef93},function(_0x33cc2e,_0x510f9f){if(_0x33cc2e){return _0x438717(_0x33cc2e);}else{return _0x4c8d33(_0x510f9f);}});});}function sentiment(_0x2ff04c,_0x314e2d,_0x383e90,_0x34e3f3,_0x163ce6){return new Promise(function(_0x584de8,_0x2e16ee){var _0x179573=new AWS['Comprehend']({'accessKeyId':_0x314e2d,'secretAccessKey':_0x2ff04c,'region':_0x383e90});_0x179573['detectSentiment']({'Text':_0x34e3f3,'LanguageCode':_0x163ce6[_0xa303('0x7')](0x0,0x2)},function(_0x44c084,_0x3332f2){if(_0x44c084){return _0x2e16ee(_0x44c084);}else{return _0x584de8(_0x3332f2);}});});}function checkTranscribeJob(_0x574164,_0x544a09,_0x371d0f){var _0x48d6a4;return new BPromise(function(_0x51617b,_0x523c38){logger[_0xa303('0x8')](util[_0xa303('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x574164['id'],_0x574164[_0xa303('0xa')]));return getTranscriptionJob(_0x371d0f[_0xa303('0xb')],_0x371d0f[_0xa303('0xc')],_0x544a09[_0xa303('0xd')],_0x574164['transcribeName'])[_0xa303('0xe')](function(_0x229b05){logger[_0xa303('0x8')](util['format'](_0xa303('0xf'),_0x574164['id'],_0x574164[_0xa303('0xa')],_0x229b05['TranscriptionJob'][_0xa303('0x10')]));if(!_0x574164[_0xa303('0x11')]){switch(_0x229b05[_0xa303('0x12')]['TranscriptionJobStatus']){case _0xa303('0x13'):var _0xc7536e={'transcribeStatus':_0x229b05[_0xa303('0x12')]['TranscriptionJobStatus'],'fileUri':_0x229b05[_0xa303('0x12')]['Transcript']['TranscriptFileUri']};logger['info'](util[_0xa303('0x9')](_0xa303('0x14'),_0x574164['id']));return rp({'uri':_0x229b05[_0xa303('0x12')][_0xa303('0x15')][_0xa303('0x16')],'json':!![]})[_0xa303('0xe')](function(_0xdb9941){logger[_0xa303('0x8')](util[_0xa303('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x574164['id']));if(_0xdb9941&&_0xdb9941[_0xa303('0x17')]&&_0xdb9941['results'][_0xa303('0x18')]&&_0xdb9941[_0xa303('0x17')]['transcripts'][_0xa303('0x19')]){_0xc7536e['fileText']='';for(var _0x8ab13d=0x0;_0x8ab13d<_0xdb9941[_0xa303('0x17')][_0xa303('0x18')][_0xa303('0x19')];_0x8ab13d++){_0xc7536e['fileText']+=_0xdb9941[_0xa303('0x17')][_0xa303('0x18')][_0x8ab13d][_0xa303('0x1a')]+'';}}return _0x574164[_0xa303('0x1b')](_0xc7536e);})[_0xa303('0xe')](function(){logger[_0xa303('0x8')](util[_0xa303('0x9')](_0xa303('0x1c'),_0x574164['id']));if(!_0x574164[_0xa303('0x1d')]){throw new db[(_0xa303('0x1e'))][(_0xa303('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x544a09[_0xa303('0x20')]||!_0x544a09[_0xa303('0x21')]||!_0x544a09[_0xa303('0x22')]||!_0x544a09['language']||!_0x544a09[_0xa303('0x23')]){throw new db[(_0xa303('0x1e'))]['ValidationError'](_0xa303('0x24'));}if(!_0xc7536e[_0xa303('0x11')]){throw new Error(_0xa303('0x25'));}if(_0x544a09[_0xa303('0x21')]===_0x371d0f['id']){return _0x371d0f;}else{return db[_0xa303('0x26')][_0xa303('0x27')]({'where':{'id':_settings[_0xa303('0x21')]}});}})[_0xa303('0xe')](function(_0xd43956){if(!_0xd43956){throw new db[(_0xa303('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xd43956[_0xa303('0xb')]||!_0xd43956['data2']){throw new db[(_0xa303('0x1e'))][(_0xa303('0x1f'))](_0xa303('0x28'));}_0x48d6a4=_0xd43956;logger['info'](util[_0xa303('0x9')](_0xa303('0x29'),_0x574164['id']));return sentiment(_0x48d6a4['data1'],_0x48d6a4[_0xa303('0xc')],_0x544a09[_0xa303('0x22')],_0xc7536e[_0xa303('0x11')],_0x544a09['language']);})[_0xa303('0xe')](function(_0x146897){logger[_0xa303('0x8')](util[_0xa303('0x9')](_0xa303('0x2a'),_0x574164['id']));return _0x574164[_0xa303('0x1b')]({'sentiment':_0x146897[_0xa303('0x2b')],'sPositive':_0x146897['SentimentScore'][_0xa303('0x2c')],'sNegative':_0x146897[_0xa303('0x2d')][_0xa303('0x2e')],'sMixed':_0x146897[_0xa303('0x2d')]['Mixed'],'sNeutral':_0x146897[_0xa303('0x2d')][_0xa303('0x2f')]});})[_0xa303('0xe')](function(){logger[_0xa303('0x8')](util[_0xa303('0x9')](_0xa303('0x1c'),_0x574164['id']));_0x51617b();});case _0xa303('0x30'):return _0x574164[_0xa303('0x1b')]({'transcribeStatus':_0xa303('0x30'),'failureReason':_0x229b05[_0xa303('0x12')][_0xa303('0x31')]})[_0xa303('0xe')](function(){logger[_0xa303('0x8')](util[_0xa303('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x574164['id']));_0x51617b();});default:logger[_0xa303('0x8')](util['format'](_0xa303('0x32'),_0x574164['id']));break;}}else{return BPromise[_0xa303('0x33')]()[_0xa303('0xe')](function(){if(!_0x574164[_0xa303('0x1d')]){throw new db['Sequelize']['ValidationError'](_0xa303('0x34'));}if(!_0x544a09[_0xa303('0x20')]||!_0x544a09[_0xa303('0x21')]||!_0x544a09['sentimentRegion']||!_0x544a09[_0xa303('0x35')]||!_0x544a09['bucket']){throw new db[(_0xa303('0x1e'))]['ValidationError'](_0xa303('0x24'));}if(!_0x574164[_0xa303('0x11')]){throw new Error(_0xa303('0x25'));}if(_0x544a09[_0xa303('0x21')]===_0x371d0f['id']){return _0x371d0f;}else{return db['CloudProvider'][_0xa303('0x27')]({'where':{'id':_settings[_0xa303('0x21')]}});}})[_0xa303('0xe')](function(_0x12cede){if(!_0x12cede){throw new db[(_0xa303('0x1e'))][(_0xa303('0x1f'))](_0xa303('0x36'));}if(!_0x12cede[_0xa303('0xb')]||!_0x12cede[_0xa303('0xc')]){throw new db[(_0xa303('0x1e'))]['ValidationError'](_0xa303('0x28'));}_0x48d6a4=_0x12cede;logger['info'](util[_0xa303('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x574164['id']));return sentiment(_0x48d6a4[_0xa303('0xb')],_0x48d6a4[_0xa303('0xc')],_0x544a09[_0xa303('0x22')],_0x574164[_0xa303('0x11')],_0x544a09[_0xa303('0x35')]);})[_0xa303('0xe')](function(_0x561fe7){logger[_0xa303('0x8')](util[_0xa303('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x574164['id']));return _0x574164[_0xa303('0x1b')]({'sentiment':_0x561fe7[_0xa303('0x2b')],'sPositive':_0x561fe7['SentimentScore'][_0xa303('0x2c')],'sNegative':_0x561fe7[_0xa303('0x2d')][_0xa303('0x2e')],'sMixed':_0x561fe7[_0xa303('0x2d')][_0xa303('0x37')],'sNeutral':_0x561fe7['SentimentScore']['Neutral'],'transcribeStatus':_0xa303('0x13')});})[_0xa303('0xe')](function(){logger[_0xa303('0x8')](util[_0xa303('0x9')](_0xa303('0x1c'),_0x574164['id']));_0x51617b();});}})[_0xa303('0x38')](function(_0x4a33f3){if(_0x4a33f3){if(!_0x4a33f3[_0xa303('0x39')]||_0x4a33f3[_0xa303('0x39')]!=='SequelizeValidationError'){logger[_0xa303('0x3a')](util[_0xa303('0x9')](_0xa303('0x3b'),_0x574164['id']),util[_0xa303('0x3c')](_0x4a33f3,{'showHidden':![],'depth':null}));}}_0x51617b();});});}function checkTranscribe(){var _0xff7916;var _0x44c525;var _0x756ecc;return db[_0xa303('0x3d')]['findAll']({'where':{'transcribeStatus':_0xa303('0x3e')}})[_0xa303('0xe')](function(_0x53ec14){if(!_0x53ec14||!_0x53ec14[_0xa303('0x19')]){throw new db['Sequelize'][(_0xa303('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0xff7916=_0x53ec14;return db[_0xa303('0x3f')][_0xa303('0x27')]({'where':{'id':0x1}});})[_0xa303('0xe')](function(_0x445678){if(!_0x445678){throw new db[(_0xa303('0x1e'))][(_0xa303('0x1f'))](_0xa303('0x40'));}_0x44c525=_0x445678;if(!_0x44c525[_0xa303('0x5')]||!_0x44c525['transcribeAccountId']||!_0x44c525['transcribeRegion']||!_0x44c525['language']||!_0x44c525[_0xa303('0x23')]){throw new db[(_0xa303('0x1e'))][(_0xa303('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0xa303('0x26')][_0xa303('0x27')]({'where':{'id':_0x44c525[_0xa303('0x41')]}});})[_0xa303('0xe')](function(_0x3f0494){if(!_0x3f0494){throw new db[(_0xa303('0x1e'))][(_0xa303('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3f0494['data1']||!_0x3f0494[_0xa303('0xc')]){throw new db[(_0xa303('0x1e'))]['ValidationError'](_0xa303('0x28'));}_0x756ecc=_0x3f0494;var _0x4b14ea=[];_0xff7916[_0xa303('0x42')](function(_0x25d19f){_0x4b14ea[_0xa303('0x43')](checkTranscribeJob(_0x25d19f,_0x44c525,_0x756ecc));});return BPromise['all'](_0x4b14ea);})[_0xa303('0x38')](function(_0x4b1e01){if(_0x4b1e01){if(!_0x4b1e01['name']||_0x4b1e01[_0xa303('0x39')]!==_0xa303('0x44')){logger[_0xa303('0x3a')](util[_0xa303('0x3c')](_0x4b1e01,{'showHidden':![],'depth':null}));}}});}exports[_0xa303('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9ce9=['Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','CloudProvider','Sentiment','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','SequelizeValidationError','inspect','start','lodash','aws-sdk','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne'];(function(_0x460083,_0x53c426){var _0x1083a3=function(_0x4f5319){while(--_0x4f5319){_0x460083['push'](_0x460083['shift']());}};_0x1083a3(++_0x53c426);}(_0x9ce9,0xa9));var _0x99ce=function(_0x3a7b43,_0x1d0b10){_0x3a7b43=_0x3a7b43-0x0;var _0x4414df=_0x9ce9[_0x3a7b43];return _0x4414df;};var _=require(_0x99ce('0x0'));var AWS=require(_0x99ce('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0x99ce('0x2'));var db=require(_0x99ce('0x3'))['db'];var logger=require(_0x99ce('0x4'))(_0x99ce('0x5'));function getTranscriptionJob(_0x56b2f8,_0x314b87,_0x28884e,_0xed60bd){return new Promise(function(_0x4b7b0f,_0x320b4f){var _0x54f090=new AWS[(_0x99ce('0x6'))]({'accessKeyId':_0x314b87,'secretAccessKey':_0x56b2f8,'region':_0x28884e});_0x54f090[_0x99ce('0x7')]({'TranscriptionJobName':_0xed60bd},function(_0x39fb9b,_0x5c464e){if(_0x39fb9b){return _0x320b4f(_0x39fb9b);}else{return _0x4b7b0f(_0x5c464e);}});});}function sentiment(_0x4a5520,_0x41acfe,_0x18b681,_0x3d5fc5,_0x3974ab){return new Promise(function(_0x11a1e1,_0x4334bb){var _0x5ebebf=new AWS[(_0x99ce('0x8'))]({'accessKeyId':_0x41acfe,'secretAccessKey':_0x4a5520,'region':_0x18b681});_0x5ebebf[_0x99ce('0x9')]({'Text':_0x3d5fc5,'LanguageCode':_0x3974ab[_0x99ce('0xa')](0x0,0x2)},function(_0xa91075,_0x4209c0){if(_0xa91075){return _0x4334bb(_0xa91075);}else{return _0x11a1e1(_0x4209c0);}});});}function checkTranscribeJob(_0x3ccc08,_0x24499b,_0x33d6ac){var _0x30fe85;return new BPromise(function(_0x312aac,_0x4aa917){logger['info'](util[_0x99ce('0xb')](_0x99ce('0xc'),_0x3ccc08['id'],_0x3ccc08[_0x99ce('0xd')]));return getTranscriptionJob(_0x33d6ac['data1'],_0x33d6ac[_0x99ce('0xe')],_0x24499b[_0x99ce('0xf')],_0x3ccc08[_0x99ce('0xd')])[_0x99ce('0x10')](function(_0x434645){logger[_0x99ce('0x11')](util['format'](_0x99ce('0x12'),_0x3ccc08['id'],_0x3ccc08['transcribeName'],_0x434645['TranscriptionJob'][_0x99ce('0x13')]));if(!_0x3ccc08[_0x99ce('0x14')]){switch(_0x434645[_0x99ce('0x15')][_0x99ce('0x13')]){case _0x99ce('0x16'):var _0x4a87f3={'transcribeStatus':_0x434645['TranscriptionJob'][_0x99ce('0x13')],'fileUri':_0x434645[_0x99ce('0x15')][_0x99ce('0x17')][_0x99ce('0x18')]};logger[_0x99ce('0x11')](util[_0x99ce('0xb')](_0x99ce('0x19'),_0x3ccc08['id']));return rp({'uri':_0x434645[_0x99ce('0x15')]['Transcript'][_0x99ce('0x18')],'json':!![]})[_0x99ce('0x10')](function(_0x10abc4){logger[_0x99ce('0x11')](util['format'](_0x99ce('0x1a'),_0x3ccc08['id']));if(_0x10abc4&&_0x10abc4[_0x99ce('0x1b')]&&_0x10abc4[_0x99ce('0x1b')][_0x99ce('0x1c')]&&_0x10abc4[_0x99ce('0x1b')][_0x99ce('0x1c')][_0x99ce('0x1d')]){_0x4a87f3[_0x99ce('0x14')]='';for(var _0x90a865=0x0;_0x90a865<_0x10abc4[_0x99ce('0x1b')][_0x99ce('0x1c')][_0x99ce('0x1d')];_0x90a865++){_0x4a87f3['fileText']+=_0x10abc4['results'][_0x99ce('0x1c')][_0x90a865]['transcript']+'';}}return _0x3ccc08[_0x99ce('0x1e')](_0x4a87f3);})['then'](function(){logger[_0x99ce('0x11')](util['format'](_0x99ce('0x1f'),_0x3ccc08['id']));if(!_0x3ccc08[_0x99ce('0x20')]){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x23'));}if(!_0x24499b[_0x99ce('0x24')]||!_0x24499b[_0x99ce('0x25')]||!_0x24499b[_0x99ce('0x26')]||!_0x24499b[_0x99ce('0x27')]||!_0x24499b[_0x99ce('0x28')]){throw new db['Sequelize'][(_0x99ce('0x22'))](_0x99ce('0x29'));}if(!_0x4a87f3[_0x99ce('0x14')]){throw new Error(_0x99ce('0x2a'));}if(_0x24499b[_0x99ce('0x25')]===_0x33d6ac['id']){return _0x33d6ac;}else{return db['CloudProvider'][_0x99ce('0x2b')]({'where':{'id':_settings[_0x99ce('0x25')]}});}})[_0x99ce('0x10')](function(_0x2d5f3d){if(!_0x2d5f3d){throw new db['Sequelize'][(_0x99ce('0x22'))](_0x99ce('0x2c'));}if(!_0x2d5f3d[_0x99ce('0x2d')]||!_0x2d5f3d['data2']){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x2e'));}_0x30fe85=_0x2d5f3d;logger[_0x99ce('0x11')](util[_0x99ce('0xb')](_0x99ce('0x2f'),_0x3ccc08['id']));return sentiment(_0x30fe85[_0x99ce('0x2d')],_0x30fe85['data2'],_0x24499b[_0x99ce('0x26')],_0x4a87f3[_0x99ce('0x14')],_0x24499b[_0x99ce('0x27')]);})[_0x99ce('0x10')](function(_0x8c9de9){logger[_0x99ce('0x11')](util[_0x99ce('0xb')](_0x99ce('0x30'),_0x3ccc08['id']));return _0x3ccc08['update']({'sentiment':_0x8c9de9['Sentiment'],'sPositive':_0x8c9de9[_0x99ce('0x31')]['Positive'],'sNegative':_0x8c9de9[_0x99ce('0x31')][_0x99ce('0x32')],'sMixed':_0x8c9de9[_0x99ce('0x31')][_0x99ce('0x33')],'sNeutral':_0x8c9de9[_0x99ce('0x31')][_0x99ce('0x34')]});})['then'](function(){logger['info'](util[_0x99ce('0xb')](_0x99ce('0x1f'),_0x3ccc08['id']));_0x312aac();});case _0x99ce('0x35'):return _0x3ccc08[_0x99ce('0x1e')]({'transcribeStatus':_0x99ce('0x35'),'failureReason':_0x434645[_0x99ce('0x15')][_0x99ce('0x36')]})[_0x99ce('0x10')](function(){logger[_0x99ce('0x11')](util[_0x99ce('0xb')](_0x99ce('0x1f'),_0x3ccc08['id']));_0x312aac();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3ccc08['id']));break;}}else{return BPromise[_0x99ce('0x37')]()['then'](function(){if(!_0x3ccc08[_0x99ce('0x20')]){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x23'));}if(!_0x24499b[_0x99ce('0x24')]||!_0x24499b[_0x99ce('0x25')]||!_0x24499b[_0x99ce('0x26')]||!_0x24499b[_0x99ce('0x27')]||!_0x24499b[_0x99ce('0x28')]){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x29'));}if(!_0x3ccc08['fileText']){throw new Error(_0x99ce('0x2a'));}if(_0x24499b['sentimentAccountId']===_0x33d6ac['id']){return _0x33d6ac;}else{return db[_0x99ce('0x38')][_0x99ce('0x2b')]({'where':{'id':_settings[_0x99ce('0x25')]}});}})['then'](function(_0x5a3985){if(!_0x5a3985){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x2c'));}if(!_0x5a3985['data1']||!_0x5a3985[_0x99ce('0xe')]){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x30fe85=_0x5a3985;logger['info'](util[_0x99ce('0xb')](_0x99ce('0x2f'),_0x3ccc08['id']));return sentiment(_0x30fe85[_0x99ce('0x2d')],_0x30fe85[_0x99ce('0xe')],_0x24499b['sentimentRegion'],_0x3ccc08[_0x99ce('0x14')],_0x24499b[_0x99ce('0x27')]);})['then'](function(_0x24af3e){logger[_0x99ce('0x11')](util[_0x99ce('0xb')](_0x99ce('0x30'),_0x3ccc08['id']));return _0x3ccc08[_0x99ce('0x1e')]({'sentiment':_0x24af3e[_0x99ce('0x39')],'sPositive':_0x24af3e[_0x99ce('0x31')]['Positive'],'sNegative':_0x24af3e['SentimentScore'][_0x99ce('0x32')],'sMixed':_0x24af3e['SentimentScore']['Mixed'],'sNeutral':_0x24af3e['SentimentScore'][_0x99ce('0x34')],'transcribeStatus':'COMPLETED'});})[_0x99ce('0x10')](function(){logger['info'](util[_0x99ce('0xb')](_0x99ce('0x1f'),_0x3ccc08['id']));_0x312aac();});}})[_0x99ce('0x3a')](function(_0x3704ca){if(_0x3704ca){if(!_0x3704ca['name']||_0x3704ca[_0x99ce('0x3b')]!=='SequelizeValidationError'){logger[_0x99ce('0x3c')](util[_0x99ce('0xb')](_0x99ce('0x3d'),_0x3ccc08['id']),util['inspect'](_0x3704ca,{'showHidden':![],'depth':null}));}}_0x312aac();});});}function checkTranscribe(){var _0x351a7d;var _0x52da39;var _0x24c234;return db['VoiceRecording'][_0x99ce('0x3e')]({'where':{'transcribeStatus':_0x99ce('0x3f')}})[_0x99ce('0x10')](function(_0xaa20b4){if(!_0xaa20b4||!_0xaa20b4[_0x99ce('0x1d')]){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x40'));}_0x351a7d=_0xaa20b4;return db[_0x99ce('0x41')][_0x99ce('0x2b')]({'where':{'id':0x1}});})['then'](function(_0x3660e2){if(!_0x3660e2){throw new db['Sequelize'][(_0x99ce('0x22'))]('Settings\x20not\x20available');}_0x52da39=_0x3660e2;if(!_0x52da39[_0x99ce('0x5')]||!_0x52da39[_0x99ce('0x42')]||!_0x52da39[_0x99ce('0xf')]||!_0x52da39[_0x99ce('0x27')]||!_0x52da39['bucket']){throw new db['Sequelize']['ValidationError'](_0x99ce('0x43'));}return db[_0x99ce('0x38')]['findOne']({'where':{'id':_0x52da39[_0x99ce('0x42')]}});})[_0x99ce('0x10')](function(_0x152e76){if(!_0x152e76){throw new db['Sequelize'][(_0x99ce('0x22'))](_0x99ce('0x2c'));}if(!_0x152e76[_0x99ce('0x2d')]||!_0x152e76[_0x99ce('0xe')]){throw new db[(_0x99ce('0x21'))][(_0x99ce('0x22'))](_0x99ce('0x2e'));}_0x24c234=_0x152e76;var _0x260942=[];_0x351a7d['forEach'](function(_0x53b9b3){_0x260942['push'](checkTranscribeJob(_0x53b9b3,_0x52da39,_0x24c234));});return BPromise['all'](_0x260942);})['catch'](function(_0x16ff58){if(_0x16ff58){if(!_0x16ff58[_0x99ce('0x3b')]||_0x16ff58[_0x99ce('0x3b')]!==_0x99ce('0x44')){logger[_0x99ce('0x3c')](util[_0x99ce('0x45')](_0x16ff58,{'showHidden':![],'depth':null}));}}});}exports[_0x99ce('0x46')]=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 6a09030..01edfa3 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 _0x9e48=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length'];(function(_0x38dfb1,_0x316c70){var _0x281238=function(_0x2e3526){while(--_0x2e3526){_0x38dfb1['push'](_0x38dfb1['shift']());}};_0x281238(++_0x316c70);}(_0x9e48,0x1eb));var _0x89e4=function(_0x171c42,_0x47b642){_0x171c42=_0x171c42-0x0;var _0x370534=_0x9e48[_0x171c42];return _0x370534;};'use strict';var _=require(_0x89e4('0x0'));var moment=require('moment');var Redis=require(_0x89e4('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x89e4('0x2'))['db'];var logger=require('../logger')(_0x89e4('0x3'));config[_0x89e4('0x4')]=_[_0x89e4('0x5')](config[_0x89e4('0x4')],{'host':_0x89e4('0x6'),'port':0x18eb});var io=require(_0x89e4('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0xadfcc5=[];return db[_0x89e4('0x8')][_0x89e4('0x9')]({'raw':!![],'attributes':['id',_0x89e4('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x89e4('0xb')](0x18,'hours')}}})['then'](function(_0x593ea5){if(_0x593ea5&&_0x593ea5[_0x89e4('0xc')]){_0xadfcc5=_['map'](_0x593ea5||[],'id');logger[_0x89e4('0xd')](_0x89e4('0xe'),_0xadfcc5[_0x89e4('0xf')]());return db[_0x89e4('0x8')][_0x89e4('0x10')]({'closeReason':'system','disposition':_0x89e4('0x11'),'closed':!![],'closedAt':moment()['format'](_0x89e4('0x12'))},{'where':{'id':_0xadfcc5}});}})[_0x89e4('0x13')](function(){if(_0xadfcc5&&_0xadfcc5[_0x89e4('0xc')]){logger[_0x89e4('0xd')](_0x89e4('0x14'),_0xadfcc5[_0x89e4('0xf')]());for(var _0x13bc69=0x0;_0x13bc69<_0xadfcc5[_0x89e4('0xc')];_0x13bc69++){io[_0x89e4('0x15')](_0x89e4('0x16'),{'id':_0xadfcc5[_0x13bc69],'closed':!![]});}}})[_0x89e4('0x17')](function(_0x2552d4){logger[_0x89e4('0x18')](_0x89e4('0x19'),_0x2552d4?util[_0x89e4('0x1a')](_0x2552d4,{'showHidden':![],'depth':null}):'');});}exports[_0x89e4('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x633d=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','map','join','WhatsappInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error'];(function(_0x4c1520,_0x4584e0){var _0x21a80a=function(_0x4648d3){while(--_0x4648d3){_0x4c1520['push'](_0x4c1520['shift']());}};_0x21a80a(++_0x4584e0);}(_0x633d,0xfe));var _0xd633=function(_0x23607f,_0x51db51){_0x23607f=_0x23607f-0x0;var _0x5a5be0=_0x633d[_0x23607f];return _0x5a5be0;};'use strict';var _=require(_0xd633('0x0'));var moment=require('moment');var Redis=require(_0xd633('0x1'));var util=require(_0xd633('0x2'));var config=require('../../config/environment');var db=require(_0xd633('0x3'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xd633('0x4')](config[_0xd633('0x5')],{'host':_0xd633('0x6'),'port':0x18eb});var io=require(_0xd633('0x7'))(new Redis(config[_0xd633('0x5')]));function closeInteractions(){var _0x19b225=[];return db['WhatsappInteraction'][_0xd633('0x8')]({'raw':!![],'attributes':['id',_0xd633('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd633('0xa')](0x18,_0xd633('0xb'))}}})['then'](function(_0xa3c8bf){if(_0xa3c8bf&&_0xa3c8bf['length']){_0x19b225=_[_0xd633('0xc')](_0xa3c8bf||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x19b225[_0xd633('0xd')]());return db[_0xd633('0xe')][_0xd633('0xf')]({'closeReason':_0xd633('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xd633('0x11')](_0xd633('0x12'))},{'where':{'id':_0x19b225}});}})[_0xd633('0x13')](function(){if(_0x19b225&&_0x19b225[_0xd633('0x14')]){logger[_0xd633('0x15')](_0xd633('0x16'),_0x19b225['join']());for(var _0xd0e3=0x0;_0xd0e3<_0x19b225['length'];_0xd0e3++){io[_0xd633('0x17')](_0xd633('0x18'),{'id':_0x19b225[_0xd0e3],'closed':!![]});}}})['catch'](function(_0x28eeda){logger[_0xd633('0x19')](_0xd633('0x1a'),_0x28eeda?util[_0xd633('0x1b')](_0x28eeda,{'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/seedContact.js b/server/config/seedContact.js index 1bafc14..2c234a3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9587=['CmContact','destroy','bulkCreate','finished\x20populating','contacts1','CmHopper','then','log','hopper1','contacts2','hopper2','../mysqldb','Biondo','@xcally.com','push','now','Innocenzo','innocenzo.biondo'];(function(_0xddacca,_0x39e415){var _0x83bf91=function(_0x4a9b3d){while(--_0x4a9b3d){_0xddacca['push'](_0xddacca['shift']());}};_0x83bf91(++_0x39e415);}(_0x9587,0x161));var _0x7958=function(_0x1a8469,_0x2ffccf){_0x1a8469=_0x1a8469-0x0;var _0x19c2dd=_0x9587[_0x1a8469];return _0x19c2dd;};'use strict';var util=require('util');var db=require(_0x7958('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7958('0x1')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7958('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7958('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x7958('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7958('0x4')](),'updatedAt':Date[_0x7958('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7958('0x3')]({'id':i,'firstName':_0x7958('0x5')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7958('0x6')+i+_0x7958('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7958('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x7958('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7958('0x4')](),'updatedAt':Date[_0x7958('0x4')]()});}db[_0x7958('0x7')][_0x7958('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0x7958('0x9')](contacts);})['then'](function(){console['log'](_0x7958('0xa'),_0x7958('0xb'));return db[_0x7958('0xc')][_0x7958('0x8')]({'where':{}});})[_0x7958('0xd')](function(){return db[_0x7958('0xc')][_0x7958('0x9')](hopper);})[_0x7958('0xd')](function(){console[_0x7958('0xe')](_0x7958('0xa'),_0x7958('0xf'));return db[_0x7958('0x7')][_0x7958('0x9')](contacts2);})[_0x7958('0xd')](function(){console[_0x7958('0xe')](_0x7958('0xa'),_0x7958('0x10'));return db['CmHopper'][_0x7958('0x9')](hopper2);})[_0x7958('0xd')](function(){console['log'](_0x7958('0xa'),_0x7958('0x11'));})['catch'](function(_0x1c3907){console['log'](_0x1c3907);}); \ No newline at end of file +var _0x56ce=['catch','util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2'];(function(_0x2b6c43,_0xae9a0c){var _0x1d770a=function(_0x3e94bd){while(--_0x3e94bd){_0x2b6c43['push'](_0x2b6c43['shift']());}};_0x1d770a(++_0xae9a0c);}(_0x56ce,0xd9));var _0xe56c=function(_0x2d2b68,_0x2f8dbe){_0x2d2b68=_0x2d2b68-0x0;var _0x3d2baf=_0x56ce[_0x2d2b68];return _0x3d2baf;};'use strict';var util=require(_0xe56c('0x0'));var db=require(_0xe56c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe56c('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe56c('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe56c('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe56c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe56c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xe56c('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe56c('0x2')]({'id':i,'firstName':_0xe56c('0x6')+i,'lastName':_0xe56c('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe56c('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe56c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe56c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe56c('0x5')](),'updatedAt':Date[_0xe56c('0x5')]()});}db[_0xe56c('0x7')][_0xe56c('0x8')]({'where':{}})['then'](function(){return db[_0xe56c('0x7')][_0xe56c('0x9')](contacts);})[_0xe56c('0xa')](function(){console[_0xe56c('0xb')](_0xe56c('0xc'),_0xe56c('0xd'));return db['CmHopper'][_0xe56c('0x8')]({'where':{}});})[_0xe56c('0xa')](function(){return db[_0xe56c('0xe')][_0xe56c('0x9')](hopper);})['then'](function(){console['log']('finished\x20populating','hopper1');return db[_0xe56c('0x7')]['bulkCreate'](contacts2);})[_0xe56c('0xa')](function(){console['log'](_0xe56c('0xc'),_0xe56c('0xf'));return db[_0xe56c('0xe')][_0xe56c('0x9')](hopper2);})[_0xe56c('0xa')](function(){console[_0xe56c('0xb')](_0xe56c('0xc'),_0xe56c('0x10'));})[_0xe56c('0x11')](function(_0x1f2650){console[_0xe56c('0xb')](_0x1f2650);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 13d4c4f..0e62b6c 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc83c=['/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','log','catch','util','push','format','%s%s','agent','password','friend','wss','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x38acf5,_0x4dc953){var _0x359468=function(_0x15d0c1){while(--_0x15d0c1){_0x38acf5['push'](_0x38acf5['shift']());}};_0x359468(++_0x4dc953);}(_0xc83c,0x66));var _0xcc83=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xc83c[_0x5f519b];return _0x2461e2;};'use strict';var util=require(_0xcc83('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcc83('0x1')]({'name':util[_0xcc83('0x2')](_0xcc83('0x3'),_0xcc83('0x4'),i),'fullname':util[_0xcc83('0x2')]('%s%s','agent',i),'email':util[_0xcc83('0x2')]('%s%s@xcally.com',_0xcc83('0x4'),i),'role':_0xcc83('0x4'),'password':_0xcc83('0x5'),'internal':0xfa0+i,'type':_0xcc83('0x6'),'transport':['udp','ws',_0xcc83('0x7')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0xcc83('0x2')]('%s%s',_0xcc83('0x4'),i),'encryption':_0xcc83('0x8'),'avpf':_0xcc83('0x8'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xcc83('0x8'),'dtlsverify':'no','dtlscertfile':_0xcc83('0x9'),'dtlsprivatekey':_0xcc83('0xa'),'dtlssetup':_0xcc83('0xb'),'callerid':util[_0xcc83('0x2')]('\x22%s\x22\x20<%s>',util[_0xcc83('0x2')](_0xcc83('0x3'),'agent',i),0xfa0+i)});}db[_0xcc83('0xc')][_0xcc83('0xd')](users)['then'](function(){console[_0xcc83('0xe')]('add\x20user');})[_0xcc83('0xf')](function(_0x3250f2){console[_0xcc83('0xe')](_0x3250f2);}); \ No newline at end of file +var _0xd718=['/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','util','push','%s%s','agent','format','%s%s@xcally.com','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x940764,_0xa2717){var _0x121b0f=function(_0x4a7822){while(--_0x4a7822){_0x940764['push'](_0x940764['shift']());}};_0x121b0f(++_0xa2717);}(_0xd718,0xb2));var _0x8d71=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xd718[_0x479160];return _0x47ac6d;};'use strict';var util=require(_0x8d71('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8d71('0x1')]({'name':util['format'](_0x8d71('0x2'),_0x8d71('0x3'),i),'fullname':util[_0x8d71('0x4')](_0x8d71('0x2'),_0x8d71('0x3'),i),'email':util[_0x8d71('0x4')](_0x8d71('0x5'),'agent',i),'role':_0x8d71('0x3'),'password':_0x8d71('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x8d71('0x7'),'ws','wss'],'disallow':[_0x8d71('0x8')],'allow':[_0x8d71('0x9')],'defaultuser':util['format'](_0x8d71('0x2'),_0x8d71('0x3'),i),'encryption':'yes','avpf':'yes','force_avp':'yes','icesupport':_0x8d71('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x8d71('0xb'),'dtlsprivatekey':_0x8d71('0xc'),'dtlssetup':_0x8d71('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x8d71('0x2'),'agent',i),0xfa0+i)});}db[_0x8d71('0xe')]['bulkCreate'](users)[_0x8d71('0xf')](function(){console[_0x8d71('0x10')](_0x8d71('0x11'));})[_0x8d71('0x12')](function(_0xa1cc00){console[_0x8d71('0x10')](_0xa1cc00);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b6a48c9..8d6f614 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a88=['FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','then','Campaign','ivr','format','%s:queue:%s','length','user:%s','query','find','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','voice:inbound','userProfileId','FaxQueue','Telephones','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','emit','user_has_chat_interactions:remove','MailInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','setMaxListeners','address','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','util','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','autoAssociation','VoiceQueues','ChatQueues'];(function(_0x3a5538,_0x227759){var _0x54497c=function(_0x217dd6){while(--_0x217dd6){_0x3a5538['push'](_0x3a5538['shift']());}};_0x54497c(++_0x227759);}(_0x6a88,0x107));var _0x86a8=function(_0x30f897,_0x37455e){_0x30f897=_0x30f897-0x0;var _0x40bfff=_0x6a88[_0x30f897];return _0x40bfff;};'use strict';var _=require('lodash');var util=require(_0x86a8('0x0'));var BPromise=require(_0x86a8('0x1'));var db=require(_0x86a8('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x86a8('0x3')],'include':[{'as':_0x86a8('0x4'),'model':db[_0x86a8('0x5')],'attributes':['id',_0x86a8('0x3'),_0x86a8('0x6')],'raw':!![],'where':{'role':_0x86a8('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x86a8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x86a8('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x86a8('0x3')],'where':{'role':_0x86a8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x86a8('0x3'),_0x86a8('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x56aea5,_0x2dff01,_0x542f00){return db['UserProfileSection']['findOne']({'where':{'name':_0x56aea5,'userProfileId':_0x2dff01},'raw':!![]})['then'](function(_0x192af3){if(_0x192af3){if(_0x192af3[_0x86a8('0xa')]){switch(_0x56aea5){case _0x86a8('0xb'):case _0x86a8('0xc'):case _0x86a8('0xd'):case _0x86a8('0xe'):case _0x86a8('0xf'):case _0x86a8('0x10'):case _0x86a8('0x11'):return db[_0x542f00][_0x86a8('0x12')](queryQueues);case'Telephones':return db[_0x542f00][_0x86a8('0x12')](queryTelephones);case _0x86a8('0x13'):return db[_0x542f00][_0x86a8('0x12')](queryTrunks);case _0x86a8('0x14'):return db[_0x542f00][_0x86a8('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x86a8('0x12')]({'attributes':[_0x86a8('0x15')],'where':{'sectionId':_0x192af3['id']},'raw':!![]})[_0x86a8('0x16')](function(_0x53fda5){if(_0x53fda5){var _0x503d09={'where':{'id':_['map'](_0x53fda5,'resourceId')},'raw':!![]};switch(_0x542f00){case _0x86a8('0x5'):_0x503d09['where']['role']=_0x86a8('0x8');break;case _0x86a8('0x17'):_0x503d09['where']['type']=_0x86a8('0x18');break;}return db[_0x542f00]['findAll'](_0x503d09);}else{return[];}});}}else{return[];}})['then'](function(_0x19f02b){return _0x19f02b;});}function joinOrLeaveQueues(_0x164b83,_0x28db44,_0x346a62,_0xea2361){_0x164b83[_0x28db44](util[_0x86a8('0x19')](_0x86a8('0x1a'),_0x346a62,_0xea2361[_0x86a8('0x3')]));if(_0xea2361[_0x86a8('0x4')]){for(var _0x3e9d8a=0x0;_0x3e9d8a<_0xea2361[_0x86a8('0x4')][_0x86a8('0x1b')];_0x3e9d8a+=0x1){_0x164b83[_0x28db44](util[_0x86a8('0x19')](_0x86a8('0x1c'),_0xea2361[_0x86a8('0x4')][_0x3e9d8a][_0x86a8('0x3')]));}}}function joinOrLeave(_0x38b7ed,_0x36de30,_0x1cb0a5){var _0x971815;if(_0x38b7ed['handshake'][_0x86a8('0x1d')]['id']){db['User'][_0x86a8('0x1e')]({'attributes':['id',_0x86a8('0x3'),_0x86a8('0x6'),'userProfileId'],'where':{'id':_0x38b7ed['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x86a8('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x86a8('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x86a8('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x86a8('0x22')],'as':_0x86a8('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x86a8('0x24')],'as':_0x86a8('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x86a8('0x26')],'as':_0x86a8('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x61d14c){if(_0x61d14c){_0x971815=_0x61d14c;_0x38b7ed[_0x36de30](util['format'](_0x86a8('0x1c'),_0x61d14c[_0x86a8('0x3')]));var _0x512459=[];switch(_0x61d14c['role']){case _0x86a8('0x28'):_0x38b7ed[_0x36de30]('voice:inbound');_0x38b7ed[_0x36de30](_0x86a8('0x29'));if(queryQueues[_0x86a8('0x2a')](_0x86a8('0x2b'))){delete queryQueues['include'];}_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x2d')][_0x86a8('0x12')](queryQueues));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x2e')][_0x86a8('0x12')](queryQueues));_0x512459[_0x86a8('0x2c')](db['FaxQueue'][_0x86a8('0x12')](queryQueues));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x2f')]['findAll'](queryQueues));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x30')][_0x86a8('0x12')](queryQueues));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x31')][_0x86a8('0x12')](queryQueues));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x32')][_0x86a8('0x12')](queryQueues));_0x512459['push'](db[_0x86a8('0x5')][_0x86a8('0x12')](queryTelephones));_0x512459[_0x86a8('0x2c')](db['Trunk']['findAll'](queryTrunks));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x17')][_0x86a8('0x12')](queryCampaigns));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x5')][_0x86a8('0x12')](queryAgents));break;case'user':_0x38b7ed[_0x36de30](_0x86a8('0x33'));_0x38b7ed[_0x36de30](_0x86a8('0x29'));_0x512459[_0x86a8('0x2c')](getAssociatedResources('VoiceQueues',_0x61d14c['userProfileId'],_0x86a8('0x2d')));_0x512459[_0x86a8('0x2c')](getAssociatedResources('ChatQueues',_0x61d14c[_0x86a8('0x34')],'ChatQueue'));_0x512459['push'](getAssociatedResources(_0x86a8('0xd'),_0x61d14c[_0x86a8('0x34')],_0x86a8('0x35')));_0x512459['push'](getAssociatedResources(_0x86a8('0xe'),_0x61d14c[_0x86a8('0x34')],_0x86a8('0x2f')));_0x512459[_0x86a8('0x2c')](getAssociatedResources('MailQueues',_0x61d14c['userProfileId'],'MailQueue'));_0x512459[_0x86a8('0x2c')](getAssociatedResources(_0x86a8('0x10'),_0x61d14c['userProfileId'],'OpenchannelQueue'));_0x512459['push'](getAssociatedResources(_0x86a8('0x11'),_0x61d14c['userProfileId'],'WhatsappQueue'));_0x512459[_0x86a8('0x2c')](getAssociatedResources(_0x86a8('0x36'),_0x61d14c['userProfileId'],'User'));_0x512459[_0x86a8('0x2c')](getAssociatedResources('Trunks',_0x61d14c['userProfileId'],_0x86a8('0x37')));_0x512459['push'](getAssociatedResources(_0x86a8('0x14'),_0x61d14c[_0x86a8('0x34')],_0x86a8('0x17')));_0x512459[_0x86a8('0x2c')](db[_0x86a8('0x5')][_0x86a8('0x12')](queryAgents));break;case _0x86a8('0x7'):_0x38b7ed[_0x36de30](_0x86a8('0x33'));_0x38b7ed[_0x36de30](_0x86a8('0x29'));_0x512459['push'](_0x61d14c['getVoiceQueues']({'attributes':['id',_0x86a8('0x3')]}));_0x512459[_0x86a8('0x2c')](_0x61d14c[_0x86a8('0x38')]({'attributes':['id','name']}));_0x512459['push'](_0x61d14c[_0x86a8('0x39')]({'attributes':['id',_0x86a8('0x3')]}));_0x512459[_0x86a8('0x2c')](_0x61d14c[_0x86a8('0x3a')]({'attributes':['id',_0x86a8('0x3')]}));_0x512459[_0x86a8('0x2c')](_0x61d14c['getMailQueues']({'attributes':['id',_0x86a8('0x3')]}));_0x512459[_0x86a8('0x2c')](_0x61d14c['getOpenchannelQueues']({'attributes':['id',_0x86a8('0x3')]}));_0x512459[_0x86a8('0x2c')](_0x61d14c[_0x86a8('0x3b')]({'attributes':['id',_0x86a8('0x3')]}));break;}return BPromise[_0x86a8('0x3c')](_0x512459);}})[_0x86a8('0x16')](function(_0x5e4d55){if(_0x5e4d55&&_0x5e4d55[_0x86a8('0x1b')]){for(var _0x155342=0x0;_0x155342<_0x5e4d55[_0x86a8('0x1b')];_0x155342+=0x1){for(var _0x507051=0x0;_0x507051<_0x5e4d55[_0x155342][_0x86a8('0x1b')];_0x507051+=0x1){switch(_0x155342){case 0x0:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x3d'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x1:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x3e'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x2:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x3f'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x3:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x40'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x4:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x41'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x5:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x42'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x6:joinOrLeaveQueues(_0x38b7ed,_0x36de30,_0x86a8('0x43'),_0x5e4d55[_0x155342][_0x507051]);break;case 0x7:_0x38b7ed[_0x36de30](util[_0x86a8('0x19')](_0x86a8('0x44'),_0x5e4d55[_0x155342][_0x507051][_0x86a8('0x3')]));break;case 0x8:_0x38b7ed[_0x36de30](util[_0x86a8('0x19')](_0x86a8('0x45'),_0x5e4d55[_0x155342][_0x507051][_0x86a8('0x3')]));break;case 0x9:_0x38b7ed[_0x36de30](util[_0x86a8('0x19')](_0x86a8('0x46'),_0x5e4d55[_0x155342][_0x507051][_0x86a8('0x9')],_0x5e4d55[_0x155342][_0x507051][_0x86a8('0x3')]));break;case 0xa:_0x38b7ed[_0x36de30](util[_0x86a8('0x19')]('user:%s',_0x5e4d55[_0x155342][_0x507051][_0x86a8('0x3')]));break;}}}}})[_0x86a8('0x16')](function(){if(_0x36de30===_0x86a8('0x47')){var _0x17855f=_[_0x86a8('0x48')](_0x971815[_0x86a8('0x1f')],'id');return _0x971815['removeChatInteractions'](_0x17855f)[_0x86a8('0x16')](function(){for(var _0xed2dd1=0x0;_0xed2dd1<_0x17855f[_0x86a8('0x1b')];_0xed2dd1+=0x1){_0x1cb0a5[_0x86a8('0x49')](_0x86a8('0x4a'),{'ChatInteractionId':Number(_0x17855f[_0xed2dd1]),'UserId':Number(_0x971815['id'])});}});}})['then'](function(){if(_0x36de30===_0x86a8('0x47')){var _0x3d0b05=_['map'](_0x971815[_0x86a8('0x4b')],'id');return _0x971815['removeMailInteractions'](_0x3d0b05)[_0x86a8('0x16')](function(){for(var _0x5825c5=0x0;_0x5825c5<_0x3d0b05[_0x86a8('0x1b')];_0x5825c5+=0x1){_0x1cb0a5[_0x86a8('0x49')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3d0b05[_0x5825c5]),'UserId':Number(_0x971815['id'])});}});}})['then'](function(){if(_0x36de30===_0x86a8('0x47')){var _0x2902f0=_['map'](_0x971815['FaxInteractions'],'id');return _0x971815['removeFaxInteractions'](_0x2902f0)[_0x86a8('0x16')](function(){for(var _0x16bb4b=0x0;_0x16bb4b<_0x2902f0[_0x86a8('0x1b')];_0x16bb4b+=0x1){_0x1cb0a5[_0x86a8('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2902f0[_0x16bb4b]),'UserId':Number(_0x971815['id'])});}});}})[_0x86a8('0x16')](function(){if(_0x36de30===_0x86a8('0x47')){var _0x4a954f=_[_0x86a8('0x48')](_0x971815[_0x86a8('0x23')],'id');return _0x971815[_0x86a8('0x4c')](_0x4a954f)['then'](function(){for(var _0x19d202=0x0;_0x19d202<_0x4a954f['length'];_0x19d202+=0x1){_0x1cb0a5[_0x86a8('0x49')](_0x86a8('0x4d'),{'SmsInteractionId':Number(_0x4a954f[_0x19d202]),'UserId':Number(_0x971815['id'])});}});}})[_0x86a8('0x16')](function(){if(_0x36de30===_0x86a8('0x47')){var _0x3c5985=_[_0x86a8('0x48')](_0x971815[_0x86a8('0x25')],'id');return _0x971815['removeOpenchannelInteractions'](_0x3c5985)[_0x86a8('0x16')](function(){for(var _0x1fc88c=0x0;_0x1fc88c<_0x3c5985[_0x86a8('0x1b')];_0x1fc88c+=0x1){_0x1cb0a5[_0x86a8('0x49')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3c5985[_0x1fc88c]),'UserId':Number(_0x971815['id'])});}});}})[_0x86a8('0x16')](function(){if(_0x36de30===_0x86a8('0x47')){var _0x2003c9=_[_0x86a8('0x48')](_0x971815[_0x86a8('0x27')],'id');return _0x971815['removeWhatsappInteractions'](_0x2003c9)[_0x86a8('0x16')](function(){for(var _0x55a4cf=0x0;_0x55a4cf<_0x2003c9[_0x86a8('0x1b')];_0x55a4cf+=0x1){_0x1cb0a5[_0x86a8('0x49')](_0x86a8('0x4e'),{'WhatsappInteractionId':Number(_0x2003c9[_0x55a4cf]),'UserId':Number(_0x971815['id'])});}});}})['catch'](function(_0x4b7da1){_0x38b7ed[_0x86a8('0x4f')](_0x4b7da1);});}}function onDisconnect(_0x23fe47,_0x1126e9){joinOrLeave(_0x23fe47,_0x86a8('0x47'),_0x1126e9);}function onConnect(_0x2f81fd){joinOrLeave(_0x2f81fd,_0x86a8('0x50'));}exports[_0x86a8('0x51')]=function(_0x9e3cb4){_0x9e3cb4['on']('connection',function(_0x3b61f1){_0x3b61f1[_0x86a8('0x52')](0x0);_0x3b61f1[_0x86a8('0x53')]=_0x3b61f1['request']['connection']['remoteAddress']+':'+_0x3b61f1[_0x86a8('0x54')][_0x86a8('0x55')][_0x86a8('0x56')];_0x3b61f1[_0x86a8('0x57')]=new Date();_0x3b61f1[_0x86a8('0x4f')]=function(_0x22398b){console['log'](_0x86a8('0x58')+_0x3b61f1[_0x86a8('0x59')]['name']+'['+_0x3b61f1[_0x86a8('0x53')]+']',_0x22398b);};_0x3b61f1['on'](_0x86a8('0x5a'),function(){onDisconnect(_0x3b61f1,_0x9e3cb4);_0x3b61f1[_0x86a8('0x4f')]('DISCONNECTED');});onConnect(_0x3b61f1);_0x3b61f1['log'](_0x86a8('0x5b'));});}; \ No newline at end of file +var _0x7231=['removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','Agents','User','name','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','role','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','voice:outbound','VoiceQueues','MailQueue','OpenchannelQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','leave','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove'];(function(_0x30a640,_0x300254){var _0x21f6b4=function(_0x5f330d){while(--_0x5f330d){_0x30a640['push'](_0x30a640['shift']());}};_0x21f6b4(++_0x300254);}(_0x7231,0xd2));var _0x1723=function(_0x280b06,_0x496a0d){_0x280b06=_0x280b06-0x0;var _0x56234c=_0x7231[_0x280b06];return _0x56234c;};'use strict';var _=require('lodash');var util=require(_0x1723('0x0'));var BPromise=require(_0x1723('0x1'));var db=require(_0x1723('0x2'))['db'];var config=require(_0x1723('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x1723('0x4'),'model':db[_0x1723('0x5')],'attributes':['id','name','role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1723('0x6')],'where':{'role':_0x1723('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1723('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x1723('0x6')],'where':{'role':_0x1723('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1723('0x6'),_0x1723('0x9')],'where':{'type':_0x1723('0xa')}};function getAssociatedResources(_0x5db13c,_0x3a9bba,_0x48f26f){return db[_0x1723('0xb')][_0x1723('0xc')]({'where':{'name':_0x5db13c,'userProfileId':_0x3a9bba},'raw':!![]})[_0x1723('0xd')](function(_0x3b95d6){if(_0x3b95d6){if(_0x3b95d6[_0x1723('0xe')]){switch(_0x5db13c){case'VoiceQueues':case _0x1723('0xf'):case'FaxQueues':case _0x1723('0x10'):case'MailQueues':case'OpenchannelQueues':case _0x1723('0x11'):return db[_0x48f26f][_0x1723('0x12')](queryQueues);case _0x1723('0x13'):return db[_0x48f26f]['findAll'](queryTelephones);case _0x1723('0x14'):return db[_0x48f26f][_0x1723('0x12')](queryTrunks);case _0x1723('0x15'):return db[_0x48f26f]['findAll'](queryCampaigns);}}else{return db[_0x1723('0x16')][_0x1723('0x12')]({'attributes':[_0x1723('0x17')],'where':{'sectionId':_0x3b95d6['id']},'raw':!![]})[_0x1723('0xd')](function(_0x304eb7){if(_0x304eb7){var _0x4b5260={'where':{'id':_[_0x1723('0x18')](_0x304eb7,_0x1723('0x17'))},'raw':!![]};switch(_0x48f26f){case _0x1723('0x5'):_0x4b5260[_0x1723('0x19')]['role']=_0x1723('0x7');break;case _0x1723('0x1a'):_0x4b5260['where'][_0x1723('0x9')]=_0x1723('0xa');break;}return db[_0x48f26f][_0x1723('0x12')](_0x4b5260);}else{return[];}});}}else{return[];}})[_0x1723('0xd')](function(_0x1fd602){return _0x1fd602;});}function joinOrLeaveQueues(_0x4652a8,_0x5352f7,_0x277fb7,_0x415ba6){_0x4652a8[_0x5352f7](util[_0x1723('0x1b')](_0x1723('0x1c'),_0x277fb7,_0x415ba6[_0x1723('0x6')]));if(_0x415ba6[_0x1723('0x4')]){for(var _0x24932d=0x0;_0x24932d<_0x415ba6[_0x1723('0x4')][_0x1723('0x1d')];_0x24932d+=0x1){_0x4652a8[_0x5352f7](util['format'](_0x1723('0x1e'),_0x415ba6[_0x1723('0x4')][_0x24932d][_0x1723('0x6')]));}}}function joinOrLeave(_0x493609,_0x53ac2b,_0xd19471){var _0x1790c6;if(_0x493609[_0x1723('0x1f')][_0x1723('0x20')]['id']){db[_0x1723('0x5')][_0x1723('0x21')]({'attributes':['id',_0x1723('0x6'),_0x1723('0x22'),_0x1723('0x23')],'where':{'id':_0x493609[_0x1723('0x1f')][_0x1723('0x20')]['id']},'include':[{'model':db[_0x1723('0x24')],'as':_0x1723('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x1723('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x1723('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x1723('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1723('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1723('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1723('0xd')](function(_0x113296){if(_0x113296){_0x1790c6=_0x113296;_0x493609[_0x53ac2b](util['format']('user:%s',_0x113296[_0x1723('0x6')]));var _0x2d3f26=[];switch(_0x113296[_0x1723('0x22')]){case _0x1723('0x2b'):_0x493609[_0x53ac2b]('voice:inbound');_0x493609[_0x53ac2b]('voice:outbound');if(queryQueues[_0x1723('0x2c')](_0x1723('0x2d'))){delete queryQueues['include'];}_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x2f')][_0x1723('0x12')](queryQueues));_0x2d3f26['push'](db[_0x1723('0x30')][_0x1723('0x12')](queryQueues));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x31')][_0x1723('0x12')](queryQueues));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x32')][_0x1723('0x12')](queryQueues));_0x2d3f26['push'](db['MailQueue'][_0x1723('0x12')](queryQueues));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x33')][_0x1723('0x12')](queryQueues));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x34')]['findAll'](queryQueues));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x5')][_0x1723('0x12')](queryTelephones));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x35')][_0x1723('0x12')](queryTrunks));_0x2d3f26[_0x1723('0x2e')](db['Campaign'][_0x1723('0x12')](queryCampaigns));_0x2d3f26[_0x1723('0x2e')](db['User'][_0x1723('0x12')](queryAgents));break;case'user':_0x493609[_0x53ac2b](_0x1723('0x36'));_0x493609[_0x53ac2b](_0x1723('0x37'));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources(_0x1723('0x38'),_0x113296[_0x1723('0x23')],_0x1723('0x2f')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources(_0x1723('0xf'),_0x113296[_0x1723('0x23')],_0x1723('0x30')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources('FaxQueues',_0x113296['userProfileId'],_0x1723('0x31')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources('SmsQueues',_0x113296[_0x1723('0x23')],_0x1723('0x32')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources('MailQueues',_0x113296[_0x1723('0x23')],_0x1723('0x39')));_0x2d3f26['push'](getAssociatedResources(_0x1723('0x3a'),_0x113296[_0x1723('0x23')],_0x1723('0x33')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources('WhatsappQueues',_0x113296[_0x1723('0x23')],_0x1723('0x34')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources(_0x1723('0x13'),_0x113296['userProfileId'],_0x1723('0x5')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources(_0x1723('0x14'),_0x113296['userProfileId'],_0x1723('0x35')));_0x2d3f26[_0x1723('0x2e')](getAssociatedResources(_0x1723('0x15'),_0x113296[_0x1723('0x23')],_0x1723('0x1a')));_0x2d3f26[_0x1723('0x2e')](db[_0x1723('0x5')][_0x1723('0x12')](queryAgents));break;case _0x1723('0x8'):_0x493609[_0x53ac2b](_0x1723('0x36'));_0x493609[_0x53ac2b](_0x1723('0x37'));_0x2d3f26[_0x1723('0x2e')](_0x113296['getVoiceQueues']({'attributes':['id',_0x1723('0x6')]}));_0x2d3f26[_0x1723('0x2e')](_0x113296['getChatQueues']({'attributes':['id',_0x1723('0x6')]}));_0x2d3f26[_0x1723('0x2e')](_0x113296['getFaxQueues']({'attributes':['id',_0x1723('0x6')]}));_0x2d3f26['push'](_0x113296[_0x1723('0x3b')]({'attributes':['id','name']}));_0x2d3f26['push'](_0x113296[_0x1723('0x3c')]({'attributes':['id',_0x1723('0x6')]}));_0x2d3f26[_0x1723('0x2e')](_0x113296['getOpenchannelQueues']({'attributes':['id',_0x1723('0x6')]}));_0x2d3f26[_0x1723('0x2e')](_0x113296[_0x1723('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0x1723('0x3e')](_0x2d3f26);}})[_0x1723('0xd')](function(_0x5bd002){if(_0x5bd002&&_0x5bd002['length']){for(var _0x1e421c=0x0;_0x1e421c<_0x5bd002[_0x1723('0x1d')];_0x1e421c+=0x1){for(var _0x581903=0x0;_0x581903<_0x5bd002[_0x1e421c][_0x1723('0x1d')];_0x581903+=0x1){switch(_0x1e421c){case 0x0:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x3f'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x1:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x40'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x2:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x41'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x3:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x42'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x4:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x43'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x5:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x44'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x6:joinOrLeaveQueues(_0x493609,_0x53ac2b,_0x1723('0x45'),_0x5bd002[_0x1e421c][_0x581903]);break;case 0x7:_0x493609[_0x53ac2b](util[_0x1723('0x1b')](_0x1723('0x46'),_0x5bd002[_0x1e421c][_0x581903][_0x1723('0x6')]));break;case 0x8:_0x493609[_0x53ac2b](util[_0x1723('0x1b')]('trunk:%s',_0x5bd002[_0x1e421c][_0x581903][_0x1723('0x6')]));break;case 0x9:_0x493609[_0x53ac2b](util[_0x1723('0x1b')]('campaign:%s:%s',_0x5bd002[_0x1e421c][_0x581903][_0x1723('0x9')],_0x5bd002[_0x1e421c][_0x581903][_0x1723('0x6')]));break;case 0xa:_0x493609[_0x53ac2b](util[_0x1723('0x1b')](_0x1723('0x1e'),_0x5bd002[_0x1e421c][_0x581903]['name']));break;}}}}})[_0x1723('0xd')](function(){if(_0x53ac2b===_0x1723('0x47')){var _0x4de18b=_[_0x1723('0x18')](_0x1790c6['ChatInteractions'],'id');return _0x1790c6['removeChatInteractions'](_0x4de18b)[_0x1723('0xd')](function(){for(var _0x3f4d93=0x0;_0x3f4d93<_0x4de18b[_0x1723('0x1d')];_0x3f4d93+=0x1){_0xd19471['emit'](_0x1723('0x48'),{'ChatInteractionId':Number(_0x4de18b[_0x3f4d93]),'UserId':Number(_0x1790c6['id'])});}});}})['then'](function(){if(_0x53ac2b===_0x1723('0x47')){var _0x93f1a=_[_0x1723('0x18')](_0x1790c6['MailInteractions'],'id');return _0x1790c6['removeMailInteractions'](_0x93f1a)[_0x1723('0xd')](function(){for(var _0x989f02=0x0;_0x989f02<_0x93f1a[_0x1723('0x1d')];_0x989f02+=0x1){_0xd19471[_0x1723('0x49')](_0x1723('0x4a'),{'MailInteractionId':Number(_0x93f1a[_0x989f02]),'UserId':Number(_0x1790c6['id'])});}});}})[_0x1723('0xd')](function(){if(_0x53ac2b===_0x1723('0x47')){var _0x2aedbd=_[_0x1723('0x18')](_0x1790c6[_0x1723('0x27')],'id');return _0x1790c6['removeFaxInteractions'](_0x2aedbd)[_0x1723('0xd')](function(){for(var _0x56a936=0x0;_0x56a936<_0x2aedbd['length'];_0x56a936+=0x1){_0xd19471[_0x1723('0x49')](_0x1723('0x4b'),{'FaxInteractionId':Number(_0x2aedbd[_0x56a936]),'UserId':Number(_0x1790c6['id'])});}});}})[_0x1723('0xd')](function(){if(_0x53ac2b===_0x1723('0x47')){var _0x3f121a=_[_0x1723('0x18')](_0x1790c6['SmsInteractions'],'id');return _0x1790c6[_0x1723('0x4c')](_0x3f121a)[_0x1723('0xd')](function(){for(var _0x3ac190=0x0;_0x3ac190<_0x3f121a['length'];_0x3ac190+=0x1){_0xd19471[_0x1723('0x49')](_0x1723('0x4d'),{'SmsInteractionId':Number(_0x3f121a[_0x3ac190]),'UserId':Number(_0x1790c6['id'])});}});}})[_0x1723('0xd')](function(){if(_0x53ac2b===_0x1723('0x47')){var _0x454ac9=_['map'](_0x1790c6['OpenchannelInteractions'],'id');return _0x1790c6[_0x1723('0x4e')](_0x454ac9)[_0x1723('0xd')](function(){for(var _0x8a3d7c=0x0;_0x8a3d7c<_0x454ac9[_0x1723('0x1d')];_0x8a3d7c+=0x1){_0xd19471['emit'](_0x1723('0x4f'),{'OpenchannelInteractionId':Number(_0x454ac9[_0x8a3d7c]),'UserId':Number(_0x1790c6['id'])});}});}})[_0x1723('0xd')](function(){if(_0x53ac2b===_0x1723('0x47')){var _0x898bca=_['map'](_0x1790c6['WhatsappInteractions'],'id');return _0x1790c6[_0x1723('0x50')](_0x898bca)[_0x1723('0xd')](function(){for(var _0x3756e7=0x0;_0x3756e7<_0x898bca['length'];_0x3756e7+=0x1){_0xd19471[_0x1723('0x49')](_0x1723('0x51'),{'WhatsappInteractionId':Number(_0x898bca[_0x3756e7]),'UserId':Number(_0x1790c6['id'])});}});}})[_0x1723('0x52')](function(_0x23a22c){_0x493609[_0x1723('0x53')](_0x23a22c);});}}function onDisconnect(_0x2cc038,_0x2d7d65){joinOrLeave(_0x2cc038,_0x1723('0x47'),_0x2d7d65);}function onConnect(_0xbfd09f){joinOrLeave(_0xbfd09f,_0x1723('0x54'));}exports[_0x1723('0x55')]=function(_0x5502b5){_0x5502b5['on'](_0x1723('0x56'),function(_0x29f739){_0x29f739['setMaxListeners'](0x0);_0x29f739[_0x1723('0x57')]=_0x29f739[_0x1723('0x58')][_0x1723('0x56')]['remoteAddress']+':'+_0x29f739[_0x1723('0x58')][_0x1723('0x56')][_0x1723('0x59')];_0x29f739[_0x1723('0x5a')]=new Date();_0x29f739[_0x1723('0x53')]=function(_0x316495){console[_0x1723('0x53')](_0x1723('0x5b')+_0x29f739[_0x1723('0x5c')][_0x1723('0x6')]+'['+_0x29f739['address']+']',_0x316495);};_0x29f739['on'](_0x1723('0x5d'),function(){onDisconnect(_0x29f739,_0x5502b5);_0x29f739[_0x1723('0x53')](_0x1723('0x5e'));});onConnect(_0x29f739);_0x29f739['log'](_0x1723('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 25c06b2..0691c93 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 _0x7297=['FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','get','channel','event','direction','User','find','UserId','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','catch','default','length','hasOwnProperty','hook','callback','toLowerCase','util','../../mysqldb','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','afterUpdate','Whatsapp','WhatsappInteraction','Fax','FaxInteraction'];(function(_0x5cb885,_0x332d02){var _0x3cf6ed=function(_0x3a70a0){while(--_0x3a70a0){_0x5cb885['push'](_0x5cb885['shift']());}};_0x3cf6ed(++_0x332d02);}(_0x7297,0x1ac));var _0x7729=function(_0x2ce297,_0x421d96){_0x2ce297=_0x2ce297-0x0;var _0xb429a=_0x7297[_0x2ce297];return _0xb429a;};'use strict';var util=require(_0x7729('0x0'));var db=require(_0x7729('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x7729('0x2'))(_0x7729('0x3'));var client=jayson[_0x7729('0x4')][_0x7729('0x5')]({'port':0x232a});var triggers=[{'channel':_0x7729('0x6'),'model':_0x7729('0x7'),'event':_0x7729('0x8'),'condition':_0x7729('0x9'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':_0x7729('0xa'),'callback':afterUpdate},{'channel':_0x7729('0x6'),'model':_0x7729('0xb'),'event':_0x7729('0x8'),'condition':_0x7729('0xc'),'callback':afterCreateMessage},{'channel':_0x7729('0xd'),'model':_0x7729('0xe'),'event':_0x7729('0x8'),'condition':_0x7729('0x9'),'callback':afterCreate},{'channel':_0x7729('0xd'),'model':_0x7729('0xe'),'event':_0x7729('0xf'),'condition':_0x7729('0xa'),'callback':afterUpdate},{'channel':_0x7729('0xd'),'model':'SmsMessage','event':_0x7729('0x8'),'condition':_0x7729('0xc'),'callback':afterCreateMessage},{'channel':_0x7729('0x10'),'model':_0x7729('0x11'),'event':_0x7729('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x7729('0xf'),'condition':_0x7729('0xa'),'callback':afterUpdate},{'channel':_0x7729('0x10'),'model':'WhatsappMessage','event':_0x7729('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7729('0x12'),'model':_0x7729('0x13'),'event':'afterCreate','condition':_0x7729('0x9'),'callback':afterCreate},{'channel':'Fax','model':_0x7729('0x13'),'event':_0x7729('0xf'),'condition':_0x7729('0xa'),'callback':afterUpdate},{'channel':_0x7729('0x12'),'model':_0x7729('0x14'),'event':_0x7729('0x8'),'condition':_0x7729('0xc'),'callback':afterCreateMessage},{'channel':_0x7729('0x15'),'model':_0x7729('0x16'),'event':_0x7729('0x8'),'condition':_0x7729('0x9'),'callback':afterCreate},{'channel':_0x7729('0x15'),'model':_0x7729('0x16'),'event':_0x7729('0xf'),'condition':_0x7729('0xa'),'callback':afterUpdate},{'channel':_0x7729('0x15'),'model':'MailMessage','event':_0x7729('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x7729('0x17'),'event':_0x7729('0x8'),'condition':_0x7729('0x9'),'callback':afterCreate},{'channel':_0x7729('0x18'),'model':_0x7729('0x17'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7729('0x18'),'model':_0x7729('0x19'),'event':'afterCreate','condition':_0x7729('0xc'),'callback':afterCreateMessage}];function request(_0x4eed1d){return client[_0x7729('0x1a')](_0x7729('0x1b'),_0x4eed1d)[_0x7729('0x1c')](function(_0x4a6a23){logger[_0x7729('0x1d')]('Trigger,\x20%s',_0x7729('0x1b'),_0x4a6a23);if(_0x4a6a23['error']){if(_0x4a6a23[_0x7729('0x1e')][_0x7729('0x1f')]===0x1f4){logger['error'](_0x7729('0x20'),_0x7729('0x1b'),_0x4a6a23['error']);}}})['catch'](function(_0x116b58){logger[_0x7729('0x1e')](_0x7729('0x20'),_0x7729('0x1b'),_0x116b58);});}function afterCreateMessage(_0x378799,_0x1500ba){return function(_0x1d02e7,_0x5c232b){_0x1d02e7=_0x1d02e7[_0x7729('0x21')]({'plain':!![]});_0x1d02e7[_0x7729('0x22')]=_0x378799;_0x1d02e7[_0x7729('0x23')]=_0x1d02e7[_0x7729('0x24')];if(_0x1d02e7['UserId']){return db[_0x7729('0x25')][_0x7729('0x26')]({'where':{'id':_0x1d02e7[_0x7729('0x27')]},'attributes':['id',_0x7729('0x28')],'raw':!![]})['then'](function(_0xd4ed57){_0x1d02e7[_0x7729('0x29')]=util[_0x7729('0x2a')](_0x7729('0x2b'),_0xd4ed57[_0x7729('0x28')]);_0x1d02e7[_0x7729('0x22')]=_0x378799;return request({'event':_0x7729('0x2c'),'message':_0x1d02e7});})['catch'](function(_0x5ecdee){console[_0x7729('0x1e')](_0x5ecdee);});}else{return request({'event':_0x7729('0x2d'),'message':_0x1d02e7});}};}function afterCreate(_0x488904,_0x432243){return function(_0x2f1faa,_0x200a26){_0x2f1faa=_0x2f1faa[_0x7729('0x21')]({'plain':!![]});_0x2f1faa[_0x7729('0x22')]=_0x488904;_0x2f1faa['event']=_0x7729('0x2e');return request({'event':_0x432243,'message':_0x2f1faa});};}function afterUpdate(_0xa74d00,_0x4b4feb){return function(_0x16790e,_0x1b1f06){if(_0x16790e[_0x7729('0x2f')](_0x7729('0x30'))&&_0x16790e[_0x7729('0x30')]){_0x16790e=_0x16790e[_0x7729('0x21')]({'plain':!![]});_0x16790e['channel']=_0xa74d00;_0x16790e[_0x7729('0x23')]=_0x7729('0x30');if(_0x16790e[_0x7729('0x27')]){return db['User'][_0x7729('0x26')]({'where':{'id':_0x16790e[_0x7729('0x27')]},'attributes':['id',_0x7729('0x28')],'raw':!![]})['then'](function(_0x16037){_0x16790e['interface']=util[_0x7729('0x2a')](_0x7729('0x2b'),_0x16037[_0x7729('0x28')]);return request({'event':_0x4b4feb,'message':_0x16790e});})[_0x7729('0x31')](function(_0x7c69b8){console[_0x7729('0x1e')](_0x7c69b8);});}else{return request({'event':_0x4b4feb,'message':_0x16790e});}}};}exports[_0x7729('0x32')]=function(){for(var _0x4e0d67=0x0;_0x4e0d67=_0x1250e8[_0x67f1('0x15')]){throw Error(_0x67f1('0x16'));}_0x57d0b7(_0x4a181d);})[_0x67f1('0x17')](function(_0xc70c20){_0x9c8cef(_0xc70c20);});});}; \ No newline at end of file +var _0x143e=['count','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','voice','mail','sms','whatsapp','openchannel','toLowerCase','clearBlockUser','updateAttributes','agent'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x143e,0xa8));var _0xe143=function(_0x54e89d,_0x4ecc1b){_0x54e89d=_0x54e89d-0x0;var _0x4babf0=_0x143e[_0x54e89d];return _0x4babf0;};'use strict';var _=require('lodash');var BPromise=require(_0xe143('0x0'));var db=require(_0xe143('0x1'))['db'];var util=require(_0xe143('0x2'));var channels=[_0xe143('0x3'),_0xe143('0x4'),'chat','fax',_0xe143('0x5'),_0xe143('0x6'),_0xe143('0x7')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x7bf5d6){_0x7bf5d6=_0x7bf5d6[_0xe143('0x8')]();return _['includes'](channels,_0x7bf5d6);};exports[_0xe143('0x9')]=function(_0x4d4fb9,_0x1f749a,_0x12b878,_0x4adda7){var _0x35741a={'loginAttempts':_0x1f749a,'blocked':_0x12b878};if(!_['isUndefined'](_0x4adda7)){_0x35741a['blockedAt']=_0x4adda7;}return _0x4d4fb9[_0xe143('0xa')](_0x35741a);};exports['getLicense']=function(_0x5bce1c){return new BPromise(function(_0x42c42b,_0x22ed4c){var _0x5315c6=0x0;if(_0x5bce1c['role']!==_0xe143('0xb')){_0x42c42b(_0x5bce1c);}db['User'][_0xe143('0xc')]({'where':{'role':_0xe143('0xb'),'online':!![],'id':{'$ne':_0x5bce1c['id']}}})['then'](function(_0x2891ee){_0x5315c6=_0x2891ee;return util[_0xe143('0xd')]();})[_0xe143('0xe')](function(_0x173288){if(_0x173288&&_0x173288[_0xe143('0xf')]&&_0x5315c6>=_0x173288[_0xe143('0xf')]){throw Error(_0xe143('0x10'));}_0x42c42b(_0x5bce1c);})[_0xe143('0x11')](function(_0x3e25f6){_0x22ed4c(_0x3e25f6);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index dc8de1c..f64b9c4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12b9=['render','send','exports','404','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x12b9,0x138));var _0x912b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x12b9[_0x2dafbe];return _0x58a45a;};'use strict';module[_0x912b('0x0')][0x194]=function pageNotFound(_0x4e8858,_0x1edba8){var _0x9cbc28=_0x912b('0x1');var _0x2ccce8=0x194;var _0x3a2780={'status':_0x2ccce8};_0x1edba8[_0x912b('0x2')](_0x3a2780[_0x912b('0x2')]);_0x1edba8[_0x912b('0x3')](_0x9cbc28,{},function(_0x46f38c,_0xbe9907){if(_0x46f38c){return _0x1edba8[_0x912b('0x2')](_0x3a2780[_0x912b('0x2')])['json'](_0x3a2780);}_0x1edba8[_0x912b('0x4')](_0xbe9907);});}; \ No newline at end of file +var _0xce9b=['send','exports','404','status','json'];(function(_0x2527d2,_0x149699){var _0x220f6c=function(_0x3ff84e){while(--_0x3ff84e){_0x2527d2['push'](_0x2527d2['shift']());}};_0x220f6c(++_0x149699);}(_0xce9b,0x119));var _0xbce9=function(_0x57945f,_0x849ec2){_0x57945f=_0x57945f-0x0;var _0x2f766e=_0xce9b[_0x57945f];return _0x2f766e;};'use strict';module[_0xbce9('0x0')][0x194]=function pageNotFound(_0x222055,_0x1347cf){var _0xc24b24=_0xbce9('0x1');var _0x1c714d=0x194;var _0x203757={'status':_0x1c714d};_0x1347cf['status'](_0x203757[_0xbce9('0x2')]);_0x1347cf['render'](_0xc24b24,{},function(_0xee22b6,_0x454b93){if(_0xee22b6){return _0x1347cf[_0xbce9('0x2')](_0x203757['status'])[_0xbce9('0x3')](_0x203757);}_0x1347cf[_0xbce9('0x4')](_0x454b93);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7e8c3ca..e61be73 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cfb=['../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','CmContact','cm_user_has_contacts','cm_user_has_lists','Team','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueue','MailQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sound','Sounds','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','MailServerOut','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','restrict','TagId','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','Members','chat_group_has_users','Contacts','CompanyId','Hoppers','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','Descriptions','DescriptionId','SubjectId','Field','FieldId','VariableId','SugarcrmConfiguration','SugarcrmField','Subject','Description','DeskAccount','int_desk_configuration_has_tags','ZendeskAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesField','ChatQueueReport','ChatInternalMessage','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','JscriptyProject','user_has_teams','ChatQueues','team_has_openchannel_queues','team_has_whatsapp_queues','Lists','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','lodash','jstz','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','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','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','CmCompany','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','../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','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model'];(function(_0x5bff8a,_0x153365){var _0x5415dd=function(_0x28a099){while(--_0x28a099){_0x5bff8a['push'](_0x5bff8a['shift']());}};_0x5415dd(++_0x153365);}(_0x4cfb,0x14a));var _0xb4cf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4cfb[_0x501510];return _0x1e6ee5;};'use strict';var path=require(_0xb4cf('0x0'));var config=require(_0xb4cf('0x1'));var Sequelize=require('sequelize');var _=require(_0xb4cf('0x2'));var jstz=require(_0xb4cf('0x3'));var timezone=jstz['determine']();config[_0xb4cf('0x4')]=_['defaultsDeep'](config['sequelize'],{'database':_0xb4cf('0x5'),'username':_0xb4cf('0x6'),'password':_0xb4cf('0x7'),'options':{'host':_0xb4cf('0x8'),'port':0xcea,'dialect':_0xb4cf('0x9'),'dialectOptions':{'charset':_0xb4cf('0xa')},'logging':![],'timezone':timezone[_0xb4cf('0xb')](),'define':{'charset':_0xb4cf('0xc'),'collate':_0xb4cf('0xd')}}});config[_0xb4cf('0xe')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xb4cf('0x5'),'username':_0xb4cf('0x6'),'password':_0xb4cf('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb4cf('0x9'),'dialectOptions':{'charset':_0xb4cf('0xa')},'logging':![],'timezone':timezone[_0xb4cf('0xb')](),'define':{'charset':_0xb4cf('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb4cf('0x4')]['database'],config[_0xb4cf('0x4')][_0xb4cf('0xf')],config[_0xb4cf('0x4')]['password'],config['sequelize'][_0xb4cf('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb4cf('0xe')]['database'],config['sequelizeHistory'][_0xb4cf('0xf')],config['sequelizeHistory'][_0xb4cf('0x11')],config[_0xb4cf('0xe')][_0xb4cf('0x10')])};db[_0xb4cf('0x12')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x14'));db[_0xb4cf('0x15')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x16'));db['VoiceContext']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x17'));db[_0xb4cf('0x18')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x19'));db[_0xb4cf('0x1a')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x1b'));db['VoiceQueue']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x1c'));db[_0xb4cf('0x1d')]=db[_0xb4cf('0x4')]['import']('../api/voiceRecording/voiceRecording.model');db[_0xb4cf('0x1e')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x1f'));db['VoiceMail']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x20'));db[_0xb4cf('0x21')]=db['sequelize']['import'](_0xb4cf('0x22'));db[_0xb4cf('0x23')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x24'));db[_0xb4cf('0x25')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x26'));db['VoiceAgentReport']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x27'));db[_0xb4cf('0x28')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x29'));db['MemberReport']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x2a'));db['Trunk']=db[_0xb4cf('0x4')]['import']('../api/trunk/trunk.model');db[_0xb4cf('0x2b')]=db['sequelize'][_0xb4cf('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xb4cf('0x2c')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x2d'));db[_0xb4cf('0x2e')]=db['sequelize']['import'](_0xb4cf('0x2f'));db[_0xb4cf('0x30')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x31'));db[_0xb4cf('0x32')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x33'));db[_0xb4cf('0x34')]=db['sequelize'][_0xb4cf('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0xb4cf('0x35')]=db['sequelize'][_0xb4cf('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0xb4cf('0x36')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xb4cf('0x37')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x38'));db[_0xb4cf('0x39')]=db['sequelize']['import'](_0xb4cf('0x3a'));db['MailServerOut']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x3b'));db[_0xb4cf('0x3c')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x3d'));db['MailQueue']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x3e'));db[_0xb4cf('0x3f')]=db[_0xb4cf('0x4')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xb4cf('0x40')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x41'));db[_0xb4cf('0x42')]=db['sequelize'][_0xb4cf('0x13')]('../api/mailMessage/mailMessage.model');db[_0xb4cf('0x43')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x44'));db[_0xb4cf('0x45')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x46'));db[_0xb4cf('0x47')]=db['sequelize']['import'](_0xb4cf('0x48'));db[_0xb4cf('0x49')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x4a'));db[_0xb4cf('0x4b')]=db[_0xb4cf('0x4')]['import']('../api/faxAccount/faxAccount.model');db[_0xb4cf('0x4c')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/faxApplication/faxApplication.model');db[_0xb4cf('0x4d')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x4e'));db[_0xb4cf('0x4f')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x50'));db[_0xb4cf('0x51')]=db[_0xb4cf('0x4')]['import']('../api/faxQueue/faxQueue.model');db[_0xb4cf('0x52')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x53'));db[_0xb4cf('0x54')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0x55'));db[_0xb4cf('0x56')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x57'));db[_0xb4cf('0x58')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x59'));db[_0xb4cf('0x5a')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x5b'));db[_0xb4cf('0x5c')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x5d'));db['OpenchannelAccount']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x5e'));db[_0xb4cf('0x5f')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x60'));db[_0xb4cf('0x61')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x62'));db['OpenchannelMessage']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x63'));db[_0xb4cf('0x64')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0x65'));db[_0xb4cf('0x66')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0x67'));db[_0xb4cf('0x68')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0x69'));db[_0xb4cf('0x6a')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x6b'));db['ChatInteraction']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x6c'));db[_0xb4cf('0x6d')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x6e'));db[_0xb4cf('0x6f')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x70'));db[_0xb4cf('0x71')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x72'));db['ChatGroup']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x73'));db['ChatProactiveAction']=db[_0xb4cf('0x4')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xb4cf('0x74')]=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x75'));db['CmHopper']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x76'));db[_0xb4cf('0x77')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x78'));db[_0xb4cf('0x79')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x7a'));db[_0xb4cf('0x7b')]=db['sequelize']['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xb4cf('0x7c')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x7d'));db[_0xb4cf('0x7e')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0x7f'));db[_0xb4cf('0x80')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x81'));db[_0xb4cf('0x82')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x83'));db[_0xb4cf('0x84')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0xb4cf('0x85')]=db['sequelize'][_0xb4cf('0x13')]('../api/disposition/disposition.model');db[_0xb4cf('0x86')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x87'));db[_0xb4cf('0x88')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x89'));db[_0xb4cf('0x8a')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x8b'));db[_0xb4cf('0x8c')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x8d'));db['VoiceQueuesLog']=db['sequelize'][_0xb4cf('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xb4cf('0x8e')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x8f'));db['Sound']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x90'));db[_0xb4cf('0x91')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x92'));db[_0xb4cf('0x93')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x94'));db[_0xb4cf('0x95')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x96'));db[_0xb4cf('0x97')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x98'));db[_0xb4cf('0x99')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x9a'));db['IntegrationReport']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x9b'));db[_0xb4cf('0x9c')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x9d'));db['AnalyticDefaultReport']=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xb4cf('0x9e')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xb4cf('0x9f')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xa0'));db['AnalyticFieldReport']=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xa1'));db[_0xb4cf('0xa2')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xb4cf('0xa3')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xa4'));db['SalesforceConfiguration']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xa5'));db[_0xb4cf('0xa6')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xa7'));db[_0xb4cf('0xa8')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xa9'));db['SugarcrmConfiguration']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xaa'));db['SugarcrmField']=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xab'));db['DeskAccount']=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xac'));db[_0xb4cf('0xad')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xb4cf('0xae')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xaf'));db[_0xb4cf('0xb0')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xb1'));db[_0xb4cf('0xb2')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xb4cf('0xb3')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xb4'));db['ZendeskAccount']=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xb5'));db['ZendeskField']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xb6'));db[_0xb4cf('0xb7')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xb8'));db[_0xb4cf('0xb9')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xb4cf('0xba')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xbb'));db[_0xb4cf('0xbc')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xbd'));db[_0xb4cf('0xbe')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xbf'));db[_0xb4cf('0xc0')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xc1'));db[_0xb4cf('0xc2')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xc3'));db['ServicenowConfiguration']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xc4'));db[_0xb4cf('0xc5')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xc6'));db[_0xb4cf('0xc7')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xc8'));db[_0xb4cf('0xc9')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xca'));db[_0xb4cf('0xcb')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xcc'));db[_0xb4cf('0xcd')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xce'));db[_0xb4cf('0xcf')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xd0'));db['FreshsalesField']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xd1'));db[_0xb4cf('0x99')]=db['sequelize']['import'](_0xb4cf('0x9a'));db['Network']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xd2'));db['ChatQueueReport']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xd3'));db['ChatInternalMessage']=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xb4cf('0xd4')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xd5'));db['JscriptyQuestionReport']=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xd6'));db[_0xb4cf('0xd7')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xd8'));db[_0xb4cf('0xd9')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xda'));db['SquareReport']=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xdb'));db['SquareDetailsReport']=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xdc'));db[_0xb4cf('0xdd')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xde'));db[_0xb4cf('0xdf')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xe0'));db[_0xb4cf('0xe1')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xe2'));db[_0xb4cf('0xe3')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xe4'));db[_0xb4cf('0xe5')]=db['sequelize'][_0xb4cf('0x13')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xe6'));db['License']=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xe7'));db[_0xb4cf('0xe8')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xe9'));db['Migration']=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/migration/migration.model');db[_0xb4cf('0xea')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xeb'));db[_0xb4cf('0xec')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xed'));db[_0xb4cf('0xee')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0xef'));db[_0xb4cf('0xf0')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xf1'));db[_0xb4cf('0xf2')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xf3'));db[_0xb4cf('0xf4')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xf5'));db[_0xb4cf('0xf6')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xf7'));db[_0xb4cf('0xf8')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xf9'));db[_0xb4cf('0xfa')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xfb'));db[_0xb4cf('0xfc')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0xfd'));db[_0xb4cf('0xfe')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0xff'));db[_0xb4cf('0x100')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x101'));db[_0xb4cf('0x102')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/notification/notification.model');db[_0xb4cf('0x103')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')](_0xb4cf('0x104'));db[_0xb4cf('0x105')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x106'));db[_0xb4cf('0x107')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xb4cf('0x108')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x109'));db[_0xb4cf('0x10a')]=db['sequelize'][_0xb4cf('0x13')](_0xb4cf('0x10b'));db[_0xb4cf('0x10c')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x10d'));db[_0xb4cf('0x10e')]=db[_0xb4cf('0x4')][_0xb4cf('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0xb4cf('0x10f')]=db[_0xb4cf('0x4')]['import'](_0xb4cf('0x110'));db[_0xb4cf('0x12')][_0xb4cf('0x111')](db[_0xb4cf('0x112')],{'as':_0xb4cf('0x112'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')]['hasMany'](db[_0xb4cf('0x1d')],{'as':'Recordings','foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')][_0xb4cf('0x115')](db[_0xb4cf('0x2c')],{'as':_0xb4cf('0x116'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')]['hasMany'](db[_0xb4cf('0x18')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xb4cf('0x12')][_0xb4cf('0x115')](db[_0xb4cf('0x79')],{'as':_0xb4cf('0x117'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')]['hasMany'](db[_0xb4cf('0x7b')],{'as':_0xb4cf('0x118'),'foreignKey':_0xb4cf('0x114')});db['User'][_0xb4cf('0x115')](db[_0xb4cf('0x7c')],{'as':_0xb4cf('0x7c'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')][_0xb4cf('0x115')](db[_0xb4cf('0x61')],{'as':_0xb4cf('0x119'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')][_0xb4cf('0x115')](db[_0xb4cf('0x11a')],{'as':'ChatInteractions','foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')][_0xb4cf('0x115')](db[_0xb4cf('0x58')],{'as':_0xb4cf('0x11b'),'foreignKey':'UserId'});db[_0xb4cf('0x12')]['hasMany'](db[_0xb4cf('0x4d')],{'as':_0xb4cf('0x11c'),'foreignKey':'UserId'});db['User'][_0xb4cf('0x115')](db['MailInteraction'],{'as':_0xb4cf('0x11d'),'foreignKey':_0xb4cf('0x114')});db['User'][_0xb4cf('0x115')](db[_0xb4cf('0x107')],{'as':_0xb4cf('0x11e'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x12')][_0xb4cf('0x115')](db[_0xb4cf('0x102')],{'as':_0xb4cf('0x11f'),'foreignKey':'SenderId'});db[_0xb4cf('0x12')][_0xb4cf('0x120')](db[_0xb4cf('0xfc')],{'as':_0xb4cf('0xfc'),'foreignKey':_0xb4cf('0x121')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x123')],{'as':_0xb4cf('0x124'),'through':'chat_group_has_users'});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x125')],{'as':'Contacts','through':_0xb4cf('0x126')});db[_0xb4cf('0x12')]['belongsToMany'](db[_0xb4cf('0xf8')],{'as':'Lists','through':_0xb4cf('0x127')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x128')],{'through':'user_has_teams'});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db['MailInteraction'],{'as':_0xb4cf('0x11d'),'through':_0xb4cf('0x129')});db[_0xb4cf('0x12')]['belongsToMany'](db[_0xb4cf('0x11a')],{'as':_0xb4cf('0x12a'),'through':_0xb4cf('0x12b')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x4d')],{'as':_0xb4cf('0x11c'),'through':_0xb4cf('0x12c')});db['User']['belongsToMany'](db[_0xb4cf('0x58')],{'as':_0xb4cf('0x11b'),'through':'user_has_sms_interactions'});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x61')],{'as':'OpenchannelInteractions','through':_0xb4cf('0x12d')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x107')],{'as':_0xb4cf('0x11e'),'through':_0xb4cf('0x12e')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x12f')],{'as':_0xb4cf('0x130'),'through':_0xb4cf('0x2e'),'required':![]});db['User'][_0xb4cf('0x122')](db[_0xb4cf('0x131')],{'as':_0xb4cf('0x132'),'through':'UserMailQueue','required':![]});db[_0xb4cf('0x12')]['belongsToMany'](db[_0xb4cf('0x71')],{'as':'ChatQueues','through':_0xb4cf('0x30'),'required':![],'hooks':!![]});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x51')],{'as':_0xb4cf('0x133'),'through':'UserFaxQueue','required':![]});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x5c')],{'as':_0xb4cf('0x134'),'through':'UserSmsQueue','required':![]});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x64')],{'as':_0xb4cf('0x135'),'through':_0xb4cf('0x36'),'required':![]});db['User']['belongsToMany'](db['WhatsappQueue'],{'as':_0xb4cf('0x136'),'through':_0xb4cf('0x37'),'required':![]});db['User'][_0xb4cf('0x122')](db['CmList'],{'through':_0xb4cf('0x127')});db[_0xb4cf('0x12')]['belongsToMany'](db[_0xb4cf('0xfa')],{'as':_0xb4cf('0x137'),'through':_0xb4cf('0x138'),'required':![]});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x66')],{'as':_0xb4cf('0x139'),'through':'user_has_chat_websites'});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x4b')],{'as':'FaxAccounts','through':_0xb4cf('0x13a')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x3c')],{'as':_0xb4cf('0x13b'),'through':_0xb4cf('0x13c')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x13d')],{'as':'OpenchannelAccounts','through':_0xb4cf('0x13e')});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db['SmsAccount'],{'as':_0xb4cf('0x13f'),'through':'user_has_sms_accounts'});db[_0xb4cf('0x12')][_0xb4cf('0x122')](db[_0xb4cf('0x103')],{'as':_0xb4cf('0x140'),'through':_0xb4cf('0x141')});db[_0xb4cf('0x12')]['belongsToMany'](db[_0xb4cf('0xe1')],{'as':_0xb4cf('0x142'),'through':_0xb4cf('0x143')});db[_0xb4cf('0x15')]['hasMany'](db['VoiceExtension'],{'as':_0xb4cf('0x144'),'onDelete':_0xb4cf('0x113'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0xb4cf('0x18')],{'onDelete':_0xb4cf('0x113')});db['VoiceExtension'][_0xb4cf('0x115')](db[_0xb4cf('0x18')],{'as':_0xb4cf('0x145'),'onDelete':_0xb4cf('0x113')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xb4cf('0x146')],{'as':_0xb4cf('0x147'),'through':'moh_has_sounds'});db[_0xb4cf('0x12f')][_0xb4cf('0x115')](db[_0xb4cf('0x2c')],{'as':'Members','foreignKey':_0xb4cf('0x148')});db['VoiceQueue'][_0xb4cf('0x115')](db[_0xb4cf('0x149')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0xb4cf('0x12f')]['hasMany'](db[_0xb4cf('0x79')],{'as':_0xb4cf('0x117'),'foreignKey':_0xb4cf('0x148')});db[_0xb4cf('0x12f')]['hasMany'](db[_0xb4cf('0x7b')],{'as':_0xb4cf('0x14a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xb4cf('0x115')](db[_0xb4cf('0x7c')],{'as':_0xb4cf('0x7c'),'foreignKey':_0xb4cf('0x148')});db[_0xb4cf('0x12f')]['hasMany'](db[_0xb4cf('0x77')],{'as':_0xb4cf('0x14b'),'foreignKey':_0xb4cf('0x148')});db[_0xb4cf('0x12f')][_0xb4cf('0x115')](db[_0xb4cf('0xd7')],{'as':_0xb4cf('0x14c'),'foreignKey':_0xb4cf('0x148')});db['VoiceQueue'][_0xb4cf('0x120')](db[_0xb4cf('0x14d')],{'as':'Trunk','foreignKey':_0xb4cf('0x14e')});db[_0xb4cf('0x12f')]['belongsTo'](db[_0xb4cf('0x14d')],{'as':_0xb4cf('0x14f'),'foreignKey':_0xb4cf('0x150')});db[_0xb4cf('0x12f')][_0xb4cf('0x120')](db[_0xb4cf('0x88')],{'as':_0xb4cf('0x88'),'foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x12f')][_0xb4cf('0x120')](db[_0xb4cf('0x8a')],{'as':_0xb4cf('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb4cf('0x12f')][_0xb4cf('0x122')](db[_0xb4cf('0xf8')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xb4cf('0x12f')]['belongsToMany'](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x2e')});db[_0xb4cf('0x12f')]['belongsToMany'](db[_0xb4cf('0x128')],{'as':_0xb4cf('0x154'),'through':_0xb4cf('0x155')});db[_0xb4cf('0x12f')][_0xb4cf('0x122')](db['CmList'],{'as':'BlackLists','through':_0xb4cf('0x156')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0xb4cf('0x12'),'foreignKey':'UserId'});db['ScreenRecording'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x12'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x112')][_0xb4cf('0x115')](db[_0xb4cf('0x21')],{'as':_0xb4cf('0x157'),'onDelete':'cascade','foreignKey':_0xb4cf('0x158'),'sourceKey':_0xb4cf('0x159')});db[_0xb4cf('0x21')]['belongsTo'](db[_0xb4cf('0x112')],{'foreignKey':_0xb4cf('0x158'),'targetKey':_0xb4cf('0x159')});db[_0xb4cf('0x23')]['hasMany'](db['VoiceQueueReport'],{'as':_0xb4cf('0x15a'),'foreignKey':_0xb4cf('0x15b'),'constraints':![]});db['VoiceCallReport'][_0xb4cf('0x115')](db[_0xb4cf('0x15c')],{'as':_0xb4cf('0x15d'),'foreignKey':_0xb4cf('0x15b'),'constraints':![]});db[_0xb4cf('0x23')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x12'),'foreignKey':_0xb4cf('0x114')});db['VoiceCallReport']['belongsTo'](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':'ContactId'});db['MailServerIn']['belongsTo'](db[_0xb4cf('0x3c')],{'as':_0xb4cf('0x3c'),'foreignKey':_0xb4cf('0x15f')});db[_0xb4cf('0x160')][_0xb4cf('0x120')](db[_0xb4cf('0x3c')],{'as':_0xb4cf('0x3c'),'foreignKey':_0xb4cf('0x15f')});db[_0xb4cf('0x3c')]['hasOne'](db[_0xb4cf('0x39')],{'as':'Imap','onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x3c')][_0xb4cf('0x111')](db[_0xb4cf('0x160')],{'as':'Smtp','onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x3c')][_0xb4cf('0x115')](db[_0xb4cf('0x85')],{'as':_0xb4cf('0x161'),'foreignKey':'MailAccountId'});db[_0xb4cf('0x3c')][_0xb4cf('0x115')](db['CannedAnswer'],{'as':_0xb4cf('0x162'),'foreignKey':'MailAccountId'});db[_0xb4cf('0x3c')][_0xb4cf('0x115')](db['MailMessage'],{'as':_0xb4cf('0x157'),'foreignKey':_0xb4cf('0x15f')});db['MailAccount']['hasMany'](db[_0xb4cf('0x40')],{'as':_0xb4cf('0x163')});db['MailAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x43')],{'as':_0xb4cf('0x145')});db[_0xb4cf('0x3c')][_0xb4cf('0x120')](db['CmList'],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0x3c')][_0xb4cf('0x120')](db['Template'],{'as':_0xb4cf('0x93'),'foreignKey':_0xb4cf('0x166')});db[_0xb4cf('0x3c')][_0xb4cf('0x120')](db[_0xb4cf('0x8a')],{'as':_0xb4cf('0x152'),'foreignKey':_0xb4cf('0x167')});db['MailAccount'][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x13c')});db[_0xb4cf('0x131')]['belongsToMany'](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':'UserMailQueue'});db['MailQueue'][_0xb4cf('0x122')](db[_0xb4cf('0x128')],{'through':_0xb4cf('0x168'),'as':'Teams'});db[_0xb4cf('0x40')][_0xb4cf('0x115')](db['MailMessage'],{'as':_0xb4cf('0x157'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xb4cf('0x40')][_0xb4cf('0x120')](db['MailAccount'],{'as':_0xb4cf('0x169'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db[_0xb4cf('0x40')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16b'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x40')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x16c'),'as':_0xb4cf('0x16d')});db[_0xb4cf('0x40')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x16c'),'as':_0xb4cf('0x16e')});db[_0xb4cf('0x40')][_0xb4cf('0x122')](db['User'],{'as':_0xb4cf('0x16f'),'through':_0xb4cf('0x129'),'foreignKey':_0xb4cf('0x170')});db['MailMessage']['hasMany'](db[_0xb4cf('0xea')],{'as':_0xb4cf('0x171'),'onDelete':_0xb4cf('0x113')});db['MailMessage'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x12')});db[_0xb4cf('0x42')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x15e')});db[_0xb4cf('0x42')][_0xb4cf('0x120')](db[_0xb4cf('0x40')],{'as':_0xb4cf('0x172'),'foreignKey':_0xb4cf('0x170')});db[_0xb4cf('0x42')][_0xb4cf('0x120')](db[_0xb4cf('0x3c')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xb4cf('0x43')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x43')][_0xb4cf('0x120')](db[_0xb4cf('0x131')],{'onDelete':'restrict'});db['MailApplication'][_0xb4cf('0x120')](db[_0xb4cf('0x3c')],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x43')][_0xb4cf('0x120')](db[_0xb4cf('0x88')],{'onDelete':_0xb4cf('0x173'),'foreignKey':'IntervalId'});db[_0xb4cf('0x43')][_0xb4cf('0x120')](db[_0xb4cf('0x91')],{'onDelete':_0xb4cf('0x173'),'foreignKey':_0xb4cf('0x174')});db[_0xb4cf('0x45')]['belongsTo'](db[_0xb4cf('0x3c')],{});db['MailQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165')});db['MailQueueReport']['belongsTo'](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':'ContactId'});db['MailQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0x40')],{});db[_0xb4cf('0x45')][_0xb4cf('0x120')](db[_0xb4cf('0x42')],{});db[_0xb4cf('0x45')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{});db[_0xb4cf('0x45')]['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0xb4cf('0x115')](db[_0xb4cf('0x49')],{'as':_0xb4cf('0x175'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x4b')][_0xb4cf('0x115')](db[_0xb4cf('0x85')],{'as':_0xb4cf('0x161'),'foreignKey':_0xb4cf('0x176')});db[_0xb4cf('0x4b')][_0xb4cf('0x115')](db[_0xb4cf('0x84')],{'as':_0xb4cf('0x162'),'foreignKey':_0xb4cf('0x176')});db[_0xb4cf('0x4b')]['hasMany'](db[_0xb4cf('0x4d')],{'as':_0xb4cf('0x163')});db['FaxAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x4c')],{'as':'Applications'});db[_0xb4cf('0x4b')][_0xb4cf('0x115')](db[_0xb4cf('0x18')],{'as':_0xb4cf('0x177'),'onDelete':_0xb4cf('0x113')});db['FaxAccount']['hasMany'](db[_0xb4cf('0x4f')],{'as':_0xb4cf('0x157')});db[_0xb4cf('0x4b')][_0xb4cf('0x120')](db[_0xb4cf('0x14d')],{'as':_0xb4cf('0x14d')});db['FaxAccount'][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165')});db['FaxAccount'][_0xb4cf('0x120')](db['Pause'],{'as':_0xb4cf('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb4cf('0x4b')]['belongsToMany'](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0xb4cf('0x12')],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x4c')][_0xb4cf('0x120')](db[_0xb4cf('0x51')],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x4c')]['belongsTo'](db['FaxAccount'],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x4c')][_0xb4cf('0x120')](db[_0xb4cf('0x91')],{'onDelete':_0xb4cf('0x173'),'foreignKey':'TagId'});db[_0xb4cf('0x4d')][_0xb4cf('0x115')](db[_0xb4cf('0x4f')],{'as':_0xb4cf('0x157'),'onDelete':'cascade','foreignKey':_0xb4cf('0x178')});db['FaxInteraction'][_0xb4cf('0x120')](db['FaxAccount'],{'as':_0xb4cf('0x169'),'foreignKey':'FaxAccountId'});db[_0xb4cf('0x4d')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db['FaxInteraction'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16b'),'foreignKey':'UserId'});db[_0xb4cf('0x4d')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x179'),'as':'Tags'});db[_0xb4cf('0x4d')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x179'),'as':_0xb4cf('0x16e')});db[_0xb4cf('0x4d')][_0xb4cf('0x122')](db['User'],{'as':_0xb4cf('0x16f'),'through':'user_has_fax_interactions','foreignKey':_0xb4cf('0x178')});db[_0xb4cf('0x4f')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x12')});db[_0xb4cf('0x4f')][_0xb4cf('0x120')](db['FaxInteraction'],{'as':_0xb4cf('0x172'),'foreignKey':_0xb4cf('0x178')});db[_0xb4cf('0x4f')][_0xb4cf('0x120')](db['CmContact'],{'onDelete':'cascade','as':_0xb4cf('0x15e')});db['FaxMessage'][_0xb4cf('0x120')](db[_0xb4cf('0xea')],{'as':_0xb4cf('0xea'),'foreignKey':'AttachmentId'});db[_0xb4cf('0x4f')][_0xb4cf('0x120')](db[_0xb4cf('0x4b')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x176')});db[_0xb4cf('0x51')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x34')});db['FaxQueue'][_0xb4cf('0x122')](db[_0xb4cf('0x128')],{'through':_0xb4cf('0x17a'),'as':_0xb4cf('0x154')});db[_0xb4cf('0x52')][_0xb4cf('0x120')](db[_0xb4cf('0x4b')],{});db[_0xb4cf('0x52')][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':'List','foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0x52')]['belongsTo'](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db[_0xb4cf('0x52')][_0xb4cf('0x120')](db[_0xb4cf('0x4d')],{});db[_0xb4cf('0x52')][_0xb4cf('0x120')](db[_0xb4cf('0x4f')],{});db[_0xb4cf('0x52')]['belongsTo'](db['User'],{});db[_0xb4cf('0x52')][_0xb4cf('0x120')](db[_0xb4cf('0x51')],{});db[_0xb4cf('0x54')][_0xb4cf('0x115')](db[_0xb4cf('0x85')],{'as':'Dispositions','foreignKey':_0xb4cf('0x17b')});db[_0xb4cf('0x54')][_0xb4cf('0x115')](db[_0xb4cf('0x84')],{'as':_0xb4cf('0x162'),'foreignKey':_0xb4cf('0x17b')});db[_0xb4cf('0x54')][_0xb4cf('0x115')](db[_0xb4cf('0x5a')],{'as':'Messages','foreignKey':_0xb4cf('0x17b')});db['SmsAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x58')],{'as':_0xb4cf('0x163')});db['SmsAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x56')],{'as':_0xb4cf('0x145')});db[_0xb4cf('0x54')][_0xb4cf('0x120')](db['CmList'],{'as':'List','foreignKey':_0xb4cf('0x165')});db['SmsAccount'][_0xb4cf('0x120')](db[_0xb4cf('0x8a')],{'as':_0xb4cf('0x152'),'foreignKey':_0xb4cf('0x167')});db['SmsAccount']['belongsToMany'](db['User'],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x17c')});db[_0xb4cf('0x56')][_0xb4cf('0x120')](db['User'],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x56')][_0xb4cf('0x120')](db[_0xb4cf('0x5c')],{'onDelete':'restrict'});db[_0xb4cf('0x56')][_0xb4cf('0x120')](db[_0xb4cf('0x54')],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x56')][_0xb4cf('0x120')](db['Interval'],{'onDelete':_0xb4cf('0x173'),'foreignKey':'IntervalId'});db[_0xb4cf('0x56')][_0xb4cf('0x120')](db[_0xb4cf('0x91')],{'onDelete':_0xb4cf('0x173'),'foreignKey':'TagId'});db[_0xb4cf('0x58')][_0xb4cf('0x115')](db['SmsMessage'],{'as':_0xb4cf('0x157'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x17d')});db[_0xb4cf('0x58')][_0xb4cf('0x120')](db[_0xb4cf('0x54')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xb4cf('0x58')][_0xb4cf('0x120')](db['CmContact'],{'as':'Contact','foreignKey':_0xb4cf('0x16a')});db['SmsInteraction'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16b'),'foreignKey':_0xb4cf('0x114')});db['SmsInteraction'][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x17e'),'as':_0xb4cf('0x16d')});db['SmsInteraction'][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x17e'),'as':_0xb4cf('0x16e')});db['SmsInteraction'][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16f'),'through':_0xb4cf('0x17f'),'foreignKey':_0xb4cf('0x17d')});db[_0xb4cf('0x5a')]['belongsTo'](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x12')});db[_0xb4cf('0x5a')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x15e')});db[_0xb4cf('0x5a')][_0xb4cf('0x120')](db[_0xb4cf('0x58')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x172'),'foreignKey':_0xb4cf('0x17d')});db[_0xb4cf('0x5a')]['belongsTo'](db['SmsAccount'],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x17b')});db['SmsQueue'][_0xb4cf('0x122')](db['User'],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x35'),'foreignKey':_0xb4cf('0x180')});db[_0xb4cf('0x5c')]['belongsToMany'](db[_0xb4cf('0x128')],{'through':_0xb4cf('0x181'),'as':_0xb4cf('0x154')});db[_0xb4cf('0x13d')][_0xb4cf('0x115')](db[_0xb4cf('0x85')],{'as':_0xb4cf('0x161'),'foreignKey':_0xb4cf('0x182')});db['OpenchannelAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x84')],{'as':'Answers','foreignKey':_0xb4cf('0x182')});db[_0xb4cf('0x13d')][_0xb4cf('0x115')](db[_0xb4cf('0x61')],{'as':_0xb4cf('0x163'),'foreignKey':_0xb4cf('0x182')});db[_0xb4cf('0x13d')][_0xb4cf('0x115')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xb4cf('0x182')});db[_0xb4cf('0x13d')][_0xb4cf('0x115')](db[_0xb4cf('0x5f')],{'as':_0xb4cf('0x145'),'foreignKey':_0xb4cf('0x182')});db['OpenchannelAccount'][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':'List','foreignKey':'ListId'});db[_0xb4cf('0x13d')][_0xb4cf('0x120')](db['Pause'],{'as':_0xb4cf('0x152'),'foreignKey':_0xb4cf('0x167')});db[_0xb4cf('0x13d')][_0xb4cf('0x122')](db['User'],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x13e')});db[_0xb4cf('0x5f')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'onDelete':'restrict'});db[_0xb4cf('0x5f')][_0xb4cf('0x120')](db['OpenchannelQueue'],{'onDelete':_0xb4cf('0x173'),'foreignKey':_0xb4cf('0x183')});db[_0xb4cf('0x5f')]['belongsTo'](db[_0xb4cf('0x13d')],{'onDelete':_0xb4cf('0x173'),'foreignKey':_0xb4cf('0x182')});db[_0xb4cf('0x5f')][_0xb4cf('0x120')](db[_0xb4cf('0x88')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xb4cf('0x5f')][_0xb4cf('0x120')](db[_0xb4cf('0x91')],{'onDelete':_0xb4cf('0x173'),'foreignKey':_0xb4cf('0x174')});db[_0xb4cf('0x61')]['hasMany'](db[_0xb4cf('0x184')],{'as':_0xb4cf('0x157'),'onDelete':_0xb4cf('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0xb4cf('0x61')][_0xb4cf('0x120')](db['OpenchannelAccount'],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x182')});db[_0xb4cf('0x61')][_0xb4cf('0x120')](db['CmContact'],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db['OpenchannelInteraction'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16b'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x61')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x185'),'as':_0xb4cf('0x16d')});db[_0xb4cf('0x61')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x185'),'as':_0xb4cf('0x16e')});db[_0xb4cf('0x61')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16f'),'through':_0xb4cf('0x12d'),'foreignKey':'OpenchannelInteractionId'});db[_0xb4cf('0x184')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'onDelete':'cascade','as':_0xb4cf('0x12')});db[_0xb4cf('0x184')][_0xb4cf('0x120')](db['CmContact'],{'onDelete':_0xb4cf('0x113'),'as':'Contact'});db[_0xb4cf('0x184')]['belongsTo'](db[_0xb4cf('0x61')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x172'),'foreignKey':_0xb4cf('0x186')});db[_0xb4cf('0x184')][_0xb4cf('0x120')](db[_0xb4cf('0xea')],{'as':_0xb4cf('0xea'),'foreignKey':_0xb4cf('0x187')});db[_0xb4cf('0x184')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xb4cf('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x36'),'foreignKey':_0xb4cf('0x183')});db[_0xb4cf('0x64')][_0xb4cf('0x122')](db[_0xb4cf('0x128')],{'through':'team_has_openchannel_queues','as':_0xb4cf('0x154')});db[_0xb4cf('0x66')][_0xb4cf('0x115')](db[_0xb4cf('0x85')],{'as':_0xb4cf('0x161'),'foreignKey':_0xb4cf('0x188')});db[_0xb4cf('0x66')]['hasMany'](db[_0xb4cf('0x84')],{'as':_0xb4cf('0x162'),'foreignKey':_0xb4cf('0x188')});db['ChatWebsite'][_0xb4cf('0x115')](db[_0xb4cf('0x189')],{'as':_0xb4cf('0x18a')});db['ChatWebsite'][_0xb4cf('0x115')](db[_0xb4cf('0x11a')],{'as':_0xb4cf('0x163')});db[_0xb4cf('0x66')]['hasMany'](db[_0xb4cf('0x6a')],{'as':_0xb4cf('0x145')});db[_0xb4cf('0x66')][_0xb4cf('0x115')](db['ChatMessage'],{'as':_0xb4cf('0x157')});db[_0xb4cf('0x66')]['belongsTo'](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':'ListId'});db[_0xb4cf('0x66')][_0xb4cf('0x120')](db['Interval'],{'as':'Interval','foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x66')][_0xb4cf('0x120')](db['Pause'],{'as':_0xb4cf('0x152'),'foreignKey':_0xb4cf('0x167')});db[_0xb4cf('0x66')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':'user_has_chat_websites'});db[_0xb4cf('0x68')][_0xb4cf('0x120')](db[_0xb4cf('0x13d')],{});db[_0xb4cf('0x68')][_0xb4cf('0x120')](db['CmList'],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0x68')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':'ContactId'});db[_0xb4cf('0x68')][_0xb4cf('0x120')](db[_0xb4cf('0x61')],{});db['OpenchannelQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0x184')],{});db['OpenchannelQueueReport'][_0xb4cf('0x120')](db['User'],{});db[_0xb4cf('0x68')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x18b'),'foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xb4cf('0x71')],{'as':'Queue','foreignKey':_0xb4cf('0x18c'),'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x6a')][_0xb4cf('0x120')](db[_0xb4cf('0x66')],{'as':_0xb4cf('0x18d'),'foreignKey':_0xb4cf('0x188'),'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x6a')][_0xb4cf('0x120')](db[_0xb4cf('0x91')],{'onDelete':_0xb4cf('0x173'),'foreignKey':_0xb4cf('0x174')});db[_0xb4cf('0x11a')][_0xb4cf('0x115')](db[_0xb4cf('0x6d')],{'as':_0xb4cf('0x157'),'onDelete':_0xb4cf('0x113'),'foreignKey':'ChatInteractionId'});db[_0xb4cf('0x11a')][_0xb4cf('0x120')](db[_0xb4cf('0x66')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x188')});db[_0xb4cf('0x11a')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb4cf('0x11a')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16b'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x11a')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x18e'),'as':_0xb4cf('0x16d')});db[_0xb4cf('0x11a')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x18e'),'as':_0xb4cf('0x16e')});db['ChatInteraction'][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16f'),'through':_0xb4cf('0x12b'),'foreignKey':_0xb4cf('0x18f')});db[_0xb4cf('0x6d')][_0xb4cf('0x120')](db['User'],{'onDelete':'cascade','as':_0xb4cf('0x12')});db[_0xb4cf('0x6d')][_0xb4cf('0x120')](db['CmContact'],{'onDelete':_0xb4cf('0x113'),'as':'Contact','foreignKey':'ContactId'});db[_0xb4cf('0x6d')][_0xb4cf('0x120')](db[_0xb4cf('0x11a')],{'onDelete':_0xb4cf('0x113'),'as':'Interaction','foreignKey':_0xb4cf('0x18f')});db[_0xb4cf('0x6d')]['belongsTo'](db[_0xb4cf('0xea')],{'as':'Attachment','foreignKey':_0xb4cf('0x187')});db[_0xb4cf('0x6d')]['belongsTo'](db[_0xb4cf('0x66')],{'as':_0xb4cf('0x169'),'foreignKey':'ChatWebsiteId'});db[_0xb4cf('0x6f')]['belongsTo'](db['CmContact'],{'onDelete':_0xb4cf('0x113'),'as':'Contact','foreignKey':_0xb4cf('0x16a')});db['ChatOfflineMessage'][_0xb4cf('0x120')](db[_0xb4cf('0x66')],{'as':_0xb4cf('0x169'),'foreignKey':'ChatWebsiteId'});db[_0xb4cf('0x71')]['belongsToMany'](db['User'],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x30'),'hooks':!![]});db[_0xb4cf('0x71')][_0xb4cf('0x122')](db['Team'],{'through':_0xb4cf('0x190'),'as':_0xb4cf('0x154')});db[_0xb4cf('0x123')]['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x123')]['belongsToMany'](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x191'),'through':_0xb4cf('0x192')});db[_0xb4cf('0x189')][_0xb4cf('0x120')](db[_0xb4cf('0x66')],{'as':_0xb4cf('0x18d'),'foreignKey':_0xb4cf('0x188')});db[_0xb4cf('0x74')]['hasMany'](db['CmContact'],{'as':_0xb4cf('0x193'),'foreignKey':_0xb4cf('0x194')});db[_0xb4cf('0x125')]['hasMany'](db[_0xb4cf('0x149')],{'as':_0xb4cf('0x195'),'foreignKey':_0xb4cf('0x16a')});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db[_0xb4cf('0x79')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xb4cf('0x125')]['hasMany'](db[_0xb4cf('0x7b')],{'as':_0xb4cf('0x14a'),'foreignKey':'ContactId'});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xb4cf('0x125')]['hasMany'](db[_0xb4cf('0xd7')],{'as':_0xb4cf('0x14c'),'foreignKey':_0xb4cf('0x16a')});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db[_0xb4cf('0x61')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db[_0xb4cf('0x11a')],{'as':_0xb4cf('0x12a'),'foreignKey':_0xb4cf('0x16a'),'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db[_0xb4cf('0x58')],{'as':_0xb4cf('0x11b'),'foreignKey':'ContactId','onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db[_0xb4cf('0x4d')],{'as':_0xb4cf('0x11c'),'foreignKey':_0xb4cf('0x16a'),'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x125')][_0xb4cf('0x115')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x125')][_0xb4cf('0x120')](db[_0xb4cf('0x74')],{'as':_0xb4cf('0x196'),'foreignKey':'CompanyId'});db[_0xb4cf('0x125')][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x125')]['belongsToMany'](db['User'],{'as':_0xb4cf('0x16f'),'through':_0xb4cf('0x126')});db['CmContact'][_0xb4cf('0x122')](db['Tag'],{'as':_0xb4cf('0x16d'),'through':_0xb4cf('0x197')});db[_0xb4cf('0x125')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x197'),'as':_0xb4cf('0x16e')});db[_0xb4cf('0x149')][_0xb4cf('0x120')](db['CmContact'],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a'),'onDelete':'cascade'});db[_0xb4cf('0x149')][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165'),'onDelete':_0xb4cf('0x113')});db['CmHopper'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x18b'),'foreignKey':_0xb4cf('0x114')});db[_0xb4cf('0x149')]['belongsTo'](db[_0xb4cf('0x12f')],{'as':_0xb4cf('0x198'),'foreignKey':_0xb4cf('0x148'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x149')]['belongsTo'](db[_0xb4cf('0xe8')],{'as':_0xb4cf('0xe8'),'foreignKey':_0xb4cf('0x199'),'onDelete':_0xb4cf('0x113')});db['CmHopper']['belongsTo'](db[_0xb4cf('0x12')],{'as':'Owner','foreignKey':_0xb4cf('0x19a')});db[_0xb4cf('0x77')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x77')]['belongsTo'](db['CmList'],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165'),'onDelete':'cascade'});db[_0xb4cf('0x77')][_0xb4cf('0x120')](db['VoiceQueue'],{'as':_0xb4cf('0x198'),'foreignKey':_0xb4cf('0x148'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x77')][_0xb4cf('0x120')](db[_0xb4cf('0xe8')],{'as':_0xb4cf('0xe8'),'foreignKey':_0xb4cf('0x199'),'onDelete':'cascade'});db['Automation'][_0xb4cf('0x115')](db[_0xb4cf('0x86')],{'as':{'plural':_0xb4cf('0x19b'),'singular':_0xb4cf('0x19c')},'foreignKey':_0xb4cf('0x19d'),'onDelete':_0xb4cf('0x113'),'hooks':!![]});db[_0xb4cf('0x82')][_0xb4cf('0x115')](db[_0xb4cf('0x86')],{'as':{'plural':_0xb4cf('0x19e'),'singular':_0xb4cf('0x19f')},'foreignKey':_0xb4cf('0x1a0'),'onDelete':_0xb4cf('0x113'),'hooks':!![]});db['Automation']['hasMany'](db[_0xb4cf('0x80')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xb4cf('0x113'),'hooks':!![]});db[_0xb4cf('0x85')][_0xb4cf('0x115')](db['Disposition'],{'as':_0xb4cf('0x161'),'foreignKey':_0xb4cf('0x1a1'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0x88')][_0xb4cf('0x115')](db[_0xb4cf('0x88')],{'as':_0xb4cf('0x1a2'),'foreignKey':'IntervalId','onDelete':_0xb4cf('0x113'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xb4cf('0x18')],{'as':_0xb4cf('0x1a3'),'foreignKey':_0xb4cf('0x151'),'onDelete':'restrict'});db['Interval'][_0xb4cf('0x115')](db[_0xb4cf('0x43')],{'as':_0xb4cf('0x1a4'),'foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x88')][_0xb4cf('0x115')](db[_0xb4cf('0x6a')],{'as':_0xb4cf('0x1a5'),'foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x88')][_0xb4cf('0x115')](db['FaxApplication'],{'as':_0xb4cf('0x1a6'),'foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x88')][_0xb4cf('0x115')](db[_0xb4cf('0x56')],{'as':_0xb4cf('0x1a7'),'foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x8e')][_0xb4cf('0x120')](db[_0xb4cf('0x3c')],{});db[_0xb4cf('0x8e')]['belongsTo'](db[_0xb4cf('0x1a8')],{'foreignKey':_0xb4cf('0x1a9')});db['Schedule'][_0xb4cf('0x120')](db[_0xb4cf('0x9c')],{'foreignKey':'CustomReportId'});db['Sound']['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xb4cf('0x1aa'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0xb4cf('0x91')][_0xb4cf('0x122')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xb4cf('0x91')]['belongsToMany'](db[_0xb4cf('0x11a')],{'through':_0xb4cf('0x18e')});db[_0xb4cf('0x91')][_0xb4cf('0x122')](db[_0xb4cf('0x40')],{'through':_0xb4cf('0x16c')});db[_0xb4cf('0x91')][_0xb4cf('0x122')](db[_0xb4cf('0x58')],{'through':_0xb4cf('0x17e')});db[_0xb4cf('0x91')][_0xb4cf('0x122')](db[_0xb4cf('0x4d')],{'through':_0xb4cf('0x179')});db[_0xb4cf('0x91')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xb4cf('0x91')][_0xb4cf('0x122')](db[_0xb4cf('0x107')],{'through':_0xb4cf('0x1ab')});db[_0xb4cf('0x95')][_0xb4cf('0x115')](db[_0xb4cf('0x86')],{'as':{'plural':'AllConditions','singular':_0xb4cf('0x1ac')},'foreignKey':_0xb4cf('0x1ad'),'onDelete':_0xb4cf('0x113'),'hooks':!![]});db[_0xb4cf('0x95')][_0xb4cf('0x115')](db[_0xb4cf('0x86')],{'as':{'plural':_0xb4cf('0x1ae'),'singular':_0xb4cf('0x1af')},'foreignKey':_0xb4cf('0x1b0'),'onDelete':_0xb4cf('0x113'),'hooks':!![]});db[_0xb4cf('0x95')][_0xb4cf('0x115')](db[_0xb4cf('0x80')],{'as':'Actions','foreignKey':_0xb4cf('0x1b1'),'onDelete':_0xb4cf('0x113'),'hooks':!![]});db[_0xb4cf('0x9c')][_0xb4cf('0x115')](db[_0xb4cf('0x1b2')],{'as':_0xb4cf('0x1b3'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xb4cf('0x1a8')][_0xb4cf('0x115')](db[_0xb4cf('0x1b2')],{'as':_0xb4cf('0x1b3'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1a9')});db['AnalyticMetric'][_0xb4cf('0x115')](db[_0xb4cf('0x1b2')],{'as':_0xb4cf('0x1b3'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b4')});db[_0xb4cf('0x1b2')][_0xb4cf('0x120')](db['AnalyticMetric'],{'foreignKey':_0xb4cf('0x1b4')});db[_0xb4cf('0xa3')]['hasMany'](db[_0xb4cf('0x1b5')],{'as':_0xb4cf('0x1b6'),'onDelete':'cascade','foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0x1b5')][_0xb4cf('0x115')](db[_0xb4cf('0xa6')],{'as':_0xb4cf('0x1b8'),'onDelete':_0xb4cf('0x113'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xb4cf('0x115')](db[_0xb4cf('0xa6')],{'as':_0xb4cf('0x1b9'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0x1b5')][_0xb4cf('0x115')](db[_0xb4cf('0xa6')],{'as':'Fields','onDelete':_0xb4cf('0x113'),'foreignKey':'FieldId'});db[_0xb4cf('0x1b5')][_0xb4cf('0x120')](db[_0xb4cf('0xa3')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xa6')][_0xb4cf('0x115')](db[_0xb4cf('0xa6')],{'as':'Subject','foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xa6')][_0xb4cf('0x115')](db[_0xb4cf('0xa6')],{'as':'Description','foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xa6')][_0xb4cf('0x115')](db[_0xb4cf('0xa6')],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xa6')][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db['SugarcrmAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x1bf')],{'as':_0xb4cf('0x1b6'),'onDelete':_0xb4cf('0x113'),'foreignKey':'AccountId'});db[_0xb4cf('0x1bf')][_0xb4cf('0x115')](db[_0xb4cf('0x1c0')],{'as':_0xb4cf('0x1b8'),'onDelete':_0xb4cf('0x113'),'foreignKey':'SubjectId'});db[_0xb4cf('0x1bf')]['hasMany'](db[_0xb4cf('0x1c0')],{'as':_0xb4cf('0x1b9'),'onDelete':'cascade','foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0x1bf')]['hasMany'](db[_0xb4cf('0x1c0')],{'as':_0xb4cf('0x1b3'),'onDelete':_0xb4cf('0x113'),'foreignKey':'FieldId'});db[_0xb4cf('0x1bf')]['belongsTo'](db[_0xb4cf('0xa8')],{'as':'Account','foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0x1c0')][_0xb4cf('0x115')](db[_0xb4cf('0x1c0')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db['SugarcrmField'][_0xb4cf('0x115')](db[_0xb4cf('0x1c0')],{'as':_0xb4cf('0x1c2'),'foreignKey':'DescriptionId'});db[_0xb4cf('0x1c0')][_0xb4cf('0x115')](db[_0xb4cf('0x1c0')],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db['SugarcrmField'][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':'Variable','foreignKey':_0xb4cf('0x1be')});db['DeskAccount'][_0xb4cf('0x115')](db[_0xb4cf('0xad')],{'as':_0xb4cf('0x1b6'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xad')][_0xb4cf('0x115')](db['DeskField'],{'as':_0xb4cf('0x1b8'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1bb')});db['DeskConfiguration'][_0xb4cf('0x115')](db['DeskField'],{'as':'Descriptions','onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1ba')});db['DeskConfiguration'][_0xb4cf('0x115')](db[_0xb4cf('0xae')],{'as':_0xb4cf('0x1b3'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xad')]['belongsTo'](db[_0xb4cf('0x1c3')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xad')]['belongsToMany'](db['Tag'],{'through':_0xb4cf('0x1c4')});db[_0xb4cf('0xae')][_0xb4cf('0x115')](db[_0xb4cf('0xae')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xae')][_0xb4cf('0x115')](db[_0xb4cf('0xae')],{'as':_0xb4cf('0x1c2'),'foreignKey':'DescriptionId'});db['DeskField'][_0xb4cf('0x115')](db[_0xb4cf('0xae')],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xae')][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db[_0xb4cf('0xb0')][_0xb4cf('0x115')](db[_0xb4cf('0xb2')],{'as':_0xb4cf('0x1b6'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xb2')][_0xb4cf('0x115')](db[_0xb4cf('0xb3')],{'as':_0xb4cf('0x1b8'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1bb')});db['ZohoConfiguration'][_0xb4cf('0x115')](db[_0xb4cf('0xb3')],{'as':'Descriptions','onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xb2')][_0xb4cf('0x115')](db[_0xb4cf('0xb3')],{'as':_0xb4cf('0x1b3'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1bd')});db['ZohoConfiguration'][_0xb4cf('0x120')](db[_0xb4cf('0xb0')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1b7')});db['ZohoField']['hasMany'](db[_0xb4cf('0xb3')],{'as':_0xb4cf('0x1c1'),'foreignKey':'SubjectId'});db[_0xb4cf('0xb3')][_0xb4cf('0x115')](db[_0xb4cf('0xb3')],{'as':_0xb4cf('0x1c2'),'foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xb3')][_0xb4cf('0x115')](db[_0xb4cf('0xb3')],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xb3')][_0xb4cf('0x120')](db['Variable'],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db[_0xb4cf('0x1c5')][_0xb4cf('0x115')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0xb4cf('0x113'),'foreignKey':'AccountId'});db[_0xb4cf('0x1c6')][_0xb4cf('0x115')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0x1c6')][_0xb4cf('0x115')](db['ZendeskField'],{'as':_0xb4cf('0x1b9'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xb4cf('0x115')](db[_0xb4cf('0x1c7')],{'as':_0xb4cf('0x1b3'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0x1c6')]['belongsTo'](db[_0xb4cf('0x1c5')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1b7')});db['ZendeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xb4cf('0x1c8')});db[_0xb4cf('0x1c7')][_0xb4cf('0x115')](db[_0xb4cf('0x1c7')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db['ZendeskField'][_0xb4cf('0x115')](db['ZendeskField'],{'as':_0xb4cf('0x1c2'),'foreignKey':_0xb4cf('0x1ba')});db['ZendeskField'][_0xb4cf('0x115')](db['ZendeskField'],{'as':'Field','foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0x1c7')][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':'Variable','foreignKey':_0xb4cf('0x1be')});db[_0xb4cf('0xb7')]['hasMany'](db[_0xb4cf('0xb9')],{'as':_0xb4cf('0x1b6'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b7')});db['FreshdeskConfiguration'][_0xb4cf('0x115')](db[_0xb4cf('0xba')],{'as':_0xb4cf('0x1b8'),'onDelete':_0xb4cf('0x113'),'foreignKey':'SubjectId'});db[_0xb4cf('0xb9')][_0xb4cf('0x115')](db[_0xb4cf('0xba')],{'as':_0xb4cf('0x1b9'),'onDelete':'cascade','foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xb9')]['hasMany'](db[_0xb4cf('0xba')],{'as':_0xb4cf('0x1b3'),'onDelete':_0xb4cf('0x113'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xb4cf('0x120')](db[_0xb4cf('0xb7')],{'as':_0xb4cf('0x169'),'foreignKey':'AccountId'});db[_0xb4cf('0xb9')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x1c9')});db[_0xb4cf('0xba')][_0xb4cf('0x115')](db['FreshdeskField'],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db['FreshdeskField'][_0xb4cf('0x115')](db[_0xb4cf('0xba')],{'as':'Description','foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xba')][_0xb4cf('0x115')](db['FreshdeskField'],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xba')][_0xb4cf('0x120')](db['Variable'],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db['VtigerAccount']['hasMany'](db[_0xb4cf('0xbe')],{'as':'Configurations','onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b7')});db['VtigerConfiguration'][_0xb4cf('0x115')](db[_0xb4cf('0xc0')],{'as':_0xb4cf('0x1b8'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xbe')][_0xb4cf('0x115')](db[_0xb4cf('0xc0')],{'as':_0xb4cf('0x1b9'),'foreignKey':_0xb4cf('0x1ba')});db['VtigerConfiguration']['hasMany'](db[_0xb4cf('0xc0')],{'as':'Fields','foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xbe')]['belongsTo'](db[_0xb4cf('0xbc')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xc0')][_0xb4cf('0x115')](db[_0xb4cf('0xc0')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xc0')]['hasMany'](db['VtigerField'],{'as':_0xb4cf('0x1c2'),'foreignKey':'DescriptionId'});db[_0xb4cf('0xc0')][_0xb4cf('0x115')](db[_0xb4cf('0xc0')],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xc0')][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db[_0xb4cf('0xc2')]['hasMany'](db[_0xb4cf('0x1ca')],{'as':_0xb4cf('0x1b6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xb4cf('0x1ca')][_0xb4cf('0x115')](db['ServicenowField'],{'as':_0xb4cf('0x1b8'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0x1ca')]['hasMany'](db['ServicenowField'],{'as':_0xb4cf('0x1b9'),'foreignKey':'DescriptionId'});db[_0xb4cf('0x1ca')][_0xb4cf('0x115')](db[_0xb4cf('0xc5')],{'as':'Fields','foreignKey':_0xb4cf('0x1bd')});db['ServicenowConfiguration']['belongsTo'](db[_0xb4cf('0xc2')],{'as':'Account','foreignKey':'AccountId'});db[_0xb4cf('0xc5')][_0xb4cf('0x115')](db[_0xb4cf('0xc5')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xc5')][_0xb4cf('0x115')](db['ServicenowField'],{'as':_0xb4cf('0x1c2'),'foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xc5')][_0xb4cf('0x115')](db[_0xb4cf('0xc5')],{'as':'Field','foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xc5')][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db[_0xb4cf('0xc7')]['hasMany'](db[_0xb4cf('0xc9')],{'as':'Configurations','onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xc9')][_0xb4cf('0x115')](db[_0xb4cf('0xcb')],{'as':_0xb4cf('0x1b8'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1bb')});db['Dynamics365Configuration'][_0xb4cf('0x115')](db[_0xb4cf('0xcb')],{'as':_0xb4cf('0x1b9'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1ba')});db['Dynamics365Configuration']['hasMany'](db[_0xb4cf('0xcb')],{'as':_0xb4cf('0x1b3'),'onDelete':'cascade','foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xc9')]['belongsTo'](db[_0xb4cf('0xc7')],{'as':_0xb4cf('0x169'),'foreignKey':'AccountId'});db[_0xb4cf('0xcb')][_0xb4cf('0x115')](db[_0xb4cf('0xcb')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xcb')][_0xb4cf('0x115')](db['Dynamics365Field'],{'as':_0xb4cf('0x1c2'),'foreignKey':_0xb4cf('0x1ba')});db['Dynamics365Field'][_0xb4cf('0x115')](db[_0xb4cf('0xcb')],{'as':_0xb4cf('0x1bc'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xcb')]['belongsTo'](db[_0xb4cf('0x97')],{'as':_0xb4cf('0x97'),'foreignKey':_0xb4cf('0x1be')});db[_0xb4cf('0xcd')]['hasMany'](db[_0xb4cf('0xcf')],{'as':_0xb4cf('0x1b6'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0xcf')]['hasMany'](db['FreshsalesField'],{'as':_0xb4cf('0x1b8'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0xcf')][_0xb4cf('0x115')](db[_0xb4cf('0x1cb')],{'as':_0xb4cf('0x1b9'),'foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0xcf')][_0xb4cf('0x115')](db[_0xb4cf('0x1cb')],{'as':_0xb4cf('0x1b3'),'foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0xcf')]['belongsTo'](db[_0xb4cf('0xcd')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1b7')});db[_0xb4cf('0x1cb')][_0xb4cf('0x115')](db[_0xb4cf('0x1cb')],{'as':_0xb4cf('0x1c1'),'foreignKey':_0xb4cf('0x1bb')});db[_0xb4cf('0x1cb')]['hasMany'](db[_0xb4cf('0x1cb')],{'as':_0xb4cf('0x1c2'),'foreignKey':_0xb4cf('0x1ba')});db[_0xb4cf('0x1cb')][_0xb4cf('0x115')](db[_0xb4cf('0x1cb')],{'as':'Field','foreignKey':_0xb4cf('0x1bd')});db[_0xb4cf('0x1cb')][_0xb4cf('0x120')](db[_0xb4cf('0x97')],{'as':_0xb4cf('0x97'),'foreignKey':'VariableId'});db[_0xb4cf('0x1cc')][_0xb4cf('0x120')](db[_0xb4cf('0x66')],{});db['ChatQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':'ListId'});db[_0xb4cf('0x1cc')][_0xb4cf('0x120')](db['CmContact'],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db['ChatQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0x11a')],{});db[_0xb4cf('0x1cc')][_0xb4cf('0x120')](db['ChatMessage'],{});db[_0xb4cf('0x1cc')]['belongsTo'](db[_0xb4cf('0x12')],{});db[_0xb4cf('0x1cc')]['belongsTo'](db[_0xb4cf('0x71')],{});db[_0xb4cf('0x1cd')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1ce')});db[_0xb4cf('0x1cd')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1cf')});db[_0xb4cf('0xd7')][_0xb4cf('0x115')](db[_0xb4cf('0x1d0')],{'foreignKey':_0xb4cf('0x1d1'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0xd7')]['hasMany'](db[_0xb4cf('0xd4')],{'foreignKey':_0xb4cf('0x1d1'),'onDelete':_0xb4cf('0x113')});db[_0xb4cf('0xd9')][_0xb4cf('0x120')](db[_0xb4cf('0x54')],{});db['SmsQueueReport'][_0xb4cf('0x120')](db['CmList'],{'as':_0xb4cf('0x164'),'foreignKey':'ListId'});db[_0xb4cf('0xd9')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db[_0xb4cf('0xd9')]['belongsTo'](db[_0xb4cf('0x58')],{});db['SmsQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0x5a')],{});db[_0xb4cf('0xd9')][_0xb4cf('0x120')](db['User'],{});db[_0xb4cf('0xd9')][_0xb4cf('0x120')](db[_0xb4cf('0x5c')],{});db['JscriptyProject'][_0xb4cf('0x115')](db[_0xb4cf('0xd7')],{'foreignKey':_0xb4cf('0x1d2')});db[_0xb4cf('0x1d3')]['hasMany'](db[_0xb4cf('0x1d0')],{'foreignKey':_0xb4cf('0x1d2')});db[_0xb4cf('0x1d3')][_0xb4cf('0x115')](db[_0xb4cf('0xd4')],{'foreignKey':_0xb4cf('0x1d2')});db[_0xb4cf('0xe1')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16f'),'through':'user_has_square_projects'});db[_0xb4cf('0x128')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x1d4')});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0xb4cf('0x155'),'as':'VoiceQueues'});db['Team'][_0xb4cf('0x122')](db['MailQueue'],{'through':_0xb4cf('0x168'),'as':_0xb4cf('0x132')});db[_0xb4cf('0x128')][_0xb4cf('0x122')](db['ChatQueue'],{'through':_0xb4cf('0x190'),'as':_0xb4cf('0x1d5')});db['Team'][_0xb4cf('0x122')](db['FaxQueue'],{'through':_0xb4cf('0x17a'),'as':_0xb4cf('0x133')});db[_0xb4cf('0x128')][_0xb4cf('0x122')](db[_0xb4cf('0x5c')],{'through':'team_has_sms_queues','as':_0xb4cf('0x134')});db[_0xb4cf('0x128')][_0xb4cf('0x122')](db[_0xb4cf('0x64')],{'through':_0xb4cf('0x1d6'),'as':'OpenchannelQueues'});db['Team'][_0xb4cf('0x122')](db[_0xb4cf('0x10e')],{'through':_0xb4cf('0x1d7'),'as':_0xb4cf('0x136')});db['Campaign'][_0xb4cf('0x115')](db[_0xb4cf('0x149')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xb4cf('0x115')](db[_0xb4cf('0x79')],{'as':_0xb4cf('0x117'),'foreignKey':_0xb4cf('0x199')});db[_0xb4cf('0xe8')][_0xb4cf('0x115')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xb4cf('0xe8')][_0xb4cf('0x115')](db[_0xb4cf('0x77')],{'as':_0xb4cf('0x14b'),'foreignKey':_0xb4cf('0x199')});db[_0xb4cf('0xe8')]['belongsTo'](db[_0xb4cf('0x14d')],{'as':_0xb4cf('0x14d'),'foreignKey':'TrunkId'});db[_0xb4cf('0xe8')][_0xb4cf('0x120')](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xb4cf('0xe8')][_0xb4cf('0x120')](db[_0xb4cf('0x88')],{'as':_0xb4cf('0x88'),'foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0xe8')][_0xb4cf('0x120')](db['SquareProject'],{'as':_0xb4cf('0xe1'),'foreignKey':'SquareProjectId'});db[_0xb4cf('0xe8')][_0xb4cf('0x122')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x1d8'),'through':_0xb4cf('0x1d9')});db[_0xb4cf('0xe8')][_0xb4cf('0x122')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x1da'),'through':_0xb4cf('0x1db')});db[_0xb4cf('0xee')][_0xb4cf('0x120')](db['MailMessage'],{});db[_0xb4cf('0xee')][_0xb4cf('0x120')](db[_0xb4cf('0x40')],{});db[_0xb4cf('0xee')][_0xb4cf('0x120')](db[_0xb4cf('0x3c')],{'foreignKey':'FromMailAccountId','as':_0xb4cf('0x1dc')});db[_0xb4cf('0xee')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1dd'),'as':_0xb4cf('0x1de')});db['MailTransferReport'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':'ToUserId','as':_0xb4cf('0x1df')});db['MailTransferReport'][_0xb4cf('0x120')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xb4cf('0x1e0')});db[_0xb4cf('0xee')][_0xb4cf('0x120')](db[_0xb4cf('0x3c')],{'foreignKey':_0xb4cf('0x1e1'),'as':_0xb4cf('0x1e2')});db[_0xb4cf('0xf0')][_0xb4cf('0x120')](db[_0xb4cf('0x6d')],{});db[_0xb4cf('0xf0')]['belongsTo'](db[_0xb4cf('0x11a')],{});db[_0xb4cf('0xf0')]['belongsTo'](db[_0xb4cf('0x66')],{'foreignKey':_0xb4cf('0x1e3'),'as':_0xb4cf('0x1dc')});db[_0xb4cf('0xf0')][_0xb4cf('0x120')](db['User'],{'foreignKey':'FromUserId','as':_0xb4cf('0x1de')});db[_0xb4cf('0xf0')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1e4'),'as':_0xb4cf('0x1df')});db[_0xb4cf('0xf0')]['belongsTo'](db[_0xb4cf('0x71')],{'foreignKey':_0xb4cf('0x1e5'),'as':'ToQueue'});db['ChatTransferReport'][_0xb4cf('0x120')](db[_0xb4cf('0x66')],{'foreignKey':'ToChatWebsiteId','as':_0xb4cf('0x1e2')});db['FaxTransferReport']['belongsTo'](db['FaxMessage'],{});db['FaxTransferReport'][_0xb4cf('0x120')](db['FaxInteraction'],{});db[_0xb4cf('0xf2')]['belongsTo'](db[_0xb4cf('0x4b')],{'foreignKey':'FromFaxAccountId','as':_0xb4cf('0x1dc')});db['FaxTransferReport']['belongsTo'](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1dd'),'as':_0xb4cf('0x1de')});db['FaxTransferReport']['belongsTo'](db[_0xb4cf('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xb4cf('0xf2')][_0xb4cf('0x120')](db[_0xb4cf('0x51')],{'foreignKey':_0xb4cf('0x1e6'),'as':'ToQueue'});db['FaxTransferReport'][_0xb4cf('0x120')](db[_0xb4cf('0x4b')],{'foreignKey':'ToFaxAccountId','as':_0xb4cf('0x1e2')});db[_0xb4cf('0xf4')]['belongsTo'](db[_0xb4cf('0x184')],{});db[_0xb4cf('0xf4')][_0xb4cf('0x120')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xb4cf('0x120')](db[_0xb4cf('0x13d')],{'foreignKey':'FromOpenchannelAccountId','as':_0xb4cf('0x1dc')});db[_0xb4cf('0xf4')]['belongsTo'](db[_0xb4cf('0x12')],{'foreignKey':'FromUserId','as':_0xb4cf('0x1de')});db[_0xb4cf('0xf4')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1e4'),'as':_0xb4cf('0x1df')});db[_0xb4cf('0xf4')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0xb4cf('0x1e7'),'as':_0xb4cf('0x1e0')});db[_0xb4cf('0xf4')]['belongsTo'](db[_0xb4cf('0x13d')],{'foreignKey':_0xb4cf('0x1e8'),'as':_0xb4cf('0x1e2')});db['SmsTransferReport'][_0xb4cf('0x120')](db[_0xb4cf('0x5a')],{});db[_0xb4cf('0xf6')]['belongsTo'](db[_0xb4cf('0x58')],{});db[_0xb4cf('0xf6')][_0xb4cf('0x120')](db['SmsAccount'],{'foreignKey':_0xb4cf('0x1e9'),'as':'FromAccount'});db[_0xb4cf('0xf6')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1dd'),'as':_0xb4cf('0x1de')});db[_0xb4cf('0xf6')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1e4'),'as':_0xb4cf('0x1df')});db[_0xb4cf('0xf6')][_0xb4cf('0x120')](db[_0xb4cf('0x5c')],{'foreignKey':_0xb4cf('0x1ea'),'as':_0xb4cf('0x1e0')});db[_0xb4cf('0xf6')]['belongsTo'](db[_0xb4cf('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xb4cf('0xf8')][_0xb4cf('0x115')](db['Disposition'],{'as':_0xb4cf('0x161'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0xf8')][_0xb4cf('0x115')](db['CmCustomField'],{'as':_0xb4cf('0x1eb'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0xf8')]['hasMany'](db[_0xb4cf('0x125')],{'as':'Contacts','onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0xf8')][_0xb4cf('0x115')](db[_0xb4cf('0x79')],{'as':'HopperFinals','foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0xf8')][_0xb4cf('0x115')](db[_0xb4cf('0x7b')],{'as':_0xb4cf('0x118'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0xf8')][_0xb4cf('0x115')](db[_0xb4cf('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0xf8')][_0xb4cf('0x122')](db['VoiceQueue'],{'as':_0xb4cf('0x1ec'),'through':_0xb4cf('0x1ed')});db[_0xb4cf('0xf8')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x127')});db[_0xb4cf('0xfa')]['hasMany'](db[_0xb4cf('0x18')],{'as':_0xb4cf('0x1a3'),'onDelete':'cascade'});db[_0xb4cf('0xfa')]['belongsToMany'](db['User'],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x138')});db[_0xb4cf('0xfc')][_0xb4cf('0x115')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16f'),'foreignKey':'userProfileId'});db[_0xb4cf('0xfc')][_0xb4cf('0x115')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xb4cf('0x121'),'onDelete':'cascade'});db['UserProfileSection']['hasMany'](db[_0xb4cf('0x100')],{'as':_0xb4cf('0x1ee'),'foreignKey':_0xb4cf('0x1ef'),'onDelete':'cascade'});db[_0xb4cf('0x103')]['hasMany'](db['Disposition'],{'as':_0xb4cf('0x161'),'foreignKey':_0xb4cf('0x1f0')});db['WhatsappAccount'][_0xb4cf('0x115')](db[_0xb4cf('0x84')],{'as':_0xb4cf('0x162'),'foreignKey':_0xb4cf('0x1f0')});db[_0xb4cf('0x103')][_0xb4cf('0x115')](db['WhatsappMessage'],{'as':_0xb4cf('0x157'),'foreignKey':'WhatsappAccountId'});db[_0xb4cf('0x103')][_0xb4cf('0x115')](db[_0xb4cf('0x107')],{'as':_0xb4cf('0x163')});db[_0xb4cf('0x103')][_0xb4cf('0x115')](db['WhatsappApplication'],{'as':_0xb4cf('0x145')});db[_0xb4cf('0x103')][_0xb4cf('0x120')](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':_0xb4cf('0x165')});db[_0xb4cf('0x103')]['belongsTo'](db['Pause'],{'as':_0xb4cf('0x152'),'foreignKey':_0xb4cf('0x167')});db[_0xb4cf('0x103')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':'Agents','through':_0xb4cf('0x141')});db[_0xb4cf('0x105')]['belongsTo'](db[_0xb4cf('0x12')],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x105')][_0xb4cf('0x120')](db['WhatsappQueue'],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x105')][_0xb4cf('0x120')](db['WhatsappAccount'],{'onDelete':_0xb4cf('0x173')});db[_0xb4cf('0x105')][_0xb4cf('0x120')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xb4cf('0x151')});db[_0xb4cf('0x105')]['belongsTo'](db[_0xb4cf('0x91')],{'onDelete':'restrict','foreignKey':_0xb4cf('0x174')});db['WhatsappInteraction'][_0xb4cf('0x115')](db[_0xb4cf('0x108')],{'as':_0xb4cf('0x157'),'onDelete':_0xb4cf('0x113'),'foreignKey':_0xb4cf('0x1f1')});db['WhatsappInteraction'][_0xb4cf('0x120')](db[_0xb4cf('0x103')],{'as':'Account','foreignKey':_0xb4cf('0x1f0')});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db[_0xb4cf('0x107')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x16b'),'foreignKey':_0xb4cf('0x114')});db['WhatsappInteraction']['belongsToMany'](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x1ab'),'as':'Tags'});db[_0xb4cf('0x107')][_0xb4cf('0x122')](db[_0xb4cf('0x91')],{'through':_0xb4cf('0x1ab'),'as':_0xb4cf('0x16e')});db[_0xb4cf('0x107')][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':'Users','through':_0xb4cf('0x12e'),'foreignKey':_0xb4cf('0x1f1')});db[_0xb4cf('0x108')]['belongsTo'](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x12')});db[_0xb4cf('0x108')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x15e')});db[_0xb4cf('0x108')][_0xb4cf('0x120')](db[_0xb4cf('0x107')],{'onDelete':_0xb4cf('0x113'),'as':_0xb4cf('0x172'),'foreignKey':'WhatsappInteractionId'});db[_0xb4cf('0x108')]['belongsTo'](db[_0xb4cf('0x103')],{'as':_0xb4cf('0x169'),'foreignKey':_0xb4cf('0x1f0')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappAccount'],{});db[_0xb4cf('0x10a')]['belongsTo'](db[_0xb4cf('0xf8')],{'as':_0xb4cf('0x164'),'foreignKey':'ListId'});db[_0xb4cf('0x10a')][_0xb4cf('0x120')](db[_0xb4cf('0x125')],{'as':_0xb4cf('0x15e'),'foreignKey':_0xb4cf('0x16a')});db['WhatsappQueueReport']['belongsTo'](db[_0xb4cf('0x107')],{});db['WhatsappQueueReport'][_0xb4cf('0x120')](db[_0xb4cf('0x10e')],{});db[_0xb4cf('0x10a')][_0xb4cf('0x120')](db[_0xb4cf('0x108')],{});db[_0xb4cf('0x10a')][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{});db[_0xb4cf('0x10c')][_0xb4cf('0x120')](db[_0xb4cf('0x108')],{});db[_0xb4cf('0x10c')][_0xb4cf('0x120')](db[_0xb4cf('0x107')],{});db['WhatsappTransferReport'][_0xb4cf('0x120')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xb4cf('0x1dc')});db[_0xb4cf('0x10c')][_0xb4cf('0x120')](db[_0xb4cf('0x103')],{'foreignKey':'ToWhatsappAccountId','as':_0xb4cf('0x1e2')});db[_0xb4cf('0x10c')][_0xb4cf('0x120')](db[_0xb4cf('0x10e')],{'foreignKey':_0xb4cf('0x1f2'),'as':_0xb4cf('0x1e0')});db[_0xb4cf('0x10c')][_0xb4cf('0x120')](db['User'],{'foreignKey':_0xb4cf('0x1dd'),'as':_0xb4cf('0x1de')});db['WhatsappTransferReport'][_0xb4cf('0x120')](db[_0xb4cf('0x12')],{'foreignKey':_0xb4cf('0x1e4'),'as':_0xb4cf('0x1df')});db['WhatsappQueue'][_0xb4cf('0x122')](db[_0xb4cf('0x12')],{'as':_0xb4cf('0x153'),'through':_0xb4cf('0x37'),'foreignKey':_0xb4cf('0x1f3')});db['WhatsappQueue'][_0xb4cf('0x122')](db[_0xb4cf('0x128')],{'through':_0xb4cf('0x1d7'),'as':_0xb4cf('0x154')});module[_0xb4cf('0x1f4')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x38e9=['../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','hasOne','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','FaxInteraction','FaxInteractions','Notifications','SenderId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','OpenchannelQueue','WhatsappQueues','UserWhatsappQueue','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','IntervalId','mandatoryDispositionPause','Teams','team_has_voice_queues','Messages','mailboxuser','VoiceQueueReport','uniqueid','AgentReports','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','MailInteractionId','Account','Contact','Tags','ThroughTags','Users','restrict','TagId','MailQueueReport','ContactId','CannedAnswer','FaxInteractionId','FaxAccountId','Owner','fax_interaction_has_tags','user_has_fax_interactions','Interaction','AttachmentId','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ChatWebsite','ProactiveActions','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Website','SmsInteractions','CompanyId','cm_contact_has_tags','Queue','OwnerId','All','OneAll','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','mail_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Description','Field','VariableId','ZohoAccount','Subject','int_freshdesk_configuration_has_tags','VtigerField','FreshsalesField','FromId','ToId','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','team_has_fax_queues','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','CampaignId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToAccount','FromUserId','ToUserId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','userProfileId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','ToQueueId','WhatsappQueueId','exports','path','sequelize','lodash','jstz','determine','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','xcall','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration'];(function(_0x3034ce,_0x1421b6){var _0x4bc0e3=function(_0x49a5ca){while(--_0x49a5ca){_0x3034ce['push'](_0x3034ce['shift']());}};_0x4bc0e3(++_0x1421b6);}(_0x38e9,0x12a));var _0x938e=function(_0x140010,_0x4d7233){_0x140010=_0x140010-0x0;var _0x373bb8=_0x38e9[_0x140010];return _0x373bb8;};'use strict';var path=require(_0x938e('0x0'));var config=require('../config/environment');var Sequelize=require(_0x938e('0x1'));var _=require(_0x938e('0x2'));var jstz=require(_0x938e('0x3'));var timezone=jstz[_0x938e('0x4')]();config[_0x938e('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':'xcall','password':_0x938e('0x5'),'options':{'host':_0x938e('0x6'),'port':0xcea,'dialect':_0x938e('0x7'),'dialectOptions':{'charset':_0x938e('0x8')},'logging':![],'timezone':timezone[_0x938e('0x9')](),'define':{'charset':'utf8','collate':_0x938e('0xa')}}});config[_0x938e('0xb')]=_[_0x938e('0xc')](config[_0x938e('0xb')],{'database':_0x938e('0xd'),'username':_0x938e('0xe'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x938e('0x8')},'logging':![],'timezone':timezone[_0x938e('0x9')](),'define':{'charset':'utf8','collate':_0x938e('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x938e('0x1')][_0x938e('0xf')],config[_0x938e('0x1')][_0x938e('0x10')],config[_0x938e('0x1')][_0x938e('0x11')],config[_0x938e('0x1')][_0x938e('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x938e('0xb')][_0x938e('0xf')],config[_0x938e('0xb')][_0x938e('0x10')],config[_0x938e('0xb')][_0x938e('0x11')],config[_0x938e('0xb')]['options'])};db[_0x938e('0x13')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x15'));db['VoiceChanSpy']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x16'));db[_0x938e('0x17')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x18'));db[_0x938e('0x19')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x1a'));db[_0x938e('0x1b')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x1c'));db[_0x938e('0x1d')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x938e('0x1e')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x1f'));db[_0x938e('0x20')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x21'));db[_0x938e('0x22')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/voiceMail/voiceMail.model');db[_0x938e('0x23')]=db[_0x938e('0x1')]['import'](_0x938e('0x24'));db[_0x938e('0x25')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x26'));db[_0x938e('0x27')]=db['sequelize']['import'](_0x938e('0x28'));db[_0x938e('0x29')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x2a'));db['VoiceQueueReport']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x2b'));db['MemberReport']=db[_0x938e('0x1')][_0x938e('0x14')]('../api/memberReport/memberReport.model');db[_0x938e('0x2c')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x2d'));db[_0x938e('0x2e')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x2f'));db['UserVoiceQueueRt']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x30'));db[_0x938e('0x31')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x32'));db['UserChatQueue']=db[_0x938e('0x1')][_0x938e('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x938e('0x33')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x34'));db[_0x938e('0x35')]=db['sequelize']['import'](_0x938e('0x36'));db[_0x938e('0x37')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x938e('0x38')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x39'));db['UserWhatsappQueue']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x3a'));db['MailServerIn']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x3b'));db[_0x938e('0x3c')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x938e('0x3d')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x3e'));db['MailQueue']=db[_0x938e('0x1')][_0x938e('0x14')]('../api/mailQueue/mailQueue.model');db[_0x938e('0x3f')]=db[_0x938e('0x1')]['import'](_0x938e('0x40'));db[_0x938e('0x41')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x42'));db[_0x938e('0x43')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x44'));db['MailApplication']=db['sequelize'][_0x938e('0x14')](_0x938e('0x45'));db['MailQueueReport']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x46'));db[_0x938e('0x47')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x48'));db[_0x938e('0x49')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x4a'));db[_0x938e('0x4b')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/faxAccount/faxAccount.model');db[_0x938e('0x4c')]=db[_0x938e('0x1')]['import'](_0x938e('0x4d'));db['FaxInteraction']=db['sequelize']['import'](_0x938e('0x4e'));db[_0x938e('0x4f')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x50'));db[_0x938e('0x51')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/faxQueue/faxQueue.model');db[_0x938e('0x52')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x53'));db['SmsAccount']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x54'));db[_0x938e('0x55')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x56'));db[_0x938e('0x57')]=db[_0x938e('0x1')]['import'](_0x938e('0x58'));db[_0x938e('0x59')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x5a'));db['SmsQueue']=db['sequelize'][_0x938e('0x14')](_0x938e('0x5b'));db[_0x938e('0x5c')]=db[_0x938e('0x1')]['import'](_0x938e('0x5d'));db[_0x938e('0x5e')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x5f'));db[_0x938e('0x60')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x61'));db[_0x938e('0x62')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x63'));db['OpenchannelQueue']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x64'));db['ChatWebsite']=db[_0x938e('0x1')]['import'](_0x938e('0x65'));db[_0x938e('0x66')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x938e('0x67')]=db[_0x938e('0x1')]['import'](_0x938e('0x68'));db[_0x938e('0x69')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x938e('0x6a')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/chatMessage/chatMessage.model');db[_0x938e('0x6b')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x6c'));db[_0x938e('0x6d')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x6e'));db[_0x938e('0x6f')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x70'));db[_0x938e('0x71')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x72'));db[_0x938e('0x73')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x74'));db[_0x938e('0x75')]=db['sequelize'][_0x938e('0x14')](_0x938e('0x76'));db['CmHopper']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x77'));db[_0x938e('0x78')]=db['sequelize']['import'](_0x938e('0x79'));db[_0x938e('0x7a')]=db[_0x938e('0x1')]['import'](_0x938e('0x7b'));db[_0x938e('0x7c')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x7d'));db[_0x938e('0x7e')]=db[_0x938e('0x1')]['import'](_0x938e('0x7f'));db[_0x938e('0x80')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x81'));db[_0x938e('0x82')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x83'));db[_0x938e('0x84')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x85'));db['CannedAnswer']=db['sequelize'][_0x938e('0x14')](_0x938e('0x86'));db[_0x938e('0x87')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x88'));db[_0x938e('0x89')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x8a'));db[_0x938e('0x8b')]=db['sequelize'][_0x938e('0x14')]('../api/interval/interval.model');db[_0x938e('0x8c')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x8d'));db[_0x938e('0x8e')]=db[_0x938e('0x1')]['import']('../api/cdr/cdr.model');db[_0x938e('0x8f')]=db[_0x938e('0x1')]['import'](_0x938e('0x90'));db['Schedule']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x91'));db[_0x938e('0x92')]=db['sequelize'][_0x938e('0x14')]('../api/sound/sound.model');db[_0x938e('0x93')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x94'));db[_0x938e('0x95')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/template/template.model');db[_0x938e('0x96')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x97'));db[_0x938e('0x98')]=db['sequelize']['import'](_0x938e('0x99'));db['Integration']=db['sequelize'][_0x938e('0x14')](_0x938e('0x9a'));db[_0x938e('0x9b')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x9c'));db[_0x938e('0x9d')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x9e'));db[_0x938e('0x9f')]=db['sequelize'][_0x938e('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x938e('0x14')](_0x938e('0xa0'));db[_0x938e('0xa1')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xa2'));db[_0x938e('0xa3')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xa4'));db[_0x938e('0xa5')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xa6'));db[_0x938e('0xa7')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x938e('0xa8')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xa9'));db['SalesforceField']=db['sequelize'][_0x938e('0x14')](_0x938e('0xaa'));db[_0x938e('0xab')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xac'));db[_0x938e('0xad')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xae'));db[_0x938e('0xaf')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x938e('0xb0')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xb1'));db[_0x938e('0xb2')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xb3'));db[_0x938e('0xb4')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xb5'));db['ZohoAccount']=db[_0x938e('0x1')][_0x938e('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x938e('0xb6')]=db['sequelize'][_0x938e('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x938e('0xb7')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xb8'));db[_0x938e('0xb9')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xba'));db[_0x938e('0xbb')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xbc'));db[_0x938e('0xbd')]=db[_0x938e('0x1')]['import'](_0x938e('0xbe'));db[_0x938e('0xbf')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x938e('0xc0')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xc1'));db[_0x938e('0xc2')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xc3'));db[_0x938e('0xc4')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xc5'));db[_0x938e('0xc6')]=db[_0x938e('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xc7'));db[_0x938e('0xc8')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xc9'));db[_0x938e('0xca')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xcb'));db[_0x938e('0xcc')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xcd'));db[_0x938e('0xce')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xcf'));db[_0x938e('0xd0')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xd1'));db[_0x938e('0xd2')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xd3'));db[_0x938e('0xd4')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xd5'));db[_0x938e('0xd6')]=db['sequelize']['import'](_0x938e('0xd7'));db['FreshsalesField']=db[_0x938e('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x938e('0x1')]['import'](_0x938e('0x9a'));db[_0x938e('0xd8')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xd9'));db[_0x938e('0xda')]=db[_0x938e('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x938e('0xdb')]=db[_0x938e('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x938e('0x14')](_0x938e('0xdc'));db[_0x938e('0xdd')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x938e('0xde')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x938e('0x1')][_0x938e('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0x938e('0xdf')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xe0'));db['SquareDetailsReport']=db[_0x938e('0x1')]['import'](_0x938e('0xe1'));db[_0x938e('0xe2')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xe3'));db[_0x938e('0xe4')]=db['sequelize'][_0x938e('0x14')](_0x938e('0xe5'));db[_0x938e('0xe6')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xe7'));db[_0x938e('0xe8')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xe9'));db[_0x938e('0xea')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xeb'));db['SquareMessage']=db['sequelize'][_0x938e('0x14')](_0x938e('0xec'));db[_0x938e('0xed')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xee'));db[_0x938e('0xef')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xf0'));db[_0x938e('0xf1')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xf2'));db[_0x938e('0xf3')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/migration/migration.model');db[_0x938e('0xf4')]=db['sequelize']['import'](_0x938e('0xf5'));db[_0x938e('0xf6')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/plugin/plugin.model');db[_0x938e('0xf7')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xf8'));db[_0x938e('0xf9')]=db['sequelize'][_0x938e('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x938e('0xfa')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xfb'));db[_0x938e('0xfc')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xfd'));db[_0x938e('0xfe')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0xff'));db['CmList']=db[_0x938e('0x1')]['import'](_0x938e('0x100'));db[_0x938e('0x101')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x102'));db[_0x938e('0x103')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x938e('0x1')][_0x938e('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x938e('0x104')]=db['sequelize']['import'](_0x938e('0x105'));db[_0x938e('0x106')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/notification/notification.model');db[_0x938e('0x107')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x108'));db[_0x938e('0x109')]=db[_0x938e('0x1')]['import'](_0x938e('0x10a'));db[_0x938e('0x10b')]=db[_0x938e('0x1')][_0x938e('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x938e('0x10c')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x10d'));db[_0x938e('0x10e')]=db[_0x938e('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x938e('0x10f')]=db[_0x938e('0x1')][_0x938e('0x14')](_0x938e('0x110'));db[_0x938e('0x111')]=db['sequelize'][_0x938e('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x938e('0x112')]=db[_0x938e('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x938e('0x13')][_0x938e('0x113')](db[_0x938e('0x22')],{'as':_0x938e('0x22'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x115')});db[_0x938e('0x13')]['hasMany'](db['VoiceRecording'],{'as':_0x938e('0x116'),'foreignKey':'UserId'});db[_0x938e('0x13')][_0x938e('0x117')](db[_0x938e('0x118')],{'as':_0x938e('0x119'),'foreignKey':_0x938e('0x115')});db[_0x938e('0x13')][_0x938e('0x117')](db['VoiceExtension'],{'as':_0x938e('0x11a'),'onDelete':_0x938e('0x114'),'hooks':!![]});db[_0x938e('0x13')][_0x938e('0x117')](db[_0x938e('0x7a')],{'as':_0x938e('0x11b'),'foreignKey':_0x938e('0x115')});db['User'][_0x938e('0x117')](db[_0x938e('0x7c')],{'as':'HopperHistory','foreignKey':_0x938e('0x115')});db[_0x938e('0x13')][_0x938e('0x117')](db[_0x938e('0x7e')],{'as':_0x938e('0x7e'),'foreignKey':_0x938e('0x115')});db[_0x938e('0x13')]['hasMany'](db[_0x938e('0x60')],{'as':_0x938e('0x11c'),'foreignKey':_0x938e('0x115')});db[_0x938e('0x13')][_0x938e('0x117')](db[_0x938e('0x69')],{'as':'ChatInteractions','foreignKey':_0x938e('0x115')});db['User'][_0x938e('0x117')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x938e('0x115')});db[_0x938e('0x13')][_0x938e('0x117')](db[_0x938e('0x11d')],{'as':_0x938e('0x11e'),'foreignKey':'UserId'});db[_0x938e('0x13')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x938e('0x115')});db[_0x938e('0x13')]['hasMany'](db[_0x938e('0x10b')],{'as':'WhatsappInteractions','foreignKey':_0x938e('0x115')});db['User'][_0x938e('0x117')](db[_0x938e('0x106')],{'as':_0x938e('0x11f'),'foreignKey':_0x938e('0x120')});db[_0x938e('0x13')]['belongsTo'](db['UserProfile'],{'as':_0x938e('0x103'),'foreignKey':'userProfileId'});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0x6f')],{'as':'Groups','through':_0x938e('0x122')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0x75')],{'as':_0x938e('0x123'),'through':_0x938e('0x124')});db[_0x938e('0x13')]['belongsToMany'](db[_0x938e('0x125')],{'as':_0x938e('0x126'),'through':_0x938e('0x127')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0xed')],{'through':'user_has_teams'});db[_0x938e('0x13')]['belongsToMany'](db[_0x938e('0x41')],{'as':_0x938e('0x128'),'through':_0x938e('0x129')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0x69')],{'as':_0x938e('0x12a'),'through':_0x938e('0x12b')});db['User'][_0x938e('0x121')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x938e('0x13')]['belongsToMany'](db[_0x938e('0x57')],{'as':'SmsInteractions','through':_0x938e('0x12c')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0x60')],{'as':_0x938e('0x11c'),'through':_0x938e('0x12d')});db['User'][_0x938e('0x121')](db[_0x938e('0x10b')],{'as':_0x938e('0x12e'),'through':_0x938e('0x12f')});db['User']['belongsToMany'](db[_0x938e('0x1d')],{'as':_0x938e('0x130'),'through':_0x938e('0x31'),'required':![]});db[_0x938e('0x13')]['belongsToMany'](db[_0x938e('0x131')],{'as':_0x938e('0x132'),'through':_0x938e('0x33'),'required':![]});db['User'][_0x938e('0x121')](db[_0x938e('0x6d')],{'as':_0x938e('0x133'),'through':_0x938e('0x134'),'required':![],'hooks':!![]});db[_0x938e('0x13')]['belongsToMany'](db[_0x938e('0x51')],{'as':_0x938e('0x135'),'through':_0x938e('0x35'),'required':![]});db['User'][_0x938e('0x121')](db[_0x938e('0x136')],{'as':'SmsQueues','through':_0x938e('0x37'),'required':![]});db['User']['belongsToMany'](db[_0x938e('0x137')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User'][_0x938e('0x121')](db[_0x938e('0x111')],{'as':_0x938e('0x138'),'through':_0x938e('0x139'),'required':![]});db['User']['belongsToMany'](db[_0x938e('0x125')],{'through':_0x938e('0x127')});db[_0x938e('0x13')]['belongsToMany'](db['VoicePrefix'],{'as':_0x938e('0x13a'),'through':_0x938e('0x13b'),'required':![]});db[_0x938e('0x13')][_0x938e('0x121')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x938e('0x13c')});db['User']['belongsToMany'](db['FaxAccount'],{'as':_0x938e('0x13d'),'through':_0x938e('0x13e')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0x3d')],{'as':_0x938e('0x13f'),'through':_0x938e('0x140')});db[_0x938e('0x13')]['belongsToMany'](db[_0x938e('0x5c')],{'as':_0x938e('0x141'),'through':_0x938e('0x142')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0x143')],{'as':_0x938e('0x144'),'through':'user_has_sms_accounts'});db['User'][_0x938e('0x121')](db['WhatsappAccount'],{'as':_0x938e('0x145'),'through':_0x938e('0x146')});db[_0x938e('0x13')][_0x938e('0x121')](db[_0x938e('0xe8')],{'as':'SquareProjects','through':_0x938e('0x147')});db[_0x938e('0x148')][_0x938e('0x117')](db[_0x938e('0x19')],{'as':_0x938e('0x149'),'onDelete':'cascade','foreignKey':_0x938e('0x14a')});db[_0x938e('0x17')][_0x938e('0x117')](db['VoiceExtension'],{'onDelete':_0x938e('0x114')});db['VoiceExtension']['hasMany'](db[_0x938e('0x19')],{'as':_0x938e('0x14b'),'onDelete':_0x938e('0x114')});db[_0x938e('0x1b')][_0x938e('0x121')](db[_0x938e('0x92')],{'as':_0x938e('0x14c'),'through':'moh_has_sounds'});db[_0x938e('0x1d')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x938e('0x14d')});db['VoiceQueue']['hasMany'](db[_0x938e('0x14e')],{'as':_0x938e('0x14f'),'foreignKey':'VoiceQueueId'});db[_0x938e('0x1d')]['hasMany'](db[_0x938e('0x7a')],{'as':_0x938e('0x11b'),'foreignKey':_0x938e('0x14d')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0x938e('0x150'),'foreignKey':_0x938e('0x14d')});db[_0x938e('0x1d')][_0x938e('0x117')](db['ReportAgentPreview'],{'as':_0x938e('0x7e'),'foreignKey':_0x938e('0x14d')});db['VoiceQueue'][_0x938e('0x117')](db[_0x938e('0x78')],{'as':_0x938e('0x151'),'foreignKey':'VoiceQueueId'});db[_0x938e('0x1d')]['hasMany'](db[_0x938e('0xde')],{'as':_0x938e('0x152'),'foreignKey':_0x938e('0x14d')});db[_0x938e('0x1d')][_0x938e('0x153')](db[_0x938e('0x2c')],{'as':_0x938e('0x2c'),'foreignKey':_0x938e('0x154')});db[_0x938e('0x1d')][_0x938e('0x153')](db[_0x938e('0x2c')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x938e('0x1d')][_0x938e('0x153')](db['Interval'],{'as':'Interval','foreignKey':_0x938e('0x155')});db[_0x938e('0x1d')][_0x938e('0x153')](db['Pause'],{'as':_0x938e('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x938e('0x1d')][_0x938e('0x121')](db['CmList'],{'as':_0x938e('0x126'),'through':'voice_queues_has_cm_lists'});db[_0x938e('0x1d')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':'Agents','through':_0x938e('0x31')});db[_0x938e('0x1d')]['belongsToMany'](db[_0x938e('0xed')],{'as':_0x938e('0x157'),'through':_0x938e('0x158')});db[_0x938e('0x1d')]['belongsToMany'](db[_0x938e('0x125')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x938e('0x1e')][_0x938e('0x153')](db['User'],{'as':_0x938e('0x13'),'foreignKey':'UserId'});db[_0x938e('0x20')][_0x938e('0x153')](db[_0x938e('0x13')],{'as':_0x938e('0x13'),'foreignKey':_0x938e('0x115')});db['VoiceMail'][_0x938e('0x117')](db[_0x938e('0x23')],{'as':_0x938e('0x159'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x15a'),'sourceKey':'mailbox'});db[_0x938e('0x23')]['belongsTo'](db[_0x938e('0x22')],{'foreignKey':_0x938e('0x15a'),'targetKey':'mailbox'});db[_0x938e('0x25')]['hasMany'](db[_0x938e('0x15b')],{'as':'QueueCalls','foreignKey':_0x938e('0x15c'),'constraints':![]});db[_0x938e('0x25')][_0x938e('0x117')](db[_0x938e('0x29')],{'as':_0x938e('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0x938e('0x25')][_0x938e('0x153')](db['User'],{'as':'User','foreignKey':_0x938e('0x115')});db[_0x938e('0x25')][_0x938e('0x153')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0x938e('0x153')](db[_0x938e('0x3d')],{'as':'MailAccount','foreignKey':_0x938e('0x15e')});db[_0x938e('0x3c')][_0x938e('0x153')](db[_0x938e('0x3d')],{'as':_0x938e('0x3d'),'foreignKey':_0x938e('0x15e')});db[_0x938e('0x3d')][_0x938e('0x113')](db['MailServerIn'],{'as':_0x938e('0x15f'),'onDelete':_0x938e('0x114')});db[_0x938e('0x3d')]['hasOne'](db['MailServerOut'],{'as':_0x938e('0x160'),'onDelete':_0x938e('0x114')});db[_0x938e('0x3d')][_0x938e('0x117')](db[_0x938e('0x87')],{'as':_0x938e('0x161'),'foreignKey':_0x938e('0x15e')});db[_0x938e('0x3d')][_0x938e('0x117')](db['CannedAnswer'],{'as':_0x938e('0x162'),'foreignKey':_0x938e('0x15e')});db['MailAccount'][_0x938e('0x117')](db['MailMessage'],{'as':_0x938e('0x159'),'foreignKey':_0x938e('0x15e')});db['MailAccount'][_0x938e('0x117')](db['MailInteraction'],{'as':_0x938e('0x163')});db[_0x938e('0x3d')][_0x938e('0x117')](db[_0x938e('0x164')],{'as':'Applications'});db[_0x938e('0x3d')][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166')});db[_0x938e('0x3d')][_0x938e('0x153')](db[_0x938e('0x95')],{'as':_0x938e('0x95'),'foreignKey':_0x938e('0x167')});db['MailAccount'][_0x938e('0x153')](db[_0x938e('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x938e('0x168')});db[_0x938e('0x3d')][_0x938e('0x121')](db['User'],{'as':_0x938e('0x169'),'through':'user_has_mail_accounts'});db[_0x938e('0x131')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':_0x938e('0x33')});db['MailQueue'][_0x938e('0x121')](db['Team'],{'through':_0x938e('0x16a'),'as':'Teams'});db[_0x938e('0x41')][_0x938e('0x117')](db[_0x938e('0x43')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x938e('0x16b')});db['MailInteraction']['belongsTo'](db[_0x938e('0x3d')],{'as':_0x938e('0x16c'),'foreignKey':'MailAccountId'});db[_0x938e('0x41')][_0x938e('0x153')](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':'ContactId'});db[_0x938e('0x41')][_0x938e('0x153')](db[_0x938e('0x13')],{'as':'Owner','foreignKey':_0x938e('0x115')});db[_0x938e('0x41')][_0x938e('0x121')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x938e('0x16e')});db['MailInteraction'][_0x938e('0x121')](db[_0x938e('0x93')],{'through':'mail_interaction_has_tags','as':_0x938e('0x16f')});db['MailInteraction'][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x170'),'through':_0x938e('0x129'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x938e('0x117')](db['Attachment'],{'as':'Attachments','onDelete':_0x938e('0x114')});db[_0x938e('0x43')][_0x938e('0x153')](db[_0x938e('0x13')],{'as':_0x938e('0x13')});db[_0x938e('0x43')][_0x938e('0x153')](db[_0x938e('0x75')],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x16d')});db[_0x938e('0x43')][_0x938e('0x153')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x938e('0x16b')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x15e')});db[_0x938e('0x164')][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':'restrict'});db['MailApplication'][_0x938e('0x153')](db['MailQueue'],{'onDelete':_0x938e('0x171')});db[_0x938e('0x164')][_0x938e('0x153')](db[_0x938e('0x3d')],{'onDelete':_0x938e('0x171')});db[_0x938e('0x164')][_0x938e('0x153')](db[_0x938e('0x8b')],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x164')][_0x938e('0x153')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x938e('0x172')});db['MailQueueReport']['belongsTo'](db[_0x938e('0x3d')],{});db[_0x938e('0x173')][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166')});db[_0x938e('0x173')][_0x938e('0x153')](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x173')][_0x938e('0x153')](db[_0x938e('0x41')],{});db['MailQueueReport'][_0x938e('0x153')](db[_0x938e('0x43')],{});db[_0x938e('0x173')][_0x938e('0x153')](db['User'],{});db[_0x938e('0x173')][_0x938e('0x153')](db[_0x938e('0x131')],{});db[_0x938e('0x47')][_0x938e('0x117')](db['DashboardItem'],{'as':'Items','onDelete':_0x938e('0x114')});db[_0x938e('0x4b')][_0x938e('0x117')](db[_0x938e('0x87')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db[_0x938e('0x175')],{'as':_0x938e('0x162'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x938e('0x117')](db[_0x938e('0x11d')],{'as':'Interactions'});db[_0x938e('0x4b')][_0x938e('0x117')](db[_0x938e('0x4c')],{'as':_0x938e('0x14b')});db[_0x938e('0x4b')][_0x938e('0x117')](db[_0x938e('0x19')],{'as':'Exntensions','onDelete':'cascade'});db[_0x938e('0x4b')]['hasMany'](db[_0x938e('0x4f')],{'as':_0x938e('0x159')});db[_0x938e('0x4b')][_0x938e('0x153')](db['Trunk'],{'as':'Trunk'});db[_0x938e('0x4b')][_0x938e('0x153')](db[_0x938e('0x125')],{'as':'List','foreignKey':'ListId'});db[_0x938e('0x4b')][_0x938e('0x153')](db[_0x938e('0x8c')],{'as':_0x938e('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x938e('0x4b')]['belongsToMany'](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':'user_has_fax_accounts'});db[_0x938e('0x4c')][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':_0x938e('0x171')});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':'restrict'});db[_0x938e('0x4c')][_0x938e('0x153')](db[_0x938e('0x4b')],{'onDelete':_0x938e('0x171')});db['FaxApplication'][_0x938e('0x153')](db['Tag'],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x172')});db[_0x938e('0x11d')][_0x938e('0x117')](db[_0x938e('0x4f')],{'as':_0x938e('0x159'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x176')});db[_0x938e('0x11d')][_0x938e('0x153')](db[_0x938e('0x4b')],{'as':'Account','foreignKey':_0x938e('0x177')});db[_0x938e('0x11d')][_0x938e('0x153')](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db['FaxInteraction'][_0x938e('0x153')](db['User'],{'as':_0x938e('0x178'),'foreignKey':_0x938e('0x115')});db['FaxInteraction'][_0x938e('0x121')](db['Tag'],{'through':_0x938e('0x179'),'as':_0x938e('0x16e')});db[_0x938e('0x11d')]['belongsToMany'](db[_0x938e('0x93')],{'through':_0x938e('0x179'),'as':'ThroughTags'});db[_0x938e('0x11d')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':'Users','through':_0x938e('0x17a'),'foreignKey':_0x938e('0x176')});db[_0x938e('0x4f')][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':'cascade','as':_0x938e('0x13')});db[_0x938e('0x4f')]['belongsTo'](db['FaxInteraction'],{'as':_0x938e('0x17b'),'foreignKey':_0x938e('0x176')});db['FaxMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x16d')});db[_0x938e('0x4f')][_0x938e('0x153')](db[_0x938e('0xf4')],{'as':_0x938e('0xf4'),'foreignKey':_0x938e('0x17c')});db['FaxMessage'][_0x938e('0x153')](db[_0x938e('0x4b')],{'as':_0x938e('0x16c'),'foreignKey':'FaxAccountId'});db[_0x938e('0x51')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0x938e('0x51')][_0x938e('0x121')](db[_0x938e('0xed')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x938e('0x52')][_0x938e('0x153')](db[_0x938e('0x4b')],{});db['FaxQueueReport'][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166')});db[_0x938e('0x52')][_0x938e('0x153')](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x52')][_0x938e('0x153')](db[_0x938e('0x11d')],{});db[_0x938e('0x52')]['belongsTo'](db['FaxMessage'],{});db[_0x938e('0x52')]['belongsTo'](db['User'],{});db['FaxQueueReport']['belongsTo'](db[_0x938e('0x51')],{});db[_0x938e('0x143')][_0x938e('0x117')](db[_0x938e('0x87')],{'as':_0x938e('0x161'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x938e('0x175')],{'as':_0x938e('0x162'),'foreignKey':_0x938e('0x17d')});db[_0x938e('0x143')][_0x938e('0x117')](db[_0x938e('0x59')],{'as':_0x938e('0x159'),'foreignKey':_0x938e('0x17d')});db[_0x938e('0x143')][_0x938e('0x117')](db[_0x938e('0x57')],{'as':'Interactions'});db[_0x938e('0x143')][_0x938e('0x117')](db[_0x938e('0x55')],{'as':'Applications'});db['SmsAccount'][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166')});db[_0x938e('0x143')]['belongsTo'](db[_0x938e('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x938e('0x168')});db[_0x938e('0x143')]['belongsToMany'](db[_0x938e('0x13')],{'as':'Agents','through':_0x938e('0x17e')});db[_0x938e('0x55')]['belongsTo'](db[_0x938e('0x13')],{'onDelete':'restrict'});db[_0x938e('0x55')][_0x938e('0x153')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x938e('0x55')]['belongsTo'](db[_0x938e('0x143')],{'onDelete':'restrict'});db[_0x938e('0x55')]['belongsTo'](db[_0x938e('0x8b')],{'onDelete':_0x938e('0x171'),'foreignKey':'IntervalId'});db['SmsApplication']['belongsTo'](db[_0x938e('0x93')],{'onDelete':'restrict','foreignKey':_0x938e('0x172')});db[_0x938e('0x57')][_0x938e('0x117')](db[_0x938e('0x59')],{'as':'Messages','onDelete':_0x938e('0x114'),'foreignKey':'SmsInteractionId'});db[_0x938e('0x57')][_0x938e('0x153')](db[_0x938e('0x143')],{'as':_0x938e('0x16c'),'foreignKey':'SmsAccountId'});db[_0x938e('0x57')]['belongsTo'](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x57')]['belongsTo'](db[_0x938e('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x938e('0x57')]['belongsToMany'](db[_0x938e('0x93')],{'through':_0x938e('0x17f'),'as':'Tags'});db[_0x938e('0x57')][_0x938e('0x121')](db['Tag'],{'through':_0x938e('0x17f'),'as':_0x938e('0x16f')});db[_0x938e('0x57')]['belongsToMany'](db[_0x938e('0x13')],{'as':_0x938e('0x170'),'through':_0x938e('0x12c'),'foreignKey':'SmsInteractionId'});db[_0x938e('0x59')]['belongsTo'](db[_0x938e('0x13')],{'as':'User'});db['SmsMessage'][_0x938e('0x153')](db['CmContact'],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x16d')});db[_0x938e('0x59')][_0x938e('0x153')](db['SmsInteraction'],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x17b'),'foreignKey':'SmsInteractionId'});db[_0x938e('0x59')][_0x938e('0x153')](db[_0x938e('0x143')],{'as':_0x938e('0x16c'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':_0x938e('0x37'),'foreignKey':_0x938e('0x180')});db[_0x938e('0x136')][_0x938e('0x121')](db['Team'],{'through':'team_has_sms_queues','as':_0x938e('0x157')});db['OpenchannelAccount'][_0x938e('0x117')](db[_0x938e('0x87')],{'as':'Dispositions','foreignKey':_0x938e('0x181')});db['OpenchannelAccount'][_0x938e('0x117')](db[_0x938e('0x175')],{'as':'Answers','foreignKey':_0x938e('0x181')});db[_0x938e('0x5c')][_0x938e('0x117')](db[_0x938e('0x60')],{'as':_0x938e('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x938e('0x5c')]['hasMany'](db['OpenchannelMessage'],{'as':_0x938e('0x159'),'foreignKey':_0x938e('0x181')});db[_0x938e('0x5c')]['hasMany'](db['OpenchannelApplication'],{'as':_0x938e('0x14b'),'foreignKey':'OpenchannelAccountId'});db[_0x938e('0x5c')]['belongsTo'](db[_0x938e('0x125')],{'as':'List','foreignKey':_0x938e('0x166')});db['OpenchannelAccount']['belongsTo'](db[_0x938e('0x8c')],{'as':_0x938e('0x156'),'foreignKey':_0x938e('0x168')});db[_0x938e('0x5c')]['belongsToMany'](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':_0x938e('0x142')});db[_0x938e('0x5e')][_0x938e('0x153')](db['User'],{'onDelete':_0x938e('0x171')});db['OpenchannelApplication'][_0x938e('0x153')](db[_0x938e('0x137')],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x182')});db[_0x938e('0x5e')][_0x938e('0x153')](db[_0x938e('0x5c')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x938e('0x5e')][_0x938e('0x153')](db[_0x938e('0x8b')],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x5e')][_0x938e('0x153')](db['Tag'],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x172')});db[_0x938e('0x60')][_0x938e('0x117')](db[_0x938e('0x62')],{'as':_0x938e('0x159'),'onDelete':'cascade','foreignKey':_0x938e('0x183')});db[_0x938e('0x60')][_0x938e('0x153')](db[_0x938e('0x5c')],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x181')});db[_0x938e('0x60')]['belongsTo'](db[_0x938e('0x75')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x938e('0x153')](db[_0x938e('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x938e('0x60')][_0x938e('0x121')](db['Tag'],{'through':_0x938e('0x184'),'as':'Tags'});db[_0x938e('0x60')][_0x938e('0x121')](db['Tag'],{'through':_0x938e('0x184'),'as':'ThroughTags'});db[_0x938e('0x60')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x170'),'through':_0x938e('0x12d'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x13')});db[_0x938e('0x62')][_0x938e('0x153')](db[_0x938e('0x75')],{'onDelete':'cascade','as':'Contact'});db[_0x938e('0x62')][_0x938e('0x153')](db[_0x938e('0x60')],{'onDelete':_0x938e('0x114'),'as':'Interaction','foreignKey':_0x938e('0x183')});db[_0x938e('0x62')][_0x938e('0x153')](db[_0x938e('0xf4')],{'as':'Attachment','foreignKey':_0x938e('0x17c')});db[_0x938e('0x62')][_0x938e('0x153')](db['OpenchannelAccount'],{'as':_0x938e('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x938e('0x137')]['belongsToMany'](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':_0x938e('0x38'),'foreignKey':_0x938e('0x182')});db['OpenchannelQueue'][_0x938e('0x121')](db[_0x938e('0xed')],{'through':_0x938e('0x185'),'as':'Teams'});db['ChatWebsite'][_0x938e('0x117')](db[_0x938e('0x87')],{'as':_0x938e('0x161'),'foreignKey':_0x938e('0x186')});db['ChatWebsite'][_0x938e('0x117')](db[_0x938e('0x175')],{'as':_0x938e('0x162'),'foreignKey':'ChatWebsiteId'});db[_0x938e('0x187')]['hasMany'](db[_0x938e('0x71')],{'as':_0x938e('0x188')});db[_0x938e('0x187')][_0x938e('0x117')](db[_0x938e('0x69')],{'as':'Interactions'});db['ChatWebsite'][_0x938e('0x117')](db['ChatApplication'],{'as':_0x938e('0x14b')});db[_0x938e('0x187')][_0x938e('0x117')](db[_0x938e('0x6a')],{'as':_0x938e('0x159')});db['ChatWebsite'][_0x938e('0x153')](db['CmList'],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166')});db['ChatWebsite'][_0x938e('0x153')](db[_0x938e('0x8b')],{'as':_0x938e('0x8b'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x187')][_0x938e('0x153')](db[_0x938e('0x8c')],{'as':_0x938e('0x156'),'foreignKey':_0x938e('0x168')});db[_0x938e('0x187')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':'user_has_chat_websites'});db[_0x938e('0x66')]['belongsTo'](db[_0x938e('0x5c')],{});db[_0x938e('0x66')][_0x938e('0x153')](db[_0x938e('0x125')],{'as':'List','foreignKey':_0x938e('0x166')});db['OpenchannelQueueReport'][_0x938e('0x153')](db['CmContact'],{'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db['OpenchannelQueueReport'][_0x938e('0x153')](db[_0x938e('0x60')],{});db[_0x938e('0x66')]['belongsTo'](db[_0x938e('0x62')],{});db[_0x938e('0x66')][_0x938e('0x153')](db[_0x938e('0x13')],{});db[_0x938e('0x66')][_0x938e('0x153')](db[_0x938e('0x137')],{});db[_0x938e('0x67')][_0x938e('0x153')](db[_0x938e('0x13')],{'as':'Agent','foreignKey':_0x938e('0x115'),'onDelete':_0x938e('0x171')});db['ChatApplication'][_0x938e('0x153')](db[_0x938e('0x6d')],{'as':'Queue','foreignKey':_0x938e('0x189'),'onDelete':_0x938e('0x171')});db[_0x938e('0x67')][_0x938e('0x153')](db[_0x938e('0x187')],{'as':'Website','foreignKey':_0x938e('0x186'),'onDelete':'restrict'});db[_0x938e('0x67')][_0x938e('0x153')](db[_0x938e('0x93')],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x172')});db[_0x938e('0x69')][_0x938e('0x117')](db[_0x938e('0x6a')],{'as':_0x938e('0x159'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x18a')});db[_0x938e('0x69')]['belongsTo'](db[_0x938e('0x187')],{'as':_0x938e('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x938e('0x69')][_0x938e('0x153')](db['CmContact'],{'as':'Contact','foreignKey':_0x938e('0x174')});db[_0x938e('0x69')][_0x938e('0x153')](db[_0x938e('0x13')],{'as':'Owner','foreignKey':_0x938e('0x115')});db[_0x938e('0x69')][_0x938e('0x121')](db[_0x938e('0x93')],{'through':_0x938e('0x18b'),'as':'Tags'});db[_0x938e('0x69')][_0x938e('0x121')](db[_0x938e('0x93')],{'through':_0x938e('0x18b'),'as':_0x938e('0x16f')});db[_0x938e('0x69')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':'Users','through':_0x938e('0x12b'),'foreignKey':_0x938e('0x18a')});db['ChatMessage'][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x13')});db[_0x938e('0x6a')][_0x938e('0x153')](db['CmContact'],{'onDelete':'cascade','as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x6a')]['belongsTo'](db[_0x938e('0x69')],{'onDelete':_0x938e('0x114'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x938e('0x6a')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x938e('0x6a')][_0x938e('0x153')](db['ChatWebsite'],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x186')});db[_0x938e('0x6b')][_0x938e('0x153')](db[_0x938e('0x75')],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x6b')][_0x938e('0x153')](db[_0x938e('0x187')],{'as':'Account','foreignKey':_0x938e('0x186')});db[_0x938e('0x6d')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':'Agents','through':_0x938e('0x134'),'hooks':!![]});db[_0x938e('0x6d')][_0x938e('0x121')](db['Team'],{'through':_0x938e('0x18c'),'as':_0x938e('0x157')});db[_0x938e('0x6f')][_0x938e('0x117')](db['ChatInternalMessage'],{'as':_0x938e('0x159'),'foreignKey':_0x938e('0x18d'),'onDelete':_0x938e('0x114')});db[_0x938e('0x6f')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x18e'),'through':_0x938e('0x122')});db[_0x938e('0x71')][_0x938e('0x153')](db[_0x938e('0x187')],{'as':_0x938e('0x18f'),'foreignKey':_0x938e('0x186')});db[_0x938e('0x73')][_0x938e('0x117')](db['CmContact'],{'as':_0x938e('0x123'),'foreignKey':'CompanyId'});db[_0x938e('0x75')]['hasMany'](db[_0x938e('0x14e')],{'as':_0x938e('0x14f'),'foreignKey':_0x938e('0x174')});db['CmContact'][_0x938e('0x117')](db[_0x938e('0x7a')],{'as':'HopperFinals','foreignKey':_0x938e('0x174')});db[_0x938e('0x75')][_0x938e('0x117')](db[_0x938e('0x7c')],{'as':_0x938e('0x150'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x75')][_0x938e('0x117')](db[_0x938e('0x7e')],{'as':_0x938e('0x7e'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x75')][_0x938e('0x117')](db['JscriptySessionReport'],{'as':_0x938e('0x152'),'foreignKey':_0x938e('0x174')});db[_0x938e('0x75')][_0x938e('0x117')](db[_0x938e('0x60')],{'as':'OpenchannelInteractions','foreignKey':_0x938e('0x174'),'onDelete':_0x938e('0x171')});db['CmContact'][_0x938e('0x117')](db['ChatInteraction'],{'as':_0x938e('0x12a'),'foreignKey':_0x938e('0x174'),'onDelete':'restrict'});db['CmContact'][_0x938e('0x117')](db[_0x938e('0x57')],{'as':_0x938e('0x190'),'foreignKey':_0x938e('0x174'),'onDelete':_0x938e('0x171')});db[_0x938e('0x75')]['hasMany'](db[_0x938e('0x11d')],{'as':_0x938e('0x11e'),'foreignKey':_0x938e('0x174'),'onDelete':'restrict'});db[_0x938e('0x75')][_0x938e('0x117')](db['MailInteraction'],{'as':_0x938e('0x128'),'foreignKey':'ContactId','onDelete':_0x938e('0x171')});db[_0x938e('0x75')][_0x938e('0x153')](db[_0x938e('0x73')],{'as':'Company','foreignKey':_0x938e('0x191')});db[_0x938e('0x75')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x938e('0x166'),'onDelete':_0x938e('0x114')});db[_0x938e('0x75')]['belongsToMany'](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db[_0x938e('0x75')]['belongsToMany'](db[_0x938e('0x93')],{'as':_0x938e('0x16e'),'through':_0x938e('0x192')});db['CmContact'][_0x938e('0x121')](db[_0x938e('0x93')],{'through':_0x938e('0x192'),'as':'ThroughTags'});db[_0x938e('0x14e')][_0x938e('0x153')](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':'ContactId','onDelete':_0x938e('0x114')});db[_0x938e('0x14e')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x938e('0x114')});db[_0x938e('0x14e')][_0x938e('0x153')](db['User'],{'as':'Agent','foreignKey':_0x938e('0x115')});db[_0x938e('0x14e')][_0x938e('0x153')](db[_0x938e('0x1d')],{'as':_0x938e('0x193'),'foreignKey':_0x938e('0x14d'),'onDelete':_0x938e('0x114')});db[_0x938e('0x14e')][_0x938e('0x153')](db[_0x938e('0xf1')],{'as':_0x938e('0xf1'),'foreignKey':'CampaignId','onDelete':_0x938e('0x114')});db[_0x938e('0x14e')][_0x938e('0x153')](db[_0x938e('0x13')],{'as':_0x938e('0x178'),'foreignKey':_0x938e('0x194')});db['CmHopperBlack']['belongsTo'](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':'ContactId','onDelete':_0x938e('0x114')});db[_0x938e('0x78')]['belongsTo'](db['CmList'],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166'),'onDelete':_0x938e('0x114')});db[_0x938e('0x78')]['belongsTo'](db[_0x938e('0x1d')],{'as':_0x938e('0x193'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x938e('0x78')][_0x938e('0x153')](db[_0x938e('0xf1')],{'as':_0x938e('0xf1'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x938e('0x84')][_0x938e('0x117')](db[_0x938e('0x89')],{'as':{'plural':_0x938e('0x195'),'singular':_0x938e('0x196')},'foreignKey':'AutomationAllId','onDelete':_0x938e('0x114'),'hooks':!![]});db[_0x938e('0x84')]['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':_0x938e('0x197')},'foreignKey':_0x938e('0x198'),'onDelete':'cascade','hooks':!![]});db[_0x938e('0x84')][_0x938e('0x117')](db[_0x938e('0x82')],{'as':'Actions','foreignKey':_0x938e('0x199'),'onDelete':_0x938e('0x114'),'hooks':!![]});db[_0x938e('0x87')][_0x938e('0x117')](db[_0x938e('0x87')],{'as':_0x938e('0x161'),'foreignKey':'ParentId','onDelete':_0x938e('0x114')});db['Interval'][_0x938e('0x117')](db[_0x938e('0x8b')],{'as':_0x938e('0x19a'),'foreignKey':'IntervalId','onDelete':_0x938e('0x114'),'hooks':!![],'required':![]});db[_0x938e('0x8b')][_0x938e('0x117')](db[_0x938e('0x19')],{'as':_0x938e('0x11a'),'foreignKey':_0x938e('0x155'),'onDelete':_0x938e('0x171')});db[_0x938e('0x8b')]['hasMany'](db['MailApplication'],{'as':_0x938e('0x19b'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x8b')][_0x938e('0x117')](db[_0x938e('0x67')],{'as':_0x938e('0x19c'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x8b')][_0x938e('0x117')](db[_0x938e('0x4c')],{'as':_0x938e('0x19d'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x8b')]['hasMany'](db['SmsApplication'],{'as':_0x938e('0x19e'),'foreignKey':_0x938e('0x155')});db[_0x938e('0x19f')]['belongsTo'](db[_0x938e('0x3d')],{});db[_0x938e('0x19f')][_0x938e('0x153')](db['AnalyticDefaultReport'],{'foreignKey':_0x938e('0x1a0')});db['Schedule'][_0x938e('0x153')](db[_0x938e('0x9d')],{'foreignKey':_0x938e('0x1a1')});db[_0x938e('0x92')]['belongsToMany'](db[_0x938e('0x1b')],{'as':_0x938e('0x1a2'),'through':_0x938e('0x1a3'),'onDelete':'restrict'});db[_0x938e('0x93')][_0x938e('0x121')](db[_0x938e('0x75')],{'through':_0x938e('0x192')});db[_0x938e('0x93')][_0x938e('0x121')](db[_0x938e('0x69')],{'through':'chat_interaction_has_tags'});db[_0x938e('0x93')][_0x938e('0x121')](db['MailInteraction'],{'through':_0x938e('0x1a4')});db[_0x938e('0x93')][_0x938e('0x121')](db[_0x938e('0x57')],{'through':_0x938e('0x17f')});db[_0x938e('0x93')][_0x938e('0x121')](db[_0x938e('0x11d')],{'through':_0x938e('0x179')});db[_0x938e('0x93')]['belongsToMany'](db[_0x938e('0x60')],{'through':'openchannel_interaction_has_tags'});db[_0x938e('0x93')][_0x938e('0x121')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x938e('0x96')][_0x938e('0x117')](db[_0x938e('0x89')],{'as':{'plural':_0x938e('0x1a5'),'singular':_0x938e('0x1a6')},'foreignKey':_0x938e('0x1a7'),'onDelete':_0x938e('0x114'),'hooks':!![]});db[_0x938e('0x96')][_0x938e('0x117')](db[_0x938e('0x89')],{'as':{'plural':_0x938e('0x1a8'),'singular':_0x938e('0x1a9')},'foreignKey':_0x938e('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x938e('0x96')]['hasMany'](db[_0x938e('0x82')],{'as':_0x938e('0x1ab'),'foreignKey':_0x938e('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0x938e('0x9d')]['hasMany'](db[_0x938e('0xa3')],{'as':_0x938e('0x1ad'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1a1'),'hooks':!![]});db[_0x938e('0x9f')]['hasMany'](db[_0x938e('0xa3')],{'as':_0x938e('0x1ad'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1a0')});db[_0x938e('0xa1')][_0x938e('0x117')](db[_0x938e('0xa3')],{'as':_0x938e('0x1ad'),'onDelete':_0x938e('0x114'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x938e('0x153')](db[_0x938e('0xa1')],{'foreignKey':_0x938e('0x1ae')});db[_0x938e('0xa7')]['hasMany'](db[_0x938e('0xa8')],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':'AccountId'});db[_0x938e('0xa8')]['hasMany'](db[_0x938e('0x1b0')],{'as':_0x938e('0x1b1'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xa8')][_0x938e('0x117')](db['SalesforceField'],{'as':_0x938e('0x1b3'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b4')});db['SalesforceConfiguration']['hasMany'](db[_0x938e('0x1b0')],{'as':_0x938e('0x1ad'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b5')});db['SalesforceConfiguration'][_0x938e('0x153')](db[_0x938e('0xa7')],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0x1b0')][_0x938e('0x117')](db[_0x938e('0x1b0')],{'as':'Subject','foreignKey':_0x938e('0x1b2')});db['SalesforceField'][_0x938e('0x117')](db[_0x938e('0x1b0')],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0x1b0')][_0x938e('0x117')](db[_0x938e('0x1b0')],{'as':_0x938e('0x1b8'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0x1b0')]['belongsTo'](db[_0x938e('0x98')],{'as':_0x938e('0x98'),'foreignKey':_0x938e('0x1b9')});db[_0x938e('0xab')]['hasMany'](db[_0x938e('0xad')],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db['SugarcrmConfiguration']['hasMany'](db[_0x938e('0xaf')],{'as':_0x938e('0x1b1'),'onDelete':_0x938e('0x114'),'foreignKey':'SubjectId'});db[_0x938e('0xad')][_0x938e('0x117')](db[_0x938e('0xaf')],{'as':'Descriptions','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xad')][_0x938e('0x117')](db[_0x938e('0xaf')],{'as':_0x938e('0x1ad'),'onDelete':'cascade','foreignKey':_0x938e('0x1b5')});db['SugarcrmConfiguration']['belongsTo'](db['SugarcrmAccount'],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x1b6')});db['SugarcrmField'][_0x938e('0x117')](db[_0x938e('0xaf')],{'as':'Subject','foreignKey':_0x938e('0x1b2')});db[_0x938e('0xaf')][_0x938e('0x117')](db[_0x938e('0xaf')],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xaf')]['hasMany'](db[_0x938e('0xaf')],{'as':_0x938e('0x1b8'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0xaf')][_0x938e('0x153')](db['Variable'],{'as':_0x938e('0x98'),'foreignKey':_0x938e('0x1b9')});db[_0x938e('0xb0')][_0x938e('0x117')](db[_0x938e('0xb2')],{'as':'Configurations','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xb2')][_0x938e('0x117')](db[_0x938e('0xb4')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x938e('0xb2')]['hasMany'](db[_0x938e('0xb4')],{'as':'Descriptions','onDelete':_0x938e('0x114'),'foreignKey':'DescriptionId'});db[_0x938e('0xb2')][_0x938e('0x117')](db[_0x938e('0xb4')],{'as':'Fields','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0xb2')][_0x938e('0x153')](db[_0x938e('0xb0')],{'as':'Account','foreignKey':_0x938e('0x1b6')});db[_0x938e('0xb2')][_0x938e('0x121')](db[_0x938e('0x93')],{'through':'int_desk_configuration_has_tags'});db[_0x938e('0xb4')]['hasMany'](db[_0x938e('0xb4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x938e('0xb4')]['hasMany'](db[_0x938e('0xb4')],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xb4')][_0x938e('0x117')](db[_0x938e('0xb4')],{'as':_0x938e('0x1b8'),'foreignKey':_0x938e('0x1b5')});db['DeskField']['belongsTo'](db[_0x938e('0x98')],{'as':_0x938e('0x98'),'foreignKey':'VariableId'});db[_0x938e('0x1ba')][_0x938e('0x117')](db['ZohoConfiguration'],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xb6')][_0x938e('0x117')](db[_0x938e('0xb7')],{'as':'Subjects','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b2')});db['ZohoConfiguration'][_0x938e('0x117')](db[_0x938e('0xb7')],{'as':_0x938e('0x1b3'),'onDelete':'cascade','foreignKey':_0x938e('0x1b4')});db['ZohoConfiguration']['hasMany'](db[_0x938e('0xb7')],{'as':_0x938e('0x1ad'),'onDelete':_0x938e('0x114'),'foreignKey':'FieldId'});db[_0x938e('0xb6')][_0x938e('0x153')](db[_0x938e('0x1ba')],{'as':_0x938e('0x16c'),'foreignKey':'AccountId'});db[_0x938e('0xb7')]['hasMany'](db[_0x938e('0xb7')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xb7')]['hasMany'](db[_0x938e('0xb7')],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xb7')][_0x938e('0x117')](db[_0x938e('0xb7')],{'as':_0x938e('0x1b8'),'foreignKey':_0x938e('0x1b5')});db['ZohoField'][_0x938e('0x153')](db[_0x938e('0x98')],{'as':_0x938e('0x98'),'foreignKey':'VariableId'});db[_0x938e('0xb9')][_0x938e('0x117')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x938e('0x114'),'foreignKey':'AccountId'});db[_0x938e('0xbb')]['hasMany'](db['ZendeskField'],{'as':_0x938e('0x1b1'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xbb')][_0x938e('0x117')](db[_0x938e('0xbd')],{'as':_0x938e('0x1b3'),'foreignKey':_0x938e('0x1b4')});db['ZendeskConfiguration']['hasMany'](db[_0x938e('0xbd')],{'as':_0x938e('0x1ad'),'foreignKey':_0x938e('0x1b5')});db['ZendeskConfiguration'][_0x938e('0x153')](db['ZendeskAccount'],{'as':_0x938e('0x16c'),'foreignKey':'AccountId'});db[_0x938e('0xbb')][_0x938e('0x121')](db[_0x938e('0x93')],{'through':'int_zendesk_configuration_has_tags'});db[_0x938e('0xbd')]['hasMany'](db[_0x938e('0xbd')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xbd')]['hasMany'](db['ZendeskField'],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xbd')][_0x938e('0x117')](db[_0x938e('0xbd')],{'as':'Field','foreignKey':_0x938e('0x1b5')});db[_0x938e('0xbd')][_0x938e('0x153')](db[_0x938e('0x98')],{'as':_0x938e('0x98'),'foreignKey':_0x938e('0x1b9')});db[_0x938e('0xbf')]['hasMany'](db[_0x938e('0xc0')],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':'AccountId'});db[_0x938e('0xc0')]['hasMany'](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xc0')][_0x938e('0x117')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x938e('0x114'),'foreignKey':'DescriptionId'});db[_0x938e('0xc0')][_0x938e('0x117')](db[_0x938e('0xc2')],{'as':'Fields','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0xc0')][_0x938e('0x153')](db['FreshdeskAccount'],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xc0')]['belongsToMany'](db[_0x938e('0x93')],{'through':_0x938e('0x1bc')});db['FreshdeskField'][_0x938e('0x117')](db[_0x938e('0xc2')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db['FreshdeskField'][_0x938e('0x117')](db[_0x938e('0xc2')],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xc2')][_0x938e('0x117')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x938e('0x1b5')});db['FreshdeskField'][_0x938e('0x153')](db[_0x938e('0x98')],{'as':'Variable','foreignKey':_0x938e('0x1b9')});db[_0x938e('0xc4')][_0x938e('0x117')](db[_0x938e('0xc6')],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xc6')][_0x938e('0x117')](db[_0x938e('0x1bd')],{'as':_0x938e('0x1b1'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xc6')][_0x938e('0x117')](db[_0x938e('0x1bd')],{'as':'Descriptions','foreignKey':_0x938e('0x1b4')});db['VtigerConfiguration'][_0x938e('0x117')](db['VtigerField'],{'as':_0x938e('0x1ad'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0xc6')]['belongsTo'](db[_0x938e('0xc4')],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0x1bd')][_0x938e('0x117')](db[_0x938e('0x1bd')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0x1bd')][_0x938e('0x117')](db[_0x938e('0x1bd')],{'as':'Description','foreignKey':_0x938e('0x1b4')});db['VtigerField'][_0x938e('0x117')](db[_0x938e('0x1bd')],{'as':_0x938e('0x1b8'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0x1bd')]['belongsTo'](db[_0x938e('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0x938e('0xc8')][_0x938e('0x117')](db[_0x938e('0xca')],{'as':'Configurations','onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xca')][_0x938e('0x117')](db['ServicenowField'],{'as':_0x938e('0x1b1'),'foreignKey':_0x938e('0x1b2')});db['ServicenowConfiguration'][_0x938e('0x117')](db['ServicenowField'],{'as':_0x938e('0x1b3'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xca')][_0x938e('0x117')](db[_0x938e('0xcc')],{'as':_0x938e('0x1ad'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0xca')][_0x938e('0x153')](db['ServicenowAccount'],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xcc')][_0x938e('0x117')](db[_0x938e('0xcc')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db['ServicenowField'][_0x938e('0x117')](db[_0x938e('0xcc')],{'as':_0x938e('0x1b7'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x938e('0x117')](db['ServicenowField'],{'as':_0x938e('0x1b8'),'foreignKey':'FieldId'});db['ServicenowField'][_0x938e('0x153')](db[_0x938e('0x98')],{'as':'Variable','foreignKey':_0x938e('0x1b9')});db[_0x938e('0xce')][_0x938e('0x117')](db[_0x938e('0xd0')],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0xd0')][_0x938e('0x117')](db[_0x938e('0xd2')],{'as':_0x938e('0x1b1'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xd0')]['hasMany'](db[_0x938e('0xd2')],{'as':_0x938e('0x1b3'),'onDelete':'cascade','foreignKey':_0x938e('0x1b4')});db['Dynamics365Configuration'][_0x938e('0x117')](db[_0x938e('0xd2')],{'as':_0x938e('0x1ad'),'onDelete':'cascade','foreignKey':_0x938e('0x1b5')});db['Dynamics365Configuration'][_0x938e('0x153')](db[_0x938e('0xce')],{'as':_0x938e('0x16c'),'foreignKey':'AccountId'});db[_0x938e('0xd2')][_0x938e('0x117')](db[_0x938e('0xd2')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x938e('0x1b7'),'foreignKey':_0x938e('0x1b4')});db[_0x938e('0xd2')][_0x938e('0x117')](db[_0x938e('0xd2')],{'as':_0x938e('0x1b8'),'foreignKey':_0x938e('0x1b5')});db[_0x938e('0xd2')][_0x938e('0x153')](db[_0x938e('0x98')],{'as':_0x938e('0x98'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0x938e('0x117')](db[_0x938e('0xd6')],{'as':_0x938e('0x1af'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1b6')});db['FreshsalesConfiguration'][_0x938e('0x117')](db['FreshsalesField'],{'as':_0x938e('0x1b1'),'foreignKey':_0x938e('0x1b2')});db[_0x938e('0xd6')][_0x938e('0x117')](db[_0x938e('0x1be')],{'as':'Descriptions','foreignKey':_0x938e('0x1b4')});db['FreshsalesConfiguration']['hasMany'](db[_0x938e('0x1be')],{'as':_0x938e('0x1ad'),'foreignKey':'FieldId'});db[_0x938e('0xd6')][_0x938e('0x153')](db[_0x938e('0xd4')],{'as':_0x938e('0x16c'),'foreignKey':_0x938e('0x1b6')});db[_0x938e('0x1be')][_0x938e('0x117')](db[_0x938e('0x1be')],{'as':_0x938e('0x1bb'),'foreignKey':_0x938e('0x1b2')});db['FreshsalesField'][_0x938e('0x117')](db[_0x938e('0x1be')],{'as':_0x938e('0x1b7'),'foreignKey':'DescriptionId'});db[_0x938e('0x1be')][_0x938e('0x117')](db[_0x938e('0x1be')],{'as':_0x938e('0x1b8'),'foreignKey':'FieldId'});db[_0x938e('0x1be')][_0x938e('0x153')](db[_0x938e('0x98')],{'as':_0x938e('0x98'),'foreignKey':_0x938e('0x1b9')});db[_0x938e('0xda')][_0x938e('0x153')](db['ChatWebsite'],{});db[_0x938e('0xda')][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':_0x938e('0x166')});db[_0x938e('0xda')]['belongsTo'](db[_0x938e('0x75')],{'as':_0x938e('0x16d'),'foreignKey':_0x938e('0x174')});db[_0x938e('0xda')][_0x938e('0x153')](db[_0x938e('0x69')],{});db['ChatQueueReport']['belongsTo'](db[_0x938e('0x6a')],{});db[_0x938e('0xda')]['belongsTo'](db[_0x938e('0x13')],{});db[_0x938e('0xda')][_0x938e('0x153')](db[_0x938e('0x6d')],{});db[_0x938e('0xdb')][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1bf')});db[_0x938e('0xdb')][_0x938e('0x153')](db[_0x938e('0x13')],{'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x1c0')});db[_0x938e('0xde')][_0x938e('0x117')](db['JscriptyQuestionReport'],{'foreignKey':_0x938e('0x1c1'),'onDelete':_0x938e('0x114')});db[_0x938e('0xde')][_0x938e('0x117')](db[_0x938e('0x1c2')],{'foreignKey':_0x938e('0x1c1'),'onDelete':'cascade'});db[_0x938e('0x1c3')][_0x938e('0x153')](db['SmsAccount'],{});db[_0x938e('0x1c3')][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':'ListId'});db[_0x938e('0x1c3')][_0x938e('0x153')](db['CmContact'],{'as':_0x938e('0x16d'),'foreignKey':'ContactId'});db[_0x938e('0x1c3')]['belongsTo'](db[_0x938e('0x57')],{});db[_0x938e('0x1c3')][_0x938e('0x153')](db[_0x938e('0x59')],{});db[_0x938e('0x1c3')]['belongsTo'](db[_0x938e('0x13')],{});db[_0x938e('0x1c3')][_0x938e('0x153')](db[_0x938e('0x136')],{});db['JscriptyProject'][_0x938e('0x117')](db[_0x938e('0xde')],{'foreignKey':'ProjectId'});db[_0x938e('0xe2')][_0x938e('0x117')](db[_0x938e('0xdd')],{'foreignKey':_0x938e('0x1c4')});db[_0x938e('0xe2')]['hasMany'](db[_0x938e('0x1c2')],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db[_0x938e('0x13')],{'as':_0x938e('0x170'),'through':_0x938e('0x147')});db[_0x938e('0xed')]['belongsToMany'](db['User'],{'as':_0x938e('0x169'),'through':'user_has_teams'});db['Team'][_0x938e('0x121')](db[_0x938e('0x1d')],{'through':_0x938e('0x158'),'as':_0x938e('0x130')});db[_0x938e('0xed')][_0x938e('0x121')](db['MailQueue'],{'through':_0x938e('0x16a'),'as':_0x938e('0x132')});db[_0x938e('0xed')][_0x938e('0x121')](db[_0x938e('0x6d')],{'through':_0x938e('0x18c'),'as':_0x938e('0x133')});db[_0x938e('0xed')]['belongsToMany'](db[_0x938e('0x51')],{'through':_0x938e('0x1c5'),'as':'FaxQueues'});db[_0x938e('0xed')]['belongsToMany'](db[_0x938e('0x136')],{'through':_0x938e('0x1c6'),'as':'SmsQueues'});db[_0x938e('0xed')][_0x938e('0x121')](db[_0x938e('0x137')],{'through':_0x938e('0x185'),'as':_0x938e('0x1c7')});db[_0x938e('0xed')][_0x938e('0x121')](db[_0x938e('0x111')],{'through':_0x938e('0x1c8'),'as':_0x938e('0x138')});db[_0x938e('0xf1')][_0x938e('0x117')](db['CmHopper'],{'as':_0x938e('0x14f'),'foreignKey':'CampaignId'});db['Campaign'][_0x938e('0x117')](db[_0x938e('0x7a')],{'as':_0x938e('0x11b'),'foreignKey':_0x938e('0x1c9')});db[_0x938e('0xf1')]['hasMany'](db[_0x938e('0x7c')],{'as':_0x938e('0x150'),'foreignKey':'CampaignId'});db[_0x938e('0xf1')]['hasMany'](db[_0x938e('0x78')],{'as':_0x938e('0x151'),'foreignKey':'CampaignId'});db[_0x938e('0xf1')][_0x938e('0x153')](db['Trunk'],{'as':_0x938e('0x2c'),'foreignKey':_0x938e('0x154')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x938e('0x1ca'),'foreignKey':'TrunkBackupId'});db[_0x938e('0xf1')][_0x938e('0x153')](db[_0x938e('0x8b')],{'as':'Interval','foreignKey':_0x938e('0x155')});db[_0x938e('0xf1')][_0x938e('0x153')](db['SquareProject'],{'as':_0x938e('0xe8'),'foreignKey':_0x938e('0x1cb')});db['Campaign'][_0x938e('0x121')](db[_0x938e('0x125')],{'as':_0x938e('0x126'),'through':_0x938e('0x1cc')});db[_0x938e('0xf1')]['belongsToMany'](db[_0x938e('0x125')],{'as':_0x938e('0x1cd'),'through':_0x938e('0x1ce')});db[_0x938e('0xf7')][_0x938e('0x153')](db[_0x938e('0x43')],{});db['MailTransferReport'][_0x938e('0x153')](db[_0x938e('0x41')],{});db[_0x938e('0xf7')]['belongsTo'](db[_0x938e('0x3d')],{'foreignKey':_0x938e('0x1cf'),'as':_0x938e('0x1d0')});db[_0x938e('0xf7')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':'FromUserId','as':_0x938e('0x1d1')});db[_0x938e('0xf7')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':'ToUserId','as':_0x938e('0x1d2')});db[_0x938e('0xf7')][_0x938e('0x153')](db[_0x938e('0x131')],{'foreignKey':_0x938e('0x1d3'),'as':'ToQueue'});db[_0x938e('0xf7')][_0x938e('0x153')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x938e('0x1d4')});db[_0x938e('0xf9')][_0x938e('0x153')](db[_0x938e('0x6a')],{});db[_0x938e('0xf9')][_0x938e('0x153')](db['ChatInteraction'],{});db[_0x938e('0xf9')][_0x938e('0x153')](db[_0x938e('0x187')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x938e('0xf9')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':_0x938e('0x1d5'),'as':_0x938e('0x1d1')});db[_0x938e('0xf9')]['belongsTo'](db[_0x938e('0x13')],{'foreignKey':_0x938e('0x1d6'),'as':'ToAgent'});db['ChatTransferReport'][_0x938e('0x153')](db[_0x938e('0x6d')],{'foreignKey':'ToChatQueueId','as':_0x938e('0x1d7')});db['ChatTransferReport'][_0x938e('0x153')](db[_0x938e('0x187')],{'foreignKey':_0x938e('0x1d8'),'as':_0x938e('0x1d4')});db[_0x938e('0xfa')][_0x938e('0x153')](db[_0x938e('0x4f')],{});db[_0x938e('0xfa')][_0x938e('0x153')](db[_0x938e('0x11d')],{});db[_0x938e('0xfa')][_0x938e('0x153')](db[_0x938e('0x4b')],{'foreignKey':_0x938e('0x1d9'),'as':_0x938e('0x1d0')});db[_0x938e('0xfa')][_0x938e('0x153')](db['User'],{'foreignKey':'FromUserId','as':_0x938e('0x1d1')});db[_0x938e('0xfa')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':_0x938e('0x1d6'),'as':_0x938e('0x1d2')});db[_0x938e('0xfa')][_0x938e('0x153')](db[_0x938e('0x51')],{'foreignKey':_0x938e('0x1da'),'as':_0x938e('0x1d7')});db[_0x938e('0xfa')][_0x938e('0x153')](db[_0x938e('0x4b')],{'foreignKey':'ToFaxAccountId','as':_0x938e('0x1d4')});db[_0x938e('0xfc')][_0x938e('0x153')](db[_0x938e('0x62')],{});db[_0x938e('0xfc')][_0x938e('0x153')](db[_0x938e('0x60')],{});db[_0x938e('0xfc')][_0x938e('0x153')](db[_0x938e('0x5c')],{'foreignKey':_0x938e('0x1db'),'as':_0x938e('0x1d0')});db[_0x938e('0xfc')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':'FromUserId','as':_0x938e('0x1d1')});db[_0x938e('0xfc')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':_0x938e('0x1d6'),'as':_0x938e('0x1d2')});db[_0x938e('0xfc')]['belongsTo'](db[_0x938e('0x137')],{'foreignKey':_0x938e('0x1dc'),'as':'ToQueue'});db[_0x938e('0xfc')][_0x938e('0x153')](db[_0x938e('0x5c')],{'foreignKey':_0x938e('0x1dd'),'as':_0x938e('0x1d4')});db[_0x938e('0xfe')][_0x938e('0x153')](db[_0x938e('0x59')],{});db['SmsTransferReport']['belongsTo'](db['SmsInteraction'],{});db[_0x938e('0xfe')]['belongsTo'](db[_0x938e('0x143')],{'foreignKey':'FromSmsAccountId','as':_0x938e('0x1d0')});db[_0x938e('0xfe')]['belongsTo'](db['User'],{'foreignKey':_0x938e('0x1d5'),'as':'FromAgent'});db[_0x938e('0xfe')][_0x938e('0x153')](db['User'],{'foreignKey':_0x938e('0x1d6'),'as':_0x938e('0x1d2')});db[_0x938e('0xfe')][_0x938e('0x153')](db[_0x938e('0x136')],{'foreignKey':_0x938e('0x1de'),'as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db[_0x938e('0x143')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x938e('0x125')][_0x938e('0x117')](db['Disposition'],{'as':_0x938e('0x161'),'foreignKey':_0x938e('0x166')});db['CmList'][_0x938e('0x117')](db[_0x938e('0x80')],{'as':'CustomFields','foreignKey':_0x938e('0x166')});db[_0x938e('0x125')][_0x938e('0x117')](db[_0x938e('0x75')],{'as':_0x938e('0x123'),'onDelete':_0x938e('0x114'),'foreignKey':_0x938e('0x166')});db[_0x938e('0x125')][_0x938e('0x117')](db[_0x938e('0x7a')],{'as':_0x938e('0x11b'),'foreignKey':_0x938e('0x166')});db[_0x938e('0x125')][_0x938e('0x117')](db[_0x938e('0x7c')],{'as':_0x938e('0x1df'),'foreignKey':'ListId'});db[_0x938e('0x125')][_0x938e('0x117')](db[_0x938e('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x938e('0x166')});db[_0x938e('0x125')]['belongsToMany'](db[_0x938e('0x1d')],{'as':_0x938e('0x1e0'),'through':_0x938e('0x1e1')});db[_0x938e('0x125')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':_0x938e('0x127')});db[_0x938e('0x101')][_0x938e('0x117')](db[_0x938e('0x19')],{'as':_0x938e('0x11a'),'onDelete':_0x938e('0x114')});db[_0x938e('0x101')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':_0x938e('0x169'),'through':_0x938e('0x13b')});db[_0x938e('0x103')]['hasMany'](db['User'],{'as':_0x938e('0x170'),'foreignKey':'userProfileId'});db[_0x938e('0x103')]['hasMany'](db[_0x938e('0x1e2')],{'as':_0x938e('0x1e3'),'foreignKey':_0x938e('0x1e4'),'onDelete':_0x938e('0x114')});db[_0x938e('0x1e2')][_0x938e('0x117')](db[_0x938e('0x104')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x938e('0x114')});db[_0x938e('0x107')][_0x938e('0x117')](db[_0x938e('0x87')],{'as':_0x938e('0x161'),'foreignKey':_0x938e('0x1e5')});db[_0x938e('0x107')][_0x938e('0x117')](db[_0x938e('0x175')],{'as':_0x938e('0x162'),'foreignKey':'WhatsappAccountId'});db[_0x938e('0x107')][_0x938e('0x117')](db[_0x938e('0x10c')],{'as':_0x938e('0x159'),'foreignKey':_0x938e('0x1e5')});db['WhatsappAccount'][_0x938e('0x117')](db[_0x938e('0x10b')],{'as':_0x938e('0x163')});db[_0x938e('0x107')][_0x938e('0x117')](db[_0x938e('0x109')],{'as':_0x938e('0x14b')});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':_0x938e('0x165'),'foreignKey':'ListId'});db[_0x938e('0x107')]['belongsTo'](db[_0x938e('0x8c')],{'as':_0x938e('0x156'),'foreignKey':_0x938e('0x168')});db[_0x938e('0x107')]['belongsToMany'](db['User'],{'as':_0x938e('0x169'),'through':_0x938e('0x146')});db[_0x938e('0x109')][_0x938e('0x153')](db['User'],{'onDelete':'restrict'});db[_0x938e('0x109')]['belongsTo'](db[_0x938e('0x111')],{'onDelete':'restrict'});db[_0x938e('0x109')][_0x938e('0x153')](db[_0x938e('0x107')],{'onDelete':_0x938e('0x171')});db['WhatsappApplication']['belongsTo'](db[_0x938e('0x8b')],{'onDelete':'restrict','foreignKey':_0x938e('0x155')});db[_0x938e('0x109')][_0x938e('0x153')](db[_0x938e('0x93')],{'onDelete':_0x938e('0x171'),'foreignKey':_0x938e('0x172')});db[_0x938e('0x10b')][_0x938e('0x117')](db[_0x938e('0x10c')],{'as':_0x938e('0x159'),'onDelete':'cascade','foreignKey':_0x938e('0x1e6')});db[_0x938e('0x10b')]['belongsTo'](db[_0x938e('0x107')],{'as':'Account','foreignKey':_0x938e('0x1e5')});db[_0x938e('0x10b')][_0x938e('0x153')](db['CmContact'],{'as':_0x938e('0x16d'),'foreignKey':'ContactId'});db[_0x938e('0x10b')][_0x938e('0x153')](db['User'],{'as':_0x938e('0x178'),'foreignKey':_0x938e('0x115')});db[_0x938e('0x10b')][_0x938e('0x121')](db[_0x938e('0x93')],{'through':_0x938e('0x1e7'),'as':_0x938e('0x16e')});db['WhatsappInteraction'][_0x938e('0x121')](db[_0x938e('0x93')],{'through':_0x938e('0x1e7'),'as':_0x938e('0x16f')});db[_0x938e('0x10b')][_0x938e('0x121')](db[_0x938e('0x13')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x938e('0x1e6')});db[_0x938e('0x10c')][_0x938e('0x153')](db['User'],{'as':_0x938e('0x13')});db['WhatsappMessage']['belongsTo'](db[_0x938e('0x75')],{'onDelete':'cascade','as':_0x938e('0x16d')});db[_0x938e('0x10c')][_0x938e('0x153')](db[_0x938e('0x10b')],{'onDelete':_0x938e('0x114'),'as':_0x938e('0x17b'),'foreignKey':_0x938e('0x1e6')});db[_0x938e('0x10c')][_0x938e('0x153')](db[_0x938e('0x107')],{'as':'Account','foreignKey':_0x938e('0x1e5')});db[_0x938e('0x10e')][_0x938e('0x153')](db[_0x938e('0x107')],{});db['WhatsappQueueReport'][_0x938e('0x153')](db[_0x938e('0x125')],{'as':_0x938e('0x165'),'foreignKey':'ListId'});db[_0x938e('0x10e')][_0x938e('0x153')](db['CmContact'],{'as':'Contact','foreignKey':_0x938e('0x174')});db[_0x938e('0x10e')][_0x938e('0x153')](db[_0x938e('0x10b')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x938e('0x111')],{});db[_0x938e('0x10e')][_0x938e('0x153')](db[_0x938e('0x10c')],{});db[_0x938e('0x10e')][_0x938e('0x153')](db[_0x938e('0x13')],{});db['WhatsappTransferReport'][_0x938e('0x153')](db[_0x938e('0x10c')],{});db[_0x938e('0x10f')][_0x938e('0x153')](db[_0x938e('0x10b')],{});db['WhatsappTransferReport'][_0x938e('0x153')](db[_0x938e('0x107')],{'foreignKey':'FromWhatsappAccountId','as':_0x938e('0x1d0')});db[_0x938e('0x10f')][_0x938e('0x153')](db[_0x938e('0x107')],{'foreignKey':'ToWhatsappAccountId','as':_0x938e('0x1d4')});db[_0x938e('0x10f')]['belongsTo'](db[_0x938e('0x111')],{'foreignKey':_0x938e('0x1e8'),'as':'ToQueue'});db[_0x938e('0x10f')][_0x938e('0x153')](db[_0x938e('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x938e('0x10f')]['belongsTo'](db[_0x938e('0x13')],{'foreignKey':_0x938e('0x1d6'),'as':_0x938e('0x1d2')});db[_0x938e('0x111')]['belongsToMany'](db['User'],{'as':_0x938e('0x169'),'through':_0x938e('0x139'),'foreignKey':_0x938e('0x1e9')});db['WhatsappQueue']['belongsToMany'](db[_0x938e('0xed')],{'through':'team_has_whatsapp_queues','as':_0x938e('0x157')});module[_0x938e('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1d0f935..8d5bd0e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/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/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/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/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x2350a0,_0x1e8c56){var _0x3e3302=function(_0x3889d7){while(--_0x3889d7){_0x2350a0['push'](_0x2350a0['shift']());}};_0x3e3302(++_0x1e8c56);}(_0x757a,0xde));var _0xa757=function(_0x3e4f8a,_0x48daa1){_0x3e4f8a=_0x3e4f8a-0x0;var _0xed7075=_0x757a[_0x3e4f8a];return _0xed7075;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file +var _0x2032=['/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','/www','/demo','/snippet','join','snippet','1.0.16','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','street','phone','fax','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','path','express','express-winston','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','method','x-forwarded-for','remoteAddress','url','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','connection','statusCode','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0x2032,0xd9));var _0x2203=function(_0x1da472,_0x30f847){_0x1da472=_0x1da472-0x0;var _0x5e6aed=_0x2032[_0x1da472];return _0x5e6aed;};'use strict';var _=require('lodash');var path=require(_0x2203('0x0'));var express=require(_0x2203('0x1'));var ewinston=require(_0x2203('0x2'));var util=require('util');var errors=require(_0x2203('0x3'));var config=require(_0x2203('0x4'));var logger=require('./config/logger')(_0x2203('0x5'));var authLogger=require(_0x2203('0x6'))(_0x2203('0x7'));exports[_0x2203('0x8')]=function(_0x3f7ba1){_0x3f7ba1[_0x2203('0x9')](ewinston[_0x2203('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2676aa,_0x18c4d6){var _0x2049ff=_0x2203('0xb');if(!_['isEmpty'](_0x2676aa['body'])){_0x2049ff+=_0x2203('0xc');var _0x549908=_0x2676aa[_0x2203('0xd')];maskSensitiveData(_0x549908);}return util[_0x2203('0xe')](_0x2049ff,_0x2676aa[_0x2203('0xf')],_0x2676aa['headers'][_0x2203('0x10')]?_0x2676aa['headers'][_0x2203('0x10')]:_0x2676aa['connection'][_0x2203('0x11')]||_0x2676aa['ip'],_0x2676aa[_0x2203('0x12')],_0x18c4d6['statusCode'],_0x18c4d6['responseTime'],_0x2676aa['user']?_0x2676aa['user']['id']:null,_0x2676aa['user']?_0x2676aa[_0x2203('0x13')]['name']:null,_0x2676aa['user']?_0x2676aa[_0x2203('0x13')][_0x2203('0x14')]:null,_0x549908?util[_0x2203('0x15')](_0x549908,![],null):'');}}));_0x3f7ba1[_0x2203('0x9')](ewinston[_0x2203('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3fe0a8,_0x2c36e6){var _0x2c085c=_0x2203('0x16');if(_0x3fe0a8[_0x2203('0xd')]&&_0x3fe0a8['body'][_0x2203('0x17')]&&_0x3fe0a8[_0x2203('0xd')]['agent_id']){_0x2c085c=_0x2203('0x18');}return util[_0x2203('0xe')](_0x2c085c,_0x3fe0a8['method'],_0x3fe0a8[_0x2203('0x19')]['x-forwarded-for']?_0x3fe0a8[_0x2203('0x19')][_0x2203('0x10')]:_0x3fe0a8[_0x2203('0x1a')][_0x2203('0x11')]||_0x3fe0a8['ip'],_0x3fe0a8[_0x2203('0x12')],_0x2c36e6[_0x2203('0x1b')],_0x2c36e6['responseTime'],_0x3fe0a8[_0x2203('0x13')]?_0x3fe0a8['user']['id']:null,_0x3fe0a8['user']?_0x3fe0a8[_0x2203('0x13')]['name']:null,_0x3fe0a8[_0x2203('0x13')]?_0x3fe0a8[_0x2203('0x13')]['role']:null,_0x3fe0a8[_0x2203('0xd')]&&_0x3fe0a8['body']['device']?_0x3fe0a8[_0x2203('0xd')][_0x2203('0x17')]:_0x2203('0x1c'),_0x3fe0a8[_0x2203('0xd')]&&_0x3fe0a8[_0x2203('0xd')][_0x2203('0x1d')]?_0x3fe0a8[_0x2203('0xd')][_0x2203('0x1d')]:'',_0x3fe0a8['body']&&_0x3fe0a8[_0x2203('0xd')][_0x2203('0x1e')]?_0x3fe0a8[_0x2203('0xd')]['agent_name']:'');},'ignoreRoute':function(_0xb2071b){var _0x1cec17=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1cec17['test'](_0xb2071b[_0x2203('0x12')]);}}));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x1f'),require(_0x2203('0x20')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x21'),require(_0x2203('0x22')));_0x3f7ba1['use'](_0x2203('0x23'),require(_0x2203('0x24')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x25'),require('./api/voiceExtension'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x26'),require(_0x2203('0x27')));_0x3f7ba1[_0x2203('0x9')]('/api/voice/queues',require(_0x2203('0x28')));_0x3f7ba1[_0x2203('0x9')]('/api/voice/recordings',require('./api/voiceRecording'));_0x3f7ba1[_0x2203('0x9')]('/api/screen/recordings',require('./api/screenRecording'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x29'),require(_0x2203('0x2a')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2b'),require('./api/voiceMailMessage'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2c'),require('./api/voiceCallReport'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2d'),require(_0x2203('0x2e')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2f'),require(_0x2203('0x30')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x31'),require(_0x2203('0x32')));_0x3f7ba1['use'](_0x2203('0x33'),require(_0x2203('0x34')));_0x3f7ba1['use']('/api/trunks',require(_0x2203('0x35')));_0x3f7ba1['use'](_0x2203('0x36'),require(_0x2203('0x37')));_0x3f7ba1[_0x2203('0x9')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x3f7ba1[_0x2203('0x9')]('/api/mail/accounts',require(_0x2203('0x38')));_0x3f7ba1['use'](_0x2203('0x39'),require('./api/mailQueue'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x3a'),require(_0x2203('0x3b')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x3c'),require('./api/mailInteraction'));_0x3f7ba1['use']('/api/mail/messages',require(_0x2203('0x3d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x3e'),require(_0x2203('0x3f')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x40'),require(_0x2203('0x41')));_0x3f7ba1['use'](_0x2203('0x42'),require(_0x2203('0x43')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x44'),require('./api/dashboardItem'));_0x3f7ba1['use'](_0x2203('0x45'),require('./api/faxAccount'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x46'),require(_0x2203('0x47')));_0x3f7ba1['use']('/api/fax/interactions',require(_0x2203('0x48')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x49'),require(_0x2203('0x4a')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x4b'),require('./api/faxQueue'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x4c'),require(_0x2203('0x4d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x4e'),require(_0x2203('0x4f')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x50'),require(_0x2203('0x51')));_0x3f7ba1[_0x2203('0x9')]('/api/sms/interactions',require(_0x2203('0x52')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x53'),require(_0x2203('0x54')));_0x3f7ba1['use']('/api/sms/queues',require(_0x2203('0x55')));_0x3f7ba1['use'](_0x2203('0x56'),require(_0x2203('0x57')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x58'),require('./api/openchannelApplication'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x59'),require('./api/openchannelInteraction'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x5a'),require(_0x2203('0x5b')));_0x3f7ba1[_0x2203('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3f7ba1[_0x2203('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x5c'),require(_0x2203('0x5d')));_0x3f7ba1['use']('/api/chat/applications',require(_0x2203('0x5e')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x5f'),require(_0x2203('0x60')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x61'),require('./api/chatMessage'));_0x3f7ba1[_0x2203('0x9')]('/api/chat/offline_messages',require(_0x2203('0x62')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x63'),require(_0x2203('0x64')));_0x3f7ba1['use']('/api/chat/groups',require(_0x2203('0x65')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x66'),require(_0x2203('0x67')));_0x3f7ba1['use']('/api/cm/companies',require('./api/cmCompany'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x68'),require('./api/cmContact'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x69'),require('./api/cmHopper'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x6a'),require(_0x2203('0x6b')));_0x3f7ba1[_0x2203('0x9')]('/api/cm/hopper_final',require(_0x2203('0x6c')));_0x3f7ba1['use'](_0x2203('0x6d'),require(_0x2203('0x6e')));_0x3f7ba1['use'](_0x2203('0x6f'),require(_0x2203('0x70')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x71'),require(_0x2203('0x72')));_0x3f7ba1[_0x2203('0x9')]('/api/automations',require('./api/automation'));_0x3f7ba1[_0x2203('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x73'),require(_0x2203('0x74')));_0x3f7ba1['use'](_0x2203('0x75'),require('./api/condition'));_0x3f7ba1['use'](_0x2203('0x76'),require('./api/interval'));_0x3f7ba1['use']('/api/pauses',require(_0x2203('0x77')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x78'),require(_0x2203('0x79')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x7a'),require(_0x2203('0x7b')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x7c'),require(_0x2203('0x7d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x7e'),require('./api/sound'));_0x3f7ba1['use'](_0x2203('0x7f'),require(_0x2203('0x80')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x81'),require(_0x2203('0x82')));_0x3f7ba1[_0x2203('0x9')]('/api/triggers',require('./api/trigger'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x83'),require(_0x2203('0x84')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x85'),require(_0x2203('0x86')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x87'),require(_0x2203('0x88')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x89'),require('./api/analyticCustomReport'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x8a'),require(_0x2203('0x8b')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x8c'),require(_0x2203('0x8d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x8e'),require(_0x2203('0x8f')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x90'),require(_0x2203('0x91')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x92'),require(_0x2203('0x93')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x94'),require(_0x2203('0x95')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x96'),require('./api/intSalesforceConfiguration'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x97'),require(_0x2203('0x98')));_0x3f7ba1['use'](_0x2203('0x99'),require(_0x2203('0x9a')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x9b'),require(_0x2203('0x9c')));_0x3f7ba1['use'](_0x2203('0x9d'),require(_0x2203('0x9e')));_0x3f7ba1[_0x2203('0x9')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x3f7ba1['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x9f'),require(_0x2203('0xa0')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa1'),require(_0x2203('0xa2')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa3'),require('./api/intZohoConfiguration'));_0x3f7ba1['use'](_0x2203('0xa4'),require(_0x2203('0xa5')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa6'),require(_0x2203('0xa7')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa8'),require(_0x2203('0xa9')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xaa'),require(_0x2203('0xab')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xac'),require(_0x2203('0xad')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xae'),require(_0x2203('0xaf')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb0'),require('./api/intFreshdeskField'));_0x3f7ba1[_0x2203('0x9')]('/api/integrations/vtiger/accounts',require(_0x2203('0xb1')));_0x3f7ba1['use'](_0x2203('0xb2'),require(_0x2203('0xb3')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb4'),require(_0x2203('0xb5')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb6'),require(_0x2203('0xb7')));_0x3f7ba1['use']('/api/integrations/servicenow/configurations',require(_0x2203('0xb8')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb9'),require('./api/intServicenowField'));_0x3f7ba1['use']('/api/integrations/dynamics365/accounts',require(_0x2203('0xba')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xbb'),require(_0x2203('0xbc')));_0x3f7ba1['use'](_0x2203('0xbd'),require('./api/intDynamics365Field'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xbe'),require(_0x2203('0xbf')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc0'),require('./api/intFreshsalesConfiguration'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc1'),require(_0x2203('0xc2')));_0x3f7ba1['use'](_0x2203('0xc3'),require(_0x2203('0xc4')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc5'),require(_0x2203('0xc6')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc7'),require(_0x2203('0xc8')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc9'),require(_0x2203('0xca')));_0x3f7ba1['use'](_0x2203('0xcb'),require(_0x2203('0xcc')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xcd'),require(_0x2203('0xce')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xcf'),require(_0x2203('0xd0')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd1'),require(_0x2203('0xd2')));_0x3f7ba1[_0x2203('0x9')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd3'),require(_0x2203('0xd4')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd5'),require('./api/setting'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd6'),require('./api/squareOdbc'));_0x3f7ba1['use']('/api/square/projects',require('./api/squareProject'));_0x3f7ba1['use'](_0x2203('0xd7'),require(_0x2203('0xd8')));_0x3f7ba1[_0x2203('0x9')]('/api/square/messages',require('./api/squareMessage'));_0x3f7ba1['use'](_0x2203('0xd9'),require(_0x2203('0xda')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xdb'),require(_0x2203('0xdc')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xdd'),require('./api/campaign'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xde'),require(_0x2203('0xdf')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xe0'),require(_0x2203('0xe1')));_0x3f7ba1[_0x2203('0x9')]('/api/plugins',require(_0x2203('0xe2')));_0x3f7ba1['use']('/api/mail/reports/transfer',require(_0x2203('0xe3')));_0x3f7ba1['use'](_0x2203('0xe4'),require(_0x2203('0xe5')));_0x3f7ba1['use'](_0x2203('0xe6'),require(_0x2203('0xe7')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xe8'),require(_0x2203('0xe9')));_0x3f7ba1[_0x2203('0x9')]('/api/sms/reports/transfer',require(_0x2203('0xea')));_0x3f7ba1[_0x2203('0x9')]('/api/cm/lists',require('./api/cmList'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xeb'),require(_0x2203('0xec')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xed'),require(_0x2203('0xee')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xef'),require(_0x2203('0xf0')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf1'),require(_0x2203('0xf2')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf3'),require(_0x2203('0xf4')));_0x3f7ba1[_0x2203('0x9')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf5'),require('./api/whatsappApplication'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf6'),require('./api/whatsappInteraction'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf7'),require('./api/whatsappMessage'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf8'),require('./api/whatsappQueueReport'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf9'),require(_0x2203('0xfa')));_0x3f7ba1[_0x2203('0x9')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xfb'),require(_0x2203('0xfc')));_0x3f7ba1['use']('/api/auth/local',require(_0x2203('0xfd')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xfe'),require('./api/authGoogle'));_0x3f7ba1['use'](_0x2203('0xff'),require(_0x2203('0x100')));_0x3f7ba1['use'](_0x2203('0x101'),require(_0x2203('0x102')));_0x3f7ba1['use'](_0x2203('0x103'),require('./api/version'));_0x3f7ba1[_0x2203('0x9')]('/api/system',require('./api/system'));_0x3f7ba1['use'](_0x2203('0x104'),require(_0x2203('0x105')));_0x3f7ba1['use'](_0x2203('0x106'),require(_0x2203('0x107')));_0x3f7ba1[_0x2203('0x9')]('/apidoc',express[_0x2203('0x108')](path['join'](config[_0x2203('0x109')],_0x2203('0x10a'))));_0x3f7ba1['use'](_0x2203('0x10b'),express[_0x2203('0x108')](path['join'](config[_0x2203('0x109')],_0x2203('0x10b'))));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x10c'),express[_0x2203('0x108')](path['join'](config[_0x2203('0x109')],_0x2203('0x10c'))));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x10d'),express[_0x2203('0x108')](path[_0x2203('0x10e')](config['root'],_0x2203('0x10f'),_0x2203('0x110'))));_0x3f7ba1['use'](_0x2203('0x111'),express['static'](path[_0x2203('0x10e')](config[_0x2203('0x109')],_0x2203('0x112'))));_0x3f7ba1['route'](_0x2203('0x113'))[_0x2203('0x114')](errors[0x194]);_0x3f7ba1[_0x2203('0x115')]('/*')[_0x2203('0x114')](function(_0x2c275f,_0x2cd816){_0x2cd816[_0x2203('0x116')](path['resolve'](_0x3f7ba1['get'](_0x2203('0x117'))+_0x2203('0x118')));});};var sensitiveFields=[_0x2203('0x119'),_0x2203('0x11a'),_0x2203('0x11b'),_0x2203('0x11c'),_0x2203('0x11d'),'lastName',_0x2203('0x11e'),_0x2203('0x11f'),'mobile',_0x2203('0x120'),'email',_0x2203('0x121'),_0x2203('0x122'),'securityToken',_0x2203('0x123'),_0x2203('0x124'),_0x2203('0x125'),_0x2203('0x126'),_0x2203('0x127'),_0x2203('0x128'),_0x2203('0x129'),_0x2203('0x12a'),_0x2203('0x12b'),_0x2203('0x12c'),_0x2203('0x12d'),_0x2203('0x12e'),'calleridnum',_0x2203('0x12f'),'vidaooApiKey',_0x2203('0x130'),_0x2203('0x131'),_0x2203('0x132'),_0x2203('0x133'),_0x2203('0x134'),_0x2203('0x13'),_0x2203('0x135'),_0x2203('0x136'),_0x2203('0x137'),_0x2203('0x138'),_0x2203('0x139'),'registry',_0x2203('0x13a')];function maskSensitiveData(_0x54e773){var _0x44e091=/(?!^)[\s\S](?!$)/g;for(var _0x3deb3b in _0x54e773){if(_[_0x2203('0x13b')](_0x54e773[_0x3deb3b])){for(var _0x4a38ca=0x0;_0x4a38ca<_0x54e773[_0x3deb3b][_0x2203('0x13c')];_0x4a38ca++){maskSensitiveData(_0x54e773[_0x3deb3b][_0x4a38ca]);}}else if(_[_0x2203('0x13d')](_0x54e773[_0x3deb3b])){maskSensitiveData(_0x54e773[_0x3deb3b]);}else if(_[_0x2203('0x13e')](_0x54e773[_0x3deb3b])){_0x54e773[_0x3deb3b]=_0x54e773[_0x3deb3b][_0x2203('0x13f')](/{{{/g,_0x2203('0x140'))['replace'](/}}}/g,_0x2203('0x141'))['replace'](/{{/g,'@{')[_0x2203('0x13f')](/}}/g,'}@');if(_[_0x2203('0x142')](sensitiveFields,_0x3deb3b)){_0x54e773[_0x3deb3b]=_0x54e773[_0x3deb3b]['replace'](_0x44e091,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2c138e6..dcfdf19 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2634=['../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/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.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/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.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'];(function(_0x480470,_0x36f644){var _0x4360a0=function(_0x32a63f){while(--_0x32a63f){_0x480470['push'](_0x480470['shift']());}};_0x4360a0(++_0x36f644);}(_0x2634,0x17e));var _0x4263=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2634[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x4263('0x0'));var BPromise=require(_0x4263('0x1'));var _=require(_0x4263('0x2'));var config=require(_0x4263('0x3'));exports['listen']=function(){return new BPromise(function(_0x27b2df,_0x5a5878){var _0x1a8cc8={};_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x5')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x6')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x7')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x8')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x9')));_0x1a8cc8=_['merge'](_0x1a8cc8,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0xa')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0xb')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0xc')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0xd')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0xe')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0xf')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/mailQueue/mailQueue.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x10')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x11')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x12')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x13')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x14')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x15')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x16')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x17')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/faxQueue/faxQueue.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x18')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x19')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/smsMessage/smsMessage.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x1a')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x1b')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x1c')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x1d')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/chatMessage/chatMessage.rpc'));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x1e')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/cmContact/cmContact.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x1f')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x20')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x21')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x22')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x23')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x24')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x25')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x26')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/template/template.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x27')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x28')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x29')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x2a')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x2b')));_0x1a8cc8=_['merge'](_0x1a8cc8,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x2c')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x2d')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x2e')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x2f')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x30')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x31')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/squareReport/squareReport.rpc'));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x32')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x33')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x34')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x35')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x36')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/campaign/campaign.rpc'));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x37')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x38')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x39')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x3a')));_0x1a8cc8=_['merge'](_0x1a8cc8,require(_0x4263('0x3b')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require(_0x4263('0x3c')));_0x1a8cc8=_[_0x4263('0x4')](_0x1a8cc8,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x403bd2=jayson[_0x4263('0x3d')](_0x1a8cc8)['http']();var _0x4acd51=config[_0x4263('0x3e')][_0x4263('0x3f')]||config['port']+0x1;var _0x363041=config[_0x4263('0x3e')]['ip']||_0x4263('0x40');_0x403bd2['on'](_0x4263('0x41'),function(_0x4055aa){return _0x5a5878(_0x4055aa);});_0x403bd2['listen'](_0x4acd51,_0x363041,function(){console[_0x4263('0x42')](_0x4263('0x43'),_0x363041,_0x4acd51);require(_0x4263('0x44'))['default']();return _0x27b2df(_0x4263('0x45')+_0x363041+':'+_0x4acd51);});});}; \ No newline at end of file +var _0xc1a8=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0x10ca76,_0x1e4b66){var _0x2cf969=function(_0xd94e1){while(--_0xd94e1){_0x10ca76['push'](_0x10ca76['shift']());}};_0x2cf969(++_0x1e4b66);}(_0xc1a8,0x84));var _0x8c1a=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xc1a8[_0x556634];return _0x4429fd;};'use strict';var jayson=require(_0x8c1a('0x0'));var BPromise=require(_0x8c1a('0x1'));var _=require(_0x8c1a('0x2'));var config=require(_0x8c1a('0x3'));exports[_0x8c1a('0x4')]=function(){return new BPromise(function(_0x55d3c5,_0x47782a){var _0x2afec5={};_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/user/user.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/voiceExtension/voiceExtension.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x6')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x7')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x8')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x9')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0xa')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0xb')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0xc')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0xd')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0xe')));_0x2afec5=_['merge'](_0x2afec5,require('../api/mailServerIn/mailServerIn.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/mailAccount/mailAccount.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0xf')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x10')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x11')));_0x2afec5=_['merge'](_0x2afec5,require('../api/mailApplication/mailApplication.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/faxAccount/faxAccount.rpc'));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x12')));_0x2afec5=_['merge'](_0x2afec5,require('../api/faxInteraction/faxInteraction.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x13')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/faxQueue/faxQueue.rpc'));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x14')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x15')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x16')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x17')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x18')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x19')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x1a')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x1b')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x1c')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x1d')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x1e')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x1f')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x20')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/cmContact/cmContact.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x21')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x22')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x23')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x24')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x25')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x26')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x27')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x28')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x29')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x2a')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x2b')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x2c')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x2d')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x2e')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x2f')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x30')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x31')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x32')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x33')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x34')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x35')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/squareReport/squareReport.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x36')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x37')));_0x2afec5=_['merge'](_0x2afec5,require('../api/squareProject/squareProject.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x38')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x39')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x3a')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x3b')));_0x2afec5=_['merge'](_0x2afec5,require(_0x8c1a('0x3c')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x3d')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require(_0x8c1a('0x3e')));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2afec5=_[_0x8c1a('0x5')](_0x2afec5,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5e6d82=jayson[_0x8c1a('0x3f')](_0x2afec5)[_0x8c1a('0x40')]();var _0x289764=config[_0x8c1a('0x41')][_0x8c1a('0x42')]||config[_0x8c1a('0x42')]+0x1;var _0x547439=config[_0x8c1a('0x41')]['ip']||_0x8c1a('0x43');_0x5e6d82['on']('error',function(_0x30a193){return _0x47782a(_0x30a193);});_0x5e6d82['listen'](_0x289764,_0x547439,function(){console[_0x8c1a('0x44')](_0x8c1a('0x45'),_0x547439,_0x289764);require(_0x8c1a('0x46'))[_0x8c1a('0x47')]();return _0x55d3c5(_0x8c1a('0x48')+_0x547439+':'+_0x289764);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 27e05ed..5c24fc1 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 _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','label','exports','util','lodash','events','./error','call'];(function(_0x4436d2,_0x3d7736){var _0x31fc56=function(_0x21ef6c){while(--_0x21ef6c){_0x4436d2['push'](_0x4436d2['shift']());}};_0x31fc56(++_0x3d7736);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0xe706,0xa3));var _0x6e70=function(_0x5249be,_0x251784){_0x5249be=_0x5249be-0x0;var _0x19ba8e=_0xe706[_0x5249be];return _0x19ba8e;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5dc4a3b..d426d34 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 _0xe07c=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x480385,_0x1913b1){var _0x5cd332=function(_0x74b2c5){while(--_0x74b2c5){_0x480385['push'](_0x480385['shift']());}};_0x5cd332(++_0x1913b1);}(_0xe07c,0x1f3));var _0xce07=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe07c[_0x2dadb9];return _0x2f0097;};'use strict';var util=require(_0xce07('0x0'));var error={'E_AGI_UNDEFINED':_0xce07('0x1'),'E_AGI_ARGUMENT_PORT':_0xce07('0x2'),'E_AGI_SERVER_ERROR':_0xce07('0x3'),'E_AGI_SERVER_CLOSE':_0xce07('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xce07('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xce07('0x6'),'E_AGI_SOCKET_ERROR':_0xce07('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xce07('0x8'),'E_AGI_COMMAND_EMPTY':_0xce07('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xce07('0xa'),'E_AGI_IVR_ENTRY':_0xce07('0xb')};function AGIError(_0x402ce1){var _0x402ce1=_0x402ce1||null,_0x2bb379=_0x2bb379||[],_0x2ecdaf=0x1,_0x13e4b1='';if(!error[_0x402ce1]){_0x402ce1=_0xce07('0xc');}_0x2bb379[_0xce07('0xd')](error[_0x402ce1]);while(arguments[_0x2ecdaf]){_0x2bb379[_0xce07('0xd')](arguments[_0x2ecdaf]);_0x2ecdaf++;}_0x13e4b1=util[_0xce07('0xe')][_0xce07('0xf')](util,_0x2bb379);this[_0xce07('0x10')]=_0x13e4b1;this[_0xce07('0x11')]=_0x402ce1;}module['exports']=AGIError; \ No newline at end of file +var _0xd549=['exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[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','format','apply','message','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd549,0xde));var _0x9d54=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd549[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0x9d54('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x9d54('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x9d54('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x9d54('0x3'),'E_AGI_SOCKET_ERROR':_0x9d54('0x4'),'E_AGI_SOCKET_CLOSE':_0x9d54('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x9d54('0x6'),'E_AGI_COMMAND_EMPTY':_0x9d54('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9d54('0x8'),'E_AGI_IVR_ENTRY':_0x9d54('0x9')};function AGIError(_0x5d2641){var _0x5d2641=_0x5d2641||null,_0x3fa989=_0x3fa989||[],_0x1956f3=0x1,_0x40a78a='';if(!error[_0x5d2641]){_0x5d2641=_0x9d54('0xa');}_0x3fa989['push'](error[_0x5d2641]);while(arguments[_0x1956f3]){_0x3fa989[_0x9d54('0xb')](arguments[_0x1956f3]);_0x1956f3++;}_0x40a78a=util[_0x9d54('0xc')][_0x9d54('0xd')](util,_0x3fa989);this[_0x9d54('0xe')]=_0x40a78a;this[_0x9d54('0xf')]=_0x5d2641;}module[_0x9d54('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 68705c7..e1c73c5 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 _0x6017=['vswitch','target','menu','invalid','includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','getdigits','getsecretdigits','edges','prototype','vertices','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand'];(function(_0x80eb99,_0xf5b711){var _0x398203=function(_0x1adc3e){while(--_0x1adc3e){_0x80eb99['push'](_0x80eb99['shift']());}};_0x398203(++_0xf5b711);}(_0x6017,0xae));var _0x7601=function(_0x331986,_0x532a32){_0x331986=_0x331986-0x0;var _0x537e0a=_0x6017[_0x331986];return _0x537e0a;};'use strict';var _=require(_0x7601('0x0'));var logger=require(_0x7601('0x1'))(_0x7601('0x2'));var verticesWithRetry=['menu',_0x7601('0x3'),_0x7601('0x4')];var Graph=function(){this['vertices']={};this[_0x7601('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x7601('0x6')]['addVertex']=function(_0x5080a3){this[_0x7601('0x7')][_0x5080a3['id']]=_0x5080a3;this[_0x7601('0x5')][_0x5080a3['id']]=[];};Graph[_0x7601('0x6')][_0x7601('0x8')]=function(_0x2bc643,_0xe6e524,_0x4ff3e4){this[_0x7601('0x5')][_0x2bc643][_0x7601('0x9')]({'target':_0xe6e524,'condition':_0x4ff3e4});this[_0x7601('0xa')]+=0x1;};Graph['prototype'][_0x7601('0xb')]=function(){return _[_0x7601('0xb')](this[_0x7601('0x7')]);};Graph['prototype'][_0x7601('0xc')]=function(){return this[_0x7601('0xa')];};Graph[_0x7601('0x6')][_0x7601('0xd')]=function(_0x33658f){return this[_0x7601('0x7')][_0x33658f];};Graph[_0x7601('0x6')][_0x7601('0xe')]=function(_0x2f5dbf,_0x40fc89){if(!this['vertices'][_0x2f5dbf]){return logger[_0x7601('0xf')]('no\x20vertex\x20found');}var _0x4be36a=_0x40fc89(this[_0x7601('0x7')][_0x2f5dbf]);if(!_0x4be36a){return logger[_0x7601('0xf')](_0x7601('0x10'));}if(this[_0x7601('0x5')][_0x2f5dbf][_0x7601('0x11')]===0x0){return logger[_0x7601('0xf')](_0x7601('0x12'));}for(var _0xdfb58a=0x0,_0x5e99b9=[],_0xa0e556=![];_0xdfb58a\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','toString','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','connection','syncho','util','moment','../../config/environment','../../config/logger','agi','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','port','info','format'];(function(_0x5decbc,_0x12b2fc){var _0x3cac97=function(_0x3376a7){while(--_0x3376a7){_0x5decbc['push'](_0x5decbc['shift']());}};_0x3cac97(++_0x12b2fc);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x1a9b('0x0'));var util=require(_0x1a9b('0x1'));var moment=require(_0x1a9b('0x2'));var config=require(_0x1a9b('0x3'));var logger=require(_0x1a9b('0x4'))(_0x1a9b('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x1a9b('0x6'));var Vertices=require(_0x1a9b('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1a9b('0x5')]=_[_0x1a9b('0x8')](config[_0x1a9b('0x5')],{'ip':_0x1a9b('0x9'),'port':0x11dd});function connectionHandler(_0x263b84){process[_0x1a9b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x263b84);agiHandler(_0x263b84);}catch(_0x29932a){logger[_0x1a9b('0xb')](_0x29932a[_0x1a9b('0xc')]);}});});}function listeningHandler(){console[_0x1a9b('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x1a9b('0xe')]);logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config['agi'][_0x1a9b('0xe')]));}function errorHandler(_0x3a49dd){if(_0x3a49dd&&_0x3a49dd[_0x1a9b('0x11')]&&_0x3a49dd[_0x1a9b('0x12')]){logger[_0x1a9b('0xb')](util[_0x1a9b('0x10')]('[%s]\x20%s',_0x3a49dd[_0x1a9b('0x11')],_0x3a49dd[_0x1a9b('0x12')]));}else{logger[_0x1a9b('0xb')](util['format'](_0x1a9b('0x13'),_0x3a49dd[_0x1a9b('0xc')]));}}function closeHandler(){logger['info'](util[_0x1a9b('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1a9b('0x14')],this[_0x1a9b('0x15')],this[_0x1a9b('0x16')],this[_0x1a9b('0x17')],this[_0x1a9b('0x18')]));try{createSquareReport(this);}catch(_0x20b8dc){logger[_0x1a9b('0xb')](_0x20b8dc[_0x1a9b('0xc')]);}}function timeoutHandler(){logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1a9b('0x14')],this[_0x1a9b('0x15')],this[_0x1a9b('0x16')],this[_0x1a9b('0x17')],this['uniqueid']));}function hangupHandler(){logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1a9b('0x14')],this[_0x1a9b('0x15')],this[_0x1a9b('0x16')],this[_0x1a9b('0x17')],this[_0x1a9b('0x18')]));this['evtHangup']=!![];}function getRoot(_0x189e78){return parser[_0x1a9b('0x19')](_0x189e78,{'object':!![]})[_0x1a9b('0x1a')][_0x1a9b('0x1b')];}function addVertex(_0x36391a,_0x2e42f1,_0x28f937){_0x2e42f1['agicommand']=_0x28f937;if(_0x2e42f1[_0x1a9b('0x1c')]('retry')){_0x2e42f1[_0x1a9b('0x1d')]=parseInt(_0x2e42f1[_0x1a9b('0x1e')],0xa);}_0x36391a[_0x1a9b('0x1f')](_['omit'](_0x2e42f1,_0x1a9b('0x20')));}function initGraph(_0x3db708,_0x1521f4){var _0x181331=new Graph();for(var _0x18c9dd in _0x3db708){if(_0x3db708[_0x1a9b('0x1c')](_0x18c9dd)){if(_['isArray'](_0x3db708[_0x18c9dd])){for(var _0x3f7807=0x0;_0x3f7807<_0x3db708[_0x18c9dd][_0x1a9b('0x21')];_0x3f7807+=0x1){addVertex(_0x181331,_0x3db708[_0x18c9dd][_0x3f7807],_0x18c9dd);}}else{addVertex(_0x181331,_0x3db708[_0x18c9dd],_0x18c9dd);}}}for(var _0x566fb4=0x0;_0x566fb4<_0x1521f4[_0x1a9b('0x21')];_0x566fb4+=0x1){if(_0x1521f4[_0x566fb4][_0x1a9b('0x22')]&&_0x1521f4[_0x566fb4]['target']){_0x181331['addEdge'](_0x1521f4[_0x566fb4][_0x1a9b('0x22')],_0x1521f4[_0x566fb4][_0x1a9b('0x23')],_0x1521f4[_0x566fb4]['value']);}}return _0x181331;}function getSquareProject(_0x30278b,_0x4071dd){rpc[_0x1a9b('0x24')](_0x30278b)[_0x1a9b('0x25')](function(_0x1a5085){_0x4071dd(null,_0x1a5085);})[_0x1a9b('0x26')](function(_0x26949c){_0x4071dd(null,_0x26949c);});}function createSquareReport(_0x5ed1e3,_0x3ba2fe){rpc[_0x1a9b('0x27')](_0x5ed1e3)[_0x1a9b('0x25')](function(_0x4185ad){if(_0x3ba2fe){_0x3ba2fe(null,_0x4185ad);}})[_0x1a9b('0x26')](function(_0x284b5f){if(_0x3ba2fe){_0x3ba2fe(null,_0x284b5f);}});}function setChannelVariables(_0xe0dd38){for(var _0x3fadcd in _0xe0dd38){if(_0xe0dd38[_0x1a9b('0x1c')](_0x3fadcd)){if(_0x3fadcd[_0x1a9b('0x28')](_0x1a9b('0x29'))===0x0){_0xe0dd38[_0x3fadcd['substring'](0x4)]=_0xe0dd38[_0x3fadcd];delete _0xe0dd38[_0x3fadcd];}}}}function getLogFromObject(_0x579a34){return util[_0x1a9b('0x2a')](_0x579a34,{'showHidden':![],'depth':null});}function agiHandler(_0x1d0179){var _0x174cda,_0x47f470,_0x248a31,_0x50f835,_0x2595f1;logger['debug'](_0x1a9b('0x2b'),JSON[_0x1a9b('0x2c')](_0x1d0179,null,0x2));logger['info'](util[_0x1a9b('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d0179[_0x1a9b('0x14')],_0x1d0179[_0x1a9b('0x15')],_0x1d0179[_0x1a9b('0x16')],_0x1d0179[_0x1a9b('0x17')],_0x1d0179['uniqueid']));_0x1d0179['on'](_0x1a9b('0xb'),errorHandler);_0x1d0179['on'](_0x1a9b('0x2d'),closeHandler);_0x1d0179['on'](_0x1a9b('0x2e'),timeoutHandler);_0x1d0179['evtHangup']=![];_0x1d0179['on'](_0x1a9b('0x2f'),hangupHandler);var _0x5be8b9=getSquareProject['sync'](null,_0x1d0179[_0x1a9b('0x14')]);if(_0x5be8b9){if(_0x5be8b9[_0x1a9b('0x30')]){_0x174cda=getRoot(_0x5be8b9[_0x1a9b('0x30')]);if(_0x174cda&&_0x174cda[_0x1a9b('0x31')]){logger[_0x1a9b('0x32')](_0x1a9b('0x1b'),JSON[_0x1a9b('0x2c')](_0x174cda,null,0x2));_0x1d0179['joinAt']=moment()[_0x1a9b('0x10')](_0x1a9b('0x33'));_0x47f470=initGraph(_[_0x1a9b('0x34')](_0x174cda,'mxCell'),_0x174cda[_0x1a9b('0x20')]);_0x248a31=new Vertices(_0x1d0179,rpc,mailRpc);logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')](_0x1a9b('0x35'),_0x1d0179['arg_1'],_0x1d0179['calleridname'],_0x1d0179[_0x1a9b('0x16')],_0x1d0179[_0x1a9b('0x17')],_0x1d0179[_0x1a9b('0x18')]));_0x47f470['traverseBFS'](_0x174cda['start']['id'],function(_0x2b9bcf){try{_0x2b9bcf=_0x248a31[_0x1a9b('0x36')](_0x2b9bcf);logger[_0x1a9b('0x32')](_0x1a9b('0x37'),JSON[_0x1a9b('0x2c')](_0x2b9bcf,null,0x2));if(_0x2b9bcf[_0x1a9b('0x38')]===_0x1a9b('0x39')){logger['info'](_0x1a9b('0x3a'));_0x1d0179[_0x1a9b('0x3b')]=_0x2b9bcf[_0x1a9b('0x3b')]||_0x1d0179[_0x1a9b('0x3b')];_0x1d0179[_0x1a9b('0x3c')]=_0x2b9bcf[_0x1a9b('0x3c')];_0x1d0179[_0x1a9b('0x3d')]=_0x2b9bcf[_0x1a9b('0x3d')]?_0x2b9bcf[_0x1a9b('0x3d')]-0x1:0x1;return null;}else if(_0x2b9bcf&&_0x248a31[_0x2b9bcf[_0x1a9b('0x38')]]){_0x2595f1=_0x248a31[_0x2b9bcf[_0x1a9b('0x38')]](_0x2b9bcf);logger[_0x1a9b('0xf')](_0x1a9b('0x3e'),JSON[_0x1a9b('0x2c')](_0x2595f1,null,0x2));if(_0x2595f1&&_0x2595f1[_0x1a9b('0x3f')]===AGI_CODE_SUCCESS&&_0x2595f1[_0x1a9b('0x40')]!==AGI_RESULT_ERROR&&!_0x1d0179['evtHangup']){logger[_0x1a9b('0x32')](_0x1a9b('0x3e'),getLogFromObject(_0x2595f1));return _['isUndefined'](_0x2595f1[_0x1a9b('0x40')])?null:_0x2595f1['result']['toString']();}else{logger[_0x1a9b('0xb')](_0x1a9b('0x3e'),getLogFromObject(_0x2595f1));return null;}}else{logger[_0x1a9b('0xb')](_0x1a9b('0x41'));return null;}}catch(_0x27acf0){logger[_0x1a9b('0xb')](_0x27acf0[_0x1a9b('0xc')]);return null;}});if(_0x174cda['finally']){logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')](_0x1a9b('0x42'),_0x1d0179[_0x1a9b('0x14')],_0x1d0179['calleridname'],_0x1d0179[_0x1a9b('0x16')],_0x1d0179[_0x1a9b('0x17')],_0x1d0179[_0x1a9b('0x18')]));_0x47f470[_0x1a9b('0x43')](_0x174cda['finally']['id'],function(_0x5ae813){try{_0x5ae813=_0x248a31[_0x1a9b('0x36')](_0x5ae813);logger[_0x1a9b('0x32')](_0x1a9b('0x37'),JSON[_0x1a9b('0x2c')](_0x5ae813,null,0x2));if(_0x5ae813&&_0x248a31[_0x5ae813['agicommand']]){_0x2595f1=_0x248a31[_0x5ae813['agicommand']](_0x5ae813);if(_0x2595f1){logger[_0x1a9b('0x32')](_0x1a9b('0x3e'),getLogFromObject(_0x2595f1));return _['isUndefined'](_0x2595f1['result'])?null:_0x2595f1[_0x1a9b('0x40')][_0x1a9b('0x44')]();}else{logger[_0x1a9b('0xb')]('response',getLogFromObject(_0x2595f1));return null;}}else{logger[_0x1a9b('0xb')](_0x1a9b('0x41'));return null;}}catch(_0x437ec9){logger[_0x1a9b('0xb')](_0x437ec9[_0x1a9b('0xc')]);return null;}});}logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d0179['arg_1'],_0x1d0179['calleridname'],_0x1d0179[_0x1a9b('0x16')],_0x1d0179[_0x1a9b('0x17')],_0x1d0179[_0x1a9b('0x18')]));logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1d0179[_0x1a9b('0x3b')],_0x1d0179[_0x1a9b('0x3c')],parseInt(_0x1d0179[_0x1a9b('0x3d')],0xa)+0x1));_0x1d0179[_0x1a9b('0x45')](_0x1d0179[_0x1a9b('0x3b')],_0x1d0179[_0x1a9b('0x3c')],parseInt(_0x1d0179[_0x1a9b('0x3d')],0xa)+0x1);_0x1d0179[_0x1a9b('0x2d')]();}}else{logger[_0x1a9b('0xb')](util[_0x1a9b('0x10')](_0x1a9b('0x46'),_0x1d0179[_0x1a9b('0x14')]));_0x1d0179[_0x1a9b('0x45')](_0x1d0179[_0x1a9b('0x3b')],_0x1d0179[_0x1a9b('0x3c')],parseInt(_0x1d0179[_0x1a9b('0x3d')],0xa)+0x1);_0x1d0179[_0x1a9b('0x2d')]();}}else{logger[_0x1a9b('0xb')](util[_0x1a9b('0x10')](_0x1a9b('0x47'),_0x1d0179[_0x1a9b('0x14')]));_0x1d0179['continueAt'](_0x1d0179['context'],_0x1d0179[_0x1a9b('0x3c')],parseInt(_0x1d0179[_0x1a9b('0x3d')],0xa)+0x1);_0x1d0179[_0x1a9b('0x2d')]();}}function main(){var _0x13361f;return utilLicense['getLicense']()[_0x1a9b('0x25')](function(_0x4ba93b){if(_0x4ba93b){if(_0x4ba93b[_0x1a9b('0x48')]){if(_0x4ba93b[_0x1a9b('0x49')]&&_0x4ba93b[_0x1a9b('0x49')]>0x0){logger[_0x1a9b('0xf')](util[_0x1a9b('0x10')](_0x1a9b('0x4a'),_0x4ba93b[_0x1a9b('0x49')]));_0x13361f=_0x4ba93b[_0x1a9b('0x49')];}else{logger[_0x1a9b('0xf')](_0x1a9b('0x4b'));}}else{logger[_0x1a9b('0xf')](_0x1a9b('0x4c'));_0x13361f=-0x1;}}})[_0x1a9b('0x26')](function(_0x2d7981){logger[_0x1a9b('0xb')](_0x1a9b('0x4d'),_0x2d7981[_0x1a9b('0xc')]);})[_0x1a9b('0x4e')](function(){var _0x4e4eab=require(_0x1a9b('0x4f'))(config[_0x1a9b('0x5')][_0x1a9b('0xe')],config[_0x1a9b('0x5')]['ip'],_0x13361f);_0x4e4eab['on']('error',errorHandler);_0x4e4eab['on']('listening',listeningHandler);_0x4e4eab['on'](_0x1a9b('0x50'),connectionHandler);_0x4e4eab['on'](_0x1a9b('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0x5c12=['debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','joinAt','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','gotoc','context','extension','response','code','isUndefined','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','finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','priority','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','inspect'];(function(_0x871115,_0xd3646b){var _0x2ddfcb=function(_0x3a4e9d){while(--_0x3a4e9d){_0x871115['push'](_0x871115['shift']());}};_0x2ddfcb(++_0xd3646b);}(_0x5c12,0x188));var _0x25c1=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x5c12[_0x4709c8];return _0x478cdd;};'use strict';var parser=require('xml2json');var _=require(_0x25c1('0x0'));var syncho=require(_0x25c1('0x1'));var util=require('util');var moment=require(_0x25c1('0x2'));var config=require(_0x25c1('0x3'));var logger=require(_0x25c1('0x4'))(_0x25c1('0x5'));var utilLicense=require(_0x25c1('0x6'));var rpc=require(_0x25c1('0x7'));var mailRpc=require(_0x25c1('0x8'));var Graph=require('./graph');var Vertices=require(_0x25c1('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x25c1('0x5')]=_[_0x25c1('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x24981c){process[_0x25c1('0xb')](function(){syncho(function(){try{setChannelVariables(_0x24981c);agiHandler(_0x24981c);}catch(_0x449014){logger[_0x25c1('0xc')](_0x449014[_0x25c1('0xd')]);}});});}function listeningHandler(){console['log'](_0x25c1('0xe'),config[_0x25c1('0x5')][_0x25c1('0xf')]);logger[_0x25c1('0x10')](util[_0x25c1('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x25c1('0x5')]['ip'],config[_0x25c1('0x5')]['port']));}function errorHandler(_0x256ecd){if(_0x256ecd&&_0x256ecd[_0x25c1('0x12')]&&_0x256ecd[_0x25c1('0x13')]){logger[_0x25c1('0xc')](util['format']('[%s]\x20%s',_0x256ecd['name'],_0x256ecd['message']));}else{logger[_0x25c1('0xc')](util[_0x25c1('0x11')](_0x25c1('0x14'),_0x256ecd[_0x25c1('0xd')]));}}function closeHandler(){logger[_0x25c1('0x10')](util['format'](_0x25c1('0x15'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x25c1('0x16')],this[_0x25c1('0x17')]));try{createSquareReport(this);}catch(_0x4dc64b){logger['error'](_0x4dc64b[_0x25c1('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x25c1('0x11')](_0x25c1('0x18'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x25c1('0x16')],this[_0x25c1('0x17')]));}function hangupHandler(){logger[_0x25c1('0x10')](util[_0x25c1('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x25c1('0x19')],this[_0x25c1('0x1a')],this[_0x25c1('0x1b')],this[_0x25c1('0x16')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2a8a84){return parser[_0x25c1('0x1c')](_0x2a8a84,{'object':!![]})[_0x25c1('0x1d')][_0x25c1('0x1e')];}function addVertex(_0x15cf2f,_0x1a4b89,_0x2ba595){_0x1a4b89[_0x25c1('0x1f')]=_0x2ba595;if(_0x1a4b89[_0x25c1('0x20')](_0x25c1('0x21'))){_0x1a4b89[_0x25c1('0x22')]=parseInt(_0x1a4b89[_0x25c1('0x21')],0xa);}_0x15cf2f[_0x25c1('0x23')](_['omit'](_0x1a4b89,_0x25c1('0x24')));}function initGraph(_0x20dbb9,_0x1b1c96){var _0x1fb59f=new Graph();for(var _0x21fdb8 in _0x20dbb9){if(_0x20dbb9[_0x25c1('0x20')](_0x21fdb8)){if(_['isArray'](_0x20dbb9[_0x21fdb8])){for(var _0x17c924=0x0;_0x17c924<_0x20dbb9[_0x21fdb8][_0x25c1('0x25')];_0x17c924+=0x1){addVertex(_0x1fb59f,_0x20dbb9[_0x21fdb8][_0x17c924],_0x21fdb8);}}else{addVertex(_0x1fb59f,_0x20dbb9[_0x21fdb8],_0x21fdb8);}}}for(var _0x6cb14f=0x0;_0x6cb14f<_0x1b1c96[_0x25c1('0x25')];_0x6cb14f+=0x1){if(_0x1b1c96[_0x6cb14f][_0x25c1('0x26')]&&_0x1b1c96[_0x6cb14f][_0x25c1('0x27')]){_0x1fb59f['addEdge'](_0x1b1c96[_0x6cb14f][_0x25c1('0x26')],_0x1b1c96[_0x6cb14f]['target'],_0x1b1c96[_0x6cb14f][_0x25c1('0x28')]);}}return _0x1fb59f;}function getSquareProject(_0x31c153,_0x2c42b9){rpc[_0x25c1('0x29')](_0x31c153)[_0x25c1('0x2a')](function(_0x21069c){_0x2c42b9(null,_0x21069c);})[_0x25c1('0x2b')](function(_0x23f2f6){_0x2c42b9(null,_0x23f2f6);});}function createSquareReport(_0x402f32,_0x4d9882){rpc[_0x25c1('0x2c')](_0x402f32)['then'](function(_0x492715){if(_0x4d9882){_0x4d9882(null,_0x492715);}})[_0x25c1('0x2b')](function(_0x1dc3a7){if(_0x4d9882){_0x4d9882(null,_0x1dc3a7);}});}function setChannelVariables(_0x4ef790){for(var _0x173f3e in _0x4ef790){if(_0x4ef790['hasOwnProperty'](_0x173f3e)){if(_0x173f3e[_0x25c1('0x2d')]('agi_')===0x0){_0x4ef790[_0x173f3e[_0x25c1('0x2e')](0x4)]=_0x4ef790[_0x173f3e];delete _0x4ef790[_0x173f3e];}}}}function getLogFromObject(_0x7f1e7a){return util[_0x25c1('0x2f')](_0x7f1e7a,{'showHidden':![],'depth':null});}function agiHandler(_0x148e2a){var _0x1d4afc,_0x2e81d4,_0x461d23,_0x167477,_0x578713;logger[_0x25c1('0x30')]('variables',JSON[_0x25c1('0x31')](_0x148e2a,null,0x2));logger['info'](util[_0x25c1('0x11')](_0x25c1('0x32'),_0x148e2a[_0x25c1('0x19')],_0x148e2a[_0x25c1('0x1a')],_0x148e2a[_0x25c1('0x1b')],_0x148e2a[_0x25c1('0x16')],_0x148e2a[_0x25c1('0x17')]));_0x148e2a['on'](_0x25c1('0xc'),errorHandler);_0x148e2a['on'](_0x25c1('0x33'),closeHandler);_0x148e2a['on'](_0x25c1('0x34'),timeoutHandler);_0x148e2a[_0x25c1('0x35')]=![];_0x148e2a['on'](_0x25c1('0x36'),hangupHandler);var _0x1041a3=getSquareProject[_0x25c1('0x37')](null,_0x148e2a[_0x25c1('0x19')]);if(_0x1041a3){if(_0x1041a3[_0x25c1('0x38')]){_0x1d4afc=getRoot(_0x1041a3[_0x25c1('0x38')]);if(_0x1d4afc&&_0x1d4afc[_0x25c1('0x39')]){logger[_0x25c1('0x30')](_0x25c1('0x1e'),JSON['stringify'](_0x1d4afc,null,0x2));_0x148e2a[_0x25c1('0x3a')]=moment()[_0x25c1('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e81d4=initGraph(_[_0x25c1('0x3b')](_0x1d4afc,'mxCell'),_0x1d4afc[_0x25c1('0x24')]);_0x461d23=new Vertices(_0x148e2a,rpc,mailRpc);logger['info'](util[_0x25c1('0x11')](_0x25c1('0x3c'),_0x148e2a[_0x25c1('0x19')],_0x148e2a[_0x25c1('0x1a')],_0x148e2a[_0x25c1('0x1b')],_0x148e2a['dnid'],_0x148e2a[_0x25c1('0x17')]));_0x2e81d4['traverseBFS'](_0x1d4afc[_0x25c1('0x39')]['id'],function(_0xe83d32){try{_0xe83d32=_0x461d23[_0x25c1('0x3d')](_0xe83d32);logger[_0x25c1('0x30')]('vertex',JSON['stringify'](_0xe83d32,null,0x2));if(_0xe83d32['agicommand']===_0x25c1('0x3e')){logger[_0x25c1('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x148e2a[_0x25c1('0x3f')]=_0xe83d32['context']||_0x148e2a[_0x25c1('0x3f')];_0x148e2a[_0x25c1('0x40')]=_0xe83d32[_0x25c1('0x40')];_0x148e2a['priority']=_0xe83d32['priority']?_0xe83d32['priority']-0x1:0x1;return null;}else if(_0xe83d32&&_0x461d23[_0xe83d32[_0x25c1('0x1f')]]){_0x578713=_0x461d23[_0xe83d32[_0x25c1('0x1f')]](_0xe83d32);logger['info'](_0x25c1('0x41'),JSON[_0x25c1('0x31')](_0x578713,null,0x2));if(_0x578713&&_0x578713[_0x25c1('0x42')]===AGI_CODE_SUCCESS&&_0x578713['result']!==AGI_RESULT_ERROR&&!_0x148e2a['evtHangup']){logger['debug']('response',getLogFromObject(_0x578713));return _[_0x25c1('0x43')](_0x578713[_0x25c1('0x44')])?null:_0x578713['result'][_0x25c1('0x45')]();}else{logger[_0x25c1('0xc')](_0x25c1('0x41'),getLogFromObject(_0x578713));return null;}}else{logger[_0x25c1('0xc')](_0x25c1('0x46'));return null;}}catch(_0xdd396){logger[_0x25c1('0xc')](_0xdd396['stack']);return null;}});if(_0x1d4afc['finally']){logger[_0x25c1('0x10')](util[_0x25c1('0x11')](_0x25c1('0x47'),_0x148e2a['arg_1'],_0x148e2a[_0x25c1('0x1a')],_0x148e2a[_0x25c1('0x1b')],_0x148e2a[_0x25c1('0x16')],_0x148e2a[_0x25c1('0x17')]));_0x2e81d4['traverseBFS'](_0x1d4afc[_0x25c1('0x48')]['id'],function(_0x3b1eee){try{_0x3b1eee=_0x461d23[_0x25c1('0x3d')](_0x3b1eee);logger[_0x25c1('0x30')]('vertex',JSON['stringify'](_0x3b1eee,null,0x2));if(_0x3b1eee&&_0x461d23[_0x3b1eee[_0x25c1('0x1f')]]){_0x578713=_0x461d23[_0x3b1eee[_0x25c1('0x1f')]](_0x3b1eee);if(_0x578713){logger[_0x25c1('0x30')](_0x25c1('0x41'),getLogFromObject(_0x578713));return _['isUndefined'](_0x578713[_0x25c1('0x44')])?null:_0x578713[_0x25c1('0x44')]['toString']();}else{logger[_0x25c1('0xc')](_0x25c1('0x41'),getLogFromObject(_0x578713));return null;}}else{logger[_0x25c1('0xc')](_0x25c1('0x46'));return null;}}catch(_0x502018){logger['error'](_0x502018[_0x25c1('0xd')]);return null;}});}logger[_0x25c1('0x10')](util[_0x25c1('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x148e2a[_0x25c1('0x19')],_0x148e2a[_0x25c1('0x1a')],_0x148e2a['callerid'],_0x148e2a[_0x25c1('0x16')],_0x148e2a[_0x25c1('0x17')]));logger[_0x25c1('0x10')](util[_0x25c1('0x11')](_0x25c1('0x49'),_0x148e2a[_0x25c1('0x3f')],_0x148e2a[_0x25c1('0x40')],parseInt(_0x148e2a['priority'],0xa)+0x1));_0x148e2a['continueAt'](_0x148e2a['context'],_0x148e2a[_0x25c1('0x40')],parseInt(_0x148e2a['priority'],0xa)+0x1);_0x148e2a[_0x25c1('0x33')]();}}else{logger[_0x25c1('0xc')](util[_0x25c1('0x11')](_0x25c1('0x4a'),_0x148e2a[_0x25c1('0x19')]));_0x148e2a[_0x25c1('0x4b')](_0x148e2a['context'],_0x148e2a[_0x25c1('0x40')],parseInt(_0x148e2a[_0x25c1('0x4c')],0xa)+0x1);_0x148e2a[_0x25c1('0x33')]();}}else{logger[_0x25c1('0xc')](util[_0x25c1('0x11')](_0x25c1('0x4d'),_0x148e2a['arg_1']));_0x148e2a[_0x25c1('0x4b')](_0x148e2a[_0x25c1('0x3f')],_0x148e2a[_0x25c1('0x40')],parseInt(_0x148e2a[_0x25c1('0x4c')],0xa)+0x1);_0x148e2a[_0x25c1('0x33')]();}}function main(){var _0x4960e0;return utilLicense[_0x25c1('0x4e')]()[_0x25c1('0x2a')](function(_0x49b192){if(_0x49b192){if(_0x49b192[_0x25c1('0x4f')]){if(_0x49b192[_0x25c1('0x50')]&&_0x49b192[_0x25c1('0x50')]>0x0){logger[_0x25c1('0x10')](util[_0x25c1('0x11')](_0x25c1('0x51'),_0x49b192['callysquare']));_0x4960e0=_0x49b192[_0x25c1('0x50')];}else{logger[_0x25c1('0x10')](_0x25c1('0x52'));}}else{logger[_0x25c1('0x10')](_0x25c1('0x53'));_0x4960e0=-0x1;}}})[_0x25c1('0x2b')](function(_0x2745b6){logger[_0x25c1('0xc')](_0x25c1('0x54'),_0x2745b6[_0x25c1('0xd')]);})[_0x25c1('0x48')](function(){var _0x2d9e6b=require(_0x25c1('0x55'))(config[_0x25c1('0x5')]['port'],config[_0x25c1('0x5')]['ip'],_0x4960e0);_0x2d9e6b['on'](_0x25c1('0xc'),errorHandler);_0x2d9e6b['on'](_0x25c1('0x56'),listeningHandler);_0x2d9e6b['on'](_0x25c1('0x57'),connectionHandler);_0x2d9e6b['on'](_0x25c1('0x33'),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 fb40dba..0e2c3d2 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x2cad8e,_0x42e673){var _0x345816=function(_0x595d94){while(--_0x595d94){_0x2cad8e['push'](_0x2cad8e['shift']());}};_0x345816(++_0x42e673);}(_0x34e8,0x12c));var _0x834e=function(_0x1cb02a,_0x7ac7c0){_0x1cb02a=_0x1cb02a-0x0;var _0x507b65=_0x34e8[_0x1cb02a];return _0x507b65;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x5263fe,_0x1586ac){var _0xd5a979=function(_0xc80ed0){while(--_0xc80ed0){_0x5263fe['push'](_0x5263fe['shift']());}};_0xd5a979(++_0x1586ac);}(_0x814b,0x1a2));var _0xb814=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0x814b[_0x923ab6];return _0x484752;};'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 e151d06..07b53d9 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x220774,_0x2d8962){var _0x53b647=function(_0x424a8e){while(--_0x424a8e){_0x220774['push'](_0x220774['shift']());}};_0x53b647(++_0x2d8962);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45f6e5,_0x17a515){_0x45f6e5=_0x45f6e5-0x0;var _0x48f124=_0x5f2f[_0x45f6e5];return _0x48f124;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0xb10b,0x12a));var _0xbb10=function(_0x181d63,_0x4c5932){_0x181d63=_0x181d63-0x0;var _0x2b32c3=_0xb10b[_0x181d63];return _0x2b32c3;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9d4e615..413809b 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 _0xa413=['getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird','lodash','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue'];(function(_0x424950,_0x4f45fc){var _0x5d2ce4=function(_0x5e5c5e){while(--_0x5e5c5e){_0x424950['push'](_0x424950['shift']());}};_0x5d2ce4(++_0x4f45fc);}(_0xa413,0x1e5));var _0x3a41=function(_0x3f743b,_0x55c179){_0x3f743b=_0x3f743b-0x0;var _0x26c92c=_0xa413[_0x3f743b];return _0x26c92c;};'use strict';var BPromise=require(_0x3a41('0x0'));var moment=require('moment');var _=require(_0x3a41('0x1'));var util=require('util');var jayson=require(_0x3a41('0x2'));var client=jayson[_0x3a41('0x3')]['http']({'port':0x2329});function request(_0x53ca9c,_0x32a053){return new BPromise(function(_0x212eb6,_0x118b7a){return client[_0x3a41('0x4')](_0x53ca9c,_0x32a053)[_0x3a41('0x5')](function(_0x1af004){if(_0x1af004[_0x3a41('0x6')]){return _0x118b7a(_0x1af004[_0x3a41('0x6')][_0x3a41('0x7')]);}else{return _0x212eb6(_0x1af004[_0x3a41('0x8')]);}})[_0x3a41('0x9')](function(_0x5a3e2e){return _0x118b7a(_0x5a3e2e);});});}exports[_0x3a41('0xa')]=function(_0x570304){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x570304},'attributes':['production']}});};exports[_0x3a41('0xb')]=function(_0x57ef75){return request(_0x3a41('0xc'),{'options':{'raw':![],'where':{'id':_0x57ef75},'include':[{'model':'MailServerOut','as':_0x3a41('0xd')}],'attributes':['id',_0x3a41('0xe'),'email']}});};exports[_0x3a41('0xf')]=function(_0x1a609e){return request(_0x3a41('0x10'),{'options':{'where':{'id':_0x1a609e},'attributes':[_0x3a41('0xe')]}});};exports[_0x3a41('0x11')]=function(_0x4ef8c6){return request(_0x3a41('0x12'),{'options':{'where':{'id':_0x4ef8c6},'attributes':[_0x3a41('0xe')]}});};exports[_0x3a41('0x13')]=function(_0x357829){return request(_0x3a41('0x14'),{'options':{'where':{'id':_0x357829},'attributes':[_0x3a41('0xe')]}});};exports[_0x3a41('0x15')]=function(_0xebcca6){return request(_0x3a41('0x16'),{'options':{'where':{'id':_0xebcca6},'attributes':[_0x3a41('0x17')]}});};exports[_0x3a41('0x18')]=function(_0x4e7e87){return request(_0x3a41('0x19'),{'options':{'where':{'id':_0x4e7e87},'attributes':[_0x3a41('0xe')]}});};exports['getTrunkById']=function(_0x515a03){return request(_0x3a41('0x1a'),{'options':{'where':{'id':_0x515a03},'attributes':[_0x3a41('0xe')]}});};exports[_0x3a41('0x1b')]=function(_0x30591d){return request(_0x3a41('0x1c'),{'options':{'where':{'id':_0x30591d},'attributes':[_0x3a41('0x1d')]}});};exports[_0x3a41('0x1e')]=function(_0x232b8d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x232b8d},'include':[{'model':'Interval','as':_0x3a41('0x1f')}]}});};exports[_0x3a41('0x20')]=function(_0x4cd443){return request('ShowSmsAccount',{'options':{'where':{'id':_0x4cd443},'attributes':['id','name']}});};exports[_0x3a41('0x21')]=function(_0x24196c){return request(_0x3a41('0x22'),{'body':_0x24196c});};exports[_0x3a41('0x23')]=function(_0x547e43){return request('CreateSquareDetailsReport',{'body':_0x547e43});};exports[_0x3a41('0x24')]=function(_0x1ea3fe){return request(_0x3a41('0x25'),{'body':_[_0x3a41('0x26')](_0x1ea3fe,{'project_name':_0x1ea3fe[_0x3a41('0x27')],'prev_project_name':_0x1ea3fe[_0x3a41('0x28')]||'','is_subproject':_0x1ea3fe['arg_2']?!![]:![],'leaveAt':moment()[_0x3a41('0x29')](_0x3a41('0x2a'))})});};exports['createSquareRecording']=function(_0x15e91c){return request(_0x3a41('0x2b'),{'body':_0x15e91c});};exports[_0x3a41('0x2c')]=function(_0x2d5f59){return request(_0x3a41('0x2d'),{'body':_0x2d5f59});};exports['createCmContact']=function(_0x3d6582){return request(_0x3a41('0x2e'),{'options':{'raw':![],'where':{'phone':_0x3d6582['phone'],'ListId':_0x3d6582[_0x3a41('0x2f')]}}})['then'](function(_0x105e6f){if(_0x105e6f){return _0x105e6f;}return request('CreateCmContact',{'body':_0x3d6582});});};exports[_0x3a41('0x30')]=function(_0x5be3cd){return request(_0x3a41('0x31'),{'options':{'where':{'id':_0x5be3cd},'attributes':[_0x3a41('0xe')]}});};exports[_0x3a41('0x32')]=function(_0x2209d1,_0x169c22){return request(_0x3a41('0x33'),{'body':{'interface':_0x169c22},'options':{'where':_0x2209d1}});};exports[_0x3a41('0x34')]=function(_0x1206fb,_0xeb5219,_0x3772ce){return request(_0x3a41('0x35'),{'body':{'type':_0xeb5219,'uniqueid':_0x3772ce},'options':{'where':_0x1206fb}});};exports[_0x3a41('0x36')]=function(_0x435380){return request(_0x3a41('0x37'),{'body':{},'options':{'where':_0x435380}});};exports['agentLogout']=function(_0x4cb335){return request('LogoutUser',{'body':{},'options':{'where':_0x4cb335}});}; \ No newline at end of file +var _0x45e2=['result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','email','getSquareProjectById','name','getVoiceQueueById','getVariableById','getSquareOdbcById','dsn','getUserById','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','UnpauseUser','agentLogout','moment','lodash','jayson/promise','client','http','request','error','message'];(function(_0x172d31,_0x236c1c){var _0x35903e=function(_0x59fa1d){while(--_0x59fa1d){_0x172d31['push'](_0x172d31['shift']());}};_0x35903e(++_0x236c1c);}(_0x45e2,0x1a0));var _0x245e=function(_0x27b1df,_0x2af1f8){_0x27b1df=_0x27b1df-0x0;var _0x4543b8=_0x45e2[_0x27b1df];return _0x4543b8;};'use strict';var BPromise=require('bluebird');var moment=require(_0x245e('0x0'));var _=require(_0x245e('0x1'));var util=require('util');var jayson=require(_0x245e('0x2'));var client=jayson[_0x245e('0x3')][_0x245e('0x4')]({'port':0x2329});function request(_0x16bce3,_0x533338){return new BPromise(function(_0x764a48,_0x5f077b){return client[_0x245e('0x5')](_0x16bce3,_0x533338)['then'](function(_0x1d1602){if(_0x1d1602[_0x245e('0x6')]){return _0x5f077b(_0x1d1602[_0x245e('0x6')][_0x245e('0x7')]);}else{return _0x764a48(_0x1d1602[_0x245e('0x8')]);}})[_0x245e('0x9')](function(_0x53114e){return _0x5f077b(_0x53114e);});});}exports['getSquareProject']=function(_0x549bee){return request(_0x245e('0xa'),{'options':{'raw':![],'where':{'name':_0x549bee},'attributes':[_0x245e('0xb')]}});};exports[_0x245e('0xc')]=function(_0x66db1b){return request(_0x245e('0xd'),{'options':{'raw':![],'where':{'id':_0x66db1b},'include':[{'model':'MailServerOut','as':_0x245e('0xe')}],'attributes':['id','name',_0x245e('0xf')]}});};exports[_0x245e('0x10')]=function(_0xeb0e79){return request(_0x245e('0xa'),{'options':{'where':{'id':_0xeb0e79},'attributes':[_0x245e('0x11')]}});};exports[_0x245e('0x12')]=function(_0x3b614b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3b614b},'attributes':[_0x245e('0x11')]}});};exports[_0x245e('0x13')]=function(_0x1fa730){return request('ShowVariable',{'options':{'where':{'id':_0x1fa730},'attributes':[_0x245e('0x11')]}});};exports[_0x245e('0x14')]=function(_0x552365){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x552365},'attributes':[_0x245e('0x15')]}});};exports[_0x245e('0x16')]=function(_0x277c89){return request('ShowUser',{'options':{'where':{'id':_0x277c89},'attributes':[_0x245e('0x11')]}});};exports[_0x245e('0x17')]=function(_0x5fde3a){return request(_0x245e('0x18'),{'options':{'where':{'id':_0x5fde3a},'attributes':[_0x245e('0x11')]}});};exports['getSoundById']=function(_0x2e7abe){return request(_0x245e('0x19'),{'options':{'where':{'id':_0x2e7abe},'attributes':[_0x245e('0x1a')]}});};exports[_0x245e('0x1b')]=function(_0x16a61c){return request(_0x245e('0x1c'),{'options':{'raw':![],'where':{'id':_0x16a61c},'include':[{'model':_0x245e('0x1d'),'as':'Intervals'}]}});};exports[_0x245e('0x1e')]=function(_0xefe25){return request(_0x245e('0x1f'),{'options':{'where':{'id':_0xefe25},'attributes':['id',_0x245e('0x11')]}});};exports[_0x245e('0x20')]=function(_0x5a9f10){return request('CreateSmsMessage',{'body':_0x5a9f10});};exports[_0x245e('0x21')]=function(_0x424cff){return request(_0x245e('0x22'),{'body':_0x424cff});};exports[_0x245e('0x23')]=function(_0x172c8e){return request('CreateSquareReport',{'body':_[_0x245e('0x24')](_0x172c8e,{'project_name':_0x172c8e[_0x245e('0x25')],'prev_project_name':_0x172c8e['arg_2']||'','is_subproject':_0x172c8e[_0x245e('0x26')]?!![]:![],'leaveAt':moment()['format'](_0x245e('0x27'))})});};exports['createSquareRecording']=function(_0x4cd68a){return request('CreateSquareRecording',{'body':_0x4cd68a});};exports[_0x245e('0x28')]=function(_0xa2e0f6){return request(_0x245e('0x29'),{'body':_0xa2e0f6});};exports[_0x245e('0x2a')]=function(_0x201859){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x201859[_0x245e('0x2b')],'ListId':_0x201859[_0x245e('0x2c')]}}})[_0x245e('0x2d')](function(_0x209378){if(_0x209378){return _0x209378;}return request(_0x245e('0x2e'),{'body':_0x201859});});};exports[_0x245e('0x2f')]=function(_0x808d8e){return request(_0x245e('0x30'),{'options':{'where':{'id':_0x808d8e},'attributes':['name']}});};exports['agentLogin']=function(_0x333710,_0x1d25dc){return request(_0x245e('0x31'),{'body':{'interface':_0x1d25dc},'options':{'where':_0x333710}});};exports[_0x245e('0x32')]=function(_0x818d7d,_0xb32586,_0x1b0dc7){return request('PauseUser',{'body':{'type':_0xb32586,'uniqueid':_0x1b0dc7},'options':{'where':_0x818d7d}});};exports['agentUnpause']=function(_0x5200f7){return request(_0x245e('0x33'),{'body':{},'options':{'where':_0x5200f7}});};exports[_0x245e('0x34')]=function(_0x1ba9fb){return request('LogoutUser',{'body':{},'options':{'where':_0x1ba9fb}});}; \ 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 d95c2f5..79a2988 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 _0x6f0d=['./lex','exports'];(function(_0xf6f71b,_0x178d5a){var _0x3be4f5=function(_0x365abb){while(--_0x365abb){_0xf6f71b['push'](_0xf6f71b['shift']());}};_0x3be4f5(++_0x178d5a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x488b6e,_0x13e1e2){_0x488b6e=_0x488b6e-0x0;var _0x4683ed=_0x6f0d[_0x488b6e];return _0x4683ed;};var polly=require('./polly');var lex=require(_0xd6f0('0x0'));module[_0xd6f0('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9b9b=['./lex'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x9b9b,0x114));var _0xb9b9=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x9b9b[_0x30faec];return _0x29484f;};var polly=require('./polly');var lex=require(_0xb9b9('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index e843fb1..65097dc 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 _0x35aa=['exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x35aa,0xbe));var _0xa35a=function(_0x3de9d7,_0x21f552){_0x3de9d7=_0x3de9d7-0x0;var _0x66bf8d=_0x35aa[_0x3de9d7];return _0x66bf8d;};'use strict';var lex=require('./lib/api');module[_0xa35a('0x0')]=function(_0x2d2970,_0x9a3c63,_0x3518ac,_0x5c294c,_0x2e9bcf,_0x4303b4){return lex(_0x2d2970,_0x9a3c63,_0x3518ac,_0x5c294c,_0x2e9bcf,_0x4303b4);}; \ No newline at end of file +var _0xfc4c=['./lib/api','exports'];(function(_0xf93e43,_0x25953d){var _0x3df86f=function(_0x4d2e54){while(--_0x4d2e54){_0xf93e43['push'](_0xf93e43['shift']());}};_0x3df86f(++_0x25953d);}(_0xfc4c,0xca));var _0xcfc4=function(_0x1451fe,_0x30bb35){_0x1451fe=_0x1451fe-0x0;var _0x1fd92a=_0xfc4c[_0x1451fe];return _0x1fd92a;};'use strict';var lex=require(_0xcfc4('0x0'));module[_0xcfc4('0x1')]=function(_0x203a38,_0x52fa35,_0x29323d,_0xb8f67b,_0x3a0bd9,_0x54bee8){return lex(_0x203a38,_0x52fa35,_0x29323d,_0xb8f67b,_0x3a0bd9,_0x54bee8);}; \ 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 2b65aa0..59876c0 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 _0x0dc0=['bluebird','aws-sdk','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST'];(function(_0x3c2f8a,_0x1c22a8){var _0x21fdc5=function(_0x360b77){while(--_0x360b77){_0x3c2f8a['push'](_0x3c2f8a['shift']());}};_0x21fdc5(++_0x1c22a8);}(_0x0dc0,0xf0));var _0x00dc=function(_0x2aa93f,_0x4dce40){_0x2aa93f=_0x2aa93f-0x0;var _0x194c71=_0x0dc0[_0x2aa93f];return _0x194c71;};'use strict';var BPromise=require(_0x00dc('0x0'));var AWS=require(_0x00dc('0x1'));function lexResult(_0x1ae124,_0x3f1776){return new BPromise(function(_0x5003e8,_0x542f0d){_0x1ae124['postText'](_0x3f1776,function(_0x30fe37,_0x408333){if(_0x30fe37){_0x542f0d(_0x30fe37);}if(_0x408333[_0x00dc('0x2')]){for(const _0x35520a in _0x408333[_0x00dc('0x2')]){if(_0x408333[_0x00dc('0x2')][_0x00dc('0x3')](_0x35520a)){var _0x2f8e61=_0x408333[_0x00dc('0x2')][_0x35520a];_0x408333[_0x00dc('0x4')+_0x35520a]=_0x2f8e61;}}}_0x5003e8(_0x408333);});});}module[_0x00dc('0x5')]=function(_0x1555b0,_0x357005,_0x18d137,_0x4f8415,_0x2346ed,_0x191663){var _0x17165f=new AWS[(_0x00dc('0x6'))]({'accessKeyId':_0x357005,'secretAccessKey':_0x18d137,'region':_0x4f8415});var _0x31127b={'botAlias':_0x00dc('0x7'),'botName':_0x191663,'inputText':_0x2346ed,'userId':_0x1555b0};return lexResult(_0x17165f,_0x31127b);}; \ No newline at end of file +var _0xec3d=['$LATEST','slots','hasOwnProperty','slot_','exports'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xec3d,0x1aa));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x41f487,_0x189887){return new BPromise(function(_0x26fa4f,_0x7a9a1d){_0x41f487['postText'](_0x189887,function(_0x3d8747,_0x158fee){if(_0x3d8747){_0x7a9a1d(_0x3d8747);}if(_0x158fee[_0xdec3('0x0')]){for(const _0x4961ad in _0x158fee[_0xdec3('0x0')]){if(_0x158fee[_0xdec3('0x0')][_0xdec3('0x1')](_0x4961ad)){var _0x5673a4=_0x158fee[_0xdec3('0x0')][_0x4961ad];_0x158fee[_0xdec3('0x2')+_0x4961ad]=_0x5673a4;}}}_0x26fa4f(_0x158fee);});});}module[_0xdec3('0x3')]=function(_0x5cb3d0,_0x43cc24,_0x828311,_0xc5804c,_0x3d5b00,_0x42b6c6){var _0x5ee84f=new AWS['LexRuntime']({'accessKeyId':_0x43cc24,'secretAccessKey':_0x828311,'region':_0xc5804c});var _0x137b00={'botAlias':_0xdec3('0x4'),'botName':_0x42b6c6,'inputText':_0x3d5b00,'userId':_0x5cb3d0};return lexResult(_0x5ee84f,_0x137b00);}; \ 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 1aae0f7..e78d153 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 _0xdf53=['./lib/api','exports'];(function(_0x56de90,_0x301576){var _0x4f47e4=function(_0x173d48){while(--_0x173d48){_0x56de90['push'](_0x56de90['shift']());}};_0x4f47e4(++_0x301576);}(_0xdf53,0x174));var _0x3df5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdf53[_0x397e5f];return _0x5302b8;};'use strict';var polly=require(_0x3df5('0x0'));module[_0x3df5('0x1')]=function(_0x5a1e2f,_0x5a0e07,_0x27936d,_0x370dae,_0x41065c,_0x26746a,_0x65fd8c){return polly(_0x5a1e2f,_0x5a0e07,_0x27936d,_0x370dae,_0x41065c,_0x26746a,_0x65fd8c);}; \ No newline at end of file +var _0x735d=['exports','./lib/api'];(function(_0x394589,_0x10c686){var _0x11248f=function(_0x5569f2){while(--_0x5569f2){_0x394589['push'](_0x394589['shift']());}};_0x11248f(++_0x10c686);}(_0x735d,0xbf));var _0xd735=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x735d[_0x4991d6];return _0x50faf7;};'use strict';var polly=require(_0xd735('0x0'));module[_0xd735('0x1')]=function(_0x4e51c5,_0x37b453,_0x6acc42,_0x3d3bc2,_0xa54446,_0x2e96cd,_0x52f6ac){return polly(_0x4e51c5,_0x37b453,_0x6acc42,_0x3d3bc2,_0xa54446,_0x2e96cd,_0x52f6ac);}; \ 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 f426ede..e93dbab 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 _0xb305=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x1c4e6c,_0x3ce9ec){var _0x4a1d29=function(_0x184dc6){while(--_0x184dc6){_0x1c4e6c['push'](_0x1c4e6c['shift']());}};_0x4a1d29(++_0x3ce9ec);}(_0xb305,0x1ae));var _0x5b30=function(_0x2b6ad3,_0x1a3fb3){_0x2b6ad3=_0x2b6ad3-0x0;var _0x5730b3=_0xb305[_0x2b6ad3];return _0x5730b3;};'use strict';var fs=require('fs');var path=require(_0x5b30('0x0'));var BPromise=require(_0x5b30('0x1'));var rs=require(_0x5b30('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x146ce2,_0x370a2f,_0x553a3a){return new BPromise(function(_0x4a8c78,_0x333d4b){_0x146ce2[_0x5b30('0x3')](_0x370a2f,function(_0x45c2e3,_0x472f52){if(_0x45c2e3){_0x333d4b(_0x45c2e3);}else if(_0x472f52){if(_0x472f52[_0x5b30('0x4')]instanceof Buffer){fs[_0x5b30('0x5')](_0x553a3a,_0x472f52[_0x5b30('0x4')],function(_0x4ab28a){if(_0x4ab28a){_0x333d4b(_0x4ab28a);}else{_0x4a8c78();}});}else{_0x333d4b(new Error(_0x5b30('0x6')));}}else{_0x333d4b(new Error(_0x5b30('0x7')));}});});}module[_0x5b30('0x8')]=function(_0x1b62ff,_0x2c6326,_0x28c0fc,_0x29cf31,_0x4c3d31,_0x1fdcc1,_0x3c972e){var _0x2d77b9=new AWS['Polly']({'accessKeyId':_0x1b62ff,'secretAccessKey':_0x2c6326,'region':_0x28c0fc});var _0x5f6f5b={'Text':_0x4c3d31,'TextType':_0x1fdcc1||_0x5b30('0x9'),'OutputFormat':_0x5b30('0xa'),'VoiceId':_0x29cf31};return pollyResult(_0x2d77b9,_0x5f6f5b,_0x3c972e);}; \ No newline at end of file +var _0xf65d=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','bluebird','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x351876,_0x5d1d62){var _0x1ed2e5=function(_0x254fce){while(--_0x254fce){_0x351876['push'](_0x351876['shift']());}};_0x1ed2e5(++_0x5d1d62);}(_0xf65d,0x7a));var _0xdf65=function(_0x1620f5,_0xcf5340){_0x1620f5=_0x1620f5-0x0;var _0x4017fe=_0xf65d[_0x1620f5];return _0x4017fe;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xdf65('0x0'));var rs=require('randomstring');var AWS=require(_0xdf65('0x1'));function pollyResult(_0x2fa1c0,_0x183075,_0xa1cf81){return new BPromise(function(_0x370b2f,_0x1730d7){_0x2fa1c0['synthesizeSpeech'](_0x183075,function(_0x397eff,_0xcc3369){if(_0x397eff){_0x1730d7(_0x397eff);}else if(_0xcc3369){if(_0xcc3369[_0xdf65('0x2')]instanceof Buffer){fs['writeFile'](_0xa1cf81,_0xcc3369[_0xdf65('0x2')],function(_0x4f65e0){if(_0x4f65e0){_0x1730d7(_0x4f65e0);}else{_0x370b2f();}});}else{_0x1730d7(new Error(_0xdf65('0x3')));}}else{_0x1730d7(new Error(_0xdf65('0x4')));}});});}module[_0xdf65('0x5')]=function(_0x61b47d,_0x2e2452,_0x381075,_0x5c23c1,_0x24972d,_0x43f845,_0x20d37a){var _0x4d9dae=new AWS['Polly']({'accessKeyId':_0x61b47d,'secretAccessKey':_0x2e2452,'region':_0x381075});var _0x2144da={'Text':_0x24972d,'TextType':_0x43f845||'text','OutputFormat':'mp3','VoiceId':_0x5c23c1};return pollyResult(_0x4d9dae,_0x2144da,_0x20d37a);}; \ 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 7e75f88..9b7d1e8 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 _0xa927=['./lib/api','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa927,0x192));var _0x7a92=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa927[_0x3bf83f];return _0x22c4a9;};'use strict';var asr=require(_0x7a92('0x0'));module[_0x7a92('0x1')]=function(_0x21d882,_0x5bedc1,_0x453d88,_0x28b23a){return asr(_0x21d882,_0x5bedc1,_0x453d88);}; \ No newline at end of file +var _0x1d0e=['./lib/api'];(function(_0x84a97e,_0x59f2f2){var _0x3f980b=function(_0x78a15f){while(--_0x78a15f){_0x84a97e['push'](_0x84a97e['shift']());}};_0x3f980b(++_0x59f2f2);}(_0x1d0e,0x1ce));var _0xe1d0=function(_0x3170d1,_0x39fa54){_0x3170d1=_0x3170d1-0x0;var _0x1e976c=_0x1d0e[_0x3170d1];return _0x1e976c;};'use strict';var asr=require(_0xe1d0('0x0'));module['exports']=function(_0x31d42e,_0x2586a9,_0x5f4f70,_0x1c6afc){return asr(_0x31d42e,_0x2586a9,_0x5f4f70);}; \ 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 316a243..99f1b2d 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 _0x8409=['base64','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','length','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x2d90cc,_0x45bb4e){var _0x227a99=function(_0x3bab2c){while(--_0x3bab2c){_0x2d90cc['push'](_0x2d90cc['shift']());}};_0x227a99(++_0x45bb4e);}(_0x8409,0x121));var _0x9840=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x8409[_0x548627];return _0x844a84;};'use strict';var url=require(_0x9840('0x0'));var BPromise=require(_0x9840('0x1'));var fs=require('fs');var host=_0x9840('0x2');module['exports']=function(_0x3fe7f8,_0x29414d,_0x29e9af){return new BPromise(function(_0x49f0a4,_0x180678){var _0x979aa0;if(typeof _0x3fe7f8!=='string'||_0x3fe7f8[_0x9840('0x3')]===0x0){return _0x180678('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x29414d!==_0x9840('0x4')||_0x29414d['length']===0x0){return _0x180678('key\x20should\x20be\x20a\x20string');}if(typeof _0x29e9af!==_0x9840('0x5')&&(typeof _0x29e9af!==_0x9840('0x4')||_0x29e9af[_0x9840('0x3')]===0x0)){return _0x180678(_0x9840('0x6'));}try{_0x979aa0=fs[_0x9840('0x7')](_0x3fe7f8)['toString'](_0x9840('0x8'));}catch(_0x201c0e){return _0x180678(_0x201c0e);}return _0x49f0a4({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x29414d,'body':{'config':{'encoding':_0x9840('0x9'),'sampleRateHertz':_0x9840('0xa'),'languageCode':_0x29e9af},'audio':{'content':_0x979aa0}},'json':!![]});});}; \ No newline at end of file +var _0x1c4f=['string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x42d4a8,_0x2cd229){var _0x390913=function(_0x57a42d){while(--_0x57a42d){_0x42d4a8['push'](_0x42d4a8['shift']());}};_0x390913(++_0x2cd229);}(_0x1c4f,0x10c));var _0xf1c4=function(_0x10b32b,_0x1eefca){_0x10b32b=_0x10b32b-0x0;var _0x9cc3ea=_0x1c4f[_0x10b32b];return _0x9cc3ea;};'use strict';var url=require(_0xf1c4('0x0'));var BPromise=require(_0xf1c4('0x1'));var fs=require('fs');var host=_0xf1c4('0x2');module['exports']=function(_0x24278f,_0x5aebd8,_0x4c41d6){return new BPromise(function(_0x48ab70,_0x511361){var _0x576e0e;if(typeof _0x24278f!=='string'||_0x24278f[_0xf1c4('0x3')]===0x0){return _0x511361(_0xf1c4('0x4'));}if(typeof _0x5aebd8!==_0xf1c4('0x5')||_0x5aebd8['length']===0x0){return _0x511361('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c41d6!==_0xf1c4('0x6')&&(typeof _0x4c41d6!=='string'||_0x4c41d6[_0xf1c4('0x3')]===0x0)){return _0x511361(_0xf1c4('0x7'));}try{_0x576e0e=fs[_0xf1c4('0x8')](_0x24278f)[_0xf1c4('0x9')](_0xf1c4('0xa'));}catch(_0x1a6066){return _0x511361(_0x1a6066);}return _0x48ab70({'method':'POST','uri':host+_0xf1c4('0xb')+_0x5aebd8,'body':{'config':{'encoding':_0xf1c4('0xc'),'sampleRateHertz':'8000','languageCode':_0x4c41d6},'audio':{'content':_0x576e0e}},'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 bf11347..3f0a0c0 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 _0x1cd0=['exports'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x1cd0,0x1e1));var _0x01cd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1cd0[_0x4565bf];return _0x5610ba;};var asr=require('./asr');module[_0x01cd('0x0')]={'asr':asr}; \ No newline at end of file +var _0x5601=['./asr'];(function(_0x1be1f4,_0x5f98a){var _0x3474e6=function(_0x1eb7f1){while(--_0x1eb7f1){_0x1be1f4['push'](_0x1be1f4['shift']());}};_0x3474e6(++_0x5f98a);}(_0x5601,0x1cf));var _0x1560=function(_0x2a3926,_0x3a56d6){_0x2a3926=_0x2a3926-0x0;var _0x42e888=_0x5601[_0x2a3926];return _0x42e888;};var asr=require(_0x1560('0x0'));module['exports']={'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 a918420..025d0ea 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 _0xb6cc=['speech','score','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','format','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','unlink','end','protocol','WHAT_EVER','data','transcode','wav','error\x20convert','info','.wav','writeFileSync','base64','then','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','POST','resolve','tmp','generate','from','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','.mp3','asr','uri','map','alternatives','transcript','join','results','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','fulfillment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6cc,0x121));var _0xcb6c=function(_0x34ed36,_0x4e44d6){_0x34ed36=_0x34ed36-0x0;var _0x103b99=_0xb6cc[_0x34ed36];return _0x103b99;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xcb6c('0x0'));var dialogflow=require(_0xcb6c('0x1'));var fs=require('fs');var http=require(_0xcb6c('0x2'));var https=require(_0xcb6c('0x3'));var md5=require(_0xcb6c('0x4'));var path=require(_0xcb6c('0x5'));var querystring=require(_0xcb6c('0x6'));var rp=require(_0xcb6c('0x7'));var rs=require('randomstring');var sox=require(_0xcb6c('0x8'));var tts=require(_0xcb6c('0x9'));var urlParse=require('url')[_0xcb6c('0xa')];var util=require(_0xcb6c('0xb'));var aws=require(_0xcb6c('0xc'));var google=require(_0xcb6c('0xd'));var sestek=require(_0xcb6c('0xe'));var tilde=require('./tilde');var logger=require(_0xcb6c('0xf'))(_0xcb6c('0x10'));var ISPEECH_API=_0xcb6c('0x11');function downloadFile(_0x514f46,_0x59730e){return new BPromise(function(_0x4636bf,_0x2ac320){var _0x534a55=urlParse(_0x514f46);var _0xf7c943=_0x534a55['protocol']===_0xcb6c('0x12')?https:http;var _0x178962={'host':_0x534a55[_0xcb6c('0x13')],'path':_0x534a55[_0xcb6c('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0xf7c943[_0xcb6c('0x14')](_0x178962,function(_0x56a8eb){if(_0x56a8eb[_0xcb6c('0x15')]!==0xc8){logger[_0xcb6c('0x16')]('request\x20to\x20'+_0x514f46+'\x20failed,\x20status\x20code\x20=\x20'+_0x56a8eb['statusCode']+'\x20('+_0x56a8eb['statusMessage']+')');_0x2ac320(new Error(_0xcb6c('0x17')+_0x514f46+_0xcb6c('0x18')+_0x56a8eb[_0xcb6c('0x15')]+'\x20('+_0x56a8eb[_0xcb6c('0x19')]+')'));return;}var _0x34fca7=fs['createWriteStream'](_0x59730e);_0x34fca7['on'](_0xcb6c('0x1a'),function(){logger['info'](_0xcb6c('0x1b'));_0x34fca7[_0xcb6c('0x1c')](_0x4636bf);});_0x34fca7['on'](_0xcb6c('0x16'),function(_0xc9f97c){fs[_0xcb6c('0x1d')](_0x59730e);logger[_0xcb6c('0x16')]('download\x20error',_0xc9f97c);_0x2ac320(_0xc9f97c);});_0x56a8eb['pipe'](_0x34fca7);})['on'](_0xcb6c('0x16'),function(_0x1f19ef){logger[_0xcb6c('0x16')](_0x1f19ef);_0x2ac320(_0x1f19ef);})[_0xcb6c('0x1e')]();});}function uploadFile(_0x1ce0fb){return new BPromise(function(_0x3fc06c,_0x435e23){var _0x524d1d=urlParse(_0x1ce0fb);var _0x5d6bf9=_0x524d1d[_0xcb6c('0x1f')]===_0xcb6c('0x12')?https:http;var _0x5e91da={'host':_0x524d1d['host'],'path':_0x524d1d['path'],'headers':{'user-agent':_0xcb6c('0x20')}};_0x5d6bf9['get'](_0x5e91da,function(_0x13a75d){if(_0x13a75d[_0xcb6c('0x15')]!==0xc8){_0x435e23(new Error(_0xcb6c('0x17')+_0x1ce0fb+_0xcb6c('0x18')+_0x13a75d[_0xcb6c('0x15')]+'\x20('+_0x13a75d[_0xcb6c('0x19')]+')'));return;}var _0x476317='';_0x13a75d['on'](_0xcb6c('0x21'),function(_0x4f0ff5){_0x476317+=_0x4f0ff5;});_0x13a75d['on']('end',function(){_0x3fc06c(_0x476317);});})['on']('error',function(_0x33a249){_0x435e23(_0x33a249);})[_0xcb6c('0x1e')]();});}function convertFile(_0x583fab,_0x24252a){return new BPromise(function(_0x71a48d,_0x51c03d){var _0x2f195e=sox[_0xcb6c('0x22')](_0x583fab,_0x24252a,{'sampleRate':0x1f40,'format':_0xcb6c('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2f195e['on']('error',function(_0x50e803){logger[_0xcb6c('0x16')](_0xcb6c('0x24'),_0x50e803);_0x51c03d(_0x50e803);});_0x2f195e['on'](_0xcb6c('0x1e'),function(){logger[_0xcb6c('0x25')]('finish\x20to\x20convert');_0x71a48d();});_0x2f195e['start']();});}function base64Decode(_0x4e5e0e,_0x3e36bf){var _0x31da0a=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xcb6c('0x26'));fs[_0xcb6c('0x27')](_0x31da0a,_0x4e5e0e,_0xcb6c('0x28'));return convertFile(_0x31da0a,_0x3e36bf)[_0xcb6c('0x29')](function(){try{fs[_0xcb6c('0x1d')](_0x31da0a);fs['chmodSync'](_0x3e36bf,_0xcb6c('0x2a'));}catch(_0x3d27cd){logger[_0xcb6c('0x16')](_0x3d27cd);}return _0x3e36bf[_0xcb6c('0x2b')]('.')[0x0];});}function base64Encode(_0x1f99b1){var _0x334e1a=fs['readFileSync'](_0x1f99b1);return new Buffer(_0x334e1a)[_0xcb6c('0x2c')](_0xcb6c('0x28'));}exports[_0xcb6c('0x2d')]=function(_0x148942,_0x240db0,_0x21bf1e,_0x27c7fc,_0x3a7d9c,_0x501bbf){var _0xfe9749,_0x37b53d;var _0x3883e7=_0xcb6c('0x2e');var _0x140300=_0xcb6c('0x2f')+_0x148942;var _0x3e9b81={};if(_0x240db0===_0xcb6c('0x30')){_0x3e9b81[_0xcb6c('0x31')]={'ssml':_0x21bf1e};}else{_0x3e9b81[_0xcb6c('0x31')]={'text':_0x21bf1e};};_0x3e9b81[_0xcb6c('0x32')]={'languageCode':_0x27c7fc,'ssmlGender':_0x3a7d9c};_0x3e9b81['audioConfig']={'audioEncoding':_0xcb6c('0x33'),'sampleRateHertz':0x1f40};var _0x50b5ca={'url':_0x3883e7+_0xcb6c('0x34')+_0x140300,'method':_0xcb6c('0x35'),'json':!![],'body':_0x3e9b81};return rp(_0x50b5ca)['then'](function(_0x4af9d9){return new BPromise(function(_0x37a7c1,_0x433f5a){_0xfe9749=path[_0xcb6c('0x36')](__dirname,_0xcb6c('0x37'),rs[_0xcb6c('0x38')](0x4)+'.mp3');var _0x23094b=Buffer[_0xcb6c('0x39')](_0x4af9d9[_0xcb6c('0x3a')],'base64');return fs['writeFile'](_0xfe9749,_0x23094b,function(_0x4090b6){_0x433f5a(_0x4090b6);},function(_0x3bd39c){fs[_0xcb6c('0x3b')](_0xfe9749,_0xcb6c('0x2a'));_0x37a7c1(_0x3bd39c);});});})[_0xcb6c('0x29')](function(_0x1072ba){_0x37b53d=path[_0xcb6c('0x36')](__dirname,_0xcb6c('0x37'),rs[_0xcb6c('0x38')](0x4)+_0xcb6c('0x26'));return convertFile(_0xfe9749,_0x37b53d);})[_0xcb6c('0x29')](function(){try{fs[_0xcb6c('0x1d')](_0xfe9749);fs[_0xcb6c('0x3b')](_0x37b53d,_0xcb6c('0x2a'));}catch(_0x126906){logger[_0xcb6c('0x16')](_0x126906);}logger[_0xcb6c('0x25')](_0xcb6c('0x3c'),_0x37b53d[_0xcb6c('0x2b')]('.')[0x0]);return _0x37b53d[_0xcb6c('0x2b')]('.')[0x0];});};exports[_0xcb6c('0x3d')]=function(_0x9bfe2,_0xc502e5){var _0x262cef,_0x518632;return tts(_0x9bfe2,_0xc502e5||'en',0x1)[_0xcb6c('0x29')](function(_0x52d100){logger[_0xcb6c('0x25')](_0x52d100);_0x262cef=path['resolve'](__dirname,_0xcb6c('0x37'),rs[_0xcb6c('0x38')](0x4)+_0xcb6c('0x3e'));return downloadFile(_0x52d100,_0x262cef);})[_0xcb6c('0x29')](function(){_0x518632=path[_0xcb6c('0x36')](__dirname,_0xcb6c('0x37'),rs[_0xcb6c('0x38')](0x4)+'.wav');return convertFile(_0x262cef,_0x518632);})[_0xcb6c('0x29')](function(){try{fs[_0xcb6c('0x1d')](_0x262cef);fs[_0xcb6c('0x3b')](_0x518632,_0xcb6c('0x2a'));}catch(_0xe1f7b2){logger['error'](_0xe1f7b2);}logger['info']('goggleTTS\x20path',_0x518632[_0xcb6c('0x2b')]('.')[0x0]);return _0x518632[_0xcb6c('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0xf896e5,_0xdd34e5,_0x5c0c25){return google[_0xcb6c('0x3f')](_0xf896e5,_0xdd34e5,_0x5c0c25)['then'](function(_0x4fbbb0){logger[_0xcb6c('0x25')](_0x4fbbb0[_0xcb6c('0x40')]);return rp(_0x4fbbb0);})[_0xcb6c('0x29')](function(_0xe305ce){var _0x49c628='';var _0x41094c=0x0;try{fs[_0xcb6c('0x1d')](_0xf896e5);}catch(_0x66516e){logger['error'](_0x66516e);}if(_0xe305ce&&_0xe305ce['results']){_0x49c628=_0xe305ce['results'][_0xcb6c('0x41')](function(_0x58bddb){return _0x58bddb&&_0x58bddb[_0xcb6c('0x42')][0x0]&&_0x58bddb[_0xcb6c('0x42')][0x0]['transcript']?_0x58bddb[_0xcb6c('0x42')][0x0][_0xcb6c('0x43')]:'';})[_0xcb6c('0x44')]('\x0a');_0x41094c=_0xe305ce[_0xcb6c('0x45')][_0xcb6c('0x41')](function(_0xc87d8e){return _0xc87d8e&&_0xc87d8e[_0xcb6c('0x42')][0x0]&&_0xc87d8e[_0xcb6c('0x42')][0x0]['confidence']?_0xc87d8e[_0xcb6c('0x42')][0x0]['confidence']:0x0;})[_0xcb6c('0x44')]('\x0a');}logger[_0xcb6c('0x25')](_0xcb6c('0x46'),_0x49c628);logger[_0xcb6c('0x25')](_0xcb6c('0x47'),_0x41094c);return{'transcript':_0x49c628,'confidence':_0x41094c};})[_0xcb6c('0x48')](function(_0xb72898){logger['error'](_0xcb6c('0x49'),_0xb72898[_0xcb6c('0x15')],_0xb72898[_0xcb6c('0x4a')],_0xb72898[_0xcb6c('0x4b')]);});};exports[_0xcb6c('0x4c')]=function(_0x318603,_0x49ba11,_0x1c91d8,_0x6996d2){var _0xb719d8=apiai(_0x49ba11,{'language':_0x6996d2||'en'});return _0xb719d8[_0xcb6c('0x4d')](_0x1c91d8,{'sessionId':md5(_0x318603)})['then'](function(_0x4a22d8){logger['info'](JSON[_0xcb6c('0x4e')](_0x4a22d8));return{'source':_0x4a22d8[_0xcb6c('0x4f')][_0xcb6c('0x50')],'resolvedQuery':_0x4a22d8['result'][_0xcb6c('0x51')],'action':_0x4a22d8['result']['action'],'actionIncomplete':_0x4a22d8[_0xcb6c('0x4f')]['actionIncomplete'],'speech':_0x4a22d8['result'][_0xcb6c('0x52')][_0xcb6c('0x53')],'score':_0x4a22d8['result'][_0xcb6c('0x54')],'statusCode':_0x4a22d8['status'][_0xcb6c('0x55')],'endConversation':_0x4a22d8[_0xcb6c('0x4f')]['metadata'][_0xcb6c('0x56')]||![],'isFallbackIntent':_0x4a22d8['result'][_0xcb6c('0x57')][_0xcb6c('0x58')]};});};exports[_0xcb6c('0x59')]=function(_0x25919e,_0x372de7,_0x5ca453,_0xc639a5,_0x1cfddb,_0x3c7990){var _0x1be9c5=_0xc639a5[_0xcb6c('0x5a')](/\\n/g,'\x0a');var _0x11fd32={'credentials':{'private_key':_0x1be9c5,'client_email':_0x5ca453}};var _0xcdb4d6=new dialogflow[(_0xcb6c('0x5b'))](_0x11fd32);var _0x5bed97=_0xcdb4d6[_0xcb6c('0x5c')](_0x372de7,md5(_0x25919e));var _0x51bdd2={'session':_0x5bed97,'queryInput':{'text':{'text':_0x1cfddb,'languageCode':_0x3c7990}}};return _0xcdb4d6[_0xcb6c('0x5d')](_0x51bdd2)['then'](function(_0x1f1daa){if(_0x1f1daa&&_0x1f1daa[_0xcb6c('0x5e')]){logger['info']('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x1f1daa));var _0x5d52a7=_0x1f1daa[0x0];if(_0x5d52a7){var _0x4e6a2e={'action':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x60')],'allRequiredParamsPresent':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x61')],'endConversation':_0x5d52a7['queryResult']['diagnosticInfo']&&_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x62')][_0xcb6c('0x63')]?_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x62')][_0xcb6c('0x63')][_0xcb6c('0x64')]['boolValue']:![],'fulfillmentText':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x65')],'intentName':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x66')][_0xcb6c('0x4a')],'intentDisplayName':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x66')]['displayName'],'isFallbackIntent':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x66')]['isFallback'],'languageCode':_0x5d52a7[_0xcb6c('0x5f')][_0xcb6c('0x67')],'queryText':_0x5d52a7['queryResult']['queryText'],'responseId':_0x5d52a7[_0xcb6c('0x68')],'score':_0x5d52a7['queryResult'][_0xcb6c('0x69')],'speech':_0x5d52a7[_0xcb6c('0x5f')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x1f1daa)};return _0x4e6a2e;}}});};exports[_0xcb6c('0x6a')]=function(_0x12a68d,_0x261e78,_0x4f92f2,_0x273ae2){return tilde[_0xcb6c('0x3f')](_0x12a68d,_0x261e78,_0x4f92f2,_0x273ae2)['then'](function(_0x320ca7){try{fs[_0xcb6c('0x1d')](_0x12a68d);}catch(_0x37e7d6){logger['error'](_0x37e7d6);}logger[_0xcb6c('0x25')](_0xcb6c('0x6b'),_0x320ca7[_0xcb6c('0x43')]);logger['info'](_0xcb6c('0x6c'),_0x320ca7[_0xcb6c('0x6d')]);return _0x320ca7;});};exports[_0xcb6c('0x6e')]=function(_0x299e96,_0x5c76ba,_0x344ec3,_0x21a81a,_0x51dc5c,_0x5b4b37){var _0x3a55d6=path[_0xcb6c('0x36')](__dirname,_0xcb6c('0x37'),rs[_0xcb6c('0x38')](0x4)+_0xcb6c('0x3e'));var _0x16d6ab;return aws[_0xcb6c('0x6f')](_0x299e96,_0x5c76ba,_0x344ec3,_0x21a81a,_0x51dc5c,_0x5b4b37,_0x3a55d6)[_0xcb6c('0x29')](function(){_0x16d6ab=path[_0xcb6c('0x36')](__dirname,_0xcb6c('0x37'),rs[_0xcb6c('0x38')](0x4)+_0xcb6c('0x26'));return convertFile(_0x3a55d6,_0x16d6ab);})['then'](function(){try{fs[_0xcb6c('0x1d')](_0x3a55d6);fs[_0xcb6c('0x3b')](_0x16d6ab,_0xcb6c('0x2a'));}catch(_0x4cd2f1){logger[_0xcb6c('0x16')](_0x4cd2f1);}return _0x16d6ab[_0xcb6c('0x2b')]('.')[0x0];});};exports[_0xcb6c('0x70')]=function(_0x474e49,_0x50711f,_0x5d52a8,_0x431a1d,_0x4a8183,_0x4c9217){return aws[_0xcb6c('0x71')](_0x474e49,_0x50711f,_0x5d52a8,_0x431a1d,_0x4a8183,_0x4c9217)[_0xcb6c('0x29')](function(_0x556165){logger[_0xcb6c('0x25')](JSON[_0xcb6c('0x4e')](_0x556165));return _0x556165;});};exports['ispeechTTS']=function(_0x4052a1,_0x4751bc,_0x2b444a,_0x545194){var _0x30e854=util[_0xcb6c('0x72')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4052a1,encodeURIComponent(_0x4751bc),_0x2b444a,_0x545194);var _0x22a6a6=path[_0xcb6c('0x36')](__dirname,'tmp',rs[_0xcb6c('0x38')](0x4)+_0xcb6c('0x3e'));var _0x3fdb60;return downloadFile(_0x30e854,_0x22a6a6)['then'](function(){_0x3fdb60=path['resolve'](__dirname,_0xcb6c('0x37'),rs['generate'](0x4)+_0xcb6c('0x26'));return convertFile(_0x22a6a6,_0x3fdb60);})['then'](function(){try{fs['unlink'](_0x22a6a6);fs[_0xcb6c('0x3b')](_0x3fdb60,_0xcb6c('0x2a'));}catch(_0x12fe1a){logger[_0xcb6c('0x16')](_0x12fe1a);}return _0x3fdb60['split']('.')[0x0];});};exports['ispeechASR']=function(_0x38dff4,_0x32d010,_0x176354,_0x1824f7){var _0x4524dd=util[_0xcb6c('0x72')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x32d010,_0x176354,base64Encode(_0x38dff4),_0x1824f7?util[_0xcb6c('0x72')]('model=%s',encodeURIComponent(_0x1824f7)):_0xcb6c('0x73'));return uploadFile(_0x4524dd)[_0xcb6c('0x29')](function(_0x51b1b3){return querystring[_0xcb6c('0xa')](_0x51b1b3);});};exports[_0xcb6c('0x74')]=function(_0x5d0648,_0x37404b){return sestek[_0xcb6c('0x75')](_0x5d0648,_0x37404b)[_0xcb6c('0x29')](function(_0x5c9ac6){logger[_0xcb6c('0x25')](JSON[_0xcb6c('0x4e')](_0x5c9ac6));var _0xb08400={'speech':_0x5c9ac6['text'],'action':_0x5c9ac6[_0xcb6c('0x76')]?_0x5c9ac6[_0xcb6c('0x76')][_0xcb6c('0x77')]:undefined,'actiondata':_0x5c9ac6[_0xcb6c('0x76')]?_0x5c9ac6[_0xcb6c('0x76')][_0xcb6c('0x78')]:undefined};if(_0x5c9ac6[_0xcb6c('0x76')]&&_0x5c9ac6['channelData'][_0xcb6c('0x79')]){return base64Decode(_0x5c9ac6['channelData'][_0xcb6c('0x79')][_0xcb6c('0x7a')],path[_0xcb6c('0x36')](__dirname,'tmp',rs[_0xcb6c('0x38')](0x4)+_0xcb6c('0x26')))[_0xcb6c('0x29')](function(_0x331afc){_0xb08400[_0xcb6c('0x7b')]=_0x331afc;return _0xb08400;});}return _0xb08400;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xfa03=['request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','end','protocol','https:','WHAT_EVER','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','text:synthesize','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','length','allRequiredParamsPresent','queryResult','diagnosticInfo','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','host','error'];(function(_0x1a577c,_0x4322e2){var _0x18049b=function(_0x9bf432){while(--_0x9bf432){_0x1a577c['push'](_0x1a577c['shift']());}};_0x18049b(++_0x4322e2);}(_0xfa03,0x6d));var _0x3fa0=function(_0x59f458,_0x1d1a29){_0x59f458=_0x59f458-0x0;var _0x2b849a=_0xfa03[_0x59f458];return _0x2b849a;};'use strict';var apiai=require(_0x3fa0('0x0'));var BPromise=require(_0x3fa0('0x1'));var dialogflow=require(_0x3fa0('0x2'));var fs=require('fs');var http=require(_0x3fa0('0x3'));var https=require(_0x3fa0('0x4'));var md5=require(_0x3fa0('0x5'));var path=require(_0x3fa0('0x6'));var querystring=require('querystring');var rp=require(_0x3fa0('0x7'));var rs=require(_0x3fa0('0x8'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x3fa0('0x9'))[_0x3fa0('0xa')];var util=require(_0x3fa0('0xb'));var aws=require(_0x3fa0('0xc'));var google=require(_0x3fa0('0xd'));var sestek=require(_0x3fa0('0xe'));var tilde=require(_0x3fa0('0xf'));var logger=require(_0x3fa0('0x10'))(_0x3fa0('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x507711,_0x3aba88){return new BPromise(function(_0x5f20c3,_0x32840a){var _0x46c728=urlParse(_0x507711);var _0x1d5929=_0x46c728['protocol']==='https:'?https:http;var _0x157c91={'host':_0x46c728[_0x3fa0('0x12')],'path':_0x46c728[_0x3fa0('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x1d5929['get'](_0x157c91,function(_0x59366f){if(_0x59366f['statusCode']!==0xc8){logger[_0x3fa0('0x13')](_0x3fa0('0x14')+_0x507711+_0x3fa0('0x15')+_0x59366f[_0x3fa0('0x16')]+'\x20('+_0x59366f[_0x3fa0('0x17')]+')');_0x32840a(new Error(_0x3fa0('0x14')+_0x507711+_0x3fa0('0x15')+_0x59366f['statusCode']+'\x20('+_0x59366f['statusMessage']+')'));return;}var _0x588a27=fs[_0x3fa0('0x18')](_0x3aba88);_0x588a27['on'](_0x3fa0('0x19'),function(){logger[_0x3fa0('0x1a')]('finish\x20download\x20file');_0x588a27[_0x3fa0('0x1b')](_0x5f20c3);});_0x588a27['on'](_0x3fa0('0x13'),function(_0x1d3ab5){fs[_0x3fa0('0x1c')](_0x3aba88);logger[_0x3fa0('0x13')](_0x3fa0('0x1d'),_0x1d3ab5);_0x32840a(_0x1d3ab5);});_0x59366f['pipe'](_0x588a27);})['on'](_0x3fa0('0x13'),function(_0xe88083){logger[_0x3fa0('0x13')](_0xe88083);_0x32840a(_0xe88083);})[_0x3fa0('0x1e')]();});}function uploadFile(_0x57efba){return new BPromise(function(_0x493d5b,_0x434d20){var _0x452503=urlParse(_0x57efba);var _0x6d37b0=_0x452503[_0x3fa0('0x1f')]===_0x3fa0('0x20')?https:http;var _0x19f93b={'host':_0x452503['host'],'path':_0x452503[_0x3fa0('0x6')],'headers':{'user-agent':_0x3fa0('0x21')}};_0x6d37b0['get'](_0x19f93b,function(_0x200410){if(_0x200410[_0x3fa0('0x16')]!==0xc8){_0x434d20(new Error(_0x3fa0('0x14')+_0x57efba+_0x3fa0('0x15')+_0x200410['statusCode']+'\x20('+_0x200410['statusMessage']+')'));return;}var _0x3f561f='';_0x200410['on'](_0x3fa0('0x22'),function(_0x5f4c45){_0x3f561f+=_0x5f4c45;});_0x200410['on']('end',function(){_0x493d5b(_0x3f561f);});})['on'](_0x3fa0('0x13'),function(_0x31d772){_0x434d20(_0x31d772);})[_0x3fa0('0x1e')]();});}function convertFile(_0x4536be,_0x9f895f){return new BPromise(function(_0x4baa09,_0x43d6e2){var _0x21ffde=sox[_0x3fa0('0x23')](_0x4536be,_0x9f895f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21ffde['on'](_0x3fa0('0x13'),function(_0x257f38){logger[_0x3fa0('0x13')](_0x3fa0('0x24'),_0x257f38);_0x43d6e2(_0x257f38);});_0x21ffde['on'](_0x3fa0('0x1e'),function(){logger[_0x3fa0('0x1a')](_0x3fa0('0x25'));_0x4baa09();});_0x21ffde[_0x3fa0('0x26')]();});}function base64Decode(_0x4e2bd2,_0x5b30f4){var _0x2299af=path[_0x3fa0('0x27')](__dirname,_0x3fa0('0x28'),rs[_0x3fa0('0x29')](0x4)+_0x3fa0('0x2a'));fs[_0x3fa0('0x2b')](_0x2299af,_0x4e2bd2,_0x3fa0('0x2c'));return convertFile(_0x2299af,_0x5b30f4)[_0x3fa0('0x2d')](function(){try{fs[_0x3fa0('0x1c')](_0x2299af);fs[_0x3fa0('0x2e')](_0x5b30f4,'777');}catch(_0x57b393){logger[_0x3fa0('0x13')](_0x57b393);}return _0x5b30f4[_0x3fa0('0x2f')]('.')[0x0];});}function base64Encode(_0x3222e8){var _0x3d989f=fs[_0x3fa0('0x30')](_0x3222e8);return new Buffer(_0x3d989f)['toString'](_0x3fa0('0x2c'));}exports[_0x3fa0('0x31')]=function(_0x1b87f4,_0x240bcf,_0x4d3366,_0xc1021c,_0x416ba0,_0x4be876){var _0x2ac12a,_0x581b27;var _0x496758=_0x3fa0('0x32');var _0x5e1aed=_0x3fa0('0x33')+_0x1b87f4;var _0x231a0d={};if(_0x240bcf==='ssml'){_0x231a0d[_0x3fa0('0x34')]={'ssml':_0x4d3366};}else{_0x231a0d['input']={'text':_0x4d3366};};_0x231a0d[_0x3fa0('0x35')]={'languageCode':_0xc1021c,'ssmlGender':_0x416ba0};_0x231a0d[_0x3fa0('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x32b858={'url':_0x496758+_0x3fa0('0x37')+_0x5e1aed,'method':'POST','json':!![],'body':_0x231a0d};return rp(_0x32b858)['then'](function(_0xdde602){return new BPromise(function(_0x49990c,_0x2f5b9e){_0x2ac12a=path['resolve'](__dirname,_0x3fa0('0x28'),rs['generate'](0x4)+_0x3fa0('0x38'));var _0x5cfc2b=Buffer[_0x3fa0('0x39')](_0xdde602[_0x3fa0('0x3a')],_0x3fa0('0x2c'));return fs[_0x3fa0('0x3b')](_0x2ac12a,_0x5cfc2b,function(_0x2c50e6){_0x2f5b9e(_0x2c50e6);},function(_0x147c37){fs[_0x3fa0('0x2e')](_0x2ac12a,'777');_0x49990c(_0x147c37);});});})[_0x3fa0('0x2d')](function(_0x2bea6f){_0x581b27=path['resolve'](__dirname,'tmp',rs[_0x3fa0('0x29')](0x4)+_0x3fa0('0x2a'));return convertFile(_0x2ac12a,_0x581b27);})['then'](function(){try{fs['unlink'](_0x2ac12a);fs['chmodSync'](_0x581b27,_0x3fa0('0x3c'));}catch(_0x1e8fc4){logger[_0x3fa0('0x13')](_0x1e8fc4);}logger['info'](_0x3fa0('0x3d'),_0x581b27['split']('.')[0x0]);return _0x581b27[_0x3fa0('0x2f')]('.')[0x0];});};exports[_0x3fa0('0x3e')]=function(_0x5d4529,_0xe3cf11){var _0x1e10f1,_0x2accf2;return tts(_0x5d4529,_0xe3cf11||'en',0x1)[_0x3fa0('0x2d')](function(_0x596a53){logger[_0x3fa0('0x1a')](_0x596a53);_0x1e10f1=path[_0x3fa0('0x27')](__dirname,_0x3fa0('0x28'),rs[_0x3fa0('0x29')](0x4)+_0x3fa0('0x38'));return downloadFile(_0x596a53,_0x1e10f1);})['then'](function(){_0x2accf2=path['resolve'](__dirname,_0x3fa0('0x28'),rs['generate'](0x4)+_0x3fa0('0x2a'));return convertFile(_0x1e10f1,_0x2accf2);})[_0x3fa0('0x2d')](function(){try{fs[_0x3fa0('0x1c')](_0x1e10f1);fs[_0x3fa0('0x2e')](_0x2accf2,_0x3fa0('0x3c'));}catch(_0x47b938){logger[_0x3fa0('0x13')](_0x47b938);}logger[_0x3fa0('0x1a')](_0x3fa0('0x3f'),_0x2accf2['split']('.')[0x0]);return _0x2accf2[_0x3fa0('0x2f')]('.')[0x0];});};exports[_0x3fa0('0x40')]=function(_0x3dbef6,_0x330470,_0x1c2492){return google['asr'](_0x3dbef6,_0x330470,_0x1c2492)[_0x3fa0('0x2d')](function(_0x54ad57){logger[_0x3fa0('0x1a')](_0x54ad57['uri']);return rp(_0x54ad57);})['then'](function(_0x271552){var _0x257776='';var _0x3f4aad=0x0;try{fs[_0x3fa0('0x1c')](_0x3dbef6);}catch(_0x28e8c9){logger['error'](_0x28e8c9);}if(_0x271552&&_0x271552[_0x3fa0('0x41')]){_0x257776=_0x271552[_0x3fa0('0x41')][_0x3fa0('0x42')](function(_0x2c185a){return _0x2c185a&&_0x2c185a[_0x3fa0('0x43')][0x0]&&_0x2c185a[_0x3fa0('0x43')][0x0][_0x3fa0('0x44')]?_0x2c185a[_0x3fa0('0x43')][0x0][_0x3fa0('0x44')]:'';})[_0x3fa0('0x45')]('\x0a');_0x3f4aad=_0x271552[_0x3fa0('0x41')][_0x3fa0('0x42')](function(_0x550a2f){return _0x550a2f&&_0x550a2f[_0x3fa0('0x43')][0x0]&&_0x550a2f['alternatives'][0x0][_0x3fa0('0x46')]?_0x550a2f['alternatives'][0x0][_0x3fa0('0x46')]:0x0;})[_0x3fa0('0x45')]('\x0a');}logger['info'](_0x3fa0('0x47'),_0x257776);logger[_0x3fa0('0x1a')]('googleASR\x20confidence',_0x3f4aad);return{'transcript':_0x257776,'confidence':_0x3f4aad};})[_0x3fa0('0x48')](function(_0x556d09){logger['error'](_0x3fa0('0x49'),_0x556d09[_0x3fa0('0x16')],_0x556d09[_0x3fa0('0x4a')],_0x556d09[_0x3fa0('0x4b')]);});};exports[_0x3fa0('0x4c')]=function(_0x54dcf4,_0x1cedfe,_0x288f72,_0x4882ad){var _0x5c1bdb=apiai(_0x1cedfe,{'language':_0x4882ad||'en'});return _0x5c1bdb[_0x3fa0('0x4d')](_0x288f72,{'sessionId':md5(_0x54dcf4)})[_0x3fa0('0x2d')](function(_0x23bc2a){logger[_0x3fa0('0x1a')](JSON[_0x3fa0('0x4e')](_0x23bc2a));return{'source':_0x23bc2a[_0x3fa0('0x4f')][_0x3fa0('0x50')],'resolvedQuery':_0x23bc2a[_0x3fa0('0x4f')][_0x3fa0('0x51')],'action':_0x23bc2a[_0x3fa0('0x4f')][_0x3fa0('0x52')],'actionIncomplete':_0x23bc2a['result'][_0x3fa0('0x53')],'speech':_0x23bc2a[_0x3fa0('0x4f')][_0x3fa0('0x54')][_0x3fa0('0x55')],'score':_0x23bc2a[_0x3fa0('0x4f')][_0x3fa0('0x56')],'statusCode':_0x23bc2a[_0x3fa0('0x57')][_0x3fa0('0x58')],'endConversation':_0x23bc2a[_0x3fa0('0x4f')][_0x3fa0('0x59')][_0x3fa0('0x5a')]||![],'isFallbackIntent':_0x23bc2a[_0x3fa0('0x4f')]['metadata'][_0x3fa0('0x5b')]};});};exports['googleDialogflowV2']=function(_0x39da32,_0x486cd8,_0x35a6f6,_0x42454a,_0x41517c,_0x59fb02){var _0x445b91=_0x42454a[_0x3fa0('0x5c')](/\\n/g,'\x0a');var _0x44ab9e={'credentials':{'private_key':_0x445b91,'client_email':_0x35a6f6}};var _0x1edbe9=new dialogflow[(_0x3fa0('0x5d'))](_0x44ab9e);var _0x5c8959=_0x1edbe9[_0x3fa0('0x5e')](_0x486cd8,md5(_0x39da32));var _0x560f37={'session':_0x5c8959,'queryInput':{'text':{'text':_0x41517c,'languageCode':_0x59fb02}}};return _0x1edbe9['detectIntent'](_0x560f37)[_0x3fa0('0x2d')](function(_0x5dbdc2){if(_0x5dbdc2&&_0x5dbdc2[_0x3fa0('0x5f')]){logger[_0x3fa0('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0x3fa0('0x4e')](_0x5dbdc2));var _0x2fb32a=_0x5dbdc2[0x0];if(_0x2fb32a){var _0xaccb9d={'action':_0x2fb32a['queryResult'][_0x3fa0('0x52')],'allRequiredParamsPresent':_0x2fb32a['queryResult'][_0x3fa0('0x60')],'endConversation':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x62')]&&_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x62')]['fields']?_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x62')]['fields']['end_conversation'][_0x3fa0('0x63')]:![],'fulfillmentText':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x64')],'intentName':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x65')][_0x3fa0('0x4a')],'intentDisplayName':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x65')][_0x3fa0('0x66')],'isFallbackIntent':_0x2fb32a['queryResult']['intent'][_0x3fa0('0x67')],'languageCode':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x68')],'queryText':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x69')],'responseId':_0x2fb32a[_0x3fa0('0x6a')],'score':_0x2fb32a['queryResult'][_0x3fa0('0x6b')],'speech':_0x2fb32a[_0x3fa0('0x61')][_0x3fa0('0x64')],'providerResponse':JSON[_0x3fa0('0x4e')](_0x5dbdc2)};return _0xaccb9d;}}});};exports[_0x3fa0('0x6c')]=function(_0x452111,_0x12fbe6,_0x414aa3,_0x1d9afd){return tilde[_0x3fa0('0x6d')](_0x452111,_0x12fbe6,_0x414aa3,_0x1d9afd)[_0x3fa0('0x2d')](function(_0x11a0d7){try{fs[_0x3fa0('0x1c')](_0x452111);}catch(_0x590a28){logger[_0x3fa0('0x13')](_0x590a28);}logger['info'](_0x3fa0('0x6e'),_0x11a0d7[_0x3fa0('0x44')]);logger[_0x3fa0('0x1a')](_0x3fa0('0x6f'),_0x11a0d7[_0x3fa0('0x46')]);return _0x11a0d7;});};exports[_0x3fa0('0x70')]=function(_0x3559ee,_0x5a4978,_0x53a350,_0xf75b63,_0x137fb9,_0x2e2422){var _0x39493e=path[_0x3fa0('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x3fa0('0x38'));var _0x394804;return aws['polly'](_0x3559ee,_0x5a4978,_0x53a350,_0xf75b63,_0x137fb9,_0x2e2422,_0x39493e)[_0x3fa0('0x2d')](function(){_0x394804=path['resolve'](__dirname,_0x3fa0('0x28'),rs[_0x3fa0('0x29')](0x4)+'.wav');return convertFile(_0x39493e,_0x394804);})[_0x3fa0('0x2d')](function(){try{fs['unlink'](_0x39493e);fs[_0x3fa0('0x2e')](_0x394804,'777');}catch(_0x141c47){logger[_0x3fa0('0x13')](_0x141c47);}return _0x394804[_0x3fa0('0x2f')]('.')[0x0];});};exports[_0x3fa0('0x71')]=function(_0x22c056,_0x152992,_0x5d04ce,_0x37d941,_0x110582,_0x20e5ee){return aws[_0x3fa0('0x72')](_0x22c056,_0x152992,_0x5d04ce,_0x37d941,_0x110582,_0x20e5ee)[_0x3fa0('0x2d')](function(_0x57a9e2){logger[_0x3fa0('0x1a')](JSON[_0x3fa0('0x4e')](_0x57a9e2));return _0x57a9e2;});};exports[_0x3fa0('0x73')]=function(_0xdaa40e,_0x5cf845,_0x4a739c,_0x1fb4c8){var _0x3ae9d9=util[_0x3fa0('0x74')](_0x3fa0('0x75'),ISPEECH_API,_0xdaa40e,encodeURIComponent(_0x5cf845),_0x4a739c,_0x1fb4c8);var _0x4c9c1f=path[_0x3fa0('0x27')](__dirname,_0x3fa0('0x28'),rs[_0x3fa0('0x29')](0x4)+_0x3fa0('0x38'));var _0x209b2b;return downloadFile(_0x3ae9d9,_0x4c9c1f)[_0x3fa0('0x2d')](function(){_0x209b2b=path[_0x3fa0('0x27')](__dirname,_0x3fa0('0x28'),rs[_0x3fa0('0x29')](0x4)+_0x3fa0('0x2a'));return convertFile(_0x4c9c1f,_0x209b2b);})[_0x3fa0('0x2d')](function(){try{fs[_0x3fa0('0x1c')](_0x4c9c1f);fs[_0x3fa0('0x2e')](_0x209b2b,_0x3fa0('0x3c'));}catch(_0x493816){logger[_0x3fa0('0x13')](_0x493816);}return _0x209b2b[_0x3fa0('0x2f')]('.')[0x0];});};exports[_0x3fa0('0x76')]=function(_0x15e7b7,_0x452583,_0x504cf8,_0x4d4b65){var _0x44bd25=util[_0x3fa0('0x74')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x452583,_0x504cf8,base64Encode(_0x15e7b7),_0x4d4b65?util[_0x3fa0('0x74')](_0x3fa0('0x77'),encodeURIComponent(_0x4d4b65)):_0x3fa0('0x78'));return uploadFile(_0x44bd25)[_0x3fa0('0x2d')](function(_0x150f24){return querystring['parse'](_0x150f24);});};exports[_0x3fa0('0x79')]=function(_0x1eb2bf,_0x279161){return sestek['nda'](_0x1eb2bf,_0x279161)['then'](function(_0x2bece2){logger[_0x3fa0('0x1a')](JSON['stringify'](_0x2bece2));var _0x572eec={'speech':_0x2bece2[_0x3fa0('0x7a')],'action':_0x2bece2[_0x3fa0('0x7b')]?_0x2bece2[_0x3fa0('0x7b')][_0x3fa0('0x7c')]:undefined,'actiondata':_0x2bece2[_0x3fa0('0x7b')]?_0x2bece2[_0x3fa0('0x7b')][_0x3fa0('0x7d')]:undefined};if(_0x2bece2[_0x3fa0('0x7b')]&&_0x2bece2[_0x3fa0('0x7b')]['AudioFromTts']){return base64Decode(_0x2bece2[_0x3fa0('0x7b')][_0x3fa0('0x7e')][_0x3fa0('0x7f')],path[_0x3fa0('0x27')](__dirname,'tmp',rs[_0x3fa0('0x29')](0x4)+_0x3fa0('0x2a')))[_0x3fa0('0x2d')](function(_0x206879){_0x572eec[_0x3fa0('0x80')]=_0x206879;return _0x572eec;});}return _0x572eec;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 9f844a8..4c42471 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 _0x03f3=['./nda'];(function(_0x209cc0,_0x59bb37){var _0x3c5029=function(_0x39c02f){while(--_0x39c02f){_0x209cc0['push'](_0x209cc0['shift']());}};_0x3c5029(++_0x59bb37);}(_0x03f3,0x1b1));var _0x303f=function(_0x24b88f,_0x22ea38){_0x24b88f=_0x24b88f-0x0;var _0x34a652=_0x03f3[_0x24b88f];return _0x34a652;};var nda=require(_0x303f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x14f7=['./nda','exports'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x14f7,0x102));var _0x714f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x14f7[_0x17d9e3];return _0x14192d;};var nda=require(_0x714f('0x0'));module[_0x714f('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 09d33df..1ff1d18 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 _0x6a5b=['info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData'];(function(_0x1f0016,_0x55780b){var _0x2b06a6=function(_0x2862ae){while(--_0x2862ae){_0x1f0016['push'](_0x1f0016['shift']());}};_0x2b06a6(++_0x55780b);}(_0x6a5b,0x101));var _0xb6a5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6a5b[_0x5b644e];return _0x49c6bf;};'use strict';var rp=require(_0xb6a5('0x0'));var url=require(_0xb6a5('0x1'));var logger=require(_0xb6a5('0x2'))(_0xb6a5('0x3'));module[_0xb6a5('0x4')]=function(_0x4aa7d9,_0xb274f8){var _0x40865e={'method':_0xb6a5('0x5'),'uri':url[_0xb6a5('0x6')](_0xb274f8[_0xb6a5('0x7')],_0xb6a5('0x8')),'form':{'grant_type':_0xb6a5('0x9'),'username':_0xb274f8[_0xb6a5('0xa')],'password':_0xb274f8[_0xb6a5('0x9')]},'json':!![]};return rp(_0x40865e)[_0xb6a5('0xb')](function(_0x2f40ed){var _0x548935={'method':_0xb6a5('0x5'),'uri':url[_0xb6a5('0x6')](_0xb274f8[_0xb6a5('0xc')],_0xb6a5('0xd')),'body':{'type':_0xb274f8[_0xb6a5('0xe')]||'message','channelId':_0xb6a5('0xf'),'conversation':{'id':_0x4aa7d9[_0xb6a5('0x10')]},'from':{'id':_0x4aa7d9[_0xb6a5('0x11')],'name':_0x4aa7d9[_0xb6a5('0x12')]},'recipient':{'id':_0x4aa7d9[_0xb6a5('0x13')],'name':_0x4aa7d9[_0xb6a5('0x14')]},'text':_0xb274f8['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2f40ed['access_token']},'json':!![]};if(_0xb274f8[_0xb6a5('0x15')]){_0x548935['body'][_0xb6a5('0x16')][_0xb6a5('0x17')]=_0xb274f8[_0xb6a5('0x15')];}if(_0xb274f8[_0xb6a5('0x18')]=='1'){_0x548935[_0xb6a5('0x19')][_0xb6a5('0x16')][_0xb6a5('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xb274f8[_0xb6a5('0x1b')]){_0x548935['body'][_0xb6a5('0x16')][_0xb6a5('0x1c')]=_0xb274f8['custom_action'];if(_0xb274f8[_0xb6a5('0x1d')]){_0x548935[_0xb6a5('0x19')][_0xb6a5('0x16')][_0xb6a5('0x1e')]=_0xb274f8[_0xb6a5('0x1d')];}}logger[_0xb6a5('0x1f')](JSON['stringify'](_0x548935));return rp(_0x548935);});}; \ No newline at end of file +var _0x925d=['callerid','calleridname','dnid','extension','text','access_token','project','channelData','ndagenerate_audio','body','AudioOutputSettings','custom_action','CustomAction','custom_action_data','request-promise','url','../../../../../config/logger','agi','POST','ndauth_url','/token','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x925d,0x187));var _0xd925=function(_0x70dba,_0x54d56b){_0x70dba=_0x70dba-0x0;var _0x52e909=_0x925d[_0x70dba];return _0x52e909;};'use strict';var rp=require(_0xd925('0x0'));var url=require(_0xd925('0x1'));var logger=require(_0xd925('0x2'))(_0xd925('0x3'));module['exports']=function(_0x277262,_0x55aebb){var _0xac64d2={'method':_0xd925('0x4'),'uri':url['resolve'](_0x55aebb[_0xd925('0x5')],_0xd925('0x6')),'form':{'grant_type':'password','username':_0x55aebb[_0xd925('0x7')],'password':_0x55aebb['password']},'json':!![]};return rp(_0xac64d2)[_0xd925('0x8')](function(_0x2193a5){var _0x84a27c={'method':_0xd925('0x4'),'uri':url[_0xd925('0x9')](_0x55aebb[_0xd925('0xa')],_0xd925('0xb')),'body':{'type':_0x55aebb[_0xd925('0xc')]||_0xd925('0xd'),'channelId':_0xd925('0xe'),'conversation':{'id':_0x277262['uniqueid']},'from':{'id':_0x277262[_0xd925('0xf')],'name':_0x277262[_0xd925('0x10')]},'recipient':{'id':_0x277262[_0xd925('0x11')],'name':_0x277262[_0xd925('0x12')]},'text':_0x55aebb[_0xd925('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2193a5[_0xd925('0x14')]},'json':!![]};if(_0x55aebb[_0xd925('0x15')]){_0x84a27c['body'][_0xd925('0x16')]['ProjectName']=_0x55aebb['project'];}if(_0x55aebb[_0xd925('0x17')]=='1'){_0x84a27c[_0xd925('0x18')][_0xd925('0x16')][_0xd925('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x55aebb[_0xd925('0x1a')]){_0x84a27c['body'][_0xd925('0x16')][_0xd925('0x1b')]=_0x55aebb[_0xd925('0x1a')];if(_0x55aebb[_0xd925('0x1c')]){_0x84a27c[_0xd925('0x18')][_0xd925('0x16')]['CustomActionData']=_0x55aebb[_0xd925('0x1c')];}}logger['info'](JSON['stringify'](_0x84a27c));return rp(_0x84a27c);});}; \ 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 e4694e1..4eb83ff 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 _0x591f=['./lib/api','exports'];(function(_0x15cfe1,_0x111570){var _0x6710bc=function(_0x249ea5){while(--_0x249ea5){_0x15cfe1['push'](_0x15cfe1['shift']());}};_0x6710bc(++_0x111570);}(_0x591f,0x1da));var _0xf591=function(_0xa3e0f7,_0x1b06db){_0xa3e0f7=_0xa3e0f7-0x0;var _0x4ce604=_0x591f[_0xa3e0f7];return _0x4ce604;};'use strict';var asr=require(_0xf591('0x0'));module[_0xf591('0x1')]=function(_0x39dc1d,_0x228418,_0x4da6cf,_0x17c81d){return asr(_0x39dc1d,_0x228418,_0x4da6cf,_0x17c81d);}; \ No newline at end of file +var _0x1093=['exports','./lib/api'];(function(_0x22bea2,_0x1bea94){var _0x475a99=function(_0x78f9f3){while(--_0x78f9f3){_0x22bea2['push'](_0x22bea2['shift']());}};_0x475a99(++_0x1bea94);}(_0x1093,0x179));var _0x3109=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x1093[_0x484e36];return _0xafc85d;};'use strict';var asr=require(_0x3109('0x0'));module[_0x3109('0x1')]=function(_0x50d3fb,_0x224032,_0xa7dd35,_0x4e2635){return asr(_0x50d3fb,_0x224032,_0xa7dd35,_0x4e2635);}; \ 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 fc9107f..fe99d5a 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 _0x1e34=['terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','likelihood','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0x14a384,_0x46c371){var _0x1d3191=function(_0xfe20ba){while(--_0xfe20ba){_0x14a384['push'](_0x14a384['shift']());}};_0x1d3191(++_0x46c371);}(_0x1e34,0x166));var _0x41e3=function(_0x42cdf5,_0x234e40){_0x42cdf5=_0x42cdf5-0x0;var _0x285f60=_0x1e34[_0x42cdf5];return _0x285f60;};'use strict';var BPromise=require(_0x41e3('0x0'));var _=require(_0x41e3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x41e3('0x2'));var crypto=require(_0x41e3('0x3'));var logger=require(_0x41e3('0x4'))('agi');module[_0x41e3('0x5')]=function(_0x969de,_0x158034,_0x3d7186,_0xeddadc){return new BPromise(function(_0x2e1f6a,_0xb7eb9c){logger[_0x41e3('0x6')]('Tilde\x20URI',_0xeddadc||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x28c50d=new WebSocket(_0xeddadc||_0x41e3('0x7'),{'perMessageDeflate':![]});var _0xeacac6='';var _0x57dfe4='0';var _0x2d016b='1';var _0x361902=_0x41e3('0x8');function _0x34cccb(_0x26509c){var _0x38d27a=crypto['createHash'](_0x41e3('0x9'));_0x38d27a[_0x41e3('0xa')](_0x26509c);return _0x38d27a[_0x41e3('0xb')](_0x41e3('0xc'));}function _0x1315ce(){try{logger[_0x41e3('0x6')](_0x41e3('0xd'));var _0x14f6d7=moment()[_0x41e3('0xe')]();var _0x3f6f75=_0x34cccb(_0x14f6d7+_0x158034+_0x3d7186);_0x28c50d[_0x41e3('0xf')](JSON['stringify']({'appID':_0x158034,'timestamp':_0x14f6d7,'appKey':_0x3f6f75}));var _0x1f2a99=fs[_0x41e3('0x10')](_0x969de);_0x1f2a99['on'](_0x41e3('0x11'),function(_0x3844b5){_0x28c50d[_0x41e3('0xf')](_0x3844b5);});_0x1f2a99['on'](_0x41e3('0x12'),function(){_0x28c50d[_0x41e3('0xf')]('EOS');});}catch(_0x25fdb9){logger[_0x41e3('0x13')](_0x41e3('0x14'),JSON['stringify'](_0x25fdb9));_0x28c50d['terminate']();}}function _0x2e5244(_0x35f1b2){try{if(_0x35f1b2){var _0x5f1c42=JSON['parse'](_0x35f1b2);switch(_0x5f1c42['status']){case 0x0:if(_0x5f1c42[_0x41e3('0x15')]){if(_0x5f1c42[_0x41e3('0x15')][_0x41e3('0x16')]){logger[_0x41e3('0x6')](_0x41e3('0x17'),JSON[_0x41e3('0x18')](_0x5f1c42['result'][_0x41e3('0x19')]));_0xeacac6=_0x5f1c42[_0x41e3('0x15')][_0x41e3('0x19')][0x0]['transcript'];_0x57dfe4=_0x5f1c42[_0x41e3('0x15')][_0x41e3('0x19')][0x0][_0x41e3('0x1a')];_0x2d016b='0';_0x361902=_0x41e3('0x1b');_0x28c50d['terminate']();}}break;case 0x1:logger[_0x41e3('0x6')](_0x41e3('0x8'));_0x2d016b='1';_0x361902=_0x41e3('0x8');break;case 0x2:logger[_0x41e3('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2d016b='2';_0x361902='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x41e3('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d016b='9';_0x361902=_0x41e3('0x1c');break;case 0xa:logger[_0x41e3('0x6')](_0x41e3('0x1d'));_0x2d016b='10';_0x361902='Authentication\x20failed.';break;case 0xb:logger[_0x41e3('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2d016b='11';_0x361902=_0x41e3('0x1e');}}}catch(_0x22ca09){logger[_0x41e3('0x13')](_0x41e3('0x1f'),JSON['stringify'](_0x22ca09));_0x28c50d[_0x41e3('0x20')]();}}function _0x2a59f7(){logger['info'](_0x41e3('0x21'));_0x2e1f6a({'transcript':_0xeacac6,'confidence':_0x57dfe4,'status':_0x2d016b,'status_message':_0x361902});}function _0x27914d(_0x54f43d){logger[_0x41e3('0x13')](_0x41e3('0x22'));if(!_[_0x41e3('0x23')](_0x54f43d)){logger[_0x41e3('0x13')](_[_0x41e3('0x24')](_0x54f43d)?JSON[_0x41e3('0x18')](_0x54f43d):_0x54f43d);}}_0x28c50d['on'](_0x41e3('0x25'),_0x1315ce);_0x28c50d['on'](_0x41e3('0x26'),_0x2e5244);_0x28c50d['on'](_0x41e3('0x12'),_0x2a59f7);_0x28c50d['on'](_0x41e3('0x13'),_0x27914d);});}; \ No newline at end of file +var _0xd849=['result','final','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status'];(function(_0x136dbb,_0x2b0666){var _0x6a5309=function(_0x2635af){while(--_0x2635af){_0x136dbb['push'](_0x136dbb['shift']());}};_0x6a5309(++_0x2b0666);}(_0xd849,0x1e3));var _0x9d84=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xd849[_0x2459fd];return _0x364cd2;};'use strict';var BPromise=require(_0x9d84('0x0'));var _=require(_0x9d84('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9d84('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module[_0x9d84('0x3')]=function(_0xc1c1cd,_0x1051d9,_0x635cce,_0xac29e4){return new BPromise(function(_0x3485ca,_0x2fd76a){logger[_0x9d84('0x4')](_0x9d84('0x5'),_0xac29e4||_0x9d84('0x6'));var _0x5d5c91=new WebSocket(_0xac29e4||_0x9d84('0x6'),{'perMessageDeflate':![]});var _0x4d46e2='';var _0x4c31c3='0';var _0x2e2836='1';var _0x369ef4=_0x9d84('0x7');function _0x38d671(_0xc33901){var _0x4c3dab=crypto['createHash'](_0x9d84('0x8'));_0x4c3dab[_0x9d84('0x9')](_0xc33901);return _0x4c3dab[_0x9d84('0xa')](_0x9d84('0xb'));}function _0x1059c7(){try{logger[_0x9d84('0x4')](_0x9d84('0xc'));var _0xe439aa=moment()[_0x9d84('0xd')]();var _0x35260b=_0x38d671(_0xe439aa+_0x1051d9+_0x635cce);_0x5d5c91[_0x9d84('0xe')](JSON['stringify']({'appID':_0x1051d9,'timestamp':_0xe439aa,'appKey':_0x35260b}));var _0x32b5a3=fs['createReadStream'](_0xc1c1cd);_0x32b5a3['on'](_0x9d84('0xf'),function(_0x211309){_0x5d5c91[_0x9d84('0xe')](_0x211309);});_0x32b5a3['on'](_0x9d84('0x10'),function(){_0x5d5c91[_0x9d84('0xe')](_0x9d84('0x11'));});}catch(_0x3a1d9f){logger[_0x9d84('0x12')](_0x9d84('0x13'),JSON[_0x9d84('0x14')](_0x3a1d9f));_0x5d5c91[_0x9d84('0x15')]();}}function _0x5cf238(_0x289f17){try{if(_0x289f17){var _0x499a09=JSON[_0x9d84('0x16')](_0x289f17);switch(_0x499a09[_0x9d84('0x17')]){case 0x0:if(_0x499a09[_0x9d84('0x18')]){if(_0x499a09[_0x9d84('0x18')][_0x9d84('0x19')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x499a09['result'][_0x9d84('0x1a')]));_0x4d46e2=_0x499a09[_0x9d84('0x18')][_0x9d84('0x1a')][0x0]['transcript'];_0x4c31c3=_0x499a09[_0x9d84('0x18')][_0x9d84('0x1a')][0x0][_0x9d84('0x1b')];_0x2e2836='0';_0x369ef4=_0x9d84('0x1c');_0x5d5c91[_0x9d84('0x15')]();}}break;case 0x1:logger[_0x9d84('0x4')](_0x9d84('0x7'));_0x2e2836='1';_0x369ef4=_0x9d84('0x7');break;case 0x2:logger[_0x9d84('0x4')](_0x9d84('0x1d'));_0x2e2836='2';_0x369ef4='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x9d84('0x4')](_0x9d84('0x1e'));_0x2e2836='9';_0x369ef4=_0x9d84('0x1e');break;case 0xa:logger['info']('Authentication\x20failed.');_0x2e2836='10';_0x369ef4=_0x9d84('0x1f');break;case 0xb:logger[_0x9d84('0x4')](_0x9d84('0x20'));_0x2e2836='11';_0x369ef4=_0x9d84('0x20');}}}catch(_0x34ccc3){logger[_0x9d84('0x12')](_0x9d84('0x21'),JSON['stringify'](_0x34ccc3));_0x5d5c91[_0x9d84('0x15')]();}}function _0xa9ad14(){logger[_0x9d84('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x3485ca({'transcript':_0x4d46e2,'confidence':_0x4c31c3,'status':_0x2e2836,'status_message':_0x369ef4});}function _0x33ad33(_0x4268c3){logger[_0x9d84('0x12')](_0x9d84('0x22'));if(!_[_0x9d84('0x23')](_0x4268c3)){logger[_0x9d84('0x12')](_[_0x9d84('0x24')](_0x4268c3)?JSON[_0x9d84('0x14')](_0x4268c3):_0x4268c3);}}_0x5d5c91['on'](_0x9d84('0x25'),_0x1059c7);_0x5d5c91['on'](_0x9d84('0x26'),_0x5cf238);_0x5d5c91['on'](_0x9d84('0x10'),_0xa9ad14);_0x5d5c91['on'](_0x9d84('0x12'),_0x33ad33);});}; \ 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 fd4aa6e..7a008a8 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 _0x1afa=['./asr','exports'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x1afa,0x70));var _0xa1af=function(_0x3d8f2c,_0x4807db){_0x3d8f2c=_0x3d8f2c-0x0;var _0x4cf46e=_0x1afa[_0x3d8f2c];return _0x4cf46e;};var asr=require(_0xa1af('0x0'));module[_0xa1af('0x1')]={'asr':asr}; \ No newline at end of file +var _0x079b=['exports','./asr'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0x079b,0x165));var _0xb079=function(_0x195686,_0xd329df){_0x195686=_0x195686-0x0;var _0xaf27a1=_0x079b[_0x195686];return _0xaf27a1;};var asr=require(_0xb079('0x0'));module[_0xb079('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 36eee35..e079747 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 _0x280f=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_CLOSE','inherits','exports','util','events','EventEmitter','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x1ea379,_0x489de8){var _0x107709=function(_0x286fc6){while(--_0x286fc6){_0x1ea379['push'](_0x1ea379['shift']());}};_0x107709(++_0x489de8);}(_0x280f,0xe2));var _0xf280=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x280f[_0x533528];return _0x3189f1;};'use strict';var util=require(_0xf280('0x0'));var net=require('net');var EventEmitter=require(_0xf280('0x1'))[_0xf280('0x2')];var AGIError=require(_0xf280('0x3'));var AGIChannel=require(_0xf280('0x4'));var AGIServer=function(_0x436dd1,_0x348341,_0xffc0f1){var _0x4fe5b5=this,_0x436dd1=_0x436dd1||0x11dd,_0x348341=_0x348341||_0xf280('0x5'),_0x23925d=null,_0x34eef7=0x0;EventEmitter['call'](_0x4fe5b5);function _0x3de766(){if(!_0x436dd1){_0x4fe5b5[_0xf280('0x6')](_0xf280('0x7'),new AGIError(_0xf280('0x8')));return![];}_0x23925d=net[_0xf280('0x9')]();_0x23925d[_0xf280('0xa')](_0x436dd1,_0x348341);_0x23925d['on']('listening',function(){_0x4fe5b5[_0xf280('0x6')](_0xf280('0xb'));});_0x23925d['on'](_0xf280('0xc'),function(_0x3e58af){_0x23925d[_0xf280('0xd')](function(_0x2e5414,_0x10ccbe){if(_0x2e5414){_0x4fe5b5[_0xf280('0x6')](_0xf280('0x7'),new AGIError(_0xf280('0xe'),_0x2e5414));}else if(_0xffc0f1&&_0xffc0f1<0x0){_0x4fe5b5[_0xf280('0x6')]('error',new AGIError(_0xf280('0xf')));_0x3e58af[_0xf280('0x10')]();}else if(_0xffc0f1&&_0xffc0f1>0x0&&_0xffc0f1<_0x10ccbe){_0x34eef7+=0x1;_0x4fe5b5[_0xf280('0x6')](_0xf280('0x7'),new AGIError(_0xf280('0x11'),_0x34eef7));_0x3e58af[_0xf280('0x10')]();}else{var _0x59fb22=new AGIChannel(_0x3e58af);_0x59fb22['on'](_0xf280('0x12'),function(){_0x4fe5b5[_0xf280('0x6')](_0xf280('0xc'),_0x59fb22);});}});});_0x23925d['on'](_0xf280('0x7'),function(_0x1e8f4d){_0x4fe5b5[_0xf280('0x6')](_0xf280('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x1e8f4d['code']));});_0x23925d['on']('close',function(){_0x4fe5b5[_0xf280('0x6')]('close',new AGIError(_0xf280('0x13')));});}process['nextTick'](function(){_0x3de766();});};util[_0xf280('0x14')](AGIServer,EventEmitter);module[_0xf280('0x15')]=function(_0x5328ae,_0x474140,_0x59b8af){return new AGIServer(_0x5328ae,_0x474140,_0x59b8af);}; \ No newline at end of file +var _0xe74e=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','listening'];(function(_0xf21ace,_0x6f020b){var _0x28e676=function(_0x5e2bf7){while(--_0x5e2bf7){_0xf21ace['push'](_0xf21ace['shift']());}};_0x28e676(++_0x6f020b);}(_0xe74e,0x10a));var _0xee74=function(_0x35a76f,_0x158af7){_0x35a76f=_0x35a76f-0x0;var _0x184f62=_0xe74e[_0x35a76f];return _0x184f62;};'use strict';var util=require('util');var net=require(_0xee74('0x0'));var EventEmitter=require(_0xee74('0x1'))[_0xee74('0x2')];var AGIError=require(_0xee74('0x3'));var AGIChannel=require(_0xee74('0x4'));var AGIServer=function(_0x38a0bd,_0x11d198,_0x175615){var _0xc652f2=this,_0x38a0bd=_0x38a0bd||0x11dd,_0x11d198=_0x11d198||_0xee74('0x5'),_0x483d0a=null,_0xbb9d43=0x0;EventEmitter['call'](_0xc652f2);function _0x58fa11(){if(!_0x38a0bd){_0xc652f2[_0xee74('0x6')](_0xee74('0x7'),new AGIError(_0xee74('0x8')));return![];}_0x483d0a=net['createServer']();_0x483d0a['listen'](_0x38a0bd,_0x11d198);_0x483d0a['on'](_0xee74('0x9'),function(){_0xc652f2[_0xee74('0x6')](_0xee74('0x9'));});_0x483d0a['on'](_0xee74('0xa'),function(_0x24128b){_0x483d0a[_0xee74('0xb')](function(_0x5b564d,_0x428062){if(_0x5b564d){_0xc652f2[_0xee74('0x6')](_0xee74('0x7'),new AGIError(_0xee74('0xc'),_0x5b564d));}else if(_0x175615&&_0x175615<0x0){_0xc652f2['emit'](_0xee74('0x7'),new AGIError(_0xee74('0xd')));_0x24128b[_0xee74('0xe')]();}else if(_0x175615&&_0x175615>0x0&&_0x175615<_0x428062){_0xbb9d43+=0x1;_0xc652f2[_0xee74('0x6')]('error',new AGIError(_0xee74('0xf'),_0xbb9d43));_0x24128b[_0xee74('0xe')]();}else{var _0x2dfe0f=new AGIChannel(_0x24128b);_0x2dfe0f['on'](_0xee74('0x10'),function(){_0xc652f2[_0xee74('0x6')](_0xee74('0xa'),_0x2dfe0f);});}});});_0x483d0a['on']('error',function(_0x18789e){_0xc652f2[_0xee74('0x6')](_0xee74('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x18789e[_0xee74('0x11')]));});_0x483d0a['on'](_0xee74('0x12'),function(){_0xc652f2['emit']('close',new AGIError(_0xee74('0x13')));});}process[_0xee74('0x14')](function(){_0x58fa11();});};util[_0xee74('0x15')](AGIServer,EventEmitter);module[_0xee74('0x16')]=function(_0x122c05,_0x47ace4,_0x15ccdd){return new AGIServer(_0x122c05,_0x47ace4,_0x15ccdd);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 410bc95..f8855bd 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 _0x95c3=['Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%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','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','service','host','port','secure','authentication','auth','pass','template_id','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','getSmsAccount','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','isEmpty','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','saveRestApiResult','%s.%s','length','setVariable','split','extra','replaceAllVariables','getAndSetVariable','result','isConfigured','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','wait','callback','list_id','delay','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','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','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','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','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','condition','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set'];(function(_0x5c4cae,_0x2028e8){var _0x432474=function(_0x5b7905){while(--_0x5b7905){_0x5c4cae['push'](_0x5c4cae['shift']());}};_0x432474(++_0x2028e8);}(_0x95c3,0x6d));var _0x395c=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x95c3[_0x11a55c];return _0x26c390;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x395c('0x0'));var sh=require(_0x395c('0x1'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x395c('0x2'));var Mustache=require(_0x395c('0x3'));var rp=require(_0x395c('0x4'));var logger=require(_0x395c('0x5'))(_0x395c('0x6'));var config=require('../../config/environment');var scripts=require(_0x395c('0x7'));var FILES_PATH=_0x395c('0x8');var recursiveMapAttributes=[_0x395c('0x9'),_0x395c('0xa')];var verticesWithRetry=[_0x395c('0xb'),_0x395c('0xc'),_0x395c('0xd')];var AGIVertices=function(_0x1de27c,_0x3a2e78,_0x2601c2){this[_0x395c('0xe')]=_0x1de27c;this[_0x395c('0xf')]=_0x3a2e78;this['mailRpc']=_0x2601c2;};AGIVertices[_0x395c('0x10')][_0x395c('0x11')]=function(_0x259a7f,_0x97f258){this['rpc'][_0x395c('0x12')](_0x259a7f)[_0x395c('0x13')](function(_0x586ada){_0x97f258(null,_0x586ada?_0x586ada[_0x395c('0x14')]:![]);})[_0x395c('0x15')](function(_0x2d5125){_0x97f258(_0x2d5125);});};AGIVertices[_0x395c('0x10')]['getVoiceQueue']=function(_0x37a440,_0x50a8f3){this['rpc']['getVoiceQueueById'](_0x37a440)[_0x395c('0x13')](function(_0x134bf5){_0x50a8f3(null,_0x134bf5?_0x134bf5[_0x395c('0x14')]:![]);})[_0x395c('0x15')](function(_0x2a60d6){_0x50a8f3(_0x2a60d6);});};AGIVertices[_0x395c('0x10')][_0x395c('0x16')]=function(_0x265c93,_0x2e63b0){this[_0x395c('0xf')][_0x395c('0x17')](_0x265c93)[_0x395c('0x13')](function(_0x55516b){_0x2e63b0(null,_0x55516b?_0x55516b['name']:![]);})[_0x395c('0x15')](function(_0x11c7d5){_0x2e63b0(_0x11c7d5);});};AGIVertices[_0x395c('0x10')][_0x395c('0x18')]=function(_0x5d4161,_0x49f029){this['rpc'][_0x395c('0x19')](_0x5d4161)[_0x395c('0x13')](function(_0x32d669){_0x49f029(null,_0x32d669?_0x32d669[_0x395c('0x1a')]:![]);})[_0x395c('0x15')](function(_0x1c2e7a){_0x49f029(_0x1c2e7a);});};AGIVertices[_0x395c('0x10')][_0x395c('0x1b')]=function(_0x169b11,_0x11b802){this[_0x395c('0xf')][_0x395c('0x1c')](_0x169b11)[_0x395c('0x13')](function(_0x3f4672){_0x11b802(null,_0x3f4672?_0x3f4672[_0x395c('0x14')]:![]);})['catch'](function(_0x404384){_0x11b802(_0x404384);});};AGIVertices[_0x395c('0x10')]['getTrunk']=function(_0x135d31,_0x3875df){this[_0x395c('0xf')]['getTrunkById'](_0x135d31)[_0x395c('0x13')](function(_0x38e8ba){_0x3875df(null,_0x38e8ba?_0x38e8ba[_0x395c('0x14')]:![]);})[_0x395c('0x15')](function(_0x72337){_0x3875df(_0x72337);});};AGIVertices['prototype'][_0x395c('0x1d')]=function(_0x5c460b,_0x2d4b54){var _0x328a2c=this;this[_0x395c('0xf')][_0x395c('0x1e')](_0x5c460b)[_0x395c('0x13')](function(_0x26343c){_0x2d4b54(null,_0x26343c?_0x328a2c[_0x395c('0x1f')](_0x26343c[_0x395c('0x20')]):![]);})[_0x395c('0x15')](function(_0x57fc61){_0x2d4b54(_0x57fc61);});};AGIVertices[_0x395c('0x10')][_0x395c('0x21')]=function(_0x500e15,_0x37d82f){this[_0x395c('0xf')][_0x395c('0x22')](_0x500e15)[_0x395c('0x13')](function(_0x3f6a1d){_0x37d82f(null,_0x3f6a1d?_0x3f6a1d:![]);})[_0x395c('0x15')](function(_0x5159ab){_0x37d82f(_0x5159ab);});};AGIVertices[_0x395c('0x10')]['sendMailMessage']=function(_0x23fad2,_0x4189b4,_0x121349){this['mailRpc']['sendMailMessage'](_0x23fad2,_0x4189b4)[_0x395c('0x13')](function(){_0x121349(null);})[_0x395c('0x15')](function(_0x52fe73){_0x121349(_0x52fe73);});};AGIVertices[_0x395c('0x10')][_0x395c('0x23')]=function(_0x37f813,_0x16d5b3){this[_0x395c('0xf')][_0x395c('0x24')](_0x37f813)[_0x395c('0x13')](function(_0x3b36b4){if(_0x3b36b4){if(_0x3b36b4[_0x395c('0x25')]){_0x16d5b3(null,[_0x3b36b4[_0x395c('0x26')]]);}else{_0x16d5b3(null,_[_0x395c('0x27')](_0x3b36b4[_0x395c('0x28')],_0x395c('0x26')));}}else{_0x16d5b3(null,![]);}})[_0x395c('0x15')](function(_0x58a347){_0x16d5b3(_0x58a347);});};AGIVertices['prototype'][_0x395c('0x1f')]=function(_0x2fa4da){return util[_0x395c('0x29')](_0x395c('0x2a'),FILES_PATH,_0x2fa4da);};AGIVertices[_0x395c('0x10')][_0x395c('0x2b')]=function(_0x26f458,_0x54f32e,_0x39b80c){odbc[_0x395c('0x2c')](_0x26f458,function(_0x250af6){if(_0x250af6){logger['error'](_0x395c('0x2d'),_0x250af6);_0x39b80c(_0x250af6);}else{logger[_0x395c('0x2e')](_0x395c('0x2f'));odbc['query'](_0x54f32e,function(_0x56f459,_0x1a9016){if(_0x56f459){logger['info'](_0x395c('0x30'),_0x54f32e);_0x39b80c(_0x56f459);}else{logger[_0x395c('0x2e')](_0x395c('0x31'),_0x54f32e);odbc['close'](function(_0x5f1c95){if(_0x5f1c95){logger[_0x395c('0x32')](_0x395c('0x33'),_0x5f1c95);}_0x39b80c(null,_0x1a9016);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x1028d5,_0x3eda71){this[_0x395c('0xf')][_0x395c('0x34')](_0x1028d5)[_0x395c('0x13')](function(_0x85652c){_0x3eda71(null,_0x85652c?_0x85652c:![]);})['catch'](function(_0x53cc95){_0x3eda71(_0x53cc95);});};AGIVertices[_0x395c('0x10')][_0x395c('0x35')]=function(_0x62474d,_0x4a88c6){this[_0x395c('0xf')]['createSmsMessage'](_0x62474d)[_0x395c('0x13')](function(_0x32ee21){_0x4a88c6(null,_0x32ee21);})['catch'](function(_0x30f3ca){_0x4a88c6(_0x30f3ca);});};AGIVertices[_0x395c('0x10')][_0x395c('0x36')]=function(_0x3d5283,_0x223036,_0x8474af){this[_0x395c('0xf')][_0x395c('0x36')]({'uniqueid':this[_0x395c('0xe')][_0x395c('0x37')],'node':_0x3d5283[_0x395c('0x38')],'application':_0x3d5283['agicommand'],'data':_0x223036||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x395c('0x39')]})[_0x395c('0x13')](function(_0x3f16aa){if(_0x8474af){_0x8474af(null,_0x3f16aa);}})[_0x395c('0x15')](function(_0x1a0cec){if(_0x8474af){_0x8474af(_0x1a0cec);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x412165,_0x4a9722,_0x36239e,_0xe2427c){this[_0x395c('0xf')][_0x395c('0x3a')]({'uniqueid':this[_0x395c('0xe')][_0x395c('0x37')],'callerid':this[_0x395c('0xe')][_0x395c('0x39')],'calleridname':this[_0x395c('0xe')]['calleridname'],'context':this[_0x395c('0xe')][_0x395c('0x3b')],'extension':this[_0x395c('0xe')][_0x395c('0x3c')],'priority':this[_0x395c('0xe')][_0x395c('0x3d')],'accountcode':this['channel'][_0x395c('0x3e')],'dnid':this['channel'][_0x395c('0x3f')],'projectName':this['channel']['arg_1'],'saveName':_0x4a9722,'filename':_0x412165[_0x395c('0x40')]||_0x4a9722,'savePath':_0x36239e})[_0x395c('0x13')](function(_0x432cb4){_0xe2427c(null,_0x432cb4);})[_0x395c('0x15')](function(_0x3c7410){_0xe2427c(_0x3c7410);});};AGIVertices[_0x395c('0x10')][_0x395c('0x41')]=function(_0x31ae9a,_0x1c6520,_0x4a053f,_0x487d41,_0x586014){this[_0x395c('0xf')][_0x395c('0x41')]({'uniqueid':this[_0x395c('0xe')]['uniqueid'],'body':_0x31ae9a,'direction':_0x1c6520,'providerName':_0x4a053f,'providerResponse':_0x487d41})[_0x395c('0x13')](function(_0x3710ed){if(_0x586014){_0x586014(null,_0x3710ed);}})[_0x395c('0x15')](function(_0x58c307){if(_0x586014){_0x586014(_0x58c307);}});};AGIVertices[_0x395c('0x10')]['createCmContact']=function(_0x3398df,_0x47735e){this[_0x395c('0xf')][_0x395c('0x42')]({'firstName':_['isEmpty'](_0x3398df[_0x395c('0x14')])||_[_0x395c('0x43')](_0x3398df['name'])?'callback_'+Math['random']():_0x3398df['name'],'lastName':_[_0x395c('0x44')](_0x3398df[_0x395c('0x45')])||_['isNil'](_0x3398df['lastName'])?null:_0x3398df['lastName'],'phone':_0x3398df[_0x395c('0x46')],'ListId':_0x3398df['list_id'],'scheduledat':_0x3398df[_0x395c('0x47')],'callbackUniqueid':this[_0x395c('0xe')][_0x395c('0x37')],'tags':'callback','description':_0x395c('0x48')+_0x3398df[_0x395c('0x47')][_0x395c('0x49')](),'priority':_0x3398df['callback_priority']})['then'](function(_0x237ff3){_0x47735e(null,_0x237ff3);})['catch'](function(_0x5dde80){_0x47735e(_0x5dde80);});};AGIVertices['prototype'][_0x395c('0x4a')]=function(_0xbaa932,_0x8990a6){this[_0x395c('0xf')][_0x395c('0x4b')](_0xbaa932)[_0x395c('0x13')](function(_0x4a319e){_0x8990a6(null,_0x4a319e?_0x4a319e[_0x395c('0x14')]:![]);})[_0x395c('0x15')](function(_0x59d63f){_0x8990a6(_0x59d63f);});};AGIVertices[_0x395c('0x10')][_0x395c('0x4c')]=function(_0xc6a834,_0x7f2e6e,_0x240f99){var _0x4ff176={'role':'agent'};_0x4ff176[_0xc6a834]=this[_0x395c('0xe')][_0x395c('0x39')];this[_0x395c('0xf')]['agentPause'](_0x4ff176,_0x7f2e6e,this[_0x395c('0xe')][_0x395c('0x37')])['then'](function(_0x1cee20){_0x240f99(null,_['isNil'](_0x1cee20)?![]:!![]);})[_0x395c('0x15')](function(_0x3032f5){logger[_0x395c('0x32')](_0x3032f5);_0x240f99(null,![]);});};AGIVertices[_0x395c('0x10')][_0x395c('0x4d')]=function(_0x156ace,_0x1730cf){var _0x589803={'role':'agent'};_0x589803[_0x156ace]=this['channel'][_0x395c('0x39')];this[_0x395c('0xf')][_0x395c('0x4d')](_0x589803)['then'](function(_0x2ac1a9){_0x1730cf(null,_[_0x395c('0x43')](_0x2ac1a9)?![]:!![]);})[_0x395c('0x15')](function(_0x46beee){logger['error'](_0x46beee);_0x1730cf(null,![]);});};AGIVertices[_0x395c('0x10')][_0x395c('0x4e')]=function(_0x59d893,_0x86a3f3){var _0x112b39={'role':_0x395c('0x4f')};_0x112b39[_0x59d893]=this[_0x395c('0xe')][_0x395c('0x39')];this[_0x395c('0xf')][_0x395c('0x4e')](_0x112b39)[_0x395c('0x13')](function(_0x27c7e5){_0x86a3f3(null,_[_0x395c('0x43')](_0x27c7e5)?![]:!![]);})[_0x395c('0x15')](function(_0x227331){logger[_0x395c('0x32')](_0x227331);_0x86a3f3(null,![]);});};AGIVertices[_0x395c('0x10')][_0x395c('0x50')]=function(_0x34f5b3,_0x34bd2f){var _0x550f41={'role':_0x395c('0x4f')};_0x550f41[_0x34f5b3]=this[_0x395c('0xe')]['callerid'];var _0x25d338=_0x34f5b3!=_0x395c('0x51')?util[_0x395c('0x29')](_0x395c('0x52'),'LOCAL',this['channel'][_0x395c('0x39')]):undefined;this[_0x395c('0xf')]['agentLogin'](_0x550f41,_0x25d338)[_0x395c('0x13')](function(_0x1cc382){_0x34bd2f(null,_[_0x395c('0x43')](_0x1cc382)?![]:!![]);})[_0x395c('0x15')](function(_0xd5d955){logger[_0x395c('0x32')](_0xd5d955);_0x34bd2f(null,![]);});};AGIVertices[_0x395c('0x10')]['shellCommand']=function(_0x2cbd3c,_0x531f3a){sh[_0x395c('0x53')](_[_0x395c('0x54')](_0x2cbd3c),function(_0x49f226,_0x245104){var _0x9e5ca1=_0x245104[_0x395c('0x55')](/(\r\n|\n|\r)/gm,'');_0x531f3a(null,_0x9e5ca1);});};AGIVertices[_0x395c('0x10')][_0x395c('0x56')]=function(_0x435bd1,_0x455c61){scripts[_0x395c('0x56')](_0x435bd1[_0x395c('0x57')],_0x435bd1['google_cloud_tts_text_type']||_0x395c('0x58'),_0x435bd1['text'],_0x435bd1[_0x395c('0x59')]||_0x395c('0x5a'),_0x435bd1[_0x395c('0x5b')]||_0x395c('0x5c'),_0x435bd1[_0x395c('0x5d')]||_0x395c('0x5e'))[_0x395c('0x13')](function(_0x3ef018){_0x455c61(null,_0x3ef018);})[_0x395c('0x15')](function(_0xe4c769){_0x455c61(_0xe4c769);});};AGIVertices['prototype'][_0x395c('0x5f')]=function(_0x2393ab,_0x15200c){scripts[_0x395c('0x5f')](_0x2393ab[_0x395c('0x58')],_0x2393ab[_0x395c('0x60')]||'en',0x1)[_0x395c('0x13')](function(_0x2c760a){_0x15200c(null,_0x2c760a);})[_0x395c('0x15')](function(_0x22ebac){_0x15200c(_0x22ebac);});};AGIVertices[_0x395c('0x10')][_0x395c('0x61')]=function(_0x311d1e,_0x2f7717){var _0x3ae771={'uri':_0x311d1e[_0x395c('0x62')],'method':_0x311d1e[_0x395c('0x63')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x311d1e[_0x395c('0x64')])===_0x395c('0x65')&&parseInt(_0x311d1e['timeout'])>=0x1?parseInt(_0x311d1e[_0x395c('0x64')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x395c('0x66')],_0x3ae771[_0x395c('0x63')][_0x395c('0x67')]())){try{_0x3ae771[_0x395c('0x68')]=_0x311d1e[_0x395c('0xa')]?JSON[_0x395c('0x69')](_0x311d1e[_0x395c('0xa')]):{};}catch(_0x16cfd9){logger[_0x395c('0x32')](_0x395c('0x6a'),_0x16cfd9);}}try{_0x3ae771[_0x395c('0x6b')]=_0x311d1e[_0x395c('0x9')]?JSON[_0x395c('0x69')](_0x311d1e['rawHeaders']):{};}catch(_0x3ef0c4){logger[_0x395c('0x32')](_0x395c('0x6c'),_0x3ef0c4);}if(_0x311d1e[_0x395c('0x6d')]){try{var _0xcd4a32=require(_0x311d1e[_0x395c('0x6d')])[_0x395c('0x6e')](this,_0x3ae771);_0x3ae771[_0x395c('0x6f')]=Mustache[_0x395c('0x70')](_0x311d1e['url'],_0xcd4a32,{},['$$','$$']);if(_0x3ae771[_0x395c('0x6b')]){_0x3ae771[_0x395c('0x6b')]=JSON[_0x395c('0x69')](Mustache[_0x395c('0x70')](JSON[_0x395c('0x71')](_0x3ae771[_0x395c('0x6b')]),_0xcd4a32,{},['$$','$$']));}if(_0x3ae771[_0x395c('0x68')]){_0x3ae771[_0x395c('0x68')]=JSON['parse'](Mustache[_0x395c('0x70')](JSON[_0x395c('0x71')](_0x3ae771['body']),_0xcd4a32,{},['$$','$$']));}}catch(_0x298faf){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x298faf);}}rp(_0x3ae771)['then'](function(_0x16c4c8){var _0x511a3c={'statusCode':_0x16c4c8[_0x395c('0x72')]||0xc8,'statusMessage':_0x16c4c8[_0x395c('0x73')]||'OK','headers':_0x16c4c8[_0x395c('0x6b')]||{},'body':_0x16c4c8['body']||{}};_0x2f7717(null,_0x511a3c);})[_0x395c('0x15')](function(_0x40aa61){var _0x1bc557={'statusCode':_0x40aa61[_0x395c('0x72')]||0x1f4,'statusMessage':_0x40aa61['message']||_0x395c('0x74'),'headers':_0x40aa61['options']['headers']||{},'body':_0x40aa61[_0x395c('0x75')]['body']||{}};_0x2f7717(null,_0x1bc557);});};AGIVertices[_0x395c('0x10')][_0x395c('0x76')]=function(_0x2e9031,_0x1d43cd){scripts[_0x395c('0x76')](this['channel'][_0x395c('0x37')],_0x2e9031[_0x395c('0x77')],_0x2e9031[_0x395c('0x58')],_0x2e9031['dialogflow_language']||'en')[_0x395c('0x13')](function(_0x11885a){_0x1d43cd(null,_0x11885a);})['catch'](function(_0x315f74){_0x1d43cd(_0x315f74);});};AGIVertices['prototype'][_0x395c('0x78')]=function(_0x19f117,_0x111a40){scripts[_0x395c('0x78')](this['channel']['uniqueid'],_0x19f117[_0x395c('0x79')],_0x19f117[_0x395c('0x7a')],_0x19f117[_0x395c('0x7b')],_0x19f117[_0x395c('0x58')],_0x19f117[_0x395c('0x7c')]||'en')[_0x395c('0x13')](function(_0x20c968){_0x111a40(null,_0x20c968);})[_0x395c('0x15')](function(_0xbc44be){_0x111a40(_0xbc44be);});};AGIVertices[_0x395c('0x10')][_0x395c('0x7d')]=function(_0x10d1f8,_0x3b529b){scripts[_0x395c('0x7d')](this[_0x395c('0xe')],_0x10d1f8)['then'](function(_0x2aec6d){_0x3b529b(null,_0x2aec6d);})[_0x395c('0x15')](function(_0x3277e0){_0x3b529b(_0x3277e0);});};AGIVertices[_0x395c('0x10')]['ispeechTTS']=function(_0x309438,_0xe8d66c){scripts[_0x395c('0x7e')](_0x309438['key'],_0x309438['text'],_0x309438[_0x395c('0x7f')]||_0x395c('0x5a'),_0x309438['speed'])[_0x395c('0x13')](function(_0x51499e){_0xe8d66c(null,_0x51499e);})[_0x395c('0x15')](function(_0x187c8c){_0xe8d66c(_0x187c8c);});};AGIVertices['prototype'][_0x395c('0x80')]=function(_0x482ee7,_0x82deed,_0x509b94){scripts[_0x395c('0x80')](_0x82deed,_0x482ee7[_0x395c('0x77')],_0x482ee7[_0x395c('0x81')]||'en-US',this['isConfigured'](_0x482ee7[_0x395c('0x82')])?_0x482ee7[_0x395c('0x82')]:undefined)['then'](function(_0xb0cb01){_0x509b94(null,_0xb0cb01);})[_0x395c('0x15')](function(_0x4ad685){_0x509b94(_0x4ad685);});};AGIVertices['prototype'][_0x395c('0x83')]=function(_0x4082b2,_0x3dd57b){scripts[_0x395c('0x83')](_0x4082b2[_0x395c('0x84')],_0x4082b2[_0x395c('0x85')],_0x4082b2[_0x395c('0x86')],_0x4082b2[_0x395c('0x87')]||_0x395c('0x88'),_0x4082b2['text'],_0x4082b2[_0x395c('0x89')]||_0x395c('0x58'))['then'](function(_0x3e4ca7){_0x3dd57b(null,_0x3e4ca7);})[_0x395c('0x15')](function(_0x3a016c){_0x3dd57b(_0x3a016c);});};AGIVertices[_0x395c('0x10')][_0x395c('0x8a')]=function(_0x629606,_0x78fdaf){scripts['awsLex'](this[_0x395c('0xe')]['uniqueid'],_0x629606['aws_access_key_id'],_0x629606[_0x395c('0x85')],_0x629606[_0x395c('0x8b')],_0x629606[_0x395c('0x58')],_0x629606[_0x395c('0x8c')])[_0x395c('0x13')](function(_0x4c153e){_0x78fdaf(null,_0x4c153e);})[_0x395c('0x15')](function(_0x145a7e){_0x78fdaf(_0x145a7e);});};AGIVertices[_0x395c('0x10')][_0x395c('0x8d')]=function(_0x485e96,_0x4a4779,_0x4cc95e){scripts['googleASR'](_0x4a4779,_0x485e96[_0x395c('0x77')],_0x485e96[_0x395c('0x8e')]||'en-US')[_0x395c('0x13')](function(_0x76aada){_0x4cc95e(null,_0x76aada);})[_0x395c('0x15')](function(_0x199e43){_0x4cc95e(_0x199e43);});};AGIVertices[_0x395c('0x10')][_0x395c('0x8f')]=function(_0x586418,_0x3c0b6d,_0x56bd84){scripts['tildeASR'](_0x3c0b6d,_0x586418[_0x395c('0x90')],_0x586418[_0x395c('0x91')],_0x586418['uri'])['then'](function(_0x213dbd){_0x56bd84(null,_0x213dbd);})[_0x395c('0x15')](function(_0x4e7d57){_0x56bd84(_0x4e7d57);});};AGIVertices[_0x395c('0x10')][_0x395c('0x92')]=function(_0x28098f){var _0x4ba4b8=_[_0x395c('0x93')](verticesWithRetry,_0x28098f[_0x395c('0x94')])?_0x28098f:_[_0x395c('0x95')](_0x28098f);for(var _0x3b7b2a in _0x4ba4b8){if(_0x4ba4b8[_0x395c('0x96')](_0x3b7b2a)){if(_0x4ba4b8[_0x3b7b2a]&&_[_0x395c('0x97')](_0x4ba4b8[_0x3b7b2a])){if(_['includes'](recursiveMapAttributes,_0x3b7b2a)){_0x4ba4b8[_0x3b7b2a]=this[_0x395c('0x98')](_0x4ba4b8[_0x3b7b2a]);}else{_0x4ba4b8[_0x3b7b2a]=this['replaceAllVariables'](_0x4ba4b8[_0x3b7b2a]);}}}}return _0x4ba4b8;};AGIVertices[_0x395c('0x10')]['recursiveNodeIndex']=function(_0x29e321){for(var _0x2832f6 in _0x29e321){if(_0x29e321[_0x395c('0x96')](_0x2832f6)){if(_[_0x395c('0x99')](_0x29e321[_0x2832f6])){this[_0x395c('0x9a')](_0x29e321[_0x2832f6]);}else if(_['isArray'](_0x29e321[_0x2832f6])){for(var _0x1616e3=0x0;_0x1616e3<_0x29e321[_0x2832f6]['length'];_0x1616e3++){this['recursiveNodeIndex'](_0x29e321[_0x2832f6][_0x1616e3]);}}else if(_[_0x395c('0x97')](_0x29e321[_0x2832f6])){_0x29e321[_0x2832f6]=this['replaceAllVariables'](_0x29e321[_0x2832f6]);}}}};AGIVertices[_0x395c('0x10')][_0x395c('0x9b')]=function(_0x176c17,_0x306702){for(var _0x162cdc in _0x176c17){if(_0x176c17[_0x395c('0x96')](_0x162cdc)){if(_['isPlainObject'](_0x176c17[_0x162cdc])){if(!_[_0x395c('0x44')](_0x176c17[_0x162cdc])){this[_0x395c('0x9b')](_0x176c17[_0x162cdc],util['format'](_0x395c('0x9c'),_0x306702,_0x162cdc));}}else if(_['isArray'](_0x176c17[_0x162cdc])){for(var _0x5bf5db=0x0;_0x5bf5db<_0x176c17[_0x162cdc][_0x395c('0x9d')];_0x5bf5db++){this[_0x395c('0x9b')](_0x176c17[_0x162cdc][_0x5bf5db],util[_0x395c('0x29')]('%s.%s',_0x306702,_0x162cdc+'['+_0x5bf5db+']'));}}else{if(!_['isNil'](_0x176c17[_0x162cdc])){this[_0x395c('0xe')][_0x395c('0x9e')](util['format'](_0x395c('0x9c'),_0x306702,_0x162cdc),_0x176c17[_0x162cdc]);}}}}};AGIVertices[_0x395c('0x10')]['replaceObjectAllVariables']=function(_0x252bc8){try{var _0x355568=JSON[_0x395c('0x69')](_0x252bc8);this[_0x395c('0x9a')](_0x355568);return JSON['stringify'](_0x355568);}catch(_0x488299){return this['replaceAllVariables'](_0x252bc8);}};AGIVertices[_0x395c('0x10')]['replaceAllVariables']=function(_0x27d594){var _0x3ecc00=_0x27d594[_0x395c('0x9f')]('{');for(var _0x3a474e=0x1;_0x3a474e<_0x3ecc00[_0x395c('0x9d')];_0x3a474e+=0x1){var _0x382eb9=_0x3ecc00[_0x3a474e]['split']('}');if(_0x382eb9['length']>0x1){_0x27d594=_0x27d594['replaceAll']('{'+_0x382eb9[0x0]+'}',this[_0x395c('0xe')][_0x395c('0x11')](_0x382eb9[0x0])[_0x395c('0xa0')]||_0x382eb9[0x0]);}}if(_0x3ecc00['length']===0x1){return _0x27d594[_0x395c('0x49')]();}return this[_0x395c('0xa1')](_0x27d594);};AGIVertices[_0x395c('0x10')][_0x395c('0xa2')]=function(_0xbc3bb8,_0xa90e3){var _0x1accaa=this['channel'][_0x395c('0x11')](_0xbc3bb8);if(_0x1accaa[_0x395c('0xa3')]===-0x1){return _0x1accaa;}logger[_0x395c('0x2e')](util[_0x395c('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xa90e3,_0x1accaa[_0x395c('0xa0')]));return this[_0x395c('0xe')][_0x395c('0x9e')](_0xa90e3,_0x1accaa[_0x395c('0xa0')]);};AGIVertices[_0x395c('0x10')][_0x395c('0xa4')]=function(_0x19fe31){return _0x19fe31&&_0x19fe31!=='0'&&_0x19fe31!=='-1'&&_0x19fe31!=='';};AGIVertices[_0x395c('0x10')][_0x395c('0xa5')]=function(_0x35a186){this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x35a186,'-');_0x35a186['retry']=_0x35a186['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x395c('0x10')][_0x395c('0xa6')]=function(_0x15b3d3){logger['info'](util[_0x395c('0x29')](_0x395c('0xa7'),_0x15b3d3[_0x395c('0x38')]));if(!this['isConfigured'](_0x15b3d3[_0x395c('0x58')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xa9'));}var _0x264ab1='\x22'+_0x15b3d3['text']+'\x22';if(this[_0x395c('0xa4')](_0x15b3d3[_0x395c('0x75')])){_0x264ab1+=','+_0x15b3d3['options'];}var _0x37ed75=this[_0x395c('0xe')][_0x395c('0x53')]('MRCPSynth',_0x264ab1);if(_0x37ed75[_0x395c('0xa3')]===-0x1){return _0x37ed75;}return this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0xaa'),_0x264ab1));};AGIVertices[_0x395c('0x10')][_0x395c('0xab')]=function(_0x1c5451){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1c5451[_0x395c('0x38')]));if(!this['isConfigured'](_0x1c5451[_0x395c('0xac')])){return this[_0x395c('0xe')]['noop'](_0x395c('0xad'));}var _0x417ec6=_0x1c5451[_0x395c('0xac')];if(this[_0x395c('0xa4')](_0x1c5451[_0x395c('0x75')])){_0x417ec6+=','+_0x1c5451[_0x395c('0x75')];}var _0x468ffa=this[_0x395c('0xe')]['exec'](_0x395c('0xae'),_0x417ec6);if(_0x468ffa[_0x395c('0xa3')]===-0x1){return _0x468ffa;}var _0x6af99e=this[_0x395c('0xa2')](_0x395c('0xaf'),_0x395c('0xb0'));if(_0x6af99e[_0x395c('0xa3')]===-0x1){return _0x6af99e;}var _0x329188=this[_0x395c('0xa2')](_0x395c('0xb1'),_0x395c('0xb2'));if(_0x329188[_0x395c('0xa3')]===-0x1){return _0x329188;}var _0x367ee2=this[_0x395c('0xa2')](_0x395c('0xb3'),_0x395c('0xb4'));if(_0x367ee2[_0x395c('0xa3')]===-0x1){return _0x367ee2;}return this[_0x395c('0xe')][_0x395c('0xa8')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x417ec6));};AGIVertices[_0x395c('0x10')][_0x395c('0x6')]=function(_0x3ab7c5){logger[_0x395c('0x2e')](util['format'](_0x395c('0xb5'),_0x3ab7c5['label']));return this[_0x395c('0xe')]['agi']([_0x3ab7c5[_0x395c('0xb6')],_0x3ab7c5[_0x395c('0xb7')]]);};AGIVertices[_0x395c('0x10')]['answer']=function(_0x29123d){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x29123d[_0x395c('0x38')]));if(this['isConfigured'](_0x29123d['timeout'])){logger['info'](util[_0x395c('0x29')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x29123d['timeout']));var _0x4114d0=this[_0x395c('0xe')][_0x395c('0xb8')](_0x29123d['timeout']);if(_0x4114d0[_0x395c('0xa3')]===-0x1){return _0x4114d0;}}return this['channel']['answer']();};AGIVertices[_0x395c('0x10')][_0x395c('0xb9')]=function(_0x5b3158){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5b3158[_0x395c('0x38')]));if(!this['isConfigured'](_0x5b3158[_0x395c('0xba')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x5b3158,'no\x20list\x20selected');}_0x5b3158[_0x395c('0x47')]=moment();if(this[_0x395c('0xa4')](_0x5b3158[_0x395c('0xbb')])){_0x5b3158[_0x395c('0x47')]=moment()['add'](_0x5b3158['delay'],'minutes');}if(!this[_0x395c('0xa4')](_0x5b3158[_0x395c('0xbc')])){_0x5b3158[_0x395c('0xbc')]=0x2;}this[_0x395c('0x42')][_0x395c('0x6e')](this,_0x5b3158);return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xbd'),_0x5b3158[_0x395c('0x46')],_0x5b3158['list_id'],_0x5b3158[_0x395c('0x47')]));};AGIVertices[_0x395c('0x10')][_0x395c('0xbe')]=function(_0x2a62f2){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0xbf'),_0x2a62f2['label']));var _0x5d4713=this[_0x395c('0xe')]['exec'](_0x2a62f2[_0x395c('0xc0')],_0x2a62f2[_0x395c('0x75')]);if(_0x5d4713[_0x395c('0xa3')]===-0x1){return _0x5d4713;}return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')]('Executed\x20command\x20%s\x20%s',_0x2a62f2[_0x395c('0xc0')],_0x2a62f2[_0x395c('0x75')]));};AGIVertices[_0x395c('0x10')][_0x395c('0xc1')]=function(_0x46bc09){logger['info'](util[_0x395c('0x29')](_0x395c('0xc2'),_0x46bc09[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x46bc09[_0x395c('0x58')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xa9'));}var _0x44f860='\x22'+_0x46bc09[_0x395c('0x58')]+'\x22';if(this[_0x395c('0xa4')](_0x46bc09[_0x395c('0x75')])){_0x44f860+=','+_0x46bc09[_0x395c('0x75')];}var _0x42f6a4=this[_0x395c('0xe')][_0x395c('0x53')](_0x395c('0xc3'),_0x44f860);if(_0x42f6a4[_0x395c('0xa3')]===-0x1){return _0x42f6a4;}return this[_0x395c('0xe')]['noop'](util['format'](_0x395c('0xaa'),_0x44f860));};AGIVertices[_0x395c('0x10')][_0x395c('0xc4')]=function(_0xd989c7){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xd989c7[_0x395c('0x38')]));if(!this['isConfigured'](_0xd989c7[_0x395c('0x58')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xa9'));}var _0x337f70='\x22'+_0xd989c7[_0x395c('0x58')]+'\x22';if(this[_0x395c('0xa4')](_0xd989c7[_0x395c('0x75')])){_0x337f70+=','+_0xd989c7[_0x395c('0x75')];}var _0x21d8c5=this[_0x395c('0xe')][_0x395c('0x53')]('MRCPSynth',_0x337f70);if(_0x21d8c5[_0x395c('0xa3')]===-0x1){return _0x21d8c5;}return this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xaa'),_0x337f70));};AGIVertices[_0x395c('0x10')][_0x395c('0xc5')]=function(_0x26f35a){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0xc6'),_0x26f35a[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x26f35a[_0x395c('0xac')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xad'));}var _0x2978df=_0x26f35a[_0x395c('0xac')];if(this[_0x395c('0xa4')](_0x26f35a['options'])){_0x2978df+=','+_0x26f35a[_0x395c('0x75')];}var _0x353e63=this[_0x395c('0xe')]['exec']('MRCPRecog',_0x2978df);if(_0x353e63['result']===-0x1){return _0x353e63;}var _0x305308=this[_0x395c('0xa2')](_0x395c('0xaf'),_0x395c('0xc7'));if(_0x305308[_0x395c('0xa3')]===-0x1){return _0x305308;}var _0x2fd814=this[_0x395c('0xa2')](_0x395c('0xb1'),_0x395c('0xc8'));if(_0x2fd814['result']===-0x1){return _0x2fd814;}var _0x42f7de=this[_0x395c('0xa2')](_0x395c('0xb3'),_0x395c('0xc9'));if(_0x42f7de[_0x395c('0xa3')]===-0x1){return _0x42f7de;}return this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0xca'),_0x2978df));};AGIVertices['prototype'][_0x395c('0xcb')]=function(_0x1054cb){logger['info'](util[_0x395c('0x29')](_0x395c('0xcc'),_0x1054cb[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x1054cb[_0x395c('0xac')])){return this[_0x395c('0xe')]['noop'](_0x395c('0xad'));}var _0x53b725=_0x1054cb[_0x395c('0xac')];if(this[_0x395c('0xa4')](_0x1054cb[_0x395c('0x75')])){_0x53b725+=','+_0x1054cb[_0x395c('0x75')];}var _0x58616e=this['channel']['exec'](_0x395c('0xae'),_0x53b725);if(_0x58616e[_0x395c('0xa3')]===-0x1){return _0x58616e;}var _0x415154=this[_0x395c('0xa2')](_0x395c('0xaf'),_0x395c('0xcd'));if(_0x415154[_0x395c('0xa3')]===-0x1){return _0x415154;}var _0x5d735c=this[_0x395c('0xa2')]('RECOG_INPUT()',_0x395c('0xce'));if(_0x5d735c[_0x395c('0xa3')]===-0x1){return _0x5d735c;}var _0x1ddf7a=this['getAndSetVariable']('RECOG_INSTANCE()',_0x395c('0xcf'));if(_0x1ddf7a[_0x395c('0xa3')]===-0x1){return _0x1ddf7a;}return this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')](_0x395c('0xca'),_0x53b725));};AGIVertices[_0x395c('0x10')][_0x395c('0xd0')]=function(_0x4ca6bf){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0xd1'),_0x4ca6bf[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x4ca6bf[_0x395c('0xd2')])){return this[_0x395c('0xe')]['error'](_0x4ca6bf,'no\x20database\x20selected');}var _0x3dd230=this[_0x395c('0x18')][_0x395c('0x6e')](this,_0x4ca6bf['odbc_id']);if(!_0x3dd230){return this[_0x395c('0xe')]['error'](_0x4ca6bf,'no\x20odbc\x20database\x20found');}if(!this[_0x395c('0xa4')](_0x4ca6bf[_0x395c('0xd3')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x4ca6bf,'no\x20query\x20configured');}var _0xd857d0=_0x4ca6bf[_0x395c('0xd3')][_0x395c('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x395c('0xe')]['noop'](util['format']('query:\x20%s',_0xd857d0));var _0x952876=this[_0x395c('0x2b')][_0x395c('0x6e')](this,_0x3dd230,_0xd857d0);this[_0x395c('0x36')]['sync'](this,_0x4ca6bf,_0xd857d0);if(!this[_0x395c('0xa4')](_0x4ca6bf[_0x395c('0xd4')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xd5'));}var _0x2d6ed8=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x4ca6bf[_0x395c('0xd4')]);if(!_0x2d6ed8){return this['channel'][_0x395c('0x32')](_0x4ca6bf,_0x395c('0xd6'));}var _0x387796=this;_0x952876[_0x395c('0xd7')](function(_0x3c3175,_0x2f50ba){Object[_0x395c('0xd8')](_0x3c3175)['forEach'](function(_0x1442c9){_0x387796['channel'][_0x395c('0x9e')](util[_0x395c('0x29')](_0x395c('0xd9'),_0x2d6ed8,_0x2f50ba,_0x1442c9),_0x3c3175[_0x1442c9]);});});this[_0x395c('0xe')][_0x395c('0x9e')](util[_0x395c('0x29')](_0x395c('0xda'),_0x2d6ed8),_0x952876[_0x395c('0x9d')]);return this[_0x395c('0xe')]['noop'](util['format'](_0x395c('0xdb'),_0x2d6ed8));};AGIVertices[_0x395c('0x10')]['dial']=function(_0xaa81e9){logger[_0x395c('0xdc')](util[_0x395c('0x29')](_0x395c('0xdd'),_0xaa81e9[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0xaa81e9[_0x395c('0xde')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0xaa81e9,_0x395c('0xdf'));}var _0x9c5149=this[_0x395c('0x1b')][_0x395c('0x6e')](this,_0xaa81e9[_0x395c('0xde')]);if(!_0x9c5149){return this['channel'][_0x395c('0x32')](_0xaa81e9,'no\x20user\x20found');}var _0x22c41b=this[_0x395c('0xe')][_0x395c('0x53')](_0x395c('0xe0'),[util[_0x395c('0x29')](_0x395c('0xe1'),_0x9c5149),_0xaa81e9[_0x395c('0x64')],_0xaa81e9[_0x395c('0xe2')],_0xaa81e9[_0x395c('0x62')]]);if(_0x22c41b[_0x395c('0xa3')]===-0x1){return _0x22c41b;}return this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xe3'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x4c8de2){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0xe4'),_0x4c8de2[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x4c8de2[_0x395c('0x77')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xe5'));}if(!this['isConfigured'](_0x4c8de2[_0x395c('0x58')])){return this['channel']['noop'](_0x395c('0xa9'));}this[_0x395c('0xe')][_0x395c('0xe6')]=!![];this[_0x395c('0x36')](_0x4c8de2);this[_0x395c('0x41')](_0x4c8de2[_0x395c('0x58')],'in','','');this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xe7'),_0x4c8de2[_0x395c('0x58')]));var _0x5236c8=this[_0x395c('0x76')][_0x395c('0x6e')](this,_0x4c8de2);if(_0x5236c8){for(var _0x24955a in _0x5236c8){if(_0x5236c8['hasOwnProperty'](_0x24955a)){this[_0x395c('0xe')][_0x395c('0x9e')](util[_0x395c('0x29')](_0x395c('0xe8'),_0x24955a[_0x395c('0x67')]()),_0x5236c8[_0x24955a]);}}this['createSquareMessage'](_0x5236c8[_0x395c('0xe9')],_0x395c('0xea'),_0x395c('0xeb'),'');return this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xec'),_0x5236c8[_0x395c('0xe9')]));}return this['channel'][_0x395c('0x32')](_0x4c8de2,_0x395c('0xed'));};AGIVertices[_0x395c('0x10')]['dialogflowV2']=function(_0x558413){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0xee'),_0x558413[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x558413[_0x395c('0x79')])){return this[_0x395c('0xe')][_0x395c('0xa8')]('no\x20project_id\x20configured');}if(!this[_0x395c('0xa4')](_0x558413[_0x395c('0x7a')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xef'));}if(!this[_0x395c('0xa4')](_0x558413['private_key'])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xf0'));}if(!this[_0x395c('0xa4')](_0x558413[_0x395c('0x7c')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xf1'));}if(!this[_0x395c('0xa4')](_0x558413[_0x395c('0x58')])){return this[_0x395c('0xe')]['noop'](_0x395c('0xa9'));}this['channel'][_0x395c('0xe6')]=!![];this[_0x395c('0x36')](_0x558413);this[_0x395c('0x41')](_0x558413[_0x395c('0x58')],'in','','');this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xf2'),_0x558413[_0x395c('0x58')]));var _0x5ab024=this[_0x395c('0x78')][_0x395c('0x6e')](this,_0x558413);if(_0x5ab024){for(var _0x15e891 in _0x5ab024){if(_0x5ab024[_0x395c('0x96')](_0x15e891)){if(_0x15e891!==_0x395c('0xf3')){this[_0x395c('0xe')][_0x395c('0x9e')](util[_0x395c('0x29')](_0x395c('0xe8'),_0x15e891['toUpperCase']()),_0x5ab024[_0x15e891]);}}}this[_0x395c('0x41')](_0x5ab024[_0x395c('0xe9')],_0x395c('0xea'),'dialogflowV2',_0x5ab024[_0x395c('0xf3')]);return this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')]('DialogflowV2\x20Result\x20%s',_0x5ab024[_0x395c('0xe9')]));}return this[_0x395c('0xe')][_0x395c('0x32')](_0x558413,_0x395c('0xf4'));};AGIVertices[_0x395c('0x10')][_0x395c('0xf5')]=function(_0x7ec909){logger['info'](util[_0x395c('0x29')](_0x395c('0xf6'),_0x7ec909['label']));if(!this['isConfigured'](_0x7ec909[_0x395c('0xf7')])){return this[_0x395c('0xe')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x395c('0xa4')](_0x7ec909[_0x395c('0xf8')])){return this['channel']['noop'](_0x395c('0xf9'));}if(!this[_0x395c('0xa4')](_0x7ec909[_0x395c('0xfa')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xfb'));}if(!this[_0x395c('0xa4')](_0x7ec909[_0x395c('0xfc')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xa9'));}this[_0x395c('0xe')][_0x395c('0xe6')]=!![];this[_0x395c('0x36')](_0x7ec909);this[_0x395c('0x41')](_0x7ec909['text'],'in','','');this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0xfd'),_0x7ec909[_0x395c('0x58')]));var _0xd6409f=this['sestekNDA'][_0x395c('0x6e')](this,_0x7ec909);if(_0xd6409f){for(var _0xf4b0b9 in _0xd6409f){if(_0xd6409f[_0x395c('0x96')](_0xf4b0b9)){this[_0x395c('0xe')][_0x395c('0x9e')](util[_0x395c('0x29')](_0x395c('0xfe'),_0xf4b0b9[_0x395c('0x67')]()),_0xd6409f[_0xf4b0b9]);}}this['createSquareMessage'](_0xd6409f[_0x395c('0xe9')],_0x395c('0xea'),'sesteknda','');if(_0xd6409f[_0x395c('0xff')]){this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x100'),_0xd6409f[_0x395c('0xff')]));var _0x53ece2=this[_0x395c('0xe')][_0x395c('0x101')](_0xd6409f[_0x395c('0xff')]);try{fs[_0x395c('0x102')](_0xd6409f[_0x395c('0xff')]+_0x395c('0x103'));}catch(_0x406712){logger[_0x395c('0x32')](_0x406712);}return _0x53ece2;}else{return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x104'),_0xd6409f[_0x395c('0xe9')]));}}return this[_0x395c('0xe')][_0x395c('0x32')](_0x7ec909,_0x395c('0x105'));};AGIVertices[_0x395c('0x10')][_0x395c('0x106')]=function(_0x3f082a){logger[_0x395c('0x2e')](util['format'](_0x395c('0x107'),_0x3f082a[_0x395c('0x38')]));return this['channel']['noop'](_0x395c('0x106'));};AGIVertices[_0x395c('0x10')][_0x395c('0x108')]=function(_0x1ea1d9){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x109'),_0x1ea1d9[_0x395c('0x38')]));var _0x33eb28='';if(_0x1ea1d9[_0x395c('0x10a')]){if(!this['isConfigured'](_0x1ea1d9[_0x395c('0x10a')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x1ea1d9,'no\x20trunk\x20selected');}else{var _0x8d6501=parseInt(_0x1ea1d9['trunk_id'],0xa);if(isNaN(_0x8d6501)){_0x33eb28=_0x1ea1d9['trunk_id'];}else{_0x33eb28=this[_0x395c('0x10b')][_0x395c('0x6e')](this,_0x1ea1d9[_0x395c('0x10a')]);if(!_0x33eb28){return this[_0x395c('0xe')][_0x395c('0x32')](_0x1ea1d9,_0x395c('0x10c'));}}}}else if(_0x1ea1d9[_0x395c('0x10d')]){_0x33eb28=_0x1ea1d9[_0x395c('0x10d')];}else{return this[_0x395c('0xe')][_0x395c('0x32')](_0x1ea1d9,_0x395c('0x10e'));}var _0xce3cc0=this[_0x395c('0xe')][_0x395c('0x53')](_0x395c('0xe0'),[util['format'](_0x395c('0x10f'),_0x33eb28,_0x1ea1d9[_0x395c('0x46')]),_0x1ea1d9[_0x395c('0x64')],_0x1ea1d9[_0x395c('0xe2')],_0x1ea1d9[_0x395c('0x62')]]);if(_0xce3cc0[_0x395c('0xa3')]===-0x1){return _0xce3cc0;}return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0xe3'),_0x395c('0xe0')));};AGIVertices['prototype']['finally']=function(_0x1684b2){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x110'),_0x1684b2[_0x395c('0x38')]));return this['channel'][_0x395c('0xa8')](_0x395c('0x111'));};AGIVertices['prototype'][_0x395c('0xc')]=function(_0x42dc03){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x112'),_0x42dc03[_0x395c('0x38')]));if(_0x42dc03[_0x395c('0x113')]===0x0){return this[_0x395c('0xa5')](_0x42dc03);}_0x42dc03[_0x395c('0x113')]-=0x1;if(!this['isConfigured'](_0x42dc03[_0x395c('0x114')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x42dc03,_0x395c('0x115'));}var _0x361911=this['getSound'][_0x395c('0x6e')](this,_0x42dc03['file_id']);if(!_0x361911){return this[_0x395c('0xe')][_0x395c('0x32')](_0x42dc03,_0x395c('0x116'));}if(!this[_0x395c('0xa4')](_0x42dc03[_0x395c('0xd4')])){return this[_0x395c('0xe')]['error'](_0x395c('0xd5'));}var _0x458052=this[_0x395c('0xe')]['getData'](_0x361911,_0x42dc03[_0x395c('0x117')],_0x42dc03['maxdigit']);var _0x4e297f=_0x458052[_0x395c('0xa3')]?_0x458052[_0x395c('0xa3')]['toString']():'';logger[_0x395c('0x2e')]('test',JSON[_0x395c('0x71')](_0x458052));if(_0x458052[_0x395c('0xa3')]===-0x1){this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x42dc03,_0x4e297f);return _0x458052;}else if(_0x458052[_0x395c('0xa0')]===_0x395c('0x64')){_0x458052[_0x395c('0xa3')]=_0x4e297f['length']>=parseInt(_0x42dc03[_0x395c('0x118')])?'x':'i';}else{_0x458052[_0x395c('0xa3')]=_0x4e297f[_0x395c('0x9d')]>=parseInt(_0x42dc03[_0x395c('0x118')])&&_0x4e297f[_0x395c('0x9d')]<=parseInt(_0x42dc03[_0x395c('0x119')])?'x':'i';}var _0x26269b=this['getVariable'][_0x395c('0x6e')](this,_0x42dc03['variable_id']);if(!_0x26269b){return this[_0x395c('0xe')][_0x395c('0x32')](_0x42dc03,_0x395c('0xd6'));}this[_0x395c('0xe')][_0x395c('0x9e')](_0x26269b,_0x4e297f);if(this[_0x395c('0xa4')](_0x42dc03[_0x395c('0x11a')])){var _0x3609db=parseInt(_0x42dc03[_0x395c('0x11a')],0xa);var _0x4ec176=rs['generate']({'charset':'*','length':_0x3609db});var _0x289510=_0x4e297f['length'];if(_0x289510>0x0){if(_0x289510>_0x3609db){this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x42dc03,_0x42dc03[_0x395c('0x11b')]===_0x395c('0x11c')?_0x4ec176+_0x4e297f[_0x395c('0x11d')](_0x3609db):_0x4e297f[_0x395c('0x11d')](0x0,_0x289510-_0x3609db)+_0x4ec176);}else{this[_0x395c('0x36')]['sync'](this,_0x42dc03,rs[_0x395c('0x11e')]({'charset':'*','length':_0x289510}));}}else{this['createSquareDetailsReport'][_0x395c('0x6e')](this,_0x42dc03,'');}}else{this['createSquareDetailsReport'][_0x395c('0x6e')](this,_0x42dc03,_0x4e297f);}return _0x458052;};AGIVertices[_0x395c('0x10')][_0x395c('0xd')]=function(_0x1accfd){logger['info'](util[_0x395c('0x29')](_0x395c('0x11f'),_0x1accfd[_0x395c('0x38')]));return this[_0x395c('0xc')](_0x1accfd);};AGIVertices[_0x395c('0x10')][_0x395c('0x120')]=function(_0x27841a){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x121'),_0x27841a[_0x395c('0x38')]));this['createSquareDetailsReport']['sync'](this,_0x27841a,_0x27841a['goalname']);return this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0x122'),_0x27841a[_0x395c('0x123')]));};AGIVertices[_0x395c('0x10')]['awspolly']=function(_0x42faa3){logger['info'](util[_0x395c('0x29')](_0x395c('0x124'),_0x42faa3['label']));if(!this['isConfigured'](_0x42faa3['aws_access_key_id'])||!this[_0x395c('0xa4')](_0x42faa3[_0x395c('0x85')])){return this[_0x395c('0xe')]['noop'](_0x395c('0x125'));}if(!this['isConfigured'](_0x42faa3[_0x395c('0x58')])){return this[_0x395c('0xe')]['noop'](_0x395c('0xa9'));}this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x126'),_0x42faa3[_0x395c('0x58')]));var _0xc65a67=this['awsPolly'][_0x395c('0x6e')](this,_0x42faa3);if(_0xc65a67){this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x127'),_0xc65a67));var _0x36b086=this[_0x395c('0xe')]['streamFile'](_0xc65a67);try{fs[_0x395c('0x102')](_0xc65a67+_0x395c('0x103'));}catch(_0x1d13eb){logger['error'](_0x1d13eb);}return _0x36b086;}return this['channel'][_0x395c('0x32')](_0x42faa3,_0x395c('0x128'));};AGIVertices['prototype']['awslex']=function(_0x2ecebd){logger[_0x395c('0x2e')](util['format'](_0x395c('0x129'),_0x2ecebd[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x2ecebd[_0x395c('0x84')])||!this[_0x395c('0xa4')](_0x2ecebd[_0x395c('0x85')])){return this[_0x395c('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x395c('0xa4')](_0x2ecebd[_0x395c('0x8c')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0x12a'));}if(!this[_0x395c('0xa4')](_0x2ecebd['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x395c('0xe')][_0x395c('0xe6')]=!![];this[_0x395c('0x36')](_0x2ecebd);this[_0x395c('0x41')](_0x2ecebd[_0x395c('0x58')],'in','','');this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x12b'),_0x2ecebd[_0x395c('0x58')]));var _0x25f716=this['awsLex'][_0x395c('0x6e')](this,_0x2ecebd);if(_0x25f716){for(var _0x5e75f5 in _0x25f716){if(_0x25f716[_0x395c('0x96')](_0x5e75f5)&&_['isString'](_0x25f716[_0x5e75f5])){this[_0x395c('0xe')][_0x395c('0x9e')](util['format'](_0x395c('0x12c'),_0x5e75f5[_0x395c('0x67')]()),_0x25f716[_0x5e75f5]);}}if(_['isNil'](_0x25f716[_0x395c('0x12d')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0x12e'));}else{this[_0x395c('0x41')](_0x25f716[_0x395c('0x12d')],_0x395c('0xea'),_0x395c('0x12f'),'');return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x25f716[_0x395c('0x12d')]));}}return this[_0x395c('0xe')][_0x395c('0x32')](_0x2ecebd,_0x395c('0x130'));};AGIVertices[_0x395c('0x10')][_0x395c('0x131')]=function(_0x113669){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x132'),_0x113669[_0x395c('0x38')],_0x113669[_0x395c('0x64')]));if(!this[_0x395c('0xa4')](_0x113669['key'])){return this['channel'][_0x395c('0xa8')](_0x395c('0xe5'));}var _0xf0ab62=_0x395c('0x133');var _0x488897=util[_0x395c('0x29')](_0x395c('0x134'),FILES_PATH,rs[_0x395c('0x11e')](0x4));var _0x222dd5=util[_0x395c('0x29')](_0x395c('0x9c'),_0x488897,_0xf0ab62);var _0x381a46=!![];if(_0x113669[_0x395c('0x135')]===_0x395c('0x136')){_0x381a46=![];}var _0x1c368d=this['channel']['recordFile'](_0x488897,_0xf0ab62,_0x113669['intKey'],_0x113669[_0x395c('0x64')],undefined,_0x381a46);if(_0x1c368d[_0x395c('0xa3')]!==-0x1){this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')](_0x395c('0x137'),_0x222dd5));var _0x3a0916=this[_0x395c('0x8d')]['sync'](this,_0x113669,_0x222dd5);if(_0x3a0916){for(var _0x13b5b9 in _0x3a0916){if(_0x3a0916[_0x395c('0x96')](_0x13b5b9)){this[_0x395c('0xe')][_0x395c('0x9e')](util[_0x395c('0x29')]('GOOGLE_ASR_%s',_0x13b5b9[_0x395c('0x67')]()),_0x3a0916[_0x13b5b9]);}}return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x138'),JSON[_0x395c('0x71')](_0x3a0916)));}}return _0x1c368d;};AGIVertices[_0x395c('0x10')]['tildeasr']=function(_0xfa13d5){logger['info'](util['format'](_0x395c('0x139'),_0xfa13d5['label']));if(!this[_0x395c('0xa4')](_0xfa13d5[_0x395c('0x90')])){return this[_0x395c('0xe')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0xfa13d5[_0x395c('0x91')])){return this['channel'][_0x395c('0xa8')](_0x395c('0x13a'));}var _0x1a21b7=_0x395c('0x133');var _0x18ac9d=util[_0x395c('0x29')](_0x395c('0x134'),FILES_PATH,rs[_0x395c('0x11e')](0x4));var _0x21e346=util[_0x395c('0x29')]('%s.%s',_0x18ac9d,_0x1a21b7);var _0x3f18a6=!![];if(_0xfa13d5[_0x395c('0x135')]==='NOBEEP'){_0x3f18a6=![];}var _0xa7cd43=this['channel'][_0x395c('0x13b')](_0x18ac9d,_0x1a21b7,_0xfa13d5[_0x395c('0x13c')],_0xfa13d5['timeout'],undefined,_0x3f18a6);if(_0xa7cd43['result']!==-0x1){this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0x13d'),_0x21e346));var _0x555072=this[_0x395c('0x8f')][_0x395c('0x6e')](this,_0xfa13d5,_0x21e346);if(_0x555072){for(var _0xe8b2cd in _0x555072){if(_0x555072['hasOwnProperty'](_0xe8b2cd)){this[_0x395c('0xe')]['setVariable'](util[_0x395c('0x29')](_0x395c('0x13e'),_0xe8b2cd[_0x395c('0x67')]()),_0x555072[_0xe8b2cd]);}}return this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0x13f'),JSON['stringify'](_0x555072)));}}return _0xa7cd43;};AGIVertices[_0x395c('0x10')]['gotoc']=function(_0x36fa41){logger['info'](util[_0x395c('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x36fa41['label']));return this[_0x395c('0xe')][_0x395c('0x140')](_0x36fa41['context'],_0x36fa41['extension'],_0x36fa41[_0x395c('0x3d')]);};AGIVertices[_0x395c('0x10')]['gotoif']=function(_0x18d96d){logger[_0x395c('0x2e')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x18d96d[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x18d96d['condition'])){return this[_0x395c('0xe')]['error'](_0x18d96d,_0x395c('0x141'));}try{var _0x131da4=eval(_0x18d96d['condition'])?'true':_0x395c('0x142');this['channel'][_0x395c('0xa8')](util['format'](_0x395c('0x143'),_0x18d96d[_0x395c('0x144')],_0x131da4));return{'code':0xc8,'result':_0x131da4};}catch(_0x2e9c3f){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x395c('0x10')]['gotoiftime']=function(_0x313d7e){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x145'),_0x313d7e['label']));if(!this[_0x395c('0xa4')](_0x313d7e[_0x395c('0x146')])){return this[_0x395c('0xe')]['error'](_0x313d7e,_0x395c('0x147'));}var _0x4440aa=this[_0x395c('0x23')][_0x395c('0x6e')](this,_0x313d7e[_0x395c('0x146')]);if(!_0x4440aa){return this[_0x395c('0xe')]['error'](_0x313d7e,'no\x20intervals\x20found');}for(var _0x1ba6f3=0x0;_0x1ba6f3<_0x4440aa[_0x395c('0x9d')];_0x1ba6f3+=0x1){var _0x3b8e2e=this[_0x395c('0xe')][_0x395c('0x11')](util['format'](_0x395c('0x148'),_0x4440aa[_0x1ba6f3]));if(_0x3b8e2e[_0x395c('0xa3')]===-0x1){return _0x3b8e2e;}logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x149'),_0x4440aa[_0x1ba6f3],_0x3b8e2e['extra']));if(_0x3b8e2e[_0x395c('0xa0')]===_0x395c('0x14a')){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x149'),_0x4440aa[_0x1ba6f3],'true'));this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x149'),_0x4440aa[_0x1ba6f3],'true'));return{'code':0xc8,'result':_0x395c('0x14a')};}else{logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x149'),_0x4440aa[_0x1ba6f3],_0x395c('0x142')));this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')]('IFTIME\x20%s\x20%s',_0x4440aa[_0x1ba6f3],_0x395c('0x142')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x395c('0x10')][_0x395c('0x14b')]=function(_0x28cd98){logger['info'](util[_0x395c('0x29')](_0x395c('0x14c'),_0x28cd98[_0x395c('0x38')]));return this['channel'][_0x395c('0x14b')]();};AGIVertices[_0x395c('0x10')][_0x395c('0x14d')]=function(_0x57ba5b){logger[_0x395c('0x2e')](util['format'](_0x395c('0x14e'),_0x57ba5b[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x57ba5b[_0x395c('0x77')])){return this['channel'][_0x395c('0xa8')](_0x395c('0xe5'));}var _0x3d580f=_0x395c('0x133');var _0x132c0f=util[_0x395c('0x29')](_0x395c('0x134'),FILES_PATH,rs[_0x395c('0x11e')](0x4));var _0x1ed0a1=util['format'](_0x395c('0x9c'),_0x132c0f,_0x3d580f);var _0x13d89b=!![];if(_0x57ba5b[_0x395c('0x135')]===_0x395c('0x136')){_0x13d89b=![];}var _0x540143=this[_0x395c('0xe')]['recordFile'](_0x132c0f,_0x3d580f,_0x57ba5b[_0x395c('0x13c')],_0x57ba5b[_0x395c('0x64')],undefined,_0x13d89b);if(_0x540143[_0x395c('0xa3')]!==-0x1){this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x14f'),_0x1ed0a1));var _0x441bc4=this[_0x395c('0x80')][_0x395c('0x6e')](this,_0x57ba5b,_0x1ed0a1);if(_0x441bc4){for(var _0x1e5c04 in _0x441bc4){if(_0x441bc4[_0x395c('0x96')](_0x1e5c04)){this[_0x395c('0xe')][_0x395c('0x9e')](util['format']('ISPEECH_ASR_%s',_0x1e5c04['toUpperCase']()),_0x441bc4[_0x1e5c04]);}}return this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x441bc4)));}}return _0x540143;};AGIVertices['prototype']['ispeechtts']=function(_0x45c93e){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x150'),_0x45c93e['label']));if(!this['isConfigured'](_0x45c93e['key'])){return this[_0x395c('0xe')]['noop'](_0x395c('0xe5'));}if(!this[_0x395c('0xa4')](_0x45c93e[_0x395c('0x58')])){return this[_0x395c('0xe')][_0x395c('0xa8')]('no\x20text\x20configured');}this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x151'),_0x45c93e[_0x395c('0x58')]));var _0x38e4eb=this[_0x395c('0x7e')]['sync'](this,_0x45c93e);if(_0x38e4eb){this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x14f'),_0x38e4eb));var _0x472919=this[_0x395c('0xe')][_0x395c('0x101')](_0x38e4eb,_0x45c93e[_0x395c('0x13c')]);try{fs[_0x395c('0x102')](_0x38e4eb+_0x395c('0x103'));}catch(_0x25e2fa){logger[_0x395c('0x32')](_0x25e2fa);}return _0x472919;}return this['channel'][_0x395c('0x32')](_0x45c93e,_0x395c('0x152'));};AGIVertices[_0x395c('0x10')]['login']=function(_0x1577ec){logger['info'](util['format'](_0x395c('0x153'),_0x1577ec[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x1577ec['findBy'])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x1577ec,_0x395c('0x154'));}logger['info'](util['format'](_0x395c('0x155'),this[_0x395c('0xe')][_0x395c('0x39')],_0x1577ec[_0x395c('0x156')]));var _0x51f511=this['agentLogin'][_0x395c('0x6e')](this,_0x1577ec['findBy']);if(_0x51f511){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x395c('0xe')][_0x395c('0x39')],_0x1577ec[_0x395c('0x156')]));this[_0x395c('0xe')]['noop'](util['format'](_0x395c('0x157'),this['channel'][_0x395c('0x39')],_0x1577ec[_0x395c('0x156')]));return{'code':0xc8,'result':_0x395c('0x158')};}else{logger['info'](util[_0x395c('0x29')](_0x395c('0x159'),this[_0x395c('0xe')][_0x395c('0x39')],_0x1577ec[_0x395c('0x156')]));this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')](_0x395c('0x159'),this[_0x395c('0xe')][_0x395c('0x39')],_0x1577ec[_0x395c('0x156')]));return{'code':0xc8,'result':_0x395c('0x15a')};}};AGIVertices[_0x395c('0x10')][_0x395c('0x15b')]=function(_0x323ddd){logger[_0x395c('0x2e')](util['format'](_0x395c('0x15c'),_0x323ddd[_0x395c('0x38')]));if(!this['isConfigured'](_0x323ddd['findBy'])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x323ddd,_0x395c('0x154'));}logger[_0x395c('0x2e')](util[_0x395c('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x395c('0xe')][_0x395c('0x39')],_0x323ddd['findBy']));var _0x932820=this[_0x395c('0x4e')][_0x395c('0x6e')](this,_0x323ddd[_0x395c('0x156')]);if(_0x932820){logger[_0x395c('0x2e')](util['format'](_0x395c('0x157'),this['channel'][_0x395c('0x39')],_0x323ddd['findBy']));this['channel']['noop'](util[_0x395c('0x29')](_0x395c('0x157'),this[_0x395c('0xe')][_0x395c('0x39')],_0x323ddd['findBy']));return{'code':0xc8,'result':_0x395c('0x158')};}else{logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x159'),this[_0x395c('0xe')][_0x395c('0x39')],_0x323ddd[_0x395c('0x156')]));this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x159'),this[_0x395c('0xe')][_0x395c('0x39')],_0x323ddd[_0x395c('0x156')]));return{'code':0xc8,'result':_0x395c('0x15a')};}};AGIVertices[_0x395c('0x10')][_0x395c('0x15d')]=function(_0x5c3d68){logger['info'](util[_0x395c('0x29')](_0x395c('0x15e'),_0x5c3d68[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x5c3d68['operation'])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x5c3d68,_0x395c('0x15f'));}this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x160'),_0x5c3d68[_0x395c('0x161')]));var _0x295c94=eval(_0x5c3d68[_0x395c('0x161')]);if(!this['isConfigured'](_0x5c3d68[_0x395c('0xd4')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xd5'));}var _0x51e37a=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x5c3d68[_0x395c('0xd4')]);if(!_0x51e37a){return this[_0x395c('0xe')][_0x395c('0x32')](_0x5c3d68,_0x395c('0xd6'));}if(_['isArray'](_0x295c94)){var _0x18e5e9=this;_0x295c94['forEach'](function(_0x417129,_0x41ae53){_0x18e5e9[_0x395c('0xe')]['setVariable'](util[_0x395c('0x29')](_0x395c('0x162'),_0x51e37a,_0x41ae53),_0x417129);});return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x163'),_0x51e37a));}else{return this[_0x395c('0xe')][_0x395c('0x9e')](_0x51e37a,_0x295c94);}};AGIVertices[_0x395c('0x10')]['menu']=function(_0x48ccd3){logger['info'](util[_0x395c('0x29')](_0x395c('0x164'),_0x48ccd3[_0x395c('0x38')]));if(_0x48ccd3[_0x395c('0x113')]===0x0){return this['maxRetry'](_0x48ccd3);}_0x48ccd3[_0x395c('0x113')]-=0x1;if(!this[_0x395c('0xa4')](_0x48ccd3[_0x395c('0x114')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x48ccd3,_0x395c('0x115'));}var _0x5c7b23=this[_0x395c('0x1d')][_0x395c('0x6e')](this,_0x48ccd3[_0x395c('0x114')]);if(!_0x5c7b23){return this[_0x395c('0xe')]['error'](_0x48ccd3,'no\x20file\x20audio\x20found');}var _0x59e94c=this[_0x395c('0xe')][_0x395c('0x165')](_0x5c7b23,_0x48ccd3[_0x395c('0x117')],_0x48ccd3[_0x395c('0x166')]);var _0x2d85e=_0x59e94c[_0x395c('0xa3')];if(_0x59e94c[_0x395c('0xa3')]===-0x1){this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x48ccd3,'-1');return _0x59e94c;}else if(_0x59e94c[_0x395c('0xa0')]===_0x395c('0x64')){_0x59e94c['result']=_0x59e94c[_0x395c('0xa3')]['length']>0x0?_0x59e94c[_0x395c('0xa3')]:'t';}else if(_[_0x395c('0x44')](_0x59e94c[_0x395c('0xa3')])){_0x59e94c['result']='#';_0x2d85e='#';}if(!this[_0x395c('0xa4')](_0x48ccd3[_0x395c('0xd4')])){this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xd5'));}else{var _0x52af79=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x48ccd3[_0x395c('0xd4')]);if(!_0x52af79){return this[_0x395c('0xe')][_0x395c('0x32')](_0x48ccd3,'no\x20variable\x20found');}this[_0x395c('0xe')][_0x395c('0x9e')](_0x52af79,_0x2d85e);}this[_0x395c('0x36')]['sync'](this,_0x48ccd3,_0x2d85e);return _0x59e94c;};AGIVertices[_0x395c('0x10')]['noop']=function(_0x4073b0){logger[_0x395c('0x2e')](util['format'](_0x395c('0x167'),_0x4073b0[_0x395c('0x38')]));return this['channel']['noop'](_0x4073b0[_0x395c('0x168')]||_0x4073b0[_0x395c('0x38')]);};AGIVertices[_0x395c('0x10')][_0x395c('0x169')]=function(_0x2bc883){logger['info'](util[_0x395c('0x29')](_0x395c('0x16a'),_0x2bc883['label']));if(!this[_0x395c('0xa4')](_0x2bc883[_0x395c('0x156')])){return this[_0x395c('0xe')]['error'](_0x2bc883,_0x395c('0x154'));}logger['info'](util['format'](_0x395c('0x155'),this[_0x395c('0xe')][_0x395c('0x39')],_0x2bc883['findBy']));var _0x47caaa=this['getPause']['sync'](this,_0x2bc883[_0x395c('0x16b')]);var _0x18ae3f=this['agentPause'][_0x395c('0x6e')](this,_0x2bc883[_0x395c('0x156')],_0x47caaa);if(_0x18ae3f){logger[_0x395c('0x2e')](util['format'](_0x395c('0x157'),this['channel'][_0x395c('0x39')],_0x2bc883['findBy']));this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0x157'),this[_0x395c('0xe')][_0x395c('0x39')],_0x2bc883[_0x395c('0x156')]));return{'code':0xc8,'result':_0x395c('0x158')};}else{logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x159'),this[_0x395c('0xe')][_0x395c('0x39')],_0x2bc883[_0x395c('0x156')]));this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x395c('0x39')],_0x2bc883['findBy']));return{'code':0xc8,'result':_0x395c('0x15a')};}};AGIVertices[_0x395c('0x10')][_0x395c('0x16c')]=function(_0x4ca917){logger['info'](util[_0x395c('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x4ca917[_0x395c('0x38')]));if(!this['isConfigured'](_0x4ca917[_0x395c('0x114')])){return this[_0x395c('0xe')]['error'](_0x4ca917,_0x395c('0x115'));}var _0x481d31=this['getSound'][_0x395c('0x6e')](this,_0x4ca917[_0x395c('0x114')]);if(!_0x481d31){return this[_0x395c('0xe')][_0x395c('0x32')](_0x4ca917,_0x395c('0x116'));}var _0x44fcc7=this[_0x395c('0xe')][_0x395c('0x53')](_0x395c('0x16d'),[_0x481d31,_0x4ca917[_0x395c('0xe2')]]);if(_0x44fcc7[_0x395c('0xa3')]===-0x1){return _0x44fcc7;}return this[_0x395c('0xe')][_0x395c('0xa8')](util['format'](_0x395c('0x16e'),_0x395c('0x16d'),_0x481d31));};AGIVertices[_0x395c('0x10')][_0x395c('0x16f')]=function(_0x15cb17){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x170'),_0x15cb17['label']));if(!this[_0x395c('0xa4')](_0x15cb17[_0x395c('0x171')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x15cb17,_0x395c('0x172'));}var _0x4b68f8='';var _0x493f63=parseInt(_0x15cb17[_0x395c('0x171')],0xa);if(isNaN(_0x493f63)){_0x4b68f8=_0x15cb17[_0x395c('0x171')];}else{_0x4b68f8=this[_0x395c('0x173')]['sync'](this,_0x15cb17['queue_id']);if(!_0x4b68f8){return this['channel']['error'](_0x15cb17,_0x395c('0x174'));}}var _0x337bb4='';if(this[_0x395c('0xa4')](_0x15cb17['file_id'])){var _0x21e9b9=this[_0x395c('0x1d')]['sync'](this,_0x15cb17['file_id']);if(_0x21e9b9){_0x337bb4=_0x21e9b9;}}this['createSquareDetailsReport'][_0x395c('0x6e')](this,_0x15cb17,_0x4b68f8);if(_0x15cb17['opts'][_0x395c('0x175')]('x')<0x0){_0x15cb17[_0x395c('0xe2')]+='x';}if(_0x15cb17[_0x395c('0xe2')][_0x395c('0x175')]('X')<0x0){_0x15cb17[_0x395c('0xe2')]+='X';}this['channel'][_0x395c('0x9e')](_0x395c('0x176'),_0x4b68f8?_0x4b68f8[_0x395c('0x177')]():'');var _0x4e8564=this[_0x395c('0xe')][_0x395c('0x53')](_0x395c('0x178'),[_0x4b68f8,_0x15cb17[_0x395c('0xe2')],_0x15cb17[_0x395c('0x62')],_0x337bb4,_0x15cb17[_0x395c('0x64')],_0x15cb17['agi'],_0x15cb17['macro'],_0x15cb17['gosub'],'',_0x15cb17[_0x395c('0x179')]]);if(_0x4e8564[_0x395c('0xa3')]===-0x1){return _0x4e8564;}return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x16e'),'QUEUE',_0x4b68f8));};AGIVertices[_0x395c('0x10')]['record']=function(_0x18b9a){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x17a'),_0x18b9a[_0x395c('0x38')]));var _0x4a1cd4=_0x18b9a[_0x395c('0x17b')]||_0x395c('0x133');var _0x1f2437=util[_0x395c('0x29')](_0x395c('0x17c'),this[_0x395c('0xe')][_0x395c('0x37')],rs[_0x395c('0x11e')](0x5));var _0x1860ed=util[_0x395c('0x29')](_0x395c('0x17d'),FILES_PATH,_0x1f2437,_0x4a1cd4);var _0x5e16d2=util[_0x395c('0x29')](_0x395c('0x134'),FILES_PATH,_0x1f2437);this[_0x395c('0x3a')]['sync'](this,_0x18b9a,_0x1f2437,_0x1860ed);this['channel'][_0x395c('0x9e')](_0x395c('0x17e'),_0x1f2437);logger[_0x395c('0x2e')](_0x395c('0x17f'),_0x5e16d2,_0x4a1cd4,_0x18b9a['escape_digits'],_0x18b9a[_0x395c('0x64')]);return this[_0x395c('0xe')][_0x395c('0x13b')](_0x5e16d2,_0x4a1cd4,_0x18b9a[_0x395c('0x180')],_0x18b9a[_0x395c('0x64')],undefined,!![]);};AGIVertices[_0x395c('0x10')][_0x395c('0x181')]=function(_0x37a1a5){logger['info'](util[_0x395c('0x29')](_0x395c('0x182'),_0x37a1a5[_0x395c('0x38')]));if(!this['isConfigured'](_0x37a1a5[_0x395c('0x62')])){return this[_0x395c('0xe')][_0x395c('0xa8')]('no\x20url\x20configured');}var _0x309836=this[_0x395c('0x61')][_0x395c('0x6e')](this,_0x37a1a5);logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Response:',util[_0x395c('0x183')](_0x309836,{'showHidden':![],'depth':null})));if(!this[_0x395c('0xa4')](_0x37a1a5[_0x395c('0xd4')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0x184'));}var _0xf4e97b=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x37a1a5['variable_id']);if(!_0xf4e97b){return this[_0x395c('0xe')]['error'](_0x37a1a5,'no\x20variable\x20found');}this[_0x395c('0xe')]['setVariable'](util[_0x395c('0x29')]('%s_STATUS_CODE',_0xf4e97b),_0x309836[_0x395c('0x72')]?_0x309836[_0x395c('0x72')]:'200');this['channel']['setVariable'](util[_0x395c('0x29')](_0x395c('0x185'),_0xf4e97b),_0x309836[_0x395c('0x73')]?_0x309836[_0x395c('0x73')]:'OK');if(_0x309836[_0x395c('0x68')]){try{this[_0x395c('0x9b')](_0x309836[_0x395c('0x68')],_0xf4e97b);}catch(_0x162a4b){logger['error'](util[_0x395c('0x29')](_0x395c('0x186'),_0xf4e97b));}}return this['channel'][_0x395c('0xa8')](util['format']('variable\x20%s\x20set',_0xf4e97b));};AGIVertices[_0x395c('0x10')][_0x395c('0x187')]=function(_0x412416){logger['info'](util[_0x395c('0x29')](_0x395c('0x188'),_0x412416[_0x395c('0x38')]));return this[_0x395c('0xe')][_0x395c('0x189')](_0x412416[_0x395c('0x18a')][_0x395c('0x55')](/\s+/g,''),_0x412416[_0x395c('0x180')]);};AGIVertices[_0x395c('0x10')][_0x395c('0x18b')]=function(_0x513cd5){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x18c'),_0x513cd5['label']));return this[_0x395c('0xe')][_0x395c('0x18d')](_0x513cd5[_0x395c('0x65')][_0x395c('0x55')](/\s+/g,''),_0x513cd5[_0x395c('0x180')]);};AGIVertices[_0x395c('0x10')][_0x395c('0x18e')]=function(_0xda055a){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x18f'),_0xda055a['label']));return this['channel'][_0x395c('0x190')](_0xda055a[_0x395c('0x58')],_0xda055a[_0x395c('0x180')]);};AGIVertices[_0x395c('0x10')]['sendMail']=function(_0x4000f4){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x191'),_0x4000f4['label']));if(!this['isConfigured'](_0x4000f4[_0x395c('0x192')])){return this['channel'][_0x395c('0xa8')](_0x395c('0x193'));}var _0x5e42bd=this['getMailAccount'][_0x395c('0x6e')](this,_0x4000f4['account_id']);if(!_0x5e42bd||!_0x5e42bd[_0x395c('0x194')]){return this['channel']['error'](_0x4000f4,_0x395c('0x195'));}var _0x4267c7={'from':util[_0x395c('0x29')](_0x395c('0x196'),_0x5e42bd[_0x395c('0x14')],_0x5e42bd['email']||_0x5e42bd[_0x395c('0x194')][_0x395c('0x197')]),'to':_0x4000f4['to']||'','cc':_0x4000f4['cc']||'','bcc':_0x4000f4[_0x395c('0x198')]||'','subject':_0x4000f4['subject'],'html':_0x4000f4[_0x395c('0x58')],'text':_0x4000f4['text']};var _0x7cd923={'tls':{'rejectUnauthorized':![]}};if(_0x5e42bd['Smtp'][_0x395c('0x199')]){_0x7cd923[_0x395c('0x199')]=_0x5e42bd[_0x395c('0x194')][_0x395c('0x199')];}else{_0x7cd923[_0x395c('0x19a')]=_0x5e42bd[_0x395c('0x194')][_0x395c('0x19a')];_0x7cd923[_0x395c('0x19b')]=_0x5e42bd[_0x395c('0x194')][_0x395c('0x19b')];_0x7cd923[_0x395c('0x19c')]=_0x5e42bd[_0x395c('0x194')][_0x395c('0x19c')];}if(_0x5e42bd[_0x395c('0x194')][_0x395c('0x19d')]){_0x7cd923[_0x395c('0x19e')]={'user':_0x5e42bd['Smtp']['user'],'pass':_0x5e42bd['Smtp'][_0x395c('0x19f')]};}if(this[_0x395c('0xa4')](_0x4000f4[_0x395c('0x1a0')])){}logger['debug']('sendMail\x20message',JSON[_0x395c('0x71')](_0x4267c7));this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x4000f4,_0x4000f4[_0x395c('0x192')]);this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x1a1'),_0x5e42bd[_0x395c('0x14')]));this[_0x395c('0x1a2')][_0x395c('0x6e')](this,_0x7cd923,_0x4267c7);return this[_0x395c('0xe')]['noop'](_0x395c('0x1a3'));};AGIVertices['prototype'][_0x395c('0x1a4')]=function(_0x47ad07){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x47ad07[_0x395c('0x38')]));return this[_0x395c('0xe')]['noop'](_0x395c('0x1a5'));};AGIVertices['prototype'][_0x395c('0x1a6')]=function(_0x3d26e2){logger['info'](util['format'](_0x395c('0x1a7'),_0x3d26e2[_0x395c('0x38')]));if(!this[_0x395c('0xa4')](_0x3d26e2['sms_account_id'])){return this[_0x395c('0xe')]['noop']('no\x20sms\x20account\x20configured');}var _0x154611=this[_0x395c('0x1a8')]['sync'](this,_0x3d26e2[_0x395c('0x1a9')]);if(!_0x154611){return this[_0x395c('0xe')][_0x395c('0x32')](_0x3d26e2,'no\x20sms\x20account\x20found');}var _0x4506c2={'body':_0x3d26e2[_0x395c('0x1aa')],'phone':_0x3d26e2['to']||'','SmsAccountId':_0x154611['id']};logger[_0x395c('0xdc')](_0x395c('0x1ab'),JSON[_0x395c('0x71')](_0x4506c2));this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x3d26e2,_0x3d26e2[_0x395c('0x1a9')]);this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')](_0x395c('0x1ac'),_0x154611[_0x395c('0x14')]));this['createSmsMessage'][_0x395c('0x6e')](this,_0x4506c2);return this['channel'][_0x395c('0xa8')](_0x395c('0x1ad'));};AGIVertices[_0x395c('0x10')][_0x395c('0x1ae')]=function(_0x3a84bd){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x1af'),_0x3a84bd['label']));if(!this[_0x395c('0xa4')](_0x3a84bd[_0x395c('0xd4')])){return this['channel']['error'](_0x3a84bd,_0x395c('0x1b0'));}var _0x305b52=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x3a84bd[_0x395c('0xd4')]);if(!_0x305b52){return this['channel'][_0x395c('0x32')](_0x3a84bd,_0x395c('0xd6'));}return this[_0x395c('0xe')][_0x395c('0x9e')](_0x305b52,_0x3a84bd['variable_value']);};AGIVertices['prototype'][_0x395c('0x1b1')]=function(_0x1baed4){logger[_0x395c('0x2e')](util['format'](_0x395c('0x1b2'),_0x1baed4[_0x395c('0x38')]));this[_0x395c('0xe')]['noop'](_0x395c('0x1b3'));if(_0x1baed4[_0x395c('0x1b4')]===_0x395c('0x1b5')){this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0x1b6'));return this[_0x395c('0xe')][_0x395c('0x1b4')]();}return this[_0x395c('0xe')][_0x395c('0xa8')]('Skipped\x20Answer');};AGIVertices[_0x395c('0x10')][_0x395c('0x1b7')]=function(_0x3aa9c4){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x1b8'),_0x3aa9c4['label']));if(!this['isConfigured'](_0x3aa9c4[_0x395c('0x1b9')])){return this['channel'][_0x395c('0x32')](_0x3aa9c4,_0x395c('0x1ba'));}var _0x194eb9=this['getSquareProject'][_0x395c('0x6e')](this,_0x3aa9c4[_0x395c('0x1b9')]);if(!this['isConfigured'](_0x194eb9)){return this[_0x395c('0xe')]['error'](_0x3aa9c4,util[_0x395c('0x29')](_0x395c('0x1bb'),_0x3aa9c4[_0x395c('0x1b9')]));}if(_0x194eb9===this['channel'][_0x395c('0x1bc')]){return this[_0x395c('0xe')][_0x395c('0x32')](_0x3aa9c4,_0x395c('0x1bd'));}this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x3aa9c4,_0x194eb9);var _0x193577=this['channel'][_0x395c('0x53')](_0x395c('0x1be'),util[_0x395c('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||'127.0.0.1',_0x194eb9,this[_0x395c('0xe')][_0x395c('0x1bc')]));if(_0x193577[_0x395c('0xa3')]===-0x1){return _0x193577;}return this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')](_0x395c('0x16e'),'AGI',_0x194eb9));};AGIVertices[_0x395c('0x10')]['system']=function(_0x34443c){logger['info'](util[_0x395c('0x29')](_0x395c('0x1bf'),_0x34443c['label']));var _0x12fea3=this[_0x395c('0x1c0')]['sync'](this,_0x34443c[_0x395c('0xb6')]);this[_0x395c('0x36')][_0x395c('0x6e')](this,_0x34443c,_0x34443c[_0x395c('0xb6')]);if(this[_0x395c('0xa4')](_0x34443c[_0x395c('0xd4')])){var _0x3e837d=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x34443c[_0x395c('0xd4')]);if(_0x3e837d){this[_0x395c('0xe')][_0x395c('0x9e')](_0x3e837d,_0x12fea3);return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x1c1'),_0x34443c[_0x395c('0xb6')],_0x3e837d));}}return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x1c2'),_0x34443c[_0x395c('0xb6')]));};AGIVertices[_0x395c('0x10')][_0x395c('0x1c3')]=function(_0x193e17){logger[_0x395c('0x2e')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x193e17[_0x395c('0x38')]));_0x193e17['text']=_0x193e17[_0x395c('0x58')][_0x395c('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x193e17[_0x395c('0x57')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0x1c4'));}if(!this[_0x395c('0xa4')](_0x193e17['text'])){return this['channel'][_0x395c('0xa8')](_0x395c('0xa9'));}this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x193e17['text']));var _0x221044=this[_0x395c('0x56')][_0x395c('0x6e')](this,_0x193e17);if(_0x221044){this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')](_0x395c('0x1c5'),_0x221044));var _0x372d7d=this[_0x395c('0xe')][_0x395c('0x101')](_0x221044);try{fs[_0x395c('0x102')](_0x221044+_0x395c('0x103'));}catch(_0x113d9d){logger[_0x395c('0x32')](_0x113d9d);}return _0x372d7d;}return this[_0x395c('0xe')][_0x395c('0x32')](_0x193e17,_0x395c('0x1c6'));};AGIVertices[_0x395c('0x10')][_0x395c('0x1c7')]=function(_0x49fab4){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x49fab4['label']));_0x49fab4[_0x395c('0x58')]=_0x49fab4[_0x395c('0x58')][_0x395c('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x395c('0xa4')](_0x49fab4[_0x395c('0x58')])){return this[_0x395c('0xe')][_0x395c('0xa8')](_0x395c('0xa9'));}this['channel'][_0x395c('0xa8')](util[_0x395c('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x49fab4[_0x395c('0x58')]));var _0x4f01ea=this[_0x395c('0x5f')]['sync'](this,_0x49fab4);if(_0x4f01ea){this[_0x395c('0xe')]['noop'](util[_0x395c('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x4f01ea));var _0xcf9017=this[_0x395c('0xe')][_0x395c('0x101')](_0x4f01ea);try{fs[_0x395c('0x102')](_0x4f01ea+_0x395c('0x103'));}catch(_0x4203a6){logger[_0x395c('0x32')](_0x4203a6);}return _0xcf9017;}return this['channel'][_0x395c('0x32')](_0x49fab4,_0x395c('0x1c8'));};AGIVertices['prototype']['unpause']=function(_0x28415a){logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x1c9'),_0x28415a[_0x395c('0x38')]));if(!this['isConfigured'](_0x28415a[_0x395c('0x156')])){return this[_0x395c('0xe')][_0x395c('0x32')](_0x28415a,_0x395c('0x154'));}logger[_0x395c('0x2e')](util['format'](_0x395c('0x155'),this[_0x395c('0xe')][_0x395c('0x39')],_0x28415a[_0x395c('0x156')]));var _0x266083=this[_0x395c('0x4d')][_0x395c('0x6e')](this,_0x28415a[_0x395c('0x156')]);if(_0x266083){logger[_0x395c('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x28415a[_0x395c('0x156')]));this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x157'),this[_0x395c('0xe')][_0x395c('0x39')],_0x28415a['findBy']));return{'code':0xc8,'result':_0x395c('0x158')};}else{logger[_0x395c('0x2e')](util[_0x395c('0x29')](_0x395c('0x159'),this[_0x395c('0xe')][_0x395c('0x39')],_0x28415a['findBy']));this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x159'),this['channel'][_0x395c('0x39')],_0x28415a[_0x395c('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x395c('0x10')][_0x395c('0x1ca')]=function(_0x96bc4b){logger['info'](util[_0x395c('0x29')](_0x395c('0x1cb'),_0x96bc4b['label']));var _0x1d8790=this[_0x395c('0xe')][_0x395c('0x53')](_0x395c('0x1cc'),[_0x96bc4b[_0x395c('0x1cd')],_0x96bc4b[_0x395c('0x75')]]);if(_0x1d8790[_0x395c('0xa3')]===-0x1){return _0x1d8790;}return this[_0x395c('0xe')][_0x395c('0xa8')](util[_0x395c('0x29')](_0x395c('0x16e'),'VOICEMAIL',_0x96bc4b['mailbox']));};AGIVertices['prototype'][_0x395c('0x1ce')]=function(_0x5062a6){logger[_0x395c('0x2e')](util[_0x395c('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5062a6[_0x395c('0x38')]));if(!this['isConfigured'](_0x5062a6[_0x395c('0xd4')])){return this['channel']['error'](_0x5062a6,_0x395c('0x1b0'));}var _0x2ba513=this[_0x395c('0x11')][_0x395c('0x6e')](this,_0x5062a6[_0x395c('0xd4')]);if(!_0x2ba513){return this['channel'][_0x395c('0x32')](_0x5062a6,_0x395c('0xd6'));}var _0x4cdeb5=this[_0x395c('0xe')][_0x395c('0x11')](_0x2ba513);return{'code':0xc8,'result':_0x4cdeb5[_0x395c('0xa0')]?_0x4cdeb5[_0x395c('0xa0')]:'-'};};String[_0x395c('0x10')][_0x395c('0x1cf')]=function(_0x2a8f83,_0x33bdd9){return this[_0x395c('0x9f')](_0x2a8f83)[_0x395c('0x1d0')](_0x33bdd9);};module['exports']=AGIVertices; \ No newline at end of file +var _0x5fb7=['ndauth_url','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','failure','logout','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','service','host','port','secure','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','moment','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','LOCAL','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','PUT','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','url','render','stringify','body','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','length','saveRestApiResult','%s.%s','recursiveNodeIndex','split','replaceAll','getAndSetVariable','result','extra','setVariable','isConfigured','maxRetry','createSquareDetailsReport','retry','mrcpsynth','no\x20text\x20configured','exec','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','toUpperCase','speech','dialogflow','dialogflowV2','no\x20project_id\x20configured','client_email','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block'];(function(_0x5efca0,_0x1a490c){var _0x2bc6fa=function(_0x4085d1){while(--_0x4085d1){_0x5efca0['push'](_0x5efca0['shift']());}};_0x2bc6fa(++_0x1a490c);}(_0x5fb7,0xd8));var _0x75fb=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x5fb7[_0x38ced4];return _0x547c07;};'use strict';var fs=require('fs');var path=require(_0x75fb('0x0'));var util=require('util');var _=require(_0x75fb('0x1'));var sh=require(_0x75fb('0x2'));var odbc=require(_0x75fb('0x3'))();var rs=require('randomstring');var moment=require(_0x75fb('0x4'));var Mustache=require('mustache');var rp=require(_0x75fb('0x5'));var logger=require(_0x75fb('0x6'))(_0x75fb('0x7'));var config=require('../../config/environment');var scripts=require(_0x75fb('0x8'));var FILES_PATH=_0x75fb('0x9');var recursiveMapAttributes=[_0x75fb('0xa'),_0x75fb('0xb')];var verticesWithRetry=[_0x75fb('0xc'),_0x75fb('0xd'),_0x75fb('0xe')];var AGIVertices=function(_0x4e6c16,_0x37d7a9,_0x30bf1d){this[_0x75fb('0xf')]=_0x4e6c16;this[_0x75fb('0x10')]=_0x37d7a9;this[_0x75fb('0x11')]=_0x30bf1d;};AGIVertices[_0x75fb('0x12')][_0x75fb('0x13')]=function(_0x46f05b,_0xa8772c){this['rpc'][_0x75fb('0x14')](_0x46f05b)[_0x75fb('0x15')](function(_0x185a9f){_0xa8772c(null,_0x185a9f?_0x185a9f['name']:![]);})[_0x75fb('0x16')](function(_0x36558a){_0xa8772c(_0x36558a);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x17')]=function(_0x1ecd64,_0x128e1d){this[_0x75fb('0x10')][_0x75fb('0x18')](_0x1ecd64)['then'](function(_0x88722d){_0x128e1d(null,_0x88722d?_0x88722d[_0x75fb('0x19')]:![]);})[_0x75fb('0x16')](function(_0x4bf900){_0x128e1d(_0x4bf900);});};AGIVertices[_0x75fb('0x12')]['getSquareProject']=function(_0x24168d,_0x5f16b1){this[_0x75fb('0x10')][_0x75fb('0x1a')](_0x24168d)[_0x75fb('0x15')](function(_0x1b1e2c){_0x5f16b1(null,_0x1b1e2c?_0x1b1e2c[_0x75fb('0x19')]:![]);})[_0x75fb('0x16')](function(_0x24ab0e){_0x5f16b1(_0x24ab0e);});};AGIVertices['prototype'][_0x75fb('0x1b')]=function(_0x35a8d5,_0x5cf8ba){this['rpc'][_0x75fb('0x1c')](_0x35a8d5)['then'](function(_0x2a6aa6){_0x5cf8ba(null,_0x2a6aa6?_0x2a6aa6['dsn']:![]);})['catch'](function(_0x14d782){_0x5cf8ba(_0x14d782);});};AGIVertices[_0x75fb('0x12')]['getUser']=function(_0x5e12b2,_0x6021f3){this[_0x75fb('0x10')][_0x75fb('0x1d')](_0x5e12b2)['then'](function(_0x443381){_0x6021f3(null,_0x443381?_0x443381['name']:![]);})[_0x75fb('0x16')](function(_0x4730f9){_0x6021f3(_0x4730f9);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1e')]=function(_0x3e3725,_0x565c61){this[_0x75fb('0x10')]['getTrunkById'](_0x3e3725)['then'](function(_0x175a3e){_0x565c61(null,_0x175a3e?_0x175a3e['name']:![]);})[_0x75fb('0x16')](function(_0x4a1011){_0x565c61(_0x4a1011);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1f')]=function(_0x374b66,_0x5657c6){var _0x5b0499=this;this['rpc'][_0x75fb('0x20')](_0x374b66)[_0x75fb('0x15')](function(_0x21a9aa){_0x5657c6(null,_0x21a9aa?_0x5b0499['getSoundPath'](_0x21a9aa[_0x75fb('0x21')]):![]);})[_0x75fb('0x16')](function(_0x56e866){_0x5657c6(_0x56e866);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x22')]=function(_0x287cd0,_0x5a8aa8){this[_0x75fb('0x10')]['getMailAccountById'](_0x287cd0)[_0x75fb('0x15')](function(_0x2c537c){_0x5a8aa8(null,_0x2c537c?_0x2c537c:![]);})[_0x75fb('0x16')](function(_0xb75f50){_0x5a8aa8(_0xb75f50);});};AGIVertices[_0x75fb('0x12')]['sendMailMessage']=function(_0x405b65,_0x264051,_0x460b54){this[_0x75fb('0x11')][_0x75fb('0x23')](_0x405b65,_0x264051)[_0x75fb('0x15')](function(){_0x460b54(null);})['catch'](function(_0x5011b4){_0x460b54(_0x5011b4);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x24')]=function(_0xc065f3,_0x2eb482){this[_0x75fb('0x10')][_0x75fb('0x25')](_0xc065f3)['then'](function(_0x39fab5){if(_0x39fab5){if(_0x39fab5[_0x75fb('0x26')]){_0x2eb482(null,[_0x39fab5[_0x75fb('0x27')]]);}else{_0x2eb482(null,_[_0x75fb('0x28')](_0x39fab5['Intervals'],'interval'));}}else{_0x2eb482(null,![]);}})[_0x75fb('0x16')](function(_0x372819){_0x2eb482(_0x372819);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x29')]=function(_0x321ce2){return util[_0x75fb('0x2a')](_0x75fb('0x2b'),FILES_PATH,_0x321ce2);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x2c')]=function(_0x2e5803,_0xeb67dc,_0x1fba10){odbc[_0x75fb('0x2d')](_0x2e5803,function(_0x12f87a){if(_0x12f87a){logger[_0x75fb('0x2e')](_0x75fb('0x2f'),_0x12f87a);_0x1fba10(_0x12f87a);}else{logger[_0x75fb('0x30')](_0x75fb('0x31'));odbc['query'](_0xeb67dc,function(_0x429d84,_0x5a3efb){if(_0x429d84){logger[_0x75fb('0x30')](_0x75fb('0x32'),_0xeb67dc);_0x1fba10(_0x429d84);}else{logger[_0x75fb('0x30')](_0x75fb('0x33'),_0xeb67dc);odbc[_0x75fb('0x34')](function(_0x38889f){if(_0x38889f){logger[_0x75fb('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x38889f);}_0x1fba10(null,_0x5a3efb);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x546e47,_0x4a42a9){this[_0x75fb('0x10')][_0x75fb('0x35')](_0x546e47)['then'](function(_0x20b96d){_0x4a42a9(null,_0x20b96d?_0x20b96d:![]);})[_0x75fb('0x16')](function(_0x51b74e){_0x4a42a9(_0x51b74e);});};AGIVertices['prototype'][_0x75fb('0x36')]=function(_0x3fbb45,_0x360d33){this['rpc'][_0x75fb('0x36')](_0x3fbb45)[_0x75fb('0x15')](function(_0x59a319){_0x360d33(null,_0x59a319);})[_0x75fb('0x16')](function(_0x1d04a0){_0x360d33(_0x1d04a0);});};AGIVertices[_0x75fb('0x12')]['createSquareDetailsReport']=function(_0x657bad,_0x493de1,_0x475c81){this[_0x75fb('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x75fb('0xf')][_0x75fb('0x37')],'node':_0x657bad[_0x75fb('0x38')],'application':_0x657bad['agicommand'],'data':_0x493de1||null,'project_name':this[_0x75fb('0xf')][_0x75fb('0x39')],'callerid':this[_0x75fb('0xf')][_0x75fb('0x3a')]})['then'](function(_0x1bfbfc){if(_0x475c81){_0x475c81(null,_0x1bfbfc);}})['catch'](function(_0x10585c){if(_0x475c81){_0x475c81(_0x10585c);}});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x3b')]=function(_0x39c82a,_0x5daa72,_0x690614,_0x31a5c5){this[_0x75fb('0x10')]['createSquareRecording']({'uniqueid':this[_0x75fb('0xf')]['uniqueid'],'callerid':this[_0x75fb('0xf')][_0x75fb('0x3a')],'calleridname':this['channel'][_0x75fb('0x3c')],'context':this[_0x75fb('0xf')][_0x75fb('0x3d')],'extension':this[_0x75fb('0xf')][_0x75fb('0x3e')],'priority':this[_0x75fb('0xf')]['priority'],'accountcode':this[_0x75fb('0xf')][_0x75fb('0x3f')],'dnid':this['channel'][_0x75fb('0x40')],'projectName':this['channel']['arg_1'],'saveName':_0x5daa72,'filename':_0x39c82a[_0x75fb('0x41')]||_0x5daa72,'savePath':_0x690614})[_0x75fb('0x15')](function(_0x58b02f){_0x31a5c5(null,_0x58b02f);})[_0x75fb('0x16')](function(_0x4ad2b5){_0x31a5c5(_0x4ad2b5);});};AGIVertices['prototype'][_0x75fb('0x42')]=function(_0x5e47e1,_0x5019fd,_0x648173,_0x461f3f,_0x225eac){this[_0x75fb('0x10')][_0x75fb('0x42')]({'uniqueid':this[_0x75fb('0xf')][_0x75fb('0x37')],'body':_0x5e47e1,'direction':_0x5019fd,'providerName':_0x648173,'providerResponse':_0x461f3f})[_0x75fb('0x15')](function(_0x1bff0b){if(_0x225eac){_0x225eac(null,_0x1bff0b);}})[_0x75fb('0x16')](function(_0x56d8c0){if(_0x225eac){_0x225eac(_0x56d8c0);}});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x43')]=function(_0x8160a9,_0x1e65f1){this['rpc']['createCmContact']({'firstName':_[_0x75fb('0x44')](_0x8160a9['name'])||_[_0x75fb('0x45')](_0x8160a9['name'])?_0x75fb('0x46')+Math[_0x75fb('0x47')]():_0x8160a9[_0x75fb('0x19')],'lastName':_['isEmpty'](_0x8160a9[_0x75fb('0x48')])||_[_0x75fb('0x45')](_0x8160a9['lastName'])?null:_0x8160a9[_0x75fb('0x48')],'phone':_0x8160a9[_0x75fb('0x49')],'ListId':_0x8160a9[_0x75fb('0x4a')],'scheduledat':_0x8160a9[_0x75fb('0x4b')],'callbackUniqueid':this[_0x75fb('0xf')]['uniqueid'],'tags':'callback','description':_0x75fb('0x4c')+_0x8160a9['scheduledAt'][_0x75fb('0x4d')](),'priority':_0x8160a9[_0x75fb('0x4e')]})[_0x75fb('0x15')](function(_0x3d8b8a){_0x1e65f1(null,_0x3d8b8a);})[_0x75fb('0x16')](function(_0x34669c){_0x1e65f1(_0x34669c);});};AGIVertices['prototype'][_0x75fb('0x4f')]=function(_0x1f5eab,_0x2f108b){this[_0x75fb('0x10')][_0x75fb('0x50')](_0x1f5eab)[_0x75fb('0x15')](function(_0x4a4209){_0x2f108b(null,_0x4a4209?_0x4a4209[_0x75fb('0x19')]:![]);})[_0x75fb('0x16')](function(_0xa80a29){_0x2f108b(_0xa80a29);});};AGIVertices[_0x75fb('0x12')]['agentPause']=function(_0x453fd5,_0x553f75,_0x3f12fb){var _0x14c8dc={'role':'agent'};_0x14c8dc[_0x453fd5]=this[_0x75fb('0xf')][_0x75fb('0x3a')];this[_0x75fb('0x10')][_0x75fb('0x51')](_0x14c8dc,_0x553f75,this[_0x75fb('0xf')][_0x75fb('0x37')])[_0x75fb('0x15')](function(_0x348dee){_0x3f12fb(null,_[_0x75fb('0x45')](_0x348dee)?![]:!![]);})[_0x75fb('0x16')](function(_0x993743){logger['error'](_0x993743);_0x3f12fb(null,![]);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x52')]=function(_0x28d576,_0x67bcd0){var _0x24c1df={'role':_0x75fb('0x53')};_0x24c1df[_0x28d576]=this[_0x75fb('0xf')][_0x75fb('0x3a')];this['rpc'][_0x75fb('0x52')](_0x24c1df)[_0x75fb('0x15')](function(_0x270dc8){_0x67bcd0(null,_['isNil'](_0x270dc8)?![]:!![]);})['catch'](function(_0x50bbee){logger[_0x75fb('0x2e')](_0x50bbee);_0x67bcd0(null,![]);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x54')]=function(_0x567a48,_0x1e6319){var _0x14acaf={'role':_0x75fb('0x53')};_0x14acaf[_0x567a48]=this[_0x75fb('0xf')][_0x75fb('0x3a')];this['rpc'][_0x75fb('0x54')](_0x14acaf)['then'](function(_0x4ab556){_0x1e6319(null,_['isNil'](_0x4ab556)?![]:!![]);})[_0x75fb('0x16')](function(_0x39f015){logger['error'](_0x39f015);_0x1e6319(null,![]);});};AGIVertices['prototype'][_0x75fb('0x55')]=function(_0x2b7f15,_0x430d80){var _0x17001d={'role':_0x75fb('0x53')};_0x17001d[_0x2b7f15]=this[_0x75fb('0xf')][_0x75fb('0x3a')];var _0x2388c4=_0x2b7f15!=_0x75fb('0x56')?util['format']('%s/%s@from-sip/n',_0x75fb('0x57'),this[_0x75fb('0xf')][_0x75fb('0x3a')]):undefined;this[_0x75fb('0x10')][_0x75fb('0x55')](_0x17001d,_0x2388c4)[_0x75fb('0x15')](function(_0x56dfcf){_0x430d80(null,_[_0x75fb('0x45')](_0x56dfcf)?![]:!![]);})[_0x75fb('0x16')](function(_0x4bfb17){logger[_0x75fb('0x2e')](_0x4bfb17);_0x430d80(null,![]);});};AGIVertices[_0x75fb('0x12')]['shellCommand']=function(_0x5b4dfb,_0x371070){sh['exec'](_['trim'](_0x5b4dfb),function(_0x39186c,_0x3d13c5){var _0x23f6af=_0x3d13c5['replace'](/(\r\n|\n|\r)/gm,'');_0x371070(null,_0x23f6af);});};AGIVertices['prototype'][_0x75fb('0x58')]=function(_0x16c329,_0x1f827d){scripts[_0x75fb('0x58')](_0x16c329['apiKey'],_0x16c329[_0x75fb('0x59')]||_0x75fb('0x5a'),_0x16c329['text'],_0x16c329[_0x75fb('0x5b')]||'en-US',_0x16c329[_0x75fb('0x5c')]||_0x75fb('0x5d'),_0x16c329['audioEncoding']||'MP3')[_0x75fb('0x15')](function(_0x54e427){_0x1f827d(null,_0x54e427);})[_0x75fb('0x16')](function(_0xf1563d){_0x1f827d(_0xf1563d);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x5e')]=function(_0x2f7571,_0x404ecf){scripts['googleTTS'](_0x2f7571[_0x75fb('0x5a')],_0x2f7571[_0x75fb('0x5f')]||'en',0x1)[_0x75fb('0x15')](function(_0x1575a8){_0x404ecf(null,_0x1575a8);})[_0x75fb('0x16')](function(_0x5471f3){_0x404ecf(_0x5471f3);});};AGIVertices['prototype'][_0x75fb('0x60')]=function(_0x3cb91a,_0x45f060){var _0x3bbe4f={'uri':_0x3cb91a['url'],'method':_0x3cb91a[_0x75fb('0x61')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3cb91a[_0x75fb('0x62')])===_0x75fb('0x63')&&parseInt(_0x3cb91a[_0x75fb('0x62')])>=0x1?parseInt(_0x3cb91a[_0x75fb('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x75fb('0x64')]([_0x75fb('0x65'),_0x75fb('0x66')],_0x3bbe4f[_0x75fb('0x61')]['toUpperCase']())){try{_0x3bbe4f['body']=_0x3cb91a[_0x75fb('0xb')]?JSON[_0x75fb('0x67')](_0x3cb91a['rawBody']):{};}catch(_0x2c79c5){logger[_0x75fb('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2c79c5);}}try{_0x3bbe4f[_0x75fb('0x68')]=_0x3cb91a['rawHeaders']?JSON[_0x75fb('0x67')](_0x3cb91a[_0x75fb('0xa')]):{};}catch(_0x16e396){logger[_0x75fb('0x2e')](_0x75fb('0x69'),_0x16e396);}if(_0x3cb91a[_0x75fb('0x6a')]){try{var _0x2810e=require(_0x3cb91a[_0x75fb('0x6a')])[_0x75fb('0x6b')](this,_0x3bbe4f);_0x3bbe4f['uri']=Mustache['render'](_0x3cb91a[_0x75fb('0x6c')],_0x2810e,{},['$$','$$']);if(_0x3bbe4f['headers']){_0x3bbe4f['headers']=JSON[_0x75fb('0x67')](Mustache[_0x75fb('0x6d')](JSON[_0x75fb('0x6e')](_0x3bbe4f[_0x75fb('0x68')]),_0x2810e,{},['$$','$$']));}if(_0x3bbe4f[_0x75fb('0x6f')]){_0x3bbe4f['body']=JSON[_0x75fb('0x67')](Mustache[_0x75fb('0x6d')](JSON[_0x75fb('0x6e')](_0x3bbe4f[_0x75fb('0x6f')]),_0x2810e,{},['$$','$$']));}}catch(_0x5fdba1){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5fdba1);}}rp(_0x3bbe4f)[_0x75fb('0x15')](function(_0x50fab9){var _0x5abee2={'statusCode':_0x50fab9[_0x75fb('0x70')]||0xc8,'statusMessage':_0x50fab9['statusMessage']||'OK','headers':_0x50fab9['headers']||{},'body':_0x50fab9[_0x75fb('0x6f')]||{}};_0x45f060(null,_0x5abee2);})[_0x75fb('0x16')](function(_0x223385){var _0x1c53a8={'statusCode':_0x223385['statusCode']||0x1f4,'statusMessage':_0x223385[_0x75fb('0x71')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x223385['options'][_0x75fb('0x68')]||{},'body':_0x223385[_0x75fb('0x72')][_0x75fb('0x6f')]||{}};_0x45f060(null,_0x1c53a8);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x73')]=function(_0x1dddb1,_0x258cb4){scripts[_0x75fb('0x73')](this[_0x75fb('0xf')][_0x75fb('0x37')],_0x1dddb1[_0x75fb('0x74')],_0x1dddb1[_0x75fb('0x5a')],_0x1dddb1[_0x75fb('0x75')]||'en')[_0x75fb('0x15')](function(_0x18de5e){_0x258cb4(null,_0x18de5e);})[_0x75fb('0x16')](function(_0x4f8e84){_0x258cb4(_0x4f8e84);});};AGIVertices[_0x75fb('0x12')]['googleDialogflowV2']=function(_0x542b9d,_0x4e509e){scripts[_0x75fb('0x76')](this[_0x75fb('0xf')][_0x75fb('0x37')],_0x542b9d['dialogflowV2_project_id'],_0x542b9d['client_email'],_0x542b9d[_0x75fb('0x77')],_0x542b9d['text'],_0x542b9d[_0x75fb('0x78')]||'en')['then'](function(_0x5a0eab){_0x4e509e(null,_0x5a0eab);})[_0x75fb('0x16')](function(_0xa543d2){_0x4e509e(_0xa543d2);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x79')]=function(_0x287743,_0x2feaf7){scripts['sestekNDA'](this['channel'],_0x287743)[_0x75fb('0x15')](function(_0x252b2a){_0x2feaf7(null,_0x252b2a);})[_0x75fb('0x16')](function(_0x46363e){_0x2feaf7(_0x46363e);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x7a')]=function(_0x3ac771,_0x1a6fcf){scripts[_0x75fb('0x7a')](_0x3ac771[_0x75fb('0x74')],_0x3ac771[_0x75fb('0x5a')],_0x3ac771[_0x75fb('0x7b')]||'en-US',_0x3ac771[_0x75fb('0x7c')])[_0x75fb('0x15')](function(_0x47c6f1){_0x1a6fcf(null,_0x47c6f1);})[_0x75fb('0x16')](function(_0xda9d46){_0x1a6fcf(_0xda9d46);});};AGIVertices[_0x75fb('0x12')]['ispeechASR']=function(_0x56edf0,_0x33f546,_0x5b872d){scripts[_0x75fb('0x7d')](_0x33f546,_0x56edf0[_0x75fb('0x74')],_0x56edf0[_0x75fb('0x7e')]||_0x75fb('0x7f'),this['isConfigured'](_0x56edf0[_0x75fb('0x80')])?_0x56edf0['model']:undefined)[_0x75fb('0x15')](function(_0x472caf){_0x5b872d(null,_0x472caf);})[_0x75fb('0x16')](function(_0x54c6f){_0x5b872d(_0x54c6f);});};AGIVertices[_0x75fb('0x12')][_0x75fb('0x81')]=function(_0x17a81d,_0x537a8f){scripts[_0x75fb('0x81')](_0x17a81d['aws_access_key_id'],_0x17a81d[_0x75fb('0x82')],_0x17a81d[_0x75fb('0x83')],_0x17a81d['aws_polly_voice']||_0x75fb('0x84'),_0x17a81d[_0x75fb('0x5a')],_0x17a81d[_0x75fb('0x85')]||'text')[_0x75fb('0x15')](function(_0x1b7bd2){_0x537a8f(null,_0x1b7bd2);})[_0x75fb('0x16')](function(_0x4f1b25){_0x537a8f(_0x4f1b25);});};AGIVertices[_0x75fb('0x12')]['awsLex']=function(_0x5b57a9,_0x1852a8){scripts['awsLex'](this['channel']['uniqueid'],_0x5b57a9[_0x75fb('0x86')],_0x5b57a9[_0x75fb('0x82')],_0x5b57a9[_0x75fb('0x87')],_0x5b57a9[_0x75fb('0x5a')],_0x5b57a9[_0x75fb('0x88')])[_0x75fb('0x15')](function(_0x3a3324){_0x1852a8(null,_0x3a3324);})[_0x75fb('0x16')](function(_0x3459a3){_0x1852a8(_0x3459a3);});};AGIVertices['prototype']['googleASR']=function(_0x2709eb,_0x8511ee,_0xa6763b){scripts[_0x75fb('0x89')](_0x8511ee,_0x2709eb[_0x75fb('0x74')],_0x2709eb[_0x75fb('0x8a')]||_0x75fb('0x7f'))[_0x75fb('0x15')](function(_0x2fc32e){_0xa6763b(null,_0x2fc32e);})['catch'](function(_0x4bff9b){_0xa6763b(_0x4bff9b);});};AGIVertices[_0x75fb('0x12')]['tildeASR']=function(_0x235a89,_0x40f1ed,_0x27cc9e){scripts[_0x75fb('0x8b')](_0x40f1ed,_0x235a89['appid'],_0x235a89[_0x75fb('0x8c')],_0x235a89['uri'])[_0x75fb('0x15')](function(_0x4c1ed7){_0x27cc9e(null,_0x4c1ed7);})['catch'](function(_0x522830){_0x27cc9e(_0x522830);});};AGIVertices[_0x75fb('0x12')]['clear']=function(_0x4352bb){var _0x3376e0=_[_0x75fb('0x64')](verticesWithRetry,_0x4352bb[_0x75fb('0x8d')])?_0x4352bb:_[_0x75fb('0x8e')](_0x4352bb);for(var _0x55c747 in _0x3376e0){if(_0x3376e0[_0x75fb('0x8f')](_0x55c747)){if(_0x3376e0[_0x55c747]&&_[_0x75fb('0x90')](_0x3376e0[_0x55c747])){if(_[_0x75fb('0x64')](recursiveMapAttributes,_0x55c747)){_0x3376e0[_0x55c747]=this[_0x75fb('0x91')](_0x3376e0[_0x55c747]);}else{_0x3376e0[_0x55c747]=this[_0x75fb('0x92')](_0x3376e0[_0x55c747]);}}}}return _0x3376e0;};AGIVertices[_0x75fb('0x12')]['recursiveNodeIndex']=function(_0xe91a05){for(var _0x25e495 in _0xe91a05){if(_0xe91a05[_0x75fb('0x8f')](_0x25e495)){if(_[_0x75fb('0x93')](_0xe91a05[_0x25e495])){this['recursiveNodeIndex'](_0xe91a05[_0x25e495]);}else if(_[_0x75fb('0x94')](_0xe91a05[_0x25e495])){for(var _0x1a3a1b=0x0;_0x1a3a1b<_0xe91a05[_0x25e495][_0x75fb('0x95')];_0x1a3a1b++){this['recursiveNodeIndex'](_0xe91a05[_0x25e495][_0x1a3a1b]);}}else if(_['isString'](_0xe91a05[_0x25e495])){_0xe91a05[_0x25e495]=this[_0x75fb('0x92')](_0xe91a05[_0x25e495]);}}}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x96')]=function(_0x2877d3,_0xe1d9b4){for(var _0x317b21 in _0x2877d3){if(_0x2877d3[_0x75fb('0x8f')](_0x317b21)){if(_[_0x75fb('0x93')](_0x2877d3[_0x317b21])){if(!_[_0x75fb('0x44')](_0x2877d3[_0x317b21])){this[_0x75fb('0x96')](_0x2877d3[_0x317b21],util['format'](_0x75fb('0x97'),_0xe1d9b4,_0x317b21));}}else if(_['isArray'](_0x2877d3[_0x317b21])){for(var _0x37d8a5=0x0;_0x37d8a5<_0x2877d3[_0x317b21][_0x75fb('0x95')];_0x37d8a5++){this[_0x75fb('0x96')](_0x2877d3[_0x317b21][_0x37d8a5],util[_0x75fb('0x2a')]('%s.%s',_0xe1d9b4,_0x317b21+'['+_0x37d8a5+']'));}}else{if(!_[_0x75fb('0x45')](_0x2877d3[_0x317b21])){this['channel']['setVariable'](util[_0x75fb('0x2a')](_0x75fb('0x97'),_0xe1d9b4,_0x317b21),_0x2877d3[_0x317b21]);}}}}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x91')]=function(_0x2368a){try{var _0x46c343=JSON[_0x75fb('0x67')](_0x2368a);this[_0x75fb('0x98')](_0x46c343);return JSON[_0x75fb('0x6e')](_0x46c343);}catch(_0x254195){return this['replaceAllVariables'](_0x2368a);}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x92')]=function(_0x57ba5e){var _0x5f025e=_0x57ba5e[_0x75fb('0x99')]('{');for(var _0x5d34c1=0x1;_0x5d34c1<_0x5f025e[_0x75fb('0x95')];_0x5d34c1+=0x1){var _0x45875d=_0x5f025e[_0x5d34c1][_0x75fb('0x99')]('}');if(_0x45875d[_0x75fb('0x95')]>0x1){_0x57ba5e=_0x57ba5e[_0x75fb('0x9a')]('{'+_0x45875d[0x0]+'}',this[_0x75fb('0xf')][_0x75fb('0x13')](_0x45875d[0x0])['extra']||_0x45875d[0x0]);}}if(_0x5f025e[_0x75fb('0x95')]===0x1){return _0x57ba5e[_0x75fb('0x4d')]();}return this[_0x75fb('0x92')](_0x57ba5e);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x9b')]=function(_0xa9aef1,_0x3b7082){var _0x3fbe3e=this[_0x75fb('0xf')][_0x75fb('0x13')](_0xa9aef1);if(_0x3fbe3e[_0x75fb('0x9c')]===-0x1){return _0x3fbe3e;}logger['info'](util[_0x75fb('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3b7082,_0x3fbe3e[_0x75fb('0x9d')]));return this[_0x75fb('0xf')][_0x75fb('0x9e')](_0x3b7082,_0x3fbe3e[_0x75fb('0x9d')]);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x9f')]=function(_0x34a00e){return _0x34a00e&&_0x34a00e!=='0'&&_0x34a00e!=='-1'&&_0x34a00e!=='';};AGIVertices[_0x75fb('0x12')][_0x75fb('0xa0')]=function(_0x67a80f){this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x67a80f,'-');_0x67a80f[_0x75fb('0xa2')]=_0x67a80f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x75fb('0xa3')]=function(_0x58c768){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x58c768['label']));if(!this[_0x75fb('0x9f')](_0x58c768['text'])){return this[_0x75fb('0xf')]['noop'](_0x75fb('0xa4'));}var _0x3dd4ab='\x22'+_0x58c768[_0x75fb('0x5a')]+'\x22';if(this['isConfigured'](_0x58c768[_0x75fb('0x72')])){_0x3dd4ab+=','+_0x58c768[_0x75fb('0x72')];}var _0x12771e=this['channel'][_0x75fb('0xa5')](_0x75fb('0xa6'),_0x3dd4ab);if(_0x12771e[_0x75fb('0x9c')]===-0x1){return _0x12771e;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xa8'),_0x3dd4ab));};AGIVertices[_0x75fb('0x12')][_0x75fb('0xa9')]=function(_0x56bb24){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xaa'),_0x56bb24[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x56bb24[_0x75fb('0xab')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xac'));}var _0x8f23d1=_0x56bb24[_0x75fb('0xab')];if(this[_0x75fb('0x9f')](_0x56bb24[_0x75fb('0x72')])){_0x8f23d1+=','+_0x56bb24['options'];}var _0x6acc8b=this[_0x75fb('0xf')][_0x75fb('0xa5')]('MRCPRecog',_0x8f23d1);if(_0x6acc8b[_0x75fb('0x9c')]===-0x1){return _0x6acc8b;}var _0x2bd13b=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x2bd13b[_0x75fb('0x9c')]===-0x1){return _0x2bd13b;}var _0x55ef8b=this['getAndSetVariable'](_0x75fb('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x55ef8b['result']===-0x1){return _0x55ef8b;}var _0x59cbd4=this[_0x75fb('0x9b')](_0x75fb('0xae'),'MRCP_RECOG_INSTANCE');if(_0x59cbd4[_0x75fb('0x9c')]===-0x1){return _0x59cbd4;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xaf'),_0x8f23d1));};AGIVertices[_0x75fb('0x12')]['agi']=function(_0x22191b){logger['info'](util[_0x75fb('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x22191b['label']));return this[_0x75fb('0xf')][_0x75fb('0x7')]([_0x22191b[_0x75fb('0xb0')],_0x22191b[_0x75fb('0xb1')]]);};AGIVertices[_0x75fb('0x12')][_0x75fb('0xb2')]=function(_0x2ae6c9){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xb3'),_0x2ae6c9[_0x75fb('0x38')]));if(this['isConfigured'](_0x2ae6c9[_0x75fb('0x62')])){logger['info'](util[_0x75fb('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2ae6c9[_0x75fb('0x62')]));var _0x1d3ba4=this[_0x75fb('0xf')]['wait'](_0x2ae6c9['timeout']);if(_0x1d3ba4[_0x75fb('0x9c')]===-0x1){return _0x1d3ba4;}}return this['channel'][_0x75fb('0xb2')]();};AGIVertices[_0x75fb('0x12')][_0x75fb('0xb4')]=function(_0x268beb){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xb5'),_0x268beb['label']));if(!this[_0x75fb('0x9f')](_0x268beb['list_id'])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x268beb,_0x75fb('0xb6'));}_0x268beb[_0x75fb('0x4b')]=moment();if(this[_0x75fb('0x9f')](_0x268beb[_0x75fb('0xb7')])){_0x268beb[_0x75fb('0x4b')]=moment()[_0x75fb('0xb8')](_0x268beb[_0x75fb('0xb7')],_0x75fb('0xb9'));}if(!this[_0x75fb('0x9f')](_0x268beb[_0x75fb('0x4e')])){_0x268beb[_0x75fb('0x4e')]=0x2;}this[_0x75fb('0x43')][_0x75fb('0x6b')](this,_0x268beb);return this[_0x75fb('0xf')]['noop'](util[_0x75fb('0x2a')](_0x75fb('0xba'),_0x268beb[_0x75fb('0x49')],_0x268beb[_0x75fb('0x4a')],_0x268beb[_0x75fb('0x4b')]));};AGIVertices[_0x75fb('0x12')]['custom_app']=function(_0x1ca310){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0xbb'),_0x1ca310[_0x75fb('0x38')]));var _0x44b786=this[_0x75fb('0xf')][_0x75fb('0xa5')](_0x1ca310['application'],_0x1ca310['options']);if(_0x44b786[_0x75fb('0x9c')]===-0x1){return _0x44b786;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xbc'),_0x1ca310[_0x75fb('0xbd')],_0x1ca310[_0x75fb('0x72')]));};AGIVertices[_0x75fb('0x12')]['lumenvoxtts']=function(_0x1df081){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xbe'),_0x1df081[_0x75fb('0x38')]));if(!this['isConfigured'](_0x1df081[_0x75fb('0x5a')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xa4'));}var _0x2f7041='\x22'+_0x1df081[_0x75fb('0x5a')]+'\x22';if(this[_0x75fb('0x9f')](_0x1df081[_0x75fb('0x72')])){_0x2f7041+=','+_0x1df081[_0x75fb('0x72')];}var _0x23b015=this[_0x75fb('0xf')]['exec'](_0x75fb('0xa6'),_0x2f7041);if(_0x23b015[_0x75fb('0x9c')]===-0x1){return _0x23b015;}return this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0xa8'),_0x2f7041));};AGIVertices['prototype'][_0x75fb('0xbf')]=function(_0x4f9dfa){logger['info'](util[_0x75fb('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4f9dfa['label']));if(!this['isConfigured'](_0x4f9dfa[_0x75fb('0x5a')])){return this['channel'][_0x75fb('0xa7')](_0x75fb('0xa4'));}var _0x527544='\x22'+_0x4f9dfa[_0x75fb('0x5a')]+'\x22';if(this[_0x75fb('0x9f')](_0x4f9dfa['options'])){_0x527544+=','+_0x4f9dfa[_0x75fb('0x72')];}var _0x1b3acb=this['channel'][_0x75fb('0xa5')]('MRCPSynth',_0x527544);if(_0x1b3acb[_0x75fb('0x9c')]===-0x1){return _0x1b3acb;}return this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0xa8'),_0x527544));};AGIVertices[_0x75fb('0x12')][_0x75fb('0xc0')]=function(_0x59a9ec){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xc1'),_0x59a9ec[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x59a9ec['grammar'])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xac'));}var _0x56352a=_0x59a9ec[_0x75fb('0xab')];if(this['isConfigured'](_0x59a9ec['options'])){_0x56352a+=','+_0x59a9ec[_0x75fb('0x72')];}var _0x5b2ee0=this['channel'][_0x75fb('0xa5')]('MRCPRecog',_0x56352a);if(_0x5b2ee0['result']===-0x1){return _0x5b2ee0;}var _0x3377fc=this[_0x75fb('0x9b')](_0x75fb('0xc2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x3377fc[_0x75fb('0x9c')]===-0x1){return _0x3377fc;}var _0x22dbd1=this[_0x75fb('0x9b')](_0x75fb('0xad'),_0x75fb('0xc3'));if(_0x22dbd1[_0x75fb('0x9c')]===-0x1){return _0x22dbd1;}var _0x152de5=this[_0x75fb('0x9b')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x152de5[_0x75fb('0x9c')]===-0x1){return _0x152de5;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xaf'),_0x56352a));};AGIVertices[_0x75fb('0x12')][_0x75fb('0xc4')]=function(_0x20cc37){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xc5'),_0x20cc37['label']));if(!this[_0x75fb('0x9f')](_0x20cc37['grammar'])){return this[_0x75fb('0xf')]['noop']('no\x20grammar\x20configured');}var _0x1a4b55=_0x20cc37['grammar'];if(this[_0x75fb('0x9f')](_0x20cc37[_0x75fb('0x72')])){_0x1a4b55+=','+_0x20cc37[_0x75fb('0x72')];}var _0x2f9ed1=this[_0x75fb('0xf')][_0x75fb('0xa5')](_0x75fb('0xc6'),_0x1a4b55);if(_0x2f9ed1[_0x75fb('0x9c')]===-0x1){return _0x2f9ed1;}var _0x5bbf41=this[_0x75fb('0x9b')](_0x75fb('0xc2'),_0x75fb('0xc7'));if(_0x5bbf41[_0x75fb('0x9c')]===-0x1){return _0x5bbf41;}var _0x146413=this[_0x75fb('0x9b')]('RECOG_INPUT()',_0x75fb('0xc8'));if(_0x146413[_0x75fb('0x9c')]===-0x1){return _0x146413;}var _0x535480=this[_0x75fb('0x9b')](_0x75fb('0xae'),_0x75fb('0xc9'));if(_0x535480['result']===-0x1){return _0x535480;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util['format'](_0x75fb('0xaf'),_0x1a4b55));};AGIVertices[_0x75fb('0x12')]['database']=function(_0x574712){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0xca'),_0x574712[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x574712[_0x75fb('0xcb')])){return this[_0x75fb('0xf')]['error'](_0x574712,_0x75fb('0xcc'));}var _0xf57a4b=this[_0x75fb('0x1b')][_0x75fb('0x6b')](this,_0x574712[_0x75fb('0xcb')]);if(!_0xf57a4b){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x574712,_0x75fb('0xcd'));}if(!this['isConfigured'](_0x574712['query'])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x574712,_0x75fb('0xce'));}var _0x40347c=_0x574712[_0x75fb('0xcf')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xd0'),_0x40347c));var _0xdf93b8=this[_0x75fb('0x2c')][_0x75fb('0x6b')](this,_0xf57a4b,_0x40347c);this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x574712,_0x40347c);if(!this[_0x75fb('0x9f')](_0x574712['variable_id'])){return this[_0x75fb('0xf')]['noop'](_0x75fb('0xd1'));}var _0x421d62=this[_0x75fb('0x13')]['sync'](this,_0x574712['variable_id']);if(!_0x421d62){return this[_0x75fb('0xf')]['error'](_0x574712,_0x75fb('0xd2'));}var _0x33675d=this;_0xdf93b8[_0x75fb('0xd3')](function(_0x430c1e,_0x1fef50){Object[_0x75fb('0xd4')](_0x430c1e)[_0x75fb('0xd3')](function(_0x2daf6c){_0x33675d[_0x75fb('0xf')][_0x75fb('0x9e')](util[_0x75fb('0x2a')](_0x75fb('0xd5'),_0x421d62,_0x1fef50,_0x2daf6c),_0x430c1e[_0x2daf6c]);});});this[_0x75fb('0xf')][_0x75fb('0x9e')](util[_0x75fb('0x2a')](_0x75fb('0xd6'),_0x421d62),_0xdf93b8[_0x75fb('0x95')]);return this[_0x75fb('0xf')]['noop'](util['format']('variable\x20%s\x20set',_0x421d62));};AGIVertices['prototype'][_0x75fb('0xd7')]=function(_0x7148b7){logger[_0x75fb('0xd8')](util[_0x75fb('0x2a')](_0x75fb('0xd9'),_0x7148b7[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x7148b7[_0x75fb('0xda')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x7148b7,_0x75fb('0xdb'));}var _0x2159c6=this['getUser']['sync'](this,_0x7148b7[_0x75fb('0xda')]);if(!_0x2159c6){return this['channel'][_0x75fb('0x2e')](_0x7148b7,_0x75fb('0xdc'));}var _0x4cc51c=this[_0x75fb('0xf')][_0x75fb('0xa5')](_0x75fb('0xdd'),[util[_0x75fb('0x2a')]('SIP/%s',_0x2159c6),_0x7148b7[_0x75fb('0x62')],_0x7148b7['opts'],_0x7148b7['url']]);if(_0x4cc51c[_0x75fb('0x9c')]===-0x1){return _0x4cc51c;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xde'),_0x75fb('0xdd')));};AGIVertices[_0x75fb('0x12')]['dialogflow']=function(_0x4b9763){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0xdf'),_0x4b9763[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x4b9763[_0x75fb('0x74')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xe0'));}if(!this[_0x75fb('0x9f')](_0x4b9763[_0x75fb('0x5a')])){return this['channel'][_0x75fb('0xa7')](_0x75fb('0xa4'));}this[_0x75fb('0xf')][_0x75fb('0xe1')]=!![];this[_0x75fb('0xa1')](_0x4b9763);this['createSquareMessage'](_0x4b9763[_0x75fb('0x5a')],'in','','');this['channel']['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x4b9763['text']));var _0xb46849=this[_0x75fb('0x73')][_0x75fb('0x6b')](this,_0x4b9763);if(_0xb46849){for(var _0x3dcaa4 in _0xb46849){if(_0xb46849['hasOwnProperty'](_0x3dcaa4)){this[_0x75fb('0xf')][_0x75fb('0x9e')](util['format']('DIALOGFLOW_%s',_0x3dcaa4[_0x75fb('0xe2')]()),_0xb46849[_0x3dcaa4]);}}this[_0x75fb('0x42')](_0xb46849[_0x75fb('0xe3')],'out',_0x75fb('0xe4'),'');return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('Dialogflow\x20Result\x20%s',_0xb46849['speech']));}return this['channel']['error'](_0x4b9763,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x75fb('0x12')][_0x75fb('0xe5')]=function(_0x15944a){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x15944a[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x15944a['dialogflowV2_project_id'])){return this['channel'][_0x75fb('0xa7')](_0x75fb('0xe6'));}if(!this[_0x75fb('0x9f')](_0x15944a[_0x75fb('0xe7')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')]('no\x20client_email\x20configured');}if(!this[_0x75fb('0x9f')](_0x15944a[_0x75fb('0x77')])){return this[_0x75fb('0xf')]['noop']('no\x20private_key\x20configured');}if(!this[_0x75fb('0x9f')](_0x15944a[_0x75fb('0x78')])){return this['channel']['noop'](_0x75fb('0xe8'));}if(!this[_0x75fb('0x9f')](_0x15944a[_0x75fb('0x5a')])){return this[_0x75fb('0xf')]['noop'](_0x75fb('0xa4'));}this['channel'][_0x75fb('0xe1')]=!![];this['createSquareDetailsReport'](_0x15944a);this[_0x75fb('0x42')](_0x15944a[_0x75fb('0x5a')],'in','','');this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xe9'),_0x15944a[_0x75fb('0x5a')]));var _0x3975fa=this[_0x75fb('0x76')][_0x75fb('0x6b')](this,_0x15944a);if(_0x3975fa){for(var _0x45522c in _0x3975fa){if(_0x3975fa[_0x75fb('0x8f')](_0x45522c)){if(_0x45522c!==_0x75fb('0xea')){this[_0x75fb('0xf')]['setVariable'](util[_0x75fb('0x2a')]('DIALOGFLOW_%s',_0x45522c[_0x75fb('0xe2')]()),_0x3975fa[_0x45522c]);}}}this[_0x75fb('0x42')](_0x3975fa[_0x75fb('0xe3')],_0x75fb('0xeb'),_0x75fb('0xe5'),_0x3975fa['providerResponse']);return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('DialogflowV2\x20Result\x20%s',_0x3975fa[_0x75fb('0xe3')]));}return this['channel'][_0x75fb('0x2e')](_0x15944a,_0x75fb('0xec'));};AGIVertices[_0x75fb('0x12')][_0x75fb('0xed')]=function(_0x11a124){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0xee'),_0x11a124[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x11a124[_0x75fb('0xef')])){return this[_0x75fb('0xf')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x75fb('0x9f')](_0x11a124['username'])){return this['channel'][_0x75fb('0xa7')](_0x75fb('0xf0'));}if(!this[_0x75fb('0x9f')](_0x11a124[_0x75fb('0xf1')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x11a124[_0x75fb('0xf2')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xa4'));}this[_0x75fb('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x11a124);this[_0x75fb('0x42')](_0x11a124['text'],'in','','');this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0xf3'),_0x11a124['text']));var _0x231a92=this[_0x75fb('0x79')][_0x75fb('0x6b')](this,_0x11a124);if(_0x231a92){for(var _0x455ee4 in _0x231a92){if(_0x231a92['hasOwnProperty'](_0x455ee4)){this[_0x75fb('0xf')][_0x75fb('0x9e')](util[_0x75fb('0x2a')](_0x75fb('0xf4'),_0x455ee4['toUpperCase']()),_0x231a92[_0x455ee4]);}}this[_0x75fb('0x42')](_0x231a92[_0x75fb('0xe3')],'out','sesteknda','');if(_0x231a92['audiofile']){this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x231a92[_0x75fb('0xf5')]));var _0x23ad4a=this['channel'][_0x75fb('0xf6')](_0x231a92['audiofile']);try{fs[_0x75fb('0xf7')](_0x231a92[_0x75fb('0xf5')]+_0x75fb('0xf8'));}catch(_0x283ebb){logger[_0x75fb('0x2e')](_0x283ebb);}return _0x23ad4a;}else{return this['channel'][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xf9'),_0x231a92[_0x75fb('0xe3')]));}}return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x11a124,_0x75fb('0xfa'));};AGIVertices[_0x75fb('0x12')]['end']=function(_0x23b48e){logger[_0x75fb('0x30')](util['format'](_0x75fb('0xfb'),_0x23b48e[_0x75fb('0x38')]));return this[_0x75fb('0xf')][_0x75fb('0xa7')]('end');};AGIVertices['prototype'][_0x75fb('0xfc')]=function(_0x4254e8){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4254e8['label']));var _0x22b800='';if(_0x4254e8[_0x75fb('0xfd')]){if(!this[_0x75fb('0x9f')](_0x4254e8[_0x75fb('0xfd')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x4254e8,_0x75fb('0xfe'));}else{var _0xbd7ee0=parseInt(_0x4254e8[_0x75fb('0xfd')],0xa);if(isNaN(_0xbd7ee0)){_0x22b800=_0x4254e8[_0x75fb('0xfd')];}else{_0x22b800=this['getTrunk']['sync'](this,_0x4254e8[_0x75fb('0xfd')]);if(!_0x22b800){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x4254e8,_0x75fb('0xff'));}}}}else if(_0x4254e8[_0x75fb('0x100')]){_0x22b800=_0x4254e8[_0x75fb('0x100')];}else{return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x4254e8,'no\x20trunk\x20selected');}var _0x1ec372=this[_0x75fb('0xf')][_0x75fb('0xa5')](_0x75fb('0xdd'),[util[_0x75fb('0x2a')](_0x75fb('0x101'),_0x22b800,_0x4254e8[_0x75fb('0x49')]),_0x4254e8[_0x75fb('0x62')],_0x4254e8[_0x75fb('0x102')],_0x4254e8[_0x75fb('0x6c')]]);if(_0x1ec372[_0x75fb('0x9c')]===-0x1){return _0x1ec372;}return this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0xde'),_0x75fb('0xdd')));};AGIVertices[_0x75fb('0x12')]['finally']=function(_0x5c848c){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5c848c[_0x75fb('0x38')]));return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x103'));};AGIVertices[_0x75fb('0x12')][_0x75fb('0xd')]=function(_0x58507b){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x104'),_0x58507b[_0x75fb('0x38')]));if(_0x58507b['retry']===0x0){return this[_0x75fb('0xa0')](_0x58507b);}_0x58507b[_0x75fb('0xa2')]-=0x1;if(!this[_0x75fb('0x9f')](_0x58507b[_0x75fb('0x105')])){return this[_0x75fb('0xf')]['error'](_0x58507b,_0x75fb('0x106'));}var _0x1676af=this[_0x75fb('0x1f')][_0x75fb('0x6b')](this,_0x58507b['file_id']);if(!_0x1676af){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x58507b,_0x75fb('0x107'));}if(!this['isConfigured'](_0x58507b[_0x75fb('0x108')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x75fb('0xd1'));}var _0x2bc566=this[_0x75fb('0xf')][_0x75fb('0x109')](_0x1676af,_0x58507b[_0x75fb('0x10a')],_0x58507b[_0x75fb('0x10b')]);var _0x33cbc2=_0x2bc566[_0x75fb('0x9c')]?_0x2bc566[_0x75fb('0x9c')]['toString']():'';logger[_0x75fb('0x30')](_0x75fb('0x10c'),JSON[_0x75fb('0x6e')](_0x2bc566));if(_0x2bc566[_0x75fb('0x9c')]===-0x1){this[_0x75fb('0xa1')]['sync'](this,_0x58507b,_0x33cbc2);return _0x2bc566;}else if(_0x2bc566[_0x75fb('0x9d')]===_0x75fb('0x62')){_0x2bc566[_0x75fb('0x9c')]=_0x33cbc2[_0x75fb('0x95')]>=parseInt(_0x58507b[_0x75fb('0x10d')])?'x':'i';}else{_0x2bc566[_0x75fb('0x9c')]=_0x33cbc2[_0x75fb('0x95')]>=parseInt(_0x58507b['mindigit'])&&_0x33cbc2['length']<=parseInt(_0x58507b['maxdigit'])?'x':'i';}var _0x4ee94c=this[_0x75fb('0x13')][_0x75fb('0x6b')](this,_0x58507b[_0x75fb('0x108')]);if(!_0x4ee94c){return this[_0x75fb('0xf')]['error'](_0x58507b,_0x75fb('0xd2'));}this['channel'][_0x75fb('0x9e')](_0x4ee94c,_0x33cbc2);if(this[_0x75fb('0x9f')](_0x58507b['hiddendigitsnum'])){var _0x53adc6=parseInt(_0x58507b[_0x75fb('0x10e')],0xa);var _0x72eba3=rs[_0x75fb('0x10f')]({'charset':'*','length':_0x53adc6});var _0x1fcfba=_0x33cbc2[_0x75fb('0x95')];if(_0x1fcfba>0x0){if(_0x1fcfba>_0x53adc6){this[_0x75fb('0xa1')]['sync'](this,_0x58507b,_0x58507b[_0x75fb('0x110')]===_0x75fb('0x111')?_0x72eba3+_0x33cbc2[_0x75fb('0x112')](_0x53adc6):_0x33cbc2[_0x75fb('0x112')](0x0,_0x1fcfba-_0x53adc6)+_0x72eba3);}else{this['createSquareDetailsReport'][_0x75fb('0x6b')](this,_0x58507b,rs[_0x75fb('0x10f')]({'charset':'*','length':_0x1fcfba}));}}else{this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x58507b,'');}}else{this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x58507b,_0x33cbc2);}return _0x2bc566;};AGIVertices[_0x75fb('0x12')][_0x75fb('0xe')]=function(_0x6e8db7){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x6e8db7[_0x75fb('0x38')]));return this[_0x75fb('0xd')](_0x6e8db7);};AGIVertices['prototype'][_0x75fb('0x113')]=function(_0xc2d84b){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x114'),_0xc2d84b[_0x75fb('0x38')]));this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0xc2d84b,_0xc2d84b[_0x75fb('0x115')]);return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x116'),_0xc2d84b['goalname']));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x117')]=function(_0x1c6ae9){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x118'),_0x1c6ae9[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x1c6ae9[_0x75fb('0x86')])||!this[_0x75fb('0x9f')](_0x1c6ae9[_0x75fb('0x82')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x119'));}if(!this[_0x75fb('0x9f')](_0x1c6ae9[_0x75fb('0x5a')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xa4'));}this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x11a'),_0x1c6ae9[_0x75fb('0x5a')]));var _0x1d8324=this[_0x75fb('0x81')]['sync'](this,_0x1c6ae9);if(_0x1d8324){this[_0x75fb('0xf')]['noop'](util['format'](_0x75fb('0x11b'),_0x1d8324));var _0xd6bcc7=this['channel']['streamFile'](_0x1d8324);try{fs[_0x75fb('0xf7')](_0x1d8324+_0x75fb('0xf8'));}catch(_0x4ed997){logger[_0x75fb('0x2e')](_0x4ed997);}return _0xd6bcc7;}return this['channel'][_0x75fb('0x2e')](_0x1c6ae9,_0x75fb('0x11c'));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x11d')]=function(_0x10a13b){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x11e'),_0x10a13b[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x10a13b['aws_access_key_id'])||!this[_0x75fb('0x9f')](_0x10a13b[_0x75fb('0x82')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x119'));}if(!this[_0x75fb('0x9f')](_0x10a13b[_0x75fb('0x88')])){return this[_0x75fb('0xf')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x75fb('0x9f')](_0x10a13b[_0x75fb('0x5a')])){return this['channel']['noop'](_0x75fb('0xa4'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x10a13b);this['createSquareMessage'](_0x10a13b[_0x75fb('0x5a')],'in','','');this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x11f'),_0x10a13b['text']));var _0x53e488=this[_0x75fb('0x120')][_0x75fb('0x6b')](this,_0x10a13b);if(_0x53e488){for(var _0x41256d in _0x53e488){if(_0x53e488[_0x75fb('0x8f')](_0x41256d)&&_[_0x75fb('0x90')](_0x53e488[_0x41256d])){this[_0x75fb('0xf')][_0x75fb('0x9e')](util[_0x75fb('0x2a')](_0x75fb('0x121'),_0x41256d[_0x75fb('0xe2')]()),_0x53e488[_0x41256d]);}}if(_[_0x75fb('0x45')](_0x53e488[_0x75fb('0x71')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x122'));}else{this[_0x75fb('0x42')](_0x53e488[_0x75fb('0x71')],_0x75fb('0xeb'),_0x75fb('0x123'),'');return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x124'),_0x53e488['message']));}}return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x10a13b,_0x75fb('0x125'));};AGIVertices[_0x75fb('0x12')]['googleasr']=function(_0x5cca72){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5cca72[_0x75fb('0x38')],_0x5cca72[_0x75fb('0x62')]));if(!this[_0x75fb('0x9f')](_0x5cca72[_0x75fb('0x74')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')]('no\x20key\x20configured');}var _0x254c58=_0x75fb('0x126');var _0xe9bde8=util[_0x75fb('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x75fb('0x10f')](0x4));var _0x11cc8c=util[_0x75fb('0x2a')](_0x75fb('0x97'),_0xe9bde8,_0x254c58);var _0x122ffe=!![];if(_0x5cca72['beep']===_0x75fb('0x127')){_0x122ffe=![];}var _0x3d5997=this[_0x75fb('0xf')][_0x75fb('0x128')](_0xe9bde8,_0x254c58,_0x5cca72['intKey'],_0x5cca72['timeout'],undefined,_0x122ffe);if(_0x3d5997[_0x75fb('0x9c')]!==-0x1){this[_0x75fb('0xf')]['noop'](util['format'](_0x75fb('0x129'),_0x11cc8c));var _0x1696f6=this['googleASR'][_0x75fb('0x6b')](this,_0x5cca72,_0x11cc8c);if(_0x1696f6){for(var _0x7c94ff in _0x1696f6){if(_0x1696f6[_0x75fb('0x8f')](_0x7c94ff)){this[_0x75fb('0xf')][_0x75fb('0x9e')](util[_0x75fb('0x2a')](_0x75fb('0x12a'),_0x7c94ff[_0x75fb('0xe2')]()),_0x1696f6[_0x7c94ff]);}}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x12b'),JSON['stringify'](_0x1696f6)));}}return _0x3d5997;};AGIVertices[_0x75fb('0x12')][_0x75fb('0x12c')]=function(_0x3ddb5a){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3ddb5a[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x3ddb5a[_0x75fb('0x12d')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x12e'));}if(!this[_0x75fb('0x9f')](_0x3ddb5a[_0x75fb('0x8c')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x12f'));}var _0x2bf748=_0x75fb('0x126');var _0x441d88=util[_0x75fb('0x2a')](_0x75fb('0x130'),FILES_PATH,rs['generate'](0x4));var _0x418a68=util[_0x75fb('0x2a')]('%s.%s',_0x441d88,_0x2bf748);var _0x6cb6e2=!![];if(_0x3ddb5a[_0x75fb('0x131')]==='NOBEEP'){_0x6cb6e2=![];}var _0x34456d=this[_0x75fb('0xf')][_0x75fb('0x128')](_0x441d88,_0x2bf748,_0x3ddb5a['intKey'],_0x3ddb5a[_0x75fb('0x62')],undefined,_0x6cb6e2);if(_0x34456d[_0x75fb('0x9c')]!==-0x1){this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x132'),_0x418a68));var _0x5049b5=this[_0x75fb('0x8b')]['sync'](this,_0x3ddb5a,_0x418a68);if(_0x5049b5){for(var _0x19d8f1 in _0x5049b5){if(_0x5049b5[_0x75fb('0x8f')](_0x19d8f1)){this[_0x75fb('0xf')][_0x75fb('0x9e')](util[_0x75fb('0x2a')](_0x75fb('0x133'),_0x19d8f1[_0x75fb('0xe2')]()),_0x5049b5[_0x19d8f1]);}}return this['channel'][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x134'),JSON[_0x75fb('0x6e')](_0x5049b5)));}}return _0x34456d;};AGIVertices[_0x75fb('0x12')][_0x75fb('0x135')]=function(_0x33cdd0){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x33cdd0[_0x75fb('0x38')]));return this['channel']['continueAt'](_0x33cdd0[_0x75fb('0x3d')],_0x33cdd0[_0x75fb('0x3e')],_0x33cdd0['priority']);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x136')]=function(_0x53cf69){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x137'),_0x53cf69[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x53cf69[_0x75fb('0x138')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x53cf69,_0x75fb('0x139'));}try{var _0x52f495=eval(_0x53cf69['condition'])?_0x75fb('0x13a'):_0x75fb('0x13b');this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0x13c'),_0x53cf69[_0x75fb('0x138')],_0x52f495));return{'code':0xc8,'result':_0x52f495};}catch(_0x2a76da){return{'code':0xc8,'result':_0x75fb('0x13b')};}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x13d')]=function(_0x4e8855){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x13e'),_0x4e8855['label']));if(!this[_0x75fb('0x9f')](_0x4e8855[_0x75fb('0x13f')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x4e8855,_0x75fb('0x140'));}var _0x459ddf=this[_0x75fb('0x24')][_0x75fb('0x6b')](this,_0x4e8855[_0x75fb('0x13f')]);if(!_0x459ddf){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x4e8855,_0x75fb('0x141'));}for(var _0xd965a3=0x0;_0xd965a3<_0x459ddf['length'];_0xd965a3+=0x1){var _0x27a210=this[_0x75fb('0xf')]['getVariable'](util[_0x75fb('0x2a')](_0x75fb('0x142'),_0x459ddf[_0xd965a3]));if(_0x27a210['result']===-0x1){return _0x27a210;}logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x143'),_0x459ddf[_0xd965a3],_0x27a210[_0x75fb('0x9d')]));if(_0x27a210[_0x75fb('0x9d')]===_0x75fb('0x13a')){logger[_0x75fb('0x30')](util['format']('IFTIME\x20%s\x20%s',_0x459ddf[_0xd965a3],_0x75fb('0x13a')));this['channel'][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x143'),_0x459ddf[_0xd965a3],_0x75fb('0x13a')));return{'code':0xc8,'result':_0x75fb('0x13a')};}else{logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x143'),_0x459ddf[_0xd965a3],_0x75fb('0x13b')));this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('IFTIME\x20%s\x20%s',_0x459ddf[_0xd965a3],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x75fb('0x12')][_0x75fb('0x144')]=function(_0xb7643b){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x145'),_0xb7643b[_0x75fb('0x38')]));return this[_0x75fb('0xf')][_0x75fb('0x144')]();};AGIVertices[_0x75fb('0x12')][_0x75fb('0x146')]=function(_0x576d42){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x147'),_0x576d42[_0x75fb('0x38')]));if(!this['isConfigured'](_0x576d42[_0x75fb('0x74')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xe0'));}var _0x5d56f6=_0x75fb('0x126');var _0x8d689=util[_0x75fb('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x75fb('0x10f')](0x4));var _0x4638ce=util[_0x75fb('0x2a')](_0x75fb('0x97'),_0x8d689,_0x5d56f6);var _0x1de71e=!![];if(_0x576d42['beep']===_0x75fb('0x127')){_0x1de71e=![];}var _0x41e50c=this[_0x75fb('0xf')][_0x75fb('0x128')](_0x8d689,_0x5d56f6,_0x576d42[_0x75fb('0x148')],_0x576d42[_0x75fb('0x62')],undefined,_0x1de71e);if(_0x41e50c[_0x75fb('0x9c')]!==-0x1){this[_0x75fb('0xf')]['noop'](util[_0x75fb('0x2a')]('ispeech\x20%s\x20file\x20created',_0x4638ce));var _0x5e4917=this[_0x75fb('0x7d')][_0x75fb('0x6b')](this,_0x576d42,_0x4638ce);if(_0x5e4917){for(var _0xf8990f in _0x5e4917){if(_0x5e4917[_0x75fb('0x8f')](_0xf8990f)){this[_0x75fb('0xf')]['setVariable'](util[_0x75fb('0x2a')](_0x75fb('0x149'),_0xf8990f[_0x75fb('0xe2')]()),_0x5e4917[_0xf8990f]);}}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x14a'),JSON['stringify'](_0x5e4917)));}}return _0x41e50c;};AGIVertices[_0x75fb('0x12')][_0x75fb('0x14b')]=function(_0x3b3931){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3b3931[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x3b3931[_0x75fb('0x74')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xe0'));}if(!this[_0x75fb('0x9f')](_0x3b3931['text'])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xa4'));}this['channel'][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x14c'),_0x3b3931[_0x75fb('0x5a')]));var _0x3525b=this[_0x75fb('0x7a')][_0x75fb('0x6b')](this,_0x3b3931);if(_0x3525b){this[_0x75fb('0xf')]['noop'](util[_0x75fb('0x2a')]('ispeech\x20%s\x20file\x20created',_0x3525b));var _0x1b5dc3=this[_0x75fb('0xf')]['streamFile'](_0x3525b,_0x3b3931['intKey']);try{fs[_0x75fb('0xf7')](_0x3525b+_0x75fb('0xf8'));}catch(_0x4bbeea){logger[_0x75fb('0x2e')](_0x4bbeea);}return _0x1b5dc3;}return this[_0x75fb('0xf')]['error'](_0x3b3931,_0x75fb('0x14d'));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x14e')]=function(_0x127585){logger[_0x75fb('0x30')](util['format'](_0x75fb('0x14f'),_0x127585[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x127585[_0x75fb('0x150')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x127585,_0x75fb('0x151'));}logger[_0x75fb('0x30')](util['format'](_0x75fb('0x152'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x127585[_0x75fb('0x150')]));var _0x4eff6f=this['agentLogin'][_0x75fb('0x6b')](this,_0x127585['findBy']);if(_0x4eff6f){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x127585['findBy']));this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0x153'),this[_0x75fb('0xf')]['callerid'],_0x127585['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x75fb('0x30')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x127585['findBy']));this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x127585[_0x75fb('0x150')]));return{'code':0xc8,'result':_0x75fb('0x154')};}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x155')]=function(_0xf5ad87){logger['info'](util[_0x75fb('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xf5ad87[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0xf5ad87[_0x75fb('0x150')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0xf5ad87,_0x75fb('0x151'));}logger[_0x75fb('0x30')](util['format'](_0x75fb('0x152'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0xf5ad87['findBy']));var _0x17df86=this[_0x75fb('0x54')][_0x75fb('0x6b')](this,_0xf5ad87[_0x75fb('0x150')]);if(_0x17df86){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x153'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0xf5ad87['findBy']));this[_0x75fb('0xf')]['noop'](util[_0x75fb('0x2a')](_0x75fb('0x153'),this[_0x75fb('0xf')]['callerid'],_0xf5ad87['findBy']));return{'code':0xc8,'result':_0x75fb('0x156')};}else{logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x157'),this['channel']['callerid'],_0xf5ad87[_0x75fb('0x150')]));this['channel'][_0x75fb('0xa7')](util['format'](_0x75fb('0x157'),this[_0x75fb('0xf')]['callerid'],_0xf5ad87[_0x75fb('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x158')]=function(_0x15469a){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x159'),_0x15469a[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x15469a[_0x75fb('0x15a')])){return this['channel']['error'](_0x15469a,'no\x20operation\x20configured');}this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('math\x20%s',_0x15469a[_0x75fb('0x15a')]));var _0x46d803=eval(_0x15469a[_0x75fb('0x15a')]);if(!this['isConfigured'](_0x15469a[_0x75fb('0x108')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xd1'));}var _0x2e9895=this[_0x75fb('0x13')][_0x75fb('0x6b')](this,_0x15469a[_0x75fb('0x108')]);if(!_0x2e9895){return this['channel']['error'](_0x15469a,_0x75fb('0xd2'));}if(_[_0x75fb('0x94')](_0x46d803)){var _0x3bd82f=this;_0x46d803[_0x75fb('0xd3')](function(_0x447462,_0x33acb3){_0x3bd82f[_0x75fb('0xf')]['setVariable'](util[_0x75fb('0x2a')](_0x75fb('0x15b'),_0x2e9895,_0x33acb3),_0x447462);});return this['channel'][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x15c'),_0x2e9895));}else{return this[_0x75fb('0xf')][_0x75fb('0x9e')](_0x2e9895,_0x46d803);}};AGIVertices[_0x75fb('0x12')][_0x75fb('0xc')]=function(_0x100017){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x15d'),_0x100017[_0x75fb('0x38')]));if(_0x100017[_0x75fb('0xa2')]===0x0){return this['maxRetry'](_0x100017);}_0x100017[_0x75fb('0xa2')]-=0x1;if(!this[_0x75fb('0x9f')](_0x100017[_0x75fb('0x105')])){return this['channel']['error'](_0x100017,_0x75fb('0x106'));}var _0x10c913=this[_0x75fb('0x1f')]['sync'](this,_0x100017[_0x75fb('0x105')]);if(!_0x10c913){return this[_0x75fb('0xf')]['error'](_0x100017,_0x75fb('0x107'));}var _0x37aa08=this[_0x75fb('0xf')][_0x75fb('0x109')](_0x10c913,_0x100017[_0x75fb('0x10a')],_0x100017['digit']);var _0x748a96=_0x37aa08['result'];if(_0x37aa08['result']===-0x1){this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x100017,'-1');return _0x37aa08;}else if(_0x37aa08[_0x75fb('0x9d')]===_0x75fb('0x62')){_0x37aa08['result']=_0x37aa08[_0x75fb('0x9c')][_0x75fb('0x95')]>0x0?_0x37aa08[_0x75fb('0x9c')]:'t';}else if(_[_0x75fb('0x44')](_0x37aa08['result'])){_0x37aa08[_0x75fb('0x9c')]='#';_0x748a96='#';}if(!this[_0x75fb('0x9f')](_0x100017['variable_id'])){this[_0x75fb('0xf')]['noop'](_0x75fb('0xd1'));}else{var _0x182de5=this[_0x75fb('0x13')][_0x75fb('0x6b')](this,_0x100017[_0x75fb('0x108')]);if(!_0x182de5){return this[_0x75fb('0xf')]['error'](_0x100017,_0x75fb('0xd2'));}this['channel'][_0x75fb('0x9e')](_0x182de5,_0x748a96);}this[_0x75fb('0xa1')]['sync'](this,_0x100017,_0x748a96);return _0x37aa08;};AGIVertices[_0x75fb('0x12')][_0x75fb('0xa7')]=function(_0x8c8172){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x8c8172[_0x75fb('0x38')]));return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x8c8172[_0x75fb('0x15e')]||_0x8c8172['label']);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x15f')]=function(_0x4bbda5){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x160'),_0x4bbda5['label']));if(!this[_0x75fb('0x9f')](_0x4bbda5[_0x75fb('0x150')])){return this['channel']['error'](_0x4bbda5,_0x75fb('0x151'));}logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x152'),this['channel'][_0x75fb('0x3a')],_0x4bbda5[_0x75fb('0x150')]));var _0xeb5bfd=this[_0x75fb('0x4f')][_0x75fb('0x6b')](this,_0x4bbda5[_0x75fb('0x161')]);var _0x1a4902=this['agentPause'][_0x75fb('0x6b')](this,_0x4bbda5[_0x75fb('0x150')],_0xeb5bfd);if(_0x1a4902){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x153'),this['channel']['callerid'],_0x4bbda5['findBy']));this['channel'][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x153'),this['channel']['callerid'],_0x4bbda5[_0x75fb('0x150')]));return{'code':0xc8,'result':_0x75fb('0x156')};}else{logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x157'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x4bbda5[_0x75fb('0x150')]));this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x75fb('0x3a')],_0x4bbda5[_0x75fb('0x150')]));return{'code':0xc8,'result':_0x75fb('0x154')};}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x162')]=function(_0x434e89){logger[_0x75fb('0x30')](util['format'](_0x75fb('0x163'),_0x434e89[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x434e89['file_id'])){return this[_0x75fb('0xf')]['error'](_0x434e89,_0x75fb('0x106'));}var _0x4b368b=this[_0x75fb('0x1f')][_0x75fb('0x6b')](this,_0x434e89['file_id']);if(!_0x4b368b){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x434e89,_0x75fb('0x107'));}var _0xeef912=this[_0x75fb('0xf')]['exec'](_0x75fb('0x164'),[_0x4b368b,_0x434e89[_0x75fb('0x102')]]);if(_0xeef912[_0x75fb('0x9c')]===-0x1){return _0xeef912;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util['format'](_0x75fb('0xbc'),'PLAYBACK',_0x4b368b));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x165')]=function(_0xd21e2d){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x166'),_0xd21e2d[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0xd21e2d[_0x75fb('0x167')])){return this['channel'][_0x75fb('0x2e')](_0xd21e2d,'no\x20queue\x20selected');}var _0x40e58c='';var _0x13ea72=parseInt(_0xd21e2d[_0x75fb('0x167')],0xa);if(isNaN(_0x13ea72)){_0x40e58c=_0xd21e2d[_0x75fb('0x167')];}else{_0x40e58c=this[_0x75fb('0x17')]['sync'](this,_0xd21e2d[_0x75fb('0x167')]);if(!_0x40e58c){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0xd21e2d,'no\x20queue\x20found');}}var _0x4d47c4='';if(this[_0x75fb('0x9f')](_0xd21e2d[_0x75fb('0x105')])){var _0x3db3b1=this[_0x75fb('0x1f')]['sync'](this,_0xd21e2d[_0x75fb('0x105')]);if(_0x3db3b1){_0x4d47c4=_0x3db3b1;}}this['createSquareDetailsReport'][_0x75fb('0x6b')](this,_0xd21e2d,_0x40e58c);if(_0xd21e2d[_0x75fb('0x102')]['indexOf']('x')<0x0){_0xd21e2d[_0x75fb('0x102')]+='x';}if(_0xd21e2d[_0x75fb('0x102')][_0x75fb('0x168')]('X')<0x0){_0xd21e2d[_0x75fb('0x102')]+='X';}this[_0x75fb('0xf')][_0x75fb('0x9e')](_0x75fb('0x169'),_0x40e58c?_0x40e58c[_0x75fb('0x16a')]():'');var _0x3d899d=this[_0x75fb('0xf')]['exec'](_0x75fb('0x16b'),[_0x40e58c,_0xd21e2d['opts'],_0xd21e2d[_0x75fb('0x6c')],_0x4d47c4,_0xd21e2d['timeout'],_0xd21e2d['agi'],_0xd21e2d[_0x75fb('0x16c')],_0xd21e2d[_0x75fb('0x16d')],'',_0xd21e2d[_0x75fb('0x16e')]]);if(_0x3d899d['result']===-0x1){return _0x3d899d;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xbc'),'QUEUE',_0x40e58c));};AGIVertices[_0x75fb('0x12')]['record']=function(_0x3503a9){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x16f'),_0x3503a9[_0x75fb('0x38')]));var _0x282311=_0x3503a9[_0x75fb('0x170')]||_0x75fb('0x126');var _0x3b3a99=util[_0x75fb('0x2a')](_0x75fb('0x171'),this['channel'][_0x75fb('0x37')],rs['generate'](0x5));var _0x3231e5=util[_0x75fb('0x2a')](_0x75fb('0x172'),FILES_PATH,_0x3b3a99,_0x282311);var _0x52c4eb=util['format'](_0x75fb('0x130'),FILES_PATH,_0x3b3a99);this[_0x75fb('0x3b')]['sync'](this,_0x3503a9,_0x3b3a99,_0x3231e5);this[_0x75fb('0xf')][_0x75fb('0x9e')](_0x75fb('0x173'),_0x3b3a99);logger[_0x75fb('0x30')](_0x75fb('0x174'),_0x52c4eb,_0x282311,_0x3503a9['escape_digits'],_0x3503a9['timeout']);return this[_0x75fb('0xf')][_0x75fb('0x128')](_0x52c4eb,_0x282311,_0x3503a9[_0x75fb('0x175')],_0x3503a9[_0x75fb('0x62')],undefined,!![]);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x176')]=function(_0xc065a5){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x177'),_0xc065a5[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0xc065a5[_0x75fb('0x6c')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x178'));}var _0x1b806f=this[_0x75fb('0x60')][_0x75fb('0x6b')](this,_0xc065a5);logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x179'),util[_0x75fb('0x17a')](_0x1b806f,{'showHidden':![],'depth':null})));if(!this[_0x75fb('0x9f')](_0xc065a5['variable_id'])){return this['channel'][_0x75fb('0xa7')](_0x75fb('0x17b'));}var _0x19d081=this[_0x75fb('0x13')][_0x75fb('0x6b')](this,_0xc065a5[_0x75fb('0x108')]);if(!_0x19d081){return this['channel'][_0x75fb('0x2e')](_0xc065a5,'no\x20variable\x20found');}this[_0x75fb('0xf')][_0x75fb('0x9e')](util['format']('%s_STATUS_CODE',_0x19d081),_0x1b806f[_0x75fb('0x70')]?_0x1b806f[_0x75fb('0x70')]:_0x75fb('0x17c'));this[_0x75fb('0xf')][_0x75fb('0x9e')](util['format'](_0x75fb('0x17d'),_0x19d081),_0x1b806f['statusMessage']?_0x1b806f[_0x75fb('0x17e')]:'OK');if(_0x1b806f['body']){try{this[_0x75fb('0x96')](_0x1b806f['body'],_0x19d081);}catch(_0x4d665f){logger[_0x75fb('0x2e')](util[_0x75fb('0x2a')](_0x75fb('0x17f'),_0x19d081));}}return this[_0x75fb('0xf')]['noop'](util[_0x75fb('0x2a')](_0x75fb('0x180'),_0x19d081));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x181')]=function(_0x41ba12){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x182'),_0x41ba12[_0x75fb('0x38')]));return this[_0x75fb('0xf')]['sayDigits'](_0x41ba12['digits'][_0x75fb('0x183')](/\s+/g,''),_0x41ba12['escape_digits']);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x184')]=function(_0x23aafe){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x185'),_0x23aafe[_0x75fb('0x38')]));return this[_0x75fb('0xf')][_0x75fb('0x186')](_0x23aafe[_0x75fb('0x63')][_0x75fb('0x183')](/\s+/g,''),_0x23aafe['escape_digits']);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x187')]=function(_0x3c017b){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x188'),_0x3c017b['label']));return this['channel'][_0x75fb('0x189')](_0x3c017b[_0x75fb('0x5a')],_0x3c017b[_0x75fb('0x175')]);};AGIVertices[_0x75fb('0x12')]['sendMail']=function(_0x2c1e32){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2c1e32[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x2c1e32[_0x75fb('0x18a')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x18b'));}var _0x189bb3=this[_0x75fb('0x22')][_0x75fb('0x6b')](this,_0x2c1e32[_0x75fb('0x18a')]);if(!_0x189bb3||!_0x189bb3[_0x75fb('0x18c')]){return this[_0x75fb('0xf')]['error'](_0x2c1e32,_0x75fb('0x18d'));}var _0x5f0970={'from':util[_0x75fb('0x2a')](_0x75fb('0x18e'),_0x189bb3['name'],_0x189bb3['email']||_0x189bb3[_0x75fb('0x18c')][_0x75fb('0x18f')]),'to':_0x2c1e32['to']||'','cc':_0x2c1e32['cc']||'','bcc':_0x2c1e32['bcc']||'','subject':_0x2c1e32['subject'],'html':_0x2c1e32['text'],'text':_0x2c1e32[_0x75fb('0x5a')]};var _0xe8cb1b={'tls':{'rejectUnauthorized':![]}};if(_0x189bb3[_0x75fb('0x18c')][_0x75fb('0x190')]){_0xe8cb1b[_0x75fb('0x190')]=_0x189bb3['Smtp'][_0x75fb('0x190')];}else{_0xe8cb1b[_0x75fb('0x191')]=_0x189bb3['Smtp']['host'];_0xe8cb1b[_0x75fb('0x192')]=_0x189bb3[_0x75fb('0x18c')]['port'];_0xe8cb1b[_0x75fb('0x193')]=_0x189bb3[_0x75fb('0x18c')][_0x75fb('0x193')];}if(_0x189bb3['Smtp'][_0x75fb('0x194')]){_0xe8cb1b[_0x75fb('0x195')]={'user':_0x189bb3[_0x75fb('0x18c')][_0x75fb('0x18f')],'pass':_0x189bb3[_0x75fb('0x18c')][_0x75fb('0x196')]};}if(this[_0x75fb('0x9f')](_0x2c1e32[_0x75fb('0x197')])){}logger[_0x75fb('0xd8')]('sendMail\x20message',JSON[_0x75fb('0x6e')](_0x5f0970));this[_0x75fb('0xa1')]['sync'](this,_0x2c1e32,_0x2c1e32['account_id']);this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x198'),_0x189bb3['name']));this[_0x75fb('0x23')][_0x75fb('0x6b')](this,_0xe8cb1b,_0x5f0970);return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x199'));};AGIVertices[_0x75fb('0x12')]['sendFax']=function(_0x4ffe32){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x19a'),_0x4ffe32[_0x75fb('0x38')]));return this[_0x75fb('0xf')][_0x75fb('0xa7')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x75fb('0x12')][_0x75fb('0x19b')]=function(_0x59b3fa){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x19c'),_0x59b3fa['label']));if(!this[_0x75fb('0x9f')](_0x59b3fa['sms_account_id'])){return this[_0x75fb('0xf')][_0x75fb('0xa7')]('no\x20sms\x20account\x20configured');}var _0x24603c=this['getSmsAccount'][_0x75fb('0x6b')](this,_0x59b3fa[_0x75fb('0x19d')]);if(!_0x24603c){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x59b3fa,_0x75fb('0x19e'));}var _0x253fb7={'body':_0x59b3fa[_0x75fb('0x19f')],'phone':_0x59b3fa['to']||'','SmsAccountId':_0x24603c['id']};logger[_0x75fb('0xd8')](_0x75fb('0x1a0'),JSON[_0x75fb('0x6e')](_0x253fb7));this['createSquareDetailsReport']['sync'](this,_0x59b3fa,_0x59b3fa[_0x75fb('0x19d')]);this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x1a1'),_0x24603c[_0x75fb('0x19')]));this['createSmsMessage']['sync'](this,_0x253fb7);return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x1a2'));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1a3')]=function(_0x48b51f){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x1a4'),_0x48b51f[_0x75fb('0x38')]));if(!this['isConfigured'](_0x48b51f['variable_id'])){return this[_0x75fb('0xf')]['error'](_0x48b51f,_0x75fb('0x1a5'));}var _0xe06e49=this[_0x75fb('0x13')][_0x75fb('0x6b')](this,_0x48b51f[_0x75fb('0x108')]);if(!_0xe06e49){return this['channel'][_0x75fb('0x2e')](_0x48b51f,'no\x20variable\x20found');}return this[_0x75fb('0xf')]['setVariable'](_0xe06e49,_0x48b51f[_0x75fb('0x1a6')]);};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1a7')]=function(_0x3de4f3){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x1a8'),_0x3de4f3['label']));this['channel'][_0x75fb('0xa7')](_0x75fb('0x1a9'));if(_0x3de4f3['answer']===_0x75fb('0x1aa')){this[_0x75fb('0xf')][_0x75fb('0xa7')]('Answer');return this[_0x75fb('0xf')][_0x75fb('0xb2')]();}return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x1ab'));};AGIVertices['prototype'][_0x75fb('0x1ac')]=function(_0x5ec2e4){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')](_0x75fb('0x1ad'),_0x5ec2e4[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x5ec2e4[_0x75fb('0x1ae')])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x5ec2e4,_0x75fb('0x1af'));}var _0x34f03a=this['getSquareProject'][_0x75fb('0x6b')](this,_0x5ec2e4[_0x75fb('0x1ae')]);if(!this[_0x75fb('0x9f')](_0x34f03a)){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x5ec2e4,util[_0x75fb('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5ec2e4['project_id']));}if(_0x34f03a===this[_0x75fb('0xf')][_0x75fb('0x39')]){return this['channel'][_0x75fb('0x2e')](_0x5ec2e4,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x5ec2e4,_0x34f03a);var _0x3ce1d2=this[_0x75fb('0xf')][_0x75fb('0xa5')](_0x75fb('0x1b0'),util[_0x75fb('0x2a')](_0x75fb('0x1b1'),config[_0x75fb('0x7')][_0x75fb('0x191')]||_0x75fb('0x1b2'),_0x34f03a,this[_0x75fb('0xf')][_0x75fb('0x39')]));if(_0x3ce1d2[_0x75fb('0x9c')]===-0x1){return _0x3ce1d2;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xbc'),'AGI',_0x34f03a));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1b3')]=function(_0x316b65){logger[_0x75fb('0x30')](util['format'](_0x75fb('0x1b4'),_0x316b65['label']));var _0x21ff19=this[_0x75fb('0x1b5')][_0x75fb('0x6b')](this,_0x316b65['command']);this[_0x75fb('0xa1')][_0x75fb('0x6b')](this,_0x316b65,_0x316b65['command']);if(this[_0x75fb('0x9f')](_0x316b65[_0x75fb('0x108')])){var _0x248cfc=this['getVariable'][_0x75fb('0x6b')](this,_0x316b65[_0x75fb('0x108')]);if(_0x248cfc){this[_0x75fb('0xf')][_0x75fb('0x9e')](_0x248cfc,_0x21ff19);return this[_0x75fb('0xf')][_0x75fb('0xa7')](util['format'](_0x75fb('0x1b6'),_0x316b65[_0x75fb('0xb0')],_0x248cfc));}}return this[_0x75fb('0xf')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x316b65[_0x75fb('0xb0')]));};AGIVertices['prototype'][_0x75fb('0x1b7')]=function(_0x293fca){logger[_0x75fb('0x30')](util[_0x75fb('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x293fca[_0x75fb('0x38')]));_0x293fca['text']=_0x293fca[_0x75fb('0x5a')][_0x75fb('0x183')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x75fb('0x9f')](_0x293fca[_0x75fb('0x1b8')])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0x1b9'));}if(!this['isConfigured'](_0x293fca[_0x75fb('0x5a')])){return this['channel'][_0x75fb('0xa7')](_0x75fb('0xa4'));}this[_0x75fb('0xf')]['noop'](util[_0x75fb('0x2a')](_0x75fb('0x1ba'),_0x293fca['text']));var _0x57963e=this[_0x75fb('0x58')][_0x75fb('0x6b')](this,_0x293fca);if(_0x57963e){this['channel']['noop'](util[_0x75fb('0x2a')](_0x75fb('0x1bb'),_0x57963e));var _0x490041=this[_0x75fb('0xf')][_0x75fb('0xf6')](_0x57963e);try{fs[_0x75fb('0xf7')](_0x57963e+'.wav');}catch(_0x48b3c9){logger[_0x75fb('0x2e')](_0x48b3c9);}return _0x490041;}return this[_0x75fb('0xf')]['error'](_0x293fca,_0x75fb('0x1bc'));};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1bd')]=function(_0x166eca){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x1be'),_0x166eca[_0x75fb('0x38')]));_0x166eca['text']=_0x166eca[_0x75fb('0x5a')][_0x75fb('0x183')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x75fb('0x9f')](_0x166eca['text'])){return this[_0x75fb('0xf')][_0x75fb('0xa7')](_0x75fb('0xa4'));}this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x1bf'),_0x166eca[_0x75fb('0x5a')]));var _0x22958e=this[_0x75fb('0x5e')][_0x75fb('0x6b')](this,_0x166eca);if(_0x22958e){this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x22958e));var _0x282e0a=this[_0x75fb('0xf')][_0x75fb('0xf6')](_0x22958e);try{fs[_0x75fb('0xf7')](_0x22958e+_0x75fb('0xf8'));}catch(_0x3176b5){logger['error'](_0x3176b5);}return _0x282e0a;}return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x166eca,_0x75fb('0x1c0'));};AGIVertices['prototype']['unpause']=function(_0x555cb6){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x555cb6[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x555cb6[_0x75fb('0x150')])){return this[_0x75fb('0xf')]['error'](_0x555cb6,_0x75fb('0x151'));}logger[_0x75fb('0x30')](util['format'](_0x75fb('0x152'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x555cb6[_0x75fb('0x150')]));var _0x516291=this[_0x75fb('0x52')]['sync'](this,_0x555cb6['findBy']);if(_0x516291){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x153'),this['channel']['callerid'],_0x555cb6[_0x75fb('0x150')]));this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0x153'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x555cb6[_0x75fb('0x150')]));return{'code':0xc8,'result':_0x75fb('0x156')};}else{logger['info'](util['format'](_0x75fb('0x157'),this[_0x75fb('0xf')][_0x75fb('0x3a')],_0x555cb6[_0x75fb('0x150')]));this[_0x75fb('0xf')]['noop'](util['format'](_0x75fb('0x157'),this['channel'][_0x75fb('0x3a')],_0x555cb6[_0x75fb('0x150')]));return{'code':0xc8,'result':_0x75fb('0x154')};}};AGIVertices[_0x75fb('0x12')][_0x75fb('0x1c1')]=function(_0x287269){logger[_0x75fb('0x30')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x287269[_0x75fb('0x38')]));var _0xb27e2c=this[_0x75fb('0xf')][_0x75fb('0xa5')](_0x75fb('0x1c2'),[_0x287269[_0x75fb('0x1c3')],_0x287269[_0x75fb('0x72')]]);if(_0xb27e2c[_0x75fb('0x9c')]===-0x1){return _0xb27e2c;}return this[_0x75fb('0xf')][_0x75fb('0xa7')](util[_0x75fb('0x2a')](_0x75fb('0xbc'),'VOICEMAIL',_0x287269[_0x75fb('0x1c3')]));};AGIVertices[_0x75fb('0x12')]['vswitch']=function(_0x5cde46){logger['info'](util[_0x75fb('0x2a')](_0x75fb('0x1c4'),_0x5cde46[_0x75fb('0x38')]));if(!this[_0x75fb('0x9f')](_0x5cde46['variable_id'])){return this[_0x75fb('0xf')][_0x75fb('0x2e')](_0x5cde46,'no\x20variable\x20selected');}var _0xac7db8=this['getVariable'][_0x75fb('0x6b')](this,_0x5cde46[_0x75fb('0x108')]);if(!_0xac7db8){return this['channel'][_0x75fb('0x2e')](_0x5cde46,'no\x20variable\x20found');}var _0x38b03c=this['channel'][_0x75fb('0x13')](_0xac7db8);return{'code':0xc8,'result':_0x38b03c[_0x75fb('0x9d')]?_0x38b03c[_0x75fb('0x9d')]:'-'};};String[_0x75fb('0x12')][_0x75fb('0x9a')]=function(_0x1dfba4,_0x47698f){return this[_0x75fb('0x99')](_0x1dfba4)[_0x75fb('0x1c5')](_0x47698f);};module[_0x75fb('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 145c87b..f95f6cb 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 _0xa8a8=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','interface','ACW','mandatoryDisposition','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer'];(function(_0x2a670f,_0x1aef2b){var _0x2e7770=function(_0x2c51d8){while(--_0x2c51d8){_0x2a670f['push'](_0x2a670f['shift']());}};_0x2e7770(++_0x1aef2b);}(_0xa8a8,0xec));var _0x8a8a=function(_0x249fd1,_0x5462ea){_0x249fd1=_0x249fd1-0x0;var _0x549362=_0xa8a8[_0x249fd1];return _0x549362;};'use strict';var util=require(_0x8a8a('0x0'));var _=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var ami=require(_0x8a8a('0x3'));var logger=require('../../../config/logger')(_0x8a8a('0x4'));var RpcUser=require(_0x8a8a('0x5'));var RpcVoiceAgentReport=require(_0x8a8a('0x6'));function Acw(_0x3ed1de){this[_0x8a8a('0x7')]=_0x3ed1de[_0x8a8a('0x7')];this[_0x8a8a('0x8')]=_0x3ed1de[_0x8a8a('0x8')];this[_0x8a8a('0x9')]=_0x3ed1de[_0x8a8a('0x9')];this[_0x8a8a('0xa')]={};ami['on'](_0x8a8a('0xb'),this[_0x8a8a('0xc')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x8a8a('0xf'),this['syncHangup'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x10'),this['syncAgentRingNoAnswer'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x11'),this[_0x8a8a('0x12')]['bind'](this));ami['on'](_0x8a8a('0x13'),this[_0x8a8a('0x14')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x15'),this['syncAgentConnectPreview'][_0x8a8a('0xd')](this));}function getDiff(_0x4e5d74){var _0x25e1d5=moment()[_0x8a8a('0x16')](0x0);var _0x787eec=moment(_0x4e5d74)[_0x8a8a('0x16')](0x0);return _0x25e1d5[_0x8a8a('0x17')](_0x787eec,_0x8a8a('0x18'));}Acw[_0x8a8a('0x19')]['startAcw']=function(_0x1ed3be){try{var _0x568b83=this;var _0x1f36b6=this[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x1a')];var _0x4291e9=this[_0x8a8a('0xa')][_0x1ed3be]['queue'];var _0x9d55f9=this[_0x8a8a('0x7')][_0x4291e9];var _0x262ca9=![];var _0x2bce13=_0x8a8a('0x1b');if(_0x9d55f9[_0x8a8a('0x1c')]){if(_0x9d55f9['mandatoryDispositionPause']['name']){_0x262ca9=!![];_0x2bce13=_0x9d55f9['mandatoryDispositionPause']['name'];}}ami['Action']({'action':_0x8a8a('0x1d'),'interface':_0x1f36b6,'paused':!![],'reason':_0x2bce13})[_0x8a8a('0x1e')](function(_0xe0f449){if(_0x568b83[_0x8a8a('0x8')][_0x1f36b6]){return RpcUser[_0x8a8a('0x1f')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6]['id'])[_0x8a8a('0x1e')](function(_0xe0321c){if(_0xe0321c&&!_0xe0321c[_0x8a8a('0x20')]){logger[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x1ed3be,_0x1f36b6,_0x4291e9);var _0x3aa2bb=_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x23')]&&_0x568b83[_0x8a8a('0xa')][_0x1ed3be]['destlinkedid']?_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x24')]:_0x1ed3be;return RpcUser[_0x8a8a('0x25')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6],_0x2bce13,_0x3aa2bb)[_0x8a8a('0x1e')](function(_0x251315){if(!_0x262ca9){_0x568b83[_0x8a8a('0x9')][_0x1f36b6]={};logger['info'](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);_0x568b83['timers'][_0x1f36b6]['timer']=setTimeout(_0x568b83[_0x8a8a('0x28')][_0x8a8a('0xd')](_0x568b83,_0x1f36b6),_0x568b83['voiceQueues'][_0x4291e9]['acwTimeout']*0x3e8);_0x568b83['timers'][_0x1f36b6][_0x8a8a('0x29')]=moment()['format'](_0x8a8a('0x2a'));_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid']=_0x1ed3be;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2b')]=_0x4291e9;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2c')]=function(){var _0x41802e=getDiff(_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x29')]);clearTimeout(_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['timer']);_0x568b83['timers'][_0x1f36b6]['timer']=![];RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x41802e},_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid'],_0x1f36b6)[_0x8a8a('0x1e')](function(_0x304e83){logger['info'](_0x8a8a('0x2e'),_0x1ed3be,_0x41802e,_0x304e83);})[_0x8a8a('0x2f')](function(_0x63b9be){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1ed3be,_0x63b9be);});delete _0x568b83[_0x8a8a('0x9')][_0x1f36b6];};}});}else{logger['info'](_0x8a8a('0x30'),_0x1ed3be,_0x1f36b6,_0x4291e9);}});}})[_0x8a8a('0x2f')](function(_0x3ecbca){logger[_0x8a8a('0x31')](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);})[_0x8a8a('0x32')](function(){delete _0x568b83[_0x8a8a('0xa')][_0x1ed3be];});}catch(_0xf7d4d7){logger[_0x8a8a('0x31')](_0x8a8a('0x33'),_0xf7d4d7[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x28')]=function(_0xac4c53){try{var _0x8e3017=this;if(_0x8e3017[_0x8a8a('0x9')][_0xac4c53]){_0x8e3017['timers'][_0xac4c53]['timer']=![];var _0x53da01=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x35')];var _0x376de3=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x2b')];var _0x508e67=_0x8e3017['voiceQueues'][_0x376de3][_0x8a8a('0x27')];logger['info'](_0x8a8a('0x36'),_0xac4c53);RpcUser['saveUnpause'](this['agents'][_0xac4c53]);RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x508e67,'agentacw':!![]},_0x53da01,_0xac4c53)[_0x8a8a('0x1e')](function(_0x285e2c){logger[_0x8a8a('0x21')](_0x8a8a('0x2e'),_0x53da01,_0x508e67,_0x285e2c);})[_0x8a8a('0x2f')](function(_0x20584a){logger['error'](_0x8a8a('0x37'),_0x53da01,_0x20584a);});}else{logger[_0x8a8a('0x31')](_0x8a8a('0x38'),_0xac4c53);if(_0x8e3017['timers']){logger[_0x8a8a('0x21')](_0x8a8a('0x39'),JSON[_0x8a8a('0x3a')](_0x8e3017['timers']));}}}catch(_0x3fda48){logger[_0x8a8a('0x31')](_0x8a8a('0x3b'),_0x3fda48[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0xc')]=function(_0x4ffdd9){try{if(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]][_0x8a8a('0x4')]||this['voiceQueues'][_0x4ffdd9['queue']][_0x8a8a('0x1c')])){if(this[_0x8a8a('0x8')][_0x4ffdd9[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x4ffdd9['uniqueid']]={'queue':_0x4ffdd9[_0x8a8a('0x2b')],'interface':_0x4ffdd9['interface'],'destlinkedid':_0x4ffdd9[_0x8a8a('0x24')]};}}}catch(_0x1629dc){logger['error'](_0x8a8a('0x3c'),_0x1629dc[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAgentConnectPreview']=function(_0x177f89){try{if(this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x177f89['queue']][_0x8a8a('0x4')]||this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]['mandatoryDisposition'])){if(this[_0x8a8a('0x8')][_0x177f89[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x177f89[_0x8a8a('0x35')]]={'queue':_0x177f89[_0x8a8a('0x2b')],'interface':_0x177f89[_0x8a8a('0x1a')]};}}}catch(_0x13c233){logger[_0x8a8a('0x31')](_0x8a8a('0x3d'),_0x13c233[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncHangupRequest']=function(_0x1ad19b){try{if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]&&_[_0x8a8a('0x3e')](this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]['attended'])){logger[_0x8a8a('0x21')](_0x8a8a('0x3f'),_0x1ad19b[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x1ad19b['uniqueid']);}else if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x41')]]&&_[_0x8a8a('0x3e')](this['channels'][_0x1ad19b['linkedid']][_0x8a8a('0x23')])){logger[_0x8a8a('0x21')](_0x8a8a('0x42'),_0x1ad19b[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x1ad19b[_0x8a8a('0x41')]);}}catch(_0x1d1b5c){logger[_0x8a8a('0x31')](_0x8a8a('0x43'),_0x1d1b5c['message']);}};Acw['prototype'][_0x8a8a('0x44')]=function(_0x10f689){try{if(this['channels'][_0x10f689['uniqueid']]&&this[_0x8a8a('0xa')][_0x10f689['uniqueid']][_0x8a8a('0x23')]){logger['info'](_0x8a8a('0x45'),_0x10f689[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x35')]);}else if(this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]]&&this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]][_0x8a8a('0x23')]){logger[_0x8a8a('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x10f689[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x41')]);}}catch(_0x1e3bf5){logger[_0x8a8a('0x31')]('[ACW][syncHangup]\x20%s',_0x1e3bf5[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAttendedTransfer']=function(_0x5c5cb6){try{if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]])){this[_0x8a8a('0x40')](_0x5c5cb6[_0x8a8a('0x47')]);if(this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']]){this['channels'][_0x5c5cb6['secondtransfereruniqueid']][_0x8a8a('0x23')]=!![];this['channels'][_0x5c5cb6[_0x8a8a('0x48')]]=this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x49')]];}}else if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6['transfertargetuniqueid']])){this[_0x8a8a('0x40')](_0x5c5cb6['transfertargetuniqueid']);if(this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]]){this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]][_0x8a8a('0x23')]=!![];this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]]=this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]];}}}catch(_0x5b029e){logger['error'](_0x8a8a('0x4b'),_0x5b029e['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x395564){try{if(this[_0x8a8a('0xa')][_0x395564['transfereruniqueid']]){logger[_0x8a8a('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x395564[_0x8a8a('0x4c')]));this[_0x8a8a('0x40')](_0x395564['transfereruniqueid']);}else if(this[_0x8a8a('0xa')][_0x395564[_0x8a8a('0x4d')]]){logger[_0x8a8a('0x21')](_0x8a8a('0x4e'),JSON[_0x8a8a('0x3a')](_0x395564[_0x8a8a('0x4d')]));this['startAcw'](_0x395564[_0x8a8a('0x4d')]);}}catch(_0x402b5f){logger['error'](_0x8a8a('0x4f'),_0x402b5f[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x50')]=function(_0x3c2f8d){try{if(this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]]&&this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]][_0x8a8a('0x51')]==='all'){if(this[_0x8a8a('0x8')][_0x3c2f8d[_0x8a8a('0x1a')]]){logger['info'](_0x8a8a('0x52'),_0x3c2f8d[_0x8a8a('0x35')],_0x3c2f8d[_0x8a8a('0x1a')],_0x3c2f8d[_0x8a8a('0x2b')]);return RpcUser[_0x8a8a('0x25')](this['agents'][_0x3c2f8d[_0x8a8a('0x1a')]],_0x8a8a('0x53'),_0x3c2f8d[_0x8a8a('0x35')]);}}}catch(_0x2984eb){logger[_0x8a8a('0x31')](_0x8a8a('0x54'),_0x2984eb[_0x8a8a('0x34')]);}};module['exports']=Acw; \ No newline at end of file +var _0xeec6=['savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','interface','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncAgentRingNoAnswer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid'];(function(_0x178f14,_0x331f97){var _0x17bd5f=function(_0x568fc0){while(--_0x568fc0){_0x178f14['push'](_0x178f14['shift']());}};_0x17bd5f(++_0x331f97);}(_0xeec6,0x1c2));var _0x6eec=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xeec6[_0x45cd35];return _0x16db84;};'use strict';var util=require(_0x6eec('0x0'));var _=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var ami=require(_0x6eec('0x3'));var logger=require('../../../config/logger')(_0x6eec('0x4'));var RpcUser=require(_0x6eec('0x5'));var RpcVoiceAgentReport=require(_0x6eec('0x6'));function Acw(_0x2d7a15){this[_0x6eec('0x7')]=_0x2d7a15[_0x6eec('0x7')];this['agents']=_0x2d7a15[_0x6eec('0x8')];this[_0x6eec('0x9')]=_0x2d7a15['timers'];this[_0x6eec('0xa')]={};ami['on'](_0x6eec('0xb'),this[_0x6eec('0xc')][_0x6eec('0xd')](this));ami['on']('hanguprequest',this[_0x6eec('0xe')][_0x6eec('0xd')](this));ami['on'](_0x6eec('0xf'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x6eec('0x10')][_0x6eec('0xd')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6eec('0xd')](this));ami['on']('blindtransfer',this[_0x6eec('0x11')][_0x6eec('0xd')](this));ami['on'](_0x6eec('0x12'),this[_0x6eec('0x13')][_0x6eec('0xd')](this));}function getDiff(_0x49fccb){var _0x25e2a5=moment()[_0x6eec('0x14')](0x0);var _0x462dbb=moment(_0x49fccb)[_0x6eec('0x14')](0x0);return _0x25e2a5[_0x6eec('0x15')](_0x462dbb,_0x6eec('0x16'));}Acw[_0x6eec('0x17')][_0x6eec('0x18')]=function(_0x34a7fc){try{var _0x2ac797=this;var _0x5e2a9b=this[_0x6eec('0xa')][_0x34a7fc]['interface'];var _0x38c9a4=this[_0x6eec('0xa')][_0x34a7fc]['queue'];var _0x3ee353=this[_0x6eec('0x7')][_0x38c9a4];var _0xb1eab7=![];var _0x56c78b=_0x6eec('0x19');if(_0x3ee353[_0x6eec('0x1a')]){if(_0x3ee353[_0x6eec('0x1b')][_0x6eec('0x1c')]){_0xb1eab7=!![];_0x56c78b=_0x3ee353[_0x6eec('0x1b')][_0x6eec('0x1c')];}}ami['Action']({'action':_0x6eec('0x1d'),'interface':_0x5e2a9b,'paused':!![],'reason':_0x56c78b})[_0x6eec('0x1e')](function(_0x132652){if(_0x2ac797[_0x6eec('0x8')][_0x5e2a9b]){return RpcUser[_0x6eec('0x1f')](_0x2ac797[_0x6eec('0x8')][_0x5e2a9b]['id'])['then'](function(_0x6e40b3){if(_0x6e40b3&&!_0x6e40b3[_0x6eec('0x20')]){logger[_0x6eec('0x21')](_0x6eec('0x22'),_0x34a7fc,_0x5e2a9b,_0x38c9a4);var _0x409b26=_0x2ac797[_0x6eec('0xa')][_0x34a7fc]['attended']&&_0x2ac797[_0x6eec('0xa')][_0x34a7fc][_0x6eec('0x23')]?_0x2ac797[_0x6eec('0xa')][_0x34a7fc][_0x6eec('0x23')]:_0x34a7fc;return RpcUser[_0x6eec('0x24')](_0x2ac797[_0x6eec('0x8')][_0x5e2a9b],_0x56c78b,_0x409b26)[_0x6eec('0x1e')](function(_0x20bed3){if(!_0xb1eab7){_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]={};logger['info'](_0x6eec('0x25'),_0x34a7fc,_0x2ac797[_0x6eec('0x7')][_0x38c9a4][_0x6eec('0x26')],_0x5e2a9b,_0x38c9a4);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['timer']=setTimeout(_0x2ac797[_0x6eec('0x27')][_0x6eec('0xd')](_0x2ac797,_0x5e2a9b),_0x2ac797['voiceQueues'][_0x38c9a4]['acwTimeout']*0x3e8);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['lastPauseAt']=moment()[_0x6eec('0x28')](_0x6eec('0x29'));_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2a')]=_0x34a7fc;_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2b')]=_0x38c9a4;_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2c')]=function(){var _0x1abd19=getDiff(_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['lastPauseAt']);clearTimeout(_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['timer']);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2d')]=![];RpcVoiceAgentReport[_0x6eec('0x2e')]({'acwtime':_0x1abd19},_0x2ac797['timers'][_0x5e2a9b]['uniqueid'],_0x5e2a9b)['then'](function(_0x183ce3){logger[_0x6eec('0x21')](_0x6eec('0x2f'),_0x34a7fc,_0x1abd19,_0x183ce3);})[_0x6eec('0x30')](function(_0x20c794){logger[_0x6eec('0x31')](_0x6eec('0x32'),_0x34a7fc,_0x20c794);});delete _0x2ac797[_0x6eec('0x9')][_0x5e2a9b];};}});}else{logger[_0x6eec('0x21')](_0x6eec('0x33'),_0x34a7fc,_0x5e2a9b,_0x38c9a4);}});}})[_0x6eec('0x30')](function(_0x4382df){logger['error'](_0x6eec('0x25'),_0x34a7fc,_0x2ac797[_0x6eec('0x7')][_0x38c9a4][_0x6eec('0x26')],_0x5e2a9b,_0x38c9a4);})['finally'](function(){delete _0x2ac797[_0x6eec('0xa')][_0x34a7fc];});}catch(_0x193732){logger[_0x6eec('0x31')](_0x6eec('0x34'),_0x193732[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')]['stopAcw']=function(_0x45cfb6){try{var _0x1f10ff=this;if(_0x1f10ff[_0x6eec('0x9')][_0x45cfb6]){_0x1f10ff['timers'][_0x45cfb6]['timer']=![];var _0x28e5fa=_0x1f10ff[_0x6eec('0x9')][_0x45cfb6][_0x6eec('0x2a')];var _0x3f79d1=_0x1f10ff[_0x6eec('0x9')][_0x45cfb6]['queue'];var _0x223dfa=_0x1f10ff[_0x6eec('0x7')][_0x3f79d1][_0x6eec('0x26')];logger[_0x6eec('0x21')](_0x6eec('0x36'),_0x45cfb6);RpcUser[_0x6eec('0x37')](this[_0x6eec('0x8')][_0x45cfb6]);RpcVoiceAgentReport[_0x6eec('0x2e')]({'acwtime':_0x223dfa,'agentacw':!![]},_0x28e5fa,_0x45cfb6)['then'](function(_0x2f7a75){logger[_0x6eec('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x28e5fa,_0x223dfa,_0x2f7a75);})['catch'](function(_0x160fc0){logger[_0x6eec('0x31')](_0x6eec('0x32'),_0x28e5fa,_0x160fc0);});}else{logger[_0x6eec('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x45cfb6);if(_0x1f10ff['timers']){logger[_0x6eec('0x21')]('[ACW][TIMERS]',JSON['stringify'](_0x1f10ff[_0x6eec('0x9')]));}}}catch(_0xe523b9){logger[_0x6eec('0x31')](_0x6eec('0x38'),_0xe523b9[_0x6eec('0x35')]);}};Acw['prototype'][_0x6eec('0xc')]=function(_0x3a4d25){try{if(this['voiceQueues'][_0x3a4d25[_0x6eec('0x2b')]]&&(this[_0x6eec('0x7')][_0x3a4d25['queue']][_0x6eec('0x4')]||this[_0x6eec('0x7')][_0x3a4d25['queue']][_0x6eec('0x1a')])){if(this[_0x6eec('0x8')][_0x3a4d25[_0x6eec('0x39')]]){this[_0x6eec('0xa')][_0x3a4d25['uniqueid']]={'queue':_0x3a4d25[_0x6eec('0x2b')],'interface':_0x3a4d25[_0x6eec('0x39')],'destlinkedid':_0x3a4d25[_0x6eec('0x23')]};}}}catch(_0x165498){logger[_0x6eec('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x165498['message']);}};Acw[_0x6eec('0x17')][_0x6eec('0x13')]=function(_0x3703b5){try{if(this[_0x6eec('0x7')][_0x3703b5[_0x6eec('0x2b')]]&&(this['voiceQueues'][_0x3703b5[_0x6eec('0x2b')]]['acw']||this[_0x6eec('0x7')][_0x3703b5[_0x6eec('0x2b')]][_0x6eec('0x1a')])){if(this['agents'][_0x3703b5[_0x6eec('0x39')]]){this[_0x6eec('0xa')][_0x3703b5[_0x6eec('0x2a')]]={'queue':_0x3703b5[_0x6eec('0x2b')],'interface':_0x3703b5[_0x6eec('0x39')]};}}}catch(_0x4be225){logger[_0x6eec('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4be225['message']);}};Acw[_0x6eec('0x17')]['syncHangupRequest']=function(_0x245a1b){try{if(this[_0x6eec('0xa')][_0x245a1b[_0x6eec('0x2a')]]&&_['isUndefined'](this['channels'][_0x245a1b[_0x6eec('0x2a')]][_0x6eec('0x3a')])){logger[_0x6eec('0x21')](_0x6eec('0x3b'),_0x245a1b[_0x6eec('0x2a')]);this[_0x6eec('0x18')](_0x245a1b[_0x6eec('0x2a')]);}else if(this[_0x6eec('0xa')][_0x245a1b[_0x6eec('0x3c')]]&&_[_0x6eec('0x3d')](this['channels'][_0x245a1b['linkedid']][_0x6eec('0x3a')])){logger[_0x6eec('0x21')](_0x6eec('0x3e'),_0x245a1b['linkedid']);this[_0x6eec('0x18')](_0x245a1b[_0x6eec('0x3c')]);}}catch(_0x16c0da){logger[_0x6eec('0x31')](_0x6eec('0x3f'),_0x16c0da[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x40')]=function(_0x5a6e05){try{if(this[_0x6eec('0xa')][_0x5a6e05[_0x6eec('0x2a')]]&&this[_0x6eec('0xa')][_0x5a6e05[_0x6eec('0x2a')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5a6e05[_0x6eec('0x2a')]);this[_0x6eec('0x18')](_0x5a6e05[_0x6eec('0x2a')]);}else if(this[_0x6eec('0xa')][_0x5a6e05['linkedid']]&&this['channels'][_0x5a6e05[_0x6eec('0x3c')]][_0x6eec('0x3a')]){logger[_0x6eec('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5a6e05[_0x6eec('0x3c')]);this[_0x6eec('0x18')](_0x5a6e05[_0x6eec('0x3c')]);}}catch(_0xf957c1){logger[_0x6eec('0x31')](_0x6eec('0x41'),_0xf957c1[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x42')]=function(_0x4e921a){try{if(!_[_0x6eec('0x43')](this['channels'][_0x4e921a[_0x6eec('0x44')]])){this[_0x6eec('0x18')](_0x4e921a[_0x6eec('0x44')]);if(this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]]){this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]]['attended']=!![];this[_0x6eec('0xa')][_0x4e921a['transfertargetuniqueid']]=this[_0x6eec('0xa')][_0x4e921a['secondtransfereruniqueid']];delete this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]];}}else if(!_[_0x6eec('0x43')](this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x46')]])){this[_0x6eec('0x18')](_0x4e921a[_0x6eec('0x46')]);if(this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x47')]]){this[_0x6eec('0xa')][_0x4e921a['origtransfereruniqueid']]['attended']=!![];this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x44')]]=this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x47')]];delete this[_0x6eec('0xa')][_0x4e921a['origtransfereruniqueid']];}}}catch(_0x1d8fb1){logger[_0x6eec('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x1d8fb1['message']);}};Acw['prototype'][_0x6eec('0x11')]=function(_0x3dfd47){try{if(this['channels'][_0x3dfd47[_0x6eec('0x48')]]){logger[_0x6eec('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x6eec('0x49')](_0x3dfd47[_0x6eec('0x48')]));this[_0x6eec('0x18')](_0x3dfd47[_0x6eec('0x48')]);}else if(this['channels'][_0x3dfd47['transfererlinkedid']]){logger[_0x6eec('0x21')](_0x6eec('0x4a'),JSON[_0x6eec('0x49')](_0x3dfd47[_0x6eec('0x4b')]));this[_0x6eec('0x18')](_0x3dfd47[_0x6eec('0x4b')]);}}catch(_0x169607){logger[_0x6eec('0x31')](_0x6eec('0x4c'),_0x169607[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x10')]=function(_0x2799ca){try{if(this[_0x6eec('0x7')][_0x2799ca[_0x6eec('0x2b')]]&&this[_0x6eec('0x7')][_0x2799ca[_0x6eec('0x2b')]]['autopause']===_0x6eec('0x4d')){if(this[_0x6eec('0x8')][_0x2799ca['interface']]){logger[_0x6eec('0x21')](_0x6eec('0x4e'),_0x2799ca['uniqueid'],_0x2799ca[_0x6eec('0x39')],_0x2799ca[_0x6eec('0x2b')]);return RpcUser[_0x6eec('0x24')](this[_0x6eec('0x8')][_0x2799ca['interface']],_0x6eec('0x4f'),_0x2799ca[_0x6eec('0x2a')]);}}}catch(_0x3a9a5b){logger[_0x6eec('0x31')](_0x6eec('0x50'),_0x3a9a5b[_0x6eec('0x35')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e7ee813..3e02ec8 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 _0x3ce5=['action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x3ce5,0x1a0));var _0x53ce=function(_0x44f8ab,_0x51a9b7){_0x44f8ab=_0x44f8ab-0x0;var _0xcab3dd=_0x3ce5[_0x44f8ab];return _0xcab3dd;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x53ce('0x0'));var moment=require('moment');var util=require(_0x53ce('0x1'));var _=require(_0x53ce('0x2'));var logger=require(_0x53ce('0x3'))(_0x53ce('0x4'));var config=require(_0x53ce('0x5'));var ami=new Manager(config[_0x53ce('0x6')][_0x53ce('0x7')],config[_0x53ce('0x6')]['ip'],config['asterisk'][_0x53ce('0x8')],config[_0x53ce('0x6')][_0x53ce('0x9')],!![]);ami[_0x53ce('0xa')]();ami[_0x53ce('0xb')]=BPromise[_0x53ce('0xc')](ami[_0x53ce('0xd')]);function error(_0x598c54){logger[_0x53ce('0xe')](util[_0x53ce('0xf')](_0x53ce('0x10'),config[_0x53ce('0x6')][_0x53ce('0x8')],config[_0x53ce('0x6')]['ip'],config['asterisk'][_0x53ce('0x7')],util[_0x53ce('0x11')](_0x598c54,![],null)));}function close(){logger[_0x53ce('0xe')](util[_0x53ce('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x53ce('0x6')][_0x53ce('0x8')],config[_0x53ce('0x6')]['ip'],config[_0x53ce('0x6')][_0x53ce('0x7')]));}ami[_0x53ce('0x12')]=function(){return function(){return ami[_0x53ce('0xb')]({'action':_0x53ce('0x13')});};};ami[_0x53ce('0x14')]=function(){return function(){return ami['Action']({'action':_0x53ce('0x15')});};};ami[_0x53ce('0x16')]=function(){return function(){return ami[_0x53ce('0xb')]({'action':_0x53ce('0x17')});};};ami[_0x53ce('0x18')]=function(){return function(){return ami['Action']({'action':_0x53ce('0x19')});};};ami[_0x53ce('0x1a')]=function(){return function(){return ami[_0x53ce('0xb')]({'action':_0x53ce('0x1b')});};};function connect(_0x13c031){logger[_0x53ce('0x1c')](util['format'](_0x53ce('0x1d'),config['asterisk'][_0x53ce('0x8')],config[_0x53ce('0x6')]['ip'],config['asterisk'][_0x53ce('0x7')]));ami[_0x53ce('0x1e')](_0x53ce('0xe'),error);ami[_0x53ce('0x1e')](_0x53ce('0x1f'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x3cd998){logger['info'](util[_0x53ce('0xf')](_0x53ce('0x20'),config[_0x53ce('0x6')]['username'],config['asterisk']['ip'],config[_0x53ce('0x6')]['port'],util[_0x53ce('0x11')](_0x3cd998,![],null)));});ami['on']('fullybooted',function(_0x32666a){logger[_0x53ce('0x1c')](util[_0x53ce('0xf')](_0x53ce('0x21'),config['asterisk'][_0x53ce('0x8')],config[_0x53ce('0x6')]['ip'],config['asterisk'][_0x53ce('0x7')]));return BPromise[_0x53ce('0x22')]()[_0x53ce('0x23')](ami[_0x53ce('0x12')]())[_0x53ce('0x23')](ami['actionDeviceStateList']())[_0x53ce('0x23')](ami[_0x53ce('0x16')]())[_0x53ce('0x23')](ami[_0x53ce('0x18')]())[_0x53ce('0x23')](ami['actionCoreShowChannels']())[_0x53ce('0x24')](function(_0xf069da){console[_0x53ce('0x25')](_0xf069da);});});ami[_0x53ce('0x1e')](_0x53ce('0xe'),error);ami[_0x53ce('0x1e')](_0x53ce('0x1f'),close);module[_0x53ce('0x26')]=ami; \ No newline at end of file +var _0x1fa5=['util','lodash','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','resolve','then','catch','exports','asterisk-manager','bluebird','moment'];(function(_0x2f7bd9,_0xe151e6){var _0x59da8b=function(_0x12c78a){while(--_0x12c78a){_0x2f7bd9['push'](_0x2f7bd9['shift']());}};_0x59da8b(++_0xe151e6);}(_0x1fa5,0x99));var _0x51fa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1fa5[_0x432682];return _0x463d05;};'use strict';var Manager=require(_0x51fa('0x0'));var BPromise=require(_0x51fa('0x1'));var moment=require(_0x51fa('0x2'));var util=require(_0x51fa('0x3'));var _=require(_0x51fa('0x4'));var logger=require('../../config/logger')(_0x51fa('0x5'));var config=require(_0x51fa('0x6'));var ami=new Manager(config[_0x51fa('0x7')]['port'],config[_0x51fa('0x7')]['ip'],config[_0x51fa('0x7')][_0x51fa('0x8')],config[_0x51fa('0x7')][_0x51fa('0x9')],!![]);ami[_0x51fa('0xa')]();ami[_0x51fa('0xb')]=BPromise[_0x51fa('0xc')](ami[_0x51fa('0xd')]);function error(_0x4217c0){logger['error'](util[_0x51fa('0xe')](_0x51fa('0xf'),config[_0x51fa('0x7')][_0x51fa('0x8')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x51fa('0x10')](_0x4217c0,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x51fa('0x8')],config[_0x51fa('0x7')]['ip'],config['asterisk'][_0x51fa('0x11')]));}ami[_0x51fa('0x12')]=function(){return function(){return ami[_0x51fa('0xb')]({'action':_0x51fa('0x13')});};};ami[_0x51fa('0x14')]=function(){return function(){return ami[_0x51fa('0xb')]({'action':_0x51fa('0x15')});};};ami[_0x51fa('0x16')]=function(){return function(){return ami['Action']({'action':_0x51fa('0x17')});};};ami[_0x51fa('0x18')]=function(){return function(){return ami[_0x51fa('0xb')]({'action':_0x51fa('0x19')});};};ami[_0x51fa('0x1a')]=function(){return function(){return ami[_0x51fa('0xb')]({'action':_0x51fa('0x1b')});};};function connect(_0x449f18){logger['info'](util[_0x51fa('0xe')](_0x51fa('0x1c'),config[_0x51fa('0x7')][_0x51fa('0x8')],config[_0x51fa('0x7')]['ip'],config[_0x51fa('0x7')][_0x51fa('0x11')]));ami[_0x51fa('0x1d')]('error',error);ami[_0x51fa('0x1d')](_0x51fa('0x1e'),close);}ami['on'](_0x51fa('0x1f'),connect);ami['on']('shutdown',function(_0x41351e){logger['info'](util['format'](_0x51fa('0x20'),config[_0x51fa('0x7')][_0x51fa('0x8')],config[_0x51fa('0x7')]['ip'],config[_0x51fa('0x7')][_0x51fa('0x11')],util[_0x51fa('0x10')](_0x41351e,![],null)));});ami['on'](_0x51fa('0x21'),function(_0x14a0fd){logger[_0x51fa('0x22')](util[_0x51fa('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x51fa('0x7')]['ip'],config[_0x51fa('0x7')][_0x51fa('0x11')]));return BPromise[_0x51fa('0x23')]()[_0x51fa('0x24')](ami['actionSipShowRegistry']())['then'](ami[_0x51fa('0x14')]())['then'](ami[_0x51fa('0x16')]())['then'](ami[_0x51fa('0x18')]())[_0x51fa('0x24')](ami['actionCoreShowChannels']())[_0x51fa('0x25')](function(_0x4a7ad4){console['log'](_0x4a7ad4);});});ami[_0x51fa('0x1d')]('error',error);ami['once'](_0x51fa('0x1e'),close);module[_0x51fa('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ae532d6..7c452b2 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 _0xead7=['client','http','Request','request','then','debug','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','ami'];(function(_0x1f4a62,_0x24192a){var _0x2a9fe7=function(_0x2c8e09){while(--_0x2c8e09){_0x1f4a62['push'](_0x1f4a62['shift']());}};_0x2a9fe7(++_0x24192a);}(_0xead7,0x1ad));var _0x7ead=function(_0x1bd9e8,_0x3cbf38){_0x1bd9e8=_0x1bd9e8-0x0;var _0x4c75c0=_0xead7[_0x1bd9e8];return _0x4c75c0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7ead('0x0'));var logger=require(_0x7ead('0x1'))(_0x7ead('0x2'));var client=jayson[_0x7ead('0x3')][_0x7ead('0x4')]({'port':0x2329});client[_0x7ead('0x5')]=function(_0x3ad10c,_0x24bfbf){return new BPromise(function(_0x272fbf,_0x376bbe){return client[_0x7ead('0x6')](_0x3ad10c,_0x24bfbf)[_0x7ead('0x7')](function(_0x4f72dd){logger[_0x7ead('0x8')](_0x7ead('0x9'),_0x7ead('0xa'),_0x3ad10c,_0x24bfbf,_0x4f72dd);if(_0x4f72dd['error']){logger['error'](_0x7ead('0x9'),_0x7ead('0xa'),_0x3ad10c,_0x4f72dd[_0x7ead('0xb')]['message'],_0x24bfbf);return _0x376bbe(_0x4f72dd['error'][_0x7ead('0xc')]);}else{return _0x272fbf(_0x4f72dd[_0x7ead('0xd')]);}})[_0x7ead('0xe')](function(_0x4aa487){logger[_0x7ead('0xb')]('rpc','memberReport',_0x3ad10c,_0x4aa487,_0x24bfbf);return _0x376bbe(_0x4aa487);});});};module[_0x7ead('0xf')]=client; \ No newline at end of file +var _0xbf0f=['Request','request','then','debug','rpc','memberReport','error','message','exports','jayson/promise','bluebird','../../config/logger','ami','http'];(function(_0x2d340d,_0x35a2f6){var _0x38932a=function(_0x425276){while(--_0x425276){_0x2d340d['push'](_0x2d340d['shift']());}};_0x38932a(++_0x35a2f6);}(_0xbf0f,0x1e5));var _0xfbf0=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xbf0f[_0x3f25b2];return _0xd8caeb;};'use strict';var jayson=require(_0xfbf0('0x0'));var BPromise=require(_0xfbf0('0x1'));var logger=require(_0xfbf0('0x2'))(_0xfbf0('0x3'));var client=jayson['client'][_0xfbf0('0x4')]({'port':0x2329});client[_0xfbf0('0x5')]=function(_0x839331,_0x27bda8){return new BPromise(function(_0x32bc56,_0x565f13){return client[_0xfbf0('0x6')](_0x839331,_0x27bda8)[_0xfbf0('0x7')](function(_0x9c5bb0){logger[_0xfbf0('0x8')](_0xfbf0('0x9'),_0xfbf0('0xa'),_0x839331,_0x27bda8,_0x9c5bb0);if(_0x9c5bb0[_0xfbf0('0xb')]){logger[_0xfbf0('0xb')](_0xfbf0('0x9'),_0xfbf0('0xa'),_0x839331,_0x9c5bb0[_0xfbf0('0xb')][_0xfbf0('0xc')],_0x27bda8);return _0x565f13(_0x9c5bb0[_0xfbf0('0xb')]['message']);}else{return _0x32bc56(_0x9c5bb0['result']);}})['catch'](function(_0x52b1c8){logger[_0xfbf0('0xb')]('rpc','memberReport',_0x839331,_0x52b1c8,_0x27bda8);return _0x565f13(_0x52b1c8);});});};module[_0xfbf0('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 962909f..1a8dae4 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 _0x552d=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName'];(function(_0x185fce,_0x4d45cf){var _0x3065d0=function(_0x2e4f8a){while(--_0x2e4f8a){_0x185fce['push'](_0x185fce['shift']());}};_0x3065d0(++_0x4d45cf);}(_0x552d,0xbe));var _0xd552=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x552d[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xd552('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x11bb57,_0x1b07e2,_0x3bc723){var _0x34d84b='';if(!_[_0xd552('0x1')](_0x1b07e2)&&_0xd552('0x2')===typeof _0x1b07e2){_0x34d84b+=_0x1b07e2;}if(!_[_0xd552('0x1')](_0x3bc723)&&_0xd552('0x2')===typeof _0x3bc723){_0x34d84b+='\x20'+_0x3bc723;}if(_0x34d84b!==''){return _0x34d84b;}return _0x11bb57;}function Action(_0x3ed1b3,_0x4ceaca,_0x68f9b2){this[_0xd552('0x3')]=_0x3ed1b3;this[_0xd552('0x4')]=_0x68f9b2||undefined;this[_0xd552('0x5')]=checkNameSurname(_0x4ceaca[_0xd552('0x6')][_0xd552('0x7')],_0x4ceaca['Contact'][_0xd552('0x8')],_0x4ceaca[_0xd552('0x6')][_0xd552('0x9')]);this['number']=_0x4ceaca[_0xd552('0x6')][_0xd552('0x7')];this['queue']=_0x3ed1b3[_0xd552('0x5')];this[_0xd552('0xa')]=_0x4ceaca[_0xd552('0xa')]||![];this['type']=_0x3ed1b3[_0xd552('0xb')];this[_0xd552('0xc')]=_0x3ed1b3[_0xd552('0xc')]||0x3;this['scheduledat']=_0x4ceaca[_0xd552('0xd')];this[_0xd552('0xe')]=_0x4ceaca['countbusyretry'];this['countcongestionretry']=_0x4ceaca[_0xd552('0xf')];this[_0xd552('0x10')]=_0x4ceaca[_0xd552('0x10')];this['countnosuchnumberretry']=_0x4ceaca[_0xd552('0x11')];this[_0xd552('0x12')]=_0x4ceaca['countdropretry'];this[_0xd552('0x13')]=_0x4ceaca[_0xd552('0x13')];this['countmachineretry']=_0x4ceaca[_0xd552('0x14')];this[_0xd552('0x15')]=_0x4ceaca[_0xd552('0x15')];this[_0xd552('0x16')]=_0x4ceaca[_0xd552('0x16')];this[_0xd552('0x17')]=_0x4ceaca[_0xd552('0x17')];this['UserId']=_0x4ceaca['UserId'];this['VoiceQueueId']=_0x4ceaca[_0xd552('0x18')];this['CampaignId']=_0x4ceaca[_0xd552('0x19')];this[_0xd552('0x1a')]=_0x4ceaca['id'];this[_0xd552('0x1b')]=_0x4ceaca['Contact']['firstName']||'';this['starttime']=moment()[_0xd552('0x1c')](_0xd552('0x1d'));this['callback']=_0x4ceaca[_0xd552('0x1e')];this[_0xd552('0x1f')]=_0x4ceaca[_0xd552('0x1f')];this[_0xd552('0x20')]=_0x4ceaca['callbackat'];this[_0xd552('0x21')]=_0x4ceaca[_0xd552('0x21')];this['originatecalleridnum']='';this[_0xd552('0x22')]='';}Action[_0xd552('0x23')]['getCaller']=function(){return util[_0xd552('0x1c')](_0xd552('0x24'),this[_0xd552('0x5')],this[_0xd552('0x3')][_0xd552('0x25')]>0x0?this[_0xd552('0x26')][_0xd552('0x27')](this[_0xd552('0x3')][_0xd552('0x25')]):this[_0xd552('0x26')]);};Action[_0xd552('0x23')]['getQueue']=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x5cbc=['format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','name','phone','Contact','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime'];(function(_0x3bc549,_0x456bb2){var _0x4c417c=function(_0x5f455d){while(--_0x5f455d){_0x3bc549['push'](_0x3bc549['shift']());}};_0x4c417c(++_0x456bb2);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x50560a,_0x4c5a85){_0x50560a=_0x50560a-0x0;var _0x3831b8=_0x5cbc[_0x50560a];return _0x3831b8;};'use strict';var util=require(_0xc5cb('0x0'));var _=require('lodash');var moment=require(_0xc5cb('0x1'));function checkNameSurname(_0x1ec545,_0x38586e,_0x4567fb){var _0x52df64='';if(!_[_0xc5cb('0x2')](_0x38586e)&&_0xc5cb('0x3')===typeof _0x38586e){_0x52df64+=_0x38586e;}if(!_[_0xc5cb('0x2')](_0x4567fb)&&'string'===typeof _0x4567fb){_0x52df64+='\x20'+_0x4567fb;}if(_0x52df64!==''){return _0x52df64;}return _0x1ec545;}function Action(_0x111c42,_0x4c9a0f,_0x157991){this[_0xc5cb('0x4')]=_0x111c42;this['uniqueid']=_0x157991||undefined;this[_0xc5cb('0x5')]=checkNameSurname(_0x4c9a0f['Contact'][_0xc5cb('0x6')],_0x4c9a0f[_0xc5cb('0x7')][_0xc5cb('0x8')],_0x4c9a0f[_0xc5cb('0x7')]['lastName']);this[_0xc5cb('0x9')]=_0x4c9a0f['Contact'][_0xc5cb('0x6')];this['queue']=_0x111c42['name'];this[_0xc5cb('0xa')]=_0x4c9a0f['active']||![];this[_0xc5cb('0xb')]=_0x111c42[_0xc5cb('0xb')];this[_0xc5cb('0xc')]=_0x111c42['dialQueueTimeout']||0x3;this['scheduledat']=_0x4c9a0f[_0xc5cb('0xd')];this[_0xc5cb('0xe')]=_0x4c9a0f['countbusyretry'];this[_0xc5cb('0xf')]=_0x4c9a0f[_0xc5cb('0xf')];this[_0xc5cb('0x10')]=_0x4c9a0f[_0xc5cb('0x10')];this[_0xc5cb('0x11')]=_0x4c9a0f['countnosuchnumberretry'];this['countdropretry']=_0x4c9a0f[_0xc5cb('0x12')];this[_0xc5cb('0x13')]=_0x4c9a0f[_0xc5cb('0x13')];this[_0xc5cb('0x14')]=_0x4c9a0f['countmachineretry'];this[_0xc5cb('0x15')]=_0x4c9a0f[_0xc5cb('0x15')];this[_0xc5cb('0x16')]=_0x4c9a0f[_0xc5cb('0x16')];this['ListId']=_0x4c9a0f['ListId'];this['UserId']=_0x4c9a0f[_0xc5cb('0x17')];this[_0xc5cb('0x18')]=_0x4c9a0f['VoiceQueueId'];this[_0xc5cb('0x19')]=_0x4c9a0f[_0xc5cb('0x19')];this[_0xc5cb('0x1a')]=_0x4c9a0f['id'];this[_0xc5cb('0x1b')]=_0x4c9a0f[_0xc5cb('0x7')]['firstName']||'';this[_0xc5cb('0x1c')]=moment()[_0xc5cb('0x1d')](_0xc5cb('0x1e'));this['callback']=_0x4c9a0f['callback'];this[_0xc5cb('0x1f')]=_0x4c9a0f['callbackuniqueid'];this[_0xc5cb('0x20')]=_0x4c9a0f[_0xc5cb('0x20')];this['recallme']=_0x4c9a0f['recallme'];this[_0xc5cb('0x21')]='';this['originatecalleridname']='';}Action[_0xc5cb('0x22')]['getCaller']=function(){return util[_0xc5cb('0x1d')](_0xc5cb('0x23'),this[_0xc5cb('0x5')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xc5cb('0x9')]['substring'](this['voiceQueue'][_0xc5cb('0x24')]):this[_0xc5cb('0x9')]);};Action[_0xc5cb('0x22')][_0xc5cb('0x25')]=function(){return this[_0xc5cb('0x26')];};module[_0xc5cb('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 623010b..df8f6a2 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 _0x4a5f=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x3927c5,_0x5e8498){var _0x4a48b3=function(_0x1ba12a){while(--_0x1ba12a){_0x3927c5['push'](_0x3927c5['shift']());}};_0x4a48b3(++_0x5e8498);}(_0x4a5f,0xe7));var _0xf4a5=function(_0x20ef83,_0xea60f9){_0x20ef83=_0x20ef83-0x0;var _0x18c673=_0x4a5f[_0x20ef83];return _0x18c673;};'use strict';var util=require(_0xf4a5('0x0'));var _=require(_0xf4a5('0x1'));var moment=require(_0xf4a5('0x2'));function getSeconds(_0x5c5dde,_0x128878){var _0x4c1b33=moment(_0x5c5dde)['milliseconds'](0x0);var _0x3da678=moment(_0x128878)['milliseconds'](0x0);return _0x4c1b33[_0xf4a5('0x3')](_0x3da678,'seconds');}function AgentComplete(_0x4d7c08,_0x2c94dd){this['state']=0x4;this[_0xf4a5('0x4')]=_0xf4a5('0x5');this[_0xf4a5('0x6')]=_0x4d7c08[_0xf4a5('0x6')];this[_0xf4a5('0x7')]=_0x4d7c08[_0xf4a5('0x7')];this[_0xf4a5('0x8')]=_0x4d7c08[_0xf4a5('0x7')]===_0xf4a5('0x9')?_0xf4a5('0xa'):_0x4d7c08[_0xf4a5('0x7')];this[_0xf4a5('0xb')]=_0x4d7c08[_0xf4a5('0xb')];this['countcongestionretry']=_0x4d7c08[_0xf4a5('0xc')];this[_0xf4a5('0xd')]=_0x4d7c08[_0xf4a5('0xd')];this[_0xf4a5('0xe')]=_0x4d7c08['countbusyretry']+_0x4d7c08[_0xf4a5('0xc')]+_0x4d7c08[_0xf4a5('0xd')]+_0x4d7c08[_0xf4a5('0xf')]+_0x4d7c08[_0xf4a5('0x10')]+_0x4d7c08[_0xf4a5('0x11')]+_0x4d7c08[_0xf4a5('0x12')]+_0x4d7c08[_0xf4a5('0x13')];this[_0xf4a5('0xf')]=_0x4d7c08[_0xf4a5('0xf')];this[_0xf4a5('0x10')]=_0x4d7c08[_0xf4a5('0x10')];this[_0xf4a5('0x11')]=_0x4d7c08['countabandonedretry'];this['countmachineretry']=_0x4d7c08[_0xf4a5('0x12')];this[_0xf4a5('0x13')]=_0x4d7c08[_0xf4a5('0x13')];this['uniqueid']=_0x2c94dd[_0xf4a5('0x14')];this[_0xf4a5('0x15')]=_0x4d7c08[_0xf4a5('0x16')];this[_0xf4a5('0x17')]=_0x4d7c08[_0xf4a5('0x18')];this[_0xf4a5('0x19')]=_0x4d7c08[_0xf4a5('0x19')];this[_0xf4a5('0x1a')]=_0x4d7c08[_0xf4a5('0x1a')];this[_0xf4a5('0x1b')]=_0x4d7c08['answertime'];this[_0xf4a5('0x1c')]=moment()['format'](_0xf4a5('0x1d'));this['ringtime']=getSeconds(_0x4d7c08[_0xf4a5('0x1a')],_0x4d7c08[_0xf4a5('0x19')]);this['holdtime']=getSeconds(_0x4d7c08[_0xf4a5('0x1b')],_0x4d7c08[_0xf4a5('0x1a')]);this[_0xf4a5('0x1e')]=getSeconds(this[_0xf4a5('0x1c')],_0x4d7c08['answertime']);this[_0xf4a5('0xa')]=_0x2c94dd[_0xf4a5('0xa')];this[_0xf4a5('0x1f')]=_0x2c94dd[_0xf4a5('0x1f')];this[_0xf4a5('0x20')]=_0x2c94dd[_0xf4a5('0x20')];this[_0xf4a5('0x21')]=_0x4d7c08['callback'];this['callbackuniqueid']=_0x4d7c08[_0xf4a5('0x22')];this[_0xf4a5('0x23')]=_0x4d7c08[_0xf4a5('0x23')];this[_0xf4a5('0x24')]=_0x4d7c08[_0xf4a5('0x24')];this[_0xf4a5('0x25')]=_0x4d7c08[_0xf4a5('0x25')];this[_0xf4a5('0x26')]=_0x4d7c08[_0xf4a5('0x26')];this[_0xf4a5('0x27')]=_0x4d7c08['UserId'];this['VoiceQueueId']=_0x4d7c08[_0xf4a5('0x28')];this[_0xf4a5('0x29')]=_0x4d7c08[_0xf4a5('0x29')];this[_0xf4a5('0x2a')]=_0x4d7c08[_0xf4a5('0x2a')]||'';this[_0xf4a5('0x2b')]=_0x4d7c08[_0xf4a5('0x2b')]||'';}module[_0xf4a5('0x2c')]=AgentComplete; \ No newline at end of file +var _0xa9f5=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x2d819b,_0x321af5){var _0x3799fd=function(_0x50090b){while(--_0x50090b){_0x2d819b['push'](_0x2d819b['shift']());}};_0x3799fd(++_0x321af5);}(_0xa9f5,0x12b));var _0x5a9f=function(_0x1ff777,_0x353323){_0x1ff777=_0x1ff777-0x0;var _0x17de60=_0xa9f5[_0x1ff777];return _0x17de60;};'use strict';var util=require(_0x5a9f('0x0'));var _=require(_0x5a9f('0x1'));var moment=require(_0x5a9f('0x2'));function getSeconds(_0x19ece4,_0x4052a1){var _0x148734=moment(_0x19ece4)[_0x5a9f('0x3')](0x0);var _0x65d7ef=moment(_0x4052a1)[_0x5a9f('0x3')](0x0);return _0x148734[_0x5a9f('0x4')](_0x65d7ef,_0x5a9f('0x5'));}function AgentComplete(_0x50988b,_0x63c76d){this[_0x5a9f('0x6')]=0x4;this[_0x5a9f('0x7')]=_0x5a9f('0x8');this[_0x5a9f('0x9')]=_0x50988b[_0x5a9f('0x9')];this[_0x5a9f('0xa')]=_0x50988b[_0x5a9f('0xa')];this[_0x5a9f('0xb')]=_0x50988b[_0x5a9f('0xa')]===_0x5a9f('0xc')?'queue':_0x50988b['type'];this['countbusyretry']=_0x50988b[_0x5a9f('0xd')];this[_0x5a9f('0xe')]=_0x50988b[_0x5a9f('0xe')];this[_0x5a9f('0xf')]=_0x50988b[_0x5a9f('0xf')];this[_0x5a9f('0x10')]=_0x50988b['countbusyretry']+_0x50988b[_0x5a9f('0xe')]+_0x50988b[_0x5a9f('0xf')]+_0x50988b['countnosuchnumberretry']+_0x50988b['countdropretry']+_0x50988b[_0x5a9f('0x11')]+_0x50988b[_0x5a9f('0x12')]+_0x50988b[_0x5a9f('0x13')];this[_0x5a9f('0x14')]=_0x50988b['countnosuchnumberretry'];this[_0x5a9f('0x15')]=_0x50988b[_0x5a9f('0x15')];this['countabandonedretry']=_0x50988b[_0x5a9f('0x11')];this[_0x5a9f('0x12')]=_0x50988b[_0x5a9f('0x12')];this[_0x5a9f('0x13')]=_0x50988b[_0x5a9f('0x13')];this[_0x5a9f('0x16')]=_0x63c76d[_0x5a9f('0x16')];this[_0x5a9f('0x17')]=_0x50988b[_0x5a9f('0x18')];this[_0x5a9f('0x19')]=_0x50988b['number'];this[_0x5a9f('0x1a')]=_0x50988b['starttime'];this[_0x5a9f('0x1b')]=_0x50988b[_0x5a9f('0x1b')];this['answertime']=_0x50988b[_0x5a9f('0x1c')];this[_0x5a9f('0x1d')]=moment()[_0x5a9f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5a9f('0x1f')]=getSeconds(_0x50988b['responsetime'],_0x50988b[_0x5a9f('0x1a')]);this[_0x5a9f('0x20')]=getSeconds(_0x50988b['answertime'],_0x50988b['responsetime']);this[_0x5a9f('0x21')]=getSeconds(this[_0x5a9f('0x1d')],_0x50988b[_0x5a9f('0x1c')]);this[_0x5a9f('0x22')]=_0x63c76d['queue'];this['membername']=_0x63c76d[_0x5a9f('0x23')];this['reason']=_0x63c76d[_0x5a9f('0x24')];this[_0x5a9f('0x25')]=_0x50988b[_0x5a9f('0x25')];this['callbackuniqueid']=_0x50988b[_0x5a9f('0x26')];this[_0x5a9f('0x27')]=_0x50988b[_0x5a9f('0x27')];this[_0x5a9f('0x28')]=_0x50988b[_0x5a9f('0x28')];this['ContactId']=_0x50988b[_0x5a9f('0x29')];this['ListId']=_0x50988b[_0x5a9f('0x2a')];this['UserId']=_0x50988b[_0x5a9f('0x2b')];this[_0x5a9f('0x2c')]=_0x50988b['VoiceQueueId'];this[_0x5a9f('0x2d')]=_0x50988b[_0x5a9f('0x2d')];this[_0x5a9f('0x2e')]=_0x50988b[_0x5a9f('0x2e')]||'';this[_0x5a9f('0x2f')]=_0x50988b[_0x5a9f('0x2f')]||'';}module[_0x5a9f('0x30')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index eb4a3c5..c21e2e9 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 _0xafad=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','countcongestionretry','countnoanswerretry','countbusyretry'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xafad,0x1d5));var _0xdafa=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xafad[_0x409353];return _0x4f4b59;};'use strict';var util=require(_0xdafa('0x0'));var _=require(_0xdafa('0x1'));var moment=require(_0xdafa('0x2'));function getSeconds(_0x28b9ab,_0x1e9e2b){var _0x107d70=moment(_0x28b9ab)[_0xdafa('0x3')](0x0);var _0x3570d3=moment(_0x1e9e2b)[_0xdafa('0x3')](0x0);return _0x107d70['diff'](_0x3570d3,_0xdafa('0x4'));}function Final(_0x1cac24){this[_0xdafa('0x5')]=_0x1cac24['uniqueid'];this[_0xdafa('0x6')]=_0x1cac24[_0xdafa('0x6')];this[_0xdafa('0x7')]=_0x1cac24['type'];this['campaigntype']=_0x1cac24[_0xdafa('0x7')]===_0xdafa('0x8')?'queue':_0x1cac24[_0xdafa('0x7')];this['countbusyretry']=_0x1cac24['countbusyretry'];this[_0xdafa('0x9')]=_0x1cac24[_0xdafa('0x9')];this['countnoanswerretry']=_0x1cac24[_0xdafa('0xa')];this['countglobal']=_0x1cac24[_0xdafa('0xb')]+_0x1cac24[_0xdafa('0x9')]+_0x1cac24[_0xdafa('0xa')]+_0x1cac24[_0xdafa('0xc')]+_0x1cac24[_0xdafa('0xd')]+_0x1cac24[_0xdafa('0xe')]+_0x1cac24[_0xdafa('0xf')]+_0x1cac24[_0xdafa('0x10')];this[_0xdafa('0xc')]=_0x1cac24[_0xdafa('0xc')];this[_0xdafa('0xd')]=_0x1cac24[_0xdafa('0xd')];this[_0xdafa('0xe')]=_0x1cac24['countabandonedretry'];this[_0xdafa('0xf')]=_0x1cac24[_0xdafa('0xf')];this[_0xdafa('0x10')]=_0x1cac24[_0xdafa('0x10')];this[_0xdafa('0x11')]=_0x1cac24[_0xdafa('0x11')];this['calleridname']=_0x1cac24[_0xdafa('0x12')];this[_0xdafa('0x13')]=_0x1cac24[_0xdafa('0x13')];this['starttime']=_0x1cac24['starttime'];this[_0xdafa('0x14')]=_0x1cac24['responsetime'];this[_0xdafa('0x15')]=_0x1cac24[_0xdafa('0x14')];this[_0xdafa('0x16')]=_0x1cac24[_0xdafa('0x16')]||0x0;this[_0xdafa('0x17')]=_0x1cac24['holdtime']||0x0;this[_0xdafa('0x18')]=_0x1cac24['talktime']||0x0;this[_0xdafa('0x19')]=_0x1cac24['callback'];this[_0xdafa('0x1a')]=_0x1cac24[_0xdafa('0x1a')];this[_0xdafa('0x1b')]=_0x1cac24[_0xdafa('0x1b')];this['recallme']=_0x1cac24[_0xdafa('0x1c')];this[_0xdafa('0x1d')]=_0x1cac24[_0xdafa('0x1d')];this['ListId']=_0x1cac24[_0xdafa('0x1e')];this[_0xdafa('0x1f')]=_0x1cac24[_0xdafa('0x1f')];this['VoiceQueueId']=_0x1cac24[_0xdafa('0x20')];this[_0xdafa('0x21')]=_0x1cac24[_0xdafa('0x21')];this['originatecalleridnum']=_0x1cac24[_0xdafa('0x22')]||'';this['originatecalleridname']=_0x1cac24[_0xdafa('0x23')]||'';}module[_0xdafa('0x24')]=Final; \ No newline at end of file +var _0x8b50=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x571670,_0x519470){var _0x49c903=function(_0x518fed){while(--_0x518fed){_0x571670['push'](_0x571670['shift']());}};_0x49c903(++_0x519470);}(_0x8b50,0x1d6));var _0x08b5=function(_0x2fde79,_0xcb5494){_0x2fde79=_0x2fde79-0x0;var _0xfd8d8d=_0x8b50[_0x2fde79];return _0xfd8d8d;};'use strict';var util=require(_0x08b5('0x0'));var _=require(_0x08b5('0x1'));var moment=require(_0x08b5('0x2'));function getSeconds(_0xd94180,_0x4ded95){var _0xbb7048=moment(_0xd94180)[_0x08b5('0x3')](0x0);var _0x514268=moment(_0x4ded95)[_0x08b5('0x3')](0x0);return _0xbb7048[_0x08b5('0x4')](_0x514268,_0x08b5('0x5'));}function Final(_0x35e8ce){this['uniqueid']=_0x35e8ce[_0x08b5('0x6')];this[_0x08b5('0x7')]=_0x35e8ce['scheduledat'];this[_0x08b5('0x8')]=_0x35e8ce[_0x08b5('0x8')];this['campaigntype']=_0x35e8ce['type']===_0x08b5('0x9')?_0x08b5('0xa'):_0x35e8ce[_0x08b5('0x8')];this[_0x08b5('0xb')]=_0x35e8ce[_0x08b5('0xb')];this[_0x08b5('0xc')]=_0x35e8ce['countcongestionretry'];this[_0x08b5('0xd')]=_0x35e8ce[_0x08b5('0xd')];this[_0x08b5('0xe')]=_0x35e8ce['countbusyretry']+_0x35e8ce['countcongestionretry']+_0x35e8ce[_0x08b5('0xd')]+_0x35e8ce['countnosuchnumberretry']+_0x35e8ce[_0x08b5('0xf')]+_0x35e8ce[_0x08b5('0x10')]+_0x35e8ce[_0x08b5('0x11')]+_0x35e8ce[_0x08b5('0x12')];this[_0x08b5('0x13')]=_0x35e8ce['countnosuchnumberretry'];this[_0x08b5('0xf')]=_0x35e8ce[_0x08b5('0xf')];this['countabandonedretry']=_0x35e8ce[_0x08b5('0x10')];this['countmachineretry']=_0x35e8ce[_0x08b5('0x11')];this[_0x08b5('0x12')]=_0x35e8ce['countagentrejectretry'];this[_0x08b5('0xa')]=_0x35e8ce['queue'];this[_0x08b5('0x14')]=_0x35e8ce[_0x08b5('0x14')];this[_0x08b5('0x15')]=_0x35e8ce[_0x08b5('0x15')];this[_0x08b5('0x16')]=_0x35e8ce[_0x08b5('0x16')];this[_0x08b5('0x17')]=_0x35e8ce[_0x08b5('0x17')];this[_0x08b5('0x18')]=_0x35e8ce[_0x08b5('0x17')];this[_0x08b5('0x19')]=_0x35e8ce[_0x08b5('0x19')]||0x0;this[_0x08b5('0x1a')]=_0x35e8ce[_0x08b5('0x1a')]||0x0;this[_0x08b5('0x1b')]=_0x35e8ce[_0x08b5('0x1b')]||0x0;this[_0x08b5('0x1c')]=_0x35e8ce[_0x08b5('0x1c')];this[_0x08b5('0x1d')]=_0x35e8ce[_0x08b5('0x1d')];this[_0x08b5('0x1e')]=_0x35e8ce[_0x08b5('0x1e')];this['recallme']=_0x35e8ce['recallme'];this[_0x08b5('0x1f')]=_0x35e8ce['ContactId'];this[_0x08b5('0x20')]=_0x35e8ce['ListId'];this[_0x08b5('0x21')]=_0x35e8ce[_0x08b5('0x21')];this[_0x08b5('0x22')]=_0x35e8ce[_0x08b5('0x22')];this['CampaignId']=_0x35e8ce[_0x08b5('0x23')];this[_0x08b5('0x24')]=_0x35e8ce[_0x08b5('0x24')]||'';this[_0x08b5('0x25')]=_0x35e8ce['originatecalleridname']||'';}module[_0x08b5('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index f64866c..8c3a0fb 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 _0x94aa=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid'];(function(_0x11a422,_0x5907a5){var _0x547177=function(_0x55ec90){while(--_0x55ec90){_0x11a422['push'](_0x11a422['shift']());}};_0x547177(++_0x5907a5);}(_0x94aa,0x13c));var _0xa94a=function(_0xdd2beb,_0x374a26){_0xdd2beb=_0xdd2beb-0x0;var _0x439a73=_0x94aa[_0xdd2beb];return _0x439a73;};'use strict';var util=require(_0xa94a('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x27b31a,_0x1f11f4){var _0x5a9f98=moment(_0x27b31a)[_0xa94a('0x1')](0x0);var _0x10ab65=moment(_0x1f11f4)['milliseconds'](0x0);return _0x5a9f98[_0xa94a('0x2')](_0x10ab65,_0xa94a('0x3'));}function Hangup(_0x1cba62,_0x5ea545){this['state']=0x4;this[_0xa94a('0x4')]=_0xa94a('0x5');this['scheduledat']=_0x1cba62[_0xa94a('0x6')];this[_0xa94a('0x7')]=_0x1cba62[_0xa94a('0x7')];this[_0xa94a('0x8')]=_0x1cba62['type']==='outbound'?_0xa94a('0x9'):_0x1cba62[_0xa94a('0x7')];this[_0xa94a('0xa')]=_0x1cba62[_0xa94a('0xa')];this[_0xa94a('0xb')]=_0x1cba62[_0xa94a('0xb')];this[_0xa94a('0xc')]=_0x1cba62['countnoanswerretry'];this[_0xa94a('0xd')]=_0x1cba62[_0xa94a('0xa')]+_0x1cba62[_0xa94a('0xb')]+_0x1cba62[_0xa94a('0xc')]+_0x1cba62['countnosuchnumberretry']+_0x1cba62[_0xa94a('0xe')]+_0x1cba62[_0xa94a('0xf')]+_0x1cba62[_0xa94a('0x10')]+_0x1cba62[_0xa94a('0x11')];this[_0xa94a('0x12')]=_0x1cba62['countnosuchnumberretry'];this[_0xa94a('0xe')]=_0x1cba62[_0xa94a('0xe')];this[_0xa94a('0xf')]=_0x1cba62['countabandonedretry'];this[_0xa94a('0x10')]=_0x1cba62['countmachineretry'];this[_0xa94a('0x11')]=_0x1cba62[_0xa94a('0x11')];this[_0xa94a('0x13')]=_0x5ea545[_0xa94a('0x13')];this[_0xa94a('0x14')]=_0x1cba62[_0xa94a('0x15')];this['calleridnum']=_0x1cba62['number'];this[_0xa94a('0x16')]=_0x1cba62['starttime'];this[_0xa94a('0x17')]=_0x1cba62['responsetime'];this[_0xa94a('0x18')]=moment()[_0xa94a('0x19')](_0xa94a('0x1a'));this[_0xa94a('0x1b')]=getSeconds(_0x1cba62[_0xa94a('0x17')],_0x1cba62[_0xa94a('0x16')]);this[_0xa94a('0x1c')]=0x0;this[_0xa94a('0x1d')]=getSeconds(this[_0xa94a('0x18')],_0x1cba62[_0xa94a('0x17')]);this[_0xa94a('0x9')]=_0x1cba62['queue'];this[_0xa94a('0x1e')]=_0xa94a('0x1f');this[_0xa94a('0x20')]=_0x5ea545[_0xa94a('0x21')];this[_0xa94a('0x22')]=_0x1cba62['callback'];this[_0xa94a('0x23')]=_0x1cba62[_0xa94a('0x23')];this[_0xa94a('0x24')]=_0x1cba62['callbackat'];this['recallme']=_0x1cba62[_0xa94a('0x25')];this[_0xa94a('0x26')]=_0x1cba62[_0xa94a('0x26')];this[_0xa94a('0x27')]=_0x1cba62['ListId'];this[_0xa94a('0x28')]=_0x1cba62['UserId'];this[_0xa94a('0x29')]=_0x1cba62[_0xa94a('0x29')];this[_0xa94a('0x2a')]=_0x1cba62['CampaignId'];}module[_0xa94a('0x2b')]=Hangup; \ No newline at end of file +var _0x7047=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7047,0x1cd));var _0x7704=function(_0x709293,_0x307acb){_0x709293=_0x709293-0x0;var _0x2a9a0f=_0x7047[_0x709293];return _0x2a9a0f;};'use strict';var util=require(_0x7704('0x0'));var _=require(_0x7704('0x1'));var moment=require(_0x7704('0x2'));function getSeconds(_0x5b9a49,_0x3297bd){var _0x23c556=moment(_0x5b9a49)[_0x7704('0x3')](0x0);var _0x5ad808=moment(_0x3297bd)['milliseconds'](0x0);return _0x23c556['diff'](_0x5ad808,_0x7704('0x4'));}function Hangup(_0x438bd6,_0x33dfb8){this[_0x7704('0x5')]=0x4;this['statedesc']=_0x7704('0x6');this[_0x7704('0x7')]=_0x438bd6[_0x7704('0x7')];this[_0x7704('0x8')]=_0x438bd6[_0x7704('0x8')];this[_0x7704('0x9')]=_0x438bd6[_0x7704('0x8')]===_0x7704('0xa')?_0x7704('0xb'):_0x438bd6[_0x7704('0x8')];this[_0x7704('0xc')]=_0x438bd6['countbusyretry'];this[_0x7704('0xd')]=_0x438bd6['countcongestionretry'];this[_0x7704('0xe')]=_0x438bd6[_0x7704('0xe')];this['countglobal']=_0x438bd6['countbusyretry']+_0x438bd6['countcongestionretry']+_0x438bd6['countnoanswerretry']+_0x438bd6[_0x7704('0xf')]+_0x438bd6[_0x7704('0x10')]+_0x438bd6[_0x7704('0x11')]+_0x438bd6['countmachineretry']+_0x438bd6[_0x7704('0x12')];this[_0x7704('0xf')]=_0x438bd6[_0x7704('0xf')];this[_0x7704('0x10')]=_0x438bd6[_0x7704('0x10')];this['countabandonedretry']=_0x438bd6['countabandonedretry'];this[_0x7704('0x13')]=_0x438bd6[_0x7704('0x13')];this[_0x7704('0x12')]=_0x438bd6[_0x7704('0x12')];this[_0x7704('0x14')]=_0x33dfb8[_0x7704('0x14')];this[_0x7704('0x15')]=_0x438bd6[_0x7704('0x16')];this['calleridnum']=_0x438bd6[_0x7704('0x17')];this[_0x7704('0x18')]=_0x438bd6[_0x7704('0x18')];this[_0x7704('0x19')]=_0x438bd6[_0x7704('0x19')];this[_0x7704('0x1a')]=moment()[_0x7704('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x438bd6[_0x7704('0x19')],_0x438bd6[_0x7704('0x18')]);this[_0x7704('0x1c')]=0x0;this[_0x7704('0x1d')]=getSeconds(this[_0x7704('0x1a')],_0x438bd6[_0x7704('0x19')]);this[_0x7704('0xb')]=_0x438bd6[_0x7704('0xb')];this['membername']=_0x7704('0x1e');this[_0x7704('0x1f')]=_0x33dfb8[_0x7704('0x20')];this[_0x7704('0x21')]=_0x438bd6[_0x7704('0x21')];this[_0x7704('0x22')]=_0x438bd6[_0x7704('0x22')];this[_0x7704('0x23')]=_0x438bd6['callbackat'];this['recallme']=_0x438bd6[_0x7704('0x24')];this[_0x7704('0x25')]=_0x438bd6[_0x7704('0x25')];this[_0x7704('0x26')]=_0x438bd6[_0x7704('0x26')];this[_0x7704('0x27')]=_0x438bd6[_0x7704('0x27')];this[_0x7704('0x28')]=_0x438bd6[_0x7704('0x28')];this[_0x7704('0x29')]=_0x438bd6[_0x7704('0x29')];}module[_0x7704('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index fa21514..8e69912 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 _0x8f02=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x3a11ef,_0x3155c6){var _0xfb7452=function(_0x3f94ee){while(--_0x3f94ee){_0x3a11ef['push'](_0x3a11ef['shift']());}};_0xfb7452(++_0x3155c6);}(_0x8f02,0x73));var _0x28f0=function(_0x145e93,_0x1e4996){_0x145e93=_0x145e93-0x0;var _0x460539=_0x8f02[_0x145e93];return _0x460539;};'use strict';var util=require(_0x28f0('0x0'));var _=require(_0x28f0('0x1'));var moment=require(_0x28f0('0x2'));function getSeconds(_0x347af5,_0xe92c30){var _0x540db7=moment(_0x347af5)[_0x28f0('0x3')](0x0);var _0x11fc8a=moment(_0xe92c30)['milliseconds'](0x0);return _0x540db7['diff'](_0x11fc8a,_0x28f0('0x4'));}function History(_0x424b06){this[_0x28f0('0x5')]=_0x424b06[_0x28f0('0x5')];this['scheduledat']=_0x424b06[_0x28f0('0x6')]||undefined;this[_0x28f0('0x7')]=_0x424b06['type'];this[_0x28f0('0x8')]=_0x424b06[_0x28f0('0x7')]===_0x28f0('0x9')?_0x28f0('0xa'):_0x424b06['type'];this[_0x28f0('0xb')]=_0x424b06['countbusyretry'];this['countcongestionretry']=_0x424b06[_0x28f0('0xc')];this[_0x28f0('0xd')]=_0x424b06['countnoanswerretry'];this[_0x28f0('0xe')]=_0x424b06['countbusyretry']+_0x424b06[_0x28f0('0xc')]+_0x424b06[_0x28f0('0xd')]+_0x424b06[_0x28f0('0xf')]+_0x424b06[_0x28f0('0x10')]+_0x424b06[_0x28f0('0x11')]+_0x424b06[_0x28f0('0x12')]+_0x424b06['countagentrejectretry'];this['countnosuchnumberretry']=_0x424b06[_0x28f0('0xf')];this[_0x28f0('0x10')]=_0x424b06[_0x28f0('0x10')];this[_0x28f0('0x11')]=_0x424b06[_0x28f0('0x11')];this['countmachineretry']=_0x424b06[_0x28f0('0x12')];this[_0x28f0('0x13')]=_0x424b06[_0x28f0('0x13')];this[_0x28f0('0xa')]=_0x424b06[_0x28f0('0xa')];this[_0x28f0('0x14')]=_0x424b06[_0x28f0('0x15')];this[_0x28f0('0x16')]=_0x424b06['number'];this[_0x28f0('0x17')]=_0x424b06[_0x28f0('0x17')];this[_0x28f0('0x18')]=_0x424b06[_0x28f0('0x18')];this['endtime']=_0x424b06[_0x28f0('0x18')];this[_0x28f0('0x19')]=getSeconds(_0x424b06[_0x28f0('0x18')],_0x424b06[_0x28f0('0x17')]);this[_0x28f0('0x1a')]=0x0;this[_0x28f0('0x1b')]=0x0;this[_0x28f0('0x1c')]=_0x424b06[_0x28f0('0x1c')];this[_0x28f0('0x1d')]=_0x424b06[_0x28f0('0x1d')];this[_0x28f0('0x1e')]=_0x424b06[_0x28f0('0x1e')];this[_0x28f0('0x1f')]=_0x424b06[_0x28f0('0x1f')];this[_0x28f0('0x20')]=_0x424b06[_0x28f0('0x20')];this[_0x28f0('0x21')]=_0x424b06[_0x28f0('0x21')];this[_0x28f0('0x22')]=_0x424b06['UserId'];this[_0x28f0('0x23')]=_0x424b06[_0x28f0('0x23')];this[_0x28f0('0x24')]=_0x424b06['CampaignId'];this[_0x28f0('0x25')]=_0x424b06[_0x28f0('0x25')]||'';this[_0x28f0('0x26')]=_0x424b06[_0x28f0('0x26')]||'';}module[_0x28f0('0x27')]=History; \ No newline at end of file +var _0x9400=['calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0x378601,_0x4369f8){var _0x241de6=function(_0x2b609){while(--_0x2b609){_0x378601['push'](_0x378601['shift']());}};_0x241de6(++_0x4369f8);}(_0x9400,0x152));var _0x0940=function(_0x1e37fd,_0x3bafc1){_0x1e37fd=_0x1e37fd-0x0;var _0x12d004=_0x9400[_0x1e37fd];return _0x12d004;};'use strict';var util=require(_0x0940('0x0'));var _=require(_0x0940('0x1'));var moment=require(_0x0940('0x2'));function getSeconds(_0x24deb1,_0x27a08f){var _0x153c12=moment(_0x24deb1)['milliseconds'](0x0);var _0x24df9d=moment(_0x27a08f)[_0x0940('0x3')](0x0);return _0x153c12[_0x0940('0x4')](_0x24df9d,_0x0940('0x5'));}function History(_0x1a8b04){this[_0x0940('0x6')]=_0x1a8b04[_0x0940('0x6')];this[_0x0940('0x7')]=_0x1a8b04[_0x0940('0x7')]||undefined;this[_0x0940('0x8')]=_0x1a8b04[_0x0940('0x8')];this[_0x0940('0x9')]=_0x1a8b04['type']===_0x0940('0xa')?_0x0940('0xb'):_0x1a8b04[_0x0940('0x8')];this['countbusyretry']=_0x1a8b04[_0x0940('0xc')];this[_0x0940('0xd')]=_0x1a8b04[_0x0940('0xd')];this['countnoanswerretry']=_0x1a8b04[_0x0940('0xe')];this[_0x0940('0xf')]=_0x1a8b04['countbusyretry']+_0x1a8b04['countcongestionretry']+_0x1a8b04[_0x0940('0xe')]+_0x1a8b04[_0x0940('0x10')]+_0x1a8b04[_0x0940('0x11')]+_0x1a8b04[_0x0940('0x12')]+_0x1a8b04[_0x0940('0x13')]+_0x1a8b04['countagentrejectretry'];this[_0x0940('0x10')]=_0x1a8b04[_0x0940('0x10')];this[_0x0940('0x11')]=_0x1a8b04['countdropretry'];this[_0x0940('0x12')]=_0x1a8b04['countabandonedretry'];this[_0x0940('0x13')]=_0x1a8b04[_0x0940('0x13')];this[_0x0940('0x14')]=_0x1a8b04[_0x0940('0x14')];this['queue']=_0x1a8b04[_0x0940('0xb')];this[_0x0940('0x15')]=_0x1a8b04['name'];this[_0x0940('0x16')]=_0x1a8b04[_0x0940('0x17')];this[_0x0940('0x18')]=_0x1a8b04[_0x0940('0x18')];this['responsetime']=_0x1a8b04[_0x0940('0x19')];this['endtime']=_0x1a8b04[_0x0940('0x19')];this['ringtime']=getSeconds(_0x1a8b04[_0x0940('0x19')],_0x1a8b04[_0x0940('0x18')]);this[_0x0940('0x1a')]=0x0;this[_0x0940('0x1b')]=0x0;this[_0x0940('0x1c')]=_0x1a8b04[_0x0940('0x1c')];this[_0x0940('0x1d')]=_0x1a8b04[_0x0940('0x1d')];this['callbackat']=_0x1a8b04[_0x0940('0x1e')];this[_0x0940('0x1f')]=_0x1a8b04[_0x0940('0x1f')];this[_0x0940('0x20')]=_0x1a8b04['ContactId'];this[_0x0940('0x21')]=_0x1a8b04[_0x0940('0x21')];this[_0x0940('0x22')]=_0x1a8b04[_0x0940('0x22')];this[_0x0940('0x23')]=_0x1a8b04[_0x0940('0x23')];this[_0x0940('0x24')]=_0x1a8b04['CampaignId'];this['originatecalleridnum']=_0x1a8b04[_0x0940('0x25')]||'';this[_0x0940('0x26')]=_0x1a8b04[_0x0940('0x26')]||'';}module[_0x0940('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c169430..df02e65 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 _0x74a1=['[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','buildObj','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','check\x20failure','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','newexten','syncNewExten','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','endtime','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','status','channel','catch','updateOriginated','queue','campaigns','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','rescheduleContact','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countdropretry','createStateFinal','reason\x2019\x20machine....','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','actionid','paused','stateinterface','locked','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','timezones','content','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','checkIfTimeIntervals','[syncQueueSummary]','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','tags','createdAt','%s%s','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedRetryFrequency'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74a1,0x7d));var _0x174a=function(_0x36bf4a,_0x13cf2f){_0x36bf4a=_0x36bf4a-0x0;var _0x3588c6=_0x74a1[_0x36bf4a];return _0x3588c6;};'use strict';var util=require(_0x174a('0x0'));var _=require(_0x174a('0x1'));var BPromise=require(_0x174a('0x2'));var uuid=require('uuid');var moment=require(_0x174a('0x3'));var rr=require('rr');var md5=require(_0x174a('0x4'));var Redis=require(_0x174a('0x5'));var ut=require(_0x174a('0x6'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x174a('0x7'));var loggerBooked=require(_0x174a('0x8'))(_0x174a('0x9'));var loggerPredictive=require(_0x174a('0x8'))(_0x174a('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x174a('0xb'));var loggerSyncQueueSummary=require(_0x174a('0x8'))(_0x174a('0xc'));var ami=require(_0x174a('0xd'));config[_0x174a('0xe')]=_['defaults'](config[_0x174a('0xe')],{'host':_0x174a('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x174a('0x10'));var cmHopperHistory=require(_0x174a('0x11'));var cmHopperBlack=require(_0x174a('0x12'));var voiceQueueRt=require(_0x174a('0x13'));var Action=require(_0x174a('0x14'));var History=require('./history');var Final=require(_0x174a('0x15'));var AgentComplete=require(_0x174a('0x16'));var QueueCallerAbandon=require(_0x174a('0x17'));var Hangup=require(_0x174a('0x18'));var ipAgi=process['env'][_0x174a('0x19')]||'127.0.0.1';var strategy={'rrmemory':_0x174a('0x1a'),'roundrobin':_0x174a('0x1b')};var Sequence=function(){};Sequence[_0x174a('0x1c')]['enqueue']=function(_0x151e45){this[_0x174a('0x1d')]=this[_0x174a('0x1d')]?this[_0x174a('0x1d')][_0x174a('0x1e')](_0x151e45):_0x151e45();};function Dialer(_0x2572c7,_0x23cb2b){this[_0x174a('0x1f')]=new Sequence();this['preview']=_0x23cb2b;this[_0x174a('0x20')]=_0x2572c7[_0x174a('0x20')];this['campaigns']=_0x2572c7['campaigns'];this['agents']=_0x2572c7[_0x174a('0x21')];this['trunks']=_0x2572c7[_0x174a('0x22')];this[_0x174a('0x23')]=config[_0x174a('0x23')]||0x2;this[_0x174a('0x24')]={};this[_0x174a('0x25')]={};this[_0x174a('0x26')]={};this[_0x174a('0x27')]={};this[_0x174a('0x28')]={};this[_0x174a('0x29')]={};this[_0x174a('0x2a')]={};this[_0x174a('0x2b')]={};this[_0x174a('0x2c')]={};this[_0x174a('0x2d')]={};ami['on']('agentconnect',this[_0x174a('0x2e')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x174a('0x2f')](this));ami['on'](_0x174a('0x30'),this[_0x174a('0x31')][_0x174a('0x2f')](this));ami['on'](_0x174a('0x32'),this[_0x174a('0x33')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x174a('0x2f')](this));ami['on'](_0x174a('0x34'),this['syncHangup']['bind'](this));ami['on'](_0x174a('0x35'),this[_0x174a('0x36')][_0x174a('0x2f')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x174a('0x37'),this[_0x174a('0x38')][_0x174a('0x2f')](this));ami['on'](_0x174a('0x39'),this[_0x174a('0x3a')][_0x174a('0x2f')](this));this[_0x174a('0x3b')]();this[_0x174a('0x3c')]();}function isNotNull(_0x15898f){return _0x15898f!==null&&!_[_0x174a('0x3d')](_0x15898f);}function checkIsLoggedIn(_0x3c8961,_0x1a46db){return function(){if(_0x1a46db<=0x0){_0x3c8961[_0x174a('0x3e')]=_0x174a('0x3f');throw _0x3c8961['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x5db7c6){return _0x5db7c6;}function checkIsActive(_0x24450c,_0x391abd){return function(){if(!isActive(_0x391abd)){_0x24450c[_0x174a('0x3e')]=_0x174a('0x40');throw _0x24450c[_0x174a('0x41')]+_0x174a('0x42');}};}function checkInterval(_0x3d0549){return function(){if(!isNotNull(_0x3d0549[_0x174a('0x43')])){_0x3d0549[_0x174a('0x3e')]=_0x174a('0x44');throw _0x3d0549[_0x174a('0x41')]+_0x174a('0x45');}if(!isNotNull(_0x3d0549[_0x174a('0x43')][_0x174a('0x46')])){_0x3d0549[_0x174a('0x3e')]='INTERVAL_IS_NULL';throw _0x3d0549[_0x174a('0x41')]+_0x174a('0x45');}if(!isNotNull(_[_0x174a('0x47')](_0x3d0549[_0x174a('0x43')]['Intervals']))){_0x3d0549['message']=_0x174a('0x44');throw _0x3d0549[_0x174a('0x41')]+_0x174a('0x45');}};}function msgResponse(_0x503a66,_0x3e7307,_0x24e3da){return{'action':_0x503a66,'response':_0x3e7307,'message':_0x24e3da,'stack':_0x24e3da};}function myreject(_0x30f474){return function(_0x22f138){return _0x30f474(msgResponse(_0x174a('0x48'),_0x174a('0x49'),JSON[_0x174a('0x4a')](_0x22f138)));};}function getSeconds(_0x1e92c7,_0x2c3efb){var _0x40bafc=moment(_0x1e92c7)[_0x174a('0x4b')](0x0);var _0xf25854=moment(_0x2c3efb)['milliseconds'](0x0);return _0x40bafc[_0x174a('0x4c')](_0xf25854,_0x174a('0x4d'));}function emit(_0x1206f2,_0x36988e,_0x209838){io['to'](_0x1206f2)[_0x174a('0x4e')](_0x36988e,_0x209838);}function emitVoiceQueueSummary(_0x3b81fc){if(_0x3b81fc[_0x174a('0x4f')]===_0x174a('0x50')){var _0xf3dbe5={'id':_0x3b81fc['id'],'name':_0x3b81fc[_0x174a('0x41')],'strategy':_0x3b81fc[_0x174a('0x51')],'answered':_0x3b81fc[_0x174a('0x52')],'available':_0x3b81fc[_0x174a('0x53')],'loggedIn':_0x3b81fc[_0x174a('0x54')],'pTalking':_0x3b81fc[_0x174a('0x55')],'sumBillable':_0x3b81fc[_0x174a('0x56')],'sumDuration':_0x3b81fc[_0x174a('0x57')],'sumHoldTime':_0x3b81fc[_0x174a('0x58')]||0x0,'talking':_0x3b81fc[_0x174a('0x59')],'total':_0x3b81fc[_0x174a('0x5a')],'type':_0x3b81fc['type'],'unmanaged':_0x3b81fc['unmanaged'],'abandoned':_0x3b81fc[_0x174a('0x5b')],'waiting':_0x3b81fc[_0x174a('0x5c')],'loggedInDb':_0x3b81fc[_0x174a('0x5d')],'dialActive':_0x3b81fc[_0x174a('0x5e')],'dialMethod':_0x3b81fc[_0x174a('0x5f')],'dialOriginateCallerIdName':_0x3b81fc[_0x174a('0x60')],'dialOriginateCallerIdNumber':_0x3b81fc[_0x174a('0x61')],'dialOriginateTimeout':_0x3b81fc['dialOriginateTimeout'],'dialPrefix':_0x3b81fc[_0x174a('0x62')],'outboundAnswerAgiCallsDay':_0x3b81fc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x3b81fc[_0x174a('0x63')],'outboundBlacklistCallsDay':_0x3b81fc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3b81fc['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3b81fc['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3b81fc['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3b81fc[_0x174a('0x64')],'outboundDropCallsDayTimeout':_0x3b81fc[_0x174a('0x65')],'outboundNoAnswerCallsDay':_0x3b81fc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3b81fc[_0x174a('0x66')],'outboundOriginateFailureCallsDay':_0x3b81fc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3b81fc[_0x174a('0x67')],'outboundRejectCallsDay':_0x3b81fc[_0x174a('0x68')],'outboundUnknownCallsDay':_0x3b81fc['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3b81fc[_0x174a('0x69')],'predictiveIntervalAvgHoldtime':_0x3b81fc[_0x174a('0x6a')],'predictiveIntervalAvgTalktime':_0x3b81fc[_0x174a('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x3b81fc[_0x174a('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x3b81fc[_0x174a('0x6d')],'predictiveIntervalErlangCalls':_0x3b81fc[_0x174a('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x3b81fc[_0x174a('0x6f')],'predictiveIntervalHitRate':_0x3b81fc[_0x174a('0x70')],'predictiveIntervalMultiplicativeFactor':_0x3b81fc[_0x174a('0x71')],'predictiveIntervalPauses':_0x3b81fc[_0x174a('0x72')],'predictiveIntervalAvailable':_0x3b81fc[_0x174a('0x73')],'predictiveIntervalTotalCalls':_0x3b81fc[_0x174a('0x74')],'message':_0x3b81fc[_0x174a('0x3e')],'originated':_0x3b81fc[_0x174a('0x75')],'erlangCalls':_0x3b81fc[_0x174a('0x76')],'erlangCallToSecond':_0x3b81fc[_0x174a('0x77')],'erlangAbandonmentRate':_0x3b81fc[_0x174a('0x78')],'erlangBusyFactor':_0x3b81fc['erlangBusyFactor'],'startPredictive':_0x3b81fc[_0x174a('0x29')],'startProgressive':_0x3b81fc[_0x174a('0x2a')]};if(_0x3b81fc[_0x174a('0x79')]){_0xf3dbe5[_0x174a('0x79')]={'id':_0x3b81fc[_0x174a('0x79')]['id'],'name':_0x3b81fc[_0x174a('0x79')]['name'],'active':_0x3b81fc[_0x174a('0x79')][_0x174a('0x7a')],'callerid':_0x3b81fc[_0x174a('0x79')][_0x174a('0x7b')]};}if(_0x3b81fc['Interval']){_0xf3dbe5[_0x174a('0x43')]={'id':_0x3b81fc[_0x174a('0x43')]['id'],'name':_0x3b81fc[_0x174a('0x43')][_0x174a('0x41')]};}var _0x2c5a67=md5(JSON[_0x174a('0x4a')](_0xf3dbe5));if(_0x3b81fc[_0x174a('0x4')]!==_0x2c5a67){_0x3b81fc[_0x174a('0x4')]=_0x2c5a67;emit(util[_0x174a('0x7c')](_0x174a('0x7d'),_0xf3dbe5[_0x174a('0x41')]),_0x174a('0x7e'),_0xf3dbe5);}}}function emitCampaignSummary(_0x4da8bc){if(_0x4da8bc['type']===_0x174a('0x7f')){emit(util[_0x174a('0x7c')](_0x174a('0x80'),_0x4da8bc['name']),'campaign:save',_0x4da8bc);}}function checkGetDataPredictive(_0x51957b){if(isNotNull(_0x51957b)&&!_[_0x174a('0x47')](_0x51957b)){loggerPredictive['info'](_0x174a('0x81'));loggerPredictive[_0x174a('0x82')](_0x174a('0x83'),_0x51957b[_0x174a('0x74')]);loggerPredictive[_0x174a('0x82')](_0x174a('0x84'),_0x51957b['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x174a('0x85'),_0x51957b[_0x174a('0x6d')]);loggerPredictive[_0x174a('0x82')](_0x174a('0x86'),_0x51957b['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x174a('0x87'),_0x51957b[_0x174a('0x6a')]);loggerPredictive[_0x174a('0x82')](_0x174a('0x88'),_0x51957b[_0x174a('0x6b')]);loggerPredictive[_0x174a('0x82')]('---------------------------');if(_0x51957b[_0x174a('0x74')]>0x0){if(!_['isUndefined'](_0x51957b[_0x174a('0x6b')])&&_0x51957b[_0x174a('0x6b')]>0x0){return!![];}loggerPredictive[_0x174a('0x82')](_0x174a('0x89'));if(!_[_0x174a('0x3d')](_0x51957b[_0x174a('0x6a')])&&_0x51957b['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x174a('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x174a('0x8a'));}}else{loggerPredictive[_0x174a('0x82')](_0x174a('0x8b'));}return![];}function mergeDataErlangB(_0x5476a0){return function(_0x48d834){loggerPredictive[_0x174a('0x82')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x174a('0x82')](_0x174a('0x8c'),_0x48d834[_0x174a('0x76')]);loggerPredictive[_0x174a('0x82')](_0x174a('0x8d'),_0x48d834[_0x174a('0x77')]);loggerPredictive[_0x174a('0x82')](_0x174a('0x8e'),_0x48d834[_0x174a('0x78')]);loggerPredictive[_0x174a('0x82')](_0x174a('0x8f'),_0x48d834[_0x174a('0x90')]);loggerPredictive[_0x174a('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x48d834[_0x174a('0x78')]);loggerPredictive['info'](_0x174a('0x91'));_[_0x174a('0x92')](_0x5476a0,_0x48d834);};}function getDiff(_0xd7e239){var _0x334078=moment()[_0x174a('0x4b')](0x0);var _0x36bf9f=moment(_0xd7e239)[_0x174a('0x4b')](0x0);return _0x334078[_0x174a('0x4c')](_0x36bf9f,_0x174a('0x4d'));}function ifInterval(_0x11cb17,_0x56de9a){if(_[_0x174a('0x3d')](_0x56de9a)){return![];}return getDiff(_0x56de9a)<_0x11cb17*0x3c;}function freeVariablesPredictive(_0x13dc6f){if(isNotNull(_0x13dc6f)){if(!_[_0x174a('0x3d')](_0x13dc6f[_0x174a('0x2a')])){_0x13dc6f['startProgressive']=undefined;loggerPredictive[_0x174a('0x82')](_0x13dc6f[_0x174a('0x41')],_0x174a('0x93'));}if(!_[_0x174a('0x3d')](_0x13dc6f[_0x174a('0x29')])){_0x13dc6f[_0x174a('0x29')]=undefined;loggerPredictive['info'](_0x13dc6f['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x174a('0x3d')](_0x13dc6f[_0x174a('0x94')])){clearInterval(_0x13dc6f['handlePredictive']);_0x13dc6f['handlePredictive']=undefined;loggerPredictive[_0x174a('0x82')](_0x13dc6f[_0x174a('0x41')],_0x174a('0x95'));}}}function erlangb(_0x551db2,_0xdbfa65){if(_0xdbfa65===0x0){return 0x0;}var _0x1620f9=0x1;for(var _0x56666c=0x1;_0x56666c<=_0xdbfa65;_0x56666c+=0x1){_0x1620f9=0x1+_0x1620f9*_0x56666c/_0x551db2;}return 0x1/_0x1620f9;}function isVoiceQueueOutbound(_0x4fc397){return _0x4fc397==='outbound';}function isNotPreview(_0x37c0ce){return _0x37c0ce!==_0x174a('0x96');}function isCampaignIvr(_0x5dac7a){return _0x5dac7a===_0x174a('0x7f');}function getCallerId(_0x591bee,_0x1caa55,_0x5698b2){if(!_[_0x174a('0x3d')](_0x5698b2)&&typeof _0x5698b2==='string'&&!_['isEmpty'](_0x5698b2)){if(!_['isUndefined'](_0x1caa55)&&typeof _0x1caa55===_0x174a('0x97')&&!_['isEmpty'](_0x1caa55)){return util[_0x174a('0x7c')](_0x174a('0x98'),_0x1caa55,_0x5698b2);}return util[_0x174a('0x7c')](_0x174a('0x98'),_0x5698b2,_0x5698b2);}if(!_[_0x174a('0x3d')](_0x591bee)&&typeof _0x591bee==='string'&&!_[_0x174a('0x47')](_0x591bee)){return _0x591bee;}return _0x174a('0x99');}function loggerCatchQueueSummary(_0x28ea04,_0xbf03dc){return function(_0x425b9a){freeVariablesPredictive(_0xbf03dc);emitVoiceQueueSummary(_0xbf03dc);emitCampaignSummary(_0xbf03dc);loggerSyncQueueSummary[_0x174a('0x9a')](_0x28ea04,util[_0x174a('0x9b')](_0x425b9a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5c180a,_0x49b4e9){return function(_0x1bc541){loggerPredictive[_0x174a('0x9a')](_0x49b4e9[_0x174a('0x41')],_0x5c180a);loggerPredictive[_0x174a('0x9a')](_0x1bc541[_0x174a('0x9c')]);freeVariablesPredictive(_0x49b4e9);};}function loggerCatch(_0x4808ee){return function(_0xbb6d1){logger[_0x174a('0x9a')](_0x4808ee,util[_0x174a('0x9b')](_0xbb6d1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2ca7f4){return _0x2ca7f4&&!_['isUndefined'](_0x2ca7f4)&&_0x2ca7f4[_0x174a('0x9d')]>0x0;}function decremetOriginate(_0x3666f6){if(!_[_0x174a('0x3d')](_0x3666f6)&&_0x3666f6!==null){if(typeof _0x3666f6[_0x174a('0x75')]!==_0x174a('0x9e')){if(_0x3666f6[_0x174a('0x75')]>0x0){_0x3666f6['originated']-=0x1;}else{logger[_0x174a('0x9a')](_0x174a('0x9f'));}}}else{logger[_0x174a('0x9a')](_0x174a('0xa0'));}}function checkContactLowerLimitOriginate(_0x218fe4,_0x1dc992,_0x4f6bf8){if(_0x1dc992>_0x4f6bf8){for(var _0x353fcc=0x0;_0x353fcc<_0x1dc992-_0x4f6bf8;_0x353fcc+=0x1){decremetOriginate(_0x218fe4);}}}function loggerGetContactDialer(_0x54433d,_0x509619,_0x4e1ddd){return function(_0x50425d){checkContactLowerLimitOriginate(_0x509619,_0x4e1ddd,0x0);logger[_0x174a('0x9a')](_0x54433d,util['inspect'](_0x50425d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3705df){return function(_0x614094){if(isNotNull(_0x614094)&&isNotNull(_0x614094[0x0])){if(_0x614094[0x0][_0x174a('0xa1')]>0x0){_0x3705df[_0x174a('0x3e')]=_0x174a('0xa2');logger[_0x174a('0x82')](_0x174a('0xa3')+_0x3705df[_0x174a('0x41')],_0x614094[0x0]['contactsRescheduled'],_0x174a('0xa4'));}else{_0x3705df[_0x174a('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x174a('0xa5')+_0x3705df['name']);}}};}function notSendMessagesQueue(_0x1ad393){if(_0x1ad393[_0x174a('0xa6')]){freeVariablesPredictive(_0x1ad393);if(_0x1ad393[_0x174a('0x75')]===0x0&&_0x1ad393[_0x174a('0x59')]===0x0&&_0x1ad393[_0x174a('0x5c')]===0x0&&(_0x1ad393[_0x174a('0x55')]||0x0)===0x0){_0x1ad393[_0x174a('0xa6')]=![];_0x1ad393['available']=0x0;_0x1ad393['message']=_0x174a('0x40');loggerSyncQueueSummary[_0x174a('0x9a')](_0x174a('0xa7'),_0x1ad393['name'],_0x174a('0xa8'));}else{_0x1ad393[_0x174a('0x3e')]=_0x174a('0xa9');loggerSyncQueueSummary[_0x174a('0x9a')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1ad393[_0x174a('0x41')],_0x174a('0xaa'));}emitVoiceQueueSummary(_0x1ad393);}}function notSendMessagesCampaign(_0x74e612){if(_0x74e612['sendMessageOneNotActive']){if(_0x74e612[_0x174a('0x75')]===0x0){_0x74e612['sendMessageOneNotActive']=![];_0x74e612[_0x174a('0x3e')]=_0x174a('0x40');loggerSyncQueueSummary[_0x174a('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x74e612['name'],_0x174a('0xa8'));}else{_0x74e612[_0x174a('0x3e')]=_0x174a('0xa9');loggerSyncQueueSummary[_0x174a('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x74e612[_0x174a('0x41')],'is\x20disactive');}emitCampaignSummary(_0x74e612);}}function createObjHistory(_0x1f7ce3,_0x5f11fb,_0x2446c0,_0x345886,_0x5ed068){_0x1f7ce3[_0x174a('0x3e')]=_0x2446c0;var _0x6e450d=new Action(_0x1f7ce3,_0x5f11fb);var _0x234d5c=new History(_0x6e450d);_0x234d5c[_0x174a('0xab')]=_0x345886;_0x234d5c['statedesc']=_0x5ed068;_0x234d5c[_0x174a('0xac')]=_0x6e450d['starttime'];return _0x234d5c;}Dialer[_0x174a('0x1c')]['loopClearZombieChannels']=function(){var _0x13889b=this;setInterval(function(){_0x13889b[_0x174a('0xad')](_0x13889b['uniqueId'],_0x174a('0xae'));_0x13889b[_0x174a('0xad')](_0x13889b[_0x174a('0x25')],_0x174a('0xaf'));},0x32c8);};Dialer[_0x174a('0x1c')][_0x174a('0xad')]=function(_0x5d4c46,_0x137da6){var _0x469a97=this;for(var _0x591947 in _0x5d4c46){if(typeof _0x5d4c46[_0x591947]!==_0x174a('0x9e')){this[_0x174a('0x1f')][_0x174a('0xb0')](function(){if(!_[_0x174a('0xb1')](_0x5d4c46[_0x591947])){return ami['Action']({'action':_0x174a('0xb2'),'channel':_0x5d4c46[_0x591947][_0x174a('0xb3')]})[_0x174a('0xb4')](function(_0x2468b2){if(_0x2468b2[_0x174a('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5d4c46[_0x591947]&&_0x5d4c46[_0x591947][_0x174a('0x4f')]!==_0x174a('0x7f')){_0x469a97[_0x174a('0xb5')](_0x469a97[_0x174a('0x20')][_0x5d4c46[_0x591947][_0x174a('0xb6')]]);logger[_0x174a('0x9a')]('[Dialer][checkChannel]',_0x137da6,_0x591947,_0x5d4c46[_0x591947][_0x174a('0xb6')]);delete _0x5d4c46[_0x591947];}if(_0x5d4c46[_0x591947]&&_0x5d4c46[_0x591947][_0x174a('0x4f')]===_0x174a('0x7f')){_0x469a97['updateOriginated'](_0x469a97[_0x174a('0xb7')][_0x5d4c46[_0x591947][_0x174a('0xb6')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x137da6,_0x591947,_0x5d4c46[_0x591947][_0x174a('0xb6')]);delete _0x5d4c46[_0x591947];}},0x2328);}});}});}}};Dialer[_0x174a('0x1c')]['countReScheduled']=function(_0x4bd01a){return BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](cmHopper[_0x174a('0xba')](_0x4bd01a))[_0x174a('0xb4')](loggerCatch(_0x174a('0xbb')));};Dialer[_0x174a('0x1c')][_0x174a('0xbc')]=function(_0x4ba94f){return BPromise[_0x174a('0xb8')]()['then'](cmHopperBlack[_0x174a('0xbc')](_0x4ba94f))['catch'](loggerCatch(_0x174a('0xbd')));};Dialer[_0x174a('0x1c')]['checkIsBlackListIvr']=function(_0x51a211){return BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](cmHopperBlack['checkIsBlackListIvr'](_0x51a211))[_0x174a('0xb4')](loggerCatch(_0x174a('0xbe')));};Dialer[_0x174a('0x1c')]['averageHandleTime']=function(_0x4ed718){return BPromise['resolve']()[_0x174a('0xb9')](cmHopperHistory['avgHandleTime'](_0x4ed718))[_0x174a('0xb4')](loggerCatch(_0x174a('0xbf')));};Dialer[_0x174a('0x1c')]['rescheduleContact']=function(_0x13e916){return BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](cmHopper['rescheduleContact'](_0x13e916))[_0x174a('0xb4')](loggerCatch(_0x174a('0xc0')));};Dialer['prototype'][_0x174a('0xc1')]=function(_0xeb3e80,_0x39ea0d,_0x472c54){return BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](cmHopper[_0x174a('0xc1')](_0xeb3e80,_0x39ea0d,_0x472c54))[_0x174a('0xb4')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x174a('0x1c')][_0x174a('0xc2')]=function(_0x296648,_0x5efeb2,_0xfc5162,_0x3fb500){return BPromise[_0x174a('0xb8')]()['then'](cmHopper[_0x174a('0xc2')](_0x296648,_0x5efeb2,_0xfc5162,_0x3fb500))[_0x174a('0xb4')](loggerCatch(_0x174a('0xc3')));};Dialer[_0x174a('0x1c')][_0x174a('0xc4')]=function(_0x297474,_0x1dbc2e,_0x412224){return BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](cmHopper[_0x174a('0xc4')](_0x297474,_0x1dbc2e,_0x412224))['catch'](loggerCatch(_0x174a('0xc3')));};Dialer[_0x174a('0x1c')][_0x174a('0xc5')]=function(_0x6d543){return BPromise['resolve']()[_0x174a('0xb9')](voiceQueueRt[_0x174a('0xc5')](_0x6d543))[_0x174a('0xb4')](loggerCatch(_0x174a('0xc6')));};Dialer[_0x174a('0x1c')][_0x174a('0xc7')]=function(_0x274be3){return BPromise[_0x174a('0xb8')]()['then'](cmHopper[_0x174a('0xc7')](_0x274be3))['catch'](loggerCatch(_0x174a('0xc8')));};Dialer['prototype']['createHistory']=function(_0xdb937){return BPromise['resolve']()['then'](cmHopperHistory[_0x174a('0xc9')](_0xdb937))[_0x174a('0xb4')](loggerCatch(_0x174a('0xca')));};Dialer[_0x174a('0x1c')]['updateOriginated']=function(_0x387ed3){if(!_['isUndefined'](_0x387ed3)&&_0x387ed3!==null){if(typeof _0x387ed3['originated']!==_0x174a('0x9e')){if(_0x387ed3[_0x174a('0x75')]>0x0){_0x387ed3[_0x174a('0x75')]-=0x1;}else{logger[_0x174a('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x174a('0x9a')](_0x174a('0xcb'));}};Dialer[_0x174a('0x1c')][_0x174a('0xcc')]=function(_0x3c2ee9,_0x51ab7c){var _0x579ebb=this;return function(_0x528bbf){_0x579ebb['updateOriginated'](_0x51ab7c);logger['error'](_0x3c2ee9,util[_0x174a('0x9b')](_0x528bbf,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x235b37,_0x59b2b1,_0x5b0870){var _0xec0966={'state':0x19,'statedesc':_0x174a('0xcd')};this[_0x174a('0xb5')](_0x59b2b1);this[_0x174a('0xce')](_[_0x174a('0x92')](_0xec0966,_[_0x174a('0xcf')](_0x5b0870,[_0x174a('0xd0'),_0x174a('0xd1'),_0x174a('0xd2'),_0x174a('0xd3'),'CampaignId'])),'[emptyContact][createHistory]',_0x174a('0xd4'));logger[_0x174a('0x9a')](_0x235b37);};Dialer[_0x174a('0x1c')][_0x174a('0xd5')]=function(_0x28e1e6){return _0x28e1e6===_0x174a('0xd6');};Dialer['prototype'][_0x174a('0xd7')]=function(_0x571d5b){return!_['isUndefined'](_0x571d5b)&&_0x571d5b&&!_[_0x174a('0x3d')](_0x571d5b['name'])&&!_['isUndefined'](_0x571d5b[_0x174a('0x7a')])&&_0x571d5b[_0x174a('0x7a')]&&(this[_0x174a('0x22')][util[_0x174a('0x7c')](_0x174a('0xd8'),_0x571d5b[_0x174a('0x41')])][_0x174a('0xb2')]===_0x174a('0xd9')||this['trunks'][util['format'](_0x174a('0xd8'),_0x571d5b[_0x174a('0x41')])]['status']===_0x174a('0xda'));};Dialer[_0x174a('0x1c')]['saveInDb']=function(_0x520fba,_0x3374b3,_0x57b44d){this['createHistory'](_0x520fba)['catch'](loggerCatch(_0x3374b3));this[_0x174a('0xc7')](_0x520fba)[_0x174a('0xb4')](loggerCatch(_0x57b44d));};Dialer[_0x174a('0x1c')][_0x174a('0xdb')]=function(_0x488a94){var _0x27844b=this[_0x174a('0x27')][_0x488a94[_0x174a('0xdc')]];var _0x131646;if(!_[_0x174a('0xb1')](_0x488a94)&&!_[_0x174a('0xb1')](_0x488a94['variable'])&&!_['isNil'](_0x488a94[_0x174a('0xdd')]['amdstatus'])&&_0x488a94[_0x174a('0xde')]===_0x174a('0xdf')&&_0x27844b){if(_0x27844b['type']!=='ivr'&&this['voiceQueues'][_0x27844b[_0x174a('0xb6')]][_0x174a('0xe0')]&&_0x488a94[_0x174a('0xe1')]===_0x174a('0xe2')){delete this[_0x174a('0x27')][_0x488a94[_0x174a('0xdc')]];this[_0x174a('0xb5')](this[_0x174a('0x20')][_0x27844b['queue']]);this['voiceQueues'][_0x27844b[_0x174a('0xb6')]][_0x174a('0x63')]+=0x1;this[_0x174a('0x20')][_0x27844b[_0x174a('0xb6')]][_0x174a('0xe3')]+=0x1;_0x131646=new Hangup(_0x27844b,_0x488a94);_0x131646[_0x174a('0xab')]=0x12;_0x131646[_0x174a('0xe4')]=_0x174a('0xe5');_0x131646[_0x174a('0xe6')]=_0x174a('0xe7');this['saveInDb'](_0x131646,'[syncHangupInAMD][createHistory]',_0x174a('0xe8'));}if(_0x27844b['type']!==_0x174a('0x7f')&&this[_0x174a('0x20')][_0x27844b['queue']][_0x174a('0xe0')]&&_0x488a94[_0x174a('0xe1')]===_0x174a('0xe9')){var _0x2b6f71=this;return new BPromise(function(_0xc415b6,_0x2ff5e8){delete _0x2b6f71[_0x174a('0x27')][_0x488a94[_0x174a('0xdc')]];_0x2b6f71[_0x174a('0xb5')](_0x2b6f71['voiceQueues'][_0x27844b[_0x174a('0xb6')]]);_0x2b6f71[_0x174a('0x20')][_0x27844b[_0x174a('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x2b6f71[_0x174a('0x20')][_0x27844b['queue']][_0x174a('0xe3')]+=0x1;var _0x548014=_0x2b6f71['voiceQueues'][_0x27844b[_0x174a('0xb6')]];var _0x222bce=new Hangup(_0x27844b,_0x488a94);_0x222bce[_0x174a('0xab')]=0x13;_0x222bce['statedesc']=_0x174a('0xea');_0x222bce[_0x174a('0xe6')]=_0x174a('0xe7');_0x222bce[_0x174a('0xeb')]+=0x1;_0x222bce[_0x174a('0xec')]+=0x1;_0x222bce[_0x174a('0xed')]=!![];_0x2b6f71[_0x174a('0xc9')](_0x222bce)[_0x174a('0xb4')](loggerCatch(_0x174a('0xee')));if(_0x222bce[_0x174a('0xef')]+_0x222bce[_0x174a('0xf0')]+_0x222bce[_0x174a('0xf1')]+_0x222bce[_0x174a('0xf2')]+_0x222bce['countdropretry']+_0x222bce['countabandonedretry']+_0x222bce[_0x174a('0xeb')]+_0x222bce['countagentrejectretry']>=_0x548014[_0x174a('0xf3')]){_0x2b6f71[_0x174a('0xf4')](_0x222bce,_0xc415b6,_0x2ff5e8,_0x174a('0xf5'));}else{if(_0x222bce[_0x174a('0xeb')]>=_0x548014[_0x174a('0xf6')]){_0x2b6f71['createStateFinal'](_0x222bce,_0xc415b6,_0x2ff5e8,'reason\x2019\x20machine....');}else{_0x2b6f71[_0x174a('0xf7')]({'active':![],'countmachineretry':_0x222bce['countmachineretry'],'scheduledat':moment()[_0x174a('0xf8')](_0x548014[_0x174a('0xf9')],_0x174a('0xfa'))[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x222bce[_0x174a('0xd0')],'ListId':_0x222bce[_0x174a('0xd1')],'VoiceQueueId':_0x222bce['VoiceQueueId']||undefined,'CampaignId':_0x222bce[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0xfd')));_0xc415b6({'reschedule':0x1});}}});}if(_0x27844b[_0x174a('0x4f')]==='ivr'&&this[_0x174a('0xb7')][_0x27844b[_0x174a('0xb6')]][_0x174a('0xe0')]&&_0x488a94['value']===_0x174a('0xe2')){delete this[_0x174a('0x27')][_0x488a94[_0x174a('0xdc')]];this[_0x174a('0xb5')](this[_0x174a('0xb7')][_0x27844b['queue']]);_0x131646=new Hangup(_0x27844b,_0x488a94);_0x131646['state']=0x12;_0x131646['statedesc']=_0x174a('0xe5');_0x131646[_0x174a('0xe6')]=_0x174a('0xe7');this[_0x174a('0xce')](_0x131646,_0x174a('0xfe'),'[syncHangupInAMDIvr]');}if(_0x27844b['type']===_0x174a('0x7f')&&this['campaigns'][_0x27844b[_0x174a('0xb6')]]['dialAMDActive']&&_0x488a94['value']===_0x174a('0xe9')){var _0x2b6f71=this;return new BPromise(function(_0x5ed890,_0x35b607){delete _0x2b6f71[_0x174a('0x27')][_0x488a94[_0x174a('0xdc')]];_0x2b6f71[_0x174a('0xb5')](_0x2b6f71[_0x174a('0xb7')][_0x27844b[_0x174a('0xb6')]]);_0x2b6f71[_0x174a('0xb7')][_0x27844b[_0x174a('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x2b6f71[_0x174a('0xb7')][_0x27844b[_0x174a('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x185993=_0x2b6f71[_0x174a('0xb7')][_0x27844b['queue']];var _0x38b420=new Hangup(_0x27844b,_0x488a94);_0x38b420[_0x174a('0xab')]=0x13;_0x38b420[_0x174a('0xe4')]=_0x174a('0xea');_0x38b420[_0x174a('0xe6')]=_0x174a('0xe7');_0x38b420[_0x174a('0xeb')]+=0x1;_0x38b420['countglobal']+=0x1;_0x38b420[_0x174a('0xed')]=!![];_0x2b6f71['createHistory'](_0x38b420)['catch'](loggerCatch(_0x174a('0xee')));if(_0x38b420[_0x174a('0xef')]+_0x38b420[_0x174a('0xf0')]+_0x38b420[_0x174a('0xf1')]+_0x38b420['countnosuchnumberretry']+_0x38b420[_0x174a('0xff')]+_0x38b420['countabandonedretry']+_0x38b420[_0x174a('0xeb')]+_0x38b420['countagentrejectretry']>=_0x185993[_0x174a('0xf3')]){_0x2b6f71[_0x174a('0xf4')](_0x38b420,_0x5ed890,_0x35b607,_0x174a('0xf5'));}else{if(_0x38b420[_0x174a('0xeb')]>=_0x185993[_0x174a('0xf6')]){_0x2b6f71[_0x174a('0x100')](_0x38b420,_0x5ed890,_0x35b607,_0x174a('0x101'));}else{_0x2b6f71['rescheduleContact']({'active':![],'countmachineretry':_0x38b420[_0x174a('0xeb')],'scheduledat':moment()[_0x174a('0xf8')](_0x185993[_0x174a('0xf9')],'minutes')[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x38b420[_0x174a('0xd0')],'ListId':_0x38b420[_0x174a('0xd1')],'VoiceQueueId':_0x38b420[_0x174a('0xd3')]||undefined,'CampaignId':_0x38b420[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0xfd')));_0x5ed890({'reschedule':0x1});}}});}}};Dialer[_0x174a('0x1c')]['syncHangup']=function(_0x377733){var _0x29f68f=this[_0x174a('0x27')][_0x377733['uniqueid']];var _0x2916c7=this;var _0x158b36;if(_0x29f68f&&_0x29f68f[_0x174a('0x4f')]===_0x174a('0x7f')){delete this[_0x174a('0x27')][_0x377733[_0x174a('0xdc')]];this[_0x174a('0xb5')](this[_0x174a('0xb7')][_0x29f68f['queue']]);this['campaigns'][_0x29f68f[_0x174a('0xb6')]]['ivrAnswerCallsDay']+=0x1;_0x158b36=new Hangup(_0x29f68f,_0x377733);this[_0x174a('0xc9')](_0x158b36)[_0x174a('0xb4')](loggerCatch(_0x174a('0x102')));this[_0x174a('0xc7')](_0x158b36)[_0x174a('0xb4')](loggerCatch(_0x174a('0x103')));}if(_0x29f68f&&_0x29f68f[_0x174a('0x4f')]!==_0x174a('0x7f')&&isNotNull(this[_0x174a('0x20')][_0x29f68f['queue']][_0x174a('0x104')])){delete this['uniqueId'][_0x377733[_0x174a('0xdc')]];this[_0x174a('0xb5')](this[_0x174a('0x20')][_0x29f68f[_0x174a('0xb6')]]);this['voiceQueues'][_0x29f68f[_0x174a('0xb6')]][_0x174a('0x63')]+=0x1;this[_0x174a('0x20')][_0x29f68f[_0x174a('0xb6')]][_0x174a('0xe3')]+=0x1;_0x158b36=new Hangup(_0x29f68f,_0x377733);_0x158b36['state']=0x10;_0x158b36[_0x174a('0xe4')]=_0x174a('0x105');_0x158b36[_0x174a('0xe6')]=_0x174a('0x106');this[_0x174a('0xc9')](_0x158b36)[_0x174a('0xb4')](loggerCatch(_0x174a('0x102')));this['moveContactManagedDialer'](_0x158b36)[_0x174a('0xb4')](loggerCatch(_0x174a('0x103')));}if(_0x29f68f&&_0x29f68f[_0x174a('0x4f')]!==_0x174a('0x7f')&&!isNotNull(this[_0x174a('0x20')][_0x29f68f[_0x174a('0xb6')]]['dialQueueProject'])){delete this['uniqueId'][_0x377733[_0x174a('0xdc')]];this[_0x174a('0xb5')](this[_0x174a('0x20')][_0x29f68f['queue']]);this[_0x174a('0x20')][_0x29f68f[_0x174a('0xb6')]][_0x174a('0x107')]+=0x1;_0x158b36=new Hangup(_0x29f68f,_0x377733);_0x158b36[_0x174a('0xab')]=0xc;_0x158b36['statedesc']=_0x377733['cause-txt'];_0x158b36['membername']=_0x174a('0x108');this[_0x174a('0xc9')](_0x158b36)[_0x174a('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x174a('0xc7')](_0x158b36)[_0x174a('0xb4')](loggerCatch(_0x174a('0x103')));}};Dialer[_0x174a('0x1c')][_0x174a('0x33')]=function(_0x32d6f7){var _0x4640a4=this[_0x174a('0x27')][_0x32d6f7['uniqueid']];var _0x1e4f36=this;if(this[_0x174a('0x20')][_0x32d6f7[_0x174a('0xb6')]]){if(_0x4640a4&&_0x4640a4['type']!==_0x174a('0x7f')){delete this[_0x174a('0x27')][_0x32d6f7[_0x174a('0xdc')]];this[_0x174a('0x20')][_0x32d6f7[_0x174a('0xb6')]][_0x174a('0x63')]+=0x1;var _0x5bd298=new AgentComplete(_0x4640a4,_0x32d6f7);if(_0x32d6f7[_0x174a('0x109')]===_0x174a('0x10a')){_0x5bd298[_0x174a('0x10b')]=this['voiceQueues'][_0x32d6f7['queue']][_0x174a('0x10c')]&&this['voiceQueues'][_0x32d6f7[_0x174a('0xb6')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x174a('0xc9')](_0x5bd298)[_0x174a('0xb4')](loggerCatch(_0x174a('0x10d')));this[_0x174a('0xc7')](_0x5bd298)['catch'](loggerCatch(_0x174a('0x10e')));}}};Dialer['prototype'][_0x174a('0x2e')]=function(_0x5b356c){if(this[_0x174a('0x20')][_0x5b356c[_0x174a('0xb6')]]){if(this[_0x174a('0x27')][_0x5b356c[_0x174a('0xdc')]]&&this[_0x174a('0x27')][_0x5b356c[_0x174a('0xdc')]][_0x174a('0x4f')]!==_0x174a('0x7f')){this[_0x174a('0xb5')](this[_0x174a('0x20')][_0x5b356c[_0x174a('0xb6')]]);this[_0x174a('0x27')][_0x5b356c[_0x174a('0xdc')]][_0x174a('0x10f')]=moment()[_0x174a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x174a('0x1c')]['queueCallerAbandonCreateState']=function(_0x5f3a01){this['createHistory'](_0x5f3a01)[_0x174a('0xb4')](loggerCatch(_0x174a('0x10d')));this[_0x174a('0xc7')](_0x5f3a01)[_0x174a('0xb4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x174a('0x110')]=function(_0x1640f1){var _0x1ccc54=this[_0x174a('0x27')][_0x1640f1[_0x174a('0xdc')]];var _0x1fa6a3=this;if(this[_0x174a('0x20')][_0x1640f1['queue']]){if(_0x1ccc54&&_0x1ccc54[_0x174a('0x4f')]!=='ivr'){delete this[_0x174a('0x27')][_0x1640f1[_0x174a('0xdc')]];this['updateOriginated'](this[_0x174a('0x20')][_0x1640f1['queue']]);_0x1ccc54['droptime']=moment()['format'](_0x174a('0xfb'));var _0x26758c=new QueueCallerAbandon(_0x1ccc54,_0x1640f1);if(getSeconds(_0x1ccc54[_0x174a('0x111')],_0x1ccc54[_0x174a('0x112')])>=_0x1ccc54[_0x174a('0x113')]){this[_0x174a('0x20')][_0x1640f1['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x174a('0x20')][_0x1640f1[_0x174a('0xb6')]][_0x174a('0x65')]+=0x1;this[_0x174a('0x20')][_0x1640f1['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x26758c[_0x174a('0xab')]=0xa;_0x26758c[_0x174a('0xe4')]=_0x174a('0x114');_0x26758c[_0x174a('0x115')]='TIMEOUT';_0x26758c[_0x174a('0x10b')]=this[_0x174a('0x20')][_0x1640f1['queue']][_0x174a('0x10c')]?moment()[_0x174a('0x7c')](_0x174a('0xfb')):undefined;_0x26758c[_0x174a('0xff')]+=0x1;_0x26758c['countglobal']+=0x1;if(_0x26758c[_0x174a('0xff')]>=this[_0x174a('0x20')][_0x1640f1[_0x174a('0xb6')]][_0x174a('0x116')]){this[_0x174a('0x117')](_0x26758c);}else{this[_0x174a('0xf7')]({'active':![],'countdropretry':_0x26758c[_0x174a('0xff')],'scheduledat':moment()[_0x174a('0xf8')](this[_0x174a('0x20')][_0x1640f1['queue']][_0x174a('0x118')],_0x174a('0xfa'))[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x1ccc54[_0x174a('0xd0')],'ListId':_0x1ccc54[_0x174a('0xd1')],'VoiceQueueId':_0x1ccc54[_0x174a('0xd3')]||undefined,'CampaignId':_0x1ccc54[_0x174a('0xfc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3428a8=new History(_0x26758c);_0x3428a8[_0x174a('0xab')]=0xa;_0x3428a8[_0x174a('0xe4')]='Drop';_0x3428a8['starttime']=moment()[_0x174a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3428a8[_0x174a('0xac')]=_0x3428a8[_0x174a('0x119')];_0x3428a8[_0x174a('0x11a')]=_0x26758c[_0x174a('0x11a')];_0x3428a8[_0x174a('0x11b')]=_0x26758c['calleridnum'];this[_0x174a('0xc9')](_0x3428a8)['catch'](loggerCatch(_0x174a('0x11c')));}}else{this['voiceQueues'][_0x1640f1[_0x174a('0xb6')]][_0x174a('0x6c')]+=0x1;this[_0x174a('0x20')][_0x1640f1['queue']][_0x174a('0x64')]+=0x1;_0x26758c[_0x174a('0xab')]=0xb;_0x26758c['statedesc']=_0x174a('0x11d');_0x26758c[_0x174a('0x115')]=_0x174a('0x11e');_0x26758c[_0x174a('0x11f')]+=0x1;_0x26758c[_0x174a('0xec')]+=0x1;if(_0x26758c[_0x174a('0x11f')]>=this[_0x174a('0x20')][_0x1640f1['queue']]['dialAbandonedMaxRetry']){this[_0x174a('0x117')](_0x26758c);}else{this[_0x174a('0xf7')]({'active':![],'countabandonedretry':_0x26758c['countabandonedretry'],'scheduledat':moment()[_0x174a('0xf8')](this[_0x174a('0x20')][_0x1640f1['queue']]['dialAbandonedRetryFrequency'],_0x174a('0xfa'))[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x1ccc54[_0x174a('0xd0')],'ListId':_0x1ccc54[_0x174a('0xd1')],'VoiceQueueId':_0x1ccc54[_0x174a('0xd3')]||undefined,'CampaignId':_0x1ccc54[_0x174a('0xfc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3428a8=new History(_0x26758c);_0x3428a8[_0x174a('0xab')]=0xb;_0x3428a8[_0x174a('0xe4')]='Abandoned';_0x3428a8['starttime']=moment()['format'](_0x174a('0xfb'));_0x3428a8[_0x174a('0xac')]=_0x3428a8[_0x174a('0x119')];_0x3428a8['calleridname']=_0x26758c[_0x174a('0x11a')];_0x3428a8['calleridnum']=_0x26758c['calleridnum'];this[_0x174a('0xc9')](_0x3428a8)[_0x174a('0xb4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x174a('0x1c')][_0x174a('0x36')]=function(_0x512007){if(this[_0x174a('0x25')][_0x512007[_0x174a('0xdc')]]){this[_0x174a('0x25')][_0x512007[_0x174a('0xdc')]][_0x174a('0xb3')]=_0x512007[_0x174a('0xb3')];}if(this[_0x174a('0x27')][_0x512007[_0x174a('0xdc')]]){this['uniqueId'][_0x512007[_0x174a('0xdc')]][_0x174a('0xb3')]=_0x512007[_0x174a('0xb3')];}};Dialer[_0x174a('0x1c')][_0x174a('0x38')]=function(_0x70adca){if(strategy[this[_0x174a('0x20')][this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]]['queue']]['strategy']]===_0x174a('0x1b')){if(this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]]&&_[_0x174a('0xb1')](this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]]['locked'])&&_0x70adca[_0x174a('0xb2')]==='1'&&_0x70adca[_0x174a('0x121')]==='0'){if(this[_0x174a('0x21')][_0x70adca['stateinterface']]){if(!this[_0x174a('0x21')][_0x70adca[_0x174a('0x122')]][_0x174a('0x123')]){this[_0x174a('0x21')][_0x70adca[_0x174a('0x122')]]['locked']=!![];this[_0x174a('0x25')][_0x70adca['actionid']][_0x174a('0x123')]=!![];this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]]['stateinterface']=_0x70adca[_0x174a('0x122')];}}}}else if((strategy[this['voiceQueues'][this[_0x174a('0x25')][_0x70adca['actionid']][_0x174a('0xb6')]][_0x174a('0x51')]]||'rrmemory')===_0x174a('0x1a')){if(this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]]){if(this[_0x174a('0x21')][_0x70adca['stateinterface']]){this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]][_0x174a('0x122')]=_0x70adca[_0x174a('0x122')];if(_[_0x174a('0xb1')](this[_0x174a('0x2c')][this[_0x174a('0x25')][_0x70adca['actionid']][_0x174a('0xb6')]])){this[_0x174a('0x2c')][this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]][_0x174a('0xb6')]]=[];}this['queueBooked'][this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]][_0x174a('0xb6')]]['push'](_['merge'](_['pick'](this[_0x174a('0x25')][_0x70adca[_0x174a('0x120')]],[_0x174a('0x124'),_0x174a('0x122')]),{'status':_0x70adca[_0x174a('0xb2')],'paused':_0x70adca[_0x174a('0x121')]}));}}}};function unlockQueueStatus(_0x282b87,_0x4e70b6){setTimeout(function(){if(_['isUndefined'](_0x282b87['queueStatusComplete'])){loggerBooked[_0x174a('0x9a')](_0x174a('0x125'),_0x4e70b6);}_0x282b87[_0x174a('0x126')]=!![];loggerBooked[_0x174a('0x82')](_0x174a('0x127'),_0x4e70b6,JSON[_0x174a('0x4a')](_[_0x174a('0xcf')](_0x282b87,[_0x174a('0x41'),_0x174a('0x126')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2fc81e){var _0x467c7a=this;var _0x44e05d=_0x467c7a[_0x174a('0x20')][_0x467c7a[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]]['queue']];if(strategy[this[_0x174a('0x20')][this[_0x174a('0x25')][_0x2fc81e['actionid']][_0x174a('0xb6')]]['strategy']]===_0x174a('0x1b')){if(this['actions'][_0x2fc81e[_0x174a('0x120')]]&&this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]]['stateinterface']){this[_0x174a('0x96')][_0x174a('0x128')](this['actions'][_0x2fc81e[_0x174a('0x120')]][_0x174a('0x124')],this[_0x174a('0x25')][_0x2fc81e['actionid']][_0x174a('0x122')])[_0x174a('0xb4')](function(_0x912028){logger[_0x174a('0x9a')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x174a('0x9b')](_0x912028,{'showHidden':![],'depth':null}));})[_0x174a('0x1e')](function(){_0x467c7a['updateOriginated'](_0x467c7a[_0x174a('0x20')][_0x467c7a[_0x174a('0x25')][_0x2fc81e['actionid']][_0x174a('0xb6')]]);_0x467c7a[_0x174a('0x21')][_0x467c7a[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]][_0x174a('0x122')]][_0x174a('0x123')]=![];delete _0x467c7a[_0x174a('0x25')][_0x2fc81e['actionid']];unlockQueueStatus(_0x44e05d);});}else{this[_0x174a('0xb5')](this[_0x174a('0x20')][this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xb6')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xd0')],'ListId':this['actions'][_0x2fc81e[_0x174a('0x120')]]['ListId'],'VoiceQueueId':this['actions'][_0x2fc81e[_0x174a('0x120')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x129')));delete this[_0x174a('0x25')][_0x2fc81e['actionid']];unlockQueueStatus(_0x44e05d);}}else if((strategy[this[_0x174a('0x20')][this['actions'][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xb6')]][_0x174a('0x51')]]||_0x174a('0x1a'))===_0x174a('0x1a')){var _0x42ddec;if(this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]]&&!_[_0x174a('0x47')](this[_0x174a('0x2c')][this['actions'][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xb6')]])){if(this[_0x174a('0x2d')][_0x467c7a[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]]['queue']]){this['queueBookedRR'][_0x467c7a[_0x174a('0x25')][_0x2fc81e['actionid']][_0x174a('0xb6')]]=this[_0x174a('0x2d')][this[_0x174a('0x25')][_0x2fc81e['actionid']]['queue']]?this[_0x174a('0x2d')][this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xb6')]]:this[_0x174a('0x2c')][this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]]['queue']]?this[_0x174a('0x2c')][this[_0x174a('0x25')][_0x2fc81e['actionid']][_0x174a('0xb6')]][_0x174a('0x12a')]||0x0:0x0;}this[_0x174a('0x2c')][this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]][_0x174a('0xb6')]][_0x174a('0x12a')]=this[_0x174a('0x2d')][this[_0x174a('0x25')][_0x2fc81e[_0x174a('0x120')]]['queue']];for(var _0x13dffc=0x0;_0x13dffc=0x0;})[_0x174a('0xb4')](myreject(_0x27fc7d)));}}else{_0x2b4468[_0x174a('0x140')](ami['Action']({'action':_0x174a('0x142'),'command':util[_0x174a('0x7c')](_0x174a('0x143'),_0x4d7816,!_['isUndefined'](config['timezones'][_0x410944])?_0x410944:'')})['then'](function(_0x288667){return _0x288667['content']['indexOf'](_0x174a('0x146'))>=0x0;})[_0x174a('0xb4')](myreject(_0x27fc7d)));}BPromise['all'](_0x2b4468)[_0x174a('0xb9')](function(_0x134d21){var _0x22e6d4=_[_0x174a('0x147')](_0x134d21);if(_0x22e6d4){return _0x3bfef5(_0x22e6d4);}else{_0x4d080a[_0x174a('0x3e')]=_0x497bf2?_0x174a('0x148'):_0x174a('0x149');return _0x27fc7d(msgResponse(_0x174a('0x14a'),'Failure',_0x174a('0x14b')+_0x497bf2+'\x20'+_0x63461+'\x20Interval\x20is\x20overtime:\x20'+util[_0x174a('0x9b')](_0x4d7816,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x410944));}})[_0x174a('0xb4')](function(_0x13db45){return _0x27fc7d(msgResponse(_0x174a('0x139'),_0x174a('0x13a'),JSON['stringify'](_0x13db45)));});});};Dialer[_0x174a('0x1c')]['checkDialMethod']=function(_0x537150){var _0x19e2d0=this;return function(){switch(_0x537150[_0x174a('0x5f')]){case _0x174a('0x14c'):freeVariablesPredictive(_0x537150);_0x19e2d0[_0x174a('0x14d')](_0x537150,0x1);break;case _0x174a('0x14e'):freeVariablesPredictive(_0x537150);_0x19e2d0['handlePower'](_0x537150,_0x537150['dialPowerLevel']);break;case'predictive':_0x19e2d0['predictive'](_0x537150);break;case _0x174a('0x9'):freeVariablesPredictive(_0x537150);_0x19e2d0['handlePower'](_0x537150,0x1);break;default:freeVariablesPredictive(_0x537150);logger[_0x174a('0x9a')](_0x174a('0x14f'),_0x537150[_0x174a('0x41')],_0x174a('0x150'));}};};Dialer[_0x174a('0x1c')][_0x174a('0x151')]=function(_0x435fdb){var _0x42036d=this;return function(){_0x42036d[_0x174a('0x152')](_0x435fdb);};};Dialer['prototype'][_0x174a('0xc')]=function(_0x712d13){var _0x2e1237=this;if(isNotPreview(_0x712d13['dialMethod'])){if(isVoiceQueueOutbound(_0x712d13['type'])&&isActive(_0x712d13[_0x174a('0x5e')])){_0x712d13['sendMessageOneNotActive']=!![];BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](checkIsLoggedIn(_0x712d13,_0x712d13['loggedIn']))[_0x174a('0xb9')](checkIsActive(_0x712d13,_0x712d13[_0x174a('0x5e')]))[_0x174a('0xb9')](checkInterval(_0x712d13))[_0x174a('0xb9')](_0x2e1237[_0x174a('0x136')](_0x712d13))['then'](_0x2e1237[_0x174a('0x138')](_0x712d13[_0x174a('0x153')],_0x712d13['dialTimezone'],_0x712d13['name'],_0x712d13))['then'](_0x2e1237[_0x174a('0x154')](_0x712d13[_0x174a('0x43')],_0x712d13['dialTimezone'],_0x712d13['name'],_0x712d13))['then'](_0x2e1237['checkDialMethod'](_0x712d13))[_0x174a('0xb4')](loggerCatchQueueSummary(_0x174a('0x155'),_0x712d13));}else{notSendMessagesQueue(_0x712d13);}}else{freeVariablesPredictive(_0x712d13);}};Dialer[_0x174a('0x1c')][_0x174a('0x135')]=function(){var _0x503a46=this;var _0x5cba1d;for(var _0x2d89a7 in this[_0x174a('0xb7')]){if(typeof this['campaigns'][_0x2d89a7]!==_0x174a('0x9e')){_0x5cba1d=this[_0x174a('0xb7')][_0x2d89a7];if(isCampaignIvr(_0x5cba1d[_0x174a('0x4f')])&&isActive(_0x5cba1d[_0x174a('0x7a')])){_0x5cba1d[_0x174a('0xa6')]=!![];BPromise[_0x174a('0xb8')]()[_0x174a('0xb9')](checkIsActive(_0x5cba1d,_0x5cba1d[_0x174a('0x7a')]))[_0x174a('0xb9')](checkInterval(_0x5cba1d))['then'](_0x503a46['checkIsTrunkReachable'](_0x5cba1d))['then'](_0x503a46[_0x174a('0x138')](_0x5cba1d['dialGlobalInterval'],_0x5cba1d['dialTimezone'],_0x5cba1d[_0x174a('0x41')],_0x5cba1d))[_0x174a('0xb9')](_0x503a46[_0x174a('0x154')](_0x5cba1d[_0x174a('0x43')],_0x5cba1d[_0x174a('0x156')],_0x5cba1d[_0x174a('0x41')],_0x5cba1d))[_0x174a('0xb9')](_0x503a46[_0x174a('0x151')](_0x5cba1d))[_0x174a('0xb4')](loggerCatchQueueSummary(_0x174a('0x157'),_0x5cba1d));}else{notSendMessagesCampaign(_0x5cba1d);}}}};function getCallerIdRandom(_0x3a9c06,_0x70207e){var _0x3c3e73;var _0x542d86;var _0x51d3fe;if(_0x70207e<=0x0){_0x70207e=0x1;}_0x3c3e73=new RegExp(_0x174a('0x158')+_0x70207e+'}$');_0x542d86=Math['pow'](0xa,_0x70207e-0x1);_0x51d3fe=Math[_0x174a('0x159')](0xa,_0x70207e)-0x1;return util[_0x174a('0x7c')]('%s',_['replace'](_0x3a9c06,_0x3c3e73,_[_0x174a('0x15a')](_0x542d86,_0x51d3fe)));}function extractCalleridName(_0x37e74d){var _0x259245=_0x37e74d[_0x174a('0x15b')](/"(.*?)"/);return _0x259245?_0x259245[0x1]:_0x37e74d;}function extractCalleridNumber(_0x187f11){var _0x391ee5=_0x187f11[_0x174a('0x15b')](/<(.*?)>/);return _0x391ee5?_0x391ee5[0x1]:_0x187f11;}Dialer[_0x174a('0x1c')][_0x174a('0x15c')]=function(_0x20bb04,_0x39a17b){var _0x321560=this;var _0x14751c=uuid['v4']();this['actions'][_0x14751c]=new Action(_0x20bb04,_0x39a17b,_0x14751c);return new BPromise(function(_0x2f58fc,_0x2e6a45){if(_[_0x174a('0x3d')](_0x20bb04)&&typeof _0x20bb04!=='object'){return _0x2e6a45(msgResponse(_0x174a('0x15d'),'Failure',_0x174a('0x15e')));}if(_[_0x174a('0x3d')](_0x39a17b[_0x174a('0x15f')][_0x174a('0x160')])||_0x39a17b[_0x174a('0x15f')][_0x174a('0x160')]===null){return _0x2e6a45(msgResponse(_0x174a('0x15d'),_0x174a('0x13a'),_0x174a('0x161')));}var _0x3be366={'XMD-CALLERID':_0x321560[_0x174a('0x25')][_0x14751c][_0x174a('0x162')](),'XMD-AGI':_0x20bb04[_0x174a('0x104')]?util[_0x174a('0x7c')](_0x174a('0x163'),ipAgi,_0x20bb04[_0x174a('0x104')]):_0x174a('0x164'),'XMD-AGIAFTER':_0x20bb04[_0x174a('0x10c')]?util['format'](_0x174a('0x163'),ipAgi,_0x20bb04['dialQueueProject2']):'NONE','XMD-QUEUE':_0x20bb04[_0x174a('0x4f')]===_0x174a('0x50')?util[_0x174a('0x7c')]('\x22%s,%s%s,,,%s\x22',_0x20bb04[_0x174a('0x41')],_0x20bb04['dialQueueOptions']||'',_0x20bb04[_0x174a('0x165')]?'c':'',_0x20bb04['dialQueueTimeout']||0x3):_0x174a('0x164'),'XMD-CONTACTID':_0x39a17b[_0x174a('0xd0')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x321560['actions'][_0x14751c]['getCaller'](),'XMD-AMD':_0x20bb04['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x20bb04[_0x174a('0xe0')]){_0x3be366[_0x174a('0x166')]=_0x20bb04[_0x174a('0x167')]||0x9c4;_0x3be366[_0x174a('0x168')]=_0x20bb04[_0x174a('0x169')]||0x5dc;_0x3be366[_0x174a('0x16a')]=_0x20bb04[_0x174a('0x16b')]||0x320;_0x3be366['XMD-AMDTOTALANALYSISTIME']=_0x20bb04[_0x174a('0x16c')]||0x1388;_0x3be366[_0x174a('0x16d')]=_0x20bb04['dialAMDMinWordLength']||0x64;_0x3be366[_0x174a('0x16e')]=_0x20bb04[_0x174a('0x16f')]||0x32;_0x3be366[_0x174a('0x170')]=_0x20bb04['dialAMDMaximumNumberOfWords']||0x3;_0x3be366[_0x174a('0x171')]=_0x20bb04[_0x174a('0x172')]||0x100;_0x3be366[_0x174a('0x173')]=_0x20bb04[_0x174a('0x174')]||0x1388;}if(_0x20bb04[_0x174a('0x4f')]===_0x174a('0x50')){_0x3be366['XMD-VOICEQUEUEID']=_0x39a17b[_0x174a('0xd3')];}else{_0x3be366['XMD-CAMPAIGNID']=_0x39a17b['CampaignId'];}for(var _0x4cda4c in _0x39a17b[_0x174a('0x15f')]){if(typeof _0x39a17b['Contact'][_0x4cda4c]!=='undefined'){if(isNotNull(_0x39a17b[_0x174a('0x15f')][_0x4cda4c])&&_0x4cda4c!=='id'&&_0x4cda4c!==_0x174a('0x175')&&_0x4cda4c!==_0x174a('0x176')&&_0x4cda4c!=='updatedAt'){_0x3be366[util[_0x174a('0x7c')](_0x174a('0x177'),'XMD-',_['toUpper'](_0x4cda4c))]=_0x39a17b[_0x174a('0x15f')][_0x4cda4c];}}}var _0x539477=_0x321560[_0x174a('0xd7')](_0x20bb04['Trunk'])?getCallerId(_0x20bb04[_0x174a('0x79')][_0x174a('0x7b')],_0x20bb04[_0x174a('0x60')],_0x20bb04[_0x174a('0x178')]>0x0?getCallerIdRandom(_0x20bb04[_0x174a('0x61')],_0x20bb04[_0x174a('0x178')]):_0x20bb04[_0x174a('0x61')]):getCallerId(_['isNil'](_0x20bb04[_0x174a('0x137')])?_0x20bb04[_0x174a('0x79')][_0x174a('0x7b')]:_0x20bb04[_0x174a('0x137')][_0x174a('0x7b')],_0x20bb04[_0x174a('0x60')],_0x20bb04[_0x174a('0x178')]>0x0?getCallerIdRandom(_0x20bb04[_0x174a('0x61')],_0x20bb04[_0x174a('0x178')]):_0x20bb04['dialOriginateCallerIdNumber']);if(_0x539477){_0x3be366[_0x174a('0x179')]=_0x321560[_0x174a('0x25')][_0x14751c]['originatecalleridname']=extractCalleridName(_0x539477);_0x3be366[_0x174a('0x17a')]=_0x321560[_0x174a('0x25')][_0x14751c][_0x174a('0x17b')]=extractCalleridNumber(_0x539477);}return ami[_0x174a('0x141')]({'actionid':_0x14751c,'action':'originate','channel':_0x321560[_0x174a('0xd7')](_0x20bb04[_0x174a('0x79')])?util[_0x174a('0x7c')](_0x174a('0x17c'),_0x20bb04[_0x174a('0x79')][_0x174a('0x41')],isNotNull(_0x20bb04[_0x174a('0x62')])?_0x20bb04[_0x174a('0x62')][_0x174a('0x17d')]()||'':'',_0x20bb04[_0x174a('0x17e')]>0x0?_0x39a17b[_0x174a('0x15f')][_0x174a('0x160')][_0x174a('0x17f')](_0x20bb04[_0x174a('0x17e')]):_0x39a17b[_0x174a('0x15f')]['phone']):util['format'](_0x174a('0x17c'),_['isNil'](_0x20bb04[_0x174a('0x137')])?_0x20bb04[_0x174a('0x79')]['name']:_0x20bb04[_0x174a('0x137')][_0x174a('0x41')],isNotNull(_0x20bb04[_0x174a('0x62')])?_0x20bb04[_0x174a('0x62')][_0x174a('0x17d')]()||'':'',_0x20bb04[_0x174a('0x17e')]>0x0?_0x39a17b[_0x174a('0x15f')][_0x174a('0x160')][_0x174a('0x17f')](_0x20bb04['dialCutDigit']):_0x39a17b['Contact'][_0x174a('0x160')]),'callerid':_0x539477,'Exten':'xcally-motion-dialer','Context':_0x174a('0x180'),'Priority':'1','variable':_0x3be366,'timeout':(_0x20bb04[_0x174a('0x181')]||0x1e)*0x3e8,'async':!![],'channelid':_0x14751c})[_0x174a('0xb9')](function(_0x1cd29a){return _0x2f58fc(_0x1cd29a);})[_0x174a('0xb4')](function(_0x43034a){_0x20bb04[_0x174a('0x182')]+=0x1;var _0xc8cd26=new History(_0x321560['actions'][_0x14751c]);logger[_0x174a('0x9a')](util['format'](_0x174a('0x183'),JSON['stringify'](_0x43034a)));_0xc8cd26[_0x174a('0xab')]=0xe;_0xc8cd26[_0x174a('0xe4')]='OriginateError';_0xc8cd26['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xc8cd26[_0x174a('0xac')]=_0xc8cd26[_0x174a('0x119')];_0x321560[_0x174a('0xc9')](_0xc8cd26)[_0x174a('0xb4')](loggerCatch(_0x174a('0x184')));_0x321560[_0x174a('0xc7')](_0xc8cd26)[_0x174a('0xb4')](loggerCatch(_0x174a('0x184')))[_0x174a('0x1e')](function(){delete _0x321560[_0x174a('0x25')][_0x14751c];return _0x2e6a45(msgResponse(_0x174a('0x15d'),_0x174a('0x49'),_0x174a('0x185')));});});});};Dialer['prototype'][_0x174a('0x31')]=function(_0x1c6f10){var _0x26e04c=this[_0x174a('0x25')][_0x1c6f10[_0x174a('0x120')]];if(_0x26e04c){delete this[_0x174a('0x25')][_0x1c6f10['actionid']];_0x26e04c['responsetime']=moment()[_0x174a('0x7c')](_0x174a('0xfb'));var _0x18984c=_0x26e04c[_0x174a('0x4f')]===_0x174a('0x7f')?this[_0x174a('0xb7')][_0x26e04c[_0x174a('0xb6')]]:this[_0x174a('0x20')][_0x26e04c['getQueue']()];if(!this[_0x174a('0xd5')](_0x1c6f10[_0x174a('0x186')])){this[_0x174a('0xb5')](_0x18984c);return this[_0x174a('0x187')](_0x26e04c,_0x18984c,_0x1c6f10)[_0x174a('0xb4')](loggerCatch(_0x174a('0x188')));}this['uniqueId'][_0x1c6f10[_0x174a('0xdc')]]=_0x26e04c;}};Dialer[_0x174a('0x1c')][_0x174a('0x189')]=function(_0x46db44,_0x191ee2,_0x12eca6){var _0x40beab=new History(_0x191ee2);if(_0x40beab[_0x174a('0xef')]+_0x40beab[_0x174a('0xf0')]+_0x40beab[_0x174a('0xf1')]+_0x40beab['countnosuchnumberretry']+_0x40beab[_0x174a('0xff')]+_0x40beab[_0x174a('0x11f')]+_0x40beab[_0x174a('0xeb')]+_0x40beab[_0x174a('0x18a')]>=_0x12eca6[_0x174a('0xf3')]-0x1){return!![];}switch(_0x46db44){case 0x3:if(_0x40beab[_0x174a('0xf1')]>=_0x12eca6[_0x174a('0x18b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x40beab[_0x174a('0xf1')]+=0x1,'scheduledat':moment()[_0x174a('0xf8')](_0x12eca6[_0x174a('0x18c')],'minutes')['format'](_0x174a('0xfb')),'ContactId':_0x40beab['ContactId'],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab[_0x174a('0xd3')]||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x18d')));break;case 0x5:if(_0x40beab[_0x174a('0xef')]>=_0x12eca6[_0x174a('0x18e')]-0x1){return!![];}this[_0x174a('0xf7')]({'active':![],'countbusyretry':_0x40beab[_0x174a('0xef')]+=0x1,'scheduledat':moment()['add'](_0x12eca6['dialBusyRetryFrequency'],_0x174a('0xfa'))[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x40beab[_0x174a('0xd0')],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab[_0x174a('0xd3')]||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x18f')));break;case 0x8:if(_0x40beab[_0x174a('0xf0')]>=_0x12eca6[_0x174a('0x190')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x40beab[_0x174a('0xf0')]+=0x1,'scheduledat':moment()[_0x174a('0xf8')](_0x12eca6['dialCongestionRetryFrequency'],_0x174a('0xfa'))[_0x174a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40beab[_0x174a('0xd0')],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab[_0x174a('0xd3')]||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})['catch'](loggerCatch(_0x174a('0x191')));break;case 0x0:if(_0x40beab['countnosuchnumberretry']>=_0x12eca6[_0x174a('0x192')]-0x1){return!![];}else{this[_0x174a('0xf7')]({'active':![],'countnosuchnumberretry':_0x40beab[_0x174a('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x12eca6[_0x174a('0x193')],_0x174a('0xfa'))[_0x174a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40beab[_0x174a('0xd0')],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab['VoiceQueueId']||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x194')));}break;case 0xa:if(_0x40beab[_0x174a('0xff')]>=_0x12eca6['dialDropMaxRetry']-0x1){return!![];}this[_0x174a('0xf7')]({'active':![],'countdropretry':_0x40beab['countdropretry']+=0x1,'scheduledat':moment()[_0x174a('0xf8')](_0x12eca6[_0x174a('0x118')],_0x174a('0xfa'))['format'](_0x174a('0xfb')),'ContactId':_0x40beab[_0x174a('0xd0')],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab[_0x174a('0xd3')]||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x195')));break;case 0xb:if(_0x40beab[_0x174a('0x11f')]>=_0x12eca6['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x174a('0xf7')]({'active':![],'countabandonedretry':_0x40beab[_0x174a('0x11f')]+=0x1,'scheduledat':moment()[_0x174a('0xf8')](_0x12eca6[_0x174a('0x196')],_0x174a('0xfa'))[_0x174a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40beab[_0x174a('0xd0')],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab[_0x174a('0xd3')]||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})['catch'](loggerCatch(_0x174a('0x197')));break;case 0x13:if(_0x40beab[_0x174a('0xeb')]>=_0x12eca6[_0x174a('0xf6')]-0x1){return!![];}this[_0x174a('0xf7')]({'active':![],'countmachineretry':_0x40beab[_0x174a('0xeb')]+=0x1,'scheduledat':moment()[_0x174a('0xf8')](_0x12eca6[_0x174a('0xf9')],'minutes')[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x40beab[_0x174a('0xd0')],'ListId':_0x40beab['ListId'],'VoiceQueueId':_0x40beab['VoiceQueueId']||undefined,'CampaignId':_0x40beab['CampaignId']||undefined})[_0x174a('0xb4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x40beab[_0x174a('0x18a')]>=_0x12eca6[_0x174a('0x198')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x40beab['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x12eca6[_0x174a('0x199')],_0x174a('0xfa'))[_0x174a('0x7c')](_0x174a('0xfb')),'ContactId':_0x40beab['ContactId'],'ListId':_0x40beab[_0x174a('0xd1')],'VoiceQueueId':_0x40beab['VoiceQueueId']||undefined,'CampaignId':_0x40beab[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x19a')));break;default:return!![];}};Dialer[_0x174a('0x1c')][_0x174a('0x187')]=function(_0x3ce016,_0x2462d2,_0x293277){var _0x234b0e=this;var _0x478fae=new History(_0x3ce016);return new BPromise(function(_0x56540a,_0x35325e){if(_[_0x174a('0x3d')](_0x2462d2)&&typeof _0x2462d2!=='object'){return _0x35325e(msgResponse(_0x174a('0x19b'),'Failure',_0x174a('0x19c')));}if(_[_0x174a('0x3d')](_0x293277)&&typeof _0x293277!==_0x174a('0x19d')){return _0x35325e(msgResponse(_0x174a('0x19b'),'Failure','evt\x20is\x20undefine'));}switch(_0x293277[_0x174a('0x109')]){case'0':_0x2462d2[_0x174a('0x66')]+=0x1;_0x478fae[_0x174a('0xab')]=0x0;_0x478fae['statedesc']='NoSuchNumber';_0x478fae[_0x174a('0xf2')]+=0x1;_0x478fae['countglobal']+=0x1;ami[_0x174a('0x4e')]('custom:agentnosuchnumber',ut[_0x174a('0x19e')](_0x3ce016,'nosuchnumber'));_0x234b0e[_0x174a('0xc9')](_0x478fae)[_0x174a('0xb4')](loggerCatch(_0x174a('0xee')));if(_0x234b0e[_0x174a('0x189')](0x0,_0x3ce016,_0x2462d2)){if(_0x478fae['countnosuchnumberretry']>=_0x2462d2[_0x174a('0x192')]){_0x234b0e['createStateFinal'](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x19f'));}else{_0x234b0e[_0x174a('0xf4')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x19f'));}}break;case'3':_0x2462d2[_0x174a('0x1a0')]+=0x1;_0x478fae['state']=0x3;_0x478fae[_0x174a('0xe4')]='NoAnswer';_0x478fae[_0x174a('0xf1')]+=0x1;_0x478fae[_0x174a('0xec')]+=0x1;ami[_0x174a('0x4e')](_0x174a('0x1a1'),ut[_0x174a('0x19e')](_0x3ce016,_0x174a('0x1a2')));_0x234b0e[_0x174a('0xc9')](_0x478fae)[_0x174a('0xb4')](loggerCatch(_0x174a('0x1a3')));if(_0x234b0e[_0x174a('0x189')](0x3,_0x3ce016,_0x2462d2)){if(_0x478fae['countnoanswerretry']>=_0x2462d2['dialNoAnswerMaxRetry']){_0x234b0e[_0x174a('0x100')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1a4'));}else{_0x234b0e[_0x174a('0xf4')](_0x478fae,_0x56540a,_0x35325e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2462d2[_0x174a('0x1a5')]+=0x1;_0x478fae['state']=0x5;_0x478fae[_0x174a('0xe4')]=_0x174a('0x1a6');_0x478fae[_0x174a('0xef')]+=0x1;_0x478fae[_0x174a('0xec')]+=0x1;ami[_0x174a('0x4e')]('custom:agentbusy',ut[_0x174a('0x19e')](_0x3ce016,_0x174a('0x1a7')));_0x234b0e[_0x174a('0xc9')](_0x478fae)[_0x174a('0xb4')](loggerCatch(_0x174a('0x1a8')));if(_0x234b0e[_0x174a('0x189')](0x5,_0x3ce016,_0x2462d2)){if(_0x478fae['countbusyretry']>=_0x2462d2[_0x174a('0x18e')]){_0x234b0e[_0x174a('0x100')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1a9'));}else{_0x234b0e[_0x174a('0xf4')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1a9'));}}break;case'8':_0x2462d2[_0x174a('0x1aa')]+=0x1;_0x478fae[_0x174a('0xab')]=0x8;_0x478fae[_0x174a('0xe4')]=_0x174a('0x1ab');_0x478fae[_0x174a('0xf0')]+=0x1;_0x478fae['countglobal']+=0x1;ami[_0x174a('0x4e')](_0x174a('0x1ac'),ut[_0x174a('0x19e')](_0x3ce016,_0x174a('0x1ad')));_0x234b0e['createHistory'](_0x478fae)['catch'](loggerCatch(_0x174a('0x1ae')));if(_0x234b0e[_0x174a('0x189')](0x8,_0x3ce016,_0x2462d2)){if(_0x478fae[_0x174a('0xf0')]>=_0x2462d2[_0x174a('0x190')]){_0x234b0e[_0x174a('0x100')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1af'));}else{_0x234b0e['stateGlobal'](_0x478fae,_0x56540a,_0x35325e,'reason\x208\x20congestion');}}break;case'11':_0x2462d2['outboundAbandonedCallsDay']+=0x1;_0x478fae[_0x174a('0xab')]=0xb;_0x478fae[_0x174a('0xe4')]='Abandoned';_0x478fae[_0x174a('0x11f')]+=0x1;_0x478fae[_0x174a('0xec')]+=0x1;_0x234b0e[_0x174a('0xc9')](_0x478fae)[_0x174a('0xb4')](loggerCatch(_0x174a('0x1b0')));if(_0x234b0e[_0x174a('0x189')](0xb,_0x3ce016,_0x2462d2)){if(_0x478fae[_0x174a('0x11f')]>=_0x2462d2[_0x174a('0x1b1')]){_0x234b0e[_0x174a('0x100')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1b2'));}else{_0x234b0e[_0x174a('0xf4')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1b2'));}}break;case'20':_0x2462d2[_0x174a('0x68')]+=0x1;_0x478fae[_0x174a('0xab')]=0x14;_0x478fae[_0x174a('0xe4')]=_0x174a('0x1b3');_0x478fae[_0x174a('0x18a')]+=0x1;_0x478fae[_0x174a('0xec')]+=0x1;ami[_0x174a('0x4e')]('custom:agentreject',ut[_0x174a('0x19e')](_0x3ce016,'agentreject'));_0x234b0e['createHistory'](_0x478fae)['catch'](loggerCatch(_0x174a('0x1b4')));if(_0x234b0e[_0x174a('0x189')](0x14,_0x3ce016,_0x2462d2)){if(_0x478fae[_0x174a('0x18a')]>=_0x2462d2['dialAgentRejectMaxRetry']){_0x234b0e[_0x174a('0x100')](_0x478fae,_0x56540a,_0x35325e,_0x174a('0x1b5'));}else{_0x234b0e[_0x174a('0xf4')](_0x478fae,_0x56540a,_0x35325e,'reason\x2020\x20agentreject');}}break;default:_0x2462d2[_0x174a('0x107')]+=0x1;_0x478fae[_0x174a('0xab')]=0xc;_0x478fae[_0x174a('0xe4')]=_0x293277['reason'];_0x234b0e[_0x174a('0xc9')](_0x478fae)['catch'](loggerCatch(_0x174a('0x1b6')));if(_0x234b0e[_0x174a('0x189')](_0x293277['reason'],_0x3ce016,_0x2462d2)){if(_0x478fae['countbusyretry']+_0x478fae[_0x174a('0xf0')]+_0x478fae[_0x174a('0xf1')]+_0x478fae[_0x174a('0xf2')]+_0x478fae[_0x174a('0xff')]+_0x478fae['countabandonedretry']+_0x478fae['countmachineretry']+_0x478fae['countagentrejectretry']>=_0x2462d2[_0x174a('0xf3')]){_0x234b0e[_0x174a('0xf4')](_0x478fae,_0x56540a,_0x35325e,_0x293277['reason']);}else{_0x234b0e[_0x174a('0x100')](_0x478fae,_0x56540a,_0x35325e,_0x293277[_0x174a('0x109')]);}}}});};Dialer[_0x174a('0x1c')][_0x174a('0xf4')]=function(_0x1469a5,_0x2a20b7,_0x2550e2,_0x482b98){var _0x21566d=new Final(_0x1469a5);_0x21566d['state']=0xf;_0x21566d[_0x174a('0xe4')]='Global';this[_0x174a('0x100')](_0x21566d,_0x2a20b7,_0x2550e2,_0x482b98);};Dialer[_0x174a('0x1c')][_0x174a('0x100')]=function(_0x3e5338,_0x2a72d6,_0x3fe46b,_0x540794){this[_0x174a('0xc7')](_0x3e5338)[_0x174a('0xb9')](function(){return _0x2a72d6(msgResponse('[callProgressDetecting]',_0x174a('0xd6'),_0x540794));})['catch'](function(){return _0x3fe46b(msgResponse(_0x174a('0x1b7'),_0x174a('0x13a'),_0x174a('0x1b8')));});};Dialer['prototype']['predictive']=function(_0x1de486){var _0x5213bf=_0x1de486[_0x174a('0x1b9')]/0x64;var _0x2e9399=_0x1de486[_0x174a('0x65')]/(_0x1de486[_0x174a('0x65')]+_0x1de486[_0x174a('0x63')]);var _0x298f5b=Math[_0x174a('0x1ba')](_0x1de486[_0x174a('0x73')]*(_0x1de486[_0x174a('0x1bb')]/0x64));var _0x1a1c67=Math[_0x174a('0x1ba')](_0x1de486[_0x174a('0x73')]*(_0x1de486[_0x174a('0x1bc')]/0x64));var _0x36052d=_0x1de486['available']+_0x1de486[_0x174a('0x59')];var _0x3de91d=Math[_0x174a('0x1bd')](_0x1de486['erlangCalls']*_0x1de486['erlangAbandonmentRate']*_0x1de486['predictiveIntervalHitRate']*_0x1de486[_0x174a('0x71')]);if(_[_0x174a('0x3d')](_0x1de486[_0x174a('0x2a')])){if(!_['isUndefined'](_0x1de486[_0x174a('0x29')])){_0x1de486[_0x174a('0x29')]=undefined;loggerPredictive[_0x174a('0x9a')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x174a('0x3d')](_0x1de486['handlePredictive'])){loggerPredictive[_0x174a('0x9a')](_0x174a('0x1be'),_0x174a('0x1bf'));clearInterval(_0x1de486['handlePredictive']);_0x1de486[_0x174a('0x94')]=undefined;}_0x1de486[_0x174a('0x2a')]=moment()[_0x174a('0x7c')](_0x174a('0xfb'));loggerPredictive[_0x174a('0x82')](_0x1de486[_0x174a('0x41')],_0x174a('0x1c0'),_0x1de486[_0x174a('0x2a')]);this[_0x174a('0x14d')](_0x1de486,0x1);}else if(ifInterval(_0x1de486[_0x174a('0x1c1')],_0x1de486[_0x174a('0x2a')])){this['handlePower'](_0x1de486,0x1);loggerPredictiveCalls[_0x174a('0x82')](_0x174a('0x1c2'),_0x1de486[_0x174a('0x2a')],_0x1de486[_0x174a('0x41')]);_0x1de486[_0x174a('0x76')]=0x0;_0x1de486[_0x174a('0x6f')]=0x0;}else if(_0x5213bf<_0x2e9399&&_0x1de486['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x1de486);loggerPredictive[_0x174a('0x82')](_0x174a('0x1c3'),_0x174a('0x1c4'),_0x2e9399,_0x174a('0x2a'),_0x1de486['name']);}else if(_0x3de91d<_0x1de486[_0x174a('0x6f')]&&_0x1de486[_0x174a('0x1c5')]===_0x174a('0x1c6')){freeVariablesPredictive(_0x1de486);loggerPredictive[_0x174a('0x82')](_0x174a('0x1c7'),_0x174a('0x1c8'),_0x3de91d,_0x174a('0x1c9'),_0x1de486['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x1de486[_0x174a('0x41')]);}else if(!ifInterval(_0x1de486['dialPredictiveInterval'],_0x1de486[_0x174a('0x2a')])&&_[_0x174a('0x3d')](_0x1de486[_0x174a('0x29')])&&!_[_0x174a('0x3d')](_0x1de486[_0x174a('0x2a')])){_0x1de486[_0x174a('0x29')]=moment()['format'](_0x174a('0xfb'));loggerPredictive[_0x174a('0x82')](_0x1de486[_0x174a('0x41')],_0x174a('0x1ca'),_0x1de486['startPredictive']);this[_0x174a('0x1cb')](_0x1de486[_0x174a('0x1c1')])[_0x174a('0xb9')](this[_0x174a('0x1cc')](_0x1de486))[_0x174a('0xb9')](mergeDataErlangB(_0x1de486))[_0x174a('0xb9')](this[_0x174a('0x1cd')](_0x1de486))[_0x174a('0xb4')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1de486));}else if(!ifInterval(_0x1de486[_0x174a('0x1c1')],_0x1de486[_0x174a('0x29')])){_0x1de486[_0x174a('0x6f')]=0x0;_0x1de486[_0x174a('0x29')]=moment()[_0x174a('0x7c')](_0x174a('0xfb'));loggerPredictive[_0x174a('0x82')](_0x1de486[_0x174a('0x41')],_0x174a('0x1ce'),_0x1de486[_0x174a('0x29')]);clearInterval(_0x1de486[_0x174a('0x94')]);_0x1de486[_0x174a('0x94')]=undefined;this[_0x174a('0x1cb')](_0x1de486[_0x174a('0x1c1')])['then'](this['getDataPredictive'](_0x1de486))[_0x174a('0xb9')](mergeDataErlangB(_0x1de486))[_0x174a('0xb9')](this[_0x174a('0x1cd')](_0x1de486))[_0x174a('0xb4')](loggerCatchPredictive(_0x174a('0x1cf'),_0x1de486));}else if(_0x1de486['predictiveIntervalAvailable']&&_0x36052d<_0x1de486[_0x174a('0x73')]-_0x1a1c67){freeVariablesPredictive(_0x1de486);loggerPredictive[_0x174a('0x82')](_0x1de486['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x36052d,_0x174a('0x1d0'),_0x1de486['predictiveIntervalAvailable'],'-',_0x1a1c67,'=',_0x1de486[_0x174a('0x73')]-_0x1a1c67,')');}else if(_0x1de486[_0x174a('0x73')]&&_0x36052d>_0x1de486['predictiveIntervalAvailable']+_0x298f5b){freeVariablesPredictive(_0x1de486);loggerPredictive[_0x174a('0x82')](_0x1de486[_0x174a('0x41')],_0x174a('0x1d1'),_0x36052d,_0x174a('0x1d2'),_0x1de486[_0x174a('0x73')],'+',_0x298f5b,'=',_0x1de486[_0x174a('0x73')]+_0x298f5b,')');}};Dialer['prototype'][_0x174a('0x1cc')]=function(_0x4324eb){var _0x4e61d2=this;return function(_0xdc9746){return new BPromise(function(_0xe07c49,_0x276500){_[_0x174a('0x92')](_0x4324eb,_0xdc9746[0x0]);if(checkGetDataPredictive(_0xdc9746[0x0])){var _0x3497c7=_0x4324eb[_0x174a('0x73')]=_0x4324eb[_0x174a('0x59')]+_0x4324eb[_0x174a('0x53')];var _0x139104=_0x4324eb['dialPredictiveInterval']*0x3c;var _0x4328b9=_0xdc9746[0x0][_0x174a('0x6b')]+_0xdc9746[0x0][_0x174a('0x6a')];var _0x544a65=(_0xdc9746[0x0][_0x174a('0x69')]+_0xdc9746[0x0][_0x174a('0x6d')]+_0xdc9746[0x0][_0x174a('0x6c')])/_0xdc9746[0x0][_0x174a('0x74')];_0x4324eb[_0x174a('0x70')]=_0x544a65>0x0?_0x544a65:0x1;switch(_0x4324eb[_0x174a('0x1c5')]){case'dropRate':var _0x16b317=_0x4324eb[_0x174a('0x1b9')]/0x64;return _0x4e61d2[_0x174a('0x1d3')](_0x3497c7,_0x139104,_0x4328b9,_0x544a65,_0x16b317)[_0x174a('0xb9')](function(_0x4042d6){return _0xe07c49(_0x4042d6);});case _0x174a('0x1d4'):var _0x5f3fb3=_0x4324eb[_0x174a('0x1b9')]/0x64;return _0x4e61d2[_0x174a('0x1d5')](_0x3497c7,_0x139104,_0x4328b9,_0x544a65,_0x5f3fb3)[_0x174a('0xb9')](function(_0x35d747){return _0xe07c49(_0x35d747);});default:return _0x276500(msgResponse('[getDataPredictive]',_0x174a('0x13a'),_0x174a('0x1d6')));}}else{return _0x276500(msgResponse(_0x174a('0x1d7'),_0x174a('0x13a'),'check\x20failure'));}});};};Dialer['prototype'][_0x174a('0x1d8')]=function(_0x380333){var _0x4a31b4=this;return function(_0x2735eb){return new BPromise(function(_0x43bd8a,_0x22a185){_[_0x174a('0x92')](_0x380333,_0x2735eb[0x0]);if(checkGetDataPredictive(_0x2735eb[0x0])){loggerPredictive['info'](JSON[_0x174a('0x4a')](_0x2735eb[0x0]));if(_0x380333[_0x174a('0x1c5')]===_0x174a('0x1c6')){return _0x4a31b4['getVoiceQueueRtPauses'](_0x380333['id'])['then'](function(_0x23b21f){var _0x1bf90c=_0x380333[_0x174a('0x54')]-_0x23b21f[0x0]['outboundQueuePauses'];var _0x1b1300=_0x380333[_0x174a('0x1c1')]*0x3c;var _0x3109f9=_0x2735eb[0x0][_0x174a('0x6b')]+_0x2735eb[0x0][_0x174a('0x6a')];var _0xcce847=(_0x2735eb[0x0][_0x174a('0x69')]+_0x2735eb[0x0][_0x174a('0x6d')]+_0x2735eb[0x0][_0x174a('0x6c')])/_0x2735eb[0x0][_0x174a('0x74')];var _0x582055=_0x380333[_0x174a('0x1b9')]/0x64;_0x380333[_0x174a('0x72')]=_0x23b21f[0x0]['outboundQueuePauses']||0x0;_0x380333[_0x174a('0x70')]=_0xcce847>0x0?_0xcce847:0x1;return _0x4a31b4[_0x174a('0x1d3')](_0x1bf90c,_0x1b1300,_0x3109f9,_0xcce847,_0x582055);})[_0x174a('0xb9')](function(_0x8190fd){return _0x43bd8a(_0x8190fd);})[_0x174a('0xb4')](function(_0x36ffcc){return _0x22a185(msgResponse(_0x174a('0x1d9'),'Failure',JSON[_0x174a('0x4a')](_0x36ffcc)));});}if(_0x380333[_0x174a('0x1c5')]===_0x174a('0x1d4')){return _0x4a31b4[_0x174a('0xc5')](_0x380333['id'])['then'](function(_0x44976a){var _0x5364f7=_0x380333[_0x174a('0x54')]-_0x44976a[0x0][_0x174a('0x1da')];var _0x33afc0=_0x380333[_0x174a('0x1c1')]*0x3c;var _0x4ec615=_0x2735eb[0x0]['predictiveIntervalAvgTalktime']+_0x2735eb[0x0][_0x174a('0x6a')];var _0x2b857a=(_0x2735eb[0x0][_0x174a('0x69')]+_0x2735eb[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2735eb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2735eb[0x0][_0x174a('0x74')];var _0xfc36bd=_0x380333[_0x174a('0x1b9')]/0x64;_0x380333[_0x174a('0x72')]=_0x44976a[0x0]['outboundQueuePauses']||0x0;_0x380333['predictiveIntervalHitRate']=_0x2b857a>0x0?_0x2b857a:0x1;return _0x4a31b4[_0x174a('0x1d5')](_0x5364f7,_0x33afc0,_0x4ec615,_0x2b857a,_0xfc36bd);})[_0x174a('0xb9')](function(_0x44088c){return _0x43bd8a(_0x44088c);})[_0x174a('0xb4')](function(_0x4d2486){return _0x22a185(msgResponse(_0x174a('0x1d9'),'Failure',JSON['stringify'](_0x4d2486)));});}}else{return _0x22a185(msgResponse(_0x174a('0x1d7'),_0x174a('0x13a'),_0x174a('0x1db')));}});};};Dialer[_0x174a('0x1c')][_0x174a('0x1cd')]=function(_0x324599){var _0x23cd18=this;return function(){var _0x53827e=0x0;var _0x4ef1d4=Math[_0x174a('0x1bd')](_0x324599[_0x174a('0x77')]*0x3e8);if(_0x4ef1d4>0x0){_0x4ef1d4=_0x4ef1d4<0x64?0x64:_0x4ef1d4;loggerPredictive[_0x174a('0x82')](_0x324599[_0x174a('0x41')],_0x174a('0x1dc'),_0x4ef1d4,_0x174a('0x4b'));_0x324599[_0x174a('0x94')]=setInterval(function(){_0x23cd18[_0x174a('0x94')](_0x324599);loggerPredictiveCalls[_0x174a('0x82')]('[handlePredictive]',_0x53827e+=0x1);},_0x4ef1d4);}else{loggerPredictive[_0x174a('0x82')](_0x324599[_0x174a('0x41')],_0x174a('0x1dd'));}};};Dialer[_0x174a('0x1c')][_0x174a('0x1de')]=function(_0x2092e3,_0x3c1273){var _0x22a18e=this;return function(_0x4851b){if(_['isEmpty'](_0x4851b)){if(_[_0x174a('0xb1')](_0x3c1273['UserId'])||!_0x3c1273[_0x174a('0x1df')]){if(_0x2092e3[_0x174a('0x5f')]==='booked'){_0x2092e3['queueStatusComplete']=_[_0x174a('0x3d')](_0x2092e3[_0x174a('0x126')])?!![]:_0x2092e3[_0x174a('0x126')];var _0x145ec8=uuid['v4']();_0x22a18e[_0x174a('0x25')][_0x145ec8]=new Action(_0x2092e3,_0x3c1273,_0x145ec8);loggerBooked[_0x174a('0x82')](_0x174a('0x1e0'),_0x145ec8,_0x174a('0x1e1'),JSON['stringify'](_0x2092e3[_0x174a('0x126')]),_0x174a('0x1e2'),_0x2092e3[_0x174a('0x41')]);if(_0x2092e3[_0x174a('0x126')]){_0x2092e3[_0x174a('0x126')]=![];_0x22a18e[_0x174a('0x2c')][_0x22a18e[_0x174a('0x25')][_0x145ec8]['queue']]=[];ami[_0x174a('0x141')]({'actionid':_0x145ec8,'action':_0x174a('0x1e3'),'queue':_0x2092e3[_0x174a('0x41')]})[_0x174a('0xb4')](function(){_0x22a18e[_0x174a('0xb5')](_0x2092e3);_0x22a18e[_0x174a('0xf7')]({'active':![],'ContactId':_0x22a18e[_0x174a('0x25')][_0x145ec8][_0x174a('0xd0')],'ListId':_0x22a18e[_0x174a('0x25')][_0x145ec8][_0x174a('0xd1')],'VoiceQueueId':_0x22a18e['actions'][_0x145ec8]['VoiceQueueId']||undefined,'CampaignId':_0x22a18e[_0x174a('0x25')][_0x145ec8][_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x1e4')));delete _0x22a18e[_0x174a('0x25')][_0x145ec8];});}else{loggerBooked['info'](_0x174a('0x1e5'),JSON[_0x174a('0x4a')](_0x2092e3['queueStatusComplete']),_0x174a('0x1e2'),_0x2092e3[_0x174a('0x41')]);_0x22a18e[_0x174a('0xb5')](_0x2092e3);_0x22a18e[_0x174a('0xf7')]({'active':![],'ContactId':_0x22a18e[_0x174a('0x25')][_0x145ec8][_0x174a('0xd0')],'ListId':_0x22a18e[_0x174a('0x25')][_0x145ec8][_0x174a('0xd1')],'VoiceQueueId':_0x22a18e[_0x174a('0x25')][_0x145ec8][_0x174a('0xd3')]||undefined,'CampaignId':_0x22a18e['actions'][_0x145ec8][_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x1e4')));delete _0x22a18e[_0x174a('0x25')][_0x145ec8];}}else{return _0x22a18e[_0x174a('0x15c')](_0x2092e3,_0x3c1273);}}else{if(getDiff(_0x3c1273[_0x174a('0x1e6')])<_0x2092e3[_0x174a('0x1e7')]*0x3c){if(_0x3c1273[_0x174a('0x1e8')]&&!_0x3c1273[_0x174a('0x1e8')]['voicePause']){_0x22a18e['preview'][_0x174a('0x128')](_0x3c1273['id'])[_0x174a('0x1e')](function(){_0x22a18e[_0x174a('0xb5')](_0x2092e3);});}else{_0x22a18e[_0x174a('0xc1')]({'active':![]},_0x3c1273['id'],0x1)[_0x174a('0x1e')](function(){_0x22a18e[_0x174a('0xb5')](_0x2092e3);});}}else{_0x2092e3[_0x174a('0x67')]+=0x1;_0x22a18e[_0x174a('0xb5')](_0x2092e3);if(_0x2092e3[_0x174a('0x1e9')]){_0x22a18e[_0x174a('0xf7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c1273[_0x174a('0xd0')],'ListId':_0x3c1273[_0x174a('0xd1')],'VoiceQueueId':_0x3c1273[_0x174a('0xd3')]||undefined,'CampaignId':_0x3c1273[_0x174a('0xfc')]||undefined})[_0x174a('0xb4')](loggerCatch(_0x174a('0x1ea')));_0x22a18e[_0x174a('0xc9')](createObjHistory(_0x2092e3,_0x3c1273,'RECALLINQUEUE',0x17,_0x174a('0x1eb')))['catch'](loggerCatch(_0x174a('0x1ec')));}else{_0x22a18e['saveInDb'](createObjHistory(_0x2092e3,_0x3c1273,_0x174a('0x1ed'),0x16,_0x174a('0x1ee')),_0x174a('0x1ef'),_0x174a('0x1f0'));}}}}else{_0x2092e3[_0x174a('0x1f1')]+=0x1;_0x22a18e[_0x174a('0xce')](createObjHistory(_0x2092e3,_0x3c1273,_0x174a('0x1f2'),0xd,_0x174a('0x1f3')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype'][_0x174a('0x152')]=function(_0x28355f){var _0x13792e=this;var _0x7ce4be=_0x28355f['limitCalls']-_0x28355f[_0x174a('0x75')]-_0x28355f[_0x174a('0x1f4')];emitCampaignSummary(_0x28355f);if(_0x7ce4be>0x0){if(_0x7ce4be>this[_0x174a('0x23')]){_0x7ce4be=this[_0x174a('0x23')];}_0x28355f[_0x174a('0x1f4')]+=_0x7ce4be;this[_0x174a('0xc4')](_0x28355f['id'],_0x7ce4be,_0x28355f[_0x174a('0x1f5')])[_0x174a('0xb9')](function(_0x13cc62){_0x28355f['temp']-=_0x7ce4be;_0x28355f[_0x174a('0x1f4')]=_0x28355f[_0x174a('0x1f4')]>0x0?_0x28355f[_0x174a('0x1f4')]:0x0;if(!checkContactEmpty(_0x13cc62)){_0x28355f['message']=_0x174a('0x1f6');logger[_0x174a('0x82')]('[getContactCampaign2][Empty]'+_0x28355f[_0x174a('0x41')]);}else{_0x28355f[_0x174a('0x75')]+=_0x13cc62[_0x174a('0x9d')];_0x28355f[_0x174a('0x3e')]=_0x174a('0x1f7');for(var _0x16f1cd=0x0;_0x16f1cd<_0x13cc62[_0x174a('0x9d')];_0x16f1cd+=0x1){_0x28355f[_0x174a('0x1f8')]+=0x1;if(_[_0x174a('0xb1')](_0x13cc62[_0x16f1cd])||_['isNil'](_0x13cc62[_0x16f1cd][_0x174a('0x15f')])||_['isNil'](_0x13cc62[_0x16f1cd][_0x174a('0x15f')][_0x174a('0x160')])){_0x13792e[_0x174a('0x1f9')](_0x174a('0x1fa'),_0x28355f,_0x13cc62[_0x16f1cd]);}else{_0x13792e[_0x174a('0x1fb')](_[_0x174a('0xcf')](_0x13cc62[_0x16f1cd],['CampaignId',_0x174a('0x1fc')]))['then'](_0x13792e[_0x174a('0x1de')](_0x28355f,_0x13cc62[_0x16f1cd]))[_0x174a('0xb4')](_0x13792e[_0x174a('0xcc')](_0x174a('0x1fd'),_0x28355f));}}}})['catch'](loggerGetContactDialer(_0x174a('0x1fe'),_0x28355f,_0x7ce4be));}};Dialer[_0x174a('0x1c')][_0x174a('0x14d')]=function(_0x22e502,_0x47c29b){var _0x2ae986=this;var _0x202604=[];var _0xf11605=_0x47c29b>=0x1?_0x47c29b:0x1;if(_0x22e502[_0x174a('0x5f')]===_0x174a('0x9')){_0xf11605=0x1;}var _0x32f55d=Math[_0x174a('0x1bd')](_0x22e502[_0x174a('0x53')]*_0xf11605)-_0x22e502[_0x174a('0x75')]-_0x22e502['temp'];emitVoiceQueueSummary(_0x22e502);if(_0x22e502['dialLimitQueue']>0x0){var _0x14a309=_0x22e502['dialLimitQueue']-_0x22e502[_0x174a('0x75')]-_0x22e502[_0x174a('0x59')]-_0x22e502['temp']-_0x22e502[_0x174a('0x55')];if(_0x32f55d>_0x14a309){_0x32f55d=_0x14a309;}}if(_0x32f55d>0x0){if(_0x22e502[_0x174a('0x5f')]===_0x174a('0x9')){_0x32f55d=0x1;}if(_0x32f55d>this['maxNumberOriginate']){_0x32f55d=this[_0x174a('0x23')];}_0x22e502['temp']+=_0x32f55d;for(var _0x507825 in this[_0x174a('0x21')]){if(typeof this[_0x174a('0x21')][_0x507825]!==_0x174a('0x9e')){if(this[_0x174a('0x21')][_0x507825][_0x174a('0xab')]===_0x174a('0x1ff')&&this[_0x174a('0x21')][_0x507825][_0x174a('0xb2')]==='reachable'){_0x202604[_0x174a('0x140')](this['agents'][_0x507825]['id']);}}}this[_0x174a('0xc2')](_0x22e502['id'],_0x202604,_0x32f55d,_0x22e502[_0x174a('0x1f5')])['then'](function(_0x61dd76){_0x22e502[_0x174a('0x1f4')]-=_0x32f55d;_0x22e502[_0x174a('0x1f4')]=_0x22e502[_0x174a('0x1f4')]>0x0?_0x22e502[_0x174a('0x1f4')]:0x0;if(!checkContactEmpty(_0x61dd76)){_0x2ae986[_0x174a('0xba')](_0x22e502)['then'](sendMessageReschedule(_0x22e502))[_0x174a('0xb4')](loggerCatch(_0x174a('0xbb')));}else{_0x22e502['originated']+=_0x61dd76[_0x174a('0x9d')];_0x22e502[_0x174a('0x3e')]=_0x22e502['dialMethod']===_0x174a('0x9')?'ACTIVE':_0x174a('0x1f7');for(var _0x317b9b=0x0;_0x317b9b<_0x61dd76[_0x174a('0x9d')];_0x317b9b+=0x1){if(_[_0x174a('0xb1')](_0x61dd76[_0x317b9b])||_['isNil'](_0x61dd76[_0x317b9b][_0x174a('0x15f')])||_[_0x174a('0xb1')](_0x61dd76[_0x317b9b][_0x174a('0x15f')]['phone'])){_0x2ae986[_0x174a('0x1f9')](_0x174a('0x1fa'),_0x22e502,_0x61dd76[_0x317b9b]);}else{_0x2ae986['checkIsBlackList'](_['pick'](_0x61dd76[_0x317b9b],[_0x174a('0xd3'),_0x174a('0x1fc')]))[_0x174a('0xb9')](_0x2ae986[_0x174a('0x1de')](_0x22e502,_0x61dd76[_0x317b9b]))['catch'](_0x2ae986[_0x174a('0xcc')](_0x174a('0x1fa'),_0x22e502));}}}})[_0x174a('0xb4')](loggerGetContactDialer(_0x174a('0x200'),_0x22e502,_0x32f55d));}};Dialer['prototype'][_0x174a('0x94')]=function(_0x1810f9){if(_0x1810f9['dialLimitQueue']>0x0){var _0xd6e8db=_0x1810f9['dialLimitQueue']-_0x1810f9[_0x174a('0x75')]-_0x1810f9[_0x174a('0x59')];if(_0xd6e8db>0x0){this[_0x174a('0x201')](_0x1810f9);}else{loggerPredictiveCalls[_0x174a('0x82')](_0x174a('0x202'));}}else{this[_0x174a('0x201')](_0x1810f9);}};Dialer['prototype'][_0x174a('0x201')]=function(_0x5ae542){var _0x34d6f9=this;var _0x119dd6=[];_0x5ae542[_0x174a('0x75')]+=0x1;for(var _0x1b684a in this[_0x174a('0x21')]){if(typeof this[_0x174a('0x21')][_0x1b684a]!==_0x174a('0x9e')){if(this[_0x174a('0x21')][_0x1b684a]['state']===_0x174a('0x1ff')&&this[_0x174a('0x21')][_0x1b684a]['status']===_0x174a('0xd9')){_0x119dd6[_0x174a('0x140')](this[_0x174a('0x21')][_0x1b684a]['id']);}}}this['getContactDialer'](_0x5ae542['id'],_0x119dd6,0x1,_0x5ae542[_0x174a('0x1f5')])['then'](function(_0x223833){if(!checkContactEmpty(_0x223833)){checkContactLowerLimitOriginate(_0x5ae542,0x1,0x0);_0x34d6f9[_0x174a('0xba')](_0x5ae542)[_0x174a('0xb9')](sendMessageReschedule(_0x5ae542))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x5ae542[_0x174a('0x3e')]='RUNNING';if(_[_0x174a('0xb1')](_0x223833[0x0])||_[_0x174a('0xb1')](_0x223833[0x0][_0x174a('0x15f')])||_[_0x174a('0xb1')](_0x223833[0x0][_0x174a('0x15f')]['phone'])){_0x34d6f9[_0x174a('0x1f9')](_0x174a('0x1fa'),_0x5ae542,_0x223833[0x0]);}else{_0x34d6f9[_0x174a('0xbc')](_[_0x174a('0xcf')](_0x223833[0x0],['VoiceQueueId',_0x174a('0x1fc')]))[_0x174a('0xb9')](_0x34d6f9[_0x174a('0x1de')](_0x5ae542,_0x223833[0x0]))[_0x174a('0xb4')](_0x34d6f9[_0x174a('0xcc')](_0x174a('0x203'),_0x5ae542));}}})['catch'](loggerGetContactDialer(_0x174a('0x204'),_0x5ae542,0x1));emitVoiceQueueSummary(_0x5ae542);};Dialer[_0x174a('0x1c')]['abandonmentRate']=function(_0x51cc35,_0x1fcc73,_0x573812,_0x38a6a7,_0x54f30d,_0x5655ba){loggerPredictive[_0x174a('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x174a('0x82')](_0x174a('0x205'),_0x51cc35);loggerPredictive[_0x174a('0x82')](_0x174a('0x206'),_0x1fcc73);loggerPredictive[_0x174a('0x82')](_0x174a('0x207'),_0x573812);loggerPredictive['info'](_0x174a('0x208'),_0x38a6a7);loggerPredictive['info'](_0x174a('0x209'),_0x54f30d);loggerPredictive[_0x174a('0x82')](_0x174a('0x91'));return new BPromise(function(_0xf940a3,_0x50609c){if(_0x51cc35<=0x0||isNaN(_0x51cc35)){return _0x50609c(msgResponse(_0x174a('0x20a'),'Error',_0x174a('0x20b')+_0x51cc35));}if(_0x573812<=0x0||isNaN(_0x573812)){return _0x50609c(msgResponse(_0x174a('0x20a'),_0x174a('0x49'),_0x174a('0x20c')+_0x573812));}if(_0x38a6a7<=0x0||isNaN(_0x38a6a7)){return _0x50609c(msgResponse('[abandonmentRate]',_0x174a('0x49'),_0x174a('0x20d')+_0x38a6a7));}if(_0x1fcc73<=0x0||isNaN(_0x1fcc73)){return _0x50609c(msgResponse(_0x174a('0x20a'),_0x174a('0x49'),_0x174a('0x20e')+_0x1fcc73));}if(_0x54f30d<=0x0||isNaN(_0x54f30d)){return _0x50609c(msgResponse('[abandonmentRate]',_0x174a('0x49'),_0x174a('0x20f')+_0x54f30d));}_0x5655ba=_0x5655ba||0x0;var _0x3a0815=0x1/_0x573812;var _0x1f354b=0x0;var _0x442c28=0x0;var _0x48f025=0x0;var _0x25d7dc=0x0;for(var _0x3d581d=0x0;_0x48f025<_0x54f30d;_0x3d581d+=0x1){_0x442c28=_0x3d581d/_0x1fcc73;_0x1f354b=(_0x38a6a7*_0x442c28+_0x5655ba)/_0x3a0815;_0x48f025=erlangb(_0x1f354b,_0x51cc35);_0x25d7dc=_0x1f354b/_0x51cc35*(0x1-erlangb(_0x1f354b,_0x51cc35));}return _0xf940a3({'erlangCalls':_0x3d581d,'erlangCallToSecond':_0x1fcc73/_0x3d581d,'erlangAbandonmentRate':_0x48f025,'erlangBusyFactor':_0x25d7dc});});};Dialer['prototype']['busyFactor']=function(_0x297928,_0x45257e,_0x10888d,_0x50562e,_0x1261fc,_0x118299){loggerPredictive[_0x174a('0x82')](_0x174a('0x210'));loggerPredictive[_0x174a('0x82')]('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',_0x297928);loggerPredictive[_0x174a('0x82')](_0x174a('0x206'),_0x45257e);loggerPredictive[_0x174a('0x82')](_0x174a('0x207'),_0x10888d);loggerPredictive['info'](_0x174a('0x208'),_0x50562e);loggerPredictive['info'](_0x174a('0x211'),_0x1261fc);loggerPredictive[_0x174a('0x82')]('---------------------------');return new BPromise(function(_0x25d073,_0x541b99){if(_0x297928<=0x0||isNaN(_0x297928)){return _0x541b99(msgResponse('[busyFactor]',_0x174a('0x49'),_0x174a('0x20b')+_0x297928));}if(_0x10888d<=0x0||isNaN(_0x10888d)){return _0x541b99(msgResponse('[busyFactor]',_0x174a('0x49'),_0x174a('0x20c')+_0x10888d));}if(_0x50562e<=0x0||isNaN(_0x50562e)){return _0x541b99(msgResponse(_0x174a('0x212'),_0x174a('0x49'),_0x174a('0x20d')+_0x50562e));}if(_0x45257e<=0x0||isNaN(_0x45257e)){return _0x541b99(msgResponse(_0x174a('0x212'),_0x174a('0x49'),'interval\x20=\x20'+_0x45257e));}if(_0x1261fc<=0x0||isNaN(_0x1261fc)){return _0x541b99(msgResponse(_0x174a('0x212'),_0x174a('0x49'),_0x174a('0x213')+_0x1261fc));}_0x118299=_0x118299||0x0;var _0x4573c9=0x1/_0x10888d;var _0x33f50e=0x0;var _0x457483=0x0;var _0x344528=0x0;var _0x530a26=0x0;for(var _0x2edfa6=0x0;_0x530a26<_0x1261fc;_0x2edfa6+=0x1){_0x457483=_0x2edfa6/_0x45257e;_0x33f50e=(_0x50562e*_0x457483+_0x118299)/_0x4573c9;_0x344528=erlangb(_0x33f50e,_0x297928);_0x530a26=_0x33f50e/_0x297928*(0x1-erlangb(_0x33f50e,_0x297928));}return _0x25d073({'erlangCalls':_0x2edfa6,'erlangCallToSecond':_0x45257e/_0x2edfa6,'erlangAbandonmentRate':_0x344528,'erlangBusyFactor':_0x530a26});});};module['exports']=Dialer; \ No newline at end of file +var _0xac0f=['[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','UserId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','add','ListId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','idHopper','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ifTime','Failure','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','averageHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','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','RUNNING','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','util','bluebird','uuid','md5','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','contactsId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','name','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','actions','sequence','enqueue','Action','status','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','campaigns','[Dialer][checkChannel][ivr]','then','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xac0f,0x147));var _0xfac0=function(_0x4488d7,_0x18322f){_0x4488d7=_0x4488d7-0x0;var _0x399924=_0xac0f[_0x4488d7];return _0x399924;};'use strict';var util=require(_0xfac0('0x0'));var _=require('lodash');var BPromise=require(_0xfac0('0x1'));var uuid=require(_0xfac0('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xfac0('0x3'));var Redis=require('ioredis');var ut=require(_0xfac0('0x4'));var config=require(_0xfac0('0x5'));var logger=require('../../../config/logger')(_0xfac0('0x6'));var loggerBooked=require(_0xfac0('0x7'))(_0xfac0('0x8'));var loggerPredictive=require('../../../config/logger')(_0xfac0('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0xfac0('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xfac0('0xb'));var ami=require(_0xfac0('0xc'));config['redis']=_['defaults'](config[_0xfac0('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xfac0('0xe'))(new Redis(config[_0xfac0('0xd')]));var cmHopper=require(_0xfac0('0xf'));var cmHopperHistory=require(_0xfac0('0x10'));var cmHopperBlack=require(_0xfac0('0x11'));var voiceQueueRt=require(_0xfac0('0x12'));var Action=require(_0xfac0('0x13'));var History=require('./history');var Final=require(_0xfac0('0x14'));var AgentComplete=require(_0xfac0('0x15'));var QueueCallerAbandon=require(_0xfac0('0x16'));var Hangup=require(_0xfac0('0x17'));var ipAgi=process[_0xfac0('0x18')][_0xfac0('0x19')]||_0xfac0('0x1a');var strategy={'rrmemory':_0xfac0('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xfac0('0x1c')]['enqueue']=function(_0x23e3b0){this['tail']=this['tail']?this[_0xfac0('0x1d')][_0xfac0('0x1e')](_0x23e3b0):_0x23e3b0();};function Dialer(_0x52b259,_0x28afd3){this['sequence']=new Sequence();this[_0xfac0('0x1f')]=_0x28afd3;this[_0xfac0('0x20')]=_0x52b259[_0xfac0('0x20')];this['campaigns']=_0x52b259['campaigns'];this[_0xfac0('0x21')]=_0x52b259[_0xfac0('0x21')];this[_0xfac0('0x22')]=_0x52b259['trunks'];this[_0xfac0('0x23')]=config[_0xfac0('0x23')]||0x2;this[_0xfac0('0x24')]={};this['actions']={};this[_0xfac0('0x25')]={};this['uniqueId']={};this['optionPredictive']={};this[_0xfac0('0x26')]={};this[_0xfac0('0x27')]={};this[_0xfac0('0x28')]={};this[_0xfac0('0x29')]={};this[_0xfac0('0x2a')]={};ami['on'](_0xfac0('0x2b'),this[_0xfac0('0x2c')][_0xfac0('0x2d')](this));ami['on'](_0xfac0('0x2e'),this[_0xfac0('0x2f')][_0xfac0('0x2d')](this));ami['on'](_0xfac0('0x30'),this[_0xfac0('0x31')]['bind'](this));ami['on'](_0xfac0('0x32'),this[_0xfac0('0x33')][_0xfac0('0x2d')](this));ami['on'](_0xfac0('0x34'),this['syncQueueSummary'][_0xfac0('0x2d')](this));ami['on'](_0xfac0('0x35'),this[_0xfac0('0x36')]['bind'](this));ami['on'](_0xfac0('0x37'),this['syncNewExten'][_0xfac0('0x2d')](this));ami['on']('varset',this[_0xfac0('0x38')][_0xfac0('0x2d')](this));ami['on'](_0xfac0('0x39'),this[_0xfac0('0x3a')][_0xfac0('0x2d')](this));ami['on'](_0xfac0('0x3b'),this[_0xfac0('0x3c')][_0xfac0('0x2d')](this));this[_0xfac0('0x3d')]();this[_0xfac0('0x3e')]();}function isNotNull(_0x5a677c){return _0x5a677c!==null&&!_[_0xfac0('0x3f')](_0x5a677c);}function checkIsLoggedIn(_0x7495c7,_0x137ca9){return function(){if(_0x137ca9<=0x0){_0x7495c7[_0xfac0('0x40')]='AGENTS_NOT_LOGGED';throw _0x7495c7['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3e352d){return _0x3e352d;}function checkIsActive(_0x584719,_0x9793c5){return function(){if(!isActive(_0x9793c5)){_0x584719[_0xfac0('0x40')]='NOT_ACTIVE';throw _0x584719['name']+_0xfac0('0x41');}};}function checkInterval(_0x329b90){return function(){if(!isNotNull(_0x329b90[_0xfac0('0x42')])){_0x329b90[_0xfac0('0x40')]=_0xfac0('0x43');throw _0x329b90[_0xfac0('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x329b90['Interval'][_0xfac0('0x45')])){_0x329b90[_0xfac0('0x40')]='INTERVAL_IS_NULL';throw _0x329b90[_0xfac0('0x44')]+_0xfac0('0x46');}if(!isNotNull(_[_0xfac0('0x47')](_0x329b90[_0xfac0('0x42')]['Intervals']))){_0x329b90[_0xfac0('0x40')]=_0xfac0('0x43');throw _0x329b90[_0xfac0('0x44')]+_0xfac0('0x46');}};}function msgResponse(_0x52cfd5,_0x59e6cd,_0x1bebe0){return{'action':_0x52cfd5,'response':_0x59e6cd,'message':_0x1bebe0,'stack':_0x1bebe0};}function myreject(_0x36497b){return function(_0x1d8c6d){return _0x36497b(msgResponse('[ifTime][Action]',_0xfac0('0x48'),JSON['stringify'](_0x1d8c6d)));};}function getSeconds(_0xd41d7a,_0x3063d4){var _0x261f4c=moment(_0xd41d7a)[_0xfac0('0x49')](0x0);var _0x2c883d=moment(_0x3063d4)['milliseconds'](0x0);return _0x261f4c[_0xfac0('0x4a')](_0x2c883d,_0xfac0('0x4b'));}function emit(_0x7709cb,_0x2cf636,_0x5b8484){io['to'](_0x7709cb)[_0xfac0('0x4c')](_0x2cf636,_0x5b8484);}function emitVoiceQueueSummary(_0x27993a){if(_0x27993a[_0xfac0('0x4d')]===_0xfac0('0x4e')){var _0x37c5f6={'id':_0x27993a['id'],'name':_0x27993a['name'],'strategy':_0x27993a[_0xfac0('0x4f')],'answered':_0x27993a[_0xfac0('0x50')],'available':_0x27993a['available'],'loggedIn':_0x27993a[_0xfac0('0x51')],'pTalking':_0x27993a[_0xfac0('0x52')],'sumBillable':_0x27993a['sumBillable'],'sumDuration':_0x27993a[_0xfac0('0x53')],'sumHoldTime':_0x27993a[_0xfac0('0x54')]||0x0,'talking':_0x27993a[_0xfac0('0x55')],'total':_0x27993a[_0xfac0('0x56')],'type':_0x27993a['type'],'unmanaged':_0x27993a[_0xfac0('0x57')],'abandoned':_0x27993a['abandoned'],'waiting':_0x27993a['waiting'],'loggedInDb':_0x27993a[_0xfac0('0x58')],'dialActive':_0x27993a[_0xfac0('0x59')],'dialMethod':_0x27993a['dialMethod'],'dialOriginateCallerIdName':_0x27993a[_0xfac0('0x5a')],'dialOriginateCallerIdNumber':_0x27993a[_0xfac0('0x5b')],'dialOriginateTimeout':_0x27993a['dialOriginateTimeout'],'dialPrefix':_0x27993a[_0xfac0('0x5c')],'outboundAnswerAgiCallsDay':_0x27993a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x27993a[_0xfac0('0x5d')],'outboundBlacklistCallsDay':_0x27993a[_0xfac0('0x5e')],'outboundBusyCallsDay':_0x27993a[_0xfac0('0x5f')],'outboundCongestionCallsDay':_0x27993a[_0xfac0('0x60')],'outboundDropCallsDayACS':_0x27993a[_0xfac0('0x61')],'outboundDropCallsDayCallersExit':_0x27993a[_0xfac0('0x62')],'outboundDropCallsDayTimeout':_0x27993a[_0xfac0('0x63')],'outboundNoAnswerCallsDay':_0x27993a[_0xfac0('0x64')],'outboundNoSuchCallsDay':_0x27993a[_0xfac0('0x65')],'outboundOriginateFailureCallsDay':_0x27993a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x27993a[_0xfac0('0x66')],'outboundRejectCallsDay':_0x27993a[_0xfac0('0x67')],'outboundUnknownCallsDay':_0x27993a['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x27993a[_0xfac0('0x68')],'predictiveIntervalAvgHoldtime':_0x27993a[_0xfac0('0x69')],'predictiveIntervalAvgTalktime':_0x27993a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x27993a[_0xfac0('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x27993a[_0xfac0('0x6b')],'predictiveIntervalErlangCalls':_0x27993a[_0xfac0('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x27993a[_0xfac0('0x6d')],'predictiveIntervalHitRate':_0x27993a[_0xfac0('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x27993a[_0xfac0('0x6f')],'predictiveIntervalPauses':_0x27993a[_0xfac0('0x70')],'predictiveIntervalAvailable':_0x27993a[_0xfac0('0x71')],'predictiveIntervalTotalCalls':_0x27993a[_0xfac0('0x72')],'message':_0x27993a[_0xfac0('0x40')],'originated':_0x27993a[_0xfac0('0x73')],'erlangCalls':_0x27993a[_0xfac0('0x74')],'erlangCallToSecond':_0x27993a[_0xfac0('0x75')],'erlangAbandonmentRate':_0x27993a[_0xfac0('0x76')],'erlangBusyFactor':_0x27993a['erlangBusyFactor'],'startPredictive':_0x27993a[_0xfac0('0x26')],'startProgressive':_0x27993a[_0xfac0('0x27')]};if(_0x27993a['Trunk']){_0x37c5f6['Trunk']={'id':_0x27993a['Trunk']['id'],'name':_0x27993a[_0xfac0('0x77')][_0xfac0('0x44')],'active':_0x27993a[_0xfac0('0x77')][_0xfac0('0x78')],'callerid':_0x27993a['Trunk'][_0xfac0('0x79')]};}if(_0x27993a[_0xfac0('0x42')]){_0x37c5f6[_0xfac0('0x42')]={'id':_0x27993a['Interval']['id'],'name':_0x27993a[_0xfac0('0x42')]['name']};}var _0xe680eb=md5(JSON[_0xfac0('0x7a')](_0x37c5f6));if(_0x27993a['md5']!==_0xe680eb){_0x27993a['md5']=_0xe680eb;emit(util['format'](_0xfac0('0x7b'),_0x37c5f6[_0xfac0('0x44')]),_0xfac0('0x7c'),_0x37c5f6);}}}function emitCampaignSummary(_0x2034e4){if(_0x2034e4[_0xfac0('0x4d')]===_0xfac0('0x7d')){emit(util[_0xfac0('0x7e')](_0xfac0('0x7f'),_0x2034e4['name']),'campaign:save',_0x2034e4);}}function checkGetDataPredictive(_0x5ae17e){if(isNotNull(_0x5ae17e)&&!_[_0xfac0('0x47')](_0x5ae17e)){loggerPredictive['info'](_0xfac0('0x80'));loggerPredictive[_0xfac0('0x81')](_0xfac0('0x82'),_0x5ae17e[_0xfac0('0x72')]);loggerPredictive['info'](_0xfac0('0x83'),_0x5ae17e['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xfac0('0x81')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ae17e[_0xfac0('0x6b')]);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x84'),_0x5ae17e[_0xfac0('0x6a')]);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x85'),_0x5ae17e[_0xfac0('0x69')]);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x86'),_0x5ae17e[_0xfac0('0x87')]);loggerPredictive['info'](_0xfac0('0x88'));if(_0x5ae17e[_0xfac0('0x72')]>0x0){if(!_[_0xfac0('0x3f')](_0x5ae17e[_0xfac0('0x87')])&&_0x5ae17e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xfac0('0x81')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xfac0('0x3f')](_0x5ae17e[_0xfac0('0x69')])&&_0x5ae17e[_0xfac0('0x69')]>0x0){return!![];}loggerPredictive[_0xfac0('0x81')](_0xfac0('0x89'));}else{loggerPredictive[_0xfac0('0x81')](_0xfac0('0x8a'));}}else{loggerPredictive[_0xfac0('0x81')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x15c919){return function(_0x336db1){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xfac0('0x81')](_0xfac0('0x8b'),_0x336db1[_0xfac0('0x74')]);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x8c'),_0x336db1['erlangCallToSecond']);loggerPredictive['info'](_0xfac0('0x8d'),_0x336db1['erlangAbandonmentRate']);loggerPredictive['info'](_0xfac0('0x8e'),_0x336db1['erlangBusyFactor']);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x8d'),_0x336db1[_0xfac0('0x76')]);loggerPredictive[_0xfac0('0x81')]('---------------------------');_['merge'](_0x15c919,_0x336db1);};}function getDiff(_0x55aedc){var _0x5ec08f=moment()['milliseconds'](0x0);var _0x2dd959=moment(_0x55aedc)[_0xfac0('0x49')](0x0);return _0x5ec08f[_0xfac0('0x4a')](_0x2dd959,_0xfac0('0x4b'));}function ifInterval(_0x40e96e,_0x4eb99a){if(_['isUndefined'](_0x4eb99a)){return![];}return getDiff(_0x4eb99a)<_0x40e96e*0x3c;}function freeVariablesPredictive(_0x5d39b5){if(isNotNull(_0x5d39b5)){if(!_['isUndefined'](_0x5d39b5[_0xfac0('0x27')])){_0x5d39b5['startProgressive']=undefined;loggerPredictive[_0xfac0('0x81')](_0x5d39b5['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xfac0('0x3f')](_0x5d39b5[_0xfac0('0x26')])){_0x5d39b5[_0xfac0('0x26')]=undefined;loggerPredictive[_0xfac0('0x81')](_0x5d39b5[_0xfac0('0x44')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xfac0('0x3f')](_0x5d39b5[_0xfac0('0x8f')])){clearInterval(_0x5d39b5[_0xfac0('0x8f')]);_0x5d39b5[_0xfac0('0x8f')]=undefined;loggerPredictive[_0xfac0('0x81')](_0x5d39b5[_0xfac0('0x44')],_0xfac0('0x90'));}}}function erlangb(_0x466a42,_0x4cc7b7){if(_0x4cc7b7===0x0){return 0x0;}var _0x2acec4=0x1;for(var _0x23488f=0x1;_0x23488f<=_0x4cc7b7;_0x23488f+=0x1){_0x2acec4=0x1+_0x2acec4*_0x23488f/_0x466a42;}return 0x1/_0x2acec4;}function isVoiceQueueOutbound(_0x18a2d4){return _0x18a2d4===_0xfac0('0x4e');}function isNotPreview(_0x2282bc){return _0x2282bc!==_0xfac0('0x1f');}function isCampaignIvr(_0x5c1bf4){return _0x5c1bf4==='ivr';}function getCallerId(_0x423aef,_0x5d20fb,_0x11e702){if(!_[_0xfac0('0x3f')](_0x11e702)&&typeof _0x11e702===_0xfac0('0x91')&&!_[_0xfac0('0x47')](_0x11e702)){if(!_[_0xfac0('0x3f')](_0x5d20fb)&&typeof _0x5d20fb===_0xfac0('0x91')&&!_[_0xfac0('0x47')](_0x5d20fb)){return util[_0xfac0('0x7e')]('\x22%s\x22\x20<%s>',_0x5d20fb,_0x11e702);}return util['format'](_0xfac0('0x92'),_0x11e702,_0x11e702);}if(!_[_0xfac0('0x3f')](_0x423aef)&&typeof _0x423aef===_0xfac0('0x91')&&!_[_0xfac0('0x47')](_0x423aef)){return _0x423aef;}return _0xfac0('0x93');}function loggerCatchQueueSummary(_0x5061b1,_0x2320cb){return function(_0x55e727){freeVariablesPredictive(_0x2320cb);emitVoiceQueueSummary(_0x2320cb);emitCampaignSummary(_0x2320cb);loggerSyncQueueSummary[_0xfac0('0x94')](_0x5061b1,util[_0xfac0('0x95')](_0x55e727,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x14f76c,_0x519e89){return function(_0x317c76){loggerPredictive[_0xfac0('0x94')](_0x519e89[_0xfac0('0x44')],_0x14f76c);loggerPredictive[_0xfac0('0x94')](_0x317c76['stack']);freeVariablesPredictive(_0x519e89);};}function loggerCatch(_0xe72f9f){return function(_0x36795e){logger['error'](_0xe72f9f,util[_0xfac0('0x95')](_0x36795e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x42efed){return _0x42efed&&!_[_0xfac0('0x3f')](_0x42efed)&&_0x42efed['length']>0x0;}function decremetOriginate(_0x5720a8){if(!_[_0xfac0('0x3f')](_0x5720a8)&&_0x5720a8!==null){if(typeof _0x5720a8[_0xfac0('0x73')]!==_0xfac0('0x96')){if(_0x5720a8[_0xfac0('0x73')]>0x0){_0x5720a8[_0xfac0('0x73')]-=0x1;}else{logger[_0xfac0('0x94')](_0xfac0('0x97'));}}}else{logger['error'](_0xfac0('0x98'));}}function checkContactLowerLimitOriginate(_0x2c178c,_0xa47512,_0x124f8d){if(_0xa47512>_0x124f8d){for(var _0x78e954=0x0;_0x78e954<_0xa47512-_0x124f8d;_0x78e954+=0x1){decremetOriginate(_0x2c178c);}}}function loggerGetContactDialer(_0x1b80b8,_0x5f038d,_0x2009ca){return function(_0x435f6b){checkContactLowerLimitOriginate(_0x5f038d,_0x2009ca,0x0);logger[_0xfac0('0x94')](_0x1b80b8,util['inspect'](_0x435f6b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xc5b267){return function(_0x491052){if(isNotNull(_0x491052)&&isNotNull(_0x491052[0x0])){if(_0x491052[0x0][_0xfac0('0x99')]>0x0){_0xc5b267[_0xfac0('0x40')]='RESCHEDULED_CONTACTS';logger['info'](_0xfac0('0x9a')+_0xc5b267[_0xfac0('0x44')],_0x491052[0x0][_0xfac0('0x99')],_0xfac0('0x9b'));}else{_0xc5b267[_0xfac0('0x40')]=_0xfac0('0x9c');logger[_0xfac0('0x81')](_0xfac0('0x9d')+_0xc5b267[_0xfac0('0x44')]);}}};}function notSendMessagesQueue(_0x267830){if(_0x267830[_0xfac0('0x9e')]){freeVariablesPredictive(_0x267830);if(_0x267830[_0xfac0('0x73')]===0x0&&_0x267830[_0xfac0('0x55')]===0x0&&_0x267830[_0xfac0('0x9f')]===0x0&&(_0x267830[_0xfac0('0x52')]||0x0)===0x0){_0x267830['sendMessageOneNotActive']=![];_0x267830['available']=0x0;_0x267830[_0xfac0('0x40')]=_0xfac0('0xa0');loggerSyncQueueSummary[_0xfac0('0x94')](_0xfac0('0xa1'),_0x267830[_0xfac0('0x44')],'is\x20not\x20active');}else{_0x267830[_0xfac0('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xfac0('0x94')](_0xfac0('0xa1'),_0x267830['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x267830);}}function notSendMessagesCampaign(_0x5cd1d1){if(_0x5cd1d1[_0xfac0('0x9e')]){if(_0x5cd1d1['originated']===0x0){_0x5cd1d1[_0xfac0('0x9e')]=![];_0x5cd1d1['message']=_0xfac0('0xa0');loggerSyncQueueSummary[_0xfac0('0x94')](_0xfac0('0xa2'),_0x5cd1d1[_0xfac0('0x44')],_0xfac0('0xa3'));}else{_0x5cd1d1[_0xfac0('0x40')]=_0xfac0('0xa4');loggerSyncQueueSummary[_0xfac0('0x94')](_0xfac0('0xa2'),_0x5cd1d1[_0xfac0('0x44')],_0xfac0('0xa5'));}emitCampaignSummary(_0x5cd1d1);}}function createObjHistory(_0x520d3a,_0x13a0ed,_0x169941,_0x8327a,_0x80083c){_0x520d3a[_0xfac0('0x40')]=_0x169941;var _0x201a91=new Action(_0x520d3a,_0x13a0ed);var _0x82e537=new History(_0x201a91);_0x82e537[_0xfac0('0xa6')]=_0x8327a;_0x82e537[_0xfac0('0xa7')]=_0x80083c;_0x82e537[_0xfac0('0xa8')]=_0x201a91[_0xfac0('0xa9')];return _0x82e537;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x2123ea=this;setInterval(function(){_0x2123ea[_0xfac0('0xaa')](_0x2123ea[_0xfac0('0xab')],_0xfac0('0xac'));_0x2123ea['clearZombieChannels'](_0x2123ea[_0xfac0('0xad')],'[actions]');},0x32c8);};Dialer[_0xfac0('0x1c')][_0xfac0('0xaa')]=function(_0x4071f0,_0x363f3e){var _0x18753e=this;for(var _0x442d6a in _0x4071f0){if(typeof _0x4071f0[_0x442d6a]!==_0xfac0('0x96')){this[_0xfac0('0xae')][_0xfac0('0xaf')](function(){if(!_['isNil'](_0x4071f0[_0x442d6a])){return ami[_0xfac0('0xb0')]({'action':_0xfac0('0xb1'),'channel':_0x4071f0[_0x442d6a]['channel']})['catch'](function(_0x55a665){if(_0x55a665[_0xfac0('0x40')]===_0xfac0('0xb2')){setTimeout(function(){if(_0x4071f0[_0x442d6a]&&_0x4071f0[_0x442d6a][_0xfac0('0x4d')]!=='ivr'){_0x18753e[_0xfac0('0xb3')](_0x18753e[_0xfac0('0x20')][_0x4071f0[_0x442d6a]['queue']]);logger[_0xfac0('0x94')](_0xfac0('0xb4'),_0x363f3e,_0x442d6a,_0x4071f0[_0x442d6a][_0xfac0('0xb5')]);delete _0x4071f0[_0x442d6a];}if(_0x4071f0[_0x442d6a]&&_0x4071f0[_0x442d6a][_0xfac0('0x4d')]==='ivr'){_0x18753e[_0xfac0('0xb3')](_0x18753e[_0xfac0('0xb6')][_0x4071f0[_0x442d6a][_0xfac0('0xb5')]]);logger[_0xfac0('0x94')](_0xfac0('0xb7'),_0x363f3e,_0x442d6a,_0x4071f0[_0x442d6a][_0xfac0('0xb5')]);delete _0x4071f0[_0x442d6a];}},0x2328);}});}});}}};Dialer[_0xfac0('0x1c')]['countReScheduled']=function(_0xb47b7e){return BPromise['resolve']()[_0xfac0('0xb8')](cmHopper[_0xfac0('0xb9')](_0xb47b7e))[_0xfac0('0xba')](loggerCatch(_0xfac0('0xbb')));};Dialer[_0xfac0('0x1c')][_0xfac0('0xbc')]=function(_0x1776c0){return BPromise['resolve']()[_0xfac0('0xb8')](cmHopperBlack[_0xfac0('0xbc')](_0x1776c0))['catch'](loggerCatch(_0xfac0('0xbd')));};Dialer[_0xfac0('0x1c')][_0xfac0('0xbe')]=function(_0x4c6d54){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopperBlack[_0xfac0('0xbe')](_0x4c6d54))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xfac0('0x1c')]['averageHandleTime']=function(_0x275631){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopperHistory['avgHandleTime'](_0x275631))['catch'](loggerCatch(_0xfac0('0xc0')));};Dialer[_0xfac0('0x1c')][_0xfac0('0xc1')]=function(_0xa03e6f){return BPromise[_0xfac0('0xbf')]()['then'](cmHopper[_0xfac0('0xc1')](_0xa03e6f))[_0xfac0('0xba')](loggerCatch(_0xfac0('0xc2')));};Dialer[_0xfac0('0x1c')][_0xfac0('0xc3')]=function(_0x26ab1e,_0x1a5d55,_0x34b74d){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopper['unlockContact'](_0x26ab1e,_0x1a5d55,_0x34b74d))[_0xfac0('0xba')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype'][_0xfac0('0xc4')]=function(_0x1271cb,_0x132135,_0x27ab32,_0x3a5f95){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopper[_0xfac0('0xc4')](_0x1271cb,_0x132135,_0x27ab32,_0x3a5f95))[_0xfac0('0xba')](loggerCatch(_0xfac0('0xc5')));};Dialer[_0xfac0('0x1c')][_0xfac0('0xc6')]=function(_0x1a81eb,_0x5d78c7,_0x367f4b){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopper[_0xfac0('0xc6')](_0x1a81eb,_0x5d78c7,_0x367f4b))[_0xfac0('0xba')](loggerCatch(_0xfac0('0xc5')));};Dialer['prototype'][_0xfac0('0xc7')]=function(_0x1fcee7){return BPromise['resolve']()[_0xfac0('0xb8')](voiceQueueRt[_0xfac0('0xc7')](_0x1fcee7))[_0xfac0('0xba')](loggerCatch(_0xfac0('0xc8')));};Dialer['prototype'][_0xfac0('0xc9')]=function(_0x4751d9){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopper['moveContactManagedDialer'](_0x4751d9))[_0xfac0('0xba')](loggerCatch(_0xfac0('0xca')));};Dialer[_0xfac0('0x1c')]['createHistory']=function(_0x228ec4){return BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](cmHopperHistory[_0xfac0('0xcb')](_0x228ec4))['catch'](loggerCatch(_0xfac0('0xcc')));};Dialer[_0xfac0('0x1c')][_0xfac0('0xb3')]=function(_0x1bf972){if(!_[_0xfac0('0x3f')](_0x1bf972)&&_0x1bf972!==null){if(typeof _0x1bf972[_0xfac0('0x73')]!==_0xfac0('0x96')){if(_0x1bf972[_0xfac0('0x73')]>0x0){_0x1bf972[_0xfac0('0x73')]-=0x1;}else{logger[_0xfac0('0x94')](_0xfac0('0xcd'));}}}else{logger[_0xfac0('0x94')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xfac0('0x1c')][_0xfac0('0xce')]=function(_0x13cd8e,_0x1ab658){var _0x2d8c0f=this;return function(_0x12782b){_0x2d8c0f[_0xfac0('0xb3')](_0x1ab658);logger[_0xfac0('0x94')](_0x13cd8e,util[_0xfac0('0x95')](_0x12782b,{'showHidden':![],'depth':null}));};};Dialer[_0xfac0('0x1c')][_0xfac0('0xcf')]=function(_0x351c81,_0x3b51a8,_0x41847f){var _0x29fefb={'state':0x19,'statedesc':_0xfac0('0xd0')};this[_0xfac0('0xb3')](_0x3b51a8);this[_0xfac0('0xd1')](_[_0xfac0('0xd2')](_0x29fefb,_[_0xfac0('0xd3')](_0x41847f,['ContactId','ListId',_0xfac0('0xd4'),'VoiceQueueId',_0xfac0('0xd5')])),_0xfac0('0xd6'),'[emptyContact]');logger['error'](_0x351c81);};Dialer['prototype'][_0xfac0('0xd7')]=function(_0x42f2e0){return _0x42f2e0===_0xfac0('0xd8');};Dialer['prototype'][_0xfac0('0xd9')]=function(_0x1d45bc){return!_[_0xfac0('0x3f')](_0x1d45bc)&&_0x1d45bc&&!_[_0xfac0('0x3f')](_0x1d45bc[_0xfac0('0x44')])&&!_[_0xfac0('0x3f')](_0x1d45bc['active'])&&_0x1d45bc[_0xfac0('0x78')]&&(this['trunks'][util[_0xfac0('0x7e')]('SIP/%s',_0x1d45bc['name'])][_0xfac0('0xb1')]===_0xfac0('0xda')||this[_0xfac0('0x22')][util[_0xfac0('0x7e')](_0xfac0('0xdb'),_0x1d45bc[_0xfac0('0x44')])]['status']===_0xfac0('0xdc'));};Dialer[_0xfac0('0x1c')]['saveInDb']=function(_0xf42f7,_0x1be0e4,_0x4bd960){this[_0xfac0('0xcb')](_0xf42f7)['catch'](loggerCatch(_0x1be0e4));this[_0xfac0('0xc9')](_0xf42f7)[_0xfac0('0xba')](loggerCatch(_0x4bd960));};Dialer[_0xfac0('0x1c')][_0xfac0('0x38')]=function(_0x11b458){var _0x5e5d9c=this[_0xfac0('0xab')][_0x11b458[_0xfac0('0xdd')]];var _0x12181a;if(!_[_0xfac0('0xde')](_0x11b458)&&!_['isNil'](_0x11b458[_0xfac0('0xdf')])&&!_[_0xfac0('0xde')](_0x11b458['variable'][_0xfac0('0xe0')])&&_0x11b458[_0xfac0('0xe1')]===_0xfac0('0xe2')&&_0x5e5d9c){if(_0x5e5d9c[_0xfac0('0x4d')]!==_0xfac0('0x7d')&&this[_0xfac0('0x20')][_0x5e5d9c['queue']][_0xfac0('0xe3')]&&_0x11b458[_0xfac0('0xe4')]===_0xfac0('0xe5')){delete this[_0xfac0('0xab')][_0x11b458['uniqueid']];this[_0xfac0('0xb3')](this['voiceQueues'][_0x5e5d9c[_0xfac0('0xb5')]]);this[_0xfac0('0x20')][_0x5e5d9c[_0xfac0('0xb5')]][_0xfac0('0x5d')]+=0x1;this[_0xfac0('0x20')][_0x5e5d9c['queue']][_0xfac0('0xe6')]+=0x1;_0x12181a=new Hangup(_0x5e5d9c,_0x11b458);_0x12181a[_0xfac0('0xa6')]=0x12;_0x12181a[_0xfac0('0xa7')]=_0xfac0('0xe7');_0x12181a[_0xfac0('0xe8')]=_0xfac0('0xe9');this[_0xfac0('0xd1')](_0x12181a,_0xfac0('0xea'),'[syncHangupInAMD]');}if(_0x5e5d9c['type']!==_0xfac0('0x7d')&&this[_0xfac0('0x20')][_0x5e5d9c[_0xfac0('0xb5')]]['dialAMDActive']&&_0x11b458['value']===_0xfac0('0xeb')){var _0x5b2951=this;return new BPromise(function(_0x59bb9f,_0x45bbfe){delete _0x5b2951[_0xfac0('0xab')][_0x11b458[_0xfac0('0xdd')]];_0x5b2951[_0xfac0('0xb3')](_0x5b2951[_0xfac0('0x20')][_0x5e5d9c[_0xfac0('0xb5')]]);_0x5b2951[_0xfac0('0x20')][_0x5e5d9c[_0xfac0('0xb5')]][_0xfac0('0x5d')]+=0x1;_0x5b2951['voiceQueues'][_0x5e5d9c[_0xfac0('0xb5')]][_0xfac0('0xe6')]+=0x1;var _0x4df6a2=_0x5b2951['voiceQueues'][_0x5e5d9c[_0xfac0('0xb5')]];var _0x248191=new Hangup(_0x5e5d9c,_0x11b458);_0x248191[_0xfac0('0xa6')]=0x13;_0x248191[_0xfac0('0xa7')]=_0xfac0('0xec');_0x248191[_0xfac0('0xe8')]=_0xfac0('0xe9');_0x248191[_0xfac0('0xed')]+=0x1;_0x248191[_0xfac0('0xee')]+=0x1;_0x248191[_0xfac0('0xef')]=!![];_0x5b2951['createHistory'](_0x248191)[_0xfac0('0xba')](loggerCatch(_0xfac0('0xf0')));if(_0x248191[_0xfac0('0xf1')]+_0x248191[_0xfac0('0xf2')]+_0x248191[_0xfac0('0xf3')]+_0x248191[_0xfac0('0xf4')]+_0x248191[_0xfac0('0xf5')]+_0x248191[_0xfac0('0xf6')]+_0x248191[_0xfac0('0xed')]+_0x248191[_0xfac0('0xf7')]>=_0x4df6a2[_0xfac0('0xf8')]){_0x5b2951[_0xfac0('0xf9')](_0x248191,_0x59bb9f,_0x45bbfe,_0xfac0('0xfa'));}else{if(_0x248191[_0xfac0('0xed')]>=_0x4df6a2[_0xfac0('0xfb')]){_0x5b2951[_0xfac0('0xfc')](_0x248191,_0x59bb9f,_0x45bbfe,_0xfac0('0xfd'));}else{_0x5b2951['rescheduleContact']({'active':![],'countmachineretry':_0x248191[_0xfac0('0xed')],'scheduledat':moment()['add'](_0x4df6a2[_0xfac0('0xfe')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x248191[_0xfac0('0x101')],'ListId':_0x248191['ListId'],'VoiceQueueId':_0x248191[_0xfac0('0x102')]||undefined,'CampaignId':_0x248191[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0x59bb9f({'reschedule':0x1});}}});}if(_0x5e5d9c[_0xfac0('0x4d')]===_0xfac0('0x7d')&&this['campaigns'][_0x5e5d9c['queue']]['dialAMDActive']&&_0x11b458[_0xfac0('0xe4')]===_0xfac0('0xe5')){delete this['uniqueId'][_0x11b458[_0xfac0('0xdd')]];this[_0xfac0('0xb3')](this[_0xfac0('0xb6')][_0x5e5d9c[_0xfac0('0xb5')]]);_0x12181a=new Hangup(_0x5e5d9c,_0x11b458);_0x12181a[_0xfac0('0xa6')]=0x12;_0x12181a[_0xfac0('0xa7')]=_0xfac0('0xe7');_0x12181a[_0xfac0('0xe8')]=_0xfac0('0xe9');this[_0xfac0('0xd1')](_0x12181a,_0xfac0('0x103'),_0xfac0('0x104'));}if(_0x5e5d9c[_0xfac0('0x4d')]===_0xfac0('0x7d')&&this[_0xfac0('0xb6')][_0x5e5d9c[_0xfac0('0xb5')]]['dialAMDActive']&&_0x11b458[_0xfac0('0xe4')]===_0xfac0('0xeb')){var _0x5b2951=this;return new BPromise(function(_0x335dae,_0x1b921b){delete _0x5b2951[_0xfac0('0xab')][_0x11b458['uniqueid']];_0x5b2951[_0xfac0('0xb3')](_0x5b2951[_0xfac0('0xb6')][_0x5e5d9c[_0xfac0('0xb5')]]);_0x5b2951[_0xfac0('0xb6')][_0x5e5d9c[_0xfac0('0xb5')]][_0xfac0('0x5d')]+=0x1;_0x5b2951[_0xfac0('0xb6')][_0x5e5d9c[_0xfac0('0xb5')]][_0xfac0('0xe6')]+=0x1;var _0x3138a9=_0x5b2951[_0xfac0('0xb6')][_0x5e5d9c['queue']];var _0xf660df=new Hangup(_0x5e5d9c,_0x11b458);_0xf660df[_0xfac0('0xa6')]=0x13;_0xf660df[_0xfac0('0xa7')]='Machine';_0xf660df[_0xfac0('0xe8')]=_0xfac0('0xe9');_0xf660df[_0xfac0('0xed')]+=0x1;_0xf660df['countglobal']+=0x1;_0xf660df[_0xfac0('0xef')]=!![];_0x5b2951['createHistory'](_0xf660df)[_0xfac0('0xba')](loggerCatch(_0xfac0('0xf0')));if(_0xf660df['countbusyretry']+_0xf660df[_0xfac0('0xf2')]+_0xf660df[_0xfac0('0xf3')]+_0xf660df[_0xfac0('0xf4')]+_0xf660df[_0xfac0('0xf5')]+_0xf660df[_0xfac0('0xf6')]+_0xf660df[_0xfac0('0xed')]+_0xf660df[_0xfac0('0xf7')]>=_0x3138a9[_0xfac0('0xf8')]){_0x5b2951[_0xfac0('0xf9')](_0xf660df,_0x335dae,_0x1b921b,_0xfac0('0xfa'));}else{if(_0xf660df[_0xfac0('0xed')]>=_0x3138a9[_0xfac0('0xfb')]){_0x5b2951[_0xfac0('0xfc')](_0xf660df,_0x335dae,_0x1b921b,'reason\x2019\x20machine....');}else{_0x5b2951[_0xfac0('0xc1')]({'active':![],'countmachineretry':_0xf660df[_0xfac0('0xed')],'scheduledat':moment()[_0xfac0('0x105')](_0x3138a9[_0xfac0('0xfe')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0xf660df['ContactId'],'ListId':_0xf660df[_0xfac0('0x106')],'VoiceQueueId':_0xf660df[_0xfac0('0x102')]||undefined,'CampaignId':_0xf660df[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x107')));_0x335dae({'reschedule':0x1});}}});}}};Dialer[_0xfac0('0x1c')][_0xfac0('0x36')]=function(_0x3addd8){var _0x20c930=this[_0xfac0('0xab')][_0x3addd8[_0xfac0('0xdd')]];var _0x19c5a8=this;var _0x46320c;if(_0x20c930&&_0x20c930[_0xfac0('0x4d')]==='ivr'){delete this['uniqueId'][_0x3addd8['uniqueid']];this[_0xfac0('0xb3')](this[_0xfac0('0xb6')][_0x20c930['queue']]);this['campaigns'][_0x20c930[_0xfac0('0xb5')]][_0xfac0('0x108')]+=0x1;_0x46320c=new Hangup(_0x20c930,_0x3addd8);this[_0xfac0('0xcb')](_0x46320c)['catch'](loggerCatch(_0xfac0('0x109')));this[_0xfac0('0xc9')](_0x46320c)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x10a')));}if(_0x20c930&&_0x20c930['type']!==_0xfac0('0x7d')&&isNotNull(this['voiceQueues'][_0x20c930[_0xfac0('0xb5')]][_0xfac0('0x10b')])){delete this[_0xfac0('0xab')][_0x3addd8['uniqueid']];this[_0xfac0('0xb3')](this[_0xfac0('0x20')][_0x20c930[_0xfac0('0xb5')]]);this[_0xfac0('0x20')][_0x20c930[_0xfac0('0xb5')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x20c930[_0xfac0('0xb5')]][_0xfac0('0xe6')]+=0x1;_0x46320c=new Hangup(_0x20c930,_0x3addd8);_0x46320c[_0xfac0('0xa6')]=0x10;_0x46320c[_0xfac0('0xa7')]=_0xfac0('0x10c');_0x46320c['membername']='AGI';this['createHistory'](_0x46320c)[_0xfac0('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xfac0('0xc9')](_0x46320c)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x10a')));}if(_0x20c930&&_0x20c930[_0xfac0('0x4d')]!==_0xfac0('0x7d')&&!isNotNull(this[_0xfac0('0x20')][_0x20c930['queue']][_0xfac0('0x10b')])){delete this[_0xfac0('0xab')][_0x3addd8[_0xfac0('0xdd')]];this['updateOriginated'](this[_0xfac0('0x20')][_0x20c930[_0xfac0('0xb5')]]);this['voiceQueues'][_0x20c930[_0xfac0('0xb5')]][_0xfac0('0x10d')]+=0x1;_0x46320c=new Hangup(_0x20c930,_0x3addd8);_0x46320c[_0xfac0('0xa6')]=0xc;_0x46320c[_0xfac0('0xa7')]=_0x3addd8['cause-txt'];_0x46320c[_0xfac0('0xe8')]='Unknow';this[_0xfac0('0xcb')](_0x46320c)['catch'](loggerCatch(_0xfac0('0x109')));this['moveContactManagedDialer'](_0x46320c)['catch'](loggerCatch(_0xfac0('0x10a')));}};Dialer[_0xfac0('0x1c')][_0xfac0('0x33')]=function(_0x416736){var _0xc16e22=this[_0xfac0('0xab')][_0x416736[_0xfac0('0xdd')]];var _0x1a4026=this;if(this[_0xfac0('0x20')][_0x416736['queue']]){if(_0xc16e22&&_0xc16e22[_0xfac0('0x4d')]!==_0xfac0('0x7d')){delete this[_0xfac0('0xab')][_0x416736[_0xfac0('0xdd')]];this[_0xfac0('0x20')][_0x416736[_0xfac0('0xb5')]][_0xfac0('0x5d')]+=0x1;var _0xca66fb=new AgentComplete(_0xc16e22,_0x416736);if(_0x416736['reason']===_0xfac0('0x10e')){_0xca66fb[_0xfac0('0x10f')]=this['voiceQueues'][_0x416736[_0xfac0('0xb5')]][_0xfac0('0x110')]&&this[_0xfac0('0x20')][_0x416736[_0xfac0('0xb5')]][_0xfac0('0x111')]?moment()[_0xfac0('0x7e')](_0xfac0('0x100')):undefined;}this[_0xfac0('0xcb')](_0xca66fb)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x112')));this[_0xfac0('0xc9')](_0xca66fb)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x113')));}}};Dialer[_0xfac0('0x1c')][_0xfac0('0x2c')]=function(_0x5bff7a){if(this['voiceQueues'][_0x5bff7a[_0xfac0('0xb5')]]){if(this['uniqueId'][_0x5bff7a[_0xfac0('0xdd')]]&&this[_0xfac0('0xab')][_0x5bff7a['uniqueid']][_0xfac0('0x4d')]!==_0xfac0('0x7d')){this[_0xfac0('0xb3')](this['voiceQueues'][_0x5bff7a[_0xfac0('0xb5')]]);this[_0xfac0('0xab')][_0x5bff7a[_0xfac0('0xdd')]][_0xfac0('0x114')]=moment()[_0xfac0('0x7e')](_0xfac0('0x100'));}}};Dialer[_0xfac0('0x1c')]['queueCallerAbandonCreateState']=function(_0x2d7d38){this[_0xfac0('0xcb')](_0x2d7d38)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x112')));this[_0xfac0('0xc9')](_0x2d7d38)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x115')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x506122){var _0x5dc76=this[_0xfac0('0xab')][_0x506122[_0xfac0('0xdd')]];var _0x4ac9ed=this;if(this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]]){if(_0x5dc76&&_0x5dc76['type']!==_0xfac0('0x7d')){delete this[_0xfac0('0xab')][_0x506122['uniqueid']];this['updateOriginated'](this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]]);_0x5dc76['droptime']=moment()[_0xfac0('0x7e')](_0xfac0('0x100'));var _0x12f606=new QueueCallerAbandon(_0x5dc76,_0x506122);if(getSeconds(_0x5dc76[_0xfac0('0x116')],_0x5dc76[_0xfac0('0x117')])>=_0x5dc76[_0xfac0('0x118')]){this[_0xfac0('0x20')][_0x506122['queue']][_0xfac0('0x6b')]+=0x1;this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]][_0xfac0('0x63')]+=0x1;this['voiceQueues'][_0x506122[_0xfac0('0xb5')]][_0xfac0('0x6d')]+=0x1;_0x12f606[_0xfac0('0xa6')]=0xa;_0x12f606[_0xfac0('0xa7')]='Drop';_0x12f606[_0xfac0('0x119')]='TIMEOUT';_0x12f606[_0xfac0('0x10f')]=this['voiceQueues'][_0x506122[_0xfac0('0xb5')]]['dialQueueProject2']?moment()[_0xfac0('0x7e')](_0xfac0('0x100')):undefined;_0x12f606[_0xfac0('0xf5')]+=0x1;_0x12f606[_0xfac0('0xee')]+=0x1;if(_0x12f606[_0xfac0('0xf5')]>=this['voiceQueues'][_0x506122[_0xfac0('0xb5')]][_0xfac0('0x11a')]){this[_0xfac0('0x11b')](_0x12f606);}else{this[_0xfac0('0xc1')]({'active':![],'countdropretry':_0x12f606['countdropretry'],'scheduledat':moment()[_0xfac0('0x105')](this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]][_0xfac0('0x11c')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x5dc76[_0xfac0('0x101')],'ListId':_0x5dc76[_0xfac0('0x106')],'VoiceQueueId':_0x5dc76[_0xfac0('0x102')]||undefined,'CampaignId':_0x5dc76[_0xfac0('0xd5')]||undefined})['catch'](loggerCatch(_0xfac0('0x11d')));var _0x424576=new History(_0x12f606);_0x424576[_0xfac0('0xa6')]=0xa;_0x424576[_0xfac0('0xa7')]='Drop';_0x424576['starttime']=moment()[_0xfac0('0x7e')](_0xfac0('0x100'));_0x424576[_0xfac0('0xa8')]=_0x424576[_0xfac0('0xa9')];_0x424576[_0xfac0('0x11e')]=_0x12f606[_0xfac0('0x11e')];_0x424576['calleridnum']=_0x12f606[_0xfac0('0x11f')];this['createHistory'](_0x424576)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]][_0xfac0('0x62')]+=0x1;_0x12f606[_0xfac0('0xa6')]=0xb;_0x12f606[_0xfac0('0xa7')]=_0xfac0('0x120');_0x12f606[_0xfac0('0x119')]='CALLEREXIT';_0x12f606[_0xfac0('0xf6')]+=0x1;_0x12f606[_0xfac0('0xee')]+=0x1;if(_0x12f606['countabandonedretry']>=this['voiceQueues'][_0x506122[_0xfac0('0xb5')]][_0xfac0('0x121')]){this['queueCallerAbandonCreateState'](_0x12f606);}else{this[_0xfac0('0xc1')]({'active':![],'countabandonedretry':_0x12f606['countabandonedretry'],'scheduledat':moment()[_0xfac0('0x105')](this[_0xfac0('0x20')][_0x506122[_0xfac0('0xb5')]]['dialAbandonedRetryFrequency'],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x5dc76[_0xfac0('0x101')],'ListId':_0x5dc76['ListId'],'VoiceQueueId':_0x5dc76[_0xfac0('0x102')]||undefined,'CampaignId':_0x5dc76[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x122')));var _0x424576=new History(_0x12f606);_0x424576[_0xfac0('0xa6')]=0xb;_0x424576[_0xfac0('0xa7')]=_0xfac0('0x120');_0x424576[_0xfac0('0xa9')]=moment()[_0xfac0('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x424576['endtime']=_0x424576['starttime'];_0x424576['calleridname']=_0x12f606[_0xfac0('0x11e')];_0x424576['calleridnum']=_0x12f606['calleridnum'];this[_0xfac0('0xcb')](_0x424576)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x123')));}}}}};Dialer[_0xfac0('0x1c')][_0xfac0('0x124')]=function(_0x983d02){if(this['actions'][_0x983d02[_0xfac0('0xdd')]]){this[_0xfac0('0xad')][_0x983d02[_0xfac0('0xdd')]][_0xfac0('0x125')]=_0x983d02[_0xfac0('0x125')];}if(this[_0xfac0('0xab')][_0x983d02[_0xfac0('0xdd')]]){this[_0xfac0('0xab')][_0x983d02['uniqueid']][_0xfac0('0x125')]=_0x983d02[_0xfac0('0x125')];}};Dialer[_0xfac0('0x1c')]['syncQueueMember']=function(_0x7c841e){if(strategy[this[_0xfac0('0x20')][this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]][_0xfac0('0xb5')]]['strategy']]==='roundrobin'){if(this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]]&&_['isNil'](this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]][_0xfac0('0x127')])&&_0x7c841e['status']==='1'&&_0x7c841e[_0xfac0('0x128')]==='0'){if(this[_0xfac0('0x21')][_0x7c841e[_0xfac0('0x129')]]){if(!this['agents'][_0x7c841e['stateinterface']]['locked']){this[_0xfac0('0x21')][_0x7c841e[_0xfac0('0x129')]]['locked']=!![];this[_0xfac0('0xad')][_0x7c841e['actionid']][_0xfac0('0x127')]=!![];this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]]['stateinterface']=_0x7c841e['stateinterface'];}}}}else if((strategy[this[_0xfac0('0x20')][this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]]['queue']][_0xfac0('0x4f')]]||_0xfac0('0x1b'))===_0xfac0('0x1b')){if(this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]]){if(this[_0xfac0('0x21')][_0x7c841e['stateinterface']]){this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]][_0xfac0('0x129')]=_0x7c841e['stateinterface'];if(_[_0xfac0('0xde')](this[_0xfac0('0x29')][this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]]['queue']])){this['queueBooked'][this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]]['queue']]=[];}this[_0xfac0('0x29')][this['actions'][_0x7c841e['actionid']]['queue']][_0xfac0('0x12a')](_['merge'](_[_0xfac0('0xd3')](this[_0xfac0('0xad')][_0x7c841e[_0xfac0('0x126')]],['idHopper',_0xfac0('0x129')]),{'status':_0x7c841e[_0xfac0('0xb1')],'paused':_0x7c841e[_0xfac0('0x128')]}));}}}};function unlockQueueStatus(_0x5866a0,_0x327c3f){setTimeout(function(){if(_[_0xfac0('0x3f')](_0x5866a0['queueStatusComplete'])){loggerBooked['error'](_0xfac0('0x12b'),_0x327c3f);}_0x5866a0[_0xfac0('0x12c')]=!![];loggerBooked[_0xfac0('0x81')](_0xfac0('0x12d'),_0x327c3f,JSON[_0xfac0('0x7a')](_[_0xfac0('0xd3')](_0x5866a0,[_0xfac0('0x44'),'queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0xfac0('0x3c')]=function(_0x2a7e6b){var _0x32063e=this;var _0x17854b=_0x32063e[_0xfac0('0x20')][_0x32063e['actions'][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]];if(strategy[this['voiceQueues'][this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]['strategy']]===_0xfac0('0x12e')){if(this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]]&&this['actions'][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0x129')]){this[_0xfac0('0x1f')][_0xfac0('0x12f')](this['actions'][_0x2a7e6b[_0xfac0('0x126')]]['idHopper'],this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]]['stateinterface'])['catch'](function(_0x326ae1){logger[_0xfac0('0x94')](_0xfac0('0x130'),util['inspect'](_0x326ae1,{'showHidden':![],'depth':null}));})[_0xfac0('0x1e')](function(){_0x32063e[_0xfac0('0xb3')](_0x32063e['voiceQueues'][_0x32063e[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]);_0x32063e[_0xfac0('0x21')][_0x32063e[_0xfac0('0xad')][_0x2a7e6b['actionid']]['stateinterface']][_0xfac0('0x127')]=![];delete _0x32063e[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]];unlockQueueStatus(_0x17854b);});}else{this['updateOriginated'](this[_0xfac0('0x20')][this['actions'][_0x2a7e6b['actionid']][_0xfac0('0xb5')]]);this[_0xfac0('0xc1')]({'active':![],'ContactId':this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]]['ContactId'],'ListId':this['actions'][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0x106')],'VoiceQueueId':this['actions'][_0x2a7e6b['actionid']][_0xfac0('0x102')]||undefined,'CampaignId':this[_0xfac0('0xad')][_0x2a7e6b['actionid']][_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x2a7e6b[_0xfac0('0x126')]];unlockQueueStatus(_0x17854b);}}else if((strategy[this['voiceQueues'][this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]['strategy']]||_0xfac0('0x1b'))===_0xfac0('0x1b')){var _0x50e7ca;if(this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]]&&!_[_0xfac0('0x47')](this[_0xfac0('0x29')][this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]]['queue']])){if(this[_0xfac0('0x2a')][_0x32063e[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]){this[_0xfac0('0x2a')][_0x32063e[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]=this[_0xfac0('0x2a')][this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]?this['queueBookedRR'][this[_0xfac0('0xad')][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]:this[_0xfac0('0x29')][this['actions'][_0x2a7e6b[_0xfac0('0x126')]]['queue']]?this[_0xfac0('0x29')][this['actions'][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]][_0xfac0('0x131')]||0x0:0x0;}this[_0xfac0('0x29')][this['actions'][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]]['_rr']=this[_0xfac0('0x2a')][this['actions'][_0x2a7e6b[_0xfac0('0x126')]][_0xfac0('0xb5')]];for(var _0x258bd8=0x0;_0x258bd8=0x0;})[_0xfac0('0xba')](myreject(_0x220cb0)));}}else{_0x3bf518[_0xfac0('0x12a')](ami['Action']({'action':_0xfac0('0x148'),'command':util[_0xfac0('0x7e')](_0xfac0('0x149'),_0x534d0d,!_['isUndefined'](config[_0xfac0('0x145')][_0x43ee8a])?_0x43ee8a:'')})[_0xfac0('0xb8')](function(_0x591bd1){return _0x591bd1[_0xfac0('0x14b')]['indexOf'](_0xfac0('0x14d'))>=0x0;})[_0xfac0('0xba')](myreject(_0x220cb0)));}BPromise['all'](_0x3bf518)['then'](function(_0x43656f){var _0x2edffc=_[_0xfac0('0x14e')](_0x43656f);if(_0x2edffc){return _0x1e3b44(_0x2edffc);}else{_0x3c310d['message']=_0x272dd1?_0xfac0('0x14f'):_0xfac0('0x150');return _0x220cb0(msgResponse(_0xfac0('0x151'),_0xfac0('0x143'),_0xfac0('0x152')+_0x272dd1+'\x20'+_0x1c0f5d+_0xfac0('0x153')+util[_0xfac0('0x95')](_0x534d0d,{'showHidden':![],'depth':null})+_0xfac0('0x154')+_0x43ee8a));}})[_0xfac0('0xba')](function(_0x55fbe6){return _0x220cb0(msgResponse(_0xfac0('0x142'),'Failure',JSON[_0xfac0('0x7a')](_0x55fbe6)));});});};Dialer[_0xfac0('0x1c')][_0xfac0('0x155')]=function(_0x1cc16c){var _0x4b3f66=this;return function(){switch(_0x1cc16c[_0xfac0('0x156')]){case'progressive':freeVariablesPredictive(_0x1cc16c);_0x4b3f66['handlePower'](_0x1cc16c,0x1);break;case _0xfac0('0x157'):freeVariablesPredictive(_0x1cc16c);_0x4b3f66[_0xfac0('0x158')](_0x1cc16c,_0x1cc16c[_0xfac0('0x159')]);break;case'predictive':_0x4b3f66[_0xfac0('0x9')](_0x1cc16c);break;case _0xfac0('0x8'):freeVariablesPredictive(_0x1cc16c);_0x4b3f66[_0xfac0('0x158')](_0x1cc16c,0x1);break;default:freeVariablesPredictive(_0x1cc16c);logger[_0xfac0('0x94')](_0xfac0('0x15a'),_0x1cc16c[_0xfac0('0x44')],_0xfac0('0x15b'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x4729c1){var _0x4414a6=this;return function(){_0x4414a6[_0xfac0('0x15c')](_0x4729c1);};};Dialer[_0xfac0('0x1c')]['syncQueueSummary']=function(_0x30450b){var _0x4a22d1=this;if(isNotPreview(_0x30450b[_0xfac0('0x156')])){if(isVoiceQueueOutbound(_0x30450b['type'])&&isActive(_0x30450b['dialActive'])){_0x30450b['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xfac0('0xb8')](checkIsLoggedIn(_0x30450b,_0x30450b[_0xfac0('0x51')]))['then'](checkIsActive(_0x30450b,_0x30450b[_0xfac0('0x59')]))[_0xfac0('0xb8')](checkInterval(_0x30450b))[_0xfac0('0xb8')](_0x4a22d1[_0xfac0('0x13f')](_0x30450b))['then'](_0x4a22d1[_0xfac0('0x15d')](_0x30450b[_0xfac0('0x15e')],_0x30450b[_0xfac0('0x15f')],_0x30450b[_0xfac0('0x44')],_0x30450b))['then'](_0x4a22d1['checkIfTimeIntervals'](_0x30450b[_0xfac0('0x42')],_0x30450b['dialTimezone'],_0x30450b[_0xfac0('0x44')],_0x30450b))[_0xfac0('0xb8')](_0x4a22d1['checkDialMethod'](_0x30450b))[_0xfac0('0xba')](loggerCatchQueueSummary('[syncQueueSummary]',_0x30450b));}else{notSendMessagesQueue(_0x30450b);}}else{freeVariablesPredictive(_0x30450b);}};Dialer[_0xfac0('0x1c')][_0xfac0('0x13e')]=function(){var _0x4a9bc9=this;var _0x2c2e39;for(var _0x921d5e in this['campaigns']){if(typeof this[_0xfac0('0xb6')][_0x921d5e]!=='undefined'){_0x2c2e39=this['campaigns'][_0x921d5e];if(isCampaignIvr(_0x2c2e39[_0xfac0('0x4d')])&&isActive(_0x2c2e39['active'])){_0x2c2e39[_0xfac0('0x9e')]=!![];BPromise[_0xfac0('0xbf')]()[_0xfac0('0xb8')](checkIsActive(_0x2c2e39,_0x2c2e39[_0xfac0('0x78')]))['then'](checkInterval(_0x2c2e39))['then'](_0x4a9bc9[_0xfac0('0x13f')](_0x2c2e39))[_0xfac0('0xb8')](_0x4a9bc9[_0xfac0('0x15d')](_0x2c2e39[_0xfac0('0x15e')],_0x2c2e39[_0xfac0('0x15f')],_0x2c2e39[_0xfac0('0x44')],_0x2c2e39))[_0xfac0('0xb8')](_0x4a9bc9[_0xfac0('0x160')](_0x2c2e39[_0xfac0('0x42')],_0x2c2e39[_0xfac0('0x15f')],_0x2c2e39[_0xfac0('0x44')],_0x2c2e39))[_0xfac0('0xb8')](_0x4a9bc9['launchHandleIvr'](_0x2c2e39))['catch'](loggerCatchQueueSummary(_0xfac0('0x161'),_0x2c2e39));}else{notSendMessagesCampaign(_0x2c2e39);}}}};function getCallerIdRandom(_0x50504e,_0x37cac6){var _0x5573b8;var _0xf32476;var _0x100d3f;if(_0x37cac6<=0x0){_0x37cac6=0x1;}_0x5573b8=new RegExp(_0xfac0('0x162')+_0x37cac6+'}$');_0xf32476=Math[_0xfac0('0x163')](0xa,_0x37cac6-0x1);_0x100d3f=Math[_0xfac0('0x163')](0xa,_0x37cac6)-0x1;return util['format']('%s',_[_0xfac0('0x164')](_0x50504e,_0x5573b8,_['random'](_0xf32476,_0x100d3f)));}function extractCalleridName(_0x242f83){var _0x11c008=_0x242f83[_0xfac0('0x165')](/"(.*?)"/);return _0x11c008?_0x11c008[0x1]:_0x242f83;}function extractCalleridNumber(_0x38a193){var _0x201042=_0x38a193[_0xfac0('0x165')](/<(.*?)>/);return _0x201042?_0x201042[0x1]:_0x38a193;}Dialer[_0xfac0('0x1c')]['actionOriginate']=function(_0x58c012,_0x316bdb){var _0x2e332c=this;var _0x395c70=uuid['v4']();this[_0xfac0('0xad')][_0x395c70]=new Action(_0x58c012,_0x316bdb,_0x395c70);return new BPromise(function(_0x1b9b02,_0x506586){if(_[_0xfac0('0x3f')](_0x58c012)&&typeof _0x58c012!==_0xfac0('0x166')){return _0x506586(msgResponse(_0xfac0('0x167'),_0xfac0('0x143'),'voiceQueue\x20is\x20undefine'));}if(_[_0xfac0('0x3f')](_0x316bdb[_0xfac0('0x168')][_0xfac0('0x169')])||_0x316bdb[_0xfac0('0x168')]['phone']===null){return _0x506586(msgResponse(_0xfac0('0x167'),'Failure',_0xfac0('0x16a')));}var _0x44cee0={'XMD-CALLERID':_0x2e332c[_0xfac0('0xad')][_0x395c70][_0xfac0('0x16b')](),'XMD-AGI':_0x58c012['dialQueueProject']?util[_0xfac0('0x7e')](_0xfac0('0x16c'),ipAgi,_0x58c012['dialQueueProject']):_0xfac0('0x16d'),'XMD-AGIAFTER':_0x58c012[_0xfac0('0x110')]?util['format'](_0xfac0('0x16c'),ipAgi,_0x58c012[_0xfac0('0x110')]):_0xfac0('0x16d'),'XMD-QUEUE':_0x58c012['type']==='outbound'?util[_0xfac0('0x7e')](_0xfac0('0x16e'),_0x58c012['name'],_0x58c012[_0xfac0('0x16f')]||'',_0x58c012[_0xfac0('0x111')]?'c':'',_0x58c012[_0xfac0('0x118')]||0x3):_0xfac0('0x16d'),'XMD-CONTACTID':_0x316bdb[_0xfac0('0x101')],'XMD-CDRTYPE':_0xfac0('0x6'),'CALLERID(all)':_0x2e332c[_0xfac0('0xad')][_0x395c70]['getCaller'](),'XMD-AMD':_0x58c012[_0xfac0('0xe3')]?_0xfac0('0x170'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x58c012['dialAMDActive']){_0x44cee0[_0xfac0('0x171')]=_0x58c012[_0xfac0('0x172')]||0x9c4;_0x44cee0[_0xfac0('0x173')]=_0x58c012[_0xfac0('0x174')]||0x5dc;_0x44cee0[_0xfac0('0x175')]=_0x58c012['dialAMDAfterGreetingSilence']||0x320;_0x44cee0['XMD-AMDTOTALANALYSISTIME']=_0x58c012['dialAMDTotalAnalysisTime']||0x1388;_0x44cee0[_0xfac0('0x176')]=_0x58c012['dialAMDMinWordLength']||0x64;_0x44cee0['XMD-AMDBETWEENWORDSSILENCE']=_0x58c012[_0xfac0('0x177')]||0x32;_0x44cee0[_0xfac0('0x178')]=_0x58c012[_0xfac0('0x179')]||0x3;_0x44cee0[_0xfac0('0x17a')]=_0x58c012[_0xfac0('0x17b')]||0x100;_0x44cee0[_0xfac0('0x17c')]=_0x58c012[_0xfac0('0x17d')]||0x1388;}if(_0x58c012[_0xfac0('0x4d')]===_0xfac0('0x4e')){_0x44cee0[_0xfac0('0x17e')]=_0x316bdb[_0xfac0('0x102')];}else{_0x44cee0['XMD-CAMPAIGNID']=_0x316bdb[_0xfac0('0xd5')];}for(var _0x1a18b7 in _0x316bdb[_0xfac0('0x168')]){if(typeof _0x316bdb['Contact'][_0x1a18b7]!==_0xfac0('0x96')){if(isNotNull(_0x316bdb[_0xfac0('0x168')][_0x1a18b7])&&_0x1a18b7!=='id'&&_0x1a18b7!==_0xfac0('0x17f')&&_0x1a18b7!==_0xfac0('0x180')&&_0x1a18b7!=='updatedAt'){_0x44cee0[util[_0xfac0('0x7e')](_0xfac0('0x181'),_0xfac0('0x182'),_[_0xfac0('0x183')](_0x1a18b7))]=_0x316bdb['Contact'][_0x1a18b7];}}}var _0x36a3a4=_0x2e332c['isTrunkReachable'](_0x58c012[_0xfac0('0x77')])?getCallerId(_0x58c012['Trunk']['callerid'],_0x58c012['dialOriginateCallerIdName'],_0x58c012[_0xfac0('0x184')]>0x0?getCallerIdRandom(_0x58c012['dialOriginateCallerIdNumber'],_0x58c012['dialRandomLastDigitCallerIdNumber']):_0x58c012[_0xfac0('0x5b')]):getCallerId(_[_0xfac0('0xde')](_0x58c012[_0xfac0('0x140')])?_0x58c012[_0xfac0('0x77')][_0xfac0('0x79')]:_0x58c012['TrunkBackup'][_0xfac0('0x79')],_0x58c012[_0xfac0('0x5a')],_0x58c012[_0xfac0('0x184')]>0x0?getCallerIdRandom(_0x58c012[_0xfac0('0x5b')],_0x58c012[_0xfac0('0x184')]):_0x58c012[_0xfac0('0x5b')]);if(_0x36a3a4){_0x44cee0[_0xfac0('0x185')]=_0x2e332c[_0xfac0('0xad')][_0x395c70][_0xfac0('0x186')]=extractCalleridName(_0x36a3a4);_0x44cee0[_0xfac0('0x187')]=_0x2e332c[_0xfac0('0xad')][_0x395c70][_0xfac0('0x188')]=extractCalleridNumber(_0x36a3a4);}return ami[_0xfac0('0xb0')]({'actionid':_0x395c70,'action':_0xfac0('0x167'),'channel':_0x2e332c['isTrunkReachable'](_0x58c012['Trunk'])?util[_0xfac0('0x7e')](_0xfac0('0x189'),_0x58c012['Trunk'][_0xfac0('0x44')],isNotNull(_0x58c012[_0xfac0('0x5c')])?_0x58c012['dialPrefix']['trim']()||'':'',_0x58c012[_0xfac0('0x18a')]>0x0?_0x316bdb[_0xfac0('0x168')][_0xfac0('0x169')]['substring'](_0x58c012[_0xfac0('0x18a')]):_0x316bdb[_0xfac0('0x168')][_0xfac0('0x169')]):util[_0xfac0('0x7e')](_0xfac0('0x189'),_[_0xfac0('0xde')](_0x58c012[_0xfac0('0x140')])?_0x58c012[_0xfac0('0x77')][_0xfac0('0x44')]:_0x58c012[_0xfac0('0x140')][_0xfac0('0x44')],isNotNull(_0x58c012['dialPrefix'])?_0x58c012[_0xfac0('0x5c')]['trim']()||'':'',_0x58c012[_0xfac0('0x18a')]>0x0?_0x316bdb[_0xfac0('0x168')][_0xfac0('0x169')]['substring'](_0x58c012[_0xfac0('0x18a')]):_0x316bdb[_0xfac0('0x168')][_0xfac0('0x169')]),'callerid':_0x36a3a4,'Exten':_0xfac0('0xe2'),'Context':'from-sip','Priority':'1','variable':_0x44cee0,'timeout':(_0x58c012[_0xfac0('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x395c70})[_0xfac0('0xb8')](function(_0x43754e){return _0x1b9b02(_0x43754e);})[_0xfac0('0xba')](function(_0x36cce4){_0x58c012[_0xfac0('0x18c')]+=0x1;var _0x1415ff=new History(_0x2e332c[_0xfac0('0xad')][_0x395c70]);logger['error'](util[_0xfac0('0x7e')](_0xfac0('0x18d'),JSON[_0xfac0('0x7a')](_0x36cce4)));_0x1415ff[_0xfac0('0xa6')]=0xe;_0x1415ff[_0xfac0('0xa7')]='OriginateError';_0x1415ff['starttime']=moment()[_0xfac0('0x7e')](_0xfac0('0x100'));_0x1415ff[_0xfac0('0xa8')]=_0x1415ff['starttime'];_0x2e332c['createHistory'](_0x1415ff)['catch'](loggerCatch(_0xfac0('0x18e')));_0x2e332c[_0xfac0('0xc9')](_0x1415ff)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x18e')))[_0xfac0('0x1e')](function(){delete _0x2e332c['actions'][_0x395c70];return _0x506586(msgResponse(_0xfac0('0x167'),_0xfac0('0x48'),_0xfac0('0x18f')));});});});};Dialer[_0xfac0('0x1c')][_0xfac0('0x31')]=function(_0x247c0c){var _0x39ce79=this[_0xfac0('0xad')][_0x247c0c[_0xfac0('0x126')]];if(_0x39ce79){delete this[_0xfac0('0xad')][_0x247c0c[_0xfac0('0x126')]];_0x39ce79[_0xfac0('0x117')]=moment()[_0xfac0('0x7e')](_0xfac0('0x100'));var _0x53a60f=_0x39ce79[_0xfac0('0x4d')]==='ivr'?this['campaigns'][_0x39ce79[_0xfac0('0xb5')]]:this[_0xfac0('0x20')][_0x39ce79['getQueue']()];if(!this['isSuccess'](_0x247c0c[_0xfac0('0x190')])){this[_0xfac0('0xb3')](_0x53a60f);return this[_0xfac0('0x191')](_0x39ce79,_0x53a60f,_0x247c0c)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x192')));}this[_0xfac0('0xab')][_0x247c0c[_0xfac0('0xdd')]]=_0x39ce79;}};Dialer[_0xfac0('0x1c')]['checkRetriveMax']=function(_0x27f775,_0x1c573b,_0x4950e4){var _0x33a53a=new History(_0x1c573b);if(_0x33a53a[_0xfac0('0xf1')]+_0x33a53a[_0xfac0('0xf2')]+_0x33a53a[_0xfac0('0xf3')]+_0x33a53a[_0xfac0('0xf4')]+_0x33a53a[_0xfac0('0xf5')]+_0x33a53a[_0xfac0('0xf6')]+_0x33a53a[_0xfac0('0xed')]+_0x33a53a[_0xfac0('0xf7')]>=_0x4950e4[_0xfac0('0xf8')]-0x1){return!![];}switch(_0x27f775){case 0x3:if(_0x33a53a[_0xfac0('0xf3')]>=_0x4950e4['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xfac0('0xc1')]({'active':![],'countnoanswerretry':_0x33a53a['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xfac0('0x105')](_0x4950e4[_0xfac0('0x193')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x194')));break;case 0x5:if(_0x33a53a[_0xfac0('0xf1')]>=_0x4950e4['dialBusyMaxRetry']-0x1){return!![];}this[_0xfac0('0xc1')]({'active':![],'countbusyretry':_0x33a53a[_0xfac0('0xf1')]+=0x1,'scheduledat':moment()[_0xfac0('0x105')](_0x4950e4[_0xfac0('0x195')],'minutes')[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})['catch'](loggerCatch(_0xfac0('0x196')));break;case 0x8:if(_0x33a53a[_0xfac0('0xf2')]>=_0x4950e4['dialCongestionMaxRetry']-0x1){return!![];}this[_0xfac0('0xc1')]({'active':![],'countcongestionretry':_0x33a53a['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x4950e4[_0xfac0('0x197')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x33a53a[_0xfac0('0xf4')]>=_0x4950e4[_0xfac0('0x198')]-0x1){return!![];}else{this[_0xfac0('0xc1')]({'active':![],'countnosuchnumberretry':_0x33a53a[_0xfac0('0xf4')]+=0x1,'scheduledat':moment()[_0xfac0('0x105')](_0x4950e4['dialNoSuchNumberRetryFrequency'],_0xfac0('0xff'))['format'](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x199')));}break;case 0xa:if(_0x33a53a[_0xfac0('0xf5')]>=_0x4950e4[_0xfac0('0x11a')]-0x1){return!![];}this[_0xfac0('0xc1')]({'active':![],'countdropretry':_0x33a53a[_0xfac0('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x4950e4['dialDropRetryFrequency'],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a['ListId'],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x11d')));break;case 0xb:if(_0x33a53a[_0xfac0('0xf6')]>=_0x4950e4[_0xfac0('0x121')]-0x1){return!![];}this[_0xfac0('0xc1')]({'active':![],'countabandonedretry':_0x33a53a[_0xfac0('0xf6')]+=0x1,'scheduledat':moment()[_0xfac0('0x105')](_0x4950e4[_0xfac0('0x19a')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x33a53a['ContactId'],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})['catch'](loggerCatch(_0xfac0('0x122')));break;case 0x13:if(_0x33a53a[_0xfac0('0xed')]>=_0x4950e4[_0xfac0('0xfb')]-0x1){return!![];}this[_0xfac0('0xc1')]({'active':![],'countmachineretry':_0x33a53a[_0xfac0('0xed')]+=0x1,'scheduledat':moment()[_0xfac0('0x105')](_0x4950e4[_0xfac0('0xfe')],_0xfac0('0xff'))[_0xfac0('0x7e')](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a[_0xfac0('0x102')]||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})['catch'](loggerCatch(_0xfac0('0x107')));break;case 0x14:if(_0x33a53a[_0xfac0('0xf7')]>=_0x4950e4[_0xfac0('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x33a53a[_0xfac0('0xf7')]+=0x1,'scheduledat':moment()[_0xfac0('0x105')](_0x4950e4[_0xfac0('0x19c')],_0xfac0('0xff'))['format'](_0xfac0('0x100')),'ContactId':_0x33a53a[_0xfac0('0x101')],'ListId':_0x33a53a[_0xfac0('0x106')],'VoiceQueueId':_0x33a53a['VoiceQueueId']||undefined,'CampaignId':_0x33a53a[_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x19d')));break;default:return!![];}};Dialer['prototype'][_0xfac0('0x191')]=function(_0x5bf90f,_0x7d4cfc,_0x556bf9){var _0x43c61e=this;var _0x1a265d=new History(_0x5bf90f);return new BPromise(function(_0x52f54a,_0x3f4325){if(_[_0xfac0('0x3f')](_0x7d4cfc)&&typeof _0x7d4cfc!==_0xfac0('0x166')){return _0x3f4325(msgResponse(_0xfac0('0x19e'),_0xfac0('0x143'),_0xfac0('0x19f')));}if(_[_0xfac0('0x3f')](_0x556bf9)&&typeof _0x556bf9!==_0xfac0('0x166')){return _0x3f4325(msgResponse(_0xfac0('0x19e'),'Failure','evt\x20is\x20undefine'));}switch(_0x556bf9[_0xfac0('0x1a0')]){case'0':_0x7d4cfc[_0xfac0('0x65')]+=0x1;_0x1a265d['state']=0x0;_0x1a265d[_0xfac0('0xa7')]=_0xfac0('0x1a1');_0x1a265d[_0xfac0('0xf4')]+=0x1;_0x1a265d['countglobal']+=0x1;ami['emit'](_0xfac0('0x1a2'),ut[_0xfac0('0x1a3')](_0x5bf90f,_0xfac0('0x1a4')));_0x43c61e[_0xfac0('0xcb')](_0x1a265d)[_0xfac0('0xba')](loggerCatch(_0xfac0('0xf0')));if(_0x43c61e[_0xfac0('0x1a5')](0x0,_0x5bf90f,_0x7d4cfc)){if(_0x1a265d[_0xfac0('0xf4')]>=_0x7d4cfc[_0xfac0('0x198')]){_0x43c61e[_0xfac0('0xfc')](_0x1a265d,_0x52f54a,_0x3f4325,'reason\x200\x20no\x20such\x20number....');}else{_0x43c61e['stateGlobal'](_0x1a265d,_0x52f54a,_0x3f4325,_0xfac0('0x1a6'));}}break;case'3':_0x7d4cfc[_0xfac0('0x64')]+=0x1;_0x1a265d[_0xfac0('0xa6')]=0x3;_0x1a265d[_0xfac0('0xa7')]=_0xfac0('0x1a7');_0x1a265d[_0xfac0('0xf3')]+=0x1;_0x1a265d[_0xfac0('0xee')]+=0x1;ami['emit'](_0xfac0('0x1a8'),ut['buildObj'](_0x5bf90f,_0xfac0('0x1a9')));_0x43c61e['createHistory'](_0x1a265d)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x1aa')));if(_0x43c61e[_0xfac0('0x1a5')](0x3,_0x5bf90f,_0x7d4cfc)){if(_0x1a265d[_0xfac0('0xf3')]>=_0x7d4cfc[_0xfac0('0x1ab')]){_0x43c61e[_0xfac0('0xfc')](_0x1a265d,_0x52f54a,_0x3f4325,'reason\x203\x20ringing\x20no\x20answer');}else{_0x43c61e['stateGlobal'](_0x1a265d,_0x52f54a,_0x3f4325,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x7d4cfc['outboundBusyCallsDay']+=0x1;_0x1a265d[_0xfac0('0xa6')]=0x5;_0x1a265d[_0xfac0('0xa7')]='Busy';_0x1a265d[_0xfac0('0xf1')]+=0x1;_0x1a265d[_0xfac0('0xee')]+=0x1;ami[_0xfac0('0x4c')](_0xfac0('0x1ac'),ut[_0xfac0('0x1a3')](_0x5bf90f,_0xfac0('0x1ad')));_0x43c61e[_0xfac0('0xcb')](_0x1a265d)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x1ae')));if(_0x43c61e[_0xfac0('0x1a5')](0x5,_0x5bf90f,_0x7d4cfc)){if(_0x1a265d[_0xfac0('0xf1')]>=_0x7d4cfc[_0xfac0('0x1af')]){_0x43c61e['createStateFinal'](_0x1a265d,_0x52f54a,_0x3f4325,'reason\x205\x20busy');}else{_0x43c61e[_0xfac0('0xf9')](_0x1a265d,_0x52f54a,_0x3f4325,'reason\x205\x20busy');}}break;case'8':_0x7d4cfc[_0xfac0('0x60')]+=0x1;_0x1a265d['state']=0x8;_0x1a265d['statedesc']=_0xfac0('0x1b0');_0x1a265d[_0xfac0('0xf2')]+=0x1;_0x1a265d[_0xfac0('0xee')]+=0x1;ami[_0xfac0('0x4c')](_0xfac0('0x1b1'),ut[_0xfac0('0x1a3')](_0x5bf90f,'congestion'));_0x43c61e[_0xfac0('0xcb')](_0x1a265d)['catch'](loggerCatch(_0xfac0('0x1b2')));if(_0x43c61e[_0xfac0('0x1a5')](0x8,_0x5bf90f,_0x7d4cfc)){if(_0x1a265d['countcongestionretry']>=_0x7d4cfc[_0xfac0('0x1b3')]){_0x43c61e[_0xfac0('0xfc')](_0x1a265d,_0x52f54a,_0x3f4325,_0xfac0('0x1b4'));}else{_0x43c61e[_0xfac0('0xf9')](_0x1a265d,_0x52f54a,_0x3f4325,_0xfac0('0x1b4'));}}break;case'11':_0x7d4cfc[_0xfac0('0x1b5')]+=0x1;_0x1a265d[_0xfac0('0xa6')]=0xb;_0x1a265d[_0xfac0('0xa7')]='Abandoned';_0x1a265d[_0xfac0('0xf6')]+=0x1;_0x1a265d[_0xfac0('0xee')]+=0x1;_0x43c61e[_0xfac0('0xcb')](_0x1a265d)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x123')));if(_0x43c61e[_0xfac0('0x1a5')](0xb,_0x5bf90f,_0x7d4cfc)){if(_0x1a265d[_0xfac0('0xf6')]>=_0x7d4cfc[_0xfac0('0x121')]){_0x43c61e[_0xfac0('0xfc')](_0x1a265d,_0x52f54a,_0x3f4325,_0xfac0('0x1b6'));}else{_0x43c61e[_0xfac0('0xf9')](_0x1a265d,_0x52f54a,_0x3f4325,'reason\x2011\x20abandoned');}}break;case'20':_0x7d4cfc[_0xfac0('0x67')]+=0x1;_0x1a265d['state']=0x14;_0x1a265d[_0xfac0('0xa7')]=_0xfac0('0x1b7');_0x1a265d[_0xfac0('0xf7')]+=0x1;_0x1a265d[_0xfac0('0xee')]+=0x1;ami[_0xfac0('0x4c')]('custom:agentreject',ut[_0xfac0('0x1a3')](_0x5bf90f,_0xfac0('0x1b8')));_0x43c61e['createHistory'](_0x1a265d)[_0xfac0('0xba')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x43c61e[_0xfac0('0x1a5')](0x14,_0x5bf90f,_0x7d4cfc)){if(_0x1a265d[_0xfac0('0xf7')]>=_0x7d4cfc[_0xfac0('0x19b')]){_0x43c61e[_0xfac0('0xfc')](_0x1a265d,_0x52f54a,_0x3f4325,_0xfac0('0x1b9'));}else{_0x43c61e[_0xfac0('0xf9')](_0x1a265d,_0x52f54a,_0x3f4325,_0xfac0('0x1b9'));}}break;default:_0x7d4cfc['outboundUnknownCallsDay']+=0x1;_0x1a265d['state']=0xc;_0x1a265d[_0xfac0('0xa7')]=_0x556bf9[_0xfac0('0x1a0')];_0x43c61e['createHistory'](_0x1a265d)[_0xfac0('0xba')](loggerCatch(_0xfac0('0x1ba')));if(_0x43c61e['checkRetriveMax'](_0x556bf9['reason'],_0x5bf90f,_0x7d4cfc)){if(_0x1a265d[_0xfac0('0xf1')]+_0x1a265d[_0xfac0('0xf2')]+_0x1a265d[_0xfac0('0xf3')]+_0x1a265d['countnosuchnumberretry']+_0x1a265d[_0xfac0('0xf5')]+_0x1a265d[_0xfac0('0xf6')]+_0x1a265d['countmachineretry']+_0x1a265d[_0xfac0('0xf7')]>=_0x7d4cfc['dialGlobalMaxRetry']){_0x43c61e[_0xfac0('0xf9')](_0x1a265d,_0x52f54a,_0x3f4325,_0x556bf9[_0xfac0('0x1a0')]);}else{_0x43c61e[_0xfac0('0xfc')](_0x1a265d,_0x52f54a,_0x3f4325,_0x556bf9[_0xfac0('0x1a0')]);}}}});};Dialer[_0xfac0('0x1c')]['stateGlobal']=function(_0x914ff2,_0x2f3a87,_0x1e16e0,_0x4eee82){var _0x5ae8c8=new Final(_0x914ff2);_0x5ae8c8[_0xfac0('0xa6')]=0xf;_0x5ae8c8[_0xfac0('0xa7')]=_0xfac0('0x1bb');this[_0xfac0('0xfc')](_0x5ae8c8,_0x2f3a87,_0x1e16e0,_0x4eee82);};Dialer['prototype'][_0xfac0('0xfc')]=function(_0x1c6d23,_0x53fc73,_0x104779,_0x578152){this[_0xfac0('0xc9')](_0x1c6d23)['then'](function(){return _0x53fc73(msgResponse('[callProgressDetecting]',_0xfac0('0xd8'),_0x578152));})['catch'](function(){return _0x104779(msgResponse(_0xfac0('0x1bc'),_0xfac0('0x143'),_0xfac0('0x1bd')));});};Dialer[_0xfac0('0x1c')]['predictive']=function(_0x4d1734){var _0xd07183=_0x4d1734[_0xfac0('0x1be')]/0x64;var _0x795660=_0x4d1734['outboundDropCallsDayTimeout']/(_0x4d1734[_0xfac0('0x63')]+_0x4d1734[_0xfac0('0x5d')]);var _0x53467f=Math['round'](_0x4d1734[_0xfac0('0x71')]*(_0x4d1734[_0xfac0('0x1bf')]/0x64));var _0x2ea456=Math[_0xfac0('0x1c0')](_0x4d1734['predictiveIntervalAvailable']*(_0x4d1734[_0xfac0('0x1c1')]/0x64));var _0x5b8bc9=_0x4d1734[_0xfac0('0x1c2')]+_0x4d1734[_0xfac0('0x55')];var _0x5f15f2=Math[_0xfac0('0x1c3')](_0x4d1734[_0xfac0('0x74')]*_0x4d1734[_0xfac0('0x76')]*_0x4d1734[_0xfac0('0x6e')]*_0x4d1734['predictiveIntervalMultiplicativeFactor']);if(_[_0xfac0('0x3f')](_0x4d1734[_0xfac0('0x27')])){if(!_['isUndefined'](_0x4d1734['startPredictive'])){_0x4d1734[_0xfac0('0x26')]=undefined;loggerPredictive[_0xfac0('0x94')](_0xfac0('0x1c4'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4d1734[_0xfac0('0x8f')])){loggerPredictive['error'](_0xfac0('0x1c4'),_0xfac0('0x1c5'));clearInterval(_0x4d1734[_0xfac0('0x8f')]);_0x4d1734[_0xfac0('0x8f')]=undefined;}_0x4d1734[_0xfac0('0x27')]=moment()[_0xfac0('0x7e')](_0xfac0('0x100'));loggerPredictive[_0xfac0('0x81')](_0x4d1734[_0xfac0('0x44')],_0xfac0('0x1c6'),_0x4d1734[_0xfac0('0x27')]);this[_0xfac0('0x158')](_0x4d1734,0x1);}else if(ifInterval(_0x4d1734['dialPredictiveInterval'],_0x4d1734[_0xfac0('0x27')])){this['handlePower'](_0x4d1734,0x1);loggerPredictiveCalls['info'](_0xfac0('0x1c7'),_0x4d1734[_0xfac0('0x27')],_0x4d1734['name']);_0x4d1734[_0xfac0('0x74')]=0x0;_0x4d1734['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xd07183<_0x795660&&_0x4d1734[_0xfac0('0x1c8')]===_0xfac0('0x1c9')){freeVariablesPredictive(_0x4d1734);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x1ca'),'Dropped\x20calls\x20day',_0x795660,'startProgressive',_0x4d1734['name']);}else if(_0x5f15f2<_0x4d1734['predictiveIntervalErlangCallsDroppedCalls']&&_0x4d1734[_0xfac0('0x1c8')]===_0xfac0('0x1c9')){freeVariablesPredictive(_0x4d1734);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x1cb'),'Max\x20Drop\x20',_0x5f15f2,_0xfac0('0x1cc'),_0x4d1734[_0xfac0('0x6d')],_0xfac0('0x27'),_0x4d1734[_0xfac0('0x44')]);}else if(!ifInterval(_0x4d1734['dialPredictiveInterval'],_0x4d1734[_0xfac0('0x27')])&&_[_0xfac0('0x3f')](_0x4d1734[_0xfac0('0x26')])&&!_[_0xfac0('0x3f')](_0x4d1734[_0xfac0('0x27')])){_0x4d1734[_0xfac0('0x26')]=moment()[_0xfac0('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfac0('0x81')](_0x4d1734[_0xfac0('0x44')],'started\x20in\x20predictive\x20at',_0x4d1734[_0xfac0('0x26')]);this[_0xfac0('0x1cd')](_0x4d1734[_0xfac0('0x1ce')])['then'](this[_0xfac0('0x1cf')](_0x4d1734))[_0xfac0('0xb8')](mergeDataErlangB(_0x4d1734))[_0xfac0('0xb8')](this[_0xfac0('0x1d0')](_0x4d1734))['catch'](loggerCatchPredictive(_0xfac0('0x1d1'),_0x4d1734));}else if(!ifInterval(_0x4d1734['dialPredictiveInterval'],_0x4d1734[_0xfac0('0x26')])){_0x4d1734[_0xfac0('0x6d')]=0x0;_0x4d1734[_0xfac0('0x26')]=moment()[_0xfac0('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfac0('0x81')](_0x4d1734[_0xfac0('0x44')],_0xfac0('0x1d2'),_0x4d1734[_0xfac0('0x26')]);clearInterval(_0x4d1734[_0xfac0('0x8f')]);_0x4d1734['handlePredictive']=undefined;this['averageHandleTime'](_0x4d1734[_0xfac0('0x1ce')])[_0xfac0('0xb8')](this[_0xfac0('0x1cf')](_0x4d1734))[_0xfac0('0xb8')](mergeDataErlangB(_0x4d1734))[_0xfac0('0xb8')](this[_0xfac0('0x1d0')](_0x4d1734))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4d1734));}else if(_0x4d1734['predictiveIntervalAvailable']&&_0x5b8bc9<_0x4d1734[_0xfac0('0x71')]-_0x2ea456){freeVariablesPredictive(_0x4d1734);loggerPredictive[_0xfac0('0x81')](_0x4d1734[_0xfac0('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5b8bc9,')\x20are\x20less\x20than\x20threshold\x20(',_0x4d1734[_0xfac0('0x71')],'-',_0x2ea456,'=',_0x4d1734[_0xfac0('0x71')]-_0x2ea456,')');}else if(_0x4d1734[_0xfac0('0x71')]&&_0x5b8bc9>_0x4d1734[_0xfac0('0x71')]+_0x53467f){freeVariablesPredictive(_0x4d1734);loggerPredictive[_0xfac0('0x81')](_0x4d1734['name'],_0xfac0('0x1d3'),_0x5b8bc9,_0xfac0('0x1d4'),_0x4d1734[_0xfac0('0x71')],'+',_0x53467f,'=',_0x4d1734['predictiveIntervalAvailable']+_0x53467f,')');}};Dialer['prototype'][_0xfac0('0x1cf')]=function(_0x9bd2e0){var _0x5e76bd=this;return function(_0xf88ab2){return new BPromise(function(_0x3f0d9e,_0x4d436f){_[_0xfac0('0xd2')](_0x9bd2e0,_0xf88ab2[0x0]);if(checkGetDataPredictive(_0xf88ab2[0x0])){var _0x106b0f=_0x9bd2e0[_0xfac0('0x71')]=_0x9bd2e0[_0xfac0('0x55')]+_0x9bd2e0['available'];var _0x3cbeff=_0x9bd2e0['dialPredictiveInterval']*0x3c;var _0x31e3ed=_0xf88ab2[0x0][_0xfac0('0x87')]+_0xf88ab2[0x0]['predictiveIntervalAvgHoldtime'];var _0x250236=(_0xf88ab2[0x0][_0xfac0('0x68')]+_0xf88ab2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xf88ab2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf88ab2[0x0][_0xfac0('0x72')];_0x9bd2e0[_0xfac0('0x6e')]=_0x250236>0x0?_0x250236:0x1;switch(_0x9bd2e0['dialPredictiveOptimization']){case _0xfac0('0x1c9'):var _0x281633=_0x9bd2e0[_0xfac0('0x1be')]/0x64;return _0x5e76bd[_0xfac0('0x1d5')](_0x106b0f,_0x3cbeff,_0x31e3ed,_0x250236,_0x281633)[_0xfac0('0xb8')](function(_0x59b23c){return _0x3f0d9e(_0x59b23c);});case'agentBusyFactor':var _0x2e69bd=_0x9bd2e0[_0xfac0('0x1be')]/0x64;return _0x5e76bd[_0xfac0('0x1d6')](_0x106b0f,_0x3cbeff,_0x31e3ed,_0x250236,_0x2e69bd)[_0xfac0('0xb8')](function(_0x1ccaaf){return _0x3f0d9e(_0x1ccaaf);});default:return _0x4d436f(msgResponse(_0xfac0('0x1d7'),'Failure',_0xfac0('0x1d8')));}}else{return _0x4d436f(msgResponse(_0xfac0('0x1d7'),'Failure',_0xfac0('0x1d9')));}});};};Dialer[_0xfac0('0x1c')]['getDataPredictiveOld']=function(_0x2917b8){var _0x45df29=this;return function(_0xaee9c2){return new BPromise(function(_0xaa6641,_0x6ca37e){_[_0xfac0('0xd2')](_0x2917b8,_0xaee9c2[0x0]);if(checkGetDataPredictive(_0xaee9c2[0x0])){loggerPredictive[_0xfac0('0x81')](JSON[_0xfac0('0x7a')](_0xaee9c2[0x0]));if(_0x2917b8[_0xfac0('0x1c8')]===_0xfac0('0x1c9')){return _0x45df29[_0xfac0('0xc7')](_0x2917b8['id'])['then'](function(_0x3db82b){var _0x562aca=_0x2917b8[_0xfac0('0x51')]-_0x3db82b[0x0][_0xfac0('0x1da')];var _0x21e608=_0x2917b8[_0xfac0('0x1ce')]*0x3c;var _0x4197c4=_0xaee9c2[0x0]['predictiveIntervalAvgTalktime']+_0xaee9c2[0x0][_0xfac0('0x69')];var _0x177332=(_0xaee9c2[0x0][_0xfac0('0x68')]+_0xaee9c2[0x0][_0xfac0('0x6b')]+_0xaee9c2[0x0][_0xfac0('0x6a')])/_0xaee9c2[0x0][_0xfac0('0x72')];var _0x134c22=_0x2917b8[_0xfac0('0x1be')]/0x64;_0x2917b8['predictiveIntervalPauses']=_0x3db82b[0x0][_0xfac0('0x1da')]||0x0;_0x2917b8['predictiveIntervalHitRate']=_0x177332>0x0?_0x177332:0x1;return _0x45df29['abandonmentRate'](_0x562aca,_0x21e608,_0x4197c4,_0x177332,_0x134c22);})[_0xfac0('0xb8')](function(_0xf5813e){return _0xaa6641(_0xf5813e);})[_0xfac0('0xba')](function(_0x281ae3){return _0x6ca37e(msgResponse(_0xfac0('0x1db'),_0xfac0('0x143'),JSON[_0xfac0('0x7a')](_0x281ae3)));});}if(_0x2917b8['dialPredictiveOptimization']==='agentBusyFactor'){return _0x45df29[_0xfac0('0xc7')](_0x2917b8['id'])['then'](function(_0x3414f4){var _0x2d002d=_0x2917b8[_0xfac0('0x51')]-_0x3414f4[0x0][_0xfac0('0x1da')];var _0x42577c=_0x2917b8[_0xfac0('0x1ce')]*0x3c;var _0x603795=_0xaee9c2[0x0]['predictiveIntervalAvgTalktime']+_0xaee9c2[0x0]['predictiveIntervalAvgHoldtime'];var _0x2ec7eb=(_0xaee9c2[0x0][_0xfac0('0x68')]+_0xaee9c2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xaee9c2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xaee9c2[0x0][_0xfac0('0x72')];var _0x1e8f15=_0x2917b8['dialPredictiveOptimizationPercentage']/0x64;_0x2917b8[_0xfac0('0x70')]=_0x3414f4[0x0][_0xfac0('0x1da')]||0x0;_0x2917b8[_0xfac0('0x6e')]=_0x2ec7eb>0x0?_0x2ec7eb:0x1;return _0x45df29[_0xfac0('0x1d6')](_0x2d002d,_0x42577c,_0x603795,_0x2ec7eb,_0x1e8f15);})['then'](function(_0x5aedf1){return _0xaa6641(_0x5aedf1);})[_0xfac0('0xba')](function(_0x46ad16){return _0x6ca37e(msgResponse(_0xfac0('0x1db'),_0xfac0('0x143'),JSON[_0xfac0('0x7a')](_0x46ad16)));});}}else{return _0x6ca37e(msgResponse(_0xfac0('0x1d7'),'Failure','check\x20failure'));}});};};Dialer[_0xfac0('0x1c')][_0xfac0('0x1d0')]=function(_0x1f2d87){var _0x449c45=this;return function(){var _0x3e0b7e=0x0;var _0x38014f=Math[_0xfac0('0x1c3')](_0x1f2d87[_0xfac0('0x75')]*0x3e8);if(_0x38014f>0x0){_0x38014f=_0x38014f<0x64?0x64:_0x38014f;loggerPredictive[_0xfac0('0x81')](_0x1f2d87[_0xfac0('0x44')],_0xfac0('0x1dc'),_0x38014f,'milliseconds');_0x1f2d87[_0xfac0('0x8f')]=setInterval(function(){_0x449c45[_0xfac0('0x8f')](_0x1f2d87);loggerPredictiveCalls[_0xfac0('0x81')](_0xfac0('0x1dd'),_0x3e0b7e+=0x1);},_0x38014f);}else{loggerPredictive[_0xfac0('0x81')](_0x1f2d87[_0xfac0('0x44')],_0xfac0('0x1de'));}};};Dialer[_0xfac0('0x1c')]['checkContactBlack']=function(_0x23103a,_0x2dc97d){var _0x2c7b42=this;return function(_0x13685f){if(_[_0xfac0('0x47')](_0x13685f)){if(_[_0xfac0('0xde')](_0x2dc97d[_0xfac0('0xd4')])||!_0x2dc97d[_0xfac0('0x1df')]){if(_0x23103a[_0xfac0('0x156')]===_0xfac0('0x8')){_0x23103a[_0xfac0('0x12c')]=_[_0xfac0('0x3f')](_0x23103a[_0xfac0('0x12c')])?!![]:_0x23103a[_0xfac0('0x12c')];var _0x34519e=uuid['v4']();_0x2c7b42[_0xfac0('0xad')][_0x34519e]=new Action(_0x23103a,_0x2dc97d,_0x34519e);loggerBooked[_0xfac0('0x81')](_0xfac0('0x1e0'),_0x34519e,_0xfac0('0x1e1'),JSON['stringify'](_0x23103a['queueStatusComplete']),_0xfac0('0x1e2'),_0x23103a['name']);if(_0x23103a[_0xfac0('0x12c')]){_0x23103a[_0xfac0('0x12c')]=![];_0x2c7b42[_0xfac0('0x29')][_0x2c7b42[_0xfac0('0xad')][_0x34519e]['queue']]=[];ami[_0xfac0('0xb0')]({'actionid':_0x34519e,'action':_0xfac0('0x1e3'),'queue':_0x23103a[_0xfac0('0x44')]})[_0xfac0('0xba')](function(){_0x2c7b42[_0xfac0('0xb3')](_0x23103a);_0x2c7b42[_0xfac0('0xc1')]({'active':![],'ContactId':_0x2c7b42['actions'][_0x34519e][_0xfac0('0x101')],'ListId':_0x2c7b42[_0xfac0('0xad')][_0x34519e][_0xfac0('0x106')],'VoiceQueueId':_0x2c7b42[_0xfac0('0xad')][_0x34519e][_0xfac0('0x102')]||undefined,'CampaignId':_0x2c7b42[_0xfac0('0xad')][_0x34519e][_0xfac0('0xd5')]||undefined})['catch'](loggerCatch(_0xfac0('0x1e4')));delete _0x2c7b42['actions'][_0x34519e];});}else{loggerBooked[_0xfac0('0x81')](_0xfac0('0x1e5'),JSON[_0xfac0('0x7a')](_0x23103a[_0xfac0('0x12c')]),_0xfac0('0x1e2'),_0x23103a[_0xfac0('0x44')]);_0x2c7b42[_0xfac0('0xb3')](_0x23103a);_0x2c7b42[_0xfac0('0xc1')]({'active':![],'ContactId':_0x2c7b42[_0xfac0('0xad')][_0x34519e][_0xfac0('0x101')],'ListId':_0x2c7b42[_0xfac0('0xad')][_0x34519e][_0xfac0('0x106')],'VoiceQueueId':_0x2c7b42[_0xfac0('0xad')][_0x34519e]['VoiceQueueId']||undefined,'CampaignId':_0x2c7b42[_0xfac0('0xad')][_0x34519e][_0xfac0('0xd5')]||undefined})[_0xfac0('0xba')](loggerCatch(_0xfac0('0x1e4')));delete _0x2c7b42['actions'][_0x34519e];}}else{return _0x2c7b42[_0xfac0('0x1e6')](_0x23103a,_0x2dc97d);}}else{if(getDiff(_0x2dc97d[_0xfac0('0x1e7')])<_0x23103a[_0xfac0('0x1e8')]*0x3c){if(_0x2dc97d[_0xfac0('0x1e9')]&&!_0x2dc97d[_0xfac0('0x1e9')]['voicePause']){_0x2c7b42[_0xfac0('0x1f')][_0xfac0('0x12f')](_0x2dc97d['id'])[_0xfac0('0x1e')](function(){_0x2c7b42[_0xfac0('0xb3')](_0x23103a);});}else{_0x2c7b42[_0xfac0('0xc3')]({'active':![]},_0x2dc97d['id'],0x1)['finally'](function(){_0x2c7b42[_0xfac0('0xb3')](_0x23103a);});}}else{_0x23103a[_0xfac0('0x66')]+=0x1;_0x2c7b42['updateOriginated'](_0x23103a);if(_0x23103a['dialRecallInQueue']){_0x2c7b42[_0xfac0('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2dc97d[_0xfac0('0x101')],'ListId':_0x2dc97d[_0xfac0('0x106')],'VoiceQueueId':_0x2dc97d[_0xfac0('0x102')]||undefined,'CampaignId':_0x2dc97d[_0xfac0('0xd5')]||undefined})['catch'](loggerCatch(_0xfac0('0x1ea')));_0x2c7b42[_0xfac0('0xcb')](createObjHistory(_0x23103a,_0x2dc97d,'RECALLINQUEUE',0x17,_0xfac0('0x1eb')))[_0xfac0('0xba')](loggerCatch(_0xfac0('0x1ec')));}else{_0x2c7b42['saveInDb'](createObjHistory(_0x23103a,_0x2dc97d,_0xfac0('0x1ed'),0x16,'RecallFailedTimeout'),_0xfac0('0x1ee'),_0xfac0('0x1ef'));}}}}else{_0x23103a[_0xfac0('0x5e')]+=0x1;_0x2c7b42[_0xfac0('0xd1')](createObjHistory(_0x23103a,_0x2dc97d,_0xfac0('0x1f0'),0xd,_0xfac0('0x1f1')),_0xfac0('0x1f2'),_0xfac0('0x1f3'));throw _0xfac0('0x1f4');}};};Dialer['prototype'][_0xfac0('0x15c')]=function(_0x687e8d){var _0x424dfb=this;var _0xd3bde=_0x687e8d[_0xfac0('0x1f5')]-_0x687e8d[_0xfac0('0x73')]-_0x687e8d['temp'];emitCampaignSummary(_0x687e8d);if(_0xd3bde>0x0){if(_0xd3bde>this[_0xfac0('0x23')]){_0xd3bde=this[_0xfac0('0x23')];}_0x687e8d[_0xfac0('0x1f6')]+=_0xd3bde;this[_0xfac0('0xc6')](_0x687e8d['id'],_0xd3bde,_0x687e8d[_0xfac0('0x1f7')])[_0xfac0('0xb8')](function(_0x136f88){_0x687e8d['temp']-=_0xd3bde;_0x687e8d[_0xfac0('0x1f6')]=_0x687e8d[_0xfac0('0x1f6')]>0x0?_0x687e8d[_0xfac0('0x1f6')]:0x0;if(!checkContactEmpty(_0x136f88)){_0x687e8d[_0xfac0('0x40')]=_0xfac0('0x9c');logger[_0xfac0('0x81')]('[getContactCampaign2][Empty]'+_0x687e8d[_0xfac0('0x44')]);}else{_0x687e8d[_0xfac0('0x73')]+=_0x136f88[_0xfac0('0x132')];_0x687e8d[_0xfac0('0x40')]=_0xfac0('0x1f8');for(var _0x3ba64c=0x0;_0x3ba64c<_0x136f88['length'];_0x3ba64c+=0x1){_0x687e8d['ivrTotalCallsDays']+=0x1;if(_[_0xfac0('0xde')](_0x136f88[_0x3ba64c])||_[_0xfac0('0xde')](_0x136f88[_0x3ba64c]['Contact'])||_[_0xfac0('0xde')](_0x136f88[_0x3ba64c][_0xfac0('0x168')][_0xfac0('0x169')])){_0x424dfb[_0xfac0('0xcf')](_0xfac0('0x1f9'),_0x687e8d,_0x136f88[_0x3ba64c]);}else{_0x424dfb[_0xfac0('0xbe')](_['pick'](_0x136f88[_0x3ba64c],[_0xfac0('0xd5'),_0xfac0('0x1fa')]))[_0xfac0('0xb8')](_0x424dfb[_0xfac0('0x1fb')](_0x687e8d,_0x136f88[_0x3ba64c]))[_0xfac0('0xba')](_0x424dfb[_0xfac0('0xce')](_0xfac0('0x1fc'),_0x687e8d));}}}})[_0xfac0('0xba')](loggerGetContactDialer('[getContactCampaign2]',_0x687e8d,_0xd3bde));}};Dialer[_0xfac0('0x1c')][_0xfac0('0x158')]=function(_0x212620,_0x1e1f1a){var _0x89017=this;var _0x425126=[];var _0x34df3c=_0x1e1f1a>=0x1?_0x1e1f1a:0x1;if(_0x212620[_0xfac0('0x156')]===_0xfac0('0x8')){_0x34df3c=0x1;}var _0x57bb64=Math[_0xfac0('0x1c3')](_0x212620[_0xfac0('0x1c2')]*_0x34df3c)-_0x212620[_0xfac0('0x73')]-_0x212620['temp'];emitVoiceQueueSummary(_0x212620);if(_0x212620[_0xfac0('0x1fd')]>0x0){var _0x407cbc=_0x212620[_0xfac0('0x1fd')]-_0x212620[_0xfac0('0x73')]-_0x212620[_0xfac0('0x55')]-_0x212620['temp']-_0x212620[_0xfac0('0x52')];if(_0x57bb64>_0x407cbc){_0x57bb64=_0x407cbc;}}if(_0x57bb64>0x0){if(_0x212620[_0xfac0('0x156')]===_0xfac0('0x8')){_0x57bb64=0x1;}if(_0x57bb64>this[_0xfac0('0x23')]){_0x57bb64=this[_0xfac0('0x23')];}_0x212620[_0xfac0('0x1f6')]+=_0x57bb64;for(var _0x46c275 in this[_0xfac0('0x21')]){if(typeof this[_0xfac0('0x21')][_0x46c275]!=='undefined'){if(this[_0xfac0('0x21')][_0x46c275][_0xfac0('0xa6')]===_0xfac0('0x1fe')&&this[_0xfac0('0x21')][_0x46c275][_0xfac0('0xb1')]===_0xfac0('0xda')){_0x425126[_0xfac0('0x12a')](this['agents'][_0x46c275]['id']);}}}this['getContactDialer'](_0x212620['id'],_0x425126,_0x57bb64,_0x212620['dialOrderByScheduledAt'])[_0xfac0('0xb8')](function(_0x59da32){_0x212620[_0xfac0('0x1f6')]-=_0x57bb64;_0x212620['temp']=_0x212620[_0xfac0('0x1f6')]>0x0?_0x212620[_0xfac0('0x1f6')]:0x0;if(!checkContactEmpty(_0x59da32)){_0x89017[_0xfac0('0xb9')](_0x212620)[_0xfac0('0xb8')](sendMessageReschedule(_0x212620))[_0xfac0('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0x212620['originated']+=_0x59da32[_0xfac0('0x132')];_0x212620[_0xfac0('0x40')]=_0x212620[_0xfac0('0x156')]===_0xfac0('0x8')?'ACTIVE':_0xfac0('0x1f8');for(var _0x1d5474=0x0;_0x1d5474<_0x59da32[_0xfac0('0x132')];_0x1d5474+=0x1){if(_[_0xfac0('0xde')](_0x59da32[_0x1d5474])||_['isNil'](_0x59da32[_0x1d5474][_0xfac0('0x168')])||_[_0xfac0('0xde')](_0x59da32[_0x1d5474][_0xfac0('0x168')]['phone'])){_0x89017[_0xfac0('0xcf')](_0xfac0('0x1f9'),_0x212620,_0x59da32[_0x1d5474]);}else{_0x89017['checkIsBlackList'](_['pick'](_0x59da32[_0x1d5474],[_0xfac0('0x102'),_0xfac0('0x1fa')]))[_0xfac0('0xb8')](_0x89017[_0xfac0('0x1fb')](_0x212620,_0x59da32[_0x1d5474]))[_0xfac0('0xba')](_0x89017[_0xfac0('0xce')](_0xfac0('0x1f9'),_0x212620));}}}})[_0xfac0('0xba')](loggerGetContactDialer('[getContactDialer2]',_0x212620,_0x57bb64));}};Dialer[_0xfac0('0x1c')][_0xfac0('0x8f')]=function(_0x4dc8f1){if(_0x4dc8f1[_0xfac0('0x1fd')]>0x0){var _0x131469=_0x4dc8f1[_0xfac0('0x1fd')]-_0x4dc8f1['originated']-_0x4dc8f1[_0xfac0('0x55')];if(_0x131469>0x0){this[_0xfac0('0x1ff')](_0x4dc8f1);}else{loggerPredictiveCalls[_0xfac0('0x81')](_0xfac0('0x200'));}}else{this[_0xfac0('0x1ff')](_0x4dc8f1);}};Dialer[_0xfac0('0x1c')][_0xfac0('0x1ff')]=function(_0xaa3c20){var _0x388ece=this;var _0x5517f6=[];_0xaa3c20['originated']+=0x1;for(var _0x2b93c9 in this[_0xfac0('0x21')]){if(typeof this['agents'][_0x2b93c9]!==_0xfac0('0x96')){if(this['agents'][_0x2b93c9][_0xfac0('0xa6')]===_0xfac0('0x1fe')&&this[_0xfac0('0x21')][_0x2b93c9]['status']===_0xfac0('0xda')){_0x5517f6[_0xfac0('0x12a')](this[_0xfac0('0x21')][_0x2b93c9]['id']);}}}this[_0xfac0('0xc4')](_0xaa3c20['id'],_0x5517f6,0x1,_0xaa3c20[_0xfac0('0x1f7')])[_0xfac0('0xb8')](function(_0x486de2){if(!checkContactEmpty(_0x486de2)){checkContactLowerLimitOriginate(_0xaa3c20,0x1,0x0);_0x388ece[_0xfac0('0xb9')](_0xaa3c20)[_0xfac0('0xb8')](sendMessageReschedule(_0xaa3c20))[_0xfac0('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0xaa3c20['message']=_0xfac0('0x1f8');if(_[_0xfac0('0xde')](_0x486de2[0x0])||_[_0xfac0('0xde')](_0x486de2[0x0][_0xfac0('0x168')])||_[_0xfac0('0xde')](_0x486de2[0x0][_0xfac0('0x168')][_0xfac0('0x169')])){_0x388ece[_0xfac0('0xcf')](_0xfac0('0x1f9'),_0xaa3c20,_0x486de2[0x0]);}else{_0x388ece[_0xfac0('0xbc')](_[_0xfac0('0xd3')](_0x486de2[0x0],[_0xfac0('0x102'),_0xfac0('0x1fa')]))[_0xfac0('0xb8')](_0x388ece[_0xfac0('0x1fb')](_0xaa3c20,_0x486de2[0x0]))[_0xfac0('0xba')](_0x388ece[_0xfac0('0xce')](_0xfac0('0x201'),_0xaa3c20));}}})[_0xfac0('0xba')](loggerGetContactDialer(_0xfac0('0x202'),_0xaa3c20,0x1));emitVoiceQueueSummary(_0xaa3c20);};Dialer[_0xfac0('0x1c')][_0xfac0('0x1d5')]=function(_0x5f1f1a,_0x25e2b9,_0x487aef,_0x42eb71,_0x1f1540,_0x509c17){loggerPredictive[_0xfac0('0x81')](_0xfac0('0x203'));loggerPredictive[_0xfac0('0x81')](_0xfac0('0x204'),_0x5f1f1a);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x205'),_0x25e2b9);loggerPredictive[_0xfac0('0x81')]('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',_0x487aef);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x206'),_0x42eb71);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x207'),_0x1f1540);loggerPredictive[_0xfac0('0x81')]('---------------------------');return new BPromise(function(_0x18aca0,_0x30537f){if(_0x5f1f1a<=0x0||isNaN(_0x5f1f1a)){return _0x30537f(msgResponse('[abandonmentRate]',_0xfac0('0x48'),_0xfac0('0x208')+_0x5f1f1a));}if(_0x487aef<=0x0||isNaN(_0x487aef)){return _0x30537f(msgResponse('[abandonmentRate]',_0xfac0('0x48'),_0xfac0('0x209')+_0x487aef));}if(_0x42eb71<=0x0||isNaN(_0x42eb71)){return _0x30537f(msgResponse(_0xfac0('0x20a'),_0xfac0('0x48'),_0xfac0('0x20b')+_0x42eb71));}if(_0x25e2b9<=0x0||isNaN(_0x25e2b9)){return _0x30537f(msgResponse('[abandonmentRate]',_0xfac0('0x48'),_0xfac0('0x20c')+_0x25e2b9));}if(_0x1f1540<=0x0||isNaN(_0x1f1540)){return _0x30537f(msgResponse(_0xfac0('0x20a'),_0xfac0('0x48'),_0xfac0('0x20d')+_0x1f1540));}_0x509c17=_0x509c17||0x0;var _0x4df4d9=0x1/_0x487aef;var _0x28144e=0x0;var _0x4b021a=0x0;var _0x4351de=0x0;var _0x3dc00d=0x0;for(var _0x561682=0x0;_0x4351de<_0x1f1540;_0x561682+=0x1){_0x4b021a=_0x561682/_0x25e2b9;_0x28144e=(_0x42eb71*_0x4b021a+_0x509c17)/_0x4df4d9;_0x4351de=erlangb(_0x28144e,_0x5f1f1a);_0x3dc00d=_0x28144e/_0x5f1f1a*(0x1-erlangb(_0x28144e,_0x5f1f1a));}return _0x18aca0({'erlangCalls':_0x561682,'erlangCallToSecond':_0x25e2b9/_0x561682,'erlangAbandonmentRate':_0x4351de,'erlangBusyFactor':_0x3dc00d});});};Dialer[_0xfac0('0x1c')][_0xfac0('0x1d6')]=function(_0x330ec4,_0x361e63,_0x1cdc2c,_0x309369,_0x544c4c,_0xc4ba55){loggerPredictive[_0xfac0('0x81')](_0xfac0('0x20e'));loggerPredictive['info'](_0xfac0('0x204'),_0x330ec4);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x361e63);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x20f'),_0x1cdc2c);loggerPredictive[_0xfac0('0x81')]('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',_0x309369);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x544c4c);loggerPredictive[_0xfac0('0x81')](_0xfac0('0x88'));return new BPromise(function(_0x4474a4,_0x3951fc){if(_0x330ec4<=0x0||isNaN(_0x330ec4)){return _0x3951fc(msgResponse(_0xfac0('0x210'),_0xfac0('0x48'),_0xfac0('0x208')+_0x330ec4));}if(_0x1cdc2c<=0x0||isNaN(_0x1cdc2c)){return _0x3951fc(msgResponse(_0xfac0('0x210'),_0xfac0('0x48'),_0xfac0('0x209')+_0x1cdc2c));}if(_0x309369<=0x0||isNaN(_0x309369)){return _0x3951fc(msgResponse(_0xfac0('0x210'),_0xfac0('0x48'),'p\x20=\x20'+_0x309369));}if(_0x361e63<=0x0||isNaN(_0x361e63)){return _0x3951fc(msgResponse(_0xfac0('0x210'),_0xfac0('0x48'),_0xfac0('0x20c')+_0x361e63));}if(_0x544c4c<=0x0||isNaN(_0x544c4c)){return _0x3951fc(msgResponse(_0xfac0('0x210'),_0xfac0('0x48'),'Umin\x20=\x20'+_0x544c4c));}_0xc4ba55=_0xc4ba55||0x0;var _0x1214ac=0x1/_0x1cdc2c;var _0x258e17=0x0;var _0x2b5653=0x0;var _0x3ace8d=0x0;var _0x47e13f=0x0;for(var _0x71543e=0x0;_0x47e13f<_0x544c4c;_0x71543e+=0x1){_0x2b5653=_0x71543e/_0x361e63;_0x258e17=(_0x309369*_0x2b5653+_0xc4ba55)/_0x1214ac;_0x3ace8d=erlangb(_0x258e17,_0x330ec4);_0x47e13f=_0x258e17/_0x330ec4*(0x1-erlangb(_0x258e17,_0x330ec4));}return _0x4474a4({'erlangCalls':_0x71543e,'erlangCallToSecond':_0x361e63/_0x71543e,'erlangAbandonmentRate':_0x3ace8d,'erlangBusyFactor':_0x47e13f});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 902ffc4..5ab9c00 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 _0xd12c=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','droptime','ringtime','membername','connectedlinename','callback'];(function(_0xe88939,_0x14ef91){var _0x3b910e=function(_0x4826cb){while(--_0x4826cb){_0xe88939['push'](_0xe88939['shift']());}};_0x3b910e(++_0x14ef91);}(_0xd12c,0x83));var _0xcd12=function(_0x2c421b,_0x234646){_0x2c421b=_0x2c421b-0x0;var _0x2a138c=_0xd12c[_0x2c421b];return _0x2a138c;};'use strict';var util=require(_0xcd12('0x0'));var _=require(_0xcd12('0x1'));var moment=require(_0xcd12('0x2'));function getSeconds(_0xe37a01,_0x49e351){var _0x18fd62=moment(_0xe37a01)[_0xcd12('0x3')](0x0);var _0x43f62d=moment(_0x49e351)['milliseconds'](0x0);return _0x18fd62['diff'](_0x43f62d,_0xcd12('0x4'));}function QueueCallerAbandon(_0x4fe012,_0x540986){this[_0xcd12('0x5')]=_0x4fe012[_0xcd12('0x5')];this[_0xcd12('0x6')]=_0x4fe012['type'];this[_0xcd12('0x7')]=_0x4fe012[_0xcd12('0x6')]===_0xcd12('0x8')?_0xcd12('0x9'):_0x4fe012[_0xcd12('0x6')];this[_0xcd12('0xa')]=_0x4fe012[_0xcd12('0xa')];this[_0xcd12('0xb')]=_0x4fe012[_0xcd12('0xb')];this[_0xcd12('0xc')]=_0x4fe012[_0xcd12('0xc')];this[_0xcd12('0xd')]=_0x4fe012[_0xcd12('0xa')]+_0x4fe012[_0xcd12('0xb')]+_0x4fe012[_0xcd12('0xc')]+_0x4fe012['countnosuchnumberretry']+_0x4fe012['countdropretry']+_0x4fe012['countabandonedretry']+_0x4fe012[_0xcd12('0xe')]+_0x4fe012['countagentrejectretry'];this[_0xcd12('0xf')]=_0x4fe012[_0xcd12('0xf')];this[_0xcd12('0x10')]=_0x4fe012[_0xcd12('0x10')];this[_0xcd12('0x11')]=_0x4fe012['countabandonedretry'];this[_0xcd12('0xe')]=_0x4fe012['countmachineretry'];this[_0xcd12('0x12')]=_0x4fe012[_0xcd12('0x12')];this[_0xcd12('0x13')]=_0x540986['uniqueid'];this[_0xcd12('0x14')]=_0x4fe012[_0xcd12('0x15')];this['calleridnum']=_0x4fe012['number'];this[_0xcd12('0x16')]=_0x4fe012[_0xcd12('0x16')];this[_0xcd12('0x17')]=_0x4fe012[_0xcd12('0x17')];this[_0xcd12('0x18')]=_0x4fe012[_0xcd12('0x18')];this['endtime']=this[_0xcd12('0x18')];this[_0xcd12('0x19')]=getSeconds(_0x4fe012[_0xcd12('0x17')],_0x4fe012['starttime']);this['holdtime']=getSeconds(this[_0xcd12('0x18')],_0x4fe012[_0xcd12('0x17')]);this['talktime']=0x0;this[_0xcd12('0x9')]=_0x540986[_0xcd12('0x9')];this[_0xcd12('0x1a')]=_0x540986[_0xcd12('0x1b')];this['reason']=_0x540986['reason'];this[_0xcd12('0x1c')]=_0x4fe012[_0xcd12('0x1c')];this[_0xcd12('0x1d')]=_0x4fe012[_0xcd12('0x1d')];this[_0xcd12('0x1e')]=_0x4fe012[_0xcd12('0x1e')];this[_0xcd12('0x1f')]=_0x4fe012[_0xcd12('0x1f')];this[_0xcd12('0x20')]=_0x4fe012[_0xcd12('0x20')];this[_0xcd12('0x21')]=_0x4fe012[_0xcd12('0x21')];this[_0xcd12('0x22')]=_0x4fe012[_0xcd12('0x22')];this[_0xcd12('0x23')]=_0x4fe012['VoiceQueueId'];this[_0xcd12('0x24')]=_0x4fe012[_0xcd12('0x24')];this['originatecalleridnum']=_0x4fe012[_0xcd12('0x25')]||'';this[_0xcd12('0x26')]=_0x4fe012['originatecalleridname']||'';}module[_0xcd12('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x923c=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5b6690,_0x42dd53){var _0x59f0d2=function(_0x18fd6c){while(--_0x18fd6c){_0x5b6690['push'](_0x5b6690['shift']());}};_0x59f0d2(++_0x42dd53);}(_0x923c,0x1c3));var _0xc923=function(_0x59082a,_0x4ae997){_0x59082a=_0x59082a-0x0;var _0x17316e=_0x923c[_0x59082a];return _0x17316e;};'use strict';var util=require(_0xc923('0x0'));var _=require(_0xc923('0x1'));var moment=require(_0xc923('0x2'));function getSeconds(_0x19c87e,_0x2ef097){var _0x9dee1a=moment(_0x19c87e)[_0xc923('0x3')](0x0);var _0x52f30d=moment(_0x2ef097)['milliseconds'](0x0);return _0x9dee1a['diff'](_0x52f30d,'seconds');}function QueueCallerAbandon(_0x23d543,_0x101bd8){this[_0xc923('0x4')]=_0x23d543[_0xc923('0x4')];this['type']=_0x23d543[_0xc923('0x5')];this['campaigntype']=_0x23d543[_0xc923('0x5')]===_0xc923('0x6')?_0xc923('0x7'):_0x23d543['type'];this[_0xc923('0x8')]=_0x23d543['countbusyretry'];this[_0xc923('0x9')]=_0x23d543[_0xc923('0x9')];this[_0xc923('0xa')]=_0x23d543[_0xc923('0xa')];this[_0xc923('0xb')]=_0x23d543['countbusyretry']+_0x23d543[_0xc923('0x9')]+_0x23d543[_0xc923('0xa')]+_0x23d543[_0xc923('0xc')]+_0x23d543[_0xc923('0xd')]+_0x23d543[_0xc923('0xe')]+_0x23d543['countmachineretry']+_0x23d543[_0xc923('0xf')];this[_0xc923('0xc')]=_0x23d543[_0xc923('0xc')];this[_0xc923('0xd')]=_0x23d543[_0xc923('0xd')];this[_0xc923('0xe')]=_0x23d543[_0xc923('0xe')];this['countmachineretry']=_0x23d543[_0xc923('0x10')];this[_0xc923('0xf')]=_0x23d543[_0xc923('0xf')];this[_0xc923('0x11')]=_0x101bd8[_0xc923('0x11')];this[_0xc923('0x12')]=_0x23d543[_0xc923('0x13')];this[_0xc923('0x14')]=_0x23d543[_0xc923('0x15')];this[_0xc923('0x16')]=_0x23d543['starttime'];this[_0xc923('0x17')]=_0x23d543[_0xc923('0x17')];this[_0xc923('0x18')]=_0x23d543[_0xc923('0x18')];this[_0xc923('0x19')]=this[_0xc923('0x18')];this[_0xc923('0x1a')]=getSeconds(_0x23d543[_0xc923('0x17')],_0x23d543[_0xc923('0x16')]);this[_0xc923('0x1b')]=getSeconds(this['droptime'],_0x23d543['responsetime']);this['talktime']=0x0;this[_0xc923('0x7')]=_0x101bd8[_0xc923('0x7')];this[_0xc923('0x1c')]=_0x101bd8[_0xc923('0x1d')];this['reason']=_0x101bd8[_0xc923('0x1e')];this[_0xc923('0x1f')]=_0x23d543[_0xc923('0x1f')];this[_0xc923('0x20')]=_0x23d543['callbackuniqueid'];this['callbackat']=_0x23d543[_0xc923('0x21')];this[_0xc923('0x22')]=_0x23d543[_0xc923('0x22')];this[_0xc923('0x23')]=_0x23d543[_0xc923('0x23')];this[_0xc923('0x24')]=_0x23d543[_0xc923('0x24')];this['UserId']=_0x23d543['UserId'];this[_0xc923('0x25')]=_0x23d543['VoiceQueueId'];this['CampaignId']=_0x23d543[_0xc923('0x26')];this[_0xc923('0x27')]=_0x23d543[_0xc923('0x27')]||'';this[_0xc923('0x28')]=_0x23d543['originatecalleridname']||'';}module[_0xc923('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 95dfbae..fc93700 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 _0x0318=['%s/%s/%s','name','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','uniqueid','channel','format'];(function(_0x29444c,_0x386fb4){var _0x3c1918=function(_0x16f364){while(--_0x16f364){_0x29444c['push'](_0x29444c['shift']());}};_0x3c1918(++_0x386fb4);}(_0x0318,0x11b));var _0x8031=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0318[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x8031('0x0'));var _=require(_0x8031('0x1'));var moment=require('moment');function Action(_0x55bff5,_0x139d6a,_0x37bb6f){this[_0x8031('0x2')]=_0x55bff5||undefined;this[_0x8031('0x3')]=util[_0x8031('0x4')](_0x8031('0x5'),_0x139d6a['tech'],_0x139d6a['Trunk'][_0x8031('0x6')],_0x37bb6f['fax']);this[_0x8031('0x7')]=_0x139d6a[_0x8031('0x7')];this['headerinfo']=_0x139d6a[_0x8031('0x8')];this[_0x8031('0x9')]=_0x37bb6f[_0x8031('0x9')];this[_0x8031('0xa')]=_0x37bb6f[_0x8031('0xa')];}module[_0x8031('0xb')]=Action; \ No newline at end of file +var _0xa2c6=['fax','localstationid','headerinfo','AttachmentId','util','lodash','uniqueid','format','%s/%s/%s','tech','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2c6,0x88));var _0x6a2c=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xa2c6[_0x946518];return _0x909b69;};'use strict';var util=require(_0x6a2c('0x0'));var _=require(_0x6a2c('0x1'));var moment=require('moment');function Action(_0x2062fe,_0x546a3f,_0x18eaa4){this[_0x6a2c('0x2')]=_0x2062fe||undefined;this['channel']=util[_0x6a2c('0x3')](_0x6a2c('0x4'),_0x546a3f[_0x6a2c('0x5')],_0x546a3f['Trunk'][_0x6a2c('0x6')],_0x18eaa4[_0x6a2c('0x7')]);this[_0x6a2c('0x8')]=_0x546a3f['localstationid'];this[_0x6a2c('0x9')]=_0x546a3f['headerinfo'];this['path']=_0x18eaa4['path'];this[_0x6a2c('0xa')]=_0x18eaa4[_0x6a2c('0xa')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index a731f4f..80735d9 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 _0x66db=['\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isNil','active','SIP/%s','status','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','stringify','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','newstate','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','syncNewState','channelstate','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','error','catch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x66db,0xaf));var _0xb66d=function(_0x592f91,_0x2b08e9){_0x592f91=_0x592f91-0x0;var _0x562437=_0x66db[_0x592f91];return _0x562437;};'use strict';var util=require(_0xb66d('0x0'));var _=require(_0xb66d('0x1'));var BPromise=require(_0xb66d('0x2'));var uuid=require(_0xb66d('0x3'));var moment=require(_0xb66d('0x4'));var path=require(_0xb66d('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xb66d('0x6'));var logger=require(_0xb66d('0x7'))(_0xb66d('0x8'));var ami=require('../ami');var rpcDb=require(_0xb66d('0x9'));var Channel=require(_0xb66d('0xa'));var ut=require(_0xb66d('0xb'));var Action=require('./action');var faxAccount=require(_0xb66d('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xb66d('0xd'));function Fax(_0x1e80b4){this[_0xb66d('0xe')]={};this[_0xb66d('0xf')]=_0x1e80b4['faxAccounts'];this[_0xb66d('0x10')]=_0x1e80b4[_0xb66d('0x10')];this[_0xb66d('0x11')]={};ami['on'](_0xb66d('0x12'),this[_0xb66d('0x13')]['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xb66d('0x14'),this['syncNewState'][_0xb66d('0x15')](this));ami['on'](_0xb66d('0x16'),this[_0xb66d('0x17')][_0xb66d('0x15')](this));ami['on'](_0xb66d('0x18'),this[_0xb66d('0x19')][_0xb66d('0x15')](this));ami['on'](_0xb66d('0x1a'),this['syncReceiveFax'][_0xb66d('0x15')](this));ami['on'](_0xb66d('0x1b'),this[_0xb66d('0x1c')][_0xb66d('0x15')](this));ami['on'](_0xb66d('0x1d'),this[_0xb66d('0x1e')][_0xb66d('0x15')](this));}Fax['prototype'][_0xb66d('0x13')]=function(_0x1326ae){if(_0x1326ae[_0xb66d('0x1f')]===_0xb66d('0x20')){for(var _0x1a4d0a in this[_0xb66d('0xf')]){if(this['faxAccounts'][_0xb66d('0x21')](_0x1a4d0a)){if(_0x1326ae[_0xb66d('0x22')]===this[_0xb66d('0xf')][_0x1a4d0a][_0xb66d('0x23')]){this['channels'][_0x1326ae[_0xb66d('0x24')]]={};this[_0xb66d('0xe')][_0x1326ae['uniqueid']][_0xb66d('0x25')]=_0x1326ae[_0xb66d('0x25')];this[_0xb66d('0xe')][_0x1326ae[_0xb66d('0x24')]]['id']=this[_0xb66d('0xf')][_0x1a4d0a]['id'];this[_0xb66d('0xe')][_0x1326ae[_0xb66d('0x24')]][_0xb66d('0x26')]=this[_0xb66d('0xf')][_0x1a4d0a][_0xb66d('0x26')];logger[_0xb66d('0x27')](_0x1326ae[_0xb66d('0x24')],_0xb66d('0x28'));}}}}if(this[_0xb66d('0x11')][_0x1326ae[_0xb66d('0x24')]]){this[_0xb66d('0xe')][_0x1326ae[_0xb66d('0x24')]]={};this[_0xb66d('0xe')][_0x1326ae['uniqueid']][_0xb66d('0x25')]=_0x1326ae[_0xb66d('0x25')];logger['info'](_0x1326ae['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xb66d('0x29')][_0xb66d('0x2a')]=function(_0x37c389){if(this[_0xb66d('0xe')][_0x37c389[_0xb66d('0x24')]]){for(var _0x5d969a in _0x37c389[_0xb66d('0x2b')]){if(_0x37c389[_0xb66d('0x2b')][_0xb66d('0x21')](_0x5d969a)){this['channels'][_0x37c389[_0xb66d('0x24')]][_0x5d969a]=_0x37c389[_0xb66d('0x2c')];}}}};Fax[_0xb66d('0x29')][_0xb66d('0x2d')]=function(_0x3c2371){if(this[_0xb66d('0xe')][_0x3c2371[_0xb66d('0x24')]]){this[_0xb66d('0xe')][_0x3c2371[_0xb66d('0x24')]][_0xb66d('0x2e')]=_0x3c2371[_0xb66d('0x2e')];this[_0xb66d('0xe')][_0x3c2371['uniqueid']]['channelstatedesc']=_0x3c2371['channelstatedesc'];}};Fax[_0xb66d('0x29')][_0xb66d('0x17')]=function(_0x487d83){if(this[_0xb66d('0xe')][_0x487d83[_0xb66d('0x24')]]){for(var _0x55df12 in _0x487d83[_0xb66d('0x2b')]){if(_0x487d83[_0xb66d('0x2b')][_0xb66d('0x21')](_0x55df12)){this[_0xb66d('0xe')][_0x487d83[_0xb66d('0x24')]][_0x55df12]=_0x487d83[_0xb66d('0x2c')];}}}};Fax[_0xb66d('0x29')][_0xb66d('0x19')]=function(_0x17caa3){if(this[_0xb66d('0xe')][_0x17caa3[_0xb66d('0x24')]]){this[_0xb66d('0xe')][_0x17caa3[_0xb66d('0x24')]]['operation']=_0x17caa3[_0xb66d('0x2f')];this[_0xb66d('0xe')][_0x17caa3['uniqueid']]['status']=_0x17caa3['status'];this['channels'][_0x17caa3[_0xb66d('0x24')]][_0xb66d('0x23')]=_0x17caa3[_0xb66d('0x23')];this['channels'][_0x17caa3['uniqueid']][_0xb66d('0x30')]=_0x17caa3[_0xb66d('0x30')];logger[_0xb66d('0x27')](_0x17caa3[_0xb66d('0x24')],_0xb66d('0x31'));}};Fax['prototype']['syncReceiveFax']=function(_0x1a6610){var _0x3748c8=this;if(this['channels'][_0x1a6610['uniqueid']]){var _0x4cdf84=this[_0xb66d('0xe')][_0x1a6610['uniqueid']]['id'];this[_0xb66d('0xe')][_0x1a6610[_0xb66d('0x24')]][_0xb66d('0x32')]=_0x1a6610['remotestationid'];this[_0xb66d('0xe')][_0x1a6610[_0xb66d('0x24')]][_0xb66d('0x33')]=_0x1a6610[_0xb66d('0x33')];this['channels'][_0x1a6610[_0xb66d('0x24')]][_0xb66d('0x23')]=_0x1a6610[_0xb66d('0x23')];this[_0xb66d('0xe')][_0x1a6610['uniqueid']][_0xb66d('0x34')]=_0x1a6610[_0xb66d('0x34')];this['channels'][_0x1a6610[_0xb66d('0x24')]][_0xb66d('0x35')]=_0x1a6610[_0xb66d('0x35')];this[_0xb66d('0xe')][_0x1a6610[_0xb66d('0x24')]]['filename']=_0x1a6610[_0xb66d('0x30')];this[_0xb66d('0xe')][_0x1a6610[_0xb66d('0x24')]][_0xb66d('0x36')]=_0x1a6610[_0xb66d('0x36')];if(this[_0xb66d('0xe')][_0x1a6610[_0xb66d('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x1a6610[_0xb66d('0x30')],_0xb66d('0x37'),function(_0x25869c){logger[_0xb66d('0x27')](_0x1a6610[_0xb66d('0x24')],_0xb66d('0x38'),_0x25869c[_0xb66d('0x39')]);attachment['create']({'name':path[_0xb66d('0x3a')](_0x1a6610['filename'])['name'],'basename':path['parse'](_0x1a6610[_0xb66d('0x30')])['name']+_0xb66d('0x3b'),'type':_0xb66d('0x3c')})['then'](function(_0x13e23c){faxAccount['notify'](_0x4cdf84,{'from':_0x1a6610[_0xb66d('0x36')],'mapKey':_0xb66d('0x8'),'body':path['parse'](_0x1a6610[_0xb66d('0x30')])['name']+'.pdf','AttachmentId':_0x13e23c['id']})['catch'](function(_0x5b8ae8){logger[_0xb66d('0x3d')](_0x1a6610[_0xb66d('0x24')],'\x20notify\x20',JSON['stringify'](_0x5b8ae8));});})[_0xb66d('0x3e')](function(_0x469c35){logger['error'](_0x1a6610[_0xb66d('0x24')],_0xb66d('0x3f'),JSON['stringify'](_0x469c35));});});}logger[_0xb66d('0x27')](_0x1a6610['uniqueid'],_0xb66d('0x3f'));}};Fax[_0xb66d('0x29')][_0xb66d('0x1e')]=function(_0x223d69){if(this[_0xb66d('0x11')][_0x223d69[_0xb66d('0x24')]]){_[_0xb66d('0x40')](this[_0xb66d('0xe')][_0x223d69[_0xb66d('0x24')]],_[_0xb66d('0x41')](_0x223d69,['response',_0xb66d('0x42')]));}};function updateStatus(_0x3b7037){if(_0x3b7037['AttachmentId']){faxMessage[_0xb66d('0x43')](_0x3b7037[_0xb66d('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xb66d('0x45')](function(_0x2133ae){ut[_0xb66d('0x46')](_0xb66d('0x47'),_0x2133ae);})[_0xb66d('0x3e')](function(_0x550262){ut[_0xb66d('0x46')](_0xb66d('0x48'),_0x550262);});}else{ut[_0xb66d('0x46')](_0xb66d('0x49'));}}Fax['prototype']['updateStatus']=function(_0x2fbeee,_0x10f2eb,_0x17b286){var _0x3e791a=this;var _0x49b599={};if(_0x10f2eb){_0x49b599={'read':_0x10f2eb};}else{_0x49b599={'failMessage':_0x17b286};}if(this['actions'][_0x2fbeee][_0xb66d('0x44')]){faxMessage['update'](this[_0xb66d('0x11')][_0x2fbeee][_0xb66d('0x44')],_0x49b599)[_0xb66d('0x45')](function(_0xe5980e){ut['logger'](_0xb66d('0x4a'),_0xe5980e);})[_0xb66d('0x3e')](function(_0x16aea7){ut[_0xb66d('0x46')](_0xb66d('0x4b'),_0x16aea7);})[_0xb66d('0x4c')](function(){delete _0x3e791a[_0xb66d('0xe')][_0x2fbeee];delete _0x3e791a[_0xb66d('0x11')][_0x2fbeee];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xb66d('0xe')][_0x2fbeee];delete this[_0xb66d('0x11')][_0x2fbeee];}};Fax['prototype'][_0xb66d('0x1c')]=function(_0x4defa0){var _0x46c273=this;if(this[_0xb66d('0xe')][_0x4defa0[_0xb66d('0x24')]]){if(this[_0xb66d('0x11')][_0x4defa0[_0xb66d('0x24')]]){this['channels'][_0x4defa0[_0xb66d('0x24')]]['id']=this[_0xb66d('0x11')][_0x4defa0[_0xb66d('0x24')]]['id'];this[_0xb66d('0xe')][_0x4defa0[_0xb66d('0x24')]][_0xb66d('0x26')]=this[_0xb66d('0x11')][_0x4defa0[_0xb66d('0x24')]]['name'];}logger['info'](_0x4defa0[_0xb66d('0x24')],this['actions'][_0x4defa0[_0xb66d('0x24')]]?_0xb66d('0x4d'):_0xb66d('0x4e'),JSON['stringify'](this[_0xb66d('0xe')][_0x4defa0[_0xb66d('0x24')]]));if(this[_0xb66d('0x11')][_0x4defa0['uniqueid']]){if(this[_0xb66d('0xe')][_0x4defa0[_0xb66d('0x24')]][_0xb66d('0x4f')]>0x0&&this[_0xb66d('0xe')][_0x4defa0[_0xb66d('0x24')]][_0xb66d('0x18')]===_0xb66d('0x50')){this[_0xb66d('0x51')](_0x4defa0[_0xb66d('0x24')],!![]);}else{this['updateStatus'](_0x4defa0['uniqueid'],![],this['channels'][_0x4defa0[_0xb66d('0x24')]]['faxstatusstring']?_0xb66d('0x52')+this['channels'][_0x4defa0['uniqueid']]['faxstatusstring']:_0xb66d('0x53'));}}}};Fax['prototype'][_0xb66d('0x54')]=function(_0x2394d0){var _0x9fa79b=this;return new BPromise(function(_0x5877d9,_0x349001){_0x9fa79b['execOriginate'](_0x2394d0,_0x9fa79b['faxAccounts'][_0x2394d0['FaxAccountId']])['then'](function(_0x4372dd){ut[_0xb66d('0x46')](_0xb66d('0x55'),_0x4372dd);_0x5877d9(ut[_0xb66d('0x39')](_0xb66d('0x56')));})['catch'](function(_0x2556c2){ut['logger'](_0xb66d('0x57'),_0x2556c2);updateStatus(_0x2394d0);_0x349001(ut[_0xb66d('0x39')](_0xb66d('0x58')));});});};Fax[_0xb66d('0x29')]['checkAfterSend']=function(_0x1854b3){var _0x251038=this;return new BPromise(function(_0x338c5a,_0x134637){var _0xf7ac86=_0x251038[_0xb66d('0x59')](_0x251038[_0xb66d('0xf')][_0x1854b3[_0xb66d('0x5a')]][_0xb66d('0x5b')],_0x1854b3);if(_0xf7ac86['isValid']){_0x338c5a(ut[_0xb66d('0x39')](_0xb66d('0x5c')));}else{_0x134637(ut[_0xb66d('0x39')](_0xf7ac86['message']));}});};function originate(_0x5f5bb7,_0x546a40,_0x3abcf8){return new BPromise(function(_0x4e0608,_0x4803e4){if(_0x3abcf8){var _0x3470c2=util[_0xb66d('0x5d')](_0xb66d('0x5e'),path[_0xb66d('0x3a')](_0x5f5bb7[_0xb66d('0x5')])[_0xb66d('0x26')],_0x5f5bb7[_0xb66d('0x5')]);gs[_0xb66d('0x5f')](_0x3470c2)[_0xb66d('0x45')](function(){_0x5f5bb7[_0xb66d('0x5')]=util[_0xb66d('0x5d')](_0xb66d('0x60'),path[_0xb66d('0x3a')](_0x5f5bb7[_0xb66d('0x5')])[_0xb66d('0x61')],path[_0xb66d('0x3a')](_0x5f5bb7['path'])['name']);_0x546a40[_0xb66d('0x62')]=_0x5f5bb7['path'];ut['logger'](_0xb66d('0x63'),'');ami['Action'](ut[_0xb66d('0x64')](_0x5f5bb7,_0x546a40))['then'](function(_0x3931d3){_0x4e0608(_0x3931d3);})[_0xb66d('0x3e')](function(_0x5177a6){_0x4803e4(_0x5177a6);});})[_0xb66d('0x3e')](function(_0x5a3295){_0x4803e4(_0x5a3295);});}else{ami[_0xb66d('0x65')](ut[_0xb66d('0x64')](_0x5f5bb7,_0x546a40))[_0xb66d('0x45')](function(_0x3273e5){_0x4e0608(_0x3273e5);})['catch'](function(_0x53f9ca){_0x4803e4(_0x53f9ca);});}});}Fax[_0xb66d('0x29')]['execOriginate']=function(_0x131419,_0x1187d7){var _0x3d0440=this;return new BPromise(function(_0x4ed570,_0x5df88d){var _0x416e39=uuid['v4']();var _0x259ffa=ut['addVariables'](_0x131419,_0x1187d7);_0x3d0440['actions'][_0x416e39]=new Action(_0x416e39,_0x1187d7,_0x131419);var _0x40f00a=_0x3d0440[_0xb66d('0x11')][_0x416e39];if(path[_0xb66d('0x3a')](_0x131419['path'])[_0xb66d('0x66')]===_0xb66d('0x3b')){originate(_0x40f00a,_0x259ffa,!![])[_0xb66d('0x45')](function(_0x1c04f3){_0x4ed570(_0x1c04f3);})[_0xb66d('0x3e')](function(_0x1d0173){_0x5df88d(_0x1d0173);});}else{originate(_0x40f00a,_0x259ffa,![])['then'](function(_0x3f18ee){_0x4ed570(_0x3f18ee);})[_0xb66d('0x3e')](function(_0x1c4f9d){_0x5df88d(_0x1c4f9d);});}});};Fax[_0xb66d('0x29')]['isTrunkReachable']=function(_0x55f17b){return!_[_0xb66d('0x67')](_0x55f17b)&&!_[_0xb66d('0x67')](_0x55f17b[_0xb66d('0x26')])&&!_['isNil'](_0x55f17b[_0xb66d('0x68')])&&_0x55f17b[_0xb66d('0x68')]&&!_[_0xb66d('0x67')](this[_0xb66d('0x10')][util[_0xb66d('0x5d')](_0xb66d('0x69'),_0x55f17b[_0xb66d('0x26')])])&&!_[_0xb66d('0x67')](this[_0xb66d('0x10')][util[_0xb66d('0x5d')](_0xb66d('0x69'),_0x55f17b[_0xb66d('0x26')])][_0xb66d('0x6a')])&&(this['trunks'][util[_0xb66d('0x5d')](_0xb66d('0x69'),_0x55f17b[_0xb66d('0x26')])][_0xb66d('0x6a')]===_0xb66d('0x6b')||this[_0xb66d('0x10')][util['format']('SIP/%s',_0x55f17b['name'])]['status']===_0xb66d('0x6c'));};Fax[_0xb66d('0x29')][_0xb66d('0x59')]=function(_0x486eb2,_0x5e2a2c){if(!this[_0xb66d('0x6d')](_0x486eb2)){ut['logger'](_0xb66d('0x6e'),_[_0xb66d('0x67')](_0x486eb2)?'':_0x486eb2[_0xb66d('0x26')]+_0xb66d('0x6f'));return{'isValid':![],'message':_0xb66d('0x70')};}if(_['isNil'](_0x5e2a2c['fax'])){ut[_0xb66d('0x46')](_0xb66d('0x71'),JSON['stringify'](_0x5e2a2c));return{'isValid':![],'message':_0xb66d('0x72')};}if(_['isNil'](_0x5e2a2c[_0xb66d('0x5')])){ut['logger'](_0xb66d('0x73'),JSON[_0xb66d('0x74')](_0x5e2a2c));return{'isValid':![],'message':_0xb66d('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xb66d('0x76')]=Fax; \ No newline at end of file +var _0x458e=['[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]'];(function(_0x27bf73,_0xd7cac3){var _0x34fb03=function(_0x17f5ae){while(--_0x17f5ae){_0x27bf73['push'](_0x27bf73['shift']());}};_0x34fb03(++_0xd7cac3);}(_0x458e,0x106));var _0xe458=function(_0x36c10c,_0x1ccee3){_0x36c10c=_0x36c10c-0x0;var _0x25e8ad=_0x458e[_0x36c10c];return _0x25e8ad;};'use strict';var util=require(_0xe458('0x0'));var _=require('lodash');var BPromise=require(_0xe458('0x1'));var uuid=require(_0xe458('0x2'));var moment=require(_0xe458('0x3'));var path=require(_0xe458('0x4'));var tiff2pdf=require(_0xe458('0x5'));var gs=require(_0xe458('0x6'));var logger=require('../../../config/logger')(_0xe458('0x7'));var ami=require(_0xe458('0x8'));var rpcDb=require(_0xe458('0x9'));var Channel=require('./channel');var ut=require(_0xe458('0xa'));var Action=require(_0xe458('0xb'));var faxAccount=require(_0xe458('0xc'));var attachment=require(_0xe458('0xd'));var faxMessage=require(_0xe458('0xe'));function Fax(_0x3b28cf){this[_0xe458('0xf')]={};this['faxAccounts']=_0x3b28cf[_0xe458('0x10')];this[_0xe458('0x11')]=_0x3b28cf[_0xe458('0x11')];this[_0xe458('0x12')]={};ami['on']('newchannel',this[_0xe458('0x13')]['bind'](this));ami['on'](_0xe458('0x14'),this[_0xe458('0x15')][_0xe458('0x16')](this));ami['on'](_0xe458('0x17'),this[_0xe458('0x18')][_0xe458('0x16')](this));ami['on'](_0xe458('0x19'),this['syncNewExten']['bind'](this));ami['on']('faxstatus',this[_0xe458('0x1a')]['bind'](this));ami['on'](_0xe458('0x1b'),this[_0xe458('0x1c')]['bind'](this));ami['on'](_0xe458('0x1d'),this[_0xe458('0x1e')]['bind'](this));ami['on'](_0xe458('0x1f'),this[_0xe458('0x20')]['bind'](this));}Fax['prototype'][_0xe458('0x13')]=function(_0x54f463){if(_0x54f463[_0xe458('0x21')]===_0xe458('0x22')){for(var _0x5e0ea2 in this[_0xe458('0x10')]){if(this[_0xe458('0x10')][_0xe458('0x23')](_0x5e0ea2)){if(_0x54f463['exten']===this['faxAccounts'][_0x5e0ea2][_0xe458('0x24')]){this[_0xe458('0xf')][_0x54f463[_0xe458('0x25')]]={};this[_0xe458('0xf')][_0x54f463[_0xe458('0x25')]][_0xe458('0x26')]=_0x54f463[_0xe458('0x26')];this[_0xe458('0xf')][_0x54f463['uniqueid']]['id']=this[_0xe458('0x10')][_0x5e0ea2]['id'];this[_0xe458('0xf')][_0x54f463[_0xe458('0x25')]][_0xe458('0x27')]=this[_0xe458('0x10')][_0x5e0ea2]['name'];logger[_0xe458('0x28')](_0x54f463[_0xe458('0x25')],_0xe458('0x29'));}}}}if(this[_0xe458('0x12')][_0x54f463['uniqueid']]){this['channels'][_0x54f463[_0xe458('0x25')]]={};this[_0xe458('0xf')][_0x54f463[_0xe458('0x25')]]['channel']=_0x54f463[_0xe458('0x26')];logger[_0xe458('0x28')](_0x54f463[_0xe458('0x25')],'\x20syncNewchannel\x20');}};Fax[_0xe458('0x2a')]['syncVarSet']=function(_0x49656d){if(this[_0xe458('0xf')][_0x49656d[_0xe458('0x25')]]){for(var _0x4cd348 in _0x49656d[_0xe458('0x2b')]){if(_0x49656d[_0xe458('0x2b')][_0xe458('0x23')](_0x4cd348)){this[_0xe458('0xf')][_0x49656d[_0xe458('0x25')]][_0x4cd348]=_0x49656d['value'];}}}};Fax[_0xe458('0x2a')][_0xe458('0x18')]=function(_0x3d26e8){if(this[_0xe458('0xf')][_0x3d26e8[_0xe458('0x25')]]){this[_0xe458('0xf')][_0x3d26e8[_0xe458('0x25')]]['channelstate']=_0x3d26e8[_0xe458('0x2c')];this['channels'][_0x3d26e8[_0xe458('0x25')]]['channelstatedesc']=_0x3d26e8[_0xe458('0x2d')];}};Fax[_0xe458('0x2a')][_0xe458('0x2e')]=function(_0x5e9e88){if(this[_0xe458('0xf')][_0x5e9e88[_0xe458('0x25')]]){for(var _0x276fec in _0x5e9e88[_0xe458('0x2b')]){if(_0x5e9e88[_0xe458('0x2b')][_0xe458('0x23')](_0x276fec)){this['channels'][_0x5e9e88[_0xe458('0x25')]][_0x276fec]=_0x5e9e88[_0xe458('0x2f')];}}}};Fax['prototype'][_0xe458('0x1a')]=function(_0x5c2100){if(this[_0xe458('0xf')][_0x5c2100[_0xe458('0x25')]]){this[_0xe458('0xf')][_0x5c2100[_0xe458('0x25')]][_0xe458('0x30')]=_0x5c2100[_0xe458('0x30')];this[_0xe458('0xf')][_0x5c2100['uniqueid']][_0xe458('0x31')]=_0x5c2100[_0xe458('0x31')];this[_0xe458('0xf')][_0x5c2100[_0xe458('0x25')]]['localstationid']=_0x5c2100['localstationid'];this[_0xe458('0xf')][_0x5c2100[_0xe458('0x25')]]['filename']=_0x5c2100[_0xe458('0x32')];logger[_0xe458('0x28')](_0x5c2100[_0xe458('0x25')],_0xe458('0x33'));}};Fax['prototype'][_0xe458('0x1c')]=function(_0x5cef0f){var _0xbb0e59=this;if(this[_0xe458('0xf')][_0x5cef0f['uniqueid']]){var _0x58b05f=this[_0xe458('0xf')][_0x5cef0f[_0xe458('0x25')]]['id'];this['channels'][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x34')]=_0x5cef0f[_0xe458('0x34')];this[_0xe458('0xf')][_0x5cef0f['uniqueid']][_0xe458('0x35')]=_0x5cef0f[_0xe458('0x35')];this[_0xe458('0xf')][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x24')]=_0x5cef0f['localstationid'];this[_0xe458('0xf')][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x36')]=_0x5cef0f[_0xe458('0x36')];this['channels'][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x37')]=_0x5cef0f[_0xe458('0x37')];this[_0xe458('0xf')][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x32')]=_0x5cef0f['filename'];this[_0xe458('0xf')][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x38')]=_0x5cef0f[_0xe458('0x38')];if(this[_0xe458('0xf')][_0x5cef0f[_0xe458('0x25')]][_0xe458('0x35')]>0x0){tiff2pdf(_0x5cef0f[_0xe458('0x32')],_0xe458('0x39'),function(_0x58946d){logger[_0xe458('0x28')](_0x5cef0f['uniqueid'],_0xe458('0x3a'),_0x58946d['message']);attachment['create']({'name':path[_0xe458('0x3b')](_0x5cef0f[_0xe458('0x32')])[_0xe458('0x27')],'basename':path[_0xe458('0x3b')](_0x5cef0f[_0xe458('0x32')])[_0xe458('0x27')]+_0xe458('0x3c'),'type':_0xe458('0x3d')})[_0xe458('0x3e')](function(_0x3534eb){faxAccount['notify'](_0x58b05f,{'from':_0x5cef0f[_0xe458('0x38')],'mapKey':'fax','body':path[_0xe458('0x3b')](_0x5cef0f[_0xe458('0x32')])[_0xe458('0x27')]+_0xe458('0x3c'),'AttachmentId':_0x3534eb['id']})[_0xe458('0x3f')](function(_0x2c93ca){logger[_0xe458('0x40')](_0x5cef0f['uniqueid'],_0xe458('0x41'),JSON['stringify'](_0x2c93ca));});})[_0xe458('0x3f')](function(_0x2a8465){logger['error'](_0x5cef0f[_0xe458('0x25')],_0xe458('0x42'),JSON[_0xe458('0x43')](_0x2a8465));});});}logger['info'](_0x5cef0f['uniqueid'],_0xe458('0x42'));}};Fax[_0xe458('0x2a')][_0xe458('0x20')]=function(_0x42a609){if(this[_0xe458('0x12')][_0x42a609[_0xe458('0x25')]]){_[_0xe458('0x44')](this[_0xe458('0xf')][_0x42a609[_0xe458('0x25')]],_[_0xe458('0x45')](_0x42a609,[_0xe458('0x46'),_0xe458('0x47')]));}};function updateStatus(_0x1d413f){if(_0x1d413f[_0xe458('0x48')]){faxMessage[_0xe458('0x49')](_0x1d413f[_0xe458('0x48')],{'failMessage':_0xe458('0x4a')})[_0xe458('0x3e')](function(_0x40d55f){ut[_0xe458('0x4b')](_0xe458('0x4c'),_0x40d55f);})[_0xe458('0x3f')](function(_0x3bdbf4){ut['logger'](_0xe458('0x4d'),_0x3bdbf4);});}else{ut[_0xe458('0x4b')](_0xe458('0x4e'));}}Fax[_0xe458('0x2a')]['updateStatus']=function(_0x151b37,_0x58fda6,_0x1646a1){var _0x992f9a=this;var _0x4449e9={};if(_0x58fda6){_0x4449e9={'read':_0x58fda6};}else{_0x4449e9={'failMessage':_0x1646a1};}if(this[_0xe458('0x12')][_0x151b37][_0xe458('0x48')]){faxMessage[_0xe458('0x49')](this[_0xe458('0x12')][_0x151b37]['AttachmentId'],_0x4449e9)[_0xe458('0x3e')](function(_0x3d51d5){ut[_0xe458('0x4b')](_0xe458('0x4f'),_0x3d51d5);})['catch'](function(_0x568e98){ut['logger'](_0xe458('0x50'),_0x568e98);})['finally'](function(){delete _0x992f9a[_0xe458('0xf')][_0x151b37];delete _0x992f9a[_0xe458('0x12')][_0x151b37];});}else{ut['logger'](_0xe458('0x51'));delete this['channels'][_0x151b37];delete this[_0xe458('0x12')][_0x151b37];}};Fax['prototype'][_0xe458('0x1e')]=function(_0x555e89){var _0x20fbb=this;if(this[_0xe458('0xf')][_0x555e89[_0xe458('0x25')]]){if(this[_0xe458('0x12')][_0x555e89[_0xe458('0x25')]]){this[_0xe458('0xf')][_0x555e89[_0xe458('0x25')]]['id']=this[_0xe458('0x12')][_0x555e89[_0xe458('0x25')]]['id'];this[_0xe458('0xf')][_0x555e89['uniqueid']][_0xe458('0x27')]=this[_0xe458('0x12')][_0x555e89[_0xe458('0x25')]][_0xe458('0x27')];}logger[_0xe458('0x28')](_0x555e89[_0xe458('0x25')],this[_0xe458('0x12')][_0x555e89[_0xe458('0x25')]]?_0xe458('0x52'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0xe458('0xf')][_0x555e89[_0xe458('0x25')]]));if(this[_0xe458('0x12')][_0x555e89[_0xe458('0x25')]]){if(this[_0xe458('0xf')][_0x555e89[_0xe458('0x25')]][_0xe458('0x53')]>0x0&&this[_0xe458('0xf')][_0x555e89[_0xe458('0x25')]][_0xe458('0x54')]===_0xe458('0x55')){this[_0xe458('0x56')](_0x555e89[_0xe458('0x25')],!![]);}else{this[_0xe458('0x56')](_0x555e89[_0xe458('0x25')],![],this[_0xe458('0xf')][_0x555e89['uniqueid']][_0xe458('0x57')]?'SENDING\x20FAILED:\x20'+this[_0xe458('0xf')][_0x555e89[_0xe458('0x25')]]['faxstatusstring']:_0xe458('0x58'));}}}};Fax[_0xe458('0x2a')]['send']=function(_0x110ff0){var _0x593fcd=this;return new BPromise(function(_0x1936bb,_0x3db4de){_0x593fcd[_0xe458('0x59')](_0x110ff0,_0x593fcd['faxAccounts'][_0x110ff0['FaxAccountId']])[_0xe458('0x3e')](function(_0x2b066f){ut[_0xe458('0x4b')](_0xe458('0x5a'),_0x2b066f);_0x1936bb(ut[_0xe458('0x5b')](_0xe458('0x5c')));})[_0xe458('0x3f')](function(_0x274003){ut[_0xe458('0x4b')]('[Fax][execOriginate][failure]',_0x274003);updateStatus(_0x110ff0);_0x3db4de(ut[_0xe458('0x5b')]('Fax\x20failed'));});});};Fax[_0xe458('0x2a')][_0xe458('0x5d')]=function(_0x374c5a){var _0x55e470=this;return new BPromise(function(_0x2877c7,_0x4c2836){var _0x4ad3fe=_0x55e470[_0xe458('0x5e')](_0x55e470['faxAccounts'][_0x374c5a['FaxAccountId']][_0xe458('0x5f')],_0x374c5a);if(_0x4ad3fe[_0xe458('0x60')]){_0x2877c7(ut[_0xe458('0x5b')](_0xe458('0x61')));}else{_0x4c2836(ut[_0xe458('0x5b')](_0x4ad3fe[_0xe458('0x5b')]));}});};function originate(_0x43a16b,_0x161d3c,_0x19aeba){return new BPromise(function(_0x32bf6f,_0x3eefdd){if(_0x19aeba){var _0xfcc9ce=util['format'](_0xe458('0x62'),path[_0xe458('0x3b')](_0x43a16b[_0xe458('0x4')])[_0xe458('0x27')],_0x43a16b['path']);gs['execute'](_0xfcc9ce)[_0xe458('0x3e')](function(){_0x43a16b[_0xe458('0x4')]=util[_0xe458('0x63')](_0xe458('0x64'),path['parse'](_0x43a16b[_0xe458('0x4')])['dir'],path[_0xe458('0x3b')](_0x43a16b[_0xe458('0x4')])[_0xe458('0x27')]);_0x161d3c[_0xe458('0x65')]=_0x43a16b['path'];ut['logger'](_0xe458('0x66'),'');ami[_0xe458('0x67')](ut[_0xe458('0x68')](_0x43a16b,_0x161d3c))['then'](function(_0x167375){_0x32bf6f(_0x167375);})['catch'](function(_0x527aea){_0x3eefdd(_0x527aea);});})[_0xe458('0x3f')](function(_0x5245ae){_0x3eefdd(_0x5245ae);});}else{ami[_0xe458('0x67')](ut[_0xe458('0x68')](_0x43a16b,_0x161d3c))['then'](function(_0x62e345){_0x32bf6f(_0x62e345);})[_0xe458('0x3f')](function(_0x216fe5){_0x3eefdd(_0x216fe5);});}});}Fax['prototype']['execOriginate']=function(_0x90d7c2,_0x4be043){var _0x4faf25=this;return new BPromise(function(_0xe054dd,_0x59aac1){var _0x2e1daf=uuid['v4']();var _0x1f4720=ut['addVariables'](_0x90d7c2,_0x4be043);_0x4faf25['actions'][_0x2e1daf]=new Action(_0x2e1daf,_0x4be043,_0x90d7c2);var _0x10f50d=_0x4faf25['actions'][_0x2e1daf];if(path['parse'](_0x90d7c2[_0xe458('0x4')])['ext']==='.pdf'){originate(_0x10f50d,_0x1f4720,!![])[_0xe458('0x3e')](function(_0x5b657b){_0xe054dd(_0x5b657b);})[_0xe458('0x3f')](function(_0x444fbc){_0x59aac1(_0x444fbc);});}else{originate(_0x10f50d,_0x1f4720,![])[_0xe458('0x3e')](function(_0x19db61){_0xe054dd(_0x19db61);})['catch'](function(_0x3ae25d){_0x59aac1(_0x3ae25d);});}});};Fax[_0xe458('0x2a')][_0xe458('0x69')]=function(_0x14032b){return!_['isNil'](_0x14032b)&&!_[_0xe458('0x6a')](_0x14032b[_0xe458('0x27')])&&!_['isNil'](_0x14032b['active'])&&_0x14032b['active']&&!_[_0xe458('0x6a')](this['trunks'][util[_0xe458('0x63')](_0xe458('0x6b'),_0x14032b['name'])])&&!_['isNil'](this[_0xe458('0x11')][util[_0xe458('0x63')](_0xe458('0x6b'),_0x14032b[_0xe458('0x27')])][_0xe458('0x31')])&&(this[_0xe458('0x11')][util['format'](_0xe458('0x6b'),_0x14032b[_0xe458('0x27')])]['status']==='reachable'||this[_0xe458('0x11')][util[_0xe458('0x63')]('SIP/%s',_0x14032b[_0xe458('0x27')])][_0xe458('0x31')]==='unmonitored');};Fax[_0xe458('0x2a')][_0xe458('0x5e')]=function(_0x578e2c,_0x522c12){if(!this[_0xe458('0x69')](_0x578e2c)){ut[_0xe458('0x4b')](_0xe458('0x6c'),_[_0xe458('0x6a')](_0x578e2c)?'':_0x578e2c[_0xe458('0x27')]+_0xe458('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xe458('0x6a')](_0x522c12[_0xe458('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xe458('0x43')](_0x522c12));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xe458('0x6a')](_0x522c12[_0xe458('0x4')])){ut[_0xe458('0x4b')](_0xe458('0x6e'),JSON['stringify'](_0x522c12));return{'isValid':![],'message':_0xe458('0x6f')};}return{'isValid':!![],'message':_0xe458('0x70')};};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 183ce4a..281b111 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 _0x2fbf=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','../../../config/logger','preview'];(function(_0x5b334a,_0x5bb06a){var _0x3b3c32=function(_0x49ed1d){while(--_0x49ed1d){_0x5b334a['push'](_0x5b334a['shift']());}};_0x3b3c32(++_0x5bb06a);}(_0x2fbf,0x153));var _0xf2fb=function(_0x99370e,_0x3a1b2d){_0x99370e=_0x99370e-0x0;var _0x532bbf=_0x2fbf[_0x99370e];return _0x532bbf;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xf2fb('0x0'))(_0xf2fb('0x1'));var _=require(_0xf2fb('0x2'));var faxAccount=require(_0xf2fb('0x3'));function loggerCatch(_0x4b80f9){return function(_0xdb3e68){logger[_0xf2fb('0x4')](_0x4b80f9,util[_0xf2fb('0x5')](_0xdb3e68,{'showHidden':![],'depth':null}));};}exports[_0xf2fb('0x6')]=function(_0x1b025f,_0x15ab7c){return BPromise[_0xf2fb('0x7')]()[_0xf2fb('0x8')](faxAccount[_0xf2fb('0x6')](_0x1b025f,_0x15ab7c))[_0xf2fb('0x9')](loggerCatch(_0xf2fb('0xa')));}; \ No newline at end of file +var _0x898b=['preview','lodash','../rpc/faxAccount','inspect','resolve','then','notify','[Notify]\x20','bluebird','../../../config/logger'];(function(_0x3dc16f,_0x5e7b05){var _0x2bfa63=function(_0x27e3c4){while(--_0x27e3c4){_0x3dc16f['push'](_0x3dc16f['shift']());}};_0x2bfa63(++_0x5e7b05);}(_0x898b,0xa8));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0xb898('0x0'));var logger=require(_0xb898('0x1'))(_0xb898('0x2'));var _=require(_0xb898('0x3'));var faxAccount=require(_0xb898('0x4'));function loggerCatch(_0xbb9e97){return function(_0x3d9fdf){logger['error'](_0xbb9e97,util[_0xb898('0x5')](_0x3d9fdf,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x593837,_0xd35afa){return BPromise[_0xb898('0x6')]()[_0xb898('0x7')](faxAccount[_0xb898('0x8')](_0x593837,_0xd35afa))['catch'](loggerCatch(_0xb898('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index ddbb688..193e540 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 _0xddba=['fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xddba,0x166));var _0xaddb=function(_0x403490,_0x235bf4){_0x403490=_0x403490-0x0;var _0x24c015=_0xddba[_0x403490];return _0x24c015;};'use strict';var util=require(_0xaddb('0x0'));var logger=require(_0xaddb('0x1'))(_0xaddb('0x2'));var BPromise=require('bluebird');var exec=require(_0xaddb('0x3'))[_0xaddb('0x4')];exports[_0xaddb('0x5')]=function(_0x233fe7){return new BPromise(function(_0x36beef,_0x37309b){exec(_0x233fe7,function(_0x428a3a,_0x4e391e,_0x1b3a99){logger[_0xaddb('0x6')](_0xaddb('0x7'),_0x4e391e);if(_0x428a3a){logger[_0xaddb('0x6')](_0xaddb('0x7'),_0xaddb('0x8'),util[_0xaddb('0x9')](_0x428a3a,{'showHidden':![],'depth':null}),_0x4e391e,_0x1b3a99);_0x37309b(_0x428a3a);}_0x36beef(_0x4e391e);});});}; \ No newline at end of file +var _0x333e=['inspect','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x14fa6e,_0x11a8b0){var _0xe008b5=function(_0x1e18d7){while(--_0x1e18d7){_0x14fa6e['push'](_0x14fa6e['shift']());}};_0xe008b5(++_0x11a8b0);}(_0x333e,0x196));var _0xe333=function(_0x249f39,_0x5d8b06){_0x249f39=_0x249f39-0x0;var _0x56bd3a=_0x333e[_0x249f39];return _0x56bd3a;};'use strict';var util=require('util');var logger=require(_0xe333('0x0'))(_0xe333('0x1'));var BPromise=require(_0xe333('0x2'));var exec=require(_0xe333('0x3'))['exec'];exports[_0xe333('0x4')]=function(_0x1f8ed8){return new BPromise(function(_0x1426d5,_0xea8bd3){exec(_0x1f8ed8,function(_0x3e988e,_0x225ad8,_0x1bad87){logger[_0xe333('0x5')](_0xe333('0x6'),_0x225ad8);if(_0x3e988e){logger[_0xe333('0x5')]('Exec\x20gs',_0xe333('0x7'),util[_0xe333('0x8')](_0x3e988e,{'showHidden':![],'depth':null}),_0x225ad8,_0x1bad87);_0xea8bd3(_0x3e988e);}_0x1426d5(_0x225ad8);});});}; \ 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 c4de78d..fdbc3c9 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 _0x750a=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','lodash','fax','message','logger','info','inspect','addVariables','ecm','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','variablesAction','uniqueid','channel'];(function(_0x3b6b8e,_0x5d127a){var _0x5c40ed=function(_0x5b0fce){while(--_0x5b0fce){_0x3b6b8e['push'](_0x3b6b8e['shift']());}};_0x5c40ed(++_0x5d127a);}(_0x750a,0x140));var _0xa750=function(_0x4906ca,_0x7cb8c0){_0x4906ca=_0x4906ca-0x0;var _0x493642=_0x750a[_0x4906ca];return _0x493642;};'use strict';var util=require('util');var _=require(_0xa750('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xa750('0x1'));exports[_0xa750('0x2')]=function(_0x1b459c){return{'message':_0x1b459c};};exports[_0xa750('0x3')]=function(_0x457cae,_0x43d704){logger[_0xa750('0x4')](_0x457cae,util[_0xa750('0x5')](_0x43d704,{'showHidden':![],'depth':null}));};exports[_0xa750('0x6')]=function(_0x2497df,_0x197299){var _0x1ae455={'XMF-ECM':_0x197299[_0xa750('0x7')],'XMF-HEADERINFO':_0x197299['headerinfo'],'XMF-MINRATE':_0x197299['minrate'],'XMF-MAXRATE':_0x197299[_0xa750('0x8')],'XMF-MODEM':util['format'](_0xa750('0x9'),_0x197299[_0xa750('0xa')]),'XMF-GATEWAY':_0x197299['gateway'],'XMF-FAXDETECT':_0x197299[_0xa750('0xb')],'XMF-T38TIMEOUT':_0x197299[_0xa750('0xc')],'XMF-LOCALSTATIONID':_0x197299['localstationid'],'XMF-PATH':_0x2497df['path']};return _0x1ae455;};exports[_0xa750('0xd')]=function(_0x4b19a1,_0x174fd0){return{'actionid':_0x4b19a1[_0xa750('0xe')],'action':'originate','channel':_0x4b19a1[_0xa750('0xf')],'Exten':_0xa750('0x10'),'Context':_0xa750('0x11'),'Priority':'1','callerid':util['format'](_0xa750('0x12'),_0x4b19a1[_0xa750('0x13')]?_0x4b19a1[_0xa750('0x13')]:'',_0x4b19a1[_0xa750('0x14')]),'variable':_0x174fd0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b19a1[_0xa750('0xe')]};}; \ No newline at end of file +var _0x5b02=['\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','info','inspect','addVariables','headerinfo','format'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x5b02,0xe9));var _0x25b0=function(_0x15a130,_0x598dc9){_0x15a130=_0x15a130-0x0;var _0x2d86f9=_0x5b02[_0x15a130];return _0x2d86f9;};'use strict';var util=require(_0x25b0('0x0'));var _=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var logger=require(_0x25b0('0x3'))('fax');exports['message']=function(_0x2b5f2d){return{'message':_0x2b5f2d};};exports['logger']=function(_0x3e1d20,_0x31c9c2){logger[_0x25b0('0x4')](_0x3e1d20,util[_0x25b0('0x5')](_0x31c9c2,{'showHidden':![],'depth':null}));};exports[_0x25b0('0x6')]=function(_0x4eea55,_0x1d82c6){var _0xd8276d={'XMF-ECM':_0x1d82c6['ecm'],'XMF-HEADERINFO':_0x1d82c6[_0x25b0('0x7')],'XMF-MINRATE':_0x1d82c6['minrate'],'XMF-MAXRATE':_0x1d82c6['maxrate'],'XMF-MODEM':util[_0x25b0('0x8')](_0x25b0('0x9'),_0x1d82c6[_0x25b0('0xa')]),'XMF-GATEWAY':_0x1d82c6['gateway'],'XMF-FAXDETECT':_0x1d82c6[_0x25b0('0xb')],'XMF-T38TIMEOUT':_0x1d82c6[_0x25b0('0xc')],'XMF-LOCALSTATIONID':_0x1d82c6[_0x25b0('0xd')],'XMF-PATH':_0x4eea55[_0x25b0('0xe')]};return _0xd8276d;};exports[_0x25b0('0xf')]=function(_0x2f57af,_0x44afbc){return{'actionid':_0x2f57af[_0x25b0('0x10')],'action':_0x25b0('0x11'),'channel':_0x2f57af[_0x25b0('0x12')],'Exten':_0x25b0('0x13'),'Context':_0x25b0('0x14'),'Priority':'1','callerid':util[_0x25b0('0x8')](_0x25b0('0x15'),_0x2f57af[_0x25b0('0x7')]?_0x2f57af[_0x25b0('0x7')]:'',_0x2f57af[_0x25b0('0xd')]),'variable':_0x44afbc,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2f57af[_0x25b0('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 623a274..e7140e8 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 _0xea71=['getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','sync','catch','bluebird','moment','./server','./realtime','./report','./acw','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initVoiceQueueReports'];(function(_0x43044e,_0x5725d6){var _0x1c6b54=function(_0x5d1a1b){while(--_0x5d1a1b){_0x43044e['push'](_0x43044e['shift']());}};_0x1c6b54(++_0x5725d6);}(_0xea71,0x151));var _0x1ea7=function(_0x486aad,_0x8048d1){_0x486aad=_0x486aad-0x0;var _0x4b3169=_0xea71[_0x486aad];return _0x4b3169;};'use strict';var BPromise=require(_0x1ea7('0x0'));var util=require('util');var moment=require(_0x1ea7('0x1'));var server=require(_0x1ea7('0x2'));var Realtime=require(_0x1ea7('0x3'));var Report=require(_0x1ea7('0x4'));var Acw=require(_0x1ea7('0x5'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x1ea7('0x6'));var voiceQueue=require(_0x1ea7('0x7'));var voiceQueueReport=require(_0x1ea7('0x8'));var voiceCallReport=require(_0x1ea7('0x9'));var trunk=require(_0x1ea7('0xa'));var trigger=require(_0x1ea7('0xb'));var template=require(_0x1ea7('0xc'));var cmHopperHistory=require(_0x1ea7('0xd'));var campaign=require(_0x1ea7('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x1ea7('0xf'));var zendesk=require(_0x1ea7('0x10'));var salesforce=require(_0x1ea7('0x11'));var sugarcrm=require(_0x1ea7('0x12'));var freshdesk=require(_0x1ea7('0x13'));var desk=require(_0x1ea7('0x14'));var zoho=require(_0x1ea7('0x15'));var vtiger=require(_0x1ea7('0x16'));var freshsales=require(_0x1ea7('0x17'));var servicenow=require(_0x1ea7('0x18'));var dynamics365=require(_0x1ea7('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1ea7('0x1a')](_0x1ea7('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1ea7('0x1c')]()[_0x1ea7('0x1d')](user[_0x1ea7('0x1e')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x1f')]())['then'](user[_0x1ea7('0x20')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x21')]())[_0x1ea7('0x1d')](trunk[_0x1ea7('0x22')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x23')]())['then'](voiceQueue['getVoiceQueues']())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x24')]())[_0x1ea7('0x1d')](trigger[_0x1ea7('0x25')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x26')]())['then'](template[_0x1ea7('0x27')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x28')]())['then'](zendesk[_0x1ea7('0x29')]())[_0x1ea7('0x1d')](realtime['initZendeskAccounts']())[_0x1ea7('0x1d')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x1ea7('0x2a')]())[_0x1ea7('0x1d')](sugarcrm[_0x1ea7('0x2b')]())['then'](realtime[_0x1ea7('0x2c')]())[_0x1ea7('0x1d')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x1ea7('0x2d')]())['then'](desk[_0x1ea7('0x2e')]())['then'](realtime[_0x1ea7('0x2f')]())['then'](zoho[_0x1ea7('0x30')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x31')]())[_0x1ea7('0x1d')](vtiger[_0x1ea7('0x32')]())[_0x1ea7('0x1d')](realtime['initVtigerAccounts']())[_0x1ea7('0x1d')](freshsales[_0x1ea7('0x33')]())['then'](realtime[_0x1ea7('0x34')]())['then'](servicenow['getServicenowAccounts']())[_0x1ea7('0x1d')](realtime['initServicenowAccounts']())[_0x1ea7('0x1d')](dynamics365[_0x1ea7('0x35')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x36')]())[_0x1ea7('0x1d')](campaign['getCampaigns']())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x37')]())[_0x1ea7('0x1d')](voiceExtension[_0x1ea7('0x38')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x39')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())[_0x1ea7('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x1ea7('0x1c')]()[_0x1ea7('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x3a')]())['then'](cmHopperHistory[_0x1ea7('0x3b')]())[_0x1ea7('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x1ea7('0x1d')](cmHopperHistory[_0x1ea7('0x3c')]())[_0x1ea7('0x1d')](realtime['initCampaignHopperHistory']())[_0x1ea7('0x1d')](voiceCallReport[_0x1ea7('0x3d')]())[_0x1ea7('0x1d')](realtime[_0x1ea7('0x3e')]())[_0x1ea7('0x1d')](function(_0x3512bb){})['catch'](function(_0x270e09){console[_0x1ea7('0x3f')](_0x270e09);});}function main(){return server['listen'](realtime,preview,fax)[_0x1ea7('0x1d')](function(_0x48b0d5){return initRealtime();})['then'](function(){return initParams();})[_0x1ea7('0x1d')](function(){report[_0x1ea7('0x40')]();setInterval(initRealtime,0x1388);})[_0x1ea7('0x41')](function(_0x1b66e9){console['log'](_0x1b66e9);});}main(); \ No newline at end of file +var _0x4fac=['initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x4fac,0xd8));var _0xc4fa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fac[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require('bluebird');var util=require(_0xc4fa('0x0'));var moment=require(_0xc4fa('0x1'));var server=require('./server');var Realtime=require(_0xc4fa('0x2'));var Report=require(_0xc4fa('0x3'));var Acw=require(_0xc4fa('0x4'));var Trigger=require(_0xc4fa('0x5'));var Dialer=require(_0xc4fa('0x6'));var Preview=require(_0xc4fa('0x7'));var Fax=require(_0xc4fa('0x8'));var user=require(_0xc4fa('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xc4fa('0xa'));var voiceCallReport=require(_0xc4fa('0xb'));var trunk=require(_0xc4fa('0xc'));var trigger=require(_0xc4fa('0xd'));var template=require(_0xc4fa('0xe'));var cmHopperHistory=require(_0xc4fa('0xf'));var campaign=require(_0xc4fa('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc4fa('0x11'));var sugarcrm=require(_0xc4fa('0x12'));var freshdesk=require(_0xc4fa('0x13'));var desk=require(_0xc4fa('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xc4fa('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xc4fa('0x16'));var dynamics365=require(_0xc4fa('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc4fa('0x18')](_0xc4fa('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc4fa('0x18')](_0xc4fa('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xc4fa('0x1a')](user[_0xc4fa('0x1b')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x1c')]())[_0xc4fa('0x1a')](user[_0xc4fa('0x1d')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x1e')]())[_0xc4fa('0x1a')](trunk[_0xc4fa('0x1f')]())['then'](realtime[_0xc4fa('0x20')]())['then'](voiceQueue[_0xc4fa('0x21')]())['then'](realtime[_0xc4fa('0x22')]())[_0xc4fa('0x1a')](trigger[_0xc4fa('0x23')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x24')]())[_0xc4fa('0x1a')](template[_0xc4fa('0x25')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x26')]())[_0xc4fa('0x1a')](zendesk[_0xc4fa('0x27')]())['then'](realtime[_0xc4fa('0x28')]())[_0xc4fa('0x1a')](salesforce[_0xc4fa('0x29')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x2a')]())[_0xc4fa('0x1a')](sugarcrm[_0xc4fa('0x2b')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x2c')]())[_0xc4fa('0x1a')](freshdesk[_0xc4fa('0x2d')]())[_0xc4fa('0x1a')](realtime['initFreshdeskAccounts']())[_0xc4fa('0x1a')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())['then'](zoho[_0xc4fa('0x2e')]())[_0xc4fa('0x1a')](realtime['initZohoAccounts']())[_0xc4fa('0x1a')](vtiger[_0xc4fa('0x2f')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x30')]())[_0xc4fa('0x1a')](freshsales[_0xc4fa('0x31')]())[_0xc4fa('0x1a')](realtime['initFreshsalesAccounts']())[_0xc4fa('0x1a')](servicenow['getServicenowAccounts']())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x32')]())[_0xc4fa('0x1a')](dynamics365[_0xc4fa('0x33')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x34')]())[_0xc4fa('0x1a')](campaign['getCampaigns']())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x35')]())[_0xc4fa('0x1a')](voiceExtension[_0xc4fa('0x36')]())['then'](realtime[_0xc4fa('0x37')]())[_0xc4fa('0x1a')](faxAccount['getFaxAccounts']())['then'](realtime[_0xc4fa('0x38')]())[_0xc4fa('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0xc4fa('0x39')]()[_0xc4fa('0x1a')](voiceQueueReport[_0xc4fa('0x3a')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x3b')]())[_0xc4fa('0x1a')](cmHopperHistory[_0xc4fa('0x3c')]())[_0xc4fa('0x1a')](realtime[_0xc4fa('0x3d')]())[_0xc4fa('0x1a')](cmHopperHistory[_0xc4fa('0x3e')]())['then'](realtime[_0xc4fa('0x3f')]())[_0xc4fa('0x1a')](voiceCallReport[_0xc4fa('0x40')]())[_0xc4fa('0x1a')](realtime['initVoiceCallReports']())[_0xc4fa('0x1a')](function(_0x5a5fd0){})[_0xc4fa('0x41')](function(_0x43e13c){console[_0xc4fa('0x42')](_0x43e13c);});}function main(){return server[_0xc4fa('0x43')](realtime,preview,fax)[_0xc4fa('0x1a')](function(_0xf52eb){return initRealtime();})[_0xc4fa('0x1a')](function(){return initParams();})[_0xc4fa('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xc4fa('0x41')](function(_0x12718d){console[_0xc4fa('0x42')](_0x12718d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 9a046f7..54c1950 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 _0xa73c=['fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','format','accountcode','stringify','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email'];(function(_0x4c2894,_0x59c969){var _0x47df81=function(_0x4313d0){while(--_0x4313d0){_0x4c2894['push'](_0x4c2894['shift']());}};_0x47df81(++_0x59c969);}(_0xa73c,0x18d));var _0xca73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa73c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xca73('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0xca73('0x1'));var Redis=require(_0xca73('0x2'));var config=require(_0xca73('0x3'));config[_0xca73('0x4')]=_[_0xca73('0x5')](config[_0xca73('0x4')],{'host':_0xca73('0x6'),'port':0x18eb});var io=require(_0xca73('0x7'))(new Redis(config[_0xca73('0x4')]));function Agent(_0x152ff4){this['id']=_0x152ff4['id']||0x0;this[_0xca73('0x8')]=_0x152ff4[_0xca73('0x8')]||'';this[_0xca73('0x9')]=_0x152ff4['email']||'';this['accountcode']=_0x152ff4['accountcode']||'';this[_0xca73('0xa')]=_0x152ff4[_0xca73('0xa')]||'';this[_0xca73('0xb')]=_0xca73('0xc');this[_0xca73('0xd')]=0x0;this[_0xca73('0xe')]=_0xca73('0xc');this[_0xca73('0xf')]='';this['phone']='';this[_0xca73('0x10')]='';this[_0xca73('0x11')]='';this['online']=_0x152ff4[_0xca73('0x12')]||![];this[_0xca73('0x13')]=_0xca73('0xc');this[_0xca73('0x14')]=0x0;this[_0xca73('0x15')]='';this['voiceStatusQueue']='';this[_0xca73('0x16')]=![];this['local']=![];this['md5']='';}Agent[_0xca73('0x17')][_0xca73('0x18')]=function(_0x232c0a){var _0x5e20c0;if(_0x232c0a&&_0x232c0a['state']){_0x5e20c0=_0x232c0a[_0xca73('0xb')][_0xca73('0x19')]();switch(_0x5e20c0){case _0xca73('0x1a'):_0x5e20c0='idle';break;case _0xca73('0x1b'):_0x5e20c0=_0xca73('0x1c');break;}}if(_0x5e20c0&&this[_0xca73('0x13')]!==_0x5e20c0||_0x232c0a[_0xca73('0x1d')]){this[_0xca73('0x14')]=_[_0xca73('0x1e')](moment()[_0xca73('0x1f')]('x'));}if(_0x5e20c0){this[_0xca73('0x13')]=_0x5e20c0;}var _0x573b6b={'id':this['id'],'name':this[_0xca73('0x8')],'email':this[_0xca73('0x9')],'accountcode':this[_0xca73('0x20')],'fullname':this['fullname'],'state':this[_0xca73('0xb')],'stateTime':this['stateTime'],'status':this[_0xca73('0xe')],'address':this[_0xca73('0xf')],'online':this[_0xca73('0x12')],'voiceStatus':this[_0xca73('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xca73('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xca73('0x11')],'onhold':this[_0xca73('0x16')]};var _0x207d60=md5(JSON[_0xca73('0x21')](_0x573b6b));if(this[_0xca73('0x1')]!==_0x207d60){this[_0xca73('0x1')]=_0x207d60;io['to'](util[_0xca73('0x1f')]('user:%s',_0x573b6b[_0xca73('0x8')]))[_0xca73('0x22')](_0xca73('0x23'),_0x573b6b);}};module[_0xca73('0x24')]=Agent; \ No newline at end of file +var _0x5c9f=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','address','phone','interface','online','voiceStatus','unknown','voiceStatusTime','onhold','local','updateStatusRealtime','not_inuse','idle','talking','statePause','toNumber','format','voiceStatusCallerIdNumber','voiceStatusQueue','stringify','user:%s','emit','user:save','lodash','moment','md5'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c9f,0x1c5));var _0xf5c9=function(_0x2bfc60,_0xa254ab){_0x2bfc60=_0x2bfc60-0x0;var _0x44ea2c=_0x5c9f[_0x2bfc60];return _0x44ea2c;};'use strict';var _=require(_0xf5c9('0x0'));var util=require('util');var moment=require(_0xf5c9('0x1'));var md5=require(_0xf5c9('0x2'));var Redis=require(_0xf5c9('0x3'));var config=require(_0xf5c9('0x4'));config[_0xf5c9('0x5')]=_[_0xf5c9('0x6')](config[_0xf5c9('0x5')],{'host':_0xf5c9('0x7'),'port':0x18eb});var io=require(_0xf5c9('0x8'))(new Redis(config[_0xf5c9('0x5')]));function Agent(_0x3c283e){this['id']=_0x3c283e['id']||0x0;this[_0xf5c9('0x9')]=_0x3c283e[_0xf5c9('0x9')]||'';this['email']=_0x3c283e[_0xf5c9('0xa')]||'';this[_0xf5c9('0xb')]=_0x3c283e[_0xf5c9('0xb')]||'';this[_0xf5c9('0xc')]=_0x3c283e[_0xf5c9('0xc')]||'';this[_0xf5c9('0xd')]='unknown';this[_0xf5c9('0xe')]=0x0;this[_0xf5c9('0xf')]='unknown';this[_0xf5c9('0x10')]='';this[_0xf5c9('0x11')]='';this['mobile']='';this[_0xf5c9('0x12')]='';this[_0xf5c9('0x13')]=_0x3c283e[_0xf5c9('0x13')]||![];this[_0xf5c9('0x14')]=_0xf5c9('0x15');this[_0xf5c9('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0xf5c9('0x17')]=![];this[_0xf5c9('0x18')]=![];this[_0xf5c9('0x2')]='';}Agent['prototype'][_0xf5c9('0x19')]=function(_0x2ed151){var _0x46ac33;if(_0x2ed151&&_0x2ed151[_0xf5c9('0xd')]){_0x46ac33=_0x2ed151[_0xf5c9('0xd')]['toLowerCase']();switch(_0x46ac33){case _0xf5c9('0x1a'):_0x46ac33=_0xf5c9('0x1b');break;case'inuse':_0x46ac33=_0xf5c9('0x1c');break;}}if(_0x46ac33&&this['voiceStatus']!==_0x46ac33||_0x2ed151[_0xf5c9('0x1d')]){this[_0xf5c9('0x16')]=_[_0xf5c9('0x1e')](moment()[_0xf5c9('0x1f')]('x'));}if(_0x46ac33){this[_0xf5c9('0x14')]=_0x46ac33;}var _0x3b4ddd={'id':this['id'],'name':this[_0xf5c9('0x9')],'email':this[_0xf5c9('0xa')],'accountcode':this[_0xf5c9('0xb')],'fullname':this[_0xf5c9('0xc')],'state':this[_0xf5c9('0xd')],'stateTime':this[_0xf5c9('0xe')],'status':this[_0xf5c9('0xf')],'address':this[_0xf5c9('0x10')],'online':this['online'],'voiceStatus':this[_0xf5c9('0x14')],'voiceStatusTime':this[_0xf5c9('0x16')],'voiceStatusCallerIdNumber':this[_0xf5c9('0x20')],'voiceStatusQueue':this[_0xf5c9('0x21')],'interface':this[_0xf5c9('0x12')],'onhold':this[_0xf5c9('0x17')]};var _0x197b19=md5(JSON[_0xf5c9('0x22')](_0x3b4ddd));if(this[_0xf5c9('0x2')]!==_0x197b19){this[_0xf5c9('0x2')]=_0x197b19;io['to'](util[_0xf5c9('0x1f')](_0xf5c9('0x23'),_0x3b4ddd[_0xf5c9('0x9')]))[_0xf5c9('0x24')](_0xf5c9('0x25'),_0x3b4ddd);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6a451cd..11ab15a 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 _0x3c66=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0xbac7e2,_0x40fe60){var _0x3ee190=function(_0x4233c9){while(--_0x4233c9){_0xbac7e2['push'](_0xbac7e2['shift']());}};_0x3ee190(++_0x40fe60);}(_0x3c66,0xdc));var _0x63c6=function(_0x4e9872,_0x41cf20){_0x4e9872=_0x4e9872-0x0;var _0x375c79=_0x3c66[_0x4e9872];return _0x375c79;};'use strict';function Campaign(_0x12548d){this['id']=_0x12548d['id']||0x0;this[_0x63c6('0x0')]=_0x12548d['name']||'';this[_0x63c6('0x1')]=_0x12548d[_0x63c6('0x1')]||_0x63c6('0x2');this[_0x63c6('0x3')]=0x0;this[_0x63c6('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x63c6('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x63c6('0x6')]=_0x12548d[_0x63c6('0x6')];this[_0x63c6('0x7')]=_0x12548d['limitCalls'];this[_0x63c6('0x8')]=_0x12548d[_0x63c6('0x8')]||null;this[_0x63c6('0x9')]=_0x12548d['dialGlobalInterval']?_0x12548d[_0x63c6('0x9')]:null;this[_0x63c6('0xa')]=_0x12548d[_0x63c6('0xa')];this['dialOriginateCallerIdNumber']=_0x12548d[_0x63c6('0xb')];this[_0x63c6('0xc')]=_0x12548d[_0x63c6('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x12548d[_0x63c6('0xd')];this['dialCongestionRetryFrequency']=_0x12548d[_0x63c6('0xe')];this[_0x63c6('0xf')]=_0x12548d[_0x63c6('0xf')];this['dialBusyRetryFrequency']=_0x12548d['dialBusyRetryFrequency'];this[_0x63c6('0x10')]=_0x12548d[_0x63c6('0x10')];this['dialNoAnswerRetryFrequency']=_0x12548d[_0x63c6('0x11')];this[_0x63c6('0x12')]=_0x12548d[_0x63c6('0x12')];this[_0x63c6('0x13')]=_0x12548d[_0x63c6('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x12548d[_0x63c6('0x14')]||0x96;this[_0x63c6('0x15')]=_0x12548d[_0x63c6('0x15')]||0x3;this[_0x63c6('0x16')]=_0x12548d[_0x63c6('0x16')]||0x96;this[_0x63c6('0x17')]=_0x12548d[_0x63c6('0x17')]||0x3;this[_0x63c6('0x18')]=_0x12548d[_0x63c6('0x18')]||0x96;this[_0x63c6('0x19')]=_0x12548d[_0x63c6('0x19')]||0x3;this[_0x63c6('0x1a')]=_0x12548d['dialMachineRetryFrequency']||0x96;this[_0x63c6('0x1b')]=_0x12548d[_0x63c6('0x1b')]||0x3;this[_0x63c6('0x1c')]=_0x12548d['dialAgentRejectRetryFrequency']||0x96;this[_0x63c6('0x1d')]=_0x12548d['dialOrderByScheduledAt']||'DESC';this[_0x63c6('0x1e')]=_0x12548d['dialPrefix']||undefined;this[_0x63c6('0x1f')]=_0x12548d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x63c6('0x20')]=_0x12548d[_0x63c6('0x20')]||undefined;this[_0x63c6('0x21')]=_0x12548d[_0x63c6('0x21')]?_0x12548d['TrunkBackup']:undefined;this[_0x63c6('0x22')]=_0x12548d[_0x63c6('0x22')]?_0x12548d[_0x63c6('0x22')]:undefined;this[_0x63c6('0x23')]=_0x12548d[_0x63c6('0x23')]?_0x12548d[_0x63c6('0x23')]:undefined;this[_0x63c6('0x24')]=_0x12548d['SquareProject']?_0x12548d[_0x63c6('0x24')]:undefined;this['dialQueueProject']=_0x12548d['SquareProject']?_0x12548d[_0x63c6('0x24')][_0x63c6('0x0')]:undefined;this[_0x63c6('0x25')]=_0x12548d[_0x63c6('0x25')]||![];this['dialAMDInitialSilence']=_0x12548d['dialAMDInitialSilence'];this[_0x63c6('0x26')]=_0x12548d[_0x63c6('0x26')];this['dialAMDAfterGreetingSilence']=_0x12548d[_0x63c6('0x27')];this[_0x63c6('0x28')]=_0x12548d[_0x63c6('0x28')];this[_0x63c6('0x29')]=_0x12548d['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x12548d['dialAMDBetweenWordsSilence'];this[_0x63c6('0x2a')]=_0x12548d[_0x63c6('0x2a')];this['dialAMDSilenceThreshold']=_0x12548d[_0x63c6('0x2b')];this[_0x63c6('0x2c')]=_0x12548d[_0x63c6('0x2c')];}module[_0x63c6('0x2d')]=Campaign; \ No newline at end of file +var _0x0911=['SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x5e0902,_0x1c68e2){var _0x38a101=function(_0x175986){while(--_0x175986){_0x5e0902['push'](_0x5e0902['shift']());}};_0x38a101(++_0x1c68e2);}(_0x0911,0x1a9));var _0x1091=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x0911[_0x430f44];return _0x1f6b0f;};'use strict';function Campaign(_0x1c600a){this['id']=_0x1c600a['id']||0x0;this[_0x1091('0x0')]=_0x1c600a[_0x1091('0x0')]||'';this[_0x1091('0x1')]=_0x1c600a[_0x1091('0x1')]||'campaign';this[_0x1091('0x2')]=0x0;this['temp']=0x0;this[_0x1091('0x3')]=0x0;this[_0x1091('0x4')]=0x0;this[_0x1091('0x5')]='';this[_0x1091('0x6')]=!![];this[_0x1091('0x7')]=_0x1c600a[_0x1091('0x7')];this[_0x1091('0x8')]=_0x1c600a[_0x1091('0x8')];this[_0x1091('0x9')]=_0x1c600a[_0x1091('0x9')]||null;this['dialGlobalInterval']=_0x1c600a[_0x1091('0xa')]?_0x1c600a[_0x1091('0xa')]:null;this[_0x1091('0xb')]=_0x1c600a[_0x1091('0xb')];this[_0x1091('0xc')]=_0x1c600a[_0x1091('0xc')];this['dialOriginateTimeout']=_0x1c600a[_0x1091('0xd')]||0x1e;this[_0x1091('0xe')]=_0x1c600a['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x1c600a[_0x1091('0xf')];this['dialBusyMaxRetry']=_0x1c600a[_0x1091('0x10')];this['dialBusyRetryFrequency']=_0x1c600a[_0x1091('0x11')];this[_0x1091('0x12')]=_0x1c600a[_0x1091('0x12')];this[_0x1091('0x13')]=_0x1c600a['dialNoAnswerRetryFrequency'];this[_0x1091('0x14')]=_0x1c600a[_0x1091('0x14')];this['dialNoSuchNumberMaxRetry']=_0x1c600a['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1c600a['dialNoSuchNumberRetryFrequency']||0x96;this[_0x1091('0x15')]=_0x1c600a[_0x1091('0x15')]||0x3;this[_0x1091('0x16')]=_0x1c600a['dialDropRetryFrequency']||0x96;this[_0x1091('0x17')]=_0x1c600a[_0x1091('0x17')]||0x3;this[_0x1091('0x18')]=_0x1c600a[_0x1091('0x18')]||0x96;this[_0x1091('0x19')]=_0x1c600a['dialMachineMaxRetry']||0x3;this[_0x1091('0x1a')]=_0x1c600a[_0x1091('0x1a')]||0x96;this[_0x1091('0x1b')]=_0x1c600a[_0x1091('0x1b')]||0x3;this[_0x1091('0x1c')]=_0x1c600a['dialAgentRejectRetryFrequency']||0x96;this[_0x1091('0x1d')]=_0x1c600a[_0x1091('0x1d')]||'DESC';this['dialPrefix']=_0x1c600a['dialPrefix']||undefined;this[_0x1091('0x1e')]=_0x1c600a[_0x1091('0x1e')]||undefined;this[_0x1091('0x1f')]=_0x1c600a[_0x1091('0x1f')]||undefined;this[_0x1091('0x20')]=_0x1c600a[_0x1091('0x20')]?_0x1c600a[_0x1091('0x20')]:undefined;this[_0x1091('0x21')]=_0x1c600a[_0x1091('0x21')]?_0x1c600a[_0x1091('0x21')]:undefined;this[_0x1091('0x22')]=_0x1c600a[_0x1091('0x22')]?_0x1c600a[_0x1091('0x22')]:undefined;this[_0x1091('0x23')]=_0x1c600a[_0x1091('0x23')]?_0x1c600a[_0x1091('0x23')]:undefined;this['dialQueueProject']=_0x1c600a[_0x1091('0x23')]?_0x1c600a[_0x1091('0x23')][_0x1091('0x0')]:undefined;this['dialAMDActive']=_0x1c600a[_0x1091('0x24')]||![];this['dialAMDInitialSilence']=_0x1c600a[_0x1091('0x25')];this[_0x1091('0x26')]=_0x1c600a[_0x1091('0x26')];this[_0x1091('0x27')]=_0x1c600a['dialAMDAfterGreetingSilence'];this[_0x1091('0x28')]=_0x1c600a[_0x1091('0x28')];this[_0x1091('0x29')]=_0x1c600a[_0x1091('0x29')];this[_0x1091('0x2a')]=_0x1c600a[_0x1091('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x1c600a[_0x1091('0x2b')];this[_0x1091('0x2c')]=_0x1c600a[_0x1091('0x2c')];this[_0x1091('0x2d')]=_0x1c600a['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8429f8d..9e61917 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 _0x4329=['uniqueid','linkedid','exten','answered','answertime','unmanaged','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x4329,0x13b));var _0x9432=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4329[_0xa1e3e3];return _0xc980e9;};'use strict';function Channel(){this[_0x9432('0x0')]=null;this[_0x9432('0x1')]='';this[_0x9432('0x2')]='';this[_0x9432('0x3')]=0x0;this[_0x9432('0x4')]='';this[_0x9432('0x5')]=undefined;this[_0x9432('0x6')]=undefined;this[_0x9432('0x7')]=0x0;this[_0x9432('0x8')]='';this[_0x9432('0x9')]=0x0;this[_0x9432('0xa')]=0x0;this[_0x9432('0xb')]=0x0;this[_0x9432('0xc')]=![];this[_0x9432('0xd')]=null;this['endtime']=null;this[_0x9432('0xe')]=![];this['abandoned']=![];this[_0x9432('0xf')]='';this[_0x9432('0x10')]='';this['duration']=0x0;this[_0x9432('0x11')]=0x0;this[_0x9432('0x12')]=0x0;this[_0x9432('0x13')]=null;this[_0x9432('0x14')]=null;this[_0x9432('0x15')]=null;this['monitor']=![];this[_0x9432('0x16')]=null;this[_0x9432('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x9432('0x18')]=undefined;this[_0x9432('0x19')]=0x0;}module[_0x9432('0x1a')]=Channel; \ No newline at end of file +var _0xf865=['duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','endtime','abandoned','lastdata'];(function(_0x23d4d9,_0x5d0da7){var _0x39a1ab=function(_0x5b3890){while(--_0x5b3890){_0x23d4d9['push'](_0x23d4d9['shift']());}};_0x39a1ab(++_0x5d0da7);}(_0xf865,0x11a));var _0x5f86=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xf865[_0x4ed1d4];return _0x28e363;};'use strict';function Channel(){this[_0x5f86('0x0')]=null;this[_0x5f86('0x1')]='';this[_0x5f86('0x2')]='';this[_0x5f86('0x3')]=0x0;this[_0x5f86('0x4')]='';this[_0x5f86('0x5')]=undefined;this[_0x5f86('0x6')]=undefined;this[_0x5f86('0x7')]=0x0;this[_0x5f86('0x8')]='';this[_0x5f86('0x9')]=0x0;this[_0x5f86('0xa')]=0x0;this['exten']=0x0;this[_0x5f86('0xb')]=![];this['answertime']=null;this[_0x5f86('0xc')]=null;this['unmanaged']=![];this[_0x5f86('0xd')]=![];this['lastapplication']='';this[_0x5f86('0xe')]='';this[_0x5f86('0xf')]=0x0;this[_0x5f86('0x10')]=0x0;this[_0x5f86('0x11')]=0x0;this[_0x5f86('0x12')]=null;this[_0x5f86('0x13')]=null;this[_0x5f86('0x14')]=null;this['monitor']=![];this[_0x5f86('0x15')]=null;this[_0x5f86('0x16')]=null;this[_0x5f86('0x17')]=[];this[_0x5f86('0x18')]=undefined;this[_0x5f86('0x19')]=undefined;this['mohtime']=0x0;}module[_0x5f86('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 83d13b1..b54427b 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 _0x2bae=['password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x8cea57,_0x290172){var _0x25ce1d=function(_0x152c9a){while(--_0x152c9a){_0x8cea57['push'](_0x8cea57['shift']());}};_0x25ce1d(++_0x290172);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x4fd3d7){this['id']=_0x4fd3d7['id']||0x0;this[_0xe2ba('0x0')]=_0x4fd3d7[_0xe2ba('0x0')]||'';this[_0xe2ba('0x1')]=_0x4fd3d7[_0xe2ba('0x1')]||'';this[_0xe2ba('0x2')]=_0x4fd3d7['remoteUri']||'';this[_0xe2ba('0x3')]=_0x4fd3d7['authType']||'';this[_0xe2ba('0x4')]=_0x4fd3d7['password']||'';this[_0xe2ba('0x5')]=_0x4fd3d7[_0xe2ba('0x5')]||'';this[_0xe2ba('0x6')]=_0x4fd3d7['consumerSecret']||'';this[_0xe2ba('0x7')]=_0x4fd3d7[_0xe2ba('0x7')]||'';this[_0xe2ba('0x8')]=_0x4fd3d7[_0xe2ba('0x8')]||'';this['type']=_0x4fd3d7['type']||'';this[_0xe2ba('0x9')]=_0x4fd3d7[_0xe2ba('0x9')]||'';this[_0xe2ba('0xa')]=_0x4fd3d7[_0xe2ba('0xa')]||{};}module[_0xe2ba('0xb')]=DeskAccount; \ No newline at end of file +var _0x04e7=['Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x212dbe,_0x39edce){var _0xe4ac0c=function(_0x224f3c){while(--_0x224f3c){_0x212dbe['push'](_0x212dbe['shift']());}};_0xe4ac0c(++_0x39edce);}(_0x04e7,0x121));var _0x704e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x04e7[_0x3c4737];return _0x2bb926;};'use strict';function DeskAccount(_0x4e3bdd){this['id']=_0x4e3bdd['id']||0x0;this[_0x704e('0x0')]=_0x4e3bdd[_0x704e('0x0')]||'';this[_0x704e('0x1')]=_0x4e3bdd[_0x704e('0x1')]||'';this[_0x704e('0x2')]=_0x4e3bdd[_0x704e('0x2')]||'';this[_0x704e('0x3')]=_0x4e3bdd[_0x704e('0x3')]||'';this[_0x704e('0x4')]=_0x4e3bdd[_0x704e('0x4')]||'';this[_0x704e('0x5')]=_0x4e3bdd['consumerKey']||'';this[_0x704e('0x6')]=_0x4e3bdd[_0x704e('0x6')]||'';this[_0x704e('0x7')]=_0x4e3bdd[_0x704e('0x7')]||'';this[_0x704e('0x8')]=_0x4e3bdd[_0x704e('0x8')]||'';this[_0x704e('0x9')]=_0x4e3bdd[_0x704e('0x9')]||'';this[_0x704e('0xa')]=_0x4e3bdd[_0x704e('0xa')]||'';this[_0x704e('0xb')]=_0x4e3bdd[_0x704e('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4ad13d5..84bc15d 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 _0xeaa1=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','exports','name'];(function(_0x5f72ad,_0x5eaae9){var _0x21d654=function(_0x383fa5){while(--_0x383fa5){_0x5f72ad['push'](_0x5f72ad['shift']());}};_0x21d654(++_0x5eaae9);}(_0xeaa1,0x19d));var _0x1eaa=function(_0x33d1d4,_0x210a96){_0x33d1d4=_0x33d1d4-0x0;var _0x122e2e=_0xeaa1[_0x33d1d4];return _0x122e2e;};'use strict';function Dynamics365Account(_0x22873e){this['id']=_0x22873e['id']||0x0;this[_0x1eaa('0x0')]=_0x22873e[_0x1eaa('0x0')]||'';this[_0x1eaa('0x1')]=_0x22873e[_0x1eaa('0x1')]||'';this[_0x1eaa('0x2')]=_0x22873e['password']||'';this[_0x1eaa('0x3')]=_0x22873e[_0x1eaa('0x3')]||'';this[_0x1eaa('0x4')]=_0x22873e[_0x1eaa('0x4')]||'';this[_0x1eaa('0x5')]=_0x22873e[_0x1eaa('0x5')]||'';this['clientSecret']=_0x22873e[_0x1eaa('0x6')]||{};this[_0x1eaa('0x7')]=_0x22873e[_0x1eaa('0x7')]||'';this['Configurations']=_0x22873e['Configurations']||{};}module[_0x1eaa('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x4216=['password','remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name','username'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x4216,0x181));var _0x6421=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4216[_0x59ee6f];return _0x4c0979;};'use strict';function Dynamics365Account(_0x27045c){this['id']=_0x27045c['id']||0x0;this[_0x6421('0x0')]=_0x27045c[_0x6421('0x0')]||'';this[_0x6421('0x1')]=_0x27045c['username']||'';this[_0x6421('0x2')]=_0x27045c['password']||'';this['remoteUri']=_0x27045c[_0x6421('0x3')]||'';this[_0x6421('0x4')]=_0x27045c[_0x6421('0x4')]||'';this[_0x6421('0x5')]=_0x27045c[_0x6421('0x5')]||'';this['clientSecret']=_0x27045c['clientSecret']||{};this[_0x6421('0x6')]=_0x27045c[_0x6421('0x6')]||'';this[_0x6421('0x7')]=_0x27045c[_0x6421('0x7')]||{};}module[_0x6421('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 76a1b5e..74d65f4 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 _0xdb21=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x4f23c8,_0x20e6e4){var _0x457281=function(_0x53516c){while(--_0x53516c){_0x4f23c8['push'](_0x4f23c8['shift']());}};_0x457281(++_0x20e6e4);}(_0xdb21,0x135));var _0x1db2=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0xdb21[_0x35b7d4];return _0x4e8cee;};'use strict';function FaxAccount(_0x3c7f37){this['id']=_0x3c7f37['id']||0x0;this[_0x1db2('0x0')]=_0x3c7f37[_0x1db2('0x0')]||'';this[_0x1db2('0x1')]=_0x3c7f37[_0x1db2('0x1')];this[_0x1db2('0x2')]=_0x3c7f37[_0x1db2('0x2')];this[_0x1db2('0x3')]=_0x3c7f37[_0x1db2('0x3')];this['localstationid']=_0x3c7f37[_0x1db2('0x4')];this['minrate']=_0x3c7f37['minrate']||0x960;this[_0x1db2('0x5')]=_0x3c7f37[_0x1db2('0x5')]||0x3840;this[_0x1db2('0x6')]=_0x3c7f37[_0x1db2('0x6')]||_0x1db2('0x7');this[_0x1db2('0x8')]=_0x3c7f37[_0x1db2('0x8')]||'no';this[_0x1db2('0x9')]=_0x3c7f37[_0x1db2('0x9')]||'no';this[_0x1db2('0xa')]=_0x3c7f37[_0x1db2('0xa')]||0x1388;this['tech']=_0x3c7f37[_0x1db2('0xb')]||_0x1db2('0xc');this[_0x1db2('0xd')]=_0x3c7f37['Trunk']?_0x3c7f37['Trunk']:undefined;this[_0x1db2('0xe')]=_0x3c7f37['ListId'];this[_0x1db2('0xf')]=_0x3c7f37[_0x1db2('0xf')];}module[_0x1db2('0x10')]=FaxAccount; \ No newline at end of file +var _0x9541=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','Trunk','ListId'];(function(_0x33a178,_0x2c793f){var _0x522738=function(_0x1a0e80){while(--_0x1a0e80){_0x33a178['push'](_0x33a178['shift']());}};_0x522738(++_0x2c793f);}(_0x9541,0x97));var _0x1954=function(_0x25f6c0,_0x493b75){_0x25f6c0=_0x25f6c0-0x0;var _0x16a7af=_0x9541[_0x25f6c0];return _0x16a7af;};'use strict';function FaxAccount(_0x49f1e1){this['id']=_0x49f1e1['id']||0x0;this[_0x1954('0x0')]=_0x49f1e1[_0x1954('0x0')]||'';this[_0x1954('0x1')]=_0x49f1e1[_0x1954('0x1')];this[_0x1954('0x2')]=_0x49f1e1[_0x1954('0x2')];this[_0x1954('0x3')]=_0x49f1e1['headerinfo'];this[_0x1954('0x4')]=_0x49f1e1[_0x1954('0x4')];this[_0x1954('0x5')]=_0x49f1e1['minrate']||0x960;this[_0x1954('0x6')]=_0x49f1e1[_0x1954('0x6')]||0x3840;this['modem']=_0x49f1e1[_0x1954('0x7')]||_0x1954('0x8');this[_0x1954('0x9')]=_0x49f1e1[_0x1954('0x9')]||'no';this[_0x1954('0xa')]=_0x49f1e1[_0x1954('0xa')]||'no';this['t38timeout']=_0x49f1e1['t38timeout']||0x1388;this[_0x1954('0xb')]=_0x49f1e1[_0x1954('0xb')]||'SIP';this[_0x1954('0xc')]=_0x49f1e1[_0x1954('0xc')]?_0x49f1e1[_0x1954('0xc')]:undefined;this['ListId']=_0x49f1e1[_0x1954('0xd')];this['key']=_0x49f1e1[_0x1954('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d9a3177..0c78c97 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 _0x1414=['exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x47d6fa,_0x5643bf){var _0x320f67=function(_0x38b92d){while(--_0x38b92d){_0x47d6fa['push'](_0x47d6fa['shift']());}};_0x320f67(++_0x5643bf);}(_0x1414,0x12d));var _0x4141=function(_0x37eed2,_0x14ff99){_0x37eed2=_0x37eed2-0x0;var _0xca6982=_0x1414[_0x37eed2];return _0xca6982;};'use strict';function FreshdeskAccount(_0x2d0d49){this['id']=_0x2d0d49['id']||0x0;this[_0x4141('0x0')]=_0x2d0d49[_0x4141('0x0')]||'';this[_0x4141('0x1')]=_0x2d0d49[_0x4141('0x1')]||'';this[_0x4141('0x2')]=_0x2d0d49['token']||'';this[_0x4141('0x3')]=_0x2d0d49[_0x4141('0x3')]||'';this[_0x4141('0x4')]=_0x2d0d49['serverUrl']||'';this['Configurations']=_0x2d0d49['Configurations']||{};}module[_0x4141('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xfb39=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x551d57,_0x1d460a){var _0x2ad513=function(_0xf228a1){while(--_0xf228a1){_0x551d57['push'](_0x551d57['shift']());}};_0x2ad513(++_0x1d460a);}(_0xfb39,0x115));var _0x9fb3=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfb39[_0x2d7f0e];return _0x110b07;};'use strict';function FreshdeskAccount(_0x2ac608){this['id']=_0x2ac608['id']||0x0;this[_0x9fb3('0x0')]=_0x2ac608[_0x9fb3('0x0')]||'';this[_0x9fb3('0x1')]=_0x2ac608[_0x9fb3('0x1')]||'';this[_0x9fb3('0x2')]=_0x2ac608[_0x9fb3('0x3')]||'';this['remoteUri']=_0x2ac608[_0x9fb3('0x4')]||'';this[_0x9fb3('0x5')]=_0x2ac608['serverUrl']||'';this['Configurations']=_0x2ac608[_0x9fb3('0x6')]||{};}module[_0x9fb3('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7b6eef3..6ddaab9 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 _0xf02d=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x58eb26,_0x36a4c1){var _0xa587da=function(_0x461b60){while(--_0x461b60){_0x58eb26['push'](_0x58eb26['shift']());}};_0xa587da(++_0x36a4c1);}(_0xf02d,0x1bc));var _0xdf02=function(_0x377d30,_0x31017e){_0x377d30=_0x377d30-0x0;var _0xbd7a08=_0xf02d[_0x377d30];return _0xbd7a08;};'use strict';function FreshsalesAccount(_0x320ee3){this['id']=_0x320ee3['id']||0x0;this['name']=_0x320ee3[_0xdf02('0x0')]||'';this[_0xdf02('0x1')]=_0x320ee3[_0xdf02('0x1')]||'';this[_0xdf02('0x2')]=_0x320ee3[_0xdf02('0x3')]||'';this[_0xdf02('0x4')]=_0x320ee3[_0xdf02('0x4')]||'';this[_0xdf02('0x5')]=_0x320ee3[_0xdf02('0x5')]||'';this['Configurations']=_0x320ee3[_0xdf02('0x6')]||{};}module[_0xdf02('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x8592=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x28eeb6,_0x2b7f07){var _0x5a8ba1=function(_0x34ba79){while(--_0x34ba79){_0x28eeb6['push'](_0x28eeb6['shift']());}};_0x5a8ba1(++_0x2b7f07);}(_0x8592,0xd5));var _0x2859=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x8592[_0x4450b1];return _0x399b0b;};'use strict';function FreshsalesAccount(_0x10fc4a){this['id']=_0x10fc4a['id']||0x0;this[_0x2859('0x0')]=_0x10fc4a[_0x2859('0x0')]||'';this[_0x2859('0x1')]=_0x10fc4a[_0x2859('0x1')]||'';this['apiKey']=_0x10fc4a['token']||'';this[_0x2859('0x2')]=_0x10fc4a[_0x2859('0x2')]||'';this[_0x2859('0x3')]=_0x10fc4a[_0x2859('0x3')]||'';this[_0x2859('0x4')]=_0x10fc4a[_0x2859('0x4')]||{};}module[_0x2859('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 85cb99e..cba6c57 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 _0x2d94=['count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','mohtime','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x154699,_0x3687c9){var _0x2bc891=function(_0x8d98fb){while(--_0x8d98fb){_0x154699['push'](_0x154699['shift']());}};_0x2bc891(++_0x3687c9);}(_0x2d94,0xe1));var _0x42d9=function(_0x1a3367,_0x193547){_0x1a3367=_0x1a3367-0x0;var _0x5dd2cd=_0x2d94[_0x1a3367];return _0x5dd2cd;};'use strict';function QueueReport(){this[_0x42d9('0x0')]=_0x42d9('0x1');this[_0x42d9('0x2')]='';this[_0x42d9('0x3')]='';this[_0x42d9('0x4')]='';this[_0x42d9('0x5')]='';this[_0x42d9('0x6')]=null;this[_0x42d9('0x7')]=null;this[_0x42d9('0x8')]=0x1;this[_0x42d9('0x9')]=0x1;this['queuecallerabandon']=![];this[_0x42d9('0xa')]=null;this[_0x42d9('0xb')]=![];this[_0x42d9('0xc')]=null;this[_0x42d9('0xd')]=![];this[_0x42d9('0xe')]=null;this[_0x42d9('0xf')]=0x1;this[_0x42d9('0x10')]='';this[_0x42d9('0x11')]='';this[_0x42d9('0x12')]='';this[_0x42d9('0x13')]='';this[_0x42d9('0x14')]='';this[_0x42d9('0x15')]='';this[_0x42d9('0x16')]='';this[_0x42d9('0x17')]=0x0;this['assigned']=![];this[_0x42d9('0x18')]='';this[_0x42d9('0x19')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x9699=['queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercomplete','originalposition','channel','connectedlinename','accountcode','exten','holdtime','assigned','lastAssignedTo','variables','exports','type','uniqueid','calleridnum','calleridname','queue'];(function(_0xb00710,_0x4d7d03){var _0x3980c0=function(_0x11addf){while(--_0x11addf){_0xb00710['push'](_0xb00710['shift']());}};_0x3980c0(++_0x4d7d03);}(_0x9699,0x19f));var _0x9969=function(_0x4cd4e6,_0xa406){_0x4cd4e6=_0x4cd4e6-0x0;var _0x500c56=_0x9699[_0x4cd4e6];return _0x500c56;};'use strict';function QueueReport(){this[_0x9969('0x0')]='inbound';this[_0x9969('0x1')]='';this[_0x9969('0x2')]='';this[_0x9969('0x3')]='';this[_0x9969('0x4')]='';this[_0x9969('0x5')]=null;this[_0x9969('0x6')]=null;this['position']=0x1;this[_0x9969('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x9969('0x8')]=null;this[_0x9969('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x9969('0xa')]=0x1;this[_0x9969('0xb')]='';this['connectedlinenum']='';this[_0x9969('0xc')]='';this[_0x9969('0xd')]='';this['context']='';this[_0x9969('0xe')]='';this['priority']='';this[_0x9969('0xf')]=0x0;this[_0x9969('0x10')]=![];this[_0x9969('0x11')]='';this['mohtime']=0x0;this[_0x9969('0x12')]={};}module[_0x9969('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 2f9fcfe..40ff2ef 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 _0x9a1b=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x5f1108,_0x506df9){var _0x52a2b8=function(_0x10997a){while(--_0x10997a){_0x5f1108['push'](_0x5f1108['shift']());}};_0x52a2b8(++_0x506df9);}(_0x9a1b,0x1b4));var _0xb9a1=function(_0x3ad2e5,_0x94d414){_0x3ad2e5=_0x3ad2e5-0x0;var _0xc4e565=_0x9a1b[_0x3ad2e5];return _0xc4e565;};'use strict';function SalesforceAccount(_0x14a262){this['id']=_0x14a262['id']||0x0;this[_0xb9a1('0x0')]=_0x14a262['name']||'';this['username']=_0x14a262[_0xb9a1('0x1')]||'';this[_0xb9a1('0x2')]=_0x14a262[_0xb9a1('0x2')]||'';this[_0xb9a1('0x3')]=_0x14a262[_0xb9a1('0x3')]||'';this['clientId']=_0x14a262['clientId']||'';this['clientSecret']=_0x14a262[_0xb9a1('0x4')]||'';this[_0xb9a1('0x5')]=_0x14a262[_0xb9a1('0x5')]||'';this['type']=_0x14a262[_0xb9a1('0x6')]||_0xb9a1('0x7');this['serverUrl']=_0x14a262[_0xb9a1('0x8')]||'';this['Configurations']=_0x14a262[_0xb9a1('0x9')]||{};}module[_0xb9a1('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x1cda=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x451fd5,_0x5c73e0){var _0xa2dcb4=function(_0x5ab0f5){while(--_0x5ab0f5){_0x451fd5['push'](_0x451fd5['shift']());}};_0xa2dcb4(++_0x5c73e0);}(_0x1cda,0xa3));var _0xa1cd=function(_0x2391c0,_0xb09103){_0x2391c0=_0x2391c0-0x0;var _0x4bb171=_0x1cda[_0x2391c0];return _0x4bb171;};'use strict';function SalesforceAccount(_0x52aefc){this['id']=_0x52aefc['id']||0x0;this[_0xa1cd('0x0')]=_0x52aefc['name']||'';this[_0xa1cd('0x1')]=_0x52aefc['username']||'';this[_0xa1cd('0x2')]=_0x52aefc['remoteUri']||'';this[_0xa1cd('0x3')]=_0x52aefc[_0xa1cd('0x3')]||'';this[_0xa1cd('0x4')]=_0x52aefc[_0xa1cd('0x4')]||'';this[_0xa1cd('0x5')]=_0x52aefc['clientSecret']||'';this[_0xa1cd('0x6')]=_0x52aefc[_0xa1cd('0x6')]||'';this[_0xa1cd('0x7')]=_0x52aefc[_0xa1cd('0x7')]||_0xa1cd('0x8');this[_0xa1cd('0x9')]=_0x52aefc[_0xa1cd('0x9')]||'';this[_0xa1cd('0xa')]=_0x52aefc[_0xa1cd('0xa')]||{};}module[_0xa1cd('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2fb4b5f..35c6ebd 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 _0x1fe2=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1eff83,_0x598a1c){var _0x20f2fa=function(_0x25a530){while(--_0x25a530){_0x1eff83['push'](_0x1eff83['shift']());}};_0x20f2fa(++_0x598a1c);}(_0x1fe2,0x155));var _0x21fe=function(_0x2729bc,_0x48f819){_0x2729bc=_0x2729bc-0x0;var _0x400e86=_0x1fe2[_0x2729bc];return _0x400e86;};'use strict';function ServicenowAccount(_0x38132a){this['id']=_0x38132a['id']||0x0;this[_0x21fe('0x0')]=_0x38132a['name']||'';this[_0x21fe('0x1')]=_0x38132a[_0x21fe('0x1')]||'';this[_0x21fe('0x2')]=_0x38132a[_0x21fe('0x2')]||'';this[_0x21fe('0x3')]=_0x38132a[_0x21fe('0x3')]||'';this[_0x21fe('0x4')]=_0x38132a['serverUrl']||'';this['Configurations']=_0x38132a[_0x21fe('0x5')]||{};}module[_0x21fe('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x5e02=['exports','name','username','password','remoteUri','Configurations'];(function(_0x543794,_0x316623){var _0x1b969f=function(_0x238382){while(--_0x238382){_0x543794['push'](_0x543794['shift']());}};_0x1b969f(++_0x316623);}(_0x5e02,0xb5));var _0x25e0=function(_0x23441a,_0x243584){_0x23441a=_0x23441a-0x0;var _0x265baf=_0x5e02[_0x23441a];return _0x265baf;};'use strict';function ServicenowAccount(_0x33ce02){this['id']=_0x33ce02['id']||0x0;this[_0x25e0('0x0')]=_0x33ce02[_0x25e0('0x0')]||'';this[_0x25e0('0x1')]=_0x33ce02['username']||'';this[_0x25e0('0x2')]=_0x33ce02[_0x25e0('0x2')]||'';this[_0x25e0('0x3')]=_0x33ce02['remoteUri']||'';this['serverUrl']=_0x33ce02['serverUrl']||'';this[_0x25e0('0x4')]=_0x33ce02[_0x25e0('0x4')]||{};}module[_0x25e0('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1f8747d..bf4ffe5 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 _0xfce0=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5854e6,_0x48e781){var _0x54a773=function(_0x99f8e4){while(--_0x99f8e4){_0x5854e6['push'](_0x5854e6['shift']());}};_0x54a773(++_0x48e781);}(_0xfce0,0xe8));var _0x0fce=function(_0x5ce43c,_0x397d8a){_0x5ce43c=_0x5ce43c-0x0;var _0xb7b3ee=_0xfce0[_0x5ce43c];return _0xb7b3ee;};'use strict';function SugarcrmAccount(_0x201688){this['id']=_0x201688['id']||0x0;this['name']=_0x201688[_0x0fce('0x0')]||'';this[_0x0fce('0x1')]=_0x201688[_0x0fce('0x1')]||'';this[_0x0fce('0x2')]=_0x201688['password']||'';this[_0x0fce('0x3')]=_0x201688[_0x0fce('0x3')]||'';this[_0x0fce('0x4')]=_0x201688['serverUrl']||'';this['Configurations']=_0x201688[_0x0fce('0x5')]||{};}module[_0x0fce('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xcb3f=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xd9ac92,_0x276ebf){var _0x50a0db=function(_0x300e7e){while(--_0x300e7e){_0xd9ac92['push'](_0xd9ac92['shift']());}};_0x50a0db(++_0x276ebf);}(_0xcb3f,0xe1));var _0xfcb3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcb3f[_0x465a0c];return _0x1e202e;};'use strict';function SugarcrmAccount(_0x33dcaa){this['id']=_0x33dcaa['id']||0x0;this['name']=_0x33dcaa[_0xfcb3('0x0')]||'';this[_0xfcb3('0x1')]=_0x33dcaa[_0xfcb3('0x1')]||'';this[_0xfcb3('0x2')]=_0x33dcaa['password']||'';this[_0xfcb3('0x3')]=_0x33dcaa[_0xfcb3('0x3')]||'';this[_0xfcb3('0x4')]=_0x33dcaa[_0xfcb3('0x4')]||'';this['Configurations']=_0x33dcaa[_0xfcb3('0x5')]||{};}module[_0xfcb3('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 6f2a4c2..09d7805 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 _0x46f8=['accountcode','state','unknown','stateTime','address','exports','name'];(function(_0x34b8af,_0x4bb48f){var _0xa1393b=function(_0x2c7cd6){while(--_0x2c7cd6){_0x34b8af['push'](_0x34b8af['shift']());}};_0xa1393b(++_0x4bb48f);}(_0x46f8,0x1f0));var _0x846f=function(_0x396a00,_0x63335b){_0x396a00=_0x396a00-0x0;var _0x3f5ef5=_0x46f8[_0x396a00];return _0x3f5ef5;};'use strict';function Telephone(_0x1147c2){this['id']=_0x1147c2['id']||0x0;this[_0x846f('0x0')]=_0x1147c2['name']||'';this[_0x846f('0x1')]=_0x1147c2[_0x846f('0x1')]||'';this[_0x846f('0x2')]=_0x846f('0x3');this[_0x846f('0x4')]=0x0;this['status']=_0x846f('0x3');this[_0x846f('0x5')]='';}module[_0x846f('0x6')]=Telephone; \ No newline at end of file +var _0xb2b7=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x2256ea,_0x3c97c3){var _0xfdf368=function(_0x548a8b){while(--_0x548a8b){_0x2256ea['push'](_0x2256ea['shift']());}};_0xfdf368(++_0x3c97c3);}(_0xb2b7,0x172));var _0x7b2b=function(_0x2f27ec,_0x3892a8){_0x2f27ec=_0x2f27ec-0x0;var _0x242910=_0xb2b7[_0x2f27ec];return _0x242910;};'use strict';function Telephone(_0x1900d2){this['id']=_0x1900d2['id']||0x0;this[_0x7b2b('0x0')]=_0x1900d2[_0x7b2b('0x0')]||'';this[_0x7b2b('0x1')]=_0x1900d2[_0x7b2b('0x1')]||'';this[_0x7b2b('0x2')]=_0x7b2b('0x3');this[_0x7b2b('0x4')]=0x0;this[_0x7b2b('0x5')]=_0x7b2b('0x3');this[_0x7b2b('0x6')]='';}module[_0x7b2b('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a2f8e14..783f967 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 _0x7eb2=['html','exports','name'];(function(_0x30e077,_0x227f4f){var _0x407792=function(_0x520623){while(--_0x520623){_0x30e077['push'](_0x30e077['shift']());}};_0x407792(++_0x227f4f);}(_0x7eb2,0x11c));var _0x27eb=function(_0xa492b8,_0x31262e){_0xa492b8=_0xa492b8-0x0;var _0x247331=_0x7eb2[_0xa492b8];return _0x247331;};'use strict';function template(_0x275b59){this['id']=_0x275b59['id']||0x0;this[_0x27eb('0x0')]=_0x275b59['name']||'';this[_0x27eb('0x1')]=_0x275b59[_0x27eb('0x1')]||'';}module[_0x27eb('0x2')]=template; \ No newline at end of file +var _0x70f2=['html','name'];(function(_0x296273,_0xc923ae){var _0x29701b=function(_0x4b5f44){while(--_0x4b5f44){_0x296273['push'](_0x296273['shift']());}};_0x29701b(++_0xc923ae);}(_0x70f2,0xb1));var _0x270f=function(_0x4049b9,_0x28228e){_0x4049b9=_0x4049b9-0x0;var _0x1b5932=_0x70f2[_0x4049b9];return _0x1b5932;};'use strict';function template(_0x267a3c){this['id']=_0x267a3c['id']||0x0;this[_0x270f('0x0')]=_0x267a3c['name']||'';this['html']=_0x267a3c[_0x270f('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index fa898d8..7a8f3f1 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x1ef880,_0xc13099){var _0x5c2ecc=function(_0x228a0b){while(--_0x228a0b){_0x1ef880['push'](_0x1ef880['shift']());}};_0x5c2ecc(++_0xc13099);}(_0x3e74,0x175));var _0x43e7=function(_0x26a0e0,_0xf8446a){_0x26a0e0=_0x26a0e0-0x0;var _0x456703=_0x3e74[_0x26a0e0];return _0x456703;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x36cfb9,_0x5f0143){var _0x496f9b=function(_0x4f422c){while(--_0x4f422c){_0x36cfb9['push'](_0x36cfb9['shift']());}};_0x496f9b(++_0x5f0143);}(_0xa41a,0x6b));var _0xaa41=function(_0x3949b0,_0x58e3cd){_0x3949b0=_0x3949b0-0x0;var _0x361941=_0xa41a[_0x3949b0];return _0x361941;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f53403a..a989516 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 _0x390a=['status','registry','split','port','refresh','stateRegistry','registrationtime','address','active','name','state','unknown','stateTime'];(function(_0x57e2fc,_0x329a07){var _0x5e2f0e=function(_0x541103){while(--_0x541103){_0x57e2fc['push'](_0x57e2fc['shift']());}};_0x5e2f0e(++_0x329a07);}(_0x390a,0xbe));var _0xa390=function(_0xfef4e2,_0x1bebc3){_0xfef4e2=_0xfef4e2-0x0;var _0x2df8c4=_0x390a[_0xfef4e2];return _0x2df8c4;};'use strict';function Trunk(_0x57217d){this['id']=_0x57217d['id']||0x0;this[_0xa390('0x0')]=_0x57217d[_0xa390('0x0')]||![];this[_0xa390('0x1')]=_0x57217d[_0xa390('0x1')]||'';this[_0xa390('0x2')]=_0xa390('0x3');this[_0xa390('0x4')]=0x0;this[_0xa390('0x5')]=_0xa390('0x3');this[_0xa390('0x6')]=_0x57217d[_0xa390('0x6')]&&_0x57217d[_0xa390('0x6')]['indexOf'](':')?_0x57217d[_0xa390('0x6')][_0xa390('0x7')](':')[0x0]:'';this['host']='';this[_0xa390('0x8')]='';this['domain']='';this['domainport']='';this[_0xa390('0x9')]='';this[_0xa390('0xa')]=_0xa390('0x3');this[_0xa390('0xb')]='';this[_0xa390('0xc')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xa600=['indexOf','split','host','port','domainport','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xa600,0xa9));var _0x0a60=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa600[_0x40ac5e];return _0x2839d6;};'use strict';function Trunk(_0x4704df){this['id']=_0x4704df['id']||0x0;this[_0x0a60('0x0')]=_0x4704df[_0x0a60('0x0')]||![];this[_0x0a60('0x1')]=_0x4704df[_0x0a60('0x1')]||'';this[_0x0a60('0x2')]=_0x0a60('0x3');this[_0x0a60('0x4')]=0x0;this[_0x0a60('0x5')]=_0x0a60('0x3');this[_0x0a60('0x6')]=_0x4704df[_0x0a60('0x6')]&&_0x4704df[_0x0a60('0x6')][_0x0a60('0x7')](':')?_0x4704df[_0x0a60('0x6')][_0x0a60('0x8')](':')[0x0]:'';this[_0x0a60('0x9')]='';this[_0x0a60('0xa')]='';this['domain']='';this[_0x0a60('0xb')]='';this['refresh']='';this[_0x0a60('0xc')]=_0x0a60('0x3');this[_0x0a60('0xd')]='';this[_0x0a60('0xe')]='';}module[_0x0a60('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index fe37994..138fc11 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 _0x0134=['mandatoryDisposition','exports','exten'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0134,0xd7));var _0x4013=function(_0x11bd81,_0x11fa4c){_0x11bd81=_0x11bd81-0x0;var _0x158de0=_0x0134[_0x11bd81];return _0x158de0;};'use strict';function voiceExtension(_0x226482){this['id']=_0x226482['id']||0x0;this[_0x4013('0x0')]=_0x226482['exten']||'';this['recordingFormat']=_0x226482['recordingFormat']||'none';this[_0x4013('0x1')]=_0x226482[_0x4013('0x1')]||![];}module[_0x4013('0x2')]=voiceExtension; \ No newline at end of file +var _0x4f95=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x449136,_0x7b1e4){var _0x289a94=function(_0x1fe08e){while(--_0x1fe08e){_0x449136['push'](_0x449136['shift']());}};_0x289a94(++_0x7b1e4);}(_0x4f95,0x195));var _0x54f9=function(_0x2f9c1e,_0x540761){_0x2f9c1e=_0x2f9c1e-0x0;var _0x492be4=_0x4f95[_0x2f9c1e];return _0x492be4;};'use strict';function voiceExtension(_0x1549b9){this['id']=_0x1549b9['id']||0x0;this[_0x54f9('0x0')]=_0x1549b9[_0x54f9('0x0')]||'';this['recordingFormat']=_0x1549b9[_0x54f9('0x1')]||_0x54f9('0x2');this[_0x54f9('0x3')]=_0x1549b9[_0x54f9('0x3')]||![];}module[_0x54f9('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 55c1466..dce80ee 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 _0x3c75=['inuse','unavailable','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x3c75,0x7c));var _0x53c7=function(_0x5de3fd,_0x42d375){_0x5de3fd=_0x5de3fd-0x0;var _0xeec602=_0x3c75[_0x5de3fd];return _0xeec602;};'use strict';var statusDesc=['unknown',_0x53c7('0x0'),_0x53c7('0x1'),'busy','invalid',_0x53c7('0x2'),'ringing',_0x53c7('0x3'),_0x53c7('0x4')];var monitorFormat={'wav':_0x53c7('0x5'),'wav49':_0x53c7('0x6'),'gsm':_0x53c7('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x53c7('0x8')};function VoiceQueue(_0x14ef0d){this['id']=_0x14ef0d['id']||0x0;this['name']=_0x14ef0d[_0x53c7('0x9')]||'';this[_0x53c7('0xa')]=_0x14ef0d[_0x53c7('0xa')]||'';this[_0x53c7('0xb')]=_0x14ef0d[_0x53c7('0xb')]||_0x53c7('0xc');this[_0x53c7('0xd')]=0x0;this[_0x53c7('0xe')]=0x0;this[_0x53c7('0xf')]=0x0;this[_0x53c7('0x10')]=0x0;this['sumDuration']=0x0;this[_0x53c7('0x11')]=0x0;this[_0x53c7('0x12')]=0x0;this[_0x53c7('0x13')]=0x0;this[_0x53c7('0x14')]=0x0;this[_0x53c7('0x15')]=0x0;this[_0x53c7('0x16')]=0x0;this[_0x53c7('0x17')]=_0x14ef0d[_0x53c7('0x17')]||![];this['acwTimeout']=_0x14ef0d[_0x53c7('0x18')]||0xa;this[_0x53c7('0x19')]=_0x14ef0d[_0x53c7('0x19')]||'no';this[_0x53c7('0x1a')]=!![];this['message']='';this[_0x53c7('0x1b')]=0x0;this[_0x53c7('0x1c')]=0x0;this[_0x53c7('0x1d')]=_0x14ef0d['dialTimezone']||null;this[_0x53c7('0x1e')]=_0x14ef0d[_0x53c7('0x1e')]?_0x14ef0d['dialGlobalInterval']:null;this[_0x53c7('0x1f')]=_0x14ef0d[_0x53c7('0x1f')];this[_0x53c7('0x20')]=_0x14ef0d['dialMethod']||_0x53c7('0x21');this[_0x53c7('0x22')]=_0x14ef0d[_0x53c7('0x22')]||0x0;this[_0x53c7('0x23')]=_0x14ef0d[_0x53c7('0x23')]||0x0;this[_0x53c7('0x24')]=_0x14ef0d[_0x53c7('0x24')]||0x1;this['dialPredictiveOptimization']=_0x14ef0d[_0x53c7('0x25')]||_0x53c7('0x26');this[_0x53c7('0x27')]=_0x14ef0d[_0x53c7('0x27')]||0.03;this['dialPredictiveInterval']=_0x14ef0d[_0x53c7('0x28')]||0x258;this[_0x53c7('0x29')]=_0x14ef0d[_0x53c7('0x29')]||_0x53c7('0x2a');this[_0x53c7('0x2b')]=_0x14ef0d[_0x53c7('0x2b')]||'anonymous';this[_0x53c7('0x2c')]=_0x14ef0d[_0x53c7('0x2c')]||0x1e;this[_0x53c7('0x2d')]=_0x14ef0d['dialQueueOptions']||_0x53c7('0x2e');this[_0x53c7('0x2f')]=_0x14ef0d[_0x53c7('0x2f')]||0x3;this['dialQueueProject']=_0x14ef0d[_0x53c7('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x14ef0d[_0x53c7('0x31')]||0x3;this[_0x53c7('0x32')]=_0x14ef0d[_0x53c7('0x32')]||0x96;this['dialBusyMaxRetry']=_0x14ef0d[_0x53c7('0x33')]||0x3;this[_0x53c7('0x34')]=_0x14ef0d['dialBusyRetryFrequency']||0x96;this[_0x53c7('0x35')]=_0x14ef0d[_0x53c7('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x14ef0d[_0x53c7('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x14ef0d[_0x53c7('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x14ef0d[_0x53c7('0x38')]||0x96;this[_0x53c7('0x39')]=_0x14ef0d[_0x53c7('0x39')]||0x3;this['dialDropRetryFrequency']=_0x14ef0d['dialDropRetryFrequency']||0x96;this[_0x53c7('0x3a')]=_0x14ef0d[_0x53c7('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x14ef0d[_0x53c7('0x3b')]||0x96;this[_0x53c7('0x3c')]=_0x14ef0d[_0x53c7('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x14ef0d[_0x53c7('0x3d')]||0x96;this[_0x53c7('0x3e')]=_0x14ef0d[_0x53c7('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x14ef0d[_0x53c7('0x3f')]||0x96;this['dialGlobalMaxRetry']=_0x14ef0d[_0x53c7('0x40')]||0x4;this[_0x53c7('0x41')]=_0x14ef0d[_0x53c7('0x41')]?_0x14ef0d[_0x53c7('0x41')]:undefined;this[_0x53c7('0x42')]=_0x14ef0d[_0x53c7('0x42')]?_0x14ef0d['TrunkBackup']:undefined;this[_0x53c7('0x43')]=_0x14ef0d[_0x53c7('0x43')]||undefined;this['Interval']=_0x14ef0d['Interval']?_0x14ef0d[_0x53c7('0x44')]:undefined;this['dialOrderByScheduledAt']=_0x14ef0d[_0x53c7('0x45')]||_0x53c7('0x46');this[_0x53c7('0x47')]=_0x14ef0d[_0x53c7('0x47')]||undefined;this[_0x53c7('0x48')]=_0x14ef0d[_0x53c7('0x48')]||undefined;this[_0x53c7('0x49')]=strategy[_0x14ef0d[_0x53c7('0x49')]]||_0x53c7('0x4a');this[_0x53c7('0x4b')]=!![];this['dialAMDActive']=_0x14ef0d[_0x53c7('0x4c')]||![];this[_0x53c7('0x4d')]=_0x14ef0d[_0x53c7('0x4d')];this[_0x53c7('0x4e')]=_0x14ef0d[_0x53c7('0x4e')];this[_0x53c7('0x4f')]=_0x14ef0d[_0x53c7('0x4f')];this['dialAMDTotalAnalysisTime']=_0x14ef0d[_0x53c7('0x50')];this[_0x53c7('0x51')]=_0x14ef0d[_0x53c7('0x51')];this[_0x53c7('0x52')]=_0x14ef0d[_0x53c7('0x52')];this[_0x53c7('0x53')]=_0x14ef0d[_0x53c7('0x53')];this[_0x53c7('0x54')]=_0x14ef0d[_0x53c7('0x54')];this[_0x53c7('0x55')]=_0x14ef0d[_0x53c7('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x53c7('0x56')]=0x0;this[_0x53c7('0x57')]=_0x14ef0d[_0x53c7('0x57')];this[_0x53c7('0x58')]=0x0;this[_0x53c7('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x53c7('0x5a')]=0x0;this[_0x53c7('0x5b')]=0x0;this[_0x53c7('0x5c')]=0x0;this[_0x53c7('0x5d')]=0x0;this[_0x53c7('0x5e')]=0x0;this[_0x53c7('0x5f')]=0x0;this[_0x53c7('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x53c7('0x61')]=0x0;this[_0x53c7('0x62')]=0x0;this[_0x53c7('0x63')]=0x0;this[_0x53c7('0x64')]=undefined;this[_0x53c7('0x65')]=undefined;this['handlePredictive']=undefined;this[_0x53c7('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x53c7('0x67')]=0x0;this[_0x53c7('0x68')]=0x0;this[_0x53c7('0x69')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x53c7('0x6a')]=0x0;this[_0x53c7('0x6b')]=0x0;this[_0x53c7('0x6c')]=0x0;this[_0x53c7('0x6d')]=_0x14ef0d[_0x53c7('0x6e')]||0x14;this[_0x53c7('0x6f')]=_0x14ef0d[_0x53c7('0x6e')]||0xa;this[_0x53c7('0x70')]=0x0;this[_0x53c7('0x71')]=0x0;this[_0x53c7('0x72')]=0x1;this[_0x53c7('0x73')]=0x0;this['erlangCallToSecond']=0x0;this[_0x53c7('0x74')]=0x0;this[_0x53c7('0x75')]=0x0;this['dialRecallMeTimeout']=_0x14ef0d[_0x53c7('0x76')]||0x1e;this[_0x53c7('0x77')]=_0x14ef0d['dialRecallInQueue']||![];this[_0x53c7('0x78')]=_0x14ef0d[_0x53c7('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x14ef0d[_0x53c7('0x79')]||![];this[_0x53c7('0x7a')]=_0x14ef0d[_0x53c7('0x7a')]||![];this[_0x53c7('0xa')]=monitorFormat[_0x14ef0d[_0x53c7('0xa')]]?monitorFormat[_0x14ef0d[_0x53c7('0xa')]]:undefined;this[_0x53c7('0x7b')]=_0x14ef0d['mandatoryDisposition']||![];this[_0x53c7('0x7c')]=_0x14ef0d[_0x53c7('0x7c')]?_0x14ef0d[_0x53c7('0x7c')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x361c=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','unavailable','ringing','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x361c,0xc0));var _0xc361=function(_0x2e5d39,_0x41f201){_0x2e5d39=_0x2e5d39-0x0;var _0x17812a=_0x361c[_0x2e5d39];return _0x17812a;};'use strict';var statusDesc=[_0xc361('0x0'),_0xc361('0x1'),_0xc361('0x2'),_0xc361('0x3'),'invalid',_0xc361('0x4'),_0xc361('0x5'),'ringinuse',_0xc361('0x6')];var monitorFormat={'wav':_0xc361('0x7'),'wav49':_0xc361('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0xc361('0x9'),'roundrobin':_0xc361('0xa')};function VoiceQueue(_0x338a75){this['id']=_0x338a75['id']||0x0;this[_0xc361('0xb')]=_0x338a75[_0xc361('0xb')]||'';this[_0xc361('0xc')]=_0x338a75['monitor_format']||'';this['type']=_0x338a75['type']||_0xc361('0xd');this[_0xc361('0xe')]=0x0;this[_0xc361('0xf')]=0x0;this[_0xc361('0x10')]=0x0;this['answered']=0x0;this[_0xc361('0x11')]=0x0;this[_0xc361('0x12')]=0x0;this[_0xc361('0x13')]=0x0;this[_0xc361('0x14')]=0x0;this[_0xc361('0x15')]=0x0;this[_0xc361('0x16')]=0x0;this['available']=0x0;this['acw']=_0x338a75[_0xc361('0x17')]||![];this[_0xc361('0x18')]=_0x338a75['acwTimeout']||0xa;this[_0xc361('0x19')]=_0x338a75[_0xc361('0x19')]||'no';this[_0xc361('0x1a')]=!![];this['message']='';this['originated']=0x0;this['temp']=0x0;this[_0xc361('0x1b')]=_0x338a75[_0xc361('0x1b')]||null;this[_0xc361('0x1c')]=_0x338a75[_0xc361('0x1c')]?_0x338a75[_0xc361('0x1c')]:null;this[_0xc361('0x1d')]=_0x338a75['dialActive'];this['dialMethod']=_0x338a75[_0xc361('0x1e')]||_0xc361('0x1f');this[_0xc361('0x20')]=_0x338a75[_0xc361('0x20')]||0x0;this[_0xc361('0x21')]=_0x338a75[_0xc361('0x21')]||0x0;this[_0xc361('0x22')]=_0x338a75[_0xc361('0x22')]||0x1;this[_0xc361('0x23')]=_0x338a75[_0xc361('0x23')]||_0xc361('0x24');this[_0xc361('0x25')]=_0x338a75[_0xc361('0x25')]||0.03;this[_0xc361('0x26')]=_0x338a75['dialPredictiveInterval']||0x258;this[_0xc361('0x27')]=_0x338a75[_0xc361('0x27')]||'anonymous';this[_0xc361('0x28')]=_0x338a75[_0xc361('0x28')]||_0xc361('0x29');this['dialOriginateTimeout']=_0x338a75[_0xc361('0x2a')]||0x1e;this[_0xc361('0x2b')]=_0x338a75['dialQueueOptions']||_0xc361('0x2c');this[_0xc361('0x2d')]=_0x338a75[_0xc361('0x2d')]||0x3;this['dialQueueProject']=_0x338a75[_0xc361('0x2e')]||undefined;this[_0xc361('0x2f')]=_0x338a75['dialCongestionMaxRetry']||0x3;this[_0xc361('0x30')]=_0x338a75[_0xc361('0x30')]||0x96;this[_0xc361('0x31')]=_0x338a75[_0xc361('0x31')]||0x3;this[_0xc361('0x32')]=_0x338a75[_0xc361('0x32')]||0x96;this[_0xc361('0x33')]=_0x338a75[_0xc361('0x33')]||0x3;this[_0xc361('0x34')]=_0x338a75[_0xc361('0x34')]||0x96;this[_0xc361('0x35')]=_0x338a75['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x338a75['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x338a75[_0xc361('0x36')]||0x3;this[_0xc361('0x37')]=_0x338a75['dialDropRetryFrequency']||0x96;this[_0xc361('0x38')]=_0x338a75['dialAbandonedMaxRetry']||0x3;this[_0xc361('0x39')]=_0x338a75['dialAbandonedRetryFrequency']||0x96;this[_0xc361('0x3a')]=_0x338a75[_0xc361('0x3a')]||0x3;this[_0xc361('0x3b')]=_0x338a75[_0xc361('0x3b')]||0x96;this[_0xc361('0x3c')]=_0x338a75['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x338a75[_0xc361('0x3d')]||0x96;this[_0xc361('0x3e')]=_0x338a75[_0xc361('0x3e')]||0x4;this['Trunk']=_0x338a75[_0xc361('0x3f')]?_0x338a75['Trunk']:undefined;this['TrunkBackup']=_0x338a75['TrunkBackup']?_0x338a75[_0xc361('0x40')]:undefined;this[_0xc361('0x41')]=_0x338a75[_0xc361('0x41')]||undefined;this[_0xc361('0x42')]=_0x338a75[_0xc361('0x42')]?_0x338a75['Interval']:undefined;this[_0xc361('0x43')]=_0x338a75[_0xc361('0x43')]||_0xc361('0x44');this[_0xc361('0x45')]=_0x338a75['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc361('0x46')]=_0x338a75[_0xc361('0x46')]||undefined;this['strategy']=strategy[_0x338a75[_0xc361('0x47')]]||'rrmemory';this[_0xc361('0x48')]=!![];this[_0xc361('0x49')]=_0x338a75[_0xc361('0x49')]||![];this[_0xc361('0x4a')]=_0x338a75['dialAMDInitialSilence'];this[_0xc361('0x4b')]=_0x338a75[_0xc361('0x4b')];this[_0xc361('0x4c')]=_0x338a75[_0xc361('0x4c')];this[_0xc361('0x4d')]=_0x338a75[_0xc361('0x4d')];this[_0xc361('0x4e')]=_0x338a75[_0xc361('0x4e')];this[_0xc361('0x4f')]=_0x338a75['dialAMDBetweenWordsSilence'];this[_0xc361('0x50')]=_0x338a75[_0xc361('0x50')];this[_0xc361('0x51')]=_0x338a75['dialAMDSilenceThreshold'];this[_0xc361('0x52')]=_0x338a75[_0xc361('0x52')];this['outboundRejectCallsDay']=0x0;this[_0xc361('0x53')]=0x0;this[_0xc361('0x54')]=_0x338a75[_0xc361('0x54')];this[_0xc361('0x55')]=0x0;this[_0xc361('0x56')]=0x0;this[_0xc361('0x57')]=0x0;this[_0xc361('0x58')]=0x0;this[_0xc361('0x59')]=0x0;this[_0xc361('0x5a')]=0x0;this[_0xc361('0x5b')]=0x0;this[_0xc361('0x5c')]=0x0;this[_0xc361('0x5d')]=0x0;this[_0xc361('0x5e')]=0x0;this[_0xc361('0x5f')]=0x0;this[_0xc361('0x60')]=0x0;this[_0xc361('0x61')]=0x0;this[_0xc361('0x62')]=0x0;this['startProgressive']=undefined;this[_0xc361('0x63')]=undefined;this[_0xc361('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xc361('0x65')]=0x0;this[_0xc361('0x66')]=0x0;this[_0xc361('0x67')]=0x0;this[_0xc361('0x68')]=0x0;this[_0xc361('0x69')]=0x0;this[_0xc361('0x6a')]=0x0;this[_0xc361('0x6b')]=0x0;this[_0xc361('0x6c')]=0x0;this[_0xc361('0x6d')]=_0x338a75[_0xc361('0x6e')]||0x14;this[_0xc361('0x6f')]=_0x338a75['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc361('0x70')]=0x0;this[_0xc361('0x71')]=0x0;this[_0xc361('0x72')]=0x1;this[_0xc361('0x73')]=0x0;this['erlangCallToSecond']=0x0;this[_0xc361('0x74')]=0x0;this[_0xc361('0x75')]=0x0;this['dialRecallMeTimeout']=_0x338a75[_0xc361('0x76')]||0x1e;this[_0xc361('0x77')]=_0x338a75[_0xc361('0x77')]||![];this[_0xc361('0x78')]=_0x338a75[_0xc361('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x338a75['dialAgiAfterHangupClient']||![];this[_0xc361('0x79')]=_0x338a75['dialAgiAfterHangupAgent']||![];this[_0xc361('0xc')]=monitorFormat[_0x338a75[_0xc361('0xc')]]?monitorFormat[_0x338a75[_0xc361('0xc')]]:undefined;this[_0xc361('0x7a')]=_0x338a75[_0xc361('0x7a')]||![];this['mandatoryDispositionPause']=_0x338a75[_0xc361('0x7b')]?_0x338a75[_0xc361('0x7b')]: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 a772c12..6158294 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 _0x4083=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1e85db,_0x432aad){var _0x11066d=function(_0x254d3c){while(--_0x254d3c){_0x1e85db['push'](_0x1e85db['shift']());}};_0x11066d(++_0x432aad);}(_0x4083,0x14f));var _0x3408=function(_0x3b24ce,_0x3ea968){_0x3b24ce=_0x3b24ce-0x0;var _0x5e25c9=_0x4083[_0x3b24ce];return _0x5e25c9;};'use strict';function VtigerAccount(_0x146763){this['id']=_0x146763['id']||0x0;this[_0x3408('0x0')]=_0x146763[_0x3408('0x0')]||'';this['username']=_0x146763[_0x3408('0x1')]||'';this[_0x3408('0x2')]=_0x146763[_0x3408('0x2')]||'';this[_0x3408('0x3')]=_0x146763[_0x3408('0x3')]||'';this[_0x3408('0x4')]=_0x146763[_0x3408('0x4')]||'';this[_0x3408('0x5')]=_0x146763[_0x3408('0x5')]||{};}module[_0x3408('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8544=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x12aa01,_0x57e967){var _0x10cac9=function(_0x3b6bde){while(--_0x3b6bde){_0x12aa01['push'](_0x12aa01['shift']());}};_0x10cac9(++_0x57e967);}(_0x8544,0x1b0));var _0x4854=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8544[_0x3e5086];return _0xfeb102;};'use strict';function VtigerAccount(_0x31457f){this['id']=_0x31457f['id']||0x0;this[_0x4854('0x0')]=_0x31457f[_0x4854('0x0')]||'';this['username']=_0x31457f[_0x4854('0x1')]||'';this[_0x4854('0x2')]=_0x31457f['accessKey']||'';this['remoteUri']=_0x31457f[_0x4854('0x3')]||'';this[_0x4854('0x4')]=_0x31457f[_0x4854('0x4')]||'';this[_0x4854('0x5')]=_0x31457f[_0x4854('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e005db5..c184151 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x37b641,_0x59521f){var _0x3bcb53=function(_0x5792c4){while(--_0x5792c4){_0x37b641['push'](_0x37b641['shift']());}};_0x3bcb53(++_0x59521f);}(_0x2032,0xd9));var _0x2203=function(_0x468c49,_0x3e7e88){_0x468c49=_0x468c49-0x0;var _0x2840e9=_0x2032[_0x468c49];return _0x2840e9;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x7a54,0x106));var _0x47a5=function(_0x2b54ef,_0x333f0d){_0x2b54ef=_0x2b54ef-0x0;var _0x15b3f3=_0x7a54[_0x2b54ef];return _0x15b3f3;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index aa3dce3..881a327 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 _0x9563=['Configurations','name','description','host','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x55c0a5,_0x4a6453){var _0x2a39c7=function(_0x2feb2a){while(--_0x2feb2a){_0x55c0a5['push'](_0x55c0a5['shift']());}};_0x2a39c7(++_0x4a6453);}(_0x9563,0x1e7));var _0x3956=function(_0x21c5b5,_0xd49696){_0x21c5b5=_0x21c5b5-0x0;var _0x2c8073=_0x9563[_0x21c5b5];return _0x2c8073;};'use strict';function ZohoAccount(_0x1eb54d){this['id']=_0x1eb54d['id']||0x0;this[_0x3956('0x0')]=_0x1eb54d['name']||'';this[_0x3956('0x1')]=_0x1eb54d[_0x3956('0x1')]||'';this[_0x3956('0x2')]=_0x1eb54d[_0x3956('0x2')]||'';this['zone']=_0x1eb54d['zone']||'';this[_0x3956('0x3')]=_0x1eb54d['clientId']||'';this[_0x3956('0x4')]=_0x1eb54d[_0x3956('0x4')]||'';this[_0x3956('0x5')]=_0x1eb54d[_0x3956('0x5')]||'';this['code']=_0x1eb54d[_0x3956('0x6')]||'';this[_0x3956('0x7')]=_0x1eb54d[_0x3956('0x7')]||'';this[_0x3956('0x8')]=_0x1eb54d[_0x3956('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x5c96=['zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x509b99,_0x3ff1f0){var _0x383d46=function(_0x5cfcab){while(--_0x5cfcab){_0x509b99['push'](_0x509b99['shift']());}};_0x383d46(++_0x3ff1f0);}(_0x5c96,0x133));var _0x65c9=function(_0x4f6765,_0x21db60){_0x4f6765=_0x4f6765-0x0;var _0x1732db=_0x5c96[_0x4f6765];return _0x1732db;};'use strict';function ZohoAccount(_0x1e81e3){this['id']=_0x1e81e3['id']||0x0;this[_0x65c9('0x0')]=_0x1e81e3[_0x65c9('0x0')]||'';this[_0x65c9('0x1')]=_0x1e81e3['description']||'';this[_0x65c9('0x2')]=_0x1e81e3[_0x65c9('0x2')]||'';this[_0x65c9('0x3')]=_0x1e81e3[_0x65c9('0x3')]||'';this[_0x65c9('0x4')]=_0x1e81e3[_0x65c9('0x4')]||'';this[_0x65c9('0x5')]=_0x1e81e3['clientSecret']||'';this['serverUrl']=_0x1e81e3['serverUrl']||'';this['code']=_0x1e81e3[_0x65c9('0x6')]||'';this[_0x65c9('0x7')]=_0x1e81e3[_0x65c9('0x7')]||'';this['Configurations']=_0x1e81e3[_0x65c9('0x8')]||{};}module[_0x65c9('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 310a607..a6927ab 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 _0xaa92=['string','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','SIP/%s','membername','Contact','firstName','lastName','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil'];(function(_0x157b56,_0x20de65){var _0x8bbb3c=function(_0x17120e){while(--_0x17120e){_0x157b56['push'](_0x157b56['shift']());}};_0x8bbb3c(++_0x20de65);}(_0xaa92,0x14d));var _0x2aa9=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xaa92[_0x1b1f88];return _0x5045b9;};'use strict';var util=require('util');var _=require(_0x2aa9('0x0'));var moment=require(_0x2aa9('0x1'));function checkNameSurname(_0x238be6,_0x491341,_0xee3203){var _0x3c5184='';if(!_[_0x2aa9('0x2')](_0x491341)&&_0x2aa9('0x3')===typeof _0x491341){_0x3c5184+=_0x491341;}if(!_[_0x2aa9('0x2')](_0xee3203)&&_0x2aa9('0x3')===typeof _0xee3203){_0x3c5184+='\x20'+_0xee3203;}if(_0x3c5184!==''){return _0x3c5184;}return _0x238be6;}function Action(_0x5f5438,_0x2ffed0,_0x198620,_0x63da7d,_0x2a30c6){this['uniqueid']=_0x198620||undefined;this['idContact']=_0x5f5438['id'];this[_0x2aa9('0x4')]=_0x2ffed0[_0x2aa9('0x5')];this['type']=_0x2ffed0[_0x2aa9('0x6')];this[_0x2aa9('0x7')]=_0x2aa9('0x4');this[_0x2aa9('0x8')]=![];this['membername']=_[_0x2aa9('0x2')](_0x5f5438[_0x2aa9('0x9')])?undefined:_0x5f5438[_0x2aa9('0x9')][_0x2aa9('0x5')];this[_0x2aa9('0xa')]=this['membername']?util['format'](_0x2aa9('0xb'),this[_0x2aa9('0xc')]):_0x63da7d||undefined;this['calleridname']=checkNameSurname(_0x5f5438[_0x2aa9('0xd')]['phone'],_0x5f5438[_0x2aa9('0xd')][_0x2aa9('0xe')],_0x5f5438['Contact'][_0x2aa9('0xf')]);this['active']=_0x5f5438['active']||![];this[_0x2aa9('0x10')]=_0x5f5438[_0x2aa9('0xd')][_0x2aa9('0x11')];this['scheduledat']=_0x5f5438[_0x2aa9('0x12')];this[_0x2aa9('0x13')]=_0x5f5438['countbusyretry']||0x0;this[_0x2aa9('0x14')]=_0x5f5438[_0x2aa9('0x14')]||0x0;this[_0x2aa9('0x15')]=_0x5f5438[_0x2aa9('0x15')]||0x0;this[_0x2aa9('0x16')]=(_0x5f5438['countbusyretry']||0x0)+(_0x5f5438['countcongestionretry']||0x0)+(_0x5f5438[_0x2aa9('0x15')]||0x0)+(_0x5f5438[_0x2aa9('0x17')]||0x0)+(_0x5f5438[_0x2aa9('0x18')]||0x0)+(_0x5f5438[_0x2aa9('0x19')]||0x0)+(_0x5f5438[_0x2aa9('0x1a')]||0x0)+(_0x5f5438[_0x2aa9('0x1b')]||0x0);this[_0x2aa9('0x17')]=_0x5f5438[_0x2aa9('0x17')]||0x0;this[_0x2aa9('0x18')]=_0x5f5438['countdropretry']||0x0;this[_0x2aa9('0x19')]=_0x5f5438[_0x2aa9('0x19')]||0x0;this['countmachineretry']=_0x5f5438[_0x2aa9('0x1a')]||0x0;this[_0x2aa9('0x1b')]=_0x5f5438['countagentrejectretry']||0x0;this[_0x2aa9('0x1c')]=_0x5f5438[_0x2aa9('0x1c')];this['callbackuniqueid']=_0x5f5438[_0x2aa9('0x1d')];this[_0x2aa9('0x1e')]=_0x5f5438['callbackat'];this[_0x2aa9('0x1f')]=_0x5f5438[_0x2aa9('0x1f')];this[_0x2aa9('0x20')]=_0x5f5438[_0x2aa9('0x20')];this['ListId']=_0x5f5438[_0x2aa9('0x21')];this['UserId']=_[_0x2aa9('0x2')](_0x5f5438[_0x2aa9('0x9')])?_0x5f5438[_0x2aa9('0x22')]:_0x5f5438[_0x2aa9('0x9')]['id'];this['VoiceQueueId']=_0x5f5438[_0x2aa9('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x2aa9('0x24')][_0x2aa9('0x25')]=function(){return util[_0x2aa9('0x26')](_0x2aa9('0x27'),this['calleridname'],this[_0x2aa9('0x28')]);};module[_0x2aa9('0x29')]=Action; \ No newline at end of file +var _0xc654=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','calleridname','number','lodash','moment','isNil','string','uniqueid','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc654,0x1ec));var _0x4c65=function(_0x1c2aeb,_0x48433c){_0x1c2aeb=_0x1c2aeb-0x0;var _0x783379=_0xc654[_0x1c2aeb];return _0x783379;};'use strict';var util=require('util');var _=require(_0x4c65('0x0'));var moment=require(_0x4c65('0x1'));function checkNameSurname(_0x3c8383,_0x1e23a2,_0x49f877){var _0x4e5afb='';if(!_[_0x4c65('0x2')](_0x1e23a2)&&_0x4c65('0x3')===typeof _0x1e23a2){_0x4e5afb+=_0x1e23a2;}if(!_[_0x4c65('0x2')](_0x49f877)&&_0x4c65('0x3')===typeof _0x49f877){_0x4e5afb+='\x20'+_0x49f877;}if(_0x4e5afb!==''){return _0x4e5afb;}return _0x3c8383;}function Action(_0x44e079,_0x2ff545,_0x4fa0b9,_0x4b754a,_0xf78111){this[_0x4c65('0x4')]=_0x4fa0b9||undefined;this['idContact']=_0x44e079['id'];this['queue']=_0x2ff545[_0x4c65('0x5')];this[_0x4c65('0x6')]=_0x2ff545[_0x4c65('0x6')];this[_0x4c65('0x7')]='queue';this[_0x4c65('0x8')]=![];this[_0x4c65('0x9')]=_['isNil'](_0x44e079[_0x4c65('0xa')])?undefined:_0x44e079[_0x4c65('0xa')]['name'];this[_0x4c65('0xb')]=this[_0x4c65('0x9')]?util[_0x4c65('0xc')](_0x4c65('0xd'),this[_0x4c65('0x9')]):_0x4b754a||undefined;this['calleridname']=checkNameSurname(_0x44e079[_0x4c65('0xe')][_0x4c65('0xf')],_0x44e079[_0x4c65('0xe')][_0x4c65('0x10')],_0x44e079[_0x4c65('0xe')][_0x4c65('0x11')]);this['active']=_0x44e079['active']||![];this['calleridnum']=_0x44e079['Contact'][_0x4c65('0xf')];this[_0x4c65('0x12')]=_0x44e079[_0x4c65('0x12')];this[_0x4c65('0x13')]=_0x44e079[_0x4c65('0x13')]||0x0;this[_0x4c65('0x14')]=_0x44e079[_0x4c65('0x14')]||0x0;this[_0x4c65('0x15')]=_0x44e079[_0x4c65('0x15')]||0x0;this[_0x4c65('0x16')]=(_0x44e079['countbusyretry']||0x0)+(_0x44e079['countcongestionretry']||0x0)+(_0x44e079[_0x4c65('0x15')]||0x0)+(_0x44e079[_0x4c65('0x17')]||0x0)+(_0x44e079[_0x4c65('0x18')]||0x0)+(_0x44e079[_0x4c65('0x19')]||0x0)+(_0x44e079['countmachineretry']||0x0)+(_0x44e079[_0x4c65('0x1a')]||0x0);this[_0x4c65('0x17')]=_0x44e079[_0x4c65('0x17')]||0x0;this['countdropretry']=_0x44e079[_0x4c65('0x18')]||0x0;this[_0x4c65('0x19')]=_0x44e079[_0x4c65('0x19')]||0x0;this['countmachineretry']=_0x44e079[_0x4c65('0x1b')]||0x0;this['countagentrejectretry']=_0x44e079[_0x4c65('0x1a')]||0x0;this[_0x4c65('0x1c')]=_0x44e079[_0x4c65('0x1c')];this[_0x4c65('0x1d')]=_0x44e079[_0x4c65('0x1d')];this['callbackat']=_0x44e079[_0x4c65('0x1e')];this[_0x4c65('0x1f')]=_0x44e079[_0x4c65('0x1f')];this[_0x4c65('0x20')]=_0x44e079[_0x4c65('0x20')];this[_0x4c65('0x21')]=_0x44e079[_0x4c65('0x21')];this[_0x4c65('0x22')]=_[_0x4c65('0x2')](_0x44e079[_0x4c65('0xa')])?_0x44e079['UserId']:_0x44e079[_0x4c65('0xa')]['id'];this[_0x4c65('0x23')]=_0x44e079[_0x4c65('0x23')];this[_0x4c65('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x4c65('0x25')]=function(){return util[_0x4c65('0xc')]('\x22%s\x22\x20<%s>',this[_0x4c65('0x26')],this[_0x4c65('0x27')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index dde4b7b..50607c1 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 _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','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','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0x470e21,_0x261058){var _0x4271ba=function(_0x586dcb){while(--_0x586dcb){_0x470e21['push'](_0x470e21['shift']());}};_0x4271ba(++_0x261058);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file +var _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','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','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0xd42a32,_0x331f76){var _0x2a7f4f=function(_0x438f47){while(--_0x438f47){_0xd42a32['push'](_0xd42a32['shift']());}};_0x2a7f4f(++_0x331f76);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index e15de66..d938257 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 _0xc3b5=['../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal'];(function(_0x417b5c,_0x2767c0){var _0x3ba4e0=function(_0x54a403){while(--_0x54a403){_0x417b5c['push'](_0x417b5c['shift']());}};_0x3ba4e0(++_0x2767c0);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x28c82b,_0x212911){_0x28c82b=_0x28c82b-0x0;var _0x1b414a=_0xc3b5[_0x28c82b];return _0x1b414a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x5c3b('0x0'))(_0x5c3b('0x1'));var _=require(_0x5c3b('0x2'));var cmHopper=require(_0x5c3b('0x3'));var cmHopperFinal=require(_0x5c3b('0x4'));var cmHopperHistory=require(_0x5c3b('0x5'));var cmHopperBlack=require(_0x5c3b('0x6'));var voiceQueueRt=require(_0x5c3b('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x5c3b('0x8'));function loggerCatch(_0x6b8a1e){return function(_0x56345e){logger[_0x5c3b('0x9')](_0x6b8a1e,util[_0x5c3b('0xa')](_0x56345e,{'showHidden':![],'depth':null}));};}function create(_0x420839){return BPromise[_0x5c3b('0xb')]()['then'](cmHopperHistory[_0x5c3b('0xc')](_0x420839))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0xe')));}function createAgent(_0x20e71){return BPromise['resolve']()[_0x5c3b('0xf')](agentReportPreview[_0x5c3b('0xc')](_0x20e71))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0xe')));}function moveContact(_0x363c3d){return BPromise['resolve']()[_0x5c3b('0xf')](cmHopper[_0x5c3b('0x10')](_0x363c3d,!![]))['catch'](loggerCatch(_0x5c3b('0x11')));}exports[_0x5c3b('0x12')]=function(_0x507c2e){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopperBlack[_0x5c3b('0x12')](_0x507c2e))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x13')));};exports[_0x5c3b('0x14')]=function(_0x27965f){return BPromise['resolve']()[_0x5c3b('0xf')](cmHopper['getContactPreview'](_0x27965f))['catch'](loggerCatch(_0x5c3b('0x15')));};exports[_0x5c3b('0xc')]=function(_0x18757e,_0x589797){create(_0x18757e)[_0x5c3b('0xd')](loggerCatch(_0x589797));moveContact(_0x18757e)[_0x5c3b('0xd')](loggerCatch(_0x589797));};exports[_0x5c3b('0x16')]=function(_0x59f71b,_0x385053){createAgent(_0x59f71b)[_0x5c3b('0xd')](loggerCatch(_0x385053));};exports['createCustomerHistory']=function(_0x3973bc,_0x4658ce){create(_0x3973bc)[_0x5c3b('0xd')](loggerCatch(_0x4658ce));};exports[_0x5c3b('0x17')]=function(_0x103943,_0x3e6d67){moveContact(_0x103943)[_0x5c3b('0xd')](loggerCatch(_0x3e6d67));};exports[_0x5c3b('0x18')]=function(_0xc63307,_0x1138b0,_0x4ec8c1){if(_0x1138b0){_0xc63307['UserId']=null;}if(_0x4ec8c1){_0xc63307[_0x5c3b('0x19')]=![];}return BPromise[_0x5c3b('0xb')]()['then'](cmHopper[_0x5c3b('0x18')](_0xc63307))['catch'](loggerCatch(_0x5c3b('0x1a')));};exports[_0x5c3b('0x1b')]=function(_0x2bb9dc){return BPromise[_0x5c3b('0xb')]()['then'](cmHopper[_0x5c3b('0x1b')](_0x2bb9dc))[_0x5c3b('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x5c3b('0x1c')]=function(_0x2c8682){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopper['unlockContact']({'UserId':null},_0x2c8682,0x1))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x1d')));};exports[_0x5c3b('0x1e')]=function(_0x28b782){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopper['unlockContact']({'active':![]},_0x28b782,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x5c3b('0x1f')]=function(_0x3e6832){var _0x59b640={};_0x59b640[_0x5c3b('0x20')]=_0x3e6832[_0x5c3b('0x20')];_0x59b640[_0x5c3b('0x21')]=_0x3e6832[_0x5c3b('0x21')];_0x59b640[_0x5c3b('0x22')]=_0x3e6832[_0x5c3b('0x22')];_0x59b640[_0x5c3b('0x23')]=_0x3e6832[_0x5c3b('0x23')];_0x59b640[_0x5c3b('0x24')]=_0x3e6832[_0x5c3b('0x24')];_0x59b640[_0x5c3b('0x25')]=_0x3e6832[_0x5c3b('0x26')];_0x59b640['queuecallerleaveAt']=_0x3e6832[_0x5c3b('0x26')];_0x59b640[_0x5c3b('0x27')]=0x1;_0x59b640[_0x5c3b('0x28')]=_0x3e6832[_0x5c3b('0x29')];_0x59b640[_0x5c3b('0x2a')]=_0x3e6832[_0x5c3b('0x2b')];_0x59b640[_0x5c3b('0x2c')]=_0x5c3b('0x2d');_0x59b640[_0x5c3b('0x2e')]=_0x5c3b('0x2f');_0x59b640[_0x5c3b('0x30')]=0x0;_0x59b640[_0x5c3b('0x31')]=0x1;_0x59b640[_0x5c3b('0x32')]=_0x3e6832[_0x5c3b('0x2b')];_0x59b640[_0x5c3b('0x33')]=_0x5c3b('0x34');return BPromise[_0x5c3b('0xb')]()['then'](voiceQueueReport[_0x5c3b('0x35')](_0x59b640))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x36')));};exports[_0x5c3b('0x37')]=function(_0x57dbcb,_0x35939b){return BPromise[_0x5c3b('0xb')]()['then'](cmHopper[_0x5c3b('0x37')](_0x57dbcb,_0x35939b))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x38')));};exports[_0x5c3b('0x39')]=function(_0x243d84){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopper[_0x5c3b('0x18')](_0x243d84,!![],!![]))[_0x5c3b('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xc3b5=['../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal'];(function(_0x61f31a,_0x1fca58){var _0x487c53=function(_0x524cd2){while(--_0x524cd2){_0x61f31a['push'](_0x61f31a['shift']());}};_0x487c53(++_0x1fca58);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x21755d,_0x20503a){_0x21755d=_0x21755d-0x0;var _0x4ac84e=_0xc3b5[_0x21755d];return _0x4ac84e;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x5c3b('0x0'))(_0x5c3b('0x1'));var _=require(_0x5c3b('0x2'));var cmHopper=require(_0x5c3b('0x3'));var cmHopperFinal=require(_0x5c3b('0x4'));var cmHopperHistory=require(_0x5c3b('0x5'));var cmHopperBlack=require(_0x5c3b('0x6'));var voiceQueueRt=require(_0x5c3b('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x5c3b('0x8'));function loggerCatch(_0x6b8a1e){return function(_0x56345e){logger[_0x5c3b('0x9')](_0x6b8a1e,util[_0x5c3b('0xa')](_0x56345e,{'showHidden':![],'depth':null}));};}function create(_0x420839){return BPromise[_0x5c3b('0xb')]()['then'](cmHopperHistory[_0x5c3b('0xc')](_0x420839))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0xe')));}function createAgent(_0x20e71){return BPromise['resolve']()[_0x5c3b('0xf')](agentReportPreview[_0x5c3b('0xc')](_0x20e71))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0xe')));}function moveContact(_0x363c3d){return BPromise['resolve']()[_0x5c3b('0xf')](cmHopper[_0x5c3b('0x10')](_0x363c3d,!![]))['catch'](loggerCatch(_0x5c3b('0x11')));}exports[_0x5c3b('0x12')]=function(_0x507c2e){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopperBlack[_0x5c3b('0x12')](_0x507c2e))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x13')));};exports[_0x5c3b('0x14')]=function(_0x27965f){return BPromise['resolve']()[_0x5c3b('0xf')](cmHopper['getContactPreview'](_0x27965f))['catch'](loggerCatch(_0x5c3b('0x15')));};exports[_0x5c3b('0xc')]=function(_0x18757e,_0x589797){create(_0x18757e)[_0x5c3b('0xd')](loggerCatch(_0x589797));moveContact(_0x18757e)[_0x5c3b('0xd')](loggerCatch(_0x589797));};exports[_0x5c3b('0x16')]=function(_0x59f71b,_0x385053){createAgent(_0x59f71b)[_0x5c3b('0xd')](loggerCatch(_0x385053));};exports['createCustomerHistory']=function(_0x3973bc,_0x4658ce){create(_0x3973bc)[_0x5c3b('0xd')](loggerCatch(_0x4658ce));};exports[_0x5c3b('0x17')]=function(_0x103943,_0x3e6d67){moveContact(_0x103943)[_0x5c3b('0xd')](loggerCatch(_0x3e6d67));};exports[_0x5c3b('0x18')]=function(_0xc63307,_0x1138b0,_0x4ec8c1){if(_0x1138b0){_0xc63307['UserId']=null;}if(_0x4ec8c1){_0xc63307[_0x5c3b('0x19')]=![];}return BPromise[_0x5c3b('0xb')]()['then'](cmHopper[_0x5c3b('0x18')](_0xc63307))['catch'](loggerCatch(_0x5c3b('0x1a')));};exports[_0x5c3b('0x1b')]=function(_0x2bb9dc){return BPromise[_0x5c3b('0xb')]()['then'](cmHopper[_0x5c3b('0x1b')](_0x2bb9dc))[_0x5c3b('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x5c3b('0x1c')]=function(_0x2c8682){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopper['unlockContact']({'UserId':null},_0x2c8682,0x1))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x1d')));};exports[_0x5c3b('0x1e')]=function(_0x28b782){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopper['unlockContact']({'active':![]},_0x28b782,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x5c3b('0x1f')]=function(_0x3e6832){var _0x59b640={};_0x59b640[_0x5c3b('0x20')]=_0x3e6832[_0x5c3b('0x20')];_0x59b640[_0x5c3b('0x21')]=_0x3e6832[_0x5c3b('0x21')];_0x59b640[_0x5c3b('0x22')]=_0x3e6832[_0x5c3b('0x22')];_0x59b640[_0x5c3b('0x23')]=_0x3e6832[_0x5c3b('0x23')];_0x59b640[_0x5c3b('0x24')]=_0x3e6832[_0x5c3b('0x24')];_0x59b640[_0x5c3b('0x25')]=_0x3e6832[_0x5c3b('0x26')];_0x59b640['queuecallerleaveAt']=_0x3e6832[_0x5c3b('0x26')];_0x59b640[_0x5c3b('0x27')]=0x1;_0x59b640[_0x5c3b('0x28')]=_0x3e6832[_0x5c3b('0x29')];_0x59b640[_0x5c3b('0x2a')]=_0x3e6832[_0x5c3b('0x2b')];_0x59b640[_0x5c3b('0x2c')]=_0x5c3b('0x2d');_0x59b640[_0x5c3b('0x2e')]=_0x5c3b('0x2f');_0x59b640[_0x5c3b('0x30')]=0x0;_0x59b640[_0x5c3b('0x31')]=0x1;_0x59b640[_0x5c3b('0x32')]=_0x3e6832[_0x5c3b('0x2b')];_0x59b640[_0x5c3b('0x33')]=_0x5c3b('0x34');return BPromise[_0x5c3b('0xb')]()['then'](voiceQueueReport[_0x5c3b('0x35')](_0x59b640))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x36')));};exports[_0x5c3b('0x37')]=function(_0x57dbcb,_0x35939b){return BPromise[_0x5c3b('0xb')]()['then'](cmHopper[_0x5c3b('0x37')](_0x57dbcb,_0x35939b))[_0x5c3b('0xd')](loggerCatch(_0x5c3b('0x38')));};exports[_0x5c3b('0x39')]=function(_0x243d84){return BPromise[_0x5c3b('0xb')]()[_0x5c3b('0xf')](cmHopper[_0x5c3b('0x18')](_0x243d84,!![],!![]))[_0x5c3b('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 d048906..ab2d10f 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 _0x08f6=['interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countglobal','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','logger','info','inspect','logger2','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','UserId','logCustomer','talktime','answertime','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue'];(function(_0x555e09,_0x16b74e){var _0x4537c0=function(_0x1f15d2){while(--_0x1f15d2){_0x555e09['push'](_0x555e09['shift']());}};_0x4537c0(++_0x16b74e);}(_0x08f6,0x14f));var _0x608f=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x08f6[_0x2d8f6c];return _0x3a00f6;};'use strict';var util=require(_0x608f('0x0'));var _=require(_0x608f('0x1'));var moment=require(_0x608f('0x2'));var logger=require('../../../../config/logger')(_0x608f('0x3'));var ipAgi=process[_0x608f('0x4')][_0x608f('0x5')]||_0x608f('0x6');function getSeconds(_0x30ccdc,_0x5bccc2){var _0x388bc5=moment(_0x30ccdc)[_0x608f('0x7')](0x0);var _0x151c4c=moment(_0x5bccc2)[_0x608f('0x7')](0x0);return _0x388bc5[_0x608f('0x8')](_0x151c4c,'seconds');}exports['loggerCatch']=function(_0x555d94){return function(_0x2a1c19){logger['error'](_0x555d94,util['inspect'](_0x2a1c19,{'showHidden':![],'depth':null}));};};exports[_0x608f('0x9')]=function(_0x41686a,_0x2fc582){logger[_0x608f('0xa')](_0x41686a,util[_0x608f('0xb')](_0x2fc582,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xaf2539,_0x5b4949){logger['error'](_0xaf2539,util['inspect'](_0x5b4949,{'showHidden':![],'depth':null}));};exports[_0x608f('0xc')]=function(_0x36b645){return function(_0x2db38c){logger[_0x608f('0xa')](_0x36b645,util[_0x608f('0xb')](_0x2db38c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x575662,_0x198eb0,_0x3c8baf){return{'message':_0x575662,'unlock':_0x198eb0,'active':_0x3c8baf};};exports[_0x608f('0xd')]=function(_0x4f5e34,_0x4c499e,_0x10562e){if(!_['isUndefined'](_0x10562e)&&_0x608f('0xe')===typeof _0x10562e&&!_[_0x608f('0xf')](_0x10562e)){if(!_[_0x608f('0x10')](_0x4c499e)&&_0x608f('0xe')===typeof _0x4c499e&&!_[_0x608f('0xf')](_0x4c499e)){return util[_0x608f('0x11')]('\x22%s\x22\x20<%s>',_0x4c499e,_0x10562e);}return util[_0x608f('0x11')](_0x608f('0x12'),_0x10562e,_0x10562e);}if(!_['isUndefined'](_0x4f5e34)&&_0x608f('0xe')===typeof _0x4f5e34&&!_['isEmpty'](_0x4f5e34)){return _0x4f5e34;}return _0x608f('0x13');};exports[_0x608f('0x14')]=function(_0x18e186){if(_[_0x608f('0x15')](_0x18e186)){return![];}return _0x18e186;};exports[_0x608f('0x16')]=function(_0x3542df,_0x49b201,_0xecc836,_0x526369,_0xe03115,_0x4443d3){var _0x334fe0={'XMD-QUEUE':_0x49b201[_0x608f('0x17')]?_0x49b201[_0x608f('0x17')][_0x608f('0x18')]:'','XMD-CALLERID':_0x526369,'XMD-CALLERID-PREVIEW':_0x4443d3?util['format'](_0x608f('0x12'),_0x4443d3[_0x608f('0x19')],_0x4443d3[_0x608f('0x1a')]):_0x526369,'XMD-DIALID':_0xe03115,'XMD-CONTACTID':_0x49b201['ContactId'],'XMD-CDRTYPE':_0x608f('0x1b'),'CALLERID(all)':_0x526369,'XMD-VOICEQUEUEID':_0x49b201[_0x608f('0x1c')],'XMD-DIALCHANNEL':_0xecc836,'XMD-DIALTIMEOUT':_0x3542df[_0x608f('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x608f('0x11')](_0x608f('0x1e'),_0x3542df[_0x608f('0x1f')]?'g':'',_[_0x608f('0xf')](_0x3542df[_0x608f('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3542df[_0x608f('0x21')]||'','XMD-AGI':_0x3542df[_0x608f('0x22')]?util[_0x608f('0x11')](_0x608f('0x23'),ipAgi,_0x3542df[_0x608f('0x22')]):'NONE','XMD-AGIAFTER':_0x3542df[_0x608f('0x1f')]?util['format'](_0x608f('0x23'),ipAgi,_0x3542df[_0x608f('0x1f')]):_0x608f('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4443d3?_0x4443d3[_0x608f('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x4443d3?_0x4443d3['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x608f('0xf')](_0x3542df['monitor_format'])){_0x334fe0[util[_0x608f('0x11')]('%s',_0x608f('0x26'))]=_0x3542df[_0x608f('0x20')];_0x334fe0[util[_0x608f('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xe03115;}if(_0x49b201&&_0x49b201[_0x608f('0x27')]){for(var _0x113a65 in _0x49b201[_0x608f('0x27')]){if(_0x49b201[_0x608f('0x27')][_0x608f('0x28')](_0x113a65)){if(!_[_0x608f('0x15')](_0x49b201[_0x608f('0x27')][_0x113a65])&&_0x113a65!=='id'&&_0x113a65!==_0x608f('0x29')&&_0x113a65!==_0x608f('0x2a')&&_0x113a65!==_0x608f('0x2b')){_0x334fe0[util[_0x608f('0x11')](_0x608f('0x2c'),_0x608f('0x2d'),_['toUpper'](_0x113a65))]=_0x49b201[_0x608f('0x27')][_0x113a65];}}}}return _0x334fe0;};exports[_0x608f('0x2e')]=function(_0xccf6af){var _0x5848e1={};for(var _0xf26d2d in _0xccf6af){if(_0xccf6af[_0x608f('0x28')](_0xf26d2d)){_0x5848e1[util[_0x608f('0x11')]('%s',_[_0x608f('0x2f')](_0xf26d2d))]=_0xccf6af[_0xf26d2d];}}return{'variables':_0x5848e1};};exports[_0x608f('0x30')]=function(_0x41ccae,_0x532c93){if(!_[_0x608f('0x15')](_0x41ccae)){if(_0x41ccae[_0x608f('0x28')](_0x608f('0x31'))){if(_0x41ccae[_0x608f('0x31')]>0x0){_0x41ccae['originated']-=0x1;}else{logger[_0x608f('0x32')](_0x608f('0x33'),_0x532c93);}}}else{logger['error'](_0x608f('0x34'),_0x532c93);}};exports['logBlacklist']=function(_0x4b3428){var _0x517d52=moment()[_0x608f('0x11')](_0x608f('0x35'));_0x4b3428[_0x608f('0x36')]=0xd;_0x4b3428[_0x608f('0x37')]=_0x608f('0x38');_0x4b3428[_0x608f('0x39')]=_0x517d52;_0x4b3428[_0x608f('0x3a')]=_0x517d52;_0x4b3428[_0x608f('0x3b')]=_0x517d52;};exports[_0x608f('0x3c')]=function(_0x2670cc,_0x182b98,_0x2d8aa0){var _0x3f733a=moment()[_0x608f('0x11')](_0x608f('0x35'));_0x2670cc[_0x608f('0x36')]=_0x182b98;_0x2670cc[_0x608f('0x37')]=_0x2d8aa0;_0x2670cc['responsetime']=_0x3f733a;_0x2670cc['ringtime']=getSeconds(_0x2670cc[_0x608f('0x3a')],_0x2670cc['starttime']);};exports['logLookAgent']=function(_0x54cff5,_0x4a7513,_0xffdfbb){_0x54cff5['membername']=_0x4a7513;_0x54cff5[_0x608f('0x3d')]=_0xffdfbb;};exports[_0x608f('0x3e')]=function(_0x4f8172,_0x543c07,_0x4b774b){var _0x42a0d3=moment()['format'](_0x608f('0x35'));_0x4f8172[_0x608f('0x36')]=_0x543c07;_0x4f8172[_0x608f('0x37')]=_0x4b774b;_0x4f8172[_0x608f('0x3a')]=_0x4f8172[_0x608f('0x3a')]?_0x4f8172[_0x608f('0x3a')]:_0x42a0d3;_0x4f8172[_0x608f('0x3b')]=_0x4f8172['endtime']?_0x4f8172['endtime']:_0x42a0d3;_0x4f8172['ringtime']=getSeconds(_0x4f8172[_0x608f('0x3a')]||0x0,_0x4f8172[_0x608f('0x39')]||0x0);_0x4f8172[_0x608f('0x3f')]=_0x4f8172[_0x608f('0x40')]?getSeconds(_0x4f8172[_0x608f('0x3b')],_0x4f8172[_0x608f('0x40')]):0x0;};exports['isFailure']=function(_0x4987a1){return _0x4987a1==='Failure';};exports[_0x608f('0x41')]=function(_0x4a1d6e,_0x3cd7c8,_0x4ebc1b,_0xe4d424,_0x77db53){var _0x284dec=_0xe4d424?_0x608f('0x42'):_0x4a1d6e['calleridname'];_0x284dec=_0x77db53?'BOOKED':_0x284dec;return{'actionid':_0x4a1d6e[_0x608f('0x43')],'action':_0x608f('0x44'),'channel':_0x4a1d6e[_0x608f('0x45')],'callerid':util[_0x608f('0x11')]('\x22%s\x22\x20<%s>',_0x284dec,_0x4a1d6e['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x608f('0x46'),'Priority':'1','variable':_0x4ebc1b,'timeout':(_0x3cd7c8[_0x608f('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4a1d6e[_0x608f('0x43')]};};exports[_0x608f('0x48')]=function(_0x190fd7){return _0x190fd7[_0x608f('0x49')]+_0x190fd7[_0x608f('0x4a')]+_0x190fd7[_0x608f('0x4b')]+_0x190fd7[_0x608f('0x4c')]+_0x190fd7[_0x608f('0x4d')];};exports[_0x608f('0x4e')]=function(_0x240c67){var _0x3e2d69=_[_0x608f('0x4f')](_0x240c67);_0x3e2d69[_0x608f('0x36')]=0xf;_0x3e2d69[_0x608f('0x37')]=_0x608f('0x50');return _0x3e2d69;};exports['scheduledAt']=function(_0x11d17b,_0x13a180,_0x46b74e){var _0x4c5b42={};_0x4c5b42[_0x13a180]=_0x11d17b[_0x13a180];_0x4c5b42[_0x608f('0x51')]=![];_0x4c5b42[_0x608f('0x52')]=moment()[_0x608f('0x53')](_0x46b74e,'minutes')['format'](_0x608f('0x35'));_0x4c5b42['ContactId']=_0x11d17b[_0x608f('0x54')];_0x4c5b42[_0x608f('0x55')]=_0x11d17b[_0x608f('0x55')];_0x4c5b42[_0x608f('0x1c')]=_0x11d17b[_0x608f('0x1c')]||undefined;return _0x4c5b42;};exports[_0x608f('0x56')]=function(_0x156514,_0x1d8f92){if(!_['isNil'](_0x156514)){if(_0x156514[_0x608f('0x57')]>0x0){_0x156514['pTalking']-=0x1;}else{logger[_0x608f('0x32')](_0x1d8f92,_0x608f('0x58'));}}else{logger['error'](_0x1d8f92,_0x608f('0x59'));}};exports[_0x608f('0x5a')]=function(_0x84775f){if(_0x84775f<=0x0){return!![];}return![];};exports[_0x608f('0x5b')]=function(_0x23cbc7,_0x380266,_0x7b7b54){_0x23cbc7[_0x608f('0x5c')]=_0x380266;_0x23cbc7[_0x608f('0x18')]=_0x23cbc7[_0x608f('0x5d')];_0x23cbc7[_0x608f('0x5e')]=_0x23cbc7[_0x608f('0x45')];if(_0x7b7b54){_0x23cbc7[_0x608f('0x5f')]=_0x7b7b54[_0x608f('0x5f')];}return _0x23cbc7;};exports[_0x608f('0x60')]=function(_0x10d74a){var _0x3755e6={};_0x3755e6[_0x608f('0x5d')]=_0x10d74a[_0x608f('0x5d')];_0x3755e6[_0x608f('0x5e')]=_0x10d74a[_0x608f('0x45')];_0x3755e6[_0x608f('0x43')]=_0x10d74a[_0x608f('0x43')];return _0x3755e6;};exports[_0x608f('0x61')]=function(_0x4eaec0){var _0x3acf1f=[];for(var _0x2e9d99 in _0x4eaec0){if(_0x4eaec0[_0x608f('0x28')](_0x2e9d99)){if(!_[_0x608f('0x15')](_0x4eaec0[_0x2e9d99])&&_0x4eaec0[_0x2e9d99][_0x608f('0x36')]===_0x608f('0x62')&&_0x4eaec0[_0x2e9d99][_0x608f('0x63')]===_0x608f('0x64')){_0x3acf1f[_0x608f('0x65')](_0x4eaec0[_0x2e9d99]['id']);}}}return _0x3acf1f;};exports[_0x608f('0x66')]=function(_0x5d3f13){var _0x5f0377=moment()[_0x608f('0x7')](0x0);var _0x273fa4=moment(_0x5d3f13)[_0x608f('0x7')](0x0);return _0x5f0377[_0x608f('0x8')](_0x273fa4,_0x608f('0x67'));};exports[_0x608f('0x68')]=function(_0x11cb3b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x11cb3b[_0x608f('0x54')],'ListId':_0x11cb3b[_0x608f('0x55')],'VoiceQueueId':_0x11cb3b[_0x608f('0x1c')]||undefined,'CampaignId':_0x11cb3b[_0x608f('0x69')]||undefined};};exports[_0x608f('0x6a')]=function(_0x366313){if(_0x366313===_0x608f('0x43')||_0x366313===_0x608f('0x6b')||_0x366313==='queue'||_0x366313==='type'||_0x366313===_0x608f('0x6c')||_0x366313===_0x608f('0x6d')||_0x366313===_0x608f('0x6e')||_0x366313===_0x608f('0x45')||_0x366313==='calleridname'||_0x366313===_0x608f('0x51')||_0x366313===_0x608f('0x1a')||_0x366313==='scheduledat'||_0x366313===_0x608f('0x49')||_0x366313===_0x608f('0x4a')||_0x366313===_0x608f('0x4b')||_0x366313===_0x608f('0x6f')||_0x366313==='callback'||_0x366313===_0x608f('0x70')||_0x366313==='callbackat'||_0x366313===_0x608f('0x71')||_0x366313===_0x608f('0x54')||_0x366313===_0x608f('0x55')||_0x366313===_0x608f('0x3d')||_0x366313===_0x608f('0x1c')||_0x366313===_0x608f('0x72')||_0x366313===_0x608f('0x73')||_0x366313===_0x608f('0x74')||_0x366313===_0x608f('0x75')||_0x366313===_0x608f('0x76')||_0x366313===_0x608f('0x77')||_0x366313===_0x608f('0x78')||_0x366313===_0x608f('0x79')||_0x366313===_0x608f('0x7a')||_0x366313===_0x608f('0x7b')||_0x366313==='xmd-contactid'||_0x366313==='xmd-cdrtype'||_0x366313==='xmd-callerid'||_0x366313===_0x608f('0x7c')||_0x366313===_0x608f('0x7d')||_0x366313===_0x608f('0x7e')||_0x366313===_0x608f('0x7f')||_0x366313===_0x608f('0x80')||_0x366313===_0x608f('0x81')||_0x366313===_0x608f('0x82')||_0x366313===_0x608f('0x83')||_0x366313==='rtpaudioqosrtt'||_0x366313===_0x608f('0x84')||_0x366313===_0x608f('0x7e')||_0x366313===_0x608f('0x7f')||_0x366313==='rtpaudioqosjitter'||_0x366313===_0x608f('0x81')||_0x366313===_0x608f('0x82')||_0x366313==='rtpaudioqoslossbridged'||_0x366313===_0x608f('0x85')||_0x366313==='rtpaudioqosrttbridged'||_0x366313===_0x608f('0x86')||_0x366313==='bridgepvtcallid'||_0x366313===_0x608f('0x36')||_0x366313===_0x608f('0x37')){return![];}return!![];};exports[_0x608f('0x87')]=function(_0x345138,_0x12e299){var _0x4fa629,_0x10cd1e,_0x3fea77;if(_0x12e299<=0x0){_0x12e299=0x1;}_0x4fa629=new RegExp(_0x608f('0x88')+_0x12e299+'}$');_0x10cd1e=Math['pow'](0xa,_0x12e299-0x1);_0x3fea77=Math[_0x608f('0x89')](0xa,_0x12e299)-0x1;return util['format']('%s',_[_0x608f('0x8a')](_0x345138,_0x4fa629,_[_0x608f('0x8b')](_0x10cd1e,_0x3fea77)));};exports[_0x608f('0x8c')]=function(_0x14bd59){var _0x4ba677=_0x14bd59[_0x608f('0x8d')](/"(.*?)"/);return _0x4ba677?_0x4ba677[0x1]:_0x14bd59;};exports[_0x608f('0x8e')]=function(_0x312298){var _0x27d2e3=_0x312298[_0x608f('0x8d')](/<(.*?)>/);return _0x27d2e3?_0x27d2e3[0x1]:_0x312298;}; \ No newline at end of file +var _0x17a6=['minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','name','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','pow','replace','extractCalleridName','match','extractCalleridNumber','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','calleridnum','from-sip','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add'];(function(_0x3babb2,_0x4e832d){var _0x43e8fd=function(_0x58fa4d){while(--_0x58fa4d){_0x3babb2['push'](_0x3babb2['shift']());}};_0x43e8fd(++_0x4e832d);}(_0x17a6,0x1dc));var _0x617a=function(_0x1474c4,_0x28705e){_0x1474c4=_0x1474c4-0x0;var _0x39d4aa=_0x17a6[_0x1474c4];return _0x39d4aa;};'use strict';var util=require('util');var _=require(_0x617a('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x617a('0x1'));var ipAgi=process[_0x617a('0x2')][_0x617a('0x3')]||_0x617a('0x4');function getSeconds(_0x15af39,_0x2c195c){var _0x468d17=moment(_0x15af39)[_0x617a('0x5')](0x0);var _0xe57500=moment(_0x2c195c)[_0x617a('0x5')](0x0);return _0x468d17[_0x617a('0x6')](_0xe57500,_0x617a('0x7'));}exports['loggerCatch']=function(_0x1529c6){return function(_0x39bdb4){logger[_0x617a('0x8')](_0x1529c6,util[_0x617a('0x9')](_0x39bdb4,{'showHidden':![],'depth':null}));};};exports[_0x617a('0xa')]=function(_0x205da1,_0x9b2096){logger['info'](_0x205da1,util[_0x617a('0x9')](_0x9b2096,{'showHidden':![],'depth':null}));};exports[_0x617a('0xb')]=function(_0x2ce786,_0x457876){logger[_0x617a('0x8')](_0x2ce786,util[_0x617a('0x9')](_0x457876,{'showHidden':![],'depth':null}));};exports[_0x617a('0xc')]=function(_0x1d2620){return function(_0x5e7de4){logger[_0x617a('0xd')](_0x1d2620,util[_0x617a('0x9')](_0x5e7de4,{'showHidden':![],'depth':null}));};};exports[_0x617a('0xe')]=function(_0x33e8ff,_0x4f40c2,_0x5a828c){return{'message':_0x33e8ff,'unlock':_0x4f40c2,'active':_0x5a828c};};exports[_0x617a('0xf')]=function(_0x5b980c,_0x5b492f,_0xec5c52){if(!_[_0x617a('0x10')](_0xec5c52)&&_0x617a('0x11')===typeof _0xec5c52&&!_['isEmpty'](_0xec5c52)){if(!_['isUndefined'](_0x5b492f)&&_0x617a('0x11')===typeof _0x5b492f&&!_[_0x617a('0x12')](_0x5b492f)){return util[_0x617a('0x13')](_0x617a('0x14'),_0x5b492f,_0xec5c52);}return util[_0x617a('0x13')](_0x617a('0x14'),_0xec5c52,_0xec5c52);}if(!_['isUndefined'](_0x5b980c)&&_0x617a('0x11')===typeof _0x5b980c&&!_[_0x617a('0x12')](_0x5b980c)){return _0x5b980c;}return _0x617a('0x15');};exports[_0x617a('0x16')]=function(_0x28be83){if(_[_0x617a('0x17')](_0x28be83)){return![];}return _0x28be83;};exports[_0x617a('0x18')]=function(_0x20b97b,_0x4d8285,_0x74d4e4,_0x253937,_0x49c034,_0x25e4e9){var _0xc2fb34={'XMD-QUEUE':_0x4d8285[_0x617a('0x19')]?_0x4d8285[_0x617a('0x19')]['name']:'','XMD-CALLERID':_0x253937,'XMD-CALLERID-PREVIEW':_0x25e4e9?util[_0x617a('0x13')](_0x617a('0x14'),_0x25e4e9[_0x617a('0x1a')],_0x25e4e9['calleridnum']):_0x253937,'XMD-DIALID':_0x49c034,'XMD-CONTACTID':_0x4d8285[_0x617a('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x253937,'XMD-VOICEQUEUEID':_0x4d8285[_0x617a('0x1c')],'XMD-DIALCHANNEL':_0x74d4e4,'XMD-DIALTIMEOUT':_0x20b97b[_0x617a('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x617a('0x13')](_0x617a('0x1e'),_0x20b97b[_0x617a('0x1f')]?'g':'',_['isEmpty'](_0x20b97b[_0x617a('0x20')])?'':_0x617a('0x21')),'XMD-DIALURL':_0x20b97b[_0x617a('0x22')]||'','XMD-AGI':_0x20b97b[_0x617a('0x23')]?util[_0x617a('0x13')](_0x617a('0x24'),ipAgi,_0x20b97b[_0x617a('0x23')]):_0x617a('0x25'),'XMD-AGIAFTER':_0x20b97b[_0x617a('0x1f')]?util[_0x617a('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x20b97b[_0x617a('0x1f')]):_0x617a('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x25e4e9?_0x25e4e9[_0x617a('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x25e4e9?_0x25e4e9[_0x617a('0x27')]:'','XMD-DESTINATION':_0x617a('0x28')};if(!_[_0x617a('0x12')](_0x20b97b[_0x617a('0x20')])){_0xc2fb34[util[_0x617a('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x20b97b[_0x617a('0x20')];_0xc2fb34[util[_0x617a('0x13')]('%s',_0x617a('0x29'))]=_0x49c034;}if(_0x4d8285&&_0x4d8285[_0x617a('0x2a')]){for(var _0x3ec840 in _0x4d8285[_0x617a('0x2a')]){if(_0x4d8285[_0x617a('0x2a')][_0x617a('0x2b')](_0x3ec840)){if(!_[_0x617a('0x17')](_0x4d8285[_0x617a('0x2a')][_0x3ec840])&&_0x3ec840!=='id'&&_0x3ec840!=='tags'&&_0x3ec840!==_0x617a('0x2c')&&_0x3ec840!==_0x617a('0x2d')){_0xc2fb34[util[_0x617a('0x13')](_0x617a('0x2e'),_0x617a('0x2f'),_[_0x617a('0x30')](_0x3ec840))]=_0x4d8285[_0x617a('0x2a')][_0x3ec840];}}}}return _0xc2fb34;};exports[_0x617a('0x31')]=function(_0x5ea344){var _0x1a07a8={};for(var _0x1fdad4 in _0x5ea344){if(_0x5ea344['hasOwnProperty'](_0x1fdad4)){_0x1a07a8[util['format']('%s',_[_0x617a('0x32')](_0x1fdad4))]=_0x5ea344[_0x1fdad4];}}return{'variables':_0x1a07a8};};exports[_0x617a('0x33')]=function(_0x4738eb,_0x7a3cb2){if(!_[_0x617a('0x17')](_0x4738eb)){if(_0x4738eb[_0x617a('0x2b')](_0x617a('0x34'))){if(_0x4738eb['originated']>0x0){_0x4738eb[_0x617a('0x34')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x7a3cb2);}}}else{logger['error'](_0x617a('0x35'),_0x7a3cb2);}};exports[_0x617a('0x36')]=function(_0x6894b){var _0x2b5e9b=moment()[_0x617a('0x13')](_0x617a('0x37'));_0x6894b[_0x617a('0x38')]=0xd;_0x6894b[_0x617a('0x39')]='Blacklist';_0x6894b[_0x617a('0x3a')]=_0x2b5e9b;_0x6894b[_0x617a('0x3b')]=_0x2b5e9b;_0x6894b[_0x617a('0x3c')]=_0x2b5e9b;};exports['logAgent']=function(_0x5a7cef,_0x33bb2f,_0x3e2bec){var _0x5f3677=moment()[_0x617a('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a7cef[_0x617a('0x38')]=_0x33bb2f;_0x5a7cef[_0x617a('0x39')]=_0x3e2bec;_0x5a7cef['responsetime']=_0x5f3677;_0x5a7cef[_0x617a('0x3d')]=getSeconds(_0x5a7cef['responsetime'],_0x5a7cef[_0x617a('0x3a')]);};exports[_0x617a('0x3e')]=function(_0x5dae1f,_0x2d54c0,_0x5aba91){_0x5dae1f[_0x617a('0x3f')]=_0x2d54c0;_0x5dae1f[_0x617a('0x40')]=_0x5aba91;};exports[_0x617a('0x41')]=function(_0x590362,_0x5307d9,_0x384141){var _0x22aab2=moment()[_0x617a('0x13')](_0x617a('0x37'));_0x590362[_0x617a('0x38')]=_0x5307d9;_0x590362[_0x617a('0x39')]=_0x384141;_0x590362[_0x617a('0x3b')]=_0x590362['responsetime']?_0x590362[_0x617a('0x3b')]:_0x22aab2;_0x590362[_0x617a('0x3c')]=_0x590362['endtime']?_0x590362[_0x617a('0x3c')]:_0x22aab2;_0x590362[_0x617a('0x3d')]=getSeconds(_0x590362['responsetime']||0x0,_0x590362[_0x617a('0x3a')]||0x0);_0x590362[_0x617a('0x42')]=_0x590362[_0x617a('0x43')]?getSeconds(_0x590362['endtime'],_0x590362[_0x617a('0x43')]):0x0;};exports[_0x617a('0x44')]=function(_0x43755f){return _0x43755f===_0x617a('0x45');};exports[_0x617a('0x46')]=function(_0x44452c,_0x1af7f8,_0xbdd7a0,_0x216504,_0x37ec44){var _0x4393d5=_0x216504?_0x617a('0x47'):_0x44452c[_0x617a('0x1a')];_0x4393d5=_0x37ec44?'BOOKED':_0x4393d5;return{'actionid':_0x44452c['uniqueid'],'action':_0x617a('0x48'),'channel':_0x44452c[_0x617a('0x49')],'callerid':util[_0x617a('0x13')](_0x617a('0x14'),_0x4393d5,_0x44452c[_0x617a('0x4a')]),'Exten':_0x617a('0x28'),'Context':_0x617a('0x4b'),'Priority':'1','variable':_0xbdd7a0,'timeout':(_0x1af7f8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x44452c[_0x617a('0x4c')]};};exports[_0x617a('0x4d')]=function(_0xa10d7d){return _0xa10d7d[_0x617a('0x4e')]+_0xa10d7d['countcongestionretry']+_0xa10d7d[_0x617a('0x4f')]+_0xa10d7d['countagentrejectretry']+_0xa10d7d[_0x617a('0x50')];};exports[_0x617a('0x51')]=function(_0x4507aa){var _0x54ac8b=_[_0x617a('0x52')](_0x4507aa);_0x54ac8b[_0x617a('0x38')]=0xf;_0x54ac8b[_0x617a('0x39')]=_0x617a('0x53');return _0x54ac8b;};exports[_0x617a('0x54')]=function(_0x719d17,_0x9e7b13,_0x2402e8){var _0x2a244c={};_0x2a244c[_0x9e7b13]=_0x719d17[_0x9e7b13];_0x2a244c[_0x617a('0x55')]=![];_0x2a244c[_0x617a('0x56')]=moment()[_0x617a('0x57')](_0x2402e8,_0x617a('0x58'))[_0x617a('0x13')](_0x617a('0x37'));_0x2a244c['ContactId']=_0x719d17[_0x617a('0x1b')];_0x2a244c[_0x617a('0x59')]=_0x719d17['ListId'];_0x2a244c[_0x617a('0x1c')]=_0x719d17[_0x617a('0x1c')]||undefined;return _0x2a244c;};exports[_0x617a('0x5a')]=function(_0x428be0,_0xd02357){if(!_[_0x617a('0x17')](_0x428be0)){if(_0x428be0[_0x617a('0x5b')]>0x0){_0x428be0[_0x617a('0x5b')]-=0x1;}else{logger[_0x617a('0x8')](_0xd02357,_0x617a('0x5c'));}}else{logger['error'](_0xd02357,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x617a('0x5d')]=function(_0x503c94){if(_0x503c94<=0x0){return!![];}return![];};exports[_0x617a('0x5e')]=function(_0x2267bb,_0x68765e,_0x1fe24f){_0x2267bb['lastevent']=_0x68765e;_0x2267bb[_0x617a('0x5f')]=_0x2267bb[_0x617a('0x60')];_0x2267bb[_0x617a('0x61')]=_0x2267bb[_0x617a('0x49')];if(_0x1fe24f){_0x2267bb['mandatoryDisposition']=_0x1fe24f[_0x617a('0x62')];}return _0x2267bb;};exports[_0x617a('0x63')]=function(_0x88a390){var _0x423799={};_0x423799['queue']=_0x88a390[_0x617a('0x60')];_0x423799[_0x617a('0x61')]=_0x88a390[_0x617a('0x49')];_0x423799[_0x617a('0x4c')]=_0x88a390['uniqueid'];return _0x423799;};exports[_0x617a('0x64')]=function(_0x4d1baa){var _0x408926=[];for(var _0x29be33 in _0x4d1baa){if(_0x4d1baa[_0x617a('0x2b')](_0x29be33)){if(!_[_0x617a('0x17')](_0x4d1baa[_0x29be33])&&_0x4d1baa[_0x29be33][_0x617a('0x38')]==='not_inuse'&&_0x4d1baa[_0x29be33][_0x617a('0x65')]===_0x617a('0x66')){_0x408926[_0x617a('0x67')](_0x4d1baa[_0x29be33]['id']);}}}return _0x408926;};exports[_0x617a('0x68')]=function(_0x36346a){var _0xf95316=moment()['milliseconds'](0x0);var _0xa540de=moment(_0x36346a)['milliseconds'](0x0);return _0xf95316[_0x617a('0x6')](_0xa540de,_0x617a('0x7'));};exports['createBody']=function(_0x2a0e1c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a0e1c[_0x617a('0x1b')],'ListId':_0x2a0e1c['ListId'],'VoiceQueueId':_0x2a0e1c[_0x617a('0x1c')]||undefined,'CampaignId':_0x2a0e1c[_0x617a('0x69')]||undefined};};exports[_0x617a('0x6a')]=function(_0x6bafd){if(_0x6bafd===_0x617a('0x4c')||_0x6bafd===_0x617a('0x6b')||_0x6bafd==='queue'||_0x6bafd===_0x617a('0x6c')||_0x6bafd===_0x617a('0x6d')||_0x6bafd===_0x617a('0x6e')||_0x6bafd===_0x617a('0x3f')||_0x6bafd===_0x617a('0x49')||_0x6bafd==='calleridname'||_0x6bafd===_0x617a('0x55')||_0x6bafd===_0x617a('0x4a')||_0x6bafd==='scheduledat'||_0x6bafd===_0x617a('0x4e')||_0x6bafd===_0x617a('0x6f')||_0x6bafd===_0x617a('0x4f')||_0x6bafd===_0x617a('0x70')||_0x6bafd==='callback'||_0x6bafd===_0x617a('0x71')||_0x6bafd==='callbackat'||_0x6bafd===_0x617a('0x72')||_0x6bafd==='ContactId'||_0x6bafd==='ListId'||_0x6bafd===_0x617a('0x40')||_0x6bafd==='VoiceQueueId'||_0x6bafd===_0x617a('0x73')||_0x6bafd==='xmd-voicequeueid'||_0x6bafd===_0x617a('0x74')||_0x6bafd===_0x617a('0x75')||_0x6bafd==='xmd-listid'||_0x6bafd===_0x617a('0x76')||_0x6bafd===_0x617a('0x77')||_0x6bafd===_0x617a('0x78')||_0x6bafd===_0x617a('0x79')||_0x6bafd===_0x617a('0x7a')||_0x6bafd===_0x617a('0x7b')||_0x6bafd===_0x617a('0x7c')||_0x6bafd==='xmd-callerid'||_0x6bafd===_0x617a('0x7d')||_0x6bafd===_0x617a('0x7e')||_0x6bafd===_0x617a('0x7f')||_0x6bafd===_0x617a('0x80')||_0x6bafd===_0x617a('0x81')||_0x6bafd===_0x617a('0x82')||_0x6bafd===_0x617a('0x83')||_0x6bafd===_0x617a('0x84')||_0x6bafd===_0x617a('0x85')||_0x6bafd==='rtpaudioqosrttbridged'||_0x6bafd===_0x617a('0x7f')||_0x6bafd===_0x617a('0x80')||_0x6bafd===_0x617a('0x81')||_0x6bafd===_0x617a('0x82')||_0x6bafd==='rtpaudioqosloss'||_0x6bafd==='rtpaudioqoslossbridged'||_0x6bafd===_0x617a('0x85')||_0x6bafd==='rtpaudioqosrttbridged'||_0x6bafd===_0x617a('0x86')||_0x6bafd==='bridgepvtcallid'||_0x6bafd===_0x617a('0x38')||_0x6bafd===_0x617a('0x39')){return![];}return!![];};exports[_0x617a('0x87')]=function(_0x4307d4,_0x3a1c81){var _0x30ac1c,_0x583b0,_0x549520;if(_0x3a1c81<=0x0){_0x3a1c81=0x1;}_0x30ac1c=new RegExp('\x5cw{0,'+_0x3a1c81+'}$');_0x583b0=Math[_0x617a('0x88')](0xa,_0x3a1c81-0x1);_0x549520=Math['pow'](0xa,_0x3a1c81)-0x1;return util[_0x617a('0x13')]('%s',_[_0x617a('0x89')](_0x4307d4,_0x30ac1c,_['random'](_0x583b0,_0x549520)));};exports[_0x617a('0x8a')]=function(_0x1473e6){var _0x426169=_0x1473e6[_0x617a('0x8b')](/"(.*?)"/);return _0x426169?_0x426169[0x1]:_0x1473e6;};exports[_0x617a('0x8c')]=function(_0x2aadde){var _0x58e91d=_0x2aadde[_0x617a('0x8b')](/<(.*?)>/);return _0x58e91d?_0x58e91d[0x1]:_0x2aadde;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e5252e2..94946c6 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x40321a,_0x2ae5c6){var _0x121f3c=function(_0x1532c0){while(--_0x1532c0){_0x40321a['push'](_0x40321a['shift']());}};_0x121f3c(++_0x2ae5c6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fec1e,_0xce18d2){_0x1fec1e=_0x1fec1e-0x0;var _0x31f9ec=_0xb10b[_0x1fec1e];return _0x31f9ec;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x476299,_0x3aa6a6){var _0x256a16=function(_0x552a4b){while(--_0x552a4b){_0x476299['push'](_0x476299['shift']());}};_0x256a16(++_0x3aa6a6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1496c1,_0x23cf40){_0x1496c1=_0x1496c1-0x0;var _0x48abc0=_0x5f2f[_0x1496c1];return _0x48abc0;};'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 ea545cd..bd2cda4 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 _0x0099=['initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumHoldTime','duration','disposition','initCampaigns','initVoiceExtensions','merge','initFaxAccounts','bluebird','util','moment','../model/agent','../model/telephone','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumDuration','sumBillable','isEmpty','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','agents','initTelephones','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts'];(function(_0x26dd9b,_0x394eb7){var _0x102e01=function(_0x16f495){while(--_0x16f495){_0x26dd9b['push'](_0x26dd9b['shift']());}};_0x102e01(++_0x394eb7);}(_0x0099,0x1a3));var _0x9009=function(_0x35e54a,_0x46953a){_0x35e54a=_0x35e54a-0x0;var _0x35c2b0=_0x0099[_0x35e54a];return _0x35c2b0;};'use strict';var BPromise=require(_0x9009('0x0'));var util=require(_0x9009('0x1'));var _=require('lodash');var moment=require(_0x9009('0x2'));var Agent=require(_0x9009('0x3'));var Telephone=require(_0x9009('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x9009('0x5'));var Template=require(_0x9009('0x6'));var Campaign=require(_0x9009('0x7'));var VoiceExtension=require(_0x9009('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x9009('0x9'));var SugarcrmAccount=require(_0x9009('0xa'));var ZohoAccount=require(_0x9009('0xb'));var DeskAccount=require(_0x9009('0xc'));var VtigerAccount=require(_0x9009('0xd'));var ServicenowAccount=require(_0x9009('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x9009('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x9009('0x10')]={};this[_0x9009('0x11')]={};this[_0x9009('0x12')]={};this[_0x9009('0x13')]={};this[_0x9009('0x14')]={};this[_0x9009('0x15')]={};this[_0x9009('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9009('0x17')]={};this[_0x9009('0x18')]={};this['queueChannels']={};this[_0x9009('0x19')]={};this[_0x9009('0x1a')]={};this['zendeskAccounts']={};this[_0x9009('0x1b')]={};this['sugarcrmAccounts']={};this[_0x9009('0x1c')]={};this[_0x9009('0x1d')]={};this['deskAccounts']={};this[_0x9009('0x1e')]={};this[_0x9009('0x1f')]={};this[_0x9009('0x20')]={};this['freshsalesAccounts']={};this[_0x9009('0x21')]={};};function freeIsNotKey(_0x5798d9,_0x12ffe0,_0xd75174){var _0x46c7e5=_[_0x9009('0x22')](_0x5798d9,function(_0x585a80,_0x2b5a35){return _0x585a80[_0xd75174];});for(var _0x42c745 in _0x12ffe0){if(_0x12ffe0[_0x9009('0x23')](_0x42c745)){if(!_0x46c7e5[_0x42c745]){delete _0x12ffe0[_0x42c745];}}}}function freeIsNotKeySip(_0x2eb873,_0x21e102){var _0x267fae=_['mapKeys'](_0x2eb873,function(_0x156e24,_0x5347c0){return util[_0x9009('0x24')](_0x9009('0x25'),_0x156e24[_0x9009('0x26')]);});for(var _0x338303 in _0x21e102){if(_0x21e102[_0x9009('0x23')](_0x338303)){if(!_0x267fae[_0x338303]){delete _0x21e102[_0x338303];}}}}function freeIsNotKeyAgent(_0xd877aa,_0x30927c){var _0x55cfa6=_[_0x9009('0x22')](_0xd877aa,function(_0x56e0f2,_0x4478c0){var _0x1a94a9=_['isNil'](_0x56e0f2[_0x9009('0x27')])?util[_0x9009('0x24')](_0x9009('0x25'),_0x56e0f2[_0x9009('0x26')]):_0x56e0f2['interface'];return _0x1a94a9;});for(var _0xed7402 in _0x30927c){if(_0x30927c[_0x9009('0x23')](_0xed7402)){if(!_0x55cfa6[_0xed7402]){delete _0x30927c[_0xed7402];}}}}function clearVoiceCallReports(_0x383c09){_0x383c09[_0x9009('0x28')]=0x0;_0x383c09[_0x9009('0x29')]=0x0;_0x383c09['sumHoldTime']=0x0;_0x383c09[_0x9009('0x2a')]=0x0;_0x383c09[_0x9009('0x2b')]=0x0;}function clearCampaigns(_0x3332b4){if(!_[_0x9009('0x2c')](_0x3332b4)){for(var _0x59b807 in _0x3332b4){if(_0x3332b4[_0x9009('0x23')](_0x59b807)){_0x3332b4[_0x59b807]['ivrTotalCallsDays']=0x0;_0x3332b4[_0x59b807]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x4c4f43){if(!_[_0x9009('0x2c')](_0x4c4f43)){for(var _0x2ef5e4 in _0x4c4f43){if(_0x4c4f43[_0x9009('0x23')](_0x2ef5e4)){_0x4c4f43[_0x2ef5e4]['total']=0x0;_0x4c4f43[_0x2ef5e4]['answered']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x2d')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x2e')]=0x0;_0x4c4f43[_0x2ef5e4]['sumHoldTime']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x2a')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x2b')]=0x0;_0x4c4f43[_0x2ef5e4]['outboundAnswerAgiCallsDay']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x2f')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x30')]=0x0;_0x4c4f43[_0x2ef5e4]['outboundCongestionCallsDay']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x31')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x32')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x33')]=0x0;_0x4c4f43[_0x2ef5e4]['outboundDropCallsDayCallersExit']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x34')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x35')]=0x0;_0x4c4f43[_0x2ef5e4]['outboundRejectCallsDay']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x36')]=0x0;_0x4c4f43[_0x2ef5e4]['outboundAnswerAgiCallsDay']=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x37')]=0x0;_0x4c4f43[_0x2ef5e4][_0x9009('0x38')]=!![];}}}}Realtime[_0x9009('0x39')][_0x9009('0x3a')]=function(_0x4344f2,_0x409318){for(var _0x41da61 in _0x409318){if(_0x4344f2['hasOwnProperty'](_0x41da61)){_0x4344f2[_0x41da61]=_0x409318[_0x41da61];}}};Realtime[_0x9009('0x39')][_0x9009('0x3b')]=function(){var _0x4c2da0=this;return function(_0x22c191){if(_0x22c191){freeIsNotKeyAgent(_0x22c191,_0x4c2da0['agents']);for(var _0x1b1a01=0x0,_0x51f81d={},_0x5e16eb={};_0x1b1a01<_0x22c191[_0x9009('0x3c')];_0x1b1a01+=0x1){_0x51f81d=_0x22c191[_0x1b1a01];var _0x158ecc=_[_0x9009('0x3d')](_0x51f81d[_0x9009('0x27')])?util[_0x9009('0x24')](_0x9009('0x25'),_0x51f81d['name']):_0x51f81d[_0x9009('0x27')];if(_[_0x9009('0x3e')](_0x4c2da0[_0x9009('0x3f')][_0x158ecc])){_0x4c2da0['agents'][_0x158ecc]=new Agent(_0x51f81d);}else{_0x4c2da0['mergeFromDatabase'](_0x4c2da0[_0x9009('0x3f')][_0x158ecc],_0x51f81d);}}}return _0x4c2da0[_0x9009('0x3f')];};};Realtime['prototype'][_0x9009('0x40')]=function(){var _0x3b3b54=this;return function(_0x20f92d){if(_0x20f92d){freeIsNotKeySip(_0x20f92d,_0x3b3b54[_0x9009('0x10')]);for(var _0x3dfe33=0x0,_0x2bb124={},_0x4ec03a={};_0x3dfe33<_0x20f92d[_0x9009('0x3c')];_0x3dfe33+=0x1){_0x2bb124=_0x20f92d[_0x3dfe33];if(_[_0x9009('0x3e')](_0x3b3b54[_0x9009('0x10')][util[_0x9009('0x24')](_0x9009('0x25'),_0x2bb124[_0x9009('0x26')])])){_0x3b3b54[_0x9009('0x10')][util[_0x9009('0x24')](_0x9009('0x25'),_0x2bb124['name'])]=new Telephone(_0x2bb124);}else{_0x3b3b54[_0x9009('0x3a')](_0x3b3b54[_0x9009('0x10')][util[_0x9009('0x24')](_0x9009('0x25'),_0x2bb124[_0x9009('0x26')])],_0x2bb124);}}}return _0x3b3b54[_0x9009('0x10')];};};Realtime[_0x9009('0x39')]['initTrunks']=function(){var _0x556cdb=this;return function(_0x2ad736){if(_0x2ad736){freeIsNotKeySip(_0x2ad736,_0x556cdb[_0x9009('0x11')]);for(var _0xa38876=0x0,_0x5d2fb8={},_0x314b48={};_0xa38876<_0x2ad736[_0x9009('0x3c')];_0xa38876+=0x1){_0x5d2fb8=_0x2ad736[_0xa38876];if(_[_0x9009('0x3e')](_0x556cdb[_0x9009('0x11')][util[_0x9009('0x24')]('SIP/%s',_0x5d2fb8[_0x9009('0x26')])])){_0x556cdb['trunks'][util[_0x9009('0x24')](_0x9009('0x25'),_0x5d2fb8[_0x9009('0x26')])]=new Trunk(_0x5d2fb8);}else{_0x556cdb[_0x9009('0x3a')](_0x556cdb[_0x9009('0x11')][util[_0x9009('0x24')]('SIP/%s',_0x5d2fb8[_0x9009('0x26')])],_0x5d2fb8);}}}return _0x556cdb['trunks'];};};Realtime[_0x9009('0x39')][_0x9009('0x41')]=function(){var _0x2f2ab6=this;return function(_0x50d0a5){if(_0x50d0a5){freeIsNotKey(_0x50d0a5,_0x2f2ab6[_0x9009('0x12')],_0x9009('0x26'));for(var _0x5766e2=0x0,_0x1db38d={},_0x317883={};_0x5766e2<_0x50d0a5[_0x9009('0x3c')];_0x5766e2+=0x1){_0x1db38d=_0x50d0a5[_0x5766e2];if(_[_0x9009('0x3e')](_0x2f2ab6[_0x9009('0x12')][_0x1db38d['name']])){_0x2f2ab6[_0x9009('0x12')][_0x1db38d[_0x9009('0x26')]]=new VoiceQueue(_0x1db38d);}else{_0x2f2ab6[_0x9009('0x3a')](_0x2f2ab6[_0x9009('0x12')][_0x1db38d['name']],_0x1db38d);}}}return _0x2f2ab6['voiceQueues'];};};Realtime[_0x9009('0x39')][_0x9009('0x42')]=function(){var _0x258422=this;return function(_0x36caaf){if(_0x36caaf){freeIsNotKey(_0x36caaf,_0x258422[_0x9009('0x13')],'id');for(var _0x2a2d88=0x0,_0x40956a={},_0x13b7b2={};_0x2a2d88<_0x36caaf[_0x9009('0x3c')];_0x2a2d88+=0x1){_0x40956a=_0x36caaf[_0x2a2d88];if(_[_0x9009('0x3e')](_0x258422[_0x9009('0x13')][_0x40956a['id']])){_0x258422[_0x9009('0x13')][_0x40956a['id']]=new Trigger(_0x40956a);}else{_0x258422[_0x9009('0x3a')](_0x258422[_0x9009('0x13')][_0x40956a['id']],_0x40956a);}}}return _0x258422['triggers'];};};Realtime[_0x9009('0x39')][_0x9009('0x43')]=function(){var _0x210961=this;return function(_0x2f06ab){if(_0x2f06ab){freeIsNotKey(_0x2f06ab,_0x210961[_0x9009('0x15')],'id');for(var _0x5de69a=0x0,_0x2d7c8e={},_0x459301={};_0x5de69a<_0x2f06ab['length'];_0x5de69a+=0x1){_0x2d7c8e=_0x2f06ab[_0x5de69a];if(_[_0x9009('0x3e')](_0x210961[_0x9009('0x15')][_0x2d7c8e['id']])){_0x210961[_0x9009('0x15')][_0x2d7c8e['id']]=new Template(_0x2d7c8e);}else{_0x210961[_0x9009('0x3a')](_0x210961['templates'][_0x2d7c8e['id']],_0x2d7c8e);}}}return _0x210961[_0x9009('0x15')];};};Realtime[_0x9009('0x39')][_0x9009('0x44')]=function(){var _0x3acdc1=this;return function(_0x24cc69){if(_0x24cc69){freeIsNotKey(_0x24cc69,_0x3acdc1[_0x9009('0x45')],'id');for(var _0x188f01=0x0,_0x1469ab={},_0x25314f={};_0x188f01<_0x24cc69[_0x9009('0x3c')];_0x188f01+=0x1){_0x1469ab=_0x24cc69[_0x188f01];if(_[_0x9009('0x3e')](_0x3acdc1[_0x9009('0x45')][_0x1469ab['id']])){_0x3acdc1[_0x9009('0x45')][_0x1469ab['id']]=new ZendeskAccount(_0x1469ab);}else{_0x3acdc1[_0x9009('0x3a')](_0x3acdc1[_0x9009('0x45')][_0x1469ab['id']],_0x1469ab);}}}return _0x3acdc1[_0x9009('0x45')];};};Realtime['prototype'][_0x9009('0x46')]=function(){var _0x2022b9=this;return function(_0x14fcaa){if(_0x14fcaa){freeIsNotKey(_0x14fcaa,_0x2022b9[_0x9009('0x1b')],'id');for(var _0x239cf7=0x0,_0x309cad={},_0x56fa2e={};_0x239cf7<_0x14fcaa[_0x9009('0x3c')];_0x239cf7+=0x1){_0x309cad=_0x14fcaa[_0x239cf7];if(_['isUndefined'](_0x2022b9[_0x9009('0x1b')][_0x309cad['id']])){_0x2022b9[_0x9009('0x1b')][_0x309cad['id']]=new SalesforceAccount(_0x309cad);}else{_0x2022b9[_0x9009('0x3a')](_0x2022b9[_0x9009('0x1b')][_0x309cad['id']],_0x309cad);}}}return _0x2022b9[_0x9009('0x1b')];};};Realtime['prototype'][_0x9009('0x47')]=function(){var _0x4b90f9=this;return function(_0x3c3d15){if(_0x3c3d15){freeIsNotKey(_0x3c3d15,_0x4b90f9[_0x9009('0x1c')],'id');for(var _0x51a023=0x0,_0x30c117={},_0x4b8985={};_0x51a023<_0x3c3d15['length'];_0x51a023+=0x1){_0x30c117=_0x3c3d15[_0x51a023];if(_[_0x9009('0x3e')](_0x4b90f9['freshdeskAccounts'][_0x30c117['id']])){_0x4b90f9[_0x9009('0x1c')][_0x30c117['id']]=new FreshdeskAccount(_0x30c117);}else{_0x4b90f9[_0x9009('0x3a')](_0x4b90f9[_0x9009('0x1c')][_0x30c117['id']],_0x30c117);}}}return _0x4b90f9[_0x9009('0x1c')];};};Realtime['prototype'][_0x9009('0x48')]=function(){var _0x410852=this;return function(_0x5187c7){if(_0x5187c7){freeIsNotKey(_0x5187c7,_0x410852['zohoAccounts'],'id');for(var _0x3b39c9=0x0,_0x2fa29f={},_0x2f3fc6={};_0x3b39c9<_0x5187c7[_0x9009('0x3c')];_0x3b39c9+=0x1){_0x2fa29f=_0x5187c7[_0x3b39c9];if(_['isUndefined'](_0x410852['zohoAccounts'][_0x2fa29f['id']])){_0x410852[_0x9009('0x1d')][_0x2fa29f['id']]=new ZohoAccount(_0x2fa29f);}else{_0x410852[_0x9009('0x3a')](_0x410852[_0x9009('0x1d')][_0x2fa29f['id']],_0x2fa29f);}}}return _0x410852[_0x9009('0x1d')];};};Realtime[_0x9009('0x39')][_0x9009('0x49')]=function(){var _0x2ee05e=this;return function(_0x30e6d8){if(_0x30e6d8){freeIsNotKey(_0x30e6d8,_0x2ee05e[_0x9009('0x4a')],'id');for(var _0x331e9b=0x0,_0x5eda05={},_0xc969df={};_0x331e9b<_0x30e6d8['length'];_0x331e9b+=0x1){_0x5eda05=_0x30e6d8[_0x331e9b];if(_[_0x9009('0x3e')](_0x2ee05e[_0x9009('0x4a')][_0x5eda05['id']])){_0x2ee05e[_0x9009('0x4a')][_0x5eda05['id']]=new DeskAccount(_0x5eda05);}else{_0x2ee05e[_0x9009('0x3a')](_0x2ee05e['deskAccounts'][_0x5eda05['id']],_0x5eda05);}}}return _0x2ee05e['deskAccounts'];};};Realtime[_0x9009('0x39')][_0x9009('0x4b')]=function(){var _0x528efa=this;return function(_0x33d47a){if(_0x33d47a){freeIsNotKey(_0x33d47a,_0x528efa[_0x9009('0x4c')],'id');for(var _0x386fb8=0x0,_0x5deab3={},_0x53dfd6={};_0x386fb8<_0x33d47a[_0x9009('0x3c')];_0x386fb8+=0x1){_0x5deab3=_0x33d47a[_0x386fb8];if(_[_0x9009('0x3e')](_0x528efa[_0x9009('0x4c')][_0x5deab3['id']])){_0x528efa[_0x9009('0x4c')][_0x5deab3['id']]=new SugarcrmAccount(_0x5deab3);}else{_0x528efa[_0x9009('0x3a')](_0x528efa[_0x9009('0x4c')][_0x5deab3['id']],_0x5deab3);}}}return _0x528efa[_0x9009('0x4c')];};};Realtime[_0x9009('0x39')]['initVtigerAccounts']=function(){var _0x2800a5=this;return function(_0x340cd6){if(_0x340cd6){freeIsNotKey(_0x340cd6,_0x2800a5[_0x9009('0x1e')],'id');for(var _0x3b2a58=0x0,_0x59d9c1={},_0x3792e2={};_0x3b2a58<_0x340cd6[_0x9009('0x3c')];_0x3b2a58+=0x1){_0x59d9c1=_0x340cd6[_0x3b2a58];if(_[_0x9009('0x3e')](_0x2800a5['vtigerAccounts'][_0x59d9c1['id']])){_0x2800a5[_0x9009('0x1e')][_0x59d9c1['id']]=new VtigerAccount(_0x59d9c1);}else{_0x2800a5[_0x9009('0x3a')](_0x2800a5[_0x9009('0x1e')][_0x59d9c1['id']],_0x59d9c1);}}}return _0x2800a5[_0x9009('0x1e')];};};Realtime[_0x9009('0x39')][_0x9009('0x4d')]=function(){var _0x2ecbf1=this;return function(_0x2dd4d1){if(_0x2dd4d1){freeIsNotKey(_0x2dd4d1,_0x2ecbf1[_0x9009('0x1f')],'id');for(var _0x1dd133=0x0,_0x3dc3f3={},_0x58db53={};_0x1dd133<_0x2dd4d1[_0x9009('0x3c')];_0x1dd133+=0x1){_0x3dc3f3=_0x2dd4d1[_0x1dd133];if(_[_0x9009('0x3e')](_0x2ecbf1['servicenowAccounts'][_0x3dc3f3['id']])){_0x2ecbf1[_0x9009('0x1f')][_0x3dc3f3['id']]=new ServicenowAccount(_0x3dc3f3);}else{_0x2ecbf1[_0x9009('0x3a')](_0x2ecbf1['servicenowAccounts'][_0x3dc3f3['id']],_0x3dc3f3);}}}return _0x2ecbf1[_0x9009('0x1f')];};};Realtime[_0x9009('0x39')][_0x9009('0x4e')]=function(){var _0x3327da=this;return function(_0x142389){if(_0x142389){freeIsNotKey(_0x142389,_0x3327da[_0x9009('0x20')],'id');for(var _0x34994e=0x0,_0x429b09={},_0xca52cc={};_0x34994e<_0x142389['length'];_0x34994e+=0x1){_0x429b09=_0x142389[_0x34994e];if(_[_0x9009('0x3e')](_0x3327da[_0x9009('0x20')][_0x429b09['id']])){_0x3327da['dynamics365Accounts'][_0x429b09['id']]=new Dynamics365Account(_0x429b09);}else{_0x3327da[_0x9009('0x3a')](_0x3327da[_0x9009('0x20')][_0x429b09['id']],_0x429b09);}}}return _0x3327da[_0x9009('0x20')];};};Realtime[_0x9009('0x39')][_0x9009('0x4f')]=function(){var _0x559420=this;return function(_0x157351){if(_0x157351){freeIsNotKey(_0x157351,_0x559420[_0x9009('0x50')],'id');for(var _0x2da666=0x0,_0x51478e={},_0x5b79f2={};_0x2da666<_0x157351[_0x9009('0x3c')];_0x2da666+=0x1){_0x51478e=_0x157351[_0x2da666];if(_[_0x9009('0x3e')](_0x559420['freshsalesAccounts'][_0x51478e['id']])){_0x559420[_0x9009('0x50')][_0x51478e['id']]=new FreshsalesAccount(_0x51478e);}else{_0x559420['mergeFromDatabase'](_0x559420[_0x9009('0x50')][_0x51478e['id']],_0x51478e);}}}return _0x559420[_0x9009('0x50')];};};Realtime[_0x9009('0x39')][_0x9009('0x51')]=function(){var _0x6e051f=this;return function(_0x52c715){for(var _0x166235=0x0;_0x166235<_0x52c715['length'];_0x166235+=0x1){_['merge'](_0x6e051f[_0x9009('0x12')][_0x52c715[_0x166235][_0x9009('0x26')]],_0x52c715[_0x166235]);}return _0x6e051f[_0x9009('0x12')];};};Realtime['prototype'][_0x9009('0x52')]=function(){var _0x25b76d=this;return function(_0x3f035e){clearVoiceQueues(_0x25b76d[_0x9009('0x12')]);if(_0x3f035e){_0x3f035e=_[_0x9009('0x53')](_0x3f035e,_0x9009('0x54'));for(var _0xd55bdd in _0x3f035e){if(_0x3f035e[_0x9009('0x23')](_0xd55bdd)){var _0x11456b={};for(var _0x49d7cf=0x0;_0x49d7cf<_0x3f035e[_0xd55bdd][_0x9009('0x3c')];_0x49d7cf+=0x1){var _0x3e78bc=_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x55')];if(_0x25b76d[_0x9009('0x12')][_0x3e78bc]){if(_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x56')]){_0x25b76d[_0x9009('0x12')][_0x3e78bc][_0x9009('0x2d')]+=0x1;}if(_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x57')]){_0x25b76d['voiceQueues'][_0x3e78bc][_0x9009('0x2e')]+=0x1;}_0x25b76d[_0x9009('0x12')][_0x3e78bc]['sumHoldTime']+=moment(_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x58')])[_0x9009('0x59')](moment(_0x3f035e[_0xd55bdd][_0x49d7cf]['queuecallerjoinAt']),'seconds')||0x0;if(_0x49d7cf===_0x3f035e[_0xd55bdd][_0x9009('0x3c')]-0x1){_0x25b76d[_0x9009('0x12')][_0x3e78bc][_0x9009('0x2a')]+=moment(_0x3f035e[_0xd55bdd][_0x49d7cf]['queuecallercompleteAt']||_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x5a')]||_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x5b')])[_0x9009('0x59')](moment(_0x3f035e[_0xd55bdd][_0x49d7cf]['queuecallerjoinAt']),'seconds')||0x0;_0x25b76d[_0x9009('0x12')][_0x3e78bc]['total']+=0x1;if(_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x5c')]){_0x25b76d[_0x9009('0x12')][_0x3e78bc]['answered']+=0x1;_0x25b76d['voiceQueues'][_0x3e78bc]['sumBillable']+=moment(_0x3f035e[_0xd55bdd][_0x49d7cf]['queuecallercompleteAt'])[_0x9009('0x59')](moment(_0x3f035e[_0xd55bdd][_0x49d7cf][_0x9009('0x58')]),'seconds')||0x0;}}else{_0x25b76d[_0x9009('0x12')][_0x3e78bc][_0x9009('0x2a')]+=_0x25b76d['voiceQueues'][_0x3e78bc][_0x9009('0x5d')]||0x0;}}}}}}return _0x25b76d['voiceQueues'];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x2da09e=this;return function(_0x3e1276){clearVoiceCallReports(_0x2da09e[_0x9009('0x16')]);if(_0x3e1276){for(var _0x1031dc=0x0;_0x1031dc<_0x3e1276[_0x9009('0x3c')];_0x1031dc+=0x1){_0x2da09e['outbound'][_0x9009('0x28')]+=0x1;_0x2da09e[_0x9009('0x16')][_0x9009('0x2a')]+=_0x3e1276[_0x1031dc][_0x9009('0x5e')];if(_0x3e1276[_0x1031dc][_0x9009('0x5f')]==='ANSWERED'){_0x2da09e[_0x9009('0x16')][_0x9009('0x29')]+=0x1;_0x2da09e[_0x9009('0x16')][_0x9009('0x5d')]+=_0x3e1276[_0x1031dc][_0x9009('0x5e')]-_0x3e1276[_0x1031dc]['billableseconds']||0x0;_0x2da09e['outbound'][_0x9009('0x2b')]+=_0x3e1276[_0x1031dc]['billableseconds'];}}}return _0x2da09e[_0x9009('0x16')];};};Realtime[_0x9009('0x39')][_0x9009('0x60')]=function(){var _0x43e01a=this;return function(_0x2a491f){if(_0x2a491f){freeIsNotKey(_0x2a491f,_0x43e01a[_0x9009('0x14')],'name');for(var _0x2fc882=0x0,_0x557a6c={};_0x2fc882<_0x2a491f[_0x9009('0x3c')];_0x2fc882+=0x1){_0x557a6c=_0x2a491f[_0x2fc882];if(_[_0x9009('0x3e')](_0x43e01a[_0x9009('0x14')][_0x557a6c[_0x9009('0x26')]])){_0x43e01a[_0x9009('0x14')][_0x557a6c[_0x9009('0x26')]]=new Campaign(_0x557a6c);}else{_0x43e01a[_0x9009('0x3a')](_0x43e01a[_0x9009('0x14')][_0x557a6c['name']],_0x557a6c);_0x43e01a['campaigns'][_0x557a6c[_0x9009('0x26')]]['dialQueueProject']=_0x557a6c['SquareProject']?_0x557a6c['SquareProject'][_0x9009('0x26')]:undefined;}}}return _0x43e01a[_0x9009('0x14')];};};Realtime['prototype'][_0x9009('0x61')]=function(){var _0x154e04=this;return function(_0x4e5ae2){if(_0x4e5ae2){freeIsNotKey(_0x4e5ae2,_0x154e04[_0x9009('0x17')],'id');for(var _0x38d438=0x0,_0x4e92ec={};_0x38d438<_0x4e5ae2[_0x9009('0x3c')];_0x38d438+=0x1){_0x4e92ec=_0x4e5ae2[_0x38d438];if(_[_0x9009('0x3e')](_0x154e04[_0x9009('0x17')][_0x4e92ec['id']])){_0x154e04[_0x9009('0x17')][_0x4e92ec['id']]=new VoiceExtension(_0x4e92ec);}else{_0x154e04[_0x9009('0x3a')](_0x154e04[_0x9009('0x17')][_0x4e92ec['id']],_0x4e92ec);}}}return _0x154e04[_0x9009('0x17')];};};Realtime[_0x9009('0x39')]['initCampaignHopperHistory']=function(){var _0xb3305c=this;return function(_0x28e478){clearCampaigns(_0xb3305c[_0x9009('0x14')]);for(var _0x24072a=0x0;_0x24072a<_0x28e478[_0x9009('0x3c')];_0x24072a+=0x1){_[_0x9009('0x62')](_0xb3305c[_0x9009('0x14')][_0x28e478[_0x24072a][_0x9009('0x26')]],_0x28e478[_0x24072a]);}return _0xb3305c[_0x9009('0x14')];};};Realtime[_0x9009('0x39')][_0x9009('0x63')]=function(){var _0x45260e=this;return function(_0x21cc15){if(_0x21cc15){freeIsNotKey(_0x21cc15,_0x45260e[_0x9009('0x21')],'id');for(var _0x42420a=0x0,_0x29d1ee={},_0x171e36={};_0x42420a<_0x21cc15['length'];_0x42420a+=0x1){_0x29d1ee=_0x21cc15[_0x42420a];if(_[_0x9009('0x3e')](_0x45260e[_0x9009('0x21')][_0x29d1ee['id']])){_0x45260e[_0x9009('0x21')][_0x29d1ee['id']]=new FaxAccount(_0x29d1ee);}else{_0x45260e[_0x9009('0x3a')](_0x45260e['faxAccounts'][_0x29d1ee['id']],_0x29d1ee);}}}return _0x45260e[_0x9009('0x21')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7a77=['../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','voiceQueues','triggers','templates','channels','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','name','isNil','interface','format','SIP/%s','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','agents','mergeFromDatabase','initTelephones','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initZohoAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/telephone'];(function(_0xa5e821,_0x4dd2f6){var _0x62d0cd=function(_0x119f86){while(--_0x119f86){_0xa5e821['push'](_0xa5e821['shift']());}};_0x62d0cd(++_0x4dd2f6);}(_0x7a77,0x1c3));var _0x77a7=function(_0x135560,_0x286116){_0x135560=_0x135560-0x0;var _0x1ece2d=_0x7a77[_0x135560];return _0x1ece2d;};'use strict';var BPromise=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var _=require(_0x77a7('0x2'));var moment=require(_0x77a7('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x77a7('0x4'));var Trunk=require(_0x77a7('0x5'));var VoiceQueue=require(_0x77a7('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x77a7('0x7'));var Campaign=require(_0x77a7('0x8'));var VoiceExtension=require(_0x77a7('0x9'));var ZendeskAccount=require(_0x77a7('0xa'));var SalesforceAccount=require(_0x77a7('0xb'));var FreshdeskAccount=require(_0x77a7('0xc'));var SugarcrmAccount=require(_0x77a7('0xd'));var ZohoAccount=require(_0x77a7('0xe'));var DeskAccount=require(_0x77a7('0xf'));var VtigerAccount=require(_0x77a7('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x77a7('0x11'));var FreshsalesAccount=require(_0x77a7('0x12'));var FaxAccount=require(_0x77a7('0x13'));var Realtime=function(){this['agents']={};this[_0x77a7('0x14')]={};this['trunks']={};this[_0x77a7('0x15')]={};this[_0x77a7('0x16')]={};this['campaigns']={};this[_0x77a7('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x77a7('0x18')]={};this[_0x77a7('0x19')]={};this[_0x77a7('0x1a')]={};this[_0x77a7('0x1b')]={};this[_0x77a7('0x1c')]={};this['salesforceAccounts']={};this[_0x77a7('0x1d')]={};this[_0x77a7('0x1e')]={};this[_0x77a7('0x1f')]={};this[_0x77a7('0x20')]={};this['vtigerAccounts']={};this[_0x77a7('0x21')]={};this[_0x77a7('0x22')]={};this[_0x77a7('0x23')]={};this[_0x77a7('0x24')]={};};function freeIsNotKey(_0x4e0c89,_0x691982,_0x5e470c){var _0x41b7c9=_[_0x77a7('0x25')](_0x4e0c89,function(_0x3f69d3,_0x135696){return _0x3f69d3[_0x5e470c];});for(var _0x5717a7 in _0x691982){if(_0x691982[_0x77a7('0x26')](_0x5717a7)){if(!_0x41b7c9[_0x5717a7]){delete _0x691982[_0x5717a7];}}}}function freeIsNotKeySip(_0x45a230,_0x337e89){var _0x262a39=_['mapKeys'](_0x45a230,function(_0x149dda,_0x407f13){return util['format']('SIP/%s',_0x149dda[_0x77a7('0x27')]);});for(var _0x21f773 in _0x337e89){if(_0x337e89[_0x77a7('0x26')](_0x21f773)){if(!_0x262a39[_0x21f773]){delete _0x337e89[_0x21f773];}}}}function freeIsNotKeyAgent(_0x349c3a,_0x4666fa){var _0xe278d4=_[_0x77a7('0x25')](_0x349c3a,function(_0x5a31d9,_0x2a2e01){var _0x13714d=_[_0x77a7('0x28')](_0x5a31d9[_0x77a7('0x29')])?util[_0x77a7('0x2a')](_0x77a7('0x2b'),_0x5a31d9[_0x77a7('0x27')]):_0x5a31d9['interface'];return _0x13714d;});for(var _0x547136 in _0x4666fa){if(_0x4666fa[_0x77a7('0x26')](_0x547136)){if(!_0xe278d4[_0x547136]){delete _0x4666fa[_0x547136];}}}}function clearVoiceCallReports(_0x2bfbe2){_0x2bfbe2['total']=0x0;_0x2bfbe2[_0x77a7('0x2c')]=0x0;_0x2bfbe2[_0x77a7('0x2d')]=0x0;_0x2bfbe2[_0x77a7('0x2e')]=0x0;_0x2bfbe2[_0x77a7('0x2f')]=0x0;}function clearCampaigns(_0x5b9803){if(!_[_0x77a7('0x30')](_0x5b9803)){for(var _0x4be7f2 in _0x5b9803){if(_0x5b9803[_0x77a7('0x26')](_0x4be7f2)){_0x5b9803[_0x4be7f2][_0x77a7('0x31')]=0x0;_0x5b9803[_0x4be7f2][_0x77a7('0x32')]=0x0;}}}}function clearVoiceQueues(_0x262f9f){if(!_['isEmpty'](_0x262f9f)){for(var _0x4c3bb8 in _0x262f9f){if(_0x262f9f['hasOwnProperty'](_0x4c3bb8)){_0x262f9f[_0x4c3bb8][_0x77a7('0x33')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x2c')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x34')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x35')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x2d')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x2e')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x2f')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x36')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x37')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x38')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x39')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x3a')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x3b')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x3c')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x3d')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x3e')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x3f')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x40')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x41')]=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x36')]=0x0;_0x262f9f[_0x4c3bb8]['outboundAnswerCallsDay']=0x0;_0x262f9f[_0x4c3bb8][_0x77a7('0x42')]=!![];}}}}Realtime[_0x77a7('0x43')]['mergeFromDatabase']=function(_0x26ac82,_0x55a96c){for(var _0x24e9a7 in _0x55a96c){if(_0x26ac82[_0x77a7('0x26')](_0x24e9a7)){_0x26ac82[_0x24e9a7]=_0x55a96c[_0x24e9a7];}}};Realtime['prototype'][_0x77a7('0x44')]=function(){var _0x4e7c6e=this;return function(_0x4f9410){if(_0x4f9410){freeIsNotKeyAgent(_0x4f9410,_0x4e7c6e['agents']);for(var _0x346898=0x0,_0xe95232={},_0x42d2fb={};_0x346898<_0x4f9410[_0x77a7('0x45')];_0x346898+=0x1){_0xe95232=_0x4f9410[_0x346898];var _0x5e9960=_[_0x77a7('0x28')](_0xe95232[_0x77a7('0x29')])?util[_0x77a7('0x2a')](_0x77a7('0x2b'),_0xe95232[_0x77a7('0x27')]):_0xe95232[_0x77a7('0x29')];if(_[_0x77a7('0x46')](_0x4e7c6e[_0x77a7('0x47')][_0x5e9960])){_0x4e7c6e[_0x77a7('0x47')][_0x5e9960]=new Agent(_0xe95232);}else{_0x4e7c6e[_0x77a7('0x48')](_0x4e7c6e[_0x77a7('0x47')][_0x5e9960],_0xe95232);}}}return _0x4e7c6e[_0x77a7('0x47')];};};Realtime['prototype'][_0x77a7('0x49')]=function(){var _0x4c5d49=this;return function(_0xb2e27f){if(_0xb2e27f){freeIsNotKeySip(_0xb2e27f,_0x4c5d49[_0x77a7('0x14')]);for(var _0x5ec056=0x0,_0x185299={},_0x5888df={};_0x5ec056<_0xb2e27f[_0x77a7('0x45')];_0x5ec056+=0x1){_0x185299=_0xb2e27f[_0x5ec056];if(_[_0x77a7('0x46')](_0x4c5d49['telephones'][util['format'](_0x77a7('0x2b'),_0x185299[_0x77a7('0x27')])])){_0x4c5d49['telephones'][util[_0x77a7('0x2a')](_0x77a7('0x2b'),_0x185299['name'])]=new Telephone(_0x185299);}else{_0x4c5d49[_0x77a7('0x48')](_0x4c5d49[_0x77a7('0x14')][util[_0x77a7('0x2a')](_0x77a7('0x2b'),_0x185299['name'])],_0x185299);}}}return _0x4c5d49['telephones'];};};Realtime['prototype'][_0x77a7('0x4a')]=function(){var _0x2d50ff=this;return function(_0x3df1fe){if(_0x3df1fe){freeIsNotKeySip(_0x3df1fe,_0x2d50ff[_0x77a7('0x4b')]);for(var _0xcebea1=0x0,_0x657c59={},_0x2c81f5={};_0xcebea1<_0x3df1fe[_0x77a7('0x45')];_0xcebea1+=0x1){_0x657c59=_0x3df1fe[_0xcebea1];if(_[_0x77a7('0x46')](_0x2d50ff[_0x77a7('0x4b')][util['format']('SIP/%s',_0x657c59['name'])])){_0x2d50ff[_0x77a7('0x4b')][util['format'](_0x77a7('0x2b'),_0x657c59[_0x77a7('0x27')])]=new Trunk(_0x657c59);}else{_0x2d50ff[_0x77a7('0x48')](_0x2d50ff[_0x77a7('0x4b')][util[_0x77a7('0x2a')](_0x77a7('0x2b'),_0x657c59[_0x77a7('0x27')])],_0x657c59);}}}return _0x2d50ff[_0x77a7('0x4b')];};};Realtime['prototype'][_0x77a7('0x4c')]=function(){var _0x1aed9d=this;return function(_0x205c40){if(_0x205c40){freeIsNotKey(_0x205c40,_0x1aed9d[_0x77a7('0x15')],_0x77a7('0x27'));for(var _0x5addd3=0x0,_0x4fba6e={},_0x56e33c={};_0x5addd3<_0x205c40[_0x77a7('0x45')];_0x5addd3+=0x1){_0x4fba6e=_0x205c40[_0x5addd3];if(_[_0x77a7('0x46')](_0x1aed9d[_0x77a7('0x15')][_0x4fba6e['name']])){_0x1aed9d[_0x77a7('0x15')][_0x4fba6e['name']]=new VoiceQueue(_0x4fba6e);}else{_0x1aed9d['mergeFromDatabase'](_0x1aed9d[_0x77a7('0x15')][_0x4fba6e[_0x77a7('0x27')]],_0x4fba6e);}}}return _0x1aed9d['voiceQueues'];};};Realtime['prototype'][_0x77a7('0x4d')]=function(){var _0x40cd19=this;return function(_0xbb147f){if(_0xbb147f){freeIsNotKey(_0xbb147f,_0x40cd19[_0x77a7('0x16')],'id');for(var _0xb190e5=0x0,_0x7aac44={},_0x2ffd15={};_0xb190e5<_0xbb147f['length'];_0xb190e5+=0x1){_0x7aac44=_0xbb147f[_0xb190e5];if(_['isUndefined'](_0x40cd19[_0x77a7('0x16')][_0x7aac44['id']])){_0x40cd19[_0x77a7('0x16')][_0x7aac44['id']]=new Trigger(_0x7aac44);}else{_0x40cd19[_0x77a7('0x48')](_0x40cd19[_0x77a7('0x16')][_0x7aac44['id']],_0x7aac44);}}}return _0x40cd19[_0x77a7('0x16')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x4e')]=function(){var _0x4bcb8e=this;return function(_0x4087d5){if(_0x4087d5){freeIsNotKey(_0x4087d5,_0x4bcb8e[_0x77a7('0x17')],'id');for(var _0x219efb=0x0,_0x10eeb0={},_0x145e93={};_0x219efb<_0x4087d5[_0x77a7('0x45')];_0x219efb+=0x1){_0x10eeb0=_0x4087d5[_0x219efb];if(_['isUndefined'](_0x4bcb8e[_0x77a7('0x17')][_0x10eeb0['id']])){_0x4bcb8e[_0x77a7('0x17')][_0x10eeb0['id']]=new Template(_0x10eeb0);}else{_0x4bcb8e[_0x77a7('0x48')](_0x4bcb8e[_0x77a7('0x17')][_0x10eeb0['id']],_0x10eeb0);}}}return _0x4bcb8e['templates'];};};Realtime['prototype'][_0x77a7('0x4f')]=function(){var _0x1d2075=this;return function(_0x158a66){if(_0x158a66){freeIsNotKey(_0x158a66,_0x1d2075[_0x77a7('0x1c')],'id');for(var _0x4dd670=0x0,_0x5d18f7={},_0x139ced={};_0x4dd670<_0x158a66[_0x77a7('0x45')];_0x4dd670+=0x1){_0x5d18f7=_0x158a66[_0x4dd670];if(_[_0x77a7('0x46')](_0x1d2075['zendeskAccounts'][_0x5d18f7['id']])){_0x1d2075[_0x77a7('0x1c')][_0x5d18f7['id']]=new ZendeskAccount(_0x5d18f7);}else{_0x1d2075['mergeFromDatabase'](_0x1d2075[_0x77a7('0x1c')][_0x5d18f7['id']],_0x5d18f7);}}}return _0x1d2075[_0x77a7('0x1c')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x4b6519=this;return function(_0x3a559e){if(_0x3a559e){freeIsNotKey(_0x3a559e,_0x4b6519[_0x77a7('0x50')],'id');for(var _0x7e8ca2=0x0,_0x3f52d9={},_0x408435={};_0x7e8ca2<_0x3a559e[_0x77a7('0x45')];_0x7e8ca2+=0x1){_0x3f52d9=_0x3a559e[_0x7e8ca2];if(_['isUndefined'](_0x4b6519[_0x77a7('0x50')][_0x3f52d9['id']])){_0x4b6519[_0x77a7('0x50')][_0x3f52d9['id']]=new SalesforceAccount(_0x3f52d9);}else{_0x4b6519[_0x77a7('0x48')](_0x4b6519[_0x77a7('0x50')][_0x3f52d9['id']],_0x3f52d9);}}}return _0x4b6519['salesforceAccounts'];};};Realtime[_0x77a7('0x43')]['initFreshdeskAccounts']=function(){var _0x54dd8c=this;return function(_0x1be706){if(_0x1be706){freeIsNotKey(_0x1be706,_0x54dd8c['freshdeskAccounts'],'id');for(var _0x4e1248=0x0,_0x255767={},_0x507128={};_0x4e1248<_0x1be706[_0x77a7('0x45')];_0x4e1248+=0x1){_0x255767=_0x1be706[_0x4e1248];if(_[_0x77a7('0x46')](_0x54dd8c[_0x77a7('0x1e')][_0x255767['id']])){_0x54dd8c[_0x77a7('0x1e')][_0x255767['id']]=new FreshdeskAccount(_0x255767);}else{_0x54dd8c[_0x77a7('0x48')](_0x54dd8c[_0x77a7('0x1e')][_0x255767['id']],_0x255767);}}}return _0x54dd8c[_0x77a7('0x1e')];};};Realtime['prototype'][_0x77a7('0x51')]=function(){var _0x506df4=this;return function(_0x412b54){if(_0x412b54){freeIsNotKey(_0x412b54,_0x506df4[_0x77a7('0x1f')],'id');for(var _0x1c99c0=0x0,_0x18a2f4={},_0x17d77a={};_0x1c99c0<_0x412b54[_0x77a7('0x45')];_0x1c99c0+=0x1){_0x18a2f4=_0x412b54[_0x1c99c0];if(_['isUndefined'](_0x506df4[_0x77a7('0x1f')][_0x18a2f4['id']])){_0x506df4[_0x77a7('0x1f')][_0x18a2f4['id']]=new ZohoAccount(_0x18a2f4);}else{_0x506df4[_0x77a7('0x48')](_0x506df4['zohoAccounts'][_0x18a2f4['id']],_0x18a2f4);}}}return _0x506df4[_0x77a7('0x1f')];};};Realtime[_0x77a7('0x43')]['initDeskAccounts']=function(){var _0x49ed03=this;return function(_0x5da167){if(_0x5da167){freeIsNotKey(_0x5da167,_0x49ed03[_0x77a7('0x20')],'id');for(var _0x17c046=0x0,_0xb78c94={},_0x5f0e4b={};_0x17c046<_0x5da167[_0x77a7('0x45')];_0x17c046+=0x1){_0xb78c94=_0x5da167[_0x17c046];if(_['isUndefined'](_0x49ed03[_0x77a7('0x20')][_0xb78c94['id']])){_0x49ed03[_0x77a7('0x20')][_0xb78c94['id']]=new DeskAccount(_0xb78c94);}else{_0x49ed03[_0x77a7('0x48')](_0x49ed03[_0x77a7('0x20')][_0xb78c94['id']],_0xb78c94);}}}return _0x49ed03[_0x77a7('0x20')];};};Realtime[_0x77a7('0x43')]['initSugarcrmAccounts']=function(){var _0x2ee9ca=this;return function(_0x4cc6bb){if(_0x4cc6bb){freeIsNotKey(_0x4cc6bb,_0x2ee9ca[_0x77a7('0x1d')],'id');for(var _0x975888=0x0,_0x2b0fca={},_0x3db08b={};_0x975888<_0x4cc6bb['length'];_0x975888+=0x1){_0x2b0fca=_0x4cc6bb[_0x975888];if(_[_0x77a7('0x46')](_0x2ee9ca[_0x77a7('0x1d')][_0x2b0fca['id']])){_0x2ee9ca[_0x77a7('0x1d')][_0x2b0fca['id']]=new SugarcrmAccount(_0x2b0fca);}else{_0x2ee9ca[_0x77a7('0x48')](_0x2ee9ca[_0x77a7('0x1d')][_0x2b0fca['id']],_0x2b0fca);}}}return _0x2ee9ca[_0x77a7('0x1d')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x52')]=function(){var _0x33a66b=this;return function(_0x2d791c){if(_0x2d791c){freeIsNotKey(_0x2d791c,_0x33a66b[_0x77a7('0x53')],'id');for(var _0x1db118=0x0,_0x129f34={},_0x1d00a8={};_0x1db118<_0x2d791c[_0x77a7('0x45')];_0x1db118+=0x1){_0x129f34=_0x2d791c[_0x1db118];if(_[_0x77a7('0x46')](_0x33a66b[_0x77a7('0x53')][_0x129f34['id']])){_0x33a66b[_0x77a7('0x53')][_0x129f34['id']]=new VtigerAccount(_0x129f34);}else{_0x33a66b[_0x77a7('0x48')](_0x33a66b[_0x77a7('0x53')][_0x129f34['id']],_0x129f34);}}}return _0x33a66b[_0x77a7('0x53')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x54')]=function(){var _0x5a96b9=this;return function(_0x325bcb){if(_0x325bcb){freeIsNotKey(_0x325bcb,_0x5a96b9[_0x77a7('0x21')],'id');for(var _0x1cbc89=0x0,_0x230c60={},_0x5ea0f5={};_0x1cbc89<_0x325bcb[_0x77a7('0x45')];_0x1cbc89+=0x1){_0x230c60=_0x325bcb[_0x1cbc89];if(_[_0x77a7('0x46')](_0x5a96b9[_0x77a7('0x21')][_0x230c60['id']])){_0x5a96b9[_0x77a7('0x21')][_0x230c60['id']]=new ServicenowAccount(_0x230c60);}else{_0x5a96b9[_0x77a7('0x48')](_0x5a96b9[_0x77a7('0x21')][_0x230c60['id']],_0x230c60);}}}return _0x5a96b9[_0x77a7('0x21')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x25d190=this;return function(_0x4d8f83){if(_0x4d8f83){freeIsNotKey(_0x4d8f83,_0x25d190[_0x77a7('0x22')],'id');for(var _0x2b1cc9=0x0,_0x479496={},_0x28c0c3={};_0x2b1cc9<_0x4d8f83[_0x77a7('0x45')];_0x2b1cc9+=0x1){_0x479496=_0x4d8f83[_0x2b1cc9];if(_[_0x77a7('0x46')](_0x25d190[_0x77a7('0x22')][_0x479496['id']])){_0x25d190[_0x77a7('0x22')][_0x479496['id']]=new Dynamics365Account(_0x479496);}else{_0x25d190['mergeFromDatabase'](_0x25d190[_0x77a7('0x22')][_0x479496['id']],_0x479496);}}}return _0x25d190[_0x77a7('0x22')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x55')]=function(){var _0x2c74a5=this;return function(_0x126c79){if(_0x126c79){freeIsNotKey(_0x126c79,_0x2c74a5[_0x77a7('0x23')],'id');for(var _0x148aa7=0x0,_0x54ba29={},_0x22b42e={};_0x148aa7<_0x126c79[_0x77a7('0x45')];_0x148aa7+=0x1){_0x54ba29=_0x126c79[_0x148aa7];if(_['isUndefined'](_0x2c74a5[_0x77a7('0x23')][_0x54ba29['id']])){_0x2c74a5[_0x77a7('0x23')][_0x54ba29['id']]=new FreshsalesAccount(_0x54ba29);}else{_0x2c74a5[_0x77a7('0x48')](_0x2c74a5['freshsalesAccounts'][_0x54ba29['id']],_0x54ba29);}}}return _0x2c74a5[_0x77a7('0x23')];};};Realtime['prototype'][_0x77a7('0x56')]=function(){var _0x53cf62=this;return function(_0x44500b){for(var _0xb278de=0x0;_0xb278de<_0x44500b[_0x77a7('0x45')];_0xb278de+=0x1){_[_0x77a7('0x57')](_0x53cf62['voiceQueues'][_0x44500b[_0xb278de][_0x77a7('0x27')]],_0x44500b[_0xb278de]);}return _0x53cf62[_0x77a7('0x15')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x58')]=function(){var _0x234fad=this;return function(_0x2518eb){clearVoiceQueues(_0x234fad[_0x77a7('0x15')]);if(_0x2518eb){_0x2518eb=_[_0x77a7('0x59')](_0x2518eb,_0x77a7('0x5a'));for(var _0x100058 in _0x2518eb){if(_0x2518eb[_0x77a7('0x26')](_0x100058)){var _0x55968e={};for(var _0x2aeb=0x0;_0x2aeb<_0x2518eb[_0x100058][_0x77a7('0x45')];_0x2aeb+=0x1){var _0x34619b=_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x5b')];if(_0x234fad[_0x77a7('0x15')][_0x34619b]){if(_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x5c')]){_0x234fad['voiceQueues'][_0x34619b][_0x77a7('0x34')]+=0x1;}if(_0x2518eb[_0x100058][_0x2aeb]['queuecallerabandon']){_0x234fad[_0x77a7('0x15')][_0x34619b][_0x77a7('0x35')]+=0x1;}_0x234fad[_0x77a7('0x15')][_0x34619b][_0x77a7('0x2d')]+=moment(_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x5d')])[_0x77a7('0x5e')](moment(_0x2518eb[_0x100058][_0x2aeb]['queuecallerjoinAt']),_0x77a7('0x5f'))||0x0;if(_0x2aeb===_0x2518eb[_0x100058][_0x77a7('0x45')]-0x1){_0x234fad[_0x77a7('0x15')][_0x34619b][_0x77a7('0x2e')]+=moment(_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x60')]||_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x61')]||_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x62')])[_0x77a7('0x5e')](moment(_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x63')]),_0x77a7('0x5f'))||0x0;_0x234fad[_0x77a7('0x15')][_0x34619b]['total']+=0x1;if(_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x64')]){_0x234fad[_0x77a7('0x15')][_0x34619b][_0x77a7('0x2c')]+=0x1;_0x234fad['voiceQueues'][_0x34619b][_0x77a7('0x2f')]+=moment(_0x2518eb[_0x100058][_0x2aeb][_0x77a7('0x60')])[_0x77a7('0x5e')](moment(_0x2518eb[_0x100058][_0x2aeb]['queuecallerleaveAt']),_0x77a7('0x5f'))||0x0;}}else{_0x234fad[_0x77a7('0x15')][_0x34619b][_0x77a7('0x2e')]+=_0x234fad['voiceQueues'][_0x34619b][_0x77a7('0x2d')]||0x0;}}}}}}return _0x234fad[_0x77a7('0x15')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x65')]=function(){var _0xb292cf=this;return function(_0x32eb34){clearVoiceCallReports(_0xb292cf['outbound']);if(_0x32eb34){for(var _0x205148=0x0;_0x205148<_0x32eb34[_0x77a7('0x45')];_0x205148+=0x1){_0xb292cf[_0x77a7('0x66')]['total']+=0x1;_0xb292cf['outbound'][_0x77a7('0x2e')]+=_0x32eb34[_0x205148]['duration'];if(_0x32eb34[_0x205148][_0x77a7('0x67')]===_0x77a7('0x68')){_0xb292cf[_0x77a7('0x66')]['answered']+=0x1;_0xb292cf['outbound'][_0x77a7('0x2d')]+=_0x32eb34[_0x205148][_0x77a7('0x69')]-_0x32eb34[_0x205148][_0x77a7('0x6a')]||0x0;_0xb292cf['outbound'][_0x77a7('0x2f')]+=_0x32eb34[_0x205148]['billableseconds'];}}}return _0xb292cf[_0x77a7('0x66')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x6b')]=function(){var _0x2bf195=this;return function(_0x3792b7){if(_0x3792b7){freeIsNotKey(_0x3792b7,_0x2bf195[_0x77a7('0x6c')],'name');for(var _0x57dffe=0x0,_0x210239={};_0x57dffe<_0x3792b7[_0x77a7('0x45')];_0x57dffe+=0x1){_0x210239=_0x3792b7[_0x57dffe];if(_[_0x77a7('0x46')](_0x2bf195[_0x77a7('0x6c')][_0x210239[_0x77a7('0x27')]])){_0x2bf195[_0x77a7('0x6c')][_0x210239[_0x77a7('0x27')]]=new Campaign(_0x210239);}else{_0x2bf195[_0x77a7('0x48')](_0x2bf195[_0x77a7('0x6c')][_0x210239[_0x77a7('0x27')]],_0x210239);_0x2bf195['campaigns'][_0x210239[_0x77a7('0x27')]]['dialQueueProject']=_0x210239[_0x77a7('0x6d')]?_0x210239[_0x77a7('0x6d')]['name']:undefined;}}}return _0x2bf195[_0x77a7('0x6c')];};};Realtime[_0x77a7('0x43')]['initVoiceExtensions']=function(){var _0x1d30ac=this;return function(_0x10be6d){if(_0x10be6d){freeIsNotKey(_0x10be6d,_0x1d30ac[_0x77a7('0x6e')],'id');for(var _0xd242db=0x0,_0x384371={};_0xd242db<_0x10be6d[_0x77a7('0x45')];_0xd242db+=0x1){_0x384371=_0x10be6d[_0xd242db];if(_[_0x77a7('0x46')](_0x1d30ac[_0x77a7('0x6e')][_0x384371['id']])){_0x1d30ac[_0x77a7('0x6e')][_0x384371['id']]=new VoiceExtension(_0x384371);}else{_0x1d30ac['mergeFromDatabase'](_0x1d30ac[_0x77a7('0x6e')][_0x384371['id']],_0x384371);}}}return _0x1d30ac[_0x77a7('0x6e')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x6f')]=function(){var _0x535ee9=this;return function(_0x247283){clearCampaigns(_0x535ee9[_0x77a7('0x6c')]);for(var _0xe6290=0x0;_0xe6290<_0x247283['length'];_0xe6290+=0x1){_[_0x77a7('0x57')](_0x535ee9[_0x77a7('0x6c')][_0x247283[_0xe6290][_0x77a7('0x27')]],_0x247283[_0xe6290]);}return _0x535ee9[_0x77a7('0x6c')];};};Realtime[_0x77a7('0x43')][_0x77a7('0x70')]=function(){var _0x2ab350=this;return function(_0x2a3f27){if(_0x2a3f27){freeIsNotKey(_0x2a3f27,_0x2ab350['faxAccounts'],'id');for(var _0xa94404=0x0,_0x120e0c={},_0x114d89={};_0xa94404<_0x2a3f27[_0x77a7('0x45')];_0xa94404+=0x1){_0x120e0c=_0x2a3f27[_0xa94404];if(_['isUndefined'](_0x2ab350[_0x77a7('0x24')][_0x120e0c['id']])){_0x2ab350[_0x77a7('0x24')][_0x120e0c['id']]=new FaxAccount(_0x120e0c);}else{_0x2ab350['mergeFromDatabase'](_0x2ab350[_0x77a7('0x24')][_0x120e0c['id']],_0x120e0c);}}}return _0x2ab350[_0x77a7('0x24')];};};module[_0x77a7('0x71')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 45508f3..7c40057 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 _0xb448=['../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','name','isNil','accountcode','interface','format','length','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','destination','exten','type','lastapplication','queue','lastdata','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','callerid','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','linkedid','transfers','create','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','attendedTransfer','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport'];(function(_0x4b516f,_0xfcf021){var _0x3a386f=function(_0x47daf1){while(--_0x47daf1){_0x4b516f['push'](_0x4b516f['shift']());}};_0x3a386f(++_0xfcf021);}(_0xb448,0x1df));var _0x8b44=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb448[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var moment=require(_0x8b44('0x0'));var util=require(_0x8b44('0x1'));var config=require(_0x8b44('0x2'));var ami=require(_0x8b44('0x3'));var RpcVoiceAgentReport=require(_0x8b44('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x8b44('0x5'));var RpcMemberReport=require(_0x8b44('0x6'));var RpcVoiceQueueReport=require(_0x8b44('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x8b44('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8b44('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x4c891f){this[_0x8b44('0xa')]=_0x4c891f;this[_0x8b44('0xb')]=_0x4c891f['agents'];this[_0x8b44('0xc')]=_0x4c891f[_0x8b44('0xc')];}Report[_0x8b44('0xd')][_0x8b44('0xe')]=function(_0x300db7){var _0x37e3e2=new VoiceQueueReport(this[_0x8b44('0xa')]);var _0x25d4fb=new VoiceAgentReport(this[_0x8b44('0xa')]);var _0x13967e=new VoiceDialReport(this[_0x8b44('0xa')]);var _0x165ead=new VoiceCallReport(this['realtime']);var _0x53b420=new UserReport(this[_0x8b44('0xa')]);if(config['xdr']&&config[_0x8b44('0xf')]['disabled']){ami['on'](_0x8b44('0x10'),this[_0x8b44('0x11')][_0x8b44('0x12')](this));ami['on'](_0x8b44('0x13'),this[_0x8b44('0x14')][_0x8b44('0x12')](this));ami['on'](_0x8b44('0x15'),this[_0x8b44('0x16')][_0x8b44('0x12')](this));ami['on']('custom:voiceDialReport',this[_0x8b44('0x17')][_0x8b44('0x12')](this));ami['on'](_0x8b44('0x18'),this[_0x8b44('0x19')]['bind'](this));ami['on'](_0x8b44('0x1a'),this['attendedTransfer'][_0x8b44('0x12')](this));}};Report[_0x8b44('0xd')][_0x8b44('0x1b')]=function(_0x5589ec){var _0x3622d7;_0x3622d7=_[_0x8b44('0x1c')](this[_0x8b44('0xb')],function(_0x4e2488){return _0x4e2488['accountcode']==_0x5589ec||_0x4e2488[_0x8b44('0x1d')]==_0x5589ec;});if(_[_0x8b44('0x1e')](_0x3622d7)){var _0x337802=_[_0x8b44('0x1c')](this[_0x8b44('0xc')],function(_0x5a9930){return _0x5a9930[_0x8b44('0x1f')]==_0x5589ec||_0x5a9930[_0x8b44('0x1d')]==_0x5589ec;});if(_0x337802){_0x3622d7=_[_0x8b44('0x1c')](this['agents'],function(_0xcaecd3){return _0xcaecd3[_0x8b44('0x20')]==util[_0x8b44('0x21')]('SIP/%s',_0x337802[_0x8b44('0x1d')]);});}}return _0x3622d7;};Report['prototype']['voiceQueueReport']=function(_0x3b5323){for(var _0x52ae27=0x0;_0x52ae27<_0x3b5323[_0x8b44('0x22')];_0x52ae27+=0x1){var _0x29d6a2=this['findAgent'](_0x3b5323[_0x52ae27]['connectedlinenum']);if(_0x29d6a2){_0x3b5323[_0x52ae27]['accountcode']=_0x29d6a2[_0x8b44('0x1f')];_0x3b5323[_0x52ae27][_0x8b44('0x23')]=!![];_0x3b5323[_0x52ae27][_0x8b44('0x24')]=_0x29d6a2[_0x8b44('0x1d')];_0x3b5323[_0x52ae27][_0x8b44('0x20')]=_[_0x8b44('0x1e')](_0x29d6a2['interface'])?util[_0x8b44('0x21')](_0x8b44('0x25'),_0x29d6a2[_0x8b44('0x1d')]):_0x29d6a2[_0x8b44('0x20')];if(_0x3b5323[_0x52ae27][_0x8b44('0x26')]){_0x3b5323[_0x52ae27]['queuecallercompleteAt']=moment()[_0x8b44('0x21')](_0x8b44('0x27'));}if(_0x3b5323[_0x52ae27][_0x8b44('0x28')]){_0x3b5323[_0x52ae27][_0x8b44('0x29')]=moment()[_0x8b44('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x8b44('0x11')](_0x3b5323[_0x52ae27]);}RpcVoiceQueueReport['create'](_0x3b5323[_0x52ae27]);}};function extractCalleridNumber(_0x10c18b){var _0x1e71c8=_0x10c18b['match'](/<(.*?)>/);return _0x1e71c8?_0x1e71c8[0x1]:_0x10c18b;}Report[_0x8b44('0xd')][_0x8b44('0x14')]=function(_0x4aa9a0){_0x4aa9a0[_0x8b44('0x2a')]=_0x4aa9a0[_0x8b44('0x2a')]||_0x4aa9a0[_0x8b44('0x2b')];if(_0x4aa9a0[_0x8b44('0x2c')]=='dialer'){_0x4aa9a0[_0x8b44('0x2d')]=_0x8b44('0x2e');_0x4aa9a0[_0x8b44('0x2f')]=_0x4aa9a0[_0x8b44('0x2e')];if(_0x4aa9a0[_0x8b44('0x30')]=='from-voip-provider'){_0x4aa9a0['accountcode']='';_0x4aa9a0['destination']=extractCalleridNumber(_0x4aa9a0['callerid']);}else if(_0x4aa9a0[_0x8b44('0x30')]=='from-sip'){if(_0x4aa9a0[_0x8b44('0x2a')]==_0x8b44('0x31')){_0x4aa9a0['destination']=extractCalleridNumber(_0x4aa9a0[_0x8b44('0x32')]);_0x4aa9a0[_0x8b44('0x33')]=_0x4aa9a0[_0x8b44('0x34')];_0x4aa9a0['destinationchannel']=[_0x4aa9a0[_0x8b44('0x35')],_0x4aa9a0[_0x8b44('0x35')]=_0x4aa9a0[_0x8b44('0x36')]][0x0];_0x4aa9a0[_0x8b44('0x37')]=_0x4aa9a0[_0x8b44('0x32')];}else{_0x4aa9a0[_0x8b44('0x2a')]=_0x4aa9a0[_0x8b44('0x33')];_0x4aa9a0[_0x8b44('0x33')]=_0x4aa9a0[_0x8b44('0x34')];if(_0x4aa9a0['disposition']==_0x8b44('0x38')){_0x4aa9a0[_0x8b44('0x1f')]=_0x4aa9a0[_0x8b44('0x39')];}else{_0x4aa9a0[_0x8b44('0x1f')]='';}}}}else{_0x4aa9a0[_0x8b44('0x37')]=util[_0x8b44('0x21')](_0x8b44('0x3a'),_0x4aa9a0['calleridname'],_0x4aa9a0['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x4aa9a0[_0x8b44('0x3b')]]){var _0x5cf193=RpcVoiceTransferReport[_0x8b44('0x3c')][_0x4aa9a0[_0x8b44('0x3b')]];_0x5cf193['transfereelinkedid']=_0x4aa9a0['uniqueid'];RpcVoiceTransferReport[_0x8b44('0x19')](_0x5cf193);delete RpcVoiceTransferReport['transfers'][_0x4aa9a0[_0x8b44('0x3b')]];}RpcVoiceCallReport[_0x8b44('0x3d')](_0x4aa9a0);if(_0x4aa9a0[_0x8b44('0x3e')]){for(var _0xddffaa=0x0;_0xddffaa<_0x4aa9a0[_0x8b44('0x3f')]['length'];_0xddffaa+=0x1){_0x4aa9a0[_0x8b44('0x40')]=_0x4aa9a0[_0x8b44('0x3f')][_0xddffaa][_0x8b44('0x41')];_0x4aa9a0[_0x8b44('0x42')]=_0x4aa9a0[_0x8b44('0x3f')][_0xddffaa]['createdAt'];if(_0x4aa9a0[_0x8b44('0x2b')]=='xcally-motion-preview'){_0x4aa9a0['calleridnum']=_0x4aa9a0[_0x8b44('0x39')];_0x4aa9a0[_0x8b44('0x43')]=_0x4aa9a0[_0x8b44('0x44')];_0x4aa9a0[_0x8b44('0x39')]=_0x4aa9a0[_0x8b44('0x1f')];_0x4aa9a0['connectedlinename']=_0x4aa9a0[_0x8b44('0x45')];_0x4aa9a0[_0x8b44('0x2b')]=_0x4aa9a0['originatecalleridnum'];}else if(_0x4aa9a0[_0x8b44('0x2b')]==_0x8b44('0x46')){_0x4aa9a0[_0x8b44('0x33')]=_0x4aa9a0[_0x8b44('0x2a')];_0x4aa9a0[_0x8b44('0x2b')]=_0x4aa9a0[_0x8b44('0x34')];}RpcVoiceRecording[_0x8b44('0x3d')](_0x4aa9a0);}}};Report['prototype']['voiceAgentReport']=function(_0x484b9c){if(_[_0x8b44('0x47')](_0x484b9c)){_0x484b9c[_0x8b44('0x48')](function(_0x1bb5f5){RpcVoiceAgentReport['create'](_0x1bb5f5);});}else{RpcVoiceAgentReport['create'](_0x484b9c);}};Report['prototype']['voiceDialReport']=function(_0x1e4a3a){RpcVoiceDialReport[_0x8b44('0x3d')](_0x1e4a3a);var _0x6d6537;var _0x535e18;var _0x41bc6f=_0x1e4a3a[_0x8b44('0x35')];if(_[_0x8b44('0x49')](_0x41bc6f,'Local')){_0x535e18=_0x41bc6f['substring'](_0x41bc6f[_0x8b44('0x4a')]('/')+0x1,_0x41bc6f[_0x8b44('0x4a')]('@'));_0x6d6537=_[_0x8b44('0x1c')](this[_0x8b44('0xb')],function(_0x2da9a9){return _0x2da9a9[_0x8b44('0x4b')]==_0x535e18||_0x2da9a9[_0x8b44('0x4c')]==_0x535e18||_0x2da9a9[_0x8b44('0x1f')]==_0x535e18;});}else{_0x535e18=_0x41bc6f[_0x8b44('0x4d')](_0x41bc6f['indexOf']('/')+0x1,_0x41bc6f[_0x8b44('0x4e')]('-'));_0x6d6537=this[_0x8b44('0x1b')](_0x535e18);}if(_0x6d6537){_0x1e4a3a['interface']=_['isNil'](_0x6d6537[_0x8b44('0x20')])?util[_0x8b44('0x21')](_0x8b44('0x25'),_0x6d6537['name']):_0x6d6537[_0x8b44('0x20')];_0x1e4a3a[_0x8b44('0x45')]=_0x6d6537[_0x8b44('0x1d')];_0x1e4a3a[_0x8b44('0x1f')]=_0x6d6537[_0x8b44('0x1f')];RpcMemberReport[_0x8b44('0x17')](_0x1e4a3a);}};Report[_0x8b44('0xd')][_0x8b44('0x19')]=function(_0x4c21f5){RpcVoiceTransferReport['transfers'][_0x4c21f5[_0x8b44('0x4f')]]=_0x4c21f5;};Report[_0x8b44('0xd')]['attendedTransfer']=function(_0x2e2b2a){RpcVoiceTransferReport[_0x8b44('0x50')](_0x2e2b2a);};module['exports']=Report; \ No newline at end of file +var _0x1e53=['connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','indexOf','find','mobile','phone','substring','lastIndexOf','blindTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','blindtransfer','attendedTransfer','findAgent','accountcode','name','isNil','interface','SIP/%s','length','connectedlinenum','assigned','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','dialer','lastapplication','queue','lastdata','context','callerid','xcally-motion-preview','calleridpreview','destinationchannel','channel','calleridnum','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','calleridname'];(function(_0x4ae123,_0x3d0910){var _0x4226f2=function(_0x3b8264){while(--_0x3b8264){_0x4ae123['push'](_0x4ae123['shift']());}};_0x4226f2(++_0x3d0910);}(_0x1e53,0x67));var _0x31e5=function(_0x23a2ac,_0x39d9d0){_0x23a2ac=_0x23a2ac-0x0;var _0x28bfb0=_0x1e53[_0x23a2ac];return _0x28bfb0;};'use strict';var _=require(_0x31e5('0x0'));var moment=require(_0x31e5('0x1'));var util=require(_0x31e5('0x2'));var config=require(_0x31e5('0x3'));var ami=require(_0x31e5('0x4'));var RpcVoiceAgentReport=require(_0x31e5('0x5'));var RpcVoiceCallReport=require(_0x31e5('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x31e5('0x7'));var RpcVoiceRecording=require(_0x31e5('0x8'));var RpcVoiceTransferReport=require(_0x31e5('0x9'));var VoiceQueueReport=require(_0x31e5('0xa'));var VoiceCallReport=require(_0x31e5('0xb'));var VoiceAgentReport=require(_0x31e5('0xc'));var VoiceDialReport=require(_0x31e5('0xd'));var UserReport=require(_0x31e5('0xe'));function Report(_0x109e9a){this['realtime']=_0x109e9a;this['agents']=_0x109e9a[_0x31e5('0xf')];this['telephones']=_0x109e9a[_0x31e5('0x10')];}Report[_0x31e5('0x11')]['sync']=function(_0x47b50a){var _0x1f8e4b=new VoiceQueueReport(this['realtime']);var _0x1c52b6=new VoiceAgentReport(this[_0x31e5('0x12')]);var _0x227df4=new VoiceDialReport(this[_0x31e5('0x12')]);var _0x50e809=new VoiceCallReport(this['realtime']);var _0x5dcecc=new UserReport(this[_0x31e5('0x12')]);if(config['xdr']&&config[_0x31e5('0x13')][_0x31e5('0x14')]){ami['on']('custom:voiceQueueReport',this[_0x31e5('0x15')][_0x31e5('0x16')](this));ami['on'](_0x31e5('0x17'),this[_0x31e5('0x18')][_0x31e5('0x16')](this));ami['on'](_0x31e5('0x19'),this[_0x31e5('0x1a')]['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x31e5('0x16')](this));ami['on'](_0x31e5('0x1b'),this['blindTransfer'][_0x31e5('0x16')](this));ami['on']('attendedtransfer',this[_0x31e5('0x1c')][_0x31e5('0x16')](this));}};Report[_0x31e5('0x11')][_0x31e5('0x1d')]=function(_0x232094){var _0x2b92ed;_0x2b92ed=_['find'](this['agents'],function(_0x5bc9a5){return _0x5bc9a5[_0x31e5('0x1e')]==_0x232094||_0x5bc9a5[_0x31e5('0x1f')]==_0x232094;});if(_[_0x31e5('0x20')](_0x2b92ed)){var _0x16d5be=_['find'](this['telephones'],function(_0xde4af3){return _0xde4af3[_0x31e5('0x1e')]==_0x232094||_0xde4af3[_0x31e5('0x1f')]==_0x232094;});if(_0x16d5be){_0x2b92ed=_['find'](this[_0x31e5('0xf')],function(_0x3a5ef6){return _0x3a5ef6[_0x31e5('0x21')]==util['format'](_0x31e5('0x22'),_0x16d5be[_0x31e5('0x1f')]);});}}return _0x2b92ed;};Report[_0x31e5('0x11')]['voiceQueueReport']=function(_0x3773e6){for(var _0x38455d=0x0;_0x38455d<_0x3773e6[_0x31e5('0x23')];_0x38455d+=0x1){var _0xb65b54=this[_0x31e5('0x1d')](_0x3773e6[_0x38455d][_0x31e5('0x24')]);if(_0xb65b54){_0x3773e6[_0x38455d][_0x31e5('0x1e')]=_0xb65b54[_0x31e5('0x1e')];_0x3773e6[_0x38455d][_0x31e5('0x25')]=!![];_0x3773e6[_0x38455d]['lastAssignedTo']=_0xb65b54[_0x31e5('0x1f')];_0x3773e6[_0x38455d]['interface']=_[_0x31e5('0x20')](_0xb65b54[_0x31e5('0x21')])?util[_0x31e5('0x26')](_0x31e5('0x22'),_0xb65b54['name']):_0xb65b54['interface'];if(_0x3773e6[_0x38455d][_0x31e5('0x27')]){_0x3773e6[_0x38455d]['queuecallercompleteAt']=moment()[_0x31e5('0x26')](_0x31e5('0x28'));}if(_0x3773e6[_0x38455d][_0x31e5('0x29')]){_0x3773e6[_0x38455d][_0x31e5('0x2a')]=moment()[_0x31e5('0x26')](_0x31e5('0x28'));}RpcMemberReport[_0x31e5('0x15')](_0x3773e6[_0x38455d]);}RpcVoiceQueueReport[_0x31e5('0x2b')](_0x3773e6[_0x38455d]);}};function extractCalleridNumber(_0x35109f){var _0x5b766b=_0x35109f[_0x31e5('0x2c')](/<(.*?)>/);return _0x5b766b?_0x5b766b[0x1]:_0x35109f;}Report[_0x31e5('0x11')]['voiceCallReport']=function(_0x2cc30b){_0x2cc30b[_0x31e5('0x2d')]=_0x2cc30b[_0x31e5('0x2d')]||_0x2cc30b[_0x31e5('0x2e')];if(_0x2cc30b['type']==_0x31e5('0x2f')){_0x2cc30b[_0x31e5('0x30')]=_0x31e5('0x31');_0x2cc30b[_0x31e5('0x32')]=_0x2cc30b['queue'];if(_0x2cc30b[_0x31e5('0x33')]=='from-voip-provider'){_0x2cc30b['accountcode']='';_0x2cc30b[_0x31e5('0x2d')]=extractCalleridNumber(_0x2cc30b[_0x31e5('0x34')]);}else if(_0x2cc30b[_0x31e5('0x33')]=='from-sip'){if(_0x2cc30b[_0x31e5('0x2d')]==_0x31e5('0x35')){_0x2cc30b['destination']=extractCalleridNumber(_0x2cc30b[_0x31e5('0x36')]);_0x2cc30b['calleridnum']=_0x2cc30b['originatecalleridnum'];_0x2cc30b[_0x31e5('0x37')]=[_0x2cc30b[_0x31e5('0x38')],_0x2cc30b[_0x31e5('0x38')]=_0x2cc30b[_0x31e5('0x37')]][0x0];_0x2cc30b[_0x31e5('0x34')]=_0x2cc30b[_0x31e5('0x36')];}else{_0x2cc30b[_0x31e5('0x2d')]=_0x2cc30b['calleridnum'];_0x2cc30b[_0x31e5('0x39')]=_0x2cc30b[_0x31e5('0x3a')];if(_0x2cc30b[_0x31e5('0x3b')]=='ANSWERED'){_0x2cc30b[_0x31e5('0x1e')]=_0x2cc30b[_0x31e5('0x24')];}else{_0x2cc30b[_0x31e5('0x1e')]='';}}}}else{_0x2cc30b['callerid']=util[_0x31e5('0x26')](_0x31e5('0x3c'),_0x2cc30b['calleridname'],_0x2cc30b[_0x31e5('0x39')]);}if(RpcVoiceTransferReport[_0x31e5('0x3d')][_0x2cc30b[_0x31e5('0x3e')]]){var _0x1b633c=RpcVoiceTransferReport['transfers'][_0x2cc30b[_0x31e5('0x3e')]];_0x1b633c[_0x31e5('0x3f')]=_0x2cc30b[_0x31e5('0x40')];RpcVoiceTransferReport['blindTransfer'](_0x1b633c);delete RpcVoiceTransferReport[_0x31e5('0x3d')][_0x2cc30b[_0x31e5('0x3e')]];}RpcVoiceCallReport['create'](_0x2cc30b);if(_0x2cc30b[_0x31e5('0x41')]){for(var _0x5e8e0e=0x0;_0x5e8e0e<_0x2cc30b[_0x31e5('0x42')][_0x31e5('0x23')];_0x5e8e0e+=0x1){_0x2cc30b[_0x31e5('0x43')]=_0x2cc30b[_0x31e5('0x42')][_0x5e8e0e][_0x31e5('0x44')];_0x2cc30b[_0x31e5('0x45')]=_0x2cc30b['monitors'][_0x5e8e0e][_0x31e5('0x45')];if(_0x2cc30b[_0x31e5('0x2e')]==_0x31e5('0x35')){_0x2cc30b[_0x31e5('0x39')]=_0x2cc30b['connectedlinenum'];_0x2cc30b[_0x31e5('0x46')]=_0x2cc30b['connectedlinename'];_0x2cc30b[_0x31e5('0x24')]=_0x2cc30b['accountcode'];_0x2cc30b[_0x31e5('0x47')]=_0x2cc30b[_0x31e5('0x48')];_0x2cc30b['exten']=_0x2cc30b[_0x31e5('0x3a')];}else if(_0x2cc30b[_0x31e5('0x2e')]==_0x31e5('0x49')){_0x2cc30b[_0x31e5('0x39')]=_0x2cc30b[_0x31e5('0x2d')];_0x2cc30b[_0x31e5('0x2e')]=_0x2cc30b['originatecalleridnum'];}RpcVoiceRecording['create'](_0x2cc30b);}}};Report['prototype'][_0x31e5('0x1a')]=function(_0x494efe){if(_[_0x31e5('0x4a')](_0x494efe)){_0x494efe[_0x31e5('0x4b')](function(_0x57c6b0){RpcVoiceAgentReport[_0x31e5('0x2b')](_0x57c6b0);});}else{RpcVoiceAgentReport[_0x31e5('0x2b')](_0x494efe);}};Report[_0x31e5('0x11')][_0x31e5('0x4c')]=function(_0x5c5ec6){RpcVoiceDialReport[_0x31e5('0x2b')](_0x5c5ec6);var _0x61bded;var _0xd1ca66;var _0x339fc0=_0x5c5ec6['channel'];if(_[_0x31e5('0x4d')](_0x339fc0,_0x31e5('0x4e'))){_0xd1ca66=_0x339fc0['substring'](_0x339fc0['indexOf']('/')+0x1,_0x339fc0[_0x31e5('0x4f')]('@'));_0x61bded=_[_0x31e5('0x50')](this[_0x31e5('0xf')],function(_0x140c40){return _0x140c40[_0x31e5('0x51')]==_0xd1ca66||_0x140c40[_0x31e5('0x52')]==_0xd1ca66||_0x140c40[_0x31e5('0x1e')]==_0xd1ca66;});}else{_0xd1ca66=_0x339fc0[_0x31e5('0x53')](_0x339fc0[_0x31e5('0x4f')]('/')+0x1,_0x339fc0[_0x31e5('0x54')]('-'));_0x61bded=this[_0x31e5('0x1d')](_0xd1ca66);}if(_0x61bded){_0x5c5ec6[_0x31e5('0x21')]=_['isNil'](_0x61bded[_0x31e5('0x21')])?util['format']('SIP/%s',_0x61bded['name']):_0x61bded[_0x31e5('0x21')];_0x5c5ec6['membername']=_0x61bded[_0x31e5('0x1f')];_0x5c5ec6[_0x31e5('0x1e')]=_0x61bded[_0x31e5('0x1e')];RpcMemberReport[_0x31e5('0x4c')](_0x5c5ec6);}};Report[_0x31e5('0x11')][_0x31e5('0x55')]=function(_0x21e835){RpcVoiceTransferReport[_0x31e5('0x3d')][_0x21e835['transfererlinkedid']]=_0x21e835;};Report['prototype'][_0x31e5('0x1c')]=function(_0x1b83e4){RpcVoiceTransferReport[_0x31e5('0x1c')](_0x1b83e4);};module[_0x31e5('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 0b6f716..c134a92 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 _0xb8f0=['localhost','trunks','agents','registryentry','bind','registry','syncRegistry','syncDeviceState','peerstatus','syncRealtimeShow','then','actionSipShowRegistry','catch','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','error','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','format','telephones','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','startsWith','substring','indexOf','phone','accountcode','updateStatusRealtime','syncPeerStatus','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults'];(function(_0x16f8b2,_0x5dc8f0){var _0x54e831=function(_0x3dc5de){while(--_0x3dc5de){_0x16f8b2['push'](_0x16f8b2['shift']());}};_0x54e831(++_0x5dc8f0);}(_0xb8f0,0x16d));var _0x0b8f=function(_0x21f4d7,_0x5cb65a){_0x21f4d7=_0x21f4d7-0x0;var _0x5ae548=_0xb8f0[_0x21f4d7];return _0x5ae548;};'use strict';var _=require(_0x0b8f('0x0'));var moment=require(_0x0b8f('0x1'));var util=require('util');var Redis=require(_0x0b8f('0x2'));var BPromise=require(_0x0b8f('0x3'));var config=require(_0x0b8f('0x4'));var logger=require(_0x0b8f('0x5'))(_0x0b8f('0x6'));var ami=require(_0x0b8f('0x7'));config[_0x0b8f('0x8')]=_[_0x0b8f('0x9')](config[_0x0b8f('0x8')],{'host':_0x0b8f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0b8f('0x8')]));function UserReport(_0x4d5542){this[_0x0b8f('0xb')]=_0x4d5542['trunks'];this[_0x0b8f('0xc')]=_0x4d5542[_0x0b8f('0xc')];this['telephones']=_0x4d5542['telephones'];ami['on'](_0x0b8f('0xd'),this['syncRegistry'][_0x0b8f('0xe')](this));ami['on'](_0x0b8f('0xf'),this[_0x0b8f('0x10')][_0x0b8f('0xe')](this));ami['on']('devicestatechange',this[_0x0b8f('0x11')][_0x0b8f('0xe')](this));ami['on'](_0x0b8f('0x12'),this['syncPeerStatus'][_0x0b8f('0xe')](this));return this[_0x0b8f('0x13')]();}function showSipRegistrations(){Promise['resolve']()[_0x0b8f('0x14')](ami[_0x0b8f('0x15')]())[_0x0b8f('0x16')](function(_0x51160b){logger['error']('[userReport][sipshowregistry]',util[_0x0b8f('0x17')](_0x51160b,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x0b8f('0x18')]()[_0x0b8f('0x14')](ami[_0x0b8f('0x19')]())[_0x0b8f('0x16')](function(_0x496522){logger['error'](_0x0b8f('0x1a'),util[_0x0b8f('0x17')](_0x496522,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x0b8f('0x18')]()[_0x0b8f('0x14')](ami[_0x0b8f('0x1b')]())['catch'](function(_0x4e3180){logger[_0x0b8f('0x1c')](_0x0b8f('0x1d'),util[_0x0b8f('0x17')](_0x4e3180,{'showHidden':![],'depth':null}));});}UserReport[_0x0b8f('0x1e')][_0x0b8f('0x13')]=function(){setInterval(function(){BPromise[_0x0b8f('0x18')]()[_0x0b8f('0x14')](showSipRegistrations())['then'](listDeviceStates())[_0x0b8f('0x14')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x0b8f('0x1f')]=function(_0x536db0){return _0x536db0!==null&&!_[_0x0b8f('0x20')](_0x536db0);};UserReport[_0x0b8f('0x1e')][_0x0b8f('0x21')]=function(_0x147c2d,_0x31365b,_0x52952d){io['to'](_0x147c2d)[_0x0b8f('0x21')](_0x31365b,_0x52952d);};UserReport[_0x0b8f('0x1e')]['syncRegistry']=function(_0x22332f){try{if(this[_0x0b8f('0x1f')](_0x22332f)){logger[_0x0b8f('0x22')](_0x0b8f('0x23'),_0x22332f[_0x0b8f('0x24')],_0x22332f[_0x0b8f('0x25')]);logger[_0x0b8f('0x26')](_0x0b8f('0x27'),util['inspect'](_0x22332f,{'showHidden':![],'depth':null}));var _0x1c5431=_[_0x0b8f('0x28')](this[_0x0b8f('0xb')],{'registry':_0x22332f[_0x0b8f('0x24')]});if(_0x1c5431){_0x22332f[_0x0b8f('0x29')]=_0x22332f[_0x0b8f('0x25')];_[_0x0b8f('0x2a')](_0x1c5431,_[_0x0b8f('0x2b')](_0x22332f,[_0x0b8f('0x2c'),_0x0b8f('0x2d'),'username',_0x0b8f('0x25')]));logger[_0x0b8f('0x26')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x1c5431,{'showHidden':![],'depth':null}));this[_0x0b8f('0x21')](util['format'](_0x0b8f('0x2e'),_0x1c5431[_0x0b8f('0x2f')]),_0x0b8f('0x30'),_0x1c5431);}}}catch(_0x296a01){logger[_0x0b8f('0x1c')](_0x0b8f('0x27'),util['inspect'](_0x296a01,{'showHidden':![],'depth':null}));}};UserReport[_0x0b8f('0x1e')][_0x0b8f('0x11')]=function(_0x53a497){try{if(this[_0x0b8f('0x1f')](_0x53a497)){logger[_0x0b8f('0x22')](_0x0b8f('0x31'),_0x53a497['device'],_0x53a497[_0x0b8f('0x25')]);logger['debug'](_0x0b8f('0x32'),util[_0x0b8f('0x17')](_0x53a497,{'showHidden':![],'depth':null}));if(this['agents'][_0x53a497[_0x0b8f('0x33')]]){if(!this[_0x0b8f('0xc')][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x34')]||_0x53a497[_0x0b8f('0x25')][_0x0b8f('0x35')]()==_0x0b8f('0x36')){this['agents'][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x34')]=![];if(this[_0x0b8f('0xc')][_0x53a497['device']]['state']!==_0x53a497[_0x0b8f('0x25')][_0x0b8f('0x35')]()){this['agents'][_0x53a497['device']][_0x0b8f('0x37')]=_['toNumber'](moment()[_0x0b8f('0x38')]('x'));}this['agents'][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x25')]=_0x53a497[_0x0b8f('0x25')]['toLowerCase']();this[_0x0b8f('0xc')][_0x53a497[_0x0b8f('0x33')]]['updateStatusRealtime'](_0x53a497);}}else if(this[_0x0b8f('0x39')][_0x53a497[_0x0b8f('0x33')]]){if(this[_0x0b8f('0x39')][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x25')]!==_0x53a497[_0x0b8f('0x25')][_0x0b8f('0x35')]()){this[_0x0b8f('0x39')][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x37')]=_[_0x0b8f('0x3a')](moment()[_0x0b8f('0x38')]('x'));}this['telephones'][_0x53a497[_0x0b8f('0x33')]]['state']=_0x53a497[_0x0b8f('0x25')][_0x0b8f('0x35')]();logger['debug'](_0x0b8f('0x3b'),util['inspect'](this['telephones'][_0x53a497[_0x0b8f('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x0b8f('0x38')]('telephone:%s',this[_0x0b8f('0x39')][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x2f')]),_0x0b8f('0x3c'),this['telephones'][_0x53a497['device']]);}else if(this[_0x0b8f('0xb')][_0x53a497['device']]){if(this[_0x0b8f('0xb')][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x25')]!==_0x53a497[_0x0b8f('0x25')][_0x0b8f('0x35')]()){this['trunks'][_0x53a497[_0x0b8f('0x33')]]['stateTime']=_['toNumber'](moment()[_0x0b8f('0x38')]('x'));}this[_0x0b8f('0xb')][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x25')]=_0x53a497['state'][_0x0b8f('0x35')]();logger[_0x0b8f('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x0b8f('0x17')](this[_0x0b8f('0xb')][_0x53a497[_0x0b8f('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this['trunks'][_0x53a497[_0x0b8f('0x33')]][_0x0b8f('0x2f')]),'trunk:save',this[_0x0b8f('0xb')][_0x53a497[_0x0b8f('0x33')]]);}else if(_[_0x0b8f('0x3d')](_0x53a497['device'],'Local')){var _0x526eb1=_0x53a497['device'];var _0x5d1e36=_0x526eb1[_0x0b8f('0x3e')](_0x526eb1['indexOf']('/')+0x1,_0x526eb1[_0x0b8f('0x3f')]('@'));var _0x4938b5=_[_0x0b8f('0x28')](this[_0x0b8f('0xc')],function(_0xee3729){return _0xee3729['mobile']==_0x5d1e36||_0xee3729[_0x0b8f('0x40')]==_0x5d1e36||_0xee3729[_0x0b8f('0x41')]==_0x5d1e36;});if(_0x4938b5){if(_0x4938b5['state']!==_0x53a497[_0x0b8f('0x25')]['toLowerCase']()){_0x4938b5[_0x0b8f('0x37')]=_[_0x0b8f('0x3a')](moment()[_0x0b8f('0x38')]('x'));}_0x4938b5[_0x0b8f('0x25')]=_0x53a497[_0x0b8f('0x25')]['toLowerCase']();_0x4938b5[_0x0b8f('0x34')]=!![];_0x4938b5[_0x0b8f('0x42')](_0x53a497);}}}}catch(_0x424c4b){logger[_0x0b8f('0x1c')](_0x0b8f('0x32'),util['inspect'](_0x424c4b,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x0b8f('0x43')]=function(_0x4a675d){try{if(this[_0x0b8f('0x1f')](_0x4a675d)&&this[_0x0b8f('0x1f')](_0x4a675d[_0x0b8f('0x12')])){logger[_0x0b8f('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4a675d[_0x0b8f('0x44')],_0x4a675d['address'],_0x4a675d['peerstatus']);logger[_0x0b8f('0x26')](_0x0b8f('0x45'),util[_0x0b8f('0x17')](_0x4a675d,{'showHidden':![],'depth':null}));if(this['agents'][_0x4a675d[_0x0b8f('0x44')]]){if(!this[_0x0b8f('0xc')][_0x4a675d[_0x0b8f('0x44')]]['local']||_0x4a675d[_0x0b8f('0x12')][_0x0b8f('0x35')]()==_0x0b8f('0x46')){this[_0x0b8f('0xc')][_0x4a675d[_0x0b8f('0x44')]][_0x0b8f('0x34')]=![];this[_0x0b8f('0xc')][_0x4a675d[_0x0b8f('0x44')]][_0x0b8f('0x47')]=_0x4a675d[_0x0b8f('0x12')][_0x0b8f('0x35')]();this[_0x0b8f('0xc')][_0x4a675d[_0x0b8f('0x44')]]['address']=_0x4a675d[_0x0b8f('0x48')];this[_0x0b8f('0xc')][_0x4a675d[_0x0b8f('0x44')]][_0x0b8f('0x42')](_0x4a675d);}}else if(this[_0x0b8f('0x39')][_0x4a675d['peer']]){this[_0x0b8f('0x39')][_0x4a675d[_0x0b8f('0x44')]][_0x0b8f('0x47')]=_0x4a675d[_0x0b8f('0x12')][_0x0b8f('0x35')]();this[_0x0b8f('0x39')][_0x4a675d[_0x0b8f('0x44')]][_0x0b8f('0x48')]=_0x4a675d[_0x0b8f('0x48')];logger['debug'](_0x0b8f('0x49'),util[_0x0b8f('0x17')](this[_0x0b8f('0x39')][_0x4a675d['peer']],{'showHidden':![],'depth':null}));this[_0x0b8f('0x21')](util[_0x0b8f('0x38')]('telephone:%s',this[_0x0b8f('0x39')][_0x4a675d['peer']]['name']),_0x0b8f('0x3c'),this['telephones'][_0x4a675d['peer']]);}else if(this[_0x0b8f('0xb')][_0x4a675d[_0x0b8f('0x44')]]){this[_0x0b8f('0xb')][_0x4a675d['peer']][_0x0b8f('0x47')]=_0x4a675d['peerstatus'][_0x0b8f('0x35')]();this['trunks'][_0x4a675d[_0x0b8f('0x44')]][_0x0b8f('0x48')]=_0x4a675d[_0x0b8f('0x48')];logger[_0x0b8f('0x26')](_0x0b8f('0x4a'),util['inspect'](this[_0x0b8f('0xb')][_0x4a675d[_0x0b8f('0x44')]],{'showHidden':![],'depth':null}));this[_0x0b8f('0x21')](util[_0x0b8f('0x38')](_0x0b8f('0x2e'),this[_0x0b8f('0xb')][_0x4a675d[_0x0b8f('0x44')]]['name']),_0x0b8f('0x30'),this[_0x0b8f('0xb')][_0x4a675d[_0x0b8f('0x44')]]);}}}catch(_0x2592b6){logger['error'](_0x0b8f('0x45'),util['inspect'](_0x2592b6,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x1342=['../../../config/logger','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','bind','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','inspect','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','moment','util','ioredis','bluebird','../../../config/environment'];(function(_0x47fa3e,_0x144d19){var _0x45975e=function(_0x1306cc){while(--_0x1306cc){_0x47fa3e['push'](_0x47fa3e['shift']());}};_0x45975e(++_0x144d19);}(_0x1342,0xdf));var _0x2134=function(_0x917a2f,_0x2d7e1e){_0x917a2f=_0x917a2f-0x0;var _0x3d91ec=_0x1342[_0x917a2f];return _0x3d91ec;};'use strict';var _=require('lodash');var moment=require(_0x2134('0x0'));var util=require(_0x2134('0x1'));var Redis=require(_0x2134('0x2'));var BPromise=require(_0x2134('0x3'));var config=require(_0x2134('0x4'));var logger=require(_0x2134('0x5'))('ami');var ami=require(_0x2134('0x6'));config[_0x2134('0x7')]=_[_0x2134('0x8')](config[_0x2134('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2134('0x9'))(new Redis(config['redis']));function UserReport(_0x3276cb){this['trunks']=_0x3276cb[_0x2134('0xa')];this[_0x2134('0xb')]=_0x3276cb[_0x2134('0xb')];this[_0x2134('0xc')]=_0x3276cb[_0x2134('0xc')];ami['on'](_0x2134('0xd'),this[_0x2134('0xe')]['bind'](this));ami['on'](_0x2134('0xf'),this['syncRegistry']['bind'](this));ami['on'](_0x2134('0x10'),this['syncDeviceState'][_0x2134('0x11')](this));ami['on']('peerstatus',this[_0x2134('0x12')][_0x2134('0x11')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x2134('0x13')]()[_0x2134('0x14')](ami[_0x2134('0x15')]())[_0x2134('0x16')](function(_0x30b489){logger[_0x2134('0x17')]('[userReport][sipshowregistry]',util[_0x2134('0x18')](_0x30b489,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x2134('0x14')](ami['actionDeviceStateList']())[_0x2134('0x16')](function(_0x557f55){logger['error'](_0x2134('0x19'),util[_0x2134('0x18')](_0x557f55,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x2134('0x13')]()['then'](ami[_0x2134('0x1a')]())[_0x2134('0x16')](function(_0xce5c6c){logger[_0x2134('0x17')](_0x2134('0x1b'),util[_0x2134('0x18')](_0xce5c6c,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x2134('0x1c')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0x2134('0x14')](listDeviceStates())[_0x2134('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x2134('0x1d')][_0x2134('0x1e')]=function(_0x55d362){return _0x55d362!==null&&!_[_0x2134('0x1f')](_0x55d362);};UserReport[_0x2134('0x1d')][_0x2134('0x20')]=function(_0x33b627,_0x1af6cb,_0x16de0a){io['to'](_0x33b627)[_0x2134('0x20')](_0x1af6cb,_0x16de0a);};UserReport[_0x2134('0x1d')][_0x2134('0xe')]=function(_0x495f81){try{if(this[_0x2134('0x1e')](_0x495f81)){logger[_0x2134('0x21')](_0x2134('0x22'),_0x495f81[_0x2134('0x23')],_0x495f81[_0x2134('0x24')]);logger[_0x2134('0x25')](_0x2134('0x26'),util[_0x2134('0x18')](_0x495f81,{'showHidden':![],'depth':null}));var _0x2912f2=_[_0x2134('0x27')](this['trunks'],{'registry':_0x495f81[_0x2134('0x23')]});if(_0x2912f2){_0x495f81[_0x2134('0x28')]=_0x495f81[_0x2134('0x24')];_[_0x2134('0x29')](_0x2912f2,_['omit'](_0x495f81,[_0x2134('0x2a'),_0x2134('0x2b'),'username',_0x2134('0x24')]));logger[_0x2134('0x25')](_0x2134('0x2c'),util['inspect'](_0x2912f2,{'showHidden':![],'depth':null}));this['emit'](util[_0x2134('0x2d')](_0x2134('0x2e'),_0x2912f2[_0x2134('0x2f')]),_0x2134('0x30'),_0x2912f2);}}}catch(_0x188473){logger['error'](_0x2134('0x26'),util[_0x2134('0x18')](_0x188473,{'showHidden':![],'depth':null}));}};UserReport[_0x2134('0x1d')][_0x2134('0x31')]=function(_0x58b259){try{if(this['isNotNull'](_0x58b259)){logger['info'](_0x2134('0x32'),_0x58b259[_0x2134('0x33')],_0x58b259[_0x2134('0x24')]);logger[_0x2134('0x25')](_0x2134('0x34'),util[_0x2134('0x18')](_0x58b259,{'showHidden':![],'depth':null}));if(this[_0x2134('0xb')][_0x58b259[_0x2134('0x33')]]){if(!this[_0x2134('0xb')][_0x58b259['device']][_0x2134('0x35')]||_0x58b259[_0x2134('0x24')][_0x2134('0x36')]()==_0x2134('0x37')){this[_0x2134('0xb')][_0x58b259['device']]['local']=![];if(this[_0x2134('0xb')][_0x58b259['device']]['state']!==_0x58b259[_0x2134('0x24')]['toLowerCase']()){this[_0x2134('0xb')][_0x58b259[_0x2134('0x33')]][_0x2134('0x38')]=_[_0x2134('0x39')](moment()['format']('x'));}this[_0x2134('0xb')][_0x58b259[_0x2134('0x33')]][_0x2134('0x24')]=_0x58b259[_0x2134('0x24')]['toLowerCase']();this[_0x2134('0xb')][_0x58b259[_0x2134('0x33')]][_0x2134('0x3a')](_0x58b259);}}else if(this[_0x2134('0xc')][_0x58b259['device']]){if(this[_0x2134('0xc')][_0x58b259['device']][_0x2134('0x24')]!==_0x58b259['state'][_0x2134('0x36')]()){this[_0x2134('0xc')][_0x58b259[_0x2134('0x33')]][_0x2134('0x38')]=_[_0x2134('0x39')](moment()[_0x2134('0x2d')]('x'));}this[_0x2134('0xc')][_0x58b259[_0x2134('0x33')]][_0x2134('0x24')]=_0x58b259[_0x2134('0x24')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x58b259[_0x2134('0x33')]],{'showHidden':![],'depth':null}));this[_0x2134('0x20')](util[_0x2134('0x2d')](_0x2134('0x3b'),this[_0x2134('0xc')][_0x58b259[_0x2134('0x33')]][_0x2134('0x2f')]),_0x2134('0x3c'),this[_0x2134('0xc')][_0x58b259[_0x2134('0x33')]]);}else if(this['trunks'][_0x58b259[_0x2134('0x33')]]){if(this['trunks'][_0x58b259['device']][_0x2134('0x24')]!==_0x58b259['state']['toLowerCase']()){this['trunks'][_0x58b259[_0x2134('0x33')]][_0x2134('0x38')]=_[_0x2134('0x39')](moment()[_0x2134('0x2d')]('x'));}this['trunks'][_0x58b259[_0x2134('0x33')]][_0x2134('0x24')]=_0x58b259[_0x2134('0x24')][_0x2134('0x36')]();logger[_0x2134('0x25')](_0x2134('0x3d'),util['inspect'](this[_0x2134('0xa')][_0x58b259[_0x2134('0x33')]],{'showHidden':![],'depth':null}));this[_0x2134('0x20')](util[_0x2134('0x2d')](_0x2134('0x2e'),this[_0x2134('0xa')][_0x58b259[_0x2134('0x33')]][_0x2134('0x2f')]),_0x2134('0x30'),this[_0x2134('0xa')][_0x58b259[_0x2134('0x33')]]);}else if(_[_0x2134('0x3e')](_0x58b259[_0x2134('0x33')],_0x2134('0x3f'))){var _0x2d0d26=_0x58b259[_0x2134('0x33')];var _0x61001f=_0x2d0d26['substring'](_0x2d0d26[_0x2134('0x40')]('/')+0x1,_0x2d0d26[_0x2134('0x40')]('@'));var _0x5329ee=_['find'](this[_0x2134('0xb')],function(_0x563353){return _0x563353['mobile']==_0x61001f||_0x563353['phone']==_0x61001f||_0x563353[_0x2134('0x41')]==_0x61001f;});if(_0x5329ee){if(_0x5329ee['state']!==_0x58b259[_0x2134('0x24')][_0x2134('0x36')]()){_0x5329ee[_0x2134('0x38')]=_['toNumber'](moment()[_0x2134('0x2d')]('x'));}_0x5329ee[_0x2134('0x24')]=_0x58b259[_0x2134('0x24')][_0x2134('0x36')]();_0x5329ee['local']=!![];_0x5329ee[_0x2134('0x3a')](_0x58b259);}}}}catch(_0x1238a9){logger['error'](_0x2134('0x34'),util[_0x2134('0x18')](_0x1238a9,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2134('0x12')]=function(_0x45e012){try{if(this[_0x2134('0x1e')](_0x45e012)&&this[_0x2134('0x1e')](_0x45e012[_0x2134('0x42')])){logger[_0x2134('0x21')](_0x2134('0x43'),_0x45e012[_0x2134('0x44')],_0x45e012[_0x2134('0x45')],_0x45e012[_0x2134('0x42')]);logger['debug']('[userReport][peerstatus]',util[_0x2134('0x18')](_0x45e012,{'showHidden':![],'depth':null}));if(this[_0x2134('0xb')][_0x45e012[_0x2134('0x44')]]){if(!this[_0x2134('0xb')][_0x45e012[_0x2134('0x44')]][_0x2134('0x35')]||_0x45e012[_0x2134('0x42')][_0x2134('0x36')]()==_0x2134('0x46')){this[_0x2134('0xb')][_0x45e012['peer']]['local']=![];this[_0x2134('0xb')][_0x45e012[_0x2134('0x44')]][_0x2134('0x47')]=_0x45e012['peerstatus'][_0x2134('0x36')]();this[_0x2134('0xb')][_0x45e012[_0x2134('0x44')]]['address']=_0x45e012[_0x2134('0x45')];this[_0x2134('0xb')][_0x45e012[_0x2134('0x44')]][_0x2134('0x3a')](_0x45e012);}}else if(this[_0x2134('0xc')][_0x45e012[_0x2134('0x44')]]){this[_0x2134('0xc')][_0x45e012[_0x2134('0x44')]][_0x2134('0x47')]=_0x45e012['peerstatus'][_0x2134('0x36')]();this[_0x2134('0xc')][_0x45e012[_0x2134('0x44')]][_0x2134('0x45')]=_0x45e012[_0x2134('0x45')];logger[_0x2134('0x25')](_0x2134('0x48'),util[_0x2134('0x18')](this[_0x2134('0xc')][_0x45e012[_0x2134('0x44')]],{'showHidden':![],'depth':null}));this[_0x2134('0x20')](util['format'](_0x2134('0x3b'),this['telephones'][_0x45e012[_0x2134('0x44')]][_0x2134('0x2f')]),_0x2134('0x3c'),this[_0x2134('0xc')][_0x45e012[_0x2134('0x44')]]);}else if(this[_0x2134('0xa')][_0x45e012['peer']]){this[_0x2134('0xa')][_0x45e012[_0x2134('0x44')]]['status']=_0x45e012['peerstatus'][_0x2134('0x36')]();this[_0x2134('0xa')][_0x45e012['peer']]['address']=_0x45e012[_0x2134('0x45')];logger[_0x2134('0x25')](_0x2134('0x49'),util[_0x2134('0x18')](this['trunks'][_0x45e012[_0x2134('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x2134('0x2d')](_0x2134('0x2e'),this['trunks'][_0x45e012['peer']][_0x2134('0x2f')]),'trunk:save',this[_0x2134('0xa')][_0x45e012[_0x2134('0x44')]]);}}}catch(_0x3db187){logger['error'](_0x2134('0x4a'),util[_0x2134('0x18')](_0x3db187,{'showHidden':![],'depth':null}));}};module[_0x2134('0x4b')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9412ebd..5f22d8d 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 _0x8c2c=['moment','util','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','membername','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]'];(function(_0x216008,_0x2d1023){var _0x4d384f=function(_0x3fd7e2){while(--_0x3fd7e2){_0x216008['push'](_0x216008['shift']());}};_0x4d384f(++_0x2d1023);}(_0x8c2c,0x94));var _0xc8c2=function(_0x32e8ed,_0x5d669c){_0x32e8ed=_0x32e8ed-0x0;var _0x10c84b=_0x8c2c[_0x32e8ed];return _0x10c84b;};'use strict';var _=require('lodash');var moment=require(_0xc8c2('0x0'));var util=require(_0xc8c2('0x1'));var Redis=require(_0xc8c2('0x2'));var config=require('../../../config/environment');var logger=require(_0xc8c2('0x3'))('ami');var ami=require('../ami');config[_0xc8c2('0x4')]=_[_0xc8c2('0x5')](config[_0xc8c2('0x4')],{'host':_0xc8c2('0x6'),'port':0x18eb});var io=require(_0xc8c2('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x19110d){this[_0xc8c2('0x8')]={};this['voiceQueues']=_0x19110d[_0xc8c2('0x9')];this[_0xc8c2('0xa')]=_0x19110d[_0xc8c2('0xa')];this[_0xc8c2('0xb')]={};ami['on']('agentcalled',this[_0xc8c2('0xc')][_0xc8c2('0xd')](this));ami['on'](_0xc8c2('0xe'),this[_0xc8c2('0xf')][_0xc8c2('0xd')](this));ami['on']('agentringnoanswer',this[_0xc8c2('0x10')][_0xc8c2('0xd')](this));ami['on']('queuecallerabandon',this[_0xc8c2('0x11')][_0xc8c2('0xd')](this));ami['on'](_0xc8c2('0x12'),this[_0xc8c2('0x13')][_0xc8c2('0xd')](this));ami['on'](_0xc8c2('0x14'),this[_0xc8c2('0x15')]['bind'](this));ami['on'](_0xc8c2('0x16'),this[_0xc8c2('0x17')]['bind'](this));ami['on'](_0xc8c2('0x18'),this[_0xc8c2('0x19')]['bind'](this));ami['on'](_0xc8c2('0x1a'),this[_0xc8c2('0x1b')][_0xc8c2('0xd')](this));ami['on'](_0xc8c2('0x1c'),this[_0xc8c2('0x1d')][_0xc8c2('0xd')](this));ami['on'](_0xc8c2('0x1e'),this[_0xc8c2('0x1f')][_0xc8c2('0xd')](this));}VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x21')]=function(_0x115a64,_0x43e255,_0xfb9706){io['to'](_0x115a64)['emit'](_0x43e255,_0xfb9706);};VoiceAgentReport[_0xc8c2('0x20')]['isNotNull']=function(_0x57250b){return _0x57250b!==null&&!_[_0xc8c2('0x22')](_0x57250b);};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0xc')]=function(_0x203aff){try{if(this[_0xc8c2('0x23')](_0x203aff)){logger[_0xc8c2('0x24')](_0xc8c2('0x25'),_0x203aff[_0xc8c2('0x26')],_0x203aff['membername'],_0x203aff[_0xc8c2('0x27')]);logger[_0xc8c2('0x28')](_0xc8c2('0x29'),_0x203aff[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x203aff,{'showHidden':![],'depth':null}));if(_[_0xc8c2('0x22')](this[_0xc8c2('0x8')][_0x203aff[_0xc8c2('0x26')]])){this['channels'][_0x203aff[_0xc8c2('0x26')]]={};}if(_['isUndefined'](this['channels'][_0x203aff['uniqueid']][_0x203aff['destuniqueid']])){this[_0xc8c2('0x8')][_0x203aff[_0xc8c2('0x26')]][_0x203aff[_0xc8c2('0x27')]]={'agentcalledAt':moment()[_0xc8c2('0x2b')](_0xc8c2('0x2c')),'lastevent':_0xc8c2('0x2d'),'mandatoryDisposition':this[_0xc8c2('0x9')][_0x203aff[_0xc8c2('0x2e')]]?this['voiceQueues'][_0x203aff['queue']]['mandatoryDisposition']||![]:![],'type':this[_0xc8c2('0x9')][_0x203aff[_0xc8c2('0x2e')]]?this[_0xc8c2('0x9')][_0x203aff['queue']][_0xc8c2('0x2f')]||_0xc8c2('0x30'):_0xc8c2('0x30'),'variables':this[_0xc8c2('0xb')][_0x203aff[_0xc8c2('0x26')]]};}_[_0xc8c2('0x31')](this[_0xc8c2('0x8')][_0x203aff[_0xc8c2('0x26')]][_0x203aff[_0xc8c2('0x27')]],_[_0xc8c2('0x32')](_0x203aff,[_0xc8c2('0x33'),_0xc8c2('0x34')]));logger[_0xc8c2('0x28')](_0xc8c2('0x35'),_0x203aff[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this['channels'][_0x203aff[_0xc8c2('0x26')]][_0x203aff[_0xc8c2('0x27')]],{'showHidden':![],'depth':null}));ami[_0xc8c2('0x21')](_0xc8c2('0x36'),this[_0xc8c2('0x8')][_0x203aff[_0xc8c2('0x26')]][_0x203aff[_0xc8c2('0x27')]]);logger[_0xc8c2('0x28')](_0xc8c2('0x37'),_0x203aff[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this[_0xc8c2('0x8')][_0x203aff[_0xc8c2('0x26')]][_0x203aff[_0xc8c2('0x27')]],{'showHidden':![],'depth':null}));this[_0xc8c2('0x21')](util[_0xc8c2('0x2b')](_0xc8c2('0x38'),_0x203aff['membername']),_0xc8c2('0x39'),this[_0xc8c2('0x8')][_0x203aff[_0xc8c2('0x26')]][_0x203aff[_0xc8c2('0x27')]]);}}catch(_0x27a1c0){logger[_0xc8c2('0x3a')](_0xc8c2('0x3b'),_0x203aff[_0xc8c2('0x26')],util['inspect'](_0x27a1c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')]['syncAgentConnect']=function(_0xdab49e){try{if(this[_0xc8c2('0x23')](_0xdab49e)){if(this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]]){logger[_0xc8c2('0x28')](_0xc8c2('0x3c'),_0xdab49e[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0xdab49e,{'showHidden':![],'depth':null}));for(var _0x26a2bc in this[_0xc8c2('0x8')][_0xdab49e['uniqueid']]){if(this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0xc8c2('0x3d')](_0x26a2bc)){if(_0xdab49e[_0xc8c2('0x27')]===_0x26a2bc){logger[_0xc8c2('0x24')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0xdab49e[_0xc8c2('0x26')],_0xdab49e[_0xc8c2('0x3e')],_0xdab49e[_0xc8c2('0x27')]);this['channels'][_0xdab49e['uniqueid']][_0x26a2bc][_0xc8c2('0x3f')]=moment()[_0xc8c2('0x2b')](_0xc8c2('0x2c'));this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x40')]=_0xdab49e['connectedlinename'];this['channels'][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x41')]=_0xdab49e[_0xc8c2('0x41')];this['channels'][_0xdab49e['uniqueid']][_0x26a2bc][_0xc8c2('0x42')]=_0xdab49e[_0xc8c2('0x42')];this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x43')]=_0xdab49e[_0xc8c2('0x43')];this['channels'][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc]['holdtime']=_0xdab49e[_0xc8c2('0x44')];this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x45')]=_0xc8c2('0x46');_[_0xc8c2('0x31')](this[_0xc8c2('0xa')][_0xdab49e[_0xc8c2('0x47')]],_[_0xc8c2('0x48')](_0xdab49e,[_0xc8c2('0x2e'),_0xc8c2('0x49')]));logger[_0xc8c2('0x28')](_0xc8c2('0x4a'),_0xdab49e[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0xdab49e[_0xc8c2('0x27')]],{'showHidden':![],'depth':null}));ami[_0xc8c2('0x21')]('custom:agentconnect',this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0xdab49e[_0xc8c2('0x27')]]);logger[_0xc8c2('0x28')](_0xc8c2('0x4b'),_0xdab49e[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0xdab49e[_0xc8c2('0x27')]],{'showHidden':![],'depth':null}));this[_0xc8c2('0x21')](util[_0xc8c2('0x2b')]('user:%s',_0xdab49e['membername']),_0xc8c2('0x4c'),this[_0xc8c2('0x8')][_0xdab49e['uniqueid']][_0xdab49e[_0xc8c2('0x27')]]);}else if(!this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x4d')]&&!this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x12')]){logger[_0xc8c2('0x24')](_0xc8c2('0x4e'),_0xdab49e['uniqueid'],this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc]['membername'],_0x26a2bc);this['channels'][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x4d')]=!![];this[_0xc8c2('0x8')][_0xdab49e['uniqueid']][_0x26a2bc][_0xc8c2('0x4f')]=moment()['format'](_0xc8c2('0x2c'));this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc]['answeredelsewheredestinationuniqueid']=_0xdab49e[_0xc8c2('0x27')];this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc]['answeredelsewheremembername']=_0xdab49e[_0xc8c2('0x3e')];this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x45')]='answered_elsewhere';this['channels'][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc][_0xc8c2('0x50')]=_0xc8c2('0x51');logger[_0xc8c2('0x28')](_0xc8c2('0x52'),_0xdab49e[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc],{'showHidden':![],'depth':null}));ami[_0xc8c2('0x21')](_0xc8c2('0x53'),this[_0xc8c2('0x8')][_0xdab49e[_0xc8c2('0x26')]][_0x26a2bc]);}}}}}}catch(_0x26203a){logger['error']('[%s][voiceAgentReport][agentconnect]',_0xdab49e[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x26203a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x10')]=function(_0x234c8b){try{if(this[_0xc8c2('0x23')](_0x234c8b)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x234c8b[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x234c8b,{'showHidden':![],'depth':null}));if(this[_0xc8c2('0x8')][_0x234c8b[_0xc8c2('0x26')]]&&this[_0xc8c2('0x8')][_0x234c8b['uniqueid']][_0x234c8b[_0xc8c2('0x27')]]){logger['info'](_0xc8c2('0x54'),_0x234c8b[_0xc8c2('0x26')],_0x234c8b[_0xc8c2('0x3e')],_0x234c8b['destuniqueid']);this[_0xc8c2('0x8')][_0x234c8b[_0xc8c2('0x26')]][_0x234c8b[_0xc8c2('0x27')]][_0xc8c2('0x4d')]=!![];this[_0xc8c2('0x8')][_0x234c8b[_0xc8c2('0x26')]][_0x234c8b['destuniqueid']][_0xc8c2('0x4f')]=moment()[_0xc8c2('0x2b')](_0xc8c2('0x2c'));this['channels'][_0x234c8b[_0xc8c2('0x26')]][_0x234c8b['destuniqueid']][_0xc8c2('0x45')]=_0xc8c2('0x55');this[_0xc8c2('0x8')][_0x234c8b[_0xc8c2('0x26')]][_0x234c8b[_0xc8c2('0x27')]]['reason']=_0xc8c2('0x55');logger[_0xc8c2('0x28')](_0xc8c2('0x56'),_0x234c8b['uniqueid'],util['inspect'](this[_0xc8c2('0x8')][_0x234c8b[_0xc8c2('0x26')]][_0x234c8b[_0xc8c2('0x27')]],{'showHidden':![],'depth':null}));ami[_0xc8c2('0x21')](_0xc8c2('0x57'),this['channels'][_0x234c8b[_0xc8c2('0x26')]][_0x234c8b[_0xc8c2('0x27')]]);}}}catch(_0xaaf23e){logger[_0xc8c2('0x3a')](_0xc8c2('0x58'),_0x234c8b[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0xaaf23e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x11')]=function(_0x5a2310){try{if(this['isNotNull'](_0x5a2310)){logger[_0xc8c2('0x28')](_0xc8c2('0x59'),_0x5a2310[_0xc8c2('0x26')],util['inspect'](_0x5a2310,{'showHidden':![],'depth':null}));if(this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]]){for(var _0x51412c in this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]]){if(this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]]['hasOwnProperty'](_0x51412c)&&!this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c][_0xc8c2('0x4d')]&&!this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c][_0xc8c2('0x12')]){logger[_0xc8c2('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x5a2310[_0xc8c2('0x26')],this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c][_0xc8c2('0x3e')],_0x51412c);this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c]['agentringnoanswer']=!![];this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c][_0xc8c2('0x4f')]=moment()[_0xc8c2('0x2b')](_0xc8c2('0x2c'));this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c][_0xc8c2('0x45')]=_0xc8c2('0x5a');this[_0xc8c2('0x8')][_0x5a2310[_0xc8c2('0x26')]][_0x51412c][_0xc8c2('0x50')]=_0xc8c2('0x5a');logger['debug'](_0xc8c2('0x5b'),_0x5a2310[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this[_0xc8c2('0x8')][_0x5a2310['uniqueid']][_0x51412c],{'showHidden':![],'depth':null}));ami[_0xc8c2('0x21')]('custom:agentqueuecallerabandon',this['channels'][_0x5a2310[_0xc8c2('0x26')]][_0x51412c]);}}}}}catch(_0x167ce0){logger[_0xc8c2('0x3a')](_0xc8c2('0x5c'),_0x5a2310[_0xc8c2('0x26')],util['inspect'](_0x167ce0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x13')]=function(_0x5d6cfb){try{if(this[_0xc8c2('0x23')](_0x5d6cfb)){logger[_0xc8c2('0x28')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x5d6cfb[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x5d6cfb,{'showHidden':![],'depth':null}));if(this[_0xc8c2('0x8')][_0x5d6cfb[_0xc8c2('0x26')]]){for(var _0x1ff1a3 in this['channels'][_0x5d6cfb['uniqueid']]){if(this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0xc8c2('0x3d')](_0x1ff1a3)){if(this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3][_0xc8c2('0x3f')]&&!this[_0xc8c2('0x8')][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3][_0xc8c2('0x12')]){logger[_0xc8c2('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5d6cfb[_0xc8c2('0x26')],this[_0xc8c2('0x8')][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3][_0xc8c2('0x3e')],_0x1ff1a3);this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3][_0xc8c2('0x12')]=!![];this['channels'][_0x5d6cfb['uniqueid']][_0x1ff1a3]['agentcompleteAt']=moment()['format'](_0xc8c2('0x2c'));this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3]['lastevent']='complete';this[_0xc8c2('0x8')][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3][_0xc8c2('0x50')]=_0x5d6cfb['reason']==_0xc8c2('0x5d')?_0xc8c2('0x5e'):_0x5d6cfb[_0xc8c2('0x50')];this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3]['talktime']=_0x5d6cfb[_0xc8c2('0x5f')];if(this['voiceQueues'][_0x5d6cfb[_0xc8c2('0x2e')]]&&this[_0xc8c2('0x9')][_0x5d6cfb['queue']][_0xc8c2('0x60')]){this[_0xc8c2('0x8')][_0x5d6cfb['uniqueid']][_0x1ff1a3][_0xc8c2('0x61')]=this[_0xc8c2('0x9')][_0x5d6cfb[_0xc8c2('0x2e')]][_0xc8c2('0x62')];this['channels'][_0x5d6cfb['uniqueid']][_0x1ff1a3][_0xc8c2('0x63')]=!![];}this[_0xc8c2('0xa')][_0x5d6cfb[_0xc8c2('0x47')]]=_['omit'](this[_0xc8c2('0xa')][_0x5d6cfb[_0xc8c2('0x47')]],[_0xc8c2('0x2e'),_0xc8c2('0x49')]);logger[_0xc8c2('0x28')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x5d6cfb[_0xc8c2('0x26')],util['inspect'](this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0xc8c2('0x8')][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3]);logger[_0xc8c2('0x28')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x5d6cfb[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](this['channels'][_0x5d6cfb[_0xc8c2('0x26')]][_0x1ff1a3],{'showHidden':![],'depth':null}));this[_0xc8c2('0x21')](util[_0xc8c2('0x2b')](_0xc8c2('0x38'),_0x5d6cfb[_0xc8c2('0x3e')]),'user:agentcomplete',this[_0xc8c2('0x8')][_0x5d6cfb['uniqueid']][_0x1ff1a3]);}}}}}}catch(_0x3e9021){logger[_0xc8c2('0x3a')]('[%s][voiceAgentReport][agentcomplete]',_0x5d6cfb['uniqueid'],util[_0xc8c2('0x2a')](_0x3e9021,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x15')]=function(_0x390f74){try{if(this[_0xc8c2('0x23')](_0x390f74)){logger[_0xc8c2('0x28')]('[%s][voiceAgentReport][varset]\x20event:',_0x390f74[_0xc8c2('0x26')],util['inspect'](_0x390f74,{'showHidden':![],'depth':null}));this[_0xc8c2('0x64')](_0x390f74[_0xc8c2('0x26')],_[_0xc8c2('0x65')](_0x390f74[_0xc8c2('0x66')])[0x0],_0x390f74[_0xc8c2('0x67')]);if(this[_0xc8c2('0x8')][_0x390f74['uniqueid']]){for(var _0x29f165 in this[_0xc8c2('0x8')][_0x390f74[_0xc8c2('0x26')]]){if(this[_0xc8c2('0x8')][_0x390f74[_0xc8c2('0x26')]]['hasOwnProperty'](_0x29f165)){logger[_0xc8c2('0x24')](_0xc8c2('0x68'),_0x390f74[_0xc8c2('0x26')],_0x29f165,_['keys'](_0x390f74['variable'])[0x0],_0x390f74[_0xc8c2('0x67')]);if(_[_0xc8c2('0x22')](this[_0xc8c2('0x8')][_0x390f74[_0xc8c2('0x26')]][_0x29f165][_0xc8c2('0xb')])){this[_0xc8c2('0x8')][_0x390f74['uniqueid']][_0x29f165]['variables']={};}this[_0xc8c2('0x8')][_0x390f74[_0xc8c2('0x26')]][_0x29f165][_0xc8c2('0xb')]=this['variables'][_0x390f74[_0xc8c2('0x26')]];}}}}}catch(_0x299c22){logger[_0xc8c2('0x3a')](_0xc8c2('0x69'),_0x390f74[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x299c22,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x64')]=function(_0x1cbb14,_0x223cd1,_0x5839d7){var _0x746f28=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0xc8c2('0x6a'),_0xc8c2('0x6b'),_0xc8c2('0x6c'),_0xc8c2('0x6d'),_0xc8c2('0x6e'),_0xc8c2('0x6f'),'sipuri',_0xc8c2('0x70'),_0xc8c2('0x71'),_0xc8c2('0x72'),_0xc8c2('0x73'),_0xc8c2('0x74'),_0xc8c2('0x75'),'membername','memberpenalty',_0xc8c2('0x76')];if(!_[_0xc8c2('0x77')](_0x223cd1)&&!_[_0xc8c2('0x78')](_0x746f28,_0x223cd1)){if(_[_0xc8c2('0x22')](this[_0xc8c2('0xb')][_0x1cbb14])){this[_0xc8c2('0xb')][_0x1cbb14]={};}this['variables'][_0x1cbb14][_0x223cd1]=_0x5839d7;}};VoiceAgentReport[_0xc8c2('0x20')]['syncHangup']=function(_0x1afe98){try{if(this[_0xc8c2('0x23')](_0x1afe98)){logger[_0xc8c2('0x28')](_0xc8c2('0x79'),_0x1afe98[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x1afe98,{'showHidden':![],'depth':null}));if(this[_0xc8c2('0x8')][_0x1afe98['uniqueid']]){for(var _0x4699df in this[_0xc8c2('0x8')][_0x1afe98['uniqueid']]){if(this['channels'][_0x1afe98[_0xc8c2('0x26')]][_0xc8c2('0x3d')](_0x4699df)){if(this['channels'][_0x1afe98[_0xc8c2('0x26')]][_0x4699df][_0xc8c2('0x50')]==_0xc8c2('0x5d')&&this[_0xc8c2('0x8')][_0x1afe98[_0xc8c2('0x26')]][_0x4699df]['agentcomplete']){logger[_0xc8c2('0x24')](_0xc8c2('0x7a'),_0x1afe98[_0xc8c2('0x26')],_0x4699df);this[_0xc8c2('0x8')][_0x1afe98[_0xc8c2('0x26')]][_0x4699df]['agentcompleteAt']=moment()[_0xc8c2('0x2b')](_0xc8c2('0x2c'));}}}logger[_0xc8c2('0x28')](_0xc8c2('0x7b'),_0x1afe98[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_[_0xc8c2('0x7c')](this[_0xc8c2('0x8')][_0x1afe98['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xc8c2('0x21')]('custom:voiceAgentReport',_['values'](this['channels'][_0x1afe98[_0xc8c2('0x26')]]));delete this[_0xc8c2('0x8')][_0x1afe98[_0xc8c2('0x26')]];}if(this[_0xc8c2('0xb')][_0x1afe98[_0xc8c2('0x26')]]){delete this['variables'][_0x1afe98[_0xc8c2('0x26')]];}}}catch(_0x5a8335){logger[_0xc8c2('0x3a')](_0xc8c2('0x7d'),_0x1afe98[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x5a8335,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x1d')]=function(_0x2962ca){try{if(this['isNotNull'](_0x2962ca)){logger[_0xc8c2('0x28')](_0xc8c2('0x7e'),_0x2962ca['uniqueid'],util[_0xc8c2('0x2a')](_0x2962ca,{'showHidden':![],'depth':null}));if(this[_0xc8c2('0x8')][_0x2962ca['transfereeuniqueid']]){for(var _0x3033c2 in this['channels'][_0x2962ca[_0xc8c2('0x7f')]]){if(this[_0xc8c2('0x8')][_0x2962ca['transfereeuniqueid']]['hasOwnProperty'](_0x3033c2)){if(_0x2962ca[_0xc8c2('0x80')]===_0x3033c2){logger[_0xc8c2('0x24')](_0xc8c2('0x81'),_0x2962ca[_0xc8c2('0x26')],this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x7f')]][_0x3033c2][_0xc8c2('0x3e')],_0x3033c2);var _0x17ad29=moment();this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x7f')]][_0x3033c2][_0xc8c2('0x12')]=!![];this['channels'][_0x2962ca[_0xc8c2('0x7f')]][_0x3033c2][_0xc8c2('0x82')]=moment()[_0xc8c2('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc8c2('0x8')][_0x2962ca['transfereeuniqueid']][_0x3033c2][_0xc8c2('0x45')]=_0xc8c2('0x83');this['channels'][_0x2962ca[_0xc8c2('0x7f')]][_0x3033c2][_0xc8c2('0x50')]=_0xc8c2('0x5d');this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x7f')]][_0x3033c2][_0xc8c2('0x5f')]=_0x17ad29[_0xc8c2('0x84')](this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x7f')]][_0x3033c2][_0xc8c2('0x3f')],_0xc8c2('0x85'));}}}}if(this['channels'][_0x2962ca[_0xc8c2('0x86')]]){var _0x4d63ed=this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x86')]];this['channels'][_0x2962ca['secondtransfereruniqueid']]=this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x7f')]];this[_0xc8c2('0x8')][_0x2962ca[_0xc8c2('0x7f')]]=_0x4d63ed;}}}catch(_0x189ebc){logger[_0xc8c2('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0x2962ca[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x189ebc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x1f')]=function(_0x36d25e){try{if(this[_0xc8c2('0x23')](_0x36d25e)){logger['debug'](_0xc8c2('0x87'),_0x36d25e[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x36d25e,{'showHidden':![],'depth':null}));if(this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]]){for(var _0x2ff7fb in this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]]){if(this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]]['hasOwnProperty'](_0x2ff7fb)){if(_0x36d25e[_0xc8c2('0x88')]===_0x2ff7fb){logger[_0xc8c2('0x24')](_0xc8c2('0x89'),_0x36d25e[_0xc8c2('0x26')],this[_0xc8c2('0x8')][_0x36d25e['transfereeuniqueid']][_0x2ff7fb][_0xc8c2('0x3e')],_0x2ff7fb);var _0x30c7f7=moment();this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]][_0x2ff7fb][_0xc8c2('0x12')]=!![];this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]][_0x2ff7fb][_0xc8c2('0x82')]=_0x30c7f7;this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]][_0x2ff7fb]['lastevent']=_0xc8c2('0x83');this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]][_0x2ff7fb][_0xc8c2('0x50')]='transfer';this['channels'][_0x36d25e[_0xc8c2('0x7f')]][_0x2ff7fb][_0xc8c2('0x5f')]=_0x30c7f7[_0xc8c2('0x84')](this[_0xc8c2('0x8')][_0x36d25e[_0xc8c2('0x7f')]][_0x2ff7fb]['agentconnectAt'],'seconds');}}}}}}catch(_0x389f5b){logger[_0xc8c2('0x3a')](_0xc8c2('0x8a'),_0x36d25e[_0xc8c2('0x26')],util['inspect'](_0x389f5b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')][_0xc8c2('0x19')]=function(_0x700098){var _0x4063e7='';try{if(this['isNotNull'](_0x700098)){logger[_0xc8c2('0x28')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x700098[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x700098,{'showHidden':![],'depth':null}));if(_0x700098[_0xc8c2('0x8b')]){_0x4063e7=_0x700098[_0xc8c2('0x8b')]['substring'](0x0,_0x700098['channel'][_0xc8c2('0x8c')]('-'));if(this['agents'][_0x4063e7]){logger[_0xc8c2('0x24')](_0xc8c2('0x8d'),_0x700098[_0xc8c2('0x26')],_0x4063e7);this['agents'][_0x4063e7][_0xc8c2('0x8e')]=!![];}}}}catch(_0x58803e){logger[_0xc8c2('0x3a')](_0xc8c2('0x8f'),_0x700098[_0xc8c2('0x26')],util[_0xc8c2('0x2a')](_0x58803e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc8c2('0x20')]['syncMusicOnHoldStop']=function(_0x17c76c){var _0xf401df='';try{if(this[_0xc8c2('0x23')](_0x17c76c)){logger[_0xc8c2('0x28')](_0xc8c2('0x90'),_0x17c76c['uniqueid'],util[_0xc8c2('0x2a')](_0x17c76c,{'showHidden':![],'depth':null}));if(_0x17c76c[_0xc8c2('0x8b')]){_0xf401df=_0x17c76c[_0xc8c2('0x8b')][_0xc8c2('0x91')](0x0,_0x17c76c['channel'][_0xc8c2('0x8c')]('-'));if(this[_0xc8c2('0xa')][_0xf401df]){logger[_0xc8c2('0x24')](_0xc8c2('0x92'),_0x17c76c[_0xc8c2('0x26')],_0xf401df);this[_0xc8c2('0xa')][_0xf401df][_0xc8c2('0x8e')]=![];}}}}catch(_0x4cb65d){logger[_0xc8c2('0x3a')](_0xc8c2('0x93'),_0x17c76c['uniqueid'],util[_0xc8c2('0x2a')](_0x4cb65d,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xcb72=['emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','isUndefined','channels','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acwtime','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','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]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','prototype'];(function(_0x1fac8c,_0x6b17d3){var _0x4fae3b=function(_0x263dad){while(--_0x263dad){_0x1fac8c['push'](_0x1fac8c['shift']());}};_0x4fae3b(++_0x6b17d3);}(_0xcb72,0x19e));var _0x2cb7=function(_0x2aa0e7,_0x5813f4){_0x2aa0e7=_0x2aa0e7-0x0;var _0x13a5af=_0xcb72[_0x2aa0e7];return _0x13a5af;};'use strict';var _=require(_0x2cb7('0x0'));var moment=require('moment');var util=require(_0x2cb7('0x1'));var Redis=require(_0x2cb7('0x2'));var config=require(_0x2cb7('0x3'));var logger=require(_0x2cb7('0x4'))(_0x2cb7('0x5'));var ami=require(_0x2cb7('0x6'));config['redis']=_[_0x2cb7('0x7')](config[_0x2cb7('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2cb7('0x8')]));function VoiceAgentReport(_0x2fa51f){this['channels']={};this[_0x2cb7('0x9')]=_0x2fa51f[_0x2cb7('0x9')];this[_0x2cb7('0xa')]=_0x2fa51f[_0x2cb7('0xa')];this[_0x2cb7('0xb')]={};ami['on'](_0x2cb7('0xc'),this[_0x2cb7('0xd')][_0x2cb7('0xe')](this));ami['on'](_0x2cb7('0xf'),this[_0x2cb7('0x10')]['bind'](this));ami['on'](_0x2cb7('0x11'),this[_0x2cb7('0x12')][_0x2cb7('0xe')](this));ami['on']('queuecallerabandon',this[_0x2cb7('0x13')][_0x2cb7('0xe')](this));ami['on']('agentcomplete',this[_0x2cb7('0x14')][_0x2cb7('0xe')](this));ami['on'](_0x2cb7('0x15'),this[_0x2cb7('0x16')][_0x2cb7('0xe')](this));ami['on'](_0x2cb7('0x17'),this['syncHangup'][_0x2cb7('0xe')](this));ami['on'](_0x2cb7('0x18'),this['syncMusicOnHoldStart'][_0x2cb7('0xe')](this));ami['on'](_0x2cb7('0x19'),this[_0x2cb7('0x1a')][_0x2cb7('0xe')](this));ami['on'](_0x2cb7('0x1b'),this['syncAttendedTransfer'][_0x2cb7('0xe')](this));ami['on']('blindtransfer',this[_0x2cb7('0x1c')][_0x2cb7('0xe')](this));}VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x1e')]=function(_0x4f9e68,_0x37118f,_0x38f09e){io['to'](_0x4f9e68)[_0x2cb7('0x1e')](_0x37118f,_0x38f09e);};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x1f')]=function(_0x2bc1e9){return _0x2bc1e9!==null&&!_['isUndefined'](_0x2bc1e9);};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0xd')]=function(_0x187fe9){try{if(this[_0x2cb7('0x1f')](_0x187fe9)){logger[_0x2cb7('0x20')](_0x2cb7('0x21'),_0x187fe9[_0x2cb7('0x22')],_0x187fe9[_0x2cb7('0x23')],_0x187fe9['destuniqueid']);logger['debug'](_0x2cb7('0x24'),_0x187fe9[_0x2cb7('0x22')],util['inspect'](_0x187fe9,{'showHidden':![],'depth':null}));if(_[_0x2cb7('0x25')](this[_0x2cb7('0x26')][_0x187fe9[_0x2cb7('0x22')]])){this['channels'][_0x187fe9['uniqueid']]={};}if(_[_0x2cb7('0x25')](this[_0x2cb7('0x26')][_0x187fe9[_0x2cb7('0x22')]][_0x187fe9[_0x2cb7('0x27')]])){this[_0x2cb7('0x26')][_0x187fe9['uniqueid']][_0x187fe9[_0x2cb7('0x27')]]={'agentcalledAt':moment()[_0x2cb7('0x28')](_0x2cb7('0x29')),'lastevent':_0x2cb7('0x2a'),'mandatoryDisposition':this[_0x2cb7('0x9')][_0x187fe9[_0x2cb7('0x2b')]]?this[_0x2cb7('0x9')][_0x187fe9[_0x2cb7('0x2b')]][_0x2cb7('0x2c')]||![]:![],'type':this['voiceQueues'][_0x187fe9[_0x2cb7('0x2b')]]?this[_0x2cb7('0x9')][_0x187fe9[_0x2cb7('0x2b')]][_0x2cb7('0x2d')]||_0x2cb7('0x2e'):_0x2cb7('0x2e'),'variables':this[_0x2cb7('0xb')][_0x187fe9[_0x2cb7('0x22')]]};}_['merge'](this['channels'][_0x187fe9['uniqueid']][_0x187fe9[_0x2cb7('0x27')]],_[_0x2cb7('0x2f')](_0x187fe9,[_0x2cb7('0x30'),'privilege']));logger['debug'](_0x2cb7('0x31'),_0x187fe9[_0x2cb7('0x22')],util[_0x2cb7('0x32')](this[_0x2cb7('0x26')][_0x187fe9[_0x2cb7('0x22')]][_0x187fe9[_0x2cb7('0x27')]],{'showHidden':![],'depth':null}));ami[_0x2cb7('0x1e')](_0x2cb7('0x33'),this[_0x2cb7('0x26')][_0x187fe9['uniqueid']][_0x187fe9[_0x2cb7('0x27')]]);logger[_0x2cb7('0x34')](_0x2cb7('0x35'),_0x187fe9[_0x2cb7('0x22')],util[_0x2cb7('0x32')](this[_0x2cb7('0x26')][_0x187fe9[_0x2cb7('0x22')]][_0x187fe9['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x2cb7('0x1e')](util[_0x2cb7('0x28')]('user:%s',_0x187fe9['membername']),'user:called',this[_0x2cb7('0x26')][_0x187fe9[_0x2cb7('0x22')]][_0x187fe9[_0x2cb7('0x27')]]);}}catch(_0x2fe507){logger[_0x2cb7('0x36')](_0x2cb7('0x37'),_0x187fe9[_0x2cb7('0x22')],util['inspect'](_0x2fe507,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x10')]=function(_0x59e61e){try{if(this[_0x2cb7('0x1f')](_0x59e61e)){if(this[_0x2cb7('0x26')][_0x59e61e['uniqueid']]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x59e61e['uniqueid'],util[_0x2cb7('0x32')](_0x59e61e,{'showHidden':![],'depth':null}));for(var _0x525712 in this[_0x2cb7('0x26')][_0x59e61e['uniqueid']]){if(this[_0x2cb7('0x26')][_0x59e61e['uniqueid']]['hasOwnProperty'](_0x525712)){if(_0x59e61e[_0x2cb7('0x27')]===_0x525712){logger[_0x2cb7('0x20')](_0x2cb7('0x38'),_0x59e61e[_0x2cb7('0x22')],_0x59e61e['membername'],_0x59e61e[_0x2cb7('0x27')]);this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x39')]=moment()[_0x2cb7('0x28')](_0x2cb7('0x29'));this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712]['connectedlinename']=_0x59e61e[_0x2cb7('0x3a')];this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712]['connectedlinenum']=_0x59e61e['connectedlinenum'];this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x3b')]=_0x59e61e[_0x2cb7('0x3b')];this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x3c')]=_0x59e61e['destchannelstatedesc'];this['channels'][_0x59e61e['uniqueid']][_0x525712][_0x2cb7('0x3d')]=_0x59e61e['holdtime'];this[_0x2cb7('0x26')][_0x59e61e['uniqueid']][_0x525712][_0x2cb7('0x3e')]=_0x2cb7('0x3f');_['merge'](this[_0x2cb7('0xa')][_0x59e61e[_0x2cb7('0x40')]],_[_0x2cb7('0x41')](_0x59e61e,['queue',_0x2cb7('0x42')]));logger[_0x2cb7('0x34')](_0x2cb7('0x43'),_0x59e61e[_0x2cb7('0x22')],util['inspect'](this['channels'][_0x59e61e[_0x2cb7('0x22')]][_0x59e61e[_0x2cb7('0x27')]],{'showHidden':![],'depth':null}));ami[_0x2cb7('0x1e')](_0x2cb7('0x44'),this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x59e61e[_0x2cb7('0x27')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x59e61e[_0x2cb7('0x22')],util['inspect'](this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x59e61e[_0x2cb7('0x27')]],{'showHidden':![],'depth':null}));this[_0x2cb7('0x1e')](util['format'](_0x2cb7('0x45'),_0x59e61e['membername']),_0x2cb7('0x46'),this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x59e61e[_0x2cb7('0x27')]]);}else if(!this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712]['agentringnoanswer']&&!this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x47')]){logger[_0x2cb7('0x20')](_0x2cb7('0x48'),_0x59e61e['uniqueid'],this['channels'][_0x59e61e['uniqueid']][_0x525712]['membername'],_0x525712);this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x11')]=!![];this['channels'][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x49')]=moment()[_0x2cb7('0x28')](_0x2cb7('0x29'));this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x4a')]=_0x59e61e[_0x2cb7('0x27')];this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x4b')]=_0x59e61e[_0x2cb7('0x23')];this[_0x2cb7('0x26')][_0x59e61e['uniqueid']][_0x525712][_0x2cb7('0x3e')]=_0x2cb7('0x4c');this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712][_0x2cb7('0x4d')]='answered_elsewhere';logger[_0x2cb7('0x34')](_0x2cb7('0x4e'),_0x59e61e[_0x2cb7('0x22')],util['inspect'](this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712],{'showHidden':![],'depth':null}));ami[_0x2cb7('0x1e')](_0x2cb7('0x4f'),this[_0x2cb7('0x26')][_0x59e61e[_0x2cb7('0x22')]][_0x525712]);}}}}}}catch(_0x1d87c7){logger[_0x2cb7('0x36')](_0x2cb7('0x50'),_0x59e61e[_0x2cb7('0x22')],util['inspect'](_0x1d87c7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2cb7('0x12')]=function(_0x551753){try{if(this[_0x2cb7('0x1f')](_0x551753)){logger[_0x2cb7('0x34')](_0x2cb7('0x51'),_0x551753[_0x2cb7('0x22')],util['inspect'](_0x551753,{'showHidden':![],'depth':null}));if(this['channels'][_0x551753[_0x2cb7('0x22')]]&&this[_0x2cb7('0x26')][_0x551753['uniqueid']][_0x551753[_0x2cb7('0x27')]]){logger[_0x2cb7('0x20')](_0x2cb7('0x52'),_0x551753[_0x2cb7('0x22')],_0x551753[_0x2cb7('0x23')],_0x551753[_0x2cb7('0x27')]);this[_0x2cb7('0x26')][_0x551753[_0x2cb7('0x22')]][_0x551753['destuniqueid']][_0x2cb7('0x11')]=!![];this[_0x2cb7('0x26')][_0x551753[_0x2cb7('0x22')]][_0x551753[_0x2cb7('0x27')]][_0x2cb7('0x49')]=moment()[_0x2cb7('0x28')](_0x2cb7('0x29'));this[_0x2cb7('0x26')][_0x551753['uniqueid']][_0x551753[_0x2cb7('0x27')]][_0x2cb7('0x3e')]=_0x2cb7('0x53');this[_0x2cb7('0x26')][_0x551753[_0x2cb7('0x22')]][_0x551753[_0x2cb7('0x27')]][_0x2cb7('0x4d')]=_0x2cb7('0x53');logger[_0x2cb7('0x34')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x551753['uniqueid'],util[_0x2cb7('0x32')](this[_0x2cb7('0x26')][_0x551753[_0x2cb7('0x22')]][_0x551753[_0x2cb7('0x27')]],{'showHidden':![],'depth':null}));ami[_0x2cb7('0x1e')](_0x2cb7('0x54'),this[_0x2cb7('0x26')][_0x551753[_0x2cb7('0x22')]][_0x551753[_0x2cb7('0x27')]]);}}}catch(_0x1a573a){logger[_0x2cb7('0x36')](_0x2cb7('0x55'),_0x551753[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x1a573a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x13')]=function(_0x408f38){try{if(this[_0x2cb7('0x1f')](_0x408f38)){logger[_0x2cb7('0x34')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x408f38['uniqueid'],util[_0x2cb7('0x32')](_0x408f38,{'showHidden':![],'depth':null}));if(this[_0x2cb7('0x26')][_0x408f38[_0x2cb7('0x22')]]){for(var _0x250e4e in this['channels'][_0x408f38[_0x2cb7('0x22')]]){if(this[_0x2cb7('0x26')][_0x408f38[_0x2cb7('0x22')]][_0x2cb7('0x56')](_0x250e4e)&&!this[_0x2cb7('0x26')][_0x408f38[_0x2cb7('0x22')]][_0x250e4e]['agentringnoanswer']&&!this[_0x2cb7('0x26')][_0x408f38['uniqueid']][_0x250e4e][_0x2cb7('0x47')]){logger[_0x2cb7('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x408f38[_0x2cb7('0x22')],this[_0x2cb7('0x26')][_0x408f38[_0x2cb7('0x22')]][_0x250e4e][_0x2cb7('0x23')],_0x250e4e);this[_0x2cb7('0x26')][_0x408f38[_0x2cb7('0x22')]][_0x250e4e][_0x2cb7('0x11')]=!![];this[_0x2cb7('0x26')][_0x408f38['uniqueid']][_0x250e4e]['agentringnoanswerAt']=moment()[_0x2cb7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2cb7('0x26')][_0x408f38[_0x2cb7('0x22')]][_0x250e4e][_0x2cb7('0x3e')]=_0x2cb7('0x57');this[_0x2cb7('0x26')][_0x408f38['uniqueid']][_0x250e4e][_0x2cb7('0x4d')]=_0x2cb7('0x57');logger[_0x2cb7('0x34')](_0x2cb7('0x58'),_0x408f38[_0x2cb7('0x22')],util[_0x2cb7('0x32')](this[_0x2cb7('0x26')][_0x408f38['uniqueid']][_0x250e4e],{'showHidden':![],'depth':null}));ami['emit'](_0x2cb7('0x59'),this['channels'][_0x408f38[_0x2cb7('0x22')]][_0x250e4e]);}}}}}catch(_0x199e39){logger[_0x2cb7('0x36')](_0x2cb7('0x5a'),_0x408f38[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x199e39,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x14')]=function(_0x5217bc){try{if(this[_0x2cb7('0x1f')](_0x5217bc)){logger[_0x2cb7('0x34')](_0x2cb7('0x5b'),_0x5217bc[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x5217bc,{'showHidden':![],'depth':null}));if(this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]]){for(var _0x57cbbe in this[_0x2cb7('0x26')][_0x5217bc['uniqueid']]){if(this[_0x2cb7('0x26')][_0x5217bc['uniqueid']][_0x2cb7('0x56')](_0x57cbbe)){if(this['channels'][_0x5217bc['uniqueid']][_0x57cbbe]['agentconnectAt']&&!this[_0x2cb7('0x26')][_0x5217bc['uniqueid']][_0x57cbbe][_0x2cb7('0x47')]){logger[_0x2cb7('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5217bc['uniqueid'],this['channels'][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe][_0x2cb7('0x23')],_0x57cbbe);this['channels'][_0x5217bc['uniqueid']][_0x57cbbe][_0x2cb7('0x47')]=!![];this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe][_0x2cb7('0x5c')]=moment()[_0x2cb7('0x28')](_0x2cb7('0x29'));this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe][_0x2cb7('0x3e')]=_0x2cb7('0x5d');this['channels'][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe][_0x2cb7('0x4d')]=_0x5217bc[_0x2cb7('0x4d')]=='transfer'?_0x2cb7('0x5e'):_0x5217bc[_0x2cb7('0x4d')];this[_0x2cb7('0x26')][_0x5217bc['uniqueid']][_0x57cbbe]['talktime']=_0x5217bc[_0x2cb7('0x5f')];if(this['voiceQueues'][_0x5217bc[_0x2cb7('0x2b')]]&&this[_0x2cb7('0x9')][_0x5217bc[_0x2cb7('0x2b')]]['acw']){this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe][_0x2cb7('0x60')]=this['voiceQueues'][_0x5217bc[_0x2cb7('0x2b')]]['acwTimeout'];this[_0x2cb7('0x26')][_0x5217bc['uniqueid']][_0x57cbbe]['agentacw']=!![];}this[_0x2cb7('0xa')][_0x5217bc[_0x2cb7('0x40')]]=_[_0x2cb7('0x2f')](this[_0x2cb7('0xa')][_0x5217bc[_0x2cb7('0x40')]],[_0x2cb7('0x2b'),'destconnectedlinenum']);logger[_0x2cb7('0x34')](_0x2cb7('0x61'),_0x5217bc['uniqueid'],util[_0x2cb7('0x32')](this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe],{'showHidden':![],'depth':null}));ami[_0x2cb7('0x1e')]('custom:agentcomplete',this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe]);logger['debug'](_0x2cb7('0x62'),_0x5217bc[_0x2cb7('0x22')],util[_0x2cb7('0x32')](this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe],{'showHidden':![],'depth':null}));this[_0x2cb7('0x1e')](util[_0x2cb7('0x28')](_0x2cb7('0x45'),_0x5217bc['membername']),_0x2cb7('0x63'),this[_0x2cb7('0x26')][_0x5217bc[_0x2cb7('0x22')]][_0x57cbbe]);}}}}}}catch(_0x4e9913){logger[_0x2cb7('0x36')]('[%s][voiceAgentReport][agentcomplete]',_0x5217bc[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x4e9913,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x16')]=function(_0x4a1384){try{if(this[_0x2cb7('0x1f')](_0x4a1384)){logger[_0x2cb7('0x34')](_0x2cb7('0x64'),_0x4a1384[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x4a1384,{'showHidden':![],'depth':null}));this[_0x2cb7('0x65')](_0x4a1384[_0x2cb7('0x22')],_[_0x2cb7('0x66')](_0x4a1384[_0x2cb7('0x67')])[0x0],_0x4a1384['value']);if(this[_0x2cb7('0x26')][_0x4a1384[_0x2cb7('0x22')]]){for(var _0x4bad4c in this[_0x2cb7('0x26')][_0x4a1384[_0x2cb7('0x22')]]){if(this[_0x2cb7('0x26')][_0x4a1384[_0x2cb7('0x22')]]['hasOwnProperty'](_0x4bad4c)){logger[_0x2cb7('0x20')](_0x2cb7('0x68'),_0x4a1384['uniqueid'],_0x4bad4c,_[_0x2cb7('0x66')](_0x4a1384[_0x2cb7('0x67')])[0x0],_0x4a1384[_0x2cb7('0x69')]);if(_[_0x2cb7('0x25')](this['channels'][_0x4a1384['uniqueid']][_0x4bad4c][_0x2cb7('0xb')])){this[_0x2cb7('0x26')][_0x4a1384[_0x2cb7('0x22')]][_0x4bad4c][_0x2cb7('0xb')]={};}this[_0x2cb7('0x26')][_0x4a1384[_0x2cb7('0x22')]][_0x4bad4c][_0x2cb7('0xb')]=this[_0x2cb7('0xb')][_0x4a1384['uniqueid']];}}}}}catch(_0x11312c){logger[_0x2cb7('0x36')](_0x2cb7('0x6a'),_0x4a1384['uniqueid'],util[_0x2cb7('0x32')](_0x11312c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')]['addVariable']=function(_0xb103f1,_0x5b8bbd,_0x40b443){var _0x3fb849=[_0x2cb7('0x6b'),'rtpaudioqosbridged',_0x2cb7('0x6c'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x2cb7('0x6d'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x2cb7('0x6e'),_0x2cb7('0x6f'),_0x2cb7('0x70'),_0x2cb7('0x71'),_0x2cb7('0x72'),'memberdynamic',_0x2cb7('0x73'),_0x2cb7('0x74'),_0x2cb7('0x23'),_0x2cb7('0x75'),'memberrealtime'];if(!_['isNil'](_0x5b8bbd)&&!_[_0x2cb7('0x76')](_0x3fb849,_0x5b8bbd)){if(_[_0x2cb7('0x25')](this['variables'][_0xb103f1])){this[_0x2cb7('0xb')][_0xb103f1]={};}this[_0x2cb7('0xb')][_0xb103f1][_0x5b8bbd]=_0x40b443;}};VoiceAgentReport[_0x2cb7('0x1d')]['syncHangup']=function(_0x3a1992){try{if(this[_0x2cb7('0x1f')](_0x3a1992)){logger[_0x2cb7('0x34')](_0x2cb7('0x77'),_0x3a1992[_0x2cb7('0x22')],util['inspect'](_0x3a1992,{'showHidden':![],'depth':null}));if(this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]]){for(var _0x4dabfe in this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]]){if(this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]][_0x2cb7('0x56')](_0x4dabfe)){if(this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]][_0x4dabfe][_0x2cb7('0x4d')]==_0x2cb7('0x78')&&this['channels'][_0x3a1992['uniqueid']][_0x4dabfe][_0x2cb7('0x47')]){logger[_0x2cb7('0x20')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x3a1992['uniqueid'],_0x4dabfe);this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]][_0x4dabfe][_0x2cb7('0x5c')]=moment()[_0x2cb7('0x28')](_0x2cb7('0x29'));}}}logger[_0x2cb7('0x34')](_0x2cb7('0x79'),_0x3a1992[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_[_0x2cb7('0x7a')](this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]]),{'showHidden':![],'depth':null}));ami[_0x2cb7('0x1e')](_0x2cb7('0x7b'),_[_0x2cb7('0x7a')](this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]]));delete this[_0x2cb7('0x26')][_0x3a1992[_0x2cb7('0x22')]];}if(this[_0x2cb7('0xb')][_0x3a1992[_0x2cb7('0x22')]]){delete this[_0x2cb7('0xb')][_0x3a1992[_0x2cb7('0x22')]];}}}catch(_0x2b3062){logger[_0x2cb7('0x36')](_0x2cb7('0x7c'),_0x3a1992['uniqueid'],util['inspect'](_0x2b3062,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')]['syncAttendedTransfer']=function(_0x413fd5){try{if(this[_0x2cb7('0x1f')](_0x413fd5)){logger[_0x2cb7('0x34')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x413fd5[_0x2cb7('0x22')],util['inspect'](_0x413fd5,{'showHidden':![],'depth':null}));if(this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]]){for(var _0x1c12b9 in this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]]){if(this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]]['hasOwnProperty'](_0x1c12b9)){if(_0x413fd5[_0x2cb7('0x7e')]===_0x1c12b9){logger['info'](_0x2cb7('0x7f'),_0x413fd5['uniqueid'],this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]][_0x1c12b9][_0x2cb7('0x23')],_0x1c12b9);var _0x88fdd1=moment();this[_0x2cb7('0x26')][_0x413fd5['transfereeuniqueid']][_0x1c12b9]['agentcomplete']=!![];this['channels'][_0x413fd5[_0x2cb7('0x7d')]][_0x1c12b9][_0x2cb7('0x5c')]=moment()[_0x2cb7('0x28')](_0x2cb7('0x29'));this[_0x2cb7('0x26')][_0x413fd5['transfereeuniqueid']][_0x1c12b9][_0x2cb7('0x3e')]='complete';this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]][_0x1c12b9][_0x2cb7('0x4d')]=_0x2cb7('0x78');this[_0x2cb7('0x26')][_0x413fd5['transfereeuniqueid']][_0x1c12b9][_0x2cb7('0x5f')]=_0x88fdd1[_0x2cb7('0x80')](this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]][_0x1c12b9][_0x2cb7('0x39')],_0x2cb7('0x81'));}}}}if(this['channels'][_0x413fd5[_0x2cb7('0x82')]]){var _0x499a79=this[_0x2cb7('0x26')][_0x413fd5['secondtransfereruniqueid']];this['channels'][_0x413fd5[_0x2cb7('0x82')]]=this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]];this[_0x2cb7('0x26')][_0x413fd5[_0x2cb7('0x7d')]]=_0x499a79;}}}catch(_0xd49374){logger[_0x2cb7('0x36')](_0x2cb7('0x83'),_0x413fd5[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0xd49374,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')]['syncBlindTransfer']=function(_0x49ef59){try{if(this[_0x2cb7('0x1f')](_0x49ef59)){logger[_0x2cb7('0x34')](_0x2cb7('0x84'),_0x49ef59[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x49ef59,{'showHidden':![],'depth':null}));if(this[_0x2cb7('0x26')][_0x49ef59['transfereeuniqueid']]){for(var _0x368667 in this['channels'][_0x49ef59[_0x2cb7('0x7d')]]){if(this[_0x2cb7('0x26')][_0x49ef59[_0x2cb7('0x7d')]][_0x2cb7('0x56')](_0x368667)){if(_0x49ef59[_0x2cb7('0x85')]===_0x368667){logger[_0x2cb7('0x20')](_0x2cb7('0x86'),_0x49ef59['uniqueid'],this[_0x2cb7('0x26')][_0x49ef59[_0x2cb7('0x7d')]][_0x368667][_0x2cb7('0x23')],_0x368667);var _0xa04985=moment();this[_0x2cb7('0x26')][_0x49ef59[_0x2cb7('0x7d')]][_0x368667][_0x2cb7('0x47')]=!![];this['channels'][_0x49ef59[_0x2cb7('0x7d')]][_0x368667][_0x2cb7('0x5c')]=_0xa04985;this['channels'][_0x49ef59[_0x2cb7('0x7d')]][_0x368667][_0x2cb7('0x3e')]=_0x2cb7('0x5d');this['channels'][_0x49ef59[_0x2cb7('0x7d')]][_0x368667][_0x2cb7('0x4d')]=_0x2cb7('0x78');this[_0x2cb7('0x26')][_0x49ef59[_0x2cb7('0x7d')]][_0x368667][_0x2cb7('0x5f')]=_0xa04985['diff'](this[_0x2cb7('0x26')][_0x49ef59['transfereeuniqueid']][_0x368667]['agentconnectAt'],'seconds');}}}}}}catch(_0x4fde03){logger[_0x2cb7('0x36')](_0x2cb7('0x87'),_0x49ef59[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x4fde03,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x88')]=function(_0xe029da){var _0x4b9c34='';try{if(this['isNotNull'](_0xe029da)){logger['debug'](_0x2cb7('0x89'),_0xe029da[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0xe029da,{'showHidden':![],'depth':null}));if(_0xe029da[_0x2cb7('0x8a')]){_0x4b9c34=_0xe029da[_0x2cb7('0x8a')][_0x2cb7('0x8b')](0x0,_0xe029da[_0x2cb7('0x8a')]['lastIndexOf']('-'));if(this[_0x2cb7('0xa')][_0x4b9c34]){logger[_0x2cb7('0x20')](_0x2cb7('0x8c'),_0xe029da[_0x2cb7('0x22')],_0x4b9c34);this[_0x2cb7('0xa')][_0x4b9c34][_0x2cb7('0x8d')]=!![];}}}}catch(_0x49b5f9){logger[_0x2cb7('0x36')](_0x2cb7('0x8e'),_0xe029da['uniqueid'],util[_0x2cb7('0x32')](_0x49b5f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2cb7('0x1d')][_0x2cb7('0x1a')]=function(_0x4290d3){var _0x3db333='';try{if(this[_0x2cb7('0x1f')](_0x4290d3)){logger[_0x2cb7('0x34')](_0x2cb7('0x8f'),_0x4290d3[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x4290d3,{'showHidden':![],'depth':null}));if(_0x4290d3[_0x2cb7('0x8a')]){_0x3db333=_0x4290d3['channel']['substring'](0x0,_0x4290d3[_0x2cb7('0x8a')][_0x2cb7('0x90')]('-'));if(this[_0x2cb7('0xa')][_0x3db333]){logger[_0x2cb7('0x20')](_0x2cb7('0x91'),_0x4290d3[_0x2cb7('0x22')],_0x3db333);this['agents'][_0x3db333][_0x2cb7('0x8d')]=![];}}}}catch(_0x13521d){logger[_0x2cb7('0x36')](_0x2cb7('0x92'),_0x4290d3[_0x2cb7('0x22')],util[_0x2cb7('0x32')](_0x13521d,{'showHidden':![],'depth':null}));}};module[_0x2cb7('0x93')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 09e1e43..4677b69 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 _0x8b24=['starttime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','monitor','.wav49','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','answertime','omit','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../ami','unknown','not_inuse','inuse','busy','ringing','ringinuse','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','channels','agents','blindTransfers','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','merge','keys','error','[%s][voiceCallReport][newcallerid]','debug','linkedid','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','context','from-sip','channel','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','pick','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered'];(function(_0x4f43e2,_0xf0a8b3){var _0x29cbf6=function(_0x137ce5){while(--_0x137ce5){_0x4f43e2['push'](_0x4f43e2['shift']());}};_0x29cbf6(++_0xf0a8b3);}(_0x8b24,0x1be));var _0x48b2=function(_0x58b4a8,_0x5065c4){_0x58b4a8=_0x58b4a8-0x0;var _0xbae372=_0x8b24[_0x58b4a8];return _0xbae372;};'use strict';var BPromise=require(_0x48b2('0x0'));var _=require(_0x48b2('0x1'));var moment=require('moment');var util=require(_0x48b2('0x2'));var path=require(_0x48b2('0x3'));var Redis=require(_0x48b2('0x4'));var config=require(_0x48b2('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x48b2('0x6'));var Channel=require('../model/channel');var statusDesc=[_0x48b2('0x7'),_0x48b2('0x8'),_0x48b2('0x9'),_0x48b2('0xa'),'invalid','unavailable',_0x48b2('0xb'),_0x48b2('0xc'),'onhold'];var applications=[_0x48b2('0xd'),_0x48b2('0xe'),_0x48b2('0xf'),'dial',_0x48b2('0x10'),_0x48b2('0x11')];var dispositions=[_0x48b2('0x12'),_0x48b2('0x13'),'FAILED',_0x48b2('0x12'),_0x48b2('0x12'),'NO\x20ANSWER','ANSWERED',_0x48b2('0x14'),'FAILED',_0x48b2('0x13'),'FAILED'];var actions={};config[_0x48b2('0x15')]=_['defaults'](config[_0x48b2('0x15')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x48b2('0x15')]));function VoiceCallReport(_0x3f0db3){this[_0x48b2('0x16')]=_0x3f0db3['channels'];this[_0x48b2('0x17')]=_0x3f0db3[_0x48b2('0x17')];this[_0x48b2('0x18')]={};ami['on']('coreshowchannel',this[_0x48b2('0x19')][_0x48b2('0x1a')](this));ami['on'](_0x48b2('0x1b'),this[_0x48b2('0x19')][_0x48b2('0x1a')](this));ami['on']('newchannel',this[_0x48b2('0x1c')]['bind'](this));ami['on']('newstate',this[_0x48b2('0x1d')][_0x48b2('0x1a')](this));ami['on'](_0x48b2('0x1e'),this[_0x48b2('0x1f')]['bind'](this));ami['on'](_0x48b2('0x20'),this['syncHangup'][_0x48b2('0x1a')](this));ami['on'](_0x48b2('0x21'),this[_0x48b2('0x22')][_0x48b2('0x1a')](this));ami['on'](_0x48b2('0x23'),this[_0x48b2('0x24')][_0x48b2('0x1a')](this));ami['on']('blindtransfer',this[_0x48b2('0x25')][_0x48b2('0x1a')](this));ami['on'](_0x48b2('0x26'),this[_0x48b2('0x27')]['bind'](this));ami['on']('musiconholdstop',this[_0x48b2('0x28')][_0x48b2('0x1a')](this));try{logger[_0x48b2('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x14c78e){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x48b2('0x2a')](_0x14c78e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x2c')]=function(_0x8fa709){return _0x8fa709!==null&&!_[_0x48b2('0x2d')](_0x8fa709);};VoiceCallReport[_0x48b2('0x2b')]['emit']=function(_0x2fba8c,_0x8b4384,_0x58d6b3){io['to'](_0x2fba8c)[_0x48b2('0x2e')](_0x8b4384,_0x58d6b3);};VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x22')]=function(_0x554729){try{if(this[_0x48b2('0x2c')](_0x554729)){logger['info'](_0x48b2('0x2f'),_0x554729[_0x48b2('0x30')],_0x554729[_0x48b2('0x31')],_0x554729[_0x48b2('0x32')]);logger['debug']('[%s][voiceCallReport][newcallerid]\x20event:',_0x554729[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x554729,{'showHidden':![],'depth':null}));if(_0x554729[_0x48b2('0x30')]===_0x554729['linkedid']){if(!_[_0x48b2('0x2d')](this[_0x48b2('0x16')][_0x554729[_0x48b2('0x30')]])){_[_0x48b2('0x33')](this[_0x48b2('0x16')][_0x554729[_0x48b2('0x30')]],_['pick'](_0x554729,_[_0x48b2('0x34')](this['channels'][_0x554729['uniqueid']])));}}}}catch(_0x46afa8){logger[_0x48b2('0x35')](_0x48b2('0x36'),_0x554729['uniqueid'],util[_0x48b2('0x2a')](_0x46afa8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x1c')]=function(_0x5a3eb3){try{if(this[_0x48b2('0x2c')](_0x5a3eb3)){logger[_0x48b2('0x37')]('[%s][voiceCallReport][newchannel]\x20event:',_0x5a3eb3[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x5a3eb3,{'showHidden':![],'depth':null}));if(_0x5a3eb3[_0x48b2('0x30')]===_0x5a3eb3[_0x48b2('0x38')]&&_0x5a3eb3['channel']!=_0x48b2('0x39')){if(_[_0x48b2('0x2d')](this[_0x48b2('0x16')][_0x5a3eb3[_0x48b2('0x30')]])){logger[_0x48b2('0x29')](_0x48b2('0x3a'),_0x5a3eb3[_0x48b2('0x30')],_0x5a3eb3['context'],_0x5a3eb3[_0x48b2('0x3b')]);this['channels'][_0x5a3eb3[_0x48b2('0x30')]]=new Channel();this['channels'][_0x5a3eb3[_0x48b2('0x30')]]['starttime']=moment()[_0x48b2('0x3c')](_0x48b2('0x3d'));this[_0x48b2('0x16')][_0x5a3eb3['uniqueid']][_0x48b2('0x3e')]=dispositions[_[_0x48b2('0x3f')](_0x5a3eb3['channelstate'])];_['merge'](this['channels'][_0x5a3eb3[_0x48b2('0x30')]],_['pick'](_0x5a3eb3,_[_0x48b2('0x34')](this['channels'][_0x5a3eb3['uniqueid']])));if(_0x5a3eb3[_0x48b2('0x40')]===_0x48b2('0x41')){if(this[_0x48b2('0x17')][_0x5a3eb3[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]]){this[_0x48b2('0x17')][_0x5a3eb3[_0x48b2('0x42')]['split']('-')[0x0]][_0x48b2('0x44')]=_0x5a3eb3[_0x48b2('0x3b')];logger[_0x48b2('0x37')](_0x48b2('0x45'),_0x5a3eb3[_0x48b2('0x30')],util['inspect']({'destaccountcode':this[_0x48b2('0x17')][_0x5a3eb3[_0x48b2('0x42')]['split']('-')[0x0]][_0x48b2('0x46')],'destconnectedlinenum':_0x5a3eb3[_0x48b2('0x3b')]},{'showHidden':![],'depth':null}));this[_0x48b2('0x2e')](util[_0x48b2('0x3c')](_0x48b2('0x47'),this[_0x48b2('0x17')][_0x5a3eb3[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]][_0x48b2('0x48')]),_0x48b2('0x49'),{'destaccountcode':this[_0x48b2('0x17')][_0x5a3eb3[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]][_0x48b2('0x46')],'destconnectedlinenum':_0x5a3eb3[_0x48b2('0x3b')]});}}}}}}catch(_0x7b9bd1){logger['error'](_0x48b2('0x4a'),_0x5a3eb3[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x7b9bd1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x48b2('0x19')]=function(_0x454cf7){try{if(this['isNotNull'](_0x454cf7)){logger[_0x48b2('0x37')](_0x48b2('0x4b'),_0x454cf7[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x454cf7,{'showHidden':![],'depth':null}));if(_0x454cf7[_0x48b2('0x30')]===_0x454cf7[_0x48b2('0x38')]&&_0x454cf7[_0x48b2('0x3b')]!='h'&&_0x454cf7[_0x48b2('0x42')]!=_0x48b2('0x39')){_0x454cf7[_0x48b2('0x4c')]=_0x454cf7[_0x48b2('0x4c')][_0x48b2('0x4d')]();_0x454cf7[_0x48b2('0x4e')]=(_0x454cf7[_0x48b2('0x4f')]||_0x454cf7['applicationdata'])[_0x48b2('0x4d')]();logger[_0x48b2('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x454cf7['uniqueid'],_0x454cf7[_0x48b2('0x4c')],_0x454cf7[_0x48b2('0x4e')]);if(_[_0x48b2('0x2d')](this[_0x48b2('0x16')][_0x454cf7[_0x48b2('0x30')]])){this['channels'][_0x454cf7[_0x48b2('0x30')]]=new Channel();this[_0x48b2('0x16')][_0x454cf7[_0x48b2('0x30')]]['starttime']=_0x454cf7['duration']?moment()[_0x48b2('0x50')](moment[_0x48b2('0x51')](_0x454cf7['duration'])[_0x48b2('0x52')](),_0x48b2('0x52'))[_0x48b2('0x3c')](_0x48b2('0x3d')):moment()[_0x48b2('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x48b2('0x16')][_0x454cf7[_0x48b2('0x30')]][_0x48b2('0x3e')]=_0x48b2('0x12');}_[_0x48b2('0x33')](this['channels'][_0x454cf7[_0x48b2('0x30')]],_[_0x48b2('0x53')](_0x454cf7,_['keys'](this['channels'][_0x454cf7[_0x48b2('0x30')]])));if(_[_0x48b2('0x54')](applications,_0x454cf7['application'])){this['channels'][_0x454cf7[_0x48b2('0x30')]][_0x48b2('0x55')]=_0x454cf7['application'];this[_0x48b2('0x16')][_0x454cf7[_0x48b2('0x30')]][_0x48b2('0x56')]=_0x454cf7[_0x48b2('0x4e')];if(_0x454cf7[_0x48b2('0x4c')]===_0x48b2('0xd')&&_[_0x48b2('0x57')](_0x454cf7['applicationdata'],_0x48b2('0x58'))){var _0x355b18=_0x454cf7[_0x48b2('0x4e')][_0x48b2('0x43')]('=');var _0x690ea5=_0x355b18[0x0][_0x48b2('0x59')](/cdr\((.*)\)/);if(_0x690ea5){this[_0x48b2('0x16')][_0x454cf7[_0x48b2('0x30')]][_0x690ea5[0x1]]=_0x355b18[0x1];}}else if(_0x454cf7['application']==='queue'){this[_0x48b2('0x16')][_0x454cf7[_0x48b2('0x30')]][_0x48b2('0xe')]=_0x454cf7[_0x48b2('0x4e')][_0x48b2('0x43')](',')[0x0];}}}}}catch(_0x4eb726){logger[_0x48b2('0x35')](_0x48b2('0x5a'),_0x454cf7['uniqueid'],util[_0x48b2('0x2a')](_0x4eb726,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x48b2('0x1d')]=function(_0x8dd421){try{if(this[_0x48b2('0x2c')](_0x8dd421)){logger[_0x48b2('0x29')](_0x48b2('0x5b'),_0x8dd421[_0x48b2('0x30')],_0x8dd421['linkedid'],_0x8dd421[_0x48b2('0x31')],_0x8dd421[_0x48b2('0x32')]);logger[_0x48b2('0x37')]('[%s][voiceCallReport][newstate]\x20event:',_0x8dd421[_0x48b2('0x30')],util['inspect'](_0x8dd421,{'showHidden':![],'depth':null}));if(_0x8dd421[_0x48b2('0x30')]!==_0x8dd421[_0x48b2('0x38')]){if(this['channels'][_0x8dd421[_0x48b2('0x38')]]){if(_0x8dd421[_0x48b2('0x5c')]==='6'){if(!this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x5d')]){var _0x4a524c=moment();this[_0x48b2('0x16')][_0x8dd421['linkedid']][_0x48b2('0x5d')]=!![];this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]]['answertime']=_0x4a524c[_0x48b2('0x3c')](_0x48b2('0x3d'));if(this['channels'][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x5e')]){this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x5f')]=_0x4a524c[_0x48b2('0x60')](this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x5e')],_0x48b2('0x52'));}}this[_0x48b2('0x16')][_0x8dd421['linkedid']]['linkedid']=_0x8dd421[_0x48b2('0x30')];if(_0x8dd421[_0x48b2('0x32')]!==_0x48b2('0x61')){this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x62')]=_0x8dd421['calleridnum'];}this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x63')]=_0x8dd421[_0x48b2('0x31')];this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x64')]=_0x8dd421[_0x48b2('0x42')];this[_0x48b2('0x16')][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x3e')]=dispositions[_['toNumber'](_0x8dd421[_0x48b2('0x5c')])];if(this['agents'][_0x8dd421[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]]){this['channels'][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x65')]=this[_0x48b2('0x17')][_0x8dd421['channel'][_0x48b2('0x43')]('-')[0x0]]['id'];this['channels'][_0x8dd421[_0x48b2('0x38')]][_0x48b2('0x66')]=this[_0x48b2('0x17')][_0x8dd421[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]][_0x48b2('0x48')];}}}}else{if(this['channels'][_0x8dd421['uniqueid']]){if(_0x8dd421[_0x48b2('0x5c')]==='6'){if(this[_0x48b2('0x17')][_0x8dd421[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]]){this['channels'][_0x8dd421[_0x48b2('0x30')]][_0x48b2('0x65')]=this[_0x48b2('0x17')][_0x8dd421[_0x48b2('0x42')]['split']('-')[0x0]]['id'];this[_0x48b2('0x16')][_0x8dd421['uniqueid']][_0x48b2('0x66')]=this[_0x48b2('0x17')][_0x8dd421[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]][_0x48b2('0x48')];}}}}}}catch(_0x7277e7){logger['error'](_0x48b2('0x67'),_0x8dd421[_0x48b2('0x30')],util['inspect'](_0x7277e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x48b2('0x2b')]['syncMixMonitorFilename']=function(_0x256673,_0x4ac7c5){try{if(this[_0x48b2('0x16')][_0x256673]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x256673,_0x4ac7c5);this[_0x48b2('0x16')][_0x256673][_0x48b2('0x68')]=!![];if(_['endsWith'](_0x4ac7c5,'.wav49')){_0x4ac7c5=_0x4ac7c5['replace'](_0x48b2('0x69'),'.WAV');}this[_0x48b2('0x16')][_0x256673][_0x48b2('0x6a')]=_0x4ac7c5;var _0x54c075=_[_0x48b2('0x6b')](this[_0x48b2('0x16')][_0x256673][_0x48b2('0x6c')],{'filename':_0x4ac7c5});if(_[_0x48b2('0x6d')](_0x54c075)){this[_0x48b2('0x16')][_0x256673][_0x48b2('0x6c')][_0x48b2('0x6e')]({'filename':_0x4ac7c5,'createdAt':moment()[_0x48b2('0x3c')](_0x48b2('0x3d')),'mixmonitorid':'','status':'rec'});}}}catch(_0x14530a){logger[_0x48b2('0x35')](_0x48b2('0x6f'),_0x256673,util[_0x48b2('0x2a')](_0x14530a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x48b2('0x1f')]=function(_0x49db9c){try{if(this[_0x48b2('0x2c')](_0x49db9c)){logger[_0x48b2('0x37')](_0x48b2('0x70'),_0x49db9c[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x49db9c,{'showHidden':![],'depth':null}));if(this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]]&&_0x49db9c[_0x48b2('0x42')]!=_0x48b2('0x39')){if(this['isNotNull'](_0x49db9c[_0x48b2('0x71')])){if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')]['mixmonitor_filename'])){logger[_0x48b2('0x29')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x49db9c['uniqueid'],_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x73')](_0x49db9c[_0x48b2('0x30')],_0x49db9c[_0x48b2('0x72')]);}else if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x74')])){logger[_0x48b2('0x29')](_0x48b2('0x75'),_0x49db9c['uniqueid'],_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0x32')]=_0x49db9c['value'];}else if(this['isNotNull'](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x76')])){logger[_0x48b2('0x29')](_0x48b2('0x77'),_0x49db9c['uniqueid'],_0x49db9c['value']);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0x78')]=_0x49db9c[_0x48b2('0x72')];}else if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x79')])){logger['info'](_0x48b2('0x7a'),_0x49db9c[_0x48b2('0x30')],_0x49db9c['value']);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0x7b')]=_0x49db9c[_0x48b2('0x72')];}else if(this['isNotNull'](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x7c')])){logger[_0x48b2('0x29')](_0x48b2('0x7d'),_0x49db9c[_0x48b2('0x30')],_0x49db9c[_0x48b2('0x72')][_0x48b2('0x43')](',')[0x0]);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0xe')]=_0x49db9c[_0x48b2('0x72')][_0x48b2('0x43')](',')[0x0];}else if(this[_0x48b2('0x2c')](_0x49db9c['variable'][_0x48b2('0x7e')])){logger[_0x48b2('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x49db9c['uniqueid'],_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0x7f')]=_0x49db9c[_0x48b2('0x72')];}else if(this[_0x48b2('0x2c')](_0x49db9c['variable'][_0x48b2('0x80')])){logger['info'](_0x48b2('0x81'),_0x49db9c[_0x48b2('0x30')],_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]]['destination']=_0x49db9c[_0x48b2('0x72')];}else if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x82')])){logger[_0x48b2('0x29')](_0x48b2('0x83'),_0x49db9c['uniqueid'],_0x49db9c[_0x48b2('0x72')]);this['channels'][_0x49db9c['uniqueid']][_0x48b2('0x84')]=_0x49db9c['value'];}else if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')]['xmcs-queue'])){logger[_0x48b2('0x29')](_0x48b2('0x85'),_0x49db9c[_0x48b2('0x30')],_0x49db9c[_0x48b2('0x72')]);this['channels'][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0xe')]=_0x49db9c['value'];}else if(this['isNotNull'](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x86')])){logger[_0x48b2('0x29')](_0x48b2('0x87'),_0x49db9c[_0x48b2('0x30')],_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x30')]][_0x48b2('0x88')]=_0x49db9c['value'];}}}else if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x89')])){if(_0x49db9c[_0x48b2('0x72')]){var _0x4fa2cb=path[_0x48b2('0x8a')](_0x49db9c[_0x48b2('0x72')])[_0x48b2('0x48')];logger[_0x48b2('0x29')](_0x48b2('0x8b'),_0x4fa2cb,_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x73')](_0x4fa2cb,_0x49db9c[_0x48b2('0x72')]);}}else if(this['channels'][_0x49db9c['linkedid']]){if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')])){if(this[_0x48b2('0x2c')](_0x49db9c[_0x48b2('0x71')][_0x48b2('0x86')])){logger[_0x48b2('0x29')](_0x48b2('0x87'),_0x49db9c[_0x48b2('0x38')],_0x49db9c[_0x48b2('0x72')]);this[_0x48b2('0x16')][_0x49db9c[_0x48b2('0x38')]][_0x48b2('0x8c')]=_0x49db9c[_0x48b2('0x72')];}}}}}catch(_0x3f105d){logger[_0x48b2('0x35')](_0x48b2('0x8d'),_0x49db9c[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x3f105d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x8e')]=function(_0x2af95f){try{if(this[_0x48b2('0x2c')](_0x2af95f)){logger[_0x48b2('0x37')]('[%s][voiceCallReport][hangup]\x20event:',_0x2af95f[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x2af95f,{'showHidden':![],'depth':null}));if(this['channels'][_0x2af95f['uniqueid']]){logger[_0x48b2('0x29')](_0x48b2('0x8f'),_0x2af95f[_0x48b2('0x30')],_0x2af95f[_0x48b2('0x90')]);var _0x243427=moment();this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x91')]=_0x243427['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x51')]=_0x243427[_0x48b2('0x60')](this['channels'][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x5e')],_0x48b2('0x52'));if(this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x5d')]){this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x92')]=_0x243427['diff'](this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x93')],_0x48b2('0x52'));this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x5f')]=this['channels'][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x51')]-this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x92')];}if(_0x2af95f[_0x48b2('0x40')]===_0x48b2('0x41')){if(this[_0x48b2('0x17')][_0x2af95f[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]]){this[_0x48b2('0x17')][_0x2af95f[_0x48b2('0x42')]['split']('-')[0x0]]=_[_0x48b2('0x94')](this[_0x48b2('0x17')][_0x2af95f[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]],[_0x48b2('0x44')]);logger[_0x48b2('0x37')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x2af95f['uniqueid'],util[_0x48b2('0x2a')]({'destaccountcode':this[_0x48b2('0x17')][_0x2af95f['channel']['split']('-')[0x0]][_0x48b2('0x46')]},{'showHidden':![],'depth':null}));this[_0x48b2('0x2e')](util[_0x48b2('0x3c')](_0x48b2('0x47'),this['agents'][_0x2af95f[_0x48b2('0x42')]['split']('-')[0x0]][_0x48b2('0x48')]),_0x48b2('0x95'),{'destaccountcode':this[_0x48b2('0x17')][_0x2af95f[_0x48b2('0x42')][_0x48b2('0x43')]('-')[0x0]][_0x48b2('0x46')]});}}if(_0x2af95f[_0x48b2('0x96')]===_0x48b2('0x97')){this[_0x48b2('0x18')][_0x2af95f[_0x48b2('0x30')]]=this[_0x48b2('0x16')][_0x2af95f['uniqueid']];}else{if(this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]]['type']===_0x48b2('0x98')&&this[_0x48b2('0x18')][_0x2af95f['uniqueid']]){this[_0x48b2('0x16')][_0x2af95f['uniqueid']][_0x48b2('0x30')]=[this['channels'][_0x2af95f['uniqueid']][_0x48b2('0x38')],this[_0x48b2('0x16')][_0x2af95f['uniqueid']][_0x48b2('0x38')]=this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]][_0x48b2('0x30')]][0x0];delete this[_0x48b2('0x18')][_0x2af95f[_0x48b2('0x30')]];}}logger[_0x48b2('0x37')](_0x48b2('0x99'),_0x2af95f[_0x48b2('0x30')],util[_0x48b2('0x2a')](this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]],{'showHidden':![],'depth':null}));ami[_0x48b2('0x2e')](_0x48b2('0x9a'),this['channels'][_0x2af95f['uniqueid']]);delete this[_0x48b2('0x16')][_0x2af95f[_0x48b2('0x30')]];}}}catch(_0x368bcf){logger[_0x48b2('0x35')](_0x48b2('0x9b'),_0x2af95f['uniqueid'],util[_0x48b2('0x2a')](_0x368bcf,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x397dfd){try{if(this[_0x48b2('0x2c')](_0x397dfd)){logger[_0x48b2('0x29')](_0x48b2('0x9c'),_0x397dfd['uniqueid'],_0x397dfd[_0x48b2('0x9d')],_0x397dfd[_0x48b2('0x9e')]);logger[_0x48b2('0x37')](_0x48b2('0x9f'),_0x397dfd[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x397dfd,{'showHidden':![],'depth':null}));if(this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa0')]]){this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa0')]][_0x48b2('0xa1')]=_0x397dfd[_0x48b2('0x9d')];this['channels'][_0x397dfd['transfereeuniqueid']][_0x48b2('0xa2')]=_0x397dfd['transfertargetcalleridnum'];if(this[_0x48b2('0x16')][_0x397dfd['secondtransfereruniqueid']]){var _0x2edd25=this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa3')]];this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa3')]]=this['channels'][_0x397dfd[_0x48b2('0xa0')]];this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa0')]]=_0x2edd25;}}else if(this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa4')]]){this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa4')]][_0x48b2('0xa1')]=_0x397dfd[_0x48b2('0x9d')];this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa4')]]['transferconnectedlinenum']=_0x397dfd[_0x48b2('0x9e')];if(this[_0x48b2('0x16')][_0x397dfd['origtransfereruniqueid']]){var _0x2edd25=this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa5')]];this[_0x48b2('0x16')][_0x397dfd[_0x48b2('0xa5')]]=this[_0x48b2('0x16')][_0x397dfd['transfertargetuniqueid']];this[_0x48b2('0x16')][_0x397dfd['transfertargetuniqueid']]=_0x2edd25;}}}}catch(_0x230955){logger[_0x48b2('0x35')](_0x48b2('0xa6'),_0x397dfd['uniqueid'],util[_0x48b2('0x2a')](_0x230955,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x25')]=function(_0x226ce8){try{if(this[_0x48b2('0x2c')](_0x226ce8)){logger['info'](_0x48b2('0xa7'),_0x226ce8[_0x48b2('0x30')],_0x226ce8[_0x48b2('0xa8')],_0x226ce8[_0x48b2('0xa9')]);logger[_0x48b2('0x37')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x226ce8[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x226ce8,{'showHidden':![],'depth':null}));if(this[_0x48b2('0x16')][_0x226ce8[_0x48b2('0xa0')]]){this[_0x48b2('0x16')][_0x226ce8[_0x48b2('0xa0')]][_0x48b2('0xa1')]=_0x226ce8[_0x48b2('0xa8')];this[_0x48b2('0x16')][_0x226ce8[_0x48b2('0xa0')]][_0x48b2('0xa2')]=_0x226ce8[_0x48b2('0xa9')];this[_0x48b2('0x8e')]({'event':'BlindTransfer','uniqueid':_0x226ce8[_0x48b2('0xa0')],'context':_0x226ce8['context'],'channel':_0x226ce8[_0x48b2('0xaa')]});}}}catch(_0x38d8b4){logger[_0x48b2('0x35')](_0x48b2('0xab'),_0x226ce8[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x38d8b4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x27')]=function(_0x574872){try{if(this[_0x48b2('0x2c')](_0x574872)){logger[_0x48b2('0x37')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x574872[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x574872,{'showHidden':![],'depth':null}));if(this[_0x48b2('0x16')][_0x574872[_0x48b2('0x30')]]){if(!_[_0x48b2('0x6d')](this['channels'][_0x574872[_0x48b2('0x30')]][_0x48b2('0x93')])){this[_0x48b2('0x16')][_0x574872[_0x48b2('0x30')]]['mohstarttime']=moment()[_0x48b2('0x3c')](_0x48b2('0x3d'));logger[_0x48b2('0x29')](_0x48b2('0xac'),_0x574872['uniqueid'],this['channels'][_0x574872['uniqueid']]['mohstarttime']);}}}}catch(_0x193cd1){logger[_0x48b2('0x35')]('[%s][voiceCallReport][musiconholdstart]',_0x574872[_0x48b2('0x30')],util[_0x48b2('0x2a')](_0x193cd1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x48b2('0x2b')][_0x48b2('0x28')]=function(_0x572748){try{if(this[_0x48b2('0x2c')](_0x572748)){logger['debug'](_0x48b2('0xad'),_0x572748['uniqueid'],util[_0x48b2('0x2a')](_0x572748,{'showHidden':![],'depth':null}));if(this['channels'][_0x572748[_0x48b2('0x30')]]){if(!_[_0x48b2('0x6d')](this[_0x48b2('0x16')][_0x572748[_0x48b2('0x30')]][_0x48b2('0xae')])){this[_0x48b2('0x16')][_0x572748[_0x48b2('0x30')]][_0x48b2('0xaf')]+=moment()[_0x48b2('0xb0')](0x0)[_0x48b2('0x60')](this[_0x48b2('0x16')][_0x572748['uniqueid']][_0x48b2('0xae')],_0x48b2('0x52'));logger[_0x48b2('0x29')](_0x48b2('0xb1'),_0x572748[_0x48b2('0x30')],this[_0x48b2('0x16')][_0x572748['uniqueid']]['mohtime']);delete this[_0x48b2('0x16')][_0x572748[_0x48b2('0x30')]][_0x48b2('0xae')];}}}}catch(_0x1741c1){logger[_0x48b2('0x35')](_0x48b2('0xb2'),_0x572748['uniqueid'],util[_0x48b2('0x2a')](_0x1741c1,{'showHidden':![],'depth':null}));}};module[_0x48b2('0xb3')]=VoiceCallReport; \ No newline at end of file +var _0x76df=['[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohtime','bluebird','lodash','moment','util','path','ioredis','../../../config/logger','../ami','../model/channel','unknown','inuse','busy','invalid','ringing','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncHangup','newcallerid','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','uniqueid','linkedid','error','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','merge','keys','from-sip','channel','split','destconnectedlinenum','exten','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','pick','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','type','outbound'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x76df,0x17e));var _0xf76d=function(_0x17615e,_0x483a49){_0x17615e=_0x17615e-0x0;var _0xa4c97e=_0x76df[_0x17615e];return _0xa4c97e;};'use strict';var BPromise=require(_0xf76d('0x0'));var _=require(_0xf76d('0x1'));var moment=require(_0xf76d('0x2'));var util=require(_0xf76d('0x3'));var path=require(_0xf76d('0x4'));var Redis=require(_0xf76d('0x5'));var config=require('../../../config/environment');var logger=require(_0xf76d('0x6'))('ami');var ami=require(_0xf76d('0x7'));var Channel=require(_0xf76d('0x8'));var statusDesc=[_0xf76d('0x9'),'not_inuse',_0xf76d('0xa'),_0xf76d('0xb'),_0xf76d('0xc'),'unavailable',_0xf76d('0xd'),'ringinuse','onhold'];var applications=[_0xf76d('0xe'),_0xf76d('0xf'),_0xf76d('0x10'),_0xf76d('0x11'),_0xf76d('0x12'),_0xf76d('0x13')];var dispositions=[_0xf76d('0x14'),_0xf76d('0x15'),'FAILED',_0xf76d('0x14'),_0xf76d('0x14'),_0xf76d('0x14'),'ANSWERED',_0xf76d('0x16'),_0xf76d('0x15'),_0xf76d('0x15'),'FAILED'];var actions={};config['redis']=_[_0xf76d('0x17')](config[_0xf76d('0x18')],{'host':_0xf76d('0x19'),'port':0x18eb});var io=require(_0xf76d('0x1a'))(new Redis(config[_0xf76d('0x18')]));function VoiceCallReport(_0xe7428b){this[_0xf76d('0x1b')]=_0xe7428b[_0xf76d('0x1b')];this[_0xf76d('0x1c')]=_0xe7428b[_0xf76d('0x1c')];this[_0xf76d('0x1d')]={};ami['on']('coreshowchannel',this['syncNewExten'][_0xf76d('0x1e')](this));ami['on'](_0xf76d('0x1f'),this[_0xf76d('0x20')][_0xf76d('0x1e')](this));ami['on'](_0xf76d('0x21'),this[_0xf76d('0x22')][_0xf76d('0x1e')](this));ami['on'](_0xf76d('0x23'),this[_0xf76d('0x24')]['bind'](this));ami['on'](_0xf76d('0x25'),this['syncVarSet'][_0xf76d('0x1e')](this));ami['on']('hangup',this[_0xf76d('0x26')]['bind'](this));ami['on'](_0xf76d('0x27'),this['syncNewCallerId'][_0xf76d('0x1e')](this));ami['on']('attendedtransfer',this[_0xf76d('0x28')][_0xf76d('0x1e')](this));ami['on']('blindtransfer',this[_0xf76d('0x29')][_0xf76d('0x1e')](this));ami['on'](_0xf76d('0x2a'),this[_0xf76d('0x2b')]['bind'](this));ami['on']('musiconholdstop',this[_0xf76d('0x2c')][_0xf76d('0x1e')](this));try{logger[_0xf76d('0x2d')](_0xf76d('0x2e'));ami[_0xf76d('0x2f')]();}catch(_0x39977f){logger['error'](_0xf76d('0x30'),util[_0xf76d('0x31')](_0x39977f,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x33')]=function(_0x2f0004){return _0x2f0004!==null&&!_[_0xf76d('0x34')](_0x2f0004);};VoiceCallReport['prototype'][_0xf76d('0x35')]=function(_0x5809d1,_0x385364,_0x820c0d){io['to'](_0x5809d1)[_0xf76d('0x35')](_0x385364,_0x820c0d);};VoiceCallReport['prototype'][_0xf76d('0x36')]=function(_0x3426e1){try{if(this[_0xf76d('0x33')](_0x3426e1)){logger[_0xf76d('0x2d')](_0xf76d('0x37'),_0x3426e1['uniqueid'],_0x3426e1[_0xf76d('0x38')],_0x3426e1[_0xf76d('0x39')]);logger[_0xf76d('0x3a')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x3426e1['uniqueid'],util['inspect'](_0x3426e1,{'showHidden':![],'depth':null}));if(_0x3426e1[_0xf76d('0x3b')]===_0x3426e1[_0xf76d('0x3c')]){if(!_[_0xf76d('0x34')](this['channels'][_0x3426e1[_0xf76d('0x3b')]])){_['merge'](this[_0xf76d('0x1b')][_0x3426e1[_0xf76d('0x3b')]],_['pick'](_0x3426e1,_['keys'](this['channels'][_0x3426e1[_0xf76d('0x3b')]])));}}}}catch(_0x5d0a4c){logger[_0xf76d('0x3d')]('[%s][voiceCallReport][newcallerid]',_0x3426e1[_0xf76d('0x3b')],util['inspect'](_0x5d0a4c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x22')]=function(_0x1b7b6b){try{if(this['isNotNull'](_0x1b7b6b)){logger[_0xf76d('0x3a')](_0xf76d('0x3e'),_0x1b7b6b[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x1b7b6b,{'showHidden':![],'depth':null}));if(_0x1b7b6b[_0xf76d('0x3b')]===_0x1b7b6b[_0xf76d('0x3c')]&&_0x1b7b6b['channel']!=_0xf76d('0x3f')){if(_[_0xf76d('0x34')](this[_0xf76d('0x1b')][_0x1b7b6b[_0xf76d('0x3b')]])){logger['info'](_0xf76d('0x40'),_0x1b7b6b[_0xf76d('0x3b')],_0x1b7b6b[_0xf76d('0x41')],_0x1b7b6b['exten']);this[_0xf76d('0x1b')][_0x1b7b6b['uniqueid']]=new Channel();this[_0xf76d('0x1b')][_0x1b7b6b[_0xf76d('0x3b')]]['starttime']=moment()[_0xf76d('0x42')](_0xf76d('0x43'));this['channels'][_0x1b7b6b['uniqueid']][_0xf76d('0x44')]=dispositions[_['toNumber'](_0x1b7b6b[_0xf76d('0x45')])];_[_0xf76d('0x46')](this[_0xf76d('0x1b')][_0x1b7b6b[_0xf76d('0x3b')]],_['pick'](_0x1b7b6b,_[_0xf76d('0x47')](this[_0xf76d('0x1b')][_0x1b7b6b[_0xf76d('0x3b')]])));if(_0x1b7b6b[_0xf76d('0x41')]===_0xf76d('0x48')){if(this['agents'][_0x1b7b6b[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]){this[_0xf76d('0x1c')][_0x1b7b6b[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]][_0xf76d('0x4b')]=_0x1b7b6b[_0xf76d('0x4c')];logger[_0xf76d('0x3a')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x1b7b6b['uniqueid'],util[_0xf76d('0x31')]({'destaccountcode':this[_0xf76d('0x1c')][_0x1b7b6b[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]][_0xf76d('0x4d')],'destconnectedlinenum':_0x1b7b6b[_0xf76d('0x4c')]},{'showHidden':![],'depth':null}));this[_0xf76d('0x35')](util[_0xf76d('0x42')]('user:%s',this['agents'][_0x1b7b6b[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]][_0xf76d('0x4e')]),_0xf76d('0x4f'),{'destaccountcode':this['agents'][_0x1b7b6b[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1b7b6b[_0xf76d('0x4c')]});}}}}}}catch(_0x433a88){logger['error'](_0xf76d('0x50'),_0x1b7b6b[_0xf76d('0x3b')],util['inspect'](_0x433a88,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf76d('0x20')]=function(_0x3a58e5){try{if(this[_0xf76d('0x33')](_0x3a58e5)){logger[_0xf76d('0x3a')]('[%s][voiceCallReport][newexten]\x20event:',_0x3a58e5[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x3a58e5,{'showHidden':![],'depth':null}));if(_0x3a58e5[_0xf76d('0x3b')]===_0x3a58e5[_0xf76d('0x3c')]&&_0x3a58e5['exten']!='h'&&_0x3a58e5['channel']!='OutgoingSpoolFailed'){_0x3a58e5[_0xf76d('0x51')]=_0x3a58e5[_0xf76d('0x51')][_0xf76d('0x52')]();_0x3a58e5[_0xf76d('0x53')]=(_0x3a58e5[_0xf76d('0x54')]||_0x3a58e5[_0xf76d('0x53')])[_0xf76d('0x52')]();logger[_0xf76d('0x2d')](_0xf76d('0x55'),_0x3a58e5[_0xf76d('0x3b')],_0x3a58e5[_0xf76d('0x51')],_0x3a58e5[_0xf76d('0x53')]);if(_[_0xf76d('0x34')](this['channels'][_0x3a58e5['uniqueid']])){this[_0xf76d('0x1b')][_0x3a58e5[_0xf76d('0x3b')]]=new Channel();this[_0xf76d('0x1b')][_0x3a58e5[_0xf76d('0x3b')]][_0xf76d('0x56')]=_0x3a58e5[_0xf76d('0x57')]?moment()[_0xf76d('0x58')](moment['duration'](_0x3a58e5[_0xf76d('0x57')])[_0xf76d('0x59')](),_0xf76d('0x59'))[_0xf76d('0x42')](_0xf76d('0x43')):moment()[_0xf76d('0x42')](_0xf76d('0x43'));this[_0xf76d('0x1b')][_0x3a58e5[_0xf76d('0x3b')]]['disposition']=_0xf76d('0x14');}_['merge'](this[_0xf76d('0x1b')][_0x3a58e5[_0xf76d('0x3b')]],_[_0xf76d('0x5a')](_0x3a58e5,_[_0xf76d('0x47')](this[_0xf76d('0x1b')][_0x3a58e5[_0xf76d('0x3b')]])));if(_[_0xf76d('0x5b')](applications,_0x3a58e5[_0xf76d('0x51')])){this['channels'][_0x3a58e5[_0xf76d('0x3b')]][_0xf76d('0x5c')]=_0x3a58e5[_0xf76d('0x51')];this['channels'][_0x3a58e5[_0xf76d('0x3b')]][_0xf76d('0x5d')]=_0x3a58e5['applicationdata'];if(_0x3a58e5[_0xf76d('0x51')]===_0xf76d('0xe')&&_[_0xf76d('0x5e')](_0x3a58e5[_0xf76d('0x53')],_0xf76d('0x5f'))){var _0x43c898=_0x3a58e5[_0xf76d('0x53')]['split']('=');var _0x1b6c5b=_0x43c898[0x0][_0xf76d('0x60')](/cdr\((.*)\)/);if(_0x1b6c5b){this['channels'][_0x3a58e5[_0xf76d('0x3b')]][_0x1b6c5b[0x1]]=_0x43c898[0x1];}}else if(_0x3a58e5[_0xf76d('0x51')]===_0xf76d('0xf')){this[_0xf76d('0x1b')][_0x3a58e5['uniqueid']][_0xf76d('0xf')]=_0x3a58e5['applicationdata']['split'](',')[0x0];}}}}}catch(_0x379d69){logger[_0xf76d('0x3d')](_0xf76d('0x61'),_0x3a58e5['uniqueid'],util[_0xf76d('0x31')](_0x379d69,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf76d('0x24')]=function(_0x4dd1ac){try{if(this[_0xf76d('0x33')](_0x4dd1ac)){logger[_0xf76d('0x2d')](_0xf76d('0x62'),_0x4dd1ac[_0xf76d('0x3b')],_0x4dd1ac[_0xf76d('0x3c')],_0x4dd1ac[_0xf76d('0x38')],_0x4dd1ac[_0xf76d('0x39')]);logger[_0xf76d('0x3a')](_0xf76d('0x63'),_0x4dd1ac['uniqueid'],util[_0xf76d('0x31')](_0x4dd1ac,{'showHidden':![],'depth':null}));if(_0x4dd1ac[_0xf76d('0x3b')]!==_0x4dd1ac[_0xf76d('0x3c')]){if(this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]]){if(_0x4dd1ac['channelstate']==='6'){if(!this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x64')]){var _0x89f56c=moment();this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x64')]=!![];this['channels'][_0x4dd1ac['linkedid']][_0xf76d('0x65')]=_0x89f56c[_0xf76d('0x42')](_0xf76d('0x43'));if(this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x56')]){this['channels'][_0x4dd1ac[_0xf76d('0x3c')]]['holdtime']=_0x89f56c[_0xf76d('0x66')](this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x56')],_0xf76d('0x59'));}}this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x3c')]=_0x4dd1ac[_0xf76d('0x3b')];if(_0x4dd1ac['calleridnum']!==_0xf76d('0x67')){this[_0xf76d('0x1b')][_0x4dd1ac['linkedid']][_0xf76d('0x68')]=_0x4dd1ac[_0xf76d('0x39')];}this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x69')]=_0x4dd1ac[_0xf76d('0x38')];this[_0xf76d('0x1b')][_0x4dd1ac['linkedid']][_0xf76d('0x6a')]=_0x4dd1ac[_0xf76d('0x49')];this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x44')]=dispositions[_[_0xf76d('0x6b')](_0x4dd1ac['channelstate'])];if(this['agents'][_0x4dd1ac[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]){this['channels'][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x6c')]=this['agents'][_0x4dd1ac[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]['id'];this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3c')]][_0xf76d('0x6d')]=this['agents'][_0x4dd1ac[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]][_0xf76d('0x4e')];}}}}else{if(this[_0xf76d('0x1b')][_0x4dd1ac['uniqueid']]){if(_0x4dd1ac[_0xf76d('0x45')]==='6'){if(this[_0xf76d('0x1c')][_0x4dd1ac['channel'][_0xf76d('0x4a')]('-')[0x0]]){this[_0xf76d('0x1b')][_0x4dd1ac['uniqueid']][_0xf76d('0x6c')]=this[_0xf76d('0x1c')][_0x4dd1ac[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]['id'];this[_0xf76d('0x1b')][_0x4dd1ac[_0xf76d('0x3b')]]['membername']=this['agents'][_0x4dd1ac[_0xf76d('0x49')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x1e5879){logger[_0xf76d('0x3d')](_0xf76d('0x6e'),_0x4dd1ac[_0xf76d('0x3b')],util['inspect'](_0x1e5879,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x6f')]=function(_0x2481ec,_0x242419){try{if(this[_0xf76d('0x1b')][_0x2481ec]){logger[_0xf76d('0x2d')](_0xf76d('0x70'),_0x2481ec,_0x242419);this[_0xf76d('0x1b')][_0x2481ec][_0xf76d('0x71')]=!![];if(_[_0xf76d('0x72')](_0x242419,'.wav49')){_0x242419=_0x242419[_0xf76d('0x73')](_0xf76d('0x74'),_0xf76d('0x75'));}this[_0xf76d('0x1b')][_0x2481ec]['monitorFilename']=_0x242419;var _0x22d05c=_[_0xf76d('0x76')](this[_0xf76d('0x1b')][_0x2481ec][_0xf76d('0x77')],{'filename':_0x242419});if(_[_0xf76d('0x78')](_0x22d05c)){this[_0xf76d('0x1b')][_0x2481ec][_0xf76d('0x77')][_0xf76d('0x79')]({'filename':_0x242419,'createdAt':moment()['format'](_0xf76d('0x43')),'mixmonitorid':'','status':_0xf76d('0x7a')});}}}catch(_0x500929){logger[_0xf76d('0x3d')](_0xf76d('0x7b'),_0x2481ec,util[_0xf76d('0x31')](_0x500929,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x7c')]=function(_0x5bcd26){try{if(this[_0xf76d('0x33')](_0x5bcd26)){logger[_0xf76d('0x3a')]('[%s][voiceCallReport][varset]\x20event:',_0x5bcd26[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x5bcd26,{'showHidden':![],'depth':null}));if(this[_0xf76d('0x1b')][_0x5bcd26['uniqueid']]&&_0x5bcd26['channel']!=_0xf76d('0x3f')){if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')])){if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')][_0xf76d('0x7e')])){logger[_0xf76d('0x2d')](_0xf76d('0x7f'),_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26[_0xf76d('0x80')]);this[_0xf76d('0x6f')](_0x5bcd26['uniqueid'],_0x5bcd26[_0xf76d('0x80')]);}else if(this['isNotNull'](_0x5bcd26[_0xf76d('0x7d')][_0xf76d('0x81')])){logger[_0xf76d('0x2d')](_0xf76d('0x82'),_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26[_0xf76d('0x80')]);this[_0xf76d('0x1b')][_0x5bcd26['uniqueid']][_0xf76d('0x39')]=_0x5bcd26[_0xf76d('0x80')];}else if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')][_0xf76d('0x83')])){logger[_0xf76d('0x2d')](_0xf76d('0x84'),_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26[_0xf76d('0x80')]);this[_0xf76d('0x1b')][_0x5bcd26[_0xf76d('0x3b')]][_0xf76d('0x85')]=_0x5bcd26[_0xf76d('0x80')];}else if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')]['xmd-cdrtype'])){logger['info'](_0xf76d('0x86'),_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26[_0xf76d('0x80')]);this['channels'][_0x5bcd26[_0xf76d('0x3b')]]['type']=_0x5bcd26[_0xf76d('0x80')];}else if(this[_0xf76d('0x33')](_0x5bcd26['variable'][_0xf76d('0x87')])){logger[_0xf76d('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26[_0xf76d('0x80')][_0xf76d('0x4a')](',')[0x0]);this[_0xf76d('0x1b')][_0x5bcd26[_0xf76d('0x3b')]]['queue']=_0x5bcd26[_0xf76d('0x80')][_0xf76d('0x4a')](',')[0x0];}else if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')][_0xf76d('0x88')])){logger[_0xf76d('0x2d')](_0xf76d('0x89'),_0x5bcd26['uniqueid'],_0x5bcd26[_0xf76d('0x80')]);this['channels'][_0x5bcd26[_0xf76d('0x3b')]]['originatecalleridnum']=_0x5bcd26['value'];}else if(this[_0xf76d('0x33')](_0x5bcd26['variable']['xmd-destination'])){logger['info'](_0xf76d('0x8a'),_0x5bcd26['uniqueid'],_0x5bcd26['value']);this[_0xf76d('0x1b')][_0x5bcd26[_0xf76d('0x3b')]][_0xf76d('0x8b')]=_0x5bcd26[_0xf76d('0x80')];}else if(this['isNotNull'](_0x5bcd26[_0xf76d('0x7d')]['xmd-callerid-preview'])){logger[_0xf76d('0x2d')](_0xf76d('0x8c'),_0x5bcd26['uniqueid'],_0x5bcd26['value']);this[_0xf76d('0x1b')][_0x5bcd26[_0xf76d('0x3b')]][_0xf76d('0x8d')]=_0x5bcd26['value'];}else if(this[_0xf76d('0x33')](_0x5bcd26['variable'][_0xf76d('0x8e')])){logger[_0xf76d('0x2d')](_0xf76d('0x8f'),_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26['value']);this[_0xf76d('0x1b')][_0x5bcd26['uniqueid']][_0xf76d('0xf')]=_0x5bcd26[_0xf76d('0x80')];}else if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')][_0xf76d('0x90')])){logger[_0xf76d('0x2d')](_0xf76d('0x91'),_0x5bcd26[_0xf76d('0x3b')],_0x5bcd26[_0xf76d('0x80')]);this[_0xf76d('0x1b')][_0x5bcd26[_0xf76d('0x3b')]]['sipcalluniqueid']=_0x5bcd26['value'];}}}else if(this[_0xf76d('0x33')](_0x5bcd26['variable'][_0xf76d('0x7e')])){if(_0x5bcd26[_0xf76d('0x80')]){var _0x3a2e4=path[_0xf76d('0x92')](_0x5bcd26[_0xf76d('0x80')])[_0xf76d('0x4e')];logger['info'](_0xf76d('0x7f'),_0x3a2e4,_0x5bcd26[_0xf76d('0x80')]);this['syncMixMonitorFilename'](_0x3a2e4,_0x5bcd26[_0xf76d('0x80')]);}}else if(this[_0xf76d('0x1b')][_0x5bcd26['linkedid']]){if(this['isNotNull'](_0x5bcd26['variable'])){if(this[_0xf76d('0x33')](_0x5bcd26[_0xf76d('0x7d')][_0xf76d('0x90')])){logger['info'](_0xf76d('0x91'),_0x5bcd26[_0xf76d('0x3c')],_0x5bcd26[_0xf76d('0x80')]);this[_0xf76d('0x1b')][_0x5bcd26[_0xf76d('0x3c')]][_0xf76d('0x93')]=_0x5bcd26[_0xf76d('0x80')];}}}}}catch(_0x3c3ec3){logger['error'](_0xf76d('0x94'),_0x5bcd26[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x3c3ec3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x26')]=function(_0x38cd16){try{if(this['isNotNull'](_0x38cd16)){logger[_0xf76d('0x3a')](_0xf76d('0x95'),_0x38cd16['uniqueid'],util[_0xf76d('0x31')](_0x38cd16,{'showHidden':![],'depth':null}));if(this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]]){logger[_0xf76d('0x2d')](_0xf76d('0x96'),_0x38cd16[_0xf76d('0x3b')],_0x38cd16['cause-txt']);var _0x37685c=moment();this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x97')]=_0x37685c[_0xf76d('0x42')](_0xf76d('0x43'));this['channels'][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x57')]=_0x37685c['diff'](this[_0xf76d('0x1b')][_0x38cd16['uniqueid']]['starttime'],_0xf76d('0x59'));if(this['channels'][_0x38cd16[_0xf76d('0x3b')]]['answered']){this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]]['billableseconds']=_0x37685c[_0xf76d('0x66')](this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]]['answertime'],_0xf76d('0x59'));this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]]['holdtime']=this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x57')]-this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x98')];}if(_0x38cd16[_0xf76d('0x41')]===_0xf76d('0x48')){if(this['agents'][_0x38cd16['channel'][_0xf76d('0x4a')]('-')[0x0]]){this[_0xf76d('0x1c')][_0x38cd16['channel'][_0xf76d('0x4a')]('-')[0x0]]=_[_0xf76d('0x99')](this[_0xf76d('0x1c')][_0x38cd16[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]],[_0xf76d('0x4b')]);logger[_0xf76d('0x3a')](_0xf76d('0x9a'),_0x38cd16[_0xf76d('0x3b')],util['inspect']({'destaccountcode':this[_0xf76d('0x1c')][_0x38cd16[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]][_0xf76d('0x4d')]},{'showHidden':![],'depth':null}));this[_0xf76d('0x35')](util[_0xf76d('0x42')](_0xf76d('0x9b'),this[_0xf76d('0x1c')][_0x38cd16[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xf76d('0x1c')][_0x38cd16[_0xf76d('0x49')][_0xf76d('0x4a')]('-')[0x0]]['accountcode']});}}if(_0x38cd16['event']==='BlindTransfer'){this['blindTransfers'][_0x38cd16[_0xf76d('0x3b')]]=this[_0xf76d('0x1b')][_0x38cd16['uniqueid']];}else{if(this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x9c')]===_0xf76d('0x9d')&&this['blindTransfers'][_0x38cd16[_0xf76d('0x3b')]]){this['channels'][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x3b')]=[this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]]['linkedid'],this['channels'][_0x38cd16[_0xf76d('0x3b')]][_0xf76d('0x3c')]=this['channels'][_0x38cd16[_0xf76d('0x3b')]]['uniqueid']][0x0];delete this['blindTransfers'][_0x38cd16[_0xf76d('0x3b')]];}}logger[_0xf76d('0x3a')](_0xf76d('0x9e'),_0x38cd16[_0xf76d('0x3b')],util[_0xf76d('0x31')](this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]],{'showHidden':![],'depth':null}));ami[_0xf76d('0x35')]('custom:voiceCallReport',this[_0xf76d('0x1b')][_0x38cd16[_0xf76d('0x3b')]]);delete this['channels'][_0x38cd16[_0xf76d('0x3b')]];}}}catch(_0x3b6be6){logger[_0xf76d('0x3d')]('[%s][voiceCallReport][hangup]',_0x38cd16[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x3b6be6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x28')]=function(_0x3cabb0){try{if(this[_0xf76d('0x33')](_0x3cabb0)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x3cabb0[_0xf76d('0x3b')],_0x3cabb0[_0xf76d('0x9f')],_0x3cabb0[_0xf76d('0xa0')]);logger[_0xf76d('0x3a')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x3cabb0[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x3cabb0,{'showHidden':![],'depth':null}));if(this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa1')]]){this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa1')]][_0xf76d('0xa2')]=_0x3cabb0['origtransferercalleridnum'];this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa1')]][_0xf76d('0xa3')]=_0x3cabb0[_0xf76d('0xa0')];if(this[_0xf76d('0x1b')][_0x3cabb0['secondtransfereruniqueid']]){var _0x2b56cd=this[_0xf76d('0x1b')][_0x3cabb0['secondtransfereruniqueid']];this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa4')]]=this[_0xf76d('0x1b')][_0x3cabb0['transfereeuniqueid']];this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa1')]]=_0x2b56cd;}}else if(this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa5')]]){this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa5')]][_0xf76d('0xa2')]=_0x3cabb0[_0xf76d('0x9f')];this['channels'][_0x3cabb0['transfertargetuniqueid']][_0xf76d('0xa3')]=_0x3cabb0[_0xf76d('0xa0')];if(this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa6')]]){var _0x2b56cd=this['channels'][_0x3cabb0[_0xf76d('0xa6')]];this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa6')]]=this['channels'][_0x3cabb0[_0xf76d('0xa5')]];this[_0xf76d('0x1b')][_0x3cabb0[_0xf76d('0xa5')]]=_0x2b56cd;}}}}catch(_0x2f634c){logger[_0xf76d('0x3d')](_0xf76d('0xa7'),_0x3cabb0[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x2f634c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x29')]=function(_0x1317c8){try{if(this[_0xf76d('0x33')](_0x1317c8)){logger[_0xf76d('0x2d')](_0xf76d('0xa8'),_0x1317c8[_0xf76d('0x3b')],_0x1317c8['transfereecalleridnum'],_0x1317c8[_0xf76d('0xa9')]);logger[_0xf76d('0x3a')](_0xf76d('0xaa'),_0x1317c8[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x1317c8,{'showHidden':![],'depth':null}));if(this[_0xf76d('0x1b')][_0x1317c8[_0xf76d('0xa1')]]){this[_0xf76d('0x1b')][_0x1317c8[_0xf76d('0xa1')]][_0xf76d('0xa2')]=_0x1317c8[_0xf76d('0xab')];this[_0xf76d('0x1b')][_0x1317c8[_0xf76d('0xa1')]][_0xf76d('0xa3')]=_0x1317c8[_0xf76d('0xa9')];this[_0xf76d('0x26')]({'event':'BlindTransfer','uniqueid':_0x1317c8[_0xf76d('0xa1')],'context':_0x1317c8[_0xf76d('0x41')],'channel':_0x1317c8[_0xf76d('0xac')]});}}}catch(_0x469cb7){logger['error'](_0xf76d('0xad'),_0x1317c8[_0xf76d('0x3b')],util['inspect'](_0x469cb7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf76d('0x2b')]=function(_0x28ede4){try{if(this[_0xf76d('0x33')](_0x28ede4)){logger[_0xf76d('0x3a')](_0xf76d('0xae'),_0x28ede4[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x28ede4,{'showHidden':![],'depth':null}));if(this[_0xf76d('0x1b')][_0x28ede4['uniqueid']]){if(!_['isNil'](this[_0xf76d('0x1b')][_0x28ede4['uniqueid']][_0xf76d('0x65')])){this['channels'][_0x28ede4[_0xf76d('0x3b')]][_0xf76d('0xaf')]=moment()[_0xf76d('0x42')](_0xf76d('0x43'));logger[_0xf76d('0x2d')](_0xf76d('0xb0'),_0x28ede4['uniqueid'],this[_0xf76d('0x1b')][_0x28ede4['uniqueid']][_0xf76d('0xaf')]);}}}}catch(_0x20204c){logger[_0xf76d('0x3d')]('[%s][voiceCallReport][musiconholdstart]',_0x28ede4['uniqueid'],util[_0xf76d('0x31')](_0x20204c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf76d('0x32')][_0xf76d('0x2c')]=function(_0x4ca57e){try{if(this[_0xf76d('0x33')](_0x4ca57e)){logger[_0xf76d('0x3a')](_0xf76d('0xb1'),_0x4ca57e['uniqueid'],util[_0xf76d('0x31')](_0x4ca57e,{'showHidden':![],'depth':null}));if(this[_0xf76d('0x1b')][_0x4ca57e[_0xf76d('0x3b')]]){if(!_[_0xf76d('0x78')](this[_0xf76d('0x1b')][_0x4ca57e[_0xf76d('0x3b')]]['mohstarttime'])){this[_0xf76d('0x1b')][_0x4ca57e[_0xf76d('0x3b')]]['mohtime']+=moment()[_0xf76d('0xb2')](0x0)[_0xf76d('0x66')](this[_0xf76d('0x1b')][_0x4ca57e[_0xf76d('0x3b')]][_0xf76d('0xaf')],_0xf76d('0x59'));logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x4ca57e[_0xf76d('0x3b')],this[_0xf76d('0x1b')][_0x4ca57e[_0xf76d('0x3b')]][_0xf76d('0xb3')]);delete this[_0xf76d('0x1b')][_0x4ca57e[_0xf76d('0x3b')]][_0xf76d('0xaf')];}}}}catch(_0x5e5c9c){logger[_0xf76d('0x3d')]('[%s][voiceCallReport][musiconholdstop]',_0x4ca57e[_0xf76d('0x3b')],util[_0xf76d('0x31')](_0x5e5c9c,{'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 431c083..4dcc266 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 _0x8030=['rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','variables','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','complete','answertime','answered','holdtime','billableseconds','sumBillable','sumDuration','duration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash','moment','util','ioredis','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice:outbound','error','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged'];(function(_0x5bdb89,_0x4fc612){var _0x5d44cc=function(_0x46bd23){while(--_0x46bd23){_0x5bdb89['push'](_0x5bdb89['shift']());}};_0x5d44cc(++_0x4fc612);}(_0x8030,0x15e));var _0x0803=function(_0x4faf18,_0x1eeefb){_0x4faf18=_0x4faf18-0x0;var _0x4a540a=_0x8030[_0x4faf18];return _0x4a540a;};'use strict';var _=require(_0x0803('0x0'));var moment=require(_0x0803('0x1'));var util=require(_0x0803('0x2'));var Redis=require(_0x0803('0x3'));var config=require(_0x0803('0x4'));var logger=require('../../../config/logger')(_0x0803('0x5'));var ami=require('../ami');config[_0x0803('0x6')]=_[_0x0803('0x7')](config['redis'],{'host':_0x0803('0x8'),'port':0x18eb});var io=require(_0x0803('0x9'))(new Redis(config[_0x0803('0x6')]));function VoiceDialReport(_0x42293c){this[_0x0803('0xa')]=_0x42293c[_0x0803('0xb')];this[_0x0803('0xc')]=_0x42293c[_0x0803('0xc')];this['variables']={};ami['on'](_0x0803('0xd'),this[_0x0803('0xe')][_0x0803('0xf')](this));ami['on'](_0x0803('0x10'),this[_0x0803('0x11')][_0x0803('0xf')](this));ami['on'](_0x0803('0x12'),this['syncVarSet'][_0x0803('0xf')](this));ami['on'](_0x0803('0x13'),this[_0x0803('0x14')][_0x0803('0xf')](this));}VoiceDialReport[_0x0803('0x15')]['isNotNull']=function(_0x498b9c){return _0x498b9c!==null&&!_[_0x0803('0x16')](_0x498b9c);};VoiceDialReport[_0x0803('0x15')]['emit']=function(_0x42f3f9,_0x327550,_0x382419){io['to'](_0x42f3f9)[_0x0803('0x17')](_0x327550,_0x382419);};VoiceDialReport[_0x0803('0x15')]['syncDialBegin']=function(_0x12eb7b){try{if(this[_0x0803('0x18')](_0x12eb7b)){logger['debug'](_0x0803('0x19'),_0x12eb7b['uniqueid'],util[_0x0803('0x1a')](_0x12eb7b,{'showHidden':![],'depth':null}));if(this['channels'][_0x12eb7b['uniqueid']]){_['merge'](this[_0x0803('0xa')][_0x12eb7b[_0x0803('0x1b')]],{'starttime':moment()[_0x0803('0x1c')](_0x0803('0x1d')),'lastevent':'called','interface':_0x12eb7b[_0x0803('0x1e')]['substring'](0x0,_0x12eb7b['channel'][_0x0803('0x1f')]('-')),'membername':_0x12eb7b[_0x0803('0x1e')]['substring'](_0x12eb7b[_0x0803('0x1e')][_0x0803('0x1f')]('/')+0x1,_0x12eb7b[_0x0803('0x1e')][_0x0803('0x1f')]('-'))},_[_0x0803('0x20')](_0x12eb7b,[_0x0803('0x21'),_0x0803('0x22')]));logger[_0x0803('0x23')](_0x0803('0x24'),_0x12eb7b[_0x0803('0x1b')],this[_0x0803('0xa')][_0x12eb7b['uniqueid']]['membername'],this[_0x0803('0xa')][_0x12eb7b[_0x0803('0x1b')]][_0x0803('0x25')]);logger[_0x0803('0x26')](_0x0803('0x27'),_0x12eb7b[_0x0803('0x1b')],util[_0x0803('0x1a')](this[_0x0803('0xa')][_0x12eb7b[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x0803('0x28'),this[_0x0803('0xa')][_0x12eb7b[_0x0803('0x1b')]]);logger[_0x0803('0x26')](_0x0803('0x29'),_0x12eb7b[_0x0803('0x1b')],util[_0x0803('0x1a')](this[_0x0803('0xa')][_0x12eb7b[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0803('0x2a'),this[_0x0803('0xa')][_0x12eb7b[_0x0803('0x1b')]]);}}}catch(_0x33e1d4){logger['error'](_0x0803('0x2b'),_0x12eb7b[_0x0803('0x1b')],util[_0x0803('0x1a')](_0x33e1d4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0803('0x15')]['syncDialEnd']=function(_0x26b8a5){try{if(this[_0x0803('0x18')](_0x26b8a5)){logger[_0x0803('0x26')](_0x0803('0x2c'),_0x26b8a5[_0x0803('0x1b')],util[_0x0803('0x1a')](_0x26b8a5,{'showHidden':![],'depth':null}));if(this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]]){this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]][_0x0803('0x2d')]=_0x26b8a5[_0x0803('0x2d')];if(_0x26b8a5[_0x0803('0x2d')]===_0x0803('0x2e')){this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]][_0x0803('0x2f')]=_0x26b8a5[_0x0803('0x2f')];this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]]['connectedlinename']=_0x26b8a5[_0x0803('0x30')];this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]]['answertime']=moment()[_0x0803('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]][_0x0803('0x31')]='connect';logger[_0x0803('0x23')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x26b8a5[_0x0803('0x1b')],_0x26b8a5[_0x0803('0x1e')][_0x0803('0x32')](_0x26b8a5[_0x0803('0x1e')][_0x0803('0x1f')]('/')+0x1,_0x26b8a5[_0x0803('0x1e')][_0x0803('0x1f')]('-')));logger[_0x0803('0x26')](_0x0803('0x33'),_0x26b8a5[_0x0803('0x1b')],util[_0x0803('0x1a')](this[_0x0803('0xa')][_0x26b8a5['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0803('0x17')]('custom:dialconnect',this['channels'][_0x26b8a5[_0x0803('0x1b')]]);}logger[_0x0803('0x26')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x26b8a5[_0x0803('0x1b')],util['inspect'](this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));this[_0x0803('0x17')](_0x0803('0x34'),_0x0803('0x28'),this[_0x0803('0xa')][_0x26b8a5[_0x0803('0x1b')]]);}}}catch(_0x1b2949){logger[_0x0803('0x35')]('[%s][voiceDialReport][dialend]',_0x26b8a5['uniqueid'],util[_0x0803('0x1a')](_0x1b2949,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0803('0x36')]=function(_0x16a181){try{if(this[_0x0803('0x18')](_0x16a181)){logger[_0x0803('0x26')](_0x0803('0x37'),_0x16a181[_0x0803('0x1b')],util[_0x0803('0x1a')](_0x16a181,{'showHidden':![],'depth':null}));this[_0x0803('0x38')](_0x16a181['uniqueid'],_[_0x0803('0x39')](_0x16a181['variable'])[0x0],_0x16a181[_0x0803('0x3a')]);if(this['isNotNull'](_0x16a181[_0x0803('0x3b')])&&this[_0x0803('0x18')](_0x16a181[_0x0803('0x3b')][_0x0803('0x3c')])){if(_[_0x0803('0x16')](this[_0x0803('0xa')][_0x16a181[_0x0803('0x1b')]])){this['channels'][_0x16a181[_0x0803('0x1b')]]={'routeId':_0x16a181['value'],'variables':this['variables'][_0x16a181[_0x0803('0x1b')]]};logger['info'](_0x0803('0x3d'),_0x16a181[_0x0803('0x1b')],_0x16a181[_0x0803('0x3b')][_0x0803('0x3c')],_['keys'](_0x16a181['variable'])[0x0],_0x16a181[_0x0803('0x3a')]);logger['debug'](_0x0803('0x3e'),_0x16a181[_0x0803('0x1b')],util[_0x0803('0x1a')](this['channels'][_0x16a181['uniqueid']],{'showHidden':![],'depth':null}));this[_0x0803('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0x0803('0xa')][_0x16a181['uniqueid']]);}}}}catch(_0x2ad30c){logger[_0x0803('0x35')]('[%s][voiceDialReport][varset]',_0x16a181[_0x0803('0x1b')],util[_0x0803('0x1a')](_0x2ad30c,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x195a38,_0x48adb2,_0x61a055){var _0x30f62c=[_0x0803('0x3f'),_0x0803('0x40'),'rtpaudioqosjitter',_0x0803('0x41'),'rtpaudioqosloss',_0x0803('0x42'),_0x0803('0x43'),_0x0803('0x44'),_0x0803('0x45'),_0x0803('0x46'),'bridgepeer','bridgepvtcallid',_0x0803('0x47'),_0x0803('0x48'),_0x0803('0x49'),_0x0803('0x4a'),'membername',_0x0803('0x4b'),'memberrealtime'];if(!_[_0x0803('0x4c')](_0x48adb2)&&!_[_0x0803('0x4d')](_0x30f62c,_0x48adb2)){if(_[_0x0803('0x16')](this[_0x0803('0x4e')][_0x195a38])){this[_0x0803('0x4e')][_0x195a38]={};}this[_0x0803('0x4e')][_0x195a38][_0x48adb2]=_0x61a055;}};VoiceDialReport[_0x0803('0x15')][_0x0803('0x14')]=function(_0x1470d0){try{if(this[_0x0803('0x18')](_0x1470d0)){logger[_0x0803('0x26')](_0x0803('0x4f'),_0x1470d0[_0x0803('0x1b')],util[_0x0803('0x1a')](_0x1470d0,{'showHidden':![],'depth':null}));if(this['channels'][_0x1470d0[_0x0803('0x1b')]]){logger[_0x0803('0x23')](_0x0803('0x50'),_0x1470d0['uniqueid'],_0x1470d0[_0x0803('0x51')]);this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x52')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1470d0[_0x0803('0x1b')]]['duration']=moment(this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x52')])[_0x0803('0x53')](this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x54')],_0x0803('0x55'));this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x31')]=_0x0803('0x56');this[_0x0803('0xc')]['total']+=0x1;if(this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x57')]){this[_0x0803('0xc')][_0x0803('0x58')]+=0x1;this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x59')]=moment(this['channels'][_0x1470d0['uniqueid']][_0x0803('0x57')])['diff'](this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]]['starttime'],_0x0803('0x55'));this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x5a')]=moment(this[_0x0803('0xa')][_0x1470d0['uniqueid']][_0x0803('0x52')])[_0x0803('0x53')](this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]]['answertime'],'seconds');this[_0x0803('0xc')]['sumHoldTime']+=this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]][_0x0803('0x59')]||0x0;this['outbound'][_0x0803('0x5b')]+=this[_0x0803('0xa')][_0x1470d0['uniqueid']][_0x0803('0x5a')];}this[_0x0803('0xc')][_0x0803('0x5c')]+=this[_0x0803('0xa')][_0x1470d0['uniqueid']][_0x0803('0x5d')];logger[_0x0803('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x1470d0[_0x0803('0x1b')],util[_0x0803('0x1a')](this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x0803('0x17')](_0x0803('0x5e'),this[_0x0803('0xa')][_0x1470d0['uniqueid']]);logger[_0x0803('0x26')](_0x0803('0x5f'),_0x1470d0[_0x0803('0x1b')],util[_0x0803('0x1a')](this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x0803('0x17')](_0x0803('0x60'),this['channels'][_0x1470d0[_0x0803('0x1b')]]);logger[_0x0803('0x26')](_0x0803('0x61'),_0x1470d0['uniqueid'],util[_0x0803('0x1a')](this['channels'][_0x1470d0[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));this[_0x0803('0x17')]('voice:outbound',_0x0803('0x62'),this[_0x0803('0xc')]);logger[_0x0803('0x23')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x0803('0x63')](this[_0x0803('0xa')][_0x1470d0['uniqueid']]));logger[_0x0803('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x1470d0[_0x0803('0x1b')],util[_0x0803('0x1a')](this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]],{'showHidden':![],'depth':null}));this[_0x0803('0x17')](_0x0803('0x34'),_0x0803('0x64'),this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]]);delete this[_0x0803('0xa')][_0x1470d0[_0x0803('0x1b')]];}else if(this[_0x0803('0xa')][_0x1470d0[_0x0803('0x65')]]){this[_0x0803('0xa')][_0x1470d0[_0x0803('0x65')]]['uniqueid']=this[_0x0803('0xa')][_0x1470d0['linkedid']][_0x0803('0x66')];}if(this[_0x0803('0x4e')][_0x1470d0['uniqueid']]){delete this[_0x0803('0x4e')][_0x1470d0[_0x0803('0x1b')]];}}}catch(_0x8ec7e6){logger[_0x0803('0x35')](_0x0803('0x67'),_0x1470d0[_0x0803('0x1b')],util['inspect'](_0x8ec7e6,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x4cec=['isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','memberpenalty','isNil','includes','variables','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','diff','starttime','complete','total','answered','seconds','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','outboundChannels','outbound','dialbegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','isNotNull','prototype','emit','syncDialBegin','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','channels','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','membername','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%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:','inspect','voice:outbound','error','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','value','variable','outboundrouteid'];(function(_0x5b6064,_0x376df5){var _0x1f5b14=function(_0x361967){while(--_0x361967){_0x5b6064['push'](_0x5b6064['shift']());}};_0x1f5b14(++_0x376df5);}(_0x4cec,0x10b));var _0xc4ce=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4cec[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xc4ce('0x0'));var moment=require(_0xc4ce('0x1'));var util=require(_0xc4ce('0x2'));var Redis=require(_0xc4ce('0x3'));var config=require('../../../config/environment');var logger=require(_0xc4ce('0x4'))(_0xc4ce('0x5'));var ami=require(_0xc4ce('0x6'));config[_0xc4ce('0x7')]=_[_0xc4ce('0x8')](config[_0xc4ce('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xc4ce('0x9'))(new Redis(config[_0xc4ce('0x7')]));function VoiceDialReport(_0x378a2a){this['channels']=_0x378a2a[_0xc4ce('0xa')];this[_0xc4ce('0xb')]=_0x378a2a[_0xc4ce('0xb')];this['variables']={};ami['on'](_0xc4ce('0xc'),this['syncDialBegin'][_0xc4ce('0xd')](this));ami['on'](_0xc4ce('0xe'),this[_0xc4ce('0xf')][_0xc4ce('0xd')](this));ami['on'](_0xc4ce('0x10'),this['syncVarSet']['bind'](this));ami['on'](_0xc4ce('0x11'),this[_0xc4ce('0x12')][_0xc4ce('0xd')](this));}VoiceDialReport['prototype'][_0xc4ce('0x13')]=function(_0x15b73e){return _0x15b73e!==null&&!_['isUndefined'](_0x15b73e);};VoiceDialReport[_0xc4ce('0x14')][_0xc4ce('0x15')]=function(_0x280aa4,_0x17cad1,_0x27c5a2){io['to'](_0x280aa4)[_0xc4ce('0x15')](_0x17cad1,_0x27c5a2);};VoiceDialReport[_0xc4ce('0x14')][_0xc4ce('0x16')]=function(_0x38c29c){try{if(this[_0xc4ce('0x13')](_0x38c29c)){logger['debug'](_0xc4ce('0x17'),_0x38c29c[_0xc4ce('0x18')],util['inspect'](_0x38c29c,{'showHidden':![],'depth':null}));if(this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]]){_['merge'](this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]],{'starttime':moment()['format'](_0xc4ce('0x1a')),'lastevent':_0xc4ce('0x1b'),'interface':_0x38c29c[_0xc4ce('0x1c')][_0xc4ce('0x1d')](0x0,_0x38c29c[_0xc4ce('0x1c')][_0xc4ce('0x1e')]('-')),'membername':_0x38c29c['channel'][_0xc4ce('0x1d')](_0x38c29c['channel'][_0xc4ce('0x1e')]('/')+0x1,_0x38c29c[_0xc4ce('0x1c')][_0xc4ce('0x1e')]('-'))},_[_0xc4ce('0x1f')](_0x38c29c,[_0xc4ce('0x20'),_0xc4ce('0x21')]));logger[_0xc4ce('0x22')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x38c29c[_0xc4ce('0x18')],this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]][_0xc4ce('0x23')],this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]]['interface']);logger[_0xc4ce('0x24')](_0xc4ce('0x25'),_0x38c29c[_0xc4ce('0x18')],util['inspect'](this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));this[_0xc4ce('0x15')]('voice:outbound',_0xc4ce('0x26'),this['channels'][_0x38c29c[_0xc4ce('0x18')]]);logger[_0xc4ce('0x24')](_0xc4ce('0x27'),_0x38c29c[_0xc4ce('0x18')],util['inspect'](this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));ami[_0xc4ce('0x15')](_0xc4ce('0x28'),this[_0xc4ce('0x19')][_0x38c29c[_0xc4ce('0x18')]]);}}}catch(_0x5e6b88){logger['error'](_0xc4ce('0x29'),_0x38c29c[_0xc4ce('0x18')],util['inspect'](_0x5e6b88,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc4ce('0x14')][_0xc4ce('0xf')]=function(_0x550dc4){try{if(this['isNotNull'](_0x550dc4)){logger[_0xc4ce('0x24')](_0xc4ce('0x2a'),_0x550dc4[_0xc4ce('0x18')],util['inspect'](_0x550dc4,{'showHidden':![],'depth':null}));if(this[_0xc4ce('0x19')][_0x550dc4[_0xc4ce('0x18')]]){this['channels'][_0x550dc4[_0xc4ce('0x18')]][_0xc4ce('0x2b')]=_0x550dc4['dialstatus'];if(_0x550dc4[_0xc4ce('0x2b')]===_0xc4ce('0x2c')){this[_0xc4ce('0x19')][_0x550dc4[_0xc4ce('0x18')]][_0xc4ce('0x2d')]=_0x550dc4['connectedlinenum'];this['channels'][_0x550dc4[_0xc4ce('0x18')]][_0xc4ce('0x2e')]=_0x550dc4[_0xc4ce('0x2e')];this[_0xc4ce('0x19')][_0x550dc4[_0xc4ce('0x18')]][_0xc4ce('0x2f')]=moment()[_0xc4ce('0x30')](_0xc4ce('0x1a'));this[_0xc4ce('0x19')][_0x550dc4['uniqueid']][_0xc4ce('0x31')]=_0xc4ce('0x32');logger['info'](_0xc4ce('0x33'),_0x550dc4[_0xc4ce('0x18')],_0x550dc4['channel']['substring'](_0x550dc4['channel'][_0xc4ce('0x1e')]('/')+0x1,_0x550dc4[_0xc4ce('0x1c')]['lastIndexOf']('-')));logger[_0xc4ce('0x24')](_0xc4ce('0x34'),_0x550dc4[_0xc4ce('0x18')],util[_0xc4ce('0x35')](this[_0xc4ce('0x19')][_0x550dc4['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0xc4ce('0x19')][_0x550dc4['uniqueid']]);}logger[_0xc4ce('0x24')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x550dc4['uniqueid'],util['inspect'](this['channels'][_0x550dc4[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));this[_0xc4ce('0x15')](_0xc4ce('0x36'),_0xc4ce('0x26'),this[_0xc4ce('0x19')][_0x550dc4[_0xc4ce('0x18')]]);}}}catch(_0x254d71){logger[_0xc4ce('0x37')](_0xc4ce('0x38'),_0x550dc4[_0xc4ce('0x18')],util[_0xc4ce('0x35')](_0x254d71,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc4ce('0x14')][_0xc4ce('0x39')]=function(_0x8a83d6){try{if(this['isNotNull'](_0x8a83d6)){logger[_0xc4ce('0x24')](_0xc4ce('0x3a'),_0x8a83d6[_0xc4ce('0x18')],util[_0xc4ce('0x35')](_0x8a83d6,{'showHidden':![],'depth':null}));this[_0xc4ce('0x3b')](_0x8a83d6['uniqueid'],_['keys'](_0x8a83d6['variable'])[0x0],_0x8a83d6[_0xc4ce('0x3c')]);if(this[_0xc4ce('0x13')](_0x8a83d6[_0xc4ce('0x3d')])&&this[_0xc4ce('0x13')](_0x8a83d6[_0xc4ce('0x3d')][_0xc4ce('0x3e')])){if(_[_0xc4ce('0x3f')](this[_0xc4ce('0x19')][_0x8a83d6[_0xc4ce('0x18')]])){this[_0xc4ce('0x19')][_0x8a83d6[_0xc4ce('0x18')]]={'routeId':_0x8a83d6[_0xc4ce('0x3c')],'variables':this['variables'][_0x8a83d6['uniqueid']]};logger['info'](_0xc4ce('0x40'),_0x8a83d6[_0xc4ce('0x18')],_0x8a83d6['variable'][_0xc4ce('0x3e')],_['keys'](_0x8a83d6[_0xc4ce('0x3d')])[0x0],_0x8a83d6[_0xc4ce('0x3c')]);logger[_0xc4ce('0x24')](_0xc4ce('0x41'),_0x8a83d6[_0xc4ce('0x18')],util[_0xc4ce('0x35')](this[_0xc4ce('0x19')][_0x8a83d6['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xc4ce('0x36'),'voice_outbound_channel:save',this[_0xc4ce('0x19')][_0x8a83d6[_0xc4ce('0x18')]]);}}}}catch(_0x1d210a){logger[_0xc4ce('0x37')](_0xc4ce('0x42'),_0x8a83d6[_0xc4ce('0x18')],util[_0xc4ce('0x35')](_0x1d210a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc4ce('0x14')][_0xc4ce('0x3b')]=function(_0x14d6a2,_0x4ad700,_0x18321e){var _0x2e1ec9=['rtpaudioqos',_0xc4ce('0x43'),_0xc4ce('0x44'),_0xc4ce('0x45'),'rtpaudioqosloss',_0xc4ce('0x46'),_0xc4ce('0x47'),_0xc4ce('0x48'),_0xc4ce('0x49'),_0xc4ce('0x4a'),_0xc4ce('0x4b'),'bridgepvtcallid',_0xc4ce('0x4c'),'memberdynamic',_0xc4ce('0x4d'),_0xc4ce('0x4e'),_0xc4ce('0x23'),_0xc4ce('0x4f'),'memberrealtime'];if(!_[_0xc4ce('0x50')](_0x4ad700)&&!_[_0xc4ce('0x51')](_0x2e1ec9,_0x4ad700)){if(_[_0xc4ce('0x3f')](this['variables'][_0x14d6a2])){this[_0xc4ce('0x52')][_0x14d6a2]={};}this[_0xc4ce('0x52')][_0x14d6a2][_0x4ad700]=_0x18321e;}};VoiceDialReport[_0xc4ce('0x14')][_0xc4ce('0x12')]=function(_0x5c0319){try{if(this['isNotNull'](_0x5c0319)){logger[_0xc4ce('0x24')](_0xc4ce('0x53'),_0x5c0319[_0xc4ce('0x18')],util[_0xc4ce('0x35')](_0x5c0319,{'showHidden':![],'depth':null}));if(this[_0xc4ce('0x19')][_0x5c0319['uniqueid']]){logger[_0xc4ce('0x22')](_0xc4ce('0x54'),_0x5c0319[_0xc4ce('0x18')],_0x5c0319['cause-txt']);this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x55')]=moment()[_0xc4ce('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x56')]=moment(this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x55')])[_0xc4ce('0x57')](this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x58')],'seconds');this[_0xc4ce('0x19')][_0x5c0319['uniqueid']][_0xc4ce('0x31')]=_0xc4ce('0x59');this[_0xc4ce('0xb')][_0xc4ce('0x5a')]+=0x1;if(this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x2f')]){this[_0xc4ce('0xb')][_0xc4ce('0x5b')]+=0x1;this['channels'][_0x5c0319['uniqueid']]['holdtime']=moment(this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x2f')])[_0xc4ce('0x57')](this['channels'][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x58')],_0xc4ce('0x5c'));this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x5d')]=moment(this['channels'][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x55')])[_0xc4ce('0x57')](this[_0xc4ce('0x19')][_0x5c0319['uniqueid']]['answertime'],_0xc4ce('0x5c'));this['outbound'][_0xc4ce('0x5e')]+=this[_0xc4ce('0x19')][_0x5c0319['uniqueid']][_0xc4ce('0x5f')]||0x0;this[_0xc4ce('0xb')][_0xc4ce('0x60')]+=this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]][_0xc4ce('0x5d')];}this[_0xc4ce('0xb')][_0xc4ce('0x61')]+=this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]]['duration'];logger[_0xc4ce('0x24')](_0xc4ce('0x62'),_0x5c0319[_0xc4ce('0x18')],util[_0xc4ce('0x35')](this['channels'][_0x5c0319[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));ami[_0xc4ce('0x15')](_0xc4ce('0x63'),this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]]);logger[_0xc4ce('0x24')](_0xc4ce('0x64'),_0x5c0319['uniqueid'],util['inspect'](this['channels'][_0x5c0319[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));ami[_0xc4ce('0x15')](_0xc4ce('0x65'),this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]]);logger[_0xc4ce('0x24')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x5c0319['uniqueid'],util[_0xc4ce('0x35')](this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));this[_0xc4ce('0x15')](_0xc4ce('0x36'),_0xc4ce('0x66'),this['outbound']);logger[_0xc4ce('0x22')](_0xc4ce('0x67'),JSON[_0xc4ce('0x68')](this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]]));logger[_0xc4ce('0x24')](_0xc4ce('0x69'),_0x5c0319[_0xc4ce('0x18')],util['inspect'](this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]],{'showHidden':![],'depth':null}));this[_0xc4ce('0x15')](_0xc4ce('0x36'),'voice_outbound_channel:remove',this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]]);delete this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x18')]];}else if(this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x6a')]]){this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x6a')]][_0xc4ce('0x18')]=this[_0xc4ce('0x19')][_0x5c0319[_0xc4ce('0x6a')]][_0xc4ce('0x6b')];}if(this[_0xc4ce('0x52')][_0x5c0319[_0xc4ce('0x18')]]){delete this['variables'][_0x5c0319[_0xc4ce('0x18')]];}}}catch(_0x346989){logger['error'](_0xc4ce('0x6c'),_0x5c0319[_0xc4ce('0x18')],util[_0xc4ce('0x35')](_0x346989,{'showHidden':![],'depth':null}));}};module[_0xc4ce('0x6d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index fc4627d..dc08ec5 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 _0x4024=['type','unmanaged','abandoned','Trunk','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','clearZombieChannels','Action','catch','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','available','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','isUndefined','queuecallerjoinAt','position','count','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerjoin]','isNotNull','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','seconds','queuecallerexitreason','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','milliseconds','diff','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfer','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','md5','ioredis','../../../config/logger','../ami','../model/queueReport','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','switch','enqueue','isNil','status','channel','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','emitVoiceQueueChannelSave','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','format','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total'];(function(_0x58f77c,_0xa95137){var _0x1cccb8=function(_0xc0fb84){while(--_0xc0fb84){_0x58f77c['push'](_0x58f77c['shift']());}};_0x1cccb8(++_0xa95137);}(_0x4024,0x89));var _0x4402=function(_0x575ae1,_0x503e8a){_0x575ae1=_0x575ae1-0x0;var _0x5caf9d=_0x4024[_0x575ae1];return _0x5caf9d;};'use strict';var _=require(_0x4402('0x0'));var moment=require(_0x4402('0x1'));var util=require('util');var md5=require(_0x4402('0x2'));var Redis=require(_0x4402('0x3'));var config=require('../../../config/environment');var logger=require(_0x4402('0x4'))('ami');var ami=require(_0x4402('0x5'));var QueueReport=require(_0x4402('0x6'));config['redis']=_['defaults'](config[_0x4402('0x7')],{'host':_0x4402('0x8'),'port':0x18eb});var io=require(_0x4402('0x9'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x4402('0xa')]['enqueue']=function(_0x5c0b70){this[_0x4402('0xb')]=this['tail']?this['tail'][_0x4402('0xc')](_0x5c0b70):_0x5c0b70();};function VoiceQueueReport(_0x4f56aa){this[_0x4402('0xd')]=new Sequence();this['queueReports']={};this[_0x4402('0xe')]=_0x4f56aa['agents'];this[_0x4402('0xf')]=_0x4f56aa[_0x4402('0x10')];this['voiceQueues']=_0x4f56aa[_0x4402('0x11')];this[_0x4402('0x12')]=!![];this[_0x4402('0x13')]=_0x4f56aa['campaigns'];this[_0x4402('0x14')]={};ami['on'](_0x4402('0x15'),this[_0x4402('0x16')][_0x4402('0x17')](this));ami['on'](_0x4402('0x18'),this[_0x4402('0x19')][_0x4402('0x17')](this));ami['on'](_0x4402('0x1a'),this[_0x4402('0x1b')][_0x4402('0x17')](this));ami['on'](_0x4402('0x1c'),this[_0x4402('0x1d')][_0x4402('0x17')](this));ami['on'](_0x4402('0x1e'),this[_0x4402('0x1f')][_0x4402('0x17')](this));ami['on'](_0x4402('0x20'),this[_0x4402('0x21')][_0x4402('0x17')](this));ami['on'](_0x4402('0x22'),this['syncAgentConnect']['bind'](this));ami['on'](_0x4402('0x23'),this[_0x4402('0x24')]['bind'](this));ami['on'](_0x4402('0x25'),this[_0x4402('0x26')]['bind'](this));ami['on'](_0x4402('0x27'),this['syncFullyBooted']['bind'](this));ami['on'](_0x4402('0x28'),this[_0x4402('0x29')][_0x4402('0x17')](this));ami['on']('musiconholdstop',this[_0x4402('0x2a')]['bind'](this));ami['on']('attendedtransfer',this[_0x4402('0x2b')][_0x4402('0x17')](this));ami['on'](_0x4402('0x2c'),this[_0x4402('0x2d')][_0x4402('0x17')](this));this[_0x4402('0x2e')]();this[_0x4402('0x2f')]();}function clearChannels(_0x6b1fc5){if(!_[_0x4402('0x30')](_0x6b1fc5)){for(var _0x4d6846 in _0x6b1fc5){if(_0x6b1fc5[_0x4402('0x31')](_0x4d6846)){delete _0x6b1fc5[_0x4d6846];}}}}function clearCampaigns(_0x4e1c04){if(!_[_0x4402('0x30')](_0x4e1c04)){for(var _0x5ab28d in _0x4e1c04){if(_0x4e1c04[_0x4402('0x31')](_0x5ab28d)){_0x4e1c04[_0x5ab28d][_0x4402('0x32')]=0x0;}}}}function clearVoiceQueues(_0x5a43d0){if(!_[_0x4402('0x30')](_0x5a43d0)){for(var _0x4e9cb5 in _0x5a43d0){if(_0x5a43d0['hasOwnProperty'](_0x4e9cb5)){_0x5a43d0[_0x4e9cb5][_0x4402('0x32')]=0x0;_0x5a43d0[_0x4e9cb5][_0x4402('0x33')]=0x0;_0x5a43d0[_0x4e9cb5][_0x4402('0x34')]=0x0;_0x5a43d0[_0x4e9cb5][_0x4402('0x35')]=0x0;_0x5a43d0[_0x4e9cb5][_0x4402('0x36')]=!![];}}}}function clearAgentBooked(_0x514e41){if(!_[_0x4402('0x30')](_0x514e41)){for(var _0x52e625 in _0x514e41){if(_0x514e41[_0x4402('0x31')](_0x52e625)){_0x514e41[_0x52e625][_0x4402('0x37')]=!![];}}}}VoiceQueueReport[_0x4402('0xa')]['clearZombieChannels']=function(){var _0x38037e=this;for(var _0x6c87f6 in this[_0x4402('0xf')]){if(this[_0x4402('0xf')][_0x4402('0x31')](_0x6c87f6)&&!this[_0x4402('0xf')][_0x6c87f6][_0x4402('0x38')]){this[_0x4402('0xd')][_0x4402('0x39')](function(){if(!_[_0x4402('0x3a')](_0x38037e[_0x4402('0xf')][_0x6c87f6])){return ami['Action']({'action':_0x4402('0x3b'),'channel':_0x38037e['channels'][_0x6c87f6][_0x4402('0x3c')]})['catch'](function(_0x2dea0f){if(_0x2dea0f[_0x4402('0x3d')]===_0x4402('0x3e')){setTimeout(function(){if(_0x38037e[_0x4402('0xf')][_0x6c87f6]){delete _0x38037e[_0x4402('0xf')][_0x6c87f6];logger['error'](_0x4402('0x3f'),_0x6c87f6,util[_0x4402('0x40')](_0x2dea0f,{'showHidden':![],'depth':null}));}if(_0x38037e[_0x4402('0x41')][_0x6c87f6]){delete _0x38037e['queueReports'][_0x6c87f6];logger[_0x4402('0x42')](_0x4402('0x43'),_0x6c87f6,util['inspect'](_0x2dea0f,{'showHidden':![],'depth':null}));}if(_0x38037e[_0x4402('0x14')][_0x6c87f6]){delete _0x38037e[_0x4402('0x14')][_0x6c87f6];logger[_0x4402('0x42')](_0x4402('0x44'),_0x6c87f6,util[_0x4402('0x40')](_0x2dea0f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x45')]=function(){logger[_0x4402('0x42')](_0x4402('0x46'));clearChannels(this['channels']);this[_0x4402('0x47')](this[_0x4402('0x41')]);clearAgentBooked(this[_0x4402('0xe')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x4402('0x13')]);};VoiceQueueReport[_0x4402('0xa')]['clearQueueReport']=function(_0x52f75f){var _0x2b9d51=this;if(!_[_0x4402('0x30')](_0x52f75f)){for(var _0x433c1e in _0x52f75f){if(_0x52f75f[_0x4402('0x31')](_0x433c1e)){_0x2b9d51['emitVoiceQueueChannelRemove'](_0x52f75f[_0x433c1e],'clearqueuereport');delete _0x52f75f[_0x433c1e];}}}};VoiceQueueReport['prototype'][_0x4402('0x48')]=function(_0x3f564f,_0xcbfa06,_0x3fd8ce){io['to'](_0x3f564f)['emit'](_0xcbfa06,_0x3fd8ce);};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x49')]=function(_0x35f877,_0x57843d){logger[_0x4402('0x4a')]('[%s][voiceQueueReport]['+_0x57843d+_0x4402('0x4b'),_0x35f877[_0x4402('0x4c')],util['inspect'](_0x35f877,{'showHidden':![],'depth':null}));this[_0x4402('0x48')](util['format'](_0x4402('0x4d'),_0x35f877[_0x4402('0x4e')]),'voice_queue_channel:save',_0x35f877);};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x4f')]=function(_0x250f09,_0x23c43a){logger['debug']('[%s][voiceQueueReport]['+_0x23c43a+_0x4402('0x50'),_0x250f09['uniqueid'],util[_0x4402('0x40')](_0x250f09,{'showHidden':![],'depth':null}));this[_0x4402('0x48')](util[_0x4402('0x51')](_0x4402('0x4d'),_0x250f09[_0x4402('0x4e')]),_0x4402('0x52'),_0x250f09);};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x53')]=function(_0x1f9b3e,_0x42812b){if(_0x1f9b3e['type']===_0x4402('0x54')){var _0x3236fc={'id':_0x1f9b3e['id'],'name':_0x1f9b3e['name'],'strategy':_0x1f9b3e[_0x4402('0x55')],'answered':_0x1f9b3e[_0x4402('0x56')],'available':_0x1f9b3e['available'],'loggedIn':_0x1f9b3e[_0x4402('0x57')],'pTalking':_0x1f9b3e[_0x4402('0x34')],'sumBillable':_0x1f9b3e[_0x4402('0x58')],'sumDuration':_0x1f9b3e[_0x4402('0x59')],'sumHoldTime':_0x1f9b3e[_0x4402('0x5a')]||0x0,'talking':_0x1f9b3e['talking'],'total':_0x1f9b3e[_0x4402('0x5b')],'type':_0x1f9b3e[_0x4402('0x5c')],'unmanaged':_0x1f9b3e[_0x4402('0x5d')],'abandoned':_0x1f9b3e[_0x4402('0x5e')],'waiting':_0x1f9b3e[_0x4402('0x35')]};if(_0x1f9b3e[_0x4402('0x5f')]){_0x3236fc[_0x4402('0x5f')]={'id':_0x1f9b3e[_0x4402('0x5f')]['id'],'name':_0x1f9b3e[_0x4402('0x5f')][_0x4402('0x4e')],'active':_0x1f9b3e[_0x4402('0x5f')]['active'],'callerid':_0x1f9b3e[_0x4402('0x5f')]['callerid']};}if(_0x1f9b3e[_0x4402('0x60')]){_0x3236fc[_0x4402('0x60')]={'id':_0x1f9b3e['Interval']['id'],'name':_0x1f9b3e[_0x4402('0x60')][_0x4402('0x4e')]};}var _0x2f2742=md5(JSON[_0x4402('0x61')](_0x3236fc));if(_0x1f9b3e[_0x4402('0x2')]!==_0x2f2742){_0x1f9b3e[_0x4402('0x2')]=_0x2f2742;logger['debug'](_0x4402('0x62')+_0x42812b+_0x4402('0x63'),util[_0x4402('0x40')](_0x3236fc,{'showHidden':![],'depth':null}));this[_0x4402('0x48')](util[_0x4402('0x51')](_0x4402('0x4d'),_0x3236fc[_0x4402('0x4e')]),_0x4402('0x64'),_0x3236fc);}}};VoiceQueueReport[_0x4402('0xa')]['isNotNull']=function(_0x4e7d5b){return _0x4e7d5b!==null&&!_['isUndefined'](_0x4e7d5b);};VoiceQueueReport['prototype'][_0x4402('0x2f')]=function(){var _0x29e67b=this;setInterval(function(){_0x29e67b[_0x4402('0x65')]();ami[_0x4402('0x66')]({'action':'queues'})[_0x4402('0x67')](function(_0x12d6de){logger[_0x4402('0x42')](_0x4402('0x68'),util[_0x4402('0x40')](_0x12d6de,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x2e')]=function(){var _0x53d306=this;setInterval(function(){if(_0x53d306[_0x4402('0x12')]){return ami[_0x4402('0x66')]({'action':_0x4402('0x15')})[_0x4402('0x69')](function(_0x266dfe){_0x53d306[_0x4402('0x12')]=![];})['catch'](function(_0xe8a8e9){logger[_0x4402('0x42')](_0x4402('0x6a'),util[_0x4402('0x40')](_0xe8a8e9,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x16')]=function(_0x137d88){try{if(this['isNotNull'](_0x137d88)&&this['isNotNull'](_0x137d88[_0x4402('0x6b')])){logger[_0x4402('0x4a')](_0x4402('0x6c'),util['inspect'](_0x137d88,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x137d88[_0x4402('0x6b')]]){logger[_0x4402('0x6d')](_0x4402('0x6e'),_0x137d88[_0x4402('0x6b')]);var _0x3ee2fe=_[_0x4402('0x6f')](this[_0x4402('0xf')],_0x4402('0x6b'))[_0x137d88[_0x4402('0x6b')]]||0x0;var _0x3f2599=_0x3ee2fe-_0x137d88[_0x4402('0x70')];if(this[_0x4402('0x11')][_0x137d88[_0x4402('0x6b')]]['waiting']!==_[_0x4402('0x71')](_0x137d88['callers'])||this[_0x4402('0x11')][_0x137d88['queue']][_0x4402('0x57')]!==_[_0x4402('0x71')](_0x137d88[_0x4402('0x72')])||this[_0x4402('0x11')][_0x137d88[_0x4402('0x6b')]][_0x4402('0x73')]!==_['toNumber'](_0x137d88[_0x4402('0x73')])||this[_0x4402('0x11')][_0x137d88[_0x4402('0x6b')]][_0x4402('0x33')]!==_0x3f2599){this[_0x4402('0x11')][_0x137d88['queue']][_0x4402('0x35')]=_[_0x4402('0x71')](_0x137d88[_0x4402('0x70')]);this[_0x4402('0x11')][_0x137d88[_0x4402('0x6b')]][_0x4402('0x57')]=_[_0x4402('0x71')](_0x137d88[_0x4402('0x72')]);this['voiceQueues'][_0x137d88[_0x4402('0x6b')]][_0x4402('0x73')]=_['toNumber'](_0x137d88[_0x4402('0x73')]);this[_0x4402('0x11')][_0x137d88['queue']]['talking']=_0x3f2599>0x0?_0x3f2599:0x0;this[_0x4402('0x11')][_0x137d88[_0x4402('0x6b')]][_0x4402('0x33')]=this['voiceQueues'][_0x137d88[_0x4402('0x6b')]][_0x4402('0x33')]>_[_0x4402('0x71')](_0x137d88['loggedin'])?_[_0x4402('0x71')](_0x137d88[_0x4402('0x72')]):this[_0x4402('0x11')][_0x137d88['queue']][_0x4402('0x33')];this[_0x4402('0x53')](this['voiceQueues'][_0x137d88['queue']],_0x4402('0x15'));}logger['debug'](_0x4402('0x74'),util[_0x4402('0x40')](this['voiceQueues'][_0x137d88['queue']],{'showHidden':![],'depth':null}));ami[_0x4402('0x48')](_0x4402('0x75'),this[_0x4402('0x11')][_0x137d88[_0x4402('0x6b')]]);}}}catch(_0x4ac95e){logger[_0x4402('0x42')](_0x4402('0x6a'),util[_0x4402('0x40')](_0x4ac95e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x19')]=function(_0x26b1ad){logger[_0x4402('0x4a')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x4402('0x40')](_0x26b1ad,{'showHidden':![],'depth':null}));this[_0x4402('0x12')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2bee9d){try{if(this['isNotNull'](_0x2bee9d)){logger[_0x4402('0x4a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2bee9d[_0x4402('0x4c')],util[_0x4402('0x40')](_0x2bee9d,{'showHidden':![],'depth':null}));if(_[_0x4402('0x76')](this[_0x4402('0x41')][_0x2bee9d[_0x4402('0x4c')]])){this[_0x4402('0x41')][_0x2bee9d[_0x4402('0x4c')]]=[];this[_0x4402('0xf')][_0x2bee9d[_0x4402('0x4c')]]={};}var _0x88864=new QueueReport();_0x88864[_0x4402('0x4e')]=_0x2bee9d[_0x4402('0x6b')];_0x88864[_0x4402('0x5c')]=this[_0x4402('0x11')][_0x88864[_0x4402('0x4e')]]&&this[_0x4402('0x11')][_0x88864['name']][_0x4402('0x5c')]?this[_0x4402('0x11')][_0x88864[_0x4402('0x4e')]]['type']||_0x4402('0x54'):'inbound';_0x88864[_0x4402('0x6b')]=_0x2bee9d[_0x4402('0x6b')];_0x88864[_0x4402('0x77')]=moment()[_0x4402('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x88864[_0x4402('0x78')]=_0x2bee9d['position'];_0x88864[_0x4402('0x79')]=_0x2bee9d[_0x4402('0x79')];_0x88864[_0x4402('0x4c')]=_0x2bee9d['uniqueid'];logger[_0x4402('0x6d')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x88864[_0x4402('0x4e')],_0x88864[_0x4402('0x5c')]);_[_0x4402('0x7a')](_0x88864,_[_0x4402('0x7b')](_0x2bee9d,_[_0x4402('0x7c')](_0x88864)));this[_0x4402('0x41')][_0x2bee9d[_0x4402('0x4c')]][_0x4402('0x7d')](_0x88864);this[_0x4402('0xf')][_0x2bee9d['uniqueid']]=_0x88864;this[_0x4402('0x49')](_0x88864,_0x4402('0x1a'));}}catch(_0x39b725){logger[_0x4402('0x42')](_0x4402('0x7e'),_0x2bee9d[_0x4402('0x4c')],util[_0x4402('0x40')](_0x39b725,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x1d')]=function(_0x5125b7){try{if(this[_0x4402('0x7f')](_0x5125b7)){logger[_0x4402('0x4a')](_0x4402('0x80'),_0x5125b7['uniqueid'],util[_0x4402('0x40')](_0x5125b7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5125b7[_0x4402('0x4c')]]){var _0x4f3d70=_[_0x4402('0x81')](this[_0x4402('0x41')][_0x5125b7['uniqueid']]);_0x4f3d70[_0x4402('0x82')]=![];_0x4f3d70['queuecallercompleteAt']=null;_0x4f3d70[_0x4402('0x83')]=_0x5125b7[_0x4402('0x83')];_0x4f3d70['originalposition']=_0x5125b7[_0x4402('0x84')];_0x4f3d70[_0x4402('0x1c')]=!![];_0x4f3d70['queuecallerabandonAt']=moment()[_0x4402('0x51')](_0x4402('0x85'));_0x4f3d70['queuecallerexitreason']=_0x4402('0x86');_0x4f3d70[_0x4402('0x87')]=null;logger[_0x4402('0x6d')](_0x4402('0x88'),_0x4f3d70[_0x4402('0x4e')],_0x4f3d70[_0x4402('0x5c')]);this[_0x4402('0xf')][_0x5125b7[_0x4402('0x4c')]]=_0x4f3d70;this[_0x4402('0x4f')](_0x4f3d70,_0x4402('0x1c'));}}}catch(_0xac63f6){logger[_0x4402('0x42')](_0x4402('0x80'),_0x5125b7[_0x4402('0x4c')],util['inspect'](_0xac63f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x1f')]=function(_0x4b9ac8){try{if(this[_0x4402('0x7f')](_0x4b9ac8)){logger['debug'](_0x4402('0x89'),_0x4b9ac8[_0x4402('0x4c')],util[_0x4402('0x40')](_0x4b9ac8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4b9ac8[_0x4402('0x4c')]]){var _0x26fc3a=_[_0x4402('0x81')](this['queueReports'][_0x4b9ac8[_0x4402('0x4c')]]);_0x26fc3a[_0x4402('0x8a')]=moment()[_0x4402('0x51')](_0x4402('0x85'));_0x26fc3a['connectedlinenum']=_0x4b9ac8[_0x4402('0x8b')];_0x26fc3a[_0x4402('0x8c')]=_0x4b9ac8[_0x4402('0x8c')];logger[_0x4402('0x6d')](_0x4402('0x8d'),_0x26fc3a[_0x4402('0x4e')],_0x26fc3a[_0x4402('0x5c')],_0x4b9ac8[_0x4402('0x8b')],_0x4b9ac8[_0x4402('0x8c')]);this[_0x4402('0xf')][_0x4b9ac8[_0x4402('0x4c')]]=_0x26fc3a;this[_0x4402('0x49')](_0x26fc3a,_0x4402('0x1e'));}}}catch(_0x532895){logger[_0x4402('0x42')](_0x4402('0x89'),_0x4b9ac8[_0x4402('0x4c')],util[_0x4402('0x40')](_0x532895,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x284b52){try{if(this[_0x4402('0x7f')](_0x284b52)){logger[_0x4402('0x4a')](_0x4402('0x8e'),_0x284b52['uniqueid'],util[_0x4402('0x40')](_0x284b52,{'showHidden':![],'depth':null}));if(this[_0x4402('0x41')][_0x284b52['uniqueid']]){var _0x16f5bb=_[_0x4402('0x81')](this[_0x4402('0x41')][_0x284b52[_0x4402('0x4c')]]);_0x16f5bb[_0x4402('0x82')]=!![];_0x16f5bb['queuecallerexitreason']=_0x4402('0x8f');logger[_0x4402('0x6d')](_0x4402('0x90'),_0x16f5bb[_0x4402('0x4e')],_0x16f5bb[_0x4402('0x5c')]);}}}catch(_0x1a2822){logger[_0x4402('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x284b52[_0x4402('0x4c')],util[_0x4402('0x40')](_0x1a2822,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x21')]=function(_0x2ea904){try{if(this['isNotNull'](_0x2ea904)){logger[_0x4402('0x4a')](_0x4402('0x91'),_0x2ea904['uniqueid'],util[_0x4402('0x40')](_0x2ea904,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2ea904['uniqueid']]){var _0x364a26=_['last'](this[_0x4402('0x41')][_0x2ea904['uniqueid']]);_0x364a26['queuecallerabandon']=![];_0x364a26[_0x4402('0x92')]=null;_0x364a26[_0x4402('0x93')]=!![];_0x364a26[_0x4402('0x87')]=_0x2ea904[_0x4402('0x94')];_0x364a26[_0x4402('0x83')]=_0x2ea904[_0x4402('0x83')];_0x364a26['queuecallercomplete']=!![];_0x364a26[_0x4402('0x95')]=![];_0x364a26[_0x4402('0x96')]=null;if(!_0x364a26['transfer']){if(_0x2ea904[_0x4402('0x97')]=='transfer'){_0x364a26['queuecallerexitreason']=_0x4402('0x98');logger['info'](_0x4402('0x99'),_0x364a26[_0x4402('0x4e')],_0x364a26[_0x4402('0x5c')]);}else{if(_[_0x4402('0x9a')](_0x2ea904[_0x4402('0x3c')]['toLowerCase'](),'local/')){if(this[_0x4402('0x41')][_0x2ea904[_0x4402('0x9b')]]){var _0x4c5cc6=_[_0x4402('0x81')](this[_0x4402('0x41')][_0x2ea904[_0x4402('0x9b')]]);_0x4c5cc6[_0x4402('0x82')]=![];_0x4c5cc6[_0x4402('0x95')]=!![];_0x4c5cc6[_0x4402('0x96')]=moment(_0x364a26['queuecallerjoinAt'])['add'](_0x2ea904[_0x4402('0x83')],_0x4402('0x9c'))[_0x4402('0x51')](_0x4402('0x85'));_0x4c5cc6[_0x4402('0x9d')]=_0x4402('0x9e');_0x4c5cc6['transfer']=!![];_0x4c5cc6[_0x4402('0x9f')]=_0x4402('0xa0');_0x4c5cc6[_0x4402('0xa1')]=_0x2ea904[_0x4402('0xa2')];_0x4c5cc6[_0x4402('0xa3')]=_0x2ea904['uniqueid'];logger[_0x4402('0x6d')](_0x4402('0xa4'),_0x4c5cc6[_0x4402('0x4e')],_0x4c5cc6[_0x4402('0x5c')]);var _0x3b89e8=this[_0x4402('0x41')][_0x2ea904['linkedid']];this['queueReports'][_0x2ea904[_0x4402('0x9b')]]=this['queueReports'][_0x2ea904[_0x4402('0x4c')]];this[_0x4402('0x41')][_0x2ea904[_0x4402('0x4c')]]=_0x3b89e8;}}else{_0x364a26[_0x4402('0x9d')]=_0x4402('0xa5')+_0x2ea904[_0x4402('0x97')][_0x4402('0xa6')]();logger[_0x4402('0x6d')](_0x4402('0xa7'),_0x364a26[_0x4402('0x4e')],_0x364a26[_0x4402('0x5c')],_0x364a26[_0x4402('0x9d')]);}}}this[_0x4402('0xf')][_0x2ea904[_0x4402('0x4c')]]=_0x364a26;this[_0x4402('0x4f')](_0x364a26,_0x4402('0x20'));}}}catch(_0x3826d9){logger[_0x4402('0x42')](_0x4402('0x91'),_0x2ea904[_0x4402('0x4c')],util[_0x4402('0x40')](_0x3826d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x24')]=function(_0x47a76a){try{if(this[_0x4402('0x7f')](_0x47a76a)){logger[_0x4402('0x4a')](_0x4402('0xa8'),_0x47a76a[_0x4402('0x4c')],util[_0x4402('0x40')](_0x47a76a,{'showHidden':![],'depth':null}));this[_0x4402('0xa9')](_0x47a76a['uniqueid'],_['keys'](_0x47a76a[_0x4402('0xaa')])[0x0],_0x47a76a[_0x4402('0xab')]);if(this[_0x4402('0x41')][_0x47a76a['uniqueid']]){var _0x5cf8ae=_['last'](this['queueReports'][_0x47a76a[_0x4402('0x4c')]]);if(_0x5cf8ae){if(this[_0x4402('0x7f')](_0x47a76a[_0x4402('0xaa')])&&this['isNotNull'](_0x47a76a[_0x4402('0xaa')][_0x4402('0xac')])){switch(_0x47a76a[_0x4402('0xab')]){case'CONTINUE':_0x5cf8ae[_0x4402('0x95')]=![];_0x5cf8ae['queuecallerexitAt']=null;break;case _0x4402('0xad'):_0x5cf8ae[_0x4402('0xae')]=_0x4402('0xaf');_0x5cf8ae[_0x4402('0x95')]=!![];_0x5cf8ae[_0x4402('0x96')]=moment()[_0x4402('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cf8ae[_0x4402('0x8a')]=moment()[_0x4402('0x51')](_0x4402('0x85'));logger['debug'](_0x4402('0xb0'),_0x47a76a['uniqueid'],util[_0x4402('0x40')](_0x5cf8ae,{'showHidden':![],'depth':null}));ami[_0x4402('0x48')](_0x4402('0xb1'),_0x5cf8ae);break;default:_0x5cf8ae[_0x4402('0x95')]=!![];_0x5cf8ae['queuecallerexitAt']=moment()[_0x4402('0x51')](_0x4402('0x85'));_0x5cf8ae[_0x4402('0x8a')]=moment()[_0x4402('0x51')](_0x4402('0x85'));}_0x5cf8ae['queuecallerabandon']=![];_0x5cf8ae[_0x4402('0x92')]=null;_0x5cf8ae[_0x4402('0x9d')]=_0x47a76a['value'];this['channels'][_0x47a76a['uniqueid']]=_0x5cf8ae;this[_0x4402('0x4f')](_0x5cf8ae,_0x4402('0x23'));}else if(this[_0x4402('0x7f')](_0x47a76a[_0x4402('0xaa')])&&this['isNotNull'](_0x47a76a[_0x4402('0xaa')][_0x4402('0xb2')])){if(!_0x5cf8ae[_0x4402('0x1c')]){_0x5cf8ae[_0x4402('0x95')]=!![];_0x5cf8ae['queuecallerexitAt']=moment()[_0x4402('0x51')](_0x4402('0x85'));_0x5cf8ae[_0x4402('0x9d')]='EXITWITHKEY';_0x5cf8ae['queuecallerleaveAt']=moment()['format'](_0x4402('0x85'));this['channels'][_0x47a76a[_0x4402('0x4c')]]=_0x5cf8ae;}}logger[_0x4402('0x6d')](_0x4402('0xb3'),_0x47a76a[_0x4402('0x4c')],_0x5cf8ae[_0x4402('0x4e')],_0x5cf8ae[_0x4402('0x5c')],_[_0x4402('0x7c')](_0x47a76a[_0x4402('0xaa')])[0x0],_0x47a76a[_0x4402('0xab')]);_0x5cf8ae[_0x4402('0x14')]=this[_0x4402('0x14')][_0x47a76a[_0x4402('0x4c')]];}}}}catch(_0x27f10c){logger[_0x4402('0x42')]('[%s][voiceQueueReport][varset]',_0x47a76a[_0x4402('0x4c')],util[_0x4402('0x40')](_0x27f10c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x57fd83,_0x1aacd7,_0x5a3ec8){var _0x47aa8b=[_0x4402('0xb4'),_0x4402('0xb5'),'rtpaudioqosjitter',_0x4402('0xb6'),_0x4402('0xb7'),_0x4402('0xb8'),_0x4402('0xb9'),'rtpaudioqosrttbridged',_0x4402('0xba'),_0x4402('0xbb'),_0x4402('0xbc'),_0x4402('0xbd'),_0x4402('0xbe'),_0x4402('0xbf'),_0x4402('0xc0'),_0x4402('0xc1'),_0x4402('0x94'),'memberpenalty',_0x4402('0xc2')];if(!_[_0x4402('0x3a')](_0x1aacd7)&&!_[_0x4402('0xc3')](_0x47aa8b,_0x1aacd7)){if(_[_0x4402('0x76')](this['variables'][_0x57fd83])){this[_0x4402('0x14')][_0x57fd83]={};}this['variables'][_0x57fd83][_0x1aacd7]=_0x5a3ec8;}};VoiceQueueReport[_0x4402('0xa')][_0x4402('0x26')]=function(_0x551dbc){try{if(this['isNotNull'](_0x551dbc)){logger[_0x4402('0x4a')](_0x4402('0xc4'),_0x551dbc[_0x4402('0x4c')],util[_0x4402('0x40')](_0x551dbc,{'showHidden':![],'depth':null}));if(this[_0x4402('0x41')][_0x551dbc[_0x4402('0x4c')]]){for(var _0x567c59=0x0,_0x57c89e={};_0x567c590x0?_0x1291be:0x0;this['voiceQueues'][_0x478f6e[_0x3c89('0x62')]][_0x3c89('0x69')]=this[_0x3c89('0x11')][_0x478f6e[_0x3c89('0x62')]][_0x3c89('0x69')]>_['toNumber'](_0x478f6e[_0x3c89('0x68')])?_[_0x3c89('0x66')](_0x478f6e[_0x3c89('0x68')]):this[_0x3c89('0x11')][_0x478f6e[_0x3c89('0x62')]][_0x3c89('0x69')];this['emitVoiceQueueSummary'](this[_0x3c89('0x11')][_0x478f6e[_0x3c89('0x62')]],_0x3c89('0x15'));}logger[_0x3c89('0x49')](_0x3c89('0x6b'),util[_0x3c89('0x3f')](this[_0x3c89('0x11')][_0x478f6e[_0x3c89('0x62')]],{'showHidden':![],'depth':null}));ami[_0x3c89('0x47')](_0x3c89('0x6c'),this[_0x3c89('0x11')][_0x478f6e[_0x3c89('0x62')]]);}}}catch(_0x7af411){logger[_0x3c89('0x3e')](_0x3c89('0x61'),util[_0x3c89('0x3f')](_0x7af411,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3c89('0xb')][_0x3c89('0x6d')]=function(_0x2eba23){logger['debug'](_0x3c89('0x6e'),util[_0x3c89('0x3f')](_0x2eba23,{'showHidden':![],'depth':null}));this[_0x3c89('0x12')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0xdb4ab3){try{if(this['isNotNull'](_0xdb4ab3)){logger[_0x3c89('0x49')](_0x3c89('0x6f'),_0xdb4ab3[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0xdb4ab3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3c89('0x40')][_0xdb4ab3[_0x3c89('0x4f')]])){this[_0x3c89('0x40')][_0xdb4ab3[_0x3c89('0x4f')]]=[];this[_0x3c89('0xf')][_0xdb4ab3[_0x3c89('0x4f')]]={};}var _0x504eca=new QueueReport();_0x504eca[_0x3c89('0x4c')]=_0xdb4ab3['queue'];_0x504eca[_0x3c89('0x50')]=this[_0x3c89('0x11')][_0x504eca[_0x3c89('0x4c')]]&&this[_0x3c89('0x11')][_0x504eca[_0x3c89('0x4c')]][_0x3c89('0x50')]?this['voiceQueues'][_0x504eca[_0x3c89('0x4c')]][_0x3c89('0x50')]||_0x3c89('0x51'):_0x3c89('0x51');_0x504eca[_0x3c89('0x62')]=_0xdb4ab3['queue'];_0x504eca[_0x3c89('0x70')]=moment()[_0x3c89('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x504eca['position']=_0xdb4ab3[_0x3c89('0x71')];_0x504eca['count']=_0xdb4ab3[_0x3c89('0x72')];_0x504eca[_0x3c89('0x4f')]=_0xdb4ab3[_0x3c89('0x4f')];logger[_0x3c89('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x504eca[_0x3c89('0x4c')],_0x504eca[_0x3c89('0x50')]);_[_0x3c89('0x74')](_0x504eca,_[_0x3c89('0x75')](_0xdb4ab3,_['keys'](_0x504eca)));this['queueReports'][_0xdb4ab3[_0x3c89('0x4f')]][_0x3c89('0x76')](_0x504eca);this[_0x3c89('0xf')][_0xdb4ab3[_0x3c89('0x4f')]]=_0x504eca;this[_0x3c89('0x48')](_0x504eca,_0x3c89('0x19'));}}catch(_0x273f6b){logger[_0x3c89('0x3e')](_0x3c89('0x6f'),_0xdb4ab3[_0x3c89('0x4f')],util['inspect'](_0x273f6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3c89('0xb')][_0x3c89('0x1c')]=function(_0x395cb0){try{if(this[_0x3c89('0x5d')](_0x395cb0)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x395cb0[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0x395cb0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x395cb0['uniqueid']]){var _0x23958f=_[_0x3c89('0x77')](this[_0x3c89('0x40')][_0x395cb0[_0x3c89('0x4f')]]);_0x23958f[_0x3c89('0x78')]=![];_0x23958f[_0x3c89('0x79')]=null;_0x23958f[_0x3c89('0x7a')]=_0x395cb0['holdtime'];_0x23958f[_0x3c89('0x7b')]=_0x395cb0[_0x3c89('0x7b')];_0x23958f[_0x3c89('0x1b')]=!![];_0x23958f['queuecallerabandonAt']=moment()[_0x3c89('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x23958f[_0x3c89('0x7c')]=_0x3c89('0x7d');_0x23958f[_0x3c89('0x7e')]=null;logger[_0x3c89('0x73')](_0x3c89('0x7f'),_0x23958f[_0x3c89('0x4c')],_0x23958f[_0x3c89('0x50')]);this[_0x3c89('0xf')][_0x395cb0['uniqueid']]=_0x23958f;this[_0x3c89('0x45')](_0x23958f,_0x3c89('0x1b'));}}}catch(_0x23bf9c){logger['error'](_0x3c89('0x80'),_0x395cb0[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0x23bf9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3c89('0x1e')]=function(_0x548ad2){try{if(this['isNotNull'](_0x548ad2)){logger['debug'](_0x3c89('0x81'),_0x548ad2[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0x548ad2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x548ad2['uniqueid']]){var _0xcabc41=_[_0x3c89('0x77')](this['queueReports'][_0x548ad2['uniqueid']]);_0xcabc41[_0x3c89('0x82')]=moment()['format'](_0x3c89('0x83'));_0xcabc41[_0x3c89('0x84')]=_0x548ad2['connectedlinenum'];_0xcabc41[_0x3c89('0x85')]=_0x548ad2[_0x3c89('0x85')];logger[_0x3c89('0x73')](_0x3c89('0x86'),_0xcabc41[_0x3c89('0x4c')],_0xcabc41['type'],_0x548ad2['connectedlinenum'],_0x548ad2[_0x3c89('0x85')]);this['channels'][_0x548ad2[_0x3c89('0x4f')]]=_0xcabc41;this['emitVoiceQueueChannelSave'](_0xcabc41,'queuecallerleave');}}}catch(_0x375944){logger[_0x3c89('0x3e')](_0x3c89('0x81'),_0x548ad2['uniqueid'],util['inspect'](_0x375944,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3c89('0x21')]=function(_0x16c45e){try{if(this['isNotNull'](_0x16c45e)){logger[_0x3c89('0x49')](_0x3c89('0x87'),_0x16c45e['uniqueid'],util[_0x3c89('0x3f')](_0x16c45e,{'showHidden':![],'depth':null}));if(this[_0x3c89('0x40')][_0x16c45e[_0x3c89('0x4f')]]){var _0x304ce8=_[_0x3c89('0x77')](this[_0x3c89('0x40')][_0x16c45e[_0x3c89('0x4f')]]);_0x304ce8[_0x3c89('0x78')]=!![];_0x304ce8['queuecallerexitreason']=_0x3c89('0x88');logger[_0x3c89('0x73')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x304ce8[_0x3c89('0x4c')],_0x304ce8[_0x3c89('0x50')]);}}}catch(_0x25fdb0){logger['error'](_0x3c89('0x87'),_0x16c45e[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0x25fdb0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3c89('0xb')][_0x3c89('0x89')]=function(_0x1540f2){try{if(this[_0x3c89('0x5d')](_0x1540f2)){logger[_0x3c89('0x49')]('[%s][voiceQueueReport][agentcomplete]',_0x1540f2[_0x3c89('0x4f')],util['inspect'](_0x1540f2,{'showHidden':![],'depth':null}));if(this[_0x3c89('0x40')][_0x1540f2['uniqueid']]){var _0x42f842=_[_0x3c89('0x77')](this[_0x3c89('0x40')][_0x1540f2[_0x3c89('0x4f')]]);_0x42f842[_0x3c89('0x1b')]=![];_0x42f842['queuecallerabandonAt']=null;_0x42f842[_0x3c89('0x8a')]=!![];_0x42f842[_0x3c89('0x7e')]=_0x1540f2[_0x3c89('0x8b')];_0x42f842[_0x3c89('0x7a')]=_0x1540f2[_0x3c89('0x7a')];_0x42f842[_0x3c89('0x78')]=!![];_0x42f842[_0x3c89('0x8c')]=![];_0x42f842[_0x3c89('0x8d')]=null;if(!_0x42f842['transfer']){if(_0x1540f2[_0x3c89('0x8e')]==_0x3c89('0x8f')){_0x42f842[_0x3c89('0x7c')]=_0x3c89('0x90');logger[_0x3c89('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x42f842[_0x3c89('0x4c')],_0x42f842[_0x3c89('0x50')]);}else{if(_[_0x3c89('0x91')](_0x1540f2['channel']['toLowerCase'](),'local/')){if(this[_0x3c89('0x40')][_0x1540f2[_0x3c89('0x92')]]){var _0x263939=_[_0x3c89('0x77')](this[_0x3c89('0x40')][_0x1540f2[_0x3c89('0x92')]]);_0x263939[_0x3c89('0x78')]=![];_0x263939[_0x3c89('0x8c')]=!![];_0x263939[_0x3c89('0x8d')]=moment(_0x42f842[_0x3c89('0x70')])[_0x3c89('0x93')](_0x1540f2[_0x3c89('0x7a')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x263939['queuecallerexitreason']=_0x3c89('0x94');_0x263939['transfer']=!![];_0x263939[_0x3c89('0x95')]=_0x3c89('0x96');_0x263939[_0x3c89('0x97')]=_0x1540f2[_0x3c89('0x98')];_0x263939[_0x3c89('0x99')]=_0x1540f2[_0x3c89('0x4f')];logger[_0x3c89('0x73')](_0x3c89('0x9a'),_0x263939[_0x3c89('0x4c')],_0x263939[_0x3c89('0x50')]);var _0x362b2f=this['queueReports'][_0x1540f2[_0x3c89('0x92')]];this[_0x3c89('0x40')][_0x1540f2['linkedid']]=this['queueReports'][_0x1540f2[_0x3c89('0x4f')]];this[_0x3c89('0x40')][_0x1540f2[_0x3c89('0x4f')]]=_0x362b2f;}}else{_0x42f842[_0x3c89('0x7c')]=_0x3c89('0x9b')+_0x1540f2[_0x3c89('0x8e')][_0x3c89('0x9c')]();logger[_0x3c89('0x73')](_0x3c89('0x9d'),_0x42f842[_0x3c89('0x4c')],_0x42f842[_0x3c89('0x50')],_0x42f842[_0x3c89('0x7c')]);}}}this[_0x3c89('0xf')][_0x1540f2[_0x3c89('0x4f')]]=_0x42f842;this[_0x3c89('0x45')](_0x42f842,_0x3c89('0x1f'));}}}catch(_0x1fcfc4){logger[_0x3c89('0x3e')](_0x3c89('0x9e'),_0x1540f2[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0x1fcfc4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3c89('0xb')][_0x3c89('0x22')]=function(_0xb0e2dd){try{if(this[_0x3c89('0x5d')](_0xb0e2dd)){logger['debug'](_0x3c89('0x9f'),_0xb0e2dd['uniqueid'],util[_0x3c89('0x3f')](_0xb0e2dd,{'showHidden':![],'depth':null}));this[_0x3c89('0xa0')](_0xb0e2dd[_0x3c89('0x4f')],_['keys'](_0xb0e2dd['variable'])[0x0],_0xb0e2dd[_0x3c89('0xa1')]);if(this[_0x3c89('0x40')][_0xb0e2dd[_0x3c89('0x4f')]]){var _0x2fe4f0=_['last'](this[_0x3c89('0x40')][_0xb0e2dd[_0x3c89('0x4f')]]);if(_0x2fe4f0){if(this['isNotNull'](_0xb0e2dd[_0x3c89('0xa2')])&&this[_0x3c89('0x5d')](_0xb0e2dd[_0x3c89('0xa2')][_0x3c89('0xa3')])){switch(_0xb0e2dd[_0x3c89('0xa1')]){case _0x3c89('0xa4'):_0x2fe4f0[_0x3c89('0x8c')]=![];_0x2fe4f0[_0x3c89('0x8d')]=null;break;case _0x3c89('0xa5'):_0x2fe4f0[_0x3c89('0xa6')]=_0x3c89('0xa7');_0x2fe4f0[_0x3c89('0x8c')]=!![];_0x2fe4f0['queuecallerexitAt']=moment()[_0x3c89('0x4a')](_0x3c89('0x83'));_0x2fe4f0[_0x3c89('0x82')]=moment()[_0x3c89('0x4a')](_0x3c89('0x83'));logger[_0x3c89('0x49')](_0x3c89('0xa8'),_0xb0e2dd[_0x3c89('0x4f')],util[_0x3c89('0x3f')](_0x2fe4f0,{'showHidden':![],'depth':null}));ami[_0x3c89('0x47')](_0x3c89('0xa9'),_0x2fe4f0);break;default:_0x2fe4f0[_0x3c89('0x8c')]=!![];_0x2fe4f0[_0x3c89('0x8d')]=moment()['format'](_0x3c89('0x83'));_0x2fe4f0['queuecallerleaveAt']=moment()[_0x3c89('0x4a')](_0x3c89('0x83'));}_0x2fe4f0[_0x3c89('0x1b')]=![];_0x2fe4f0[_0x3c89('0xaa')]=null;_0x2fe4f0[_0x3c89('0x7c')]=_0xb0e2dd[_0x3c89('0xa1')];this[_0x3c89('0xf')][_0xb0e2dd[_0x3c89('0x4f')]]=_0x2fe4f0;this[_0x3c89('0x45')](_0x2fe4f0,_0x3c89('0xab'));}else if(this[_0x3c89('0x5d')](_0xb0e2dd['variable'])&&this[_0x3c89('0x5d')](_0xb0e2dd['variable'][_0x3c89('0xac')])){if(!_0x2fe4f0[_0x3c89('0x1b')]){_0x2fe4f0[_0x3c89('0x8c')]=!![];_0x2fe4f0[_0x3c89('0x8d')]=moment()[_0x3c89('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x2fe4f0[_0x3c89('0x7c')]=_0x3c89('0xad');_0x2fe4f0[_0x3c89('0x82')]=moment()[_0x3c89('0x4a')](_0x3c89('0x83'));this[_0x3c89('0xf')][_0xb0e2dd[_0x3c89('0x4f')]]=_0x2fe4f0;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0xb0e2dd['uniqueid'],_0x2fe4f0[_0x3c89('0x4c')],_0x2fe4f0[_0x3c89('0x50')],_['keys'](_0xb0e2dd[_0x3c89('0xa2')])[0x0],_0xb0e2dd[_0x3c89('0xa1')]);_0x2fe4f0['variables']=this['variables'][_0xb0e2dd[_0x3c89('0x4f')]];}}}}catch(_0x190139){logger[_0x3c89('0x3e')](_0x3c89('0x9f'),_0xb0e2dd[_0x3c89('0x4f')],util['inspect'](_0x190139,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3c89('0xb')]['addVariable']=function(_0x59265d,_0x15a227,_0x9993a7){var _0x5bb987=['rtpaudioqos',_0x3c89('0xae'),_0x3c89('0xaf'),_0x3c89('0xb0'),_0x3c89('0xb1'),_0x3c89('0xb2'),_0x3c89('0xb3'),_0x3c89('0xb4'),_0x3c89('0xb5'),_0x3c89('0xb6'),'bridgepeer',_0x3c89('0xb7'),'membercalls',_0x3c89('0xb8'),'memberinterface',_0x3c89('0xb9'),_0x3c89('0x8b'),'memberpenalty',_0x3c89('0xba')];if(!_['isNil'](_0x15a227)&&!_[_0x3c89('0xbb')](_0x5bb987,_0x15a227)){if(_['isUndefined'](this[_0x3c89('0x14')][_0x59265d])){this[_0x3c89('0x14')][_0x59265d]={};}this[_0x3c89('0x14')][_0x59265d][_0x15a227]=_0x9993a7;}};VoiceQueueReport[_0x3c89('0xb')][_0x3c89('0x24')]=function(_0x41d2f3){try{if(this[_0x3c89('0x5d')](_0x41d2f3)){logger[_0x3c89('0x49')](_0x3c89('0xbc'),_0x41d2f3[_0x3c89('0x4f')],util['inspect'](_0x41d2f3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41d2f3['uniqueid']]){for(var _0x33f32b=0x0,_0x3a1948={};_0x33f32b=0x0?moment(_0x3cbbcc['endtime'])[_0x60fa('0xe')](_0x3cbbcc[_0x60fa('0x1a')],_0x60fa('0x1b')):null,'data1':'outbound','data2':_0x3cbbcc[_0x60fa('0x15')],'data3':_0x3cbbcc[_0x60fa('0x12')],'data4':_0x3cbbcc[_0x60fa('0x1c')]||null,'role':_0x60fa('0x14'),'internal':_0x3cbbcc[_0x60fa('0x15')]?_['toNumber'](_0x3cbbcc[_0x60fa('0x15')]):undefined,'uniqueid':_0x3cbbcc[_0x60fa('0x17')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x5809=['queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','queue','agent','uniqueid','voiceDialReport','starttime','endtime','outbound','dialstring','accountcode','moment','lodash','util','../client','voiceQueueReport'];(function(_0x111fec,_0x55932a){var _0x13b1a4=function(_0x175fda){while(--_0x175fda){_0x111fec['push'](_0x111fec['shift']());}};_0x13b1a4(++_0x55932a);}(_0x5809,0xdb));var _0x9580=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5809[_0x4a9fb1];return _0x348672;};'use strict';var moment=require(_0x9580('0x0'));var _=require(_0x9580('0x1'));var util=require(_0x9580('0x2'));var client=require(_0x9580('0x3'));exports[_0x9580('0x4')]=function(_0x6a5e16){var _0x57ab86=_0x6a5e16[_0x9580('0x5')]||_0x6a5e16[_0x9580('0x6')];return client[_0x9580('0x7')](_0x9580('0x8'),{'body':{'channel':_0x9580('0x9'),'membername':_0x6a5e16['lastAssignedTo'],'interface':_['isNil'](_0x6a5e16[_0x9580('0xa')])?util[_0x9580('0xb')](_0x9580('0xc'),_0x6a5e16[_0x9580('0xd')]):_0x6a5e16[_0x9580('0xa')],'type':_0x9580('0xe'),'enterAt':_0x6a5e16[_0x9580('0xf')],'exitAt':_0x57ab86,'duration':moment(_0x57ab86)[_0x9580('0x10')](_0x6a5e16[_0x9580('0xf')],_0x9580('0x11')),'data1':_0x9580('0x12'),'data2':_0x6a5e16['calleridnum'],'data3':_0x6a5e16['exten'],'data4':null,'data5':_0x6a5e16[_0x9580('0x13')],'role':_0x9580('0x14'),'internal':_0x6a5e16['accountcode']?_['toNumber'](_0x6a5e16['accountcode']):undefined,'uniqueid':_0x6a5e16[_0x9580('0x15')]},'log':_0x9580('0x8')});};exports[_0x9580('0x16')]=function(_0x5651d4){return client[_0x9580('0x7')](_0x9580('0x8'),{'body':{'channel':_0x9580('0x9'),'membername':_0x5651d4['membername'],'interface':_0x5651d4[_0x9580('0xa')],'type':_0x9580('0xe'),'enterAt':_0x5651d4[_0x9580('0x17')],'exitAt':_0x5651d4[_0x9580('0x18')],'duration':moment(_0x5651d4[_0x9580('0x18')])['diff'](_0x5651d4['starttime'],'seconds')>=0x0?moment(_0x5651d4[_0x9580('0x18')])['diff'](_0x5651d4[_0x9580('0x17')],'seconds'):null,'data1':_0x9580('0x19'),'data2':_0x5651d4['accountcode'],'data3':_0x5651d4['exten'],'data4':_0x5651d4[_0x9580('0x1a')]||null,'role':_0x9580('0x14'),'internal':_0x5651d4['accountcode']?_['toNumber'](_0x5651d4[_0x9580('0x1b')]):undefined,'uniqueid':_0x5651d4['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index bfd039d..aebdc1b 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 _0xbf6e=['html','Request','GetTemplate','name'];(function(_0x20d7c8,_0x4347cc){var _0x25b1fc=function(_0x549d56){while(--_0x549d56){_0x20d7c8['push'](_0x20d7c8['shift']());}};_0x25b1fc(++_0x4347cc);}(_0xbf6e,0x149));var _0xebf6=function(_0x295e7f,_0x1a4d59){_0x295e7f=_0x295e7f-0x0;var _0xdb8b56=_0xbf6e[_0x295e7f];return _0xdb8b56;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x1f94d5){return function(_0x2b658d){return client[_0xebf6('0x0')](_0xebf6('0x1'),{'options':{'raw':!![],'attributes':['id',_0xebf6('0x2'),_0xebf6('0x3')]},'log':_0xebf6('0x1')});};}; \ No newline at end of file +var _0x153f=['GetTemplate','name','../client','getTemplates','Request'];(function(_0x5d3cbe,_0x5c2cb4){var _0x4a88fc=function(_0x439f14){while(--_0x439f14){_0x5d3cbe['push'](_0x5d3cbe['shift']());}};_0x4a88fc(++_0x5c2cb4);}(_0x153f,0x15b));var _0xf153=function(_0x5a6e69,_0x1fd76c){_0x5a6e69=_0x5a6e69-0x0;var _0x1318db=_0x153f[_0x5a6e69];return _0x1318db;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return function(_0x44cea3){return client[_0xf153('0x2')](_0xf153('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf153('0x4'),'html']},'log':_0xf153('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 3c3d232..31c1f85 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 _0xd87f=['operator','value','Condition','AnyConditions','Action','Actions','data1','data2','data3','data4','data7','../client','getTriggers','Request','GetTrigger','name','channel','AllConditions','field'];(function(_0x572637,_0x216d95){var _0xb6748=function(_0x3eeb8c){while(--_0x3eeb8c){_0x572637['push'](_0x572637['shift']());}};_0xb6748(++_0x216d95);}(_0xd87f,0xdc));var _0xfd87=function(_0x185e54,_0x512708){_0x185e54=_0x185e54-0x0;var _0x1a830a=_0xd87f[_0x185e54];return _0x1a830a;};'use strict';var client=require(_0xfd87('0x0'));exports[_0xfd87('0x1')]=function(_0x2b379e){return function(_0x5bd3b5){return client[_0xfd87('0x2')](_0xfd87('0x3'),{'options':{'raw':![],'attributes':['id',_0xfd87('0x4'),_0xfd87('0x5'),'status'],'include':[{'model':'Condition','as':_0xfd87('0x6'),'attributes':['id',_0xfd87('0x7'),_0xfd87('0x8'),_0xfd87('0x9')]},{'model':_0xfd87('0xa'),'as':_0xfd87('0xb'),'attributes':['id',_0xfd87('0x7'),_0xfd87('0x8'),'value']},{'model':_0xfd87('0xc'),'as':_0xfd87('0xd'),'attributes':['id','action',_0xfd87('0xe'),_0xfd87('0xf'),_0xfd87('0x10'),_0xfd87('0x11'),'data5','data6',_0xfd87('0x12')]}]},'log':_0xfd87('0x3')});};}; \ No newline at end of file +var _0x0821=['GetTrigger','status','field','value','Condition','AnyConditions','operator','action','data1','data2','data3','data4','data5','data7','../client','getTriggers','Request'];(function(_0x55207a,_0x50d9e8){var _0x311988=function(_0x133c26){while(--_0x133c26){_0x55207a['push'](_0x55207a['shift']());}};_0x311988(++_0x50d9e8);}(_0x0821,0xeb));var _0x1082=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x0821[_0x173d7e];return _0x2220d6;};'use strict';var client=require(_0x1082('0x0'));exports[_0x1082('0x1')]=function(_0x3a90a6){return function(_0x55a97b){return client[_0x1082('0x2')](_0x1082('0x3'),{'options':{'raw':![],'attributes':['id','name','channel',_0x1082('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x1082('0x5'),'operator',_0x1082('0x6')]},{'model':_0x1082('0x7'),'as':_0x1082('0x8'),'attributes':['id','field',_0x1082('0x9'),_0x1082('0x6')]},{'model':'Action','as':'Actions','attributes':['id',_0x1082('0xa'),_0x1082('0xb'),_0x1082('0xc'),_0x1082('0xd'),_0x1082('0xe'),_0x1082('0xf'),'data6',_0x1082('0x10')]}]},'log':_0x1082('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 536d06e..2df5c40 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 _0x5b7d=['name','getTrunks','Request','GetTrunk'];(function(_0x3c4a91,_0x1d3105){var _0x4d1ed8=function(_0x23f01b){while(--_0x23f01b){_0x3c4a91['push'](_0x3c4a91['shift']());}};_0x4d1ed8(++_0x1d3105);}(_0x5b7d,0x191));var _0xd5b7=function(_0x4ad3e8,_0x4db2fb){_0x4ad3e8=_0x4ad3e8-0x0;var _0x41e6db=_0x5b7d[_0x4ad3e8];return _0x41e6db;};'use strict';var client=require('../client');exports[_0xd5b7('0x0')]=function(_0x268f4e){return function(_0x5ea217){return client[_0xd5b7('0x1')](_0xd5b7('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd5b7('0x3'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x1f57=['getTrunks','Request','GetTrunk','registry'];(function(_0x3102be,_0x4ba5f2){var _0x5022b1=function(_0x3823b9){while(--_0x3823b9){_0x3102be['push'](_0x3102be['shift']());}};_0x5022b1(++_0x4ba5f2);}(_0x1f57,0x104));var _0x71f5=function(_0x139838,_0x36bf6c){_0x139838=_0x139838-0x0;var _0x45c8ca=_0x1f57[_0x139838];return _0x45c8ca;};'use strict';var client=require('../client');exports[_0x71f5('0x0')]=function(_0x250897){return function(_0x13a124){return client[_0x71f5('0x1')](_0x71f5('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x71f5('0x3')]},'log':_0x71f5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 862854c..7d15e5e 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 _0xad32=['accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','interface','GetUser','telephone','name','internal','getTelephones','savePause','PauseUser','getAgent','lastPauseAt','../client','getAgents','Request','agent'];(function(_0xf44608,_0x4d8e55){var _0x129f91=function(_0x2dda9a){while(--_0x2dda9a){_0xf44608['push'](_0xf44608['shift']());}};_0x129f91(++_0x4d8e55);}(_0xad32,0x172));var _0x2ad3=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0xad32[_0xdd0313];return _0x2bd7e8;};'use strict';var client=require(_0x2ad3('0x0'));exports[_0x2ad3('0x1')]=function(){return function(){return client[_0x2ad3('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x2ad3('0x3')},'attributes':['id','name','email',_0x2ad3('0x4'),_0x2ad3('0x5'),_0x2ad3('0x6'),_0x2ad3('0x7'),_0x2ad3('0x8'),'lastPauseAt',_0x2ad3('0x9'),_0x2ad3('0xa'),_0x2ad3('0xb'),_0x2ad3('0xc')]},'log':_0x2ad3('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x2ad3('0xd'),{'options':{'raw':!![],'where':{'role':_0x2ad3('0xe')},'attributes':['id',_0x2ad3('0xf'),_0x2ad3('0x4'),_0x2ad3('0x10')]},'log':_0x2ad3('0x11')});};};exports[_0x2ad3('0x12')]=function(_0x2e9574,_0x48af39,_0xaa3956){return client[_0x2ad3('0x2')](_0x2ad3('0x13'),{'body':{'type':_0x48af39,'uniqueid':_0xaa3956},'options':{'where':{'id':_0x2e9574['id']}},'log':_0x2ad3('0x12')});};exports['saveUnpause']=function(_0x5cf150){return client[_0x2ad3('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5cf150['id']}},'log':_0x2ad3('0x12')});};exports[_0x2ad3('0x14')]=function(_0x531467){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x531467},'attributes':['id','name','email','accountcode',_0x2ad3('0x5'),'online','lastLoginAt',_0x2ad3('0x8'),_0x2ad3('0x15'),_0x2ad3('0x9'),_0x2ad3('0xc')]},'log':_0x2ad3('0x14')});}; \ No newline at end of file +var _0xd73f=['interface','getTelephones','telephone','name','internal','savePause','saveUnpause','getAgent','ShowUser','online','voicePause','../client','getAgents','Request','GetUser','agent','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','phone','mobile'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xd73f,0x113));var _0xfd73=function(_0x500439,_0x24b02e){_0x500439=_0x500439-0x0;var _0x476501=_0xd73f[_0x500439];return _0x476501;};'use strict';var client=require(_0xfd73('0x0'));exports[_0xfd73('0x1')]=function(){return function(){return client[_0xfd73('0x2')](_0xfd73('0x3'),{'options':{'raw':![],'where':{'role':_0xfd73('0x4')},'attributes':['id','name',_0xfd73('0x5'),_0xfd73('0x6'),_0xfd73('0x7'),'online',_0xfd73('0x8'),_0xfd73('0x9'),_0xfd73('0xa'),'voicePause',_0xfd73('0xb'),_0xfd73('0xc'),_0xfd73('0xd')]},'log':_0xfd73('0x1')});};};exports[_0xfd73('0xe')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0xfd73('0xf')},'attributes':['id',_0xfd73('0x10'),_0xfd73('0x6'),_0xfd73('0x11')]},'log':_0xfd73('0xe')});};};exports[_0xfd73('0x12')]=function(_0x2d1dbe,_0x27e4b2,_0x437c4f){return client[_0xfd73('0x2')]('PauseUser',{'body':{'type':_0x27e4b2,'uniqueid':_0x437c4f},'options':{'where':{'id':_0x2d1dbe['id']}},'log':'savePause'});};exports[_0xfd73('0x13')]=function(_0x41057a){return client[_0xfd73('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x41057a['id']}},'log':_0xfd73('0x12')});};exports[_0xfd73('0x14')]=function(_0x205a53){return client['Request'](_0xfd73('0x15'),{'options':{'raw':![],'where':{'role':_0xfd73('0x4'),'id':_0x205a53},'attributes':['id',_0xfd73('0x10'),_0xfd73('0x5'),_0xfd73('0x6'),_0xfd73('0x7'),_0xfd73('0x16'),_0xfd73('0x8'),_0xfd73('0x9'),_0xfd73('0xa'),_0xfd73('0x17'),_0xfd73('0xd')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index fa9e953..470f2eb 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 _0xf46f=['update','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x1d580a,_0x324ac1){var _0x28983c=function(_0x23c64f){while(--_0x23c64f){_0x1d580a['push'](_0x1d580a['shift']());}};_0x28983c(++_0x324ac1);}(_0xf46f,0x12e));var _0xff46=function(_0x10f857,_0x3c762a){_0x10f857=_0x10f857-0x0;var _0x5d9bb5=_0xf46f[_0x10f857];return _0x5d9bb5;};'use strict';var client=require('../client');exports[_0xff46('0x0')]=function(_0x3558be){return client['Request'](_0xff46('0x1'),{'body':_0x3558be,'log':_0xff46('0x1')});};exports[_0xff46('0x2')]=function(_0x3b6d9b,_0x541a71,_0x4f05e1){return client['Request']('UpdateVoiceAgentReport',{'body':_0x3b6d9b,'options':{'where':{'uniqueid':_0x541a71,'interface':_0x4f05e1,'agentcomplete':!![]}},'log':_0xff46('0x3')});}; \ No newline at end of file +var _0xfa71=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x118c28,_0x348904){var _0x4afea9=function(_0x1ff3a3){while(--_0x1ff3a3){_0x118c28['push'](_0x118c28['shift']());}};_0x4afea9(++_0x348904);}(_0xfa71,0xa2));var _0x1fa7=function(_0x3ac0ca,_0x5697e7){_0x3ac0ca=_0x3ac0ca-0x0;var _0xa17da2=_0xfa71[_0x3ac0ca];return _0xa17da2;};'use strict';var client=require(_0x1fa7('0x0'));exports[_0x1fa7('0x1')]=function(_0x1f9b85){return client[_0x1fa7('0x2')](_0x1fa7('0x3'),{'body':_0x1f9b85,'log':_0x1fa7('0x3')});};exports[_0x1fa7('0x4')]=function(_0x5290c1,_0x2ae3db,_0x2f4829){return client['Request'](_0x1fa7('0x5'),{'body':_0x5290c1,'options':{'where':{'uniqueid':_0x2ae3db,'interface':_0x2f4829,'agentcomplete':!![]}},'log':_0x1fa7('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a101290..513f859 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 _0xe0a7=['callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','Request','merge','calleridnum'];(function(_0x479143,_0x4e798d){var _0x3a47f5=function(_0x27c154){while(--_0x27c154){_0x479143['push'](_0x479143['shift']());}};_0x3a47f5(++_0x4e798d);}(_0xe0a7,0xcc));var _0x7e0a=function(_0x1392cf,_0x44aa45){_0x1392cf=_0x1392cf-0x0;var _0x4e72f2=_0xe0a7[_0x1392cf];return _0x4e72f2;};'use strict';var moment=require(_0x7e0a('0x0'));var util=require('util');var _=require(_0x7e0a('0x1'));var client=require(_0x7e0a('0x2'));exports['create']=function(_0x147f56){return client[_0x7e0a('0x3')]('CreateVoiceCallReport',{'body':_[_0x7e0a('0x4')](_0x147f56,{'source':_0x147f56[_0x7e0a('0x5')],'destinationcontext':_0x147f56['context'],'callerid':_0x147f56[_0x7e0a('0x6')],'amaflags':_0x7e0a('0x7')}),'log':_0x7e0a('0x8')});};exports[_0x7e0a('0x9')]=function(){return function(){return client[_0x7e0a('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x7e0a('0xa')],'createdAt':{'$between':[moment()[_0x7e0a('0xb')](_0x7e0a('0xc'))[_0x7e0a('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x7e0a('0xe')]('day')[_0x7e0a('0xd')](_0x7e0a('0xf'))]}},'attributes':[_0x7e0a('0x10'),_0x7e0a('0x11'),_0x7e0a('0x12'),_0x7e0a('0x13')]},'log':_0x7e0a('0x14')});};}; \ No newline at end of file +var _0x8073=['GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','type','disposition','duration','billableseconds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8073,0x14b));var _0x3807=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8073[_0x160c73];return _0xd9302;};'use strict';var moment=require(_0x3807('0x0'));var util=require(_0x3807('0x1'));var _=require('lodash');var client=require(_0x3807('0x2'));exports[_0x3807('0x3')]=function(_0x51e8fe){return client[_0x3807('0x4')](_0x3807('0x5'),{'body':_[_0x3807('0x6')](_0x51e8fe,{'source':_0x51e8fe['calleridnum'],'destinationcontext':_0x51e8fe[_0x3807('0x7')],'callerid':_0x51e8fe['callerid'],'amaflags':_0x3807('0x8')}),'log':_0x3807('0x5')});};exports[_0x3807('0x9')]=function(){return function(){return client[_0x3807('0x4')](_0x3807('0xa'),{'options':{'where':{'type':[_0x3807('0xb')],'createdAt':{'$between':[moment()[_0x3807('0xc')]('day')['format'](_0x3807('0xd')),moment()[_0x3807('0xe')](_0x3807('0xf'))[_0x3807('0x10')](_0x3807('0xd'))]}},'attributes':[_0x3807('0x11'),_0x3807('0x12'),_0x3807('0x13'),_0x3807('0x14')]},'log':_0x3807('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index acd357d..4f4491a 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 _0x0a5e=['Request','CreateVoiceDialReport','../client'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0x0a5e,0x98));var _0xe0a5=function(_0x44ef20,_0x59563a){_0x44ef20=_0x44ef20-0x0;var _0x1b7330=_0x0a5e[_0x44ef20];return _0x1b7330;};'use strict';var client=require(_0xe0a5('0x0'));exports['create']=function(_0x18b8d8){return client[_0xe0a5('0x1')](_0xe0a5('0x2'),{'body':_0x18b8d8,'log':_0xe0a5('0x2')});}; \ No newline at end of file +var _0x0772=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2adf8c,_0x137095){var _0x33ce30=function(_0x12d304){while(--_0x12d304){_0x2adf8c['push'](_0x2adf8c['shift']());}};_0x33ce30(++_0x137095);}(_0x0772,0x1c3));var _0x2077=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0772[_0xefd519];return _0x4bb882;};'use strict';var client=require(_0x2077('0x0'));exports[_0x2077('0x1')]=function(_0x5eafb9){return client[_0x2077('0x2')](_0x2077('0x3'),{'body':_0x5eafb9,'log':_0x2077('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ffc4d4e..10d1192 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 _0xc9be=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0xc9be,0x1aa));var _0xec9b=function(_0x206fb3,_0x1d1dfd){_0x206fb3=_0x206fb3-0x0;var _0x51783e=_0xc9be[_0x206fb3];return _0x51783e;};'use strict';var client=require(_0xec9b('0x0'));exports[_0xec9b('0x1')]=function(){return function(){return client[_0xec9b('0x2')](_0xec9b('0x3'),{'options':{'raw':!![],'attributes':['id',_0xec9b('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xec9b('0x1')});};}; \ No newline at end of file +var _0xc5cf=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x40a996,_0x48ad95){var _0x28ad53=function(_0x588702){while(--_0x588702){_0x40a996['push'](_0x40a996['shift']());}};_0x28ad53(++_0x48ad95);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x2ae958,_0x3ee309){_0x2ae958=_0x2ae958-0x0;var _0x48d937=_0xc5cf[_0x2ae958];return _0x48d937;};'use strict';var client=require(_0xfc5c('0x0'));exports[_0xfc5c('0x1')]=function(){return function(){return client[_0xfc5c('0x2')](_0xfc5c('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfc5c('0x4'),_0xfc5c('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xfc5c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5032f90..54e47cd 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 _0x0291=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x0291,0xda));var _0x1029=function(_0x5d320c,_0x5cb9f4){_0x5d320c=_0x5d320c-0x0;var _0x54588f=_0x0291[_0x5d320c];return _0x54588f;};'use strict';var client=require(_0x1029('0x0'));exports[_0x1029('0x1')]=function(){return function(){return client[_0x1029('0x2')](_0x1029('0x3'),{'options':{'raw':![],'attributes':['id',_0x1029('0x4'),_0x1029('0x5'),_0x1029('0x6'),_0x1029('0x7'),_0x1029('0x8'),_0x1029('0x9'),_0x1029('0xa'),_0x1029('0xb'),_0x1029('0xc'),'dialLimitQueue',_0x1029('0xd'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x1029('0xe'),_0x1029('0xf'),_0x1029('0x10'),_0x1029('0x11'),_0x1029('0x12'),'dialQueueTimeout',_0x1029('0x13'),'dialCongestionMaxRetry',_0x1029('0x14'),_0x1029('0x15'),_0x1029('0x16'),_0x1029('0x17'),_0x1029('0x18'),_0x1029('0x19'),_0x1029('0x1a'),_0x1029('0x1b'),'dialPrefix','dialCheckDuplicateType',_0x1029('0x1c'),'dialAMDInitialSilence',_0x1029('0x1d'),_0x1029('0x1e'),_0x1029('0x1f'),'dialAMDMinWordLength',_0x1029('0x20'),'dialAMDMaximumNumberOfWords',_0x1029('0x21'),_0x1029('0x22'),_0x1029('0x23'),_0x1029('0x24'),'dialRecallInQueue',_0x1029('0x25'),_0x1029('0x26'),_0x1029('0x27'),_0x1029('0x28'),_0x1029('0x8'),'strategy','dialRandomLastDigitCallerIdNumber',_0x1029('0x29'),_0x1029('0x2a'),_0x1029('0x2b'),_0x1029('0x2c'),_0x1029('0x2d'),'dialAbandonedMaxRetry',_0x1029('0x2e'),'dialMachineMaxRetry',_0x1029('0x2f'),_0x1029('0x30'),'dialAgentRejectRetryFrequency',_0x1029('0x31'),_0x1029('0x32'),_0x1029('0x33')],'include':[{'model':_0x1029('0x34'),'as':_0x1029('0x34'),'attributes':['id',_0x1029('0x4'),_0x1029('0x35'),_0x1029('0x36')]},{'model':'Pause','as':_0x1029('0x37'),'attributes':['id',_0x1029('0x4')]},{'model':_0x1029('0x34'),'as':_0x1029('0x38'),'attributes':['id',_0x1029('0x4'),'callerid',_0x1029('0x36')]},{'model':_0x1029('0x39'),'as':_0x1029('0x39'),'attributes':['id',_0x1029('0x4')],'include':[{'model':'Interval','as':_0x1029('0x3a'),'attributes':['id','name',_0x1029('0x3b')]}]}]},'log':_0x1029('0x1')});};}; \ No newline at end of file +var _0x6233=['monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','getVoiceQueues','../client','Request','name','acw','acwTimeout','autopause'];(function(_0x1b94ab,_0x24efb2){var _0x1894f3=function(_0x6d4cb1){while(--_0x6d4cb1){_0x1b94ab['push'](_0x1b94ab['shift']());}};_0x1894f3(++_0x24efb2);}(_0x6233,0xba));var _0x3623=function(_0x133614,_0x1a9b07){_0x133614=_0x133614-0x0;var _0x46fc7b=_0x6233[_0x133614];return _0x46fc7b;};'use strict';var client=require(_0x3623('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x3623('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3623('0x2'),_0x3623('0x3'),_0x3623('0x4'),_0x3623('0x5'),_0x3623('0x6'),_0x3623('0x7'),_0x3623('0x8'),_0x3623('0x9'),_0x3623('0xa'),'dialLimitQueue','dialPowerLevel',_0x3623('0xb'),'dialPredictiveOptimizationPercentage',_0x3623('0xc'),_0x3623('0xd'),_0x3623('0xe'),_0x3623('0xf'),_0x3623('0x10'),_0x3623('0x11'),_0x3623('0x12'),_0x3623('0x13'),_0x3623('0x14'),_0x3623('0x15'),_0x3623('0x16'),_0x3623('0x17'),_0x3623('0x18'),_0x3623('0x19'),_0x3623('0x1a'),_0x3623('0x1b'),_0x3623('0x1c'),_0x3623('0x1d'),'dialAMDActive',_0x3623('0x1e'),_0x3623('0x1f'),'dialAMDAfterGreetingSilence',_0x3623('0x20'),_0x3623('0x21'),'dialAMDBetweenWordsSilence',_0x3623('0x22'),_0x3623('0x23'),_0x3623('0x24'),_0x3623('0x25'),_0x3623('0x26'),'dialRecallInQueue',_0x3623('0x27'),_0x3623('0x28'),_0x3623('0x29'),_0x3623('0x2a'),'monitor_format',_0x3623('0x2b'),_0x3623('0x2c'),'dialCutDigit',_0x3623('0x2d'),_0x3623('0x2e'),_0x3623('0x2f'),'dialDropRetryFrequency',_0x3623('0x30'),_0x3623('0x31'),'dialMachineMaxRetry',_0x3623('0x32'),_0x3623('0x33'),_0x3623('0x34'),_0x3623('0x35'),_0x3623('0x36'),_0x3623('0x37')],'include':[{'model':_0x3623('0x38'),'as':_0x3623('0x38'),'attributes':['id',_0x3623('0x2'),_0x3623('0x39'),_0x3623('0x3a')]},{'model':_0x3623('0x3b'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x3623('0x38'),'as':_0x3623('0x3c'),'attributes':['id',_0x3623('0x2'),_0x3623('0x39'),_0x3623('0x3a')]},{'model':_0x3623('0x3d'),'as':_0x3623('0x3d'),'attributes':['id','name'],'include':[{'model':_0x3623('0x3d'),'as':'Intervals','attributes':['id',_0x3623('0x2'),_0x3623('0x3e')]}]}]},'log':_0x3623('0x3f')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 6213036..295b9ce 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 _0x5a0b=['CreateVoiceQueueReport','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','moment','../client','create','Request'];(function(_0x2f5113,_0x2aca3e){var _0x239cc9=function(_0x3fcb10){while(--_0x3fcb10){_0x2f5113['push'](_0x2f5113['shift']());}};_0x239cc9(++_0x2aca3e);}(_0x5a0b,0x178));var _0xb5a0=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x5a0b[_0x1f9f37];return _0x21c080;};'use strict';var moment=require(_0xb5a0('0x0'));var _=require('lodash');var client=require(_0xb5a0('0x1'));exports[_0xb5a0('0x2')]=function(_0xa71e9a){return client[_0xb5a0('0x3')](_0xb5a0('0x4'),{'body':_0xa71e9a,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xb5a0('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xb5a0('0x5')](_0xb5a0('0x6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb5a0('0x7')](_0xb5a0('0x6'))[_0xb5a0('0x8')](_0xb5a0('0x9'))]}},'attributes':[_0xb5a0('0xa'),_0xb5a0('0xb'),_0xb5a0('0xc'),_0xb5a0('0xd'),_0xb5a0('0xe'),_0xb5a0('0xf'),_0xb5a0('0x10'),_0xb5a0('0x11'),_0xb5a0('0x12'),'queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xd8e0=['../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd8e0,0x18e));var _0x0d8e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd8e0[_0x432682];return _0x463d05;};'use strict';var moment=require('moment');var _=require(_0x0d8e('0x0'));var client=require(_0x0d8e('0x1'));exports[_0x0d8e('0x2')]=function(_0x2d944e){return client[_0x0d8e('0x3')](_0x0d8e('0x4'),{'body':_0x2d944e,'log':_0x0d8e('0x4')});};exports[_0x0d8e('0x5')]=function(){return function(){return client[_0x0d8e('0x3')](_0x0d8e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0d8e('0x7')](_0x0d8e('0x8'))[_0x0d8e('0x9')](_0x0d8e('0xa')),moment()[_0x0d8e('0xb')](_0x0d8e('0x8'))[_0x0d8e('0x9')](_0x0d8e('0xa'))]}},'attributes':[_0x0d8e('0xc'),_0x0d8e('0xd'),'queuecallerjoinAt',_0x0d8e('0xe'),_0x0d8e('0xf'),_0x0d8e('0x10'),'queuecallerexit',_0x0d8e('0x11'),_0x0d8e('0x12'),_0x0d8e('0x13')]},'log':_0x0d8e('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 6c66ea0..13c243a 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 _0x17c2=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0x2e56da,_0x58753b){var _0x3d8ea1=function(_0x1bc48a){while(--_0x1bc48a){_0x2e56da['push'](_0x2e56da['shift']());}};_0x3d8ea1(++_0x58753b);}(_0x17c2,0x1ab));var _0x217c=function(_0x1bb49c,_0x510210){_0x1bb49c=_0x1bb49c-0x0;var _0x45db79=_0x17c2[_0x1bb49c];return _0x45db79;};'use strict';var client=require(_0x217c('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4e0938){return function(){return client['Request'](_0x217c('0x1'),{'options':{'where':{'VoiceQueueId':_0x4e0938,'paused':!![]},'raw':!![]},'log':_0x217c('0x2')});};}; \ No newline at end of file +var _0xcef7=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xcef7,0xe3));var _0x7cef=function(_0x502fdd,_0x5d7a0e){_0x502fdd=_0x502fdd-0x0;var _0x3e016c=_0xcef7[_0x502fdd];return _0x3e016c;};'use strict';var client=require('../client');exports[_0x7cef('0x0')]=function(_0x22b4dc){return function(){return client[_0x7cef('0x1')](_0x7cef('0x2'),{'options':{'where':{'VoiceQueueId':_0x22b4dc,'paused':!![]},'raw':!![]},'log':_0x7cef('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bdae414..a833b72 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 _0x10b7=['monitorFilename','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10b7,0xcd));var _0x710b=function(_0x4d6a8f,_0x565271){_0x4d6a8f=_0x4d6a8f-0x0;var _0x537980=_0x10b7[_0x4d6a8f];return _0x537980;};'use strict';var _=require(_0x710b('0x0'));var client=require(_0x710b('0x1'));exports[_0x710b('0x2')]=function(_0x4da9cd){return client[_0x710b('0x3')](_0x710b('0x4'),{'body':_['merge'](_0x4da9cd,{'value':_0x4da9cd[_0x710b('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x77fc=['../client','create','Request','merge','CreateVoiceRecording','lodash'];(function(_0x446ea5,_0x55de4f){var _0x39aea7=function(_0x2cb204){while(--_0x2cb204){_0x446ea5['push'](_0x446ea5['shift']());}};_0x39aea7(++_0x55de4f);}(_0x77fc,0x101));var _0xc77f=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x77fc[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xc77f('0x0'));var client=require(_0xc77f('0x1'));exports[_0xc77f('0x2')]=function(_0x470a3e){return client[_0xc77f('0x3')]('CreateVoiceRecording',{'body':_[_0xc77f('0x4')](_0x470a3e,{'value':_0x470a3e['monitorFilename']}),'log':_0xc77f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index ec34bc5..d131287 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 _0xbccd=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','context','blind','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridname'];(function(_0x1d2195,_0x4b8096){var _0x4962cd=function(_0x301f5a){while(--_0x301f5a){_0x1d2195['push'](_0x1d2195['shift']());}};_0x4962cd(++_0x4b8096);}(_0xbccd,0xd8));var _0xdbcc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbccd[_0x5f09c5];return _0x426ad9;};'use strict';var client=require(_0xdbcc('0x0'));exports[_0xdbcc('0x1')]={};exports[_0xdbcc('0x2')]=function(_0x3727de){return client['Request'](_0xdbcc('0x3'),{'body':{'result':_0x3727de[_0xdbcc('0x4')],'transfererchannel':_0x3727de['transfererchannel'],'transferercalleridnum':_0x3727de['transferercalleridnum'],'transferercalleridname':_0x3727de[_0xdbcc('0x5')],'transfererconnectedlinenum':_0x3727de[_0xdbcc('0x6')],'transfererconnectedlinename':_0x3727de[_0xdbcc('0x7')],'transfereraccountcode':_0x3727de[_0xdbcc('0x8')],'transferercontext':_0x3727de['transferercontext'],'transfererexten':_0x3727de['transfererexten'],'transfererlinkedid':_0x3727de[_0xdbcc('0x9')],'transfereechannel':_0x3727de[_0xdbcc('0xa')],'transfereecalleridnum':_0x3727de[_0xdbcc('0xb')],'transfereecalleridname':_0x3727de[_0xdbcc('0xc')],'transfereeconnectedlinenum':_0x3727de[_0xdbcc('0xd')],'transfereeconnectedlinename':_0x3727de[_0xdbcc('0xe')],'transfereeaccountcode':_0x3727de['transfereeaccountcode'],'transfereecontext':_0x3727de[_0xdbcc('0xf')],'transfereeexten':_0x3727de[_0xdbcc('0x10')],'transfereelinkedid':_0x3727de['transfereelinkedid'],'isexternal':_0x3727de['isexternal'],'context':_0x3727de[_0xdbcc('0x11')],'extension':_0x3727de['extension'],'type':_0xdbcc('0x12')},'log':_0xdbcc('0x3')});};exports[_0xdbcc('0x13')]=function(_0xc4c5c6){return client[_0xdbcc('0x14')](_0xdbcc('0x3'),{'body':{'result':_0xc4c5c6[_0xdbcc('0x4')],'transfererchannel':_0xc4c5c6['origtransfererchannel'],'transferercalleridnum':_0xc4c5c6[_0xdbcc('0x15')],'transferercalleridname':_0xc4c5c6[_0xdbcc('0x16')],'transfererconnectedlinenum':_0xc4c5c6[_0xdbcc('0x17')],'transfererconnectedlinename':_0xc4c5c6['secondtransfererconnectedlinename'],'transfereraccountcode':_0xc4c5c6[_0xdbcc('0x18')],'transferercontext':_0xc4c5c6[_0xdbcc('0x19')],'transfererexten':_0xc4c5c6[_0xdbcc('0x1a')],'transfererlinkedid':_0xc4c5c6[_0xdbcc('0x1b')],'transfereechannel':_0xc4c5c6['transfertargetchannel'],'transfereecalleridnum':_0xc4c5c6[_0xdbcc('0x1c')],'transfereecalleridname':_0xc4c5c6[_0xdbcc('0x1d')],'transfereeconnectedlinenum':_0xc4c5c6[_0xdbcc('0x1e')],'transfereeconnectedlinename':_0xc4c5c6['transfertargetconnectedlinename'],'transfereeaccountcode':_0xc4c5c6[_0xdbcc('0x1f')],'transfereecontext':_0xc4c5c6[_0xdbcc('0x20')],'transfereeexten':_0xc4c5c6[_0xdbcc('0x21')],'transfereelinkedid':_0xc4c5c6[_0xdbcc('0x22')],'isexternal':_0xc4c5c6['isexternal'],'context':_0xc4c5c6[_0xdbcc('0x23')],'extension':_0xc4c5c6['origtransfererexten'],'type':_0xdbcc('0x24')},'log':_0xdbcc('0x3')});}; \ No newline at end of file +var _0x084d=['transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x084d,0x147));var _0xd084=function(_0x3147c2,_0x24bdfb){_0x3147c2=_0x3147c2-0x0;var _0x41fd62=_0x084d[_0x3147c2];return _0x41fd62;};'use strict';var client=require(_0xd084('0x0'));exports[_0xd084('0x1')]={};exports[_0xd084('0x2')]=function(_0x299515){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x299515[_0xd084('0x3')],'transfererchannel':_0x299515[_0xd084('0x4')],'transferercalleridnum':_0x299515[_0xd084('0x5')],'transferercalleridname':_0x299515[_0xd084('0x6')],'transfererconnectedlinenum':_0x299515[_0xd084('0x7')],'transfererconnectedlinename':_0x299515[_0xd084('0x8')],'transfereraccountcode':_0x299515[_0xd084('0x9')],'transferercontext':_0x299515[_0xd084('0xa')],'transfererexten':_0x299515[_0xd084('0xb')],'transfererlinkedid':_0x299515[_0xd084('0xc')],'transfereechannel':_0x299515[_0xd084('0xd')],'transfereecalleridnum':_0x299515[_0xd084('0xe')],'transfereecalleridname':_0x299515['transfereecalleridname'],'transfereeconnectedlinenum':_0x299515[_0xd084('0xf')],'transfereeconnectedlinename':_0x299515[_0xd084('0x10')],'transfereeaccountcode':_0x299515['transfereeaccountcode'],'transfereecontext':_0x299515[_0xd084('0x11')],'transfereeexten':_0x299515['transfereeexten'],'transfereelinkedid':_0x299515[_0xd084('0x12')],'isexternal':_0x299515[_0xd084('0x13')],'context':_0x299515['context'],'extension':_0x299515[_0xd084('0x14')],'type':_0xd084('0x15')},'log':_0xd084('0x16')});};exports[_0xd084('0x17')]=function(_0x2d69e0){return client[_0xd084('0x18')]('CreateVoiceTransferReport',{'body':{'result':_0x2d69e0[_0xd084('0x3')],'transfererchannel':_0x2d69e0['origtransfererchannel'],'transferercalleridnum':_0x2d69e0['origtransferercalleridnum'],'transferercalleridname':_0x2d69e0['origtransferercalleridname'],'transfererconnectedlinenum':_0x2d69e0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2d69e0[_0xd084('0x19')],'transfereraccountcode':_0x2d69e0[_0xd084('0x1a')],'transferercontext':_0x2d69e0['secondtransferercontext'],'transfererexten':_0x2d69e0['secondtransfererexten'],'transfererlinkedid':_0x2d69e0[_0xd084('0x1b')],'transfereechannel':_0x2d69e0['transfertargetchannel'],'transfereecalleridnum':_0x2d69e0[_0xd084('0x1c')],'transfereecalleridname':_0x2d69e0[_0xd084('0x1d')],'transfereeconnectedlinenum':_0x2d69e0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2d69e0[_0xd084('0x1e')],'transfereeaccountcode':_0x2d69e0[_0xd084('0x1f')],'transfereecontext':_0x2d69e0[_0xd084('0x20')],'transfereeexten':_0x2d69e0[_0xd084('0x21')],'transfereelinkedid':_0x2d69e0[_0xd084('0x22')],'isexternal':_0x2d69e0[_0xd084('0x13')],'context':_0x2d69e0[_0xd084('0x23')],'extension':_0x2d69e0[_0xd084('0x24')],'type':'attended'},'log':_0xd084('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cc80728..73efd56 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 _0x3986=['%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','message','catch','error','isConnected','command','action','Command','voiceQueues','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','emit','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format'];(function(_0x5d9042,_0x3ec198){var _0x4d10f0=function(_0x55bb01){while(--_0x55bb01){_0x5d9042['push'](_0x5d9042['shift']());}};_0x4d10f0(++_0x3ec198);}(_0x3986,0x83));var _0x6398=function(_0x10adea,_0x3136df){_0x10adea=_0x10adea-0x0;var _0x2355c8=_0x3986[_0x10adea];return _0x2355c8;};'use strict';var _=require(_0x6398('0x0'));var util=require(_0x6398('0x1'));var jayson=require(_0x6398('0x2'));var schema=require(_0x6398('0x3'));var BPromise=require(_0x6398('0x4'));var moment=require(_0x6398('0x5'));var config=require(_0x6398('0x6'));var properties=require(_0x6398('0x7'));var ami=require(_0x6398('0x8'));exports['listen']=function(_0x28dff1,_0x3fcc85,_0x159f9a){return new BPromise(function(_0x49e784,_0x40cad1){var _0x46367f={'QueuePause':function(_0x41b6f9){return new Promise(function(_0x2dd4c3,_0x4a3351){var _0x405c5b=util[_0x6398('0x9')](_0x6398('0xa'),'SIP',_0x41b6f9[_0x6398('0xb')]);if(_0x28dff1[_0x6398('0xc')]&&_0x28dff1['timers'][_0x405c5b]&&_0x28dff1['timers'][_0x405c5b][_0x6398('0xd')]){_0x28dff1[_0x6398('0xc')][_0x405c5b][_0x6398('0xe')]();}if(_0x28dff1[_0x6398('0xf')][_0x405c5b]){_0x28dff1[_0x6398('0xf')][_0x405c5b][_0x6398('0x10')]({'statePause':_0x41b6f9[_0x6398('0x11')]?!![]:![]});}_0x2dd4c3({'code':0xc8,'message':_0x6398('0x12')});});},'Reload':function(_0x5ab663){var _0x1f1ed2=this;return new Promise(function(_0x532840,_0x2b6e23){if(ami['isConnected']()==![]){return _0x2b6e23(_0x1f1ed2['error'](0x1f4,[config[_0x6398('0x13')]['ip'],config['asterisk'][_0x6398('0x14')],_0x6398('0x15')][_0x6398('0x16')]('\x20')));}_0x5ab663=_[_0x6398('0x17')](_0x5ab663,_[_0x6398('0x18')](properties[_0x6398('0x19')]));_0x5ab663['action']=_0x6398('0x1a');return ami[_0x6398('0x1b')](_0x5ab663)[_0x6398('0x1c')](function(_0x44dd33){_0x532840({'code':0xc8,'message':_0x44dd33[_0x6398('0x1d')]});})[_0x6398('0x1e')](function(_0xc42967){_0x2b6e23(_0x1f1ed2[_0x6398('0x1f')](0x1f5,_0xc42967[_0x6398('0x1d')]));});});},'Command':function(_0x474454){var _0x2eba4d=this;return new Promise(function(_0x3b7860,_0x52c90a){if(ami[_0x6398('0x20')]()==![]){return _0x52c90a(_0x2eba4d['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x6398('0x14')],'ami\x20disconnected'][_0x6398('0x16')]('\x20')));}_0x474454=_[_0x6398('0x17')](_0x474454,_0x6398('0x21'));_0x474454[_0x6398('0x22')]=_0x6398('0x23');return ami[_0x6398('0x1b')](_0x474454)['then'](function(_0x2d28d3){_0x3b7860({'code':0xc8,'message':_0x2d28d3['content']});})[_0x6398('0x1e')](function(_0x5b24af){_0x52c90a(_0x2eba4d[_0x6398('0x1f')](0x1f5,_0x5b24af[_0x6398('0x1d')]));});});},'VoiceQueues':function(_0x38a92a){return new Promise(function(_0x34f583,_0x26f7a5){var _0x12ef04=[];for(var _0x4321ff in _0x28dff1[_0x6398('0x24')]){if(_0x28dff1['voiceQueues']['hasOwnProperty'](_0x4321ff)){var _0x52d268=_0x28dff1[_0x6398('0x24')][_0x4321ff];var _0x37566b={'id':_0x52d268['id'],'name':_0x52d268[_0x6398('0xb')],'strategy':_0x52d268[_0x6398('0x25')],'answered':_0x52d268['answered'],'available':_0x52d268[_0x6398('0x26')],'loggedIn':_0x52d268[_0x6398('0x27')],'pTalking':_0x52d268[_0x6398('0x28')],'sumBillable':_0x52d268[_0x6398('0x29')],'sumDuration':_0x52d268[_0x6398('0x2a')],'sumHoldTime':_0x52d268[_0x6398('0x2b')]||0x0,'talking':_0x52d268['talking'],'total':_0x52d268['total'],'type':_0x52d268[_0x6398('0x2c')],'unmanaged':_0x52d268[_0x6398('0x2d')],'abandoned':_0x52d268[_0x6398('0x2e')],'waiting':_0x52d268[_0x6398('0x2f')],'loggedInDb':_0x52d268[_0x6398('0x30')]};if(_0x52d268[_0x6398('0x2c')]===_0x6398('0x31')){_0x37566b['dialActive']=_0x52d268['dialActive'];_0x37566b[_0x6398('0x32')]=_0x52d268['dialMethod'];_0x37566b['dialOriginateCallerIdName']=_0x52d268['dialOriginateCallerIdName'];_0x37566b[_0x6398('0x33')]=_0x52d268[_0x6398('0x33')];_0x37566b[_0x6398('0x34')]=_0x52d268['dialOriginateTimeout'];_0x37566b[_0x6398('0x35')]=_0x52d268[_0x6398('0x35')];_0x37566b[_0x6398('0x36')]=_0x52d268[_0x6398('0x36')];_0x37566b['outboundAnswerCallsDay']=_0x52d268[_0x6398('0x37')];_0x37566b[_0x6398('0x38')]=_0x52d268[_0x6398('0x38')];_0x37566b[_0x6398('0x39')]=_0x52d268[_0x6398('0x39')];_0x37566b[_0x6398('0x3a')]=_0x52d268['outboundCongestionCallsDay'];_0x37566b['outboundDropCallsDayACS']=_0x52d268[_0x6398('0x3b')];_0x37566b[_0x6398('0x3c')]=_0x52d268[_0x6398('0x3c')];_0x37566b[_0x6398('0x3d')]=_0x52d268[_0x6398('0x3d')];_0x37566b[_0x6398('0x3e')]=_0x52d268[_0x6398('0x3e')];_0x37566b['outboundNoSuchCallsDay']=_0x52d268[_0x6398('0x3f')];_0x37566b[_0x6398('0x40')]=_0x52d268[_0x6398('0x40')];_0x37566b['outboundReCallsDay']=_0x52d268[_0x6398('0x41')];_0x37566b[_0x6398('0x42')]=_0x52d268[_0x6398('0x42')];_0x37566b['outboundUnknownCallsDay']=_0x52d268[_0x6398('0x43')];_0x37566b[_0x6398('0x44')]=_0x52d268[_0x6398('0x44')];_0x37566b['predictiveIntervalAvgHoldtime']=_0x52d268['predictiveIntervalAvgHoldtime'];_0x37566b['predictiveIntervalAvgTalktime']=_0x52d268[_0x6398('0x45')];_0x37566b[_0x6398('0x46')]=_0x52d268[_0x6398('0x46')];_0x37566b[_0x6398('0x47')]=_0x52d268[_0x6398('0x47')];_0x37566b['predictiveIntervalErlangCalls']=_0x52d268[_0x6398('0x48')];_0x37566b['predictiveIntervalErlangCallsDroppedCalls']=_0x52d268[_0x6398('0x49')];_0x37566b[_0x6398('0x4a')]=_0x52d268[_0x6398('0x4a')];_0x37566b[_0x6398('0x4b')]=_0x52d268[_0x6398('0x4b')];_0x37566b[_0x6398('0x4c')]=_0x52d268[_0x6398('0x4c')];_0x37566b[_0x6398('0x4d')]=_0x52d268[_0x6398('0x4d')];_0x37566b[_0x6398('0x4e')]=_0x52d268[_0x6398('0x4e')];_0x37566b[_0x6398('0x1d')]=_0x52d268[_0x6398('0x1d')];_0x37566b[_0x6398('0x4f')]=_0x52d268['originated'];_0x37566b['erlangCalls']=_0x52d268['erlangCalls'];_0x37566b[_0x6398('0x50')]=_0x52d268[_0x6398('0x50')];_0x37566b[_0x6398('0x51')]=_0x52d268[_0x6398('0x51')];_0x37566b[_0x6398('0x52')]=_0x52d268[_0x6398('0x52')];_0x37566b[_0x6398('0x53')]=_0x52d268[_0x6398('0x53')];_0x37566b[_0x6398('0x54')]=_0x52d268['startProgressive'];}if(_0x52d268[_0x6398('0x55')]){_0x37566b['Trunk']={'id':_0x52d268[_0x6398('0x55')]['id'],'name':_0x52d268[_0x6398('0x55')][_0x6398('0xb')],'active':_0x52d268[_0x6398('0x55')][_0x6398('0x56')],'callerid':_0x52d268[_0x6398('0x55')][_0x6398('0x57')]};}if(_0x52d268[_0x6398('0x58')]){_0x37566b['Interval']={'id':_0x52d268[_0x6398('0x58')]['id'],'name':_0x52d268[_0x6398('0x58')][_0x6398('0xb')]};}_0x12ef04['push'](_0x37566b);}}_0x34f583({'count':_0x12ef04[_0x6398('0x59')],'rows':_0x12ef04});});},'VoiceChannels':function(_0x387ce5){return new Promise(function(_0x4104cf,_0x935aed){var _0x83a500=_[_0x6398('0x5a')](_0x28dff1[_0x6398('0x5b')]);_0x4104cf({'count':_0x83a500[_0x6398('0x59')],'rows':_0x83a500});});},'VoiceChannelMixMonitor':function(_0x34a1c5){var _0x47f3f9=this;return new Promise(function(_0x37caf6,_0x342046){if(ami[_0x6398('0x20')]()==![]){return _0x342046(_0x47f3f9[_0x6398('0x1f')](0x1f4,[config[_0x6398('0x13')]['ip'],config[_0x6398('0x13')][_0x6398('0x14')],_0x6398('0x15')][_0x6398('0x16')]('\x20')));}var _0x4ad186=schema(properties[_0x6398('0x5c')])[_0x6398('0x3')](_0x34a1c5);if(_0x4ad186[_0x6398('0x59')]>0x0){return _0x342046(_0x47f3f9[_0x6398('0x1f')](0x1f4,_[_0x6398('0x5d')](_0x4ad186,_0x6398('0x1d'))[_0x6398('0x16')](',\x20')));}var _0x31e61d=_[_0x6398('0x5e')](_0x28dff1['channels'],{'uniqueid':_0x34a1c5[_0x6398('0x5f')]});if(_0x31e61d&&_0x31e61d[_0x6398('0x60')]){var _0x5bba66=util[_0x6398('0x9')](_0x6398('0x61'),_0x34a1c5[_0x6398('0x62')]||_0x34a1c5['uniqueid'],_0x34a1c5[_0x6398('0x9')]||_0x6398('0x63'));return ami[_0x6398('0x1b')]({'action':_0x6398('0x64'),'channel':_0x31e61d['channel'],'file':_0x5bba66,'options':'ai(mixmonitorid)'})[_0x6398('0x1c')](function(_0x2fbe08){var _0x2e0d3f=_[_0x6398('0x5e')](_0x31e61d[_0x6398('0x65')],{'filename':_0x6398('0x66')+_0x5bba66[_0x6398('0x67')]()});if(_[_0x6398('0x68')](_0x2e0d3f)){_0x31e61d[_0x6398('0x65')][_0x6398('0x69')]({'filename':_0x6398('0x66')+_0x5bba66[_0x6398('0x67')](),'createdAt':moment()['format'](_0x6398('0x6a')),'mixmonitorid':_0x2fbe08[_0x6398('0x6b')],'status':'rec'});}else{_0x2e0d3f['mixmonitorid']=_0x2fbe08[_0x6398('0x6b')];_0x2e0d3f[_0x6398('0x6c')]=_0x6398('0x6d');}_0x37caf6({'code':0xc8,'message':[_0x34a1c5[_0x6398('0x5f')],_0x6398('0x6e'),_0x2fbe08[_0x6398('0x6b')]][_0x6398('0x16')]('\x20'),'mixmonitorid':_0x2fbe08['mixmonitorid']});})[_0x6398('0x1e')](function(_0x51eeb9){_0x342046(_0x47f3f9[_0x6398('0x1f')](0x1f5,[_0x34a1c5['uniqueid'],_0x51eeb9['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x342046(_0x47f3f9[_0x6398('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4c6121){var _0x1fc8d4=this;return new Promise(function(_0x32ca45,_0x53e571){if(ami[_0x6398('0x20')]()==![]){return _0x53e571(_0x1fc8d4[_0x6398('0x1f')](0x1f4,[config['asterisk']['ip'],config[_0x6398('0x13')]['username'],_0x6398('0x15')][_0x6398('0x16')]('\x20')));}var _0xf6ebe2=schema(properties[_0x6398('0x5c')])['validate'](_0x4c6121);if(_0xf6ebe2[_0x6398('0x59')]>0x0){return _0x53e571(_0x1fc8d4['error'](0x1f4,_[_0x6398('0x5d')](_0xf6ebe2,_0x6398('0x1d'))[_0x6398('0x16')](',\x20')));}var _0x340a61=_[_0x6398('0x5e')](_0x28dff1[_0x6398('0x5b')],{'uniqueid':_0x4c6121[_0x6398('0x5f')]});if(_0x340a61){return BPromise[_0x6398('0x6f')]()[_0x6398('0x1c')](function(){if(_0x340a61[_0x6398('0x60')]){return ami[_0x6398('0x1b')]({'action':_0x6398('0x70'),'channel':_0x340a61[_0x6398('0x60')],'mixmonitorid':_0x4c6121[_0x6398('0x6b')]})[_0x6398('0x1e')](function(_0x2616a8){});}})['then'](function(){if(_0x340a61['destinationchannel']){return ami[_0x6398('0x1b')]({'action':_0x6398('0x70'),'channel':_0x340a61[_0x6398('0x71')],'mixmonitorid':_0x4c6121['mixmonitorid']})[_0x6398('0x1e')](function(_0x5fb15d){});}})[_0x6398('0x1c')](function(_0x411516){var _0x275621=_['find'](_0x340a61[_0x6398('0x65')],{'mixmonitorid':_0x4c6121[_0x6398('0x6b')]});if(_0x275621){_0x275621[_0x6398('0x6c')]=_0x6398('0x72');}})[_0x6398('0x1c')](function(){var _0x29b0b4=util[_0x6398('0x9')]('%s.%s',_0x4c6121[_0x6398('0x62')]||_0x4c6121['uniqueid'],_0x4c6121['format']||_0x6398('0x63'));var _0x357aa2=_[_0x6398('0x5e')](_0x340a61[_0x6398('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x29b0b4[_0x6398('0x67')]()});if(_0x357aa2){_0x357aa2[_0x6398('0x6c')]='stop';}})[_0x6398('0x1c')](function(){_0x32ca45({'code':0xc8,'message':[_0x4c6121[_0x6398('0x5f')],_0x6398('0x73')][_0x6398('0x16')]('\x20')});})[_0x6398('0x1e')](function(_0x2de92f){_0x53e571(_0x1fc8d4[_0x6398('0x1f')](0x1f5,[_0x4c6121[_0x6398('0x5f')],_0x2de92f[_0x6398('0x1d')][_0x6398('0x67')]()]['join']('\x20')));});}else{return _0x53e571(_0x1fc8d4[_0x6398('0x1f')](0x1f5,_0x6398('0x74')));}});},'VoiceQueuesChannels':function(_0x3cecef){return new Promise(function(_0xb9b8d0,_0x595e30){var _0x43e7f0=_[_0x6398('0x5a')](_0x28dff1['queueChannels']);_0xb9b8d0({'count':_0x43e7f0['length'],'rows':_0x43e7f0});});},'VoiceQueuesChannel':function(_0x46b3ca){var _0x33d412=this;return new Promise(function(_0x13b464,_0x2104c2){var _0x4749fc=schema(properties[_0x6398('0x75')])[_0x6398('0x3')](_0x46b3ca);if(_0x4749fc[_0x6398('0x59')]>0x0){return _0x2104c2(_0x33d412[_0x6398('0x1f')](0x1f4,_[_0x6398('0x5d')](_0x4749fc,_0x6398('0x1d'))['join'](',\x20')));}var _0x3be2ae=_[_0x6398('0x5e')](_0x28dff1[_0x6398('0x76')],{'uniqueid':_0x46b3ca[_0x6398('0x5f')]});if(_0x3be2ae){_0x13b464(_0x3be2ae);}else{return _0x2104c2(_0x33d412[_0x6398('0x1f')](0x1f5,_0x6398('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x1b247f){var _0x158b25=this;return new Promise(function(_0x1355ec,_0xa69f09){if(ami['isConnected']()==![]){return _0xa69f09(_0x158b25[_0x6398('0x1f')](0x1f4,[config[_0x6398('0x13')]['ip'],config['asterisk'][_0x6398('0x14')],_0x6398('0x15')][_0x6398('0x16')]('\x20')));}var _0x4612b8=schema(properties['voicequeuechannelhangup'])[_0x6398('0x3')](_0x1b247f);if(_0x4612b8[_0x6398('0x59')]>0x0){return _0xa69f09(_0x158b25['error'](0x1f4,_[_0x6398('0x5d')](_0x4612b8,_0x6398('0x1d'))['join'](',\x20')));}var _0x385d45=_[_0x6398('0x5e')](_0x28dff1[_0x6398('0x76')],{'uniqueid':_0x1b247f['uniqueid']});if(_0x385d45&&_0x385d45[_0x6398('0x60')]){return ami['Action']({'action':_0x6398('0x77'),'channel':_0x385d45['channel']})[_0x6398('0x1c')](function(_0x1063b1){_0x1355ec({'code':0xc8,'message':[_0x1b247f[_0x6398('0x5f')],_0x1063b1[_0x6398('0x1d')][_0x6398('0x67')]()]['join']('\x20')});})[_0x6398('0x1e')](function(_0x3542c9){_0xa69f09(_0x158b25[_0x6398('0x1f')](0x1f5,[_0x1b247f[_0x6398('0x5f')],_0x3542c9[_0x6398('0x1d')][_0x6398('0x67')]()][_0x6398('0x16')]('\x20')));});}else{return _0xa69f09(_0x158b25[_0x6398('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x161953){var _0x12d17b=this;return new Promise(function(_0x567fb9,_0x199e67){if(ami[_0x6398('0x20')]()==![]){return _0x199e67(_0x12d17b[_0x6398('0x1f')](0x1f4,[config[_0x6398('0x13')]['ip'],config['asterisk']['username'],_0x6398('0x15')]['join']('\x20')));}var _0x37f78b=schema(properties[_0x6398('0x78')])[_0x6398('0x3')](_0x161953);if(_0x37f78b[_0x6398('0x59')]>0x0){return _0x199e67(_0x12d17b[_0x6398('0x1f')](0x1f4,_['map'](_0x37f78b,_0x6398('0x1d'))[_0x6398('0x16')](',\x20')));}var _0x3dddd3=_['find'](_0x28dff1['queueChannels'],{'uniqueid':_0x161953[_0x6398('0x5f')]});if(_0x3dddd3&&_0x3dddd3[_0x6398('0x60')]){return ami[_0x6398('0x1b')]({'action':_0x6398('0x79'),'channel':_0x3dddd3[_0x6398('0x60')],'exten':_0x161953[_0x6398('0x7a')],'context':_0x161953[_0x6398('0x7b')]||_0x3dddd3[_0x6398('0x7b')],'priority':0x1})['then'](function(_0x23fd52){_0x567fb9({'code':0xc8,'message':[_0x161953[_0x6398('0x5f')],_0x23fd52[_0x6398('0x1d')][_0x6398('0x67')]()][_0x6398('0x16')]('\x20')});})[_0x6398('0x1e')](function(_0x326323){_0x199e67(_0x12d17b[_0x6398('0x1f')](0x1f5,[_0x161953[_0x6398('0x5f')],_0x326323['message'][_0x6398('0x67')]()][_0x6398('0x16')]('\x20')));});}else{return _0x199e67(_0x12d17b[_0x6398('0x1f')](0x1f5,_0x6398('0x74')));}});},'Agents':function(_0x4fc42e){return new Promise(function(_0x5d9289,_0x2c72d0){var _0x3bcbd3=_['values'](_0x28dff1[_0x6398('0xf')]);_0x5d9289({'count':_0x3bcbd3[_0x6398('0x59')],'rows':_0x3bcbd3});});},'Telephones':function(_0x251d97){return new Promise(function(_0x48b21e,_0xcf8654){var _0x1228d0=_[_0x6398('0x5a')](_0x28dff1[_0x6398('0x7c')]);_0x48b21e({'count':_0x1228d0[_0x6398('0x59')],'rows':_0x1228d0});});},'Trunks':function(_0x512381){return new Promise(function(_0xa9f3da,_0x21ef20){var _0x1cb241=_[_0x6398('0x5a')](_0x28dff1[_0x6398('0x7d')]);_0xa9f3da({'count':_0x1cb241[_0x6398('0x59')],'rows':_0x1cb241});});},'OutboundChannels':function(_0x36a166){return new Promise(function(_0x98b2b6,_0xef1437){var _0x58ca8e=_[_0x6398('0x5a')](_0x28dff1[_0x6398('0x7e')]);_0x98b2b6({'count':_0x58ca8e[_0x6398('0x59')],'rows':_0x58ca8e});});},'Outbound':function(_0x3e55ac){return new Promise(function(_0x54fdd7,_0x472bca){_0x54fdd7(_0x28dff1[_0x6398('0x31')]);});},'Campaigns':function(_0x116203){return new Promise(function(_0x543832,_0x571f09){var _0x82644b=_[_0x6398('0x5a')](_0x28dff1[_0x6398('0x7f')]);_0x543832({'count':_0x82644b[_0x6398('0x59')],'rows':_0x82644b});});},'VoiceQueuesPreview':function(_0x12dd6d){var _0x35819c=this;return new Promise(function(_0x3c5181,_0x3120b6){_0x3fcc85['run'](_0x12dd6d['id'])[_0x6398('0x1c')](function(_0x47a52a){_0x3c5181({'code':0xc8,'message':_0x47a52a[_0x6398('0x1d')]});})[_0x6398('0x1e')](function(_0x14613b){_0x3120b6(_0x35819c[_0x6398('0x1f')](0x1f4,_0x14613b['message']));});});},'EventManager':function(_0x1f7394){var _0xdb5062=this;return new Promise(function(_0x358c6b,_0x47e63e){if(!_0x1f7394[_0x6398('0x80')]){return _0x47e63e(_0xdb5062[_0x6398('0x1f')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x6398('0x81')](_0x6398('0x82')+_0x1f7394[_0x6398('0x80')],_0x1f7394[_0x6398('0x1d')]);_0x358c6b({'code':0xc8,'message':_0x1f7394});});},'FaxAccounts':function(_0x2a5484){return new Promise(function(_0xb8116c,_0x5c7ab9){var _0x2d80ca=_['values'](_0x28dff1[_0x6398('0x83')]);_0xb8116c({'count':_0x2d80ca[_0x6398('0x59')],'rows':_0x2d80ca});});},'SendFax':function(_0x168840){var _0x4859b5=this;return new Promise(function(_0x12678d,_0x18523b){_0x159f9a[_0x6398('0x84')](_0x168840)[_0x6398('0x1c')](function(_0x1bb63e){_0x12678d({'code':0xc8,'message':_0x1bb63e[_0x6398('0x1d')]});})[_0x6398('0x1e')](function(_0x87f302){_0x18523b(_0x4859b5[_0x6398('0x1f')](0x1f4,_0x87f302['message']));});});},'CheckAfterSend':function(_0x1f5f0e){var _0x35af1c=this;return new Promise(function(_0x1930e4,_0x59ef3e){_0x159f9a[_0x6398('0x85')](_0x1f5f0e)['then'](function(_0x5367be){_0x1930e4({'code':0xc8,'message':_0x5367be[_0x6398('0x1d')]});})['catch'](function(_0x88d996){_0x59ef3e(_0x35af1c[_0x6398('0x1f')](0x1f4,_0x88d996[_0x6398('0x1d')]));});});}};var _0x28abce=jayson[_0x6398('0x86')](_0x46367f)[_0x6398('0x87')]();_0x28abce['on'](_0x6398('0x1f'),function(_0x143c71){return _0x40cad1(_0x143c71);});_0x28abce[_0x6398('0x88')](0x232a,_0x6398('0x89'),function(){console[_0x6398('0x8a')](_0x6398('0x8b'),0x232a);return _0x49e784(_0x6398('0x8c')+0x232a);});});}; \ No newline at end of file +var _0x4b6b=['wav','MixMonitor','toLowerCase','isNil','monitors','push','/var/spool/asterisk/monitor/','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','run','Event\x20name\x20mandatory','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','error','asterisk','ami\x20disconnected','keys','module','action','Action','then','catch','message','isConnected','join','pick','command','Command','content','voiceQueues','strategy','answered','available','loggedIn','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','username','voicechannel','map','find','uniqueid','channel','%s.%s'];(function(_0x16d8db,_0x6a1999){var _0x51ca48=function(_0x412e25){while(--_0x412e25){_0x16d8db['push'](_0x16d8db['shift']());}};_0x51ca48(++_0x6a1999);}(_0x4b6b,0xab));var _0xb4b6=function(_0x479cde,_0x2974ad){_0x479cde=_0x479cde-0x0;var _0x528f22=_0x4b6b[_0x479cde];return _0x528f22;};'use strict';var _=require('lodash');var util=require(_0xb4b6('0x0'));var jayson=require(_0xb4b6('0x1'));var schema=require(_0xb4b6('0x2'));var BPromise=require(_0xb4b6('0x3'));var moment=require(_0xb4b6('0x4'));var config=require(_0xb4b6('0x5'));var properties=require('../properties');var ami=require(_0xb4b6('0x6'));exports[_0xb4b6('0x7')]=function(_0x5eb189,_0x11397a,_0x585aec){return new BPromise(function(_0x2dc78a,_0x2c0cd7){var _0x808075={'QueuePause':function(_0x5808c0){return new Promise(function(_0x35dc11,_0x39dfe8){var _0x3b71d1=util[_0xb4b6('0x8')](_0xb4b6('0x9'),'SIP',_0x5808c0[_0xb4b6('0xa')]);if(_0x5eb189['timers']&&_0x5eb189[_0xb4b6('0xb')][_0x3b71d1]&&_0x5eb189[_0xb4b6('0xb')][_0x3b71d1][_0xb4b6('0xc')]){_0x5eb189[_0xb4b6('0xb')][_0x3b71d1][_0xb4b6('0xd')]();}if(_0x5eb189[_0xb4b6('0xe')][_0x3b71d1]){_0x5eb189[_0xb4b6('0xe')][_0x3b71d1][_0xb4b6('0xf')]({'statePause':_0x5808c0[_0xb4b6('0x10')]?!![]:![]});}_0x35dc11({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x48c977){var _0xec9c13=this;return new Promise(function(_0x559dda,_0x3b3e4f){if(ami['isConnected']()==![]){return _0x3b3e4f(_0xec9c13[_0xb4b6('0x11')](0x1f4,[config[_0xb4b6('0x12')]['ip'],config['asterisk']['username'],_0xb4b6('0x13')]['join']('\x20')));}_0x48c977=_['pick'](_0x48c977,_[_0xb4b6('0x14')](properties[_0xb4b6('0x15')]));_0x48c977[_0xb4b6('0x16')]='Reload';return ami[_0xb4b6('0x17')](_0x48c977)[_0xb4b6('0x18')](function(_0x520f92){_0x559dda({'code':0xc8,'message':_0x520f92['message']});})[_0xb4b6('0x19')](function(_0xddaa13){_0x3b3e4f(_0xec9c13['error'](0x1f5,_0xddaa13[_0xb4b6('0x1a')]));});});},'Command':function(_0x3f8d3c){var _0x9aae29=this;return new Promise(function(_0x2c1d11,_0x3c34b1){if(ami[_0xb4b6('0x1b')]()==![]){return _0x3c34b1(_0x9aae29[_0xb4b6('0x11')](0x1f4,[config[_0xb4b6('0x12')]['ip'],config['asterisk']['username'],_0xb4b6('0x13')][_0xb4b6('0x1c')]('\x20')));}_0x3f8d3c=_[_0xb4b6('0x1d')](_0x3f8d3c,_0xb4b6('0x1e'));_0x3f8d3c[_0xb4b6('0x16')]=_0xb4b6('0x1f');return ami['Action'](_0x3f8d3c)[_0xb4b6('0x18')](function(_0x1902e7){_0x2c1d11({'code':0xc8,'message':_0x1902e7[_0xb4b6('0x20')]});})[_0xb4b6('0x19')](function(_0x3166a8){_0x3c34b1(_0x9aae29['error'](0x1f5,_0x3166a8[_0xb4b6('0x1a')]));});});},'VoiceQueues':function(_0x4c9810){return new Promise(function(_0x16e4d6,_0x15a588){var _0x5e8a93=[];for(var _0x216122 in _0x5eb189[_0xb4b6('0x21')]){if(_0x5eb189[_0xb4b6('0x21')]['hasOwnProperty'](_0x216122)){var _0x17eaa8=_0x5eb189[_0xb4b6('0x21')][_0x216122];var _0x572070={'id':_0x17eaa8['id'],'name':_0x17eaa8['name'],'strategy':_0x17eaa8[_0xb4b6('0x22')],'answered':_0x17eaa8[_0xb4b6('0x23')],'available':_0x17eaa8[_0xb4b6('0x24')],'loggedIn':_0x17eaa8[_0xb4b6('0x25')],'pTalking':_0x17eaa8['pTalking'],'sumBillable':_0x17eaa8['sumBillable'],'sumDuration':_0x17eaa8['sumDuration'],'sumHoldTime':_0x17eaa8['sumHoldTime']||0x0,'talking':_0x17eaa8['talking'],'total':_0x17eaa8['total'],'type':_0x17eaa8[_0xb4b6('0x26')],'unmanaged':_0x17eaa8[_0xb4b6('0x27')],'abandoned':_0x17eaa8['abandoned'],'waiting':_0x17eaa8[_0xb4b6('0x28')],'loggedInDb':_0x17eaa8['loggedInDb']};if(_0x17eaa8[_0xb4b6('0x26')]===_0xb4b6('0x29')){_0x572070['dialActive']=_0x17eaa8[_0xb4b6('0x2a')];_0x572070[_0xb4b6('0x2b')]=_0x17eaa8[_0xb4b6('0x2b')];_0x572070['dialOriginateCallerIdName']=_0x17eaa8[_0xb4b6('0x2c')];_0x572070[_0xb4b6('0x2d')]=_0x17eaa8[_0xb4b6('0x2d')];_0x572070[_0xb4b6('0x2e')]=_0x17eaa8[_0xb4b6('0x2e')];_0x572070['dialPrefix']=_0x17eaa8[_0xb4b6('0x2f')];_0x572070[_0xb4b6('0x30')]=_0x17eaa8[_0xb4b6('0x30')];_0x572070[_0xb4b6('0x31')]=_0x17eaa8[_0xb4b6('0x31')];_0x572070[_0xb4b6('0x32')]=_0x17eaa8[_0xb4b6('0x32')];_0x572070[_0xb4b6('0x33')]=_0x17eaa8['outboundBusyCallsDay'];_0x572070[_0xb4b6('0x34')]=_0x17eaa8[_0xb4b6('0x34')];_0x572070[_0xb4b6('0x35')]=_0x17eaa8[_0xb4b6('0x35')];_0x572070[_0xb4b6('0x36')]=_0x17eaa8[_0xb4b6('0x36')];_0x572070[_0xb4b6('0x37')]=_0x17eaa8['outboundDropCallsDayTimeout'];_0x572070[_0xb4b6('0x38')]=_0x17eaa8[_0xb4b6('0x38')];_0x572070[_0xb4b6('0x39')]=_0x17eaa8['outboundNoSuchCallsDay'];_0x572070[_0xb4b6('0x3a')]=_0x17eaa8[_0xb4b6('0x3a')];_0x572070['outboundReCallsDay']=_0x17eaa8[_0xb4b6('0x3b')];_0x572070['outboundRejectCallsDay']=_0x17eaa8[_0xb4b6('0x3c')];_0x572070['outboundUnknownCallsDay']=_0x17eaa8['outboundUnknownCallsDay'];_0x572070[_0xb4b6('0x3d')]=_0x17eaa8[_0xb4b6('0x3d')];_0x572070[_0xb4b6('0x3e')]=_0x17eaa8[_0xb4b6('0x3e')];_0x572070[_0xb4b6('0x3f')]=_0x17eaa8[_0xb4b6('0x3f')];_0x572070[_0xb4b6('0x40')]=_0x17eaa8['predictiveIntervalDroppedCallsCallersExit'];_0x572070[_0xb4b6('0x41')]=_0x17eaa8['predictiveIntervalDroppedCallsTimeout'];_0x572070[_0xb4b6('0x42')]=_0x17eaa8[_0xb4b6('0x42')];_0x572070['predictiveIntervalErlangCallsDroppedCalls']=_0x17eaa8['predictiveIntervalErlangCallsDroppedCalls'];_0x572070[_0xb4b6('0x43')]=_0x17eaa8[_0xb4b6('0x43')];_0x572070[_0xb4b6('0x44')]=_0x17eaa8[_0xb4b6('0x44')];_0x572070[_0xb4b6('0x45')]=_0x17eaa8['predictiveIntervalPauses'];_0x572070[_0xb4b6('0x46')]=_0x17eaa8[_0xb4b6('0x46')];_0x572070['predictiveIntervalTotalCalls']=_0x17eaa8[_0xb4b6('0x47')];_0x572070[_0xb4b6('0x1a')]=_0x17eaa8['message'];_0x572070[_0xb4b6('0x48')]=_0x17eaa8[_0xb4b6('0x48')];_0x572070[_0xb4b6('0x49')]=_0x17eaa8[_0xb4b6('0x49')];_0x572070['erlangCallToSecond']=_0x17eaa8['erlangCallToSecond'];_0x572070[_0xb4b6('0x4a')]=_0x17eaa8[_0xb4b6('0x4a')];_0x572070['erlangBusyFactor']=_0x17eaa8[_0xb4b6('0x4b')];_0x572070['startPredictive']=_0x17eaa8[_0xb4b6('0x4c')];_0x572070[_0xb4b6('0x4d')]=_0x17eaa8[_0xb4b6('0x4d')];}if(_0x17eaa8[_0xb4b6('0x4e')]){_0x572070[_0xb4b6('0x4e')]={'id':_0x17eaa8[_0xb4b6('0x4e')]['id'],'name':_0x17eaa8['Trunk'][_0xb4b6('0xa')],'active':_0x17eaa8[_0xb4b6('0x4e')][_0xb4b6('0x4f')],'callerid':_0x17eaa8[_0xb4b6('0x4e')][_0xb4b6('0x50')]};}if(_0x17eaa8[_0xb4b6('0x51')]){_0x572070[_0xb4b6('0x51')]={'id':_0x17eaa8['Interval']['id'],'name':_0x17eaa8[_0xb4b6('0x51')][_0xb4b6('0xa')]};}_0x5e8a93['push'](_0x572070);}}_0x16e4d6({'count':_0x5e8a93[_0xb4b6('0x52')],'rows':_0x5e8a93});});},'VoiceChannels':function(_0x671d2){return new Promise(function(_0x149ba2,_0x3a4ef0){var _0x2e6acb=_[_0xb4b6('0x53')](_0x5eb189['channels']);_0x149ba2({'count':_0x2e6acb[_0xb4b6('0x52')],'rows':_0x2e6acb});});},'VoiceChannelMixMonitor':function(_0x528c61){var _0x5c5a2e=this;return new Promise(function(_0x5486cf,_0x43fd29){if(ami[_0xb4b6('0x1b')]()==![]){return _0x43fd29(_0x5c5a2e[_0xb4b6('0x11')](0x1f4,[config[_0xb4b6('0x12')]['ip'],config[_0xb4b6('0x12')][_0xb4b6('0x54')],_0xb4b6('0x13')]['join']('\x20')));}var _0x4e0fea=schema(properties[_0xb4b6('0x55')])[_0xb4b6('0x2')](_0x528c61);if(_0x4e0fea['length']>0x0){return _0x43fd29(_0x5c5a2e[_0xb4b6('0x11')](0x1f4,_[_0xb4b6('0x56')](_0x4e0fea,'message')[_0xb4b6('0x1c')](',\x20')));}var _0x2815d9=_[_0xb4b6('0x57')](_0x5eb189['channels'],{'uniqueid':_0x528c61[_0xb4b6('0x58')]});if(_0x2815d9&&_0x2815d9[_0xb4b6('0x59')]){var _0x42dbfc=util[_0xb4b6('0x8')](_0xb4b6('0x5a'),_0x528c61['filename']||_0x528c61[_0xb4b6('0x58')],_0x528c61['format']||_0xb4b6('0x5b'));return ami[_0xb4b6('0x17')]({'action':_0xb4b6('0x5c'),'channel':_0x2815d9[_0xb4b6('0x59')],'file':_0x42dbfc,'options':'ai(mixmonitorid)'})[_0xb4b6('0x18')](function(_0x312091){var _0xe54bc6=_[_0xb4b6('0x57')](_0x2815d9['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x42dbfc[_0xb4b6('0x5d')]()});if(_[_0xb4b6('0x5e')](_0xe54bc6)){_0x2815d9[_0xb4b6('0x5f')][_0xb4b6('0x60')]({'filename':_0xb4b6('0x61')+_0x42dbfc[_0xb4b6('0x5d')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x312091[_0xb4b6('0x62')],'status':'rec'});}else{_0xe54bc6[_0xb4b6('0x62')]=_0x312091[_0xb4b6('0x62')];_0xe54bc6[_0xb4b6('0x63')]=_0xb4b6('0x64');}_0x5486cf({'code':0xc8,'message':[_0x528c61[_0xb4b6('0x58')],_0xb4b6('0x65'),_0x312091[_0xb4b6('0x62')]][_0xb4b6('0x1c')]('\x20'),'mixmonitorid':_0x312091[_0xb4b6('0x62')]});})['catch'](function(_0x5f3008){_0x43fd29(_0x5c5a2e['error'](0x1f5,[_0x528c61[_0xb4b6('0x58')],_0x5f3008[_0xb4b6('0x1a')]['toLowerCase']()][_0xb4b6('0x1c')]('\x20')));});}else{return _0x43fd29(_0x5c5a2e[_0xb4b6('0x11')](0x1f5,_0xb4b6('0x66')));}});},'VoiceChannelStopMixMonitor':function(_0x4b34bb){var _0x5a06b9=this;return new Promise(function(_0x383de1,_0x30abc4){if(ami['isConnected']()==![]){return _0x30abc4(_0x5a06b9[_0xb4b6('0x11')](0x1f4,[config[_0xb4b6('0x12')]['ip'],config['asterisk'][_0xb4b6('0x54')],'ami\x20disconnected'][_0xb4b6('0x1c')]('\x20')));}var _0x59748e=schema(properties[_0xb4b6('0x55')])[_0xb4b6('0x2')](_0x4b34bb);if(_0x59748e['length']>0x0){return _0x30abc4(_0x5a06b9[_0xb4b6('0x11')](0x1f4,_['map'](_0x59748e,'message')['join'](',\x20')));}var _0x1d0cf9=_[_0xb4b6('0x57')](_0x5eb189[_0xb4b6('0x67')],{'uniqueid':_0x4b34bb['uniqueid']});if(_0x1d0cf9){return BPromise[_0xb4b6('0x68')]()[_0xb4b6('0x18')](function(){if(_0x1d0cf9[_0xb4b6('0x59')]){return ami[_0xb4b6('0x17')]({'action':_0xb4b6('0x69'),'channel':_0x1d0cf9['channel'],'mixmonitorid':_0x4b34bb[_0xb4b6('0x62')]})[_0xb4b6('0x19')](function(_0x11ef30){});}})[_0xb4b6('0x18')](function(){if(_0x1d0cf9[_0xb4b6('0x6a')]){return ami[_0xb4b6('0x17')]({'action':_0xb4b6('0x69'),'channel':_0x1d0cf9[_0xb4b6('0x6a')],'mixmonitorid':_0x4b34bb[_0xb4b6('0x62')]})[_0xb4b6('0x19')](function(_0x2e0ec8){});}})[_0xb4b6('0x18')](function(_0x413bcf){var _0x15e716=_[_0xb4b6('0x57')](_0x1d0cf9[_0xb4b6('0x5f')],{'mixmonitorid':_0x4b34bb[_0xb4b6('0x62')]});if(_0x15e716){_0x15e716[_0xb4b6('0x63')]=_0xb4b6('0x6b');}})[_0xb4b6('0x18')](function(){var _0x2aace3=util['format'](_0xb4b6('0x5a'),_0x4b34bb[_0xb4b6('0x6c')]||_0x4b34bb[_0xb4b6('0x58')],_0x4b34bb[_0xb4b6('0x8')]||'wav');var _0x55292c=_[_0xb4b6('0x57')](_0x1d0cf9[_0xb4b6('0x5f')],{'filename':_0xb4b6('0x61')+_0x2aace3[_0xb4b6('0x5d')]()});if(_0x55292c){_0x55292c[_0xb4b6('0x63')]=_0xb4b6('0x6b');}})[_0xb4b6('0x18')](function(){_0x383de1({'code':0xc8,'message':[_0x4b34bb[_0xb4b6('0x58')],_0xb4b6('0x6d')][_0xb4b6('0x1c')]('\x20')});})[_0xb4b6('0x19')](function(_0x4acee3){_0x30abc4(_0x5a06b9[_0xb4b6('0x11')](0x1f5,[_0x4b34bb['uniqueid'],_0x4acee3['message'][_0xb4b6('0x5d')]()][_0xb4b6('0x1c')]('\x20')));});}else{return _0x30abc4(_0x5a06b9['error'](0x1f5,_0xb4b6('0x66')));}});},'VoiceQueuesChannels':function(_0x35c925){return new Promise(function(_0x3e9b0f,_0x1cbd8a){var _0x2e109e=_['values'](_0x5eb189['queueChannels']);_0x3e9b0f({'count':_0x2e109e[_0xb4b6('0x52')],'rows':_0x2e109e});});},'VoiceQueuesChannel':function(_0x4e3733){var _0x1f49db=this;return new Promise(function(_0x466fbc,_0x4047d4){var _0x550932=schema(properties['voicequeuechannel'])[_0xb4b6('0x2')](_0x4e3733);if(_0x550932[_0xb4b6('0x52')]>0x0){return _0x4047d4(_0x1f49db[_0xb4b6('0x11')](0x1f4,_[_0xb4b6('0x56')](_0x550932,'message')[_0xb4b6('0x1c')](',\x20')));}var _0x2d2bf5=_[_0xb4b6('0x57')](_0x5eb189['queueChannels'],{'uniqueid':_0x4e3733['uniqueid']});if(_0x2d2bf5){_0x466fbc(_0x2d2bf5);}else{return _0x4047d4(_0x1f49db[_0xb4b6('0x11')](0x1f5,_0xb4b6('0x66')));}});},'VoiceQueuesChannelHangup':function(_0xa0269e){var _0x45138d=this;return new Promise(function(_0x4f22ba,_0x44d116){if(ami[_0xb4b6('0x1b')]()==![]){return _0x44d116(_0x45138d[_0xb4b6('0x11')](0x1f4,[config[_0xb4b6('0x12')]['ip'],config[_0xb4b6('0x12')][_0xb4b6('0x54')],'ami\x20disconnected'][_0xb4b6('0x1c')]('\x20')));}var _0x373fa9=schema(properties[_0xb4b6('0x6e')])[_0xb4b6('0x2')](_0xa0269e);if(_0x373fa9[_0xb4b6('0x52')]>0x0){return _0x44d116(_0x45138d['error'](0x1f4,_[_0xb4b6('0x56')](_0x373fa9,_0xb4b6('0x1a'))['join'](',\x20')));}var _0x2c8846=_['find'](_0x5eb189[_0xb4b6('0x6f')],{'uniqueid':_0xa0269e[_0xb4b6('0x58')]});if(_0x2c8846&&_0x2c8846[_0xb4b6('0x59')]){return ami[_0xb4b6('0x17')]({'action':_0xb4b6('0x70'),'channel':_0x2c8846[_0xb4b6('0x59')]})[_0xb4b6('0x18')](function(_0x236bbb){_0x4f22ba({'code':0xc8,'message':[_0xa0269e[_0xb4b6('0x58')],_0x236bbb[_0xb4b6('0x1a')][_0xb4b6('0x5d')]()][_0xb4b6('0x1c')]('\x20')});})[_0xb4b6('0x19')](function(_0x110353){_0x44d116(_0x45138d['error'](0x1f5,[_0xa0269e[_0xb4b6('0x58')],_0x110353[_0xb4b6('0x1a')][_0xb4b6('0x5d')]()][_0xb4b6('0x1c')]('\x20')));});}else{return _0x44d116(_0x45138d[_0xb4b6('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2bf212){var _0x51bb48=this;return new Promise(function(_0x4a870b,_0x5b1a60){if(ami[_0xb4b6('0x1b')]()==![]){return _0x5b1a60(_0x51bb48[_0xb4b6('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xb4b6('0x13')][_0xb4b6('0x1c')]('\x20')));}var _0x2d2e72=schema(properties['voicequeuechannelredirect'])[_0xb4b6('0x2')](_0x2bf212);if(_0x2d2e72[_0xb4b6('0x52')]>0x0){return _0x5b1a60(_0x51bb48['error'](0x1f4,_['map'](_0x2d2e72,_0xb4b6('0x1a'))[_0xb4b6('0x1c')](',\x20')));}var _0x2866f5=_['find'](_0x5eb189[_0xb4b6('0x6f')],{'uniqueid':_0x2bf212['uniqueid']});if(_0x2866f5&&_0x2866f5[_0xb4b6('0x59')]){return ami[_0xb4b6('0x17')]({'action':_0xb4b6('0x71'),'channel':_0x2866f5[_0xb4b6('0x59')],'exten':_0x2bf212[_0xb4b6('0x72')],'context':_0x2bf212[_0xb4b6('0x73')]||_0x2866f5[_0xb4b6('0x73')],'priority':0x1})[_0xb4b6('0x18')](function(_0x332d37){_0x4a870b({'code':0xc8,'message':[_0x2bf212['uniqueid'],_0x332d37['message']['toLowerCase']()]['join']('\x20')});})[_0xb4b6('0x19')](function(_0x2a7107){_0x5b1a60(_0x51bb48['error'](0x1f5,[_0x2bf212[_0xb4b6('0x58')],_0x2a7107[_0xb4b6('0x1a')][_0xb4b6('0x5d')]()][_0xb4b6('0x1c')]('\x20')));});}else{return _0x5b1a60(_0x51bb48[_0xb4b6('0x11')](0x1f5,_0xb4b6('0x66')));}});},'Agents':function(_0x1492e8){return new Promise(function(_0x475512,_0x19d399){var _0x4eb65d=_[_0xb4b6('0x53')](_0x5eb189[_0xb4b6('0xe')]);_0x475512({'count':_0x4eb65d['length'],'rows':_0x4eb65d});});},'Telephones':function(_0x3913da){return new Promise(function(_0x56362e,_0x1fdb4c){var _0x4d3d0a=_[_0xb4b6('0x53')](_0x5eb189[_0xb4b6('0x74')]);_0x56362e({'count':_0x4d3d0a[_0xb4b6('0x52')],'rows':_0x4d3d0a});});},'Trunks':function(_0x3af1d3){return new Promise(function(_0xa598b0,_0xedde42){var _0x38e90e=_[_0xb4b6('0x53')](_0x5eb189[_0xb4b6('0x75')]);_0xa598b0({'count':_0x38e90e[_0xb4b6('0x52')],'rows':_0x38e90e});});},'OutboundChannels':function(_0x2e0378){return new Promise(function(_0x4c8f61,_0x16386f){var _0x32a5c1=_[_0xb4b6('0x53')](_0x5eb189[_0xb4b6('0x76')]);_0x4c8f61({'count':_0x32a5c1[_0xb4b6('0x52')],'rows':_0x32a5c1});});},'Outbound':function(_0x5f36cd){return new Promise(function(_0x2b1c2a,_0x1ff155){_0x2b1c2a(_0x5eb189[_0xb4b6('0x29')]);});},'Campaigns':function(_0x5e87fc){return new Promise(function(_0x1ef0a7,_0x455db5){var _0x5502fa=_['values'](_0x5eb189['campaigns']);_0x1ef0a7({'count':_0x5502fa[_0xb4b6('0x52')],'rows':_0x5502fa});});},'VoiceQueuesPreview':function(_0x3987bb){var _0xc5b2dc=this;return new Promise(function(_0x488050,_0xab3e1f){_0x11397a[_0xb4b6('0x77')](_0x3987bb['id'])['then'](function(_0x584c3c){_0x488050({'code':0xc8,'message':_0x584c3c[_0xb4b6('0x1a')]});})['catch'](function(_0x3c0ef4){_0xab3e1f(_0xc5b2dc[_0xb4b6('0x11')](0x1f4,_0x3c0ef4[_0xb4b6('0x1a')]));});});},'EventManager':function(_0x22d8a7){var _0x249a39=this;return new Promise(function(_0x498de7,_0x3c9542){if(!_0x22d8a7['event']){return _0x3c9542(_0x249a39['error'](0x1f4,_0xb4b6('0x78')));}ami['emit'](_0xb4b6('0x79')+_0x22d8a7[_0xb4b6('0x7a')],_0x22d8a7[_0xb4b6('0x1a')]);_0x498de7({'code':0xc8,'message':_0x22d8a7});});},'FaxAccounts':function(_0x41571c){return new Promise(function(_0x26ade0,_0x259b32){var _0x501cc8=_[_0xb4b6('0x53')](_0x5eb189[_0xb4b6('0x7b')]);_0x26ade0({'count':_0x501cc8['length'],'rows':_0x501cc8});});},'SendFax':function(_0x59e4fd){var _0x155386=this;return new Promise(function(_0x5cd172,_0x4583d8){_0x585aec[_0xb4b6('0x7c')](_0x59e4fd)[_0xb4b6('0x18')](function(_0x490d64){_0x5cd172({'code':0xc8,'message':_0x490d64['message']});})[_0xb4b6('0x19')](function(_0x23066d){_0x4583d8(_0x155386[_0xb4b6('0x11')](0x1f4,_0x23066d['message']));});});},'CheckAfterSend':function(_0x3f8f48){var _0xb3c595=this;return new Promise(function(_0x5d3f9b,_0x11393f){_0x585aec[_0xb4b6('0x7d')](_0x3f8f48)['then'](function(_0x45fd8c){_0x5d3f9b({'code':0xc8,'message':_0x45fd8c[_0xb4b6('0x1a')]});})[_0xb4b6('0x19')](function(_0x40bc35){_0x11393f(_0xb3c595[_0xb4b6('0x11')](0x1f4,_0x40bc35[_0xb4b6('0x1a')]));});});}};var _0x569ff8=jayson[_0xb4b6('0x7e')](_0x808075)[_0xb4b6('0x7f')]();_0x569ff8['on'](_0xb4b6('0x11'),function(_0x474161){return _0x2c0cd7(_0x474161);});_0x569ff8[_0xb4b6('0x7')](0x232a,_0xb4b6('0x80'),function(){console[_0xb4b6('0x81')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2dc78a(_0xb4b6('0x82')+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 ea82872..a51f7cb 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 _0x9638=['mobile','scheduledAt','updatedAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','destcalleridnum','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','emit','data1','data2','ListId','data3','split','phone','$or','routeId','firstName','lastName'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9638,0x85));var _0x8963=function(_0x427214,_0xaa01af){_0x427214=_0x427214-0x0;var _0x4a9fe0=_0x9638[_0x427214];return _0x4a9fe0;};'use strict';var _=require(_0x8963('0x0'));var BPromise=require(_0x8963('0x1'));var Redis=require(_0x8963('0x2'));var util=require(_0x8963('0x3'));var config=require(_0x8963('0x4'));var logger=require(_0x8963('0x5'))('trigger');var cmContactRpc=require(_0x8963('0x6'));config[_0x8963('0x7')]=_['defaults'](config[_0x8963('0x7')],{'host':_0x8963('0x8'),'port':0x18eb});var io=require(_0x8963('0x9'))(new Redis(config[_0x8963('0x7')]));function emit(_0x45650f,_0x5f360a,_0x20eab3,_0x510d3d,_0x4c4f89){logger[_0x8963('0xa')]('[CM][%s][%s]',_0x45650f,_0x5f360a['id'],_0x20eab3,_0x510d3d,JSON[_0x8963('0xb')](_0x4c4f89));io['to'](_0x20eab3)[_0x8963('0xc')](_0x510d3d,_0x4c4f89);}exports['exec']=function(_0x18b5c1,_0x4ea123,_0x2412cc,_0x589d4f){var _0x134704,_0xa45210;var _0x33a16a={};var _0x5a0798=Number(_0x2412cc[_0x8963('0xd')]);var _0x11862c=_0x2412cc[_0x8963('0xe')]?Boolean(Number(_0x2412cc[_0x8963('0xe')])):![];var _0x132168;if(_0x589d4f['xmd-contactid']){_0x33a16a['id']=_0x589d4f['xmd-contactid'];}if(!_0x33a16a['id']){_0x33a16a[_0x8963('0xf')]=_0x5a0798;_0x132168=_0x2412cc[_0x8963('0x10')]&&_0x2412cc[_0x8963('0x10')]!=='0'?_0x2412cc[_0x8963('0x10')][_0x8963('0x11')](','):[_0x8963('0x12')];_0x33a16a[_0x8963('0x13')]=_['map'](_0x132168,function(_0x1664fd){var _0x2c4471={};_0x2c4471[_0x1664fd]=_0x589d4f[_0x8963('0x14')]?_0x589d4f['destcalleridnum']:_0x589d4f['calleridnum'];return _0x2c4471;});}var _0x45c209=['id',_0x8963('0x15'),_0x8963('0x16'),_0x8963('0x12'),_0x8963('0x17'),'fax',_0x8963('0xf'),'createdAt',_0x8963('0x18'),_0x8963('0x19')];var _0x45bedf=_[_0x8963('0x1a')](_0x45c209,_0x132168);BPromise['resolve']()[_0x8963('0x1b')](cmContactRpc['getContacts']({'attributes':_0x45bedf,'where':_0x33a16a}))[_0x8963('0x1b')](function(_0x552f8a){_0xa45210=_0x552f8a;if(!_[_0x8963('0x1c')](_0xa45210)){if(_0xa45210[_0x8963('0x1d')]===0x1){_0x134704=_0xa45210[0x0];logger['info'](_0x8963('0x1e'),_0x589d4f['uniqueid'],_0x4ea123['id'],_0x134704['id']);}else{logger[_0x8963('0xa')](_0x8963('0x1f'),_0x589d4f[_0x8963('0x20')],_0x4ea123['id'],_[_0x8963('0x21')](_0xa45210,'id')['join'](','));}return;}else{logger[_0x8963('0xa')](_0x8963('0x22'),_0x589d4f[_0x8963('0x20')],_0x4ea123['id']);var _0x18b39b={'ListId':_0x5a0798};var _0x417867=_0x2412cc[_0x8963('0x23')]&&_0x2412cc[_0x8963('0x23')]!=='0'?_0x2412cc[_0x8963('0x23')]:'phone';if(_0x11862c){logger['info'](_0x8963('0x24'),_0x589d4f[_0x8963('0x20')],_0x4ea123['id']);_0x18b39b[_0x417867]=_['isNil'](_0x589d4f[_0x8963('0x14')])?_0x589d4f[_0x8963('0x25')]:_0x589d4f[_0x8963('0x26')];if(_[_0x8963('0x27')](_0x589d4f[_0x8963('0x14')])){_0x18b39b[_0x8963('0x15')]=_0x589d4f[_0x8963('0x28')]&&_0x589d4f[_0x8963('0x28')]!==_0x8963('0x29')?_0x589d4f[_0x8963('0x28')]:_0x8963('0x2a');}else{_0x18b39b[_0x8963('0x15')]=_0x589d4f[_0x8963('0x2b')]&&_0x589d4f[_0x8963('0x2b')]!==_0x8963('0x29')?_0x589d4f[_0x8963('0x2b')]:_0x8963('0x2a');}return BPromise['resolve']()['then'](cmContactRpc[_0x8963('0x2c')](_0x18b39b))[_0x8963('0x1b')](function(_0x48d326){_0x134704=_0x48d326;_0xa45210[_0x8963('0x2d')](_0x48d326);if(_0x134704){logger['info'](_0x8963('0x2e'),_0x589d4f[_0x8963('0x20')],_0x4ea123['id'],_0x134704['id']);}return;});}else{logger[_0x8963('0xa')](_0x8963('0x2f'),_0x589d4f[_0x8963('0x20')],_0x4ea123['id']);_0x18b39b[_0x417867]=_[_0x8963('0x27')](_0x589d4f[_0x8963('0x14')])?_0x589d4f[_0x8963('0x25')]:_0x589d4f['destcalleridnum'];if(_[_0x8963('0x27')](_0x589d4f[_0x8963('0x14')])){_0x18b39b[_0x8963('0x15')]=_0x589d4f[_0x8963('0x28')]&&_0x589d4f[_0x8963('0x28')]!==_0x8963('0x29')?_0x589d4f[_0x8963('0x28')]:_0x8963('0x2a');}else{_0x18b39b[_0x8963('0x15')]=_0x589d4f[_0x8963('0x2b')]&&_0x589d4f['destcalleridname']!==_0x8963('0x29')?_0x589d4f[_0x8963('0x2b')]:'Unknown';}_0x134704=_0x18b39b;_0xa45210['push'](_0x18b39b);return;}}})[_0x8963('0x1b')](function(){if(_0x18b5c1){emit(_0x589d4f[_0x8963('0x20')],_0x4ea123,util[_0x8963('0x30')](_0x8963('0x31'),_0x18b5c1['name']),util[_0x8963('0x30')]('trigger:%s',_0x2412cc[_0x8963('0x32')]['toLowerCase']()),{'evt':_[_0x8963('0x33')](_0x589d4f,{'autoCreate':_0x11862c}),'contact':_0x134704===undefined?{}:_0x134704,'contacts':_0xa45210[_0x8963('0x1d')]===0x0?undefined:_0xa45210});}});}; \ No newline at end of file +var _0x27f5=['mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','format','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','xmd-contactid','ListId','data3','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x27f5,0xbb));var _0x527f=function(_0x25a45a,_0x156e4b){_0x25a45a=_0x25a45a-0x0;var _0x237f87=_0x27f5[_0x25a45a];return _0x237f87;};'use strict';var _=require('lodash');var BPromise=require(_0x527f('0x0'));var Redis=require(_0x527f('0x1'));var util=require(_0x527f('0x2'));var config=require('../../../../config/environment');var logger=require(_0x527f('0x3'))(_0x527f('0x4'));var cmContactRpc=require(_0x527f('0x5'));config['redis']=_[_0x527f('0x6')](config[_0x527f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x527f('0x8'))(new Redis(config[_0x527f('0x7')]));function emit(_0x31ed78,_0x32000d,_0x318738,_0x45a6c4,_0x761e59){logger[_0x527f('0x9')](_0x527f('0xa'),_0x31ed78,_0x32000d['id'],_0x318738,_0x45a6c4,JSON[_0x527f('0xb')](_0x761e59));io['to'](_0x318738)[_0x527f('0xc')](_0x45a6c4,_0x761e59);}exports[_0x527f('0xd')]=function(_0x45fbd0,_0x26d382,_0x315d73,_0xd62407){var _0x11b303,_0x209e65;var _0x2fef28={};var _0x18e1f0=Number(_0x315d73['data1']);var _0x513212=_0x315d73[_0x527f('0xe')]?Boolean(Number(_0x315d73[_0x527f('0xe')])):![];var _0x5c3803;if(_0xd62407[_0x527f('0xf')]){_0x2fef28['id']=_0xd62407['xmd-contactid'];}if(!_0x2fef28['id']){_0x2fef28[_0x527f('0x10')]=_0x18e1f0;_0x5c3803=_0x315d73[_0x527f('0x11')]&&_0x315d73[_0x527f('0x11')]!=='0'?_0x315d73[_0x527f('0x11')]['split'](','):[_0x527f('0x12')];_0x2fef28['$or']=_[_0x527f('0x13')](_0x5c3803,function(_0x2e6c7f){var _0x231dda={};_0x231dda[_0x2e6c7f]=_0xd62407[_0x527f('0x14')]?_0xd62407[_0x527f('0x15')]:_0xd62407[_0x527f('0x16')];return _0x231dda;});}var _0x31c838=['id',_0x527f('0x17'),_0x527f('0x18'),_0x527f('0x12'),_0x527f('0x19'),_0x527f('0x1a'),_0x527f('0x10'),_0x527f('0x1b'),_0x527f('0x1c'),_0x527f('0x1d')];var _0x33b96b=_['union'](_0x31c838,_0x5c3803);BPromise[_0x527f('0x1e')]()[_0x527f('0x1f')](cmContactRpc['getContacts']({'attributes':_0x33b96b,'where':_0x2fef28}))[_0x527f('0x1f')](function(_0x5d6fce){_0x209e65=_0x5d6fce;if(!_[_0x527f('0x20')](_0x209e65)){if(_0x209e65[_0x527f('0x21')]===0x1){_0x11b303=_0x209e65[0x0];logger['info'](_0x527f('0x22'),_0xd62407[_0x527f('0x23')],_0x26d382['id'],_0x11b303['id']);}else{logger['info'](_0x527f('0x24'),_0xd62407['uniqueid'],_0x26d382['id'],_[_0x527f('0x13')](_0x209e65,'id')[_0x527f('0x25')](','));}return;}else{logger[_0x527f('0x9')](_0x527f('0x26'),_0xd62407[_0x527f('0x23')],_0x26d382['id']);var _0x335d3e={'ListId':_0x18e1f0};var _0x141273=_0x315d73[_0x527f('0x27')]&&_0x315d73['data4']!=='0'?_0x315d73[_0x527f('0x27')]:_0x527f('0x12');if(_0x513212){logger[_0x527f('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xd62407[_0x527f('0x23')],_0x26d382['id']);_0x335d3e[_0x141273]=_['isNil'](_0xd62407['routeId'])?_0xd62407['calleridnum']:_0xd62407[_0x527f('0x15')];if(_[_0x527f('0x28')](_0xd62407['routeId'])){_0x335d3e[_0x527f('0x17')]=_0xd62407[_0x527f('0x29')]&&_0xd62407['calleridname']!==_0x527f('0x2a')?_0xd62407[_0x527f('0x29')]:'Unknown';}else{_0x335d3e['firstName']=_0xd62407['destcalleridname']&&_0xd62407[_0x527f('0x2b')]!==_0x527f('0x2a')?_0xd62407[_0x527f('0x2b')]:_0x527f('0x2c');}return BPromise['resolve']()[_0x527f('0x1f')](cmContactRpc[_0x527f('0x2d')](_0x335d3e))[_0x527f('0x1f')](function(_0x5e6795){_0x11b303=_0x5e6795;_0x209e65['push'](_0x5e6795);if(_0x11b303){logger[_0x527f('0x9')](_0x527f('0x2e'),_0xd62407['uniqueid'],_0x26d382['id'],_0x11b303['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0xd62407[_0x527f('0x23')],_0x26d382['id']);_0x335d3e[_0x141273]=_[_0x527f('0x28')](_0xd62407[_0x527f('0x14')])?_0xd62407[_0x527f('0x16')]:_0xd62407[_0x527f('0x15')];if(_['isNil'](_0xd62407['routeId'])){_0x335d3e[_0x527f('0x17')]=_0xd62407['calleridname']&&_0xd62407['calleridname']!==''?_0xd62407[_0x527f('0x29')]:_0x527f('0x2c');}else{_0x335d3e[_0x527f('0x17')]=_0xd62407['destcalleridname']&&_0xd62407[_0x527f('0x2b')]!==''?_0xd62407['destcalleridname']:_0x527f('0x2c');}_0x11b303=_0x335d3e;_0x209e65['push'](_0x335d3e);return;}}})[_0x527f('0x1f')](function(){if(_0x45fbd0){emit(_0xd62407[_0x527f('0x23')],_0x26d382,util[_0x527f('0x2f')]('user:%s',_0x45fbd0[_0x527f('0x30')]),util['format'](_0x527f('0x31'),_0x315d73[_0x527f('0x32')][_0x527f('0x33')]()),{'evt':_[_0x527f('0x34')](_0xd62407,{'autoCreate':_0x513212}),'contact':_0x11b303===undefined?{}:_0x11b303,'contacts':_0x209e65['length']===0x0?undefined:_0x209e65});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 495a679..053a16a 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 _0x7c21=['channel','some','AnyConditions','checkConditions','field','account','ChatWebsiteId','value','AccountId','operator','upperFirst','interaction','event','queue','agent','membername','lastevent','exports','util','lodash','url','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','popup','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentconnect','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','uri','buildUri','data3','data4','location','uriLocation','windowWidth','isNil','data5','800','windowHeight','data6','600','winApplication','winArguments','render','user:%s','trigger:%s:%s','data1','format','name','exec','voiceQueues','routeId','script','parse','query','search','replace','AllConditions','every'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x7c21,0x1e2));var _0x17c2=function(_0xbeb92d,_0x2bda6b){_0xbeb92d=_0xbeb92d-0x0;var _0x40829f=_0x7c21[_0xbeb92d];return _0x40829f;};'use strict';var util=require(_0x17c2('0x0'));var _=require(_0x17c2('0x1'));var url=require(_0x17c2('0x2'));var Mustache=require('mustache');var Redis=require(_0x17c2('0x3'));var urlforward=require(_0x17c2('0x4'));var integration=require('./integration');var cmContact=require(_0x17c2('0x5'));var script=require(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var logger=require(_0x17c2('0x8'))('trigger');var ami=require(_0x17c2('0x9'));config['redis']=_['defaults'](config[_0x17c2('0xa')],{'host':_0x17c2('0xb'),'port':0x18eb});var io=require(_0x17c2('0xc'))(new Redis(config[_0x17c2('0xa')]));var operators={'equals':function(_0x184ad8,_0x2f5f3a){return _0x184ad8==_0x2f5f3a;},'not_equals':function(_0x3422f2,_0x526b2e){return _0x3422f2!=_0x526b2e;}};var barAndWebActions=[_0x17c2('0xd'),'url','winapp'];function Trigger(_0x379390){this['triggers']=_0x379390[_0x17c2('0xe')];this[_0x17c2('0xf')]=_0x379390[_0x17c2('0xf')];this['voiceQueues']=_0x379390['voiceQueues'];this[_0x17c2('0x10')]=_0x379390['templates'];this[_0x17c2('0x11')]=_0x379390[_0x17c2('0x11')];this[_0x17c2('0x12')]=_0x379390[_0x17c2('0x12')];this['freshdeskAccounts']=_0x379390[_0x17c2('0x13')];this[_0x17c2('0x14')]=_0x379390[_0x17c2('0x14')];this[_0x17c2('0x15')]=_0x379390[_0x17c2('0x15')];this['zohoAccounts']=_0x379390[_0x17c2('0x16')];this[_0x17c2('0x17')]=_0x379390[_0x17c2('0x17')];this[_0x17c2('0x18')]=_0x379390[_0x17c2('0x18')];this[_0x17c2('0x19')]=_0x379390[_0x17c2('0x19')];this['dynamics365Accounts']=_0x379390[_0x17c2('0x1a')];this[_0x17c2('0x1b')]=_0x379390[_0x17c2('0x1b')];this[_0x17c2('0x1c')]={'zendesk':this[_0x17c2('0x12')],'salesforce':this[_0x17c2('0x14')],'freshdesk':this[_0x17c2('0x13')],'sugarcrm':this[_0x17c2('0x15')],'zoho':this[_0x17c2('0x16')],'desk':this[_0x17c2('0x17')],'vtiger':this[_0x17c2('0x18')],'dynamics365':this[_0x17c2('0x1a')],'freshsales':this[_0x17c2('0x1b')],'servicenow':this[_0x17c2('0x19')]};ami['on']('custom:agentcalled',this['syncCustomEvent']['bind'](this));ami['on'](_0x17c2('0x1d'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x20'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x21'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x22'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x23'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on']('custom:agentbusy',this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on']('custom:agentcongestion',this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x24'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on']('custom:queuecallerabandon',this[_0x17c2('0x1e')]['bind'](this));ami['on'](_0x17c2('0x25'),this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x26'),this[_0x17c2('0x27')]['bind'](this));ami['on'](_0x17c2('0x28'),this[_0x17c2('0x27')][_0x17c2('0x1f')](this));ami['on']('custom:dialend',this[_0x17c2('0x27')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x29'),this[_0x17c2('0x1e')]['bind'](this));ami['on'](_0x17c2('0x2a'),this[_0x17c2('0x1e')]['bind'](this));ami['on'](_0x17c2('0x2b'),this['syncCustomEvent'][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x2c'),this[_0x17c2('0x1e')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x17c2('0x1e')][_0x17c2('0x1f')](this));ami['on'](_0x17c2('0x2d'),this[_0x17c2('0x1e')]['bind'](this));}Trigger[_0x17c2('0x2e')][_0x17c2('0x2f')]=function(_0x4d7044,_0x1f37cb,_0x5e94ae){logger['info'](_0x4d7044,_0x1f37cb,JSON[_0x17c2('0x30')](_0x5e94ae));io['to'](_0x4d7044)['emit'](_0x1f37cb,_0x5e94ae);};Trigger[_0x17c2('0x2e')][_0x17c2('0x1e')]=function(_0x4b09e1){var _0x3a8579=_[_0x17c2('0x31')](_0x4b09e1);this[_0x17c2('0x32')](_0x3a8579);};Trigger['prototype'][_0x17c2('0x27')]=function(_0x46e8bc){if(this['agents'][_0x46e8bc[_0x17c2('0x33')]]){this['syncCustomEvent'](_0x46e8bc);}};Trigger['prototype']['checkTriggers']=function(_0x54b355){var _0x34cb6e;for(var _0x294dd3 in this[_0x17c2('0xe')]){if(this['triggers'][_0x17c2('0x34')](_0x294dd3)){if(this['triggers'][_0x294dd3][_0x17c2('0x35')]){_0x34cb6e=this[_0x17c2('0x36')](this[_0x17c2('0xe')][_0x294dd3],_0x54b355);if(_0x34cb6e){_[_0x17c2('0x37')](_0x54b355,_0x54b355[_0x17c2('0x38')]);for(var _0x45511c=0x0,_0xf36de1,_0x4f3e3b,_0x50e740;_0x45511c0x0){_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(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 5a7b740..60f506b 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 _0xd126=['content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','util','./util','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','destcalleridnum','contacts','/systemusers(','userId','headers','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','value','outbound','calleridnum','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','customField','idField','indexOf'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xd126,0xde));var _0x6d12=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0xd126[_0x3f4a8e];return _0x7f68fd;};'use strict';var _=require('lodash');var BPromise=require(_0x6d12('0x0'));var rp=require('request-promise');var util=require(_0x6d12('0x1'));var intUtil=require(_0x6d12('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')('dynamics365');var config=require('../../../../config/environment');config[_0x6d12('0x3')]=_['defaults'](config[_0x6d12('0x3')],{'host':_0x6d12('0x4'),'port':0x18eb});var io=require(_0x6d12('0x5'))(new Redis(config[_0x6d12('0x3')]));function getAuthToken(_0x122e58,_0x457b57,_0x58800d){var _0x375110={'method':_0x6d12('0x6'),'uri':_0x457b57,'form':{'client_id':_0x122e58[_0x6d12('0x7')],'resource':_0x122e58[_0x6d12('0x8')],'username':_0x122e58['username'],'password':_0x122e58['password'],'grant_type':_0x6d12('0x9'),'client_secret':_0x122e58[_0x6d12('0xa')]},'json':!![]};return rp(_0x375110)[_0x6d12('0xb')](function(_0x3d679e){return _0x3d679e['access_token'];})[_0x6d12('0xc')](function(_0x1993ef){logger['error']('['+[_0x58800d[_0x6d12('0xd')]()]+']\x20Wrong\x20credentials!');return _0x1993ef[_0x6d12('0xe')];});}function getUser(_0x2eb1fe,_0xd3f216,_0x503580,_0x23f488,_0x18aa2f,_0x5ababa){return new BPromise(function(_0x38c722,_0xbe5a02){return getAuthToken(_0xd3f216,_0x23f488,_0x5ababa)[_0x6d12('0xb')](function(_0x5a8641){var _0x58b45d={'method':_0x6d12('0xf'),'uri':_0x18aa2f+_0x6d12('0x10'),'headers':{'Authorization':_0x6d12('0x11')+_0x5a8641,'OData-Version':_0x6d12('0x12')},'json':!![]};return rp(_0x58b45d);})[_0x6d12('0xb')](function(_0x3eff35){var _0x5eb056=_0x3eff35['value'];var _0x3cb7a8=![];var _0x189ff2=null;if(!_[_0x6d12('0x13')](_0x503580)){if(intUtil[_0x6d12('0x14')](_0x503580['email'])){_0x2eb1fe[_0x6d12('0x15')]=_0x503580[_0x6d12('0x16')];for(_0x189ff2=0x0;_0x189ff2<_0x5eb056[_0x6d12('0x17')];_0x189ff2++){if(_0x5eb056[_0x189ff2][_0x6d12('0x18')]===_0x503580['email']&&!_0x5eb056[_0x189ff2][_0x6d12('0x19')]){_0x3cb7a8=!![];logger[_0x6d12('0x1a')]('['+[_0x5ababa[_0x6d12('0xd')]()]+_0x6d12('0x1b')+_0x5eb056[_0x189ff2][_0x6d12('0x1c')]+'!');_0x2eb1fe['userId']=_0x5eb056[_0x189ff2][_0x6d12('0x1c')];}}}}if(!_0x3cb7a8){logger[_0x6d12('0x1a')]('['+[_0x5ababa['toUpperCase']()]+_0x6d12('0x1d'));_0x2eb1fe['userEmail']=_0xd3f216['username'];for(_0x189ff2=0x0;_0x189ff2<_0x5eb056[_0x6d12('0x17')];_0x189ff2++){if(_0x5eb056[_0x189ff2]['internalemailaddress']===_0xd3f216[_0x6d12('0x1e')]){_0x2eb1fe['userId']=_0x5eb056[_0x189ff2][_0x6d12('0x1c')];}}}_0x38c722(_0x2eb1fe);})[_0x6d12('0xc')](function(_0x5d47da){_0xbe5a02(_0x5d47da['message']);});});}function createEndUser(_0x11e7cb,_0x23706f,_0x105ea5,_0x2775ea,_0x36ebe8,_0x5067f7){return new BPromise(function(_0x8850f7,_0x72c3e5){return getAuthToken(_0x23706f,_0x105ea5,_0x5067f7)[_0x6d12('0xb')](function(_0x83b923){var _0x3b7df3=_0x5067f7[_0x6d12('0x1f')]()==='outbound'?_0x36ebe8[_0x6d12('0x20')]:_0x36ebe8['calleridnum'];var _0x3eed1a={'method':_0x6d12('0x6'),'uri':_0x2775ea+_0x6d12('0x21'),'body':{'telephone1':_0x3b7df3,'fullname':_0x3b7df3,'firstname':_0x3b7df3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6d12('0x22')+_0x11e7cb[_0x6d12('0x23')]+')'},'headers':{'Authorization':_0x6d12('0x11')+_0x83b923,'OData-Version':_0x6d12('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3eed1a);})[_0x6d12('0xb')](function(_0x4bddf5){var _0x623587=_0x4bddf5[_0x6d12('0x24')][_0x6d12('0x25')];var _0x3708f8=_0x623587[_0x6d12('0x26')](_0x623587[_0x6d12('0x27')]('(')+0x1,_0x623587['lastIndexOf'](')'));_0x11e7cb['enduserId']=_0x3708f8;_0x8850f7(_0x11e7cb);})[_0x6d12('0xc')](function(_0x539c59){_0x72c3e5(_0x539c59[_0x6d12('0xe')]);});});}function getEndUser(_0x2e880b,_0x2b5b7d,_0x55276f,_0x1ab9b0,_0x26641b,_0xe11c72){return new BPromise(function(_0x2a9df5,_0x142da4){return getAuthToken(_0x2b5b7d,_0x55276f,_0xe11c72)[_0x6d12('0xb')](function(_0x396e54){var _0x4ec59e={'method':_0x6d12('0xf'),'uri':_0x1ab9b0+_0x6d12('0x28'),'headers':{'Authorization':_0x6d12('0x11')+_0x396e54,'If-None-Match':null,'OData-Version':_0x6d12('0x12')},'json':!![]};return rp(_0x4ec59e);})[_0x6d12('0xb')](function(_0x582b1e){var _0x178b0b=null;if(_0x582b1e){var _0x4391e=_0x582b1e[_0x6d12('0x29')];var _0x40a150=![];for(_0x178b0b=0x0;_0x178b0b<_0x4391e[_0x6d12('0x17')];_0x178b0b++){var _0x1f35c3=_0xe11c72[_0x6d12('0x1f')]()===_0x6d12('0x2a')?_0x26641b['destcalleridnum']:_0x26641b[_0x6d12('0x2b')];if(_0x4391e[_0x178b0b][_0x6d12('0x2c')]===_0x1f35c3){_0x40a150=!![];_0x2e880b[_0x6d12('0x2d')]=_0x4391e[_0x178b0b][_0x6d12('0x2e')];}}if(_0x40a150){_0x2a9df5(_0x2e880b);}else{return createEndUser(_0x2e880b,_0x2b5b7d,_0x55276f,_0x1ab9b0,_0x26641b,_0xe11c72)[_0x6d12('0xb')](function(_0x4b083f){logger['info']('['+[_0xe11c72[_0x6d12('0xd')]()]+_0x6d12('0x2f'),_0x4b083f[_0x6d12('0x2d')]);_0x2a9df5(_0x4b083f);});}}else{return createEndUser(_0x2e880b,_0x2b5b7d,_0x55276f,_0x1ab9b0,_0x26641b,_0xe11c72)[_0x6d12('0xb')](function(_0x90290a){logger[_0x6d12('0x1a')]('['+[_0xe11c72[_0x6d12('0xd')]()]+_0x6d12('0x30'),_0x90290a['enduserId']);_0x2a9df5(_0x90290a);});}});});}function getCustomFields(_0x344950,_0x4bb223,_0x1b5a34){var _0x2ac4df={};if(_0x344950[_0x6d12('0x17')]>0x0){_[_0x6d12('0x31')](_0x344950,function(_0x153b62){if(_0x153b62[_0x6d12('0x32')]==='string'&&_0x153b62['nameField']&&!_0x153b62[_0x6d12('0x33')]){var _0x3e7139=_0x153b62[_0x6d12('0x34')]['toLowerCase']();var _0x4d1f37=_0x3e7139[_0x6d12('0x26')](0x0,_0x3e7139[_0x6d12('0x35')]('_'));var _0x14b5ea=_0x3e7139[_0x6d12('0x26')](_0x3e7139[_0x6d12('0x35')]('_')+0x1);if(_0x4d1f37===_0x1b5a34){_0x2ac4df[_0x14b5ea]=_0x153b62[_0x6d12('0x36')];}}});}return _0x2ac4df;}function getTicket(_0x4f7a80,_0x5250a9,_0x517cfa,_0x5b0d03,_0x1d6724,_0x574ed8,_0xdda3d0){return new BPromise(function(_0x1aba19,_0x16633a){var _0x1194a1;return getAuthToken(_0x5250a9,_0x517cfa,_0xdda3d0)[_0x6d12('0xb')](function(_0x5dce5d){if(_0x574ed8[_0x6d12('0x37')]===_0x6d12('0x38')){_0x1194a1={'method':_0x6d12('0x6'),'uri':_0x5b0d03+_0x6d12('0x39'),'body':Object[_0x6d12('0x3a')]({},{'title':intUtil[_0x6d12('0x3b')](_0x574ed8['Subjects'],_0x1d6724,'\x20'),'description':intUtil[_0x6d12('0x3b')](_0x574ed8[_0x6d12('0x3c')],_0x1d6724,'\x0a'),'customerid_contact@odata.bind':_0x6d12('0x3d')+_0x4f7a80[_0x6d12('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x4f7a80[_0x6d12('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x574ed8[_0x6d12('0x3e')],_0x1d6724,_0x574ed8[_0x6d12('0x37')])),'headers':{'Authorization':_0x6d12('0x11')+_0x5dce5d,'OData-Version':_0x6d12('0x12')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x574ed8[_0x6d12('0x37')]===_0x6d12('0x3f')){_0x1194a1={'method':_0x6d12('0x6'),'uri':_0x5b0d03+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x574ed8['Subjects'],_0x1d6724,'\x20'),'phonenumber':String(_0x1d6724[_0x6d12('0x2b')]),'description':intUtil['getString'](_0x574ed8[_0x6d12('0x3c')],_0x1d6724,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6d12('0x3d')+_0x4f7a80['enduserId']+')','ownerid@odata.bind':_0x6d12('0x22')+_0x4f7a80['userId']+')','directioncode':_0x4f7a80['callDirection']===_0x6d12('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4f7a80[_0x6d12('0x23')]+')','participationtypemask':_0x4f7a80[_0x6d12('0x41')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4f7a80[_0x6d12('0x2d')]+')','participationtypemask':_0x4f7a80[_0x6d12('0x41')]==='queue'?0x1:0x2}]},getCustomFields(_0x574ed8[_0x6d12('0x3e')],_0x1d6724,_0x574ed8[_0x6d12('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x5dce5d,'OData-Version':_0x6d12('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1194a1);})[_0x6d12('0xb')](function(_0x3a77aa){var _0x2648ce=_0x3a77aa['headers'][_0x6d12('0x25')];var _0x4c96eb=_0x2648ce['substring'](_0x2648ce[_0x6d12('0x27')]('(')+0x1,_0x2648ce[_0x6d12('0x27')](')'));_0x4f7a80[_0x6d12('0x42')]=_0x4c96eb;_0x1aba19(_0x4f7a80);})[_0x6d12('0xc')](function(_0x3ec4cd){_0x16633a(_0x3ec4cd[_0x6d12('0xe')]);});});}function emit(_0x51e391,_0x45b440,_0x48d8bd,_0x43e83f){var _0x3b4085={'uri':util[_0x6d12('0x43')](_0x6d12('0x44'),_0x51e391,_0x48d8bd,_0x43e83f)};io['to'](util[_0x6d12('0x43')](_0x6d12('0x45'),_0x45b440))[_0x6d12('0x46')](_0x6d12('0x47'),_0x3b4085);}exports['cs']=function(_0x15e265,_0x55d0f3,_0x52dbd1,_0x57b754,_0x3502a0,_0x22b0d,_0x402ba9,_0x5884a9){var _0x5c291a={};_0x22b0d[_0x6d12('0x8')]=intUtil[_0x6d12('0x48')](_0x22b0d[_0x6d12('0x8')]);_0x22b0d[_0x6d12('0x49')]=intUtil[_0x6d12('0x48')](_0x22b0d[_0x6d12('0x49')]);_0x5c291a[_0x6d12('0x41')]=_0x5884a9===_0x6d12('0x40')||_0x5884a9==='unmanaged'?'queue':_0x6d12('0x2a');var _0x49907f=util[_0x6d12('0x43')]('%s/api/data/v9.0/',_0x22b0d[_0x6d12('0x8')]);var _0x4bd368=util['format'](_0x6d12('0x4a'),_0x22b0d[_0x6d12('0x4b')]);var _0x129d03=util[_0x6d12('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22b0d['serverUrl'],_0x55d0f3[_0x6d12('0x4c')],md5(_0x55d0f3[_0x6d12('0x4c')]));if(_0x3502a0&&_0x3502a0[_0x6d12('0x4d')]){logger[_0x6d12('0x1a')](_0x6d12('0x4e'),_0x6d12('0x4f'));_0x55d0f3['recordingURL']=_0x129d03;}else if(_0x402ba9&&_0x402ba9['recordingFormat']&&_0x402ba9['recordingFormat']!==_0x6d12('0x50')){logger[_0x6d12('0x1a')](_0x6d12('0x51'),_0x6d12('0x4f'));_0x55d0f3[_0x6d12('0x52')]=_0x129d03;}else{_0x55d0f3[_0x6d12('0x52')]='';}return getUser(_0x5c291a,_0x22b0d,_0x57b754,_0x4bd368,_0x49907f,_0x5884a9)['then'](function(_0x5c7270){logger['info']('['+_0x5884a9[_0x6d12('0xd')]()+']\x20The\x20User\x20ID\x20is:',_0x5c7270['userId']);logger[_0x6d12('0x1a')]('['+_0x5884a9[_0x6d12('0xd')]()+']\x20The\x20User\x20email\x20is:',_0x5c7270[_0x6d12('0x15')]);return getEndUser(_0x5c7270,_0x22b0d,_0x4bd368,_0x49907f,_0x55d0f3,_0x5884a9);})[_0x6d12('0xb')](function(_0x4f033c){logger[_0x6d12('0x1a')]('['+_0x5884a9[_0x6d12('0xd')]()+_0x6d12('0x53'),_0x4f033c[_0x6d12('0x2d')]);logger['info']('['+_0x5884a9[_0x6d12('0xd')]()+_0x6d12('0x54'),_0x55d0f3['calleridnum']);return getTicket(_0x4f033c,_0x22b0d,_0x4bd368,_0x49907f,_0x55d0f3,_0x52dbd1,_0x5884a9);})[_0x6d12('0xb')](function(_0x5470ce){logger[_0x6d12('0x1a')](util['format']('['+_0x5884a9[_0x6d12('0xd')]()+_0x6d12('0x55'),_0x52dbd1[_0x6d12('0x37')],_0x5470ce[_0x6d12('0x42')]));logger[_0x6d12('0x1a')](util['format']('['+_0x5884a9[_0x6d12('0xd')]()+_0x6d12('0x56'),_0x5884a9));if(_0x5884a9!==_0x6d12('0x57')){logger[_0x6d12('0x1a')]('['+_0x5884a9[_0x6d12('0xd')]()+']',_0x6d12('0x58'));emit(_0x22b0d[_0x6d12('0x8')],_0x57b754['name'],_0x52dbd1[_0x6d12('0x37')],_0x5470ce[_0x6d12('0x42')]);}})['catch'](function(_0x3880c0){logger[_0x6d12('0x59')]('['+_0x5884a9[_0x6d12('0xd')]()+_0x6d12('0x5a'),util[_0x6d12('0x5b')](_0x3880c0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2976=['lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','customField','idField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','phonecall','phonecalls','assign','queue','callDirection','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','email','userEmail','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','odata-entityid','substring'];(function(_0x58832b,_0x4e6ffc){var _0x1a7b20=function(_0x208600){while(--_0x208600){_0x58832b['push'](_0x58832b['shift']());}};_0x1a7b20(++_0x4e6ffc);}(_0x2976,0xf6));var _0x6297=function(_0x16eb4a,_0x3572d0){_0x16eb4a=_0x16eb4a-0x0;var _0x11a968=_0x2976[_0x16eb4a];return _0x11a968;};'use strict';var _=require(_0x6297('0x0'));var BPromise=require(_0x6297('0x1'));var rp=require(_0x6297('0x2'));var util=require('util');var intUtil=require(_0x6297('0x3'));var md5=require(_0x6297('0x4'));var Redis=require(_0x6297('0x5'));var logger=require(_0x6297('0x6'))(_0x6297('0x7'));var config=require('../../../../config/environment');config[_0x6297('0x8')]=_[_0x6297('0x9')](config[_0x6297('0x8')],{'host':_0x6297('0xa'),'port':0x18eb});var io=require(_0x6297('0xb'))(new Redis(config[_0x6297('0x8')]));function getAuthToken(_0x4f9ff9,_0x1a37f6,_0x72507f){var _0x1a6c10={'method':_0x6297('0xc'),'uri':_0x1a37f6,'form':{'client_id':_0x4f9ff9[_0x6297('0xd')],'resource':_0x4f9ff9[_0x6297('0xe')],'username':_0x4f9ff9['username'],'password':_0x4f9ff9[_0x6297('0xf')],'grant_type':_0x6297('0xf'),'client_secret':_0x4f9ff9[_0x6297('0x10')]},'json':!![]};return rp(_0x1a6c10)[_0x6297('0x11')](function(_0x21091b){return _0x21091b['access_token'];})[_0x6297('0x12')](function(_0x1106a6){logger[_0x6297('0x13')]('['+[_0x72507f['toUpperCase']()]+_0x6297('0x14'));return _0x1106a6[_0x6297('0x15')];});}function getUser(_0x2abb74,_0x1ed38d,_0x1e8fcd,_0x1921c0,_0x5a7e3f,_0x16ef56){return new BPromise(function(_0x2e09db,_0x335c0c){return getAuthToken(_0x1ed38d,_0x1921c0,_0x16ef56)[_0x6297('0x11')](function(_0x33d644){var _0x4c302f={'method':_0x6297('0x16'),'uri':_0x5a7e3f+_0x6297('0x17'),'headers':{'Authorization':_0x6297('0x18')+_0x33d644,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c302f);})[_0x6297('0x11')](function(_0x2ed3d2){var _0x281060=_0x2ed3d2[_0x6297('0x19')];var _0x17cdaf=![];var _0x2e9e95=null;if(!_['isNil'](_0x1e8fcd)){if(intUtil[_0x6297('0x1a')](_0x1e8fcd[_0x6297('0x1b')])){_0x2abb74[_0x6297('0x1c')]=_0x1e8fcd['email'];for(_0x2e9e95=0x0;_0x2e9e95<_0x281060['length'];_0x2e9e95++){if(_0x281060[_0x2e9e95]['internalemailaddress']===_0x1e8fcd[_0x6297('0x1b')]&&!_0x281060[_0x2e9e95][_0x6297('0x1d')]){_0x17cdaf=!![];logger['info']('['+[_0x16ef56[_0x6297('0x1e')]()]+_0x6297('0x1f')+_0x281060[_0x2e9e95][_0x6297('0x20')]+'!');_0x2abb74[_0x6297('0x21')]=_0x281060[_0x2e9e95]['systemuserid'];}}}}if(!_0x17cdaf){logger[_0x6297('0x22')]('['+[_0x16ef56[_0x6297('0x1e')]()]+_0x6297('0x23'));_0x2abb74['userEmail']=_0x1ed38d[_0x6297('0x24')];for(_0x2e9e95=0x0;_0x2e9e95<_0x281060[_0x6297('0x25')];_0x2e9e95++){if(_0x281060[_0x2e9e95][_0x6297('0x26')]===_0x1ed38d[_0x6297('0x24')]){_0x2abb74[_0x6297('0x21')]=_0x281060[_0x2e9e95]['systemuserid'];}}}_0x2e09db(_0x2abb74);})[_0x6297('0x12')](function(_0x4176c9){_0x335c0c(_0x4176c9[_0x6297('0x15')]);});});}function createEndUser(_0x10aac3,_0x2d743b,_0x22c432,_0x44d832,_0x255c20,_0x472405){return new BPromise(function(_0x505bff,_0x37e85f){return getAuthToken(_0x2d743b,_0x22c432,_0x472405)[_0x6297('0x11')](function(_0x37912d){var _0x36fbeb=_0x472405[_0x6297('0x27')]()===_0x6297('0x28')?_0x255c20[_0x6297('0x29')]:_0x255c20[_0x6297('0x2a')];var _0x19c170={'method':'POST','uri':_0x44d832+_0x6297('0x2b'),'body':{'telephone1':_0x36fbeb,'fullname':_0x36fbeb,'firstname':_0x36fbeb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6297('0x2c')+_0x10aac3[_0x6297('0x21')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x37912d,'OData-Version':_0x6297('0x2d')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x19c170);})[_0x6297('0x11')](function(_0x3ec880){var _0x15a42a=_0x3ec880['headers'][_0x6297('0x2e')];var _0x1ed199=_0x15a42a[_0x6297('0x2f')](_0x15a42a['lastIndexOf']('(')+0x1,_0x15a42a[_0x6297('0x30')](')'));_0x10aac3[_0x6297('0x31')]=_0x1ed199;_0x505bff(_0x10aac3);})[_0x6297('0x12')](function(_0x59cdf0){_0x37e85f(_0x59cdf0[_0x6297('0x15')]);});});}function getEndUser(_0x5c6c51,_0x5c181b,_0x346f4e,_0x6355a0,_0x2612f3,_0x5bdcee){return new BPromise(function(_0x29ab91,_0x477244){return getAuthToken(_0x5c181b,_0x346f4e,_0x5bdcee)['then'](function(_0xc57f4e){var _0x12e92c={'method':_0x6297('0x16'),'uri':_0x6355a0+'contacts?$select=telephone1','headers':{'Authorization':_0x6297('0x18')+_0xc57f4e,'If-None-Match':null,'OData-Version':_0x6297('0x2d')},'json':!![]};return rp(_0x12e92c);})['then'](function(_0x18b484){var _0x581961=null;if(_0x18b484){var _0x11a754=_0x18b484[_0x6297('0x19')];var _0x4686d4=![];for(_0x581961=0x0;_0x581961<_0x11a754[_0x6297('0x25')];_0x581961++){var _0x5dd45b=_0x5bdcee[_0x6297('0x27')]()===_0x6297('0x28')?_0x2612f3['destcalleridnum']:_0x2612f3['calleridnum'];if(_0x11a754[_0x581961][_0x6297('0x32')]===_0x5dd45b){_0x4686d4=!![];_0x5c6c51[_0x6297('0x31')]=_0x11a754[_0x581961][_0x6297('0x33')];}}if(_0x4686d4){_0x29ab91(_0x5c6c51);}else{return createEndUser(_0x5c6c51,_0x5c181b,_0x346f4e,_0x6355a0,_0x2612f3,_0x5bdcee)[_0x6297('0x11')](function(_0x7339bb){logger[_0x6297('0x22')]('['+[_0x5bdcee[_0x6297('0x1e')]()]+_0x6297('0x34'),_0x7339bb[_0x6297('0x31')]);_0x29ab91(_0x7339bb);});}}else{return createEndUser(_0x5c6c51,_0x5c181b,_0x346f4e,_0x6355a0,_0x2612f3,_0x5bdcee)[_0x6297('0x11')](function(_0x3d5a95){logger[_0x6297('0x22')]('['+[_0x5bdcee[_0x6297('0x1e')]()]+_0x6297('0x35'),_0x3d5a95[_0x6297('0x31')]);_0x29ab91(_0x3d5a95);});}});});}function getCustomFields(_0x1e92dc,_0x5ef192,_0x5d104d){var _0x3cfdb7={};if(_0x1e92dc['length']>0x0){_[_0x6297('0x36')](_0x1e92dc,function(_0x405e7f){if(_0x405e7f['type']===_0x6297('0x37')&&_0x405e7f['nameField']&&!_0x405e7f[_0x6297('0x38')]){var _0x11cab7=_0x405e7f[_0x6297('0x39')][_0x6297('0x27')]();var _0x4b1c5a=_0x11cab7['substring'](0x0,_0x11cab7[_0x6297('0x3a')]('_'));var _0x4e6bd1=_0x11cab7[_0x6297('0x2f')](_0x11cab7[_0x6297('0x3a')]('_')+0x1);if(_0x4b1c5a===_0x5d104d){_0x3cfdb7[_0x4e6bd1]=_0x405e7f['content'];}}});}return _0x3cfdb7;}function getTicket(_0x11a5df,_0x4d4298,_0x1c7a38,_0x35ffb1,_0x65a0d3,_0x597d04,_0x4dfab2){return new BPromise(function(_0x59c54a,_0x4ae0c9){var _0x44a00d;return getAuthToken(_0x4d4298,_0x1c7a38,_0x4dfab2)[_0x6297('0x11')](function(_0x32eba7){if(_0x597d04[_0x6297('0x3b')]===_0x6297('0x3c')){_0x44a00d={'method':_0x6297('0xc'),'uri':_0x35ffb1+_0x6297('0x3d'),'body':Object['assign']({},{'title':intUtil[_0x6297('0x3e')](_0x597d04[_0x6297('0x3f')],_0x65a0d3,'\x20'),'description':intUtil['getString'](_0x597d04[_0x6297('0x40')],_0x65a0d3,'\x0a'),'customerid_contact@odata.bind':_0x6297('0x41')+_0x11a5df[_0x6297('0x31')]+')','ownerid@odata.bind':_0x6297('0x2c')+_0x11a5df[_0x6297('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x597d04['Fields'],_0x65a0d3,_0x597d04[_0x6297('0x3b')])),'headers':{'Authorization':_0x6297('0x18')+_0x32eba7,'OData-Version':_0x6297('0x2d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x597d04[_0x6297('0x3b')]===_0x6297('0x42')){_0x44a00d={'method':_0x6297('0xc'),'uri':_0x35ffb1+_0x6297('0x43'),'body':Object[_0x6297('0x44')]({},{'subject':intUtil[_0x6297('0x3e')](_0x597d04[_0x6297('0x3f')],_0x65a0d3,'\x20'),'phonenumber':String(_0x65a0d3[_0x6297('0x2a')]),'description':intUtil[_0x6297('0x3e')](_0x597d04[_0x6297('0x40')],_0x65a0d3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6297('0x41')+_0x11a5df[_0x6297('0x31')]+')','ownerid@odata.bind':'/systemusers('+_0x11a5df[_0x6297('0x21')]+')','directioncode':_0x11a5df['callDirection']===_0x6297('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x11a5df['userId']+')','participationtypemask':_0x11a5df[_0x6297('0x46')]===_0x6297('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x6297('0x41')+_0x11a5df[_0x6297('0x31')]+')','participationtypemask':_0x11a5df[_0x6297('0x46')]==='queue'?0x1:0x2}]},getCustomFields(_0x597d04['Fields'],_0x65a0d3,_0x597d04[_0x6297('0x3b')])),'headers':{'Authorization':_0x6297('0x18')+_0x32eba7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x44a00d);})[_0x6297('0x11')](function(_0x4e3d11){var _0x561675=_0x4e3d11[_0x6297('0x47')][_0x6297('0x2e')];var _0x2ce94c=_0x561675[_0x6297('0x2f')](_0x561675[_0x6297('0x30')]('(')+0x1,_0x561675[_0x6297('0x30')](')'));_0x11a5df[_0x6297('0x48')]=_0x2ce94c;_0x59c54a(_0x11a5df);})['catch'](function(_0x4bdaef){_0x4ae0c9(_0x4bdaef[_0x6297('0x15')]);});});}function emit(_0x560984,_0x3f9c7b,_0x1ee4d2,_0x197810){var _0x17900f={'uri':util['format'](_0x6297('0x49'),_0x560984,_0x1ee4d2,_0x197810)};io['to'](util[_0x6297('0x4a')](_0x6297('0x4b'),_0x3f9c7b))[_0x6297('0x4c')]('trigger:browser:url',_0x17900f);}exports['cs']=function(_0x14f75e,_0x3dccd4,_0x583119,_0x4af6c2,_0x573341,_0xda7e99,_0xf6989b,_0x595cdd){var _0x2a0603={};_0xda7e99[_0x6297('0xe')]=intUtil['stripTrailingSlash'](_0xda7e99['remoteUri']);_0xda7e99['serverUrl']=intUtil[_0x6297('0x4d')](_0xda7e99['serverUrl']);_0x2a0603[_0x6297('0x46')]=_0x595cdd===_0x6297('0x45')||_0x595cdd===_0x6297('0x4e')?_0x6297('0x45'):_0x6297('0x28');var _0x365043=util[_0x6297('0x4a')](_0x6297('0x4f'),_0xda7e99[_0x6297('0xe')]);var _0x47d046=util[_0x6297('0x4a')](_0x6297('0x50'),_0xda7e99[_0x6297('0x51')]);var _0x52b6be=util[_0x6297('0x4a')](_0x6297('0x52'),_0xda7e99[_0x6297('0x53')],_0x3dccd4['uniqueid'],md5(_0x3dccd4['uniqueid']));if(_0x573341&&_0x573341[_0x6297('0x54')]){logger[_0x6297('0x22')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3dccd4[_0x6297('0x55')]=_0x52b6be;}else if(_0xf6989b&&_0xf6989b['recordingFormat']&&_0xf6989b[_0x6297('0x56')]!==_0x6297('0x57')){logger['info'](_0x6297('0x58'),_0x6297('0x59'));_0x3dccd4[_0x6297('0x55')]=_0x52b6be;}else{_0x3dccd4[_0x6297('0x55')]='';}return getUser(_0x2a0603,_0xda7e99,_0x4af6c2,_0x47d046,_0x365043,_0x595cdd)['then'](function(_0x34aa37){logger[_0x6297('0x22')]('['+_0x595cdd['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x34aa37['userId']);logger[_0x6297('0x22')]('['+_0x595cdd[_0x6297('0x1e')]()+_0x6297('0x5a'),_0x34aa37[_0x6297('0x1c')]);return getEndUser(_0x34aa37,_0xda7e99,_0x47d046,_0x365043,_0x3dccd4,_0x595cdd);})[_0x6297('0x11')](function(_0x5b0b0f){logger[_0x6297('0x22')]('['+_0x595cdd[_0x6297('0x1e')]()+_0x6297('0x5b'),_0x5b0b0f[_0x6297('0x31')]);logger[_0x6297('0x22')]('['+_0x595cdd[_0x6297('0x1e')]()+_0x6297('0x5c'),_0x3dccd4[_0x6297('0x2a')]);return getTicket(_0x5b0b0f,_0xda7e99,_0x47d046,_0x365043,_0x3dccd4,_0x583119,_0x595cdd);})['then'](function(_0x5b26fa){logger[_0x6297('0x22')](util['format']('['+_0x595cdd[_0x6297('0x1e')]()+_0x6297('0x5d'),_0x583119[_0x6297('0x3b')],_0x5b26fa[_0x6297('0x48')]));logger[_0x6297('0x22')](util[_0x6297('0x4a')]('['+_0x595cdd['toUpperCase']()+_0x6297('0x5e'),_0x595cdd));if(_0x595cdd!=='unmanaged'){logger[_0x6297('0x22')]('['+_0x595cdd[_0x6297('0x1e')]()+']',_0x6297('0x5f'));emit(_0xda7e99[_0x6297('0xe')],_0x4af6c2[_0x6297('0x60')],_0x583119[_0x6297('0x3b')],_0x5b26fa[_0x6297('0x48')]);}})[_0x6297('0x12')](function(_0x2fd062){logger['error']('['+_0x595cdd[_0x6297('0x1e')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x6297('0x61')](_0x2fd062,{'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 68f377b..f484f91 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 _0x770d=['../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','GET','map','nameField','customField','toLowerCase','content','idField','push','type','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','unmanaged','toUpperCase','The\x20Enduser\x20ID\x20is:','lastevent','request-promise','md5','util','ioredis','../../../../config/environment'];(function(_0x3da1ce,_0x28965e){var _0x1265eb=function(_0x3f42db){while(--_0x3f42db){_0x3da1ce['push'](_0x3da1ce['shift']());}};_0x1265eb(++_0x28965e);}(_0x770d,0x109));var _0xd770=function(_0x56a110,_0x4bf523){_0x56a110=_0x56a110-0x0;var _0x1c41e0=_0x770d[_0x56a110];return _0x1c41e0;};'use strict';var _=require('lodash');var rp=require(_0xd770('0x0'));var md5=require(_0xd770('0x1'));var util=require(_0xd770('0x2'));var Redis=require(_0xd770('0x3'));var intUtil=require('./util');var config=require(_0xd770('0x4'));var logger=require(_0xd770('0x5'))(_0xd770('0x6'));config['redis']=_[_0xd770('0x7')](config[_0xd770('0x8')],{'host':_0xd770('0x9'),'port':0x18eb});var io=require(_0xd770('0xa'))(new Redis(config[_0xd770('0x8')]));var headers={'Content-Type':_0xd770('0xb'),'Accept':'application/json'};function emit(_0x17446a,_0xd3c058,_0x38974f){io['to'](_0x17446a)['emit'](_0xd3c058,_0x38974f);}function getTicket(_0x17cc94,_0x4b5451,_0x1b3f0c,_0x24387c,_0x296454){logger[_0xd770('0xc')](_0xd770('0xd'));var _0x3ec7c2=_[_0xd770('0xe')]({'responder_id':_0x4b5451['id'],'requester_id':_0x1b3f0c['id'],'name':util[_0xd770('0xf')]('Caller\x20-\x20%s',_0x296454[_0xd770('0x10')]),'phone':_0x296454[_0xd770('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd770('0x12')](_0x24387c[_0xd770('0x13')],_0x296454,'\x20'),'description':intUtil[_0xd770('0x12')](_0x24387c[_0xd770('0x14')],_0x296454,_0xd770('0x15')),'tags':getTags(_0x24387c['Tags'],_0xd770('0x16'))},getCustomFields(_0x24387c[_0xd770('0x17')],_0x296454));_0x3ec7c2[_0xd770('0x18')]=_[_0xd770('0x19')](_['keyBy'](_0x3ec7c2[_0xd770('0x18')],'id'),_0xd770('0x1a'));return request({'uri':util[_0xd770('0xf')](_0xd770('0x1b'),_0x17cc94[_0xd770('0x1c')]),'method':'POST','body':_0x3ec7c2})[_0xd770('0x1d')](function(_0x5d3605){logger[_0xd770('0xc')](_0xd770('0x1e'));return _0x5d3605;});}function getUser(_0x18a160,_0x495669){if(intUtil[_0xd770('0x1f')](_0x495669)){return request({'uri':util[_0xd770('0xf')](_0xd770('0x20'),_0x18a160['remoteUri']),'qs':{'email':_0x495669}})['then'](function(_0x24eb61){if(_0x24eb61[_0xd770('0x21')]){logger['info']('Agent\x20found!');return _[_0xd770('0x22')](_0x24eb61,function(_0x20a581){return _0x20a581[_0xd770('0x23')][_0xd770('0x24')]===_0x495669;});}else{logger[_0xd770('0xc')](_0xd770('0x25'));return request({'uri':util['format'](_0xd770('0x26'),_0x18a160[_0xd770('0x1c')])})[_0xd770('0x1d')](function(_0x3aec66){logger[_0xd770('0xc')](_0xd770('0x27'));return _0x3aec66;});}});}else{logger['info'](_0xd770('0x28'));return request({'uri':util[_0xd770('0xf')](_0xd770('0x26'),_0x18a160[_0xd770('0x1c')])})['then'](function(_0x2fe097){logger[_0xd770('0xc')](_0xd770('0x27'));return _0x2fe097;});}}function getEndUser(_0x165cff,_0x5f0d2a,_0x25b3e8){logger[_0xd770('0xc')](_0xd770('0x29'),_0x25b3e8);return request({'uri':util[_0xd770('0xf')]('%s/api/v2/contacts',_0x165cff[_0xd770('0x1c')]),'qs':{'phone':_0x25b3e8}})[_0xd770('0x1d')](function(_0x49a65f){if(_0x49a65f[_0xd770('0x21')]){logger[_0xd770('0xc')](_0xd770('0x2a'));return _[_0xd770('0x22')](_0x49a65f,{'phone':_0x25b3e8});}else{logger[_0xd770('0xc')](_0xd770('0x2b'));return request({'uri':util[_0xd770('0xf')](_0xd770('0x2c'),_0x165cff['remoteUri']),'method':_0xd770('0x2d'),'body':{'name':_0x5f0d2a,'phone':_0x25b3e8}})[_0xd770('0x1d')](function(_0x569cfd){logger[_0xd770('0xc')](_0xd770('0x2e'));return _0x569cfd;});}});}function getAuth(_0x53fbd4){return util[_0xd770('0xf')](_0xd770('0x2f'),new Buffer(_0x53fbd4['apiKey']+':X')[_0xd770('0x30')](_0xd770('0x31')));}function request(_0x1e7d92){logger[_0xd770('0x32')]('[HTTP]',JSON[_0xd770('0x33')](_0x1e7d92));return rp(_['defaults'](_0x1e7d92,{'method':_0xd770('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x490906,_0x17bb78){var _0xed3f5f=[];if(_0x490906&&_0x490906[_0xd770('0x21')]>0x0){_0xed3f5f=_[_0xd770('0x35')](_0x490906,_0x17bb78);}return _0xed3f5f;}function getCustomFields(_0x92a371,_0x38c538){var _0x50544a=[];var _0xb58854={'custom_fields':[]};if(_0x92a371[_0xd770('0x21')]>0x0){_['forEach'](_0x92a371,function(_0x54c04b){if(_0x54c04b['type']==='string'&&_0x54c04b[_0xd770('0x36')]&&!_0x54c04b[_0xd770('0x37')]){_0xb58854[_0x54c04b[_0xd770('0x36')][_0xd770('0x38')]()]=_0x54c04b[_0xd770('0x39')]['toString']();}else if(_0x54c04b['type']==='string'&&_0x54c04b[_0xd770('0x3a')]&&_0x54c04b[_0xd770('0x37')]){_0xb58854[_0xd770('0x18')][_0xd770('0x3b')]({'id':_0x54c04b['idField'],'value':_0x54c04b[_0xd770('0x39')][_0xd770('0x30')]()});}else if(_0x54c04b[_0xd770('0x3c')]===_0xd770('0x3d')&&_0x54c04b[_0xd770('0x3e')]&&_0x54c04b[_0xd770('0x3a')]&&_0x54c04b[_0xd770('0x37')]){_0x38c538[_0x54c04b['variableName']]&&_0xb58854[_0xd770('0x18')][_0xd770('0x3b')]({'id':_0x54c04b[_0xd770('0x3a')],'value':_0x38c538[_0x54c04b['variableName']]['toString']()});}else if(_0x54c04b[_0xd770('0x3c')]===_0xd770('0x3f')&&_0x54c04b[_0xd770('0x40')]&&_0x54c04b[_0xd770('0x40')][_0xd770('0x16')]&&_0x54c04b[_0xd770('0x3a')]&&_0x54c04b[_0xd770('0x37')]){_0x38c538[_0x54c04b[_0xd770('0x40')]['name'][_0xd770('0x38')]()]&&_0xb58854[_0xd770('0x18')][_0xd770('0x3b')]({'id':_0x54c04b[_0xd770('0x3a')],'value':_0x38c538[_0x54c04b['Variable']['name'][_0xd770('0x38')]()][_0xd770('0x30')]()});}});}return _0xb58854;}exports[_0xd770('0x41')]=function(_0x271d34,_0x2227e6,_0x2fd2e8,_0x22077c,_0x523a1e,_0x50ff37){var _0x154a18,_0x4f0bfe;_0x50ff37[_0xd770('0x1c')]=intUtil[_0xd770('0x42')](_0x50ff37['remoteUri']);_0x50ff37[_0xd770('0x43')]=intUtil[_0xd770('0x42')](_0x50ff37[_0xd770('0x43')]);if(_0x523a1e&&_0x523a1e[_0xd770('0x44')]){logger[_0xd770('0xc')](_0xd770('0x45'),_0xd770('0x46'));_0x2227e6[_0xd770('0x47')]=util[_0xd770('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50ff37[_0xd770('0x43')],_0x2227e6['uniqueid'],md5(_0x2227e6[_0xd770('0x48')]));}else{_0x2227e6[_0xd770('0x47')]='';}headers[_0xd770('0x49')]=getAuth(_0x50ff37);return getUser(_0x50ff37,_0x22077c[_0xd770('0x24')])[_0xd770('0x1d')](function(_0xd28cf6){_0x154a18=_0xd28cf6;logger['info'](_0xd770('0x4a'),_0x154a18['id']);return getEndUser(_0x50ff37,_0x2227e6['calleridname'],_0x2227e6[_0xd770('0x11')]);})[_0xd770('0x1d')](function(_0x5cfc4f){_0x4f0bfe=_0x5cfc4f;logger[_0xd770('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4f0bfe['id']);return getTicket(_0x50ff37,_0x154a18,_0x4f0bfe,_0x2fd2e8,_0x2227e6);})['then'](function(_0x4d732b){if(_0x4d732b&&_0x4d732b['id']){logger[_0xd770('0xc')](_0xd770('0x1e'));logger[_0xd770('0xc')](_0xd770('0x4b'),_0x4d732b['id']);logger[_0xd770('0xc')](_0xd770('0x45'),_0xd770('0x4c'));emit(util[_0xd770('0xf')](_0xd770('0x4d'),_0x22077c[_0xd770('0x16')]),'trigger:browser:url',{'uri':util['format'](_0xd770('0x4e'),_0x50ff37[_0xd770('0x1c')],_0x4d732b['id'])});}})[_0xd770('0x4f')](function(_0x53fc84){logger[_0xd770('0x50')](_0xd770('0x45'),JSON[_0xd770('0x33')](_0x53fc84));});};exports['outbound']=function(_0xf89c49,_0x25b2c3,_0x5bdf5b,_0x253658,_0x5c4e14,_0x17a593,_0x3d392d){var _0x103f87,_0x406812;_0x17a593[_0xd770('0x1c')]=intUtil[_0xd770('0x42')](_0x17a593[_0xd770('0x1c')]);_0x17a593[_0xd770('0x43')]=intUtil['stripTrailingSlash'](_0x17a593[_0xd770('0x43')]);if(_0x3d392d&&_0x3d392d[_0xd770('0x51')]&&_0x3d392d[_0xd770('0x51')]!==_0xd770('0x52')){logger['info'](_0xd770('0x53'),'Recording\x20is\x20enabled!');_0x25b2c3[_0xd770('0x47')]=util[_0xd770('0xf')](_0xd770('0x54'),_0x17a593[_0xd770('0x43')],_0x25b2c3['uniqueid'],md5(_0x25b2c3[_0xd770('0x48')]));}headers[_0xd770('0x49')]=getAuth(_0x17a593);return getUser(_0x17a593,_0x253658[_0xd770('0x24')])[_0xd770('0x1d')](function(_0x1663b9){_0x103f87=_0x1663b9;logger['info'](_0xd770('0x4a'),_0x103f87['id']);return getEndUser(_0x17a593,_0x25b2c3[_0xd770('0x55')],_0x25b2c3['destcalleridnum']);})[_0xd770('0x1d')](function(_0x5b2912){_0x406812=_0x5b2912;logger['info']('The\x20Enduser\x20ID\x20is:',_0x406812['id']);return getTicket(_0x17a593,_0x103f87,_0x406812,_0x5bdf5b,_0x25b2c3);})['then'](function(_0x1d97ed){if(_0x1d97ed&&_0x1d97ed['id']){logger[_0xd770('0xc')](_0xd770('0x1e'));logger[_0xd770('0xc')](_0xd770('0x4b'),_0x1d97ed['id']);logger[_0xd770('0xc')](_0xd770('0x53'),_0xd770('0x4c'));emit(util[_0xd770('0xf')](_0xd770('0x4d'),_0x253658[_0xd770('0x16')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x17a593[_0xd770('0x1c')],_0x1d97ed['id'])});}})[_0xd770('0x4f')](function(_0x4cf3f0){logger[_0xd770('0x50')](_0xd770('0x53'),JSON[_0xd770('0x33')](_0x4cf3f0));});};exports[_0xd770('0x56')]=function(_0x2d4051,_0x261769,_0x4b1568,_0x3a2187,_0xcb33d2,_0xf1942a){var _0x117bdc,_0x557285;_0xf1942a[_0xd770('0x1c')]=intUtil['stripTrailingSlash'](_0xf1942a['remoteUri']);_0xf1942a[_0xd770('0x43')]=intUtil[_0xd770('0x42')](_0xf1942a['serverUrl']);if(_0xcb33d2&&_0xcb33d2[_0xd770('0x44')]){logger[_0xd770('0xc')]('['+_0x261769['lastevent'][_0xd770('0x57')]()+']','Recording\x20is\x20enabled!');_0x261769[_0xd770('0x47')]=util[_0xd770('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf1942a[_0xd770('0x43')],_0x261769[_0xd770('0x48')],md5(_0x261769[_0xd770('0x48')]));}else{_0x261769[_0xd770('0x47')]='';}headers[_0xd770('0x49')]=getAuth(_0xf1942a);return getUser(_0xf1942a,'')[_0xd770('0x1d')](function(_0x473b97){_0x117bdc=_0x473b97;logger[_0xd770('0xc')](_0xd770('0x4a'),_0x117bdc['id']);return getEndUser(_0xf1942a,_0x261769[_0xd770('0x10')],_0x261769[_0xd770('0x11')]);})[_0xd770('0x1d')](function(_0x2f583a){_0x557285=_0x2f583a;logger['info'](_0xd770('0x58'),_0x557285['id']);return getTicket(_0xf1942a,_0x117bdc,_0x557285,_0x4b1568,_0x261769);})['then'](function(_0x106294){if(_0x106294){logger[_0xd770('0xc')](_0xd770('0x1e'));logger[_0xd770('0xc')](_0xd770('0x4b'),_0x106294['id']);}})[_0xd770('0x4f')](function(_0x31f0c5){logger[_0xd770('0x50')]('['+_0x261769[_0xd770('0x59')][_0xd770('0x57')]()+']',JSON['stringify'](_0x31f0c5));});}; \ No newline at end of file +var _0x2b99=['Enduser\x20found!','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','map','string','nameField','toLowerCase','content','toString','idField','customField','push','type','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridnum','%s/helpdesk/tickets/%d','lastevent','toUpperCase','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','POST','remoteUri','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts'];(function(_0x298f26,_0x20cbf2){var _0x4bd7a8=function(_0x20b180){while(--_0x20b180){_0x298f26['push'](_0x298f26['shift']());}};_0x4bd7a8(++_0x20cbf2);}(_0x2b99,0x88));var _0x92b9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2b99[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x92b9('0x0'));var rp=require(_0x92b9('0x1'));var md5=require('md5');var util=require(_0x92b9('0x2'));var Redis=require('ioredis');var intUtil=require(_0x92b9('0x3'));var config=require(_0x92b9('0x4'));var logger=require(_0x92b9('0x5'))(_0x92b9('0x6'));config[_0x92b9('0x7')]=_[_0x92b9('0x8')](config[_0x92b9('0x7')],{'host':_0x92b9('0x9'),'port':0x18eb});var io=require(_0x92b9('0xa'))(new Redis(config[_0x92b9('0x7')]));var headers={'Content-Type':_0x92b9('0xb'),'Accept':_0x92b9('0xb')};function emit(_0x228b1d,_0x284fb7,_0x16a076){io['to'](_0x228b1d)[_0x92b9('0xc')](_0x284fb7,_0x16a076);}function getTicket(_0x1d2371,_0x36e3a9,_0x70a459,_0x5a2757,_0x11eefe){logger[_0x92b9('0xd')](_0x92b9('0xe'));var _0x533777=_[_0x92b9('0xf')]({'responder_id':_0x36e3a9['id'],'requester_id':_0x70a459['id'],'name':util[_0x92b9('0x10')](_0x92b9('0x11'),_0x11eefe[_0x92b9('0x12')]),'phone':_0x11eefe[_0x92b9('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x92b9('0x14')](_0x5a2757[_0x92b9('0x15')],_0x11eefe,'\x20'),'description':intUtil['getString'](_0x5a2757['Descriptions'],_0x11eefe,_0x92b9('0x16')),'tags':getTags(_0x5a2757[_0x92b9('0x17')],_0x92b9('0x18'))},getCustomFields(_0x5a2757['Fields'],_0x11eefe));_0x533777[_0x92b9('0x19')]=_['mapValues'](_[_0x92b9('0x1a')](_0x533777[_0x92b9('0x19')],'id'),_0x92b9('0x1b'));return request({'uri':util['format'](_0x92b9('0x1c'),_0x1d2371['remoteUri']),'method':_0x92b9('0x1d'),'body':_0x533777})['then'](function(_0x2a63a8){logger[_0x92b9('0xd')]('Ticket\x20created!');return _0x2a63a8;});}function getUser(_0x16329b,_0x4d25f9){if(intUtil['validateEmail'](_0x4d25f9)){return request({'uri':util['format']('%s/api/v2/agents',_0x16329b[_0x92b9('0x1e')]),'qs':{'email':_0x4d25f9}})['then'](function(_0x5cbf23){if(_0x5cbf23[_0x92b9('0x1f')]){logger['info'](_0x92b9('0x20'));return _[_0x92b9('0x21')](_0x5cbf23,function(_0x390de6){return _0x390de6['contact'][_0x92b9('0x22')]===_0x4d25f9;});}else{logger[_0x92b9('0xd')](_0x92b9('0x23'));return request({'uri':util[_0x92b9('0x10')](_0x92b9('0x24'),_0x16329b[_0x92b9('0x1e')])})[_0x92b9('0x25')](function(_0x363c99){logger[_0x92b9('0xd')](_0x92b9('0x26'));return _0x363c99;});}});}else{logger[_0x92b9('0xd')](_0x92b9('0x27'));return request({'uri':util['format'](_0x92b9('0x24'),_0x16329b['remoteUri'])})[_0x92b9('0x25')](function(_0x56c43c){logger['info'](_0x92b9('0x26'));return _0x56c43c;});}}function getEndUser(_0x567ef4,_0x480b09,_0x4244e1){logger['info'](_0x92b9('0x28'),_0x4244e1);return request({'uri':util[_0x92b9('0x10')](_0x92b9('0x29'),_0x567ef4[_0x92b9('0x1e')]),'qs':{'phone':_0x4244e1}})[_0x92b9('0x25')](function(_0x5b20e4){if(_0x5b20e4[_0x92b9('0x1f')]){logger[_0x92b9('0xd')](_0x92b9('0x2a'));return _[_0x92b9('0x21')](_0x5b20e4,{'phone':_0x4244e1});}else{logger[_0x92b9('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x92b9('0x10')](_0x92b9('0x29'),_0x567ef4[_0x92b9('0x1e')]),'method':_0x92b9('0x1d'),'body':{'name':_0x480b09,'phone':_0x4244e1}})[_0x92b9('0x25')](function(_0x352f51){logger['info'](_0x92b9('0x2b'));return _0x352f51;});}});}function getAuth(_0x21fb80){return util['format']('Basic\x20%s',new Buffer(_0x21fb80[_0x92b9('0x2c')]+':X')['toString'](_0x92b9('0x2d')));}function request(_0x389858){logger[_0x92b9('0x2e')](_0x92b9('0x2f'),JSON[_0x92b9('0x30')](_0x389858));return rp(_['defaults'](_0x389858,{'method':_0x92b9('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x564cce,_0x5150e8){var _0x29f62e=[];if(_0x564cce&&_0x564cce[_0x92b9('0x1f')]>0x0){_0x29f62e=_[_0x92b9('0x32')](_0x564cce,_0x5150e8);}return _0x29f62e;}function getCustomFields(_0x3ef2e8,_0x3924b5){var _0x5e9ba9=[];var _0x576a3e={'custom_fields':[]};if(_0x3ef2e8[_0x92b9('0x1f')]>0x0){_['forEach'](_0x3ef2e8,function(_0x2e3785){if(_0x2e3785['type']===_0x92b9('0x33')&&_0x2e3785[_0x92b9('0x34')]&&!_0x2e3785['customField']){_0x576a3e[_0x2e3785[_0x92b9('0x34')][_0x92b9('0x35')]()]=_0x2e3785[_0x92b9('0x36')][_0x92b9('0x37')]();}else if(_0x2e3785['type']===_0x92b9('0x33')&&_0x2e3785[_0x92b9('0x38')]&&_0x2e3785[_0x92b9('0x39')]){_0x576a3e[_0x92b9('0x19')][_0x92b9('0x3a')]({'id':_0x2e3785['idField'],'value':_0x2e3785[_0x92b9('0x36')][_0x92b9('0x37')]()});}else if(_0x2e3785[_0x92b9('0x3b')]===_0x92b9('0x3c')&&_0x2e3785[_0x92b9('0x3d')]&&_0x2e3785[_0x92b9('0x38')]&&_0x2e3785[_0x92b9('0x39')]){_0x3924b5[_0x2e3785['variableName']]&&_0x576a3e[_0x92b9('0x19')][_0x92b9('0x3a')]({'id':_0x2e3785['idField'],'value':_0x3924b5[_0x2e3785[_0x92b9('0x3d')]][_0x92b9('0x37')]()});}else if(_0x2e3785[_0x92b9('0x3b')]==='customVariable'&&_0x2e3785[_0x92b9('0x3e')]&&_0x2e3785[_0x92b9('0x3e')][_0x92b9('0x18')]&&_0x2e3785[_0x92b9('0x38')]&&_0x2e3785[_0x92b9('0x39')]){_0x3924b5[_0x2e3785[_0x92b9('0x3e')][_0x92b9('0x18')][_0x92b9('0x35')]()]&&_0x576a3e[_0x92b9('0x19')][_0x92b9('0x3a')]({'id':_0x2e3785[_0x92b9('0x38')],'value':_0x3924b5[_0x2e3785['Variable'][_0x92b9('0x18')][_0x92b9('0x35')]()]['toString']()});}});}return _0x576a3e;}exports[_0x92b9('0x3f')]=function(_0x68982b,_0xe919ca,_0x56aad7,_0x4c83ec,_0x251ee8,_0x3b4d67){var _0x1f9771,_0x2dea46;_0x3b4d67['remoteUri']=intUtil[_0x92b9('0x40')](_0x3b4d67[_0x92b9('0x1e')]);_0x3b4d67[_0x92b9('0x41')]=intUtil['stripTrailingSlash'](_0x3b4d67['serverUrl']);if(_0x251ee8&&_0x251ee8[_0x92b9('0x42')]){logger['info']('[QUEUE]',_0x92b9('0x43'));_0xe919ca[_0x92b9('0x44')]=util['format'](_0x92b9('0x45'),_0x3b4d67[_0x92b9('0x41')],_0xe919ca[_0x92b9('0x46')],md5(_0xe919ca['uniqueid']));}else{_0xe919ca[_0x92b9('0x44')]='';}headers[_0x92b9('0x47')]=getAuth(_0x3b4d67);return getUser(_0x3b4d67,_0x4c83ec[_0x92b9('0x22')])['then'](function(_0x2d8bc9){_0x1f9771=_0x2d8bc9;logger['info'](_0x92b9('0x48'),_0x1f9771['id']);return getEndUser(_0x3b4d67,_0xe919ca[_0x92b9('0x12')],_0xe919ca[_0x92b9('0x13')]);})[_0x92b9('0x25')](function(_0x1dab3f){_0x2dea46=_0x1dab3f;logger[_0x92b9('0xd')](_0x92b9('0x49'),_0x2dea46['id']);return getTicket(_0x3b4d67,_0x1f9771,_0x2dea46,_0x56aad7,_0xe919ca);})['then'](function(_0x171806){if(_0x171806&&_0x171806['id']){logger[_0x92b9('0xd')](_0x92b9('0x4a'));logger[_0x92b9('0xd')](_0x92b9('0x4b'),_0x171806['id']);logger['info']('[QUEUE]',_0x92b9('0x4c'));emit(util[_0x92b9('0x10')](_0x92b9('0x4d'),_0x4c83ec[_0x92b9('0x18')]),_0x92b9('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3b4d67[_0x92b9('0x1e')],_0x171806['id'])});}})[_0x92b9('0x4f')](function(_0x115040){logger[_0x92b9('0x50')](_0x92b9('0x51'),JSON['stringify'](_0x115040));});};exports['outbound']=function(_0x32c0ce,_0x6792e4,_0x4fc8a9,_0x56b275,_0x1857f9,_0x9f06e6,_0x12640c){var _0x2bc72c,_0x359cb2;_0x9f06e6[_0x92b9('0x1e')]=intUtil[_0x92b9('0x40')](_0x9f06e6[_0x92b9('0x1e')]);_0x9f06e6[_0x92b9('0x41')]=intUtil[_0x92b9('0x40')](_0x9f06e6[_0x92b9('0x41')]);if(_0x12640c&&_0x12640c[_0x92b9('0x52')]&&_0x12640c[_0x92b9('0x52')]!==_0x92b9('0x53')){logger[_0x92b9('0xd')](_0x92b9('0x54'),'Recording\x20is\x20enabled!');_0x6792e4[_0x92b9('0x44')]=util[_0x92b9('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9f06e6[_0x92b9('0x41')],_0x6792e4[_0x92b9('0x46')],md5(_0x6792e4[_0x92b9('0x46')]));}headers['Authorization']=getAuth(_0x9f06e6);return getUser(_0x9f06e6,_0x56b275[_0x92b9('0x22')])[_0x92b9('0x25')](function(_0x5bd8b2){_0x2bc72c=_0x5bd8b2;logger[_0x92b9('0xd')]('The\x20User\x20ID\x20is:',_0x2bc72c['id']);return getEndUser(_0x9f06e6,_0x6792e4['destcalleridname'],_0x6792e4[_0x92b9('0x55')]);})[_0x92b9('0x25')](function(_0x2506c1){_0x359cb2=_0x2506c1;logger[_0x92b9('0xd')]('The\x20Enduser\x20ID\x20is:',_0x359cb2['id']);return getTicket(_0x9f06e6,_0x2bc72c,_0x359cb2,_0x4fc8a9,_0x6792e4);})[_0x92b9('0x25')](function(_0x4271c9){if(_0x4271c9&&_0x4271c9['id']){logger[_0x92b9('0xd')](_0x92b9('0x4a'));logger[_0x92b9('0xd')](_0x92b9('0x4b'),_0x4271c9['id']);logger[_0x92b9('0xd')]('[OUTBOUND]',_0x92b9('0x4c'));emit(util['format'](_0x92b9('0x4d'),_0x56b275[_0x92b9('0x18')]),_0x92b9('0x4e'),{'uri':util[_0x92b9('0x10')](_0x92b9('0x56'),_0x9f06e6['remoteUri'],_0x4271c9['id'])});}})[_0x92b9('0x4f')](function(_0xf56e7){logger[_0x92b9('0x50')]('[OUTBOUND]',JSON[_0x92b9('0x30')](_0xf56e7));});};exports['unmanaged']=function(_0x489159,_0x20fbca,_0x5a9553,_0xfa971e,_0xa4d6a9,_0x27212a){var _0x2bc7f5,_0x1b6b2f;_0x27212a[_0x92b9('0x1e')]=intUtil[_0x92b9('0x40')](_0x27212a['remoteUri']);_0x27212a[_0x92b9('0x41')]=intUtil[_0x92b9('0x40')](_0x27212a[_0x92b9('0x41')]);if(_0xa4d6a9&&_0xa4d6a9[_0x92b9('0x42')]){logger[_0x92b9('0xd')]('['+_0x20fbca[_0x92b9('0x57')][_0x92b9('0x58')]()+']',_0x92b9('0x43'));_0x20fbca[_0x92b9('0x44')]=util['format'](_0x92b9('0x45'),_0x27212a['serverUrl'],_0x20fbca[_0x92b9('0x46')],md5(_0x20fbca[_0x92b9('0x46')]));}else{_0x20fbca['recordingURL']='';}headers[_0x92b9('0x47')]=getAuth(_0x27212a);return getUser(_0x27212a,'')[_0x92b9('0x25')](function(_0x449d08){_0x2bc7f5=_0x449d08;logger['info'](_0x92b9('0x48'),_0x2bc7f5['id']);return getEndUser(_0x27212a,_0x20fbca['calleridname'],_0x20fbca[_0x92b9('0x13')]);})[_0x92b9('0x25')](function(_0x4d982a){_0x1b6b2f=_0x4d982a;logger[_0x92b9('0xd')](_0x92b9('0x49'),_0x1b6b2f['id']);return getTicket(_0x27212a,_0x2bc7f5,_0x1b6b2f,_0x5a9553,_0x20fbca);})['then'](function(_0x593bb8){if(_0x593bb8){logger[_0x92b9('0xd')](_0x92b9('0x4a'));logger[_0x92b9('0xd')](_0x92b9('0x4b'),_0x593bb8['id']);}})[_0x92b9('0x4f')](function(_0x289129){logger[_0x92b9('0x50')]('['+_0x20fbca[_0x92b9('0x57')][_0x92b9('0x58')]()+']',JSON['stringify'](_0x289129));});}; \ 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 c5a1620..8d88f01 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 _0x3baf=['info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers'];(function(_0x214263,_0x249e0b){var _0x104331=function(_0x329e6f){while(--_0x329e6f){_0x214263['push'](_0x214263['shift']());}};_0x104331(++_0x249e0b);}(_0x3baf,0xf7));var _0xf3ba=function(_0xd75a66,_0x156900){_0xd75a66=_0xd75a66-0x0;var _0x35ae80=_0x3baf[_0xd75a66];return _0x35ae80;};'use strict';var _=require(_0xf3ba('0x0'));var rp=require(_0xf3ba('0x1'));var md5=require(_0xf3ba('0x2'));var util=require(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var Promise=require(_0xf3ba('0x5'));var Redis=require(_0xf3ba('0x6'));var intUtil=require(_0xf3ba('0x7'));var config=require(_0xf3ba('0x8'));var logger=require(_0xf3ba('0x9'))(_0xf3ba('0xa'));config[_0xf3ba('0xb')]=_[_0xf3ba('0xc')](config[_0xf3ba('0xb')],{'host':_0xf3ba('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x5ab058,_0x32f810,_0x5affaf,_0x346f5b){return new Promise(function(_0x1a2166,_0x3ae5fb){var _0x40cff2=![];var _0x3a5714={'method':_0xf3ba('0xe'),'uri':_0x346f5b+_0xf3ba('0xf'),'json':!![]};_0x3a5714[_0xf3ba('0x10')]=_0x5affaf;logger[_0xf3ba('0x11')](_0xf3ba('0x12'));return rp(_0x3a5714)[_0xf3ba('0x13')](function(_0x3f9ed8){if(_0x3f9ed8){var _0x46c2cf=_0x3f9ed8[_0xf3ba('0x14')];var _0x26cefe=null;for(_0x26cefe=0x0;_0x26cefe<_0x46c2cf[_0xf3ba('0x15')];_0x26cefe++){if(_0x46c2cf[_0x26cefe][_0xf3ba('0x16')]===_0x5ab058[_0xf3ba('0x17')]){_0x5ab058['adminId']=_0x46c2cf[_0x26cefe]['id'];_0x40cff2=!![];}}if(_0x40cff2){logger[_0xf3ba('0x11')]('Admin\x20found:',_0x5ab058[_0xf3ba('0x18')]);_0x1a2166(_0x5ab058);}else{_0x3ae5fb({'statusCode':0x194,'message':_0xf3ba('0x19')});}}else{_0x3ae5fb({'statusCode':0x194,'message':_0xf3ba('0x19')});}})[_0xf3ba('0x1a')](function(_0x235c8a){logger['error']('['+[_0x32f810[_0xf3ba('0x1b')]()]+']',_0x235c8a[_0xf3ba('0x1c')]);_0x3ae5fb(_0x235c8a);});});}function getUser(_0x13d899,_0x550dd3,_0x292ebb){return function(_0x11fbd2){return new Promise(function(_0x430d64,_0x44de40){var _0x4d3c0a={'method':_0xf3ba('0xe'),'uri':_0x292ebb+_0xf3ba('0xf'),'json':!![]};_0x4d3c0a['headers']=_0x550dd3;logger['info'](_0xf3ba('0x1d'));return rp(_0x4d3c0a)[_0xf3ba('0x13')](function(_0x854fc4){if(_0x854fc4){var _0x5d351f=_0x854fc4[_0xf3ba('0x14')];var _0x327723=![];var _0x35d6d4=null;if(_0x11fbd2[_0xf3ba('0x1e')]!==null){logger[_0xf3ba('0x11')](_0xf3ba('0x1f'),_0x11fbd2[_0xf3ba('0x1e')]);_0x11fbd2['userEmail']=_0x11fbd2['agentEmail'];for(_0x35d6d4=0x0;_0x35d6d4<_0x5d351f['length'];_0x35d6d4++){if(_0x5d351f[_0x35d6d4][_0xf3ba('0x16')]===_0x11fbd2[_0xf3ba('0x1e')]){_0x327723=!![];_0x11fbd2[_0xf3ba('0x20')]=_0x5d351f[_0x35d6d4]['id'];logger[_0xf3ba('0x11')](_0xf3ba('0x21'),_0x11fbd2['userId']);}}}if(!_0x327723){logger['info'](_0xf3ba('0x22'));_0x11fbd2[_0xf3ba('0x23')]=_0x11fbd2['adminEmail'];_0x11fbd2[_0xf3ba('0x20')]=_0x11fbd2[_0xf3ba('0x18')];_0x327723=!![];}if(_0x327723){_0x430d64(_0x11fbd2);}else{_0x44de40({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x44de40({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf3ba('0x1a')](function(_0x7effa1){logger['error']('['+[_0x13d899[_0xf3ba('0x1b')]()]+']',_0x7effa1[_0xf3ba('0x1c')]);_0x44de40(_0x7effa1);});});};}function searchContact(_0x15ac44,_0x5a880e,_0x29ed57,_0x4e1708){return new Promise(function(_0x4e3094,_0x7c1a60){var _0x19ef2c={'method':'GET','headers':_0x5a880e,'uri':_0x15ac44+_0xf3ba('0x24')+_0x4e1708+_0xf3ba('0x25')+_0x29ed57+'&entities=contact','json':!![]};rp(_0x19ef2c)['then'](function(_0x49f234){var _0x1c6062=_[_0xf3ba('0x26')](_0x49f234['contacts'][_0xf3ba('0x27')],[_0x29ed57,_0x4e1708]);_0x4e3094(_0x1c6062);})['catch'](function(_0x48d81c){_0x7c1a60(_0x48d81c);});});}function getEndUser(_0x28dee0,_0x2a426c,_0x26b6e9){return function(_0x7af1e4){return new Promise(function(_0x1df823,_0xf1b77a){logger['info'](util[_0xf3ba('0x28')]('Searching\x20contact\x20with\x20phone\x20%s',_0x7af1e4[_0xf3ba('0x29')]));searchContact(_0x26b6e9,_0x2a426c,_0xf3ba('0x2a'),_0x7af1e4['contactNumber'])[_0xf3ba('0x13')](function(_0x36b6a1){if(_0x36b6a1){_0x7af1e4[_0xf3ba('0x2b')]=_0x36b6a1['id'];logger[_0xf3ba('0x11')]('Contact\x20found\x20mobile_number:',_0x7af1e4[_0xf3ba('0x2b')]);return _0x1df823(_0x7af1e4);}searchContact(_0x26b6e9,_0x2a426c,'work_number',_0x7af1e4['contactNumber'])['then'](function(_0x22fde8){if(_0x22fde8){_0x7af1e4[_0xf3ba('0x2b')]=_0x22fde8['id'];logger[_0xf3ba('0x11')](_0xf3ba('0x2c'),_0x7af1e4[_0xf3ba('0x2b')]);return _0x1df823(_0x7af1e4);}createEndUser(_0x7af1e4,_0x28dee0,_0x2a426c,_0x26b6e9)['then'](function(_0x10fe3e){logger['info'](_0xf3ba('0x2d'),_0x10fe3e['endUserId']);return _0x1df823(_0x10fe3e);});});})[_0xf3ba('0x1a')](function(_0x4355fe){_0xf1b77a(_0x4355fe);});});};}function createEndUser(_0x4232e0,_0x1607a4,_0x55d9be,_0x2a4c16){return new Promise(function(_0x416393,_0x5a1536){var _0x3d844d=moment();var _0x2405e5={'method':_0xf3ba('0x2e'),'uri':_0x2a4c16+_0xf3ba('0x2f'),'body':{'contact':{'last_name':_0x4232e0[_0xf3ba('0x29')],'work_number':_0x4232e0[_0xf3ba('0x29')],'mobile_number':_0x4232e0[_0xf3ba('0x29')],'owner_id':_0x4232e0['userId'],'created_at':_0x3d844d[_0xf3ba('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2405e5[_0xf3ba('0x10')]=_0x55d9be;logger['info'](_0xf3ba('0x30'));return rp(_0x2405e5)[_0xf3ba('0x13')](function(_0x1251b1){_0x4232e0[_0xf3ba('0x2b')]=_0x1251b1[_0xf3ba('0x31')]['id'];_0x416393(_0x4232e0);})['catch'](function(_0x55f56b){logger[_0xf3ba('0x32')]('['+[_0x1607a4[_0xf3ba('0x1b')]()]+']',_0x55f56b[_0xf3ba('0x1c')]);_0x5a1536(_0x55f56b[_0xf3ba('0x1c')]);});});}function getTicket(_0xd51c31,_0x3506cb,_0x4eb86b,_0x1859f6,_0x4b9c9e){return function(_0x42b805){logger[_0xf3ba('0x11')](_0xf3ba('0x33'));return new Promise(function(_0xa7fd7f,_0x25f68e){var _0x1e2de8=moment();var _0x26f640={'method':_0xf3ba('0x2e'),'uri':_0x4eb86b+'/api/tasks','body':{'title':intUtil[_0xf3ba('0x34')](_0x1859f6[_0xf3ba('0x35')],_0x4b9c9e,'\x20'),'description':intUtil[_0xf3ba('0x34')](_0x1859f6[_0xf3ba('0x36')],_0x4b9c9e,'\x0a'),'owner_id':_0x42b805[_0xf3ba('0x20')],'creater_id':_0x42b805[_0xf3ba('0x18')],'targetable_id':_0x42b805[_0xf3ba('0x2b')],'targetable_type':'Contact','created_at':_0x1e2de8[_0xf3ba('0x28')](_0xf3ba('0x37')),'due_date':_0x1e2de8['add'](0x1e,'m')[_0xf3ba('0x28')](_0xf3ba('0x37'))},'json':!![]};_0x26f640[_0xf3ba('0x10')]=_0x3506cb;return rp(_0x26f640)[_0xf3ba('0x13')](function(_0x3c454e){_0x42b805[_0xf3ba('0x38')]=_0x3c454e[_0xf3ba('0x39')]['id'];logger[_0xf3ba('0x11')](_0xf3ba('0x3a'),_0x42b805[_0xf3ba('0x38')]);_0xa7fd7f(_0x42b805);})[_0xf3ba('0x1a')](function(_0x1df8be){logger[_0xf3ba('0x32')]('['+[_0xd51c31[_0xf3ba('0x1b')]()]+']',_0x1df8be[_0xf3ba('0x1c')]);_0x25f68e(_0x1df8be[_0xf3ba('0x1c')]);});});};}function emit(_0xb28277,_0x3afc3e,_0x4f251b){var _0x10d30d={'uri':_0xb28277+_0xf3ba('0x3b')+_0x4f251b};io['to'](util['format'](_0xf3ba('0x3c'),_0x3afc3e))[_0xf3ba('0x3d')](_0xf3ba('0x3e'),_0x10d30d);}exports['cs']=function(_0x36f476,_0x52ef61,_0x5d0e2a,_0x28ca9b,_0x3186e7,_0x3fd90f,_0x1e6910,_0x502483){var _0x2d3a0d={};var _0xdc71c8={'Authorization':_0xf3ba('0x3f')+_0x3fd90f['apiKey']};_0x3fd90f[_0xf3ba('0x40')]=intUtil[_0xf3ba('0x41')](_0x3fd90f[_0xf3ba('0x40')]);_0x3fd90f[_0xf3ba('0x42')]=intUtil[_0xf3ba('0x41')](_0x3fd90f[_0xf3ba('0x42')]);var _0x2c9643=_0x3fd90f[_0xf3ba('0x40')];_0x2d3a0d[_0xf3ba('0x17')]=_0x3fd90f[_0xf3ba('0x43')];_0x2d3a0d['contactNumber']=_0x502483[_0xf3ba('0x44')]()===_0xf3ba('0x45')?_0x52ef61[_0xf3ba('0x46')]:_0x52ef61[_0xf3ba('0x47')];_0x2d3a0d['callDirection']=_0x502483===_0xf3ba('0x48')||_0x502483==='unmanaged'?'queue':_0xf3ba('0x45');if(_0x28ca9b){_0x2d3a0d[_0xf3ba('0x1e')]=_0x28ca9b[_0xf3ba('0x16')];}var _0x1fc9e6=util[_0xf3ba('0x28')](_0xf3ba('0x49'),_0x3fd90f[_0xf3ba('0x42')],_0x52ef61[_0xf3ba('0x4a')],md5(_0x52ef61['uniqueid']));if(_0x3186e7&&_0x3186e7[_0xf3ba('0x4b')]){logger[_0xf3ba('0x11')](_0xf3ba('0x4c'),_0xf3ba('0x4d'));_0x52ef61['recordingURL']=_0x1fc9e6;}else if(_0x1e6910&&_0x1e6910['recordingFormat']&&_0x1e6910[_0xf3ba('0x4e')]!==_0xf3ba('0x4f')){logger[_0xf3ba('0x11')](_0xf3ba('0x50'),_0xf3ba('0x4d'));_0x52ef61['recordingURL']=_0x1fc9e6;}else{_0x52ef61[_0xf3ba('0x51')]='';}return getAdminId(_0x2d3a0d,_0x502483,_0xdc71c8,_0x2c9643)['then'](getUser(_0x502483,_0xdc71c8,_0x2c9643))[_0xf3ba('0x13')](getEndUser(_0x502483,_0xdc71c8,_0x2c9643))['then'](getTicket(_0x502483,_0xdc71c8,_0x2c9643,_0x5d0e2a,_0x52ef61))[_0xf3ba('0x13')](function(_0x578000){logger[_0xf3ba('0x11')](util[_0xf3ba('0x28')](_0xf3ba('0x52'),_0x578000[_0xf3ba('0x38')]));if(_0x502483!==_0xf3ba('0x53')){logger['info']('['+[_0x502483[_0xf3ba('0x1b')]()]+']',_0xf3ba('0x54'));emit(_0x2c9643,_0x28ca9b[_0xf3ba('0x55')],_0x578000['endUserId']);}})[_0xf3ba('0x1a')](function(_0x553e9f){logger[_0xf3ba('0x32')]('['+[_0x502483[_0xf3ba('0x1b')]()]+_0xf3ba('0x56'),util[_0xf3ba('0x57')](_0x553e9f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x72a2=['contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminEmail','error','toUpperCase','message','/api/lookup?q=','&f=','&entities=contact','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x72a2,0x161));var _0x272a=function(_0x562e5c,_0x481cc1){_0x562e5c=_0x562e5c-0x0;var _0x11a68e=_0x72a2[_0x562e5c];return _0x11a68e;};'use strict';var _=require('lodash');var rp=require(_0x272a('0x0'));var md5=require(_0x272a('0x1'));var util=require(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var Promise=require(_0x272a('0x4'));var Redis=require('ioredis');var intUtil=require(_0x272a('0x5'));var config=require('../../../../config/environment');var logger=require(_0x272a('0x6'))('freshsales');config['redis']=_['defaults'](config[_0x272a('0x7')],{'host':_0x272a('0x8'),'port':0x18eb});var io=require(_0x272a('0x9'))(new Redis(config[_0x272a('0x7')]));function getAdminId(_0x54dbfb,_0x484f88,_0x1fdba5,_0x5edd05){return new Promise(function(_0x830fb6,_0x50af90){var _0x8ff2fe=![];var _0x844c3a={'method':_0x272a('0xa'),'uri':_0x5edd05+_0x272a('0xb'),'json':!![]};_0x844c3a['headers']=_0x1fdba5;logger['info'](_0x272a('0xc'));return rp(_0x844c3a)[_0x272a('0xd')](function(_0x5c2e7a){if(_0x5c2e7a){var _0x21f703=_0x5c2e7a[_0x272a('0xe')];var _0x37ee7e=null;for(_0x37ee7e=0x0;_0x37ee7e<_0x21f703[_0x272a('0xf')];_0x37ee7e++){if(_0x21f703[_0x37ee7e][_0x272a('0x10')]===_0x54dbfb['adminEmail']){_0x54dbfb[_0x272a('0x11')]=_0x21f703[_0x37ee7e]['id'];_0x8ff2fe=!![];}}if(_0x8ff2fe){logger[_0x272a('0x12')](_0x272a('0x13'),_0x54dbfb[_0x272a('0x11')]);_0x830fb6(_0x54dbfb);}else{_0x50af90({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x50af90({'statusCode':0x194,'message':_0x272a('0x14')});}})[_0x272a('0x15')](function(_0x5b615a){logger['error']('['+[_0x484f88['toUpperCase']()]+']',_0x5b615a['message']);_0x50af90(_0x5b615a);});});}function getUser(_0x47dfdf,_0x567955,_0xa13cda){return function(_0x48bf3d){return new Promise(function(_0x3eab5e,_0x327f68){var _0x2bc720={'method':_0x272a('0xa'),'uri':_0xa13cda+'/api/selector/owners','json':!![]};_0x2bc720[_0x272a('0x16')]=_0x567955;logger[_0x272a('0x12')](_0x272a('0x17'));return rp(_0x2bc720)[_0x272a('0xd')](function(_0x1652c9){if(_0x1652c9){var _0x9a0156=_0x1652c9[_0x272a('0xe')];var _0x5cc0d6=![];var _0x393e68=null;if(_0x48bf3d[_0x272a('0x18')]!==null){logger[_0x272a('0x12')](_0x272a('0x19'),_0x48bf3d[_0x272a('0x18')]);_0x48bf3d[_0x272a('0x1a')]=_0x48bf3d['agentEmail'];for(_0x393e68=0x0;_0x393e68<_0x9a0156[_0x272a('0xf')];_0x393e68++){if(_0x9a0156[_0x393e68]['email']===_0x48bf3d[_0x272a('0x18')]){_0x5cc0d6=!![];_0x48bf3d['userId']=_0x9a0156[_0x393e68]['id'];logger[_0x272a('0x12')]('User\x20found:',_0x48bf3d[_0x272a('0x1b')]);}}}if(!_0x5cc0d6){logger[_0x272a('0x12')](_0x272a('0x1c'));_0x48bf3d[_0x272a('0x1a')]=_0x48bf3d[_0x272a('0x1d')];_0x48bf3d[_0x272a('0x1b')]=_0x48bf3d[_0x272a('0x11')];_0x5cc0d6=!![];}if(_0x5cc0d6){_0x3eab5e(_0x48bf3d);}else{_0x327f68({'statusCode':0x194,'message':_0x272a('0x14')});}}else{_0x327f68({'statusCode':0x194,'message':_0x272a('0x14')});}})['catch'](function(_0xc743bc){logger[_0x272a('0x1e')]('['+[_0x47dfdf[_0x272a('0x1f')]()]+']',_0xc743bc[_0x272a('0x20')]);_0x327f68(_0xc743bc);});});};}function searchContact(_0x332ac8,_0x4f7947,_0x4b50b8,_0x1216b5){return new Promise(function(_0x270df8,_0x654dc6){var _0x1bce15={'method':_0x272a('0xa'),'headers':_0x4f7947,'uri':_0x332ac8+_0x272a('0x21')+_0x1216b5+_0x272a('0x22')+_0x4b50b8+_0x272a('0x23'),'json':!![]};rp(_0x1bce15)[_0x272a('0xd')](function(_0x3c6618){var _0x2c19d1=_['find'](_0x3c6618['contacts']['contacts'],[_0x4b50b8,_0x1216b5]);_0x270df8(_0x2c19d1);})[_0x272a('0x15')](function(_0x4e27b6){_0x654dc6(_0x4e27b6);});});}function getEndUser(_0x3fbb46,_0x18a3cd,_0x4b7628){return function(_0x17c49f){return new Promise(function(_0x3fb678,_0x360d68){logger[_0x272a('0x12')](util[_0x272a('0x24')](_0x272a('0x25'),_0x17c49f[_0x272a('0x26')]));searchContact(_0x4b7628,_0x18a3cd,_0x272a('0x27'),_0x17c49f['contactNumber'])[_0x272a('0xd')](function(_0x708c46){if(_0x708c46){_0x17c49f[_0x272a('0x28')]=_0x708c46['id'];logger['info'](_0x272a('0x29'),_0x17c49f['endUserId']);return _0x3fb678(_0x17c49f);}searchContact(_0x4b7628,_0x18a3cd,'work_number',_0x17c49f[_0x272a('0x26')])['then'](function(_0x3c167f){if(_0x3c167f){_0x17c49f[_0x272a('0x28')]=_0x3c167f['id'];logger[_0x272a('0x12')](_0x272a('0x2a'),_0x17c49f[_0x272a('0x28')]);return _0x3fb678(_0x17c49f);}createEndUser(_0x17c49f,_0x3fbb46,_0x18a3cd,_0x4b7628)[_0x272a('0xd')](function(_0x5be81b){logger[_0x272a('0x12')](_0x272a('0x2b'),_0x5be81b[_0x272a('0x28')]);return _0x3fb678(_0x5be81b);});});})[_0x272a('0x15')](function(_0x17b44c){_0x360d68(_0x17b44c);});});};}function createEndUser(_0x258288,_0x411714,_0x4dea62,_0x8b76eb){return new Promise(function(_0x2ab2c0,_0x3cd7f6){var _0x248ada=moment();var _0xadf3ec={'method':_0x272a('0x2c'),'uri':_0x8b76eb+'/api/contacts','body':{'contact':{'last_name':_0x258288['contactNumber'],'work_number':_0x258288[_0x272a('0x26')],'mobile_number':_0x258288[_0x272a('0x26')],'owner_id':_0x258288[_0x272a('0x1b')],'created_at':_0x248ada[_0x272a('0x24')](_0x272a('0x2d'))}},'json':!![]};_0xadf3ec[_0x272a('0x16')]=_0x4dea62;logger[_0x272a('0x12')](_0x272a('0x2e'));return rp(_0xadf3ec)[_0x272a('0xd')](function(_0x3cb33a){_0x258288[_0x272a('0x28')]=_0x3cb33a[_0x272a('0x2f')]['id'];_0x2ab2c0(_0x258288);})[_0x272a('0x15')](function(_0x4e5b22){logger[_0x272a('0x1e')]('['+[_0x411714['toUpperCase']()]+']',_0x4e5b22[_0x272a('0x20')]);_0x3cd7f6(_0x4e5b22[_0x272a('0x20')]);});});}function getTicket(_0x4f5fe0,_0x464e4b,_0x3bb10d,_0x13881c,_0xcb9265){return function(_0x1e7be0){logger[_0x272a('0x12')](_0x272a('0x30'));return new Promise(function(_0x52e45e,_0x24ad25){var _0xa70d2a=moment();var _0x5a7a12={'method':'POST','uri':_0x3bb10d+_0x272a('0x31'),'body':{'title':intUtil['getString'](_0x13881c[_0x272a('0x32')],_0xcb9265,'\x20'),'description':intUtil[_0x272a('0x33')](_0x13881c[_0x272a('0x34')],_0xcb9265,'\x0a'),'owner_id':_0x1e7be0[_0x272a('0x1b')],'creater_id':_0x1e7be0[_0x272a('0x11')],'targetable_id':_0x1e7be0[_0x272a('0x28')],'targetable_type':'Contact','created_at':_0xa70d2a[_0x272a('0x24')](_0x272a('0x2d')),'due_date':_0xa70d2a['add'](0x1e,'m')[_0x272a('0x24')](_0x272a('0x2d'))},'json':!![]};_0x5a7a12['headers']=_0x464e4b;return rp(_0x5a7a12)[_0x272a('0xd')](function(_0xbc824b){_0x1e7be0[_0x272a('0x35')]=_0xbc824b[_0x272a('0x36')]['id'];logger[_0x272a('0x12')](_0x272a('0x37'),_0x1e7be0['ticketId']);_0x52e45e(_0x1e7be0);})[_0x272a('0x15')](function(_0x367f54){logger[_0x272a('0x1e')]('['+[_0x4f5fe0['toUpperCase']()]+']',_0x367f54[_0x272a('0x20')]);_0x24ad25(_0x367f54[_0x272a('0x20')]);});});};}function emit(_0x5d7ad4,_0x4034fa,_0x370f3b){var _0x36862b={'uri':_0x5d7ad4+_0x272a('0x38')+_0x370f3b};io['to'](util[_0x272a('0x24')](_0x272a('0x39'),_0x4034fa))[_0x272a('0x3a')]('trigger:browser:url',_0x36862b);}exports['cs']=function(_0x53a627,_0x596d99,_0x47cde3,_0xe8e14f,_0x326aa3,_0x86a795,_0x6704b0,_0x4bb335){var _0x96d803={};var _0x4179c4={'Authorization':'Token\x20token='+_0x86a795[_0x272a('0x3b')]};_0x86a795[_0x272a('0x3c')]=intUtil[_0x272a('0x3d')](_0x86a795[_0x272a('0x3c')]);_0x86a795[_0x272a('0x3e')]=intUtil[_0x272a('0x3d')](_0x86a795[_0x272a('0x3e')]);var _0x32cb32=_0x86a795[_0x272a('0x3c')];_0x96d803[_0x272a('0x1d')]=_0x86a795[_0x272a('0x3f')];_0x96d803['contactNumber']=_0x4bb335['toLowerCase']()===_0x272a('0x40')?_0x596d99['destcalleridnum']:_0x596d99[_0x272a('0x41')];_0x96d803[_0x272a('0x42')]=_0x4bb335===_0x272a('0x43')||_0x4bb335===_0x272a('0x44')?_0x272a('0x43'):'outbound';if(_0xe8e14f){_0x96d803['agentEmail']=_0xe8e14f[_0x272a('0x10')];}var _0x5822cb=util[_0x272a('0x24')](_0x272a('0x45'),_0x86a795[_0x272a('0x3e')],_0x596d99[_0x272a('0x46')],md5(_0x596d99[_0x272a('0x46')]));if(_0x326aa3&&_0x326aa3[_0x272a('0x47')]){logger['info'](_0x272a('0x48'),'Recording\x20is\x20enabled!');_0x596d99['recordingURL']=_0x5822cb;}else if(_0x6704b0&&_0x6704b0[_0x272a('0x49')]&&_0x6704b0['recordingFormat']!=='none'){logger[_0x272a('0x12')](_0x272a('0x4a'),_0x272a('0x4b'));_0x596d99['recordingURL']=_0x5822cb;}else{_0x596d99[_0x272a('0x4c')]='';}return getAdminId(_0x96d803,_0x4bb335,_0x4179c4,_0x32cb32)[_0x272a('0xd')](getUser(_0x4bb335,_0x4179c4,_0x32cb32))[_0x272a('0xd')](getEndUser(_0x4bb335,_0x4179c4,_0x32cb32))['then'](getTicket(_0x4bb335,_0x4179c4,_0x32cb32,_0x47cde3,_0x596d99))[_0x272a('0xd')](function(_0x386966){logger[_0x272a('0x12')](util[_0x272a('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x386966[_0x272a('0x35')]));if(_0x4bb335!==_0x272a('0x44')){logger[_0x272a('0x12')]('['+[_0x4bb335[_0x272a('0x1f')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x32cb32,_0xe8e14f[_0x272a('0x4d')],_0x386966[_0x272a('0x28')]);}})[_0x272a('0x15')](function(_0x291a6f){logger[_0x272a('0x1e')]('['+[_0x4bb335[_0x272a('0x1f')]()]+_0x272a('0x4e'),util[_0x272a('0x4f')](_0x291a6f,{'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 79b0946..d413b22 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 _0x9ffd=['unknown\x20integration','error','../../../../config/logger','[EXEC]','format','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','Configurations','data3','queue','unmanaged','servicenow','log'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4b85ac,_0x325e30){_0x4b85ac=_0x4b85ac-0x0;var _0x182e10=_0x9ffd[_0x4b85ac];return _0x182e10;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var zendesk=require(_0xd9ff('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xd9ff('0x3'));var freshdesk=require(_0xd9ff('0x4'));var zoho=require(_0xd9ff('0x5'));var desk=require(_0xd9ff('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xd9ff('0x7'));var dynamics365=require(_0xd9ff('0x8'));var freshsales=require('./freshsales');var integrations=[_0xd9ff('0x9'),_0xd9ff('0xa'),_0xd9ff('0xb'),_0xd9ff('0xc'),_0xd9ff('0xd'),_0xd9ff('0xe'),_0xd9ff('0xf'),_0xd9ff('0x10'),_0xd9ff('0x11'),'servicenow'];exports['exec']=function(_0x567f79,_0x5aa954,_0x2355ab,_0x2fd77a,_0x193537,_0x32b48f){if(_0x2355ab){if(_[_0xd9ff('0x12')](integrations,_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]())){try{var _0x1c2a16=null;var _0x47d842='';var _0x47b0d7=_0x2355ab[_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]()];if(_0x47b0d7){var _0x415c58=_0x47b0d7[_0x567f79[_0xd9ff('0x15')]];if(_0x415c58){var _0x12c39a=_['find'](_0x415c58[_0xd9ff('0x16')],{'id':parseInt(_0x567f79[_0xd9ff('0x17')],0xa)});if(_0x12c39a){if(_0x2fd77a){if(_0x193537&&_0x5aa954['queue']){_0x47d842=_0xd9ff('0x18');}else if(_0x5aa954['routeId']){_0x47d842='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x5aa954);}}else{_0x47d842=_0xd9ff('0x19');}switch(_0x567f79['data1'][_0xd9ff('0x14')]()){case _0xd9ff('0x9'):zendesk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xa'):salesforce[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xb'):sugarcrm[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xc'):freshdesk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xd'):zoho[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xe'):desk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xf'):vtiger[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0x11'):freshsales['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;case _0xd9ff('0x1a'):servicenow['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;case _0xd9ff('0x10'):dynamics365['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;default:console[_0xd9ff('0x1b')](_0xd9ff('0x1c'));}}else{_0x1c2a16=require('../../../../config/logger')(_0x567f79['data1'][_0xd9ff('0x14')]());_0x1c2a16[_0xd9ff('0x1d')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x567f79['data1'][_0xd9ff('0x14')](),_0x567f79['data3']));}}else{_0x1c2a16=require(_0xd9ff('0x1e'))(_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]());_0x1c2a16[_0xd9ff('0x1d')](_0xd9ff('0x1f'),util[_0xd9ff('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x567f79['data1'][_0xd9ff('0x14')](),_0x567f79['data2']));}}else{}}catch(_0x3ca906){console['error'](_0x3ca906);}}}}; \ No newline at end of file +var _0x5eb8=['data1','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','toLowerCase','vtiger','freshsales','log','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','error','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','servicenow','exec','includes'];(function(_0x57594d,_0x3a9645){var _0x3c5528=function(_0x5a1582){while(--_0x5a1582){_0x57594d['push'](_0x57594d['shift']());}};_0x3c5528(++_0x3a9645);}(_0x5eb8,0xb0));var _0x85eb=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x5eb8[_0x500c0];return _0xdd146f;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x85eb('0x0'));var salesforce=require(_0x85eb('0x1'));var sugarcrm=require(_0x85eb('0x2'));var freshdesk=require(_0x85eb('0x3'));var zoho=require(_0x85eb('0x4'));var desk=require(_0x85eb('0x5'));var vtiger=require(_0x85eb('0x6'));var servicenow=require(_0x85eb('0x7'));var dynamics365=require(_0x85eb('0x8'));var freshsales=require(_0x85eb('0x9'));var integrations=[_0x85eb('0xa'),_0x85eb('0xb'),'sugarcrm',_0x85eb('0xc'),_0x85eb('0xd'),_0x85eb('0xe'),'vtiger',_0x85eb('0xf'),'freshsales',_0x85eb('0x10')];exports[_0x85eb('0x11')]=function(_0x673228,_0x29030b,_0x1dacf2,_0x73e6d0,_0x2c7fd3,_0x50ef6f){if(_0x1dacf2){if(_[_0x85eb('0x12')](integrations,_0x673228[_0x85eb('0x13')]['toLowerCase']())){try{var _0x2af376=null;var _0x784583='';var _0x2f42ba=_0x1dacf2[_0x673228[_0x85eb('0x13')]['toLowerCase']()];if(_0x2f42ba){var _0x548628=_0x2f42ba[_0x673228[_0x85eb('0x14')]];if(_0x548628){var _0x5c760a=_[_0x85eb('0x15')](_0x548628[_0x85eb('0x16')],{'id':parseInt(_0x673228[_0x85eb('0x17')],0xa)});if(_0x5c760a){if(_0x73e6d0){if(_0x2c7fd3&&_0x29030b[_0x85eb('0x18')]){_0x784583=_0x85eb('0x18');}else if(_0x29030b['routeId']){_0x784583=_0x85eb('0x19');}else{console['log'](_0x85eb('0x1a'),_0x29030b);}}else{_0x784583=_0x85eb('0x1b');}switch(_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')]()){case'zendesk':zendesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'salesforce':salesforce[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'sugarcrm':sugarcrm[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xc'):freshdesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xd'):zoho[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xe'):desk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1d'):vtiger[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1e'):freshsales['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case _0x85eb('0x10'):servicenow['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case'dynamics365':dynamics365['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;default:console[_0x85eb('0x1f')](_0x85eb('0x20'));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error']('[EXEC]',util[_0x85eb('0x22')](_0x85eb('0x23'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x17')]));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error'](_0x85eb('0x24'),util[_0x85eb('0x22')](_0x85eb('0x25'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x14')]));}}else{}}catch(_0x5dfc96){console[_0x85eb('0x26')](_0x5dfc96);}}}}; \ 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 30616bf..99c56a7 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 _0x819a=['moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','Subjects','Descriptions','create','isNil','validateEmail','sobject','execute','then','find','Email','Agent\x20%s\x20found.','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','moduleSearch','Contact','Lead','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','length','Phone','Name','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.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','catch','unmanaged','monitor_format','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise'];(function(_0x2b615c,_0x2794a6){var _0x9e262e=function(_0x2faf7e){while(--_0x2faf7e){_0x2b615c['push'](_0x2b615c['shift']());}};_0x9e262e(++_0x2794a6);}(_0x819a,0x1bf));var _0xa819=function(_0x60b834,_0x3ccdda){_0x60b834=_0x60b834-0x0;var _0x832e5e=_0x819a[_0x60b834];return _0x832e5e;};'use strict';var _=require('lodash');var rp=require(_0xa819('0x0'));var moment=require(_0xa819('0x1'));var BPromise=require(_0xa819('0x2'));var md5=require(_0xa819('0x3'));var jsforce=require(_0xa819('0x4'));var util=require(_0xa819('0x5'));var Redis=require(_0xa819('0x6'));var intUtil=require(_0xa819('0x7'));var config=require(_0xa819('0x8'));var logger=require(_0xa819('0x9'))(_0xa819('0xa'));config[_0xa819('0xb')]=_[_0xa819('0xc')](config[_0xa819('0xb')],{'host':_0xa819('0xd'),'port':0x18eb});var io=require(_0xa819('0xe'))(new Redis(config[_0xa819('0xb')]));function emit(_0x5a83a1,_0x59d5a4,_0x358d21){io['to'](_0x5a83a1)['emit'](_0x59d5a4,_0x358d21);}function getTicket(_0x56ef57,_0x27478f,_0x180dad,_0x208437,_0x33be07,_0x19ab5e,_0x37a770,_0x21b4e0){var _0x4e9ad6={};if(_0x208437[_0xa819('0xf')]===_0xa819('0x10')){_0x4e9ad6=Object[_0xa819('0x11')]({},{'OwnerId':_0x27478f['id'],'ActivityDate':moment[_0xa819('0x12')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xa819('0x13')](_0x208437['Subjects'],_0x33be07,'\x20'),'Description':intUtil[_0xa819('0x13')](_0x208437['Descriptions'],_0x33be07,'\x0a')},getCustomFields(_0x19ab5e,_0x33be07));if(_0x180dad){_0x4e9ad6['WhoId']=_0x180dad['id'];}}else if(_0x208437[_0xa819('0xf')]==='Case'){_0x4e9ad6=Object['assign']({},{'OwnerId':_0x27478f['id'],'Subject':intUtil[_0xa819('0x13')](_0x208437[_0xa819('0x14')],_0x33be07,'\x20'),'Description':intUtil[_0xa819('0x13')](_0x208437[_0xa819('0x15')],_0x33be07,'\x0a')},getCustomFields(_0x19ab5e,_0x33be07));if(_0x180dad){_0x4e9ad6['ContactId']=_0x180dad['id'];}}return _0x37a770['sobject'](_0x208437[_0xa819('0xf')])[_0xa819('0x16')](_0x4e9ad6);}function getUser(_0x262bed,_0x249edc,_0x435cf5){if(!_[_0xa819('0x17')](_0x249edc)&&intUtil[_0xa819('0x18')](_0x249edc)){var _0x50a2b1={'Email':_0x249edc};var _0x12e4e1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x435cf5[_0xa819('0x19')]('User')['find'](_0x50a2b1,_0x12e4e1)[_0xa819('0x1a')]()[_0xa819('0x1b')](function(_0x423ba4){if(_0x423ba4['length']){var _0x5ecfaf=_[_0xa819('0x1c')](_0x423ba4,function(_0x39b137){return _0x39b137[_0xa819('0x1d')]===_0x249edc;});if(_0x5ecfaf){logger['info'](_0xa819('0x1e'),_0x249edc);return BPromise['resolve']({'id':_0x5ecfaf['Id'],'name':_0x5ecfaf['Name']});}}else{logger[_0xa819('0x1f')](_0xa819('0x20'),_0x249edc);return _0x435cf5[_0xa819('0x21')]()[_0xa819('0x1b')](function(_0xf779cd){return BPromise[_0xa819('0x22')]({'id':_0xf779cd[_0xa819('0x23')],'name':_0xf779cd[_0xa819('0x24')]});});}});}else{logger[_0xa819('0x1f')](_0xa819('0x20'),_0x249edc);return _0x435cf5[_0xa819('0x21')]()[_0xa819('0x1b')](function(_0x51a36a){return BPromise[_0xa819('0x22')]({'id':_0x51a36a[_0xa819('0x23')],'name':_0x51a36a[_0xa819('0x24')]});});}}function getEndUser(_0x1e8169,_0x13e095,_0x32be1b,_0x36758b,_0x4db482){var _0x18ccf3={'Phone':_0x36758b};var _0x4b37e6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa819('0x22')]()['then'](function(){if(_0x13e095['ticketType']===_0xa819('0x10')){logger[_0xa819('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x36758b,_0x13e095[_0xa819('0x25')]);switch(_0x13e095[_0xa819('0x25')]){case'contact_lead':return _0x4db482[_0xa819('0x19')](_0xa819('0x26'))[_0xa819('0x1c')](_0x18ccf3,_0x4b37e6)[_0xa819('0x1a')]()[_0xa819('0x1b')](function(_0x4c6cf7){if(_0x4c6cf7&&_0x4c6cf7['length']){return _0x4c6cf7;}else{return _0x4db482[_0xa819('0x19')](_0xa819('0x27'))[_0xa819('0x1c')](_0x18ccf3,_0x4b37e6);}});case _0xa819('0x28'):return _0x4db482[_0xa819('0x19')](_0xa819('0x26'))[_0xa819('0x1c')](_0x18ccf3,_0x4b37e6)[_0xa819('0x1a')]();case _0xa819('0x29'):return _0x4db482[_0xa819('0x19')](_0xa819('0x27'))[_0xa819('0x1c')](_0x18ccf3,_0x4b37e6);default:return null;}}else if(_0x13e095[_0xa819('0xf')]==='Case'){logger[_0xa819('0x1f')](_0xa819('0x2a'),_0x36758b,_0xa819('0x28'));return _0x4db482[_0xa819('0x19')](_0xa819('0x26'))['find'](_0x18ccf3,_0x4b37e6)[_0xa819('0x1a')]();}})['then'](function(_0x57a5fb){if(_0x57a5fb&&_0x57a5fb[_0xa819('0x2b')]){var _0x8879e3=_[_0xa819('0x1c')](_0x57a5fb,function(_0x376d42){return _0x376d42[_0xa819('0x2c')]===_0x36758b;});if(_0x8879e3){return BPromise[_0xa819('0x22')]({'id':_0x8879e3['Id'],'name':_0x8879e3[_0xa819('0x2d')],'phone':_0x8879e3[_0xa819('0x2c')]});}}})[_0xa819('0x1b')](function(_0x2be0a1){if(_0x2be0a1){logger['info'](_0xa819('0x2e'),_0x36758b);return BPromise[_0xa819('0x22')](_0x2be0a1);}else{logger[_0xa819('0x1f')](_0xa819('0x2f'),_0x36758b);var _0x166bde={'LastName':_0x32be1b!==_0xa819('0x30')?_0x32be1b:util[_0xa819('0x31')](_0xa819('0x32'),_0x36758b),'Phone':_0x36758b};if(_0x13e095['moduleCreate']){if(_0x13e095[_0xa819('0x33')]===_0xa819('0x28')){logger[_0xa819('0x1f')](_0xa819('0x34'),_0x36758b,_0x13e095[_0xa819('0x33')]);}else if(_0x13e095[_0xa819('0x33')]===_0xa819('0x29')&&_0x13e095[_0xa819('0xf')]===_0xa819('0x10')){logger[_0xa819('0x1f')](_0xa819('0x34'),_0x36758b,_0x13e095['moduleCreate']);_0x166bde[_0xa819('0x35')]=_0xa819('0x36');}else{return null;}}return _0x4db482[_0xa819('0x19')](_[_0xa819('0x37')](_0x13e095['moduleCreate']))['create'](_0x166bde);}});}function getCustomFields(_0x3132a9,_0x5399b8){var _0x39e8ad={};if(_0x3132a9['length']>0x0){_[_0xa819('0x38')](_0x3132a9,function(_0x3f52b8){if(_0x3f52b8[_0xa819('0x39')]===_0xa819('0x3a')&&_0x3f52b8[_0xa819('0x3b')]){_0x39e8ad[_0x3f52b8[_0xa819('0x3b')]]=_0x3f52b8[_0xa819('0x3c')][_0xa819('0x3d')]();}else if(_0x3f52b8['type']===_0xa819('0x3e')&&_0x3f52b8[_0xa819('0x3f')]&&_0x3f52b8[_0xa819('0x3b')]){_0x5399b8[_0x3f52b8[_0xa819('0x3f')]]&&(_0x39e8ad[_0x3f52b8[_0xa819('0x3b')]]=_0x5399b8[_0x3f52b8[_0xa819('0x3f')]]['toString']());}else if(_0x3f52b8[_0xa819('0x39')]===_0xa819('0x40')&&_0x3f52b8[_0xa819('0x41')]&&_0x3f52b8['Variable'][_0xa819('0x42')]&&_0x3f52b8[_0xa819('0x3b')]){_0x5399b8[_0x3f52b8[_0xa819('0x41')]['name'][_0xa819('0x43')]()]&&(_0x39e8ad[_0x3f52b8['idField']]=_0x5399b8[_0x3f52b8[_0xa819('0x41')][_0xa819('0x42')][_0xa819('0x43')]()]['toString']());}});}return _0x39e8ad;}function getConnection(_0x3ac5bd){var _0x103012=_0x3ac5bd[_0xa819('0x44')][_0xa819('0x45')](_0x3ac5bd[_0xa819('0x46')]);var _0xef980b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3ac5bd['remoteUri']||'https://login.salesforce.com','clientId':_0x3ac5bd[_0xa819('0x47')],'clientSecret':_0x3ac5bd[_0xa819('0x48')]}});return _0xef980b[_0xa819('0x49')](_0x3ac5bd[_0xa819('0x4a')],_0x103012)['then'](function(){logger[_0xa819('0x1f')]('Connection\x20established.');return _0xef980b;});}exports[_0xa819('0x4b')]=function(_0x2bcc8e,_0x527062,_0x53872f,_0xde151c,_0x47225f,_0xd7b6f6){var _0x2c0b24,_0x6ab6e5,_0x36282c,_0x155fcc;_0xd7b6f6[_0xa819('0x4c')]=intUtil[_0xa819('0x4d')](_0xd7b6f6[_0xa819('0x4c')]);_0xd7b6f6['remoteUri']=intUtil[_0xa819('0x4d')](_0xd7b6f6[_0xa819('0x4e')]);if(_0x47225f&&_0x47225f['monitor_format']){logger['info'](_0xa819('0x4f'),_0xa819('0x50'));_0x527062[_0xa819('0x51')]=util[_0xa819('0x31')](_0xa819('0x52'),_0xd7b6f6[_0xa819('0x4c')],_0x527062[_0xa819('0x53')],md5(_0x527062[_0xa819('0x53')]));}else{_0x527062[_0xa819('0x51')]='';}return getConnection(_0xd7b6f6)['then'](function(_0x1d2bbb){_0x155fcc=_0x1d2bbb;return getUser(_0xd7b6f6,_0xde151c[_0xa819('0x54')],_0x155fcc);})[_0xa819('0x1b')](function(_0x2236a8){_0x2c0b24=_0x2236a8;return getEndUser(_0xd7b6f6,_0x53872f,_0x527062[_0xa819('0x55')],_0x527062['calleridnum'],_0x155fcc);})[_0xa819('0x1b')](function(_0x2a04d1){_0x6ab6e5=_0x2a04d1;return getTicket(_0xd7b6f6,_0x2c0b24,_0x6ab6e5,_0x53872f,_0x527062,_0x53872f['Fields'],_0x155fcc,_0xa819('0x4b'));})[_0xa819('0x1b')](function(_0xd2f0){_0x36282c=_0xd2f0;logger[_0xa819('0x1f')](_0xa819('0x56'),_0x36282c['id']);logger[_0xa819('0x1f')](_0xa819('0x57'),_0x36282c['id'],_0xde151c[_0xa819('0x42')],_0xd7b6f6['type']);switch(_0xd7b6f6['type']){case'integrationTab':emit(util[_0xa819('0x31')](_0xa819('0x58'),_0xde151c[_0xa819('0x42')]),_0xa819('0x59'),{'recordId':_0x36282c['id']});break;case _0xa819('0x5a'):emit(util['format'](_0xa819('0x58'),_0xde151c[_0xa819('0x42')]),_0xa819('0x5b'),{'uri':util[_0xa819('0x31')]('%s/%s/e',_0x155fcc[_0xa819('0x5c')],_0x36282c['id'])});break;default:logger[_0xa819('0x5d')](_0xa819('0x5e'));}})['catch'](function(_0x1d992f){logger[_0xa819('0x5d')](_0xa819('0x4f'),JSON[_0xa819('0x5f')](_0x1d992f));});};exports[_0xa819('0x60')]=function(_0xd392c7,_0x4ade13,_0x10244e,_0xa91b09,_0x285aa8,_0x501112,_0x1e8f81){var _0x2d84e6,_0x3abf39,_0x2c6d18,_0x13286d;_0x501112['serverUrl']=intUtil[_0xa819('0x4d')](_0x501112['serverUrl']);_0x501112['remoteUri']=intUtil[_0xa819('0x4d')](_0x501112['remoteUri']);if(_0x1e8f81&&_0x1e8f81[_0xa819('0x61')]&&_0x1e8f81[_0xa819('0x61')]!=='none'){logger['info'](_0xa819('0x62'),_0xa819('0x50'));_0x4ade13[_0xa819('0x51')]=util['format'](_0xa819('0x52'),_0x501112[_0xa819('0x4c')],_0x4ade13['uniqueid'],md5(_0x4ade13[_0xa819('0x53')]));}return getConnection(_0x501112)['then'](function(_0x927804){_0x13286d=_0x927804;return getUser(_0x501112,_0xa91b09[_0xa819('0x54')],_0x13286d);})[_0xa819('0x1b')](function(_0x4235e0){_0x2d84e6=_0x4235e0;return getEndUser(_0x501112,_0x10244e,_0x4ade13[_0xa819('0x63')],_0x4ade13[_0xa819('0x64')],_0x13286d);})['then'](function(_0x98cec3){_0x3abf39=_0x98cec3;return getTicket(_0x501112,_0x2d84e6,_0x3abf39,_0x10244e,_0x4ade13,_0x10244e[_0xa819('0x65')],_0x13286d,'outbound');})['then'](function(_0x1e1f2d){_0x2c6d18=_0x1e1f2d;logger[_0xa819('0x1f')](_0xa819('0x66'),_0x2c6d18['id']);logger['info'](_0xa819('0x67'),_0x2c6d18['id'],_0xa91b09[_0xa819('0x42')],_0x501112[_0xa819('0x39')]);switch(_0x501112[_0xa819('0x39')]){case _0xa819('0x68'):emit(util['format'](_0xa819('0x58'),_0xa91b09[_0xa819('0x42')]),'trigger:salesforce:display',{'recordId':_0x2c6d18['id']});break;case'newTab':emit(util[_0xa819('0x31')](_0xa819('0x58'),_0xa91b09['name']),_0xa819('0x5b'),{'uri':util[_0xa819('0x31')](_0xa819('0x69'),_0x13286d[_0xa819('0x5c')],_0x2c6d18['id'])});break;default:logger[_0xa819('0x5d')](_0xa819('0x62'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xa819('0x6a')](function(_0x147b5c){logger['error'](_0xa819('0x62'),JSON[_0xa819('0x5f')](_0x147b5c));});};exports[_0xa819('0x6b')]=function(_0x6b34d4,_0x510d21,_0x312551,_0x283602,_0x4c4c1d,_0x5a5929){var _0x4c6087,_0x41d060,_0x5db221,_0x2d7897;_0x5a5929['serverUrl']=intUtil[_0xa819('0x4d')](_0x5a5929[_0xa819('0x4c')]);_0x5a5929[_0xa819('0x4e')]=intUtil[_0xa819('0x4d')](_0x5a5929[_0xa819('0x4e')]);if(_0x4c4c1d&&_0x4c4c1d[_0xa819('0x6c')]){logger['info']('['+_0x510d21['lastevent'][_0xa819('0x6d')]()+']',_0xa819('0x50'));_0x510d21[_0xa819('0x51')]=util[_0xa819('0x31')](_0xa819('0x52'),_0x5a5929[_0xa819('0x4c')],_0x510d21[_0xa819('0x53')],md5(_0x510d21[_0xa819('0x53')]));}else{_0x510d21[_0xa819('0x51')]='';}return getConnection(_0x5a5929)['then'](function(_0x15e2e1){_0x2d7897=_0x15e2e1;if(!_[_0xa819('0x17')](_0x283602)){return getUser(_0x5a5929,_0x283602[_0xa819('0x42')],_0x2d7897);}else{return getUser(_0x5a5929,null,_0x2d7897);}})[_0xa819('0x1b')](function(_0x5c224c){_0x4c6087=_0x5c224c;return getEndUser(_0x5a5929,_0x312551,_0x510d21[_0xa819('0x55')],_0x510d21['calleridnum'],_0x2d7897);})['then'](function(_0x477b87){_0x41d060=_0x477b87;return getTicket(_0x5a5929,_0x4c6087,_0x41d060,_0x312551,_0x510d21,_0x312551[_0xa819('0x65')],_0x2d7897);})[_0xa819('0x1b')](function(_0x5b70c9){_0x5db221=_0x5b70c9;logger[_0xa819('0x1f')]('['+_0x510d21['lastevent'][_0xa819('0x6d')]()+_0xa819('0x6e'),_0x5db221['id']);logger[_0xa819('0x1f')]('['+_0x510d21['lastevent'][_0xa819('0x6d')]()+_0xa819('0x6f'),_0x5a5929[_0xa819('0x39')]);})[_0xa819('0x6a')](function(_0x29ffda){logger['error']('['+_0x510d21['lastevent']['toUpperCase']()+']',JSON[_0xa819('0x5f')](_0x29ffda));});}; \ No newline at end of file +var _0x7834=['./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','socket.io-emitter','emit','Task','assign','getString','Descriptions','WhoId','ticketType','Case','Subjects','ContactId','sobject','create','isNil','User','execute','then','length','find','info','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','Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','stringify','unmanaged','toUpperCase','recordingURL','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','jsforce','util','ioredis'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7834,0x13f));var _0x4783=function(_0x5498b8,_0x3fd10c){_0x5498b8=_0x5498b8-0x0;var _0x13c31c=_0x7834[_0x5498b8];return _0x13c31c;};'use strict';var _=require(_0x4783('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4783('0x1'));var md5=require('md5');var jsforce=require(_0x4783('0x2'));var util=require(_0x4783('0x3'));var Redis=require(_0x4783('0x4'));var intUtil=require(_0x4783('0x5'));var config=require(_0x4783('0x6'));var logger=require(_0x4783('0x7'))(_0x4783('0x8'));config['redis']=_[_0x4783('0x9')](config[_0x4783('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x4783('0xb'))(new Redis(config[_0x4783('0xa')]));function emit(_0x36c0a7,_0x112a19,_0xc8b2d7){io['to'](_0x36c0a7)[_0x4783('0xc')](_0x112a19,_0xc8b2d7);}function getTicket(_0x5caa81,_0xf75e9e,_0x2e2f83,_0x2da940,_0x1e558e,_0x6cfdfb,_0x1eaeea,_0x10c184){var _0x5b8428={};if(_0x2da940['ticketType']===_0x4783('0xd')){_0x5b8428=Object[_0x4783('0xe')]({},{'OwnerId':_0xf75e9e['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4783('0xf')](_0x2da940['Subjects'],_0x1e558e,'\x20'),'Description':intUtil[_0x4783('0xf')](_0x2da940[_0x4783('0x10')],_0x1e558e,'\x0a')},getCustomFields(_0x6cfdfb,_0x1e558e));if(_0x2e2f83){_0x5b8428[_0x4783('0x11')]=_0x2e2f83['id'];}}else if(_0x2da940[_0x4783('0x12')]===_0x4783('0x13')){_0x5b8428=Object['assign']({},{'OwnerId':_0xf75e9e['id'],'Subject':intUtil[_0x4783('0xf')](_0x2da940[_0x4783('0x14')],_0x1e558e,'\x20'),'Description':intUtil[_0x4783('0xf')](_0x2da940[_0x4783('0x10')],_0x1e558e,'\x0a')},getCustomFields(_0x6cfdfb,_0x1e558e));if(_0x2e2f83){_0x5b8428[_0x4783('0x15')]=_0x2e2f83['id'];}}return _0x1eaeea[_0x4783('0x16')](_0x2da940[_0x4783('0x12')])[_0x4783('0x17')](_0x5b8428);}function getUser(_0x1ccf8a,_0x28c979,_0x1bcc3d){if(!_[_0x4783('0x18')](_0x28c979)&&intUtil['validateEmail'](_0x28c979)){var _0x465ed7={'Email':_0x28c979};var _0xcda581={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1bcc3d['sobject'](_0x4783('0x19'))['find'](_0x465ed7,_0xcda581)[_0x4783('0x1a')]()[_0x4783('0x1b')](function(_0x396903){if(_0x396903[_0x4783('0x1c')]){var _0x1b5e90=_[_0x4783('0x1d')](_0x396903,function(_0x3a8220){return _0x3a8220['Email']===_0x28c979;});if(_0x1b5e90){logger[_0x4783('0x1e')]('Agent\x20%s\x20found.',_0x28c979);return BPromise[_0x4783('0x1f')]({'id':_0x1b5e90['Id'],'name':_0x1b5e90[_0x4783('0x20')]});}}else{logger[_0x4783('0x1e')](_0x4783('0x21'),_0x28c979);return _0x1bcc3d[_0x4783('0x22')]()['then'](function(_0x2633e6){return BPromise[_0x4783('0x1f')]({'id':_0x2633e6[_0x4783('0x23')],'name':_0x2633e6[_0x4783('0x24')]});});}});}else{logger[_0x4783('0x1e')](_0x4783('0x21'),_0x28c979);return _0x1bcc3d[_0x4783('0x22')]()['then'](function(_0x22d276){return BPromise[_0x4783('0x1f')]({'id':_0x22d276['user_id'],'name':_0x22d276['display_name']});});}}function getEndUser(_0x1d3e22,_0xb5f71c,_0x4ead16,_0x106b09,_0x532961){var _0x5c5a6a={'Phone':_0x106b09};var _0x5368d3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0xb5f71c['ticketType']===_0x4783('0xd')){logger['info'](_0x4783('0x25'),_0x106b09,_0xb5f71c[_0x4783('0x26')]);switch(_0xb5f71c[_0x4783('0x26')]){case _0x4783('0x27'):return _0x532961[_0x4783('0x16')]('Contact')[_0x4783('0x1d')](_0x5c5a6a,_0x5368d3)[_0x4783('0x1a')]()['then'](function(_0x1020ac){if(_0x1020ac&&_0x1020ac[_0x4783('0x1c')]){return _0x1020ac;}else{return _0x532961['sobject'](_0x4783('0x28'))['find'](_0x5c5a6a,_0x5368d3);}});case _0x4783('0x29'):return _0x532961['sobject'](_0x4783('0x2a'))[_0x4783('0x1d')](_0x5c5a6a,_0x5368d3)['execute']();case _0x4783('0x2b'):return _0x532961[_0x4783('0x16')](_0x4783('0x28'))[_0x4783('0x1d')](_0x5c5a6a,_0x5368d3);default:return null;}}else if(_0xb5f71c['ticketType']===_0x4783('0x13')){logger[_0x4783('0x1e')](_0x4783('0x25'),_0x106b09,_0x4783('0x29'));return _0x532961['sobject'](_0x4783('0x2a'))[_0x4783('0x1d')](_0x5c5a6a,_0x5368d3)['execute']();}})[_0x4783('0x1b')](function(_0x36894e){if(_0x36894e&&_0x36894e[_0x4783('0x1c')]){var _0x57ade4=_[_0x4783('0x1d')](_0x36894e,function(_0x4e6902){return _0x4e6902[_0x4783('0x2c')]===_0x106b09;});if(_0x57ade4){return BPromise['resolve']({'id':_0x57ade4['Id'],'name':_0x57ade4['Name'],'phone':_0x57ade4[_0x4783('0x2c')]});}}})[_0x4783('0x1b')](function(_0x43437e){if(_0x43437e){logger['info'](_0x4783('0x2d'),_0x106b09);return BPromise['resolve'](_0x43437e);}else{logger[_0x4783('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x106b09);var _0x2f476e={'LastName':_0x4ead16!==_0x4783('0x2e')?_0x4ead16:util[_0x4783('0x2f')]('Caller\x20-\x20%s',_0x106b09),'Phone':_0x106b09};if(_0xb5f71c[_0x4783('0x30')]){if(_0xb5f71c['moduleCreate']===_0x4783('0x29')){logger[_0x4783('0x1e')](_0x4783('0x31'),_0x106b09,_0xb5f71c[_0x4783('0x30')]);}else if(_0xb5f71c['moduleCreate']===_0x4783('0x2b')&&_0xb5f71c[_0x4783('0x12')]===_0x4783('0xd')){logger['info'](_0x4783('0x31'),_0x106b09,_0xb5f71c[_0x4783('0x30')]);_0x2f476e[_0x4783('0x32')]='No\x20Company';}else{return null;}}return _0x532961['sobject'](_[_0x4783('0x33')](_0xb5f71c[_0x4783('0x30')]))[_0x4783('0x17')](_0x2f476e);}});}function getCustomFields(_0xbb6755,_0x91f1a5){var _0x158fc8={};if(_0xbb6755[_0x4783('0x1c')]>0x0){_[_0x4783('0x34')](_0xbb6755,function(_0x135dd7){if(_0x135dd7['type']==='string'&&_0x135dd7[_0x4783('0x35')]){_0x158fc8[_0x135dd7['idField']]=_0x135dd7[_0x4783('0x36')][_0x4783('0x37')]();}else if(_0x135dd7[_0x4783('0x38')]===_0x4783('0x39')&&_0x135dd7['variableName']&&_0x135dd7[_0x4783('0x35')]){_0x91f1a5[_0x135dd7[_0x4783('0x3a')]]&&(_0x158fc8[_0x135dd7[_0x4783('0x35')]]=_0x91f1a5[_0x135dd7['variableName']]['toString']());}else if(_0x135dd7[_0x4783('0x38')]===_0x4783('0x3b')&&_0x135dd7['Variable']&&_0x135dd7[_0x4783('0x3c')]['name']&&_0x135dd7[_0x4783('0x35')]){_0x91f1a5[_0x135dd7[_0x4783('0x3c')][_0x4783('0x3d')][_0x4783('0x3e')]()]&&(_0x158fc8[_0x135dd7[_0x4783('0x35')]]=_0x91f1a5[_0x135dd7[_0x4783('0x3c')][_0x4783('0x3d')][_0x4783('0x3e')]()]['toString']());}});}return _0x158fc8;}function getConnection(_0x5dcf8c){var _0x3523a4=_0x5dcf8c['password'][_0x4783('0x3f')](_0x5dcf8c[_0x4783('0x40')]);var _0xe12c47=new jsforce[(_0x4783('0x41'))]({'oauth2':{'loginUrl':_0x5dcf8c[_0x4783('0x42')]||_0x4783('0x43'),'clientId':_0x5dcf8c[_0x4783('0x44')],'clientSecret':_0x5dcf8c[_0x4783('0x45')]}});return _0xe12c47[_0x4783('0x46')](_0x5dcf8c[_0x4783('0x47')],_0x3523a4)[_0x4783('0x1b')](function(){logger[_0x4783('0x1e')]('Connection\x20established.');return _0xe12c47;});}exports['queue']=function(_0xb416de,_0x200fdc,_0x5f13c7,_0x5f4e85,_0x19d037,_0x6ee3cf){var _0x4bf93c,_0x5b248f,_0x3dbd65,_0x56d50c;_0x6ee3cf[_0x4783('0x48')]=intUtil[_0x4783('0x49')](_0x6ee3cf['serverUrl']);_0x6ee3cf['remoteUri']=intUtil['stripTrailingSlash'](_0x6ee3cf[_0x4783('0x42')]);if(_0x19d037&&_0x19d037[_0x4783('0x4a')]){logger['info'](_0x4783('0x4b'),_0x4783('0x4c'));_0x200fdc['recordingURL']=util[_0x4783('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6ee3cf[_0x4783('0x48')],_0x200fdc['uniqueid'],md5(_0x200fdc[_0x4783('0x4d')]));}else{_0x200fdc['recordingURL']='';}return getConnection(_0x6ee3cf)[_0x4783('0x1b')](function(_0x4974f6){_0x56d50c=_0x4974f6;return getUser(_0x6ee3cf,_0x5f4e85['email'],_0x56d50c);})['then'](function(_0x125c9d){_0x4bf93c=_0x125c9d;return getEndUser(_0x6ee3cf,_0x5f13c7,_0x200fdc['calleridname'],_0x200fdc[_0x4783('0x4e')],_0x56d50c);})[_0x4783('0x1b')](function(_0x1104f8){_0x5b248f=_0x1104f8;return getTicket(_0x6ee3cf,_0x4bf93c,_0x5b248f,_0x5f13c7,_0x200fdc,_0x5f13c7[_0x4783('0x4f')],_0x56d50c,_0x4783('0x50'));})[_0x4783('0x1b')](function(_0x5517e0){_0x3dbd65=_0x5517e0;logger['info'](_0x4783('0x51'),_0x3dbd65['id']);logger[_0x4783('0x1e')](_0x4783('0x52'),_0x3dbd65['id'],_0x5f4e85[_0x4783('0x3d')],_0x6ee3cf['type']);switch(_0x6ee3cf[_0x4783('0x38')]){case _0x4783('0x53'):emit(util[_0x4783('0x2f')](_0x4783('0x54'),_0x5f4e85[_0x4783('0x3d')]),_0x4783('0x55'),{'recordId':_0x3dbd65['id']});break;case _0x4783('0x56'):emit(util['format']('user:%s',_0x5f4e85[_0x4783('0x3d')]),_0x4783('0x57'),{'uri':util[_0x4783('0x2f')](_0x4783('0x58'),_0x56d50c[_0x4783('0x59')],_0x3dbd65['id'])});break;default:logger[_0x4783('0x5a')](_0x4783('0x5b'));}})[_0x4783('0x5c')](function(_0x3cb0e9){logger[_0x4783('0x5a')](_0x4783('0x4b'),JSON['stringify'](_0x3cb0e9));});};exports[_0x4783('0x5d')]=function(_0xf7c06d,_0x3a7305,_0x3cd7aa,_0x29dbef,_0x2be320,_0x289efc,_0x59abc1){var _0x2b23bc,_0x366ade,_0x5cf125,_0x639bf6;_0x289efc[_0x4783('0x48')]=intUtil[_0x4783('0x49')](_0x289efc['serverUrl']);_0x289efc['remoteUri']=intUtil[_0x4783('0x49')](_0x289efc[_0x4783('0x42')]);if(_0x59abc1&&_0x59abc1[_0x4783('0x5e')]&&_0x59abc1[_0x4783('0x5e')]!=='none'){logger[_0x4783('0x1e')](_0x4783('0x5f'),_0x4783('0x4c'));_0x3a7305['recordingURL']=util[_0x4783('0x2f')](_0x4783('0x60'),_0x289efc[_0x4783('0x48')],_0x3a7305['uniqueid'],md5(_0x3a7305[_0x4783('0x4d')]));}return getConnection(_0x289efc)[_0x4783('0x1b')](function(_0x5b9eb7){_0x639bf6=_0x5b9eb7;return getUser(_0x289efc,_0x29dbef['email'],_0x639bf6);})[_0x4783('0x1b')](function(_0x10de85){_0x2b23bc=_0x10de85;return getEndUser(_0x289efc,_0x3cd7aa,_0x3a7305[_0x4783('0x61')],_0x3a7305[_0x4783('0x62')],_0x639bf6);})[_0x4783('0x1b')](function(_0x40d4e0){_0x366ade=_0x40d4e0;return getTicket(_0x289efc,_0x2b23bc,_0x366ade,_0x3cd7aa,_0x3a7305,_0x3cd7aa[_0x4783('0x4f')],_0x639bf6,'outbound');})['then'](function(_0x2a7296){_0x5cf125=_0x2a7296;logger[_0x4783('0x1e')](_0x4783('0x63'),_0x5cf125['id']);logger['info'](_0x4783('0x64'),_0x5cf125['id'],_0x29dbef[_0x4783('0x3d')],_0x289efc[_0x4783('0x38')]);switch(_0x289efc[_0x4783('0x38')]){case'integrationTab':emit(util[_0x4783('0x2f')](_0x4783('0x54'),_0x29dbef['name']),_0x4783('0x55'),{'recordId':_0x5cf125['id']});break;case _0x4783('0x56'):emit(util['format']('user:%s',_0x29dbef[_0x4783('0x3d')]),_0x4783('0x57'),{'uri':util[_0x4783('0x2f')](_0x4783('0x58'),_0x639bf6['instanceUrl'],_0x5cf125['id'])});break;default:logger['error'](_0x4783('0x5f'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x4783('0x5c')](function(_0x7422e7){logger[_0x4783('0x5a')](_0x4783('0x5f'),JSON[_0x4783('0x65')](_0x7422e7));});};exports[_0x4783('0x66')]=function(_0x14f903,_0x76e335,_0x20c9ef,_0x4fe4ae,_0x19ce5f,_0x26b908){var _0x477e77,_0xf39703,_0x4985cd,_0x5d905b;_0x26b908['serverUrl']=intUtil[_0x4783('0x49')](_0x26b908[_0x4783('0x48')]);_0x26b908[_0x4783('0x42')]=intUtil['stripTrailingSlash'](_0x26b908['remoteUri']);if(_0x19ce5f&&_0x19ce5f[_0x4783('0x4a')]){logger[_0x4783('0x1e')]('['+_0x76e335['lastevent'][_0x4783('0x67')]()+']',_0x4783('0x4c'));_0x76e335['recordingURL']=util[_0x4783('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x26b908[_0x4783('0x48')],_0x76e335['uniqueid'],md5(_0x76e335[_0x4783('0x4d')]));}else{_0x76e335[_0x4783('0x68')]='';}return getConnection(_0x26b908)[_0x4783('0x1b')](function(_0x361280){_0x5d905b=_0x361280;if(!_[_0x4783('0x18')](_0x4fe4ae)){return getUser(_0x26b908,_0x4fe4ae[_0x4783('0x3d')],_0x5d905b);}else{return getUser(_0x26b908,null,_0x5d905b);}})['then'](function(_0x3b6826){_0x477e77=_0x3b6826;return getEndUser(_0x26b908,_0x20c9ef,_0x76e335['calleridname'],_0x76e335[_0x4783('0x4e')],_0x5d905b);})[_0x4783('0x1b')](function(_0x4633aa){_0xf39703=_0x4633aa;return getTicket(_0x26b908,_0x477e77,_0xf39703,_0x20c9ef,_0x76e335,_0x20c9ef[_0x4783('0x4f')],_0x5d905b);})[_0x4783('0x1b')](function(_0x18a17a){_0x4985cd=_0x18a17a;logger[_0x4783('0x1e')]('['+_0x76e335[_0x4783('0x69')]['toUpperCase']()+_0x4783('0x6a'),_0x4985cd['id']);logger[_0x4783('0x1e')]('['+_0x76e335[_0x4783('0x69')][_0x4783('0x67')]()+_0x4783('0x6b'),_0x26b908['type']);})['catch'](function(_0x319e18){logger['error']('['+_0x76e335['lastevent'][_0x4783('0x67')]()+']',JSON[_0x4783('0x65')](_0x319e18));});}; \ 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 2a6cbc5..0be0a38 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 _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x33d7cc,_0x3925bc){var _0x1ff98d=function(_0x19daef){while(--_0x19daef){_0x33d7cc['push'](_0x33d7cc['shift']());}};_0x1ff98d(++_0x3925bc);}(_0x814b,0x1a2));var _0xb814=function(_0x5e8c0f,_0x1f20d9){_0x5e8c0f=_0x5e8c0f-0x0;var _0x568dbe=_0x814b[_0x5e8c0f];return _0x568dbe;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'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(_0x555e5c,_0x3adc08){var _0x4104a1=function(_0x38af15){while(--_0x38af15){_0x555e5c['push'](_0x555e5c['shift']());}};_0x4104a1(++_0x3adc08);}(_0x326f,0xd1));var _0xf326=function(_0x1ef7ff,_0x311060){_0x1ef7ff=_0x1ef7ff-0x0;var _0x3c8b3=_0x326f[_0x1ef7ff];return _0x3c8b3;};'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 1dc6562..3c6722e 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 _0x13be=['The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','outbound','uri','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','calleridnum','contacts','error','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','slice','duration_hours','parent_id','Contacts','forEach','variableName','push','idField','set_entry','stringify','Calls','format','Basic\x20%s','toString','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','customField','nameField','toLowerCase','content','type','custom_fields','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x13be,0x175));var _0xe13b=function(_0x4bd33b,_0x2b7fbe){_0x4bd33b=_0x4bd33b-0x0;var _0x5e2048=_0x13be[_0x4bd33b];return _0x5e2048;};'use strict';var _=require('lodash');var rp=require(_0xe13b('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xe13b('0x1'));var Redis=require(_0xe13b('0x2'));var intUtil=require(_0xe13b('0x3'));var config=require(_0xe13b('0x4'));var logger=require(_0xe13b('0x5'))(_0xe13b('0x6'));config['redis']=_[_0xe13b('0x7')](config[_0xe13b('0x8')],{'host':_0xe13b('0x9'),'port':0x18eb});var io=require(_0xe13b('0xa'))(new Redis(config[_0xe13b('0x8')]));var def={'method':_0xe13b('0xb'),'json':!![]};function emit(_0x162b8e,_0x33b182,_0x38a756){io['to'](_0x162b8e)['emit'](_0x33b182,_0x38a756);}function getTicket(_0x183f7a,_0x5d3b92,_0x59a45c,_0x3e245a,_0x18ad8b,_0x364ff0,_0x52703f,_0x4bb341){logger[_0xe13b('0xc')](_0xe13b('0xd'));var _0x6b5662=new Date();var _0x47c2fe=[{'name':_0xe13b('0xe'),'value':intUtil['getString'](_0x3e245a[_0xe13b('0xf')],_0x18ad8b,'\x20')},{'name':_0xe13b('0x10'),'value':_0x5d3b92['id']},{'name':_0xe13b('0x11'),'value':_0x5d3b92['id']},{'name':'description','value':intUtil[_0xe13b('0x12')](_0x3e245a[_0xe13b('0x13')],_0x18ad8b,'\x0a')},{'name':_0xe13b('0x14'),'value':_0x6b5662['toISOString']()[_0xe13b('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0xe13b('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xe13b('0x17'),'value':_0x59a45c['id']},{'name':'parent_type','value':_0xe13b('0x18')},{'name':'parent_name','value':_0x59a45c[_0xe13b('0xe')]},{'name':'direction','value':_0x4bb341}];if(_0x364ff0['length']){_[_0xe13b('0x19')](_0x364ff0,function(_0x34c990){if(_0x18ad8b[_0x34c990[_0xe13b('0x1a')]]){_0x47c2fe[_0xe13b('0x1b')]({'name':_0x34c990[_0xe13b('0x1c')],'value':_0x18ad8b[_0x34c990[_0xe13b('0x1a')]]});}});}return request({'form':{'method':_0xe13b('0x1d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe13b('0x1e')]({'session':_0x52703f['id'],'module_name':_0xe13b('0x1f'),'name_value_list':_0x47c2fe})}});}function getAuth(_0x4fb25d){return util[_0xe13b('0x20')](_0xe13b('0x21'),new Buffer(_0x4fb25d['apiKey']+':X')[_0xe13b('0x22')]('base64'));}function getServerInfo(_0x31d86a){return request({'form':{'method':_0xe13b('0x23'),'input_type':_0xe13b('0x24'),'response_type':_0xe13b('0x24'),'rest_data':JSON[_0xe13b('0x1e')]({'session':_0x31d86a['id']})}});}function getUser(_0x528844,_0x4a0b9b,_0x7de307){if(!_[_0xe13b('0x25')](_0x4a0b9b)){logger[_0xe13b('0xc')](_0xe13b('0x26'),_0x4a0b9b);return request({'form':{'method':_0xe13b('0x27'),'input_type':_0xe13b('0x24'),'response_type':_0xe13b('0x24'),'rest_data':JSON[_0xe13b('0x1e')]({'session':_0x7de307['id'],'module_name':_0xe13b('0x28'),'query':util[_0xe13b('0x20')](_0xe13b('0x29'),_0x4a0b9b),'order_by':'','offset':'0','select_fields':['id',_0xe13b('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe13b('0x2a')](function(_0x4fd539){if(_0x4fd539[_0xe13b('0x2b')][_0xe13b('0x2c')]){var _0x4f553e=_['find'](_0x4fd539[_0xe13b('0x2b')],function(_0xebbdbe){return _0xebbdbe['name_value_list']['user_name'][_0xe13b('0x2d')]===_0x4a0b9b;});if(_0x4f553e){logger[_0xe13b('0xc')](_0xe13b('0x2e'));return BPromise[_0xe13b('0x2f')]({'id':_0x4f553e[_0xe13b('0x30')]['id'][_0xe13b('0x2d')],'name':_0x4f553e[_0xe13b('0x30')]['name'][_0xe13b('0x2d')]});}}logger[_0xe13b('0xc')](_0xe13b('0x31'));return BPromise[_0xe13b('0x2f')]({'id':_0x7de307[_0xe13b('0x30')]['user_id']['value'],'name':_0x7de307[_0xe13b('0x30')][_0xe13b('0x32')]['value']});});}else{logger[_0xe13b('0xc')](_0xe13b('0x33'));return BPromise[_0xe13b('0x2f')]({'id':_0x7de307[_0xe13b('0x30')][_0xe13b('0x34')][_0xe13b('0x2d')],'name':_0x7de307[_0xe13b('0x30')][_0xe13b('0x32')][_0xe13b('0x2d')]});}}function getEndUser(_0x28c699,_0x52d954,_0x4895b5,_0x153c3b){logger[_0xe13b('0xc')]('Searching\x20enduser\x20with\x20phone',_0x4895b5);return request({'form':{'method':_0xe13b('0x27'),'input_type':_0xe13b('0x24'),'response_type':_0xe13b('0x24'),'rest_data':JSON[_0xe13b('0x1e')]({'session':_0x153c3b['id'],'module_name':_0xe13b('0x18'),'query':util[_0xe13b('0x20')](_0xe13b('0x35'),_0x4895b5),'order_by':'','offset':'0','select_fields':['id',_0xe13b('0xe'),_0xe13b('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe13b('0x2a')](function(_0x474a02){if(_0x474a02[_0xe13b('0x2b')][_0xe13b('0x2c')]){var _0xf1ce9a=_['find'](_0x474a02[_0xe13b('0x2b')],function(_0x2e3952){return _0x2e3952[_0xe13b('0x30')][_0xe13b('0x36')][_0xe13b('0x2d')]===_0x4895b5;});if(_0xf1ce9a){logger[_0xe13b('0xc')](_0xe13b('0x37'));return BPromise[_0xe13b('0x2f')]({'id':_0xf1ce9a[_0xe13b('0x30')]['id'][_0xe13b('0x2d')],'name':_0xf1ce9a['name_value_list'][_0xe13b('0xe')][_0xe13b('0x2d')],'phone':_0xf1ce9a[_0xe13b('0x30')][_0xe13b('0x36')][_0xe13b('0x2d')]});}}else{logger['info'](_0xe13b('0x38'));return request({'form':{'method':'set_entry','input_type':_0xe13b('0x24'),'response_type':_0xe13b('0x24'),'rest_data':JSON[_0xe13b('0x1e')]({'session':_0x153c3b['id'],'module_name':_0xe13b('0x18'),'name_value_list':[{'name':_0xe13b('0x39'),'value':_0x52d954!==_0xe13b('0x3a')?_0x52d954:util[_0xe13b('0x20')](_0xe13b('0x3b'),_0x4895b5)},{'name':'phone_home','value':_0x4895b5}]})}})['then'](function(_0x4c5053){logger[_0xe13b('0xc')](_0xe13b('0x3c'));return BPromise[_0xe13b('0x2f')]({'id':_0x4c5053['id'],'name':_0x4c5053[_0xe13b('0x2b')][_0xe13b('0x39')][_0xe13b('0x2d')],'phone':_0x4c5053[_0xe13b('0x2b')][_0xe13b('0x36')]['value']});});}});}function request(_0x15f143){logger[_0xe13b('0x3d')](_0xe13b('0x3e'),JSON[_0xe13b('0x1e')](_0x15f143));return rp(_[_0xe13b('0x3f')](def,_0x15f143));}function getTags(_0x5f253f,_0x565ce1){var _0x2eeb17=[];if(_0x5f253f&&_0x5f253f[_0xe13b('0x2c')]>0x0){_0x2eeb17=_[_0xe13b('0x40')](_0x5f253f,_0x565ce1);}return _0x2eeb17;}function getCustomFields(_0x17ae08,_0x32d56c){var _0x55ae03=[];var _0x267255={'custom_fields':[]};if(_0x17ae08[_0xe13b('0x2c')]>0x0){_[_0xe13b('0x19')](_0x17ae08,function(_0x3bd81d){if(_0x3bd81d['type']===_0xe13b('0x41')&&_0x3bd81d['nameField']&&!_0x3bd81d[_0xe13b('0x42')]){_0x267255[_0x3bd81d[_0xe13b('0x43')][_0xe13b('0x44')]()]=_0x3bd81d[_0xe13b('0x45')]['toString']();}else if(_0x3bd81d[_0xe13b('0x46')]===_0xe13b('0x41')&&_0x3bd81d[_0xe13b('0x1c')]&&_0x3bd81d['customField']){_0x267255[_0xe13b('0x47')][_0xe13b('0x1b')]({'id':_0x3bd81d[_0xe13b('0x1c')],'value':_0x3bd81d[_0xe13b('0x45')][_0xe13b('0x22')]()});}else if(_0x3bd81d['type']==='variable'&&_0x3bd81d['variableName']&&_0x3bd81d[_0xe13b('0x1c')]&&_0x3bd81d[_0xe13b('0x42')]){_0x32d56c[_0x3bd81d[_0xe13b('0x1a')]]&&_0x267255['custom_fields']['push']({'id':_0x3bd81d['idField'],'value':_0x32d56c[_0x3bd81d[_0xe13b('0x1a')]][_0xe13b('0x22')]()});}else if(_0x3bd81d[_0xe13b('0x46')]==='customVariable'&&_0x3bd81d[_0xe13b('0x48')]&&_0x3bd81d[_0xe13b('0x48')][_0xe13b('0xe')]&&_0x3bd81d['idField']&&_0x3bd81d['customField']){_0x32d56c[_0x3bd81d[_0xe13b('0x48')][_0xe13b('0xe')][_0xe13b('0x44')]()]&&_0x267255[_0xe13b('0x47')][_0xe13b('0x1b')]({'id':_0x3bd81d[_0xe13b('0x1c')],'value':_0x32d56c[_0x3bd81d[_0xe13b('0x48')]['name'][_0xe13b('0x44')]()][_0xe13b('0x22')]()});}});}return _0x267255;}function getConnection(_0x555da3){return request({'method':'POST','form':{'method':_0xe13b('0x49'),'input_type':_0xe13b('0x24'),'response_type':_0xe13b('0x24'),'rest_data':JSON[_0xe13b('0x1e')]({'user_auth':{'user_name':_0x555da3['username'],'password':_0x555da3['password'],'encryption':_0xe13b('0x4a')},'application':_0xe13b('0x4b')})}})['then'](function(_0x29e9f1){var _0xa8ed75=_0x29e9f1;if(_0xa8ed75['id']){def[_0xe13b('0x4c')]=_0xa8ed75['id'];return BPromise['resolve'](_0xa8ed75);}else{throw new Error(util[_0xe13b('0x20')](_0xe13b('0x4d'),_0x555da3['id']));}});}function setRelationship(_0x30f5e6,_0x51207c,_0x35b0ae,_0x36ee08){return request({'form':{'method':_0xe13b('0x4e'),'input_type':_0xe13b('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x30f5e6['id'],'module_name':_0xe13b('0x1f'),'module_id':_0x35b0ae['id'],'link_field_name':_0x36ee08,'related_ids':[_0x51207c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe13b('0x4f')]=function(_0x28b4c2,_0x10aa4b,_0x27b70b,_0x57be2b,_0x21f560,_0x4aaf3e){var _0x1e5632,_0x20d6bd,_0x77856a,_0x58ca43;_0x4aaf3e['remoteUri']=intUtil[_0xe13b('0x50')](_0x4aaf3e[_0xe13b('0x51')]);_0x4aaf3e['serverUrl']=intUtil[_0xe13b('0x50')](_0x4aaf3e[_0xe13b('0x52')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x4aaf3e[_0xe13b('0x51')]);if(_0x21f560&&_0x21f560[_0xe13b('0x53')]){logger['info'](_0xe13b('0x54'),_0xe13b('0x55'));_0x10aa4b[_0xe13b('0x56')]=util[_0xe13b('0x20')](_0xe13b('0x57'),_0x4aaf3e[_0xe13b('0x52')],_0x10aa4b[_0xe13b('0x58')],md5(_0x10aa4b[_0xe13b('0x58')]));}else{_0x10aa4b[_0xe13b('0x56')]='';}return getConnection(_0x4aaf3e)[_0xe13b('0x2a')](function(_0x445e9c){_0x58ca43=_0x445e9c;return getUser(_0x4aaf3e,_0x57be2b[_0xe13b('0xe')],_0x58ca43);})[_0xe13b('0x2a')](function(_0x5b41d4){_0x1e5632=_0x5b41d4;logger[_0xe13b('0xc')](_0xe13b('0x59'),_0x1e5632['id']);return getEndUser(_0x4aaf3e,_0x10aa4b[_0xe13b('0x5a')],_0x10aa4b['calleridnum'],_0x58ca43);})[_0xe13b('0x2a')](function(_0x2da08b){_0x20d6bd=_0x2da08b;logger[_0xe13b('0xc')](_0xe13b('0x5b'),_0x20d6bd['id']);return getTicket(_0x4aaf3e,_0x1e5632,_0x20d6bd,_0x27b70b,_0x10aa4b,_0x27b70b[_0xe13b('0x5c')],_0x58ca43,_0xe13b('0x5d'));})['then'](function(_0x31c8da){_0x77856a=_0x31c8da;logger[_0xe13b('0xc')](_0xe13b('0x5e'));logger[_0xe13b('0xc')](_0xe13b('0x5f'),_0x77856a['id']);return setRelationship(_0x58ca43,_0x1e5632,_0x77856a,_0xe13b('0x60'));})[_0xe13b('0x2a')](function(){return setRelationship(_0x58ca43,_0x20d6bd,_0x77856a,'contacts');})['then'](function(){return getServerInfo(_0x58ca43);})[_0xe13b('0x2a')](function(_0x4f3f14){var _0x85852d=parseInt(_0x4f3f14['version'][_0xe13b('0x61')](0x0));var _0xae3cc0=util[_0xe13b('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4aaf3e[_0xe13b('0x51')],_0x77856a['id']);if(_0x85852d>0x6){_0xae3cc0=util[_0xe13b('0x20')](_0xe13b('0x62'),_0x4aaf3e[_0xe13b('0x51')],_0x77856a['id']);}logger[_0xe13b('0xc')](_0xe13b('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe13b('0x20')](_0xe13b('0x63'),_0x57be2b[_0xe13b('0xe')]),_0xe13b('0x64'),{'uri':_0xae3cc0});})[_0xe13b('0x65')](function(_0x5a8780){logger['error'](_0xe13b('0x54'),JSON[_0xe13b('0x1e')](_0x5a8780));});};exports[_0xe13b('0x66')]=function(_0x53a278,_0x59e7f6,_0x3b6564,_0x6581e7,_0x41a4e9,_0x11d313,_0x48621d){var _0x58dd5c,_0x2bdf76,_0x3c02f3,_0x1adaa7;_0x11d313[_0xe13b('0x51')]=intUtil[_0xe13b('0x50')](_0x11d313[_0xe13b('0x51')]);_0x11d313[_0xe13b('0x52')]=intUtil[_0xe13b('0x50')](_0x11d313[_0xe13b('0x52')]);def[_0xe13b('0x67')]=util['format']('%s/service/v4_1/rest.php',_0x11d313['remoteUri']);if(_0x48621d&&_0x48621d['recordingFormat']&&_0x48621d['recordingFormat']!==_0xe13b('0x68')){logger['info'](_0xe13b('0x69'),_0xe13b('0x55'));_0x59e7f6[_0xe13b('0x56')]=util[_0xe13b('0x20')](_0xe13b('0x57'),_0x11d313['serverUrl'],_0x59e7f6['uniqueid'],md5(_0x59e7f6[_0xe13b('0x58')]));}return getConnection(_0x11d313)[_0xe13b('0x2a')](function(_0x1f56a5){_0x1adaa7=_0x1f56a5;return getUser(_0x11d313,_0x6581e7[_0xe13b('0xe')],_0x1adaa7);})[_0xe13b('0x2a')](function(_0x5ea30c){_0x58dd5c=_0x5ea30c;logger['info']('The\x20User\x20ID\x20is:',_0x58dd5c['id']);return getEndUser(_0x11d313,_0x59e7f6[_0xe13b('0x6a')],_0x59e7f6[_0xe13b('0x6b')],_0x1adaa7);})['then'](function(_0x5bdc32){_0x2bdf76=_0x5bdc32;logger['info'](_0xe13b('0x5b'),_0x2bdf76['id']);return getTicket(_0x11d313,_0x58dd5c,_0x2bdf76,_0x3b6564,_0x59e7f6,_0x3b6564[_0xe13b('0x5c')],_0x1adaa7,'Outbound');})[_0xe13b('0x2a')](function(_0x7b9823){_0x3c02f3=_0x7b9823;logger[_0xe13b('0xc')](_0xe13b('0x5e'));logger[_0xe13b('0xc')](_0xe13b('0x5f'),_0x3c02f3['id']);return setRelationship(_0x1adaa7,_0x58dd5c,_0x3c02f3,'users');})[_0xe13b('0x2a')](function(){return setRelationship(_0x1adaa7,_0x2bdf76,_0x3c02f3,'contacts');})[_0xe13b('0x2a')](function(){return getServerInfo(_0x1adaa7);})[_0xe13b('0x2a')](function(_0x3e0ad6){var _0x119fa9=parseInt(_0x3e0ad6['version']['charAt'](0x0));var _0x3328b4=util[_0xe13b('0x20')](_0xe13b('0x6c'),_0x11d313[_0xe13b('0x51')],_0x3c02f3['id']);if(_0x119fa9>0x6){_0x3328b4=util['format'](_0xe13b('0x62'),_0x11d313[_0xe13b('0x51')],_0x3c02f3['id']);}logger['info'](_0xe13b('0x69'),_0xe13b('0x6d'));emit(util['format']('user:%s',_0x6581e7['name']),_0xe13b('0x64'),{'uri':_0x3328b4});})[_0xe13b('0x65')](function(_0x140b4b){logger['error'](_0xe13b('0x69'),JSON[_0xe13b('0x1e')](_0x140b4b));});};exports[_0xe13b('0x6e')]=function(_0x44cbb8,_0x5e8353,_0x590266,_0xe1a99c,_0x4d6200,_0x2a4c31){var _0x973d76,_0x2521d2,_0x2bd370,_0x216f6c;_0x2a4c31[_0xe13b('0x51')]=intUtil['stripTrailingSlash'](_0x2a4c31[_0xe13b('0x51')]);_0x2a4c31[_0xe13b('0x52')]=intUtil['stripTrailingSlash'](_0x2a4c31[_0xe13b('0x52')]);def[_0xe13b('0x67')]=util[_0xe13b('0x20')]('%s/service/v4_1/rest.php',_0x2a4c31[_0xe13b('0x51')]);if(_0x4d6200&&_0x4d6200['monitor_format']){logger['info']('['+_0x5e8353[_0xe13b('0x6f')][_0xe13b('0x70')]()+']',_0xe13b('0x55'));_0x5e8353[_0xe13b('0x56')]=util['format'](_0xe13b('0x57'),_0x2a4c31[_0xe13b('0x52')],_0x5e8353[_0xe13b('0x58')],md5(_0x5e8353['uniqueid']));}else{_0x5e8353[_0xe13b('0x56')]='';}return getConnection(_0x2a4c31)[_0xe13b('0x2a')](function(_0x4e4136){_0x216f6c=_0x4e4136;if(!_[_0xe13b('0x25')](_0xe1a99c)){return getUser(_0x2a4c31,_0xe1a99c['name'],_0x216f6c);}else{return getUser(_0x2a4c31,null,_0x216f6c);}})['then'](function(_0x313842){_0x973d76=_0x313842;logger[_0xe13b('0xc')](_0xe13b('0x59'),_0x973d76['id']);return getEndUser(_0x2a4c31,_0x5e8353[_0xe13b('0x5a')],_0x5e8353[_0xe13b('0x71')],_0x216f6c);})[_0xe13b('0x2a')](function(_0x1c9d5e){_0x2521d2=_0x1c9d5e;logger[_0xe13b('0xc')](_0xe13b('0x5b'),_0x2521d2['id']);return getTicket(_0x2a4c31,_0x973d76,_0x2521d2,_0x590266,_0x5e8353,_0x590266[_0xe13b('0x5c')],_0x216f6c,_0xe13b('0x5d'));})[_0xe13b('0x2a')](function(_0x4ae742){_0x2bd370=_0x4ae742;logger[_0xe13b('0xc')]('Ticket\x20created!');logger[_0xe13b('0xc')](_0xe13b('0x5f'),_0x2bd370['id']);return setRelationship(_0x216f6c,_0x973d76,_0x2bd370,_0xe13b('0x60'));})['then'](function(){return setRelationship(_0x216f6c,_0x2521d2,_0x2bd370,_0xe13b('0x72'));})[_0xe13b('0x2a')](function(){return getServerInfo(_0x216f6c);})[_0xe13b('0x65')](function(_0x4fe317){logger[_0xe13b('0x73')]('['+_0x5e8353['lastevent'][_0xe13b('0x70')]()+']',JSON[_0xe13b('0x1e')](_0x4fe317));});}; \ No newline at end of file +var _0xa1a4=['custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','[QUEUE]','outbound','uri','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','users','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','lastevent','toUpperCase','Inbound','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','forEach','push','idField','variableName','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','merge','map','string','nameField','customField','toLowerCase','content','type'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa1a4,0x11f));var _0x4a1a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa1a4[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x4a1a('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x4a1a('0x1'));var util=require(_0x4a1a('0x2'));var Redis=require(_0x4a1a('0x3'));var intUtil=require(_0x4a1a('0x4'));var config=require(_0x4a1a('0x5'));var logger=require(_0x4a1a('0x6'))(_0x4a1a('0x7'));config[_0x4a1a('0x8')]=_[_0x4a1a('0x9')](config[_0x4a1a('0x8')],{'host':_0x4a1a('0xa'),'port':0x18eb});var io=require(_0x4a1a('0xb'))(new Redis(config['redis']));var def={'method':_0x4a1a('0xc'),'json':!![]};function emit(_0x51c432,_0xcd0771,_0x44089c){io['to'](_0x51c432)[_0x4a1a('0xd')](_0xcd0771,_0x44089c);}function getTicket(_0x27238a,_0x4a7735,_0x4855fb,_0x583a51,_0x4a69fd,_0x3a1e3f,_0x127690,_0x45b938){logger[_0x4a1a('0xe')](_0x4a1a('0xf'));var _0x5234c8=new Date();var _0xa6ea51=[{'name':_0x4a1a('0x10'),'value':intUtil[_0x4a1a('0x11')](_0x583a51[_0x4a1a('0x12')],_0x4a69fd,'\x20')},{'name':_0x4a1a('0x13'),'value':_0x4a7735['id']},{'name':_0x4a1a('0x14'),'value':_0x4a7735['id']},{'name':'description','value':intUtil[_0x4a1a('0x11')](_0x583a51[_0x4a1a('0x15')],_0x4a69fd,'\x0a')},{'name':_0x4a1a('0x16'),'value':_0x5234c8['toISOString']()[_0x4a1a('0x17')](0x0,0x13)[_0x4a1a('0x18')]('T','\x20')},{'name':_0x4a1a('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4a1a('0x1a'),'value':_0x4855fb['id']},{'name':_0x4a1a('0x1b'),'value':_0x4a1a('0x1c')},{'name':_0x4a1a('0x1d'),'value':_0x4855fb[_0x4a1a('0x10')]},{'name':_0x4a1a('0x1e'),'value':_0x45b938}];if(_0x3a1e3f['length']){_[_0x4a1a('0x1f')](_0x3a1e3f,function(_0xad38b0){if(_0x4a69fd[_0xad38b0['variableName']]){_0xa6ea51[_0x4a1a('0x20')]({'name':_0xad38b0[_0x4a1a('0x21')],'value':_0x4a69fd[_0xad38b0[_0x4a1a('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x4a1a('0x23'),'response_type':_0x4a1a('0x23'),'rest_data':JSON[_0x4a1a('0x24')]({'session':_0x127690['id'],'module_name':_0x4a1a('0x25'),'name_value_list':_0xa6ea51})}});}function getAuth(_0x5e6f2f){return util[_0x4a1a('0x26')](_0x4a1a('0x27'),new Buffer(_0x5e6f2f['apiKey']+':X')[_0x4a1a('0x28')]('base64'));}function getServerInfo(_0x480d71){return request({'form':{'method':_0x4a1a('0x29'),'input_type':_0x4a1a('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x480d71['id']})}});}function getUser(_0x2b1a35,_0xa7dd2b,_0x3c30c5){if(!_[_0x4a1a('0x2a')](_0xa7dd2b)){logger[_0x4a1a('0xe')]('Getting\x20agent\x20with\x20name',_0xa7dd2b);return request({'form':{'method':_0x4a1a('0x2b'),'input_type':'JSON','response_type':_0x4a1a('0x23'),'rest_data':JSON[_0x4a1a('0x24')]({'session':_0x3c30c5['id'],'module_name':'Employees','query':util[_0x4a1a('0x26')](_0x4a1a('0x2c'),_0xa7dd2b),'order_by':'','offset':'0','select_fields':['id',_0x4a1a('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x33d53e){if(_0x33d53e[_0x4a1a('0x2d')]['length']){var _0x116ff4=_[_0x4a1a('0x2e')](_0x33d53e[_0x4a1a('0x2d')],function(_0x45a39f){return _0x45a39f[_0x4a1a('0x2f')][_0x4a1a('0x30')][_0x4a1a('0x31')]===_0xa7dd2b;});if(_0x116ff4){logger[_0x4a1a('0xe')]('Agent\x20found!');return BPromise[_0x4a1a('0x32')]({'id':_0x116ff4[_0x4a1a('0x2f')]['id'][_0x4a1a('0x31')],'name':_0x116ff4[_0x4a1a('0x2f')][_0x4a1a('0x10')][_0x4a1a('0x31')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4a1a('0x32')]({'id':_0x3c30c5[_0x4a1a('0x2f')]['user_id']['value'],'name':_0x3c30c5[_0x4a1a('0x2f')][_0x4a1a('0x30')][_0x4a1a('0x31')]});});}else{logger[_0x4a1a('0xe')](_0x4a1a('0x33'));return BPromise['resolve']({'id':_0x3c30c5[_0x4a1a('0x2f')][_0x4a1a('0x34')][_0x4a1a('0x31')],'name':_0x3c30c5[_0x4a1a('0x2f')][_0x4a1a('0x30')][_0x4a1a('0x31')]});}}function getEndUser(_0xf797c4,_0x468e71,_0x498fed,_0x10d498){logger[_0x4a1a('0xe')](_0x4a1a('0x35'),_0x498fed);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x4a1a('0x23'),'rest_data':JSON[_0x4a1a('0x24')]({'session':_0x10d498['id'],'module_name':_0x4a1a('0x1c'),'query':util[_0x4a1a('0x26')](_0x4a1a('0x36'),_0x498fed),'order_by':'','offset':'0','select_fields':['id','name',_0x4a1a('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x521d1c){if(_0x521d1c[_0x4a1a('0x2d')][_0x4a1a('0x38')]){var _0x552e3c=_['find'](_0x521d1c[_0x4a1a('0x2d')],function(_0x2863c5){return _0x2863c5[_0x4a1a('0x2f')][_0x4a1a('0x37')][_0x4a1a('0x31')]===_0x498fed;});if(_0x552e3c){logger['info'](_0x4a1a('0x39'));return BPromise['resolve']({'id':_0x552e3c[_0x4a1a('0x2f')]['id']['value'],'name':_0x552e3c[_0x4a1a('0x2f')]['name'][_0x4a1a('0x31')],'phone':_0x552e3c[_0x4a1a('0x2f')][_0x4a1a('0x37')]['value']});}}else{logger[_0x4a1a('0xe')](_0x4a1a('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x4a1a('0x23'),'response_type':_0x4a1a('0x23'),'rest_data':JSON[_0x4a1a('0x24')]({'session':_0x10d498['id'],'module_name':_0x4a1a('0x1c'),'name_value_list':[{'name':_0x4a1a('0x3b'),'value':_0x468e71!==_0x4a1a('0x3c')?_0x468e71:util[_0x4a1a('0x26')](_0x4a1a('0x3d'),_0x498fed)},{'name':_0x4a1a('0x37'),'value':_0x498fed}]})}})[_0x4a1a('0x3e')](function(_0x513351){logger[_0x4a1a('0xe')](_0x4a1a('0x3f'));return BPromise[_0x4a1a('0x32')]({'id':_0x513351['id'],'name':_0x513351[_0x4a1a('0x2d')][_0x4a1a('0x3b')]['value'],'phone':_0x513351[_0x4a1a('0x2d')][_0x4a1a('0x37')][_0x4a1a('0x31')]});});}});}function request(_0x40d6e8){logger[_0x4a1a('0x40')]('[HTTP]',JSON['stringify'](_0x40d6e8));return rp(_[_0x4a1a('0x41')](def,_0x40d6e8));}function getTags(_0x37b4c8,_0x16441e){var _0x1d4540=[];if(_0x37b4c8&&_0x37b4c8[_0x4a1a('0x38')]>0x0){_0x1d4540=_[_0x4a1a('0x42')](_0x37b4c8,_0x16441e);}return _0x1d4540;}function getCustomFields(_0x36c9fe,_0xf7a2d4){var _0x45c129=[];var _0x260528={'custom_fields':[]};if(_0x36c9fe['length']>0x0){_[_0x4a1a('0x1f')](_0x36c9fe,function(_0x76e7e9){if(_0x76e7e9['type']===_0x4a1a('0x43')&&_0x76e7e9[_0x4a1a('0x44')]&&!_0x76e7e9[_0x4a1a('0x45')]){_0x260528[_0x76e7e9['nameField'][_0x4a1a('0x46')]()]=_0x76e7e9[_0x4a1a('0x47')]['toString']();}else if(_0x76e7e9[_0x4a1a('0x48')]===_0x4a1a('0x43')&&_0x76e7e9[_0x4a1a('0x21')]&&_0x76e7e9[_0x4a1a('0x45')]){_0x260528[_0x4a1a('0x49')]['push']({'id':_0x76e7e9[_0x4a1a('0x21')],'value':_0x76e7e9['content'][_0x4a1a('0x28')]()});}else if(_0x76e7e9['type']===_0x4a1a('0x4a')&&_0x76e7e9['variableName']&&_0x76e7e9[_0x4a1a('0x21')]&&_0x76e7e9[_0x4a1a('0x45')]){_0xf7a2d4[_0x76e7e9[_0x4a1a('0x22')]]&&_0x260528[_0x4a1a('0x49')][_0x4a1a('0x20')]({'id':_0x76e7e9['idField'],'value':_0xf7a2d4[_0x76e7e9['variableName']][_0x4a1a('0x28')]()});}else if(_0x76e7e9[_0x4a1a('0x48')]===_0x4a1a('0x4b')&&_0x76e7e9[_0x4a1a('0x4c')]&&_0x76e7e9['Variable']['name']&&_0x76e7e9[_0x4a1a('0x21')]&&_0x76e7e9[_0x4a1a('0x45')]){_0xf7a2d4[_0x76e7e9[_0x4a1a('0x4c')][_0x4a1a('0x10')]['toLowerCase']()]&&_0x260528[_0x4a1a('0x49')][_0x4a1a('0x20')]({'id':_0x76e7e9[_0x4a1a('0x21')],'value':_0xf7a2d4[_0x76e7e9[_0x4a1a('0x4c')][_0x4a1a('0x10')][_0x4a1a('0x46')]()][_0x4a1a('0x28')]()});}});}return _0x260528;}function getConnection(_0x482676){return request({'method':_0x4a1a('0xc'),'form':{'method':_0x4a1a('0x4d'),'input_type':_0x4a1a('0x23'),'response_type':_0x4a1a('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x482676[_0x4a1a('0x4e')],'password':_0x482676[_0x4a1a('0x4f')],'encryption':_0x4a1a('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4a1a('0x3e')](function(_0x3e32bf){var _0x5e6fd7=_0x3e32bf;if(_0x5e6fd7['id']){def[_0x4a1a('0x51')]=_0x5e6fd7['id'];return BPromise[_0x4a1a('0x32')](_0x5e6fd7);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x482676['id']));}});}function setRelationship(_0x34ec95,_0x52b4bb,_0x56ed9f,_0x3a312e){return request({'form':{'method':'set_relationship','input_type':_0x4a1a('0x23'),'response_type':_0x4a1a('0x23'),'rest_data':JSON[_0x4a1a('0x24')]({'session':_0x34ec95['id'],'module_name':_0x4a1a('0x25'),'module_id':_0x56ed9f['id'],'link_field_name':_0x3a312e,'related_ids':[_0x52b4bb['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x244988,_0x108d9f,_0x578bf7,_0x14e1ab,_0x68650f,_0x49cde9){var _0x128468,_0x3928ab,_0x19f61e,_0x800a2a;_0x49cde9['remoteUri']=intUtil[_0x4a1a('0x52')](_0x49cde9['remoteUri']);_0x49cde9[_0x4a1a('0x53')]=intUtil[_0x4a1a('0x52')](_0x49cde9[_0x4a1a('0x53')]);def['uri']=util[_0x4a1a('0x26')](_0x4a1a('0x54'),_0x49cde9[_0x4a1a('0x55')]);if(_0x68650f&&_0x68650f[_0x4a1a('0x56')]){logger['info']('[QUEUE]',_0x4a1a('0x57'));_0x108d9f[_0x4a1a('0x58')]=util['format'](_0x4a1a('0x59'),_0x49cde9['serverUrl'],_0x108d9f[_0x4a1a('0x5a')],md5(_0x108d9f[_0x4a1a('0x5a')]));}else{_0x108d9f[_0x4a1a('0x58')]='';}return getConnection(_0x49cde9)[_0x4a1a('0x3e')](function(_0x4767a0){_0x800a2a=_0x4767a0;return getUser(_0x49cde9,_0x14e1ab[_0x4a1a('0x10')],_0x800a2a);})[_0x4a1a('0x3e')](function(_0x5b44aa){_0x128468=_0x5b44aa;logger['info']('The\x20User\x20ID\x20is:',_0x128468['id']);return getEndUser(_0x49cde9,_0x108d9f[_0x4a1a('0x5b')],_0x108d9f['calleridnum'],_0x800a2a);})['then'](function(_0x7ce9db){_0x3928ab=_0x7ce9db;logger[_0x4a1a('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3928ab['id']);return getTicket(_0x49cde9,_0x128468,_0x3928ab,_0x578bf7,_0x108d9f,_0x578bf7[_0x4a1a('0x5c')],_0x800a2a,'Inbound');})[_0x4a1a('0x3e')](function(_0x58ce66){_0x19f61e=_0x58ce66;logger[_0x4a1a('0xe')](_0x4a1a('0x5d'));logger[_0x4a1a('0xe')](_0x4a1a('0x5e'),_0x19f61e['id']);return setRelationship(_0x800a2a,_0x128468,_0x19f61e,'users');})[_0x4a1a('0x3e')](function(){return setRelationship(_0x800a2a,_0x3928ab,_0x19f61e,_0x4a1a('0x5f'));})[_0x4a1a('0x3e')](function(){return getServerInfo(_0x800a2a);})[_0x4a1a('0x3e')](function(_0x27d106){var _0x2d782a=parseInt(_0x27d106[_0x4a1a('0x60')]['charAt'](0x0));var _0x38c809=util[_0x4a1a('0x26')](_0x4a1a('0x61'),_0x49cde9['remoteUri'],_0x19f61e['id']);if(_0x2d782a>0x6){_0x38c809=util[_0x4a1a('0x26')](_0x4a1a('0x62'),_0x49cde9[_0x4a1a('0x55')],_0x19f61e['id']);}logger[_0x4a1a('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4a1a('0x26')](_0x4a1a('0x63'),_0x14e1ab['name']),_0x4a1a('0x64'),{'uri':_0x38c809});})[_0x4a1a('0x65')](function(_0x5c23d0){logger['error'](_0x4a1a('0x66'),JSON[_0x4a1a('0x24')](_0x5c23d0));});};exports[_0x4a1a('0x67')]=function(_0x569938,_0x10bdfe,_0x39f214,_0x22baf5,_0x30371c,_0x1d8cbd,_0x3ab434){var _0x2b981f,_0x23da9f,_0x3acb12,_0x37ae3f;_0x1d8cbd[_0x4a1a('0x55')]=intUtil[_0x4a1a('0x52')](_0x1d8cbd[_0x4a1a('0x55')]);_0x1d8cbd['serverUrl']=intUtil[_0x4a1a('0x52')](_0x1d8cbd['serverUrl']);def[_0x4a1a('0x68')]=util[_0x4a1a('0x26')](_0x4a1a('0x54'),_0x1d8cbd[_0x4a1a('0x55')]);if(_0x3ab434&&_0x3ab434[_0x4a1a('0x69')]&&_0x3ab434[_0x4a1a('0x69')]!==_0x4a1a('0x6a')){logger[_0x4a1a('0xe')](_0x4a1a('0x6b'),_0x4a1a('0x57'));_0x10bdfe[_0x4a1a('0x58')]=util[_0x4a1a('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d8cbd[_0x4a1a('0x53')],_0x10bdfe['uniqueid'],md5(_0x10bdfe['uniqueid']));}return getConnection(_0x1d8cbd)[_0x4a1a('0x3e')](function(_0x1d9471){_0x37ae3f=_0x1d9471;return getUser(_0x1d8cbd,_0x22baf5[_0x4a1a('0x10')],_0x37ae3f);})['then'](function(_0x467525){_0x2b981f=_0x467525;logger[_0x4a1a('0xe')](_0x4a1a('0x6c'),_0x2b981f['id']);return getEndUser(_0x1d8cbd,_0x10bdfe[_0x4a1a('0x6d')],_0x10bdfe[_0x4a1a('0x6e')],_0x37ae3f);})[_0x4a1a('0x3e')](function(_0x3dbd7b){_0x23da9f=_0x3dbd7b;logger[_0x4a1a('0xe')](_0x4a1a('0x6f'),_0x23da9f['id']);return getTicket(_0x1d8cbd,_0x2b981f,_0x23da9f,_0x39f214,_0x10bdfe,_0x39f214[_0x4a1a('0x5c')],_0x37ae3f,'Outbound');})['then'](function(_0x1f01fd){_0x3acb12=_0x1f01fd;logger[_0x4a1a('0xe')](_0x4a1a('0x5d'));logger[_0x4a1a('0xe')](_0x4a1a('0x5e'),_0x3acb12['id']);return setRelationship(_0x37ae3f,_0x2b981f,_0x3acb12,_0x4a1a('0x70'));})[_0x4a1a('0x3e')](function(){return setRelationship(_0x37ae3f,_0x23da9f,_0x3acb12,'contacts');})[_0x4a1a('0x3e')](function(){return getServerInfo(_0x37ae3f);})[_0x4a1a('0x3e')](function(_0x3cb3b3){var _0x17c263=parseInt(_0x3cb3b3[_0x4a1a('0x60')][_0x4a1a('0x71')](0x0));var _0x333a9a=util['format'](_0x4a1a('0x61'),_0x1d8cbd[_0x4a1a('0x55')],_0x3acb12['id']);if(_0x17c263>0x6){_0x333a9a=util[_0x4a1a('0x26')](_0x4a1a('0x62'),_0x1d8cbd[_0x4a1a('0x55')],_0x3acb12['id']);}logger[_0x4a1a('0xe')](_0x4a1a('0x6b'),_0x4a1a('0x72'));emit(util[_0x4a1a('0x26')]('user:%s',_0x22baf5[_0x4a1a('0x10')]),'trigger:browser:url',{'uri':_0x333a9a});})['catch'](function(_0x3cedac){logger[_0x4a1a('0x73')](_0x4a1a('0x6b'),JSON[_0x4a1a('0x24')](_0x3cedac));});};exports[_0x4a1a('0x74')]=function(_0x2a4546,_0x47655f,_0x5a45b9,_0x42a70c,_0x24ce83,_0x5ae472){var _0x46f3e8,_0x27a527,_0x441176,_0x1f3cad;_0x5ae472[_0x4a1a('0x55')]=intUtil[_0x4a1a('0x52')](_0x5ae472['remoteUri']);_0x5ae472[_0x4a1a('0x53')]=intUtil[_0x4a1a('0x52')](_0x5ae472[_0x4a1a('0x53')]);def[_0x4a1a('0x68')]=util['format']('%s/service/v4_1/rest.php',_0x5ae472[_0x4a1a('0x55')]);if(_0x24ce83&&_0x24ce83[_0x4a1a('0x56')]){logger[_0x4a1a('0xe')]('['+_0x47655f[_0x4a1a('0x75')][_0x4a1a('0x76')]()+']','Recording\x20is\x20enabled!');_0x47655f[_0x4a1a('0x58')]=util[_0x4a1a('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ae472['serverUrl'],_0x47655f[_0x4a1a('0x5a')],md5(_0x47655f[_0x4a1a('0x5a')]));}else{_0x47655f['recordingURL']='';}return getConnection(_0x5ae472)['then'](function(_0x2ee527){_0x1f3cad=_0x2ee527;if(!_['isNil'](_0x42a70c)){return getUser(_0x5ae472,_0x42a70c[_0x4a1a('0x10')],_0x1f3cad);}else{return getUser(_0x5ae472,null,_0x1f3cad);}})[_0x4a1a('0x3e')](function(_0x1e2f74){_0x46f3e8=_0x1e2f74;logger['info']('The\x20User\x20ID\x20is:',_0x46f3e8['id']);return getEndUser(_0x5ae472,_0x47655f['calleridname'],_0x47655f['calleridnum'],_0x1f3cad);})[_0x4a1a('0x3e')](function(_0x4f4963){_0x27a527=_0x4f4963;logger[_0x4a1a('0xe')](_0x4a1a('0x6f'),_0x27a527['id']);return getTicket(_0x5ae472,_0x46f3e8,_0x27a527,_0x5a45b9,_0x47655f,_0x5a45b9[_0x4a1a('0x5c')],_0x1f3cad,_0x4a1a('0x77'));})['then'](function(_0x4c6b03){_0x441176=_0x4c6b03;logger[_0x4a1a('0xe')](_0x4a1a('0x5d'));logger['info'](_0x4a1a('0x5e'),_0x441176['id']);return setRelationship(_0x1f3cad,_0x46f3e8,_0x441176,_0x4a1a('0x70'));})['then'](function(){return setRelationship(_0x1f3cad,_0x27a527,_0x441176,_0x4a1a('0x5f'));})[_0x4a1a('0x3e')](function(){return getServerInfo(_0x1f3cad);})['catch'](function(_0x1e04f9){logger[_0x4a1a('0x73')]('['+_0x47655f['lastevent'][_0x4a1a('0x76')]()+']',JSON[_0x4a1a('0x24')](_0x1e04f9));});}; \ 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 bd43b55..463295f 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 _0x00c9=['string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type'];(function(_0x130c7e,_0x284884){var _0x581a42=function(_0x2cfa98){while(--_0x2cfa98){_0x130c7e['push'](_0x130c7e['shift']());}};_0x581a42(++_0x284884);}(_0x00c9,0x112));var _0x900c=function(_0x5f06c8,_0x36c7b8){_0x5f06c8=_0x5f06c8-0x0;var _0x210368=_0x00c9[_0x5f06c8];return _0x210368;};'use strict';var _=require(_0x900c('0x0'));var util=require(_0x900c('0x1'));exports[_0x900c('0x2')]=function(_0x4faaa2,_0x228b64,_0xbe9ff4){var _0x408550=[];if(_0x4faaa2[_0x900c('0x3')]>0x0){var _0x577698=_[_0x900c('0x4')](_0x4faaa2,['id']);for(var _0x165ce9=0x0;_0x165ce9<_0x577698[_0x900c('0x3')];_0x165ce9++){var _0x4af716=_0x577698[_0x165ce9];if(_0x4af716[_0x900c('0x5')]===_0x900c('0x6')){_0x408550[_0x900c('0x7')](_0x4af716[_0x900c('0x8')]);}else if(_0x4af716[_0x900c('0x5')]===_0x900c('0x9')&&_0x4af716[_0x900c('0xa')]){_0x228b64[_0x4af716[_0x900c('0xa')]]&&_0x408550[_0x900c('0x7')](_0x228b64[_0x4af716[_0x900c('0xa')]]['toString']());}else if(_0x4af716[_0x900c('0x5')]===_0x900c('0xb')&&_0x4af716[_0x900c('0xc')]&&_0x4af716[_0x900c('0xc')][_0x900c('0xd')]){_0x228b64[_0x4af716[_0x900c('0xc')][_0x900c('0xd')][_0x900c('0xe')]()]&&_0x408550[_0x900c('0x7')](_0x228b64[_0x4af716[_0x900c('0xc')]['name'][_0x900c('0xe')]()][_0x900c('0xf')]());}else if(_0x4af716[_0x900c('0x5')]===_0x900c('0x10')){if(_0x4af716[_0x900c('0x11')]===_0x900c('0x6')&&_0x4af716[_0x900c('0x12')]){_0x408550[_0x900c('0x7')](util[_0x900c('0x13')](_0x900c('0x14'),_0x4af716[_0x900c('0x12')],_0x4af716[_0x900c('0x15')]));}else if(_0x4af716[_0x900c('0x11')]==='variable'&&_0x4af716[_0x900c('0xa')]&&_0x4af716['key']){_0x228b64[_0x4af716[_0x900c('0xa')]]&&_0x408550[_0x900c('0x7')](util[_0x900c('0x13')]('%s:\x20%s',_0x4af716[_0x900c('0x12')],_0x228b64[_0x4af716[_0x900c('0xa')]]));}else if(_0x4af716['keyType']===_0x900c('0xb')&&_0x4af716[_0x900c('0xc')]&&_0x4af716['Variable'][_0x900c('0xd')]&&_0x4af716[_0x900c('0x12')]){_0x228b64[_0x4af716[_0x900c('0xc')][_0x900c('0xd')][_0x900c('0xe')]()]&&_0x408550[_0x900c('0x7')](util[_0x900c('0x13')]('%s:\x20%s',_0x4af716[_0x900c('0x12')],_0x228b64[_0x4af716[_0x900c('0xc')]['name'][_0x900c('0xe')]()]));}}}}return _0x408550[_0x900c('0x16')](_0xbe9ff4);};exports[_0x900c('0x17')]=function(_0xaaae58){var _0x14cdd9=_0xaaae58['slice'](-0x1);if(_0x14cdd9==='/'){_0xaaae58=_0xaaae58[_0x900c('0x18')](0x0,_0xaaae58['lastIndexOf'](_0x14cdd9));}return _0xaaae58;};exports[_0x900c('0x19')]=function(_0x1262a7){if(!_[_0x900c('0x1a')](_0x1262a7)&&_0x1262a7!==''){var _0x990744=/^(([^<>()\[\]\\.,;:\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 _0x990744[_0x900c('0x1b')](String(_0x1262a7)[_0x900c('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x3dad=['customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','length','sortBy','string','push','type','variable','variableName','toString'];(function(_0x548672,_0xcbb07c){var _0x198f56=function(_0x156037){while(--_0x156037){_0x548672['push'](_0x548672['shift']());}};_0x198f56(++_0xcbb07c);}(_0x3dad,0x8d));var _0xd3da=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3dad[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd3da('0x0'));var util=require('util');exports['getString']=function(_0x349943,_0x299358,_0x2f33da){var _0x4761ab=[];if(_0x349943[_0xd3da('0x1')]>0x0){var _0x34e2cc=_[_0xd3da('0x2')](_0x349943,['id']);for(var _0x567ba8=0x0;_0x567ba8<_0x34e2cc[_0xd3da('0x1')];_0x567ba8++){var _0x14b274=_0x34e2cc[_0x567ba8];if(_0x14b274['type']===_0xd3da('0x3')){_0x4761ab[_0xd3da('0x4')](_0x14b274['content']);}else if(_0x14b274[_0xd3da('0x5')]===_0xd3da('0x6')&&_0x14b274[_0xd3da('0x7')]){_0x299358[_0x14b274[_0xd3da('0x7')]]&&_0x4761ab[_0xd3da('0x4')](_0x299358[_0x14b274[_0xd3da('0x7')]][_0xd3da('0x8')]());}else if(_0x14b274[_0xd3da('0x5')]===_0xd3da('0x9')&&_0x14b274['Variable']&&_0x14b274[_0xd3da('0xa')][_0xd3da('0xb')]){_0x299358[_0x14b274['Variable'][_0xd3da('0xb')]['toLowerCase']()]&&_0x4761ab[_0xd3da('0x4')](_0x299358[_0x14b274[_0xd3da('0xa')][_0xd3da('0xb')][_0xd3da('0xc')]()][_0xd3da('0x8')]());}else if(_0x14b274[_0xd3da('0x5')]===_0xd3da('0xd')){if(_0x14b274[_0xd3da('0xe')]===_0xd3da('0x3')&&_0x14b274[_0xd3da('0xf')]){_0x4761ab[_0xd3da('0x4')](util['format'](_0xd3da('0x10'),_0x14b274[_0xd3da('0xf')],_0x14b274[_0xd3da('0x11')]));}else if(_0x14b274[_0xd3da('0xe')]==='variable'&&_0x14b274[_0xd3da('0x7')]&&_0x14b274[_0xd3da('0xf')]){_0x299358[_0x14b274['variableName']]&&_0x4761ab[_0xd3da('0x4')](util[_0xd3da('0x12')](_0xd3da('0x10'),_0x14b274[_0xd3da('0xf')],_0x299358[_0x14b274[_0xd3da('0x7')]]));}else if(_0x14b274[_0xd3da('0xe')]===_0xd3da('0x9')&&_0x14b274[_0xd3da('0xa')]&&_0x14b274[_0xd3da('0xa')][_0xd3da('0xb')]&&_0x14b274[_0xd3da('0xf')]){_0x299358[_0x14b274[_0xd3da('0xa')]['name'][_0xd3da('0xc')]()]&&_0x4761ab[_0xd3da('0x4')](util[_0xd3da('0x12')]('%s:\x20%s',_0x14b274[_0xd3da('0xf')],_0x299358[_0x14b274[_0xd3da('0xa')][_0xd3da('0xb')][_0xd3da('0xc')]()]));}}}}return _0x4761ab[_0xd3da('0x13')](_0x2f33da);};exports[_0xd3da('0x14')]=function(_0x46cfc3){var _0x3b1942=_0x46cfc3[_0xd3da('0x15')](-0x1);if(_0x3b1942==='/'){_0x46cfc3=_0x46cfc3[_0xd3da('0x16')](0x0,_0x46cfc3[_0xd3da('0x17')](_0x3b1942));}return _0x46cfc3;};exports[_0xd3da('0x18')]=function(_0xc096f8){if(!_['isNil'](_0xc096f8)&&_0xc096f8!==''){var _0x3d86cb=/^(([^<>()\[\]\\.,;:\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 _0x3d86cb['test'](String(_0xc096f8)[_0xd3da('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 5a2f8de..d3fa837 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 _0x4bed=['catch','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','result','first_name','userId','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','GET','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','length','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','getEndUser','accessKey','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','calleridname','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','emit','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','%s/webservice.php','create','username','sessionName','stringify','then','success','resolve','format','error'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0x4bed,0x1dd));var _0xd4be=function(_0x251fc9,_0x1b27d1){_0x251fc9=_0x251fc9-0x0;var _0x59ba9a=_0x4bed[_0x251fc9];return _0x59ba9a;};'use strict';var _=require('lodash');var rp=require(_0xd4be('0x0'));var BPromise=require('bluebird');var md5=require(_0xd4be('0x1'));var util=require(_0xd4be('0x2'));var Redis=require(_0xd4be('0x3'));var intUtil=require(_0xd4be('0x4'));var config=require(_0xd4be('0x5'));var logger=require(_0xd4be('0x6'))(_0xd4be('0x7'));config['redis']=_[_0xd4be('0x8')](config[_0xd4be('0x9')],{'host':_0xd4be('0xa'),'port':0x18eb});var io=require(_0xd4be('0xb'))(new Redis(config['redis']));function emit(_0x4068ad,_0x5df332,_0x45e231){io['to'](_0x4068ad)[_0xd4be('0xc')](_0x5df332,_0x45e231);}function getCustomFields(_0x56e42c,_0x3ad8b8){var _0x3beb90={};if(_0x56e42c['length']>0x0){_[_0xd4be('0xd')](_0x56e42c,function(_0x22fa51){if(_0x22fa51['type']==='string'&&_0x22fa51[_0xd4be('0xe')]){_0x3beb90[_0x22fa51['idField']]=_0x22fa51[_0xd4be('0xf')][_0xd4be('0x10')]();}else if(_0x22fa51[_0xd4be('0x11')]===_0xd4be('0x12')&&_0x22fa51[_0xd4be('0x13')]&&_0x22fa51[_0xd4be('0xe')]&&_0x3ad8b8[_0x22fa51['variableName']]){_0x3beb90[_0x22fa51[_0xd4be('0xe')]]=_0x3ad8b8[_0x22fa51[_0xd4be('0x13')]][_0xd4be('0x10')]();}else if(_0x22fa51[_0xd4be('0x11')]===_0xd4be('0x14')&&_0x22fa51[_0xd4be('0x15')]&&_0x22fa51[_0xd4be('0x15')][_0xd4be('0x16')]&&_0x22fa51[_0xd4be('0xe')]&&_0x3ad8b8[_0x22fa51[_0xd4be('0x15')][_0xd4be('0x16')][_0xd4be('0x17')]()]){_0x3beb90[_0x22fa51['idField']]=_0x3ad8b8[_0x22fa51[_0xd4be('0x15')]['name'][_0xd4be('0x17')]()][_0xd4be('0x10')]();}});}return _0x3beb90;}function createTicket(_0x4717b0,_0x16585d,_0x79635a,_0x31c228,_0x257392,_0x256158,_0x1975f2){logger[_0xd4be('0x18')](_0xd4be('0x19'));var _0xa7a01d=_[_0xd4be('0x1a')]({'parent_id':'','assigned_user_id':_0x16585d['id'],'ticketpriorities':_0xd4be('0x1b'),'ticketstatus':_0xd4be('0x1c'),'ticket_title':intUtil['getString'](_0x31c228[_0xd4be('0x1d')],_0x257392,'\x20'),'description':intUtil[_0xd4be('0x1e')](_0x31c228[_0xd4be('0x1f')],_0x257392,'\x0a'),'contact_id':_0x79635a['id']},getCustomFields(_0x256158,_0x257392));var _0x357b33={'method':_0xd4be('0x20'),'uri':util['format'](_0xd4be('0x21'),_0x4717b0['remoteUri']),'form':{'operation':_0xd4be('0x22'),'username':_0x4717b0[_0xd4be('0x23')],'sessionName':_0x1975f2[_0xd4be('0x24')],'elementType':'HelpDesk','element':JSON[_0xd4be('0x25')](_0xa7a01d)},'json':!![]};return request(_0x357b33)[_0xd4be('0x26')](function(_0x3954e5){if(_0x3954e5[_0xd4be('0x27')]){return BPromise[_0xd4be('0x28')]({'id':_0x3954e5['result']['id']});}else{throw new Error(util[_0xd4be('0x29')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0xd4be('0x25')](_0x3954e5[_0xd4be('0x2a')])));}})[_0xd4be('0x2b')](function(_0x4c35c2){var _0x4bbf79=_0x4c35c2['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x4bbf79,JSON['stringify'](_0x4c35c2));});}function getUser(_0x377c70,_0x39f8c7,_0x2393ba){if(intUtil[_0xd4be('0x2c')](_0x39f8c7)){logger[_0xd4be('0x18')](_0xd4be('0x2d'),_0x39f8c7);return request({'method':'GET','uri':util[_0xd4be('0x29')](_0xd4be('0x21'),_0x377c70[_0xd4be('0x2e')]),'qs':{'operation':_0xd4be('0x2f'),'username':_0x377c70[_0xd4be('0x23')],'sessionName':_0x2393ba['sessionName'],'query':util['format'](_0xd4be('0x30'),_0x39f8c7)},'json':!![]})[_0xd4be('0x26')](function(_0x189603){if(_0x189603[_0xd4be('0x27')]&&_0x189603['result']['length']){logger[_0xd4be('0x18')](_0xd4be('0x31'));return BPromise[_0xd4be('0x28')]({'id':_0x189603['result'][0x0]['id'],'email':_0x189603['result'][0x0][_0xd4be('0x32')],'name':_0x189603[_0xd4be('0x33')][0x0][_0xd4be('0x34')]+'\x20'+_0x189603['result']['last_name']});}else{logger[_0xd4be('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd4be('0x28')]({'id':_0x2393ba[_0xd4be('0x35')],'email':_0x377c70[_0xd4be('0x23')],'name':'admin'});}})[_0xd4be('0x2b')](function(_0x58d82a){var _0x12dc43=_0x58d82a[_0xd4be('0x36')]||0x1f4;logger[_0xd4be('0x2a')](_0xd4be('0x37'),_0xd4be('0x38'),_0x12dc43,JSON['stringify'](_0x58d82a));});}else{logger[_0xd4be('0x18')](_0xd4be('0x39'));return BPromise[_0xd4be('0x28')]({'id':_0x2393ba[_0xd4be('0x35')],'email':_0x377c70[_0xd4be('0x23')],'name':'admin'})[_0xd4be('0x2b')](function(_0x175a24){var _0x2d0e1c=_0x175a24[_0xd4be('0x36')]||0x1f4;logger[_0xd4be('0x2a')](_0xd4be('0x37'),'getUser',_0x2d0e1c,JSON[_0xd4be('0x25')](_0x175a24));});}}function getEndUser(_0xd43545,_0x33df98,_0xa29c73,_0x27967e){logger[_0xd4be('0x18')](_0xd4be('0x3a'),_0xa29c73);return request({'method':_0xd4be('0x3b'),'uri':util[_0xd4be('0x29')](_0xd4be('0x21'),_0xd43545[_0xd4be('0x2e')]),'qs':{'operation':_0xd4be('0x2f'),'username':_0xd43545['username'],'sessionName':_0x27967e['sessionName'],'query':util['format'](_0xd4be('0x3c'),_0xa29c73,_0xa29c73,_0xa29c73,_0xa29c73,_0xa29c73)},'json':!![]})[_0xd4be('0x26')](function(_0x233d35){if(_0x233d35[_0xd4be('0x27')]&&_0x233d35[_0xd4be('0x33')][_0xd4be('0x3d')]){logger[_0xd4be('0x18')](_0xd4be('0x3e'));return BPromise[_0xd4be('0x28')]({'id':_0x233d35['result'][0x0]['id'],'name':_0x233d35['result'][0x0][_0xd4be('0x3f')]+'\x20'+_0x233d35['result'][0x0][_0xd4be('0x40')],'phone':_0xa29c73});}else{logger[_0xd4be('0x18')](_0xd4be('0x41'));return request({'method':_0xd4be('0x20'),'uri':util['format'](_0xd4be('0x21'),_0xd43545[_0xd4be('0x2e')]),'form':{'operation':_0xd4be('0x22'),'sessionName':_0x27967e[_0xd4be('0x24')],'elementType':_0xd4be('0x42'),'element':JSON['stringify']({'lastname':_0x33df98,'phone':_0xa29c73,'assigned_user_id':'\x20'})},'json':!![]})[_0xd4be('0x26')](function(_0x55b453){logger[_0xd4be('0x18')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x55b453[_0xd4be('0x33')]['id'],'name':_0x55b453[_0xd4be('0x33')]['lastname'],'phone':_0x55b453['result'][_0xd4be('0x43')]});})[_0xd4be('0x2b')](function(_0xd3d75a){var _0x3374a1=_0xd3d75a['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xd4be('0x44'),_0x3374a1,JSON[_0xd4be('0x25')](_0xd3d75a));});}});}function getConnection(_0x3b7d96){var _0x5870bf=_0x3b7d96['username'];var _0x290e4b=_0x3b7d96[_0xd4be('0x45')];return request({'method':_0xd4be('0x3b'),'uri':util[_0xd4be('0x29')](_0xd4be('0x21'),_0x3b7d96[_0xd4be('0x2e')]),'qs':{'operation':'getchallenge','username':_0x5870bf},'json':!![]})[_0xd4be('0x26')](function(_0x4cd013){if(_0x4cd013['success']){return request({'method':_0xd4be('0x20'),'uri':util[_0xd4be('0x29')](_0xd4be('0x21'),_0x3b7d96[_0xd4be('0x2e')]),'form':{'operation':'login','username':_0x5870bf,'accessKey':md5(_0x4cd013[_0xd4be('0x33')][_0xd4be('0x46')]+_0x290e4b)},'json':!![]});}})[_0xd4be('0x26')](function(_0x52a72f){if(_0x52a72f['success']){return BPromise[_0xd4be('0x28')](_0x52a72f[_0xd4be('0x33')]);}else{throw new Error(util[_0xd4be('0x29')](_0xd4be('0x47'),_0x3b7d96['id']));}})[_0xd4be('0x2b')](function(_0x40ecf4){var _0x1e6f34=_0x40ecf4['statusCode']||0x1f4;logger[_0xd4be('0x2a')](_0xd4be('0x37'),'getConnection',_0x1e6f34,JSON['stringify'](_0x40ecf4));});}function request(_0xa011ea){logger[_0xd4be('0x18')](_0xd4be('0x48'),JSON[_0xd4be('0x25')](_0xa011ea));return rp(_0xa011ea);}exports[_0xd4be('0x49')]=function(_0xfd15f4,_0x9bfc5f,_0x5e274c,_0x10b58f,_0x269799,_0x23be6d){var _0x239ad1,_0x2692e8,_0x3e9658,_0x52c77e;_0x23be6d[_0xd4be('0x2e')]=intUtil[_0xd4be('0x4a')](_0x23be6d[_0xd4be('0x2e')]);if(_0x269799&&_0x269799[_0xd4be('0x4b')]){logger[_0xd4be('0x18')]('[QUEUE]',_0xd4be('0x4c'));_0x9bfc5f[_0xd4be('0x4d')]=util[_0xd4be('0x29')](_0xd4be('0x4e'),_0x23be6d['serverUrl'],_0x9bfc5f['uniqueid'],md5(_0x9bfc5f[_0xd4be('0x4f')]));}else{_0x9bfc5f[_0xd4be('0x4d')]='';}return getConnection(_0x23be6d)['then'](function(_0x61b239){_0x52c77e=_0x61b239;return getUser(_0x23be6d,_0x10b58f['email'],_0x52c77e);})['then'](function(_0xbd0ae3){_0x239ad1=_0xbd0ae3;logger[_0xd4be('0x18')](_0xd4be('0x50'),_0x239ad1['id']);return getEndUser(_0x23be6d,_0x9bfc5f['calleridname'],_0x9bfc5f[_0xd4be('0x51')],_0x52c77e);})[_0xd4be('0x26')](function(_0x2d64a2){_0x2692e8=_0x2d64a2;logger[_0xd4be('0x18')](_0xd4be('0x52'),_0x2692e8['id']);return createTicket(_0x23be6d,_0x239ad1,_0x2692e8,_0x5e274c,_0x9bfc5f,_0x5e274c[_0xd4be('0x53')],_0x52c77e);})['then'](function(_0x59d95c){_0x3e9658=_0x59d95c;logger['info'](_0xd4be('0x54'));logger[_0xd4be('0x18')](_0xd4be('0x55'),_0x3e9658['id']);var _0x634ac=util['format'](_0xd4be('0x56'),_0x23be6d[_0xd4be('0x2e')],_[_0xd4be('0x57')](_0x3e9658['id'],'x')[0x1]);logger[_0xd4be('0x18')](_0xd4be('0x58'),_0xd4be('0x59'));emit(util[_0xd4be('0x29')](_0xd4be('0x5a'),_0x10b58f['name']),_0xd4be('0x5b'),{'uri':_0x634ac});})[_0xd4be('0x2b')](function(_0x495b4e){logger[_0xd4be('0x2a')](_0xd4be('0x58'),JSON[_0xd4be('0x25')](_0x495b4e));});};exports[_0xd4be('0x5c')]=function(_0x49582f,_0xd17592,_0x21449c,_0x341279,_0x42cbc6,_0x4a27b3,_0x2e791f){var _0x4153d8,_0x46ce20,_0x1438d4,_0x28f1b4;_0x4a27b3[_0xd4be('0x2e')]=intUtil[_0xd4be('0x4a')](_0x4a27b3['remoteUri']);_0x4a27b3[_0xd4be('0x5d')]=intUtil[_0xd4be('0x4a')](_0x4a27b3[_0xd4be('0x5d')]);if(_0x2e791f&&_0x2e791f[_0xd4be('0x5e')]&&_0x2e791f['recordingFormat']!==_0xd4be('0x5f')){logger['info'](_0xd4be('0x60'),_0xd4be('0x4c'));_0xd17592['recordingURL']=util['format'](_0xd4be('0x4e'),_0x4a27b3['serverUrl'],_0xd17592[_0xd4be('0x4f')],md5(_0xd17592[_0xd4be('0x4f')]));}return getConnection(_0x4a27b3)[_0xd4be('0x26')](function(_0x1635b5){_0x28f1b4=_0x1635b5;return getUser(_0x4a27b3,_0x341279[_0xd4be('0x61')],_0x28f1b4);})[_0xd4be('0x26')](function(_0xb46ddb){_0x4153d8=_0xb46ddb;logger[_0xd4be('0x18')]('The\x20User\x20ID\x20is:',_0x4153d8['id']);return getEndUser(_0x4a27b3,_0xd17592[_0xd4be('0x62')],_0xd17592[_0xd4be('0x63')],_0x28f1b4);})[_0xd4be('0x26')](function(_0x51cb22){_0x46ce20=_0x51cb22;logger[_0xd4be('0x18')](_0xd4be('0x52'),_0x46ce20['id']);return createTicket(_0x4a27b3,_0x4153d8,_0x46ce20,_0x21449c,_0xd17592,_0x21449c['Fields'],_0x28f1b4);})[_0xd4be('0x26')](function(_0x59223a){_0x1438d4=_0x59223a;logger['info'](_0xd4be('0x54'));logger[_0xd4be('0x18')]('The\x20Ticket\x20ID\x20is:',_0x1438d4['id']);var _0x3a94ff=util[_0xd4be('0x29')](_0xd4be('0x56'),_0x4a27b3[_0xd4be('0x2e')],_[_0xd4be('0x57')](_0x1438d4['id'],'x')[0x1]);logger['info'](_0xd4be('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4be('0x29')](_0xd4be('0x5a'),_0x341279[_0xd4be('0x16')]),_0xd4be('0x5b'),{'uri':_0x3a94ff});})[_0xd4be('0x2b')](function(_0x11ca44){logger[_0xd4be('0x2a')]('[OUTBOUND]',JSON[_0xd4be('0x25')](_0x11ca44));});};exports[_0xd4be('0x64')]=function(_0x56657c,_0x371534,_0x213ac2,_0x3ff034,_0x17f04c,_0xecf06d){var _0x5917ea,_0x53c74a,_0x3c82ca,_0x4cee9d;_0xecf06d[_0xd4be('0x2e')]=intUtil[_0xd4be('0x4a')](_0xecf06d[_0xd4be('0x2e')]);_0xecf06d['serverUrl']=intUtil['stripTrailingSlash'](_0xecf06d[_0xd4be('0x5d')]);if(_0x17f04c&&_0x17f04c[_0xd4be('0x4b')]){logger[_0xd4be('0x18')]('['+_0x371534[_0xd4be('0x65')][_0xd4be('0x66')]()+']',_0xd4be('0x4c'));_0x371534[_0xd4be('0x4d')]=util[_0xd4be('0x29')](_0xd4be('0x4e'),_0xecf06d[_0xd4be('0x5d')],_0x371534[_0xd4be('0x4f')],md5(_0x371534[_0xd4be('0x4f')]));}else{_0x371534[_0xd4be('0x4d')]='';}return getConnection(_0xecf06d)[_0xd4be('0x26')](function(_0x15e5c7){_0x4cee9d=_0x15e5c7;return getUser(_0xecf06d,'',_0x4cee9d);})[_0xd4be('0x26')](function(_0x50aef6){_0x5917ea=_0x50aef6;logger[_0xd4be('0x18')](_0xd4be('0x50'),_0x5917ea['id']);return getEndUser(_0xecf06d,_0x371534[_0xd4be('0x67')],_0x371534[_0xd4be('0x51')],_0x4cee9d);})['then'](function(_0x24fc17){_0x53c74a=_0x24fc17;logger[_0xd4be('0x18')]('The\x20Enduser\x20ID\x20is:',_0x53c74a['id']);return createTicket(_0xecf06d,_0x5917ea,_0x53c74a,_0x213ac2,_0x371534,_0x213ac2['Fields'],_0x4cee9d);})[_0xd4be('0x26')](function(_0xfdf969){_0x3c82ca=_0xfdf969;logger[_0xd4be('0x18')](_0xd4be('0x54'));logger[_0xd4be('0x18')]('The\x20Ticket\x20ID\x20is:',_0x3c82ca['id']);})[_0xd4be('0x2b')](function(_0x30735f){logger[_0xd4be('0x2a')]('['+_0x371534[_0xd4be('0x65')]['toUpperCase']()+']',JSON[_0xd4be('0x25')](_0x30735f));});}; \ No newline at end of file +var _0x0454=['%s/webservice.php','remoteUri','create','username','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','info','Getting\x20agent\x20with\x20email','query','Agent\x20found!','resolve','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','GET','sessionName','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;','lastname','Enduser\x20created.','phone','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','socket.io-emitter','emit','length','type','string','content','toString','variableName','Variable','name','toLowerCase','idField','Creating\x20new\x20ticket...','Open','getString','Subjects','POST','format'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x0454,0x1c8));var _0x4045=function(_0x2e97a9,_0x172ff6){_0x2e97a9=_0x2e97a9-0x0;var _0x341774=_0x0454[_0x2e97a9];return _0x341774;};'use strict';var _=require(_0x4045('0x0'));var rp=require(_0x4045('0x1'));var BPromise=require(_0x4045('0x2'));var md5=require(_0x4045('0x3'));var util=require(_0x4045('0x4'));var Redis=require('ioredis');var intUtil=require(_0x4045('0x5'));var config=require(_0x4045('0x6'));var logger=require(_0x4045('0x7'))(_0x4045('0x8'));config[_0x4045('0x9')]=_[_0x4045('0xa')](config[_0x4045('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4045('0xb'))(new Redis(config[_0x4045('0x9')]));function emit(_0x4937fb,_0x3ce85f,_0x514763){io['to'](_0x4937fb)[_0x4045('0xc')](_0x3ce85f,_0x514763);}function getCustomFields(_0x5a69c6,_0xd20387){var _0x1e7b51={};if(_0x5a69c6[_0x4045('0xd')]>0x0){_['forEach'](_0x5a69c6,function(_0x19b495){if(_0x19b495[_0x4045('0xe')]===_0x4045('0xf')&&_0x19b495['idField']){_0x1e7b51[_0x19b495['idField']]=_0x19b495[_0x4045('0x10')][_0x4045('0x11')]();}else if(_0x19b495[_0x4045('0xe')]==='variable'&&_0x19b495[_0x4045('0x12')]&&_0x19b495['idField']&&_0xd20387[_0x19b495[_0x4045('0x12')]]){_0x1e7b51[_0x19b495['idField']]=_0xd20387[_0x19b495['variableName']][_0x4045('0x11')]();}else if(_0x19b495[_0x4045('0xe')]==='customVariable'&&_0x19b495[_0x4045('0x13')]&&_0x19b495[_0x4045('0x13')][_0x4045('0x14')]&&_0x19b495['idField']&&_0xd20387[_0x19b495['Variable'][_0x4045('0x14')][_0x4045('0x15')]()]){_0x1e7b51[_0x19b495[_0x4045('0x16')]]=_0xd20387[_0x19b495[_0x4045('0x13')][_0x4045('0x14')]['toLowerCase']()][_0x4045('0x11')]();}});}return _0x1e7b51;}function createTicket(_0x3b52d7,_0x1e992b,_0x7586a1,_0x44a638,_0x13d16d,_0x53f48f,_0x12efa8){logger['info'](_0x4045('0x17'));var _0x21a450=_['merge']({'parent_id':'','assigned_user_id':_0x1e992b['id'],'ticketpriorities':'Normal','ticketstatus':_0x4045('0x18'),'ticket_title':intUtil[_0x4045('0x19')](_0x44a638[_0x4045('0x1a')],_0x13d16d,'\x20'),'description':intUtil[_0x4045('0x19')](_0x44a638['Descriptions'],_0x13d16d,'\x0a'),'contact_id':_0x7586a1['id']},getCustomFields(_0x53f48f,_0x13d16d));var _0x3475fc={'method':_0x4045('0x1b'),'uri':util[_0x4045('0x1c')](_0x4045('0x1d'),_0x3b52d7[_0x4045('0x1e')]),'form':{'operation':_0x4045('0x1f'),'username':_0x3b52d7[_0x4045('0x20')],'sessionName':_0x12efa8['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x21a450)},'json':!![]};return request(_0x3475fc)[_0x4045('0x21')](function(_0x1dcc45){if(_0x1dcc45[_0x4045('0x22')]){return BPromise['resolve']({'id':_0x1dcc45[_0x4045('0x23')]['id']});}else{throw new Error(util[_0x4045('0x1c')](_0x4045('0x24'),JSON[_0x4045('0x25')](_0x1dcc45[_0x4045('0x26')])));}})[_0x4045('0x27')](function(_0x2186a8){var _0x146bd7=_0x2186a8[_0x4045('0x28')]||0x1f4;logger[_0x4045('0x26')](_0x4045('0x29'),_0x4045('0x2a'),_0x146bd7,JSON[_0x4045('0x25')](_0x2186a8));});}function getUser(_0x54312a,_0x5ef970,_0x342862){if(intUtil['validateEmail'](_0x5ef970)){logger[_0x4045('0x2b')](_0x4045('0x2c'),_0x5ef970);return request({'method':'GET','uri':util['format'](_0x4045('0x1d'),_0x54312a['remoteUri']),'qs':{'operation':_0x4045('0x2d'),'username':_0x54312a['username'],'sessionName':_0x342862['sessionName'],'query':util[_0x4045('0x1c')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x5ef970)},'json':!![]})[_0x4045('0x21')](function(_0x32ffe9){if(_0x32ffe9[_0x4045('0x22')]&&_0x32ffe9[_0x4045('0x23')][_0x4045('0xd')]){logger[_0x4045('0x2b')](_0x4045('0x2e'));return BPromise[_0x4045('0x2f')]({'id':_0x32ffe9[_0x4045('0x23')][0x0]['id'],'email':_0x32ffe9[_0x4045('0x23')][0x0][_0x4045('0x30')],'name':_0x32ffe9[_0x4045('0x23')][0x0][_0x4045('0x31')]+'\x20'+_0x32ffe9[_0x4045('0x23')][_0x4045('0x32')]});}else{logger[_0x4045('0x2b')](_0x4045('0x33'));return BPromise[_0x4045('0x2f')]({'id':_0x342862[_0x4045('0x34')],'email':_0x54312a[_0x4045('0x20')],'name':_0x4045('0x35')});}})['catch'](function(_0x1e4434){var _0x24c7fb=_0x1e4434[_0x4045('0x28')]||0x1f4;logger[_0x4045('0x26')](_0x4045('0x29'),'getUser',_0x24c7fb,JSON[_0x4045('0x25')](_0x1e4434));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x342862[_0x4045('0x34')],'email':_0x54312a[_0x4045('0x20')],'name':_0x4045('0x35')})[_0x4045('0x27')](function(_0x402ead){var _0x57cacd=_0x402ead['statusCode']||0x1f4;logger[_0x4045('0x26')](_0x4045('0x29'),_0x4045('0x36'),_0x57cacd,JSON['stringify'](_0x402ead));});}}function getEndUser(_0x26da6e,_0x9e3760,_0x420272,_0xb1e8ec){logger['info'](_0x4045('0x37'),_0x420272);return request({'method':_0x4045('0x38'),'uri':util['format'](_0x4045('0x1d'),_0x26da6e[_0x4045('0x1e')]),'qs':{'operation':_0x4045('0x2d'),'username':_0x26da6e[_0x4045('0x20')],'sessionName':_0xb1e8ec[_0x4045('0x39')],'query':util[_0x4045('0x1c')](_0x4045('0x3a'),_0x420272,_0x420272,_0x420272,_0x420272,_0x420272)},'json':!![]})[_0x4045('0x21')](function(_0x2a829a){if(_0x2a829a[_0x4045('0x22')]&&_0x2a829a[_0x4045('0x23')]['length']){logger[_0x4045('0x2b')]('Enduser\x20found!');return BPromise[_0x4045('0x2f')]({'id':_0x2a829a['result'][0x0]['id'],'name':_0x2a829a['result'][0x0]['firstname']+'\x20'+_0x2a829a[_0x4045('0x23')][0x0][_0x4045('0x3b')],'phone':_0x420272});}else{logger[_0x4045('0x2b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0x4045('0x1c')](_0x4045('0x1d'),_0x26da6e[_0x4045('0x1e')]),'form':{'operation':_0x4045('0x1f'),'sessionName':_0xb1e8ec[_0x4045('0x39')],'elementType':'Contacts','element':JSON[_0x4045('0x25')]({'lastname':_0x9e3760,'phone':_0x420272,'assigned_user_id':'\x20'})},'json':!![]})[_0x4045('0x21')](function(_0xb1ed29){logger[_0x4045('0x2b')](_0x4045('0x3c'));return BPromise[_0x4045('0x2f')]({'id':_0xb1ed29['result']['id'],'name':_0xb1ed29[_0x4045('0x23')][_0x4045('0x3b')],'phone':_0xb1ed29['result'][_0x4045('0x3d')]});})[_0x4045('0x27')](function(_0x525bcb){var _0x241872=_0x525bcb['statusCode']||0x1f4;logger['error'](_0x4045('0x29'),_0x4045('0x3e'),_0x241872,JSON[_0x4045('0x25')](_0x525bcb));});}});}function getConnection(_0x4bdf87){var _0x468416=_0x4bdf87[_0x4045('0x20')];var _0x4e0d30=_0x4bdf87[_0x4045('0x3f')];return request({'method':_0x4045('0x38'),'uri':util[_0x4045('0x1c')](_0x4045('0x1d'),_0x4bdf87['remoteUri']),'qs':{'operation':'getchallenge','username':_0x468416},'json':!![]})['then'](function(_0x447d71){if(_0x447d71[_0x4045('0x22')]){return request({'method':_0x4045('0x1b'),'uri':util[_0x4045('0x1c')]('%s/webservice.php',_0x4bdf87['remoteUri']),'form':{'operation':_0x4045('0x40'),'username':_0x468416,'accessKey':md5(_0x447d71['result'][_0x4045('0x41')]+_0x4e0d30)},'json':!![]});}})['then'](function(_0x4872e6){if(_0x4872e6[_0x4045('0x22')]){return BPromise[_0x4045('0x2f')](_0x4872e6[_0x4045('0x23')]);}else{throw new Error(util[_0x4045('0x1c')](_0x4045('0x42'),_0x4bdf87['id']));}})[_0x4045('0x27')](function(_0x4e0d1f){var _0x3b310c=_0x4e0d1f[_0x4045('0x28')]||0x1f4;logger[_0x4045('0x26')](_0x4045('0x29'),_0x4045('0x43'),_0x3b310c,JSON[_0x4045('0x25')](_0x4e0d1f));});}function request(_0x591cb2){logger['info']('[HTTP]',JSON['stringify'](_0x591cb2));return rp(_0x591cb2);}exports[_0x4045('0x44')]=function(_0x27a5c3,_0x2a32bb,_0x21399d,_0x3cb14c,_0x4ee512,_0x1fa019){var _0x209870,_0x4d12a3,_0x493b04,_0x22029e;_0x1fa019[_0x4045('0x1e')]=intUtil[_0x4045('0x45')](_0x1fa019[_0x4045('0x1e')]);if(_0x4ee512&&_0x4ee512[_0x4045('0x46')]){logger[_0x4045('0x2b')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2a32bb[_0x4045('0x47')]=util['format'](_0x4045('0x48'),_0x1fa019[_0x4045('0x49')],_0x2a32bb[_0x4045('0x4a')],md5(_0x2a32bb['uniqueid']));}else{_0x2a32bb[_0x4045('0x47')]='';}return getConnection(_0x1fa019)['then'](function(_0x2f59f4){_0x22029e=_0x2f59f4;return getUser(_0x1fa019,_0x3cb14c[_0x4045('0x4b')],_0x22029e);})[_0x4045('0x21')](function(_0x454b48){_0x209870=_0x454b48;logger[_0x4045('0x2b')](_0x4045('0x4c'),_0x209870['id']);return getEndUser(_0x1fa019,_0x2a32bb[_0x4045('0x4d')],_0x2a32bb['calleridnum'],_0x22029e);})[_0x4045('0x21')](function(_0xba8a72){_0x4d12a3=_0xba8a72;logger[_0x4045('0x2b')](_0x4045('0x4e'),_0x4d12a3['id']);return createTicket(_0x1fa019,_0x209870,_0x4d12a3,_0x21399d,_0x2a32bb,_0x21399d[_0x4045('0x4f')],_0x22029e);})[_0x4045('0x21')](function(_0x57d627){_0x493b04=_0x57d627;logger[_0x4045('0x2b')](_0x4045('0x50'));logger[_0x4045('0x2b')]('The\x20Ticket\x20ID\x20is:',_0x493b04['id']);var _0x480765=util[_0x4045('0x1c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1fa019['remoteUri'],_[_0x4045('0x51')](_0x493b04['id'],'x')[0x1]);logger[_0x4045('0x2b')](_0x4045('0x52'),_0x4045('0x53'));emit(util[_0x4045('0x1c')](_0x4045('0x54'),_0x3cb14c[_0x4045('0x14')]),_0x4045('0x55'),{'uri':_0x480765});})[_0x4045('0x27')](function(_0x186d9a){logger[_0x4045('0x26')]('[QUEUE]',JSON[_0x4045('0x25')](_0x186d9a));});};exports['outbound']=function(_0x1ddf02,_0x1f839e,_0x65e275,_0xd67b9e,_0xbf142,_0x405908,_0x322cf7){var _0x491a1e,_0x1a7938,_0x218c7a,_0x1c5861;_0x405908['remoteUri']=intUtil['stripTrailingSlash'](_0x405908[_0x4045('0x1e')]);_0x405908[_0x4045('0x49')]=intUtil[_0x4045('0x45')](_0x405908[_0x4045('0x49')]);if(_0x322cf7&&_0x322cf7[_0x4045('0x56')]&&_0x322cf7[_0x4045('0x56')]!==_0x4045('0x57')){logger[_0x4045('0x2b')]('[OUTBOUND]',_0x4045('0x58'));_0x1f839e[_0x4045('0x47')]=util[_0x4045('0x1c')](_0x4045('0x48'),_0x405908['serverUrl'],_0x1f839e[_0x4045('0x4a')],md5(_0x1f839e[_0x4045('0x4a')]));}return getConnection(_0x405908)['then'](function(_0x42fa00){_0x1c5861=_0x42fa00;return getUser(_0x405908,_0xd67b9e[_0x4045('0x4b')],_0x1c5861);})[_0x4045('0x21')](function(_0x41232c){_0x491a1e=_0x41232c;logger[_0x4045('0x2b')](_0x4045('0x4c'),_0x491a1e['id']);return getEndUser(_0x405908,_0x1f839e[_0x4045('0x59')],_0x1f839e[_0x4045('0x5a')],_0x1c5861);})['then'](function(_0x306a9a){_0x1a7938=_0x306a9a;logger['info'](_0x4045('0x4e'),_0x1a7938['id']);return createTicket(_0x405908,_0x491a1e,_0x1a7938,_0x65e275,_0x1f839e,_0x65e275['Fields'],_0x1c5861);})[_0x4045('0x21')](function(_0x863a78){_0x218c7a=_0x863a78;logger[_0x4045('0x2b')](_0x4045('0x50'));logger[_0x4045('0x2b')](_0x4045('0x5b'),_0x218c7a['id']);var _0x236506=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x405908[_0x4045('0x1e')],_[_0x4045('0x51')](_0x218c7a['id'],'x')[0x1]);logger[_0x4045('0x2b')](_0x4045('0x5c'),_0x4045('0x53'));emit(util[_0x4045('0x1c')](_0x4045('0x54'),_0xd67b9e[_0x4045('0x14')]),_0x4045('0x55'),{'uri':_0x236506});})[_0x4045('0x27')](function(_0x203579){logger['error'](_0x4045('0x5c'),JSON[_0x4045('0x25')](_0x203579));});};exports[_0x4045('0x5d')]=function(_0x186096,_0x317d8c,_0x220570,_0x523984,_0x162ba1,_0x360e68){var _0x5f35e0,_0x3d4ace,_0x176097,_0x1e0d29;_0x360e68[_0x4045('0x1e')]=intUtil[_0x4045('0x45')](_0x360e68[_0x4045('0x1e')]);_0x360e68[_0x4045('0x49')]=intUtil[_0x4045('0x45')](_0x360e68[_0x4045('0x49')]);if(_0x162ba1&&_0x162ba1[_0x4045('0x46')]){logger[_0x4045('0x2b')]('['+_0x317d8c[_0x4045('0x5e')][_0x4045('0x5f')]()+']',_0x4045('0x58'));_0x317d8c[_0x4045('0x47')]=util['format'](_0x4045('0x48'),_0x360e68[_0x4045('0x49')],_0x317d8c[_0x4045('0x4a')],md5(_0x317d8c[_0x4045('0x4a')]));}else{_0x317d8c['recordingURL']='';}return getConnection(_0x360e68)[_0x4045('0x21')](function(_0x4312eb){_0x1e0d29=_0x4312eb;return getUser(_0x360e68,'',_0x1e0d29);})['then'](function(_0x1dcf80){_0x5f35e0=_0x1dcf80;logger[_0x4045('0x2b')](_0x4045('0x4c'),_0x5f35e0['id']);return getEndUser(_0x360e68,_0x317d8c[_0x4045('0x4d')],_0x317d8c[_0x4045('0x60')],_0x1e0d29);})[_0x4045('0x21')](function(_0x25f70a){_0x3d4ace=_0x25f70a;logger[_0x4045('0x2b')](_0x4045('0x4e'),_0x3d4ace['id']);return createTicket(_0x360e68,_0x5f35e0,_0x3d4ace,_0x220570,_0x317d8c,_0x220570['Fields'],_0x1e0d29);})['then'](function(_0x45b5f5){_0x176097=_0x45b5f5;logger['info'](_0x4045('0x50'));logger[_0x4045('0x2b')](_0x4045('0x5b'),_0x176097['id']);})['catch'](function(_0x4cfbec){logger[_0x4045('0x26')]('['+_0x317d8c[_0x4045('0x5e')][_0x4045('0x5f')]()+']',JSON['stringify'](_0x4cfbec));});}; \ 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 9c7ceb8..16f0e30 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 _0xc077=['variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','name','getString','Subjects','Descriptions','Fields','then','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','results','length','filter','end-user','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','token','%s/token:%s','username','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','content','idField','custom_fields','push','toString'];(function(_0x28923b,_0xfaef3f){var _0x453678=function(_0x2e1e46){while(--_0x2e1e46){_0x28923b['push'](_0x28923b['shift']());}};_0x453678(++_0xfaef3f);}(_0xc077,0x16f));var _0x7c07=function(_0x40b898,_0x2fd575){_0x40b898=_0x40b898-0x0;var _0x2ff0bb=_0xc077[_0x40b898];return _0x2ff0bb;};'use strict';var _=require('lodash');var rp=require(_0x7c07('0x0'));var md5=require(_0x7c07('0x1'));var util=require(_0x7c07('0x2'));var Redis=require(_0x7c07('0x3'));var intUtil=require('./util');var config=require(_0x7c07('0x4'));var logger=require(_0x7c07('0x5'))(_0x7c07('0x6'));config[_0x7c07('0x7')]=_[_0x7c07('0x8')](config[_0x7c07('0x7')],{'host':_0x7c07('0x9'),'port':0x18eb});var io=require(_0x7c07('0xa'))(new Redis(config['redis']));function emit(_0x22df6b,_0x1159fb,_0x760812){io['to'](_0x22df6b)[_0x7c07('0xb')](_0x1159fb,_0x760812);}var headers={'Content-Type':_0x7c07('0xc'),'Accept':'application/json'};function getTicket(_0x20352a,_0x592708,_0x590208,_0x4b9437,_0x303874){logger[_0x7c07('0xd')](_0x7c07('0xe'));return request({'uri':util[_0x7c07('0xf')]('%s/tickets.json',_0x20352a[_0x7c07('0x10')]),'method':'POST','body':{'ticket':_[_0x7c07('0x11')]({'requester_id':_0x590208['id'],'submitter_id':_0x592708?_0x592708['id']:undefined,'assignee_id':_0x592708?_0x592708['id']:undefined,'tags':getTags(_0x4b9437['Tags'],_0x7c07('0x12')),'subject':intUtil[_0x7c07('0x13')](_0x4b9437[_0x7c07('0x14')],_0x303874,'\x20'),'description':intUtil[_0x7c07('0x13')](_0x4b9437[_0x7c07('0x15')],_0x303874,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4b9437['Descriptions'],_0x303874,'\x0a')}},getCustomFields(_0x4b9437[_0x7c07('0x16')],_0x303874))}})[_0x7c07('0x17')](function(_0x27b86b){logger[_0x7c07('0xd')]('Ticket\x20created!');return _0x27b86b['ticket'];});}function getUser(_0x272f72,_0x2f911d){if(intUtil[_0x7c07('0x18')](_0x2f911d)){logger[_0x7c07('0xd')](_0x7c07('0x19'),_0x2f911d);return request({'uri':util['format'](_0x7c07('0x1a'),_0x272f72[_0x7c07('0x10')]),'qs':{'query':util[_0x7c07('0xf')](_0x7c07('0x1b'),_0x2f911d)}})['then'](function(_0x3fb5f0){if(_0x3fb5f0[_0x7c07('0x1c')]){logger[_0x7c07('0xd')](_0x7c07('0x1d'));return _[_0x7c07('0x1e')](_0x3fb5f0['results'],{'email':_0x2f911d,'role':_0x7c07('0x1f')});}else{logger[_0x7c07('0xd')](_0x7c07('0x20'));return request({'uri':util['format'](_0x7c07('0x21'),_0x272f72[_0x7c07('0x10')])})[_0x7c07('0x17')](function(_0x594203){logger[_0x7c07('0xd')](_0x7c07('0x22'));return _0x594203[_0x7c07('0x23')];});}});}else{logger[_0x7c07('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x272f72[_0x7c07('0x10')])})['then'](function(_0x3a1f1e){logger[_0x7c07('0xd')](_0x7c07('0x22'));return _0x3a1f1e[_0x7c07('0x23')];});}}function getEndUser(_0x1b54b0,_0x1ea123,_0x4ebb12){logger[_0x7c07('0xd')]('Searching\x20enduser\x20with\x20phone',_0x4ebb12);return request({'uri':util[_0x7c07('0xf')](_0x7c07('0x1a'),_0x1b54b0['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x4ebb12)}})[_0x7c07('0x17')](function(_0x765a79){var _0x34fcf7;if(_0x765a79[_0x7c07('0x24')][_0x7c07('0x25')]){_0x765a79[_0x7c07('0x24')]=_[_0x7c07('0x26')](_0x765a79[_0x7c07('0x24')],{'suspended':![],'role':_0x7c07('0x27')});if(_0x765a79['results']['length']){_0x34fcf7=_['first'](_0x765a79[_0x7c07('0x24')]);}}if(_0x34fcf7){logger[_0x7c07('0xd')](_0x7c07('0x28'));return _0x34fcf7;}else{logger[_0x7c07('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7c07('0xf')](_0x7c07('0x29'),_0x1b54b0[_0x7c07('0x10')]),'method':_0x7c07('0x2a'),'body':{'user':{'role':_0x7c07('0x27'),'name':util[_0x7c07('0xf')](_0x7c07('0x2b'),_0x1ea123||_0x4ebb12),'phone':_0x4ebb12}}})[_0x7c07('0x17')](function(_0x5d0322){logger['info'](_0x7c07('0x2c'));return _0x5d0322[_0x7c07('0x23')];});}});}function getAuth(_0x861a0f){var _0x4abe81;if(_0x861a0f[_0x7c07('0x2d')]==='password'){_0x4abe81=util[_0x7c07('0xf')](_0x7c07('0x2e'),_0x861a0f['username'],_0x861a0f['password']);}else if(_0x861a0f[_0x7c07('0x2d')]===_0x7c07('0x2f')){_0x4abe81=util[_0x7c07('0xf')](_0x7c07('0x30'),_0x861a0f[_0x7c07('0x31')],_0x861a0f['token']);}return util['format']('Basic\x20%s',new Buffer(_0x4abe81)['toString']('base64'));}function request(_0x4fe54c){logger[_0x7c07('0x32')](_0x7c07('0x33'),JSON[_0x7c07('0x34')](_0x4fe54c));return rp(_[_0x7c07('0x8')](_0x4fe54c,{'method':_0x7c07('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x46a228,_0x29a5c9){var _0x5eb69e=[];if(_0x46a228&&_0x46a228[_0x7c07('0x25')]>0x0){_0x5eb69e=_[_0x7c07('0x36')](_0x46a228,_0x29a5c9);}return _0x5eb69e;}function getCustomFields(_0x48b5f4,_0x424649){var _0x22dd13=[];var _0x4f3cf3={'custom_fields':[]};if(_0x48b5f4['length']>0x0){_[_0x7c07('0x37')](_0x48b5f4,function(_0x15ce0a){if(_0x15ce0a[_0x7c07('0x38')]===_0x7c07('0x39')&&_0x15ce0a[_0x7c07('0x3a')]&&!_0x15ce0a[_0x7c07('0x3b')]){_0x4f3cf3[_0x15ce0a['nameField']['toLowerCase']()]=_0x15ce0a[_0x7c07('0x3c')]['toString']();}else if(_0x15ce0a[_0x7c07('0x38')]===_0x7c07('0x39')&&_0x15ce0a[_0x7c07('0x3d')]&&_0x15ce0a['customField']){_0x4f3cf3[_0x7c07('0x3e')][_0x7c07('0x3f')]({'id':_0x15ce0a[_0x7c07('0x3d')],'value':_0x15ce0a[_0x7c07('0x3c')][_0x7c07('0x40')]()});}else if(_0x15ce0a[_0x7c07('0x38')]===_0x7c07('0x41')&&_0x15ce0a[_0x7c07('0x42')]&&_0x15ce0a[_0x7c07('0x3d')]&&_0x15ce0a[_0x7c07('0x3b')]){_0x424649[_0x15ce0a[_0x7c07('0x42')]]&&_0x4f3cf3[_0x7c07('0x3e')][_0x7c07('0x3f')]({'id':_0x15ce0a[_0x7c07('0x3d')],'value':_0x424649[_0x15ce0a['variableName']][_0x7c07('0x40')]()});}else if(_0x15ce0a[_0x7c07('0x38')]===_0x7c07('0x43')&&_0x15ce0a[_0x7c07('0x44')]&&_0x15ce0a['Variable']['name']&&_0x15ce0a[_0x7c07('0x3d')]&&_0x15ce0a[_0x7c07('0x3b')]){_0x424649[_0x15ce0a[_0x7c07('0x44')]['name'][_0x7c07('0x45')]()]&&_0x4f3cf3['custom_fields']['push']({'id':_0x15ce0a['idField'],'value':_0x424649[_0x15ce0a[_0x7c07('0x44')][_0x7c07('0x12')][_0x7c07('0x45')]()][_0x7c07('0x40')]()});}});}return _0x4f3cf3;}exports[_0x7c07('0x46')]=function(_0x381732,_0x59c439,_0x1b74f4,_0x5bdf97,_0x345ca6,_0x464d10){var _0x4ebfab,_0x7ed799;_0x464d10['remoteUri']=intUtil[_0x7c07('0x47')](_0x464d10[_0x7c07('0x10')]);_0x464d10['serverUrl']=intUtil[_0x7c07('0x47')](_0x464d10[_0x7c07('0x48')]);if(_0x345ca6&&_0x345ca6['monitor_format']){logger['info']('[QUEUE]',_0x7c07('0x49'));_0x59c439['recordingURL']=util[_0x7c07('0xf')](_0x7c07('0x4a'),_0x464d10[_0x7c07('0x48')],_0x59c439['uniqueid'],md5(_0x59c439['uniqueid']));}else{_0x59c439[_0x7c07('0x4b')]='';}headers[_0x7c07('0x4c')]=getAuth(_0x464d10);return getUser(_0x464d10,_0x5bdf97[_0x7c07('0x4d')])[_0x7c07('0x17')](function(_0x4cff16){_0x4ebfab=_0x4cff16;logger['info'](_0x7c07('0x4e'),_0x4ebfab['id']);return getEndUser(_0x464d10,_0x59c439['calleridname'],_0x59c439['calleridnum']);})[_0x7c07('0x17')](function(_0xa8470e){_0x7ed799=_0xa8470e;logger['info'](_0x7c07('0x4f'),_0x7ed799['id']);return getTicket(_0x464d10,_0x4ebfab,_0x7ed799,_0x1b74f4,_0x59c439);})[_0x7c07('0x17')](function(_0x249ba5){if(_0x249ba5){logger[_0x7c07('0xd')](_0x7c07('0x50'),_0x249ba5['id']);switch(_0x464d10['type']){case _0x7c07('0x51'):logger[_0x7c07('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7c07('0xf')](_0x7c07('0x52'),_0x464d10['remoteUri'],_0x4ebfab['id'],_0x249ba5['id']),'method':_0x7c07('0x2a')});case _0x7c07('0x53'):logger[_0x7c07('0xd')](_0x7c07('0x54'),_0x7c07('0x55'));emit(util[_0x7c07('0xf')](_0x7c07('0x56'),_0x5bdf97[_0x7c07('0x12')]),_0x7c07('0x57'),{'uri':util[_0x7c07('0xf')](_0x7c07('0x58'),_0x464d10[_0x7c07('0x10')][_0x7c07('0x59')](_0x7c07('0x5a'),''),_0x249ba5['id'])});break;default:logger['error']('[QUEUE]',_0x7c07('0x5b'));}}})[_0x7c07('0x5c')](function(_0x55d858){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7c07('0x5d')](_0x55d858,{'showHidden':!![],'depth':null}));});};exports[_0x7c07('0x5e')]=function(_0x5e224c,_0x4187b5,_0x3e5742,_0x11f6a8,_0x10e638,_0x34b8f1,_0x2897c1){var _0x4f08dd,_0x4ba7ac;_0x34b8f1[_0x7c07('0x10')]=intUtil[_0x7c07('0x47')](_0x34b8f1[_0x7c07('0x10')]);_0x34b8f1['serverUrl']=intUtil[_0x7c07('0x47')](_0x34b8f1[_0x7c07('0x48')]);if(_0x2897c1&&_0x2897c1[_0x7c07('0x5f')]&&_0x2897c1['recordingFormat']!=='none'){logger['info'](_0x7c07('0x60'),'Recording\x20is\x20enabled!');_0x4187b5[_0x7c07('0x4b')]=util['format'](_0x7c07('0x4a'),_0x34b8f1[_0x7c07('0x48')],_0x4187b5['uniqueid'],md5(_0x4187b5[_0x7c07('0x61')]));}headers['Authorization']=getAuth(_0x34b8f1);return getUser(_0x34b8f1,_0x11f6a8['email'])[_0x7c07('0x17')](function(_0x3acd04){_0x4f08dd=_0x3acd04;logger['info'](_0x7c07('0x4e'),_0x4f08dd['id']);return getEndUser(_0x34b8f1,_0x4187b5[_0x7c07('0x62')],_0x4187b5[_0x7c07('0x63')]);})[_0x7c07('0x17')](function(_0x3e24e0){_0x4ba7ac=_0x3e24e0;logger[_0x7c07('0xd')]('The\x20Enduser\x20ID\x20is:',_0x4ba7ac['id']);return getTicket(_0x34b8f1,_0x4f08dd,_0x4ba7ac,_0x3e5742,_0x4187b5);})[_0x7c07('0x17')](function(_0x319f8a){if(_0x319f8a){logger[_0x7c07('0xd')](_0x7c07('0x50'),_0x319f8a['id']);switch(_0x34b8f1[_0x7c07('0x38')]){case _0x7c07('0x51'):logger[_0x7c07('0xd')](_0x7c07('0x60'),_0x7c07('0x64'));return request({'uri':util[_0x7c07('0xf')](_0x7c07('0x52'),_0x34b8f1[_0x7c07('0x10')],_0x4f08dd['id'],_0x319f8a['id']),'method':'POST'});case'newTab':logger[_0x7c07('0xd')](_0x7c07('0x60'),_0x7c07('0x55'));emit(util['format']('user:%s',_0x11f6a8[_0x7c07('0x12')]),_0x7c07('0x57'),{'uri':util[_0x7c07('0xf')](_0x7c07('0x58'),_0x34b8f1['remoteUri'][_0x7c07('0x59')](_0x7c07('0x5a'),''),_0x319f8a['id'])});break;default:logger[_0x7c07('0x65')](_0x7c07('0x60'),_0x7c07('0x5b'));}}})[_0x7c07('0x5c')](function(_0x1d955e){logger[_0x7c07('0x65')](_0x7c07('0x66'),util[_0x7c07('0x5d')](_0x1d955e,{'showHidden':!![],'depth':null}));});};exports[_0x7c07('0x67')]=function(_0x33f297,_0x215d9b,_0x542574,_0x5b2ab2,_0x4f6143,_0x5e7bba){var _0x2d9f8e,_0x51b43d;_0x5e7bba[_0x7c07('0x10')]=intUtil['stripTrailingSlash'](_0x5e7bba[_0x7c07('0x10')]);_0x5e7bba[_0x7c07('0x48')]=intUtil[_0x7c07('0x47')](_0x5e7bba[_0x7c07('0x48')]);if(_0x4f6143&&_0x4f6143[_0x7c07('0x68')]){logger['info']('['+_0x215d9b['lastevent'][_0x7c07('0x69')]()+']','Recording\x20is\x20enabled!');_0x215d9b['recordingURL']=util[_0x7c07('0xf')](_0x7c07('0x4a'),_0x5e7bba[_0x7c07('0x48')],_0x215d9b[_0x7c07('0x61')],md5(_0x215d9b[_0x7c07('0x61')]));}else{_0x215d9b[_0x7c07('0x4b')]='';}headers[_0x7c07('0x4c')]=getAuth(_0x5e7bba);return getUser(_0x5e7bba)[_0x7c07('0x17')](function(_0x4ccac8){_0x2d9f8e=_0x4ccac8;logger[_0x7c07('0xd')]('The\x20User\x20ID\x20is:',_0x2d9f8e['id']);return getEndUser(_0x5e7bba,_0x215d9b['calleridname'],_0x215d9b[_0x7c07('0x6a')]);})[_0x7c07('0x17')](function(_0x4b4e3c){_0x51b43d=_0x4b4e3c;logger[_0x7c07('0xd')](_0x7c07('0x4f'),_0x51b43d['id']);return getTicket(_0x5e7bba,_0x2d9f8e,_0x51b43d,_0x542574,_0x215d9b);})['then'](function(_0x1653b0){if(_0x1653b0){logger['info'](_0x7c07('0x50'),_0x1653b0['id']);}})['catch'](function(_0x1dba8a){logger[_0x7c07('0x65')]('['+_0x215d9b[_0x7c07('0x6b')][_0x7c07('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7c07('0x5d')](_0x1dba8a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x557b=['monitor_format','calleridname','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','zendesk','defaults','redis','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','name','Subjects','getString','Descriptions','Fields','info','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','destcalleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x557b,0x1b9));var _0xb557=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x557b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xb557('0x0'));var util=require(_0xb557('0x1'));var Redis=require(_0xb557('0x2'));var intUtil=require(_0xb557('0x3'));var config=require(_0xb557('0x4'));var logger=require('../../../../config/logger')(_0xb557('0x5'));config['redis']=_[_0xb557('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb557('0x7')]));function emit(_0x21cb94,_0x2a9917,_0x15eded){io['to'](_0x21cb94)[_0xb557('0x8')](_0x2a9917,_0x15eded);}var headers={'Content-Type':_0xb557('0x9'),'Accept':_0xb557('0x9')};function getTicket(_0x42f48b,_0x3c5cc1,_0x29c0d9,_0x212ec5,_0x31151c){logger['info'](_0xb557('0xa'));return request({'uri':util[_0xb557('0xb')]('%s/tickets.json',_0x42f48b[_0xb557('0xc')]),'method':_0xb557('0xd'),'body':{'ticket':_[_0xb557('0xe')]({'requester_id':_0x29c0d9['id'],'submitter_id':_0x3c5cc1?_0x3c5cc1['id']:undefined,'assignee_id':_0x3c5cc1?_0x3c5cc1['id']:undefined,'tags':getTags(_0x212ec5['Tags'],_0xb557('0xf')),'subject':intUtil['getString'](_0x212ec5[_0xb557('0x10')],_0x31151c,'\x20'),'description':intUtil[_0xb557('0x11')](_0x212ec5[_0xb557('0x12')],_0x31151c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x212ec5[_0xb557('0x12')],_0x31151c,'\x0a')}},getCustomFields(_0x212ec5[_0xb557('0x13')],_0x31151c))}})['then'](function(_0x404a37){logger[_0xb557('0x14')]('Ticket\x20created!');return _0x404a37[_0xb557('0x15')];});}function getUser(_0x1204e6,_0x293fc8){if(intUtil['validateEmail'](_0x293fc8)){logger[_0xb557('0x14')](_0xb557('0x16'),_0x293fc8);return request({'uri':util[_0xb557('0xb')](_0xb557('0x17'),_0x1204e6[_0xb557('0xc')]),'qs':{'query':util['format'](_0xb557('0x18'),_0x293fc8)}})['then'](function(_0x107882){if(_0x107882[_0xb557('0x19')]){logger['info'](_0xb557('0x1a'));return _[_0xb557('0x1b')](_0x107882['results'],{'email':_0x293fc8,'role':_0xb557('0x1c')});}else{logger['info'](_0xb557('0x1d'));return request({'uri':util[_0xb557('0xb')](_0xb557('0x1e'),_0x1204e6[_0xb557('0xc')])})[_0xb557('0x1f')](function(_0x2acec5){logger[_0xb557('0x14')](_0xb557('0x20'));return _0x2acec5[_0xb557('0x21')];});}});}else{logger[_0xb557('0x14')](_0xb557('0x1d'));return request({'uri':util['format'](_0xb557('0x1e'),_0x1204e6['remoteUri'])})[_0xb557('0x1f')](function(_0x2b3585){logger['info']('Admin\x20account\x20selected.');return _0x2b3585[_0xb557('0x21')];});}}function getEndUser(_0x2aae06,_0x12e1fb,_0x4ab40d){logger['info'](_0xb557('0x22'),_0x4ab40d);return request({'uri':util[_0xb557('0xb')](_0xb557('0x17'),_0x2aae06['remoteUri']),'qs':{'query':util[_0xb557('0xb')](_0xb557('0x23'),_0x4ab40d)}})[_0xb557('0x1f')](function(_0x4392ea){var _0x3e874d;if(_0x4392ea[_0xb557('0x24')][_0xb557('0x25')]){_0x4392ea['results']=_[_0xb557('0x26')](_0x4392ea[_0xb557('0x24')],{'suspended':![],'role':_0xb557('0x27')});if(_0x4392ea[_0xb557('0x24')][_0xb557('0x25')]){_0x3e874d=_[_0xb557('0x28')](_0x4392ea['results']);}}if(_0x3e874d){logger[_0xb557('0x14')](_0xb557('0x29'));return _0x3e874d;}else{logger['info'](_0xb557('0x2a'));return request({'uri':util[_0xb557('0xb')](_0xb557('0x2b'),_0x2aae06[_0xb557('0xc')]),'method':_0xb557('0xd'),'body':{'user':{'role':_0xb557('0x27'),'name':util['format'](_0xb557('0x2c'),_0x12e1fb||_0x4ab40d),'phone':_0x4ab40d}}})[_0xb557('0x1f')](function(_0x54e07c){logger[_0xb557('0x14')]('Enduser\x20created.');return _0x54e07c[_0xb557('0x21')];});}});}function getAuth(_0x4c9425){var _0x12a1d7;if(_0x4c9425[_0xb557('0x2d')]===_0xb557('0x2e')){_0x12a1d7=util[_0xb557('0xb')]('%s:%s',_0x4c9425[_0xb557('0x2f')],_0x4c9425[_0xb557('0x2e')]);}else if(_0x4c9425['authType']===_0xb557('0x30')){_0x12a1d7=util[_0xb557('0xb')](_0xb557('0x31'),_0x4c9425[_0xb557('0x2f')],_0x4c9425[_0xb557('0x30')]);}return util['format'](_0xb557('0x32'),new Buffer(_0x12a1d7)[_0xb557('0x33')](_0xb557('0x34')));}function request(_0x17fbd3){logger[_0xb557('0x35')](_0xb557('0x36'),JSON['stringify'](_0x17fbd3));return rp(_[_0xb557('0x6')](_0x17fbd3,{'method':_0xb557('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x2a2517,_0x136b63){var _0x1c9093=[];if(_0x2a2517&&_0x2a2517['length']>0x0){_0x1c9093=_[_0xb557('0x38')](_0x2a2517,_0x136b63);}return _0x1c9093;}function getCustomFields(_0x4cfd9c,_0x1c12ba){var _0x1a6949=[];var _0x436b0c={'custom_fields':[]};if(_0x4cfd9c['length']>0x0){_[_0xb557('0x39')](_0x4cfd9c,function(_0x146708){if(_0x146708[_0xb557('0x3a')]===_0xb557('0x3b')&&_0x146708[_0xb557('0x3c')]&&!_0x146708[_0xb557('0x3d')]){_0x436b0c[_0x146708['nameField'][_0xb557('0x3e')]()]=_0x146708[_0xb557('0x3f')][_0xb557('0x33')]();}else if(_0x146708['type']===_0xb557('0x3b')&&_0x146708[_0xb557('0x40')]&&_0x146708[_0xb557('0x3d')]){_0x436b0c['custom_fields'][_0xb557('0x41')]({'id':_0x146708['idField'],'value':_0x146708['content'][_0xb557('0x33')]()});}else if(_0x146708['type']===_0xb557('0x42')&&_0x146708[_0xb557('0x43')]&&_0x146708['idField']&&_0x146708[_0xb557('0x3d')]){_0x1c12ba[_0x146708[_0xb557('0x43')]]&&_0x436b0c[_0xb557('0x44')][_0xb557('0x41')]({'id':_0x146708[_0xb557('0x40')],'value':_0x1c12ba[_0x146708[_0xb557('0x43')]]['toString']()});}else if(_0x146708[_0xb557('0x3a')]===_0xb557('0x45')&&_0x146708[_0xb557('0x46')]&&_0x146708['Variable']['name']&&_0x146708[_0xb557('0x40')]&&_0x146708[_0xb557('0x3d')]){_0x1c12ba[_0x146708[_0xb557('0x46')][_0xb557('0xf')]['toLowerCase']()]&&_0x436b0c['custom_fields'][_0xb557('0x41')]({'id':_0x146708[_0xb557('0x40')],'value':_0x1c12ba[_0x146708[_0xb557('0x46')]['name'][_0xb557('0x3e')]()][_0xb557('0x33')]()});}});}return _0x436b0c;}exports[_0xb557('0x47')]=function(_0x4f0e3f,_0x35cbf5,_0xe38a1,_0x4da4cb,_0x424268,_0x2c7e52){var _0x4a13a7,_0x42eec3;_0x2c7e52[_0xb557('0xc')]=intUtil['stripTrailingSlash'](_0x2c7e52[_0xb557('0xc')]);_0x2c7e52['serverUrl']=intUtil[_0xb557('0x48')](_0x2c7e52[_0xb557('0x49')]);if(_0x424268&&_0x424268['monitor_format']){logger[_0xb557('0x14')](_0xb557('0x4a'),_0xb557('0x4b'));_0x35cbf5[_0xb557('0x4c')]=util[_0xb557('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c7e52[_0xb557('0x49')],_0x35cbf5['uniqueid'],md5(_0x35cbf5['uniqueid']));}else{_0x35cbf5[_0xb557('0x4c')]='';}headers[_0xb557('0x4d')]=getAuth(_0x2c7e52);return getUser(_0x2c7e52,_0x4da4cb['email'])[_0xb557('0x1f')](function(_0x249685){_0x4a13a7=_0x249685;logger[_0xb557('0x14')](_0xb557('0x4e'),_0x4a13a7['id']);return getEndUser(_0x2c7e52,_0x35cbf5['calleridname'],_0x35cbf5[_0xb557('0x4f')]);})['then'](function(_0x3f70be){_0x42eec3=_0x3f70be;logger[_0xb557('0x14')]('The\x20Enduser\x20ID\x20is:',_0x42eec3['id']);return getTicket(_0x2c7e52,_0x4a13a7,_0x42eec3,_0xe38a1,_0x35cbf5);})[_0xb557('0x1f')](function(_0x465b41){if(_0x465b41){logger['info'](_0xb557('0x50'),_0x465b41['id']);switch(_0x2c7e52[_0xb557('0x3a')]){case _0xb557('0x51'):logger[_0xb557('0x14')](_0xb557('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb557('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2c7e52[_0xb557('0xc')],_0x4a13a7['id'],_0x465b41['id']),'method':_0xb557('0xd')});case _0xb557('0x52'):logger['info']('[QUEUE]',_0xb557('0x53'));emit(util['format'](_0xb557('0x54'),_0x4da4cb[_0xb557('0xf')]),_0xb557('0x55'),{'uri':util[_0xb557('0xb')](_0xb557('0x56'),_0x2c7e52[_0xb557('0xc')][_0xb557('0x57')](_0xb557('0x58'),''),_0x465b41['id'])});break;default:logger[_0xb557('0x59')](_0xb557('0x4a'),_0xb557('0x5a'));}}})[_0xb557('0x5b')](function(_0x175637){logger[_0xb557('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb557('0x5c')](_0x175637,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5387c4,_0x2c9e93,_0x3dde24,_0x2257a8,_0x5024bd,_0x56e5fc,_0x582741){var _0x3f30f6,_0x25f1e9;_0x56e5fc[_0xb557('0xc')]=intUtil['stripTrailingSlash'](_0x56e5fc['remoteUri']);_0x56e5fc['serverUrl']=intUtil[_0xb557('0x48')](_0x56e5fc[_0xb557('0x49')]);if(_0x582741&&_0x582741[_0xb557('0x5d')]&&_0x582741['recordingFormat']!==_0xb557('0x5e')){logger[_0xb557('0x14')](_0xb557('0x5f'),_0xb557('0x4b'));_0x2c9e93['recordingURL']=util[_0xb557('0xb')](_0xb557('0x60'),_0x56e5fc[_0xb557('0x49')],_0x2c9e93['uniqueid'],md5(_0x2c9e93[_0xb557('0x61')]));}headers[_0xb557('0x4d')]=getAuth(_0x56e5fc);return getUser(_0x56e5fc,_0x2257a8[_0xb557('0x62')])[_0xb557('0x1f')](function(_0x5bf89c){_0x3f30f6=_0x5bf89c;logger[_0xb557('0x14')](_0xb557('0x4e'),_0x3f30f6['id']);return getEndUser(_0x56e5fc,_0x2c9e93[_0xb557('0x63')],_0x2c9e93['destcalleridnum']);})[_0xb557('0x1f')](function(_0x34df79){_0x25f1e9=_0x34df79;logger[_0xb557('0x14')](_0xb557('0x64'),_0x25f1e9['id']);return getTicket(_0x56e5fc,_0x3f30f6,_0x25f1e9,_0x3dde24,_0x2c9e93);})[_0xb557('0x1f')](function(_0x3eb768){if(_0x3eb768){logger[_0xb557('0x14')](_0xb557('0x50'),_0x3eb768['id']);switch(_0x56e5fc[_0xb557('0x3a')]){case _0xb557('0x51'):logger['info'](_0xb557('0x5f'),_0xb557('0x65'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x56e5fc[_0xb557('0xc')],_0x3f30f6['id'],_0x3eb768['id']),'method':_0xb557('0xd')});case _0xb557('0x52'):logger[_0xb557('0x14')](_0xb557('0x5f'),_0xb557('0x53'));emit(util[_0xb557('0xb')](_0xb557('0x54'),_0x2257a8[_0xb557('0xf')]),_0xb557('0x55'),{'uri':util['format']('%s/agent/tickets/%s',_0x56e5fc[_0xb557('0xc')][_0xb557('0x57')]('/api/v2',''),_0x3eb768['id'])});break;default:logger[_0xb557('0x59')](_0xb557('0x5f'),_0xb557('0x5a'));}}})[_0xb557('0x5b')](function(_0x95acb4){logger[_0xb557('0x59')](_0xb557('0x66'),util['inspect'](_0x95acb4,{'showHidden':!![],'depth':null}));});};exports[_0xb557('0x67')]=function(_0x34fac8,_0x22d167,_0x26127e,_0x18de68,_0x3a75b0,_0x2ce320){var _0x28cfb4,_0x2dfdd7;_0x2ce320[_0xb557('0xc')]=intUtil[_0xb557('0x48')](_0x2ce320[_0xb557('0xc')]);_0x2ce320[_0xb557('0x49')]=intUtil[_0xb557('0x48')](_0x2ce320['serverUrl']);if(_0x3a75b0&&_0x3a75b0[_0xb557('0x68')]){logger[_0xb557('0x14')]('['+_0x22d167['lastevent']['toUpperCase']()+']',_0xb557('0x4b'));_0x22d167[_0xb557('0x4c')]=util[_0xb557('0xb')](_0xb557('0x60'),_0x2ce320['serverUrl'],_0x22d167[_0xb557('0x61')],md5(_0x22d167[_0xb557('0x61')]));}else{_0x22d167[_0xb557('0x4c')]='';}headers['Authorization']=getAuth(_0x2ce320);return getUser(_0x2ce320)['then'](function(_0x1afd49){_0x28cfb4=_0x1afd49;logger[_0xb557('0x14')](_0xb557('0x4e'),_0x28cfb4['id']);return getEndUser(_0x2ce320,_0x22d167[_0xb557('0x69')],_0x22d167[_0xb557('0x4f')]);})[_0xb557('0x1f')](function(_0x3bcfae){_0x2dfdd7=_0x3bcfae;logger[_0xb557('0x14')](_0xb557('0x64'),_0x2dfdd7['id']);return getTicket(_0x2ce320,_0x28cfb4,_0x2dfdd7,_0x26127e,_0x22d167);})['then'](function(_0x108481){if(_0x108481){logger['info'](_0xb557('0x50'),_0x108481['id']);}})[_0xb557('0x5b')](function(_0x34a8f2){logger['error']('['+_0x22d167[_0xb557('0x6a')][_0xb557('0x6b')]()+']'+_0xb557('0x6c'),util[_0xb557('0x5c')](_0x34a8f2,{'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 29b1e22..293faf3 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 _0x9ea8=['/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','request-promise','md5','util','./util','moment','bluebird','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','lead','Leads','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','queue','host','serverUrl','monitor_format','[QUEUE]','recordingURL'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x9ea8,0x147));var _0x89ea=function(_0x1e67ca,_0x11a673){_0x1e67ca=_0x1e67ca-0x0;var _0x4da401=_0x9ea8[_0x1e67ca];return _0x4da401;};'use strict';var _=require('lodash');var rp=require(_0x89ea('0x0'));var md5=require(_0x89ea('0x1'));var util=require(_0x89ea('0x2'));var intUtil=require(_0x89ea('0x3'));var moment=require(_0x89ea('0x4'));var Redis=require('ioredis');var BPromise=require(_0x89ea('0x5'));var config=require('../../../../config/environment');var logger=require(_0x89ea('0x6'))('zoho');config['redis']=_[_0x89ea('0x7')](config[_0x89ea('0x8')],{'host':_0x89ea('0x9'),'port':0x18eb});var io=require(_0x89ea('0xa'))(new Redis(config['redis']));function emit(_0x5bbc97,_0x42a6f3,_0x23abbe){io['to'](_0x5bbc97)[_0x89ea('0xb')](_0x42a6f3,_0x23abbe);}function request(_0x21ad04){logger[_0x89ea('0xc')](_0x89ea('0xd'),JSON[_0x89ea('0xe')](_0x21ad04));return rp(_0x21ad04);}function getCustomFields(_0x424e05,_0x22813e){var _0x4138c1={};if(_0x424e05[_0x89ea('0xf')]>0x0){_[_0x89ea('0x10')](_0x424e05,function(_0x46197b){if(_0x46197b[_0x89ea('0x11')]===_0x89ea('0x12')&&_0x46197b['idField']){_0x4138c1[_0x46197b[_0x89ea('0x13')]]=_0x46197b[_0x89ea('0x14')][_0x89ea('0x15')]();}else if(_0x46197b['type']===_0x89ea('0x16')&&_0x46197b[_0x89ea('0x17')]&&_0x46197b['idField']&&_0x22813e[_0x46197b['variableName']]){_0x4138c1[_0x46197b[_0x89ea('0x13')]]=_0x22813e[_0x46197b[_0x89ea('0x17')]][_0x89ea('0x15')]();}else if(_0x46197b[_0x89ea('0x11')]===_0x89ea('0x18')&&_0x46197b[_0x89ea('0x19')]&&_0x46197b['Variable'][_0x89ea('0x1a')]&&_0x46197b[_0x89ea('0x13')]&&_0x22813e[_0x46197b[_0x89ea('0x19')][_0x89ea('0x1a')]['toLowerCase']()]){_0x4138c1[_0x46197b['idField']]=_0x22813e[_0x46197b[_0x89ea('0x19')][_0x89ea('0x1a')][_0x89ea('0x1b')]()][_0x89ea('0x15')]();}});}return _0x4138c1;}function getName(_0x38c28c){if(_0x38c28c[_0x89ea('0x1c')]('\x20')>0x0){var _0x2b49ec=_0x38c28c[_0x89ea('0x1d')](/ (.+)/);if(_0x2b49ec[0x1]){return _0x2b49ec;}}return[_0x38c28c,_0x38c28c];}var accountsTokens={};function getAccessToken(_0x5d9bae){return new Promise(function(_0x4ac655,_0x329e9f){if(!_['isNil'](accountsTokens[_0x5d9bae['id']])&&!_[_0x89ea('0x1e')](accountsTokens[_0x5d9bae['id']][_0x89ea('0x1f')])){if(moment()[_0x89ea('0x20')](accountsTokens[_0x5d9bae['id']][_0x89ea('0x21')])){_0x4ac655(accountsTokens[_0x5d9bae['id']][_0x89ea('0x1f')]);}}var _0x1d12ce;switch(_0x5d9bae[_0x89ea('0x22')]){case'US':_0x1d12ce='https://accounts.zoho.com';break;case'AU':_0x1d12ce=_0x89ea('0x23');break;case'EU':_0x1d12ce=_0x89ea('0x24');break;case'IN':_0x1d12ce='https://accounts.zoho.in';break;case'CN':_0x1d12ce='https://accounts.zoho.com.cn';break;default:_0x1d12ce=_0x89ea('0x24');break;}var _0x10a4b3={'method':_0x89ea('0x25'),'uri':_0x1d12ce+_0x89ea('0x26'),'qs':{'refresh_token':_0x5d9bae[_0x89ea('0x27')],'client_id':_0x5d9bae[_0x89ea('0x28')],'client_secret':_0x5d9bae['clientSecret'],'grant_type':_0x89ea('0x29')},'json':!![]};return rp(_0x10a4b3)[_0x89ea('0x2a')](function(_0x2354fb){accountsTokens[_0x5d9bae['id']]={'access_token':_0x2354fb[_0x89ea('0x1f')],'expires_in':moment()[_0x89ea('0x2b')](_0x2354fb[_0x89ea('0x21')],_0x89ea('0x2c'))};_0x4ac655(_0x2354fb['access_token']);})[_0x89ea('0x2d')](function(_0x509a8e){logger[_0x89ea('0x2e')](_0x89ea('0x2f'),_0x509a8e[_0x89ea('0x30')]);_0x329e9f(_0x509a8e);});});}function getUser(_0x48a120,_0x579006,_0x3cade7,_0x125687){logger[_0x89ea('0x31')](_0x89ea('0x32'));return request({'method':'GET','uri':util[_0x89ea('0x33')](_0x89ea('0x34'),_0x579006),'qs':{'type':_0x89ea('0x35')},'headers':{'Authorization':_0x89ea('0x36')+_0x48a120},'json':!![]})[_0x89ea('0x2a')](function(_0x45322e){if(_0x45322e[_0x89ea('0x37')]){var _0x3c1676=-0x1;if(_[_0x89ea('0x38')](_0x45322e['users'])){if(!_[_0x89ea('0x1e')](_0x125687)){_0x3c1676=_[_0x89ea('0x39')](_0x45322e[_0x89ea('0x37')],function(_0x34e7a1){return _0x34e7a1[_0x89ea('0x3a')]===_0x125687;});}if(_0x3c1676>=0x0){logger[_0x89ea('0x31')]('Agent\x20found!');}else{logger[_0x89ea('0x31')](_0x89ea('0x3b'));_0x3c1676=_[_0x89ea('0x39')](_0x45322e[_0x89ea('0x37')],function(_0x3a4e68){return _0x3a4e68['profile'][_0x89ea('0x1a')]===_0x89ea('0x3c');});}return _0x45322e[_0x89ea('0x37')][_0x3c1676];}else{if(_0x45322e[_0x89ea('0x3d')][_0x89ea('0x3e')][_0x89ea('0x1a')]===_0x89ea('0x3c')){logger[_0x89ea('0x31')](_0x89ea('0x3b'));user=_0x45322e[_0x89ea('0x3d')];return user;}else{logger[_0x89ea('0x2e')](_0x89ea('0x3f'),JSON['stringify'](_0x45322e));throw new Error(_0x89ea('0x40')+JSON[_0x89ea('0xe')](_0x45322e));}}}else{logger['error'](_0x89ea('0x3f'),JSON['stringify'](_0x45322e));throw new Error(_0x89ea('0x40')+JSON['stringify'](_0x45322e));}})[_0x89ea('0x2d')](function(_0x54da5a){console[_0x89ea('0x2e')](_0x54da5a);});}function getZohoUser(_0x11f69b,_0x299039){return new BPromise(function(_0x122e5d,_0x735c28){request(_0x11f69b)[_0x89ea('0x2a')](function(_0x195737){var _0x44c15b=null;if(_0x195737){_0x44c15b=_0x195737[_0x89ea('0x41')][0x0];_0x44c15b[_0x89ea('0x42')]=_0x299039;}_0x122e5d(_0x44c15b);})[_0x89ea('0x2d')](function(_0x14c974){_0x735c28(_0x14c974);});});}function createEndUser(_0x26216d,_0x2cc724,_0x3aa957,_0xd040bc,_0x17413e,_0x954863){var _0x3aa957=getName(_0x3aa957);return request({'method':_0x89ea('0x25'),'uri':_0x89ea('0x43')+_0x2cc724+_0x89ea('0x44')+_[_0x89ea('0x45')](_0x954863[_0x89ea('0x46')])+'s','body':{'data':[{'Last_Name':_0x3aa957[0x1],'First_Name':_0x3aa957[0x0],'Phone':_0xd040bc,'Owner':{'name':!_[_0x89ea('0x1e')](_0x17413e[_0x89ea('0x47')][_0x89ea('0x1a')])?_0x17413e[_0x89ea('0x47')][_0x89ea('0x1a')]:!_['isNil'](_0x17413e[_0x89ea('0x48')])?_0x17413e['first_name']+'\x20'+_0x17413e[_0x89ea('0x49')]:_0x17413e[_0x89ea('0x49')],'id':_0x17413e['id']}}]},'headers':{'Authorization':_0x89ea('0x36')+_0x26216d},'json':!![]})['then'](function(_0x2d7654){if(_0x2d7654&&_0x2d7654[_0x89ea('0x41')][0x0][_0x89ea('0x4a')]===_0x89ea('0x4b')){var _0x3a227d=_0x2d7654[_0x89ea('0x41')][0x0][_0x89ea('0x4c')];_0x3a227d[_0x89ea('0x42')]=_[_0x89ea('0x45')](_0x954863[_0x89ea('0x46')])+'s';return _0x3a227d;}logger[_0x89ea('0x2e')](_0x89ea('0x3f'),JSON['stringify'](data));throw new Error(_0x89ea('0x4d')+JSON[_0x89ea('0xe')](data));})[_0x89ea('0x2d')](function(_0x358f82){console[_0x89ea('0x4e')](_0x89ea('0x4f'),_0x358f82);});}function getEndUser(_0x3528c4,_0x272e77,_0x3a2321,_0x47a82a,_0x53fa8c,_0x1c6980,_0x1a448e){var _0x531018={'method':_0x89ea('0x50'),'uri':'','headers':{'Authorization':_0x89ea('0x36')+_0x3528c4},'json':!![]};switch(_0x1a448e[_0x89ea('0x51')]){case'contact_lead':_0x531018['uri']='https://www.zohoapis.'+_0x272e77+_0x89ea('0x52')+_0x53fa8c+'))';return getZohoUser(_0x531018,_0x89ea('0x53'))['then'](function(_0x4a1849){if(_0x4a1849)return _0x4a1849;_0x531018[_0x89ea('0x54')]=_0x89ea('0x43')+_0x272e77+_0x89ea('0x55')+_0x53fa8c+'))';return getZohoUser(_0x531018,'Leads')[_0x89ea('0x2a')](function(_0x360306){if(_0x360306)return _0x360306;if(_0x1a448e[_0x89ea('0x46')]!=_0x89ea('0x56')){return createEndUser(_0x3528c4,_0x272e77,_0x47a82a,_0x53fa8c,_0x1c6980,_0x1a448e);}else{return{};}});});break;case'contact':_0x531018['uri']='https://www.zohoapis.'+_0x272e77+_0x89ea('0x52')+_0x53fa8c+'))';return getZohoUser(_0x531018,_0x89ea('0x53'))[_0x89ea('0x2a')](function(_0x5e1a4a){if(_0x5e1a4a)return _0x5e1a4a;if(_0x1a448e[_0x89ea('0x46')]!=_0x89ea('0x56')){return createEndUser(_0x3528c4,_0x272e77,_0x47a82a,_0x53fa8c,_0x1c6980,_0x1a448e);}else{return{};}});break;case _0x89ea('0x57'):_0x531018[_0x89ea('0x54')]=_0x89ea('0x43')+_0x272e77+_0x89ea('0x55')+_0x53fa8c+'))';return getZohoUser(_0x531018,_0x89ea('0x58'))[_0x89ea('0x2a')](function(_0x14d148){if(_0x14d148)return _0x14d148;if(_0x1a448e[_0x89ea('0x46')]!=_0x89ea('0x56')){return createEndUser(_0x3528c4,_0x272e77,_0x47a82a,_0x53fa8c,_0x1c6980,_0x1a448e);}else{return{};}});break;}}function getCall(_0x28a9f2,_0x32c64e,_0x3fb03b,_0x200be1,_0x1895b2,_0xf0da25,_0xf592c4,_0x3ee198){logger[_0x89ea('0x31')](_0x89ea('0x59'));var _0x451c23={};_0x451c23[_0x89ea('0x5a')]={'name':!_[_0x89ea('0x1e')](_0x200be1[_0x89ea('0x47')][_0x89ea('0x1a')])&&!_['isNil'](_0x200be1[_0x89ea('0x3e')][_0x89ea('0x1a')])&&_0x200be1['profile']['name']==='administrator'?_0x200be1[_0x89ea('0x47')][_0x89ea('0x1a')]:!_[_0x89ea('0x1e')](_0x200be1[_0x89ea('0x48')])?_0x200be1['first_name']+'\x20'+_0x200be1[_0x89ea('0x49')]:_0x200be1[_0x89ea('0x49')],'id':_0x200be1['id']};_0x451c23[_0x89ea('0x5b')]=intUtil[_0x89ea('0x5c')](_0xf0da25[_0x89ea('0x5d')],_0xf592c4,'\x20');_0x451c23[_0x89ea('0x5e')]=intUtil['getString'](_0xf0da25[_0x89ea('0x5f')],_0xf592c4,'\x0a');if(_0x1895b2[_0x89ea('0x42')]===_0x89ea('0x53')){_0x451c23[_0x89ea('0x60')]={'name':!_['isNil'](_0x1895b2[_0x89ea('0x61')])?_0x1895b2[_0x89ea('0x61')]:!_['isNil'](_0x1895b2[_0x89ea('0x62')])?_0x1895b2[_0x89ea('0x62')]+'\x20'+_0x1895b2[_0x89ea('0x63')]:_0x1895b2['Last_Name'],'id':_0x1895b2['id']};}if(_0x1895b2[_0x89ea('0x42')]==='Leads'){_0x451c23[_0x89ea('0x64')]={'name':!_[_0x89ea('0x1e')](_0x1895b2[_0x89ea('0x61')])?_0x1895b2[_0x89ea('0x61')]:!_[_0x89ea('0x1e')](_0x1895b2[_0x89ea('0x62')])?_0x1895b2[_0x89ea('0x62')]+'\x20'+_0x1895b2[_0x89ea('0x63')]:_0x1895b2['Last_Name'],'id':_0x1895b2['id']};_0x451c23[_0x89ea('0x65')]=_[_0x89ea('0x45')](_0x1895b2[_0x89ea('0x42')]);}if(_0xf592c4[_0x89ea('0x66')]){_0x451c23['Call_Duration']=moment[_0x89ea('0x67')](parseInt(_0xf592c4['talktime'])*0x3e8)['format']('mm:ss');}else if(_0xf592c4['answertime']&&_0xf592c4[_0x89ea('0x68')]){_0x451c23['Call_Duration']=moment[_0x89ea('0x67')](moment(_0xf592c4[_0x89ea('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x89ea('0x69')](moment(_0xf592c4[_0x89ea('0x6a')],_0x89ea('0x6b'))))['format']('mm:ss');}switch(_0xf592c4[_0x89ea('0x6c')]){case _0x89ea('0x6d'):_0x451c23[_0x89ea('0x6e')]=_0x89ea('0x6f');break;case _0x89ea('0x70'):case _0x89ea('0x71'):_0x451c23[_0x89ea('0x6e')]='Answered';break;case _0x89ea('0x72'):_0x451c23[_0x89ea('0x6e')]=_0x89ea('0x73');break;case'abandoned':_0x451c23[_0x89ea('0x6e')]='Abandoned';break;case _0x89ea('0x74'):_0x451c23[_0x89ea('0x6e')]=_0x89ea('0x75');default:}_0x451c23[_0x89ea('0x76')]=(_0x3ee198===_0x89ea('0x77')?moment(_0xf592c4['starttime'])[_0x89ea('0x33')](_0x89ea('0x6b')):moment(_0xf592c4['agentcalledAt'])['format'](_0x89ea('0x6b')))||moment()[_0x89ea('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x451c23[_0x89ea('0x78')]=_0x3ee198||_0x89ea('0x79');_0x451c23=_[_0x89ea('0x7a')](_0x451c23,getCustomFields(_0xf0da25[_0x89ea('0x7b')],_0xf592c4));return request({'method':_0x89ea('0x25'),'uri':_0x89ea('0x43')+_0x32c64e+_0x89ea('0x7c'),'headers':{'Authorization':_0x89ea('0x36')+_0x28a9f2},'body':{'data':[_0x451c23]},'json':!![]})['then'](function(_0x212be4){if(_0x212be4&&_0x212be4[_0x89ea('0x41')][0x0][_0x89ea('0x4a')]==='SUCCESS'){logger[_0x89ea('0x31')]('Call\x20created!');return{'id':_0x212be4[_0x89ea('0x41')][0x0][_0x89ea('0x4c')]['id']};}})['catch'](function(_0xc11988){logger[_0x89ea('0x31')](_0x89ea('0x7d'),_0xc11988[_0x89ea('0x30')]);console['log'](_0x89ea('0x7d'),_0xc11988);});}exports[_0x89ea('0x7e')]=function(_0x534d3b,_0x14f72f,_0x2c7d1d,_0x4cfbb2,_0x1b5875,_0x2eaa64){var _0x180163,_0x2c3262,_0x3f9aa2;_0x2eaa64[_0x89ea('0x7f')]=intUtil['stripTrailingSlash'](_0x2eaa64[_0x89ea('0x7f')]);_0x2eaa64['serverUrl']=intUtil['stripTrailingSlash'](_0x2eaa64[_0x89ea('0x80')]);if(_0x1b5875&&_0x1b5875[_0x89ea('0x81')]){logger['info'](_0x89ea('0x82'),'Recording\x20is\x20enabled!');_0x14f72f[_0x89ea('0x83')]=_0x2eaa64[_0x89ea('0x80')]+_0x89ea('0x84')+_0x14f72f[_0x89ea('0x85')]+_0x89ea('0x86')+md5(_0x14f72f['uniqueid']);}else{_0x14f72f['recordingURL']='';}var _0xcfb0d7=_0x2eaa64[_0x89ea('0x7f')]===_0x89ea('0x87')?'eu':_0x89ea('0x88');return getAccessToken(_0x2eaa64)['then'](function(_0x1fe20a){_0x3f9aa2=_0x1fe20a;return getUser(_0x3f9aa2,_0xcfb0d7,_0x2eaa64,_0x4cfbb2[_0x89ea('0x3a')]);})[_0x89ea('0x2a')](function(_0x5c4776){_0x180163=_0x5c4776;logger[_0x89ea('0x31')](_0x89ea('0x89'),_0x180163['id']);return getEndUser(_0x3f9aa2,_0xcfb0d7,_0x2eaa64,_0x14f72f[_0x89ea('0x8a')],_0x14f72f[_0x89ea('0x8b')],_0x180163,_0x2c7d1d);})['then'](function(_0x59c23f){_0x2c3262=_0x59c23f;return getCall(_0x3f9aa2,_0xcfb0d7,_0x2eaa64,_0x180163,_0x2c3262,_0x2c7d1d,_0x14f72f,_0x89ea('0x79'));})[_0x89ea('0x2a')](function(_0x41c726){if(_0x41c726){logger[_0x89ea('0x31')](_0x89ea('0x8c'),_0x41c726['id']);logger[_0x89ea('0x31')](_0x89ea('0x82'),_0x89ea('0x8d'));emit(util['format'](_0x89ea('0x8e'),_0x4cfbb2[_0x89ea('0x1a')]),_0x89ea('0x8f'),{'uri':_0x89ea('0x90')+_0x2eaa64[_0x89ea('0x7f')]+_0x89ea('0x91')+_0x41c726['id']});}})[_0x89ea('0x2d')](function(_0x43cbc6){logger['error'](_0x89ea('0x82'),JSON[_0x89ea('0xe')](_0x43cbc6));});};exports[_0x89ea('0x77')]=function(_0x1419c5,_0x1a2363,_0x572dce,_0x19acf8,_0x3d2bd6,_0x4694f4,_0x3330e3){var _0x3dea67,_0x501857,_0x544d54;_0x4694f4[_0x89ea('0x7f')]=intUtil[_0x89ea('0x92')](_0x4694f4['host']);_0x4694f4[_0x89ea('0x80')]=intUtil[_0x89ea('0x92')](_0x4694f4['serverUrl']);if(_0x3330e3&&_0x3330e3['recordingFormat']&&_0x3330e3[_0x89ea('0x93')]!==_0x89ea('0x94')){logger[_0x89ea('0x31')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1a2363[_0x89ea('0x83')]=_0x4694f4[_0x89ea('0x80')]+_0x89ea('0x84')+_0x1a2363[_0x89ea('0x85')]+_0x89ea('0x86')+md5(_0x1a2363[_0x89ea('0x85')]);}var _0x54e81e=_0x4694f4[_0x89ea('0x7f')]===_0x89ea('0x87')?'eu':_0x89ea('0x88');return getAccessToken(_0x4694f4)['then'](function(_0x4b9874){_0x544d54=_0x4b9874;return getUser(_0x544d54,_0x54e81e,_0x4694f4,_0x19acf8[_0x89ea('0x3a')]);})['then'](function(_0x270480){_0x3dea67=_0x270480;logger['info'](_0x89ea('0x89'),_0x3dea67['id']);return getEndUser(_0x544d54,_0x54e81e,_0x4694f4,_0x1a2363['destcalleridname'],_0x1a2363[_0x89ea('0x95')],_0x3dea67,_0x572dce);})[_0x89ea('0x2a')](function(_0x36c157){_0x501857=_0x36c157;return getCall(_0x544d54,_0x54e81e,_0x4694f4,_0x3dea67,_0x501857,_0x572dce,_0x1a2363,_0x89ea('0x96'));})['then'](function(_0x29ff7e){if(_0x29ff7e){logger[_0x89ea('0x31')](_0x89ea('0x8c'),_0x29ff7e['id']);logger[_0x89ea('0x31')](_0x89ea('0x97'),_0x89ea('0x8d'));emit(util[_0x89ea('0x33')](_0x89ea('0x8e'),_0x19acf8['name']),_0x89ea('0x8f'),{'uri':_0x89ea('0x90')+_0x4694f4[_0x89ea('0x7f')]+_0x89ea('0x91')+_0x29ff7e['id']});}})[_0x89ea('0x2d')](function(_0xe31138){logger[_0x89ea('0x2e')]('[OUTBOUND]',JSON[_0x89ea('0xe')](_0xe31138));});};exports[_0x89ea('0x98')]=function(_0xad59a1,_0x8fda09,_0x23af7a,_0x1d7745,_0x43bb94,_0x2c762f){var _0x40fa5f,_0x8c5597,_0x3e41ca;_0x2c762f['host']=intUtil[_0x89ea('0x92')](_0x2c762f[_0x89ea('0x7f')]);_0x2c762f['serverUrl']=intUtil['stripTrailingSlash'](_0x2c762f['serverUrl']);if(_0x43bb94&&_0x43bb94[_0x89ea('0x81')]){logger[_0x89ea('0x31')]('['+_0x8fda09[_0x89ea('0x6c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x8fda09[_0x89ea('0x83')]=_0x2c762f[_0x89ea('0x80')]+_0x89ea('0x84')+_0x8fda09[_0x89ea('0x85')]+_0x89ea('0x86')+md5(_0x8fda09['uniqueid']);}else{_0x8fda09[_0x89ea('0x83')]='';}var _0x4e721c=_0x2c762f[_0x89ea('0x7f')]===_0x89ea('0x87')?'eu':_0x89ea('0x88');return getAccessToken(_0x2c762f)['then'](function(_0x361573){_0x3e41ca=_0x361573;return getUser(_0x3e41ca,_0x4e721c,_0x2c762f);})[_0x89ea('0x2a')](function(_0x5f0210){_0x40fa5f=_0x5f0210;logger[_0x89ea('0x31')](_0x89ea('0x89'),_0x40fa5f['id']);return getEndUser(_0x3e41ca,_0x4e721c,_0x2c762f,_0x8fda09[_0x89ea('0x8a')],_0x8fda09[_0x89ea('0x8b')],_0x40fa5f,_0x23af7a);})[_0x89ea('0x2a')](function(_0x1afe21){_0x8c5597=_0x1afe21;return getCall(_0x3e41ca,_0x4e721c,_0x2c762f,_0x40fa5f,_0x8c5597,_0x23af7a,_0x8fda09,_0x89ea('0x79'));})[_0x89ea('0x2a')](function(_0x11e948){if(_0x11e948){logger['info'](_0x89ea('0x8c'),_0x11e948['id']);}})['catch'](function(_0x20611f){logger[_0x89ea('0x2e')]('['+_0x8fda09['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x20611f));});}; \ No newline at end of file +var _0xf4c9=['../../../../config/environment','zoho','defaults','redis','emit','[HTTP]','stringify','length','forEach','idField','type','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','isNil','email','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Contacts','Leads','Creating\x20new\x20call...','Owner','administrator','Subjects','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','destcalleridname','Outbound','[OUTBOUND]','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','./util','ioredis','bluebird'];(function(_0x446c3e,_0x548f28){var _0x541da7=function(_0x3fe60c){while(--_0x3fe60c){_0x446c3e['push'](_0x446c3e['shift']());}};_0x541da7(++_0x548f28);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf4c9[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x9f4c('0x0'));var rp=require(_0x9f4c('0x1'));var md5=require(_0x9f4c('0x2'));var util=require('util');var intUtil=require(_0x9f4c('0x3'));var moment=require('moment');var Redis=require(_0x9f4c('0x4'));var BPromise=require(_0x9f4c('0x5'));var config=require(_0x9f4c('0x6'));var logger=require('../../../../config/logger')(_0x9f4c('0x7'));config['redis']=_[_0x9f4c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f4c('0x9')]));function emit(_0x398b30,_0x72c8ea,_0x3ea263){io['to'](_0x398b30)[_0x9f4c('0xa')](_0x72c8ea,_0x3ea263);}function request(_0x37b693){logger['debug'](_0x9f4c('0xb'),JSON[_0x9f4c('0xc')](_0x37b693));return rp(_0x37b693);}function getCustomFields(_0x20c329,_0x700e2d){var _0xd0da22={};if(_0x20c329[_0x9f4c('0xd')]>0x0){_[_0x9f4c('0xe')](_0x20c329,function(_0x2b01cd){if(_0x2b01cd['type']==='string'&&_0x2b01cd['idField']){_0xd0da22[_0x2b01cd[_0x9f4c('0xf')]]=_0x2b01cd['content']['toString']();}else if(_0x2b01cd[_0x9f4c('0x10')]==='variable'&&_0x2b01cd['variableName']&&_0x2b01cd[_0x9f4c('0xf')]&&_0x700e2d[_0x2b01cd['variableName']]){_0xd0da22[_0x2b01cd['idField']]=_0x700e2d[_0x2b01cd[_0x9f4c('0x11')]]['toString']();}else if(_0x2b01cd[_0x9f4c('0x10')]===_0x9f4c('0x12')&&_0x2b01cd[_0x9f4c('0x13')]&&_0x2b01cd[_0x9f4c('0x13')][_0x9f4c('0x14')]&&_0x2b01cd[_0x9f4c('0xf')]&&_0x700e2d[_0x2b01cd['Variable'][_0x9f4c('0x14')][_0x9f4c('0x15')]()]){_0xd0da22[_0x2b01cd[_0x9f4c('0xf')]]=_0x700e2d[_0x2b01cd[_0x9f4c('0x13')][_0x9f4c('0x14')]['toLowerCase']()][_0x9f4c('0x16')]();}});}return _0xd0da22;}function getName(_0x158493){if(_0x158493[_0x9f4c('0x17')]('\x20')>0x0){var _0x5d9587=_0x158493['split'](/ (.+)/);if(_0x5d9587[0x1]){return _0x5d9587;}}return[_0x158493,_0x158493];}var accountsTokens={};function getAccessToken(_0x502a33){return new Promise(function(_0x53d301,_0x2040a5){if(!_['isNil'](accountsTokens[_0x502a33['id']])&&!_['isNil'](accountsTokens[_0x502a33['id']][_0x9f4c('0x18')])){if(moment()[_0x9f4c('0x19')](accountsTokens[_0x502a33['id']]['expires_in'])){_0x53d301(accountsTokens[_0x502a33['id']][_0x9f4c('0x18')]);}}var _0x1d0df9;switch(_0x502a33['zone']){case'US':_0x1d0df9=_0x9f4c('0x1a');break;case'AU':_0x1d0df9='https://accounts.zoho.com.au';break;case'EU':_0x1d0df9='https://accounts.zoho.eu';break;case'IN':_0x1d0df9=_0x9f4c('0x1b');break;case'CN':_0x1d0df9='https://accounts.zoho.com.cn';break;default:_0x1d0df9=_0x9f4c('0x1c');break;}var _0x30d9f6={'method':_0x9f4c('0x1d'),'uri':_0x1d0df9+_0x9f4c('0x1e'),'qs':{'refresh_token':_0x502a33[_0x9f4c('0x1f')],'client_id':_0x502a33[_0x9f4c('0x20')],'client_secret':_0x502a33['clientSecret'],'grant_type':_0x9f4c('0x21')},'json':!![]};return rp(_0x30d9f6)[_0x9f4c('0x22')](function(_0x174552){accountsTokens[_0x502a33['id']]={'access_token':_0x174552[_0x9f4c('0x18')],'expires_in':moment()[_0x9f4c('0x23')](_0x174552[_0x9f4c('0x24')],_0x9f4c('0x25'))};_0x53d301(_0x174552[_0x9f4c('0x18')]);})[_0x9f4c('0x26')](function(_0x12e558){logger[_0x9f4c('0x27')](_0x9f4c('0x28'),_0x12e558[_0x9f4c('0x29')]);_0x2040a5(_0x12e558);});});}function getUser(_0x3702bf,_0x21ba20,_0x246599,_0x31d486){logger[_0x9f4c('0x2a')](_0x9f4c('0x2b'));return request({'method':_0x9f4c('0x2c'),'uri':util[_0x9f4c('0x2d')](_0x9f4c('0x2e'),_0x21ba20),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3702bf},'json':!![]})['then'](function(_0x101c13){if(_0x101c13[_0x9f4c('0x2f')]){var _0x5951c7=-0x1;if(_[_0x9f4c('0x30')](_0x101c13[_0x9f4c('0x2f')])){if(!_[_0x9f4c('0x31')](_0x31d486)){_0x5951c7=_['findIndex'](_0x101c13['users'],function(_0xa7ebad){return _0xa7ebad[_0x9f4c('0x32')]===_0x31d486;});}if(_0x5951c7>=0x0){logger['info'](_0x9f4c('0x33'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x5951c7=_[_0x9f4c('0x34')](_0x101c13[_0x9f4c('0x2f')],function(_0x259b71){return _0x259b71[_0x9f4c('0x35')][_0x9f4c('0x14')]===_0x9f4c('0x36');});}return _0x101c13['users'][_0x5951c7];}else{if(_0x101c13[_0x9f4c('0x37')][_0x9f4c('0x35')][_0x9f4c('0x14')]===_0x9f4c('0x36')){logger[_0x9f4c('0x2a')](_0x9f4c('0x38'));user=_0x101c13[_0x9f4c('0x37')];return user;}else{logger[_0x9f4c('0x27')](_0x9f4c('0x39'),JSON[_0x9f4c('0xc')](_0x101c13));throw new Error(_0x9f4c('0x3a')+JSON[_0x9f4c('0xc')](_0x101c13));}}}else{logger[_0x9f4c('0x27')]('The\x20failing\x20result\x20is',JSON[_0x9f4c('0xc')](_0x101c13));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x9f4c('0xc')](_0x101c13));}})[_0x9f4c('0x26')](function(_0x2e2e72){console[_0x9f4c('0x27')](_0x2e2e72);});}function getZohoUser(_0x33639a,_0x649bc){return new BPromise(function(_0x20c6ca,_0x3b7189){request(_0x33639a)[_0x9f4c('0x22')](function(_0x291130){var _0x3bfdeb=null;if(_0x291130){_0x3bfdeb=_0x291130[_0x9f4c('0x3b')][0x0];_0x3bfdeb['enduserType']=_0x649bc;}_0x20c6ca(_0x3bfdeb);})[_0x9f4c('0x26')](function(_0x321c6e){_0x3b7189(_0x321c6e);});});}function createEndUser(_0x41b942,_0x550557,_0x46fef8,_0x380c08,_0x198c59,_0x56f108){var _0x46fef8=getName(_0x46fef8);return request({'method':_0x9f4c('0x1d'),'uri':_0x9f4c('0x3c')+_0x550557+_0x9f4c('0x3d')+_[_0x9f4c('0x3e')](_0x56f108[_0x9f4c('0x3f')])+'s','body':{'data':[{'Last_Name':_0x46fef8[0x1],'First_Name':_0x46fef8[0x0],'Phone':_0x380c08,'Owner':{'name':!_[_0x9f4c('0x31')](_0x198c59[_0x9f4c('0x40')][_0x9f4c('0x14')])?_0x198c59[_0x9f4c('0x40')]['name']:!_[_0x9f4c('0x31')](_0x198c59[_0x9f4c('0x41')])?_0x198c59['first_name']+'\x20'+_0x198c59[_0x9f4c('0x42')]:_0x198c59[_0x9f4c('0x42')],'id':_0x198c59['id']}}]},'headers':{'Authorization':_0x9f4c('0x43')+_0x41b942},'json':!![]})['then'](function(_0x21f25b){if(_0x21f25b&&_0x21f25b['data'][0x0][_0x9f4c('0x44')]==='SUCCESS'){var _0x3e2fd4=_0x21f25b[_0x9f4c('0x3b')][0x0][_0x9f4c('0x45')];_0x3e2fd4[_0x9f4c('0x46')]=_[_0x9f4c('0x3e')](_0x56f108['moduleCreate'])+'s';return _0x3e2fd4;}logger['error'](_0x9f4c('0x39'),JSON[_0x9f4c('0xc')](data));throw new Error(_0x9f4c('0x47')+JSON['stringify'](data));})[_0x9f4c('0x26')](function(_0x530924){console['log'](_0x9f4c('0x48'),_0x530924);});}function getEndUser(_0x5914e5,_0x1e1830,_0x38f7cc,_0x291604,_0x5ecbec,_0x2111e3,_0x5d1192){var _0x36e923={'method':_0x9f4c('0x2c'),'uri':'','headers':{'Authorization':_0x9f4c('0x43')+_0x5914e5},'json':!![]};switch(_0x5d1192[_0x9f4c('0x49')]){case'contact_lead':_0x36e923[_0x9f4c('0x4a')]='https://www.zohoapis.'+_0x1e1830+_0x9f4c('0x4b')+_0x5ecbec+'))';return getZohoUser(_0x36e923,'Contacts')[_0x9f4c('0x22')](function(_0x1294da){if(_0x1294da)return _0x1294da;_0x36e923['uri']=_0x9f4c('0x3c')+_0x1e1830+_0x9f4c('0x4c')+_0x5ecbec+'))';return getZohoUser(_0x36e923,'Leads')[_0x9f4c('0x22')](function(_0x51a547){if(_0x51a547)return _0x51a547;if(_0x5d1192[_0x9f4c('0x3f')]!=_0x9f4c('0x4d')){return createEndUser(_0x5914e5,_0x1e1830,_0x291604,_0x5ecbec,_0x2111e3,_0x5d1192);}else{return{};}});});break;case'contact':_0x36e923['uri']='https://www.zohoapis.'+_0x1e1830+_0x9f4c('0x4b')+_0x5ecbec+'))';return getZohoUser(_0x36e923,_0x9f4c('0x4e'))['then'](function(_0x2c7f9a){if(_0x2c7f9a)return _0x2c7f9a;if(_0x5d1192[_0x9f4c('0x3f')]!=_0x9f4c('0x4d')){return createEndUser(_0x5914e5,_0x1e1830,_0x291604,_0x5ecbec,_0x2111e3,_0x5d1192);}else{return{};}});break;case'lead':_0x36e923[_0x9f4c('0x4a')]='https://www.zohoapis.'+_0x1e1830+_0x9f4c('0x4c')+_0x5ecbec+'))';return getZohoUser(_0x36e923,_0x9f4c('0x4f'))['then'](function(_0x4baa25){if(_0x4baa25)return _0x4baa25;if(_0x5d1192[_0x9f4c('0x3f')]!=_0x9f4c('0x4d')){return createEndUser(_0x5914e5,_0x1e1830,_0x291604,_0x5ecbec,_0x2111e3,_0x5d1192);}else{return{};}});break;}}function getCall(_0x4ae595,_0x395e5b,_0x885938,_0x3ebf54,_0x4dbbef,_0x4d68b5,_0x1431d1,_0x27eef4){logger[_0x9f4c('0x2a')](_0x9f4c('0x50'));var _0x558102={};_0x558102[_0x9f4c('0x51')]={'name':!_[_0x9f4c('0x31')](_0x3ebf54[_0x9f4c('0x40')][_0x9f4c('0x14')])&&!_[_0x9f4c('0x31')](_0x3ebf54[_0x9f4c('0x35')][_0x9f4c('0x14')])&&_0x3ebf54[_0x9f4c('0x35')][_0x9f4c('0x14')]===_0x9f4c('0x52')?_0x3ebf54[_0x9f4c('0x40')]['name']:!_[_0x9f4c('0x31')](_0x3ebf54[_0x9f4c('0x41')])?_0x3ebf54[_0x9f4c('0x41')]+'\x20'+_0x3ebf54[_0x9f4c('0x42')]:_0x3ebf54[_0x9f4c('0x42')],'id':_0x3ebf54['id']};_0x558102['Subject']=intUtil['getString'](_0x4d68b5[_0x9f4c('0x53')],_0x1431d1,'\x20');_0x558102['Description']=intUtil[_0x9f4c('0x54')](_0x4d68b5['Descriptions'],_0x1431d1,'\x0a');if(_0x4dbbef[_0x9f4c('0x46')]===_0x9f4c('0x4e')){_0x558102[_0x9f4c('0x55')]={'name':!_[_0x9f4c('0x31')](_0x4dbbef[_0x9f4c('0x56')])?_0x4dbbef[_0x9f4c('0x56')]:!_['isNil'](_0x4dbbef[_0x9f4c('0x57')])?_0x4dbbef[_0x9f4c('0x57')]+'\x20'+_0x4dbbef[_0x9f4c('0x58')]:_0x4dbbef[_0x9f4c('0x58')],'id':_0x4dbbef['id']};}if(_0x4dbbef[_0x9f4c('0x46')]==='Leads'){_0x558102[_0x9f4c('0x59')]={'name':!_[_0x9f4c('0x31')](_0x4dbbef[_0x9f4c('0x56')])?_0x4dbbef[_0x9f4c('0x56')]:!_[_0x9f4c('0x31')](_0x4dbbef[_0x9f4c('0x57')])?_0x4dbbef[_0x9f4c('0x57')]+'\x20'+_0x4dbbef[_0x9f4c('0x58')]:_0x4dbbef[_0x9f4c('0x58')],'id':_0x4dbbef['id']};_0x558102['$se_module']=_[_0x9f4c('0x3e')](_0x4dbbef[_0x9f4c('0x46')]);}if(_0x1431d1[_0x9f4c('0x5a')]){_0x558102[_0x9f4c('0x5b')]=moment[_0x9f4c('0x5c')](parseInt(_0x1431d1[_0x9f4c('0x5a')])*0x3e8)['format'](_0x9f4c('0x5d'));}else if(_0x1431d1[_0x9f4c('0x5e')]&&_0x1431d1[_0x9f4c('0x5f')]){_0x558102[_0x9f4c('0x5b')]=moment[_0x9f4c('0x5c')](moment(_0x1431d1[_0x9f4c('0x5f')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x1431d1['starttime'],_0x9f4c('0x60'))))[_0x9f4c('0x2d')](_0x9f4c('0x5d'));}switch(_0x1431d1['lastevent']){case _0x9f4c('0x61'):_0x558102[_0x9f4c('0x62')]=_0x9f4c('0x63');break;case _0x9f4c('0x64'):case _0x9f4c('0x65'):_0x558102[_0x9f4c('0x62')]=_0x9f4c('0x66');break;case _0x9f4c('0x67'):_0x558102[_0x9f4c('0x62')]=_0x9f4c('0x68');break;case'abandoned':_0x558102[_0x9f4c('0x62')]=_0x9f4c('0x69');break;case _0x9f4c('0x6a'):_0x558102[_0x9f4c('0x62')]='Timeout';default:}_0x558102['Call_Start_Time']=(_0x27eef4==='outbound'?moment(_0x1431d1[_0x9f4c('0x6b')])[_0x9f4c('0x2d')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1431d1[_0x9f4c('0x6c')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x9f4c('0x2d')]('YYYY-MM-DDTHH:mm:ss');_0x558102[_0x9f4c('0x6d')]=_0x27eef4||_0x9f4c('0x6e');_0x558102=_['merge'](_0x558102,getCustomFields(_0x4d68b5[_0x9f4c('0x6f')],_0x1431d1));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x395e5b+_0x9f4c('0x70'),'headers':{'Authorization':_0x9f4c('0x43')+_0x4ae595},'body':{'data':[_0x558102]},'json':!![]})[_0x9f4c('0x22')](function(_0xeb0dc0){if(_0xeb0dc0&&_0xeb0dc0['data'][0x0][_0x9f4c('0x44')]===_0x9f4c('0x71')){logger['info'](_0x9f4c('0x72'));return{'id':_0xeb0dc0['data'][0x0][_0x9f4c('0x45')]['id']};}})[_0x9f4c('0x26')](function(_0x21b568){logger[_0x9f4c('0x2a')](_0x9f4c('0x73'),_0x21b568['stack']);console['log']('err',_0x21b568);});}exports[_0x9f4c('0x74')]=function(_0x55067d,_0x13115f,_0x169e46,_0x4d8007,_0x5511d3,_0x452a88){var _0x394d4d,_0x2f18b1,_0x3dee3d;_0x452a88['host']=intUtil[_0x9f4c('0x75')](_0x452a88[_0x9f4c('0x76')]);_0x452a88[_0x9f4c('0x77')]=intUtil[_0x9f4c('0x75')](_0x452a88['serverUrl']);if(_0x5511d3&&_0x5511d3['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x13115f[_0x9f4c('0x78')]=_0x452a88['serverUrl']+_0x9f4c('0x79')+_0x13115f[_0x9f4c('0x7a')]+'/downloads?type=uniqueid&token='+md5(_0x13115f['uniqueid']);}else{_0x13115f[_0x9f4c('0x78')]='';}var _0x3c20b3=_0x452a88[_0x9f4c('0x76')]===_0x9f4c('0x7b')?'eu':'com';return getAccessToken(_0x452a88)[_0x9f4c('0x22')](function(_0x4bf551){_0x3dee3d=_0x4bf551;return getUser(_0x3dee3d,_0x3c20b3,_0x452a88,_0x4d8007['email']);})['then'](function(_0x40d041){_0x394d4d=_0x40d041;logger[_0x9f4c('0x2a')]('The\x20User\x20ID\x20is:',_0x394d4d['id']);return getEndUser(_0x3dee3d,_0x3c20b3,_0x452a88,_0x13115f[_0x9f4c('0x7c')],_0x13115f[_0x9f4c('0x7d')],_0x394d4d,_0x169e46);})[_0x9f4c('0x22')](function(_0x3d4fd4){_0x2f18b1=_0x3d4fd4;return getCall(_0x3dee3d,_0x3c20b3,_0x452a88,_0x394d4d,_0x2f18b1,_0x169e46,_0x13115f,_0x9f4c('0x6e'));})[_0x9f4c('0x22')](function(_0x40a3cc){if(_0x40a3cc){logger[_0x9f4c('0x2a')](_0x9f4c('0x7e'),_0x40a3cc['id']);logger[_0x9f4c('0x2a')](_0x9f4c('0x7f'),_0x9f4c('0x80'));emit(util[_0x9f4c('0x2d')]('user:%s',_0x4d8007[_0x9f4c('0x14')]),_0x9f4c('0x81'),{'uri':_0x9f4c('0x82')+_0x452a88[_0x9f4c('0x76')]+_0x9f4c('0x83')+_0x40a3cc['id']});}})['catch'](function(_0x218aed){logger['error'](_0x9f4c('0x7f'),JSON[_0x9f4c('0xc')](_0x218aed));});};exports['outbound']=function(_0x36063e,_0x548f27,_0x4d6426,_0x574b74,_0x5478b5,_0x11112c,_0x2c043a){var _0x1fb30d,_0x316030,_0x4ec44c;_0x11112c[_0x9f4c('0x76')]=intUtil[_0x9f4c('0x75')](_0x11112c[_0x9f4c('0x76')]);_0x11112c['serverUrl']=intUtil[_0x9f4c('0x75')](_0x11112c[_0x9f4c('0x77')]);if(_0x2c043a&&_0x2c043a[_0x9f4c('0x84')]&&_0x2c043a['recordingFormat']!==_0x9f4c('0x85')){logger['info']('[OUTBOUND]',_0x9f4c('0x86'));_0x548f27[_0x9f4c('0x78')]=_0x11112c[_0x9f4c('0x77')]+'/api/voice/recordings/'+_0x548f27[_0x9f4c('0x7a')]+_0x9f4c('0x87')+md5(_0x548f27[_0x9f4c('0x7a')]);}var _0x57904d=_0x11112c[_0x9f4c('0x76')]===_0x9f4c('0x7b')?'eu':_0x9f4c('0x88');return getAccessToken(_0x11112c)['then'](function(_0x5cdb60){_0x4ec44c=_0x5cdb60;return getUser(_0x4ec44c,_0x57904d,_0x11112c,_0x574b74[_0x9f4c('0x32')]);})[_0x9f4c('0x22')](function(_0x204511){_0x1fb30d=_0x204511;logger['info'](_0x9f4c('0x89'),_0x1fb30d['id']);return getEndUser(_0x4ec44c,_0x57904d,_0x11112c,_0x548f27[_0x9f4c('0x8a')],_0x548f27['destcalleridnum'],_0x1fb30d,_0x4d6426);})[_0x9f4c('0x22')](function(_0x3aafd6){_0x316030=_0x3aafd6;return getCall(_0x4ec44c,_0x57904d,_0x11112c,_0x1fb30d,_0x316030,_0x4d6426,_0x548f27,_0x9f4c('0x8b'));})[_0x9f4c('0x22')](function(_0x5b53bb){if(_0x5b53bb){logger[_0x9f4c('0x2a')](_0x9f4c('0x7e'),_0x5b53bb['id']);logger[_0x9f4c('0x2a')](_0x9f4c('0x8c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9f4c('0x2d')]('user:%s',_0x574b74[_0x9f4c('0x14')]),_0x9f4c('0x81'),{'uri':_0x9f4c('0x82')+_0x11112c[_0x9f4c('0x76')]+_0x9f4c('0x83')+_0x5b53bb['id']});}})[_0x9f4c('0x26')](function(_0x349b1b){logger[_0x9f4c('0x27')](_0x9f4c('0x8c'),JSON[_0x9f4c('0xc')](_0x349b1b));});};exports['unmanaged']=function(_0x2e4ea5,_0x5c3f5b,_0xf8b18a,_0x23dd0f,_0x11ac6f,_0x8ace18){var _0x14b0e7,_0x12cd4a,_0x649415;_0x8ace18['host']=intUtil[_0x9f4c('0x75')](_0x8ace18[_0x9f4c('0x76')]);_0x8ace18['serverUrl']=intUtil[_0x9f4c('0x75')](_0x8ace18[_0x9f4c('0x77')]);if(_0x11ac6f&&_0x11ac6f[_0x9f4c('0x8d')]){logger[_0x9f4c('0x2a')]('['+_0x5c3f5b[_0x9f4c('0x8e')][_0x9f4c('0x8f')]()+']',_0x9f4c('0x86'));_0x5c3f5b[_0x9f4c('0x78')]=_0x8ace18[_0x9f4c('0x77')]+'/api/voice/recordings/'+_0x5c3f5b[_0x9f4c('0x7a')]+_0x9f4c('0x87')+md5(_0x5c3f5b[_0x9f4c('0x7a')]);}else{_0x5c3f5b[_0x9f4c('0x78')]='';}var _0x371e82=_0x8ace18[_0x9f4c('0x76')]===_0x9f4c('0x7b')?'eu':'com';return getAccessToken(_0x8ace18)['then'](function(_0x471777){_0x649415=_0x471777;return getUser(_0x649415,_0x371e82,_0x8ace18);})[_0x9f4c('0x22')](function(_0x1eddab){_0x14b0e7=_0x1eddab;logger[_0x9f4c('0x2a')](_0x9f4c('0x89'),_0x14b0e7['id']);return getEndUser(_0x649415,_0x371e82,_0x8ace18,_0x5c3f5b['calleridname'],_0x5c3f5b[_0x9f4c('0x7d')],_0x14b0e7,_0xf8b18a);})[_0x9f4c('0x22')](function(_0x329409){_0x12cd4a=_0x329409;return getCall(_0x649415,_0x371e82,_0x8ace18,_0x14b0e7,_0x12cd4a,_0xf8b18a,_0x5c3f5b,_0x9f4c('0x6e'));})[_0x9f4c('0x22')](function(_0x28c4b0){if(_0x28c4b0){logger[_0x9f4c('0x2a')]('The\x20Call\x20ID\x20is:',_0x28c4b0['id']);}})[_0x9f4c('0x26')](function(_0x1de423){logger['error']('['+_0x5c3f5b[_0x9f4c('0x8e')][_0x9f4c('0x8f')]()+']',JSON[_0x9f4c('0xc')](_0x1de423));});}; \ 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 fdf575a..1c832c6 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(_0x1e96f1,_0x259f45){var _0x52c345=function(_0x589e8a){while(--_0x589e8a){_0x1e96f1['push'](_0x1e96f1['shift']());}};_0x52c345(++_0x259f45);}(_0x7a54,0x106));var _0x47a5=function(_0x9491c1,_0x33a0ab){_0x9491c1=_0x9491c1-0x0;var _0xbc67e6=_0x7a54[_0x9491c1];return _0xbc67e6;};'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(_0x32b24d,_0x2c130c){var _0x28f079=function(_0x3f011f){while(--_0x3f011f){_0x32b24d['push'](_0x32b24d['shift']());}};_0x28f079(++_0x2c130c);}(_0x7a54,0x106));var _0x47a5=function(_0x22274b,_0x579700){_0x22274b=_0x22274b-0x0;var _0x52e3b5=_0x7a54[_0x22274b];return _0x52e3b5;};'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 a279f51..062e7a8 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x3af934,_0x556589){var _0x353f83=function(_0x3aba5b){while(--_0x3aba5b){_0x3af934['push'](_0x3af934['shift']());}};_0x353f83(++_0x556589);}(_0x5f2f,0x73));var _0xf5f2=function(_0x446093,_0x1b2f19){_0x446093=_0x446093-0x0;var _0x759c21=_0x5f2f[_0x446093];return _0x759c21;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x1eef8e,_0x57ffa5){var _0x3ed508=function(_0x1a5987){while(--_0x1a5987){_0x1eef8e['push'](_0x1eef8e['shift']());}};_0x3ed508(++_0x57ffa5);}(_0x7a54,0x106));var _0x47a5=function(_0x4fa0e1,_0x1abd40){_0x4fa0e1=_0x4fa0e1-0x0;var _0x5a5fef=_0x7a54[_0x4fa0e1];return _0x5a5fef;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index bbbd9d8..57223c1 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 _0x12cc=['http','debug','rpc','error','message','catch','exports','bluebird','../../config/logger','routing','client'];(function(_0x1238e0,_0x16bd9b){var _0x59dfc8=function(_0x3cd547){while(--_0x3cd547){_0x1238e0['push'](_0x1238e0['shift']());}};_0x59dfc8(++_0x16bd9b);}(_0x12cc,0xc2));var _0xc12c=function(_0x51e7a0,_0x74edae){_0x51e7a0=_0x51e7a0-0x0;var _0x1c3537=_0x12cc[_0x51e7a0];return _0x1c3537;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc12c('0x0'));var logger=require(_0xc12c('0x1'))(_0xc12c('0x2'));var client=jayson[_0xc12c('0x3')][_0xc12c('0x4')]({'port':0x2329});client['Request']=function(_0x48809a,_0x3e773c){return new BPromise(function(_0x914c7e,_0x54bfa3){return client['request'](_0x48809a,_0x3e773c)['then'](function(_0x152fcd){logger[_0xc12c('0x5')](_0xc12c('0x6'),'routing',_0x48809a,_0x3e773c,_0x152fcd);if(_0x152fcd['error']){logger[_0xc12c('0x7')](_0xc12c('0x6'),_0xc12c('0x2'),_0x48809a,_0x152fcd['error'][_0xc12c('0x8')],_0x3e773c);return _0x54bfa3(_0x152fcd[_0xc12c('0x7')][_0xc12c('0x8')]);}else{return _0x914c7e(_0x152fcd['result']);}})[_0xc12c('0x9')](function(_0x30cfc9){logger[_0xc12c('0x7')](_0xc12c('0x6'),_0xc12c('0x2'),_0x48809a,_0x30cfc9,_0x3e773c);return _0x54bfa3(_0x30cfc9);});});};module[_0xc12c('0xa')]=client; \ No newline at end of file +var _0xd2bb=['client','http','Request','request','then','debug','rpc','error','message','catch','exports','bluebird','routing'];(function(_0x4b470c,_0x11e17c){var _0x1517b2=function(_0x46e2ff){while(--_0x46e2ff){_0x4b470c['push'](_0x4b470c['shift']());}};_0x1517b2(++_0x11e17c);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x2c8533,_0x4dede0){_0x2c8533=_0x2c8533-0x0;var _0x1c38a6=_0xd2bb[_0x2c8533];return _0x1c38a6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var client=jayson[_0xbd2b('0x2')][_0xbd2b('0x3')]({'port':0x2329});client[_0xbd2b('0x4')]=function(_0x306817,_0x3c67c1){return new BPromise(function(_0x5c41c7,_0x26d2fa){return client[_0xbd2b('0x5')](_0x306817,_0x3c67c1)[_0xbd2b('0x6')](function(_0x2f64a8){logger[_0xbd2b('0x7')](_0xbd2b('0x8'),_0xbd2b('0x1'),_0x306817,_0x3c67c1,_0x2f64a8);if(_0x2f64a8[_0xbd2b('0x9')]){logger[_0xbd2b('0x9')](_0xbd2b('0x8'),'routing',_0x306817,_0x2f64a8[_0xbd2b('0x9')]['message'],_0x3c67c1);return _0x26d2fa(_0x2f64a8[_0xbd2b('0x9')][_0xbd2b('0xa')]);}else{return _0x5c41c7(_0x2f64a8['result']);}})[_0xbd2b('0xb')](function(_0x475d9d){logger[_0xbd2b('0x9')](_0xbd2b('0x8'),_0xbd2b('0x1'),_0x306817,_0x475d9d,_0x3c67c1);return _0x26d2fa(_0x475d9d);});});};module[_0xbd2b('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 45ed006..b27fedf 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 _0x9f7a=['log','bluebird','./server','./realtime','./lib/email','../../mysqldb','then','initMailAccounts','mailAccounts','Setting','findOne','loginMailFrequency'];(function(_0xda1c9e,_0x4f8d94){var _0x31b19b=function(_0x114cd4){while(--_0x114cd4){_0xda1c9e['push'](_0xda1c9e['shift']());}};_0x31b19b(++_0x4f8d94);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9f7a[_0x138adb];return _0x1b27f2;};'use strict';var BPromise=require(_0xa9f7('0x0'));var server=require(_0xa9f7('0x1'));var Realtime=require(_0xa9f7('0x2'));var EmailChannel=require(_0xa9f7('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xa9f7('0x4'))['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount['getMailAccounts']())[_0xa9f7('0x5')](realtime[_0xa9f7('0x6')]())['then'](function(){email['refresh'](realtime[_0xa9f7('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x5bf7ca){return initRealtime();})[_0xa9f7('0x5')](function(_0x58a3f3){return db[_0xa9f7('0x8')][_0xa9f7('0x9')]({'attributes':['id',_0xa9f7('0xa')],'raw':!![]});})['then'](function(_0xd26f7d){return setInterval(initRealtime,_0xd26f7d[_0xa9f7('0xa')]*0x3e8);})['catch'](function(_0x33d505){console[_0xa9f7('0xb')](_0x33d505);});}main(); \ No newline at end of file +var _0x52ad=['initMailAccounts','refresh','mailAccounts','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts'];(function(_0x96316a,_0x494ca3){var _0x3acd15=function(_0x3df0fa){while(--_0x3df0fa){_0x96316a['push'](_0x96316a['shift']());}};_0x3acd15(++_0x494ca3);}(_0x52ad,0x1d8));var _0xd52a=function(_0x413bab,_0x4580fb){_0x413bab=_0x413bab-0x0;var _0x5d9ac5=_0x52ad[_0x413bab];return _0x5d9ac5;};'use strict';var BPromise=require(_0xd52a('0x0'));var server=require(_0xd52a('0x1'));var Realtime=require(_0xd52a('0x2'));var EmailChannel=require(_0xd52a('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xd52a('0x4'))['db'];function initRealtime(){return BPromise[_0xd52a('0x5')]()[_0xd52a('0x6')](mailAccount[_0xd52a('0x7')]())[_0xd52a('0x6')](realtime[_0xd52a('0x8')]())[_0xd52a('0x6')](function(){email[_0xd52a('0x9')](realtime[_0xd52a('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd52a('0x6')](function(_0x16a73d){return initRealtime();})[_0xd52a('0x6')](function(_0x3df9d4){return db['Setting'][_0xd52a('0xb')]({'attributes':['id',_0xd52a('0xc')],'raw':!![]});})['then'](function(_0x4df6c3){return setInterval(initRealtime,_0x4df6c3[_0xd52a('0xc')]*0x3e8);})[_0xd52a('0xd')](function(_0x1a9bbd){console[_0xd52a('0xe')](_0x1a9bbd);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d56abba..7d20916 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 _0x24df=['bind','end','handleImapEnd','error','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','catch','lastSync','handleImapError','sendMail','send','Smtp','then','verified','verify','exports','lodash','bluebird','../../../config/environment','email','defaults','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','mailAccount:update','prototype','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail'];(function(_0x1b453d,_0x1eba29){var _0x428ea4=function(_0x244a5a){while(--_0x244a5a){_0x1b453d['push'](_0x1b453d['shift']());}};_0x428ea4(++_0x1eba29);}(_0x24df,0x1c6));var _0xf24d=function(_0x21cc4e,_0x24a7ac){_0x21cc4e=_0x21cc4e-0x0;var _0x3b7125=_0x24df[_0x21cc4e];return _0x3b7125;};'use strict';var _=require(_0xf24d('0x0'));var moment=require('moment');var BPromise=require(_0xf24d('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xf24d('0x2'));var logger=require('../../../config/logger')(_0xf24d('0x3'));config['redis']=_[_0xf24d('0x4')](config[_0xf24d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf24d('0x6'))(new Redis(config[_0xf24d('0x5')]));var EmailImap=require(_0xf24d('0x7'));var EmailSmtp=require(_0xf24d('0x8'));var mailAccount=require(_0xf24d('0x9'));var md5Accounts={};function EmailChannel(_0x36a51b){logger['info'](_0xf24d('0xa'));this[_0xf24d('0xb')]=_0x36a51b[_0xf24d('0xb')];this['imapAccounts']={};this[_0xf24d('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0xf24d('0xd')]=function(_0x2d1e5d){var _0x3e09b4=this['mailAccounts'][_0x2d1e5d];var _0x49bb5f={'id':_0x3e09b4['id'],'name':_0x3e09b4[_0xf24d('0xe')],'key':_0x3e09b4[_0xf24d('0xf')],'active':_0x3e09b4[_0xf24d('0x10')],'Imap':{'status':_0x3e09b4[_0xf24d('0x11')][_0xf24d('0x12')],'messageStatus':_0x3e09b4[_0xf24d('0x11')][_0xf24d('0x13')],'total':_0x3e09b4[_0xf24d('0x11')][_0xf24d('0x14')]}};if(_[_0xf24d('0x15')](md5Accounts[_0x2d1e5d])){md5Accounts[_0x2d1e5d]={};}var _0x58b690=md5(JSON[_0xf24d('0x16')](_0x49bb5f));if(md5Accounts[_0x2d1e5d][_0xf24d('0x17')]!==_0x58b690){md5Accounts[_0x2d1e5d][_0xf24d('0x17')]=_0x58b690;io[_0xf24d('0xd')](_0xf24d('0x18'),_0x49bb5f);}};EmailChannel[_0xf24d('0x19')][_0xf24d('0x1a')]=function(_0x4b69e5){for(var _0x5e13b8 in _0x4b69e5){if(_0x4b69e5[_0xf24d('0x1b')](_0x5e13b8)){if(_0x4b69e5[_0x5e13b8][_0xf24d('0x11')]&&_0x4b69e5[_0x5e13b8][_0xf24d('0x10')]){var _0x9c59a4=_0x4b69e5[_0x5e13b8][_0xf24d('0x11')];if(!this[_0xf24d('0x1c')]['hasOwnProperty'](_0x9c59a4['id'])){this[_0xf24d('0x1c')][_0x9c59a4['id']]=new EmailImap(_0x9c59a4,_0x4b69e5[_0x5e13b8][_0xf24d('0x3')]);this['imapAccounts'][_0x9c59a4['id']]['on'](_0xf24d('0x1d'),this[_0xf24d('0x1e')]['bind'](this,_0x5e13b8));this['imapAccounts'][_0x9c59a4['id']]['on'](_0xf24d('0x3'),this[_0xf24d('0x1f')][_0xf24d('0x20')](this,_0x5e13b8));this[_0xf24d('0x1c')][_0x9c59a4['id']]['on'](_0xf24d('0x21'),this[_0xf24d('0x22')]['bind'](this,_0x5e13b8));this['imapAccounts'][_0x9c59a4['id']]['on'](_0xf24d('0x23'),this['handleImapError']['bind'](this,_0x5e13b8));}}else{if(_[_0xf24d('0x15')](this['mailAccounts'][_0x5e13b8][_0xf24d('0x11')])){this[_0xf24d('0xb')][_0x5e13b8][_0xf24d('0x11')]={};}this[_0xf24d('0xb')][_0x5e13b8][_0xf24d('0x11')][_0xf24d('0x12')]=_0xf24d('0x24');this[_0xf24d('0xb')][_0x5e13b8][_0xf24d('0x11')][_0xf24d('0x13')]='';this[_0xf24d('0xd')](_0x5e13b8);}}}};EmailChannel['prototype'][_0xf24d('0x1e')]=function(_0x235111,_0x56a736){if(this[_0xf24d('0xb')][_0x235111]){this[_0xf24d('0xb')][_0x235111][_0xf24d('0x11')][_0xf24d('0x12')]=_0xf24d('0x25');this[_0xf24d('0xb')][_0x235111][_0xf24d('0x11')][_0xf24d('0x13')]=_0x56a736[_0xf24d('0xe')];if(_0x56a736[_0xf24d('0x26')]){this[_0xf24d('0xb')][_0x235111][_0xf24d('0x11')][_0xf24d('0x14')]=_0x56a736[_0xf24d('0x26')][_0xf24d('0x14')];}return this[_0xf24d('0xd')](_0x235111);}};EmailChannel[_0xf24d('0x19')][_0xf24d('0x1f')]=function(_0x45d336,_0x3b0606){logger[_0xf24d('0x27')](_0xf24d('0x28'),_0x3b0606[_0xf24d('0x29')],_0x3b0606[_0xf24d('0x2a')],_0x3b0606['from'],_0x45d336);if(this[_0xf24d('0xb')][_0x45d336]){return mailAccount[_0xf24d('0x2b')](_0x45d336,_0x3b0606)['then'](function(_0x549ece){if(_0x549ece){logger[_0xf24d('0x27')]('Mail\x20accepted\x20from\x20routing');}})[_0xf24d('0x2c')](function(_0x3b873e){logger[_0xf24d('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xf24d('0x16')](_0x3b873e));});}};EmailChannel[_0xf24d('0x19')][_0xf24d('0x22')]=function(_0x441d9b){if(this[_0xf24d('0xb')][_0x441d9b]&&this[_0xf24d('0xb')][_0x441d9b][_0xf24d('0x11')]){if(this[_0xf24d('0x1c')][this[_0xf24d('0xb')][_0x441d9b][_0xf24d('0x11')]['id']]){delete this[_0xf24d('0x1c')][this['mailAccounts'][_0x441d9b][_0xf24d('0x11')]['id']];}this[_0xf24d('0xb')][_0x441d9b][_0xf24d('0x11')][_0xf24d('0x2d')]=moment();this[_0xf24d('0xd')](_0x441d9b);}};EmailChannel[_0xf24d('0x19')][_0xf24d('0x2e')]=function(_0x5d6698,_0x1e62c4){if(this[_0xf24d('0xb')][_0x5d6698]){this[_0xf24d('0xb')][_0x5d6698][_0xf24d('0x11')][_0xf24d('0x12')]=_0xf24d('0x23');this['mailAccounts'][_0x5d6698][_0xf24d('0x11')]['messageStatus']=_0x1e62c4;return this['emit'](_0x5d6698);}};EmailChannel['prototype'][_0xf24d('0x2f')]=function(_0x519aab,_0x107fd5){return this[_0xf24d('0xc')][_0xf24d('0x30')](_0x519aab,_0x107fd5);};EmailChannel[_0xf24d('0x19')]['verifySmtp']=function(_0x2592fd){var _0x268a89=this;if(this['mailAccounts'][_0x2592fd['id']]){if(_[_0xf24d('0x15')](this[_0xf24d('0xb')][_0x2592fd['id']][_0xf24d('0x31')])){this[_0xf24d('0xb')][_0x2592fd['id']]['Smtp']={};}this[_0xf24d('0xb')][_0x2592fd['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x52353b,_0x5b53ec){return _0x268a89[_0xf24d('0xc')]['verify'](_0x2592fd)[_0xf24d('0x32')](function(_0x491996){_0x268a89['mailAccounts'][_0x2592fd['id']][_0xf24d('0x31')]['status']=_0xf24d('0x33');_0x268a89[_0xf24d('0xb')][_0x2592fd['id']][_0xf24d('0x31')][_0xf24d('0x13')]='';_0x268a89[_0xf24d('0xd')](_0x2592fd['id']);_0x52353b(_0x491996);})[_0xf24d('0x2c')](function(_0xefc593){_0x268a89[_0xf24d('0xb')][_0x2592fd['id']][_0xf24d('0x31')][_0xf24d('0x12')]=_0xf24d('0x23');_0x268a89['mailAccounts'][_0x2592fd['id']]['Smtp'][_0xf24d('0x13')]=_0xefc593;_0x268a89['emit'](_0x2592fd['id']);_0x5b53ec(_0xefc593);});});}return this[_0xf24d('0xc')][_0xf24d('0x34')](_0x2592fd);};module[_0xf24d('0x35')]=EmailChannel; \ No newline at end of file +var _0x529c=['connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','stringify','lastSync','sendMail','send','Smtp','verify','verified','catch','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','active','Imap','messageStatus','total','md5','refresh','hasOwnProperty','box','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','isNil','status','disabled','handleImapBox'];(function(_0x4d440d,_0x2fafd2){var _0x34ed5a=function(_0x4449e0){while(--_0x4449e0){_0x4d440d['push'](_0x4d440d['shift']());}};_0x34ed5a(++_0x2fafd2);}(_0x529c,0x165));var _0xc529=function(_0x41678f,_0x1a34ae){_0x41678f=_0x41678f-0x0;var _0x55ec5c=_0x529c[_0x41678f];return _0x55ec5c;};'use strict';var _=require(_0xc529('0x0'));var moment=require(_0xc529('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xc529('0x2'));var config=require(_0xc529('0x3'));var logger=require(_0xc529('0x4'))(_0xc529('0x5'));config[_0xc529('0x6')]=_[_0xc529('0x7')](config[_0xc529('0x6')],{'host':_0xc529('0x8'),'port':0x18eb});var io=require(_0xc529('0x9'))(new Redis(config[_0xc529('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xc529('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1b6e1a){logger[_0xc529('0xb')]('start\x20email\x20channel');this[_0xc529('0xc')]=_0x1b6e1a['mailAccounts'];this[_0xc529('0xd')]={};this[_0xc529('0xe')]=new EmailSmtp();}EmailChannel[_0xc529('0xf')][_0xc529('0x10')]=function(_0x267672){var _0x410fa7=this[_0xc529('0xc')][_0x267672];var _0x19d806={'id':_0x410fa7['id'],'name':_0x410fa7['name'],'key':_0x410fa7['key'],'active':_0x410fa7[_0xc529('0x11')],'Imap':{'status':_0x410fa7[_0xc529('0x12')]['status'],'messageStatus':_0x410fa7[_0xc529('0x12')][_0xc529('0x13')],'total':_0x410fa7[_0xc529('0x12')][_0xc529('0x14')]}};if(_['isNil'](md5Accounts[_0x267672])){md5Accounts[_0x267672]={};}var _0x57e847=md5(JSON['stringify'](_0x19d806));if(md5Accounts[_0x267672][_0xc529('0x15')]!==_0x57e847){md5Accounts[_0x267672][_0xc529('0x15')]=_0x57e847;io[_0xc529('0x10')]('mailAccount:update',_0x19d806);}};EmailChannel[_0xc529('0xf')][_0xc529('0x16')]=function(_0x58dd70){for(var _0x463c5e in _0x58dd70){if(_0x58dd70[_0xc529('0x17')](_0x463c5e)){if(_0x58dd70[_0x463c5e][_0xc529('0x12')]&&_0x58dd70[_0x463c5e]['active']){var _0x4d0e59=_0x58dd70[_0x463c5e][_0xc529('0x12')];if(!this['imapAccounts'][_0xc529('0x17')](_0x4d0e59['id'])){this['imapAccounts'][_0x4d0e59['id']]=new EmailImap(_0x4d0e59,_0x58dd70[_0x463c5e][_0xc529('0x5')]);this[_0xc529('0xd')][_0x4d0e59['id']]['on'](_0xc529('0x18'),this['handleImapBox']['bind'](this,_0x463c5e));this['imapAccounts'][_0x4d0e59['id']]['on'](_0xc529('0x5'),this[_0xc529('0x19')]['bind'](this,_0x463c5e));this[_0xc529('0xd')][_0x4d0e59['id']]['on'](_0xc529('0x1a'),this[_0xc529('0x1b')][_0xc529('0x1c')](this,_0x463c5e));this[_0xc529('0xd')][_0x4d0e59['id']]['on'](_0xc529('0x1d'),this[_0xc529('0x1e')][_0xc529('0x1c')](this,_0x463c5e));}}else{if(_[_0xc529('0x1f')](this['mailAccounts'][_0x463c5e][_0xc529('0x12')])){this[_0xc529('0xc')][_0x463c5e][_0xc529('0x12')]={};}this[_0xc529('0xc')][_0x463c5e][_0xc529('0x12')][_0xc529('0x20')]=_0xc529('0x21');this[_0xc529('0xc')][_0x463c5e][_0xc529('0x12')][_0xc529('0x13')]='';this[_0xc529('0x10')](_0x463c5e);}}}};EmailChannel['prototype'][_0xc529('0x22')]=function(_0xf517ff,_0x209c93){if(this[_0xc529('0xc')][_0xf517ff]){this[_0xc529('0xc')][_0xf517ff]['Imap'][_0xc529('0x20')]=_0xc529('0x23');this['mailAccounts'][_0xf517ff]['Imap'][_0xc529('0x13')]=_0x209c93['name'];if(_0x209c93['messages']){this[_0xc529('0xc')][_0xf517ff][_0xc529('0x12')][_0xc529('0x14')]=_0x209c93['messages'][_0xc529('0x14')];}return this[_0xc529('0x10')](_0xf517ff);}};EmailChannel['prototype'][_0xc529('0x19')]=function(_0x2550d0,_0x34681e){logger[_0xc529('0xb')](_0xc529('0x24'),_0x34681e['firstName'],_0x34681e[_0xc529('0x25')],_0x34681e[_0xc529('0x26')],_0x2550d0);if(this[_0xc529('0xc')][_0x2550d0]){return mailAccount[_0xc529('0x27')](_0x2550d0,_0x34681e)['then'](function(_0x1185ed){if(_0x1185ed){logger[_0xc529('0xb')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x336161){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xc529('0x28')](_0x336161));});}};EmailChannel[_0xc529('0xf')]['handleImapEnd']=function(_0x364bdd){if(this[_0xc529('0xc')][_0x364bdd]&&this[_0xc529('0xc')][_0x364bdd]['Imap']){if(this[_0xc529('0xd')][this[_0xc529('0xc')][_0x364bdd]['Imap']['id']]){delete this[_0xc529('0xd')][this[_0xc529('0xc')][_0x364bdd][_0xc529('0x12')]['id']];}this[_0xc529('0xc')][_0x364bdd][_0xc529('0x12')][_0xc529('0x29')]=moment();this[_0xc529('0x10')](_0x364bdd);}};EmailChannel[_0xc529('0xf')][_0xc529('0x1e')]=function(_0x575de7,_0x484c29){if(this[_0xc529('0xc')][_0x575de7]){this[_0xc529('0xc')][_0x575de7][_0xc529('0x12')][_0xc529('0x20')]=_0xc529('0x1d');this['mailAccounts'][_0x575de7][_0xc529('0x12')][_0xc529('0x13')]=_0x484c29;return this[_0xc529('0x10')](_0x575de7);}};EmailChannel[_0xc529('0xf')][_0xc529('0x2a')]=function(_0x248be4,_0x5d5e8c){return this[_0xc529('0xe')][_0xc529('0x2b')](_0x248be4,_0x5d5e8c);};EmailChannel[_0xc529('0xf')]['verifySmtp']=function(_0x423da2){var _0x3a3abe=this;if(this[_0xc529('0xc')][_0x423da2['id']]){if(_['isNil'](this['mailAccounts'][_0x423da2['id']][_0xc529('0x2c')])){this[_0xc529('0xc')][_0x423da2['id']][_0xc529('0x2c')]={};}this[_0xc529('0xc')][_0x423da2['id']]['Smtp'][_0xc529('0x29')]=moment();return new BPromise(function(_0x15ca61,_0x35ff7e){return _0x3a3abe[_0xc529('0xe')][_0xc529('0x2d')](_0x423da2)['then'](function(_0x31dfc7){_0x3a3abe[_0xc529('0xc')][_0x423da2['id']][_0xc529('0x2c')][_0xc529('0x20')]=_0xc529('0x2e');_0x3a3abe['mailAccounts'][_0x423da2['id']]['Smtp'][_0xc529('0x13')]='';_0x3a3abe[_0xc529('0x10')](_0x423da2['id']);_0x15ca61(_0x31dfc7);})[_0xc529('0x2f')](function(_0x202e48){_0x3a3abe[_0xc529('0xc')][_0x423da2['id']][_0xc529('0x2c')][_0xc529('0x20')]=_0xc529('0x1d');_0x3a3abe[_0xc529('0xc')][_0x423da2['id']]['Smtp'][_0xc529('0x13')]=_0x202e48;_0x3a3abe[_0xc529('0x10')](_0x423da2['id']);_0x35ff7e(_0x202e48);});});}return this[_0xc529('0xe')][_0xc529('0x2d')](_0x423da2);};module[_0xc529('0x30')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e495193..831c466 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 _0xaccc=['Iconv','events','EventEmitter','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','mailbox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','mailparser','iconv'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xaccc,0x16f));var _0xcacc=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0xaccc[_0x30c649];return _0x3edfb9;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xcacc('0x0'));var Imap=require(_0xcacc('0x1'));var _=require(_0xcacc('0x2'));var rs=require('randomstring');var simpleParser=require(_0xcacc('0x3'))['simpleParser'];var Iconv=require(_0xcacc('0x4'))[_0xcacc('0x5')];var EventEmitter=require(_0xcacc('0x6'))[_0xcacc('0x7')];var utils=require('./utils');var logger=require(_0xcacc('0x8'))(_0xcacc('0x9'));function EmailImap(_0x1862bf,_0x180656){this['mailbox']=_0xcacc('0xa');this[_0xcacc('0xb')]=this[_0xcacc('0xc')](_0x1862bf,_0x180656);this[_0xcacc('0x1')]=new Imap(this[_0xcacc('0xb')]);this[_0xcacc('0x1')][_0xcacc('0xd')](_0xcacc('0xe'),this[_0xcacc('0xf')]['bind'](this));this[_0xcacc('0x1')]['once']('end',this['handleEnd'][_0xcacc('0x10')](this));this[_0xcacc('0x1')]['on'](_0xcacc('0x11'),this['handleError'][_0xcacc('0x10')](this));this[_0xcacc('0x1')][_0xcacc('0x12')]();}util[_0xcacc('0x13')](EmailImap,EventEmitter);EmailImap[_0xcacc('0x14')]['getAccount']=function(_0x50aa7e,_0x4fff4e){var _0x106783={'connTimeout':_0x50aa7e[_0xcacc('0x15')]?_0x50aa7e[_0xcacc('0x15')]*0x3e8:0x2710,'authTimeout':_0x50aa7e[_0xcacc('0x16')]?_0x50aa7e['authTimeout']*0x3e8:0x1388};if(_[_0xcacc('0x17')](_0x50aa7e['service'])){if(_0x50aa7e[_0xcacc('0x18')]){_0x106783[_0xcacc('0x19')]=_0x50aa7e[_0xcacc('0x19')];_0x106783[_0xcacc('0x1a')]=_0x50aa7e[_0xcacc('0x1a')];}_0x106783[_0xcacc('0x1b')]=_0x50aa7e['host'];_0x106783[_0xcacc('0x1c')]=_0x50aa7e['port']||0x3e1;if(_0x50aa7e[_0xcacc('0x1d')]){_0x106783['tls']=!![];}else{_0x106783[_0xcacc('0x1d')]=![];_0x106783['autotls']=_0xcacc('0x1e');}}else{_0x106783[_0xcacc('0x19')]=_0x50aa7e[_0xcacc('0x19')];_0x106783[_0xcacc('0x1a')]=_0x50aa7e[_0xcacc('0x1a')];_0x106783[_0xcacc('0x1b')]=utils[_0xcacc('0x1f')](_0x50aa7e[_0xcacc('0x20')]);_0x106783[_0xcacc('0x1c')]=0x3e1;_0x106783[_0xcacc('0x1d')]=!![];}_0x106783[_0xcacc('0x9')]=_0x4fff4e||_0x50aa7e[_0xcacc('0x19')]||_0xcacc('0x21');return _0x106783;};EmailImap[_0xcacc('0x14')]['handleReady']=function(){this[_0xcacc('0x1')]['openBox'](this[_0xcacc('0x22')],![],this[_0xcacc('0x23')][_0xcacc('0x10')](this));};EmailImap[_0xcacc('0x14')][_0xcacc('0x23')]=function(_0x38b75f,_0x3fe3d5){if(_0x38b75f){this[_0xcacc('0x24')](_0x38b75f,!![]);}else{this['emit'](_0xcacc('0x25'),_0x3fe3d5);this[_0xcacc('0x26')]();}};EmailImap[_0xcacc('0x14')][_0xcacc('0x27')]=function(_0x13d74a){if(_0x13d74a){this['handleError'](_0x13d74a,!![]);}else{this['imap'][_0xcacc('0x28')]();}};EmailImap[_0xcacc('0x14')][_0xcacc('0x26')]=function(){this[_0xcacc('0x1')][_0xcacc('0x29')](['UNSEEN'],this[_0xcacc('0x2a')][_0xcacc('0x10')](this));};EmailImap[_0xcacc('0x14')][_0xcacc('0x2a')]=function(_0x5a6f2a,_0x14f979){if(_0x5a6f2a){this[_0xcacc('0x24')](_0x5a6f2a,!![]);}else{if(_0x14f979[_0xcacc('0x2b')]){try{var _0x183767=this[_0xcacc('0x1')][_0xcacc('0x2c')](_0x14f979,{'bodies':'','markSeen':!![]});_0x183767['on'](_0xcacc('0x2d'),this[_0xcacc('0x2e')][_0xcacc('0x10')](this));_0x183767[_0xcacc('0xd')](_0xcacc('0x11'),this[_0xcacc('0x2f')]['bind'](this));_0x183767[_0xcacc('0xd')](_0xcacc('0x28'),this[_0xcacc('0x30')]['bind'](this));}catch(_0x38cf23){logger[_0xcacc('0x11')](_0x38cf23);}}else{this[_0xcacc('0x1')][_0xcacc('0x31')](!![],this[_0xcacc('0x27')][_0xcacc('0x10')](this));}}};EmailImap[_0xcacc('0x14')]['handleFetchMessage']=function(_0x398380,_0x207c34){_0x398380['on']('body',this[_0xcacc('0x32')][_0xcacc('0x10')](this));_0x398380[_0xcacc('0xd')](_0xcacc('0x33'),this[_0xcacc('0x34')][_0xcacc('0x10')](this));_0x398380['once']('end',this[_0xcacc('0x35')][_0xcacc('0x10')](this));};EmailImap[_0xcacc('0x14')][_0xcacc('0x32')]=function(_0x4f454d,_0x479f6c){simpleParser(_0x4f454d,{'Iconv':Iconv},this[_0xcacc('0x36')][_0xcacc('0x10')](this));};EmailImap[_0xcacc('0x14')][_0xcacc('0x34')]=function(_0x341376){};EmailImap[_0xcacc('0x14')][_0xcacc('0x35')]=function(){};EmailImap[_0xcacc('0x14')][_0xcacc('0x36')]=function(_0x136f9c,_0x56e3e9){if(_0x136f9c){logger[_0xcacc('0x11')](_0x136f9c);}else{var _0x5111b5=this;utils[_0xcacc('0x37')](this['account'],_0x56e3e9,function(_0x575358){_0x5111b5['emit'](_0xcacc('0x9'),_0x575358);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0xcacc('0x31')](!![],this[_0xcacc('0x27')][_0xcacc('0x10')](this));};EmailImap[_0xcacc('0x14')]['handleFetchError']=function(_0x266ac4){this['handleError'](_0x266ac4);this['imap'][_0xcacc('0x31')](!![],this[_0xcacc('0x27')][_0xcacc('0x10')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xcacc('0x38')](_0xcacc('0x28'));};EmailImap['prototype'][_0xcacc('0x24')]=function(_0x16a7f4,_0x3c69e5){logger['error'](_0xcacc('0x24'),this[_0xcacc('0xb')][_0xcacc('0x9')],JSON[_0xcacc('0x39')](_0x16a7f4));var _0x14833d='';if(_0x16a7f4){if(_0x16a7f4[_0xcacc('0x3a')]){_0x14833d=_0x16a7f4[_0xcacc('0x3a')];}else{for(var _0x398b62 in _0x16a7f4){if(_0x16a7f4[_0xcacc('0x3b')](_0x398b62)){_0x14833d+=_[_0xcacc('0x3c')](_0x398b62)+':\x20'+_0x16a7f4[_0x398b62]+'\x0a';}}}}if(_0x3c69e5){this[_0xcacc('0x1')][_0xcacc('0x28')]();}else{this['emit'](_0xcacc('0x11'),_0x14833d);this[_0xcacc('0x38')](_0xcacc('0x28'));}};module[_0xcacc('0x3d')]=EmailImap; \ No newline at end of file +var _0x582f=['attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','account','stringify','textCode','hasOwnProperty','upperFirst','exports','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','prototype','handleOpenBox','emit','box','readUnseen','UNSEEN','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody'];(function(_0x17704c,_0x336b34){var _0x2fbd5d=function(_0x280367){while(--_0x280367){_0x17704c['push'](_0x17704c['shift']());}};_0x2fbd5d(++_0x336b34);}(_0x582f,0x1f4));var _0xf582=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x582f[_0x2b737c];return _0x466ed5;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require('imap');var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0xf582('0x0'))[_0xf582('0x1')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xf582('0x2'))[_0xf582('0x3')];var utils=require(_0xf582('0x4'));var logger=require(_0xf582('0x5'))(_0xf582('0x6'));function EmailImap(_0x22ebf9,_0x213b4e){this[_0xf582('0x7')]=_0xf582('0x8');this['account']=this[_0xf582('0x9')](_0x22ebf9,_0x213b4e);this[_0xf582('0xa')]=new Imap(this['account']);this[_0xf582('0xa')]['once'](_0xf582('0xb'),this[_0xf582('0xc')][_0xf582('0xd')](this));this[_0xf582('0xa')][_0xf582('0xe')](_0xf582('0xf'),this[_0xf582('0x10')][_0xf582('0xd')](this));this[_0xf582('0xa')]['on'](_0xf582('0x11'),this[_0xf582('0x12')]['bind'](this));this[_0xf582('0xa')][_0xf582('0x13')]();}util[_0xf582('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0xf582('0x9')]=function(_0x599c38,_0x59ef2a){var _0x5b77d3={'connTimeout':_0x599c38[_0xf582('0x15')]?_0x599c38[_0xf582('0x15')]*0x3e8:0x2710,'authTimeout':_0x599c38[_0xf582('0x16')]?_0x599c38[_0xf582('0x16')]*0x3e8:0x1388};if(_[_0xf582('0x17')](_0x599c38[_0xf582('0x18')])){if(_0x599c38[_0xf582('0x19')]){_0x5b77d3[_0xf582('0x1a')]=_0x599c38['user'];_0x5b77d3[_0xf582('0x1b')]=_0x599c38[_0xf582('0x1b')];}_0x5b77d3[_0xf582('0x1c')]=_0x599c38['host'];_0x5b77d3[_0xf582('0x1d')]=_0x599c38['port']||0x3e1;if(_0x599c38[_0xf582('0x1e')]){_0x5b77d3[_0xf582('0x1e')]=!![];}else{_0x5b77d3['tls']=![];_0x5b77d3[_0xf582('0x1f')]='required';}}else{_0x5b77d3[_0xf582('0x1a')]=_0x599c38[_0xf582('0x1a')];_0x5b77d3[_0xf582('0x1b')]=_0x599c38[_0xf582('0x1b')];_0x5b77d3[_0xf582('0x1c')]=utils[_0xf582('0x20')](_0x599c38[_0xf582('0x18')]);_0x5b77d3[_0xf582('0x1d')]=0x3e1;_0x5b77d3[_0xf582('0x1e')]=!![];}_0x5b77d3[_0xf582('0x6')]=_0x59ef2a||_0x599c38[_0xf582('0x1a')]||_0xf582('0x21');return _0x5b77d3;};EmailImap[_0xf582('0x22')][_0xf582('0xc')]=function(){this[_0xf582('0xa')]['openBox'](this[_0xf582('0x7')],![],this[_0xf582('0x23')][_0xf582('0xd')](this));};EmailImap[_0xf582('0x22')][_0xf582('0x23')]=function(_0x186454,_0x37f1b8){if(_0x186454){this[_0xf582('0x12')](_0x186454,!![]);}else{this[_0xf582('0x24')](_0xf582('0x25'),_0x37f1b8);this[_0xf582('0x26')]();}};EmailImap[_0xf582('0x22')]['handleCloseBox']=function(_0x593548){if(_0x593548){this[_0xf582('0x12')](_0x593548,!![]);}else{this[_0xf582('0xa')][_0xf582('0xf')]();}};EmailImap[_0xf582('0x22')]['readUnseen']=function(){this[_0xf582('0xa')]['search']([_0xf582('0x27')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x10979c,_0x1156a3){if(_0x10979c){this[_0xf582('0x12')](_0x10979c,!![]);}else{if(_0x1156a3[_0xf582('0x28')]){try{var _0x39ea14=this['imap'][_0xf582('0x29')](_0x1156a3,{'bodies':'','markSeen':!![]});_0x39ea14['on'](_0xf582('0x2a'),this[_0xf582('0x2b')]['bind'](this));_0x39ea14[_0xf582('0xe')](_0xf582('0x11'),this['handleFetchError']['bind'](this));_0x39ea14[_0xf582('0xe')](_0xf582('0xf'),this[_0xf582('0x2c')][_0xf582('0xd')](this));}catch(_0x531560){logger['error'](_0x531560);}}else{this[_0xf582('0xa')][_0xf582('0x2d')](!![],this[_0xf582('0x2e')]['bind'](this));}}};EmailImap[_0xf582('0x22')][_0xf582('0x2b')]=function(_0x3dc732,_0x147f7f){_0x3dc732['on'](_0xf582('0x2f'),this[_0xf582('0x30')][_0xf582('0xd')](this));_0x3dc732[_0xf582('0xe')](_0xf582('0x31'),this[_0xf582('0x32')][_0xf582('0xd')](this));_0x3dc732['once'](_0xf582('0xf'),this[_0xf582('0x33')]['bind'](this));};EmailImap[_0xf582('0x22')][_0xf582('0x30')]=function(_0x528d9f,_0x474ef5){simpleParser(_0x528d9f,{'Iconv':Iconv},this[_0xf582('0x34')][_0xf582('0xd')](this));};EmailImap[_0xf582('0x22')][_0xf582('0x32')]=function(_0x128e24){};EmailImap['prototype'][_0xf582('0x33')]=function(){};EmailImap[_0xf582('0x22')][_0xf582('0x34')]=function(_0x1ce909,_0x43fb68){if(_0x1ce909){logger['error'](_0x1ce909);}else{var _0x184f3b=this;utils[_0xf582('0x35')](this['account'],_0x43fb68,function(_0x865d61){_0x184f3b[_0xf582('0x24')]('email',_0x865d61);});}};EmailImap[_0xf582('0x22')][_0xf582('0x2c')]=function(){this[_0xf582('0xa')][_0xf582('0x2d')](!![],this[_0xf582('0x2e')][_0xf582('0xd')](this));};EmailImap[_0xf582('0x22')][_0xf582('0x36')]=function(_0x5f11dc){this[_0xf582('0x12')](_0x5f11dc);this['imap'][_0xf582('0x2d')](!![],this['handleCloseBox'][_0xf582('0xd')](this));};EmailImap['prototype'][_0xf582('0x10')]=function(){this[_0xf582('0x24')](_0xf582('0xf'));};EmailImap[_0xf582('0x22')][_0xf582('0x12')]=function(_0x57a16f,_0x2a268e){logger[_0xf582('0x11')](_0xf582('0x12'),this[_0xf582('0x37')][_0xf582('0x6')],JSON[_0xf582('0x38')](_0x57a16f));var _0x23b121='';if(_0x57a16f){if(_0x57a16f[_0xf582('0x39')]){_0x23b121=_0x57a16f[_0xf582('0x39')];}else{for(var _0x446247 in _0x57a16f){if(_0x57a16f[_0xf582('0x3a')](_0x446247)){_0x23b121+=_[_0xf582('0x3b')](_0x446247)+':\x20'+_0x57a16f[_0x446247]+'\x0a';}}}}if(_0x2a268e){this[_0xf582('0xa')]['end']();}else{this[_0xf582('0x24')](_0xf582('0x11'),_0x23b121);this['emit'](_0xf582('0xf'));}};module[_0xf582('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 343067f..03440e3 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 _0x163b=['bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','verify','toString','Not\x20verifired','exports','nodemailer'];(function(_0xa5e821,_0x4dd2f6){var _0x62d0cd=function(_0x119f86){while(--_0x119f86){_0xa5e821['push'](_0xa5e821['shift']());}};_0x62d0cd(++_0x4dd2f6);}(_0x163b,0x103));var _0xb163=function(_0x3329c5,_0x821244){_0x3329c5=_0x3329c5-0x0;var _0x4ee002=_0x163b[_0x3329c5];return _0x4ee002;};'use strict';var nodemailer=require(_0xb163('0x0'));var BPromise=require(_0xb163('0x1'));var inlineBase64=require(_0xb163('0x2'));function EmailSmtp(){}EmailSmtp[_0xb163('0x3')][_0xb163('0x4')]=function(_0x39b656,_0x5e8247){return new BPromise(function(_0x2028d6,_0x4f63f9){var _0x56131a=nodemailer[_0xb163('0x5')](_0x39b656);_0x56131a[_0xb163('0x6')](_0xb163('0x7'),inlineBase64());_0x56131a[_0xb163('0x8')](_0x5e8247,function(_0x3341c4,_0x1fb197){if(_0x3341c4){_0x4f63f9(_0x3341c4['toString']());}else{_0x2028d6(_0x1fb197);}});});};EmailSmtp[_0xb163('0x3')][_0xb163('0x9')]=function(_0x4f1962){return new BPromise(function(_0x3334eb,_0x2dcb87){var _0x5a2af7=nodemailer[_0xb163('0x5')](_0x4f1962);_0x5a2af7[_0xb163('0x9')](function(_0x589a6d,_0x300a49){if(_0x589a6d){_0x2dcb87(_0x589a6d[_0xb163('0xa')]());}else{if(_0x300a49){_0x3334eb(_0x300a49);}else{_0x2dcb87(_0xb163('0xb'));}}});});};module[_0xb163('0xc')]=EmailSmtp; \ No newline at end of file +var _0x63dd=['nodemailer-plugin-inline-base64','prototype','use','compile','toString','verify','createTransport','Not\x20verifired','exports','nodemailer'];(function(_0x5b57ae,_0x3492fc){var _0x403520=function(_0x1524db){while(--_0x1524db){_0x5b57ae['push'](_0x5b57ae['shift']());}};_0x403520(++_0x3492fc);}(_0x63dd,0x199));var _0xd63d=function(_0x1078bc,_0x115563){_0x1078bc=_0x1078bc-0x0;var _0x57d2dd=_0x63dd[_0x1078bc];return _0x57d2dd;};'use strict';var nodemailer=require(_0xd63d('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xd63d('0x1'));function EmailSmtp(){}EmailSmtp[_0xd63d('0x2')]['send']=function(_0x3ee1ba,_0x50bd93){return new BPromise(function(_0xc8cf58,_0x50d650){var _0x1fbd6d=nodemailer['createTransport'](_0x3ee1ba);_0x1fbd6d[_0xd63d('0x3')](_0xd63d('0x4'),inlineBase64());_0x1fbd6d['sendMail'](_0x50bd93,function(_0x3bb4f9,_0x55f708){if(_0x3bb4f9){_0x50d650(_0x3bb4f9[_0xd63d('0x5')]());}else{_0xc8cf58(_0x55f708);}});});};EmailSmtp[_0xd63d('0x2')][_0xd63d('0x6')]=function(_0x288ca3){return new BPromise(function(_0x163c2b,_0x501ee4){var _0x25e5e1=nodemailer[_0xd63d('0x7')](_0x288ca3);_0x25e5e1['verify'](function(_0x167c90,_0x2f16c9){if(_0x167c90){_0x501ee4(_0x167c90[_0xd63d('0x5')]());}else{if(_0x2f16c9){_0x163c2b(_0x2f16c9);}else{_0x501ee4(_0xd63d('0x8'));}}});});};module[_0xd63d('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 2239762..6b641c5 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 _0x56ac=['

Empty\x20message

','Attachments','push','Title','Data','getHost','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','slice','join','Anonymous','pop','length','isEmpty','html','test','body','0x1?_0x466336[_0xc56a('0x12')]():'';}return'';}function getMails(_0x792ea9,_0x3b5bdc){var _0x563bb5='';for(var _0x1f6a1c=0x0;_0x1f6a1c<_0x3b5bdc[_0xc56a('0x7')][_0xc56a('0x13')];_0x1f6a1c+=0x1){if(_0x3b5bdc[_0xc56a('0x7')][_0x1f6a1c][_0xc56a('0x8')]!==_0x792ea9){if(!_[_0xc56a('0x14')](_0x563bb5)){_0x563bb5+=',';}_0x563bb5+=_0x3b5bdc['value'][_0x1f6a1c][_0xc56a('0xd')]||_0x3b5bdc[_0xc56a('0x7')][_0x1f6a1c][_0xc56a('0x8')]||'';_0x563bb5+='\x20<';_0x563bb5+=_0x3b5bdc[_0xc56a('0x7')][_0x1f6a1c][_0xc56a('0x8')]?_0x3b5bdc[_0xc56a('0x7')][_0x1f6a1c][_0xc56a('0x8')]:_0xc56a('0x9')+random[_0xc56a('0xa')](0x6)+_0xc56a('0xb');_0x563bb5+='>';}}return _0x563bb5;}function parseEmail(_0x481f62,_0x7a0cbe,_0x311a0d){if(_0x7a0cbe[_0xc56a('0x15')]){var _0x50b16c=/)<[^<]*)*<\/script>/gi;while(_0x50b16c[_0xc56a('0x16')](_0x7a0cbe[_0xc56a('0x15')])){_0x7a0cbe[_0xc56a('0x15')]=_0x7a0cbe[_0xc56a('0x15')]['replace'](_0x50b16c,'');}_0x311a0d[_0xc56a('0x17')]=_0x7a0cbe['html'];}else{_0x311a0d[_0xc56a('0x17')]=_0x7a0cbe['textAsHtml'];}if(_0x311a0d[_0xc56a('0x17')]){_0x311a0d[_0xc56a('0x17')]=_0x311a0d['body']['replace'](/Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value'];(function(_0x269a72,_0x5a7194){var _0x3acd68=function(_0x3cf0ac){while(--_0x3cf0ac){_0x269a72['push'](_0x269a72['shift']());}};_0x3acd68(++_0x5a7194);}(_0x3637,0xbf));var _0x7363=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0x3637[_0x28b7ab];return _0x56791b;};'use strict';var _=require('lodash');var moment=require(_0x7363('0x0'));var random=require(_0x7363('0x1'));var fs=require('fs');var path=require(_0x7363('0x2'));var util=require(_0x7363('0x3'));var tnef=require(_0x7363('0x4'));var logger=require(_0x7363('0x5'))(_0x7363('0x6'));var config=require(_0x7363('0x7'));function getAddress(_0x1e9ef7){var _0x3bea9c=_[_0x7363('0x8')](_0x1e9ef7[_0x7363('0x9')]);return _0x3bea9c&&_0x3bea9c[_0x7363('0xa')]?_0x3bea9c['address']:_0x7363('0xb')+random['generate'](0x6)+_0x7363('0xc');}function getFirstName(_0x4fba52){var _0x1e1bc9=_[_0x7363('0x8')](_0x4fba52['value']);if(_0x1e1bc9&&_0x1e1bc9['name']){var _0x4709e1=_0x1e1bc9[_0x7363('0xd')]['split'](/\s+/);return _0x4709e1[_0x7363('0xe')]?_0x4709e1[_0x7363('0xf')](0x0,-0x1)[_0x7363('0x10')]('\x20'):_0x1e1bc9[_0x7363('0xd')];}return _0x7363('0x11');}function getLastName(_0x4019cd){var _0x36b9dc=_[_0x7363('0x8')](_0x4019cd[_0x7363('0x9')]);if(_0x36b9dc&&_0x36b9dc[_0x7363('0xd')]){var _0x445801=_0x36b9dc[_0x7363('0xd')]['split'](/\s+/);return _0x445801[_0x7363('0xe')]>0x1?_0x445801[_0x7363('0x12')]():'';}return'';}function getMails(_0x5ed62c,_0x45f283){var _0x2a9849='';for(var _0x18a4a4=0x0;_0x18a4a4<_0x45f283['value']['length'];_0x18a4a4+=0x1){if(_0x45f283[_0x7363('0x9')][_0x18a4a4]['address']!==_0x5ed62c){if(!_[_0x7363('0x13')](_0x2a9849)){_0x2a9849+=',';}_0x2a9849+=_0x45f283[_0x7363('0x9')][_0x18a4a4][_0x7363('0xd')]||_0x45f283['value'][_0x18a4a4][_0x7363('0xa')]||'';_0x2a9849+='\x20<';_0x2a9849+=_0x45f283['value'][_0x18a4a4]['address']?_0x45f283['value'][_0x18a4a4][_0x7363('0xa')]:_0x7363('0xb')+random[_0x7363('0x14')](0x6)+_0x7363('0xc');_0x2a9849+='>';}}return _0x2a9849;}function parseEmail(_0x497a88,_0x39b6f7,_0x28cae8){if(_0x39b6f7[_0x7363('0x15')]){var _0x250792=/)<[^<]*)*<\/script>/gi;while(_0x250792[_0x7363('0x16')](_0x39b6f7[_0x7363('0x15')])){_0x39b6f7[_0x7363('0x15')]=_0x39b6f7[_0x7363('0x15')][_0x7363('0x17')](_0x250792,'');}_0x28cae8[_0x7363('0x18')]=_0x39b6f7[_0x7363('0x15')];}else{_0x28cae8[_0x7363('0x18')]=_0x39b6f7[_0x7363('0x19')];}if(_0x28cae8[_0x7363('0x18')]){_0x28cae8['body']=_0x28cae8[_0x7363('0x18')]['replace'](/0x0){if(this[_0x37a3bd+_0x820d('0x28')]>0x0&&this[_0x37a3bd+_0x820d('0x29')]>=this[_0x37a3bd+_0x820d('0x28')]){return _0x820d('0x2a');}else{return _0x820d('0x2b');}}else{return _0x820d('0x2c');}};Agent[_0x820d('0x2d')][_0x820d('0x26')]=function(){var _0x4650d0=[_0x820d('0x2e'),'chat',_0x820d('0x2f'),'fax',_0x820d('0x30'),_0x820d('0x31')];for(var _0xa9fc92=0x0;_0xa9fc92<_0x4650d0[_0x820d('0x32')];_0xa9fc92+=0x1){var _0x3fecb0=this[_0x820d('0x27')](_0x4650d0[_0xa9fc92]);if(this[_0x4650d0[_0xa9fc92]+_0x820d('0x33')]!==_0x3fecb0){this[_0x4650d0[_0xa9fc92]+'StatusTime']=_[_0x820d('0x34')](moment()[_0x820d('0x35')]('x'));}this[_0x4650d0[_0xa9fc92]+_0x820d('0x33')]=_0x3fecb0;}var _0x537823={'id':this['id'],'name':this[_0x820d('0x7')],'online':this['online'],'voicePause':this[_0x820d('0x9')],'chatPause':this[_0x820d('0xa')],'mailPause':this[_0x820d('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x820d('0xd')],'chatStatus':this[_0x820d('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x820d('0x11')],'mailStatus':this[_0x820d('0x36')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x820d('0x14')],'mailCurrentCapacity':this[_0x820d('0x15')],'faxStatus':this[_0x820d('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x820d('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x820d('0x1a')],'smsCurrentCapacity':this[_0x820d('0x1b')],'whatsappStatus':this[_0x820d('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x820d('0x1e')],'whatsappCurrentCapacity':this[_0x820d('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x820d('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x820d('0x23')],'busy':this[_0x820d('0x24')],'busyQueue':this[_0x820d('0x25')]};var _0x50351f=md5(JSON[_0x820d('0x37')](_0x537823));if(this['md5']!==_0x50351f){this[_0x820d('0x2')]=_0x50351f;io[_0x820d('0x38')](_0x820d('0x39'),_0x537823);}};module[_0x820d('0x3a')]=Agent; \ No newline at end of file +var _0x24e9=['format','voicePause','mailStatusTime','faxCurrentCapacity','smsStatus','smsCurrentCapacity','whatsappStatusTime','busy','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x24e9,0x85));var _0x924e=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x24e9[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0x924e('0x0'));var moment=require('moment');var md5=require(_0x924e('0x1'));var Redis=require(_0x924e('0x2'));var config=require(_0x924e('0x3'));config[_0x924e('0x4')]=_[_0x924e('0x5')](config[_0x924e('0x4')],{'host':_0x924e('0x6'),'port':0x18eb});var io=require(_0x924e('0x7'))(new Redis(config['redis']));function Agent(_0x18346f){this['id']=_0x18346f['id']||0x0;this[_0x924e('0x8')]=_0x18346f[_0x924e('0x8')]||'';this[_0x924e('0x9')]=_0x18346f[_0x924e('0x9')]||!![];this['voicePause']=_0x18346f['voicePause']||![];this[_0x924e('0xa')]=_0x18346f[_0x924e('0xa')]||![];this[_0x924e('0xb')]=_0x18346f[_0x924e('0xb')]||![];this['faxPause']=_0x18346f[_0x924e('0xc')]||![];this[_0x924e('0xd')]=_0x18346f['smsPause']||![];this[_0x924e('0xe')]=_0x18346f['openchannelPause']||![];this[_0x924e('0xf')]=_0x924e('0x10');this[_0x924e('0x11')]=0x0;this[_0x924e('0x12')]=_0x18346f[_0x924e('0x12')]||0x0;this[_0x924e('0x13')]=0x0;this[_0x924e('0x14')]=_0x924e('0x10');this['mailStatusTime']=0x0;this[_0x924e('0x15')]=_0x18346f['mailCapacity']||0x0;this[_0x924e('0x16')]=0x0;this[_0x924e('0x17')]=_0x924e('0x10');this[_0x924e('0x18')]=0x0;this[_0x924e('0x19')]=_0x18346f[_0x924e('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x924e('0x10');this[_0x924e('0x1a')]=0x0;this['smsCapacity']=_0x18346f[_0x924e('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x924e('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x18346f[_0x924e('0x1c')]||0x0;this[_0x924e('0x1d')]=0x0;this[_0x924e('0x1e')]=_0x924e('0x10');this[_0x924e('0x1f')]=0x0;this['openchannelCapacity']=_0x18346f[_0x924e('0x20')]||0x0;this[_0x924e('0x21')]=0x0;this['busy']=![];this[_0x924e('0x22')]=undefined;this[_0x924e('0x1')]='';this[_0x924e('0x23')]();}Agent[_0x924e('0x24')]['getChannelStatus']=function(_0x38782f){if(this[_0x38782f+_0x924e('0x25')]>0x0){if(this[_0x38782f+'Capacity']>0x0&&this[_0x38782f+_0x924e('0x25')]>=this[_0x38782f+_0x924e('0x26')]){return'maxcapacity';}else{return _0x924e('0x27');}}else{return _0x924e('0x28');}};Agent[_0x924e('0x24')][_0x924e('0x23')]=function(){var _0x33bc7c=[_0x924e('0x29'),_0x924e('0x2a'),_0x924e('0x2b'),_0x924e('0x2c'),_0x924e('0x2d'),'whatsapp'];for(var _0x497daa=0x0;_0x497daa<_0x33bc7c[_0x924e('0x2e')];_0x497daa+=0x1){var _0x5e4fd8=this['getChannelStatus'](_0x33bc7c[_0x497daa]);if(this[_0x33bc7c[_0x497daa]+_0x924e('0x2f')]!==_0x5e4fd8){this[_0x33bc7c[_0x497daa]+_0x924e('0x30')]=_[_0x924e('0x31')](moment()[_0x924e('0x32')]('x'));}this[_0x33bc7c[_0x497daa]+'Status']=_0x5e4fd8;}var _0x52d47d={'id':this['id'],'name':this[_0x924e('0x8')],'online':this['online'],'voicePause':this[_0x924e('0x33')],'chatPause':this[_0x924e('0xa')],'mailPause':this[_0x924e('0xb')],'smsPause':this[_0x924e('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x924e('0xe')],'chatStatus':this[_0x924e('0xf')],'chatStatusTime':this[_0x924e('0x11')],'chatCapacity':this[_0x924e('0x12')],'chatCurrentCapacity':this[_0x924e('0x13')],'mailStatus':this[_0x924e('0x14')],'mailStatusTime':this[_0x924e('0x34')],'mailCapacity':this[_0x924e('0x15')],'mailCurrentCapacity':this[_0x924e('0x16')],'faxStatus':this[_0x924e('0x17')],'faxStatusTime':this[_0x924e('0x18')],'faxCapacity':this[_0x924e('0x19')],'faxCurrentCapacity':this[_0x924e('0x35')],'smsStatus':this[_0x924e('0x36')],'smsStatusTime':this[_0x924e('0x1a')],'smsCapacity':this[_0x924e('0x1b')],'smsCurrentCapacity':this[_0x924e('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x924e('0x38')],'whatsappCapacity':this[_0x924e('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x924e('0x1e')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x924e('0x20')],'openchannelCurrentCapacity':this[_0x924e('0x21')],'busy':this[_0x924e('0x39')],'busyQueue':this[_0x924e('0x22')]};var _0x238301=md5(JSON['stringify'](_0x52d47d));if(this[_0x924e('0x1')]!==_0x238301){this[_0x924e('0x1')]=_0x238301;io[_0x924e('0x3a')](_0x924e('0x3b'),_0x52d47d);}};module[_0x924e('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e18ec07..783ba29 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 _0x7b4d=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','chatPause','available','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x286a19,_0x419d58){var _0x49d84f=function(_0x2a1cd9){while(--_0x2a1cd9){_0x286a19['push'](_0x286a19['shift']());}};_0x49d84f(++_0x419d58);}(_0x7b4d,0x16a));var _0xd7b4=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7b4d[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xd7b4('0x0'));var md5=require(_0xd7b4('0x1'));var util=require(_0xd7b4('0x2'));var Redis=require(_0xd7b4('0x3'));var config=require(_0xd7b4('0x4'));config[_0xd7b4('0x5')]=_[_0xd7b4('0x6')](config[_0xd7b4('0x5')],{'host':_0xd7b4('0x7'),'port':0x18eb});var io=require(_0xd7b4('0x8'))(new Redis(config['redis']));function ChatQueue(_0x2754a3){this['id']=_0x2754a3['id']||0x0;this[_0xd7b4('0x9')]=_0x2754a3['name']||'';this['timeout']=_0x2754a3[_0xd7b4('0xa')]||0xa;this[_0xd7b4('0xb')]=_0x2754a3['strategy']||_0xd7b4('0xc');this[_0xd7b4('0xd')]=_0x2754a3[_0xd7b4('0xd')];this[_0xd7b4('0xe')]={};this['waiting']=0x0;this[_0xd7b4('0x1')]='';this[_0xd7b4('0xf')]();this[_0xd7b4('0x10')]();}ChatQueue[_0xd7b4('0x11')]['updateRouting']=function(){var _0x163578=this['mapAgentsId'][_0xd7b4('0x12')];this['mapAgentsId']=_['map'](this[_0xd7b4('0xd')],'id');this['mapAgentsId'][_0xd7b4('0x12')]=_0x163578;};ChatQueue[_0xd7b4('0x11')][_0xd7b4('0x10')]=function(){this[_0xd7b4('0x13')]=0x0;this[_0xd7b4('0x14')]=0x0;for(var _0x400283=0x0;_0x400283=0x0?this[_0xd7b4('0x18')]:0x0;var _0x504b01={'id':this['id'],'available':this[_0xd7b4('0x18')],'loggedIn':this[_0xd7b4('0x13')],'name':this['name'],'paused':this[_0xd7b4('0x14')],'waiting':this[_0xd7b4('0x19')]};var _0x596c00=md5(JSON['stringify'](_0x504b01));if(this[_0xd7b4('0x1')]!==_0x596c00){this[_0xd7b4('0x1')]=_0x596c00;io['to'](util[_0xd7b4('0x1a')](_0xd7b4('0x1b'),_0x504b01['name']))[_0xd7b4('0x1c')](_0xd7b4('0x1d'),_0x504b01);}};module[_0xd7b4('0x1e')]=ChatQueue; \ No newline at end of file +var _0xa1f1=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','loggedIn','length','chatPause','paused','available','stringify','emit','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa1f1,0x172));var _0x1a1f=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0xa1f1[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x1a1f('0x0'));var md5=require(_0x1a1f('0x1'));var util=require(_0x1a1f('0x2'));var Redis=require(_0x1a1f('0x3'));var config=require(_0x1a1f('0x4'));config[_0x1a1f('0x5')]=_['defaults'](config[_0x1a1f('0x5')],{'host':_0x1a1f('0x6'),'port':0x18eb});var io=require(_0x1a1f('0x7'))(new Redis(config[_0x1a1f('0x5')]));function ChatQueue(_0x20d007){this['id']=_0x20d007['id']||0x0;this[_0x1a1f('0x8')]=_0x20d007[_0x1a1f('0x8')]||'';this['timeout']=_0x20d007[_0x1a1f('0x9')]||0xa;this[_0x1a1f('0xa')]=_0x20d007['strategy']||_0x1a1f('0xb');this[_0x1a1f('0xc')]=_0x20d007[_0x1a1f('0xc')];this[_0x1a1f('0xd')]={};this[_0x1a1f('0xe')]=0x0;this[_0x1a1f('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x1a1f('0xf')][_0x1a1f('0x10')]=function(){var _0x16ab1e=this[_0x1a1f('0xd')][_0x1a1f('0x11')];this[_0x1a1f('0xd')]=_['map'](this[_0x1a1f('0xc')],'id');this[_0x1a1f('0xd')][_0x1a1f('0x11')]=_0x16ab1e;};ChatQueue[_0x1a1f('0xf')]['updateRealtime']=function(){this[_0x1a1f('0x12')]=0x0;this['paused']=0x0;for(var _0x435ae7=0x0;_0x435ae7=0x0?this[_0x1a1f('0x16')]:0x0;var _0x380c59={'id':this['id'],'available':this[_0x1a1f('0x16')],'loggedIn':this[_0x1a1f('0x12')],'name':this[_0x1a1f('0x8')],'paused':this[_0x1a1f('0x15')],'waiting':this['waiting']};var _0x326929=md5(JSON[_0x1a1f('0x17')](_0x380c59));if(this[_0x1a1f('0x1')]!==_0x326929){this['md5']=_0x326929;io['to'](util['format']('chat:queue:%s',_0x380c59['name']))[_0x1a1f('0x18')]('chat_queue:save',_0x380c59);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 24753c0..42d2abd 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(_0x4aa977,_0x1e8d6a){var _0x30d7be=function(_0x4d86c8){while(--_0x4d86c8){_0x4aa977['push'](_0x4aa977['shift']());}};_0x30d7be(++_0x1e8d6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0xa76234,_0x402b39){var _0x4ef0f7=function(_0x3d2ad6){while(--_0x3d2ad6){_0xa76234['push'](_0xa76234['shift']());}};_0x4ef0f7(++_0x402b39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 4724112..a07ef84 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 _0x2c6d=['exports','name','Intervals'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x2c6d,0x10f));var _0xd2c6=function(_0x4d9e15,_0x55fefc){_0x4d9e15=_0x4d9e15-0x0;var _0x3e7d90=_0x2c6d[_0x4d9e15];return _0x3e7d90;};'use strict';function Interval(_0x40ec83){this['id']=_0x40ec83['id']||0x0;this[_0xd2c6('0x0')]=_0x40ec83['name']||'';this['Intervals']=_0x40ec83[_0xd2c6('0x1')]||{};}module[_0xd2c6('0x2')]=Interval; \ No newline at end of file +var _0x4bdb=['name','Intervals','exports'];(function(_0x4d12d,_0xd9692f){var _0x53cb23=function(_0x3f1b2b){while(--_0x3f1b2b){_0x4d12d['push'](_0x4d12d['shift']());}};_0x53cb23(++_0xd9692f);}(_0x4bdb,0x1c5));var _0xb4bd=function(_0x581509,_0x2c32e2){_0x581509=_0x581509-0x0;var _0x41fe43=_0x4bdb[_0x581509];return _0x41fe43;};'use strict';function Interval(_0x28a1c0){this['id']=_0x28a1c0['id']||0x0;this[_0xb4bd('0x0')]=_0x28a1c0[_0xb4bd('0x0')]||'';this['Intervals']=_0x28a1c0[_0xb4bd('0x1')]||{};}module[_0xb4bd('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 aa6fce9..31f2795 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 _0x3c36=['../../../config/environment','defaults','redis','localhost','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','name','stringify','md5','mail:queue:%s','emit','exports','util','ioredis'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x3c36,0x10c));var _0x63c3=function(_0x56b00e,_0x350b5b){_0x56b00e=_0x56b00e-0x0;var _0x359ce2=_0x3c36[_0x56b00e];return _0x359ce2;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x63c3('0x0'));var Redis=require(_0x63c3('0x1'));var config=require(_0x63c3('0x2'));config['redis']=_[_0x63c3('0x3')](config[_0x63c3('0x4')],{'host':_0x63c3('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x63c3('0x4')]));function MailQueue(_0x1db9ec){this['id']=_0x1db9ec['id']||0x0;this['name']=_0x1db9ec['name']||'';this['timeout']=_0x1db9ec[_0x63c3('0x6')]||0xa;this['strategy']=_0x1db9ec[_0x63c3('0x7')]||'beepall';this[_0x63c3('0x8')]=_0x1db9ec[_0x63c3('0x8')];this[_0x63c3('0x9')]={};this[_0x63c3('0xa')]=0x0;this['md5']='';this[_0x63c3('0xb')]();this['updateRealtime']();}MailQueue['prototype'][_0x63c3('0xb')]=function(){var _0x356139=this[_0x63c3('0x9')][_0x63c3('0xc')];this[_0x63c3('0x9')]=_[_0x63c3('0xd')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x356139;};MailQueue['prototype'][_0x63c3('0xe')]=function(){this[_0x63c3('0xf')]=0x0;this[_0x63c3('0x10')]=0x0;for(var _0x40620c=0x0;_0x40620c=0x0?this['available']:0x0;var _0x95d113={'id':this['id'],'available':this['available'],'loggedIn':this[_0x63c3('0xf')],'name':this[_0x63c3('0x15')],'paused':this['paused'],'waiting':this[_0x63c3('0xa')]};var _0x1981f1=md5(JSON[_0x63c3('0x16')](_0x95d113));if(this[_0x63c3('0x17')]!==_0x1981f1){this[_0x63c3('0x17')]=_0x1981f1;io['to'](util['format'](_0x63c3('0x18'),_0x95d113[_0x63c3('0x15')]))[_0x63c3('0x19')]('mail_queue:save',_0x95d113);}};module[_0x63c3('0x1a')]=MailQueue; \ No newline at end of file +var _0x94c2=['name','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','updateRealtime','online','loggedIn','mailPause','paused','available','stringify','format','mail:queue:%s','mail_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x94c2,0x13d));var _0x294c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x94c2[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var md5=require(_0x294c('0x0'));var util=require('util');var Redis=require(_0x294c('0x1'));var config=require(_0x294c('0x2'));config[_0x294c('0x3')]=_[_0x294c('0x4')](config[_0x294c('0x3')],{'host':_0x294c('0x5'),'port':0x18eb});var io=require(_0x294c('0x6'))(new Redis(config[_0x294c('0x3')]));function MailQueue(_0x1b7438){this['id']=_0x1b7438['id']||0x0;this['name']=_0x1b7438[_0x294c('0x7')]||'';this['timeout']=_0x1b7438['timeout']||0xa;this[_0x294c('0x8')]=_0x1b7438[_0x294c('0x8')]||_0x294c('0x9');this[_0x294c('0xa')]=_0x1b7438['Agents'];this['mapAgentsId']={};this[_0x294c('0xb')]=0x0;this[_0x294c('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x294c('0xc')][_0x294c('0xd')]=function(){var _0x260886=this[_0x294c('0xe')][_0x294c('0xf')];this[_0x294c('0xe')]=_[_0x294c('0x10')](this[_0x294c('0xa')],'id');this[_0x294c('0xe')][_0x294c('0xf')]=_0x260886;};MailQueue[_0x294c('0xc')][_0x294c('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1d28d7=0x0;_0x1d28d7=0x0?this[_0x294c('0x16')]:0x0;var _0x3aca35={'id':this['id'],'available':this[_0x294c('0x16')],'loggedIn':this[_0x294c('0x13')],'name':this[_0x294c('0x7')],'paused':this[_0x294c('0x15')],'waiting':this[_0x294c('0xb')]};var _0x220b96=md5(JSON[_0x294c('0x17')](_0x3aca35));if(this[_0x294c('0x0')]!==_0x220b96){this[_0x294c('0x0')]=_0x220b96;io['to'](util[_0x294c('0x18')](_0x294c('0x19'),_0x3aca35[_0x294c('0x7')]))['emit'](_0x294c('0x1a'),_0x3aca35);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a3f77dc..56cb8a2 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 _0x1528=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','length','online','loggedIn','openchannelPause','paused','available','stringify','openchannel_queue:save','exports','lodash','md5','util','../../../config/environment','redis'];(function(_0xc266d6,_0x15fc8c){var _0x2ab82c=function(_0x1990bb){while(--_0x1990bb){_0xc266d6['push'](_0xc266d6['shift']());}};_0x2ab82c(++_0x15fc8c);}(_0x1528,0x7d));var _0x8152=function(_0x42ff55,_0xfea77a){_0x42ff55=_0x42ff55-0x0;var _0x2807b4=_0x1528[_0x42ff55];return _0x2807b4;};'use strict';var _=require(_0x8152('0x0'));var md5=require(_0x8152('0x1'));var util=require(_0x8152('0x2'));var Redis=require('ioredis');var config=require(_0x8152('0x3'));config[_0x8152('0x4')]=_['defaults'](config[_0x8152('0x4')],{'host':_0x8152('0x5'),'port':0x18eb});var io=require(_0x8152('0x6'))(new Redis(config[_0x8152('0x4')]));function OpenchannelQueue(_0x588f06){this['id']=_0x588f06['id']||0x0;this[_0x8152('0x7')]=_0x588f06[_0x8152('0x7')]||'';this[_0x8152('0x8')]=_0x588f06['timeout']||0xa;this[_0x8152('0x9')]=_0x588f06['strategy']||'beepall';this[_0x8152('0xa')]=_0x588f06['Agents'];this[_0x8152('0xb')]={};this[_0x8152('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x8152('0xd')]();}OpenchannelQueue[_0x8152('0xe')][_0x8152('0xf')]=function(){var _0x517003=this[_0x8152('0xb')]['_rr'];this[_0x8152('0xb')]=_[_0x8152('0x10')](this['Agents'],'id');this[_0x8152('0xb')]['_rr']=_0x517003;};OpenchannelQueue['prototype'][_0x8152('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x41d458=0x0;_0x41d458=0x0?this[_0x8152('0x16')]:0x0;var _0x5d137b={'id':this['id'],'available':this[_0x8152('0x16')],'loggedIn':this[_0x8152('0x13')],'name':this[_0x8152('0x7')],'paused':this['paused'],'waiting':this[_0x8152('0xc')]};var _0x470e21=md5(JSON[_0x8152('0x17')](_0x5d137b));if(this['md5']!==_0x470e21){this[_0x8152('0x1')]=_0x470e21;io['to'](util['format']('openchannel:queue:%s',_0x5d137b[_0x8152('0x7')]))['emit'](_0x8152('0x18'),_0x5d137b);}};module[_0x8152('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x7453=['stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','available'];(function(_0x53c9ab,_0x292c5e){var _0x39f593=function(_0x22f04b){while(--_0x22f04b){_0x53c9ab['push'](_0x53c9ab['shift']());}};_0x39f593(++_0x292c5e);}(_0x7453,0x1f3));var _0x3745=function(_0x574d2a,_0x5d1194){_0x574d2a=_0x574d2a-0x0;var _0x29011a=_0x7453[_0x574d2a];return _0x29011a;};'use strict';var _=require(_0x3745('0x0'));var md5=require(_0x3745('0x1'));var util=require(_0x3745('0x2'));var Redis=require(_0x3745('0x3'));var config=require(_0x3745('0x4'));config[_0x3745('0x5')]=_[_0x3745('0x6')](config[_0x3745('0x5')],{'host':_0x3745('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3745('0x5')]));function OpenchannelQueue(_0x1b50b6){this['id']=_0x1b50b6['id']||0x0;this[_0x3745('0x8')]=_0x1b50b6['name']||'';this['timeout']=_0x1b50b6['timeout']||0xa;this[_0x3745('0x9')]=_0x1b50b6[_0x3745('0x9')]||_0x3745('0xa');this[_0x3745('0xb')]=_0x1b50b6[_0x3745('0xb')];this[_0x3745('0xc')]={};this[_0x3745('0xd')]=0x0;this[_0x3745('0x1')]='';this['updateRouting']();this[_0x3745('0xe')]();}OpenchannelQueue[_0x3745('0xf')][_0x3745('0x10')]=function(){var _0x1a697e=this[_0x3745('0xc')][_0x3745('0x11')];this[_0x3745('0xc')]=_['map'](this[_0x3745('0xb')],'id');this['mapAgentsId']['_rr']=_0x1a697e;};OpenchannelQueue['prototype'][_0x3745('0xe')]=function(){this[_0x3745('0x12')]=0x0;this[_0x3745('0x13')]=0x0;for(var _0x262d0c=0x0;_0x262d0c=0x0?this['available']:0x0;var _0x5c09c3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3745('0x12')],'name':this[_0x3745('0x8')],'paused':this[_0x3745('0x13')],'waiting':this[_0x3745('0xd')]};var _0x5df2b4=md5(JSON[_0x3745('0x17')](_0x5c09c3));if(this[_0x3745('0x1')]!==_0x5df2b4){this[_0x3745('0x1')]=_0x5df2b4;io['to'](util[_0x3745('0x18')](_0x3745('0x19'),_0x5c09c3[_0x3745('0x8')]))[_0x3745('0x1a')](_0x3745('0x1b'),_0x5c09c3);}};module[_0x3745('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 8243e82..9fd2b99 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x14fb54,_0x3f30fc){var _0x23923e=function(_0x284a21){while(--_0x284a21){_0x14fb54['push'](_0x14fb54['shift']());}};_0x23923e(++_0x3f30fc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x310a78,_0x925d2d){var _0x49d18d=function(_0x591a84){while(--_0x591a84){_0x310a78['push'](_0x310a78['shift']());}};_0x49d18d(++_0x925d2d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8530e10..73d93d6 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 _0xa724=['../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','util','ioredis'];(function(_0x55b037,_0x2d9392){var _0x5f1053=function(_0x7a13d4){while(--_0x7a13d4){_0x55b037['push'](_0x55b037['shift']());}};_0x5f1053(++_0x2d9392);}(_0xa724,0x178));var _0x4a72=function(_0x399b54,_0x519b16){_0x399b54=_0x399b54-0x0;var _0x18eb89=_0xa724[_0x399b54];return _0x18eb89;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4a72('0x0'));var Redis=require(_0x4a72('0x1'));var config=require(_0x4a72('0x2'));config[_0x4a72('0x3')]=_[_0x4a72('0x4')](config[_0x4a72('0x3')],{'host':_0x4a72('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4a72('0x3')]));function WhatsappQueue(_0x3231b4){this['id']=_0x3231b4['id']||0x0;this[_0x4a72('0x6')]=_0x3231b4[_0x4a72('0x6')]||'';this[_0x4a72('0x7')]=_0x3231b4[_0x4a72('0x7')]||0xa;this[_0x4a72('0x8')]=_0x3231b4[_0x4a72('0x8')]||'beepall';this[_0x4a72('0x9')]=_0x3231b4['Agents'];this[_0x4a72('0xa')]={};this[_0x4a72('0xb')]=0x0;this[_0x4a72('0xc')]='';this[_0x4a72('0xd')]();this[_0x4a72('0xe')]();}WhatsappQueue[_0x4a72('0xf')][_0x4a72('0xd')]=function(){var _0x572b81=this[_0x4a72('0xa')][_0x4a72('0x10')];this[_0x4a72('0xa')]=_[_0x4a72('0x11')](this[_0x4a72('0x9')],'id');this['mapAgentsId'][_0x4a72('0x10')]=_0x572b81;};WhatsappQueue[_0x4a72('0xf')]['updateRealtime']=function(){this[_0x4a72('0x12')]=0x0;this['paused']=0x0;for(var _0x58d38b=0x0;_0x58d38b=0x0?this[_0x4a72('0x17')]:0x0;var _0x39920c={'id':this['id'],'available':this[_0x4a72('0x17')],'loggedIn':this[_0x4a72('0x12')],'name':this[_0x4a72('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x18a741=md5(JSON[_0x4a72('0x18')](_0x39920c));if(this[_0x4a72('0xc')]!==_0x18a741){this[_0x4a72('0xc')]=_0x18a741;io['to'](util[_0x4a72('0x19')](_0x4a72('0x1a'),_0x39920c[_0x4a72('0x6')]))['emit']('whatsapp_queue:save',_0x39920c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x9934=['beepall','prototype','updateRouting','mapAgentsId','_rr','map','Agents','updateRealtime','loggedIn','paused','online','whatsappPause','available','stringify','md5','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x507b0b,_0x3a0cb5){var _0x100c6d=function(_0x594e29){while(--_0x594e29){_0x507b0b['push'](_0x507b0b['shift']());}};_0x100c6d(++_0x3a0cb5);}(_0x9934,0xf1));var _0x4993=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x9934[_0x36d703];return _0x12c909;};'use strict';var _=require(_0x4993('0x0'));var md5=require('md5');var util=require(_0x4993('0x1'));var Redis=require(_0x4993('0x2'));var config=require(_0x4993('0x3'));config[_0x4993('0x4')]=_[_0x4993('0x5')](config['redis'],{'host':_0x4993('0x6'),'port':0x18eb});var io=require(_0x4993('0x7'))(new Redis(config[_0x4993('0x4')]));function WhatsappQueue(_0x437def){this['id']=_0x437def['id']||0x0;this[_0x4993('0x8')]=_0x437def['name']||'';this[_0x4993('0x9')]=_0x437def[_0x4993('0x9')]||0xa;this['strategy']=_0x437def[_0x4993('0xa')]||_0x4993('0xb');this['Agents']=_0x437def['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x4993('0xc')][_0x4993('0xd')]=function(){var _0x4cbfbe=this[_0x4993('0xe')][_0x4993('0xf')];this[_0x4993('0xe')]=_[_0x4993('0x10')](this[_0x4993('0x11')],'id');this['mapAgentsId'][_0x4993('0xf')]=_0x4cbfbe;};WhatsappQueue[_0x4993('0xc')][_0x4993('0x12')]=function(){this[_0x4993('0x13')]=0x0;this[_0x4993('0x14')]=0x0;for(var _0x118804=0x0;_0x118804=0x0?this[_0x4993('0x17')]:0x0;var _0x54e2fd={'id':this['id'],'available':this[_0x4993('0x17')],'loggedIn':this[_0x4993('0x13')],'name':this[_0x4993('0x8')],'paused':this[_0x4993('0x14')],'waiting':this['waiting']};var _0x526c5f=md5(JSON[_0x4993('0x18')](_0x54e2fd));if(this[_0x4993('0x19')]!==_0x526c5f){this[_0x4993('0x19')]=_0x526c5f;io['to'](util['format']('whatsapp:queue:%s',_0x54e2fd[_0x4993('0x8')]))[_0x4993('0x1a')](_0x4993('0x1b'),_0x54e2fd);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index aed9765..eb07f89 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_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 _0x00bb=['openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','agents','intervals','updateRealtime','initSmsQueues','updateRouting','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/mailQueue','../model/faxQueue'];(function(_0x5b0aee,_0xa55909){var _0x7b87af=function(_0x380351){while(--_0x380351){_0x5b0aee['push'](_0x5b0aee['shift']());}};_0x7b87af(++_0xa55909);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var BPromise=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var moment=require('moment');var Agent=require(_0xb00b('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xb00b('0x4'));var ChatQueue=require(_0xb00b('0x5'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0xb00b('0x6'));var FaxQueue=require(_0xb00b('0x7'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this['intervals']={};this[_0xb00b('0x8')]={};this[_0xb00b('0x9')]={};this[_0xb00b('0xa')]={};this[_0xb00b('0xb')]={};this[_0xb00b('0xc')]={};this[_0xb00b('0xd')]={};this['chatQueuesWaitingInteractions']={};this['mailQueuesWaitingInteractions']={};this[_0xb00b('0xe')]={};this[_0xb00b('0xf')]={};this[_0xb00b('0x10')]={};this[_0xb00b('0x11')]={};};function freeIsNotKey(_0x28d3cc,_0x48e125,_0x3182db){var _0x5a63ed=_['mapKeys'](_0x28d3cc,function(_0x594075,_0x4ff792){return _0x594075[_0x3182db];});for(var _0x2d8ddf in _0x48e125){if(_0x48e125[_0xb00b('0x12')](_0x2d8ddf)){if(!_0x5a63ed[_0x2d8ddf]){delete _0x48e125[_0x2d8ddf];}}}}Realtime[_0xb00b('0x13')][_0xb00b('0x14')]=function(_0x1f1c1d,_0x4ada81){for(var _0x218de2 in _0x4ada81){if(_0x1f1c1d[_0xb00b('0x12')](_0x218de2)){_0x1f1c1d[_0x218de2]=_0x4ada81[_0x218de2];}}};Realtime['prototype'][_0xb00b('0x15')]=function(){var _0x1084a6=this;return function(_0x540b79){if(_0x540b79){freeIsNotKey(_0x540b79,_0x1084a6['agents'],'id');for(var _0x9b471e=0x0,_0x4dcd45={},_0x51d136={};_0x9b471e<_0x540b79[_0xb00b('0x16')];_0x9b471e+=0x1){_0x4dcd45=_0x540b79[_0x9b471e];if(_[_0xb00b('0x17')](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']])){_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']]=new Agent(_0x4dcd45);}else{_0x1084a6['mergeFromDatabase'](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']],_0x4dcd45);}}}return _0x1084a6['agents'];};};Realtime[_0xb00b('0x13')]['initIntervals']=function(){var _0x25d7a0=this;return function(_0x5e8d7b){if(_0x5e8d7b){freeIsNotKey(_0x5e8d7b,_0x25d7a0[_0xb00b('0x19')],'id');for(var _0x3355a3=0x0,_0x53ee68={},_0x55770c={};_0x3355a3<_0x5e8d7b[_0xb00b('0x16')];_0x3355a3+=0x1){_0x53ee68=_0x5e8d7b[_0x3355a3];if(_['isUndefined'](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']])){_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']]=new Interval(_0x53ee68);}else{_0x25d7a0[_0xb00b('0x14')](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']],_0x53ee68);}}}return _0x25d7a0['intervals'];};};Realtime[_0xb00b('0x13')]['initOpenchannelQueues']=function(){var _0x25a973=this;return function(_0x121ec7){if(_0x121ec7){freeIsNotKey(_0x121ec7,_0x25a973['openchannelQueues'],'id');for(var _0x231293=0x0,_0x2896d1={},_0x520444={};_0x231293<_0x121ec7[_0xb00b('0x16')];_0x231293+=0x1){_0x2896d1=_0x121ec7[_0x231293];if(_[_0xb00b('0x17')](_0x25a973['openchannelQueues'][_0x2896d1['id']])){_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]=new OpenchannelQueue(_0x2896d1);}else{_0x25a973[_0xb00b('0x14')](_0x25a973[_0xb00b('0x8')][_0x2896d1['id']],_0x2896d1);}_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]['updateRouting']();_0x25a973['openchannelQueues'][_0x2896d1['id']][_0xb00b('0x1a')]();}}return _0x25a973['openchannelQueues'];};};Realtime['prototype']['initChatQueues']=function(){var _0x16ac55=this;return function(_0x73b6b0){if(_0x73b6b0){freeIsNotKey(_0x73b6b0,_0x16ac55[_0xb00b('0x9')],'id');for(var _0x3825af=0x0,_0x1f14fa={},_0x197379={};_0x3825af<_0x73b6b0[_0xb00b('0x16')];_0x3825af+=0x1){_0x1f14fa=_0x73b6b0[_0x3825af];if(_['isUndefined'](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']])){_0x16ac55['chatQueues'][_0x1f14fa['id']]=new ChatQueue(_0x1f14fa);}else{_0x16ac55[_0xb00b('0x14')](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']],_0x1f14fa);}_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']]['updateRouting']();_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']][_0xb00b('0x1a')]();}}return _0x16ac55[_0xb00b('0x9')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1b')]=function(){var _0x2b9824=this;return function(_0x2e160a){if(_0x2e160a){freeIsNotKey(_0x2e160a,_0x2b9824[_0xb00b('0xa')],'id');for(var _0x149c1a=0x0,_0x54e247={},_0x2b5f41={};_0x149c1a<_0x2e160a[_0xb00b('0x16')];_0x149c1a+=0x1){_0x54e247=_0x2e160a[_0x149c1a];if(_['isUndefined'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']])){_0x2b9824[_0xb00b('0xa')][_0x54e247['id']]=new SmsQueue(_0x54e247);}else{_0x2b9824['mergeFromDatabase'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']],_0x54e247);}_0x2b9824['smsQueues'][_0x54e247['id']][_0xb00b('0x1c')]();_0x2b9824[_0xb00b('0xa')][_0x54e247['id']][_0xb00b('0x1a')]();}}return _0x2b9824[_0xb00b('0xa')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1d')]=function(){var _0x17f613=this;return function(_0x594840){if(_0x594840){freeIsNotKey(_0x594840,_0x17f613['mailQueues'],'id');for(var _0x5b04c2=0x0,_0x347e73={},_0xc21102={};_0x5b04c2<_0x594840[_0xb00b('0x16')];_0x5b04c2+=0x1){_0x347e73=_0x594840[_0x5b04c2];if(_[_0xb00b('0x17')](_0x17f613['mailQueues'][_0x347e73['id']])){_0x17f613[_0xb00b('0xb')][_0x347e73['id']]=new MailQueue(_0x347e73);}else{_0x17f613[_0xb00b('0x14')](_0x17f613[_0xb00b('0xb')][_0x347e73['id']],_0x347e73);}_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1c')]();_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1a')]();}}return _0x17f613[_0xb00b('0xb')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x2ea41d=this;return function(_0x56022e){if(_0x56022e){freeIsNotKey(_0x56022e,_0x2ea41d[_0xb00b('0xc')],'id');for(var _0x1c5400=0x0,_0x29579b={},_0x45ca74={};_0x1c5400<_0x56022e[_0xb00b('0x16')];_0x1c5400+=0x1){_0x29579b=_0x56022e[_0x1c5400];if(_[_0xb00b('0x17')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']])){_0x2ea41d['faxQueues'][_0x29579b['id']]=new FaxQueue(_0x29579b);}else{_0x2ea41d[_0xb00b('0x14')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']],_0x29579b);}_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1c')]();_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1a')]();}}return _0x2ea41d['faxQueues'];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1e')]=function(){var _0x4801e7=this;return function(_0x17ff34){if(_0x17ff34){freeIsNotKey(_0x17ff34,_0x4801e7[_0xb00b('0xd')],'id');for(var _0xa2ae04=0x0,_0x2d8620={},_0x2954e8={};_0xa2ae04<_0x17ff34['length'];_0xa2ae04+=0x1){_0x2d8620=_0x17ff34[_0xa2ae04];if(_[_0xb00b('0x17')](_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']])){_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']]=new WhatsappQueue(_0x2d8620);}else{_0x4801e7[_0xb00b('0x14')](_0x4801e7['whatsappQueues'][_0x2d8620['id']],_0x2d8620);}_0x4801e7['whatsappQueues'][_0x2d8620['id']][_0xb00b('0x1c')]();_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']][_0xb00b('0x1a')]();}}return _0x4801e7[_0xb00b('0xd')];};};module[_0xb00b('0x1f')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ec858c8..25cab38 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 _0x2fa7=['UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2fa7,0x1e7));var _0x72fa=function(_0x4d0406,_0x40bfdd){_0x4d0406=_0x4d0406-0x0;var _0x342abf=_0x2fa7[_0x4d0406];return _0x342abf;};'use strict';var client=require('../client');exports[_0x72fa('0x0')]=function(_0x488f43,_0xeada3e){return client['Request'](_0x72fa('0x1'),{'body':_0xeada3e,'options':{'where':{'id':_0x488f43}},'log':_0x72fa('0x2')});};exports['addTags']=function(_0x3b5ae5,_0x2dbdcd){return client['Request']('AddTagsToChatInteraction',{'body':_0x2dbdcd,'options':{'where':{'id':_0x3b5ae5}},'log':_0x72fa('0x3')});}; \ No newline at end of file +var _0x2491=['addTags','addTagsToChatInteraction','update','Request','updateChatInteraction'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x2491,0xc0));var _0x1249=function(_0x3d95a9,_0x384814){_0x3d95a9=_0x3d95a9-0x0;var _0x72ad25=_0x2491[_0x3d95a9];return _0x72ad25;};'use strict';var client=require('../client');exports[_0x1249('0x0')]=function(_0x505ac3,_0x3e511a){return client[_0x1249('0x1')]('UpdateChatInteraction',{'body':_0x3e511a,'options':{'where':{'id':_0x505ac3}},'log':_0x1249('0x2')});};exports[_0x1249('0x3')]=function(_0x2994a1,_0x3279d6){return client['Request']('AddTagsToChatInteraction',{'body':_0x3279d6,'options':{'where':{'id':_0x2994a1}},'log':_0x1249('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1f68c3d..2af2f64 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 _0xd94e=['../client','Request','CreateChatMessage','createChatMessage'];(function(_0x4e7c1c,_0x56eafd){var _0x47adb2=function(_0x346135){while(--_0x346135){_0x4e7c1c['push'](_0x4e7c1c['shift']());}};_0x47adb2(++_0x56eafd);}(_0xd94e,0x1dc));var _0xed94=function(_0x183a19,_0x36dace){_0x183a19=_0x183a19-0x0;var _0x5e2ba3=_0xd94e[_0x183a19];return _0x5e2ba3;};'use strict';var client=require(_0xed94('0x0'));exports['create']=function(_0x4c21a8){return client[_0xed94('0x1')](_0xed94('0x2'),{'body':_0x4c21a8,'log':_0xed94('0x3')});}; \ No newline at end of file +var _0xf01c=['../client','create','Request','CreateChatMessage'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf01c,0xb0));var _0xcf01=function(_0x12b2ba,_0x2591fa){_0x12b2ba=_0x12b2ba-0x0;var _0x521d7f=_0xf01c[_0x12b2ba];return _0x521d7f;};'use strict';var client=require(_0xcf01('0x0'));exports[_0xcf01('0x1')]=function(_0x5ec11f){return client[_0xcf01('0x2')](_0xcf01('0x3'),{'body':_0x5ec11f,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 93327e0..f50a9a1 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 _0x95e6=['chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0x54c219,_0x47d792){var _0x136499=function(_0x542a97){while(--_0x542a97){_0x54c219['push'](_0x54c219['shift']());}};_0x136499(++_0x47d792);}(_0x95e6,0xf2));var _0x695e=function(_0x1f54ce,_0x17b1ca){_0x1f54ce=_0x1f54ce-0x0;var _0x594827=_0x95e6[_0x1f54ce];return _0x594827;};'use strict';var client=require(_0x695e('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x695e('0x1')](_0x695e('0x2'),{'options':{'raw':![],'attributes':['id',_0x695e('0x3'),_0x695e('0x4'),_0x695e('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x695e('0x6')]}]},'log':_0x695e('0x7')});};}; \ No newline at end of file +var _0xc602=['GetChatQueue','strategy','User','name','online','getChatQueues','../client','Request'];(function(_0x41258f,_0x2a23fa){var _0x1a559e=function(_0x46be1c){while(--_0x46be1c){_0x41258f['push'](_0x41258f['shift']());}};_0x1a559e(++_0x2a23fa);}(_0xc602,0x14e));var _0x2c60=function(_0xe3fe16,_0x480f01){_0xe3fe16=_0xe3fe16-0x0;var _0x586cf9=_0xc602[_0xe3fe16];return _0x586cf9;};'use strict';var client=require(_0x2c60('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x2c60('0x1')](_0x2c60('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x2c60('0x3')],'include':[{'model':_0x2c60('0x4'),'as':'Agents','attributes':['id',_0x2c60('0x5'),_0x2c60('0x6'),'chatPause']}]},'log':_0x2c60('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 68d4e20..85a952e 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 _0x55d2=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','Request'];(function(_0x5623f7,_0x24e332){var _0x2f30b2=function(_0x2b086c){while(--_0x2b086c){_0x5623f7['push'](_0x5623f7['shift']());}};_0x2f30b2(++_0x24e332);}(_0x55d2,0x9f));var _0x255d=function(_0x5eb294,_0x5b52ba){_0x5eb294=_0x5eb294-0x0;var _0xd139fd=_0x55d2[_0x5eb294];return _0xd139fd;};'use strict';var client=require('../client');exports['create']=function(_0x37e1c7){return client[_0x255d('0x0')](_0x255d('0x1'),{'body':_0x37e1c7,'log':_0x255d('0x1')});};exports[_0x255d('0x2')]=function(_0x2c9d29,_0x57cbc1){return client[_0x255d('0x0')](_0x255d('0x3'),{'body':_0x57cbc1,'options':{'where':{'uniqueid':_0x2c9d29},'order':[['id',_0x255d('0x4')]],'limit':0x1},'log':_0x255d('0x3')});}; \ No newline at end of file +var _0x562d=['update','Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x14300c,_0x3cade8){var _0x1a6438=function(_0x363862){while(--_0x363862){_0x14300c['push'](_0x14300c['shift']());}};_0x1a6438(++_0x3cade8);}(_0x562d,0xe1));var _0xd562=function(_0x5d082a,_0x4aa33f){_0x5d082a=_0x5d082a-0x0;var _0xebd7f4=_0x562d[_0x5d082a];return _0xebd7f4;};'use strict';var client=require(_0xd562('0x0'));exports[_0xd562('0x1')]=function(_0x41a5c7){return client['Request']('CreateChatQueueReport',{'body':_0x41a5c7,'log':_0xd562('0x2')});};exports[_0xd562('0x3')]=function(_0x73c3fa,_0x4c6430){return client[_0xd562('0x4')]('UpdateChatQueueReport',{'body':_0x4c6430,'options':{'where':{'uniqueid':_0x73c3fa},'order':[['id','DESC']],'limit':0x1},'log':_0xd562('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index cafb1a9..0240f2a 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 _0x9914=['updateFaxInteraction','addTags','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x3c7ce4,_0x221ae1){var _0x2fce5c=function(_0x3d0cc6){while(--_0x3d0cc6){_0x3c7ce4['push'](_0x3c7ce4['shift']());}};_0x2fce5c(++_0x221ae1);}(_0x9914,0x10b));var _0x4991=function(_0xabdf95,_0xda8f88){_0xabdf95=_0xabdf95-0x0;var _0x54e36a=_0x9914[_0xabdf95];return _0x54e36a;};'use strict';var client=require(_0x4991('0x0'));exports[_0x4991('0x1')]=function(_0x5c5d45,_0x456acd){return client['Request'](_0x4991('0x2'),{'body':_0x456acd,'options':{'where':{'id':_0x5c5d45}},'log':_0x4991('0x3')});};exports[_0x4991('0x4')]=function(_0xcaef7b,_0x5696e9){return client['Request']('AddTagsToFaxInteraction',{'body':_0x5696e9,'options':{'where':{'id':_0xcaef7b}},'log':_0x4991('0x5')});}; \ No newline at end of file +var _0xe169=['AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','addTags'];(function(_0x179cee,_0x3790dd){var _0x19e72b=function(_0x282300){while(--_0x282300){_0x179cee['push'](_0x179cee['shift']());}};_0x19e72b(++_0x3790dd);}(_0xe169,0x134));var _0x9e16=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe169[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x9e16('0x0'));exports['update']=function(_0x53569d,_0x5da082){return client[_0x9e16('0x1')](_0x9e16('0x2'),{'body':_0x5da082,'options':{'where':{'id':_0x53569d}},'log':'updateFaxInteraction'});};exports[_0x9e16('0x3')]=function(_0x4ae55d,_0x389aea){return client[_0x9e16('0x1')](_0x9e16('0x4'),{'body':_0x389aea,'options':{'where':{'id':_0x4ae55d}},'log':_0x9e16('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ba24d1b..c10599a 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 _0x113d=['Request','createFaxMessage','../client','create'];(function(_0x22f4e1,_0x18c57c){var _0x49498f=function(_0x331331){while(--_0x331331){_0x22f4e1['push'](_0x22f4e1['shift']());}};_0x49498f(++_0x18c57c);}(_0x113d,0x9a));var _0xd113=function(_0xc99c24,_0x29b8f3){_0xc99c24=_0xc99c24-0x0;var _0x456b52=_0x113d[_0xc99c24];return _0x456b52;};'use strict';var client=require(_0xd113('0x0'));exports[_0xd113('0x1')]=function(_0x46b350){return client[_0xd113('0x2')]('CreateFaxMessage',{'body':_0x46b350,'log':_0xd113('0x3')});}; \ No newline at end of file +var _0x00b9=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x188a53,_0x381507){var _0x449e97=function(_0x34560d){while(--_0x34560d){_0x188a53['push'](_0x188a53['shift']());}};_0x449e97(++_0x381507);}(_0x00b9,0x1cf));var _0x900b=function(_0x51d23b,_0x264945){_0x51d23b=_0x51d23b-0x0;var _0x303022=_0x00b9[_0x51d23b];return _0x303022;};'use strict';var client=require(_0x900b('0x0'));exports[_0x900b('0x1')]=function(_0x54b065){return client[_0x900b('0x2')](_0x900b('0x3'),{'body':_0x54b065,'log':_0x900b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index ed4023c..19a4b0e 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 _0xb952=['Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User'];(function(_0x16a154,_0x40df38){var _0x5b674c=function(_0xd47e88){while(--_0xd47e88){_0x16a154['push'](_0x16a154['shift']());}};_0x5b674c(++_0x40df38);}(_0xb952,0x88));var _0x2b95=function(_0x4557fd,_0x319a0c){_0x4557fd=_0x4557fd-0x0;var _0x310d0b=_0xb952[_0x4557fd];return _0x310d0b;};'use strict';var client=require(_0x2b95('0x0'));exports[_0x2b95('0x1')]=function(){return function(){return client[_0x2b95('0x2')](_0x2b95('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2b95('0x4'),_0x2b95('0x5')],'include':[{'model':_0x2b95('0x6'),'as':_0x2b95('0x7'),'attributes':['id',_0x2b95('0x8'),_0x2b95('0x9'),_0x2b95('0xa')]}]},'log':_0x2b95('0x1')});};}; \ No newline at end of file +var _0x99e3=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','Agents','online','faxPause'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x99e3,0x15e));var _0x399e=function(_0x26329b,_0xbd3e81){_0x26329b=_0x26329b-0x0;var _0x2cb869=_0x99e3[_0x26329b];return _0x2cb869;};'use strict';var client=require(_0x399e('0x0'));exports[_0x399e('0x1')]=function(){return function(){return client[_0x399e('0x2')](_0x399e('0x3'),{'options':{'raw':![],'attributes':['id',_0x399e('0x4'),_0x399e('0x5'),_0x399e('0x6')],'include':[{'model':'User','as':_0x399e('0x7'),'attributes':['id',_0x399e('0x4'),_0x399e('0x8'),_0x399e('0x9')]}]},'log':_0x399e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9e6277a..e842d99 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 _0x67d6=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x1d7d56,_0x1104cd){var _0x38a3d2=function(_0xd339bb){while(--_0xd339bb){_0x1d7d56['push'](_0x1d7d56['shift']());}};_0x38a3d2(++_0x1104cd);}(_0x67d6,0x16c));var _0x667d=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x67d6[_0x421cf8];return _0x145c48;};'use strict';var client=require('../client');exports[_0x667d('0x0')]=function(_0x3a1787){return client[_0x667d('0x1')](_0x667d('0x2'),{'body':_0x3a1787,'log':_0x667d('0x2')});};exports[_0x667d('0x3')]=function(_0x5694f7,_0x4225c8){return client[_0x667d('0x1')](_0x667d('0x4'),{'body':_0x4225c8,'options':{'where':{'uniqueid':_0x5694f7},'order':[['id',_0x667d('0x5')]],'limit':0x1},'log':_0x667d('0x4')});}; \ No newline at end of file +var _0xd78e=['update','Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x294a9e,_0x21d7c7){var _0x4b3346=function(_0x4e7576){while(--_0x4e7576){_0x294a9e['push'](_0x294a9e['shift']());}};_0x4b3346(++_0x21d7c7);}(_0xd78e,0xc1));var _0xed78=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xd78e[_0x5caf7e];return _0x5c3435;};'use strict';var client=require(_0xed78('0x0'));exports[_0xed78('0x1')]=function(_0x11bf47){return client['Request']('CreateFaxQueueReport',{'body':_0x11bf47,'log':_0xed78('0x2')});};exports[_0xed78('0x3')]=function(_0x33115b,_0x3f8825){return client[_0xed78('0x4')](_0xed78('0x5'),{'body':_0x3f8825,'options':{'where':{'uniqueid':_0x33115b},'order':[['id',_0xed78('0x6')]],'limit':0x1},'log':_0xed78('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a18d361..0af52a9 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 _0xb78e=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xb78e,0x1c9));var _0xeb78=function(_0xc339a2,_0x2bcbde){_0xc339a2=_0xc339a2-0x0;var _0x22f604=_0xb78e[_0xc339a2];return _0x22f604;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(){return function(){return client['Request'](_0xeb78('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb78('0x3')],'include':[{'model':_0xeb78('0x4'),'as':_0xeb78('0x5'),'attributes':['id',_0xeb78('0x3'),_0xeb78('0x6')]}]},'log':_0xeb78('0x1')});};}; \ No newline at end of file +var _0x6b24=['name','interval','getIntervals','Request','GetInterval'];(function(_0x2ff64e,_0x43a51d){var _0x50a0b1=function(_0x1a8488){while(--_0x1a8488){_0x2ff64e['push'](_0x2ff64e['shift']());}};_0x50a0b1(++_0x43a51d);}(_0x6b24,0x1ce));var _0x46b2=function(_0x115b95,_0xa1f8b9){_0x115b95=_0x115b95-0x0;var _0x460b3d=_0x6b24[_0x115b95];return _0x460b3d;};'use strict';var client=require('../client');exports[_0x46b2('0x0')]=function(){return function(){return client[_0x46b2('0x1')](_0x46b2('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x46b2('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0x46b2('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8f6d3c4..1906c71 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 _0x3941=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction'];(function(_0x595aa4,_0x4008cb){var _0x5eab70=function(_0x3de8a8){while(--_0x3de8a8){_0x595aa4['push'](_0x595aa4['shift']());}};_0x5eab70(++_0x4008cb);}(_0x3941,0x1d9));var _0x1394=function(_0xa1b4ae,_0x77927c){_0xa1b4ae=_0xa1b4ae-0x0;var _0x271b8f=_0x3941[_0xa1b4ae];return _0x271b8f;};'use strict';var client=require('../client');exports[_0x1394('0x0')]=function(_0x57ecfd,_0xb023c5){return client[_0x1394('0x1')](_0x1394('0x2'),{'body':_0xb023c5,'options':{'where':{'id':_0x57ecfd}},'log':_0x1394('0x3')});};exports[_0x1394('0x4')]=function(_0x2c3f05,_0x1fdbc2){return client[_0x1394('0x1')](_0x1394('0x5'),{'body':_0x1fdbc2,'options':{'where':{'id':_0x2c3f05}},'log':_0x1394('0x6')});}; \ No newline at end of file +var _0x4d77=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d77,0x141));var _0x74d7=function(_0xe868b2,_0xcd88ef){_0xe868b2=_0xe868b2-0x0;var _0x61b3de=_0x4d77[_0xe868b2];return _0x61b3de;};'use strict';var client=require(_0x74d7('0x0'));exports[_0x74d7('0x1')]=function(_0x216529,_0x578cb6){return client[_0x74d7('0x2')]('UpdateMailInteraction',{'body':_0x578cb6,'options':{'where':{'id':_0x216529}},'log':_0x74d7('0x3')});};exports['addTags']=function(_0xb0b277,_0x1f0b9f){return client[_0x74d7('0x2')](_0x74d7('0x4'),{'body':_0x1f0b9f,'options':{'where':{'id':_0xb0b277}},'log':_0x74d7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 7f93814..b6fb5fd 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 _0xdca2=['CreateMailMessage','createMailMessage','Request'];(function(_0x12d641,_0x22a68f){var _0x40660c=function(_0x479426){while(--_0x479426){_0x12d641['push'](_0x12d641['shift']());}};_0x40660c(++_0x22a68f);}(_0xdca2,0x95));var _0x2dca=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xdca2[_0x273c39];return _0x46d6b5;};'use strict';var client=require('../client');exports['create']=function(_0x4ed368){return client[_0x2dca('0x0')](_0x2dca('0x1'),{'body':_0x4ed368,'log':_0x2dca('0x2')});}; \ No newline at end of file +var _0x14a9=['Request'];(function(_0x15c7ab,_0x317c91){var _0x2ba2cc=function(_0x3d33ac){while(--_0x3d33ac){_0x15c7ab['push'](_0x15c7ab['shift']());}};_0x2ba2cc(++_0x317c91);}(_0x14a9,0xd3));var _0x914a=function(_0x26bcff,_0x1bf100){_0x26bcff=_0x26bcff-0x0;var _0xb14b0d=_0x14a9[_0x26bcff];return _0xb14b0d;};'use strict';var client=require('../client');exports['create']=function(_0x162fa3){return client[_0x914a('0x0')]('CreateMailMessage',{'body':_0x162fa3,'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 9425b85..2bc769b 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 _0x9468=['Request','name','timeout','strategy','Agents','online','mailPause','../client','getMailQueues'];(function(_0x58f032,_0x1ce454){var _0x480cdf=function(_0x522bfc){while(--_0x522bfc){_0x58f032['push'](_0x58f032['shift']());}};_0x480cdf(++_0x1ce454);}(_0x9468,0xe8));var _0x8946=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x9468[_0x1a7550];return _0x426e22;};'use strict';var client=require(_0x8946('0x0'));exports[_0x8946('0x1')]=function(){return function(){return client[_0x8946('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x8946('0x3'),_0x8946('0x4'),_0x8946('0x5')],'include':[{'model':'User','as':_0x8946('0x6'),'attributes':['id','name',_0x8946('0x7'),_0x8946('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x3a9e=['name','strategy','User','Agents','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0x9e5e07,_0x4a0daf){var _0x566468=function(_0x3c3ee0){while(--_0x3c3ee0){_0x9e5e07['push'](_0x9e5e07['shift']());}};_0x566468(++_0x4a0daf);}(_0x3a9e,0x191));var _0xe3a9=function(_0x52d303,_0x26f460){_0x52d303=_0x52d303-0x0;var _0x42d1c6=_0x3a9e[_0x52d303];return _0x42d1c6;};'use strict';var client=require(_0xe3a9('0x0'));exports[_0xe3a9('0x1')]=function(){return function(){return client[_0xe3a9('0x2')](_0xe3a9('0x3'),{'options':{'raw':![],'attributes':['id',_0xe3a9('0x4'),'timeout',_0xe3a9('0x5')],'include':[{'model':_0xe3a9('0x6'),'as':_0xe3a9('0x7'),'attributes':['id',_0xe3a9('0x4'),'online',_0xe3a9('0x8')]}]},'log':_0xe3a9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a9707b0..b281fdf 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 _0x46b8=['Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x2f9e99,_0x297d59){var _0x3a9179=function(_0x397f4c){while(--_0x397f4c){_0x2f9e99['push'](_0x2f9e99['shift']());}};_0x3a9179(++_0x297d59);}(_0x46b8,0x104));var _0x846b=function(_0x1bc8d9,_0x385486){_0x1bc8d9=_0x1bc8d9-0x0;var _0x1f9208=_0x46b8[_0x1bc8d9];return _0x1f9208;};'use strict';var client=require('../client');exports['create']=function(_0x4bb0a6){return client[_0x846b('0x0')](_0x846b('0x1'),{'body':_0x4bb0a6,'log':_0x846b('0x1')});};exports[_0x846b('0x2')]=function(_0x59425a,_0x4979fb){return client[_0x846b('0x0')]('UpdateMailQueueReport',{'body':_0x4979fb,'options':{'where':{'uniqueid':_0x59425a},'order':[['id','DESC']],'limit':0x1},'log':_0x846b('0x3')});}; \ No newline at end of file +var _0xae78=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x4faa5c,_0x4198ee){var _0x1f0339=function(_0x317bc2){while(--_0x317bc2){_0x4faa5c['push'](_0x4faa5c['shift']());}};_0x1f0339(++_0x4198ee);}(_0xae78,0x1d7));var _0x8ae7=function(_0xb94d96,_0xaa8484){_0xb94d96=_0xb94d96-0x0;var _0x2ca68c=_0xae78[_0xb94d96];return _0x2ca68c;};'use strict';var client=require(_0x8ae7('0x0'));exports[_0x8ae7('0x1')]=function(_0x171a65){return client[_0x8ae7('0x2')](_0x8ae7('0x3'),{'body':_0x171a65,'log':_0x8ae7('0x3')});};exports[_0x8ae7('0x4')]=function(_0x16baca,_0x24c973){return client[_0x8ae7('0x2')](_0x8ae7('0x5'),{'body':_0x24c973,'options':{'where':{'uniqueid':_0x16baca},'order':[['id','DESC']],'limit':0x1},'log':_0x8ae7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e5ace61..31d7342 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 _0x5ec1=['update','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5ec1,0x19e));var _0x15ec=function(_0x434804,_0x415f68){_0x434804=_0x434804-0x0;var _0x573fc8=_0x5ec1[_0x434804];return _0x573fc8;};'use strict';var client=require(_0x15ec('0x0'));exports[_0x15ec('0x1')]=function(_0x95990c,_0x4fe22a){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x4fe22a,'options':{'where':{'id':_0x95990c}},'log':'updateOpenchannelInteraction'});};exports[_0x15ec('0x2')]=function(_0x1ce8aa,_0x664ff5){return client[_0x15ec('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x664ff5,'options':{'where':{'id':_0x1ce8aa}},'log':_0x15ec('0x4')});}; \ No newline at end of file +var _0xbb89=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x5442d1,_0x193d0e){var _0x2f0eaf=function(_0x51a79){while(--_0x51a79){_0x5442d1['push'](_0x5442d1['shift']());}};_0x2f0eaf(++_0x193d0e);}(_0xbb89,0x1dc));var _0x9bb8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbb89[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x9bb8('0x0'));exports[_0x9bb8('0x1')]=function(_0x4d4313,_0x4874e8){return client[_0x9bb8('0x2')](_0x9bb8('0x3'),{'body':_0x4874e8,'options':{'where':{'id':_0x4d4313}},'log':_0x9bb8('0x4')});};exports[_0x9bb8('0x5')]=function(_0xbc4c49,_0x28ae6c){return client['Request'](_0x9bb8('0x6'),{'body':_0x28ae6c,'options':{'where':{'id':_0xbc4c49}},'log':_0x9bb8('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0c9d575..1a52227 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['Request','CreateOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xdace[_0xd1d19a];return _0x52a79d;};'use strict';var client=require(_0xedac('0x0'));exports['create']=function(_0x1c76b2){return client[_0xedac('0x1')](_0xedac('0x2'),{'body':_0x1c76b2,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xf109=['../client','create'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0xf109,0xce));var _0x9f10=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xf109[_0x2261ce];return _0x524640;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateOpenchannelMessage',{'body':_0x44c4f2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 503a78b..66d2665 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 _0x6e15=['strategy','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout'];(function(_0x518e12,_0x3491ad){var _0x1da7ff=function(_0x528771){while(--_0x528771){_0x518e12['push'](_0x518e12['shift']());}};_0x1da7ff(++_0x3491ad);}(_0x6e15,0x17e));var _0x56e1=function(_0x341c2a,_0x24c7c0){_0x341c2a=_0x341c2a-0x0;var _0x5a8b92=_0x6e15[_0x341c2a];return _0x5a8b92;};'use strict';var client=require(_0x56e1('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x56e1('0x1')](_0x56e1('0x2'),{'options':{'raw':![],'attributes':['id',_0x56e1('0x3'),_0x56e1('0x4'),_0x56e1('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x56e1('0x3'),_0x56e1('0x6'),_0x56e1('0x7')]}]},'log':_0x56e1('0x8')});};}; \ No newline at end of file +var _0x520a=['strategy','User','Agents','online','openchannelPause','../client','Request','GetOpenchannelQueue','name','timeout'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x520a,0x195));var _0xa520=function(_0x422faa,_0x30fb93){_0x422faa=_0x422faa-0x0;var _0x5dfb54=_0x520a[_0x422faa];return _0x5dfb54;};'use strict';var client=require(_0xa520('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xa520('0x1')](_0xa520('0x2'),{'options':{'raw':![],'attributes':['id',_0xa520('0x3'),_0xa520('0x4'),_0xa520('0x5')],'include':[{'model':_0xa520('0x6'),'as':_0xa520('0x7'),'attributes':['id',_0xa520('0x3'),_0xa520('0x8'),_0xa520('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c337b4f..ffaf716 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 _0x075f=['DESC','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x4f7d2c,_0x2c37d3){var _0x5920ce=function(_0x3d2588){while(--_0x3d2588){_0x4f7d2c['push'](_0x4f7d2c['shift']());}};_0x5920ce(++_0x2c37d3);}(_0x075f,0xa6));var _0xf075=function(_0x2173ad,_0x15079c){_0x2173ad=_0x2173ad-0x0;var _0x184543=_0x075f[_0x2173ad];return _0x184543;};'use strict';var client=require('../client');exports['create']=function(_0x2fd081){return client[_0xf075('0x0')](_0xf075('0x1'),{'body':_0x2fd081,'log':'CreateOpenchannelQueueReport'});};exports[_0xf075('0x2')]=function(_0xcbfe61,_0xaf3695){return client[_0xf075('0x0')](_0xf075('0x3'),{'body':_0xaf3695,'options':{'where':{'uniqueid':_0xcbfe61},'order':[['id',_0xf075('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xe8f2=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create','Request'];(function(_0x1461e7,_0x4b6199){var _0x3ef2fc=function(_0x4893e8){while(--_0x4893e8){_0x1461e7['push'](_0x1461e7['shift']());}};_0x3ef2fc(++_0x4b6199);}(_0xe8f2,0x13e));var _0x2e8f=function(_0xc57e5e,_0x2a3ef5){_0xc57e5e=_0xc57e5e-0x0;var _0x15f3d3=_0xe8f2[_0xc57e5e];return _0x15f3d3;};'use strict';var client=require('../client');exports[_0x2e8f('0x0')]=function(_0x3ea9bd){return client[_0x2e8f('0x1')](_0x2e8f('0x2'),{'body':_0x3ea9bd,'log':_0x2e8f('0x2')});};exports[_0x2e8f('0x3')]=function(_0x42f68b,_0x506e13){return client[_0x2e8f('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x506e13,'options':{'where':{'uniqueid':_0x42f68b},'order':[['id','DESC']],'limit':0x1},'log':_0x2e8f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 63300ac..e741cbb 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 _0x9a2f=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags'];(function(_0x21b860,_0x2d597e){var _0x498008=function(_0x395767){while(--_0x395767){_0x21b860['push'](_0x21b860['shift']());}};_0x498008(++_0x2d597e);}(_0x9a2f,0x8e));var _0xf9a2=function(_0x3ace8,_0x4bf514){_0x3ace8=_0x3ace8-0x0;var _0x4968d3=_0x9a2f[_0x3ace8];return _0x4968d3;};'use strict';var client=require(_0xf9a2('0x0'));exports[_0xf9a2('0x1')]=function(_0x305d51,_0x2a3e8b){return client[_0xf9a2('0x2')]('UpdateSmsInteraction',{'body':_0x2a3e8b,'options':{'where':{'id':_0x305d51}},'log':_0xf9a2('0x3')});};exports[_0xf9a2('0x4')]=function(_0x3c169d,_0x4056a0){return client[_0xf9a2('0x2')](_0xf9a2('0x5'),{'body':_0x4056a0,'options':{'where':{'id':_0x3c169d}},'log':_0xf9a2('0x6')});}; \ No newline at end of file +var _0xbe86=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0xbe86,0x1f4));var _0x6be8=function(_0x484e74,_0x4e62bd){_0x484e74=_0x484e74-0x0;var _0x2874fa=_0xbe86[_0x484e74];return _0x2874fa;};'use strict';var client=require(_0x6be8('0x0'));exports[_0x6be8('0x1')]=function(_0x33cc01,_0x20d2ee){return client[_0x6be8('0x2')](_0x6be8('0x3'),{'body':_0x20d2ee,'options':{'where':{'id':_0x33cc01}},'log':_0x6be8('0x4')});};exports[_0x6be8('0x5')]=function(_0x46ff70,_0xb148ba){return client[_0x6be8('0x2')](_0x6be8('0x6'),{'body':_0xb148ba,'options':{'where':{'id':_0x46ff70}},'log':_0x6be8('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 05d8c4d..718ec4c 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 _0x3b43=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3b43,0x71));var _0x33b4=function(_0x2b21bd,_0x167c0f){_0x2b21bd=_0x2b21bd-0x0;var _0x28235c=_0x3b43[_0x2b21bd];return _0x28235c;};'use strict';var client=require(_0x33b4('0x0'));exports[_0x33b4('0x1')]=function(_0x4099f3){return client[_0x33b4('0x2')](_0x33b4('0x3'),{'body':_0x4099f3,'log':_0x33b4('0x4')});}; \ No newline at end of file +var _0xe148=['CreateSmsMessage','../client','create','Request'];(function(_0x23841a,_0x415c7c){var _0x29b4f=function(_0x52eca9){while(--_0x52eca9){_0x23841a['push'](_0x23841a['shift']());}};_0x29b4f(++_0x415c7c);}(_0xe148,0x109));var _0x8e14=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xe148[_0x261b8a];return _0x3455e8;};'use strict';var client=require(_0x8e14('0x0'));exports[_0x8e14('0x1')]=function(_0x24d3b1){return client[_0x8e14('0x2')](_0x8e14('0x3'),{'body':_0x24d3b1,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 23072b6..00ea9bd 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 _0x254d=['name','strategy','User','Agents','../client','getSmsQueues','Request','GetSmsQueue'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x254d,0x1ec));var _0xd254=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x254d[_0x3a6efd];return _0x487b9a;};'use strict';var client=require(_0xd254('0x0'));exports[_0xd254('0x1')]=function(){return function(){return client[_0xd254('0x2')](_0xd254('0x3'),{'options':{'raw':![],'attributes':['id',_0xd254('0x4'),'timeout',_0xd254('0x5')],'include':[{'model':_0xd254('0x6'),'as':_0xd254('0x7'),'attributes':['id',_0xd254('0x4'),'online','smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x8c47=['Request','name','strategy','User','Agents','online','smsPause','getSmsQueues','../client'];(function(_0x4247e5,_0x30b7bb){var _0x5ee3d5=function(_0x5056cd){while(--_0x5056cd){_0x4247e5['push'](_0x4247e5['shift']());}};_0x5ee3d5(++_0x30b7bb);}(_0x8c47,0xc5));var _0x78c4=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8c47[_0x342baa];return _0x1208f3;};'use strict';var client=require(_0x78c4('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x78c4('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x78c4('0x2'),'timeout',_0x78c4('0x3')],'include':[{'model':_0x78c4('0x4'),'as':_0x78c4('0x5'),'attributes':['id',_0x78c4('0x2'),_0x78c4('0x6'),_0x78c4('0x7')]}]},'log':_0x78c4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b16eb67..a158165 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 _0x609a=['CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport','../client','create','Request'];(function(_0x4ebe7a,_0x1c2824){var _0xd5b5a2=function(_0x4d4530){while(--_0x4d4530){_0x4ebe7a['push'](_0x4ebe7a['shift']());}};_0xd5b5a2(++_0x1c2824);}(_0x609a,0x11c));var _0xa609=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x609a[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0xa609('0x0'));exports[_0xa609('0x1')]=function(_0x5ab0a6){return client[_0xa609('0x2')](_0xa609('0x3'),{'body':_0x5ab0a6,'log':'CreateSmsQueueReport'});};exports[_0xa609('0x4')]=function(_0x2d6d87,_0x1caea6){return client['Request']('UpdateSmsQueueReport',{'body':_0x1caea6,'options':{'where':{'uniqueid':_0x2d6d87},'order':[['id',_0xa609('0x5')]],'limit':0x1},'log':_0xa609('0x6')});}; \ No newline at end of file +var _0x37c8=['../client','create','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x232c1f,_0x36465e){var _0x1439f5=function(_0x10f5d6){while(--_0x10f5d6){_0x232c1f['push'](_0x232c1f['shift']());}};_0x1439f5(++_0x36465e);}(_0x37c8,0x69));var _0x837c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x37c8[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x837c('0x0'));exports[_0x837c('0x1')]=function(_0x1d5f5e){return client['Request'](_0x837c('0x2'),{'body':_0x1d5f5e,'log':_0x837c('0x2')});};exports[_0x837c('0x3')]=function(_0x2af7b6,_0x2a0a37){return client['Request'](_0x837c('0x4'),{'body':_0x2a0a37,'options':{'where':{'uniqueid':_0x2af7b6},'order':[['id','DESC']],'limit':0x1},'log':_0x837c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 30b19c7..6a78ec1 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 _0xcf65=['faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','agent','name','online','lastPauseAt','voicePause','chatPause','faxPause','whatsappPause','chatCapacity','mailCapacity'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0xcf65,0x149));var _0x5cf6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcf65[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x5cf6('0x0'));exports['getAgents']=function(){return function(){return client[_0x5cf6('0x1')](_0x5cf6('0x2'),{'options':{'raw':!![],'where':{'role':_0x5cf6('0x3')},'attributes':['id',_0x5cf6('0x4'),_0x5cf6('0x5'),'pauseType',_0x5cf6('0x6'),_0x5cf6('0x7'),_0x5cf6('0x8'),'mailPause',_0x5cf6('0x9'),'smsPause',_0x5cf6('0xa'),'openchannelPause',_0x5cf6('0xb'),_0x5cf6('0xc'),_0x5cf6('0xd'),_0x5cf6('0xe'),_0x5cf6('0xf'),_0x5cf6('0x10')]},'log':_0x5cf6('0x11')});};}; \ No newline at end of file +var _0x9ce3=['openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','online','pauseType','lastPauseAt','voicePause','chatPause','faxPause','smsPause','whatsappPause'];(function(_0x7cf586,_0xd0ff06){var _0x3c38a4=function(_0x509822){while(--_0x509822){_0x7cf586['push'](_0x7cf586['shift']());}};_0x3c38a4(++_0xd0ff06);}(_0x9ce3,0x15c));var _0x39ce=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0x9ce3[_0x43026b];return _0x4a96cd;};'use strict';var client=require('../client');exports[_0x39ce('0x0')]=function(){return function(){return client[_0x39ce('0x1')](_0x39ce('0x2'),{'options':{'raw':!![],'where':{'role':_0x39ce('0x3')},'attributes':['id','name',_0x39ce('0x4'),_0x39ce('0x5'),_0x39ce('0x6'),_0x39ce('0x7'),_0x39ce('0x8'),'mailPause',_0x39ce('0x9'),_0x39ce('0xa'),_0x39ce('0xb'),_0x39ce('0xc'),_0x39ce('0xd'),_0x39ce('0xe'),_0x39ce('0xf'),'smsCapacity',_0x39ce('0x10'),_0x39ce('0x11')]},'log':_0x39ce('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index a406e88..cb5f9eb 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 _0x1af3=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5efe32,_0x146336){var _0x4d4c52=function(_0x22ae4c){while(--_0x22ae4c){_0x5efe32['push'](_0x5efe32['shift']());}};_0x4d4c52(++_0x146336);}(_0x1af3,0x1ca));var _0x31af=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x1af3[_0x23e7c1];return _0x1add43;};'use strict';var client=require(_0x31af('0x0'));exports[_0x31af('0x1')]=function(_0x8b64dd,_0x1f7c8f){return client[_0x31af('0x2')](_0x31af('0x3'),{'body':_0x1f7c8f,'options':{'where':{'id':_0x8b64dd}},'log':_0x31af('0x4')});};exports[_0x31af('0x5')]=function(_0x3d64ae,_0xc098ee){return client['Request'](_0x31af('0x6'),{'body':_0xc098ee,'options':{'where':{'id':_0x3d64ae}},'log':_0x31af('0x7')});}; \ No newline at end of file +var _0x0506=['addTagsToWhatsappInteraction','../client','update','addTags'];(function(_0xa72f73,_0x8058d1){var _0x190264=function(_0x547589){while(--_0x547589){_0xa72f73['push'](_0xa72f73['shift']());}};_0x190264(++_0x8058d1);}(_0x0506,0x1d1));var _0x6050=function(_0x3cdc8d,_0x47d8d4){_0x3cdc8d=_0x3cdc8d-0x0;var _0x2bfbc1=_0x0506[_0x3cdc8d];return _0x2bfbc1;};'use strict';var client=require(_0x6050('0x0'));exports[_0x6050('0x1')]=function(_0x1ba949,_0x5592e4){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5592e4,'options':{'where':{'id':_0x1ba949}},'log':'updateWhatsappInteraction'});};exports[_0x6050('0x2')]=function(_0x58e2a9,_0x3cbb1f){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x3cbb1f,'options':{'where':{'id':_0x58e2a9}},'log':_0x6050('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a162dfc..a35300c 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 _0x2a31=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4c2fae,_0x5b8585){var _0x3fec1e=function(_0x435a76){while(--_0x435a76){_0x4c2fae['push'](_0x4c2fae['shift']());}};_0x3fec1e(++_0x5b8585);}(_0x2a31,0x118));var _0x12a3=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2a31[_0x491a7f];return _0x3d8f44;};'use strict';var client=require(_0x12a3('0x0'));exports[_0x12a3('0x1')]=function(_0x468f5c){return client[_0x12a3('0x2')](_0x12a3('0x3'),{'body':_0x468f5c,'log':_0x12a3('0x4')});}; \ No newline at end of file +var _0x0f0f=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x50870b,_0x4bd1a8){var _0x558264=function(_0x269cb1){while(--_0x269cb1){_0x50870b['push'](_0x50870b['shift']());}};_0x558264(++_0x4bd1a8);}(_0x0f0f,0x1bf));var _0xf0f0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0f0f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf0f0('0x0'));exports[_0xf0f0('0x1')]=function(_0x7c4d5){return client[_0xf0f0('0x2')](_0xf0f0('0x3'),{'body':_0x7c4d5,'log':_0xf0f0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 4dbb77c..ed53b5d 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 _0x49f8=['Agents','online','getWhatsappQueues','../client','GetWhatsappQueue','name','strategy'];(function(_0x4487ac,_0x300055){var _0x561bc7=function(_0x1fd045){while(--_0x1fd045){_0x4487ac['push'](_0x4487ac['shift']());}};_0x561bc7(++_0x300055);}(_0x49f8,0xff));var _0x849f=function(_0x30fc17,_0x43b50f){_0x30fc17=_0x30fc17-0x0;var _0x38ec11=_0x49f8[_0x30fc17];return _0x38ec11;};'use strict';var client=require(_0x849f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x849f('0x1'),{'options':{'raw':![],'attributes':['id',_0x849f('0x2'),'timeout',_0x849f('0x3')],'include':[{'model':'User','as':_0x849f('0x4'),'attributes':['id','name',_0x849f('0x5'),'whatsappPause']}]},'log':_0x849f('0x6')});};}; \ No newline at end of file +var _0xa699=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x4b4050,_0xe2fe12){var _0x2fa5cc=function(_0xe7bb28){while(--_0xe7bb28){_0x4b4050['push'](_0x4b4050['shift']());}};_0x2fa5cc(++_0xe2fe12);}(_0xa699,0x6b));var _0x9a69=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xa699[_0x162780];return _0x1ea2dc;};'use strict';var client=require(_0x9a69('0x0'));exports[_0x9a69('0x1')]=function(){return function(){return client[_0x9a69('0x2')](_0x9a69('0x3'),{'options':{'raw':![],'attributes':['id',_0x9a69('0x4'),_0x9a69('0x5'),_0x9a69('0x6')],'include':[{'model':_0x9a69('0x7'),'as':_0x9a69('0x8'),'attributes':['id',_0x9a69('0x4'),_0x9a69('0x9'),_0x9a69('0xa')]}]},'log':_0x9a69('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 579fc2c..b296a29 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 _0x695b=['CreateWhatsappQueueReport','update','create','Request'];(function(_0x559c49,_0x14bc40){var _0x376ebc=function(_0xeab8a0){while(--_0xeab8a0){_0x559c49['push'](_0x559c49['shift']());}};_0x376ebc(++_0x14bc40);}(_0x695b,0x16a));var _0xb695=function(_0x1c515f,_0x1d7631){_0x1c515f=_0x1c515f-0x0;var _0x4dc360=_0x695b[_0x1c515f];return _0x4dc360;};'use strict';var client=require('../client');exports[_0xb695('0x0')]=function(_0x2cba8d){return client[_0xb695('0x1')](_0xb695('0x2'),{'body':_0x2cba8d,'log':_0xb695('0x2')});};exports[_0xb695('0x3')]=function(_0x58b65a,_0x1d7906){return client[_0xb695('0x1')]('UpdateWhatsappQueueReport',{'body':_0x1d7906,'options':{'where':{'uniqueid':_0x58b65a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x1dde=['DESC','UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x31bdab,_0x3a33c2){var _0x44a3ec=function(_0x2dd09e){while(--_0x2dd09e){_0x31bdab['push'](_0x31bdab['shift']());}};_0x44a3ec(++_0x3a33c2);}(_0x1dde,0x16a));var _0xe1dd=function(_0x12beb4,_0x86b12d){_0x12beb4=_0x12beb4-0x0;var _0x37683a=_0x1dde[_0x12beb4];return _0x37683a;};'use strict';var client=require(_0xe1dd('0x0'));exports['create']=function(_0x1afc54){return client[_0xe1dd('0x1')](_0xe1dd('0x2'),{'body':_0x1afc54,'log':_0xe1dd('0x2')});};exports[_0xe1dd('0x3')]=function(_0x4fb096,_0x385759){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x385759,'options':{'where':{'uniqueid':_0x4fb096},'order':[['id',_0xe1dd('0x4')]],'limit':0x1},'log':_0xe1dd('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 c5c5f1b..0d4bb58 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 _0x6de5=['join','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','map'];(function(_0x27aff0,_0x226b7f){var _0x3d0415=function(_0x17afba){while(--_0x17afba){_0x27aff0['push'](_0x27aff0['shift']());}};_0x3d0415(++_0x226b7f);}(_0x6de5,0xac));var _0x56de=function(_0x2cd787,_0x1ab9a9){_0x2cd787=_0x2cd787-0x0;var _0x1d568d=_0x6de5[_0x2cd787];return _0x1d568d;};'use strict';var schema=require('validate');var _=require(_0x56de('0x0'));var util=require(_0x56de('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x56de('0x2'))(_0x56de('0x3'));var strategy=require(_0x56de('0x4'));var queue=schema({'name':{'type':_0x56de('0x5'),'required':!![],'message':_0x56de('0x6')},'timeout':{'type':_0x56de('0x7'),'message':_0x56de('0x8')}});function writeLog(_0x4a2d48,_0x35e89f,_0x24557d){return logger[_0x56de('0x9')](util[_0x56de('0xa')](_0x56de('0xb'),_0x4a2d48,_0x35e89f[_0x56de('0xc')],_0x24557d));}function handleFindAgent(_0x32627d){return function(_0x500988){return _0x500988[_0x56de('0xc')][_0x56de('0xd')]()===_0x32627d[_0x56de('0xd')]();};}exports[_0x56de('0xe')]=function(_0x40867d,_0x36ea0b,_0x2f422e,_0x5916f9){return function(_0x450072){try{var _0x4bf709={'name':_0x36ea0b[0x0],'timeout':_0x36ea0b[0x1]};var _0x20996e=queue[_0x56de('0xf')](_0x4bf709,{'typecast':!![]});if(_0x20996e['length']){logger[_0x56de('0x10')]('[%s][AGENT]\x20%s',_0x40867d,_[_0x56de('0x11')](_0x20996e,'message')[_0x56de('0x12')](',\x20'));_0x450072[_0x56de('0x13')]();}else{var _0x44854e=_[_0x56de('0x14')](_0x2f422e[_0x56de('0x15')],handleFindAgent(_0x4bf709[_0x56de('0xc')]));if(_0x44854e){var _0x203bad=(_0x4bf709[_0x56de('0x16')]||0xa)*0x3e8;var _0x5642a2,_0x2e2b76;var _0xc6aa4c=seqqueue['createQueue'](_0x203bad);_0xc6aa4c['id']=_0x40867d;_0xc6aa4c[_0x56de('0x17')]=_0x203bad;_0xc6aa4c[_0x56de('0x18')]=_0x5916f9[_0x56de('0x18')];writeLog(_0x40867d,_0x44854e,util[_0x56de('0xa')](_0x56de('0x19'),_0x203bad));_0x2f422e[_0x56de('0x1a')][_0x40867d]['on'](_0x56de('0x1b'),function(){logger[_0x56de('0x9')](_0x56de('0x1c'),_0x40867d);clearTimeout(_0x2e2b76);_0x2e2b76=undefined;_0xc6aa4c['close']();if(_0x2f422e[_0x56de('0x1a')][_0x40867d]){delete _0x2f422e[_0x56de('0x1a')][_0x40867d];}_0x450072[_0x56de('0x13')]();});_0x2f422e[_0x56de('0x1a')][_0x40867d]['on'](_0x56de('0x1d'),function(){if(_0x2f422e[_0x56de('0x1a')][_0x40867d]){delete _0x2f422e[_0x56de('0x1a')][_0x40867d];}});_0x2e2b76=setTimeout(function(){logger['info'](_0x56de('0x1e'),_0x40867d);clearTimeout(_0x2e2b76);_0xc6aa4c[_0x56de('0x1f')]();_0x450072[_0x56de('0x20')]();},_0x203bad);strategy[_0x56de('0x21')](_0xc6aa4c,_0x44854e,_0x2f422e,_0x5916f9);}else{logger[_0x56de('0x10')](_0x56de('0x22'),_0x40867d,_0x4bf709['name']);_0x450072[_0x56de('0x13')]();}}}catch(_0x5b5b8d){console[_0x56de('0x23')](_0x5b5b8d);logger['error'](_0x56de('0x24'),_0x40867d,_0x5b5b8d[_0x56de('0x25')]);_0x450072[_0x56de('0x13')]();}};}; \ No newline at end of file +var _0xc5c6=['next','agent','error','log','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x3cc34a,_0x13e2db){var _0x5ca5a1=function(_0x4f672d){while(--_0x4f672d){_0x3cc34a['push'](_0x3cc34a['shift']());}};_0x5ca5a1(++_0x13e2db);}(_0xc5c6,0x14e));var _0x6c5c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc5c6[_0x413feb];return _0x40ee88;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x6c5c('0x0'))(_0x6c5c('0x1'));var strategy=require(_0x6c5c('0x2'));var queue=schema({'name':{'type':_0x6c5c('0x3'),'required':!![],'message':_0x6c5c('0x4')},'timeout':{'type':_0x6c5c('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2d5a16,_0x1ecd0e,_0x3b1e35){return logger[_0x6c5c('0x6')](util[_0x6c5c('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2d5a16,_0x1ecd0e[_0x6c5c('0x8')],_0x3b1e35));}function handleFindAgent(_0x4d8943){return function(_0x519826){return _0x519826[_0x6c5c('0x8')][_0x6c5c('0x9')]()===_0x4d8943['toLowerCase']();};}exports[_0x6c5c('0xa')]=function(_0x3d5621,_0x36d4e8,_0x1fc1ba,_0x39a9a1){return function(_0x30d30e){try{var _0x36d693={'name':_0x36d4e8[0x0],'timeout':_0x36d4e8[0x1]};var _0x506031=queue[_0x6c5c('0xb')](_0x36d693,{'typecast':!![]});if(_0x506031[_0x6c5c('0xc')]){logger['error'](_0x6c5c('0xd'),_0x3d5621,_[_0x6c5c('0xe')](_0x506031,'message')['join'](',\x20'));_0x30d30e['stop']();}else{var _0x2efc0d=_[_0x6c5c('0xf')](_0x1fc1ba[_0x6c5c('0x10')],handleFindAgent(_0x36d693['name']));if(_0x2efc0d){var _0x4a1600=(_0x36d693[_0x6c5c('0x11')]||0xa)*0x3e8;var _0x160c67,_0x4d7000;var _0x46fbb4=seqqueue[_0x6c5c('0x12')](_0x4a1600);_0x46fbb4['id']=_0x3d5621;_0x46fbb4[_0x6c5c('0x13')]=_0x4a1600;_0x46fbb4[_0x6c5c('0x14')]=_0x39a9a1[_0x6c5c('0x14')];writeLog(_0x3d5621,_0x2efc0d,util[_0x6c5c('0x7')](_0x6c5c('0x15'),_0x4a1600));_0x1fc1ba[_0x6c5c('0x16')][_0x3d5621]['on'](_0x6c5c('0x17'),function(){logger[_0x6c5c('0x6')](_0x6c5c('0x18'),_0x3d5621);clearTimeout(_0x4d7000);_0x4d7000=undefined;_0x46fbb4[_0x6c5c('0x19')]();if(_0x1fc1ba[_0x6c5c('0x16')][_0x3d5621]){delete _0x1fc1ba['rules'][_0x3d5621];}_0x30d30e[_0x6c5c('0x1a')]();});_0x1fc1ba['rules'][_0x3d5621]['on'](_0x6c5c('0x1b'),function(){if(_0x1fc1ba['rules'][_0x3d5621]){delete _0x1fc1ba[_0x6c5c('0x16')][_0x3d5621];}});_0x4d7000=setTimeout(function(){logger[_0x6c5c('0x6')](_0x6c5c('0x1c'),_0x3d5621);clearTimeout(_0x4d7000);_0x46fbb4['close']();_0x30d30e[_0x6c5c('0x1d')]();},_0x4a1600);strategy[_0x6c5c('0x1e')](_0x46fbb4,_0x2efc0d,_0x1fc1ba,_0x39a9a1);}else{logger[_0x6c5c('0x1f')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3d5621,_0x36d693[_0x6c5c('0x8')]);_0x30d30e[_0x6c5c('0x1a')]();}}}catch(_0x12fe07){console[_0x6c5c('0x20')](_0x12fe07);logger[_0x6c5c('0x1f')]('[%s][QUEUE]\x20%s',_0x3d5621,_0x12fe07['stack']);_0x30d30e[_0x6c5c('0x1a')]();}};}; \ 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 bd1d53d..0e77f58 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 _0x7a86=['body','getMustacheRender','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','postText','error','message','amazonlex','providerName','providerResponse','Message','dialogState','Failed','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x7a86,0x1a6));var _0x67a8=function(_0x1c4769,_0x200259){_0x1c4769=_0x1c4769-0x0;var _0x2883f7=_0x7a86[_0x1c4769];return _0x2883f7;};'use strict';var _=require(_0x67a8('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x67a8('0x1'));var logger=require(_0x67a8('0x2'))('routing');var rpc={'chatMessage':require(_0x67a8('0x3')),'openchannelMessage':require(_0x67a8('0x4')),'mailMessage':require(_0x67a8('0x5')),'smsMessage':require(_0x67a8('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3fb1f5,_0x462497){return function(_0x551a45){try{if(!_[_0x67a8('0x7')](this[_0x67a8('0x8')][_0x67a8('0x9')])){logger[_0x67a8('0xa')](_0x67a8('0xb'),_0x3fb1f5,_0x67a8('0xc'));return _0x551a45[_0x67a8('0xd')]();}var _0x44d98b={'ContactId':this[_0x67a8('0xe')]['id'],'sentAt':moment()['format'](_0x67a8('0xf')),'direction':_0x67a8('0x10')};if(this[_0x67a8('0x11')]===_0x67a8('0x12')||this['channel']===_0x67a8('0x13')){_0x44d98b[_0x67a8('0x14')]=this[_0x67a8('0x8')][_0x67a8('0x14')];}var _0x8e3155=this[_0x67a8('0x11')];if(_0x8e3155===_0x67a8('0x15')){_0x44d98b[_0x67a8('0x16')]=this[_0x67a8('0x17')]['id'];}else{_0x44d98b[_[_0x67a8('0x18')](_0x8e3155)+'AccountId']=this['account']['id'];}_0x44d98b[_['upperFirst'](_0x8e3155)+_0x67a8('0x19')]=this[_0x67a8('0x8')]['id'];if(this[_0x67a8('0x8')][_0x67a8('0x1a')]){var _0x525e7f=_0x462497[0x4];if(!_[_0x67a8('0x1b')](_0x525e7f)){_0x44d98b[_0x67a8('0x1c')]=utils[_0x67a8('0x1d')](_0x525e7f,this);return rpc[_0x8e3155+'Message'][_0x67a8('0x1e')](_0x44d98b)[_0x67a8('0x1f')](function(_0x18d573){logger[_0x67a8('0xa')](_0x67a8('0xb'),_0x3fb1f5,_0x44d98b[_0x67a8('0x1c')]);})[_0x67a8('0x20')](function(_0xf71abb){logger['error'](_0x67a8('0xb'),_0x3fb1f5,JSON[_0x67a8('0x21')](_0xf71abb));})[_0x67a8('0x22')](function(){logger['info'](_0x67a8('0x23'),_0x3fb1f5);_0x551a45['stop']();});}else{logger[_0x67a8('0xa')](_0x67a8('0x24'),_0x3fb1f5);_0x551a45[_0x67a8('0x25')]();}}else{var _0xb737e1=this;var _0x33c257=new AWS[(_0x67a8('0x26'))]({'accessKeyId':_0x462497[0x0],'secretAccessKey':_0x462497[0x1],'region':_0x462497[0x2]});var _0x80cbbc={'botAlias':_0x67a8('0x27'),'botName':_0x462497[0x3],'inputText':this['message']['body'],'userId':this['channel']+':'+this[_0x67a8('0x8')]['id'][_0x67a8('0x28')]()};_0x33c257[_0x67a8('0x29')](_0x80cbbc,function(_0x14b038,_0x2971e2){if(_0x14b038){logger[_0x67a8('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x3fb1f5,_0x14b038[_0x67a8('0x2b')]);_0x551a45['next']();}else if(_0x2971e2&&_0x2971e2[_0x67a8('0x2b')]){_0xb737e1[_0x67a8('0x1c')][_0x67a8('0x2c')]=_0x2971e2;_0x44d98b['body']=_0x2971e2[_0x67a8('0x2b')];_0x44d98b[_0x67a8('0x2d')]=_0x67a8('0x2c');_0x44d98b[_0x67a8('0x2e')]=JSON['stringify'](_0x2971e2);return rpc[_0x8e3155+_0x67a8('0x2f')]['create'](_0x44d98b)[_0x67a8('0x1f')](function(_0x2f5dd5){logger[_0x67a8('0xa')](_0x67a8('0xb'),_0x3fb1f5,_0x44d98b[_0x67a8('0x1c')]);if(_0x2971e2[_0x67a8('0x30')]==_0x67a8('0x31')){_0x551a45[_0x67a8('0xd')]();}else{_0x551a45[_0x67a8('0x25')]();}})['catch'](function(_0x28547f){logger[_0x67a8('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x3fb1f5,JSON[_0x67a8('0x21')](_0x28547f));_0x551a45[_0x67a8('0xd')]();});}else{_0x551a45[_0x67a8('0xd')]();}});}}catch(_0x548988){logger[_0x67a8('0x2a')](_0x67a8('0xb'),_0x3fb1f5,JSON['stringify'](_0x548988));_0x551a45[_0x67a8('0x25')]();}};}; \ No newline at end of file +var _0x2890=['consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','getMustacheRender','Message','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','body','toString','postText','amazonlex','providerName','providerResponse','create','then','Failed','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x3ba819,_0x1339ea){var _0x577c57=function(_0x4b54e2){while(--_0x4b54e2){_0x3ba819['push'](_0x3ba819['shift']());}};_0x577c57(++_0x1339ea);}(_0x2890,0x14f));var _0x0289=function(_0x47f655,_0x36138f){_0x47f655=_0x47f655-0x0;var _0x42ac12=_0x2890[_0x47f655];return _0x42ac12;};'use strict';var _=require(_0x0289('0x0'));var moment=require(_0x0289('0x1'));var AWS=require(_0x0289('0x2'));var utils=require('./utils');var logger=require(_0x0289('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0289('0x4')),'smsMessage':require(_0x0289('0x5')),'faxMessage':require(_0x0289('0x6')),'whatsappMessage':require(_0x0289('0x7'))};exports[_0x0289('0x8')]=function(_0x3f6a41,_0x4aecce){return function(_0x947c8f){try{if(!_[_0x0289('0x9')](this[_0x0289('0xa')][_0x0289('0xb')])){logger[_0x0289('0xc')](_0x0289('0xd'),_0x3f6a41,_0x0289('0xe'));return _0x947c8f[_0x0289('0xf')]();}var _0x3ddc0a={'ContactId':this[_0x0289('0x10')]['id'],'sentAt':moment()[_0x0289('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0289('0x12')};if(this[_0x0289('0x13')]===_0x0289('0x14')||this[_0x0289('0x13')]==='whatsapp'){_0x3ddc0a[_0x0289('0x15')]=this[_0x0289('0xa')]['phone'];}var _0x25f3da=this[_0x0289('0x13')];if(_0x25f3da===_0x0289('0x16')){_0x3ddc0a[_0x0289('0x17')]=this[_0x0289('0x18')]['id'];}else{_0x3ddc0a[_['upperFirst'](_0x25f3da)+_0x0289('0x19')]=this[_0x0289('0x18')]['id'];}_0x3ddc0a[_[_0x0289('0x1a')](_0x25f3da)+'InteractionId']=this['interaction']['id'];if(this[_0x0289('0xa')][_0x0289('0x1b')]){var _0x13ceef=_0x4aecce[0x4];if(!_[_0x0289('0x1c')](_0x13ceef)){_0x3ddc0a['body']=utils[_0x0289('0x1d')](_0x13ceef,this);return rpc[_0x25f3da+_0x0289('0x1e')]['create'](_0x3ddc0a)['then'](function(_0x3fc20a){logger['info'](_0x0289('0xd'),_0x3f6a41,_0x3ddc0a['body']);})[_0x0289('0x1f')](function(_0x172746){logger[_0x0289('0x20')](_0x0289('0xd'),_0x3f6a41,JSON[_0x0289('0x21')](_0x172746));})[_0x0289('0x22')](function(){logger[_0x0289('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3f6a41);_0x947c8f['stop']();});}else{logger['info'](_0x0289('0x23'),_0x3f6a41);_0x947c8f[_0x0289('0x24')]();}}else{var _0x91965f=this;var _0x59557c=new AWS[(_0x0289('0x25'))]({'accessKeyId':_0x4aecce[0x0],'secretAccessKey':_0x4aecce[0x1],'region':_0x4aecce[0x2]});var _0x18e41d={'botAlias':_0x0289('0x26'),'botName':_0x4aecce[0x3],'inputText':this[_0x0289('0x27')][_0x0289('0x28')],'userId':this[_0x0289('0x13')]+':'+this[_0x0289('0xa')]['id'][_0x0289('0x29')]()};_0x59557c[_0x0289('0x2a')](_0x18e41d,function(_0x272ef9,_0x435311){if(_0x272ef9){logger[_0x0289('0x20')](_0x0289('0xd'),_0x3f6a41,_0x272ef9[_0x0289('0x27')]);_0x947c8f[_0x0289('0xf')]();}else if(_0x435311&&_0x435311[_0x0289('0x27')]){_0x91965f[_0x0289('0x28')][_0x0289('0x2b')]=_0x435311;_0x3ddc0a[_0x0289('0x28')]=_0x435311[_0x0289('0x27')];_0x3ddc0a[_0x0289('0x2c')]='amazonlex';_0x3ddc0a[_0x0289('0x2d')]=JSON[_0x0289('0x21')](_0x435311);return rpc[_0x25f3da+'Message'][_0x0289('0x2e')](_0x3ddc0a)[_0x0289('0x2f')](function(_0x2ee9d1){logger[_0x0289('0xc')](_0x0289('0xd'),_0x3f6a41,_0x3ddc0a[_0x0289('0x28')]);if(_0x435311['dialogState']==_0x0289('0x30')){_0x947c8f[_0x0289('0xf')]();}else{_0x947c8f[_0x0289('0x24')]();}})[_0x0289('0x1f')](function(_0x71bf34){logger[_0x0289('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3f6a41,JSON[_0x0289('0x21')](_0x71bf34));_0x947c8f[_0x0289('0xf')]();});}else{_0x947c8f[_0x0289('0xf')]();}});}}catch(_0x555c71){logger[_0x0289('0x20')](_0x0289('0xd'),_0x3f6a41,JSON['stringify'](_0x555c71));_0x947c8f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 80f111d..554b6b1 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 _0x88e6=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','mail','service','host','Smtp','port','secure','user','inReplyTo','messageId','html','','replace','body','','headers','auto-replied','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stringify','lodash','moment','../../../../config/logger','routing'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x88e6,0x1b5));var _0x688e=function(_0x583457,_0xfc9e64){_0x583457=_0x583457-0x0;var _0x2b9292=_0x88e6[_0x583457];return _0x2b9292;};'use strict';var _=require(_0x688e('0x0'));var moment=require(_0x688e('0x1'));var utils=require('./utils');var logger=require(_0x688e('0x2'))(_0x688e('0x3'));var rpc={'chatMessage':require(_0x688e('0x4')),'openchannelMessage':require(_0x688e('0x5')),'mailMessage':require(_0x688e('0x6')),'smsMessage':require(_0x688e('0x7')),'faxMessage':require(_0x688e('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x688e('0x9'));exports[_0x688e('0xa')]=function(_0x158789,_0x4c6e3d){return function(_0x574b76){try{if(_0x4c6e3d[0x0]==='1'&&(_[_0x688e('0xb')](this['interaction'][_0x688e('0xc')])||!this[_0x688e('0xd')][_0x688e('0xc')])){logger[_0x688e('0xe')](_0x688e('0xf'),_0x158789,_0x688e('0x10'));return _0x574b76[_0x688e('0x11')]();}var _0x19e7e1=this['channel'];var _0x34025c={'body':utils[_0x688e('0x12')](_0x4c6e3d[0x1],this),'ContactId':this[_0x688e('0x13')]['id'],'sentAt':moment()[_0x688e('0x14')](_0x688e('0x15')),'direction':_0x688e('0x16')};if(this[_0x688e('0x17')]){_0x34025c['to']=this[_0x688e('0x17')]['from']||'';_0x34025c['cc']=this[_0x688e('0x17')]['cc']||'';_0x34025c[_0x688e('0x18')]=this[_0x688e('0x17')]['to']||'';_0x34025c[_0x688e('0x19')]=this[_0x688e('0x17')][_0x688e('0x19')]||'';_0x34025c[_0x688e('0x1a')]=!![];if(this[_0x688e('0x17')][_0x688e('0x1b')]){_0x34025c[_0x688e('0x1b')]='';_0x34025c['subject']+=_[_0x688e('0x1c')](this['message'][_0x688e('0x1b')],_0x688e('0x1d'))?'':'Re:\x20';_0x34025c[_0x688e('0x1b')]+=this[_0x688e('0x17')]['subject'];}}if(this[_0x688e('0x1e')]===_0x688e('0x1f')){_0x34025c[_0x688e('0x20')]=this[_0x688e('0x21')]['id'];}else{_0x34025c[_[_0x688e('0x22')](this[_0x688e('0x1e')])+_0x688e('0x23')]=this[_0x688e('0x21')]['id'];}_0x34025c[_[_0x688e('0x22')](this[_0x688e('0x1e')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x688e('0x1e')]+_0x688e('0x24')]){if(this[_0x688e('0x1e')]===_0x688e('0x25')){var _0x53b81d={'tls':{'rejectUnauthorized':![]}};if(this[_0x688e('0x21')]['Smtp']['service']){_0x53b81d[_0x688e('0x26')]=this[_0x688e('0x21')]['Smtp'][_0x688e('0x26')];}else{_0x53b81d[_0x688e('0x27')]=this[_0x688e('0x21')][_0x688e('0x28')][_0x688e('0x27')];_0x53b81d[_0x688e('0x29')]=this[_0x688e('0x21')][_0x688e('0x28')][_0x688e('0x29')];_0x53b81d[_0x688e('0x2a')]=this[_0x688e('0x21')]['Smtp'][_0x688e('0x2a')];}if(this[_0x688e('0x21')][_0x688e('0x28')]['authentication']){_0x53b81d['auth']={'user':this['account'][_0x688e('0x28')][_0x688e('0x2b')],'pass':this[_0x688e('0x21')][_0x688e('0x28')]['pass']};}_0x34025c[_0x688e('0x2c')]=this[_0x688e('0x17')][_0x688e('0x2d')];_0x34025c[_0x688e('0x2e')]=_0x688e('0x2f')+_[_0x688e('0x30')](_0x34025c[_0x688e('0x31')],'','replace','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:\x20','channel','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','host','port','secure','user'];(function(_0x2f9a5e,_0x4bc19c){var _0x4ae35b=function(_0x40ccbb){while(--_0x40ccbb){_0x2f9a5e['push'](_0x2f9a5e['shift']());}};_0x4ae35b(++_0x4bc19c);}(_0xacc3,0x8d));var _0x3acc=function(_0xb20282,_0x316206){_0xb20282=_0xb20282-0x0;var _0x3c1ab9=_0xacc3[_0xb20282];return _0x3c1ab9;};'use strict';var _=require('lodash');var moment=require(_0x3acc('0x0'));var utils=require('./utils');var logger=require(_0x3acc('0x1'))(_0x3acc('0x2'));var rpc={'chatMessage':require(_0x3acc('0x3')),'openchannelMessage':require(_0x3acc('0x4')),'mailMessage':require(_0x3acc('0x5')),'smsMessage':require(_0x3acc('0x6')),'faxMessage':require(_0x3acc('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x3acc('0x8'));exports[_0x3acc('0x9')]=function(_0x59d815,_0x5acf29){return function(_0x56abe1){try{if(_0x5acf29[0x0]==='1'&&(_['isNil'](this['interaction'][_0x3acc('0xa')])||!this[_0x3acc('0xb')]['created'])){logger[_0x3acc('0xc')](_0x3acc('0xd'),_0x59d815,_0x3acc('0xe'));return _0x56abe1[_0x3acc('0xf')]();}var _0x3176f4=this['channel'];var _0x7db29f={'body':utils[_0x3acc('0x10')](_0x5acf29[0x1],this),'ContactId':this[_0x3acc('0x11')]['id'],'sentAt':moment()[_0x3acc('0x12')](_0x3acc('0x13')),'direction':_0x3acc('0x14')};if(this[_0x3acc('0x15')]){_0x7db29f['to']=this[_0x3acc('0x15')][_0x3acc('0x16')]||'';_0x7db29f['cc']=this[_0x3acc('0x15')]['cc']||'';_0x7db29f['from']=this[_0x3acc('0x15')]['to']||'';_0x7db29f[_0x3acc('0x17')]=this[_0x3acc('0x15')][_0x3acc('0x17')]||'';_0x7db29f[_0x3acc('0x18')]=!![];if(this['message'][_0x3acc('0x19')]){_0x7db29f[_0x3acc('0x19')]='';_0x7db29f[_0x3acc('0x19')]+=_[_0x3acc('0x1a')](this[_0x3acc('0x15')][_0x3acc('0x19')],'Re:')?'':_0x3acc('0x1b');_0x7db29f['subject']+=this['message']['subject'];}}if(this[_0x3acc('0x1c')]==='chat'){_0x7db29f[_0x3acc('0x1d')]=this[_0x3acc('0x1e')]['id'];}else{_0x7db29f[_[_0x3acc('0x1f')](this[_0x3acc('0x1c')])+'AccountId']=this[_0x3acc('0x1e')]['id'];}_0x7db29f[_['upperFirst'](this[_0x3acc('0x1c')])+_0x3acc('0x20')]=this[_0x3acc('0xb')]['id'];if(rpc[this[_0x3acc('0x1c')]+_0x3acc('0x21')]){if(this[_0x3acc('0x1c')]==='mail'){var _0x49850e={'tls':{'rejectUnauthorized':![]}};if(this[_0x3acc('0x1e')][_0x3acc('0x22')]['service']){_0x49850e['service']=this[_0x3acc('0x1e')][_0x3acc('0x22')]['service'];}else{_0x49850e[_0x3acc('0x23')]=this[_0x3acc('0x1e')]['Smtp'][_0x3acc('0x23')];_0x49850e[_0x3acc('0x24')]=this[_0x3acc('0x1e')][_0x3acc('0x22')]['port'];_0x49850e['secure']=this[_0x3acc('0x1e')][_0x3acc('0x22')][_0x3acc('0x25')];}if(this[_0x3acc('0x1e')][_0x3acc('0x22')]['authentication']){_0x49850e['auth']={'user':this['account'][_0x3acc('0x22')][_0x3acc('0x26')],'pass':this[_0x3acc('0x1e')]['Smtp'][_0x3acc('0x27')]};}_0x7db29f['inReplyTo']=this[_0x3acc('0x15')][_0x3acc('0x28')];_0x7db29f[_0x3acc('0x29')]=_0x3acc('0x2a')+_[_0x3acc('0x2b')](_0x7db29f[_0x3acc('0x2c')],']+(>|$)/g,''),'priorityTrue':_0x40a8f8[0x1],'priorityFalse':_0x40a8f8[0x2]};var _0x3e3e25=gotoif[_0x0fe5('0x8')](_0x5511be,{'typecast':!![]});if(_0x3e3e25['length']){logger[_0x0fe5('0x9')](_0x0fe5('0xa'),_0x3ddc10,_[_0x0fe5('0xb')](_0x3e3e25,_0x0fe5('0xc'))['join'](',\x20'));_0x1a7189[_0x0fe5('0xd')]();}else{try{var _0x3f9464=eval('('+_0x5511be[_0x0fe5('0xe')]+')');var _0x159a13=_0x3f9464?_0x5511be['priorityTrue']:_0x5511be[_0x0fe5('0xf')];logger[_0x0fe5('0x10')](_0x0fe5('0x11'),_0x3ddc10,_0x5511be[_0x0fe5('0xe')],_0x3f9464,_0x159a13||'next');if(_0x159a13){var _0x22f1a8=_['findIndex'](_0x1a7189[_0x0fe5('0x12')](),{'p':_0x159a13});if(_0x22f1a8>=0x0){logger[_0x0fe5('0x10')](_0x0fe5('0x13'),_0x3ddc10,_0x159a13||_0x0fe5('0x14'),_0x22f1a8);_0x1a7189[_0x0fe5('0x14')](_0x22f1a8);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3ddc10,_0x159a13||_0x0fe5('0x14'));_0x1a7189[_0x0fe5('0xd')]();}}else{_0x1a7189[_0x0fe5('0x14')]();}}catch(_0x50acb2){logger['error'](_0x0fe5('0x15'),_0x3ddc10,_0x50acb2[_0x0fe5('0xc')]);_0x1a7189[_0x0fe5('0xd')]();}}}catch(_0x39fa60){logger[_0x0fe5('0x9')](_0x0fe5('0xa'),_0x3ddc10,JSON['stringify'](_0x39fa60));_0x1a7189[_0x0fe5('0xd')]();}};}; \ No newline at end of file +var _0xffcd=['lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','message','validate'];(function(_0xec1f31,_0x7dbc13){var _0x2226c9=function(_0x57fdc2){while(--_0x57fdc2){_0xec1f31['push'](_0xec1f31['shift']());}};_0x2226c9(++_0x7dbc13);}(_0xffcd,0xe9));var _0xdffc=function(_0x41a23f,_0x3285d1){_0x41a23f=_0x41a23f-0x0;var _0x4f81ac=_0xffcd[_0x41a23f];return _0x4f81ac;};'use strict';var schema=require(_0xdffc('0x0'));var _=require(_0xdffc('0x1'));var htmlToText=require(_0xdffc('0x2'));var utils=require(_0xdffc('0x3'));var logger=require(_0xdffc('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xdffc('0x5'),'required':!![],'message':_0xdffc('0x6')},'priorityTrue':{'type':_0xdffc('0x7'),'message':_0xdffc('0x8')},'priorityFalse':{'type':_0xdffc('0x7'),'message':_0xdffc('0x9')}});exports['consequence']=function(_0x562bc4,_0x461567){return function(_0x2be967){try{var _0x2d973d={'condition':htmlToText[_0xdffc('0xa')](utils['getMustacheRender'](_0x461567[0x0],this),{'wordwrap':![]})[_0xdffc('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x461567[0x1],'priorityFalse':_0x461567[0x2]};var _0x3c7b89=gotoif[_0xdffc('0x0')](_0x2d973d,{'typecast':!![]});if(_0x3c7b89[_0xdffc('0xc')]){logger[_0xdffc('0xd')](_0xdffc('0xe'),_0x562bc4,_[_0xdffc('0xf')](_0x3c7b89,'message')['join'](',\x20'));_0x2be967[_0xdffc('0x10')]();}else{try{var _0x4d1d9b=eval('('+_0x2d973d['condition']+')');var _0x313435=_0x4d1d9b?_0x2d973d[_0xdffc('0x11')]:_0x2d973d['priorityFalse'];logger[_0xdffc('0x12')](_0xdffc('0x13'),_0x562bc4,_0x2d973d[_0xdffc('0x14')],_0x4d1d9b,_0x313435||'next');if(_0x313435){var _0x1a80d=_[_0xdffc('0x15')](_0x2be967[_0xdffc('0x16')](),{'p':_0x313435});if(_0x1a80d>=0x0){logger[_0xdffc('0x12')](_0xdffc('0x17'),_0x562bc4,_0x313435||'next',_0x1a80d);_0x2be967[_0xdffc('0x18')](_0x1a80d);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x562bc4,_0x313435||_0xdffc('0x18'));_0x2be967[_0xdffc('0x10')]();}}else{_0x2be967[_0xdffc('0x18')]();}}catch(_0x4461a0){logger[_0xdffc('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x562bc4,_0x4461a0[_0xdffc('0x19')]);_0x2be967[_0xdffc('0x10')]();}}}catch(_0x2353c0){logger['error'](_0xdffc('0xe'),_0x562bc4,JSON['stringify'](_0x2353c0));_0x2be967['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 058b8db..8f59663 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 _0x5557=['lodash','../../../../config/logger','length','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate'];(function(_0x3333bc,_0x49ed0d){var _0x3137db=function(_0x59f91d){while(--_0x59f91d){_0x3333bc['push'](_0x3333bc['shift']());}};_0x3137db(++_0x49ed0d);}(_0x5557,0x65));var _0x7555=function(_0x845991,_0x12f98b){_0x845991=_0x845991-0x0;var _0x6194fe=_0x5557[_0x845991];return _0x6194fe;};'use strict';var schema=require(_0x7555('0x0'));var _=require(_0x7555('0x1'));var logger=require(_0x7555('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x113fe0,_0x5b65e4){return function(_0x33568f){try{var _0x2adf5d={'priority':_0x5b65e4[0x0]};var _0x5c112f=gotop[_0x7555('0x0')](_0x2adf5d,{'typecast':!![]});if(_0x5c112f[_0x7555('0x3')]){logger[_0x7555('0x4')](_0x7555('0x5'),_0x113fe0,_[_0x7555('0x6')](_0x5c112f,_0x7555('0x7'))[_0x7555('0x8')](',\x20'));_0x33568f['stop']();}else{logger[_0x7555('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x113fe0,_0x2adf5d[_0x7555('0xa')]);if(_0x2adf5d[_0x7555('0xa')]){var _0x432dee=_[_0x7555('0xb')](_0x33568f['rules'](),{'p':_0x2adf5d[_0x7555('0xa')]});if(_0x432dee>=0x0){logger['info'](_0x7555('0xc'),_0x113fe0,_0x2adf5d[_0x7555('0xa')]||_0x7555('0xd'),_0x432dee);_0x33568f[_0x7555('0xd')](_0x432dee);}else{logger[_0x7555('0x9')](_0x7555('0xe'),_0x113fe0,_0x2adf5d[_0x7555('0xa')]||_0x7555('0xd'));_0x33568f[_0x7555('0xf')]();}}else{_0x33568f[_0x7555('0xd')]();}}}catch(_0x5e9ca9){logger['error'](_0x7555('0x5'),_0x113fe0,JSON[_0x7555('0x10')](_0x5e9ca9));_0x33568f[_0x7555('0xf')]();}};}; \ No newline at end of file +var _0xd310=['message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map'];(function(_0x3327a4,_0x920762){var _0x4ea0c2=function(_0x5f0001){while(--_0x5f0001){_0x3327a4['push'](_0x3327a4['shift']());}};_0x4ea0c2(++_0x920762);}(_0xd310,0x174));var _0x0d31=function(_0x1793c7,_0x411568){_0x1793c7=_0x1793c7-0x0;var _0x162609=_0xd310[_0x1793c7];return _0x162609;};'use strict';var schema=require(_0x0d31('0x0'));var _=require(_0x0d31('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x0d31('0x2'),'required':!![],'message':_0x0d31('0x3')}});exports[_0x0d31('0x4')]=function(_0x384ffd,_0x397030){return function(_0x59f639){try{var _0x54cfbf={'priority':_0x397030[0x0]};var _0x3e65d8=gotop[_0x0d31('0x0')](_0x54cfbf,{'typecast':!![]});if(_0x3e65d8[_0x0d31('0x5')]){logger[_0x0d31('0x6')]('[%s][GOTOP]\x20%s',_0x384ffd,_[_0x0d31('0x7')](_0x3e65d8,_0x0d31('0x8'))[_0x0d31('0x9')](',\x20'));_0x59f639[_0x0d31('0xa')]();}else{logger['info'](_0x0d31('0xb'),_0x384ffd,_0x54cfbf[_0x0d31('0xc')]);if(_0x54cfbf[_0x0d31('0xc')]){var _0x3ec980=_['findIndex'](_0x59f639[_0x0d31('0xd')](),{'p':_0x54cfbf[_0x0d31('0xc')]});if(_0x3ec980>=0x0){logger[_0x0d31('0xe')](_0x0d31('0xf'),_0x384ffd,_0x54cfbf[_0x0d31('0xc')]||_0x0d31('0x10'),_0x3ec980);_0x59f639[_0x0d31('0x10')](_0x3ec980);}else{logger[_0x0d31('0xe')](_0x0d31('0x11'),_0x384ffd,_0x54cfbf[_0x0d31('0xc')]||_0x0d31('0x10'));_0x59f639['stop']();}}else{_0x59f639['next']();}}}catch(_0x320fed){logger[_0x0d31('0x6')](_0x0d31('0x12'),_0x384ffd,JSON[_0x0d31('0x13')](_0x320fed));_0x59f639[_0x0d31('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 13eedd3..352bc92 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 _0x9688=['./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','AccountId','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9688,0x12b));var _0x8968=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9688[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x8968('0x0'));var utils=require(_0x8968('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x8968('0x2')),'openchannelMessage':require(_0x8968('0x3')),'mailMessage':require(_0x8968('0x4')),'smsMessage':require(_0x8968('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8968('0x6'))};exports[_0x8968('0x7')]=function(_0xf4807c,_0x389268){return function(_0x5569da){try{var _0x45686f={'body':utils[_0x8968('0x8')](_0x389268[0x0],this),'ContactId':this[_0x8968('0x9')]['id']};if(this[_0x8968('0xa')]===_0x8968('0xb')){_0x45686f[_0x8968('0xc')]=this['account']['id'];}else{_0x45686f[_['upperFirst'](this[_0x8968('0xa')])+_0x8968('0xd')]=this['account']['id'];}_0x45686f[_['upperFirst'](this['channel'])+_0x8968('0xe')]=this[_0x8968('0xf')]['id'];if(rpc[this[_0x8968('0xa')]+_0x8968('0x10')]){return rpc[this[_0x8968('0xa')]+'Message'][_0x8968('0x11')](_0x45686f)[_0x8968('0x12')](function(_0x64dd0){logger['info'](_0x8968('0x13'),_0xf4807c,_0x45686f[_0x8968('0x14')]);_0x5569da[_0x8968('0x15')]();})['catch'](function(_0x34bd6b){logger[_0x8968('0x16')](_0x8968('0x13'),_0xf4807c,JSON[_0x8968('0x17')](_0x34bd6b));_0x5569da[_0x8968('0x18')]();});}}catch(_0x47be79){logger[_0x8968('0x16')](_0x8968('0x13'),_0xf4807c,JSON['stringify'](_0x47be79));_0x5569da['stop']();}};}; \ No newline at end of file +var _0x1a5a=['stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','error'];(function(_0x45ea78,_0x31678e){var _0xd722b7=function(_0x25710a){while(--_0x25710a){_0x45ea78['push'](_0x45ea78['shift']());}};_0xd722b7(++_0x31678e);}(_0x1a5a,0x1d5));var _0xa1a5=function(_0x708c33,_0x57e9f2){_0x708c33=_0x708c33-0x0;var _0xe5e059=_0x1a5a[_0x708c33];return _0xe5e059;};'use strict';var _=require(_0xa1a5('0x0'));var utils=require('./utils');var logger=require(_0xa1a5('0x1'))(_0xa1a5('0x2'));var rpc={'chatMessage':require(_0xa1a5('0x3')),'openchannelMessage':require(_0xa1a5('0x4')),'mailMessage':require(_0xa1a5('0x5')),'smsMessage':require(_0xa1a5('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa1a5('0x7'))};exports[_0xa1a5('0x8')]=function(_0xfc648e,_0x583f95){return function(_0x160046){try{var _0x3a9306={'body':utils[_0xa1a5('0x9')](_0x583f95[0x0],this),'ContactId':this[_0xa1a5('0xa')]['id']};if(this[_0xa1a5('0xb')]==='chat'){_0x3a9306[_0xa1a5('0xc')]=this[_0xa1a5('0xd')]['id'];}else{_0x3a9306[_[_0xa1a5('0xe')](this[_0xa1a5('0xb')])+'AccountId']=this[_0xa1a5('0xd')]['id'];}_0x3a9306[_[_0xa1a5('0xe')](this[_0xa1a5('0xb')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xa1a5('0xb')]+_0xa1a5('0xf')]){return rpc[this['channel']+_0xa1a5('0xf')][_0xa1a5('0x10')](_0x3a9306)[_0xa1a5('0x11')](function(_0x387360){logger[_0xa1a5('0x12')](_0xa1a5('0x13'),_0xfc648e,_0x3a9306[_0xa1a5('0x14')]);_0x160046[_0xa1a5('0x15')]();})[_0xa1a5('0x16')](function(_0x1a8e86){logger['error']('[%s][MESSAGE]\x20%s',_0xfc648e,JSON[_0xa1a5('0x17')](_0x1a8e86));_0x160046['stop']();});}}catch(_0x491dbe){logger[_0xa1a5('0x18')]('[%s][MESSAGE]\x20%s',_0xfc648e,JSON[_0xa1a5('0x17')](_0x491dbe));_0x160046[_0xa1a5('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 f4dab2a..fc4bb25 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 _0x33b7=['next','error','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x20e121,_0x1d14b0){var _0x3b0fbf=function(_0x2e91ca){while(--_0x2e91ca){_0x20e121['push'](_0x20e121['shift']());}};_0x3b0fbf(++_0x1d14b0);}(_0x33b7,0x1b2));var _0x733b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x33b7[_0x19e35c];return _0x3e1fe8;};'use strict';var utils=require(_0x733b('0x0'));var logger=require(_0x733b('0x1'))(_0x733b('0x2'));exports[_0x733b('0x3')]=function(_0x2e3b99,_0x5ed744){return function(_0x18aa32){try{logger[_0x733b('0x4')](_0x733b('0x5'),_0x2e3b99,utils[_0x733b('0x6')](_0x5ed744[0x0],this));_0x18aa32[_0x733b('0x7')]();}catch(_0x5ef591){logger[_0x733b('0x8')]('[%s][NOOP]\x20%s',_0x2e3b99,JSON['stringify'](_0x5ef591));_0x18aa32['stop']();}};}; \ No newline at end of file +var _0x43ad=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x43ad,0x1b5));var _0xd43a=function(_0xc86a93,_0x115c09){_0xc86a93=_0xc86a93-0x0;var _0xa835e2=_0x43ad[_0xc86a93];return _0xa835e2;};'use strict';var utils=require(_0xd43a('0x0'));var logger=require(_0xd43a('0x1'))(_0xd43a('0x2'));exports[_0xd43a('0x3')]=function(_0x3c4cd9,_0x26e5dd){return function(_0x31a284){try{logger['info'](_0xd43a('0x4'),_0x3c4cd9,utils[_0xd43a('0x5')](_0x26e5dd[0x0],this));_0x31a284[_0xd43a('0x6')]();}catch(_0x29356d){logger[_0xd43a('0x7')](_0xd43a('0x4'),_0x3c4cd9,JSON[_0xd43a('0x8')](_0x29356d));_0x31a284[_0xd43a('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index a29dbf5..86bd35c 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 _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x1c0e1b,_0x43d5b5){var _0x26d224=function(_0x4d568e){while(--_0x4d568e){_0x1c0e1b['push'](_0x1c0e1b['shift']());}};_0x26d224(++_0x43d5b5);}(_0x34e8,0x12c));var _0x834e=function(_0x562841,_0x1e1015){_0x562841=_0x562841-0x0;var _0x238c13=_0x34e8[_0x562841];return _0x238c13;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x26a9e3,_0x1a20d7){var _0x3cbd06=function(_0xa8ab54){while(--_0xa8ab54){_0x26a9e3['push'](_0x26a9e3['shift']());}};_0x3cbd06(++_0x1a20d7);}(_0x34e8,0x12c));var _0x834e=function(_0x55406c,_0x4576cd){_0x55406c=_0x55406c-0x0;var _0x84226b=_0x34e8[_0x55406c];return _0x84226b;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index db3b770..0632c12 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 _0x93d2=['agent','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93d2,0x110));var _0x293d=function(_0xc721f5,_0x42404b){_0xc721f5=_0xc721f5-0x0;var _0x1bc1bd=_0x93d2[_0xc721f5];return _0x1bc1bd;};'use strict';var _=require(_0x293d('0x0'));var uuid=require(_0x293d('0x1'));var util=require(_0x293d('0x2'));var logger=require(_0x293d('0x3'))(_0x293d('0x4'));var Agent=function(_0x2452aa,_0x3f4e96,_0x22110e,_0x275066){this[_0x293d('0x5')]=uuid['v4']();this[_0x293d('0x6')]=_0x2452aa;this['agent']=_0x3f4e96;this[_0x293d('0x7')]=_0x22110e;this['routing']=_0x275066;this[_0x293d('0x6')][_0x293d('0x8')](this['handleRun'][_0x293d('0x9')](this),this[_0x293d('0xa')]['bind'](this));this[_0x293d('0x6')]['on'](_0x293d('0xb'),this['handleTimeout'][_0x293d('0x9')](this));this['squeue']['on']('drained',this[_0x293d('0xc')]['bind'](this));};Agent[_0x293d('0xd')][_0x293d('0x8')]=function(){this[_0x293d('0x6')][_0x293d('0x8')](this[_0x293d('0xe')][_0x293d('0x9')](this),this['handleTimeout'][_0x293d('0x9')](this));};Agent[_0x293d('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x293d('0xd')][_0x293d('0xe')]=function(_0x2fa29a){logger[_0x293d('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x293d('0x10')]['id']);if(_[_0x293d('0x11')](this[_0x293d('0x7')][_0x293d('0x12')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x293d('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x293d('0x8')][_0x293d('0x9')](this),0x3e8);}else{if(this[_0x293d('0x4')][_0x293d('0x13')]||util[_0x293d('0x14')](this[_0x293d('0x6')]['id'],this['realtime']['agents'][this[_0x293d('0x10')]['id']],this[_0x293d('0x6')][_0x293d('0x15')],![])){this[_0x293d('0x7')]['agents'][this[_0x293d('0x10')]['id']][_0x293d('0x16')]=!![];this[_0x293d('0x7')][_0x293d('0x12')][this['agent']['id']][_0x293d('0x17')]=undefined;util[_0x293d('0x18')](this['notificationId'],this[_0x293d('0x6')]['id'],this[_0x293d('0x7')][_0x293d('0x12')][this[_0x293d('0x10')]['id']],null,this[_0x293d('0x4')]);util['writeLog'](this[_0x293d('0x6')]['id'],this[_0x293d('0x7')][_0x293d('0x12')][this['agent']['id']],'RINGING'+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['info'](_0x293d('0x19'),this[_0x293d('0x6')]['id'],this[_0x293d('0x10')]['id']);setTimeout(this[_0x293d('0x8')][_0x293d('0x9')](this),0x3e8);}}};Agent[_0x293d('0xd')]['handleTimeout']=function(_0x50d3e6){if(_[_0x293d('0x11')](this[_0x293d('0x7')][_0x293d('0x12')][this[_0x293d('0x10')]['id']])){return logger[_0x293d('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x293d('0xf')](_0x293d('0x1a'),this[_0x293d('0x6')]['id'],this[_0x293d('0x10')]['id']);util[_0x293d('0x1b')](this[_0x293d('0x5')],this[_0x293d('0x6')]['id'],this['realtime'][_0x293d('0x12')][this[_0x293d('0x10')]['id']],null,this['routing']);this[_0x293d('0x7')]['agents'][this['agent']['id']]['busy']=![];this[_0x293d('0x7')][_0x293d('0x12')][this[_0x293d('0x10')]['id']][_0x293d('0x17')]=undefined;util[_0x293d('0x1c')](this[_0x293d('0x6')]['id'],this[_0x293d('0x7')]['agents'][this['agent']['id']],_0x50d3e6?_0x293d('0x1d'):_0x293d('0x1e'));}if(!_0x50d3e6){setTimeout(this[_0x293d('0x8')][_0x293d('0x9')](this),0x3e8);}};function agent(_0x55cf2d,_0x5a51c8,_0x2ba852,_0x40d537){return new Agent(_0x55cf2d,_0x5a51c8,_0x2ba852,_0x40d537);}module[_0x293d('0x1f')]=agent; \ No newline at end of file +var _0xcee2=['info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','notificationId','squeue','realtime','handleRun','bind','handleTimeout','prototype','push','handleDrained'];(function(_0x5760fb,_0x4a581b){var _0x5e83ff=function(_0x1c480f){while(--_0x1c480f){_0x5760fb['push'](_0x5760fb['shift']());}};_0x5e83ff(++_0x4a581b);}(_0xcee2,0x1e4));var _0x2cee=function(_0xd720f9,_0x185fcd){_0xd720f9=_0xd720f9-0x0;var _0xa0e390=_0xcee2[_0xd720f9];return _0xa0e390;};'use strict';var _=require(_0x2cee('0x0'));var uuid=require('uuid');var util=require(_0x2cee('0x1'));var logger=require(_0x2cee('0x2'))('routing');var Agent=function(_0x25883c,_0x2e3492,_0x14d8b8,_0x10d3b1){this[_0x2cee('0x3')]=uuid['v4']();this[_0x2cee('0x4')]=_0x25883c;this['agent']=_0x2e3492;this[_0x2cee('0x5')]=_0x14d8b8;this['routing']=_0x10d3b1;this[_0x2cee('0x4')]['push'](this[_0x2cee('0x6')][_0x2cee('0x7')](this),this[_0x2cee('0x8')]['bind'](this));this[_0x2cee('0x4')]['on']('timeout',this['handleTimeout'][_0x2cee('0x7')](this));this['squeue']['on']('drained',this['handleDrained'][_0x2cee('0x7')](this));};Agent[_0x2cee('0x9')]['push']=function(){this['squeue'][_0x2cee('0xa')](this['handleRun']['bind'](this),this['handleTimeout'][_0x2cee('0x7')](this));};Agent['prototype'][_0x2cee('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype']['handleRun']=function(_0x16dbe8){logger[_0x2cee('0xc')](_0x2cee('0xd'),this['squeue']['id'],this['agent']['id']);if(_[_0x2cee('0xe')](this[_0x2cee('0x5')][_0x2cee('0xf')][this[_0x2cee('0x10')]['id']])){logger[_0x2cee('0xc')](_0x2cee('0x11'),this[_0x2cee('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x2cee('0xa')][_0x2cee('0x7')](this),0x3e8);}else{if(this[_0x2cee('0x12')][_0x2cee('0x13')]||util[_0x2cee('0x14')](this[_0x2cee('0x4')]['id'],this[_0x2cee('0x5')]['agents'][this['agent']['id']],this[_0x2cee('0x4')]['channel'],![])){this[_0x2cee('0x5')][_0x2cee('0xf')][this[_0x2cee('0x10')]['id']]['busy']=!![];this[_0x2cee('0x5')][_0x2cee('0xf')][this['agent']['id']][_0x2cee('0x15')]=undefined;util[_0x2cee('0x16')](this['notificationId'],this[_0x2cee('0x4')]['id'],this['realtime'][_0x2cee('0xf')][this[_0x2cee('0x10')]['id']],null,this[_0x2cee('0x12')]);util[_0x2cee('0x17')](this[_0x2cee('0x4')]['id'],this[_0x2cee('0x5')][_0x2cee('0xf')][this['agent']['id']],_0x2cee('0x18')+(this[_0x2cee('0x12')]['forcedOwnership']?_0x2cee('0x19'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x2cee('0x4')]['id'],this[_0x2cee('0x10')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0x2cee('0x8')]=function(_0x30a2ae){if(_[_0x2cee('0xe')](this[_0x2cee('0x5')]['agents'][this['agent']['id']])){return logger[_0x2cee('0xc')](_0x2cee('0x11'),this[_0x2cee('0x4')]['id'],this['agent']['id']);}else{logger[_0x2cee('0xc')](_0x2cee('0x1a'),this['squeue']['id'],this[_0x2cee('0x10')]['id']);util[_0x2cee('0x1b')](this[_0x2cee('0x3')],this['squeue']['id'],this[_0x2cee('0x5')][_0x2cee('0xf')][this[_0x2cee('0x10')]['id']],null,this[_0x2cee('0x12')]);this[_0x2cee('0x5')][_0x2cee('0xf')][this[_0x2cee('0x10')]['id']][_0x2cee('0x1c')]=![];this[_0x2cee('0x5')][_0x2cee('0xf')][this[_0x2cee('0x10')]['id']][_0x2cee('0x15')]=undefined;util['writeLog'](this[_0x2cee('0x4')]['id'],this[_0x2cee('0x5')][_0x2cee('0xf')][this['agent']['id']],_0x30a2ae?_0x2cee('0x1d'):_0x2cee('0x1e'));}if(!_0x30a2ae){setTimeout(this['push'][_0x2cee('0x7')](this),0x3e8);}};function agent(_0x471f72,_0x525ef3,_0x2fab4a,_0xe18376){return new Agent(_0x471f72,_0x525ef3,_0x2fab4a,_0xe18376);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index a6c57d6..3ce0b4d 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 _0xe08f=['handleDrained','prototype','push','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','lodash','uuid','./util','squeue','realtime','routing','handleRun','handleTimeout','bind','timeout','drained'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xe08f,0x105));var _0xfe08=function(_0x29add2,_0x11e843){_0x29add2=_0x29add2-0x0;var _0x3af9dd=_0xe08f[_0x29add2];return _0x3af9dd;};'use strict';var _=require(_0xfe08('0x0'));var uuid=require(_0xfe08('0x1'));var util=require(_0xfe08('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x4576fe,_0xf95b8c,_0x5839c7,_0x1f34e3){this['notificationId']=uuid['v4']();this[_0xfe08('0x3')]=_0x4576fe;this['queue']=_0xf95b8c;this[_0xfe08('0x4')]=_0x5839c7;this[_0xfe08('0x5')]=_0x1f34e3;this[_0xfe08('0x3')]['push'](this[_0xfe08('0x6')]['bind'](this),this[_0xfe08('0x7')][_0xfe08('0x8')](this));this[_0xfe08('0x3')]['on'](_0xfe08('0x9'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xfe08('0xa'),this[_0xfe08('0xb')][_0xfe08('0x8')](this));};Beepall[_0xfe08('0xc')]['push']=function(){this[_0xfe08('0x3')][_0xfe08('0xd')](this[_0xfe08('0x6')][_0xfe08('0x8')](this),this['handleTimeout'][_0xfe08('0x8')](this));};Beepall[_0xfe08('0xc')][_0xfe08('0xb')]=function(_0x1f3725){this[_0xfe08('0x7')](!![]);};Beepall['prototype'][_0xfe08('0x6')]=function(_0x1925fc){var _0x34d4f8=!![];if(!_[_0xfe08('0xe')](this['queue'])&&!_[_0xfe08('0xe')](this[_0xfe08('0xf')][_0xfe08('0x10')])&&this[_0xfe08('0xf')][_0xfe08('0x10')][_0xfe08('0x11')]>0x0){for(var _0x479096=0x0,_0x4bb353;_0x4790960x0){for(var _0x11ffa8=0x0,_0x524640;_0x11ffa80x0&&_0x4a289f[_0x4c76f+'CurrentCapacity']>=_0x4a289f[_0x4c76f+_0x7045('0x23')]){writeLog(_0x2124fc,_0x4a289f,_0x4c76f[_0x7045('0x25')]()+_0x7045('0x26'));return![];}}return!![];};exports[_0x7045('0x27')]=function(_0x4f41e8,_0x258378,_0x349010,_0x37b288,_0x2e7e65){return sendNotification(!![],_0x4f41e8,_0x258378,_0x349010,_0x37b288,_0x2e7e65);};exports[_0x7045('0x28')]=function(_0x297a4d,_0x109a88,_0x4e078b,_0x408b46,_0x3360c5){return sendNotification(![],_0x297a4d,_0x109a88,_0x4e078b,_0x408b46,_0x3360c5);};exports[_0x7045('0x29')]=writeLog; \ No newline at end of file +var _0xdae9=['ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','split','\x20interaction','account','notificationSound','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','util','mustache'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0xdae9,0x15e));var _0x9dae=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xdae9[_0x521929];return _0x632436;};'use strict';var _=require('lodash');var util=require(_0x9dae('0x0'));var utils=require('../utils');var Mustache=require(_0x9dae('0x1'));var Redis=require(_0x9dae('0x2'));var config=require(_0x9dae('0x3'));var logger=require(_0x9dae('0x4'))(_0x9dae('0x5'));config[_0x9dae('0x6')]=_[_0x9dae('0x7')](config[_0x9dae('0x6')],{'host':_0x9dae('0x8'),'port':0x18eb});var io=require(_0x9dae('0x9'))(new Redis(config['redis']));function emit(_0x25f46f,_0x3a2b7e,_0x52ce1d){io['to'](_0x25f46f)[_0x9dae('0xa')](_0x3a2b7e,_0x52ce1d);}function sendNotification(_0x4b85d7,_0x230759,_0x3845f9,_0xc0510e,_0x5d8f79,_0x1e1ce1){io['to'](util[_0x9dae('0xb')](_0x9dae('0xc'),_0xc0510e[_0x9dae('0xd')]))[_0x9dae('0xa')]('user:save',_0xc0510e);var _0x4a57e7=_0x1e1ce1||{};var _0x527626=_0x3845f9[_0x9dae('0xe')]('.');var _0x56d050={'uniqueid':_0x230759,'channel':_0x527626[0x0],'id':_0x527626[0x1],'title':_0x527626[0x0]+_0x9dae('0xf'),'interactionId':_0x527626[0x2],'queue':_0x5d8f79?_0x5d8f79[_0x9dae('0xd')]:null,'sound':_0x4a57e7[_0x9dae('0x10')][_0x9dae('0x11')],'shake':_0x4a57e7[_0x9dae('0x10')]['notificationShake']};try{if(!_0x4a57e7['body']){_0x4a57e7[_0x9dae('0x12')]={};}if(_0x5d8f79){_0x4a57e7[_0x9dae('0x12')][_0x9dae('0x13')]=_0x5d8f79;}else if(_0x4a57e7['body'][_0x9dae('0x13')]){delete _0x4a57e7[_0x9dae('0x12')][_0x9dae('0x13')];}_0x56d050['msg']=utils[_0x9dae('0x14')](_0x4a57e7['account'][_0x9dae('0x15')],_0x4a57e7);}catch(_0xae2261){_0x56d050[_0x9dae('0x16')]=_0x9dae('0x17');logger[_0x9dae('0x18')](util[_0x9dae('0xb')](_0x9dae('0x19'),_0x230759,_0xae2261[_0x9dae('0x1a')]));}io['to'](util[_0x9dae('0xb')]('user:%s',_0xc0510e[_0x9dae('0xd')]))[_0x9dae('0xa')](util['format'](_0x9dae('0x1b'),_0x4b85d7?_0x9dae('0x1c'):_0x9dae('0x1d')),_0x56d050);}function writeLog(_0x5d9b16,_0x312fae,_0x26dd64){return logger[_0x9dae('0x1e')](util['format'](_0x9dae('0x1f'),_0x5d9b16,_0x312fae[_0x9dae('0xd')],_0x26dd64));}exports[_0x9dae('0x20')]=function(_0x227ed9,_0x209572,_0x187d85,_0x3eee5e){if(_0x209572[_0x9dae('0x21')]){writeLog(_0x227ed9,_0x209572,'BUSY');return![];}if(!_0x209572['online']){writeLog(_0x227ed9,_0x209572,_0x9dae('0x22'));return![];}if(_0x209572[_0x187d85+_0x9dae('0x23')]){writeLog(_0x227ed9,_0x209572,_0x9dae('0x24'));return![];}if(_0x3eee5e&&_0x209572[_0x9dae('0x25')](_0x187d85+'Capacity')&&_0x209572[_0x9dae('0x25')](_0x187d85+'CurrentCapacity')){if(_0x209572[_0x187d85+_0x9dae('0x26')]>0x0&&_0x209572[_0x187d85+_0x9dae('0x27')]>=_0x209572[_0x187d85+_0x9dae('0x26')]){writeLog(_0x227ed9,_0x209572,_0x187d85[_0x9dae('0x28')]()+_0x9dae('0x29'));return![];}}return!![];};exports[_0x9dae('0x2a')]=function(_0x148f6b,_0x3e0cbe,_0xb45957,_0x5bd697,_0x3c6cda){return sendNotification(!![],_0x148f6b,_0x3e0cbe,_0xb45957,_0x5bd697,_0x3c6cda);};exports['hideNotification']=function(_0x37a9ec,_0x5583cd,_0x40d5ef,_0x21faf6,_0x4229de){return sendNotification(![],_0x37a9ec,_0x5583cd,_0x40d5ef,_0x21faf6,_0x4229de);};exports[_0x9dae('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 76da6dc..32f984d 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 _0xdc55=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x38e936,_0x1b8f4c){var _0x2c63c6=function(_0x3fdf44){while(--_0x3fdf44){_0x38e936['push'](_0x38e936['shift']());}};_0x2c63c6(++_0x1b8f4c);}(_0xdc55,0x139));var _0x5dc5=function(_0x4e11f7,_0x29af40){_0x4e11f7=_0x4e11f7-0x0;var _0x29d1e3=_0xdc55[_0x4e11f7];return _0x29d1e3;};'use strict';var schema=require(_0x5dc5('0x0'));var sh=require(_0x5dc5('0x1'));var _=require(_0x5dc5('0x2'));var utils=require(_0x5dc5('0x3'));var logger=require(_0x5dc5('0x4'))(_0x5dc5('0x5'));var system=schema({'command':{'type':_0x5dc5('0x6'),'required':!![],'message':_0x5dc5('0x7')}});exports[_0x5dc5('0x8')]=function(_0x19d7e6,_0x47c0f2){return function(_0x652687){try{var _0x333774={'command':_0x47c0f2[0x0]};var _0x3db6dc=system['validate'](_0x333774,{'typecast':!![]});if(_0x3db6dc[_0x5dc5('0x9')]){logger[_0x5dc5('0xa')]('[%s][SYSTEM]\x20%s',_0x19d7e6,_['map'](_0x3db6dc,'message')[_0x5dc5('0xb')](',\x20'));logger['info'](_0x5dc5('0xc'),_0x19d7e6);_0x652687[_0x5dc5('0xd')]();}else{var _0x1fe483=this;var _0x2ad012=utils[_0x5dc5('0xe')](_0x47c0f2[0x0],this);logger['info'](_0x5dc5('0xf'),_0x19d7e6,_0x2ad012);sh[_0x5dc5('0x10')](_[_0x5dc5('0x11')](_0x2ad012),function(_0x3c6355,_0x4cb18e){logger[_0x5dc5('0x12')](_0x5dc5('0x13'),_0x19d7e6,_0x3c6355);if(_0x3c6355==0x0){var _0x20ef02=_0x4cb18e[_0x5dc5('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x5dc5('0x15')](_0x47c0f2[0x1])||_[_0x5dc5('0x16')](_0x47c0f2[0x1])){logger['info'](_0x5dc5('0x17'),_0x19d7e6);_0x1fe483[_0x5dc5('0x18')][_0x47c0f2[0x1]]=_0x20ef02;}else{logger[_0x5dc5('0x12')](_0x5dc5('0x19'),_0x19d7e6,_0x47c0f2[0x1],_0x20ef02);_0x1fe483['body'][_0x47c0f2[0x1]]=_0x20ef02;}}_0x652687[_0x5dc5('0xd')]();});}}catch(_0x1d39c2){logger[_0x5dc5('0xa')](_0x5dc5('0x1a'),_0x19d7e6,_['isObject'](_0x1d39c2)?JSON[_0x5dc5('0x1b')](_0x1d39c2):_0x1d39c2);logger[_0x5dc5('0x12')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x19d7e6);_0x652687[_0x5dc5('0xd')]();}};}; \ No newline at end of file +var _0x027f=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil'];(function(_0x234c65,_0x29a326){var _0x15de8d=function(_0x12b42b){while(--_0x12b42b){_0x234c65['push'](_0x234c65['shift']());}};_0x15de8d(++_0x29a326);}(_0x027f,0x1b0));var _0xf027=function(_0x227143,_0x4184ce){_0x227143=_0x227143-0x0;var _0x33654e=_0x027f[_0x227143];return _0x33654e;};'use strict';var schema=require(_0xf027('0x0'));var sh=require('shelljs');var _=require(_0xf027('0x1'));var utils=require(_0xf027('0x2'));var logger=require(_0xf027('0x3'))('routing');var system=schema({'command':{'type':_0xf027('0x4'),'required':!![],'message':_0xf027('0x5')}});exports[_0xf027('0x6')]=function(_0x532bed,_0x1f52fe){return function(_0x452810){try{var _0x56abd8={'command':_0x1f52fe[0x0]};var _0x3e104e=system['validate'](_0x56abd8,{'typecast':!![]});if(_0x3e104e['length']){logger['error'](_0xf027('0x7'),_0x532bed,_['map'](_0x3e104e,'message')[_0xf027('0x8')](',\x20'));logger['info'](_0xf027('0x9'),_0x532bed);_0x452810[_0xf027('0xa')]();}else{var _0xb5137c=this;var _0x1d0eb8=utils[_0xf027('0xb')](_0x1f52fe[0x0],this);logger[_0xf027('0xc')](_0xf027('0xd'),_0x532bed,_0x1d0eb8);sh[_0xf027('0xe')](_[_0xf027('0xf')](_0x1d0eb8),function(_0x4ff952,_0x4da81a){logger['info'](_0xf027('0x10'),_0x532bed,_0x4ff952);if(_0x4ff952==0x0){var _0x4dbbe8=_0x4da81a['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xf027('0x11')](_0x1f52fe[0x1])||_[_0xf027('0x12')](_0x1f52fe[0x1])){logger['info'](_0xf027('0x13'),_0x532bed);_0xb5137c[_0xf027('0x14')][_0x1f52fe[0x1]]=_0x4dbbe8;}else{logger[_0xf027('0xc')](_0xf027('0x15'),_0x532bed,_0x1f52fe[0x1],_0x4dbbe8);_0xb5137c[_0xf027('0x14')][_0x1f52fe[0x1]]=_0x4dbbe8;}}_0x452810[_0xf027('0xa')]();});}}catch(_0x4cceb4){logger[_0xf027('0x16')](_0xf027('0x7'),_0x532bed,_[_0xf027('0x17')](_0x4cceb4)?JSON[_0xf027('0x18')](_0x4cceb4):_0x4cceb4);logger[_0xf027('0xc')](_0xf027('0x9'),_0x532bed);_0x452810[_0xf027('0xa')]();}};}; \ 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 d292a12..1dac699 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 _0xbd09=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction'];(function(_0x11fb85,_0x396de9){var _0x3f7a27=function(_0x3458fa){while(--_0x3458fa){_0x11fb85['push'](_0x11fb85['shift']());}};_0x3f7a27(++_0x396de9);}(_0xbd09,0xf0));var _0x9bd0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbd09[_0x432682];return _0x463d05;};'use strict';var schema=require(_0x9bd0('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9bd0('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9bd0('0x2')),'faxInteraction':require(_0x9bd0('0x3')),'whatsappInteraction':require(_0x9bd0('0x4'))};var logger=require('../../../../config/logger')(_0x9bd0('0x5'));var tag=schema({'tag':{'type':_0x9bd0('0x6'),'required':!![],'message':_0x9bd0('0x7')}});exports[_0x9bd0('0x8')]=function(_0x339add,_0x2deb55,_0x276fc2,_0x1e5f6b){return function(_0x326f98){try{var _0x431cfd={'tag':_0x2deb55[0x0]};var _0x500b52=tag['validate'](_0x431cfd,{'typecast':!![]});if(_0x500b52['length']){logger[_0x9bd0('0x9')](_0x9bd0('0xa'),_0x339add,_[_0x9bd0('0xb')](_0x500b52,_0x9bd0('0xc'))[_0x9bd0('0xd')](',\x20'));logger[_0x9bd0('0xe')](_0x9bd0('0xf'),_0x339add);_0x326f98[_0x9bd0('0x10')]();}else{var _0x3db8b2={'ids':[_0x2deb55[0x0]]};if(rpc[_0x1e5f6b[_0x9bd0('0x11')]+'Interaction']){rpc[_0x1e5f6b[_0x9bd0('0x11')]+'Interaction'][_0x9bd0('0x12')](_0x1e5f6b[_0x9bd0('0x13')]['id'],_0x3db8b2)[_0x9bd0('0x14')](function(_0x1a2378){logger[_0x9bd0('0xe')](_0x9bd0('0x15'),_0x339add,_0x2deb55[0x1],_0x1e5f6b[_0x9bd0('0x11')],_0x1e5f6b[_0x9bd0('0x13')]['id']);})[_0x9bd0('0x16')](function(_0x5674bf){logger[_0x9bd0('0x9')]('[%s][TAG]\x20%s',_0x339add,JSON[_0x9bd0('0x17')](_0x5674bf));logger[_0x9bd0('0xe')](_0x9bd0('0xf'),_0x339add);})[_0x9bd0('0x18')](function(){_0x326f98['next']();});}}}catch(_0x5d9e3f){logger[_0x9bd0('0x9')](_0x9bd0('0xa'),_0x339add,_[_0x9bd0('0x19')](_0x5d9e3f)?JSON[_0x9bd0('0x17')](_0x5d9e3f):_0x5d9e3f);logger['info'](_0x9bd0('0xf'),_0x339add);_0x326f98['next']();}};}; \ No newline at end of file +var _0xf236=['join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','next','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x15e4af,_0x32bba5){var _0xb635ec=function(_0x43125f){while(--_0x43125f){_0x15e4af['push'](_0x15e4af['shift']());}};_0xb635ec(++_0x32bba5);}(_0xf236,0xae));var _0x6f23=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0xf236[_0x466e57];return _0x34df42;};'use strict';var schema=require(_0x6f23('0x0'));var _=require(_0x6f23('0x1'));var rpc={'chatInteraction':require(_0x6f23('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6f23('0x3')),'mailInteraction':require(_0x6f23('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x6f23('0x5'))(_0x6f23('0x6'));var tag=schema({'tag':{'type':_0x6f23('0x7'),'required':!![],'message':_0x6f23('0x8')}});exports[_0x6f23('0x9')]=function(_0x450290,_0x251cc1,_0x570566,_0x4b71b1){return function(_0x43fe01){try{var _0x48dd30={'tag':_0x251cc1[0x0]};var _0x8c3df5=tag['validate'](_0x48dd30,{'typecast':!![]});if(_0x8c3df5[_0x6f23('0xa')]){logger[_0x6f23('0xb')](_0x6f23('0xc'),_0x450290,_[_0x6f23('0xd')](_0x8c3df5,_0x6f23('0xe'))[_0x6f23('0xf')](',\x20'));logger[_0x6f23('0x10')](_0x6f23('0x11'),_0x450290);_0x43fe01['next']();}else{var _0x3bd44c={'ids':[_0x251cc1[0x0]]};if(rpc[_0x4b71b1['channel']+_0x6f23('0x12')]){rpc[_0x4b71b1[_0x6f23('0x13')]+'Interaction'][_0x6f23('0x14')](_0x4b71b1[_0x6f23('0x15')]['id'],_0x3bd44c)['then'](function(_0x18dad8){logger[_0x6f23('0x10')](_0x6f23('0x16'),_0x450290,_0x251cc1[0x1],_0x4b71b1[_0x6f23('0x13')],_0x4b71b1['interaction']['id']);})[_0x6f23('0x17')](function(_0x1c2bec){logger[_0x6f23('0xb')]('[%s][TAG]\x20%s',_0x450290,JSON['stringify'](_0x1c2bec));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x450290);})['finally'](function(){_0x43fe01[_0x6f23('0x18')]();});}}}catch(_0x35e0a8){logger[_0x6f23('0xb')](_0x6f23('0xc'),_0x450290,_[_0x6f23('0x19')](_0x35e0a8)?JSON[_0x6f23('0x1a')](_0x35e0a8):_0x35e0a8);logger[_0x6f23('0x10')](_0x6f23('0x11'),_0x450290);_0x43fe01[_0x6f23('0x18')]();}};}; \ 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 8f72ba9..12fa95d 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 _0xdab2=['render','merge','contact','message','account','interaction','list','mustache','lodash'];(function(_0x555c94,_0x39f65a){var _0xe6e2b=function(_0x2ca89c){while(--_0x2ca89c){_0x555c94['push'](_0x555c94['shift']());}};_0xe6e2b(++_0x39f65a);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Mustache=require(_0x2dab('0x0'));var _=require(_0x2dab('0x1'));module['exports']={'getMustacheRender':function(_0x475660,_0x2aa420){return Mustache[_0x2dab('0x2')](_0x475660,_[_0x2dab('0x3')](_0x2aa420['body'],{'contact':_0x2aa420[_0x2dab('0x4')],'message':_0x2aa420[_0x2dab('0x5')],'account':_0x2aa420[_0x2dab('0x6')],'interaction':_0x2aa420[_0x2dab('0x7')],'list':_0x2aa420[_0x2dab('0x8')]}))||'';}}; \ No newline at end of file +var _0x6658=['mustache','lodash','exports','render','merge','body','message','account'];(function(_0x17d9ba,_0x4d980c){var _0x46185d=function(_0x1dce47){while(--_0x1dce47){_0x17d9ba['push'](_0x17d9ba['shift']());}};_0x46185d(++_0x4d980c);}(_0x6658,0x198));var _0x8665=function(_0xf6d4cb,_0x309244){_0xf6d4cb=_0xf6d4cb-0x0;var _0xd22022=_0x6658[_0xf6d4cb];return _0xd22022;};'use strict';var Mustache=require(_0x8665('0x0'));var _=require(_0x8665('0x1'));module[_0x8665('0x2')]={'getMustacheRender':function(_0x1a6b0b,_0x45eb4a){return Mustache[_0x8665('0x3')](_0x1a6b0b,_[_0x8665('0x4')](_0x45eb4a[_0x8665('0x5')],{'contact':_0x45eb4a['contact'],'message':_0x45eb4a[_0x8665('0x6')],'account':_0x45eb4a[_0x8665('0x7')],'interaction':_0x45eb4a['interaction'],'list':_0x45eb4a['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 867a898..3d6bb50 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 _0x86b0=['capacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','applications','length','existsSync','join','app','.js','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','emit','complete','routing\x20is\x20empty','QueueReport','UserId','catch','message\x20is\x20empty','agent','agents','stack','end','hasOwnProperty','CurrentCapacity'];(function(_0xefac7f,_0x26aad5){var _0x5cfc40=function(_0x33c451){while(--_0x33c451){_0xefac7f['push'](_0xefac7f['shift']());}};_0x5cfc40(++_0x26aad5);}(_0x86b0,0x122));var _0x086b=function(_0x56401a,_0x5162ac){_0x56401a=_0x56401a-0x0;var _0x4de921=_0x86b0[_0x56401a];return _0x4de921;};'use strict';var _=require(_0x086b('0x0'));var util=require('util');var path=require(_0x086b('0x1'));var fs=require('fs');var jayson=require(_0x086b('0x2'));var BPromise=require(_0x086b('0x3'));var uuid=require(_0x086b('0x4'));var config=require(_0x086b('0x5'));var logger=require(_0x086b('0x6'))(_0x086b('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x086b('0x8')),'smsQueueReport':require(_0x086b('0x9')),'faxQueueReport':require(_0x086b('0xa')),'whatsappQueueReport':require(_0x086b('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x34a06c,_0xea81b6,_0x31d60c){return util[_0x086b('0xc')]('%s.%s.%s',_0x34a06c,_0xea81b6||0x0,_0x31d60c||0x0);}function getIntervals(_0x4aed2c,_0x413d11){var _0x435d00=[];if(!_['isNil'](_0x413d11[_0x086b('0xd')])&&!_[_0x086b('0xe')](_0x4aed2c[_0x413d11[_0x086b('0xd')]])&&!_[_0x086b('0xe')](_0x4aed2c[_0x413d11['IntervalId']][_0x086b('0xf')])){_0x435d00=_[_0x086b('0x10')](_0x4aed2c[_0x413d11[_0x086b('0xd')]][_0x086b('0xf')],_0x086b('0x11'));}else if(!_[_0x086b('0xe')](_0x413d11[_0x086b('0x11')])){_0x435d00=[_0x413d11[_0x086b('0x11')]];}return _0x435d00;}exports[_0x086b('0x12')]=function(_0x21c272){_0x21c272['rules']={};return new BPromise(function(_0x57afb6,_0x14ee7d){var _0x13e75f={'Start':function(_0x4fb43e){var _0x21c39b=this;return new Promise(function(_0x29d7a7,_0x2938d9){if(_0x4fb43e){try{var _0x384d9e=[];var _0x2a75ea=getId(_0x4fb43e[_0x086b('0x13')],_0x4fb43e[_0x086b('0x14')]?_0x4fb43e[_0x086b('0x14')]['id']:0x0,_0x4fb43e[_0x086b('0x15')]?_0x4fb43e['interaction']['id']:0x0);if(_0x4fb43e[_0x086b('0x16')]&&_['isArray'](_0x4fb43e[_0x086b('0x16')])&&_0x4fb43e[_0x086b('0x16')][_0x086b('0x17')]){for(var _0x1aee6f=0x0;_0x1aee6f<_0x4fb43e[_0x086b('0x16')][_0x086b('0x17')];_0x1aee6f+=0x1){var _0x215590=_0x4fb43e[_0x086b('0x16')][_0x1aee6f];if(fs[_0x086b('0x18')](path[_0x086b('0x19')](__dirname,_0x086b('0x16'),_0x215590[_0x086b('0x1a')]+_0x086b('0x1b')))){var _0x388cad=[];switch(_0x215590[_0x086b('0x1a')]['toLowerCase']()){case'autoreply':var _0x1b2e9c=_0x215590[_0x086b('0x1c')][_0x086b('0x1d')](',');_0x388cad[_0x086b('0x1e')](_0x1b2e9c[0x0]);_0x388cad[_0x086b('0x1e')](_0x1b2e9c[_0x086b('0x1f')](0x1,_0x1b2e9c[_0x086b('0x17')])[_0x086b('0x19')](','));break;case _0x086b('0x20'):var _0x2d9328=_0x215590['appdata']['split'](',');_0x388cad[_0x086b('0x1e')](_0x2d9328[0x0]);_0x388cad[_0x086b('0x1e')](_0x2d9328[0x1]);_0x388cad[_0x086b('0x1e')](_0x2d9328[_0x086b('0x1f')](0x2,_0x2d9328[_0x086b('0x17')])['join'](','));break;case _0x086b('0x21'):var _0x3d792f=_0x215590[_0x086b('0x1c')][_0x086b('0x1d')](',');_0x388cad[_0x086b('0x1e')](_0x3d792f[0x0]);_0x388cad['push'](_0x3d792f[0x1]);_0x388cad[_0x086b('0x1e')](_0x3d792f[0x2]);_0x388cad[_0x086b('0x1e')](_0x3d792f[0x3]);_0x388cad[_0x086b('0x1e')](_0x3d792f[_0x086b('0x1f')](0x4,_0x3d792f[_0x086b('0x17')])[_0x086b('0x19')](','));break;case _0x086b('0x22'):var _0x46b492=_0x215590['appdata']['split'](',');_0x388cad[_0x086b('0x1e')](_0x46b492[0x0]);_0x388cad['push'](_0x46b492[0x1]);_0x388cad[_0x086b('0x1e')](_0x46b492[0x2]);_0x388cad[_0x086b('0x1e')](_0x46b492[0x3]);_0x388cad['push'](_0x46b492[_0x086b('0x1f')](0x4,_0x46b492[_0x086b('0x17')])[_0x086b('0x19')](','));break;case _0x086b('0x14'):_0x388cad[_0x086b('0x1e')](_0x215590['appdata']);break;case _0x086b('0x23'):_0x388cad['push'](_0x215590[_0x086b('0x24')]);_0x388cad[_0x086b('0x1e')](_0x215590[_0x086b('0x1c')]);break;default:_0x388cad=_['isNil'](_0x215590['appdata'])?[]:_0x215590[_0x086b('0x1c')][_0x086b('0x1d')](',');}var _0x5b38df={'id':util[_0x086b('0xc')](_0x086b('0x25'),_0x2a75ea,_0x215590['id'],_0x215590[_0x086b('0x1a')]),'condition':require(_0x086b('0x26'))[_0x086b('0x27')](_0x2a75ea,getIntervals(_0x21c272['intervals'],_0x215590),_0x21c272),'consequence':require(_0x086b('0x28')+_0x215590['app'])[_0x086b('0x29')](_0x2a75ea,_0x388cad,_0x21c272,_0x4fb43e),'p':_0x215590[_0x086b('0x2a')]||0x0};logger[_0x086b('0x2b')](_0x086b('0x2c'),_0x5b38df['id'],_0x086b('0x2d'),getIntervals(_0x21c272['intervals'],_0x215590)[_0x086b('0x19')](_0x086b('0x2e')));_0x384d9e[_0x086b('0x1e')](_0x5b38df);}else{logger[_0x086b('0x2f')](_0x086b('0x30'),path[_0x086b('0x19')](__dirname,_0x086b('0x16'),_0x215590[_0x086b('0x1a')]+_0x086b('0x1b')));}}_0x21c272[_0x086b('0x31')][_0x2a75ea]=new RuleEngine(_0x384d9e);_0x21c272[_0x086b('0x31')][_0x2a75ea]['execute'](_0x4fb43e,function(_0x419d85){logger['info'](_0x086b('0x32'),JSON[_0x086b('0x33')](_0x419d85[_0x086b('0x34')]));if(_0x21c272[_0x086b('0x31')][_0x2a75ea]){_0x21c272[_0x086b('0x31')][_0x2a75ea][_0x086b('0x35')](_0x086b('0x36'));}});return _0x29d7a7({'code':0xc8,'message':_0x4fb43e});}else{logger[_0x086b('0x2b')]('No\x20applications\x20to\x20execute');return _0x29d7a7({'code':0xc8,'message':_0x4fb43e});}}catch(_0x31aa0c){logger[_0x086b('0x2f')](_0x31aa0c['stack']);return _0x2938d9(_0x21c39b['error'](0x1f4,_0x31aa0c));}}return _0x2938d9(_0x086b('0x37'));});},'AcceptMessage':function(_0x2e0a3d){var _0x310dbc=this;return new Promise(function(_0x152103,_0x972c22){if(_0x2e0a3d[_0x086b('0x14')]&&_0x2e0a3d[_0x086b('0x14')]['id']){try{var _0x495ba9=getId(_0x2e0a3d[_0x086b('0x13')],_0x2e0a3d[_0x086b('0x14')]?_0x2e0a3d['message']['id']:0x0,_0x2e0a3d[_0x086b('0x15')]?_0x2e0a3d[_0x086b('0x15')]['id']:0x0);if(_0x21c272['rules'][_0x495ba9]){_0x21c272['rules'][_0x495ba9][_0x086b('0x35')]('end');if(rpc[_0x2e0a3d[_0x086b('0x13')]+_0x086b('0x38')]){rpc[_0x2e0a3d['channel']+_0x086b('0x38')]['update'](_0x495ba9,{'UserId':_0x2e0a3d['message'][_0x086b('0x39')]})[_0x086b('0x3a')](function(_0x5ded9a){logger[_0x086b('0x2f')]('error\x20update\x20queue\x20report');});}}return _0x152103({'code':0xc8,'message':_0x2e0a3d});}catch(_0x53bddc){logger[_0x086b('0x2f')](_0x53bddc['stack']);return _0x972c22(_0x310dbc[_0x086b('0x2f')](0x1f4,_0x53bddc));}}logger[_0x086b('0x2f')]('message\x20is\x20empty');return _0x972c22(_0x310dbc['error'](0x1f4,_0x086b('0x3b')));});},'RejectMessage':function(_0x4cb8a6){var _0x589c70=this;return new Promise(function(_0xcf374d,_0x35cba4){if(_0x4cb8a6[_0x086b('0x3c')]&&_0x4cb8a6[_0x086b('0x3c')]['id']){try{if(_0x21c272['agents'][_0x4cb8a6[_0x086b('0x3c')]['id']]){_0x21c272[_0x086b('0x3d')][_0x4cb8a6[_0x086b('0x3c')]['id']]['busy']=![];_0x21c272[_0x086b('0x3d')][_0x4cb8a6[_0x086b('0x3c')]['id']]['busyQueue']=undefined;}return _0xcf374d({'code':0xc8,'message':_0x4cb8a6});}catch(_0x2db0df){logger[_0x086b('0x2f')](_0x2db0df[_0x086b('0x3e')]);return _0x35cba4(_0x589c70[_0x086b('0x2f')](0x1f4,_0x2db0df));}}logger['error']('message\x20is\x20empty');return _0x35cba4(_0x589c70[_0x086b('0x2f')](0x1f4,_0x086b('0x3b')));});},'AbandonInteraction':function(_0x26d450){var _0x5bd27d=this;return new Promise(function(_0x253c21,_0x3b89ea){if(_0x26d450[_0x086b('0x13')]&&_0x26d450[_0x086b('0x15')]&&_0x26d450[_0x086b('0x15')]['id']){try{var _0x54b408=getId(_0x26d450[_0x086b('0x13')],_0x26d450[_0x086b('0x14')]?_0x26d450[_0x086b('0x14')]['id']:0x0,_0x26d450[_0x086b('0x15')]?_0x26d450[_0x086b('0x15')]['id']:0x0);if(_0x21c272['rules'][_0x54b408]){_0x21c272[_0x086b('0x31')][_0x54b408]['emit'](_0x086b('0x3f'));}return _0x253c21({'code':0xc8,'message':_0x26d450});}catch(_0x526fa1){logger[_0x086b('0x2f')](_0x526fa1['stack']);return _0x3b89ea(_0x5bd27d['error'](0x1f4,_0x526fa1));}}logger[_0x086b('0x2f')](_0x086b('0x3b'));return _0x3b89ea(_0x5bd27d[_0x086b('0x2f')](0x1f4,_0x086b('0x3b')));});},'AgentCapacity':function(_0x5b9930){var _0x4d1bac=this;return new Promise(function(_0x33cc5d,_0x123157){if(_0x21c272['agents']['hasOwnProperty'](_0x5b9930['id'])){for(var _0x64d5ff in _0x5b9930['capacity']){if(_0x5b9930['capacity'][_0x086b('0x40')](_0x64d5ff)){if(_0x21c272[_0x086b('0x3d')][_0x5b9930['id']][_0x086b('0x40')](_0x64d5ff+_0x086b('0x41'))){_0x21c272[_0x086b('0x3d')][_0x5b9930['id']][_0x64d5ff+'CurrentCapacity']=parseInt(_0x5b9930[_0x086b('0x42')][_0x64d5ff],0xa);}}}_0x21c272['agents'][_0x5b9930['id']]['updateRealtime']();return _0x33cc5d({'code':0xc8,'message':_0x21c272[_0x086b('0x3d')][_0x5b9930['id']]});}else{return _0x123157(_0x4d1bac[_0x086b('0x2f')](0x1f4,_0x086b('0x43')));}});},'Agents':function(_0x1fe7c2){return new Promise(function(_0x205743,_0x4edb2e){var _0x3fb016=_[_0x086b('0x44')](_0x21c272[_0x086b('0x3d')]);_0x205743({'count':_0x3fb016[_0x086b('0x17')],'rows':_0x3fb016});});},'ChatQueues':function(_0x38ff9d){return new Promise(function(_0xc65b56,_0x5e0a58){var _0x5ecb2a=[];for(var _0x248482 in _0x21c272[_0x086b('0x45')]){if(_0x21c272['chatQueues'][_0x086b('0x40')](_0x248482)){var _0x4d8617=_0x21c272[_0x086b('0x45')][_0x248482];var _0x256da8={'id':_0x4d8617['id'],'available':_0x4d8617[_0x086b('0x46')],'loggedIn':_0x4d8617[_0x086b('0x47')],'name':_0x4d8617[_0x086b('0x48')],'paused':_0x4d8617['paused'],'waiting':_0x4d8617[_0x086b('0x49')]};_0x5ecb2a[_0x086b('0x1e')](_0x256da8);}}_0xc65b56({'count':_0x5ecb2a['length'],'rows':_0x5ecb2a});});},'MailQueues':function(_0x403935){return new Promise(function(_0x1f25c0,_0x377574){var _0x25b61d=[];for(var _0x152361 in _0x21c272[_0x086b('0x4a')]){if(_0x21c272['mailQueues'][_0x086b('0x40')](_0x152361)){var _0x53fbcb=_0x21c272['mailQueues'][_0x152361];var _0x569ed5={'id':_0x53fbcb['id'],'available':_0x53fbcb['available'],'loggedIn':_0x53fbcb[_0x086b('0x47')],'name':_0x53fbcb[_0x086b('0x48')],'paused':_0x53fbcb[_0x086b('0x4b')],'waiting':_0x53fbcb[_0x086b('0x49')]};_0x25b61d[_0x086b('0x1e')](_0x569ed5);}}_0x1f25c0({'count':_0x25b61d[_0x086b('0x17')],'rows':_0x25b61d});});},'OpenchannelQueues':function(_0x55de39){return new Promise(function(_0xcd305,_0x7e9501){var _0x1c8242=[];for(var _0x578fe8 in _0x21c272[_0x086b('0x4c')]){if(_0x21c272[_0x086b('0x4c')][_0x086b('0x40')](_0x578fe8)){var _0x2f22f8=_0x21c272[_0x086b('0x4c')][_0x578fe8];var _0x2f374e={'id':_0x2f22f8['id'],'available':_0x2f22f8[_0x086b('0x46')],'loggedIn':_0x2f22f8[_0x086b('0x47')],'name':_0x2f22f8[_0x086b('0x48')],'paused':_0x2f22f8['paused'],'waiting':_0x2f22f8[_0x086b('0x49')]};_0x1c8242[_0x086b('0x1e')](_0x2f374e);}}_0xcd305({'count':_0x1c8242[_0x086b('0x17')],'rows':_0x1c8242});});},'SmsQueues':function(_0x487758){return new Promise(function(_0x54b691,_0x1d4ab8){var _0xae5d7b=[];for(var _0x544b16 in _0x21c272[_0x086b('0x4d')]){if(_0x21c272[_0x086b('0x4d')][_0x086b('0x40')](_0x544b16)){var _0x55a1e4=_0x21c272[_0x086b('0x4d')][_0x544b16];var _0x1b9f6a={'id':_0x55a1e4['id'],'available':_0x55a1e4['available'],'loggedIn':_0x55a1e4['loggedIn'],'name':_0x55a1e4[_0x086b('0x48')],'paused':_0x55a1e4[_0x086b('0x4b')],'waiting':_0x55a1e4[_0x086b('0x49')]};_0xae5d7b[_0x086b('0x1e')](_0x1b9f6a);}}_0x54b691({'count':_0xae5d7b[_0x086b('0x17')],'rows':_0xae5d7b});});},'FaxQueues':function(_0x3cebae){return new Promise(function(_0x518830,_0xe2463c){var _0x4d3b3d=[];for(var _0x43bca6 in _0x21c272[_0x086b('0x4e')]){if(_0x21c272['faxQueues'][_0x086b('0x40')](_0x43bca6)){var _0xdfe73a=_0x21c272['faxQueues'][_0x43bca6];var _0x33761a={'id':_0xdfe73a['id'],'available':_0xdfe73a[_0x086b('0x46')],'loggedIn':_0xdfe73a[_0x086b('0x47')],'name':_0xdfe73a[_0x086b('0x48')],'paused':_0xdfe73a[_0x086b('0x4b')],'waiting':_0xdfe73a[_0x086b('0x49')]};_0x4d3b3d[_0x086b('0x1e')](_0x33761a);}}_0x518830({'count':_0x4d3b3d[_0x086b('0x17')],'rows':_0x4d3b3d});});},'WhatsappQueues':function(_0x3befdf){return new Promise(function(_0x5b8dbb,_0x5248a5){var _0x37acc2=[];for(var _0x20f478 in _0x21c272[_0x086b('0x4f')]){if(_0x21c272[_0x086b('0x4f')]['hasOwnProperty'](_0x20f478)){var _0x2f8dcb=_0x21c272[_0x086b('0x4f')][_0x20f478];var _0x141bcd={'id':_0x2f8dcb['id'],'available':_0x2f8dcb[_0x086b('0x46')],'loggedIn':_0x2f8dcb['loggedIn'],'name':_0x2f8dcb['name'],'paused':_0x2f8dcb[_0x086b('0x4b')],'waiting':_0x2f8dcb[_0x086b('0x49')]};_0x37acc2[_0x086b('0x1e')](_0x141bcd);}}_0x5b8dbb({'count':_0x37acc2[_0x086b('0x17')],'rows':_0x37acc2});});},'ChatQueuesWaitingInteractions':function(_0x1d5718){return new Promise(function(_0x34588a,_0x1180f1){var _0xe50c38=_[_0x086b('0x44')](_0x21c272[_0x086b('0x50')]);_0x34588a({'count':_0xe50c38['length'],'rows':_0xe50c38});});},'MailQueuesWaitingInteractions':function(_0x4c018e){return new Promise(function(_0x423270,_0x1a1962){var _0x11540b=_['values'](_0x21c272['mailQueuesWaitingInteractions']);_0x423270({'count':_0x11540b[_0x086b('0x17')],'rows':_0x11540b});});},'OpenchannelQueuesWaitingInteractions':function(_0x1fe20b){return new Promise(function(_0x157b7d,_0x4938c2){var _0xcba5fb=_[_0x086b('0x44')](_0x21c272[_0x086b('0x51')]);_0x157b7d({'count':_0xcba5fb[_0x086b('0x17')],'rows':_0xcba5fb});});},'SmsQueuesWaitingInteractions':function(_0xba8431){return new Promise(function(_0x3a6e90,_0x2b8b23){var _0x1d1489=_[_0x086b('0x44')](_0x21c272[_0x086b('0x52')]);_0x3a6e90({'count':_0x1d1489[_0x086b('0x17')],'rows':_0x1d1489});});},'FaxQueuesWaitingInteractions':function(_0x5a82f2){return new Promise(function(_0x5b25f0,_0x19926a){var _0x46fa8a=_[_0x086b('0x44')](_0x21c272[_0x086b('0x53')]);_0x5b25f0({'count':_0x46fa8a[_0x086b('0x17')],'rows':_0x46fa8a});});},'WhatsappQueuesWaitingInteractions':function(_0x383555){return new Promise(function(_0x149ae8,_0x28dfab){var _0x271486=_[_0x086b('0x44')](_0x21c272['whatsappQueuesWaitingInteractions']);_0x149ae8({'count':_0x271486[_0x086b('0x17')],'rows':_0x271486});});}};var _0xf6e718=jayson['server'](_0x13e75f)[_0x086b('0x54')]();_0xf6e718['on'](_0x086b('0x2f'),function(_0x1744af){logger['error'](JSON[_0x086b('0x33')](_0x1744af));return _0x14ee7d(_0x1744af);});_0xf6e718['listen'](0x232c,_0x086b('0x55'),function(){console[_0x086b('0x56')](_0x086b('0x57'),0x232c);return _0x57afb6(_0x086b('0x58')+0x232c);});});}; \ No newline at end of file +var _0xe295=['paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','.js','app','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','emit','end','QueueReport','UserId','catch','message\x20is\x20empty','agent','agents','busy','capacity','hasOwnProperty','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','waiting','openchannelQueues'];(function(_0x4829ee,_0x3c07a1){var _0x51b9f6=function(_0x1534b1){while(--_0x1534b1){_0x4829ee['push'](_0x4829ee['shift']());}};_0x51b9f6(++_0x3c07a1);}(_0xe295,0x179));var _0x5e29=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xe295[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x5e29('0x0'));var util=require(_0x5e29('0x1'));var path=require(_0x5e29('0x2'));var fs=require('fs');var jayson=require(_0x5e29('0x3'));var BPromise=require('bluebird');var uuid=require(_0x5e29('0x4'));var config=require('../../../config/environment');var logger=require(_0x5e29('0x5'))(_0x5e29('0x6'));var rpc={'openchannelQueueReport':require(_0x5e29('0x7')),'mailQueueReport':require(_0x5e29('0x8')),'chatQueueReport':require(_0x5e29('0x9')),'smsQueueReport':require(_0x5e29('0xa')),'faxQueueReport':require(_0x5e29('0xb')),'whatsappQueueReport':require(_0x5e29('0xc'))};var RuleEngine=require(_0x5e29('0xd'));function getId(_0x5412fe,_0x1cf78d,_0x570c0d){return util[_0x5e29('0xe')](_0x5e29('0xf'),_0x5412fe,_0x1cf78d||0x0,_0x570c0d||0x0);}function getIntervals(_0x44ee60,_0x5c5bca){var _0x45f1f8=[];if(!_[_0x5e29('0x10')](_0x5c5bca[_0x5e29('0x11')])&&!_['isNil'](_0x44ee60[_0x5c5bca['IntervalId']])&&!_[_0x5e29('0x10')](_0x44ee60[_0x5c5bca[_0x5e29('0x11')]][_0x5e29('0x12')])){_0x45f1f8=_[_0x5e29('0x13')](_0x44ee60[_0x5c5bca[_0x5e29('0x11')]][_0x5e29('0x12')],_0x5e29('0x14'));}else if(!_[_0x5e29('0x10')](_0x5c5bca[_0x5e29('0x14')])){_0x45f1f8=[_0x5c5bca[_0x5e29('0x14')]];}return _0x45f1f8;}exports[_0x5e29('0x15')]=function(_0x31c383){_0x31c383[_0x5e29('0x16')]={};return new BPromise(function(_0x5af2c0,_0x1d4858){var _0x33c817={'Start':function(_0x38180a){var _0x1513cf=this;return new Promise(function(_0xb52b52,_0x4d4aea){if(_0x38180a){try{var _0x192f11=[];var _0x16772c=getId(_0x38180a[_0x5e29('0x17')],_0x38180a[_0x5e29('0x18')]?_0x38180a[_0x5e29('0x18')]['id']:0x0,_0x38180a[_0x5e29('0x19')]?_0x38180a['interaction']['id']:0x0);if(_0x38180a[_0x5e29('0x1a')]&&_[_0x5e29('0x1b')](_0x38180a[_0x5e29('0x1a')])&&_0x38180a[_0x5e29('0x1a')][_0x5e29('0x1c')]){for(var _0x22f3a9=0x0;_0x22f3a9<_0x38180a[_0x5e29('0x1a')]['length'];_0x22f3a9+=0x1){var _0x3348c9=_0x38180a[_0x5e29('0x1a')][_0x22f3a9];if(fs['existsSync'](path[_0x5e29('0x1d')](__dirname,_0x5e29('0x1a'),_0x3348c9['app']+_0x5e29('0x1e')))){var _0x90fed5=[];switch(_0x3348c9[_0x5e29('0x1f')]['toLowerCase']()){case _0x5e29('0x20'):var _0xeebf84=_0x3348c9[_0x5e29('0x21')][_0x5e29('0x22')](',');_0x90fed5[_0x5e29('0x23')](_0xeebf84[0x0]);_0x90fed5['push'](_0xeebf84[_0x5e29('0x24')](0x1,_0xeebf84[_0x5e29('0x1c')])[_0x5e29('0x1d')](','));break;case _0x5e29('0x25'):var _0xded4ee=_0x3348c9[_0x5e29('0x21')][_0x5e29('0x22')](',');_0x90fed5[_0x5e29('0x23')](_0xded4ee[0x0]);_0x90fed5[_0x5e29('0x23')](_0xded4ee[0x1]);_0x90fed5[_0x5e29('0x23')](_0xded4ee[_0x5e29('0x24')](0x2,_0xded4ee[_0x5e29('0x1c')])[_0x5e29('0x1d')](','));break;case _0x5e29('0x26'):var _0x113ec6=_0x3348c9[_0x5e29('0x21')][_0x5e29('0x22')](',');_0x90fed5[_0x5e29('0x23')](_0x113ec6[0x0]);_0x90fed5[_0x5e29('0x23')](_0x113ec6[0x1]);_0x90fed5['push'](_0x113ec6[0x2]);_0x90fed5[_0x5e29('0x23')](_0x113ec6[0x3]);_0x90fed5[_0x5e29('0x23')](_0x113ec6[_0x5e29('0x24')](0x4,_0x113ec6[_0x5e29('0x1c')])[_0x5e29('0x1d')](','));break;case'amazonlex':var _0x5cb517=_0x3348c9[_0x5e29('0x21')][_0x5e29('0x22')](',');_0x90fed5[_0x5e29('0x23')](_0x5cb517[0x0]);_0x90fed5[_0x5e29('0x23')](_0x5cb517[0x1]);_0x90fed5[_0x5e29('0x23')](_0x5cb517[0x2]);_0x90fed5[_0x5e29('0x23')](_0x5cb517[0x3]);_0x90fed5[_0x5e29('0x23')](_0x5cb517['slice'](0x4,_0x5cb517[_0x5e29('0x1c')])['join'](','));break;case _0x5e29('0x18'):_0x90fed5[_0x5e29('0x23')](_0x3348c9[_0x5e29('0x21')]);break;case _0x5e29('0x27'):_0x90fed5['push'](_0x3348c9[_0x5e29('0x28')]);_0x90fed5[_0x5e29('0x23')](_0x3348c9[_0x5e29('0x21')]);break;default:_0x90fed5=_[_0x5e29('0x10')](_0x3348c9[_0x5e29('0x21')])?[]:_0x3348c9[_0x5e29('0x21')][_0x5e29('0x22')](',');}var _0x247493={'id':util[_0x5e29('0xe')]('%s:%s:%s',_0x16772c,_0x3348c9['id'],_0x3348c9['app']),'condition':require('./interval')['condition'](_0x16772c,getIntervals(_0x31c383[_0x5e29('0x29')],_0x3348c9),_0x31c383),'consequence':require('./applications/'+_0x3348c9['app'])[_0x5e29('0x2a')](_0x16772c,_0x90fed5,_0x31c383,_0x38180a),'p':_0x3348c9[_0x5e29('0x2b')]||0x0};logger['info'](_0x5e29('0x2c'),_0x247493['id'],_0x5e29('0x2d'),getIntervals(_0x31c383['intervals'],_0x3348c9)[_0x5e29('0x1d')]('\x20|\x20'));_0x192f11[_0x5e29('0x23')](_0x247493);}else{logger[_0x5e29('0x2e')](_0x5e29('0x2f'),path[_0x5e29('0x1d')](__dirname,'applications',_0x3348c9[_0x5e29('0x1f')]+'.js'));}}_0x31c383[_0x5e29('0x16')][_0x16772c]=new RuleEngine(_0x192f11);_0x31c383['rules'][_0x16772c][_0x5e29('0x30')](_0x38180a,function(_0x5f47a9){logger[_0x5e29('0x31')](_0x5e29('0x32'),JSON[_0x5e29('0x33')](_0x5f47a9[_0x5e29('0x34')]));if(_0x31c383[_0x5e29('0x16')][_0x16772c]){_0x31c383[_0x5e29('0x16')][_0x16772c]['emit'](_0x5e29('0x35'));}});return _0xb52b52({'code':0xc8,'message':_0x38180a});}else{logger[_0x5e29('0x31')](_0x5e29('0x36'));return _0xb52b52({'code':0xc8,'message':_0x38180a});}}catch(_0x60693c){logger[_0x5e29('0x2e')](_0x60693c[_0x5e29('0x37')]);return _0x4d4aea(_0x1513cf[_0x5e29('0x2e')](0x1f4,_0x60693c));}}return _0x4d4aea(_0x5e29('0x38'));});},'AcceptMessage':function(_0x109042){var _0x5c3b85=this;return new Promise(function(_0x17e4ae,_0x2febac){if(_0x109042['message']&&_0x109042['message']['id']){try{var _0x5de24d=getId(_0x109042['channel'],_0x109042[_0x5e29('0x18')]?_0x109042['message']['id']:0x0,_0x109042[_0x5e29('0x19')]?_0x109042['interaction']['id']:0x0);if(_0x31c383['rules'][_0x5de24d]){_0x31c383[_0x5e29('0x16')][_0x5de24d][_0x5e29('0x39')](_0x5e29('0x3a'));if(rpc[_0x109042[_0x5e29('0x17')]+_0x5e29('0x3b')]){rpc[_0x109042[_0x5e29('0x17')]+'QueueReport']['update'](_0x5de24d,{'UserId':_0x109042[_0x5e29('0x18')][_0x5e29('0x3c')]})[_0x5e29('0x3d')](function(_0x3e760a){logger[_0x5e29('0x2e')]('error\x20update\x20queue\x20report');});}}return _0x17e4ae({'code':0xc8,'message':_0x109042});}catch(_0x18ae9d){logger['error'](_0x18ae9d['stack']);return _0x2febac(_0x5c3b85['error'](0x1f4,_0x18ae9d));}}logger[_0x5e29('0x2e')](_0x5e29('0x3e'));return _0x2febac(_0x5c3b85[_0x5e29('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xcc1b78){var _0x323dbe=this;return new Promise(function(_0x4c5de3,_0x3df6cb){if(_0xcc1b78[_0x5e29('0x3f')]&&_0xcc1b78[_0x5e29('0x3f')]['id']){try{if(_0x31c383[_0x5e29('0x40')][_0xcc1b78[_0x5e29('0x3f')]['id']]){_0x31c383['agents'][_0xcc1b78[_0x5e29('0x3f')]['id']][_0x5e29('0x41')]=![];_0x31c383[_0x5e29('0x40')][_0xcc1b78[_0x5e29('0x3f')]['id']]['busyQueue']=undefined;}return _0x4c5de3({'code':0xc8,'message':_0xcc1b78});}catch(_0xfc000c){logger[_0x5e29('0x2e')](_0xfc000c[_0x5e29('0x37')]);return _0x3df6cb(_0x323dbe[_0x5e29('0x2e')](0x1f4,_0xfc000c));}}logger[_0x5e29('0x2e')](_0x5e29('0x3e'));return _0x3df6cb(_0x323dbe[_0x5e29('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2c7d3f){var _0x2c4e3a=this;return new Promise(function(_0x5e6f3b,_0x414856){if(_0x2c7d3f[_0x5e29('0x17')]&&_0x2c7d3f[_0x5e29('0x19')]&&_0x2c7d3f[_0x5e29('0x19')]['id']){try{var _0x4dadbd=getId(_0x2c7d3f[_0x5e29('0x17')],_0x2c7d3f['message']?_0x2c7d3f[_0x5e29('0x18')]['id']:0x0,_0x2c7d3f[_0x5e29('0x19')]?_0x2c7d3f[_0x5e29('0x19')]['id']:0x0);if(_0x31c383[_0x5e29('0x16')][_0x4dadbd]){_0x31c383[_0x5e29('0x16')][_0x4dadbd][_0x5e29('0x39')](_0x5e29('0x3a'));}return _0x5e6f3b({'code':0xc8,'message':_0x2c7d3f});}catch(_0x5d76ae){logger[_0x5e29('0x2e')](_0x5d76ae[_0x5e29('0x37')]);return _0x414856(_0x2c4e3a[_0x5e29('0x2e')](0x1f4,_0x5d76ae));}}logger['error']('message\x20is\x20empty');return _0x414856(_0x2c4e3a[_0x5e29('0x2e')](0x1f4,_0x5e29('0x3e')));});},'AgentCapacity':function(_0x1887a2){var _0x4f7b75=this;return new Promise(function(_0x20cf84,_0x423aa2){if(_0x31c383[_0x5e29('0x40')]['hasOwnProperty'](_0x1887a2['id'])){for(var _0x11409c in _0x1887a2[_0x5e29('0x42')]){if(_0x1887a2['capacity'][_0x5e29('0x43')](_0x11409c)){if(_0x31c383['agents'][_0x1887a2['id']][_0x5e29('0x43')](_0x11409c+'CurrentCapacity')){_0x31c383[_0x5e29('0x40')][_0x1887a2['id']][_0x11409c+'CurrentCapacity']=parseInt(_0x1887a2[_0x5e29('0x42')][_0x11409c],0xa);}}}_0x31c383['agents'][_0x1887a2['id']][_0x5e29('0x44')]();return _0x20cf84({'code':0xc8,'message':_0x31c383[_0x5e29('0x40')][_0x1887a2['id']]});}else{return _0x423aa2(_0x4f7b75[_0x5e29('0x2e')](0x1f4,_0x5e29('0x45')));}});},'Agents':function(_0x3d0d22){return new Promise(function(_0x4acc7a,_0x20018c){var _0x178484=_[_0x5e29('0x46')](_0x31c383[_0x5e29('0x40')]);_0x4acc7a({'count':_0x178484[_0x5e29('0x1c')],'rows':_0x178484});});},'ChatQueues':function(_0x234f18){return new Promise(function(_0x31ed5f,_0x4a5f68){var _0x1673e2=[];for(var _0x2c90e3 in _0x31c383[_0x5e29('0x47')]){if(_0x31c383['chatQueues'][_0x5e29('0x43')](_0x2c90e3)){var _0x1297de=_0x31c383['chatQueues'][_0x2c90e3];var _0x475ae2={'id':_0x1297de['id'],'available':_0x1297de[_0x5e29('0x48')],'loggedIn':_0x1297de[_0x5e29('0x49')],'name':_0x1297de[_0x5e29('0x4a')],'paused':_0x1297de['paused'],'waiting':_0x1297de['waiting']};_0x1673e2['push'](_0x475ae2);}}_0x31ed5f({'count':_0x1673e2[_0x5e29('0x1c')],'rows':_0x1673e2});});},'MailQueues':function(_0x946f71){return new Promise(function(_0x42df95,_0x3c8dbc){var _0x5f3a81=[];for(var _0x52a7e5 in _0x31c383[_0x5e29('0x4b')]){if(_0x31c383[_0x5e29('0x4b')][_0x5e29('0x43')](_0x52a7e5)){var _0x577ce0=_0x31c383[_0x5e29('0x4b')][_0x52a7e5];var _0x23a622={'id':_0x577ce0['id'],'available':_0x577ce0[_0x5e29('0x48')],'loggedIn':_0x577ce0[_0x5e29('0x49')],'name':_0x577ce0[_0x5e29('0x4a')],'paused':_0x577ce0['paused'],'waiting':_0x577ce0[_0x5e29('0x4c')]};_0x5f3a81[_0x5e29('0x23')](_0x23a622);}}_0x42df95({'count':_0x5f3a81[_0x5e29('0x1c')],'rows':_0x5f3a81});});},'OpenchannelQueues':function(_0x199fa0){return new Promise(function(_0x166612,_0x27eed2){var _0x2ce518=[];for(var _0x317656 in _0x31c383[_0x5e29('0x4d')]){if(_0x31c383['openchannelQueues'][_0x5e29('0x43')](_0x317656)){var _0x37e2dc=_0x31c383[_0x5e29('0x4d')][_0x317656];var _0x5bbc1a={'id':_0x37e2dc['id'],'available':_0x37e2dc[_0x5e29('0x48')],'loggedIn':_0x37e2dc[_0x5e29('0x49')],'name':_0x37e2dc[_0x5e29('0x4a')],'paused':_0x37e2dc[_0x5e29('0x4e')],'waiting':_0x37e2dc[_0x5e29('0x4c')]};_0x2ce518['push'](_0x5bbc1a);}}_0x166612({'count':_0x2ce518[_0x5e29('0x1c')],'rows':_0x2ce518});});},'SmsQueues':function(_0x3ae7e7){return new Promise(function(_0x3ff28a,_0x157ce5){var _0x329f42=[];for(var _0x23d9f in _0x31c383[_0x5e29('0x4f')]){if(_0x31c383[_0x5e29('0x4f')][_0x5e29('0x43')](_0x23d9f)){var _0x5ba037=_0x31c383[_0x5e29('0x4f')][_0x23d9f];var _0x296bee={'id':_0x5ba037['id'],'available':_0x5ba037[_0x5e29('0x48')],'loggedIn':_0x5ba037[_0x5e29('0x49')],'name':_0x5ba037[_0x5e29('0x4a')],'paused':_0x5ba037[_0x5e29('0x4e')],'waiting':_0x5ba037[_0x5e29('0x4c')]};_0x329f42[_0x5e29('0x23')](_0x296bee);}}_0x3ff28a({'count':_0x329f42[_0x5e29('0x1c')],'rows':_0x329f42});});},'FaxQueues':function(_0x5be20d){return new Promise(function(_0x143e42,_0x48c3a9){var _0x14500b=[];for(var _0x430561 in _0x31c383[_0x5e29('0x50')]){if(_0x31c383[_0x5e29('0x50')][_0x5e29('0x43')](_0x430561)){var _0x23726a=_0x31c383['faxQueues'][_0x430561];var _0x4c6311={'id':_0x23726a['id'],'available':_0x23726a[_0x5e29('0x48')],'loggedIn':_0x23726a['loggedIn'],'name':_0x23726a[_0x5e29('0x4a')],'paused':_0x23726a[_0x5e29('0x4e')],'waiting':_0x23726a[_0x5e29('0x4c')]};_0x14500b[_0x5e29('0x23')](_0x4c6311);}}_0x143e42({'count':_0x14500b['length'],'rows':_0x14500b});});},'WhatsappQueues':function(_0x45181b){return new Promise(function(_0x45d6c4,_0x276dd8){var _0x5ccc84=[];for(var _0x518dab in _0x31c383[_0x5e29('0x51')]){if(_0x31c383[_0x5e29('0x51')][_0x5e29('0x43')](_0x518dab)){var _0x4c88f8=_0x31c383[_0x5e29('0x51')][_0x518dab];var _0x52e553={'id':_0x4c88f8['id'],'available':_0x4c88f8['available'],'loggedIn':_0x4c88f8[_0x5e29('0x49')],'name':_0x4c88f8['name'],'paused':_0x4c88f8['paused'],'waiting':_0x4c88f8[_0x5e29('0x4c')]};_0x5ccc84[_0x5e29('0x23')](_0x52e553);}}_0x45d6c4({'count':_0x5ccc84[_0x5e29('0x1c')],'rows':_0x5ccc84});});},'ChatQueuesWaitingInteractions':function(_0x256a3c){return new Promise(function(_0x413002,_0x260f79){var _0x52533e=_[_0x5e29('0x46')](_0x31c383[_0x5e29('0x52')]);_0x413002({'count':_0x52533e['length'],'rows':_0x52533e});});},'MailQueuesWaitingInteractions':function(_0xd335d1){return new Promise(function(_0x195538,_0x7ae6e5){var _0x41b1ae=_[_0x5e29('0x46')](_0x31c383[_0x5e29('0x53')]);_0x195538({'count':_0x41b1ae['length'],'rows':_0x41b1ae});});},'OpenchannelQueuesWaitingInteractions':function(_0x5b8df9){return new Promise(function(_0x11ff2b,_0x3307cc){var _0x32da15=_['values'](_0x31c383[_0x5e29('0x54')]);_0x11ff2b({'count':_0x32da15[_0x5e29('0x1c')],'rows':_0x32da15});});},'SmsQueuesWaitingInteractions':function(_0x5be295){return new Promise(function(_0x426f77,_0x4130a4){var _0x5174c0=_['values'](_0x31c383[_0x5e29('0x55')]);_0x426f77({'count':_0x5174c0[_0x5e29('0x1c')],'rows':_0x5174c0});});},'FaxQueuesWaitingInteractions':function(_0x526511){return new Promise(function(_0x3cec8d,_0x40212c){var _0x43d484=_['values'](_0x31c383[_0x5e29('0x56')]);_0x3cec8d({'count':_0x43d484[_0x5e29('0x1c')],'rows':_0x43d484});});},'WhatsappQueuesWaitingInteractions':function(_0x2d13a9){return new Promise(function(_0x5d50f4,_0x3ceebc){var _0x5230e2=_[_0x5e29('0x46')](_0x31c383[_0x5e29('0x57')]);_0x5d50f4({'count':_0x5230e2[_0x5e29('0x1c')],'rows':_0x5230e2});});}};var _0x4c4fea=jayson['server'](_0x33c817)['http']();_0x4c4fea['on'](_0x5e29('0x2e'),function(_0x492f27){logger[_0x5e29('0x2e')](JSON[_0x5e29('0x33')](_0x492f27));return _0x1d4858(_0x492f27);});_0x4c4fea[_0x5e29('0x15')](0x232c,_0x5e29('0x58'),function(){console[_0x5e29('0x59')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5af2c0(_0x5e29('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7cf93b1..8d5d980 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 _0xfd75=['some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','catch','log','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all'];(function(_0xaacefa,_0x304dd1){var _0x583ae7=function(_0x216c26){while(--_0x216c26){_0xaacefa['push'](_0xaacefa['shift']());}};_0x583ae7(++_0x304dd1);}(_0xfd75,0xa1));var _0x5fd7=function(_0x5a529b,_0x555ba9){_0x5a529b=_0x5a529b-0x0;var _0x3a1ab5=_0xfd75[_0x5a529b];return _0x3a1ab5;};'use strict';var util=require('util');var BPromise=require(_0x5fd7('0x0'));var jayson=require(_0x5fd7('0x1'));var _=require(_0x5fd7('0x2'));var logger=require(_0x5fd7('0x3'))(_0x5fd7('0x4'));var client=jayson[_0x5fd7('0x5')][_0x5fd7('0x6')]({'port':0x232a});function request(_0x3661e5,_0x255ad1){return new BPromise(function(_0x55992a,_0x24eab0){return client[_0x5fd7('0x7')](_0x3661e5,_0x255ad1)[_0x5fd7('0x8')](function(_0x1f23bf){if(_0x1f23bf[_0x5fd7('0x9')]){return _0x24eab0(_0x1f23bf[_0x5fd7('0x9')][_0x5fd7('0xa')]);}else{return _0x55992a(_0x1f23bf['result']);}})['catch'](function(_0x191cd2){return _0x24eab0(_0x191cd2);});});}exports[_0x5fd7('0xb')]=function(_0x58bf3d,_0x576b9a,_0x26ca74){return function(_0x39c0e1){if(_0x26ca74['rules']&&!_0x26ca74[_0x5fd7('0xc')][_0x58bf3d]){logger[_0x5fd7('0xd')](_0x5fd7('0xe'),_0x58bf3d);return _0x39c0e1[_0x5fd7('0xf')]();}var _0x592452=[];for(var _0x5da33b=0x0;_0x5da33b<_0x576b9a[_0x5fd7('0x10')];_0x5da33b+=0x1){_0x592452[_0x5fd7('0x11')](request(_0x5fd7('0x12'),{'command':util[_0x5fd7('0x13')](_0x5fd7('0x14'),_0x576b9a[_0x5da33b])})[_0x5fd7('0x8')](function(_0x4f3966){return _0x4f3966&&_0x4f3966[_0x5fd7('0xa')]&&_0x4f3966[_0x5fd7('0xa')][_0x5fd7('0x15')](_0x5fd7('0x16'))>=0x0?!![]:![];})['catch'](function(_0x1e3599){logger[_0x5fd7('0x9')](_0x5fd7('0x17'),_0x58bf3d,_0x576b9a[_0x5da33b]);}));}BPromise[_0x5fd7('0x18')](_0x592452)[_0x5fd7('0x8')](function(_0x12bb99){var _0x1bc42e=_[_0x5fd7('0x19')](_0x12bb99);logger['info'](_0x5fd7('0x1a'),_0x58bf3d,_0x576b9a[_0x5fd7('0x1b')](_0x5fd7('0x1c')),_0x1bc42e);_0x39c0e1['when'](_0x1bc42e);})[_0x5fd7('0x1d')](function(_0x2ae758){console[_0x5fd7('0x1e')](_0x2ae758);logger[_0x5fd7('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x58bf3d,_0x576b9a['join']('\x20|\x20'),_0x2ae758['stack']);_0x39c0e1[_0x5fd7('0xf')]();});};}; \ No newline at end of file +var _0x7a71=['\x20|\x20','when','log','util','bluebird','jayson/promise','routing','client','request','error','message','condition','rules','info','stop','length','push','Command','iftime\x20%s','then','indexOf','true','catch','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x510bcd,_0x3e5a67){var _0x1975e6=function(_0x176aa1){while(--_0x176aa1){_0x510bcd['push'](_0x510bcd['shift']());}};_0x1975e6(++_0x3e5a67);}(_0x7a71,0x107));var _0x17a7=function(_0x502ad7,_0x39a859){_0x502ad7=_0x502ad7-0x0;var _0x1e97f0=_0x7a71[_0x502ad7];return _0x1e97f0;};'use strict';var util=require(_0x17a7('0x0'));var BPromise=require(_0x17a7('0x1'));var jayson=require(_0x17a7('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x17a7('0x3'));var client=jayson[_0x17a7('0x4')]['http']({'port':0x232a});function request(_0x1b6cf9,_0x26659a){return new BPromise(function(_0x58b6d7,_0x149851){return client[_0x17a7('0x5')](_0x1b6cf9,_0x26659a)['then'](function(_0x1f3aa7){if(_0x1f3aa7[_0x17a7('0x6')]){return _0x149851(_0x1f3aa7[_0x17a7('0x6')][_0x17a7('0x7')]);}else{return _0x58b6d7(_0x1f3aa7['result']);}})['catch'](function(_0x41b484){return _0x149851(_0x41b484);});});}exports[_0x17a7('0x8')]=function(_0x4c1655,_0xba212c,_0x5932d6){return function(_0xcb3151){if(_0x5932d6[_0x17a7('0x9')]&&!_0x5932d6[_0x17a7('0x9')][_0x4c1655]){logger[_0x17a7('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4c1655);return _0xcb3151[_0x17a7('0xb')]();}var _0x3f1620=[];for(var _0x3c2ca8=0x0;_0x3c2ca8<_0xba212c[_0x17a7('0xc')];_0x3c2ca8+=0x1){_0x3f1620[_0x17a7('0xd')](request(_0x17a7('0xe'),{'command':util['format'](_0x17a7('0xf'),_0xba212c[_0x3c2ca8])})[_0x17a7('0x10')](function(_0x2f3fa3){return _0x2f3fa3&&_0x2f3fa3[_0x17a7('0x7')]&&_0x2f3fa3['message'][_0x17a7('0x11')](_0x17a7('0x12'))>=0x0?!![]:![];})[_0x17a7('0x13')](function(_0x245f29){logger['error'](_0x17a7('0x14'),_0x4c1655,_0xba212c[_0x3c2ca8]);}));}BPromise['all'](_0x3f1620)[_0x17a7('0x10')](function(_0x8739d){var _0x38eaa1=_['some'](_0x8739d);logger[_0x17a7('0xa')](_0x17a7('0x15'),_0x4c1655,_0xba212c[_0x17a7('0x16')](_0x17a7('0x17')),_0x38eaa1);_0xcb3151[_0x17a7('0x18')](_0x38eaa1);})[_0x17a7('0x13')](function(_0x3e4103){console[_0x17a7('0x19')](_0x3e4103);logger[_0x17a7('0x6')](_0x17a7('0x15'),_0x4c1655,_0xba212c[_0x17a7('0x16')](_0x17a7('0x17')),_0x3e4103['stack']);_0xcb3151[_0x17a7('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 431fcb3..fa88df8 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 _0xdd35=['talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','lodash','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','request','CreateVoiceAgentReport','agentcalled','debug','agentcalledAt','now','destuniqueid','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime'];(function(_0x336497,_0x417730){var _0x2f9aa1=function(_0x495aa0){while(--_0x495aa0){_0x336497['push'](_0x336497['shift']());}};_0x2f9aa1(++_0x417730);}(_0xdd35,0x1c9));var _0x5dd3=function(_0x45e8c2,_0x4d715c){_0x45e8c2=_0x45e8c2-0x0;var _0x577a10=_0xdd35[_0x45e8c2];return _0x577a10;};'use strict';var _=require(_0x5dd3('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x364026,_0xef212b){utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x364026[_0x5dd3('0x3')],_0x364026[_0x5dd3('0x4')],_0x364026[_0x5dd3('0x5')],_0x364026[_0x5dd3('0x6')],_0x364026[_0x5dd3('0x7')],_0x364026['calleridnum'],_0x364026[_0x5dd3('0x8')],_0x364026[_0x5dd3('0x9')]));if(_0x364026['queue']){utils[_0x5dd3('0xa')](_0x364026['queue'])[_0x5dd3('0xb')](function(_0x2cc9d7){if(_0x2cc9d7){_0x364026[_0x5dd3('0xc')]=_0x2cc9d7[_0x5dd3('0xc')];_0x364026[_0x5dd3('0xd')]=_0x364026[_0x5dd3('0xe')]?_0x2cc9d7['acw']:![];_0x364026['acwtime']=_0x364026[_0x5dd3('0xd')]?_0x2cc9d7['acwTimeout']:0x0;}utils[_0x5dd3('0xf')](_0x5dd3('0x10'),_0x364026);});}else{utils[_0x5dd3('0xf')]('CreateVoiceAgentReport',_0x364026);}if(_0xef212b){delete transfers[_0x364026[_0x5dd3('0x3')]];}else{delete agents[_0x364026['destuniqueid']];}}exports[_0x5dd3('0x11')]=function(_0x5e4792){try{utils[_0x5dd3('0x12')](util['format']('[%s][agents][agentcalled]',_0x5e4792[_0x5dd3('0x3')]),_0x5e4792);agents[_0x5e4792['destuniqueid']]=_0x5e4792;agents[_0x5e4792['destuniqueid']][_0x5dd3('0x13')]=utils[_0x5dd3('0x14')]();agents[_0x5e4792[_0x5dd3('0x15')]][_0x5dd3('0x9')]=_0x5dd3('0x16');agents[_0x5e4792[_0x5dd3('0x15')]][_0x5dd3('0x8')]=null;agents[_0x5e4792[_0x5dd3('0x15')]][_0x5dd3('0x17')]=null;utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')](_0x5dd3('0x18'),_0x5e4792['uniqueid'],agents[_0x5e4792[_0x5dd3('0x15')]][_0x5dd3('0x6')],_0x5e4792[_0x5dd3('0x15')]));}catch(_0x4c4987){utils[_0x5dd3('0x19')](util[_0x5dd3('0x2')](_0x5dd3('0x1a'),_0x5e4792[_0x5dd3('0x3')]),_0x4c4987);}};exports[_0x5dd3('0x1b')]=function(_0x3c7b78){try{if(!_[_0x5dd3('0x1c')](agents[_0x3c7b78['destuniqueid']])){utils[_0x5dd3('0x12')](util[_0x5dd3('0x2')](_0x5dd3('0x1d'),_0x3c7b78['uniqueid']),_0x3c7b78);utils[_0x5dd3('0x1')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x3c7b78[_0x5dd3('0x3')],agents[_0x3c7b78[_0x5dd3('0x15')]][_0x5dd3('0x6')],_0x3c7b78['destuniqueid']));agents[_0x3c7b78[_0x5dd3('0x15')]]['agentringnoanswer']=!![];agents[_0x3c7b78[_0x5dd3('0x15')]][_0x5dd3('0x1e')]=utils['now']();agents[_0x3c7b78[_0x5dd3('0x15')]][_0x5dd3('0x9')]=_0x5dd3('0x1f');agents[_0x3c7b78['destuniqueid']][_0x5dd3('0x20')]=_0x5dd3('0x1f');agents[_0x3c7b78[_0x5dd3('0x15')]][_0x5dd3('0x21')]=_0x3c7b78['ringtime']?parseInt(_0x3c7b78[_0x5dd3('0x22')])/0x3e8:0x0;agents[_0x3c7b78['destuniqueid']][_0x5dd3('0x23')]=0x0;unanswered[_0x5dd3('0x24')](_0x3c7b78[_0x5dd3('0x15')]);}}catch(_0x9c8bc6){utils['error'](util[_0x5dd3('0x2')]('[%s][agents][agentringnoanswer]',_0x3c7b78['uniqueid']),_0x9c8bc6);}};exports[_0x5dd3('0x25')]=function(_0x3bf714){try{_[_0x5dd3('0x26')](agents,function(_0x439e7e,_0x428fda){if(_0x439e7e[_0x5dd3('0x3')]==_0x3bf714[_0x5dd3('0x3')]&&!_['includes'](unanswered,_0x439e7e[_0x5dd3('0x15')])){utils[_0x5dd3('0x12')](util['format'](_0x5dd3('0x27'),_0x3bf714[_0x5dd3('0x3')]),_0x3bf714);utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3bf714[_0x5dd3('0x3')],_0x439e7e[_0x5dd3('0x6')],_0x439e7e[_0x5dd3('0x15')]));_0x439e7e[_0x5dd3('0x1b')]=!![];_0x439e7e[_0x5dd3('0x1e')]=utils[_0x5dd3('0x14')]();_0x439e7e['lastevent']=_0x5dd3('0x28');_0x439e7e[_0x5dd3('0x20')]=_0x5dd3('0x28');_0x439e7e[_0x5dd3('0x21')]=_0x3bf714[_0x5dd3('0x21')];_0x439e7e[_0x5dd3('0x23')]=0x0;writeDB(_0x439e7e);}});}catch(_0x1ec01d){utils[_0x5dd3('0x19')](util[_0x5dd3('0x2')]('[%s][agents][queuecallerabandon]',_0x3bf714[_0x5dd3('0x3')]),_0x1ec01d);}};exports[_0x5dd3('0x29')]=function(_0x802177){try{if(agents[_0x802177['destuniqueid']]){utils[_0x5dd3('0x12')](util[_0x5dd3('0x2')](_0x5dd3('0x2a'),_0x802177[_0x5dd3('0x3')]),_0x802177);utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')](_0x5dd3('0x2b'),_0x802177[_0x5dd3('0x3')],agents[_0x802177[_0x5dd3('0x15')]][_0x5dd3('0x6')],_0x802177['destuniqueid']));agents[_0x802177[_0x5dd3('0x15')]][_0x5dd3('0x2c')]=utils['now']();agents[_0x802177['destuniqueid']][_0x5dd3('0x8')]=_0x802177[_0x5dd3('0x8')];agents[_0x802177[_0x5dd3('0x15')]][_0x5dd3('0x17')]=_0x802177[_0x5dd3('0x17')];agents[_0x802177[_0x5dd3('0x15')]][_0x5dd3('0x21')]=_0x802177[_0x5dd3('0x22')];agents[_0x802177[_0x5dd3('0x15')]]['lastevent']=_0x5dd3('0x2d');_[_0x5dd3('0x26')](agents,function(_0x406353,_0x397f50){if(_0x406353[_0x5dd3('0x15')]!=_0x802177[_0x5dd3('0x15')]&&_0x406353[_0x5dd3('0x3')]==_0x802177[_0x5dd3('0x3')]){_0x406353[_0x5dd3('0x23')]=0x0;_0x406353[_0x5dd3('0x21')]=_0x802177[_0x5dd3('0x22')];_0x406353[_0x5dd3('0x1b')]=!![];_0x406353[_0x5dd3('0x1e')]=utils[_0x5dd3('0x14')]();_0x406353[_0x5dd3('0x9')]='answered_elsewhere';_0x406353[_0x5dd3('0x20')]=_0x5dd3('0x2e');_0x406353[_0x5dd3('0x2f')]=_0x802177['destuniqueid'];_0x406353[_0x5dd3('0x30')]=_0x802177['membername'];writeDB(_0x406353);}});}}catch(_0x2a71ec){utils[_0x5dd3('0x19')](util[_0x5dd3('0x2')](_0x5dd3('0x2a'),_0x802177['uniqueid']),_0x2a71ec);}};exports['agentcomplete']=function(_0x302689){try{if(!_[_0x5dd3('0x1c')](agents[_0x302689[_0x5dd3('0x15')]])){utils[_0x5dd3('0x12')](util[_0x5dd3('0x2')](_0x5dd3('0x31'),_0x302689[_0x5dd3('0x3')]),_0x302689);utils['info'](util[_0x5dd3('0x2')](_0x5dd3('0x32'),_0x302689[_0x5dd3('0x3')],agents[_0x302689['destuniqueid']]['membername'],_0x302689[_0x5dd3('0x15')]));agents[_0x302689[_0x5dd3('0x15')]][_0x5dd3('0xe')]=!![];agents[_0x302689['destuniqueid']][_0x5dd3('0x33')]=utils['now']();agents[_0x302689[_0x5dd3('0x15')]][_0x5dd3('0x23')]=utils[_0x5dd3('0x34')](agents[_0x302689[_0x5dd3('0x15')]][_0x5dd3('0x33')],agents[_0x302689[_0x5dd3('0x15')]]['agentconnectAt']);agents[_0x302689[_0x5dd3('0x15')]][_0x5dd3('0x20')]=_0x302689[_0x5dd3('0x20')];agents[_0x302689['destuniqueid']][_0x5dd3('0x9')]=_0x5dd3('0x35');writeDB(agents[_0x302689[_0x5dd3('0x15')]]);}}catch(_0x3c7728){utils[_0x5dd3('0x19')](util[_0x5dd3('0x2')](_0x5dd3('0x31'),_0x302689[_0x5dd3('0x3')]),_0x3c7728);}};exports['blindtransfer']=function(_0x5ed770){try{if(!_['isNil'](agents[_0x5ed770['transfereruniqueid']])){utils[_0x5dd3('0x12')](util['format'](_0x5dd3('0x36'),_0x5ed770['uniqueid']),_0x5ed770);utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')](_0x5dd3('0x37'),_0x5ed770[_0x5dd3('0x3')],agents[_0x5ed770['transfereruniqueid']][_0x5dd3('0x6')],agents[_0x5ed770[_0x5dd3('0x38')]][_0x5dd3('0x3')]));agents[_0x5ed770[_0x5dd3('0x38')]][_0x5dd3('0x39')]=!![];agents[_0x5ed770[_0x5dd3('0x38')]][_0x5dd3('0x3a')]='blind';agents[_0x5ed770[_0x5dd3('0x38')]][_0x5dd3('0x3b')]=_0x5ed770[_0x5dd3('0x3c')];agents[_0x5ed770[_0x5dd3('0x38')]][_0x5dd3('0x3d')]=agents[_0x5ed770[_0x5dd3('0x38')]][_0x5dd3('0x3')];}}catch(_0x9a0b0c){utils[_0x5dd3('0x19')](util['format'](_0x5dd3('0x36'),_0x5ed770[_0x5dd3('0x3')]),_0x9a0b0c);}};exports[_0x5dd3('0x3e')]=function(_0x512aa6){try{utils['debug'](util[_0x5dd3('0x2')](_0x5dd3('0x3f'),_0x512aa6[_0x5dd3('0x40')]),_0x512aa6);if(_0x512aa6[_0x5dd3('0x40')]==_0x512aa6[_0x5dd3('0x41')]){if(!_[_0x5dd3('0x1c')](agents[_0x512aa6[_0x5dd3('0x42')]])){utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x512aa6[_0x5dd3('0x40')],agents[_0x512aa6[_0x5dd3('0x42')]][_0x5dd3('0x6')]));agents[_0x512aa6[_0x5dd3('0x42')]][_0x5dd3('0x39')]=!![];agents[_0x512aa6[_0x5dd3('0x42')]]['transfertype']='ATTENDED';agents[_0x512aa6['secondtransfereruniqueid']][_0x5dd3('0x3b')]=_0x512aa6[_0x5dd3('0x43')];agents[_0x512aa6['secondtransfereruniqueid']][_0x5dd3('0x3d')]=_0x512aa6['origtransfereruniqueid'];}if(_0x512aa6[_0x5dd3('0x44')]&&agents[_0x512aa6['transfereeuniqueid']]){agents[_0x512aa6[_0x5dd3('0x44')]][_0x5dd3('0x45')]=0x1;transfers[_0x512aa6['transfereeuniqueid']]=_[_0x5dd3('0x46')](agents[_0x512aa6[_0x5dd3('0x44')]]);transfers[_0x512aa6[_0x5dd3('0x44')]][_0x5dd3('0x47')]=agents[_0x512aa6[_0x5dd3('0x42')]][_0x5dd3('0x47')];transfers[_0x512aa6[_0x5dd3('0x44')]][_0x5dd3('0x48')]=agents[_0x512aa6[_0x5dd3('0x42')]][_0x5dd3('0x48')];transfers[_0x512aa6['transfereeuniqueid']]['agentcalledAt']=utils[_0x5dd3('0x14')]();transfers[_0x512aa6[_0x5dd3('0x44')]][_0x5dd3('0x2c')]=utils[_0x5dd3('0x14')]();transfers[_0x512aa6['transfereeuniqueid']][_0x5dd3('0x21')]=0x0;transfers[_0x512aa6[_0x5dd3('0x44')]][_0x5dd3('0x45')]=0x2;}}else if(_0x512aa6[_0x5dd3('0x42')]==_0x512aa6[_0x5dd3('0x49')]){if(!_[_0x5dd3('0x1c')](agents[_0x512aa6[_0x5dd3('0x40')]])){utils['info'](util[_0x5dd3('0x2')](_0x5dd3('0x4a'),_0x512aa6[_0x5dd3('0x40')],agents[_0x512aa6[_0x5dd3('0x40')]][_0x5dd3('0x6')]));agents[_0x512aa6[_0x5dd3('0x40')]]['transfer']=!![];agents[_0x512aa6[_0x5dd3('0x40')]]['transfertype']=_0x5dd3('0x4b');agents[_0x512aa6[_0x5dd3('0x40')]][_0x5dd3('0x3b')]=_0x512aa6['secondtransfererexten'];agents[_0x512aa6['origtransfereruniqueid']][_0x5dd3('0x3d')]=_0x512aa6[_0x5dd3('0x42')];}if(_0x512aa6['transfertargetuniqueid']&&agents[_0x512aa6[_0x5dd3('0x4c')]]){agents[_0x512aa6[_0x5dd3('0x4c')]][_0x5dd3('0x45')]=0x1;transfers[_0x512aa6[_0x5dd3('0x4c')]]=_[_0x5dd3('0x46')](agents[_0x512aa6[_0x5dd3('0x4c')]]);transfers[_0x512aa6['transfertargetuniqueid']][_0x5dd3('0x47')]=agents[_0x512aa6[_0x5dd3('0x40')]][_0x5dd3('0x47')];transfers[_0x512aa6[_0x5dd3('0x4c')]][_0x5dd3('0x48')]=agents[_0x512aa6[_0x5dd3('0x40')]][_0x5dd3('0x48')];transfers[_0x512aa6['transfertargetuniqueid']][_0x5dd3('0x13')]=utils[_0x5dd3('0x14')]();transfers[_0x512aa6['transfertargetuniqueid']][_0x5dd3('0x2c')]=utils['now']();transfers[_0x512aa6[_0x5dd3('0x4c')]][_0x5dd3('0x21')]=0x0;transfers[_0x512aa6['transfertargetuniqueid']][_0x5dd3('0x45')]=0x2;}}}catch(_0x50f68b){utils['error'](util[_0x5dd3('0x2')](_0x5dd3('0x3f'),_0x512aa6['origtransfereruniqueid']),_0x50f68b);}};exports[_0x5dd3('0x4d')]=function(_0xc1a51b){try{utils[_0x5dd3('0x12')](util[_0x5dd3('0x2')](_0x5dd3('0x4e'),_0xc1a51b[_0x5dd3('0x3')]),_0xc1a51b);if(agents[_0xc1a51b['uniqueid']]&&agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x20')]===_0x5dd3('0x1f')){if(_0xc1a51b['cause']==='21'){agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x20')]=_0x5dd3('0x4f');agents[_0xc1a51b[_0x5dd3('0x3')]]['lastevent']=_0x5dd3('0x4f');}utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')](_0x5dd3('0x50'),_0xc1a51b[_0x5dd3('0x3')],agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x6')],agents[_0xc1a51b[_0x5dd3('0x3')]]['reason'],agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x9')]));writeDB(agents[_0xc1a51b[_0x5dd3('0x3')]]);var _0x569e5f=unanswered['indexOf'](_0xc1a51b[_0x5dd3('0x3')]);if(_0x569e5f>-0x1){unanswered[_0x5dd3('0x51')](_0x569e5f,0x1);}}if(transfers[_0xc1a51b['uniqueid']]){transfers[_0xc1a51b[_0x5dd3('0x3')]]['agentcomplete']=!![];transfers[_0xc1a51b[_0x5dd3('0x3')]]['agentcompleteAt']=utils[_0x5dd3('0x14')]();transfers[_0xc1a51b['uniqueid']][_0x5dd3('0x23')]=utils[_0x5dd3('0x34')](transfers[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x33')],transfers[_0xc1a51b[_0x5dd3('0x3')]]['agentconnectAt']);transfers[_0xc1a51b['uniqueid']]['reason']='agent';transfers[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x9')]=_0x5dd3('0x35');utils['info'](util[_0x5dd3('0x2')](_0x5dd3('0x50'),_0xc1a51b[_0x5dd3('0x3')],transfers[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x6')],transfers[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x20')],transfers[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x9')]));writeDB(transfers[_0xc1a51b['uniqueid']],!![]);}if(agents[_0xc1a51b['uniqueid']]&&agents[_0xc1a51b['uniqueid']][_0x5dd3('0x2c')]){agents[_0xc1a51b['uniqueid']][_0x5dd3('0xe')]=!![];agents[_0xc1a51b[_0x5dd3('0x3')]]['agentcompleteAt']=utils[_0x5dd3('0x14')]();agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x23')]=utils['diffTime'](agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x33')],agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x2c')]);agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x20')]=agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x39')]?_0x5dd3('0x39'):'agent';agents[_0xc1a51b['uniqueid']]['lastevent']='complete';utils[_0x5dd3('0x1')](util[_0x5dd3('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xc1a51b['uniqueid'],agents[_0xc1a51b['uniqueid']][_0x5dd3('0x6')],agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x20')],agents[_0xc1a51b[_0x5dd3('0x3')]][_0x5dd3('0x9')]));writeDB(agents[_0xc1a51b[_0x5dd3('0x3')]]);}}catch(_0x4d3c10){utils['error'](util[_0x5dd3('0x2')]('[%s][agents][hangup]',_0xc1a51b[_0x5dd3('0x3')]),_0x4d3c10);}}; \ No newline at end of file +var _0x7d3b=['complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','isNil','agentringnoanswer','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','agentconnectAt','connect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0x5a474d,_0x3c85e2){var _0x512f2a=function(_0x2f6669){while(--_0x2f6669){_0x5a474d['push'](_0x5a474d['shift']());}};_0x512f2a(++_0x3c85e2);}(_0x7d3b,0xc8));var _0xb7d3=function(_0x397043,_0x3dadc3){_0x397043=_0x397043-0x0;var _0x56e6a7=_0x7d3b[_0x397043];return _0x56e6a7;};'use strict';var _=require(_0xb7d3('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x30bdf2,_0x36b0b5){utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')](_0xb7d3('0x3'),_0x30bdf2[_0xb7d3('0x4')],_0x30bdf2['channel'],_0x30bdf2['queue'],_0x30bdf2['membername'],_0x30bdf2[_0xb7d3('0x5')],_0x30bdf2[_0xb7d3('0x6')],_0x30bdf2[_0xb7d3('0x7')],_0x30bdf2[_0xb7d3('0x8')]));if(_0x30bdf2[_0xb7d3('0x9')]){utils['getVoiceQueueByName'](_0x30bdf2['queue'])[_0xb7d3('0xa')](function(_0x1f40a9){if(_0x1f40a9){_0x30bdf2[_0xb7d3('0xb')]=_0x1f40a9[_0xb7d3('0xb')];_0x30bdf2[_0xb7d3('0xc')]=_0x30bdf2[_0xb7d3('0xd')]?_0x1f40a9[_0xb7d3('0xe')]:![];_0x30bdf2[_0xb7d3('0xf')]=_0x30bdf2[_0xb7d3('0xc')]?_0x1f40a9[_0xb7d3('0x10')]:0x0;}utils[_0xb7d3('0x11')](_0xb7d3('0x12'),_0x30bdf2);});}else{utils['request'](_0xb7d3('0x12'),_0x30bdf2);}if(_0x36b0b5){delete transfers[_0x30bdf2[_0xb7d3('0x4')]];}else{delete agents[_0x30bdf2['destuniqueid']];}}exports[_0xb7d3('0x13')]=function(_0x3a7d5e){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x2')](_0xb7d3('0x15'),_0x3a7d5e[_0xb7d3('0x4')]),_0x3a7d5e);agents[_0x3a7d5e[_0xb7d3('0x16')]]=_0x3a7d5e;agents[_0x3a7d5e[_0xb7d3('0x16')]][_0xb7d3('0x17')]=utils[_0xb7d3('0x18')]();agents[_0x3a7d5e[_0xb7d3('0x16')]][_0xb7d3('0x8')]=_0xb7d3('0x19');agents[_0x3a7d5e[_0xb7d3('0x16')]][_0xb7d3('0x7')]=null;agents[_0x3a7d5e[_0xb7d3('0x16')]][_0xb7d3('0x1a')]=null;utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')](_0xb7d3('0x1b'),_0x3a7d5e[_0xb7d3('0x4')],agents[_0x3a7d5e[_0xb7d3('0x16')]][_0xb7d3('0x1c')],_0x3a7d5e[_0xb7d3('0x16')]));}catch(_0x2df484){utils[_0xb7d3('0x1d')](util[_0xb7d3('0x2')](_0xb7d3('0x15'),_0x3a7d5e[_0xb7d3('0x4')]),_0x2df484);}};exports['agentringnoanswer']=function(_0x25bc71){try{if(!_[_0xb7d3('0x1e')](agents[_0x25bc71[_0xb7d3('0x16')]])){utils[_0xb7d3('0x14')](util['format']('[%s][agents][agentringnoanswer]',_0x25bc71[_0xb7d3('0x4')]),_0x25bc71);utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x25bc71[_0xb7d3('0x4')],agents[_0x25bc71[_0xb7d3('0x16')]][_0xb7d3('0x1c')],_0x25bc71[_0xb7d3('0x16')]));agents[_0x25bc71[_0xb7d3('0x16')]][_0xb7d3('0x1f')]=!![];agents[_0x25bc71['destuniqueid']]['agentringnoanswerAt']=utils[_0xb7d3('0x18')]();agents[_0x25bc71[_0xb7d3('0x16')]]['lastevent']=_0xb7d3('0x20');agents[_0x25bc71[_0xb7d3('0x16')]][_0xb7d3('0x21')]=_0xb7d3('0x20');agents[_0x25bc71['destuniqueid']][_0xb7d3('0x22')]=_0x25bc71[_0xb7d3('0x23')]?parseInt(_0x25bc71[_0xb7d3('0x23')])/0x3e8:0x0;agents[_0x25bc71['destuniqueid']][_0xb7d3('0x24')]=0x0;unanswered['push'](_0x25bc71[_0xb7d3('0x16')]);}}catch(_0x58cea1){utils['error'](util[_0xb7d3('0x2')]('[%s][agents][agentringnoanswer]',_0x25bc71[_0xb7d3('0x4')]),_0x58cea1);}};exports[_0xb7d3('0x25')]=function(_0x1af65f){try{_[_0xb7d3('0x26')](agents,function(_0x1befa7,_0x286d59){if(_0x1befa7[_0xb7d3('0x4')]==_0x1af65f['uniqueid']&&!_['includes'](unanswered,_0x1befa7[_0xb7d3('0x16')])){utils[_0xb7d3('0x14')](util[_0xb7d3('0x2')](_0xb7d3('0x27'),_0x1af65f[_0xb7d3('0x4')]),_0x1af65f);utils[_0xb7d3('0x1')](util['format'](_0xb7d3('0x28'),_0x1af65f[_0xb7d3('0x4')],_0x1befa7[_0xb7d3('0x1c')],_0x1befa7['destuniqueid']));_0x1befa7[_0xb7d3('0x1f')]=!![];_0x1befa7['agentringnoanswerAt']=utils[_0xb7d3('0x18')]();_0x1befa7[_0xb7d3('0x8')]=_0xb7d3('0x29');_0x1befa7[_0xb7d3('0x21')]=_0xb7d3('0x29');_0x1befa7[_0xb7d3('0x22')]=_0x1af65f[_0xb7d3('0x22')];_0x1befa7[_0xb7d3('0x24')]=0x0;writeDB(_0x1befa7);}});}catch(_0x143fcf){utils[_0xb7d3('0x1d')](util['format'](_0xb7d3('0x27'),_0x1af65f['uniqueid']),_0x143fcf);}};exports['agentconnect']=function(_0x32fedf){try{if(agents[_0x32fedf[_0xb7d3('0x16')]]){utils['debug'](util[_0xb7d3('0x2')](_0xb7d3('0x2a'),_0x32fedf['uniqueid']),_0x32fedf);utils['info'](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x32fedf['uniqueid'],agents[_0x32fedf[_0xb7d3('0x16')]][_0xb7d3('0x1c')],_0x32fedf[_0xb7d3('0x16')]));agents[_0x32fedf[_0xb7d3('0x16')]][_0xb7d3('0x2b')]=utils[_0xb7d3('0x18')]();agents[_0x32fedf[_0xb7d3('0x16')]][_0xb7d3('0x7')]=_0x32fedf[_0xb7d3('0x7')];agents[_0x32fedf[_0xb7d3('0x16')]][_0xb7d3('0x1a')]=_0x32fedf[_0xb7d3('0x1a')];agents[_0x32fedf[_0xb7d3('0x16')]]['holdtime']=_0x32fedf[_0xb7d3('0x23')];agents[_0x32fedf['destuniqueid']][_0xb7d3('0x8')]=_0xb7d3('0x2c');_[_0xb7d3('0x26')](agents,function(_0x5e4e16,_0x22220a){if(_0x5e4e16[_0xb7d3('0x16')]!=_0x32fedf['destuniqueid']&&_0x5e4e16[_0xb7d3('0x4')]==_0x32fedf[_0xb7d3('0x4')]){_0x5e4e16[_0xb7d3('0x24')]=0x0;_0x5e4e16[_0xb7d3('0x22')]=_0x32fedf[_0xb7d3('0x23')];_0x5e4e16['agentringnoanswer']=!![];_0x5e4e16[_0xb7d3('0x2d')]=utils[_0xb7d3('0x18')]();_0x5e4e16[_0xb7d3('0x8')]='answered_elsewhere';_0x5e4e16[_0xb7d3('0x21')]='answered_elsewhere';_0x5e4e16[_0xb7d3('0x2e')]=_0x32fedf[_0xb7d3('0x16')];_0x5e4e16[_0xb7d3('0x2f')]=_0x32fedf[_0xb7d3('0x1c')];writeDB(_0x5e4e16);}});}}catch(_0xce7ee0){utils[_0xb7d3('0x1d')](util['format']('[%s][agents][agentconnect]',_0x32fedf[_0xb7d3('0x4')]),_0xce7ee0);}};exports['agentcomplete']=function(_0x32780f){try{if(!_[_0xb7d3('0x1e')](agents[_0x32780f[_0xb7d3('0x16')]])){utils[_0xb7d3('0x14')](util['format'](_0xb7d3('0x30'),_0x32780f['uniqueid']),_0x32780f);utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')](_0xb7d3('0x31'),_0x32780f['uniqueid'],agents[_0x32780f['destuniqueid']][_0xb7d3('0x1c')],_0x32780f[_0xb7d3('0x16')]));agents[_0x32780f[_0xb7d3('0x16')]]['agentcomplete']=!![];agents[_0x32780f[_0xb7d3('0x16')]][_0xb7d3('0x32')]=utils['now']();agents[_0x32780f[_0xb7d3('0x16')]][_0xb7d3('0x24')]=utils[_0xb7d3('0x33')](agents[_0x32780f['destuniqueid']][_0xb7d3('0x32')],agents[_0x32780f[_0xb7d3('0x16')]][_0xb7d3('0x2b')]);agents[_0x32780f[_0xb7d3('0x16')]][_0xb7d3('0x21')]=_0x32780f['reason'];agents[_0x32780f[_0xb7d3('0x16')]][_0xb7d3('0x8')]=_0xb7d3('0x34');writeDB(agents[_0x32780f[_0xb7d3('0x16')]]);}}catch(_0x46f82b){utils[_0xb7d3('0x1d')](util['format'](_0xb7d3('0x30'),_0x32780f[_0xb7d3('0x4')]),_0x46f82b);}};exports[_0xb7d3('0x35')]=function(_0x1b65bd){try{if(!_['isNil'](agents[_0x1b65bd['transfereruniqueid']])){utils[_0xb7d3('0x14')](util['format'](_0xb7d3('0x36'),_0x1b65bd['uniqueid']),_0x1b65bd);utils[_0xb7d3('0x1')](util['format'](_0xb7d3('0x37'),_0x1b65bd[_0xb7d3('0x4')],agents[_0x1b65bd['transfereruniqueid']][_0xb7d3('0x1c')],agents[_0x1b65bd[_0xb7d3('0x38')]][_0xb7d3('0x4')]));agents[_0x1b65bd[_0xb7d3('0x38')]][_0xb7d3('0x39')]=!![];agents[_0x1b65bd[_0xb7d3('0x38')]]['transfertype']=_0xb7d3('0x3a');agents[_0x1b65bd[_0xb7d3('0x38')]][_0xb7d3('0x3b')]=_0x1b65bd[_0xb7d3('0x3c')];agents[_0x1b65bd[_0xb7d3('0x38')]][_0xb7d3('0x3d')]=agents[_0x1b65bd['transfereruniqueid']][_0xb7d3('0x4')];}}catch(_0x41f85f){utils[_0xb7d3('0x1d')](util[_0xb7d3('0x2')]('[%s][agents][blindtransfer]',_0x1b65bd[_0xb7d3('0x4')]),_0x41f85f);}};exports[_0xb7d3('0x3e')]=function(_0x5ae4f7){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x2')](_0xb7d3('0x3f'),_0x5ae4f7[_0xb7d3('0x40')]),_0x5ae4f7);if(_0x5ae4f7['origtransfereruniqueid']==_0x5ae4f7['origtransfererlinkedid']){if(!_[_0xb7d3('0x1e')](agents[_0x5ae4f7[_0xb7d3('0x41')]])){utils[_0xb7d3('0x1')](util['format'](_0xb7d3('0x42'),_0x5ae4f7[_0xb7d3('0x40')],agents[_0x5ae4f7[_0xb7d3('0x41')]]['membername']));agents[_0x5ae4f7['secondtransfereruniqueid']][_0xb7d3('0x39')]=!![];agents[_0x5ae4f7[_0xb7d3('0x41')]][_0xb7d3('0x43')]=_0xb7d3('0x44');agents[_0x5ae4f7['secondtransfereruniqueid']][_0xb7d3('0x3b')]=_0x5ae4f7[_0xb7d3('0x45')];agents[_0x5ae4f7[_0xb7d3('0x41')]][_0xb7d3('0x3d')]=_0x5ae4f7[_0xb7d3('0x40')];}if(_0x5ae4f7[_0xb7d3('0x46')]&&agents[_0x5ae4f7[_0xb7d3('0x46')]]){agents[_0x5ae4f7[_0xb7d3('0x46')]]['agententerreason']=0x1;transfers[_0x5ae4f7[_0xb7d3('0x46')]]=_[_0xb7d3('0x47')](agents[_0x5ae4f7[_0xb7d3('0x46')]]);transfers[_0x5ae4f7['transfereeuniqueid']][_0xb7d3('0x6')]=agents[_0x5ae4f7[_0xb7d3('0x41')]][_0xb7d3('0x6')];transfers[_0x5ae4f7[_0xb7d3('0x46')]][_0xb7d3('0x48')]=agents[_0x5ae4f7['secondtransfereruniqueid']]['calleridname'];transfers[_0x5ae4f7[_0xb7d3('0x46')]][_0xb7d3('0x17')]=utils[_0xb7d3('0x18')]();transfers[_0x5ae4f7[_0xb7d3('0x46')]][_0xb7d3('0x2b')]=utils[_0xb7d3('0x18')]();transfers[_0x5ae4f7['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x5ae4f7[_0xb7d3('0x46')]][_0xb7d3('0x49')]=0x2;}}else if(_0x5ae4f7[_0xb7d3('0x41')]==_0x5ae4f7[_0xb7d3('0x4a')]){if(!_[_0xb7d3('0x1e')](agents[_0x5ae4f7[_0xb7d3('0x40')]])){utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ae4f7[_0xb7d3('0x40')],agents[_0x5ae4f7[_0xb7d3('0x40')]][_0xb7d3('0x1c')]));agents[_0x5ae4f7[_0xb7d3('0x40')]][_0xb7d3('0x39')]=!![];agents[_0x5ae4f7[_0xb7d3('0x40')]]['transfertype']='ATTENDED';agents[_0x5ae4f7['origtransfereruniqueid']][_0xb7d3('0x3b')]=_0x5ae4f7[_0xb7d3('0x4b')];agents[_0x5ae4f7[_0xb7d3('0x40')]][_0xb7d3('0x3d')]=_0x5ae4f7['secondtransfereruniqueid'];}if(_0x5ae4f7[_0xb7d3('0x4c')]&&agents[_0x5ae4f7[_0xb7d3('0x4c')]]){agents[_0x5ae4f7[_0xb7d3('0x4c')]][_0xb7d3('0x49')]=0x1;transfers[_0x5ae4f7[_0xb7d3('0x4c')]]=_[_0xb7d3('0x47')](agents[_0x5ae4f7[_0xb7d3('0x4c')]]);transfers[_0x5ae4f7['transfertargetuniqueid']]['calleridnum']=agents[_0x5ae4f7['origtransfereruniqueid']][_0xb7d3('0x6')];transfers[_0x5ae4f7['transfertargetuniqueid']]['calleridname']=agents[_0x5ae4f7[_0xb7d3('0x40')]][_0xb7d3('0x48')];transfers[_0x5ae4f7[_0xb7d3('0x4c')]][_0xb7d3('0x17')]=utils[_0xb7d3('0x18')]();transfers[_0x5ae4f7[_0xb7d3('0x4c')]][_0xb7d3('0x2b')]=utils[_0xb7d3('0x18')]();transfers[_0x5ae4f7[_0xb7d3('0x4c')]][_0xb7d3('0x22')]=0x0;transfers[_0x5ae4f7[_0xb7d3('0x4c')]]['agententerreason']=0x2;}}}catch(_0x49e754){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x5ae4f7[_0xb7d3('0x40')]),_0x49e754);}};exports[_0xb7d3('0x4d')]=function(_0x3da76b){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x2')](_0xb7d3('0x4e'),_0x3da76b[_0xb7d3('0x4')]),_0x3da76b);if(agents[_0x3da76b[_0xb7d3('0x4')]]&&agents[_0x3da76b[_0xb7d3('0x4')]]['reason']===_0xb7d3('0x20')){if(_0x3da76b[_0xb7d3('0x4f')]==='21'){agents[_0x3da76b['uniqueid']][_0xb7d3('0x21')]=_0xb7d3('0x50');agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x8')]=_0xb7d3('0x50');}utils['info'](util[_0xb7d3('0x2')](_0xb7d3('0x51'),_0x3da76b['uniqueid'],agents[_0x3da76b[_0xb7d3('0x4')]]['membername'],agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x21')],agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x8')]));writeDB(agents[_0x3da76b[_0xb7d3('0x4')]]);var _0x41cf59=unanswered[_0xb7d3('0x52')](_0x3da76b[_0xb7d3('0x4')]);if(_0x41cf59>-0x1){unanswered['splice'](_0x41cf59,0x1);}}if(transfers[_0x3da76b[_0xb7d3('0x4')]]){transfers[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0xd')]=!![];transfers[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x32')]=utils[_0xb7d3('0x18')]();transfers[_0x3da76b['uniqueid']][_0xb7d3('0x24')]=utils[_0xb7d3('0x33')](transfers[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x32')],transfers[_0x3da76b['uniqueid']][_0xb7d3('0x2b')]);transfers[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x21')]='agent';transfers[_0x3da76b['uniqueid']][_0xb7d3('0x8')]=_0xb7d3('0x34');utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')](_0xb7d3('0x51'),_0x3da76b[_0xb7d3('0x4')],transfers[_0x3da76b['uniqueid']][_0xb7d3('0x1c')],transfers[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x21')],transfers[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x8')]));writeDB(transfers[_0x3da76b[_0xb7d3('0x4')]],!![]);}if(agents[_0x3da76b[_0xb7d3('0x4')]]&&agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x2b')]){agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0xd')]=!![];agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x32')]=utils[_0xb7d3('0x18')]();agents[_0x3da76b[_0xb7d3('0x4')]]['talktime']=utils[_0xb7d3('0x33')](agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x32')],agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x2b')]);agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x21')]=agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x39')]?_0xb7d3('0x39'):_0xb7d3('0x53');agents[_0x3da76b['uniqueid']][_0xb7d3('0x8')]='complete';utils[_0xb7d3('0x1')](util[_0xb7d3('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3da76b[_0xb7d3('0x4')],agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x1c')],agents[_0x3da76b[_0xb7d3('0x4')]]['reason'],agents[_0x3da76b[_0xb7d3('0x4')]][_0xb7d3('0x8')]));writeDB(agents[_0x3da76b[_0xb7d3('0x4')]]);}}catch(_0x2e4697){utils[_0xb7d3('0x1d')](util[_0xb7d3('0x2')](_0xb7d3('0x4e'),_0x3da76b['uniqueid']),_0x2e4697);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 26f06c2..2e8a240 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 _0x7721=['toLowerCase','cdr','appdata','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x7721,0xd9));var _0x1772=function(_0x211565,_0x42bcfd){_0x211565=_0x211565-0x0;var _0x1361fa=_0x7721[_0x211565];return _0x1361fa;};'use strict';var _=require(_0x1772('0x0'));var util=require(_0x1772('0x1'));var utils=require(_0x1772('0x2'));var dispositions=['NO\x20ANSWER',_0x1772('0x3'),_0x1772('0x3'),_0x1772('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x1772('0x5'),'BUSY','FAILED',_0x1772('0x3'),_0x1772('0x3')];var channels={};function writeDB(_0x2638b4){utils[_0x1772('0x6')](util[_0x1772('0x7')](_0x1772('0x8'),_0x2638b4[_0x1772('0x9')],_0x2638b4[_0x1772('0xa')],_0x2638b4[_0x1772('0xb')],_0x2638b4['membername'],_0x2638b4[_0x1772('0xc')],_0x2638b4[_0x1772('0xd')],_0x2638b4[_0x1772('0xe')],_0x2638b4['lastevent']));if(_0x2638b4[_0x1772('0xf')]){utils[_0x1772('0x10')](_0x2638b4[_0x1772('0xf')])['then'](function(_0x21430d){if(_0x21430d){_0x2638b4[_0x1772('0x11')]=_0x21430d['id'];}utils['request'](_0x1772('0x12'),_0x2638b4);});}else{utils[_0x1772('0x13')](_0x1772('0x12'),_0x2638b4);}if(channels[_0x2638b4[_0x1772('0x9')]]){delete channels[_0x2638b4[_0x1772('0x9')]];}}exports[_0x1772('0x14')]=function(_0x44cd90){try{utils[_0x1772('0x15')](util['format'](_0x1772('0x16'),_0x44cd90[_0x1772('0x9')]),_0x44cd90);if(_0x44cd90[_0x1772('0x9')]==_0x44cd90['linkedid']&&_0x44cd90[_0x1772('0xa')]!='OutgoingSpoolFailed'){utils[_0x1772('0x6')](util[_0x1772('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x44cd90['uniqueid'],_0x44cd90[_0x1772('0x17')],_0x44cd90['exten']));channels[_0x44cd90[_0x1772('0x9')]]={'uniqueid':_0x44cd90['uniqueid'],'accountcode':_0x44cd90[_0x1772('0xf')],'source':_0x44cd90[_0x1772('0xd')],'destination':_0x44cd90[_0x1772('0x18')],'destinationcontext':_0x44cd90[_0x1772('0x17')],'channel':_0x44cd90['channel'],'starttime':utils[_0x1772('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1772('0x4'),'amaflags':_0x1772('0x1a')};}}catch(_0xdafa80){utils['error'](util[_0x1772('0x7')](_0x1772('0x16'),_0x44cd90[_0x1772('0x9')]),_0xdafa80);}};exports[_0x1772('0x1b')]=function(_0x365416){try{utils[_0x1772('0x15')](util[_0x1772('0x7')](_0x1772('0x1c'),_0x365416[_0x1772('0x9')]),_0x365416);if(!_['isNil'](channels[_0x365416[_0x1772('0x9')]])&&_0x365416['channelstate']==0x6){utils['info'](util['format'](_0x1772('0x1d'),_0x365416[_0x1772('0x9')],_0x365416['context'],_0x365416[_0x1772('0xa')]));if(_['isNil'](channels[_0x365416[_0x1772('0x9')]]['systemanswertime'])){channels[_0x365416[_0x1772('0x9')]][_0x1772('0x1e')]=utils[_0x1772('0x19')]();}}else if(!_[_0x1772('0x1f')](channels[_0x365416[_0x1772('0x20')]])&&_0x365416[_0x1772('0x21')]==0x6&&_0x365416['context']!=_0x1772('0x22')){utils['info'](util['format'](_0x1772('0x23'),_0x365416['uniqueid'],_0x365416[_0x1772('0x20')],_0x365416[_0x1772('0x17')],_0x365416[_0x1772('0xa')]));channels[_0x365416[_0x1772('0x20')]]['accountcode']=_0x365416['accountcode'];channels[_0x365416[_0x1772('0x20')]][_0x1772('0x24')]=_0x365416['channel'];if(_['isNil'](channels[_0x365416['linkedid']][_0x1772('0x25')])){channels[_0x365416['linkedid']]['answertime']=utils[_0x1772('0x19')]();}channels[_0x365416[_0x1772('0x20')]][_0x1772('0x26')]=dispositions[_['toNumber'](_0x365416[_0x1772('0x21')])]||_0x1772('0x5');}}catch(_0x4b6c94){utils[_0x1772('0x27')](util[_0x1772('0x7')](_0x1772('0x1c'),_0x365416[_0x1772('0x9')]),_0x4b6c94);}};exports[_0x1772('0x28')]=function(_0x4662ce){try{if(!_[_0x1772('0x1f')](channels[_0x4662ce[_0x1772('0x9')]])){utils[_0x1772('0x15')](util['format'](_0x1772('0x29'),_0x4662ce['uniqueid']),_0x4662ce);if(_[_0x1772('0x1f')](channels[_0x4662ce[_0x1772('0x9')]][_0x1772('0x2a')])){channels[_0x4662ce[_0x1772('0x9')]]['callerid']=_0x4662ce[_0x1772('0x2b')]+'\x20<'+_0x4662ce['calleridnum']+'>';}utils[_0x1772('0x6')](util[_0x1772('0x7')](_0x1772('0x2c'),_0x4662ce[_0x1772('0x9')],channels[_0x4662ce[_0x1772('0x9')]][_0x1772('0x2a')],_0x4662ce[_0x1772('0x2d')]));channels[_0x4662ce['uniqueid']][_0x1772('0x2e')]=utils['now']();channels[_0x4662ce['uniqueid']][_0x1772('0x2f')]=utils[_0x1772('0x30')](channels[_0x4662ce[_0x1772('0x9')]][_0x1772('0x2e')],channels[_0x4662ce[_0x1772('0x9')]][_0x1772('0x31')]);channels[_0x4662ce[_0x1772('0x9')]][_0x1772('0x32')]=channels[_0x4662ce['uniqueid']]['answertime']?utils['diffTime'](channels[_0x4662ce[_0x1772('0x9')]]['endtime'],channels[_0x4662ce[_0x1772('0x9')]][_0x1772('0x25')]):0x0;writeDB(channels[_0x4662ce['uniqueid']]);}}catch(_0x25fa56){utils[_0x1772('0x27')](util['format'](_0x1772('0x29'),_0x4662ce['uniqueid']),_0x25fa56);}};exports[_0x1772('0x33')]=function(_0x2d65d8){try{if(!_[_0x1772('0x1f')](channels[_0x2d65d8[_0x1772('0x34')]])){utils['debug'](util[_0x1772('0x7')]('[%s][calls][attendedtransfer]',_0x2d65d8[_0x1772('0x35')]),_0x2d65d8);if(channels[_0x2d65d8[_0x1772('0x34')]][_0x1772('0xa')]==_0x2d65d8[_0x1772('0x36')]){utils['info'](util[_0x1772('0x7')](_0x1772('0x37'),_0x2d65d8[_0x1772('0x35')],_0x2d65d8[_0x1772('0x34')],_0x2d65d8['secondtransfererchannel']));channels[_0x2d65d8['localtwolinkedid']]['destinationchannel']=_0x2d65d8[_0x1772('0x38')];channels[_0x2d65d8[_0x1772('0x34')]][_0x1772('0x39')]=_0x1772('0x3a');}else if(channels[_0x2d65d8[_0x1772('0x34')]]['channel']=_0x2d65d8['transfertargetchannel']){utils[_0x1772('0x6')](util[_0x1772('0x7')](_0x1772('0x37'),_0x2d65d8[_0x1772('0x35')],_0x2d65d8[_0x1772('0x34')],_0x2d65d8['origtransfererchannel']));channels[_0x2d65d8[_0x1772('0x34')]][_0x1772('0x24')]=_0x2d65d8['origtransfererchannel'];channels[_0x2d65d8[_0x1772('0x34')]]['userfield']=_0x1772('0x3a');}}}catch(_0x1f2de5){utils[_0x1772('0x27')](util[_0x1772('0x7')](_0x1772('0x3b'),_0x2d65d8[_0x1772('0x35')]),_0x1f2de5);}};exports[_0x1772('0x3c')]=function(_0x48436b){try{if(!_[_0x1772('0x1f')](channels[_0x48436b[_0x1772('0x9')]])){utils[_0x1772('0x15')](util[_0x1772('0x7')]('[%s][calls][musiconholdstart]',_0x48436b[_0x1772('0x9')]),_0x48436b);channels[_0x48436b[_0x1772('0x9')]]['musiconholdstartAt']=utils[_0x1772('0x19')]();utils[_0x1772('0x6')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x48436b[_0x1772('0x9')],channels[_0x48436b['uniqueid']][_0x1772('0x3d')]));}}catch(_0x3ca45e){utils[_0x1772('0x27')](util['format'](_0x1772('0x3e'),_0x48436b[_0x1772('0x9')]),_0x3ca45e);}};exports['musiconholdstop']=function(_0x30d4b1){try{if(!_['isNil'](channels[_0x30d4b1[_0x1772('0x9')]])){utils[_0x1772('0x15')](util[_0x1772('0x7')](_0x1772('0x3f'),_0x30d4b1['uniqueid']),_0x30d4b1);if(!_[_0x1772('0x1f')](channels[_0x30d4b1[_0x1772('0x9')]][_0x1772('0x3d')])){channels[_0x30d4b1['uniqueid']]['mohtime']+=utils[_0x1772('0x30')](utils[_0x1772('0x19')](),channels[_0x30d4b1[_0x1772('0x9')]][_0x1772('0x3d')]);utils[_0x1772('0x6')](util[_0x1772('0x7')](_0x1772('0x40'),_0x30d4b1[_0x1772('0x9')],channels[_0x30d4b1[_0x1772('0x9')]][_0x1772('0x41')]));delete channels[_0x30d4b1[_0x1772('0x9')]][_0x1772('0x3d')];}}}catch(_0x26ab23){utils[_0x1772('0x27')](util[_0x1772('0x7')](_0x1772('0x3f'),_0x30d4b1[_0x1772('0x9')]),_0x26ab23);}};exports['varset']=function(_0x22ce93){try{if(!_['isNil'](channels[_0x22ce93[_0x1772('0x9')]])){utils[_0x1772('0x15')](util[_0x1772('0x7')](_0x1772('0x42'),_0x22ce93[_0x1772('0x9')]),_0x22ce93);if(!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x44')])){utils[_0x1772('0x6')](util['format'](_0x1772('0x45'),_0x22ce93[_0x1772('0x9')],_0x22ce93[_0x1772('0x46')]));channels[_0x22ce93[_0x1772('0x9')]][_0x1772('0x47')]=_0x22ce93[_0x1772('0x46')];}if(!_[_0x1772('0x1f')](_0x22ce93['variable'][_0x1772('0x48')])){utils[_0x1772('0x6')](util['format'](_0x1772('0x49'),_0x22ce93['uniqueid'],_0x22ce93['value']));channels[_0x22ce93[_0x1772('0x9')]][_0x1772('0x4a')]=_0x22ce93[_0x1772('0x46')];channels[_0x22ce93['uniqueid']][_0x1772('0x2a')]='\x22'+_0x22ce93[_0x1772('0x46')]+_0x1772('0x4b')+_0x22ce93['value']+'>';}if(!_['isNil'](_0x22ce93[_0x1772('0x43')][_0x1772('0x4c')])||!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x4d')])){utils[_0x1772('0x6')](util[_0x1772('0x7')](_0x1772('0x4e'),_0x22ce93[_0x1772('0x9')],!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x4c')])?_0x1772('0x4c'):'xmd-callerid',_0x22ce93[_0x1772('0x46')]));channels[_0x22ce93[_0x1772('0x9')]]['callerid']=_0x22ce93[_0x1772('0x46')];}if(!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x4f')])||!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x50')])){utils[_0x1772('0x6')](util['format'](_0x1772('0x4e'),_0x22ce93[_0x1772('0x9')],!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')]['xmd-queue'])?_0x1772('0x4f'):'xmcs-queue',_0x22ce93['value']));channels[_0x22ce93['uniqueid']][_0x1772('0x51')]=_0x1772('0x52');channels[_0x22ce93[_0x1772('0x9')]]['lastdata']=_0x22ce93[_0x1772('0x46')];channels[_0x22ce93[_0x1772('0x9')]][_0x1772('0xb')]=!![];}if(!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')]['xmd-contactid'])){utils[_0x1772('0x6')](util[_0x1772('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x22ce93[_0x1772('0x9')],_0x22ce93[_0x1772('0x46')]));channels[_0x22ce93['uniqueid']][_0x1772('0x53')]=_0x22ce93[_0x1772('0x46')];}if(!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x54')])){utils['info'](util[_0x1772('0x7')](_0x1772('0x55'),_0x22ce93['uniqueid'],_0x22ce93[_0x1772('0x46')]));channels[_0x22ce93[_0x1772('0x9')]][_0x1772('0x56')]=_0x22ce93[_0x1772('0x46')];}if(!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')][_0x1772('0x57')])){utils[_0x1772('0x6')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x22ce93[_0x1772('0x9')],_0x22ce93['value']));channels[_0x22ce93[_0x1772('0x9')]][_0x1772('0x58')]=_0x22ce93[_0x1772('0x46')];}if(!_[_0x1772('0x1f')](_0x22ce93[_0x1772('0x43')]['sipcallid'])){utils['info'](util[_0x1772('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x22ce93[_0x1772('0x9')],_0x22ce93[_0x1772('0x46')]));channels[_0x22ce93['uniqueid']][_0x1772('0x59')]=_0x22ce93[_0x1772('0x46')];}}}catch(_0x4c905a){utils['error'](util['format'](_0x1772('0x42'),_0x22ce93[_0x1772('0x9')]),_0x4c905a);}};exports[_0x1772('0x5a')]=function(_0x39f972){try{if(!_[_0x1772('0x1f')](channels[_0x39f972[_0x1772('0x9')]])){utils[_0x1772('0x15')](util[_0x1772('0x7')]('[%s][calls][newexten]',_0x39f972['uniqueid']),_0x39f972);utils[_0x1772('0x6')](util[_0x1772('0x7')](_0x1772('0x5b'),_0x39f972[_0x1772('0x9')],_0x39f972[_0x1772('0x5c')],_0x39f972['appdata']));if(_0x39f972[_0x1772('0x5c')]['toLowerCase']()==_0x1772('0x5d')&&_[_0x1772('0x5e')](_0x39f972['appdata'][_0x1772('0x5f')](),_0x1772('0x60'))){var _0x56f698=_0x39f972[_0x1772('0x61')]['split']('=');var _0x4a0be0=_0x56f698[0x0]['substring'](_0x56f698[0x0][_0x1772('0x62')]('(')+0x1,_0x56f698[0x0][_0x1772('0x62')](')'));var _0x24ad8e=_0x56f698[0x1];channels[_0x39f972[_0x1772('0x9')]][_0x4a0be0]=_0x24ad8e;}if(!_[_0x1772('0x63')]([_0x1772('0x28'),_0x1772('0x64'),_0x1772('0x65'),'set',_0x1772('0x66')],_0x39f972['application'][_0x1772('0x5f')]())){channels[_0x39f972['uniqueid']][_0x1772('0x51')]=_0x39f972[_0x1772('0x5c')];channels[_0x39f972['uniqueid']]['lastdata']=_0x39f972[_0x1772('0x61')];}}}catch(_0x189b14){utils[_0x1772('0x27')](util[_0x1772('0x7')](_0x1772('0x67'),_0x39f972[_0x1772('0x9')]),_0x189b14);}}; \ No newline at end of file +var _0x0502=['[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','lodash','util','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','endtime','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset'];(function(_0x52b8fc,_0x370c7f){var _0x4b0e7d=function(_0x714f22){while(--_0x714f22){_0x52b8fc['push'](_0x52b8fc['shift']());}};_0x4b0e7d(++_0x370c7f);}(_0x0502,0xfe));var _0x2050=function(_0x2cd333,_0x1fe3c6){_0x2cd333=_0x2cd333-0x0;var _0x2d0408=_0x0502[_0x2cd333];return _0x2d0408;};'use strict';var _=require(_0x2050('0x0'));var util=require(_0x2050('0x1'));var utils=require('./utils');var dispositions=[_0x2050('0x2'),_0x2050('0x3'),'FAILED',_0x2050('0x2'),_0x2050('0x2'),_0x2050('0x2'),'ANSWERED','BUSY',_0x2050('0x3'),_0x2050('0x3'),_0x2050('0x3')];var channels={};function writeDB(_0x295505){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x6'),_0x295505[_0x2050('0x7')],_0x295505[_0x2050('0x8')],_0x295505[_0x2050('0x9')],_0x295505[_0x2050('0xa')],_0x295505[_0x2050('0xb')],_0x295505[_0x2050('0xc')],_0x295505[_0x2050('0xd')],_0x295505[_0x2050('0xe')]));if(_0x295505[_0x2050('0xf')]){utils[_0x2050('0x10')](_0x295505[_0x2050('0xf')])[_0x2050('0x11')](function(_0x23c7a9){if(_0x23c7a9){_0x295505[_0x2050('0x12')]=_0x23c7a9['id'];}utils[_0x2050('0x13')](_0x2050('0x14'),_0x295505);});}else{utils[_0x2050('0x13')](_0x2050('0x14'),_0x295505);}if(channels[_0x295505[_0x2050('0x7')]]){delete channels[_0x295505[_0x2050('0x7')]];}}exports[_0x2050('0x15')]=function(_0x4166f4){try{utils[_0x2050('0x16')](util[_0x2050('0x5')](_0x2050('0x17'),_0x4166f4[_0x2050('0x7')]),_0x4166f4);if(_0x4166f4[_0x2050('0x7')]==_0x4166f4[_0x2050('0x18')]&&_0x4166f4['channel']!=_0x2050('0x19')){utils['info'](util[_0x2050('0x5')](_0x2050('0x1a'),_0x4166f4['uniqueid'],_0x4166f4[_0x2050('0x1b')],_0x4166f4[_0x2050('0x1c')]));channels[_0x4166f4[_0x2050('0x7')]]={'uniqueid':_0x4166f4['uniqueid'],'accountcode':_0x4166f4[_0x2050('0xf')],'source':_0x4166f4[_0x2050('0xc')],'destination':_0x4166f4[_0x2050('0x1c')],'destinationcontext':_0x4166f4[_0x2050('0x1b')],'channel':_0x4166f4[_0x2050('0x8')],'starttime':utils[_0x2050('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2050('0x1e')};}}catch(_0x9bafa0){utils[_0x2050('0x1f')](util[_0x2050('0x5')]('[%s][calls][newchannel]',_0x4166f4[_0x2050('0x7')]),_0x9bafa0);}};exports[_0x2050('0x20')]=function(_0x5ef3ce){try{utils[_0x2050('0x16')](util['format'](_0x2050('0x21'),_0x5ef3ce[_0x2050('0x7')]),_0x5ef3ce);if(!_[_0x2050('0x22')](channels[_0x5ef3ce[_0x2050('0x7')]])&&_0x5ef3ce['channelstate']==0x6){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x23'),_0x5ef3ce[_0x2050('0x7')],_0x5ef3ce[_0x2050('0x1b')],_0x5ef3ce[_0x2050('0x8')]));if(_['isNil'](channels[_0x5ef3ce['uniqueid']][_0x2050('0x24')])){channels[_0x5ef3ce['uniqueid']][_0x2050('0x24')]=utils['now']();}}else if(!_[_0x2050('0x22')](channels[_0x5ef3ce['linkedid']])&&_0x5ef3ce[_0x2050('0x25')]==0x6&&_0x5ef3ce[_0x2050('0x1b')]!='transfer'){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x26'),_0x5ef3ce[_0x2050('0x7')],_0x5ef3ce['linkedid'],_0x5ef3ce[_0x2050('0x1b')],_0x5ef3ce[_0x2050('0x8')]));channels[_0x5ef3ce[_0x2050('0x18')]][_0x2050('0xf')]=_0x5ef3ce[_0x2050('0xf')];channels[_0x5ef3ce[_0x2050('0x18')]][_0x2050('0x27')]=_0x5ef3ce['channel'];if(_[_0x2050('0x22')](channels[_0x5ef3ce[_0x2050('0x18')]][_0x2050('0x28')])){channels[_0x5ef3ce['linkedid']][_0x2050('0x28')]=utils[_0x2050('0x1d')]();}channels[_0x5ef3ce[_0x2050('0x18')]][_0x2050('0x29')]=dispositions[_[_0x2050('0x2a')](_0x5ef3ce[_0x2050('0x25')])]||_0x2050('0x2b');}}catch(_0x2c9964){utils[_0x2050('0x1f')](util['format'](_0x2050('0x21'),_0x5ef3ce['uniqueid']),_0x2c9964);}};exports[_0x2050('0x2c')]=function(_0x168a8b){try{if(!_[_0x2050('0x22')](channels[_0x168a8b[_0x2050('0x7')]])){utils[_0x2050('0x16')](util[_0x2050('0x5')]('[%s][calls][hangup]',_0x168a8b[_0x2050('0x7')]),_0x168a8b);if(_[_0x2050('0x22')](channels[_0x168a8b['uniqueid']]['callerid'])){channels[_0x168a8b[_0x2050('0x7')]][_0x2050('0x2d')]=_0x168a8b[_0x2050('0x2e')]+'\x20<'+_0x168a8b[_0x2050('0xc')]+'>';}utils['info'](util[_0x2050('0x5')](_0x2050('0x2f'),_0x168a8b[_0x2050('0x7')],channels[_0x168a8b[_0x2050('0x7')]][_0x2050('0x2d')],_0x168a8b['cause-txt']));channels[_0x168a8b[_0x2050('0x7')]]['endtime']=utils[_0x2050('0x1d')]();channels[_0x168a8b[_0x2050('0x7')]][_0x2050('0x30')]=utils['diffTime'](channels[_0x168a8b['uniqueid']][_0x2050('0x31')],channels[_0x168a8b[_0x2050('0x7')]][_0x2050('0x32')]);channels[_0x168a8b['uniqueid']][_0x2050('0x33')]=channels[_0x168a8b[_0x2050('0x7')]][_0x2050('0x28')]?utils[_0x2050('0x34')](channels[_0x168a8b['uniqueid']][_0x2050('0x31')],channels[_0x168a8b['uniqueid']]['answertime']):0x0;writeDB(channels[_0x168a8b[_0x2050('0x7')]]);}}catch(_0x417706){utils[_0x2050('0x1f')](util[_0x2050('0x5')](_0x2050('0x35'),_0x168a8b['uniqueid']),_0x417706);}};exports[_0x2050('0x36')]=function(_0x56d6aa){try{if(!_[_0x2050('0x22')](channels[_0x56d6aa[_0x2050('0x37')]])){utils['debug'](util[_0x2050('0x5')](_0x2050('0x38'),_0x56d6aa[_0x2050('0x39')]),_0x56d6aa);if(channels[_0x56d6aa[_0x2050('0x37')]][_0x2050('0x8')]==_0x56d6aa[_0x2050('0x3a')]){utils['info'](util[_0x2050('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x56d6aa[_0x2050('0x39')],_0x56d6aa[_0x2050('0x37')],_0x56d6aa[_0x2050('0x3b')]));channels[_0x56d6aa[_0x2050('0x37')]][_0x2050('0x27')]=_0x56d6aa['secondtransfererchannel'];channels[_0x56d6aa[_0x2050('0x37')]]['userfield']='_attended';}else if(channels[_0x56d6aa[_0x2050('0x37')]][_0x2050('0x8')]=_0x56d6aa['transfertargetchannel']){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x3c'),_0x56d6aa[_0x2050('0x39')],_0x56d6aa[_0x2050('0x37')],_0x56d6aa[_0x2050('0x3d')]));channels[_0x56d6aa[_0x2050('0x37')]]['destinationchannel']=_0x56d6aa['origtransfererchannel'];channels[_0x56d6aa['localtwolinkedid']][_0x2050('0x3e')]='_attended';}}}catch(_0x4633c8){utils[_0x2050('0x1f')](util[_0x2050('0x5')]('[%s][calls][attendedtransfer]',_0x56d6aa[_0x2050('0x39')]),_0x4633c8);}};exports['musiconholdstart']=function(_0x380b44){try{if(!_[_0x2050('0x22')](channels[_0x380b44['uniqueid']])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x380b44[_0x2050('0x7')]),_0x380b44);channels[_0x380b44[_0x2050('0x7')]][_0x2050('0x3f')]=utils['now']();utils['info'](util[_0x2050('0x5')](_0x2050('0x40'),_0x380b44[_0x2050('0x7')],channels[_0x380b44[_0x2050('0x7')]][_0x2050('0x3f')]));}}catch(_0x43e0e5){utils[_0x2050('0x1f')](util['format'](_0x2050('0x41'),_0x380b44['uniqueid']),_0x43e0e5);}};exports['musiconholdstop']=function(_0x12d937){try{if(!_[_0x2050('0x22')](channels[_0x12d937[_0x2050('0x7')]])){utils[_0x2050('0x16')](util[_0x2050('0x5')](_0x2050('0x42'),_0x12d937[_0x2050('0x7')]),_0x12d937);if(!_[_0x2050('0x22')](channels[_0x12d937[_0x2050('0x7')]][_0x2050('0x3f')])){channels[_0x12d937['uniqueid']][_0x2050('0x43')]+=utils['diffTime'](utils[_0x2050('0x1d')](),channels[_0x12d937[_0x2050('0x7')]][_0x2050('0x3f')]);utils['info'](util['format'](_0x2050('0x44'),_0x12d937[_0x2050('0x7')],channels[_0x12d937[_0x2050('0x7')]]['mohtime']));delete channels[_0x12d937[_0x2050('0x7')]]['musiconholdstartAt'];}}}catch(_0x45a4ad){utils[_0x2050('0x1f')](util[_0x2050('0x5')]('[%s][calls][musiconholdstop]',_0x12d937[_0x2050('0x7')]),_0x45a4ad);}};exports[_0x2050('0x45')]=function(_0x407693){try{if(!_[_0x2050('0x22')](channels[_0x407693[_0x2050('0x7')]])){utils['debug'](util[_0x2050('0x5')](_0x2050('0x46'),_0x407693[_0x2050('0x7')]),_0x407693);if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0x2050('0x5')](_0x2050('0x48'),_0x407693[_0x2050('0x7')],_0x407693[_0x2050('0x49')]));channels[_0x407693[_0x2050('0x7')]][_0x2050('0x4a')]=_0x407693[_0x2050('0x49')];}if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x4b')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x407693['uniqueid'],_0x407693['value']));channels[_0x407693[_0x2050('0x7')]][_0x2050('0x4c')]=_0x407693[_0x2050('0x49')];channels[_0x407693[_0x2050('0x7')]][_0x2050('0x2d')]='\x22'+_0x407693[_0x2050('0x49')]+_0x2050('0x4d')+_0x407693[_0x2050('0x49')]+'>';}if(!_[_0x2050('0x22')](_0x407693['variable']['xmd-callerid-preview'])||!_['isNil'](_0x407693['variable'][_0x2050('0x4e')])){utils['info'](util[_0x2050('0x5')](_0x2050('0x4f'),_0x407693['uniqueid'],!_[_0x2050('0x22')](_0x407693['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':_0x2050('0x4e'),_0x407693[_0x2050('0x49')]));channels[_0x407693[_0x2050('0x7')]]['callerid']=_0x407693[_0x2050('0x49')];}if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x50')])||!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')]['xmcs-queue'])){utils[_0x2050('0x4')](util['format'](_0x2050('0x4f'),_0x407693[_0x2050('0x7')],!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x50')])?'xmd-queue':_0x2050('0x51'),_0x407693[_0x2050('0x49')]));channels[_0x407693[_0x2050('0x7')]][_0x2050('0x52')]=_0x2050('0x53');channels[_0x407693[_0x2050('0x7')]][_0x2050('0x54')]=_0x407693['value'];channels[_0x407693[_0x2050('0x7')]][_0x2050('0x9')]=!![];}if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x55')])){utils['info'](util[_0x2050('0x5')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x407693[_0x2050('0x7')],_0x407693[_0x2050('0x49')]));channels[_0x407693['uniqueid']][_0x2050('0x56')]=_0x407693[_0x2050('0x49')];}if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x57')])){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x58'),_0x407693[_0x2050('0x7')],_0x407693[_0x2050('0x49')]));channels[_0x407693[_0x2050('0x7')]][_0x2050('0x59')]=_0x407693[_0x2050('0x49')];}if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x5a')])){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x5b'),_0x407693[_0x2050('0x7')],_0x407693[_0x2050('0x49')]));channels[_0x407693['uniqueid']][_0x2050('0x5c')]=_0x407693[_0x2050('0x49')];}if(!_[_0x2050('0x22')](_0x407693[_0x2050('0x47')][_0x2050('0x5d')])){utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x5e'),_0x407693['uniqueid'],_0x407693[_0x2050('0x49')]));channels[_0x407693[_0x2050('0x7')]][_0x2050('0x5d')]=_0x407693[_0x2050('0x49')];}}}catch(_0x4b7091){utils[_0x2050('0x1f')](util[_0x2050('0x5')](_0x2050('0x46'),_0x407693[_0x2050('0x7')]),_0x4b7091);}};exports[_0x2050('0x5f')]=function(_0x775e2b){try{if(!_[_0x2050('0x22')](channels[_0x775e2b[_0x2050('0x7')]])){utils['debug'](util[_0x2050('0x5')](_0x2050('0x60'),_0x775e2b[_0x2050('0x7')]),_0x775e2b);utils[_0x2050('0x4')](util[_0x2050('0x5')](_0x2050('0x61'),_0x775e2b[_0x2050('0x7')],_0x775e2b['application'],_0x775e2b[_0x2050('0x62')]));if(_0x775e2b['application'][_0x2050('0x63')]()==_0x2050('0x64')&&_[_0x2050('0x65')](_0x775e2b['appdata'][_0x2050('0x63')](),_0x2050('0x66'))){var _0x42a586=_0x775e2b[_0x2050('0x62')][_0x2050('0x67')]('=');var _0xd0b980=_0x42a586[0x0]['substring'](_0x42a586[0x0][_0x2050('0x68')]('(')+0x1,_0x42a586[0x0][_0x2050('0x68')](')'));var _0x1d299f=_0x42a586[0x1];channels[_0x775e2b[_0x2050('0x7')]][_0xd0b980]=_0x1d299f;}if(!_[_0x2050('0x69')]([_0x2050('0x2c'),_0x2050('0x6a'),_0x2050('0x6b'),_0x2050('0x64'),'gotoif'],_0x775e2b['application'][_0x2050('0x63')]())){channels[_0x775e2b['uniqueid']]['lastapplication']=_0x775e2b['application'];channels[_0x775e2b['uniqueid']]['lastdata']=_0x775e2b['appdata'];}}}catch(_0x596038){utils[_0x2050('0x1f')](util[_0x2050('0x5')]('[%s][calls][newexten]',_0x775e2b['uniqueid']),_0x596038);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c120a23..fde5c29 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 _0x786c=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect','info'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x786c,0x1bf));var _0xc786=function(_0xb90d14,_0x3fb76e){_0xb90d14=_0xb90d14-0x0;var _0xebbdda=_0x786c[_0xb90d14];return _0xebbdda;};'use strict';var utils=require(_0xc786('0x0'));exports[_0xc786('0x1')]=function(){utils[_0xc786('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xc786('0x2')]('[core]\x20shutdown');};exports[_0xc786('0x3')]=function(){utils[_0xc786('0x2')](_0xc786('0x4'));};exports[_0xc786('0x5')]=function(_0x5bbe36){utils['error'](_0xc786('0x6'),_0x5bbe36);};exports[_0xc786('0x7')]=function(){utils[_0xc786('0x2')]('[core]\x20close');};exports[_0xc786('0x8')]=function(_0x45387e){}; \ No newline at end of file +var _0x93be=['[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x2790a2,_0x5e5032){var _0x11f76d=function(_0x5c0814){while(--_0x5c0814){_0x2790a2['push'](_0x2790a2['shift']());}};_0x11f76d(++_0x5e5032);}(_0x93be,0x19f));var _0xe93b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x93be[_0xa464c9];return _0x3d73c4;};'use strict';var utils=require(_0xe93b('0x0'));exports[_0xe93b('0x1')]=function(){utils[_0xe93b('0x2')](_0xe93b('0x3'));};exports[_0xe93b('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xe93b('0x5')]=function(){utils[_0xe93b('0x2')](_0xe93b('0x6'));};exports[_0xe93b('0x7')]=function(_0x9c7885){utils[_0xe93b('0x7')](_0xe93b('0x8'),_0x9c7885);};exports['close']=function(){utils['info'](_0xe93b('0x9'));};exports[_0xe93b('0xa')]=function(_0x5e701f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c6262f5..4968276 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 _0x65d2=['varset','debug','[%s][dials][varset]','isNil','outboundrouteid','value','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','now','[%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','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr(routeid)','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65d2,0xb2));var _0x265d=function(_0x11f9f9,_0x187b0f){_0x11f9f9=_0x11f9f9-0x0;var _0x1beadc=_0x65d2[_0x11f9f9];return _0x1beadc;};'use strict';var _=require(_0x265d('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x18a901){utils['info'](util[_0x265d('0x1')](_0x265d('0x2'),_0x18a901[_0x265d('0x3')],_0x18a901[_0x265d('0x4')],_0x18a901[_0x265d('0x5')],_0x18a901[_0x265d('0x6')],_0x18a901[_0x265d('0x7')],_0x18a901[_0x265d('0x8')]));utils[_0x265d('0x9')](_0x265d('0xa'),_0x18a901);delete dials[_0x18a901[_0x265d('0x3')]];}exports[_0x265d('0xb')]=function(_0x24f267){try{utils['debug'](util['format'](_0x265d('0xc'),_0x24f267[_0x265d('0x3')]),_0x24f267);utils[_0x265d('0xd')](util[_0x265d('0x1')](_0x265d('0xe'),_0x24f267[_0x265d('0x3')],_0x24f267['application'],_0x24f267[_0x265d('0xf')]));if(_0x24f267[_0x265d('0x10')]['toLowerCase']()==_0x265d('0x11')&&_[_0x265d('0x12')](_0x24f267[_0x265d('0xf')][_0x265d('0x13')](),_0x265d('0x14'))){var _0x2f8e88=_0x24f267[_0x265d('0xf')]['split']('=');dials[_0x24f267[_0x265d('0x3')]]={'routeId':_0x2f8e88[0x1]};}}catch(_0x12983e){utils[_0x265d('0x15')](util[_0x265d('0x1')]('[%s][dials][newexten]',_0x24f267['uniqueid']),_0x12983e);}};exports[_0x265d('0x16')]=function(_0x57d81c){try{utils[_0x265d('0x17')](util[_0x265d('0x1')](_0x265d('0x18'),_0x57d81c[_0x265d('0x3')]),_0x57d81c);if(!_[_0x265d('0x19')](_0x57d81c['variable'][_0x265d('0x1a')])){utils[_0x265d('0xd')](util[_0x265d('0x1')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x57d81c[_0x265d('0x3')],_0x57d81c[_0x265d('0x1b')]));dials[_0x57d81c['uniqueid']]={'routeId':_0x57d81c[_0x265d('0x1b')]};}}catch(_0x1d5d9c){utils[_0x265d('0x15')](util[_0x265d('0x1')](_0x265d('0x18'),_0x57d81c[_0x265d('0x3')]),_0x1d5d9c);}};exports['dialbegin']=function(_0x17b7a3){try{if(!_['isNil'](dials[_0x17b7a3[_0x265d('0x3')]])){utils[_0x265d('0x17')](util[_0x265d('0x1')](_0x265d('0x1c'),_0x17b7a3[_0x265d('0x3')]),_0x17b7a3);dials[_0x17b7a3['uniqueid']]=_[_0x265d('0x1d')](dials[_0x17b7a3[_0x265d('0x3')]],_0x17b7a3);dials[_0x17b7a3[_0x265d('0x3')]][_0x265d('0x1e')]=utils['now']();dials[_0x17b7a3['uniqueid']][_0x265d('0x1f')]=_0x265d('0x20');utils[_0x265d('0xd')](util[_0x265d('0x1')](_0x265d('0x21'),_0x17b7a3['uniqueid'],dials[_0x17b7a3[_0x265d('0x3')]][_0x265d('0x1e')]));}}catch(_0x56df50){utils[_0x265d('0x15')](util['format'](_0x265d('0x1c'),_0x17b7a3[_0x265d('0x3')]),_0x56df50);}};exports['dialend']=function(_0x3ca7da){try{if(!_[_0x265d('0x19')](dials[_0x3ca7da[_0x265d('0x3')]])){utils[_0x265d('0x17')](util[_0x265d('0x1')](_0x265d('0x22'),_0x3ca7da[_0x265d('0x3')]),_0x3ca7da);dials[_0x3ca7da[_0x265d('0x3')]]['dialstatus']=_0x3ca7da[_0x265d('0x8')];if(_0x3ca7da[_0x265d('0x8')]==_0x265d('0x23')){dials[_0x3ca7da[_0x265d('0x3')]]=_[_0x265d('0x1d')](dials[_0x3ca7da['uniqueid']],_0x3ca7da);dials[_0x3ca7da[_0x265d('0x3')]][_0x265d('0x24')]=utils[_0x265d('0x25')]();dials[_0x3ca7da['uniqueid']][_0x265d('0x1f')]='connect';utils[_0x265d('0xd')](util['format'](_0x265d('0x26'),_0x3ca7da['uniqueid'],_0x3ca7da[_0x265d('0x8')],dials[_0x3ca7da[_0x265d('0x3')]]['answertime']));}else{utils[_0x265d('0xd')](util['format'](_0x265d('0x27'),_0x3ca7da[_0x265d('0x3')],_0x3ca7da[_0x265d('0x8')]));}}}catch(_0x241e31){utils[_0x265d('0x15')](util['format'](_0x265d('0x22'),_0x3ca7da[_0x265d('0x3')]),_0x241e31);}};exports[_0x265d('0x28')]=function(_0x15cedc){try{if(!_[_0x265d('0x19')](dials[_0x15cedc[_0x265d('0x3')]])){utils[_0x265d('0x17')](util['format'](_0x265d('0x29'),_0x15cedc[_0x265d('0x3')]),_0x15cedc);utils['info'](util[_0x265d('0x1')](_0x265d('0x2a'),_0x15cedc[_0x265d('0x3')],_0x15cedc[_0x265d('0x6')],_0x15cedc[_0x265d('0x2b')],_0x15cedc[_0x265d('0x2c')]));dials[_0x15cedc[_0x265d('0x3')]]=_[_0x265d('0x1d')](dials[_0x15cedc[_0x265d('0x3')]],{'endtime':utils['now'](),'lastevent':_0x265d('0x2d')});dials[_0x15cedc[_0x265d('0x3')]]['duration']=utils[_0x265d('0x2e')](dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x2f')],dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x1e')]);dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x30')]=utils['diffTime'](dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x24')]||dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x2f')],dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x1e')]);dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x31')]=dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x24')]?utils[_0x265d('0x2e')](dials[_0x15cedc[_0x265d('0x3')]]['endtime'],dials[_0x15cedc[_0x265d('0x3')]][_0x265d('0x24')]):0x0;writeDB(dials[_0x15cedc[_0x265d('0x3')]]);}}catch(_0x5c8c65){utils['error'](util[_0x265d('0x1')](_0x265d('0x29'),_0x15cedc[_0x265d('0x3')]),_0x5c8c65);}}; \ No newline at end of file +var _0xc928=['error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','answertime','billableseconds','[%s][dials][hangup]','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr(routeid)','split'];(function(_0x4c6232,_0x482617){var _0x2ed951=function(_0x406e6a){while(--_0x406e6a){_0x4c6232['push'](_0x4c6232['shift']());}};_0x2ed951(++_0x482617);}(_0xc928,0x89));var _0x8c92=function(_0x371404,_0x4e6dcb){_0x371404=_0x371404-0x0;var _0x18edaf=_0xc928[_0x371404];return _0x18edaf;};'use strict';var _=require('lodash');var util=require(_0x8c92('0x0'));var utils=require(_0x8c92('0x1'));var dials={};function writeDB(_0xfafc06){utils[_0x8c92('0x2')](util[_0x8c92('0x3')](_0x8c92('0x4'),_0xfafc06['uniqueid'],_0xfafc06[_0x8c92('0x5')],_0xfafc06[_0x8c92('0x6')],_0xfafc06[_0x8c92('0x7')],_0xfafc06['connectedlinenum'],_0xfafc06[_0x8c92('0x8')]));utils[_0x8c92('0x9')](_0x8c92('0xa'),_0xfafc06);delete dials[_0xfafc06[_0x8c92('0xb')]];}exports[_0x8c92('0xc')]=function(_0x5bab0e){try{utils[_0x8c92('0xd')](util['format'](_0x8c92('0xe'),_0x5bab0e[_0x8c92('0xb')]),_0x5bab0e);utils[_0x8c92('0x2')](util[_0x8c92('0x3')](_0x8c92('0xf'),_0x5bab0e[_0x8c92('0xb')],_0x5bab0e[_0x8c92('0x10')],_0x5bab0e[_0x8c92('0x11')]));if(_0x5bab0e[_0x8c92('0x10')]['toLowerCase']()=='set'&&_[_0x8c92('0x12')](_0x5bab0e[_0x8c92('0x11')][_0x8c92('0x13')](),_0x8c92('0x14'))){var _0x2bfa64=_0x5bab0e[_0x8c92('0x11')][_0x8c92('0x15')]('=');dials[_0x5bab0e[_0x8c92('0xb')]]={'routeId':_0x2bfa64[0x1]};}}catch(_0x194d88){utils[_0x8c92('0x16')](util[_0x8c92('0x3')](_0x8c92('0xe'),_0x5bab0e[_0x8c92('0xb')]),_0x194d88);}};exports[_0x8c92('0x17')]=function(_0x15d43a){try{utils[_0x8c92('0xd')](util[_0x8c92('0x3')](_0x8c92('0x18'),_0x15d43a['uniqueid']),_0x15d43a);if(!_[_0x8c92('0x19')](_0x15d43a['variable'][_0x8c92('0x1a')])){utils['info'](util[_0x8c92('0x3')](_0x8c92('0x1b'),_0x15d43a[_0x8c92('0xb')],_0x15d43a[_0x8c92('0x1c')]));dials[_0x15d43a[_0x8c92('0xb')]]={'routeId':_0x15d43a[_0x8c92('0x1c')]};}}catch(_0xbc2a2){utils[_0x8c92('0x16')](util[_0x8c92('0x3')](_0x8c92('0x18'),_0x15d43a[_0x8c92('0xb')]),_0xbc2a2);}};exports[_0x8c92('0x1d')]=function(_0x52f32a){try{if(!_[_0x8c92('0x19')](dials[_0x52f32a[_0x8c92('0xb')]])){utils[_0x8c92('0xd')](util[_0x8c92('0x3')]('[%s][dials][dialbegin]',_0x52f32a[_0x8c92('0xb')]),_0x52f32a);dials[_0x52f32a[_0x8c92('0xb')]]=_['assign'](dials[_0x52f32a['uniqueid']],_0x52f32a);dials[_0x52f32a[_0x8c92('0xb')]][_0x8c92('0x1e')]=utils[_0x8c92('0x1f')]();dials[_0x52f32a[_0x8c92('0xb')]][_0x8c92('0x20')]=_0x8c92('0x21');utils['info'](util[_0x8c92('0x3')](_0x8c92('0x22'),_0x52f32a[_0x8c92('0xb')],dials[_0x52f32a[_0x8c92('0xb')]][_0x8c92('0x1e')]));}}catch(_0x27e122){utils[_0x8c92('0x16')](util[_0x8c92('0x3')](_0x8c92('0x23'),_0x52f32a[_0x8c92('0xb')]),_0x27e122);}};exports[_0x8c92('0x24')]=function(_0x6260f8){try{if(!_[_0x8c92('0x19')](dials[_0x6260f8['uniqueid']])){utils[_0x8c92('0xd')](util[_0x8c92('0x3')](_0x8c92('0x25'),_0x6260f8[_0x8c92('0xb')]),_0x6260f8);dials[_0x6260f8['uniqueid']]['dialstatus']=_0x6260f8[_0x8c92('0x8')];if(_0x6260f8[_0x8c92('0x8')]==_0x8c92('0x26')){dials[_0x6260f8[_0x8c92('0xb')]]=_[_0x8c92('0x27')](dials[_0x6260f8[_0x8c92('0xb')]],_0x6260f8);dials[_0x6260f8['uniqueid']]['answertime']=utils[_0x8c92('0x1f')]();dials[_0x6260f8[_0x8c92('0xb')]][_0x8c92('0x20')]='connect';utils[_0x8c92('0x2')](util[_0x8c92('0x3')](_0x8c92('0x28'),_0x6260f8[_0x8c92('0xb')],_0x6260f8[_0x8c92('0x8')],dials[_0x6260f8[_0x8c92('0xb')]]['answertime']));}else{utils[_0x8c92('0x2')](util[_0x8c92('0x3')](_0x8c92('0x29'),_0x6260f8[_0x8c92('0xb')],_0x6260f8['dialstatus']));}}}catch(_0x5d97d7){utils[_0x8c92('0x16')](util['format'](_0x8c92('0x25'),_0x6260f8[_0x8c92('0xb')]),_0x5d97d7);}};exports[_0x8c92('0x2a')]=function(_0x6e35e6){try{if(!_[_0x8c92('0x19')](dials[_0x6e35e6[_0x8c92('0xb')]])){utils['debug'](util[_0x8c92('0x3')]('[%s][dials][hangup]',_0x6e35e6['uniqueid']),_0x6e35e6);utils['info'](util[_0x8c92('0x3')](_0x8c92('0x2b'),_0x6e35e6[_0x8c92('0xb')],_0x6e35e6[_0x8c92('0x7')],_0x6e35e6[_0x8c92('0x2c')],_0x6e35e6[_0x8c92('0x2d')]));dials[_0x6e35e6[_0x8c92('0xb')]]=_['assign'](dials[_0x6e35e6['uniqueid']],{'endtime':utils[_0x8c92('0x1f')](),'lastevent':'complete'});dials[_0x6e35e6['uniqueid']][_0x8c92('0x2e')]=utils[_0x8c92('0x2f')](dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x30')],dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x1e')]);dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x31')]=utils[_0x8c92('0x2f')](dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x32')]||dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x30')],dials[_0x6e35e6['uniqueid']][_0x8c92('0x1e')]);dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x33')]=dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x32')]?utils['diffTime'](dials[_0x6e35e6['uniqueid']]['endtime'],dials[_0x6e35e6[_0x8c92('0xb')]][_0x8c92('0x32')]):0x0;writeDB(dials[_0x6e35e6['uniqueid']]);}}catch(_0x266dc6){utils[_0x8c92('0x16')](util[_0x8c92('0x3')](_0x8c92('0x34'),_0x6e35e6[_0x8c92('0xb')]),_0x266dc6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6f0acb8..b813d20 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 _0xdc57=['[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','port','asterisk','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0xf6a35b,_0x5b162b){var _0x3fb571=function(_0x47f7eb){while(--_0x47f7eb){_0xf6a35b['push'](_0xf6a35b['shift']());}};_0x3fb571(++_0x5b162b);}(_0xdc57,0x162));var _0x7dc5=function(_0x3c0f33,_0x1fe57b){_0x3c0f33=_0x3c0f33-0x0;var _0x45eac9=_0xdc57[_0x3c0f33];return _0x45eac9;};var AsteriskManager=require(_0x7dc5('0x0'));var config=require(_0x7dc5('0x1'));var utils=require(_0x7dc5('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x7dc5('0x3')],config[_0x7dc5('0x4')]['ip'],config['asterisk']['username'],config[_0x7dc5('0x4')][_0x7dc5('0x5')],!![]);ami[_0x7dc5('0x6')]();if(config[_0x7dc5('0x7')]&&config[_0x7dc5('0x7')][_0x7dc5('0x8')]){utils[_0x7dc5('0x9')](_0x7dc5('0xa'));}else{var agents=require(_0x7dc5('0xb'));var calls=require(_0x7dc5('0xc'));var queues=require('./queues.controller');var recordings=require(_0x7dc5('0xd'));var members=require('./members.controller');var dials=require(_0x7dc5('0xe'));var transfers=require(_0x7dc5('0xf'));var core=require(_0x7dc5('0x10'));ami['on']('connect',core[_0x7dc5('0x11')]);ami['on'](_0x7dc5('0x12'),core[_0x7dc5('0x12')]);ami['on'](_0x7dc5('0x13'),core[_0x7dc5('0x13')]);ami['on'](_0x7dc5('0x14'),core[_0x7dc5('0x14')]);ami['on']('close',core['close']);ami['on'](_0x7dc5('0x15'),core[_0x7dc5('0x15')]);ami['on']('devicestatechange',function(_0x58f4c7){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x18'),_0x58f4c7[_0x7dc5('0x19')]),_0x58f4c7);members[_0x7dc5('0x1a')](_0x58f4c7);}catch(_0x50837c){utils['error'](util[_0x7dc5('0x17')]('[%s][index][devicestatechange]',_0x58f4c7[_0x7dc5('0x19')]),_0x50837c);}});ami['on'](_0x7dc5('0x1b'),function(_0x4f888f){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x1c'),_0x4f888f[_0x7dc5('0x1d')]),_0x4f888f);agents[_0x7dc5('0x1b')](_0x4f888f);}catch(_0x56de6a){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x1c'),_0x4f888f[_0x7dc5('0x1d')]),_0x56de6a);}});ami['on'](_0x7dc5('0x1e'),function(_0xf36f53){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x1f'),_0xf36f53['uniqueid']),_0xf36f53);agents[_0x7dc5('0x1e')](_0xf36f53);}catch(_0x111b85){utils['error'](util['format'](_0x7dc5('0x1f'),_0xf36f53[_0x7dc5('0x1d')]),_0x111b85);}});ami['on'](_0x7dc5('0x20'),function(_0x3a7af6){try{utils['debug'](util[_0x7dc5('0x17')](_0x7dc5('0x21'),_0x3a7af6[_0x7dc5('0x1d')]),_0x3a7af6);agents[_0x7dc5('0x20')](_0x3a7af6);queues[_0x7dc5('0x20')](_0x3a7af6);}catch(_0x5ec2a1){utils[_0x7dc5('0x14')](util['format'](_0x7dc5('0x21'),_0x3a7af6[_0x7dc5('0x1d')]),_0x5ec2a1);}});ami['on'](_0x7dc5('0x22'),function(_0x4fad6f){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x23'),_0x4fad6f[_0x7dc5('0x1d')]),_0x4fad6f);agents[_0x7dc5('0x22')](_0x4fad6f);queues[_0x7dc5('0x22')](_0x4fad6f);members['agentcomplete'](_0x4fad6f);}catch(_0x30ef5f){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x23'),_0x4fad6f[_0x7dc5('0x1d')]),_0x30ef5f);}});ami['on'](_0x7dc5('0x24'),function(_0x50b9b0){try{utils['debug'](util[_0x7dc5('0x17')]('[%s][index][queuecallerabandon]',_0x50b9b0[_0x7dc5('0x1d')]),_0x50b9b0);agents['queuecallerabandon'](_0x50b9b0);queues[_0x7dc5('0x24')](_0x50b9b0);}catch(_0x3fea1d){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x25'),_0x50b9b0[_0x7dc5('0x1d')]),_0x3fea1d);}});ami['on'](_0x7dc5('0x26'),function(_0x56dfe0){try{utils['debug'](util[_0x7dc5('0x17')](_0x7dc5('0x27'),_0x56dfe0[_0x7dc5('0x1d')]),_0x56dfe0);queues[_0x7dc5('0x26')](_0x56dfe0);recordings[_0x7dc5('0x26')](_0x56dfe0);}catch(_0x152f14){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x27'),_0x56dfe0['uniqueid']),_0x152f14);}});ami['on']('queuecallerleave',function(_0x3cfc5e){try{utils[_0x7dc5('0x16')](util['format'](_0x7dc5('0x28'),_0x3cfc5e[_0x7dc5('0x1d')]),_0x3cfc5e);queues[_0x7dc5('0x29')](_0x3cfc5e);}catch(_0x336ee8){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x28'),_0x3cfc5e[_0x7dc5('0x1d')]),_0x336ee8);}});ami['on'](_0x7dc5('0x2a'),function(_0x2e2b8d){try{utils[_0x7dc5('0x16')](util['format'](_0x7dc5('0x2b'),_0x2e2b8d['uniqueid']),_0x2e2b8d);queues[_0x7dc5('0x2a')](_0x2e2b8d);calls[_0x7dc5('0x2a')](_0x2e2b8d);}catch(_0x4c8e9b){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x2b'),_0x2e2b8d[_0x7dc5('0x1d')]),_0x4c8e9b);}});ami['on'](_0x7dc5('0x2c'),function(_0x5839b6){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x2d'),_0x5839b6[_0x7dc5('0x1d')]),_0x5839b6);queues[_0x7dc5('0x2c')](_0x5839b6);calls[_0x7dc5('0x2c')](_0x5839b6);}catch(_0x4bfc22){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')]('[%s][index][musiconholdstop]',_0x5839b6[_0x7dc5('0x1d')]),_0x4bfc22);}});ami['on'](_0x7dc5('0x2e'),function(_0x55170e){try{utils['debug'](util[_0x7dc5('0x17')](_0x7dc5('0x2f'),_0x55170e['uniqueid']),_0x55170e);calls[_0x7dc5('0x2e')](_0x55170e);recordings[_0x7dc5('0x2e')](_0x55170e);}catch(_0x3aaa9e){utils['error'](util[_0x7dc5('0x17')](_0x7dc5('0x2f'),_0x55170e[_0x7dc5('0x1d')]),_0x3aaa9e);}});ami['on'](_0x7dc5('0x30'),function(_0x2cad3a){try{utils['debug'](util[_0x7dc5('0x17')](_0x7dc5('0x31'),_0x2cad3a[_0x7dc5('0x1d')]),_0x2cad3a);calls[_0x7dc5('0x30')](_0x2cad3a);recordings['hangup'](_0x2cad3a);dials[_0x7dc5('0x30')](_0x2cad3a);agents[_0x7dc5('0x30')](_0x2cad3a);queues['hangup'](_0x2cad3a);}catch(_0x257b7c){utils['error'](util[_0x7dc5('0x17')](_0x7dc5('0x31'),_0x2cad3a['uniqueid']),_0x257b7c);}});ami['on'](_0x7dc5('0x32'),function(_0xaa268a){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x33'),_0xaa268a[_0x7dc5('0x1d')]),_0xaa268a);members[_0x7dc5('0x32')](_0xaa268a);}catch(_0x4c4e6f){utils[_0x7dc5('0x14')](util['format']('[%s][index][cdr]',_0xaa268a['uniqueid']),_0x4c4e6f);}});ami['on'](_0x7dc5('0x34'),function(_0x1e1c2b){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x35'),_0x1e1c2b[_0x7dc5('0x1d')]),_0x1e1c2b);queues[_0x7dc5('0x34')](_0x1e1c2b);agents[_0x7dc5('0x34')](_0x1e1c2b);transfers['blindtransfer'](_0x1e1c2b);}catch(_0x5235d8){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x35'),_0x1e1c2b[_0x7dc5('0x1d')]),_0x5235d8);}});ami['on']('attendedtransfer',function(_0x4d9935){try{utils[_0x7dc5('0x16')](util['format'](_0x7dc5('0x36'),_0x4d9935[_0x7dc5('0x37')]),_0x4d9935);queues[_0x7dc5('0x38')](_0x4d9935);transfers['attendedtransfer'](_0x4d9935);agents[_0x7dc5('0x38')](_0x4d9935);calls[_0x7dc5('0x38')](_0x4d9935);}catch(_0x4de471){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x36'),_0x4d9935['origtransfereruniqueid']),_0x4de471);}});ami['on'](_0x7dc5('0x39'),function(_0x5263a5){try{utils['debug'](util[_0x7dc5('0x17')](_0x7dc5('0x3a'),_0x5263a5[_0x7dc5('0x1d')]),_0x5263a5);queues[_0x7dc5('0x39')](_0x5263a5);recordings[_0x7dc5('0x39')](_0x5263a5);calls[_0x7dc5('0x39')](_0x5263a5);dials['varset'](_0x5263a5);}catch(_0x3e417a){utils['error'](util[_0x7dc5('0x17')](_0x7dc5('0x3a'),_0x5263a5[_0x7dc5('0x1d')]),_0x3e417a);}});ami['on'](_0x7dc5('0x3b'),function(_0x436f55){try{utils['debug'](util[_0x7dc5('0x17')](_0x7dc5('0x3c'),_0x436f55[_0x7dc5('0x1d')]),_0x436f55);calls[_0x7dc5('0x3b')](_0x436f55);recordings[_0x7dc5('0x3b')](_0x436f55);dials[_0x7dc5('0x3b')](_0x436f55);}catch(_0x324179){utils[_0x7dc5('0x14')](util['format']('[%s][index][newexten]',_0x436f55['uniqueid']),_0x324179);}});ami['on'](_0x7dc5('0x3d'),function(_0x5deace){try{utils[_0x7dc5('0x16')](util['format'](_0x7dc5('0x3e'),_0x5deace[_0x7dc5('0x1d')]),_0x5deace);calls[_0x7dc5('0x3d')](_0x5deace);recordings[_0x7dc5('0x3d')](_0x5deace);}catch(_0x4cbd83){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x3e'),_0x5deace[_0x7dc5('0x1d')]),_0x4cbd83);}});ami['on'](_0x7dc5('0x3f'),function(_0x4ce678){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x40'),_0x4ce678[_0x7dc5('0x1d')]),_0x4ce678);dials[_0x7dc5('0x3f')](_0x4ce678);}catch(_0x6fe27c){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')](_0x7dc5('0x41'),_0x4ce678['uniqueid']),_0x6fe27c);}});ami['on'](_0x7dc5('0x42'),function(_0x65de72){try{utils[_0x7dc5('0x16')](util[_0x7dc5('0x17')](_0x7dc5('0x43'),_0x65de72[_0x7dc5('0x1d')]),_0x65de72);dials['dialend'](_0x65de72);}catch(_0xe1556f){utils[_0x7dc5('0x14')](util[_0x7dc5('0x17')]('[%s][index][dialend]',_0x65de72[_0x7dc5('0x1d')]),_0xe1556f);}});} \ No newline at end of file +var _0x15a8=['error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x15a8,0xf3));var _0x815a=function(_0x7d2d21,_0xdb7e51){_0x7d2d21=_0x7d2d21-0x0;var _0x5f19df=_0x15a8[_0x7d2d21];return _0x5f19df;};var AsteriskManager=require(_0x815a('0x0'));var config=require(_0x815a('0x1'));var utils=require(_0x815a('0x2'));var util=require(_0x815a('0x3'));var ami=new AsteriskManager(config['asterisk'][_0x815a('0x4')],config[_0x815a('0x5')]['ip'],config[_0x815a('0x5')][_0x815a('0x6')],config[_0x815a('0x5')][_0x815a('0x7')],!![]);ami[_0x815a('0x8')]();if(config[_0x815a('0x9')]&&config[_0x815a('0x9')][_0x815a('0xa')]){utils[_0x815a('0xb')](_0x815a('0xc'));}else{var agents=require(_0x815a('0xd'));var calls=require('./calls.controller');var queues=require(_0x815a('0xe'));var recordings=require('./recordings.controller');var members=require(_0x815a('0xf'));var dials=require(_0x815a('0x10'));var transfers=require('./transfers.controller');var core=require(_0x815a('0x11'));ami['on'](_0x815a('0x12'),core[_0x815a('0x12')]);ami['on'](_0x815a('0x13'),core[_0x815a('0x13')]);ami['on'](_0x815a('0x14'),core[_0x815a('0x14')]);ami['on'](_0x815a('0x15'),core['error']);ami['on']('close',core[_0x815a('0x16')]);ami['on'](_0x815a('0x17'),core['managerevent']);ami['on']('devicestatechange',function(_0x3632a1){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x1a'),_0x3632a1[_0x815a('0x1b')]),_0x3632a1);members[_0x815a('0x1c')](_0x3632a1);}catch(_0x2140a4){utils[_0x815a('0x15')](util[_0x815a('0x19')]('[%s][index][devicestatechange]',_0x3632a1[_0x815a('0x1b')]),_0x2140a4);}});ami['on'](_0x815a('0x1d'),function(_0xcec365){try{utils[_0x815a('0x18')](util['format'](_0x815a('0x1e'),_0xcec365[_0x815a('0x1f')]),_0xcec365);agents[_0x815a('0x1d')](_0xcec365);}catch(_0x2ef797){utils[_0x815a('0x15')](util['format'](_0x815a('0x1e'),_0xcec365[_0x815a('0x1f')]),_0x2ef797);}});ami['on']('agentringnoanswer',function(_0x264923){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x20'),_0x264923[_0x815a('0x1f')]),_0x264923);agents[_0x815a('0x21')](_0x264923);}catch(_0x5afc20){utils[_0x815a('0x15')](util[_0x815a('0x19')](_0x815a('0x20'),_0x264923[_0x815a('0x1f')]),_0x5afc20);}});ami['on'](_0x815a('0x22'),function(_0x4c2d73){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x23'),_0x4c2d73[_0x815a('0x1f')]),_0x4c2d73);agents[_0x815a('0x22')](_0x4c2d73);queues[_0x815a('0x22')](_0x4c2d73);}catch(_0x1676eb){utils['error'](util['format'](_0x815a('0x23'),_0x4c2d73['uniqueid']),_0x1676eb);}});ami['on']('agentcomplete',function(_0x18e71b){try{utils[_0x815a('0x18')](util['format'](_0x815a('0x24'),_0x18e71b['uniqueid']),_0x18e71b);agents[_0x815a('0x25')](_0x18e71b);queues[_0x815a('0x25')](_0x18e71b);members[_0x815a('0x25')](_0x18e71b);}catch(_0x581cb3){utils['error'](util[_0x815a('0x19')](_0x815a('0x24'),_0x18e71b['uniqueid']),_0x581cb3);}});ami['on']('queuecallerabandon',function(_0xa46ba){try{utils[_0x815a('0x18')](util['format'](_0x815a('0x26'),_0xa46ba[_0x815a('0x1f')]),_0xa46ba);agents[_0x815a('0x27')](_0xa46ba);queues[_0x815a('0x27')](_0xa46ba);}catch(_0x139d8d){utils['error'](util[_0x815a('0x19')]('[%s][index][queuecallerabandon]',_0xa46ba[_0x815a('0x1f')]),_0x139d8d);}});ami['on'](_0x815a('0x28'),function(_0x5d7733){try{utils[_0x815a('0x18')](util[_0x815a('0x19')]('[%s][index][queuecallerjoin]',_0x5d7733[_0x815a('0x1f')]),_0x5d7733);queues[_0x815a('0x28')](_0x5d7733);recordings[_0x815a('0x28')](_0x5d7733);}catch(_0x11aa78){utils[_0x815a('0x15')](util[_0x815a('0x19')]('[%s][index][queuecallerjoin]',_0x5d7733[_0x815a('0x1f')]),_0x11aa78);}});ami['on']('queuecallerleave',function(_0x2310ad){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x29'),_0x2310ad[_0x815a('0x1f')]),_0x2310ad);queues[_0x815a('0x2a')](_0x2310ad);}catch(_0x94e935){utils[_0x815a('0x15')](util['format']('[%s][index][queuecallerleave]',_0x2310ad[_0x815a('0x1f')]),_0x94e935);}});ami['on'](_0x815a('0x2b'),function(_0x4e81f8){try{utils[_0x815a('0x18')](util['format']('[%s][index][musiconholdstart]',_0x4e81f8['uniqueid']),_0x4e81f8);queues[_0x815a('0x2b')](_0x4e81f8);calls[_0x815a('0x2b')](_0x4e81f8);}catch(_0x290171){utils['error'](util[_0x815a('0x19')]('[%s][index][musiconholdstart]',_0x4e81f8[_0x815a('0x1f')]),_0x290171);}});ami['on']('musiconholdstop',function(_0x469738){try{utils[_0x815a('0x18')](util[_0x815a('0x19')]('[%s][index][musiconholdstop]',_0x469738[_0x815a('0x1f')]),_0x469738);queues[_0x815a('0x2c')](_0x469738);calls[_0x815a('0x2c')](_0x469738);}catch(_0x5a23b2){utils[_0x815a('0x15')](util['format']('[%s][index][musiconholdstop]',_0x469738[_0x815a('0x1f')]),_0x5a23b2);}});ami['on'](_0x815a('0x2d'),function(_0x24efaf){try{utils[_0x815a('0x18')](util['format'](_0x815a('0x2e'),_0x24efaf['uniqueid']),_0x24efaf);calls['newstate'](_0x24efaf);recordings[_0x815a('0x2d')](_0x24efaf);}catch(_0x45b336){utils[_0x815a('0x15')](util['format'](_0x815a('0x2e'),_0x24efaf[_0x815a('0x1f')]),_0x45b336);}});ami['on']('hangup',function(_0x22e20a){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x2f'),_0x22e20a[_0x815a('0x1f')]),_0x22e20a);calls['hangup'](_0x22e20a);recordings[_0x815a('0x30')](_0x22e20a);dials[_0x815a('0x30')](_0x22e20a);agents['hangup'](_0x22e20a);queues[_0x815a('0x30')](_0x22e20a);}catch(_0x132c75){utils['error'](util['format']('[%s][index][hangup]',_0x22e20a[_0x815a('0x1f')]),_0x132c75);}});ami['on'](_0x815a('0x31'),function(_0x16a72e){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x32'),_0x16a72e[_0x815a('0x1f')]),_0x16a72e);members['cdr'](_0x16a72e);}catch(_0x19c7e9){utils[_0x815a('0x15')](util[_0x815a('0x19')](_0x815a('0x32'),_0x16a72e[_0x815a('0x1f')]),_0x19c7e9);}});ami['on'](_0x815a('0x33'),function(_0x5d3ca4){try{utils['debug'](util['format'](_0x815a('0x34'),_0x5d3ca4[_0x815a('0x1f')]),_0x5d3ca4);queues['blindtransfer'](_0x5d3ca4);agents[_0x815a('0x33')](_0x5d3ca4);transfers[_0x815a('0x33')](_0x5d3ca4);}catch(_0x35b867){utils[_0x815a('0x15')](util[_0x815a('0x19')](_0x815a('0x34'),_0x5d3ca4[_0x815a('0x1f')]),_0x35b867);}});ami['on'](_0x815a('0x35'),function(_0x3ae819){try{utils[_0x815a('0x18')](util[_0x815a('0x19')]('[%s][index][attendedtransfer]',_0x3ae819['origtransfereruniqueid']),_0x3ae819);queues[_0x815a('0x35')](_0x3ae819);transfers[_0x815a('0x35')](_0x3ae819);agents[_0x815a('0x35')](_0x3ae819);calls[_0x815a('0x35')](_0x3ae819);}catch(_0x480ccc){utils['error'](util[_0x815a('0x19')](_0x815a('0x36'),_0x3ae819[_0x815a('0x37')]),_0x480ccc);}});ami['on'](_0x815a('0x38'),function(_0x2d7282){try{utils['debug'](util[_0x815a('0x19')](_0x815a('0x39'),_0x2d7282[_0x815a('0x1f')]),_0x2d7282);queues[_0x815a('0x38')](_0x2d7282);recordings['varset'](_0x2d7282);calls[_0x815a('0x38')](_0x2d7282);dials[_0x815a('0x38')](_0x2d7282);}catch(_0x1d9e27){utils[_0x815a('0x15')](util[_0x815a('0x19')]('[%s][index][varset]',_0x2d7282['uniqueid']),_0x1d9e27);}});ami['on']('newexten',function(_0x1114c7){try{utils[_0x815a('0x18')](util[_0x815a('0x19')](_0x815a('0x3a'),_0x1114c7[_0x815a('0x1f')]),_0x1114c7);calls[_0x815a('0x3b')](_0x1114c7);recordings['newexten'](_0x1114c7);dials[_0x815a('0x3b')](_0x1114c7);}catch(_0x289b37){utils[_0x815a('0x15')](util[_0x815a('0x19')](_0x815a('0x3a'),_0x1114c7[_0x815a('0x1f')]),_0x289b37);}});ami['on']('newchannel',function(_0x3941bc){try{utils[_0x815a('0x18')](util[_0x815a('0x19')]('[%s][index][newchannel]',_0x3941bc[_0x815a('0x1f')]),_0x3941bc);calls[_0x815a('0x3c')](_0x3941bc);recordings[_0x815a('0x3c')](_0x3941bc);}catch(_0x2b8880){utils['error'](util[_0x815a('0x19')](_0x815a('0x3d'),_0x3941bc[_0x815a('0x1f')]),_0x2b8880);}});ami['on'](_0x815a('0x3e'),function(_0x1b4656){try{utils['debug'](util[_0x815a('0x19')]('[%s][index][dialbegin]',_0x1b4656[_0x815a('0x1f')]),_0x1b4656);dials[_0x815a('0x3e')](_0x1b4656);}catch(_0x397aac){utils[_0x815a('0x15')](util['format'](_0x815a('0x3f'),_0x1b4656[_0x815a('0x1f')]),_0x397aac);}});ami['on'](_0x815a('0x40'),function(_0x1a2a75){try{utils['debug'](util[_0x815a('0x19')](_0x815a('0x41'),_0x1a2a75[_0x815a('0x1f')]),_0x1a2a75);dials['dialend'](_0x1a2a75);}catch(_0x41b662){utils[_0x815a('0x15')](util['format'](_0x815a('0x41'),_0x1a2a75[_0x815a('0x1f')]),_0x41b662);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3fda3a5..ce0cf2d 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 _0x7145=['[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','agent','isNil','exitAt','now','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','[%s][members][cdr]','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','then','name','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x7145,0x1ee));var _0x5714=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7145[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5714('0x0'));var util=require(_0x5714('0x1'));var utils=require(_0x5714('0x2'));var members={};var exclude=[_0x5714('0x3'),'Queue:'];function writeDB(_0x473961){utils[_0x5714('0x4')](util[_0x5714('0x5')](_0x5714('0x6'),_0x473961[_0x5714('0x7')],_0x473961[_0x5714('0x8')],_0x473961[_0x5714('0x9')],_0x473961['data2'],_0x473961[_0x5714('0xa')],_0x473961[_0x5714('0xb')]));if(_0x473961[_0x5714('0x8')]){utils['getUserByInterface'](_0x473961[_0x5714('0x8')])[_0x5714('0xc')](function(_0x328d89){if(_0x328d89){_0x473961[_0x5714('0xa')]=_0x328d89[_0x5714('0xd')];_0x473961[_0x5714('0xe')]=_0x328d89[_0x5714('0xe')];utils[_0x5714('0xf')](_0x5714('0x10'),_0x473961);}else{utils['getUserByName'](_0x473961[_0x5714('0x8')][_0x5714('0x11')]('/')[0x1])['then'](function(_0x179553){if(_0x179553){_0x473961['membername']=_0x179553['name'];_0x473961['internal']=_0x179553[_0x5714('0xe')];utils['request'](_0x5714('0x10'),_0x473961);}});}})[_0x5714('0x12')](function(_0x4d7a46){utils['error'](util[_0x5714('0x5')](_0x5714('0x13'),_0x473961[_0x5714('0x7')]),_0x4d7a46);});}delete members[_0x473961[_0x5714('0x8')]];}function startsWith(_0x502bda,_0x403a4c){return _[_0x5714('0x14')](_0x502bda,function(_0x8a5eb6){return _[_0x5714('0x15')](_0x403a4c,_0x8a5eb6);});}exports[_0x5714('0x16')]=function(_0x22ef1b){try{utils[_0x5714('0x17')](util[_0x5714('0x5')](_0x5714('0x18'),members[_0x22ef1b[_0x5714('0x19')]]?members[_0x22ef1b[_0x5714('0x19')]][_0x5714('0x7')]:_0x22ef1b['device']),_0x22ef1b);utils[_0x5714('0x4')](util[_0x5714('0x5')](_0x5714('0x1a'),members[_0x22ef1b[_0x5714('0x19')]]?members[_0x22ef1b['device']]['uniqueid']:_0x22ef1b[_0x5714('0x19')],_0x22ef1b[_0x5714('0x1b')],_0x22ef1b[_0x5714('0x19')]));switch(_0x22ef1b[_0x5714('0x1b')]){case _0x5714('0x1c'):case'BUSY':if(!startsWith(exclude,_0x22ef1b[_0x5714('0x19')])){members[_0x22ef1b[_0x5714('0x19')]]={'channel':_0x5714('0x1d'),'interface':_0x22ef1b[_0x5714('0x19')],'type':_0x5714('0x1e'),'enterAt':utils['now'](),'role':_0x5714('0x1f')};}break;case'NOT_INUSE':if(!_[_0x5714('0x20')](members[_0x22ef1b['device']])){members[_0x22ef1b[_0x5714('0x19')]][_0x5714('0x21')]=utils[_0x5714('0x22')]();members[_0x22ef1b['device']][_0x5714('0x23')]=utils['diffTime'](members[_0x22ef1b[_0x5714('0x19')]][_0x5714('0x21')],members[_0x22ef1b['device']][_0x5714('0x24')]);if(members[_0x22ef1b[_0x5714('0x19')]]['uniqueid']){writeDB(members[_0x22ef1b['device']]);}}break;default:break;}}catch(_0x434a33){utils['error'](util[_0x5714('0x5')](_0x5714('0x18'),members[_0x22ef1b[_0x5714('0x19')]]?members[_0x22ef1b[_0x5714('0x19')]]['uniqueid']:_0x22ef1b[_0x5714('0x19')]),_0x434a33);}};exports[_0x5714('0x25')]=function(_0x18b530){try{if(!_[_0x5714('0x20')](members[_0x18b530[_0x5714('0x8')]])){utils[_0x5714('0x17')](util[_0x5714('0x5')](_0x5714('0x26'),_0x18b530['uniqueid']),_0x18b530);utils['info'](util['format'](_0x5714('0x27'),_0x18b530[_0x5714('0x7')],_0x18b530[_0x5714('0x8')],_0x18b530[_0x5714('0x28')]));members[_0x18b530[_0x5714('0x8')]]=_[_0x5714('0x29')](members[_0x18b530[_0x5714('0x8')]],{'data4':_0x18b530[_0x5714('0x28')],'uniqueid':_0x18b530[_0x5714('0x7')]});}}catch(_0x11c310){utils[_0x5714('0x2a')](util[_0x5714('0x5')](_0x5714('0x26'),_0x18b530[_0x5714('0x7')]),_0x11c310);}};exports[_0x5714('0x2b')]=function(_0x3e801e){try{utils[_0x5714('0x17')](util[_0x5714('0x5')](_0x5714('0x2c'),_0x3e801e[_0x5714('0x7')]),_0x3e801e);if(_0x3e801e['channel']){var _0x3c740e=_0x3e801e[_0x5714('0x9')][_0x5714('0x11')]('-')[0x0];if(!_['isNil'](members[_0x3c740e])){members[_0x3c740e]=_['assign'](members[_0x3c740e],{'data1':members[_0x3c740e][_0x5714('0x2d')]||_0x3e801e[_0x5714('0xb')],'data2':members[_0x3c740e][_0x5714('0x2e')]||_0x3e801e['source'],'data3':members[_0x3c740e][_0x5714('0x2f')]||_0x3e801e[_0x5714('0x30')],'uniqueid':members[_0x3c740e][_0x5714('0x7')]||_0x3e801e[_0x5714('0x7')]});utils[_0x5714('0x4')](util[_0x5714('0x5')](_0x5714('0x31'),_0x3e801e[_0x5714('0x7')],members[_0x3c740e][_0x5714('0x2d')],members[_0x3c740e][_0x5714('0x2e')],members[_0x3c740e][_0x5714('0x2f')]));if(members[_0x3c740e][_0x5714('0x21')]){writeDB(members[_0x3c740e]);}}}if(_0x3e801e[_0x5714('0x32')]){var _0x587a41=_0x3e801e[_0x5714('0x32')][_0x5714('0x11')]('-')[0x0];if(!_['isNil'](members[_0x587a41])){members[_0x587a41]=_['assign'](members[_0x587a41],{'data1':members[_0x587a41]['data1']||_0x3e801e['type'],'data2':members[_0x587a41][_0x5714('0x2e')]||_0x3e801e[_0x5714('0x33')],'data3':members[_0x587a41]['data3']||_0x3e801e[_0x5714('0x30')],'uniqueid':members[_0x587a41][_0x5714('0x7')]||_0x3e801e[_0x5714('0x7')]});utils[_0x5714('0x4')](util['format'](_0x5714('0x31'),_0x3e801e[_0x5714('0x7')],members[_0x587a41][_0x5714('0x2d')],members[_0x587a41]['data2'],members[_0x587a41][_0x5714('0x2f')]));if(members[_0x587a41][_0x5714('0x21')]){writeDB(members[_0x587a41]);}}}}catch(_0x34b351){utils[_0x5714('0x2a')](util[_0x5714('0x5')](_0x5714('0x2c'),_0x3e801e[_0x5714('0x7')]),_0x34b351);}}; \ No newline at end of file +var _0xafef=['destinationchannel','isNil','error','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x21004a,_0x5976b4){var _0x815d42=function(_0x4af707){while(--_0x4af707){_0x21004a['push'](_0x21004a['shift']());}};_0x815d42(++_0x5976b4);}(_0xafef,0x1ac));var _0xfafe=function(_0x2c08f8,_0x69afca){_0x2c08f8=_0x2c08f8-0x0;var _0x3661ce=_0xafef[_0x2c08f8];return _0x3661ce;};'use strict';var _=require(_0xfafe('0x0'));var util=require(_0xfafe('0x1'));var utils=require(_0xfafe('0x2'));var members={};var exclude=[_0xfafe('0x3'),_0xfafe('0x4')];function writeDB(_0x16dda7){utils[_0xfafe('0x5')](util[_0xfafe('0x6')](_0xfafe('0x7'),_0x16dda7[_0xfafe('0x8')],_0x16dda7[_0xfafe('0x9')],_0x16dda7[_0xfafe('0xa')],_0x16dda7[_0xfafe('0xb')],_0x16dda7[_0xfafe('0xc')],_0x16dda7[_0xfafe('0xd')]));if(_0x16dda7['interface']){utils[_0xfafe('0xe')](_0x16dda7[_0xfafe('0x9')])[_0xfafe('0xf')](function(_0x104183){if(_0x104183){_0x16dda7[_0xfafe('0xc')]=_0x104183['name'];_0x16dda7[_0xfafe('0x10')]=_0x104183[_0xfafe('0x10')];utils[_0xfafe('0x11')](_0xfafe('0x12'),_0x16dda7);}else{utils[_0xfafe('0x13')](_0x16dda7[_0xfafe('0x9')][_0xfafe('0x14')]('/')[0x1])[_0xfafe('0xf')](function(_0x598385){if(_0x598385){_0x16dda7[_0xfafe('0xc')]=_0x598385[_0xfafe('0x15')];_0x16dda7[_0xfafe('0x10')]=_0x598385[_0xfafe('0x10')];utils[_0xfafe('0x11')](_0xfafe('0x12'),_0x16dda7);}});}})[_0xfafe('0x16')](function(_0x31a4d3){utils['error'](util[_0xfafe('0x6')](_0xfafe('0x17'),_0x16dda7['uniqueid']),_0x31a4d3);});}delete members[_0x16dda7[_0xfafe('0x9')]];}function startsWith(_0x3980da,_0x5f4201){return _[_0xfafe('0x18')](_0x3980da,function(_0x16e778){return _[_0xfafe('0x19')](_0x5f4201,_0x16e778);});}exports[_0xfafe('0x1a')]=function(_0x6eb243){try{utils[_0xfafe('0x1b')](util['format']('[%s][members][devicestatechange]',members[_0x6eb243['device']]?members[_0x6eb243[_0xfafe('0x1c')]]['uniqueid']:_0x6eb243[_0xfafe('0x1c')]),_0x6eb243);utils['info'](util[_0xfafe('0x6')](_0xfafe('0x1d'),members[_0x6eb243[_0xfafe('0x1c')]]?members[_0x6eb243['device']][_0xfafe('0x8')]:_0x6eb243[_0xfafe('0x1c')],_0x6eb243[_0xfafe('0x1e')],_0x6eb243[_0xfafe('0x1c')]));switch(_0x6eb243[_0xfafe('0x1e')]){case _0xfafe('0x1f'):case'BUSY':if(!startsWith(exclude,_0x6eb243[_0xfafe('0x1c')])){members[_0x6eb243['device']]={'channel':_0xfafe('0x20'),'interface':_0x6eb243[_0xfafe('0x1c')],'type':'TALKING','enterAt':utils[_0xfafe('0x21')](),'role':_0xfafe('0x22')};}break;case _0xfafe('0x23'):if(!_['isNil'](members[_0x6eb243[_0xfafe('0x1c')]])){members[_0x6eb243[_0xfafe('0x1c')]]['exitAt']=utils[_0xfafe('0x21')]();members[_0x6eb243[_0xfafe('0x1c')]][_0xfafe('0x24')]=utils[_0xfafe('0x25')](members[_0x6eb243['device']][_0xfafe('0x26')],members[_0x6eb243[_0xfafe('0x1c')]][_0xfafe('0x27')]);if(members[_0x6eb243[_0xfafe('0x1c')]]['uniqueid']){writeDB(members[_0x6eb243[_0xfafe('0x1c')]]);}}break;default:break;}}catch(_0x21976e){utils['error'](util[_0xfafe('0x6')](_0xfafe('0x28'),members[_0x6eb243['device']]?members[_0x6eb243['device']][_0xfafe('0x8')]:_0x6eb243['device']),_0x21976e);}};exports['agentcomplete']=function(_0x1d2538){try{if(!_['isNil'](members[_0x1d2538['interface']])){utils[_0xfafe('0x1b')](util[_0xfafe('0x6')]('[%s][members][agentcomplete]',_0x1d2538[_0xfafe('0x8')]),_0x1d2538);utils[_0xfafe('0x5')](util[_0xfafe('0x6')](_0xfafe('0x29'),_0x1d2538[_0xfafe('0x8')],_0x1d2538['interface'],_0x1d2538[_0xfafe('0x2a')]));members[_0x1d2538['interface']]=_[_0xfafe('0x2b')](members[_0x1d2538[_0xfafe('0x9')]],{'data4':_0x1d2538[_0xfafe('0x2a')],'uniqueid':_0x1d2538[_0xfafe('0x8')]});}}catch(_0x38cc63){utils['error'](util[_0xfafe('0x6')]('[%s][members][agentcomplete]',_0x1d2538[_0xfafe('0x8')]),_0x38cc63);}};exports['cdr']=function(_0x599985){try{utils[_0xfafe('0x1b')](util[_0xfafe('0x6')]('[%s][members][cdr]',_0x599985[_0xfafe('0x8')]),_0x599985);if(_0x599985['channel']){var _0x55b886=_0x599985[_0xfafe('0xa')][_0xfafe('0x14')]('-')[0x0];if(!_['isNil'](members[_0x55b886])){members[_0x55b886]=_[_0xfafe('0x2b')](members[_0x55b886],{'data1':members[_0x55b886][_0xfafe('0x2c')]||_0x599985['type'],'data2':members[_0x55b886][_0xfafe('0xb')]||_0x599985[_0xfafe('0x2d')],'data3':members[_0x55b886][_0xfafe('0x2e')]||_0x599985[_0xfafe('0x2f')],'uniqueid':members[_0x55b886][_0xfafe('0x8')]||_0x599985[_0xfafe('0x8')]});utils[_0xfafe('0x5')](util[_0xfafe('0x6')](_0xfafe('0x30'),_0x599985[_0xfafe('0x8')],members[_0x55b886][_0xfafe('0x2c')],members[_0x55b886][_0xfafe('0xb')],members[_0x55b886][_0xfafe('0x2e')]));if(members[_0x55b886][_0xfafe('0x26')]){writeDB(members[_0x55b886]);}}}if(_0x599985[_0xfafe('0x31')]){var _0x5f5d28=_0x599985[_0xfafe('0x31')][_0xfafe('0x14')]('-')[0x0];if(!_[_0xfafe('0x32')](members[_0x5f5d28])){members[_0x5f5d28]=_['assign'](members[_0x5f5d28],{'data1':members[_0x5f5d28][_0xfafe('0x2c')]||_0x599985['type'],'data2':members[_0x5f5d28]['data2']||_0x599985[_0xfafe('0x2d')],'data3':members[_0x5f5d28]['data3']||_0x599985[_0xfafe('0x2f')],'uniqueid':members[_0x5f5d28]['uniqueid']||_0x599985['uniqueid']});utils[_0xfafe('0x5')](util[_0xfafe('0x6')](_0xfafe('0x30'),_0x599985['uniqueid'],members[_0x5f5d28][_0xfafe('0x2c')],members[_0x5f5d28][_0xfafe('0xb')],members[_0x5f5d28]['data3']));if(members[_0x5f5d28][_0xfafe('0x26')]){writeDB(members[_0x5f5d28]);}}}}catch(_0x36e12c){utils[_0xfafe('0x33')](util[_0xfafe('0x6')](_0xfafe('0x34'),_0x599985[_0xfafe('0x8')]),_0x36e12c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4f1a419..cd40b5d 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 _0x28f2=['COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','debug','[%s][queues][varset]','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','variable','queueposition','queuecallerexit','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','isNil','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason'];(function(_0xdbc385,_0x67590){var _0x494737=function(_0x55f9f4){while(--_0x55f9f4){_0xdbc385['push'](_0xdbc385['shift']());}};_0x494737(++_0x67590);}(_0x28f2,0x193));var _0x228f=function(_0x2f30af,_0x3b1955){_0x2f30af=_0x2f30af-0x0;var _0x381456=_0x28f2[_0x2f30af];return _0x381456;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var utils=require(_0x228f('0x2'));var queues={};function writeDB(_0x2e5e0b){utils[_0x228f('0x3')](util['format'](_0x228f('0x4'),_0x2e5e0b[_0x228f('0x5')],_0x2e5e0b[_0x228f('0x6')],_0x2e5e0b[_0x228f('0x7')],_0x2e5e0b[_0x228f('0x8')],_0x2e5e0b[_0x228f('0x9')],_0x2e5e0b[_0x228f('0xa')],_0x2e5e0b['queuecallerexitreason']));if(_0x2e5e0b[_0x228f('0x7')]){utils['getVoiceQueueByName'](_0x2e5e0b[_0x228f('0x7')])[_0x228f('0xb')](function(_0xf4b011){if(_0xf4b011){_0x2e5e0b['type']=_0xf4b011[_0x228f('0xc')];}utils['request'](_0x228f('0xd'),_0x2e5e0b);});}else{utils[_0x228f('0xe')]('CreateVoiceQueueReport',_0x2e5e0b);}if(_0x2e5e0b[_0x228f('0xf')]){delete queues[_0x2e5e0b[_0x228f('0xf')]];}else{delete queues[_0x2e5e0b[_0x228f('0x5')]];}}exports[_0x228f('0x10')]=function(_0x3aa9bf){try{utils['debug'](util[_0x228f('0x11')](_0x228f('0x12'),_0x3aa9bf[_0x228f('0x5')]),_0x3aa9bf);utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x13'),_0x3aa9bf[_0x228f('0x5')],_0x3aa9bf[_0x228f('0x7')],_0x3aa9bf['position']));queues[_0x3aa9bf[_0x228f('0x5')]]=_[_0x228f('0x14')](_0x3aa9bf,{'originalposition':_0x3aa9bf[_0x228f('0x15')],'queuecallerjoinAt':utils[_0x228f('0x16')](),'mohtime':0x0});}catch(_0x2a4d87){utils[_0x228f('0x17')](util[_0x228f('0x11')]('[%s][queues][queuecallerjoin]',_0x3aa9bf[_0x228f('0x5')]),_0x2a4d87);}};exports['hangup']=function(_0x20e687){try{if(!_[_0x228f('0x18')](queues[_0x20e687[_0x228f('0x5')]])){utils['debug'](util[_0x228f('0x11')]('[%s][queues][hangup]',_0x20e687[_0x228f('0x5')]),_0x20e687);if(queues[_0x20e687['uniqueid']][_0x228f('0x19')]){if(!queues[_0x20e687['uniqueid']]['queuecallerabandon']&&!queues[_0x20e687[_0x228f('0x5')]]['queuecallerexit']){queues[_0x20e687[_0x228f('0x5')]][_0x228f('0x1a')]=!![];queues[_0x20e687[_0x228f('0x5')]][_0x228f('0x1b')]=utils[_0x228f('0x16')]();queues[_0x20e687[_0x228f('0x5')]][_0x228f('0x1c')]=_0x228f('0x1d');}utils[_0x228f('0x3')](util['format'](_0x228f('0x1e'),_0x20e687[_0x228f('0x5')],queues[_0x20e687[_0x228f('0x5')]][_0x228f('0x1f')],queues[_0x20e687[_0x228f('0x5')]][_0x228f('0x1c')]));writeDB(queues[_0x20e687[_0x228f('0x5')]]);}else if(queues[_0x20e687[_0x228f('0x5')]][_0x228f('0xf')]){utils['info'](util[_0x228f('0x11')](_0x228f('0x20'),_0x20e687[_0x228f('0x5')],queues[_0x20e687[_0x228f('0x5')]][_0x228f('0x1f')],queues[_0x20e687['uniqueid']][_0x228f('0xf')]));queues[queues[_0x20e687['uniqueid']][_0x228f('0xf')]]=queues[_0x20e687['uniqueid']];queues[queues[_0x20e687['uniqueid']][_0x228f('0xf')]][_0x228f('0x21')]=0x2;delete queues[_0x20e687[_0x228f('0x5')]];}}}catch(_0x3ab339){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x22'),_0x20e687[_0x228f('0x5')]),_0x3ab339);}};exports[_0x228f('0x23')]=function(_0x2f13d9){try{utils[_0x228f('0x24')](util[_0x228f('0x11')](_0x228f('0x25'),_0x2f13d9[_0x228f('0x5')]),_0x2f13d9);if(!_[_0x228f('0x18')](_0x2f13d9['variable'][_0x228f('0x26')])&&_0x2f13d9[_0x228f('0x27')][_0x228f('0x28')]()!=='CONTINUE'){if(!_[_0x228f('0x18')](queues[_0x2f13d9[_0x228f('0x5')]])){queues[_0x2f13d9['uniqueid']][_0x228f('0x29')]=![];queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x2a')]=null;queues[_0x2f13d9[_0x228f('0x5')]]['queuecallerexit']=!![];queues[_0x2f13d9[_0x228f('0x5')]]['queuecallerexitAt']=utils[_0x228f('0x16')]();queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x1c')]=_0x2f13d9[_0x228f('0x27')]['toUpperCase']();utils[_0x228f('0x3')](util[_0x228f('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2f13d9['uniqueid'],queues[_0x2f13d9['uniqueid']][_0x228f('0x1f')],_0x2f13d9[_0x228f('0x27')],queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x1c')]));writeDB(queues[_0x2f13d9[_0x228f('0x5')]]);}}else if(!_[_0x228f('0x18')](_0x2f13d9[_0x228f('0x2b')][_0x228f('0x2c')])){if(!_[_0x228f('0x18')](queues[_0x2f13d9['uniqueid']])&&!queues[_0x2f13d9['uniqueid']][_0x228f('0x29')]){queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x29')]=![];queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x2a')]=null;queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x2d')]=!![];queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x2e')]=utils[_0x228f('0x16')]();queues[_0x2f13d9['uniqueid']]['queuecallerexitreason']=_0x228f('0x2f');utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x30'),_0x2f13d9['uniqueid'],queues[_0x2f13d9[_0x228f('0x5')]][_0x228f('0x1f')],_0x2f13d9['value'],queues[_0x2f13d9['uniqueid']][_0x228f('0x1c')]));}}}catch(_0x2f6f54){utils['error'](util[_0x228f('0x11')](_0x228f('0x25'),_0x2f13d9['uniqueid']),_0x2f6f54);}};exports['queuecallerabandon']=function(_0x404668){try{if(!_['isNil'](queues[_0x404668[_0x228f('0x5')]])){utils[_0x228f('0x24')](util[_0x228f('0x11')](_0x228f('0x31'),_0x404668[_0x228f('0x5')]),_0x404668);queues[_0x404668[_0x228f('0x5')]]['queuecallerexit']=![];queues[_0x404668[_0x228f('0x5')]]['queuecallerexitAt']=null;queues[_0x404668[_0x228f('0x5')]][_0x228f('0x29')]=!![];queues[_0x404668[_0x228f('0x5')]][_0x228f('0x2a')]=utils[_0x228f('0x16')]();queues[_0x404668[_0x228f('0x5')]][_0x228f('0x1c')]=_0x228f('0x32');utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x33'),_0x404668[_0x228f('0x5')],queues[_0x404668[_0x228f('0x5')]]['name'],queues[_0x404668['uniqueid']][_0x228f('0x1c')]));}}catch(_0x2f7f82){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x31'),_0x404668[_0x228f('0x5')]),_0x2f7f82);}};exports[_0x228f('0x34')]=function(_0x296ee8){try{if(!_[_0x228f('0x18')](queues[_0x296ee8[_0x228f('0x5')]])){utils['debug'](util[_0x228f('0x11')](_0x228f('0x35'),_0x296ee8['uniqueid']),_0x296ee8);utils[_0x228f('0x3')](util['format'](_0x228f('0x36'),_0x296ee8['uniqueid'],queues[_0x296ee8[_0x228f('0x5')]]['name'],_0x296ee8[_0x228f('0x37')],_0x296ee8[_0x228f('0x38')]));queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x34')]=!![];queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x19')]=utils[_0x228f('0x16')]();queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x39')]=utils[_0x228f('0x3a')](queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x19')],queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x3b')]);queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x15')]=_0x296ee8[_0x228f('0x15')];queues[_0x296ee8[_0x228f('0x5')]][_0x228f('0x3c')]=_0x296ee8['count'];queues[_0x296ee8['uniqueid']][_0x228f('0x37')]=_0x296ee8[_0x228f('0x37')];queues[_0x296ee8[_0x228f('0x5')]]['connectedlinename']=_0x296ee8[_0x228f('0x38')];}}catch(_0x9750ca){utils[_0x228f('0x17')](util['format']('[%s][queues][queuecallerleave]',_0x296ee8['uniqueid']),_0x9750ca);}};exports[_0x228f('0x3d')]=function(_0x4332fb){try{if(!_[_0x228f('0x18')](queues[_0x4332fb[_0x228f('0x5')]])){utils[_0x228f('0x24')](util[_0x228f('0x11')](_0x228f('0x3e'),_0x4332fb[_0x228f('0x5')]),_0x4332fb);utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x3f'),_0x4332fb[_0x228f('0x5')],queues[_0x4332fb['uniqueid']][_0x228f('0x1f')],_0x4332fb[_0x228f('0x40')],_0x4332fb[_0x228f('0x41')]));queues[_0x4332fb[_0x228f('0x5')]][_0x228f('0x29')]=![];queues[_0x4332fb[_0x228f('0x5')]][_0x228f('0x29')]=![];queues[_0x4332fb[_0x228f('0x5')]]['queuecallerabandonAt']=null;queues[_0x4332fb[_0x228f('0x5')]][_0x228f('0x2d')]=![];queues[_0x4332fb[_0x228f('0x5')]][_0x228f('0x1c')]=null;queues[_0x4332fb['uniqueid']][_0x228f('0x2e')]=null;queues[_0x4332fb[_0x228f('0x5')]]['assigned']=!![];queues[_0x4332fb[_0x228f('0x5')]][_0x228f('0xa')]=_0x4332fb[_0x228f('0x41')];queues[_0x4332fb[_0x228f('0x5')]][_0x228f('0x8')]=_0x4332fb[_0x228f('0x40')];}}catch(_0x435a00){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x3e'),_0x4332fb['uniqueid']),_0x435a00);}};exports[_0x228f('0x42')]=function(_0x4e2308){try{if(!_[_0x228f('0x18')](queues[_0x4e2308[_0x228f('0x5')]])){if(queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x19')]){utils[_0x228f('0x24')](util[_0x228f('0x11')](_0x228f('0x43'),_0x4e2308[_0x228f('0x5')]),_0x4e2308);queues[_0x4e2308['uniqueid']][_0x228f('0x29')]=![];queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x29')]=![];queues[_0x4e2308['uniqueid']][_0x228f('0x2a')]=null;queues[_0x4e2308['uniqueid']][_0x228f('0x2d')]=![];queues[_0x4e2308[_0x228f('0x5')]]['queuecallerexitAt']=null;queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x44')]=!![];queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x8')]=_0x4e2308[_0x228f('0x40')];queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x1a')]=!![];queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x1b')]=utils[_0x228f('0x16')]();if(_0x4e2308[_0x228f('0x45')]=='transfer'){if(!queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x46')]){queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x1c')]=_0x228f('0x47');}}else{queues[_0x4e2308['uniqueid']]['queuecallerexitreason']=_0x228f('0x48')+_0x4e2308['reason'][_0x228f('0x28')]();}utils['info'](util[_0x228f('0x11')](_0x228f('0x49'),_0x4e2308['uniqueid'],queues[_0x4e2308[_0x228f('0x5')]][_0x228f('0x1f')],_0x4e2308[_0x228f('0x40')],queues[_0x4e2308[_0x228f('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4e2308[_0x228f('0x5')]]);}}}catch(_0x21f860){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x43'),_0x4e2308[_0x228f('0x5')]),_0x21f860);}};exports[_0x228f('0x4a')]=function(_0x3691cc){try{if(!_['isNil'](queues[_0x3691cc[_0x228f('0x4b')]])){utils[_0x228f('0x24')](util[_0x228f('0x11')](_0x228f('0x4c'),_0x3691cc[_0x228f('0x5')]),_0x3691cc);queues[_0x3691cc['transfereeuniqueid']][_0x228f('0x46')]=!![];queues[_0x3691cc['transfereeuniqueid']][_0x228f('0x4d')]=_0x228f('0x4e');queues[_0x3691cc['transfereeuniqueid']][_0x228f('0x4f')]=_0x3691cc[_0x228f('0x50')];queues[_0x3691cc[_0x228f('0x4b')]]['transferuniqueid']=_0x3691cc[_0x228f('0x4b')];queues[_0x3691cc[_0x228f('0x4b')]][_0x228f('0x1c')]=_0x228f('0x51');utils[_0x228f('0x3')](util['format'](_0x228f('0x52'),_0x3691cc[_0x228f('0x5')],queues[_0x3691cc['transfereeuniqueid']]['name'],_0x3691cc[_0x228f('0x4b')],_0x3691cc[_0x228f('0x50')]));}}catch(_0x139ac0){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x4c'),_0x3691cc[_0x228f('0x5')]),_0x139ac0);}};exports[_0x228f('0x53')]=function(_0x56244e){try{utils[_0x228f('0x24')](util['format'](_0x228f('0x54'),_0x56244e[_0x228f('0x55')]),_0x56244e);if(_0x56244e[_0x228f('0x55')]==_0x56244e[_0x228f('0x56')]){if(!_[_0x228f('0x18')](queues[_0x56244e[_0x228f('0x57')]])){utils[_0x228f('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x56244e[_0x228f('0x55')],queues[_0x56244e[_0x228f('0x57')]][_0x228f('0x1f')],_0x56244e[_0x228f('0x58')]));queues[_0x56244e[_0x228f('0x57')]][_0x228f('0x46')]=!![];queues[_0x56244e['secondtransfererlinkedid']][_0x228f('0x4d')]=_0x228f('0x59');queues[_0x56244e[_0x228f('0x57')]][_0x228f('0x4f')]=_0x56244e[_0x228f('0x58')];queues[_0x56244e[_0x228f('0x57')]][_0x228f('0x5a')]=_0x56244e[_0x228f('0x55')];queues[_0x56244e[_0x228f('0x57')]]['queuecallerexitreason']=_0x228f('0x5b');}if(!_[_0x228f('0x18')](queues[_0x56244e['origtransfererlinkedid']])){if(_0x56244e[_0x228f('0x5c')]&&queues[_0x56244e[_0x228f('0x5c')]]){queues[_0x56244e['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x56244e['transfereeuniqueid']]=_[_0x228f('0x5d')](queues[_0x56244e['transfereelinkedid']]);queues[_0x56244e[_0x228f('0x4b')]]['transfereduniqueid']=_0x56244e[_0x228f('0x5e')];queues[_0x56244e[_0x228f('0x4b')]]['queuecallerenterreason']=0x2;queues[_0x56244e[_0x228f('0x4b')]][_0x228f('0x9')]=queues[_0x56244e[_0x228f('0x57')]][_0x228f('0x9')];queues[_0x56244e[_0x228f('0x4b')]]['calleridname']=queues[_0x56244e[_0x228f('0x57')]][_0x228f('0x5f')];queues[_0x56244e[_0x228f('0x4b')]][_0x228f('0x3b')]=utils[_0x228f('0x16')]();queues[_0x56244e[_0x228f('0x4b')]][_0x228f('0x19')]=utils[_0x228f('0x16')]();queues[_0x56244e[_0x228f('0x4b')]]['holdtime']=0x0;queues[_0x56244e[_0x228f('0x4b')]][_0x228f('0x60')]=0x0;utils[_0x228f('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x56244e['origtransfereruniqueid'],queues[_0x56244e[_0x228f('0x4b')]]['name'],queues[_0x56244e[_0x228f('0x4b')]][_0x228f('0x9')],queues[_0x56244e['transfereeuniqueid']][_0x228f('0x5f')]));}else{utils[_0x228f('0x3')](util['format'](_0x228f('0x61'),_0x56244e[_0x228f('0x55')],queues[_0x56244e[_0x228f('0x56')]][_0x228f('0x1f')],_0x56244e['secondtransfererlinkedid']));queues[_0x56244e[_0x228f('0x56')]][_0x228f('0xf')]=_0x56244e[_0x228f('0x57')];}}}else if(_0x56244e[_0x228f('0x62')]==_0x56244e[_0x228f('0x57')]){if(!_[_0x228f('0x18')](queues[_0x56244e[_0x228f('0x56')]])){utils[_0x228f('0x3')](util[_0x228f('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x56244e[_0x228f('0x55')],queues[_0x56244e[_0x228f('0x56')]][_0x228f('0x1f')],_0x56244e[_0x228f('0x62')],_0x56244e[_0x228f('0x63')]));queues[_0x56244e['origtransfererlinkedid']]['transfer']=!![];queues[_0x56244e[_0x228f('0x56')]]['transfertype']=_0x228f('0x59');queues[_0x56244e['origtransfererlinkedid']][_0x228f('0x4f')]=_0x56244e['secondtransfererexten'];queues[_0x56244e[_0x228f('0x56')]][_0x228f('0x5a')]=_0x56244e[_0x228f('0x62')];queues[_0x56244e[_0x228f('0x56')]][_0x228f('0x1c')]=_0x228f('0x5b');}if(!_[_0x228f('0x18')](queues[_0x56244e[_0x228f('0x57')]])){if(_0x56244e[_0x228f('0x64')]&&queues[_0x56244e[_0x228f('0x64')]]){queues[_0x56244e[_0x228f('0x64')]][_0x228f('0x21')]=0x1;queues[_0x56244e[_0x228f('0x5e')]]=_[_0x228f('0x5d')](queues[_0x56244e[_0x228f('0x64')]]);queues[_0x56244e[_0x228f('0x5e')]]['transfereduniqueid']=_0x56244e[_0x228f('0x5e')];queues[_0x56244e[_0x228f('0x5e')]][_0x228f('0x21')]=0x2;queues[_0x56244e['transfertargetuniqueid']][_0x228f('0x9')]=queues[_0x56244e['origtransfererlinkedid']]['calleridnum'];queues[_0x56244e['transfertargetuniqueid']][_0x228f('0x5f')]=queues[_0x56244e['origtransfererlinkedid']][_0x228f('0x5f')];queues[_0x56244e[_0x228f('0x5e')]]['queuecallerjoinAt']=utils[_0x228f('0x16')]();queues[_0x56244e[_0x228f('0x5e')]]['queuecallerleaveAt']=utils[_0x228f('0x16')]();queues[_0x56244e[_0x228f('0x5e')]]['holdtime']=0x0;queues[_0x56244e['transfertargetuniqueid']][_0x228f('0x60')]=0x0;utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x65'),_0x56244e['origtransfereruniqueid'],queues[_0x56244e[_0x228f('0x5e')]][_0x228f('0x1f')],queues[_0x56244e['transfertargetuniqueid']][_0x228f('0xf')],queues[_0x56244e[_0x228f('0x5e')]][_0x228f('0x9')],queues[_0x56244e[_0x228f('0x5e')]][_0x228f('0x5f')]));}else{utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x61'),_0x56244e['origtransfereruniqueid'],queues[_0x56244e[_0x228f('0x57')]]['name'],_0x56244e['origtransfererlinkedid']));queues[_0x56244e['secondtransfererlinkedid']]['transfereduniqueid']=_0x56244e[_0x228f('0x56')];}}}}catch(_0x1673ef){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x54'),_0x56244e[_0x228f('0x55')]),_0x1673ef);}};exports[_0x228f('0x66')]=function(_0x4e5dfe){try{if(!_[_0x228f('0x18')](queues[_0x4e5dfe['uniqueid']])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x4e5dfe[_0x228f('0x5')]),_0x4e5dfe);queues[_0x4e5dfe['uniqueid']][_0x228f('0x67')]=utils[_0x228f('0x16')]();utils[_0x228f('0x3')](util[_0x228f('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4e5dfe[_0x228f('0x5')],queues[_0x4e5dfe[_0x228f('0x5')]][_0x228f('0x1f')],queues[_0x4e5dfe[_0x228f('0x5')]][_0x228f('0x67')]));}}catch(_0x208b18){utils[_0x228f('0x17')](util[_0x228f('0x11')](_0x228f('0x68'),_0x4e5dfe[_0x228f('0x5')]),_0x208b18);}};exports[_0x228f('0x69')]=function(_0x59b7ae){try{if(!_['isNil'](queues[_0x59b7ae['uniqueid']])){if(!_[_0x228f('0x18')](queues[_0x59b7ae[_0x228f('0x5')]][_0x228f('0x67')])){utils[_0x228f('0x24')](util[_0x228f('0x11')](_0x228f('0x6a'),_0x59b7ae[_0x228f('0x5')]),_0x59b7ae);queues[_0x59b7ae[_0x228f('0x5')]]['mohtime']+=utils[_0x228f('0x3a')](utils[_0x228f('0x16')](),queues[_0x59b7ae[_0x228f('0x5')]][_0x228f('0x67')]);utils[_0x228f('0x3')](util[_0x228f('0x11')](_0x228f('0x6b'),_0x59b7ae[_0x228f('0x5')],queues[_0x59b7ae[_0x228f('0x5')]]['name'],queues[_0x59b7ae[_0x228f('0x5')]][_0x228f('0x60')]));delete queues[_0x59b7ae[_0x228f('0x5')]]['musiconholdstartAt'];}}}catch(_0x4e1c25){utils[_0x228f('0x17')](util['format'](_0x228f('0x6a'),_0x59b7ae[_0x228f('0x5')]),_0x4e1c25);}}; \ No newline at end of file +var _0x81cb=['[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','queuecallerabandonAt','queuecallerexitAt','value','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','lastAssignedTo','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','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','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb81c('0x0'));var util=require(_0xb81c('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1e4c17){utils[_0xb81c('0x2')](util['format'](_0xb81c('0x3'),_0x1e4c17[_0xb81c('0x4')],_0x1e4c17[_0xb81c('0x5')],_0x1e4c17[_0xb81c('0x6')],_0x1e4c17['lastAssignedTo'],_0x1e4c17[_0xb81c('0x7')],_0x1e4c17['accountcode'],_0x1e4c17['queuecallerexitreason']));if(_0x1e4c17[_0xb81c('0x6')]){utils[_0xb81c('0x8')](_0x1e4c17[_0xb81c('0x6')])[_0xb81c('0x9')](function(_0xe7aa17){if(_0xe7aa17){_0x1e4c17[_0xb81c('0xa')]=_0xe7aa17[_0xb81c('0xa')];}utils[_0xb81c('0xb')](_0xb81c('0xc'),_0x1e4c17);});}else{utils[_0xb81c('0xb')](_0xb81c('0xc'),_0x1e4c17);}if(_0x1e4c17[_0xb81c('0xd')]){delete queues[_0x1e4c17[_0xb81c('0xd')]];}else{delete queues[_0x1e4c17[_0xb81c('0x4')]];}}exports['queuecallerjoin']=function(_0x29a6f2){try{utils[_0xb81c('0xe')](util[_0xb81c('0xf')](_0xb81c('0x10'),_0x29a6f2[_0xb81c('0x4')]),_0x29a6f2);utils['info'](util[_0xb81c('0xf')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x29a6f2[_0xb81c('0x4')],_0x29a6f2[_0xb81c('0x6')],_0x29a6f2['position']));queues[_0x29a6f2[_0xb81c('0x4')]]=_[_0xb81c('0x11')](_0x29a6f2,{'originalposition':_0x29a6f2['position'],'queuecallerjoinAt':utils[_0xb81c('0x12')](),'mohtime':0x0});}catch(_0x3942dc){utils[_0xb81c('0x13')](util['format'](_0xb81c('0x10'),_0x29a6f2[_0xb81c('0x4')]),_0x3942dc);}};exports['hangup']=function(_0xe7a277){try{if(!_[_0xb81c('0x14')](queues[_0xe7a277[_0xb81c('0x4')]])){utils['debug'](util[_0xb81c('0xf')](_0xb81c('0x15'),_0xe7a277[_0xb81c('0x4')]),_0xe7a277);if(queues[_0xe7a277['uniqueid']][_0xb81c('0x16')]){if(!queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0x17')]&&!queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0x18')]){queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0x19')]=!![];queues[_0xe7a277['uniqueid']][_0xb81c('0x1a')]=utils[_0xb81c('0x12')]();queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0x1b')]='COMPLETEDBYAGENT';}utils[_0xb81c('0x2')](util['format'](_0xb81c('0x1c'),_0xe7a277[_0xb81c('0x4')],queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0x1d')],queues[_0xe7a277['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0xe7a277[_0xb81c('0x4')]]);}else if(queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0xd')]){utils[_0xb81c('0x2')](util[_0xb81c('0xf')](_0xb81c('0x1e'),_0xe7a277[_0xb81c('0x4')],queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0x1d')],queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0xd')]));queues[queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0xd')]]=queues[_0xe7a277[_0xb81c('0x4')]];queues[queues[_0xe7a277[_0xb81c('0x4')]][_0xb81c('0xd')]][_0xb81c('0x1f')]=0x2;delete queues[_0xe7a277['uniqueid']];}}}catch(_0x5c07c0){utils[_0xb81c('0x13')](util[_0xb81c('0xf')]('[%s][queues][hangup]',_0xe7a277[_0xb81c('0x4')]),_0x5c07c0);}};exports[_0xb81c('0x20')]=function(_0x545530){try{utils[_0xb81c('0xe')](util['format'](_0xb81c('0x21'),_0x545530['uniqueid']),_0x545530);if(!_[_0xb81c('0x14')](_0x545530[_0xb81c('0x22')][_0xb81c('0x23')])&&_0x545530['value'][_0xb81c('0x24')]()!=='CONTINUE'){if(!_[_0xb81c('0x14')](queues[_0x545530[_0xb81c('0x4')]])){queues[_0x545530['uniqueid']][_0xb81c('0x17')]=![];queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x25')]=null;queues[_0x545530['uniqueid']][_0xb81c('0x18')]=!![];queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x26')]=utils[_0xb81c('0x12')]();queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x1b')]=_0x545530[_0xb81c('0x27')][_0xb81c('0x24')]();utils[_0xb81c('0x2')](util[_0xb81c('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x545530[_0xb81c('0x4')],queues[_0x545530['uniqueid']]['name'],_0x545530[_0xb81c('0x27')],queues[_0x545530['uniqueid']][_0xb81c('0x1b')]));writeDB(queues[_0x545530['uniqueid']]);}}else if(!_[_0xb81c('0x14')](_0x545530[_0xb81c('0x22')]['queueposition'])){if(!_[_0xb81c('0x14')](queues[_0x545530[_0xb81c('0x4')]])&&!queues[_0x545530[_0xb81c('0x4')]]['queuecallerabandon']){queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x17')]=![];queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x25')]=null;queues[_0x545530['uniqueid']][_0xb81c('0x18')]=!![];queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x26')]=utils[_0xb81c('0x12')]();queues[_0x545530[_0xb81c('0x4')]][_0xb81c('0x1b')]=_0xb81c('0x28');utils[_0xb81c('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x545530['uniqueid'],queues[_0x545530['uniqueid']]['name'],_0x545530[_0xb81c('0x27')],queues[_0x545530['uniqueid']][_0xb81c('0x1b')]));}}}catch(_0x8fced9){utils[_0xb81c('0x13')](util[_0xb81c('0xf')](_0xb81c('0x21'),_0x545530['uniqueid']),_0x8fced9);}};exports[_0xb81c('0x17')]=function(_0x3184a9){try{if(!_['isNil'](queues[_0x3184a9['uniqueid']])){utils['debug'](util[_0xb81c('0xf')](_0xb81c('0x29'),_0x3184a9[_0xb81c('0x4')]),_0x3184a9);queues[_0x3184a9[_0xb81c('0x4')]][_0xb81c('0x18')]=![];queues[_0x3184a9[_0xb81c('0x4')]]['queuecallerexitAt']=null;queues[_0x3184a9[_0xb81c('0x4')]]['queuecallerabandon']=!![];queues[_0x3184a9[_0xb81c('0x4')]][_0xb81c('0x25')]=utils[_0xb81c('0x12')]();queues[_0x3184a9[_0xb81c('0x4')]]['queuecallerexitreason']=_0xb81c('0x2a');utils['info'](util[_0xb81c('0xf')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3184a9[_0xb81c('0x4')],queues[_0x3184a9[_0xb81c('0x4')]][_0xb81c('0x1d')],queues[_0x3184a9['uniqueid']][_0xb81c('0x1b')]));}}catch(_0x5f581c){utils[_0xb81c('0x13')](util[_0xb81c('0xf')](_0xb81c('0x29'),_0x3184a9['uniqueid']),_0x5f581c);}};exports[_0xb81c('0x2b')]=function(_0xbc5256){try{if(!_[_0xb81c('0x14')](queues[_0xbc5256[_0xb81c('0x4')]])){utils[_0xb81c('0xe')](util[_0xb81c('0xf')](_0xb81c('0x2c'),_0xbc5256[_0xb81c('0x4')]),_0xbc5256);utils[_0xb81c('0x2')](util['format'](_0xb81c('0x2d'),_0xbc5256[_0xb81c('0x4')],queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x1d')],_0xbc5256[_0xb81c('0x2e')],_0xbc5256['connectedlinename']));queues[_0xbc5256[_0xb81c('0x4')]]['queuecallerleave']=!![];queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x16')]=utils[_0xb81c('0x12')]();queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x2f')]=utils[_0xb81c('0x30')](queues[_0xbc5256[_0xb81c('0x4')]]['queuecallerleaveAt'],queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x31')]);queues[_0xbc5256['uniqueid']]['position']=_0xbc5256[_0xb81c('0x32')];queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x33')]=_0xbc5256[_0xb81c('0x33')];queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x2e')]=_0xbc5256[_0xb81c('0x2e')];queues[_0xbc5256[_0xb81c('0x4')]][_0xb81c('0x34')]=_0xbc5256[_0xb81c('0x34')];}}catch(_0x512b3b){utils['error'](util[_0xb81c('0xf')]('[%s][queues][queuecallerleave]',_0xbc5256[_0xb81c('0x4')]),_0x512b3b);}};exports[_0xb81c('0x35')]=function(_0x39feb6){try{if(!_[_0xb81c('0x14')](queues[_0x39feb6[_0xb81c('0x4')]])){utils[_0xb81c('0xe')](util[_0xb81c('0xf')](_0xb81c('0x36'),_0x39feb6[_0xb81c('0x4')]),_0x39feb6);utils['info'](util[_0xb81c('0xf')](_0xb81c('0x37'),_0x39feb6['uniqueid'],queues[_0x39feb6[_0xb81c('0x4')]][_0xb81c('0x1d')],_0x39feb6[_0xb81c('0x38')],_0x39feb6['destaccountcode']));queues[_0x39feb6[_0xb81c('0x4')]][_0xb81c('0x17')]=![];queues[_0x39feb6[_0xb81c('0x4')]]['queuecallerabandon']=![];queues[_0x39feb6[_0xb81c('0x4')]][_0xb81c('0x25')]=null;queues[_0x39feb6[_0xb81c('0x4')]]['queuecallerexit']=![];queues[_0x39feb6[_0xb81c('0x4')]][_0xb81c('0x1b')]=null;queues[_0x39feb6['uniqueid']][_0xb81c('0x26')]=null;queues[_0x39feb6[_0xb81c('0x4')]][_0xb81c('0x39')]=!![];queues[_0x39feb6['uniqueid']]['accountcode']=_0x39feb6[_0xb81c('0x3a')];queues[_0x39feb6['uniqueid']][_0xb81c('0x3b')]=_0x39feb6[_0xb81c('0x38')];}}catch(_0x353251){utils[_0xb81c('0x13')](util[_0xb81c('0xf')](_0xb81c('0x36'),_0x39feb6[_0xb81c('0x4')]),_0x353251);}};exports['agentcomplete']=function(_0x2df7e7){try{if(!_[_0xb81c('0x14')](queues[_0x2df7e7[_0xb81c('0x4')]])){if(queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x16')]){utils[_0xb81c('0xe')](util['format'](_0xb81c('0x3c'),_0x2df7e7[_0xb81c('0x4')]),_0x2df7e7);queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x17')]=![];queues[_0x2df7e7['uniqueid']][_0xb81c('0x17')]=![];queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x25')]=null;queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x18')]=![];queues[_0x2df7e7[_0xb81c('0x4')]]['queuecallerexitAt']=null;queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x39')]=!![];queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x3b')]=_0x2df7e7[_0xb81c('0x38')];queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x19')]=!![];queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x1a')]=utils[_0xb81c('0x12')]();if(_0x2df7e7[_0xb81c('0x3d')]==_0xb81c('0x3e')){if(!queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x3e')]){queues[_0x2df7e7['uniqueid']][_0xb81c('0x1b')]='TRANSFER';}}else{queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x1b')]=_0xb81c('0x3f')+_0x2df7e7[_0xb81c('0x3d')][_0xb81c('0x24')]();}utils[_0xb81c('0x2')](util[_0xb81c('0xf')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2df7e7[_0xb81c('0x4')],queues[_0x2df7e7[_0xb81c('0x4')]][_0xb81c('0x1d')],_0x2df7e7[_0xb81c('0x38')],queues[_0x2df7e7[_0xb81c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x2df7e7['uniqueid']]);}}}catch(_0x5d0d27){utils[_0xb81c('0x13')](util[_0xb81c('0xf')](_0xb81c('0x3c'),_0x2df7e7[_0xb81c('0x4')]),_0x5d0d27);}};exports[_0xb81c('0x40')]=function(_0x110d2e){try{if(!_[_0xb81c('0x14')](queues[_0x110d2e[_0xb81c('0x41')]])){utils['debug'](util[_0xb81c('0xf')]('[%s][queues][blindtransfer]',_0x110d2e[_0xb81c('0x4')]),_0x110d2e);queues[_0x110d2e[_0xb81c('0x41')]][_0xb81c('0x3e')]=!![];queues[_0x110d2e[_0xb81c('0x41')]]['transfertype']=_0xb81c('0x42');queues[_0x110d2e['transfereeuniqueid']][_0xb81c('0x43')]=_0x110d2e[_0xb81c('0x44')];queues[_0x110d2e[_0xb81c('0x41')]][_0xb81c('0x45')]=_0x110d2e['transfereeuniqueid'];queues[_0x110d2e[_0xb81c('0x41')]][_0xb81c('0x1b')]=_0xb81c('0x46');utils['info'](util[_0xb81c('0xf')](_0xb81c('0x47'),_0x110d2e[_0xb81c('0x4')],queues[_0x110d2e[_0xb81c('0x41')]][_0xb81c('0x1d')],_0x110d2e[_0xb81c('0x41')],_0x110d2e['extension']));}}catch(_0x3191be){utils['error'](util['format'](_0xb81c('0x48'),_0x110d2e[_0xb81c('0x4')]),_0x3191be);}};exports[_0xb81c('0x49')]=function(_0x3320e2){try{utils[_0xb81c('0xe')](util[_0xb81c('0xf')](_0xb81c('0x4a'),_0x3320e2[_0xb81c('0x4b')]),_0x3320e2);if(_0x3320e2['origtransfereruniqueid']==_0x3320e2[_0xb81c('0x4c')]){if(!_[_0xb81c('0x14')](queues[_0x3320e2[_0xb81c('0x4d')]])){utils['info'](util[_0xb81c('0xf')](_0xb81c('0x4e'),_0x3320e2['origtransfereruniqueid'],queues[_0x3320e2['secondtransfererlinkedid']][_0xb81c('0x1d')],_0x3320e2[_0xb81c('0x4f')]));queues[_0x3320e2[_0xb81c('0x4d')]][_0xb81c('0x3e')]=!![];queues[_0x3320e2[_0xb81c('0x4d')]][_0xb81c('0x50')]='ATTENDED';queues[_0x3320e2[_0xb81c('0x4d')]][_0xb81c('0x43')]=_0x3320e2['origtransfererexten'];queues[_0x3320e2['secondtransfererlinkedid']][_0xb81c('0x45')]=_0x3320e2[_0xb81c('0x4b')];queues[_0x3320e2['secondtransfererlinkedid']][_0xb81c('0x1b')]=_0xb81c('0x51');}if(!_[_0xb81c('0x14')](queues[_0x3320e2[_0xb81c('0x4c')]])){if(_0x3320e2['transfereelinkedid']&&queues[_0x3320e2['transfereelinkedid']]){queues[_0x3320e2[_0xb81c('0x52')]][_0xb81c('0x1f')]=0x1;queues[_0x3320e2['transfereeuniqueid']]=_[_0xb81c('0x53')](queues[_0x3320e2[_0xb81c('0x52')]]);queues[_0x3320e2[_0xb81c('0x41')]][_0xb81c('0xd')]=_0x3320e2[_0xb81c('0x54')];queues[_0x3320e2['transfereeuniqueid']][_0xb81c('0x1f')]=0x2;queues[_0x3320e2[_0xb81c('0x41')]][_0xb81c('0x7')]=queues[_0x3320e2[_0xb81c('0x4d')]]['calleridnum'];queues[_0x3320e2['transfereeuniqueid']]['calleridname']=queues[_0x3320e2[_0xb81c('0x4d')]][_0xb81c('0x55')];queues[_0x3320e2['transfereeuniqueid']][_0xb81c('0x31')]=utils[_0xb81c('0x12')]();queues[_0x3320e2[_0xb81c('0x41')]][_0xb81c('0x16')]=utils[_0xb81c('0x12')]();queues[_0x3320e2['transfereeuniqueid']][_0xb81c('0x2f')]=0x0;queues[_0x3320e2[_0xb81c('0x41')]][_0xb81c('0x56')]=0x0;utils[_0xb81c('0x2')](util[_0xb81c('0xf')](_0xb81c('0x57'),_0x3320e2[_0xb81c('0x4b')],queues[_0x3320e2[_0xb81c('0x41')]]['name'],queues[_0x3320e2['transfereeuniqueid']]['calleridnum'],queues[_0x3320e2[_0xb81c('0x41')]][_0xb81c('0x55')]));}else{utils[_0xb81c('0x2')](util[_0xb81c('0xf')](_0xb81c('0x58'),_0x3320e2[_0xb81c('0x4b')],queues[_0x3320e2[_0xb81c('0x4c')]]['name'],_0x3320e2['secondtransfererlinkedid']));queues[_0x3320e2[_0xb81c('0x4c')]]['transfereduniqueid']=_0x3320e2[_0xb81c('0x4d')];}}}else if(_0x3320e2[_0xb81c('0x59')]==_0x3320e2[_0xb81c('0x4d')]){if(!_[_0xb81c('0x14')](queues[_0x3320e2[_0xb81c('0x4c')]])){utils['info'](util[_0xb81c('0xf')](_0xb81c('0x5a'),_0x3320e2[_0xb81c('0x4b')],queues[_0x3320e2[_0xb81c('0x4c')]][_0xb81c('0x1d')],_0x3320e2['secondtransfereruniqueid'],_0x3320e2[_0xb81c('0x5b')]));queues[_0x3320e2[_0xb81c('0x4c')]][_0xb81c('0x3e')]=!![];queues[_0x3320e2[_0xb81c('0x4c')]]['transfertype']=_0xb81c('0x5c');queues[_0x3320e2[_0xb81c('0x4c')]][_0xb81c('0x43')]=_0x3320e2[_0xb81c('0x5b')];queues[_0x3320e2[_0xb81c('0x4c')]][_0xb81c('0x45')]=_0x3320e2[_0xb81c('0x59')];queues[_0x3320e2[_0xb81c('0x4c')]][_0xb81c('0x1b')]=_0xb81c('0x51');}if(!_[_0xb81c('0x14')](queues[_0x3320e2[_0xb81c('0x4d')]])){if(_0x3320e2[_0xb81c('0x5d')]&&queues[_0x3320e2[_0xb81c('0x5d')]]){queues[_0x3320e2[_0xb81c('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x3320e2['transfertargetuniqueid']]=_[_0xb81c('0x53')](queues[_0x3320e2['transfertargetlinkedid']]);queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0xd')]=_0x3320e2[_0xb81c('0x54')];queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0x1f')]=0x2;queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0x7')]=queues[_0x3320e2['origtransfererlinkedid']][_0xb81c('0x7')];queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0x55')]=queues[_0x3320e2[_0xb81c('0x4c')]]['calleridname'];queues[_0x3320e2['transfertargetuniqueid']][_0xb81c('0x31')]=utils[_0xb81c('0x12')]();queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0x16')]=utils[_0xb81c('0x12')]();queues[_0x3320e2['transfertargetuniqueid']][_0xb81c('0x2f')]=0x0;queues[_0x3320e2['transfertargetuniqueid']][_0xb81c('0x56')]=0x0;utils[_0xb81c('0x2')](util['format'](_0xb81c('0x5e'),_0x3320e2[_0xb81c('0x4b')],queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0x1d')],queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0xd')],queues[_0x3320e2['transfertargetuniqueid']]['calleridnum'],queues[_0x3320e2[_0xb81c('0x54')]][_0xb81c('0x55')]));}else{utils[_0xb81c('0x2')](util[_0xb81c('0xf')](_0xb81c('0x58'),_0x3320e2[_0xb81c('0x4b')],queues[_0x3320e2[_0xb81c('0x4d')]][_0xb81c('0x1d')],_0x3320e2[_0xb81c('0x4c')]));queues[_0x3320e2['secondtransfererlinkedid']][_0xb81c('0xd')]=_0x3320e2[_0xb81c('0x4c')];}}}}catch(_0xe4b187){utils[_0xb81c('0x13')](util['format'](_0xb81c('0x4a'),_0x3320e2[_0xb81c('0x4b')]),_0xe4b187);}};exports['musiconholdstart']=function(_0x4dbf9c){try{if(!_[_0xb81c('0x14')](queues[_0x4dbf9c[_0xb81c('0x4')]])){utils[_0xb81c('0xe')](util[_0xb81c('0xf')](_0xb81c('0x5f'),_0x4dbf9c[_0xb81c('0x4')]),_0x4dbf9c);queues[_0x4dbf9c[_0xb81c('0x4')]][_0xb81c('0x60')]=utils[_0xb81c('0x12')]();utils[_0xb81c('0x2')](util[_0xb81c('0xf')](_0xb81c('0x61'),_0x4dbf9c['uniqueid'],queues[_0x4dbf9c[_0xb81c('0x4')]][_0xb81c('0x1d')],queues[_0x4dbf9c[_0xb81c('0x4')]][_0xb81c('0x60')]));}}catch(_0x409c52){utils[_0xb81c('0x13')](util[_0xb81c('0xf')](_0xb81c('0x5f'),_0x4dbf9c['uniqueid']),_0x409c52);}};exports['musiconholdstop']=function(_0x256632){try{if(!_['isNil'](queues[_0x256632[_0xb81c('0x4')]])){if(!_[_0xb81c('0x14')](queues[_0x256632['uniqueid']]['musiconholdstartAt'])){utils[_0xb81c('0xe')](util[_0xb81c('0xf')](_0xb81c('0x62'),_0x256632[_0xb81c('0x4')]),_0x256632);queues[_0x256632[_0xb81c('0x4')]][_0xb81c('0x56')]+=utils['diffTime'](utils['now'](),queues[_0x256632['uniqueid']][_0xb81c('0x60')]);utils[_0xb81c('0x2')](util['format'](_0xb81c('0x63'),_0x256632[_0xb81c('0x4')],queues[_0x256632[_0xb81c('0x4')]][_0xb81c('0x1d')],queues[_0x256632[_0xb81c('0x4')]][_0xb81c('0x56')]));delete queues[_0x256632[_0xb81c('0x4')]][_0xb81c('0x60')];}}}catch(_0x12763d){utils[_0xb81c('0x13')](util[_0xb81c('0xf')](_0xb81c('0x62'),_0x256632['uniqueid']),_0x12763d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a32e59d..1af065a 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 _0x8985=['varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][hangup]','newexten','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','uniqueid','accountcode','membername','name','request','CreateVoiceRecording','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error'];(function(_0x38ef9b,_0x27e000){var _0x4c097d=function(_0x561520){while(--_0x561520){_0x38ef9b['push'](_0x38ef9b['shift']());}};_0x4c097d(++_0x27e000);}(_0x8985,0x198));var _0x5898=function(_0x3e4bec,_0x36067d){_0x3e4bec=_0x3e4bec-0x0;var _0x5b01c=_0x8985[_0x3e4bec];return _0x5b01c;};'use strict';var _=require(_0x5898('0x0'));var util=require(_0x5898('0x1'));var utils=require(_0x5898('0x2'));var recordings={};function writeDB(_0x5f5602){utils[_0x5898('0x3')](util['format']('[%s][recordings][writeDB]',_0x5f5602[_0x5898('0x4')]));if(_0x5f5602[_0x5898('0x5')]){utils['getUserByInternal'](_0x5f5602['accountcode'])['then'](function(_0x23a6f2){if(_0x23a6f2){_0x5f5602[_0x5898('0x6')]=_0x23a6f2[_0x5898('0x7')];_0x5f5602['UserId']=_0x23a6f2['id'];}utils[_0x5898('0x8')]('CreateVoiceRecording',_0x5f5602);});}else{utils[_0x5898('0x8')](_0x5898('0x9'),_0x5f5602);}}exports['newchannel']=function(_0x34995f){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x34995f['uniqueid']),_0x34995f);if(_0x34995f['uniqueid']==_0x34995f['linkedid']){utils[_0x5898('0x3')](util[_0x5898('0xa')](_0x5898('0xb'),_0x34995f[_0x5898('0x4')],_0x34995f['context'],_0x34995f[_0x5898('0xc')]));recordings[_0x34995f[_0x5898('0x4')]]={'uniqueid':_0x34995f[_0x5898('0x4')],'accountcode':_0x34995f[_0x5898('0x5')],'exten':_0x34995f[_0x5898('0xc')],'context':_0x34995f['context'],'channel':_0x34995f[_0x5898('0xd')],'monitors':[]};}}catch(_0x119224){utils['error'](util[_0x5898('0xa')](_0x5898('0xe'),_0x34995f['uniqueid']),_0x119224);}};exports[_0x5898('0xf')]=function(_0x1b013d){try{utils[_0x5898('0x10')](util[_0x5898('0xa')](_0x5898('0x11'),_0x1b013d[_0x5898('0x4')]),_0x1b013d);if(!_['isNil'](recordings[_0x1b013d['uniqueid']])&&_0x1b013d[_0x5898('0x12')]==0x6){utils[_0x5898('0x3')](util[_0x5898('0xa')](_0x5898('0x13'),_0x1b013d[_0x5898('0x4')],_0x1b013d[_0x5898('0x14')],_0x1b013d[_0x5898('0xd')]));}else if(!_[_0x5898('0x15')](recordings[_0x1b013d[_0x5898('0x16')]])&&_0x1b013d[_0x5898('0x12')]==0x6&&_0x1b013d['context']!=_0x5898('0x17')){utils[_0x5898('0x3')](util['format'](_0x5898('0x18'),_0x1b013d[_0x5898('0x4')],_0x1b013d['linkedid'],_0x1b013d[_0x5898('0x14')],_0x1b013d['channel']));recordings[_0x1b013d[_0x5898('0x16')]][_0x5898('0x5')]=_0x1b013d[_0x5898('0x5')];}}catch(_0x1e68a8){utils[_0x5898('0x19')](util[_0x5898('0xa')](_0x5898('0x11'),_0x1b013d['uniqueid']),_0x1e68a8);}};exports[_0x5898('0x1a')]=function(_0x50eb57){try{if(!_[_0x5898('0x15')](_0x50eb57[_0x5898('0x1b')])&&!_[_0x5898('0x15')](_0x50eb57['variable'][_0x5898('0x1c')])){utils['debug'](util[_0x5898('0xa')](_0x5898('0x1d'),_0x50eb57[_0x5898('0x4')]),_0x50eb57);utils[_0x5898('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x50eb57[_0x5898('0x4')],_0x50eb57['variable'],_0x50eb57[_0x5898('0x1e')]));if(_[_0x5898('0x1f')](_0x50eb57[_0x5898('0x1e')],_0x5898('0x20'))){_0x50eb57[_0x5898('0x1e')]=_0x50eb57[_0x5898('0x1e')][_0x5898('0x21')]('.wav49',_0x5898('0x22'));}if(recordings[_0x50eb57[_0x5898('0x16')]]){var _0x4bf177=_['find'](recordings[_0x50eb57[_0x5898('0x16')]][_0x5898('0x23')],{'value':_0x50eb57[_0x5898('0x1e')]});if(_['isNil'](_0x4bf177)){recordings[_0x50eb57[_0x5898('0x16')]][_0x5898('0x23')][_0x5898('0x24')]({'value':_0x50eb57[_0x5898('0x1e')]});}}}}catch(_0x1c8fd3){utils[_0x5898('0x19')](util[_0x5898('0xa')](_0x5898('0x1d'),_0x50eb57[_0x5898('0x4')]),_0x1c8fd3);}};exports[_0x5898('0x25')]=function(_0x4debb3){try{if(!_[_0x5898('0x15')](recordings[_0x4debb3['uniqueid']])){utils[_0x5898('0x10')](util[_0x5898('0xa')]('[%s][recordings][hangup]',_0x4debb3[_0x5898('0x4')]),_0x4debb3);utils[_0x5898('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4debb3[_0x5898('0x4')],_0x4debb3['calleridnum'],_0x4debb3[_0x5898('0x26')],_0x4debb3[_0x5898('0x27')]));recordings[_0x4debb3['uniqueid']][_0x5898('0x28')]=_0x4debb3['calleridnum'];recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x26')]=_0x4debb3['calleridname'];recordings[_0x4debb3['uniqueid']]['connectedlinenum']=_0x4debb3[_0x5898('0x29')];recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x2a')]=_0x4debb3[_0x5898('0x2a')];if(recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x2b')]==_0x5898('0x2c')&&recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x5')]){recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x29')]=recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x5')];recordings[_0x4debb3[_0x5898('0x4')]][_0x5898('0x2a')]='';}recordings[_0x4debb3['uniqueid']][_0x5898('0x23')]['forEach'](function(_0x5bcbd2){var _0x44779f=_[_0x5898('0x2d')](recordings[_0x4debb3[_0x5898('0x4')]]);_0x44779f[_0x5898('0x1e')]=_0x5bcbd2[_0x5898('0x1e')];writeDB(_0x44779f);});delete recordings[_0x4debb3[_0x5898('0x4')]];}}catch(_0x2e7ec0){utils[_0x5898('0x19')](util['format'](_0x5898('0x2e'),_0x4debb3[_0x5898('0x4')]),_0x2e7ec0);}};exports[_0x5898('0x2f')]=function(_0x23227f){try{if(!_[_0x5898('0x15')](recordings[_0x23227f['uniqueid']])){utils['debug'](util[_0x5898('0xa')]('[%s][recordings][newexten]',_0x23227f['uniqueid']),_0x23227f);utils[_0x5898('0x3')](util[_0x5898('0xa')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x23227f[_0x5898('0x4')],_0x23227f[_0x5898('0x30')],_0x23227f[_0x5898('0x31')]));if(_0x23227f[_0x5898('0x30')]['toLowerCase']()==_0x5898('0x32')&&_[_0x5898('0x33')](_0x23227f[_0x5898('0x31')][_0x5898('0x34')](),_0x5898('0x35'))){var _0x19c4e2=_0x23227f['appdata'][_0x5898('0x36')]('=');var _0x3ded35=_0x19c4e2[0x0][_0x5898('0x37')](_0x19c4e2[0x0][_0x5898('0x38')]('(')+0x1,_0x19c4e2[0x0]['lastIndexOf'](')'));var _0x529d4a=_0x19c4e2[0x1];recordings[_0x23227f[_0x5898('0x4')]][_0x3ded35]=_0x529d4a;}}}catch(_0x25c057){utils[_0x5898('0x19')](util[_0x5898('0xa')](_0x5898('0x39'),_0x23227f['uniqueid']),_0x25c057);}};exports[_0x5898('0x3a')]=function(_0x4d14ca){try{if(!_[_0x5898('0x15')](recordings[_0x4d14ca[_0x5898('0x4')]])){utils[_0x5898('0x10')](util['format'](_0x5898('0x3b'),_0x4d14ca[_0x5898('0x4')]),_0x4d14ca);utils['info'](util[_0x5898('0xa')](_0x5898('0x3c'),_0x4d14ca[_0x5898('0x4')],_0x4d14ca['queue']));recordings[_0x4d14ca['uniqueid']][_0x5898('0x3d')]=_0x4d14ca[_0x5898('0x3d')];}}catch(_0x2a1b9e){utils[_0x5898('0x19')](util[_0x5898('0xa')](_0x5898('0x3b'),_0x4d14ca[_0x5898('0x4')]),_0x2a1b9e);}}; \ No newline at end of file +var _0xaf80=['toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','uniqueid','accountcode','getUserByInternal','then','UserId','CreateVoiceRecording','request','debug','format','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaf80,0x1ef));var _0x0af8=function(_0x154712,_0x3faeb1){_0x154712=_0x154712-0x0;var _0x59b922=_0xaf80[_0x154712];return _0x59b922;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var utils=require(_0x0af8('0x2'));var recordings={};function writeDB(_0x146357){utils['info'](util['format']('[%s][recordings][writeDB]',_0x146357[_0x0af8('0x3')]));if(_0x146357[_0x0af8('0x4')]){utils[_0x0af8('0x5')](_0x146357[_0x0af8('0x4')])[_0x0af8('0x6')](function(_0x20fdc5){if(_0x20fdc5){_0x146357['membername']=_0x20fdc5['name'];_0x146357[_0x0af8('0x7')]=_0x20fdc5['id'];}utils['request'](_0x0af8('0x8'),_0x146357);});}else{utils[_0x0af8('0x9')](_0x0af8('0x8'),_0x146357);}}exports['newchannel']=function(_0xc0d5eb){try{utils[_0x0af8('0xa')](util[_0x0af8('0xb')]('[%s][recordings][newchannel]',_0xc0d5eb['uniqueid']),_0xc0d5eb);if(_0xc0d5eb[_0x0af8('0x3')]==_0xc0d5eb[_0x0af8('0xc')]){utils[_0x0af8('0xd')](util[_0x0af8('0xb')](_0x0af8('0xe'),_0xc0d5eb['uniqueid'],_0xc0d5eb[_0x0af8('0xf')],_0xc0d5eb[_0x0af8('0x10')]));recordings[_0xc0d5eb[_0x0af8('0x3')]]={'uniqueid':_0xc0d5eb[_0x0af8('0x3')],'accountcode':_0xc0d5eb[_0x0af8('0x4')],'exten':_0xc0d5eb[_0x0af8('0x10')],'context':_0xc0d5eb[_0x0af8('0xf')],'channel':_0xc0d5eb['channel'],'monitors':[]};}}catch(_0x58ef18){utils[_0x0af8('0x11')](util[_0x0af8('0xb')](_0x0af8('0x12'),_0xc0d5eb[_0x0af8('0x3')]),_0x58ef18);}};exports[_0x0af8('0x13')]=function(_0x1997b8){try{utils[_0x0af8('0xa')](util[_0x0af8('0xb')]('[%s][recordings][newstate]',_0x1997b8['uniqueid']),_0x1997b8);if(!_['isNil'](recordings[_0x1997b8[_0x0af8('0x3')]])&&_0x1997b8[_0x0af8('0x14')]==0x6){utils['info'](util[_0x0af8('0xb')](_0x0af8('0x15'),_0x1997b8[_0x0af8('0x3')],_0x1997b8['context'],_0x1997b8['channel']));}else if(!_['isNil'](recordings[_0x1997b8[_0x0af8('0xc')]])&&_0x1997b8[_0x0af8('0x14')]==0x6&&_0x1997b8['context']!=_0x0af8('0x16')){utils['info'](util['format'](_0x0af8('0x17'),_0x1997b8[_0x0af8('0x3')],_0x1997b8[_0x0af8('0xc')],_0x1997b8[_0x0af8('0xf')],_0x1997b8[_0x0af8('0x18')]));recordings[_0x1997b8['linkedid']]['accountcode']=_0x1997b8[_0x0af8('0x4')];}}catch(_0x309795){utils[_0x0af8('0x11')](util[_0x0af8('0xb')](_0x0af8('0x19'),_0x1997b8[_0x0af8('0x3')]),_0x309795);}};exports[_0x0af8('0x1a')]=function(_0x43e3d1){try{if(!_['isNil'](_0x43e3d1['variable'])&&!_[_0x0af8('0x1b')](_0x43e3d1[_0x0af8('0x1c')][_0x0af8('0x1d')])){utils[_0x0af8('0xa')](util['format']('[%s][recordings][varset]',_0x43e3d1[_0x0af8('0x3')]),_0x43e3d1);utils[_0x0af8('0xd')](util[_0x0af8('0xb')](_0x0af8('0x1e'),_0x43e3d1[_0x0af8('0x3')],_0x43e3d1[_0x0af8('0x1c')],_0x43e3d1[_0x0af8('0x1f')]));if(_['endsWith'](_0x43e3d1[_0x0af8('0x1f')],_0x0af8('0x20'))){_0x43e3d1[_0x0af8('0x1f')]=_0x43e3d1[_0x0af8('0x1f')][_0x0af8('0x21')](_0x0af8('0x20'),_0x0af8('0x22'));}if(recordings[_0x43e3d1[_0x0af8('0xc')]]){var _0x80bdcc=_[_0x0af8('0x23')](recordings[_0x43e3d1[_0x0af8('0xc')]]['monitors'],{'value':_0x43e3d1[_0x0af8('0x1f')]});if(_['isNil'](_0x80bdcc)){recordings[_0x43e3d1[_0x0af8('0xc')]]['monitors'][_0x0af8('0x24')]({'value':_0x43e3d1[_0x0af8('0x1f')]});}}}}catch(_0x535352){utils[_0x0af8('0x11')](util[_0x0af8('0xb')](_0x0af8('0x25'),_0x43e3d1['uniqueid']),_0x535352);}};exports[_0x0af8('0x26')]=function(_0x3c6884){try{if(!_[_0x0af8('0x1b')](recordings[_0x3c6884['uniqueid']])){utils[_0x0af8('0xa')](util[_0x0af8('0xb')](_0x0af8('0x27'),_0x3c6884[_0x0af8('0x3')]),_0x3c6884);utils[_0x0af8('0xd')](util[_0x0af8('0xb')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3c6884[_0x0af8('0x3')],_0x3c6884[_0x0af8('0x28')],_0x3c6884[_0x0af8('0x29')],_0x3c6884[_0x0af8('0x2a')]));recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x28')]=_0x3c6884[_0x0af8('0x28')];recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x29')]=_0x3c6884[_0x0af8('0x29')];recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x2b')]=_0x3c6884['connectedlinenum'];recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x2c')]=_0x3c6884[_0x0af8('0x2c')];if(recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x2d')]==_0x0af8('0x2e')&&recordings[_0x3c6884[_0x0af8('0x3')]]['accountcode']){recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x2b')]=recordings[_0x3c6884[_0x0af8('0x3')]]['accountcode'];recordings[_0x3c6884[_0x0af8('0x3')]][_0x0af8('0x2c')]='';}recordings[_0x3c6884[_0x0af8('0x3')]]['monitors'][_0x0af8('0x2f')](function(_0x122382){var _0x344bcb=_[_0x0af8('0x30')](recordings[_0x3c6884[_0x0af8('0x3')]]);_0x344bcb[_0x0af8('0x1f')]=_0x122382[_0x0af8('0x1f')];writeDB(_0x344bcb);});delete recordings[_0x3c6884['uniqueid']];}}catch(_0x586924){utils[_0x0af8('0x11')](util[_0x0af8('0xb')]('[%s][recordings][hangup]',_0x3c6884[_0x0af8('0x3')]),_0x586924);}};exports[_0x0af8('0x31')]=function(_0x52b98b){try{if(!_[_0x0af8('0x1b')](recordings[_0x52b98b['uniqueid']])){utils[_0x0af8('0xa')](util[_0x0af8('0xb')]('[%s][recordings][newexten]',_0x52b98b[_0x0af8('0x3')]),_0x52b98b);utils[_0x0af8('0xd')](util['format'](_0x0af8('0x32'),_0x52b98b['uniqueid'],_0x52b98b[_0x0af8('0x33')],_0x52b98b[_0x0af8('0x34')]));if(_0x52b98b[_0x0af8('0x33')]['toLowerCase']()=='set'&&_[_0x0af8('0x35')](_0x52b98b[_0x0af8('0x34')][_0x0af8('0x36')](),_0x0af8('0x37'))){var _0x59bb96=_0x52b98b[_0x0af8('0x34')][_0x0af8('0x38')]('=');var _0x32e32f=_0x59bb96[0x0]['substring'](_0x59bb96[0x0][_0x0af8('0x39')]('(')+0x1,_0x59bb96[0x0][_0x0af8('0x39')](')'));var _0x5039ea=_0x59bb96[0x1];recordings[_0x52b98b[_0x0af8('0x3')]][_0x32e32f]=_0x5039ea;}}}catch(_0x5babc4){utils[_0x0af8('0x11')](util['format']('[%s][recordings][newexten]',_0x52b98b['uniqueid']),_0x5babc4);}};exports[_0x0af8('0x3a')]=function(_0x5afb76){try{if(!_[_0x0af8('0x1b')](recordings[_0x5afb76['uniqueid']])){utils[_0x0af8('0xa')](util[_0x0af8('0xb')](_0x0af8('0x3b'),_0x5afb76[_0x0af8('0x3')]),_0x5afb76);utils[_0x0af8('0xd')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5afb76[_0x0af8('0x3')],_0x5afb76[_0x0af8('0x3c')]));recordings[_0x5afb76[_0x0af8('0x3')]][_0x0af8('0x3c')]=_0x5afb76[_0x0af8('0x3c')];}}catch(_0x1b352e){utils[_0x0af8('0x11')](util['format']('[%s][recordings][queuecallerjoin]',_0x5afb76[_0x0af8('0x3')]),_0x1b352e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 879a27c..b0c8fe7 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 _0x864b=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x36120e,_0x30bf2b){var _0x3c84e3=function(_0xb6ef61){while(--_0xb6ef61){_0x36120e['push'](_0x36120e['shift']());}};_0x3c84e3(++_0x30bf2b);}(_0x864b,0x94));var _0xb864=function(_0x93202d,_0x225d91){_0x93202d=_0x93202d-0x0;var _0x2cb7a2=_0x864b[_0x93202d];return _0x2cb7a2;};'use strict';var _=require('lodash');var util=require(_0xb864('0x0'));var utils=require('./utils');function writeDB(_0x2b88fc){utils[_0xb864('0x1')](util[_0xb864('0x2')](_0xb864('0x3'),_0x2b88fc[_0xb864('0x4')]==='attended'?_0x2b88fc[_0xb864('0x5')]:_0x2b88fc[_0xb864('0x6')],_0x2b88fc[_0xb864('0x4')]));utils['request'](_0xb864('0x7'),_0x2b88fc);}exports['blindtransfer']=function(_0x466b43){try{utils[_0xb864('0x8')](util[_0xb864('0x2')](_0xb864('0x9'),_0x466b43[_0xb864('0x6')]),_0x466b43);utils[_0xb864('0x1')](util[_0xb864('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x466b43[_0xb864('0x6')],_0x466b43[_0xb864('0xa')],_0x466b43[_0xb864('0xb')],_0x466b43[_0xb864('0xc')],_0x466b43[_0xb864('0xd')]));_0x466b43[_0xb864('0x4')]='blind';writeDB(_0x466b43);}catch(_0xb869df){utils[_0xb864('0xe')](util[_0xb864('0x2')](_0xb864('0x9'),_0x466b43[_0xb864('0x6')]),_0xb869df);}};exports[_0xb864('0xf')]=function(_0x39b1fe){try{utils[_0xb864('0x8')](util[_0xb864('0x2')](_0xb864('0x10'),_0x39b1fe[_0xb864('0x5')]),_0x39b1fe);utils[_0xb864('0x1')](util[_0xb864('0x2')](_0xb864('0x11'),_0x39b1fe[_0xb864('0x5')],_0x39b1fe['origtransferercalleridnum'],_0x39b1fe[_0xb864('0x12')],_0x39b1fe[_0xb864('0x13')],_0x39b1fe['transfertargetcalleridname']));_0x39b1fe=_[_0xb864('0x14')](_0x39b1fe,{'transfererchannel':_0x39b1fe[_0xb864('0x15')],'transferercalleridnum':_0x39b1fe['origtransferercalleridnum'],'transferercalleridname':_0x39b1fe[_0xb864('0x12')],'transfererconnectedlinenum':_0x39b1fe['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x39b1fe[_0xb864('0x16')],'transfereraccountcode':_0x39b1fe[_0xb864('0x17')],'transferercontext':_0x39b1fe['secondtransferercontext'],'transfererexten':_0x39b1fe[_0xb864('0x18')],'transfererlinkedid':_0x39b1fe['origtransfererlinkedid'],'context':_0x39b1fe[_0xb864('0x19')],'extension':_0x39b1fe[_0xb864('0x1a')],'type':'attended'});if(_[_0xb864('0x1b')](_0x39b1fe[_0xb864('0x1c')])){_0x39b1fe=_['assign'](_0x39b1fe,{'transfereechannel':_0x39b1fe['transfertargetchannel'],'transfereecalleridnum':_0x39b1fe[_0xb864('0x13')],'transfereecalleridname':_0x39b1fe[_0xb864('0x1d')],'transfereeconnectedlinenum':_0x39b1fe[_0xb864('0x1e')],'transfereeconnectedlinename':_0x39b1fe[_0xb864('0x1f')],'transfereeaccountcode':_0x39b1fe[_0xb864('0x20')],'transfereecontext':_0x39b1fe[_0xb864('0x21')],'transfereeexten':_0x39b1fe[_0xb864('0x22')],'transfereelinkedid':_0x39b1fe[_0xb864('0x23')]});}writeDB(_0x39b1fe);}catch(_0x13a832){utils[_0xb864('0xe')](util[_0xb864('0x2')](_0xb864('0x10'),_0x39b1fe[_0xb864('0x5')]),_0x13a832);}}; \ No newline at end of file +var _0xb8ca=['[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','format'];(function(_0x40a10e,_0x17bea7){var _0x5c2612=function(_0x4a57ed){while(--_0x4a57ed){_0x40a10e['push'](_0x40a10e['shift']());}};_0x5c2612(++_0x17bea7);}(_0xb8ca,0x140));var _0xab8c=function(_0x4b2da4,_0x11620b){_0x4b2da4=_0x4b2da4-0x0;var _0x2d5697=_0xb8ca[_0x4b2da4];return _0x2d5697;};'use strict';var _=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var utils=require(_0xab8c('0x2'));function writeDB(_0x435f63){utils['info'](util[_0xab8c('0x3')](_0xab8c('0x4'),_0x435f63['type']===_0xab8c('0x5')?_0x435f63['origtransfereruniqueid']:_0x435f63[_0xab8c('0x6')],_0x435f63['type']));utils[_0xab8c('0x7')](_0xab8c('0x8'),_0x435f63);}exports[_0xab8c('0x9')]=function(_0x4d7403){try{utils[_0xab8c('0xa')](util[_0xab8c('0x3')](_0xab8c('0xb'),_0x4d7403[_0xab8c('0x6')]),_0x4d7403);utils['info'](util[_0xab8c('0x3')](_0xab8c('0xc'),_0x4d7403[_0xab8c('0x6')],_0x4d7403[_0xab8c('0xd')],_0x4d7403['transferercalleridname'],_0x4d7403[_0xab8c('0xe')],_0x4d7403['transfereecalleridname']));_0x4d7403['type']=_0xab8c('0xf');writeDB(_0x4d7403);}catch(_0x20f170){utils[_0xab8c('0x10')](util[_0xab8c('0x3')]('[%s][transfers][blindtransfer]',_0x4d7403[_0xab8c('0x6')]),_0x20f170);}};exports['attendedtransfer']=function(_0x4e9ed3){try{utils[_0xab8c('0xa')](util[_0xab8c('0x3')](_0xab8c('0x11'),_0x4e9ed3['origtransfereruniqueid']),_0x4e9ed3);utils['info'](util['format'](_0xab8c('0x12'),_0x4e9ed3[_0xab8c('0x13')],_0x4e9ed3[_0xab8c('0x14')],_0x4e9ed3['origtransferercalleridname'],_0x4e9ed3[_0xab8c('0x15')],_0x4e9ed3[_0xab8c('0x16')]));_0x4e9ed3=_[_0xab8c('0x17')](_0x4e9ed3,{'transfererchannel':_0x4e9ed3['origtransfererchannel'],'transferercalleridnum':_0x4e9ed3['origtransferercalleridnum'],'transferercalleridname':_0x4e9ed3[_0xab8c('0x18')],'transfererconnectedlinenum':_0x4e9ed3[_0xab8c('0x19')],'transfererconnectedlinename':_0x4e9ed3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4e9ed3[_0xab8c('0x1a')],'transferercontext':_0x4e9ed3['secondtransferercontext'],'transfererexten':_0x4e9ed3[_0xab8c('0x1b')],'transfererlinkedid':_0x4e9ed3[_0xab8c('0x1c')],'context':_0x4e9ed3['origtransferercontext'],'extension':_0x4e9ed3[_0xab8c('0x1d')],'type':_0xab8c('0x5')});if(_['isNil'](_0x4e9ed3[_0xab8c('0x1e')])){_0x4e9ed3=_[_0xab8c('0x17')](_0x4e9ed3,{'transfereechannel':_0x4e9ed3[_0xab8c('0x1f')],'transfereecalleridnum':_0x4e9ed3['transfertargetcalleridnum'],'transfereecalleridname':_0x4e9ed3[_0xab8c('0x16')],'transfereeconnectedlinenum':_0x4e9ed3[_0xab8c('0x20')],'transfereeconnectedlinename':_0x4e9ed3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4e9ed3[_0xab8c('0x21')],'transfereecontext':_0x4e9ed3[_0xab8c('0x22')],'transfereeexten':_0x4e9ed3['transfertargetexten'],'transfereelinkedid':_0x4e9ed3[_0xab8c('0x23')]});}writeDB(_0x4e9ed3);}catch(_0x58822c){utils[_0xab8c('0x10')](util[_0xab8c('0x3')](_0xab8c('0x11'),_0x4e9ed3[_0xab8c('0x13')]),_0x58822c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 7468081..559161a 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 _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(_0x1da08f,_0x4c155d){var _0x35856b=function(_0xe6fb31){while(--_0xe6fb31){_0x1da08f['push'](_0x1da08f['shift']());}};_0x35856b(++_0x4c155d);}(_0x7a54,0x106));var _0x47a5=function(_0x241e63,_0x282597){_0x241e63=_0x241e63-0x0;var _0x329039=_0x7a54[_0x241e63];return _0x329039;};'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 +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(_0xa03db6,_0x436e2c){var _0x1e7e80=function(_0x4d4747){while(--_0x4d4747){_0xa03db6['push'](_0xa03db6['shift']());}};_0x1e7e80(++_0x436e2c);}(_0x7a54,0x106));var _0x47a5=function(_0x5e7216,_0x221a00){_0x5e7216=_0x5e7216-0x0;var _0xcc70da=_0x7a54[_0x5e7216];return _0xcc70da;};'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